From: Andrea Amorese Date: Tue, 14 Sep 2021 08:56:18 +0000 (+0200) Subject: Built motion from commit c4823e9f.|2.5.345 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22thisimagedoesnotexist.png/%22javascript:;//%22%7B%7Blicense.fax?a=commitdiff_plain;h=11c1f79a8b52d5ba0a0ed5a1bd78f84ee6537dd3;p=motion2.git Built motion from commit c4823e9f.|2.5.345 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f5497cb..174aec6 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-09-14T08:20:49.875Z", + "time": "2021-09-14T08:43:48.915Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8c91f7f..aca68c0 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-14T08:20:49.875Z", + "time": "2021-09-14T08:43:48.915Z", "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 f5b511a..bc97cc6 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 _0x9fd4=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','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)]','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)]'];(function(_0x1e0327,_0x3797c2){var _0x337c9f=function(_0x5f2f3a){while(--_0x5f2f3a){_0x1e0327['push'](_0x1e0327['shift']());}};_0x337c9f(++_0x3797c2);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x9fd4[_0x3a3c17];return _0xd07f21;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'get':function(_0x30771e){return this[_0x49fd('0x3')](_0x49fd('0x4'));}},'action':{'type':Sequelize[_0x49fd('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x49fd('0x6'),_0x49fd('0x7'),'motionbar','jscripty',_0x49fd('0x8'),_0x49fd('0x9'),_0x49fd('0xa'),_0x49fd('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x49fd('0xc')},'data1':{'type':Sequelize[_0x49fd('0x5')](0x1000),'comment':_0x49fd('0xd')},'data2':{'type':Sequelize[_0x49fd('0x5')](0x1000),'comment':_0x49fd('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x49fd('0xf')},'data4':{'type':Sequelize[_0x49fd('0x5')](0x1000),'comments':_0x49fd('0x10')},'data5':{'type':Sequelize[_0x49fd('0x5')](0x1000),'comments':_0x49fd('0x11')},'data6':{'type':Sequelize[_0x49fd('0x5')],'comments':_0x49fd('0x12')},'data7':{'type':Sequelize['TEXT'],'comments':_0x49fd('0x13')}}; \ No newline at end of file +var _0x6eed=['exports','VIRTUAL','getDataValue','STRING','contactManager','jscripty','urlForward','browser','bot','script','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','TEXT','urlForward[body]','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6eed,0xff));var _0xd6ee=function(_0x3f761d,_0x5d907d){_0x3f761d=_0x3f761d-0x0;var _0x49d6e3=_0x6eed[_0x3f761d];return _0x49d6e3;};'use strict';var Sequelize=require(_0xd6ee('0x0'));module[_0xd6ee('0x1')]={'name':{'type':Sequelize[_0xd6ee('0x2')],'get':function(_0x27b7bf){return this[_0xd6ee('0x3')]('action');}},'action':{'type':Sequelize[_0xd6ee('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd6ee('0x5'),'integration','motionbar',_0xd6ee('0x6'),_0xd6ee('0x7'),_0xd6ee('0x8'),_0xd6ee('0x9'),_0xd6ee('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xd6ee('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xd6ee('0x4')](0x1000),'comment':_0xd6ee('0xb')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xd6ee('0xc')},'data5':{'type':Sequelize[_0xd6ee('0x4')](0x1000),'comments':_0xd6ee('0xd')},'data6':{'type':Sequelize[_0xd6ee('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xd6ee('0xe')],'comments':_0xd6ee('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index fff7885..717a0d3 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 _0x140e=['params','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','name','send','update','Action','find','body','catch'];(function(_0x18b7eb,_0x19e89d){var _0x525d5e=function(_0x4b9e34){while(--_0x4b9e34){_0x18b7eb['push'](_0x18b7eb['shift']());}};_0x525d5e(++_0x19e89d);}(_0x140e,0x1e1));var _0xe140=function(_0x46b83c,_0x1fc79c){_0x46b83c=_0x46b83c-0x0;var _0x25eb27=_0x140e[_0x46b83c];return _0x25eb27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe140('0x0'));var zipdir=require(_0xe140('0x1'));var jsonpatch=require(_0xe140('0x2'));var rp=require(_0xe140('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe140('0x4'));var path=require('path');var sox=require(_0xe140('0x5'));var csv=require(_0xe140('0x6'));var ejs=require(_0xe140('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe140('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xe140('0x9'));var toCsv=require(_0xe140('0x6'));var querystring=require(_0xe140('0xa'));var Papa=require(_0xe140('0xb'));var Redis=require('ioredis');var authService=require(_0xe140('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe140('0xd'));var hardwareService=require(_0xe140('0xe'));var logger=require(_0xe140('0xf'))(_0xe140('0x10'));var utils=require('../../config/utils');var config=require(_0xe140('0x11'));var licenseUtil=require(_0xe140('0x12'));var db=require(_0xe140('0x13'))['db'];function respondWithStatusCode(_0x3a5109,_0x442928){_0x442928=_0x442928||0xcc;return function(_0x5022a3){if(_0x5022a3){return _0x3a5109[_0xe140('0x14')](_0x442928);}return _0x3a5109[_0xe140('0x15')](_0x442928)[_0xe140('0x16')]();};}function respondWithResult(_0x1b9d67,_0xa72b47){_0xa72b47=_0xa72b47||0xc8;return function(_0x580915){if(_0x580915){return _0x1b9d67[_0xe140('0x15')](_0xa72b47)[_0xe140('0x17')](_0x580915);}};}function respondWithFilteredResult(_0x223e84,_0x3e2f10){return function(_0x591089){if(_0x591089){var _0x34884e=typeof _0x3e2f10[_0xe140('0x18')]===_0xe140('0x19')&&typeof _0x3e2f10['limit']===_0xe140('0x19');var _0x33325b=_0x591089['count'];var _0x4877ca=_0x34884e?0x0:_0x3e2f10[_0xe140('0x18')];var _0x36d84f=_0x34884e?_0x591089[_0xe140('0x1a')]:_0x3e2f10[_0xe140('0x18')]+_0x3e2f10['limit'];var _0x2263a6;if(_0x36d84f>=_0x33325b){_0x36d84f=_0x33325b;_0x2263a6=0xc8;}else{_0x2263a6=0xce;}_0x223e84[_0xe140('0x15')](_0x2263a6);return _0x223e84[_0xe140('0x1b')](_0xe140('0x1c'),_0x4877ca+'-'+_0x36d84f+'/'+_0x33325b)[_0xe140('0x17')](_0x591089);}return null;};}function patchUpdates(_0x360e36){return function(_0x3f5fcd){try{jsonpatch[_0xe140('0x1d')](_0x3f5fcd,_0x360e36,!![]);}catch(_0x5effc6){return BPromise[_0xe140('0x1e')](_0x5effc6);}return _0x3f5fcd['save']();};}function saveUpdates(_0x20bcbe,_0x487b97){return function(_0x22ab16){if(_0x22ab16){return _0x22ab16['update'](_0x20bcbe)[_0xe140('0x1f')](function(_0x51add5){return _0x51add5;});}return null;};}function removeEntity(_0x3fc7c5,_0x1831e6){return function(_0x209825){if(_0x209825){return _0x209825['destroy']()[_0xe140('0x1f')](function(){_0x3fc7c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd677,_0x91c7c6){return function(_0x4f1248){if(!_0x4f1248){_0xcd677['sendStatus'](0x194);}return _0x4f1248;};}function handleError(_0x22522c,_0x1f27b9){_0x1f27b9=_0x1f27b9||0x1f4;return function(_0x1006a2){logger['error'](_0x1006a2['stack']);if(_0x1006a2[_0xe140('0x20')]){delete _0x1006a2[_0xe140('0x20')];}_0x22522c[_0xe140('0x15')](_0x1f27b9)[_0xe140('0x21')](_0x1006a2);};}exports[_0xe140('0x22')]=function(_0x4e8350,_0x326a91){if(_0x4e8350['body']['id']){delete _0x4e8350['body']['id'];}return db[_0xe140('0x23')][_0xe140('0x24')]({'where':{'id':_0x4e8350['params']['id']}})[_0xe140('0x1f')](handleEntityNotFound(_0x326a91,null))['then'](saveUpdates(_0x4e8350[_0xe140('0x25')],null))[_0xe140('0x1f')](respondWithResult(_0x326a91,null))[_0xe140('0x26')](handleError(_0x326a91,null));};exports['destroy']=function(_0x1ec8d4,_0x38f37e){return db[_0xe140('0x23')][_0xe140('0x24')]({'where':{'id':_0x1ec8d4[_0xe140('0x27')]['id']}})['then'](handleEntityNotFound(_0x38f37e,null))['then'](removeEntity(_0x38f37e,null))[_0xe140('0x26')](handleError(_0x38f37e,null));}; \ No newline at end of file +var _0xc08e=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','body','find','Action','params','catch','eml-format','rimraf','request-promise'];(function(_0x27d8e2,_0x3808e6){var _0x1a980b=function(_0x23ece1){while(--_0x23ece1){_0x27d8e2['push'](_0x27d8e2['shift']());}};_0x1a980b(++_0x3808e6);}(_0xc08e,0xbd));var _0xec08=function(_0x5cb5b1,_0xafc0d6){_0x5cb5b1=_0x5cb5b1-0x0;var _0x22d423=_0xc08e[_0x5cb5b1];return _0x22d423;};'use strict';var emlformat=require(_0xec08('0x0'));var rimraf=require(_0xec08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xec08('0x2'));var moment=require(_0xec08('0x3'));var BPromise=require(_0xec08('0x4'));var Mustache=require(_0xec08('0x5'));var util=require('util');var path=require(_0xec08('0x6'));var sox=require(_0xec08('0x7'));var csv=require(_0xec08('0x8'));var ejs=require(_0xec08('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec08('0xa'));var squel=require(_0xec08('0xb'));var crypto=require(_0xec08('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xec08('0xd'));var toCsv=require(_0xec08('0x8'));var querystring=require(_0xec08('0xe'));var Papa=require(_0xec08('0xf'));var Redis=require(_0xec08('0x10'));var authService=require(_0xec08('0x11'));var qs=require(_0xec08('0x12'));var as=require(_0xec08('0x13'));var hardwareService=require(_0xec08('0x14'));var logger=require(_0xec08('0x15'))(_0xec08('0x16'));var utils=require(_0xec08('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xec08('0x18'))['db'];function respondWithStatusCode(_0x3ae005,_0x1c74a7){_0x1c74a7=_0x1c74a7||0xcc;return function(_0x1a380f){if(_0x1a380f){return _0x3ae005['sendStatus'](_0x1c74a7);}return _0x3ae005['status'](_0x1c74a7)[_0xec08('0x19')]();};}function respondWithResult(_0x472b1e,_0x548772){_0x548772=_0x548772||0xc8;return function(_0xef5838){if(_0xef5838){return _0x472b1e[_0xec08('0x1a')](_0x548772)[_0xec08('0x1b')](_0xef5838);}};}function respondWithFilteredResult(_0x318bef,_0x50bd7f){return function(_0x51b028){if(_0x51b028){var _0x35145c=typeof _0x50bd7f['offset']===_0xec08('0x1c')&&typeof _0x50bd7f['limit']===_0xec08('0x1c');var _0x3a3bf1=_0x51b028[_0xec08('0x1d')];var _0x329e63=_0x35145c?0x0:_0x50bd7f[_0xec08('0x1e')];var _0x122164=_0x35145c?_0x51b028[_0xec08('0x1d')]:_0x50bd7f['offset']+_0x50bd7f['limit'];var _0x5b4108;if(_0x122164>=_0x3a3bf1){_0x122164=_0x3a3bf1;_0x5b4108=0xc8;}else{_0x5b4108=0xce;}_0x318bef[_0xec08('0x1a')](_0x5b4108);return _0x318bef['set'](_0xec08('0x1f'),_0x329e63+'-'+_0x122164+'/'+_0x3a3bf1)[_0xec08('0x1b')](_0x51b028);}return null;};}function patchUpdates(_0x50ee24){return function(_0x3588d4){try{jsonpatch[_0xec08('0x20')](_0x3588d4,_0x50ee24,!![]);}catch(_0x33aa95){return BPromise[_0xec08('0x21')](_0x33aa95);}return _0x3588d4[_0xec08('0x22')]();};}function saveUpdates(_0x3fc93d,_0x3a21f2){return function(_0x1df01d){if(_0x1df01d){return _0x1df01d[_0xec08('0x23')](_0x3fc93d)['then'](function(_0xeeff9e){return _0xeeff9e;});}return null;};}function removeEntity(_0x4b4fe6,_0x9e725c){return function(_0x23e20a){if(_0x23e20a){return _0x23e20a[_0xec08('0x24')]()[_0xec08('0x25')](function(){_0x4b4fe6[_0xec08('0x1a')](0xcc)[_0xec08('0x19')]();});}};}function handleEntityNotFound(_0xf45bfa,_0x3ab65d){return function(_0x57b5f3){if(!_0x57b5f3){_0xf45bfa[_0xec08('0x26')](0x194);}return _0x57b5f3;};}function handleError(_0x82d292,_0x4913d4){_0x4913d4=_0x4913d4||0x1f4;return function(_0x377769){logger[_0xec08('0x27')](_0x377769[_0xec08('0x28')]);if(_0x377769[_0xec08('0x29')]){delete _0x377769[_0xec08('0x29')];}_0x82d292['status'](_0x4913d4)[_0xec08('0x2a')](_0x377769);};}exports[_0xec08('0x23')]=function(_0x311d33,_0x216c97){if(_0x311d33[_0xec08('0x2b')]['id']){delete _0x311d33[_0xec08('0x2b')]['id'];}return db['Action'][_0xec08('0x2c')]({'where':{'id':_0x311d33['params']['id']}})[_0xec08('0x25')](handleEntityNotFound(_0x216c97,null))[_0xec08('0x25')](saveUpdates(_0x311d33['body'],null))[_0xec08('0x25')](respondWithResult(_0x216c97,null))['catch'](handleError(_0x216c97,null));};exports[_0xec08('0x24')]=function(_0x39d7e1,_0x5dded5){return db[_0xec08('0x2d')][_0xec08('0x2c')]({'where':{'id':_0x39d7e1[_0xec08('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5dded5,null))[_0xec08('0x25')](removeEntity(_0x5dded5,null))[_0xec08('0x2f')](handleError(_0x5dded5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 905b070..54af11e 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 _0x899d=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','Action','tools_actions','lodash','util'];(function(_0x5e6d6a,_0x2ab8cf){var _0x3df9f7=function(_0x7c55d){while(--_0x7c55d){_0x5e6d6a['push'](_0x5e6d6a['shift']());}};_0x3df9f7(++_0x2ab8cf);}(_0x899d,0xca));var _0xd899=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x899d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd899('0x0'));var util=require(_0xd899('0x1'));var logger=require(_0xd899('0x2'))(_0xd899('0x3'));var moment=require('moment');var BPromise=require(_0xd899('0x4'));var rp=require(_0xd899('0x5'));var fs=require('fs');var path=require(_0xd899('0x6'));var rimraf=require(_0xd899('0x7'));var config=require(_0xd899('0x8'));var attributes=require('./action.attributes');module['exports']=function(_0x10f463,_0x1864a3){return _0x10f463[_0xd899('0x9')](_0xd899('0xa'),attributes,{'tableName':_0xd899('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x844d=['bluebird','request-promise','../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger','api','moment'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x844d,0xaf));var _0xd844=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x844d[_0x2f227c];return _0x5032bc;};'use strict';var _=require(_0xd844('0x0'));var util=require(_0xd844('0x1'));var logger=require(_0xd844('0x2'))(_0xd844('0x3'));var moment=require(_0xd844('0x4'));var BPromise=require(_0xd844('0x5'));var rp=require(_0xd844('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd844('0x7'));var attributes=require(_0xd844('0x8'));module[_0xd844('0x9')]=function(_0x4f8fa6,_0x32a58c){return _0x4f8fa6[_0xd844('0xa')](_0xd844('0xb'),attributes,{'tableName':'tools_actions','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 06567d5..9e78df1 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x814b,0x1a2));var _0xb814=function(_0x21e79a,_0x5a7990){_0x21e79a=_0x21e79a-0x0;var _0x506c02=_0x814b[_0x21e79a];return _0x506c02;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x3b7bbb,_0x3a8e31){var _0x994331=function(_0x19539c){while(--_0x19539c){_0x3b7bbb['push'](_0x3b7bbb['shift']());}};_0x994331(++_0x3a8e31);}(_0xe14b,0x93));var _0xbe14=function(_0x26e2f5,_0x2012f7){_0x26e2f5=_0x26e2f5-0x0;var _0x1a3917=_0xe14b[_0x26e2f5];return _0x1a3917;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8cee48a..55bf83b 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 _0xdc16=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./action.controller','put','/:id','delete','destroy','exports'];(function(_0x15b1ec,_0x15ee62){var _0x33320c=function(_0x26e74d){while(--_0x26e74d){_0x15b1ec['push'](_0x15b1ec['shift']());}};_0x33320c(++_0x15ee62);}(_0xdc16,0x9c));var _0x6dc1=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0xdc16[_0x4e697a];return _0x88850c;};'use strict';var multer=require(_0x6dc1('0x0'));var util=require(_0x6dc1('0x1'));var path=require(_0x6dc1('0x2'));var timeout=require(_0x6dc1('0x3'));var express=require(_0x6dc1('0x4'));var router=express['Router']();var fs_extra=require(_0x6dc1('0x5'));var auth=require(_0x6dc1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6dc1('0x7'));router[_0x6dc1('0x8')](_0x6dc1('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x6dc1('0xa')](_0x6dc1('0x9'),auth['isAuthenticated'](),controller[_0x6dc1('0xb')]);module[_0x6dc1('0xc')]=router; \ No newline at end of file +var _0xde41=['destroy','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated'];(function(_0xad08b3,_0x2a3003){var _0xb6c9b6=function(_0x57e379){while(--_0x57e379){_0xad08b3['push'](_0xad08b3['shift']());}};_0xb6c9b6(++_0x2a3003);}(_0xde41,0x187));var _0x1de4=function(_0x5cd173,_0x42b6c8){_0x5cd173=_0x5cd173-0x0;var _0x170e48=_0xde41[_0x5cd173];return _0x170e48;};'use strict';var multer=require(_0x1de4('0x0'));var util=require('util');var path=require(_0x1de4('0x1'));var timeout=require(_0x1de4('0x2'));var express=require(_0x1de4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1de4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1de4('0x5'));var controller=require(_0x1de4('0x6'));router[_0x1de4('0x7')](_0x1de4('0x8'),auth['isAuthenticated'](),controller[_0x1de4('0x9')]);router[_0x1de4('0xa')]('/:id',auth[_0x1de4('0xb')](),controller[_0x1de4('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b2dfed1..c4134e9 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x74dd89,_0x8524a6){var _0x719ece=function(_0x50abf9){while(--_0x50abf9){_0x74dd89['push'](_0x74dd89['shift']());}};_0x719ece(++_0x8524a6);}(_0xac9d,0x14d));var _0xdac9=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0xac9d[_0x4c6bca];return _0x29d58e;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file +var _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x496709,_0x572736){var _0x56ddc3=function(_0x1eba61){while(--_0x1eba61){_0x496709['push'](_0x496709['shift']());}};_0x56ddc3(++_0x572736);}(_0x2bd8,0x130));var _0x82bd=function(_0x35a10b,_0x5ec760){_0x35a10b=_0x35a10b-0x0;var _0x67274d=_0x2bd8[_0x35a10b];return _0x67274d;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 70c3794..06ee64c 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 _0xf495=['stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','AnalyticCustomReport','includeAll','include','rows','catch','show','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','create','CustomReports','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','options','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','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','clone','debug','toString','sequelize','QueryTypes','SELECT','cross_join','AVG(%s)','HOUR(%s)','IS\x20EMPTY','AnalyticMetric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','child_process','fork','../../files/reports','savename','countTable','run','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','../../mysqldb','dbH','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','then','sendStatus','error'];(function(_0x297318,_0x552f41){var _0x521a7f=function(_0x5cbe0f){while(--_0x5cbe0f){_0x297318['push'](_0x297318['shift']());}};_0x521a7f(++_0x552f41);}(_0xf495,0x7d));var _0x5f49=function(_0x33ab7e,_0x3193ad){_0x33ab7e=_0x33ab7e-0x0;var _0x4b6ae8=_0xf495[_0x33ab7e];return _0x4b6ae8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f49('0x0'));var zipdir=require(_0x5f49('0x1'));var jsonpatch=require(_0x5f49('0x2'));var rp=require('request-promise');var moment=require(_0x5f49('0x3'));var BPromise=require(_0x5f49('0x4'));var Mustache=require(_0x5f49('0x5'));var util=require(_0x5f49('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5f49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f49('0x8'));var _=require(_0x5f49('0x9'));var squel=require(_0x5f49('0xa'));var crypto=require(_0x5f49('0xb'));var jsforce=require(_0x5f49('0xc'));var deskjs=require(_0x5f49('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5f49('0xe'));var Papa=require(_0x5f49('0xf'));var Redis=require(_0x5f49('0x10'));var authService=require(_0x5f49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f49('0x12'));var hardwareService=require(_0x5f49('0x13'));var logger=require(_0x5f49('0x14'))(_0x5f49('0x15'));var utils=require(_0x5f49('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f49('0x17'))['db'];var dbH=require(_0x5f49('0x17'))[_0x5f49('0x18')];function respondWithStatusCode(_0x980b78,_0x48cf5f){_0x48cf5f=_0x48cf5f||0xcc;return function(_0x2adb0e){if(_0x2adb0e){return _0x980b78['sendStatus'](_0x48cf5f);}return _0x980b78[_0x5f49('0x19')](_0x48cf5f)[_0x5f49('0x1a')]();};}function respondWithResult(_0x46d38a,_0x5c0052){_0x5c0052=_0x5c0052||0xc8;return function(_0x4bc456){if(_0x4bc456){return _0x46d38a['status'](_0x5c0052)['json'](_0x4bc456);}};}function respondWithFilteredResult(_0x4374d3,_0x1090be){return function(_0x5ce9f2){if(_0x5ce9f2){var _0x8e61db=typeof _0x1090be['offset']===_0x5f49('0x1b')&&typeof _0x1090be[_0x5f49('0x1c')]===_0x5f49('0x1b');var _0x1de934=_0x5ce9f2[_0x5f49('0x1d')];var _0x3e5f20=_0x8e61db?0x0:_0x1090be['offset'];var _0x549915=_0x8e61db?_0x5ce9f2[_0x5f49('0x1d')]:_0x1090be[_0x5f49('0x1e')]+_0x1090be[_0x5f49('0x1c')];var _0x1ff63c;if(_0x549915>=_0x1de934){_0x549915=_0x1de934;_0x1ff63c=0xc8;}else{_0x1ff63c=0xce;}_0x4374d3[_0x5f49('0x19')](_0x1ff63c);return _0x4374d3[_0x5f49('0x1f')]('Content-Range',_0x3e5f20+'-'+_0x549915+'/'+_0x1de934)[_0x5f49('0x20')](_0x5ce9f2);}return null;};}function patchUpdates(_0x5a3277){return function(_0x167ee6){try{jsonpatch[_0x5f49('0x21')](_0x167ee6,_0x5a3277,!![]);}catch(_0x175418){return BPromise[_0x5f49('0x22')](_0x175418);}return _0x167ee6[_0x5f49('0x23')]();};}function saveUpdates(_0x5a4995,_0x35e8ed){return function(_0x470e00){if(_0x470e00){return _0x470e00[_0x5f49('0x24')](_0x5a4995)['then'](function(_0x4cddca){return _0x4cddca;});}return null;};}function removeEntity(_0x5c0bb1,_0x31dc9f){return function(_0x11f6d4){if(_0x11f6d4){return _0x11f6d4[_0x5f49('0x25')]()['then'](function(){var _0x3dbc7c=_0x11f6d4['get']({'plain':!![]});var _0x483647='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x483647,'resourceId':_0x3dbc7c['id']}})[_0x5f49('0x26')](function(){return _0x11f6d4;});})['then'](function(){_0x5c0bb1[_0x5f49('0x19')](0xcc)[_0x5f49('0x1a')]();});}};}function handleEntityNotFound(_0x527b1a,_0x341aee){return function(_0x24b4ea){if(!_0x24b4ea){_0x527b1a[_0x5f49('0x27')](0x194);}return _0x24b4ea;};}function handleError(_0x54d645,_0x305ab9){_0x305ab9=_0x305ab9||0x1f4;return function(_0x5b4bd0){logger[_0x5f49('0x28')](_0x5b4bd0[_0x5f49('0x29')]);if(_0x5b4bd0['name']){delete _0x5b4bd0[_0x5f49('0x2a')];}_0x54d645[_0x5f49('0x19')](_0x305ab9)[_0x5f49('0x2b')](_0x5b4bd0);};}exports[_0x5f49('0x2c')]=function(_0x5e94d3,_0x9987fb){var _0xad2732={},_0xdff68c={},_0x21e196={'count':0x0,'rows':[]};var _0x2e7dda=_[_0x5f49('0x2d')](db['AnalyticCustomReport'][_0x5f49('0x2e')],function(_0x546b17){return{'name':_0x546b17[_0x5f49('0x2f')],'type':_0x546b17[_0x5f49('0x30')]['key']};});_0xdff68c['model']=_['map'](_0x2e7dda,_0x5f49('0x2a'));_0xdff68c[_0x5f49('0x31')]=_[_0x5f49('0x32')](_0x5e94d3['query']);_0xdff68c[_0x5f49('0x33')]=_['intersection'](_0xdff68c[_0x5f49('0x34')],_0xdff68c[_0x5f49('0x31')]);_0xad2732[_0x5f49('0x35')]=_[_0x5f49('0x36')](_0xdff68c[_0x5f49('0x34')],qs[_0x5f49('0x37')](_0x5e94d3[_0x5f49('0x31')][_0x5f49('0x37')]));_0xad2732['attributes']=_0xad2732['attributes'][_0x5f49('0x38')]?_0xad2732[_0x5f49('0x35')]:_0xdff68c[_0x5f49('0x34')];if(!_0x5e94d3[_0x5f49('0x31')][_0x5f49('0x39')](_0x5f49('0x3a'))){_0xad2732['limit']=qs[_0x5f49('0x1c')](_0x5e94d3['query'][_0x5f49('0x1c')]);_0xad2732[_0x5f49('0x1e')]=qs[_0x5f49('0x1e')](_0x5e94d3['query']['offset']);}_0xad2732[_0x5f49('0x3b')]=qs[_0x5f49('0x3c')](_0x5e94d3[_0x5f49('0x31')][_0x5f49('0x3c')]);_0xad2732[_0x5f49('0x3d')]=qs['filters'](_['pick'](_0x5e94d3[_0x5f49('0x31')],_0xdff68c['filters']),_0x2e7dda);if(_0x5e94d3[_0x5f49('0x31')][_0x5f49('0x3e')]){_0xad2732[_0x5f49('0x3d')]=_['merge'](_0xad2732[_0x5f49('0x3d')],{'$or':_['map'](_0x2e7dda,function(_0x2ae0cb){if(_0x2ae0cb[_0x5f49('0x30')]!==_0x5f49('0x3f')){var _0x2256c5={};_0x2256c5[_0x2ae0cb[_0x5f49('0x2a')]]={'$like':'%'+_0x5e94d3[_0x5f49('0x31')][_0x5f49('0x3e')]+'%'};return _0x2256c5;}})});}_0xad2732=_[_0x5f49('0x40')]({},_0xad2732,_0x5e94d3['options']);var _0x166b18={'where':_0xad2732[_0x5f49('0x3d')]};return db[_0x5f49('0x41')][_0x5f49('0x1d')](_0x166b18)['then'](function(_0x290593){_0x21e196['count']=_0x290593;if(_0x5e94d3[_0x5f49('0x31')][_0x5f49('0x42')]){_0xad2732[_0x5f49('0x43')]=[{'all':!![]}];}return db[_0x5f49('0x41')]['findAll'](_0xad2732);})['then'](function(_0x4851ae){_0x21e196[_0x5f49('0x44')]=_0x4851ae;return _0x21e196;})['then'](respondWithFilteredResult(_0x9987fb,_0xad2732))[_0x5f49('0x45')](handleError(_0x9987fb,null));};exports[_0x5f49('0x46')]=function(_0x284a65,_0x37b5e8){var _0x49c05e={'raw':![],'where':{'id':_0x284a65[_0x5f49('0x47')]['id']}},_0x10c273={};_0x10c273[_0x5f49('0x34')]=_['keys'](db[_0x5f49('0x41')][_0x5f49('0x2e')]);_0x10c273[_0x5f49('0x31')]=_[_0x5f49('0x32')](_0x284a65[_0x5f49('0x31')]);_0x10c273[_0x5f49('0x33')]=_[_0x5f49('0x36')](_0x10c273['model'],_0x10c273['query']);_0x49c05e[_0x5f49('0x35')]=_[_0x5f49('0x36')](_0x10c273['model'],qs[_0x5f49('0x37')](_0x284a65[_0x5f49('0x31')]['fields']));_0x49c05e[_0x5f49('0x35')]=_0x49c05e[_0x5f49('0x35')][_0x5f49('0x38')]?_0x49c05e[_0x5f49('0x35')]:_0x10c273[_0x5f49('0x34')];if(_0x284a65['query'][_0x5f49('0x42')]){_0x49c05e[_0x5f49('0x43')]=[{'all':!![]}];}_0x49c05e=_['merge']({},_0x49c05e,_0x284a65['options']);return db[_0x5f49('0x41')]['find'](_0x49c05e)[_0x5f49('0x26')](handleEntityNotFound(_0x37b5e8,null))[_0x5f49('0x26')](respondWithResult(_0x37b5e8,null))[_0x5f49('0x45')](handleError(_0x37b5e8,null));};exports['create']=function(_0x23ce64,_0x299e74){return db[_0x5f49('0x41')]['create'](_0x23ce64[_0x5f49('0x48')],{})[_0x5f49('0x26')](function(_0x555833){var _0x5ccaa3=_0x23ce64[_0x5f49('0x49')][_0x5f49('0x4a')]({'plain':!![]});if(!_0x5ccaa3)throw new Error(_0x5f49('0x4b'));if(_0x5ccaa3[_0x5f49('0x4c')]===_0x5f49('0x49')){var _0x2e81b9=_0x555833['get']({'plain':!![]});var _0x194d33=_0x5f49('0x4d');return db[_0x5f49('0x4e')][_0x5f49('0x4f')]({'where':{'name':_0x194d33,'userProfileId':_0x5ccaa3[_0x5f49('0x50')]},'raw':!![]})[_0x5f49('0x26')](function(_0x486b4a){if(_0x486b4a&&_0x486b4a[_0x5f49('0x51')]===0x0){return db['UserProfileResource'][_0x5f49('0x52')]({'name':_0x2e81b9[_0x5f49('0x2a')],'resourceId':_0x2e81b9['id'],'type':_0x5f49('0x53'),'sectionId':_0x486b4a['id']},{})[_0x5f49('0x26')](function(){return _0x555833;});}else{return _0x555833;}})[_0x5f49('0x45')](function(_0x4be5d0){logger[_0x5f49('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be5d0);throw _0x4be5d0;});}return _0x555833;})[_0x5f49('0x26')](respondWithResult(_0x299e74,0xc9))[_0x5f49('0x45')](handleError(_0x299e74,null));};exports['update']=function(_0x492b4d,_0x2f6860){if(_0x492b4d[_0x5f49('0x48')]['id']){delete _0x492b4d[_0x5f49('0x48')]['id'];}return db[_0x5f49('0x41')]['find']({'where':{'id':_0x492b4d['params']['id']}})[_0x5f49('0x26')](handleEntityNotFound(_0x2f6860,null))['then'](saveUpdates(_0x492b4d[_0x5f49('0x48')],null))['then'](respondWithResult(_0x2f6860,null))['catch'](handleError(_0x2f6860,null));};exports[_0x5f49('0x25')]=function(_0x27ca40,_0x5c8d37){return db['AnalyticCustomReport']['find']({'where':{'id':_0x27ca40[_0x5f49('0x47')]['id']}})[_0x5f49('0x26')](handleEntityNotFound(_0x5c8d37,null))[_0x5f49('0x26')](removeEntity(_0x5c8d37,null))[_0x5f49('0x45')](handleError(_0x5c8d37,null));};exports['preview']=function(_0x18627f,_0x180fd9){var _0x170de9=0xa;var _0x52149d=[_0x5f49('0x54'),_0x5f49('0x55'),_0x5f49('0x56'),'cross_join'];var _0x415e3e={'SUM':_0x5f49('0x57'),'COUNT':_0x5f49('0x58'),'COUNT DISTINCT':_0x5f49('0x59'),'MAX':_0x5f49('0x5a'),'MIN':_0x5f49('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5f49('0x5c'),'GROUP_CONCAT ASC':_0x5f49('0x5d'),'GROUP_CONCAT DESC':_0x5f49('0x5e')};var _0xda2125={'SEC_TO_TIME':_0x5f49('0x5f'),'DATE':_0x5f49('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x5f49('0x61'),'UNIX_TIMESTAMP':_0x5f49('0x62')};var _0x11bb49=function(_0x3d8093){return!_[_0x5f49('0x63')]([_0x5f49('0x64'),_0x5f49('0x65'),'IS\x20EMPTY',_0x5f49('0x66')],_0x3d8093);};var _0x26f65f=function(_0x48271e){if(!_0x48271e||!_0x48271e[_0x5f49('0x67')]['length']){return'';}for(var _0x3d3369='(',_0x25d7c8=0x0;_0x25d7c8<_0x48271e[_0x5f49('0x67')]['length'];_0x25d7c8+=0x1){_0x25d7c8>0x0&&(_0x3d3369+='\x20'+_0x48271e[_0x5f49('0x68')]+'\x20');_0x3d3369+=_0x48271e[_0x5f49('0x67')][_0x25d7c8]['group']?_0x26f65f(_0x48271e['rules'][_0x25d7c8][_0x5f49('0x69')]):_0x48271e['rules'][_0x25d7c8][_0x5f49('0x6a')]+'\x20'+_0x48271e[_0x5f49('0x67')][_0x25d7c8][_0x5f49('0x6b')]+(_0x11bb49(_0x48271e[_0x5f49('0x67')][_0x25d7c8][_0x5f49('0x6b')])?'\x20'+_0x48271e['rules'][_0x25d7c8][_0x5f49('0x6c')]:'');}return _0x3d3369+')';};var _0xc42b97={'where':{'id':_0x18627f[_0x5f49('0x47')]['id']}},_0x338765,_0x2e95a8,_0x1d1da3,_0x53251b,_0x31448b;_0xc42b97=_[_0x5f49('0x40')]({},_0xc42b97,_0x18627f[_0x5f49('0x6d')]);return db[_0x5f49('0x41')][_0x5f49('0x4f')](_0xc42b97)[_0x5f49('0x26')](function(_0x4a6bb0){if(_0x4a6bb0){_0x338765=_0x4a6bb0;return _0x4a6bb0[_0x5f49('0x6e')]();}return null;})[_0x5f49('0x26')](function(_0x5da91f){if(_0x5da91f){if(!_0x5da91f[_0x5f49('0x38')]){throw new db[(_0x5f49('0x6f'))][(_0x5f49('0x70'))](_0x5f49('0x71'),0x193);}_0x2e95a8=_0x5da91f;return db['AnalyticMetric'][_0x5f49('0x72')]({'raw':!![]});}return null;})[_0x5f49('0x26')](function(_0x5a1cb4){if(_0x5a1cb4){_0x1d1da3=_[_0x5f49('0x73')](_0x5a1cb4,'id');var _0x113347;var _0x1cfbc2=squel[_0x5f49('0x74')]();_0x1cfbc2[_0x5f49('0x75')](_0x338765[_0x5f49('0x76')]);for(var _0x41b3d9=0x0;_0x41b3d9<_0x2e95a8[_0x5f49('0x38')];_0x41b3d9+=0x1){_0x113347=_0x2e95a8[_0x41b3d9][_0x5f49('0x77')]?_0x1d1da3[_0x2e95a8[_0x41b3d9]['MetricId']][_0x5f49('0x78')]:_0x2e95a8[_0x41b3d9][_0x5f49('0x6a')];_0x113347=_0x2e95a8[_0x41b3d9][_0x5f49('0x79')]?_[_0x5f49('0x7a')](_0x415e3e[_0x2e95a8[_0x41b3d9][_0x5f49('0x79')]],'%s',_0x113347):_0x113347;_0x113347=_0x2e95a8[_0x41b3d9][_0x5f49('0x7b')]?_[_0x5f49('0x7a')](_0xda2125[_0x2e95a8[_0x41b3d9][_0x5f49('0x7b')]],'%s',_0x113347):_0x113347;if(_0x2e95a8[_0x41b3d9][_0x5f49('0x7c')]){_0x1cfbc2[_0x5f49('0x69')](_0x113347);}_0x2e95a8[_0x41b3d9][_0x5f49('0x7d')]&&_0x1cfbc2['order'](_0x113347,_0x2e95a8[_0x41b3d9]['orderBy']===_0x5f49('0x7e')?![]:!![]);_0x1cfbc2[_0x5f49('0x6a')](_0x113347,_0x2e95a8[_0x41b3d9][_0x5f49('0x7f')]||_0x113347);}if(_0x338765[_0x5f49('0x80')]){_0x338765['joins']=JSON[_0x5f49('0x81')](_0x338765[_0x5f49('0x80')]);for(var _0xe86fb1=0x0;_0xe86fb1<_0x338765[_0x5f49('0x80')][_0x5f49('0x38')];_0xe86fb1+=0x1){if(_0x338765[_0x5f49('0x80')][_0xe86fb1][_0x5f49('0x30')]&&_[_0x5f49('0x63')](_0x52149d,_0x338765['joins'][_0xe86fb1][_0x5f49('0x30')])&&_0x338765[_0x5f49('0x80')][_0xe86fb1][_0x5f49('0x82')]&&_0x338765[_0x5f49('0x80')][_0xe86fb1][_0x5f49('0x83')]&&_0x338765[_0x5f49('0x80')][_0xe86fb1][_0x5f49('0x84')]){_0x1cfbc2[_0x338765[_0x5f49('0x80')][_0xe86fb1][_0x5f49('0x30')]](_0x338765[_0x5f49('0x80')][_0xe86fb1][_0x5f49('0x83')],null,util['format'](_0x5f49('0x85'),_0x338765[_0x5f49('0x76')],_0x338765[_0x5f49('0x80')][_0xe86fb1][_0x5f49('0x82')],_0x338765['joins'][_0xe86fb1][_0x5f49('0x83')],_0x338765['joins'][_0xe86fb1][_0x5f49('0x84')]));}}}if(_0x338765['conditions']){_0x338765[_0x5f49('0x86')]=JSON[_0x5f49('0x81')](_0x338765[_0x5f49('0x86')]);_0x1cfbc2['where'](_0x26f65f(_0x338765[_0x5f49('0x86')][_0x5f49('0x69')]));}_0x31448b=_0x1cfbc2[_0x5f49('0x87')]();_0x1cfbc2[_0x5f49('0x1c')](_0x170de9);_0x1cfbc2['offset'](0x0);logger[_0x5f49('0x88')]('Limited\x20Query:',_0x1cfbc2[_0x5f49('0x89')]());return dbH[_0x5f49('0x8a')][_0x5f49('0x31')](_0x1cfbc2[_0x5f49('0x89')](),{'type':dbH[_0x5f49('0x8a')][_0x5f49('0x8b')][_0x5f49('0x8c')]});}})['then'](respondWithResult(_0x180fd9,null))[_0x5f49('0x45')](handleError(_0x180fd9,null));};function runReport(_0x48f0c2,_0x8284ea,_0x3ea527){var _0x3ef1b4=_0x8284ea[_0x5f49('0x2a')];var _0x19f067=0xa;var _0x35216a=[_0x5f49('0x54'),_0x5f49('0x55'),_0x5f49('0x56'),_0x5f49('0x8d')];var _0x2a5885={'SUM':_0x5f49('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5f49('0x59'),'MAX':_0x5f49('0x5a'),'MIN':'MIN(%s)','AVG':_0x5f49('0x8e'),'GROUP_CONCAT':_0x5f49('0x5c'),'GROUP_CONCAT ASC':_0x5f49('0x5d'),'GROUP_CONCAT DESC':_0x5f49('0x5e')};var _0x13b479={'SEC_TO_TIME':_0x5f49('0x5f'),'DATE':'DATE(%s)','HOUR':_0x5f49('0x8f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5f49('0x62')};var _0x307ad6=function(_0x31d18a){return!_[_0x5f49('0x63')]([_0x5f49('0x64'),_0x5f49('0x65'),_0x5f49('0x90'),_0x5f49('0x66')],_0x31d18a);};var _0x3bae01=function(_0x15e7f8){if(!_0x15e7f8||!_0x15e7f8[_0x5f49('0x67')]['length']){return'';}for(var _0x4fee1e='(',_0x3afd73=0x0;_0x3afd73<_0x15e7f8[_0x5f49('0x67')][_0x5f49('0x38')];_0x3afd73+=0x1){_0x3afd73>0x0&&(_0x4fee1e+='\x20'+_0x15e7f8[_0x5f49('0x68')]+'\x20');_0x4fee1e+=_0x15e7f8[_0x5f49('0x67')][_0x3afd73]['group']?_0x3bae01(_0x15e7f8[_0x5f49('0x67')][_0x3afd73][_0x5f49('0x69')]):_0x15e7f8['rules'][_0x3afd73]['field']+'\x20'+_0x15e7f8[_0x5f49('0x67')][_0x3afd73][_0x5f49('0x6b')]+(_0x307ad6(_0x15e7f8[_0x5f49('0x67')][_0x3afd73]['condition'])?'\x20'+_0x15e7f8['rules'][_0x3afd73][_0x5f49('0x6c')]:'');}return _0x4fee1e+')';};var _0x4a0590={'where':{'id':_0x48f0c2['id']}},_0x59314d,_0xd13dca,_0x8feff6,_0x207985,_0x395c32;_0x4a0590=_[_0x5f49('0x40')]({},_0x4a0590,_0x3ea527);return db[_0x5f49('0x41')][_0x5f49('0x4f')](_0x4a0590)[_0x5f49('0x26')](function(_0x13e5bf){if(_0x13e5bf){_0x59314d=_0x13e5bf;return _0x13e5bf[_0x5f49('0x6e')]();}return null;})['then'](function(_0x16aee6){if(_0x16aee6){if(!_0x16aee6['length']){throw new db[(_0x5f49('0x6f'))][(_0x5f49('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xd13dca=_0x16aee6;return db[_0x5f49('0x91')][_0x5f49('0x72')]({'raw':!![]});}return null;})[_0x5f49('0x26')](function(_0x52ff1c){if(_0x52ff1c){_0x8feff6=_['keyBy'](_0x52ff1c,'id');var _0x37fd3b;var _0x1a182f=squel['select']();_0x1a182f['from'](_0x59314d[_0x5f49('0x76')]);for(var _0x5a9f12=0x0;_0x5a9f12<_0xd13dca[_0x5f49('0x38')];_0x5a9f12+=0x1){_0x37fd3b=_0xd13dca[_0x5a9f12][_0x5f49('0x77')]?_0x8feff6[_0xd13dca[_0x5a9f12][_0x5f49('0x77')]][_0x5f49('0x78')]:_0xd13dca[_0x5a9f12][_0x5f49('0x6a')];_0x37fd3b=_0xd13dca[_0x5a9f12]['function']?_[_0x5f49('0x7a')](_0x2a5885[_0xd13dca[_0x5a9f12][_0x5f49('0x79')]],'%s',_0x37fd3b):_0x37fd3b;_0x37fd3b=_0xd13dca[_0x5a9f12][_0x5f49('0x7b')]?_['replace'](_0x13b479[_0xd13dca[_0x5a9f12]['format']],'%s',_0x37fd3b):_0x37fd3b;if(_0xd13dca[_0x5a9f12]['groupBy']){_0x1a182f[_0x5f49('0x69')](_0x37fd3b);}_0xd13dca[_0x5a9f12][_0x5f49('0x7d')]&&_0x1a182f['order'](_0x37fd3b,_0xd13dca[_0x5a9f12]['orderBy']==='DESC'?![]:!![]);_0x1a182f[_0x5f49('0x6a')](_0x37fd3b,_0xd13dca[_0x5a9f12][_0x5f49('0x7f')]||_0x37fd3b);}if(_0x59314d[_0x5f49('0x80')]){_0x59314d['joins']=JSON[_0x5f49('0x81')](_0x59314d['joins']);for(var _0x2893c5=0x0;_0x2893c5<_0x59314d[_0x5f49('0x80')][_0x5f49('0x38')];_0x2893c5+=0x1){if(_0x59314d[_0x5f49('0x80')][_0x2893c5]['type']&&_[_0x5f49('0x63')](_0x35216a,_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x30')])&&_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x82')]&&_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x83')]&&_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x84')]){_0x1a182f[_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x30')]](_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x83')],null,util['format'](_0x5f49('0x85'),_0x59314d[_0x5f49('0x76')],_0x59314d[_0x5f49('0x80')][_0x2893c5]['parentKey'],_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x83')],_0x59314d[_0x5f49('0x80')][_0x2893c5][_0x5f49('0x84')]));}}}if(_0x59314d[_0x5f49('0x86')]){_0x59314d[_0x5f49('0x86')]=JSON['parse'](_0x59314d[_0x5f49('0x86')]);_0x1a182f[_0x5f49('0x3d')](_0x3bae01(_0x59314d[_0x5f49('0x86')][_0x5f49('0x69')]));}_0x395c32=_0x1a182f[_0x5f49('0x87')]();_0x1a182f[_0x5f49('0x1c')](_0x19f067);_0x1a182f[_0x5f49('0x1e')](0x0);return;}})[_0x5f49('0x26')](function(){if(_0x8284ea[_0x5f49('0x92')]===_0x5f49('0x93')){return null;}var _0x1032dc=_[_0x5f49('0x40')](_0x8284ea,{'name':_0x8284ea[_0x5f49('0x94')]||_0x8284ea[_0x5f49('0x2a')]||_0x59314d[_0x5f49('0x2a')],'basename':_0x3ef1b4,'savename':util[_0x5f49('0x7b')](_0x5f49('0x95'),_0x8284ea[_0x5f49('0x2a')]||_0x59314d[_0x5f49('0x2a')],require(_0x5f49('0x96'))[_0x5f49('0x97')](0x4),_0x8284ea[_0x5f49('0x92')]||_0x5f49('0x98')),'reportId':_0x59314d['id'],'reportType':_0x5f49('0x99')});return db[_0x5f49('0x9a')]['create'](_0x1032dc,{'raw':!![]});})[_0x5f49('0x26')](function(_0x1370b5){if(_0x59314d[_0x5f49('0x76')]===_0x5f49('0x9b')){_0x395c32[_0x5f49('0x3d')](_0x59314d[_0x5f49('0x76')]+_0x5f49('0x9c'),_0x8284ea[_0x5f49('0x9d')],_0x8284ea['endDate']);}else{_0x395c32[_0x5f49('0x3d')](_0x59314d[_0x5f49('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x8284ea[_0x5f49('0x9d')],_0x8284ea[_0x5f49('0x9e')]);}if(_0x1370b5){logger['info']('Run\x20Query:',_0x395c32[_0x5f49('0x89')]());require(_0x5f49('0x9f'))[_0x5f49('0xa0')](path[_0x5f49('0x54')](__dirname,'../../components/export/',_0x1370b5['output']),[_0x1370b5['id'],_0x395c32['toString'](),path[_0x5f49('0x54')](__dirname,_0x5f49('0xa1'),_0x1370b5[_0x5f49('0xa2')]),_0x3ef1b4]);return _0x1370b5;}else{var _0x4a86ab=squel[_0x5f49('0x74')]();_0x4a86ab['from']('('+_0x395c32[_0x5f49('0x89')]()+')',_0x5f49('0xa3'));_0x4a86ab[_0x5f49('0x6a')]('COUNT(*)','count');_0x395c32[_0x5f49('0x1c')](_0x8284ea['limit']||_0x19f067);_0x395c32[_0x5f49('0x1e')](_0x8284ea[_0x5f49('0x1e')]||0x0);return dbH['sequelize'][_0x5f49('0x31')](_0x4a86ab[_0x5f49('0x89')](),{'type':dbH['sequelize'][_0x5f49('0x8b')]['SELECT']})[_0x5f49('0x26')](function(_0x433019){if(!_0x433019[_0x5f49('0x38')]){_0x207985=0x0;}else{_0x207985=_0x433019[0x0][_0x5f49('0x1d')]||0x0;}return dbH[_0x5f49('0x8a')][_0x5f49('0x31')](_0x395c32[_0x5f49('0x89')](),{'type':dbH[_0x5f49('0x8a')]['QueryTypes'][_0x5f49('0x8c')]});})['then'](function(_0x329769){return{'rows':_0x329769||[],'count':_0x207985};});}});}exports[_0x5f49('0xa4')]=function(_0x58a7bb,_0x5a3bec){return runReport(_0x58a7bb[_0x5f49('0x47')],_0x58a7bb[_0x5f49('0x31')],_0x58a7bb[_0x5f49('0x6d')])[_0x5f49('0x26')](respondWithResult(_0x5a3bec,null))[_0x5f49('0x45')](handleError(_0x5a3bec,null));};exports['runReport']=runReport;exports['query']=function(_0x4fe1a4,_0x2a04a2){var _0x4864fd=0xa;var _0x35bad9=[_0x5f49('0x54'),_0x5f49('0x55'),_0x5f49('0x56'),_0x5f49('0x8d')];var _0x569bb4={'SUM':_0x5f49('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5f49('0x59'),'MAX':_0x5f49('0x5a'),'MIN':_0x5f49('0x5b'),'AVG':_0x5f49('0x8e'),'GROUP_CONCAT':_0x5f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x5f49('0x5e')};var _0x2fe4cb={'SEC_TO_TIME':_0x5f49('0x5f'),'DATE':'DATE(%s)','HOUR':_0x5f49('0x8f'),'ROUND':_0x5f49('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1673e1=function(_0x1dba14){return!_[_0x5f49('0x63')]([_0x5f49('0x64'),_0x5f49('0x65'),_0x5f49('0x90'),'IS\x20NOT\x20EMPTY'],_0x1dba14);};var _0x48e9cd=function(_0x5cf32c){if(!_0x5cf32c||!_0x5cf32c[_0x5f49('0x67')][_0x5f49('0x38')]){return'';}for(var _0xd39f84='(',_0x86aa40=0x0;_0x86aa40<_0x5cf32c[_0x5f49('0x67')][_0x5f49('0x38')];_0x86aa40+=0x1){_0x86aa40>0x0&&(_0xd39f84+='\x20'+_0x5cf32c[_0x5f49('0x68')]+'\x20');_0xd39f84+=_0x5cf32c['rules'][_0x86aa40][_0x5f49('0x69')]?_0x48e9cd(_0x5cf32c['rules'][_0x86aa40]['group']):_0x5cf32c[_0x5f49('0x67')][_0x86aa40][_0x5f49('0x6a')]+'\x20'+_0x5cf32c['rules'][_0x86aa40][_0x5f49('0x6b')]+(_0x1673e1(_0x5cf32c[_0x5f49('0x67')][_0x86aa40][_0x5f49('0x6b')])?'\x20'+_0x5cf32c[_0x5f49('0x67')][_0x86aa40][_0x5f49('0x6c')]:'');}return _0xd39f84+')';};var _0x53f65b={'where':{'id':_0x4fe1a4[_0x5f49('0x47')]['id']}},_0x5c4c5c,_0x2f66a0,_0x5b4306,_0x71fa3,_0x4ac9bb;_0x53f65b=_[_0x5f49('0x40')]({},_0x53f65b,_0x4fe1a4[_0x5f49('0x6d')]);return db[_0x5f49('0x41')][_0x5f49('0x4f')](_0x53f65b)[_0x5f49('0x26')](function(_0x497563){if(_0x497563){_0x5c4c5c=_0x497563;return _0x497563[_0x5f49('0x6e')]();}return null;})[_0x5f49('0x26')](function(_0x488633){if(_0x488633){if(!_0x488633['length']){throw new db[(_0x5f49('0x6f'))][(_0x5f49('0x70'))](_0x5f49('0x71'),0x193);}_0x2f66a0=_0x488633;return db['AnalyticMetric'][_0x5f49('0x72')]({'raw':!![]});}return null;})[_0x5f49('0x26')](function(_0x5767bd){if(_0x5767bd){_0x5b4306=_['keyBy'](_0x5767bd,'id');var _0x26133a;var _0x33b1d3=squel[_0x5f49('0x74')]();_0x33b1d3['from'](_0x5c4c5c[_0x5f49('0x76')]);for(var _0xb0385b=0x0;_0xb0385b<_0x2f66a0['length'];_0xb0385b+=0x1){_0x26133a=_0x2f66a0[_0xb0385b][_0x5f49('0x77')]?_0x5b4306[_0x2f66a0[_0xb0385b][_0x5f49('0x77')]][_0x5f49('0x78')]:_0x2f66a0[_0xb0385b][_0x5f49('0x6a')];_0x26133a=_0x2f66a0[_0xb0385b]['function']?_[_0x5f49('0x7a')](_0x569bb4[_0x2f66a0[_0xb0385b]['function']],'%s',_0x26133a):_0x26133a;_0x26133a=_0x2f66a0[_0xb0385b][_0x5f49('0x7b')]?_['replace'](_0x2fe4cb[_0x2f66a0[_0xb0385b][_0x5f49('0x7b')]],'%s',_0x26133a):_0x26133a;if(_0x2f66a0[_0xb0385b][_0x5f49('0x7c')]){_0x33b1d3[_0x5f49('0x69')](_0x26133a);}_0x2f66a0[_0xb0385b][_0x5f49('0x7d')]&&_0x33b1d3[_0x5f49('0x3b')](_0x26133a,_0x2f66a0[_0xb0385b]['orderBy']===_0x5f49('0x7e')?![]:!![]);_0x33b1d3[_0x5f49('0x6a')](_0x26133a,_0x2f66a0[_0xb0385b][_0x5f49('0x7f')]||_0x26133a);}if(_0x5c4c5c[_0x5f49('0x80')]){_0x5c4c5c[_0x5f49('0x80')]=JSON[_0x5f49('0x81')](_0x5c4c5c[_0x5f49('0x80')]);for(var _0x5bcb12=0x0;_0x5bcb12<_0x5c4c5c[_0x5f49('0x80')]['length'];_0x5bcb12+=0x1){if(_0x5c4c5c[_0x5f49('0x80')][_0x5bcb12]['type']&&_['includes'](_0x35bad9,_0x5c4c5c[_0x5f49('0x80')][_0x5bcb12][_0x5f49('0x30')])&&_0x5c4c5c['joins'][_0x5bcb12]['parentKey']&&_0x5c4c5c[_0x5f49('0x80')][_0x5bcb12]['foreignTable']&&_0x5c4c5c[_0x5f49('0x80')][_0x5bcb12][_0x5f49('0x84')]){_0x33b1d3[_0x5c4c5c[_0x5f49('0x80')][_0x5bcb12][_0x5f49('0x30')]](_0x5c4c5c[_0x5f49('0x80')][_0x5bcb12][_0x5f49('0x83')],null,util['format'](_0x5f49('0x85'),_0x5c4c5c[_0x5f49('0x76')],_0x5c4c5c['joins'][_0x5bcb12][_0x5f49('0x82')],_0x5c4c5c['joins'][_0x5bcb12]['foreignTable'],_0x5c4c5c[_0x5f49('0x80')][_0x5bcb12][_0x5f49('0x84')]));}}}if(_0x5c4c5c['conditions']){_0x5c4c5c['conditions']=JSON['parse'](_0x5c4c5c[_0x5f49('0x86')]);_0x33b1d3[_0x5f49('0x3d')](_0x48e9cd(_0x5c4c5c['conditions'][_0x5f49('0x69')]));}_0x4ac9bb=_0x33b1d3['clone']();_0x33b1d3[_0x5f49('0x1c')](_0x4864fd);_0x33b1d3[_0x5f49('0x1e')](0x0);logger['debug'](_0x5f49('0xa5'),_0x33b1d3[_0x5f49('0x89')]());return dbH['sequelize'][_0x5f49('0x31')](_0x33b1d3['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5f49('0x8c')]});}})[_0x5f49('0x26')](function(){return{'sql':_0x4ac9bb['toString']()};})['then'](respondWithResult(_0x2a04a2,null))[_0x5f49('0x45')](handleError(_0x2a04a2,null));}; \ No newline at end of file +var _0xa8fd=['where','merge','options','includeAll','rows','params','keys','find','catch','create','user','role','Reports','UserProfileSection','autoAssociation','UserProfileResource','error','update','body','destroy','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','DESC','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','keyBy','select','alias','clone','output','web','fullPath','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','left_join','IS\x20EMPTY','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','get','CustomReports','sendStatus','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x4c291a,_0x15fc10){var _0x276509=function(_0x518692){while(--_0x518692){_0x4c291a['push'](_0x4c291a['shift']());}};_0x276509(++_0x15fc10);}(_0xa8fd,0x69));var _0xda8f=function(_0x1daf92,_0x3ff770){_0x1daf92=_0x1daf92-0x0;var _0x5b4f6f=_0xa8fd[_0x1daf92];return _0x5b4f6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda8f('0x0'));var zipdir=require(_0xda8f('0x1'));var jsonpatch=require(_0xda8f('0x2'));var rp=require(_0xda8f('0x3'));var moment=require(_0xda8f('0x4'));var BPromise=require(_0xda8f('0x5'));var Mustache=require('mustache');var util=require(_0xda8f('0x6'));var path=require(_0xda8f('0x7'));var sox=require('sox');var csv=require(_0xda8f('0x8'));var ejs=require(_0xda8f('0x9'));var fs=require('fs');var fs_extra=require(_0xda8f('0xa'));var _=require(_0xda8f('0xb'));var squel=require('squel');var crypto=require(_0xda8f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xda8f('0x8'));var querystring=require(_0xda8f('0xd'));var Papa=require('papaparse');var Redis=require(_0xda8f('0xe'));var authService=require(_0xda8f('0xf'));var qs=require(_0xda8f('0x10'));var as=require(_0xda8f('0x11'));var hardwareService=require(_0xda8f('0x12'));var logger=require('../../config/logger')(_0xda8f('0x13'));var utils=require(_0xda8f('0x14'));var config=require(_0xda8f('0x15'));var licenseUtil=require(_0xda8f('0x16'));var db=require(_0xda8f('0x17'))['db'];var dbH=require(_0xda8f('0x17'))['dbH'];function respondWithStatusCode(_0x1671c8,_0x589e05){_0x589e05=_0x589e05||0xcc;return function(_0x2967be){if(_0x2967be){return _0x1671c8['sendStatus'](_0x589e05);}return _0x1671c8[_0xda8f('0x18')](_0x589e05)[_0xda8f('0x19')]();};}function respondWithResult(_0xeb2aad,_0x170c45){_0x170c45=_0x170c45||0xc8;return function(_0x1365d7){if(_0x1365d7){return _0xeb2aad[_0xda8f('0x18')](_0x170c45)[_0xda8f('0x1a')](_0x1365d7);}};}function respondWithFilteredResult(_0x10b30b,_0x16c8ac){return function(_0x403f91){if(_0x403f91){var _0x179779=typeof _0x16c8ac['offset']==='undefined'&&typeof _0x16c8ac['limit']===_0xda8f('0x1b');var _0x59a031=_0x403f91[_0xda8f('0x1c')];var _0x385d38=_0x179779?0x0:_0x16c8ac[_0xda8f('0x1d')];var _0xa2aea2=_0x179779?_0x403f91[_0xda8f('0x1c')]:_0x16c8ac[_0xda8f('0x1d')]+_0x16c8ac[_0xda8f('0x1e')];var _0x5abe5b;if(_0xa2aea2>=_0x59a031){_0xa2aea2=_0x59a031;_0x5abe5b=0xc8;}else{_0x5abe5b=0xce;}_0x10b30b[_0xda8f('0x18')](_0x5abe5b);return _0x10b30b[_0xda8f('0x1f')](_0xda8f('0x20'),_0x385d38+'-'+_0xa2aea2+'/'+_0x59a031)[_0xda8f('0x1a')](_0x403f91);}return null;};}function patchUpdates(_0x5dff4b){return function(_0x242595){try{jsonpatch[_0xda8f('0x21')](_0x242595,_0x5dff4b,!![]);}catch(_0x5c6876){return BPromise[_0xda8f('0x22')](_0x5c6876);}return _0x242595['save']();};}function saveUpdates(_0x1f7d19,_0x4d0fe3){return function(_0x265253){if(_0x265253){return _0x265253['update'](_0x1f7d19)[_0xda8f('0x23')](function(_0x462363){return _0x462363;});}return null;};}function removeEntity(_0x2a951c,_0x322822){return function(_0x5b1e31){if(_0x5b1e31){return _0x5b1e31['destroy']()['then'](function(){var _0x909745=_0x5b1e31[_0xda8f('0x24')]({'plain':!![]});var _0x1b4280=_0xda8f('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x1b4280,'resourceId':_0x909745['id']}})['then'](function(){return _0x5b1e31;});})[_0xda8f('0x23')](function(){_0x2a951c[_0xda8f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc99b82,_0x1f7eec){return function(_0x483b28){if(!_0x483b28){_0xc99b82[_0xda8f('0x26')](0x194);}return _0x483b28;};}function handleError(_0x3b9cf5,_0x3c086){_0x3c086=_0x3c086||0x1f4;return function(_0x12f292){logger['error'](_0x12f292[_0xda8f('0x27')]);if(_0x12f292[_0xda8f('0x28')]){delete _0x12f292[_0xda8f('0x28')];}_0x3b9cf5[_0xda8f('0x18')](_0x3c086)[_0xda8f('0x29')](_0x12f292);};}exports[_0xda8f('0x2a')]=function(_0x44d376,_0x366c8b){var _0x5458ab={},_0x502d9e={},_0x2bab6b={'count':0x0,'rows':[]};var _0x1ba035=_[_0xda8f('0x2b')](db[_0xda8f('0x2c')][_0xda8f('0x2d')],function(_0x253181){return{'name':_0x253181[_0xda8f('0x2e')],'type':_0x253181[_0xda8f('0x2f')][_0xda8f('0x30')]};});_0x502d9e[_0xda8f('0x31')]=_['map'](_0x1ba035,_0xda8f('0x28'));_0x502d9e[_0xda8f('0x32')]=_['keys'](_0x44d376[_0xda8f('0x32')]);_0x502d9e[_0xda8f('0x33')]=_[_0xda8f('0x34')](_0x502d9e[_0xda8f('0x31')],_0x502d9e[_0xda8f('0x32')]);_0x5458ab[_0xda8f('0x35')]=_[_0xda8f('0x34')](_0x502d9e[_0xda8f('0x31')],qs[_0xda8f('0x36')](_0x44d376[_0xda8f('0x32')]['fields']));_0x5458ab['attributes']=_0x5458ab[_0xda8f('0x35')][_0xda8f('0x37')]?_0x5458ab['attributes']:_0x502d9e['model'];if(!_0x44d376[_0xda8f('0x32')][_0xda8f('0x38')](_0xda8f('0x39'))){_0x5458ab[_0xda8f('0x1e')]=qs[_0xda8f('0x1e')](_0x44d376['query'][_0xda8f('0x1e')]);_0x5458ab[_0xda8f('0x1d')]=qs[_0xda8f('0x1d')](_0x44d376[_0xda8f('0x32')][_0xda8f('0x1d')]);}_0x5458ab['order']=qs['sort'](_0x44d376[_0xda8f('0x32')][_0xda8f('0x3a')]);_0x5458ab['where']=qs[_0xda8f('0x33')](_[_0xda8f('0x3b')](_0x44d376[_0xda8f('0x32')],_0x502d9e['filters']),_0x1ba035);if(_0x44d376['query'][_0xda8f('0x3c')]){_0x5458ab[_0xda8f('0x3d')]=_[_0xda8f('0x3e')](_0x5458ab[_0xda8f('0x3d')],{'$or':_[_0xda8f('0x2b')](_0x1ba035,function(_0x3f4814){if(_0x3f4814[_0xda8f('0x2f')]!=='VIRTUAL'){var _0x34883c={};_0x34883c[_0x3f4814[_0xda8f('0x28')]]={'$like':'%'+_0x44d376['query'][_0xda8f('0x3c')]+'%'};return _0x34883c;}})});}_0x5458ab=_[_0xda8f('0x3e')]({},_0x5458ab,_0x44d376[_0xda8f('0x3f')]);var _0x557cb3={'where':_0x5458ab['where']};return db['AnalyticCustomReport']['count'](_0x557cb3)[_0xda8f('0x23')](function(_0x1929d6){_0x2bab6b[_0xda8f('0x1c')]=_0x1929d6;if(_0x44d376['query'][_0xda8f('0x40')]){_0x5458ab['include']=[{'all':!![]}];}return db[_0xda8f('0x2c')]['findAll'](_0x5458ab);})[_0xda8f('0x23')](function(_0x4afee6){_0x2bab6b[_0xda8f('0x41')]=_0x4afee6;return _0x2bab6b;})[_0xda8f('0x23')](respondWithFilteredResult(_0x366c8b,_0x5458ab))['catch'](handleError(_0x366c8b,null));};exports['show']=function(_0x1422fd,_0x4ac96c){var _0x4e9bc5={'raw':![],'where':{'id':_0x1422fd[_0xda8f('0x42')]['id']}},_0x1030a0={};_0x1030a0['model']=_[_0xda8f('0x43')](db[_0xda8f('0x2c')]['rawAttributes']);_0x1030a0[_0xda8f('0x32')]=_[_0xda8f('0x43')](_0x1422fd['query']);_0x1030a0[_0xda8f('0x33')]=_[_0xda8f('0x34')](_0x1030a0['model'],_0x1030a0['query']);_0x4e9bc5[_0xda8f('0x35')]=_[_0xda8f('0x34')](_0x1030a0['model'],qs[_0xda8f('0x36')](_0x1422fd[_0xda8f('0x32')][_0xda8f('0x36')]));_0x4e9bc5[_0xda8f('0x35')]=_0x4e9bc5[_0xda8f('0x35')][_0xda8f('0x37')]?_0x4e9bc5[_0xda8f('0x35')]:_0x1030a0[_0xda8f('0x31')];if(_0x1422fd['query'][_0xda8f('0x40')]){_0x4e9bc5['include']=[{'all':!![]}];}_0x4e9bc5=_[_0xda8f('0x3e')]({},_0x4e9bc5,_0x1422fd[_0xda8f('0x3f')]);return db[_0xda8f('0x2c')][_0xda8f('0x44')](_0x4e9bc5)['then'](handleEntityNotFound(_0x4ac96c,null))[_0xda8f('0x23')](respondWithResult(_0x4ac96c,null))[_0xda8f('0x45')](handleError(_0x4ac96c,null));};exports[_0xda8f('0x46')]=function(_0x3ac295,_0x5c33f5){return db[_0xda8f('0x2c')][_0xda8f('0x46')](_0x3ac295['body'],{})[_0xda8f('0x23')](function(_0x143d42){var _0x16c0be=_0x3ac295[_0xda8f('0x47')]['get']({'plain':!![]});if(!_0x16c0be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16c0be[_0xda8f('0x48')]==='user'){var _0xdc3300=_0x143d42[_0xda8f('0x24')]({'plain':!![]});var _0x262024=_0xda8f('0x49');return db[_0xda8f('0x4a')]['find']({'where':{'name':_0x262024,'userProfileId':_0x16c0be['userProfileId']},'raw':!![]})['then'](function(_0x2cc2ad){if(_0x2cc2ad&&_0x2cc2ad[_0xda8f('0x4b')]===0x0){return db[_0xda8f('0x4c')][_0xda8f('0x46')]({'name':_0xdc3300[_0xda8f('0x28')],'resourceId':_0xdc3300['id'],'type':'CustomReports','sectionId':_0x2cc2ad['id']},{})[_0xda8f('0x23')](function(){return _0x143d42;});}else{return _0x143d42;}})[_0xda8f('0x45')](function(_0xc72639){logger[_0xda8f('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc72639);throw _0xc72639;});}return _0x143d42;})[_0xda8f('0x23')](respondWithResult(_0x5c33f5,0xc9))[_0xda8f('0x45')](handleError(_0x5c33f5,null));};exports[_0xda8f('0x4e')]=function(_0x2b834b,_0x4953b8){if(_0x2b834b[_0xda8f('0x4f')]['id']){delete _0x2b834b[_0xda8f('0x4f')]['id'];}return db[_0xda8f('0x2c')]['find']({'where':{'id':_0x2b834b[_0xda8f('0x42')]['id']}})[_0xda8f('0x23')](handleEntityNotFound(_0x4953b8,null))[_0xda8f('0x23')](saveUpdates(_0x2b834b[_0xda8f('0x4f')],null))[_0xda8f('0x23')](respondWithResult(_0x4953b8,null))[_0xda8f('0x45')](handleError(_0x4953b8,null));};exports[_0xda8f('0x50')]=function(_0x39e3e6,_0x51ca18){return db['AnalyticCustomReport'][_0xda8f('0x44')]({'where':{'id':_0x39e3e6[_0xda8f('0x42')]['id']}})[_0xda8f('0x23')](handleEntityNotFound(_0x51ca18,null))[_0xda8f('0x23')](removeEntity(_0x51ca18,null))[_0xda8f('0x45')](handleError(_0x51ca18,null));};exports[_0xda8f('0x51')]=function(_0x45c7b3,_0x17e238){var _0x512b55=0xa;var _0x13c140=[_0xda8f('0x52'),'left_join',_0xda8f('0x53'),_0xda8f('0x54')];var _0x125d4b={'SUM':_0xda8f('0x55'),'COUNT':_0xda8f('0x56'),'COUNT DISTINCT':_0xda8f('0x57'),'MAX':_0xda8f('0x58'),'MIN':_0xda8f('0x59'),'AVG':_0xda8f('0x5a'),'GROUP_CONCAT':_0xda8f('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xec51c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xda8f('0x5c'),'HOUR':_0xda8f('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3ac4b3=function(_0x5441b1){return!_[_0xda8f('0x5e')]([_0xda8f('0x5f'),_0xda8f('0x60'),'IS\x20EMPTY',_0xda8f('0x61')],_0x5441b1);};var _0x1b710f=function(_0x3116e9){if(!_0x3116e9||!_0x3116e9[_0xda8f('0x62')][_0xda8f('0x37')]){return'';}for(var _0x1c8c3c='(',_0x1b3d28=0x0;_0x1b3d28<_0x3116e9[_0xda8f('0x62')][_0xda8f('0x37')];_0x1b3d28+=0x1){_0x1b3d28>0x0&&(_0x1c8c3c+='\x20'+_0x3116e9[_0xda8f('0x63')]+'\x20');_0x1c8c3c+=_0x3116e9['rules'][_0x1b3d28][_0xda8f('0x64')]?_0x1b710f(_0x3116e9[_0xda8f('0x62')][_0x1b3d28][_0xda8f('0x64')]):_0x3116e9[_0xda8f('0x62')][_0x1b3d28][_0xda8f('0x65')]+'\x20'+_0x3116e9[_0xda8f('0x62')][_0x1b3d28]['condition']+(_0x3ac4b3(_0x3116e9[_0xda8f('0x62')][_0x1b3d28][_0xda8f('0x66')])?'\x20'+_0x3116e9[_0xda8f('0x62')][_0x1b3d28][_0xda8f('0x67')]:'');}return _0x1c8c3c+')';};var _0xb853ba={'where':{'id':_0x45c7b3[_0xda8f('0x42')]['id']}},_0x413a90,_0x4e950a,_0x4fc14,_0x3abd74,_0x5de69d;_0xb853ba=_[_0xda8f('0x3e')]({},_0xb853ba,_0x45c7b3[_0xda8f('0x3f')]);return db[_0xda8f('0x2c')]['find'](_0xb853ba)[_0xda8f('0x23')](function(_0x4be953){if(_0x4be953){_0x413a90=_0x4be953;return _0x4be953[_0xda8f('0x68')]();}return null;})[_0xda8f('0x23')](function(_0x4855ba){if(_0x4855ba){if(!_0x4855ba[_0xda8f('0x37')]){throw new db[(_0xda8f('0x69'))][(_0xda8f('0x6a'))](_0xda8f('0x6b'),0x193);}_0x4e950a=_0x4855ba;return db[_0xda8f('0x6c')][_0xda8f('0x6d')]({'raw':!![]});}return null;})['then'](function(_0x20278d){if(_0x20278d){_0x4fc14=_['keyBy'](_0x20278d,'id');var _0x39dac3;var _0x18fc0c=squel['select']();_0x18fc0c[_0xda8f('0x6e')](_0x413a90[_0xda8f('0x6f')]);for(var _0xba0cb7=0x0;_0xba0cb7<_0x4e950a['length'];_0xba0cb7+=0x1){_0x39dac3=_0x4e950a[_0xba0cb7][_0xda8f('0x70')]?_0x4fc14[_0x4e950a[_0xba0cb7][_0xda8f('0x70')]][_0xda8f('0x71')]:_0x4e950a[_0xba0cb7][_0xda8f('0x65')];_0x39dac3=_0x4e950a[_0xba0cb7]['function']?_[_0xda8f('0x72')](_0x125d4b[_0x4e950a[_0xba0cb7][_0xda8f('0x73')]],'%s',_0x39dac3):_0x39dac3;_0x39dac3=_0x4e950a[_0xba0cb7][_0xda8f('0x74')]?_[_0xda8f('0x72')](_0xec51c[_0x4e950a[_0xba0cb7]['format']],'%s',_0x39dac3):_0x39dac3;if(_0x4e950a[_0xba0cb7][_0xda8f('0x75')]){_0x18fc0c[_0xda8f('0x64')](_0x39dac3);}_0x4e950a[_0xba0cb7][_0xda8f('0x76')]&&_0x18fc0c[_0xda8f('0x77')](_0x39dac3,_0x4e950a[_0xba0cb7][_0xda8f('0x76')]===_0xda8f('0x78')?![]:!![]);_0x18fc0c['field'](_0x39dac3,_0x4e950a[_0xba0cb7]['alias']||_0x39dac3);}if(_0x413a90['joins']){_0x413a90['joins']=JSON[_0xda8f('0x79')](_0x413a90[_0xda8f('0x7a')]);for(var _0x4f6176=0x0;_0x4f6176<_0x413a90[_0xda8f('0x7a')][_0xda8f('0x37')];_0x4f6176+=0x1){if(_0x413a90['joins'][_0x4f6176][_0xda8f('0x2f')]&&_[_0xda8f('0x5e')](_0x13c140,_0x413a90['joins'][_0x4f6176]['type'])&&_0x413a90[_0xda8f('0x7a')][_0x4f6176][_0xda8f('0x7b')]&&_0x413a90[_0xda8f('0x7a')][_0x4f6176][_0xda8f('0x7c')]&&_0x413a90[_0xda8f('0x7a')][_0x4f6176][_0xda8f('0x7d')]){_0x18fc0c[_0x413a90[_0xda8f('0x7a')][_0x4f6176][_0xda8f('0x2f')]](_0x413a90[_0xda8f('0x7a')][_0x4f6176][_0xda8f('0x7c')],null,util[_0xda8f('0x74')](_0xda8f('0x7e'),_0x413a90['table'],_0x413a90[_0xda8f('0x7a')][_0x4f6176]['parentKey'],_0x413a90[_0xda8f('0x7a')][_0x4f6176][_0xda8f('0x7c')],_0x413a90[_0xda8f('0x7a')][_0x4f6176]['foreignKey']));}}}if(_0x413a90[_0xda8f('0x7f')]){_0x413a90['conditions']=JSON['parse'](_0x413a90[_0xda8f('0x7f')]);_0x18fc0c[_0xda8f('0x3d')](_0x1b710f(_0x413a90[_0xda8f('0x7f')][_0xda8f('0x64')]));}_0x5de69d=_0x18fc0c['clone']();_0x18fc0c[_0xda8f('0x1e')](_0x512b55);_0x18fc0c[_0xda8f('0x1d')](0x0);logger[_0xda8f('0x80')]('Limited\x20Query:',_0x18fc0c[_0xda8f('0x81')]());return dbH[_0xda8f('0x82')][_0xda8f('0x32')](_0x18fc0c[_0xda8f('0x81')](),{'type':dbH[_0xda8f('0x82')][_0xda8f('0x83')][_0xda8f('0x84')]});}})[_0xda8f('0x23')](respondWithResult(_0x17e238,null))[_0xda8f('0x45')](handleError(_0x17e238,null));};function runReport(_0x27612b,_0x39d21c,_0x4f2984){var _0xab168b=_0x39d21c['name'];var _0x50f51=0xa;var _0x2a94a6=[_0xda8f('0x52'),'left_join',_0xda8f('0x53'),_0xda8f('0x54')];var _0x528141={'SUM':_0xda8f('0x55'),'COUNT':_0xda8f('0x56'),'COUNT DISTINCT':_0xda8f('0x57'),'MAX':_0xda8f('0x58'),'MIN':_0xda8f('0x59'),'AVG':_0xda8f('0x5a'),'GROUP_CONCAT':_0xda8f('0x5b'),'GROUP_CONCAT ASC':_0xda8f('0x85'),'GROUP_CONCAT DESC':_0xda8f('0x86')};var _0x34ede2={'SEC_TO_TIME':_0xda8f('0x87'),'DATE':_0xda8f('0x5c'),'HOUR':_0xda8f('0x5d'),'ROUND':_0xda8f('0x88'),'UNIX_TIMESTAMP':_0xda8f('0x89')};var _0x3fdae7=function(_0x48c188){return!_[_0xda8f('0x5e')]([_0xda8f('0x5f'),_0xda8f('0x60'),'IS\x20EMPTY',_0xda8f('0x61')],_0x48c188);};var _0x4e8b20=function(_0x1b8bd5){if(!_0x1b8bd5||!_0x1b8bd5[_0xda8f('0x62')][_0xda8f('0x37')]){return'';}for(var _0x24593c='(',_0x318261=0x0;_0x318261<_0x1b8bd5[_0xda8f('0x62')][_0xda8f('0x37')];_0x318261+=0x1){_0x318261>0x0&&(_0x24593c+='\x20'+_0x1b8bd5[_0xda8f('0x63')]+'\x20');_0x24593c+=_0x1b8bd5[_0xda8f('0x62')][_0x318261]['group']?_0x4e8b20(_0x1b8bd5['rules'][_0x318261][_0xda8f('0x64')]):_0x1b8bd5[_0xda8f('0x62')][_0x318261]['field']+'\x20'+_0x1b8bd5['rules'][_0x318261][_0xda8f('0x66')]+(_0x3fdae7(_0x1b8bd5['rules'][_0x318261][_0xda8f('0x66')])?'\x20'+_0x1b8bd5[_0xda8f('0x62')][_0x318261]['value']:'');}return _0x24593c+')';};var _0x4a543a={'where':{'id':_0x27612b['id']}},_0xf913a3,_0x1cdb27,_0x1d778c,_0x5b5f35,_0x2778e7;_0x4a543a=_['merge']({},_0x4a543a,_0x4f2984);return db[_0xda8f('0x2c')]['find'](_0x4a543a)[_0xda8f('0x23')](function(_0x1cf326){if(_0x1cf326){_0xf913a3=_0x1cf326;return _0x1cf326[_0xda8f('0x68')]();}return null;})[_0xda8f('0x23')](function(_0x3bbb1c){if(_0x3bbb1c){if(!_0x3bbb1c[_0xda8f('0x37')]){throw new db[(_0xda8f('0x69'))][(_0xda8f('0x6a'))](_0xda8f('0x6b'),0x193);}_0x1cdb27=_0x3bbb1c;return db[_0xda8f('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xda8f('0x23')](function(_0x38188a){if(_0x38188a){_0x1d778c=_[_0xda8f('0x8a')](_0x38188a,'id');var _0x19902e;var _0x3866ce=squel[_0xda8f('0x8b')]();_0x3866ce[_0xda8f('0x6e')](_0xf913a3['table']);for(var _0x53a9c3=0x0;_0x53a9c3<_0x1cdb27[_0xda8f('0x37')];_0x53a9c3+=0x1){_0x19902e=_0x1cdb27[_0x53a9c3][_0xda8f('0x70')]?_0x1d778c[_0x1cdb27[_0x53a9c3][_0xda8f('0x70')]][_0xda8f('0x71')]:_0x1cdb27[_0x53a9c3][_0xda8f('0x65')];_0x19902e=_0x1cdb27[_0x53a9c3][_0xda8f('0x73')]?_[_0xda8f('0x72')](_0x528141[_0x1cdb27[_0x53a9c3][_0xda8f('0x73')]],'%s',_0x19902e):_0x19902e;_0x19902e=_0x1cdb27[_0x53a9c3][_0xda8f('0x74')]?_[_0xda8f('0x72')](_0x34ede2[_0x1cdb27[_0x53a9c3]['format']],'%s',_0x19902e):_0x19902e;if(_0x1cdb27[_0x53a9c3]['groupBy']){_0x3866ce['group'](_0x19902e);}_0x1cdb27[_0x53a9c3][_0xda8f('0x76')]&&_0x3866ce[_0xda8f('0x77')](_0x19902e,_0x1cdb27[_0x53a9c3][_0xda8f('0x76')]===_0xda8f('0x78')?![]:!![]);_0x3866ce[_0xda8f('0x65')](_0x19902e,_0x1cdb27[_0x53a9c3][_0xda8f('0x8c')]||_0x19902e);}if(_0xf913a3[_0xda8f('0x7a')]){_0xf913a3[_0xda8f('0x7a')]=JSON[_0xda8f('0x79')](_0xf913a3['joins']);for(var _0x1de696=0x0;_0x1de696<_0xf913a3[_0xda8f('0x7a')][_0xda8f('0x37')];_0x1de696+=0x1){if(_0xf913a3[_0xda8f('0x7a')][_0x1de696][_0xda8f('0x2f')]&&_['includes'](_0x2a94a6,_0xf913a3['joins'][_0x1de696][_0xda8f('0x2f')])&&_0xf913a3[_0xda8f('0x7a')][_0x1de696][_0xda8f('0x7b')]&&_0xf913a3[_0xda8f('0x7a')][_0x1de696][_0xda8f('0x7c')]&&_0xf913a3[_0xda8f('0x7a')][_0x1de696][_0xda8f('0x7d')]){_0x3866ce[_0xf913a3['joins'][_0x1de696][_0xda8f('0x2f')]](_0xf913a3['joins'][_0x1de696][_0xda8f('0x7c')],null,util[_0xda8f('0x74')]('%s.%s\x20=\x20%s.%s',_0xf913a3['table'],_0xf913a3[_0xda8f('0x7a')][_0x1de696][_0xda8f('0x7b')],_0xf913a3[_0xda8f('0x7a')][_0x1de696]['foreignTable'],_0xf913a3[_0xda8f('0x7a')][_0x1de696]['foreignKey']));}}}if(_0xf913a3['conditions']){_0xf913a3['conditions']=JSON[_0xda8f('0x79')](_0xf913a3[_0xda8f('0x7f')]);_0x3866ce[_0xda8f('0x3d')](_0x4e8b20(_0xf913a3[_0xda8f('0x7f')]['group']));}_0x2778e7=_0x3866ce[_0xda8f('0x8d')]();_0x3866ce[_0xda8f('0x1e')](_0x50f51);_0x3866ce[_0xda8f('0x1d')](0x0);return;}})['then'](function(){if(_0x39d21c[_0xda8f('0x8e')]===_0xda8f('0x8f')){return null;}var _0x581ade=_[_0xda8f('0x3e')](_0x39d21c,{'name':_0x39d21c[_0xda8f('0x90')]||_0x39d21c[_0xda8f('0x28')]||_0xf913a3['name'],'basename':_0xab168b,'savename':util['format'](_0xda8f('0x91'),_0x39d21c[_0xda8f('0x28')]||_0xf913a3[_0xda8f('0x28')],require(_0xda8f('0x92'))['generate'](0x4),_0x39d21c[_0xda8f('0x8e')]||'csv'),'reportId':_0xf913a3['id'],'reportType':_0xda8f('0x93')});return db[_0xda8f('0x94')][_0xda8f('0x46')](_0x581ade,{'raw':!![]});})['then'](function(_0x43a59d){if(_0xf913a3[_0xda8f('0x6f')]===_0xda8f('0x95')){_0x2778e7[_0xda8f('0x3d')](_0xf913a3[_0xda8f('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x39d21c[_0xda8f('0x96')],_0x39d21c['endDate']);}else{_0x2778e7[_0xda8f('0x3d')](_0xf913a3['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x39d21c[_0xda8f('0x96')],_0x39d21c[_0xda8f('0x97')]);}if(_0x43a59d){logger[_0xda8f('0x98')](_0xda8f('0x99'),_0x2778e7['toString']());require(_0xda8f('0x9a'))[_0xda8f('0x9b')](path[_0xda8f('0x52')](__dirname,_0xda8f('0x9c'),_0x43a59d[_0xda8f('0x8e')]),[_0x43a59d['id'],_0x2778e7['toString'](),path['join'](__dirname,_0xda8f('0x9d'),_0x43a59d[_0xda8f('0x9e')]),_0xab168b]);return _0x43a59d;}else{var _0x5aa84c=squel['select']();_0x5aa84c[_0xda8f('0x6e')]('('+_0x2778e7[_0xda8f('0x81')]()+')',_0xda8f('0x9f'));_0x5aa84c[_0xda8f('0x65')](_0xda8f('0xa0'),_0xda8f('0x1c'));_0x2778e7[_0xda8f('0x1e')](_0x39d21c['limit']||_0x50f51);_0x2778e7['offset'](_0x39d21c[_0xda8f('0x1d')]||0x0);return dbH[_0xda8f('0x82')]['query'](_0x5aa84c[_0xda8f('0x81')](),{'type':dbH[_0xda8f('0x82')][_0xda8f('0x83')]['SELECT']})[_0xda8f('0x23')](function(_0x4886fa){if(!_0x4886fa[_0xda8f('0x37')]){_0x5b5f35=0x0;}else{_0x5b5f35=_0x4886fa[0x0]['count']||0x0;}return dbH[_0xda8f('0x82')][_0xda8f('0x32')](_0x2778e7[_0xda8f('0x81')](),{'type':dbH[_0xda8f('0x82')][_0xda8f('0x83')][_0xda8f('0x84')]});})['then'](function(_0x3f038f){return{'rows':_0x3f038f||[],'count':_0x5b5f35};});}});}exports[_0xda8f('0xa1')]=function(_0x5c2979,_0x406ee3){return runReport(_0x5c2979[_0xda8f('0x42')],_0x5c2979['query'],_0x5c2979[_0xda8f('0x3f')])[_0xda8f('0x23')](respondWithResult(_0x406ee3,null))['catch'](handleError(_0x406ee3,null));};exports[_0xda8f('0xa2')]=runReport;exports[_0xda8f('0x32')]=function(_0x21f257,_0x55a677){var _0x1e4fe0=0xa;var _0x1a9f05=[_0xda8f('0x52'),_0xda8f('0xa3'),_0xda8f('0x53'),'cross_join'];var _0x5e442d={'SUM':_0xda8f('0x55'),'COUNT':_0xda8f('0x56'),'COUNT DISTINCT':_0xda8f('0x57'),'MAX':'MAX(%s)','MIN':_0xda8f('0x59'),'AVG':_0xda8f('0x5a'),'GROUP_CONCAT':_0xda8f('0x5b'),'GROUP_CONCAT ASC':_0xda8f('0x85'),'GROUP_CONCAT DESC':_0xda8f('0x86')};var _0x1250a4={'SEC_TO_TIME':_0xda8f('0x87'),'DATE':_0xda8f('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0xda8f('0x88'),'UNIX_TIMESTAMP':_0xda8f('0x89')};var _0x513abd=function(_0x220d51){return!_[_0xda8f('0x5e')]([_0xda8f('0x5f'),_0xda8f('0x60'),_0xda8f('0xa4'),_0xda8f('0x61')],_0x220d51);};var _0x3aaae6=function(_0x5995ae){if(!_0x5995ae||!_0x5995ae[_0xda8f('0x62')][_0xda8f('0x37')]){return'';}for(var _0x16bb32='(',_0x26478e=0x0;_0x26478e<_0x5995ae[_0xda8f('0x62')][_0xda8f('0x37')];_0x26478e+=0x1){_0x26478e>0x0&&(_0x16bb32+='\x20'+_0x5995ae['operator']+'\x20');_0x16bb32+=_0x5995ae[_0xda8f('0x62')][_0x26478e]['group']?_0x3aaae6(_0x5995ae[_0xda8f('0x62')][_0x26478e][_0xda8f('0x64')]):_0x5995ae[_0xda8f('0x62')][_0x26478e][_0xda8f('0x65')]+'\x20'+_0x5995ae['rules'][_0x26478e][_0xda8f('0x66')]+(_0x513abd(_0x5995ae[_0xda8f('0x62')][_0x26478e][_0xda8f('0x66')])?'\x20'+_0x5995ae[_0xda8f('0x62')][_0x26478e][_0xda8f('0x67')]:'');}return _0x16bb32+')';};var _0x54b8b3={'where':{'id':_0x21f257['params']['id']}},_0x1503a2,_0x4733ae,_0x3a9e2e,_0x499bbd,_0x12c7e3;_0x54b8b3=_[_0xda8f('0x3e')]({},_0x54b8b3,_0x21f257[_0xda8f('0x3f')]);return db[_0xda8f('0x2c')][_0xda8f('0x44')](_0x54b8b3)[_0xda8f('0x23')](function(_0x34eb40){if(_0x34eb40){_0x1503a2=_0x34eb40;return _0x34eb40[_0xda8f('0x68')]();}return null;})[_0xda8f('0x23')](function(_0x621336){if(_0x621336){if(!_0x621336['length']){throw new db[(_0xda8f('0x69'))]['ValidationErrorItem'](_0xda8f('0x6b'),0x193);}_0x4733ae=_0x621336;return db[_0xda8f('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xda8f('0x23')](function(_0x8f32ce){if(_0x8f32ce){_0x3a9e2e=_[_0xda8f('0x8a')](_0x8f32ce,'id');var _0x191954;var _0x1d7ba4=squel['select']();_0x1d7ba4['from'](_0x1503a2[_0xda8f('0x6f')]);for(var _0x3da5ea=0x0;_0x3da5ea<_0x4733ae[_0xda8f('0x37')];_0x3da5ea+=0x1){_0x191954=_0x4733ae[_0x3da5ea][_0xda8f('0x70')]?_0x3a9e2e[_0x4733ae[_0x3da5ea]['MetricId']]['metric']:_0x4733ae[_0x3da5ea][_0xda8f('0x65')];_0x191954=_0x4733ae[_0x3da5ea]['function']?_[_0xda8f('0x72')](_0x5e442d[_0x4733ae[_0x3da5ea]['function']],'%s',_0x191954):_0x191954;_0x191954=_0x4733ae[_0x3da5ea][_0xda8f('0x74')]?_[_0xda8f('0x72')](_0x1250a4[_0x4733ae[_0x3da5ea][_0xda8f('0x74')]],'%s',_0x191954):_0x191954;if(_0x4733ae[_0x3da5ea]['groupBy']){_0x1d7ba4[_0xda8f('0x64')](_0x191954);}_0x4733ae[_0x3da5ea][_0xda8f('0x76')]&&_0x1d7ba4[_0xda8f('0x77')](_0x191954,_0x4733ae[_0x3da5ea][_0xda8f('0x76')]===_0xda8f('0x78')?![]:!![]);_0x1d7ba4[_0xda8f('0x65')](_0x191954,_0x4733ae[_0x3da5ea]['alias']||_0x191954);}if(_0x1503a2[_0xda8f('0x7a')]){_0x1503a2['joins']=JSON[_0xda8f('0x79')](_0x1503a2['joins']);for(var _0x4ce235=0x0;_0x4ce235<_0x1503a2[_0xda8f('0x7a')][_0xda8f('0x37')];_0x4ce235+=0x1){if(_0x1503a2['joins'][_0x4ce235][_0xda8f('0x2f')]&&_['includes'](_0x1a9f05,_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x2f')])&&_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x7b')]&&_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x7c')]&&_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x7d')]){_0x1d7ba4[_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x2f')]](_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x7c')],null,util[_0xda8f('0x74')](_0xda8f('0x7e'),_0x1503a2['table'],_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x7b')],_0x1503a2['joins'][_0x4ce235][_0xda8f('0x7c')],_0x1503a2[_0xda8f('0x7a')][_0x4ce235][_0xda8f('0x7d')]));}}}if(_0x1503a2[_0xda8f('0x7f')]){_0x1503a2[_0xda8f('0x7f')]=JSON['parse'](_0x1503a2[_0xda8f('0x7f')]);_0x1d7ba4[_0xda8f('0x3d')](_0x3aaae6(_0x1503a2[_0xda8f('0x7f')]['group']));}_0x12c7e3=_0x1d7ba4['clone']();_0x1d7ba4[_0xda8f('0x1e')](_0x1e4fe0);_0x1d7ba4[_0xda8f('0x1d')](0x0);logger[_0xda8f('0x80')](_0xda8f('0xa5'),_0x1d7ba4[_0xda8f('0x81')]());return dbH['sequelize'][_0xda8f('0x32')](_0x1d7ba4[_0xda8f('0x81')](),{'type':dbH[_0xda8f('0x82')][_0xda8f('0x83')][_0xda8f('0x84')]});}})[_0xda8f('0x23')](function(){return{'sql':_0x12c7e3['toString']()};})['then'](respondWithResult(_0x55a677,null))[_0xda8f('0x45')](handleError(_0x55a677,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index c087899..8c26b34 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 _0x8703=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x2a4569,_0x353e8f){var _0x27cae3=function(_0x4c809f){while(--_0x4c809f){_0x2a4569['push'](_0x2a4569['shift']());}};_0x27cae3(++_0x353e8f);}(_0x8703,0x196));var _0x3870=function(_0x19afbc,_0x5bc711){_0x19afbc=_0x19afbc-0x0;var _0x22a698=_0x8703[_0x19afbc];return _0x22a698;};'use strict';var _=require(_0x3870('0x0'));var util=require(_0x3870('0x1'));var logger=require(_0x3870('0x2'))('api');var moment=require(_0x3870('0x3'));var BPromise=require(_0x3870('0x4'));var rp=require(_0x3870('0x5'));var fs=require('fs');var path=require(_0x3870('0x6'));var rimraf=require(_0x3870('0x7'));var config=require('../../config/environment');var attributes=require(_0x3870('0x8'));module[_0x3870('0x9')]=function(_0x4f8bea,_0xf8468a){return _0x4f8bea['define'](_0x3870('0xa'),attributes,{'tableName':_0x3870('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccf8=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xccf8,0x1b6));var _0x8ccf=function(_0x4af703,_0x1b6475){_0x4af703=_0x4af703-0x0;var _0x380feb=_0xccf8[_0x4af703];return _0x380feb;};'use strict';var _=require(_0x8ccf('0x0'));var util=require(_0x8ccf('0x1'));var logger=require(_0x8ccf('0x2'))(_0x8ccf('0x3'));var moment=require(_0x8ccf('0x4'));var BPromise=require(_0x8ccf('0x5'));var rp=require(_0x8ccf('0x6'));var fs=require('fs');var path=require(_0x8ccf('0x7'));var rimraf=require('rimraf');var config=require(_0x8ccf('0x8'));var attributes=require(_0x8ccf('0x9'));module[_0x8ccf('0xa')]=function(_0x4b5f49,_0x19352d){return _0x4b5f49[_0x8ccf('0xb')](_0x8ccf('0xc'),attributes,{'tableName':_0x8ccf('0xd'),'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 9685f1d..7b48ca3 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 _0x44fd=['client','request','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise'];(function(_0x273333,_0x279f46){var _0x2c6e8f=function(_0x17c2c0){while(--_0x17c2c0){_0x273333['push'](_0x273333['shift']());}};_0x2c6e8f(++_0x279f46);}(_0x44fd,0x1d8));var _0xd44f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x44fd[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xd44f('0x0'));var util=require(_0xd44f('0x1'));var moment=require(_0xd44f('0x2'));var BPromise=require(_0xd44f('0x3'));var rs=require(_0xd44f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd44f('0x5'));var logger=require(_0xd44f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd44f('0x7'));var client=jayson[_0xd44f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29bfd2,_0x5e9e46,_0x3a37d1){return new BPromise(function(_0x321bb0,_0x149173){return client[_0xd44f('0x9')](_0x29bfd2,_0x3a37d1)[_0xd44f('0xa')](function(_0x474cda){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5e9e46,_0xd44f('0xb'));logger[_0xd44f('0xc')](_0xd44f('0xd'),_0x5e9e46,_0xd44f('0xb'),JSON[_0xd44f('0xe')](_0x474cda));if(_0x474cda[_0xd44f('0xf')]){if(_0x474cda[_0xd44f('0xf')]['code']===0x1f4){logger[_0xd44f('0xf')](_0xd44f('0x10'),_0x5e9e46,_0x474cda['error'][_0xd44f('0x11')]);return _0x149173(_0x474cda['error'][_0xd44f('0x11')]);}logger[_0xd44f('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5e9e46,_0x474cda[_0xd44f('0xf')][_0xd44f('0x11')]);return _0x321bb0(_0x474cda['error']['message']);}else{logger[_0xd44f('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5e9e46,_0xd44f('0xb'));_0x321bb0(_0x474cda[_0xd44f('0x13')][_0xd44f('0x11')]);}})['catch'](function(_0x15beca){logger[_0xd44f('0xf')](_0xd44f('0x10'),_0x5e9e46,_0x15beca);_0x149173(_0x15beca);});});} \ No newline at end of file +var _0xbbc8=['client','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x1444e4,_0xb9594c){var _0x306585=function(_0x97153f){while(--_0x97153f){_0x1444e4['push'](_0x1444e4['shift']());}};_0x306585(++_0xb9594c);}(_0xbbc8,0xd0));var _0x8bbc=function(_0x22b390,_0x959f67){_0x22b390=_0x22b390-0x0;var _0x4ac5ac=_0xbbc8[_0x22b390];return _0x4ac5ac;};'use strict';var _=require(_0x8bbc('0x0'));var util=require(_0x8bbc('0x1'));var moment=require(_0x8bbc('0x2'));var BPromise=require(_0x8bbc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bbc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bbc('0x5'));var logger=require('../../config/logger')(_0x8bbc('0x6'));var config=require('../../config/environment');var jayson=require(_0x8bbc('0x7'));var client=jayson[_0x8bbc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dfb40,_0x559db2,_0x481b8e){return new BPromise(function(_0x997d20,_0x21ef0b){return client['request'](_0x3dfb40,_0x481b8e)[_0x8bbc('0x9')](function(_0x4c8418){logger['info'](_0x8bbc('0xa'),_0x559db2,_0x8bbc('0xb'));logger[_0x8bbc('0xc')](_0x8bbc('0xd'),_0x559db2,_0x8bbc('0xb'),JSON['stringify'](_0x4c8418));if(_0x4c8418[_0x8bbc('0xe')]){if(_0x4c8418['error']['code']===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x559db2,_0x4c8418[_0x8bbc('0xe')][_0x8bbc('0xf')]);return _0x21ef0b(_0x4c8418[_0x8bbc('0xe')][_0x8bbc('0xf')]);}logger[_0x8bbc('0xe')](_0x8bbc('0xa'),_0x559db2,_0x4c8418[_0x8bbc('0xe')][_0x8bbc('0xf')]);return _0x997d20(_0x4c8418[_0x8bbc('0xe')]['message']);}else{logger[_0x8bbc('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x559db2,_0x8bbc('0xb'));_0x997d20(_0x4c8418[_0x8bbc('0x11')][_0x8bbc('0xf')]);}})['catch'](function(_0x4636bd){logger[_0x8bbc('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x559db2,_0x4636bd);_0x21ef0b(_0x4636bd);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 19c750c..93f9d05 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 _0x4bbf=['/:id/query','query','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4bbf,0xd0));var _0xf4bb=function(_0x17cdb2,_0x16f15d){_0x17cdb2=_0x17cdb2-0x0;var _0x488955=_0x4bbf[_0x17cdb2];return _0x488955;};'use strict';var multer=require(_0xf4bb('0x0'));var util=require('util');var path=require(_0xf4bb('0x1'));var timeout=require(_0xf4bb('0x2'));var express=require('express');var router=express[_0xf4bb('0x3')]();var fs_extra=require(_0xf4bb('0x4'));var auth=require(_0xf4bb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4bb('0x6'));var controller=require(_0xf4bb('0x7'));router['get']('/',auth[_0xf4bb('0x8')](),controller[_0xf4bb('0x9')]);router['get'](_0xf4bb('0xa'),auth[_0xf4bb('0x8')](),controller[_0xf4bb('0xb')]);router[_0xf4bb('0xc')](_0xf4bb('0xd'),auth[_0xf4bb('0x8')](),controller[_0xf4bb('0xe')]);router['get'](_0xf4bb('0xf'),auth[_0xf4bb('0x8')](),controller[_0xf4bb('0x10')]);router['get'](_0xf4bb('0x11'),auth[_0xf4bb('0x8')](),controller[_0xf4bb('0x12')]);router[_0xf4bb('0x13')]('/',auth[_0xf4bb('0x8')](),controller['create']);router[_0xf4bb('0x14')](_0xf4bb('0xa'),auth[_0xf4bb('0x8')](),controller[_0xf4bb('0x15')]);router[_0xf4bb('0x16')](_0xf4bb('0xa'),auth[_0xf4bb('0x8')](),controller[_0xf4bb('0x17')]);module[_0xf4bb('0x18')]=router; \ No newline at end of file +var _0xc4ec=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x238469,_0x28b7e9){var _0x18c9e5=function(_0x1df8e7){while(--_0x1df8e7){_0x238469['push'](_0x238469['shift']());}};_0x18c9e5(++_0x28b7e9);}(_0xc4ec,0x1d1));var _0xcc4e=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0xc4ec[_0x38ce4c];return _0x5d4544;};'use strict';var multer=require(_0xcc4e('0x0'));var util=require('util');var path=require(_0xcc4e('0x1'));var timeout=require(_0xcc4e('0x2'));var express=require(_0xcc4e('0x3'));var router=express[_0xcc4e('0x4')]();var fs_extra=require(_0xcc4e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcc4e('0x6'));var config=require(_0xcc4e('0x7'));var controller=require(_0xcc4e('0x8'));router[_0xcc4e('0x9')]('/',auth[_0xcc4e('0xa')](),controller['index']);router[_0xcc4e('0x9')](_0xcc4e('0xb'),auth[_0xcc4e('0xa')](),controller[_0xcc4e('0xc')]);router[_0xcc4e('0x9')](_0xcc4e('0xd'),auth[_0xcc4e('0xa')](),controller[_0xcc4e('0xe')]);router['get'](_0xcc4e('0xf'),auth['isAuthenticated'](),controller[_0xcc4e('0x10')]);router['get'](_0xcc4e('0x11'),auth[_0xcc4e('0xa')](),controller[_0xcc4e('0x12')]);router[_0xcc4e('0x13')]('/',auth[_0xcc4e('0xa')](),controller[_0xcc4e('0x14')]);router[_0xcc4e('0x15')](_0xcc4e('0xb'),auth[_0xcc4e('0xa')](),controller[_0xcc4e('0x16')]);router[_0xcc4e('0x17')](_0xcc4e('0xb'),auth['isAuthenticated'](),controller[_0xcc4e('0x18')]);module[_0xcc4e('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7aa2ef9..91931c9 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x242f63,_0x228566){var _0x17df2b=function(_0x1bf179){while(--_0x1bf179){_0x242f63['push'](_0x242f63['shift']());}};_0x17df2b(++_0x228566);}(_0x6f47,0xc7));var _0x76f4=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x6f47[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2bd8=['TEXT','sequelize','STRING'];(function(_0x416c1a,_0x19c685){var _0xcf7188=function(_0x1e31e2){while(--_0x1e31e2){_0x416c1a['push'](_0x416c1a['shift']());}};_0xcf7188(++_0x19c685);}(_0x2bd8,0x130));var _0x82bd=function(_0x9c284f,_0xc6c39f){_0x9c284f=_0x9c284f-0x0;var _0x325d5e=_0x2bd8[_0x9c284f];return _0x325d5e;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x82bd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x82bd('0x1')]},'parent':{'type':Sequelize[_0x82bd('0x1')]},'table':{'type':Sequelize[_0x82bd('0x1')]},'conditions':{'type':Sequelize[_0x82bd('0x2')]},'joins':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 537ee92..d128675 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 _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0xd0e639,_0x60783b){var _0x1a6948=function(_0x59bf93){while(--_0x59bf93){_0xd0e639['push'](_0xd0e639['shift']());}};_0x1a6948(++_0x60783b);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x468e45,_0x27afe2){var _0x2c1e49=function(_0x10a6b3){while(--_0x10a6b3){_0x468e45['push'](_0x468e45['shift']());}};_0x2c1e49(++_0x27afe2);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index dada23b..22eddc6 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 _0xb30f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x3b8952,_0x24296d){var _0x4ad6a8=function(_0x978fbe){while(--_0x978fbe){_0x3b8952['push'](_0x3b8952['shift']());}};_0x4ad6a8(++_0x24296d);}(_0xb30f,0x89));var _0xfb30=function(_0x2e41ed,_0x26dc33){_0x2e41ed=_0x2e41ed-0x0;var _0xf12845=_0xb30f[_0x2e41ed];return _0xf12845;};'use strict';var _=require(_0xfb30('0x0'));var util=require(_0xfb30('0x1'));var logger=require(_0xfb30('0x2'))(_0xfb30('0x3'));var moment=require(_0xfb30('0x4'));var BPromise=require(_0xfb30('0x5'));var rp=require(_0xfb30('0x6'));var fs=require('fs');var path=require(_0xfb30('0x7'));var rimraf=require(_0xfb30('0x8'));var config=require(_0xfb30('0x9'));var attributes=require('./analyticDefaultReport.attributes');module[_0xfb30('0xa')]=function(_0x5358f4,_0x34e987){return _0x5358f4[_0xfb30('0xb')](_0xfb30('0xc'),attributes,{'tableName':_0xfb30('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8776=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','lodash','util','api'];(function(_0xb46359,_0x4391ad){var _0x6d9807=function(_0x350fdc){while(--_0x350fdc){_0xb46359['push'](_0xb46359['shift']());}};_0x6d9807(++_0x4391ad);}(_0x8776,0xd9));var _0x6877=function(_0x5bd6c7,_0x24f383){_0x5bd6c7=_0x5bd6c7-0x0;var _0x5d8ef7=_0x8776[_0x5bd6c7];return _0x5d8ef7;};'use strict';var _=require(_0x6877('0x0'));var util=require(_0x6877('0x1'));var logger=require('../../config/logger')(_0x6877('0x2'));var moment=require(_0x6877('0x3'));var BPromise=require(_0x6877('0x4'));var rp=require(_0x6877('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6877('0x6'));var config=require(_0x6877('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x6877('0x8')]=function(_0x32f057,_0x1cdb4c){return _0x32f057[_0x6877('0x9')](_0x6877('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 1f58bcb..a29c329 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 _0xf16f=['client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/environment','jayson/promise'];(function(_0x47a14b,_0x6f8c0){var _0x52cf12=function(_0x232ef2){while(--_0x232ef2){_0x47a14b['push'](_0x47a14b['shift']());}};_0x52cf12(++_0x6f8c0);}(_0xf16f,0x1c2));var _0xff16=function(_0x2bc4fd,_0x298c78){_0x2bc4fd=_0x2bc4fd-0x0;var _0x59a56d=_0xf16f[_0x2bc4fd];return _0x59a56d;};'use strict';var _=require(_0xff16('0x0'));var util=require(_0xff16('0x1'));var moment=require(_0xff16('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff16('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xff16('0x4'));var jayson=require(_0xff16('0x5'));var client=jayson[_0xff16('0x6')][_0xff16('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2be742,_0x3eb5df,_0x587495){return new BPromise(function(_0x700de7,_0x2fd543){return client['request'](_0x2be742,_0x587495)[_0xff16('0x8')](function(_0x2bf9c8){logger[_0xff16('0x9')](_0xff16('0xa'),_0x3eb5df,_0xff16('0xb'));logger[_0xff16('0xc')](_0xff16('0xd'),_0x3eb5df,_0xff16('0xb'),JSON[_0xff16('0xe')](_0x2bf9c8));if(_0x2bf9c8[_0xff16('0xf')]){if(_0x2bf9c8['error'][_0xff16('0x10')]===0x1f4){logger[_0xff16('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3eb5df,_0x2bf9c8[_0xff16('0xf')][_0xff16('0x11')]);return _0x2fd543(_0x2bf9c8['error'][_0xff16('0x11')]);}logger['error'](_0xff16('0xa'),_0x3eb5df,_0x2bf9c8[_0xff16('0xf')][_0xff16('0x11')]);return _0x700de7(_0x2bf9c8[_0xff16('0xf')][_0xff16('0x11')]);}else{logger['info'](_0xff16('0xa'),_0x3eb5df,_0xff16('0xb'));_0x700de7(_0x2bf9c8[_0xff16('0x12')][_0xff16('0x11')]);}})['catch'](function(_0x29d578){logger[_0xff16('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3eb5df,_0x29d578);_0x2fd543(_0x29d578);});});} \ No newline at end of file +var _0x1559=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x14a84e,_0xffb06){var _0x2aca47=function(_0x5cdc00){while(--_0x5cdc00){_0x14a84e['push'](_0x14a84e['shift']());}};_0x2aca47(++_0xffb06);}(_0x1559,0x163));var _0x9155=function(_0x48fb10,_0xa50a89){_0x48fb10=_0x48fb10-0x0;var _0x534251=_0x1559[_0x48fb10];return _0x534251;};'use strict';var _=require(_0x9155('0x0'));var util=require('util');var moment=require(_0x9155('0x1'));var BPromise=require('bluebird');var rs=require(_0x9155('0x2'));var fs=require('fs');var Redis=require(_0x9155('0x3'));var db=require(_0x9155('0x4'))['db'];var utils=require(_0x9155('0x5'));var logger=require(_0x9155('0x6'))('rpc');var config=require(_0x9155('0x7'));var jayson=require(_0x9155('0x8'));var client=jayson[_0x9155('0x9')][_0x9155('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5772f4,_0x5e8c77,_0x4c8ad0){return new BPromise(function(_0x2529cb,_0x276d48){return client['request'](_0x5772f4,_0x4c8ad0)[_0x9155('0xb')](function(_0xc2db51){logger[_0x9155('0xc')](_0x9155('0xd'),_0x5e8c77,'request\x20sent');logger[_0x9155('0xe')](_0x9155('0xf'),_0x5e8c77,_0x9155('0x10'),JSON['stringify'](_0xc2db51));if(_0xc2db51['error']){if(_0xc2db51[_0x9155('0x11')][_0x9155('0x12')]===0x1f4){logger[_0x9155('0x11')](_0x9155('0xd'),_0x5e8c77,_0xc2db51['error'][_0x9155('0x13')]);return _0x276d48(_0xc2db51[_0x9155('0x11')]['message']);}logger[_0x9155('0x11')](_0x9155('0xd'),_0x5e8c77,_0xc2db51[_0x9155('0x11')]['message']);return _0x2529cb(_0xc2db51['error'][_0x9155('0x13')]);}else{logger['info'](_0x9155('0xd'),_0x5e8c77,_0x9155('0x10'));_0x2529cb(_0xc2db51[_0x9155('0x14')][_0x9155('0x13')]);}})[_0x9155('0x15')](function(_0x21a188){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x5e8c77,_0x21a188);_0x276d48(_0x21a188);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 93e1029..d5ef8cb 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 _0x7e5c=['../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x19eef5,_0x45589c){var _0xef7759=function(_0x1a3b94){while(--_0x1a3b94){_0x19eef5['push'](_0x19eef5['shift']());}};_0xef7759(++_0x45589c);}(_0x7e5c,0xc0));var _0xc7e5=function(_0x43d0dd,_0x1bd3d2){_0x43d0dd=_0x43d0dd-0x0;var _0x233879=_0x7e5c[_0x43d0dd];return _0x233879;};'use strict';var multer=require('multer');var util=require(_0xc7e5('0x0'));var path=require(_0xc7e5('0x1'));var timeout=require(_0xc7e5('0x2'));var express=require(_0xc7e5('0x3'));var router=express[_0xc7e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7e5('0x5'));var interaction=require(_0xc7e5('0x6'));var config=require(_0xc7e5('0x7'));var controller=require(_0xc7e5('0x8'));router[_0xc7e5('0x9')]('/',auth[_0xc7e5('0xa')](),controller[_0xc7e5('0xb')]);router[_0xc7e5('0x9')](_0xc7e5('0xc'),auth[_0xc7e5('0xa')](),controller[_0xc7e5('0xd')]);router['get'](_0xc7e5('0xe'),auth[_0xc7e5('0xa')](),controller[_0xc7e5('0xf')]);router[_0xc7e5('0x9')](_0xc7e5('0x10'),auth['isAuthenticated'](),controller[_0xc7e5('0x11')]);router[_0xc7e5('0x9')]('/:id/query',auth[_0xc7e5('0xa')](),controller[_0xc7e5('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc7e5('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc7e5('0x14')](_0xc7e5('0xc'),auth[_0xc7e5('0xa')](),controller[_0xc7e5('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd939=['/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','preview'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xd939,0x12b));var _0x9d93=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0xd939[_0x49beea];return _0x27693a;};'use strict';var multer=require(_0x9d93('0x0'));var util=require(_0x9d93('0x1'));var path=require(_0x9d93('0x2'));var timeout=require(_0x9d93('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9d93('0x4'));var auth=require(_0x9d93('0x5'));var interaction=require(_0x9d93('0x6'));var config=require(_0x9d93('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9d93('0x8')](_0x9d93('0x9'),auth[_0x9d93('0xa')](),controller[_0x9d93('0xb')]);router[_0x9d93('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0x9d93('0xc')]);router[_0x9d93('0x8')](_0x9d93('0xd'),auth['isAuthenticated'](),controller[_0x9d93('0xe')]);router['get'](_0x9d93('0xf'),auth['isAuthenticated'](),controller[_0x9d93('0x10')]);router[_0x9d93('0x11')]('/',auth[_0x9d93('0xa')](),controller[_0x9d93('0x12')]);router[_0x9d93('0x13')](_0x9d93('0x9'),auth[_0x9d93('0xa')](),controller[_0x9d93('0x14')]);router[_0x9d93('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9d93('0x16')]);module[_0x9d93('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index b50800c..5b07011 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 _0x3a60=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x3a60,0x152));var _0x03a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a60[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x03a6('0x0'));module[_0x03a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x03a6('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x03a6('0x3')](_0x03a6('0x4'),_0x03a6('0x5'),_0x03a6('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x03a6('0x7')]},'endDate':{'type':Sequelize[_0x03a6('0x7')]},'status':{'type':Sequelize[_0x03a6('0x2')],'defaultValue':_0x03a6('0x8')},'type':{'type':Sequelize[_0x03a6('0x3')](_0x03a6('0x9'),_0x03a6('0xa')),'allowNull':![],'defaultValue':_0x03a6('0x9')},'reportId':{'type':Sequelize[_0x03a6('0xb')](0xb)[_0x03a6('0xc')]},'reportType':{'type':Sequelize[_0x03a6('0x2')]}}; \ No newline at end of file +var _0x38c3=['INTEGER','sequelize','STRING','ENUM','csv','xlsx','DATE','manual','scheduled'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x38c3,0x106));var _0x338c=function(_0x259ce8,_0x798276){_0x259ce8=_0x259ce8-0x0;var _0x5ef5c2=_0x38c3[_0x259ce8];return _0x5ef5c2;};'use strict';var Sequelize=require(_0x338c('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x338c('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x338c('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x338c('0x2')](_0x338c('0x3'),'pdf',_0x338c('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x338c('0x5')]},'status':{'type':Sequelize[_0x338c('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x338c('0x6'),_0x338c('0x7')),'allowNull':![],'defaultValue':_0x338c('0x6')},'reportId':{'type':Sequelize[_0x338c('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 705a2fb..6fd68ba 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 _0x8561=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','end','error','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find'];(function(_0x1b319f,_0x2598b1){var _0x19dbcf=function(_0x4e10d3){while(--_0x4e10d3){_0x1b319f['push'](_0x1b319f['shift']());}};_0x19dbcf(++_0x2598b1);}(_0x8561,0x1ee));var _0x1856=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x8561[_0x422ac3];return _0x53c0d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1856('0x0'));var zipdir=require(_0x1856('0x1'));var jsonpatch=require(_0x1856('0x2'));var rp=require(_0x1856('0x3'));var moment=require(_0x1856('0x4'));var BPromise=require(_0x1856('0x5'));var Mustache=require('mustache');var util=require(_0x1856('0x6'));var path=require(_0x1856('0x7'));var sox=require('sox');var csv=require(_0x1856('0x8'));var ejs=require(_0x1856('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1856('0xa'));var squel=require(_0x1856('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1856('0xc'));var toCsv=require(_0x1856('0x8'));var querystring=require(_0x1856('0xd'));var Papa=require(_0x1856('0xe'));var Redis=require(_0x1856('0xf'));var authService=require(_0x1856('0x10'));var qs=require(_0x1856('0x11'));var as=require(_0x1856('0x12'));var hardwareService=require(_0x1856('0x13'));var logger=require('../../config/logger')(_0x1856('0x14'));var utils=require(_0x1856('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1856('0x16'))['db'];function respondWithStatusCode(_0x197221,_0x373507){_0x373507=_0x373507||0xcc;return function(_0x3cdd50){if(_0x3cdd50){return _0x197221[_0x1856('0x17')](_0x373507);}return _0x197221['status'](_0x373507)['end']();};}function respondWithResult(_0x52b532,_0x121797){_0x121797=_0x121797||0xc8;return function(_0x54dc47){if(_0x54dc47){return _0x52b532[_0x1856('0x18')](_0x121797)[_0x1856('0x19')](_0x54dc47);}};}function respondWithFilteredResult(_0x4ee354,_0x508d7b){return function(_0x2db8c2){if(_0x2db8c2){var _0x1bfef7=typeof _0x508d7b[_0x1856('0x1a')]===_0x1856('0x1b')&&typeof _0x508d7b[_0x1856('0x1c')]===_0x1856('0x1b');var _0x598f8e=_0x2db8c2[_0x1856('0x1d')];var _0x59eac0=_0x1bfef7?0x0:_0x508d7b[_0x1856('0x1a')];var _0xcec0aa=_0x1bfef7?_0x2db8c2['count']:_0x508d7b['offset']+_0x508d7b[_0x1856('0x1c')];var _0x5155d9;if(_0xcec0aa>=_0x598f8e){_0xcec0aa=_0x598f8e;_0x5155d9=0xc8;}else{_0x5155d9=0xce;}_0x4ee354[_0x1856('0x18')](_0x5155d9);return _0x4ee354['set']('Content-Range',_0x59eac0+'-'+_0xcec0aa+'/'+_0x598f8e)[_0x1856('0x19')](_0x2db8c2);}return null;};}function patchUpdates(_0x1f92e0){return function(_0xcb4eae){try{jsonpatch['apply'](_0xcb4eae,_0x1f92e0,!![]);}catch(_0x5e49bc){return BPromise[_0x1856('0x1e')](_0x5e49bc);}return _0xcb4eae[_0x1856('0x1f')]();};}function saveUpdates(_0x1d5af0,_0x41b0a3){return function(_0x3ff8dc){if(_0x3ff8dc){return _0x3ff8dc[_0x1856('0x20')](_0x1d5af0)[_0x1856('0x21')](function(_0x5a994d){return _0x5a994d;});}return null;};}function removeEntity(_0x512477,_0x49e50b){return function(_0x44a04d){if(_0x44a04d){return _0x44a04d[_0x1856('0x22')]()[_0x1856('0x21')](function(){var _0x1ebd65=_0x44a04d['get']({'plain':!![]});var _0x2fe1c8='ExtractedReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x2fe1c8,'resourceId':_0x1ebd65['id']}})[_0x1856('0x21')](function(){return _0x44a04d;});})[_0x1856('0x21')](function(){_0x512477[_0x1856('0x18')](0xcc)[_0x1856('0x23')]();});}};}function handleEntityNotFound(_0x3a3e0a,_0x46f87a){return function(_0x4e46d1){if(!_0x4e46d1){_0x3a3e0a[_0x1856('0x17')](0x194);}return _0x4e46d1;};}function handleError(_0x90b80,_0x1dcbc2){_0x1dcbc2=_0x1dcbc2||0x1f4;return function(_0x4914fe){logger[_0x1856('0x24')](_0x4914fe['stack']);if(_0x4914fe[_0x1856('0x25')]){delete _0x4914fe['name'];}_0x90b80[_0x1856('0x18')](_0x1dcbc2)[_0x1856('0x26')](_0x4914fe);};}exports['index']=function(_0x2c275a,_0x42ff4d){var _0xef3d9b={},_0x2a616c={},_0x5bd76d={'count':0x0,'rows':[]};var _0x4afbba=_[_0x1856('0x27')](db[_0x1856('0x28')][_0x1856('0x29')],function(_0x158567){return{'name':_0x158567[_0x1856('0x2a')],'type':_0x158567[_0x1856('0x2b')][_0x1856('0x2c')]};});_0x2a616c[_0x1856('0x2d')]=_[_0x1856('0x27')](_0x4afbba,_0x1856('0x25'));_0x2a616c[_0x1856('0x2e')]=_[_0x1856('0x2f')](_0x2c275a[_0x1856('0x2e')]);_0x2a616c['filters']=_[_0x1856('0x30')](_0x2a616c[_0x1856('0x2d')],_0x2a616c[_0x1856('0x2e')]);_0xef3d9b['attributes']=_[_0x1856('0x30')](_0x2a616c[_0x1856('0x2d')],qs['fields'](_0x2c275a['query'][_0x1856('0x31')]));_0xef3d9b[_0x1856('0x32')]=_0xef3d9b[_0x1856('0x32')]['length']?_0xef3d9b[_0x1856('0x32')]:_0x2a616c['model'];if(!_0x2c275a['query'][_0x1856('0x33')](_0x1856('0x34'))){_0xef3d9b[_0x1856('0x1c')]=qs[_0x1856('0x1c')](_0x2c275a[_0x1856('0x2e')][_0x1856('0x1c')]);_0xef3d9b[_0x1856('0x1a')]=qs[_0x1856('0x1a')](_0x2c275a[_0x1856('0x2e')][_0x1856('0x1a')]);}_0xef3d9b[_0x1856('0x35')]=qs[_0x1856('0x36')](_0x2c275a[_0x1856('0x2e')]['sort']);_0xef3d9b[_0x1856('0x37')]=qs[_0x1856('0x38')](_[_0x1856('0x39')](_0x2c275a['query'],_0x2a616c[_0x1856('0x38')]),_0x4afbba);if(_0x2c275a['query'][_0x1856('0x3a')]){_0xef3d9b[_0x1856('0x37')]=_[_0x1856('0x3b')](_0xef3d9b['where'],{'$or':_[_0x1856('0x27')](_0x4afbba,function(_0x57a651){if(_0x57a651[_0x1856('0x2b')]!==_0x1856('0x3c')){var _0x319a1b={};_0x319a1b[_0x57a651['name']]={'$like':'%'+_0x2c275a[_0x1856('0x2e')]['filter']+'%'};return _0x319a1b;}})});}_0xef3d9b=_[_0x1856('0x3b')]({},_0xef3d9b,_0x2c275a[_0x1856('0x3d')]);var _0x492564={'where':_0xef3d9b[_0x1856('0x37')]};return db[_0x1856('0x28')]['count'](_0x492564)[_0x1856('0x21')](function(_0x341fc4){_0x5bd76d['count']=_0x341fc4;if(_0x2c275a[_0x1856('0x2e')][_0x1856('0x3e')]){_0xef3d9b['include']=[{'all':!![]}];}return db[_0x1856('0x28')][_0x1856('0x3f')](_0xef3d9b);})[_0x1856('0x21')](function(_0x3e49f5){_0x5bd76d[_0x1856('0x40')]=_0x3e49f5;return _0x5bd76d;})[_0x1856('0x21')](respondWithFilteredResult(_0x42ff4d,_0xef3d9b))[_0x1856('0x41')](handleError(_0x42ff4d,null));};exports['show']=function(_0x163b9c,_0x210dd9){var _0x28cbec={'raw':!![],'where':{'id':_0x163b9c[_0x1856('0x42')]['id']}},_0x1dda0c={};_0x1dda0c[_0x1856('0x2d')]=_[_0x1856('0x2f')](db[_0x1856('0x28')][_0x1856('0x29')]);_0x1dda0c['query']=_[_0x1856('0x2f')](_0x163b9c['query']);_0x1dda0c[_0x1856('0x38')]=_[_0x1856('0x30')](_0x1dda0c['model'],_0x1dda0c[_0x1856('0x2e')]);_0x28cbec['attributes']=_[_0x1856('0x30')](_0x1dda0c[_0x1856('0x2d')],qs[_0x1856('0x31')](_0x163b9c[_0x1856('0x2e')][_0x1856('0x31')]));_0x28cbec[_0x1856('0x32')]=_0x28cbec[_0x1856('0x32')][_0x1856('0x43')]?_0x28cbec[_0x1856('0x32')]:_0x1dda0c['model'];if(_0x163b9c[_0x1856('0x2e')][_0x1856('0x3e')]){_0x28cbec[_0x1856('0x44')]=[{'all':!![]}];}_0x28cbec=_[_0x1856('0x3b')]({},_0x28cbec,_0x163b9c[_0x1856('0x3d')]);return db[_0x1856('0x28')][_0x1856('0x45')](_0x28cbec)[_0x1856('0x21')](handleEntityNotFound(_0x210dd9,null))['then'](respondWithResult(_0x210dd9,null))['catch'](handleError(_0x210dd9,null));};exports[_0x1856('0x46')]=function(_0x464122,_0x1076d1){return db[_0x1856('0x28')][_0x1856('0x46')](_0x464122['body'],{})[_0x1856('0x21')](function(_0x258aa4){var _0x4c59b1=_0x464122[_0x1856('0x47')]['get']({'plain':!![]});if(!_0x4c59b1)throw new Error(_0x1856('0x48'));if(_0x4c59b1[_0x1856('0x49')]===_0x1856('0x47')){var _0x59b26d=_0x258aa4[_0x1856('0x4a')]({'plain':!![]});var _0x1c138e=_0x1856('0x4b');return db[_0x1856('0x4c')][_0x1856('0x45')]({'where':{'name':_0x1c138e,'userProfileId':_0x4c59b1[_0x1856('0x4d')]},'raw':!![]})['then'](function(_0x1201ab){if(_0x1201ab&&_0x1201ab[_0x1856('0x4e')]===0x0){return db[_0x1856('0x4f')]['create']({'name':_0x59b26d[_0x1856('0x25')],'resourceId':_0x59b26d['id'],'type':_0x1201ab[_0x1856('0x25')],'sectionId':_0x1201ab['id']},{})['then'](function(){return _0x258aa4;});}else{return _0x258aa4;}})[_0x1856('0x41')](function(_0x5a3ef5){logger['error'](_0x1856('0x50'),_0x5a3ef5);throw _0x5a3ef5;});}return _0x258aa4;})[_0x1856('0x21')](respondWithResult(_0x1076d1,0xc9))[_0x1856('0x41')](handleError(_0x1076d1,null));};exports[_0x1856('0x20')]=function(_0x3639ca,_0x1df51c){if(_0x3639ca[_0x1856('0x51')]['id']){delete _0x3639ca[_0x1856('0x51')]['id'];}return db['AnalyticExtractedReport'][_0x1856('0x45')]({'where':{'id':_0x3639ca[_0x1856('0x42')]['id']}})[_0x1856('0x21')](handleEntityNotFound(_0x1df51c,null))['then'](saveUpdates(_0x3639ca[_0x1856('0x51')],null))[_0x1856('0x21')](respondWithResult(_0x1df51c,null))[_0x1856('0x41')](handleError(_0x1df51c,null));};exports[_0x1856('0x22')]=function(_0x167b23,_0x2b52f3){return db[_0x1856('0x28')][_0x1856('0x45')]({'where':{'id':_0x167b23['params']['id']}})[_0x1856('0x21')](handleEntityNotFound(_0x2b52f3,null))[_0x1856('0x21')](removeEntity(_0x2b52f3,null))['catch'](handleError(_0x2b52f3,null));};exports[_0x1856('0x52')]=function(_0x20edb9,_0x1dd372,_0x159bd5){return db['AnalyticExtractedReport'][_0x1856('0x45')]({'where':{'id':_0x20edb9[_0x1856('0x42')]['id']},'attributes':[_0x1856('0x25'),_0x1856('0x53'),_0x1856('0x54'),'output'],'raw':!![]})[_0x1856('0x21')](handleEntityNotFound(_0x1dd372,null))[_0x1856('0x21')](function(_0x42686f){if(_0x42686f){if(!fs[_0x1856('0x55')](path['join'](config[_0x1856('0x56')],_0x1856('0x57'),_0x42686f[_0x1856('0x54')]))){throw new db[(_0x1856('0x58'))][(_0x1856('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x20edb9[_0x1856('0x2e')][_0x1856('0x5a')]){return _0x1dd372[_0x1856('0x17')](0xc8);}return _0x1dd372[_0x1856('0x52')](path['join'](config[_0x1856('0x56')],_0x1856('0x57'),_0x42686f['savename']),util[_0x1856('0x5b')](_0x1856('0x5c'),_0x42686f[_0x1856('0x53')]||_0x42686f[_0x1856('0x25')],_0x42686f['output'][_0x1856('0x5d')]()));}})[_0x1856('0x41')](handleError(_0x1dd372,null));}; \ No newline at end of file +var _0x6356=['ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','merge','find','create','body','user','get','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','Sequelize','ValidationError','exists','root','server/files/reports','savename','format','%s.%s','toLowerCase','rimraf','request-promise','moment','mustache','path','to-csv'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6356,0x17e));var _0x6635=function(_0x50bace,_0x16f8b7){_0x50bace=_0x50bace-0x0;var _0x25dc5e=_0x6356[_0x50bace];return _0x25dc5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6635('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6635('0x1'));var moment=require(_0x6635('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6635('0x3'));var util=require('util');var path=require(_0x6635('0x4'));var sox=require('sox');var csv=require(_0x6635('0x5'));var ejs=require(_0x6635('0x6'));var fs=require('fs');var fs_extra=require(_0x6635('0x7'));var _=require('lodash');var squel=require(_0x6635('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6635('0x9'));var toCsv=require(_0x6635('0x5'));var querystring=require(_0x6635('0xa'));var Papa=require(_0x6635('0xb'));var Redis=require(_0x6635('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6635('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6635('0xe'));var logger=require(_0x6635('0xf'))(_0x6635('0x10'));var utils=require(_0x6635('0x11'));var config=require(_0x6635('0x12'));var licenseUtil=require(_0x6635('0x13'));var db=require(_0x6635('0x14'))['db'];function respondWithStatusCode(_0x1d09b5,_0x579a44){_0x579a44=_0x579a44||0xcc;return function(_0xcdeca5){if(_0xcdeca5){return _0x1d09b5[_0x6635('0x15')](_0x579a44);}return _0x1d09b5[_0x6635('0x16')](_0x579a44)['end']();};}function respondWithResult(_0x510738,_0x2c087f){_0x2c087f=_0x2c087f||0xc8;return function(_0x5a8d86){if(_0x5a8d86){return _0x510738[_0x6635('0x16')](_0x2c087f)[_0x6635('0x17')](_0x5a8d86);}};}function respondWithFilteredResult(_0x37544d,_0x583600){return function(_0xbff8d7){if(_0xbff8d7){var _0x5cece7=typeof _0x583600[_0x6635('0x18')]===_0x6635('0x19')&&typeof _0x583600[_0x6635('0x1a')]===_0x6635('0x19');var _0x422a10=_0xbff8d7[_0x6635('0x1b')];var _0x5ab1d8=_0x5cece7?0x0:_0x583600[_0x6635('0x18')];var _0x2e7657=_0x5cece7?_0xbff8d7[_0x6635('0x1b')]:_0x583600[_0x6635('0x18')]+_0x583600[_0x6635('0x1a')];var _0x4027c7;if(_0x2e7657>=_0x422a10){_0x2e7657=_0x422a10;_0x4027c7=0xc8;}else{_0x4027c7=0xce;}_0x37544d[_0x6635('0x16')](_0x4027c7);return _0x37544d[_0x6635('0x1c')](_0x6635('0x1d'),_0x5ab1d8+'-'+_0x2e7657+'/'+_0x422a10)['json'](_0xbff8d7);}return null;};}function patchUpdates(_0x41f1cf){return function(_0x4f2718){try{jsonpatch[_0x6635('0x1e')](_0x4f2718,_0x41f1cf,!![]);}catch(_0x23e327){return BPromise[_0x6635('0x1f')](_0x23e327);}return _0x4f2718[_0x6635('0x20')]();};}function saveUpdates(_0x4f4969,_0x1de07b){return function(_0x115fba){if(_0x115fba){return _0x115fba[_0x6635('0x21')](_0x4f4969)[_0x6635('0x22')](function(_0x10bdc8){return _0x10bdc8;});}return null;};}function removeEntity(_0xfbb0af,_0xf9d9d){return function(_0x1ec402){if(_0x1ec402){return _0x1ec402['destroy']()['then'](function(){var _0x1e3411=_0x1ec402['get']({'plain':!![]});var _0x13c876='ExtractedReports';return db[_0x6635('0x23')][_0x6635('0x24')]({'where':{'type':_0x13c876,'resourceId':_0x1e3411['id']}})[_0x6635('0x22')](function(){return _0x1ec402;});})[_0x6635('0x22')](function(){_0xfbb0af[_0x6635('0x16')](0xcc)[_0x6635('0x25')]();});}};}function handleEntityNotFound(_0xffffd,_0x4a48b1){return function(_0x600fc3){if(!_0x600fc3){_0xffffd[_0x6635('0x15')](0x194);}return _0x600fc3;};}function handleError(_0x42f6bd,_0x493652){_0x493652=_0x493652||0x1f4;return function(_0x1f33b8){logger[_0x6635('0x26')](_0x1f33b8[_0x6635('0x27')]);if(_0x1f33b8['name']){delete _0x1f33b8[_0x6635('0x28')];}_0x42f6bd['status'](_0x493652)[_0x6635('0x29')](_0x1f33b8);};}exports[_0x6635('0x2a')]=function(_0x3d4ba0,_0x220156){var _0x21f937={},_0x4385a5={},_0x4436e2={'count':0x0,'rows':[]};var _0xcc0527=_[_0x6635('0x2b')](db[_0x6635('0x2c')][_0x6635('0x2d')],function(_0x42d1c1){return{'name':_0x42d1c1[_0x6635('0x2e')],'type':_0x42d1c1[_0x6635('0x2f')][_0x6635('0x30')]};});_0x4385a5[_0x6635('0x31')]=_[_0x6635('0x2b')](_0xcc0527,_0x6635('0x28'));_0x4385a5[_0x6635('0x32')]=_[_0x6635('0x33')](_0x3d4ba0['query']);_0x4385a5[_0x6635('0x34')]=_[_0x6635('0x35')](_0x4385a5[_0x6635('0x31')],_0x4385a5[_0x6635('0x32')]);_0x21f937['attributes']=_[_0x6635('0x35')](_0x4385a5[_0x6635('0x31')],qs[_0x6635('0x36')](_0x3d4ba0[_0x6635('0x32')][_0x6635('0x36')]));_0x21f937[_0x6635('0x37')]=_0x21f937['attributes']['length']?_0x21f937[_0x6635('0x37')]:_0x4385a5[_0x6635('0x31')];if(!_0x3d4ba0['query'][_0x6635('0x38')]('nolimit')){_0x21f937[_0x6635('0x1a')]=qs['limit'](_0x3d4ba0[_0x6635('0x32')]['limit']);_0x21f937[_0x6635('0x18')]=qs['offset'](_0x3d4ba0['query'][_0x6635('0x18')]);}_0x21f937[_0x6635('0x39')]=qs[_0x6635('0x3a')](_0x3d4ba0[_0x6635('0x32')]['sort']);_0x21f937[_0x6635('0x3b')]=qs[_0x6635('0x34')](_[_0x6635('0x3c')](_0x3d4ba0[_0x6635('0x32')],_0x4385a5[_0x6635('0x34')]),_0xcc0527);if(_0x3d4ba0[_0x6635('0x32')][_0x6635('0x3d')]){_0x21f937['where']=_['merge'](_0x21f937[_0x6635('0x3b')],{'$or':_[_0x6635('0x2b')](_0xcc0527,function(_0x443172){if(_0x443172[_0x6635('0x2f')]!==_0x6635('0x3e')){var _0x223c46={};_0x223c46[_0x443172[_0x6635('0x28')]]={'$like':'%'+_0x3d4ba0['query'][_0x6635('0x3d')]+'%'};return _0x223c46;}})});}_0x21f937=_['merge']({},_0x21f937,_0x3d4ba0[_0x6635('0x3f')]);var _0x17b240={'where':_0x21f937[_0x6635('0x3b')]};return db[_0x6635('0x2c')][_0x6635('0x1b')](_0x17b240)[_0x6635('0x22')](function(_0x17de3a){_0x4436e2[_0x6635('0x1b')]=_0x17de3a;if(_0x3d4ba0[_0x6635('0x32')]['includeAll']){_0x21f937[_0x6635('0x40')]=[{'all':!![]}];}return db[_0x6635('0x2c')]['findAll'](_0x21f937);})[_0x6635('0x22')](function(_0x25b3de){_0x4436e2[_0x6635('0x41')]=_0x25b3de;return _0x4436e2;})[_0x6635('0x22')](respondWithFilteredResult(_0x220156,_0x21f937))[_0x6635('0x42')](handleError(_0x220156,null));};exports[_0x6635('0x43')]=function(_0x4d8f9b,_0x5eeb1c){var _0x46a9f5={'raw':!![],'where':{'id':_0x4d8f9b[_0x6635('0x44')]['id']}},_0xb6323b={};_0xb6323b[_0x6635('0x31')]=_[_0x6635('0x33')](db[_0x6635('0x2c')][_0x6635('0x2d')]);_0xb6323b[_0x6635('0x32')]=_[_0x6635('0x33')](_0x4d8f9b['query']);_0xb6323b[_0x6635('0x34')]=_['intersection'](_0xb6323b[_0x6635('0x31')],_0xb6323b[_0x6635('0x32')]);_0x46a9f5[_0x6635('0x37')]=_['intersection'](_0xb6323b[_0x6635('0x31')],qs[_0x6635('0x36')](_0x4d8f9b[_0x6635('0x32')][_0x6635('0x36')]));_0x46a9f5['attributes']=_0x46a9f5[_0x6635('0x37')][_0x6635('0x45')]?_0x46a9f5['attributes']:_0xb6323b['model'];if(_0x4d8f9b['query'][_0x6635('0x46')]){_0x46a9f5['include']=[{'all':!![]}];}_0x46a9f5=_[_0x6635('0x47')]({},_0x46a9f5,_0x4d8f9b[_0x6635('0x3f')]);return db[_0x6635('0x2c')][_0x6635('0x48')](_0x46a9f5)[_0x6635('0x22')](handleEntityNotFound(_0x5eeb1c,null))[_0x6635('0x22')](respondWithResult(_0x5eeb1c,null))[_0x6635('0x42')](handleError(_0x5eeb1c,null));};exports[_0x6635('0x49')]=function(_0x5ac3c7,_0x3b675f){return db[_0x6635('0x2c')][_0x6635('0x49')](_0x5ac3c7[_0x6635('0x4a')],{})[_0x6635('0x22')](function(_0x136ac1){var _0x5f0fb7=_0x5ac3c7[_0x6635('0x4b')][_0x6635('0x4c')]({'plain':!![]});if(!_0x5f0fb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f0fb7[_0x6635('0x4d')]==='user'){var _0x2c80f1=_0x136ac1[_0x6635('0x4c')]({'plain':!![]});var _0x2b922f=_0x6635('0x4e');return db[_0x6635('0x4f')][_0x6635('0x48')]({'where':{'name':_0x2b922f,'userProfileId':_0x5f0fb7[_0x6635('0x50')]},'raw':!![]})[_0x6635('0x22')](function(_0x3a27e3){if(_0x3a27e3&&_0x3a27e3[_0x6635('0x51')]===0x0){return db['UserProfileResource'][_0x6635('0x49')]({'name':_0x2c80f1[_0x6635('0x28')],'resourceId':_0x2c80f1['id'],'type':_0x3a27e3[_0x6635('0x28')],'sectionId':_0x3a27e3['id']},{})[_0x6635('0x22')](function(){return _0x136ac1;});}else{return _0x136ac1;}})['catch'](function(_0x3f8538){logger['error'](_0x6635('0x52'),_0x3f8538);throw _0x3f8538;});}return _0x136ac1;})[_0x6635('0x22')](respondWithResult(_0x3b675f,0xc9))[_0x6635('0x42')](handleError(_0x3b675f,null));};exports[_0x6635('0x21')]=function(_0x5e7f92,_0x34dec7){if(_0x5e7f92[_0x6635('0x4a')]['id']){delete _0x5e7f92['body']['id'];}return db[_0x6635('0x2c')][_0x6635('0x48')]({'where':{'id':_0x5e7f92['params']['id']}})[_0x6635('0x22')](handleEntityNotFound(_0x34dec7,null))[_0x6635('0x22')](saveUpdates(_0x5e7f92[_0x6635('0x4a')],null))[_0x6635('0x22')](respondWithResult(_0x34dec7,null))['catch'](handleError(_0x34dec7,null));};exports[_0x6635('0x24')]=function(_0x4626ae,_0x12f163){return db['AnalyticExtractedReport'][_0x6635('0x48')]({'where':{'id':_0x4626ae[_0x6635('0x44')]['id']}})['then'](handleEntityNotFound(_0x12f163,null))['then'](removeEntity(_0x12f163,null))['catch'](handleError(_0x12f163,null));};exports[_0x6635('0x53')]=function(_0x2c8b13,_0x458d32,_0x56e7a6){return db[_0x6635('0x2c')][_0x6635('0x48')]({'where':{'id':_0x2c8b13[_0x6635('0x44')]['id']},'attributes':[_0x6635('0x28'),_0x6635('0x54'),'savename',_0x6635('0x55')],'raw':!![]})[_0x6635('0x22')](handleEntityNotFound(_0x458d32,null))[_0x6635('0x22')](function(_0x3c9f61){if(_0x3c9f61){if(!fs[_0x6635('0x56')](path[_0x6635('0x57')](config['root'],'server/files/reports',_0x3c9f61['savename']))){throw new db[(_0x6635('0x58'))][(_0x6635('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x2c8b13[_0x6635('0x32')][_0x6635('0x5a')]){return _0x458d32['sendStatus'](0xc8);}return _0x458d32[_0x6635('0x53')](path[_0x6635('0x57')](config[_0x6635('0x5b')],_0x6635('0x5c'),_0x3c9f61[_0x6635('0x5d')]),util[_0x6635('0x5e')](_0x6635('0x5f'),_0x3c9f61[_0x6635('0x54')]||_0x3c9f61['name'],_0x3c9f61[_0x6635('0x55')][_0x6635('0x60')]()));}})[_0x6635('0x42')](handleError(_0x458d32,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 32acbb9..142a8ac 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 _0x5a23=['../../config/environment','./analyticExtractedReport.attributes','analytics_extracted_reports','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x5a23,0x1b3));var _0x35a2=function(_0x3ffb88,_0x20036c){_0x3ffb88=_0x3ffb88-0x0;var _0x23de86=_0x5a23[_0x3ffb88];return _0x23de86;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35a2('0x0'))(_0x35a2('0x1'));var moment=require(_0x35a2('0x2'));var BPromise=require(_0x35a2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x35a2('0x4'));var config=require(_0x35a2('0x5'));var attributes=require(_0x35a2('0x6'));module['exports']=function(_0x2b820b,_0x3d132f){return _0x2b820b['define']('AnalyticExtractedReport',attributes,{'tableName':_0x35a2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe477=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d6f29,_0x2f6366){var _0x291f5a=function(_0x36b6bd){while(--_0x36b6bd){_0x2d6f29['push'](_0x2d6f29['shift']());}};_0x291f5a(++_0x2f6366);}(_0xe477,0x1f1));var _0x7e47=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0xe477[_0x440917];return _0x5e906b;};'use strict';var _=require('lodash');var util=require(_0x7e47('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7e47('0x1'));var BPromise=require(_0x7e47('0x2'));var rp=require(_0x7e47('0x3'));var fs=require('fs');var path=require(_0x7e47('0x4'));var rimraf=require(_0x7e47('0x5'));var config=require(_0x7e47('0x6'));var attributes=require(_0x7e47('0x7'));module[_0x7e47('0x8')]=function(_0x272921,_0x35dc8a){return _0x272921[_0x7e47('0x9')](_0x7e47('0xa'),attributes,{'tableName':_0x7e47('0xb'),'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 b5e8acf..6764f79 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 _0x7a52=['request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x7a52,0x1bd));var _0x27a5=function(_0x3bbf4b,_0x549d33){_0x3bbf4b=_0x3bbf4b-0x0;var _0x15d54d=_0x7a52[_0x3bbf4b];return _0x15d54d;};'use strict';var _=require(_0x27a5('0x0'));var util=require('util');var moment=require(_0x27a5('0x1'));var BPromise=require(_0x27a5('0x2'));var rs=require(_0x27a5('0x3'));var fs=require('fs');var Redis=require(_0x27a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27a5('0x5'));var logger=require(_0x27a5('0x6'))(_0x27a5('0x7'));var config=require(_0x27a5('0x8'));var jayson=require(_0x27a5('0x9'));var client=jayson[_0x27a5('0xa')][_0x27a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x568bbe,_0x26ddd,_0x2c49fe){return new BPromise(function(_0x4b6ef0,_0x47ab24){return client[_0x27a5('0xc')](_0x568bbe,_0x2c49fe)['then'](function(_0x2e1fe4){logger[_0x27a5('0xd')](_0x27a5('0xe'),_0x26ddd,'request\x20sent');logger[_0x27a5('0xf')](_0x27a5('0x10'),_0x26ddd,_0x27a5('0x11'),JSON['stringify'](_0x2e1fe4));if(_0x2e1fe4['error']){if(_0x2e1fe4[_0x27a5('0x12')]['code']===0x1f4){logger['error'](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);return _0x47ab24(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4['error'][_0x27a5('0x13')]);return _0x4b6ef0(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x26ddd,_0x27a5('0x11'));_0x4b6ef0(_0x2e1fe4[_0x27a5('0x14')][_0x27a5('0x13')]);}})[_0x27a5('0x15')](function(_0x398354){logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x398354);_0x47ab24(_0x398354);});});} \ No newline at end of file +var _0x0a6b=['http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b4c68,_0x14d416){var _0x1686e6=function(_0x56ab6c){while(--_0x56ab6c){_0x4b4c68['push'](_0x4b4c68['shift']());}};_0x1686e6(++_0x14d416);}(_0x0a6b,0x120));var _0xb0a6=function(_0x25bd2a,_0xc8fe7a){_0x25bd2a=_0x25bd2a-0x0;var _0xb6b479=_0x0a6b[_0x25bd2a];return _0xb6b479;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require(_0xb0a6('0x1'));var BPromise=require(_0xb0a6('0x2'));var rs=require(_0xb0a6('0x3'));var fs=require('fs');var Redis=require(_0xb0a6('0x4'));var db=require(_0xb0a6('0x5'))['db'];var utils=require(_0xb0a6('0x6'));var logger=require(_0xb0a6('0x7'))(_0xb0a6('0x8'));var config=require(_0xb0a6('0x9'));var jayson=require(_0xb0a6('0xa'));var client=jayson['client'][_0xb0a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x504a45,_0x23e004,_0x490cfc){return new BPromise(function(_0x597b68,_0xdaa894){return client['request'](_0x504a45,_0x490cfc)[_0xb0a6('0xc')](function(_0x423683){logger['info'](_0xb0a6('0xd'),_0x23e004,_0xb0a6('0xe'));logger['debug'](_0xb0a6('0xf'),_0x23e004,_0xb0a6('0xe'),JSON[_0xb0a6('0x10')](_0x423683));if(_0x423683[_0xb0a6('0x11')]){if(_0x423683[_0xb0a6('0x11')][_0xb0a6('0x12')]===0x1f4){logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x423683['error'][_0xb0a6('0x13')]);return _0xdaa894(_0x423683[_0xb0a6('0x11')][_0xb0a6('0x13')]);}logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x423683['error'][_0xb0a6('0x13')]);return _0x597b68(_0x423683[_0xb0a6('0x11')]['message']);}else{logger[_0xb0a6('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x23e004,'request\x20sent');_0x597b68(_0x423683[_0xb0a6('0x15')][_0xb0a6('0x13')]);}})[_0xb0a6('0x16')](function(_0x2ef938){logger[_0xb0a6('0x11')](_0xb0a6('0xd'),_0x23e004,_0x2ef938);_0xdaa894(_0x2ef938);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e66595a..a9a2307 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 _0x4d66=['get','index','isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./analyticExtractedReport.controller'];(function(_0x291f3d,_0x5f8285){var _0x12e96e=function(_0x31a51b){while(--_0x31a51b){_0x291f3d['push'](_0x291f3d['shift']());}};_0x12e96e(++_0x5f8285);}(_0x4d66,0x1f1));var _0x64d6=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x4d66[_0x476c7];return _0x47ae56;};'use strict';var multer=require('multer');var util=require(_0x64d6('0x0'));var path=require(_0x64d6('0x1'));var timeout=require(_0x64d6('0x2'));var express=require('express');var router=express[_0x64d6('0x3')]();var fs_extra=require(_0x64d6('0x4'));var auth=require(_0x64d6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64d6('0x6'));router[_0x64d6('0x7')]('/',auth['isAuthenticated'](),controller[_0x64d6('0x8')]);router[_0x64d6('0x7')]('/:id',auth[_0x64d6('0x9')](),controller[_0x64d6('0xa')]);router[_0x64d6('0x7')](_0x64d6('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x64d6('0xc')]('/',auth[_0x64d6('0x9')](),controller[_0x64d6('0xd')]);router['put'](_0x64d6('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x64d6('0xf')](_0x64d6('0xe'),auth[_0x64d6('0x9')](),controller[_0x64d6('0x10')]);module[_0x64d6('0x11')]=router; \ No newline at end of file +var _0x72af=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','show','/:id/download','download','create','put','update','delete','/:id','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72af,0x190));var _0xf72a=function(_0x5716b1,_0x25cf2a){_0x5716b1=_0x5716b1-0x0;var _0x31c026=_0x72af[_0x5716b1];return _0x31c026;};'use strict';var multer=require(_0xf72a('0x0'));var util=require(_0xf72a('0x1'));var path=require('path');var timeout=require(_0xf72a('0x2'));var express=require(_0xf72a('0x3'));var router=express[_0xf72a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf72a('0x5'));var interaction=require(_0xf72a('0x6'));var config=require(_0xf72a('0x7'));var controller=require(_0xf72a('0x8'));router['get']('/',auth[_0xf72a('0x9')](),controller[_0xf72a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf72a('0xb')]);router['get'](_0xf72a('0xc'),auth[_0xf72a('0x9')](),controller[_0xf72a('0xd')]);router['post']('/',auth[_0xf72a('0x9')](),controller[_0xf72a('0xe')]);router[_0xf72a('0xf')]('/:id',auth[_0xf72a('0x9')](),controller[_0xf72a('0x10')]);router[_0xf72a('0x11')](_0xf72a('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xf72a('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 942a6f2..4528344 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 _0xa071=['BOOLEAN','exports','TEXT','STRING'];(function(_0x4b96bd,_0x6a3d65){var _0x30ff3a=function(_0x45d287){while(--_0x45d287){_0x4b96bd['push'](_0x4b96bd['shift']());}};_0x30ff3a(++_0x6a3d65);}(_0xa071,0x1ed));var _0x1a07=function(_0x21e920,_0x296dc3){_0x21e920=_0x21e920-0x0;var _0x47f9c5=_0xa071[_0x21e920];return _0x47f9c5;};'use strict';var Sequelize=require('sequelize');module[_0x1a07('0x0')]={'field':{'type':Sequelize[_0x1a07('0x1')]},'alias':{'type':Sequelize[_0x1a07('0x2')]},'function':{'type':Sequelize[_0x1a07('0x2')]},'format':{'type':Sequelize[_0x1a07('0x2')]},'groupBy':{'type':Sequelize[_0x1a07('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x1a07('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4740=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x18f030,_0x30fd56){var _0x3ea085=function(_0x8ea6ed){while(--_0x8ea6ed){_0x18f030['push'](_0x18f030['shift']());}};_0x3ea085(++_0x30fd56);}(_0x4740,0x1ac));var _0x0474=function(_0x7075ca,_0x16577d){_0x7075ca=_0x7075ca-0x0;var _0x1f527e=_0x4740[_0x7075ca];return _0x1f527e;};'use strict';var Sequelize=require(_0x0474('0x0'));module[_0x0474('0x1')]={'field':{'type':Sequelize[_0x0474('0x2')]},'alias':{'type':Sequelize[_0x0474('0x3')]},'function':{'type':Sequelize[_0x0474('0x3')]},'format':{'type':Sequelize[_0x0474('0x3')]},'groupBy':{'type':Sequelize[_0x0474('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0474('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 56b2727..bbe7c05 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 _0xfdd0=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','bulkCreate','params','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/license/util','end','status','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','map','AnalyticFieldReport','rawAttributes'];(function(_0x4c2cd2,_0x1d50b8){var _0x448543=function(_0x29e355){while(--_0x29e355){_0x4c2cd2['push'](_0x4c2cd2['shift']());}};_0x448543(++_0x1d50b8);}(_0xfdd0,0x7d));var _0x0fdd=function(_0x469add,_0x50ef21){_0x469add=_0x469add-0x0;var _0x2e8a26=_0xfdd0[_0x469add];return _0x2e8a26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fdd('0x0'));var zipdir=require(_0x0fdd('0x1'));var jsonpatch=require(_0x0fdd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0fdd('0x3'));var Mustache=require(_0x0fdd('0x4'));var util=require(_0x0fdd('0x5'));var path=require('path');var sox=require(_0x0fdd('0x6'));var csv=require(_0x0fdd('0x7'));var ejs=require(_0x0fdd('0x8'));var fs=require('fs');var fs_extra=require(_0x0fdd('0x9'));var _=require(_0x0fdd('0xa'));var squel=require(_0x0fdd('0xb'));var crypto=require(_0x0fdd('0xc'));var jsforce=require(_0x0fdd('0xd'));var deskjs=require(_0x0fdd('0xe'));var toCsv=require(_0x0fdd('0x7'));var querystring=require(_0x0fdd('0xf'));var Papa=require(_0x0fdd('0x10'));var Redis=require(_0x0fdd('0x11'));var authService=require(_0x0fdd('0x12'));var qs=require(_0x0fdd('0x13'));var as=require(_0x0fdd('0x14'));var hardwareService=require(_0x0fdd('0x15'));var logger=require(_0x0fdd('0x16'))(_0x0fdd('0x17'));var utils=require(_0x0fdd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0fdd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x535aec,_0x698aa6){_0x698aa6=_0x698aa6||0xcc;return function(_0x21888f){if(_0x21888f){return _0x535aec['sendStatus'](_0x698aa6);}return _0x535aec['status'](_0x698aa6)[_0x0fdd('0x1a')]();};}function respondWithResult(_0xa57ddd,_0x1dc234){_0x1dc234=_0x1dc234||0xc8;return function(_0x57aa19){if(_0x57aa19){return _0xa57ddd[_0x0fdd('0x1b')](_0x1dc234)['json'](_0x57aa19);}};}function respondWithFilteredResult(_0x5902d8,_0x11de67){return function(_0x5e4813){if(_0x5e4813){var _0x4bd8df=typeof _0x11de67['offset']===_0x0fdd('0x1c')&&typeof _0x11de67[_0x0fdd('0x1d')]==='undefined';var _0x37740c=_0x5e4813[_0x0fdd('0x1e')];var _0x4a1ae3=_0x4bd8df?0x0:_0x11de67['offset'];var _0x2a4e17=_0x4bd8df?_0x5e4813[_0x0fdd('0x1e')]:_0x11de67['offset']+_0x11de67['limit'];var _0x230408;if(_0x2a4e17>=_0x37740c){_0x2a4e17=_0x37740c;_0x230408=0xc8;}else{_0x230408=0xce;}_0x5902d8[_0x0fdd('0x1b')](_0x230408);return _0x5902d8[_0x0fdd('0x1f')](_0x0fdd('0x20'),_0x4a1ae3+'-'+_0x2a4e17+'/'+_0x37740c)[_0x0fdd('0x21')](_0x5e4813);}return null;};}function patchUpdates(_0x3d6baf){return function(_0x378022){try{jsonpatch[_0x0fdd('0x22')](_0x378022,_0x3d6baf,!![]);}catch(_0x44a8d0){return BPromise[_0x0fdd('0x23')](_0x44a8d0);}return _0x378022['save']();};}function saveUpdates(_0x5df2fb,_0x1d32de){return function(_0x5b4632){if(_0x5b4632){return _0x5b4632[_0x0fdd('0x24')](_0x5df2fb)[_0x0fdd('0x25')](function(_0x59b3b3){return _0x59b3b3;});}return null;};}function removeEntity(_0x3e4bdb,_0x235621){return function(_0x2a3734){if(_0x2a3734){return _0x2a3734[_0x0fdd('0x26')]()['then'](function(){_0x3e4bdb['status'](0xcc)[_0x0fdd('0x1a')]();});}};}function handleEntityNotFound(_0x582545,_0x3599bd){return function(_0x2c3821){if(!_0x2c3821){_0x582545['sendStatus'](0x194);}return _0x2c3821;};}function handleError(_0x2e84c5,_0x2f7b5c){_0x2f7b5c=_0x2f7b5c||0x1f4;return function(_0x13c2d9){logger[_0x0fdd('0x27')](_0x13c2d9[_0x0fdd('0x28')]);if(_0x13c2d9[_0x0fdd('0x29')]){delete _0x13c2d9['name'];}_0x2e84c5[_0x0fdd('0x1b')](_0x2f7b5c)['send'](_0x13c2d9);};}exports['index']=function(_0x366489,_0x25c909){var _0x980c1b={},_0x3d45f7={},_0x151e92={'count':0x0,'rows':[]};var _0x25be3e=_[_0x0fdd('0x2a')](db[_0x0fdd('0x2b')][_0x0fdd('0x2c')],function(_0x15d24d){return{'name':_0x15d24d[_0x0fdd('0x2d')],'type':_0x15d24d[_0x0fdd('0x2e')][_0x0fdd('0x2f')]};});_0x3d45f7[_0x0fdd('0x30')]=_[_0x0fdd('0x2a')](_0x25be3e,'name');_0x3d45f7['query']=_['keys'](_0x366489[_0x0fdd('0x31')]);_0x3d45f7['filters']=_[_0x0fdd('0x32')](_0x3d45f7['model'],_0x3d45f7[_0x0fdd('0x31')]);_0x980c1b[_0x0fdd('0x33')]=_[_0x0fdd('0x32')](_0x3d45f7[_0x0fdd('0x30')],qs[_0x0fdd('0x34')](_0x366489[_0x0fdd('0x31')]['fields']));_0x980c1b[_0x0fdd('0x33')]=_0x980c1b['attributes'][_0x0fdd('0x35')]?_0x980c1b[_0x0fdd('0x33')]:_0x3d45f7[_0x0fdd('0x30')];if(!_0x366489[_0x0fdd('0x31')][_0x0fdd('0x36')](_0x0fdd('0x37'))){_0x980c1b[_0x0fdd('0x1d')]=qs[_0x0fdd('0x1d')](_0x366489['query'][_0x0fdd('0x1d')]);_0x980c1b['offset']=qs['offset'](_0x366489[_0x0fdd('0x31')][_0x0fdd('0x38')]);}_0x980c1b[_0x0fdd('0x39')]=qs['sort'](_0x366489[_0x0fdd('0x31')][_0x0fdd('0x3a')]);_0x980c1b[_0x0fdd('0x3b')]=qs[_0x0fdd('0x3c')](_[_0x0fdd('0x3d')](_0x366489[_0x0fdd('0x31')],_0x3d45f7['filters']),_0x25be3e);if(_0x366489[_0x0fdd('0x31')][_0x0fdd('0x3e')]){_0x980c1b[_0x0fdd('0x3b')]=_[_0x0fdd('0x3f')](_0x980c1b['where'],{'$or':_[_0x0fdd('0x2a')](_0x25be3e,function(_0x3f0508){if(_0x3f0508[_0x0fdd('0x2e')]!==_0x0fdd('0x40')){var _0x321473={};_0x321473[_0x3f0508['name']]={'$like':'%'+_0x366489[_0x0fdd('0x31')]['filter']+'%'};return _0x321473;}})});}_0x980c1b=_[_0x0fdd('0x3f')]({},_0x980c1b,_0x366489[_0x0fdd('0x41')]);var _0x1ab1cb={'where':_0x980c1b['where']};return db['AnalyticFieldReport'][_0x0fdd('0x1e')](_0x1ab1cb)[_0x0fdd('0x25')](function(_0x595dbb){_0x151e92[_0x0fdd('0x1e')]=_0x595dbb;if(_0x366489[_0x0fdd('0x31')][_0x0fdd('0x42')]){_0x980c1b[_0x0fdd('0x43')]=[{'all':!![]}];}return db[_0x0fdd('0x2b')][_0x0fdd('0x44')](_0x980c1b);})[_0x0fdd('0x25')](function(_0x2accf5){_0x151e92[_0x0fdd('0x45')]=_0x2accf5;return _0x151e92;})[_0x0fdd('0x25')](respondWithFilteredResult(_0x25c909,_0x980c1b))[_0x0fdd('0x46')](handleError(_0x25c909,null));};exports[_0x0fdd('0x47')]=function(_0x5c8e25,_0xea8a74){var _0x3aeb96={'raw':![],'where':{'id':_0x5c8e25['params']['id']}},_0x1937df={};_0x1937df[_0x0fdd('0x30')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x1937df[_0x0fdd('0x31')]=_[_0x0fdd('0x48')](_0x5c8e25['query']);_0x1937df[_0x0fdd('0x3c')]=_[_0x0fdd('0x32')](_0x1937df[_0x0fdd('0x30')],_0x1937df[_0x0fdd('0x31')]);_0x3aeb96['attributes']=_[_0x0fdd('0x32')](_0x1937df[_0x0fdd('0x30')],qs[_0x0fdd('0x34')](_0x5c8e25[_0x0fdd('0x31')]['fields']));_0x3aeb96['attributes']=_0x3aeb96['attributes'][_0x0fdd('0x35')]?_0x3aeb96['attributes']:_0x1937df[_0x0fdd('0x30')];if(_0x5c8e25[_0x0fdd('0x31')][_0x0fdd('0x42')]){_0x3aeb96['include']=[{'all':!![]}];}_0x3aeb96=_[_0x0fdd('0x3f')]({},_0x3aeb96,_0x5c8e25[_0x0fdd('0x41')]);return db[_0x0fdd('0x2b')][_0x0fdd('0x49')](_0x3aeb96)[_0x0fdd('0x25')](handleEntityNotFound(_0xea8a74,null))[_0x0fdd('0x25')](respondWithResult(_0xea8a74,null))[_0x0fdd('0x46')](handleError(_0xea8a74,null));};exports[_0x0fdd('0x4a')]=function(_0x26391b,_0x201bb7){return db[_0x0fdd('0x2b')][_0x0fdd('0x4a')](_0x26391b[_0x0fdd('0x4b')],{})[_0x0fdd('0x25')](respondWithResult(_0x201bb7,0xc9))[_0x0fdd('0x46')](handleError(_0x201bb7,null));};exports[_0x0fdd('0x4c')]=function(_0x3e3230,_0xfe3c8a){return db[_0x0fdd('0x2b')][_0x0fdd('0x4c')](_0x3e3230[_0x0fdd('0x4b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xfe3c8a,0xc9))[_0x0fdd('0x46')](handleError(_0xfe3c8a,null));};exports[_0x0fdd('0x24')]=function(_0x26706f,_0x401a6b){if(_0x26706f[_0x0fdd('0x4b')]['id']){delete _0x26706f['body']['id'];}return db['AnalyticFieldReport'][_0x0fdd('0x49')]({'where':{'id':_0x26706f[_0x0fdd('0x4d')]['id']}})[_0x0fdd('0x25')](handleEntityNotFound(_0x401a6b,null))[_0x0fdd('0x25')](saveUpdates(_0x26706f[_0x0fdd('0x4b')],null))[_0x0fdd('0x25')](respondWithResult(_0x401a6b,null))[_0x0fdd('0x46')](handleError(_0x401a6b,null));};exports[_0x0fdd('0x26')]=function(_0x3eefc1,_0x30eddb){return db['AnalyticFieldReport'][_0x0fdd('0x49')]({'where':{'id':_0x3eefc1[_0x0fdd('0x4d')]['id']}})[_0x0fdd('0x25')](handleEntityNotFound(_0x30eddb,null))[_0x0fdd('0x25')](removeEntity(_0x30eddb,null))[_0x0fdd('0x46')](handleError(_0x30eddb,null));};exports[_0x0fdd('0x4e')]=function(_0x1eb93b,_0x4527f1){return db[_0x0fdd('0x2b')][_0x0fdd('0x26')]({'where':{'id':_0x1eb93b['query'][_0x0fdd('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x0fdd('0x25')](respondWithResult(_0x4527f1,0xcc))['catch'](handleError(_0x4527f1,null));};exports['addFields']=function(_0x1b2156,_0x52dda7,_0x292e84){return db[_0x0fdd('0x50')][_0x0fdd('0x51')]({'where':{'id':_0x1b2156[_0x0fdd('0x4d')]['id']}})[_0x0fdd('0x25')](handleEntityNotFound(_0x52dda7,null))['then'](function(_0x1ce7bf){if(_0x1ce7bf){return db[_0x0fdd('0x52')][_0x0fdd('0x53')](function(_0x5ebe56){return db['AnalyticFieldReport'][_0x0fdd('0x26')]({'where':{'CustomReportId':_0x1b2156[_0x0fdd('0x4d')]['id']},'transaction':_0x5ebe56})[_0x0fdd('0x25')](function(_0x13ee77){var _0x48f6ae=_[_0x0fdd('0x2a')](_0x1b2156[_0x0fdd('0x4b')],function(_0x53f88f){delete _0x53f88f['id'];_0x53f88f[_0x0fdd('0x54')]=_0x1b2156[_0x0fdd('0x4d')]['id'];return _0x53f88f;});return db[_0x0fdd('0x2b')][_0x0fdd('0x4c')](_0x48f6ae,{'transaction':_0x5ebe56});});})[_0x0fdd('0x25')](function(){return db['AnalyticFieldReport'][_0x0fdd('0x44')]({'where':{'CustomReportId':_0x1b2156[_0x0fdd('0x4d')]['id']}});});}})[_0x0fdd('0x25')](respondWithResult(_0x52dda7,null))[_0x0fdd('0x46')](handleError(_0x52dda7,null));}; \ No newline at end of file +var _0x4a85=['findOne','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','rows','show','params','rawAttributes','keys','include','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport'];(function(_0x4dc48e,_0x3d2d69){var _0x4858b5=function(_0xb20765){while(--_0xb20765){_0x4dc48e['push'](_0x4dc48e['shift']());}};_0x4858b5(++_0x3d2d69);}(_0x4a85,0x101));var _0x54a8=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4a85[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x54a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x54a8('0x1'));var jsonpatch=require(_0x54a8('0x2'));var rp=require('request-promise');var moment=require(_0x54a8('0x3'));var BPromise=require(_0x54a8('0x4'));var Mustache=require('mustache');var util=require(_0x54a8('0x5'));var path=require(_0x54a8('0x6'));var sox=require(_0x54a8('0x7'));var csv=require(_0x54a8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54a8('0x9'));var _=require(_0x54a8('0xa'));var squel=require(_0x54a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x54a8('0xc'));var deskjs=require(_0x54a8('0xd'));var toCsv=require(_0x54a8('0x8'));var querystring=require(_0x54a8('0xe'));var Papa=require(_0x54a8('0xf'));var Redis=require(_0x54a8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x54a8('0x11'));var as=require(_0x54a8('0x12'));var hardwareService=require(_0x54a8('0x13'));var logger=require(_0x54a8('0x14'))(_0x54a8('0x15'));var utils=require('../../config/utils');var config=require(_0x54a8('0x16'));var licenseUtil=require(_0x54a8('0x17'));var db=require(_0x54a8('0x18'))['db'];function respondWithStatusCode(_0x2a6f39,_0x4819f1){_0x4819f1=_0x4819f1||0xcc;return function(_0x3ed53c){if(_0x3ed53c){return _0x2a6f39[_0x54a8('0x19')](_0x4819f1);}return _0x2a6f39[_0x54a8('0x1a')](_0x4819f1)[_0x54a8('0x1b')]();};}function respondWithResult(_0x10c684,_0x889ad4){_0x889ad4=_0x889ad4||0xc8;return function(_0x5a77aa){if(_0x5a77aa){return _0x10c684[_0x54a8('0x1a')](_0x889ad4)[_0x54a8('0x1c')](_0x5a77aa);}};}function respondWithFilteredResult(_0x23feb7,_0x46c80d){return function(_0x5b1e6a){if(_0x5b1e6a){var _0x17e49b=typeof _0x46c80d[_0x54a8('0x1d')]==='undefined'&&typeof _0x46c80d[_0x54a8('0x1e')]===_0x54a8('0x1f');var _0x51399e=_0x5b1e6a[_0x54a8('0x20')];var _0x2a0b43=_0x17e49b?0x0:_0x46c80d[_0x54a8('0x1d')];var _0x747660=_0x17e49b?_0x5b1e6a[_0x54a8('0x20')]:_0x46c80d['offset']+_0x46c80d[_0x54a8('0x1e')];var _0x562965;if(_0x747660>=_0x51399e){_0x747660=_0x51399e;_0x562965=0xc8;}else{_0x562965=0xce;}_0x23feb7[_0x54a8('0x1a')](_0x562965);return _0x23feb7[_0x54a8('0x21')](_0x54a8('0x22'),_0x2a0b43+'-'+_0x747660+'/'+_0x51399e)['json'](_0x5b1e6a);}return null;};}function patchUpdates(_0xff1e8d){return function(_0x56cd3f){try{jsonpatch['apply'](_0x56cd3f,_0xff1e8d,!![]);}catch(_0x446d30){return BPromise[_0x54a8('0x23')](_0x446d30);}return _0x56cd3f[_0x54a8('0x24')]();};}function saveUpdates(_0x40f5a8,_0x3012b0){return function(_0x4d5f12){if(_0x4d5f12){return _0x4d5f12[_0x54a8('0x25')](_0x40f5a8)[_0x54a8('0x26')](function(_0x25351f){return _0x25351f;});}return null;};}function removeEntity(_0x53f839,_0x1c959e){return function(_0x1253b5){if(_0x1253b5){return _0x1253b5[_0x54a8('0x27')]()[_0x54a8('0x26')](function(){_0x53f839['status'](0xcc)[_0x54a8('0x1b')]();});}};}function handleEntityNotFound(_0x258341,_0x1a22d4){return function(_0x3e1a99){if(!_0x3e1a99){_0x258341['sendStatus'](0x194);}return _0x3e1a99;};}function handleError(_0x26b33a,_0x342265){_0x342265=_0x342265||0x1f4;return function(_0x41c69a){logger[_0x54a8('0x28')](_0x41c69a[_0x54a8('0x29')]);if(_0x41c69a[_0x54a8('0x2a')]){delete _0x41c69a['name'];}_0x26b33a['status'](_0x342265)[_0x54a8('0x2b')](_0x41c69a);};}exports['index']=function(_0xa5d26,_0x247e86){var _0x1edf70={},_0x3a3b9a={},_0x154ed5={'count':0x0,'rows':[]};var _0x323b27=_[_0x54a8('0x2c')](db[_0x54a8('0x2d')]['rawAttributes'],function(_0x315bd8){return{'name':_0x315bd8[_0x54a8('0x2e')],'type':_0x315bd8['type'][_0x54a8('0x2f')]};});_0x3a3b9a[_0x54a8('0x30')]=_[_0x54a8('0x2c')](_0x323b27,_0x54a8('0x2a'));_0x3a3b9a[_0x54a8('0x31')]=_['keys'](_0xa5d26[_0x54a8('0x31')]);_0x3a3b9a[_0x54a8('0x32')]=_['intersection'](_0x3a3b9a[_0x54a8('0x30')],_0x3a3b9a['query']);_0x1edf70[_0x54a8('0x33')]=_[_0x54a8('0x34')](_0x3a3b9a[_0x54a8('0x30')],qs[_0x54a8('0x35')](_0xa5d26[_0x54a8('0x31')][_0x54a8('0x35')]));_0x1edf70[_0x54a8('0x33')]=_0x1edf70[_0x54a8('0x33')][_0x54a8('0x36')]?_0x1edf70[_0x54a8('0x33')]:_0x3a3b9a[_0x54a8('0x30')];if(!_0xa5d26['query'][_0x54a8('0x37')](_0x54a8('0x38'))){_0x1edf70[_0x54a8('0x1e')]=qs['limit'](_0xa5d26[_0x54a8('0x31')][_0x54a8('0x1e')]);_0x1edf70[_0x54a8('0x1d')]=qs['offset'](_0xa5d26[_0x54a8('0x31')][_0x54a8('0x1d')]);}_0x1edf70['order']=qs[_0x54a8('0x39')](_0xa5d26['query'][_0x54a8('0x39')]);_0x1edf70[_0x54a8('0x3a')]=qs[_0x54a8('0x32')](_[_0x54a8('0x3b')](_0xa5d26['query'],_0x3a3b9a['filters']),_0x323b27);if(_0xa5d26[_0x54a8('0x31')]['filter']){_0x1edf70[_0x54a8('0x3a')]=_[_0x54a8('0x3c')](_0x1edf70[_0x54a8('0x3a')],{'$or':_[_0x54a8('0x2c')](_0x323b27,function(_0x53d0f1){if(_0x53d0f1['type']!==_0x54a8('0x3d')){var _0x4000f2={};_0x4000f2[_0x53d0f1['name']]={'$like':'%'+_0xa5d26[_0x54a8('0x31')][_0x54a8('0x3e')]+'%'};return _0x4000f2;}})});}_0x1edf70=_['merge']({},_0x1edf70,_0xa5d26[_0x54a8('0x3f')]);var _0x1ea466={'where':_0x1edf70[_0x54a8('0x3a')]};return db['AnalyticFieldReport'][_0x54a8('0x20')](_0x1ea466)['then'](function(_0x268744){_0x154ed5[_0x54a8('0x20')]=_0x268744;if(_0xa5d26[_0x54a8('0x31')]['includeAll']){_0x1edf70['include']=[{'all':!![]}];}return db[_0x54a8('0x2d')]['findAll'](_0x1edf70);})[_0x54a8('0x26')](function(_0x17a6d6){_0x154ed5[_0x54a8('0x40')]=_0x17a6d6;return _0x154ed5;})[_0x54a8('0x26')](respondWithFilteredResult(_0x247e86,_0x1edf70))['catch'](handleError(_0x247e86,null));};exports[_0x54a8('0x41')]=function(_0x5b3fe3,_0x491a35){var _0x599c9f={'raw':![],'where':{'id':_0x5b3fe3[_0x54a8('0x42')]['id']}},_0x1a1727={};_0x1a1727[_0x54a8('0x30')]=_['keys'](db[_0x54a8('0x2d')][_0x54a8('0x43')]);_0x1a1727[_0x54a8('0x31')]=_[_0x54a8('0x44')](_0x5b3fe3[_0x54a8('0x31')]);_0x1a1727[_0x54a8('0x32')]=_[_0x54a8('0x34')](_0x1a1727['model'],_0x1a1727[_0x54a8('0x31')]);_0x599c9f[_0x54a8('0x33')]=_[_0x54a8('0x34')](_0x1a1727[_0x54a8('0x30')],qs[_0x54a8('0x35')](_0x5b3fe3[_0x54a8('0x31')][_0x54a8('0x35')]));_0x599c9f[_0x54a8('0x33')]=_0x599c9f[_0x54a8('0x33')][_0x54a8('0x36')]?_0x599c9f[_0x54a8('0x33')]:_0x1a1727[_0x54a8('0x30')];if(_0x5b3fe3[_0x54a8('0x31')]['includeAll']){_0x599c9f[_0x54a8('0x45')]=[{'all':!![]}];}_0x599c9f=_[_0x54a8('0x3c')]({},_0x599c9f,_0x5b3fe3[_0x54a8('0x3f')]);return db[_0x54a8('0x2d')][_0x54a8('0x46')](_0x599c9f)[_0x54a8('0x26')](handleEntityNotFound(_0x491a35,null))[_0x54a8('0x26')](respondWithResult(_0x491a35,null))[_0x54a8('0x47')](handleError(_0x491a35,null));};exports[_0x54a8('0x48')]=function(_0x564363,_0x556fd6){return db[_0x54a8('0x2d')]['create'](_0x564363[_0x54a8('0x49')],{})[_0x54a8('0x26')](respondWithResult(_0x556fd6,0xc9))[_0x54a8('0x47')](handleError(_0x556fd6,null));};exports[_0x54a8('0x4a')]=function(_0x750bce,_0x28c50b){return db[_0x54a8('0x2d')][_0x54a8('0x4a')](_0x750bce[_0x54a8('0x49')],{'raw':![],'individualHooks':!![]})[_0x54a8('0x26')](respondWithResult(_0x28c50b,0xc9))[_0x54a8('0x47')](handleError(_0x28c50b,null));};exports['update']=function(_0x1141f0,_0x472fbc){if(_0x1141f0[_0x54a8('0x49')]['id']){delete _0x1141f0[_0x54a8('0x49')]['id'];}return db[_0x54a8('0x2d')][_0x54a8('0x46')]({'where':{'id':_0x1141f0['params']['id']}})[_0x54a8('0x26')](handleEntityNotFound(_0x472fbc,null))[_0x54a8('0x26')](saveUpdates(_0x1141f0[_0x54a8('0x49')],null))[_0x54a8('0x26')](respondWithResult(_0x472fbc,null))[_0x54a8('0x47')](handleError(_0x472fbc,null));};exports[_0x54a8('0x27')]=function(_0x5e507d,_0x28253f){return db[_0x54a8('0x2d')][_0x54a8('0x46')]({'where':{'id':_0x5e507d[_0x54a8('0x42')]['id']}})['then'](handleEntityNotFound(_0x28253f,null))[_0x54a8('0x26')](removeEntity(_0x28253f,null))[_0x54a8('0x47')](handleError(_0x28253f,null));};exports[_0x54a8('0x4b')]=function(_0x1c18d3,_0x4e0370){return db['AnalyticFieldReport'][_0x54a8('0x27')]({'where':{'id':_0x1c18d3[_0x54a8('0x31')][_0x54a8('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x54a8('0x26')](respondWithResult(_0x4e0370,0xcc))['catch'](handleError(_0x4e0370,null));};exports[_0x54a8('0x4d')]=function(_0x1e9c9e,_0xd82b93,_0xf00b4c){return db[_0x54a8('0x4e')][_0x54a8('0x4f')]({'where':{'id':_0x1e9c9e['params']['id']}})[_0x54a8('0x26')](handleEntityNotFound(_0xd82b93,null))['then'](function(_0x30fb3c){if(_0x30fb3c){return db[_0x54a8('0x50')][_0x54a8('0x51')](function(_0x2764fd){return db[_0x54a8('0x2d')][_0x54a8('0x27')]({'where':{'CustomReportId':_0x1e9c9e[_0x54a8('0x42')]['id']},'transaction':_0x2764fd})['then'](function(_0xc9a4d5){var _0x746abf=_['map'](_0x1e9c9e[_0x54a8('0x49')],function(_0x5227b7){delete _0x5227b7['id'];_0x5227b7[_0x54a8('0x52')]=_0x1e9c9e[_0x54a8('0x42')]['id'];return _0x5227b7;});return db['AnalyticFieldReport'][_0x54a8('0x4a')](_0x746abf,{'transaction':_0x2764fd});});})[_0x54a8('0x26')](function(){return db[_0x54a8('0x2d')][_0x54a8('0x53')]({'where':{'CustomReportId':_0x1e9c9e['params']['id']}});});}})[_0x54a8('0x26')](respondWithResult(_0xd82b93,null))['catch'](handleError(_0xd82b93,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a0faff1..c54bb5b 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 _0x1ffb=['../../config/environment','exports','define','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x22d8d9,_0x4257bb){var _0x215b78=function(_0x405509){while(--_0x405509){_0x22d8d9['push'](_0x22d8d9['shift']());}};_0x215b78(++_0x4257bb);}(_0x1ffb,0x1b1));var _0xb1ff=function(_0xe4bd12,_0x75f8a3){_0xe4bd12=_0xe4bd12-0x0;var _0x5943f2=_0x1ffb[_0xe4bd12];return _0x5943f2;};'use strict';var _=require(_0xb1ff('0x0'));var util=require(_0xb1ff('0x1'));var logger=require(_0xb1ff('0x2'))('api');var moment=require(_0xb1ff('0x3'));var BPromise=require(_0xb1ff('0x4'));var rp=require(_0xb1ff('0x5'));var fs=require('fs');var path=require(_0xb1ff('0x6'));var rimraf=require('rimraf');var config=require(_0xb1ff('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xb1ff('0x8')]=function(_0x1104e8,_0x4154f6){return _0x1104e8[_0xb1ff('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xb1ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd38b=['analytics_report_fields','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x43ba8d,_0x347e9f){var _0x300aaf=function(_0x5e1b2d){while(--_0x5e1b2d){_0x43ba8d['push'](_0x43ba8d['shift']());}};_0x300aaf(++_0x347e9f);}(_0xd38b,0x97));var _0xbd38=function(_0x5e8d3a,_0x2ac363){_0x5e8d3a=_0x5e8d3a-0x0;var _0x3a0dbb=_0xd38b[_0x5e8d3a];return _0x3a0dbb;};'use strict';var _=require('lodash');var util=require(_0xbd38('0x0'));var logger=require(_0xbd38('0x1'))('api');var moment=require(_0xbd38('0x2'));var BPromise=require(_0xbd38('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd38('0x4'));var config=require(_0xbd38('0x5'));var attributes=require(_0xbd38('0x6'));module[_0xbd38('0x7')]=function(_0x206601,_0x366977){return _0x206601['define'](_0xbd38('0x8'),attributes,{'tableName':_0xbd38('0x9'),'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 7c4f1db..c7ade35 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 _0xca1a=['message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x336e50,_0x29dd04){var _0x135939=function(_0x57fb42){while(--_0x57fb42){_0x336e50['push'](_0x336e50['shift']());}};_0x135939(++_0x29dd04);}(_0xca1a,0xf3));var _0xaca1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca1a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaca1('0x0'));var BPromise=require(_0xaca1('0x1'));var rs=require(_0xaca1('0x2'));var fs=require('fs');var Redis=require(_0xaca1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaca1('0x4'))('rpc');var config=require(_0xaca1('0x5'));var jayson=require(_0xaca1('0x6'));var client=jayson['client'][_0xaca1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7eaa85,_0xd19f67,_0x586f80){return new BPromise(function(_0x5b8798,_0x3be0e9){return client[_0xaca1('0x8')](_0x7eaa85,_0x586f80)[_0xaca1('0x9')](function(_0x2afaf3){logger[_0xaca1('0xa')](_0xaca1('0xb'),_0xd19f67,'request\x20sent');logger[_0xaca1('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xd19f67,_0xaca1('0xd'),JSON[_0xaca1('0xe')](_0x2afaf3));if(_0x2afaf3['error']){if(_0x2afaf3[_0xaca1('0xf')][_0xaca1('0x10')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xd19f67,_0x2afaf3[_0xaca1('0xf')]['message']);return _0x3be0e9(_0x2afaf3[_0xaca1('0xf')]['message']);}logger[_0xaca1('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0xd19f67,_0x2afaf3[_0xaca1('0xf')][_0xaca1('0x11')]);return _0x5b8798(_0x2afaf3['error'][_0xaca1('0x11')]);}else{logger['info'](_0xaca1('0xb'),_0xd19f67,_0xaca1('0xd'));_0x5b8798(_0x2afaf3[_0xaca1('0x12')][_0xaca1('0x11')]);}})[_0xaca1('0x13')](function(_0x57040e){logger[_0xaca1('0xf')](_0xaca1('0xb'),_0xd19f67,_0x57040e);_0x3be0e9(_0x57040e);});});} \ No newline at end of file +var _0xd335=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd335,0x6a));var _0x5d33=function(_0x2652f5,_0x3130ec){_0x2652f5=_0x2652f5-0x0;var _0xd81bb5=_0xd335[_0x2652f5];return _0xd81bb5;};'use strict';var _=require(_0x5d33('0x0'));var util=require('util');var moment=require(_0x5d33('0x1'));var BPromise=require(_0x5d33('0x2'));var rs=require(_0x5d33('0x3'));var fs=require('fs');var Redis=require(_0x5d33('0x4'));var db=require(_0x5d33('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d33('0x6'))(_0x5d33('0x7'));var config=require(_0x5d33('0x8'));var jayson=require(_0x5d33('0x9'));var client=jayson['client'][_0x5d33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8c86,_0x5d06b4,_0x3c82df){return new BPromise(function(_0x2d45e9,_0x1befb5){return client[_0x5d33('0xb')](_0x1c8c86,_0x3c82df)[_0x5d33('0xc')](function(_0x1645e2){logger[_0x5d33('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5d06b4,_0x5d33('0xe'));logger[_0x5d33('0xf')](_0x5d33('0x10'),_0x5d06b4,_0x5d33('0xe'),JSON['stringify'](_0x1645e2));if(_0x1645e2[_0x5d33('0x11')]){if(_0x1645e2[_0x5d33('0x11')][_0x5d33('0x12')]===0x1f4){logger[_0x5d33('0x11')](_0x5d33('0x13'),_0x5d06b4,_0x1645e2['error'][_0x5d33('0x14')]);return _0x1befb5(_0x1645e2['error']['message']);}logger[_0x5d33('0x11')](_0x5d33('0x13'),_0x5d06b4,_0x1645e2[_0x5d33('0x11')][_0x5d33('0x14')]);return _0x2d45e9(_0x1645e2[_0x5d33('0x11')][_0x5d33('0x14')]);}else{logger[_0x5d33('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5d06b4,_0x5d33('0xe'));_0x2d45e9(_0x1645e2['result'][_0x5d33('0x14')]);}})[_0x5d33('0x15')](function(_0x509fa9){logger[_0x5d33('0x11')](_0x5d33('0x13'),_0x5d06b4,_0x509fa9);_0x1befb5(_0x509fa9);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 651fa96..dfac656 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(_0x95faf1,_0x5171a7){var _0x3ac0fb=function(_0x3d61c2){while(--_0x3d61c2){_0x95faf1['push'](_0x95faf1['shift']());}};_0x3ac0fb(++_0x5171a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x11e07d,_0x3eb473){var _0x389290=function(_0x2ecc29){while(--_0x2ecc29){_0x11e07d['push'](_0x11e07d['shift']());}};_0x389290(++_0x3eb473);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 5dc8dd2..777d607 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 _0xce3a=['exports','STRING','name','TEXT','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xce3a,0x194));var _0xace3=function(_0x58b665,_0x5bdd88){_0x58b665=_0x58b665-0x0;var _0x560ae5=_0xce3a[_0x58b665];return _0x560ae5;};'use strict';var Sequelize=require(_0xace3('0x0'));module[_0xace3('0x1')]={'name':{'type':Sequelize[_0xace3('0x2')],'allowNull':![],'unique':_0xace3('0x3')},'table':{'type':Sequelize[_0xace3('0x2')]},'metric':{'type':Sequelize[_0xace3('0x4')]},'description':{'type':Sequelize[_0xace3('0x2')]}}; \ No newline at end of file +var _0x4c4d=['sequelize','TEXT'];(function(_0x573fcc,_0x37239f){var _0x322e29=function(_0xb30f49){while(--_0xb30f49){_0x573fcc['push'](_0x573fcc['shift']());}};_0x322e29(++_0x37239f);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x14acbd,_0x3b2502){_0x14acbd=_0x14acbd-0x0;var _0x4f51c8=_0x4c4d[_0x14acbd];return _0x4f51c8;};'use strict';var Sequelize=require(_0xd4c4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd4c4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c76d34c..eab5db6 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 _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x4bf457,_0x14dcf4){var _0x232be2=function(_0x12daf7){while(--_0x12daf7){_0x4bf457['push'](_0x4bf457['shift']());}};_0x232be2(++_0x14dcf4);}(_0x81bd,0x7c));var _0xd81b=function(_0x3746ff,_0x5dfa8f){_0x3746ff=_0x3746ff-0x0;var _0x353055=_0x81bd[_0x3746ff];return _0x353055;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3afe16,_0x4e20cf){_0x3afe16=_0x3afe16-0x0;var _0xe117c9=_0x1cb9[_0x3afe16];return _0xe117c9;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index dc07ea1..62647de 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 _0x8c46=['api','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8c46,0x171));var _0x68c4=function(_0x2e6724,_0xee938a){_0x2e6724=_0x2e6724-0x0;var _0x3eb41b=_0x8c46[_0x2e6724];return _0x3eb41b;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac0a=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','../../config/logger','api'];(function(_0x491fe8,_0xfdb264){var _0xc6f9e6=function(_0x4867e5){while(--_0x4867e5){_0x491fe8['push'](_0x491fe8['shift']());}};_0xc6f9e6(++_0xfdb264);}(_0xac0a,0x11e));var _0xaac0=function(_0xe0e3d0,_0x3eabd9){_0xe0e3d0=_0xe0e3d0-0x0;var _0x4a7f63=_0xac0a[_0xe0e3d0];return _0x4a7f63;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaac0('0x0'))(_0xaac0('0x1'));var moment=require('moment');var BPromise=require(_0xaac0('0x2'));var rp=require(_0xaac0('0x3'));var fs=require('fs');var path=require(_0xaac0('0x4'));var rimraf=require(_0xaac0('0x5'));var config=require(_0xaac0('0x6'));var attributes=require(_0xaac0('0x7'));module[_0xaac0('0x8')]=function(_0x1c92d1,_0x2cefc3){return _0x1c92d1[_0xaac0('0x9')](_0xaac0('0xa'),attributes,{'tableName':_0xaac0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 46c879f..0fa6264 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 _0xf082=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x138946,_0x46b9db){var _0x4e009b=function(_0x24601b){while(--_0x24601b){_0x138946['push'](_0x138946['shift']());}};_0x4e009b(++_0x46b9db);}(_0xf082,0x15d));var _0x2f08=function(_0x591c9a,_0x3f14bd){_0x591c9a=_0x591c9a-0x0;var _0x443759=_0xf082[_0x591c9a];return _0x443759;};'use strict';var _=require('lodash');var util=require(_0x2f08('0x0'));var moment=require(_0x2f08('0x1'));var BPromise=require(_0x2f08('0x2'));var rs=require(_0x2f08('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f08('0x4'))['db'];var utils=require(_0x2f08('0x5'));var logger=require(_0x2f08('0x6'))('rpc');var config=require(_0x2f08('0x7'));var jayson=require(_0x2f08('0x8'));var client=jayson[_0x2f08('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x520584,_0x5f000a,_0x2a3789){return new BPromise(function(_0x5c2b72,_0x445070){return client[_0x2f08('0xa')](_0x520584,_0x2a3789)[_0x2f08('0xb')](function(_0x120fae){logger[_0x2f08('0xc')](_0x2f08('0xd'),_0x5f000a,_0x2f08('0xe'));logger[_0x2f08('0xf')](_0x2f08('0x10'),_0x5f000a,'request\x20sent',JSON[_0x2f08('0x11')](_0x120fae));if(_0x120fae['error']){if(_0x120fae[_0x2f08('0x12')][_0x2f08('0x13')]===0x1f4){logger[_0x2f08('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x5f000a,_0x120fae[_0x2f08('0x12')][_0x2f08('0x14')]);return _0x445070(_0x120fae[_0x2f08('0x12')][_0x2f08('0x14')]);}logger[_0x2f08('0x12')](_0x2f08('0xd'),_0x5f000a,_0x120fae[_0x2f08('0x12')]['message']);return _0x5c2b72(_0x120fae['error']['message']);}else{logger[_0x2f08('0xc')](_0x2f08('0xd'),_0x5f000a,_0x2f08('0xe'));_0x5c2b72(_0x120fae[_0x2f08('0x15')][_0x2f08('0x14')]);}})['catch'](function(_0x36c9d1){logger['error'](_0x2f08('0xd'),_0x5f000a,_0x36c9d1);_0x445070(_0x36c9d1);});});} \ No newline at end of file +var _0x6fd2=['debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x1e6179,_0x230c83){var _0xd7c30a=function(_0x141ba1){while(--_0x141ba1){_0x1e6179['push'](_0x1e6179['shift']());}};_0xd7c30a(++_0x230c83);}(_0x6fd2,0xd5));var _0x26fd=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6fd2[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x26fd('0x0'));var util=require(_0x26fd('0x1'));var moment=require(_0x26fd('0x2'));var BPromise=require('bluebird');var rs=require(_0x26fd('0x3'));var fs=require('fs');var Redis=require(_0x26fd('0x4'));var db=require(_0x26fd('0x5'))['db'];var utils=require(_0x26fd('0x6'));var logger=require(_0x26fd('0x7'))(_0x26fd('0x8'));var config=require(_0x26fd('0x9'));var jayson=require(_0x26fd('0xa'));var client=jayson[_0x26fd('0xb')][_0x26fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x349841,_0x520971,_0x5950d4){return new BPromise(function(_0x5172b1,_0xb3679a){return client['request'](_0x349841,_0x5950d4)[_0x26fd('0xd')](function(_0x512c54){logger[_0x26fd('0xe')](_0x26fd('0xf'),_0x520971,_0x26fd('0x10'));logger[_0x26fd('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x520971,_0x26fd('0x10'),JSON[_0x26fd('0x12')](_0x512c54));if(_0x512c54[_0x26fd('0x13')]){if(_0x512c54[_0x26fd('0x13')][_0x26fd('0x14')]===0x1f4){logger['error'](_0x26fd('0xf'),_0x520971,_0x512c54[_0x26fd('0x13')][_0x26fd('0x15')]);return _0xb3679a(_0x512c54[_0x26fd('0x13')]['message']);}logger[_0x26fd('0x13')](_0x26fd('0xf'),_0x520971,_0x512c54['error'][_0x26fd('0x15')]);return _0x5172b1(_0x512c54['error'][_0x26fd('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x520971,_0x26fd('0x10'));_0x5172b1(_0x512c54['result']['message']);}})[_0x26fd('0x16')](function(_0x2cface){logger[_0x26fd('0x13')](_0x26fd('0xf'),_0x520971,_0x2cface);_0xb3679a(_0x2cface);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 54903a4..546f975 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 _0xf52f=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x260865,_0x3a148a){var _0x5165c6=function(_0x338514){while(--_0x338514){_0x260865['push'](_0x260865['shift']());}};_0x5165c6(++_0x3a148a);}(_0xf52f,0x113));var _0xff52=function(_0x1a2ef3,_0x21186c){_0x1a2ef3=_0x1a2ef3-0x0;var _0x34f4a4=_0xf52f[_0x1a2ef3];return _0x34f4a4;};'use strict';var multer=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var path=require(_0xff52('0x2'));var timeout=require('connect-timeout');var express=require(_0xff52('0x3'));var router=express[_0xff52('0x4')]();var fs_extra=require(_0xff52('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xff52('0x6'));var config=require(_0xff52('0x7'));var controller=require('./analyticMetric.controller');router[_0xff52('0x8')]('/',auth[_0xff52('0x9')](),controller[_0xff52('0xa')]);router[_0xff52('0x8')](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0xc')]);router[_0xff52('0xd')]('/',auth[_0xff52('0x9')](),controller[_0xff52('0xe')]);router[_0xff52('0xf')](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0x10')]);router[_0xff52('0x11')](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0x12')]);module[_0xff52('0x13')]=router; \ No newline at end of file +var _0x96e0=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','put','delete','exports'];(function(_0x58e275,_0x3f82a6){var _0x7ee0e4=function(_0x3deaf6){while(--_0x3deaf6){_0x58e275['push'](_0x58e275['shift']());}};_0x7ee0e4(++_0x3f82a6);}(_0x96e0,0x7e));var _0x096e=function(_0x54af4e,_0x4c58a7){_0x54af4e=_0x54af4e-0x0;var _0x327970=_0x96e0[_0x54af4e];return _0x327970;};'use strict';var multer=require(_0x096e('0x0'));var util=require('util');var path=require(_0x096e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x096e('0x2')]();var fs_extra=require(_0x096e('0x3'));var auth=require(_0x096e('0x4'));var interaction=require(_0x096e('0x5'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x096e('0x6')](),controller[_0x096e('0x7')]);router[_0x096e('0x8')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller[_0x096e('0xa')]);router['post']('/',auth[_0x096e('0x6')](),controller['create']);router[_0x096e('0xb')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller['update']);router[_0x096e('0xc')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller['destroy']);module[_0x096e('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 7f49792..a7a11ce 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 _0x48dd=['TEXT'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x48dd,0x99));var _0xd48d=function(_0x13527c,_0x3aa564){_0x13527c=_0x13527c-0x0;var _0x2da7e3=_0x48dd[_0x13527c];return _0x2da7e3;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0xd48d('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0c48=['TEXT','sequelize','exports'];(function(_0x77fce6,_0x1e2fee){var _0x4b2e26=function(_0x30c79c){while(--_0x30c79c){_0x77fce6['push'](_0x77fce6['shift']());}};_0x4b2e26(++_0x1e2fee);}(_0x0c48,0xd3));var _0x80c4=function(_0x2dd161,_0x2afcfb){_0x2dd161=_0x2dd161-0x0;var _0xa027ae=_0x0c48[_0x2dd161];return _0xa027ae;};'use strict';var Sequelize=require(_0x80c4('0x0'));module[_0x80c4('0x1')]={'tree':{'type':Sequelize[_0x80c4('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 c2b7d0e..3916beb 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 _0x1898=['json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x3dbf5a,_0x4613fc){var _0x5e83a8=function(_0x523916){while(--_0x523916){_0x3dbf5a['push'](_0x3dbf5a['shift']());}};_0x5e83a8(++_0x4613fc);}(_0x1898,0xc8));var _0x8189=function(_0x41c82a,_0x2101b5){_0x41c82a=_0x41c82a-0x0;var _0x206c6f=_0x1898[_0x41c82a];return _0x206c6f;};'use strict';var emlformat=require(_0x8189('0x0'));var rimraf=require(_0x8189('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8189('0x2'));var rp=require(_0x8189('0x3'));var moment=require(_0x8189('0x4'));var BPromise=require(_0x8189('0x5'));var Mustache=require(_0x8189('0x6'));var util=require(_0x8189('0x7'));var path=require('path');var sox=require(_0x8189('0x8'));var csv=require(_0x8189('0x9'));var ejs=require(_0x8189('0xa'));var fs=require('fs');var fs_extra=require(_0x8189('0xb'));var _=require(_0x8189('0xc'));var squel=require(_0x8189('0xd'));var crypto=require(_0x8189('0xe'));var jsforce=require(_0x8189('0xf'));var deskjs=require(_0x8189('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8189('0x11'));var authService=require(_0x8189('0x12'));var qs=require(_0x8189('0x13'));var as=require(_0x8189('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8189('0x15'))(_0x8189('0x16'));var utils=require(_0x8189('0x17'));var config=require(_0x8189('0x18'));var licenseUtil=require(_0x8189('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bbef,_0x4a26d4){_0x4a26d4=_0x4a26d4||0xcc;return function(_0x125fb7){if(_0x125fb7){return _0x54bbef[_0x8189('0x1a')](_0x4a26d4);}return _0x54bbef[_0x8189('0x1b')](_0x4a26d4)['end']();};}function respondWithResult(_0x34ea70,_0x25f66c){_0x25f66c=_0x25f66c||0xc8;return function(_0x441850){if(_0x441850){return _0x34ea70['status'](_0x25f66c)[_0x8189('0x1c')](_0x441850);}};}function respondWithFilteredResult(_0x208573,_0x236b4b){return function(_0x3cdfdc){if(_0x3cdfdc){var _0x2338b1=typeof _0x236b4b['offset']===_0x8189('0x1d')&&typeof _0x236b4b[_0x8189('0x1e')]===_0x8189('0x1d');var _0x1b1a76=_0x3cdfdc[_0x8189('0x1f')];var _0x1826a4=_0x2338b1?0x0:_0x236b4b['offset'];var _0x181544=_0x2338b1?_0x3cdfdc[_0x8189('0x1f')]:_0x236b4b[_0x8189('0x20')]+_0x236b4b[_0x8189('0x1e')];var _0x147154;if(_0x181544>=_0x1b1a76){_0x181544=_0x1b1a76;_0x147154=0xc8;}else{_0x147154=0xce;}_0x208573[_0x8189('0x1b')](_0x147154);return _0x208573[_0x8189('0x21')](_0x8189('0x22'),_0x1826a4+'-'+_0x181544+'/'+_0x1b1a76)['json'](_0x3cdfdc);}return null;};}function patchUpdates(_0x518a95){return function(_0x25da3c){try{jsonpatch['apply'](_0x25da3c,_0x518a95,!![]);}catch(_0x2baa0a){return BPromise[_0x8189('0x23')](_0x2baa0a);}return _0x25da3c[_0x8189('0x24')]();};}function saveUpdates(_0x17739c,_0x14680a){return function(_0x2230ef){if(_0x2230ef){return _0x2230ef[_0x8189('0x25')](_0x17739c)[_0x8189('0x26')](function(_0x31723c){return _0x31723c;});}return null;};}function removeEntity(_0xf13e0a,_0x29d1bd){return function(_0x4f1376){if(_0x4f1376){return _0x4f1376[_0x8189('0x27')]()[_0x8189('0x26')](function(){_0xf13e0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b492,_0x1ca0f4){return function(_0x3d27e5){if(!_0x3d27e5){_0x55b492['sendStatus'](0x194);}return _0x3d27e5;};}function handleError(_0x1d4ae6,_0x366bb3){_0x366bb3=_0x366bb3||0x1f4;return function(_0x4c46cf){logger[_0x8189('0x28')](_0x4c46cf['stack']);if(_0x4c46cf['name']){delete _0x4c46cf[_0x8189('0x29')];}_0x1d4ae6['status'](_0x366bb3)[_0x8189('0x2a')](_0x4c46cf);};}exports[_0x8189('0x2b')]=function(_0x1861c3,_0x4a62e3){var _0x757e6a={},_0x59889b={},_0x193203={'count':0x0,'rows':[]};var _0x97dfa9=_[_0x8189('0x2c')](db[_0x8189('0x2d')][_0x8189('0x2e')],function(_0x5f28fb){return{'name':_0x5f28fb[_0x8189('0x2f')],'type':_0x5f28fb[_0x8189('0x30')][_0x8189('0x31')]};});_0x59889b[_0x8189('0x32')]=_['map'](_0x97dfa9,'name');_0x59889b[_0x8189('0x33')]=_[_0x8189('0x34')](_0x1861c3[_0x8189('0x33')]);_0x59889b[_0x8189('0x35')]=_[_0x8189('0x36')](_0x59889b['model'],_0x59889b['query']);_0x757e6a[_0x8189('0x37')]=_[_0x8189('0x36')](_0x59889b['model'],qs['fields'](_0x1861c3[_0x8189('0x33')][_0x8189('0x38')]));_0x757e6a[_0x8189('0x37')]=_0x757e6a['attributes'][_0x8189('0x39')]?_0x757e6a[_0x8189('0x37')]:_0x59889b['model'];if(!_0x1861c3['query']['hasOwnProperty'](_0x8189('0x3a'))){_0x757e6a[_0x8189('0x1e')]=qs[_0x8189('0x1e')](_0x1861c3[_0x8189('0x33')][_0x8189('0x1e')]);_0x757e6a[_0x8189('0x20')]=qs[_0x8189('0x20')](_0x1861c3[_0x8189('0x33')]['offset']);}_0x757e6a['order']=qs[_0x8189('0x3b')](_0x1861c3[_0x8189('0x33')][_0x8189('0x3b')]);_0x757e6a[_0x8189('0x3c')]=qs[_0x8189('0x35')](_[_0x8189('0x3d')](_0x1861c3[_0x8189('0x33')],_0x59889b[_0x8189('0x35')]),_0x97dfa9);if(_0x1861c3[_0x8189('0x33')][_0x8189('0x3e')]){_0x757e6a[_0x8189('0x3c')]=_['merge'](_0x757e6a['where'],{'$or':_[_0x8189('0x2c')](_0x97dfa9,function(_0x8fab03){if(_0x8fab03[_0x8189('0x30')]!==_0x8189('0x3f')){var _0x4cf506={};_0x4cf506[_0x8fab03[_0x8189('0x29')]]={'$like':'%'+_0x1861c3[_0x8189('0x33')][_0x8189('0x3e')]+'%'};return _0x4cf506;}})});}_0x757e6a=_[_0x8189('0x40')]({},_0x757e6a,_0x1861c3['options']);var _0x2d9f5a={'where':_0x757e6a['where']};return db[_0x8189('0x2d')][_0x8189('0x1f')](_0x2d9f5a)[_0x8189('0x26')](function(_0x26955e){_0x193203[_0x8189('0x1f')]=_0x26955e;if(_0x1861c3[_0x8189('0x33')]['includeAll']){_0x757e6a['include']=[{'all':!![]}];}return db[_0x8189('0x2d')][_0x8189('0x41')](_0x757e6a);})['then'](function(_0x357cce){_0x193203[_0x8189('0x42')]=_0x357cce;return _0x193203;})[_0x8189('0x26')](respondWithFilteredResult(_0x4a62e3,_0x757e6a))[_0x8189('0x43')](handleError(_0x4a62e3,null));};exports[_0x8189('0x44')]=function(_0xeb1492,_0x26c9f9){var _0x3cb49f={'raw':!![],'where':{'id':_0xeb1492[_0x8189('0x45')]['id']}},_0x1fe297={};_0x1fe297[_0x8189('0x32')]=_[_0x8189('0x34')](db[_0x8189('0x2d')][_0x8189('0x2e')]);_0x1fe297[_0x8189('0x33')]=_[_0x8189('0x34')](_0xeb1492[_0x8189('0x33')]);_0x1fe297[_0x8189('0x35')]=_['intersection'](_0x1fe297[_0x8189('0x32')],_0x1fe297[_0x8189('0x33')]);_0x3cb49f[_0x8189('0x37')]=_['intersection'](_0x1fe297['model'],qs[_0x8189('0x38')](_0xeb1492['query'][_0x8189('0x38')]));_0x3cb49f['attributes']=_0x3cb49f[_0x8189('0x37')][_0x8189('0x39')]?_0x3cb49f['attributes']:_0x1fe297[_0x8189('0x32')];if(_0xeb1492['query'][_0x8189('0x46')]){_0x3cb49f[_0x8189('0x47')]=[{'all':!![]}];}_0x3cb49f=_[_0x8189('0x40')]({},_0x3cb49f,_0xeb1492[_0x8189('0x48')]);return db[_0x8189('0x2d')][_0x8189('0x49')](_0x3cb49f)['then'](handleEntityNotFound(_0x26c9f9,null))[_0x8189('0x26')](respondWithResult(_0x26c9f9,null))[_0x8189('0x43')](handleError(_0x26c9f9,null));};exports[_0x8189('0x4a')]=function(_0x17f988,_0xd14e58){return db['AnalyticTreeReport']['create'](_0x17f988[_0x8189('0x4b')],{})[_0x8189('0x26')](respondWithResult(_0xd14e58,0xc9))[_0x8189('0x43')](handleError(_0xd14e58,null));};exports[_0x8189('0x25')]=function(_0x174cb2,_0x587ceb){if(_0x174cb2['body']['id']){delete _0x174cb2[_0x8189('0x4b')]['id'];}return db[_0x8189('0x2d')][_0x8189('0x49')]({'where':{'id':_0x174cb2[_0x8189('0x45')]['id']}})['then'](handleEntityNotFound(_0x587ceb,null))['then'](saveUpdates(_0x174cb2[_0x8189('0x4b')],null))['then'](respondWithResult(_0x587ceb,null))[_0x8189('0x43')](handleError(_0x587ceb,null));};exports[_0x8189('0x27')]=function(_0x388035,_0x551100){return db[_0x8189('0x2d')][_0x8189('0x49')]({'where':{'id':_0x388035[_0x8189('0x45')]['id']}})['then'](handleEntityNotFound(_0x551100,null))['then'](removeEntity(_0x551100,null))['catch'](handleError(_0x551100,null));}; \ No newline at end of file +var _0x5bd6=['merge','type','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter'];(function(_0x574945,_0x2319ab){var _0x2adfb6=function(_0x168d4b){while(--_0x168d4b){_0x574945['push'](_0x574945['shift']());}};_0x2adfb6(++_0x2319ab);}(_0x5bd6,0xa5));var _0x65bd=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x5bd6[_0x5959c9];return _0x4ffcbc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65bd('0x0'));var zipdir=require(_0x65bd('0x1'));var jsonpatch=require(_0x65bd('0x2'));var rp=require(_0x65bd('0x3'));var moment=require(_0x65bd('0x4'));var BPromise=require(_0x65bd('0x5'));var Mustache=require(_0x65bd('0x6'));var util=require('util');var path=require(_0x65bd('0x7'));var sox=require(_0x65bd('0x8'));var csv=require(_0x65bd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65bd('0xa'));var _=require(_0x65bd('0xb'));var squel=require(_0x65bd('0xc'));var crypto=require(_0x65bd('0xd'));var jsforce=require(_0x65bd('0xe'));var deskjs=require(_0x65bd('0xf'));var toCsv=require('to-csv');var querystring=require(_0x65bd('0x10'));var Papa=require(_0x65bd('0x11'));var Redis=require('ioredis');var authService=require(_0x65bd('0x12'));var qs=require(_0x65bd('0x13'));var as=require(_0x65bd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65bd('0x15'))(_0x65bd('0x16'));var utils=require('../../config/utils');var config=require(_0x65bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x65bd('0x18'))['db'];function respondWithStatusCode(_0x2e8405,_0x3c16cf){_0x3c16cf=_0x3c16cf||0xcc;return function(_0x4f6845){if(_0x4f6845){return _0x2e8405[_0x65bd('0x19')](_0x3c16cf);}return _0x2e8405['status'](_0x3c16cf)[_0x65bd('0x1a')]();};}function respondWithResult(_0x60e359,_0x1147c2){_0x1147c2=_0x1147c2||0xc8;return function(_0x405fb4){if(_0x405fb4){return _0x60e359[_0x65bd('0x1b')](_0x1147c2)[_0x65bd('0x1c')](_0x405fb4);}};}function respondWithFilteredResult(_0x15b515,_0x3fd5a3){return function(_0x10eefc){if(_0x10eefc){var _0x22d3fa=typeof _0x3fd5a3[_0x65bd('0x1d')]===_0x65bd('0x1e')&&typeof _0x3fd5a3[_0x65bd('0x1f')]==='undefined';var _0x117df0=_0x10eefc[_0x65bd('0x20')];var _0x5d5b0f=_0x22d3fa?0x0:_0x3fd5a3[_0x65bd('0x1d')];var _0xecddc2=_0x22d3fa?_0x10eefc[_0x65bd('0x20')]:_0x3fd5a3[_0x65bd('0x1d')]+_0x3fd5a3[_0x65bd('0x1f')];var _0x4fc1ec;if(_0xecddc2>=_0x117df0){_0xecddc2=_0x117df0;_0x4fc1ec=0xc8;}else{_0x4fc1ec=0xce;}_0x15b515[_0x65bd('0x1b')](_0x4fc1ec);return _0x15b515[_0x65bd('0x21')](_0x65bd('0x22'),_0x5d5b0f+'-'+_0xecddc2+'/'+_0x117df0)[_0x65bd('0x1c')](_0x10eefc);}return null;};}function patchUpdates(_0x5c1b29){return function(_0x33e3ef){try{jsonpatch['apply'](_0x33e3ef,_0x5c1b29,!![]);}catch(_0x1b2fd3){return BPromise[_0x65bd('0x23')](_0x1b2fd3);}return _0x33e3ef[_0x65bd('0x24')]();};}function saveUpdates(_0x7f87e4,_0x16db0d){return function(_0x2b8fc9){if(_0x2b8fc9){return _0x2b8fc9[_0x65bd('0x25')](_0x7f87e4)['then'](function(_0x3ed1e1){return _0x3ed1e1;});}return null;};}function removeEntity(_0x458b33,_0x2da8bb){return function(_0x4e676d){if(_0x4e676d){return _0x4e676d[_0x65bd('0x26')]()[_0x65bd('0x27')](function(){_0x458b33[_0x65bd('0x1b')](0xcc)[_0x65bd('0x1a')]();});}};}function handleEntityNotFound(_0x504005,_0x21e96c){return function(_0x4b3c71){if(!_0x4b3c71){_0x504005[_0x65bd('0x19')](0x194);}return _0x4b3c71;};}function handleError(_0x580bb1,_0x330306){_0x330306=_0x330306||0x1f4;return function(_0x2a6ac2){logger[_0x65bd('0x28')](_0x2a6ac2[_0x65bd('0x29')]);if(_0x2a6ac2[_0x65bd('0x2a')]){delete _0x2a6ac2[_0x65bd('0x2a')];}_0x580bb1[_0x65bd('0x1b')](_0x330306)[_0x65bd('0x2b')](_0x2a6ac2);};}exports[_0x65bd('0x2c')]=function(_0x4716db,_0x5c7d5d){var _0x398bbf={},_0x35b73f={},_0x4ed64a={'count':0x0,'rows':[]};var _0x1858a6=_['map'](db[_0x65bd('0x2d')][_0x65bd('0x2e')],function(_0x13283a){return{'name':_0x13283a[_0x65bd('0x2f')],'type':_0x13283a['type']['key']};});_0x35b73f['model']=_[_0x65bd('0x30')](_0x1858a6,'name');_0x35b73f[_0x65bd('0x31')]=_[_0x65bd('0x32')](_0x4716db[_0x65bd('0x31')]);_0x35b73f[_0x65bd('0x33')]=_[_0x65bd('0x34')](_0x35b73f[_0x65bd('0x35')],_0x35b73f['query']);_0x398bbf['attributes']=_['intersection'](_0x35b73f[_0x65bd('0x35')],qs[_0x65bd('0x36')](_0x4716db[_0x65bd('0x31')][_0x65bd('0x36')]));_0x398bbf[_0x65bd('0x37')]=_0x398bbf[_0x65bd('0x37')][_0x65bd('0x38')]?_0x398bbf[_0x65bd('0x37')]:_0x35b73f[_0x65bd('0x35')];if(!_0x4716db[_0x65bd('0x31')]['hasOwnProperty'](_0x65bd('0x39'))){_0x398bbf[_0x65bd('0x1f')]=qs[_0x65bd('0x1f')](_0x4716db[_0x65bd('0x31')][_0x65bd('0x1f')]);_0x398bbf[_0x65bd('0x1d')]=qs[_0x65bd('0x1d')](_0x4716db[_0x65bd('0x31')][_0x65bd('0x1d')]);}_0x398bbf[_0x65bd('0x3a')]=qs[_0x65bd('0x3b')](_0x4716db['query'][_0x65bd('0x3b')]);_0x398bbf[_0x65bd('0x3c')]=qs[_0x65bd('0x33')](_[_0x65bd('0x3d')](_0x4716db['query'],_0x35b73f[_0x65bd('0x33')]),_0x1858a6);if(_0x4716db[_0x65bd('0x31')][_0x65bd('0x3e')]){_0x398bbf['where']=_[_0x65bd('0x3f')](_0x398bbf[_0x65bd('0x3c')],{'$or':_[_0x65bd('0x30')](_0x1858a6,function(_0x3c27f2){if(_0x3c27f2[_0x65bd('0x40')]!==_0x65bd('0x41')){var _0x5de894={};_0x5de894[_0x3c27f2[_0x65bd('0x2a')]]={'$like':'%'+_0x4716db['query']['filter']+'%'};return _0x5de894;}})});}_0x398bbf=_[_0x65bd('0x3f')]({},_0x398bbf,_0x4716db[_0x65bd('0x42')]);var _0xb9189e={'where':_0x398bbf[_0x65bd('0x3c')]};return db[_0x65bd('0x2d')][_0x65bd('0x20')](_0xb9189e)[_0x65bd('0x27')](function(_0x440bc5){_0x4ed64a[_0x65bd('0x20')]=_0x440bc5;if(_0x4716db[_0x65bd('0x31')]['includeAll']){_0x398bbf[_0x65bd('0x43')]=[{'all':!![]}];}return db[_0x65bd('0x2d')][_0x65bd('0x44')](_0x398bbf);})['then'](function(_0x11904e){_0x4ed64a[_0x65bd('0x45')]=_0x11904e;return _0x4ed64a;})['then'](respondWithFilteredResult(_0x5c7d5d,_0x398bbf))[_0x65bd('0x46')](handleError(_0x5c7d5d,null));};exports['show']=function(_0x3f07ae,_0x4fc964){var _0x73ef02={'raw':!![],'where':{'id':_0x3f07ae['params']['id']}},_0x5313e9={};_0x5313e9[_0x65bd('0x35')]=_[_0x65bd('0x32')](db[_0x65bd('0x2d')][_0x65bd('0x2e')]);_0x5313e9['query']=_[_0x65bd('0x32')](_0x3f07ae[_0x65bd('0x31')]);_0x5313e9['filters']=_[_0x65bd('0x34')](_0x5313e9['model'],_0x5313e9[_0x65bd('0x31')]);_0x73ef02[_0x65bd('0x37')]=_[_0x65bd('0x34')](_0x5313e9[_0x65bd('0x35')],qs[_0x65bd('0x36')](_0x3f07ae[_0x65bd('0x31')]['fields']));_0x73ef02[_0x65bd('0x37')]=_0x73ef02[_0x65bd('0x37')][_0x65bd('0x38')]?_0x73ef02[_0x65bd('0x37')]:_0x5313e9[_0x65bd('0x35')];if(_0x3f07ae['query'][_0x65bd('0x47')]){_0x73ef02[_0x65bd('0x43')]=[{'all':!![]}];}_0x73ef02=_[_0x65bd('0x3f')]({},_0x73ef02,_0x3f07ae['options']);return db[_0x65bd('0x2d')][_0x65bd('0x48')](_0x73ef02)['then'](handleEntityNotFound(_0x4fc964,null))[_0x65bd('0x27')](respondWithResult(_0x4fc964,null))[_0x65bd('0x46')](handleError(_0x4fc964,null));};exports[_0x65bd('0x49')]=function(_0x585820,_0x124ad0){return db[_0x65bd('0x2d')][_0x65bd('0x49')](_0x585820[_0x65bd('0x4a')],{})[_0x65bd('0x27')](respondWithResult(_0x124ad0,0xc9))[_0x65bd('0x46')](handleError(_0x124ad0,null));};exports[_0x65bd('0x25')]=function(_0x1c613e,_0x1be882){if(_0x1c613e[_0x65bd('0x4a')]['id']){delete _0x1c613e[_0x65bd('0x4a')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x1c613e['params']['id']}})[_0x65bd('0x27')](handleEntityNotFound(_0x1be882,null))[_0x65bd('0x27')](saveUpdates(_0x1c613e['body'],null))[_0x65bd('0x27')](respondWithResult(_0x1be882,null))[_0x65bd('0x46')](handleError(_0x1be882,null));};exports[_0x65bd('0x26')]=function(_0x4741c3,_0x3e5c31){return db['AnalyticTreeReport'][_0x65bd('0x48')]({'where':{'id':_0x4741c3[_0x65bd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e5c31,null))['then'](removeEntity(_0x3e5c31,null))[_0x65bd('0x46')](handleError(_0x3e5c31,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 20f4d02..29a73c4 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 _0x4715=['../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x4715,0xec));var _0x5471=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4715[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x5471('0x0'));var util=require('util');var logger=require(_0x5471('0x1'))(_0x5471('0x2'));var moment=require(_0x5471('0x3'));var BPromise=require('bluebird');var rp=require(_0x5471('0x4'));var fs=require('fs');var path=require(_0x5471('0x5'));var rimraf=require('rimraf');var config=require(_0x5471('0x6'));var attributes=require(_0x5471('0x7'));module['exports']=function(_0x4d5226,_0x5636f9){return _0x4d5226[_0x5471('0x8')](_0x5471('0x9'),attributes,{'tableName':_0x5471('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8dc=['request-promise','path','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment'];(function(_0x504ad8,_0x1ff2ff){var _0x38229b=function(_0x52a9be){while(--_0x52a9be){_0x504ad8['push'](_0x504ad8['shift']());}};_0x38229b(++_0x1ff2ff);}(_0xe8dc,0xb0));var _0xce8d=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xe8dc[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0xce8d('0x0'));var util=require('util');var logger=require(_0xce8d('0x1'))(_0xce8d('0x2'));var moment=require(_0xce8d('0x3'));var BPromise=require('bluebird');var rp=require(_0xce8d('0x4'));var fs=require('fs');var path=require(_0xce8d('0x5'));var rimraf=require('rimraf');var config=require(_0xce8d('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0xce8d('0x7')]=function(_0xc47045,_0x583dd4){return _0xc47045['define'](_0xce8d('0x8'),attributes,{'tableName':_0xce8d('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 1b10eee..2995d43 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0xadb5,0xad));var _0x5adb=function(_0x399440,_0xdaaf94){_0x399440=_0x399440-0x0;var _0x566163=_0xadb5[_0x399440];return _0x566163;};'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']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xa1dcbd,_0x39a535){var _0x5a20dc=function(_0x33c40f){while(--_0x33c40f){_0xa1dcbd['push'](_0xa1dcbd['shift']());}};_0x5a20dc(++_0x39a535);}(_0xadb5,0xad));var _0x5adb=function(_0x4ae173,_0x324e50){_0x4ae173=_0x4ae173-0x0;var _0x27f39b=_0xadb5[_0x4ae173];return _0x27f39b;};'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']('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index bb4aaed..94a1e1e 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 _0x848a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','express'];(function(_0xdbf8f2,_0x409a32){var _0x4ed5d2=function(_0xe7819c){while(--_0xe7819c){_0xdbf8f2['push'](_0xdbf8f2['shift']());}};_0x4ed5d2(++_0x409a32);}(_0x848a,0x1e3));var _0xa848=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0x848a[_0x12b83d];return _0x1fd39d;};'use strict';var multer=require(_0xa848('0x0'));var util=require(_0xa848('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa848('0x2'));var router=express[_0xa848('0x3')]();var fs_extra=require(_0xa848('0x4'));var auth=require(_0xa848('0x5'));var interaction=require(_0xa848('0x6'));var config=require(_0xa848('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xa848('0x8')]('/',auth[_0xa848('0x9')](),controller[_0xa848('0xa')]);router[_0xa848('0x8')](_0xa848('0xb'),auth[_0xa848('0x9')](),controller['show']);router[_0xa848('0xc')]('/',auth['isAuthenticated'](),controller[_0xa848('0xd')]);router[_0xa848('0xe')](_0xa848('0xb'),auth['isAuthenticated'](),controller[_0xa848('0xf')]);router[_0xa848('0x10')](_0xa848('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa848('0x11')]=router; \ No newline at end of file +var _0x54f4=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports','multer','util','path','express','fs-extra'];(function(_0xb524a6,_0x43c07f){var _0x2aaeca=function(_0x2c6e59){while(--_0x2c6e59){_0xb524a6['push'](_0xb524a6['shift']());}};_0x2aaeca(++_0x43c07f);}(_0x54f4,0x160));var _0x454f=function(_0x3683e3,_0xdaa1b3){_0x3683e3=_0x3683e3-0x0;var _0x3825f1=_0x54f4[_0x3683e3];return _0x3825f1;};'use strict';var multer=require(_0x454f('0x0'));var util=require(_0x454f('0x1'));var path=require(_0x454f('0x2'));var timeout=require('connect-timeout');var express=require(_0x454f('0x3'));var router=express['Router']();var fs_extra=require(_0x454f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x454f('0x5'));var controller=require(_0x454f('0x6'));router[_0x454f('0x7')]('/',auth[_0x454f('0x8')](),controller[_0x454f('0x9')]);router[_0x454f('0x7')]('/:id',auth[_0x454f('0x8')](),controller['show']);router[_0x454f('0xa')]('/',auth[_0x454f('0x8')](),controller[_0x454f('0xb')]);router[_0x454f('0xc')]('/:id',auth[_0x454f('0x8')](),controller['update']);router[_0x454f('0xd')](_0x454f('0xe'),auth[_0x454f('0x8')](),controller[_0x454f('0xf')]);module[_0x454f('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index fd6e22a..888887d 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 _0x3fc6=['sequelize','exports','STRING'];(function(_0x46639c,_0x8dd072){var _0x1e7b0b=function(_0x190678){while(--_0x190678){_0x46639c['push'](_0x46639c['shift']());}};_0x1e7b0b(++_0x8dd072);}(_0x3fc6,0x159));var _0x63fc=function(_0x2be24f,_0x2a5efd){_0x2be24f=_0x2be24f-0x0;var _0x4686ca=_0x3fc6[_0x2be24f];return _0x4686ca;};'use strict';var Sequelize=require(_0x63fc('0x0'));module[_0x63fc('0x1')]={'name':{'type':Sequelize[_0x63fc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x63fc('0x2')]}}; \ No newline at end of file +var _0xdeb7=['exports','STRING','sequelize'];(function(_0x25f8bc,_0x220222){var _0x39c967=function(_0x8bc969){while(--_0x8bc969){_0x25f8bc['push'](_0x25f8bc['shift']());}};_0x39c967(++_0x220222);}(_0xdeb7,0x77));var _0x7deb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdeb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7deb('0x0'));module[_0x7deb('0x1')]={'name':{'type':Sequelize[_0x7deb('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7deb('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e142606..76d6e36 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 _0x594f=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','Attachment','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','options','findAll','rows','find','catch','clone','params','include','get','createdAt','updatedAt','body','omit','create','includeAll','file','basename','filename','mimetype','download','findOne','root','server/files/attachments/','join','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis'];(function(_0x131090,_0x4b5e43){var _0x1e10cf=function(_0x489085){while(--_0x489085){_0x131090['push'](_0x131090['shift']());}};_0x1e10cf(++_0x4b5e43);}(_0x594f,0x98));var _0xf594=function(_0x135994,_0x31fd0c){_0x135994=_0x135994-0x0;var _0x5ad741=_0x594f[_0x135994];return _0x5ad741;};'use strict';var emlformat=require(_0xf594('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf594('0x1'));var jsonpatch=require(_0xf594('0x2'));var rp=require('request-promise');var moment=require(_0xf594('0x3'));var BPromise=require(_0xf594('0x4'));var Mustache=require('mustache');var util=require(_0xf594('0x5'));var path=require(_0xf594('0x6'));var sox=require(_0xf594('0x7'));var csv=require('to-csv');var ejs=require(_0xf594('0x8'));var fs=require('fs');var fs_extra=require(_0xf594('0x9'));var _=require(_0xf594('0xa'));var squel=require(_0xf594('0xb'));var crypto=require('crypto');var jsforce=require(_0xf594('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf594('0xd'));var querystring=require('querystring');var Papa=require(_0xf594('0xe'));var Redis=require(_0xf594('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf594('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf594('0x11'))(_0xf594('0x12'));var utils=require(_0xf594('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf594('0x14'))['db'];function respondWithStatusCode(_0x429fab,_0x5910c2){_0x5910c2=_0x5910c2||0xcc;return function(_0x1ca7ba){if(_0x1ca7ba){return _0x429fab[_0xf594('0x15')](_0x5910c2);}return _0x429fab['status'](_0x5910c2)[_0xf594('0x16')]();};}function respondWithResult(_0xe4538d,_0x5523c3){_0x5523c3=_0x5523c3||0xc8;return function(_0x18cc87){if(_0x18cc87){return _0xe4538d[_0xf594('0x17')](_0x5523c3)['json'](_0x18cc87);}};}function respondWithFilteredResult(_0x3b7ed4,_0x536647){return function(_0x23ed0a){if(_0x23ed0a){var _0x5580f0=typeof _0x536647[_0xf594('0x18')]===_0xf594('0x19')&&typeof _0x536647['limit']===_0xf594('0x19');var _0x235109=_0x23ed0a[_0xf594('0x1a')];var _0x58c0ac=_0x5580f0?0x0:_0x536647[_0xf594('0x18')];var _0x4bb090=_0x5580f0?_0x23ed0a['count']:_0x536647[_0xf594('0x18')]+_0x536647[_0xf594('0x1b')];var _0x5cf418;if(_0x4bb090>=_0x235109){_0x4bb090=_0x235109;_0x5cf418=0xc8;}else{_0x5cf418=0xce;}_0x3b7ed4['status'](_0x5cf418);return _0x3b7ed4[_0xf594('0x1c')](_0xf594('0x1d'),_0x58c0ac+'-'+_0x4bb090+'/'+_0x235109)['json'](_0x23ed0a);}return null;};}function patchUpdates(_0x313415){return function(_0x321e46){try{jsonpatch['apply'](_0x321e46,_0x313415,!![]);}catch(_0x10997b){return BPromise[_0xf594('0x1e')](_0x10997b);}return _0x321e46[_0xf594('0x1f')]();};}function saveUpdates(_0x92a34a,_0x75976f){return function(_0xcbc736){if(_0xcbc736){return _0xcbc736[_0xf594('0x20')](_0x92a34a)[_0xf594('0x21')](function(_0x5399ec){return _0x5399ec;});}return null;};}function removeEntity(_0xf95fd7,_0x2087ed){return function(_0xa7229c){if(_0xa7229c){return _0xa7229c[_0xf594('0x22')]()['then'](function(){_0xf95fd7[_0xf594('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4d7a,_0x5d63e6){return function(_0x35f6a7){if(!_0x35f6a7){_0x4c4d7a[_0xf594('0x15')](0x194);}return _0x35f6a7;};}function handleError(_0x12e6c1,_0xa078bd){_0xa078bd=_0xa078bd||0x1f4;return function(_0x5d77c8){logger[_0xf594('0x23')](_0x5d77c8['stack']);if(_0x5d77c8[_0xf594('0x24')]){delete _0x5d77c8['name'];}_0x12e6c1[_0xf594('0x17')](_0xa078bd)[_0xf594('0x25')](_0x5d77c8);};}exports[_0xf594('0x26')]=function(_0x5b9d10,_0x2ce744){var _0x59917e={},_0x1d1990={},_0x53bf97={'count':0x0,'rows':[]};var _0x59999a=_['map'](db[_0xf594('0x27')][_0xf594('0x28')],function(_0x519f12){return{'name':_0x519f12[_0xf594('0x29')],'type':_0x519f12[_0xf594('0x2a')][_0xf594('0x2b')]};});_0x1d1990[_0xf594('0x2c')]=_['map'](_0x59999a,'name');_0x1d1990[_0xf594('0x2d')]=_[_0xf594('0x2e')](_0x5b9d10['query']);_0x1d1990['filters']=_['intersection'](_0x1d1990[_0xf594('0x2c')],_0x1d1990['query']);_0x59917e[_0xf594('0x2f')]=_[_0xf594('0x30')](_0x1d1990[_0xf594('0x2c')],qs['fields'](_0x5b9d10[_0xf594('0x2d')][_0xf594('0x31')]));_0x59917e[_0xf594('0x2f')]=_0x59917e[_0xf594('0x2f')][_0xf594('0x32')]?_0x59917e['attributes']:_0x1d1990[_0xf594('0x2c')];if(!_0x5b9d10[_0xf594('0x2d')][_0xf594('0x33')](_0xf594('0x34'))){_0x59917e[_0xf594('0x1b')]=qs[_0xf594('0x1b')](_0x5b9d10[_0xf594('0x2d')][_0xf594('0x1b')]);_0x59917e[_0xf594('0x18')]=qs[_0xf594('0x18')](_0x5b9d10[_0xf594('0x2d')][_0xf594('0x18')]);}_0x59917e['order']=qs[_0xf594('0x35')](_0x5b9d10[_0xf594('0x2d')][_0xf594('0x35')]);_0x59917e[_0xf594('0x36')]=qs[_0xf594('0x37')](_[_0xf594('0x38')](_0x5b9d10[_0xf594('0x2d')],_0x1d1990[_0xf594('0x37')]),_0x59999a);if(_0x5b9d10[_0xf594('0x2d')][_0xf594('0x39')]){_0x59917e[_0xf594('0x36')]=_[_0xf594('0x3a')](_0x59917e[_0xf594('0x36')],{'$or':_[_0xf594('0x3b')](_0x59999a,function(_0x1dc599){if(_0x1dc599[_0xf594('0x2a')]!=='VIRTUAL'){var _0x396aee={};_0x396aee[_0x1dc599[_0xf594('0x24')]]={'$like':'%'+_0x5b9d10[_0xf594('0x2d')]['filter']+'%'};return _0x396aee;}})});}_0x59917e=_['merge']({},_0x59917e,_0x5b9d10[_0xf594('0x3c')]);var _0x360149={'where':_0x59917e[_0xf594('0x36')]};return db['Attachment'][_0xf594('0x1a')](_0x360149)['then'](function(_0x4788c3){_0x53bf97[_0xf594('0x1a')]=_0x4788c3;if(_0x5b9d10[_0xf594('0x2d')]['includeAll']){_0x59917e['include']=[{'all':!![]}];}return db[_0xf594('0x27')][_0xf594('0x3d')](_0x59917e);})[_0xf594('0x21')](function(_0x5cb6f1){_0x53bf97[_0xf594('0x3e')]=_0x5cb6f1;return _0x53bf97;})[_0xf594('0x21')](respondWithFilteredResult(_0x2ce744,_0x59917e))['catch'](handleError(_0x2ce744,null));};exports['show']=function(_0xc84793,_0x393d44){var _0x10cdaa={'raw':!![],'where':{'id':_0xc84793['params']['id']}},_0x57f779={};_0x57f779[_0xf594('0x2c')]=_['keys'](db[_0xf594('0x27')][_0xf594('0x28')]);_0x57f779[_0xf594('0x2d')]=_[_0xf594('0x2e')](_0xc84793[_0xf594('0x2d')]);_0x57f779[_0xf594('0x37')]=_[_0xf594('0x30')](_0x57f779['model'],_0x57f779[_0xf594('0x2d')]);_0x10cdaa[_0xf594('0x2f')]=_[_0xf594('0x30')](_0x57f779[_0xf594('0x2c')],qs[_0xf594('0x31')](_0xc84793[_0xf594('0x2d')]['fields']));_0x10cdaa['attributes']=_0x10cdaa[_0xf594('0x2f')][_0xf594('0x32')]?_0x10cdaa[_0xf594('0x2f')]:_0x57f779[_0xf594('0x2c')];if(_0xc84793[_0xf594('0x2d')]['includeAll']){_0x10cdaa['include']=[{'all':!![]}];}_0x10cdaa=_[_0xf594('0x3a')]({},_0x10cdaa,_0xc84793[_0xf594('0x3c')]);return db[_0xf594('0x27')][_0xf594('0x3f')](_0x10cdaa)['then'](handleEntityNotFound(_0x393d44,null))[_0xf594('0x21')](respondWithResult(_0x393d44,null))[_0xf594('0x40')](handleError(_0x393d44,null));};exports[_0xf594('0x41')]=function(_0xa84130,_0xceba33){var _0x4f00f8={'where':{'id':_0xa84130[_0xf594('0x42')]['id']}},_0x223e3b={};_0x223e3b[_0xf594('0x2c')]=_[_0xf594('0x2e')](db[_0xf594('0x27')][_0xf594('0x28')]);_0x4f00f8[_0xf594('0x2f')]=_['intersection'](_0x223e3b[_0xf594('0x2c')],qs[_0xf594('0x31')](_0xa84130[_0xf594('0x2d')]['fields']));_0x4f00f8['attributes']=_0x4f00f8[_0xf594('0x2f')][_0xf594('0x32')]?_0x4f00f8['attributes']:_0x223e3b['model'];if(_0xa84130['query']['includeAll']){_0x4f00f8[_0xf594('0x43')]=[{'all':!![]}];}_0x4f00f8=_['merge']({},_0x4f00f8,_0xa84130['options']);return db[_0xf594('0x27')][_0xf594('0x3f')](_0x4f00f8)[_0xf594('0x21')](handleEntityNotFound(_0xceba33,null))['then'](function(_0x3dcaf3){if(_0x3dcaf3){var _0x41def8=_0x3dcaf3[_0xf594('0x44')]({'plain':!![]});_0x41def8=qs['omit'](_0x41def8,['id',_0xf594('0x45'),_0xf594('0x46')]);_0xa84130[_0xf594('0x47')]=_[_0xf594('0x48')](_0xa84130['body'],['id','createdAt',_0xf594('0x46')]);return db[_0xf594('0x27')][_0xf594('0x49')](_['merge'](_0x41def8,_0xa84130[_0xf594('0x47')]),{'include':_0xa84130[_0xf594('0x2d')][_0xf594('0x4a')]?[{'all':!![]}]:undefined});}})[_0xf594('0x21')](respondWithResult(_0xceba33,0xc9))[_0xf594('0x40')](handleError(_0xceba33,null));};exports[_0xf594('0x20')]=function(_0x29c6ec,_0x592b2c){if(_0x29c6ec[_0xf594('0x47')]['id']){delete _0x29c6ec[_0xf594('0x47')]['id'];}return db[_0xf594('0x27')][_0xf594('0x3f')]({'where':{'id':_0x29c6ec[_0xf594('0x42')]['id']}})[_0xf594('0x21')](handleEntityNotFound(_0x592b2c,null))[_0xf594('0x21')](saveUpdates(_0x29c6ec[_0xf594('0x47')],null))[_0xf594('0x21')](respondWithResult(_0x592b2c,null))['catch'](handleError(_0x592b2c,null));};exports['destroy']=function(_0x354ea5,_0x5f0330){return db[_0xf594('0x27')][_0xf594('0x3f')]({'where':{'id':_0x354ea5[_0xf594('0x42')]['id']}})[_0xf594('0x21')](handleEntityNotFound(_0x5f0330,null))['then'](removeEntity(_0x5f0330,null))[_0xf594('0x40')](handleError(_0x5f0330,null));};exports[_0xf594('0x49')]=function(_0x29376b,_0x1cbed0,_0xf7ea91){_0x29376b['body'][_0xf594('0x24')]=_0x29376b[_0xf594('0x4b')]['originalname'];_0x29376b[_0xf594('0x47')][_0xf594('0x4c')]=_0x29376b[_0xf594('0x4b')][_0xf594('0x4d')];_0x29376b[_0xf594('0x47')][_0xf594('0x2a')]=_0x29376b[_0xf594('0x4b')][_0xf594('0x4e')];return db[_0xf594('0x27')][_0xf594('0x49')](_0x29376b[_0xf594('0x47')])[_0xf594('0x21')](respondWithResult(_0x1cbed0,0xc9))[_0xf594('0x40')](handleError(_0x1cbed0,null));};exports[_0xf594('0x4f')]=function(_0x4723fe,_0x1f9451,_0x406d88){return db[_0xf594('0x27')][_0xf594('0x50')]({'where':{'id':_0x4723fe[_0xf594('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1f9451,null))[_0xf594('0x21')](function(_0x4eb290){if(_0x4eb290){var _0xda8d4=_0x4eb290['ChatOfflineMessageId']!==null;var _0x43dca4=path['join'](config[_0xf594('0x51')],_0xf594('0x52'));if(_0xda8d4){_0x43dca4=path[_0xf594('0x53')](_0x43dca4,'offline-chat/');}var _0x4bf800=path[_0xf594('0x53')](_0x43dca4,_0x4eb290[_0xf594('0x4c')]);return _0x1f9451[_0xf594('0x4f')](_0x4bf800);}})[_0xf594('0x40')](handleError(_0x1f9451,null));}; \ No newline at end of file +var _0x786f=['merge','VIRTUAL','filter','options','findAll','rows','show','params','keys','rawAttributes','includeAll','include','find','catch','clone','get','omit','createdAt','body','updatedAt','create','originalname','basename','filename','file','mimetype','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../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','reject','save','update','then','destroy','stack','name','send','index','Attachment','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3bb7e8,_0x4e6109){var _0x5b6286=function(_0x47f940){while(--_0x47f940){_0x3bb7e8['push'](_0x3bb7e8['shift']());}};_0x5b6286(++_0x4e6109);}(_0x786f,0x137));var _0xf786=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x786f[_0x280f4a];return _0x1bb157;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf786('0x0'));var jsonpatch=require(_0xf786('0x1'));var rp=require(_0xf786('0x2'));var moment=require(_0xf786('0x3'));var BPromise=require(_0xf786('0x4'));var Mustache=require('mustache');var util=require(_0xf786('0x5'));var path=require(_0xf786('0x6'));var sox=require(_0xf786('0x7'));var csv=require(_0xf786('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf786('0x9'));var _=require(_0xf786('0xa'));var squel=require(_0xf786('0xb'));var crypto=require(_0xf786('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf786('0xd'));var toCsv=require(_0xf786('0x8'));var querystring=require(_0xf786('0xe'));var Papa=require(_0xf786('0xf'));var Redis=require(_0xf786('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf786('0x11'));var hardwareService=require(_0xf786('0x12'));var logger=require(_0xf786('0x13'))(_0xf786('0x14'));var utils=require(_0xf786('0x15'));var config=require(_0xf786('0x16'));var licenseUtil=require(_0xf786('0x17'));var db=require(_0xf786('0x18'))['db'];function respondWithStatusCode(_0x352815,_0x5dd1fd){_0x5dd1fd=_0x5dd1fd||0xcc;return function(_0x2878e3){if(_0x2878e3){return _0x352815[_0xf786('0x19')](_0x5dd1fd);}return _0x352815[_0xf786('0x1a')](_0x5dd1fd)[_0xf786('0x1b')]();};}function respondWithResult(_0x805ce3,_0x2b623f){_0x2b623f=_0x2b623f||0xc8;return function(_0x37aeb9){if(_0x37aeb9){return _0x805ce3['status'](_0x2b623f)[_0xf786('0x1c')](_0x37aeb9);}};}function respondWithFilteredResult(_0x49b90f,_0x2fb4b1){return function(_0x2c2e61){if(_0x2c2e61){var _0x38bca4=typeof _0x2fb4b1[_0xf786('0x1d')]===_0xf786('0x1e')&&typeof _0x2fb4b1[_0xf786('0x1f')]==='undefined';var _0x214ed2=_0x2c2e61[_0xf786('0x20')];var _0x14a2ee=_0x38bca4?0x0:_0x2fb4b1['offset'];var _0x35844b=_0x38bca4?_0x2c2e61[_0xf786('0x20')]:_0x2fb4b1[_0xf786('0x1d')]+_0x2fb4b1['limit'];var _0x506d98;if(_0x35844b>=_0x214ed2){_0x35844b=_0x214ed2;_0x506d98=0xc8;}else{_0x506d98=0xce;}_0x49b90f[_0xf786('0x1a')](_0x506d98);return _0x49b90f[_0xf786('0x21')](_0xf786('0x22'),_0x14a2ee+'-'+_0x35844b+'/'+_0x214ed2)[_0xf786('0x1c')](_0x2c2e61);}return null;};}function patchUpdates(_0x38834f){return function(_0x14aa55){try{jsonpatch['apply'](_0x14aa55,_0x38834f,!![]);}catch(_0x17ba8d){return BPromise[_0xf786('0x23')](_0x17ba8d);}return _0x14aa55[_0xf786('0x24')]();};}function saveUpdates(_0x20cec2,_0x533da3){return function(_0x4747b5){if(_0x4747b5){return _0x4747b5[_0xf786('0x25')](_0x20cec2)[_0xf786('0x26')](function(_0x12a774){return _0x12a774;});}return null;};}function removeEntity(_0x410a6e,_0x244d69){return function(_0x207901){if(_0x207901){return _0x207901[_0xf786('0x27')]()[_0xf786('0x26')](function(){_0x410a6e[_0xf786('0x1a')](0xcc)[_0xf786('0x1b')]();});}};}function handleEntityNotFound(_0x43aec5,_0x349bdd){return function(_0x45fc66){if(!_0x45fc66){_0x43aec5['sendStatus'](0x194);}return _0x45fc66;};}function handleError(_0x41ebad,_0x830de5){_0x830de5=_0x830de5||0x1f4;return function(_0x5dd887){logger['error'](_0x5dd887[_0xf786('0x28')]);if(_0x5dd887[_0xf786('0x29')]){delete _0x5dd887[_0xf786('0x29')];}_0x41ebad[_0xf786('0x1a')](_0x830de5)[_0xf786('0x2a')](_0x5dd887);};}exports[_0xf786('0x2b')]=function(_0x4ae2ae,_0x5a5274){var _0x4c23c8={},_0x412afd={},_0x4ae82e={'count':0x0,'rows':[]};var _0x3f52ff=_['map'](db[_0xf786('0x2c')]['rawAttributes'],function(_0x3bd3ac){return{'name':_0x3bd3ac[_0xf786('0x2d')],'type':_0x3bd3ac[_0xf786('0x2e')]['key']};});_0x412afd[_0xf786('0x2f')]=_[_0xf786('0x30')](_0x3f52ff,'name');_0x412afd[_0xf786('0x31')]=_['keys'](_0x4ae2ae[_0xf786('0x31')]);_0x412afd[_0xf786('0x32')]=_[_0xf786('0x33')](_0x412afd['model'],_0x412afd[_0xf786('0x31')]);_0x4c23c8[_0xf786('0x34')]=_[_0xf786('0x33')](_0x412afd[_0xf786('0x2f')],qs[_0xf786('0x35')](_0x4ae2ae['query'][_0xf786('0x35')]));_0x4c23c8[_0xf786('0x34')]=_0x4c23c8['attributes'][_0xf786('0x36')]?_0x4c23c8['attributes']:_0x412afd[_0xf786('0x2f')];if(!_0x4ae2ae[_0xf786('0x31')][_0xf786('0x37')](_0xf786('0x38'))){_0x4c23c8[_0xf786('0x1f')]=qs['limit'](_0x4ae2ae[_0xf786('0x31')]['limit']);_0x4c23c8['offset']=qs[_0xf786('0x1d')](_0x4ae2ae[_0xf786('0x31')][_0xf786('0x1d')]);}_0x4c23c8[_0xf786('0x39')]=qs['sort'](_0x4ae2ae[_0xf786('0x31')][_0xf786('0x3a')]);_0x4c23c8[_0xf786('0x3b')]=qs[_0xf786('0x32')](_[_0xf786('0x3c')](_0x4ae2ae[_0xf786('0x31')],_0x412afd[_0xf786('0x32')]),_0x3f52ff);if(_0x4ae2ae[_0xf786('0x31')]['filter']){_0x4c23c8[_0xf786('0x3b')]=_[_0xf786('0x3d')](_0x4c23c8[_0xf786('0x3b')],{'$or':_['map'](_0x3f52ff,function(_0x4b92ba){if(_0x4b92ba[_0xf786('0x2e')]!==_0xf786('0x3e')){var _0x53425a={};_0x53425a[_0x4b92ba['name']]={'$like':'%'+_0x4ae2ae[_0xf786('0x31')][_0xf786('0x3f')]+'%'};return _0x53425a;}})});}_0x4c23c8=_['merge']({},_0x4c23c8,_0x4ae2ae[_0xf786('0x40')]);var _0x218c05={'where':_0x4c23c8[_0xf786('0x3b')]};return db[_0xf786('0x2c')][_0xf786('0x20')](_0x218c05)[_0xf786('0x26')](function(_0x194399){_0x4ae82e['count']=_0x194399;if(_0x4ae2ae[_0xf786('0x31')]['includeAll']){_0x4c23c8['include']=[{'all':!![]}];}return db[_0xf786('0x2c')][_0xf786('0x41')](_0x4c23c8);})[_0xf786('0x26')](function(_0xe7278c){_0x4ae82e[_0xf786('0x42')]=_0xe7278c;return _0x4ae82e;})[_0xf786('0x26')](respondWithFilteredResult(_0x5a5274,_0x4c23c8))['catch'](handleError(_0x5a5274,null));};exports[_0xf786('0x43')]=function(_0x107446,_0x14f0d7){var _0x34d69d={'raw':!![],'where':{'id':_0x107446[_0xf786('0x44')]['id']}},_0x488d49={};_0x488d49[_0xf786('0x2f')]=_[_0xf786('0x45')](db[_0xf786('0x2c')][_0xf786('0x46')]);_0x488d49['query']=_['keys'](_0x107446[_0xf786('0x31')]);_0x488d49[_0xf786('0x32')]=_[_0xf786('0x33')](_0x488d49[_0xf786('0x2f')],_0x488d49[_0xf786('0x31')]);_0x34d69d[_0xf786('0x34')]=_[_0xf786('0x33')](_0x488d49[_0xf786('0x2f')],qs[_0xf786('0x35')](_0x107446[_0xf786('0x31')][_0xf786('0x35')]));_0x34d69d['attributes']=_0x34d69d[_0xf786('0x34')]['length']?_0x34d69d[_0xf786('0x34')]:_0x488d49[_0xf786('0x2f')];if(_0x107446[_0xf786('0x31')][_0xf786('0x47')]){_0x34d69d[_0xf786('0x48')]=[{'all':!![]}];}_0x34d69d=_[_0xf786('0x3d')]({},_0x34d69d,_0x107446[_0xf786('0x40')]);return db[_0xf786('0x2c')][_0xf786('0x49')](_0x34d69d)[_0xf786('0x26')](handleEntityNotFound(_0x14f0d7,null))[_0xf786('0x26')](respondWithResult(_0x14f0d7,null))[_0xf786('0x4a')](handleError(_0x14f0d7,null));};exports[_0xf786('0x4b')]=function(_0x5450f4,_0x407b5b){var _0x201877={'where':{'id':_0x5450f4[_0xf786('0x44')]['id']}},_0x25720b={};_0x25720b['model']=_['keys'](db[_0xf786('0x2c')][_0xf786('0x46')]);_0x201877[_0xf786('0x34')]=_[_0xf786('0x33')](_0x25720b[_0xf786('0x2f')],qs['fields'](_0x5450f4[_0xf786('0x31')][_0xf786('0x35')]));_0x201877[_0xf786('0x34')]=_0x201877['attributes'][_0xf786('0x36')]?_0x201877['attributes']:_0x25720b[_0xf786('0x2f')];if(_0x5450f4[_0xf786('0x31')]['includeAll']){_0x201877[_0xf786('0x48')]=[{'all':!![]}];}_0x201877=_['merge']({},_0x201877,_0x5450f4[_0xf786('0x40')]);return db[_0xf786('0x2c')][_0xf786('0x49')](_0x201877)[_0xf786('0x26')](handleEntityNotFound(_0x407b5b,null))['then'](function(_0x126146){if(_0x126146){var _0x3b495f=_0x126146[_0xf786('0x4c')]({'plain':!![]});_0x3b495f=qs[_0xf786('0x4d')](_0x3b495f,['id',_0xf786('0x4e'),'updatedAt']);_0x5450f4[_0xf786('0x4f')]=_[_0xf786('0x4d')](_0x5450f4[_0xf786('0x4f')],['id',_0xf786('0x4e'),_0xf786('0x50')]);return db['Attachment'][_0xf786('0x51')](_[_0xf786('0x3d')](_0x3b495f,_0x5450f4[_0xf786('0x4f')]),{'include':_0x5450f4[_0xf786('0x31')][_0xf786('0x47')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x407b5b,0xc9))[_0xf786('0x4a')](handleError(_0x407b5b,null));};exports[_0xf786('0x25')]=function(_0x1a5b84,_0x5563ff){if(_0x1a5b84[_0xf786('0x4f')]['id']){delete _0x1a5b84[_0xf786('0x4f')]['id'];}return db['Attachment'][_0xf786('0x49')]({'where':{'id':_0x1a5b84['params']['id']}})[_0xf786('0x26')](handleEntityNotFound(_0x5563ff,null))[_0xf786('0x26')](saveUpdates(_0x1a5b84[_0xf786('0x4f')],null))[_0xf786('0x26')](respondWithResult(_0x5563ff,null))[_0xf786('0x4a')](handleError(_0x5563ff,null));};exports[_0xf786('0x27')]=function(_0x5b5ddb,_0x3c2ef7){return db[_0xf786('0x2c')][_0xf786('0x49')]({'where':{'id':_0x5b5ddb[_0xf786('0x44')]['id']}})[_0xf786('0x26')](handleEntityNotFound(_0x3c2ef7,null))['then'](removeEntity(_0x3c2ef7,null))['catch'](handleError(_0x3c2ef7,null));};exports[_0xf786('0x51')]=function(_0x4237d0,_0x8210b8,_0x2ef5c9){_0x4237d0[_0xf786('0x4f')][_0xf786('0x29')]=_0x4237d0['file'][_0xf786('0x52')];_0x4237d0[_0xf786('0x4f')][_0xf786('0x53')]=_0x4237d0['file'][_0xf786('0x54')];_0x4237d0[_0xf786('0x4f')][_0xf786('0x2e')]=_0x4237d0[_0xf786('0x55')][_0xf786('0x56')];return db['Attachment'][_0xf786('0x51')](_0x4237d0[_0xf786('0x4f')])['then'](respondWithResult(_0x8210b8,0xc9))[_0xf786('0x4a')](handleError(_0x8210b8,null));};exports['download']=function(_0x34f9b1,_0x2b3a79,_0x54a6a3){return db[_0xf786('0x2c')]['findOne']({'where':{'id':_0x34f9b1[_0xf786('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2b3a79,null))[_0xf786('0x26')](function(_0x4eaabe){if(_0x4eaabe){var _0x368010=_0x4eaabe[_0xf786('0x57')]!==null;var _0x35bc8a=path['join'](config[_0xf786('0x58')],_0xf786('0x59'));if(_0x368010){_0x35bc8a=path[_0xf786('0x5a')](_0x35bc8a,_0xf786('0x5b'));}var _0x4cd65d=path['join'](_0x35bc8a,_0x4eaabe[_0xf786('0x53')]);return _0x2b3a79[_0xf786('0x5c')](_0x4cd65d);}})[_0xf786('0x4a')](handleError(_0x2b3a79,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 252e4f4..4f6052a 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 _0xd760=['request-promise','path','../../config/environment','exports','define','lodash','util','../../config/logger','moment'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0xd760,0x12e));var _0x0d76=function(_0x47faec,_0x3ecd1c){_0x47faec=_0x47faec-0x0;var _0x530c77=_0xd760[_0x47faec];return _0x530c77;};'use strict';var _=require(_0x0d76('0x0'));var util=require(_0x0d76('0x1'));var logger=require(_0x0d76('0x2'))('api');var moment=require(_0x0d76('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d76('0x4'));var fs=require('fs');var path=require(_0x0d76('0x5'));var rimraf=require('rimraf');var config=require(_0x0d76('0x6'));var attributes=require('./attachment.attributes');module[_0x0d76('0x7')]=function(_0x3314be,_0x3fbbec){return _0x3314be[_0x0d76('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf0e=['exports','define','Attachment','attachments','util','../../config/logger','request-promise','path','../../config/environment','./attachment.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdf0e,0xcc));var _0xedf0=function(_0x382ca6,_0x1aaf79){_0x382ca6=_0x382ca6-0x0;var _0x295a6c=_0xdf0e[_0x382ca6];return _0x295a6c;};'use strict';var _=require('lodash');var util=require(_0xedf0('0x0'));var logger=require(_0xedf0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xedf0('0x2'));var fs=require('fs');var path=require(_0xedf0('0x3'));var rimraf=require('rimraf');var config=require(_0xedf0('0x4'));var attributes=require(_0xedf0('0x5'));module[_0xedf0('0x6')]=function(_0x4aaac9,_0x3c1728){return _0x4aaac9[_0xedf0('0x7')](_0xedf0('0x8'),attributes,{'tableName':_0xedf0('0x9'),'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 532b42c..a4b034a 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 _0x4c4e=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateAttachment','create','body','options','then','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Attachment,\x20%s,\x20%s'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x4c4e,0x152));var _0xe4c4=function(_0xd506a9,_0x1bf9db){_0xd506a9=_0xd506a9-0x0;var _0x14f47d=_0x4c4e[_0xd506a9];return _0x14f47d;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('Attachment,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('Attachment,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});}exports[_0xe4c4('0x15')]=function(_0x42242c){var _0x3820c7=this;return new Promise(function(_0x43a9ce,_0x376585){return db['Attachment'][_0xe4c4('0x16')](_0x42242c[_0xe4c4('0x17')],{'raw':_0x42242c[_0xe4c4('0x18')]?_0x42242c[_0xe4c4('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xe4c4('0x19')](function(_0x1cad5d){logger[_0xe4c4('0xb')](_0xe4c4('0x15'),_0x42242c);logger[_0xe4c4('0xe')](_0xe4c4('0x15'),_0x42242c,JSON[_0xe4c4('0x1a')](_0x1cad5d));_0x43a9ce(_0x1cad5d);})[_0xe4c4('0x14')](function(_0x21bbb1){logger[_0xe4c4('0x10')](_0xe4c4('0x15'),_0x21bbb1[_0xe4c4('0x12')],_0x42242c);_0x376585(_0x3820c7[_0xe4c4('0x10')](0x1f4,_0x21bbb1[_0xe4c4('0x12')]));});});}; \ No newline at end of file +var _0xbe02=['jayson/promise','client','http','request','then','stringify','error','code','Attachment,\x20%s,\x20%s','message','request\x20sent','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e9463,_0x17b772){var _0x40c6c5=function(_0x3949d3){while(--_0x3949d3){_0x5e9463['push'](_0x5e9463['shift']());}};_0x40c6c5(++_0x17b772);}(_0xbe02,0x146));var _0x2be0=function(_0x4dfdb2,_0x3ca31b){_0x4dfdb2=_0x4dfdb2-0x0;var _0x10189a=_0xbe02[_0x4dfdb2];return _0x10189a;};'use strict';var _=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var moment=require(_0x2be0('0x2'));var BPromise=require(_0x2be0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2be0('0x4'));var db=require(_0x2be0('0x5'))['db'];var utils=require(_0x2be0('0x6'));var logger=require(_0x2be0('0x7'))(_0x2be0('0x8'));var config=require(_0x2be0('0x9'));var jayson=require(_0x2be0('0xa'));var client=jayson[_0x2be0('0xb')][_0x2be0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e872c,_0x4ca22f,_0x176f12){return new BPromise(function(_0xdfef68,_0x1ac0a3){return client[_0x2be0('0xd')](_0x4e872c,_0x176f12)[_0x2be0('0xe')](function(_0x45d9f5){logger['info']('Attachment,\x20%s,\x20%s',_0x4ca22f,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x4ca22f,'request\x20sent',JSON[_0x2be0('0xf')](_0x45d9f5));if(_0x45d9f5[_0x2be0('0x10')]){if(_0x45d9f5['error'][_0x2be0('0x11')]===0x1f4){logger[_0x2be0('0x10')](_0x2be0('0x12'),_0x4ca22f,_0x45d9f5[_0x2be0('0x10')][_0x2be0('0x13')]);return _0x1ac0a3(_0x45d9f5[_0x2be0('0x10')][_0x2be0('0x13')]);}logger[_0x2be0('0x10')](_0x2be0('0x12'),_0x4ca22f,_0x45d9f5[_0x2be0('0x10')]['message']);return _0xdfef68(_0x45d9f5[_0x2be0('0x10')][_0x2be0('0x13')]);}else{logger['info'](_0x2be0('0x12'),_0x4ca22f,_0x2be0('0x14'));_0xdfef68(_0x45d9f5['result'][_0x2be0('0x13')]);}})[_0x2be0('0x15')](function(_0x137ce9){logger[_0x2be0('0x10')](_0x2be0('0x12'),_0x4ca22f,_0x137ce9);_0x1ac0a3(_0x137ce9);});});}exports[_0x2be0('0x16')]=function(_0x48d386){var _0x415894=this;return new Promise(function(_0x3f8dba,_0x35da90){return db[_0x2be0('0x17')][_0x2be0('0x18')](_0x48d386[_0x2be0('0x19')],{'raw':_0x48d386[_0x2be0('0x1a')]?_0x48d386[_0x2be0('0x1a')][_0x2be0('0x1b')]===undefined?!![]:![]:!![]})[_0x2be0('0xe')](function(_0x4c8afc){logger['info'](_0x2be0('0x16'),_0x48d386);logger['debug']('CreateAttachment',_0x48d386,JSON[_0x2be0('0xf')](_0x4c8afc));_0x3f8dba(_0x4c8afc);})[_0x2be0('0x15')](function(_0x2da0d5){logger[_0x2be0('0x10')](_0x2be0('0x16'),_0x2da0d5[_0x2be0('0x13')],_0x48d386);_0x35da90(_0x415894[_0x2be0('0x10')](0x1f4,_0x2da0d5[_0x2be0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a2b6d77..8298f61 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(_0x174211,_0x1f00ed){var _0x411a85=function(_0x2abb2f){while(--_0x2abb2f){_0x174211['push'](_0x174211['shift']());}};_0x411a85(++_0x1f00ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f3173,_0x532c04){_0x2f3173=_0x2f3173-0x0;var _0x426e08=_0xb10b[_0x2f3173];return _0x426e08;};'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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x20aff6,_0x80787e){var _0x3d23c2=function(_0x175b36){while(--_0x175b36){_0x20aff6['push'](_0x20aff6['shift']());}};_0x3d23c2(++_0x80787e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3747c3,_0x4e17bd){_0x3747c3=_0x3747c3-0x0;var _0x879b56=_0x5f2f[_0x3747c3];return _0x879b56;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a220b2b..095b751 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 _0x7446=['User','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','minutes','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts','then'];(function(_0x498621,_0x392917){var _0x574e8c=function(_0x346258){while(--_0x346258){_0x498621['push'](_0x498621['shift']());}};_0x574e8c(++_0x392917);}(_0x7446,0x146));var _0x6744=function(_0x2a31f1,_0x5320a9){_0x2a31f1=_0x2a31f1-0x0;var _0x26ba98=_0x7446[_0x2a31f1];return _0x26ba98;};'use strict';var _=require(_0x6744('0x0'));var passport=require(_0x6744('0x1'));var GoogleStrategy=require(_0x6744('0x2'))[_0x6744('0x3')];var moment=require(_0x6744('0x4'));var db=require(_0x6744('0x5'))['db'];var config=require(_0x6744('0x6'));var signToken=require(_0x6744('0x7'))[_0x6744('0x8')];var utils=require(_0x6744('0x9'));exports[_0x6744('0xa')]=passport[_0x6744('0xb')](_0x6744('0xc'),{'failureRedirect':_0x6744('0xd'),'scope':[_0x6744('0xe'),_0x6744('0xf')],'session':![]});exports[_0x6744('0x10')]=passport[_0x6744('0xb')](_0x6744('0xc'),{'failureRedirect':_0x6744('0xd'),'session':![]});passport[_0x6744('0x11')](new GoogleStrategy({'clientID':config['google']?config[_0x6744('0xc')][_0x6744('0x12')]:'id','clientSecret':config[_0x6744('0xc')]?config['google'][_0x6744('0x13')]:_0x6744('0x14'),'callbackURL':config['google']?config[_0x6744('0xc')][_0x6744('0x15')]:''},function(_0x3e70c7,_0x40d1f9,_0x1107de,_0x278eae){var _0xb59384,_0x578324;return db[_0x6744('0x16')]['findOne']({'where':{'id':0x1},'attributes':[_0x6744('0x17'),'blockDuration'],'raw':!![]})[_0x6744('0x18')](function(_0x1ff5ff){_0xb59384=_0x1ff5ff;return db[_0x6744('0x19')]['find']({'where':{'email':_['map'](_0x1107de[_0x6744('0x1a')],'value'),'role':{'$or':[_0x6744('0x1b'),_0x6744('0x1c'),_0x6744('0x1d')]}}});})[_0x6744('0x18')](function(_0x527403){_0x578324=_0x527403;if(_0x578324){if(_0x578324[_0x6744('0x1e')]){return _0x278eae(_0x6744('0x1f'));}else if(_0xb59384[_0x6744('0x20')]>0x0){if(_0x578324[_0x6744('0x21')]){if(moment(_0x578324[_0x6744('0x22')])[_0x6744('0x23')](_0xb59384['blockDuration'],_0x6744('0x24'))>moment()){return _0x278eae(_0x6744('0x1f'));}else{return utils['clearBlockUser'](_0x578324,0x0,![],null)[_0x6744('0x18')](function(){return utils['getLicense'](_0x578324);})[_0x6744('0x18')](function(){return _0x278eae(null,_0x578324);});}}else{return utils[_0x6744('0x25')](_0x578324)[_0x6744('0x18')](function(){return _0x278eae(null,_0x578324);});}}else{return utils['getLicense'](_0x578324)['then'](function(){return _0x278eae(null,_0x578324);});}}return _0x278eae('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x6744('0x26')](function(_0x30a164){_0x278eae(_0x30a164);});})); \ No newline at end of file +var _0xf69a=['clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','find','map','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../components/auth/service','login','authenticate','google','profile','email','callback','/login','use','clientID'];(function(_0x328249,_0x3680bd){var _0x4162cb=function(_0x3a8665){while(--_0x3a8665){_0x328249['push'](_0x328249['shift']());}};_0x4162cb(++_0x3680bd);}(_0xf69a,0x85));var _0xaf69=function(_0x7b717,_0x311539){_0x7b717=_0x7b717-0x0;var _0x50d254=_0xf69a[_0x7b717];return _0x50d254;};'use strict';var _=require(_0xaf69('0x0'));var passport=require(_0xaf69('0x1'));var GoogleStrategy=require(_0xaf69('0x2'))[_0xaf69('0x3')];var moment=require(_0xaf69('0x4'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require(_0xaf69('0x5'))['signToken'];var utils=require('../../config/utils');exports[_0xaf69('0x6')]=passport[_0xaf69('0x7')](_0xaf69('0x8'),{'failureRedirect':'/login','scope':[_0xaf69('0x9'),_0xaf69('0xa')],'session':![]});exports[_0xaf69('0xb')]=passport['authenticate'](_0xaf69('0x8'),{'failureRedirect':_0xaf69('0xc'),'session':![]});passport[_0xaf69('0xd')](new GoogleStrategy({'clientID':config[_0xaf69('0x8')]?config[_0xaf69('0x8')][_0xaf69('0xe')]:'id','clientSecret':config[_0xaf69('0x8')]?config[_0xaf69('0x8')][_0xaf69('0xf')]:_0xaf69('0x10'),'callbackURL':config[_0xaf69('0x8')]?config[_0xaf69('0x8')][_0xaf69('0x11')]:''},function(_0x38d940,_0x4053d8,_0x3f9f9b,_0x57b477){var _0x49e2af,_0x2718a1;return db[_0xaf69('0x12')][_0xaf69('0x13')]({'where':{'id':0x1},'attributes':[_0xaf69('0x14'),'blockDuration'],'raw':!![]})[_0xaf69('0x15')](function(_0x3e6c35){_0x49e2af=_0x3e6c35;return db['User'][_0xaf69('0x16')]({'where':{'email':_[_0xaf69('0x17')](_0x3f9f9b['emails'],'value'),'role':{'$or':[_0xaf69('0x18'),_0xaf69('0x19'),_0xaf69('0x1a')]}}});})[_0xaf69('0x15')](function(_0x15171a){_0x2718a1=_0x15171a;if(_0x2718a1){if(_0x2718a1[_0xaf69('0x1b')]){return _0x57b477(_0xaf69('0x1c'));}else if(_0x49e2af[_0xaf69('0x1d')]>0x0){if(_0x2718a1[_0xaf69('0x1e')]){if(moment(_0x2718a1[_0xaf69('0x1f')])[_0xaf69('0x20')](_0x49e2af[_0xaf69('0x1d')],_0xaf69('0x21'))>moment()){return _0x57b477(_0xaf69('0x1c'));}else{return utils[_0xaf69('0x22')](_0x2718a1,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2718a1);})['then'](function(){return _0x57b477(null,_0x2718a1);});}}else{return utils[_0xaf69('0x23')](_0x2718a1)['then'](function(){return _0x57b477(null,_0x2718a1);});}}else{return utils[_0xaf69('0x23')](_0x2718a1)[_0xaf69('0x15')](function(){return _0x57b477(null,_0x2718a1);});}}return _0x57b477('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xaf69('0x24')](function(_0x40998e){_0x57b477(_0x40998e);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 39a0e7f..d39128d 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 _0x97a1=['../../components/auth/service','login','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','../user/user.controller.js'];(function(_0x474973,_0xb6b5eb){var _0x99479e=function(_0x15af1a){while(--_0x15af1a){_0x474973['push'](_0x474973['shift']());}};_0x99479e(++_0xb6b5eb);}(_0x97a1,0x1b4));var _0x197a=function(_0x5c98a1,_0x4a2a42){_0x5c98a1=_0x5c98a1-0x0;var _0x3d3ad9=_0x97a1[_0x5c98a1];return _0x3d3ad9;};'use strict';var express=require(_0x197a('0x0'));var passport=require(_0x197a('0x1'));var router=express[_0x197a('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x197a('0x3'));var authService=require(_0x197a('0x4'));router['get']('/',controller[_0x197a('0x5')]);router['get']('/callback',controller[_0x197a('0x6')],authService[_0x197a('0x7')],userController[_0x197a('0x5')],authService[_0x197a('0x8')]);module[_0x197a('0x9')]=router; \ No newline at end of file +var _0xd161=['../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','express','Router','./authGoogle.controller'];(function(_0x5e3836,_0x35936a){var _0x2a4f95=function(_0x25e5d7){while(--_0x25e5d7){_0x5e3836['push'](_0x5e3836['shift']());}};_0x2a4f95(++_0x35936a);}(_0xd161,0x1d1));var _0x1d16=function(_0x5ce8ec,_0x25eaf9){_0x5ce8ec=_0x5ce8ec-0x0;var _0xb4b63e=_0xd161[_0x5ce8ec];return _0xb4b63e;};'use strict';var express=require(_0x1d16('0x0'));var passport=require('passport');var router=express[_0x1d16('0x1')]();var controller=require(_0x1d16('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x1d16('0x3'));router[_0x1d16('0x4')]('/',controller[_0x1d16('0x5')]);router[_0x1d16('0x4')]('/callback',controller[_0x1d16('0x6')],authService[_0x1d16('0x7')],userController['login'],authService[_0x1d16('0x8')]);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 d3d9838..c02d6ce 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 _0x3327=['trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','token','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport-local','Strategy','lodash','moment','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','email','Email\x20parameter\x20is\x20missing','generate','body'];(function(_0xace1ac,_0x2d20a8){var _0x103c4c=function(_0x12ed69){while(--_0x12ed69){_0xace1ac['push'](_0xace1ac['shift']());}};_0x103c4c(++_0x2d20a8);}(_0x3327,0xc8));var _0x7332=function(_0x420ff2,_0x41853a){_0x420ff2=_0x420ff2-0x0;var _0x5d7626=_0x3327[_0x420ff2];return _0x5d7626;};'use strict';var util=require(_0x7332('0x0'));var passport=require('passport');var LocalStrategy=require(_0x7332('0x1'))[_0x7332('0x2')];var jayson=require('jayson/promise');var _=require(_0x7332('0x3'));var rs=require('randomstring');var moment=require(_0x7332('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x7332('0x5'));var utils=require(_0x7332('0x6'));var client=jayson['client'][_0x7332('0x7')]({'port':0x232b});function localAuthenticate(_0x5c0a29,_0x9f39d7,_0xc27ae9,_0x3bf336){var _0xaa6bf4,_0xc6d667;return db[_0x7332('0x8')][_0x7332('0x9')]({'where':{'id':0x1},'attributes':[_0x7332('0xa'),_0x7332('0xb')],'raw':!![]})[_0x7332('0xc')](function(_0x54af2b){_0xaa6bf4=_0x54af2b;return _0x5c0a29[_0x7332('0x9')]({'attributes':['id',_0x7332('0xd'),_0x7332('0xe'),_0x7332('0xf'),_0x7332('0x10'),'disabled','blocked',_0x7332('0x11'),_0x7332('0x12')],'where':{'name':_0x9f39d7,'role':{'$or':[_0x7332('0x13'),'user',_0x7332('0x14')]}}});})[_0x7332('0xc')](function(_0x26489d){if(!_0x26489d||_0x26489d&&_0x26489d[_0x7332('0xd')]!==_0x9f39d7){throw new Error(_0x7332('0x15'));}else{_0xc6d667=_0x26489d;return _0xc6d667;}})[_0x7332('0xc')](function(){_0xc6d667['authenticate'](_0xc27ae9,function(_0x2e58ee,_0x371153){var _0x287ab1=_0xc6d667['loginAttempts']+0x1;if(_0x2e58ee){return _0x3bf336(_0x2e58ee);}else if(!_0x371153){if(_0xc6d667['disabled']){return _0x3bf336(null,![],{'message':_0x7332('0x15')});}else if(_0xaa6bf4[_0x7332('0xa')]>0x0){if(_0xc6d667[_0x7332('0x16')]){if(_0xaa6bf4['blockDuration']>0x0){if(moment(_0xc6d667[_0x7332('0x11')])[_0x7332('0x17')](_0xaa6bf4[_0x7332('0xb')],_0x7332('0x18'))>moment()){return _0x3bf336(null,![],{'message':_0x7332('0x15')});}else{return utils[_0x7332('0x19')](_0xc6d667,_0x287ab1,![],null)[_0x7332('0xc')](function(){return _0x3bf336(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3bf336(null,![],{'message':_0x7332('0x15')});}}else{if(_0x287ab1>=_0xaa6bf4[_0x7332('0xa')]){return utils[_0x7332('0x19')](_0xc6d667,0x0,!![],moment())[_0x7332('0xc')](function(){return _0x3bf336(null,![],{'message':_0x7332('0x15')});});}else{return utils[_0x7332('0x19')](_0xc6d667,_0x287ab1,![],null)[_0x7332('0xc')](function(){return _0x3bf336(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3bf336(null,![],{'message':_0x7332('0x15')});}}else{if(_0xc6d667[_0x7332('0x1a')]){return _0x3bf336(null,![],{'message':_0x7332('0x15')});}else if(_0xaa6bf4['allowedLoginAttempts']>0x0){if(_0xc6d667[_0x7332('0x16')]){if(_0xaa6bf4[_0x7332('0xb')]>0x0){if(moment(_0xc6d667[_0x7332('0x11')])[_0x7332('0x17')](_0xaa6bf4[_0x7332('0xb')],_0x7332('0x18'))>moment()){return _0x3bf336(null,![],{'message':_0x7332('0x15')});}else{return utils[_0x7332('0x19')](_0xc6d667,0x0,![],null)[_0x7332('0xc')](function(){return utils[_0x7332('0x1b')](_0xc6d667);})[_0x7332('0xc')](function(){return _0x3bf336(null,_0xc6d667);});}}else{return _0x3bf336(null,![],{'message':_0x7332('0x15')});}}else{return utils[_0x7332('0x19')](_0xc6d667,0x0,![],null)['then'](function(){return utils[_0x7332('0x1b')](_0xc6d667);})['then'](function(){return _0x3bf336(null,_0xc6d667);})[_0x7332('0x1c')](function(_0x4e697a){return _0x3bf336(null,![],_0x4e697a);});}}else{if(_0xc6d667['blocked']){return _0x3bf336(null,![],{'message':_0x7332('0x15')});}else{return utils[_0x7332('0x1b')](_0xc6d667)[_0x7332('0xc')](function(){return _0x3bf336(null,_0xc6d667);});}}}});})[_0x7332('0x1c')](function(_0x2b96a0){return _0x3bf336(null,![],_0x2b96a0);});}function sendServiceMail(_0x324a53){return db[_0x7332('0x1d')][_0x7332('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x7332('0xd'),'email'],'include':[{'model':db[_0x7332('0x1f')],'as':_0x7332('0x20')}]})['then'](function(_0x13f9e9){if(!_0x13f9e9){throw new Error(_0x7332('0x21'));}var _0x2958f6={'tls':{'rejectUnauthorized':![]}};if(_0x13f9e9[_0x7332('0x20')][_0x7332('0x22')]){_0x2958f6[_0x7332('0x22')]=_0x13f9e9[_0x7332('0x20')]['service'];}else{_0x2958f6[_0x7332('0x23')]=_0x13f9e9[_0x7332('0x20')][_0x7332('0x23')];_0x2958f6[_0x7332('0x24')]=_0x13f9e9['Smtp'][_0x7332('0x24')];_0x2958f6[_0x7332('0x25')]=_0x13f9e9['Smtp'][_0x7332('0x25')];}if(_0x13f9e9[_0x7332('0x20')][_0x7332('0x26')]){_0x2958f6['auth']={'user':_0x13f9e9[_0x7332('0x20')][_0x7332('0x27')],'pass':_0x13f9e9['Smtp'][_0x7332('0x28')]};}var _0x5d1a28={'account':_0x2958f6,'message':_['merge']({'from':util[_0x7332('0x29')](_0x7332('0x2a'),_0x13f9e9[_0x7332('0xd')],_0x13f9e9['email']||_0x13f9e9['Smtp']['user'])},_0x324a53)};return client[_0x7332('0x2b')](_0x7332('0x2c'),_0x5d1a28);})[_0x7332('0xc')](function(_0x3c777d){if(_0x3c777d[_0x7332('0x2d')]){throw new Error(util[_0x7332('0x29')](_0x7332('0x2e'),_0x3c777d[_0x7332('0x2d')][_0x7332('0x2f')]||JSON[_0x7332('0x30')](_0x3c777d[_0x7332('0x2d')])));}return!![];});}function handleError(_0x2e7f61,_0x2d55d4,_0x45cbe7){return _0x2e7f61['status'](_0x2d55d4||0x1f4)[_0x7332('0x31')]({'message':_0x45cbe7?_0x45cbe7[_0x7332('0x2f')]||_0x45cbe7:''});}exports[_0x7332('0x32')]=function(_0x43de4d,_0x55c452,_0x169fe5){passport[_0x7332('0x33')](_0x7332('0x34'),function(_0x29611a,_0x402977,_0x915bde){var _0x3fd8f2=_0x29611a||_0x915bde;if(_0x3fd8f2){return handleError(_0x55c452,0x191,_0x3fd8f2);}if(!_0x402977){return handleError(_0x55c452,0x194,{'message':_0x7332('0x35')});}else{var _0x470977={'payload':{'id':_0x402977['id'],'role':_0x402977[_0x7332('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x7332('0x36')](_0x470977)[_0x7332('0xc')](function(_0xa4ee7d){_0x55c452[_0x7332('0x37')]({'id':_0x402977['id'],'token':_0xa4ee7d,'statusCall':'','isAlreadyLogged':_0x402977['online']});});}})(_0x43de4d,_0x55c452,_0x169fe5);};exports[_0x7332('0x38')]=function(_0x2e10c4,_0x18e780,_0x5b6d0f){if(!_0x2e10c4['body'][_0x7332('0x39')]){return handleError(_0x18e780,0x1f4,{'message':_0x7332('0x3a')});}var _0x522cb6=rs[_0x7332('0x3b')]();_0x2e10c4[_0x7332('0x3c')]['email']=_0x2e10c4[_0x7332('0x3c')][_0x7332('0x39')][_0x7332('0x3d')]()['toLowerCase']();var _0x125d30;return db[_0x7332('0x8')][_0x7332('0x9')]({'where':{'id':0x1},'attributes':[_0x7332('0xa'),_0x7332('0xb')],'raw':!![]})['then'](function(_0x15854f){_0x125d30=_0x15854f;return db[_0x7332('0x3e')]['find']({'where':{'email':_0x2e10c4[_0x7332('0x3c')][_0x7332('0x39')]}});})['then'](function(_0x59240d){if(!_0x59240d){throw new Error(_0x7332('0x3f'));}if(_0x59240d[_0x7332('0x1a')]){throw new Error(_0x7332('0x40'));}if(_0x59240d['blocked']){if(moment(_0x59240d['blockedAt'])[_0x7332('0x17')](_0x125d30[_0x7332('0xb')],'minutes')>moment()){throw new Error(_0x7332('0x41'));}else{_0x59240d[_0x7332('0x16')]=![];_0x59240d[_0x7332('0x11')]=null;}}_0x59240d[_0x7332('0x42')]=_0x522cb6;_0x59240d[_0x7332('0x43')]=Date[_0x7332('0x44')]()+0x36ee80;return _0x59240d['save']();})[_0x7332('0xc')](function(){return sendServiceMail({'to':_0x2e10c4[_0x7332('0x3c')][_0x7332('0x39')],'subject':_0x7332('0x45'),'text':_0x7332('0x46')+_0x7332('0x47')+_0x7332('0x48')+_0x2e10c4[_0x7332('0x49')]['host']+'/reset/'+_0x522cb6+'\x0a\x0a'+_0x7332('0x4a')});})['then'](function(){_0x18e780[_0x7332('0x4b')](0xc8)['send']({'message':_0x7332('0x4c')});})[_0x7332('0x1c')](function(_0x27fc86){return handleError(_0x18e780,0x1f4,_0x27fc86);});};exports[_0x7332('0x4d')]=function(_0x33e5ae,_0x4a986f,_0x231b7a){return db[_0x7332('0x3e')]['find']({'where':{'resetPasswordToken':_0x33e5ae['params'][_0x7332('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x7332('0x44')]()}}})['then'](function(_0x341541){if(!_0x341541){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x7332('0x9')]({'attributes':['id','securePassword',_0x7332('0x4f'),_0x7332('0x50')]})[_0x7332('0xc')](function(_0x53828e){if(_0x53828e[_0x7332('0x51')])authService['validatePasswordPattern'](_0x33e5ae[_0x7332('0x3c')][_0x7332('0xe')]);if(!_0x53828e['enforcePasswordHistory']||!_0x341541[_0x7332('0x52')])return _0x341541;authService[_0x7332('0x53')](_0x33e5ae[_0x7332('0x3c')][_0x7332('0xe')],_0x341541[_0x7332('0x52')],_0x53828e[_0x7332('0x50')]);return _0x341541;})[_0x7332('0xc')](function(){_0x341541['password']=_0x33e5ae[_0x7332('0x3c')]['password'];_0x341541[_0x7332('0x42')]=null;_0x341541['resetPasswordExpires']=null;return _0x341541[_0x7332('0x54')]();});})[_0x7332('0xc')](function(){_0x4a986f[_0x7332('0x4b')](0xc8)[_0x7332('0x31')]({'message':_0x7332('0x55')});})['catch'](function(_0x2dfc9a){return handleError(_0x4a986f,0x1f4,_0x2dfc9a);});};passport[_0x7332('0x56')](new LocalStrategy({'usernameField':'name','passwordField':_0x7332('0xe')},function(_0x17c316,_0x384547,_0x40cabf){return localAuthenticate(db[_0x7332('0x3e')],_0x17c316,_0x384547,_0x40cabf);})); \ No newline at end of file +var _0xe373=['json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','validatePasswordHistory','previousPasswords','resetPasswordExpires','save','Password\x20reset!','use','util','passport','passport-local','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','disabled','blocked','blockedAt','agent','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role'];(function(_0x41e1c6,_0xc47835){var _0x45fc9e=function(_0x4cc65d){while(--_0x4cc65d){_0x41e1c6['push'](_0x41e1c6['shift']());}};_0x45fc9e(++_0xc47835);}(_0xe373,0x11c));var _0x3e37=function(_0x12f0c2,_0x2baff9){_0x12f0c2=_0x12f0c2-0x0;var _0x423f98=_0xe373[_0x12f0c2];return _0x423f98;};'use strict';var util=require(_0x3e37('0x0'));var passport=require(_0x3e37('0x1'));var LocalStrategy=require(_0x3e37('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x3e37('0x3'));var rs=require('randomstring');var moment=require(_0x3e37('0x4'));var db=require(_0x3e37('0x5'))['db'];var authService=require(_0x3e37('0x6'));var utils=require(_0x3e37('0x7'));var client=jayson[_0x3e37('0x8')][_0x3e37('0x9')]({'port':0x232b});function localAuthenticate(_0x539870,_0x42d6e3,_0x2e8fc8,_0x563c98){var _0x5e2509,_0x435f3f;return db[_0x3e37('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x3e37('0xb'),_0x3e37('0xc')],'raw':!![]})[_0x3e37('0xd')](function(_0x5c2382){_0x5e2509=_0x5c2382;return _0x539870[_0x3e37('0xe')]({'attributes':['id',_0x3e37('0xf'),'password',_0x3e37('0x10'),'role',_0x3e37('0x11'),_0x3e37('0x12'),_0x3e37('0x13'),'loginAttempts'],'where':{'name':_0x42d6e3,'role':{'$or':['admin','user',_0x3e37('0x14')]}}});})[_0x3e37('0xd')](function(_0x447671){if(!_0x447671||_0x447671&&_0x447671['name']!==_0x42d6e3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x435f3f=_0x447671;return _0x435f3f;}})[_0x3e37('0xd')](function(){_0x435f3f[_0x3e37('0x15')](_0x2e8fc8,function(_0x35c72a,_0x588b00){var _0x471b07=_0x435f3f[_0x3e37('0x16')]+0x1;if(_0x35c72a){return _0x563c98(_0x35c72a);}else if(!_0x588b00){if(_0x435f3f[_0x3e37('0x11')]){return _0x563c98(null,![],{'message':_0x3e37('0x17')});}else if(_0x5e2509[_0x3e37('0xb')]>0x0){if(_0x435f3f['blocked']){if(_0x5e2509['blockDuration']>0x0){if(moment(_0x435f3f[_0x3e37('0x13')])[_0x3e37('0x18')](_0x5e2509[_0x3e37('0xc')],_0x3e37('0x19'))>moment()){return _0x563c98(null,![],{'message':_0x3e37('0x17')});}else{return utils[_0x3e37('0x1a')](_0x435f3f,_0x471b07,![],null)[_0x3e37('0xd')](function(){return _0x563c98(null,![],{'message':_0x3e37('0x17')});});}}else{return _0x563c98(null,![],{'message':_0x3e37('0x17')});}}else{if(_0x471b07>=_0x5e2509['allowedLoginAttempts']){return utils[_0x3e37('0x1a')](_0x435f3f,0x0,!![],moment())[_0x3e37('0xd')](function(){return _0x563c98(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x435f3f,_0x471b07,![],null)[_0x3e37('0xd')](function(){return _0x563c98(null,![],{'message':_0x3e37('0x17')});});}}}else{return _0x563c98(null,![],{'message':_0x3e37('0x17')});}}else{if(_0x435f3f[_0x3e37('0x11')]){return _0x563c98(null,![],{'message':_0x3e37('0x17')});}else if(_0x5e2509['allowedLoginAttempts']>0x0){if(_0x435f3f[_0x3e37('0x12')]){if(_0x5e2509[_0x3e37('0xc')]>0x0){if(moment(_0x435f3f[_0x3e37('0x13')])[_0x3e37('0x18')](_0x5e2509['blockDuration'],_0x3e37('0x19'))>moment()){return _0x563c98(null,![],{'message':_0x3e37('0x17')});}else{return utils[_0x3e37('0x1a')](_0x435f3f,0x0,![],null)[_0x3e37('0xd')](function(){return utils[_0x3e37('0x1b')](_0x435f3f);})['then'](function(){return _0x563c98(null,_0x435f3f);});}}else{return _0x563c98(null,![],{'message':_0x3e37('0x17')});}}else{return utils[_0x3e37('0x1a')](_0x435f3f,0x0,![],null)[_0x3e37('0xd')](function(){return utils[_0x3e37('0x1b')](_0x435f3f);})['then'](function(){return _0x563c98(null,_0x435f3f);})[_0x3e37('0x1c')](function(_0x40672c){return _0x563c98(null,![],_0x40672c);});}}else{if(_0x435f3f['blocked']){return _0x563c98(null,![],{'message':_0x3e37('0x17')});}else{return utils[_0x3e37('0x1b')](_0x435f3f)[_0x3e37('0xd')](function(){return _0x563c98(null,_0x435f3f);});}}}});})[_0x3e37('0x1c')](function(_0x1248fc){return _0x563c98(null,![],_0x1248fc);});}function sendServiceMail(_0x72679d){return db[_0x3e37('0x1d')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x3e37('0x1e')],'include':[{'model':db[_0x3e37('0x1f')],'as':_0x3e37('0x20')}]})[_0x3e37('0xd')](function(_0x37838a){if(!_0x37838a){throw new Error(_0x3e37('0x21'));}var _0x12b7b5={'tls':{'rejectUnauthorized':![]}};if(_0x37838a['Smtp'][_0x3e37('0x22')]){_0x12b7b5['service']=_0x37838a[_0x3e37('0x20')][_0x3e37('0x22')];}else{_0x12b7b5[_0x3e37('0x23')]=_0x37838a[_0x3e37('0x20')]['host'];_0x12b7b5[_0x3e37('0x24')]=_0x37838a['Smtp'][_0x3e37('0x24')];_0x12b7b5['secure']=_0x37838a[_0x3e37('0x20')][_0x3e37('0x25')];}if(_0x37838a[_0x3e37('0x20')][_0x3e37('0x26')]){_0x12b7b5[_0x3e37('0x27')]={'user':_0x37838a[_0x3e37('0x20')]['user'],'pass':_0x37838a[_0x3e37('0x20')][_0x3e37('0x28')]};}var _0x4e0f11={'account':_0x12b7b5,'message':_[_0x3e37('0x29')]({'from':util[_0x3e37('0x2a')](_0x3e37('0x2b'),_0x37838a[_0x3e37('0xf')],_0x37838a[_0x3e37('0x1e')]||_0x37838a['Smtp'][_0x3e37('0x2c')])},_0x72679d)};return client[_0x3e37('0x2d')](_0x3e37('0x2e'),_0x4e0f11);})[_0x3e37('0xd')](function(_0x237514){if(_0x237514[_0x3e37('0x2f')]){throw new Error(util[_0x3e37('0x2a')](_0x3e37('0x30'),_0x237514['error'][_0x3e37('0x31')]||JSON[_0x3e37('0x32')](_0x237514[_0x3e37('0x2f')])));}return!![];});}function handleError(_0x1eb021,_0x2b8615,_0x52b31b){return _0x1eb021['status'](_0x2b8615||0x1f4)[_0x3e37('0x33')]({'message':_0x52b31b?_0x52b31b[_0x3e37('0x31')]||_0x52b31b:''});}exports[_0x3e37('0x34')]=function(_0x249c1c,_0x207bf0,_0x537d86){passport['authenticate'](_0x3e37('0x35'),function(_0x56a0ff,_0x9682a2,_0x411167){var _0x251009=_0x56a0ff||_0x411167;if(_0x251009){return handleError(_0x207bf0,0x191,_0x251009);}if(!_0x9682a2){return handleError(_0x207bf0,0x194,{'message':_0x3e37('0x36')});}else{var _0x25e07f={'payload':{'id':_0x9682a2['id'],'role':_0x9682a2[_0x3e37('0x37')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x25e07f)['then'](function(_0x49e9b3){_0x207bf0[_0x3e37('0x38')]({'id':_0x9682a2['id'],'token':_0x49e9b3,'statusCall':'','isAlreadyLogged':_0x9682a2['online']});});}})(_0x249c1c,_0x207bf0,_0x537d86);};exports[_0x3e37('0x39')]=function(_0x1da211,_0x5ec0f5,_0x3e7981){if(!_0x1da211[_0x3e37('0x3a')][_0x3e37('0x1e')]){return handleError(_0x5ec0f5,0x1f4,{'message':_0x3e37('0x3b')});}var _0x171e1b=rs[_0x3e37('0x3c')]();_0x1da211[_0x3e37('0x3a')]['email']=_0x1da211[_0x3e37('0x3a')][_0x3e37('0x1e')][_0x3e37('0x3d')]()['toLowerCase']();var _0x457bd6;return db[_0x3e37('0xa')][_0x3e37('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x3e37('0xc')],'raw':!![]})[_0x3e37('0xd')](function(_0x1374ba){_0x457bd6=_0x1374ba;return db[_0x3e37('0x3e')][_0x3e37('0x3f')]({'where':{'email':_0x1da211[_0x3e37('0x3a')][_0x3e37('0x1e')]}});})[_0x3e37('0xd')](function(_0xbbd927){if(!_0xbbd927){throw new Error(_0x3e37('0x40'));}if(_0xbbd927[_0x3e37('0x11')]){throw new Error(_0x3e37('0x41'));}if(_0xbbd927['blocked']){if(moment(_0xbbd927[_0x3e37('0x13')])[_0x3e37('0x18')](_0x457bd6[_0x3e37('0xc')],_0x3e37('0x19'))>moment()){throw new Error(_0x3e37('0x42'));}else{_0xbbd927[_0x3e37('0x12')]=![];_0xbbd927[_0x3e37('0x13')]=null;}}_0xbbd927[_0x3e37('0x43')]=_0x171e1b;_0xbbd927['resetPasswordExpires']=Date[_0x3e37('0x44')]()+0x36ee80;return _0xbbd927['save']();})['then'](function(){return sendServiceMail({'to':_0x1da211[_0x3e37('0x3a')][_0x3e37('0x1e')],'subject':_0x3e37('0x45'),'text':_0x3e37('0x46')+_0x3e37('0x47')+'https://'+_0x1da211['headers']['host']+'/reset/'+_0x171e1b+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x3e37('0xd')](function(){_0x5ec0f5['status'](0xc8)[_0x3e37('0x33')]({'message':_0x3e37('0x48')});})[_0x3e37('0x1c')](function(_0x22084e){return handleError(_0x5ec0f5,0x1f4,_0x22084e);});};exports[_0x3e37('0x49')]=function(_0x44dcf9,_0x2041ab,_0x51ac67){return db[_0x3e37('0x3e')][_0x3e37('0x3f')]({'where':{'resetPasswordToken':_0x44dcf9['params'][_0x3e37('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x3e37('0x44')]()}}})[_0x3e37('0xd')](function(_0x5eed9f){if(!_0x5eed9f){throw new Error(_0x3e37('0x4b'));}return db[_0x3e37('0xa')][_0x3e37('0xe')]({'attributes':['id',_0x3e37('0x4c'),'enforcePasswordHistory',_0x3e37('0x4d')]})[_0x3e37('0xd')](function(_0x1bb2be){if(_0x1bb2be[_0x3e37('0x4c')])authService['validatePasswordPattern'](_0x44dcf9[_0x3e37('0x3a')][_0x3e37('0x4e')]);if(!_0x1bb2be['enforcePasswordHistory']||!_0x5eed9f['previousPasswords'])return _0x5eed9f;authService[_0x3e37('0x4f')](_0x44dcf9[_0x3e37('0x3a')]['password'],_0x5eed9f[_0x3e37('0x50')],_0x1bb2be[_0x3e37('0x4d')]);return _0x5eed9f;})[_0x3e37('0xd')](function(){_0x5eed9f[_0x3e37('0x4e')]=_0x44dcf9['body'][_0x3e37('0x4e')];_0x5eed9f[_0x3e37('0x43')]=null;_0x5eed9f[_0x3e37('0x51')]=null;return _0x5eed9f[_0x3e37('0x52')]();});})[_0x3e37('0xd')](function(){_0x2041ab['status'](0xc8)[_0x3e37('0x33')]({'message':_0x3e37('0x53')});})[_0x3e37('0x1c')](function(_0x18d7ec){return handleError(_0x2041ab,0x1f4,_0x18d7ec);});};passport[_0x3e37('0x54')](new LocalStrategy({'usernameField':_0x3e37('0xf'),'passwordField':'password'},function(_0x495862,_0x334a48,_0x2b4c9a){return localAuthenticate(db['User'],_0x495862,_0x334a48,_0x2b4c9a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a2c33c4..53fa769 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 _0x5dbb=['exports','Router','login','post','/forgot','forgot','/reset/:token','reset'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x5dbb,0x79));var _0xb5db=function(_0x220a4e,_0x36a2cd){_0x220a4e=_0x220a4e-0x0;var _0x2cd728=_0x5dbb[_0x220a4e];return _0x2cd728;};'use strict';var express=require('express');var router=express[_0xb5db('0x0')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xb5db('0x1')]);router[_0xb5db('0x2')](_0xb5db('0x3'),controller[_0xb5db('0x4')]);router[_0xb5db('0x2')](_0xb5db('0x5'),controller[_0xb5db('0x6')]);module[_0xb5db('0x7')]=router; \ No newline at end of file +var _0x81ee=['login','post','/forgot','forgot','/reset/:token','reset','exports','express','./authLocal.controller'];(function(_0x2be23f,_0xd6c424){var _0x546c11=function(_0x2c98a1){while(--_0x2c98a1){_0x2be23f['push'](_0x2be23f['shift']());}};_0x546c11(++_0xd6c424);}(_0x81ee,0x178));var _0xe81e=function(_0x11d1f3,_0x450ef1){_0x11d1f3=_0x11d1f3-0x0;var _0x293c7b=_0x81ee[_0x11d1f3];return _0x293c7b;};'use strict';var express=require(_0xe81e('0x0'));var router=express['Router']();var controller=require(_0xe81e('0x1'));router['post']('/',controller[_0xe81e('0x2')]);router[_0xe81e('0x3')](_0xe81e('0x4'),controller[_0xe81e('0x5')]);router[_0xe81e('0x3')](_0xe81e('0x6'),controller[_0xe81e('0x7')]);module[_0xe81e('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 836aa55..51f47b2 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 _0x6cc4=['STRING','INTEGER','sequelize','exports'];(function(_0x46261b,_0xd68542){var _0x31e36f=function(_0xf5ed2b){while(--_0xf5ed2b){_0x46261b['push'](_0x46261b['shift']());}};_0x31e36f(++_0xd68542);}(_0x6cc4,0x76));var _0x46cc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6cc4[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x46cc('0x0'));module[_0x46cc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x46cc('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x46cc('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x28d7=['INTEGER','sequelize','exports','STRING'];(function(_0xcc6b49,_0x4bcf17){var _0x2d3559=function(_0x4f0f40){while(--_0x4f0f40){_0xcc6b49['push'](_0xcc6b49['shift']());}};_0x2d3559(++_0x4bcf17);}(_0x28d7,0xf5));var _0x728d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28d7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x728d('0x0'));module[_0x728d('0x1')]={'name':{'type':Sequelize[_0x728d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x728d('0x2')]},'description':{'type':Sequelize[_0x728d('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x728d('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index a80f2b3..270e528 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 _0x8258=['pick','filter','VIRTUAL','merge','Automation','includeAll','include','rows','catch','show','params','options','find','create','body','update','ids','omit','getConditions','findOne','Condition','hasOwnProperty','nolimit','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where'];(function(_0x360739,_0x2ec1b2){var _0x3e23a1=function(_0x105b37){while(--_0x105b37){_0x360739['push'](_0x360739['shift']());}};_0x3e23a1(++_0x2ec1b2);}(_0x8258,0x116));var _0x8825=function(_0x180f6e,_0x1d7c5c){_0x180f6e=_0x180f6e-0x0;var _0x537fd2=_0x8258[_0x180f6e];return _0x537fd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8825('0x0'));var zipdir=require(_0x8825('0x1'));var jsonpatch=require(_0x8825('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8825('0x3'));var util=require(_0x8825('0x4'));var path=require(_0x8825('0x5'));var sox=require(_0x8825('0x6'));var csv=require(_0x8825('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8825('0x8'));var _=require('lodash');var squel=require(_0x8825('0x9'));var crypto=require(_0x8825('0xa'));var jsforce=require(_0x8825('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8825('0xc'));var Papa=require('papaparse');var Redis=require(_0x8825('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8825('0xe'));var as=require(_0x8825('0xf'));var hardwareService=require(_0x8825('0x10'));var logger=require(_0x8825('0x11'))('api');var utils=require(_0x8825('0x12'));var config=require(_0x8825('0x13'));var licenseUtil=require(_0x8825('0x14'));var db=require(_0x8825('0x15'))['db'];function respondWithStatusCode(_0x193699,_0xea9fed){_0xea9fed=_0xea9fed||0xcc;return function(_0x346a72){if(_0x346a72){return _0x193699[_0x8825('0x16')](_0xea9fed);}return _0x193699['status'](_0xea9fed)[_0x8825('0x17')]();};}function respondWithResult(_0x39388b,_0x556e00){_0x556e00=_0x556e00||0xc8;return function(_0x1ea8e8){if(_0x1ea8e8){return _0x39388b[_0x8825('0x18')](_0x556e00)[_0x8825('0x19')](_0x1ea8e8);}};}function respondWithFilteredResult(_0x5cd4e5,_0x2ce500){return function(_0xc626dd){if(_0xc626dd){var _0x4f059f=typeof _0x2ce500[_0x8825('0x1a')]===_0x8825('0x1b')&&typeof _0x2ce500[_0x8825('0x1c')]===_0x8825('0x1b');var _0x49a3d4=_0xc626dd['count'];var _0x3d0ca8=_0x4f059f?0x0:_0x2ce500[_0x8825('0x1a')];var _0x510088=_0x4f059f?_0xc626dd[_0x8825('0x1d')]:_0x2ce500[_0x8825('0x1a')]+_0x2ce500[_0x8825('0x1c')];var _0x36b34f;if(_0x510088>=_0x49a3d4){_0x510088=_0x49a3d4;_0x36b34f=0xc8;}else{_0x36b34f=0xce;}_0x5cd4e5['status'](_0x36b34f);return _0x5cd4e5[_0x8825('0x1e')](_0x8825('0x1f'),_0x3d0ca8+'-'+_0x510088+'/'+_0x49a3d4)[_0x8825('0x19')](_0xc626dd);}return null;};}function patchUpdates(_0x420034){return function(_0x241136){try{jsonpatch[_0x8825('0x20')](_0x241136,_0x420034,!![]);}catch(_0x5026af){return BPromise[_0x8825('0x21')](_0x5026af);}return _0x241136[_0x8825('0x22')]();};}function saveUpdates(_0x192adc,_0x4ef125){return function(_0x17ab81){if(_0x17ab81){return _0x17ab81['update'](_0x192adc)['then'](function(_0x7f07c1){return _0x7f07c1;});}return null;};}function removeEntity(_0x4b3958,_0x15ff6f){return function(_0x11f872){if(_0x11f872){return _0x11f872[_0x8825('0x23')]()[_0x8825('0x24')](function(){_0x4b3958[_0x8825('0x18')](0xcc)[_0x8825('0x17')]();});}};}function handleEntityNotFound(_0x49129a,_0x5a4c34){return function(_0x21cb07){if(!_0x21cb07){_0x49129a[_0x8825('0x16')](0x194);}return _0x21cb07;};}function handleError(_0x469ce4,_0x5893fe){_0x5893fe=_0x5893fe||0x1f4;return function(_0x3bf736){logger[_0x8825('0x25')](_0x3bf736[_0x8825('0x26')]);if(_0x3bf736['name']){delete _0x3bf736['name'];}_0x469ce4[_0x8825('0x18')](_0x5893fe)[_0x8825('0x27')](_0x3bf736);};}exports[_0x8825('0x28')]=function(_0x448266,_0x34db37){var _0xa52a04={},_0x735fee={},_0x3e8d27={'count':0x0,'rows':[]};var _0xf8331c=_[_0x8825('0x29')](db['Automation'][_0x8825('0x2a')],function(_0x3a0eea){return{'name':_0x3a0eea[_0x8825('0x2b')],'type':_0x3a0eea[_0x8825('0x2c')][_0x8825('0x2d')]};});_0x735fee['model']=_[_0x8825('0x29')](_0xf8331c,_0x8825('0x2e'));_0x735fee[_0x8825('0x2f')]=_[_0x8825('0x30')](_0x448266[_0x8825('0x2f')]);_0x735fee[_0x8825('0x31')]=_[_0x8825('0x32')](_0x735fee[_0x8825('0x33')],_0x735fee[_0x8825('0x2f')]);_0xa52a04['attributes']=_[_0x8825('0x32')](_0x735fee[_0x8825('0x33')],qs[_0x8825('0x34')](_0x448266['query'][_0x8825('0x34')]));_0xa52a04['attributes']=_0xa52a04[_0x8825('0x35')][_0x8825('0x36')]?_0xa52a04[_0x8825('0x35')]:_0x735fee[_0x8825('0x33')];if(!_0x448266[_0x8825('0x2f')]['hasOwnProperty']('nolimit')){_0xa52a04[_0x8825('0x1c')]=qs[_0x8825('0x1c')](_0x448266[_0x8825('0x2f')]['limit']);_0xa52a04[_0x8825('0x1a')]=qs[_0x8825('0x1a')](_0x448266['query'][_0x8825('0x1a')]);}_0xa52a04[_0x8825('0x37')]=qs['sort'](_0x448266[_0x8825('0x2f')][_0x8825('0x38')]);_0xa52a04[_0x8825('0x39')]=qs[_0x8825('0x31')](_[_0x8825('0x3a')](_0x448266['query'],_0x735fee[_0x8825('0x31')]),_0xf8331c);if(_0x448266['query'][_0x8825('0x3b')]){_0xa52a04[_0x8825('0x39')]=_['merge'](_0xa52a04['where'],{'$or':_[_0x8825('0x29')](_0xf8331c,function(_0x5c8851){if(_0x5c8851['type']!==_0x8825('0x3c')){var _0x50d837={};_0x50d837[_0x5c8851['name']]={'$like':'%'+_0x448266[_0x8825('0x2f')][_0x8825('0x3b')]+'%'};return _0x50d837;}})});}_0xa52a04=_[_0x8825('0x3d')]({},_0xa52a04,_0x448266['options']);var _0x255334={'where':_0xa52a04['where']};return db[_0x8825('0x3e')][_0x8825('0x1d')](_0x255334)[_0x8825('0x24')](function(_0x2f3ec7){_0x3e8d27[_0x8825('0x1d')]=_0x2f3ec7;if(_0x448266['query'][_0x8825('0x3f')]){_0xa52a04[_0x8825('0x40')]=[{'all':!![]}];}return db['Automation']['findAll'](_0xa52a04);})[_0x8825('0x24')](function(_0x4ee18b){_0x3e8d27[_0x8825('0x41')]=_0x4ee18b;return _0x3e8d27;})['then'](respondWithFilteredResult(_0x34db37,_0xa52a04))[_0x8825('0x42')](handleError(_0x34db37,null));};exports[_0x8825('0x43')]=function(_0xfa57bc,_0x6e8de3){var _0x981df5={'raw':![],'where':{'id':_0xfa57bc[_0x8825('0x44')]['id']}},_0x4bffd6={};_0x4bffd6['model']=_[_0x8825('0x30')](db[_0x8825('0x3e')][_0x8825('0x2a')]);_0x4bffd6[_0x8825('0x2f')]=_[_0x8825('0x30')](_0xfa57bc[_0x8825('0x2f')]);_0x4bffd6['filters']=_[_0x8825('0x32')](_0x4bffd6[_0x8825('0x33')],_0x4bffd6[_0x8825('0x2f')]);_0x981df5[_0x8825('0x35')]=_[_0x8825('0x32')](_0x4bffd6[_0x8825('0x33')],qs['fields'](_0xfa57bc[_0x8825('0x2f')][_0x8825('0x34')]));_0x981df5[_0x8825('0x35')]=_0x981df5[_0x8825('0x35')]['length']?_0x981df5['attributes']:_0x4bffd6[_0x8825('0x33')];if(_0xfa57bc[_0x8825('0x2f')][_0x8825('0x3f')]){_0x981df5[_0x8825('0x40')]=[{'all':!![]}];}_0x981df5=_[_0x8825('0x3d')]({},_0x981df5,_0xfa57bc[_0x8825('0x45')]);return db[_0x8825('0x3e')][_0x8825('0x46')](_0x981df5)['then'](handleEntityNotFound(_0x6e8de3,null))['then'](respondWithResult(_0x6e8de3,null))[_0x8825('0x42')](handleError(_0x6e8de3,null));};exports[_0x8825('0x47')]=function(_0x55dbfe,_0x5e999a){return db[_0x8825('0x3e')][_0x8825('0x47')](_0x55dbfe[_0x8825('0x48')],{})[_0x8825('0x24')](respondWithResult(_0x5e999a,0xc9))[_0x8825('0x42')](handleError(_0x5e999a,null));};exports[_0x8825('0x49')]=function(_0x2bef34,_0x4fa701){if(_0x2bef34[_0x8825('0x48')]['id']){delete _0x2bef34[_0x8825('0x48')]['id'];}return db[_0x8825('0x3e')][_0x8825('0x46')]({'where':{'id':_0x2bef34[_0x8825('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fa701,null))[_0x8825('0x24')](saveUpdates(_0x2bef34['body'],null))[_0x8825('0x24')](respondWithResult(_0x4fa701,null))[_0x8825('0x42')](handleError(_0x4fa701,null));};exports[_0x8825('0x23')]=function(_0x5178b5,_0xd361af){return db['Automation'][_0x8825('0x46')]({'where':{'id':_0x5178b5['params']['id']}})[_0x8825('0x24')](handleEntityNotFound(_0xd361af,null))[_0x8825('0x24')](removeEntity(_0xd361af,null))[_0x8825('0x42')](handleError(_0xd361af,null));};exports['addConditions']=function(_0x44293c,_0x5831b1,_0x5e6754){return db['Condition'][_0x8825('0x46')]({'where':{'id':_0x44293c[_0x8825('0x44')]['id']}})[_0x8825('0x24')](handleEntityNotFound(_0x5831b1,null))[_0x8825('0x24')](function(_0xa369d7){if(_0xa369d7){return _0xa369d7['addConditions'](_0x44293c['body'][_0x8825('0x4a')],_[_0x8825('0x4b')](_0x44293c[_0x8825('0x48')],[_0x8825('0x4a'),'id'])||{});}})[_0x8825('0x24')](respondWithResult(_0x5831b1,null))['catch'](handleError(_0x5831b1,null));};exports[_0x8825('0x4c')]=function(_0x407d1a,_0x4e8a72,_0xe408ff){var _0x33ba2c={};var _0x16c296={};var _0x51d8c5;var _0x3e6346;return db[_0x8825('0x3e')][_0x8825('0x4d')]({'where':{'id':_0x407d1a[_0x8825('0x44')]['id']}})[_0x8825('0x24')](handleEntityNotFound(_0x4e8a72,null))[_0x8825('0x24')](function(_0x5a3433){if(_0x5a3433){_0x51d8c5=_0x5a3433;_0x16c296['model']=_[_0x8825('0x30')](db[_0x8825('0x4e')]['rawAttributes']);_0x16c296['query']=_['keys'](_0x407d1a[_0x8825('0x2f')]);_0x16c296[_0x8825('0x31')]=_[_0x8825('0x32')](_0x16c296['model'],_0x16c296[_0x8825('0x2f')]);_0x33ba2c[_0x8825('0x35')]=_[_0x8825('0x32')](_0x16c296[_0x8825('0x33')],qs[_0x8825('0x34')](_0x407d1a[_0x8825('0x2f')][_0x8825('0x34')]));_0x33ba2c[_0x8825('0x35')]=_0x33ba2c['attributes'][_0x8825('0x36')]?_0x33ba2c[_0x8825('0x35')]:_0x16c296[_0x8825('0x33')];_0x33ba2c[_0x8825('0x37')]=qs[_0x8825('0x38')](_0x407d1a[_0x8825('0x2f')][_0x8825('0x38')]);_0x33ba2c[_0x8825('0x39')]=qs[_0x8825('0x31')](_['pick'](_0x407d1a[_0x8825('0x2f')],_0x16c296[_0x8825('0x31')]));if(_0x407d1a[_0x8825('0x2f')][_0x8825('0x3b')]){_0x33ba2c[_0x8825('0x39')]=_[_0x8825('0x3d')](_0x33ba2c[_0x8825('0x39')],{'$or':_['map'](_0x33ba2c['attributes'],function(_0x44e0bb){var _0x4679ce={};_0x4679ce[_0x44e0bb]={'$like':'%'+_0x407d1a[_0x8825('0x2f')][_0x8825('0x3b')]+'%'};return _0x4679ce;})});}_0x33ba2c=_[_0x8825('0x3d')]({},_0x33ba2c,_0x407d1a['options']);return _0x51d8c5[_0x8825('0x4c')](_0x33ba2c);}})[_0x8825('0x24')](function(_0xde26ae){if(_0xde26ae){_0x3e6346=_0xde26ae[_0x8825('0x36')];if(!_0x407d1a['query'][_0x8825('0x4f')](_0x8825('0x50'))){_0x33ba2c['limit']=qs[_0x8825('0x1c')](_0x407d1a['query'][_0x8825('0x1c')]);_0x33ba2c[_0x8825('0x1a')]=qs[_0x8825('0x1a')](_0x407d1a[_0x8825('0x2f')]['offset']);}return _0x51d8c5['getConditions'](_0x33ba2c);}})[_0x8825('0x24')](function(_0x384597){if(_0x384597){return _0x384597?{'count':_0x3e6346,'rows':_0x384597}:null;}})[_0x8825('0x24')](respondWithResult(_0x4e8a72,null))[_0x8825('0x42')](handleError(_0x4e8a72,null));};exports[_0x8825('0x51')]=function(_0x568163,_0x5379be,_0x58a14b){return db['Action'][_0x8825('0x46')]({'where':{'id':_0x568163['params']['id']}})['then'](handleEntityNotFound(_0x5379be,null))[_0x8825('0x24')](function(_0x567f94){if(_0x567f94){return _0x567f94['addActions'](_0x568163[_0x8825('0x48')][_0x8825('0x4a')],_['omit'](_0x568163[_0x8825('0x48')],[_0x8825('0x4a'),'id'])||{});}})[_0x8825('0x24')](respondWithResult(_0x5379be,null))[_0x8825('0x42')](handleError(_0x5379be,null));};exports['getActions']=function(_0x1d0560,_0x1c2ead,_0x1311b1){var _0x17b85f={};var _0x59453f={};var _0xd1cbe8;var _0x112c7f;return db[_0x8825('0x3e')]['findOne']({'where':{'id':_0x1d0560[_0x8825('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c2ead,null))[_0x8825('0x24')](function(_0x5c9800){if(_0x5c9800){_0xd1cbe8=_0x5c9800;_0x59453f[_0x8825('0x33')]=_['keys'](db[_0x8825('0x52')][_0x8825('0x2a')]);_0x59453f[_0x8825('0x2f')]=_[_0x8825('0x30')](_0x1d0560[_0x8825('0x2f')]);_0x59453f[_0x8825('0x31')]=_[_0x8825('0x32')](_0x59453f[_0x8825('0x33')],_0x59453f[_0x8825('0x2f')]);_0x17b85f[_0x8825('0x35')]=_['intersection'](_0x59453f[_0x8825('0x33')],qs[_0x8825('0x34')](_0x1d0560[_0x8825('0x2f')][_0x8825('0x34')]));_0x17b85f[_0x8825('0x35')]=_0x17b85f[_0x8825('0x35')][_0x8825('0x36')]?_0x17b85f[_0x8825('0x35')]:_0x59453f[_0x8825('0x33')];_0x17b85f['order']=qs[_0x8825('0x38')](_0x1d0560[_0x8825('0x2f')]['sort']);_0x17b85f[_0x8825('0x39')]=qs[_0x8825('0x31')](_['pick'](_0x1d0560[_0x8825('0x2f')],_0x59453f[_0x8825('0x31')]));if(_0x1d0560[_0x8825('0x2f')]['filter']){_0x17b85f[_0x8825('0x39')]=_[_0x8825('0x3d')](_0x17b85f[_0x8825('0x39')],{'$or':_[_0x8825('0x29')](_0x17b85f[_0x8825('0x35')],function(_0xdfae4f){var _0x5232ef={};_0x5232ef[_0xdfae4f]={'$like':'%'+_0x1d0560['query'][_0x8825('0x3b')]+'%'};return _0x5232ef;})});}_0x17b85f=_['merge']({},_0x17b85f,_0x1d0560[_0x8825('0x45')]);return _0xd1cbe8[_0x8825('0x53')](_0x17b85f);}})[_0x8825('0x24')](function(_0x29089d){if(_0x29089d){_0x112c7f=_0x29089d[_0x8825('0x36')];if(!_0x1d0560[_0x8825('0x2f')]['hasOwnProperty'](_0x8825('0x50'))){_0x17b85f[_0x8825('0x1c')]=qs[_0x8825('0x1c')](_0x1d0560[_0x8825('0x2f')][_0x8825('0x1c')]);_0x17b85f[_0x8825('0x1a')]=qs['offset'](_0x1d0560[_0x8825('0x2f')][_0x8825('0x1a')]);}return _0xd1cbe8[_0x8825('0x53')](_0x17b85f);}})[_0x8825('0x24')](function(_0x3c7a0d){if(_0x3c7a0d){return _0x3c7a0d?{'count':_0x112c7f,'rows':_0x3c7a0d}:null;}})[_0x8825('0x24')](respondWithResult(_0x1c2ead,null))[_0x8825('0x42')](handleError(_0x1c2ead,null));}; \ No newline at end of file +var _0x2e5f=['apply','reject','update','then','error','stack','name','send','index','Automation','rawAttributes','key','map','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','options','catch','create','body','find','destroy','Condition','addConditions','omit','ids','getConditions','findOne','order','addActions','Action','getActions','eml-format','rimraf','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x254b7a,_0x14e81d){var _0x439ad2=function(_0x2fccc2){while(--_0x2fccc2){_0x254b7a['push'](_0x254b7a['shift']());}};_0x439ad2(++_0x14e81d);}(_0x2e5f,0x125));var _0xf2e5=function(_0x414217,_0x896d01){_0x414217=_0x414217-0x0;var _0x2794d3=_0x2e5f[_0x414217];return _0x2794d3;};'use strict';var emlformat=require(_0xf2e5('0x0'));var rimraf=require(_0xf2e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf2e5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf2e5('0x3'));var sox=require(_0xf2e5('0x4'));var csv=require(_0xf2e5('0x5'));var ejs=require(_0xf2e5('0x6'));var fs=require('fs');var fs_extra=require(_0xf2e5('0x7'));var _=require(_0xf2e5('0x8'));var squel=require(_0xf2e5('0x9'));var crypto=require(_0xf2e5('0xa'));var jsforce=require(_0xf2e5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf2e5('0x5'));var querystring=require(_0xf2e5('0xc'));var Papa=require(_0xf2e5('0xd'));var Redis=require(_0xf2e5('0xe'));var authService=require(_0xf2e5('0xf'));var qs=require(_0xf2e5('0x10'));var as=require(_0xf2e5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2e5('0x12'))(_0xf2e5('0x13'));var utils=require('../../config/utils');var config=require(_0xf2e5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2e5('0x15'))['db'];function respondWithStatusCode(_0x1ead9b,_0x1ec48c){_0x1ec48c=_0x1ec48c||0xcc;return function(_0x52c6a2){if(_0x52c6a2){return _0x1ead9b[_0xf2e5('0x16')](_0x1ec48c);}return _0x1ead9b[_0xf2e5('0x17')](_0x1ec48c)[_0xf2e5('0x18')]();};}function respondWithResult(_0x3e23f6,_0x49adcc){_0x49adcc=_0x49adcc||0xc8;return function(_0x8f64ae){if(_0x8f64ae){return _0x3e23f6[_0xf2e5('0x17')](_0x49adcc)['json'](_0x8f64ae);}};}function respondWithFilteredResult(_0x15fd45,_0x111c54){return function(_0x3d31dc){if(_0x3d31dc){var _0x16a863=typeof _0x111c54[_0xf2e5('0x19')]===_0xf2e5('0x1a')&&typeof _0x111c54[_0xf2e5('0x1b')]===_0xf2e5('0x1a');var _0x34887b=_0x3d31dc[_0xf2e5('0x1c')];var _0x41c0cc=_0x16a863?0x0:_0x111c54[_0xf2e5('0x19')];var _0xa04436=_0x16a863?_0x3d31dc[_0xf2e5('0x1c')]:_0x111c54['offset']+_0x111c54['limit'];var _0x122f17;if(_0xa04436>=_0x34887b){_0xa04436=_0x34887b;_0x122f17=0xc8;}else{_0x122f17=0xce;}_0x15fd45[_0xf2e5('0x17')](_0x122f17);return _0x15fd45[_0xf2e5('0x1d')](_0xf2e5('0x1e'),_0x41c0cc+'-'+_0xa04436+'/'+_0x34887b)['json'](_0x3d31dc);}return null;};}function patchUpdates(_0x21de3b){return function(_0xb86eed){try{jsonpatch[_0xf2e5('0x1f')](_0xb86eed,_0x21de3b,!![]);}catch(_0x25417a){return BPromise[_0xf2e5('0x20')](_0x25417a);}return _0xb86eed['save']();};}function saveUpdates(_0x348ecd,_0x49d9bc){return function(_0x55586b){if(_0x55586b){return _0x55586b[_0xf2e5('0x21')](_0x348ecd)[_0xf2e5('0x22')](function(_0x14ec7c){return _0x14ec7c;});}return null;};}function removeEntity(_0x4d2cba,_0x324fc4){return function(_0x376bc8){if(_0x376bc8){return _0x376bc8['destroy']()[_0xf2e5('0x22')](function(){_0x4d2cba[_0xf2e5('0x17')](0xcc)[_0xf2e5('0x18')]();});}};}function handleEntityNotFound(_0x23c863,_0x51baeb){return function(_0x19299b){if(!_0x19299b){_0x23c863['sendStatus'](0x194);}return _0x19299b;};}function handleError(_0x5b7467,_0x4a8b3d){_0x4a8b3d=_0x4a8b3d||0x1f4;return function(_0x3acc1f){logger[_0xf2e5('0x23')](_0x3acc1f[_0xf2e5('0x24')]);if(_0x3acc1f['name']){delete _0x3acc1f[_0xf2e5('0x25')];}_0x5b7467[_0xf2e5('0x17')](_0x4a8b3d)[_0xf2e5('0x26')](_0x3acc1f);};}exports[_0xf2e5('0x27')]=function(_0x5da3e7,_0x2e1873){var _0x4e678c={},_0x3e2339={},_0x14c3b5={'count':0x0,'rows':[]};var _0x34c814=_['map'](db[_0xf2e5('0x28')][_0xf2e5('0x29')],function(_0x1fea6e){return{'name':_0x1fea6e['fieldName'],'type':_0x1fea6e['type'][_0xf2e5('0x2a')]};});_0x3e2339['model']=_[_0xf2e5('0x2b')](_0x34c814,_0xf2e5('0x25'));_0x3e2339['query']=_[_0xf2e5('0x2c')](_0x5da3e7['query']);_0x3e2339[_0xf2e5('0x2d')]=_['intersection'](_0x3e2339[_0xf2e5('0x2e')],_0x3e2339[_0xf2e5('0x2f')]);_0x4e678c[_0xf2e5('0x30')]=_[_0xf2e5('0x31')](_0x3e2339['model'],qs[_0xf2e5('0x32')](_0x5da3e7['query'][_0xf2e5('0x32')]));_0x4e678c['attributes']=_0x4e678c[_0xf2e5('0x30')][_0xf2e5('0x33')]?_0x4e678c[_0xf2e5('0x30')]:_0x3e2339[_0xf2e5('0x2e')];if(!_0x5da3e7[_0xf2e5('0x2f')][_0xf2e5('0x34')](_0xf2e5('0x35'))){_0x4e678c['limit']=qs[_0xf2e5('0x1b')](_0x5da3e7[_0xf2e5('0x2f')][_0xf2e5('0x1b')]);_0x4e678c[_0xf2e5('0x19')]=qs[_0xf2e5('0x19')](_0x5da3e7[_0xf2e5('0x2f')]['offset']);}_0x4e678c['order']=qs[_0xf2e5('0x36')](_0x5da3e7[_0xf2e5('0x2f')]['sort']);_0x4e678c[_0xf2e5('0x37')]=qs['filters'](_[_0xf2e5('0x38')](_0x5da3e7[_0xf2e5('0x2f')],_0x3e2339[_0xf2e5('0x2d')]),_0x34c814);if(_0x5da3e7['query'][_0xf2e5('0x39')]){_0x4e678c[_0xf2e5('0x37')]=_[_0xf2e5('0x3a')](_0x4e678c[_0xf2e5('0x37')],{'$or':_[_0xf2e5('0x2b')](_0x34c814,function(_0x3f5038){if(_0x3f5038['type']!==_0xf2e5('0x3b')){var _0x36c6a7={};_0x36c6a7[_0x3f5038[_0xf2e5('0x25')]]={'$like':'%'+_0x5da3e7['query'][_0xf2e5('0x39')]+'%'};return _0x36c6a7;}})});}_0x4e678c=_[_0xf2e5('0x3a')]({},_0x4e678c,_0x5da3e7['options']);var _0x4c748a={'where':_0x4e678c[_0xf2e5('0x37')]};return db[_0xf2e5('0x28')]['count'](_0x4c748a)['then'](function(_0x69b943){_0x14c3b5[_0xf2e5('0x1c')]=_0x69b943;if(_0x5da3e7['query'][_0xf2e5('0x3c')]){_0x4e678c['include']=[{'all':!![]}];}return db[_0xf2e5('0x28')][_0xf2e5('0x3d')](_0x4e678c);})[_0xf2e5('0x22')](function(_0x5ce7d9){_0x14c3b5[_0xf2e5('0x3e')]=_0x5ce7d9;return _0x14c3b5;})['then'](respondWithFilteredResult(_0x2e1873,_0x4e678c))['catch'](handleError(_0x2e1873,null));};exports['show']=function(_0x314899,_0x49ec56){var _0x55a603={'raw':![],'where':{'id':_0x314899[_0xf2e5('0x3f')]['id']}},_0x14371f={};_0x14371f['model']=_[_0xf2e5('0x2c')](db[_0xf2e5('0x28')][_0xf2e5('0x29')]);_0x14371f[_0xf2e5('0x2f')]=_['keys'](_0x314899[_0xf2e5('0x2f')]);_0x14371f['filters']=_[_0xf2e5('0x31')](_0x14371f[_0xf2e5('0x2e')],_0x14371f[_0xf2e5('0x2f')]);_0x55a603['attributes']=_[_0xf2e5('0x31')](_0x14371f[_0xf2e5('0x2e')],qs[_0xf2e5('0x32')](_0x314899[_0xf2e5('0x2f')][_0xf2e5('0x32')]));_0x55a603['attributes']=_0x55a603[_0xf2e5('0x30')][_0xf2e5('0x33')]?_0x55a603[_0xf2e5('0x30')]:_0x14371f['model'];if(_0x314899['query']['includeAll']){_0x55a603[_0xf2e5('0x40')]=[{'all':!![]}];}_0x55a603=_[_0xf2e5('0x3a')]({},_0x55a603,_0x314899[_0xf2e5('0x41')]);return db[_0xf2e5('0x28')]['find'](_0x55a603)[_0xf2e5('0x22')](handleEntityNotFound(_0x49ec56,null))[_0xf2e5('0x22')](respondWithResult(_0x49ec56,null))[_0xf2e5('0x42')](handleError(_0x49ec56,null));};exports[_0xf2e5('0x43')]=function(_0x391709,_0x3e7098){return db[_0xf2e5('0x28')][_0xf2e5('0x43')](_0x391709[_0xf2e5('0x44')],{})[_0xf2e5('0x22')](respondWithResult(_0x3e7098,0xc9))[_0xf2e5('0x42')](handleError(_0x3e7098,null));};exports[_0xf2e5('0x21')]=function(_0x2c4cd5,_0x3432fb){if(_0x2c4cd5[_0xf2e5('0x44')]['id']){delete _0x2c4cd5[_0xf2e5('0x44')]['id'];}return db['Automation'][_0xf2e5('0x45')]({'where':{'id':_0x2c4cd5[_0xf2e5('0x3f')]['id']}})[_0xf2e5('0x22')](handleEntityNotFound(_0x3432fb,null))[_0xf2e5('0x22')](saveUpdates(_0x2c4cd5[_0xf2e5('0x44')],null))[_0xf2e5('0x22')](respondWithResult(_0x3432fb,null))[_0xf2e5('0x42')](handleError(_0x3432fb,null));};exports[_0xf2e5('0x46')]=function(_0x185df4,_0x473d90){return db[_0xf2e5('0x28')][_0xf2e5('0x45')]({'where':{'id':_0x185df4['params']['id']}})['then'](handleEntityNotFound(_0x473d90,null))['then'](removeEntity(_0x473d90,null))['catch'](handleError(_0x473d90,null));};exports['addConditions']=function(_0x224f93,_0x31531d,_0x1225f8){return db[_0xf2e5('0x47')]['find']({'where':{'id':_0x224f93[_0xf2e5('0x3f')]['id']}})[_0xf2e5('0x22')](handleEntityNotFound(_0x31531d,null))[_0xf2e5('0x22')](function(_0x50086e){if(_0x50086e){return _0x50086e[_0xf2e5('0x48')](_0x224f93[_0xf2e5('0x44')]['ids'],_[_0xf2e5('0x49')](_0x224f93['body'],[_0xf2e5('0x4a'),'id'])||{});}})[_0xf2e5('0x22')](respondWithResult(_0x31531d,null))['catch'](handleError(_0x31531d,null));};exports[_0xf2e5('0x4b')]=function(_0x1af53e,_0x229c16,_0x2b51a7){var _0x4e3449={};var _0x2ba5cb={};var _0x485c9b;var _0x4926b7;return db[_0xf2e5('0x28')][_0xf2e5('0x4c')]({'where':{'id':_0x1af53e[_0xf2e5('0x3f')]['id']}})[_0xf2e5('0x22')](handleEntityNotFound(_0x229c16,null))[_0xf2e5('0x22')](function(_0x20f95b){if(_0x20f95b){_0x485c9b=_0x20f95b;_0x2ba5cb['model']=_['keys'](db['Condition'][_0xf2e5('0x29')]);_0x2ba5cb[_0xf2e5('0x2f')]=_['keys'](_0x1af53e[_0xf2e5('0x2f')]);_0x2ba5cb[_0xf2e5('0x2d')]=_[_0xf2e5('0x31')](_0x2ba5cb[_0xf2e5('0x2e')],_0x2ba5cb[_0xf2e5('0x2f')]);_0x4e3449[_0xf2e5('0x30')]=_[_0xf2e5('0x31')](_0x2ba5cb[_0xf2e5('0x2e')],qs[_0xf2e5('0x32')](_0x1af53e[_0xf2e5('0x2f')]['fields']));_0x4e3449[_0xf2e5('0x30')]=_0x4e3449['attributes'][_0xf2e5('0x33')]?_0x4e3449['attributes']:_0x2ba5cb['model'];_0x4e3449[_0xf2e5('0x4d')]=qs[_0xf2e5('0x36')](_0x1af53e['query'][_0xf2e5('0x36')]);_0x4e3449[_0xf2e5('0x37')]=qs[_0xf2e5('0x2d')](_[_0xf2e5('0x38')](_0x1af53e[_0xf2e5('0x2f')],_0x2ba5cb[_0xf2e5('0x2d')]));if(_0x1af53e[_0xf2e5('0x2f')][_0xf2e5('0x39')]){_0x4e3449['where']=_[_0xf2e5('0x3a')](_0x4e3449[_0xf2e5('0x37')],{'$or':_['map'](_0x4e3449[_0xf2e5('0x30')],function(_0xfe4a8f){var _0x5065f5={};_0x5065f5[_0xfe4a8f]={'$like':'%'+_0x1af53e['query'][_0xf2e5('0x39')]+'%'};return _0x5065f5;})});}_0x4e3449=_[_0xf2e5('0x3a')]({},_0x4e3449,_0x1af53e[_0xf2e5('0x41')]);return _0x485c9b['getConditions'](_0x4e3449);}})[_0xf2e5('0x22')](function(_0x43ade4){if(_0x43ade4){_0x4926b7=_0x43ade4['length'];if(!_0x1af53e[_0xf2e5('0x2f')][_0xf2e5('0x34')]('nolimit')){_0x4e3449[_0xf2e5('0x1b')]=qs[_0xf2e5('0x1b')](_0x1af53e[_0xf2e5('0x2f')][_0xf2e5('0x1b')]);_0x4e3449[_0xf2e5('0x19')]=qs['offset'](_0x1af53e[_0xf2e5('0x2f')]['offset']);}return _0x485c9b['getConditions'](_0x4e3449);}})[_0xf2e5('0x22')](function(_0x2ef51a){if(_0x2ef51a){return _0x2ef51a?{'count':_0x4926b7,'rows':_0x2ef51a}:null;}})[_0xf2e5('0x22')](respondWithResult(_0x229c16,null))[_0xf2e5('0x42')](handleError(_0x229c16,null));};exports[_0xf2e5('0x4e')]=function(_0x5f4f6f,_0xa372c3,_0x41ae2b){return db[_0xf2e5('0x4f')][_0xf2e5('0x45')]({'where':{'id':_0x5f4f6f['params']['id']}})[_0xf2e5('0x22')](handleEntityNotFound(_0xa372c3,null))[_0xf2e5('0x22')](function(_0x3a651e){if(_0x3a651e){return _0x3a651e[_0xf2e5('0x4e')](_0x5f4f6f[_0xf2e5('0x44')][_0xf2e5('0x4a')],_[_0xf2e5('0x49')](_0x5f4f6f[_0xf2e5('0x44')],[_0xf2e5('0x4a'),'id'])||{});}})[_0xf2e5('0x22')](respondWithResult(_0xa372c3,null))[_0xf2e5('0x42')](handleError(_0xa372c3,null));};exports[_0xf2e5('0x50')]=function(_0xc0a210,_0x5d9362,_0x2126cb){var _0xab3907={};var _0x5b5c4a={};var _0x42a105;var _0x37566a;return db['Automation']['findOne']({'where':{'id':_0xc0a210[_0xf2e5('0x3f')]['id']}})[_0xf2e5('0x22')](handleEntityNotFound(_0x5d9362,null))[_0xf2e5('0x22')](function(_0x64622d){if(_0x64622d){_0x42a105=_0x64622d;_0x5b5c4a['model']=_['keys'](db[_0xf2e5('0x4f')][_0xf2e5('0x29')]);_0x5b5c4a[_0xf2e5('0x2f')]=_[_0xf2e5('0x2c')](_0xc0a210['query']);_0x5b5c4a[_0xf2e5('0x2d')]=_['intersection'](_0x5b5c4a[_0xf2e5('0x2e')],_0x5b5c4a['query']);_0xab3907[_0xf2e5('0x30')]=_['intersection'](_0x5b5c4a[_0xf2e5('0x2e')],qs['fields'](_0xc0a210[_0xf2e5('0x2f')][_0xf2e5('0x32')]));_0xab3907[_0xf2e5('0x30')]=_0xab3907[_0xf2e5('0x30')][_0xf2e5('0x33')]?_0xab3907['attributes']:_0x5b5c4a['model'];_0xab3907[_0xf2e5('0x4d')]=qs['sort'](_0xc0a210['query'][_0xf2e5('0x36')]);_0xab3907['where']=qs[_0xf2e5('0x2d')](_[_0xf2e5('0x38')](_0xc0a210[_0xf2e5('0x2f')],_0x5b5c4a[_0xf2e5('0x2d')]));if(_0xc0a210[_0xf2e5('0x2f')][_0xf2e5('0x39')]){_0xab3907[_0xf2e5('0x37')]=_[_0xf2e5('0x3a')](_0xab3907[_0xf2e5('0x37')],{'$or':_[_0xf2e5('0x2b')](_0xab3907[_0xf2e5('0x30')],function(_0x104291){var _0x1b1e8f={};_0x1b1e8f[_0x104291]={'$like':'%'+_0xc0a210[_0xf2e5('0x2f')][_0xf2e5('0x39')]+'%'};return _0x1b1e8f;})});}_0xab3907=_[_0xf2e5('0x3a')]({},_0xab3907,_0xc0a210[_0xf2e5('0x41')]);return _0x42a105['getActions'](_0xab3907);}})[_0xf2e5('0x22')](function(_0x4d5f99){if(_0x4d5f99){_0x37566a=_0x4d5f99['length'];if(!_0xc0a210[_0xf2e5('0x2f')][_0xf2e5('0x34')](_0xf2e5('0x35'))){_0xab3907['limit']=qs['limit'](_0xc0a210[_0xf2e5('0x2f')]['limit']);_0xab3907[_0xf2e5('0x19')]=qs[_0xf2e5('0x19')](_0xc0a210[_0xf2e5('0x2f')][_0xf2e5('0x19')]);}return _0x42a105[_0xf2e5('0x50')](_0xab3907);}})[_0xf2e5('0x22')](function(_0x44896d){if(_0x44896d){return _0x44896d?{'count':_0x37566a,'rows':_0x44896d}:null;}})[_0xf2e5('0x22')](respondWithResult(_0x5d9362,null))['catch'](handleError(_0x5d9362,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2148947..097bcd8 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 _0x332a=['tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x4866b5,_0x32eb3b){var _0x2d8227=function(_0x322e5){while(--_0x322e5){_0x4866b5['push'](_0x4866b5['shift']());}};_0x2d8227(++_0x32eb3b);}(_0x332a,0x197));var _0xa332=function(_0x308a4e,_0x5b6c19){_0x308a4e=_0x308a4e-0x0;var _0x7e11c4=_0x332a[_0x308a4e];return _0x7e11c4;};'use strict';var _=require(_0xa332('0x0'));var util=require(_0xa332('0x1'));var logger=require(_0xa332('0x2'))(_0xa332('0x3'));var moment=require(_0xa332('0x4'));var BPromise=require(_0xa332('0x5'));var rp=require(_0xa332('0x6'));var fs=require('fs');var path=require(_0xa332('0x7'));var rimraf=require('rimraf');var config=require(_0xa332('0x8'));var attributes=require(_0xa332('0x9'));module[_0xa332('0xa')]=function(_0x3a4a86,_0x1e48e2){return _0x3a4a86[_0xa332('0xb')](_0xa332('0xc'),attributes,{'tableName':_0xa332('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94f4=['Automation','tools_automations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x94f4,0xff));var _0x494f=function(_0x2f65e1,_0x4d7c5e){_0x2f65e1=_0x2f65e1-0x0;var _0x1eb661=_0x94f4[_0x2f65e1];return _0x1eb661;};'use strict';var _=require(_0x494f('0x0'));var util=require('util');var logger=require(_0x494f('0x1'))(_0x494f('0x2'));var moment=require(_0x494f('0x3'));var BPromise=require(_0x494f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x494f('0x5'));var rimraf=require(_0x494f('0x6'));var config=require(_0x494f('0x7'));var attributes=require(_0x494f('0x8'));module['exports']=function(_0x2745cf,_0x5aefd2){return _0x2745cf['define'](_0x494f('0x9'),attributes,{'tableName':_0x494f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index fb607ae..08a3d1e 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 _0x0f42=['rpc','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x3f92ed,_0x528507){var _0x382956=function(_0xbaf0a){while(--_0xbaf0a){_0x3f92ed['push'](_0x3f92ed['shift']());}};_0x382956(++_0x528507);}(_0x0f42,0x126));var _0x20f4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0f42[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var moment=require(_0x20f4('0x2'));var BPromise=require(_0x20f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20f4('0x5'));var logger=require('../../config/logger')(_0x20f4('0x6'));var config=require(_0x20f4('0x7'));var jayson=require(_0x20f4('0x8'));var client=jayson['client'][_0x20f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1519fe,_0x525da0,_0x45adf6){return new BPromise(function(_0x553d5d,_0x4a452d){return client['request'](_0x1519fe,_0x45adf6)[_0x20f4('0xa')](function(_0x4f3d95){logger[_0x20f4('0xb')](_0x20f4('0xc'),_0x525da0,_0x20f4('0xd'));logger[_0x20f4('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x525da0,_0x20f4('0xd'),JSON['stringify'](_0x4f3d95));if(_0x4f3d95[_0x20f4('0xf')]){if(_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x10')]===0x1f4){logger[_0x20f4('0xf')]('Automation,\x20%s,\x20%s',_0x525da0,_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);return _0x4a452d(_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);}logger[_0x20f4('0xf')](_0x20f4('0xc'),_0x525da0,_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);return _0x553d5d(_0x4f3d95[_0x20f4('0xf')][_0x20f4('0x11')]);}else{logger[_0x20f4('0xb')]('Automation,\x20%s,\x20%s',_0x525da0,'request\x20sent');_0x553d5d(_0x4f3d95[_0x20f4('0x12')][_0x20f4('0x11')]);}})[_0x20f4('0x13')](function(_0x36fdc2){logger[_0x20f4('0xf')]('Automation,\x20%s,\x20%s',_0x525da0,_0x36fdc2);_0x4a452d(_0x36fdc2);});});} \ No newline at end of file +var _0x1c9a=['http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1c9a,0x98));var _0xa1c9=function(_0x558445,_0x1e7edc){_0x558445=_0x558445-0x0;var _0x3ba5fd=_0x1c9a[_0x558445];return _0x3ba5fd;};'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')]('Automation,\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);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 016bf60..5a1e8c6 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 _0x8ff3=['addConditions','addActions','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create'];(function(_0x54a77a,_0x4c7764){var _0x2aa5b8=function(_0x47e4cd){while(--_0x47e4cd){_0x54a77a['push'](_0x54a77a['shift']());}};_0x2aa5b8(++_0x4c7764);}(_0x8ff3,0x1bb));var _0x38ff=function(_0x120564,_0x3c18cf){_0x120564=_0x120564-0x0;var _0x579980=_0x8ff3[_0x120564];return _0x579980;};'use strict';var multer=require('multer');var util=require(_0x38ff('0x0'));var path=require('path');var timeout=require(_0x38ff('0x1'));var express=require(_0x38ff('0x2'));var router=express[_0x38ff('0x3')]();var fs_extra=require(_0x38ff('0x4'));var auth=require(_0x38ff('0x5'));var interaction=require(_0x38ff('0x6'));var config=require(_0x38ff('0x7'));var controller=require('./automation.controller');router[_0x38ff('0x8')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0xa')]);router[_0x38ff('0x8')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xc')]);router[_0x38ff('0x8')](_0x38ff('0xd'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xe')]);router[_0x38ff('0x8')](_0x38ff('0xf'),auth['isAuthenticated'](),controller[_0x38ff('0x10')]);router[_0x38ff('0x11')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0x12')]);router['post'](_0x38ff('0xd'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x13')]);router[_0x38ff('0x11')](_0x38ff('0xf'),auth['isAuthenticated'](),controller[_0x38ff('0x14')]);router['put'](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x15')]);router['delete'](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6263=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/conditions','/:id/actions','post','create','addConditions','addActions'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x6263,0x19d));var _0x3626=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x6263[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x3626('0x0'));var util=require(_0x3626('0x1'));var path=require(_0x3626('0x2'));var timeout=require(_0x3626('0x3'));var express=require(_0x3626('0x4'));var router=express['Router']();var fs_extra=require(_0x3626('0x5'));var auth=require(_0x3626('0x6'));var interaction=require(_0x3626('0x7'));var config=require(_0x3626('0x8'));var controller=require('./automation.controller');router[_0x3626('0x9')]('/',auth['isAuthenticated'](),controller[_0x3626('0xa')]);router[_0x3626('0x9')]('/:id',auth[_0x3626('0xb')](),controller[_0x3626('0xc')]);router['get'](_0x3626('0xd'),auth[_0x3626('0xb')](),controller['getConditions']);router['get'](_0x3626('0xe'),auth[_0x3626('0xb')](),controller['getActions']);router[_0x3626('0xf')]('/',auth[_0x3626('0xb')](),controller[_0x3626('0x10')]);router[_0x3626('0xf')](_0x3626('0xd'),auth['isAuthenticated'](),controller[_0x3626('0x11')]);router[_0x3626('0xf')]('/:id/actions',auth[_0x3626('0xb')](),controller[_0x3626('0x12')]);router[_0x3626('0x13')](_0x3626('0x14'),auth[_0x3626('0xb')](),controller[_0x3626('0x15')]);router[_0x3626('0x16')](_0x3626('0x14'),auth[_0x3626('0xb')](),controller[_0x3626('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e791302..33419ee 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 _0x3c5f=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x3c5f,0x149));var _0xf3c5=function(_0x33cc84,_0x28f87a){_0x33cc84=_0x33cc84-0x0;var _0x158557=_0x3c5f[_0x33cc84];return _0x158557;};'use strict';var Sequelize=require('sequelize');module[_0xf3c5('0x0')]={'name':{'type':Sequelize[_0xf3c5('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf3c5('0x2')](_0xf3c5('0x3')),'allowNull':![],'defaultValue':_0xf3c5('0x3')},'description':{'type':Sequelize[_0xf3c5('0x1')]},'active':{'type':Sequelize[_0xf3c5('0x4')],'defaultValue':0x0,'comment':_0xf3c5('0x5')},'limitCalls':{'type':Sequelize[_0xf3c5('0x6')](0x4)[_0xf3c5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf3c5('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf3c5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf3c5('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf3c5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3c5('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3c5('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf3c5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3c5('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3c5('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3c5('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf3c5('0xe')},'dialTimezone':{'type':Sequelize[_0xf3c5('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf3c5('0x1')],'defaultValue':_0xf3c5('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xf3c5('0x2')](_0xf3c5('0x10'),_0xf3c5('0x11'),_0xf3c5('0x12')),'defaultValue':_0xf3c5('0x10')},'dialAMDActive':{'type':Sequelize[_0xf3c5('0x4')],'defaultValue':0x0,'comment':_0xf3c5('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xf3c5('0x6')](0x9)[_0xf3c5('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xf3c5('0x6')](0x9)[_0xf3c5('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf3c5('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf3c5('0x6')](0x9)[_0xf3c5('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf3c5('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf3c5('0x6')](0x9)[_0xf3c5('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf3c5('0x6')](0x9)[_0xf3c5('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf3c5('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf3c5('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf3c5('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf3c5('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf3c5('0x6')](0x9)[_0xf3c5('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf3c5('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf3c5('0x1a'),_0xf3c5('0x1b')),'defaultValue':_0xf3c5('0x1a')},'dialPrefix':{'type':Sequelize[_0xf3c5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf3c5('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xf3c5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf3c5('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3c5('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3c5('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3c5('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3c5('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3c5('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3c5('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xf3c5('0x6')](0x3)[_0xf3c5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3c5('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf3c5('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf3c5('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf3c5('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf3c5('0x6')](0x5)[_0xf3c5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xb671=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ENUM','DESC','ASC','#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)','sequelize','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x5dbf45,_0xe16a35){var _0x12bb46=function(_0x9e80b4){while(--_0x9e80b4){_0x5dbf45['push'](_0x5dbf45['shift']());}};_0x12bb46(++_0xe16a35);}(_0xb671,0xcf));var _0x1b67=function(_0x1f88a6,_0x3b249c){_0x1f88a6=_0x1f88a6-0x0;var _0x548341=_0xb671[_0x1f88a6];return _0x548341;};'use strict';var Sequelize=require(_0x1b67('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b67('0x1')],'unique':_0x1b67('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1b67('0x3')),'allowNull':![],'defaultValue':_0x1b67('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1b67('0x4')},'limitCalls':{'type':Sequelize[_0x1b67('0x5')](0x4)[_0x1b67('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1b67('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1b67('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1b67('0x5')](0x3)[_0x1b67('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b67('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1b67('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b67('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1b67('0x5')](0x5)[_0x1b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1b67('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b67('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1b67('0x5')](0x5)[_0x1b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b67('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1b67('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1b67('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1b67('0x5')](0x5)[_0x1b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b67('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1b67('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1b67('0xe')},'dialTimezone':{'type':Sequelize[_0x1b67('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1b67('0x1')],'defaultValue':_0x1b67('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1b67('0x10'),'never',_0x1b67('0x11')),'defaultValue':_0x1b67('0x10')},'dialAMDActive':{'type':Sequelize[_0x1b67('0x12')],'defaultValue':0x0,'comment':_0x1b67('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x1b67('0x5')](0x9)[_0x1b67('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1b67('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x1b67('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1b67('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1b67('0x5')](0x9)[_0x1b67('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1b67('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1b67('0x5')](0x9)[_0x1b67('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b67('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x1b67('0x5')](0x9)[_0x1b67('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1b67('0x5')](0x9)[_0x1b67('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1b67('0x5')](0x9)[_0x1b67('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1b67('0x5')](0x5)[_0x1b67('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1b67('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1b67('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1b67('0x19')](_0x1b67('0x1a'),_0x1b67('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1b67('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1b67('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1b67('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b67('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1b67('0x5')](0x5)[_0x1b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b67('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b67('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1b67('0x5')](0x3)[_0x1b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b67('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1b67('0x5')](0x5)[_0x1b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b67('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x1b67('0x5')](0x3)[_0x1b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1b67('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1b67('0x5')](0x5)[_0x1b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 8b9ed69..70b9551 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 _0xe31d=['key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','options','count','includeAll','include','findAll','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','body','updatedAt','getHoppers','CmHopper','order','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','CmListId','fromQuery','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','update','destroy','then','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type'];(function(_0x293e93,_0x229ae2){var _0x20beae=function(_0xb5c068){while(--_0xb5c068){_0x293e93['push'](_0x293e93['shift']());}};_0x20beae(++_0x229ae2);}(_0xe31d,0x1ec));var _0xde31=function(_0x3686d2,_0x36e278){_0x3686d2=_0x3686d2-0x0;var _0xa23b78=_0xe31d[_0x3686d2];return _0xa23b78;};'use strict';var emlformat=require(_0xde31('0x0'));var rimraf=require(_0xde31('0x1'));var zipdir=require(_0xde31('0x2'));var jsonpatch=require(_0xde31('0x3'));var rp=require(_0xde31('0x4'));var moment=require(_0xde31('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xde31('0x6'));var util=require('util');var path=require(_0xde31('0x7'));var sox=require(_0xde31('0x8'));var csv=require(_0xde31('0x9'));var ejs=require(_0xde31('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde31('0xb'));var squel=require(_0xde31('0xc'));var crypto=require(_0xde31('0xd'));var jsforce=require(_0xde31('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xde31('0x9'));var querystring=require(_0xde31('0xf'));var Papa=require('papaparse');var Redis=require(_0xde31('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xde31('0x11'));var as=require(_0xde31('0x12'));var hardwareService=require(_0xde31('0x13'));var logger=require(_0xde31('0x14'))(_0xde31('0x15'));var utils=require(_0xde31('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xde31('0x17'));var db=require(_0xde31('0x18'))['db'];function respondWithStatusCode(_0x1070c6,_0x36bb9f){_0x36bb9f=_0x36bb9f||0xcc;return function(_0x475faa){if(_0x475faa){return _0x1070c6['sendStatus'](_0x36bb9f);}return _0x1070c6[_0xde31('0x19')](_0x36bb9f)[_0xde31('0x1a')]();};}function respondWithResult(_0x393176,_0x425695){_0x425695=_0x425695||0xc8;return function(_0x254000){if(_0x254000){return _0x393176[_0xde31('0x19')](_0x425695)[_0xde31('0x1b')](_0x254000);}};}function respondWithFilteredResult(_0x5e6275,_0x475301){return function(_0x4e3a5b){if(_0x4e3a5b){var _0x124117=typeof _0x475301[_0xde31('0x1c')]==='undefined'&&typeof _0x475301[_0xde31('0x1d')]==='undefined';var _0x1e3333=_0x4e3a5b['count'];var _0x4ad04c=_0x124117?0x0:_0x475301[_0xde31('0x1c')];var _0x4f01c8=_0x124117?_0x4e3a5b['count']:_0x475301[_0xde31('0x1c')]+_0x475301[_0xde31('0x1d')];var _0x6e8c71;if(_0x4f01c8>=_0x1e3333){_0x4f01c8=_0x1e3333;_0x6e8c71=0xc8;}else{_0x6e8c71=0xce;}_0x5e6275['status'](_0x6e8c71);return _0x5e6275[_0xde31('0x1e')](_0xde31('0x1f'),_0x4ad04c+'-'+_0x4f01c8+'/'+_0x1e3333)['json'](_0x4e3a5b);}return null;};}function patchUpdates(_0x264075){return function(_0xe606f){try{jsonpatch[_0xde31('0x20')](_0xe606f,_0x264075,!![]);}catch(_0x1c940f){return BPromise['reject'](_0x1c940f);}return _0xe606f['save']();};}function saveUpdates(_0x231a2e,_0x61b009){return function(_0x4406e8){if(_0x4406e8){return _0x4406e8[_0xde31('0x21')](_0x231a2e)['then'](function(_0x3f0217){return _0x3f0217;});}return null;};}function removeEntity(_0xe279dd,_0x53d1ab){return function(_0x10bc8b){if(_0x10bc8b){return _0x10bc8b[_0xde31('0x22')]()[_0xde31('0x23')](function(){var _0x50801d=_0x10bc8b['get']({'plain':!![]});var _0x4727c8=_0xde31('0x24');return db[_0xde31('0x25')][_0xde31('0x22')]({'where':{'type':_0x4727c8,'resourceId':_0x50801d['id']}})[_0xde31('0x23')](function(){return _0x10bc8b;});})[_0xde31('0x23')](function(){_0xe279dd[_0xde31('0x19')](0xcc)[_0xde31('0x1a')]();});}};}function handleEntityNotFound(_0x28508a,_0x37364a){return function(_0x24124b){if(!_0x24124b){_0x28508a[_0xde31('0x26')](0x194);}return _0x24124b;};}function handleError(_0x10609c,_0x325c74){_0x325c74=_0x325c74||0x1f4;return function(_0x3d7bd1){logger[_0xde31('0x27')](_0x3d7bd1[_0xde31('0x28')]);if(_0x3d7bd1[_0xde31('0x29')]){delete _0x3d7bd1[_0xde31('0x29')];}_0x10609c[_0xde31('0x19')](_0x325c74)[_0xde31('0x2a')](_0x3d7bd1);};}exports['index']=function(_0x5a3439,_0x15e758){var _0x56c30a={},_0x4adc61={},_0x5cf30a={'count':0x0,'rows':[]};var _0x40707b=_[_0xde31('0x2b')](db[_0xde31('0x2c')][_0xde31('0x2d')],function(_0x1836f7){return{'name':_0x1836f7[_0xde31('0x2e')],'type':_0x1836f7[_0xde31('0x2f')][_0xde31('0x30')]};});_0x4adc61[_0xde31('0x31')]=_['map'](_0x40707b,_0xde31('0x29'));_0x4adc61['query']=_[_0xde31('0x32')](_0x5a3439[_0xde31('0x33')]);_0x4adc61[_0xde31('0x34')]=_[_0xde31('0x35')](_0x4adc61[_0xde31('0x31')],_0x4adc61['query']);_0x56c30a['attributes']=_[_0xde31('0x35')](_0x4adc61[_0xde31('0x31')],qs[_0xde31('0x36')](_0x5a3439[_0xde31('0x33')][_0xde31('0x36')]));_0x56c30a['attributes']=_0x56c30a[_0xde31('0x37')]['length']?_0x56c30a[_0xde31('0x37')]:_0x4adc61[_0xde31('0x31')];if(!_0x5a3439[_0xde31('0x33')][_0xde31('0x38')](_0xde31('0x39'))){_0x56c30a[_0xde31('0x1d')]=qs['limit'](_0x5a3439[_0xde31('0x33')][_0xde31('0x1d')]);_0x56c30a[_0xde31('0x1c')]=qs[_0xde31('0x1c')](_0x5a3439['query'][_0xde31('0x1c')]);}_0x56c30a['order']=qs[_0xde31('0x3a')](_0x5a3439[_0xde31('0x33')][_0xde31('0x3a')]);_0x56c30a['where']=qs['filters'](_['pick'](_0x5a3439[_0xde31('0x33')],_0x4adc61['filters']),_0x40707b);if(_0x5a3439[_0xde31('0x33')][_0xde31('0x3b')]){_0x56c30a[_0xde31('0x3c')]=_[_0xde31('0x3d')](_0x56c30a[_0xde31('0x3c')],{'$or':_[_0xde31('0x2b')](_0x40707b,function(_0x4c511d){if(_0x4c511d[_0xde31('0x2f')]!=='VIRTUAL'){var _0x418072={};_0x418072[_0x4c511d[_0xde31('0x29')]]={'$like':'%'+_0x5a3439[_0xde31('0x33')][_0xde31('0x3b')]+'%'};return _0x418072;}})});}_0x56c30a=_['merge']({},_0x56c30a,_0x5a3439[_0xde31('0x3e')]);var _0x4ed1e1={'where':_0x56c30a[_0xde31('0x3c')]};return db[_0xde31('0x2c')][_0xde31('0x3f')](_0x4ed1e1)[_0xde31('0x23')](function(_0x1ba03c){_0x5cf30a[_0xde31('0x3f')]=_0x1ba03c;if(_0x5a3439[_0xde31('0x33')][_0xde31('0x40')]){_0x56c30a[_0xde31('0x41')]=[{'all':!![]}];}return db[_0xde31('0x2c')][_0xde31('0x42')](_0x56c30a);})[_0xde31('0x23')](function(_0x2e2b12){_0x5cf30a['rows']=_0x2e2b12;return _0x5cf30a;})[_0xde31('0x23')](respondWithFilteredResult(_0x15e758,_0x56c30a))[_0xde31('0x43')](handleError(_0x15e758,null));};exports[_0xde31('0x44')]=function(_0x478d10,_0x3a968f){var _0x57fd81={'raw':![],'where':{'id':_0x478d10[_0xde31('0x45')]['id']}},_0x1313bd={};_0x1313bd[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x2c')][_0xde31('0x2d')]);_0x1313bd['query']=_[_0xde31('0x32')](_0x478d10[_0xde31('0x33')]);_0x1313bd[_0xde31('0x34')]=_[_0xde31('0x35')](_0x1313bd['model'],_0x1313bd[_0xde31('0x33')]);_0x57fd81['attributes']=_[_0xde31('0x35')](_0x1313bd['model'],qs[_0xde31('0x36')](_0x478d10[_0xde31('0x33')]['fields']));_0x57fd81['attributes']=_0x57fd81[_0xde31('0x37')]['length']?_0x57fd81[_0xde31('0x37')]:_0x1313bd[_0xde31('0x31')];if(_0x478d10['query'][_0xde31('0x40')]){_0x57fd81[_0xde31('0x41')]=[{'all':!![]}];}_0x57fd81=_[_0xde31('0x3d')]({},_0x57fd81,_0x478d10['options']);return db['Campaign'][_0xde31('0x46')](_0x57fd81)[_0xde31('0x23')](handleEntityNotFound(_0x3a968f,null))[_0xde31('0x23')](respondWithResult(_0x3a968f,null))['catch'](handleError(_0x3a968f,null));};exports[_0xde31('0x47')]=function(_0x2db225,_0x3f46d9){return db[_0xde31('0x2c')][_0xde31('0x47')](_0x2db225['body'],{})[_0xde31('0x23')](function(_0x3e39fa){var _0x588c2c=_0x2db225[_0xde31('0x48')][_0xde31('0x49')]({'plain':!![]});if(!_0x588c2c)throw new Error(_0xde31('0x4a'));if(_0x588c2c['role']==='user'){var _0x6d3a98=_0x3e39fa['get']({'plain':!![]});var _0x27cc88=_0xde31('0x24');return db['UserProfileSection'][_0xde31('0x46')]({'where':{'name':_0x27cc88,'userProfileId':_0x588c2c[_0xde31('0x4b')]},'raw':!![]})[_0xde31('0x23')](function(_0xb3af14){if(_0xb3af14&&_0xb3af14[_0xde31('0x4c')]===0x0){return db[_0xde31('0x25')][_0xde31('0x47')]({'name':_0x6d3a98['name'],'resourceId':_0x6d3a98['id'],'type':_0xb3af14[_0xde31('0x29')],'sectionId':_0xb3af14['id']},{})[_0xde31('0x23')](function(){return _0x3e39fa;});}else{return _0x3e39fa;}})['catch'](function(_0x40554a){logger[_0xde31('0x27')](_0xde31('0x4d'),_0x40554a);throw _0x40554a;});}return _0x3e39fa;})[_0xde31('0x23')](respondWithResult(_0x3f46d9,0xc9))[_0xde31('0x43')](handleError(_0x3f46d9,null));};exports[_0xde31('0x4e')]=function(_0x3a696f,_0x52b23b){var _0x176770={'where':{'id':_0x3a696f[_0xde31('0x45')]['id']}},_0x2286a9={};_0x2286a9[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x2c')][_0xde31('0x2d')]);_0x176770[_0xde31('0x37')]=_['intersection'](_0x2286a9[_0xde31('0x31')],qs[_0xde31('0x36')](_0x3a696f[_0xde31('0x33')]['fields']));_0x176770[_0xde31('0x37')]=_0x176770[_0xde31('0x37')][_0xde31('0x4f')]?_0x176770[_0xde31('0x37')]:_0x2286a9[_0xde31('0x31')];if(_0x3a696f['query']['includeAll']){_0x176770[_0xde31('0x41')]=[{'all':!![]}];}_0x176770=_['merge']({},_0x176770,_0x3a696f[_0xde31('0x3e')]);return db[_0xde31('0x2c')][_0xde31('0x46')](_0x176770)[_0xde31('0x23')](handleEntityNotFound(_0x52b23b,null))[_0xde31('0x23')](function(_0x21255b){if(_0x21255b){var _0x24cc49=_0x21255b['get']({'plain':!![]});_0x24cc49=qs[_0xde31('0x50')](_0x24cc49,['id',_0xde31('0x51'),'updatedAt']);_0x3a696f[_0xde31('0x52')]=_[_0xde31('0x50')](_0x3a696f[_0xde31('0x52')],['id',_0xde31('0x51'),_0xde31('0x53')]);return db[_0xde31('0x2c')][_0xde31('0x47')](_[_0xde31('0x3d')](_0x24cc49,_0x3a696f[_0xde31('0x52')]),{'include':_0x3a696f['query'][_0xde31('0x40')]?[{'all':!![]}]:undefined})[_0xde31('0x23')](function(_0x582f93){var _0x3420b5=_0x3a696f['user'][_0xde31('0x49')]({'plain':!![]});if(!_0x3420b5)throw new Error(_0xde31('0x4a'));if(_0x3420b5['role']==='user'){var _0x1cf082=_0x582f93['get']({'plain':!![]});var _0x3132fa=_0xde31('0x24');return db['UserProfileSection'][_0xde31('0x46')]({'where':{'name':_0x3132fa,'userProfileId':_0x3420b5[_0xde31('0x4b')]},'raw':!![]})[_0xde31('0x23')](function(_0x5bdd73){if(_0x5bdd73&&_0x5bdd73[_0xde31('0x4c')]===0x0){return db[_0xde31('0x25')]['create']({'name':_0x1cf082[_0xde31('0x29')],'resourceId':_0x1cf082['id'],'type':_0x5bdd73['name'],'sectionId':_0x5bdd73['id']},{})[_0xde31('0x23')](function(){return _0x582f93;});}else{return _0x582f93;}})['catch'](function(_0x35807e){logger[_0xde31('0x27')](_0xde31('0x4d'),_0x35807e);throw _0x35807e;});}return _0x582f93;});}})[_0xde31('0x23')](respondWithResult(_0x52b23b,0xc9))[_0xde31('0x43')](handleError(_0x52b23b,null));};exports[_0xde31('0x21')]=function(_0x42470c,_0x539edb){if(_0x42470c[_0xde31('0x52')]['id']){delete _0x42470c[_0xde31('0x52')]['id'];}return db[_0xde31('0x2c')][_0xde31('0x46')]({'where':{'id':_0x42470c['params']['id']}})['then'](handleEntityNotFound(_0x539edb,null))[_0xde31('0x23')](saveUpdates(_0x42470c['body'],null))['then'](respondWithResult(_0x539edb,null))['catch'](handleError(_0x539edb,null));};exports[_0xde31('0x22')]=function(_0x47f8d4,_0x82ff3f){return db['Campaign']['find']({'where':{'id':_0x47f8d4[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x82ff3f,null))[_0xde31('0x23')](removeEntity(_0x82ff3f,null))[_0xde31('0x43')](handleError(_0x82ff3f,null));};exports[_0xde31('0x54')]=function(_0x5d4782,_0x24067b,_0x3f42a8){var _0x4350a5={'raw':!![],'where':{}};var _0x535069={};var _0x4fe16d={'count':0x0,'rows':[]};return db[_0xde31('0x2c')]['findOne']({'where':{'id':_0x5d4782[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x24067b,null))['then'](function(_0x24ada5){if(_0x24ada5){_0x535069[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x55')][_0xde31('0x2d')]);_0x535069[_0xde31('0x33')]=_[_0xde31('0x32')](_0x5d4782[_0xde31('0x33')]);_0x535069['filters']=_[_0xde31('0x35')](_0x535069[_0xde31('0x31')],_0x535069['query']);_0x4350a5['attributes']=_[_0xde31('0x35')](_0x535069[_0xde31('0x31')],qs[_0xde31('0x36')](_0x5d4782[_0xde31('0x33')]['fields']));_0x4350a5['attributes']=_0x4350a5[_0xde31('0x37')][_0xde31('0x4f')]?_0x4350a5['attributes']:_0x535069[_0xde31('0x31')];if(!_0x5d4782['query']['hasOwnProperty'](_0xde31('0x39'))){_0x4350a5[_0xde31('0x1d')]=qs['limit'](_0x5d4782[_0xde31('0x33')]['limit']);_0x4350a5[_0xde31('0x1c')]=qs[_0xde31('0x1c')](_0x5d4782['query']['offset']);}_0x4350a5[_0xde31('0x56')]=qs['sort'](_0x5d4782[_0xde31('0x33')][_0xde31('0x3a')]);_0x4350a5['where']=qs[_0xde31('0x34')](_[_0xde31('0x57')](_0x5d4782[_0xde31('0x33')],_0x535069[_0xde31('0x34')]));_0x4350a5[_0xde31('0x3c')][_0xde31('0x58')]=_0x24ada5['id'];if(_0x5d4782[_0xde31('0x33')][_0xde31('0x3b')]){_0x4350a5['where']=_[_0xde31('0x3d')](_0x4350a5[_0xde31('0x3c')],{'$or':_[_0xde31('0x2b')](_0x4350a5['attributes'],function(_0x4269a2){var _0x260952={};_0x260952[_0x4269a2]={'$like':'%'+_0x5d4782[_0xde31('0x33')][_0xde31('0x3b')]+'%'};return _0x260952;})});}_0x4350a5=_[_0xde31('0x3d')]({},_0x4350a5,_0x5d4782['options']);return db[_0xde31('0x55')][_0xde31('0x3f')]({'where':_0x4350a5['where']})['then'](function(_0x4a355a){_0x4fe16d['count']=_0x4a355a;if(_0x5d4782[_0xde31('0x33')]['includeAll']){_0x4350a5[_0xde31('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0xde31('0x42')](_0x4350a5);})[_0xde31('0x23')](function(_0x39c959){_0x4fe16d[_0xde31('0x59')]=_0x39c959;return _0x4fe16d;});}})[_0xde31('0x23')](respondWithFilteredResult(_0x24067b,_0x4350a5))[_0xde31('0x43')](handleError(_0x24067b,null));};exports[_0xde31('0x5a')]=function(_0x3888e4,_0x404a09,_0x2bd2b9){var _0x351c54={'raw':!![],'where':{}};var _0x912502={};var _0x5a2219={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3888e4['params']['id']}})['then'](handleEntityNotFound(_0x404a09,null))['then'](function(_0x3877f8){if(_0x3877f8){_0x912502[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x5b')][_0xde31('0x2d')]);_0x912502['query']=_[_0xde31('0x32')](_0x3888e4[_0xde31('0x33')]);_0x912502[_0xde31('0x34')]=_[_0xde31('0x35')](_0x912502['model'],_0x912502['query']);_0x351c54[_0xde31('0x37')]=_[_0xde31('0x35')](_0x912502['model'],qs[_0xde31('0x36')](_0x3888e4[_0xde31('0x33')][_0xde31('0x36')]));_0x351c54['attributes']=_0x351c54[_0xde31('0x37')][_0xde31('0x4f')]?_0x351c54[_0xde31('0x37')]:_0x912502[_0xde31('0x31')];if(!_0x3888e4['query'][_0xde31('0x38')](_0xde31('0x39'))){_0x351c54['limit']=qs['limit'](_0x3888e4['query']['limit']);_0x351c54['offset']=qs[_0xde31('0x1c')](_0x3888e4[_0xde31('0x33')][_0xde31('0x1c')]);}_0x351c54['order']=qs['sort'](_0x3888e4[_0xde31('0x33')][_0xde31('0x3a')]);_0x351c54[_0xde31('0x3c')]=qs[_0xde31('0x34')](_['pick'](_0x3888e4['query'],_0x912502[_0xde31('0x34')]));_0x351c54[_0xde31('0x3c')]['CampaignId']=_0x3877f8['id'];if(_0x3888e4[_0xde31('0x33')][_0xde31('0x3b')]){_0x351c54[_0xde31('0x3c')]=_[_0xde31('0x3d')](_0x351c54[_0xde31('0x3c')],{'$or':_[_0xde31('0x2b')](_0x351c54[_0xde31('0x37')],function(_0x3ec197){var _0x20a5aa={};_0x20a5aa[_0x3ec197]={'$like':'%'+_0x3888e4[_0xde31('0x33')][_0xde31('0x3b')]+'%'};return _0x20a5aa;})});}_0x351c54=_[_0xde31('0x3d')]({},_0x351c54,_0x3888e4[_0xde31('0x3e')]);return db['CmHopperHistory']['count']({'where':_0x351c54['where']})[_0xde31('0x23')](function(_0x588874){_0x5a2219[_0xde31('0x3f')]=_0x588874;if(_0x3888e4['query'][_0xde31('0x40')]){_0x351c54[_0xde31('0x41')]=[{'all':!![]}];}return db[_0xde31('0x5b')][_0xde31('0x42')](_0x351c54);})[_0xde31('0x23')](function(_0x10440b){_0x5a2219[_0xde31('0x59')]=_0x10440b;return _0x5a2219;});}})[_0xde31('0x23')](respondWithFilteredResult(_0x404a09,_0x351c54))[_0xde31('0x43')](handleError(_0x404a09,null));};exports['getHopperFinals']=function(_0x36948f,_0x444392,_0x8b41ac){var _0x512c9b={'raw':!![],'where':{}};var _0xd281a={};var _0x4f04bf={'count':0x0,'rows':[]};return db[_0xde31('0x2c')][_0xde31('0x5c')]({'where':{'id':_0x36948f['params']['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x444392,null))[_0xde31('0x23')](function(_0x5bb24e){if(_0x5bb24e){_0xd281a[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x5d')]['rawAttributes']);_0xd281a[_0xde31('0x33')]=_[_0xde31('0x32')](_0x36948f[_0xde31('0x33')]);_0xd281a['filters']=_[_0xde31('0x35')](_0xd281a[_0xde31('0x31')],_0xd281a[_0xde31('0x33')]);_0x512c9b[_0xde31('0x37')]=_[_0xde31('0x35')](_0xd281a['model'],qs[_0xde31('0x36')](_0x36948f[_0xde31('0x33')][_0xde31('0x36')]));_0x512c9b[_0xde31('0x37')]=_0x512c9b[_0xde31('0x37')][_0xde31('0x4f')]?_0x512c9b[_0xde31('0x37')]:_0xd281a['model'];if(!_0x36948f['query'][_0xde31('0x38')]('nolimit')){_0x512c9b[_0xde31('0x1d')]=qs['limit'](_0x36948f[_0xde31('0x33')][_0xde31('0x1d')]);_0x512c9b[_0xde31('0x1c')]=qs['offset'](_0x36948f['query']['offset']);}_0x512c9b[_0xde31('0x56')]=qs['sort'](_0x36948f['query']['sort']);_0x512c9b[_0xde31('0x3c')]=qs[_0xde31('0x34')](_['pick'](_0x36948f[_0xde31('0x33')],_0xd281a[_0xde31('0x34')]));_0x512c9b[_0xde31('0x3c')][_0xde31('0x58')]=_0x5bb24e['id'];if(_0x36948f['query']['filter']){_0x512c9b[_0xde31('0x3c')]=_[_0xde31('0x3d')](_0x512c9b['where'],{'$or':_[_0xde31('0x2b')](_0x512c9b[_0xde31('0x37')],function(_0xaaec44){var _0x1b4029={};_0x1b4029[_0xaaec44]={'$like':'%'+_0x36948f[_0xde31('0x33')][_0xde31('0x3b')]+'%'};return _0x1b4029;})});}_0x512c9b=_[_0xde31('0x3d')]({},_0x512c9b,_0x36948f[_0xde31('0x3e')]);return db[_0xde31('0x5d')][_0xde31('0x3f')]({'where':_0x512c9b[_0xde31('0x3c')]})[_0xde31('0x23')](function(_0x3000b1){_0x4f04bf['count']=_0x3000b1;if(_0x36948f[_0xde31('0x33')][_0xde31('0x40')]){_0x512c9b['include']=[{'all':!![]}];}return db[_0xde31('0x5d')]['findAll'](_0x512c9b);})[_0xde31('0x23')](function(_0x44ff63){_0x4f04bf[_0xde31('0x59')]=_0x44ff63;return _0x4f04bf;});}})[_0xde31('0x23')](respondWithFilteredResult(_0x444392,_0x512c9b))[_0xde31('0x43')](handleError(_0x444392,null));};exports[_0xde31('0x5e')]=function(_0xc2fe45,_0x5e306a,_0x645948){var _0x1b466b={'raw':!![],'where':{}};var _0x374df0={};var _0x2c8d16={'count':0x0,'rows':[]};return db['Campaign'][_0xde31('0x5c')]({'where':{'id':_0xc2fe45[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x5e306a,null))[_0xde31('0x23')](function(_0x484f39){if(_0x484f39){_0x374df0[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x5f')][_0xde31('0x2d')]);_0x374df0[_0xde31('0x33')]=_[_0xde31('0x32')](_0xc2fe45[_0xde31('0x33')]);_0x374df0[_0xde31('0x34')]=_[_0xde31('0x35')](_0x374df0['model'],_0x374df0[_0xde31('0x33')]);_0x1b466b[_0xde31('0x37')]=_['intersection'](_0x374df0[_0xde31('0x31')],qs[_0xde31('0x36')](_0xc2fe45['query'][_0xde31('0x36')]));_0x1b466b[_0xde31('0x37')]=_0x1b466b['attributes'][_0xde31('0x4f')]?_0x1b466b[_0xde31('0x37')]:_0x374df0[_0xde31('0x31')];if(!_0xc2fe45[_0xde31('0x33')][_0xde31('0x38')](_0xde31('0x39'))){_0x1b466b[_0xde31('0x1d')]=qs[_0xde31('0x1d')](_0xc2fe45[_0xde31('0x33')][_0xde31('0x1d')]);_0x1b466b[_0xde31('0x1c')]=qs[_0xde31('0x1c')](_0xc2fe45['query'][_0xde31('0x1c')]);}_0x1b466b[_0xde31('0x56')]=qs[_0xde31('0x3a')](_0xc2fe45['query'][_0xde31('0x3a')]);_0x1b466b['where']=qs[_0xde31('0x34')](_['pick'](_0xc2fe45[_0xde31('0x33')],_0x374df0[_0xde31('0x34')]));_0x1b466b[_0xde31('0x3c')][_0xde31('0x58')]=_0x484f39['id'];if(_0xc2fe45[_0xde31('0x33')][_0xde31('0x3b')]){_0x1b466b[_0xde31('0x3c')]=_[_0xde31('0x3d')](_0x1b466b[_0xde31('0x3c')],{'$or':_[_0xde31('0x2b')](_0x1b466b[_0xde31('0x37')],function(_0x5dc390){var _0x361b15={};_0x361b15[_0x5dc390]={'$like':'%'+_0xc2fe45[_0xde31('0x33')][_0xde31('0x3b')]+'%'};return _0x361b15;})});}_0x1b466b=_[_0xde31('0x3d')]({},_0x1b466b,_0xc2fe45[_0xde31('0x3e')]);return db[_0xde31('0x5f')][_0xde31('0x3f')]({'where':_0x1b466b['where']})[_0xde31('0x23')](function(_0x5921ad){_0x2c8d16[_0xde31('0x3f')]=_0x5921ad;if(_0xc2fe45['query'][_0xde31('0x40')]){_0x1b466b[_0xde31('0x41')]=[{'all':!![]}];}return db[_0xde31('0x5f')][_0xde31('0x42')](_0x1b466b);})['then'](function(_0x4e4202){_0x2c8d16['rows']=_0x4e4202;return _0x2c8d16;});}})[_0xde31('0x23')](respondWithFilteredResult(_0x5e306a,_0x1b466b))[_0xde31('0x43')](handleError(_0x5e306a,null));};exports[_0xde31('0x60')]=function(_0x123b90,_0x4db812,_0x3a6b52){var _0x384bc9={};var _0x2f4190={};var _0x43625f;var _0x369552;return db[_0xde31('0x2c')][_0xde31('0x5c')]({'where':{'id':_0x123b90[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x4db812,null))[_0xde31('0x23')](function(_0x4618e5){if(_0x4618e5){_0x43625f=_0x4618e5;_0x2f4190[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x61')][_0xde31('0x2d')]);_0x2f4190['query']=_[_0xde31('0x32')](_0x123b90[_0xde31('0x33')]);_0x2f4190[_0xde31('0x34')]=_[_0xde31('0x35')](_0x2f4190[_0xde31('0x31')],_0x2f4190[_0xde31('0x33')]);_0x384bc9[_0xde31('0x37')]=_['intersection'](_0x2f4190[_0xde31('0x31')],qs[_0xde31('0x36')](_0x123b90['query'][_0xde31('0x36')]));_0x384bc9[_0xde31('0x37')]=_0x384bc9[_0xde31('0x37')]['length']?_0x384bc9[_0xde31('0x37')]:_0x2f4190[_0xde31('0x31')];_0x384bc9[_0xde31('0x56')]=qs['sort'](_0x123b90[_0xde31('0x33')]['sort']);_0x384bc9[_0xde31('0x3c')]=qs['filters'](_[_0xde31('0x57')](_0x123b90[_0xde31('0x33')],_0x2f4190[_0xde31('0x34')]));if(_0x123b90['query'][_0xde31('0x3b')]){_0x384bc9[_0xde31('0x3c')]=_['merge'](_0x384bc9[_0xde31('0x3c')],{'$or':_[_0xde31('0x2b')](_0x384bc9['attributes'],function(_0x4b748a){var _0x36f0c1={};_0x36f0c1[_0x4b748a]={'$like':'%'+_0x123b90[_0xde31('0x33')]['filter']+'%'};return _0x36f0c1;})});}_0x384bc9=_[_0xde31('0x3d')]({},_0x384bc9,_0x123b90[_0xde31('0x3e')]);return _0x43625f[_0xde31('0x60')](_0x384bc9);}})[_0xde31('0x23')](function(_0x3b1832){if(_0x3b1832){_0x369552=_0x3b1832['length'];if(!_0x123b90[_0xde31('0x33')][_0xde31('0x38')](_0xde31('0x39'))){_0x384bc9[_0xde31('0x1d')]=qs[_0xde31('0x1d')](_0x123b90[_0xde31('0x33')][_0xde31('0x1d')]);_0x384bc9[_0xde31('0x1c')]=qs['offset'](_0x123b90[_0xde31('0x33')][_0xde31('0x1c')]);}return _0x43625f[_0xde31('0x60')](_0x384bc9);}})['then'](function(_0x2678de){if(_0x2678de){return _0x2678de?{'count':_0x369552,'rows':_0x2678de}:null;}})[_0xde31('0x23')](respondWithResult(_0x4db812,null))[_0xde31('0x43')](handleError(_0x4db812,null));};exports[_0xde31('0x62')]=function(_0x148e54,_0x24f88a,_0x43c753){var _0x5b8169,_0x304c29;return db[_0xde31('0x2c')][_0xde31('0x46')]({'where':{'id':_0x148e54[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x24f88a,null))[_0xde31('0x23')](function(_0x4fc351){if(_0x4fc351){_0x304c29=_0x4fc351;return _0x4fc351[_0xde31('0x62')](_0x148e54[_0xde31('0x52')][_0xde31('0x63')],_['omit'](_0x148e54['body'],[_0xde31('0x63'),'id'])||{});}return null;})[_0xde31('0x64')](function(_0x51c704){var _0x284e17;_0x5b8169=_0x51c704||[];var _0x568ce7=[];if(_0x51c704){for(var _0xec0dbb=0x0;_0xec0dbb<_0x51c704[_0xde31('0x4f')];_0xec0dbb+=0x1){var _0x22d9e1=_0x51c704[_0xec0dbb]['get']({'plain':!![]});_0x304c29[_0xde31('0x65')]=_0x148e54[_0xde31('0x52')][_0xde31('0x65')]?_0x148e54[_0xde31('0x52')][_0xde31('0x65')]:_0x304c29[_0xde31('0x65')];switch(_0x304c29['dialCheckDuplicateType']){case _0xde31('0x66'):_0x284e17=squel[_0xde31('0x67')]()[_0xde31('0x68')](_0xde31('0x69'))['fromQuery']([_0xde31('0x6a'),_0xde31('0x6b'),_0xde31('0x6c'),_0xde31('0x6d'),_0xde31('0x58'),'createdAt','updatedAt'],squel[_0xde31('0x6e')]()[_0xde31('0x6f')](_0xde31('0x6a'),_0xde31('0x6a'))[_0xde31('0x6f')](_0xde31('0x70'),_0xde31('0x6b'))[_0xde31('0x6f')]('id',_0xde31('0x6c'))[_0xde31('0x6f')](_0x22d9e1['CmListId'][_0xde31('0x71')](),_0xde31('0x6d'))[_0xde31('0x6f')](_0x148e54['params']['id'][_0xde31('0x71')](),_0xde31('0x58'))[_0xde31('0x6f')]('NOW()',_0xde31('0x51'))[_0xde31('0x6f')](_0xde31('0x70'),_0xde31('0x53'))['from'](_0xde31('0x72'))[_0xde31('0x3c')](_0xde31('0x73'))[_0xde31('0x3c')](_0xde31('0x74'),_0x22d9e1['CmListId'][_0xde31('0x71')]())['where'](_0xde31('0x75'))[_0xde31('0x3c')](_0xde31('0x76'),squel[_0xde31('0x6e')]()[_0xde31('0x6f')](_0xde31('0x77'))[_0xde31('0x78')](_0xde31('0x79'))[_0xde31('0x3c')](_0xde31('0x7a'),_0x148e54['params']['id']['toString']()))[_0xde31('0x3c')](_0xde31('0x76'),squel[_0xde31('0x6e')]()[_0xde31('0x6f')](_0xde31('0x7b'))[_0xde31('0x78')](_0xde31('0x69'))[_0xde31('0x3c')](_0xde31('0x7a'),_0x148e54['params']['id'][_0xde31('0x71')]())))[_0xde31('0x71')]();break;case _0xde31('0x7c'):_0x284e17=squel[_0xde31('0x67')]()[_0xde31('0x68')](_0xde31('0x69'))['fromQuery']([_0xde31('0x6a'),'scheduledAt',_0xde31('0x6c'),_0xde31('0x6d'),_0xde31('0x58'),'createdAt','updatedAt'],squel[_0xde31('0x6e')]()[_0xde31('0x6f')]('phone','phone')[_0xde31('0x6f')](_0xde31('0x70'),_0xde31('0x6b'))['field']('id',_0xde31('0x6c'))['field'](_0x22d9e1[_0xde31('0x7d')][_0xde31('0x71')](),_0xde31('0x6d'))[_0xde31('0x6f')](_0x148e54[_0xde31('0x45')]['id']['toString'](),_0xde31('0x58'))['field'](_0xde31('0x70'),'createdAt')[_0xde31('0x6f')](_0xde31('0x70'),'updatedAt')['from'](_0xde31('0x72'))[_0xde31('0x3c')](_0xde31('0x73'))[_0xde31('0x3c')]('ListId\x20=\x20?',_0x22d9e1['CmListId'][_0xde31('0x71')]())[_0xde31('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xde31('0x3c')](_0xde31('0x76'),squel[_0xde31('0x6e')]()[_0xde31('0x6f')]('COALESCE(phone,\x27\x27)')[_0xde31('0x78')](_0xde31('0x69'))[_0xde31('0x3c')](_0xde31('0x7a'),_0x148e54['params']['id']['toString']())))[_0xde31('0x71')]();break;default:_0x284e17=squel[_0xde31('0x67')]()[_0xde31('0x68')](_0xde31('0x69'))[_0xde31('0x7e')]([_0xde31('0x6a'),'scheduledAt',_0xde31('0x6c'),_0xde31('0x6d'),_0xde31('0x58'),_0xde31('0x51'),_0xde31('0x53')],squel[_0xde31('0x6e')]()['field'](_0xde31('0x6a'),_0xde31('0x6a'))[_0xde31('0x6f')](_0xde31('0x70'),_0xde31('0x6b'))['field']('id',_0xde31('0x6c'))['field'](_0x22d9e1[_0xde31('0x7d')][_0xde31('0x71')](),_0xde31('0x6d'))[_0xde31('0x6f')](_0x148e54[_0xde31('0x45')]['id']['toString'](),_0xde31('0x58'))[_0xde31('0x6f')]('NOW()',_0xde31('0x51'))[_0xde31('0x6f')](_0xde31('0x70'),_0xde31('0x53'))[_0xde31('0x78')](_0xde31('0x72'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xde31('0x74'),_0x22d9e1[_0xde31('0x7d')]['toString']())[_0xde31('0x3c')](_0xde31('0x75')))[_0xde31('0x71')]();}_0x568ce7[_0xde31('0x7f')](db['sequelize'][_0xde31('0x33')](_0x284e17));}return BPromise[_0xde31('0x80')](_0x568ce7);}})[_0xde31('0x23')](function(){return _0x5b8169;})[_0xde31('0x23')](respondWithResult(_0x24f88a,null))[_0xde31('0x43')](handleError(_0x24f88a,null));};exports[_0xde31('0x81')]=function(_0x119712,_0x22ea0e,_0x57cca4){return db[_0xde31('0x2c')][_0xde31('0x46')]({'where':{'id':_0x119712[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x22ea0e,null))[_0xde31('0x23')](function(_0x27dec1){if(_0x27dec1){return _0x27dec1['removeLists'](_0x119712['query']['ids']);}})['then'](function(_0x29a049){if(_0x29a049){return db[_0xde31('0x55')][_0xde31('0x22')]({'where':{'ListId':_0x119712[_0xde31('0x33')][_0xde31('0x63')],'CampaignId':_0x119712[_0xde31('0x45')]['id']}})['then'](function(){return _0x29a049;});}})[_0xde31('0x23')](respondWithStatusCode(_0x22ea0e,null))[_0xde31('0x43')](handleError(_0x22ea0e,null));};exports[_0xde31('0x82')]=function(_0x3124e7,_0xd966d6,_0x1b47b6){var _0x3f1dda={};var _0xcb2769={};var _0x5966f8;var _0x1bc54d;return db[_0xde31('0x2c')]['findOne']({'where':{'id':_0x3124e7[_0xde31('0x45')]['id']}})['then'](handleEntityNotFound(_0xd966d6,null))[_0xde31('0x23')](function(_0x56f7dd){if(_0x56f7dd){_0x5966f8=_0x56f7dd;_0xcb2769[_0xde31('0x31')]=_[_0xde31('0x32')](db[_0xde31('0x61')][_0xde31('0x2d')]);_0xcb2769[_0xde31('0x33')]=_[_0xde31('0x32')](_0x3124e7[_0xde31('0x33')]);_0xcb2769[_0xde31('0x34')]=_[_0xde31('0x35')](_0xcb2769[_0xde31('0x31')],_0xcb2769[_0xde31('0x33')]);_0x3f1dda[_0xde31('0x37')]=_[_0xde31('0x35')](_0xcb2769[_0xde31('0x31')],qs[_0xde31('0x36')](_0x3124e7[_0xde31('0x33')][_0xde31('0x36')]));_0x3f1dda[_0xde31('0x37')]=_0x3f1dda[_0xde31('0x37')][_0xde31('0x4f')]?_0x3f1dda[_0xde31('0x37')]:_0xcb2769[_0xde31('0x31')];_0x3f1dda[_0xde31('0x56')]=qs['sort'](_0x3124e7['query'][_0xde31('0x3a')]);_0x3f1dda[_0xde31('0x3c')]=qs['filters'](_['pick'](_0x3124e7[_0xde31('0x33')],_0xcb2769['filters']));if(_0x3124e7[_0xde31('0x33')][_0xde31('0x3b')]){_0x3f1dda[_0xde31('0x3c')]=_[_0xde31('0x3d')](_0x3f1dda[_0xde31('0x3c')],{'$or':_[_0xde31('0x2b')](_0x3f1dda['attributes'],function(_0x177d2f){var _0x2e9c41={};_0x2e9c41[_0x177d2f]={'$like':'%'+_0x3124e7[_0xde31('0x33')][_0xde31('0x3b')]+'%'};return _0x2e9c41;})});}_0x3f1dda=_['merge']({},_0x3f1dda,_0x3124e7['options']);return _0x5966f8[_0xde31('0x82')](_0x3f1dda);}})[_0xde31('0x23')](function(_0x1052f9){if(_0x1052f9){_0x1bc54d=_0x1052f9[_0xde31('0x4f')];if(!_0x3124e7[_0xde31('0x33')]['hasOwnProperty'](_0xde31('0x39'))){_0x3f1dda['limit']=qs[_0xde31('0x1d')](_0x3124e7['query'][_0xde31('0x1d')]);_0x3f1dda[_0xde31('0x1c')]=qs[_0xde31('0x1c')](_0x3124e7[_0xde31('0x33')][_0xde31('0x1c')]);}return _0x5966f8[_0xde31('0x82')](_0x3f1dda);}})['then'](function(_0x54bed6){if(_0x54bed6){return _0x54bed6?{'count':_0x1bc54d,'rows':_0x54bed6}:null;}})[_0xde31('0x23')](respondWithResult(_0xd966d6,null))[_0xde31('0x43')](handleError(_0xd966d6,null));};exports[_0xde31('0x83')]=function(_0x44c461,_0x1e0d9a,_0x4a7ed4){var _0x2b9ba2,_0x362661;return db[_0xde31('0x2c')][_0xde31('0x46')]({'where':{'id':_0x44c461[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x1e0d9a,null))[_0xde31('0x23')](function(_0x475f56){if(_0x475f56){_0x362661=_0x475f56;return _0x475f56[_0xde31('0x83')](_0x44c461[_0xde31('0x52')][_0xde31('0x63')],_[_0xde31('0x50')](_0x44c461[_0xde31('0x52')],['ids','id'])||{});}return null;})[_0xde31('0x64')](function(_0xdbc3ae){var _0x319903;_0x2b9ba2=_0xdbc3ae||[];var _0x21fd56=[];if(_0xdbc3ae){for(var _0x2e8d2b=0x0;_0x2e8d2b<_0xdbc3ae[_0xde31('0x4f')];_0x2e8d2b+=0x1){var _0x318172=_0xdbc3ae[_0x2e8d2b][_0xde31('0x49')]({'plain':!![]});_0x319903=squel['insert']()[_0xde31('0x68')](_0xde31('0x84'))['fromQuery']([_0xde31('0x6a'),_0xde31('0x6c'),_0xde31('0x6d'),_0xde31('0x58'),'createdAt',_0xde31('0x53')],squel[_0xde31('0x6e')]()[_0xde31('0x6f')](_0xde31('0x6a'),_0xde31('0x6a'))[_0xde31('0x6f')]('id',_0xde31('0x6c'))[_0xde31('0x6f')](_0x318172[_0xde31('0x7d')][_0xde31('0x71')](),'ListId')[_0xde31('0x6f')](_0x44c461['params']['id'][_0xde31('0x71')](),_0xde31('0x58'))[_0xde31('0x6f')](_0xde31('0x70'),_0xde31('0x51'))[_0xde31('0x6f')](_0xde31('0x70'),_0xde31('0x53'))[_0xde31('0x78')](_0xde31('0x72'))[_0xde31('0x3c')](_0xde31('0x73'))[_0xde31('0x3c')]('ListId\x20=\x20?',_0x318172[_0xde31('0x7d')][_0xde31('0x71')]())[_0xde31('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xde31('0x71')]();_0x21fd56[_0xde31('0x7f')](db[_0xde31('0x85')][_0xde31('0x33')](_0x319903));}return BPromise[_0xde31('0x80')](_0x21fd56);}})['then'](function(){return _0x2b9ba2;})[_0xde31('0x23')](respondWithResult(_0x1e0d9a,null))[_0xde31('0x43')](handleError(_0x1e0d9a,null));};exports[_0xde31('0x86')]=function(_0x4a1e3d,_0x242ab6,_0x353863){return db['Campaign'][_0xde31('0x46')]({'where':{'id':_0x4a1e3d[_0xde31('0x45')]['id']}})[_0xde31('0x23')](handleEntityNotFound(_0x242ab6,null))[_0xde31('0x23')](function(_0xb3a7f2){if(_0xb3a7f2){return _0xb3a7f2[_0xde31('0x86')](_0x4a1e3d[_0xde31('0x33')][_0xde31('0x63')]);}})[_0xde31('0x23')](function(_0x5d568f){if(_0x5d568f){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x4a1e3d[_0xde31('0x33')][_0xde31('0x63')],'CampaignId':_0x4a1e3d[_0xde31('0x45')]['id']}})[_0xde31('0x23')](function(){return _0x5d568f;});}})[_0xde31('0x23')](respondWithStatusCode(_0x242ab6,null))['catch'](handleError(_0x242ab6,null));}; \ No newline at end of file +var _0xd9bb=['getBlackLists','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','map','Campaign','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','pick','CampaignId','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','phone','scheduledAt','ContactId','select','field','NOW()','toString','ListId','createdAt','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','fromQuery','deletedAt\x20IS\x20NULL','push','sequelize','removeLists'];(function(_0x3060ec,_0x10dbc4){var _0x514da2=function(_0x49d1b2){while(--_0x49d1b2){_0x3060ec['push'](_0x3060ec['shift']());}};_0x514da2(++_0x10dbc4);}(_0xd9bb,0x8f));var _0xbd9b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9bb[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xbd9b('0x0'));var rimraf=require(_0xbd9b('0x1'));var zipdir=require(_0xbd9b('0x2'));var jsonpatch=require(_0xbd9b('0x3'));var rp=require(_0xbd9b('0x4'));var moment=require(_0xbd9b('0x5'));var BPromise=require(_0xbd9b('0x6'));var Mustache=require(_0xbd9b('0x7'));var util=require(_0xbd9b('0x8'));var path=require('path');var sox=require(_0xbd9b('0x9'));var csv=require(_0xbd9b('0xa'));var ejs=require(_0xbd9b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd9b('0xc'));var squel=require(_0xbd9b('0xd'));var crypto=require(_0xbd9b('0xe'));var jsforce=require(_0xbd9b('0xf'));var deskjs=require(_0xbd9b('0x10'));var toCsv=require(_0xbd9b('0xa'));var querystring=require(_0xbd9b('0x11'));var Papa=require(_0xbd9b('0x12'));var Redis=require(_0xbd9b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbd9b('0x14'));var as=require(_0xbd9b('0x15'));var hardwareService=require(_0xbd9b('0x16'));var logger=require(_0xbd9b('0x17'))(_0xbd9b('0x18'));var utils=require(_0xbd9b('0x19'));var config=require(_0xbd9b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd9b('0x1b'))['db'];function respondWithStatusCode(_0x37628d,_0x1ad14d){_0x1ad14d=_0x1ad14d||0xcc;return function(_0x3390a5){if(_0x3390a5){return _0x37628d[_0xbd9b('0x1c')](_0x1ad14d);}return _0x37628d[_0xbd9b('0x1d')](_0x1ad14d)[_0xbd9b('0x1e')]();};}function respondWithResult(_0x9103db,_0x4f80b0){_0x4f80b0=_0x4f80b0||0xc8;return function(_0x2e6f7c){if(_0x2e6f7c){return _0x9103db['status'](_0x4f80b0)[_0xbd9b('0x1f')](_0x2e6f7c);}};}function respondWithFilteredResult(_0x38777b,_0x4b77e0){return function(_0x3736fb){if(_0x3736fb){var _0x2e7b80=typeof _0x4b77e0[_0xbd9b('0x20')]===_0xbd9b('0x21')&&typeof _0x4b77e0[_0xbd9b('0x22')]===_0xbd9b('0x21');var _0x5d4f1e=_0x3736fb[_0xbd9b('0x23')];var _0x381251=_0x2e7b80?0x0:_0x4b77e0[_0xbd9b('0x20')];var _0x5a35b0=_0x2e7b80?_0x3736fb[_0xbd9b('0x23')]:_0x4b77e0[_0xbd9b('0x20')]+_0x4b77e0[_0xbd9b('0x22')];var _0x46e133;if(_0x5a35b0>=_0x5d4f1e){_0x5a35b0=_0x5d4f1e;_0x46e133=0xc8;}else{_0x46e133=0xce;}_0x38777b[_0xbd9b('0x1d')](_0x46e133);return _0x38777b[_0xbd9b('0x24')](_0xbd9b('0x25'),_0x381251+'-'+_0x5a35b0+'/'+_0x5d4f1e)[_0xbd9b('0x1f')](_0x3736fb);}return null;};}function patchUpdates(_0x396784){return function(_0x237c2d){try{jsonpatch['apply'](_0x237c2d,_0x396784,!![]);}catch(_0x4b6f6d){return BPromise['reject'](_0x4b6f6d);}return _0x237c2d[_0xbd9b('0x26')]();};}function saveUpdates(_0x15748a,_0x4b2da8){return function(_0x599c2f){if(_0x599c2f){return _0x599c2f[_0xbd9b('0x27')](_0x15748a)[_0xbd9b('0x28')](function(_0x406011){return _0x406011;});}return null;};}function removeEntity(_0x179663,_0xac18a){return function(_0x598425){if(_0x598425){return _0x598425['destroy']()[_0xbd9b('0x28')](function(){var _0x29e7a9=_0x598425[_0xbd9b('0x29')]({'plain':!![]});var _0x63664d='IvrCampaigns';return db[_0xbd9b('0x2a')][_0xbd9b('0x2b')]({'where':{'type':_0x63664d,'resourceId':_0x29e7a9['id']}})[_0xbd9b('0x28')](function(){return _0x598425;});})['then'](function(){_0x179663['status'](0xcc)[_0xbd9b('0x1e')]();});}};}function handleEntityNotFound(_0x20d263,_0x112c7a){return function(_0xc7c8bc){if(!_0xc7c8bc){_0x20d263[_0xbd9b('0x1c')](0x194);}return _0xc7c8bc;};}function handleError(_0x2ea4d0,_0x34f3a4){_0x34f3a4=_0x34f3a4||0x1f4;return function(_0xc54d71){logger['error'](_0xc54d71[_0xbd9b('0x2c')]);if(_0xc54d71[_0xbd9b('0x2d')]){delete _0xc54d71[_0xbd9b('0x2d')];}_0x2ea4d0[_0xbd9b('0x1d')](_0x34f3a4)[_0xbd9b('0x2e')](_0xc54d71);};}exports[_0xbd9b('0x2f')]=function(_0xf5632e,_0x57c7e8){var _0x2cddfb={},_0x1c4f83={},_0x9cb32e={'count':0x0,'rows':[]};var _0x4b6463=_[_0xbd9b('0x30')](db[_0xbd9b('0x31')][_0xbd9b('0x32')],function(_0x9aee41){return{'name':_0x9aee41[_0xbd9b('0x33')],'type':_0x9aee41['type'][_0xbd9b('0x34')]};});_0x1c4f83[_0xbd9b('0x35')]=_['map'](_0x4b6463,_0xbd9b('0x2d'));_0x1c4f83[_0xbd9b('0x36')]=_['keys'](_0xf5632e['query']);_0x1c4f83[_0xbd9b('0x37')]=_[_0xbd9b('0x38')](_0x1c4f83[_0xbd9b('0x35')],_0x1c4f83[_0xbd9b('0x36')]);_0x2cddfb[_0xbd9b('0x39')]=_[_0xbd9b('0x38')](_0x1c4f83['model'],qs[_0xbd9b('0x3a')](_0xf5632e[_0xbd9b('0x36')][_0xbd9b('0x3a')]));_0x2cddfb[_0xbd9b('0x39')]=_0x2cddfb[_0xbd9b('0x39')]['length']?_0x2cddfb[_0xbd9b('0x39')]:_0x1c4f83['model'];if(!_0xf5632e['query'][_0xbd9b('0x3b')](_0xbd9b('0x3c'))){_0x2cddfb[_0xbd9b('0x22')]=qs[_0xbd9b('0x22')](_0xf5632e[_0xbd9b('0x36')]['limit']);_0x2cddfb['offset']=qs[_0xbd9b('0x20')](_0xf5632e[_0xbd9b('0x36')][_0xbd9b('0x20')]);}_0x2cddfb['order']=qs['sort'](_0xf5632e[_0xbd9b('0x36')][_0xbd9b('0x3d')]);_0x2cddfb['where']=qs[_0xbd9b('0x37')](_['pick'](_0xf5632e[_0xbd9b('0x36')],_0x1c4f83[_0xbd9b('0x37')]),_0x4b6463);if(_0xf5632e[_0xbd9b('0x36')][_0xbd9b('0x3e')]){_0x2cddfb[_0xbd9b('0x3f')]=_[_0xbd9b('0x40')](_0x2cddfb['where'],{'$or':_[_0xbd9b('0x30')](_0x4b6463,function(_0x229887){if(_0x229887[_0xbd9b('0x41')]!==_0xbd9b('0x42')){var _0x2685ad={};_0x2685ad[_0x229887['name']]={'$like':'%'+_0xf5632e[_0xbd9b('0x36')][_0xbd9b('0x3e')]+'%'};return _0x2685ad;}})});}_0x2cddfb=_[_0xbd9b('0x40')]({},_0x2cddfb,_0xf5632e[_0xbd9b('0x43')]);var _0x2e0ec9={'where':_0x2cddfb[_0xbd9b('0x3f')]};return db[_0xbd9b('0x31')]['count'](_0x2e0ec9)[_0xbd9b('0x28')](function(_0x568ca1){_0x9cb32e[_0xbd9b('0x23')]=_0x568ca1;if(_0xf5632e[_0xbd9b('0x36')][_0xbd9b('0x44')]){_0x2cddfb[_0xbd9b('0x45')]=[{'all':!![]}];}return db[_0xbd9b('0x31')][_0xbd9b('0x46')](_0x2cddfb);})[_0xbd9b('0x28')](function(_0x415fb8){_0x9cb32e[_0xbd9b('0x47')]=_0x415fb8;return _0x9cb32e;})[_0xbd9b('0x28')](respondWithFilteredResult(_0x57c7e8,_0x2cddfb))[_0xbd9b('0x48')](handleError(_0x57c7e8,null));};exports[_0xbd9b('0x49')]=function(_0x2bcc30,_0x1169f2){var _0x1c43cc={'raw':![],'where':{'id':_0x2bcc30[_0xbd9b('0x4a')]['id']}},_0x4a9685={};_0x4a9685[_0xbd9b('0x35')]=_[_0xbd9b('0x4b')](db[_0xbd9b('0x31')][_0xbd9b('0x32')]);_0x4a9685['query']=_[_0xbd9b('0x4b')](_0x2bcc30['query']);_0x4a9685[_0xbd9b('0x37')]=_[_0xbd9b('0x38')](_0x4a9685['model'],_0x4a9685[_0xbd9b('0x36')]);_0x1c43cc[_0xbd9b('0x39')]=_[_0xbd9b('0x38')](_0x4a9685[_0xbd9b('0x35')],qs['fields'](_0x2bcc30['query']['fields']));_0x1c43cc['attributes']=_0x1c43cc[_0xbd9b('0x39')][_0xbd9b('0x4c')]?_0x1c43cc[_0xbd9b('0x39')]:_0x4a9685[_0xbd9b('0x35')];if(_0x2bcc30[_0xbd9b('0x36')][_0xbd9b('0x44')]){_0x1c43cc[_0xbd9b('0x45')]=[{'all':!![]}];}_0x1c43cc=_[_0xbd9b('0x40')]({},_0x1c43cc,_0x2bcc30[_0xbd9b('0x43')]);return db['Campaign'][_0xbd9b('0x4d')](_0x1c43cc)[_0xbd9b('0x28')](handleEntityNotFound(_0x1169f2,null))[_0xbd9b('0x28')](respondWithResult(_0x1169f2,null))[_0xbd9b('0x48')](handleError(_0x1169f2,null));};exports[_0xbd9b('0x4e')]=function(_0x2560e9,_0x29ecf8){return db[_0xbd9b('0x31')][_0xbd9b('0x4e')](_0x2560e9[_0xbd9b('0x4f')],{})['then'](function(_0x5168d5){var _0x486ba4=_0x2560e9[_0xbd9b('0x50')]['get']({'plain':!![]});if(!_0x486ba4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x486ba4[_0xbd9b('0x51')]===_0xbd9b('0x50')){var _0xf86957=_0x5168d5[_0xbd9b('0x29')]({'plain':!![]});var _0x3c1bb9=_0xbd9b('0x52');return db[_0xbd9b('0x53')][_0xbd9b('0x4d')]({'where':{'name':_0x3c1bb9,'userProfileId':_0x486ba4[_0xbd9b('0x54')]},'raw':!![]})[_0xbd9b('0x28')](function(_0x33d000){if(_0x33d000&&_0x33d000[_0xbd9b('0x55')]===0x0){return db[_0xbd9b('0x2a')][_0xbd9b('0x4e')]({'name':_0xf86957[_0xbd9b('0x2d')],'resourceId':_0xf86957['id'],'type':_0x33d000[_0xbd9b('0x2d')],'sectionId':_0x33d000['id']},{})[_0xbd9b('0x28')](function(){return _0x5168d5;});}else{return _0x5168d5;}})[_0xbd9b('0x48')](function(_0x2834a7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2834a7);throw _0x2834a7;});}return _0x5168d5;})[_0xbd9b('0x28')](respondWithResult(_0x29ecf8,0xc9))[_0xbd9b('0x48')](handleError(_0x29ecf8,null));};exports[_0xbd9b('0x56')]=function(_0x2576e4,_0x2ba55b){var _0x4e1b90={'where':{'id':_0x2576e4[_0xbd9b('0x4a')]['id']}},_0x65939c={};_0x65939c[_0xbd9b('0x35')]=_[_0xbd9b('0x4b')](db[_0xbd9b('0x31')]['rawAttributes']);_0x4e1b90[_0xbd9b('0x39')]=_['intersection'](_0x65939c[_0xbd9b('0x35')],qs['fields'](_0x2576e4[_0xbd9b('0x36')][_0xbd9b('0x3a')]));_0x4e1b90[_0xbd9b('0x39')]=_0x4e1b90[_0xbd9b('0x39')]['length']?_0x4e1b90[_0xbd9b('0x39')]:_0x65939c['model'];if(_0x2576e4[_0xbd9b('0x36')][_0xbd9b('0x44')]){_0x4e1b90[_0xbd9b('0x45')]=[{'all':!![]}];}_0x4e1b90=_[_0xbd9b('0x40')]({},_0x4e1b90,_0x2576e4[_0xbd9b('0x43')]);return db[_0xbd9b('0x31')][_0xbd9b('0x4d')](_0x4e1b90)[_0xbd9b('0x28')](handleEntityNotFound(_0x2ba55b,null))[_0xbd9b('0x28')](function(_0x3a64ae){if(_0x3a64ae){var _0x58eaa3=_0x3a64ae[_0xbd9b('0x29')]({'plain':!![]});_0x58eaa3=qs[_0xbd9b('0x57')](_0x58eaa3,['id','createdAt',_0xbd9b('0x58')]);_0x2576e4[_0xbd9b('0x4f')]=_[_0xbd9b('0x57')](_0x2576e4[_0xbd9b('0x4f')],['id','createdAt',_0xbd9b('0x58')]);return db[_0xbd9b('0x31')][_0xbd9b('0x4e')](_[_0xbd9b('0x40')](_0x58eaa3,_0x2576e4[_0xbd9b('0x4f')]),{'include':_0x2576e4['query'][_0xbd9b('0x44')]?[{'all':!![]}]:undefined})[_0xbd9b('0x28')](function(_0x3fd77d){var _0x2b2bbd=_0x2576e4[_0xbd9b('0x50')]['get']({'plain':!![]});if(!_0x2b2bbd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2bbd['role']===_0xbd9b('0x50')){var _0xe6d69a=_0x3fd77d[_0xbd9b('0x29')]({'plain':!![]});var _0x533ac1='IvrCampaigns';return db[_0xbd9b('0x53')]['find']({'where':{'name':_0x533ac1,'userProfileId':_0x2b2bbd[_0xbd9b('0x54')]},'raw':!![]})[_0xbd9b('0x28')](function(_0x26bdb6){if(_0x26bdb6&&_0x26bdb6['autoAssociation']===0x0){return db['UserProfileResource'][_0xbd9b('0x4e')]({'name':_0xe6d69a[_0xbd9b('0x2d')],'resourceId':_0xe6d69a['id'],'type':_0x26bdb6['name'],'sectionId':_0x26bdb6['id']},{})[_0xbd9b('0x28')](function(){return _0x3fd77d;});}else{return _0x3fd77d;}})[_0xbd9b('0x48')](function(_0x3b96a8){logger[_0xbd9b('0x59')](_0xbd9b('0x5a'),_0x3b96a8);throw _0x3b96a8;});}return _0x3fd77d;});}})[_0xbd9b('0x28')](respondWithResult(_0x2ba55b,0xc9))[_0xbd9b('0x48')](handleError(_0x2ba55b,null));};exports['update']=function(_0x4c6dd5,_0xe3deef){if(_0x4c6dd5[_0xbd9b('0x4f')]['id']){delete _0x4c6dd5['body']['id'];}return db['Campaign'][_0xbd9b('0x4d')]({'where':{'id':_0x4c6dd5['params']['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0xe3deef,null))[_0xbd9b('0x28')](saveUpdates(_0x4c6dd5[_0xbd9b('0x4f')],null))[_0xbd9b('0x28')](respondWithResult(_0xe3deef,null))[_0xbd9b('0x48')](handleError(_0xe3deef,null));};exports['destroy']=function(_0x4f4709,_0x12603e){return db[_0xbd9b('0x31')][_0xbd9b('0x4d')]({'where':{'id':_0x4f4709[_0xbd9b('0x4a')]['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0x12603e,null))[_0xbd9b('0x28')](removeEntity(_0x12603e,null))[_0xbd9b('0x48')](handleError(_0x12603e,null));};exports[_0xbd9b('0x5b')]=function(_0x3be789,_0xb0c6d1,_0x2326ad){var _0x55e287={'raw':!![],'where':{}};var _0x13fbaa={};var _0x5acb38={'count':0x0,'rows':[]};return db[_0xbd9b('0x31')][_0xbd9b('0x5c')]({'where':{'id':_0x3be789['params']['id']}})['then'](handleEntityNotFound(_0xb0c6d1,null))['then'](function(_0x52f921){if(_0x52f921){_0x13fbaa[_0xbd9b('0x35')]=_[_0xbd9b('0x4b')](db[_0xbd9b('0x5d')]['rawAttributes']);_0x13fbaa[_0xbd9b('0x36')]=_['keys'](_0x3be789[_0xbd9b('0x36')]);_0x13fbaa[_0xbd9b('0x37')]=_['intersection'](_0x13fbaa[_0xbd9b('0x35')],_0x13fbaa[_0xbd9b('0x36')]);_0x55e287[_0xbd9b('0x39')]=_[_0xbd9b('0x38')](_0x13fbaa[_0xbd9b('0x35')],qs[_0xbd9b('0x3a')](_0x3be789[_0xbd9b('0x36')][_0xbd9b('0x3a')]));_0x55e287[_0xbd9b('0x39')]=_0x55e287['attributes'][_0xbd9b('0x4c')]?_0x55e287[_0xbd9b('0x39')]:_0x13fbaa[_0xbd9b('0x35')];if(!_0x3be789['query'][_0xbd9b('0x3b')](_0xbd9b('0x3c'))){_0x55e287[_0xbd9b('0x22')]=qs[_0xbd9b('0x22')](_0x3be789[_0xbd9b('0x36')][_0xbd9b('0x22')]);_0x55e287[_0xbd9b('0x20')]=qs[_0xbd9b('0x20')](_0x3be789['query'][_0xbd9b('0x20')]);}_0x55e287['order']=qs[_0xbd9b('0x3d')](_0x3be789[_0xbd9b('0x36')][_0xbd9b('0x3d')]);_0x55e287[_0xbd9b('0x3f')]=qs[_0xbd9b('0x37')](_[_0xbd9b('0x5e')](_0x3be789[_0xbd9b('0x36')],_0x13fbaa[_0xbd9b('0x37')]));_0x55e287[_0xbd9b('0x3f')][_0xbd9b('0x5f')]=_0x52f921['id'];if(_0x3be789[_0xbd9b('0x36')][_0xbd9b('0x3e')]){_0x55e287['where']=_[_0xbd9b('0x40')](_0x55e287[_0xbd9b('0x3f')],{'$or':_['map'](_0x55e287[_0xbd9b('0x39')],function(_0x2ea315){var _0x3bdc9b={};_0x3bdc9b[_0x2ea315]={'$like':'%'+_0x3be789[_0xbd9b('0x36')][_0xbd9b('0x3e')]+'%'};return _0x3bdc9b;})});}_0x55e287=_[_0xbd9b('0x40')]({},_0x55e287,_0x3be789[_0xbd9b('0x43')]);return db[_0xbd9b('0x5d')][_0xbd9b('0x23')]({'where':_0x55e287['where']})['then'](function(_0x3881b2){_0x5acb38['count']=_0x3881b2;if(_0x3be789[_0xbd9b('0x36')][_0xbd9b('0x44')]){_0x55e287[_0xbd9b('0x45')]=[{'all':!![]}];}return db[_0xbd9b('0x5d')]['findAll'](_0x55e287);})[_0xbd9b('0x28')](function(_0x4cea12){_0x5acb38[_0xbd9b('0x47')]=_0x4cea12;return _0x5acb38;});}})[_0xbd9b('0x28')](respondWithFilteredResult(_0xb0c6d1,_0x55e287))[_0xbd9b('0x48')](handleError(_0xb0c6d1,null));};exports[_0xbd9b('0x60')]=function(_0x2458f3,_0x1f6a5a,_0x14040e){var _0x141c4d={'raw':!![],'where':{}};var _0x5ee7e3={};var _0x1628bd={'count':0x0,'rows':[]};return db[_0xbd9b('0x31')][_0xbd9b('0x5c')]({'where':{'id':_0x2458f3[_0xbd9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f6a5a,null))['then'](function(_0x32f416){if(_0x32f416){_0x5ee7e3['model']=_[_0xbd9b('0x4b')](db[_0xbd9b('0x61')][_0xbd9b('0x32')]);_0x5ee7e3[_0xbd9b('0x36')]=_['keys'](_0x2458f3[_0xbd9b('0x36')]);_0x5ee7e3[_0xbd9b('0x37')]=_[_0xbd9b('0x38')](_0x5ee7e3[_0xbd9b('0x35')],_0x5ee7e3[_0xbd9b('0x36')]);_0x141c4d[_0xbd9b('0x39')]=_[_0xbd9b('0x38')](_0x5ee7e3[_0xbd9b('0x35')],qs[_0xbd9b('0x3a')](_0x2458f3['query'][_0xbd9b('0x3a')]));_0x141c4d['attributes']=_0x141c4d[_0xbd9b('0x39')][_0xbd9b('0x4c')]?_0x141c4d[_0xbd9b('0x39')]:_0x5ee7e3['model'];if(!_0x2458f3[_0xbd9b('0x36')]['hasOwnProperty'](_0xbd9b('0x3c'))){_0x141c4d['limit']=qs['limit'](_0x2458f3['query'][_0xbd9b('0x22')]);_0x141c4d[_0xbd9b('0x20')]=qs[_0xbd9b('0x20')](_0x2458f3[_0xbd9b('0x36')][_0xbd9b('0x20')]);}_0x141c4d[_0xbd9b('0x62')]=qs[_0xbd9b('0x3d')](_0x2458f3[_0xbd9b('0x36')][_0xbd9b('0x3d')]);_0x141c4d['where']=qs[_0xbd9b('0x37')](_[_0xbd9b('0x5e')](_0x2458f3[_0xbd9b('0x36')],_0x5ee7e3[_0xbd9b('0x37')]));_0x141c4d['where']['CampaignId']=_0x32f416['id'];if(_0x2458f3[_0xbd9b('0x36')]['filter']){_0x141c4d['where']=_[_0xbd9b('0x40')](_0x141c4d[_0xbd9b('0x3f')],{'$or':_['map'](_0x141c4d[_0xbd9b('0x39')],function(_0x1bc823){var _0x2abe99={};_0x2abe99[_0x1bc823]={'$like':'%'+_0x2458f3[_0xbd9b('0x36')]['filter']+'%'};return _0x2abe99;})});}_0x141c4d=_['merge']({},_0x141c4d,_0x2458f3['options']);return db[_0xbd9b('0x61')][_0xbd9b('0x23')]({'where':_0x141c4d[_0xbd9b('0x3f')]})[_0xbd9b('0x28')](function(_0x1c0840){_0x1628bd[_0xbd9b('0x23')]=_0x1c0840;if(_0x2458f3[_0xbd9b('0x36')][_0xbd9b('0x44')]){_0x141c4d[_0xbd9b('0x45')]=[{'all':!![]}];}return db[_0xbd9b('0x61')][_0xbd9b('0x46')](_0x141c4d);})[_0xbd9b('0x28')](function(_0x2a4d38){_0x1628bd[_0xbd9b('0x47')]=_0x2a4d38;return _0x1628bd;});}})[_0xbd9b('0x28')](respondWithFilteredResult(_0x1f6a5a,_0x141c4d))[_0xbd9b('0x48')](handleError(_0x1f6a5a,null));};exports[_0xbd9b('0x63')]=function(_0xa5323c,_0x49ddfb,_0x340a17){var _0x1273fe={'raw':!![],'where':{}};var _0x11db57={};var _0x38a626={'count':0x0,'rows':[]};return db[_0xbd9b('0x31')][_0xbd9b('0x5c')]({'where':{'id':_0xa5323c['params']['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0x49ddfb,null))[_0xbd9b('0x28')](function(_0x264ac2){if(_0x264ac2){_0x11db57[_0xbd9b('0x35')]=_[_0xbd9b('0x4b')](db[_0xbd9b('0x64')]['rawAttributes']);_0x11db57[_0xbd9b('0x36')]=_[_0xbd9b('0x4b')](_0xa5323c[_0xbd9b('0x36')]);_0x11db57[_0xbd9b('0x37')]=_[_0xbd9b('0x38')](_0x11db57['model'],_0x11db57['query']);_0x1273fe[_0xbd9b('0x39')]=_['intersection'](_0x11db57[_0xbd9b('0x35')],qs['fields'](_0xa5323c['query']['fields']));_0x1273fe[_0xbd9b('0x39')]=_0x1273fe['attributes'][_0xbd9b('0x4c')]?_0x1273fe[_0xbd9b('0x39')]:_0x11db57[_0xbd9b('0x35')];if(!_0xa5323c['query'][_0xbd9b('0x3b')](_0xbd9b('0x3c'))){_0x1273fe['limit']=qs['limit'](_0xa5323c[_0xbd9b('0x36')][_0xbd9b('0x22')]);_0x1273fe[_0xbd9b('0x20')]=qs[_0xbd9b('0x20')](_0xa5323c[_0xbd9b('0x36')][_0xbd9b('0x20')]);}_0x1273fe['order']=qs[_0xbd9b('0x3d')](_0xa5323c[_0xbd9b('0x36')][_0xbd9b('0x3d')]);_0x1273fe[_0xbd9b('0x3f')]=qs[_0xbd9b('0x37')](_['pick'](_0xa5323c[_0xbd9b('0x36')],_0x11db57[_0xbd9b('0x37')]));_0x1273fe[_0xbd9b('0x3f')][_0xbd9b('0x5f')]=_0x264ac2['id'];if(_0xa5323c[_0xbd9b('0x36')][_0xbd9b('0x3e')]){_0x1273fe['where']=_[_0xbd9b('0x40')](_0x1273fe[_0xbd9b('0x3f')],{'$or':_[_0xbd9b('0x30')](_0x1273fe[_0xbd9b('0x39')],function(_0x13a84a){var _0xebf997={};_0xebf997[_0x13a84a]={'$like':'%'+_0xa5323c['query']['filter']+'%'};return _0xebf997;})});}_0x1273fe=_[_0xbd9b('0x40')]({},_0x1273fe,_0xa5323c[_0xbd9b('0x43')]);return db[_0xbd9b('0x64')][_0xbd9b('0x23')]({'where':_0x1273fe[_0xbd9b('0x3f')]})[_0xbd9b('0x28')](function(_0x4d7ca4){_0x38a626[_0xbd9b('0x23')]=_0x4d7ca4;if(_0xa5323c[_0xbd9b('0x36')]['includeAll']){_0x1273fe['include']=[{'all':!![]}];}return db[_0xbd9b('0x64')][_0xbd9b('0x46')](_0x1273fe);})[_0xbd9b('0x28')](function(_0x719689){_0x38a626[_0xbd9b('0x47')]=_0x719689;return _0x38a626;});}})['then'](respondWithFilteredResult(_0x49ddfb,_0x1273fe))['catch'](handleError(_0x49ddfb,null));};exports['getHopperBlacks']=function(_0xfb6e,_0x366929,_0x5bb3ba){var _0x3e43ab={'raw':!![],'where':{}};var _0x4d0266={};var _0x1999b4={'count':0x0,'rows':[]};return db[_0xbd9b('0x31')]['findOne']({'where':{'id':_0xfb6e[_0xbd9b('0x4a')]['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0x366929,null))[_0xbd9b('0x28')](function(_0x33d8b1){if(_0x33d8b1){_0x4d0266[_0xbd9b('0x35')]=_['keys'](db[_0xbd9b('0x65')]['rawAttributes']);_0x4d0266[_0xbd9b('0x36')]=_[_0xbd9b('0x4b')](_0xfb6e[_0xbd9b('0x36')]);_0x4d0266['filters']=_[_0xbd9b('0x38')](_0x4d0266['model'],_0x4d0266[_0xbd9b('0x36')]);_0x3e43ab[_0xbd9b('0x39')]=_[_0xbd9b('0x38')](_0x4d0266[_0xbd9b('0x35')],qs['fields'](_0xfb6e['query'][_0xbd9b('0x3a')]));_0x3e43ab['attributes']=_0x3e43ab[_0xbd9b('0x39')][_0xbd9b('0x4c')]?_0x3e43ab[_0xbd9b('0x39')]:_0x4d0266[_0xbd9b('0x35')];if(!_0xfb6e['query'][_0xbd9b('0x3b')](_0xbd9b('0x3c'))){_0x3e43ab[_0xbd9b('0x22')]=qs[_0xbd9b('0x22')](_0xfb6e[_0xbd9b('0x36')][_0xbd9b('0x22')]);_0x3e43ab['offset']=qs['offset'](_0xfb6e[_0xbd9b('0x36')][_0xbd9b('0x20')]);}_0x3e43ab[_0xbd9b('0x62')]=qs[_0xbd9b('0x3d')](_0xfb6e[_0xbd9b('0x36')][_0xbd9b('0x3d')]);_0x3e43ab[_0xbd9b('0x3f')]=qs[_0xbd9b('0x37')](_[_0xbd9b('0x5e')](_0xfb6e['query'],_0x4d0266[_0xbd9b('0x37')]));_0x3e43ab[_0xbd9b('0x3f')]['CampaignId']=_0x33d8b1['id'];if(_0xfb6e[_0xbd9b('0x36')][_0xbd9b('0x3e')]){_0x3e43ab[_0xbd9b('0x3f')]=_[_0xbd9b('0x40')](_0x3e43ab[_0xbd9b('0x3f')],{'$or':_[_0xbd9b('0x30')](_0x3e43ab[_0xbd9b('0x39')],function(_0x403923){var _0x2c10bb={};_0x2c10bb[_0x403923]={'$like':'%'+_0xfb6e['query'][_0xbd9b('0x3e')]+'%'};return _0x2c10bb;})});}_0x3e43ab=_[_0xbd9b('0x40')]({},_0x3e43ab,_0xfb6e[_0xbd9b('0x43')]);return db[_0xbd9b('0x65')]['count']({'where':_0x3e43ab[_0xbd9b('0x3f')]})[_0xbd9b('0x28')](function(_0x53d602){_0x1999b4[_0xbd9b('0x23')]=_0x53d602;if(_0xfb6e[_0xbd9b('0x36')]['includeAll']){_0x3e43ab[_0xbd9b('0x45')]=[{'all':!![]}];}return db[_0xbd9b('0x65')][_0xbd9b('0x46')](_0x3e43ab);})[_0xbd9b('0x28')](function(_0x197f3c){_0x1999b4[_0xbd9b('0x47')]=_0x197f3c;return _0x1999b4;});}})[_0xbd9b('0x28')](respondWithFilteredResult(_0x366929,_0x3e43ab))['catch'](handleError(_0x366929,null));};exports[_0xbd9b('0x66')]=function(_0xa8bf29,_0x129248,_0x17a05b){var _0x631db4={};var _0x52fb51={};var _0x3829ff;var _0x16e1ab;return db[_0xbd9b('0x31')][_0xbd9b('0x5c')]({'where':{'id':_0xa8bf29[_0xbd9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x129248,null))[_0xbd9b('0x28')](function(_0xcaff58){if(_0xcaff58){_0x3829ff=_0xcaff58;_0x52fb51['model']=_[_0xbd9b('0x4b')](db[_0xbd9b('0x67')]['rawAttributes']);_0x52fb51[_0xbd9b('0x36')]=_[_0xbd9b('0x4b')](_0xa8bf29['query']);_0x52fb51['filters']=_['intersection'](_0x52fb51[_0xbd9b('0x35')],_0x52fb51['query']);_0x631db4[_0xbd9b('0x39')]=_[_0xbd9b('0x38')](_0x52fb51[_0xbd9b('0x35')],qs[_0xbd9b('0x3a')](_0xa8bf29[_0xbd9b('0x36')]['fields']));_0x631db4[_0xbd9b('0x39')]=_0x631db4[_0xbd9b('0x39')][_0xbd9b('0x4c')]?_0x631db4[_0xbd9b('0x39')]:_0x52fb51['model'];_0x631db4[_0xbd9b('0x62')]=qs['sort'](_0xa8bf29['query'][_0xbd9b('0x3d')]);_0x631db4[_0xbd9b('0x3f')]=qs[_0xbd9b('0x37')](_[_0xbd9b('0x5e')](_0xa8bf29[_0xbd9b('0x36')],_0x52fb51[_0xbd9b('0x37')]));if(_0xa8bf29[_0xbd9b('0x36')][_0xbd9b('0x3e')]){_0x631db4[_0xbd9b('0x3f')]=_[_0xbd9b('0x40')](_0x631db4[_0xbd9b('0x3f')],{'$or':_[_0xbd9b('0x30')](_0x631db4[_0xbd9b('0x39')],function(_0x53886b){var _0x53578b={};_0x53578b[_0x53886b]={'$like':'%'+_0xa8bf29[_0xbd9b('0x36')][_0xbd9b('0x3e')]+'%'};return _0x53578b;})});}_0x631db4=_[_0xbd9b('0x40')]({},_0x631db4,_0xa8bf29[_0xbd9b('0x43')]);return _0x3829ff[_0xbd9b('0x66')](_0x631db4);}})['then'](function(_0x2e1168){if(_0x2e1168){_0x16e1ab=_0x2e1168[_0xbd9b('0x4c')];if(!_0xa8bf29[_0xbd9b('0x36')][_0xbd9b('0x3b')]('nolimit')){_0x631db4[_0xbd9b('0x22')]=qs[_0xbd9b('0x22')](_0xa8bf29[_0xbd9b('0x36')][_0xbd9b('0x22')]);_0x631db4['offset']=qs[_0xbd9b('0x20')](_0xa8bf29[_0xbd9b('0x36')][_0xbd9b('0x20')]);}return _0x3829ff['getLists'](_0x631db4);}})['then'](function(_0x34685e){if(_0x34685e){return _0x34685e?{'count':_0x16e1ab,'rows':_0x34685e}:null;}})[_0xbd9b('0x28')](respondWithResult(_0x129248,null))['catch'](handleError(_0x129248,null));};exports[_0xbd9b('0x68')]=function(_0x42f1c4,_0x3e8a85,_0x31d91c){var _0x42973f,_0x3326d2;return db[_0xbd9b('0x31')]['find']({'where':{'id':_0x42f1c4[_0xbd9b('0x4a')]['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0x3e8a85,null))[_0xbd9b('0x28')](function(_0x1ef1dc){if(_0x1ef1dc){_0x3326d2=_0x1ef1dc;return _0x1ef1dc[_0xbd9b('0x68')](_0x42f1c4[_0xbd9b('0x4f')][_0xbd9b('0x69')],_[_0xbd9b('0x57')](_0x42f1c4[_0xbd9b('0x4f')],[_0xbd9b('0x69'),'id'])||{});}return null;})[_0xbd9b('0x6a')](function(_0x544903){var _0x19bda0;_0x42973f=_0x544903||[];var _0x1f5fd6=[];if(_0x544903){for(var _0x28139c=0x0;_0x28139c<_0x544903['length'];_0x28139c+=0x1){var _0x4874e8=_0x544903[_0x28139c][_0xbd9b('0x29')]({'plain':!![]});_0x3326d2['dialCheckDuplicateType']=_0x42f1c4[_0xbd9b('0x4f')]['dialCheckDuplicateType']?_0x42f1c4[_0xbd9b('0x4f')][_0xbd9b('0x6b')]:_0x3326d2[_0xbd9b('0x6b')];switch(_0x3326d2[_0xbd9b('0x6b')]){case _0xbd9b('0x6c'):_0x19bda0=squel['insert']()['into'](_0xbd9b('0x6d'))['fromQuery']([_0xbd9b('0x6e'),_0xbd9b('0x6f'),_0xbd9b('0x70'),'ListId','CampaignId','createdAt',_0xbd9b('0x58')],squel[_0xbd9b('0x71')]()[_0xbd9b('0x72')](_0xbd9b('0x6e'),_0xbd9b('0x6e'))[_0xbd9b('0x72')](_0xbd9b('0x73'),_0xbd9b('0x6f'))['field']('id',_0xbd9b('0x70'))[_0xbd9b('0x72')](_0x4874e8['CmListId'][_0xbd9b('0x74')](),_0xbd9b('0x75'))[_0xbd9b('0x72')](_0x42f1c4[_0xbd9b('0x4a')]['id'][_0xbd9b('0x74')](),_0xbd9b('0x5f'))[_0xbd9b('0x72')](_0xbd9b('0x73'),_0xbd9b('0x76'))[_0xbd9b('0x72')]('NOW()',_0xbd9b('0x58'))[_0xbd9b('0x77')](_0xbd9b('0x78'))['where']('deletedAt\x20IS\x20NULL')[_0xbd9b('0x3f')](_0xbd9b('0x79'),_0x4874e8[_0xbd9b('0x7a')][_0xbd9b('0x74')]())[_0xbd9b('0x3f')](_0xbd9b('0x7b'))['where'](_0xbd9b('0x7c'),squel[_0xbd9b('0x71')]()['field'](_0xbd9b('0x7d'))[_0xbd9b('0x77')](_0xbd9b('0x7e'))[_0xbd9b('0x3f')](_0xbd9b('0x7f'),_0x42f1c4['params']['id'][_0xbd9b('0x74')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xbd9b('0x71')]()[_0xbd9b('0x72')](_0xbd9b('0x80'))[_0xbd9b('0x77')](_0xbd9b('0x6d'))[_0xbd9b('0x3f')](_0xbd9b('0x7f'),_0x42f1c4[_0xbd9b('0x4a')]['id'][_0xbd9b('0x74')]())))['toString']();break;case _0xbd9b('0x81'):_0x19bda0=squel[_0xbd9b('0x82')]()[_0xbd9b('0x83')](_0xbd9b('0x6d'))[_0xbd9b('0x84')]([_0xbd9b('0x6e'),_0xbd9b('0x6f'),_0xbd9b('0x70'),'ListId','CampaignId','createdAt',_0xbd9b('0x58')],squel[_0xbd9b('0x71')]()[_0xbd9b('0x72')](_0xbd9b('0x6e'),'phone')[_0xbd9b('0x72')](_0xbd9b('0x73'),_0xbd9b('0x6f'))[_0xbd9b('0x72')]('id','ContactId')[_0xbd9b('0x72')](_0x4874e8[_0xbd9b('0x7a')][_0xbd9b('0x74')](),'ListId')['field'](_0x42f1c4['params']['id'][_0xbd9b('0x74')](),_0xbd9b('0x5f'))['field'](_0xbd9b('0x73'),_0xbd9b('0x76'))[_0xbd9b('0x72')](_0xbd9b('0x73'),'updatedAt')[_0xbd9b('0x77')](_0xbd9b('0x78'))[_0xbd9b('0x3f')](_0xbd9b('0x85'))[_0xbd9b('0x3f')](_0xbd9b('0x79'),_0x4874e8[_0xbd9b('0x7a')][_0xbd9b('0x74')]())[_0xbd9b('0x3f')](_0xbd9b('0x7b'))[_0xbd9b('0x3f')](_0xbd9b('0x7c'),squel[_0xbd9b('0x71')]()[_0xbd9b('0x72')](_0xbd9b('0x80'))[_0xbd9b('0x77')](_0xbd9b('0x6d'))[_0xbd9b('0x3f')](_0xbd9b('0x7f'),_0x42f1c4[_0xbd9b('0x4a')]['id']['toString']())))[_0xbd9b('0x74')]();break;default:_0x19bda0=squel[_0xbd9b('0x82')]()['into'](_0xbd9b('0x6d'))['fromQuery']([_0xbd9b('0x6e'),_0xbd9b('0x6f'),_0xbd9b('0x70'),'ListId',_0xbd9b('0x5f'),_0xbd9b('0x76'),_0xbd9b('0x58')],squel['select']()[_0xbd9b('0x72')]('phone',_0xbd9b('0x6e'))['field'](_0xbd9b('0x73'),_0xbd9b('0x6f'))[_0xbd9b('0x72')]('id',_0xbd9b('0x70'))['field'](_0x4874e8['CmListId'][_0xbd9b('0x74')](),_0xbd9b('0x75'))['field'](_0x42f1c4['params']['id'][_0xbd9b('0x74')](),_0xbd9b('0x5f'))[_0xbd9b('0x72')](_0xbd9b('0x73'),'createdAt')[_0xbd9b('0x72')](_0xbd9b('0x73'),_0xbd9b('0x58'))['from'](_0xbd9b('0x78'))[_0xbd9b('0x3f')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4874e8[_0xbd9b('0x7a')][_0xbd9b('0x74')]())[_0xbd9b('0x3f')](_0xbd9b('0x7b')))[_0xbd9b('0x74')]();}_0x1f5fd6[_0xbd9b('0x86')](db[_0xbd9b('0x87')][_0xbd9b('0x36')](_0x19bda0));}return BPromise['all'](_0x1f5fd6);}})[_0xbd9b('0x28')](function(){return _0x42973f;})[_0xbd9b('0x28')](respondWithResult(_0x3e8a85,null))[_0xbd9b('0x48')](handleError(_0x3e8a85,null));};exports[_0xbd9b('0x88')]=function(_0x45f29a,_0x38ab1c,_0x4b8166){return db[_0xbd9b('0x31')][_0xbd9b('0x4d')]({'where':{'id':_0x45f29a[_0xbd9b('0x4a')]['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0x38ab1c,null))[_0xbd9b('0x28')](function(_0x7c5a70){if(_0x7c5a70){return _0x7c5a70['removeLists'](_0x45f29a[_0xbd9b('0x36')]['ids']);}})['then'](function(_0x29c7dc){if(_0x29c7dc){return db[_0xbd9b('0x5d')][_0xbd9b('0x2b')]({'where':{'ListId':_0x45f29a[_0xbd9b('0x36')][_0xbd9b('0x69')],'CampaignId':_0x45f29a[_0xbd9b('0x4a')]['id']}})[_0xbd9b('0x28')](function(){return _0x29c7dc;});}})[_0xbd9b('0x28')](respondWithStatusCode(_0x38ab1c,null))[_0xbd9b('0x48')](handleError(_0x38ab1c,null));};exports[_0xbd9b('0x89')]=function(_0x496601,_0x41400f,_0x1d72db){var _0x47c449={};var _0x523e07={};var _0x2e46ed;var _0x875f95;return db[_0xbd9b('0x31')][_0xbd9b('0x5c')]({'where':{'id':_0x496601[_0xbd9b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x41400f,null))[_0xbd9b('0x28')](function(_0x2814c2){if(_0x2814c2){_0x2e46ed=_0x2814c2;_0x523e07[_0xbd9b('0x35')]=_['keys'](db[_0xbd9b('0x67')][_0xbd9b('0x32')]);_0x523e07[_0xbd9b('0x36')]=_[_0xbd9b('0x4b')](_0x496601[_0xbd9b('0x36')]);_0x523e07[_0xbd9b('0x37')]=_[_0xbd9b('0x38')](_0x523e07[_0xbd9b('0x35')],_0x523e07[_0xbd9b('0x36')]);_0x47c449['attributes']=_[_0xbd9b('0x38')](_0x523e07[_0xbd9b('0x35')],qs['fields'](_0x496601[_0xbd9b('0x36')][_0xbd9b('0x3a')]));_0x47c449['attributes']=_0x47c449['attributes'][_0xbd9b('0x4c')]?_0x47c449[_0xbd9b('0x39')]:_0x523e07[_0xbd9b('0x35')];_0x47c449[_0xbd9b('0x62')]=qs['sort'](_0x496601[_0xbd9b('0x36')]['sort']);_0x47c449[_0xbd9b('0x3f')]=qs[_0xbd9b('0x37')](_[_0xbd9b('0x5e')](_0x496601['query'],_0x523e07[_0xbd9b('0x37')]));if(_0x496601[_0xbd9b('0x36')][_0xbd9b('0x3e')]){_0x47c449[_0xbd9b('0x3f')]=_[_0xbd9b('0x40')](_0x47c449[_0xbd9b('0x3f')],{'$or':_[_0xbd9b('0x30')](_0x47c449[_0xbd9b('0x39')],function(_0x1e1795){var _0x4676db={};_0x4676db[_0x1e1795]={'$like':'%'+_0x496601['query'][_0xbd9b('0x3e')]+'%'};return _0x4676db;})});}_0x47c449=_[_0xbd9b('0x40')]({},_0x47c449,_0x496601[_0xbd9b('0x43')]);return _0x2e46ed[_0xbd9b('0x89')](_0x47c449);}})['then'](function(_0x112952){if(_0x112952){_0x875f95=_0x112952[_0xbd9b('0x4c')];if(!_0x496601[_0xbd9b('0x36')][_0xbd9b('0x3b')](_0xbd9b('0x3c'))){_0x47c449[_0xbd9b('0x22')]=qs['limit'](_0x496601[_0xbd9b('0x36')][_0xbd9b('0x22')]);_0x47c449['offset']=qs['offset'](_0x496601[_0xbd9b('0x36')]['offset']);}return _0x2e46ed['getBlackLists'](_0x47c449);}})['then'](function(_0x3e55a5){if(_0x3e55a5){return _0x3e55a5?{'count':_0x875f95,'rows':_0x3e55a5}:null;}})[_0xbd9b('0x28')](respondWithResult(_0x41400f,null))[_0xbd9b('0x48')](handleError(_0x41400f,null));};exports[_0xbd9b('0x8a')]=function(_0x52ab3a,_0x2cac41,_0x2c7200){var _0x142112,_0xad7323;return db[_0xbd9b('0x31')][_0xbd9b('0x4d')]({'where':{'id':_0x52ab3a[_0xbd9b('0x4a')]['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0x2cac41,null))[_0xbd9b('0x28')](function(_0x1be6fe){if(_0x1be6fe){_0xad7323=_0x1be6fe;return _0x1be6fe[_0xbd9b('0x8a')](_0x52ab3a[_0xbd9b('0x4f')]['ids'],_[_0xbd9b('0x57')](_0x52ab3a[_0xbd9b('0x4f')],['ids','id'])||{});}return null;})[_0xbd9b('0x6a')](function(_0x1e5c42){var _0x5d68a5;_0x142112=_0x1e5c42||[];var _0x3ce7c7=[];if(_0x1e5c42){for(var _0x21d3ab=0x0;_0x21d3ab<_0x1e5c42[_0xbd9b('0x4c')];_0x21d3ab+=0x1){var _0x28433f=_0x1e5c42[_0x21d3ab][_0xbd9b('0x29')]({'plain':!![]});_0x5d68a5=squel[_0xbd9b('0x82')]()[_0xbd9b('0x83')](_0xbd9b('0x8b'))['fromQuery']([_0xbd9b('0x6e'),_0xbd9b('0x70'),_0xbd9b('0x75'),_0xbd9b('0x5f'),_0xbd9b('0x76'),_0xbd9b('0x58')],squel[_0xbd9b('0x71')]()['field'](_0xbd9b('0x6e'),_0xbd9b('0x6e'))[_0xbd9b('0x72')]('id',_0xbd9b('0x70'))[_0xbd9b('0x72')](_0x28433f[_0xbd9b('0x7a')][_0xbd9b('0x74')](),_0xbd9b('0x75'))['field'](_0x52ab3a[_0xbd9b('0x4a')]['id'][_0xbd9b('0x74')](),_0xbd9b('0x5f'))['field'](_0xbd9b('0x73'),_0xbd9b('0x76'))[_0xbd9b('0x72')]('NOW()',_0xbd9b('0x58'))['from'](_0xbd9b('0x78'))[_0xbd9b('0x3f')](_0xbd9b('0x85'))['where'](_0xbd9b('0x79'),_0x28433f['CmListId']['toString']())[_0xbd9b('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3ce7c7[_0xbd9b('0x86')](db[_0xbd9b('0x87')][_0xbd9b('0x36')](_0x5d68a5));}return BPromise['all'](_0x3ce7c7);}})[_0xbd9b('0x28')](function(){return _0x142112;})['then'](respondWithResult(_0x2cac41,null))['catch'](handleError(_0x2cac41,null));};exports['removeBlackLists']=function(_0x4db767,_0x250b4b,_0x45be65){return db[_0xbd9b('0x31')][_0xbd9b('0x4d')]({'where':{'id':_0x4db767[_0xbd9b('0x4a')]['id']}})[_0xbd9b('0x28')](handleEntityNotFound(_0x250b4b,null))[_0xbd9b('0x28')](function(_0x5f2266){if(_0x5f2266){return _0x5f2266['removeBlackLists'](_0x4db767[_0xbd9b('0x36')]['ids']);}})[_0xbd9b('0x28')](function(_0x189a74){if(_0x189a74){return db[_0xbd9b('0x65')][_0xbd9b('0x2b')]({'where':{'ListId':_0x4db767[_0xbd9b('0x36')][_0xbd9b('0x69')],'CampaignId':_0x4db767[_0xbd9b('0x4a')]['id']}})['then'](function(){return _0x189a74;});}})['then'](respondWithStatusCode(_0x250b4b,null))[_0xbd9b('0x48')](handleError(_0x250b4b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index acf4ba9..0b0cb2e 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x453378,_0x2f360c){var _0xab3d9e=function(_0x58c2c8){while(--_0x58c2c8){_0x453378['push'](_0x453378['shift']());}};_0xab3d9e(++_0x2f360c);}(_0x7a54,0x106));var _0x47a5=function(_0x601cb2,_0x1cfc39){_0x601cb2=_0x601cb2-0x0;var _0x327a6c=_0x7a54[_0x601cb2];return _0x327a6c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 23227b8..66e3086 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 _0xb790=['Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Campaign,\x20%s,\x20%s','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','map','include','model','util','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug'];(function(_0x3063cd,_0x29a884){var _0x104def=function(_0x2df3c0){while(--_0x2df3c0){_0x3063cd['push'](_0x3063cd['shift']());}};_0x104def(++_0x29a884);}(_0xb790,0xe5));var _0x0b79=function(_0x6ea106,_0x181b3d){_0x6ea106=_0x6ea106-0x0;var _0x49ecfe=_0xb790[_0x6ea106];return _0x49ecfe;};'use strict';var _=require('lodash');var util=require(_0x0b79('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b79('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0b79('0x2'))(_0x0b79('0x3'));var config=require('../../config/environment');var jayson=require(_0x0b79('0x4'));var client=jayson[_0x0b79('0x5')][_0x0b79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x574c73,_0x69b376,_0x1e9124){return new BPromise(function(_0x3de006,_0x301de6){return client[_0x0b79('0x7')](_0x574c73,_0x1e9124)[_0x0b79('0x8')](function(_0x834937){logger[_0x0b79('0x9')]('Campaign,\x20%s,\x20%s',_0x69b376,'request\x20sent');logger[_0x0b79('0xa')](_0x0b79('0xb'),_0x69b376,_0x0b79('0xc'),JSON[_0x0b79('0xd')](_0x834937));if(_0x834937[_0x0b79('0xe')]){if(_0x834937['error'][_0x0b79('0xf')]===0x1f4){logger[_0x0b79('0xe')]('Campaign,\x20%s,\x20%s',_0x69b376,_0x834937[_0x0b79('0xe')][_0x0b79('0x10')]);return _0x301de6(_0x834937[_0x0b79('0xe')][_0x0b79('0x10')]);}logger['error'](_0x0b79('0x11'),_0x69b376,_0x834937[_0x0b79('0xe')][_0x0b79('0x10')]);return _0x3de006(_0x834937[_0x0b79('0xe')]['message']);}else{logger[_0x0b79('0x9')](_0x0b79('0x11'),_0x69b376,'request\x20sent');_0x3de006(_0x834937[_0x0b79('0x12')][_0x0b79('0x10')]);}})[_0x0b79('0x13')](function(_0x43259e){logger[_0x0b79('0xe')](_0x0b79('0x11'),_0x69b376,_0x43259e);_0x301de6(_0x43259e);});});}exports[_0x0b79('0x14')]=function(_0x316ebb){var _0x55bc36=this;return new Promise(function(_0x49909d,_0x4e7614){return db[_0x0b79('0x15')][_0x0b79('0x16')]({'raw':_0x316ebb[_0x0b79('0x17')]?_0x316ebb['options'][_0x0b79('0x18')]===undefined?!![]:![]:!![],'where':_0x316ebb['options']?_0x316ebb[_0x0b79('0x17')][_0x0b79('0x19')]||null:null,'attributes':_0x316ebb[_0x0b79('0x17')]?_0x316ebb['options'][_0x0b79('0x1a')]||null:null,'limit':_0x316ebb[_0x0b79('0x17')]?_0x316ebb[_0x0b79('0x17')]['limit']||null:null,'include':_0x316ebb[_0x0b79('0x17')]?_0x316ebb['options']['include']?_[_0x0b79('0x1b')](_0x316ebb['options'][_0x0b79('0x1c')],function(_0x235a7f){return{'model':db[_0x235a7f[_0x0b79('0x1d')]],'as':_0x235a7f['as'],'attributes':_0x235a7f[_0x0b79('0x1a')],'include':_0x235a7f['include']?_[_0x0b79('0x1b')](_0x235a7f[_0x0b79('0x1c')],function(_0x409db2){return{'model':db[_0x409db2[_0x0b79('0x1d')]],'as':_0x409db2['as'],'attributes':_0x409db2[_0x0b79('0x1a')],'include':_0x409db2[_0x0b79('0x1c')]?_[_0x0b79('0x1b')](_0x409db2[_0x0b79('0x1c')],function(_0x39b034){return{'model':db[_0x39b034[_0x0b79('0x1d')]],'as':_0x39b034['as'],'attributes':_0x39b034[_0x0b79('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b79('0x8')](function(_0x1cf7f7){logger['info'](_0x0b79('0x14'),_0x316ebb);logger[_0x0b79('0xa')](_0x0b79('0x14'),_0x316ebb,JSON[_0x0b79('0xd')](_0x1cf7f7));_0x49909d(_0x1cf7f7);})['catch'](function(_0x47cdf2){logger[_0x0b79('0xe')]('GetCampaign',_0x47cdf2[_0x0b79('0x10')],_0x316ebb);_0x4e7614(_0x55bc36['error'](0x1f4,_0x47cdf2[_0x0b79('0x10')]));});});}; \ No newline at end of file +var _0x8fed=['include','model','map','then','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetCampaign','options','where','attributes','limit'];(function(_0x25bbc2,_0x25465e){var _0x497c91=function(_0xcc907f){while(--_0xcc907f){_0x25bbc2['push'](_0x25bbc2['shift']());}};_0x497c91(++_0x25465e);}(_0x8fed,0xf5));var _0xd8fe=function(_0x15983d,_0x14dc19){_0x15983d=_0x15983d-0x0;var _0x3ae35d=_0x8fed[_0x15983d];return _0x3ae35d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8fe('0x0'));var BPromise=require(_0xd8fe('0x1'));var rs=require(_0xd8fe('0x2'));var fs=require('fs');var Redis=require(_0xd8fe('0x3'));var db=require(_0xd8fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8fe('0x5'))(_0xd8fe('0x6'));var config=require(_0xd8fe('0x7'));var jayson=require(_0xd8fe('0x8'));var client=jayson[_0xd8fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e3b94,_0x1747b3,_0xa33e22){return new BPromise(function(_0x26d33d,_0x5e48f9){return client[_0xd8fe('0xa')](_0x7e3b94,_0xa33e22)['then'](function(_0x410d44){logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));logger[_0xd8fe('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1747b3,_0xd8fe('0xd'),JSON[_0xd8fe('0xf')](_0x410d44));if(_0x410d44[_0xd8fe('0x10')]){if(_0x410d44['error'][_0xd8fe('0x11')]===0x1f4){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);return _0x5e48f9(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x410d44[_0xd8fe('0x10')]['message']);return _0x26d33d(_0x410d44[_0xd8fe('0x10')][_0xd8fe('0x12')]);}else{logger[_0xd8fe('0xb')](_0xd8fe('0xc'),_0x1747b3,_0xd8fe('0xd'));_0x26d33d(_0x410d44[_0xd8fe('0x13')][_0xd8fe('0x12')]);}})['catch'](function(_0x260a7f){logger['error'](_0xd8fe('0xc'),_0x1747b3,_0x260a7f);_0x5e48f9(_0x260a7f);});});}exports[_0xd8fe('0x14')]=function(_0x4cfb98){var _0x31a5d7=this;return new Promise(function(_0x4b7d9e,_0x52a8b6){return db['Campaign']['findAll']({'raw':_0x4cfb98['options']?_0x4cfb98[_0xd8fe('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98['options'][_0xd8fe('0x16')]||null:null,'attributes':_0x4cfb98['options']?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x17')]||null:null,'limit':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x18')]||null:null,'include':_0x4cfb98[_0xd8fe('0x15')]?_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x19')]?_['map'](_0x4cfb98[_0xd8fe('0x15')][_0xd8fe('0x19')],function(_0x19d4d1){return{'model':db[_0x19d4d1[_0xd8fe('0x1a')]],'as':_0x19d4d1['as'],'attributes':_0x19d4d1['attributes'],'include':_0x19d4d1[_0xd8fe('0x19')]?_[_0xd8fe('0x1b')](_0x19d4d1[_0xd8fe('0x19')],function(_0x130c16){return{'model':db[_0x130c16[_0xd8fe('0x1a')]],'as':_0x130c16['as'],'attributes':_0x130c16[_0xd8fe('0x17')],'include':_0x130c16['include']?_['map'](_0x130c16[_0xd8fe('0x19')],function(_0x22ef87){return{'model':db[_0x22ef87[_0xd8fe('0x1a')]],'as':_0x22ef87['as'],'attributes':_0x22ef87[_0xd8fe('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd8fe('0x1c')](function(_0x1666e4){logger[_0xd8fe('0xb')](_0xd8fe('0x14'),_0x4cfb98);logger[_0xd8fe('0xe')](_0xd8fe('0x14'),_0x4cfb98,JSON[_0xd8fe('0xf')](_0x1666e4));_0x4b7d9e(_0x1666e4);})[_0xd8fe('0x1d')](function(_0x2c2767){logger[_0xd8fe('0x10')]('GetCampaign',_0x2c2767[_0xd8fe('0x12')],_0x4cfb98);_0x52a8b6(_0x31a5d7[_0xd8fe('0x10')](0x1f4,_0x2c2767[_0xd8fe('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index cf25a17..e914044 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 _0xd5bf=['getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists'];(function(_0x4fc326,_0x43d83b){var _0x454b5c=function(_0x166dd4){while(--_0x166dd4){_0x4fc326['push'](_0x4fc326['shift']());}};_0x454b5c(++_0x43d83b);}(_0xd5bf,0x66));var _0xfd5b=function(_0x2c12d7,_0x3074ae){_0x2c12d7=_0x2c12d7-0x0;var _0x9e469a=_0xd5bf[_0x2c12d7];return _0x9e469a;};'use strict';var multer=require(_0xfd5b('0x0'));var util=require(_0xfd5b('0x1'));var path=require(_0xfd5b('0x2'));var timeout=require(_0xfd5b('0x3'));var express=require(_0xfd5b('0x4'));var router=express[_0xfd5b('0x5')]();var fs_extra=require(_0xfd5b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd5b('0x7'));var controller=require(_0xfd5b('0x8'));router[_0xfd5b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfd5b('0x9')](_0xfd5b('0xa'),auth[_0xfd5b('0xb')](),controller['show']);router[_0xfd5b('0x9')](_0xfd5b('0xc'),auth['isAuthenticated'](),controller[_0xfd5b('0xd')]);router[_0xfd5b('0x9')]('/:id/hopper_histories',auth[_0xfd5b('0xb')](),controller['getHopperHistories']);router[_0xfd5b('0x9')]('/:id/hopper_finals',auth[_0xfd5b('0xb')](),controller['getHopperFinals']);router[_0xfd5b('0x9')](_0xfd5b('0xe'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xfd5b('0x9')](_0xfd5b('0xf'),auth['isAuthenticated'](),controller[_0xfd5b('0x10')]);router[_0xfd5b('0x9')](_0xfd5b('0x11'),auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x12')]);router[_0xfd5b('0x13')]('/',auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x14')]);router[_0xfd5b('0x13')](_0xfd5b('0x15'),auth['isAuthenticated'](),controller[_0xfd5b('0x16')]);router[_0xfd5b('0x13')](_0xfd5b('0xf'),auth[_0xfd5b('0xb')](),controller['addLists']);router[_0xfd5b('0x13')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xfd5b('0x17')]);router[_0xfd5b('0x18')](_0xfd5b('0xa'),auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x19')]);router['delete']('/:id',auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x1a')]);router[_0xfd5b('0x1b')](_0xfd5b('0xf'),auth[_0xfd5b('0xb')](),controller['removeLists']);router[_0xfd5b('0x1b')](_0xfd5b('0x11'),auth[_0xfd5b('0xb')](),controller[_0xfd5b('0x1c')]);module[_0xfd5b('0x1d')]=router; \ No newline at end of file +var _0x59a2=['multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','/:id/clone','addLists','post','addBlackLists','put','delete','removeLists','exports'];(function(_0x37fca1,_0xdc30d5){var _0x2d13d9=function(_0x338dbe){while(--_0x338dbe){_0x37fca1['push'](_0x37fca1['shift']());}};_0x2d13d9(++_0xdc30d5);}(_0x59a2,0x1dc));var _0x259a=function(_0x43ad88,_0x553f6d){_0x43ad88=_0x43ad88-0x0;var _0x34c595=_0x59a2[_0x43ad88];return _0x34c595;};'use strict';var multer=require(_0x259a('0x0'));var util=require(_0x259a('0x1'));var path=require(_0x259a('0x2'));var timeout=require('connect-timeout');var express=require(_0x259a('0x3'));var router=express['Router']();var fs_extra=require(_0x259a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x259a('0x5'));var config=require(_0x259a('0x6'));var controller=require('./campaign.controller');router[_0x259a('0x7')]('/',auth[_0x259a('0x8')](),controller['index']);router[_0x259a('0x7')](_0x259a('0x9'),auth[_0x259a('0x8')](),controller['show']);router[_0x259a('0x7')](_0x259a('0xa'),auth[_0x259a('0x8')](),controller['getHoppers']);router[_0x259a('0x7')]('/:id/hopper_histories',auth[_0x259a('0x8')](),controller[_0x259a('0xb')]);router[_0x259a('0x7')](_0x259a('0xc'),auth[_0x259a('0x8')](),controller[_0x259a('0xd')]);router['get']('/:id/hopper_black',auth[_0x259a('0x8')](),controller[_0x259a('0xe')]);router[_0x259a('0x7')](_0x259a('0xf'),auth[_0x259a('0x8')](),controller[_0x259a('0x10')]);router['get'](_0x259a('0x11'),auth['isAuthenticated'](),controller[_0x259a('0x12')]);router['post']('/',auth[_0x259a('0x8')](),controller[_0x259a('0x13')]);router['post'](_0x259a('0x14'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/lists',auth[_0x259a('0x8')](),controller[_0x259a('0x15')]);router[_0x259a('0x16')]('/:id/blacklists',auth[_0x259a('0x8')](),controller[_0x259a('0x17')]);router[_0x259a('0x18')](_0x259a('0x9'),auth[_0x259a('0x8')](),controller['update']);router[_0x259a('0x19')]('/:id',auth[_0x259a('0x8')](),controller['destroy']);router[_0x259a('0x19')](_0x259a('0xf'),auth[_0x259a('0x8')](),controller[_0x259a('0x1a')]);router['delete'](_0x259a('0x11'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x259a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 47668a8..faf08ae 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 _0x4a5b=['STRING','TEXT','VIRTUAL','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a5b,0x9e));var _0xb4a5=function(_0x33e2c1,_0x4654c1){_0x33e2c1=_0x33e2c1-0x0;var _0x15c67b=_0x4a5b[_0x33e2c1];return _0x15c67b;};'use strict';var Sequelize=require(_0xb4a5('0x0'));module[_0xb4a5('0x1')]={'key':{'type':Sequelize[_0xb4a5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb4a5('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xb4a5('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x250d=['getDataValue','STRING','TEXT','VIRTUAL'];(function(_0xaa7b3e,_0x9c8790){var _0x189e2b=function(_0x114af4){while(--_0x114af4){_0xaa7b3e['push'](_0xaa7b3e['shift']());}};_0x189e2b(++_0x9c8790);}(_0x250d,0x1ad));var _0xd250=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x250d[_0x57fa33];return _0x12e724;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0xd250('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0xd250('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd250('0x0')]},'name':{'type':Sequelize[_0xd250('0x2')],'get':function(){return this[_0xd250('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index fd2c757..3b78723 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 _0x6952=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','stack','name','index','map','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','filter','options','count','findAll','rows','catch','show','keys','CannedAnswer','includeAll','find','body','params','MailAccountId','SmsAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','UserProfileResource','error','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'];(function(_0x255b94,_0x352b45){var _0xc5806b=function(_0x530e79){while(--_0x530e79){_0x255b94['push'](_0x255b94['shift']());}};_0xc5806b(++_0x352b45);}(_0x6952,0x167));var _0x2695=function(_0xbbc00b,_0x490793){_0xbbc00b=_0xbbc00b-0x0;var _0x514753=_0x6952[_0xbbc00b];return _0x514753;};'use strict';var emlformat=require(_0x2695('0x0'));var rimraf=require(_0x2695('0x1'));var zipdir=require(_0x2695('0x2'));var jsonpatch=require(_0x2695('0x3'));var rp=require(_0x2695('0x4'));var moment=require(_0x2695('0x5'));var BPromise=require(_0x2695('0x6'));var Mustache=require(_0x2695('0x7'));var util=require(_0x2695('0x8'));var path=require(_0x2695('0x9'));var sox=require(_0x2695('0xa'));var csv=require(_0x2695('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2695('0xc'));var _=require(_0x2695('0xd'));var squel=require(_0x2695('0xe'));var crypto=require(_0x2695('0xf'));var jsforce=require(_0x2695('0x10'));var deskjs=require(_0x2695('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2695('0x12'));var Papa=require(_0x2695('0x13'));var Redis=require(_0x2695('0x14'));var authService=require(_0x2695('0x15'));var qs=require(_0x2695('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2695('0x17'))(_0x2695('0x18'));var utils=require(_0x2695('0x19'));var config=require(_0x2695('0x1a'));var licenseUtil=require(_0x2695('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fc6a9,_0x21b5f5){_0x21b5f5=_0x21b5f5||0xcc;return function(_0x1704a9){if(_0x1704a9){return _0x3fc6a9[_0x2695('0x1c')](_0x21b5f5);}return _0x3fc6a9[_0x2695('0x1d')](_0x21b5f5)[_0x2695('0x1e')]();};}function respondWithResult(_0x21145a,_0x368c09){_0x368c09=_0x368c09||0xc8;return function(_0x5097cc){if(_0x5097cc){return _0x21145a[_0x2695('0x1d')](_0x368c09)['json'](_0x5097cc);}};}function respondWithFilteredResult(_0x2b27ee,_0x3f51f6){return function(_0x2270d0){if(_0x2270d0){var _0x17d758=typeof _0x3f51f6['offset']===_0x2695('0x1f')&&typeof _0x3f51f6[_0x2695('0x20')]==='undefined';var _0x42bbe6=_0x2270d0['count'];var _0x476504=_0x17d758?0x0:_0x3f51f6['offset'];var _0x520a4c=_0x17d758?_0x2270d0['count']:_0x3f51f6[_0x2695('0x21')]+_0x3f51f6[_0x2695('0x20')];var _0x4eb111;if(_0x520a4c>=_0x42bbe6){_0x520a4c=_0x42bbe6;_0x4eb111=0xc8;}else{_0x4eb111=0xce;}_0x2b27ee[_0x2695('0x1d')](_0x4eb111);return _0x2b27ee['set'](_0x2695('0x22'),_0x476504+'-'+_0x520a4c+'/'+_0x42bbe6)['json'](_0x2270d0);}return null;};}function patchUpdates(_0x377601){return function(_0x3f1e07){try{jsonpatch[_0x2695('0x23')](_0x3f1e07,_0x377601,!![]);}catch(_0x331157){return BPromise[_0x2695('0x24')](_0x331157);}return _0x3f1e07[_0x2695('0x25')]();};}function saveUpdates(_0x506681,_0x47aeb1){return function(_0x56b7b9){if(_0x56b7b9){return _0x56b7b9[_0x2695('0x26')](_0x506681)['then'](function(_0x2de07b){return _0x2de07b;});}return null;};}function removeEntity(_0x46eff7,_0x528064){return function(_0x82e342){if(_0x82e342){return _0x82e342[_0x2695('0x27')]()[_0x2695('0x28')](function(){var _0x56ec01=_0x82e342['get']({'plain':!![]});var _0x5cdaf1=_0x2695('0x29');return db['UserProfileResource'][_0x2695('0x27')]({'where':{'type':_0x5cdaf1,'resourceId':_0x56ec01['id']}})[_0x2695('0x28')](function(){return _0x82e342;});})[_0x2695('0x28')](function(){_0x46eff7[_0x2695('0x1d')](0xcc)[_0x2695('0x1e')]();});}};}function handleEntityNotFound(_0x1eb307,_0x2b117c){return function(_0x1b7320){if(!_0x1b7320){_0x1eb307[_0x2695('0x1c')](0x194);}return _0x1b7320;};}function handleError(_0x5e92e1,_0x3f258f){_0x3f258f=_0x3f258f||0x1f4;return function(_0x2842f6){logger['error'](_0x2842f6[_0x2695('0x2a')]);if(_0x2842f6[_0x2695('0x2b')]){delete _0x2842f6[_0x2695('0x2b')];}_0x5e92e1[_0x2695('0x1d')](_0x3f258f)['send'](_0x2842f6);};}exports[_0x2695('0x2c')]=function(_0x23735e,_0x5cc522){var _0x15c3e7={},_0x4a11e7={},_0x124797={'count':0x0,'rows':[]};var _0xa44419=_[_0x2695('0x2d')](db['CannedAnswer'][_0x2695('0x2e')],function(_0xf867ee){return{'name':_0xf867ee[_0x2695('0x2f')],'type':_0xf867ee[_0x2695('0x30')][_0x2695('0x31')]};});_0x4a11e7['model']=_[_0x2695('0x2d')](_0xa44419,_0x2695('0x2b'));_0x4a11e7['query']=_['keys'](_0x23735e[_0x2695('0x32')]);_0x4a11e7['filters']=_['intersection'](_0x4a11e7[_0x2695('0x33')],_0x4a11e7[_0x2695('0x32')]);_0x15c3e7[_0x2695('0x34')]=_[_0x2695('0x35')](_0x4a11e7[_0x2695('0x33')],qs[_0x2695('0x36')](_0x23735e[_0x2695('0x32')][_0x2695('0x36')]));_0x15c3e7[_0x2695('0x34')]=_0x15c3e7[_0x2695('0x34')][_0x2695('0x37')]?_0x15c3e7[_0x2695('0x34')]:_0x4a11e7['model'];if(!_0x23735e[_0x2695('0x32')][_0x2695('0x38')](_0x2695('0x39'))){_0x15c3e7[_0x2695('0x20')]=qs[_0x2695('0x20')](_0x23735e['query'][_0x2695('0x20')]);_0x15c3e7[_0x2695('0x21')]=qs['offset'](_0x23735e[_0x2695('0x32')]['offset']);}_0x15c3e7['order']=qs[_0x2695('0x3a')](_0x23735e[_0x2695('0x32')][_0x2695('0x3a')]);_0x15c3e7[_0x2695('0x3b')]=qs['filters'](_[_0x2695('0x3c')](_0x23735e['query'],_0x4a11e7[_0x2695('0x3d')]),_0xa44419);if(_0x23735e['query']['filter']){_0x15c3e7[_0x2695('0x3b')]=_[_0x2695('0x3e')](_0x15c3e7[_0x2695('0x3b')],{'$or':[{'key':{'$like':'%'+_0x23735e[_0x2695('0x32')][_0x2695('0x3f')]+'%'}},{'value':{'$like':'%'+_0x23735e['query']['filter']+'%'}}]});}_0x15c3e7=_['merge']({},_0x15c3e7,_0x23735e[_0x2695('0x40')]);var _0x2a62fb={'where':_0x15c3e7[_0x2695('0x3b')]};return db['CannedAnswer'][_0x2695('0x41')](_0x2a62fb)[_0x2695('0x28')](function(_0x216a24){_0x124797[_0x2695('0x41')]=_0x216a24;if(_0x23735e['query']['includeAll']){_0x15c3e7['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2695('0x42')](_0x15c3e7);})[_0x2695('0x28')](function(_0x39a5b3){_0x124797[_0x2695('0x43')]=_0x39a5b3;return _0x124797;})[_0x2695('0x28')](respondWithFilteredResult(_0x5cc522,_0x15c3e7))[_0x2695('0x44')](handleError(_0x5cc522,null));};exports[_0x2695('0x45')]=function(_0x9bb8fe,_0x44952f){var _0x5a4604={'raw':!![],'where':{'id':_0x9bb8fe['params']['id']}},_0x22364b={};_0x22364b[_0x2695('0x33')]=_[_0x2695('0x46')](db[_0x2695('0x47')][_0x2695('0x2e')]);_0x22364b[_0x2695('0x32')]=_[_0x2695('0x46')](_0x9bb8fe[_0x2695('0x32')]);_0x22364b[_0x2695('0x3d')]=_[_0x2695('0x35')](_0x22364b[_0x2695('0x33')],_0x22364b[_0x2695('0x32')]);_0x5a4604[_0x2695('0x34')]=_['intersection'](_0x22364b[_0x2695('0x33')],qs[_0x2695('0x36')](_0x9bb8fe[_0x2695('0x32')][_0x2695('0x36')]));_0x5a4604[_0x2695('0x34')]=_0x5a4604[_0x2695('0x34')]['length']?_0x5a4604[_0x2695('0x34')]:_0x22364b[_0x2695('0x33')];if(_0x9bb8fe[_0x2695('0x32')][_0x2695('0x48')]){_0x5a4604['include']=[{'all':!![]}];}_0x5a4604=_[_0x2695('0x3e')]({},_0x5a4604,_0x9bb8fe[_0x2695('0x40')]);return db['CannedAnswer'][_0x2695('0x49')](_0x5a4604)[_0x2695('0x28')](handleEntityNotFound(_0x44952f,null))[_0x2695('0x28')](respondWithResult(_0x44952f,null))[_0x2695('0x44')](handleError(_0x44952f,null));};exports[_0x2695('0x26')]=function(_0xcaeeea,_0x1e4eb5){if(_0xcaeeea[_0x2695('0x4a')]['id']){delete _0xcaeeea[_0x2695('0x4a')]['id'];}return db[_0x2695('0x47')][_0x2695('0x49')]({'where':{'id':_0xcaeeea['params']['id']}})[_0x2695('0x28')](handleEntityNotFound(_0x1e4eb5,null))[_0x2695('0x28')](saveUpdates(_0xcaeeea['body'],null))[_0x2695('0x28')](respondWithResult(_0x1e4eb5,null))[_0x2695('0x44')](handleError(_0x1e4eb5,null));};exports[_0x2695('0x27')]=function(_0x26bba5,_0x35bdad){return db[_0x2695('0x47')][_0x2695('0x49')]({'where':{'id':_0x26bba5[_0x2695('0x4b')]['id']}})[_0x2695('0x28')](handleEntityNotFound(_0x35bdad,null))[_0x2695('0x28')](removeEntity(_0x35bdad,null))[_0x2695('0x44')](handleError(_0x35bdad,null));};exports['create']=function(_0x3f4cc5,_0x2d50f2){var _0x39d297={'key':_0x3f4cc5[_0x2695('0x4a')][_0x2695('0x31')]};if(_0x3f4cc5[_0x2695('0x4a')][_0x2695('0x4c')]){_0x39d297[_0x2695('0x4c')]=_0x3f4cc5[_0x2695('0x4a')]['MailAccountId'];}else if(_0x3f4cc5['body'][_0x2695('0x4d')]){_0x39d297[_0x2695('0x4d')]=_0x3f4cc5['body'][_0x2695('0x4d')];}else if(_0x3f4cc5[_0x2695('0x4a')]['OpenchannelAccountId']){_0x39d297['OpenchannelAccountId']=_0x3f4cc5[_0x2695('0x4a')]['OpenchannelAccountId'];}else if(_0x3f4cc5[_0x2695('0x4a')]['ChatWebsiteId']){_0x39d297[_0x2695('0x4e')]=_0x3f4cc5[_0x2695('0x4a')]['ChatWebsiteId'];}return db[_0x2695('0x47')][_0x2695('0x49')]({'where':_0x39d297})[_0x2695('0x28')](function(_0x515416){if(_0x515416){throw new db[(_0x2695('0x4f'))][(_0x2695('0x50'))](_0x2695('0x51'));}return db[_0x2695('0x47')][_0x2695('0x52')](_0x3f4cc5[_0x2695('0x4a')]);})[_0x2695('0x28')](function(_0x27ef0d){var _0x5c85a3=_0x3f4cc5[_0x2695('0x53')]['get']({'plain':!![]});if(!_0x5c85a3)throw new Error(_0x2695('0x54'));if(_0x5c85a3[_0x2695('0x55')]==='user'){var _0x19fc00=_0x27ef0d[_0x2695('0x56')]({'plain':!![]});return db['UserProfileSection'][_0x2695('0x49')]({'where':{'name':_0x2695('0x29'),'userProfileId':_0x5c85a3[_0x2695('0x57')]},'raw':!![]})[_0x2695('0x28')](function(_0x3ced96){if(_0x3ced96&&_0x3ced96[_0x2695('0x58')]===0x0){return db[_0x2695('0x59')][_0x2695('0x52')]({'name':_0x19fc00[_0x2695('0x2b')],'resourceId':_0x19fc00['id'],'type':_0x3ced96[_0x2695('0x2b')],'sectionId':_0x3ced96['id']},{})[_0x2695('0x28')](function(){return _0x27ef0d;});}else{return _0x27ef0d;}})[_0x2695('0x44')](function(_0x4b53bc){logger[_0x2695('0x5a')](_0x2695('0x5b'),_0x4b53bc);throw _0x4b53bc;});}return _0x27ef0d;})[_0x2695('0x28')](respondWithResult(_0x2d50f2,0xc9))[_0x2695('0x44')](handleError(_0x2d50f2,null));}; \ No newline at end of file +var _0xf1d8=['params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1d8,0x171));var _0x8f1d=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0xf1d8[_0x3d00db];return _0x41f115;};'use strict';var emlformat=require(_0x8f1d('0x0'));var rimraf=require(_0x8f1d('0x1'));var zipdir=require(_0x8f1d('0x2'));var jsonpatch=require(_0x8f1d('0x3'));var rp=require(_0x8f1d('0x4'));var moment=require('moment');var BPromise=require(_0x8f1d('0x5'));var Mustache=require('mustache');var util=require(_0x8f1d('0x6'));var path=require(_0x8f1d('0x7'));var sox=require(_0x8f1d('0x8'));var csv=require(_0x8f1d('0x9'));var ejs=require(_0x8f1d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f1d('0xb'));var squel=require(_0x8f1d('0xc'));var crypto=require(_0x8f1d('0xd'));var jsforce=require(_0x8f1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8f1d('0x9'));var querystring=require(_0x8f1d('0xf'));var Papa=require(_0x8f1d('0x10'));var Redis=require(_0x8f1d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f1d('0x12'));var as=require(_0x8f1d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f1d('0x14'))(_0x8f1d('0x15'));var utils=require('../../config/utils');var config=require(_0x8f1d('0x16'));var licenseUtil=require(_0x8f1d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bd430,_0x3628b1){_0x3628b1=_0x3628b1||0xcc;return function(_0x1fe9c4){if(_0x1fe9c4){return _0x1bd430[_0x8f1d('0x18')](_0x3628b1);}return _0x1bd430[_0x8f1d('0x19')](_0x3628b1)[_0x8f1d('0x1a')]();};}function respondWithResult(_0x135571,_0x38a226){_0x38a226=_0x38a226||0xc8;return function(_0x5c6de0){if(_0x5c6de0){return _0x135571[_0x8f1d('0x19')](_0x38a226)[_0x8f1d('0x1b')](_0x5c6de0);}};}function respondWithFilteredResult(_0x4ae853,_0x526353){return function(_0x493c2e){if(_0x493c2e){var _0x2ea8e3=typeof _0x526353[_0x8f1d('0x1c')]==='undefined'&&typeof _0x526353[_0x8f1d('0x1d')]===_0x8f1d('0x1e');var _0x5de51a=_0x493c2e[_0x8f1d('0x1f')];var _0x5a551d=_0x2ea8e3?0x0:_0x526353[_0x8f1d('0x1c')];var _0x4c55a6=_0x2ea8e3?_0x493c2e[_0x8f1d('0x1f')]:_0x526353['offset']+_0x526353[_0x8f1d('0x1d')];var _0x5ef826;if(_0x4c55a6>=_0x5de51a){_0x4c55a6=_0x5de51a;_0x5ef826=0xc8;}else{_0x5ef826=0xce;}_0x4ae853[_0x8f1d('0x19')](_0x5ef826);return _0x4ae853[_0x8f1d('0x20')](_0x8f1d('0x21'),_0x5a551d+'-'+_0x4c55a6+'/'+_0x5de51a)['json'](_0x493c2e);}return null;};}function patchUpdates(_0x17df9b){return function(_0x11aaa8){try{jsonpatch[_0x8f1d('0x22')](_0x11aaa8,_0x17df9b,!![]);}catch(_0x1afc11){return BPromise[_0x8f1d('0x23')](_0x1afc11);}return _0x11aaa8[_0x8f1d('0x24')]();};}function saveUpdates(_0x3d5a74,_0x733c16){return function(_0x51de56){if(_0x51de56){return _0x51de56[_0x8f1d('0x25')](_0x3d5a74)['then'](function(_0x2a3296){return _0x2a3296;});}return null;};}function removeEntity(_0x1f56b1,_0x2a5b3e){return function(_0x18084f){if(_0x18084f){return _0x18084f[_0x8f1d('0x26')]()[_0x8f1d('0x27')](function(){var _0x43a5aa=_0x18084f[_0x8f1d('0x28')]({'plain':!![]});var _0x3463ab=_0x8f1d('0x29');return db[_0x8f1d('0x2a')][_0x8f1d('0x26')]({'where':{'type':_0x3463ab,'resourceId':_0x43a5aa['id']}})['then'](function(){return _0x18084f;});})[_0x8f1d('0x27')](function(){_0x1f56b1['status'](0xcc)[_0x8f1d('0x1a')]();});}};}function handleEntityNotFound(_0x3055c5,_0x50542a){return function(_0x335415){if(!_0x335415){_0x3055c5[_0x8f1d('0x18')](0x194);}return _0x335415;};}function handleError(_0x13f696,_0x8f6c76){_0x8f6c76=_0x8f6c76||0x1f4;return function(_0x26f2de){logger['error'](_0x26f2de[_0x8f1d('0x2b')]);if(_0x26f2de[_0x8f1d('0x2c')]){delete _0x26f2de[_0x8f1d('0x2c')];}_0x13f696[_0x8f1d('0x19')](_0x8f6c76)['send'](_0x26f2de);};}exports['index']=function(_0x21e013,_0x2f7563){var _0x97fa8f={},_0x7ceb0f={},_0x14f1c8={'count':0x0,'rows':[]};var _0x8c0ef=_[_0x8f1d('0x2d')](db[_0x8f1d('0x2e')][_0x8f1d('0x2f')],function(_0x3c4d2d){return{'name':_0x3c4d2d[_0x8f1d('0x30')],'type':_0x3c4d2d[_0x8f1d('0x31')][_0x8f1d('0x32')]};});_0x7ceb0f[_0x8f1d('0x33')]=_['map'](_0x8c0ef,_0x8f1d('0x2c'));_0x7ceb0f['query']=_[_0x8f1d('0x34')](_0x21e013[_0x8f1d('0x35')]);_0x7ceb0f[_0x8f1d('0x36')]=_[_0x8f1d('0x37')](_0x7ceb0f[_0x8f1d('0x33')],_0x7ceb0f[_0x8f1d('0x35')]);_0x97fa8f[_0x8f1d('0x38')]=_[_0x8f1d('0x37')](_0x7ceb0f[_0x8f1d('0x33')],qs[_0x8f1d('0x39')](_0x21e013[_0x8f1d('0x35')][_0x8f1d('0x39')]));_0x97fa8f[_0x8f1d('0x38')]=_0x97fa8f[_0x8f1d('0x38')][_0x8f1d('0x3a')]?_0x97fa8f[_0x8f1d('0x38')]:_0x7ceb0f['model'];if(!_0x21e013[_0x8f1d('0x35')]['hasOwnProperty'](_0x8f1d('0x3b'))){_0x97fa8f[_0x8f1d('0x1d')]=qs[_0x8f1d('0x1d')](_0x21e013[_0x8f1d('0x35')][_0x8f1d('0x1d')]);_0x97fa8f[_0x8f1d('0x1c')]=qs[_0x8f1d('0x1c')](_0x21e013[_0x8f1d('0x35')]['offset']);}_0x97fa8f[_0x8f1d('0x3c')]=qs['sort'](_0x21e013[_0x8f1d('0x35')][_0x8f1d('0x3d')]);_0x97fa8f[_0x8f1d('0x3e')]=qs[_0x8f1d('0x36')](_[_0x8f1d('0x3f')](_0x21e013[_0x8f1d('0x35')],_0x7ceb0f[_0x8f1d('0x36')]),_0x8c0ef);if(_0x21e013['query'][_0x8f1d('0x40')]){_0x97fa8f[_0x8f1d('0x3e')]=_[_0x8f1d('0x41')](_0x97fa8f[_0x8f1d('0x3e')],{'$or':[{'key':{'$like':'%'+_0x21e013[_0x8f1d('0x35')][_0x8f1d('0x40')]+'%'}},{'value':{'$like':'%'+_0x21e013[_0x8f1d('0x35')][_0x8f1d('0x40')]+'%'}}]});}_0x97fa8f=_[_0x8f1d('0x41')]({},_0x97fa8f,_0x21e013[_0x8f1d('0x42')]);var _0x306ece={'where':_0x97fa8f[_0x8f1d('0x3e')]};return db[_0x8f1d('0x2e')][_0x8f1d('0x1f')](_0x306ece)[_0x8f1d('0x27')](function(_0x278cf2){_0x14f1c8[_0x8f1d('0x1f')]=_0x278cf2;if(_0x21e013[_0x8f1d('0x35')][_0x8f1d('0x43')]){_0x97fa8f[_0x8f1d('0x44')]=[{'all':!![]}];}return db[_0x8f1d('0x2e')]['findAll'](_0x97fa8f);})[_0x8f1d('0x27')](function(_0x30600d){_0x14f1c8['rows']=_0x30600d;return _0x14f1c8;})['then'](respondWithFilteredResult(_0x2f7563,_0x97fa8f))[_0x8f1d('0x45')](handleError(_0x2f7563,null));};exports[_0x8f1d('0x46')]=function(_0x350a4d,_0x3ff54e){var _0x180819={'raw':!![],'where':{'id':_0x350a4d[_0x8f1d('0x47')]['id']}},_0x28b1d3={};_0x28b1d3[_0x8f1d('0x33')]=_[_0x8f1d('0x34')](db[_0x8f1d('0x2e')]['rawAttributes']);_0x28b1d3[_0x8f1d('0x35')]=_[_0x8f1d('0x34')](_0x350a4d[_0x8f1d('0x35')]);_0x28b1d3['filters']=_[_0x8f1d('0x37')](_0x28b1d3[_0x8f1d('0x33')],_0x28b1d3[_0x8f1d('0x35')]);_0x180819[_0x8f1d('0x38')]=_[_0x8f1d('0x37')](_0x28b1d3[_0x8f1d('0x33')],qs[_0x8f1d('0x39')](_0x350a4d[_0x8f1d('0x35')][_0x8f1d('0x39')]));_0x180819['attributes']=_0x180819['attributes'][_0x8f1d('0x3a')]?_0x180819[_0x8f1d('0x38')]:_0x28b1d3[_0x8f1d('0x33')];if(_0x350a4d['query'][_0x8f1d('0x43')]){_0x180819[_0x8f1d('0x44')]=[{'all':!![]}];}_0x180819=_[_0x8f1d('0x41')]({},_0x180819,_0x350a4d[_0x8f1d('0x42')]);return db[_0x8f1d('0x2e')][_0x8f1d('0x48')](_0x180819)[_0x8f1d('0x27')](handleEntityNotFound(_0x3ff54e,null))[_0x8f1d('0x27')](respondWithResult(_0x3ff54e,null))[_0x8f1d('0x45')](handleError(_0x3ff54e,null));};exports[_0x8f1d('0x25')]=function(_0x1e0826,_0x4e25ca){if(_0x1e0826[_0x8f1d('0x49')]['id']){delete _0x1e0826[_0x8f1d('0x49')]['id'];}return db[_0x8f1d('0x2e')]['find']({'where':{'id':_0x1e0826[_0x8f1d('0x47')]['id']}})[_0x8f1d('0x27')](handleEntityNotFound(_0x4e25ca,null))[_0x8f1d('0x27')](saveUpdates(_0x1e0826[_0x8f1d('0x49')],null))[_0x8f1d('0x27')](respondWithResult(_0x4e25ca,null))['catch'](handleError(_0x4e25ca,null));};exports['destroy']=function(_0x2f1625,_0xbd1ec8){return db['CannedAnswer']['find']({'where':{'id':_0x2f1625['params']['id']}})[_0x8f1d('0x27')](handleEntityNotFound(_0xbd1ec8,null))[_0x8f1d('0x27')](removeEntity(_0xbd1ec8,null))[_0x8f1d('0x45')](handleError(_0xbd1ec8,null));};exports[_0x8f1d('0x4a')]=function(_0x439235,_0x5074ab){var _0x4492c9={'key':_0x439235['body'][_0x8f1d('0x32')]};if(_0x439235[_0x8f1d('0x49')][_0x8f1d('0x4b')]){_0x4492c9['MailAccountId']=_0x439235[_0x8f1d('0x49')][_0x8f1d('0x4b')];}else if(_0x439235[_0x8f1d('0x49')][_0x8f1d('0x4c')]){_0x4492c9['SmsAccountId']=_0x439235['body']['SmsAccountId'];}else if(_0x439235['body'][_0x8f1d('0x4d')]){_0x4492c9[_0x8f1d('0x4d')]=_0x439235[_0x8f1d('0x49')][_0x8f1d('0x4d')];}else if(_0x439235[_0x8f1d('0x49')][_0x8f1d('0x4e')]){_0x4492c9['ChatWebsiteId']=_0x439235['body'][_0x8f1d('0x4e')];}return db[_0x8f1d('0x2e')][_0x8f1d('0x48')]({'where':_0x4492c9})[_0x8f1d('0x27')](function(_0x572174){if(_0x572174){throw new db['Sequelize'][(_0x8f1d('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x8f1d('0x2e')]['create'](_0x439235[_0x8f1d('0x49')]);})[_0x8f1d('0x27')](function(_0xd8385c){var _0xa00beb=_0x439235[_0x8f1d('0x50')][_0x8f1d('0x28')]({'plain':!![]});if(!_0xa00beb)throw new Error(_0x8f1d('0x51'));if(_0xa00beb[_0x8f1d('0x52')]===_0x8f1d('0x50')){var _0x5d4eb0=_0xd8385c['get']({'plain':!![]});return db[_0x8f1d('0x53')][_0x8f1d('0x48')]({'where':{'name':_0x8f1d('0x29'),'userProfileId':_0xa00beb[_0x8f1d('0x54')]},'raw':!![]})['then'](function(_0x4a1250){if(_0x4a1250&&_0x4a1250[_0x8f1d('0x55')]===0x0){return db[_0x8f1d('0x2a')]['create']({'name':_0x5d4eb0['name'],'resourceId':_0x5d4eb0['id'],'type':_0x4a1250[_0x8f1d('0x2c')],'sectionId':_0x4a1250['id']},{})['then'](function(){return _0xd8385c;});}else{return _0xd8385c;}})[_0x8f1d('0x45')](function(_0x3f5189){logger[_0x8f1d('0x56')](_0x8f1d('0x57'),_0x3f5189);throw _0x3f5189;});}return _0xd8385c;})[_0x8f1d('0x27')](respondWithResult(_0x5074ab,0xc9))[_0x8f1d('0x45')](handleError(_0x5074ab,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 72a77ad..676c343 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 _0x7232=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','define'];(function(_0x5dbda2,_0x587e21){var _0xc5cfbe=function(_0x14c28a){while(--_0x14c28a){_0x5dbda2['push'](_0x5dbda2['shift']());}};_0xc5cfbe(++_0x587e21);}(_0x7232,0x13a));var _0x2723=function(_0x3c484c,_0x3f977c){_0x3c484c=_0x3c484c-0x0;var _0x15b3cd=_0x7232[_0x3c484c];return _0x15b3cd;};'use strict';var _=require(_0x2723('0x0'));var util=require('util');var logger=require(_0x2723('0x1'))(_0x2723('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2723('0x3'));var fs=require('fs');var path=require(_0x2723('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x188833,_0x45d0be){return _0x188833[_0x2723('0x5')](_0x2723('0x6'),attributes,{'tableName':_0x2723('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2723('0x8'),'collate':_0x2723('0x9')});}; \ No newline at end of file +var _0x5015=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','lodash','../../config/logger','moment'];(function(_0x15f4f0,_0x2d805b){var _0x4bbd93=function(_0xb6f887){while(--_0xb6f887){_0x15f4f0['push'](_0x15f4f0['shift']());}};_0x4bbd93(++_0x2d805b);}(_0x5015,0x1dd));var _0x5501=function(_0x504575,_0x1e1f2b){_0x504575=_0x504575-0x0;var _0x2e23d9=_0x5015[_0x504575];return _0x2e23d9;};'use strict';var _=require(_0x5501('0x0'));var util=require('util');var logger=require(_0x5501('0x1'))('api');var moment=require(_0x5501('0x2'));var BPromise=require('bluebird');var rp=require(_0x5501('0x3'));var fs=require('fs');var path=require(_0x5501('0x4'));var rimraf=require(_0x5501('0x5'));var config=require(_0x5501('0x6'));var attributes=require(_0x5501('0x7'));module['exports']=function(_0x3880f9,_0x30f989){return _0x3880f9[_0x5501('0x8')]('CannedAnswer',attributes,{'tableName':_0x5501('0x9'),'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 87a2306..b0e1b77 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(_0x41befa,_0x36847c){var _0x394472=function(_0x43e597){while(--_0x43e597){_0x41befa['push'](_0x41befa['shift']());}};_0x394472(++_0x36847c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xe670c4,_0x1bcb6a){var _0x358cab=function(_0x4933b6){while(--_0x4933b6){_0xe670c4['push'](_0xe670c4['shift']());}};_0x358cab(++_0x1bcb6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 23c82be..d0ab768 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 _0xd517=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0xd517,0x189));var _0x7d51=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0xd517[_0x56608c];return _0x3c7fb0;};'use strict';var multer=require(_0x7d51('0x0'));var util=require(_0x7d51('0x1'));var path=require(_0x7d51('0x2'));var timeout=require(_0x7d51('0x3'));var express=require(_0x7d51('0x4'));var router=express[_0x7d51('0x5')]();var fs_extra=require(_0x7d51('0x6'));var auth=require(_0x7d51('0x7'));var interaction=require(_0x7d51('0x8'));var config=require(_0x7d51('0x9'));var controller=require(_0x7d51('0xa'));router[_0x7d51('0xb')]('/',auth[_0x7d51('0xc')](),controller['index']);router[_0x7d51('0xb')](_0x7d51('0xd'),auth[_0x7d51('0xc')](),controller[_0x7d51('0xe')]);router[_0x7d51('0xf')]('/',auth[_0x7d51('0xc')](),controller['create']);router[_0x7d51('0x10')](_0x7d51('0xd'),auth[_0x7d51('0xc')](),controller[_0x7d51('0x11')]);router[_0x7d51('0x12')](_0x7d51('0xd'),auth[_0x7d51('0xc')](),controller[_0x7d51('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2d99=['../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x2d99,0xd5));var _0x92d9=function(_0x2c6267,_0x153dc8){_0x2c6267=_0x2c6267-0x0;var _0x418ecd=_0x2d99[_0x2c6267];return _0x418ecd;};'use strict';var multer=require(_0x92d9('0x0'));var util=require(_0x92d9('0x1'));var path=require('path');var timeout=require(_0x92d9('0x2'));var express=require(_0x92d9('0x3'));var router=express[_0x92d9('0x4')]();var fs_extra=require(_0x92d9('0x5'));var auth=require(_0x92d9('0x6'));var interaction=require(_0x92d9('0x7'));var config=require('../../config/environment');var controller=require(_0x92d9('0x8'));router[_0x92d9('0x9')]('/',auth[_0x92d9('0xa')](),controller['index']);router['get'](_0x92d9('0xb'),auth[_0x92d9('0xa')](),controller[_0x92d9('0xc')]);router[_0x92d9('0xd')]('/',auth['isAuthenticated'](),controller[_0x92d9('0xe')]);router[_0x92d9('0xf')](_0x92d9('0xb'),auth[_0x92d9('0xa')](),controller[_0x92d9('0x10')]);router[_0x92d9('0x11')]('/:id',auth[_0x92d9('0xa')](),controller[_0x92d9('0x12')]);module[_0x92d9('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5243afd..3c24a8e 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 _0x159b=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0xd77bf5,_0x42b453){var _0x48e838=function(_0x32d312){while(--_0x32d312){_0xd77bf5['push'](_0xd77bf5['shift']());}};_0x48e838(++_0x42b453);}(_0x159b,0x181));var _0xb159=function(_0x34badf,_0x5a6187){_0x34badf=_0x34badf-0x0;var _0x39ecd3=_0x159b[_0x34badf];return _0x39ecd3;};'use strict';var Sequelize=require(_0xb159('0x0'));module[_0xb159('0x1')]={'calldate':{'type':Sequelize[_0xb159('0x2')],'allowNull':![],'defaultValue':_0xb159('0x3')},'clid':{'type':Sequelize[_0xb159('0x4')]},'src':{'type':Sequelize[_0xb159('0x4')]},'dst':{'type':Sequelize[_0xb159('0x4')]},'dcontext':{'type':Sequelize[_0xb159('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xb159('0x4')]},'lastapp':{'type':Sequelize[_0xb159('0x4')]},'lastdata':{'type':Sequelize[_0xb159('0x4')]},'duration':{'type':Sequelize[_0xb159('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb159('0x4')]},'amaflags':{'type':Sequelize[_0xb159('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb159('0x4')]},'userfield':{'type':Sequelize[_0xb159('0x4')]},'uniqueid':{'type':Sequelize[_0xb159('0x4')]},'linkedid':{'type':Sequelize[_0xb159('0x4')]},'sequence':{'type':Sequelize[_0xb159('0x4')]},'peeraccount':{'type':Sequelize[_0xb159('0x4')]},'type':{'type':Sequelize[_0xb159('0x4')]},'tag':{'type':Sequelize[_0xb159('0x4')]}}; \ No newline at end of file +var _0x71f4=['INTEGER','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x3c7251,_0x412b17){var _0x469c9a=function(_0x1e3f5b){while(--_0x1e3f5b){_0x3c7251['push'](_0x3c7251['shift']());}};_0x469c9a(++_0x412b17);}(_0x71f4,0xf9));var _0x471f=function(_0x21962c,_0x489a42){_0x21962c=_0x21962c-0x0;var _0x3ca065=_0x71f4[_0x21962c];return _0x3ca065;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x471f('0x0')],'allowNull':![],'defaultValue':_0x471f('0x1')},'clid':{'type':Sequelize[_0x471f('0x2')]},'src':{'type':Sequelize[_0x471f('0x2')]},'dst':{'type':Sequelize[_0x471f('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x471f('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x471f('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x471f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x471f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x471f('0x2')]},'amaflags':{'type':Sequelize[_0x471f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x471f('0x2')]},'userfield':{'type':Sequelize[_0x471f('0x2')]},'uniqueid':{'type':Sequelize[_0x471f('0x2')]},'linkedid':{'type':Sequelize[_0x471f('0x2')]},'sequence':{'type':Sequelize[_0x471f('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'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 c7aea68..9cea36b 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 _0xfd87=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','filter','merge','where','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x466fb8,_0x50fedd){var _0x26a4a3=function(_0x417316){while(--_0x417316){_0x466fb8['push'](_0x466fb8['shift']());}};_0x26a4a3(++_0x50fedd);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7fd8('0x0'));var rimraf=require(_0x7fd8('0x1'));var zipdir=require(_0x7fd8('0x2'));var jsonpatch=require(_0x7fd8('0x3'));var rp=require(_0x7fd8('0x4'));var moment=require(_0x7fd8('0x5'));var BPromise=require(_0x7fd8('0x6'));var Mustache=require(_0x7fd8('0x7'));var util=require(_0x7fd8('0x8'));var path=require(_0x7fd8('0x9'));var sox=require(_0x7fd8('0xa'));var csv=require('to-csv');var ejs=require(_0x7fd8('0xb'));var fs=require('fs');var fs_extra=require(_0x7fd8('0xc'));var _=require('lodash');var squel=require(_0x7fd8('0xd'));var crypto=require(_0x7fd8('0xe'));var jsforce=require(_0x7fd8('0xf'));var deskjs=require(_0x7fd8('0x10'));var toCsv=require(_0x7fd8('0x11'));var querystring=require('querystring');var Papa=require(_0x7fd8('0x12'));var Redis=require(_0x7fd8('0x13'));var authService=require(_0x7fd8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fd8('0x15'))('api');var utils=require(_0x7fd8('0x16'));var config=require(_0x7fd8('0x17'));var licenseUtil=require(_0x7fd8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136770,_0x2cccdb){_0x2cccdb=_0x2cccdb||0xcc;return function(_0xe84aa7){if(_0xe84aa7){return _0x136770[_0x7fd8('0x19')](_0x2cccdb);}return _0x136770[_0x7fd8('0x1a')](_0x2cccdb)['end']();};}function respondWithResult(_0x1af365,_0x17a3a1){_0x17a3a1=_0x17a3a1||0xc8;return function(_0x1d481a){if(_0x1d481a){return _0x1af365[_0x7fd8('0x1a')](_0x17a3a1)[_0x7fd8('0x1b')](_0x1d481a);}};}function respondWithFilteredResult(_0x38d45a,_0x1a4a52){return function(_0x33c8f9){if(_0x33c8f9){var _0x2a8818=typeof _0x1a4a52[_0x7fd8('0x1c')]===_0x7fd8('0x1d')&&typeof _0x1a4a52['limit']==='undefined';var _0x5ca7f6=_0x33c8f9[_0x7fd8('0x1e')];var _0xce23dc=_0x2a8818?0x0:_0x1a4a52['offset'];var _0x39e301=_0x2a8818?_0x33c8f9[_0x7fd8('0x1e')]:_0x1a4a52[_0x7fd8('0x1c')]+_0x1a4a52[_0x7fd8('0x1f')];var _0x3ab724;if(_0x39e301>=_0x5ca7f6){_0x39e301=_0x5ca7f6;_0x3ab724=0xc8;}else{_0x3ab724=0xce;}_0x38d45a[_0x7fd8('0x1a')](_0x3ab724);return _0x38d45a[_0x7fd8('0x20')](_0x7fd8('0x21'),_0xce23dc+'-'+_0x39e301+'/'+_0x5ca7f6)['json'](_0x33c8f9);}return null;};}function patchUpdates(_0x34bc09){return function(_0x3b7b49){try{jsonpatch[_0x7fd8('0x22')](_0x3b7b49,_0x34bc09,!![]);}catch(_0x13417d){return BPromise[_0x7fd8('0x23')](_0x13417d);}return _0x3b7b49[_0x7fd8('0x24')]();};}function saveUpdates(_0x4f8563,_0xecd3f3){return function(_0x1d26d4){if(_0x1d26d4){return _0x1d26d4[_0x7fd8('0x25')](_0x4f8563)[_0x7fd8('0x26')](function(_0x52b71a){return _0x52b71a;});}return null;};}function removeEntity(_0x3f71a4,_0x402fa1){return function(_0x2e7520){if(_0x2e7520){return _0x2e7520[_0x7fd8('0x27')]()[_0x7fd8('0x26')](function(){_0x3f71a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3650cb,_0x6cccad){return function(_0xa273a7){if(!_0xa273a7){_0x3650cb[_0x7fd8('0x19')](0x194);}return _0xa273a7;};}function handleError(_0x17b86a,_0x50f34f){_0x50f34f=_0x50f34f||0x1f4;return function(_0x12bc21){logger[_0x7fd8('0x28')](_0x12bc21[_0x7fd8('0x29')]);if(_0x12bc21[_0x7fd8('0x2a')]){delete _0x12bc21[_0x7fd8('0x2a')];}_0x17b86a['status'](_0x50f34f)['send'](_0x12bc21);};}exports[_0x7fd8('0x2b')]=function(_0x2bd721,_0x3919b1){var _0x4319b8={},_0x573ed0={},_0x4fc63a={'count':0x0,'rows':[]};var _0x8f9a8e=_['map'](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')],function(_0x3df0a2){return{'name':_0x3df0a2['fieldName'],'type':_0x3df0a2[_0x7fd8('0x2e')]['key']};});_0x573ed0[_0x7fd8('0x2f')]=_[_0x7fd8('0x30')](_0x8f9a8e,_0x7fd8('0x2a'));_0x573ed0[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x2bd721[_0x7fd8('0x31')]);_0x573ed0[_0x7fd8('0x33')]=_['intersection'](_0x573ed0[_0x7fd8('0x2f')],_0x573ed0[_0x7fd8('0x31')]);_0x4319b8[_0x7fd8('0x34')]=_[_0x7fd8('0x35')](_0x573ed0[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x36')]));_0x4319b8['attributes']=_0x4319b8['attributes'][_0x7fd8('0x37')]?_0x4319b8[_0x7fd8('0x34')]:_0x573ed0[_0x7fd8('0x2f')];if(!_0x2bd721['query'][_0x7fd8('0x38')]('nolimit')){_0x4319b8['limit']=qs[_0x7fd8('0x1f')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1f')]);_0x4319b8[_0x7fd8('0x1c')]=qs[_0x7fd8('0x1c')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1c')]);}_0x4319b8[_0x7fd8('0x39')]=qs['sort'](_0x2bd721[_0x7fd8('0x31')]['sort']);_0x4319b8['where']=qs[_0x7fd8('0x33')](_['pick'](_0x2bd721['query'],_0x573ed0['filters']),_0x8f9a8e);if(_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]){_0x4319b8['where']=_[_0x7fd8('0x3b')](_0x4319b8[_0x7fd8('0x3c')],{'$or':_[_0x7fd8('0x30')](_0x8f9a8e,function(_0x5d8d3d){if(_0x5d8d3d['type']!=='VIRTUAL'){var _0x1cc1d5={};_0x1cc1d5[_0x5d8d3d[_0x7fd8('0x2a')]]={'$like':'%'+_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]+'%'};return _0x1cc1d5;}})});}_0x4319b8=_[_0x7fd8('0x3b')]({},_0x4319b8,_0x2bd721[_0x7fd8('0x3d')]);var _0x2b5abb={'where':_0x4319b8['where']};return db['Cdr']['count'](_0x2b5abb)[_0x7fd8('0x26')](function(_0x24a0f8){_0x4fc63a[_0x7fd8('0x1e')]=_0x24a0f8;if(_0x2bd721['query'][_0x7fd8('0x3e')]){_0x4319b8[_0x7fd8('0x3f')]=[{'all':!![]}];}return db[_0x7fd8('0x2c')][_0x7fd8('0x40')](_0x4319b8);})['then'](function(_0x2f480c){_0x4fc63a[_0x7fd8('0x41')]=_0x2f480c;return _0x4fc63a;})['then'](respondWithFilteredResult(_0x3919b1,_0x4319b8))[_0x7fd8('0x42')](handleError(_0x3919b1,null));};exports['show']=function(_0x92b45f,_0x2026aa){var _0x393174={'raw':!![],'where':{'id':_0x92b45f['params']['id']}},_0xffd29a={};_0xffd29a[_0x7fd8('0x2f')]=_[_0x7fd8('0x32')](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')]);_0xffd29a[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x92b45f['query']);_0xffd29a['filters']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],_0xffd29a[_0x7fd8('0x31')]);_0x393174['attributes']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x92b45f['query'][_0x7fd8('0x36')]));_0x393174[_0x7fd8('0x34')]=_0x393174[_0x7fd8('0x34')]['length']?_0x393174[_0x7fd8('0x34')]:_0xffd29a[_0x7fd8('0x2f')];if(_0x92b45f['query'][_0x7fd8('0x3e')]){_0x393174['include']=[{'all':!![]}];}_0x393174=_[_0x7fd8('0x3b')]({},_0x393174,_0x92b45f[_0x7fd8('0x3d')]);return db[_0x7fd8('0x2c')][_0x7fd8('0x43')](_0x393174)[_0x7fd8('0x26')](handleEntityNotFound(_0x2026aa,null))[_0x7fd8('0x26')](respondWithResult(_0x2026aa,null))[_0x7fd8('0x42')](handleError(_0x2026aa,null));};exports[_0x7fd8('0x44')]=function(_0x4c2784,_0x1666e7){return db['Cdr'][_0x7fd8('0x44')](_0x4c2784[_0x7fd8('0x45')],{})['then'](respondWithResult(_0x1666e7,0xc9))[_0x7fd8('0x42')](handleError(_0x1666e7,null));};exports[_0x7fd8('0x25')]=function(_0x5cbc91,_0x5e3a45){if(_0x5cbc91['body']['id']){delete _0x5cbc91[_0x7fd8('0x45')]['id'];}return db['Cdr'][_0x7fd8('0x43')]({'where':{'id':_0x5cbc91[_0x7fd8('0x46')]['id']}})[_0x7fd8('0x26')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0x26')](saveUpdates(_0x5cbc91[_0x7fd8('0x45')],null))['then'](respondWithResult(_0x5e3a45,null))['catch'](handleError(_0x5e3a45,null));};exports[_0x7fd8('0x27')]=function(_0x46c230,_0x6924a2){return db[_0x7fd8('0x2c')]['find']({'where':{'id':_0x46c230[_0x7fd8('0x46')]['id']}})['then'](handleEntityNotFound(_0x6924a2,null))[_0x7fd8('0x26')](removeEntity(_0x6924a2,null))[_0x7fd8('0x42')](handleError(_0x6924a2,null));};exports[_0x7fd8('0x47')]=function(_0x1a6a03,_0x32160c){return db[_0x7fd8('0x2c')][_0x7fd8('0x47')]()[_0x7fd8('0x26')](respondWithResult(_0x32160c,null))[_0x7fd8('0x42')](handleError(_0x32160c,null));}; \ No newline at end of file +var _0x2675=['limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','Cdr','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','create','body','update','params','describe','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x971b24,_0x2df2b3){var _0x43840c=function(_0x3f84b3){while(--_0x3f84b3){_0x971b24['push'](_0x971b24['shift']());}};_0x43840c(++_0x2df2b3);}(_0x2675,0x75));var _0x5267=function(_0xb05c3a,_0x3686ae){_0xb05c3a=_0xb05c3a-0x0;var _0x2e96d0=_0x2675[_0xb05c3a];return _0x2e96d0;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['Cdr'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['Cdr'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['create']=function(_0x12d6a8,_0x4ee826){return db['Cdr'][_0x5267('0x43')](_0x12d6a8[_0x5267('0x44')],{})['then'](respondWithResult(_0x4ee826,0xc9))['catch'](handleError(_0x4ee826,null));};exports[_0x5267('0x45')]=function(_0xe0439e,_0x3d2436){if(_0xe0439e[_0x5267('0x44')]['id']){delete _0xe0439e[_0x5267('0x44')]['id'];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'id':_0xe0439e[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x3d2436,null))[_0x5267('0x22')](saveUpdates(_0xe0439e[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0x3d2436,null))[_0x5267('0x3d')](handleError(_0x3d2436,null));};exports[_0x5267('0x21')]=function(_0x4f7f75,_0x8636d0){return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'id':_0x4f7f75['params']['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x8636d0,null))[_0x5267('0x22')](removeEntity(_0x8636d0,null))[_0x5267('0x3d')](handleError(_0x8636d0,null));};exports[_0x5267('0x47')]=function(_0x119546,_0x1457cf){return db['Cdr'][_0x5267('0x47')]()['then'](respondWithResult(_0x1457cf,null))[_0x5267('0x3d')](handleError(_0x1457cf,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c354bf5..079a4bf 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(_0x4dbdb1,_0x2d8a30){var _0x52a3ab=function(_0x3054c5){while(--_0x3054c5){_0x4dbdb1['push'](_0x4dbdb1['shift']());}};_0x52a3ab(++_0x2d8a30);}(_0x7a54,0x106));var _0x47a5=function(_0x1bd95a,_0x4827af){_0x1bd95a=_0x1bd95a-0x0;var _0x2f00fa=_0x7a54[_0x1bd95a];return _0x2f00fa;};'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(_0x1e4ee0,_0x439067){var _0x24b187=function(_0x40d49c){while(--_0x40d49c){_0x1e4ee0['push'](_0x1e4ee0['shift']());}};_0x24b187(++_0x439067);}(_0x7a54,0x106));var _0x47a5=function(_0x57cee4,_0x6a2ff4){_0x57cee4=_0x57cee4-0x0;var _0x2c4e53=_0x7a54[_0x57cee4];return _0x2c4e53;};'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 4a64180..d0be54e 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 _0x742a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x35c8aa,_0x34ac41){var _0x206a0a=function(_0x3b857d){while(--_0x3b857d){_0x35c8aa['push'](_0x35c8aa['shift']());}};_0x206a0a(++_0x34ac41);}(_0x742a,0x97));var _0xa742=function(_0x3a634e,_0x273db2){_0x3a634e=_0x3a634e-0x0;var _0x2ecddb=_0x742a[_0x3a634e];return _0x2ecddb;};'use strict';var _=require(_0xa742('0x0'));var util=require(_0xa742('0x1'));var moment=require('moment');var BPromise=require(_0xa742('0x2'));var rs=require(_0xa742('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa742('0x4'))['db'];var utils=require(_0xa742('0x5'));var logger=require(_0xa742('0x6'))(_0xa742('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa742('0x8')][_0xa742('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d4ec6,_0x37a4bb,_0x1d086f){return new BPromise(function(_0x39715e,_0x511658){return client[_0xa742('0xa')](_0x3d4ec6,_0x1d086f)[_0xa742('0xb')](function(_0x2c94a3){logger[_0xa742('0xc')](_0xa742('0xd'),_0x37a4bb,_0xa742('0xe'));logger['debug'](_0xa742('0xf'),_0x37a4bb,'request\x20sent',JSON[_0xa742('0x10')](_0x2c94a3));if(_0x2c94a3[_0xa742('0x11')]){if(_0x2c94a3['error'][_0xa742('0x12')]===0x1f4){logger[_0xa742('0x11')](_0xa742('0xd'),_0x37a4bb,_0x2c94a3[_0xa742('0x11')][_0xa742('0x13')]);return _0x511658(_0x2c94a3[_0xa742('0x11')][_0xa742('0x13')]);}logger[_0xa742('0x11')](_0xa742('0xd'),_0x37a4bb,_0x2c94a3[_0xa742('0x11')][_0xa742('0x13')]);return _0x39715e(_0x2c94a3['error'][_0xa742('0x13')]);}else{logger[_0xa742('0xc')](_0xa742('0xd'),_0x37a4bb,_0xa742('0xe'));_0x39715e(_0x2c94a3[_0xa742('0x14')][_0xa742('0x13')]);}})[_0xa742('0x15')](function(_0x20e214){logger['error']('Cdr,\x20%s,\x20%s',_0x37a4bb,_0x20e214);_0x511658(_0x20e214);});});} \ No newline at end of file +var _0x2415=['../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2415,0x1f1));var _0x5241=function(_0x1ad30f,_0x461038){_0x1ad30f=_0x1ad30f-0x0;var _0x7a388f=_0x2415[_0x1ad30f];return _0x7a388f;};'use strict';var _=require(_0x5241('0x0'));var util=require(_0x5241('0x1'));var moment=require(_0x5241('0x2'));var BPromise=require(_0x5241('0x3'));var rs=require(_0x5241('0x4'));var fs=require('fs');var Redis=require(_0x5241('0x5'));var db=require(_0x5241('0x6'))['db'];var utils=require(_0x5241('0x7'));var logger=require('../../config/logger')(_0x5241('0x8'));var config=require(_0x5241('0x9'));var jayson=require(_0x5241('0xa'));var client=jayson[_0x5241('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c9b96,_0x27f0f1,_0x109486){return new BPromise(function(_0x20604c,_0x1c88aa){return client[_0x5241('0xc')](_0x3c9b96,_0x109486)[_0x5241('0xd')](function(_0x57f164){logger[_0x5241('0xe')](_0x5241('0xf'),_0x27f0f1,_0x5241('0x10'));logger['debug'](_0x5241('0x11'),_0x27f0f1,'request\x20sent',JSON[_0x5241('0x12')](_0x57f164));if(_0x57f164[_0x5241('0x13')]){if(_0x57f164[_0x5241('0x13')]['code']===0x1f4){logger[_0x5241('0x13')](_0x5241('0xf'),_0x27f0f1,_0x57f164[_0x5241('0x13')]['message']);return _0x1c88aa(_0x57f164[_0x5241('0x13')][_0x5241('0x14')]);}logger[_0x5241('0x13')](_0x5241('0xf'),_0x27f0f1,_0x57f164[_0x5241('0x13')][_0x5241('0x14')]);return _0x20604c(_0x57f164[_0x5241('0x13')][_0x5241('0x14')]);}else{logger[_0x5241('0xe')]('Cdr,\x20%s,\x20%s',_0x27f0f1,_0x5241('0x10'));_0x20604c(_0x57f164['result'][_0x5241('0x14')]);}})[_0x5241('0x15')](function(_0x301752){logger[_0x5241('0x13')](_0x5241('0xf'),_0x27f0f1,_0x301752);_0x1c88aa(_0x301752);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index fdc71e2..4f8b74c 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x20e575,_0xdb70f3){var _0x14a78d=function(_0x5f4ab3){while(--_0x5f4ab3){_0x20e575['push'](_0x20e575['shift']());}};_0x14a78d(++_0xdb70f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x53377b,_0x166f23){_0x53377b=_0x53377b-0x0;var _0x39cba9=_0xb10b[_0x53377b];return _0x39cba9;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5cc30e,_0x2646b6){var _0x208c6d=function(_0x1abc53){while(--_0x1abc53){_0x5cc30e['push'](_0x5cc30e['shift']());}};_0x208c6d(++_0x2646b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1286b98..520accf 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 _0x38bd=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x491165,_0x4cebe9){var _0x551406=function(_0x3d7fd6){while(--_0x3d7fd6){_0x491165['push'](_0x491165['shift']());}};_0x551406(++_0x4cebe9);}(_0x38bd,0x7e));var _0xd38b=function(_0x1a7bde,_0x1803fb){_0x1a7bde=_0x1a7bde-0x0;var _0x12c6ca=_0x38bd[_0x1a7bde];return _0x12c6ca;};'use strict';var Sequelize=require(_0xd38b('0x0'));module[_0xd38b('0x1')]={'priority':{'type':Sequelize[_0xd38b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd38b('0x3')],'allowNull':![],'defaultValue':_0xd38b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd38b('0x3')]},'interval':{'type':Sequelize[_0xd38b('0x3')],'defaultValue':_0xd38b('0x5')}}; \ No newline at end of file +var _0x8f69=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x424106,_0x33ff55){var _0xd8928d=function(_0x1e7fce){while(--_0x1e7fce){_0x424106['push'](_0x424106['shift']());}};_0xd8928d(++_0x33ff55);}(_0x8f69,0x168));var _0x98f6=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x8f69[_0x54a761];return _0x37d1da;};'use strict';var Sequelize=require(_0x98f6('0x0'));module[_0x98f6('0x1')]={'priority':{'type':Sequelize[_0x98f6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x98f6('0x3')],'allowNull':![],'defaultValue':_0x98f6('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x98f6('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x98f6('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3dc5993..43754b1 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 _0x7072=['ChatApplication','query','keys','filters','model','attributes','intersection','fields','length','options','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','show','params'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7072,0x138));var _0x2707=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x7072[_0x5416db];return _0x243e35;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x3f6976,_0x171add){return function(_0x2ad386){if(!_0x2ad386){_0x3f6976[_0x2707('0x1a')](0x194);}return _0x2ad386;};}function handleError(_0x528b20,_0x2dce16){_0x2dce16=_0x2dce16||0x1f4;return function(_0x4ca05d){logger[_0x2707('0x2a')](_0x4ca05d[_0x2707('0x2b')]);if(_0x4ca05d[_0x2707('0x2c')]){delete _0x4ca05d['name'];}_0x528b20[_0x2707('0x1c')](_0x2dce16)[_0x2707('0x2d')](_0x4ca05d);};}exports[_0x2707('0x2e')]=function(_0x529be8,_0x31e990){var _0x42adf8={'raw':!![],'where':{'id':_0x529be8[_0x2707('0x2f')]['id']}},_0x4a99ce={};_0x4a99ce['model']=_['keys'](db[_0x2707('0x30')]['rawAttributes']);_0x4a99ce[_0x2707('0x31')]=_[_0x2707('0x32')](_0x529be8[_0x2707('0x31')]);_0x4a99ce[_0x2707('0x33')]=_['intersection'](_0x4a99ce[_0x2707('0x34')],_0x4a99ce[_0x2707('0x31')]);_0x42adf8[_0x2707('0x35')]=_[_0x2707('0x36')](_0x4a99ce[_0x2707('0x34')],qs[_0x2707('0x37')](_0x529be8[_0x2707('0x31')][_0x2707('0x37')]));_0x42adf8[_0x2707('0x35')]=_0x42adf8['attributes'][_0x2707('0x38')]?_0x42adf8[_0x2707('0x35')]:_0x4a99ce['model'];if(_0x529be8['query']['includeAll']){_0x42adf8['include']=[{'all':!![]}];}_0x42adf8=_['merge']({},_0x42adf8,_0x529be8[_0x2707('0x39')]);return db['ChatApplication']['find'](_0x42adf8)[_0x2707('0x29')](handleEntityNotFound(_0x31e990,null))[_0x2707('0x29')](respondWithResult(_0x31e990,null))['catch'](handleError(_0x31e990,null));};exports[_0x2707('0x27')]=function(_0x36993a,_0x5df463){if(_0x36993a['body']['id']){delete _0x36993a[_0x2707('0x3a')]['id'];}return db[_0x2707('0x30')]['find']({'where':{'id':_0x36993a['params']['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x5df463,null))[_0x2707('0x29')](saveUpdates(_0x36993a['body'],null))[_0x2707('0x29')](respondWithResult(_0x5df463,null))[_0x2707('0x3b')](handleError(_0x5df463,null));};exports[_0x2707('0x28')]=function(_0x2df9d5,_0x9943e8){return db[_0x2707('0x30')]['find']({'where':{'id':_0x2df9d5[_0x2707('0x2f')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x9943e8,null))[_0x2707('0x29')](removeEntity(_0x9943e8,null))[_0x2707('0x3b')](handleError(_0x9943e8,null));}; \ No newline at end of file +var _0x220b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','length','merge','options','find','catch','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x220b,0x1a2));var _0xb220=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x220b[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb220('0x0'));var zipdir=require(_0xb220('0x1'));var jsonpatch=require(_0xb220('0x2'));var rp=require(_0xb220('0x3'));var moment=require('moment');var BPromise=require(_0xb220('0x4'));var Mustache=require('mustache');var util=require(_0xb220('0x5'));var path=require('path');var sox=require(_0xb220('0x6'));var csv=require(_0xb220('0x7'));var ejs=require(_0xb220('0x8'));var fs=require('fs');var fs_extra=require(_0xb220('0x9'));var _=require('lodash');var squel=require(_0xb220('0xa'));var crypto=require(_0xb220('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xc'));var toCsv=require(_0xb220('0x7'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require(_0xb220('0xf'));var authService=require(_0xb220('0x10'));var qs=require(_0xb220('0x11'));var as=require(_0xb220('0x12'));var hardwareService=require(_0xb220('0x13'));var logger=require('../../config/logger')(_0xb220('0x14'));var utils=require(_0xb220('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x528ce0,_0x59ef3e){_0x59ef3e=_0x59ef3e||0xcc;return function(_0x11229c){if(_0x11229c){return _0x528ce0['sendStatus'](_0x59ef3e);}return _0x528ce0[_0xb220('0x16')](_0x59ef3e)[_0xb220('0x17')]();};}function respondWithResult(_0x378a3b,_0x312c59){_0x312c59=_0x312c59||0xc8;return function(_0x576649){if(_0x576649){return _0x378a3b['status'](_0x312c59)[_0xb220('0x18')](_0x576649);}};}function respondWithFilteredResult(_0x1db409,_0x159eb7){return function(_0x2ee3d2){if(_0x2ee3d2){var _0x16a34b=typeof _0x159eb7[_0xb220('0x19')]===_0xb220('0x1a')&&typeof _0x159eb7[_0xb220('0x1b')]===_0xb220('0x1a');var _0x1416de=_0x2ee3d2[_0xb220('0x1c')];var _0x464ceb=_0x16a34b?0x0:_0x159eb7[_0xb220('0x19')];var _0x21cf2d=_0x16a34b?_0x2ee3d2[_0xb220('0x1c')]:_0x159eb7[_0xb220('0x19')]+_0x159eb7[_0xb220('0x1b')];var _0x1cc822;if(_0x21cf2d>=_0x1416de){_0x21cf2d=_0x1416de;_0x1cc822=0xc8;}else{_0x1cc822=0xce;}_0x1db409[_0xb220('0x16')](_0x1cc822);return _0x1db409[_0xb220('0x1d')](_0xb220('0x1e'),_0x464ceb+'-'+_0x21cf2d+'/'+_0x1416de)[_0xb220('0x18')](_0x2ee3d2);}return null;};}function patchUpdates(_0x213736){return function(_0x358035){try{jsonpatch['apply'](_0x358035,_0x213736,!![]);}catch(_0x45b406){return BPromise['reject'](_0x45b406);}return _0x358035[_0xb220('0x1f')]();};}function saveUpdates(_0x5c4d46,_0x3a1ad7){return function(_0x501f0f){if(_0x501f0f){return _0x501f0f[_0xb220('0x20')](_0x5c4d46)[_0xb220('0x21')](function(_0x2ddf73){return _0x2ddf73;});}return null;};}function removeEntity(_0x2f5a0d,_0x396c72){return function(_0x2975ff){if(_0x2975ff){return _0x2975ff['destroy']()[_0xb220('0x21')](function(){_0x2f5a0d[_0xb220('0x16')](0xcc)[_0xb220('0x17')]();});}};}function handleEntityNotFound(_0x1849c8,_0x180b94){return function(_0x4d83aa){if(!_0x4d83aa){_0x1849c8[_0xb220('0x22')](0x194);}return _0x4d83aa;};}function handleError(_0x30b75b,_0x57768e){_0x57768e=_0x57768e||0x1f4;return function(_0x2b9b1a){logger[_0xb220('0x23')](_0x2b9b1a[_0xb220('0x24')]);if(_0x2b9b1a[_0xb220('0x25')]){delete _0x2b9b1a[_0xb220('0x25')];}_0x30b75b[_0xb220('0x16')](_0x57768e)['send'](_0x2b9b1a);};}exports[_0xb220('0x26')]=function(_0x54c1b9,_0x589e07){var _0x181b14={'raw':!![],'where':{'id':_0x54c1b9[_0xb220('0x27')]['id']}},_0x1a9b82={};_0x1a9b82[_0xb220('0x28')]=_[_0xb220('0x29')](db[_0xb220('0x2a')][_0xb220('0x2b')]);_0x1a9b82[_0xb220('0x2c')]=_[_0xb220('0x29')](_0x54c1b9[_0xb220('0x2c')]);_0x1a9b82['filters']=_[_0xb220('0x2d')](_0x1a9b82[_0xb220('0x28')],_0x1a9b82[_0xb220('0x2c')]);_0x181b14['attributes']=_['intersection'](_0x1a9b82[_0xb220('0x28')],qs['fields'](_0x54c1b9['query']['fields']));_0x181b14[_0xb220('0x2e')]=_0x181b14[_0xb220('0x2e')][_0xb220('0x2f')]?_0x181b14[_0xb220('0x2e')]:_0x1a9b82[_0xb220('0x28')];if(_0x54c1b9[_0xb220('0x2c')]['includeAll']){_0x181b14['include']=[{'all':!![]}];}_0x181b14=_[_0xb220('0x30')]({},_0x181b14,_0x54c1b9[_0xb220('0x31')]);return db['ChatApplication'][_0xb220('0x32')](_0x181b14)['then'](handleEntityNotFound(_0x589e07,null))[_0xb220('0x21')](respondWithResult(_0x589e07,null))[_0xb220('0x33')](handleError(_0x589e07,null));};exports[_0xb220('0x20')]=function(_0x5e4c0a,_0x1ed281){if(_0x5e4c0a['body']['id']){delete _0x5e4c0a['body']['id'];}return db['ChatApplication'][_0xb220('0x32')]({'where':{'id':_0x5e4c0a['params']['id']}})[_0xb220('0x21')](handleEntityNotFound(_0x1ed281,null))[_0xb220('0x21')](saveUpdates(_0x5e4c0a[_0xb220('0x34')],null))['then'](respondWithResult(_0x1ed281,null))['catch'](handleError(_0x1ed281,null));};exports[_0xb220('0x35')]=function(_0x4f385e,_0xb3cff4){return db[_0xb220('0x2a')]['find']({'where':{'id':_0x4f385e[_0xb220('0x27')]['id']}})[_0xb220('0x21')](handleEntityNotFound(_0xb3cff4,null))[_0xb220('0x21')](removeEntity(_0xb3cff4,null))[_0xb220('0x33')](handleError(_0xb3cff4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index b2e03e0..5b3bee6 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 _0xc3a6=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3a6,0x116));var _0x6c3a=function(_0x367e58,_0x2a9e49){_0x367e58=_0x367e58-0x0;var _0x37a2c5=_0xc3a6[_0x367e58];return _0x37a2c5;};'use strict';var _=require(_0x6c3a('0x0'));var util=require('util');var logger=require(_0x6c3a('0x1'))(_0x6c3a('0x2'));var moment=require(_0x6c3a('0x3'));var BPromise=require(_0x6c3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c3a('0x5'));var rimraf=require(_0x6c3a('0x6'));var config=require(_0x6c3a('0x7'));var attributes=require(_0x6c3a('0x8'));module[_0x6c3a('0x9')]=function(_0x65b400,_0x543cc9){return _0x65b400[_0x6c3a('0xa')](_0x6c3a('0xb'),attributes,{'tableName':_0x6c3a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c3a('0xd'),'collate':_0x6c3a('0xe')});}; \ No newline at end of file +var _0x9435=['api','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9435,0x93));var _0x5943=function(_0x5a5d73,_0x2f215d){_0x5a5d73=_0x5a5d73-0x0;var _0x36a276=_0x9435[_0x5a5d73];return _0x36a276;};'use strict';var _=require(_0x5943('0x0'));var util=require(_0x5943('0x1'));var logger=require(_0x5943('0x2'))(_0x5943('0x3'));var moment=require('moment');var BPromise=require(_0x5943('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5943('0x5'));var rimraf=require(_0x5943('0x6'));var config=require(_0x5943('0x7'));var attributes=require(_0x5943('0x8'));module[_0x5943('0x9')]=function(_0x42f32e,_0x114c6c){return _0x42f32e[_0x5943('0xa')](_0x5943('0xb'),attributes,{'tableName':_0x5943('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5943('0xd'),'collate':_0x5943('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1c826f3..385b58c 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 _0x992e=['then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x955cb2,_0x26cab7){var _0x5bbfb0=function(_0x25506a){while(--_0x25506a){_0x955cb2['push'](_0x955cb2['shift']());}};_0x5bbfb0(++_0x26cab7);}(_0x992e,0x114));var _0xe992=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0x992e[_0x323419];return _0x4c0be7;};'use strict';var _=require('lodash');var util=require(_0xe992('0x0'));var moment=require(_0xe992('0x1'));var BPromise=require(_0xe992('0x2'));var rs=require(_0xe992('0x3'));var fs=require('fs');var Redis=require(_0xe992('0x4'));var db=require(_0xe992('0x5'))['db'];var utils=require(_0xe992('0x6'));var logger=require(_0xe992('0x7'))(_0xe992('0x8'));var config=require(_0xe992('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe992('0xa')][_0xe992('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a4b57,_0x235e0a,_0x4cc544){return new BPromise(function(_0x2ffabd,_0x25592b){return client['request'](_0x4a4b57,_0x4cc544)[_0xe992('0xc')](function(_0x279136){logger[_0xe992('0xd')]('ChatApplication,\x20%s,\x20%s',_0x235e0a,_0xe992('0xe'));logger[_0xe992('0xf')](_0xe992('0x10'),_0x235e0a,'request\x20sent',JSON[_0xe992('0x11')](_0x279136));if(_0x279136['error']){if(_0x279136[_0xe992('0x12')][_0xe992('0x13')]===0x1f4){logger['error'](_0xe992('0x14'),_0x235e0a,_0x279136[_0xe992('0x12')][_0xe992('0x15')]);return _0x25592b(_0x279136[_0xe992('0x12')][_0xe992('0x15')]);}logger[_0xe992('0x12')](_0xe992('0x14'),_0x235e0a,_0x279136['error'][_0xe992('0x15')]);return _0x2ffabd(_0x279136['error'][_0xe992('0x15')]);}else{logger[_0xe992('0xd')](_0xe992('0x14'),_0x235e0a,_0xe992('0xe'));_0x2ffabd(_0x279136[_0xe992('0x16')][_0xe992('0x15')]);}})[_0xe992('0x17')](function(_0x5c1f05){logger[_0xe992('0x12')](_0xe992('0x14'),_0x235e0a,_0x5c1f05);_0x25592b(_0x5c1f05);});});} \ No newline at end of file +var _0x1955=['bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x43af74,_0x41b94b){var _0x594972=function(_0x47a765){while(--_0x47a765){_0x43af74['push'](_0x43af74['shift']());}};_0x594972(++_0x41b94b);}(_0x1955,0x12f));var _0x5195=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1955[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x5195('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5195('0x1'));var rs=require(_0x5195('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5195('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5195('0x4'));var config=require(_0x5195('0x5'));var jayson=require(_0x5195('0x6'));var client=jayson[_0x5195('0x7')][_0x5195('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2846db,_0x47e54f,_0x1e6bc7){return new BPromise(function(_0x8a6769,_0x23200d){return client['request'](_0x2846db,_0x1e6bc7)[_0x5195('0x9')](function(_0x55ddf3){logger['info'](_0x5195('0xa'),_0x47e54f,_0x5195('0xb'));logger[_0x5195('0xc')](_0x5195('0xd'),_0x47e54f,_0x5195('0xb'),JSON['stringify'](_0x55ddf3));if(_0x55ddf3[_0x5195('0xe')]){if(_0x55ddf3[_0x5195('0xe')][_0x5195('0xf')]===0x1f4){logger[_0x5195('0xe')]('ChatApplication,\x20%s,\x20%s',_0x47e54f,_0x55ddf3[_0x5195('0xe')][_0x5195('0x10')]);return _0x23200d(_0x55ddf3[_0x5195('0xe')][_0x5195('0x10')]);}logger[_0x5195('0xe')](_0x5195('0xa'),_0x47e54f,_0x55ddf3[_0x5195('0xe')][_0x5195('0x10')]);return _0x8a6769(_0x55ddf3[_0x5195('0xe')]['message']);}else{logger['info'](_0x5195('0xa'),_0x47e54f,'request\x20sent');_0x8a6769(_0x55ddf3[_0x5195('0x11')]['message']);}})[_0x5195('0x12')](function(_0x1cebcd){logger['error'](_0x5195('0xa'),_0x47e54f,_0x1cebcd);_0x23200d(_0x1cebcd);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 337bafc..ce46a5d 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 _0x5514=['fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','delete','exports','multer','util','express','Router'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x5514,0x1d8));var _0x4551=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x5514[_0x5a2285];return _0x48f6ed;};'use strict';var multer=require(_0x4551('0x0'));var util=require(_0x4551('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4551('0x2'));var router=express[_0x4551('0x3')]();var fs_extra=require(_0x4551('0x4'));var auth=require(_0x4551('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4551('0x6'));var controller=require(_0x4551('0x7'));router['get'](_0x4551('0x8'),auth[_0x4551('0x9')](),controller[_0x4551('0xa')]);router[_0x4551('0xb')](_0x4551('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x4551('0xc')](_0x4551('0x8'),auth[_0x4551('0x9')](),controller['destroy']);module[_0x4551('0xd')]=router; \ No newline at end of file +var _0x0946=['./chatApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0946,0x140));var _0x6094=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x0946[_0x136619];return _0x38c4a5;};'use strict';var multer=require(_0x6094('0x0'));var util=require('util');var path=require(_0x6094('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6094('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6094('0x3'));var interaction=require(_0x6094('0x4'));var config=require('../../config/environment');var controller=require(_0x6094('0x5'));router[_0x6094('0x6')](_0x6094('0x7'),auth['isAuthenticated'](),controller[_0x6094('0x8')]);router['put'](_0x6094('0x7'),auth[_0x6094('0x9')](),controller[_0x6094('0xa')]);router[_0x6094('0xb')]('/:id',auth[_0x6094('0x9')](),controller[_0x6094('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 6146cb5..8288f8c 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 _0x3e0c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x6d193c,_0x3d8855){var _0x12ec4a=function(_0x1fb8bb){while(--_0x1fb8bb){_0x6d193c['push'](_0x6d193c['shift']());}};_0x12ec4a(++_0x3d8855);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x19e0f0,_0x2fa57f){_0x19e0f0=_0x19e0f0-0x0;var _0xb46f54=_0x3e0c[_0x19e0f0];return _0xb46f54;};'use strict';var Sequelize=require(_0xc3e0('0x0'));module[_0xc3e0('0x1')]={'name':{'type':Sequelize[_0xc3e0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xc3e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb6ba=['sequelize','exports','STRING','BOOLEAN'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0xb6ba,0x180));var _0xab6b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xb6ba[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xab6b('0x0'));module[_0xab6b('0x1')]={'name':{'type':Sequelize[_0xab6b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xab6b('0x2')]},'write':{'type':Sequelize[_0xab6b('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 3d3b4e9..c054d36 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 _0x01db=['fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','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','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','rows','keys','catch','create','body','update','find','describe','ChatInternalMessage','params','addMembers','ids','omit','findOne','User','order','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x01db,0x117));var _0xb01d=function(_0x16cfd1,_0x196a00){_0x16cfd1=_0x16cfd1-0x0;var _0x2facf7=_0x01db[_0x16cfd1];return _0x2facf7;};'use strict';var emlformat=require(_0xb01d('0x0'));var rimraf=require(_0xb01d('0x1'));var zipdir=require(_0xb01d('0x2'));var jsonpatch=require(_0xb01d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb01d('0x4'));var path=require(_0xb01d('0x5'));var sox=require(_0xb01d('0x6'));var csv=require(_0xb01d('0x7'));var ejs=require(_0xb01d('0x8'));var fs=require('fs');var fs_extra=require(_0xb01d('0x9'));var _=require(_0xb01d('0xa'));var squel=require(_0xb01d('0xb'));var crypto=require(_0xb01d('0xc'));var jsforce=require(_0xb01d('0xd'));var deskjs=require(_0xb01d('0xe'));var toCsv=require(_0xb01d('0x7'));var querystring=require(_0xb01d('0xf'));var Papa=require(_0xb01d('0x10'));var Redis=require('ioredis');var authService=require(_0xb01d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb01d('0x12'));var hardwareService=require(_0xb01d('0x13'));var logger=require(_0xb01d('0x14'))('api');var utils=require(_0xb01d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb01d('0x16'));var db=require(_0xb01d('0x17'))['db'];config[_0xb01d('0x18')]=_['defaults'](config['redis'],{'host':_0xb01d('0x19'),'port':0x18eb});var socket=require(_0xb01d('0x1a'))(new Redis(config[_0xb01d('0x18')]));require(_0xb01d('0x1b'))['register'](socket);function respondWithStatusCode(_0x55f956,_0x2535be){_0x2535be=_0x2535be||0xcc;return function(_0x2555c9){if(_0x2555c9){return _0x55f956[_0xb01d('0x1c')](_0x2535be);}return _0x55f956[_0xb01d('0x1d')](_0x2535be)[_0xb01d('0x1e')]();};}function respondWithResult(_0x3070b6,_0x135822){_0x135822=_0x135822||0xc8;return function(_0x2be6fc){if(_0x2be6fc){return _0x3070b6[_0xb01d('0x1d')](_0x135822)['json'](_0x2be6fc);}};}function respondWithFilteredResult(_0x37eb3c,_0x58054f){return function(_0xe28a74){if(_0xe28a74){var _0x240c80=typeof _0x58054f[_0xb01d('0x1f')]===_0xb01d('0x20')&&typeof _0x58054f[_0xb01d('0x21')]===_0xb01d('0x20');var _0x2f8e18=_0xe28a74[_0xb01d('0x22')];var _0x185564=_0x240c80?0x0:_0x58054f['offset'];var _0x38cba2=_0x240c80?_0xe28a74[_0xb01d('0x22')]:_0x58054f[_0xb01d('0x1f')]+_0x58054f[_0xb01d('0x21')];var _0x45de36;if(_0x38cba2>=_0x2f8e18){_0x38cba2=_0x2f8e18;_0x45de36=0xc8;}else{_0x45de36=0xce;}_0x37eb3c[_0xb01d('0x1d')](_0x45de36);return _0x37eb3c[_0xb01d('0x23')](_0xb01d('0x24'),_0x185564+'-'+_0x38cba2+'/'+_0x2f8e18)[_0xb01d('0x25')](_0xe28a74);}return null;};}function patchUpdates(_0x1521b6){return function(_0x148eb8){try{jsonpatch[_0xb01d('0x26')](_0x148eb8,_0x1521b6,!![]);}catch(_0x415ff2){return BPromise[_0xb01d('0x27')](_0x415ff2);}return _0x148eb8[_0xb01d('0x28')]();};}function saveUpdates(_0x11b42a,_0x4b2e28){return function(_0x40bcf1){if(_0x40bcf1){return _0x40bcf1['update'](_0x11b42a)['then'](function(_0x530c9a){return _0x530c9a;});}return null;};}function removeEntity(_0x21a106,_0x74379){return function(_0xade3bc){if(_0xade3bc){return _0xade3bc[_0xb01d('0x29')]()[_0xb01d('0x2a')](function(){_0x21a106['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ecde,_0x5770be){return function(_0x424c6d){if(!_0x424c6d){_0x55ecde[_0xb01d('0x1c')](0x194);}return _0x424c6d;};}function handleError(_0x38fb98,_0x5ce89a){_0x5ce89a=_0x5ce89a||0x1f4;return function(_0x48c617){logger['error'](_0x48c617[_0xb01d('0x2b')]);if(_0x48c617[_0xb01d('0x2c')]){delete _0x48c617['name'];}_0x38fb98['status'](_0x5ce89a)['send'](_0x48c617);};}exports[_0xb01d('0x2d')]=function(_0x5dea29,_0xcdf90){var _0x5b202d={},_0x897ebc={},_0x5df5c0={'count':0x0,'rows':[]};var _0x2a045a=_[_0xb01d('0x2e')](db['ChatGroup'][_0xb01d('0x2f')],function(_0x175276){return{'name':_0x175276[_0xb01d('0x30')],'type':_0x175276[_0xb01d('0x31')]['key']};});_0x897ebc['model']=_['map'](_0x2a045a,_0xb01d('0x2c'));_0x897ebc[_0xb01d('0x32')]=_['keys'](_0x5dea29[_0xb01d('0x32')]);_0x897ebc[_0xb01d('0x33')]=_['intersection'](_0x897ebc[_0xb01d('0x34')],_0x897ebc[_0xb01d('0x32')]);_0x5b202d[_0xb01d('0x35')]=_[_0xb01d('0x36')](_0x897ebc[_0xb01d('0x34')],qs[_0xb01d('0x37')](_0x5dea29['query']['fields']));_0x5b202d[_0xb01d('0x35')]=_0x5b202d[_0xb01d('0x35')][_0xb01d('0x38')]?_0x5b202d[_0xb01d('0x35')]:_0x897ebc[_0xb01d('0x34')];if(!_0x5dea29[_0xb01d('0x32')][_0xb01d('0x39')]('nolimit')){_0x5b202d[_0xb01d('0x21')]=qs[_0xb01d('0x21')](_0x5dea29[_0xb01d('0x32')][_0xb01d('0x21')]);_0x5b202d['offset']=qs[_0xb01d('0x1f')](_0x5dea29[_0xb01d('0x32')][_0xb01d('0x1f')]);}_0x5b202d['order']=qs[_0xb01d('0x3a')](_0x5dea29[_0xb01d('0x32')][_0xb01d('0x3a')]);_0x5b202d[_0xb01d('0x3b')]=qs['filters'](_[_0xb01d('0x3c')](_0x5dea29['query'],_0x897ebc[_0xb01d('0x33')]),_0x2a045a);if(_0x5dea29[_0xb01d('0x32')][_0xb01d('0x3d')]){_0x5b202d[_0xb01d('0x3b')]=_[_0xb01d('0x3e')](_0x5b202d[_0xb01d('0x3b')],{'$or':_[_0xb01d('0x2e')](_0x2a045a,function(_0x46334a){if(_0x46334a['type']!==_0xb01d('0x3f')){var _0x1de7da={};_0x1de7da[_0x46334a[_0xb01d('0x2c')]]={'$like':'%'+_0x5dea29['query'][_0xb01d('0x3d')]+'%'};return _0x1de7da;}})});}_0x5b202d=_[_0xb01d('0x3e')]({},_0x5b202d,_0x5dea29[_0xb01d('0x40')]);var _0x5f1273={'where':_0x5b202d[_0xb01d('0x3b')]};return db[_0xb01d('0x41')][_0xb01d('0x22')](_0x5f1273)[_0xb01d('0x2a')](function(_0x43d72a){_0x5df5c0[_0xb01d('0x22')]=_0x43d72a;if(_0x5dea29[_0xb01d('0x32')][_0xb01d('0x42')]){_0x5b202d[_0xb01d('0x43')]=[{'all':!![]}];}return db[_0xb01d('0x41')][_0xb01d('0x44')](_0x5b202d);})[_0xb01d('0x2a')](function(_0x18474e){_0x5df5c0[_0xb01d('0x45')]=_0x18474e;return _0x5df5c0;})[_0xb01d('0x2a')](respondWithFilteredResult(_0xcdf90,_0x5b202d))['catch'](handleError(_0xcdf90,null));};exports['show']=function(_0x3474f7,_0x486fe1){var _0x15fb9c={'raw':!![],'where':{'id':_0x3474f7['params']['id']}},_0x7c5dd0={};_0x7c5dd0[_0xb01d('0x34')]=_[_0xb01d('0x46')](db[_0xb01d('0x41')][_0xb01d('0x2f')]);_0x7c5dd0[_0xb01d('0x32')]=_['keys'](_0x3474f7[_0xb01d('0x32')]);_0x7c5dd0[_0xb01d('0x33')]=_['intersection'](_0x7c5dd0['model'],_0x7c5dd0[_0xb01d('0x32')]);_0x15fb9c[_0xb01d('0x35')]=_[_0xb01d('0x36')](_0x7c5dd0['model'],qs[_0xb01d('0x37')](_0x3474f7[_0xb01d('0x32')][_0xb01d('0x37')]));_0x15fb9c['attributes']=_0x15fb9c[_0xb01d('0x35')][_0xb01d('0x38')]?_0x15fb9c[_0xb01d('0x35')]:_0x7c5dd0['model'];if(_0x3474f7[_0xb01d('0x32')]['includeAll']){_0x15fb9c[_0xb01d('0x43')]=[{'all':!![]}];}_0x15fb9c=_[_0xb01d('0x3e')]({},_0x15fb9c,_0x3474f7[_0xb01d('0x40')]);return db[_0xb01d('0x41')]['find'](_0x15fb9c)[_0xb01d('0x2a')](handleEntityNotFound(_0x486fe1,null))[_0xb01d('0x2a')](respondWithResult(_0x486fe1,null))[_0xb01d('0x47')](handleError(_0x486fe1,null));};exports[_0xb01d('0x48')]=function(_0x181896,_0x443390){return db['ChatGroup'][_0xb01d('0x48')](_0x181896[_0xb01d('0x49')],{})[_0xb01d('0x2a')](respondWithResult(_0x443390,0xc9))[_0xb01d('0x47')](handleError(_0x443390,null));};exports[_0xb01d('0x4a')]=function(_0x424931,_0x470062){if(_0x424931['body']['id']){delete _0x424931[_0xb01d('0x49')]['id'];}return db[_0xb01d('0x41')]['find']({'where':{'id':_0x424931['params']['id']}})[_0xb01d('0x2a')](handleEntityNotFound(_0x470062,null))[_0xb01d('0x2a')](saveUpdates(_0x424931[_0xb01d('0x49')],null))[_0xb01d('0x2a')](respondWithResult(_0x470062,null))[_0xb01d('0x47')](handleError(_0x470062,null));};exports['destroy']=function(_0x269a9b,_0x4913a2){return db[_0xb01d('0x41')][_0xb01d('0x4b')]({'where':{'id':_0x269a9b['params']['id']}})[_0xb01d('0x2a')](handleEntityNotFound(_0x4913a2,null))[_0xb01d('0x2a')](removeEntity(_0x4913a2,null))[_0xb01d('0x47')](handleError(_0x4913a2,null));};exports[_0xb01d('0x4c')]=function(_0x3a5070,_0x24422d){return db['ChatGroup']['describe']()['then'](respondWithResult(_0x24422d,null))[_0xb01d('0x47')](handleError(_0x24422d,null));};exports['getUnread']=function(_0x3acf1c,_0x213b3b,_0x1aa61a){return db[_0xb01d('0x4d')][_0xb01d('0x22')]({'where':{'ChatGroupId':_0x3acf1c[_0xb01d('0x4e')]['id'],'ToId':_0x3acf1c['user']['id'],'read':![]}})['then'](function(_0x2bdf33){return{'id':_['toInteger'](_0x3acf1c['params']['id']),'count':_0x2bdf33};})[_0xb01d('0x2a')](respondWithResult(_0x213b3b,null))[_0xb01d('0x47')](handleError(_0x213b3b,null));};exports[_0xb01d('0x4f')]=function(_0x31fb17,_0x1b238f,_0xd6b148){return db[_0xb01d('0x41')]['find']({'where':{'id':_0x31fb17['params']['id']}})[_0xb01d('0x2a')](handleEntityNotFound(_0x1b238f,null))[_0xb01d('0x2a')](function(_0x4b727e){if(_0x4b727e){return _0x4b727e[_0xb01d('0x4f')](_0x31fb17['body'][_0xb01d('0x50')],_[_0xb01d('0x51')](_0x31fb17['body'],['ids','id'])||{});}})[_0xb01d('0x2a')](respondWithResult(_0x1b238f,null))[_0xb01d('0x47')](handleError(_0x1b238f,null));};exports['getMembers']=function(_0x48cf1a,_0x3a2b20,_0x336032){var _0x3bacc5={};var _0x42ab1b={};var _0x1f71f;var _0x3cb31a;return db['ChatGroup'][_0xb01d('0x52')]({'where':{'id':_0x48cf1a[_0xb01d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a2b20,null))[_0xb01d('0x2a')](function(_0x247571){if(_0x247571){_0x1f71f=_0x247571;_0x42ab1b[_0xb01d('0x34')]=_[_0xb01d('0x46')](db[_0xb01d('0x53')][_0xb01d('0x2f')]);_0x42ab1b[_0xb01d('0x32')]=_['keys'](_0x48cf1a[_0xb01d('0x32')]);_0x42ab1b[_0xb01d('0x33')]=_[_0xb01d('0x36')](_0x42ab1b[_0xb01d('0x34')],_0x42ab1b[_0xb01d('0x32')]);_0x3bacc5['attributes']=_['intersection'](_0x42ab1b[_0xb01d('0x34')],qs[_0xb01d('0x37')](_0x48cf1a[_0xb01d('0x32')][_0xb01d('0x37')]));_0x3bacc5['attributes']=_0x3bacc5[_0xb01d('0x35')][_0xb01d('0x38')]?_0x3bacc5[_0xb01d('0x35')]:_0x42ab1b[_0xb01d('0x34')];_0x3bacc5[_0xb01d('0x54')]=qs[_0xb01d('0x3a')](_0x48cf1a[_0xb01d('0x32')][_0xb01d('0x3a')]);_0x3bacc5[_0xb01d('0x3b')]=qs[_0xb01d('0x33')](_['pick'](_0x48cf1a[_0xb01d('0x32')],_0x42ab1b[_0xb01d('0x33')]));if(_0x48cf1a['query'][_0xb01d('0x3d')]){_0x3bacc5[_0xb01d('0x3b')]=_[_0xb01d('0x3e')](_0x3bacc5['where'],{'$or':_['map'](_0x3bacc5[_0xb01d('0x35')],function(_0x19e623){var _0x62c6a9={};_0x62c6a9[_0x19e623]={'$like':'%'+_0x48cf1a[_0xb01d('0x32')][_0xb01d('0x3d')]+'%'};return _0x62c6a9;})});}_0x3bacc5=_[_0xb01d('0x3e')]({},_0x3bacc5,_0x48cf1a[_0xb01d('0x40')]);return _0x1f71f[_0xb01d('0x55')](_0x3bacc5);}})[_0xb01d('0x2a')](function(_0x3aa265){if(_0x3aa265){_0x3cb31a=_0x3aa265[_0xb01d('0x38')];if(!_0x48cf1a[_0xb01d('0x32')]['hasOwnProperty'](_0xb01d('0x56'))){_0x3bacc5['limit']=qs[_0xb01d('0x21')](_0x48cf1a[_0xb01d('0x32')][_0xb01d('0x21')]);_0x3bacc5[_0xb01d('0x1f')]=qs['offset'](_0x48cf1a[_0xb01d('0x32')][_0xb01d('0x1f')]);}return _0x1f71f['getMembers'](_0x3bacc5);}})[_0xb01d('0x2a')](function(_0x14640f){if(_0x14640f){return _0x14640f?{'count':_0x3cb31a,'rows':_0x14640f}:null;}})[_0xb01d('0x2a')](respondWithResult(_0x3a2b20,null))[_0xb01d('0x47')](handleError(_0x3a2b20,null));};exports[_0xb01d('0x57')]=function(_0x5732ec,_0x267cac,_0x4e7357){return db[_0xb01d('0x41')][_0xb01d('0x4b')]({'where':{'id':_0x5732ec['params']['id']}})[_0xb01d('0x2a')](handleEntityNotFound(_0x267cac,null))[_0xb01d('0x2a')](function(_0x6d4f2){if(_0x6d4f2){return _0x6d4f2[_0xb01d('0x57')](_0x5732ec[_0xb01d('0x32')][_0xb01d('0x50')]);}})[_0xb01d('0x2a')](respondWithStatusCode(_0x267cac,null))[_0xb01d('0x47')](handleError(_0x267cac,null));};exports[_0xb01d('0x58')]=function(_0x3f17d7,_0x363eaf,_0x35ffba){if(_0x3f17d7[_0xb01d('0x49')]['id']){delete _0x3f17d7[_0xb01d('0x49')]['id'];}return db[_0xb01d('0x41')][_0xb01d('0x4b')]({'where':{'id':_0x3f17d7[_0xb01d('0x4e')]['id']}})[_0xb01d('0x2a')](handleEntityNotFound(_0x363eaf,null))[_0xb01d('0x2a')](function(_0x52a25d){if(_0x52a25d){_0x3f17d7['body'][_0xb01d('0x59')]=_0x52a25d['id'];return db[_0xb01d('0x4d')][_0xb01d('0x48')](_0x3f17d7['body']);}})[_0xb01d('0x2a')](respondWithResult(_0x363eaf,null))[_0xb01d('0x47')](handleError(_0x363eaf,null));};exports[_0xb01d('0x5a')]=function(_0x360ded,_0xd73258,_0x458c75){var _0x332c51={};var _0x269a6c={};var _0x2522e4;var _0x5bd540;return db['ChatGroup'][_0xb01d('0x52')]({'where':{'id':_0x360ded[_0xb01d('0x4e')]['id']}})[_0xb01d('0x2a')](handleEntityNotFound(_0xd73258,null))[_0xb01d('0x2a')](function(_0x57711a){if(_0x57711a){_0x2522e4=_0x57711a;_0x269a6c[_0xb01d('0x34')]=_[_0xb01d('0x46')](db['ChatInternalMessage'][_0xb01d('0x2f')]);_0x269a6c[_0xb01d('0x32')]=_['keys'](_0x360ded[_0xb01d('0x32')]);_0x269a6c[_0xb01d('0x33')]=_['intersection'](_0x269a6c[_0xb01d('0x34')],_0x269a6c[_0xb01d('0x32')]);_0x332c51[_0xb01d('0x35')]=_[_0xb01d('0x36')](_0x269a6c[_0xb01d('0x34')],qs[_0xb01d('0x37')](_0x360ded[_0xb01d('0x32')][_0xb01d('0x37')]));_0x332c51[_0xb01d('0x35')]=_0x332c51[_0xb01d('0x35')][_0xb01d('0x38')]?_0x332c51['attributes']:_0x269a6c[_0xb01d('0x34')];_0x332c51[_0xb01d('0x54')]=qs[_0xb01d('0x3a')](_0x360ded[_0xb01d('0x32')][_0xb01d('0x3a')]);_0x332c51[_0xb01d('0x3b')]=qs[_0xb01d('0x33')](_[_0xb01d('0x3c')](_0x360ded[_0xb01d('0x32')],_0x269a6c[_0xb01d('0x33')]));if(_0x360ded[_0xb01d('0x32')]['filter']){_0x332c51[_0xb01d('0x3b')]=_[_0xb01d('0x3e')](_0x332c51[_0xb01d('0x3b')],{'$or':_[_0xb01d('0x2e')](_0x332c51['attributes'],function(_0x18df72){var _0x273ffd={};_0x273ffd[_0x18df72]={'$like':'%'+_0x360ded['query']['filter']+'%'};return _0x273ffd;})});}if(_0x360ded[_0xb01d('0x32')][_0xb01d('0x5b')]){var _0x5828e3=_0x360ded[_0xb01d('0x32')][_0xb01d('0x5b')][_0xb01d('0x5c')](',');var _0x1cf47b={};_0x1cf47b[_0x5828e3[0x0]]={'$gte':moment(_0x5828e3[0x1])['format'](_0xb01d('0x5d'))};_0x332c51[_0xb01d('0x3b')]=_[_0xb01d('0x3e')](_0x332c51[_0xb01d('0x3b')],_0x1cf47b);}_0x332c51=_[_0xb01d('0x3e')]({},_0x332c51,_0x360ded[_0xb01d('0x40')]);return _0x2522e4[_0xb01d('0x5a')](_0x332c51);}})[_0xb01d('0x2a')](function(_0x28dff9){if(_0x28dff9){_0x5bd540=_0x28dff9[_0xb01d('0x38')];if(!_0x360ded[_0xb01d('0x32')][_0xb01d('0x39')](_0xb01d('0x56'))){_0x332c51[_0xb01d('0x21')]=qs[_0xb01d('0x21')](_0x360ded['query']['limit']);_0x332c51[_0xb01d('0x1f')]=qs[_0xb01d('0x1f')](_0x360ded[_0xb01d('0x32')]['offset']);}return _0x2522e4[_0xb01d('0x5a')](_0x332c51);}})[_0xb01d('0x2a')](function(_0x126f57){if(_0x126f57){return _0x126f57?{'count':_0x5bd540,'rows':_0x126f57}:null;}})['then'](respondWithResult(_0xd73258,null))['catch'](handleError(_0xd73258,null));}; \ No newline at end of file +var _0x8d90=['../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','model','query','filters','attributes','intersection','fields','length','sort','pick','filter','where','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','findAll','catch','params','keys','find','create','body','describe','toInteger','addMembers','ids','getMembers','findOne','User','order','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware'];(function(_0xe619ff,_0x52ac89){var _0x493425=function(_0x278585){while(--_0x278585){_0xe619ff['push'](_0xe619ff['shift']());}};_0x493425(++_0x52ac89);}(_0x8d90,0x1bd));var _0x08d9=function(_0x29dfc0,_0x3a75ce){_0x29dfc0=_0x29dfc0-0x0;var _0x799f9=_0x8d90[_0x29dfc0];return _0x799f9;};'use strict';var emlformat=require(_0x08d9('0x0'));var rimraf=require(_0x08d9('0x1'));var zipdir=require(_0x08d9('0x2'));var jsonpatch=require(_0x08d9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x08d9('0x4'));var util=require(_0x08d9('0x5'));var path=require(_0x08d9('0x6'));var sox=require(_0x08d9('0x7'));var csv=require(_0x08d9('0x8'));var ejs=require(_0x08d9('0x9'));var fs=require('fs');var fs_extra=require(_0x08d9('0xa'));var _=require(_0x08d9('0xb'));var squel=require(_0x08d9('0xc'));var crypto=require(_0x08d9('0xd'));var jsforce=require(_0x08d9('0xe'));var deskjs=require(_0x08d9('0xf'));var toCsv=require(_0x08d9('0x8'));var querystring=require(_0x08d9('0x10'));var Papa=require(_0x08d9('0x11'));var Redis=require('ioredis');var authService=require(_0x08d9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08d9('0x13'));var logger=require(_0x08d9('0x14'))(_0x08d9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x08d9('0x16'))['db'];config[_0x08d9('0x17')]=_[_0x08d9('0x18')](config[_0x08d9('0x17')],{'host':_0x08d9('0x19'),'port':0x18eb});var socket=require(_0x08d9('0x1a'))(new Redis(config['redis']));require(_0x08d9('0x1b'))[_0x08d9('0x1c')](socket);function respondWithStatusCode(_0x596010,_0x2bbe4d){_0x2bbe4d=_0x2bbe4d||0xcc;return function(_0x2d9266){if(_0x2d9266){return _0x596010[_0x08d9('0x1d')](_0x2bbe4d);}return _0x596010[_0x08d9('0x1e')](_0x2bbe4d)[_0x08d9('0x1f')]();};}function respondWithResult(_0x37a758,_0x2e7b1b){_0x2e7b1b=_0x2e7b1b||0xc8;return function(_0xc3900f){if(_0xc3900f){return _0x37a758[_0x08d9('0x1e')](_0x2e7b1b)[_0x08d9('0x20')](_0xc3900f);}};}function respondWithFilteredResult(_0x12c0f2,_0x5ea6df){return function(_0x189758){if(_0x189758){var _0x3a5f0e=typeof _0x5ea6df[_0x08d9('0x21')]===_0x08d9('0x22')&&typeof _0x5ea6df[_0x08d9('0x23')]===_0x08d9('0x22');var _0xe61a39=_0x189758['count'];var _0x45ecd1=_0x3a5f0e?0x0:_0x5ea6df[_0x08d9('0x21')];var _0x428e63=_0x3a5f0e?_0x189758[_0x08d9('0x24')]:_0x5ea6df['offset']+_0x5ea6df[_0x08d9('0x23')];var _0x2f23ab;if(_0x428e63>=_0xe61a39){_0x428e63=_0xe61a39;_0x2f23ab=0xc8;}else{_0x2f23ab=0xce;}_0x12c0f2['status'](_0x2f23ab);return _0x12c0f2[_0x08d9('0x25')](_0x08d9('0x26'),_0x45ecd1+'-'+_0x428e63+'/'+_0xe61a39)[_0x08d9('0x20')](_0x189758);}return null;};}function patchUpdates(_0x51c636){return function(_0x18dc67){try{jsonpatch[_0x08d9('0x27')](_0x18dc67,_0x51c636,!![]);}catch(_0x5740fd){return BPromise['reject'](_0x5740fd);}return _0x18dc67[_0x08d9('0x28')]();};}function saveUpdates(_0x1e838a,_0xc813a9){return function(_0x25a848){if(_0x25a848){return _0x25a848[_0x08d9('0x29')](_0x1e838a)[_0x08d9('0x2a')](function(_0x2d0b06){return _0x2d0b06;});}return null;};}function removeEntity(_0x278969,_0x402e66){return function(_0x192ba0){if(_0x192ba0){return _0x192ba0[_0x08d9('0x2b')]()[_0x08d9('0x2a')](function(){_0x278969[_0x08d9('0x1e')](0xcc)[_0x08d9('0x1f')]();});}};}function handleEntityNotFound(_0x22a756,_0x3b2b39){return function(_0xbf2e29){if(!_0xbf2e29){_0x22a756[_0x08d9('0x1d')](0x194);}return _0xbf2e29;};}function handleError(_0x11ae65,_0x4d5850){_0x4d5850=_0x4d5850||0x1f4;return function(_0x383472){logger['error'](_0x383472[_0x08d9('0x2c')]);if(_0x383472['name']){delete _0x383472[_0x08d9('0x2d')];}_0x11ae65[_0x08d9('0x1e')](_0x4d5850)[_0x08d9('0x2e')](_0x383472);};}exports[_0x08d9('0x2f')]=function(_0x36b2b4,_0x473fc1){var _0x3baa13={},_0x2f1416={},_0x588e7c={'count':0x0,'rows':[]};var _0x23d505=_[_0x08d9('0x30')](db['ChatGroup'][_0x08d9('0x31')],function(_0x38cae0){return{'name':_0x38cae0['fieldName'],'type':_0x38cae0['type']['key']};});_0x2f1416[_0x08d9('0x32')]=_[_0x08d9('0x30')](_0x23d505,_0x08d9('0x2d'));_0x2f1416[_0x08d9('0x33')]=_['keys'](_0x36b2b4[_0x08d9('0x33')]);_0x2f1416[_0x08d9('0x34')]=_['intersection'](_0x2f1416['model'],_0x2f1416[_0x08d9('0x33')]);_0x3baa13[_0x08d9('0x35')]=_[_0x08d9('0x36')](_0x2f1416['model'],qs['fields'](_0x36b2b4[_0x08d9('0x33')][_0x08d9('0x37')]));_0x3baa13[_0x08d9('0x35')]=_0x3baa13[_0x08d9('0x35')][_0x08d9('0x38')]?_0x3baa13[_0x08d9('0x35')]:_0x2f1416['model'];if(!_0x36b2b4[_0x08d9('0x33')]['hasOwnProperty']('nolimit')){_0x3baa13[_0x08d9('0x23')]=qs[_0x08d9('0x23')](_0x36b2b4[_0x08d9('0x33')][_0x08d9('0x23')]);_0x3baa13[_0x08d9('0x21')]=qs['offset'](_0x36b2b4[_0x08d9('0x33')]['offset']);}_0x3baa13['order']=qs[_0x08d9('0x39')](_0x36b2b4[_0x08d9('0x33')]['sort']);_0x3baa13['where']=qs[_0x08d9('0x34')](_[_0x08d9('0x3a')](_0x36b2b4['query'],_0x2f1416['filters']),_0x23d505);if(_0x36b2b4[_0x08d9('0x33')][_0x08d9('0x3b')]){_0x3baa13[_0x08d9('0x3c')]=_[_0x08d9('0x3d')](_0x3baa13[_0x08d9('0x3c')],{'$or':_[_0x08d9('0x30')](_0x23d505,function(_0x3e6658){if(_0x3e6658[_0x08d9('0x3e')]!==_0x08d9('0x3f')){var _0x5a8997={};_0x5a8997[_0x3e6658[_0x08d9('0x2d')]]={'$like':'%'+_0x36b2b4[_0x08d9('0x33')][_0x08d9('0x3b')]+'%'};return _0x5a8997;}})});}_0x3baa13=_[_0x08d9('0x3d')]({},_0x3baa13,_0x36b2b4[_0x08d9('0x40')]);var _0x5611a0={'where':_0x3baa13['where']};return db[_0x08d9('0x41')][_0x08d9('0x24')](_0x5611a0)['then'](function(_0x1b8005){_0x588e7c[_0x08d9('0x24')]=_0x1b8005;if(_0x36b2b4[_0x08d9('0x33')][_0x08d9('0x42')]){_0x3baa13[_0x08d9('0x43')]=[{'all':!![]}];}return db['ChatGroup'][_0x08d9('0x44')](_0x3baa13);})[_0x08d9('0x2a')](function(_0x5214ed){_0x588e7c['rows']=_0x5214ed;return _0x588e7c;})[_0x08d9('0x2a')](respondWithFilteredResult(_0x473fc1,_0x3baa13))[_0x08d9('0x45')](handleError(_0x473fc1,null));};exports['show']=function(_0x1486b8,_0x300e19){var _0x4d9126={'raw':!![],'where':{'id':_0x1486b8[_0x08d9('0x46')]['id']}},_0x440eb9={};_0x440eb9[_0x08d9('0x32')]=_[_0x08d9('0x47')](db[_0x08d9('0x41')]['rawAttributes']);_0x440eb9[_0x08d9('0x33')]=_[_0x08d9('0x47')](_0x1486b8[_0x08d9('0x33')]);_0x440eb9[_0x08d9('0x34')]=_[_0x08d9('0x36')](_0x440eb9[_0x08d9('0x32')],_0x440eb9[_0x08d9('0x33')]);_0x4d9126[_0x08d9('0x35')]=_[_0x08d9('0x36')](_0x440eb9[_0x08d9('0x32')],qs[_0x08d9('0x37')](_0x1486b8[_0x08d9('0x33')]['fields']));_0x4d9126[_0x08d9('0x35')]=_0x4d9126[_0x08d9('0x35')][_0x08d9('0x38')]?_0x4d9126[_0x08d9('0x35')]:_0x440eb9[_0x08d9('0x32')];if(_0x1486b8[_0x08d9('0x33')][_0x08d9('0x42')]){_0x4d9126[_0x08d9('0x43')]=[{'all':!![]}];}_0x4d9126=_['merge']({},_0x4d9126,_0x1486b8[_0x08d9('0x40')]);return db[_0x08d9('0x41')][_0x08d9('0x48')](_0x4d9126)[_0x08d9('0x2a')](handleEntityNotFound(_0x300e19,null))['then'](respondWithResult(_0x300e19,null))[_0x08d9('0x45')](handleError(_0x300e19,null));};exports[_0x08d9('0x49')]=function(_0x3075d0,_0x1f0cc7){return db[_0x08d9('0x41')]['create'](_0x3075d0[_0x08d9('0x4a')],{})[_0x08d9('0x2a')](respondWithResult(_0x1f0cc7,0xc9))[_0x08d9('0x45')](handleError(_0x1f0cc7,null));};exports[_0x08d9('0x29')]=function(_0x1301f0,_0x2203fb){if(_0x1301f0[_0x08d9('0x4a')]['id']){delete _0x1301f0['body']['id'];}return db[_0x08d9('0x41')][_0x08d9('0x48')]({'where':{'id':_0x1301f0[_0x08d9('0x46')]['id']}})['then'](handleEntityNotFound(_0x2203fb,null))[_0x08d9('0x2a')](saveUpdates(_0x1301f0[_0x08d9('0x4a')],null))['then'](respondWithResult(_0x2203fb,null))['catch'](handleError(_0x2203fb,null));};exports[_0x08d9('0x2b')]=function(_0x53830b,_0x1fc73e){return db['ChatGroup'][_0x08d9('0x48')]({'where':{'id':_0x53830b[_0x08d9('0x46')]['id']}})[_0x08d9('0x2a')](handleEntityNotFound(_0x1fc73e,null))[_0x08d9('0x2a')](removeEntity(_0x1fc73e,null))[_0x08d9('0x45')](handleError(_0x1fc73e,null));};exports[_0x08d9('0x4b')]=function(_0x13c297,_0x39c8e0){return db[_0x08d9('0x41')][_0x08d9('0x4b')]()[_0x08d9('0x2a')](respondWithResult(_0x39c8e0,null))[_0x08d9('0x45')](handleError(_0x39c8e0,null));};exports['getUnread']=function(_0x5aa010,_0x2f7335,_0x3aed10){return db['ChatInternalMessage'][_0x08d9('0x24')]({'where':{'ChatGroupId':_0x5aa010[_0x08d9('0x46')]['id'],'ToId':_0x5aa010['user']['id'],'read':![]}})[_0x08d9('0x2a')](function(_0x3b03ab){return{'id':_[_0x08d9('0x4c')](_0x5aa010['params']['id']),'count':_0x3b03ab};})[_0x08d9('0x2a')](respondWithResult(_0x2f7335,null))[_0x08d9('0x45')](handleError(_0x2f7335,null));};exports[_0x08d9('0x4d')]=function(_0x4409eb,_0x3d4e2e,_0x28d494){return db[_0x08d9('0x41')][_0x08d9('0x48')]({'where':{'id':_0x4409eb[_0x08d9('0x46')]['id']}})[_0x08d9('0x2a')](handleEntityNotFound(_0x3d4e2e,null))['then'](function(_0x5a3249){if(_0x5a3249){return _0x5a3249[_0x08d9('0x4d')](_0x4409eb[_0x08d9('0x4a')]['ids'],_['omit'](_0x4409eb[_0x08d9('0x4a')],[_0x08d9('0x4e'),'id'])||{});}})[_0x08d9('0x2a')](respondWithResult(_0x3d4e2e,null))[_0x08d9('0x45')](handleError(_0x3d4e2e,null));};exports[_0x08d9('0x4f')]=function(_0x1631a6,_0x341ba0,_0x2ac330){var _0xd51629={};var _0x1629c9={};var _0x18d478;var _0x472842;return db[_0x08d9('0x41')][_0x08d9('0x50')]({'where':{'id':_0x1631a6['params']['id']}})[_0x08d9('0x2a')](handleEntityNotFound(_0x341ba0,null))[_0x08d9('0x2a')](function(_0x476439){if(_0x476439){_0x18d478=_0x476439;_0x1629c9[_0x08d9('0x32')]=_[_0x08d9('0x47')](db[_0x08d9('0x51')][_0x08d9('0x31')]);_0x1629c9[_0x08d9('0x33')]=_[_0x08d9('0x47')](_0x1631a6[_0x08d9('0x33')]);_0x1629c9[_0x08d9('0x34')]=_[_0x08d9('0x36')](_0x1629c9[_0x08d9('0x32')],_0x1629c9[_0x08d9('0x33')]);_0xd51629[_0x08d9('0x35')]=_[_0x08d9('0x36')](_0x1629c9[_0x08d9('0x32')],qs['fields'](_0x1631a6[_0x08d9('0x33')][_0x08d9('0x37')]));_0xd51629[_0x08d9('0x35')]=_0xd51629[_0x08d9('0x35')][_0x08d9('0x38')]?_0xd51629['attributes']:_0x1629c9[_0x08d9('0x32')];_0xd51629[_0x08d9('0x52')]=qs['sort'](_0x1631a6[_0x08d9('0x33')]['sort']);_0xd51629[_0x08d9('0x3c')]=qs[_0x08d9('0x34')](_['pick'](_0x1631a6[_0x08d9('0x33')],_0x1629c9[_0x08d9('0x34')]));if(_0x1631a6['query']['filter']){_0xd51629[_0x08d9('0x3c')]=_[_0x08d9('0x3d')](_0xd51629['where'],{'$or':_[_0x08d9('0x30')](_0xd51629[_0x08d9('0x35')],function(_0x3a0fb5){var _0x3c8d1a={};_0x3c8d1a[_0x3a0fb5]={'$like':'%'+_0x1631a6[_0x08d9('0x33')]['filter']+'%'};return _0x3c8d1a;})});}_0xd51629=_['merge']({},_0xd51629,_0x1631a6[_0x08d9('0x40')]);return _0x18d478[_0x08d9('0x4f')](_0xd51629);}})[_0x08d9('0x2a')](function(_0x2091a6){if(_0x2091a6){_0x472842=_0x2091a6[_0x08d9('0x38')];if(!_0x1631a6[_0x08d9('0x33')][_0x08d9('0x53')](_0x08d9('0x54'))){_0xd51629['limit']=qs[_0x08d9('0x23')](_0x1631a6[_0x08d9('0x33')]['limit']);_0xd51629[_0x08d9('0x21')]=qs[_0x08d9('0x21')](_0x1631a6[_0x08d9('0x33')][_0x08d9('0x21')]);}return _0x18d478[_0x08d9('0x4f')](_0xd51629);}})[_0x08d9('0x2a')](function(_0x217c45){if(_0x217c45){return _0x217c45?{'count':_0x472842,'rows':_0x217c45}:null;}})[_0x08d9('0x2a')](respondWithResult(_0x341ba0,null))['catch'](handleError(_0x341ba0,null));};exports['removeMembers']=function(_0x177475,_0x2a2a08,_0x51e1ea){return db['ChatGroup']['find']({'where':{'id':_0x177475[_0x08d9('0x46')]['id']}})[_0x08d9('0x2a')](handleEntityNotFound(_0x2a2a08,null))[_0x08d9('0x2a')](function(_0x537134){if(_0x537134){return _0x537134[_0x08d9('0x55')](_0x177475['query'][_0x08d9('0x4e')]);}})[_0x08d9('0x2a')](respondWithStatusCode(_0x2a2a08,null))[_0x08d9('0x45')](handleError(_0x2a2a08,null));};exports[_0x08d9('0x56')]=function(_0x53442a,_0x9ae596,_0x4b08d4){if(_0x53442a[_0x08d9('0x4a')]['id']){delete _0x53442a[_0x08d9('0x4a')]['id'];}return db[_0x08d9('0x41')][_0x08d9('0x48')]({'where':{'id':_0x53442a[_0x08d9('0x46')]['id']}})[_0x08d9('0x2a')](handleEntityNotFound(_0x9ae596,null))['then'](function(_0x25c039){if(_0x25c039){_0x53442a[_0x08d9('0x4a')][_0x08d9('0x57')]=_0x25c039['id'];return db[_0x08d9('0x58')]['create'](_0x53442a['body']);}})[_0x08d9('0x2a')](respondWithResult(_0x9ae596,null))[_0x08d9('0x45')](handleError(_0x9ae596,null));};exports[_0x08d9('0x59')]=function(_0x1c2953,_0xf1a159,_0x31c778){var _0xf0350b={};var _0x5a21c5={};var _0x3b32ce;var _0x1f7e0;return db[_0x08d9('0x41')][_0x08d9('0x50')]({'where':{'id':_0x1c2953[_0x08d9('0x46')]['id']}})[_0x08d9('0x2a')](handleEntityNotFound(_0xf1a159,null))['then'](function(_0x2c719d){if(_0x2c719d){_0x3b32ce=_0x2c719d;_0x5a21c5[_0x08d9('0x32')]=_['keys'](db[_0x08d9('0x58')][_0x08d9('0x31')]);_0x5a21c5[_0x08d9('0x33')]=_['keys'](_0x1c2953[_0x08d9('0x33')]);_0x5a21c5[_0x08d9('0x34')]=_[_0x08d9('0x36')](_0x5a21c5[_0x08d9('0x32')],_0x5a21c5[_0x08d9('0x33')]);_0xf0350b['attributes']=_[_0x08d9('0x36')](_0x5a21c5[_0x08d9('0x32')],qs['fields'](_0x1c2953[_0x08d9('0x33')][_0x08d9('0x37')]));_0xf0350b[_0x08d9('0x35')]=_0xf0350b[_0x08d9('0x35')][_0x08d9('0x38')]?_0xf0350b[_0x08d9('0x35')]:_0x5a21c5[_0x08d9('0x32')];_0xf0350b[_0x08d9('0x52')]=qs[_0x08d9('0x39')](_0x1c2953[_0x08d9('0x33')]['sort']);_0xf0350b[_0x08d9('0x3c')]=qs[_0x08d9('0x34')](_['pick'](_0x1c2953['query'],_0x5a21c5['filters']));if(_0x1c2953[_0x08d9('0x33')][_0x08d9('0x3b')]){_0xf0350b[_0x08d9('0x3c')]=_[_0x08d9('0x3d')](_0xf0350b[_0x08d9('0x3c')],{'$or':_[_0x08d9('0x30')](_0xf0350b[_0x08d9('0x35')],function(_0x43c214){var _0x16fad4={};_0x16fad4[_0x43c214]={'$like':'%'+_0x1c2953['query'][_0x08d9('0x3b')]+'%'};return _0x16fad4;})});}if(_0x1c2953['query'][_0x08d9('0x5a')]){var _0x1ce658=_0x1c2953[_0x08d9('0x33')]['$gte'][_0x08d9('0x5b')](',');var _0x4ed76f={};_0x4ed76f[_0x1ce658[0x0]]={'$gte':moment(_0x1ce658[0x1])['format'](_0x08d9('0x5c'))};_0xf0350b[_0x08d9('0x3c')]=_['merge'](_0xf0350b[_0x08d9('0x3c')],_0x4ed76f);}_0xf0350b=_[_0x08d9('0x3d')]({},_0xf0350b,_0x1c2953[_0x08d9('0x40')]);return _0x3b32ce[_0x08d9('0x59')](_0xf0350b);}})['then'](function(_0x70c721){if(_0x70c721){_0x1f7e0=_0x70c721[_0x08d9('0x38')];if(!_0x1c2953['query'][_0x08d9('0x53')](_0x08d9('0x54'))){_0xf0350b[_0x08d9('0x23')]=qs['limit'](_0x1c2953[_0x08d9('0x33')][_0x08d9('0x23')]);_0xf0350b[_0x08d9('0x21')]=qs[_0x08d9('0x21')](_0x1c2953[_0x08d9('0x33')]['offset']);}return _0x3b32ce[_0x08d9('0x59')](_0xf0350b);}})[_0x08d9('0x2a')](function(_0x383903){if(_0x383903){return _0x383903?{'count':_0x1f7e0,'rows':_0x383903}:null;}})['then'](respondWithResult(_0xf1a159,null))[_0x08d9('0x45')](handleError(_0xf1a159,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 40e1b70..bc0199b 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 _0x04cc=['hasOwnProperty','hook','events','../../mysqldb','ChatGroup','setMaxListeners','update','emit'];(function(_0xc04eb0,_0x38ffaf){var _0x4712ab=function(_0x37bc8e){while(--_0x37bc8e){_0xc04eb0['push'](_0xc04eb0['shift']());}};_0x4712ab(++_0x38ffaf);}(_0x04cc,0x11a));var _0xc04c=function(_0x5d4aff,_0x4d58e9){_0x5d4aff=_0x5d4aff-0x0;var _0x28ef30=_0x04cc[_0x5d4aff];return _0x28ef30;};'use strict';var EventEmitter=require(_0xc04c('0x0'));var ChatGroup=require(_0xc04c('0x1'))['db'][_0xc04c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc04c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc04c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4cca40){return function(_0x138028,_0x2fefd7,_0x153c93){ChatGroupEvents[_0xc04c('0x5')](_0x4cca40+':'+_0x138028['id'],_0x138028);ChatGroupEvents[_0xc04c('0x5')](_0x4cca40,_0x138028);_0x153c93(null);};}for(var e in events){if(events[_0xc04c('0x6')](e)){var event=events[e];ChatGroup[_0xc04c('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x74cd=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x53f951,_0x4bff0a){var _0x3eedd6=function(_0x333f0c){while(--_0x333f0c){_0x53f951['push'](_0x53f951['shift']());}};_0x3eedd6(++_0x4bff0a);}(_0x74cd,0x162));var _0xd74c=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x74cd[_0x3a0c4f];return _0x247049;};'use strict';var EventEmitter=require(_0xd74c('0x0'));var ChatGroup=require(_0xd74c('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd74c('0x2')](0x0);var events={'afterCreate':_0xd74c('0x3'),'afterUpdate':'update','afterDestroy':_0xd74c('0x4')};function emitEvent(_0x3bf0e3){return function(_0x1a43e1,_0x395516,_0x1dc04e){ChatGroupEvents[_0xd74c('0x5')](_0x3bf0e3+':'+_0x1a43e1['id'],_0x1a43e1);ChatGroupEvents[_0xd74c('0x5')](_0x3bf0e3,_0x1a43e1);_0x1dc04e(null);};}for(var e in events){if(events[_0xd74c('0x6')](e)){var event=events[e];ChatGroup[_0xd74c('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 58b8b0f..fb9a06a 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 _0x9c32=['exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x9c32,0x1b6));var _0x29c3=function(_0xf02bc5,_0x2c56e9){_0xf02bc5=_0xf02bc5-0x0;var _0x142674=_0x9c32[_0xf02bc5];return _0x142674;};'use strict';var _=require('lodash');var util=require(_0x29c3('0x0'));var logger=require(_0x29c3('0x1'))(_0x29c3('0x2'));var moment=require(_0x29c3('0x3'));var BPromise=require(_0x29c3('0x4'));var rp=require(_0x29c3('0x5'));var fs=require('fs');var path=require(_0x29c3('0x6'));var rimraf=require(_0x29c3('0x7'));var config=require(_0x29c3('0x8'));var attributes=require(_0x29c3('0x9'));module[_0x29c3('0xa')]=function(_0x17a4cb,_0x33b70a){return _0x17a4cb[_0x29c3('0xb')](_0x29c3('0xc'),attributes,{'tableName':_0x29c3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc62f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x2b7695,_0x20c6cd){var _0x313ebd=function(_0x5a8bb1){while(--_0x5a8bb1){_0x2b7695['push'](_0x2b7695['shift']());}};_0x313ebd(++_0x20c6cd);}(_0xc62f,0xc6));var _0xfc62=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xc62f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xfc62('0x0'));var util=require(_0xfc62('0x1'));var logger=require(_0xfc62('0x2'))('api');var moment=require(_0xfc62('0x3'));var BPromise=require(_0xfc62('0x4'));var rp=require(_0xfc62('0x5'));var fs=require('fs');var path=require(_0xfc62('0x6'));var rimraf=require(_0xfc62('0x7'));var config=require(_0xfc62('0x8'));var attributes=require(_0xfc62('0x9'));module[_0xfc62('0xa')]=function(_0x110b76,_0x494780){return _0x110b76['define']('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 931d7f3..eb5f76a 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 _0xef39=['./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xef39,0x92));var _0x9ef3=function(_0x560042,_0x3924f5){_0x560042=_0x560042-0x0;var _0x2f6586=_0xef39[_0x560042];return _0x2f6586;};'use strict';var _=require('lodash');var util=require(_0x9ef3('0x0'));var moment=require(_0x9ef3('0x1'));var BPromise=require(_0x9ef3('0x2'));var rs=require(_0x9ef3('0x3'));var fs=require('fs');var Redis=require(_0x9ef3('0x4'));var db=require(_0x9ef3('0x5'))['db'];var utils=require(_0x9ef3('0x6'));var logger=require(_0x9ef3('0x7'))(_0x9ef3('0x8'));var config=require(_0x9ef3('0x9'));var jayson=require(_0x9ef3('0xa'));var client=jayson[_0x9ef3('0xb')]['http']({'port':0x232a});config[_0x9ef3('0xc')]=_[_0x9ef3('0xd')](config[_0x9ef3('0xc')],{'host':_0x9ef3('0xe'),'port':0x18eb});var socket=require(_0x9ef3('0xf'))(new Redis(config[_0x9ef3('0xc')]));require(_0x9ef3('0x10'))[_0x9ef3('0x11')](socket);function respondWithRpcPromise(_0x388d02,_0x268765,_0x347f85){return new BPromise(function(_0xcacf18,_0x475bd3){return client['request'](_0x388d02,_0x347f85)[_0x9ef3('0x12')](function(_0x31e819){logger[_0x9ef3('0x13')](_0x9ef3('0x14'),_0x268765,_0x9ef3('0x15'));logger[_0x9ef3('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x268765,_0x9ef3('0x15'),JSON[_0x9ef3('0x17')](_0x31e819));if(_0x31e819[_0x9ef3('0x18')]){if(_0x31e819['error'][_0x9ef3('0x19')]===0x1f4){logger[_0x9ef3('0x18')]('ChatGroup,\x20%s,\x20%s',_0x268765,_0x31e819[_0x9ef3('0x18')][_0x9ef3('0x1a')]);return _0x475bd3(_0x31e819[_0x9ef3('0x18')][_0x9ef3('0x1a')]);}logger[_0x9ef3('0x18')](_0x9ef3('0x14'),_0x268765,_0x31e819['error'][_0x9ef3('0x1a')]);return _0xcacf18(_0x31e819[_0x9ef3('0x18')][_0x9ef3('0x1a')]);}else{logger['info'](_0x9ef3('0x14'),_0x268765,_0x9ef3('0x15'));_0xcacf18(_0x31e819['result']['message']);}})['catch'](function(_0x43fe20){logger[_0x9ef3('0x18')]('ChatGroup,\x20%s,\x20%s',_0x268765,_0x43fe20);_0x475bd3(_0x43fe20);});});} \ No newline at end of file +var _0x6113=['ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','request\x20sent','debug'];(function(_0x58e025,_0x4fab37){var _0x10015b=function(_0x38f225){while(--_0x38f225){_0x58e025['push'](_0x58e025['shift']());}};_0x10015b(++_0x4fab37);}(_0x6113,0x1c8));var _0x3611=function(_0x190e1f,_0x11e558){_0x190e1f=_0x190e1f-0x0;var _0x2ba93a=_0x6113[_0x190e1f];return _0x2ba93a;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var moment=require(_0x3611('0x2'));var BPromise=require('bluebird');var rs=require(_0x3611('0x3'));var fs=require('fs');var Redis=require(_0x3611('0x4'));var db=require(_0x3611('0x5'))['db'];var utils=require(_0x3611('0x6'));var logger=require(_0x3611('0x7'))(_0x3611('0x8'));var config=require(_0x3611('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3611('0xa')][_0x3611('0xb')]({'port':0x232a});config[_0x3611('0xc')]=_['defaults'](config[_0x3611('0xc')],{'host':_0x3611('0xd'),'port':0x18eb});var socket=require(_0x3611('0xe'))(new Redis(config['redis']));require(_0x3611('0xf'))['register'](socket);function respondWithRpcPromise(_0x17cf65,_0x4f1a2f,_0x33f793){return new BPromise(function(_0x2d117e,_0x49b4ce){return client[_0x3611('0x10')](_0x17cf65,_0x33f793)[_0x3611('0x11')](function(_0xa391a){logger['info']('ChatGroup,\x20%s,\x20%s',_0x4f1a2f,_0x3611('0x12'));logger[_0x3611('0x13')](_0x3611('0x14'),_0x4f1a2f,_0x3611('0x12'),JSON[_0x3611('0x15')](_0xa391a));if(_0xa391a[_0x3611('0x16')]){if(_0xa391a[_0x3611('0x16')][_0x3611('0x17')]===0x1f4){logger[_0x3611('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4f1a2f,_0xa391a[_0x3611('0x16')][_0x3611('0x18')]);return _0x49b4ce(_0xa391a['error']['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4f1a2f,_0xa391a[_0x3611('0x16')][_0x3611('0x18')]);return _0x2d117e(_0xa391a[_0x3611('0x16')][_0x3611('0x18')]);}else{logger['info'](_0x3611('0x19'),_0x4f1a2f,'request\x20sent');_0x2d117e(_0xa391a[_0x3611('0x1a')][_0x3611('0x18')]);}})[_0x3611('0x1b')](function(_0x470bcc){logger[_0x3611('0x16')](_0x3611('0x19'),_0x4f1a2f,_0x470bcc);_0x49b4ce(_0x470bcc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index cff9e70..fa36c93 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 _0x76fc=['remove','update','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x76fc,0xfe));var _0xc76f=function(_0x517be7,_0x240c5d){_0x517be7=_0x517be7-0x0;var _0x139a3e=_0x76fc[_0x517be7];return _0x139a3e;};'use strict';var ChatGroupEvents=require(_0xc76f('0x0'));var events=[_0xc76f('0x1'),_0xc76f('0x2'),_0xc76f('0x3')];function createListener(_0x4fe02b,_0x1ffa14){return function(_0x39c2d2){_0x1ffa14['emit'](_0x4fe02b,_0x39c2d2);};}function removeListener(_0x43f870,_0x375b2f){return function(){ChatGroupEvents[_0xc76f('0x4')](_0x43f870,_0x375b2f);};}exports[_0xc76f('0x5')]=function(_0xf4b017){for(var _0x47d63a=0x0,_0x3d1e3f=events[_0xc76f('0x6')];_0x47d63a<_0x3d1e3f;_0x47d63a++){var _0x14f5eb=events[_0x47d63a];var _0xcd479f=createListener(_0xc76f('0x7')+_0x14f5eb,_0xf4b017);ChatGroupEvents['on'](_0x14f5eb,_0xcd479f);}}; \ No newline at end of file +var _0x719b=['removeListener','length','./chatGroup.events','save','remove','update'];(function(_0xfde90,_0x27fe63){var _0x268892=function(_0xb57387){while(--_0xb57387){_0xfde90['push'](_0xfde90['shift']());}};_0x268892(++_0x27fe63);}(_0x719b,0xa4));var _0xb719=function(_0x37dbdc,_0x1407ce){_0x37dbdc=_0x37dbdc-0x0;var _0x5f18b7=_0x719b[_0x37dbdc];return _0x5f18b7;};'use strict';var ChatGroupEvents=require(_0xb719('0x0'));var events=[_0xb719('0x1'),_0xb719('0x2'),_0xb719('0x3')];function createListener(_0x4def2a,_0x2e0d9f){return function(_0x4718b9){_0x2e0d9f['emit'](_0x4def2a,_0x4718b9);};}function removeListener(_0x58f9be,_0x546ebb){return function(){ChatGroupEvents[_0xb719('0x4')](_0x58f9be,_0x546ebb);};}exports['register']=function(_0x17ab38){for(var _0x4d2c0a=0x0,_0x170d42=events[_0xb719('0x5')];_0x4d2c0a<_0x170d42;_0x4d2c0a++){var _0x1360ca=events[_0x4d2c0a];var _0x53a453=createListener('chatGroup:'+_0x1360ca,_0x17ab38);ChatGroupEvents['on'](_0x1360ca,_0x53a453);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 20c9b76..7d64336 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 _0x063a=['get','isAuthenticated','/describe','/:id','show','/:id/unread','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','addMessage','put','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatGroup.controller'];(function(_0x46d7d8,_0x2e7e34){var _0x141154=function(_0x45bf4e){while(--_0x45bf4e){_0x46d7d8['push'](_0x46d7d8['shift']());}};_0x141154(++_0x2e7e34);}(_0x063a,0x1b2));var _0xa063=function(_0x446791,_0x39756e){_0x446791=_0x446791-0x0;var _0x2f77fa=_0x063a[_0x446791];return _0x2f77fa;};'use strict';var multer=require(_0xa063('0x0'));var util=require(_0xa063('0x1'));var path=require(_0xa063('0x2'));var timeout=require(_0xa063('0x3'));var express=require(_0xa063('0x4'));var router=express[_0xa063('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa063('0x6'));var controller=require(_0xa063('0x7'));router[_0xa063('0x8')]('/',auth[_0xa063('0x9')](),controller['index']);router[_0xa063('0x8')](_0xa063('0xa'),auth[_0xa063('0x9')](),controller['describe']);router[_0xa063('0x8')](_0xa063('0xb'),auth[_0xa063('0x9')](),controller[_0xa063('0xc')]);router[_0xa063('0x8')](_0xa063('0xd'),auth[_0xa063('0x9')](),controller['getUnread']);router[_0xa063('0x8')](_0xa063('0xe'),auth[_0xa063('0x9')](),controller[_0xa063('0xf')]);router[_0xa063('0x8')]('/:id/messages',auth[_0xa063('0x9')](),controller[_0xa063('0x10')]);router[_0xa063('0x11')]('/',auth[_0xa063('0x9')](),controller[_0xa063('0x12')]);router[_0xa063('0x11')]('/:id/members',auth[_0xa063('0x9')](),controller[_0xa063('0x13')]);router[_0xa063('0x11')](_0xa063('0x14'),auth[_0xa063('0x9')](),controller[_0xa063('0x15')]);router[_0xa063('0x16')](_0xa063('0xb'),auth[_0xa063('0x9')](),controller['update']);router[_0xa063('0x17')](_0xa063('0xb'),auth[_0xa063('0x9')](),controller[_0xa063('0x18')]);router[_0xa063('0x17')](_0xa063('0xe'),auth[_0xa063('0x9')](),controller[_0xa063('0x19')]);module['exports']=router; \ No newline at end of file +var _0xcec3=['../../config/environment','isAuthenticated','get','/describe','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','removeMembers','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x1f1689,_0x2770ea){var _0x6800c=function(_0x1e56e7){while(--_0x1e56e7){_0x1f1689['push'](_0x1f1689['shift']());}};_0x6800c(++_0x2770ea);}(_0xcec3,0x90));var _0x3cec=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcec3[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x3cec('0x0'));var util=require(_0x3cec('0x1'));var path=require('path');var timeout=require(_0x3cec('0x2'));var express=require(_0x3cec('0x3'));var router=express[_0x3cec('0x4')]();var fs_extra=require(_0x3cec('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3cec('0x6'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0x3cec('0x7')](),controller['index']);router[_0x3cec('0x8')](_0x3cec('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x3cec('0x8')]('/:id',auth[_0x3cec('0x7')](),controller[_0x3cec('0xa')]);router[_0x3cec('0x8')](_0x3cec('0xb'),auth[_0x3cec('0x7')](),controller['getUnread']);router[_0x3cec('0x8')](_0x3cec('0xc'),auth[_0x3cec('0x7')](),controller[_0x3cec('0xd')]);router[_0x3cec('0x8')](_0x3cec('0xe'),auth[_0x3cec('0x7')](),controller[_0x3cec('0xf')]);router[_0x3cec('0x10')]('/',auth['isAuthenticated'](),controller[_0x3cec('0x11')]);router[_0x3cec('0x10')]('/:id/members',auth[_0x3cec('0x7')](),controller['addMembers']);router[_0x3cec('0x10')](_0x3cec('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0x3cec('0x12')](_0x3cec('0x13'),auth[_0x3cec('0x7')](),controller[_0x3cec('0x14')]);router[_0x3cec('0x15')](_0x3cec('0x13'),auth[_0x3cec('0x7')](),controller[_0x3cec('0x16')]);router[_0x3cec('0x15')](_0x3cec('0xc'),auth[_0x3cec('0x7')](),controller[_0x3cec('0x17')]);module[_0x3cec('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 99b4cbf..3c7a782 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 _0x3da6=['star','thumb','TEXT','DATE','STRING','long','sequelize','exports','BOOLEAN','INTEGER','ENUM'];(function(_0x4c2fb1,_0x37979b){var _0x118a8c=function(_0x11f192){while(--_0x11f192){_0x4c2fb1['push'](_0x4c2fb1['shift']());}};_0x118a8c(++_0x37979b);}(_0x3da6,0xc1));var _0x63da=function(_0x26013b,_0x23d44e){_0x26013b=_0x26013b-0x0;var _0x16a91f=_0x3da6[_0x26013b];return _0x16a91f;};'use strict';var Sequelize=require(_0x63da('0x0'));module[_0x63da('0x1')]={'closed':{'type':Sequelize[_0x63da('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x63da('0x3')]},'ratingType':{'type':Sequelize[_0x63da('0x4')](_0x63da('0x5'),_0x63da('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x63da('0x7')]},'pathTranscript':{'type':Sequelize[_0x63da('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x63da('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x63da('0x9')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x63da('0x9')]},'browserName':{'type':Sequelize[_0x63da('0x9')]},'browserVersion':{'type':Sequelize[_0x63da('0x9')]},'osName':{'type':Sequelize[_0x63da('0x9')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x63da('0x9')]},'deviceVendor':{'type':Sequelize[_0x63da('0x9')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x63da('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x63da('0x7')](_0x63da('0xa'))},'read1stAt':{'type':Sequelize[_0x63da('0x8')]},'lastMsgAt':{'type':Sequelize[_0x63da('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x63da('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x63da('0x9')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x63da('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x63da('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd9dc=['thumb','TEXT','STRING','DATE','long','exports','BOOLEAN','ENUM','star'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x6651c3,_0x13210f){_0x6651c3=_0x6651c3-0x0;var _0x3d1598=_0xd9dc[_0x6651c3];return _0x3d1598;};'use strict';var Sequelize=require('sequelize');module[_0xcd9d('0x0')]={'closed':{'type':Sequelize[_0xcd9d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xcd9d('0x2')](_0xcd9d('0x3'),_0xcd9d('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xcd9d('0x5')]},'pathTranscript':{'type':Sequelize[_0xcd9d('0x5')]},'mailTranscript':{'type':Sequelize[_0xcd9d('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xcd9d('0x7')]},'disposition':{'type':Sequelize[_0xcd9d('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcd9d('0x6')]},'note':{'type':Sequelize[_0xcd9d('0x6')]},'browserName':{'type':Sequelize[_0xcd9d('0x6')]},'browserVersion':{'type':Sequelize[_0xcd9d('0x6')]},'osName':{'type':Sequelize[_0xcd9d('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xcd9d('0x6')]},'deviceVendor':{'type':Sequelize[_0xcd9d('0x6')]},'deviceType':{'type':Sequelize[_0xcd9d('0x6')]},'referer':{'type':Sequelize[_0xcd9d('0x5')]},'customerIp':{'type':Sequelize[_0xcd9d('0x6')]},'formData':{'type':Sequelize[_0xcd9d('0x5')](_0xcd9d('0x8'))},'read1stAt':{'type':Sequelize[_0xcd9d('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcd9d('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xcd9d('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xcd9d('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xcd9d('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9ab9a68..4a7b749 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 _0x36ee=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','u.id\x20=\x20ui.UserId','chat_interactions','left_join','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','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','length','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','start','Tag','User','UserId','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20=\x20?','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','includeAll','options','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','POST','email','vidaooNote','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','transcript-%s.txt','Messages','format','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','addMessage','omit','ids','getMessages','include','findAll','rows','getMyMessages','includeAgent','spread','emit','chatInteractionTags:save','removeTags','unix','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','secret','read','Owner','get','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','osName','referer','customerIp','createReadStream','pipe','createWriteStream','out','server','views','downloadInteraction.ejs','log','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','limit','undefined','offset','count','set','apply','reject','save','update','then','end','sendStatus','stack','name','send','render','merge','body','contact','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','push','index','map','ChatInteraction','rawAttributes','type','key','model','query','keys'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var pdf=require(_0xe36e('0x12'));var hardwareService=require(_0xe36e('0x13'));var logger=require(_0xe36e('0x14'))(_0xe36e('0x15'));var utils=require(_0xe36e('0x16'));var config=require(_0xe36e('0x17'));var licenseUtil=require(_0xe36e('0x18'));var db=require('../../mysqldb')['db'];config[_0xe36e('0x19')]=_[_0xe36e('0x1a')](config[_0xe36e('0x19')],{'host':_0xe36e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe36e('0x19')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xe36e('0x1c'));var client=jayson[_0xe36e('0x1d')][_0xe36e('0x1e')]({'port':0x232b});var client9004=jayson[_0xe36e('0x1d')][_0xe36e('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x924cd5,_0x2096f6,_0x39bae8,_0x387c37){return new BPromise(function(_0x428d34,_0x5792e8){var _0x333554=_0x387c37||client;return _0x333554[_0xe36e('0x1f')](_0x924cd5,_0x39bae8)['then'](function(_0x21d9a3){logger['info'](_0xe36e('0x20'),_0x2096f6,_0xe36e('0x21'));logger['debug'](_0xe36e('0x22'),_0x2096f6,_0xe36e('0x21'),JSON[_0xe36e('0x23')](_0x21d9a3));if(_0x21d9a3['error']){if(_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x25')]===0x1f4){logger[_0xe36e('0x24')](_0xe36e('0x20'),_0x2096f6,_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x26')]);return _0x5792e8(_0x21d9a3['error'][_0xe36e('0x26')]);}logger[_0xe36e('0x24')](_0xe36e('0x20'),_0x2096f6,_0x21d9a3[_0xe36e('0x24')][_0xe36e('0x26')]);return _0x428d34(_0x21d9a3['error']['message']);}else{logger[_0xe36e('0x27')](_0xe36e('0x20'),_0x2096f6,_0xe36e('0x21'));_0x428d34(_0x21d9a3[_0xe36e('0x28')][_0xe36e('0x26')]);}})[_0xe36e('0x29')](function(_0x1a045c){logger['error'](_0xe36e('0x20'),_0x2096f6,_0x1a045c);_0x5792e8(_0x1a045c);});});}function respondWithStatusCode(_0x35f9e7,_0x10597f){_0x10597f=_0x10597f||0xcc;return function(_0x262caa){if(_0x262caa){return _0x35f9e7['sendStatus'](_0x10597f);}return _0x35f9e7[_0xe36e('0x2a')](_0x10597f)['end']();};}function respondWithResult(_0xf7b02e,_0x5993de){_0x5993de=_0x5993de||0xc8;return function(_0x19f001){if(_0x19f001){return _0xf7b02e['status'](_0x5993de)[_0xe36e('0x2b')](_0x19f001);}};}function respondWithFilteredResult(_0x4c5d98,_0x3b1045){return function(_0x59548b){if(_0x59548b){var _0x4bb75b=typeof _0x3b1045['offset']==='undefined'&&typeof _0x3b1045[_0xe36e('0x2c')]===_0xe36e('0x2d');var _0x4cf185=_0x59548b['count'];var _0x1fa1ec=_0x4bb75b?0x0:_0x3b1045[_0xe36e('0x2e')];var _0x259e19=_0x4bb75b?_0x59548b[_0xe36e('0x2f')]:_0x3b1045[_0xe36e('0x2e')]+_0x3b1045[_0xe36e('0x2c')];var _0x57bb9b;if(_0x259e19>=_0x4cf185){_0x259e19=_0x4cf185;_0x57bb9b=0xc8;}else{_0x57bb9b=0xce;}_0x4c5d98[_0xe36e('0x2a')](_0x57bb9b);return _0x4c5d98[_0xe36e('0x30')]('Content-Range',_0x1fa1ec+'-'+_0x259e19+'/'+_0x4cf185)[_0xe36e('0x2b')](_0x59548b);}return null;};}function patchUpdates(_0xa06f61){return function(_0xba4869){try{jsonpatch[_0xe36e('0x31')](_0xba4869,_0xa06f61,!![]);}catch(_0x21623e){return BPromise[_0xe36e('0x32')](_0x21623e);}return _0xba4869[_0xe36e('0x33')]();};}function saveUpdates(_0x127807,_0x36cee2){return function(_0x1cc329){if(_0x1cc329){return _0x1cc329[_0xe36e('0x34')](_0x127807)['then'](function(_0x4507b9){return _0x4507b9;});}return null;};}function removeEntity(_0x59231e,_0x4a717e){return function(_0x81cf9a){if(_0x81cf9a){return _0x81cf9a['destroy']()[_0xe36e('0x35')](function(){_0x59231e[_0xe36e('0x2a')](0xcc)[_0xe36e('0x36')]();});}};}function handleEntityNotFound(_0x235437,_0x4a6a2b){return function(_0x56135c){if(!_0x56135c){_0x235437[_0xe36e('0x37')](0x194);}return _0x56135c;};}function handleError(_0x222c65,_0x19a53f){_0x19a53f=_0x19a53f||0x1f4;return function(_0x243338){logger['error'](_0x243338[_0xe36e('0x38')]);if(_0x243338[_0xe36e('0x39')]){delete _0x243338[_0xe36e('0x39')];}_0x222c65['status'](_0x19a53f)[_0xe36e('0x3a')](_0x243338);};}function getMustacheRender(_0x2ff8f4,_0x5d9f64){return Mustache[_0xe36e('0x3b')](_0x2ff8f4,_[_0xe36e('0x3c')](_0x5d9f64[_0xe36e('0x3d')],{'contact':_0x5d9f64[_0xe36e('0x3e')],'message':_0x5d9f64[_0xe36e('0x26')],'agent':_0x5d9f64[_0xe36e('0x3f')],'interaction':_0x5d9f64[_0xe36e('0x40')],'account':_0x5d9f64[_0xe36e('0x41')]}))||'';}function getInteractionUsers(_0x458a4e,_0x23da09){return new BPromise(function(_0x2f1933,_0x39dd9b){try{if(_0x23da09[_0x458a4e['id']]){_0x458a4e[_0xe36e('0x42')]=_['map'](_0x23da09[_0x458a4e['id']],function(_0x23d36e){return{'id':_0x23d36e['id'],'fullname':_0x23d36e[_0xe36e('0x43')]};});}}catch(_0xd45bb3){_0x39dd9b(_0xd45bb3);}_0x2f1933(_0x458a4e);});}function getInteractionTags(_0x11ee1d,_0x295feb){return new BPromise(function(_0x4d133b,_0x591e33){try{if(_0x11ee1d[_0xe36e('0x44')]){_0x11ee1d[_0xe36e('0x45')]=[];_0x11ee1d[_0xe36e('0x44')][_0xe36e('0x46')](',')[_0xe36e('0x47')](function(_0x34a1ba){_0x11ee1d[_0xe36e('0x45')][_0xe36e('0x48')](_0x295feb[_0x34a1ba]);});}delete _0x11ee1d['TagIds'];}catch(_0x198a40){_0x591e33(_0x198a40);}_0x4d133b(_0x11ee1d);});}function updateChatInteraction(_0x2d392c,_0x4788a0,_0x21dc35){return new BPromise(function(_0x5ef3e4,_0x23e344){return getInteractionUsers(_0x2d392c,_0x21dc35)[_0xe36e('0x35')](function(_0x1d45a4){return getInteractionTags(_0x1d45a4,_0x4788a0);})[_0xe36e('0x35')](function(_0x3b1269){_0x5ef3e4(_0x3b1269);})['catch'](function(_0x2ffc34){_0x23e344(_0x2ffc34);});});}exports[_0xe36e('0x49')]=function(_0x2265c4,_0x1dddfe){var _0x2e57f4={},_0x31760e={},_0x569809={'count':0x0,'rows':[]};var _0x122704=_[_0xe36e('0x4a')](db[_0xe36e('0x4b')][_0xe36e('0x4c')],function(_0x1cbb7d){return{'name':_0x1cbb7d['fieldName'],'type':_0x1cbb7d[_0xe36e('0x4d')][_0xe36e('0x4e')]};});_0x31760e[_0xe36e('0x4f')]=_[_0xe36e('0x4a')](_0x122704,_0xe36e('0x39'));_0x31760e[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x2265c4[_0xe36e('0x50')]);_0x31760e[_0xe36e('0x52')]=_['intersection'](_0x31760e['model'],_0x31760e[_0xe36e('0x50')]);_0x2e57f4['attributes']=_[_0xe36e('0x53')](_0x31760e[_0xe36e('0x4f')],qs[_0xe36e('0x54')](_0x2265c4[_0xe36e('0x50')]['fields']));_0x2e57f4[_0xe36e('0x55')]=_0x2e57f4[_0xe36e('0x55')]['length']?_0x2e57f4[_0xe36e('0x55')]:_0x31760e[_0xe36e('0x4f')];if(!_0x2265c4[_0xe36e('0x50')][_0xe36e('0x56')](_0xe36e('0x57'))){_0x2e57f4[_0xe36e('0x2c')]=qs[_0xe36e('0x2c')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x2c')]);_0x2e57f4[_0xe36e('0x2e')]=qs[_0xe36e('0x2e')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x2e57f4[_0xe36e('0x58')]=qs[_0xe36e('0x59')](_0x2265c4['query'][_0xe36e('0x59')]);_0x2e57f4['where']=qs['filters'](_[_0xe36e('0x5a')](_0x2265c4[_0xe36e('0x50')],_0x31760e['filters']),_0x122704);var _0x3ec864=[];var _0x3814eb=squel[_0xe36e('0x5b')]()[_0xe36e('0x5c')]('id')[_0xe36e('0x5c')](_0xe36e('0x39'))[_0xe36e('0x5c')](_0xe36e('0x5d'))[_0xe36e('0x5e')]('tools_tags');var _0x22117e=squel[_0xe36e('0x5b')]()['field'](_0xe36e('0x5f'))[_0xe36e('0x5c')](_0xe36e('0x60'))[_0xe36e('0x5c')](_0xe36e('0x61'))['from']('user_has_chat_interactions','ui')['left_join']('users','u',_0xe36e('0x62'));var _0x2fab4c=squel[_0xe36e('0x5b')]()[_0xe36e('0x5e')](_0xe36e('0x63'),'i')[_0xe36e('0x64')](_0xe36e('0x65'),'c',_0xe36e('0x66'))[_0xe36e('0x64')]('users','o',_0xe36e('0x67'))[_0xe36e('0x64')]('chat_websites','a',_0xe36e('0x68'))[_0xe36e('0x64')](_0xe36e('0x69'),'me',_0xe36e('0x6a'))[_0xe36e('0x64')](_0xe36e('0x6b'),'it',_0xe36e('0x6c'))[_0xe36e('0x64')](_0xe36e('0x6d'),'t',_0xe36e('0x6e'));var _0x56718a=squel[_0xe36e('0x6f')]();var _0x389e91=[];var _0x6f979f=squel[_0xe36e('0x6f')]();var _0x3e4860;if(_0x2265c4[_0xe36e('0x50')][_0xe36e('0x70')]){_0x3e4860=as[_0xe36e('0x71')](_0x2265c4[_0xe36e('0x50')][_0xe36e('0x70')]);var _0x432584=_0x3e4860[_0xe36e('0x72')];for(var _0x434d88=0x0;_0x434d88<_0x3e4860[_0xe36e('0x73')]['length'];_0x434d88++){var _0x429a01=_0x3e4860[_0xe36e('0x73')][_0x434d88];var _0x49336b='i';var _0xce5583=_[_0xe36e('0x74')](_0x122704,[_0xe36e('0x39'),_0x429a01[_0xe36e('0x5c')]]);if(!_0xce5583){switch(_0x429a01[_0xe36e('0x5c')]){case _0xe36e('0x75'):if(_0x429a01['value']==0x1){_0x2fab4c[_0xe36e('0x76')]('`'+_0x429a01['field']+_0xe36e('0x77'));}else{_0x2fab4c[_0xe36e('0x76')]('`'+_0x429a01[_0xe36e('0x5c')]+_0xe36e('0x78'));}break;case _0xe36e('0x79'):if(_0x429a01[_0xe36e('0x7a')]===_0xe36e('0x7b')){if(_0x429a01[_0xe36e('0x7c')]['split']('\x20')[_0xe36e('0x7d')]>0x1){_0x56718a[_0x432584](_0xe36e('0x7e'),qs['getFullTextValue'](_0x429a01[_0xe36e('0x7c')]),null);}else{var _0x2bf9ac='%'+_0x429a01[_0xe36e('0x7c')]+'%';_0x56718a[_0x432584](_0xe36e('0x7f'),_0x2bf9ac,_0x2bf9ac,_0x2bf9ac);}}else{_0xce5583=_[_0xe36e('0x74')](_0x122704,[_0xe36e('0x39'),_0xe36e('0x80')]);_0x429a01['field']=_0xe36e('0x80');_0x483e06=as[_0xe36e('0x81')](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);}break;case _0xe36e('0x84'):var _0xeab452=_0x429a01[_0xe36e('0x7c')]['split'](',')[_0xe36e('0x4a')](function(_0x9a77de){return Number(_0x9a77de);});_0xeab452[_0xe36e('0x47')](function(_0x2f05f5){_0x6f979f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2f05f5+',%');});_0x389e91=_['union'](_0x389e91,_0xeab452);break;case _0xe36e('0x85'):if(_0x429a01['operator']==='$substring'){_0x56718a[_0x432584]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x429a01[_0xe36e('0x7c')]+'%',null);}else{_0xce5583=_['find'](_0x122704,[_0xe36e('0x39'),_0xe36e('0x86')]);_0x429a01[_0xe36e('0x5c')]=_0xe36e('0x86');_0x483e06=as[_0xe36e('0x81')](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06['value'][_0xe36e('0x36')]);}break;case'body':_0x483e06=as[_0xe36e('0x81')]('me',null,_0x429a01);_0x56718a[_0x432584](_0x483e06['text'],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);break;}}else{var _0x483e06=as['buildExpression'](_0x49336b,_0xce5583[_0xe36e('0x4d')],_0x429a01);_0x56718a[_0x432584](_0x483e06[_0xe36e('0x82')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x83')],_0x483e06[_0xe36e('0x7c')][_0xe36e('0x36')]);}}}else{var _0x57ae0d=_(_0x2265c4[_0xe36e('0x50')])[_0xe36e('0x51')]()['map'](function(_0xb83ea7){return _['some'](_0x122704,[_0xe36e('0x39'),_0xb83ea7])?_0xb83ea7:undefined;})[_0xe36e('0x87')]()[_0xe36e('0x7c')]();if(!_[_0xe36e('0x88')](_0x57ae0d)){_0x57ae0d['forEach'](function(_0x2d920e){if(_0x2d920e==='ChatWebsiteId'){_0x2fab4c['where'](_0xe36e('0x89'),[][_0xe36e('0x8a')](_0x2265c4['query'][_0x2d920e]));}else if(_0x2d920e==='createdAt'){var _0x460cc9=JSON['parse'](_0x2265c4[_0xe36e('0x50')][_0x2d920e])[_0xe36e('0x8b')];var _0x2c0ed5=JSON[_0xe36e('0x8c')](_0x2265c4[_0xe36e('0x50')][_0x2d920e])[_0xe36e('0x8d')];_0x2fab4c['where'](_0xe36e('0x8e'),_0x460cc9,_0x2c0ed5);}else{if(_0x2265c4[_0xe36e('0x50')][_0x2d920e]===_0xe36e('0x8f')){_0x2fab4c[_0xe36e('0x90')]('i.'+_0x2d920e+'\x20IS\x20NULL');}else{_0x2fab4c[_0xe36e('0x90')]('i.'+_0x2d920e+_0xe36e('0x91'),_0x2265c4[_0xe36e('0x50')][_0x2d920e]);}}});}if(_0x2265c4[_0xe36e('0x50')]['read']){if(_0x2265c4[_0xe36e('0x50')]['read']==0x1){_0x2fab4c[_0xe36e('0x76')]('`unreadMessages`\x20=\x200');}else{_0x2fab4c[_0xe36e('0x76')]('`unreadMessages`\x20>\x200');}}if(_0x2265c4['query'][_0xe36e('0x92')]){_0x389e91=_[_0xe36e('0x93')](_0x2265c4[_0xe36e('0x50')]['tag'])?_0x2265c4[_0xe36e('0x50')][_0xe36e('0x92')]:new Array(_0x2265c4['query'][_0xe36e('0x92')]);_0x389e91[_0xe36e('0x47')](function(_0x156e7f){_0x6f979f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x156e7f+',%');});}if(_0x2265c4['query'][_0xe36e('0x94')]){var _0x2ba37a=_0x2265c4[_0xe36e('0x50')][_0xe36e('0x94')][_0xe36e('0x95')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe36e('0x96')](_0x2ba37a)){_0x56718a['or'](_0xe36e('0x97'),_0x2ba37a+'%');}else{_0x56718a['or'](_0xe36e('0x98'),qs[_0xe36e('0x99')](_0x2ba37a))['or'](_0xe36e('0x9a'),_0x2ba37a+'%');}}}_0x2fab4c['where'](_0x56718a);_0x2fab4c[_0xe36e('0x9b')](_0xe36e('0x9c'));var _0x188dc9={'type':db['Sequelize'][_0xe36e('0x9d')]['SELECT'],'raw':!![]};var _0x2ee394=_0x2fab4c['clone']();_0x2ee394[_0xe36e('0x5c')](_0xe36e('0x9c'));_0x2ee394['field'](_0xe36e('0x9e'),'unreadMessages');if(_0x2e57f4[_0xe36e('0x58')]){_0x2e57f4[_0xe36e('0x58')][_0xe36e('0x47')](function(_0x201212){var _0x431aac=_0x201212[0x0]==='contactName'?_0x201212[0x0]:'i.'+_0x201212[0x0];_0x2fab4c[_0xe36e('0x58')](_0x431aac,_0x201212[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe36e('0x88')](_0x389e91)){_0x2fab4c[_0xe36e('0x76')](_0x6f979f);_0x2ee394[_0xe36e('0x90')](_0xe36e('0x9f'),_0x389e91);}BPromise[_0xe36e('0xa0')]()[_0xe36e('0x35')](function(){if(!_0x3e4860){if(_0x2265c4['query'][_0xe36e('0xa1')])return;_0x2ee394[_0xe36e('0x90')](_0xe36e('0xa2'));_0x2fab4c['where'](_0xe36e('0xa2'));return;}if(_0x2265c4[_0xe36e('0xa3')][_0xe36e('0xa4')]!==_0xe36e('0x3f'))return;return _0x2265c4['user'][_0xe36e('0xa5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11ebdd){if(_['isEmpty'](_0x11ebdd)){_0x2ee394[_0xe36e('0x90')](_0xe36e('0xa6'));_0x2fab4c[_0xe36e('0x90')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x2ee394[_0xe36e('0x90')](_0xe36e('0x89'),_['map'](_0x11ebdd,'id'));_0x2fab4c[_0xe36e('0x90')](_0xe36e('0x89'),_[_0xe36e('0x4a')](_0x11ebdd,'id'));}});})['then'](function(){if(_0x2265c4['user'][_0xe36e('0xa4')]===_0xe36e('0x3f')&&!_0x3e4860&&!_0x2265c4[_0xe36e('0x50')][_0xe36e('0xa1')])return[];return db[_0xe36e('0xa7')]['query'](_0x2ee394[_0xe36e('0xa8')](),_0x188dc9);})[_0xe36e('0x35')](function(_0x2c923b){_0x569809[_0xe36e('0x2f')]=_0x2c923b['length'];if(_0x569809[_0xe36e('0x2f')]===0x0)return[];return db[_0xe36e('0xa7')]['query'](_0x3814eb['toString'](),_0x188dc9)['then'](function(_0x1acffb){_0x3ec864=_['keyBy'](_0x1acffb,'id');_0x188dc9=_['merge'](_0x188dc9,{'model':db[_0xe36e('0x4b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2265c4[_0xe36e('0x50')][_0xe36e('0x54')]){_0x2e57f4[_0xe36e('0x55')][_0xe36e('0x47')](function(_0x378126){_0x2fab4c['field']('i.'+_0x378126);});}else{_0x2fab4c[_0xe36e('0x5c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xa9'),_0xe36e('0xaa'));_0x2fab4c[_0xe36e('0x5c')]('a.mandatoryDisposition',_0xe36e('0xab'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xac'),_0xe36e('0xad'));_0x2fab4c['field'](_0xe36e('0xae'));_0x2fab4c['field'](_0xe36e('0xaf'),_0xe36e('0xb0'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb1'),_0xe36e('0xb2'));_0x2fab4c['field'](_0xe36e('0xb3'),_0xe36e('0xb4'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb5'),_0xe36e('0xb6'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb7'),_0xe36e('0xb8'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xb9'),_0xe36e('0xba'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xbb'),'Owner.fullname');_0x2fab4c['field']('o.internal',_0xe36e('0xbc'));_0x2fab4c[_0xe36e('0x5c')](_0xe36e('0xbd'),_0xe36e('0x44'));}if(_0x2e57f4['limit'])_0x2fab4c[_0xe36e('0x2c')](_0x2e57f4[_0xe36e('0x2c')]);if(_0x2e57f4[_0xe36e('0x2e')])_0x2fab4c[_0xe36e('0x2e')](_0x2e57f4['offset']);return db[_0xe36e('0xa7')][_0xe36e('0x50')](_0x2fab4c[_0xe36e('0xa8')](),_0x188dc9);})[_0xe36e('0x35')](function(_0x515a79){if(_0x515a79['length']>0x0)_0x22117e[_0xe36e('0x90')](_0xe36e('0xbe'),_['map'](_0x515a79,'id'));return db['sequelize']['query'](_0x22117e[_0xe36e('0xa8')](),_0x188dc9)[_0xe36e('0x35')](function(_0xd57a9e){var _0x4d7f1a=_[_0xe36e('0xbf')](_0xd57a9e,_0xe36e('0xc0'));var _0x280812=[];_0x515a79[_0xe36e('0x47')](function(_0x5250c9){_0x280812[_0xe36e('0x48')](updateChatInteraction(_0x5250c9,_0x3ec864,_0x4d7f1a));});return BPromise[_0xe36e('0xc1')](_0x280812);});});})[_0xe36e('0x35')](function(_0x3b4152){_0x569809['rows']=_0x3b4152;return _0x569809;})[_0xe36e('0x35')](respondWithFilteredResult(_0x1dddfe,_0x2e57f4))['catch'](handleError(_0x1dddfe,null));};exports[_0xe36e('0xc2')]=function(_0x4c169c,_0x1c95cd){var _0x2b3e81={'raw':![],'where':{'id':_0x4c169c[_0xe36e('0xc3')]['id']}},_0x498822={};_0x498822[_0xe36e('0x4f')]=_['keys'](db[_0xe36e('0x4b')][_0xe36e('0x4c')]);_0x498822[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x4c169c[_0xe36e('0x50')]);_0x498822[_0xe36e('0x52')]=_['intersection'](_0x498822[_0xe36e('0x4f')],_0x498822[_0xe36e('0x50')]);_0x2b3e81['attributes']=_[_0xe36e('0x53')](_0x498822['model'],qs[_0xe36e('0x54')](_0x4c169c[_0xe36e('0x50')][_0xe36e('0x54')]));_0x2b3e81[_0xe36e('0x55')]=_0x2b3e81['attributes'][_0xe36e('0x7d')]?_0x2b3e81[_0xe36e('0x55')]:_0x498822[_0xe36e('0x4f')];if(_0x4c169c[_0xe36e('0x50')][_0xe36e('0xc4')]){_0x2b3e81['include']=[{'all':!![]}];}_0x2b3e81=_[_0xe36e('0x3c')]({},_0x2b3e81,_0x4c169c[_0xe36e('0xc5')]);return db['ChatInteraction']['find'](_0x2b3e81)[_0xe36e('0x35')](handleEntityNotFound(_0x1c95cd,null))['then'](respondWithResult(_0x1c95cd,null))[_0xe36e('0x29')](handleError(_0x1c95cd,null));};exports[_0xe36e('0xc6')]=function(_0x23dfd7,_0x3f9c84){return db[_0xe36e('0x4b')][_0xe36e('0xc6')](_0x23dfd7[_0xe36e('0x3d')],{})[_0xe36e('0x35')](respondWithResult(_0x3f9c84,0xc9))[_0xe36e('0x29')](handleError(_0x3f9c84,null));};exports[_0xe36e('0x34')]=function(_0x4ca2cc,_0xab0e50){if(_0x4ca2cc['body']['id']){delete _0x4ca2cc[_0xe36e('0x3d')]['id'];}return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x4ca2cc['params']['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0xab0e50,null))[_0xe36e('0x35')](saveUpdates(_0x4ca2cc['body'],null))[_0xe36e('0x35')](respondWithResult(_0xab0e50,null))['catch'](handleError(_0xab0e50,null));};exports[_0xe36e('0xc7')]=function(_0x3d14b1,_0x3246c6){return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x3d14b1[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x3246c6,null))[_0xe36e('0x35')](removeEntity(_0x3246c6,null))[_0xe36e('0x29')](handleError(_0x3246c6,null));};exports[_0xe36e('0xc8')]=function(_0x166c22,_0x47b082){return db['ChatInteraction'][_0xe36e('0xc8')]()[_0xe36e('0x35')](respondWithResult(_0x47b082,null))[_0xe36e('0x29')](handleError(_0x47b082,null));};exports[_0xe36e('0xc9')]=function(_0x5b3f98,_0xf38a08){var _0x24a0f6=_0x5b3f98['params']['id'];var _0x281519;var _0x4d12f6;var _0x260fff;return db[_0xe36e('0x4b')][_0xe36e('0xca')]({'where':{'id':_0x24a0f6}})['then'](function(_0x142caa){_0x281519=_0x142caa;return db[_0xe36e('0xcb')][_0xe36e('0xca')]({'where':{'id':_0x142caa[_0xe36e('0xa1')]},'attributes':['id',_0xe36e('0xcc'),_0xe36e('0xcd'),_0xe36e('0xce'),'vidaooNote',_0xe36e('0xcf')],'raw':!![]});})[_0xe36e('0x35')](function(_0x2d890a){if(_0x2d890a&&_0x2d890a[_0xe36e('0xcc')]&&_0x2d890a[_0xe36e('0xcd')]){_0x4d12f6=_0x2d890a;var _0x165372={'interaction':{'id':_0x24a0f6},'agent':{'id':_0x5b3f98[_0xe36e('0xa3')]['id'],'name':_0x5b3f98[_0xe36e('0xa3')][_0xe36e('0x39')],'fullname':_0x5b3f98['user'][_0xe36e('0x43')],'email':_0x5b3f98[_0xe36e('0xa3')]['email']},'contact':_0x5b3f98['body']['contact'],'account':_0x5b3f98[_0xe36e('0x3d')][_0xe36e('0x41')]};var _0x4ed60e={'rejectUnauthorized':![],'method':_0xe36e('0xd0'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2d890a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5b3f98['user'][_0xe36e('0xd1')]],'buttons':null,'topic':_0x4d12f6[_0xe36e('0xce')],'note':_['isNull'](_0x4d12f6[_0xe36e('0xd2')])?null:getMustacheRender(_0x4d12f6[_0xe36e('0xd2')],_0x165372),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xe36e('0xd3')](_0x4d12f6[_0xe36e('0xcf')])){var _0x493407=getMustacheRender(_0x4d12f6[_0xe36e('0xcf')],_0x165372);var _0x3d451f=JSON['parse'](_0x493407);_0x4ed60e['body'][_0xe36e('0xd4')]=_0x3d451f;}}catch(_0x1e018b){throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xd7'));}return rp(_0x4ed60e);}else{throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xd8'));}})['then'](function(_0x44cf3d){_0x260fff=_0x44cf3d;if(_0x260fff['id']){var _0x7b1e8f={'body':_0x260fff[_0xe36e('0xd9')],'ChatWebsiteId':_0x4d12f6['id'],'ChatInteractionId':_0x281519['id'],'direction':'out','UserId':_0x5b3f98[_0xe36e('0xa3')]['id']};return db[_0xe36e('0xda')][_0xe36e('0xc6')](_0x7b1e8f,{});}else{throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xdb'));}})['then'](function(){return _0x281519[_0xe36e('0xdc')]({'vidaooSessionId':_0x260fff['id']});})[_0xe36e('0x35')](respondWithResult(_0xf38a08,null))['catch'](handleError(_0xf38a08,null));};exports['customUpdate']=function(_0x33f382,_0x4a6986){if(_0x33f382[_0xe36e('0x3d')]['id']){delete _0x33f382[_0xe36e('0x3d')]['id'];}return db['ChatInteraction'][_0xe36e('0x74')]({'where':{'id':_0x33f382[_0xe36e('0xc3')]['id']},'include':[{'model':db[_0xe36e('0xdd')],'as':_0xe36e('0x79')}]})['then'](handleEntityNotFound(_0x4a6986,null))['then'](saveUpdates(_0x33f382[_0xe36e('0x3d')],null))[_0xe36e('0x35')](respondWithResult(_0x4a6986,null))[_0xe36e('0x29')](handleError(_0x4a6986,null));};exports[_0xe36e('0xde')]=function(_0x15bf65,_0x2c2f12,_0x1ec6c5){if(_0x15bf65['body']['id']){delete _0x15bf65[_0xe36e('0x3d')]['id'];}return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x15bf65[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](function(_0x322fc4){if(!_0x322fc4){logger[_0xe36e('0x24')](_0xe36e('0xdf'),_0xe36e('0xde'),0x194,_0xe36e('0xe0'));_0x2c2f12[_0xe36e('0x37')](0x194);}else{if(_0x322fc4['UserId']){throw new db[(_0xe36e('0xd5'))][(_0xe36e('0xd6'))](_0xe36e('0xe1'));}}return _0x322fc4;})[_0xe36e('0x35')](function(_0x478cc9){if(_0x478cc9){return _0x478cc9['update']({'closed':_0x15bf65[_0xe36e('0x3d')]['closed'],'disposition':_0x15bf65[_0xe36e('0x3d')]['disposition']})[_0xe36e('0x35')](function(_0x52de0f){return _0x52de0f;});}})[_0xe36e('0x35')](function(_0x30928a){return respondWithRpcPromise(_0xe36e('0xe2'),_0xe36e('0xde'),_0x15bf65[_0xe36e('0x3d')],client9004);})['then'](respondWithResult(_0x2c2f12,null))[_0xe36e('0x29')](handleError(_0x2c2f12,null));};exports[_0xe36e('0xe3')]=function(_0x3b8631,_0x5bf046,_0x4fc846){_0x3b8631[_0xe36e('0x3d')][_0xe36e('0x39')]=_0x3b8631['file'][_0xe36e('0xe4')];_0x3b8631['body'][_0xe36e('0xe5')]=_0x3b8631[_0xe36e('0xe6')][_0xe36e('0xe7')];_0x3b8631[_0xe36e('0x3d')][_0xe36e('0x4d')]=_0x3b8631[_0xe36e('0xe6')][_0xe36e('0xe8')];return db[_0xe36e('0xe9')][_0xe36e('0xc6')](_0x3b8631[_0xe36e('0x3d')])[_0xe36e('0x35')](respondWithResult(_0x5bf046,0xc9))[_0xe36e('0x29')](handleError(_0x5bf046,null));};exports[_0xe36e('0xea')]=function(_0x50cc85,_0x2ad011,_0x5466b8){return db[_0xe36e('0x4b')][_0xe36e('0xca')]({'where':{'id':_0x50cc85[_0xe36e('0xc3')]['id']},'raw':!![]})[_0xe36e('0x35')](handleEntityNotFound(_0x2ad011,null))[_0xe36e('0x35')](function(_0x57456d){if(_0x57456d){if(_0x57456d[_0xe36e('0xeb')]){return _0x2ad011[_0xe36e('0x2a')](0x193)[_0xe36e('0x2b')]({'status':0x193,'message':_0xe36e('0xec')});}return db[_0xe36e('0xe9')][_0xe36e('0xca')]({'where':{'id':_0x50cc85[_0xe36e('0x50')][_0xe36e('0xed')]},'raw':!![]})[_0xe36e('0x35')](handleEntityNotFound(_0x2ad011,null));}})[_0xe36e('0x35')](function(_0x1a380e){if(_0x1a380e){var _0xd786b8=_0x1a380e[_0xe36e('0xee')]!==null;var _0x38d16c=path['join'](config[_0xe36e('0xef')],_0xe36e('0xf0'));if(_0xd786b8){_0x38d16c=path['join'](_0x38d16c,_0xe36e('0xf1'));}var _0x512a19=path[_0xe36e('0xf2')](_0x38d16c,_0x1a380e['basename']);return _0x2ad011[_0xe36e('0xf3')](_0x512a19);}})[_0xe36e('0x29')](handleError(_0x2ad011,null));};exports[_0xe36e('0xf4')]=function(_0x153b4f,_0x5d2afc){var _0xeb0eb3=null;var _0x67afa3=null;var _0x2e0f59=null;var _0x2644c7=null;if(_0x153b4f[_0xe36e('0x3d')]['id']){delete _0x153b4f[_0xe36e('0x3d')]['id'];}if(_0x153b4f['body'][_0xe36e('0xf5')]){_0x2644c7=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server/files/chat/upload/',util['format'](_0xe36e('0xf6'),Date['now']()));_0x153b4f[_0xe36e('0x3d')]['pathTranscript']=_0x2644c7;}return db[_0xe36e('0x4b')]['find']({'where':{'id':_0x153b4f[_0xe36e('0xc3')]['id']},'include':[{'model':db[_0xe36e('0xda')],'as':_0xe36e('0xf7'),'include':[{'model':db[_0xe36e('0x85')],'as':_0xe36e('0x85')}]}]})[_0xe36e('0x35')](handleEntityNotFound(_0x5d2afc,null))['then'](saveUpdates(_0x153b4f['body'],null))[_0xe36e('0x35')](function(_0x26031e){if(_0x26031e){_0xeb0eb3=_0x26031e;return db[_0xe36e('0xcb')]['find']({'where':{'id':_0xeb0eb3[_0xe36e('0xa1')]}});}})[_0xe36e('0x35')](function(_0xc1d0bd){if(_0xc1d0bd){_0x2e0f59=_0xc1d0bd;return db[_0xe36e('0xdd')][_0xe36e('0x74')]({'where':{'id':_0xeb0eb3[_0xe36e('0x80')]}});}})[_0xe36e('0x35')](function(_0x518d30){if(_0x518d30){_0x67afa3=_0x518d30;if(_0x2644c7){var _0xfb015e=null;for(var _0xd2176=0x1;_0xd2176<_0xeb0eb3[_0xe36e('0xf7')]['length'];++_0xd2176){_0xfb015e=_0xeb0eb3[_0xe36e('0xf7')][_0xd2176];var _0x4727cd=_0xfb015e['UserId']?util[_0xe36e('0xf8')]('%s%d',_0x2e0f59['agentAlias'],_0xfb015e[_0xe36e('0x86')]):'System';var _0x3ac919=_0x153b4f[_0xe36e('0x3d')][_0xe36e('0xf9')]||util['format'](_0xe36e('0xfa'),_0xe36e('0xfb'),_0xfb015e[_0xe36e('0x80')]);switch(_0x2e0f59[_0xe36e('0xfc')]){case _0xe36e('0xfd'):_0x4727cd=_0xfb015e[_0xe36e('0x86')]?util[_0xe36e('0xf8')](_0xe36e('0xfa'),_0x2e0f59[_0xe36e('0xfe')],_0xfb015e[_0xe36e('0x86')]):_0xe36e('0xff');break;case _0xe36e('0x100'):_0x4727cd=_0xfb015e['UserId']?_0xfb015e[_0xe36e('0x85')][_0xe36e('0x101')]||_0xfb015e['User'][_0xe36e('0x43')]:_0xe36e('0xff');break;case'agent_fullname':_0x4727cd=_0xfb015e[_0xe36e('0x86')]?_0xfb015e[_0xe36e('0x85')]['fullname']:_0xe36e('0xff');break;default:_0x4727cd=_0xfb015e[_0xe36e('0x86')]?util[_0xe36e('0xf8')](_0xe36e('0xfa'),_0x2e0f59[_0xe36e('0xfe')],_0xfb015e[_0xe36e('0x86')]):_0xe36e('0xff');}var _0x332cd8=util[_0xe36e('0xf8')](_0xe36e('0x102'),moment(_0xfb015e['createdAt'])[_0xe36e('0xf8')](_0xe36e('0x103')),_0xfb015e['direction']==='in'?_0x3ac919:_0x4727cd,_0xfb015e[_0xe36e('0x3d')]);if(!_0xfb015e['secret']){fs['appendFileSync'](_0x2644c7,_0x332cd8);}}return db['MailAccount'][_0xe36e('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0xe36e('0x104')],'as':_0xe36e('0x105'),'raw':!![]}]});}}})[_0xe36e('0x35')](function(_0x154f52){if(_0x154f52&&_0x154f52['Smtp']&&_0x153b4f[_0xe36e('0x3d')]){var _0x34523d={'tls':{'rejectUnauthorized':![]}};if(_0x154f52['Smtp']['service']){_0x34523d[_0xe36e('0x106')]=_0x154f52[_0xe36e('0x105')][_0xe36e('0x106')];}else{_0x34523d[_0xe36e('0x107')]=_0x154f52['Smtp'][_0xe36e('0x107')];_0x34523d['port']=_0x154f52[_0xe36e('0x105')][_0xe36e('0x108')];_0x34523d[_0xe36e('0x109')]=_0x154f52['Smtp'][_0xe36e('0x109')];}if(_0x154f52['Smtp'][_0xe36e('0x10a')]){_0x34523d[_0xe36e('0x10b')]={'user':_0x154f52[_0xe36e('0x105')][_0xe36e('0xa3')],'pass':_0x154f52[_0xe36e('0x105')][_0xe36e('0x10c')]};}return respondWithRpcPromise(_0xe36e('0x10d'),'sendMail',{'account':_0x34523d,'message':{'from':util[_0xe36e('0xf8')](_0xe36e('0x10e'),_0x154f52['name'],_0x154f52[_0xe36e('0xd1')]||_0x154f52['Smtp'][_0xe36e('0xa3')]),'to':_0x153b4f['body'][_0xe36e('0xf5')],'subject':'Mail\x20Transcript','text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x153b4f[_0xe36e('0x3d')][_0xe36e('0xf5')]),'attachments':[{'path':_0x2644c7}]}})[_0xe36e('0x35')](function(){return _0xeb0eb3;})[_0xe36e('0x29')](function(_0x65e8ae){console[_0xe36e('0x24')](_0x65e8ae);});}else{return _0xeb0eb3;}})[_0xe36e('0x35')](respondWithStatusCode(_0x5d2afc,0xc8))[_0xe36e('0x29')](handleError(_0x5d2afc,null));};exports[_0xe36e('0x10f')]=function(_0x49225b,_0x214f23,_0x29883e){return db[_0xe36e('0xda')][_0xe36e('0x74')]({'where':{'id':_0x49225b[_0xe36e('0xc3')]['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x214f23,null))[_0xe36e('0x35')](function(_0xeb88eb){if(_0xeb88eb){return _0xeb88eb[_0xe36e('0x10f')](_0x49225b[_0xe36e('0x3d')]['ids'],_[_0xe36e('0x110')](_0x49225b['body'],[_0xe36e('0x111'),'id'])||{});}})[_0xe36e('0x35')](respondWithResult(_0x214f23,null))[_0xe36e('0x29')](handleError(_0x214f23,null));};exports[_0xe36e('0x112')]=function(_0x37282a,_0x5e7360,_0x4b4e4f){var _0x5583d8={'raw':![],'where':{}};var _0x542ae6={};var _0x2291e7={'count':0x0,'rows':[]};return db[_0xe36e('0x4b')]['findOne']({'where':{'id':_0x37282a[_0xe36e('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5e7360,null))['then'](function(_0x12e580){if(_0x12e580){_0x542ae6['model']=_[_0xe36e('0x51')](db[_0xe36e('0xda')]['rawAttributes']);_0x542ae6[_0xe36e('0x50')]=_[_0xe36e('0x51')](_0x37282a['query']);_0x542ae6[_0xe36e('0x52')]=_[_0xe36e('0x53')](_0x542ae6[_0xe36e('0x4f')],_0x542ae6[_0xe36e('0x50')]);_0x5583d8[_0xe36e('0x55')]=_[_0xe36e('0x53')](_0x542ae6[_0xe36e('0x4f')],qs['fields'](_0x37282a[_0xe36e('0x50')][_0xe36e('0x54')]));_0x5583d8['attributes']=_0x5583d8['attributes'][_0xe36e('0x7d')]?_0x5583d8[_0xe36e('0x55')]:_0x542ae6['model'];if(!_0x37282a[_0xe36e('0x50')][_0xe36e('0x56')](_0xe36e('0x57'))){_0x5583d8[_0xe36e('0x2c')]=qs[_0xe36e('0x2c')](_0x37282a[_0xe36e('0x50')]['limit']);_0x5583d8['offset']=qs['offset'](_0x37282a[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x5583d8['order']=qs[_0xe36e('0x59')](_0x37282a['query'][_0xe36e('0x59')]);_0x5583d8[_0xe36e('0x90')]=qs['filters'](_[_0xe36e('0x5a')](_0x37282a[_0xe36e('0x50')],_0x542ae6[_0xe36e('0x52')]));_0x5583d8[_0xe36e('0x90')]['ChatInteractionId']=_0x12e580['id'];if(_0x37282a[_0xe36e('0x50')][_0xe36e('0x94')]){_0x5583d8[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x5583d8[_0xe36e('0x90')],{'$or':_['map'](_0x5583d8['attributes'],function(_0xb40daf){var _0x584f19={};_0x584f19[_0xb40daf]={'$like':'%'+_0x37282a['query'][_0xe36e('0x94')]+'%'};return _0x584f19;})});}if(_0x37282a[_0xe36e('0x50')][_0xe36e('0x8b')]){var _0x2ee22b=_0x37282a[_0xe36e('0x50')][_0xe36e('0x8b')][_0xe36e('0x46')](',');var _0x2cfaee={};_0x2cfaee[_0x2ee22b[0x0]]={'$gte':moment(_0x2ee22b[0x1])[_0xe36e('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5583d8[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x5583d8[_0xe36e('0x90')],_0x2cfaee);}_0x5583d8=_[_0xe36e('0x3c')]({},_0x5583d8,_0x37282a[_0xe36e('0xc5')]);return db[_0xe36e('0xda')][_0xe36e('0x2f')]({'where':_0x5583d8['where']})[_0xe36e('0x35')](function(_0x3f0fd2){_0x2291e7[_0xe36e('0x2f')]=_0x3f0fd2;if(_0x37282a[_0xe36e('0x50')][_0xe36e('0xc4')]){_0x5583d8[_0xe36e('0x113')]=[{'all':!![]}];}return db[_0xe36e('0xda')][_0xe36e('0x114')](_0x5583d8);})[_0xe36e('0x35')](function(_0x2c85c5){_0x2291e7[_0xe36e('0x115')]=_0x2c85c5;return _0x2291e7;});}})[_0xe36e('0x35')](respondWithFilteredResult(_0x5e7360,_0x5583d8))[_0xe36e('0x29')](handleError(_0x5e7360,null));};exports[_0xe36e('0x116')]=function(_0x545f90,_0x2291d1,_0x3ccaa5){var _0x19f952={'where':{}},_0x3e706e={},_0x51cea0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xe36e('0xca')]({'where':{'id':_0x545f90['params']['id']}})[_0xe36e('0x35')](handleEntityNotFound(_0x2291d1,null))['then'](function(_0x21ffc7){if(_0x21ffc7){_0x3e706e[_0xe36e('0x4f')]=_['keys'](db[_0xe36e('0xda')][_0xe36e('0x4c')]);_0x3e706e[_0xe36e('0x50')]=_['keys'](_0x545f90[_0xe36e('0x50')]);_0x3e706e[_0xe36e('0x52')]=_[_0xe36e('0x53')](_0x3e706e[_0xe36e('0x4f')],_0x3e706e[_0xe36e('0x50')]);_0x19f952['attributes']=_[_0xe36e('0x53')](_0x3e706e[_0xe36e('0x4f')],qs[_0xe36e('0x54')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x54')]));_0x19f952['attributes']=_0x19f952[_0xe36e('0x55')][_0xe36e('0x7d')]?_0x19f952[_0xe36e('0x55')]:_0x3e706e[_0xe36e('0x4f')];if(!_0x545f90[_0xe36e('0x50')]['hasOwnProperty'](_0xe36e('0x57'))){_0x19f952['limit']=qs[_0xe36e('0x2c')](_0x545f90['query'][_0xe36e('0x2c')]);_0x19f952[_0xe36e('0x2e')]=qs[_0xe36e('0x2e')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x2e')]);}_0x19f952[_0xe36e('0x58')]=qs[_0xe36e('0x59')](_0x545f90[_0xe36e('0x50')][_0xe36e('0x59')]);_0x19f952[_0xe36e('0x90')]=qs[_0xe36e('0x52')](_[_0xe36e('0x5a')](_0x545f90[_0xe36e('0x50')],_0x3e706e['filters']));_0x19f952['where'][_0xe36e('0xc0')]=_0x21ffc7['id'];if(_0x545f90[_0xe36e('0x50')][_0xe36e('0x94')]){_0x19f952[_0xe36e('0x90')]=_[_0xe36e('0x3c')](_0x19f952[_0xe36e('0x90')],{'$or':_[_0xe36e('0x4a')](_0x19f952[_0xe36e('0x55')],function(_0x82c1ae){var _0x5f22b7={};_0x5f22b7[_0x82c1ae]={'$like':'%'+_0x545f90[_0xe36e('0x50')][_0xe36e('0x94')]+'%'};return _0x5f22b7;})});}_0x19f952['where']['secret']=![];if(_0x545f90[_0xe36e('0x50')]['id']){_0x19f952[_0xe36e('0x90')]['id']={'$gt':_0x545f90[_0xe36e('0x50')]['id']};}_0x19f952=_[_0xe36e('0x3c')]({},_0x19f952,_0x545f90['options']);return db[_0xe36e('0xda')]['count']({'where':_0x19f952[_0xe36e('0x90')]})[_0xe36e('0x35')](function(_0x150c17){_0x51cea0[_0xe36e('0x2f')]=_0x150c17;_0x19f952[_0xe36e('0x113')]=[];if(_0x545f90[_0xe36e('0x50')][_0xe36e('0x117')]){_0x19f952['include'][_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':'User','attributes':['id',_0xe36e('0x43'),_0xe36e('0x101')]});}if(_0x545f90[_0xe36e('0x50')]['includeAll']){_0x19f952[_0xe36e('0x113')]=[{'all':!![]}];}return db[_0xe36e('0xda')][_0xe36e('0x114')](_0x19f952);})['then'](function(_0x4553ac){_0x51cea0[_0xe36e('0x115')]=_0x4553ac;return _0x51cea0;});}})['then'](respondWithFilteredResult(_0x2291d1,_0x19f952))[_0xe36e('0x29')](handleError(_0x2291d1,null));};exports['addTags']=function(_0x2cba34,_0x1e7118,_0x4b8d01){return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x2cba34['params']['id']}})['then'](handleEntityNotFound(_0x1e7118,null))[_0xe36e('0x35')](function(_0x4284aa){if(_0x4284aa){return _0x4284aa['setTags'](_0x2cba34['body'][_0xe36e('0x111')],_[_0xe36e('0x110')](_0x2cba34[_0xe36e('0x3d')],[_0xe36e('0x111'),'id'])||{})[_0xe36e('0x118')](function(){return db[_0xe36e('0x84')][_0xe36e('0x114')]({'attributes':['id','name',_0xe36e('0x5d')],'where':{'id':_0x2cba34[_0xe36e('0x3d')][_0xe36e('0x111')]}});})[_0xe36e('0x35')](function(_0x464128){socket[_0xe36e('0x119')](_0xe36e('0x11a'),{'id':Number(_0x2cba34[_0xe36e('0xc3')]['id']),'tags':_0x464128||[]});return{'id':Number(_0x2cba34['params']['id']),'tags':_0x464128||[]};});}})['then'](respondWithResult(_0x1e7118,null))[_0xe36e('0x29')](handleError(_0x1e7118,null));};exports[_0xe36e('0x11b')]=function(_0x262797,_0x40f9f1,_0x457c8e){return db[_0xe36e('0x4b')]['find']({'where':{'id':_0x262797[_0xe36e('0xc3')]['id']}})['then'](handleEntityNotFound(_0x40f9f1,null))['then'](function(_0x31fb7a){if(_0x31fb7a){return _0x31fb7a['removeTags'](_0x262797[_0xe36e('0x50')][_0xe36e('0x111')]);}})[_0xe36e('0x35')](respondWithStatusCode(_0x40f9f1,null))[_0xe36e('0x29')](handleError(_0x40f9f1,null));};exports[_0xe36e('0xf3')]=function(_0x20a347,_0x2c1324){var _0xa7ef59=moment()[_0xe36e('0x11c')]()[_0xe36e('0xa8')]();var _0x3a4701=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server',_0xe36e('0x11d'),'tmp');var _0x1cab01=path[_0xe36e('0xf2')](config[_0xe36e('0xef')],'server',_0xe36e('0x11d'),_0xe36e('0x11e'));var _0x6c8c82=path[_0xe36e('0xf2')](_0x3a4701,_0xa7ef59);var _0x71c885=util['format'](_0xe36e('0x11f'),_0x20a347[_0xe36e('0xc3')]['id'],_0xa7ef59);var _0x29393a=path[_0xe36e('0xf2')](_0x3a4701,_0x71c885);var _0x4e7b14=[];_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':_0xe36e('0x85'),'attributes':['id',_0xe36e('0x43')],'raw':!![]});_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0xdd')],'as':_0xe36e('0x79'),'attributes':['id',_0xe36e('0x120'),_0xe36e('0x121')],'raw':!![]});if(_0x20a347[_0xe36e('0x50')]['attachments']){_0x4e7b14[_0xe36e('0x48')]({'model':db[_0xe36e('0xe9')],'as':'Attachment','raw':!![]});}var _0xecb02b=[{'model':db[_0xe36e('0xda')],'as':_0xe36e('0xf7'),'attributes':['id',_0xe36e('0x3d'),_0xe36e('0x122'),_0xe36e('0x123'),_0xe36e('0x124'),_0xe36e('0x125')],'include':_0x4e7b14}];_0xecb02b[_0xe36e('0x48')]({'model':db[_0xe36e('0xcb')],'as':'Account','attributes':['id',_0xe36e('0x39')]});_0xecb02b[_0xe36e('0x48')]({'model':db[_0xe36e('0x85')],'as':_0xe36e('0x126'),'attributes':['id',_0xe36e('0x43')]});return db[_0xe36e('0x4b')][_0xe36e('0x74')]({'where':{'id':_0x20a347[_0xe36e('0xc3')]['id']},'include':_0xecb02b})[_0xe36e('0x35')](handleEntityNotFound(_0x2c1324,null))[_0xe36e('0x35')](function(_0x4197e9){if(_0x4197e9){var _0x35c442=_0x4197e9[_0xe36e('0x127')]({'plain':!![]});fs['mkdirSync'](_0x6c8c82);var _0x343ad8={'channel':'Chat','account':_0x35c442[_0xe36e('0x128')][_0xe36e('0x39')],'agent':_0x35c442[_0xe36e('0x126')]?_0x35c442[_0xe36e('0x126')]['fullname']:_0xe36e('0x129'),'createdAt':moment(_0x35c442[_0xe36e('0x122')])['format'](_0xe36e('0x12a'))[_0xe36e('0xa8')](),'closedAt':_0x35c442[_0xe36e('0xeb')]?moment(_0x35c442[_0xe36e('0x12b')])[_0xe36e('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe36e('0xa8')]():'','disposition':_0x35c442[_0xe36e('0x12c')],'chatInfo':{'browser':_0x35c442['browserName'],'os':_0x35c442[_0xe36e('0x12d')],'referer':_0x35c442[_0xe36e('0x12e')],'customerIp':_0x35c442[_0xe36e('0x12f')],'customerPort':_0x35c442['customerPort']?_0x35c442['customerPort']:'N.A.'},'messages':_(_0x35c442[_0xe36e('0xf7')])['tail']()[_0xe36e('0x94')]({'secret':![]})['map'](function(_0x59156b){if(_0x59156b[_0xe36e('0xe9')]){var _0x52719b=path[_0xe36e('0xf2')](_0x1cab01,_0x59156b['Attachment'][_0xe36e('0xe5')]);if(fs['existsSync'](_0x52719b)){fs[_0xe36e('0x130')](_0x52719b)[_0xe36e('0x131')](fs[_0xe36e('0x132')](path[_0xe36e('0xf2')](_0x6c8c82,_0x59156b[_0xe36e('0xe9')][_0xe36e('0xe5')])));}}return{'date':moment(_0x59156b[_0xe36e('0x122')])[_0xe36e('0xf8')](_0xe36e('0x12a'))[_0xe36e('0xa8')](),'sender':_0x59156b[_0xe36e('0x123')]===_0xe36e('0x133')?_0x59156b['User']?_0x59156b[_0xe36e('0x85')][_0xe36e('0x43')]:_0xe36e('0xff'):_0x59156b[_0xe36e('0x79')]['firstName']+(_0x59156b[_0xe36e('0x79')][_0xe36e('0x121')]?'\x20'+_0x59156b[_0xe36e('0x79')]['lastName']:''),'body':_0x59156b['Attachment']?_0x59156b[_0xe36e('0xe9')][_0xe36e('0xe5')]:_0x59156b['body'],'direction':_0x59156b[_0xe36e('0x123')]===_0xe36e('0x133')?'A':'C','secret':_0x59156b['secret'],'read':_0x59156b[_0xe36e('0x125')],'attachment':_0x59156b[_0xe36e('0xe9')]};})['value']()};return ejs['renderFile'](path[_0xe36e('0xf2')](config[_0xe36e('0xef')],_0xe36e('0x134'),_0xe36e('0x135'),_0xe36e('0x136')),{'interaction':_0x343ad8})[_0xe36e('0x35')](function(_0x340915){var _0x5370b9=path['join'](_0x6c8c82,'transcript-'+_0x35c442['id']+'-'+_0xa7ef59+'.pdf');var _0x16b769={'path':_0x5370b9,'channel':'Chat','interactionId':_0x35c442['id']};return pdf['createPdfFromHTML'](_0x340915,_0x16b769);})[_0xe36e('0x35')](function(){return new BPromise(function(_0x36706c,_0x5e7f24){zipdir(_0x6c8c82,{'saveTo':_0x29393a},function(_0x5e19e2,_0x2a89b0){if(_0x5e19e2)return _0x5e7f24(_0x5e19e2);return _0x36706c(_0x2a89b0);});})[_0xe36e('0x35')](function(){return new BPromise(function(_0xf70d66,_0x2c0371){rimraf(_0x6c8c82,function(_0x59de53){if(_0x59de53)_0x2c0371(_0x59de53);return _0xf70d66();});});})[_0xe36e('0x35')](function(){return _0x2c1324['download'](_0x29393a,_0x71c885,function(_0x47e24c){if(_0x47e24c){console[_0xe36e('0x137')](_0xe36e('0x138'),_0x47e24c);}else{fs[_0xe36e('0x139')](_0x29393a);}});});});}else{return _0x2c1324[_0xe36e('0x37')](0xc8);}})[_0xe36e('0x29')](handleError(_0x2c1324,null));}; \ No newline at end of file +var _0x66fa=['error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','contact','agent','interaction','TagIds','Tags','split','forEach','push','map','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','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','start','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.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','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','params','includeAll','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','join_url','out','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','root','offline-chat/','join','basename','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','MailServerOut','Smtp','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ChatMessage','addMessage','omit','ids','getMessages','merge','YYYY-MM-DD\x20HH:mm:ss','options','getMyMessages','include','includeAgent','alias','addTags','setTags','findAll','color','emit','chatInteractionTags:save','removeTags','download','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','secret','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54ce75,_0x1c72f7){var _0x516dbd=function(_0x198342){while(--_0x198342){_0x54ce75['push'](_0x54ce75['shift']());}};_0x516dbd(++_0x1c72f7);}(_0x66fa,0x117));var _0xa66f=function(_0x537968,_0x23bd66){_0x537968=_0x537968-0x0;var _0x43749f=_0x66fa[_0x537968];return _0x43749f;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xa66f('0x11'));var hardwareService=require(_0xa66f('0x12'));var logger=require('../../config/logger')(_0xa66f('0x13'));var utils=require('../../config/utils');var config=require(_0xa66f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66f('0x15'))['db'];config[_0xa66f('0x16')]=_[_0xa66f('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0x18'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xa66f('0x19'));var client=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232b});var client9004=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x567d4f,_0x5510dc,_0x19b5ac,_0x32d338){return new BPromise(function(_0x295acf,_0x403f4d){var _0x5c67f5=_0x32d338||client;return _0x5c67f5[_0xa66f('0x1c')](_0x567d4f,_0x19b5ac)['then'](function(_0x4a28d4){logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));logger[_0xa66f('0x20')](_0xa66f('0x21'),_0x5510dc,_0xa66f('0x1f'),JSON[_0xa66f('0x22')](_0x4a28d4));if(_0x4a28d4[_0xa66f('0x23')]){if(_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x24')]===0x1f4){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x403f4d(_0x4a28d4[_0xa66f('0x23')]['message']);}logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x295acf(_0x4a28d4['error'][_0xa66f('0x25')]);}else{logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));_0x295acf(_0x4a28d4['result']['message']);}})[_0xa66f('0x26')](function(_0x598942){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x598942);_0x403f4d(_0x598942);});});}function respondWithStatusCode(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0xcc;return function(_0x4683c7){if(_0x4683c7){return _0x384164[_0xa66f('0x27')](_0x57da7f);}return _0x384164[_0xa66f('0x28')](_0x57da7f)[_0xa66f('0x29')]();};}function respondWithResult(_0x17c103,_0x236046){_0x236046=_0x236046||0xc8;return function(_0x1eb86a){if(_0x1eb86a){return _0x17c103[_0xa66f('0x28')](_0x236046)[_0xa66f('0x2a')](_0x1eb86a);}};}function respondWithFilteredResult(_0x117d03,_0x45f71c){return function(_0x63650b){if(_0x63650b){var _0x42b966=typeof _0x45f71c[_0xa66f('0x2b')]==='undefined'&&typeof _0x45f71c['limit']===_0xa66f('0x2c');var _0x27ceae=_0x63650b['count'];var _0x44c79a=_0x42b966?0x0:_0x45f71c[_0xa66f('0x2b')];var _0x4cd7f2=_0x42b966?_0x63650b[_0xa66f('0x2d')]:_0x45f71c[_0xa66f('0x2b')]+_0x45f71c[_0xa66f('0x2e')];var _0x2c2ace;if(_0x4cd7f2>=_0x27ceae){_0x4cd7f2=_0x27ceae;_0x2c2ace=0xc8;}else{_0x2c2ace=0xce;}_0x117d03[_0xa66f('0x28')](_0x2c2ace);return _0x117d03['set'](_0xa66f('0x2f'),_0x44c79a+'-'+_0x4cd7f2+'/'+_0x27ceae)['json'](_0x63650b);}return null;};}function patchUpdates(_0x306b35){return function(_0x35a0a7){try{jsonpatch[_0xa66f('0x30')](_0x35a0a7,_0x306b35,!![]);}catch(_0x486e4e){return BPromise[_0xa66f('0x31')](_0x486e4e);}return _0x35a0a7[_0xa66f('0x32')]();};}function saveUpdates(_0x4f1668,_0x1a5d4a){return function(_0x35a847){if(_0x35a847){return _0x35a847[_0xa66f('0x33')](_0x4f1668)[_0xa66f('0x34')](function(_0x10a782){return _0x10a782;});}return null;};}function removeEntity(_0x2452d2,_0x25c74c){return function(_0x41303c){if(_0x41303c){return _0x41303c[_0xa66f('0x35')]()[_0xa66f('0x34')](function(){_0x2452d2['status'](0xcc)[_0xa66f('0x29')]();});}};}function handleEntityNotFound(_0x5bf736,_0x1c7eda){return function(_0x46f6cc){if(!_0x46f6cc){_0x5bf736[_0xa66f('0x27')](0x194);}return _0x46f6cc;};}function handleError(_0x3b9261,_0x3722d3){_0x3722d3=_0x3722d3||0x1f4;return function(_0x201432){logger[_0xa66f('0x23')](_0x201432[_0xa66f('0x36')]);if(_0x201432['name']){delete _0x201432[_0xa66f('0x37')];}_0x3b9261['status'](_0x3722d3)[_0xa66f('0x38')](_0x201432);};}function getMustacheRender(_0x45eeb8,_0x2ed1fb){return Mustache['render'](_0x45eeb8,_['merge'](_0x2ed1fb[_0xa66f('0x39')],{'contact':_0x2ed1fb[_0xa66f('0x3a')],'message':_0x2ed1fb[_0xa66f('0x25')],'agent':_0x2ed1fb[_0xa66f('0x3b')],'interaction':_0x2ed1fb[_0xa66f('0x3c')],'account':_0x2ed1fb['account']}))||'';}function getInteractionUsers(_0x5cb0a9,_0x49b869){return new BPromise(function(_0x30f7de,_0x4aeeb4){try{if(_0x49b869[_0x5cb0a9['id']]){_0x5cb0a9['Users']=_['map'](_0x49b869[_0x5cb0a9['id']],function(_0x5fdc3e){return{'id':_0x5fdc3e['id'],'fullname':_0x5fdc3e['fullname']};});}}catch(_0x8965d3){_0x4aeeb4(_0x8965d3);}_0x30f7de(_0x5cb0a9);});}function getInteractionTags(_0x17d942,_0x23a546){return new BPromise(function(_0x1647a0,_0xd65c5d){try{if(_0x17d942[_0xa66f('0x3d')]){_0x17d942[_0xa66f('0x3e')]=[];_0x17d942[_0xa66f('0x3d')][_0xa66f('0x3f')](',')[_0xa66f('0x40')](function(_0x3a7929){_0x17d942[_0xa66f('0x3e')][_0xa66f('0x41')](_0x23a546[_0x3a7929]);});}delete _0x17d942[_0xa66f('0x3d')];}catch(_0x4f01b9){_0xd65c5d(_0x4f01b9);}_0x1647a0(_0x17d942);});}function updateChatInteraction(_0x36037c,_0x25c2cb,_0x58c1f2){return new BPromise(function(_0x248587,_0x4b6e6b){return getInteractionUsers(_0x36037c,_0x58c1f2)[_0xa66f('0x34')](function(_0x27adf4){return getInteractionTags(_0x27adf4,_0x25c2cb);})['then'](function(_0x1ddd2f){_0x248587(_0x1ddd2f);})[_0xa66f('0x26')](function(_0x2126e8){_0x4b6e6b(_0x2126e8);});});}exports['index']=function(_0x394b1e,_0x5cdfe2){var _0x276cd5={},_0x33ed23={},_0xb52cc6={'count':0x0,'rows':[]};var _0x3a499e=_[_0xa66f('0x42')](db[_0xa66f('0x43')][_0xa66f('0x44')],function(_0x50cc47){return{'name':_0x50cc47[_0xa66f('0x45')],'type':_0x50cc47[_0xa66f('0x46')][_0xa66f('0x47')]};});_0x33ed23[_0xa66f('0x48')]=_[_0xa66f('0x42')](_0x3a499e,'name');_0x33ed23['query']=_[_0xa66f('0x49')](_0x394b1e[_0xa66f('0x4a')]);_0x33ed23[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],_0x33ed23[_0xa66f('0x4a')]);_0x276cd5['attributes']=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x394b1e['query']['fields']));_0x276cd5[_0xa66f('0x4e')]=_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x276cd5['attributes']:_0x33ed23['model'];if(!_0x394b1e['query'][_0xa66f('0x50')](_0xa66f('0x51'))){_0x276cd5[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x2e')]);_0x276cd5[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x394b1e['query'][_0xa66f('0x2b')]);}_0x276cd5[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x276cd5[_0xa66f('0x54')]=qs['filters'](_[_0xa66f('0x55')](_0x394b1e[_0xa66f('0x4a')],_0x33ed23[_0xa66f('0x4b')]),_0x3a499e);var _0x13848d=[];var _0x20d6be=squel['select']()[_0xa66f('0x56')]('id')['field'](_0xa66f('0x37'))['field']('color')[_0xa66f('0x57')](_0xa66f('0x58'));var _0x12271d=squel[_0xa66f('0x59')]()[_0xa66f('0x56')](_0xa66f('0x5a'))['field'](_0xa66f('0x5b'))[_0xa66f('0x56')](_0xa66f('0x5c'))[_0xa66f('0x57')]('user_has_chat_interactions','ui')[_0xa66f('0x5d')]('users','u',_0xa66f('0x5e'));var _0x10fc75=squel[_0xa66f('0x59')]()[_0xa66f('0x57')](_0xa66f('0x5f'),'i')[_0xa66f('0x5d')](_0xa66f('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa66f('0x5d')](_0xa66f('0x61'),'o',_0xa66f('0x62'))[_0xa66f('0x5d')](_0xa66f('0x63'),'a',_0xa66f('0x64'))[_0xa66f('0x5d')](_0xa66f('0x65'),'me',_0xa66f('0x66'))['left_join']('chat_interaction_has_tags','it',_0xa66f('0x67'))[_0xa66f('0x5d')](_0xa66f('0x58'),'t',_0xa66f('0x68'));var _0x2f1f1e=squel[_0xa66f('0x69')]();var _0x8bea2b=[];var _0x4b10cf=squel[_0xa66f('0x69')]();var _0x11c89e;if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]){_0x11c89e=as['parseSearch'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]);var _0x19ff30=_0x11c89e[_0xa66f('0x6b')];for(var _0x19f4b5=0x0;_0x19f4b5<_0x11c89e[_0xa66f('0x6c')]['length'];_0x19f4b5++){var _0x4b31f7=_0x11c89e[_0xa66f('0x6c')][_0x19f4b5];var _0x31b81b='i';var _0x174aad=_['find'](_0x3a499e,[_0xa66f('0x37'),_0x4b31f7[_0xa66f('0x56')]]);if(!_0x174aad){switch(_0x4b31f7[_0xa66f('0x56')]){case _0xa66f('0x6d'):if(_0x4b31f7[_0xa66f('0x6e')]==0x1){_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7[_0xa66f('0x56')]+_0xa66f('0x70'));}else{_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7['field']+_0xa66f('0x71'));}break;case _0xa66f('0x72'):if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){if(_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')]('\x20')[_0xa66f('0x4f')]>0x1){_0x2f1f1e[_0x19ff30](_0xa66f('0x75'),qs['getFullTextValue'](_0x4b31f7['value']),null);}else{var _0x46327d='%'+_0x4b31f7[_0xa66f('0x6e')]+'%';_0x2f1f1e[_0x19ff30](_0xa66f('0x76'),_0x46327d,_0x46327d,_0x46327d);}}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),'ContactId']);_0x4b31f7[_0xa66f('0x56')]='ContactId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x7a'):var _0x46ea11=_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')](',')[_0xa66f('0x42')](function(_0x2bdb18){return Number(_0x2bdb18);});_0x46ea11[_0xa66f('0x40')](function(_0x36b92f){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x36b92f+',%');});_0x8bea2b=_[_0xa66f('0x7c')](_0x8bea2b,_0x46ea11);break;case'User':if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){_0x2f1f1e[_0x19ff30](_0xa66f('0x7d'),'%'+_0x4b31f7[_0xa66f('0x6e')]+'%',null);}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),_0xa66f('0x7e')]);_0x4b31f7[_0xa66f('0x56')]='UserId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x39'):_0x53b01b=as['buildExpression']('me',null,_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b['text'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')]['end']);break;}}else{var _0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}}}else{var _0x1d4642=_(_0x394b1e[_0xa66f('0x4a')])[_0xa66f('0x49')]()[_0xa66f('0x42')](function(_0x218128){return _[_0xa66f('0x80')](_0x3a499e,['name',_0x218128])?_0x218128:undefined;})[_0xa66f('0x81')]()[_0xa66f('0x6e')]();if(!_['isEmpty'](_0x1d4642)){_0x1d4642['forEach'](function(_0x183155){if(_0x183155===_0xa66f('0x82')){_0x10fc75['where'](_0xa66f('0x83'),[]['concat'](_0x394b1e[_0xa66f('0x4a')][_0x183155]));}else if(_0x183155==='createdAt'){var _0x4feda0=JSON['parse'](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x84')];var _0x1f05bb=JSON[_0xa66f('0x85')](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x86')];_0x10fc75[_0xa66f('0x54')](_0xa66f('0x87'),_0x4feda0,_0x1f05bb);}else{if(_0x394b1e[_0xa66f('0x4a')][_0x183155]===_0xa66f('0x88')){_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x89'));}else{_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x8a'),_0x394b1e[_0xa66f('0x4a')][_0x183155]);}}});}if(_0x394b1e[_0xa66f('0x4a')]['read']){if(_0x394b1e[_0xa66f('0x4a')]['read']==0x1){_0x10fc75[_0xa66f('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x10fc75[_0xa66f('0x6f')](_0xa66f('0x8b'));}}if(_0x394b1e[_0xa66f('0x4a')]['tag']){_0x8bea2b=_['isArray'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')])?_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]:new Array(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]);_0x8bea2b[_0xa66f('0x40')](function(_0x578bff){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x578bff+',%');});}if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')]){var _0x4426d2=_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')][_0xa66f('0x8e')]('\x5c','\x5c\x5c')[_0xa66f('0x8e')](/'/g,'\x27\x27');if(qs[_0xa66f('0x8f')](_0x4426d2)){_0x2f1f1e['or'](_0xa66f('0x90'),_0x4426d2+'%');}else{_0x2f1f1e['or'](_0xa66f('0x91'),qs[_0xa66f('0x92')](_0x4426d2))['or'](_0xa66f('0x93'),_0x4426d2+'%');}}}_0x10fc75['where'](_0x2f1f1e);_0x10fc75[_0xa66f('0x94')](_0xa66f('0x95'));var _0x34ebfd={'type':db[_0xa66f('0x96')][_0xa66f('0x97')][_0xa66f('0x98')],'raw':!![]};var _0x3058aa=_0x10fc75[_0xa66f('0x99')]();_0x3058aa[_0xa66f('0x56')]('i.id');_0x3058aa[_0xa66f('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa66f('0x6d'));if(_0x276cd5['order']){_0x276cd5[_0xa66f('0x52')]['forEach'](function(_0x298bd8){var _0x5a1750=_0x298bd8[0x0]===_0xa66f('0x9a')?_0x298bd8[0x0]:'i.'+_0x298bd8[0x0];_0x10fc75[_0xa66f('0x52')](_0x5a1750,_0x298bd8[0x1]===_0xa66f('0x9b')?![]:!![]);});}if(!_[_0xa66f('0x9c')](_0x8bea2b)){_0x10fc75[_0xa66f('0x6f')](_0x4b10cf);_0x3058aa[_0xa66f('0x54')]('t.id\x20IN\x20?',_0x8bea2b);}BPromise[_0xa66f('0x9d')]()[_0xa66f('0x34')](function(){if(!_0x11c89e){if(_0x394b1e[_0xa66f('0x4a')]['ChatWebsiteId'])return;_0x3058aa[_0xa66f('0x54')](_0xa66f('0x9e'));_0x10fc75['where'](_0xa66f('0x9e'));return;}if(_0x394b1e[_0xa66f('0x9f')]['role']!=='agent')return;return _0x394b1e[_0xa66f('0x9f')][_0xa66f('0xa0')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x34')](function(_0x2929fe){if(_[_0xa66f('0x9c')](_0x2929fe)){_0x3058aa['where'](_0xa66f('0xa1'));_0x10fc75[_0xa66f('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x3058aa[_0xa66f('0x54')](_0xa66f('0x83'),_['map'](_0x2929fe,'id'));_0x10fc75[_0xa66f('0x54')](_0xa66f('0x83'),_[_0xa66f('0x42')](_0x2929fe,'id'));}});})[_0xa66f('0x34')](function(){if(_0x394b1e[_0xa66f('0x9f')]['role']===_0xa66f('0x3b')&&!_0x11c89e&&!_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x82')])return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x3058aa[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x2b2c54){_0xb52cc6[_0xa66f('0x2d')]=_0x2b2c54[_0xa66f('0x4f')];if(_0xb52cc6[_0xa66f('0x2d')]===0x0)return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x20d6be[_0xa66f('0xa3')](),_0x34ebfd)['then'](function(_0x5ec355){_0x13848d=_[_0xa66f('0xa4')](_0x5ec355,'id');_0x34ebfd=_['merge'](_0x34ebfd,{'model':db[_0xa66f('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x394b1e[_0xa66f('0x4a')]['fields']){_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x40')](function(_0x3f84f9){_0x10fc75['field']('i.'+_0x3f84f9);});}else{_0x10fc75['field'](_0xa66f('0xa5'),'unreadMessages');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa6'),_0xa66f('0xa7'));_0x10fc75['field'](_0xa66f('0xa8'),'Account.mandatoryDisposition');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa9'),_0xa66f('0x9a'));_0x10fc75[_0xa66f('0x56')]('i.*');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xaa'),_0xa66f('0xab'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xac'),_0xa66f('0xad'));_0x10fc75['field'](_0xa66f('0xae'),_0xa66f('0xaf'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb0'),_0xa66f('0xb1'));_0x10fc75['field']('c.mobile',_0xa66f('0xb2'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb3'),_0xa66f('0xb4'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb5'),_0xa66f('0xb6'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb7'),_0xa66f('0xb8'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb9'),'TagIds');}if(_0x276cd5[_0xa66f('0x2e')])_0x10fc75[_0xa66f('0x2e')](_0x276cd5['limit']);if(_0x276cd5[_0xa66f('0x2b')])_0x10fc75[_0xa66f('0x2b')](_0x276cd5[_0xa66f('0x2b')]);return db['sequelize']['query'](_0x10fc75[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x3520e1){if(_0x3520e1[_0xa66f('0x4f')]>0x0)_0x12271d['where'](_0xa66f('0xba'),_[_0xa66f('0x42')](_0x3520e1,'id'));return db['sequelize'][_0xa66f('0x4a')](_0x12271d[_0xa66f('0xa3')](),_0x34ebfd)[_0xa66f('0x34')](function(_0x176b30){var _0x4bc36d=_['groupBy'](_0x176b30,_0xa66f('0xbb'));var _0xdd2d09=[];_0x3520e1[_0xa66f('0x40')](function(_0x1bab2b){_0xdd2d09[_0xa66f('0x41')](updateChatInteraction(_0x1bab2b,_0x13848d,_0x4bc36d));});return BPromise[_0xa66f('0xbc')](_0xdd2d09);});});})[_0xa66f('0x34')](function(_0xac0e98){_0xb52cc6[_0xa66f('0xbd')]=_0xac0e98;return _0xb52cc6;})[_0xa66f('0x34')](respondWithFilteredResult(_0x5cdfe2,_0x276cd5))['catch'](handleError(_0x5cdfe2,null));};exports['show']=function(_0x1d472d,_0x3cbbb6){var _0x3cf40f={'raw':![],'where':{'id':_0x1d472d[_0xa66f('0xbe')]['id']}},_0x4298ca={};_0x4298ca['model']=_[_0xa66f('0x49')](db[_0xa66f('0x43')][_0xa66f('0x44')]);_0x4298ca['query']=_['keys'](_0x1d472d['query']);_0x4298ca[_0xa66f('0x4b')]=_['intersection'](_0x4298ca[_0xa66f('0x48')],_0x4298ca[_0xa66f('0x4a')]);_0x3cf40f[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x4298ca['model'],qs[_0xa66f('0x4d')](_0x1d472d[_0xa66f('0x4a')]['fields']));_0x3cf40f[_0xa66f('0x4e')]=_0x3cf40f[_0xa66f('0x4e')]['length']?_0x3cf40f['attributes']:_0x4298ca[_0xa66f('0x48')];if(_0x1d472d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3cf40f['include']=[{'all':!![]}];}_0x3cf40f=_['merge']({},_0x3cf40f,_0x1d472d['options']);return db['ChatInteraction'][_0xa66f('0x77')](_0x3cf40f)[_0xa66f('0x34')](handleEntityNotFound(_0x3cbbb6,null))[_0xa66f('0x34')](respondWithResult(_0x3cbbb6,null))[_0xa66f('0x26')](handleError(_0x3cbbb6,null));};exports[_0xa66f('0xc0')]=function(_0x46c9b2,_0x580eb7){return db[_0xa66f('0x43')][_0xa66f('0xc0')](_0x46c9b2[_0xa66f('0x39')],{})[_0xa66f('0x34')](respondWithResult(_0x580eb7,0xc9))['catch'](handleError(_0x580eb7,null));};exports['update']=function(_0xd78ede,_0xe11c2d){if(_0xd78ede[_0xa66f('0x39')]['id']){delete _0xd78ede[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd78ede[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0xe11c2d,null))[_0xa66f('0x34')](saveUpdates(_0xd78ede[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0xe11c2d,null))['catch'](handleError(_0xe11c2d,null));};exports[_0xa66f('0x35')]=function(_0x597ae3,_0x1b93e0){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x597ae3[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x1b93e0,null))['then'](removeEntity(_0x1b93e0,null))['catch'](handleError(_0x1b93e0,null));};exports['describe']=function(_0x484c8e,_0x728faa){return db[_0xa66f('0x43')][_0xa66f('0xc1')]()[_0xa66f('0x34')](respondWithResult(_0x728faa,null))['catch'](handleError(_0x728faa,null));};exports[_0xa66f('0xc2')]=function(_0x174510,_0x4f3985){var _0x348e6b=_0x174510[_0xa66f('0xbe')]['id'];var _0x4ed950;var _0xe43d63;var _0x3c2367;return db['ChatInteraction'][_0xa66f('0xc3')]({'where':{'id':_0x348e6b}})[_0xa66f('0x34')](function(_0x32bea5){_0x4ed950=_0x32bea5;return db[_0xa66f('0xc4')][_0xa66f('0xc3')]({'where':{'id':_0x32bea5[_0xa66f('0x82')]},'attributes':['id',_0xa66f('0xc5'),_0xa66f('0xc6'),_0xa66f('0xc7'),_0xa66f('0xc8'),_0xa66f('0xc9')],'raw':!![]});})['then'](function(_0x4c8386){if(_0x4c8386&&_0x4c8386[_0xa66f('0xc5')]&&_0x4c8386[_0xa66f('0xc6')]){_0xe43d63=_0x4c8386;var _0x12278e={'interaction':{'id':_0x348e6b},'agent':{'id':_0x174510['user']['id'],'name':_0x174510['user'][_0xa66f('0x37')],'fullname':_0x174510[_0xa66f('0x9f')][_0xa66f('0xca')],'email':_0x174510[_0xa66f('0x9f')][_0xa66f('0xcb')]},'contact':_0x174510['body'][_0xa66f('0x3a')],'account':_0x174510[_0xa66f('0x39')][_0xa66f('0xcc')]};var _0xfc01d7={'rejectUnauthorized':![],'method':'POST','url':_0xa66f('0xcd'),'headers':{'X-APIKEY':_0x4c8386[_0xa66f('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x174510['user'][_0xa66f('0xcb')]],'buttons':null,'topic':_0xe43d63[_0xa66f('0xc7')],'note':_['isNull'](_0xe43d63[_0xa66f('0xc8')])?null:getMustacheRender(_0xe43d63[_0xa66f('0xc8')],_0x12278e),'metadata':null},'redirect':_0xa66f('0xce'),'json':!![]};try{if(!_[_0xa66f('0xcf')](_0xe43d63[_0xa66f('0xc9')])){var _0x3c73cc=getMustacheRender(_0xe43d63[_0xa66f('0xc9')],_0x12278e);var _0x4885bb=JSON['parse'](_0x3c73cc);_0xfc01d7[_0xa66f('0x39')][_0xa66f('0xd0')]=_0x4885bb;}}catch(_0x2e7c26){throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xfc01d7);}else{throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa66f('0x34')](function(_0x56198a){_0x3c2367=_0x56198a;if(_0x3c2367['id']){var _0x41ef9a={'body':_0x3c2367[_0xa66f('0xd2')],'ChatWebsiteId':_0xe43d63['id'],'ChatInteractionId':_0x4ed950['id'],'direction':_0xa66f('0xd3'),'UserId':_0x174510[_0xa66f('0x9f')]['id']};return db['ChatMessage']['create'](_0x41ef9a,{});}else{throw new db['Sequelize'][(_0xa66f('0xd1'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa66f('0x34')](function(){return _0x4ed950['updateAttributes']({'vidaooSessionId':_0x3c2367['id']});})[_0xa66f('0x34')](respondWithResult(_0x4f3985,null))[_0xa66f('0x26')](handleError(_0x4f3985,null));};exports['customUpdate']=function(_0x35a2ce,_0x2d3bca){if(_0x35a2ce[_0xa66f('0x39')]['id']){delete _0x35a2ce[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x35a2ce[_0xa66f('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xa66f('0x72')}]})[_0xa66f('0x34')](handleEntityNotFound(_0x2d3bca,null))[_0xa66f('0x34')](saveUpdates(_0x35a2ce[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0x2d3bca,null))[_0xa66f('0x26')](handleError(_0x2d3bca,null));};exports[_0xa66f('0xd4')]=function(_0x3a2c2c,_0x179953,_0x5dcf9d){if(_0x3a2c2c[_0xa66f('0x39')]['id']){delete _0x3a2c2c['body']['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x3a2c2c[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](function(_0x1f4bc4){if(!_0x1f4bc4){logger['error'](_0xa66f('0xd5'),_0xa66f('0xd4'),0x194,_0xa66f('0xd6'));_0x179953[_0xa66f('0x27')](0x194);}else{if(_0x1f4bc4['UserId']){throw new db['Sequelize']['ValidationError'](_0xa66f('0xd7'));}}return _0x1f4bc4;})[_0xa66f('0x34')](function(_0x4be9ae){if(_0x4be9ae){return _0x4be9ae['update']({'closed':_0x3a2c2c[_0xa66f('0x39')][_0xa66f('0xd8')],'disposition':_0x3a2c2c['body'][_0xa66f('0xd9')]})[_0xa66f('0x34')](function(_0x17dc7d){return _0x17dc7d;});}})[_0xa66f('0x34')](function(_0x551c09){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3a2c2c[_0xa66f('0x39')],client9004);})[_0xa66f('0x34')](respondWithResult(_0x179953,null))[_0xa66f('0x26')](handleError(_0x179953,null));};exports[_0xa66f('0xda')]=function(_0x377764,_0x434764,_0x315b27){_0x377764[_0xa66f('0x39')]['name']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdc')];_0x377764[_0xa66f('0x39')]['basename']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdd')];_0x377764[_0xa66f('0x39')]['type']=_0x377764['file'][_0xa66f('0xde')];return db[_0xa66f('0xdf')][_0xa66f('0xc0')](_0x377764[_0xa66f('0x39')])[_0xa66f('0x34')](respondWithResult(_0x434764,0xc9))[_0xa66f('0x26')](handleError(_0x434764,null));};exports[_0xa66f('0xe0')]=function(_0x5c5550,_0x383ce6,_0x4b2702){return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550[_0xa66f('0xbe')]['id']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null))[_0xa66f('0x34')](function(_0x32f7ab){if(_0x32f7ab){if(_0x32f7ab[_0xa66f('0xd8')]){return _0x383ce6[_0xa66f('0x28')](0x193)[_0xa66f('0x2a')]({'status':0x193,'message':_0xa66f('0xe1')});}return db[_0xa66f('0xdf')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550['query']['attachId']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null));}})[_0xa66f('0x34')](function(_0x29ce7f){if(_0x29ce7f){var _0x1248c9=_0x29ce7f[_0xa66f('0xe2')]!==null;var _0x13948a=path['join'](config[_0xa66f('0xe3')],'server/files/attachments/');if(_0x1248c9){_0x13948a=path['join'](_0x13948a,_0xa66f('0xe4'));}var _0x1ce936=path[_0xa66f('0xe5')](_0x13948a,_0x29ce7f[_0xa66f('0xe6')]);return _0x383ce6['download'](_0x1ce936);}})[_0xa66f('0x26')](handleError(_0x383ce6,null));};exports[_0xa66f('0xe7')]=function(_0x1686df,_0x1889f4){var _0x2a03c8=null;var _0x48b16d=null;var _0x5a05e4=null;var _0x1b78fa=null;if(_0x1686df[_0xa66f('0x39')]['id']){delete _0x1686df[_0xa66f('0x39')]['id'];}if(_0x1686df[_0xa66f('0x39')]['mailTranscript']){_0x1b78fa=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0xe8'),util[_0xa66f('0xe9')](_0xa66f('0xea'),Date[_0xa66f('0xeb')]()));_0x1686df[_0xa66f('0x39')][_0xa66f('0xec')]=_0x1b78fa;}return db['ChatInteraction'][_0xa66f('0x77')]({'where':{'id':_0x1686df[_0xa66f('0xbe')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xa66f('0xed'),'include':[{'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee')}]}]})[_0xa66f('0x34')](handleEntityNotFound(_0x1889f4,null))[_0xa66f('0x34')](saveUpdates(_0x1686df['body'],null))[_0xa66f('0x34')](function(_0x4153a0){if(_0x4153a0){_0x2a03c8=_0x4153a0;return db[_0xa66f('0xc4')][_0xa66f('0x77')]({'where':{'id':_0x2a03c8[_0xa66f('0x82')]}});}})['then'](function(_0x820ac1){if(_0x820ac1){_0x5a05e4=_0x820ac1;return db[_0xa66f('0xef')]['find']({'where':{'id':_0x2a03c8[_0xa66f('0xf0')]}});}})[_0xa66f('0x34')](function(_0x22d154){if(_0x22d154){_0x48b16d=_0x22d154;if(_0x1b78fa){var _0x31959f=null;for(var _0x2d3123=0x1;_0x2d3123<_0x2a03c8['Messages'][_0xa66f('0x4f')];++_0x2d3123){_0x31959f=_0x2a03c8[_0xa66f('0xed')][_0x2d3123];var _0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f['UserId']):_0xa66f('0xf3');var _0x19fabd=_0x1686df[_0xa66f('0x39')][_0xa66f('0xf4')]||util['format'](_0xa66f('0xf1'),_0xa66f('0xf5'),_0x31959f['ContactId']);switch(_0x5a05e4[_0xa66f('0xf6')]){case _0xa66f('0xf7'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f[_0xa66f('0x7e')]):'System';break;case _0xa66f('0xf8'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f['User']['alias']||_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:'System';break;case _0xa66f('0xf9'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3');break;default:_0x207ea2=_0x31959f['UserId']?util[_0xa66f('0xe9')](_0xa66f('0xf1'),_0x5a05e4['agentAlias'],_0x31959f[_0xa66f('0x7e')]):'System';}var _0x506797=util[_0xa66f('0xe9')](_0xa66f('0xfa'),moment(_0x31959f['createdAt'])[_0xa66f('0xe9')]('MM/DD/YYYY\x20HH:mm:ss'),_0x31959f[_0xa66f('0xfb')]==='in'?_0x19fabd:_0x207ea2,_0x31959f[_0xa66f('0x39')]);if(!_0x31959f['secret']){fs['appendFileSync'](_0x1b78fa,_0x506797);}}return db['MailAccount'][_0xa66f('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0xa66f('0xfc')],'as':_0xa66f('0xfd'),'raw':!![]}]});}}})[_0xa66f('0x34')](function(_0x168d31){if(_0x168d31&&_0x168d31[_0xa66f('0xfd')]&&_0x1686df[_0xa66f('0x39')]){var _0x5a762d={'tls':{'rejectUnauthorized':![]}};if(_0x168d31['Smtp'][_0xa66f('0xfe')]){_0x5a762d[_0xa66f('0xfe')]=_0x168d31[_0xa66f('0xfd')][_0xa66f('0xfe')];}else{_0x5a762d[_0xa66f('0xff')]=_0x168d31[_0xa66f('0xfd')]['host'];_0x5a762d[_0xa66f('0x100')]=_0x168d31[_0xa66f('0xfd')]['port'];_0x5a762d[_0xa66f('0x101')]=_0x168d31['Smtp'][_0xa66f('0x101')];}if(_0x168d31['Smtp']['authentication']){_0x5a762d[_0xa66f('0x102')]={'user':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x9f')],'pass':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x103')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5a762d,'message':{'from':util[_0xa66f('0xe9')](_0xa66f('0x104'),_0x168d31[_0xa66f('0x37')],_0x168d31['email']||_0x168d31['Smtp']['user']),'to':_0x1686df[_0xa66f('0x39')][_0xa66f('0x105')],'subject':_0xa66f('0x106'),'text':util[_0xa66f('0xe9')](_0xa66f('0x107'),_0x1686df[_0xa66f('0x39')]['mailTranscript']),'attachments':[{'path':_0x1b78fa}]}})[_0xa66f('0x34')](function(){return _0x2a03c8;})[_0xa66f('0x26')](function(_0x3215af){console['error'](_0x3215af);});}else{return _0x2a03c8;}})[_0xa66f('0x34')](respondWithStatusCode(_0x1889f4,0xc8))[_0xa66f('0x26')](handleError(_0x1889f4,null));};exports['addMessage']=function(_0x4e4b66,_0x2aaaab,_0x75d882){return db[_0xa66f('0x108')][_0xa66f('0x77')]({'where':{'id':_0x4e4b66['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x2aaaab,null))[_0xa66f('0x34')](function(_0x21e1d1){if(_0x21e1d1){return _0x21e1d1[_0xa66f('0x109')](_0x4e4b66[_0xa66f('0x39')]['ids'],_[_0xa66f('0x10a')](_0x4e4b66[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{});}})['then'](respondWithResult(_0x2aaaab,null))[_0xa66f('0x26')](handleError(_0x2aaaab,null));};exports[_0xa66f('0x10c')]=function(_0x53170d,_0x5d1e51,_0x3c3aff){var _0x3fb295={'raw':![],'where':{}};var _0x57c403={};var _0x31832f={'count':0x0,'rows':[]};return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x53170d[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x5d1e51,null))[_0xa66f('0x34')](function(_0x43cc99){if(_0x43cc99){_0x57c403['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x57c403['query']=_['keys'](_0x53170d[_0xa66f('0x4a')]);_0x57c403[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],_0x57c403[_0xa66f('0x4a')]);_0x3fb295['attributes']=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],qs['fields'](_0x53170d['query']['fields']));_0x3fb295[_0xa66f('0x4e')]=_0x3fb295[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x3fb295['attributes']:_0x57c403[_0xa66f('0x48')];if(!_0x53170d[_0xa66f('0x4a')][_0xa66f('0x50')]('nolimit')){_0x3fb295[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x53170d[_0xa66f('0x4a')]['limit']);_0x3fb295[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x3fb295[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x3fb295['where']=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x53170d[_0xa66f('0x4a')],_0x57c403[_0xa66f('0x4b')]));_0x3fb295[_0xa66f('0x54')][_0xa66f('0xbb')]=_0x43cc99['id'];if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]){_0x3fb295[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x3fb295[_0xa66f('0x54')],{'$or':_[_0xa66f('0x42')](_0x3fb295[_0xa66f('0x4e')],function(_0x2b9a3c){var _0x1d688a={};_0x1d688a[_0x2b9a3c]={'$like':'%'+_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x1d688a;})});}if(_0x53170d['query'][_0xa66f('0x84')]){var _0x570a01=_0x53170d['query']['$gte'][_0xa66f('0x3f')](',');var _0x35919e={};_0x35919e[_0x570a01[0x0]]={'$gte':moment(_0x570a01[0x1])[_0xa66f('0xe9')](_0xa66f('0x10e'))};_0x3fb295[_0xa66f('0x54')]=_['merge'](_0x3fb295[_0xa66f('0x54')],_0x35919e);}_0x3fb295=_['merge']({},_0x3fb295,_0x53170d[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x3fb295['where']})[_0xa66f('0x34')](function(_0x3517eb){_0x31832f[_0xa66f('0x2d')]=_0x3517eb;if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3fb295['include']=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x3fb295);})[_0xa66f('0x34')](function(_0x24c209){_0x31832f[_0xa66f('0xbd')]=_0x24c209;return _0x31832f;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x5d1e51,_0x3fb295))[_0xa66f('0x26')](handleError(_0x5d1e51,null));};exports[_0xa66f('0x110')]=function(_0x1ef4c2,_0x21ec7f,_0x32b1c1){var _0x4ee9a3={'where':{}},_0x12889f={},_0xc813ad={'count':0x0,'rows':[]};return db[_0xa66f('0x43')]['findOne']({'where':{'id':_0x1ef4c2['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x21ec7f,null))[_0xa66f('0x34')](function(_0x3a1e4a){if(_0x3a1e4a){_0x12889f['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x12889f[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0x1ef4c2[_0xa66f('0x4a')]);_0x12889f[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],_0x12889f[_0xa66f('0x4a')]);_0x4ee9a3[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x1ef4c2[_0xa66f('0x4a')]['fields']));_0x4ee9a3[_0xa66f('0x4e')]=_0x4ee9a3[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x4ee9a3[_0xa66f('0x4e')]:_0x12889f['model'];if(!_0x1ef4c2[_0xa66f('0x4a')]['hasOwnProperty'](_0xa66f('0x51'))){_0x4ee9a3[_0xa66f('0x2e')]=qs['limit'](_0x1ef4c2['query'][_0xa66f('0x2e')]);_0x4ee9a3[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x4ee9a3[_0xa66f('0x52')]=qs['sort'](_0x1ef4c2['query']['sort']);_0x4ee9a3[_0xa66f('0x54')]=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x1ef4c2[_0xa66f('0x4a')],_0x12889f[_0xa66f('0x4b')]));_0x4ee9a3['where'][_0xa66f('0xbb')]=_0x3a1e4a['id'];if(_0x1ef4c2['query'][_0xa66f('0x8d')]){_0x4ee9a3[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x4ee9a3['where'],{'$or':_['map'](_0x4ee9a3[_0xa66f('0x4e')],function(_0x2bf349){var _0x211ac6={};_0x211ac6[_0x2bf349]={'$like':'%'+_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x211ac6;})});}_0x4ee9a3[_0xa66f('0x54')]['secret']=![];if(_0x1ef4c2[_0xa66f('0x4a')]['id']){_0x4ee9a3['where']['id']={'$gt':_0x1ef4c2['query']['id']};}_0x4ee9a3=_[_0xa66f('0x10d')]({},_0x4ee9a3,_0x1ef4c2[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x4ee9a3['where']})['then'](function(_0x533dc1){_0xc813ad[_0xa66f('0x2d')]=_0x533dc1;_0x4ee9a3[_0xa66f('0x111')]=[];if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x112')]){_0x4ee9a3[_0xa66f('0x111')][_0xa66f('0x41')]({'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca'),_0xa66f('0x113')]});}if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x4ee9a3[_0xa66f('0x111')]=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x4ee9a3);})['then'](function(_0x554ba6){_0xc813ad[_0xa66f('0xbd')]=_0x554ba6;return _0xc813ad;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x21ec7f,_0x4ee9a3))[_0xa66f('0x26')](handleError(_0x21ec7f,null));};exports[_0xa66f('0x114')]=function(_0x1a3bac,_0x44649c,_0x5e4fbc){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x1a3bac[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x44649c,null))[_0xa66f('0x34')](function(_0x1d2967){if(_0x1d2967){return _0x1d2967[_0xa66f('0x115')](_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')],_[_0xa66f('0x10a')](_0x1a3bac[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{})['spread'](function(){return db[_0xa66f('0x7a')][_0xa66f('0x116')]({'attributes':['id','name',_0xa66f('0x117')],'where':{'id':_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')]}});})['then'](function(_0x367549){socket[_0xa66f('0x118')](_0xa66f('0x119'),{'id':Number(_0x1a3bac['params']['id']),'tags':_0x367549||[]});return{'id':Number(_0x1a3bac[_0xa66f('0xbe')]['id']),'tags':_0x367549||[]};});}})[_0xa66f('0x34')](respondWithResult(_0x44649c,null))[_0xa66f('0x26')](handleError(_0x44649c,null));};exports[_0xa66f('0x11a')]=function(_0x4a1613,_0x324b7e,_0x1d3395){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x4a1613[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x324b7e,null))[_0xa66f('0x34')](function(_0x33f1ea){if(_0x33f1ea){return _0x33f1ea[_0xa66f('0x11a')](_0x4a1613[_0xa66f('0x4a')]['ids']);}})[_0xa66f('0x34')](respondWithStatusCode(_0x324b7e,null))['catch'](handleError(_0x324b7e,null));};exports[_0xa66f('0x11b')]=function(_0xd7dccf,_0x2b4238){var _0x321fa1=moment()['unix']()['toString']();var _0x254599=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),_0xa66f('0x11d'),_0xa66f('0x11e'));var _0x3b9ff3=path['join'](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'files',_0xa66f('0x11f'));var _0x5206a5=path['join'](_0x254599,_0x321fa1);var _0x6b60bd=util[_0xa66f('0xe9')](_0xa66f('0x120'),_0xd7dccf['params']['id'],_0x321fa1);var _0x3709b6=path['join'](_0x254599,_0x6b60bd);var _0x21bda3=[];_0x21bda3[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca')],'raw':!![]});_0x21bda3[_0xa66f('0x41')]({'model':db[_0xa66f('0xef')],'as':_0xa66f('0x72'),'attributes':['id',_0xa66f('0x121'),_0xa66f('0x122')],'raw':!![]});if(_0xd7dccf['query'][_0xa66f('0x11f')]){_0x21bda3[_0xa66f('0x41')]({'model':db['Attachment'],'as':_0xa66f('0xdf'),'raw':!![]});}var _0x22e7a6=[{'model':db[_0xa66f('0x108')],'as':_0xa66f('0xed'),'attributes':['id',_0xa66f('0x39'),_0xa66f('0x123'),_0xa66f('0xfb'),_0xa66f('0x124'),_0xa66f('0x125')],'include':_0x21bda3}];_0x22e7a6[_0xa66f('0x41')]({'model':db[_0xa66f('0xc4')],'as':_0xa66f('0x126'),'attributes':['id','name']});_0x22e7a6[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0x127'),'attributes':['id',_0xa66f('0xca')]});return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd7dccf[_0xa66f('0xbe')]['id']},'include':_0x22e7a6})[_0xa66f('0x34')](handleEntityNotFound(_0x2b4238,null))[_0xa66f('0x34')](function(_0x5efd6c){if(_0x5efd6c){var _0x24ee72=_0x5efd6c['get']({'plain':!![]});fs[_0xa66f('0x128')](_0x5206a5);var _0xdbb792={'channel':_0xa66f('0x129'),'account':_0x24ee72['Account'][_0xa66f('0x37')],'agent':_0x24ee72[_0xa66f('0x127')]?_0x24ee72['Owner']['fullname']:_0xa66f('0x12a'),'createdAt':moment(_0x24ee72[_0xa66f('0x123')])[_0xa66f('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa66f('0xa3')](),'closedAt':_0x24ee72[_0xa66f('0xd8')]?moment(_0x24ee72[_0xa66f('0x12b')])['format'](_0xa66f('0x10e'))[_0xa66f('0xa3')]():'','disposition':_0x24ee72[_0xa66f('0xd9')],'chatInfo':{'browser':_0x24ee72[_0xa66f('0x12c')],'os':_0x24ee72[_0xa66f('0x12d')],'referer':_0x24ee72['referer'],'customerIp':_0x24ee72[_0xa66f('0x12e')],'customerPort':_0x24ee72[_0xa66f('0x12f')]?_0x24ee72[_0xa66f('0x12f')]:_0xa66f('0x12a')},'messages':_(_0x24ee72[_0xa66f('0xed')])[_0xa66f('0x130')]()['filter']({'secret':![]})[_0xa66f('0x42')](function(_0x31cc20){if(_0x31cc20['Attachment']){var _0x10a611=path[_0xa66f('0xe5')](_0x3b9ff3,_0x31cc20['Attachment'][_0xa66f('0xe6')]);if(fs[_0xa66f('0x131')](_0x10a611)){fs[_0xa66f('0x132')](_0x10a611)['pipe'](fs[_0xa66f('0x133')](path['join'](_0x5206a5,_0x31cc20['Attachment']['basename'])));}}return{'date':moment(_0x31cc20['createdAt'])['format'](_0xa66f('0x10e'))['toString'](),'sender':_0x31cc20[_0xa66f('0xfb')]===_0xa66f('0xd3')?_0x31cc20[_0xa66f('0xee')]?_0x31cc20[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3'):_0x31cc20[_0xa66f('0x72')][_0xa66f('0x121')]+(_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]?'\x20'+_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]:''),'body':_0x31cc20[_0xa66f('0xdf')]?_0x31cc20[_0xa66f('0xdf')][_0xa66f('0xe6')]:_0x31cc20[_0xa66f('0x39')],'direction':_0x31cc20[_0xa66f('0xfb')]==='out'?'A':'C','secret':_0x31cc20['secret'],'read':_0x31cc20[_0xa66f('0x125')],'attachment':_0x31cc20[_0xa66f('0xdf')]};})[_0xa66f('0x6e')]()};return ejs[_0xa66f('0x134')](path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'views',_0xa66f('0x135')),{'interaction':_0xdbb792})['then'](function(_0x12024d){var _0x4baf59=path[_0xa66f('0xe5')](_0x5206a5,_0xa66f('0x136')+_0x24ee72['id']+'-'+_0x321fa1+'.pdf');var _0x33198c={'path':_0x4baf59,'channel':_0xa66f('0x129'),'interactionId':_0x24ee72['id']};return pdf[_0xa66f('0x137')](_0x12024d,_0x33198c);})[_0xa66f('0x34')](function(){return new BPromise(function(_0x3792b2,_0x5101f8){zipdir(_0x5206a5,{'saveTo':_0x3709b6},function(_0x4ac4b4,_0x171111){if(_0x4ac4b4)return _0x5101f8(_0x4ac4b4);return _0x3792b2(_0x171111);});})[_0xa66f('0x34')](function(){return new BPromise(function(_0x46691d,_0x136518){rimraf(_0x5206a5,function(_0x1404df){if(_0x1404df)_0x136518(_0x1404df);return _0x46691d();});});})[_0xa66f('0x34')](function(){return _0x2b4238[_0xa66f('0x11b')](_0x3709b6,_0x6b60bd,function(_0x58f445){if(_0x58f445){console[_0xa66f('0x138')](_0xa66f('0x139'),_0x58f445);}else{fs['unlinkSync'](_0x3709b6);}});});});}else{return _0x2b4238[_0xa66f('0x27')](0xc8);}})['catch'](handleError(_0x2b4238,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8278dcf..e48d62a 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 _0x18c5=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x18c5,0x82));var _0x518c=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x18c5[_0x2a3c4d];return _0x55c390;};'use strict';var EventEmitter=require(_0x518c('0x0'));var ChatInteraction=require(_0x518c('0x1'))['db'][_0x518c('0x2')];var ChatMessage=require(_0x518c('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x518c('0x3'),'afterUpdate':_0x518c('0x4'),'afterDestroy':_0x518c('0x5')};function emitEvent(_0x2c9335){return function(_0x35fbf7,_0x1c857b,_0x122ccc){_0x35fbf7[_0x518c('0x6')]({'attributes':['id'],'raw':!![]})[_0x518c('0x7')](function(_0x16a59b){_0x35fbf7[_0x518c('0x8')](_0x518c('0x9'),_0x16a59b[_0x518c('0xa')](function(_0x4a03b9){return{'id':_0x4a03b9['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x35fbf7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1053b3){_0x35fbf7['setDataValue'](_0x518c('0xb'),_0x1053b3[_0x518c('0xc')]);ChatInteractionEvents[_0x518c('0xd')](_0x2c9335+':'+_0x35fbf7['id'],_0x35fbf7);ChatInteractionEvents[_0x518c('0xd')](_0x2c9335,_0x35fbf7);_0x122ccc(null);})[_0x518c('0xe')](_0x122ccc(null));};}for(var e in events){if(events[_0x518c('0xf')](e)){var event=events[e];ChatInteraction[_0x518c('0x10')](e,emitEvent(event));}}module[_0x518c('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x5f81=['emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','setDataValue','map','findAll','unreadMessages','length'];(function(_0x213304,_0x5bd292){var _0x20b424=function(_0xbc0dde){while(--_0xbc0dde){_0x213304['push'](_0x213304['shift']());}};_0x20b424(++_0x5bd292);}(_0x5f81,0xd6));var _0x15f8=function(_0x36dc24,_0x189ad1){_0x36dc24=_0x36dc24-0x0;var _0x439447=_0x5f81[_0x36dc24];return _0x439447;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x15f8('0x0'))['db'][_0x15f8('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x15f8('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x15f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x15f8('0x4'),'afterDestroy':_0x15f8('0x5')};function emitEvent(_0x4084f3){return function(_0x53d035,_0x51387c,_0x1dc31a){_0x53d035['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1ec68d){_0x53d035[_0x15f8('0x6')]('Users',_0x1ec68d[_0x15f8('0x7')](function(_0x475f40){return{'id':_0x475f40['id']};}));return ChatMessage[_0x15f8('0x8')]({'where':{'ChatInteractionId':_0x53d035['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x528822){_0x53d035[_0x15f8('0x6')](_0x15f8('0x9'),_0x528822[_0x15f8('0xa')]);ChatInteractionEvents[_0x15f8('0xb')](_0x4084f3+':'+_0x53d035['id'],_0x53d035);ChatInteractionEvents[_0x15f8('0xb')](_0x4084f3,_0x53d035);_0x1dc31a(null);})[_0x15f8('0xc')](_0x1dc31a(null));};}for(var e in events){if(events[_0x15f8('0xd')](e)){var event=events[e];ChatInteraction[_0x15f8('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index eb33e72..b817cfc 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 _0xa653=['../../config/environment','./chatInteraction.attributes','exports','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xa653,0x16f));var _0x3a65=function(_0x565993,_0x30c99c){_0x565993=_0x565993-0x0;var _0x535c0d=_0xa653[_0x565993];return _0x535c0d;};'use strict';var _=require('lodash');var util=require(_0x3a65('0x0'));var logger=require(_0x3a65('0x1'))(_0x3a65('0x2'));var moment=require(_0x3a65('0x3'));var BPromise=require(_0x3a65('0x4'));var rp=require(_0x3a65('0x5'));var fs=require('fs');var path=require(_0x3a65('0x6'));var rimraf=require('rimraf');var config=require(_0x3a65('0x7'));var attributes=require(_0x3a65('0x8'));module[_0x3a65('0x9')]=function(_0x53126d,_0x3c1df6){return _0x53126d[_0x3a65('0xa')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cc259,_0x21411c,_0x1a850b){if(_0x2cc259[_0x3a65('0xb')](_0x3a65('0xc'))){_0x2cc259['closedAt']=moment()[_0x3a65('0xd')](_0x3a65('0xe'));}_0x1a850b(null,_0x2cc259);}},'charset':_0x3a65('0xf'),'collate':_0x3a65('0x10')});}; \ No newline at end of file +var _0xef3e=['define','ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xef3e,0x170));var _0xeef3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xef3e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xeef3('0x0'));var util=require(_0xeef3('0x1'));var logger=require('../../config/logger')(_0xeef3('0x2'));var moment=require(_0xeef3('0x3'));var BPromise=require(_0xeef3('0x4'));var rp=require(_0xeef3('0x5'));var fs=require('fs');var path=require(_0xeef3('0x6'));var rimraf=require(_0xeef3('0x7'));var config=require(_0xeef3('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xeef3('0x9')]=function(_0x1b91d7,_0x2a2494){return _0x1b91d7[_0xeef3('0xa')](_0xeef3('0xb'),attributes,{'tableName':_0xeef3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x412e9a,_0x728966,_0x4e40ea){if(_0x412e9a[_0xeef3('0xd')]('closed')){_0x412e9a['closedAt']=moment()[_0xeef3('0xe')](_0xeef3('0xf'));}_0x4e40ea(null,_0x412e9a);}},'charset':_0xeef3('0x10'),'collate':_0xeef3('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index caa10b7..44d234a 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 _0x0d73=['request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','limit','find','where','addTags','ids','omit','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x0d73,0x11e));var _0x30d7=function(_0x134943,_0xd3e659){_0x134943=_0x134943-0x0;var _0x2558cc=_0x0d73[_0x134943];return _0x2558cc;};'use strict';var _=require(_0x30d7('0x0'));var util=require('util');var moment=require(_0x30d7('0x1'));var BPromise=require(_0x30d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30d7('0x3'));var db=require(_0x30d7('0x4'))['db'];var utils=require(_0x30d7('0x5'));var logger=require('../../config/logger')(_0x30d7('0x6'));var config=require(_0x30d7('0x7'));var jayson=require(_0x30d7('0x8'));var client=jayson[_0x30d7('0x9')][_0x30d7('0xa')]({'port':0x232a});config[_0x30d7('0xb')]=_[_0x30d7('0xc')](config[_0x30d7('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30d7('0xb')]));require(_0x30d7('0xd'))[_0x30d7('0xe')](socket);function respondWithRpcPromise(_0x5e717d,_0x4e2ac8,_0x38c208){return new BPromise(function(_0x4d7711,_0x3291f7){return client['request'](_0x5e717d,_0x38c208)[_0x30d7('0xf')](function(_0x32f876){logger[_0x30d7('0x10')](_0x30d7('0x11'),_0x4e2ac8,_0x30d7('0x12'));logger[_0x30d7('0x13')](_0x30d7('0x14'),_0x4e2ac8,_0x30d7('0x12'),JSON[_0x30d7('0x15')](_0x32f876));if(_0x32f876[_0x30d7('0x16')]){if(_0x32f876[_0x30d7('0x16')][_0x30d7('0x17')]===0x1f4){logger[_0x30d7('0x16')](_0x30d7('0x11'),_0x4e2ac8,_0x32f876[_0x30d7('0x16')][_0x30d7('0x18')]);return _0x3291f7(_0x32f876[_0x30d7('0x16')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4e2ac8,_0x32f876[_0x30d7('0x16')][_0x30d7('0x18')]);return _0x4d7711(_0x32f876[_0x30d7('0x16')][_0x30d7('0x18')]);}else{logger[_0x30d7('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x4e2ac8,_0x30d7('0x12'));_0x4d7711(_0x32f876['result'][_0x30d7('0x18')]);}})[_0x30d7('0x19')](function(_0x14f2b1){logger[_0x30d7('0x16')](_0x30d7('0x11'),_0x4e2ac8,_0x14f2b1);_0x3291f7(_0x14f2b1);});});}exports[_0x30d7('0x1a')]=function(_0x1af47e){var _0x32a9d5=this;return new Promise(function(_0x1ee11b,_0x47803f){return db[_0x30d7('0x1b')]['update'](_0x1af47e[_0x30d7('0x1c')],{'raw':_0x1af47e[_0x30d7('0x1d')]?_0x1af47e[_0x30d7('0x1d')][_0x30d7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af47e[_0x30d7('0x1d')]?_0x1af47e[_0x30d7('0x1d')]['where']||null:null,'attributes':_0x1af47e[_0x30d7('0x1d')]?_0x1af47e[_0x30d7('0x1d')]['attributes']||null:null,'limit':_0x1af47e[_0x30d7('0x1d')]?_0x1af47e[_0x30d7('0x1d')][_0x30d7('0x1f')]||null:null})['then'](function(_0x33715a){logger['info'](_0x30d7('0x1a'),_0x1af47e);logger[_0x30d7('0x13')](_0x30d7('0x1a'),_0x1af47e,JSON[_0x30d7('0x15')](_0x33715a));_0x1ee11b(_0x33715a);})[_0x30d7('0x19')](function(_0x2208ec){logger['error'](_0x30d7('0x1a'),_0x2208ec[_0x30d7('0x18')],_0x1af47e);_0x47803f(_0x32a9d5[_0x30d7('0x16')](0x1f4,_0x2208ec['message']));});});};exports['AddTagsToChatInteraction']=function(_0x247377){return new Promise(function(_0x103592,_0x435761){return db[_0x30d7('0x1b')][_0x30d7('0x20')]({'where':_0x247377[_0x30d7('0x1d')]?_0x247377[_0x30d7('0x1d')][_0x30d7('0x21')]||null:null})['then'](function(_0x482e56){if(_0x482e56){return _0x482e56[_0x30d7('0x22')](_0x247377[_0x30d7('0x1c')][_0x30d7('0x23')],_[_0x30d7('0x24')](_0x247377[_0x30d7('0x1c')],[_0x30d7('0x23'),'id'])||{});}})['spread'](function(_0x52d541){logger[_0x30d7('0x10')](_0x30d7('0x25'),_0x247377);logger[_0x30d7('0x13')]('AddTags',_0x247377,JSON[_0x30d7('0x15')](_0x52d541));_0x103592(_0x52d541);})[_0x30d7('0x19')](function(_0x350aba){logger['error'](_0x30d7('0x25'),_0x350aba['message'],_0x247377);_0x435761(_this[_0x30d7('0x16')](0x1f4,_0x350aba[_0x30d7('0x18')]));});});}; \ No newline at end of file +var _0xa150=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ChatInteraction','update','body','options','where','attributes','limit','UpdateChatInteraction','debug','addTags','ids','spread','AddTags'];(function(_0x18dee1,_0x1e1bb0){var _0x40d3cb=function(_0x2a7686){while(--_0x2a7686){_0x18dee1['push'](_0x18dee1['shift']());}};_0x40d3cb(++_0x1e1bb0);}(_0xa150,0x78));var _0x0a15=function(_0x8b0e0a,_0x264de0){_0x8b0e0a=_0x8b0e0a-0x0;var _0x401df6=_0xa150[_0x8b0e0a];return _0x401df6;};'use strict';var _=require(_0x0a15('0x0'));var util=require(_0x0a15('0x1'));var moment=require(_0x0a15('0x2'));var BPromise=require(_0x0a15('0x3'));var rs=require(_0x0a15('0x4'));var fs=require('fs');var Redis=require(_0x0a15('0x5'));var db=require(_0x0a15('0x6'))['db'];var utils=require(_0x0a15('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a15('0x8'));var jayson=require(_0x0a15('0x9'));var client=jayson[_0x0a15('0xa')][_0x0a15('0xb')]({'port':0x232a});config['redis']=_[_0x0a15('0xc')](config['redis'],{'host':_0x0a15('0xd'),'port':0x18eb});var socket=require(_0x0a15('0xe'))(new Redis(config[_0x0a15('0xf')]));require(_0x0a15('0x10'))['register'](socket);function respondWithRpcPromise(_0x225828,_0x58d661,_0x202c7e){return new BPromise(function(_0x1cdf10,_0x1ca234){return client[_0x0a15('0x11')](_0x225828,_0x202c7e)[_0x0a15('0x12')](function(_0x17451f){logger[_0x0a15('0x13')](_0x0a15('0x14'),_0x58d661,'request\x20sent');logger['debug'](_0x0a15('0x15'),_0x58d661,_0x0a15('0x16'),JSON[_0x0a15('0x17')](_0x17451f));if(_0x17451f[_0x0a15('0x18')]){if(_0x17451f[_0x0a15('0x18')]['code']===0x1f4){logger[_0x0a15('0x18')](_0x0a15('0x14'),_0x58d661,_0x17451f['error'][_0x0a15('0x19')]);return _0x1ca234(_0x17451f[_0x0a15('0x18')][_0x0a15('0x19')]);}logger[_0x0a15('0x18')](_0x0a15('0x14'),_0x58d661,_0x17451f[_0x0a15('0x18')][_0x0a15('0x19')]);return _0x1cdf10(_0x17451f['error'][_0x0a15('0x19')]);}else{logger[_0x0a15('0x13')](_0x0a15('0x14'),_0x58d661,_0x0a15('0x16'));_0x1cdf10(_0x17451f[_0x0a15('0x1a')][_0x0a15('0x19')]);}})['catch'](function(_0x293141){logger[_0x0a15('0x18')](_0x0a15('0x14'),_0x58d661,_0x293141);_0x1ca234(_0x293141);});});}exports['UpdateChatInteraction']=function(_0x2489d4){var _0x1e2dc2=this;return new Promise(function(_0xb7e8fc,_0xed56d){return db[_0x0a15('0x1b')][_0x0a15('0x1c')](_0x2489d4[_0x0a15('0x1d')],{'raw':_0x2489d4[_0x0a15('0x1e')]?_0x2489d4[_0x0a15('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2489d4[_0x0a15('0x1e')]?_0x2489d4[_0x0a15('0x1e')][_0x0a15('0x1f')]||null:null,'attributes':_0x2489d4['options']?_0x2489d4[_0x0a15('0x1e')][_0x0a15('0x20')]||null:null,'limit':_0x2489d4[_0x0a15('0x1e')]?_0x2489d4[_0x0a15('0x1e')][_0x0a15('0x21')]||null:null})['then'](function(_0x1e05ed){logger[_0x0a15('0x13')](_0x0a15('0x22'),_0x2489d4);logger[_0x0a15('0x23')](_0x0a15('0x22'),_0x2489d4,JSON[_0x0a15('0x17')](_0x1e05ed));_0xb7e8fc(_0x1e05ed);})['catch'](function(_0x19b13b){logger['error'](_0x0a15('0x22'),_0x19b13b['message'],_0x2489d4);_0xed56d(_0x1e2dc2[_0x0a15('0x18')](0x1f4,_0x19b13b[_0x0a15('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x3343b9){return new Promise(function(_0x4c7236,_0xeba3d){return db[_0x0a15('0x1b')]['find']({'where':_0x3343b9[_0x0a15('0x1e')]?_0x3343b9[_0x0a15('0x1e')]['where']||null:null})[_0x0a15('0x12')](function(_0x21e287){if(_0x21e287){return _0x21e287[_0x0a15('0x24')](_0x3343b9[_0x0a15('0x1d')][_0x0a15('0x25')],_['omit'](_0x3343b9[_0x0a15('0x1d')],[_0x0a15('0x25'),'id'])||{});}})[_0x0a15('0x26')](function(_0xa9c035){logger[_0x0a15('0x13')](_0x0a15('0x27'),_0x3343b9);logger['debug'](_0x0a15('0x27'),_0x3343b9,JSON[_0x0a15('0x17')](_0xa9c035));_0x4c7236(_0xa9c035);})['catch'](function(_0x1dd092){logger[_0x0a15('0x18')](_0x0a15('0x27'),_0x1dd092['message'],_0x3343b9);_0xeba3d(_this[_0x0a15('0x18')](0x1f4,_0x1dd092[_0x0a15('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a7f978c..6c9e7af 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 _0x06b7=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','remove','update'];(function(_0x13c1a9,_0x2892f3){var _0xbaa5bc=function(_0x12682e){while(--_0x12682e){_0x13c1a9['push'](_0x13c1a9['shift']());}};_0xbaa5bc(++_0x2892f3);}(_0x06b7,0x17d));var _0x706b=function(_0x492b46,_0x29b20c){_0x492b46=_0x492b46-0x0;var _0x46b1dc=_0x06b7[_0x492b46];return _0x46b1dc;};'use strict';var ChatInteractionEvents=require(_0x706b('0x0'));var events=['save',_0x706b('0x1'),_0x706b('0x2')];function createListener(_0x4d4702,_0x1abacd){return function(_0x51bdd8){_0x1abacd[_0x706b('0x3')](_0x4d4702,_0x51bdd8);};}function removeListener(_0x16ab6d,_0x346736){return function(){ChatInteractionEvents[_0x706b('0x4')](_0x16ab6d,_0x346736);};}exports[_0x706b('0x5')]=function(_0x40bcd7){for(var _0x3aec38=0x0,_0x17a780=events[_0x706b('0x6')];_0x3aec38<_0x17a780;_0x3aec38++){var _0x1c55d4=events[_0x3aec38];var _0x20fb19=createListener(_0x706b('0x7')+_0x1c55d4,_0x40bcd7);ChatInteractionEvents['on'](_0x1c55d4,_0x20fb19);}}; \ No newline at end of file +var _0x0735=['length','./chatInteraction.events','remove','update','removeListener','register'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x0735,0x1a5));var _0x5073=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0735[_0x422905];return _0x33dc6c;};'use strict';var ChatInteractionEvents=require(_0x5073('0x0'));var events=['save',_0x5073('0x1'),_0x5073('0x2')];function createListener(_0x3190e6,_0x371cd1){return function(_0x4d0c41){_0x371cd1['emit'](_0x3190e6,_0x4d0c41);};}function removeListener(_0x1eb041,_0x53a228){return function(){ChatInteractionEvents[_0x5073('0x3')](_0x1eb041,_0x53a228);};}exports[_0x5073('0x4')]=function(_0x283844){for(var _0x5a9b00=0x0,_0x10b776=events[_0x5073('0x5')];_0x5a9b00<_0x10b776;_0x5a9b00++){var _0x203be8=events[_0x5a9b00];var _0x7f95da=createListener('chatInteraction:'+_0x203be8,_0x283844);ChatInteractionEvents['on'](_0x203be8,_0x7f95da);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4087432..3daf21f 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 _0x778c=['root','server/files/attachments/','format','originalname','/:id/attachment_upload','single','file','addMessage','/:id/tags','chat','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join'];(function(_0x304c47,_0x4e0e20){var _0x2dbd2c=function(_0x4f7049){while(--_0x4f7049){_0x304c47['push'](_0x304c47['shift']());}};_0x2dbd2c(++_0x4e0e20);}(_0x778c,0x138));var _0xc778=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0x778c[_0x2c93e2];return _0x57264e;};'use strict';var multer=require('multer');var util=require(_0xc778('0x0'));var path=require(_0xc778('0x1'));var timeout=require(_0xc778('0x2'));var express=require(_0xc778('0x3'));var router=express[_0xc778('0x4')]();var fs_extra=require(_0xc778('0x5'));var auth=require(_0xc778('0x6'));var interaction=require(_0xc778('0x7'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xc778('0x8')](),controller[_0xc778('0x9')]);router[_0xc778('0xa')](_0xc778('0xb'),auth[_0xc778('0x8')](),controller['describe']);router['get'](_0xc778('0xc'),auth[_0xc778('0xd')](),controller[_0xc778('0xe')]);router[_0xc778('0xa')]('/:id/attachment_download',auth[_0xc778('0xd')](),controller['attachmentDownload']);router[_0xc778('0xa')](_0xc778('0xf'),auth[_0xc778('0x8')](),controller[_0xc778('0x10')]);router[_0xc778('0xa')](_0xc778('0x11'),auth[_0xc778('0xd')](),controller['getMyMessages']);router[_0xc778('0xa')]('/:id/download',auth[_0xc778('0x8')](),controller['download']);router[_0xc778('0x12')]('/',auth[_0xc778('0x8')](),controller[_0xc778('0x13')]);router[_0xc778('0x12')](_0xc778('0x14'),auth[_0xc778('0x8')](),controller[_0xc778('0x15')]);var upload=multer({'storage':multer[_0xc778('0x16')]({'destination':function(_0x311eff,_0x497d8f,_0x10b612){_0x10b612(null,path[_0xc778('0x17')](config[_0xc778('0x18')],_0xc778('0x19')));},'filename':function(_0x1c12d4,_0x58ea25,_0x3ff06d){_0x3ff06d(null,util[_0xc778('0x1a')]('%s-%s',Date['now'](),_0x58ea25[_0xc778('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc778('0x12')](_0xc778('0x1c'),upload[_0xc778('0x1d')](_0xc778('0x1e')),controller['attachmentUpload']);router[_0xc778('0x12')](_0xc778('0xf'),auth[_0xc778('0xd')](),controller[_0xc778('0x1f')]);router['post'](_0xc778('0x20'),auth[_0xc778('0x8')](),interaction['tracked'](_0xc778('0x21'),'chatinteraction:addtags'),controller[_0xc778('0x22')]);router[_0xc778('0x23')](_0xc778('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xc778('0x21'),'chatinteraction:update'),controller[_0xc778('0x24')]);router['put'](_0xc778('0x25'),controller[_0xc778('0x26')]);router[_0xc778('0x23')](_0xc778('0x27'),auth['isChatInteractionAuthorized'](),controller[_0xc778('0x28')]);router[_0xc778('0x23')](_0xc778('0x29'),controller[_0xc778('0x2a')]);router[_0xc778('0x2b')](_0xc778('0xc'),auth[_0xc778('0x8')](),interaction[_0xc778('0x2c')](_0xc778('0x21'),_0xc778('0x2d')),controller[_0xc778('0x2e')]);router[_0xc778('0x2b')](_0xc778('0x20'),auth[_0xc778('0x8')](),controller[_0xc778('0x2f')]);module['exports']=router; \ No newline at end of file +var _0xc4b2=['/:id/my_messages','getMyMessages','download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','originalname','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages'];(function(_0x1a7019,_0x40e751){var _0x4423c7=function(_0x2c60dd){while(--_0x2c60dd){_0x1a7019['push'](_0x1a7019['shift']());}};_0x4423c7(++_0x40e751);}(_0xc4b2,0x175));var _0x2c4b=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xc4b2[_0x86b219];return _0x1f320c;};'use strict';var multer=require(_0x2c4b('0x0'));var util=require(_0x2c4b('0x1'));var path=require(_0x2c4b('0x2'));var timeout=require(_0x2c4b('0x3'));var express=require(_0x2c4b('0x4'));var router=express[_0x2c4b('0x5')]();var fs_extra=require(_0x2c4b('0x6'));var auth=require(_0x2c4b('0x7'));var interaction=require(_0x2c4b('0x8'));var config=require(_0x2c4b('0x9'));var controller=require(_0x2c4b('0xa'));router[_0x2c4b('0xb')]('/',auth['isAuthenticated'](),controller[_0x2c4b('0xc')]);router[_0x2c4b('0xb')](_0x2c4b('0xd'),auth[_0x2c4b('0xe')](),controller['describe']);router[_0x2c4b('0xb')]('/:id',auth[_0x2c4b('0xf')](),controller['show']);router[_0x2c4b('0xb')](_0x2c4b('0x10'),auth[_0x2c4b('0xf')](),controller['attachmentDownload']);router[_0x2c4b('0xb')](_0x2c4b('0x11'),auth['isAuthenticated'](),controller[_0x2c4b('0x12')]);router[_0x2c4b('0xb')](_0x2c4b('0x13'),auth[_0x2c4b('0xf')](),controller[_0x2c4b('0x14')]);router[_0x2c4b('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x2c4b('0x15')]);router[_0x2c4b('0x16')]('/',auth[_0x2c4b('0xe')](),controller[_0x2c4b('0x17')]);router[_0x2c4b('0x16')]('/:id/vidaoo',auth[_0x2c4b('0xe')](),controller[_0x2c4b('0x18')]);var upload=multer({'storage':multer[_0x2c4b('0x19')]({'destination':function(_0x5c9d95,_0x3fe9d5,_0x13e888){_0x13e888(null,path[_0x2c4b('0x1a')](config[_0x2c4b('0x1b')],_0x2c4b('0x1c')));},'filename':function(_0x554f4e,_0x118b31,_0x2e7d6f){_0x2e7d6f(null,util[_0x2c4b('0x1d')]('%s-%s',Date['now'](),_0x118b31[_0x2c4b('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2c4b('0x16')]('/:id/attachment_upload',upload[_0x2c4b('0x1f')](_0x2c4b('0x20')),controller[_0x2c4b('0x21')]);router['post'](_0x2c4b('0x11'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0x2c4b('0x22'),auth[_0x2c4b('0xe')](),interaction[_0x2c4b('0x23')](_0x2c4b('0x24'),_0x2c4b('0x25')),controller[_0x2c4b('0x26')]);router[_0x2c4b('0x27')]('/:id',auth[_0x2c4b('0xe')](),interaction[_0x2c4b('0x23')](_0x2c4b('0x24'),_0x2c4b('0x28')),controller[_0x2c4b('0x29')]);router[_0x2c4b('0x27')](_0x2c4b('0x2a'),controller[_0x2c4b('0x2b')]);router[_0x2c4b('0x27')]('/:id/abandon',auth[_0x2c4b('0xf')](),controller[_0x2c4b('0x2c')]);router[_0x2c4b('0x27')](_0x2c4b('0x2d'),controller[_0x2c4b('0x2e')]);router[_0x2c4b('0x2f')]('/:id',auth[_0x2c4b('0xe')](),interaction[_0x2c4b('0x23')]('chat','chatinteraction:destroy'),controller[_0x2c4b('0x30')]);router[_0x2c4b('0x2f')](_0x2c4b('0x22'),auth[_0x2c4b('0xe')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index bb1dc52..a359b93 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 _0xc773=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x43cf19,_0x56ebde){var _0x560994=function(_0x4bfde7){while(--_0x4bfde7){_0x43cf19['push'](_0x43cf19['shift']());}};_0x560994(++_0x56ebde);}(_0xc773,0x13f));var _0x3c77=function(_0x3e35b3,_0x147dd0){_0x3e35b3=_0x3e35b3-0x0;var _0x3b770e=_0xc773[_0x3e35b3];return _0x3b770e;};'use strict';var Sequelize=require(_0x3c77('0x0'));module[_0x3c77('0x1')]={'body':{'type':Sequelize[_0x3c77('0x2')](_0x3c77('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3c77('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3c77('0x5')]}}; \ No newline at end of file +var _0x7fa3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x7fa3,0xf0));var _0x37fa=function(_0x21abf1,_0xcd06d){_0x21abf1=_0x21abf1-0x0;var _0x8f3ba=_0x7fa3[_0x21abf1];return _0x8f3ba;};'use strict';var Sequelize=require(_0x37fa('0x0'));module[_0x37fa('0x1')]={'body':{'type':Sequelize[_0x37fa('0x2')](_0x37fa('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x37fa('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x37fa('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c1140cb..984d639 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 _0xcb63=['filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','params','find','describe','get','lastMessage','lastMessageAt','format','getUsers','User','agent','user','fullname','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','ChatInternalMessage','type','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0x2c99a9,_0x3a826a){var _0x2e222b=function(_0x1907a9){while(--_0x1907a9){_0x2c99a9['push'](_0x2c99a9['shift']());}};_0x2e222b(++_0x3a826a);}(_0xcb63,0x17c));var _0x3cb6=function(_0x11487e,_0x2695cd){_0x11487e=_0x11487e-0x0;var _0x3bb686=_0xcb63[_0x11487e];return _0x3bb686;};'use strict';var emlformat=require(_0x3cb6('0x0'));var rimraf=require(_0x3cb6('0x1'));var zipdir=require(_0x3cb6('0x2'));var jsonpatch=require(_0x3cb6('0x3'));var rp=require(_0x3cb6('0x4'));var moment=require('moment');var BPromise=require(_0x3cb6('0x5'));var Mustache=require(_0x3cb6('0x6'));var util=require(_0x3cb6('0x7'));var path=require(_0x3cb6('0x8'));var sox=require('sox');var csv=require(_0x3cb6('0x9'));var ejs=require(_0x3cb6('0xa'));var fs=require('fs');var fs_extra=require(_0x3cb6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3cb6('0xc'));var jsforce=require(_0x3cb6('0xd'));var deskjs=require(_0x3cb6('0xe'));var toCsv=require(_0x3cb6('0x9'));var querystring=require(_0x3cb6('0xf'));var Papa=require(_0x3cb6('0x10'));var Redis=require('ioredis');var authService=require(_0x3cb6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cb6('0x12'));var logger=require(_0x3cb6('0x13'))(_0x3cb6('0x14'));var utils=require('../../config/utils');var config=require(_0x3cb6('0x15'));var licenseUtil=require(_0x3cb6('0x16'));var db=require(_0x3cb6('0x17'))['db'];config[_0x3cb6('0x18')]=_[_0x3cb6('0x19')](config[_0x3cb6('0x18')],{'host':_0x3cb6('0x1a'),'port':0x18eb});var socket=require(_0x3cb6('0x1b'))(new Redis(config[_0x3cb6('0x18')]));require(_0x3cb6('0x1c'))[_0x3cb6('0x1d')](socket);function respondWithStatusCode(_0x3ea33a,_0x2270ad){_0x2270ad=_0x2270ad||0xcc;return function(_0x49ba68){if(_0x49ba68){return _0x3ea33a[_0x3cb6('0x1e')](_0x2270ad);}return _0x3ea33a[_0x3cb6('0x1f')](_0x2270ad)[_0x3cb6('0x20')]();};}function respondWithResult(_0x1ecc1f,_0x422eb3){_0x422eb3=_0x422eb3||0xc8;return function(_0x548ec2){if(_0x548ec2){return _0x1ecc1f[_0x3cb6('0x1f')](_0x422eb3)[_0x3cb6('0x21')](_0x548ec2);}};}function respondWithFilteredResult(_0x37595f,_0x1e4aa4){return function(_0x1fd968){if(_0x1fd968){var _0x161ea0=typeof _0x1e4aa4[_0x3cb6('0x22')]===_0x3cb6('0x23')&&typeof _0x1e4aa4[_0x3cb6('0x24')]==='undefined';var _0x268cd5=_0x1fd968['count'];var _0x3e1935=_0x161ea0?0x0:_0x1e4aa4['offset'];var _0x2a41c2=_0x161ea0?_0x1fd968[_0x3cb6('0x25')]:_0x1e4aa4[_0x3cb6('0x22')]+_0x1e4aa4[_0x3cb6('0x24')];var _0x24d22e;if(_0x2a41c2>=_0x268cd5){_0x2a41c2=_0x268cd5;_0x24d22e=0xc8;}else{_0x24d22e=0xce;}_0x37595f['status'](_0x24d22e);return _0x37595f[_0x3cb6('0x26')](_0x3cb6('0x27'),_0x3e1935+'-'+_0x2a41c2+'/'+_0x268cd5)[_0x3cb6('0x21')](_0x1fd968);}return null;};}function patchUpdates(_0x56c00b){return function(_0xa46839){try{jsonpatch[_0x3cb6('0x28')](_0xa46839,_0x56c00b,!![]);}catch(_0x34a982){return BPromise['reject'](_0x34a982);}return _0xa46839[_0x3cb6('0x29')]();};}function saveUpdates(_0x414d97,_0x2a9aa3){return function(_0x3adf08){if(_0x3adf08){return _0x3adf08[_0x3cb6('0x2a')](_0x414d97)[_0x3cb6('0x2b')](function(_0x38f9bc){return _0x38f9bc;});}return null;};}function removeEntity(_0x86d58e,_0x245f6d){return function(_0x32662e){if(_0x32662e){return _0x32662e[_0x3cb6('0x2c')]()[_0x3cb6('0x2b')](function(){_0x86d58e[_0x3cb6('0x1f')](0xcc)[_0x3cb6('0x20')]();});}};}function handleEntityNotFound(_0xd19204,_0xce768a){return function(_0x56a154){if(!_0x56a154){_0xd19204[_0x3cb6('0x1e')](0x194);}return _0x56a154;};}function handleError(_0x298d5d,_0x589063){_0x589063=_0x589063||0x1f4;return function(_0x52926c){logger[_0x3cb6('0x2d')](_0x52926c[_0x3cb6('0x2e')]);if(_0x52926c[_0x3cb6('0x2f')]){delete _0x52926c[_0x3cb6('0x2f')];}_0x298d5d[_0x3cb6('0x1f')](_0x589063)['send'](_0x52926c);};}exports['index']=function(_0x1e9d2b,_0x4921b0){var _0x1ca330={},_0x557405={},_0x79b419={'count':0x0,'rows':[]};var _0x3e3648=_['map'](db[_0x3cb6('0x30')]['rawAttributes'],function(_0x1a76c4){return{'name':_0x1a76c4['fieldName'],'type':_0x1a76c4[_0x3cb6('0x31')]['key']};});_0x557405[_0x3cb6('0x32')]=_[_0x3cb6('0x33')](_0x3e3648,_0x3cb6('0x2f'));_0x557405['query']=_[_0x3cb6('0x34')](_0x1e9d2b['query']);_0x557405['filters']=_['intersection'](_0x557405[_0x3cb6('0x32')],_0x557405[_0x3cb6('0x35')]);_0x1ca330[_0x3cb6('0x36')]=_[_0x3cb6('0x37')](_0x557405[_0x3cb6('0x32')],qs[_0x3cb6('0x38')](_0x1e9d2b[_0x3cb6('0x35')][_0x3cb6('0x38')]));_0x1ca330[_0x3cb6('0x36')]=_0x1ca330['attributes'][_0x3cb6('0x39')]?_0x1ca330[_0x3cb6('0x36')]:_0x557405['model'];if(!_0x1e9d2b[_0x3cb6('0x35')][_0x3cb6('0x3a')](_0x3cb6('0x3b'))){_0x1ca330[_0x3cb6('0x24')]=qs[_0x3cb6('0x24')](_0x1e9d2b[_0x3cb6('0x35')]['limit']);_0x1ca330[_0x3cb6('0x22')]=qs[_0x3cb6('0x22')](_0x1e9d2b[_0x3cb6('0x35')][_0x3cb6('0x22')]);}_0x1ca330[_0x3cb6('0x3c')]=qs[_0x3cb6('0x3d')](_0x1e9d2b[_0x3cb6('0x35')][_0x3cb6('0x3d')]);_0x1ca330['where']=qs[_0x3cb6('0x3e')](_[_0x3cb6('0x3f')](_0x1e9d2b[_0x3cb6('0x35')],_0x557405['filters']),_0x3e3648);if(_0x1e9d2b[_0x3cb6('0x35')][_0x3cb6('0x40')]){_0x1ca330[_0x3cb6('0x41')]=_[_0x3cb6('0x42')](_0x1ca330['where'],{'$or':_[_0x3cb6('0x33')](_0x3e3648,function(_0x436f4e){if(_0x436f4e[_0x3cb6('0x31')]!==_0x3cb6('0x43')){var _0x474864={};_0x474864[_0x436f4e['name']]={'$like':'%'+_0x1e9d2b[_0x3cb6('0x35')][_0x3cb6('0x40')]+'%'};return _0x474864;}})});}_0x1ca330=_[_0x3cb6('0x42')]({},_0x1ca330,_0x1e9d2b[_0x3cb6('0x44')]);var _0x5f9201={'where':_0x1ca330['where']};return db[_0x3cb6('0x30')][_0x3cb6('0x25')](_0x5f9201)[_0x3cb6('0x2b')](function(_0x1002ac){_0x79b419[_0x3cb6('0x25')]=_0x1002ac;if(_0x1e9d2b[_0x3cb6('0x35')][_0x3cb6('0x45')]){_0x1ca330['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x3cb6('0x46')](_0x1ca330);})[_0x3cb6('0x2b')](function(_0x3dda9e){_0x79b419[_0x3cb6('0x47')]=_0x3dda9e;return _0x79b419;})[_0x3cb6('0x2b')](respondWithFilteredResult(_0x4921b0,_0x1ca330))[_0x3cb6('0x48')](handleError(_0x4921b0,null));};exports[_0x3cb6('0x49')]=function(_0x57c08e,_0x1020b3){var _0x429361={'raw':!![],'where':{'id':_0x57c08e['params']['id']}},_0x5ea596={};_0x5ea596['model']=_[_0x3cb6('0x34')](db[_0x3cb6('0x30')][_0x3cb6('0x4a')]);_0x5ea596['query']=_['keys'](_0x57c08e[_0x3cb6('0x35')]);_0x5ea596[_0x3cb6('0x3e')]=_[_0x3cb6('0x37')](_0x5ea596[_0x3cb6('0x32')],_0x5ea596[_0x3cb6('0x35')]);_0x429361[_0x3cb6('0x36')]=_[_0x3cb6('0x37')](_0x5ea596[_0x3cb6('0x32')],qs[_0x3cb6('0x38')](_0x57c08e[_0x3cb6('0x35')]['fields']));_0x429361[_0x3cb6('0x36')]=_0x429361[_0x3cb6('0x36')]['length']?_0x429361[_0x3cb6('0x36')]:_0x5ea596[_0x3cb6('0x32')];if(_0x57c08e['query'][_0x3cb6('0x45')]){_0x429361[_0x3cb6('0x4b')]=[{'all':!![]}];}_0x429361=_['merge']({},_0x429361,_0x57c08e[_0x3cb6('0x44')]);return db[_0x3cb6('0x30')]['find'](_0x429361)[_0x3cb6('0x2b')](handleEntityNotFound(_0x1020b3,null))['then'](respondWithResult(_0x1020b3,null))[_0x3cb6('0x48')](handleError(_0x1020b3,null));};exports['create']=function(_0x5d434a,_0x33ae54){return db['ChatInternalMessage'][_0x3cb6('0x4c')](_0x5d434a[_0x3cb6('0x4d')],{})[_0x3cb6('0x2b')](respondWithResult(_0x33ae54,0xc9))['catch'](handleError(_0x33ae54,null));};exports['update']=function(_0x5545da,_0x90d1bb){if(_0x5545da[_0x3cb6('0x4d')]['id']){delete _0x5545da[_0x3cb6('0x4d')]['id'];}return db[_0x3cb6('0x30')]['find']({'where':{'id':_0x5545da[_0x3cb6('0x4e')]['id']}})[_0x3cb6('0x2b')](handleEntityNotFound(_0x90d1bb,null))[_0x3cb6('0x2b')](saveUpdates(_0x5545da[_0x3cb6('0x4d')],null))[_0x3cb6('0x2b')](respondWithResult(_0x90d1bb,null))[_0x3cb6('0x48')](handleError(_0x90d1bb,null));};exports['destroy']=function(_0xec16ae,_0x4ed4c4){return db['ChatInternalMessage'][_0x3cb6('0x4f')]({'where':{'id':_0xec16ae[_0x3cb6('0x4e')]['id']}})[_0x3cb6('0x2b')](handleEntityNotFound(_0x4ed4c4,null))[_0x3cb6('0x2b')](removeEntity(_0x4ed4c4,null))[_0x3cb6('0x48')](handleError(_0x4ed4c4,null));};exports[_0x3cb6('0x50')]=function(_0x4ba953,_0x141703){return db[_0x3cb6('0x30')][_0x3cb6('0x50')]()[_0x3cb6('0x2b')](respondWithResult(_0x141703,null))['catch'](handleError(_0x141703,null));};function wrapUser(_0x3f50db){return function(_0x3d9ebf){var _0x5134e8=_0x3f50db[_0x3cb6('0x51')]({'plain':!![]});_0x5134e8['messages']=[];if(_0x3d9ebf){_0x5134e8['lastMessageAt']=_0x3d9ebf['createdAt'];_0x5134e8[_0x3cb6('0x52')]=_0x3d9ebf;}else{_0x5134e8[_0x3cb6('0x53')]=moment(0x0)[_0x3cb6('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x5134e8[_0x3cb6('0x52')]={};}return _0x5134e8;};}exports[_0x3cb6('0x55')]=function(_0xdec2e,_0x2632dd,_0x1b0535){var _0x59f853=[];return db[_0x3cb6('0x56')]['findAll']({'where':{'role':[_0x3cb6('0x57'),'admin',_0x3cb6('0x58')]},'attributes':['id',_0x3cb6('0x59'),_0x3cb6('0x2f'),'role','userpic','internal',_0x3cb6('0x5a'),_0x3cb6('0x5b'),_0x3cb6('0x5c'),_0x3cb6('0x5d')],'order':qs[_0x3cb6('0x3d')](_0x3cb6('0x5e')),'include':[{'model':db[_0x3cb6('0x5f')],'as':_0x3cb6('0x60'),'attributes':['id',_0x3cb6('0x2f'),'type'],'through':{'attributes':[]}}]})[_0x3cb6('0x2b')](function(_0x1df8f0){if(_0x1df8f0){var _0x5805bc=_0xdec2e[_0x3cb6('0x58')]['get']({'plain':!![]});if(!_0x5805bc)throw new Error(_0x3cb6('0x61'));if(_0x5805bc[_0x3cb6('0x62')]===_0x3cb6('0x58')){return db[_0x3cb6('0x63')][_0x3cb6('0x4f')]({'where':{'name':_0x3cb6('0x64'),'userProfileId':_0x5805bc['userProfileId']},'raw':!![]})[_0x3cb6('0x2b')](function(_0x4af26d){if(_0x4af26d){if(_0x4af26d['autoAssociation']===0x0){return db[_0x3cb6('0x65')][_0x3cb6('0x46')]({'where':{'sectionId':_0x4af26d['id']},'raw':!![]})[_0x3cb6('0x2b')](function(_0x13e071){var _0x50980c=[];if(_[_0x3cb6('0x66')](_0x13e071)){_0x50980c=_['filter'](_0x1df8f0,function(_0x575aee){if(_0x575aee[_0x3cb6('0x62')]!==_0x3cb6('0x57')){return _0x575aee;}});return _0x50980c;}else{for(var _0x48916b=0x0;_0x48916b<_0x1df8f0['length'];_0x48916b++){var _0x41e6c6=_0x1df8f0[_0x48916b];if(_0x41e6c6[_0x3cb6('0x62')]===_0x3cb6('0x57')){var _0x34cb3a=_[_0x3cb6('0x4f')](_0x13e071,function(_0x282db5){return _0x282db5[_0x3cb6('0x67')]===_0x41e6c6['id'];});if(_0x34cb3a)_0x50980c[_0x3cb6('0x68')](_0x41e6c6);}else{_0x50980c[_0x3cb6('0x68')](_0x41e6c6);}}return _0x50980c;}});}else{return _0x1df8f0;}}else{var _0x324dcf=_[_0x3cb6('0x40')](_0x1df8f0,function(_0x267898){if(_0x267898[_0x3cb6('0x62')]!==_0x3cb6('0x57')){return _0x267898;}});return _0x324dcf;}});}else{return _0x1df8f0;}}})[_0x3cb6('0x2b')](function(_0x2f3b72){var _0x5638e2=[];if(_0x2f3b72){_0x59f853=_0x2f3b72;for(var _0x4faf94=0x0;_0x4faf94<_0x2f3b72[_0x3cb6('0x39')];_0x4faf94+=0x1){_0x59f853[_0x4faf94]['messages']=[];_0x5638e2[_0x3cb6('0x68')](db[_0x3cb6('0x30')]['find']({'where':{'FromId':[_0xdec2e['user']['id'],_0x2f3b72[_0x4faf94]['id']],'ToId':[_0xdec2e[_0x3cb6('0x58')]['id'],_0x2f3b72[_0x4faf94]['id']],'ChatGroupId':null},'attributes':['id',_0x3cb6('0x69'),_0x3cb6('0x6a'),_0x3cb6('0x6b'),_0x3cb6('0x6c'),'body'],'order':qs[_0x3cb6('0x3d')](_0x3cb6('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3cb6('0x2b')](wrapUser(_0x2f3b72[_0x4faf94])));}return BPromise[_0x3cb6('0x6e')](_0x5638e2);}return[];})[_0x3cb6('0x2b')](function(_0x3dd9fa){return{'rows':_0x3dd9fa,'count':_0x3dd9fa[_0x3cb6('0x39')]};})[_0x3cb6('0x2b')](respondWithResult(_0x2632dd,null))[_0x3cb6('0x48')](handleError(_0x2632dd,null));}; \ No newline at end of file +var _0x8749=['all','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatInternalMessage','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','options','find','create','body','params','describe','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','user','fullname','userpic','internal','allowmessenger','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','ToId','read','-createdAt'];(function(_0x40e8ce,_0x1976ca){var _0x1c9032=function(_0x38a3ed){while(--_0x38a3ed){_0x40e8ce['push'](_0x40e8ce['shift']());}};_0x1c9032(++_0x1976ca);}(_0x8749,0x1c5));var _0x9874=function(_0x5ca7ee,_0x4c4c48){_0x5ca7ee=_0x5ca7ee-0x0;var _0x47123f=_0x8749[_0x5ca7ee];return _0x47123f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9874('0x0'));var jsonpatch=require(_0x9874('0x1'));var rp=require(_0x9874('0x2'));var moment=require(_0x9874('0x3'));var BPromise=require(_0x9874('0x4'));var Mustache=require(_0x9874('0x5'));var util=require('util');var path=require(_0x9874('0x6'));var sox=require(_0x9874('0x7'));var csv=require(_0x9874('0x8'));var ejs=require(_0x9874('0x9'));var fs=require('fs');var fs_extra=require(_0x9874('0xa'));var _=require(_0x9874('0xb'));var squel=require(_0x9874('0xc'));var crypto=require(_0x9874('0xd'));var jsforce=require(_0x9874('0xe'));var deskjs=require(_0x9874('0xf'));var toCsv=require(_0x9874('0x8'));var querystring=require('querystring');var Papa=require(_0x9874('0x10'));var Redis=require(_0x9874('0x11'));var authService=require(_0x9874('0x12'));var qs=require(_0x9874('0x13'));var as=require(_0x9874('0x14'));var hardwareService=require(_0x9874('0x15'));var logger=require('../../config/logger')(_0x9874('0x16'));var utils=require(_0x9874('0x17'));var config=require(_0x9874('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9874('0x19'))['db'];config[_0x9874('0x1a')]=_[_0x9874('0x1b')](config[_0x9874('0x1a')],{'host':_0x9874('0x1c'),'port':0x18eb});var socket=require(_0x9874('0x1d'))(new Redis(config['redis']));require(_0x9874('0x1e'))[_0x9874('0x1f')](socket);function respondWithStatusCode(_0x3e193f,_0x20d911){_0x20d911=_0x20d911||0xcc;return function(_0x5d0b96){if(_0x5d0b96){return _0x3e193f['sendStatus'](_0x20d911);}return _0x3e193f[_0x9874('0x20')](_0x20d911)[_0x9874('0x21')]();};}function respondWithResult(_0x39c25a,_0x5d2d2f){_0x5d2d2f=_0x5d2d2f||0xc8;return function(_0x57f91c){if(_0x57f91c){return _0x39c25a[_0x9874('0x20')](_0x5d2d2f)[_0x9874('0x22')](_0x57f91c);}};}function respondWithFilteredResult(_0x542f5d,_0x359061){return function(_0x26e47f){if(_0x26e47f){var _0x2d2277=typeof _0x359061[_0x9874('0x23')]===_0x9874('0x24')&&typeof _0x359061[_0x9874('0x25')]===_0x9874('0x24');var _0x446819=_0x26e47f['count'];var _0x4177e6=_0x2d2277?0x0:_0x359061['offset'];var _0x2599f1=_0x2d2277?_0x26e47f[_0x9874('0x26')]:_0x359061['offset']+_0x359061[_0x9874('0x25')];var _0x4215c9;if(_0x2599f1>=_0x446819){_0x2599f1=_0x446819;_0x4215c9=0xc8;}else{_0x4215c9=0xce;}_0x542f5d['status'](_0x4215c9);return _0x542f5d[_0x9874('0x27')](_0x9874('0x28'),_0x4177e6+'-'+_0x2599f1+'/'+_0x446819)[_0x9874('0x22')](_0x26e47f);}return null;};}function patchUpdates(_0x6dec1f){return function(_0x55643b){try{jsonpatch[_0x9874('0x29')](_0x55643b,_0x6dec1f,!![]);}catch(_0x53a8b2){return BPromise[_0x9874('0x2a')](_0x53a8b2);}return _0x55643b[_0x9874('0x2b')]();};}function saveUpdates(_0x2f36c1,_0x490347){return function(_0x1f221a){if(_0x1f221a){return _0x1f221a[_0x9874('0x2c')](_0x2f36c1)[_0x9874('0x2d')](function(_0xe60d80){return _0xe60d80;});}return null;};}function removeEntity(_0x301544,_0x4d4315){return function(_0x81a26){if(_0x81a26){return _0x81a26[_0x9874('0x2e')]()[_0x9874('0x2d')](function(){_0x301544[_0x9874('0x20')](0xcc)[_0x9874('0x21')]();});}};}function handleEntityNotFound(_0x5aa8cf,_0x653642){return function(_0xf20566){if(!_0xf20566){_0x5aa8cf[_0x9874('0x2f')](0x194);}return _0xf20566;};}function handleError(_0xd5d581,_0xcd205f){_0xcd205f=_0xcd205f||0x1f4;return function(_0x15fc9d){logger['error'](_0x15fc9d[_0x9874('0x30')]);if(_0x15fc9d['name']){delete _0x15fc9d[_0x9874('0x31')];}_0xd5d581['status'](_0xcd205f)[_0x9874('0x32')](_0x15fc9d);};}exports[_0x9874('0x33')]=function(_0x58a33c,_0x42b1ef){var _0x35414d={},_0x36a149={},_0x39fa5b={'count':0x0,'rows':[]};var _0x29baed=_[_0x9874('0x34')](db[_0x9874('0x35')]['rawAttributes'],function(_0x4f1109){return{'name':_0x4f1109['fieldName'],'type':_0x4f1109['type'][_0x9874('0x36')]};});_0x36a149[_0x9874('0x37')]=_['map'](_0x29baed,_0x9874('0x31'));_0x36a149[_0x9874('0x38')]=_['keys'](_0x58a33c[_0x9874('0x38')]);_0x36a149[_0x9874('0x39')]=_[_0x9874('0x3a')](_0x36a149[_0x9874('0x37')],_0x36a149['query']);_0x35414d[_0x9874('0x3b')]=_[_0x9874('0x3a')](_0x36a149[_0x9874('0x37')],qs[_0x9874('0x3c')](_0x58a33c[_0x9874('0x38')]['fields']));_0x35414d[_0x9874('0x3b')]=_0x35414d[_0x9874('0x3b')][_0x9874('0x3d')]?_0x35414d[_0x9874('0x3b')]:_0x36a149['model'];if(!_0x58a33c[_0x9874('0x38')][_0x9874('0x3e')]('nolimit')){_0x35414d[_0x9874('0x25')]=qs[_0x9874('0x25')](_0x58a33c[_0x9874('0x38')][_0x9874('0x25')]);_0x35414d[_0x9874('0x23')]=qs[_0x9874('0x23')](_0x58a33c[_0x9874('0x38')][_0x9874('0x23')]);}_0x35414d[_0x9874('0x3f')]=qs[_0x9874('0x40')](_0x58a33c['query'][_0x9874('0x40')]);_0x35414d[_0x9874('0x41')]=qs[_0x9874('0x39')](_[_0x9874('0x42')](_0x58a33c[_0x9874('0x38')],_0x36a149[_0x9874('0x39')]),_0x29baed);if(_0x58a33c[_0x9874('0x38')][_0x9874('0x43')]){_0x35414d[_0x9874('0x41')]=_[_0x9874('0x44')](_0x35414d[_0x9874('0x41')],{'$or':_[_0x9874('0x34')](_0x29baed,function(_0x410360){if(_0x410360[_0x9874('0x45')]!==_0x9874('0x46')){var _0x398689={};_0x398689[_0x410360['name']]={'$like':'%'+_0x58a33c['query'][_0x9874('0x43')]+'%'};return _0x398689;}})});}_0x35414d=_[_0x9874('0x44')]({},_0x35414d,_0x58a33c['options']);var _0x540e1a={'where':_0x35414d[_0x9874('0x41')]};return db['ChatInternalMessage']['count'](_0x540e1a)[_0x9874('0x2d')](function(_0x1b7246){_0x39fa5b['count']=_0x1b7246;if(_0x58a33c[_0x9874('0x38')][_0x9874('0x47')]){_0x35414d[_0x9874('0x48')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x9874('0x49')](_0x35414d);})['then'](function(_0x2ceeca){_0x39fa5b[_0x9874('0x4a')]=_0x2ceeca;return _0x39fa5b;})[_0x9874('0x2d')](respondWithFilteredResult(_0x42b1ef,_0x35414d))[_0x9874('0x4b')](handleError(_0x42b1ef,null));};exports[_0x9874('0x4c')]=function(_0x1130e2,_0x758299){var _0x5839f4={'raw':!![],'where':{'id':_0x1130e2['params']['id']}},_0x1a8501={};_0x1a8501['model']=_[_0x9874('0x4d')](db[_0x9874('0x35')][_0x9874('0x4e')]);_0x1a8501[_0x9874('0x38')]=_[_0x9874('0x4d')](_0x1130e2[_0x9874('0x38')]);_0x1a8501['filters']=_[_0x9874('0x3a')](_0x1a8501[_0x9874('0x37')],_0x1a8501[_0x9874('0x38')]);_0x5839f4[_0x9874('0x3b')]=_[_0x9874('0x3a')](_0x1a8501[_0x9874('0x37')],qs[_0x9874('0x3c')](_0x1130e2['query'][_0x9874('0x3c')]));_0x5839f4[_0x9874('0x3b')]=_0x5839f4[_0x9874('0x3b')][_0x9874('0x3d')]?_0x5839f4[_0x9874('0x3b')]:_0x1a8501['model'];if(_0x1130e2[_0x9874('0x38')]['includeAll']){_0x5839f4[_0x9874('0x48')]=[{'all':!![]}];}_0x5839f4=_[_0x9874('0x44')]({},_0x5839f4,_0x1130e2[_0x9874('0x4f')]);return db[_0x9874('0x35')][_0x9874('0x50')](_0x5839f4)[_0x9874('0x2d')](handleEntityNotFound(_0x758299,null))[_0x9874('0x2d')](respondWithResult(_0x758299,null))[_0x9874('0x4b')](handleError(_0x758299,null));};exports['create']=function(_0x4ae6a1,_0x33f5db){return db[_0x9874('0x35')][_0x9874('0x51')](_0x4ae6a1[_0x9874('0x52')],{})[_0x9874('0x2d')](respondWithResult(_0x33f5db,0xc9))['catch'](handleError(_0x33f5db,null));};exports[_0x9874('0x2c')]=function(_0x581929,_0x22933b){if(_0x581929[_0x9874('0x52')]['id']){delete _0x581929['body']['id'];}return db['ChatInternalMessage'][_0x9874('0x50')]({'where':{'id':_0x581929[_0x9874('0x53')]['id']}})['then'](handleEntityNotFound(_0x22933b,null))['then'](saveUpdates(_0x581929[_0x9874('0x52')],null))[_0x9874('0x2d')](respondWithResult(_0x22933b,null))[_0x9874('0x4b')](handleError(_0x22933b,null));};exports[_0x9874('0x2e')]=function(_0x6dfa3f,_0x3a12aa){return db[_0x9874('0x35')][_0x9874('0x50')]({'where':{'id':_0x6dfa3f[_0x9874('0x53')]['id']}})[_0x9874('0x2d')](handleEntityNotFound(_0x3a12aa,null))[_0x9874('0x2d')](removeEntity(_0x3a12aa,null))['catch'](handleError(_0x3a12aa,null));};exports[_0x9874('0x54')]=function(_0x3388ad,_0x22cc2c){return db[_0x9874('0x35')][_0x9874('0x54')]()['then'](respondWithResult(_0x22cc2c,null))[_0x9874('0x4b')](handleError(_0x22cc2c,null));};function wrapUser(_0x585bc8){return function(_0x359f4a){var _0x4a884c=_0x585bc8['get']({'plain':!![]});_0x4a884c[_0x9874('0x55')]=[];if(_0x359f4a){_0x4a884c[_0x9874('0x56')]=_0x359f4a[_0x9874('0x57')];_0x4a884c['lastMessage']=_0x359f4a;}else{_0x4a884c[_0x9874('0x56')]=moment(0x0)[_0x9874('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a884c[_0x9874('0x59')]={};}return _0x4a884c;};}exports[_0x9874('0x5a')]=function(_0x5999fc,_0xc9ebde,_0x225841){var _0xcc4d83=[];return db[_0x9874('0x5b')][_0x9874('0x49')]({'where':{'role':['agent','admin',_0x9874('0x5c')]},'attributes':['id',_0x9874('0x5d'),_0x9874('0x31'),'role',_0x9874('0x5e'),_0x9874('0x5f'),'online','lastLoginAt',_0x9874('0x60'),'showWebBar'],'order':qs['sort'](_0x9874('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0x9874('0x62'),'attributes':['id',_0x9874('0x31'),_0x9874('0x45')],'through':{'attributes':[]}}]})[_0x9874('0x2d')](function(_0x32e81c){if(_0x32e81c){var _0x3d1d7d=_0x5999fc[_0x9874('0x5c')]['get']({'plain':!![]});if(!_0x3d1d7d)throw new Error(_0x9874('0x63'));if(_0x3d1d7d[_0x9874('0x64')]===_0x9874('0x5c')){return db[_0x9874('0x65')]['find']({'where':{'name':_0x9874('0x66'),'userProfileId':_0x3d1d7d[_0x9874('0x67')]},'raw':!![]})['then'](function(_0x445c16){if(_0x445c16){if(_0x445c16[_0x9874('0x68')]===0x0){return db[_0x9874('0x69')]['findAll']({'where':{'sectionId':_0x445c16['id']},'raw':!![]})[_0x9874('0x2d')](function(_0x1ee030){var _0x4473b2=[];if(_[_0x9874('0x6a')](_0x1ee030)){_0x4473b2=_[_0x9874('0x43')](_0x32e81c,function(_0x292317){if(_0x292317[_0x9874('0x64')]!==_0x9874('0x6b')){return _0x292317;}});return _0x4473b2;}else{for(var _0x57bf13=0x0;_0x57bf13<_0x32e81c['length'];_0x57bf13++){var _0x34a101=_0x32e81c[_0x57bf13];if(_0x34a101['role']==='agent'){var _0x69ff4=_[_0x9874('0x50')](_0x1ee030,function(_0x17459a){return _0x17459a[_0x9874('0x6c')]===_0x34a101['id'];});if(_0x69ff4)_0x4473b2['push'](_0x34a101);}else{_0x4473b2['push'](_0x34a101);}}return _0x4473b2;}});}else{return _0x32e81c;}}else{var _0x44e4af=_['filter'](_0x32e81c,function(_0x15f439){if(_0x15f439[_0x9874('0x64')]!==_0x9874('0x6b')){return _0x15f439;}});return _0x44e4af;}});}else{return _0x32e81c;}}})[_0x9874('0x2d')](function(_0x1cef3d){var _0x4dec83=[];if(_0x1cef3d){_0xcc4d83=_0x1cef3d;for(var _0x2609df=0x0;_0x2609df<_0x1cef3d[_0x9874('0x3d')];_0x2609df+=0x1){_0xcc4d83[_0x2609df][_0x9874('0x55')]=[];_0x4dec83['push'](db[_0x9874('0x35')][_0x9874('0x50')]({'where':{'FromId':[_0x5999fc[_0x9874('0x5c')]['id'],_0x1cef3d[_0x2609df]['id']],'ToId':[_0x5999fc['user']['id'],_0x1cef3d[_0x2609df]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x9874('0x6d'),_0x9874('0x6e'),_0x9874('0x52')],'order':qs[_0x9874('0x40')](_0x9874('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9874('0x2d')](wrapUser(_0x1cef3d[_0x2609df])));}return BPromise[_0x9874('0x70')](_0x4dec83);}return[];})[_0x9874('0x2d')](function(_0x29c118){return{'rows':_0x29c118,'count':_0x29c118['length']};})[_0x9874('0x2d')](respondWithResult(_0xc9ebde,null))[_0x9874('0x4b')](handleError(_0xc9ebde,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7a2003d..3157bf2 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 _0x5452=['hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','update','remove','emit'];(function(_0xf38552,_0x1fcf41){var _0x2c7528=function(_0xc81e3a){while(--_0xc81e3a){_0xf38552['push'](_0xf38552['shift']());}};_0x2c7528(++_0x1fcf41);}(_0x5452,0xbf));var _0x2545=function(_0x4d8504,_0x3fce2f){_0x4d8504=_0x4d8504-0x0;var _0x116792=_0x5452[_0x4d8504];return _0x116792;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x2545('0x0'))['db'][_0x2545('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2545('0x2'),'afterDestroy':_0x2545('0x3')};function emitEvent(_0x345c1f){return function(_0xceaac,_0x4ac98e,_0x4962ba){ChatInternalMessageEvents[_0x2545('0x4')](_0x345c1f+':'+_0xceaac['id'],_0xceaac);ChatInternalMessageEvents['emit'](_0x345c1f,_0xceaac);_0x4962ba(null);};}for(var e in events){if(events[_0x2545('0x5')](e)){var event=events[e];ChatInternalMessage[_0x2545('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x657b=['hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit'];(function(_0x5d3bda,_0x4d10c1){var _0x5b6d20=function(_0x18bdcb){while(--_0x18bdcb){_0x5d3bda['push'](_0x5d3bda['shift']());}};_0x5b6d20(++_0x4d10c1);}(_0x657b,0x77));var _0xb657=function(_0x387d26,_0x13c985){_0x387d26=_0x387d26-0x0;var _0x5d073a=_0x657b[_0x387d26];return _0x5d073a;};'use strict';var EventEmitter=require(_0xb657('0x0'));var ChatInternalMessage=require(_0xb657('0x1'))['db'][_0xb657('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb657('0x3'),'afterUpdate':_0xb657('0x4'),'afterDestroy':_0xb657('0x5')};function emitEvent(_0x2de0e3){return function(_0x5c7118,_0xeed689,_0x16190d){ChatInternalMessageEvents['emit'](_0x2de0e3+':'+_0x5c7118['id'],_0x5c7118);ChatInternalMessageEvents[_0xb657('0x6')](_0x2de0e3,_0x5c7118);_0x16190d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xb657('0x7')](e,emitEvent(event));}}module[_0xb657('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8a7836b..ec1cf07 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 _0x9307=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9307,0x16e));var _0x7930=function(_0x2f83d1,_0x465431){_0x2f83d1=_0x2f83d1-0x0;var _0x351f3f=_0x9307[_0x2f83d1];return _0x351f3f;};'use strict';var _=require(_0x7930('0x0'));var util=require(_0x7930('0x1'));var logger=require(_0x7930('0x2'))('api');var moment=require(_0x7930('0x3'));var BPromise=require(_0x7930('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7930('0x5'));var rimraf=require(_0x7930('0x6'));var config=require(_0x7930('0x7'));var attributes=require(_0x7930('0x8'));module[_0x7930('0x9')]=function(_0x3a220a,_0x172951){return _0x3a220a[_0x7930('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x7930('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7930('0xc'),'collate':_0x7930('0xd')});}; \ No newline at end of file +var _0x5f9a=['api','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x34697a,_0x5a93d6){var _0x18abce=function(_0x356b33){while(--_0x356b33){_0x34697a['push'](_0x34697a['shift']());}};_0x18abce(++_0x5a93d6);}(_0x5f9a,0xa6));var _0xa5f9=function(_0x4c742a,_0x3608ac){_0x4c742a=_0x4c742a-0x0;var _0x55717b=_0x5f9a[_0x4c742a];return _0x55717b;};'use strict';var _=require(_0xa5f9('0x0'));var util=require('util');var logger=require(_0xa5f9('0x1'))(_0xa5f9('0x2'));var moment=require('moment');var BPromise=require(_0xa5f9('0x3'));var rp=require(_0xa5f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5f9('0x5'));var config=require(_0xa5f9('0x6'));var attributes=require(_0xa5f9('0x7'));module[_0xa5f9('0x8')]=function(_0x152de8,_0x168f68){return _0x152de8[_0xa5f9('0x9')](_0xa5f9('0xa'),attributes,{'tableName':_0xa5f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa5f9('0xc'),'collate':_0xa5f9('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9d45dbb..72b35c6 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 _0xec86=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','register','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message'];(function(_0x569118,_0x187060){var _0x181ff5=function(_0x3cfd8f){while(--_0x3cfd8f){_0x569118['push'](_0x569118['shift']());}};_0x181ff5(++_0x187060);}(_0xec86,0x7f));var _0x6ec8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xec86[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x6ec8('0x0'));var util=require(_0x6ec8('0x1'));var moment=require(_0x6ec8('0x2'));var BPromise=require(_0x6ec8('0x3'));var rs=require(_0x6ec8('0x4'));var fs=require('fs');var Redis=require(_0x6ec8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ec8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6ec8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6ec8('0x8')][_0x6ec8('0x9')]({'port':0x232a});config[_0x6ec8('0xa')]=_[_0x6ec8('0xb')](config[_0x6ec8('0xa')],{'host':_0x6ec8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ec8('0xa')]));require('./chatInternalMessage.socket')[_0x6ec8('0xd')](socket);function respondWithRpcPromise(_0x331dfe,_0x272f76,_0x6c0d4){return new BPromise(function(_0x321b8f,_0x3fcc54){return client['request'](_0x331dfe,_0x6c0d4)['then'](function(_0x108a9b){logger[_0x6ec8('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x272f76,_0x6ec8('0xf'));logger[_0x6ec8('0x10')](_0x6ec8('0x11'),_0x272f76,'request\x20sent',JSON[_0x6ec8('0x12')](_0x108a9b));if(_0x108a9b[_0x6ec8('0x13')]){if(_0x108a9b[_0x6ec8('0x13')][_0x6ec8('0x14')]===0x1f4){logger['error'](_0x6ec8('0x15'),_0x272f76,_0x108a9b[_0x6ec8('0x13')][_0x6ec8('0x16')]);return _0x3fcc54(_0x108a9b[_0x6ec8('0x13')][_0x6ec8('0x16')]);}logger[_0x6ec8('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x272f76,_0x108a9b[_0x6ec8('0x13')][_0x6ec8('0x16')]);return _0x321b8f(_0x108a9b[_0x6ec8('0x13')]['message']);}else{logger[_0x6ec8('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x272f76,_0x6ec8('0xf'));_0x321b8f(_0x108a9b[_0x6ec8('0x17')][_0x6ec8('0x16')]);}})[_0x6ec8('0x18')](function(_0x402091){logger[_0x6ec8('0x13')](_0x6ec8('0x15'),_0x272f76,_0x402091);_0x3fcc54(_0x402091);});});} \ No newline at end of file +var _0xf40b=['client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x35f188,_0x4f70a7){var _0x284e96=function(_0x281f73){while(--_0x281f73){_0x35f188['push'](_0x35f188['shift']());}};_0x284e96(++_0x4f70a7);}(_0xf40b,0xfb));var _0xbf40=function(_0x48a0b4,_0x2a4c3f){_0x48a0b4=_0x48a0b4-0x0;var _0x44b1e6=_0xf40b[_0x48a0b4];return _0x44b1e6;};'use strict';var _=require('lodash');var util=require(_0xbf40('0x0'));var moment=require(_0xbf40('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf40('0x2'));var fs=require('fs');var Redis=require(_0xbf40('0x3'));var db=require(_0xbf40('0x4'))['db'];var utils=require(_0xbf40('0x5'));var logger=require(_0xbf40('0x6'))('rpc');var config=require(_0xbf40('0x7'));var jayson=require(_0xbf40('0x8'));var client=jayson[_0xbf40('0x9')][_0xbf40('0xa')]({'port':0x232a});config[_0xbf40('0xb')]=_['defaults'](config[_0xbf40('0xb')],{'host':_0xbf40('0xc'),'port':0x18eb});var socket=require(_0xbf40('0xd'))(new Redis(config['redis']));require(_0xbf40('0xe'))[_0xbf40('0xf')](socket);function respondWithRpcPromise(_0xfaf7fb,_0x2945b4,_0xbaaee1){return new BPromise(function(_0x3d3993,_0x48f2f6){return client[_0xbf40('0x10')](_0xfaf7fb,_0xbaaee1)['then'](function(_0x828850){logger[_0xbf40('0x11')](_0xbf40('0x12'),_0x2945b4,_0xbf40('0x13'));logger['debug'](_0xbf40('0x14'),_0x2945b4,_0xbf40('0x13'),JSON['stringify'](_0x828850));if(_0x828850[_0xbf40('0x15')]){if(_0x828850[_0xbf40('0x15')][_0xbf40('0x16')]===0x1f4){logger[_0xbf40('0x15')](_0xbf40('0x12'),_0x2945b4,_0x828850[_0xbf40('0x15')][_0xbf40('0x17')]);return _0x48f2f6(_0x828850['error'][_0xbf40('0x17')]);}logger[_0xbf40('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2945b4,_0x828850[_0xbf40('0x15')][_0xbf40('0x17')]);return _0x3d3993(_0x828850[_0xbf40('0x15')]['message']);}else{logger['info'](_0xbf40('0x12'),_0x2945b4,_0xbf40('0x13'));_0x3d3993(_0x828850[_0xbf40('0x18')][_0xbf40('0x17')]);}})[_0xbf40('0x19')](function(_0x51042f){logger[_0xbf40('0x15')](_0xbf40('0x12'),_0x2945b4,_0x51042f);_0x48f2f6(_0x51042f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4d53dfe..453c58e 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 _0x69d5=['remove','update','emit','removeListener','register','length','./chatInternalMessage.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x69d5,0xf6));var _0x569d=function(_0x12d357,_0x5253f4){_0x12d357=_0x12d357-0x0;var _0x5af041=_0x69d5[_0x12d357];return _0x5af041;};'use strict';var ChatInternalMessageEvents=require(_0x569d('0x0'));var events=[_0x569d('0x1'),_0x569d('0x2'),_0x569d('0x3')];function createListener(_0x222ef8,_0x22f78a){return function(_0x419d68){_0x22f78a[_0x569d('0x4')](_0x222ef8,_0x419d68);};}function removeListener(_0x3bea12,_0x282f2d){return function(){ChatInternalMessageEvents[_0x569d('0x5')](_0x3bea12,_0x282f2d);};}exports[_0x569d('0x6')]=function(_0x3b2f66){for(var _0x14e1c6=0x0,_0x2f05cc=events[_0x569d('0x7')];_0x14e1c6<_0x2f05cc;_0x14e1c6++){var _0x530660=events[_0x14e1c6];var _0x1edac8=createListener('chatInternalMessage:'+_0x530660,_0x3b2f66);ChatInternalMessageEvents['on'](_0x530660,_0x1edac8);}}; \ No newline at end of file +var _0x6d30=['removeListener','register','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit'];(function(_0x3dc277,_0x2e082d){var _0x4fd68d=function(_0x529918){while(--_0x529918){_0x3dc277['push'](_0x3dc277['shift']());}};_0x4fd68d(++_0x2e082d);}(_0x6d30,0x168));var _0x06d3=function(_0x17d133,_0x3aebc5){_0x17d133=_0x17d133-0x0;var _0xf4f7a2=_0x6d30[_0x17d133];return _0xf4f7a2;};'use strict';var ChatInternalMessageEvents=require(_0x06d3('0x0'));var events=['save',_0x06d3('0x1'),_0x06d3('0x2')];function createListener(_0xc3ff85,_0x37f176){return function(_0x161edd){_0x37f176[_0x06d3('0x3')](_0xc3ff85,_0x161edd);};}function removeListener(_0x169238,_0x3d3a22){return function(){ChatInternalMessageEvents[_0x06d3('0x4')](_0x169238,_0x3d3a22);};}exports[_0x06d3('0x5')]=function(_0x109628){for(var _0x7c7845=0x0,_0xaa61df=events['length'];_0x7c7845<_0xaa61df;_0x7c7845++){var _0x9c05fa=events[_0x7c7845];var _0x3156ba=createListener(_0x06d3('0x6')+_0x9c05fa,_0x109628);ChatInternalMessageEvents['on'](_0x9c05fa,_0x3156ba);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 1b7c7ec..01a0f0a 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 _0xd046=['../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','show','post','put','delete','/:id','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x41b51f,_0x216fa6){var _0x5bd366=function(_0x163499){while(--_0x163499){_0x41b51f['push'](_0x41b51f['shift']());}};_0x5bd366(++_0x216fa6);}(_0xd046,0x177));var _0x6d04=function(_0x2b6e5d,_0x417c59){_0x2b6e5d=_0x2b6e5d-0x0;var _0x77d8c8=_0xd046[_0x2b6e5d];return _0x77d8c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d04('0x0'));var timeout=require(_0x6d04('0x1'));var express=require('express');var router=express[_0x6d04('0x2')]();var fs_extra=require(_0x6d04('0x3'));var auth=require(_0x6d04('0x4'));var interaction=require(_0x6d04('0x5'));var config=require(_0x6d04('0x6'));var controller=require(_0x6d04('0x7'));router[_0x6d04('0x8')]('/',auth[_0x6d04('0x9')](),controller[_0x6d04('0xa')]);router[_0x6d04('0x8')](_0x6d04('0xb'),auth['isAuthenticated'](),controller[_0x6d04('0xc')]);router[_0x6d04('0x8')](_0x6d04('0xd'),auth[_0x6d04('0x9')](),controller['getUsers']);router[_0x6d04('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0xe')]);router[_0x6d04('0xf')]('/',auth[_0x6d04('0x9')](),controller['create']);router[_0x6d04('0x10')]('/:id',controller['update']);router[_0x6d04('0x11')](_0x6d04('0x12'),auth[_0x6d04('0x9')](),controller[_0x6d04('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa049=['show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers','/:id'];(function(_0x258ff2,_0x2d0e88){var _0xaea1f2=function(_0x54c4f4){while(--_0x54c4f4){_0x258ff2['push'](_0x258ff2['shift']());}};_0xaea1f2(++_0x2d0e88);}(_0xa049,0x18d));var _0x9a04=function(_0x17cca1,_0x4cd1f6){_0x17cca1=_0x17cca1-0x0;var _0x2a1d4a=_0xa049[_0x17cca1];return _0x2a1d4a;};'use strict';var multer=require(_0x9a04('0x0'));var util=require(_0x9a04('0x1'));var path=require(_0x9a04('0x2'));var timeout=require(_0x9a04('0x3'));var express=require(_0x9a04('0x4'));var router=express[_0x9a04('0x5')]();var fs_extra=require(_0x9a04('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9a04('0x7'));var config=require(_0x9a04('0x8'));var controller=require(_0x9a04('0x9'));router[_0x9a04('0xa')]('/',auth[_0x9a04('0xb')](),controller['index']);router[_0x9a04('0xa')](_0x9a04('0xc'),auth['isAuthenticated'](),controller[_0x9a04('0xd')]);router[_0x9a04('0xa')](_0x9a04('0xe'),auth[_0x9a04('0xb')](),controller[_0x9a04('0xf')]);router[_0x9a04('0xa')](_0x9a04('0x10'),auth[_0x9a04('0xb')](),controller[_0x9a04('0x11')]);router['post']('/',auth[_0x9a04('0xb')](),controller[_0x9a04('0x12')]);router['put'](_0x9a04('0x10'),controller[_0x9a04('0x13')]);router[_0x9a04('0x14')](_0x9a04('0x10'),auth[_0x9a04('0xb')](),controller[_0x9a04('0x15')]);module[_0x9a04('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 10bcd9c..7120bc7 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 _0x87d9=['STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1a57af,_0x1fb1f1){var _0x538b3c=function(_0x21537d){while(--_0x21537d){_0x1a57af['push'](_0x1a57af['shift']());}};_0x538b3c(++_0x1fb1f1);}(_0x87d9,0x143));var _0x987d=function(_0x39b9b3,_0x3e9a66){_0x39b9b3=_0x39b9b3-0x0;var _0x4977c8=_0x87d9[_0x39b9b3];return _0x4977c8;};'use strict';var Sequelize=require(_0x987d('0x0'));module['exports']={'body':{'type':Sequelize[_0x987d('0x1')](_0x987d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x987d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x987d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x987d('0x4')]('in','out'),'defaultValue':_0x987d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x987d('0x6')]},'providerResponse':{'type':Sequelize[_0x987d('0x1')]}}; \ No newline at end of file +var _0x9e0d=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x372004,_0x503f88){_0x372004=_0x372004-0x0;var _0x213de1=_0x9e0d[_0x372004];return _0x213de1;};'use strict';var Sequelize=require(_0xd9e0('0x0'));module[_0xd9e0('0x1')]={'body':{'type':Sequelize[_0xd9e0('0x2')](_0xd9e0('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd9e0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9e0('0x5')]('in',_0xd9e0('0x6')),'defaultValue':_0xd9e0('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9e0('0x7')]},'providerName':{'type':Sequelize[_0xd9e0('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d0ba464..2ba8aef 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 _0xaf93=['../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','offset','undefined','limit','count','json','apply','reject','destroy','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','show','params','keys','merge','options','find','create','body','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','update','isNil','read1stAt','interaction','role','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util'];(function(_0x47a0cc,_0x51c40d){var _0x1c5f01=function(_0x575e70){while(--_0x575e70){_0x47a0cc['push'](_0x47a0cc['shift']());}};_0x1c5f01(++_0x51c40d);}(_0xaf93,0x16d));var _0x3af9=function(_0x844048,_0x174a1c){_0x844048=_0x844048-0x0;var _0x1686e7=_0xaf93[_0x844048];return _0x1686e7;};'use strict';var emlformat=require(_0x3af9('0x0'));var rimraf=require(_0x3af9('0x1'));var zipdir=require(_0x3af9('0x2'));var jsonpatch=require(_0x3af9('0x3'));var rp=require(_0x3af9('0x4'));var moment=require(_0x3af9('0x5'));var BPromise=require(_0x3af9('0x6'));var Mustache=require(_0x3af9('0x7'));var util=require(_0x3af9('0x8'));var path=require('path');var sox=require(_0x3af9('0x9'));var csv=require(_0x3af9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3af9('0xb'));var _=require(_0x3af9('0xc'));var squel=require('squel');var crypto=require(_0x3af9('0xd'));var jsforce=require(_0x3af9('0xe'));var deskjs=require(_0x3af9('0xf'));var toCsv=require(_0x3af9('0xa'));var querystring=require('querystring');var Papa=require(_0x3af9('0x10'));var Redis=require(_0x3af9('0x11'));var authService=require(_0x3af9('0x12'));var qs=require(_0x3af9('0x13'));var as=require(_0x3af9('0x14'));var hardwareService=require(_0x3af9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3af9('0x16'));var config=require(_0x3af9('0x17'));var licenseUtil=require(_0x3af9('0x18'));var db=require(_0x3af9('0x19'))['db'];config[_0x3af9('0x1a')]=_[_0x3af9('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3af9('0x1c'))(new Redis(config[_0x3af9('0x1a')]));require(_0x3af9('0x1d'))['register'](socket);var jayson=require(_0x3af9('0x1e'));var client=jayson[_0x3af9('0x1f')][_0x3af9('0x20')]({'port':0x232c});var client9002=jayson[_0x3af9('0x1f')][_0x3af9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xf12185,_0xd28480,_0x118a87,_0x5d981d){return new BPromise(function(_0xd58173,_0x3bcbfb){var _0x4f66ef=_0x5d981d||client;return _0x4f66ef[_0x3af9('0x21')](_0xf12185,_0x118a87)[_0x3af9('0x22')](function(_0x32c23e){logger['info'](_0x3af9('0x23'),_0xd28480,_0x3af9('0x24'));logger['debug'](_0x3af9('0x25'),_0xd28480,_0x3af9('0x24'),JSON[_0x3af9('0x26')](_0x32c23e));if(_0x32c23e[_0x3af9('0x27')]){if(_0x32c23e[_0x3af9('0x27')][_0x3af9('0x28')]===0x1f4){logger[_0x3af9('0x27')](_0x3af9('0x23'),_0xd28480,_0x32c23e[_0x3af9('0x27')][_0x3af9('0x29')]);return _0x3bcbfb(_0x32c23e[_0x3af9('0x27')][_0x3af9('0x29')]);}logger[_0x3af9('0x27')](_0x3af9('0x23'),_0xd28480,_0x32c23e['error']['message']);return _0xd58173(_0x32c23e['error'][_0x3af9('0x29')]);}else{logger[_0x3af9('0x2a')](_0x3af9('0x23'),_0xd28480,_0x3af9('0x24'));_0xd58173(_0x32c23e['result']['message']);}})[_0x3af9('0x2b')](function(_0x412623){logger[_0x3af9('0x27')](_0x3af9('0x23'),_0xd28480,_0x412623);_0x3bcbfb(_0x412623);});});}function respondWithStatusCode(_0x3c820f,_0x273eca){_0x273eca=_0x273eca||0xcc;return function(_0x4a4585){if(_0x4a4585){return _0x3c820f['sendStatus'](_0x273eca);}return _0x3c820f['status'](_0x273eca)['end']();};}function respondWithResult(_0x4f644f,_0x5e8a98){_0x5e8a98=_0x5e8a98||0xc8;return function(_0x2687e3){if(_0x2687e3){return _0x4f644f[_0x3af9('0x2c')](_0x5e8a98)['json'](_0x2687e3);}};}function respondWithFilteredResult(_0x3719ee,_0x26f7b4){return function(_0x236cf9){if(_0x236cf9){var _0x132903=typeof _0x26f7b4[_0x3af9('0x2d')]===_0x3af9('0x2e')&&typeof _0x26f7b4[_0x3af9('0x2f')]===_0x3af9('0x2e');var _0x45151d=_0x236cf9[_0x3af9('0x30')];var _0x5d6df9=_0x132903?0x0:_0x26f7b4[_0x3af9('0x2d')];var _0x1364f1=_0x132903?_0x236cf9['count']:_0x26f7b4[_0x3af9('0x2d')]+_0x26f7b4[_0x3af9('0x2f')];var _0x41a04e;if(_0x1364f1>=_0x45151d){_0x1364f1=_0x45151d;_0x41a04e=0xc8;}else{_0x41a04e=0xce;}_0x3719ee[_0x3af9('0x2c')](_0x41a04e);return _0x3719ee['set']('Content-Range',_0x5d6df9+'-'+_0x1364f1+'/'+_0x45151d)[_0x3af9('0x31')](_0x236cf9);}return null;};}function patchUpdates(_0x288495){return function(_0x1a3bd2){try{jsonpatch[_0x3af9('0x32')](_0x1a3bd2,_0x288495,!![]);}catch(_0x43fe44){return BPromise[_0x3af9('0x33')](_0x43fe44);}return _0x1a3bd2['save']();};}function saveUpdates(_0x32a914,_0x53b7c8){return function(_0x4e8d64){if(_0x4e8d64){return _0x4e8d64['update'](_0x32a914)[_0x3af9('0x22')](function(_0x467a25){return _0x467a25;});}return null;};}function removeEntity(_0x42e69e,_0x5e224e){return function(_0x245333){if(_0x245333){return _0x245333[_0x3af9('0x34')]()['then'](function(){_0x42e69e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a51a,_0x878786){return function(_0x1b3778){if(!_0x1b3778){_0x23a51a[_0x3af9('0x35')](0x194);}return _0x1b3778;};}function handleError(_0x4ea849,_0x437a03){_0x437a03=_0x437a03||0x1f4;return function(_0x399d65){logger['error'](_0x399d65[_0x3af9('0x36')]);if(_0x399d65[_0x3af9('0x37')]){delete _0x399d65['name'];}_0x4ea849[_0x3af9('0x2c')](_0x437a03)[_0x3af9('0x38')](_0x399d65);};}exports['index']=function(_0x2f23ca,_0x1a103d){var _0x33c0ae={},_0x30389d={},_0x3ef95d={'count':0x0,'rows':[]};var _0x1f4457=_[_0x3af9('0x39')](db[_0x3af9('0x3a')][_0x3af9('0x3b')],function(_0x431463){return{'name':_0x431463[_0x3af9('0x3c')],'type':_0x431463[_0x3af9('0x3d')][_0x3af9('0x3e')]};});_0x30389d['model']=_[_0x3af9('0x39')](_0x1f4457,_0x3af9('0x37'));_0x30389d[_0x3af9('0x3f')]=_['keys'](_0x2f23ca[_0x3af9('0x3f')]);_0x30389d['filters']=_[_0x3af9('0x40')](_0x30389d[_0x3af9('0x41')],_0x30389d['query']);_0x33c0ae['attributes']=_['intersection'](_0x30389d['model'],qs['fields'](_0x2f23ca[_0x3af9('0x3f')][_0x3af9('0x42')]));_0x33c0ae[_0x3af9('0x43')]=_0x33c0ae[_0x3af9('0x43')][_0x3af9('0x44')]?_0x33c0ae[_0x3af9('0x43')]:_0x30389d['model'];if(!_0x2f23ca[_0x3af9('0x3f')][_0x3af9('0x45')](_0x3af9('0x46'))){_0x33c0ae['limit']=qs[_0x3af9('0x2f')](_0x2f23ca['query']['limit']);_0x33c0ae[_0x3af9('0x2d')]=qs[_0x3af9('0x2d')](_0x2f23ca[_0x3af9('0x3f')][_0x3af9('0x2d')]);}_0x33c0ae[_0x3af9('0x47')]=qs[_0x3af9('0x48')](_0x2f23ca[_0x3af9('0x3f')][_0x3af9('0x48')]);_0x33c0ae[_0x3af9('0x49')]=qs[_0x3af9('0x4a')](_['pick'](_0x2f23ca['query'],_0x30389d[_0x3af9('0x4a')]),_0x1f4457);if(_0x2f23ca['query'][_0x3af9('0x4b')]){_0x33c0ae[_0x3af9('0x49')]=_['merge'](_0x33c0ae['where'],{'$or':_[_0x3af9('0x39')](_0x1f4457,function(_0x23e288){if(_0x23e288[_0x3af9('0x3d')]!==_0x3af9('0x4c')){var _0x19d508={};_0x19d508[_0x23e288[_0x3af9('0x37')]]={'$like':'%'+_0x2f23ca[_0x3af9('0x3f')][_0x3af9('0x4b')]+'%'};return _0x19d508;}})});}_0x33c0ae=_['merge']({},_0x33c0ae,_0x2f23ca['options']);var _0x4fe010={'where':_0x33c0ae[_0x3af9('0x49')]};return db[_0x3af9('0x3a')][_0x3af9('0x30')](_0x4fe010)[_0x3af9('0x22')](function(_0x3a9dbc){_0x3ef95d[_0x3af9('0x30')]=_0x3a9dbc;if(_0x2f23ca['query'][_0x3af9('0x4d')]){_0x33c0ae[_0x3af9('0x4e')]=[{'all':!![]}];}return db[_0x3af9('0x3a')][_0x3af9('0x4f')](_0x33c0ae);})[_0x3af9('0x22')](function(_0x7d991c){_0x3ef95d['rows']=_0x7d991c;return _0x3ef95d;})[_0x3af9('0x22')](respondWithFilteredResult(_0x1a103d,_0x33c0ae))['catch'](handleError(_0x1a103d,null));};exports[_0x3af9('0x50')]=function(_0x5da1b5,_0x29e4a9){var _0x51c2b8={'raw':!![],'where':{'id':_0x5da1b5[_0x3af9('0x51')]['id']}},_0x531f4d={};_0x531f4d[_0x3af9('0x41')]=_[_0x3af9('0x52')](db[_0x3af9('0x3a')]['rawAttributes']);_0x531f4d[_0x3af9('0x3f')]=_['keys'](_0x5da1b5[_0x3af9('0x3f')]);_0x531f4d['filters']=_['intersection'](_0x531f4d['model'],_0x531f4d[_0x3af9('0x3f')]);_0x51c2b8[_0x3af9('0x43')]=_[_0x3af9('0x40')](_0x531f4d[_0x3af9('0x41')],qs['fields'](_0x5da1b5[_0x3af9('0x3f')][_0x3af9('0x42')]));_0x51c2b8['attributes']=_0x51c2b8[_0x3af9('0x43')][_0x3af9('0x44')]?_0x51c2b8[_0x3af9('0x43')]:_0x531f4d['model'];if(_0x5da1b5[_0x3af9('0x3f')][_0x3af9('0x4d')]){_0x51c2b8['include']=[{'all':!![]}];}_0x51c2b8=_[_0x3af9('0x53')]({},_0x51c2b8,_0x5da1b5[_0x3af9('0x54')]);return db[_0x3af9('0x3a')][_0x3af9('0x55')](_0x51c2b8)[_0x3af9('0x22')](handleEntityNotFound(_0x29e4a9,null))[_0x3af9('0x22')](respondWithResult(_0x29e4a9,null))[_0x3af9('0x2b')](handleError(_0x29e4a9,null));};exports['create']=function(_0x44c776,_0x564b48){return db[_0x3af9('0x3a')][_0x3af9('0x56')](_0x44c776[_0x3af9('0x57')],{})['then'](respondWithResult(_0x564b48,0xc9))[_0x3af9('0x2b')](handleError(_0x564b48,null));};exports['update']=function(_0x343026,_0x3270b9){if(_0x343026[_0x3af9('0x57')]['id']){delete _0x343026[_0x3af9('0x57')]['id'];}return db[_0x3af9('0x3a')]['find']({'where':{'id':_0x343026[_0x3af9('0x51')]['id']}})[_0x3af9('0x22')](handleEntityNotFound(_0x3270b9,null))['then'](saveUpdates(_0x343026[_0x3af9('0x57')],null))[_0x3af9('0x22')](respondWithResult(_0x3270b9,null))[_0x3af9('0x2b')](handleError(_0x3270b9,null));};exports[_0x3af9('0x34')]=function(_0x1be169,_0x54a205){return db[_0x3af9('0x3a')][_0x3af9('0x55')]({'where':{'id':_0x1be169['params']['id']}})[_0x3af9('0x22')](handleEntityNotFound(_0x54a205,null))['then'](removeEntity(_0x54a205,null))[_0x3af9('0x2b')](handleError(_0x54a205,null));};exports['describe']=function(_0x38a3b3,_0x2d8cba){return db[_0x3af9('0x3a')]['describe']()['then'](respondWithResult(_0x2d8cba,null))[_0x3af9('0x2b')](handleError(_0x2d8cba,null));};var interaction_log=require('../../config/logger')(_0x3af9('0x58'));exports['accept']=function(_0x432053,_0x5391b,_0xf1cbfe){var _0x38c3a0={'agent':{},'channel':_0x3af9('0x59')};if(_0x432053[_0x3af9('0x57')]['id']){delete _0x432053[_0x3af9('0x57')]['id'];}_0x432053['body'][_0x3af9('0x5a')]=!![];_0x432053[_0x3af9('0x57')][_0x3af9('0x5b')]=moment()[_0x3af9('0x5c')](_0x3af9('0x5d'));_0x432053[_0x3af9('0x57')]['UserId']=_0x432053['body'][_0x3af9('0x5e')]||_0x432053[_0x3af9('0x5f')]['id'];_0x38c3a0[_0x3af9('0x60')]['id']=_0x432053[_0x3af9('0x57')][_0x3af9('0x5e')];return db['ChatMessage']['find']({'where':{'id':_0x432053['params']['id'],'UserId':null}})[_0x3af9('0x22')](handleEntityNotFound(_0x5391b,null))[_0x3af9('0x22')](saveUpdates(_0x432053[_0x3af9('0x57')],null))['then'](function(_0x54a74e){if(_0x54a74e){_0x38c3a0[_0x3af9('0x29')]=_0x54a74e[_0x3af9('0x61')]({'plain':!![]});return db[_0x3af9('0x62')][_0x3af9('0x55')]({'where':{'id':_0x54a74e[_0x3af9('0x63')]}});}return null;})[_0x3af9('0x22')](handleEntityNotFound(_0x5391b,null))[_0x3af9('0x22')](function(_0x28e02c){if(_0x28e02c){return _0x28e02c[_0x3af9('0x64')]({'UserId':_0x432053[_0x3af9('0x57')][_0x3af9('0x5e')],'read1stAt':_[_0x3af9('0x65')](_0x28e02c[_0x3af9('0x66')])?moment()[_0x3af9('0x5c')](_0x3af9('0x5d')):undefined});}return null;})[_0x3af9('0x22')](function(_0x11acc7){if(_0x11acc7){_0x38c3a0[_0x3af9('0x67')]=_0x11acc7['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x432053[_0x3af9('0x5f')]['id'],_0x432053[_0x3af9('0x5f')]['name'],_0x432053[_0x3af9('0x5f')][_0x3af9('0x68')],_0x38c3a0[_0x3af9('0x67')]['id'],_0x432053[_0x3af9('0x57')]?JSON[_0x3af9('0x26')](_0x432053['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x3af9('0x69'),_0x38c3a0);}return null;})[_0x3af9('0x22')](function(_0x2e473){var _0x499678='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e473[_0x3af9('0x29')]['ContactId'];return db[_0x3af9('0x6a')][_0x3af9('0x3f')](_0x499678,{'type':db[_0x3af9('0x6b')][_0x3af9('0x6c')][_0x3af9('0x6d')],'raw':!![]})[_0x3af9('0x22')](function(_0x58d4d5){return _0x58d4d5;});})[_0x3af9('0x22')](function(_0x5bb083){if(_0x5bb083){_0x38c3a0[_0x3af9('0x29')][_0x3af9('0x6e')]=_0x5bb083[0x0];if(!_0x432053[_0x3af9('0x57')][_0x3af9('0x5e')])return;return db['User'][_0x3af9('0x55')]({'where':{'id':_0x432053['body'][_0x3af9('0x5e')],'role':_0x3af9('0x60')},'attributes':['id',_0x3af9('0x37'),_0x3af9('0x6f'),_0x3af9('0x70'),_0x3af9('0x71')],'raw':!![]});}return null;})[_0x3af9('0x22')](function(_0x25b96d){if(!_0x25b96d)return null;_0x38c3a0[_0x3af9('0x29')]['agent']=_0x25b96d;return _0x38c3a0;})[_0x3af9('0x22')](function(_0x291358){if(_0x291358){if(_0x432053['body'][_0x3af9('0x72')]){_0x38c3a0[_0x3af9('0x29')][_0x3af9('0x73')]=util[_0x3af9('0x5c')](_0x3af9('0x74'),_0x432053[_0x3af9('0x5f')][_0x3af9('0x37')]);_0x38c3a0[_0x3af9('0x29')][_0x3af9('0x75')]=_0x38c3a0[_0x3af9('0x75')];_0x38c3a0[_0x3af9('0x29')][_0x3af9('0x76')]=_0x38c3a0[_0x3af9('0x75')];_0x38c3a0[_0x3af9('0x29')][_0x3af9('0x77')]=_0x3af9('0x78');return respondWithRpcPromise(_0x3af9('0x79'),_0x3af9('0x79'),{'event':'acceptmessage','message':_[_0x3af9('0x53')](_0x38c3a0['message'],JSON[_0x3af9('0x7a')](_0x38c3a0['interaction'][_0x3af9('0x7b')]))},client9002)[_0x3af9('0x22')](function(){return _0x38c3a0;});}return _0x38c3a0;}return null;})['then'](respondWithResult(_0x5391b,null))['catch'](handleError(_0x5391b,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x3af9('0x33')]=function(_0x2bdeea,_0x4fdf23,_0x22b94a){var _0x4f552b={'agent':{},'channel':'chat'};if(_0x2bdeea[_0x3af9('0x57')]['id']){delete _0x2bdeea[_0x3af9('0x57')]['id'];}_0x2bdeea[_0x3af9('0x57')][_0x3af9('0x5e')]=_0x2bdeea[_0x3af9('0x57')]['UserId']||_0x2bdeea[_0x3af9('0x5f')]['id'];_0x4f552b[_0x3af9('0x60')]['id']=_0x2bdeea['body']['UserId'];return db[_0x3af9('0x3a')][_0x3af9('0x55')]({'where':{'id':_0x2bdeea['params']['id'],'UserId':null}})[_0x3af9('0x22')](handleEntityNotFound(_0x4fdf23,null))['then'](function(_0x31e08e){if(_0x31e08e){_0x4f552b['message']=_0x31e08e[_0x3af9('0x61')]({'plain':!![]});return db[_0x3af9('0x62')][_0x3af9('0x55')]({'where':{'id':_0x31e08e[_0x3af9('0x63')]}});}return null;})[_0x3af9('0x22')](handleEntityNotFound(_0x4fdf23,null))[_0x3af9('0x22')](function(_0x3fd7d4){if(_0x3fd7d4){_0x4f552b['interaction']=_0x3fd7d4[_0x3af9('0x61')]({'plain':!![]});interaction_log[_0x3af9('0x2a')](_0x3af9('0x7c'),_0x2bdeea[_0x3af9('0x5f')]['id'],_0x2bdeea[_0x3af9('0x5f')][_0x3af9('0x37')],_0x2bdeea['user'][_0x3af9('0x68')],_0x4f552b[_0x3af9('0x67')]['id'],_0x2bdeea['body']?JSON[_0x3af9('0x26')](_0x2bdeea['body']):_0x3af9('0x7d'));return respondWithRpcPromise(_0x3af9('0x7e'),'rejectMessage',_0x4f552b);}return null;})[_0x3af9('0x22')](function(_0x356b6e){var _0x52946e=_0x3af9('0x7f')+_0x356b6e[_0x3af9('0x29')]['ContactId'];return db['sequelize'][_0x3af9('0x3f')](_0x52946e,{'type':db[_0x3af9('0x6b')][_0x3af9('0x6c')][_0x3af9('0x6d')],'raw':!![]})[_0x3af9('0x22')](function(_0x52706c){return _0x52706c;});})[_0x3af9('0x22')](function(_0x23d834){if(_0x23d834){_0x4f552b[_0x3af9('0x29')][_0x3af9('0x6e')]=_0x23d834[0x0];if(!_0x2bdeea['body']['UserId'])return;return db[_0x3af9('0x80')][_0x3af9('0x55')]({'where':{'id':_0x2bdeea[_0x3af9('0x57')]['UserId'],'role':_0x3af9('0x60')},'attributes':['id',_0x3af9('0x37'),_0x3af9('0x6f'),_0x3af9('0x70'),'internal'],'raw':!![]});}return null;})[_0x3af9('0x22')](function(_0x415312){if(!_0x415312)return null;_0x4f552b['message']['agent']=_0x415312;return _0x4f552b;})[_0x3af9('0x22')](function(_0x4e1eff){if(_0x4e1eff){_0x4e1eff['message'][_0x3af9('0x73')]=util[_0x3af9('0x5c')](_0x3af9('0x74'),_0x2bdeea[_0x3af9('0x5f')][_0x3af9('0x37')]);_0x4e1eff[_0x3af9('0x29')][_0x3af9('0x75')]=_0x4f552b[_0x3af9('0x75')];_0x4e1eff[_0x3af9('0x29')][_0x3af9('0x76')]=_0x4f552b[_0x3af9('0x75')];_0x4e1eff[_0x3af9('0x29')]['event']=_0x3af9('0x33');respondWithRpcPromise(_0x3af9('0x79'),'EventManager',{'event':_0x3af9('0x81'),'message':_['merge'](_0x4f552b[_0x3af9('0x29')],JSON[_0x3af9('0x7a')](_0x4f552b[_0x3af9('0x67')]['formData']))},client9002);return _0x4f552b;}return null;})['then'](respondWithResult(_0x4fdf23,null))[_0x3af9('0x2b')](handleError(_0x4fdf23,null));}; \ No newline at end of file +var _0x31d5=['User','fullname','manual','interface','format','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','formData','Sequelize','email','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','ChatMessage','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','merge','find','create','body','update','describe','chat-interactions','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT'];(function(_0x3684b6,_0x3da85e){var _0x39f06b=function(_0x5b4565){while(--_0x5b4565){_0x3684b6['push'](_0x3684b6['shift']());}};_0x39f06b(++_0x3da85e);}(_0x31d5,0x1ab));var _0x531d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x31d5[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x531d('0x0'));var rimraf=require(_0x531d('0x1'));var zipdir=require(_0x531d('0x2'));var jsonpatch=require(_0x531d('0x3'));var rp=require(_0x531d('0x4'));var moment=require(_0x531d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x531d('0x6'));var util=require(_0x531d('0x7'));var path=require(_0x531d('0x8'));var sox=require(_0x531d('0x9'));var csv=require('to-csv');var ejs=require(_0x531d('0xa'));var fs=require('fs');var fs_extra=require(_0x531d('0xb'));var _=require(_0x531d('0xc'));var squel=require('squel');var crypto=require(_0x531d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x531d('0xe'));var toCsv=require(_0x531d('0xf'));var querystring=require(_0x531d('0x10'));var Papa=require('papaparse');var Redis=require(_0x531d('0x11'));var authService=require(_0x531d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x531d('0x13'));var hardwareService=require(_0x531d('0x14'));var logger=require(_0x531d('0x15'))(_0x531d('0x16'));var utils=require(_0x531d('0x17'));var config=require(_0x531d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x531d('0x19')]=_[_0x531d('0x1a')](config['redis'],{'host':_0x531d('0x1b'),'port':0x18eb});var socket=require(_0x531d('0x1c'))(new Redis(config[_0x531d('0x19')]));require(_0x531d('0x1d'))[_0x531d('0x1e')](socket);var jayson=require(_0x531d('0x1f'));var client=jayson[_0x531d('0x20')][_0x531d('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x531d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1a194a,_0x1862cf,_0x32386d,_0x52f491){return new BPromise(function(_0x1302e0,_0x36ea8c){var _0x3a73f4=_0x52f491||client;return _0x3a73f4[_0x531d('0x22')](_0x1a194a,_0x32386d)['then'](function(_0x468fde){logger[_0x531d('0x23')](_0x531d('0x24'),_0x1862cf,'request\x20sent');logger[_0x531d('0x25')](_0x531d('0x26'),_0x1862cf,_0x531d('0x27'),JSON[_0x531d('0x28')](_0x468fde));if(_0x468fde[_0x531d('0x29')]){if(_0x468fde[_0x531d('0x29')][_0x531d('0x2a')]===0x1f4){logger['error'](_0x531d('0x24'),_0x1862cf,_0x468fde['error'][_0x531d('0x2b')]);return _0x36ea8c(_0x468fde[_0x531d('0x29')][_0x531d('0x2b')]);}logger['error'](_0x531d('0x24'),_0x1862cf,_0x468fde[_0x531d('0x29')][_0x531d('0x2b')]);return _0x1302e0(_0x468fde[_0x531d('0x29')][_0x531d('0x2b')]);}else{logger[_0x531d('0x23')](_0x531d('0x24'),_0x1862cf,_0x531d('0x27'));_0x1302e0(_0x468fde[_0x531d('0x2c')]['message']);}})[_0x531d('0x2d')](function(_0x2239ac){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1862cf,_0x2239ac);_0x36ea8c(_0x2239ac);});});}function respondWithStatusCode(_0x205fee,_0x2bb346){_0x2bb346=_0x2bb346||0xcc;return function(_0x582f4a){if(_0x582f4a){return _0x205fee['sendStatus'](_0x2bb346);}return _0x205fee[_0x531d('0x2e')](_0x2bb346)[_0x531d('0x2f')]();};}function respondWithResult(_0x548f22,_0x3c6456){_0x3c6456=_0x3c6456||0xc8;return function(_0x38a65b){if(_0x38a65b){return _0x548f22[_0x531d('0x2e')](_0x3c6456)[_0x531d('0x30')](_0x38a65b);}};}function respondWithFilteredResult(_0x436b96,_0x632efb){return function(_0x36e9f9){if(_0x36e9f9){var _0x28085a=typeof _0x632efb['offset']===_0x531d('0x31')&&typeof _0x632efb[_0x531d('0x32')]===_0x531d('0x31');var _0x4eb7f2=_0x36e9f9[_0x531d('0x33')];var _0x103adc=_0x28085a?0x0:_0x632efb[_0x531d('0x34')];var _0x2de0ed=_0x28085a?_0x36e9f9[_0x531d('0x33')]:_0x632efb[_0x531d('0x34')]+_0x632efb[_0x531d('0x32')];var _0x236eff;if(_0x2de0ed>=_0x4eb7f2){_0x2de0ed=_0x4eb7f2;_0x236eff=0xc8;}else{_0x236eff=0xce;}_0x436b96['status'](_0x236eff);return _0x436b96[_0x531d('0x35')](_0x531d('0x36'),_0x103adc+'-'+_0x2de0ed+'/'+_0x4eb7f2)['json'](_0x36e9f9);}return null;};}function patchUpdates(_0x1491c3){return function(_0xe2b6e){try{jsonpatch[_0x531d('0x37')](_0xe2b6e,_0x1491c3,!![]);}catch(_0x24cf89){return BPromise[_0x531d('0x38')](_0x24cf89);}return _0xe2b6e[_0x531d('0x39')]();};}function saveUpdates(_0xc9554e,_0x25ded4){return function(_0x4e17d1){if(_0x4e17d1){return _0x4e17d1['update'](_0xc9554e)[_0x531d('0x3a')](function(_0x3462b6){return _0x3462b6;});}return null;};}function removeEntity(_0x36e00d,_0x38e8f1){return function(_0x11ab14){if(_0x11ab14){return _0x11ab14[_0x531d('0x3b')]()[_0x531d('0x3a')](function(){_0x36e00d[_0x531d('0x2e')](0xcc)[_0x531d('0x2f')]();});}};}function handleEntityNotFound(_0x4d5743,_0x5227fd){return function(_0x198ffb){if(!_0x198ffb){_0x4d5743[_0x531d('0x3c')](0x194);}return _0x198ffb;};}function handleError(_0x1eadcb,_0x3e5999){_0x3e5999=_0x3e5999||0x1f4;return function(_0x1f518f){logger[_0x531d('0x29')](_0x1f518f[_0x531d('0x3d')]);if(_0x1f518f[_0x531d('0x3e')]){delete _0x1f518f[_0x531d('0x3e')];}_0x1eadcb['status'](_0x3e5999)[_0x531d('0x3f')](_0x1f518f);};}exports[_0x531d('0x40')]=function(_0x5e83a5,_0x36cd56){var _0x15b3e5={},_0x20fac9={},_0x485871={'count':0x0,'rows':[]};var _0x244303=_['map'](db[_0x531d('0x41')]['rawAttributes'],function(_0xd53f1d){return{'name':_0xd53f1d[_0x531d('0x42')],'type':_0xd53f1d[_0x531d('0x43')][_0x531d('0x44')]};});_0x20fac9[_0x531d('0x45')]=_[_0x531d('0x46')](_0x244303,_0x531d('0x3e'));_0x20fac9[_0x531d('0x47')]=_[_0x531d('0x48')](_0x5e83a5[_0x531d('0x47')]);_0x20fac9[_0x531d('0x49')]=_['intersection'](_0x20fac9['model'],_0x20fac9[_0x531d('0x47')]);_0x15b3e5[_0x531d('0x4a')]=_[_0x531d('0x4b')](_0x20fac9[_0x531d('0x45')],qs['fields'](_0x5e83a5['query'][_0x531d('0x4c')]));_0x15b3e5['attributes']=_0x15b3e5[_0x531d('0x4a')][_0x531d('0x4d')]?_0x15b3e5['attributes']:_0x20fac9[_0x531d('0x45')];if(!_0x5e83a5[_0x531d('0x47')][_0x531d('0x4e')](_0x531d('0x4f'))){_0x15b3e5[_0x531d('0x32')]=qs[_0x531d('0x32')](_0x5e83a5[_0x531d('0x47')][_0x531d('0x32')]);_0x15b3e5[_0x531d('0x34')]=qs[_0x531d('0x34')](_0x5e83a5[_0x531d('0x47')][_0x531d('0x34')]);}_0x15b3e5[_0x531d('0x50')]=qs['sort'](_0x5e83a5[_0x531d('0x47')][_0x531d('0x51')]);_0x15b3e5[_0x531d('0x52')]=qs[_0x531d('0x49')](_[_0x531d('0x53')](_0x5e83a5[_0x531d('0x47')],_0x20fac9['filters']),_0x244303);if(_0x5e83a5[_0x531d('0x47')][_0x531d('0x54')]){_0x15b3e5[_0x531d('0x52')]=_['merge'](_0x15b3e5['where'],{'$or':_[_0x531d('0x46')](_0x244303,function(_0x4a146f){if(_0x4a146f[_0x531d('0x43')]!==_0x531d('0x55')){var _0x5ccdd9={};_0x5ccdd9[_0x4a146f[_0x531d('0x3e')]]={'$like':'%'+_0x5e83a5[_0x531d('0x47')][_0x531d('0x54')]+'%'};return _0x5ccdd9;}})});}_0x15b3e5=_['merge']({},_0x15b3e5,_0x5e83a5[_0x531d('0x56')]);var _0xce549c={'where':_0x15b3e5['where']};return db[_0x531d('0x41')][_0x531d('0x33')](_0xce549c)[_0x531d('0x3a')](function(_0x4ce359){_0x485871['count']=_0x4ce359;if(_0x5e83a5[_0x531d('0x47')][_0x531d('0x57')]){_0x15b3e5[_0x531d('0x58')]=[{'all':!![]}];}return db[_0x531d('0x41')][_0x531d('0x59')](_0x15b3e5);})[_0x531d('0x3a')](function(_0x4d62fe){_0x485871['rows']=_0x4d62fe;return _0x485871;})[_0x531d('0x3a')](respondWithFilteredResult(_0x36cd56,_0x15b3e5))[_0x531d('0x2d')](handleError(_0x36cd56,null));};exports[_0x531d('0x5a')]=function(_0x335def,_0x25c1d1){var _0x216581={'raw':!![],'where':{'id':_0x335def[_0x531d('0x5b')]['id']}},_0x24a049={};_0x24a049[_0x531d('0x45')]=_[_0x531d('0x48')](db[_0x531d('0x41')]['rawAttributes']);_0x24a049['query']=_[_0x531d('0x48')](_0x335def[_0x531d('0x47')]);_0x24a049[_0x531d('0x49')]=_[_0x531d('0x4b')](_0x24a049[_0x531d('0x45')],_0x24a049['query']);_0x216581['attributes']=_[_0x531d('0x4b')](_0x24a049['model'],qs[_0x531d('0x4c')](_0x335def[_0x531d('0x47')][_0x531d('0x4c')]));_0x216581[_0x531d('0x4a')]=_0x216581['attributes'][_0x531d('0x4d')]?_0x216581[_0x531d('0x4a')]:_0x24a049[_0x531d('0x45')];if(_0x335def['query'][_0x531d('0x57')]){_0x216581['include']=[{'all':!![]}];}_0x216581=_[_0x531d('0x5c')]({},_0x216581,_0x335def['options']);return db['ChatMessage'][_0x531d('0x5d')](_0x216581)[_0x531d('0x3a')](handleEntityNotFound(_0x25c1d1,null))['then'](respondWithResult(_0x25c1d1,null))[_0x531d('0x2d')](handleError(_0x25c1d1,null));};exports[_0x531d('0x5e')]=function(_0x51a119,_0xc09bfe){return db['ChatMessage'][_0x531d('0x5e')](_0x51a119[_0x531d('0x5f')],{})[_0x531d('0x3a')](respondWithResult(_0xc09bfe,0xc9))[_0x531d('0x2d')](handleError(_0xc09bfe,null));};exports[_0x531d('0x60')]=function(_0x1981d0,_0x1ee0c1){if(_0x1981d0[_0x531d('0x5f')]['id']){delete _0x1981d0[_0x531d('0x5f')]['id'];}return db[_0x531d('0x41')][_0x531d('0x5d')]({'where':{'id':_0x1981d0[_0x531d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1ee0c1,null))[_0x531d('0x3a')](saveUpdates(_0x1981d0['body'],null))['then'](respondWithResult(_0x1ee0c1,null))[_0x531d('0x2d')](handleError(_0x1ee0c1,null));};exports[_0x531d('0x3b')]=function(_0x370604,_0x110068){return db['ChatMessage'][_0x531d('0x5d')]({'where':{'id':_0x370604['params']['id']}})[_0x531d('0x3a')](handleEntityNotFound(_0x110068,null))['then'](removeEntity(_0x110068,null))[_0x531d('0x2d')](handleError(_0x110068,null));};exports[_0x531d('0x61')]=function(_0x453391,_0x120982){return db[_0x531d('0x41')]['describe']()['then'](respondWithResult(_0x120982,null))[_0x531d('0x2d')](handleError(_0x120982,null));};var interaction_log=require(_0x531d('0x15'))(_0x531d('0x62'));exports['accept']=function(_0x3f97e5,_0x41b6cf,_0x58a56c){var _0x43089b={'agent':{},'channel':_0x531d('0x63')};if(_0x3f97e5['body']['id']){delete _0x3f97e5[_0x531d('0x5f')]['id'];}_0x3f97e5[_0x531d('0x5f')][_0x531d('0x64')]=!![];_0x3f97e5[_0x531d('0x5f')][_0x531d('0x65')]=moment()['format'](_0x531d('0x66'));_0x3f97e5[_0x531d('0x5f')]['UserId']=_0x3f97e5[_0x531d('0x5f')][_0x531d('0x67')]||_0x3f97e5[_0x531d('0x68')]['id'];_0x43089b[_0x531d('0x69')]['id']=_0x3f97e5[_0x531d('0x5f')][_0x531d('0x67')];return db['ChatMessage'][_0x531d('0x5d')]({'where':{'id':_0x3f97e5['params']['id'],'UserId':null}})[_0x531d('0x3a')](handleEntityNotFound(_0x41b6cf,null))[_0x531d('0x3a')](saveUpdates(_0x3f97e5[_0x531d('0x5f')],null))[_0x531d('0x3a')](function(_0x407fb8){if(_0x407fb8){_0x43089b[_0x531d('0x2b')]=_0x407fb8[_0x531d('0x6a')]({'plain':!![]});return db[_0x531d('0x6b')][_0x531d('0x5d')]({'where':{'id':_0x407fb8[_0x531d('0x6c')]}});}return null;})[_0x531d('0x3a')](handleEntityNotFound(_0x41b6cf,null))[_0x531d('0x3a')](function(_0x439607){if(_0x439607){return _0x439607[_0x531d('0x60')]({'UserId':_0x3f97e5['body'][_0x531d('0x67')],'read1stAt':_[_0x531d('0x6d')](_0x439607[_0x531d('0x6e')])?moment()['format'](_0x531d('0x66')):undefined});}return null;})[_0x531d('0x3a')](function(_0x2bc8a0){if(_0x2bc8a0){_0x43089b[_0x531d('0x6f')]=_0x2bc8a0[_0x531d('0x6a')]({'plain':!![]});interaction_log[_0x531d('0x23')](_0x531d('0x70'),_0x3f97e5[_0x531d('0x68')]['id'],_0x3f97e5[_0x531d('0x68')][_0x531d('0x3e')],_0x3f97e5['user'][_0x531d('0x71')],_0x43089b[_0x531d('0x6f')]['id'],_0x3f97e5[_0x531d('0x5f')]?JSON[_0x531d('0x28')](_0x3f97e5['body']):_0x531d('0x72'));return respondWithRpcPromise(_0x531d('0x73'),_0x531d('0x74'),_0x43089b);}return null;})[_0x531d('0x3a')](function(_0x468741){var _0xf99428='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x468741[_0x531d('0x2b')][_0x531d('0x75')];return db[_0x531d('0x76')][_0x531d('0x47')](_0xf99428,{'type':db['Sequelize'][_0x531d('0x77')][_0x531d('0x78')],'raw':!![]})[_0x531d('0x3a')](function(_0x15cc93){return _0x15cc93;});})[_0x531d('0x3a')](function(_0x28a57e){if(_0x28a57e){_0x43089b[_0x531d('0x2b')]['contact']=_0x28a57e[0x0];if(!_0x3f97e5['body'][_0x531d('0x67')])return;return db[_0x531d('0x79')][_0x531d('0x5d')]({'where':{'id':_0x3f97e5[_0x531d('0x5f')][_0x531d('0x67')],'role':_0x531d('0x69')},'attributes':['id',_0x531d('0x3e'),_0x531d('0x7a'),'email','internal'],'raw':!![]});}return null;})[_0x531d('0x3a')](function(_0x343488){if(!_0x343488)return null;_0x43089b['message'][_0x531d('0x69')]=_0x343488;return _0x43089b;})['then'](function(_0x532586){if(_0x532586){if(_0x3f97e5[_0x531d('0x5f')][_0x531d('0x7b')]){_0x43089b[_0x531d('0x2b')][_0x531d('0x7c')]=util[_0x531d('0x7d')](_0x531d('0x7e'),_0x3f97e5[_0x531d('0x68')][_0x531d('0x3e')]);_0x43089b[_0x531d('0x2b')]['channel']=_0x43089b[_0x531d('0x7f')];_0x43089b[_0x531d('0x2b')][_0x531d('0x80')]=_0x43089b[_0x531d('0x7f')];_0x43089b['message'][_0x531d('0x81')]=_0x531d('0x82');return respondWithRpcPromise('EventManager',_0x531d('0x83'),{'event':_0x531d('0x84'),'message':_['merge'](_0x43089b['message'],JSON['parse'](_0x43089b[_0x531d('0x6f')][_0x531d('0x85')]))},client9002)['then'](function(){return _0x43089b;});}return _0x43089b;}return null;})[_0x531d('0x3a')](respondWithResult(_0x41b6cf,null))[_0x531d('0x2d')](handleError(_0x41b6cf,null));};var interaction_log=require(_0x531d('0x15'))('chat-interactions');exports[_0x531d('0x38')]=function(_0xe4585a,_0x3c9aa6,_0x29c6db){var _0x536d45={'agent':{},'channel':'chat'};if(_0xe4585a[_0x531d('0x5f')]['id']){delete _0xe4585a[_0x531d('0x5f')]['id'];}_0xe4585a[_0x531d('0x5f')][_0x531d('0x67')]=_0xe4585a[_0x531d('0x5f')][_0x531d('0x67')]||_0xe4585a[_0x531d('0x68')]['id'];_0x536d45[_0x531d('0x69')]['id']=_0xe4585a[_0x531d('0x5f')][_0x531d('0x67')];return db[_0x531d('0x41')][_0x531d('0x5d')]({'where':{'id':_0xe4585a[_0x531d('0x5b')]['id'],'UserId':null}})[_0x531d('0x3a')](handleEntityNotFound(_0x3c9aa6,null))[_0x531d('0x3a')](function(_0x3d7cd3){if(_0x3d7cd3){_0x536d45[_0x531d('0x2b')]=_0x3d7cd3[_0x531d('0x6a')]({'plain':!![]});return db[_0x531d('0x6b')][_0x531d('0x5d')]({'where':{'id':_0x3d7cd3['ChatInteractionId']}});}return null;})[_0x531d('0x3a')](handleEntityNotFound(_0x3c9aa6,null))[_0x531d('0x3a')](function(_0x1b4a27){if(_0x1b4a27){_0x536d45[_0x531d('0x6f')]=_0x1b4a27['get']({'plain':!![]});interaction_log[_0x531d('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe4585a[_0x531d('0x68')]['id'],_0xe4585a[_0x531d('0x68')]['name'],_0xe4585a[_0x531d('0x68')][_0x531d('0x71')],_0x536d45['interaction']['id'],_0xe4585a[_0x531d('0x5f')]?JSON['stringify'](_0xe4585a[_0x531d('0x5f')]):_0x531d('0x72'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x536d45);}return null;})[_0x531d('0x3a')](function(_0x426cfc){var _0x5c31b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x426cfc[_0x531d('0x2b')][_0x531d('0x75')];return db[_0x531d('0x76')][_0x531d('0x47')](_0x5c31b6,{'type':db[_0x531d('0x86')][_0x531d('0x77')][_0x531d('0x78')],'raw':!![]})['then'](function(_0x19ec74){return _0x19ec74;});})[_0x531d('0x3a')](function(_0x37218d){if(_0x37218d){_0x536d45[_0x531d('0x2b')]['contact']=_0x37218d[0x0];if(!_0xe4585a[_0x531d('0x5f')][_0x531d('0x67')])return;return db[_0x531d('0x79')][_0x531d('0x5d')]({'where':{'id':_0xe4585a[_0x531d('0x5f')][_0x531d('0x67')],'role':_0x531d('0x69')},'attributes':['id',_0x531d('0x3e'),_0x531d('0x7a'),_0x531d('0x87'),'internal'],'raw':!![]});}return null;})[_0x531d('0x3a')](function(_0x1e1842){if(!_0x1e1842)return null;_0x536d45['message'][_0x531d('0x69')]=_0x1e1842;return _0x536d45;})[_0x531d('0x3a')](function(_0x567129){if(_0x567129){_0x567129[_0x531d('0x2b')][_0x531d('0x7c')]=util[_0x531d('0x7d')](_0x531d('0x7e'),_0xe4585a['user'][_0x531d('0x3e')]);_0x567129[_0x531d('0x2b')][_0x531d('0x7f')]=_0x536d45[_0x531d('0x7f')];_0x567129[_0x531d('0x2b')][_0x531d('0x80')]=_0x536d45[_0x531d('0x7f')];_0x567129[_0x531d('0x2b')]['event']=_0x531d('0x38');respondWithRpcPromise(_0x531d('0x83'),_0x531d('0x83'),{'event':'rejectmessage','message':_[_0x531d('0x5c')](_0x536d45[_0x531d('0x2b')],JSON[_0x531d('0x88')](_0x536d45['interaction'][_0x531d('0x85')]))},client9002);return _0x536d45;}return null;})[_0x531d('0x3a')](respondWithResult(_0x3c9aa6,null))['catch'](handleError(_0x3c9aa6,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3342945..a9d334a 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 _0xb8ec=['exports','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x24d1c8,_0x2e0c6f){var _0x4ec82c=function(_0x100286){while(--_0x100286){_0x24d1c8['push'](_0x24d1c8['shift']());}};_0x4ec82c(++_0x2e0c6f);}(_0xb8ec,0x19b));var _0xcb8e=function(_0x49b06a,_0x1fa4ef){_0x49b06a=_0x49b06a-0x0;var _0x17899d=_0xb8ec[_0x49b06a];return _0x17899d;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcb8e('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb8e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x9bf781){return function(_0x48e757,_0x236ca8,_0x589706){ChatMessageEvents[_0xcb8e('0x2')](_0x9bf781+':'+_0x48e757['id'],_0x48e757);ChatMessageEvents[_0xcb8e('0x2')](_0x9bf781,_0x48e757);_0x589706(null);};}for(var e in events){if(events[_0xcb8e('0x3')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xcb8e('0x4')]=ChatMessageEvents; \ No newline at end of file +var _0xa047=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xa047,0x9f));var _0x7a04=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0xa047[_0x19a49f];return _0x5351ae;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x7a04('0x0'))['db'][_0x7a04('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7a04('0x2')](0x0);var events={'afterCreate':_0x7a04('0x3'),'afterUpdate':'update','afterDestroy':_0x7a04('0x4')};function emitEvent(_0x2c9652){return function(_0x296a0b,_0x405662,_0x51974c){ChatMessageEvents[_0x7a04('0x5')](_0x2c9652+':'+_0x296a0b['id'],_0x296a0b);ChatMessageEvents[_0x7a04('0x5')](_0x2c9652,_0x296a0b);_0x51974c(null);};}for(var e in events){if(events[_0x7a04('0x6')](e)){var event=events[e];ChatMessage[_0x7a04('0x7')](e,emitEvent(event));}}module[_0x7a04('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5c5d53a..3c87724 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 _0xea81=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','direction','toLowerCase','out','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4313b7,_0x48641c){var _0x57dbbe=function(_0x500936){while(--_0x500936){_0x4313b7['push'](_0x4313b7['shift']());}};_0x57dbbe(++_0x48641c);}(_0xea81,0x1ed));var _0x1ea8=function(_0x24c287,_0x3185ec){_0x24c287=_0x24c287-0x0;var _0xefa78d=_0xea81[_0x24c287];return _0xefa78d;};'use strict';var _=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var logger=require(_0x1ea8('0x2'))(_0x1ea8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ea8('0x4'));var fs=require('fs');var path=require(_0x1ea8('0x5'));var rimraf=require(_0x1ea8('0x6'));var config=require(_0x1ea8('0x7'));var attributes=require(_0x1ea8('0x8'));module['exports']=function(_0x486b32,_0x5f4538){return _0x486b32[_0x1ea8('0x9')](_0x1ea8('0xa'),attributes,{'tableName':_0x1ea8('0xb'),'paranoid':![],'indexes':[{'name':_0x1ea8('0xc'),'fields':['body'],'type':_0x1ea8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c48ce,_0x35160b,_0x432447){var _0x495092=_0x486b32['models'];var _0x5be789=_0x2c48ce['get']({'plain':!![]});if(_0x5be789[_0x1ea8('0xe')][_0x1ea8('0xf')]()==='in'||_0x5be789[_0x1ea8('0xe')][_0x1ea8('0xf')]()===_0x1ea8('0x10')&&!_0x5be789['secret']&&!_['isNil'](_0x5be789[_0x1ea8('0x11')])){_0x495092[_0x1ea8('0x12')]['findOne']({'where':{'id':_0x5be789[_0x1ea8('0x13')]}})[_0x1ea8('0x14')](function(_0x97d328){if(_0x97d328){_0x97d328[_0x1ea8('0x15')]({'lastMsgAt':_0x5be789[_0x1ea8('0x16')],'lastMsgDirection':_0x5be789['direction'][_0x1ea8('0xf')]()});}})[_0x1ea8('0x17')](function(_0x3e072d){console['error'](_0x3e072d);});}_0x432447();}},'charset':_0x1ea8('0x18'),'collate':_0x1ea8('0x19')});}; \ No newline at end of file +var _0x323f=['FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x323f,0xde));var _0xf323=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x323f[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require('moment');var BPromise=require(_0xf323('0x2'));var rp=require(_0xf323('0x3'));var fs=require('fs');var path=require(_0xf323('0x4'));var rimraf=require(_0xf323('0x5'));var config=require('../../config/environment');var attributes=require(_0xf323('0x6'));module['exports']=function(_0x3917ae,_0x1d6d5f){return _0x3917ae[_0xf323('0x7')](_0xf323('0x8'),attributes,{'tableName':_0xf323('0x9'),'paranoid':![],'indexes':[{'name':_0xf323('0xa'),'fields':[_0xf323('0xb')],'type':_0xf323('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2223b0,_0x4b9f24,_0x1fe8d3){var _0x5335d4=_0x3917ae['models'];var _0x59fd25=_0x2223b0[_0xf323('0xd')]({'plain':!![]});if(_0x59fd25[_0xf323('0xe')][_0xf323('0xf')]()==='in'||_0x59fd25['direction'][_0xf323('0xf')]()===_0xf323('0x10')&&!_0x59fd25['secret']&&!_[_0xf323('0x11')](_0x59fd25[_0xf323('0x12')])){_0x5335d4[_0xf323('0x13')][_0xf323('0x14')]({'where':{'id':_0x59fd25[_0xf323('0x15')]}})[_0xf323('0x16')](function(_0x5a6888){if(_0x5a6888){_0x5a6888[_0xf323('0x17')]({'lastMsgAt':_0x59fd25[_0xf323('0x18')],'lastMsgDirection':_0x59fd25[_0xf323('0xe')][_0xf323('0xf')]()});}})['catch'](function(_0x4053bf){console['error'](_0x4053bf);});}_0x1fe8d3();}},'charset':'utf8mb4','collate':_0xf323('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4ab0136..e134a04 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 _0xe7ac=['http','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xa4a442,_0x766162){var _0x3486f5=function(_0x2094f5){while(--_0x2094f5){_0xa4a442['push'](_0xa4a442['shift']());}};_0x3486f5(++_0x766162);}(_0xe7ac,0xd0));var _0xce7a=function(_0x26b367,_0x158299){_0x26b367=_0x26b367-0x0;var _0x5a7c9f=_0xe7ac[_0x26b367];return _0x5a7c9f;};'use strict';var _=require(_0xce7a('0x0'));var util=require('util');var moment=require(_0xce7a('0x1'));var BPromise=require(_0xce7a('0x2'));var rs=require(_0xce7a('0x3'));var fs=require('fs');var Redis=require(_0xce7a('0x4'));var db=require(_0xce7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce7a('0x6'))(_0xce7a('0x7'));var config=require(_0xce7a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce7a('0x9')]({'port':0x232a});config['redis']=_[_0xce7a('0xa')](config['redis'],{'host':_0xce7a('0xb'),'port':0x18eb});var socket=require(_0xce7a('0xc'))(new Redis(config[_0xce7a('0xd')]));require(_0xce7a('0xe'))['register'](socket);function respondWithRpcPromise(_0x729c46,_0x5bb33e,_0x16e575){return new BPromise(function(_0x2190bf,_0x4f4752){return client['request'](_0x729c46,_0x16e575)[_0xce7a('0xf')](function(_0x4ce59e){logger['info'](_0xce7a('0x10'),_0x5bb33e,_0xce7a('0x11'));logger[_0xce7a('0x12')](_0xce7a('0x13'),_0x5bb33e,'request\x20sent',JSON[_0xce7a('0x14')](_0x4ce59e));if(_0x4ce59e[_0xce7a('0x15')]){if(_0x4ce59e[_0xce7a('0x15')][_0xce7a('0x16')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5bb33e,_0x4ce59e[_0xce7a('0x15')]['message']);return _0x4f4752(_0x4ce59e[_0xce7a('0x15')][_0xce7a('0x17')]);}logger[_0xce7a('0x15')](_0xce7a('0x10'),_0x5bb33e,_0x4ce59e[_0xce7a('0x15')][_0xce7a('0x17')]);return _0x2190bf(_0x4ce59e[_0xce7a('0x15')][_0xce7a('0x17')]);}else{logger[_0xce7a('0x18')](_0xce7a('0x10'),_0x5bb33e,'request\x20sent');_0x2190bf(_0x4ce59e[_0xce7a('0x19')][_0xce7a('0x17')]);}})[_0xce7a('0x1a')](function(_0x26a50e){logger['error'](_0xce7a('0x10'),_0x5bb33e,_0x26a50e);_0x4f4752(_0x26a50e);});});}exports[_0xce7a('0x1b')]=function(_0x1244f8){var _0x170862=this;return new Promise(function(_0x5ddbc9,_0x374944){return db[_0xce7a('0x1c')][_0xce7a('0x1d')](_0x1244f8['body'],{'raw':_0x1244f8[_0xce7a('0x1e')]?_0x1244f8[_0xce7a('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xce7a('0xf')](function(_0xab77ba){logger[_0xce7a('0x18')](_0xce7a('0x1b'),_0x1244f8);logger[_0xce7a('0x12')]('CreateChatMessage',_0x1244f8,JSON[_0xce7a('0x14')](_0xab77ba));_0x5ddbc9(_0xab77ba);})[_0xce7a('0x1a')](function(_0x18266b){logger[_0xce7a('0x15')]('CreateChatMessage',_0x18266b[_0xce7a('0x17')],_0x1244f8);_0x374944(_0x170862['error'](0x1f4,_0x18266b[_0xce7a('0x17')]));});});}; \ No newline at end of file +var _0x6d27=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register'];(function(_0x5f534f,_0x59a38e){var _0x467679=function(_0x43a53c){while(--_0x43a53c){_0x5f534f['push'](_0x5f534f['shift']());}};_0x467679(++_0x59a38e);}(_0x6d27,0x15b));var _0x76d2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6d27[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x76d2('0x0'));var util=require(_0x76d2('0x1'));var moment=require(_0x76d2('0x2'));var BPromise=require('bluebird');var rs=require(_0x76d2('0x3'));var fs=require('fs');var Redis=require(_0x76d2('0x4'));var db=require(_0x76d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x76d2('0x6'))(_0x76d2('0x7'));var config=require(_0x76d2('0x8'));var jayson=require(_0x76d2('0x9'));var client=jayson[_0x76d2('0xa')][_0x76d2('0xb')]({'port':0x232a});config[_0x76d2('0xc')]=_[_0x76d2('0xd')](config['redis'],{'host':_0x76d2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76d2('0xc')]));require('./chatMessage.socket')[_0x76d2('0xf')](socket);function respondWithRpcPromise(_0x1eb87c,_0x38b1bd,_0xb6221){return new BPromise(function(_0x5aa6bf,_0x4a32f8){return client['request'](_0x1eb87c,_0xb6221)['then'](function(_0xc2ca3){logger['info']('ChatMessage,\x20%s,\x20%s',_0x38b1bd,'request\x20sent');logger[_0x76d2('0x10')](_0x76d2('0x11'),_0x38b1bd,_0x76d2('0x12'),JSON['stringify'](_0xc2ca3));if(_0xc2ca3[_0x76d2('0x13')]){if(_0xc2ca3[_0x76d2('0x13')][_0x76d2('0x14')]===0x1f4){logger['error'](_0x76d2('0x15'),_0x38b1bd,_0xc2ca3['error'][_0x76d2('0x16')]);return _0x4a32f8(_0xc2ca3['error'][_0x76d2('0x16')]);}logger[_0x76d2('0x13')](_0x76d2('0x15'),_0x38b1bd,_0xc2ca3['error'][_0x76d2('0x16')]);return _0x5aa6bf(_0xc2ca3[_0x76d2('0x13')]['message']);}else{logger[_0x76d2('0x17')](_0x76d2('0x15'),_0x38b1bd,_0x76d2('0x12'));_0x5aa6bf(_0xc2ca3[_0x76d2('0x18')][_0x76d2('0x16')]);}})[_0x76d2('0x19')](function(_0x33c822){logger[_0x76d2('0x13')]('ChatMessage,\x20%s,\x20%s',_0x38b1bd,_0x33c822);_0x4a32f8(_0x33c822);});});}exports[_0x76d2('0x1a')]=function(_0x53f13d){var _0x2d04c4=this;return new Promise(function(_0x1c8d28,_0x140e6d){return db[_0x76d2('0x1b')][_0x76d2('0x1c')](_0x53f13d[_0x76d2('0x1d')],{'raw':_0x53f13d['options']?_0x53f13d[_0x76d2('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x76d2('0x1f')](function(_0x1e8251){logger[_0x76d2('0x17')](_0x76d2('0x1a'),_0x53f13d);logger['debug'](_0x76d2('0x1a'),_0x53f13d,JSON[_0x76d2('0x20')](_0x1e8251));_0x1c8d28(_0x1e8251);})[_0x76d2('0x19')](function(_0x2b77b7){logger[_0x76d2('0x13')](_0x76d2('0x1a'),_0x2b77b7[_0x76d2('0x16')],_0x53f13d);_0x140e6d(_0x2d04c4[_0x76d2('0x13')](0x1f4,_0x2b77b7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e74ba93..65c2596 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 _0x826a=['update','emit','removeListener','register','length','chatMessage:','save'];(function(_0x289856,_0xe83156){var _0x4c4115=function(_0x383499){while(--_0x383499){_0x289856['push'](_0x289856['shift']());}};_0x4c4115(++_0xe83156);}(_0x826a,0x1aa));var _0xa826=function(_0x531aef,_0xef95ba){_0x531aef=_0x531aef-0x0;var _0x3bea62=_0x826a[_0x531aef];return _0x3bea62;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa826('0x0'),'remove',_0xa826('0x1')];function createListener(_0x50c70e,_0x376d53){return function(_0x19ba11){_0x376d53[_0xa826('0x2')](_0x50c70e,_0x19ba11);};}function removeListener(_0x34e1ad,_0x5372ab){return function(){ChatMessageEvents[_0xa826('0x3')](_0x34e1ad,_0x5372ab);};}exports[_0xa826('0x4')]=function(_0x3929d4){for(var _0x34327b=0x0,_0x45154f=events[_0xa826('0x5')];_0x34327b<_0x45154f;_0x34327b++){var _0x4339f9=events[_0x34327b];var _0x14c2ba=createListener(_0xa826('0x6')+_0x4339f9,_0x3929d4);ChatMessageEvents['on'](_0x4339f9,_0x14c2ba);}}; \ No newline at end of file +var _0xec46=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x189cde,_0x457803){var _0xb066ed=function(_0x31a3be){while(--_0x31a3be){_0x189cde['push'](_0x189cde['shift']());}};_0xb066ed(++_0x457803);}(_0xec46,0x19c));var _0x6ec4=function(_0x5c06b,_0x20564c){_0x5c06b=_0x5c06b-0x0;var _0x34c54c=_0xec46[_0x5c06b];return _0x34c54c;};'use strict';var ChatMessageEvents=require(_0x6ec4('0x0'));var events=[_0x6ec4('0x1'),_0x6ec4('0x2'),_0x6ec4('0x3')];function createListener(_0x5e854b,_0x5052d2){return function(_0x307c5c){_0x5052d2[_0x6ec4('0x4')](_0x5e854b,_0x307c5c);};}function removeListener(_0x86b9f8,_0x53bbed){return function(){ChatMessageEvents[_0x6ec4('0x5')](_0x86b9f8,_0x53bbed);};}exports[_0x6ec4('0x6')]=function(_0x55b203){for(var _0x533fda=0x0,_0x55d260=events[_0x6ec4('0x7')];_0x533fda<_0x55d260;_0x533fda++){var _0x391ed9=events[_0x533fda];var _0x42b81b=createListener(_0x6ec4('0x8')+_0x391ed9,_0x55b203);ChatMessageEvents['on'](_0x391ed9,_0x42b81b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 7e90769..e0ddc58 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 _0x0f7c=['index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f7c,0xf9));var _0xc0f7=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x0f7c[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xc0f7('0x0'));var util=require(_0xc0f7('0x1'));var path=require(_0xc0f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xc0f7('0x3'));var router=express[_0xc0f7('0x4')]();var fs_extra=require(_0xc0f7('0x5'));var auth=require(_0xc0f7('0x6'));var interaction=require(_0xc0f7('0x7'));var config=require(_0xc0f7('0x8'));var controller=require(_0xc0f7('0x9'));router[_0xc0f7('0xa')]('/',auth[_0xc0f7('0xb')](),controller[_0xc0f7('0xc')]);router['get'](_0xc0f7('0xd'),auth[_0xc0f7('0xb')](),controller[_0xc0f7('0xe')]);router[_0xc0f7('0xa')](_0xc0f7('0xf'),auth[_0xc0f7('0xb')](),controller[_0xc0f7('0x10')]);router[_0xc0f7('0x11')]('/',auth[_0xc0f7('0xb')](),interaction[_0xc0f7('0x12')](_0xc0f7('0x13'),_0xc0f7('0x14')),controller[_0xc0f7('0x15')]);router[_0xc0f7('0x16')](_0xc0f7('0xf'),controller[_0xc0f7('0x17')]);router['put'](_0xc0f7('0x18'),auth[_0xc0f7('0xb')](),controller[_0xc0f7('0x19')]);router['put'](_0xc0f7('0x1a'),auth['isAuthenticated'](),controller['reject']);router[_0xc0f7('0x1b')](_0xc0f7('0xf'),auth[_0xc0f7('0xb')](),controller[_0xc0f7('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xabf3=['chatmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat'];(function(_0x4fde3a,_0x50e735){var _0x2d4cf1=function(_0x56fe28){while(--_0x56fe28){_0x4fde3a['push'](_0x4fde3a['shift']());}};_0x2d4cf1(++_0x50e735);}(_0xabf3,0x149));var _0x3abf=function(_0x5cbb1f,_0x3447e1){_0x5cbb1f=_0x5cbb1f-0x0;var _0x2626d7=_0xabf3[_0x5cbb1f];return _0x2626d7;};'use strict';var multer=require('multer');var util=require(_0x3abf('0x0'));var path=require(_0x3abf('0x1'));var timeout=require(_0x3abf('0x2'));var express=require(_0x3abf('0x3'));var router=express[_0x3abf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3abf('0x5'));var interaction=require(_0x3abf('0x6'));var config=require(_0x3abf('0x7'));var controller=require(_0x3abf('0x8'));router[_0x3abf('0x9')]('/',auth[_0x3abf('0xa')](),controller[_0x3abf('0xb')]);router[_0x3abf('0x9')](_0x3abf('0xc'),auth[_0x3abf('0xa')](),controller[_0x3abf('0xd')]);router['get'](_0x3abf('0xe'),auth['isAuthenticated'](),controller[_0x3abf('0xf')]);router[_0x3abf('0x10')]('/',auth[_0x3abf('0xa')](),interaction[_0x3abf('0x11')](_0x3abf('0x12'),_0x3abf('0x13')),controller[_0x3abf('0x14')]);router[_0x3abf('0x15')](_0x3abf('0xe'),controller[_0x3abf('0x16')]);router[_0x3abf('0x15')](_0x3abf('0x17'),auth['isAuthenticated'](),controller[_0x3abf('0x18')]);router[_0x3abf('0x15')]('/:id/reject',auth[_0x3abf('0xa')](),controller[_0x3abf('0x19')]);router[_0x3abf('0x1a')](_0x3abf('0xe'),auth['isAuthenticated'](),controller[_0x3abf('0x1b')]);module[_0x3abf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 458ba37..55e519d 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 _0x38e8=['sequelize','exports','TEXT','medium'];(function(_0xc5400f,_0x33b910){var _0x7ad9c=function(_0x39c8d9){while(--_0x39c8d9){_0xc5400f['push'](_0xc5400f['shift']());}};_0x7ad9c(++_0x33b910);}(_0x38e8,0x150));var _0x838e=function(_0x12e77a,_0x227e87){_0x12e77a=_0x12e77a-0x0;var _0x56123c=_0x38e8[_0x12e77a];return _0x56123c;};'use strict';var Sequelize=require(_0x838e('0x0'));module[_0x838e('0x1')]={'body':{'type':Sequelize[_0x838e('0x2')](_0x838e('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x2440=['TEXT','exports'];(function(_0x4b23a1,_0x352e14){var _0x786bf1=function(_0x5c0a7c){while(--_0x5c0a7c){_0x4b23a1['push'](_0x4b23a1['shift']());}};_0x786bf1(++_0x352e14);}(_0x2440,0x1e1));var _0x0244=function(_0x5aa02b,_0x3dcacc){_0x5aa02b=_0x5aa02b-0x0;var _0x2c5863=_0x2440[_0x5aa02b];return _0x2c5863;};'use strict';var Sequelize=require('sequelize');module[_0x0244('0x0')]={'body':{'type':Sequelize[_0x0244('0x1')]('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 662068e..5f87517 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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x7a54,0x106));var _0x47a5=function(_0x48c3a1,_0x1afeb1){_0x48c3a1=_0x48c3a1-0x0;var _0xfcb857=_0x7a54[_0x48c3a1];return _0xfcb857;};'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(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x43df6c,_0x1a1f7c){_0x43df6c=_0x43df6c-0x0;var _0x4cc545=_0x7a54[_0x43df6c];return _0x4cc545;};'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 805a9df..1710e8a 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 _0x527f=['exports','define','ChatOfflineMessage','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x490b54,_0x47317b){var _0x442740=function(_0x502140){while(--_0x502140){_0x490b54['push'](_0x490b54['shift']());}};_0x442740(++_0x47317b);}(_0x527f,0x10c));var _0xf527=function(_0x299a45,_0x3805af){_0x299a45=_0x299a45-0x0;var _0x39c861=_0x527f[_0x299a45];return _0x39c861;};'use strict';var _=require(_0xf527('0x0'));var util=require(_0xf527('0x1'));var logger=require(_0xf527('0x2'))(_0xf527('0x3'));var moment=require('moment');var BPromise=require(_0xf527('0x4'));var rp=require(_0xf527('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf527('0x6'));var config=require(_0xf527('0x7'));var attributes=require('./chatOfflineMessage.attributes');module[_0xf527('0x8')]=function(_0x153c36,_0x25f209){return _0x153c36[_0xf527('0x9')](_0xf527('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf527('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8cdd=['exports','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x47de5d,_0x5ba7d6){var _0x43ea49=function(_0x4836f5){while(--_0x4836f5){_0x47de5d['push'](_0x47de5d['shift']());}};_0x43ea49(++_0x5ba7d6);}(_0x8cdd,0x122));var _0xd8cd=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x8cdd[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xd8cd('0x0'));var util=require(_0xd8cd('0x1'));var logger=require(_0xd8cd('0x2'))('api');var moment=require(_0xd8cd('0x3'));var BPromise=require('bluebird');var rp=require(_0xd8cd('0x4'));var fs=require('fs');var path=require(_0xd8cd('0x5'));var rimraf=require(_0xd8cd('0x6'));var config=require(_0xd8cd('0x7'));var attributes=require(_0xd8cd('0x8'));module[_0xd8cd('0x9')]=function(_0x4ebb2a,_0x1acfe7){return _0x4ebb2a['define'](_0xd8cd('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd8cd('0xb'),'collate':_0xd8cd('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index af607f4..0ac07a9 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 _0x4d23=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment'];(function(_0x19f9b4,_0x1798c5){var _0x2c535b=function(_0x8e60ee){while(--_0x8e60ee){_0x19f9b4['push'](_0x19f9b4['shift']());}};_0x2c535b(++_0x1798c5);}(_0x4d23,0x82));var _0x34d2=function(_0x5c3b5e,_0x31ad52){_0x5c3b5e=_0x5c3b5e-0x0;var _0x5d6993=_0x4d23[_0x5c3b5e];return _0x5d6993;};'use strict';var _=require('lodash');var util=require(_0x34d2('0x0'));var moment=require(_0x34d2('0x1'));var BPromise=require(_0x34d2('0x2'));var rs=require(_0x34d2('0x3'));var fs=require('fs');var Redis=require(_0x34d2('0x4'));var db=require(_0x34d2('0x5'))['db'];var utils=require(_0x34d2('0x6'));var logger=require(_0x34d2('0x7'))(_0x34d2('0x8'));var config=require(_0x34d2('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x34d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cac28,_0x4ccb43,_0x51cc7b){return new BPromise(function(_0x25d2cb,_0x2c46ab){return client[_0x34d2('0xb')](_0x3cac28,_0x51cc7b)[_0x34d2('0xc')](function(_0x373886){logger[_0x34d2('0xd')](_0x34d2('0xe'),_0x4ccb43,_0x34d2('0xf'));logger[_0x34d2('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4ccb43,_0x34d2('0xf'),JSON[_0x34d2('0x11')](_0x373886));if(_0x373886[_0x34d2('0x12')]){if(_0x373886['error'][_0x34d2('0x13')]===0x1f4){logger[_0x34d2('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4ccb43,_0x373886[_0x34d2('0x12')]['message']);return _0x2c46ab(_0x373886[_0x34d2('0x12')][_0x34d2('0x14')]);}logger[_0x34d2('0x12')](_0x34d2('0xe'),_0x4ccb43,_0x373886['error'][_0x34d2('0x14')]);return _0x25d2cb(_0x373886[_0x34d2('0x12')][_0x34d2('0x14')]);}else{logger[_0x34d2('0xd')](_0x34d2('0xe'),_0x4ccb43,'request\x20sent');_0x25d2cb(_0x373886['result'][_0x34d2('0x14')]);}})[_0x34d2('0x15')](function(_0x1e6df8){logger[_0x34d2('0x12')](_0x34d2('0xe'),_0x4ccb43,_0x1e6df8);_0x2c46ab(_0x1e6df8);});});} \ No newline at end of file +var _0x939d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x464121,_0x39c954){var _0x1d0cb8=function(_0x24722a){while(--_0x24722a){_0x464121['push'](_0x464121['shift']());}};_0x1d0cb8(++_0x39c954);}(_0x939d,0xcc));var _0xd939=function(_0x577c12,_0x2babb4){_0x577c12=_0x577c12-0x0;var _0x466fbf=_0x939d[_0x577c12];return _0x466fbf;};'use strict';var _=require(_0xd939('0x0'));var util=require(_0xd939('0x1'));var moment=require('moment');var BPromise=require(_0xd939('0x2'));var rs=require(_0xd939('0x3'));var fs=require('fs');var Redis=require(_0xd939('0x4'));var db=require(_0xd939('0x5'))['db'];var utils=require(_0xd939('0x6'));var logger=require(_0xd939('0x7'))(_0xd939('0x8'));var config=require(_0xd939('0x9'));var jayson=require(_0xd939('0xa'));var client=jayson[_0xd939('0xb')][_0xd939('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51f38f,_0x6db92c,_0x559294){return new BPromise(function(_0x451a54,_0x2c8e98){return client['request'](_0x51f38f,_0x559294)[_0xd939('0xd')](function(_0x39e302){logger[_0xd939('0xe')](_0xd939('0xf'),_0x6db92c,'request\x20sent');logger['debug'](_0xd939('0x10'),_0x6db92c,_0xd939('0x11'),JSON[_0xd939('0x12')](_0x39e302));if(_0x39e302[_0xd939('0x13')]){if(_0x39e302[_0xd939('0x13')]['code']===0x1f4){logger[_0xd939('0x13')](_0xd939('0xf'),_0x6db92c,_0x39e302[_0xd939('0x13')][_0xd939('0x14')]);return _0x2c8e98(_0x39e302[_0xd939('0x13')][_0xd939('0x14')]);}logger['error'](_0xd939('0xf'),_0x6db92c,_0x39e302[_0xd939('0x13')]['message']);return _0x451a54(_0x39e302[_0xd939('0x13')]['message']);}else{logger[_0xd939('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x6db92c,_0xd939('0x11'));_0x451a54(_0x39e302[_0xd939('0x15')][_0xd939('0x14')]);}})[_0xd939('0x16')](function(_0x32b16c){logger['error'](_0xd939('0xf'),_0x6db92c,_0x32b16c);_0x2c8e98(_0x32b16c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 94f1dd7..c4f5c24 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 _0x0bd7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x10e0af,_0x35a91c){var _0x402a6f=function(_0x5f2313){while(--_0x5f2313){_0x10e0af['push'](_0x10e0af['shift']());}};_0x402a6f(++_0x35a91c);}(_0x0bd7,0xb8));var _0x70bd=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x0bd7[_0x5c6022];return _0x4ab5af;};'use strict';var multer=require(_0x70bd('0x0'));var util=require(_0x70bd('0x1'));var path=require(_0x70bd('0x2'));var timeout=require(_0x70bd('0x3'));var express=require(_0x70bd('0x4'));var router=express[_0x70bd('0x5')]();var fs_extra=require(_0x70bd('0x6'));var auth=require(_0x70bd('0x7'));var interaction=require(_0x70bd('0x8'));var config=require('../../config/environment');var controller=require(_0x70bd('0x9'));router['get']('/',auth[_0x70bd('0xa')](),controller[_0x70bd('0xb')]);router[_0x70bd('0xc')](_0x70bd('0xd'),auth[_0x70bd('0xa')](),controller[_0x70bd('0xe')]);router[_0x70bd('0xc')](_0x70bd('0xf'),auth[_0x70bd('0xa')](),controller[_0x70bd('0x10')]);router['post']('/',auth[_0x70bd('0xa')](),controller[_0x70bd('0x11')]);router[_0x70bd('0x12')](_0x70bd('0xf'),auth[_0x70bd('0xa')](),controller[_0x70bd('0x13')]);router[_0x70bd('0x14')](_0x70bd('0xf'),auth[_0x70bd('0xa')](),controller[_0x70bd('0x15')]);module[_0x70bd('0x16')]=router; \ No newline at end of file +var _0xb30c=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','create','put'];(function(_0x54c516,_0x420575){var _0x2583c0=function(_0x4171e4){while(--_0x4171e4){_0x54c516['push'](_0x54c516['shift']());}};_0x2583c0(++_0x420575);}(_0xb30c,0x81));var _0xcb30=function(_0x3c5617,_0x549e48){_0x3c5617=_0x3c5617-0x0;var _0xaddb2d=_0xb30c[_0x3c5617];return _0xaddb2d;};'use strict';var multer=require('multer');var util=require(_0xcb30('0x0'));var path=require(_0xcb30('0x1'));var timeout=require(_0xcb30('0x2'));var express=require(_0xcb30('0x3'));var router=express[_0xcb30('0x4')]();var fs_extra=require(_0xcb30('0x5'));var auth=require(_0xcb30('0x6'));var interaction=require(_0xcb30('0x7'));var config=require(_0xcb30('0x8'));var controller=require(_0xcb30('0x9'));router[_0xcb30('0xa')]('/',auth[_0xcb30('0xb')](),controller[_0xcb30('0xc')]);router[_0xcb30('0xa')]('/describe',auth[_0xcb30('0xb')](),controller[_0xcb30('0xd')]);router[_0xcb30('0xa')](_0xcb30('0xe'),auth[_0xcb30('0xb')](),controller[_0xcb30('0xf')]);router['post']('/',auth[_0xcb30('0xb')](),controller[_0xcb30('0x10')]);router[_0xcb30('0x11')](_0xcb30('0xe'),auth[_0xcb30('0xb')](),controller[_0xcb30('0x12')]);router[_0xcb30('0x13')](_0xcb30('0xe'),auth['isAuthenticated'](),controller[_0xcb30('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b9061d2..3f3f85b 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 _0x68fa=['exports','STRING','ENUM','timeout','mouseOver','INTEGER','sequelize'];(function(_0x23bb2c,_0x5eeb86){var _0x4d1ad8=function(_0xc65367){while(--_0xc65367){_0x23bb2c['push'](_0x23bb2c['shift']());}};_0x4d1ad8(++_0x5eeb86);}(_0x68fa,0x109));var _0xa68f=function(_0x330ee4,_0x27b717){_0x330ee4=_0x330ee4-0x0;var _0x31d749=_0x68fa[_0x330ee4];return _0x31d749;};'use strict';var Sequelize=require(_0xa68f('0x0'));module[_0xa68f('0x1')]={'name':{'type':Sequelize[_0xa68f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa68f('0x3')]('mouseOver',_0xa68f('0x4')),'defaultValue':_0xa68f('0x5')},'selector':{'type':Sequelize[_0xa68f('0x2')]},'timeout':{'type':Sequelize[_0xa68f('0x6')]}}; \ No newline at end of file +var _0x9f02=['ENUM','mouseOver','timeout','sequelize','exports','STRING'];(function(_0xf26c34,_0x5bc08b){var _0xdb6411=function(_0x750f56){while(--_0x750f56){_0xf26c34['push'](_0xf26c34['shift']());}};_0xdb6411(++_0x5bc08b);}(_0x9f02,0x18f));var _0x29f0=function(_0x15833d,_0xa2d050){_0x15833d=_0x15833d-0x0;var _0x31cc57=_0x9f02[_0x15833d];return _0x31cc57;};'use strict';var Sequelize=require(_0x29f0('0x0'));module[_0x29f0('0x1')]={'name':{'type':Sequelize[_0x29f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x29f0('0x3')](_0x29f0('0x4'),_0x29f0('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 50ca924..38edc20 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 _0xc906=['destroy','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','options','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','save'];(function(_0x17a09c,_0x233370){var _0x491dde=function(_0xb32995){while(--_0xb32995){_0x17a09c['push'](_0x17a09c['shift']());}};_0x491dde(++_0x233370);}(_0xc906,0x1ad));var _0x6c90=function(_0xd2a145,_0x53070d){_0xd2a145=_0xd2a145-0x0;var _0xfe94b5=_0xc906[_0xd2a145];return _0xfe94b5;};'use strict';var emlformat=require(_0x6c90('0x0'));var rimraf=require(_0x6c90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c90('0x2'));var rp=require(_0x6c90('0x3'));var moment=require(_0x6c90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c90('0x5'));var util=require(_0x6c90('0x6'));var path=require(_0x6c90('0x7'));var sox=require(_0x6c90('0x8'));var csv=require(_0x6c90('0x9'));var ejs=require(_0x6c90('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c90('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6c90('0xc'));var toCsv=require(_0x6c90('0x9'));var querystring=require(_0x6c90('0xd'));var Papa=require(_0x6c90('0xe'));var Redis=require(_0x6c90('0xf'));var authService=require(_0x6c90('0x10'));var qs=require(_0x6c90('0x11'));var as=require(_0x6c90('0x12'));var hardwareService=require(_0x6c90('0x13'));var logger=require(_0x6c90('0x14'))(_0x6c90('0x15'));var utils=require(_0x6c90('0x16'));var config=require(_0x6c90('0x17'));var licenseUtil=require(_0x6c90('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51814c,_0x447fb3){_0x447fb3=_0x447fb3||0xcc;return function(_0x2d7755){if(_0x2d7755){return _0x51814c[_0x6c90('0x19')](_0x447fb3);}return _0x51814c[_0x6c90('0x1a')](_0x447fb3)[_0x6c90('0x1b')]();};}function respondWithResult(_0x3cf02d,_0x117da5){_0x117da5=_0x117da5||0xc8;return function(_0x30f64a){if(_0x30f64a){return _0x3cf02d[_0x6c90('0x1a')](_0x117da5)[_0x6c90('0x1c')](_0x30f64a);}};}function respondWithFilteredResult(_0x49e7ef,_0x2bb817){return function(_0x226917){if(_0x226917){var _0x273ed1=typeof _0x2bb817[_0x6c90('0x1d')]==='undefined'&&typeof _0x2bb817[_0x6c90('0x1e')]===_0x6c90('0x1f');var _0x5589ad=_0x226917[_0x6c90('0x20')];var _0x3f9572=_0x273ed1?0x0:_0x2bb817[_0x6c90('0x1d')];var _0x424902=_0x273ed1?_0x226917[_0x6c90('0x20')]:_0x2bb817[_0x6c90('0x1d')]+_0x2bb817['limit'];var _0x9fc18e;if(_0x424902>=_0x5589ad){_0x424902=_0x5589ad;_0x9fc18e=0xc8;}else{_0x9fc18e=0xce;}_0x49e7ef[_0x6c90('0x1a')](_0x9fc18e);return _0x49e7ef[_0x6c90('0x21')]('Content-Range',_0x3f9572+'-'+_0x424902+'/'+_0x5589ad)['json'](_0x226917);}return null;};}function patchUpdates(_0x3e9ba6){return function(_0x6f0a46){try{jsonpatch['apply'](_0x6f0a46,_0x3e9ba6,!![]);}catch(_0x224115){return BPromise['reject'](_0x224115);}return _0x6f0a46[_0x6c90('0x22')]();};}function saveUpdates(_0x593010,_0x4f8818){return function(_0x137285){if(_0x137285){return _0x137285['update'](_0x593010)['then'](function(_0x3284a5){return _0x3284a5;});}return null;};}function removeEntity(_0x59ba0e,_0x26139e){return function(_0x55ddfc){if(_0x55ddfc){return _0x55ddfc[_0x6c90('0x23')]()[_0x6c90('0x24')](function(){_0x59ba0e[_0x6c90('0x1a')](0xcc)[_0x6c90('0x1b')]();});}};}function handleEntityNotFound(_0xf51b92,_0x4e1976){return function(_0x3ad642){if(!_0x3ad642){_0xf51b92[_0x6c90('0x19')](0x194);}return _0x3ad642;};}function handleError(_0x4a5818,_0x2a04f6){_0x2a04f6=_0x2a04f6||0x1f4;return function(_0x5aaf2f){logger[_0x6c90('0x25')](_0x5aaf2f[_0x6c90('0x26')]);if(_0x5aaf2f[_0x6c90('0x27')]){delete _0x5aaf2f[_0x6c90('0x27')];}_0x4a5818[_0x6c90('0x1a')](_0x2a04f6)['send'](_0x5aaf2f);};}exports[_0x6c90('0x28')]=function(_0x122246,_0x1d1cc6){var _0x4cffd0={'raw':!![],'where':{'id':_0x122246[_0x6c90('0x29')]['id']}},_0x17dfbd={};_0x17dfbd[_0x6c90('0x2a')]=_[_0x6c90('0x2b')](db[_0x6c90('0x2c')][_0x6c90('0x2d')]);_0x17dfbd[_0x6c90('0x2e')]=_['keys'](_0x122246[_0x6c90('0x2e')]);_0x17dfbd[_0x6c90('0x2f')]=_[_0x6c90('0x30')](_0x17dfbd['model'],_0x17dfbd[_0x6c90('0x2e')]);_0x4cffd0[_0x6c90('0x31')]=_[_0x6c90('0x30')](_0x17dfbd['model'],qs[_0x6c90('0x32')](_0x122246['query'][_0x6c90('0x32')]));_0x4cffd0['attributes']=_0x4cffd0[_0x6c90('0x31')]['length']?_0x4cffd0[_0x6c90('0x31')]:_0x17dfbd['model'];if(_0x122246[_0x6c90('0x2e')][_0x6c90('0x33')]){_0x4cffd0['include']=[{'all':!![]}];}_0x4cffd0=_['merge']({},_0x4cffd0,_0x122246[_0x6c90('0x34')]);return db['ChatProactiveAction'][_0x6c90('0x35')](_0x4cffd0)[_0x6c90('0x24')](handleEntityNotFound(_0x1d1cc6,null))[_0x6c90('0x24')](respondWithResult(_0x1d1cc6,null))[_0x6c90('0x36')](handleError(_0x1d1cc6,null));};exports[_0x6c90('0x37')]=function(_0x23a109,_0x176c33){return db['ChatProactiveAction'][_0x6c90('0x37')](_0x23a109[_0x6c90('0x38')],{})['then'](respondWithResult(_0x176c33,0xc9))[_0x6c90('0x36')](handleError(_0x176c33,null));};exports[_0x6c90('0x39')]=function(_0x17d5b6,_0x103c35){if(_0x17d5b6[_0x6c90('0x38')]['id']){delete _0x17d5b6[_0x6c90('0x38')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x17d5b6[_0x6c90('0x29')]['id']}})[_0x6c90('0x24')](handleEntityNotFound(_0x103c35,null))['then'](saveUpdates(_0x17d5b6['body'],null))[_0x6c90('0x24')](respondWithResult(_0x103c35,null))[_0x6c90('0x36')](handleError(_0x103c35,null));};exports[_0x6c90('0x23')]=function(_0x26c921,_0x447a7b){return db[_0x6c90('0x2c')]['find']({'where':{'id':_0x26c921[_0x6c90('0x29')]['id']}})[_0x6c90('0x24')](handleEntityNotFound(_0x447a7b,null))[_0x6c90('0x24')](removeEntity(_0x447a7b,null))['catch'](handleError(_0x447a7b,null));}; \ No newline at end of file +var _0x1af3=['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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','length','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x40a73a,_0x4d3623){var _0x46e6cb=function(_0x5d08a3){while(--_0x5d08a3){_0x40a73a['push'](_0x40a73a['shift']());}};_0x46e6cb(++_0x4d3623);}(_0x1af3,0x1ca));var _0x31af=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0x1af3[_0x41582d];return _0x59c504;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require(_0x31af('0x2'));var jsonpatch=require(_0x31af('0x3'));var rp=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var BPromise=require(_0x31af('0x6'));var Mustache=require(_0x31af('0x7'));var util=require(_0x31af('0x8'));var path=require(_0x31af('0x9'));var sox=require('sox');var csv=require(_0x31af('0xa'));var ejs=require(_0x31af('0xb'));var fs=require('fs');var fs_extra=require(_0x31af('0xc'));var _=require(_0x31af('0xd'));var squel=require('squel');var crypto=require(_0x31af('0xe'));var jsforce=require(_0x31af('0xf'));var deskjs=require(_0x31af('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31af('0x11'));var Papa=require(_0x31af('0x12'));var Redis=require(_0x31af('0x13'));var authService=require(_0x31af('0x14'));var qs=require(_0x31af('0x15'));var as=require(_0x31af('0x16'));var hardwareService=require(_0x31af('0x17'));var logger=require(_0x31af('0x18'))('api');var utils=require(_0x31af('0x19'));var config=require(_0x31af('0x1a'));var licenseUtil=require(_0x31af('0x1b'));var db=require(_0x31af('0x1c'))['db'];function respondWithStatusCode(_0x144406,_0x481f20){_0x481f20=_0x481f20||0xcc;return function(_0x358fb4){if(_0x358fb4){return _0x144406[_0x31af('0x1d')](_0x481f20);}return _0x144406['status'](_0x481f20)['end']();};}function respondWithResult(_0x2a4727,_0x46a494){_0x46a494=_0x46a494||0xc8;return function(_0x14c57e){if(_0x14c57e){return _0x2a4727[_0x31af('0x1e')](_0x46a494)[_0x31af('0x1f')](_0x14c57e);}};}function respondWithFilteredResult(_0x1d35fa,_0x369934){return function(_0x37c275){if(_0x37c275){var _0xd431e4=typeof _0x369934[_0x31af('0x20')]===_0x31af('0x21')&&typeof _0x369934['limit']===_0x31af('0x21');var _0xd33b3f=_0x37c275[_0x31af('0x22')];var _0x477ada=_0xd431e4?0x0:_0x369934[_0x31af('0x20')];var _0x30a112=_0xd431e4?_0x37c275[_0x31af('0x22')]:_0x369934[_0x31af('0x20')]+_0x369934[_0x31af('0x23')];var _0x550870;if(_0x30a112>=_0xd33b3f){_0x30a112=_0xd33b3f;_0x550870=0xc8;}else{_0x550870=0xce;}_0x1d35fa[_0x31af('0x1e')](_0x550870);return _0x1d35fa[_0x31af('0x24')](_0x31af('0x25'),_0x477ada+'-'+_0x30a112+'/'+_0xd33b3f)[_0x31af('0x1f')](_0x37c275);}return null;};}function patchUpdates(_0x414ad8){return function(_0x5d96ca){try{jsonpatch[_0x31af('0x26')](_0x5d96ca,_0x414ad8,!![]);}catch(_0x46b03e){return BPromise[_0x31af('0x27')](_0x46b03e);}return _0x5d96ca[_0x31af('0x28')]();};}function saveUpdates(_0x394d13,_0x14c3f9){return function(_0x1ddfba){if(_0x1ddfba){return _0x1ddfba[_0x31af('0x29')](_0x394d13)[_0x31af('0x2a')](function(_0x6634e3){return _0x6634e3;});}return null;};}function removeEntity(_0x40aa32,_0x1a67e3){return function(_0x3a98d3){if(_0x3a98d3){return _0x3a98d3[_0x31af('0x2b')]()[_0x31af('0x2a')](function(){_0x40aa32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3832,_0x20a50c){return function(_0x2b3bad){if(!_0x2b3bad){_0x5d3832['sendStatus'](0x194);}return _0x2b3bad;};}function handleError(_0x4c958,_0x8f9f60){_0x8f9f60=_0x8f9f60||0x1f4;return function(_0x49812a){logger[_0x31af('0x2c')](_0x49812a[_0x31af('0x2d')]);if(_0x49812a['name']){delete _0x49812a[_0x31af('0x2e')];}_0x4c958[_0x31af('0x1e')](_0x8f9f60)[_0x31af('0x2f')](_0x49812a);};}exports[_0x31af('0x30')]=function(_0x3326a7,_0x5a1f41){var _0xb1f5b1={'raw':!![],'where':{'id':_0x3326a7[_0x31af('0x31')]['id']}},_0x3eb61f={};_0x3eb61f[_0x31af('0x32')]=_[_0x31af('0x33')](db[_0x31af('0x34')][_0x31af('0x35')]);_0x3eb61f[_0x31af('0x36')]=_[_0x31af('0x33')](_0x3326a7[_0x31af('0x36')]);_0x3eb61f[_0x31af('0x37')]=_[_0x31af('0x38')](_0x3eb61f['model'],_0x3eb61f[_0x31af('0x36')]);_0xb1f5b1[_0x31af('0x39')]=_['intersection'](_0x3eb61f['model'],qs['fields'](_0x3326a7[_0x31af('0x36')]['fields']));_0xb1f5b1[_0x31af('0x39')]=_0xb1f5b1[_0x31af('0x39')][_0x31af('0x3a')]?_0xb1f5b1[_0x31af('0x39')]:_0x3eb61f[_0x31af('0x32')];if(_0x3326a7[_0x31af('0x36')]['includeAll']){_0xb1f5b1[_0x31af('0x3b')]=[{'all':!![]}];}_0xb1f5b1=_[_0x31af('0x3c')]({},_0xb1f5b1,_0x3326a7[_0x31af('0x3d')]);return db[_0x31af('0x34')][_0x31af('0x3e')](_0xb1f5b1)[_0x31af('0x2a')](handleEntityNotFound(_0x5a1f41,null))[_0x31af('0x2a')](respondWithResult(_0x5a1f41,null))[_0x31af('0x3f')](handleError(_0x5a1f41,null));};exports['create']=function(_0x258645,_0x57af86){return db[_0x31af('0x34')][_0x31af('0x40')](_0x258645[_0x31af('0x41')],{})[_0x31af('0x2a')](respondWithResult(_0x57af86,0xc9))[_0x31af('0x3f')](handleError(_0x57af86,null));};exports['update']=function(_0x59efe4,_0x53bb6d){if(_0x59efe4[_0x31af('0x41')]['id']){delete _0x59efe4[_0x31af('0x41')]['id'];}return db[_0x31af('0x34')][_0x31af('0x3e')]({'where':{'id':_0x59efe4[_0x31af('0x31')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x53bb6d,null))[_0x31af('0x2a')](saveUpdates(_0x59efe4[_0x31af('0x41')],null))['then'](respondWithResult(_0x53bb6d,null))[_0x31af('0x3f')](handleError(_0x53bb6d,null));};exports[_0x31af('0x2b')]=function(_0x1b6a20,_0x2a5cde){return db[_0x31af('0x34')][_0x31af('0x3e')]({'where':{'id':_0x1b6a20[_0x31af('0x31')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x2a5cde,null))[_0x31af('0x2a')](removeEntity(_0x2a5cde,null))['catch'](handleError(_0x2a5cde,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 219e1ed..e580b39 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 _0x1c85=['../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x59911a,_0x50cee2){var _0x4e142e=function(_0x4ab147){while(--_0x4ab147){_0x59911a['push'](_0x59911a['shift']());}};_0x4e142e(++_0x50cee2);}(_0x1c85,0x1ee));var _0x51c8=function(_0x5d078d,_0x1cb590){_0x5d078d=_0x5d078d-0x0;var _0x45948a=_0x1c85[_0x5d078d];return _0x45948a;};'use strict';var _=require(_0x51c8('0x0'));var util=require(_0x51c8('0x1'));var logger=require(_0x51c8('0x2'))(_0x51c8('0x3'));var moment=require('moment');var BPromise=require(_0x51c8('0x4'));var rp=require(_0x51c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x51c8('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x51c8('0x7')]=function(_0x268869,_0x39b3c0){return _0x268869['define'](_0x51c8('0x8'),attributes,{'tableName':_0x51c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6db0=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x15cba8,_0x4f2264){var _0x2b80f5=function(_0x2ef83e){while(--_0x2ef83e){_0x15cba8['push'](_0x15cba8['shift']());}};_0x2b80f5(++_0x4f2264);}(_0x6db0,0xaa));var _0x06db=function(_0xab7744,_0x1411bf){_0xab7744=_0xab7744-0x0;var _0x465fff=_0x6db0[_0xab7744];return _0x465fff;};'use strict';var _=require(_0x06db('0x0'));var util=require(_0x06db('0x1'));var logger=require(_0x06db('0x2'))('api');var moment=require(_0x06db('0x3'));var BPromise=require('bluebird');var rp=require(_0x06db('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06db('0x5'));var config=require('../../config/environment');var attributes=require(_0x06db('0x6'));module[_0x06db('0x7')]=function(_0x5f00b4,_0x5bf7a1){return _0x5f00b4[_0x06db('0x8')](_0x06db('0x9'),attributes,{'tableName':_0x06db('0xa'),'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 2a371ee..28a94d4 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 _0xaf5e=['result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ccdbe,_0xabd011){var _0x3d6e09=function(_0x28fac5){while(--_0x28fac5){_0x3ccdbe['push'](_0x3ccdbe['shift']());}};_0x3d6e09(++_0xabd011);}(_0xaf5e,0x1e2));var _0xeaf5=function(_0x566b18,_0x534828){_0x566b18=_0x566b18-0x0;var _0x34d320=_0xaf5e[_0x566b18];return _0x34d320;};'use strict';var _=require(_0xeaf5('0x0'));var util=require(_0xeaf5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeaf5('0x2'));var db=require(_0xeaf5('0x3'))['db'];var utils=require(_0xeaf5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xeaf5('0x5'));var jayson=require(_0xeaf5('0x6'));var client=jayson[_0xeaf5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512c63,_0x31a93a,_0x283ba5){return new BPromise(function(_0x2d0e2c,_0x156ac5){return client['request'](_0x512c63,_0x283ba5)[_0xeaf5('0x8')](function(_0x4d249c){logger[_0xeaf5('0x9')](_0xeaf5('0xa'),_0x31a93a,_0xeaf5('0xb'));logger[_0xeaf5('0xc')](_0xeaf5('0xd'),_0x31a93a,_0xeaf5('0xb'),JSON[_0xeaf5('0xe')](_0x4d249c));if(_0x4d249c['error']){if(_0x4d249c[_0xeaf5('0xf')][_0xeaf5('0x10')]===0x1f4){logger[_0xeaf5('0xf')](_0xeaf5('0xa'),_0x31a93a,_0x4d249c[_0xeaf5('0xf')]['message']);return _0x156ac5(_0x4d249c[_0xeaf5('0xf')][_0xeaf5('0x11')]);}logger[_0xeaf5('0xf')](_0xeaf5('0xa'),_0x31a93a,_0x4d249c[_0xeaf5('0xf')][_0xeaf5('0x11')]);return _0x2d0e2c(_0x4d249c['error'][_0xeaf5('0x11')]);}else{logger[_0xeaf5('0x9')](_0xeaf5('0xa'),_0x31a93a,_0xeaf5('0xb'));_0x2d0e2c(_0x4d249c[_0xeaf5('0x12')][_0xeaf5('0x11')]);}})[_0xeaf5('0x13')](function(_0xfb4c8a){logger['error'](_0xeaf5('0xa'),_0x31a93a,_0xfb4c8a);_0x156ac5(_0xfb4c8a);});});} \ No newline at end of file +var _0x5a21=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x14a62c,_0x5c77e1){var _0x5bab14=function(_0xa6dc35){while(--_0xa6dc35){_0x14a62c['push'](_0x14a62c['shift']());}};_0x5bab14(++_0x5c77e1);}(_0x5a21,0x13f));var _0x15a2=function(_0x4ee695,_0x5a579b){_0x4ee695=_0x4ee695-0x0;var _0x165508=_0x5a21[_0x4ee695];return _0x165508;};'use strict';var _=require(_0x15a2('0x0'));var util=require(_0x15a2('0x1'));var moment=require(_0x15a2('0x2'));var BPromise=require(_0x15a2('0x3'));var rs=require(_0x15a2('0x4'));var fs=require('fs');var Redis=require(_0x15a2('0x5'));var db=require(_0x15a2('0x6'))['db'];var utils=require(_0x15a2('0x7'));var logger=require(_0x15a2('0x8'))('rpc');var config=require(_0x15a2('0x9'));var jayson=require(_0x15a2('0xa'));var client=jayson[_0x15a2('0xb')][_0x15a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4acbdb,_0x2a4210,_0x3ca566){return new BPromise(function(_0x3441f9,_0x9090a4){return client[_0x15a2('0xd')](_0x4acbdb,_0x3ca566)[_0x15a2('0xe')](function(_0x58217f){logger[_0x15a2('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a4210,_0x15a2('0x10'));logger[_0x15a2('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2a4210,'request\x20sent',JSON['stringify'](_0x58217f));if(_0x58217f[_0x15a2('0x12')]){if(_0x58217f['error']['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2a4210,_0x58217f[_0x15a2('0x12')][_0x15a2('0x13')]);return _0x9090a4(_0x58217f[_0x15a2('0x12')][_0x15a2('0x13')]);}logger[_0x15a2('0x12')](_0x15a2('0x14'),_0x2a4210,_0x58217f[_0x15a2('0x12')][_0x15a2('0x13')]);return _0x3441f9(_0x58217f[_0x15a2('0x12')][_0x15a2('0x13')]);}else{logger[_0x15a2('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2a4210,_0x15a2('0x10'));_0x3441f9(_0x58217f[_0x15a2('0x15')][_0x15a2('0x13')]);}})[_0x15a2('0x16')](function(_0x5d111e){logger[_0x15a2('0x12')](_0x15a2('0x14'),_0x2a4210,_0x5d111e);_0x9090a4(_0x5d111e);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d469e8c..3f6fa0d 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 _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x593245,_0x389f68){_0x593245=_0x593245-0x0;var _0x34ac09=_0xb4c7[_0x593245];return _0x34ac09;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x718cde,_0x20343f){var _0xdf36a3=function(_0xe2b91b){while(--_0xe2b91b){_0x718cde['push'](_0x718cde['shift']());}};_0xdf36a3(++_0x20343f);}(_0x032e,0x124));var _0xe032=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x032e[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index bf62e67..48731a3 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 _0x38ca=['ENUM','rrmemory','beepall','roundrobin'];(function(_0x41bc2b,_0x22aa30){var _0x712fec=function(_0x174dc7){while(--_0x174dc7){_0x41bc2b['push'](_0x41bc2b['shift']());}};_0x712fec(++_0x22aa30);}(_0x38ca,0x114));var _0xa38c=function(_0x3ab1ad,_0x267591){_0x3ab1ad=_0x3ab1ad-0x0;var _0x57ee2b=_0x38ca[_0x3ab1ad];return _0x57ee2b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa38c('0x0')](_0xa38c('0x1'),_0xa38c('0x2'),_0xa38c('0x3'))}}; \ No newline at end of file +var _0xb8b3=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x4ce5f3,_0x4f08ac){var _0x5537c2=function(_0x3547ec){while(--_0x3547ec){_0x4ce5f3['push'](_0x4ce5f3['shift']());}};_0x5537c2(++_0x4f08ac);}(_0xb8b3,0x16e));var _0x3b8b=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xb8b3[_0x2ed7d1];return _0x38ae3c;};'use strict';var Sequelize=require('sequelize');module[_0x3b8b('0x0')]={'name':{'type':Sequelize[_0x3b8b('0x1')],'unique':_0x3b8b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3b8b('0x1')]},'timeout':{'type':Sequelize[_0x3b8b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b8b('0x4')](_0x3b8b('0x5'),_0x3b8b('0x6'),_0x3b8b('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8bd5141..e4c7209 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 _0xc3f9=['userProfileId','autoAssociation','body','describe','getMembers','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','format','%s/%s','chatPause','createdAt','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','findOrCreate','emit','removeTeams','select','field','tq.TeamId','team_has_chat_queues','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find'];(function(_0x36d646,_0x50ecc5){var _0x2b37d6=function(_0x28e207){while(--_0x28e207){_0x36d646['push'](_0x36d646['shift']());}};_0x2b37d6(++_0x50ecc5);}(_0xc3f9,0xd0));var _0x9c3f=function(_0x108977,_0x22ec52){_0x108977=_0x108977-0x0;var _0x441ad5=_0xc3f9[_0x108977];return _0x441ad5;};'use strict';var emlformat=require(_0x9c3f('0x0'));var rimraf=require(_0x9c3f('0x1'));var zipdir=require(_0x9c3f('0x2'));var jsonpatch=require(_0x9c3f('0x3'));var rp=require(_0x9c3f('0x4'));var moment=require(_0x9c3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c3f('0x6'));var util=require(_0x9c3f('0x7'));var path=require(_0x9c3f('0x8'));var sox=require(_0x9c3f('0x9'));var csv=require(_0x9c3f('0xa'));var ejs=require(_0x9c3f('0xb'));var fs=require('fs');var fs_extra=require(_0x9c3f('0xc'));var _=require(_0x9c3f('0xd'));var squel=require(_0x9c3f('0xe'));var crypto=require(_0x9c3f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9c3f('0x10'));var toCsv=require(_0x9c3f('0xa'));var querystring=require(_0x9c3f('0x11'));var Papa=require(_0x9c3f('0x12'));var Redis=require('ioredis');var authService=require(_0x9c3f('0x13'));var qs=require(_0x9c3f('0x14'));var as=require(_0x9c3f('0x15'));var hardwareService=require(_0x9c3f('0x16'));var logger=require(_0x9c3f('0x17'))(_0x9c3f('0x18'));var utils=require('../../config/utils');var config=require(_0x9c3f('0x19'));var licenseUtil=require(_0x9c3f('0x1a'));var db=require(_0x9c3f('0x1b'))['db'];config['redis']=_[_0x9c3f('0x1c')](config[_0x9c3f('0x1d')],{'host':_0x9c3f('0x1e'),'port':0x18eb});var socket=require(_0x9c3f('0x1f'))(new Redis(config['redis']));require(_0x9c3f('0x20'))[_0x9c3f('0x21')](socket);var jayson=require(_0x9c3f('0x22'));var client=jayson[_0x9c3f('0x23')][_0x9c3f('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x4e9bc8,_0x583573,_0x1072dd,_0x4b8a51){return new BPromise(function(_0x2bad68,_0x3ba901){var _0x3c9ec5=_0x4b8a51||client;return _0x3c9ec5['request'](_0x4e9bc8,_0x1072dd)[_0x9c3f('0x25')](function(_0x5c22b6){logger[_0x9c3f('0x26')](_0x9c3f('0x27'),_0x583573,_0x9c3f('0x28'));logger[_0x9c3f('0x29')](_0x9c3f('0x2a'),_0x583573,_0x9c3f('0x28'),JSON['stringify'](_0x5c22b6));if(_0x5c22b6[_0x9c3f('0x2b')]){if(_0x5c22b6[_0x9c3f('0x2b')][_0x9c3f('0x2c')]===0x1f4){logger[_0x9c3f('0x2b')](_0x9c3f('0x27'),_0x583573,_0x5c22b6['error']['message']);return _0x3ba901(_0x5c22b6[_0x9c3f('0x2b')][_0x9c3f('0x2d')]);}logger[_0x9c3f('0x2b')](_0x9c3f('0x27'),_0x583573,_0x5c22b6[_0x9c3f('0x2b')][_0x9c3f('0x2d')]);return _0x2bad68(_0x5c22b6[_0x9c3f('0x2b')]['message']);}else{logger[_0x9c3f('0x26')](_0x9c3f('0x27'),_0x583573,_0x9c3f('0x28'));_0x2bad68(_0x5c22b6[_0x9c3f('0x2e')][_0x9c3f('0x2d')]);}})[_0x9c3f('0x2f')](function(_0x28c1db){logger[_0x9c3f('0x2b')](_0x9c3f('0x27'),_0x583573,_0x28c1db);_0x3ba901(_0x28c1db);});});}function respondWithStatusCode(_0x19072b,_0xc0b5f4){_0xc0b5f4=_0xc0b5f4||0xcc;return function(_0x302092){if(_0x302092){return _0x19072b['sendStatus'](_0xc0b5f4);}return _0x19072b[_0x9c3f('0x30')](_0xc0b5f4)['end']();};}function respondWithResult(_0x30504c,_0x380a26){_0x380a26=_0x380a26||0xc8;return function(_0x334660){if(_0x334660){return _0x30504c[_0x9c3f('0x30')](_0x380a26)[_0x9c3f('0x31')](_0x334660);}};}function respondWithFilteredResult(_0x4b7550,_0x14439b){return function(_0x4bcb6f){if(_0x4bcb6f){var _0x34139a=typeof _0x14439b['offset']===_0x9c3f('0x32')&&typeof _0x14439b[_0x9c3f('0x33')]==='undefined';var _0x35e6d8=_0x4bcb6f['count'];var _0x509a27=_0x34139a?0x0:_0x14439b[_0x9c3f('0x34')];var _0x2ae502=_0x34139a?_0x4bcb6f[_0x9c3f('0x35')]:_0x14439b['offset']+_0x14439b[_0x9c3f('0x33')];var _0x4387c1;if(_0x2ae502>=_0x35e6d8){_0x2ae502=_0x35e6d8;_0x4387c1=0xc8;}else{_0x4387c1=0xce;}_0x4b7550[_0x9c3f('0x30')](_0x4387c1);return _0x4b7550[_0x9c3f('0x36')](_0x9c3f('0x37'),_0x509a27+'-'+_0x2ae502+'/'+_0x35e6d8)[_0x9c3f('0x31')](_0x4bcb6f);}return null;};}function patchUpdates(_0x3adf0a){return function(_0x404f38){try{jsonpatch[_0x9c3f('0x38')](_0x404f38,_0x3adf0a,!![]);}catch(_0x189c6e){return BPromise[_0x9c3f('0x39')](_0x189c6e);}return _0x404f38[_0x9c3f('0x3a')]();};}function saveUpdates(_0x21d2f8,_0xd8ce4b){return function(_0x19ff09){if(_0x19ff09){return _0x19ff09[_0x9c3f('0x3b')](_0x21d2f8)[_0x9c3f('0x25')](function(_0x49f1f4){return _0x49f1f4;});}return null;};}function removeEntity(_0x5232cf,_0x55c0b3){return function(_0x11a4b9){if(_0x11a4b9){return _0x11a4b9[_0x9c3f('0x3c')]()[_0x9c3f('0x25')](function(){var _0x37868d=_0x11a4b9[_0x9c3f('0x3d')]({'plain':!![]});var _0x3460bc=_0x9c3f('0x3e');return db[_0x9c3f('0x3f')]['destroy']({'where':{'type':_0x3460bc,'resourceId':_0x37868d['id']}})[_0x9c3f('0x25')](function(){return _0x11a4b9;});})[_0x9c3f('0x25')](function(){_0x5232cf[_0x9c3f('0x30')](0xcc)[_0x9c3f('0x40')]();});}};}function handleEntityNotFound(_0x53428a,_0x209480){return function(_0x7108f){if(!_0x7108f){_0x53428a['sendStatus'](0x194);}return _0x7108f;};}function handleError(_0x5443a7,_0x4af659){_0x4af659=_0x4af659||0x1f4;return function(_0x1acf34){logger[_0x9c3f('0x2b')](_0x1acf34[_0x9c3f('0x41')]);if(_0x1acf34[_0x9c3f('0x42')]){delete _0x1acf34[_0x9c3f('0x42')];}_0x5443a7[_0x9c3f('0x30')](_0x4af659)[_0x9c3f('0x43')](_0x1acf34);};}exports[_0x9c3f('0x44')]=function(_0x5d41fc,_0x193e3e){var _0x409148={},_0x1cac72={},_0x53111b={'count':0x0,'rows':[]};var _0x4e5b6d=_[_0x9c3f('0x45')](db[_0x9c3f('0x46')][_0x9c3f('0x47')],function(_0x1ac0be){return{'name':_0x1ac0be['fieldName'],'type':_0x1ac0be[_0x9c3f('0x48')][_0x9c3f('0x49')]};});_0x1cac72[_0x9c3f('0x4a')]=_['map'](_0x4e5b6d,_0x9c3f('0x42'));_0x1cac72['query']=_[_0x9c3f('0x4b')](_0x5d41fc[_0x9c3f('0x4c')]);_0x1cac72[_0x9c3f('0x4d')]=_[_0x9c3f('0x4e')](_0x1cac72['model'],_0x1cac72[_0x9c3f('0x4c')]);_0x409148[_0x9c3f('0x4f')]=_[_0x9c3f('0x4e')](_0x1cac72[_0x9c3f('0x4a')],qs[_0x9c3f('0x50')](_0x5d41fc[_0x9c3f('0x4c')][_0x9c3f('0x50')]));_0x409148[_0x9c3f('0x4f')]=_0x409148[_0x9c3f('0x4f')][_0x9c3f('0x51')]?_0x409148[_0x9c3f('0x4f')]:_0x1cac72[_0x9c3f('0x4a')];if(!_0x5d41fc[_0x9c3f('0x4c')][_0x9c3f('0x52')](_0x9c3f('0x53'))){_0x409148[_0x9c3f('0x33')]=qs['limit'](_0x5d41fc['query'][_0x9c3f('0x33')]);_0x409148['offset']=qs[_0x9c3f('0x34')](_0x5d41fc['query'][_0x9c3f('0x34')]);}_0x409148[_0x9c3f('0x54')]=qs[_0x9c3f('0x55')](_0x5d41fc[_0x9c3f('0x4c')]['sort']);_0x409148['where']=qs[_0x9c3f('0x4d')](_[_0x9c3f('0x56')](_0x5d41fc[_0x9c3f('0x4c')],_0x1cac72[_0x9c3f('0x4d')]),_0x4e5b6d);if(_0x5d41fc['query'][_0x9c3f('0x57')]){_0x409148[_0x9c3f('0x58')]=_[_0x9c3f('0x59')](_0x409148[_0x9c3f('0x58')],{'$or':_[_0x9c3f('0x45')](_0x4e5b6d,function(_0x236d11){if(_0x236d11['type']!=='VIRTUAL'){var _0x2074f1={};_0x2074f1[_0x236d11['name']]={'$like':'%'+_0x5d41fc['query']['filter']+'%'};return _0x2074f1;}})});}_0x409148=_[_0x9c3f('0x59')]({},_0x409148,_0x5d41fc[_0x9c3f('0x5a')]);var _0x306b9e={'where':_0x409148[_0x9c3f('0x58')]};return db['ChatQueue']['count'](_0x306b9e)[_0x9c3f('0x25')](function(_0x17d79a){_0x53111b[_0x9c3f('0x35')]=_0x17d79a;if(_0x5d41fc[_0x9c3f('0x4c')][_0x9c3f('0x5b')]){_0x409148['include']=[{'all':!![]}];}return db[_0x9c3f('0x46')][_0x9c3f('0x5c')](_0x409148);})[_0x9c3f('0x25')](function(_0xe802f4){_0x53111b[_0x9c3f('0x5d')]=_0xe802f4;return _0x53111b;})['then'](respondWithFilteredResult(_0x193e3e,_0x409148))[_0x9c3f('0x2f')](handleError(_0x193e3e,null));};exports[_0x9c3f('0x5e')]=function(_0x6c6e7c,_0x3be2ed){var _0x50e2d0={'raw':!![],'where':{'id':_0x6c6e7c[_0x9c3f('0x5f')]['id']}},_0x10147e={};_0x10147e[_0x9c3f('0x4a')]=_['keys'](db[_0x9c3f('0x46')][_0x9c3f('0x47')]);_0x10147e[_0x9c3f('0x4c')]=_['keys'](_0x6c6e7c[_0x9c3f('0x4c')]);_0x10147e[_0x9c3f('0x4d')]=_['intersection'](_0x10147e['model'],_0x10147e[_0x9c3f('0x4c')]);_0x50e2d0['attributes']=_['intersection'](_0x10147e[_0x9c3f('0x4a')],qs[_0x9c3f('0x50')](_0x6c6e7c[_0x9c3f('0x4c')][_0x9c3f('0x50')]));_0x50e2d0['attributes']=_0x50e2d0[_0x9c3f('0x4f')][_0x9c3f('0x51')]?_0x50e2d0[_0x9c3f('0x4f')]:_0x10147e[_0x9c3f('0x4a')];if(_0x6c6e7c[_0x9c3f('0x4c')]['includeAll']){_0x50e2d0[_0x9c3f('0x60')]=[{'all':!![]}];}_0x50e2d0=_['merge']({},_0x50e2d0,_0x6c6e7c[_0x9c3f('0x5a')]);return db[_0x9c3f('0x46')]['find'](_0x50e2d0)[_0x9c3f('0x25')](handleEntityNotFound(_0x3be2ed,null))[_0x9c3f('0x25')](respondWithResult(_0x3be2ed,null))[_0x9c3f('0x2f')](handleError(_0x3be2ed,null));};exports[_0x9c3f('0x61')]=function(_0x442e7a,_0x3ae916){return db['ChatQueue'][_0x9c3f('0x61')](_0x442e7a['body'],{})['then'](function(_0x1058b0){var _0x290c25=_0x442e7a['user'][_0x9c3f('0x3d')]({'plain':!![]});if(!_0x290c25)throw new Error(_0x9c3f('0x62'));if(_0x290c25['role']===_0x9c3f('0x63')){var _0x5b93bd=_0x1058b0[_0x9c3f('0x3d')]({'plain':!![]});var _0xc96fed='ChatQueues';return db[_0x9c3f('0x64')][_0x9c3f('0x65')]({'where':{'name':_0xc96fed,'userProfileId':_0x290c25[_0x9c3f('0x66')]},'raw':!![]})[_0x9c3f('0x25')](function(_0x3cb128){if(_0x3cb128&&_0x3cb128[_0x9c3f('0x67')]===0x0){return db[_0x9c3f('0x3f')]['create']({'name':_0x5b93bd['name'],'resourceId':_0x5b93bd['id'],'type':_0x3cb128['name'],'sectionId':_0x3cb128['id']},{})[_0x9c3f('0x25')](function(){return _0x1058b0;});}else{return _0x1058b0;}})[_0x9c3f('0x2f')](function(_0x3a0571){logger[_0x9c3f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a0571);throw _0x3a0571;});}return _0x1058b0;})[_0x9c3f('0x25')](respondWithResult(_0x3ae916,0xc9))[_0x9c3f('0x2f')](handleError(_0x3ae916,null));};exports['update']=function(_0x48181c,_0x38b443){if(_0x48181c[_0x9c3f('0x68')]['id']){delete _0x48181c[_0x9c3f('0x68')]['id'];}return db[_0x9c3f('0x46')]['find']({'where':{'id':_0x48181c[_0x9c3f('0x5f')]['id']}})[_0x9c3f('0x25')](handleEntityNotFound(_0x38b443,null))[_0x9c3f('0x25')](saveUpdates(_0x48181c['body'],null))['then'](respondWithResult(_0x38b443,null))['catch'](handleError(_0x38b443,null));};exports[_0x9c3f('0x3c')]=function(_0x407aca,_0x552161){return db[_0x9c3f('0x46')][_0x9c3f('0x65')]({'where':{'id':_0x407aca[_0x9c3f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x552161,null))[_0x9c3f('0x25')](removeEntity(_0x552161,null))[_0x9c3f('0x2f')](handleError(_0x552161,null));};exports[_0x9c3f('0x69')]=function(_0x5ea475,_0x65049f){return db['ChatQueue']['describe']()['then'](respondWithResult(_0x65049f,null))['catch'](handleError(_0x65049f,null));};exports[_0x9c3f('0x6a')]=function(_0x4b8b2b,_0x1dff6d,_0x9083f7){var _0x3126c0={'raw':!![],'where':{}},_0x155557={},_0x1d5f48;return db[_0x9c3f('0x46')]['findOne']({'where':{'id':_0x4b8b2b[_0x9c3f('0x5f')]['id']}})[_0x9c3f('0x25')](handleEntityNotFound(_0x1dff6d,null))[_0x9c3f('0x25')](function(_0x4ec9e1){if(_0x4ec9e1){_0x1d5f48=_0x4ec9e1[_0x9c3f('0x3d')]({'plain':!![]});_0x155557[_0x9c3f('0x4a')]=_[_0x9c3f('0x4b')](db[_0x9c3f('0x6b')][_0x9c3f('0x47')]);_0x155557[_0x9c3f('0x4c')]=_['keys'](_0x4b8b2b[_0x9c3f('0x4c')]);_0x155557[_0x9c3f('0x4d')]=_['intersection'](_0x155557[_0x9c3f('0x4a')],_0x155557[_0x9c3f('0x4c')]);_0x3126c0['attributes']=_[_0x9c3f('0x4e')](_0x155557[_0x9c3f('0x4a')],qs['fields'](_0x4b8b2b[_0x9c3f('0x4c')][_0x9c3f('0x50')]));_0x3126c0[_0x9c3f('0x4f')]=_0x3126c0[_0x9c3f('0x4f')][_0x9c3f('0x51')]?_0x3126c0[_0x9c3f('0x4f')]:_0x155557[_0x9c3f('0x4a')];if(!_0x4b8b2b[_0x9c3f('0x4c')][_0x9c3f('0x52')]('nolimit')){_0x3126c0['limit']=qs[_0x9c3f('0x33')](_0x4b8b2b[_0x9c3f('0x4c')][_0x9c3f('0x33')]);_0x3126c0[_0x9c3f('0x34')]=qs['offset'](_0x4b8b2b[_0x9c3f('0x4c')][_0x9c3f('0x34')]);}_0x3126c0[_0x9c3f('0x54')]=qs[_0x9c3f('0x55')](_0x4b8b2b['query'][_0x9c3f('0x55')]);_0x3126c0[_0x9c3f('0x58')]=qs[_0x9c3f('0x4d')](_[_0x9c3f('0x56')](_0x4b8b2b[_0x9c3f('0x4c')],_0x155557['filters']));_0x3126c0[_0x9c3f('0x58')][_0x9c3f('0x6c')]=_0x4ec9e1['id'];if(_0x4b8b2b[_0x9c3f('0x4c')]['filter']){_0x3126c0[_0x9c3f('0x58')]=_[_0x9c3f('0x59')](_0x3126c0['where'],{'$or':_['map'](_0x3126c0['attributes'],function(_0x19aa10){var _0x36f514={};_0x36f514[_0x19aa10]={'$like':'%'+_0x4b8b2b[_0x9c3f('0x4c')][_0x9c3f('0x57')]+'%'};return _0x36f514;})});}_0x3126c0=_[_0x9c3f('0x59')]({},_0x3126c0,_0x4b8b2b[_0x9c3f('0x5a')]);return db[_0x9c3f('0x6b')][_0x9c3f('0x5c')](_0x3126c0);}})[_0x9c3f('0x25')](function(_0x267f00){if(_0x267f00){return db['User'][_0x9c3f('0x6d')]({'where':{'id':_['map'](_0x267f00,_0x9c3f('0x6e')),'role':_0x9c3f('0x6f')},'attributes':['id',_0x9c3f('0x42'),'chatPause','updatedAt','createdAt']});}})[_0x9c3f('0x25')](function(_0x57f173){if(_0x57f173){return{'count':_0x57f173[_0x9c3f('0x35')],'rows':_[_0x9c3f('0x45')](_0x57f173[_0x9c3f('0x5d')],function(_0x142d72){return{'membername':_0x142d72[_0x9c3f('0x42')],'UserId':_0x142d72['id'],'queue_name':_0x1d5f48[_0x9c3f('0x42')],'ChatQueueId':_0x1d5f48['id'],'interface':util[_0x9c3f('0x70')](_0x9c3f('0x71'),'SIP',_0x142d72[_0x9c3f('0x42')]),'penalty':0x0,'paused':_0x142d72[_0x9c3f('0x72')],'createdAt':_0x142d72[_0x9c3f('0x73')],'updatedAt':_0x142d72['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9c3f('0x25')](respondWithFilteredResult(_0x1dff6d,_0x3126c0))['catch'](handleError(_0x1dff6d,null));};exports[_0x9c3f('0x74')]=function(_0x2934d5,_0x540b75,_0x207171){var _0x446893={};var _0x49ba91={};var _0x24f3e8;var _0x3bc9f8;return db['ChatQueue'][_0x9c3f('0x75')]({'where':{'id':_0x2934d5[_0x9c3f('0x5f')]['id']}})[_0x9c3f('0x25')](handleEntityNotFound(_0x540b75,null))[_0x9c3f('0x25')](function(_0x3bf40e){if(_0x3bf40e){_0x24f3e8=_0x3bf40e;_0x49ba91[_0x9c3f('0x4a')]=_[_0x9c3f('0x4b')](db[_0x9c3f('0x76')][_0x9c3f('0x47')]);_0x49ba91[_0x9c3f('0x4c')]=_[_0x9c3f('0x4b')](_0x2934d5[_0x9c3f('0x4c')]);_0x49ba91['filters']=_[_0x9c3f('0x4e')](_0x49ba91[_0x9c3f('0x4a')],_0x49ba91[_0x9c3f('0x4c')]);_0x446893[_0x9c3f('0x4f')]=_[_0x9c3f('0x4e')](_0x49ba91['model'],qs[_0x9c3f('0x50')](_0x2934d5[_0x9c3f('0x4c')][_0x9c3f('0x50')]));_0x446893[_0x9c3f('0x4f')]=_0x446893['attributes'][_0x9c3f('0x51')]?_0x446893[_0x9c3f('0x4f')]:_0x49ba91[_0x9c3f('0x4a')];_0x446893[_0x9c3f('0x54')]=qs[_0x9c3f('0x55')](_0x2934d5[_0x9c3f('0x4c')]['sort']);_0x446893[_0x9c3f('0x58')]=qs[_0x9c3f('0x4d')](_[_0x9c3f('0x56')](_0x2934d5[_0x9c3f('0x4c')],_0x49ba91[_0x9c3f('0x4d')]));if(_0x2934d5[_0x9c3f('0x4c')][_0x9c3f('0x57')]){_0x446893[_0x9c3f('0x58')]=_['merge'](_0x446893[_0x9c3f('0x58')],{'$or':_[_0x9c3f('0x45')](_0x446893[_0x9c3f('0x4f')],function(_0xf88acd){var _0x214c40={};_0x214c40[_0xf88acd]={'$like':'%'+_0x2934d5['query']['filter']+'%'};return _0x214c40;})});}_0x446893=_[_0x9c3f('0x59')]({},_0x446893,_0x2934d5['options']);return _0x24f3e8[_0x9c3f('0x74')](_0x446893);}})[_0x9c3f('0x25')](function(_0x3173c4){if(_0x3173c4){_0x3bc9f8=_0x3173c4['length'];if(!_0x2934d5['query']['hasOwnProperty']('nolimit')){_0x446893[_0x9c3f('0x33')]=qs[_0x9c3f('0x33')](_0x2934d5[_0x9c3f('0x4c')][_0x9c3f('0x33')]);_0x446893[_0x9c3f('0x34')]=qs[_0x9c3f('0x34')](_0x2934d5[_0x9c3f('0x4c')]['offset']);}return _0x24f3e8[_0x9c3f('0x74')](_0x446893);}})[_0x9c3f('0x25')](function(_0x47ef7f){if(_0x47ef7f){return _0x47ef7f?{'count':_0x3bc9f8,'rows':_0x47ef7f}:null;}})[_0x9c3f('0x25')](respondWithResult(_0x540b75,null))[_0x9c3f('0x2f')](handleError(_0x540b75,null));};exports[_0x9c3f('0x77')]=function(_0x53c266,_0x32af94,_0x3b6935){var _0x4a203c=_0x53c266['body'][_0x9c3f('0x78')];return db['Team'][_0x9c3f('0x5c')]({'where':{'id':_0x4a203c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9c3f('0x42'),_0x9c3f('0x79'),_0x9c3f('0x7a'),_0x9c3f('0x7b')],'raw':!![]}]})['then'](function(_0x2575ef){if(_0x2575ef){var _0x5c5a0d=_[_0x9c3f('0x7c')](_0x2575ef,function(_0x3afddc){var _0x33827b=_0x3afddc[_0x9c3f('0x3d')]({'plain':!![]});return _0x33827b[_0x9c3f('0x7d')];});return db[_0x9c3f('0x46')][_0x9c3f('0x65')]({'where':{'id':_0x53c266[_0x9c3f('0x5f')]['id']}})['then'](function(_0x4a47eb){return db[_0x9c3f('0x7e')]['transaction'](function(_0x4266ef){return _0x4a47eb[_0x9c3f('0x77')](_0x4a203c,{'transaction':_0x4266ef})[_0x9c3f('0x25')](function(){return BPromise['each'](_0x5c5a0d,function(_0x11b85f){return db[_0x9c3f('0x6b')][_0x9c3f('0x7f')]({'where':{'UserId':_0x11b85f['id'],'ChatQueueId':_0x53c266['params']['id']},'transaction':_0x4266ef});});})[_0x9c3f('0x25')](function(){_0x5c5a0d['forEach'](function(_0x4ed564){socket[_0x9c3f('0x80')]('userChatQueue:save',{'UserId':_0x4ed564['id'],'ChatQueueId':_0x4a47eb['id']});});});});});}})['then'](respondWithStatusCode(_0x32af94,null))[_0x9c3f('0x2f')](handleError(_0x32af94,null));};exports[_0x9c3f('0x81')]=function(_0x487ef0,_0x5834b7,_0x37f4f8){return db['Team'][_0x9c3f('0x5c')]({'where':{'id':_0x487ef0['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9c3f('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x9c3f('0x25')](handleEntityNotFound(_0x5834b7,null))[_0x9c3f('0x25')](function(_0x31f1f2){var _0x131157=_[_0x9c3f('0x45')](_0x31f1f2,'id');var _0x1af3f7=[];var _0x8c02f5=[];var _0x396ba5=squel[_0x9c3f('0x82')]();_0x396ba5[_0x9c3f('0x83')](_0x9c3f('0x84'))['from'](_0x9c3f('0x85'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9c3f('0x58')](_0x9c3f('0x86'),_0x487ef0[_0x9c3f('0x5f')]['id']);for(var _0x4a9181=0x0;_0x4a9181<_0x31f1f2[_0x9c3f('0x51')];_0x4a9181+=0x1){let _0x9e0055=_0x31f1f2[_0x4a9181];for(var _0x4281be=0x0;_0x4281be<_0x9e0055[_0x9c3f('0x7d')]['length'];_0x4281be+=0x1){let _0x4fcba9=_0x9e0055[_0x9c3f('0x7d')][_0x4281be];var _0x165dd3=_0x396ba5['clone']();_0x165dd3[_0x9c3f('0x58')](_0x9c3f('0x87'),_0x4fcba9['id']);_0x8c02f5['push'](db['sequelize'][_0x9c3f('0x4c')](_0x165dd3[_0x9c3f('0x88')](),{'type':db[_0x9c3f('0x7e')][_0x9c3f('0x89')]['SELECT']})['then'](function(_0x14289d){if(_0x14289d[_0x9c3f('0x51')]===0x1){return _0x4fcba9['id'];}else{var _0x5b25f0=_[_0x9c3f('0x8a')](_[_0x9c3f('0x45')](_0x14289d,'TeamId'),function(_0x2cdc44){return _['includes'](_0x131157,_0x2cdc44);});if(_0x5b25f0){return _0x4fcba9['id'];}}}));}}return BPromise[_0x9c3f('0x8b')](_0x8c02f5)[_0x9c3f('0x25')](function(_0x1a38b6){_0x1af3f7=_(_0x1af3f7)[_0x9c3f('0x8c')](_0x1a38b6)[_0x9c3f('0x8d')]()[_0x9c3f('0x8e')]();return db[_0x9c3f('0x46')][_0x9c3f('0x65')]({'where':{'id':_0x487ef0['params']['id']}})[_0x9c3f('0x25')](function(_0x3606a0){return db[_0x9c3f('0x7e')][_0x9c3f('0x8f')](function(_0x40445d){return _0x3606a0[_0x9c3f('0x81')](_0x487ef0[_0x9c3f('0x4c')][_0x9c3f('0x78')],{'transaction':_0x40445d})['then'](function(){if(!_[_0x9c3f('0x90')](_0x1af3f7)){return _0x3606a0[_0x9c3f('0x91')](_0x1af3f7,{'transaction':_0x40445d});}})[_0x9c3f('0x25')](function(){_0x1af3f7[_0x9c3f('0x92')](function(_0x5a54af){socket['emit'](_0x9c3f('0x93'),{'UserId':_0x5a54af,'ChatQueueId':_0x3606a0['id']});});});});});});})[_0x9c3f('0x25')](respondWithStatusCode(_0x5834b7,null))['catch'](handleError(_0x5834b7,null));};exports[_0x9c3f('0x94')]=function(_0x15ab76,_0x5284e3,_0x3d557f){return db[_0x9c3f('0x46')][_0x9c3f('0x65')]({'where':{'id':_0x15ab76['params']['id']}})[_0x9c3f('0x25')](handleEntityNotFound(_0x5284e3,null))[_0x9c3f('0x25')](function(_0x1af495){if(_0x1af495){return _0x1af495[_0x9c3f('0x94')](_0x15ab76[_0x9c3f('0x68')][_0x9c3f('0x78')],_[_0x9c3f('0x95')](_0x15ab76[_0x9c3f('0x68')],[_0x9c3f('0x78'),'id'])||{})[_0x9c3f('0x96')](function(_0x1906d9){for(var _0x5ec285=0x0;_0x5ec285<_0x15ab76['body'][_0x9c3f('0x78')]['length'];_0x5ec285+=0x1){socket[_0x9c3f('0x80')](_0x9c3f('0x97'),{'UserId':Number(_0x15ab76[_0x9c3f('0x68')]['ids'][_0x5ec285]),'ChatQueueId':Number(_0x15ab76[_0x9c3f('0x5f')]['id'])});}return _0x1906d9;});}})[_0x9c3f('0x25')](respondWithResult(_0x5284e3,null))[_0x9c3f('0x2f')](handleError(_0x5284e3,null));};exports[_0x9c3f('0x91')]=function(_0x131c18,_0xac63c1,_0x4e70a8){return db[_0x9c3f('0x46')]['find']({'where':{'id':_0x131c18[_0x9c3f('0x5f')]['id']}})[_0x9c3f('0x25')](handleEntityNotFound(_0xac63c1,null))[_0x9c3f('0x25')](function(_0x211097){if(_0x211097){return _0x211097[_0x9c3f('0x91')](_0x131c18[_0x9c3f('0x4c')][_0x9c3f('0x78')])['then'](function(){if(_[_0x9c3f('0x98')](_0x131c18[_0x9c3f('0x4c')][_0x9c3f('0x78')])){for(var _0x32673a=0x0;_0x32673a<_0x131c18[_0x9c3f('0x4c')][_0x9c3f('0x78')][_0x9c3f('0x51')];_0x32673a+=0x1){socket[_0x9c3f('0x80')](_0x9c3f('0x93'),{'UserId':Number(_0x131c18[_0x9c3f('0x4c')][_0x9c3f('0x78')][_0x32673a]),'ChatQueueId':Number(_0x131c18[_0x9c3f('0x5f')]['id'])});}}else{socket[_0x9c3f('0x80')](_0x9c3f('0x93'),{'UserId':Number(_0x131c18[_0x9c3f('0x4c')]['ids']),'ChatQueueId':Number(_0x131c18['params']['id'])});}});}})[_0x9c3f('0x25')](respondWithStatusCode(_0xac63c1,null))[_0x9c3f('0x2f')](handleError(_0xac63c1,null));};exports[_0x9c3f('0x99')]=function(_0x295168,_0x148aa7,_0x37fe96){var _0x1bd606={};var _0x5e3747={};var _0x37b293;var _0x3359b7;return db[_0x9c3f('0x46')][_0x9c3f('0x75')]({'where':{'id':_0x295168[_0x9c3f('0x5f')]['id']}})[_0x9c3f('0x25')](handleEntityNotFound(_0x148aa7,null))[_0x9c3f('0x25')](function(_0x48fefd){if(_0x48fefd){_0x37b293=_0x48fefd;_0x5e3747['model']=_[_0x9c3f('0x4b')](db[_0x9c3f('0x9a')][_0x9c3f('0x47')]);_0x5e3747[_0x9c3f('0x4c')]=_['keys'](_0x295168['query']);_0x5e3747['filters']=_[_0x9c3f('0x4e')](_0x5e3747[_0x9c3f('0x4a')],_0x5e3747[_0x9c3f('0x4c')]);_0x1bd606[_0x9c3f('0x4f')]=_[_0x9c3f('0x4e')](_0x5e3747[_0x9c3f('0x4a')],qs[_0x9c3f('0x50')](_0x295168[_0x9c3f('0x4c')][_0x9c3f('0x50')]));_0x1bd606[_0x9c3f('0x4f')]=_0x1bd606[_0x9c3f('0x4f')][_0x9c3f('0x51')]?_0x1bd606[_0x9c3f('0x4f')]:_0x5e3747['model'];_0x1bd606[_0x9c3f('0x54')]=qs[_0x9c3f('0x55')](_0x295168[_0x9c3f('0x4c')][_0x9c3f('0x55')]);_0x1bd606[_0x9c3f('0x58')]=qs[_0x9c3f('0x4d')](_[_0x9c3f('0x56')](_0x295168[_0x9c3f('0x4c')],_0x5e3747[_0x9c3f('0x4d')]));if(_0x295168['query']['filter']){_0x1bd606[_0x9c3f('0x58')]=_[_0x9c3f('0x59')](_0x1bd606[_0x9c3f('0x58')],{'$or':_['map'](_0x1bd606[_0x9c3f('0x4f')],function(_0x32e189){var _0x5d98b3={};_0x5d98b3[_0x32e189]={'$like':'%'+_0x295168[_0x9c3f('0x4c')]['filter']+'%'};return _0x5d98b3;})});}_0x1bd606=_[_0x9c3f('0x59')]({},_0x1bd606,_0x295168[_0x9c3f('0x5a')]);return _0x37b293['getAgents'](_0x1bd606);}})[_0x9c3f('0x25')](function(_0x19aaf5){if(_0x19aaf5){_0x3359b7=_0x19aaf5['length'];if(!_0x295168[_0x9c3f('0x4c')]['hasOwnProperty']('nolimit')){_0x1bd606[_0x9c3f('0x33')]=qs[_0x9c3f('0x33')](_0x295168[_0x9c3f('0x4c')][_0x9c3f('0x33')]);_0x1bd606['offset']=qs['offset'](_0x295168['query']['offset']);}return _0x37b293[_0x9c3f('0x99')](_0x1bd606);}})[_0x9c3f('0x25')](function(_0x3966fc){if(_0x3966fc){return _0x3966fc?{'count':_0x3359b7,'rows':_0x3966fc}:null;}})['then'](respondWithResult(_0x148aa7,null))[_0x9c3f('0x2f')](handleError(_0x148aa7,null));}; \ No newline at end of file +var _0xaf21=['findAll','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','userChatQueue:remove','rawAttributes','getAgents','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','ChatQueues','UserProfileResource','stack','name','index','ChatQueue','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','intersection','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','find','describe','getMembers','UserChatQueue','User','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','findOne','Team','getTeams','nolimit','addTeams','ids'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaf21,0x154));var _0x1af2=function(_0x1b80ee,_0x393e5f){_0x1b80ee=_0x1b80ee-0x0;var _0x4c0355=_0xaf21[_0x1b80ee];return _0x4c0355;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1af2('0x0'));var jsonpatch=require(_0x1af2('0x1'));var rp=require(_0x1af2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1af2('0x3'));var util=require(_0x1af2('0x4'));var path=require(_0x1af2('0x5'));var sox=require(_0x1af2('0x6'));var csv=require('to-csv');var ejs=require(_0x1af2('0x7'));var fs=require('fs');var fs_extra=require(_0x1af2('0x8'));var _=require(_0x1af2('0x9'));var squel=require(_0x1af2('0xa'));var crypto=require(_0x1af2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1af2('0xc'));var querystring=require('querystring');var Papa=require(_0x1af2('0xd'));var Redis=require('ioredis');var authService=require(_0x1af2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1af2('0xf'));var hardwareService=require(_0x1af2('0x10'));var logger=require(_0x1af2('0x11'))(_0x1af2('0x12'));var utils=require(_0x1af2('0x13'));var config=require(_0x1af2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1af2('0x15'))['db'];config[_0x1af2('0x16')]=_['defaults'](config[_0x1af2('0x16')],{'host':_0x1af2('0x17'),'port':0x18eb});var socket=require(_0x1af2('0x18'))(new Redis(config[_0x1af2('0x16')]));require(_0x1af2('0x19'))['register'](socket);var jayson=require(_0x1af2('0x1a'));var client=jayson[_0x1af2('0x1b')][_0x1af2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xb50d2,_0x15cc49,_0x1ab64f,_0x372a78){return new BPromise(function(_0x2801ab,_0x2caba7){var _0x2a17a8=_0x372a78||client;return _0x2a17a8['request'](_0xb50d2,_0x1ab64f)['then'](function(_0x5137c6){logger[_0x1af2('0x1d')](_0x1af2('0x1e'),_0x15cc49,'request\x20sent');logger[_0x1af2('0x1f')](_0x1af2('0x20'),_0x15cc49,_0x1af2('0x21'),JSON[_0x1af2('0x22')](_0x5137c6));if(_0x5137c6[_0x1af2('0x23')]){if(_0x5137c6['error'][_0x1af2('0x24')]===0x1f4){logger[_0x1af2('0x23')]('ChatQueue,\x20%s,\x20%s',_0x15cc49,_0x5137c6[_0x1af2('0x23')]['message']);return _0x2caba7(_0x5137c6[_0x1af2('0x23')][_0x1af2('0x25')]);}logger['error'](_0x1af2('0x1e'),_0x15cc49,_0x5137c6[_0x1af2('0x23')][_0x1af2('0x25')]);return _0x2801ab(_0x5137c6[_0x1af2('0x23')][_0x1af2('0x25')]);}else{logger[_0x1af2('0x1d')](_0x1af2('0x1e'),_0x15cc49,_0x1af2('0x21'));_0x2801ab(_0x5137c6[_0x1af2('0x26')]['message']);}})[_0x1af2('0x27')](function(_0x3688c3){logger['error'](_0x1af2('0x1e'),_0x15cc49,_0x3688c3);_0x2caba7(_0x3688c3);});});}function respondWithStatusCode(_0x432b22,_0x460be8){_0x460be8=_0x460be8||0xcc;return function(_0x31ec33){if(_0x31ec33){return _0x432b22[_0x1af2('0x28')](_0x460be8);}return _0x432b22[_0x1af2('0x29')](_0x460be8)[_0x1af2('0x2a')]();};}function respondWithResult(_0x2ab26e,_0x54812b){_0x54812b=_0x54812b||0xc8;return function(_0x1f1a1b){if(_0x1f1a1b){return _0x2ab26e[_0x1af2('0x29')](_0x54812b)[_0x1af2('0x2b')](_0x1f1a1b);}};}function respondWithFilteredResult(_0x142ff2,_0x43ec2c){return function(_0x498885){if(_0x498885){var _0x4e8be8=typeof _0x43ec2c[_0x1af2('0x2c')]===_0x1af2('0x2d')&&typeof _0x43ec2c[_0x1af2('0x2e')]===_0x1af2('0x2d');var _0x600798=_0x498885[_0x1af2('0x2f')];var _0x3e00e0=_0x4e8be8?0x0:_0x43ec2c['offset'];var _0x420b8b=_0x4e8be8?_0x498885[_0x1af2('0x2f')]:_0x43ec2c[_0x1af2('0x2c')]+_0x43ec2c[_0x1af2('0x2e')];var _0x251694;if(_0x420b8b>=_0x600798){_0x420b8b=_0x600798;_0x251694=0xc8;}else{_0x251694=0xce;}_0x142ff2[_0x1af2('0x29')](_0x251694);return _0x142ff2[_0x1af2('0x30')](_0x1af2('0x31'),_0x3e00e0+'-'+_0x420b8b+'/'+_0x600798)[_0x1af2('0x2b')](_0x498885);}return null;};}function patchUpdates(_0x693eb0){return function(_0x4c8508){try{jsonpatch['apply'](_0x4c8508,_0x693eb0,!![]);}catch(_0x23276e){return BPromise[_0x1af2('0x32')](_0x23276e);}return _0x4c8508[_0x1af2('0x33')]();};}function saveUpdates(_0x1ca987,_0x101b25){return function(_0x268357){if(_0x268357){return _0x268357[_0x1af2('0x34')](_0x1ca987)[_0x1af2('0x35')](function(_0x33dccc){return _0x33dccc;});}return null;};}function removeEntity(_0x2b0bcb,_0x2378fe){return function(_0x81612e){if(_0x81612e){return _0x81612e[_0x1af2('0x36')]()['then'](function(){var _0x357d48=_0x81612e['get']({'plain':!![]});var _0x3db6da=_0x1af2('0x37');return db[_0x1af2('0x38')]['destroy']({'where':{'type':_0x3db6da,'resourceId':_0x357d48['id']}})[_0x1af2('0x35')](function(){return _0x81612e;});})[_0x1af2('0x35')](function(){_0x2b0bcb[_0x1af2('0x29')](0xcc)[_0x1af2('0x2a')]();});}};}function handleEntityNotFound(_0x257b3a,_0x296e5e){return function(_0x4455d7){if(!_0x4455d7){_0x257b3a[_0x1af2('0x28')](0x194);}return _0x4455d7;};}function handleError(_0x31f4c2,_0x1304f5){_0x1304f5=_0x1304f5||0x1f4;return function(_0x1c63ed){logger[_0x1af2('0x23')](_0x1c63ed[_0x1af2('0x39')]);if(_0x1c63ed[_0x1af2('0x3a')]){delete _0x1c63ed[_0x1af2('0x3a')];}_0x31f4c2['status'](_0x1304f5)['send'](_0x1c63ed);};}exports[_0x1af2('0x3b')]=function(_0x35d72d,_0x7c1dba){var _0x2bce08={},_0x3dc9b3={},_0x5d151f={'count':0x0,'rows':[]};var _0x2ecea5=_['map'](db[_0x1af2('0x3c')]['rawAttributes'],function(_0x43c262){return{'name':_0x43c262[_0x1af2('0x3d')],'type':_0x43c262[_0x1af2('0x3e')]['key']};});_0x3dc9b3[_0x1af2('0x3f')]=_[_0x1af2('0x40')](_0x2ecea5,_0x1af2('0x3a'));_0x3dc9b3[_0x1af2('0x41')]=_[_0x1af2('0x42')](_0x35d72d[_0x1af2('0x41')]);_0x3dc9b3[_0x1af2('0x43')]=_['intersection'](_0x3dc9b3[_0x1af2('0x3f')],_0x3dc9b3[_0x1af2('0x41')]);_0x2bce08[_0x1af2('0x44')]=_['intersection'](_0x3dc9b3[_0x1af2('0x3f')],qs['fields'](_0x35d72d['query'][_0x1af2('0x45')]));_0x2bce08[_0x1af2('0x44')]=_0x2bce08[_0x1af2('0x44')][_0x1af2('0x46')]?_0x2bce08[_0x1af2('0x44')]:_0x3dc9b3['model'];if(!_0x35d72d[_0x1af2('0x41')][_0x1af2('0x47')]('nolimit')){_0x2bce08[_0x1af2('0x2e')]=qs['limit'](_0x35d72d['query']['limit']);_0x2bce08[_0x1af2('0x2c')]=qs['offset'](_0x35d72d[_0x1af2('0x41')][_0x1af2('0x2c')]);}_0x2bce08[_0x1af2('0x48')]=qs[_0x1af2('0x49')](_0x35d72d[_0x1af2('0x41')][_0x1af2('0x49')]);_0x2bce08[_0x1af2('0x4a')]=qs[_0x1af2('0x43')](_[_0x1af2('0x4b')](_0x35d72d['query'],_0x3dc9b3[_0x1af2('0x43')]),_0x2ecea5);if(_0x35d72d[_0x1af2('0x41')][_0x1af2('0x4c')]){_0x2bce08[_0x1af2('0x4a')]=_['merge'](_0x2bce08[_0x1af2('0x4a')],{'$or':_[_0x1af2('0x40')](_0x2ecea5,function(_0x2ad5ca){if(_0x2ad5ca[_0x1af2('0x3e')]!==_0x1af2('0x4d')){var _0x5f42e8={};_0x5f42e8[_0x2ad5ca[_0x1af2('0x3a')]]={'$like':'%'+_0x35d72d['query'][_0x1af2('0x4c')]+'%'};return _0x5f42e8;}})});}_0x2bce08=_[_0x1af2('0x4e')]({},_0x2bce08,_0x35d72d[_0x1af2('0x4f')]);var _0x3fce18={'where':_0x2bce08[_0x1af2('0x4a')]};return db[_0x1af2('0x3c')][_0x1af2('0x2f')](_0x3fce18)[_0x1af2('0x35')](function(_0x348728){_0x5d151f[_0x1af2('0x2f')]=_0x348728;if(_0x35d72d[_0x1af2('0x41')][_0x1af2('0x50')]){_0x2bce08[_0x1af2('0x51')]=[{'all':!![]}];}return db[_0x1af2('0x3c')]['findAll'](_0x2bce08);})[_0x1af2('0x35')](function(_0x43ba78){_0x5d151f[_0x1af2('0x52')]=_0x43ba78;return _0x5d151f;})[_0x1af2('0x35')](respondWithFilteredResult(_0x7c1dba,_0x2bce08))[_0x1af2('0x27')](handleError(_0x7c1dba,null));};exports['show']=function(_0x5258d6,_0x5e3e41){var _0x54b49a={'raw':!![],'where':{'id':_0x5258d6[_0x1af2('0x53')]['id']}},_0x359a70={};_0x359a70[_0x1af2('0x3f')]=_[_0x1af2('0x42')](db[_0x1af2('0x3c')]['rawAttributes']);_0x359a70[_0x1af2('0x41')]=_[_0x1af2('0x42')](_0x5258d6[_0x1af2('0x41')]);_0x359a70[_0x1af2('0x43')]=_[_0x1af2('0x54')](_0x359a70[_0x1af2('0x3f')],_0x359a70[_0x1af2('0x41')]);_0x54b49a['attributes']=_[_0x1af2('0x54')](_0x359a70['model'],qs[_0x1af2('0x45')](_0x5258d6[_0x1af2('0x41')][_0x1af2('0x45')]));_0x54b49a['attributes']=_0x54b49a[_0x1af2('0x44')][_0x1af2('0x46')]?_0x54b49a['attributes']:_0x359a70[_0x1af2('0x3f')];if(_0x5258d6[_0x1af2('0x41')][_0x1af2('0x50')]){_0x54b49a[_0x1af2('0x51')]=[{'all':!![]}];}_0x54b49a=_[_0x1af2('0x4e')]({},_0x54b49a,_0x5258d6[_0x1af2('0x4f')]);return db['ChatQueue']['find'](_0x54b49a)[_0x1af2('0x35')](handleEntityNotFound(_0x5e3e41,null))[_0x1af2('0x35')](respondWithResult(_0x5e3e41,null))['catch'](handleError(_0x5e3e41,null));};exports['create']=function(_0x40e64e,_0x2b533){return db[_0x1af2('0x3c')]['create'](_0x40e64e[_0x1af2('0x55')],{})[_0x1af2('0x35')](function(_0x30abf6){var _0x152c28=_0x40e64e[_0x1af2('0x56')][_0x1af2('0x57')]({'plain':!![]});if(!_0x152c28)throw new Error(_0x1af2('0x58'));if(_0x152c28[_0x1af2('0x59')]==='user'){var _0x18569b=_0x30abf6['get']({'plain':!![]});var _0x2a1ced=_0x1af2('0x37');return db[_0x1af2('0x5a')]['find']({'where':{'name':_0x2a1ced,'userProfileId':_0x152c28['userProfileId']},'raw':!![]})[_0x1af2('0x35')](function(_0x4c16b6){if(_0x4c16b6&&_0x4c16b6['autoAssociation']===0x0){return db[_0x1af2('0x38')][_0x1af2('0x5b')]({'name':_0x18569b[_0x1af2('0x3a')],'resourceId':_0x18569b['id'],'type':_0x4c16b6[_0x1af2('0x3a')],'sectionId':_0x4c16b6['id']},{})[_0x1af2('0x35')](function(){return _0x30abf6;});}else{return _0x30abf6;}})[_0x1af2('0x27')](function(_0x5661a9){logger[_0x1af2('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5661a9);throw _0x5661a9;});}return _0x30abf6;})[_0x1af2('0x35')](respondWithResult(_0x2b533,0xc9))[_0x1af2('0x27')](handleError(_0x2b533,null));};exports[_0x1af2('0x34')]=function(_0x3228a2,_0x427e92){if(_0x3228a2[_0x1af2('0x55')]['id']){delete _0x3228a2[_0x1af2('0x55')]['id'];}return db[_0x1af2('0x3c')][_0x1af2('0x5c')]({'where':{'id':_0x3228a2[_0x1af2('0x53')]['id']}})[_0x1af2('0x35')](handleEntityNotFound(_0x427e92,null))[_0x1af2('0x35')](saveUpdates(_0x3228a2[_0x1af2('0x55')],null))[_0x1af2('0x35')](respondWithResult(_0x427e92,null))['catch'](handleError(_0x427e92,null));};exports[_0x1af2('0x36')]=function(_0x431184,_0x16dae4){return db[_0x1af2('0x3c')][_0x1af2('0x5c')]({'where':{'id':_0x431184[_0x1af2('0x53')]['id']}})['then'](handleEntityNotFound(_0x16dae4,null))[_0x1af2('0x35')](removeEntity(_0x16dae4,null))['catch'](handleError(_0x16dae4,null));};exports['describe']=function(_0x15bc11,_0x3f4b2a){return db[_0x1af2('0x3c')][_0x1af2('0x5d')]()[_0x1af2('0x35')](respondWithResult(_0x3f4b2a,null))['catch'](handleError(_0x3f4b2a,null));};exports[_0x1af2('0x5e')]=function(_0x5ce794,_0x14d130,_0x3940b6){var _0x1da0db={'raw':!![],'where':{}},_0x58741b={},_0x106f41;return db[_0x1af2('0x3c')]['findOne']({'where':{'id':_0x5ce794[_0x1af2('0x53')]['id']}})['then'](handleEntityNotFound(_0x14d130,null))[_0x1af2('0x35')](function(_0xcdc0b6){if(_0xcdc0b6){_0x106f41=_0xcdc0b6[_0x1af2('0x57')]({'plain':!![]});_0x58741b[_0x1af2('0x3f')]=_['keys'](db[_0x1af2('0x5f')]['rawAttributes']);_0x58741b[_0x1af2('0x41')]=_['keys'](_0x5ce794[_0x1af2('0x41')]);_0x58741b[_0x1af2('0x43')]=_[_0x1af2('0x54')](_0x58741b[_0x1af2('0x3f')],_0x58741b[_0x1af2('0x41')]);_0x1da0db[_0x1af2('0x44')]=_[_0x1af2('0x54')](_0x58741b[_0x1af2('0x3f')],qs[_0x1af2('0x45')](_0x5ce794[_0x1af2('0x41')][_0x1af2('0x45')]));_0x1da0db[_0x1af2('0x44')]=_0x1da0db['attributes'][_0x1af2('0x46')]?_0x1da0db[_0x1af2('0x44')]:_0x58741b['model'];if(!_0x5ce794[_0x1af2('0x41')][_0x1af2('0x47')]('nolimit')){_0x1da0db[_0x1af2('0x2e')]=qs[_0x1af2('0x2e')](_0x5ce794[_0x1af2('0x41')]['limit']);_0x1da0db['offset']=qs['offset'](_0x5ce794[_0x1af2('0x41')][_0x1af2('0x2c')]);}_0x1da0db['order']=qs[_0x1af2('0x49')](_0x5ce794[_0x1af2('0x41')][_0x1af2('0x49')]);_0x1da0db[_0x1af2('0x4a')]=qs[_0x1af2('0x43')](_[_0x1af2('0x4b')](_0x5ce794[_0x1af2('0x41')],_0x58741b['filters']));_0x1da0db[_0x1af2('0x4a')]['ChatQueueId']=_0xcdc0b6['id'];if(_0x5ce794[_0x1af2('0x41')][_0x1af2('0x4c')]){_0x1da0db[_0x1af2('0x4a')]=_['merge'](_0x1da0db['where'],{'$or':_[_0x1af2('0x40')](_0x1da0db['attributes'],function(_0x25bff8){var _0x2eeabd={};_0x2eeabd[_0x25bff8]={'$like':'%'+_0x5ce794[_0x1af2('0x41')][_0x1af2('0x4c')]+'%'};return _0x2eeabd;})});}_0x1da0db=_[_0x1af2('0x4e')]({},_0x1da0db,_0x5ce794[_0x1af2('0x4f')]);return db[_0x1af2('0x5f')]['findAll'](_0x1da0db);}})[_0x1af2('0x35')](function(_0x5a28ac){if(_0x5a28ac){return db[_0x1af2('0x60')]['findAndCountAll']({'where':{'id':_[_0x1af2('0x40')](_0x5a28ac,_0x1af2('0x61')),'role':_0x1af2('0x62')},'attributes':['id','name',_0x1af2('0x63'),_0x1af2('0x64'),_0x1af2('0x65')]});}})['then'](function(_0xac84dd){if(_0xac84dd){return{'count':_0xac84dd[_0x1af2('0x2f')],'rows':_[_0x1af2('0x40')](_0xac84dd[_0x1af2('0x52')],function(_0x14ddd0){return{'membername':_0x14ddd0['name'],'UserId':_0x14ddd0['id'],'queue_name':_0x106f41['name'],'ChatQueueId':_0x106f41['id'],'interface':util[_0x1af2('0x66')]('%s/%s',_0x1af2('0x67'),_0x14ddd0[_0x1af2('0x3a')]),'penalty':0x0,'paused':_0x14ddd0['chatPause'],'createdAt':_0x14ddd0[_0x1af2('0x65')],'updatedAt':_0x14ddd0[_0x1af2('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1af2('0x35')](respondWithFilteredResult(_0x14d130,_0x1da0db))['catch'](handleError(_0x14d130,null));};exports['getTeams']=function(_0x48b5e3,_0x2b2d51,_0x53fff3){var _0x505749={};var _0x5d72b4={};var _0x37ee8e;var _0x401682;return db[_0x1af2('0x3c')][_0x1af2('0x68')]({'where':{'id':_0x48b5e3['params']['id']}})[_0x1af2('0x35')](handleEntityNotFound(_0x2b2d51,null))[_0x1af2('0x35')](function(_0x3d7d94){if(_0x3d7d94){_0x37ee8e=_0x3d7d94;_0x5d72b4[_0x1af2('0x3f')]=_[_0x1af2('0x42')](db[_0x1af2('0x69')]['rawAttributes']);_0x5d72b4[_0x1af2('0x41')]=_[_0x1af2('0x42')](_0x48b5e3[_0x1af2('0x41')]);_0x5d72b4[_0x1af2('0x43')]=_['intersection'](_0x5d72b4['model'],_0x5d72b4[_0x1af2('0x41')]);_0x505749[_0x1af2('0x44')]=_[_0x1af2('0x54')](_0x5d72b4[_0x1af2('0x3f')],qs[_0x1af2('0x45')](_0x48b5e3[_0x1af2('0x41')][_0x1af2('0x45')]));_0x505749['attributes']=_0x505749['attributes'][_0x1af2('0x46')]?_0x505749[_0x1af2('0x44')]:_0x5d72b4['model'];_0x505749[_0x1af2('0x48')]=qs[_0x1af2('0x49')](_0x48b5e3[_0x1af2('0x41')][_0x1af2('0x49')]);_0x505749[_0x1af2('0x4a')]=qs['filters'](_[_0x1af2('0x4b')](_0x48b5e3[_0x1af2('0x41')],_0x5d72b4[_0x1af2('0x43')]));if(_0x48b5e3[_0x1af2('0x41')][_0x1af2('0x4c')]){_0x505749[_0x1af2('0x4a')]=_[_0x1af2('0x4e')](_0x505749[_0x1af2('0x4a')],{'$or':_[_0x1af2('0x40')](_0x505749[_0x1af2('0x44')],function(_0x4bc39c){var _0x2528a0={};_0x2528a0[_0x4bc39c]={'$like':'%'+_0x48b5e3[_0x1af2('0x41')][_0x1af2('0x4c')]+'%'};return _0x2528a0;})});}_0x505749=_[_0x1af2('0x4e')]({},_0x505749,_0x48b5e3['options']);return _0x37ee8e[_0x1af2('0x6a')](_0x505749);}})['then'](function(_0x5e9243){if(_0x5e9243){_0x401682=_0x5e9243['length'];if(!_0x48b5e3[_0x1af2('0x41')][_0x1af2('0x47')](_0x1af2('0x6b'))){_0x505749['limit']=qs[_0x1af2('0x2e')](_0x48b5e3[_0x1af2('0x41')][_0x1af2('0x2e')]);_0x505749[_0x1af2('0x2c')]=qs['offset'](_0x48b5e3[_0x1af2('0x41')]['offset']);}return _0x37ee8e[_0x1af2('0x6a')](_0x505749);}})[_0x1af2('0x35')](function(_0x42df7b){if(_0x42df7b){return _0x42df7b?{'count':_0x401682,'rows':_0x42df7b}:null;}})[_0x1af2('0x35')](respondWithResult(_0x2b2d51,null))[_0x1af2('0x27')](handleError(_0x2b2d51,null));};exports[_0x1af2('0x6c')]=function(_0x525eab,_0x3de054,_0x15e285){var _0x1ee59e=_0x525eab[_0x1af2('0x55')][_0x1af2('0x6d')];return db[_0x1af2('0x69')][_0x1af2('0x6e')]({'where':{'id':_0x1ee59e},'attributes':['id'],'include':[{'model':db[_0x1af2('0x60')],'as':_0x1af2('0x6f'),'attributes':['id',_0x1af2('0x3a'),_0x1af2('0x70'),_0x1af2('0x71'),'interface'],'raw':!![]}]})[_0x1af2('0x35')](function(_0x3406c0){if(_0x3406c0){var _0x48975e=_[_0x1af2('0x72')](_0x3406c0,function(_0x4a2890){var _0xebbb62=_0x4a2890[_0x1af2('0x57')]({'plain':!![]});return _0xebbb62[_0x1af2('0x6f')];});return db[_0x1af2('0x3c')][_0x1af2('0x5c')]({'where':{'id':_0x525eab[_0x1af2('0x53')]['id']}})[_0x1af2('0x35')](function(_0xd714b1){return db[_0x1af2('0x73')][_0x1af2('0x74')](function(_0x447a03){return _0xd714b1[_0x1af2('0x6c')](_0x1ee59e,{'transaction':_0x447a03})[_0x1af2('0x35')](function(){return BPromise['each'](_0x48975e,function(_0x124fdd){return db[_0x1af2('0x5f')][_0x1af2('0x75')]({'where':{'UserId':_0x124fdd['id'],'ChatQueueId':_0x525eab['params']['id']},'transaction':_0x447a03});});})[_0x1af2('0x35')](function(){_0x48975e[_0x1af2('0x76')](function(_0x47cec1){socket[_0x1af2('0x77')](_0x1af2('0x78'),{'UserId':_0x47cec1['id'],'ChatQueueId':_0xd714b1['id']});});});});});}})['then'](respondWithStatusCode(_0x3de054,null))[_0x1af2('0x27')](handleError(_0x3de054,null));};exports[_0x1af2('0x79')]=function(_0x5f5777,_0x3694c4,_0x1b3153){return db['Team']['findAll']({'where':{'id':_0x5f5777['query'][_0x1af2('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x1af2('0x60')],'as':_0x1af2('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x1af2('0x35')](handleEntityNotFound(_0x3694c4,null))['then'](function(_0x159a2a){var _0x4c909b=_[_0x1af2('0x40')](_0x159a2a,'id');var _0x5ad91d=[];var _0x1a91c6=[];var _0x2c6646=squel['select']();_0x2c6646[_0x1af2('0x7a')](_0x1af2('0x7b'))[_0x1af2('0x7c')](_0x1af2('0x7d'),'tq')[_0x1af2('0x7e')](_0x1af2('0x7f'),'ut',_0x1af2('0x80'))['where'](_0x1af2('0x81'),_0x5f5777[_0x1af2('0x53')]['id']);for(var _0x3769f5=0x0;_0x3769f5<_0x159a2a[_0x1af2('0x46')];_0x3769f5+=0x1){let _0x412136=_0x159a2a[_0x3769f5];for(var _0x444f97=0x0;_0x444f97<_0x412136['Agents'][_0x1af2('0x46')];_0x444f97+=0x1){let _0x213b58=_0x412136[_0x1af2('0x6f')][_0x444f97];var _0x4a7ef4=_0x2c6646['clone']();_0x4a7ef4['where'](_0x1af2('0x82'),_0x213b58['id']);_0x1a91c6[_0x1af2('0x83')](db['sequelize'][_0x1af2('0x41')](_0x4a7ef4[_0x1af2('0x84')](),{'type':db[_0x1af2('0x73')][_0x1af2('0x85')][_0x1af2('0x86')]})[_0x1af2('0x35')](function(_0x54baf3){if(_0x54baf3[_0x1af2('0x46')]===0x1){return _0x213b58['id'];}else{var _0xd60993=_[_0x1af2('0x87')](_[_0x1af2('0x40')](_0x54baf3,_0x1af2('0x88')),function(_0x59e767){return _[_0x1af2('0x89')](_0x4c909b,_0x59e767);});if(_0xd60993){return _0x213b58['id'];}}}));}}return BPromise[_0x1af2('0x8a')](_0x1a91c6)[_0x1af2('0x35')](function(_0x2ec8d9){_0x5ad91d=_(_0x5ad91d)[_0x1af2('0x8b')](_0x2ec8d9)[_0x1af2('0x8c')]()[_0x1af2('0x8d')]();return db[_0x1af2('0x3c')][_0x1af2('0x5c')]({'where':{'id':_0x5f5777[_0x1af2('0x53')]['id']}})[_0x1af2('0x35')](function(_0x104765){return db['sequelize'][_0x1af2('0x74')](function(_0x347391){return _0x104765[_0x1af2('0x79')](_0x5f5777['query']['ids'],{'transaction':_0x347391})[_0x1af2('0x35')](function(){if(!_[_0x1af2('0x8e')](_0x5ad91d)){return _0x104765[_0x1af2('0x8f')](_0x5ad91d,{'transaction':_0x347391});}})[_0x1af2('0x35')](function(){_0x5ad91d[_0x1af2('0x76')](function(_0x50b3d7){socket[_0x1af2('0x77')]('userChatQueue:remove',{'UserId':_0x50b3d7,'ChatQueueId':_0x104765['id']});});});});});});})[_0x1af2('0x35')](respondWithStatusCode(_0x3694c4,null))[_0x1af2('0x27')](handleError(_0x3694c4,null));};exports[_0x1af2('0x90')]=function(_0x3eceba,_0x2b897d,_0x49cd42){return db[_0x1af2('0x3c')][_0x1af2('0x5c')]({'where':{'id':_0x3eceba[_0x1af2('0x53')]['id']}})['then'](handleEntityNotFound(_0x2b897d,null))['then'](function(_0x825694){if(_0x825694){return _0x825694['addAgents'](_0x3eceba['body'][_0x1af2('0x6d')],_['omit'](_0x3eceba['body'],[_0x1af2('0x6d'),'id'])||{})[_0x1af2('0x91')](function(_0x4dfe60){for(var _0x3350c8=0x0;_0x3350c8<_0x3eceba[_0x1af2('0x55')][_0x1af2('0x6d')][_0x1af2('0x46')];_0x3350c8+=0x1){socket[_0x1af2('0x77')]('userChatQueue:save',{'UserId':Number(_0x3eceba['body'][_0x1af2('0x6d')][_0x3350c8]),'ChatQueueId':Number(_0x3eceba['params']['id'])});}return _0x4dfe60;});}})[_0x1af2('0x35')](respondWithResult(_0x2b897d,null))['catch'](handleError(_0x2b897d,null));};exports[_0x1af2('0x8f')]=function(_0x51ed9e,_0x42056d,_0x2b4fff){return db[_0x1af2('0x3c')]['find']({'where':{'id':_0x51ed9e[_0x1af2('0x53')]['id']}})['then'](handleEntityNotFound(_0x42056d,null))[_0x1af2('0x35')](function(_0x2c3323){if(_0x2c3323){return _0x2c3323[_0x1af2('0x8f')](_0x51ed9e[_0x1af2('0x41')][_0x1af2('0x6d')])[_0x1af2('0x35')](function(){if(_[_0x1af2('0x92')](_0x51ed9e[_0x1af2('0x41')]['ids'])){for(var _0x1b5ca5=0x0;_0x1b5ca5<_0x51ed9e[_0x1af2('0x41')][_0x1af2('0x6d')][_0x1af2('0x46')];_0x1b5ca5+=0x1){socket['emit'](_0x1af2('0x93'),{'UserId':Number(_0x51ed9e[_0x1af2('0x41')][_0x1af2('0x6d')][_0x1b5ca5]),'ChatQueueId':Number(_0x51ed9e[_0x1af2('0x53')]['id'])});}}else{socket[_0x1af2('0x77')]('userChatQueue:remove',{'UserId':Number(_0x51ed9e[_0x1af2('0x41')][_0x1af2('0x6d')]),'ChatQueueId':Number(_0x51ed9e[_0x1af2('0x53')]['id'])});}});}})[_0x1af2('0x35')](respondWithStatusCode(_0x42056d,null))[_0x1af2('0x27')](handleError(_0x42056d,null));};exports['getAgents']=function(_0x1ff688,_0x1e3e1d,_0x465e9b){var _0x429f92={};var _0x29f9ec={};var _0x1c5e57;var _0x4f702b;return db[_0x1af2('0x3c')]['findOne']({'where':{'id':_0x1ff688['params']['id']}})[_0x1af2('0x35')](handleEntityNotFound(_0x1e3e1d,null))[_0x1af2('0x35')](function(_0x3643b8){if(_0x3643b8){_0x1c5e57=_0x3643b8;_0x29f9ec[_0x1af2('0x3f')]=_['keys'](db[_0x1af2('0x60')][_0x1af2('0x94')]);_0x29f9ec[_0x1af2('0x41')]=_['keys'](_0x1ff688[_0x1af2('0x41')]);_0x29f9ec[_0x1af2('0x43')]=_[_0x1af2('0x54')](_0x29f9ec['model'],_0x29f9ec[_0x1af2('0x41')]);_0x429f92[_0x1af2('0x44')]=_[_0x1af2('0x54')](_0x29f9ec[_0x1af2('0x3f')],qs[_0x1af2('0x45')](_0x1ff688[_0x1af2('0x41')][_0x1af2('0x45')]));_0x429f92[_0x1af2('0x44')]=_0x429f92[_0x1af2('0x44')][_0x1af2('0x46')]?_0x429f92[_0x1af2('0x44')]:_0x29f9ec[_0x1af2('0x3f')];_0x429f92[_0x1af2('0x48')]=qs['sort'](_0x1ff688[_0x1af2('0x41')][_0x1af2('0x49')]);_0x429f92[_0x1af2('0x4a')]=qs['filters'](_[_0x1af2('0x4b')](_0x1ff688[_0x1af2('0x41')],_0x29f9ec[_0x1af2('0x43')]));if(_0x1ff688['query']['filter']){_0x429f92['where']=_[_0x1af2('0x4e')](_0x429f92['where'],{'$or':_[_0x1af2('0x40')](_0x429f92[_0x1af2('0x44')],function(_0x17c818){var _0x1a5041={};_0x1a5041[_0x17c818]={'$like':'%'+_0x1ff688['query'][_0x1af2('0x4c')]+'%'};return _0x1a5041;})});}_0x429f92=_['merge']({},_0x429f92,_0x1ff688[_0x1af2('0x4f')]);return _0x1c5e57['getAgents'](_0x429f92);}})[_0x1af2('0x35')](function(_0x32ad50){if(_0x32ad50){_0x4f702b=_0x32ad50[_0x1af2('0x46')];if(!_0x1ff688[_0x1af2('0x41')][_0x1af2('0x47')]('nolimit')){_0x429f92[_0x1af2('0x2e')]=qs[_0x1af2('0x2e')](_0x1ff688[_0x1af2('0x41')][_0x1af2('0x2e')]);_0x429f92[_0x1af2('0x2c')]=qs['offset'](_0x1ff688[_0x1af2('0x41')]['offset']);}return _0x1c5e57[_0x1af2('0x95')](_0x429f92);}})[_0x1af2('0x35')](function(_0x49295f){if(_0x49295f){return _0x49295f?{'count':_0x4f702b,'rows':_0x49295f}:null;}})[_0x1af2('0x35')](respondWithResult(_0x1e3e1d,null))['catch'](handleError(_0x1e3e1d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1a7dea1..03beb1d 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 _0x782e=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatQueue','save'];(function(_0x426f00,_0x4f7131){var _0x324a41=function(_0x30060c){while(--_0x30060c){_0x426f00['push'](_0x426f00['shift']());}};_0x324a41(++_0x4f7131);}(_0x782e,0x155));var _0xe782=function(_0xfcabd7,_0x43f87b){_0xfcabd7=_0xfcabd7-0x0;var _0x122ee1=_0x782e[_0xfcabd7];return _0x122ee1;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xe782('0x0'))['db'][_0xe782('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe782('0x2'),'afterUpdate':_0xe782('0x3'),'afterDestroy':_0xe782('0x4')};function emitEvent(_0x1ec3e7){return function(_0x1800b1,_0x4d1e53,_0x51401f){ChatQueueEvents[_0xe782('0x5')](_0x1ec3e7+':'+_0x1800b1['id'],_0x1800b1);ChatQueueEvents[_0xe782('0x5')](_0x1ec3e7,_0x1800b1);_0x51401f(null);};}for(var e in events){if(events[_0xe782('0x6')](e)){var event=events[e];ChatQueue[_0xe782('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x08fd=['ChatQueue','setMaxListeners','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x37a9f8,_0x18bd9e){var _0x448e3f=function(_0x5128b3){while(--_0x5128b3){_0x37a9f8['push'](_0x37a9f8['shift']());}};_0x448e3f(++_0x18bd9e);}(_0x08fd,0xa6));var _0xd08f=function(_0x127bba,_0x46432d){_0x127bba=_0x127bba-0x0;var _0x42d208=_0x08fd[_0x127bba];return _0x42d208;};'use strict';var EventEmitter=require(_0xd08f('0x0'));var ChatQueue=require(_0xd08f('0x1'))['db'][_0xd08f('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd08f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd08f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53cb37){return function(_0x3a2b80,_0x196b04,_0xc18efb){ChatQueueEvents[_0xd08f('0x5')](_0x53cb37+':'+_0x3a2b80['id'],_0x3a2b80);ChatQueueEvents[_0xd08f('0x5')](_0x53cb37,_0x3a2b80);_0xc18efb(null);};}for(var e in events){if(events[_0xd08f('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xd08f('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 898733f..c48715f 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 _0xd8e2=['exports','ChatQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0xd8e2,0xa4));var _0x2d8e=function(_0x356d9f,_0x4599d9){_0x356d9f=_0x356d9f-0x0;var _0xad7a15=_0xd8e2[_0x356d9f];return _0xad7a15;};'use strict';var _=require(_0x2d8e('0x0'));var util=require('util');var logger=require(_0x2d8e('0x1'))(_0x2d8e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d8e('0x3'));var rimraf=require(_0x2d8e('0x4'));var config=require(_0x2d8e('0x5'));var attributes=require(_0x2d8e('0x6'));module[_0x2d8e('0x7')]=function(_0x297a81,_0x20bc08){return _0x297a81['define'](_0x2d8e('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2552=['path','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','../../config/logger','api'];(function(_0x66d929,_0x2c9e16){var _0x868705=function(_0x4e153f){while(--_0x4e153f){_0x66d929['push'](_0x66d929['shift']());}};_0x868705(++_0x2c9e16);}(_0x2552,0x139));var _0x2255=function(_0x2350fa,_0x43cbcf){_0x2350fa=_0x2350fa-0x0;var _0x1133a7=_0x2552[_0x2350fa];return _0x1133a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2255('0x0'))(_0x2255('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2255('0x2'));var rimraf=require(_0x2255('0x3'));var config=require(_0x2255('0x4'));var attributes=require('./chatQueue.attributes');module[_0x2255('0x5')]=function(_0x3ef9b3,_0x2552c4){return _0x3ef9b3[_0x2255('0x6')](_0x2255('0x7'),attributes,{'tableName':_0x2255('0x8'),'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 849be02..1402ade 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 _0x2c64=['../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','bluebird','randomstring','ioredis'];(function(_0x238a7a,_0x5807fe){var _0x5a1038=function(_0x533f30){while(--_0x533f30){_0x238a7a['push'](_0x238a7a['shift']());}};_0x5a1038(++_0x5807fe);}(_0x2c64,0x181));var _0x42c6=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x2c64[_0x307d86];return _0x361745;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var moment=require('moment');var BPromise=require(_0x42c6('0x2'));var rs=require(_0x42c6('0x3'));var fs=require('fs');var Redis=require(_0x42c6('0x4'));var db=require(_0x42c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42c6('0x6'));var config=require(_0x42c6('0x7'));var jayson=require(_0x42c6('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x42c6('0x9')](config[_0x42c6('0xa')],{'host':_0x42c6('0xb'),'port':0x18eb});var socket=require(_0x42c6('0xc'))(new Redis(config[_0x42c6('0xa')]));require('./chatQueue.socket')[_0x42c6('0xd')](socket);function respondWithRpcPromise(_0x15af4d,_0x27500d,_0x5480ea){return new BPromise(function(_0x235256,_0x3d749e){return client['request'](_0x15af4d,_0x5480ea)[_0x42c6('0xe')](function(_0x227a87){logger[_0x42c6('0xf')](_0x42c6('0x10'),_0x27500d,_0x42c6('0x11'));logger[_0x42c6('0x12')](_0x42c6('0x13'),_0x27500d,'request\x20sent',JSON[_0x42c6('0x14')](_0x227a87));if(_0x227a87[_0x42c6('0x15')]){if(_0x227a87[_0x42c6('0x15')][_0x42c6('0x16')]===0x1f4){logger[_0x42c6('0x15')](_0x42c6('0x10'),_0x27500d,_0x227a87[_0x42c6('0x15')]['message']);return _0x3d749e(_0x227a87[_0x42c6('0x15')][_0x42c6('0x17')]);}logger[_0x42c6('0x15')](_0x42c6('0x10'),_0x27500d,_0x227a87['error'][_0x42c6('0x17')]);return _0x235256(_0x227a87['error'][_0x42c6('0x17')]);}else{logger[_0x42c6('0xf')](_0x42c6('0x10'),_0x27500d,'request\x20sent');_0x235256(_0x227a87[_0x42c6('0x18')][_0x42c6('0x17')]);}})[_0x42c6('0x19')](function(_0x3fce8d){logger[_0x42c6('0x15')](_0x42c6('0x10'),_0x27500d,_0x3fce8d);_0x3d749e(_0x3fce8d);});});}exports[_0x42c6('0x1a')]=function(_0x486e94){var _0x51aae3=this;return new Promise(function(_0x141e3e,_0x3139bc){return db[_0x42c6('0x1b')][_0x42c6('0x1c')]({'raw':_0x486e94['options']?_0x486e94['options'][_0x42c6('0x1d')]===undefined?!![]:![]:!![],'where':_0x486e94[_0x42c6('0x1e')]?_0x486e94['options'][_0x42c6('0x1f')]||null:null,'attributes':_0x486e94['options']?_0x486e94[_0x42c6('0x1e')][_0x42c6('0x20')]||null:null,'limit':_0x486e94[_0x42c6('0x1e')]?_0x486e94[_0x42c6('0x1e')][_0x42c6('0x21')]||null:null,'include':_0x486e94[_0x42c6('0x1e')]?_0x486e94[_0x42c6('0x1e')][_0x42c6('0x22')]?_[_0x42c6('0x23')](_0x486e94[_0x42c6('0x1e')][_0x42c6('0x22')],function(_0x1c9875){return{'model':db[_0x1c9875['model']],'as':_0x1c9875['as'],'attributes':_0x1c9875[_0x42c6('0x20')],'include':_0x1c9875[_0x42c6('0x22')]?_[_0x42c6('0x23')](_0x1c9875[_0x42c6('0x22')],function(_0x496aaf){return{'model':db[_0x496aaf[_0x42c6('0x24')]],'as':_0x496aaf['as'],'attributes':_0x496aaf[_0x42c6('0x20')],'include':_0x496aaf[_0x42c6('0x22')]?_['map'](_0x496aaf[_0x42c6('0x22')],function(_0x5394ff){return{'model':db[_0x5394ff[_0x42c6('0x24')]],'as':_0x5394ff['as'],'attributes':_0x5394ff[_0x42c6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x42c6('0xe')](function(_0x2ccd03){logger[_0x42c6('0xf')]('GetChatQueue',_0x486e94);logger['debug']('GetChatQueue',_0x486e94,JSON[_0x42c6('0x14')](_0x2ccd03));_0x141e3e(_0x2ccd03);})[_0x42c6('0x19')](function(_0x305e27){logger[_0x42c6('0x15')]('GetChatQueue',_0x305e27[_0x42c6('0x17')],_0x486e94);_0x3139bc(_0x51aae3[_0x42c6('0x15')](0x1f4,_0x305e27['message']));});});};exports[_0x42c6('0x25')]=function(_0x4bba65){var _0x3bbb4a=this;return new Promise(function(_0x482dc1,_0xd7a969){return db[_0x42c6('0x1b')][_0x42c6('0x26')]({'raw':_0x4bba65[_0x42c6('0x1e')]?_0x4bba65[_0x42c6('0x1e')][_0x42c6('0x1d')]===undefined?!![]:![]:!![],'where':_0x4bba65[_0x42c6('0x1e')]?_0x4bba65['options'][_0x42c6('0x1f')]||null:null,'attributes':_0x4bba65[_0x42c6('0x1e')]?_0x4bba65[_0x42c6('0x1e')][_0x42c6('0x20')]||null:null,'include':_0x4bba65[_0x42c6('0x1e')]?_0x4bba65[_0x42c6('0x1e')][_0x42c6('0x22')]?_[_0x42c6('0x23')](_0x4bba65[_0x42c6('0x1e')][_0x42c6('0x22')],function(_0x5bbfc4){return{'model':db[_0x5bbfc4[_0x42c6('0x24')]],'as':_0x5bbfc4['as'],'attributes':_0x5bbfc4[_0x42c6('0x20')],'include':_0x5bbfc4[_0x42c6('0x22')]?_[_0x42c6('0x23')](_0x5bbfc4[_0x42c6('0x22')],function(_0x4cebbe){return{'model':db[_0x4cebbe[_0x42c6('0x24')]],'as':_0x4cebbe['as'],'attributes':_0x4cebbe[_0x42c6('0x20')],'include':_0x4cebbe['include']?_[_0x42c6('0x23')](_0x4cebbe['include'],function(_0x3ec1c4){return{'model':db[_0x3ec1c4['model']],'as':_0x3ec1c4['as'],'attributes':_0x3ec1c4[_0x42c6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x42c6('0xe')](function(_0x5e537a){logger[_0x42c6('0xf')](_0x42c6('0x25'),_0x4bba65);logger[_0x42c6('0x12')]('ShowChatQueue',_0x4bba65,JSON[_0x42c6('0x14')](_0x5e537a));_0x482dc1(_0x5e537a);})[_0x42c6('0x19')](function(_0x238c65){logger['error'](_0x42c6('0x25'),_0x238c65[_0x42c6('0x17')],_0x4bba65);_0xd7a969(_0x3bbb4a[_0x42c6('0x15')](0x1f4,_0x238c65['message']));});});}; \ No newline at end of file +var _0x6629=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','message','ChatQueue,\x20%s,\x20%s','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowChatQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x540095,_0x11db40){var _0x39a8c1=function(_0x4bd1ae){while(--_0x4bd1ae){_0x540095['push'](_0x540095['shift']());}};_0x39a8c1(++_0x11db40);}(_0x6629,0x1c2));var _0x9662=function(_0x403f95,_0xffe5c2){_0x403f95=_0x403f95-0x0;var _0x9dc662=_0x6629[_0x403f95];return _0x9dc662;};'use strict';var _=require(_0x9662('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9662('0x1'));var rs=require(_0x9662('0x2'));var fs=require('fs');var Redis=require(_0x9662('0x3'));var db=require(_0x9662('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9662('0x5'))(_0x9662('0x6'));var config=require(_0x9662('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9662('0x8')][_0x9662('0x9')]({'port':0x232a});config[_0x9662('0xa')]=_['defaults'](config[_0x9662('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9662('0xb'))(new Redis(config[_0x9662('0xa')]));require(_0x9662('0xc'))[_0x9662('0xd')](socket);function respondWithRpcPromise(_0x3615f3,_0x40c983,_0x2a58e5){return new BPromise(function(_0x413ba3,_0x3bb261){return client[_0x9662('0xe')](_0x3615f3,_0x2a58e5)[_0x9662('0xf')](function(_0x556842){logger[_0x9662('0x10')]('ChatQueue,\x20%s,\x20%s',_0x40c983,_0x9662('0x11'));logger[_0x9662('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x40c983,_0x9662('0x11'),JSON[_0x9662('0x13')](_0x556842));if(_0x556842[_0x9662('0x14')]){if(_0x556842['error']['code']===0x1f4){logger[_0x9662('0x14')]('ChatQueue,\x20%s,\x20%s',_0x40c983,_0x556842[_0x9662('0x14')][_0x9662('0x15')]);return _0x3bb261(_0x556842[_0x9662('0x14')]['message']);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x40c983,_0x556842[_0x9662('0x14')][_0x9662('0x15')]);return _0x413ba3(_0x556842['error'][_0x9662('0x15')]);}else{logger[_0x9662('0x10')](_0x9662('0x16'),_0x40c983,_0x9662('0x11'));_0x413ba3(_0x556842[_0x9662('0x17')][_0x9662('0x15')]);}})['catch'](function(_0x14335a){logger[_0x9662('0x14')]('ChatQueue,\x20%s,\x20%s',_0x40c983,_0x14335a);_0x3bb261(_0x14335a);});});}exports[_0x9662('0x18')]=function(_0xef0462){var _0x139d1a=this;return new Promise(function(_0x7c4209,_0x2e16cf){return db[_0x9662('0x19')][_0x9662('0x1a')]({'raw':_0xef0462[_0x9662('0x1b')]?_0xef0462[_0x9662('0x1b')][_0x9662('0x1c')]===undefined?!![]:![]:!![],'where':_0xef0462['options']?_0xef0462['options'][_0x9662('0x1d')]||null:null,'attributes':_0xef0462[_0x9662('0x1b')]?_0xef0462[_0x9662('0x1b')][_0x9662('0x1e')]||null:null,'limit':_0xef0462[_0x9662('0x1b')]?_0xef0462[_0x9662('0x1b')][_0x9662('0x1f')]||null:null,'include':_0xef0462['options']?_0xef0462['options'][_0x9662('0x20')]?_[_0x9662('0x21')](_0xef0462[_0x9662('0x1b')][_0x9662('0x20')],function(_0x5a16cd){return{'model':db[_0x5a16cd[_0x9662('0x22')]],'as':_0x5a16cd['as'],'attributes':_0x5a16cd[_0x9662('0x1e')],'include':_0x5a16cd[_0x9662('0x20')]?_[_0x9662('0x21')](_0x5a16cd[_0x9662('0x20')],function(_0x402896){return{'model':db[_0x402896[_0x9662('0x22')]],'as':_0x402896['as'],'attributes':_0x402896[_0x9662('0x1e')],'include':_0x402896['include']?_[_0x9662('0x21')](_0x402896[_0x9662('0x20')],function(_0x766c97){return{'model':db[_0x766c97['model']],'as':_0x766c97['as'],'attributes':_0x766c97['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56e731){logger['info']('GetChatQueue',_0xef0462);logger[_0x9662('0x12')](_0x9662('0x18'),_0xef0462,JSON[_0x9662('0x13')](_0x56e731));_0x7c4209(_0x56e731);})[_0x9662('0x23')](function(_0x4ae219){logger['error'](_0x9662('0x18'),_0x4ae219['message'],_0xef0462);_0x2e16cf(_0x139d1a[_0x9662('0x14')](0x1f4,_0x4ae219[_0x9662('0x15')]));});});};exports[_0x9662('0x24')]=function(_0x28c20a){var _0x13a3de=this;return new Promise(function(_0x5b97b8,_0xae35b6){return db[_0x9662('0x19')][_0x9662('0x25')]({'raw':_0x28c20a[_0x9662('0x1b')]?_0x28c20a[_0x9662('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x28c20a[_0x9662('0x1b')]?_0x28c20a['options'][_0x9662('0x1d')]||null:null,'attributes':_0x28c20a[_0x9662('0x1b')]?_0x28c20a[_0x9662('0x1b')]['attributes']||null:null,'include':_0x28c20a['options']?_0x28c20a['options'][_0x9662('0x20')]?_[_0x9662('0x21')](_0x28c20a[_0x9662('0x1b')]['include'],function(_0x17dbfd){return{'model':db[_0x17dbfd[_0x9662('0x22')]],'as':_0x17dbfd['as'],'attributes':_0x17dbfd['attributes'],'include':_0x17dbfd[_0x9662('0x20')]?_[_0x9662('0x21')](_0x17dbfd[_0x9662('0x20')],function(_0x478d6c){return{'model':db[_0x478d6c['model']],'as':_0x478d6c['as'],'attributes':_0x478d6c['attributes'],'include':_0x478d6c[_0x9662('0x20')]?_[_0x9662('0x21')](_0x478d6c[_0x9662('0x20')],function(_0x52c65b){return{'model':db[_0x52c65b[_0x9662('0x22')]],'as':_0x52c65b['as'],'attributes':_0x52c65b[_0x9662('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9662('0xf')](function(_0x79565d){logger[_0x9662('0x10')](_0x9662('0x24'),_0x28c20a);logger[_0x9662('0x12')]('ShowChatQueue',_0x28c20a,JSON['stringify'](_0x79565d));_0x5b97b8(_0x79565d);})['catch'](function(_0x41fbcc){logger['error']('ShowChatQueue',_0x41fbcc[_0x9662('0x15')],_0x28c20a);_0xae35b6(_0x13a3de[_0x9662('0x14')](0x1f4,_0x41fbcc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 322feba..29bdf99 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 _0x0bde=['save','update','emit','removeListener','register','length','chatQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe0bd('0x0'),'remove',_0xe0bd('0x1')];function createListener(_0x3dc984,_0x1d8922){return function(_0x1e198a){_0x1d8922[_0xe0bd('0x2')](_0x3dc984,_0x1e198a);};}function removeListener(_0x5541b9,_0x34df88){return function(){ChatQueueEvents[_0xe0bd('0x3')](_0x5541b9,_0x34df88);};}exports[_0xe0bd('0x4')]=function(_0x3b712a){for(var _0x22bfd1=0x0,_0x26393f=events[_0xe0bd('0x5')];_0x22bfd1<_0x26393f;_0x22bfd1++){var _0x491dc7=events[_0x22bfd1];var _0x40b36a=createListener(_0xe0bd('0x6')+_0x491dc7,_0x3b712a);ChatQueueEvents['on'](_0x491dc7,_0x40b36a);}}; \ No newline at end of file +var _0x2bc6=['length','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x21d691,_0x114a69){var _0x5b6fe6=function(_0x141727){while(--_0x141727){_0x21d691['push'](_0x21d691['shift']());}};_0x5b6fe6(++_0x114a69);}(_0x2bc6,0x163));var _0x62bc=function(_0x19906e,_0x1a2808){_0x19906e=_0x19906e-0x0;var _0x3f1aea=_0x2bc6[_0x19906e];return _0x3f1aea;};'use strict';var ChatQueueEvents=require(_0x62bc('0x0'));var events=[_0x62bc('0x1'),_0x62bc('0x2'),'update'];function createListener(_0x4b4e73,_0x5a2676){return function(_0x5c5a2a){_0x5a2676[_0x62bc('0x3')](_0x4b4e73,_0x5c5a2a);};}function removeListener(_0x576608,_0x2a1959){return function(){ChatQueueEvents[_0x62bc('0x4')](_0x576608,_0x2a1959);};}exports['register']=function(_0x3cce26){for(var _0x450cb6=0x0,_0x40af10=events[_0x62bc('0x5')];_0x450cb6<_0x40af10;_0x450cb6++){var _0x3ed6ad=events[_0x450cb6];var _0x3f625c=createListener('chatQueue:'+_0x3ed6ad,_0x3cce26);ChatQueueEvents['on'](_0x3ed6ad,_0x3f625c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6cb564e..f617c3b 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x5fc3,0xa8));var _0x35fc=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x5fc3[_0x37c07d];return _0x10dadc;};'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/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x3f0e83,_0x433755){var _0x4b793e=function(_0x116b31){while(--_0x116b31){_0x3f0e83['push'](_0x3f0e83['shift']());}};_0x4b793e(++_0x433755);}(_0x55ca,0x126));var _0xa55c=function(_0x5a3ee9,_0x11ed55){_0x5a3ee9=_0x5a3ee9-0x0;var _0x45032c=_0x55ca[_0x5a3ee9];return _0x45032c;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 54ccb21..578d7fb 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 _0xcb75=['sequelize','STRING','DATE'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0xcb75,0x183));var _0x5cb7=function(_0x1710e3,_0x1a9832){_0x1710e3=_0x1710e3-0x0;var _0x152bc5=_0xcb75[_0x1710e3];return _0x152bc5;};'use strict';var moment=require('moment');var Sequelize=require(_0x5cb7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5cb7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5cb7('0x1')]},'joinAt':{'type':Sequelize[_0x5cb7('0x2')]},'leaveAt':{'type':Sequelize[_0x5cb7('0x2')]},'acceptAt':{'type':Sequelize[_0x5cb7('0x2')]},'exitAt':{'type':Sequelize[_0x5cb7('0x2')]},'reason':{'type':Sequelize[_0x5cb7('0x1')]}}; \ No newline at end of file +var _0x7ccb=['STRING','DATE','moment','sequelize','exports'];(function(_0x925812,_0x2ee730){var _0x375ae9=function(_0x14fbe7){while(--_0x14fbe7){_0x925812['push'](_0x925812['shift']());}};_0x375ae9(++_0x2ee730);}(_0x7ccb,0x17e));var _0xb7cc=function(_0x188832,_0x49101d){_0x188832=_0x188832-0x0;var _0x2b990f=_0x7ccb[_0x188832];return _0x2b990f;};'use strict';var moment=require(_0xb7cc('0x0'));var Sequelize=require(_0xb7cc('0x1'));module[_0xb7cc('0x2')]={'uniqueid':{'type':Sequelize[_0xb7cc('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb7cc('0x4')]},'acceptAt':{'type':Sequelize[_0xb7cc('0x4')]},'exitAt':{'type':Sequelize[_0xb7cc('0x4')]},'reason':{'type':Sequelize[_0xb7cc('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 365f4f6..4d0ecc1 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 _0x62f1=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','save','update','then','stack','name','send','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','ChatQueueReport','includeAll','include','rows','show','params','keys','create','body','catch','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x62f1,0x112));var _0x162f=function(_0xc9191e,_0x17842f){_0xc9191e=_0xc9191e-0x0;var _0x32b242=_0x62f1[_0xc9191e];return _0x32b242;};'use strict';var emlformat=require(_0x162f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x162f('0x1'));var jsonpatch=require(_0x162f('0x2'));var rp=require(_0x162f('0x3'));var moment=require(_0x162f('0x4'));var BPromise=require(_0x162f('0x5'));var Mustache=require(_0x162f('0x6'));var util=require(_0x162f('0x7'));var path=require(_0x162f('0x8'));var sox=require(_0x162f('0x9'));var csv=require(_0x162f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x162f('0xb'));var _=require(_0x162f('0xc'));var squel=require('squel');var crypto=require(_0x162f('0xd'));var jsforce=require(_0x162f('0xe'));var deskjs=require(_0x162f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x162f('0x10'));var Papa=require(_0x162f('0x11'));var Redis=require(_0x162f('0x12'));var authService=require(_0x162f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x162f('0x14'));var hardwareService=require(_0x162f('0x15'));var logger=require(_0x162f('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x162f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6ae441,_0x361048){_0x361048=_0x361048||0xcc;return function(_0x4561d2){if(_0x4561d2){return _0x6ae441[_0x162f('0x18')](_0x361048);}return _0x6ae441['status'](_0x361048)[_0x162f('0x19')]();};}function respondWithResult(_0x2bf9f0,_0x3daa69){_0x3daa69=_0x3daa69||0xc8;return function(_0x130db8){if(_0x130db8){return _0x2bf9f0['status'](_0x3daa69)[_0x162f('0x1a')](_0x130db8);}};}function respondWithFilteredResult(_0x4e48e1,_0x250983){return function(_0x2d90ad){if(_0x2d90ad){var _0x40a284=typeof _0x250983[_0x162f('0x1b')]==='undefined'&&typeof _0x250983['limit']===_0x162f('0x1c');var _0xa03e71=_0x2d90ad[_0x162f('0x1d')];var _0x1ee433=_0x40a284?0x0:_0x250983[_0x162f('0x1b')];var _0x750506=_0x40a284?_0x2d90ad[_0x162f('0x1d')]:_0x250983['offset']+_0x250983[_0x162f('0x1e')];var _0x53ac47;if(_0x750506>=_0xa03e71){_0x750506=_0xa03e71;_0x53ac47=0xc8;}else{_0x53ac47=0xce;}_0x4e48e1[_0x162f('0x1f')](_0x53ac47);return _0x4e48e1[_0x162f('0x20')]('Content-Range',_0x1ee433+'-'+_0x750506+'/'+_0xa03e71)[_0x162f('0x1a')](_0x2d90ad);}return null;};}function patchUpdates(_0x236ef5){return function(_0x57796d){try{jsonpatch[_0x162f('0x21')](_0x57796d,_0x236ef5,!![]);}catch(_0x436a5a){return BPromise[_0x162f('0x22')](_0x436a5a);}return _0x57796d[_0x162f('0x23')]();};}function saveUpdates(_0x5dc1a7,_0xdab3e){return function(_0x246aff){if(_0x246aff){return _0x246aff[_0x162f('0x24')](_0x5dc1a7)[_0x162f('0x25')](function(_0x422241){return _0x422241;});}return null;};}function removeEntity(_0x1512b0,_0xbcbe11){return function(_0x331d0d){if(_0x331d0d){return _0x331d0d['destroy']()[_0x162f('0x25')](function(){_0x1512b0[_0x162f('0x1f')](0xcc)[_0x162f('0x19')]();});}};}function handleEntityNotFound(_0x16f5e2,_0x59482e){return function(_0x2fc293){if(!_0x2fc293){_0x16f5e2['sendStatus'](0x194);}return _0x2fc293;};}function handleError(_0x1e25d5,_0x54e4e1){_0x54e4e1=_0x54e4e1||0x1f4;return function(_0x2cd181){logger['error'](_0x2cd181[_0x162f('0x26')]);if(_0x2cd181['name']){delete _0x2cd181[_0x162f('0x27')];}_0x1e25d5[_0x162f('0x1f')](_0x54e4e1)[_0x162f('0x28')](_0x2cd181);};}exports['index']=function(_0x4bb880,_0x4c58ff){var _0x580e13={},_0x3f9247={},_0x1b0f5b={'count':0x0,'rows':[]};var _0x4c4049=_['map'](db['ChatQueueReport'][_0x162f('0x29')],function(_0x5089c7){return{'name':_0x5089c7[_0x162f('0x2a')],'type':_0x5089c7[_0x162f('0x2b')]['key']};});_0x3f9247['model']=_[_0x162f('0x2c')](_0x4c4049,_0x162f('0x27'));_0x3f9247[_0x162f('0x2d')]=_['keys'](_0x4bb880[_0x162f('0x2d')]);_0x3f9247[_0x162f('0x2e')]=_[_0x162f('0x2f')](_0x3f9247[_0x162f('0x30')],_0x3f9247['query']);_0x580e13['attributes']=_[_0x162f('0x2f')](_0x3f9247['model'],qs[_0x162f('0x31')](_0x4bb880['query']['fields']));_0x580e13['attributes']=_0x580e13['attributes'][_0x162f('0x32')]?_0x580e13[_0x162f('0x33')]:_0x3f9247[_0x162f('0x30')];if(!_0x4bb880['query'][_0x162f('0x34')](_0x162f('0x35'))){_0x580e13['limit']=qs[_0x162f('0x1e')](_0x4bb880[_0x162f('0x2d')][_0x162f('0x1e')]);_0x580e13['offset']=qs[_0x162f('0x1b')](_0x4bb880['query'][_0x162f('0x1b')]);}_0x580e13['order']=qs[_0x162f('0x36')](_0x4bb880['query'][_0x162f('0x36')]);_0x580e13[_0x162f('0x37')]=qs['filters'](_[_0x162f('0x38')](_0x4bb880['query'],_0x3f9247[_0x162f('0x2e')]),_0x4c4049);if(_0x4bb880[_0x162f('0x2d')]['filter']){_0x580e13[_0x162f('0x37')]=_['merge'](_0x580e13[_0x162f('0x37')],{'$or':_['map'](_0x4c4049,function(_0x5f4b3f){if(_0x5f4b3f[_0x162f('0x2b')]!==_0x162f('0x39')){var _0x4a328f={};_0x4a328f[_0x5f4b3f[_0x162f('0x27')]]={'$like':'%'+_0x4bb880['query']['filter']+'%'};return _0x4a328f;}})});}_0x580e13=_[_0x162f('0x3a')]({},_0x580e13,_0x4bb880[_0x162f('0x3b')]);var _0x59ca49={'where':_0x580e13[_0x162f('0x37')]};return db[_0x162f('0x3c')][_0x162f('0x1d')](_0x59ca49)[_0x162f('0x25')](function(_0x2fa18e){_0x1b0f5b['count']=_0x2fa18e;if(_0x4bb880[_0x162f('0x2d')][_0x162f('0x3d')]){_0x580e13[_0x162f('0x3e')]=[{'all':!![]}];}return db[_0x162f('0x3c')]['findAll'](_0x580e13);})[_0x162f('0x25')](function(_0x146daa){_0x1b0f5b[_0x162f('0x3f')]=_0x146daa;return _0x1b0f5b;})[_0x162f('0x25')](respondWithFilteredResult(_0x4c58ff,_0x580e13))['catch'](handleError(_0x4c58ff,null));};exports[_0x162f('0x40')]=function(_0xc2143e,_0x52c8c3){var _0x8c8443={'raw':!![],'where':{'id':_0xc2143e[_0x162f('0x41')]['id']}},_0x21dd30={};_0x21dd30[_0x162f('0x30')]=_[_0x162f('0x42')](db[_0x162f('0x3c')][_0x162f('0x29')]);_0x21dd30['query']=_[_0x162f('0x42')](_0xc2143e[_0x162f('0x2d')]);_0x21dd30['filters']=_[_0x162f('0x2f')](_0x21dd30[_0x162f('0x30')],_0x21dd30['query']);_0x8c8443[_0x162f('0x33')]=_[_0x162f('0x2f')](_0x21dd30[_0x162f('0x30')],qs[_0x162f('0x31')](_0xc2143e[_0x162f('0x2d')][_0x162f('0x31')]));_0x8c8443[_0x162f('0x33')]=_0x8c8443[_0x162f('0x33')][_0x162f('0x32')]?_0x8c8443[_0x162f('0x33')]:_0x21dd30[_0x162f('0x30')];if(_0xc2143e[_0x162f('0x2d')][_0x162f('0x3d')]){_0x8c8443[_0x162f('0x3e')]=[{'all':!![]}];}_0x8c8443=_['merge']({},_0x8c8443,_0xc2143e[_0x162f('0x3b')]);return db[_0x162f('0x3c')]['find'](_0x8c8443)['then'](handleEntityNotFound(_0x52c8c3,null))[_0x162f('0x25')](respondWithResult(_0x52c8c3,null))['catch'](handleError(_0x52c8c3,null));};exports[_0x162f('0x43')]=function(_0x5d06c1,_0x1e936b){return db['ChatQueueReport'][_0x162f('0x43')](_0x5d06c1[_0x162f('0x44')],{})[_0x162f('0x25')](respondWithResult(_0x1e936b,0xc9))[_0x162f('0x45')](handleError(_0x1e936b,null));};exports[_0x162f('0x24')]=function(_0xf74671,_0x466136){if(_0xf74671[_0x162f('0x44')]['id']){delete _0xf74671[_0x162f('0x44')]['id'];}return db['ChatQueueReport'][_0x162f('0x46')]({'where':{'id':_0xf74671[_0x162f('0x41')]['id']}})['then'](handleEntityNotFound(_0x466136,null))[_0x162f('0x25')](saveUpdates(_0xf74671[_0x162f('0x44')],null))[_0x162f('0x25')](respondWithResult(_0x466136,null))[_0x162f('0x45')](handleError(_0x466136,null));};exports[_0x162f('0x47')]=function(_0x487835,_0x232348){return db[_0x162f('0x3c')][_0x162f('0x46')]({'where':{'id':_0x487835[_0x162f('0x41')]['id']}})[_0x162f('0x25')](handleEntityNotFound(_0x232348,null))['then'](removeEntity(_0x232348,null))['catch'](handleError(_0x232348,null));};exports[_0x162f('0x48')]=function(_0x4d74eb,_0x3e25b5){return db[_0x162f('0x3c')]['describe']()[_0x162f('0x25')](respondWithResult(_0x3e25b5,null))[_0x162f('0x45')](handleError(_0x3e25b5,null));}; \ No newline at end of file +var _0xd8fb=['catch','show','params','keys','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows'];(function(_0x41f43d,_0x3df10c){var _0x34dc57=function(_0x26e078){while(--_0x26e078){_0x41f43d['push'](_0x41f43d['shift']());}};_0x34dc57(++_0x3df10c);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1f719a,_0x13c44a){_0x1f719a=_0x1f719a-0x0;var _0x537020=_0xd8fb[_0x1f719a];return _0x537020;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['ChatQueueReport'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')](_0x1f12dd[_0xbd8f('0x44')],{})[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,0xc9))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x255c59,_0x3d0ffa){if(_0x255c59[_0xbd8f('0x44')]['id']){delete _0x255c59[_0xbd8f('0x44')]['id'];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'id':_0x255c59[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x3d0ffa,null))['then'](saveUpdates(_0x255c59[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x3d0ffa,null))[_0xbd8f('0x3c')](handleError(_0x3d0ffa,null));};exports[_0xbd8f('0x45')]=function(_0x4ce6b0,_0x1b38ad){return db['ChatQueueReport'][_0xbd8f('0x42')]({'where':{'id':_0x4ce6b0[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x1b38ad,null))[_0xbd8f('0x1f')](removeEntity(_0x1b38ad,null))['catch'](handleError(_0x1b38ad,null));};exports[_0xbd8f('0x46')]=function(_0x35b814,_0x3b67ac){return db[_0xbd8f('0x25')][_0xbd8f('0x46')]()[_0xbd8f('0x1f')](respondWithResult(_0x3b67ac,null))['catch'](handleError(_0x3b67ac,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 89684f4..1e0c87f 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3383d6,_0x4e4eb9){var _0x2d247d=function(_0x5b9a13){while(--_0x5b9a13){_0x3383d6['push'](_0x3383d6['shift']());}};_0x2d247d(++_0x4e4eb9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'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 +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x4ca648,_0x6ce4b2){var _0x3d8d54=function(_0x1ef0fd){while(--_0x1ef0fd){_0x4ca648['push'](_0x4ca648['shift']());}};_0x3d8d54(++_0x6ce4b2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index a1ebe50..00e8947 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 _0x722b=['stringify','error','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateChatQueueReport','create','body','options','then','debug','ChatQueueReport','raw','where','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3ac16c,_0x54c187){var _0x1204e6=function(_0x25cf2c){while(--_0x25cf2c){_0x3ac16c['push'](_0x3ac16c['shift']());}};_0x1204e6(++_0x54c187);}(_0x722b,0x1e2));var _0xb722=function(_0x582b86,_0x251422){_0x582b86=_0x582b86-0x0;var _0x57f4c2=_0x722b[_0x582b86];return _0x57f4c2;};'use strict';var _=require(_0xb722('0x0'));var util=require(_0xb722('0x1'));var moment=require(_0xb722('0x2'));var BPromise=require('bluebird');var rs=require(_0xb722('0x3'));var fs=require('fs');var Redis=require(_0xb722('0x4'));var db=require(_0xb722('0x5'))['db'];var utils=require(_0xb722('0x6'));var logger=require(_0xb722('0x7'))('rpc');var config=require(_0xb722('0x8'));var jayson=require(_0xb722('0x9'));var client=jayson[_0xb722('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x284fff,_0x5b900a,_0x14bdd9){return new BPromise(function(_0x3e49fe,_0x207792){return client[_0xb722('0xb')](_0x284fff,_0x14bdd9)['then'](function(_0x3a15f8){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5b900a,_0xb722('0xc'));logger['debug'](_0xb722('0xd'),_0x5b900a,_0xb722('0xc'),JSON[_0xb722('0xe')](_0x3a15f8));if(_0x3a15f8[_0xb722('0xf')]){if(_0x3a15f8[_0xb722('0xf')]['code']===0x1f4){logger['error'](_0xb722('0x10'),_0x5b900a,_0x3a15f8['error'][_0xb722('0x11')]);return _0x207792(_0x3a15f8['error'][_0xb722('0x11')]);}logger[_0xb722('0xf')](_0xb722('0x10'),_0x5b900a,_0x3a15f8['error']['message']);return _0x3e49fe(_0x3a15f8[_0xb722('0xf')][_0xb722('0x11')]);}else{logger[_0xb722('0x12')](_0xb722('0x10'),_0x5b900a,_0xb722('0xc'));_0x3e49fe(_0x3a15f8[_0xb722('0x13')][_0xb722('0x11')]);}})[_0xb722('0x14')](function(_0xa7cda0){logger[_0xb722('0xf')](_0xb722('0x10'),_0x5b900a,_0xa7cda0);_0x207792(_0xa7cda0);});});}exports[_0xb722('0x15')]=function(_0xa023cc){var _0x148dac=this;return new Promise(function(_0x334cb7,_0x3f654c){return db['ChatQueueReport'][_0xb722('0x16')](_0xa023cc[_0xb722('0x17')],{'raw':_0xa023cc[_0xb722('0x18')]?_0xa023cc[_0xb722('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb722('0x19')](function(_0x2a7f6f){logger[_0xb722('0x12')]('CreateChatQueueReport',_0xa023cc);logger[_0xb722('0x1a')](_0xb722('0x15'),_0xa023cc,JSON[_0xb722('0xe')](_0x2a7f6f));_0x334cb7(_0x2a7f6f);})['catch'](function(_0x10c9c5){logger[_0xb722('0xf')](_0xb722('0x15'),_0x10c9c5['message'],_0xa023cc);_0x3f654c(_0x148dac['error'](0x1f4,_0x10c9c5[_0xb722('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x107464){var _0x584e37=this;return new Promise(function(_0x4287ba,_0x5a2397){return db[_0xb722('0x1b')]['update'](_0x107464['body'],{'raw':_0x107464[_0xb722('0x18')]?_0x107464['options'][_0xb722('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x107464[_0xb722('0x18')]?_0x107464[_0xb722('0x18')][_0xb722('0x1d')]||null:null,'attributes':_0x107464[_0xb722('0x18')]?_0x107464['options']['attributes']||null:null,'limit':_0x107464[_0xb722('0x18')]?_0x107464[_0xb722('0x18')]['limit']||null:null})[_0xb722('0x19')](function(_0x24606f){logger['info']('UpdateChatQueueReport',_0x107464);logger[_0xb722('0x1a')]('UpdateChatQueueReport',_0x107464,JSON[_0xb722('0xe')](_0x24606f));_0x4287ba(_0x24606f);})['catch'](function(_0x5dd9bb){logger[_0xb722('0xf')](_0xb722('0x1e'),_0x5dd9bb[_0xb722('0x11')],_0x107464);_0x5a2397(_0x584e37['error'](0x1f4,_0x5dd9bb['message']));});});}; \ No newline at end of file +var _0x9fd0=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','raw','UpdateChatQueueReport','options','where','attributes','lodash','util','bluebird'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9fd0,0x13c));var _0x09fd=function(_0x584beb,_0x45f583){_0x584beb=_0x584beb-0x0;var _0x1e316d=_0x9fd0[_0x584beb];return _0x1e316d;};'use strict';var _=require(_0x09fd('0x0'));var util=require(_0x09fd('0x1'));var moment=require('moment');var BPromise=require(_0x09fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09fd('0x3'))['db'];var utils=require(_0x09fd('0x4'));var logger=require('../../config/logger')(_0x09fd('0x5'));var config=require(_0x09fd('0x6'));var jayson=require(_0x09fd('0x7'));var client=jayson['client'][_0x09fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2387be,_0xafbeb3,_0x55c347){return new BPromise(function(_0x1261a3,_0xca76e3){return client['request'](_0x2387be,_0x55c347)[_0x09fd('0x9')](function(_0x59c37c){logger[_0x09fd('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0xafbeb3,_0x09fd('0xb'));logger[_0x09fd('0xc')](_0x09fd('0xd'),_0xafbeb3,_0x09fd('0xb'),JSON[_0x09fd('0xe')](_0x59c37c));if(_0x59c37c[_0x09fd('0xf')]){if(_0x59c37c[_0x09fd('0xf')][_0x09fd('0x10')]===0x1f4){logger['error'](_0x09fd('0x11'),_0xafbeb3,_0x59c37c[_0x09fd('0xf')][_0x09fd('0x12')]);return _0xca76e3(_0x59c37c[_0x09fd('0xf')][_0x09fd('0x12')]);}logger[_0x09fd('0xf')](_0x09fd('0x11'),_0xafbeb3,_0x59c37c[_0x09fd('0xf')]['message']);return _0x1261a3(_0x59c37c[_0x09fd('0xf')][_0x09fd('0x12')]);}else{logger[_0x09fd('0xa')](_0x09fd('0x11'),_0xafbeb3,'request\x20sent');_0x1261a3(_0x59c37c[_0x09fd('0x13')][_0x09fd('0x12')]);}})[_0x09fd('0x14')](function(_0x417ca3){logger[_0x09fd('0xf')](_0x09fd('0x11'),_0xafbeb3,_0x417ca3);_0xca76e3(_0x417ca3);});});}exports[_0x09fd('0x15')]=function(_0x37c692){var _0x5ebea1=this;return new Promise(function(_0x57059e,_0x199503){return db[_0x09fd('0x16')]['create'](_0x37c692[_0x09fd('0x17')],{'raw':_0x37c692['options']?_0x37c692['options'][_0x09fd('0x18')]===undefined?!![]:![]:!![]})[_0x09fd('0x9')](function(_0x410263){logger[_0x09fd('0xa')]('CreateChatQueueReport',_0x37c692);logger['debug'](_0x09fd('0x15'),_0x37c692,JSON['stringify'](_0x410263));_0x57059e(_0x410263);})[_0x09fd('0x14')](function(_0x2ba39a){logger[_0x09fd('0xf')](_0x09fd('0x15'),_0x2ba39a['message'],_0x37c692);_0x199503(_0x5ebea1[_0x09fd('0xf')](0x1f4,_0x2ba39a[_0x09fd('0x12')]));});});};exports[_0x09fd('0x19')]=function(_0x2216fb){var _0x376b3d=this;return new Promise(function(_0xfeef43,_0x183699){return db[_0x09fd('0x16')]['update'](_0x2216fb[_0x09fd('0x17')],{'raw':_0x2216fb[_0x09fd('0x1a')]?_0x2216fb['options'][_0x09fd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2216fb[_0x09fd('0x1a')]?_0x2216fb[_0x09fd('0x1a')][_0x09fd('0x1b')]||null:null,'attributes':_0x2216fb[_0x09fd('0x1a')]?_0x2216fb['options'][_0x09fd('0x1c')]||null:null,'limit':_0x2216fb[_0x09fd('0x1a')]?_0x2216fb[_0x09fd('0x1a')]['limit']||null:null})[_0x09fd('0x9')](function(_0x2c9958){logger[_0x09fd('0xa')](_0x09fd('0x19'),_0x2216fb);logger[_0x09fd('0xc')](_0x09fd('0x19'),_0x2216fb,JSON['stringify'](_0x2c9958));_0xfeef43(_0x2c9958);})[_0x09fd('0x14')](function(_0x5baeef){logger[_0x09fd('0xf')](_0x09fd('0x19'),_0x5baeef[_0x09fd('0x12')],_0x2216fb);_0x183699(_0x376b3d[_0x09fd('0xf')](0x1f4,_0x5baeef[_0x09fd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6e41dad..165d660 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 _0x3b9c=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x33991e,_0x191657){var _0x2f8b34=function(_0x55ed46){while(--_0x55ed46){_0x33991e['push'](_0x33991e['shift']());}};_0x2f8b34(++_0x191657);}(_0x3b9c,0x148));var _0xc3b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc3b9('0x0'));var util=require(_0xc3b9('0x1'));var path=require(_0xc3b9('0x2'));var timeout=require(_0xc3b9('0x3'));var express=require(_0xc3b9('0x4'));var router=express[_0xc3b9('0x5')]();var fs_extra=require(_0xc3b9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc3b9('0x7'));var config=require('../../config/environment');var controller=require(_0xc3b9('0x8'));router[_0xc3b9('0x9')]('/',auth[_0xc3b9('0xa')](),controller[_0xc3b9('0xb')]);router['get'](_0xc3b9('0xc'),auth['isAuthenticated'](),controller[_0xc3b9('0xd')]);router[_0xc3b9('0x9')](_0xc3b9('0xe'),auth[_0xc3b9('0xa')](),controller[_0xc3b9('0xf')]);router[_0xc3b9('0x10')]('/',auth[_0xc3b9('0xa')](),controller['create']);router[_0xc3b9('0x11')]('/:id',auth[_0xc3b9('0xa')](),controller[_0xc3b9('0x12')]);router[_0xc3b9('0x13')](_0xc3b9('0xe'),auth[_0xc3b9('0xa')](),controller['destroy']);module[_0xc3b9('0x14')]=router; \ No newline at end of file +var _0xfbc5=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x1d3892,_0x47d5fe){var _0x574ff2=function(_0x5cc441){while(--_0x5cc441){_0x1d3892['push'](_0x1d3892['shift']());}};_0x574ff2(++_0x47d5fe);}(_0xfbc5,0x1f3));var _0x5fbc=function(_0x1cf1e2,_0x10fcc4){_0x1cf1e2=_0x1cf1e2-0x0;var _0x3c6e18=_0xfbc5[_0x1cf1e2];return _0x3c6e18;};'use strict';var multer=require(_0x5fbc('0x0'));var util=require(_0x5fbc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5fbc('0x2'));var router=express[_0x5fbc('0x3')]();var fs_extra=require(_0x5fbc('0x4'));var auth=require(_0x5fbc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5fbc('0x6'));var controller=require(_0x5fbc('0x7'));router[_0x5fbc('0x8')]('/',auth['isAuthenticated'](),controller[_0x5fbc('0x9')]);router[_0x5fbc('0x8')](_0x5fbc('0xa'),auth[_0x5fbc('0xb')](),controller[_0x5fbc('0xc')]);router[_0x5fbc('0x8')](_0x5fbc('0xd'),auth[_0x5fbc('0xb')](),controller[_0x5fbc('0xe')]);router['post']('/',auth[_0x5fbc('0xb')](),controller['create']);router[_0x5fbc('0xf')](_0x5fbc('0xd'),auth[_0x5fbc('0xb')](),controller[_0x5fbc('0x10')]);router[_0x5fbc('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5fbc('0x12')]);module[_0x5fbc('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c3b216e..1689ef0 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x5a125c,_0x155fa2){var _0x4c70af=function(_0x5dccb6){while(--_0x5dccb6){_0x5a125c['push'](_0x5a125c['shift']());}};_0x4c70af(++_0x155fa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x492f90,_0x5c3c44){var _0x4bdee5=function(_0x36c5e2){while(--_0x36c5e2){_0x492f90['push'](_0x492f90['shift']());}};_0x4bdee5(++_0x5c3c44);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xcb91[_0x44a64f];return _0x52024b;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 94e0f60..d83715d 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 _0x2a2f=['index','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','catch','fields','create','body','update','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','error','stack','name'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x2a2f,0xb7));var _0xf2a2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2a2f[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2a2('0x0'));var zipdir=require(_0xf2a2('0x1'));var jsonpatch=require(_0xf2a2('0x2'));var rp=require('request-promise');var moment=require(_0xf2a2('0x3'));var BPromise=require(_0xf2a2('0x4'));var Mustache=require(_0xf2a2('0x5'));var util=require(_0xf2a2('0x6'));var path=require(_0xf2a2('0x7'));var sox=require('sox');var csv=require(_0xf2a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2a2('0x9'));var _=require(_0xf2a2('0xa'));var squel=require(_0xf2a2('0xb'));var crypto=require('crypto');var jsforce=require(_0xf2a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf2a2('0x8'));var querystring=require('querystring');var Papa=require(_0xf2a2('0xd'));var Redis=require(_0xf2a2('0xe'));var authService=require(_0xf2a2('0xf'));var qs=require(_0xf2a2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2a2('0x11'));var logger=require('../../config/logger')(_0xf2a2('0x12'));var utils=require(_0xf2a2('0x13'));var config=require(_0xf2a2('0x14'));var licenseUtil=require(_0xf2a2('0x15'));var db=require(_0xf2a2('0x16'))['db'];function respondWithStatusCode(_0x52604d,_0x26d0b1){_0x26d0b1=_0x26d0b1||0xcc;return function(_0x9b1a73){if(_0x9b1a73){return _0x52604d[_0xf2a2('0x17')](_0x26d0b1);}return _0x52604d[_0xf2a2('0x18')](_0x26d0b1)[_0xf2a2('0x19')]();};}function respondWithResult(_0x3b0cee,_0x212d4c){_0x212d4c=_0x212d4c||0xc8;return function(_0x5dd4ac){if(_0x5dd4ac){return _0x3b0cee[_0xf2a2('0x18')](_0x212d4c)[_0xf2a2('0x1a')](_0x5dd4ac);}};}function respondWithFilteredResult(_0x37fd44,_0x5a0240){return function(_0x6addc1){if(_0x6addc1){var _0x1aee64=typeof _0x5a0240[_0xf2a2('0x1b')]===_0xf2a2('0x1c')&&typeof _0x5a0240[_0xf2a2('0x1d')]===_0xf2a2('0x1c');var _0x1766d8=_0x6addc1[_0xf2a2('0x1e')];var _0x46945f=_0x1aee64?0x0:_0x5a0240[_0xf2a2('0x1b')];var _0x44c4a3=_0x1aee64?_0x6addc1[_0xf2a2('0x1e')]:_0x5a0240[_0xf2a2('0x1b')]+_0x5a0240['limit'];var _0x74182d;if(_0x44c4a3>=_0x1766d8){_0x44c4a3=_0x1766d8;_0x74182d=0xc8;}else{_0x74182d=0xce;}_0x37fd44[_0xf2a2('0x18')](_0x74182d);return _0x37fd44['set']('Content-Range',_0x46945f+'-'+_0x44c4a3+'/'+_0x1766d8)[_0xf2a2('0x1a')](_0x6addc1);}return null;};}function patchUpdates(_0x57cf83){return function(_0x44eda5){try{jsonpatch['apply'](_0x44eda5,_0x57cf83,!![]);}catch(_0x10c4db){return BPromise[_0xf2a2('0x1f')](_0x10c4db);}return _0x44eda5[_0xf2a2('0x20')]();};}function saveUpdates(_0x7e10ec,_0x5c3e9c){return function(_0x4292b6){if(_0x4292b6){return _0x4292b6['update'](_0x7e10ec)['then'](function(_0x300b9a){return _0x300b9a;});}return null;};}function removeEntity(_0x36ab03,_0x2b8b45){return function(_0x14d278){if(_0x14d278){return _0x14d278['destroy']()['then'](function(){_0x36ab03[_0xf2a2('0x18')](0xcc)[_0xf2a2('0x19')]();});}};}function handleEntityNotFound(_0x494e7e,_0x5ae29a){return function(_0x54a209){if(!_0x54a209){_0x494e7e['sendStatus'](0x194);}return _0x54a209;};}function handleError(_0xdd24e3,_0x1c1dfe){_0x1c1dfe=_0x1c1dfe||0x1f4;return function(_0x50295d){logger[_0xf2a2('0x21')](_0x50295d[_0xf2a2('0x22')]);if(_0x50295d[_0xf2a2('0x23')]){delete _0x50295d['name'];}_0xdd24e3['status'](_0x1c1dfe)['send'](_0x50295d);};}exports[_0xf2a2('0x24')]=function(_0x24576d,_0x2e1653){var _0x2e691c={},_0x502a0f={},_0x4d6de1={'count':0x0,'rows':[]};var _0x12472a=_['map'](db[_0xf2a2('0x25')][_0xf2a2('0x26')],function(_0x254bd5){return{'name':_0x254bd5[_0xf2a2('0x27')],'type':_0x254bd5[_0xf2a2('0x28')]['key']};});_0x502a0f[_0xf2a2('0x29')]=_[_0xf2a2('0x2a')](_0x12472a,_0xf2a2('0x23'));_0x502a0f[_0xf2a2('0x2b')]=_[_0xf2a2('0x2c')](_0x24576d[_0xf2a2('0x2b')]);_0x502a0f['filters']=_[_0xf2a2('0x2d')](_0x502a0f[_0xf2a2('0x29')],_0x502a0f[_0xf2a2('0x2b')]);_0x2e691c[_0xf2a2('0x2e')]=_[_0xf2a2('0x2d')](_0x502a0f[_0xf2a2('0x29')],qs['fields'](_0x24576d[_0xf2a2('0x2b')]['fields']));_0x2e691c[_0xf2a2('0x2e')]=_0x2e691c[_0xf2a2('0x2e')][_0xf2a2('0x2f')]?_0x2e691c[_0xf2a2('0x2e')]:_0x502a0f[_0xf2a2('0x29')];if(!_0x24576d[_0xf2a2('0x2b')][_0xf2a2('0x30')](_0xf2a2('0x31'))){_0x2e691c[_0xf2a2('0x1d')]=qs['limit'](_0x24576d[_0xf2a2('0x2b')][_0xf2a2('0x1d')]);_0x2e691c['offset']=qs[_0xf2a2('0x1b')](_0x24576d[_0xf2a2('0x2b')][_0xf2a2('0x1b')]);}_0x2e691c[_0xf2a2('0x32')]=qs['sort'](_0x24576d[_0xf2a2('0x2b')][_0xf2a2('0x33')]);_0x2e691c['where']=qs[_0xf2a2('0x34')](_[_0xf2a2('0x35')](_0x24576d[_0xf2a2('0x2b')],_0x502a0f[_0xf2a2('0x34')]),_0x12472a);if(_0x24576d[_0xf2a2('0x2b')]['filter']){_0x2e691c['where']=_[_0xf2a2('0x36')](_0x2e691c[_0xf2a2('0x37')],{'$or':_['map'](_0x12472a,function(_0xfa0359){if(_0xfa0359['type']!==_0xf2a2('0x38')){var _0x356d3e={};_0x356d3e[_0xfa0359[_0xf2a2('0x23')]]={'$like':'%'+_0x24576d[_0xf2a2('0x2b')][_0xf2a2('0x39')]+'%'};return _0x356d3e;}})});}_0x2e691c=_['merge']({},_0x2e691c,_0x24576d[_0xf2a2('0x3a')]);var _0x3c497d={'where':_0x2e691c[_0xf2a2('0x37')]};return db[_0xf2a2('0x25')][_0xf2a2('0x1e')](_0x3c497d)['then'](function(_0x251162){_0x4d6de1['count']=_0x251162;if(_0x24576d[_0xf2a2('0x2b')][_0xf2a2('0x3b')]){_0x2e691c[_0xf2a2('0x3c')]=[{'all':!![]}];}return db[_0xf2a2('0x25')][_0xf2a2('0x3d')](_0x2e691c);})[_0xf2a2('0x3e')](function(_0x1880b7){_0x4d6de1[_0xf2a2('0x3f')]=_0x1880b7;return _0x4d6de1;})[_0xf2a2('0x3e')](respondWithFilteredResult(_0x2e1653,_0x2e691c))[_0xf2a2('0x40')](handleError(_0x2e1653,null));};exports['show']=function(_0x1109e4,_0x52fbdb){var _0xa27cc0={'raw':!![],'where':{'id':_0x1109e4['params']['id']}},_0x23b238={};_0x23b238[_0xf2a2('0x29')]=_[_0xf2a2('0x2c')](db['ChatTransferReport'][_0xf2a2('0x26')]);_0x23b238[_0xf2a2('0x2b')]=_[_0xf2a2('0x2c')](_0x1109e4['query']);_0x23b238[_0xf2a2('0x34')]=_['intersection'](_0x23b238[_0xf2a2('0x29')],_0x23b238[_0xf2a2('0x2b')]);_0xa27cc0[_0xf2a2('0x2e')]=_[_0xf2a2('0x2d')](_0x23b238[_0xf2a2('0x29')],qs[_0xf2a2('0x41')](_0x1109e4['query']['fields']));_0xa27cc0['attributes']=_0xa27cc0['attributes']['length']?_0xa27cc0['attributes']:_0x23b238['model'];if(_0x1109e4[_0xf2a2('0x2b')][_0xf2a2('0x3b')]){_0xa27cc0[_0xf2a2('0x3c')]=[{'all':!![]}];}_0xa27cc0=_[_0xf2a2('0x36')]({},_0xa27cc0,_0x1109e4['options']);return db['ChatTransferReport']['find'](_0xa27cc0)[_0xf2a2('0x3e')](handleEntityNotFound(_0x52fbdb,null))[_0xf2a2('0x3e')](respondWithResult(_0x52fbdb,null))['catch'](handleError(_0x52fbdb,null));};exports[_0xf2a2('0x42')]=function(_0xad2a77,_0x3ad245){return db[_0xf2a2('0x25')]['create'](_0xad2a77[_0xf2a2('0x43')],{})[_0xf2a2('0x3e')](respondWithResult(_0x3ad245,0xc9))['catch'](handleError(_0x3ad245,null));};exports[_0xf2a2('0x44')]=function(_0x23643e,_0x21849e){if(_0x23643e[_0xf2a2('0x43')]['id']){delete _0x23643e[_0xf2a2('0x43')]['id'];}return db[_0xf2a2('0x25')][_0xf2a2('0x45')]({'where':{'id':_0x23643e[_0xf2a2('0x46')]['id']}})[_0xf2a2('0x3e')](handleEntityNotFound(_0x21849e,null))[_0xf2a2('0x3e')](saveUpdates(_0x23643e[_0xf2a2('0x43')],null))[_0xf2a2('0x3e')](respondWithResult(_0x21849e,null))[_0xf2a2('0x40')](handleError(_0x21849e,null));};exports[_0xf2a2('0x47')]=function(_0x54d820,_0x1868f0){return db[_0xf2a2('0x25')][_0xf2a2('0x45')]({'where':{'id':_0x54d820[_0xf2a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x1868f0,null))[_0xf2a2('0x3e')](removeEntity(_0x1868f0,null))[_0xf2a2('0x40')](handleError(_0x1868f0,null));};exports[_0xf2a2('0x48')]=function(_0x3f02a0,_0x46fcea){return db[_0xf2a2('0x25')][_0xf2a2('0x48')]()[_0xf2a2('0x3e')](respondWithResult(_0x46fcea,null))['catch'](handleError(_0x46fcea,null));}; \ No newline at end of file +var _0xde7a=['findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','includeAll','include'];(function(_0x1541bb,_0x58b07c){var _0x409bec=function(_0x416e50){while(--_0x416e50){_0x1541bb['push'](_0x1541bb['shift']());}};_0x409bec(++_0x58b07c);}(_0xde7a,0xa6));var _0xade7=function(_0x34ece7,_0x197dce){_0x34ece7=_0x34ece7-0x0;var _0x2bb837=_0xde7a[_0x34ece7];return _0x2bb837;};'use strict';var emlformat=require(_0xade7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xade7('0x1'));var jsonpatch=require(_0xade7('0x2'));var rp=require(_0xade7('0x3'));var moment=require(_0xade7('0x4'));var BPromise=require(_0xade7('0x5'));var Mustache=require(_0xade7('0x6'));var util=require(_0xade7('0x7'));var path=require(_0xade7('0x8'));var sox=require('sox');var csv=require(_0xade7('0x9'));var ejs=require(_0xade7('0xa'));var fs=require('fs');var fs_extra=require(_0xade7('0xb'));var _=require(_0xade7('0xc'));var squel=require('squel');var crypto=require(_0xade7('0xd'));var jsforce=require(_0xade7('0xe'));var deskjs=require(_0xade7('0xf'));var toCsv=require(_0xade7('0x9'));var querystring=require(_0xade7('0x10'));var Papa=require(_0xade7('0x11'));var Redis=require(_0xade7('0x12'));var authService=require(_0xade7('0x13'));var qs=require(_0xade7('0x14'));var as=require(_0xade7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xade7('0x16'))('api');var utils=require(_0xade7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xade7('0x18'));var db=require(_0xade7('0x19'))['db'];function respondWithStatusCode(_0x4d5e6f,_0xc6753f){_0xc6753f=_0xc6753f||0xcc;return function(_0x5c5733){if(_0x5c5733){return _0x4d5e6f[_0xade7('0x1a')](_0xc6753f);}return _0x4d5e6f[_0xade7('0x1b')](_0xc6753f)[_0xade7('0x1c')]();};}function respondWithResult(_0x560f21,_0x38e013){_0x38e013=_0x38e013||0xc8;return function(_0x21b4ee){if(_0x21b4ee){return _0x560f21['status'](_0x38e013)[_0xade7('0x1d')](_0x21b4ee);}};}function respondWithFilteredResult(_0x5565d4,_0x5f31ba){return function(_0x4bdf1c){if(_0x4bdf1c){var _0x4fc876=typeof _0x5f31ba[_0xade7('0x1e')]===_0xade7('0x1f')&&typeof _0x5f31ba['limit']===_0xade7('0x1f');var _0x3eb2c8=_0x4bdf1c[_0xade7('0x20')];var _0xf61991=_0x4fc876?0x0:_0x5f31ba[_0xade7('0x1e')];var _0x4aed39=_0x4fc876?_0x4bdf1c[_0xade7('0x20')]:_0x5f31ba[_0xade7('0x1e')]+_0x5f31ba[_0xade7('0x21')];var _0x5961d9;if(_0x4aed39>=_0x3eb2c8){_0x4aed39=_0x3eb2c8;_0x5961d9=0xc8;}else{_0x5961d9=0xce;}_0x5565d4['status'](_0x5961d9);return _0x5565d4[_0xade7('0x22')](_0xade7('0x23'),_0xf61991+'-'+_0x4aed39+'/'+_0x3eb2c8)[_0xade7('0x1d')](_0x4bdf1c);}return null;};}function patchUpdates(_0x24a9af){return function(_0x1ce8eb){try{jsonpatch[_0xade7('0x24')](_0x1ce8eb,_0x24a9af,!![]);}catch(_0x54d69d){return BPromise[_0xade7('0x25')](_0x54d69d);}return _0x1ce8eb[_0xade7('0x26')]();};}function saveUpdates(_0x2b6761,_0x366342){return function(_0x1cf2ee){if(_0x1cf2ee){return _0x1cf2ee[_0xade7('0x27')](_0x2b6761)[_0xade7('0x28')](function(_0x428011){return _0x428011;});}return null;};}function removeEntity(_0x14ca3e,_0x1b2ad7){return function(_0x412178){if(_0x412178){return _0x412178[_0xade7('0x29')]()[_0xade7('0x28')](function(){_0x14ca3e['status'](0xcc)[_0xade7('0x1c')]();});}};}function handleEntityNotFound(_0x2bd4fc,_0x3f87b0){return function(_0x45c671){if(!_0x45c671){_0x2bd4fc[_0xade7('0x1a')](0x194);}return _0x45c671;};}function handleError(_0x578d37,_0x4597cd){_0x4597cd=_0x4597cd||0x1f4;return function(_0x483426){logger[_0xade7('0x2a')](_0x483426[_0xade7('0x2b')]);if(_0x483426['name']){delete _0x483426[_0xade7('0x2c')];}_0x578d37['status'](_0x4597cd)[_0xade7('0x2d')](_0x483426);};}exports[_0xade7('0x2e')]=function(_0x49cd4c,_0x55c050){var _0x40be13={},_0x3385d1={},_0x26fc41={'count':0x0,'rows':[]};var _0x517bb0=_[_0xade7('0x2f')](db['ChatTransferReport'][_0xade7('0x30')],function(_0x4f94bf){return{'name':_0x4f94bf['fieldName'],'type':_0x4f94bf[_0xade7('0x31')][_0xade7('0x32')]};});_0x3385d1['model']=_[_0xade7('0x2f')](_0x517bb0,_0xade7('0x2c'));_0x3385d1['query']=_[_0xade7('0x33')](_0x49cd4c[_0xade7('0x34')]);_0x3385d1[_0xade7('0x35')]=_[_0xade7('0x36')](_0x3385d1[_0xade7('0x37')],_0x3385d1['query']);_0x40be13[_0xade7('0x38')]=_[_0xade7('0x36')](_0x3385d1[_0xade7('0x37')],qs['fields'](_0x49cd4c[_0xade7('0x34')][_0xade7('0x39')]));_0x40be13[_0xade7('0x38')]=_0x40be13[_0xade7('0x38')][_0xade7('0x3a')]?_0x40be13['attributes']:_0x3385d1[_0xade7('0x37')];if(!_0x49cd4c[_0xade7('0x34')]['hasOwnProperty'](_0xade7('0x3b'))){_0x40be13[_0xade7('0x21')]=qs['limit'](_0x49cd4c[_0xade7('0x34')][_0xade7('0x21')]);_0x40be13[_0xade7('0x1e')]=qs[_0xade7('0x1e')](_0x49cd4c[_0xade7('0x34')][_0xade7('0x1e')]);}_0x40be13[_0xade7('0x3c')]=qs['sort'](_0x49cd4c[_0xade7('0x34')][_0xade7('0x3d')]);_0x40be13[_0xade7('0x3e')]=qs[_0xade7('0x35')](_[_0xade7('0x3f')](_0x49cd4c[_0xade7('0x34')],_0x3385d1[_0xade7('0x35')]),_0x517bb0);if(_0x49cd4c[_0xade7('0x34')][_0xade7('0x40')]){_0x40be13[_0xade7('0x3e')]=_[_0xade7('0x41')](_0x40be13['where'],{'$or':_['map'](_0x517bb0,function(_0x5ddf2a){if(_0x5ddf2a[_0xade7('0x31')]!==_0xade7('0x42')){var _0x363a54={};_0x363a54[_0x5ddf2a[_0xade7('0x2c')]]={'$like':'%'+_0x49cd4c['query'][_0xade7('0x40')]+'%'};return _0x363a54;}})});}_0x40be13=_[_0xade7('0x41')]({},_0x40be13,_0x49cd4c[_0xade7('0x43')]);var _0x54be97={'where':_0x40be13[_0xade7('0x3e')]};return db[_0xade7('0x44')][_0xade7('0x20')](_0x54be97)[_0xade7('0x28')](function(_0x5c9ad5){_0x26fc41['count']=_0x5c9ad5;if(_0x49cd4c['query'][_0xade7('0x45')]){_0x40be13[_0xade7('0x46')]=[{'all':!![]}];}return db[_0xade7('0x44')][_0xade7('0x47')](_0x40be13);})[_0xade7('0x28')](function(_0x48fe52){_0x26fc41[_0xade7('0x48')]=_0x48fe52;return _0x26fc41;})['then'](respondWithFilteredResult(_0x55c050,_0x40be13))[_0xade7('0x49')](handleError(_0x55c050,null));};exports['show']=function(_0x1c0c28,_0x4d9607){var _0x587ca7={'raw':!![],'where':{'id':_0x1c0c28[_0xade7('0x4a')]['id']}},_0x7a9719={};_0x7a9719['model']=_[_0xade7('0x33')](db[_0xade7('0x44')]['rawAttributes']);_0x7a9719[_0xade7('0x34')]=_[_0xade7('0x33')](_0x1c0c28[_0xade7('0x34')]);_0x7a9719[_0xade7('0x35')]=_[_0xade7('0x36')](_0x7a9719['model'],_0x7a9719['query']);_0x587ca7[_0xade7('0x38')]=_[_0xade7('0x36')](_0x7a9719['model'],qs['fields'](_0x1c0c28[_0xade7('0x34')]['fields']));_0x587ca7[_0xade7('0x38')]=_0x587ca7[_0xade7('0x38')][_0xade7('0x3a')]?_0x587ca7[_0xade7('0x38')]:_0x7a9719[_0xade7('0x37')];if(_0x1c0c28[_0xade7('0x34')][_0xade7('0x45')]){_0x587ca7[_0xade7('0x46')]=[{'all':!![]}];}_0x587ca7=_[_0xade7('0x41')]({},_0x587ca7,_0x1c0c28[_0xade7('0x43')]);return db[_0xade7('0x44')][_0xade7('0x4b')](_0x587ca7)[_0xade7('0x28')](handleEntityNotFound(_0x4d9607,null))[_0xade7('0x28')](respondWithResult(_0x4d9607,null))[_0xade7('0x49')](handleError(_0x4d9607,null));};exports[_0xade7('0x4c')]=function(_0x529a58,_0x539129){return db[_0xade7('0x44')][_0xade7('0x4c')](_0x529a58['body'],{})[_0xade7('0x28')](respondWithResult(_0x539129,0xc9))[_0xade7('0x49')](handleError(_0x539129,null));};exports[_0xade7('0x27')]=function(_0x45f1c0,_0x58b102){if(_0x45f1c0['body']['id']){delete _0x45f1c0[_0xade7('0x4d')]['id'];}return db[_0xade7('0x44')][_0xade7('0x4b')]({'where':{'id':_0x45f1c0[_0xade7('0x4a')]['id']}})[_0xade7('0x28')](handleEntityNotFound(_0x58b102,null))[_0xade7('0x28')](saveUpdates(_0x45f1c0[_0xade7('0x4d')],null))[_0xade7('0x28')](respondWithResult(_0x58b102,null))[_0xade7('0x49')](handleError(_0x58b102,null));};exports[_0xade7('0x29')]=function(_0x1e5eb7,_0x279795){return db[_0xade7('0x44')][_0xade7('0x4b')]({'where':{'id':_0x1e5eb7['params']['id']}})[_0xade7('0x28')](handleEntityNotFound(_0x279795,null))[_0xade7('0x28')](removeEntity(_0x279795,null))[_0xade7('0x49')](handleError(_0x279795,null));};exports[_0xade7('0x4e')]=function(_0x6ce279,_0x2fe49b){return db[_0xade7('0x44')]['describe']()[_0xade7('0x28')](respondWithResult(_0x2fe49b,null))['catch'](handleError(_0x2fe49b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e46a523..81b8add 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 _0xd46d=['moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api'];(function(_0x10b898,_0x1c213c){var _0x58ee85=function(_0x1e86e8){while(--_0x1e86e8){_0x10b898['push'](_0x10b898['shift']());}};_0x58ee85(++_0x1c213c);}(_0xd46d,0x183));var _0xdd46=function(_0x4836b2,_0x368311){_0x4836b2=_0x4836b2-0x0;var _0xe877f3=_0xd46d[_0x4836b2];return _0xe877f3;};'use strict';var _=require(_0xdd46('0x0'));var util=require(_0xdd46('0x1'));var logger=require('../../config/logger')(_0xdd46('0x2'));var moment=require(_0xdd46('0x3'));var BPromise=require(_0xdd46('0x4'));var rp=require(_0xdd46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdd46('0x6'));var attributes=require(_0xdd46('0x7'));module[_0xdd46('0x8')]=function(_0x1d36fb,_0x4fa1f1){return _0x1d36fb[_0xdd46('0x9')](_0xdd46('0xa'),attributes,{'tableName':_0xdd46('0xb'),'paranoid':![],'indexes':[{'name':_0xdd46('0xc'),'fields':[_0xdd46('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x599a=['./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x110320,_0x9e327c){var _0x2762ff=function(_0x442c58){while(--_0x442c58){_0x110320['push'](_0x110320['shift']());}};_0x2762ff(++_0x9e327c);}(_0x599a,0x17f));var _0xa599=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x599a[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0xa599('0x0'));var util=require(_0xa599('0x1'));var logger=require(_0xa599('0x2'))(_0xa599('0x3'));var moment=require(_0xa599('0x4'));var BPromise=require('bluebird');var rp=require(_0xa599('0x5'));var fs=require('fs');var path=require(_0xa599('0x6'));var rimraf=require(_0xa599('0x7'));var config=require(_0xa599('0x8'));var attributes=require(_0xa599('0x9'));module['exports']=function(_0x2b4a8a,_0x3a7684){return _0x2b4a8a[_0xa599('0xa')](_0xa599('0xb'),attributes,{'tableName':_0xa599('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa599('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 1a62429..4343366 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 _0xcbf3=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xcbf3,0x18f));var _0x3cbf=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xcbf3[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x3cbf('0x0'));var util=require(_0x3cbf('0x1'));var moment=require('moment');var BPromise=require(_0x3cbf('0x2'));var rs=require(_0x3cbf('0x3'));var fs=require('fs');var Redis=require(_0x3cbf('0x4'));var db=require(_0x3cbf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3cbf('0x6'));var config=require(_0x3cbf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3cbf('0x8')][_0x3cbf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x257e16,_0x4180b6,_0x39db27){return new BPromise(function(_0x467f02,_0x207e41){return client[_0x3cbf('0xa')](_0x257e16,_0x39db27)['then'](function(_0x5acff7){logger[_0x3cbf('0xb')](_0x3cbf('0xc'),_0x4180b6,_0x3cbf('0xd'));logger[_0x3cbf('0xe')](_0x3cbf('0xf'),_0x4180b6,_0x3cbf('0xd'),JSON[_0x3cbf('0x10')](_0x5acff7));if(_0x5acff7['error']){if(_0x5acff7[_0x3cbf('0x11')][_0x3cbf('0x12')]===0x1f4){logger[_0x3cbf('0x11')](_0x3cbf('0xc'),_0x4180b6,_0x5acff7[_0x3cbf('0x11')][_0x3cbf('0x13')]);return _0x207e41(_0x5acff7[_0x3cbf('0x11')][_0x3cbf('0x13')]);}logger[_0x3cbf('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x4180b6,_0x5acff7[_0x3cbf('0x11')][_0x3cbf('0x13')]);return _0x467f02(_0x5acff7['error'][_0x3cbf('0x13')]);}else{logger[_0x3cbf('0xb')](_0x3cbf('0xc'),_0x4180b6,'request\x20sent');_0x467f02(_0x5acff7[_0x3cbf('0x14')][_0x3cbf('0x13')]);}})[_0x3cbf('0x15')](function(_0xb06c85){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x4180b6,_0xb06c85);_0x207e41(_0xb06c85);});});} \ No newline at end of file +var _0xa0b6=['lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0xa0b6,0x98));var _0x6a0b=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xa0b6[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x6a0b('0x0'));var util=require('util');var moment=require(_0x6a0b('0x1'));var BPromise=require(_0x6a0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a0b('0x3'))['db'];var utils=require(_0x6a0b('0x4'));var logger=require('../../config/logger')(_0x6a0b('0x5'));var config=require(_0x6a0b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6a0b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4250ec,_0x3ca449,_0x4aeacb){return new BPromise(function(_0xdfe835,_0x26360f){return client[_0x6a0b('0x8')](_0x4250ec,_0x4aeacb)[_0x6a0b('0x9')](function(_0x5e6c10){logger[_0x6a0b('0xa')](_0x6a0b('0xb'),_0x3ca449,_0x6a0b('0xc'));logger[_0x6a0b('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x3ca449,_0x6a0b('0xc'),JSON[_0x6a0b('0xe')](_0x5e6c10));if(_0x5e6c10[_0x6a0b('0xf')]){if(_0x5e6c10['error'][_0x6a0b('0x10')]===0x1f4){logger[_0x6a0b('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x3ca449,_0x5e6c10[_0x6a0b('0xf')]['message']);return _0x26360f(_0x5e6c10['error']['message']);}logger[_0x6a0b('0xf')](_0x6a0b('0xb'),_0x3ca449,_0x5e6c10[_0x6a0b('0xf')][_0x6a0b('0x11')]);return _0xdfe835(_0x5e6c10['error'][_0x6a0b('0x11')]);}else{logger[_0x6a0b('0xa')](_0x6a0b('0xb'),_0x3ca449,'request\x20sent');_0xdfe835(_0x5e6c10[_0x6a0b('0x12')][_0x6a0b('0x11')]);}})['catch'](function(_0x3af35d){logger[_0x6a0b('0xf')](_0x6a0b('0xb'),_0x3ca449,_0x3af35d);_0x26360f(_0x3af35d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 67afea6..f49755f 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 _0xe789=['create','put','delete','destroy','exports','express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xe789,0x104));var _0x9e78=function(_0x531734,_0x12501a){_0x531734=_0x531734-0x0;var _0x595157=_0xe789[_0x531734];return _0x595157;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9e78('0x0'));var router=express['Router']();var fs_extra=require(_0x9e78('0x1'));var auth=require(_0x9e78('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x9e78('0x3'));var controller=require(_0x9e78('0x4'));router['get']('/',auth[_0x9e78('0x5')](),controller[_0x9e78('0x6')]);router[_0x9e78('0x7')](_0x9e78('0x8'),auth[_0x9e78('0x5')](),controller[_0x9e78('0x9')]);router[_0x9e78('0x7')](_0x9e78('0xa'),auth[_0x9e78('0x5')](),controller[_0x9e78('0xb')]);router['post']('/',auth[_0x9e78('0x5')](),controller[_0x9e78('0xc')]);router[_0x9e78('0xd')](_0x9e78('0xa'),auth[_0x9e78('0x5')](),controller['update']);router[_0x9e78('0xe')](_0x9e78('0xa'),auth[_0x9e78('0x5')](),controller[_0x9e78('0xf')]);module[_0x9e78('0x10')]=router; \ No newline at end of file +var _0xd50d=['delete','exports','multer','util','path','Router','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd50d,0x122));var _0xdd50=function(_0x52a19b,_0x4d627e){_0x52a19b=_0x52a19b-0x0;var _0x579730=_0xd50d[_0x52a19b];return _0x579730;};'use strict';var multer=require(_0xdd50('0x0'));var util=require(_0xdd50('0x1'));var path=require(_0xdd50('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd50('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdd50('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd50('0x5'));router[_0xdd50('0x6')]('/',auth[_0xdd50('0x7')](),controller[_0xdd50('0x8')]);router[_0xdd50('0x6')](_0xdd50('0x9'),auth[_0xdd50('0x7')](),controller[_0xdd50('0xa')]);router['get'](_0xdd50('0xb'),auth['isAuthenticated'](),controller[_0xdd50('0xc')]);router[_0xdd50('0xd')]('/',auth[_0xdd50('0x7')](),controller['create']);router[_0xdd50('0xe')]('/:id',auth[_0xdd50('0x7')](),controller[_0xdd50('0xf')]);router[_0xdd50('0x10')]('/:id',auth[_0xdd50('0x7')](),controller['destroy']);module[_0xdd50('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 24e6f24..0ffb127 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 _0x5f11=['input','text','name','getDataValue','TEXT','Comments','Leave\x20your\x20comments','offlineForm','parse','setDataValue','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.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','STRING','address','email','#011F6A','INTEGER','ENUM','rounded','squared','Chat','Send','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify'];(function(_0x84a159,_0x1d2a62){var _0x596baa=function(_0x4676fd){while(--_0x4676fd){_0x84a159['push'](_0x84a159['shift']());}};_0x596baa(++_0x1d2a62);}(_0x5f11,0x131));var _0x15f1=function(_0x28a0a2,_0x1367db){_0x28a0a2=_0x28a0a2-0x0;var _0x1ceafb=_0x5f11[_0x28a0a2];return _0x1ceafb;};'use strict';var Sequelize=require(_0x15f1('0x0'));var rs=require(_0x15f1('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x15f1('0x2')],'allowNull':![],'unique':_0x15f1('0x3')},'description':{'type':Sequelize[_0x15f1('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x15f1('0x4')},'mapKeyOffline':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x4')},'key':{'type':Sequelize[_0x15f1('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x15f1('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x15f1('0x2')],'allowNull':![],'defaultValue':_0x15f1('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x15f1('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x15f1('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x15f1('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x15f1('0x7')](_0x15f1('0x8'),_0x15f1('0x9')),'defaultValue':_0x15f1('0x8')},'header_online':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x15f1('0xa')},'offline_chat_button':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x15f1('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x15f1('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x15f1('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x10')},'noteTitle':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x11')},'placeholderMessage':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x12')},'closingMessageButton':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0xb')},'skipMessageButton':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x13')},'conditionAgreement':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x14')},'ratingType':{'type':Sequelize['ENUM'](_0x15f1('0x15'),_0x15f1('0x16')),'defaultValue':_0x15f1('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x15f1('0x17')]({'items':[{'type':_0x15f1('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x15f1('0x19'),'required':!![]},'props':{'title':_0x15f1('0x1a'),'helpText':''}},{'type':_0x15f1('0x18'),'props':{'title':_0x15f1('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x15f1('0x4'),'type':_0x15f1('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this[_0x15f1('0x1b')]('onlineForm')):{};},'set':function(_0x528351){return this['setDataValue']('onlineForm',JSON[_0x15f1('0x17')](_0x528351));}},'offlineForm':{'type':Sequelize[_0x15f1('0x1c')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x15f1('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x15f1('0x4'),'type':_0x15f1('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x15f1('0x1d')},'props':{'title':_0x15f1('0x1d'),'helpText':_0x15f1('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x15f1('0x1b')](_0x15f1('0x1f'))?JSON[_0x15f1('0x20')](this[_0x15f1('0x1b')](_0x15f1('0x1f'))):{};},'set':function(_0x51bbc1){return this[_0x15f1('0x21')](_0x15f1('0x1f'),JSON[_0x15f1('0x17')](_0x51bbc1));}},'token':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x15f1('0x2')]},'forwardOffline':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x15f1('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x15f1('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x15f1('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x25')},'skipUnmanaged':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x15f1('0x1c')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x15f1('0x2')]},'notificationTemplate':{'type':Sequelize[_0x15f1('0x1c')],'defaultValue':function(){return _0x15f1('0x26');}},'notificationSound':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x15f1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x28')},'verticalAlignment':{'type':Sequelize[_0x15f1('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x15f1('0x2')]},'customerAvatar':{'type':Sequelize[_0x15f1('0x1c')]},'showCustomerAvatar':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x15f1('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x15f1('0x2')],'allowNull':![],'defaultValue':_0x15f1('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':_0x15f1('0x2a')},'systemAvatar':{'type':Sequelize[_0x15f1('0x1c')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x15f1('0x6')],'comment':_0x15f1('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![],'comment':_0x15f1('0x2c'),'set':function(_0x313c8d){if(!_0x313c8d)this[_0x15f1('0x21')]('mandatoryDispositionPauseId',null);this[_0x15f1('0x21')](_0x15f1('0x2d'),_0x313c8d);}},'vidaooEscalation':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x15f1('0x2')]},'vidaooTopic':{'type':Sequelize[_0x15f1('0x2')],'allowNull':![],'defaultValue':_0x15f1('0x2e')},'vidaooNote':{'type':Sequelize[_0x15f1('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x15f1('0x1c')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x15f1('0xc')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x15f1('0x1c')]}}; \ No newline at end of file +var _0x11e9=['star','thumb','stringify','name','input','getDataValue','parse','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback'];(function(_0xb9eb48,_0xff6ac6){var _0x2c78ad=function(_0x62c59b){while(--_0x62c59b){_0xb9eb48['push'](_0xb9eb48['shift']());}};_0x2c78ad(++_0xff6ac6);}(_0x11e9,0x168));var _0x911e=function(_0x2ed065,_0x197ca4){_0x2ed065=_0x2ed065-0x0;var _0x1c76c7=_0x11e9[_0x2ed065];return _0x1c76c7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x911e('0x0'));module[_0x911e('0x1')]={'name':{'type':Sequelize[_0x911e('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x911e('0x2')],'allowNull':![],'unique':_0x911e('0x3')},'description':{'type':Sequelize[_0x911e('0x2')]},'mapKey':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x911e('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x911e('0x5')},'customerAlias':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x911e('0x2')],'allowNull':![],'defaultValue':_0x911e('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x911e('0x2')],'allowNull':![],'defaultValue':_0x911e('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x911e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x911e('0x9')](_0x911e('0xa'),'squared'),'defaultValue':_0x911e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0xb')},'offline_chat_button':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0xc')},'download_transcript':{'type':Sequelize[_0x911e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x911e('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x911e('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x911e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x911e('0xf')]},'closingQuestion':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x12')},'noteTitle':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x13')},'placeholderMessage':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x14')},'closingMessage':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x15')},'closingMessageButton':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x16')},'skipMessageButton':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0x911e('0x18'),_0x911e('0x19')),'defaultValue':_0x911e('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x911e('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x911e('0xf')],'defaultValue':function(){return JSON[_0x911e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x911e('0x1b'),'helpText':''}},{'type':_0x911e('0x1c'),'props':{'title':_0x911e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x911e('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x911e('0x1d')]('onlineForm')?JSON[_0x911e('0x1e')](this[_0x911e('0x1d')]('onlineForm')):{};},'set':function(_0x486165){return this[_0x911e('0x1f')](_0x911e('0x20'),JSON['stringify'](_0x486165));}},'offlineForm':{'type':Sequelize[_0x911e('0xf')],'defaultValue':function(){return JSON[_0x911e('0x1a')]({'items':[{'type':_0x911e('0x1c'),'props':{'title':_0x911e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x911e('0x21'),'config':{'placeholder':_0x911e('0x22')},'props':{'title':_0x911e('0x22'),'helpText':_0x911e('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x911e('0x1d')](_0x911e('0x24'))?JSON[_0x911e('0x1e')](this['getDataValue'](_0x911e('0x24'))):{};},'set':function(_0x4a5bd4){return this[_0x911e('0x1f')](_0x911e('0x24'),JSON['stringify'](_0x4a5bd4));}},'token':{'type':Sequelize[_0x911e('0x2')],'defaultValue':function(){return rs[_0x911e('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x911e('0x2')]},'forwardOffline':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x911e('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x911e('0x26')},'waitingMessage':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x911e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x911e('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x911e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x911e('0xf')],'defaultValue':function(){return _0x911e('0x29');}},'notificationSound':{'type':Sequelize[_0x911e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x2a')},'verticalAlignment':{'type':Sequelize[_0x911e('0xd')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x911e('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x911e('0x2')]},'customerAvatar':{'type':Sequelize[_0x911e('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x911e('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x911e('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x911e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x911e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x911e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x911e('0x2')],'defaultValue':_0x911e('0x2b')},'systemAvatar':{'type':Sequelize[_0x911e('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x911e('0xd')],'comment':_0x911e('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x911e('0x2d'),'set':function(_0x11bef0){if(!_0x11bef0)this[_0x911e('0x1f')]('mandatoryDispositionPauseId',null);this[_0x911e('0x1f')](_0x911e('0x2e'),_0x11bef0);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x911e('0x2')]},'vidaooTopic':{'type':Sequelize[_0x911e('0x2')],'allowNull':![],'defaultValue':_0x911e('0x2f')},'vidaooNote':{'type':Sequelize[_0x911e('0x2')],'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[_0x911e('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 5ae37df..49c0647 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 _0x59db=['filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','custom','isNil','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','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','applications','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','unknown','format','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','*,*,*,*','AttachmentId','UserId','User','unshift','forcedOwnership','Start','startRouting','EventManager','offline','send','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','originalname','server','files','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','forwardOffline','forwardOfflineAddress','service','host','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','iftime\x20%s','interval','true','ONLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','readFileSync','server/files/chat/iframe.ejs','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','priority','getApplications','addProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','Pause','map','ChatWebsite','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','keys','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','addAvatar','agentAvatar','file'];(function(_0x41b663,_0x119258){var _0x4d7395=function(_0x3a4fe8){while(--_0x3a4fe8){_0x41b663['push'](_0x41b663['shift']());}};_0x4d7395(++_0x119258);}(_0x59db,0x1ec));var _0xb59d=function(_0xbb89d3,_0x47fd06){_0xbb89d3=_0xbb89d3-0x0;var _0x302ebf=_0x59db[_0xbb89d3];return _0x302ebf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb59d('0x0'));var jsonpatch=require(_0xb59d('0x1'));var rp=require(_0xb59d('0x2'));var moment=require(_0xb59d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb59d('0x4'));var util=require(_0xb59d('0x5'));var path=require('path');var sox=require(_0xb59d('0x6'));var csv=require('to-csv');var ejs=require(_0xb59d('0x7'));var fs=require('fs');var fs_extra=require(_0xb59d('0x8'));var _=require(_0xb59d('0x9'));var squel=require(_0xb59d('0xa'));var crypto=require('crypto');var jsforce=require(_0xb59d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb59d('0xc'));var Papa=require(_0xb59d('0xd'));var Redis=require(_0xb59d('0xe'));var authService=require(_0xb59d('0xf'));var qs=require(_0xb59d('0x10'));var as=require(_0xb59d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb59d('0x12'))(_0xb59d('0x13'));var utils=require('../../config/utils');var config=require(_0xb59d('0x14'));var licenseUtil=require(_0xb59d('0x15'));var db=require('../../mysqldb')['db'];config[_0xb59d('0x16')]=_[_0xb59d('0x17')](config[_0xb59d('0x16')],{'host':_0xb59d('0x18'),'port':0x18eb});var socket=require(_0xb59d('0x19'))(new Redis(config[_0xb59d('0x16')]));require(_0xb59d('0x1a'))['register'](socket);var jayson=require(_0xb59d('0x1b'));var client=jayson[_0xb59d('0x1c')][_0xb59d('0x1d')]({'port':0x232c});var client9002=jayson[_0xb59d('0x1c')][_0xb59d('0x1d')]({'port':0x232a});var client9003=jayson[_0xb59d('0x1c')][_0xb59d('0x1d')]({'port':0x232b});var client9001=jayson[_0xb59d('0x1c')][_0xb59d('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x28d350,_0x430c45,_0x322159,_0x440236){return new BPromise(function(_0x3d6c66,_0x1cb06e){var _0x39fc35=_0x440236||client;return _0x39fc35[_0xb59d('0x1e')](_0x28d350,_0x322159)[_0xb59d('0x1f')](function(_0x4cd914){logger[_0xb59d('0x20')](_0xb59d('0x21'),_0x430c45,_0xb59d('0x22'));logger[_0xb59d('0x23')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x430c45,'request\x20sent',JSON[_0xb59d('0x24')](_0x4cd914));if(_0x4cd914['error']){if(_0x4cd914['error'][_0xb59d('0x25')]===0x1f4){logger['error'](_0xb59d('0x21'),_0x430c45,_0x4cd914[_0xb59d('0x26')][_0xb59d('0x27')]);return _0x1cb06e(_0x4cd914[_0xb59d('0x26')][_0xb59d('0x27')]);}logger[_0xb59d('0x26')](_0xb59d('0x21'),_0x430c45,_0x4cd914['error'][_0xb59d('0x27')]);return _0x3d6c66(_0x4cd914[_0xb59d('0x26')][_0xb59d('0x27')]);}else{logger['info'](_0xb59d('0x21'),_0x430c45,_0xb59d('0x22'));_0x3d6c66(_0x4cd914[_0xb59d('0x28')][_0xb59d('0x27')]);}})[_0xb59d('0x29')](function(_0x51d3de){logger[_0xb59d('0x26')](_0xb59d('0x21'),_0x430c45,_0x51d3de);_0x1cb06e(_0x51d3de);});});}function respondWithStatusCode(_0x5217e7,_0xc57343){_0xc57343=_0xc57343||0xcc;return function(_0x1013f2){if(_0x1013f2){return _0x5217e7[_0xb59d('0x2a')](_0xc57343);}return _0x5217e7['status'](_0xc57343)[_0xb59d('0x2b')]();};}function respondWithResult(_0x116b6a,_0x2c8ba7){_0x2c8ba7=_0x2c8ba7||0xc8;return function(_0x3700b1){if(_0x3700b1){return _0x116b6a[_0xb59d('0x2c')](_0x2c8ba7)['json'](_0x3700b1);}};}function respondWithFilteredResult(_0x26d152,_0x1f5cc1){return function(_0x2d41c0){if(_0x2d41c0){var _0x43b4ac=typeof _0x1f5cc1[_0xb59d('0x2d')]==='undefined'&&typeof _0x1f5cc1['limit']===_0xb59d('0x2e');var _0x2afebd=_0x2d41c0[_0xb59d('0x2f')];var _0x2b3e84=_0x43b4ac?0x0:_0x1f5cc1[_0xb59d('0x2d')];var _0x57ad51=_0x43b4ac?_0x2d41c0[_0xb59d('0x2f')]:_0x1f5cc1['offset']+_0x1f5cc1[_0xb59d('0x30')];var _0x83636f;if(_0x57ad51>=_0x2afebd){_0x57ad51=_0x2afebd;_0x83636f=0xc8;}else{_0x83636f=0xce;}_0x26d152[_0xb59d('0x2c')](_0x83636f);return _0x26d152['set'](_0xb59d('0x31'),_0x2b3e84+'-'+_0x57ad51+'/'+_0x2afebd)[_0xb59d('0x32')](_0x2d41c0);}return null;};}function patchUpdates(_0x5a8731){return function(_0xcaf369){try{jsonpatch[_0xb59d('0x33')](_0xcaf369,_0x5a8731,!![]);}catch(_0x2e90b3){return BPromise[_0xb59d('0x34')](_0x2e90b3);}return _0xcaf369[_0xb59d('0x35')]();};}function saveUpdates(_0x391538,_0x342e1a){return function(_0x2a1a03){if(_0x2a1a03){return _0x2a1a03[_0xb59d('0x36')](_0x391538)['then'](function(_0x286b9b){return _0x286b9b;});}return null;};}function removeEntity(_0x867059,_0x592332){return function(_0x58a257){if(_0x58a257){return _0x58a257[_0xb59d('0x37')]()[_0xb59d('0x1f')](function(){var _0x51c788=_0x58a257[_0xb59d('0x38')]({'plain':!![]});var _0x2c2f4e=_0xb59d('0x39');return db[_0xb59d('0x3a')][_0xb59d('0x37')]({'where':{'type':_0x2c2f4e,'resourceId':_0x51c788['id']}})['then'](function(){return _0x58a257;});})['then'](function(){_0x867059[_0xb59d('0x2c')](0xcc)[_0xb59d('0x2b')]();});}};}function handleEntityNotFound(_0x3cba92,_0x86eebb){return function(_0x3b3ea){if(!_0x3b3ea){_0x3cba92['sendStatus'](0x194);}return _0x3b3ea;};}function handleError(_0x55e28d,_0xd38c0c){_0xd38c0c=_0xd38c0c||0x1f4;return function(_0x4b0acf){logger[_0xb59d('0x26')](_0x4b0acf[_0xb59d('0x3b')]);if(_0x4b0acf[_0xb59d('0x3c')]){delete _0x4b0acf[_0xb59d('0x3c')];}_0x55e28d[_0xb59d('0x2c')](_0xd38c0c)['send'](_0x4b0acf);};}exports['index']=function(_0x48a99b,_0x2d1773){var _0x755bea={'include':[{'model':db[_0xb59d('0x3d')],'as':'mandatoryDispositionPause'}]},_0x4474ad={},_0x26b7bb={'count':0x0,'rows':[]};var _0x32d795=_[_0xb59d('0x3e')](db[_0xb59d('0x3f')]['rawAttributes'],function(_0x50f1b9){return{'name':_0x50f1b9['fieldName'],'type':_0x50f1b9[_0xb59d('0x40')][_0xb59d('0x41')]};});_0x4474ad[_0xb59d('0x42')]=_[_0xb59d('0x3e')](_0x32d795,_0xb59d('0x3c'));_0x4474ad['query']=_['keys'](_0x48a99b[_0xb59d('0x43')]);_0x4474ad[_0xb59d('0x44')]=_[_0xb59d('0x45')](_0x4474ad['model'],_0x4474ad[_0xb59d('0x43')]);_0x755bea[_0xb59d('0x46')]=_['intersection'](_0x4474ad[_0xb59d('0x42')],qs[_0xb59d('0x47')](_0x48a99b[_0xb59d('0x43')][_0xb59d('0x47')]));_0x755bea[_0xb59d('0x46')]=_0x755bea[_0xb59d('0x46')][_0xb59d('0x48')]?_0x755bea[_0xb59d('0x46')]:_0x4474ad[_0xb59d('0x42')];if(!_0x48a99b[_0xb59d('0x43')][_0xb59d('0x49')](_0xb59d('0x4a'))){_0x755bea['limit']=qs['limit'](_0x48a99b[_0xb59d('0x43')][_0xb59d('0x30')]);_0x755bea[_0xb59d('0x2d')]=qs[_0xb59d('0x2d')](_0x48a99b[_0xb59d('0x43')][_0xb59d('0x2d')]);}_0x755bea['order']=qs[_0xb59d('0x4b')](_0x48a99b['query']['sort']);_0x755bea[_0xb59d('0x4c')]=qs[_0xb59d('0x44')](_[_0xb59d('0x4d')](_0x48a99b[_0xb59d('0x43')],_0x4474ad[_0xb59d('0x44')]),_0x32d795);if(_0x48a99b[_0xb59d('0x43')][_0xb59d('0x4e')]){_0x755bea[_0xb59d('0x4c')]=_[_0xb59d('0x4f')](_0x755bea[_0xb59d('0x4c')],{'$or':_[_0xb59d('0x3e')](_0x32d795,function(_0x4cdd9a){if(_0x4cdd9a[_0xb59d('0x40')]!==_0xb59d('0x50')){var _0x91f5a3={};_0x91f5a3[_0x4cdd9a[_0xb59d('0x3c')]]={'$like':'%'+_0x48a99b[_0xb59d('0x43')][_0xb59d('0x4e')]+'%'};return _0x91f5a3;}})});}_0x755bea=_[_0xb59d('0x4f')]({},_0x755bea,_0x48a99b['options']);var _0x2907ac={'where':_0x755bea[_0xb59d('0x4c')]};return db[_0xb59d('0x3f')]['count'](_0x2907ac)[_0xb59d('0x1f')](function(_0x1ba87){_0x26b7bb[_0xb59d('0x2f')]=_0x1ba87;if(_0x48a99b[_0xb59d('0x43')]['includeAll']){_0x755bea[_0xb59d('0x51')]=[{'all':!![]}];}return db['ChatWebsite'][_0xb59d('0x52')](_0x755bea);})[_0xb59d('0x1f')](function(_0x4791fa){_0x26b7bb[_0xb59d('0x53')]=_0x4791fa;return _0x26b7bb;})[_0xb59d('0x1f')](respondWithFilteredResult(_0x2d1773,_0x755bea))['catch'](handleError(_0x2d1773,null));};exports[_0xb59d('0x54')]=function(_0x5d73ab,_0x4801af){var _0x478726={'raw':![],'where':{'id':_0x5d73ab[_0xb59d('0x55')]['id']},'include':[{'model':db[_0xb59d('0x3d')],'as':_0xb59d('0x56')}]},_0x1d7a43={};_0x1d7a43[_0xb59d('0x42')]=_['keys'](db[_0xb59d('0x3f')][_0xb59d('0x57')]);_0x1d7a43[_0xb59d('0x43')]=_[_0xb59d('0x58')](_0x5d73ab[_0xb59d('0x43')]);_0x1d7a43[_0xb59d('0x44')]=_[_0xb59d('0x45')](_0x1d7a43[_0xb59d('0x42')],_0x1d7a43['query']);_0x478726[_0xb59d('0x46')]=_['intersection'](_0x1d7a43[_0xb59d('0x42')],qs['fields'](_0x5d73ab[_0xb59d('0x43')][_0xb59d('0x47')]));_0x478726['attributes']=_0x478726['attributes'][_0xb59d('0x48')]?_0x478726[_0xb59d('0x46')]:_0x1d7a43[_0xb59d('0x42')];if(_0x5d73ab[_0xb59d('0x43')][_0xb59d('0x59')]){_0x478726[_0xb59d('0x51')]=[{'all':!![]}];}_0x478726=_[_0xb59d('0x4f')]({},_0x478726,_0x5d73ab[_0xb59d('0x5a')]);return db['ChatWebsite'][_0xb59d('0x5b')](_0x478726)[_0xb59d('0x1f')](handleEntityNotFound(_0x4801af,null))[_0xb59d('0x1f')](respondWithResult(_0x4801af,null))[_0xb59d('0x29')](handleError(_0x4801af,null));};exports['create']=function(_0x4800f1,_0x5820e3){return db[_0xb59d('0x3f')]['create'](_0x4800f1[_0xb59d('0x5c')],{})['then'](function(_0x2ce742){var _0x139c7f=_0x4800f1[_0xb59d('0x5d')][_0xb59d('0x38')]({'plain':!![]});if(!_0x139c7f)throw new Error(_0xb59d('0x5e'));if(_0x139c7f['role']===_0xb59d('0x5d')){var _0x10281f=_0x2ce742[_0xb59d('0x38')]({'plain':!![]});var _0x407a44=_0xb59d('0x39');return db['UserProfileSection'][_0xb59d('0x5b')]({'where':{'name':_0x407a44,'userProfileId':_0x139c7f['userProfileId']},'raw':!![]})[_0xb59d('0x1f')](function(_0x4c1de0){if(_0x4c1de0&&_0x4c1de0['autoAssociation']===0x0){return db['UserProfileResource'][_0xb59d('0x5f')]({'name':_0x10281f['name'],'resourceId':_0x10281f['id'],'type':_0x4c1de0[_0xb59d('0x3c')],'sectionId':_0x4c1de0['id']},{})[_0xb59d('0x1f')](function(){return _0x2ce742;});}else{return _0x2ce742;}})[_0xb59d('0x29')](function(_0x103602){logger[_0xb59d('0x26')](_0xb59d('0x60'),_0x103602);throw _0x103602;});}return _0x2ce742;})[_0xb59d('0x1f')](respondWithResult(_0x5820e3,0xc9))[_0xb59d('0x29')](handleError(_0x5820e3,null));};exports[_0xb59d('0x36')]=function(_0x180d96,_0x22fc64){if(_0x180d96[_0xb59d('0x5c')]['id']){delete _0x180d96[_0xb59d('0x5c')]['id'];}return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x180d96['params']['id']},'include':[{'model':db[_0xb59d('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x22fc64,null))[_0xb59d('0x1f')](saveUpdates(_0x180d96[_0xb59d('0x5c')],null))[_0xb59d('0x1f')](respondWithResult(_0x22fc64,null))[_0xb59d('0x29')](handleError(_0x22fc64,null));};exports[_0xb59d('0x37')]=function(_0x21535d,_0x38b3a9){return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x21535d[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x38b3a9,null))[_0xb59d('0x1f')](removeEntity(_0x38b3a9,null))[_0xb59d('0x29')](handleError(_0x38b3a9,null));};exports[_0xb59d('0x61')]=function(_0xaf4a47,_0x4f0051){return db[_0xb59d('0x3f')]['describe']()[_0xb59d('0x1f')](respondWithResult(_0x4f0051,null))[_0xb59d('0x29')](handleError(_0x4f0051,null));};exports[_0xb59d('0x62')]=function(_0x578d7b,_0x485e88,_0x253f4e){if(_0x578d7b[_0xb59d('0x5c')]['id']){delete _0x578d7b[_0xb59d('0x5c')]['id'];}return db[_0xb59d('0x3f')]['find']({'where':{'id':_0x578d7b[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x485e88,null))[_0xb59d('0x1f')](function(_0x18ed9f){if(_0x18ed9f){_0x578d7b[_0xb59d('0x5c')][_0xb59d('0x63')]=_0x18ed9f['id'];return db[_0xb59d('0x64')]['create'](_0x578d7b['body']);}})[_0xb59d('0x1f')](respondWithResult(_0x485e88,null))['catch'](handleError(_0x485e88,null));};exports[_0xb59d('0x65')]=function(_0x244630,_0x1b3867,_0x56f7ec){var _0x3540a3={'raw':![],'where':{}};var _0x16e253={};var _0x5a0790={'count':0x0,'rows':[]};return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x244630['params']['id']}})['then'](handleEntityNotFound(_0x1b3867,null))['then'](function(_0x655595){if(_0x655595){_0x16e253['model']=_['keys'](db[_0xb59d('0x64')]['rawAttributes']);_0x16e253[_0xb59d('0x43')]=_['keys'](_0x244630[_0xb59d('0x43')]);_0x16e253[_0xb59d('0x44')]=_[_0xb59d('0x45')](_0x16e253[_0xb59d('0x42')],_0x16e253[_0xb59d('0x43')]);_0x3540a3[_0xb59d('0x46')]=_[_0xb59d('0x45')](_0x16e253[_0xb59d('0x42')],qs[_0xb59d('0x47')](_0x244630[_0xb59d('0x43')][_0xb59d('0x47')]));_0x3540a3['attributes']=_0x3540a3['attributes']['length']?_0x3540a3['attributes']:_0x16e253[_0xb59d('0x42')];if(!_0x244630['query'][_0xb59d('0x49')](_0xb59d('0x4a'))){_0x3540a3[_0xb59d('0x30')]=qs[_0xb59d('0x30')](_0x244630[_0xb59d('0x43')][_0xb59d('0x30')]);_0x3540a3['offset']=qs[_0xb59d('0x2d')](_0x244630['query'][_0xb59d('0x2d')]);}_0x3540a3[_0xb59d('0x67')]=qs[_0xb59d('0x4b')](_0x244630[_0xb59d('0x43')][_0xb59d('0x4b')]);_0x3540a3[_0xb59d('0x4c')]=qs[_0xb59d('0x44')](_[_0xb59d('0x4d')](_0x244630[_0xb59d('0x43')],_0x16e253[_0xb59d('0x44')]));_0x3540a3[_0xb59d('0x4c')]['ChatWebsiteId']=_0x655595['id'];if(_0x244630[_0xb59d('0x43')][_0xb59d('0x4e')]){_0x3540a3[_0xb59d('0x4c')]=_[_0xb59d('0x4f')](_0x3540a3[_0xb59d('0x4c')],{'$or':_[_0xb59d('0x3e')](_0x3540a3['attributes'],function(_0x47b3a1){var _0x356837={};_0x356837[_0x47b3a1]={'$like':'%'+_0x244630['query'][_0xb59d('0x4e')]+'%'};return _0x356837;})});}_0x3540a3=_[_0xb59d('0x4f')]({},_0x3540a3,_0x244630[_0xb59d('0x5a')]);return db['Disposition']['count']({'where':_0x3540a3[_0xb59d('0x4c')]})[_0xb59d('0x1f')](function(_0x15dc21){_0x5a0790[_0xb59d('0x2f')]=_0x15dc21;if(_0x244630[_0xb59d('0x43')]['includeAll']){_0x3540a3[_0xb59d('0x51')]=[{'all':!![]}];}return db[_0xb59d('0x64')][_0xb59d('0x52')](_0x3540a3);})[_0xb59d('0x1f')](function(_0x404bed){_0x5a0790[_0xb59d('0x53')]=_0x404bed;return _0x5a0790;});}})['then'](respondWithFilteredResult(_0x1b3867,_0x3540a3))[_0xb59d('0x29')](handleError(_0x1b3867,null));};exports[_0xb59d('0x68')]=function(_0x4f3940,_0x25d0bd,_0x4435a2){return db[_0xb59d('0x3f')]['find']({'where':{'id':_0x4f3940[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x25d0bd,null))[_0xb59d('0x1f')](function(_0x5c654d){if(_0x5c654d){return _0x5c654d[_0xb59d('0x68')](_0x4f3940[_0xb59d('0x43')][_0xb59d('0x69')]);}})['then'](respondWithStatusCode(_0x25d0bd,null))[_0xb59d('0x29')](handleError(_0x25d0bd,null));};exports[_0xb59d('0x6a')]=function(_0x3cd595,_0x5c619b,_0x130ad9){if(_0x3cd595['body']['id']){delete _0x3cd595[_0xb59d('0x5c')]['id'];}return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x3cd595[_0xb59d('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c619b,null))[_0xb59d('0x1f')](function(_0x17f2a4){if(_0x17f2a4){_0x3cd595[_0xb59d('0x5c')][_0xb59d('0x63')]=_0x17f2a4['id'];return db[_0xb59d('0x6b')]['create'](_0x3cd595[_0xb59d('0x5c')]);}})[_0xb59d('0x1f')](respondWithResult(_0x5c619b,null))[_0xb59d('0x29')](handleError(_0x5c619b,null));};exports[_0xb59d('0x6c')]=function(_0x18e3ae,_0x36dc8f,_0x50b48d){var _0xf41de={'raw':![],'where':{}};var _0x5732a0={};var _0x55b7b0={'count':0x0,'rows':[]};return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x18e3ae[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x36dc8f,null))[_0xb59d('0x1f')](function(_0x37f323){if(_0x37f323){_0x5732a0[_0xb59d('0x42')]=_[_0xb59d('0x58')](db['CannedAnswer']['rawAttributes']);_0x5732a0[_0xb59d('0x43')]=_['keys'](_0x18e3ae[_0xb59d('0x43')]);_0x5732a0['filters']=_['intersection'](_0x5732a0[_0xb59d('0x42')],_0x5732a0['query']);_0xf41de[_0xb59d('0x46')]=_['intersection'](_0x5732a0[_0xb59d('0x42')],qs[_0xb59d('0x47')](_0x18e3ae[_0xb59d('0x43')][_0xb59d('0x47')]));_0xf41de[_0xb59d('0x46')]=_0xf41de['attributes'][_0xb59d('0x48')]?_0xf41de[_0xb59d('0x46')]:_0x5732a0[_0xb59d('0x42')];if(!_0x18e3ae[_0xb59d('0x43')][_0xb59d('0x49')](_0xb59d('0x4a'))){_0xf41de[_0xb59d('0x30')]=qs['limit'](_0x18e3ae[_0xb59d('0x43')]['limit']);_0xf41de[_0xb59d('0x2d')]=qs[_0xb59d('0x2d')](_0x18e3ae[_0xb59d('0x43')][_0xb59d('0x2d')]);}_0xf41de[_0xb59d('0x67')]=qs[_0xb59d('0x4b')](_0x18e3ae[_0xb59d('0x43')]['sort']);_0xf41de['where']=qs[_0xb59d('0x44')](_[_0xb59d('0x4d')](_0x18e3ae[_0xb59d('0x43')],_0x5732a0[_0xb59d('0x44')]));_0xf41de[_0xb59d('0x4c')][_0xb59d('0x63')]=_0x37f323['id'];if(_0x18e3ae[_0xb59d('0x43')][_0xb59d('0x4e')]){_0xf41de[_0xb59d('0x4c')]=_['merge'](_0xf41de[_0xb59d('0x4c')],{'$or':_[_0xb59d('0x3e')](_0xf41de[_0xb59d('0x46')],function(_0x204eec){var _0x1874a8={};_0x1874a8[_0x204eec]={'$like':'%'+_0x18e3ae[_0xb59d('0x43')][_0xb59d('0x4e')]+'%'};return _0x1874a8;})});}_0xf41de=_[_0xb59d('0x4f')]({},_0xf41de,_0x18e3ae['options']);return db['CannedAnswer'][_0xb59d('0x2f')]({'where':_0xf41de[_0xb59d('0x4c')]})[_0xb59d('0x1f')](function(_0x3ece21){_0x55b7b0[_0xb59d('0x2f')]=_0x3ece21;if(_0x18e3ae[_0xb59d('0x43')][_0xb59d('0x59')]){_0xf41de[_0xb59d('0x51')]=[{'all':!![]}];}return db[_0xb59d('0x6b')][_0xb59d('0x52')](_0xf41de);})[_0xb59d('0x1f')](function(_0x142861){_0x55b7b0[_0xb59d('0x53')]=_0x142861;return _0x55b7b0;});}})[_0xb59d('0x1f')](respondWithFilteredResult(_0x36dc8f,_0xf41de))[_0xb59d('0x29')](handleError(_0x36dc8f,null));};exports[_0xb59d('0x6d')]=function(_0x53ea35,_0x3949a6,_0x1c82e3){return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x53ea35[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x3949a6,null))['then'](function(_0xcfdf75){if(_0xcfdf75){return _0xcfdf75['removeAnswers'](_0x53ea35[_0xb59d('0x43')][_0xb59d('0x69')]);}})[_0xb59d('0x1f')](respondWithStatusCode(_0x3949a6,null))[_0xb59d('0x29')](handleError(_0x3949a6,null));};exports[_0xb59d('0x6e')]=function(_0x54864b,_0x3af0f6,_0x348c28){_0x54864b[_0xb59d('0x5c')]['sitepic']=_0x54864b['file']['filename'];return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x54864b[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x3af0f6,null))[_0xb59d('0x1f')](saveUpdates(_0x54864b[_0xb59d('0x5c')],null))['then'](respondWithResult(_0x3af0f6,null))[_0xb59d('0x29')](handleError(_0x3af0f6,null));};exports[_0xb59d('0x6f')]=function(_0x5a8eaa,_0x517e1e,_0x2ae4f8){_0x5a8eaa['body'][_0xb59d('0x70')]=_0x5a8eaa[_0xb59d('0x71')][_0xb59d('0x72')];return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x5a8eaa['params']['id']}})['then'](handleEntityNotFound(_0x517e1e,null))[_0xb59d('0x1f')](saveUpdates(_0x5a8eaa[_0xb59d('0x5c')],null))[_0xb59d('0x1f')](respondWithResult(_0x517e1e,null))[_0xb59d('0x29')](handleError(_0x517e1e,null));};exports[_0xb59d('0x73')]=function(_0x8d8961,_0x22843b,_0x1260f8){_0x8d8961[_0xb59d('0x5c')][_0xb59d('0x74')]=_0x8d8961[_0xb59d('0x71')]['filename'];return db['ChatWebsite'][_0xb59d('0x5b')]({'where':{'id':_0x8d8961['params']['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x22843b,null))[_0xb59d('0x1f')](saveUpdates(_0x8d8961['body'],null))[_0xb59d('0x1f')](respondWithResult(_0x22843b,null))[_0xb59d('0x29')](handleError(_0x22843b,null));};exports[_0xb59d('0x75')]=function(_0x4390ea,_0x583e99,_0x1336a3){_0x4390ea[_0xb59d('0x5c')][_0xb59d('0x76')]=_0x4390ea['file'][_0xb59d('0x72')];return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x4390ea[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x583e99,null))['then'](saveUpdates(_0x4390ea[_0xb59d('0x5c')],null))[_0xb59d('0x1f')](respondWithResult(_0x583e99,null))[_0xb59d('0x29')](handleError(_0x583e99,null));};exports[_0xb59d('0x77')]=function(_0x1f569e,_0x214a8c,_0x501bdb){var _0x2f46cd=path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0x7a'));var _0x34007b={'where':{'id':_0x1f569e[_0xb59d('0x55')]['id']},'attributes':['id',_0xb59d('0x7b')],'raw':!![]};var _0x392c7c=![];return require('../../config/license/util')['getLicense']()['then'](function(_0x543ee9){if(_0x543ee9){_0x392c7c=_0x543ee9[_0xb59d('0x7c')];}})[_0xb59d('0x1f')](function(){return db[_0xb59d('0x3f')][_0xb59d('0x5b')](_0x34007b);})[_0xb59d('0x1f')](handleEntityNotFound(_0x214a8c,null))[_0xb59d('0x1f')](function(_0x5e4d9d){if(_0x5e4d9d){if(!_[_0xb59d('0x7d')](_0x5e4d9d[_0xb59d('0x7b')])){if(fs['existsSync'](path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0x7e'),_0x5e4d9d[_0xb59d('0x7b')]))&&_0x392c7c){_0x2f46cd=path['join'](config[_0xb59d('0x79')],_0xb59d('0x7e'),_0x5e4d9d[_0xb59d('0x7b')]);}}return _0x214a8c[_0xb59d('0x7f')](_0x2f46cd);}})[_0xb59d('0x29')](handleError(_0x214a8c,null));};exports[_0xb59d('0x80')]=function(_0x12e071,_0x235b3a,_0xb1e32){var _0x5f16f5=path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0x81'));var _0x531bf2={'where':{'id':_0x12e071[_0xb59d('0x55')]['id']},'attributes':['id',_0xb59d('0x70')],'raw':!![]};return db[_0xb59d('0x3f')][_0xb59d('0x5b')](_0x531bf2)[_0xb59d('0x1f')](handleEntityNotFound(_0x235b3a,null))[_0xb59d('0x1f')](function(_0x4d7ea7){if(_0x4d7ea7){if(!_[_0xb59d('0x7d')](_0x4d7ea7[_0xb59d('0x70')])){if(fs[_0xb59d('0x82')](path[_0xb59d('0x78')](config[_0xb59d('0x79')],'server/files/images/avatars/',_0x4d7ea7[_0xb59d('0x70')]))){_0x5f16f5=path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0x83'),_0x4d7ea7[_0xb59d('0x70')]);}}return _0x235b3a[_0xb59d('0x7f')](_0x5f16f5);}})[_0xb59d('0x29')](handleError(_0x235b3a,null));};exports[_0xb59d('0x84')]=function(_0x1e26e6,_0x305a15,_0x40cdcd){var _0x13480d=path[_0xb59d('0x78')](config['root'],_0xb59d('0x85'));var _0x4a7bb3={'where':{'id':_0x1e26e6['params']['id']},'attributes':['id',_0xb59d('0x74'),_0xb59d('0x86')],'raw':!![]};return db['ChatWebsite'][_0xb59d('0x5b')](_0x4a7bb3)['then'](handleEntityNotFound(_0x305a15,null))[_0xb59d('0x1f')](function(_0x116bf0){if(_0x116bf0){if(!_[_0xb59d('0x7d')](_0x116bf0[_0xb59d('0x74')])){if(fs[_0xb59d('0x82')](path[_0xb59d('0x78')](config['root'],'server/files/images/avatars/',_0x116bf0[_0xb59d('0x74')]))&&_0x116bf0['showCustomerAvatar']){_0x13480d=path[_0xb59d('0x78')](config[_0xb59d('0x79')],'server/files/images/avatars/',_0x116bf0[_0xb59d('0x74')]);}}return _0x305a15[_0xb59d('0x7f')](_0x13480d);}})[_0xb59d('0x29')](handleError(_0x305a15,null));};exports['getSystemAvatar']=function(_0xb61c30,_0x54d5a2,_0x5e585f){var _0x41a9dd=path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0x87'));var _0x3774d3={'where':{'id':_0xb61c30['params']['id']},'attributes':['id',_0xb59d('0x76')],'raw':!![]};return db[_0xb59d('0x3f')][_0xb59d('0x5b')](_0x3774d3)['then'](handleEntityNotFound(_0x54d5a2,null))['then'](function(_0x371bba){if(_0x371bba){if(!_[_0xb59d('0x7d')](_0x371bba['systemAvatar'])){if(fs[_0xb59d('0x82')](path[_0xb59d('0x78')](config[_0xb59d('0x79')],'server/files/images/avatars/',_0x371bba[_0xb59d('0x76')]))){_0x41a9dd=path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0x83'),_0x371bba[_0xb59d('0x76')]);}}return _0x54d5a2['download'](_0x41a9dd);}})[_0xb59d('0x29')](handleError(_0x54d5a2,null));};exports[_0xb59d('0x88')]=function(_0x55cf8d,_0x56450f,_0x4f4420){var _0x2c9637=require(_0xb59d('0x89'));var _0x40b0bd=new _0x2c9637();var _0x207137=_0x40b0bd[_0xb59d('0x8a')](_0x55cf8d['headers'][_0xb59d('0x8b')])[_0xb59d('0x8c')]();var _0x37bb3e={'body':_0x55cf8d[_0xb59d('0x5c')],'channel':_0xb59d('0x8d')};var _0xcd345a=[];var _0x5c856b=[];var _0x9f5c7c={};var _0x2fd9fb=![];return db[_0xb59d('0x8e')][_0xb59d('0x61')]()[_0xb59d('0x1f')](function(_0x58fd7b){if(!_0x58fd7b){throw new db[(_0xb59d('0x8f'))]['ValidationError'](_0xb59d('0x90'));}_0xcd345a=_[_0xb59d('0x91')](_[_0xb59d('0x58')](_0x58fd7b),[_0xb59d('0x92'),_0xb59d('0x93')]);_0x5c856b=_[_0xb59d('0x91')](_[_0xb59d('0x58')](_0x58fd7b),[_0xb59d('0x92'),_0xb59d('0x93'),_0xb59d('0x94'),'ListId']);if(_0x55cf8d['body']['id']){delete _0x55cf8d['body']['id'];}if(_[_0xb59d('0x7d')](_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0x95')])){throw new db['Sequelize'][(_0xb59d('0x96'))](_0xb59d('0x97'));}if(_[_0xb59d('0x7d')](_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0x5c')])||_0x55cf8d['body'][_0xb59d('0x5c')]===''){throw new db['Sequelize'][(_0xb59d('0x96'))](_0xb59d('0x98'));}if(_[_0xb59d('0x7d')](_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0x99')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c856b);}if(!_[_0xb59d('0x9a')](_0x5c856b,_0x55cf8d['body'][_0xb59d('0x99')])){throw new db[(_0xb59d('0x8f'))]['ValidationError'](_0xb59d('0x9b')+_0x5c856b);}_0x9f5c7c[_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0x99')]]=_0x55cf8d[_0xb59d('0x5c')]['from'];})[_0xb59d('0x1f')](function(){return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x55cf8d[_0xb59d('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xb59d('0x9c'),'include':[{'model':db[_0xb59d('0x8e')],'as':_0xb59d('0x9d'),'where':_0x9f5c7c,'limit':0x1,'order':[[_0xb59d('0x93'),_0xb59d('0x9e')]]}]},{'model':db[_0xb59d('0x9f')],'as':_0xb59d('0xa0')}]});})[_0xb59d('0x1f')](handleEntityNotFound(_0x56450f,null))[_0xb59d('0x1f')](function(_0x16757c){if(_0x16757c&&_0x16757c[_0xb59d('0x9c')]){_0x37bb3e[_0xb59d('0xa1')]=_0x16757c;_0x37bb3e[_0xb59d('0xa2')]=_0x16757c[_0xb59d('0xa0')];_0x37bb3e['list']=_0x16757c[_0xb59d('0x9c')];_0x37bb3e[_0xb59d('0xa2')]=_['orderBy'](_0x37bb3e[_0xb59d('0xa2')],['priority'],['asc']);if(_0x37bb3e['account'][_0xb59d('0xa0')]){delete _0x37bb3e['account'][_0xb59d('0xa0')];}if(_0x37bb3e[_0xb59d('0xa1')][_0xb59d('0x9c')]&&_0x37bb3e['account'][_0xb59d('0x9c')]['Contacts']['length']){return _0x37bb3e['account'][_0xb59d('0x9c')]['Contacts'][0x0];}var _0x557123=_[_0xb59d('0x17')](_0x55cf8d[_0xb59d('0x5c')],{'firstName':_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0x95')],'ListId':_0x16757c[_0xb59d('0xa3')]});_0x557123[_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0x99')]]=_0x55cf8d[_0xb59d('0x5c')]['from'];return db[_0xb59d('0x8e')][_0xb59d('0x5f')](_0x557123,{'fields':_0xcd345a,'raw':!![]});}})[_0xb59d('0x1f')](handleEntityNotFound(_0x56450f,null))[_0xb59d('0x1f')](function(_0x5e0bc6){_0x37bb3e[_0xb59d('0xa4')]=_0x5e0bc6;var _0x35f707=_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xa5')];if(_0x55cf8d[_0xb59d('0xa6')][_0xb59d('0xa7')]){_0x35f707=_0x55cf8d[_0xb59d('0xa6')][_0xb59d('0xa7')];}else if(_0x55cf8d[_0xb59d('0xa6')][_0xb59d('0xa8')]){_0x35f707=_[_0xb59d('0xa9')](_0x55cf8d[_0xb59d('0xa6')]['x-forwarded-for']['split'](','));}if(_0x5e0bc6){var _0x19f7b4={'ContactId':_0x5e0bc6['id'],'ChatWebsiteId':_0x55cf8d[_0xb59d('0x55')]['id'],'from':(_0x5e0bc6[_0xb59d('0xaa')]||'')+'\x20'+(_0x5e0bc6[_0xb59d('0xab')]||''),'customerIp':_0x35f707,'customerPort':_0x55cf8d['headers'][_0xb59d('0xac')]?_0x55cf8d[_0xb59d('0xa6')]['x-real-port']:null,'referer':_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xad')],'browserName':_0x207137[_0xb59d('0xae')][_0xb59d('0x3c')]&&_0x207137[_0xb59d('0xae')][_0xb59d('0xaf')]?util['format']('%s\x20%s',_0x207137[_0xb59d('0xae')]['name'],_0x207137['browser']['version']):_0xb59d('0xb0'),'browserVersion':_0x207137['browser']['version']||_0xb59d('0xb0'),'osName':util[_0xb59d('0xb1')](_0xb59d('0xb2'),_0x207137['os']['name'],_0x207137['os'][_0xb59d('0xaf')]),'osVersion':_0x207137['os'][_0xb59d('0xaf')],'deviceModel':_0x207137[_0xb59d('0xb3')][_0xb59d('0x42')]&&_0x207137[_0xb59d('0xb3')]['vendor']?util[_0xb59d('0xb1')](_0xb59d('0xb4'),_0x207137[_0xb59d('0xb3')][_0xb59d('0x42')],_0x207137[_0xb59d('0xb3')][_0xb59d('0xb5')],_0x207137[_0xb59d('0xb3')][_0xb59d('0x40')]):null,'deviceVendor':_0x207137[_0xb59d('0xb3')][_0xb59d('0xb5')],'deviceType':_0x207137[_0xb59d('0xb3')][_0xb59d('0x40')],'formData':JSON[_0xb59d('0x24')](_0x55cf8d[_0xb59d('0x5c')])};var _0x41f25e={'ChatWebsiteId':_0x55cf8d[_0xb59d('0x55')]['id'],'closed':![]};if(_0x55cf8d['body'][_0xb59d('0xb6')]){_0x41f25e['threadId']=_0x55cf8d[_0xb59d('0x5c')]['threadId'];return db[_0xb59d('0xb7')][_0xb59d('0x5b')]({'where':_0x41f25e})[_0xb59d('0x1f')](function(_0x381560){if(_0x381560){return[_0x381560,![]];}_0x19f7b4['threadId']=_0x55cf8d[_0xb59d('0x5c')]['threadId'];_0x19f7b4[_0xb59d('0xb8')]=_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xb8')];return db[_0xb59d('0xb7')][_0xb59d('0x5f')](_0x19f7b4)['then'](function(_0x10f4ce){return[_0x10f4ce,!![]];});});}_0x41f25e[_0xb59d('0xb9')]=_0x5e0bc6['id'];if(_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xba')]&&_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xba')]['id']){_0x41f25e['id']=_0x55cf8d[_0xb59d('0x5c')]['interaction']['id'];return db['ChatInteraction'][_0xb59d('0x5b')]({'where':_0x41f25e})[_0xb59d('0x1f')](function(_0x1ae654){if(_0x1ae654){return[_0x1ae654,![]];}return db['ChatInteraction'][_0xb59d('0x5f')](_0x19f7b4)['then'](function(_0x376cab){return[_0x376cab,!![]];});});}return db[_0xb59d('0xb7')][_0xb59d('0x5f')](_0x19f7b4)[_0xb59d('0x1f')](function(_0x11b961){return[_0x11b961,!![]];});}})[_0xb59d('0xbb')](function(_0x52541a,_0x5eac01){if(_0x52541a){_0x2fd9fb=_0x5eac01;if(!_0x5eac01){var _0x2a82de={'from':(_0x37bb3e['contact'][_0xb59d('0xaa')]||'')+'\x20'+(_0x37bb3e['contact'][_0xb59d('0xab')]||'')};if(_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xb6')]&&_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xbc')]&&_0x55cf8d[_0xb59d('0x5c')]['threadId']!=_0x55cf8d[_0xb59d('0x5c')]['messageId']){_0x2a82de[_0xb59d('0xb6')]=_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xbc')];}return _0x52541a[_0xb59d('0x36')](_0x2a82de);}else{return _0x52541a;}}})[_0xb59d('0x1f')](function(_0x131d4c){_0x37bb3e[_0xb59d('0xba')]=_0x131d4c[_0xb59d('0x38')]({'plain':!![]});_0x37bb3e[_0xb59d('0xba')][_0xb59d('0xbd')]=_0x2fd9fb;if(_0x37bb3e[_0xb59d('0xba')][_0xb59d('0xbd')]){if(_0x37bb3e['account'][_0xb59d('0xbe')]){_0x37bb3e[_0xb59d('0xa2')][_0xb59d('0xbf')]({'id':0x0,'priority':_0x37bb3e['applications'][_0xb59d('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xb59d('0xc0')});}}return db['ChatMessage']['create']({'body':_0x55cf8d[_0xb59d('0x5c')]['body'],'ChatWebsiteId':_0x55cf8d[_0xb59d('0x55')]['id'],'ChatInteractionId':_0x131d4c['id'],'direction':'in','ContactId':_0x37bb3e[_0xb59d('0xa4')]['id'],'AttachmentId':_0x55cf8d[_0xb59d('0x5c')][_0xb59d('0xc1')]});})[_0xb59d('0x1f')](function(_0x1bf0b4){_0x37bb3e[_0xb59d('0x27')]=_0x1bf0b4;if(_0x37bb3e[_0xb59d('0xba')][_0xb59d('0xc2')]){return db[_0xb59d('0xc3')]['find']({'attributes':['id',_0xb59d('0x3c')],'where':{'id':_0x37bb3e[_0xb59d('0xba')][_0xb59d('0xc2')]}})[_0xb59d('0x1f')](function(_0x449258){if(_0x449258){_0x37bb3e[_0xb59d('0xa2')][_0xb59d('0xc4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x449258[_0xb59d('0x3c')]+','+(_0x37bb3e[_0xb59d('0xa1')]['waitForTheAssignedAgent']||0xa),'interval':_0xb59d('0xc0')});_0x37bb3e[_0xb59d('0xc5')]=!![];}return respondWithRpcPromise(_0xb59d('0xc6'),_0xb59d('0xc7'),_0x37bb3e);});}return respondWithRpcPromise('Start',_0xb59d('0xc7'),_0x37bb3e);})['then'](function(_0x11b88c){respondWithRpcPromise('EventManager',_0xb59d('0xc8'),{'event':_0xb59d('0x88'),'message':_0x11b88c},client9002);return _0x11b88c;})[_0xb59d('0x1f')](respondWithResult(_0x56450f,null))[_0xb59d('0x29')](handleError(_0x56450f,null));};exports[_0xb59d('0xc9')]=function(_0x140836,_0x1331f5,_0xff1274){var _0x3f84cd,_0x2394e8,_0x571051;var _0xcae49=[];var _0x29712f=[];var _0x114897={};var _0x2f7ddc=_0x140836['files']||[];var _0x57b2ee=[];var _0xba600;return db[_0xb59d('0x8e')][_0xb59d('0x61')]()[_0xb59d('0x1f')](function(_0xe15862){if(!_0xe15862){throw new db[(_0xb59d('0x8f'))][(_0xb59d('0x96'))](_0xb59d('0x90'));}_0x29712f=_[_0xb59d('0x91')](_[_0xb59d('0x58')](_0xe15862),[_0xb59d('0x92'),_0xb59d('0x93')]);_0xcae49=_['difference'](_['keys'](_0xe15862),[_0xb59d('0x92'),_0xb59d('0x93'),_0xb59d('0x94'),_0xb59d('0xa3')]);if(_0x140836['body']['id']){delete _0x140836[_0xb59d('0x5c')]['id'];}if(_['isNil'](_0x140836[_0xb59d('0x5c')][_0xb59d('0x95')])){throw _0x1331f5[_0xb59d('0x2c')](0x1f4)['send'](new db[(_0xb59d('0x8f'))][(_0xb59d('0x96'))](_0xb59d('0x97')));}if(_[_0xb59d('0x7d')](_0x140836[_0xb59d('0x5c')][_0xb59d('0x5c')])||_0x140836[_0xb59d('0x5c')][_0xb59d('0x5c')]===''){throw _0x1331f5[_0xb59d('0x2c')](0x1f4)[_0xb59d('0xca')](new db[(_0xb59d('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x140836[_0xb59d('0x5c')][_0xb59d('0xcb')])){throw _0x1331f5[_0xb59d('0x2c')](0x1f4)[_0xb59d('0xca')](new db[(_0xb59d('0x8f'))][(_0xb59d('0x96'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xcae49));}if(!_['includes'](_0xcae49,_0x140836['body'][_0xb59d('0xcb')])){throw _0x1331f5[_0xb59d('0x2c')](0x1f4)[_0xb59d('0xca')](new db[(_0xb59d('0x8f'))][(_0xb59d('0x96'))](_0xb59d('0xcc')+_0xcae49));}_0x114897[_0x140836[_0xb59d('0x5c')][_0xb59d('0xcb')]]=_0x140836['body'][_0xb59d('0x95')];})['then'](function(){return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x140836[_0xb59d('0x55')]['id']},'include':[{'model':db[_0xb59d('0xcd')],'as':_0xb59d('0x9c')},{'model':db[_0xb59d('0xce')],'as':_0xb59d('0xce')}]});})[_0xb59d('0x1f')](handleEntityNotFound(_0x1331f5,null))[_0xb59d('0x1f')](function(_0x5bb12e){if(_0x5bb12e&&_0x5bb12e[_0xb59d('0x9c')]){_0x2394e8=_0x5bb12e;var _0x280a4e=_[_0xb59d('0x17')](_0x140836[_0xb59d('0x5c')],{'firstName':_0x140836[_0xb59d('0x5c')][_0xb59d('0x95')],'phone':_0x140836['body'][_0xb59d('0x95')],'ListId':_0x5bb12e[_0xb59d('0xa3')]});_0x280a4e[_0x140836[_0xb59d('0x5c')][_0xb59d('0xcb')]]=_0x140836[_0xb59d('0x5c')][_0xb59d('0x95')];return db[_0xb59d('0x8e')]['findOrCreate']({'where':_0x114897,'defaults':_0x280a4e});}})[_0xb59d('0xbb')](function(_0x80b1de){if(_0x80b1de){_0x571051=_0x80b1de;var _0x2d910d=fs['readFileSync'](path['join'](config['root'],_0xb59d('0xcf')),_0xb59d('0xd0'));var _0x453570=ejs[_0xb59d('0xd1')](_0x2d910d,{'body':_[_0xb59d('0xd2')](_0x140836[_0xb59d('0x5c')][_0xb59d('0x5c')]),'bodyTitle':_0x2394e8[_0xb59d('0xd3')]});return db['ChatOfflineMessage'][_0xb59d('0x5f')]({'body':_0x453570,'ContactId':_0x80b1de['id'],'ChatWebsiteId':_0x2394e8['id']});}})[_0xb59d('0x1f')](function(_0x9d96ce){_0xba600=_0x9d96ce;if(_0x2f7ddc[_0xb59d('0x48')]){var _0x1d7fa8=_0x2f7ddc['map'](function(_0x4613b6){return{'name':_0x4613b6[_0xb59d('0xd4')],'basename':_0x4613b6[_0xb59d('0x72')],'type':_0x4613b6['mimetype'],'ChatOfflineMessageId':_0x9d96ce['id']};});_0x57b2ee=_0x1d7fa8[_0xb59d('0x3e')](_0x4022bb=>{var _0x3950f3={'filename':_0x4022bb[_0xb59d('0x3c')],'path':path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0xd5'),_0xb59d('0xd6'),_0xb59d('0xd7'),'offline-chat',_0x4022bb[_0xb59d('0xd8')])};return _0x3950f3;});if(!_0x2394e8[_0xb59d('0xd9')]){return db[_0xb59d('0xda')][_0xb59d('0xdb')](function(_0x19ce6d){return db[_0xb59d('0xdc')][_0xb59d('0xdd')](_0x1d7fa8,{'transaction':_0x19ce6d});});}}})['then'](function(){if(_0xba600){_0x3f84cd=_0xba600;return db['MailAccount'][_0xb59d('0x66')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb59d('0xde'),'raw':!![]}]});}})[_0xb59d('0x1f')](function(_0x15f88a){if(_0x15f88a&&_0x15f88a[_0xb59d('0xde')]&&_0x2394e8[_0xb59d('0xdf')]&&_0x2394e8[_0xb59d('0xe0')]){var _0x28e518={'tls':{'rejectUnauthorized':![]}};if(_0x15f88a[_0xb59d('0xde')][_0xb59d('0xe1')]){_0x28e518[_0xb59d('0xe1')]=_0x15f88a[_0xb59d('0xde')]['service'];}else{_0x28e518[_0xb59d('0xe2')]=_0x15f88a['Smtp'][_0xb59d('0xe2')];_0x28e518['port']=_0x15f88a[_0xb59d('0xde')]['port'];_0x28e518[_0xb59d('0xe3')]=_0x15f88a[_0xb59d('0xde')][_0xb59d('0xe3')];}if(_0x15f88a[_0xb59d('0xde')][_0xb59d('0xe4')]){_0x28e518[_0xb59d('0xe5')]={'user':_0x15f88a['Smtp']['user'],'pass':_0x15f88a[_0xb59d('0xde')][_0xb59d('0xe6')]};}return respondWithRpcPromise(_0xb59d('0xe7'),_0xb59d('0xe8'),{'account':_0x28e518,'message':{'from':util['format'](_0xb59d('0xe9'),_0x15f88a[_0xb59d('0x3c')],_0x15f88a[_0xb59d('0xea')]||_0x15f88a[_0xb59d('0xde')]['user']),'to':_0x2394e8[_0xb59d('0xe0')],'subject':_0x2394e8[_0xb59d('0xeb')],'html':_0x3f84cd[_0xb59d('0x5c')],'attachments':_0x57b2ee}},client9003)[_0xb59d('0x1f')](function(){return _0x3f84cd;})[_0xb59d('0x29')](function(_0x5367b8){console[_0xb59d('0x26')](_0x5367b8);});}})[_0xb59d('0x1f')](function(){if(_0x2394e8&&_0x2394e8[_0xb59d('0xd9')]&&_0x2394e8[_0xb59d('0xec')]){var _0x4ea381=[];if(_0x2f7ddc[_0xb59d('0x48')]){_0x4ea381=_0x2f7ddc[_0xb59d('0x3e')](function(_0x537c1e){return{'name':_0x537c1e[_0xb59d('0xd4')],'basename':_0x537c1e[_0xb59d('0x72')],'type':_0x537c1e[_0xb59d('0xed')],'ChatOfflineMessageId':_0xba600['id']};});}var _0x3a3e6c;if(!_['isNil'](_0x2394e8[_0xb59d('0xee')])){var _0x46bbe0=_[_0xb59d('0x3e')](_0x140836['body'],function(_0x49b4b6){return _0x49b4b6;});var _0xbf360f=_['toPairsIn'](_0x46bbe0)[0x0];var _0x2d0b84=_['mapValues'](_0xbf360f,function(_0x3f64d0){return _0x3f64d0;});_0x3a3e6c=_0x2d0b84[0x1][_0x2394e8[_0xb59d('0xee')]];}var _0xb23bd5={'from':_0x571051['email'],'firstName':_0x571051['firstName'],'lastName':_0x571051[_0xb59d('0xab')],'mapKey':_0xb59d('0xea'),'message':{'from':_0x571051[_0xb59d('0xea')],'to':_0x2394e8[_0xb59d('0xce')][_0xb59d('0xea')],'cc':'','subject':_[_0xb59d('0x7d')](_0x3a3e6c)?_0x2394e8['offlineMessageSubject']:_0x3a3e6c,'messageId':'','sentAt':new Date(),'attach':_0x4ea381[_0xb59d('0x48')],'attachments':_0x4ea381,'originChannel':_0xb59d('0xef'),'ChatWebsiteId':_0x2394e8['id'],'ChatOfflineMessageId':_0x3f84cd['id'],'originTo':_0x2394e8[_0xb59d('0xce')][_0xb59d('0xea')]},'body':_0x3f84cd['body']};var _0x2ea04f={'account':{'id':_0x2394e8[_0xb59d('0xec')]},'body':_0xb23bd5,'log':_0xb59d('0xf0')};return respondWithRpcPromise(_0xb59d('0xf0'),_0xb59d('0xf1'),_0x2ea04f,client9001)[_0xb59d('0x1f')](function(){return _0x3f84cd;})[_0xb59d('0x29')](function(_0x4fbd4f){console[_0xb59d('0x26')](_0x4fbd4f);});}return;})['then'](function(){if(_0x3f84cd){return _0x3f84cd;}})[_0xb59d('0x1f')](respondWithResult(_0x1331f5,null))[_0xb59d('0x29')](function(_0x4fd51a){console[_0xb59d('0x26')]('catch',_0x4fd51a);for(var _0x52d2af of _0x2f7ddc){var _0x321add=path['join'](config['root'],_0xb59d('0xd5'),'files',_0xb59d('0xd7'),_0xb59d('0xf2'),_0x52d2af['filename']);fs_extra[_0xb59d('0xf3')](_0x321add)[_0xb59d('0x29')](function(_0x5d4a03){console[_0xb59d('0x26')]('Could\x20not\x20remove\x20attachment\x20file',_0x321add,_0x5d4a03);});}});};exports['addInteraction']=function(_0x48a6d1,_0x1f553d,_0x2c88d9){return db['ChatInteraction']['find']({'where':{'id':_0x48a6d1[_0xb59d('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f553d,null))[_0xb59d('0x1f')](function(_0x21a896){if(_0x21a896){return _0x21a896[_0xb59d('0xf4')](_0x48a6d1['body'][_0xb59d('0x69')],_[_0xb59d('0xf5')](_0x48a6d1[_0xb59d('0x5c')],['ids','id'])||{});}})['then'](respondWithResult(_0x1f553d,null))[_0xb59d('0x29')](handleError(_0x1f553d,null));};exports[_0xb59d('0xf6')]=function(_0x303f97,_0x591e04,_0x2acb4d){var _0x325396={'raw':![],'where':{}};var _0x5cdbcb={};var _0x20be03={'count':0x0,'rows':[]};return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x303f97[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x591e04,null))[_0xb59d('0x1f')](function(_0x24ccbd){if(_0x24ccbd){_0x5cdbcb['model']=_[_0xb59d('0x58')](db[_0xb59d('0xb7')][_0xb59d('0x57')]);_0x5cdbcb['query']=_[_0xb59d('0x58')](_0x303f97['query']);_0x5cdbcb[_0xb59d('0x44')]=_[_0xb59d('0x45')](_0x5cdbcb[_0xb59d('0x42')],_0x5cdbcb[_0xb59d('0x43')]);_0x325396[_0xb59d('0x46')]=_['intersection'](_0x5cdbcb[_0xb59d('0x42')],qs[_0xb59d('0x47')](_0x303f97[_0xb59d('0x43')][_0xb59d('0x47')]));_0x325396[_0xb59d('0x46')]=_0x325396[_0xb59d('0x46')][_0xb59d('0x48')]?_0x325396[_0xb59d('0x46')]:_0x5cdbcb['model'];if(!_0x303f97[_0xb59d('0x43')][_0xb59d('0x49')](_0xb59d('0x4a'))){_0x325396[_0xb59d('0x30')]=qs[_0xb59d('0x30')](_0x303f97['query'][_0xb59d('0x30')]);_0x325396[_0xb59d('0x2d')]=qs['offset'](_0x303f97[_0xb59d('0x43')][_0xb59d('0x2d')]);}_0x325396[_0xb59d('0x67')]=qs[_0xb59d('0x4b')](_0x303f97['query'][_0xb59d('0x4b')]);_0x325396[_0xb59d('0x4c')]=qs[_0xb59d('0x44')](_['pick'](_0x303f97[_0xb59d('0x43')],_0x5cdbcb['filters']));_0x325396[_0xb59d('0x4c')]['ChatWebsiteId']=_0x24ccbd['id'];if(_0x303f97[_0xb59d('0x43')]['filter']){_0x325396['where']=_['merge'](_0x325396[_0xb59d('0x4c')],{'$or':_[_0xb59d('0x3e')](_0x325396[_0xb59d('0x46')],function(_0x248539){var _0x2cdec2={};_0x2cdec2[_0x248539]={'$like':'%'+_0x303f97['query'][_0xb59d('0x4e')]+'%'};return _0x2cdec2;})});}_0x325396=_[_0xb59d('0x4f')]({},_0x325396,_0x303f97['options']);return db[_0xb59d('0xb7')][_0xb59d('0x2f')]({'where':_0x325396[_0xb59d('0x4c')]})[_0xb59d('0x1f')](function(_0x4f8f71){_0x20be03[_0xb59d('0x2f')]=_0x4f8f71;if(_0x303f97['query']['includeAll']){_0x325396[_0xb59d('0x51')]=[{'model':db['CmContact'],'as':_0xb59d('0xf7'),'required':![]},{'model':db[_0xb59d('0xc3')],'as':_0xb59d('0xf8'),'attributes':[_0xb59d('0x3c'),_0xb59d('0xf9'),_0xb59d('0xfa')],'required':![]},{'model':db[_0xb59d('0xfb')],'as':_0xb59d('0xfc'),'attributes':['id',_0xb59d('0x3c'),_0xb59d('0xfd')],'where':_0x303f97['query'][_0xb59d('0xfe')]?{'id':_0x303f97[_0xb59d('0x43')][_0xb59d('0xfe')]}:undefined,'required':_0x303f97[_0xb59d('0x43')][_0xb59d('0xfe')]?!![]:![]}];}return db[_0xb59d('0xb7')][_0xb59d('0x52')](_0x325396);})['then'](function(_0x1dcb31){_0x20be03['rows']=_0x1dcb31;return _0x20be03;});}})['then'](respondWithFilteredResult(_0x591e04,_0x325396))['catch'](handleError(_0x591e04,null));};function iftimePromise(_0xc248cb,_0x2fe932){return respondWithRpcPromise(_0xb59d('0xff'),'getSnippet',{'command':_0x2fe932[_0xb59d('0x100')]?util[_0xb59d('0xb1')](_0xb59d('0x101'),_0xc248cb['interval'],_0x2fe932[_0xb59d('0x100')]):util[_0xb59d('0xb1')](_0xb59d('0x102'),_0xc248cb[_0xb59d('0x103')])},client9002)[_0xb59d('0x1f')](function(_0x595157){var _0x403243=_0x595157&&_0x595157['indexOf'](_0xb59d('0x104'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2fe932['id'],_0xc248cb['id'],_0xc248cb[_0xb59d('0x103')],_0x403243?_0xb59d('0x105'):'OFFLINE',_0x2fe932[_0xb59d('0x100')]?_0x2fe932['timezone']:_0xb59d('0x106'));return _0x403243;})[_0xb59d('0x29')](function(_0x36ced1){logger[_0xb59d('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2fe932['id'],_0xc248cb['id'],_0xc248cb['interval'],util['inspect'](_0x36ced1,{'showHidden':![],'depth':null}),_0x2fe932[_0xb59d('0x100')]?_0x2fe932[_0xb59d('0x100')]:_0xb59d('0x106'));return![];});}exports['getSnippet']=function(_0x7c5d17,_0x37b921,_0xc8c89b){var _0x28543=0x0;var _0x6563fa=0x0;var _0x9e9a20=![];var _0x7b07c4;var _0x116d86;return db[_0xb59d('0x3f')][_0xb59d('0x5b')]({'where':{'id':_0x7c5d17[_0xb59d('0x55')]['id']},'include':[{'model':db[_0xb59d('0x107')],'as':_0xb59d('0x107'),'include':[{'model':db[_0xb59d('0x107')],'as':_0xb59d('0x108'),'attributes':['id',_0xb59d('0x103')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x37b921,null))[_0xb59d('0x1f')](function(_0x1c745b){if(_0x1c745b){_0x7b07c4=_0x1c745b;return _0x1c745b[_0xb59d('0x109')]({'raw':!![]});}})['then'](function(_0x549766){if(_0x7b07c4){if(_0x549766){_0x116d86=_0x549766;}}return require('../../config/license/util')['getLicense']();})[_0xb59d('0x1f')](function(_0x5bad68){if(_0x5bad68){_0x6563fa=_0x5bad68[_0xb59d('0x10a')];_0x9e9a20=_0x5bad68[_0xb59d('0x7c')];}})[_0xb59d('0x1f')](function(){return db[_0xb59d('0xb7')]['count']({'where':{'closed':![]}});})['then'](function(_0x4a3d51){_0x28543=_0x4a3d51;if(_0x6563fa&&_0x4a3d51>_0x6563fa){return db[_0xb59d('0x10b')][_0xb59d('0x66')]({'where':{'id':0x1}})['then'](function(_0x31c061){if(_0x31c061){_0x31c061[_0xb59d('0x10c')](_0xb59d('0x10d'));}});}})[_0xb59d('0x1f')](function(){if(_0x7b07c4['Interval']&&_0x7b07c4[_0xb59d('0x107')]['Intervals']){var _0x3020e7=[];for(var _0x4755ca=0x0;_0x4755ca<_0x7b07c4[_0xb59d('0x107')]['Intervals']['length'];_0x4755ca++){var _0x407c75=_0x7b07c4['Interval'][_0xb59d('0x108')][_0x4755ca][_0xb59d('0x38')]({'plain':!![]});_0x3020e7[_0xb59d('0xbf')](iftimePromise(_0x407c75,_0x7b07c4));}return BPromise[_0xb59d('0x10e')](_0x3020e7)[_0xb59d('0x1f')](function(_0x101f74){return _['some'](_0x101f74);});}else{return!![];}})[_0xb59d('0x1f')](function(_0x40064d){var _0x2584cf=fs[_0xb59d('0x10f')](path[_0xb59d('0x78')](config[_0xb59d('0x79')],_0xb59d('0x110')),_0xb59d('0xd0'));var _0x4ecc5f={'remote':_0x7b07c4[_0xb59d('0x111')],'query':querystring[_0xb59d('0x24')](_[_0xb59d('0x4f')](_0x7b07c4[_0xb59d('0x38')]({'plain':!![]}),{'customerIp':_0x7c5d17[_0xb59d('0xa6')][_0xb59d('0xa8')]||_0x7c5d17[_0xb59d('0xa6')]['x-real-ip']||_0x7c5d17[_0xb59d('0x112')][_0xb59d('0x113')]||_0x7c5d17['ip'],'referer':_0x7c5d17[_0xb59d('0xa6')][_0xb59d('0xad')],'openedInteractions':_0x28543,'maxInteractions':_0x6563fa,'virtual':_0x9e9a20[_0xb59d('0x10a')],'online':_0x40064d,'custom':_0x9e9a20}))[_0xb59d('0x114')](/'/g,'\x5c\x27')};_0x37b921['send'](ejs[_0xb59d('0xd1')](Mustache[_0xb59d('0xd1')](_0x2584cf,_0x4ecc5f),{'proactiveActions':_0x116d86,'alignment':_0x7b07c4[_0xb59d('0x115')],'verticalAlignment':_0x7b07c4[_0xb59d('0x116')],'div_color':_0x7b07c4[_0xb59d('0xfd')],'text_color':_0x7b07c4[_0xb59d('0x117')],'button_color':_0x7b07c4[_0xb59d('0x118')],'background_color':_0x7b07c4[_0xb59d('0x119')]}));})[_0xb59d('0x29')](handleError(_0x37b921,null));};exports[_0xb59d('0x11a')]=function(_0x57fd05,_0xdf057f,_0x4d5660){return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x57fd05[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0xdf057f,null))['then'](function(_0x3fa883){if(_0x3fa883){return db[_0xb59d('0xda')][_0xb59d('0xdb')](function(_0x19f78d){return db[_0xb59d('0x9f')][_0xb59d('0x37')]({'where':{'ChatWebsiteId':_0x57fd05[_0xb59d('0x55')]['id']},'transaction':_0x19f78d})[_0xb59d('0x1f')](function(_0x557feb){var _0x5f22ca=_[_0xb59d('0x3e')](_0x57fd05[_0xb59d('0x5c')],function(_0x4b2149){_0x4b2149[_0xb59d('0x63')]=_0x57fd05[_0xb59d('0x55')]['id'];return _0x4b2149;});return db[_0xb59d('0x9f')]['bulkCreate'](_0x5f22ca,{'transaction':_0x19f78d});});})['then'](function(){return db[_0xb59d('0x9f')][_0xb59d('0x11b')]({'where':{'ChatWebsiteId':_0x57fd05[_0xb59d('0x55')]['id']},'order':_0xb59d('0x11c')});});}})[_0xb59d('0x1f')](respondWithResult(_0xdf057f,null))[_0xb59d('0x29')](handleError(_0xdf057f,null));};exports[_0xb59d('0x11d')]=function(_0x102ea6,_0xe6ac27,_0x2e60a5){var _0x452dba={};var _0x41ddad={};var _0x33d6cf;var _0x246cfa;return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x102ea6[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0xe6ac27,null))[_0xb59d('0x1f')](function(_0x335cb1){if(_0x335cb1){_0x33d6cf=_0x335cb1;_0x41ddad[_0xb59d('0x42')]=_[_0xb59d('0x58')](db[_0xb59d('0x9f')][_0xb59d('0x57')]);_0x41ddad[_0xb59d('0x43')]=_[_0xb59d('0x58')](_0x102ea6[_0xb59d('0x43')]);_0x41ddad[_0xb59d('0x44')]=_[_0xb59d('0x45')](_0x41ddad['model'],_0x41ddad[_0xb59d('0x43')]);_0x452dba[_0xb59d('0x46')]=_[_0xb59d('0x45')](_0x41ddad['model'],qs[_0xb59d('0x47')](_0x102ea6[_0xb59d('0x43')][_0xb59d('0x47')]));_0x452dba[_0xb59d('0x46')]=_0x452dba[_0xb59d('0x46')][_0xb59d('0x48')]?_0x452dba[_0xb59d('0x46')]:_0x41ddad[_0xb59d('0x42')];_0x452dba[_0xb59d('0x67')]=qs[_0xb59d('0x4b')](_0x102ea6[_0xb59d('0x43')][_0xb59d('0x4b')]);_0x452dba[_0xb59d('0x4c')]=qs[_0xb59d('0x44')](_[_0xb59d('0x4d')](_0x102ea6[_0xb59d('0x43')],_0x41ddad[_0xb59d('0x44')]));if(_0x102ea6[_0xb59d('0x43')][_0xb59d('0x4e')]){_0x452dba[_0xb59d('0x4c')]=_[_0xb59d('0x4f')](_0x452dba[_0xb59d('0x4c')],{'$or':_[_0xb59d('0x3e')](_0x452dba[_0xb59d('0x46')],function(_0x68a572){var _0x4a802b={};_0x4a802b[_0x68a572]={'$like':'%'+_0x102ea6['query'][_0xb59d('0x4e')]+'%'};return _0x4a802b;})});}_0x452dba=_[_0xb59d('0x4f')]({},_0x452dba,_0x102ea6[_0xb59d('0x5a')]);return _0x33d6cf['getApplications'](_0x452dba);}})[_0xb59d('0x1f')](function(_0x84c0dc){if(_0x84c0dc){_0x246cfa=_0x84c0dc[_0xb59d('0x48')];if(!_0x102ea6[_0xb59d('0x43')][_0xb59d('0x49')](_0xb59d('0x4a'))){_0x452dba[_0xb59d('0x30')]=qs[_0xb59d('0x30')](_0x102ea6[_0xb59d('0x43')][_0xb59d('0x30')]);_0x452dba[_0xb59d('0x2d')]=qs[_0xb59d('0x2d')](_0x102ea6[_0xb59d('0x43')][_0xb59d('0x2d')]);}return _0x33d6cf[_0xb59d('0x11d')](_0x452dba);}})[_0xb59d('0x1f')](function(_0x48a702){if(_0x48a702){return _0x48a702?{'count':_0x246cfa,'rows':_0x48a702}:null;}})[_0xb59d('0x1f')](respondWithResult(_0xe6ac27,null))['catch'](handleError(_0xe6ac27,null));};exports[_0xb59d('0x11e')]=function(_0x1d8f75,_0xd6f795,_0x17bab5){return db['chatProactiveAction']['find']({'where':{'id':_0x1d8f75[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0xd6f795,null))[_0xb59d('0x1f')](function(_0x29ba45){if(_0x29ba45){return _0x29ba45[_0xb59d('0x11e')](_0x1d8f75[_0xb59d('0x5c')][_0xb59d('0x69')],_[_0xb59d('0xf5')](_0x1d8f75['body'],[_0xb59d('0x69'),'id'])||{});}})[_0xb59d('0x1f')](respondWithResult(_0xd6f795,null))[_0xb59d('0x29')](handleError(_0xd6f795,null));};exports['getProactiveActions']=function(_0x557cc5,_0x47293c,_0x464859){var _0x3afb4d={};var _0x259a5b={};var _0x2846da;var _0x14bf2a;return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x557cc5['params']['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x47293c,null))[_0xb59d('0x1f')](function(_0x380a6d){if(_0x380a6d){_0x2846da=_0x380a6d;_0x259a5b['model']=_[_0xb59d('0x58')](db['ChatProactiveAction'][_0xb59d('0x57')]);_0x259a5b[_0xb59d('0x43')]=_['keys'](_0x557cc5['query']);_0x259a5b[_0xb59d('0x44')]=_[_0xb59d('0x45')](_0x259a5b[_0xb59d('0x42')],_0x259a5b[_0xb59d('0x43')]);_0x3afb4d[_0xb59d('0x46')]=_[_0xb59d('0x45')](_0x259a5b[_0xb59d('0x42')],qs['fields'](_0x557cc5[_0xb59d('0x43')][_0xb59d('0x47')]));_0x3afb4d[_0xb59d('0x46')]=_0x3afb4d[_0xb59d('0x46')][_0xb59d('0x48')]?_0x3afb4d[_0xb59d('0x46')]:_0x259a5b['model'];_0x3afb4d[_0xb59d('0x67')]=qs['sort'](_0x557cc5[_0xb59d('0x43')][_0xb59d('0x4b')]);_0x3afb4d[_0xb59d('0x4c')]=qs[_0xb59d('0x44')](_[_0xb59d('0x4d')](_0x557cc5[_0xb59d('0x43')],_0x259a5b['filters']));if(_0x557cc5[_0xb59d('0x43')][_0xb59d('0x4e')]){_0x3afb4d[_0xb59d('0x4c')]=_[_0xb59d('0x4f')](_0x3afb4d[_0xb59d('0x4c')],{'$or':_[_0xb59d('0x3e')](_0x3afb4d[_0xb59d('0x46')],function(_0x221e48){var _0x5bf44f={};_0x5bf44f[_0x221e48]={'$like':'%'+_0x557cc5[_0xb59d('0x43')][_0xb59d('0x4e')]+'%'};return _0x5bf44f;})});}_0x3afb4d=_[_0xb59d('0x4f')]({},_0x3afb4d,_0x557cc5[_0xb59d('0x5a')]);return _0x2846da[_0xb59d('0x109')](_0x3afb4d);}})[_0xb59d('0x1f')](function(_0x57307e){if(_0x57307e){_0x14bf2a=_0x57307e[_0xb59d('0x48')];if(!_0x557cc5[_0xb59d('0x43')][_0xb59d('0x49')](_0xb59d('0x4a'))){_0x3afb4d[_0xb59d('0x30')]=qs['limit'](_0x557cc5[_0xb59d('0x43')][_0xb59d('0x30')]);_0x3afb4d['offset']=qs[_0xb59d('0x2d')](_0x557cc5[_0xb59d('0x43')][_0xb59d('0x2d')]);}return _0x2846da['getProactiveActions'](_0x3afb4d);}})[_0xb59d('0x1f')](function(_0x44fa5b){if(_0x44fa5b){return _0x44fa5b?{'count':_0x14bf2a,'rows':_0x44fa5b}:null;}})[_0xb59d('0x1f')](respondWithResult(_0x47293c,null))[_0xb59d('0x29')](handleError(_0x47293c,null));};exports[_0xb59d('0x11f')]=function(_0x16503a,_0x4d348e,_0x29eb0d){var _0x1e5666=_0x16503a[_0xb59d('0x43')][_0xb59d('0x120')]===_0xb59d('0x121')?_0xb59d('0x122'):_0xb59d('0x123');return db['ChatWebsite'][_0xb59d('0x5b')]({'attributes':['id',_0x1e5666],'where':{'id':_0x16503a[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x4d348e,null))[_0xb59d('0x1f')](function(_0x28afdd){if(_0x28afdd){var _0x1a12e3=_0x28afdd[_0x1e5666];var _0xffd7ff=_0x1a12e3&&_0x1a12e3['items']?_0x1a12e3[_0xb59d('0x124')]:[];_0x4d348e['send']({'fromKey':_[_0xb59d('0x7d')](_0x1a12e3['fromKey'])?undefined:_0x1a12e3[_0xb59d('0x125')],'count':_0xffd7ff['length'],'rows':_0xffd7ff});}})[_0xb59d('0x29')](handleError(_0x4d348e,null));};exports[_0xb59d('0x126')]=function(_0x1f2d47,_0x1404e9,_0x1a8ec9){var _0x3a2c50={'raw':![],'where':{}};var _0x573848={};var _0x17c17e={'count':0x0,'rows':[]};return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x1f2d47[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x1404e9,null))[_0xb59d('0x1f')](function(_0x1e25b1){if(_0x1e25b1){_0x573848[_0xb59d('0x42')]=_[_0xb59d('0x58')](db[_0xb59d('0x127')][_0xb59d('0x57')]);_0x573848[_0xb59d('0x43')]=_[_0xb59d('0x58')](_0x1f2d47[_0xb59d('0x43')]);_0x573848['filters']=_[_0xb59d('0x45')](_0x573848[_0xb59d('0x42')],_0x573848[_0xb59d('0x43')]);_0x3a2c50[_0xb59d('0x46')]=_[_0xb59d('0x45')](_0x573848[_0xb59d('0x42')],qs[_0xb59d('0x47')](_0x1f2d47['query'][_0xb59d('0x47')]));_0x3a2c50['attributes']=_0x3a2c50['attributes'][_0xb59d('0x48')]?_0x3a2c50[_0xb59d('0x46')]:_0x573848[_0xb59d('0x42')];if(!_0x1f2d47[_0xb59d('0x43')]['hasOwnProperty'](_0xb59d('0x4a'))){_0x3a2c50['limit']=qs[_0xb59d('0x30')](_0x1f2d47['query'][_0xb59d('0x30')]);_0x3a2c50['offset']=qs[_0xb59d('0x2d')](_0x1f2d47[_0xb59d('0x43')][_0xb59d('0x2d')]);}_0x3a2c50[_0xb59d('0x67')]=qs[_0xb59d('0x4b')](_0x1f2d47[_0xb59d('0x43')]['sort']);_0x3a2c50[_0xb59d('0x4c')]=qs[_0xb59d('0x44')](_['pick'](_0x1f2d47['query'],_0x573848[_0xb59d('0x44')]));_0x3a2c50[_0xb59d('0x4c')][_0xb59d('0x63')]=_0x1e25b1['id'];if(_0x1f2d47[_0xb59d('0x43')][_0xb59d('0x4e')]){_0x3a2c50['where']=_[_0xb59d('0x4f')](_0x3a2c50[_0xb59d('0x4c')],{'$or':_['map'](_0x3a2c50[_0xb59d('0x46')],function(_0x1d91ed){var _0x401fa6={};_0x401fa6[_0x1d91ed]={'$like':'%'+_0x1f2d47[_0xb59d('0x43')][_0xb59d('0x4e')]+'%'};return _0x401fa6;})});}_0x3a2c50=_['merge']({},_0x3a2c50,_0x1f2d47[_0xb59d('0x5a')]);return db[_0xb59d('0x127')]['count']({'where':_0x3a2c50[_0xb59d('0x4c')]})['then'](function(_0x2d33e2){_0x17c17e['count']=_0x2d33e2;if(_0x1f2d47[_0xb59d('0x43')][_0xb59d('0x59')]){_0x3a2c50['include']=[{'all':!![]}];}else{_0x3a2c50[_0xb59d('0x51')]=[{'model':db['CmContact'],'as':_0xb59d('0xf7'),'required':![]},{'model':db[_0xb59d('0xdc')],'as':_0xb59d('0x128'),'required':![]}];}return db['ChatOfflineMessage'][_0xb59d('0x52')](_0x3a2c50);})['then'](function(_0x1d08ba){_0x17c17e[_0xb59d('0x53')]=_0x1d08ba;return _0x17c17e;});}})[_0xb59d('0x1f')](respondWithFilteredResult(_0x1404e9,_0x3a2c50))['catch'](handleError(_0x1404e9,null));};exports['addAgents']=function(_0x2c1f07,_0x4b9c78,_0x195e74){return db[_0xb59d('0x3f')]['find']({'where':{'id':_0x2c1f07[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x4b9c78,null))[_0xb59d('0x1f')](function(_0x348f67){if(_0x348f67){return _0x348f67['addAgents'](_0x2c1f07[_0xb59d('0x5c')]['ids'],_[_0xb59d('0xf5')](_0x2c1f07[_0xb59d('0x5c')],[_0xb59d('0x69'),'id'])||{})[_0xb59d('0xbb')](function(_0x509c71){for(var _0x4853e5=0x0;_0x4853e5<_0x2c1f07['body'][_0xb59d('0x69')]['length'];_0x4853e5+=0x1){socket[_0xb59d('0x129')](_0xb59d('0x12a'),{'UserId':Number(_0x2c1f07[_0xb59d('0x5c')][_0xb59d('0x69')][_0x4853e5]),'ChatWebsiteId':Number(_0x2c1f07['params']['id'])});}return _0x509c71;});}})[_0xb59d('0x1f')](respondWithResult(_0x4b9c78,null))[_0xb59d('0x29')](handleError(_0x4b9c78,null));};exports[_0xb59d('0x12b')]=function(_0x503af9,_0x1080d5,_0x105592){return db['ChatWebsite']['find']({'where':{'id':_0x503af9[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x1080d5,null))[_0xb59d('0x1f')](function(_0x42faf3){if(_0x42faf3){return _0x42faf3['removeAgents'](_0x503af9[_0xb59d('0x43')][_0xb59d('0x69')])[_0xb59d('0x1f')](function(){if(_[_0xb59d('0x12c')](_0x503af9['query'][_0xb59d('0x69')])){for(var _0x352426=0x0;_0x352426<_0x503af9[_0xb59d('0x43')][_0xb59d('0x69')][_0xb59d('0x48')];_0x352426+=0x1){socket[_0xb59d('0x129')](_0xb59d('0x12d'),{'UserId':Number(_0x503af9[_0xb59d('0x43')]['ids'][_0x352426]),'ChatWebsiteId':Number(_0x503af9[_0xb59d('0x55')]['id'])});}}else{socket[_0xb59d('0x129')](_0xb59d('0x12d'),{'UserId':Number(_0x503af9[_0xb59d('0x43')][_0xb59d('0x69')]),'ChatWebsiteId':Number(_0x503af9[_0xb59d('0x55')]['id'])});}});}})[_0xb59d('0x1f')](respondWithStatusCode(_0x1080d5,null))[_0xb59d('0x29')](handleError(_0x1080d5,null));};exports[_0xb59d('0x12e')]=function(_0x29c045,_0x54a98b,_0x3ce696){var _0x497984={};var _0x3ef58b={};var _0x5b6b17;var _0x14ab14;return db[_0xb59d('0x3f')][_0xb59d('0x66')]({'where':{'id':_0x29c045[_0xb59d('0x55')]['id']}})[_0xb59d('0x1f')](handleEntityNotFound(_0x54a98b,null))[_0xb59d('0x1f')](function(_0x4e7aed){if(_0x4e7aed){_0x5b6b17=_0x4e7aed;_0x3ef58b['model']=_['keys'](db[_0xb59d('0xc3')][_0xb59d('0x57')]);_0x3ef58b[_0xb59d('0x43')]=_['keys'](_0x29c045['query']);_0x3ef58b[_0xb59d('0x44')]=_[_0xb59d('0x45')](_0x3ef58b[_0xb59d('0x42')],_0x3ef58b[_0xb59d('0x43')]);_0x497984[_0xb59d('0x46')]=_[_0xb59d('0x45')](_0x3ef58b[_0xb59d('0x42')],qs[_0xb59d('0x47')](_0x29c045[_0xb59d('0x43')][_0xb59d('0x47')]));_0x497984[_0xb59d('0x46')]=_0x497984[_0xb59d('0x46')][_0xb59d('0x48')]?_0x497984[_0xb59d('0x46')]:_0x3ef58b[_0xb59d('0x42')];_0x497984[_0xb59d('0x67')]=qs[_0xb59d('0x4b')](_0x29c045[_0xb59d('0x43')][_0xb59d('0x4b')]);_0x497984[_0xb59d('0x4c')]=qs[_0xb59d('0x44')](_[_0xb59d('0x4d')](_0x29c045[_0xb59d('0x43')],_0x3ef58b[_0xb59d('0x44')]));if(_0x29c045['query'][_0xb59d('0x4e')]){_0x497984[_0xb59d('0x4c')]=_[_0xb59d('0x4f')](_0x497984[_0xb59d('0x4c')],{'$or':_['map'](_0x497984['attributes'],function(_0x548d31){var _0x343589={};_0x343589[_0x548d31]={'$like':'%'+_0x29c045[_0xb59d('0x43')][_0xb59d('0x4e')]+'%'};return _0x343589;})});}_0x497984=_[_0xb59d('0x4f')]({},_0x497984,_0x29c045[_0xb59d('0x5a')]);return _0x5b6b17['getAgents'](_0x497984);}})[_0xb59d('0x1f')](function(_0x9ec48d){if(_0x9ec48d){_0x14ab14=_0x9ec48d['length'];if(!_0x29c045[_0xb59d('0x43')]['hasOwnProperty'](_0xb59d('0x4a'))){_0x497984[_0xb59d('0x30')]=qs['limit'](_0x29c045[_0xb59d('0x43')]['limit']);_0x497984[_0xb59d('0x2d')]=qs['offset'](_0x29c045['query'][_0xb59d('0x2d')]);}return _0x5b6b17['getAgents'](_0x497984);}})[_0xb59d('0x1f')](function(_0x5591a1){if(_0x5591a1){return _0x5591a1?{'count':_0x14ab14,'rows':_0x5591a1}:null;}})[_0xb59d('0x1f')](respondWithResult(_0x54a98b,null))['catch'](handleError(_0x54a98b,null));}; \ No newline at end of file +var _0x4ced=['from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','asc','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','close','unmanaged','ChatMessage','User','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','originalname','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','pass','SendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','mapValues','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','push','some','remote','x-real-ip','verticalAlignment','textColor','color_button','backgroundColor','addApplications','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','sendStatus','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','destroy','find','describe','ChatWebsiteId','Disposition','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from'];(function(_0x51cf17,_0x333223){var _0x5b5a04=function(_0x5cffdf){while(--_0x5cffdf){_0x51cf17['push'](_0x51cf17['shift']());}};_0x5b5a04(++_0x333223);}(_0x4ced,0x1c1));var _0xd4ce=function(_0x4e3a00,_0x13fcf2){_0x4e3a00=_0x4e3a00-0x0;var _0xf7cba7=_0x4ced[_0x4e3a00];return _0xf7cba7;};'use strict';var emlformat=require(_0xd4ce('0x0'));var rimraf=require(_0xd4ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4ce('0x2'));var rp=require(_0xd4ce('0x3'));var moment=require(_0xd4ce('0x4'));var BPromise=require(_0xd4ce('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd4ce('0x6'));var sox=require(_0xd4ce('0x7'));var csv=require(_0xd4ce('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4ce('0x9'));var _=require('lodash');var squel=require(_0xd4ce('0xa'));var crypto=require(_0xd4ce('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4ce('0x8'));var querystring=require('querystring');var Papa=require(_0xd4ce('0xc'));var Redis=require(_0xd4ce('0xd'));var authService=require(_0xd4ce('0xe'));var qs=require(_0xd4ce('0xf'));var as=require(_0xd4ce('0x10'));var hardwareService=require(_0xd4ce('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xd4ce('0x12'));var config=require(_0xd4ce('0x13'));var licenseUtil=require(_0xd4ce('0x14'));var db=require(_0xd4ce('0x15'))['db'];config[_0xd4ce('0x16')]=_['defaults'](config['redis'],{'host':_0xd4ce('0x17'),'port':0x18eb});var socket=require(_0xd4ce('0x18'))(new Redis(config[_0xd4ce('0x16')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0xd4ce('0x19'));var client=jayson[_0xd4ce('0x1a')][_0xd4ce('0x1b')]({'port':0x232c});var client9002=jayson[_0xd4ce('0x1a')][_0xd4ce('0x1b')]({'port':0x232a});var client9003=jayson['client'][_0xd4ce('0x1b')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x12cf69,_0x54b651,_0x43a0f5,_0x217726){return new BPromise(function(_0x3f1c31,_0x1c2310){var _0x4189c0=_0x217726||client;return _0x4189c0['request'](_0x12cf69,_0x43a0f5)['then'](function(_0x16f66f){logger[_0xd4ce('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x54b651,_0xd4ce('0x1d'));logger[_0xd4ce('0x1e')](_0xd4ce('0x1f'),_0x54b651,_0xd4ce('0x1d'),JSON[_0xd4ce('0x20')](_0x16f66f));if(_0x16f66f[_0xd4ce('0x21')]){if(_0x16f66f['error']['code']===0x1f4){logger[_0xd4ce('0x21')](_0xd4ce('0x22'),_0x54b651,_0x16f66f[_0xd4ce('0x21')]['message']);return _0x1c2310(_0x16f66f[_0xd4ce('0x21')]['message']);}logger[_0xd4ce('0x21')](_0xd4ce('0x22'),_0x54b651,_0x16f66f['error'][_0xd4ce('0x23')]);return _0x3f1c31(_0x16f66f[_0xd4ce('0x21')][_0xd4ce('0x23')]);}else{logger[_0xd4ce('0x1c')](_0xd4ce('0x22'),_0x54b651,_0xd4ce('0x1d'));_0x3f1c31(_0x16f66f['result'][_0xd4ce('0x23')]);}})['catch'](function(_0x48a189){logger[_0xd4ce('0x21')](_0xd4ce('0x22'),_0x54b651,_0x48a189);_0x1c2310(_0x48a189);});});}function respondWithStatusCode(_0x3076a7,_0x1684c8){_0x1684c8=_0x1684c8||0xcc;return function(_0x271606){if(_0x271606){return _0x3076a7[_0xd4ce('0x24')](_0x1684c8);}return _0x3076a7['status'](_0x1684c8)['end']();};}function respondWithResult(_0x5a501d,_0x365ab0){_0x365ab0=_0x365ab0||0xc8;return function(_0x3d79a8){if(_0x3d79a8){return _0x5a501d['status'](_0x365ab0)[_0xd4ce('0x25')](_0x3d79a8);}};}function respondWithFilteredResult(_0x55b737,_0x11aee6){return function(_0x2b462c){if(_0x2b462c){var _0x3c0ca4=typeof _0x11aee6['offset']===_0xd4ce('0x26')&&typeof _0x11aee6[_0xd4ce('0x27')]==='undefined';var _0x47de61=_0x2b462c[_0xd4ce('0x28')];var _0x48943e=_0x3c0ca4?0x0:_0x11aee6[_0xd4ce('0x29')];var _0xcfa086=_0x3c0ca4?_0x2b462c[_0xd4ce('0x28')]:_0x11aee6[_0xd4ce('0x29')]+_0x11aee6[_0xd4ce('0x27')];var _0x28ad29;if(_0xcfa086>=_0x47de61){_0xcfa086=_0x47de61;_0x28ad29=0xc8;}else{_0x28ad29=0xce;}_0x55b737[_0xd4ce('0x2a')](_0x28ad29);return _0x55b737[_0xd4ce('0x2b')]('Content-Range',_0x48943e+'-'+_0xcfa086+'/'+_0x47de61)['json'](_0x2b462c);}return null;};}function patchUpdates(_0x2e3791){return function(_0x27aea7){try{jsonpatch[_0xd4ce('0x2c')](_0x27aea7,_0x2e3791,!![]);}catch(_0x1cb776){return BPromise[_0xd4ce('0x2d')](_0x1cb776);}return _0x27aea7[_0xd4ce('0x2e')]();};}function saveUpdates(_0x4753aa,_0x1d872e){return function(_0x13cc3b){if(_0x13cc3b){return _0x13cc3b[_0xd4ce('0x2f')](_0x4753aa)['then'](function(_0x2ea84e){return _0x2ea84e;});}return null;};}function removeEntity(_0x5cf075,_0x3a40cf){return function(_0x361015){if(_0x361015){return _0x361015['destroy']()[_0xd4ce('0x30')](function(){var _0x3b579f=_0x361015['get']({'plain':!![]});var _0x1d20db=_0xd4ce('0x31');return db[_0xd4ce('0x32')]['destroy']({'where':{'type':_0x1d20db,'resourceId':_0x3b579f['id']}})[_0xd4ce('0x30')](function(){return _0x361015;});})['then'](function(){_0x5cf075[_0xd4ce('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59964d,_0x13f26a){return function(_0x465fa4){if(!_0x465fa4){_0x59964d[_0xd4ce('0x24')](0x194);}return _0x465fa4;};}function handleError(_0x3b934b,_0x48e179){_0x48e179=_0x48e179||0x1f4;return function(_0x508edf){logger[_0xd4ce('0x21')](_0x508edf[_0xd4ce('0x33')]);if(_0x508edf[_0xd4ce('0x34')]){delete _0x508edf[_0xd4ce('0x34')];}_0x3b934b[_0xd4ce('0x2a')](_0x48e179)[_0xd4ce('0x35')](_0x508edf);};}exports[_0xd4ce('0x36')]=function(_0x5be70e,_0x31171a){var _0x5d3745={'include':[{'model':db[_0xd4ce('0x37')],'as':_0xd4ce('0x38')}]},_0x5bd479={},_0x50adf8={'count':0x0,'rows':[]};var _0x3a2ee3=_[_0xd4ce('0x39')](db[_0xd4ce('0x3a')][_0xd4ce('0x3b')],function(_0x55f964){return{'name':_0x55f964[_0xd4ce('0x3c')],'type':_0x55f964['type'][_0xd4ce('0x3d')]};});_0x5bd479[_0xd4ce('0x3e')]=_['map'](_0x3a2ee3,'name');_0x5bd479[_0xd4ce('0x3f')]=_[_0xd4ce('0x40')](_0x5be70e[_0xd4ce('0x3f')]);_0x5bd479[_0xd4ce('0x41')]=_['intersection'](_0x5bd479[_0xd4ce('0x3e')],_0x5bd479[_0xd4ce('0x3f')]);_0x5d3745['attributes']=_[_0xd4ce('0x42')](_0x5bd479[_0xd4ce('0x3e')],qs['fields'](_0x5be70e[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x5d3745['attributes']=_0x5d3745[_0xd4ce('0x44')]['length']?_0x5d3745[_0xd4ce('0x44')]:_0x5bd479[_0xd4ce('0x3e')];if(!_0x5be70e[_0xd4ce('0x3f')][_0xd4ce('0x45')](_0xd4ce('0x46'))){_0x5d3745[_0xd4ce('0x27')]=qs[_0xd4ce('0x27')](_0x5be70e[_0xd4ce('0x3f')][_0xd4ce('0x27')]);_0x5d3745[_0xd4ce('0x29')]=qs[_0xd4ce('0x29')](_0x5be70e['query'][_0xd4ce('0x29')]);}_0x5d3745[_0xd4ce('0x47')]=qs[_0xd4ce('0x48')](_0x5be70e[_0xd4ce('0x3f')]['sort']);_0x5d3745['where']=qs[_0xd4ce('0x41')](_[_0xd4ce('0x49')](_0x5be70e['query'],_0x5bd479[_0xd4ce('0x41')]),_0x3a2ee3);if(_0x5be70e[_0xd4ce('0x3f')][_0xd4ce('0x4a')]){_0x5d3745[_0xd4ce('0x4b')]=_[_0xd4ce('0x4c')](_0x5d3745[_0xd4ce('0x4b')],{'$or':_[_0xd4ce('0x39')](_0x3a2ee3,function(_0x4cccc9){if(_0x4cccc9[_0xd4ce('0x4d')]!==_0xd4ce('0x4e')){var _0x49ef81={};_0x49ef81[_0x4cccc9['name']]={'$like':'%'+_0x5be70e[_0xd4ce('0x3f')][_0xd4ce('0x4a')]+'%'};return _0x49ef81;}})});}_0x5d3745=_['merge']({},_0x5d3745,_0x5be70e['options']);var _0x29f5fa={'where':_0x5d3745['where']};return db[_0xd4ce('0x3a')]['count'](_0x29f5fa)['then'](function(_0x1bf002){_0x50adf8[_0xd4ce('0x28')]=_0x1bf002;if(_0x5be70e[_0xd4ce('0x3f')][_0xd4ce('0x4f')]){_0x5d3745[_0xd4ce('0x50')]=[{'all':!![]}];}return db[_0xd4ce('0x3a')][_0xd4ce('0x51')](_0x5d3745);})[_0xd4ce('0x30')](function(_0x56b3ed){_0x50adf8[_0xd4ce('0x52')]=_0x56b3ed;return _0x50adf8;})[_0xd4ce('0x30')](respondWithFilteredResult(_0x31171a,_0x5d3745))[_0xd4ce('0x53')](handleError(_0x31171a,null));};exports['show']=function(_0x53bdd6,_0x93df8c){var _0x238d05={'raw':![],'where':{'id':_0x53bdd6[_0xd4ce('0x54')]['id']},'include':[{'model':db[_0xd4ce('0x37')],'as':'mandatoryDispositionPause'}]},_0x143757={};_0x143757[_0xd4ce('0x3e')]=_[_0xd4ce('0x40')](db[_0xd4ce('0x3a')]['rawAttributes']);_0x143757[_0xd4ce('0x3f')]=_['keys'](_0x53bdd6[_0xd4ce('0x3f')]);_0x143757[_0xd4ce('0x41')]=_[_0xd4ce('0x42')](_0x143757['model'],_0x143757['query']);_0x238d05[_0xd4ce('0x44')]=_['intersection'](_0x143757['model'],qs[_0xd4ce('0x43')](_0x53bdd6[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x238d05[_0xd4ce('0x44')]=_0x238d05[_0xd4ce('0x44')][_0xd4ce('0x55')]?_0x238d05[_0xd4ce('0x44')]:_0x143757[_0xd4ce('0x3e')];if(_0x53bdd6[_0xd4ce('0x3f')][_0xd4ce('0x4f')]){_0x238d05['include']=[{'all':!![]}];}_0x238d05=_[_0xd4ce('0x4c')]({},_0x238d05,_0x53bdd6[_0xd4ce('0x56')]);return db[_0xd4ce('0x3a')]['find'](_0x238d05)[_0xd4ce('0x30')](handleEntityNotFound(_0x93df8c,null))[_0xd4ce('0x30')](respondWithResult(_0x93df8c,null))[_0xd4ce('0x53')](handleError(_0x93df8c,null));};exports[_0xd4ce('0x57')]=function(_0x30448e,_0x35bc26){return db[_0xd4ce('0x3a')][_0xd4ce('0x57')](_0x30448e[_0xd4ce('0x58')],{})['then'](function(_0x64d412){var _0x3660d2=_0x30448e[_0xd4ce('0x59')][_0xd4ce('0x5a')]({'plain':!![]});if(!_0x3660d2)throw new Error(_0xd4ce('0x5b'));if(_0x3660d2[_0xd4ce('0x5c')]==='user'){var _0x284b01=_0x64d412[_0xd4ce('0x5a')]({'plain':!![]});var _0x5ca3a2=_0xd4ce('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x5ca3a2,'userProfileId':_0x3660d2['userProfileId']},'raw':!![]})[_0xd4ce('0x30')](function(_0x77348a){if(_0x77348a&&_0x77348a[_0xd4ce('0x5d')]===0x0){return db[_0xd4ce('0x32')][_0xd4ce('0x57')]({'name':_0x284b01[_0xd4ce('0x34')],'resourceId':_0x284b01['id'],'type':_0x77348a['name'],'sectionId':_0x77348a['id']},{})[_0xd4ce('0x30')](function(){return _0x64d412;});}else{return _0x64d412;}})['catch'](function(_0xe2eae3){logger[_0xd4ce('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe2eae3);throw _0xe2eae3;});}return _0x64d412;})[_0xd4ce('0x30')](respondWithResult(_0x35bc26,0xc9))['catch'](handleError(_0x35bc26,null));};exports[_0xd4ce('0x2f')]=function(_0x353368,_0x2d0dee){if(_0x353368['body']['id']){delete _0x353368[_0xd4ce('0x58')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x353368['params']['id']},'include':[{'model':db['Pause'],'as':_0xd4ce('0x38')}]})[_0xd4ce('0x30')](handleEntityNotFound(_0x2d0dee,null))['then'](saveUpdates(_0x353368['body'],null))[_0xd4ce('0x30')](respondWithResult(_0x2d0dee,null))[_0xd4ce('0x53')](handleError(_0x2d0dee,null));};exports[_0xd4ce('0x5e')]=function(_0x9014b9,_0x5e21ee){return db['ChatWebsite'][_0xd4ce('0x5f')]({'where':{'id':_0x9014b9[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x5e21ee,null))[_0xd4ce('0x30')](removeEntity(_0x5e21ee,null))[_0xd4ce('0x53')](handleError(_0x5e21ee,null));};exports['describe']=function(_0x4ae01b,_0x276424){return db[_0xd4ce('0x3a')][_0xd4ce('0x60')]()['then'](respondWithResult(_0x276424,null))[_0xd4ce('0x53')](handleError(_0x276424,null));};exports['addDisposition']=function(_0x573fc0,_0xd0484a,_0x509452){if(_0x573fc0[_0xd4ce('0x58')]['id']){delete _0x573fc0[_0xd4ce('0x58')]['id'];}return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x573fc0[_0xd4ce('0x54')]['id']}})['then'](handleEntityNotFound(_0xd0484a,null))[_0xd4ce('0x30')](function(_0x2a8636){if(_0x2a8636){_0x573fc0[_0xd4ce('0x58')][_0xd4ce('0x61')]=_0x2a8636['id'];return db[_0xd4ce('0x62')][_0xd4ce('0x57')](_0x573fc0[_0xd4ce('0x58')]);}})['then'](respondWithResult(_0xd0484a,null))[_0xd4ce('0x53')](handleError(_0xd0484a,null));};exports['getDispositions']=function(_0x2589f8,_0x1328a,_0x1a3919){var _0x4b81df={'raw':![],'where':{}};var _0x886b96={};var _0x27bccf={'count':0x0,'rows':[]};return db[_0xd4ce('0x3a')][_0xd4ce('0x63')]({'where':{'id':_0x2589f8[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x1328a,null))[_0xd4ce('0x30')](function(_0x15efa9){if(_0x15efa9){_0x886b96[_0xd4ce('0x3e')]=_[_0xd4ce('0x40')](db['Disposition'][_0xd4ce('0x3b')]);_0x886b96[_0xd4ce('0x3f')]=_[_0xd4ce('0x40')](_0x2589f8[_0xd4ce('0x3f')]);_0x886b96['filters']=_['intersection'](_0x886b96[_0xd4ce('0x3e')],_0x886b96[_0xd4ce('0x3f')]);_0x4b81df[_0xd4ce('0x44')]=_[_0xd4ce('0x42')](_0x886b96['model'],qs[_0xd4ce('0x43')](_0x2589f8[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x4b81df['attributes']=_0x4b81df['attributes'][_0xd4ce('0x55')]?_0x4b81df[_0xd4ce('0x44')]:_0x886b96['model'];if(!_0x2589f8[_0xd4ce('0x3f')][_0xd4ce('0x45')](_0xd4ce('0x46'))){_0x4b81df[_0xd4ce('0x27')]=qs['limit'](_0x2589f8[_0xd4ce('0x3f')]['limit']);_0x4b81df['offset']=qs[_0xd4ce('0x29')](_0x2589f8[_0xd4ce('0x3f')][_0xd4ce('0x29')]);}_0x4b81df[_0xd4ce('0x47')]=qs[_0xd4ce('0x48')](_0x2589f8[_0xd4ce('0x3f')][_0xd4ce('0x48')]);_0x4b81df[_0xd4ce('0x4b')]=qs[_0xd4ce('0x41')](_['pick'](_0x2589f8[_0xd4ce('0x3f')],_0x886b96['filters']));_0x4b81df[_0xd4ce('0x4b')][_0xd4ce('0x61')]=_0x15efa9['id'];if(_0x2589f8[_0xd4ce('0x3f')][_0xd4ce('0x4a')]){_0x4b81df['where']=_['merge'](_0x4b81df[_0xd4ce('0x4b')],{'$or':_[_0xd4ce('0x39')](_0x4b81df[_0xd4ce('0x44')],function(_0x1b6fac){var _0x280f80={};_0x280f80[_0x1b6fac]={'$like':'%'+_0x2589f8['query'][_0xd4ce('0x4a')]+'%'};return _0x280f80;})});}_0x4b81df=_['merge']({},_0x4b81df,_0x2589f8[_0xd4ce('0x56')]);return db[_0xd4ce('0x62')][_0xd4ce('0x28')]({'where':_0x4b81df[_0xd4ce('0x4b')]})[_0xd4ce('0x30')](function(_0x1841bc){_0x27bccf[_0xd4ce('0x28')]=_0x1841bc;if(_0x2589f8[_0xd4ce('0x3f')][_0xd4ce('0x4f')]){_0x4b81df[_0xd4ce('0x50')]=[{'all':!![]}];}return db[_0xd4ce('0x62')][_0xd4ce('0x51')](_0x4b81df);})[_0xd4ce('0x30')](function(_0x3fa88e){_0x27bccf[_0xd4ce('0x52')]=_0x3fa88e;return _0x27bccf;});}})[_0xd4ce('0x30')](respondWithFilteredResult(_0x1328a,_0x4b81df))[_0xd4ce('0x53')](handleError(_0x1328a,null));};exports['removeDispositions']=function(_0x3ca616,_0x5593e9,_0x3b081d){return db[_0xd4ce('0x3a')]['find']({'where':{'id':_0x3ca616[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x5593e9,null))[_0xd4ce('0x30')](function(_0x130d25){if(_0x130d25){return _0x130d25[_0xd4ce('0x64')](_0x3ca616['query']['ids']);}})['then'](respondWithStatusCode(_0x5593e9,null))[_0xd4ce('0x53')](handleError(_0x5593e9,null));};exports[_0xd4ce('0x65')]=function(_0x5f15f6,_0x28a80e,_0x174923){if(_0x5f15f6[_0xd4ce('0x58')]['id']){delete _0x5f15f6[_0xd4ce('0x58')]['id'];}return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x5f15f6[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x28a80e,null))['then'](function(_0x2009f0){if(_0x2009f0){_0x5f15f6[_0xd4ce('0x58')][_0xd4ce('0x61')]=_0x2009f0['id'];return db[_0xd4ce('0x66')][_0xd4ce('0x57')](_0x5f15f6[_0xd4ce('0x58')]);}})[_0xd4ce('0x30')](respondWithResult(_0x28a80e,null))[_0xd4ce('0x53')](handleError(_0x28a80e,null));};exports['getAnswers']=function(_0x5bb562,_0x250368,_0x4ea8a0){var _0x2d1947={'raw':![],'where':{}};var _0x471695={};var _0x501948={'count':0x0,'rows':[]};return db[_0xd4ce('0x3a')]['findOne']({'where':{'id':_0x5bb562['params']['id']}})['then'](handleEntityNotFound(_0x250368,null))['then'](function(_0xd8f8f){if(_0xd8f8f){_0x471695[_0xd4ce('0x3e')]=_[_0xd4ce('0x40')](db[_0xd4ce('0x66')][_0xd4ce('0x3b')]);_0x471695['query']=_['keys'](_0x5bb562['query']);_0x471695[_0xd4ce('0x41')]=_['intersection'](_0x471695[_0xd4ce('0x3e')],_0x471695[_0xd4ce('0x3f')]);_0x2d1947['attributes']=_[_0xd4ce('0x42')](_0x471695['model'],qs[_0xd4ce('0x43')](_0x5bb562[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x2d1947[_0xd4ce('0x44')]=_0x2d1947[_0xd4ce('0x44')][_0xd4ce('0x55')]?_0x2d1947[_0xd4ce('0x44')]:_0x471695[_0xd4ce('0x3e')];if(!_0x5bb562[_0xd4ce('0x3f')][_0xd4ce('0x45')](_0xd4ce('0x46'))){_0x2d1947['limit']=qs['limit'](_0x5bb562[_0xd4ce('0x3f')]['limit']);_0x2d1947['offset']=qs[_0xd4ce('0x29')](_0x5bb562[_0xd4ce('0x3f')][_0xd4ce('0x29')]);}_0x2d1947[_0xd4ce('0x47')]=qs['sort'](_0x5bb562[_0xd4ce('0x3f')]['sort']);_0x2d1947[_0xd4ce('0x4b')]=qs[_0xd4ce('0x41')](_[_0xd4ce('0x49')](_0x5bb562[_0xd4ce('0x3f')],_0x471695[_0xd4ce('0x41')]));_0x2d1947['where'][_0xd4ce('0x61')]=_0xd8f8f['id'];if(_0x5bb562[_0xd4ce('0x3f')][_0xd4ce('0x4a')]){_0x2d1947['where']=_['merge'](_0x2d1947['where'],{'$or':_[_0xd4ce('0x39')](_0x2d1947[_0xd4ce('0x44')],function(_0x5e65ae){var _0x37dd70={};_0x37dd70[_0x5e65ae]={'$like':'%'+_0x5bb562['query'][_0xd4ce('0x4a')]+'%'};return _0x37dd70;})});}_0x2d1947=_['merge']({},_0x2d1947,_0x5bb562[_0xd4ce('0x56')]);return db[_0xd4ce('0x66')]['count']({'where':_0x2d1947[_0xd4ce('0x4b')]})['then'](function(_0x40b642){_0x501948[_0xd4ce('0x28')]=_0x40b642;if(_0x5bb562['query'][_0xd4ce('0x4f')]){_0x2d1947[_0xd4ce('0x50')]=[{'all':!![]}];}return db[_0xd4ce('0x66')]['findAll'](_0x2d1947);})[_0xd4ce('0x30')](function(_0x729efe){_0x501948[_0xd4ce('0x52')]=_0x729efe;return _0x501948;});}})[_0xd4ce('0x30')](respondWithFilteredResult(_0x250368,_0x2d1947))[_0xd4ce('0x53')](handleError(_0x250368,null));};exports[_0xd4ce('0x67')]=function(_0x1b232f,_0x35cfab,_0x1a54d7){return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x1b232f[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x35cfab,null))[_0xd4ce('0x30')](function(_0x28e2cb){if(_0x28e2cb){return _0x28e2cb[_0xd4ce('0x67')](_0x1b232f[_0xd4ce('0x3f')][_0xd4ce('0x68')]);}})['then'](respondWithStatusCode(_0x35cfab,null))[_0xd4ce('0x53')](handleError(_0x35cfab,null));};exports['addLogo']=function(_0x19e939,_0x44ed18,_0xb8783d){_0x19e939[_0xd4ce('0x58')][_0xd4ce('0x69')]=_0x19e939[_0xd4ce('0x6a')][_0xd4ce('0x6b')];return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x19e939[_0xd4ce('0x54')]['id']}})['then'](handleEntityNotFound(_0x44ed18,null))['then'](saveUpdates(_0x19e939[_0xd4ce('0x58')],null))[_0xd4ce('0x30')](respondWithResult(_0x44ed18,null))[_0xd4ce('0x53')](handleError(_0x44ed18,null));};exports['addAvatar']=function(_0x2d5b5e,_0x4d09ee,_0x50baa3){_0x2d5b5e[_0xd4ce('0x58')][_0xd4ce('0x6c')]=_0x2d5b5e[_0xd4ce('0x6a')][_0xd4ce('0x6b')];return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x2d5b5e[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x4d09ee,null))['then'](saveUpdates(_0x2d5b5e[_0xd4ce('0x58')],null))[_0xd4ce('0x30')](respondWithResult(_0x4d09ee,null))[_0xd4ce('0x53')](handleError(_0x4d09ee,null));};exports[_0xd4ce('0x6d')]=function(_0x2bcfcb,_0x835775,_0x34c36f){_0x2bcfcb[_0xd4ce('0x58')][_0xd4ce('0x6e')]=_0x2bcfcb[_0xd4ce('0x6a')][_0xd4ce('0x6b')];return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x2bcfcb[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x835775,null))['then'](saveUpdates(_0x2bcfcb[_0xd4ce('0x58')],null))[_0xd4ce('0x30')](respondWithResult(_0x835775,null))[_0xd4ce('0x53')](handleError(_0x835775,null));};exports[_0xd4ce('0x6f')]=function(_0x58511f,_0x4fa1a3,_0x5ec676){_0x58511f['body'][_0xd4ce('0x70')]=_0x58511f[_0xd4ce('0x6a')][_0xd4ce('0x6b')];return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x58511f[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x4fa1a3,null))[_0xd4ce('0x30')](saveUpdates(_0x58511f[_0xd4ce('0x58')],null))[_0xd4ce('0x30')](respondWithResult(_0x4fa1a3,null))[_0xd4ce('0x53')](handleError(_0x4fa1a3,null));};exports[_0xd4ce('0x71')]=function(_0x51fb6b,_0x9ed20f,_0x39cc0f){var _0x7402aa=path['join'](config[_0xd4ce('0x72')],_0xd4ce('0x73'));var _0x21274={'where':{'id':_0x51fb6b[_0xd4ce('0x54')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3f6d64=![];return require(_0xd4ce('0x14'))['getLicense']()[_0xd4ce('0x30')](function(_0x2bccea){if(_0x2bccea){_0x3f6d64=_0x2bccea[_0xd4ce('0x74')];}})[_0xd4ce('0x30')](function(){return db[_0xd4ce('0x3a')]['find'](_0x21274);})[_0xd4ce('0x30')](handleEntityNotFound(_0x9ed20f,null))[_0xd4ce('0x30')](function(_0x571514){if(_0x571514){if(!_[_0xd4ce('0x75')](_0x571514['sitepic'])){if(fs[_0xd4ce('0x76')](path[_0xd4ce('0x77')](config['root'],_0xd4ce('0x78'),_0x571514[_0xd4ce('0x69')]))&&_0x3f6d64){_0x7402aa=path[_0xd4ce('0x77')](config[_0xd4ce('0x72')],'server/files/images/logos/',_0x571514[_0xd4ce('0x69')]);}}return _0x9ed20f[_0xd4ce('0x79')](_0x7402aa);}})[_0xd4ce('0x53')](handleError(_0x9ed20f,null));};exports[_0xd4ce('0x7a')]=function(_0x245b09,_0x518eaa,_0x673b95){var _0x5ea52b=path[_0xd4ce('0x77')](config[_0xd4ce('0x72')],_0xd4ce('0x7b'));var _0x144765={'where':{'id':_0x245b09[_0xd4ce('0x54')]['id']},'attributes':['id',_0xd4ce('0x6c')],'raw':!![]};return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')](_0x144765)[_0xd4ce('0x30')](handleEntityNotFound(_0x518eaa,null))[_0xd4ce('0x30')](function(_0x58bede){if(_0x58bede){if(!_[_0xd4ce('0x75')](_0x58bede[_0xd4ce('0x6c')])){if(fs[_0xd4ce('0x76')](path[_0xd4ce('0x77')](config['root'],_0xd4ce('0x7c'),_0x58bede['agentAvatar']))){_0x5ea52b=path[_0xd4ce('0x77')](config[_0xd4ce('0x72')],_0xd4ce('0x7c'),_0x58bede[_0xd4ce('0x6c')]);}}return _0x518eaa[_0xd4ce('0x79')](_0x5ea52b);}})[_0xd4ce('0x53')](handleError(_0x518eaa,null));};exports[_0xd4ce('0x7d')]=function(_0x51244e,_0x313689,_0x257bb5){var _0x1ece52=path['join'](config[_0xd4ce('0x72')],_0xd4ce('0x7e'));var _0x4be7ee={'where':{'id':_0x51244e[_0xd4ce('0x54')]['id']},'attributes':['id',_0xd4ce('0x6e'),_0xd4ce('0x7f')],'raw':!![]};return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')](_0x4be7ee)[_0xd4ce('0x30')](handleEntityNotFound(_0x313689,null))[_0xd4ce('0x30')](function(_0x565b9a){if(_0x565b9a){if(!_[_0xd4ce('0x75')](_0x565b9a[_0xd4ce('0x6e')])){if(fs[_0xd4ce('0x76')](path['join'](config[_0xd4ce('0x72')],'server/files/images/avatars/',_0x565b9a[_0xd4ce('0x6e')]))&&_0x565b9a[_0xd4ce('0x7f')]){_0x1ece52=path[_0xd4ce('0x77')](config['root'],'server/files/images/avatars/',_0x565b9a['customerAvatar']);}}return _0x313689['download'](_0x1ece52);}})[_0xd4ce('0x53')](handleError(_0x313689,null));};exports['getSystemAvatar']=function(_0x26db18,_0x25a93b,_0x52ea84){var _0xa7dae8=path[_0xd4ce('0x77')](config[_0xd4ce('0x72')],_0xd4ce('0x80'));var _0x1654af={'where':{'id':_0x26db18[_0xd4ce('0x54')]['id']},'attributes':['id',_0xd4ce('0x70')],'raw':!![]};return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')](_0x1654af)[_0xd4ce('0x30')](handleEntityNotFound(_0x25a93b,null))[_0xd4ce('0x30')](function(_0x2bd889){if(_0x2bd889){if(!_[_0xd4ce('0x75')](_0x2bd889[_0xd4ce('0x70')])){if(fs[_0xd4ce('0x76')](path[_0xd4ce('0x77')](config[_0xd4ce('0x72')],_0xd4ce('0x7c'),_0x2bd889[_0xd4ce('0x70')]))){_0xa7dae8=path[_0xd4ce('0x77')](config[_0xd4ce('0x72')],_0xd4ce('0x7c'),_0x2bd889[_0xd4ce('0x70')]);}}return _0x25a93b[_0xd4ce('0x79')](_0xa7dae8);}})['catch'](handleError(_0x25a93b,null));};exports[_0xd4ce('0x81')]=function(_0x1b7ddf,_0x5cb6fd,_0x5ac113){var _0x23c305=require(_0xd4ce('0x82'));var _0x3a0baf=new _0x23c305();var _0x354b4f=_0x3a0baf[_0xd4ce('0x83')](_0x1b7ddf[_0xd4ce('0x84')][_0xd4ce('0x85')])['getResult']();var _0x365e38={'body':_0x1b7ddf[_0xd4ce('0x58')],'channel':_0xd4ce('0x86')};var _0xace7bf=[];var _0x3f448f=[];var _0x3d7bcc={};var _0x44d0ca=![];return db['CmContact']['describe']()[_0xd4ce('0x30')](function(_0x5de9d9){if(!_0x5de9d9){throw new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))](_0xd4ce('0x89'));}_0xace7bf=_[_0xd4ce('0x8a')](_[_0xd4ce('0x40')](_0x5de9d9),['createdAt',_0xd4ce('0x8b')]);_0x3f448f=_[_0xd4ce('0x8a')](_[_0xd4ce('0x40')](_0x5de9d9),[_0xd4ce('0x8c'),_0xd4ce('0x8b'),'CompanyId',_0xd4ce('0x8d')]);if(_0x1b7ddf[_0xd4ce('0x58')]['id']){delete _0x1b7ddf[_0xd4ce('0x58')]['id'];}if(_[_0xd4ce('0x75')](_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x8e')])){throw new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))](_0xd4ce('0x8f'));}if(_['isNil'](_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x58')])||_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x58')]===''){throw new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd4ce('0x75')](_0x1b7ddf[_0xd4ce('0x58')]['mapKey'])){throw new db[(_0xd4ce('0x87'))]['ValidationError'](_0xd4ce('0x90')+_0x3f448f);}if(!_[_0xd4ce('0x91')](_0x3f448f,_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x92')])){throw new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))](_0xd4ce('0x93')+_0x3f448f);}_0x3d7bcc[_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x92')]]=_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x8e')];})[_0xd4ce('0x30')](function(){return db['ChatWebsite'][_0xd4ce('0x5f')]({'where':{'id':_0x1b7ddf[_0xd4ce('0x54')]['id']},'include':[{'model':db[_0xd4ce('0x94')],'as':'List','include':[{'model':db[_0xd4ce('0x95')],'as':_0xd4ce('0x96'),'where':_0x3d7bcc,'limit':0x1,'order':[[_0xd4ce('0x8b'),_0xd4ce('0x97')]]}]},{'model':db[_0xd4ce('0x98')],'as':_0xd4ce('0x99')}]});})[_0xd4ce('0x30')](handleEntityNotFound(_0x5cb6fd,null))['then'](function(_0x592eb5){if(_0x592eb5&&_0x592eb5[_0xd4ce('0x9a')]){_0x365e38[_0xd4ce('0x9b')]=_0x592eb5;_0x365e38[_0xd4ce('0x9c')]=_0x592eb5['Applications'];_0x365e38[_0xd4ce('0x9d')]=_0x592eb5[_0xd4ce('0x9a')];_0x365e38['applications']=_[_0xd4ce('0x9e')](_0x365e38[_0xd4ce('0x9c')],[_0xd4ce('0x9f')],[_0xd4ce('0xa0')]);if(_0x365e38[_0xd4ce('0x9b')][_0xd4ce('0x99')]){delete _0x365e38[_0xd4ce('0x9b')][_0xd4ce('0x99')];}if(_0x365e38[_0xd4ce('0x9b')][_0xd4ce('0x9a')]&&_0x365e38[_0xd4ce('0x9b')][_0xd4ce('0x9a')][_0xd4ce('0x96')]['length']){return _0x365e38['account'][_0xd4ce('0x9a')]['Contacts'][0x0];}var _0x570a97=_[_0xd4ce('0xa1')](_0x1b7ddf[_0xd4ce('0x58')],{'firstName':_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x8e')],'ListId':_0x592eb5[_0xd4ce('0x8d')]});_0x570a97[_0x1b7ddf['body'][_0xd4ce('0x92')]]=_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x8e')];return db[_0xd4ce('0x95')][_0xd4ce('0x57')](_0x570a97,{'fields':_0xace7bf,'raw':!![]});}})[_0xd4ce('0x30')](handleEntityNotFound(_0x5cb6fd,null))[_0xd4ce('0x30')](function(_0x202547){_0x365e38[_0xd4ce('0xa2')]=_0x202547;var _0x31229c=_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xa3')];if(_0x1b7ddf[_0xd4ce('0x84')]['cf-connecting-ip']){_0x31229c=_0x1b7ddf[_0xd4ce('0x84')][_0xd4ce('0xa4')];}else if(_0x1b7ddf[_0xd4ce('0x84')][_0xd4ce('0xa5')]){_0x31229c=_[_0xd4ce('0xa6')](_0x1b7ddf['headers'][_0xd4ce('0xa5')][_0xd4ce('0xa7')](','));}if(_0x202547){var _0x20b47f={'ContactId':_0x202547['id'],'ChatWebsiteId':_0x1b7ddf['params']['id'],'from':(_0x202547[_0xd4ce('0xa8')]||'')+'\x20'+(_0x202547[_0xd4ce('0xa9')]||''),'customerIp':_0x31229c,'customerPort':_0x1b7ddf[_0xd4ce('0x84')]['x-real-port']?_0x1b7ddf['headers'][_0xd4ce('0xaa')]:null,'referer':_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xab')],'browserName':_0x354b4f[_0xd4ce('0xac')][_0xd4ce('0x34')]&&_0x354b4f['browser'][_0xd4ce('0xad')]?util['format'](_0xd4ce('0xae'),_0x354b4f['browser'][_0xd4ce('0x34')],_0x354b4f[_0xd4ce('0xac')]['version']):_0xd4ce('0xaf'),'browserVersion':_0x354b4f['browser'][_0xd4ce('0xad')]||_0xd4ce('0xaf'),'osName':util[_0xd4ce('0xb0')](_0xd4ce('0xae'),_0x354b4f['os'][_0xd4ce('0x34')],_0x354b4f['os']['version']),'osVersion':_0x354b4f['os'][_0xd4ce('0xad')],'deviceModel':_0x354b4f[_0xd4ce('0xb1')][_0xd4ce('0x3e')]&&_0x354b4f[_0xd4ce('0xb1')][_0xd4ce('0xb2')]?util[_0xd4ce('0xb0')](_0xd4ce('0xb3'),_0x354b4f['device']['model'],_0x354b4f[_0xd4ce('0xb1')]['vendor'],_0x354b4f[_0xd4ce('0xb1')]['type']):null,'deviceVendor':_0x354b4f[_0xd4ce('0xb1')]['vendor'],'deviceType':_0x354b4f[_0xd4ce('0xb1')][_0xd4ce('0x4d')],'formData':JSON['stringify'](_0x1b7ddf[_0xd4ce('0x58')])};var _0x42fece={'ChatWebsiteId':_0x1b7ddf[_0xd4ce('0x54')]['id'],'closed':![]};if(_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xb4')]){_0x42fece[_0xd4ce('0xb4')]=_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xb4')];return db[_0xd4ce('0xb5')][_0xd4ce('0x5f')]({'where':_0x42fece})['then'](function(_0x5e6b56){if(_0x5e6b56){return[_0x5e6b56,![]];}_0x20b47f['threadId']=_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xb4')];_0x20b47f['externalUrl']=_0x1b7ddf['body'][_0xd4ce('0xb6')];return db[_0xd4ce('0xb5')][_0xd4ce('0x57')](_0x20b47f)[_0xd4ce('0x30')](function(_0x540802){return[_0x540802,!![]];});});}_0x42fece[_0xd4ce('0xb7')]=_0x202547['id'];if(_0x1b7ddf['body'][_0xd4ce('0xb8')]&&_0x1b7ddf['body'][_0xd4ce('0xb8')]['id']){_0x42fece['id']=_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xb8')]['id'];return db[_0xd4ce('0xb5')][_0xd4ce('0x5f')]({'where':_0x42fece})[_0xd4ce('0x30')](function(_0x4ce6e2){if(_0x4ce6e2){return[_0x4ce6e2,![]];}return db[_0xd4ce('0xb5')][_0xd4ce('0x57')](_0x20b47f)['then'](function(_0x40ec6c){return[_0x40ec6c,!![]];});});}return db[_0xd4ce('0xb5')]['create'](_0x20b47f)[_0xd4ce('0x30')](function(_0x36b01a){return[_0x36b01a,!![]];});}})['spread'](function(_0x5a9b41,_0x16d114){if(_0x5a9b41){_0x44d0ca=_0x16d114;if(!_0x16d114){var _0x17b21a={'from':(_0x365e38[_0xd4ce('0xa2')][_0xd4ce('0xa8')]||'')+'\x20'+(_0x365e38[_0xd4ce('0xa2')][_0xd4ce('0xa9')]||'')};if(_0x1b7ddf['body'][_0xd4ce('0xb4')]&&_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xb9')]&&_0x1b7ddf['body'][_0xd4ce('0xb4')]!=_0x1b7ddf[_0xd4ce('0x58')]['messageId']){_0x17b21a[_0xd4ce('0xb4')]=_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0xb9')];}return _0x5a9b41[_0xd4ce('0x2f')](_0x17b21a);}else{return _0x5a9b41;}}})[_0xd4ce('0x30')](function(_0x3f1a0d){_0x365e38[_0xd4ce('0xb8')]=_0x3f1a0d[_0xd4ce('0x5a')]({'plain':!![]});_0x365e38['interaction'][_0xd4ce('0xba')]=_0x44d0ca;if(_0x365e38[_0xd4ce('0xb8')]['created']){if(_0x365e38[_0xd4ce('0x9b')][_0xd4ce('0xbb')]){_0x365e38['applications']['push']({'id':0x0,'priority':_0x365e38[_0xd4ce('0x9c')]['length']+0x1,'app':_0xd4ce('0xbc'),'appdata':_0xd4ce('0xbd'),'interval':'*,*,*,*'});}}return db[_0xd4ce('0xbe')][_0xd4ce('0x57')]({'body':_0x1b7ddf[_0xd4ce('0x58')][_0xd4ce('0x58')],'ChatWebsiteId':_0x1b7ddf[_0xd4ce('0x54')]['id'],'ChatInteractionId':_0x3f1a0d['id'],'direction':'in','ContactId':_0x365e38[_0xd4ce('0xa2')]['id'],'AttachmentId':_0x1b7ddf[_0xd4ce('0x58')]['AttachmentId']});})[_0xd4ce('0x30')](function(_0x519757){_0x365e38[_0xd4ce('0x23')]=_0x519757;if(_0x365e38[_0xd4ce('0xb8')]['UserId']){return db[_0xd4ce('0xbf')][_0xd4ce('0x5f')]({'attributes':['id','name'],'where':{'id':_0x365e38[_0xd4ce('0xb8')][_0xd4ce('0xc0')]}})[_0xd4ce('0x30')](function(_0x443847){if(_0x443847){_0x365e38[_0xd4ce('0x9c')][_0xd4ce('0xc1')]({'id':0x0,'priority':0x0,'app':_0xd4ce('0xc2'),'appdata':_0x443847['name']+','+(_0x365e38['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x365e38[_0xd4ce('0xc3')]=!![];}return respondWithRpcPromise(_0xd4ce('0xc4'),'startRouting',_0x365e38);});}return respondWithRpcPromise('Start',_0xd4ce('0xc5'),_0x365e38);})[_0xd4ce('0x30')](function(_0x36f12a){respondWithRpcPromise(_0xd4ce('0xc6'),'EventManager',{'event':_0xd4ce('0x81'),'message':_0x36f12a},client9002);return _0x36f12a;})[_0xd4ce('0x30')](respondWithResult(_0x5cb6fd,null))[_0xd4ce('0x53')](handleError(_0x5cb6fd,null));};exports[_0xd4ce('0xc7')]=function(_0x2117a2,_0x54a642,_0x43c34b){var _0x819a9,_0x1b815a,_0x4dae87;var _0x5d5cb0=[];var _0x249bd8=[];var _0x3d57f5={};var _0x29b065=_0x2117a2[_0xd4ce('0xc8')]||[];var _0x128f6a=[];var _0x18cd9;return db[_0xd4ce('0x95')][_0xd4ce('0x60')]()[_0xd4ce('0x30')](function(_0x3cf1a0){if(!_0x3cf1a0){throw new db[(_0xd4ce('0x87'))]['ValidationError'](_0xd4ce('0x89'));}_0x249bd8=_[_0xd4ce('0x8a')](_[_0xd4ce('0x40')](_0x3cf1a0),['createdAt','updatedAt']);_0x5d5cb0=_['difference'](_['keys'](_0x3cf1a0),[_0xd4ce('0x8c'),'updatedAt','CompanyId',_0xd4ce('0x8d')]);if(_0x2117a2[_0xd4ce('0x58')]['id']){delete _0x2117a2[_0xd4ce('0x58')]['id'];}if(_[_0xd4ce('0x75')](_0x2117a2[_0xd4ce('0x58')][_0xd4ce('0x8e')])){throw _0x54a642['status'](0x1f4)['send'](new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))]('from\x20is\x20mandatory'));}if(_[_0xd4ce('0x75')](_0x2117a2[_0xd4ce('0x58')][_0xd4ce('0x58')])||_0x2117a2[_0xd4ce('0x58')][_0xd4ce('0x58')]===''){throw _0x54a642['status'](0x1f4)[_0xd4ce('0x35')](new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))](_0xd4ce('0xc9')));}if(_[_0xd4ce('0x75')](_0x2117a2['body']['mapKeyOffline'])){throw _0x54a642[_0xd4ce('0x2a')](0x1f4)['send'](new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))](_0xd4ce('0xca')+_0x5d5cb0));}if(!_['includes'](_0x5d5cb0,_0x2117a2['body'][_0xd4ce('0xcb')])){throw _0x54a642[_0xd4ce('0x2a')](0x1f4)['send'](new db[(_0xd4ce('0x87'))][(_0xd4ce('0x88'))](_0xd4ce('0xcc')+_0x5d5cb0));}_0x3d57f5[_0x2117a2[_0xd4ce('0x58')][_0xd4ce('0xcb')]]=_0x2117a2['body'][_0xd4ce('0x8e')];})[_0xd4ce('0x30')](function(){return db[_0xd4ce('0x3a')]['find']({'where':{'id':_0x2117a2[_0xd4ce('0x54')]['id']},'include':[{'model':db[_0xd4ce('0x94')],'as':_0xd4ce('0x9a')},{'model':db[_0xd4ce('0xcd')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x54a642,null))[_0xd4ce('0x30')](function(_0x5e74f6){if(_0x5e74f6&&_0x5e74f6[_0xd4ce('0x9a')]){_0x1b815a=_0x5e74f6;var _0x8e85b5=_[_0xd4ce('0xa1')](_0x2117a2[_0xd4ce('0x58')],{'firstName':_0x2117a2['body'][_0xd4ce('0x8e')],'phone':_0x2117a2[_0xd4ce('0x58')][_0xd4ce('0x8e')],'ListId':_0x5e74f6[_0xd4ce('0x8d')]});_0x8e85b5[_0x2117a2['body'][_0xd4ce('0xcb')]]=_0x2117a2[_0xd4ce('0x58')]['from'];return db[_0xd4ce('0x95')][_0xd4ce('0xce')]({'where':_0x3d57f5,'defaults':_0x8e85b5});}})[_0xd4ce('0xcf')](function(_0x541d0c){if(_0x541d0c){_0x4dae87=_0x541d0c;var _0x1907ad=fs[_0xd4ce('0xd0')](path[_0xd4ce('0x77')](config['root'],_0xd4ce('0xd1')),'utf8');var _0x900046=ejs[_0xd4ce('0xd2')](_0x1907ad,{'body':_[_0xd4ce('0xd3')](_0x2117a2[_0xd4ce('0x58')][_0xd4ce('0x58')]),'bodyTitle':_0x1b815a[_0xd4ce('0xd4')]});return db['ChatOfflineMessage'][_0xd4ce('0x57')]({'body':_0x900046,'ContactId':_0x541d0c['id'],'ChatWebsiteId':_0x1b815a['id']});}})[_0xd4ce('0x30')](function(_0x4663d3){_0x18cd9=_0x4663d3;if(_0x29b065[_0xd4ce('0x55')]){var _0x396ab9=_0x29b065[_0xd4ce('0x39')](function(_0x101a6c){return{'name':_0x101a6c[_0xd4ce('0xd5')],'basename':_0x101a6c['filename'],'type':_0x101a6c['mimetype'],'ChatOfflineMessageId':_0x4663d3['id']};});_0x128f6a=_0x396ab9['map'](_0x551646=>{var _0x542c0f={'filename':_0x551646[_0xd4ce('0x34')],'path':path['join'](config[_0xd4ce('0x72')],_0xd4ce('0xd6'),_0xd4ce('0xc8'),_0xd4ce('0xd7'),_0xd4ce('0xd8'),_0x551646[_0xd4ce('0xd9')])};return _0x542c0f;});if(!_0x1b815a[_0xd4ce('0xda')]){return db[_0xd4ce('0xdb')][_0xd4ce('0xdc')](function(_0x397976){return db[_0xd4ce('0xdd')][_0xd4ce('0xde')](_0x396ab9,{'transaction':_0x397976});});}}})[_0xd4ce('0x30')](function(){if(_0x18cd9){_0x819a9=_0x18cd9;return db[_0xd4ce('0xcd')][_0xd4ce('0x63')]({'where':{'active':!![]},'include':[{'model':db[_0xd4ce('0xdf')],'as':_0xd4ce('0xe0'),'raw':!![]}]});}})['then'](function(_0x1f5788){if(_0x1f5788&&_0x1f5788[_0xd4ce('0xe0')]&&_0x1b815a[_0xd4ce('0xe1')]&&_0x1b815a[_0xd4ce('0xe2')]){var _0x566dae={'tls':{'rejectUnauthorized':![]}};if(_0x1f5788['Smtp'][_0xd4ce('0xe3')]){_0x566dae[_0xd4ce('0xe3')]=_0x1f5788[_0xd4ce('0xe0')][_0xd4ce('0xe3')];}else{_0x566dae[_0xd4ce('0xe4')]=_0x1f5788[_0xd4ce('0xe0')][_0xd4ce('0xe4')];_0x566dae[_0xd4ce('0xe5')]=_0x1f5788[_0xd4ce('0xe0')][_0xd4ce('0xe5')];_0x566dae[_0xd4ce('0xe6')]=_0x1f5788[_0xd4ce('0xe0')][_0xd4ce('0xe6')];}if(_0x1f5788[_0xd4ce('0xe0')]['authentication']){_0x566dae['auth']={'user':_0x1f5788['Smtp'][_0xd4ce('0x59')],'pass':_0x1f5788[_0xd4ce('0xe0')][_0xd4ce('0xe7')]};}return respondWithRpcPromise(_0xd4ce('0xe8'),'sendMail',{'account':_0x566dae,'message':{'from':util[_0xd4ce('0xb0')](_0xd4ce('0xe9'),_0x1f5788['name'],_0x1f5788[_0xd4ce('0xea')]||_0x1f5788[_0xd4ce('0xe0')][_0xd4ce('0x59')]),'to':_0x1b815a[_0xd4ce('0xe2')],'subject':_0x1b815a['offlineMessageSubject'],'html':_0x819a9['body'],'attachments':_0x128f6a}},client9003)['then'](function(){return _0x819a9;})[_0xd4ce('0x53')](function(_0x617250){console['error'](_0x617250);});}})[_0xd4ce('0x30')](function(){if(_0x1b815a&&_0x1b815a[_0xd4ce('0xda')]&&_0x1b815a[_0xd4ce('0xeb')]){var _0x2c0a81=[];if(_0x29b065[_0xd4ce('0x55')]){_0x2c0a81=_0x29b065[_0xd4ce('0x39')](function(_0x5a2733){return{'name':_0x5a2733['originalname'],'basename':_0x5a2733[_0xd4ce('0x6b')],'type':_0x5a2733[_0xd4ce('0xec')],'ChatOfflineMessageId':_0x18cd9['id']};});}var _0x37db92;if(!_[_0xd4ce('0x75')](_0x1b815a[_0xd4ce('0xed')])){var _0x3ec821=_[_0xd4ce('0x39')](_0x2117a2['body'],function(_0x4b293b){return _0x4b293b;});var _0x2b7ff6=_['toPairsIn'](_0x3ec821)[0x0];var _0x18286c=_[_0xd4ce('0xee')](_0x2b7ff6,function(_0x296dc8){return _0x296dc8;});_0x37db92=_0x18286c[0x1][_0x1b815a[_0xd4ce('0xed')]];}var _0x37870f={'from':_0x4dae87[_0xd4ce('0xea')],'firstName':_0x4dae87[_0xd4ce('0xa8')],'lastName':_0x4dae87[_0xd4ce('0xa9')],'mapKey':'email','message':{'from':_0x4dae87[_0xd4ce('0xea')],'to':_0x1b815a['MailAccount'][_0xd4ce('0xea')],'cc':'','subject':_[_0xd4ce('0x75')](_0x37db92)?_0x1b815a['offlineMessageSubject']:_0x37db92,'messageId':'','sentAt':new Date(),'attach':_0x2c0a81[_0xd4ce('0x55')],'attachments':_0x2c0a81,'originChannel':'Chat','ChatWebsiteId':_0x1b815a['id'],'ChatOfflineMessageId':_0x819a9['id'],'originTo':_0x1b815a[_0xd4ce('0xcd')][_0xd4ce('0xea')]},'body':_0x819a9[_0xd4ce('0x58')]};var _0x5a78e4={'account':{'id':_0x1b815a[_0xd4ce('0xeb')]},'body':_0x37870f,'log':_0xd4ce('0xef')};return respondWithRpcPromise(_0xd4ce('0xef'),_0xd4ce('0xf0'),_0x5a78e4,client9001)['then'](function(){return _0x819a9;})['catch'](function(_0x4971cd){console['error'](_0x4971cd);});}return;})[_0xd4ce('0x30')](function(){if(_0x819a9){return _0x819a9;}})[_0xd4ce('0x30')](respondWithResult(_0x54a642,null))['catch'](function(_0x2e4092){console['error'](_0xd4ce('0x53'),_0x2e4092);for(var _0xb98274 of _0x29b065){var _0x415bfe=path['join'](config[_0xd4ce('0x72')],_0xd4ce('0xd6'),'files',_0xd4ce('0xd7'),'offline-chat',_0xb98274['filename']);fs_extra[_0xd4ce('0xf1')](_0x415bfe)[_0xd4ce('0x53')](function(_0x152b83){console[_0xd4ce('0x21')](_0xd4ce('0xf2'),_0x415bfe,_0x152b83);});}});};exports[_0xd4ce('0xf3')]=function(_0x23dc34,_0x2db601,_0x8d91e9){return db[_0xd4ce('0xb5')][_0xd4ce('0x5f')]({'where':{'id':_0x23dc34['params']['id']}})['then'](handleEntityNotFound(_0x2db601,null))[_0xd4ce('0x30')](function(_0x355e72){if(_0x355e72){return _0x355e72[_0xd4ce('0xf3')](_0x23dc34['body'][_0xd4ce('0x68')],_[_0xd4ce('0xf4')](_0x23dc34[_0xd4ce('0x58')],[_0xd4ce('0x68'),'id'])||{});}})[_0xd4ce('0x30')](respondWithResult(_0x2db601,null))[_0xd4ce('0x53')](handleError(_0x2db601,null));};exports[_0xd4ce('0xf5')]=function(_0x2be085,_0x40f0b8,_0x921239){var _0x33713e={'raw':![],'where':{}};var _0x38a96c={};var _0x24dd51={'count':0x0,'rows':[]};return db[_0xd4ce('0x3a')][_0xd4ce('0x63')]({'where':{'id':_0x2be085['params']['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x40f0b8,null))[_0xd4ce('0x30')](function(_0xa1d65e){if(_0xa1d65e){_0x38a96c[_0xd4ce('0x3e')]=_[_0xd4ce('0x40')](db[_0xd4ce('0xb5')][_0xd4ce('0x3b')]);_0x38a96c[_0xd4ce('0x3f')]=_['keys'](_0x2be085['query']);_0x38a96c[_0xd4ce('0x41')]=_['intersection'](_0x38a96c['model'],_0x38a96c[_0xd4ce('0x3f')]);_0x33713e['attributes']=_[_0xd4ce('0x42')](_0x38a96c[_0xd4ce('0x3e')],qs[_0xd4ce('0x43')](_0x2be085[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x33713e[_0xd4ce('0x44')]=_0x33713e['attributes']['length']?_0x33713e[_0xd4ce('0x44')]:_0x38a96c['model'];if(!_0x2be085[_0xd4ce('0x3f')]['hasOwnProperty']('nolimit')){_0x33713e['limit']=qs[_0xd4ce('0x27')](_0x2be085[_0xd4ce('0x3f')][_0xd4ce('0x27')]);_0x33713e[_0xd4ce('0x29')]=qs[_0xd4ce('0x29')](_0x2be085['query']['offset']);}_0x33713e[_0xd4ce('0x47')]=qs[_0xd4ce('0x48')](_0x2be085['query'][_0xd4ce('0x48')]);_0x33713e[_0xd4ce('0x4b')]=qs[_0xd4ce('0x41')](_['pick'](_0x2be085[_0xd4ce('0x3f')],_0x38a96c['filters']));_0x33713e['where'][_0xd4ce('0x61')]=_0xa1d65e['id'];if(_0x2be085['query'][_0xd4ce('0x4a')]){_0x33713e[_0xd4ce('0x4b')]=_['merge'](_0x33713e[_0xd4ce('0x4b')],{'$or':_[_0xd4ce('0x39')](_0x33713e['attributes'],function(_0x4d30e5){var _0x2d4551={};_0x2d4551[_0x4d30e5]={'$like':'%'+_0x2be085['query'][_0xd4ce('0x4a')]+'%'};return _0x2d4551;})});}_0x33713e=_[_0xd4ce('0x4c')]({},_0x33713e,_0x2be085['options']);return db[_0xd4ce('0xb5')][_0xd4ce('0x28')]({'where':_0x33713e[_0xd4ce('0x4b')]})['then'](function(_0x84e9a){_0x24dd51[_0xd4ce('0x28')]=_0x84e9a;if(_0x2be085['query'][_0xd4ce('0x4f')]){_0x33713e[_0xd4ce('0x50')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd4ce('0xbf')],'as':_0xd4ce('0xf6'),'attributes':[_0xd4ce('0x34'),_0xd4ce('0xf7'),'internal'],'required':![]},{'model':db[_0xd4ce('0xf8')],'as':'Tags','attributes':['id',_0xd4ce('0x34'),_0xd4ce('0xf9')],'where':_0x2be085[_0xd4ce('0x3f')]['tag']?{'id':_0x2be085['query'][_0xd4ce('0xfa')]}:undefined,'required':_0x2be085['query'][_0xd4ce('0xfa')]?!![]:![]}];}return db[_0xd4ce('0xb5')]['findAll'](_0x33713e);})[_0xd4ce('0x30')](function(_0x5accc5){_0x24dd51['rows']=_0x5accc5;return _0x24dd51;});}})[_0xd4ce('0x30')](respondWithFilteredResult(_0x40f0b8,_0x33713e))['catch'](handleError(_0x40f0b8,null));};function iftimePromise(_0x91795a,_0x369d42){return respondWithRpcPromise(_0xd4ce('0xfb'),_0xd4ce('0xfc'),{'command':_0x369d42[_0xd4ce('0xfd')]?util[_0xd4ce('0xb0')](_0xd4ce('0xfe'),_0x91795a[_0xd4ce('0xff')],_0x369d42['timezone']):util[_0xd4ce('0xb0')](_0xd4ce('0x100'),_0x91795a[_0xd4ce('0xff')])},client9002)['then'](function(_0x2f22b4){var _0xaa2a48=_0x2f22b4&&_0x2f22b4['indexOf']('true')>=0x0?!![]:![];logger[_0xd4ce('0x1c')](_0xd4ce('0x101'),_0x369d42['id'],_0x91795a['id'],_0x91795a['interval'],_0xaa2a48?_0xd4ce('0x102'):'OFFLINE',_0x369d42[_0xd4ce('0xfd')]?_0x369d42[_0xd4ce('0xfd')]:_0xd4ce('0x103'));return _0xaa2a48;})[_0xd4ce('0x53')](function(_0xdd3d5a){logger[_0xd4ce('0x21')](_0xd4ce('0x101'),_0x369d42['id'],_0x91795a['id'],_0x91795a['interval'],util[_0xd4ce('0x104')](_0xdd3d5a,{'showHidden':![],'depth':null}),_0x369d42[_0xd4ce('0xfd')]?_0x369d42[_0xd4ce('0xfd')]:_0xd4ce('0x103'));return![];});}exports[_0xd4ce('0xfc')]=function(_0x4862f5,_0x2765ff,_0x1962d){var _0x35442f=0x0;var _0x405fb6=0x0;var _0x13e67a=![];var _0x484f3b;var _0x4ec70d;return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x4862f5[_0xd4ce('0x54')]['id']},'include':[{'model':db[_0xd4ce('0x105')],'as':_0xd4ce('0x105'),'include':[{'model':db[_0xd4ce('0x105')],'as':_0xd4ce('0x106'),'attributes':['id',_0xd4ce('0xff')],'raw':!![]}]}]})[_0xd4ce('0x30')](handleEntityNotFound(_0x2765ff,null))[_0xd4ce('0x30')](function(_0x16eeed){if(_0x16eeed){_0x484f3b=_0x16eeed;return _0x16eeed[_0xd4ce('0x107')]({'raw':!![]});}})['then'](function(_0xb033a2){if(_0x484f3b){if(_0xb033a2){_0x4ec70d=_0xb033a2;}}return require('../../config/license/util')[_0xd4ce('0x108')]();})['then'](function(_0x5c1ba3){if(_0x5c1ba3){_0x405fb6=_0x5c1ba3[_0xd4ce('0x109')];_0x13e67a=_0x5c1ba3['custom'];}})[_0xd4ce('0x30')](function(){return db[_0xd4ce('0xb5')]['count']({'where':{'closed':![]}});})[_0xd4ce('0x30')](function(_0x45f40a){_0x35442f=_0x45f40a;if(_0x405fb6&&_0x45f40a>_0x405fb6){return db[_0xd4ce('0x10a')][_0xd4ce('0x63')]({'where':{'id':0x1}})['then'](function(_0x226df4){if(_0x226df4){_0x226df4['increment'](_0xd4ce('0x10b'));}});}})['then'](function(){if(_0x484f3b['Interval']&&_0x484f3b['Interval'][_0xd4ce('0x106')]){var _0x925878=[];for(var _0x1fc5fc=0x0;_0x1fc5fc<_0x484f3b[_0xd4ce('0x105')][_0xd4ce('0x106')][_0xd4ce('0x55')];_0x1fc5fc++){var _0x3542d4=_0x484f3b['Interval'][_0xd4ce('0x106')][_0x1fc5fc][_0xd4ce('0x5a')]({'plain':!![]});_0x925878[_0xd4ce('0x10c')](iftimePromise(_0x3542d4,_0x484f3b));}return BPromise['all'](_0x925878)[_0xd4ce('0x30')](function(_0x3fcb35){return _[_0xd4ce('0x10d')](_0x3fcb35);});}else{return!![];}})[_0xd4ce('0x30')](function(_0x26dafb){var _0x35b356=fs[_0xd4ce('0xd0')](path[_0xd4ce('0x77')](config[_0xd4ce('0x72')],'server/files/chat/iframe.ejs'),'utf8');var _0x1b26bd={'remote':_0x484f3b[_0xd4ce('0x10e')],'query':querystring[_0xd4ce('0x20')](_[_0xd4ce('0x4c')](_0x484f3b[_0xd4ce('0x5a')]({'plain':!![]}),{'customerIp':_0x4862f5[_0xd4ce('0x84')][_0xd4ce('0xa5')]||_0x4862f5[_0xd4ce('0x84')][_0xd4ce('0x10f')]||_0x4862f5['connection']['remoteAddress']||_0x4862f5['ip'],'referer':_0x4862f5[_0xd4ce('0x84')][_0xd4ce('0xab')],'openedInteractions':_0x35442f,'maxInteractions':_0x405fb6,'virtual':_0x13e67a['virtual'],'online':_0x26dafb,'custom':_0x13e67a}))['replace'](/'/g,'\x5c\x27')};_0x2765ff[_0xd4ce('0x35')](ejs['render'](Mustache['render'](_0x35b356,_0x1b26bd),{'proactiveActions':_0x4ec70d,'alignment':_0x484f3b['alignment'],'verticalAlignment':_0x484f3b[_0xd4ce('0x110')],'div_color':_0x484f3b[_0xd4ce('0xf9')],'text_color':_0x484f3b[_0xd4ce('0x111')],'button_color':_0x484f3b[_0xd4ce('0x112')],'background_color':_0x484f3b[_0xd4ce('0x113')]}));})[_0xd4ce('0x53')](handleError(_0x2765ff,null));};exports[_0xd4ce('0x114')]=function(_0x14c2bc,_0x128878,_0x204206){return db['ChatWebsite'][_0xd4ce('0x63')]({'where':{'id':_0x14c2bc['params']['id']}})['then'](handleEntityNotFound(_0x128878,null))['then'](function(_0x18d549){if(_0x18d549){return db[_0xd4ce('0xdb')][_0xd4ce('0xdc')](function(_0x297856){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x14c2bc[_0xd4ce('0x54')]['id']},'transaction':_0x297856})[_0xd4ce('0x30')](function(_0x192a70){var _0x1728dc=_[_0xd4ce('0x39')](_0x14c2bc[_0xd4ce('0x58')],function(_0x4f6208){_0x4f6208[_0xd4ce('0x61')]=_0x14c2bc[_0xd4ce('0x54')]['id'];return _0x4f6208;});return db[_0xd4ce('0x98')][_0xd4ce('0xde')](_0x1728dc,{'transaction':_0x297856});});})['then'](function(){return db[_0xd4ce('0x98')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x14c2bc[_0xd4ce('0x54')]['id']},'order':_0xd4ce('0x9f')});});}})[_0xd4ce('0x30')](respondWithResult(_0x128878,null))['catch'](handleError(_0x128878,null));};exports[_0xd4ce('0x115')]=function(_0x2fa51d,_0x9c8bad,_0xf587a2){var _0x4fdc08={};var _0x206edb={};var _0xbfec28;var _0x2cef63;return db[_0xd4ce('0x3a')][_0xd4ce('0x63')]({'where':{'id':_0x2fa51d['params']['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x9c8bad,null))['then'](function(_0xc8905e){if(_0xc8905e){_0xbfec28=_0xc8905e;_0x206edb['model']=_[_0xd4ce('0x40')](db[_0xd4ce('0x98')][_0xd4ce('0x3b')]);_0x206edb['query']=_['keys'](_0x2fa51d[_0xd4ce('0x3f')]);_0x206edb[_0xd4ce('0x41')]=_[_0xd4ce('0x42')](_0x206edb[_0xd4ce('0x3e')],_0x206edb['query']);_0x4fdc08['attributes']=_[_0xd4ce('0x42')](_0x206edb[_0xd4ce('0x3e')],qs['fields'](_0x2fa51d[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x4fdc08['attributes']=_0x4fdc08[_0xd4ce('0x44')][_0xd4ce('0x55')]?_0x4fdc08['attributes']:_0x206edb[_0xd4ce('0x3e')];_0x4fdc08[_0xd4ce('0x47')]=qs[_0xd4ce('0x48')](_0x2fa51d[_0xd4ce('0x3f')][_0xd4ce('0x48')]);_0x4fdc08[_0xd4ce('0x4b')]=qs[_0xd4ce('0x41')](_[_0xd4ce('0x49')](_0x2fa51d[_0xd4ce('0x3f')],_0x206edb[_0xd4ce('0x41')]));if(_0x2fa51d['query'][_0xd4ce('0x4a')]){_0x4fdc08['where']=_[_0xd4ce('0x4c')](_0x4fdc08[_0xd4ce('0x4b')],{'$or':_[_0xd4ce('0x39')](_0x4fdc08[_0xd4ce('0x44')],function(_0x5eba38){var _0x4f2e31={};_0x4f2e31[_0x5eba38]={'$like':'%'+_0x2fa51d[_0xd4ce('0x3f')]['filter']+'%'};return _0x4f2e31;})});}_0x4fdc08=_[_0xd4ce('0x4c')]({},_0x4fdc08,_0x2fa51d['options']);return _0xbfec28[_0xd4ce('0x115')](_0x4fdc08);}})['then'](function(_0x29e914){if(_0x29e914){_0x2cef63=_0x29e914['length'];if(!_0x2fa51d[_0xd4ce('0x3f')][_0xd4ce('0x45')](_0xd4ce('0x46'))){_0x4fdc08[_0xd4ce('0x27')]=qs[_0xd4ce('0x27')](_0x2fa51d[_0xd4ce('0x3f')][_0xd4ce('0x27')]);_0x4fdc08[_0xd4ce('0x29')]=qs[_0xd4ce('0x29')](_0x2fa51d[_0xd4ce('0x3f')][_0xd4ce('0x29')]);}return _0xbfec28[_0xd4ce('0x115')](_0x4fdc08);}})[_0xd4ce('0x30')](function(_0x1b6b10){if(_0x1b6b10){return _0x1b6b10?{'count':_0x2cef63,'rows':_0x1b6b10}:null;}})[_0xd4ce('0x30')](respondWithResult(_0x9c8bad,null))[_0xd4ce('0x53')](handleError(_0x9c8bad,null));};exports['addProactiveActions']=function(_0x1fa49d,_0x352620,_0x316f57){return db['chatProactiveAction'][_0xd4ce('0x5f')]({'where':{'id':_0x1fa49d[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x352620,null))[_0xd4ce('0x30')](function(_0x4f189d){if(_0x4f189d){return _0x4f189d[_0xd4ce('0x116')](_0x1fa49d['body']['ids'],_[_0xd4ce('0xf4')](_0x1fa49d[_0xd4ce('0x58')],[_0xd4ce('0x68'),'id'])||{});}})[_0xd4ce('0x30')](respondWithResult(_0x352620,null))[_0xd4ce('0x53')](handleError(_0x352620,null));};exports[_0xd4ce('0x107')]=function(_0x5ca03b,_0x3ea85b,_0x4cd184){var _0xcc2916={};var _0xc28c45={};var _0x2ef9d4;var _0x31be21;return db[_0xd4ce('0x3a')]['findOne']({'where':{'id':_0x5ca03b[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x3ea85b,null))[_0xd4ce('0x30')](function(_0x55f1f7){if(_0x55f1f7){_0x2ef9d4=_0x55f1f7;_0xc28c45[_0xd4ce('0x3e')]=_[_0xd4ce('0x40')](db[_0xd4ce('0x117')][_0xd4ce('0x3b')]);_0xc28c45[_0xd4ce('0x3f')]=_[_0xd4ce('0x40')](_0x5ca03b[_0xd4ce('0x3f')]);_0xc28c45['filters']=_[_0xd4ce('0x42')](_0xc28c45['model'],_0xc28c45['query']);_0xcc2916['attributes']=_['intersection'](_0xc28c45[_0xd4ce('0x3e')],qs[_0xd4ce('0x43')](_0x5ca03b[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0xcc2916['attributes']=_0xcc2916[_0xd4ce('0x44')][_0xd4ce('0x55')]?_0xcc2916[_0xd4ce('0x44')]:_0xc28c45[_0xd4ce('0x3e')];_0xcc2916[_0xd4ce('0x47')]=qs[_0xd4ce('0x48')](_0x5ca03b[_0xd4ce('0x3f')][_0xd4ce('0x48')]);_0xcc2916[_0xd4ce('0x4b')]=qs['filters'](_[_0xd4ce('0x49')](_0x5ca03b[_0xd4ce('0x3f')],_0xc28c45[_0xd4ce('0x41')]));if(_0x5ca03b[_0xd4ce('0x3f')][_0xd4ce('0x4a')]){_0xcc2916[_0xd4ce('0x4b')]=_['merge'](_0xcc2916[_0xd4ce('0x4b')],{'$or':_[_0xd4ce('0x39')](_0xcc2916[_0xd4ce('0x44')],function(_0x36e276){var _0x480659={};_0x480659[_0x36e276]={'$like':'%'+_0x5ca03b[_0xd4ce('0x3f')][_0xd4ce('0x4a')]+'%'};return _0x480659;})});}_0xcc2916=_[_0xd4ce('0x4c')]({},_0xcc2916,_0x5ca03b[_0xd4ce('0x56')]);return _0x2ef9d4[_0xd4ce('0x107')](_0xcc2916);}})[_0xd4ce('0x30')](function(_0xaa7216){if(_0xaa7216){_0x31be21=_0xaa7216[_0xd4ce('0x55')];if(!_0x5ca03b[_0xd4ce('0x3f')][_0xd4ce('0x45')](_0xd4ce('0x46'))){_0xcc2916[_0xd4ce('0x27')]=qs[_0xd4ce('0x27')](_0x5ca03b[_0xd4ce('0x3f')][_0xd4ce('0x27')]);_0xcc2916[_0xd4ce('0x29')]=qs[_0xd4ce('0x29')](_0x5ca03b['query'][_0xd4ce('0x29')]);}return _0x2ef9d4[_0xd4ce('0x107')](_0xcc2916);}})[_0xd4ce('0x30')](function(_0x3b18b4){if(_0x3b18b4){return _0x3b18b4?{'count':_0x31be21,'rows':_0x3b18b4}:null;}})[_0xd4ce('0x30')](respondWithResult(_0x3ea85b,null))[_0xd4ce('0x53')](handleError(_0x3ea85b,null));};exports[_0xd4ce('0x118')]=function(_0x341388,_0x3e6701,_0x928c22){var _0x3db495=_0x341388['query'][_0xd4ce('0x119')]===_0xd4ce('0x11a')?_0xd4ce('0x11b'):_0xd4ce('0x11c');return db['ChatWebsite'][_0xd4ce('0x5f')]({'attributes':['id',_0x3db495],'where':{'id':_0x341388['params']['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x3e6701,null))[_0xd4ce('0x30')](function(_0x2f3f02){if(_0x2f3f02){var _0x4adf70=_0x2f3f02[_0x3db495];var _0x312b18=_0x4adf70&&_0x4adf70[_0xd4ce('0x11d')]?_0x4adf70['items']:[];_0x3e6701['send']({'fromKey':_[_0xd4ce('0x75')](_0x4adf70['fromKey'])?undefined:_0x4adf70[_0xd4ce('0x11e')],'count':_0x312b18[_0xd4ce('0x55')],'rows':_0x312b18});}})[_0xd4ce('0x53')](handleError(_0x3e6701,null));};exports[_0xd4ce('0x11f')]=function(_0x148831,_0x23d499,_0x3c00ca){var _0x494a76={'raw':![],'where':{}};var _0x3c6b8b={};var _0x18d448={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd4ce('0x63')]({'where':{'id':_0x148831[_0xd4ce('0x54')]['id']}})['then'](handleEntityNotFound(_0x23d499,null))[_0xd4ce('0x30')](function(_0x16e53e){if(_0x16e53e){_0x3c6b8b[_0xd4ce('0x3e')]=_[_0xd4ce('0x40')](db[_0xd4ce('0x120')][_0xd4ce('0x3b')]);_0x3c6b8b['query']=_[_0xd4ce('0x40')](_0x148831[_0xd4ce('0x3f')]);_0x3c6b8b[_0xd4ce('0x41')]=_['intersection'](_0x3c6b8b[_0xd4ce('0x3e')],_0x3c6b8b['query']);_0x494a76[_0xd4ce('0x44')]=_['intersection'](_0x3c6b8b[_0xd4ce('0x3e')],qs['fields'](_0x148831[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x494a76[_0xd4ce('0x44')]=_0x494a76[_0xd4ce('0x44')]['length']?_0x494a76[_0xd4ce('0x44')]:_0x3c6b8b[_0xd4ce('0x3e')];if(!_0x148831[_0xd4ce('0x3f')][_0xd4ce('0x45')](_0xd4ce('0x46'))){_0x494a76[_0xd4ce('0x27')]=qs[_0xd4ce('0x27')](_0x148831[_0xd4ce('0x3f')]['limit']);_0x494a76[_0xd4ce('0x29')]=qs['offset'](_0x148831[_0xd4ce('0x3f')]['offset']);}_0x494a76[_0xd4ce('0x47')]=qs[_0xd4ce('0x48')](_0x148831['query'][_0xd4ce('0x48')]);_0x494a76[_0xd4ce('0x4b')]=qs[_0xd4ce('0x41')](_[_0xd4ce('0x49')](_0x148831[_0xd4ce('0x3f')],_0x3c6b8b[_0xd4ce('0x41')]));_0x494a76[_0xd4ce('0x4b')][_0xd4ce('0x61')]=_0x16e53e['id'];if(_0x148831[_0xd4ce('0x3f')][_0xd4ce('0x4a')]){_0x494a76[_0xd4ce('0x4b')]=_['merge'](_0x494a76[_0xd4ce('0x4b')],{'$or':_[_0xd4ce('0x39')](_0x494a76[_0xd4ce('0x44')],function(_0xf3baa6){var _0x4abe55={};_0x4abe55[_0xf3baa6]={'$like':'%'+_0x148831['query'][_0xd4ce('0x4a')]+'%'};return _0x4abe55;})});}_0x494a76=_[_0xd4ce('0x4c')]({},_0x494a76,_0x148831[_0xd4ce('0x56')]);return db[_0xd4ce('0x120')]['count']({'where':_0x494a76[_0xd4ce('0x4b')]})[_0xd4ce('0x30')](function(_0x1a4cef){_0x18d448[_0xd4ce('0x28')]=_0x1a4cef;if(_0x148831[_0xd4ce('0x3f')][_0xd4ce('0x4f')]){_0x494a76[_0xd4ce('0x50')]=[{'all':!![]}];}else{_0x494a76['include']=[{'model':db[_0xd4ce('0x95')],'as':_0xd4ce('0x121'),'required':![]},{'model':db[_0xd4ce('0xdd')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x494a76);})[_0xd4ce('0x30')](function(_0x2a7ffc){_0x18d448[_0xd4ce('0x52')]=_0x2a7ffc;return _0x18d448;});}})[_0xd4ce('0x30')](respondWithFilteredResult(_0x23d499,_0x494a76))[_0xd4ce('0x53')](handleError(_0x23d499,null));};exports[_0xd4ce('0x122')]=function(_0x25941b,_0x2410ee,_0x238c23){return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x25941b[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x2410ee,null))['then'](function(_0x29ea1f){if(_0x29ea1f){return _0x29ea1f[_0xd4ce('0x122')](_0x25941b[_0xd4ce('0x58')][_0xd4ce('0x68')],_[_0xd4ce('0xf4')](_0x25941b[_0xd4ce('0x58')],[_0xd4ce('0x68'),'id'])||{})[_0xd4ce('0xcf')](function(_0x325c78){for(var _0x3eaed1=0x0;_0x3eaed1<_0x25941b['body'][_0xd4ce('0x68')][_0xd4ce('0x55')];_0x3eaed1+=0x1){socket['emit'](_0xd4ce('0x123'),{'UserId':Number(_0x25941b[_0xd4ce('0x58')]['ids'][_0x3eaed1]),'ChatWebsiteId':Number(_0x25941b['params']['id'])});}return _0x325c78;});}})['then'](respondWithResult(_0x2410ee,null))['catch'](handleError(_0x2410ee,null));};exports[_0xd4ce('0x124')]=function(_0x199fbf,_0x261020,_0x2be6e9){return db[_0xd4ce('0x3a')][_0xd4ce('0x5f')]({'where':{'id':_0x199fbf['params']['id']}})['then'](handleEntityNotFound(_0x261020,null))[_0xd4ce('0x30')](function(_0x1a8fa6){if(_0x1a8fa6){return _0x1a8fa6['removeAgents'](_0x199fbf[_0xd4ce('0x3f')]['ids'])[_0xd4ce('0x30')](function(){if(_['isArray'](_0x199fbf[_0xd4ce('0x3f')]['ids'])){for(var _0x108a4a=0x0;_0x108a4a<_0x199fbf[_0xd4ce('0x3f')][_0xd4ce('0x68')][_0xd4ce('0x55')];_0x108a4a+=0x1){socket[_0xd4ce('0x125')]('userChatWebsite:remove',{'UserId':Number(_0x199fbf['query'][_0xd4ce('0x68')][_0x108a4a]),'ChatWebsiteId':Number(_0x199fbf[_0xd4ce('0x54')]['id'])});}}else{socket['emit'](_0xd4ce('0x126'),{'UserId':Number(_0x199fbf[_0xd4ce('0x3f')]['ids']),'ChatWebsiteId':Number(_0x199fbf[_0xd4ce('0x54')]['id'])});}});}})[_0xd4ce('0x30')](respondWithStatusCode(_0x261020,null))['catch'](handleError(_0x261020,null));};exports['getAgents']=function(_0x46bc64,_0x4b1fcc,_0x348c6c){var _0x35b9c5={};var _0x328e84={};var _0x47c9a3;var _0x43e13f;return db[_0xd4ce('0x3a')][_0xd4ce('0x63')]({'where':{'id':_0x46bc64[_0xd4ce('0x54')]['id']}})[_0xd4ce('0x30')](handleEntityNotFound(_0x4b1fcc,null))['then'](function(_0x34b470){if(_0x34b470){_0x47c9a3=_0x34b470;_0x328e84[_0xd4ce('0x3e')]=_['keys'](db[_0xd4ce('0xbf')]['rawAttributes']);_0x328e84[_0xd4ce('0x3f')]=_['keys'](_0x46bc64['query']);_0x328e84['filters']=_[_0xd4ce('0x42')](_0x328e84[_0xd4ce('0x3e')],_0x328e84['query']);_0x35b9c5['attributes']=_[_0xd4ce('0x42')](_0x328e84[_0xd4ce('0x3e')],qs[_0xd4ce('0x43')](_0x46bc64[_0xd4ce('0x3f')][_0xd4ce('0x43')]));_0x35b9c5[_0xd4ce('0x44')]=_0x35b9c5[_0xd4ce('0x44')][_0xd4ce('0x55')]?_0x35b9c5[_0xd4ce('0x44')]:_0x328e84[_0xd4ce('0x3e')];_0x35b9c5[_0xd4ce('0x47')]=qs['sort'](_0x46bc64[_0xd4ce('0x3f')][_0xd4ce('0x48')]);_0x35b9c5[_0xd4ce('0x4b')]=qs[_0xd4ce('0x41')](_[_0xd4ce('0x49')](_0x46bc64[_0xd4ce('0x3f')],_0x328e84[_0xd4ce('0x41')]));if(_0x46bc64[_0xd4ce('0x3f')][_0xd4ce('0x4a')]){_0x35b9c5['where']=_[_0xd4ce('0x4c')](_0x35b9c5[_0xd4ce('0x4b')],{'$or':_['map'](_0x35b9c5[_0xd4ce('0x44')],function(_0xf372b){var _0x213575={};_0x213575[_0xf372b]={'$like':'%'+_0x46bc64[_0xd4ce('0x3f')][_0xd4ce('0x4a')]+'%'};return _0x213575;})});}_0x35b9c5=_[_0xd4ce('0x4c')]({},_0x35b9c5,_0x46bc64[_0xd4ce('0x56')]);return _0x47c9a3[_0xd4ce('0x127')](_0x35b9c5);}})[_0xd4ce('0x30')](function(_0x2f0e54){if(_0x2f0e54){_0x43e13f=_0x2f0e54[_0xd4ce('0x55')];if(!_0x46bc64[_0xd4ce('0x3f')]['hasOwnProperty'](_0xd4ce('0x46'))){_0x35b9c5[_0xd4ce('0x27')]=qs[_0xd4ce('0x27')](_0x46bc64[_0xd4ce('0x3f')][_0xd4ce('0x27')]);_0x35b9c5['offset']=qs[_0xd4ce('0x29')](_0x46bc64[_0xd4ce('0x3f')][_0xd4ce('0x29')]);}return _0x47c9a3[_0xd4ce('0x127')](_0x35b9c5);}})[_0xd4ce('0x30')](function(_0x39832a){if(_0x39832a){return _0x39832a?{'count':_0x43e13f,'rows':_0x39832a}:null;}})[_0xd4ce('0x30')](respondWithResult(_0x4b1fcc,null))['catch'](handleError(_0x4b1fcc,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 7f9dfe9..2ebc4a9 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 _0x3c6d=['../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3c6d,0x199));var _0xd3c6=function(_0x541162,_0x62b9a9){_0x541162=_0x541162-0x0;var _0x20963b=_0x3c6d[_0x541162];return _0x20963b;};'use strict';var EventEmitter=require(_0xd3c6('0x0'));var ChatWebsite=require(_0xd3c6('0x1'))['db'][_0xd3c6('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd3c6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd3c6('0x4'),'afterDestroy':_0xd3c6('0x5')};function emitEvent(_0x2a3a62){return function(_0x28b706,_0x26c5b9,_0x236c6b){ChatWebsiteEvents['emit'](_0x2a3a62+':'+_0x28b706['id'],_0x28b706);ChatWebsiteEvents[_0xd3c6('0x6')](_0x2a3a62,_0x28b706);_0x236c6b(null);};}for(var e in events){if(events[_0xd3c6('0x7')](e)){var event=events[e];ChatWebsite[_0xd3c6('0x8')](e,emitEvent(event));}}module[_0xd3c6('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xa63f=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa63f,0x1b6));var _0xfa63=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0xa63f[_0x3c04d7];return _0x2fb24;};'use strict';var EventEmitter=require(_0xfa63('0x0'));var ChatWebsite=require(_0xfa63('0x1'))['db'][_0xfa63('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xfa63('0x3')](0x0);var events={'afterCreate':_0xfa63('0x4'),'afterUpdate':_0xfa63('0x5'),'afterDestroy':_0xfa63('0x6')};function emitEvent(_0x402b13){return function(_0x37e644,_0x138518,_0x581d1f){ChatWebsiteEvents['emit'](_0x402b13+':'+_0x37e644['id'],_0x37e644);ChatWebsiteEvents[_0xfa63('0x7')](_0x402b13,_0x37e644);_0x581d1f(null);};}for(var e in events){if(events[_0xfa63('0x8')](e)){var event=events[e];ChatWebsite[_0xfa63('0x9')](e,emitEvent(event));}}module[_0xfa63('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 27b8195..cbd9554 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 _0x82e4=['ChatWebsite','chat_websites','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x82e4,0x14c));var _0x482e=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0x82e4[_0x45ae0d];return _0x371826;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x482e('0x0'))(_0x482e('0x1'));var moment=require(_0x482e('0x2'));var BPromise=require(_0x482e('0x3'));var rp=require(_0x482e('0x4'));var fs=require('fs');var path=require(_0x482e('0x5'));var rimraf=require(_0x482e('0x6'));var config=require(_0x482e('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x482e('0x8')]=function(_0x1fcaf6,_0x922db9){return _0x1fcaf6['define'](_0x482e('0x9'),attributes,{'tableName':_0x482e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12cb=['exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','request-promise','path','../../config/environment','./chatWebsite.attributes'];(function(_0x3b1502,_0xa23e9d){var _0x1c8537=function(_0x3c05f1){while(--_0x3c05f1){_0x3b1502['push'](_0x3b1502['shift']());}};_0x1c8537(++_0xa23e9d);}(_0x12cb,0x67));var _0xb12c=function(_0x372aeb,_0x436ed1){_0x372aeb=_0x372aeb-0x0;var _0x31343d=_0x12cb[_0x372aeb];return _0x31343d;};'use strict';var _=require(_0xb12c('0x0'));var util=require(_0xb12c('0x1'));var logger=require(_0xb12c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb12c('0x3'));var fs=require('fs');var path=require(_0xb12c('0x4'));var rimraf=require('rimraf');var config=require(_0xb12c('0x5'));var attributes=require(_0xb12c('0x6'));module[_0xb12c('0x7')]=function(_0x50a308,_0x165670){return _0x50a308[_0xb12c('0x8')](_0xb12c('0x9'),attributes,{'tableName':_0xb12c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 16e2b55..28b8d88 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 _0xf1c8=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x56d850,_0xc4a37f){var _0x22296c=function(_0x2c22e5){while(--_0x2c22e5){_0x56d850['push'](_0x56d850['shift']());}};_0x22296c(++_0xc4a37f);}(_0xf1c8,0x75));var _0x8f1c=function(_0x3861f4,_0x3ad84d){_0x3861f4=_0x3861f4-0x0;var _0x122cd1=_0xf1c8[_0x3861f4];return _0x122cd1;};'use strict';var _=require(_0x8f1c('0x0'));var util=require(_0x8f1c('0x1'));var moment=require(_0x8f1c('0x2'));var BPromise=require(_0x8f1c('0x3'));var rs=require(_0x8f1c('0x4'));var fs=require('fs');var Redis=require(_0x8f1c('0x5'));var db=require(_0x8f1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f1c('0x7'))(_0x8f1c('0x8'));var config=require(_0x8f1c('0x9'));var jayson=require(_0x8f1c('0xa'));var client=jayson[_0x8f1c('0xb')][_0x8f1c('0xc')]({'port':0x232a});config[_0x8f1c('0xd')]=_['defaults'](config[_0x8f1c('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f1c('0xd')]));require(_0x8f1c('0xe'))[_0x8f1c('0xf')](socket);function respondWithRpcPromise(_0xe372f9,_0x133a52,_0x51e43b){return new BPromise(function(_0x26180d,_0x3be7b4){return client[_0x8f1c('0x10')](_0xe372f9,_0x51e43b)[_0x8f1c('0x11')](function(_0x1d1236){logger[_0x8f1c('0x12')](_0x8f1c('0x13'),_0x133a52,'request\x20sent');logger[_0x8f1c('0x14')](_0x8f1c('0x15'),_0x133a52,_0x8f1c('0x16'),JSON['stringify'](_0x1d1236));if(_0x1d1236[_0x8f1c('0x17')]){if(_0x1d1236[_0x8f1c('0x17')][_0x8f1c('0x18')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x133a52,_0x1d1236['error']['message']);return _0x3be7b4(_0x1d1236['error']['message']);}logger['error'](_0x8f1c('0x13'),_0x133a52,_0x1d1236['error'][_0x8f1c('0x19')]);return _0x26180d(_0x1d1236[_0x8f1c('0x17')]['message']);}else{logger[_0x8f1c('0x12')](_0x8f1c('0x13'),_0x133a52,'request\x20sent');_0x26180d(_0x1d1236[_0x8f1c('0x1a')][_0x8f1c('0x19')]);}})[_0x8f1c('0x1b')](function(_0xb87575){logger[_0x8f1c('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x133a52,_0xb87575);_0x3be7b4(_0xb87575);});});} \ No newline at end of file +var _0xca6f=['localhost','./chatWebsite.socket','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','ChatWebsite,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0xca6f,0xe5));var _0xfca6=function(_0x333463,_0x4326b5){_0x333463=_0x333463-0x0;var _0x1464ca=_0xca6f[_0x333463];return _0x1464ca;};'use strict';var _=require('lodash');var util=require(_0xfca6('0x0'));var moment=require(_0xfca6('0x1'));var BPromise=require(_0xfca6('0x2'));var rs=require(_0xfca6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfca6('0x4'))['db'];var utils=require(_0xfca6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xfca6('0x6'));var jayson=require(_0xfca6('0x7'));var client=jayson[_0xfca6('0x8')][_0xfca6('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfca6('0xa')],{'host':_0xfca6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfca6('0xa')]));require(_0xfca6('0xc'))['register'](socket);function respondWithRpcPromise(_0x116b1b,_0x4ecc33,_0x3dfcad){return new BPromise(function(_0x2cc261,_0x3ddaba){return client['request'](_0x116b1b,_0x3dfcad)[_0xfca6('0xd')](function(_0x1ac504){logger[_0xfca6('0xe')]('ChatWebsite,\x20%s,\x20%s',_0x4ecc33,_0xfca6('0xf'));logger[_0xfca6('0x10')](_0xfca6('0x11'),_0x4ecc33,_0xfca6('0xf'),JSON[_0xfca6('0x12')](_0x1ac504));if(_0x1ac504['error']){if(_0x1ac504['error'][_0xfca6('0x13')]===0x1f4){logger['error'](_0xfca6('0x14'),_0x4ecc33,_0x1ac504[_0xfca6('0x15')][_0xfca6('0x16')]);return _0x3ddaba(_0x1ac504[_0xfca6('0x15')][_0xfca6('0x16')]);}logger[_0xfca6('0x15')](_0xfca6('0x14'),_0x4ecc33,_0x1ac504[_0xfca6('0x15')]['message']);return _0x2cc261(_0x1ac504['error'][_0xfca6('0x16')]);}else{logger[_0xfca6('0xe')]('ChatWebsite,\x20%s,\x20%s',_0x4ecc33,_0xfca6('0xf'));_0x2cc261(_0x1ac504[_0xfca6('0x17')][_0xfca6('0x16')]);}})['catch'](function(_0x475511){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4ecc33,_0x475511);_0x3ddaba(_0x475511);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4f77f07..39b81a4 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 _0x153d=['remove','update','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4b3970,_0x8fa714){var _0x24d3d9=function(_0x74da43){while(--_0x74da43){_0x4b3970['push'](_0x4b3970['shift']());}};_0x24d3d9(++_0x8fa714);}(_0x153d,0xf4));var _0xd153=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x153d[_0x167cc1];return _0x10bc4b;};'use strict';var ChatWebsiteEvents=require(_0xd153('0x0'));var events=[_0xd153('0x1'),_0xd153('0x2'),_0xd153('0x3')];function createListener(_0x300a46,_0xbf70de){return function(_0x3d7b25){_0xbf70de['emit'](_0x300a46,_0x3d7b25);};}function removeListener(_0x375775,_0x291955){return function(){ChatWebsiteEvents['removeListener'](_0x375775,_0x291955);};}exports['register']=function(_0x4e0f5e){for(var _0x38d245=0x0,_0x82be70=events[_0xd153('0x4')];_0x38d245<_0x82be70;_0x38d245++){var _0x7cb943=events[_0x38d245];var _0x1df5e5=createListener(_0xd153('0x5')+_0x7cb943,_0x4e0f5e);ChatWebsiteEvents['on'](_0x7cb943,_0x1df5e5);}}; \ No newline at end of file +var _0x6e3e=['./chatWebsite.events','save','remove','emit','removeListener','register'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x6e3e,0x132));var _0xe6e3=function(_0xf5671b,_0x1a9685){_0xf5671b=_0xf5671b-0x0;var _0xc4e591=_0x6e3e[_0xf5671b];return _0xc4e591;};'use strict';var ChatWebsiteEvents=require(_0xe6e3('0x0'));var events=[_0xe6e3('0x1'),_0xe6e3('0x2'),'update'];function createListener(_0x5a36aa,_0xab1058){return function(_0xdcf153){_0xab1058[_0xe6e3('0x3')](_0x5a36aa,_0xdcf153);};}function removeListener(_0x2fbcbf,_0x1454c0){return function(){ChatWebsiteEvents[_0xe6e3('0x4')](_0x2fbcbf,_0x1454c0);};}exports[_0xe6e3('0x5')]=function(_0x3b1de7){for(var _0x1d84b3=0x0,_0x20938a=events['length'];_0x1d84b3<_0x20938a;_0x1d84b3++){var _0x35af53=events[_0x1d84b3];var _0x1a7111=createListener('chatWebsite:'+_0x35af53,_0x3b1de7);ChatWebsiteEvents['on'](_0x35af53,_0x1a7111);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 4e2a1b1..f0ea0d2 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 _0xb9a1=['/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','%s-%s','now','single','file','addLogo','originalname','addAvatar','addCustomerAvatar','server/files/images/avatars/','format','server/files','attachments','offline-chat','ensureDir','replace','any','/:id/interactions','addInteraction','addApplications','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getLogo','/:id/avatar'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb9a1,0x172));var _0x1b9a=function(_0x40f5cf,_0x2cbccb){_0x40f5cf=_0x40f5cf-0x0;var _0x1981e6=_0xb9a1[_0x40f5cf];return _0x1981e6;};'use strict';var multer=require(_0x1b9a('0x0'));var util=require('util');var path=require(_0x1b9a('0x1'));var timeout=require(_0x1b9a('0x2'));var express=require(_0x1b9a('0x3'));var router=express[_0x1b9a('0x4')]();var fs_extra=require(_0x1b9a('0x5'));var auth=require(_0x1b9a('0x6'));var interaction=require(_0x1b9a('0x7'));var config=require(_0x1b9a('0x8'));var controller=require(_0x1b9a('0x9'));router['get']('/',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0xb')]);router[_0x1b9a('0xc')]('/describe',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0xd')]);router['get'](_0x1b9a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x1b9a('0xc')](_0x1b9a('0xf'),auth['isAuthenticated'](),controller[_0x1b9a('0x10')]);router['get']('/:id/canned_answers',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x11')]);router[_0x1b9a('0xc')]('/:id/logo',controller[_0x1b9a('0x12')]);router['get'](_0x1b9a('0x13'),controller['getAvatar']);router[_0x1b9a('0xc')](_0x1b9a('0x14'),controller[_0x1b9a('0x15')]);router[_0x1b9a('0xc')](_0x1b9a('0x16'),controller[_0x1b9a('0x17')]);router[_0x1b9a('0xc')]('/:id/interactions',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x18')]);router[_0x1b9a('0xc')]('/:id/snippet',controller[_0x1b9a('0x19')]);router[_0x1b9a('0xc')](_0x1b9a('0x1a'),auth[_0x1b9a('0xa')](),controller['getApplications']);router[_0x1b9a('0xc')](_0x1b9a('0x1b'),auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x1c')]);router[_0x1b9a('0xc')](_0x1b9a('0x1d'),controller['getFields']);router[_0x1b9a('0xc')]('/:id/offline_messages',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x1e')]);router[_0x1b9a('0xc')]('/:id/users',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x1f')]);router['post']('/',auth[_0x1b9a('0xa')](),controller['create']);router[_0x1b9a('0x20')](_0x1b9a('0xf'),auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x21')]);router['post'](_0x1b9a('0x22'),auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x23')]);var upload=multer({'storage':multer[_0x1b9a('0x24')]({'destination':function(_0x1e473f,_0x1ae387,_0x4c9e5b){_0x4c9e5b(null,path[_0x1b9a('0x25')](config[_0x1b9a('0x26')],'server/files/images/logos/'));},'filename':function(_0x359046,_0x573b04,_0x75c530){_0x75c530(null,util['format'](_0x1b9a('0x27'),Date[_0x1b9a('0x28')](),_0x573b04['originalname']));}})});router[_0x1b9a('0x20')]('/:id/logo',upload[_0x1b9a('0x29')](_0x1b9a('0x2a')),controller[_0x1b9a('0x2b')]);var upload=multer({'storage':multer[_0x1b9a('0x24')]({'destination':function(_0x4613fd,_0x273b05,_0x154e0b){_0x154e0b(null,path[_0x1b9a('0x25')](config[_0x1b9a('0x26')],'server/files/images/avatars/'));},'filename':function(_0x57d5f1,_0x4b05ec,_0x4a72ff){_0x4a72ff(null,util['format'](_0x1b9a('0x27'),Date['now'](),_0x4b05ec[_0x1b9a('0x2c')]));}})});router['post'](_0x1b9a('0x13'),upload[_0x1b9a('0x29')]('file'),controller[_0x1b9a('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4197ab,_0x2791de,_0x125310){_0x125310(null,path['join'](config[_0x1b9a('0x26')],'server/files/images/avatars/'));},'filename':function(_0x439d4a,_0x4efc44,_0x2ddf32){_0x2ddf32(null,util['format'](_0x1b9a('0x27'),Date[_0x1b9a('0x28')](),_0x4efc44[_0x1b9a('0x2c')]));}})});router['post'](_0x1b9a('0x14'),upload[_0x1b9a('0x29')](_0x1b9a('0x2a')),controller[_0x1b9a('0x2e')]);var upload=multer({'storage':multer[_0x1b9a('0x24')]({'destination':function(_0x296542,_0x17ab01,_0x1c400c){_0x1c400c(null,path[_0x1b9a('0x25')](config[_0x1b9a('0x26')],_0x1b9a('0x2f')));},'filename':function(_0x364efe,_0x5dafee,_0x2683e7){_0x2683e7(null,util[_0x1b9a('0x30')](_0x1b9a('0x27'),Date['now'](),_0x5dafee[_0x1b9a('0x2c')]));}})});router['post'](_0x1b9a('0x16'),upload[_0x1b9a('0x29')]('file'),controller['addSystemAvatar']);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x1b9a('0x24')]({'destination':function(_0x51b2d0,_0x6482c,_0x427865){const _0x518569=path['join'](config[_0x1b9a('0x26')],_0x1b9a('0x31'),_0x1b9a('0x32'),_0x1b9a('0x33'));fs_extra[_0x1b9a('0x34')](_0x518569,function(){_0x427865(null,_0x518569);});},'filename':function(_0x3dcc88,_0x35751a,_0x9f4da){const _0x4bf86e=_0x35751a[_0x1b9a('0x2c')][_0x1b9a('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2fe7a7=path['extname'](_0x4bf86e);const _0x47e97f=Date[_0x1b9a('0x28')]()+'-'+_0x4bf86e[_0x1b9a('0x35')](_0x2fe7a7,'')+_0x2fe7a7;_0x9f4da(null,_0x47e97f);}})});router[_0x1b9a('0x20')]('/:id/offline',offlineUploadMulter[_0x1b9a('0x36')](),controller['offline']);router[_0x1b9a('0x20')](_0x1b9a('0x37'),auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x38')]);router[_0x1b9a('0x20')](_0x1b9a('0x1a'),auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x39')]);router['post'](_0x1b9a('0x1b'),auth['isAuthenticated'](),controller['addProactiveActions']);router['post']('/:id/users',auth[_0x1b9a('0xa')](),controller['addAgents']);router[_0x1b9a('0x3a')](_0x1b9a('0xe'),auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x3b')]);router[_0x1b9a('0x3c')](_0x1b9a('0xe'),auth['isAuthenticated'](),controller[_0x1b9a('0x3d')]);router['delete'](_0x1b9a('0xf'),auth[_0x1b9a('0xa')](),controller['removeDispositions']);router[_0x1b9a('0x3c')]('/:id/canned_answers',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x3e')]);router[_0x1b9a('0x3c')]('/:id/users',auth[_0x1b9a('0xa')](),controller[_0x1b9a('0x3f')]);module[_0x1b9a('0x40')]=router; \ No newline at end of file +var _0xaba9=['getSystemAvatar','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/users','getAgents','post','diskStorage','join','root','server/files/images/logos/','format','now','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','addCustomerAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','/:id/proactive_actions','addProactiveActions','put','/:id','update','delete','removeAnswers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar'];(function(_0x3d60f2,_0x42ed21){var _0x33231c=function(_0x1c1152){while(--_0x1c1152){_0x3d60f2['push'](_0x3d60f2['shift']());}};_0x33231c(++_0x42ed21);}(_0xaba9,0xad));var _0x9aba=function(_0x11b6ef,_0x35dad0){_0x11b6ef=_0x11b6ef-0x0;var _0x4aab6a=_0xaba9[_0x11b6ef];return _0x4aab6a;};'use strict';var multer=require(_0x9aba('0x0'));var util=require(_0x9aba('0x1'));var path=require(_0x9aba('0x2'));var timeout=require(_0x9aba('0x3'));var express=require('express');var router=express[_0x9aba('0x4')]();var fs_extra=require(_0x9aba('0x5'));var auth=require(_0x9aba('0x6'));var interaction=require(_0x9aba('0x7'));var config=require(_0x9aba('0x8'));var controller=require('./chatWebsite.controller');router[_0x9aba('0x9')]('/',auth[_0x9aba('0xa')](),controller[_0x9aba('0xb')]);router['get']('/describe',auth[_0x9aba('0xa')](),controller[_0x9aba('0xc')]);router[_0x9aba('0x9')]('/:id',auth[_0x9aba('0xa')](),controller[_0x9aba('0xd')]);router[_0x9aba('0x9')](_0x9aba('0xe'),auth['isAuthenticated'](),controller[_0x9aba('0xf')]);router['get'](_0x9aba('0x10'),auth[_0x9aba('0xa')](),controller[_0x9aba('0x11')]);router[_0x9aba('0x9')](_0x9aba('0x12'),controller[_0x9aba('0x13')]);router['get'](_0x9aba('0x14'),controller[_0x9aba('0x15')]);router[_0x9aba('0x9')](_0x9aba('0x16'),controller[_0x9aba('0x17')]);router[_0x9aba('0x9')](_0x9aba('0x18'),controller[_0x9aba('0x19')]);router['get']('/:id/interactions',auth[_0x9aba('0xa')](),controller['getInteractions']);router[_0x9aba('0x9')](_0x9aba('0x1a'),controller[_0x9aba('0x1b')]);router[_0x9aba('0x9')](_0x9aba('0x1c'),auth[_0x9aba('0xa')](),controller[_0x9aba('0x1d')]);router[_0x9aba('0x9')]('/:id/proactive_actions',auth[_0x9aba('0xa')](),controller[_0x9aba('0x1e')]);router['get']('/:id/fields',controller[_0x9aba('0x1f')]);router['get']('/:id/offline_messages',auth[_0x9aba('0xa')](),controller['getOfflineMessages']);router[_0x9aba('0x9')](_0x9aba('0x20'),auth['isAuthenticated'](),controller[_0x9aba('0x21')]);router['post']('/',auth[_0x9aba('0xa')](),controller['create']);router['post'](_0x9aba('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x9aba('0x22')](_0x9aba('0x10'),auth[_0x9aba('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x9aba('0x23')]({'destination':function(_0x191bab,_0x320cce,_0x35e119){_0x35e119(null,path[_0x9aba('0x24')](config[_0x9aba('0x25')],_0x9aba('0x26')));},'filename':function(_0x41dd36,_0x1f0d6f,_0x75c3b0){_0x75c3b0(null,util[_0x9aba('0x27')]('%s-%s',Date[_0x9aba('0x28')](),_0x1f0d6f[_0x9aba('0x29')]));}})});router[_0x9aba('0x22')](_0x9aba('0x12'),upload[_0x9aba('0x2a')](_0x9aba('0x2b')),controller[_0x9aba('0x2c')]);var upload=multer({'storage':multer[_0x9aba('0x23')]({'destination':function(_0x496ab0,_0x531f12,_0x1f4f57){_0x1f4f57(null,path[_0x9aba('0x24')](config[_0x9aba('0x25')],_0x9aba('0x2d')));},'filename':function(_0x3f5057,_0x57f5b0,_0x16f6eb){_0x16f6eb(null,util[_0x9aba('0x27')](_0x9aba('0x2e'),Date['now'](),_0x57f5b0[_0x9aba('0x29')]));}})});router['post'](_0x9aba('0x14'),upload[_0x9aba('0x2a')](_0x9aba('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a9c31,_0x3325a9,_0x2fee91){_0x2fee91(null,path['join'](config[_0x9aba('0x25')],_0x9aba('0x2d')));},'filename':function(_0x12ae03,_0x9984f6,_0x41f7ea){_0x41f7ea(null,util[_0x9aba('0x27')](_0x9aba('0x2e'),Date[_0x9aba('0x28')](),_0x9984f6['originalname']));}})});router['post'](_0x9aba('0x16'),upload[_0x9aba('0x2a')](_0x9aba('0x2b')),controller[_0x9aba('0x2f')]);var upload=multer({'storage':multer[_0x9aba('0x23')]({'destination':function(_0x2abff2,_0x250f89,_0x4d073d){_0x4d073d(null,path['join'](config['root'],_0x9aba('0x2d')));},'filename':function(_0x230210,_0x33c982,_0x4e5328){_0x4e5328(null,util['format'](_0x9aba('0x2e'),Date[_0x9aba('0x28')](),_0x33c982[_0x9aba('0x29')]));}})});router[_0x9aba('0x22')]('/:id/system_avatar',upload[_0x9aba('0x2a')](_0x9aba('0x2b')),controller['addSystemAvatar']);router['post'](_0x9aba('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x9aba('0x23')]({'destination':function(_0x36fa60,_0x1ecec7,_0x4c3493){const _0x44ad4d=path[_0x9aba('0x24')](config[_0x9aba('0x25')],_0x9aba('0x31'),_0x9aba('0x32'),_0x9aba('0x33'));fs_extra[_0x9aba('0x34')](_0x44ad4d,function(){_0x4c3493(null,_0x44ad4d);});},'filename':function(_0x140363,_0x534444,_0x3debf7){const _0x4e874d=_0x534444[_0x9aba('0x29')][_0x9aba('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x200e0f=path[_0x9aba('0x36')](_0x4e874d);const _0x2cb744=Date[_0x9aba('0x28')]()+'-'+_0x4e874d[_0x9aba('0x35')](_0x200e0f,'')+_0x200e0f;_0x3debf7(null,_0x2cb744);}})});router[_0x9aba('0x22')](_0x9aba('0x37'),offlineUploadMulter[_0x9aba('0x38')](),controller['offline']);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x9aba('0x39')]);router[_0x9aba('0x22')](_0x9aba('0x1c'),auth[_0x9aba('0xa')](),controller['addApplications']);router[_0x9aba('0x22')](_0x9aba('0x3a'),auth[_0x9aba('0xa')](),controller[_0x9aba('0x3b')]);router['post'](_0x9aba('0x20'),auth[_0x9aba('0xa')](),controller['addAgents']);router[_0x9aba('0x3c')](_0x9aba('0x3d'),auth['isAuthenticated'](),controller[_0x9aba('0x3e')]);router[_0x9aba('0x3f')]('/:id',auth[_0x9aba('0xa')](),controller['destroy']);router[_0x9aba('0x3f')](_0x9aba('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x9aba('0x10'),auth[_0x9aba('0xa')](),controller[_0x9aba('0x40')]);router[_0x9aba('0x3f')](_0x9aba('0x20'),auth[_0x9aba('0xa')](),controller['removeAgents']);module[_0x9aba('0x41')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 09b9791..6a11ca7 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 _0x4677=['AmazonAWS','sequelize','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4677,0x155));var _0x7467=function(_0x7582fa,_0x4303cc){_0x7582fa=_0x7582fa-0x0;var _0x2fec3a=_0x4677[_0x7582fa];return _0x2fec3a;};'use strict';var Sequelize=require(_0x7467('0x0'));module['exports']={'name':{'type':Sequelize[_0x7467('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7467('0x2')](_0x7467('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x7467('0x1')]},'data2':{'type':Sequelize[_0x7467('0x1')]}}; \ No newline at end of file +var _0xbc48=['STRING','ENUM','Google','sequelize','exports'];(function(_0x22c3ab,_0x47a1ee){var _0x21a963=function(_0x11a6d5){while(--_0x11a6d5){_0x22c3ab['push'](_0x22c3ab['shift']());}};_0x21a963(++_0x47a1ee);}(_0xbc48,0x111));var _0x8bc4=function(_0x32245b,_0x7bdba2){_0x32245b=_0x32245b-0x0;var _0x2b0e9f=_0xbc48[_0x32245b];return _0x2b0e9f;};'use strict';var Sequelize=require(_0x8bc4('0x0'));module[_0x8bc4('0x1')]={'name':{'type':Sequelize[_0x8bc4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8bc4('0x3')]('AmazonAWS',_0x8bc4('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x8bc4('0x2')]},'data2':{'type':Sequelize[_0x8bc4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a0b5d39..81918a1 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 _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(_0x2f235f,_0x80f23){var _0x31351c=function(_0x20b102){while(--_0x20b102){_0x2f235f['push'](_0x2f235f['shift']());}};_0x31351c(++_0x80f23);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a9e01,_0x480a68){_0x3a9e01=_0x3a9e01-0x0;var _0x22e3ab=_0x2ef3[_0x3a9e01];return _0x22e3ab;};'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 +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c396c,_0x4db177){_0x2c396c=_0x2c396c-0x0;var _0x26219b=_0x5f2f[_0x2c396c];return _0x26219b;};'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 diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b909a58..c023b29 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 _0xda13=['exports','define','CloudProvider','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xda13,0x1e3));var _0x3da1=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0xda13[_0x2967c1];return _0x103397;};'use strict';var _=require(_0x3da1('0x0'));var util=require(_0x3da1('0x1'));var logger=require(_0x3da1('0x2'))('api');var moment=require(_0x3da1('0x3'));var BPromise=require(_0x3da1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3da1('0x5'));var rimraf=require(_0x3da1('0x6'));var config=require(_0x3da1('0x7'));var attributes=require(_0x3da1('0x8'));module[_0x3da1('0x9')]=function(_0x508860,_0x4a4f21){return _0x508860[_0x3da1('0xa')](_0x3da1('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd9=['exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes'];(function(_0x1ffd78,_0x11af73){var _0x3aa3a5=function(_0x32dcdc){while(--_0x32dcdc){_0x1ffd78['push'](_0x1ffd78['shift']());}};_0x3aa3a5(++_0x11af73);}(_0x3dd9,0x1f1));var _0x93dd=function(_0x42e723,_0x503e9b){_0x42e723=_0x42e723-0x0;var _0x1045ff=_0x3dd9[_0x42e723];return _0x1045ff;};'use strict';var _=require(_0x93dd('0x0'));var util=require(_0x93dd('0x1'));var logger=require(_0x93dd('0x2'))(_0x93dd('0x3'));var moment=require(_0x93dd('0x4'));var BPromise=require(_0x93dd('0x5'));var rp=require(_0x93dd('0x6'));var fs=require('fs');var path=require(_0x93dd('0x7'));var rimraf=require('rimraf');var config=require(_0x93dd('0x8'));var attributes=require(_0x93dd('0x9'));module[_0x93dd('0xa')]=function(_0x9fec0e,_0x2c744c){return _0x9fec0e['define'](_0x93dd('0xb'),attributes,{'tableName':_0x93dd('0xc'),'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 9a93b07..ff134e9 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 _0xfff0=['../../config/environment','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3c1bc0,_0x2597ac){var _0x5c41be=function(_0xc62b2b){while(--_0xc62b2b){_0x3c1bc0['push'](_0x3c1bc0['shift']());}};_0x5c41be(++_0x2597ac);}(_0xfff0,0x139));var _0x0fff=function(_0x7478da,_0x12bcf3){_0x7478da=_0x7478da-0x0;var _0x2f2f67=_0xfff0[_0x7478da];return _0x2f2f67;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('CloudProvider,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});} \ No newline at end of file +var _0x4c4a=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x25d368,_0x59e491){_0x25d368=_0x25d368-0x0;var _0x1c6fc7=_0x4c4a[_0x25d368];return _0x1c6fc7;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var moment=require(_0xa4c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4c4('0x3'));var fs=require('fs');var Redis=require(_0xa4c4('0x4'));var db=require(_0xa4c4('0x5'))['db'];var utils=require(_0xa4c4('0x6'));var logger=require('../../config/logger')(_0xa4c4('0x7'));var config=require('../../config/environment');var jayson=require(_0xa4c4('0x8'));var client=jayson[_0xa4c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x557596,_0x11b498,_0x553525){return new BPromise(function(_0x27b877,_0x118d89){return client[_0xa4c4('0xa')](_0x557596,_0x553525)['then'](function(_0x5ec64c){logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));logger[_0xa4c4('0xe')](_0xa4c4('0xf'),_0x11b498,'request\x20sent',JSON[_0xa4c4('0x10')](_0x5ec64c));if(_0x5ec64c['error']){if(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x12')]===0x1f4){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x118d89(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}logger[_0xa4c4('0x11')]('CloudProvider,\x20%s,\x20%s',_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x27b877(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}else{logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));_0x27b877(_0x5ec64c['result'][_0xa4c4('0x13')]);}})[_0xa4c4('0x14')](function(_0x4b2f2d){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x4b2f2d);_0x118d89(_0x4b2f2d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9c0b2b6..239414d 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 _0x1f3c=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','get','index','isAuthenticated','show'];(function(_0x15e581,_0x309af2){var _0x4d01e2=function(_0x18b658){while(--_0x18b658){_0x15e581['push'](_0x15e581['shift']());}};_0x4d01e2(++_0x309af2);}(_0x1f3c,0xd7));var _0xc1f3=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x1f3c[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0xc1f3('0x0'));var util=require(_0xc1f3('0x1'));var path=require(_0xc1f3('0x2'));var timeout=require(_0xc1f3('0x3'));var express=require(_0xc1f3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0xc1f3('0x5')]('/',auth['isAuthenticated'](),controller[_0xc1f3('0x6')]);router[_0xc1f3('0x5')]('/:id',auth[_0xc1f3('0x7')](),controller[_0xc1f3('0x8')]);router['post']('/',auth[_0xc1f3('0x7')](),controller[_0xc1f3('0x9')]);router[_0xc1f3('0xa')](_0xc1f3('0xb'),auth[_0xc1f3('0x7')](),controller[_0xc1f3('0xc')]);router[_0xc1f3('0xd')](_0xc1f3('0xb'),auth[_0xc1f3('0x7')](),controller[_0xc1f3('0xe')]);module[_0xc1f3('0xf')]=router; \ No newline at end of file +var _0xd8a5=['connect-timeout','Router','fs-extra','../../components/interaction/service','./cloudProvider.controller','isAuthenticated','get','/:id','post','put','destroy','exports','multer'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xd8a5,0x81));var _0x5d8a=function(_0x3dd948,_0x3b51b1){_0x3dd948=_0x3dd948-0x0;var _0x591a50=_0xd8a5[_0x3dd948];return _0x591a50;};'use strict';var multer=require(_0x5d8a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5d8a('0x1'));var express=require('express');var router=express[_0x5d8a('0x2')]();var fs_extra=require(_0x5d8a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5d8a('0x4'));var config=require('../../config/environment');var controller=require(_0x5d8a('0x5'));router['get']('/',auth[_0x5d8a('0x6')](),controller['index']);router[_0x5d8a('0x7')](_0x5d8a('0x8'),auth[_0x5d8a('0x6')](),controller['show']);router[_0x5d8a('0x9')]('/',auth[_0x5d8a('0x6')](),controller['create']);router[_0x5d8a('0xa')](_0x5d8a('0x8'),auth[_0x5d8a('0x6')](),controller['update']);router['delete'](_0x5d8a('0x8'),auth[_0x5d8a('0x6')](),controller[_0x5d8a('0xb')]);module[_0x5d8a('0xc')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 3623805..144cf5d 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 _0xddce=['sequelize','exports','STRING','name'];(function(_0xc3b08e,_0x427235){var _0x4c5e08=function(_0x501784){while(--_0x501784){_0xc3b08e['push'](_0xc3b08e['shift']());}};_0x4c5e08(++_0x427235);}(_0xddce,0xdc));var _0xeddc=function(_0x39df08,_0x331cd5){_0x39df08=_0x39df08-0x0;var _0x3cc1cd=_0xddce[_0x39df08];return _0x3cc1cd;};'use strict';var Sequelize=require(_0xeddc('0x0'));module[_0xeddc('0x1')]={'name':{'type':Sequelize[_0xeddc('0x2')],'unique':_0xeddc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xeddc('0x2')]},'companyId':{'type':Sequelize[_0xeddc('0x2')]},'website':{'type':Sequelize[_0xeddc('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xeddc('0x2')]},'type':{'type':Sequelize[_0xeddc('0x2')]},'street':{'type':Sequelize[_0xeddc('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xeddc('0x2')]},'country':{'type':Sequelize[_0xeddc('0x2')]},'email':{'type':Sequelize[_0xeddc('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xeddc('0x2')]},'sCity':{'type':Sequelize[_0xeddc('0x2')]},'sCountry':{'type':Sequelize[_0xeddc('0x2')]},'description':{'type':Sequelize[_0xeddc('0x2')]}}; \ No newline at end of file +var _0x57b5=['exports','STRING','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x57b5,0x1bc));var _0x557b=function(_0x23b1d5,_0x3043fa){_0x23b1d5=_0x23b1d5-0x0;var _0x3f5702=_0x57b5[_0x23b1d5];return _0x3f5702;};'use strict';var Sequelize=require('sequelize');module[_0x557b('0x0')]={'name':{'type':Sequelize[_0x557b('0x1')],'unique':_0x557b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x557b('0x1')]},'companyId':{'type':Sequelize[_0x557b('0x1')]},'website':{'type':Sequelize[_0x557b('0x1')]},'phone':{'type':Sequelize[_0x557b('0x1')]},'fax':{'type':Sequelize[_0x557b('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x557b('0x1')]},'postalCode':{'type':Sequelize[_0x557b('0x1')]},'city':{'type':Sequelize[_0x557b('0x1')]},'country':{'type':Sequelize[_0x557b('0x1')]},'email':{'type':Sequelize[_0x557b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x557b('0x1')]},'sStreet':{'type':Sequelize[_0x557b('0x1')]},'sPostalCode':{'type':Sequelize[_0x557b('0x1')]},'sCity':{'type':Sequelize[_0x557b('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x557b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 3c7a118..b2ce954 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 _0xa0e9=['show','params','keys','rawAttributes','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','zip-dir','moment','bluebird','mustache','path','sox','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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','Companies','UserProfileResource','destroy','error','stack','name','send','index','describe','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','CmCompany','count','include','findAll','catch'];(function(_0x190cbd,_0x776df2){var _0x5b8657=function(_0x4021ef){while(--_0x4021ef){_0x190cbd['push'](_0x190cbd['shift']());}};_0x5b8657(++_0x776df2);}(_0xa0e9,0x129));var _0x9a0e=function(_0x1066f6,_0x55f1ad){_0x1066f6=_0x1066f6-0x0;var _0x2f716e=_0xa0e9[_0x1066f6];return _0x2f716e;};'use strict';var emlformat=require(_0x9a0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a0e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a0e('0x2'));var BPromise=require(_0x9a0e('0x3'));var Mustache=require(_0x9a0e('0x4'));var util=require('util');var path=require(_0x9a0e('0x5'));var sox=require(_0x9a0e('0x6'));var csv=require('to-csv');var ejs=require(_0x9a0e('0x7'));var fs=require('fs');var fs_extra=require(_0x9a0e('0x8'));var _=require('lodash');var squel=require(_0x9a0e('0x9'));var crypto=require(_0x9a0e('0xa'));var jsforce=require(_0x9a0e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9a0e('0xc'));var Papa=require(_0x9a0e('0xd'));var Redis=require(_0x9a0e('0xe'));var authService=require(_0x9a0e('0xf'));var qs=require(_0x9a0e('0x10'));var as=require(_0x9a0e('0x11'));var hardwareService=require(_0x9a0e('0x12'));var logger=require(_0x9a0e('0x13'))(_0x9a0e('0x14'));var utils=require(_0x9a0e('0x15'));var config=require(_0x9a0e('0x16'));var licenseUtil=require(_0x9a0e('0x17'));var db=require(_0x9a0e('0x18'))['db'];function respondWithStatusCode(_0x573d21,_0x3355e3){_0x3355e3=_0x3355e3||0xcc;return function(_0x32e245){if(_0x32e245){return _0x573d21[_0x9a0e('0x19')](_0x3355e3);}return _0x573d21[_0x9a0e('0x1a')](_0x3355e3)[_0x9a0e('0x1b')]();};}function respondWithResult(_0x10fcd7,_0x48deee){_0x48deee=_0x48deee||0xc8;return function(_0x31d558){if(_0x31d558){return _0x10fcd7['status'](_0x48deee)[_0x9a0e('0x1c')](_0x31d558);}};}function respondWithFilteredResult(_0x127db0,_0xc5256f){return function(_0x548da9){if(_0x548da9){var _0x3a1209=typeof _0xc5256f[_0x9a0e('0x1d')]===_0x9a0e('0x1e')&&typeof _0xc5256f[_0x9a0e('0x1f')]===_0x9a0e('0x1e');var _0x1bd7d5=_0x548da9['count'];var _0x546de9=_0x3a1209?0x0:_0xc5256f[_0x9a0e('0x1d')];var _0x41d819=_0x3a1209?_0x548da9['count']:_0xc5256f[_0x9a0e('0x1d')]+_0xc5256f[_0x9a0e('0x1f')];var _0x34b6f9;if(_0x41d819>=_0x1bd7d5){_0x41d819=_0x1bd7d5;_0x34b6f9=0xc8;}else{_0x34b6f9=0xce;}_0x127db0[_0x9a0e('0x1a')](_0x34b6f9);return _0x127db0[_0x9a0e('0x20')](_0x9a0e('0x21'),_0x546de9+'-'+_0x41d819+'/'+_0x1bd7d5)['json'](_0x548da9);}return null;};}function patchUpdates(_0x3dcd01){return function(_0x1c3ad8){try{jsonpatch[_0x9a0e('0x22')](_0x1c3ad8,_0x3dcd01,!![]);}catch(_0x3f5bc8){return BPromise[_0x9a0e('0x23')](_0x3f5bc8);}return _0x1c3ad8['save']();};}function saveUpdates(_0x33de76,_0xd33ec4){return function(_0x3e672a){if(_0x3e672a){return _0x3e672a['update'](_0x33de76)[_0x9a0e('0x24')](function(_0xc9e2d4){return _0xc9e2d4;});}return null;};}function removeEntity(_0xaf2f5d,_0x4b56a6){return function(_0x143256){if(_0x143256){return _0x143256['destroy']()[_0x9a0e('0x24')](function(){var _0x5d3ada=_0x143256['get']({'plain':!![]});var _0x35e240=_0x9a0e('0x25');return db[_0x9a0e('0x26')][_0x9a0e('0x27')]({'where':{'type':_0x35e240,'resourceId':_0x5d3ada['id']}})['then'](function(){return _0x143256;});})[_0x9a0e('0x24')](function(){_0xaf2f5d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x448d5e,_0x491688){return function(_0x48400b){if(!_0x48400b){_0x448d5e[_0x9a0e('0x19')](0x194);}return _0x48400b;};}function handleError(_0x1b641f,_0x1bbe37){_0x1bbe37=_0x1bbe37||0x1f4;return function(_0x2b5002){logger[_0x9a0e('0x28')](_0x2b5002[_0x9a0e('0x29')]);if(_0x2b5002[_0x9a0e('0x2a')]){delete _0x2b5002[_0x9a0e('0x2a')];}_0x1b641f[_0x9a0e('0x1a')](_0x1bbe37)[_0x9a0e('0x2b')](_0x2b5002);};}exports[_0x9a0e('0x2c')]=function(_0x30f541,_0x46ebaf){var _0x5187f6={},_0x423898={},_0x5d44cc={'count':0x0,'rows':[]};return db['CmCompany'][_0x9a0e('0x2d')]()[_0x9a0e('0x24')](function(_0x25642a){_0x423898[_0x9a0e('0x2e')]=_['keys'](_0x25642a);_0x423898['query']=_['keys'](_0x30f541['query']);_0x423898['filters']=_[_0x9a0e('0x2f')](_0x423898[_0x9a0e('0x2e')],_0x423898[_0x9a0e('0x30')]);_0x5187f6[_0x9a0e('0x31')]=_[_0x9a0e('0x2f')](_0x423898[_0x9a0e('0x2e')],qs[_0x9a0e('0x32')](_0x30f541[_0x9a0e('0x30')][_0x9a0e('0x32')]));_0x5187f6['attributes']=_0x5187f6[_0x9a0e('0x31')][_0x9a0e('0x33')]?_0x5187f6[_0x9a0e('0x31')]:_0x423898[_0x9a0e('0x2e')];if(!_0x30f541[_0x9a0e('0x30')][_0x9a0e('0x34')](_0x9a0e('0x35'))){_0x5187f6[_0x9a0e('0x1f')]=qs['limit'](_0x30f541[_0x9a0e('0x30')][_0x9a0e('0x1f')]);_0x5187f6['offset']=qs[_0x9a0e('0x1d')](_0x30f541[_0x9a0e('0x30')][_0x9a0e('0x1d')]);}_0x5187f6[_0x9a0e('0x36')]=qs['sort'](_0x30f541[_0x9a0e('0x30')][_0x9a0e('0x37')]);_0x5187f6[_0x9a0e('0x38')]=qs['filters'](_[_0x9a0e('0x39')](_0x30f541[_0x9a0e('0x30')],_0x423898[_0x9a0e('0x3a')]),_0x25642a);if(_0x30f541[_0x9a0e('0x30')][_0x9a0e('0x3b')]){_0x5187f6['where']=_[_0x9a0e('0x3c')](_0x5187f6['where'],{'$or':_[_0x9a0e('0x3d')](_0x5187f6['attributes'],function(_0x4f2588){var _0x4d8bb9={};_0x4d8bb9[_0x4f2588]={'$like':'%'+_0x30f541[_0x9a0e('0x30')][_0x9a0e('0x3b')]+'%'};return _0x4d8bb9;})});}_0x5187f6=_[_0x9a0e('0x3c')]({},_0x5187f6,_0x30f541['options']);var _0x41e213={'where':_0x5187f6[_0x9a0e('0x38')]};return db[_0x9a0e('0x3e')][_0x9a0e('0x3f')](_0x41e213)[_0x9a0e('0x24')](function(_0x48ae48){_0x5d44cc[_0x9a0e('0x3f')]=_0x48ae48;if(_0x30f541['query']['includeAll']){_0x5187f6[_0x9a0e('0x40')]=[{'all':!![]}];}return db['CmCompany'][_0x9a0e('0x41')](_0x5187f6);})[_0x9a0e('0x24')](function(_0x3e099c){_0x5d44cc['rows']=_0x3e099c;return _0x5d44cc;})[_0x9a0e('0x24')](respondWithFilteredResult(_0x46ebaf,_0x5187f6))[_0x9a0e('0x42')](handleError(_0x46ebaf,null));})[_0x9a0e('0x42')](handleError(_0x46ebaf,null));};exports[_0x9a0e('0x43')]=function(_0x596df9,_0x4b5001){var _0x3b9602={'raw':![],'where':{'id':_0x596df9[_0x9a0e('0x44')]['id']}},_0x5e5447={};_0x5e5447[_0x9a0e('0x2e')]=_[_0x9a0e('0x45')](db[_0x9a0e('0x3e')][_0x9a0e('0x46')]);_0x5e5447[_0x9a0e('0x30')]=_[_0x9a0e('0x45')](_0x596df9[_0x9a0e('0x30')]);_0x5e5447[_0x9a0e('0x3a')]=_['intersection'](_0x5e5447[_0x9a0e('0x2e')],_0x5e5447[_0x9a0e('0x30')]);_0x3b9602[_0x9a0e('0x31')]=_[_0x9a0e('0x2f')](_0x5e5447[_0x9a0e('0x2e')],qs['fields'](_0x596df9[_0x9a0e('0x30')][_0x9a0e('0x32')]));_0x3b9602[_0x9a0e('0x31')]=_0x3b9602[_0x9a0e('0x31')][_0x9a0e('0x33')]?_0x3b9602[_0x9a0e('0x31')]:_0x5e5447['model'];if(_0x596df9[_0x9a0e('0x30')][_0x9a0e('0x47')]){_0x3b9602[_0x9a0e('0x40')]=[{'all':!![]}];}_0x3b9602=_['merge']({},_0x3b9602,_0x596df9[_0x9a0e('0x48')]);return db['CmCompany'][_0x9a0e('0x49')](_0x3b9602)[_0x9a0e('0x24')](handleEntityNotFound(_0x4b5001,null))[_0x9a0e('0x24')](respondWithResult(_0x4b5001,null))[_0x9a0e('0x42')](handleError(_0x4b5001,null));};exports['create']=function(_0x18572d,_0x3487ab){return db['CmCompany'][_0x9a0e('0x4a')](_0x18572d[_0x9a0e('0x4b')],{})['then'](function(_0x12df9b){var _0x435632=_0x18572d[_0x9a0e('0x4c')][_0x9a0e('0x4d')]({'plain':!![]});if(!_0x435632)throw new Error(_0x9a0e('0x4e'));if(_0x435632[_0x9a0e('0x4f')]===_0x9a0e('0x4c')){var _0x1ac22a=_0x12df9b[_0x9a0e('0x4d')]({'plain':!![]});var _0x5d3ead=_0x9a0e('0x25');return db[_0x9a0e('0x50')][_0x9a0e('0x49')]({'where':{'name':_0x5d3ead,'userProfileId':_0x435632[_0x9a0e('0x51')]},'raw':!![]})['then'](function(_0x48f9cc){if(_0x48f9cc&&_0x48f9cc[_0x9a0e('0x52')]===0x0){return db[_0x9a0e('0x26')][_0x9a0e('0x4a')]({'name':_0x1ac22a[_0x9a0e('0x2a')],'resourceId':_0x1ac22a['id'],'type':_0x48f9cc['name'],'sectionId':_0x48f9cc['id']},{})['then'](function(){return _0x12df9b;});}else{return _0x12df9b;}})[_0x9a0e('0x42')](function(_0x477344){logger[_0x9a0e('0x28')](_0x9a0e('0x53'),_0x477344);throw _0x477344;});}return _0x12df9b;})[_0x9a0e('0x24')](respondWithResult(_0x3487ab,0xc9))['catch'](handleError(_0x3487ab,null));};exports[_0x9a0e('0x54')]=function(_0x188fc6,_0x4e40e5){if(_0x188fc6['body']['id']){delete _0x188fc6[_0x9a0e('0x4b')]['id'];}return db['CmCompany'][_0x9a0e('0x49')]({'where':{'id':_0x188fc6['params']['id']}})[_0x9a0e('0x24')](handleEntityNotFound(_0x4e40e5,null))[_0x9a0e('0x24')](saveUpdates(_0x188fc6[_0x9a0e('0x4b')],null))[_0x9a0e('0x24')](respondWithResult(_0x4e40e5,null))[_0x9a0e('0x42')](handleError(_0x4e40e5,null));};exports[_0x9a0e('0x27')]=function(_0x4df6b8,_0x58e558){return db['CmCompany'][_0x9a0e('0x49')]({'where':{'id':_0x4df6b8[_0x9a0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x58e558,null))['then'](removeEntity(_0x58e558,null))[_0x9a0e('0x42')](handleError(_0x58e558,null));};exports[_0x9a0e('0x2d')]=function(_0x502b18,_0x4a0493){return db[_0x9a0e('0x3e')]['describe']()[_0x9a0e('0x24')](respondWithResult(_0x4a0493,null))['catch'](handleError(_0x4a0493,null));};exports[_0x9a0e('0x55')]=function(_0x2a5b1f,_0x33e17b,_0x3d4ff3){return db[_0x9a0e('0x56')]['find']({'where':{'id':_0x2a5b1f['params']['id']}})[_0x9a0e('0x24')](handleEntityNotFound(_0x33e17b,null))[_0x9a0e('0x24')](function(_0x57b9d1){if(_0x57b9d1){return _0x57b9d1[_0x9a0e('0x55')](_0x2a5b1f[_0x9a0e('0x4b')][_0x9a0e('0x57')],_[_0x9a0e('0x58')](_0x2a5b1f[_0x9a0e('0x4b')],['ids','id'])||{});}})[_0x9a0e('0x24')](respondWithResult(_0x33e17b,null))[_0x9a0e('0x42')](handleError(_0x33e17b,null));};exports[_0x9a0e('0x59')]=function(_0x4e9003,_0x88ad5b,_0x5e55dd){var _0x1a4b2a={};var _0x4591c7={};var _0xaf56bb;var _0x5b6ce7;return db[_0x9a0e('0x3e')][_0x9a0e('0x5a')]({'where':{'id':_0x4e9003[_0x9a0e('0x44')]['id']}})[_0x9a0e('0x24')](handleEntityNotFound(_0x88ad5b,null))[_0x9a0e('0x24')](function(_0x184a22){if(_0x184a22){_0xaf56bb=_0x184a22;_0x4591c7[_0x9a0e('0x2e')]=_[_0x9a0e('0x45')](db[_0x9a0e('0x56')]['rawAttributes']);_0x4591c7[_0x9a0e('0x30')]=_[_0x9a0e('0x45')](_0x4e9003[_0x9a0e('0x30')]);_0x4591c7['filters']=_[_0x9a0e('0x2f')](_0x4591c7[_0x9a0e('0x2e')],_0x4591c7[_0x9a0e('0x30')]);_0x1a4b2a[_0x9a0e('0x31')]=_[_0x9a0e('0x2f')](_0x4591c7[_0x9a0e('0x2e')],qs[_0x9a0e('0x32')](_0x4e9003[_0x9a0e('0x30')][_0x9a0e('0x32')]));_0x1a4b2a[_0x9a0e('0x31')]=_0x1a4b2a['attributes'][_0x9a0e('0x33')]?_0x1a4b2a[_0x9a0e('0x31')]:_0x4591c7[_0x9a0e('0x2e')];_0x1a4b2a[_0x9a0e('0x36')]=qs[_0x9a0e('0x37')](_0x4e9003[_0x9a0e('0x30')][_0x9a0e('0x37')]);_0x1a4b2a[_0x9a0e('0x38')]=qs[_0x9a0e('0x3a')](_[_0x9a0e('0x39')](_0x4e9003['query'],_0x4591c7[_0x9a0e('0x3a')]));if(_0x4e9003['query'][_0x9a0e('0x3b')]){_0x1a4b2a[_0x9a0e('0x38')]=_[_0x9a0e('0x3c')](_0x1a4b2a[_0x9a0e('0x38')],{'$or':_[_0x9a0e('0x3d')](_0x1a4b2a['attributes'],function(_0x4b0820){var _0x5f527c={};_0x5f527c[_0x4b0820]={'$like':'%'+_0x4e9003[_0x9a0e('0x30')][_0x9a0e('0x3b')]+'%'};return _0x5f527c;})});}_0x1a4b2a=_[_0x9a0e('0x3c')]({},_0x1a4b2a,_0x4e9003['options']);return _0xaf56bb[_0x9a0e('0x59')](_0x1a4b2a);}})['then'](function(_0x5a535b){if(_0x5a535b){_0x5b6ce7=_0x5a535b['length'];if(!_0x4e9003['query'][_0x9a0e('0x34')](_0x9a0e('0x35'))){_0x1a4b2a['limit']=qs[_0x9a0e('0x1f')](_0x4e9003[_0x9a0e('0x30')][_0x9a0e('0x1f')]);_0x1a4b2a[_0x9a0e('0x1d')]=qs[_0x9a0e('0x1d')](_0x4e9003['query'][_0x9a0e('0x1d')]);}return _0xaf56bb[_0x9a0e('0x59')](_0x1a4b2a);}})[_0x9a0e('0x24')](function(_0x58c1bc){if(_0x58c1bc){return _0x58c1bc?{'count':_0x5b6ce7,'rows':_0x58c1bc}:null;}})[_0x9a0e('0x24')](respondWithResult(_0x88ad5b,null))[_0x9a0e('0x42')](handleError(_0x88ad5b,null));}; \ No newline at end of file +var _0x4eaa=['set','reject','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','CmCompany','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','user','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x4eaa,0x189));var _0xa4ea=function(_0x25406a,_0x104ad5){_0x25406a=_0x25406a-0x0;var _0x2a18ad=_0x4eaa[_0x25406a];return _0x2a18ad;};'use strict';var emlformat=require(_0xa4ea('0x0'));var rimraf=require(_0xa4ea('0x1'));var zipdir=require(_0xa4ea('0x2'));var jsonpatch=require(_0xa4ea('0x3'));var rp=require('request-promise');var moment=require(_0xa4ea('0x4'));var BPromise=require(_0xa4ea('0x5'));var Mustache=require('mustache');var util=require(_0xa4ea('0x6'));var path=require(_0xa4ea('0x7'));var sox=require(_0xa4ea('0x8'));var csv=require('to-csv');var ejs=require(_0xa4ea('0x9'));var fs=require('fs');var fs_extra=require(_0xa4ea('0xa'));var _=require(_0xa4ea('0xb'));var squel=require('squel');var crypto=require(_0xa4ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa4ea('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa4ea('0xe'));var Papa=require(_0xa4ea('0xf'));var Redis=require('ioredis');var authService=require(_0xa4ea('0x10'));var qs=require(_0xa4ea('0x11'));var as=require(_0xa4ea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa4ea('0x13'));var utils=require(_0xa4ea('0x14'));var config=require(_0xa4ea('0x15'));var licenseUtil=require(_0xa4ea('0x16'));var db=require(_0xa4ea('0x17'))['db'];function respondWithStatusCode(_0x337b23,_0x449713){_0x449713=_0x449713||0xcc;return function(_0x10066e){if(_0x10066e){return _0x337b23[_0xa4ea('0x18')](_0x449713);}return _0x337b23['status'](_0x449713)[_0xa4ea('0x19')]();};}function respondWithResult(_0x5aade3,_0x18afcd){_0x18afcd=_0x18afcd||0xc8;return function(_0x491f32){if(_0x491f32){return _0x5aade3[_0xa4ea('0x1a')](_0x18afcd)[_0xa4ea('0x1b')](_0x491f32);}};}function respondWithFilteredResult(_0x4a32cb,_0x32b764){return function(_0x5368fa){if(_0x5368fa){var _0x1df8e6=typeof _0x32b764[_0xa4ea('0x1c')]===_0xa4ea('0x1d')&&typeof _0x32b764[_0xa4ea('0x1e')]===_0xa4ea('0x1d');var _0x1292ac=_0x5368fa[_0xa4ea('0x1f')];var _0x2eda4c=_0x1df8e6?0x0:_0x32b764[_0xa4ea('0x1c')];var _0x902291=_0x1df8e6?_0x5368fa[_0xa4ea('0x1f')]:_0x32b764['offset']+_0x32b764['limit'];var _0x1add0c;if(_0x902291>=_0x1292ac){_0x902291=_0x1292ac;_0x1add0c=0xc8;}else{_0x1add0c=0xce;}_0x4a32cb[_0xa4ea('0x1a')](_0x1add0c);return _0x4a32cb[_0xa4ea('0x20')]('Content-Range',_0x2eda4c+'-'+_0x902291+'/'+_0x1292ac)['json'](_0x5368fa);}return null;};}function patchUpdates(_0x164a23){return function(_0x4c5418){try{jsonpatch['apply'](_0x4c5418,_0x164a23,!![]);}catch(_0x489106){return BPromise[_0xa4ea('0x21')](_0x489106);}return _0x4c5418[_0xa4ea('0x22')]();};}function saveUpdates(_0x454a24,_0x521390){return function(_0x459f45){if(_0x459f45){return _0x459f45[_0xa4ea('0x23')](_0x454a24)['then'](function(_0x1591c7){return _0x1591c7;});}return null;};}function removeEntity(_0x4cd99e,_0xa4698c){return function(_0x34b3c2){if(_0x34b3c2){return _0x34b3c2['destroy']()[_0xa4ea('0x24')](function(){var _0x404fc0=_0x34b3c2[_0xa4ea('0x25')]({'plain':!![]});var _0x206337=_0xa4ea('0x26');return db[_0xa4ea('0x27')][_0xa4ea('0x28')]({'where':{'type':_0x206337,'resourceId':_0x404fc0['id']}})[_0xa4ea('0x24')](function(){return _0x34b3c2;});})[_0xa4ea('0x24')](function(){_0x4cd99e['status'](0xcc)[_0xa4ea('0x19')]();});}};}function handleEntityNotFound(_0x1968e0,_0x58c6f0){return function(_0x369ea3){if(!_0x369ea3){_0x1968e0['sendStatus'](0x194);}return _0x369ea3;};}function handleError(_0x5e9029,_0x4dc647){_0x4dc647=_0x4dc647||0x1f4;return function(_0x12ef9b){logger[_0xa4ea('0x29')](_0x12ef9b[_0xa4ea('0x2a')]);if(_0x12ef9b['name']){delete _0x12ef9b['name'];}_0x5e9029['status'](_0x4dc647)['send'](_0x12ef9b);};}exports[_0xa4ea('0x2b')]=function(_0x3ef5b,_0x53b72e){var _0x54bb10={},_0x1bde6b={},_0x4f0f53={'count':0x0,'rows':[]};return db['CmCompany'][_0xa4ea('0x2c')]()['then'](function(_0x214fc2){_0x1bde6b[_0xa4ea('0x2d')]=_[_0xa4ea('0x2e')](_0x214fc2);_0x1bde6b[_0xa4ea('0x2f')]=_['keys'](_0x3ef5b[_0xa4ea('0x2f')]);_0x1bde6b[_0xa4ea('0x30')]=_[_0xa4ea('0x31')](_0x1bde6b['model'],_0x1bde6b['query']);_0x54bb10[_0xa4ea('0x32')]=_['intersection'](_0x1bde6b[_0xa4ea('0x2d')],qs[_0xa4ea('0x33')](_0x3ef5b[_0xa4ea('0x2f')][_0xa4ea('0x33')]));_0x54bb10[_0xa4ea('0x32')]=_0x54bb10[_0xa4ea('0x32')][_0xa4ea('0x34')]?_0x54bb10[_0xa4ea('0x32')]:_0x1bde6b[_0xa4ea('0x2d')];if(!_0x3ef5b[_0xa4ea('0x2f')][_0xa4ea('0x35')](_0xa4ea('0x36'))){_0x54bb10[_0xa4ea('0x1e')]=qs['limit'](_0x3ef5b[_0xa4ea('0x2f')][_0xa4ea('0x1e')]);_0x54bb10[_0xa4ea('0x1c')]=qs[_0xa4ea('0x1c')](_0x3ef5b[_0xa4ea('0x2f')][_0xa4ea('0x1c')]);}_0x54bb10[_0xa4ea('0x37')]=qs[_0xa4ea('0x38')](_0x3ef5b[_0xa4ea('0x2f')][_0xa4ea('0x38')]);_0x54bb10[_0xa4ea('0x39')]=qs[_0xa4ea('0x30')](_[_0xa4ea('0x3a')](_0x3ef5b['query'],_0x1bde6b[_0xa4ea('0x30')]),_0x214fc2);if(_0x3ef5b['query'][_0xa4ea('0x3b')]){_0x54bb10['where']=_[_0xa4ea('0x3c')](_0x54bb10[_0xa4ea('0x39')],{'$or':_[_0xa4ea('0x3d')](_0x54bb10[_0xa4ea('0x32')],function(_0x6e678e){var _0x3390cf={};_0x3390cf[_0x6e678e]={'$like':'%'+_0x3ef5b[_0xa4ea('0x2f')][_0xa4ea('0x3b')]+'%'};return _0x3390cf;})});}_0x54bb10=_[_0xa4ea('0x3c')]({},_0x54bb10,_0x3ef5b['options']);var _0x62441d={'where':_0x54bb10['where']};return db[_0xa4ea('0x3e')][_0xa4ea('0x1f')](_0x62441d)[_0xa4ea('0x24')](function(_0x36d737){_0x4f0f53[_0xa4ea('0x1f')]=_0x36d737;if(_0x3ef5b['query'][_0xa4ea('0x3f')]){_0x54bb10['include']=[{'all':!![]}];}return db[_0xa4ea('0x3e')][_0xa4ea('0x40')](_0x54bb10);})['then'](function(_0x5a4a19){_0x4f0f53[_0xa4ea('0x41')]=_0x5a4a19;return _0x4f0f53;})[_0xa4ea('0x24')](respondWithFilteredResult(_0x53b72e,_0x54bb10))[_0xa4ea('0x42')](handleError(_0x53b72e,null));})[_0xa4ea('0x42')](handleError(_0x53b72e,null));};exports['show']=function(_0x26d58a,_0x23df4d){var _0x1e34ae={'raw':![],'where':{'id':_0x26d58a[_0xa4ea('0x43')]['id']}},_0x27fbac={};_0x27fbac[_0xa4ea('0x2d')]=_['keys'](db[_0xa4ea('0x3e')][_0xa4ea('0x44')]);_0x27fbac[_0xa4ea('0x2f')]=_[_0xa4ea('0x2e')](_0x26d58a[_0xa4ea('0x2f')]);_0x27fbac[_0xa4ea('0x30')]=_[_0xa4ea('0x31')](_0x27fbac[_0xa4ea('0x2d')],_0x27fbac['query']);_0x1e34ae[_0xa4ea('0x32')]=_[_0xa4ea('0x31')](_0x27fbac['model'],qs[_0xa4ea('0x33')](_0x26d58a[_0xa4ea('0x2f')]['fields']));_0x1e34ae[_0xa4ea('0x32')]=_0x1e34ae[_0xa4ea('0x32')]['length']?_0x1e34ae[_0xa4ea('0x32')]:_0x27fbac[_0xa4ea('0x2d')];if(_0x26d58a['query'][_0xa4ea('0x3f')]){_0x1e34ae[_0xa4ea('0x45')]=[{'all':!![]}];}_0x1e34ae=_['merge']({},_0x1e34ae,_0x26d58a['options']);return db[_0xa4ea('0x3e')][_0xa4ea('0x46')](_0x1e34ae)[_0xa4ea('0x24')](handleEntityNotFound(_0x23df4d,null))['then'](respondWithResult(_0x23df4d,null))[_0xa4ea('0x42')](handleError(_0x23df4d,null));};exports['create']=function(_0x297769,_0xd6e4df){return db[_0xa4ea('0x3e')][_0xa4ea('0x47')](_0x297769['body'],{})[_0xa4ea('0x24')](function(_0x5a2ee1){var _0x5dc168=_0x297769[_0xa4ea('0x48')][_0xa4ea('0x25')]({'plain':!![]});if(!_0x5dc168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dc168[_0xa4ea('0x49')]===_0xa4ea('0x48')){var _0x22c028=_0x5a2ee1[_0xa4ea('0x25')]({'plain':!![]});var _0x10e625=_0xa4ea('0x26');return db[_0xa4ea('0x4a')][_0xa4ea('0x46')]({'where':{'name':_0x10e625,'userProfileId':_0x5dc168[_0xa4ea('0x4b')]},'raw':!![]})[_0xa4ea('0x24')](function(_0x3f7c86){if(_0x3f7c86&&_0x3f7c86['autoAssociation']===0x0){return db[_0xa4ea('0x27')][_0xa4ea('0x47')]({'name':_0x22c028[_0xa4ea('0x4c')],'resourceId':_0x22c028['id'],'type':_0x3f7c86[_0xa4ea('0x4c')],'sectionId':_0x3f7c86['id']},{})[_0xa4ea('0x24')](function(){return _0x5a2ee1;});}else{return _0x5a2ee1;}})[_0xa4ea('0x42')](function(_0x5516b0){logger[_0xa4ea('0x29')](_0xa4ea('0x4d'),_0x5516b0);throw _0x5516b0;});}return _0x5a2ee1;})[_0xa4ea('0x24')](respondWithResult(_0xd6e4df,0xc9))['catch'](handleError(_0xd6e4df,null));};exports[_0xa4ea('0x23')]=function(_0x153667,_0x5e6436){if(_0x153667[_0xa4ea('0x4e')]['id']){delete _0x153667[_0xa4ea('0x4e')]['id'];}return db[_0xa4ea('0x3e')][_0xa4ea('0x46')]({'where':{'id':_0x153667[_0xa4ea('0x43')]['id']}})[_0xa4ea('0x24')](handleEntityNotFound(_0x5e6436,null))['then'](saveUpdates(_0x153667[_0xa4ea('0x4e')],null))['then'](respondWithResult(_0x5e6436,null))[_0xa4ea('0x42')](handleError(_0x5e6436,null));};exports[_0xa4ea('0x28')]=function(_0x333fb2,_0x3f009f){return db['CmCompany'][_0xa4ea('0x46')]({'where':{'id':_0x333fb2['params']['id']}})[_0xa4ea('0x24')](handleEntityNotFound(_0x3f009f,null))[_0xa4ea('0x24')](removeEntity(_0x3f009f,null))[_0xa4ea('0x42')](handleError(_0x3f009f,null));};exports['describe']=function(_0x5f3abb,_0x2df6a9){return db[_0xa4ea('0x3e')][_0xa4ea('0x2c')]()[_0xa4ea('0x24')](respondWithResult(_0x2df6a9,null))[_0xa4ea('0x42')](handleError(_0x2df6a9,null));};exports[_0xa4ea('0x4f')]=function(_0x11b34a,_0x1e0c09,_0x3edc61){return db[_0xa4ea('0x50')][_0xa4ea('0x46')]({'where':{'id':_0x11b34a['params']['id']}})['then'](handleEntityNotFound(_0x1e0c09,null))[_0xa4ea('0x24')](function(_0x18424c){if(_0x18424c){return _0x18424c[_0xa4ea('0x4f')](_0x11b34a[_0xa4ea('0x4e')][_0xa4ea('0x51')],_[_0xa4ea('0x52')](_0x11b34a[_0xa4ea('0x4e')],['ids','id'])||{});}})[_0xa4ea('0x24')](respondWithResult(_0x1e0c09,null))[_0xa4ea('0x42')](handleError(_0x1e0c09,null));};exports[_0xa4ea('0x53')]=function(_0xe04e50,_0x1ed958,_0x461482){var _0x27c8be={};var _0x2c286a={};var _0x4acef7;var _0x111c43;return db[_0xa4ea('0x3e')][_0xa4ea('0x54')]({'where':{'id':_0xe04e50[_0xa4ea('0x43')]['id']}})[_0xa4ea('0x24')](handleEntityNotFound(_0x1ed958,null))[_0xa4ea('0x24')](function(_0x8a71be){if(_0x8a71be){_0x4acef7=_0x8a71be;_0x2c286a[_0xa4ea('0x2d')]=_['keys'](db[_0xa4ea('0x50')]['rawAttributes']);_0x2c286a[_0xa4ea('0x2f')]=_[_0xa4ea('0x2e')](_0xe04e50[_0xa4ea('0x2f')]);_0x2c286a['filters']=_[_0xa4ea('0x31')](_0x2c286a[_0xa4ea('0x2d')],_0x2c286a['query']);_0x27c8be[_0xa4ea('0x32')]=_['intersection'](_0x2c286a[_0xa4ea('0x2d')],qs[_0xa4ea('0x33')](_0xe04e50['query'][_0xa4ea('0x33')]));_0x27c8be[_0xa4ea('0x32')]=_0x27c8be[_0xa4ea('0x32')][_0xa4ea('0x34')]?_0x27c8be[_0xa4ea('0x32')]:_0x2c286a['model'];_0x27c8be[_0xa4ea('0x37')]=qs[_0xa4ea('0x38')](_0xe04e50[_0xa4ea('0x2f')][_0xa4ea('0x38')]);_0x27c8be[_0xa4ea('0x39')]=qs[_0xa4ea('0x30')](_[_0xa4ea('0x3a')](_0xe04e50[_0xa4ea('0x2f')],_0x2c286a[_0xa4ea('0x30')]));if(_0xe04e50[_0xa4ea('0x2f')][_0xa4ea('0x3b')]){_0x27c8be[_0xa4ea('0x39')]=_[_0xa4ea('0x3c')](_0x27c8be[_0xa4ea('0x39')],{'$or':_[_0xa4ea('0x3d')](_0x27c8be[_0xa4ea('0x32')],function(_0x347776){var _0x3bfed2={};_0x3bfed2[_0x347776]={'$like':'%'+_0xe04e50['query'][_0xa4ea('0x3b')]+'%'};return _0x3bfed2;})});}_0x27c8be=_[_0xa4ea('0x3c')]({},_0x27c8be,_0xe04e50['options']);return _0x4acef7[_0xa4ea('0x53')](_0x27c8be);}})['then'](function(_0x1217c6){if(_0x1217c6){_0x111c43=_0x1217c6[_0xa4ea('0x34')];if(!_0xe04e50[_0xa4ea('0x2f')]['hasOwnProperty'](_0xa4ea('0x36'))){_0x27c8be[_0xa4ea('0x1e')]=qs[_0xa4ea('0x1e')](_0xe04e50['query'][_0xa4ea('0x1e')]);_0x27c8be[_0xa4ea('0x1c')]=qs[_0xa4ea('0x1c')](_0xe04e50[_0xa4ea('0x2f')]['offset']);}return _0x4acef7['getContacts'](_0x27c8be);}})['then'](function(_0x11e4d7){if(_0x11e4d7){return _0x11e4d7?{'count':_0x111c43,'rows':_0x11e4d7}:null;}})[_0xa4ea('0x24')](respondWithResult(_0x1ed958,null))[_0xa4ea('0x42')](handleError(_0x1ed958,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9ef2432..5229684 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 _0x3d63=['api','moment','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x31080a,_0x55b5cd){var _0x58d2fc=function(_0x446558){while(--_0x446558){_0x31080a['push'](_0x31080a['shift']());}};_0x58d2fc(++_0x55b5cd);}(_0x3d63,0xf4));var _0x33d6=function(_0xcfb1a8,_0x5e8548){_0xcfb1a8=_0xcfb1a8-0x0;var _0x181d45=_0x3d63[_0xcfb1a8];return _0x181d45;};'use strict';var _=require(_0x33d6('0x0'));var util=require(_0x33d6('0x1'));var logger=require(_0x33d6('0x2'))(_0x33d6('0x3'));var moment=require(_0x33d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x33d6('0x5'));var fs=require('fs');var path=require(_0x33d6('0x6'));var rimraf=require('rimraf');var config=require(_0x33d6('0x7'));var attributes=require(_0x33d6('0x8'));module[_0x33d6('0x9')]=function(_0x3f9799,_0x1fedf7){return _0x3f9799[_0x33d6('0xa')](_0x33d6('0xb'),attributes,{'tableName':_0x33d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd889=['CmCompany','cm_companies','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./cmCompany.attributes','exports'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0xd889,0x141));var _0x9d88=function(_0x293c92,_0x4fe243){_0x293c92=_0x293c92-0x0;var _0x11dfc4=_0xd889[_0x293c92];return _0x11dfc4;};'use strict';var _=require(_0x9d88('0x0'));var util=require(_0x9d88('0x1'));var logger=require(_0x9d88('0x2'))(_0x9d88('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9d88('0x4'));var fs=require('fs');var path=require(_0x9d88('0x5'));var rimraf=require('rimraf');var config=require(_0x9d88('0x6'));var attributes=require(_0x9d88('0x7'));module[_0x9d88('0x8')]=function(_0x5aca6e,_0x18c363){return _0x5aca6e['define'](_0x9d88('0x9'),attributes,{'tableName':_0x9d88('0xa'),'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 4303e7a..633e101 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 _0x3d80=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','CmCompany,\x20%s,\x20%s','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x2d68f7,_0x534b07){var _0x447e1b=function(_0x29a655){while(--_0x29a655){_0x2d68f7['push'](_0x2d68f7['shift']());}};_0x447e1b(++_0x534b07);}(_0x3d80,0x111));var _0x03d8=function(_0xa8661c,_0x3e5852){_0xa8661c=_0xa8661c-0x0;var _0x205759=_0x3d80[_0xa8661c];return _0x205759;};'use strict';var _=require('lodash');var util=require(_0x03d8('0x0'));var moment=require(_0x03d8('0x1'));var BPromise=require(_0x03d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03d8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x03d8('0x4'));var logger=require(_0x03d8('0x5'))('rpc');var config=require(_0x03d8('0x6'));var jayson=require(_0x03d8('0x7'));var client=jayson['client'][_0x03d8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55d824,_0x7087a3,_0x469bcf){return new BPromise(function(_0x5e32e1,_0xb1b53){return client['request'](_0x55d824,_0x469bcf)[_0x03d8('0x9')](function(_0x57821e){logger[_0x03d8('0xa')]('CmCompany,\x20%s,\x20%s',_0x7087a3,_0x03d8('0xb'));logger[_0x03d8('0xc')](_0x03d8('0xd'),_0x7087a3,_0x03d8('0xb'),JSON[_0x03d8('0xe')](_0x57821e));if(_0x57821e['error']){if(_0x57821e[_0x03d8('0xf')]['code']===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x7087a3,_0x57821e['error'][_0x03d8('0x10')]);return _0xb1b53(_0x57821e['error'][_0x03d8('0x10')]);}logger[_0x03d8('0xf')]('CmCompany,\x20%s,\x20%s',_0x7087a3,_0x57821e['error']['message']);return _0x5e32e1(_0x57821e['error'][_0x03d8('0x10')]);}else{logger['info'](_0x03d8('0x11'),_0x7087a3,'request\x20sent');_0x5e32e1(_0x57821e[_0x03d8('0x12')][_0x03d8('0x10')]);}})['catch'](function(_0x53ae50){logger[_0x03d8('0xf')](_0x03d8('0x11'),_0x7087a3,_0x53ae50);_0xb1b53(_0x53ae50);});});} \ No newline at end of file +var _0xa7d9=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7d9,0x1cb));var _0x9a7d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa7d9[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x9a7d('0x0'));var util=require(_0x9a7d('0x1'));var moment=require(_0x9a7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a7d('0x5'))(_0x9a7d('0x6'));var config=require(_0x9a7d('0x7'));var jayson=require(_0x9a7d('0x8'));var client=jayson[_0x9a7d('0x9')][_0x9a7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x97a24b,_0x840752,_0x28a384){return new BPromise(function(_0x43519a,_0x3849b7){return client[_0x9a7d('0xb')](_0x97a24b,_0x28a384)[_0x9a7d('0xc')](function(_0x76b00c){logger[_0x9a7d('0xd')]('CmCompany,\x20%s,\x20%s',_0x840752,'request\x20sent');logger['debug'](_0x9a7d('0xe'),_0x840752,_0x9a7d('0xf'),JSON[_0x9a7d('0x10')](_0x76b00c));if(_0x76b00c['error']){if(_0x76b00c[_0x9a7d('0x11')]['code']===0x1f4){logger[_0x9a7d('0x11')](_0x9a7d('0x12'),_0x840752,_0x76b00c[_0x9a7d('0x11')]['message']);return _0x3849b7(_0x76b00c['error']['message']);}logger[_0x9a7d('0x11')](_0x9a7d('0x12'),_0x840752,_0x76b00c[_0x9a7d('0x11')][_0x9a7d('0x13')]);return _0x43519a(_0x76b00c[_0x9a7d('0x11')]['message']);}else{logger['info'](_0x9a7d('0x12'),_0x840752,_0x9a7d('0xf'));_0x43519a(_0x76b00c[_0x9a7d('0x14')][_0x9a7d('0x13')]);}})[_0x9a7d('0x15')](function(_0x3cac72){logger['error'](_0x9a7d('0x12'),_0x840752,_0x3cac72);_0x3849b7(_0x3cac72);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b1ec977..8b74e6e 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 _0xbcf3=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3df1a8,_0x14c6a0){var _0x52e372=function(_0x1a8218){while(--_0x1a8218){_0x3df1a8['push'](_0x3df1a8['shift']());}};_0x52e372(++_0x14c6a0);}(_0xbcf3,0x17e));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3bcf('0x0'));var util=require(_0x3bcf('0x1'));var path=require(_0x3bcf('0x2'));var timeout=require(_0x3bcf('0x3'));var express=require(_0x3bcf('0x4'));var router=express[_0x3bcf('0x5')]();var fs_extra=require(_0x3bcf('0x6'));var auth=require(_0x3bcf('0x7'));var interaction=require(_0x3bcf('0x8'));var config=require(_0x3bcf('0x9'));var controller=require('./cmCompany.controller');router[_0x3bcf('0xa')]('/',auth[_0x3bcf('0xb')](),controller[_0x3bcf('0xc')]);router[_0x3bcf('0xa')](_0x3bcf('0xd'),auth[_0x3bcf('0xb')](),controller[_0x3bcf('0xe')]);router[_0x3bcf('0xa')](_0x3bcf('0xf'),auth[_0x3bcf('0xb')](),controller[_0x3bcf('0x10')]);router[_0x3bcf('0xa')]('/:id/contacts',auth[_0x3bcf('0xb')](),controller[_0x3bcf('0x11')]);router[_0x3bcf('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3bcf('0x13'),auth['isAuthenticated'](),controller[_0x3bcf('0x14')]);router[_0x3bcf('0x15')](_0x3bcf('0xf'),auth[_0x3bcf('0xb')](),controller[_0x3bcf('0x16')]);router[_0x3bcf('0x17')](_0x3bcf('0xf'),auth[_0x3bcf('0xb')](),controller[_0x3bcf('0x18')]);module[_0x3bcf('0x19')]=router; \ No newline at end of file +var _0xb486=['./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x10fb7c,_0x1ab5f0){var _0x47c550=function(_0x296e8a){while(--_0x296e8a){_0x10fb7c['push'](_0x10fb7c['shift']());}};_0x47c550(++_0x1ab5f0);}(_0xb486,0x1b0));var _0x6b48=function(_0x245d53,_0x56e09d){_0x245d53=_0x245d53-0x0;var _0x410b78=_0xb486[_0x245d53];return _0x410b78;};'use strict';var multer=require(_0x6b48('0x0'));var util=require(_0x6b48('0x1'));var path=require('path');var timeout=require(_0x6b48('0x2'));var express=require(_0x6b48('0x3'));var router=express[_0x6b48('0x4')]();var fs_extra=require(_0x6b48('0x5'));var auth=require(_0x6b48('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b48('0x7'));var controller=require(_0x6b48('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6b48('0x9')](_0x6b48('0xa'),auth[_0x6b48('0xb')](),controller[_0x6b48('0xc')]);router[_0x6b48('0x9')](_0x6b48('0xd'),auth[_0x6b48('0xb')](),controller['show']);router[_0x6b48('0x9')](_0x6b48('0xe'),auth[_0x6b48('0xb')](),controller[_0x6b48('0xf')]);router[_0x6b48('0x10')]('/',auth[_0x6b48('0xb')](),controller[_0x6b48('0x11')]);router['post'](_0x6b48('0xe'),auth[_0x6b48('0xb')](),controller['addContacts']);router['put'](_0x6b48('0xd'),auth[_0x6b48('0xb')](),controller[_0x6b48('0x12')]);router[_0x6b48('0x13')](_0x6b48('0xd'),auth[_0x6b48('0xb')](),controller[_0x6b48('0x14')]);module[_0x6b48('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2007eda..c419be6 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 _0xa4fe=['lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x318762,_0xe164fe){var _0x22e4bc=function(_0x506940){while(--_0x506940){_0x318762['push'](_0x318762['shift']());}};_0x22e4bc(++_0xe164fe);}(_0xa4fe,0x1d8));var _0xea4f=function(_0xa43ea8,_0x3a5813){_0xa43ea8=_0xa43ea8-0x0;var _0xcd0fbd=_0xa4fe[_0xa43ea8];return _0xcd0fbd;};'use strict';var _=require(_0xea4f('0x0'));var Sequelize=require('sequelize');module[_0xea4f('0x1')]={'firstName':{'type':Sequelize[_0xea4f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xea4f('0x2')]},'street':{'type':Sequelize[_0xea4f('0x2')]},'postalCode':{'type':Sequelize[_0xea4f('0x2')]},'city':{'type':Sequelize[_0xea4f('0x2')]},'country':{'type':Sequelize[_0xea4f('0x2')]},'dateOfBirth':{'type':Sequelize[_0xea4f('0x2')]},'description':{'type':Sequelize[_0xea4f('0x3')]},'phone':{'type':Sequelize[_0xea4f('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xea4f('0x2')]},'url':{'type':Sequelize[_0xea4f('0x2')]},'facebook':{'type':Sequelize[_0xea4f('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xea4f('0x2')]},'skype':{'type':Sequelize[_0xea4f('0x2')]},'teams':{'type':Sequelize[_0xea4f('0x2')]},'viber':{'type':Sequelize[_0xea4f('0x2')]},'line':{'type':Sequelize[_0xea4f('0x2')]},'wechat':{'type':Sequelize[_0xea4f('0x2')]},'telegram':{'type':Sequelize[_0xea4f('0x2')]},'UserId':{'type':Sequelize[_0xea4f('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xea4f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xea4f('0x6')],'defaultValue':Sequelize[_0xea4f('0x7')]}}; \ No newline at end of file +var _0xe416=['STRING','TEXT','INTEGER','DATE','NOW','lodash','sequelize','exports'];(function(_0x3b5341,_0x58c9ba){var _0x245feb=function(_0x51d24f){while(--_0x51d24f){_0x3b5341['push'](_0x3b5341['shift']());}};_0x245feb(++_0x58c9ba);}(_0xe416,0x1b5));var _0x6e41=function(_0x597d5c,_0x209015){_0x597d5c=_0x597d5c-0x0;var _0xe99164=_0xe416[_0x597d5c];return _0xe99164;};'use strict';var _=require(_0x6e41('0x0'));var Sequelize=require(_0x6e41('0x1'));module[_0x6e41('0x2')]={'firstName':{'type':Sequelize[_0x6e41('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x6e41('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6e41('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x6e41('0x3')]},'description':{'type':Sequelize[_0x6e41('0x4')]},'phone':{'type':Sequelize[_0x6e41('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6e41('0x3')]},'email':{'type':Sequelize[_0x6e41('0x3')]},'url':{'type':Sequelize[_0x6e41('0x3')]},'facebook':{'type':Sequelize[_0x6e41('0x3')]},'fb_data':{'type':Sequelize[_0x6e41('0x3')]},'twitter':{'type':Sequelize[_0x6e41('0x3')]},'skype':{'type':Sequelize[_0x6e41('0x3')]},'teams':{'type':Sequelize[_0x6e41('0x3')]},'viber':{'type':Sequelize[_0x6e41('0x3')]},'line':{'type':Sequelize[_0x6e41('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x6e41('0x3')]},'UserId':{'type':Sequelize[_0x6e41('0x5')]},'priority':{'type':Sequelize[_0x6e41('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6e41('0x6')],'defaultValue':Sequelize[_0x6e41('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1da4d79..01c7011 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 _0xf61a=['fullname','DESC','VoiceCallReport','startCase','chat','Account','closedAt','note','disposition','secondDisposition','key','Owner','Tag','browserName','customerIp','customerPort','ratingMessage','ratingValue','referer','subject','externalUrl','threadId','findAndCountAll','flatten','sortBy','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','findOne','trimStart','all','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','fieldType','datetime','buildExpression','text','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','isArray','filter','replace','getFullTextValue','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','having','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','fields','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','tags','displayName','CmCustomField','findAll','columnName','alias','values','merge','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','show','params','$and','omit','format','cf_%d','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','rawAttributes','options','getTags','setTags','ids','getHoppers','ContactId','include','includeAll','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','fork','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','parse','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','sms','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId'];(function(_0x41f493,_0x5601ba){var _0x222469=function(_0x53c38b){while(--_0x53c38b){_0x41f493['push'](_0x41f493['shift']());}};_0x222469(++_0x5601ba);}(_0xf61a,0x146));var _0xaf61=function(_0x15e8a9,_0x307746){_0x15e8a9=_0x15e8a9-0x0;var _0x372db1=_0xf61a[_0x15e8a9];return _0x372db1;};'use strict';var emlformat=require(_0xaf61('0x0'));var rimraf=require(_0xaf61('0x1'));var zipdir=require(_0xaf61('0x2'));var jsonpatch=require(_0xaf61('0x3'));var rp=require(_0xaf61('0x4'));var moment=require(_0xaf61('0x5'));var BPromise=require(_0xaf61('0x6'));var Mustache=require('mustache');var util=require(_0xaf61('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xaf61('0x8'));var ejs=require(_0xaf61('0x9'));var fs=require('fs');var fs_extra=require(_0xaf61('0xa'));var _=require('lodash');var squel=require(_0xaf61('0xb'));var crypto=require(_0xaf61('0xc'));var jsforce=require(_0xaf61('0xd'));var deskjs=require(_0xaf61('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaf61('0xf'));var Papa=require(_0xaf61('0x10'));var Redis=require('ioredis');var authService=require(_0xaf61('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaf61('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf61('0x13'))(_0xaf61('0x14'));var utils=require('../../config/utils');var config=require(_0xaf61('0x15'));var licenseUtil=require(_0xaf61('0x16'));var db=require(_0xaf61('0x17'))['db'];config[_0xaf61('0x18')]=_[_0xaf61('0x19')](config[_0xaf61('0x18')],{'host':_0xaf61('0x1a'),'port':0x18eb});var socket=require(_0xaf61('0x1b'))(new Redis(config[_0xaf61('0x18')]));require(_0xaf61('0x1c'))[_0xaf61('0x1d')](socket);function respondWithStatusCode(_0x100d2c,_0x441be8){_0x441be8=_0x441be8||0xcc;return function(_0x2b4784){if(_0x2b4784){return _0x100d2c['sendStatus'](_0x441be8);}return _0x100d2c[_0xaf61('0x1e')](_0x441be8)[_0xaf61('0x1f')]();};}function respondWithResult(_0x26eac2,_0x5619b0){_0x5619b0=_0x5619b0||0xc8;return function(_0x575df0){if(_0x575df0){return _0x26eac2['status'](_0x5619b0)[_0xaf61('0x20')](_0x575df0);}};}function respondWithFilteredResult(_0x33ba29,_0xb250c5){return function(_0x3b10b9){if(_0x3b10b9){var _0x169422=typeof _0xb250c5[_0xaf61('0x21')]===_0xaf61('0x22')&&typeof _0xb250c5[_0xaf61('0x23')]==='undefined';var _0x343d59=_0x3b10b9[_0xaf61('0x24')];var _0x236b39=_0x169422?0x0:_0xb250c5[_0xaf61('0x21')];var _0x159f1e=_0x169422?_0x3b10b9[_0xaf61('0x24')]:_0xb250c5[_0xaf61('0x21')]+_0xb250c5[_0xaf61('0x23')];var _0x3fc2a1;if(_0x159f1e>=_0x343d59){_0x159f1e=_0x343d59;_0x3fc2a1=0xc8;}else{_0x3fc2a1=0xce;}_0x33ba29[_0xaf61('0x1e')](_0x3fc2a1);return _0x33ba29[_0xaf61('0x25')](_0xaf61('0x26'),_0x236b39+'-'+_0x159f1e+'/'+_0x343d59)[_0xaf61('0x20')](_0x3b10b9);}return null;};}function patchUpdates(_0x1bd21c){return function(_0x1510b5){try{jsonpatch[_0xaf61('0x27')](_0x1510b5,_0x1bd21c,!![]);}catch(_0x522e02){return BPromise[_0xaf61('0x28')](_0x522e02);}return _0x1510b5[_0xaf61('0x29')]();};}function saveUpdates(_0x181050,_0x43f4b4){return function(_0x32bf56){if(_0x32bf56){return _0x32bf56['update'](_0x181050)['then'](function(_0x40775d){return _0x40775d;});}return null;};}function removeEntity(_0x47544a,_0x47d427){return function(_0x45356b){if(_0x45356b){return _0x45356b[_0xaf61('0x2a')]()[_0xaf61('0x2b')](function(){_0x47544a[_0xaf61('0x1e')](0xcc)[_0xaf61('0x1f')]();});}};}function handleEntityNotFound(_0x4f3125,_0x200647){return function(_0x1eb187){if(!_0x1eb187){_0x4f3125['sendStatus'](0x194);}return _0x1eb187;};}function handleError(_0x285aef,_0x5e3735){_0x5e3735=_0x5e3735||0x1f4;return function(_0x356e74){logger[_0xaf61('0x2c')](_0x356e74[_0xaf61('0x2d')]);if(_0x356e74['name']){delete _0x356e74[_0xaf61('0x2e')];}_0x285aef[_0xaf61('0x1e')](_0x5e3735)[_0xaf61('0x2f')](_0x356e74);};}exports[_0xaf61('0x30')]=function(_0x39a87d,_0x336384){var _0x18ef76={},_0x3a8e02={},_0x347069={'count':0x0,'rows':[]};return db[_0xaf61('0x31')][_0xaf61('0x32')]()[_0xaf61('0x2b')](function(_0x4fb693){var _0x12b153=[];for(var _0x708aee=0x0;_0x708aee0x1){_0x1b3563['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xaf61('0x70')](_0xcddd42),null);}else{if(qs[_0xaf61('0x71')](_0xcddd42)){_0x1b3563['or']('c.id\x20LIKE\x20?',_0xcddd42+'%');_0x1b3563['or']('c.phone\x20LIKE\x20?',_0xcddd42+'%');_0x1b3563['or'](_0xaf61('0x72'),_0xcddd42+'%');_0x1b3563['or'](_0xaf61('0x73'),_0xcddd42+'%');}else if(qs[_0xaf61('0x74')](_0xcddd42)){_0x1b3563['or']('c.email\x20LIKE\x20?',_0xcddd42+'%');}else{_0x1b3563['or'](_0xaf61('0x75'),'%'+_0xcddd42+'%');_0x1b3563['or'](_0xaf61('0x76'),'%'+_0xcddd42+'%');_0x1b3563['or'](_0xaf61('0x77'),'%'+_0xcddd42+'%');}}}}_0x56f75a['where'](_0x1b3563);_0x56f75a['group'](_0xaf61('0x78'));var _0x2f71bc={'type':db[_0xaf61('0x79')][_0xaf61('0x7a')][_0xaf61('0x7b')],'raw':!![]};var _0xd087d=_0x56f75a[_0xaf61('0x7c')]()['field'](_0xaf61('0x78'));if(_0x18ef76[_0xaf61('0x43')]){_0x18ef76['order'][_0xaf61('0x5a')](function(_0x3dbcf3){_0x56f75a[_0xaf61('0x43')]('c.'+_0x3dbcf3[0x0],_0x3dbcf3[0x1]==='DESC'?![]:!![]);});}if(!_[_0xaf61('0x67')](_0x36965d)){_0x56f75a[_0xaf61('0x7d')](_0x5f10e8);_0xd087d[_0xaf61('0x45')]('t.id\x20IN\x20?',_0x36965d);}BPromise[_0xaf61('0x7e')]()[_0xaf61('0x2b')](function(){if(!_0x40c731)return;if(_0x39a87d[_0xaf61('0x7f')]['role']!==_0xaf61('0x80'))return;if(!_[_0xaf61('0x81')](_0x40c731[_0xaf61('0x55')],[_0xaf61('0x48'),_0xaf61('0x5d')])){return _0x39a87d[_0xaf61('0x7f')][_0xaf61('0x82')]({'attributes':['id'],'raw':!![]})[_0xaf61('0x2b')](function(_0x2204cf){if(_[_0xaf61('0x67')](_0x2204cf)){_0xd087d[_0xaf61('0x45')](_0xaf61('0x83'));_0x56f75a[_0xaf61('0x45')](_0xaf61('0x83'));}else{_0xd087d['where'](_0xaf61('0x69'),_[_0xaf61('0x59')](_0x2204cf,'id'));_0x56f75a[_0xaf61('0x45')]('c.ListId\x20IN\x20?',_['map'](_0x2204cf,'id'));}});}})[_0xaf61('0x2b')](function(){if(_0x39a87d[_0xaf61('0x7f')]['role']==='agent'&&!_0x40c731&&!_0x39a87d['query']['ListId'])return[];return db[_0xaf61('0x84')][_0xaf61('0x3d')](_0xd087d[_0xaf61('0x85')](),_0x2f71bc);})[_0xaf61('0x2b')](function(_0x4d0108){_0x347069[_0xaf61('0x24')]=_0x4d0108[_0xaf61('0x34')];if(_0x347069[_0xaf61('0x24')]===0x0)return[];return db[_0xaf61('0x84')][_0xaf61('0x3d')](_0x55609a[_0xaf61('0x85')](),_0x2f71bc)[_0xaf61('0x2b')](function(_0x531a0c){_0x1e285a=_['keyBy'](_0x531a0c,'id');_0x2f71bc=_['merge'](_0x2f71bc,{'model':db[_0xaf61('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39a87d[_0xaf61('0x3d')][_0xaf61('0x86')]){_0x18ef76[_0xaf61('0x40')][_0xaf61('0x5a')](function(_0x12e93c){_0x56f75a[_0xaf61('0x48')]('c.'+_0x12e93c);});}else{_0x56f75a['field']('c.id');_0x56f75a[_0xaf61('0x48')](_0xaf61('0x87'));_0x56f75a[_0xaf61('0x48')](_0xaf61('0x88'));_0x56f75a['field'](_0xaf61('0x89'));_0x56f75a[_0xaf61('0x48')](_0xaf61('0x8a'));_0x56f75a['field'](_0xaf61('0x8b'));_0x56f75a[_0xaf61('0x48')](_0xaf61('0x8c'));_0x56f75a[_0xaf61('0x48')]('c.ListId');_0x56f75a[_0xaf61('0x48')](_0xaf61('0x8d'));_0x56f75a[_0xaf61('0x48')](_0xaf61('0x8e'));_0x56f75a[_0xaf61('0x48')](_0xaf61('0x8f'));_0x56f75a['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xaf61('0x90'));}if(_0x18ef76['limit'])_0x56f75a['limit'](_0x18ef76[_0xaf61('0x23')]);if(_0x18ef76[_0xaf61('0x21')])_0x56f75a[_0xaf61('0x21')](_0x18ef76[_0xaf61('0x21')]);return db[_0xaf61('0x84')][_0xaf61('0x3d')](_0x56f75a[_0xaf61('0x85')](),_0x2f71bc);});})['then'](function(_0x487c0f){_0x487c0f[_0xaf61('0x5a')](function(_0x579945){if(_0x579945[_0xaf61('0x90')]){_0x579945[_0xaf61('0x91')]=[];_0x579945[_0xaf61('0x90')][_0xaf61('0x58')](',')['forEach'](function(_0x48655b){_0x579945[_0xaf61('0x91')]['push'](_0x1e285a[_0x48655b]);});}delete _0x579945[_0xaf61('0x90')];});_0x347069[_0xaf61('0x92')]=_0x487c0f;return _0x347069;})['then'](respondWithFilteredResult(_0x336384,_0x18ef76));})['catch'](handleError(_0x336384,null));};exports[_0xaf61('0x2a')]=function(_0x2516b1,_0x39a254){return db[_0xaf61('0x31')][_0xaf61('0x56')]({'where':{'id':_0x2516b1['params']['id']}})['then'](handleEntityNotFound(_0x39a254,null))[_0xaf61('0x2b')](removeEntity(_0x39a254,null))[_0xaf61('0x93')](handleError(_0x39a254,null));};exports[_0xaf61('0x32')]=function(_0x1af064,_0x12b12f){return db[_0xaf61('0x31')][_0xaf61('0x32')]()['then'](function(_0x217eba){delete _0x217eba[_0xaf61('0x94')];for(var _0x6c6852=0x0;_0x6c6852=_0x3381f5){_0x23f3cd=_0x3381f5;_0xb5f338=0xc8;}else{_0xb5f338=0xce;}_0x420274[_0x144b('0x1c')](_0xb5f338);return _0x420274[_0x144b('0x21')](_0x144b('0x22'),_0x3ac198+'-'+_0x23f3cd+'/'+_0x3381f5)[_0x144b('0x23')](_0x254dce);}return null;};}function patchUpdates(_0x36356b){return function(_0x93f21){try{jsonpatch[_0x144b('0x24')](_0x93f21,_0x36356b,!![]);}catch(_0x3e5921){return BPromise['reject'](_0x3e5921);}return _0x93f21[_0x144b('0x25')]();};}function saveUpdates(_0x28da9f,_0x240519){return function(_0x5591c3){if(_0x5591c3){return _0x5591c3[_0x144b('0x26')](_0x28da9f)[_0x144b('0x27')](function(_0xeb6f46){return _0xeb6f46;});}return null;};}function removeEntity(_0x4ffb8f,_0x3c24dd){return function(_0x246d1b){if(_0x246d1b){return _0x246d1b[_0x144b('0x28')]()['then'](function(){_0x4ffb8f[_0x144b('0x1c')](0xcc)[_0x144b('0x1d')]();});}};}function handleEntityNotFound(_0x4e659a,_0x41ada4){return function(_0x28e3e5){if(!_0x28e3e5){_0x4e659a['sendStatus'](0x194);}return _0x28e3e5;};}function handleError(_0x3c8df1,_0x52622d){_0x52622d=_0x52622d||0x1f4;return function(_0x2793cc){logger[_0x144b('0x29')](_0x2793cc[_0x144b('0x2a')]);if(_0x2793cc[_0x144b('0x2b')]){delete _0x2793cc['name'];}_0x3c8df1['status'](_0x52622d)['send'](_0x2793cc);};}exports[_0x144b('0x2c')]=function(_0x5b7899,_0x8504b2){var _0x212380={},_0x3ef85f={},_0x4431fc={'count':0x0,'rows':[]};return db[_0x144b('0x2d')][_0x144b('0x2e')]()[_0x144b('0x27')](function(_0x2f2289){var _0xafc10b=[];for(var _0x1b9ffc=0x0;_0x1b9ffc0x1){_0x5c55f6['or'](_0x144b('0x6a'),qs[_0x144b('0x6b')](_0x18c216),null);}else{if(qs[_0x144b('0x6c')](_0x18c216)){_0x5c55f6['or'](_0x144b('0x6d'),_0x18c216+'%');_0x5c55f6['or'](_0x144b('0x6e'),_0x18c216+'%');_0x5c55f6['or']('c.mobile\x20LIKE\x20?',_0x18c216+'%');_0x5c55f6['or'](_0x144b('0x6f'),_0x18c216+'%');}else if(qs[_0x144b('0x70')](_0x18c216)){_0x5c55f6['or']('c.email\x20LIKE\x20?',_0x18c216+'%');}else{_0x5c55f6['or'](_0x144b('0x71'),'%'+_0x18c216+'%');_0x5c55f6['or'](_0x144b('0x72'),'%'+_0x18c216+'%');_0x5c55f6['or'](_0x144b('0x73'),'%'+_0x18c216+'%');}}}}_0x2067f3['where'](_0x5c55f6);_0x2067f3[_0x144b('0x74')](_0x144b('0x75'));var _0x284fe5={'type':db[_0x144b('0x76')][_0x144b('0x77')][_0x144b('0x78')],'raw':!![]};var _0xbb446f=_0x2067f3[_0x144b('0x79')]()[_0x144b('0x44')](_0x144b('0x75'));if(_0x212380[_0x144b('0x40')]){_0x212380[_0x144b('0x40')][_0x144b('0x52')](function(_0x5b90e4){_0x2067f3['order']('c.'+_0x5b90e4[0x0],_0x5b90e4[0x1]===_0x144b('0x7a')?![]:!![]);});}if(!_[_0x144b('0x62')](_0x5f2ad8)){_0x2067f3[_0x144b('0x7b')](_0x10d601);_0xbb446f['where'](_0x144b('0x7c'),_0x5f2ad8);}BPromise[_0x144b('0x7d')]()[_0x144b('0x27')](function(){if(!_0x17dabd)return;if(_0x5b7899[_0x144b('0x7e')][_0x144b('0x7f')]!==_0x144b('0x80'))return;if(!_[_0x144b('0x81')](_0x17dabd[_0x144b('0x82')],[_0x144b('0x44'),'User'])){return _0x5b7899[_0x144b('0x7e')][_0x144b('0x83')]({'attributes':['id'],'raw':!![]})[_0x144b('0x27')](function(_0x548450){if(_['isEmpty'](_0x548450)){_0xbb446f[_0x144b('0x64')](_0x144b('0x84'));_0x2067f3[_0x144b('0x64')](_0x144b('0x84'));}else{_0xbb446f[_0x144b('0x64')]('c.ListId\x20IN\x20?',_[_0x144b('0x51')](_0x548450,'id'));_0x2067f3[_0x144b('0x64')]('c.ListId\x20IN\x20?',_['map'](_0x548450,'id'));}});}})['then'](function(){if(_0x5b7899[_0x144b('0x7e')]['role']===_0x144b('0x80')&&!_0x17dabd&&!_0x5b7899['query'][_0x144b('0x63')])return[];return db['sequelize'][_0x144b('0x39')](_0xbb446f[_0x144b('0x85')](),_0x284fe5);})['then'](function(_0x372e10){_0x4431fc[_0x144b('0x86')]=_0x372e10[_0x144b('0x30')];if(_0x4431fc[_0x144b('0x86')]===0x0)return[];return db[_0x144b('0x87')][_0x144b('0x39')](_0x2b0e30[_0x144b('0x85')](),_0x284fe5)[_0x144b('0x27')](function(_0x5a68af){_0x539b88=_[_0x144b('0x88')](_0x5a68af,'id');_0x284fe5=_[_0x144b('0x89')](_0x284fe5,{'model':db[_0x144b('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b7899[_0x144b('0x39')][_0x144b('0x3c')]){_0x212380[_0x144b('0x3d')][_0x144b('0x52')](function(_0x95398e){_0x2067f3[_0x144b('0x44')]('c.'+_0x95398e);});}else{_0x2067f3[_0x144b('0x44')](_0x144b('0x75'));_0x2067f3[_0x144b('0x44')]('c.firstName');_0x2067f3[_0x144b('0x44')](_0x144b('0x8a'));_0x2067f3[_0x144b('0x44')](_0x144b('0x8b'));_0x2067f3['field'](_0x144b('0x8c'));_0x2067f3['field'](_0x144b('0x8d'));_0x2067f3[_0x144b('0x44')]('c.email');_0x2067f3[_0x144b('0x44')]('c.ListId');_0x2067f3[_0x144b('0x44')](_0x144b('0x8e'));_0x2067f3[_0x144b('0x44')](_0x144b('0x8f'));_0x2067f3['field']('c.CompanyId');_0x2067f3[_0x144b('0x44')](_0x144b('0x90'),_0x144b('0x91'));}if(_0x212380[_0x144b('0x1f')])_0x2067f3[_0x144b('0x1f')](_0x212380[_0x144b('0x1f')]);if(_0x212380[_0x144b('0x20')])_0x2067f3[_0x144b('0x20')](_0x212380[_0x144b('0x20')]);return db[_0x144b('0x87')][_0x144b('0x39')](_0x2067f3[_0x144b('0x85')](),_0x284fe5);});})[_0x144b('0x27')](function(_0x48e353){_0x48e353[_0x144b('0x52')](function(_0x5a3f52){if(_0x5a3f52[_0x144b('0x91')]){_0x5a3f52[_0x144b('0x92')]=[];_0x5a3f52['TagIds'][_0x144b('0x50')](',')[_0x144b('0x52')](function(_0x287cd5){_0x5a3f52[_0x144b('0x92')][_0x144b('0x60')](_0x539b88[_0x287cd5]);});}delete _0x5a3f52[_0x144b('0x91')];});_0x4431fc[_0x144b('0x93')]=_0x48e353;return _0x4431fc;})[_0x144b('0x27')](respondWithFilteredResult(_0x8504b2,_0x212380));})[_0x144b('0x94')](handleError(_0x8504b2,null));};exports[_0x144b('0x28')]=function(_0x4d4a07,_0x6e26e){return db[_0x144b('0x2d')]['find']({'where':{'id':_0x4d4a07[_0x144b('0x95')]['id']}})[_0x144b('0x27')](handleEntityNotFound(_0x6e26e,null))[_0x144b('0x27')](removeEntity(_0x6e26e,null))[_0x144b('0x94')](handleError(_0x6e26e,null));};exports[_0x144b('0x2e')]=function(_0x2f0d7f,_0x256135){return db['CmContact'][_0x144b('0x2e')]()[_0x144b('0x27')](function(_0x19d8b9){delete _0x19d8b9[_0x144b('0x96')];for(var _0x596f0a=0x0;_0x596f0a{}\s\\|]/g,'-');_0x4d397c(null,util[_0x6e53('0x1e')](_0x6e53('0x1f'),path[_0x6e53('0x20')](_0x34eb82['originalname'],path[_0x6e53('0x21')](_0x34eb82[_0x6e53('0x1d')])),Date[_0x6e53('0x22')](),path[_0x6e53('0x21')](_0x34eb82[_0x6e53('0x1d')])));}})});router[_0x6e53('0x15')](_0x6e53('0x23'),upload['single'](_0x6e53('0x24')),controller[_0x6e53('0x25')]);var upload=multer({'storage':multer[_0x6e53('0x1c')]({'destination':function(_0x1445f1,_0x4c1c34,_0x1ca2a8){_0x1ca2a8(null,path[_0x6e53('0x26')](config[_0x6e53('0x27')],_0x6e53('0x28')));},'filename':function(_0x2e0750,_0x6d1c47,_0x458d10){_0x6d1c47['originalname']=_0x6d1c47['originalname'][_0x6e53('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x458d10(null,util[_0x6e53('0x1e')](_0x6e53('0x1f'),path[_0x6e53('0x20')](_0x6d1c47[_0x6e53('0x1d')],path[_0x6e53('0x21')](_0x6d1c47[_0x6e53('0x1d')])),Date[_0x6e53('0x22')](),path['extname'](_0x6d1c47[_0x6e53('0x1d')])));}})});router['post']('/upload',upload[_0x6e53('0x2a')](_0x6e53('0x24')),controller['upload']);router[_0x6e53('0x15')](_0x6e53('0x2b'),auth[_0x6e53('0xb')](),controller['import']);router['put'](_0x6e53('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6e53('0xf'),auth['isAuthenticated'](),controller[_0x6e53('0x2c')]);module[_0x6e53('0x2d')]=router; \ No newline at end of file +var _0xe316=['show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getJscriptySessions','/:id/journey','getJourney','post','/merge','create','bulkCreate','join','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','server/files/tmp','format','/upload','/upload/:id','import','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','/describe','isAuthenticated','/:id'];(function(_0x59aa84,_0x45284f){var _0x50d0f1=function(_0x5c3af9){while(--_0x5c3af9){_0x59aa84['push'](_0x59aa84['shift']());}};_0x50d0f1(++_0x45284f);}(_0xe316,0x10c));var _0x6e31=function(_0x34cc85,_0x46811b){_0x34cc85=_0x34cc85-0x0;var _0x588b4c=_0xe316[_0x34cc85];return _0x588b4c;};'use strict';var multer=require(_0x6e31('0x0'));var util=require(_0x6e31('0x1'));var path=require(_0x6e31('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e31('0x3'));var router=express[_0x6e31('0x4')]();var fs_extra=require(_0x6e31('0x5'));var auth=require(_0x6e31('0x6'));var interaction=require(_0x6e31('0x7'));var config=require(_0x6e31('0x8'));var controller=require(_0x6e31('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6e31('0xa')](_0x6e31('0xb'),auth[_0x6e31('0xc')](),controller['describe']);router['get'](_0x6e31('0xd'),auth[_0x6e31('0xc')](),controller[_0x6e31('0xe')]);router['get'](_0x6e31('0xf'),auth[_0x6e31('0xc')](),controller[_0x6e31('0x10')]);router['get'](_0x6e31('0x11'),auth[_0x6e31('0xc')](),controller[_0x6e31('0x12')]);router[_0x6e31('0xa')](_0x6e31('0x13'),auth[_0x6e31('0xc')](),controller[_0x6e31('0x14')]);router[_0x6e31('0xa')]('/:id/hopper_finals',auth[_0x6e31('0xc')](),controller['getHopperFinals']);router['get']('/:id/jscripty_sessions',auth['isAuthenticated'](),controller[_0x6e31('0x15')]);router[_0x6e31('0xa')](_0x6e31('0x16'),auth[_0x6e31('0xc')](),controller[_0x6e31('0x17')]);router[_0x6e31('0x18')](_0x6e31('0x19'),auth['isAuthenticated'](),controller['merge']);router['post']('/',auth[_0x6e31('0xc')](),controller[_0x6e31('0x1a')]);router[_0x6e31('0x18')]('/create_many',auth[_0x6e31('0xc')](),controller[_0x6e31('0x1b')]);router[_0x6e31('0x18')]('/:id/tags',auth[_0x6e31('0xc')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc6a662,_0xa377c6,_0x2844fb){_0x2844fb(null,path[_0x6e31('0x1c')](config['root'],'server/files/tmp'));},'filename':function(_0x4db488,_0x217dff,_0x3cd459){_0x217dff['originalname']=_0x217dff[_0x6e31('0x1d')][_0x6e31('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cd459(null,util['format'](_0x6e31('0x1f'),path[_0x6e31('0x20')](_0x217dff[_0x6e31('0x1d')],path[_0x6e31('0x21')](_0x217dff['originalname'])),Date[_0x6e31('0x22')](),path[_0x6e31('0x21')](_0x217dff[_0x6e31('0x1d')])));}})});router[_0x6e31('0x18')](_0x6e31('0x23'),upload[_0x6e31('0x24')](_0x6e31('0x25')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb11cf,_0x142e93,_0x12ebda){_0x12ebda(null,path[_0x6e31('0x1c')](config['root'],_0x6e31('0x26')));},'filename':function(_0x28a5da,_0x1d9f77,_0x3f0a40){_0x1d9f77[_0x6e31('0x1d')]=_0x1d9f77[_0x6e31('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3f0a40(null,util[_0x6e31('0x27')](_0x6e31('0x1f'),path[_0x6e31('0x20')](_0x1d9f77[_0x6e31('0x1d')],path['extname'](_0x1d9f77[_0x6e31('0x1d')])),Date[_0x6e31('0x22')](),path[_0x6e31('0x21')](_0x1d9f77[_0x6e31('0x1d')])));}})});router[_0x6e31('0x18')](_0x6e31('0x28'),upload[_0x6e31('0x24')](_0x6e31('0x25')),controller['upload']);router[_0x6e31('0x18')](_0x6e31('0x29'),auth['isAuthenticated'](),controller[_0x6e31('0x2a')]);router['put'](_0x6e31('0xd'),auth[_0x6e31('0xc')](),controller[_0x6e31('0x2b')]);router[_0x6e31('0x2c')](_0x6e31('0xd'),auth[_0x6e31('0xc')](),controller[_0x6e31('0x2d')]);module[_0x6e31('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8d4dcf2..9bbc631 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 _0x045f=['stringify','ENUM','voice','lodash','exports','getDataValue','alias','STRING','name','TEXT','long','type','select','values','isArray','setDataValue'];(function(_0x493fff,_0x1cfdb6){var _0x2b0b81=function(_0x1c3b46){while(--_0x1c3b46){_0x493fff['push'](_0x493fff['shift']());}};_0x2b0b81(++_0x1cfdb6);}(_0x045f,0x1b3));var _0xf045=function(_0x32e7d6,_0x214dda){_0x32e7d6=_0x32e7d6-0x0;var _0x481e8c=_0x045f[_0x32e7d6];return _0x481e8c;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf045('0x0'));module[_0xf045('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a5eb6){return this[_0xf045('0x2')](_0xf045('0x3'));}},'alias':{'type':Sequelize[_0xf045('0x4')],'allowNull':![],'set':function(_0x5262fd){this['setDataValue'](_0xf045('0x3'),_0x5262fd?_0x5262fd:this[_0xf045('0x2')](_0xf045('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xf045('0x6')](_0xf045('0x7')),'get':function(){if(this[_0xf045('0x2')](_0xf045('0x8'))===_0xf045('0x9')){return JSON['parse'](this[_0xf045('0x2')](_0xf045('0xa')));}else{return this[_0xf045('0x2')](_0xf045('0xa'));}},'set':function(_0x277cba){if(Array[_0xf045('0xb')](_0x277cba)){this[_0xf045('0xc')](_0xf045('0xa'),JSON[_0xf045('0xd')](_0x277cba));}else{this[_0xf045('0xc')](_0xf045('0xa'),_0x277cba);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf045('0xe')](_0xf045('0xf'))}}; \ No newline at end of file +var _0x36e1=['values','isArray','setDataValue','stringify','BOOLEAN','ENUM','lodash','exports','VIRTUAL','getDataValue','alias','name','STRING','long','type','parse'];(function(_0x166676,_0x3319c){var _0x2e7779=function(_0x54d116){while(--_0x54d116){_0x166676['push'](_0x166676['shift']());}};_0x2e7779(++_0x3319c);}(_0x36e1,0x186));var _0x136e=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0x36e1[_0xaf25ae];return _0x49732d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x136e('0x0'));module[_0x136e('0x1')]={'name':{'type':Sequelize[_0x136e('0x2')],'get':function(_0x3233cf){return this[_0x136e('0x3')](_0x136e('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x79018){this['setDataValue'](_0x136e('0x4'),_0x79018?_0x79018:this[_0x136e('0x3')](_0x136e('0x5')));}},'type':{'type':Sequelize[_0x136e('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x136e('0x7')),'get':function(){if(this[_0x136e('0x3')](_0x136e('0x8'))==='select'){return JSON[_0x136e('0x9')](this[_0x136e('0x3')](_0x136e('0xa')));}else{return this[_0x136e('0x3')](_0x136e('0xa'));}},'set':function(_0x47cdb6){if(Array[_0x136e('0xb')](_0x47cdb6)){this[_0x136e('0xc')](_0x136e('0xa'),JSON[_0x136e('0xd')](_0x47cdb6));}else{this['setDataValue'](_0x136e('0xa'),_0x47cdb6);}}},'required':{'type':Sequelize[_0x136e('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x136e('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x136e('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 9b826b6..b0a6adf 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 _0xd945=['name','send','index','map','CmCustomField','fieldName','type','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','find','catch','update','body','create','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','sendStatus','stack'];(function(_0x35872e,_0x30c708){var _0x55b484=function(_0x304371){while(--_0x304371){_0x35872e['push'](_0x35872e['shift']());}};_0x55b484(++_0x30c708);}(_0xd945,0x1b8));var _0x5d94=function(_0x52a3a6,_0x19253f){_0x52a3a6=_0x52a3a6-0x0;var _0x141782=_0xd945[_0x52a3a6];return _0x141782;};'use strict';var emlformat=require(_0x5d94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d94('0x1'));var jsonpatch=require(_0x5d94('0x2'));var rp=require('request-promise');var moment=require(_0x5d94('0x3'));var BPromise=require(_0x5d94('0x4'));var Mustache=require('mustache');var util=require(_0x5d94('0x5'));var path=require(_0x5d94('0x6'));var sox=require(_0x5d94('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d94('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5d94('0x9'));var toCsv=require(_0x5d94('0xa'));var querystring=require('querystring');var Papa=require(_0x5d94('0xb'));var Redis=require(_0x5d94('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5d94('0xd'));var as=require(_0x5d94('0xe'));var hardwareService=require(_0x5d94('0xf'));var logger=require('../../config/logger')(_0x5d94('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5d94('0x11'));var db=require(_0x5d94('0x12'))['db'];function respondWithStatusCode(_0x31b68e,_0x511d05){_0x511d05=_0x511d05||0xcc;return function(_0x4f4060){if(_0x4f4060){return _0x31b68e['sendStatus'](_0x511d05);}return _0x31b68e[_0x5d94('0x13')](_0x511d05)[_0x5d94('0x14')]();};}function respondWithResult(_0x25da19,_0x551df1){_0x551df1=_0x551df1||0xc8;return function(_0x358591){if(_0x358591){return _0x25da19[_0x5d94('0x13')](_0x551df1)[_0x5d94('0x15')](_0x358591);}};}function respondWithFilteredResult(_0x3565a8,_0x5ca905){return function(_0x22b1bc){if(_0x22b1bc){var _0x13b861=typeof _0x5ca905['offset']===_0x5d94('0x16')&&typeof _0x5ca905[_0x5d94('0x17')]===_0x5d94('0x16');var _0x10d8eb=_0x22b1bc[_0x5d94('0x18')];var _0x4a1e02=_0x13b861?0x0:_0x5ca905[_0x5d94('0x19')];var _0x536d3b=_0x13b861?_0x22b1bc['count']:_0x5ca905[_0x5d94('0x19')]+_0x5ca905['limit'];var _0x203c26;if(_0x536d3b>=_0x10d8eb){_0x536d3b=_0x10d8eb;_0x203c26=0xc8;}else{_0x203c26=0xce;}_0x3565a8[_0x5d94('0x13')](_0x203c26);return _0x3565a8['set'](_0x5d94('0x1a'),_0x4a1e02+'-'+_0x536d3b+'/'+_0x10d8eb)['json'](_0x22b1bc);}return null;};}function patchUpdates(_0xa21e7d){return function(_0x16c394){try{jsonpatch[_0x5d94('0x1b')](_0x16c394,_0xa21e7d,!![]);}catch(_0x3bfbe4){return BPromise[_0x5d94('0x1c')](_0x3bfbe4);}return _0x16c394[_0x5d94('0x1d')]();};}function saveUpdates(_0x76d2d3,_0x4da894){return function(_0xc7f32e){if(_0xc7f32e){return _0xc7f32e['update'](_0x76d2d3)[_0x5d94('0x1e')](function(_0xab3d01){return _0xab3d01;});}return null;};}function removeEntity(_0x1efb9f,_0x17a4eb){return function(_0x1e1843){if(_0x1e1843){return _0x1e1843[_0x5d94('0x1f')]()['then'](function(){_0x1efb9f[_0x5d94('0x13')](0xcc)[_0x5d94('0x14')]();});}};}function handleEntityNotFound(_0x3e781a,_0x1b2908){return function(_0x43ca7f){if(!_0x43ca7f){_0x3e781a[_0x5d94('0x20')](0x194);}return _0x43ca7f;};}function handleError(_0x4f22bb,_0x1faa92){_0x1faa92=_0x1faa92||0x1f4;return function(_0x2a2a13){logger['error'](_0x2a2a13[_0x5d94('0x21')]);if(_0x2a2a13[_0x5d94('0x22')]){delete _0x2a2a13['name'];}_0x4f22bb[_0x5d94('0x13')](_0x1faa92)[_0x5d94('0x23')](_0x2a2a13);};}exports[_0x5d94('0x24')]=function(_0x350df9,_0x1cea9d){var _0x4d3c20={},_0x165602={},_0x20c887={'count':0x0,'rows':[]};var _0x46a6f0=_[_0x5d94('0x25')](db[_0x5d94('0x26')]['rawAttributes'],function(_0xd43975){return{'name':_0xd43975[_0x5d94('0x27')],'type':_0xd43975[_0x5d94('0x28')]['key']};});_0x165602[_0x5d94('0x29')]=_[_0x5d94('0x2a')](_[_0x5d94('0x25')](_0x46a6f0,_0x5d94('0x22')),[_0x5d94('0x22')]);_0x165602['query']=_[_0x5d94('0x2b')](_0x350df9[_0x5d94('0x2c')]);_0x165602[_0x5d94('0x2d')]=_[_0x5d94('0x2e')](_0x165602[_0x5d94('0x29')],_0x165602['query']);_0x4d3c20[_0x5d94('0x2f')]=_[_0x5d94('0x2e')](_0x165602[_0x5d94('0x29')],qs[_0x5d94('0x30')](_0x350df9[_0x5d94('0x2c')][_0x5d94('0x30')]));_0x4d3c20[_0x5d94('0x2f')]=_0x4d3c20[_0x5d94('0x2f')][_0x5d94('0x31')]?_0x4d3c20['attributes']:_0x165602[_0x5d94('0x29')];if(!_0x350df9[_0x5d94('0x2c')][_0x5d94('0x32')]('nolimit')){_0x4d3c20[_0x5d94('0x17')]=qs[_0x5d94('0x17')](_0x350df9[_0x5d94('0x2c')][_0x5d94('0x17')]);_0x4d3c20['offset']=qs['offset'](_0x350df9['query'][_0x5d94('0x19')]);}_0x4d3c20['order']=qs[_0x5d94('0x33')](_0x350df9['query']['sort']);_0x4d3c20['where']=qs['filters'](_[_0x5d94('0x34')](_0x350df9[_0x5d94('0x2c')],_0x165602['filters']),_0x46a6f0);if(_0x350df9[_0x5d94('0x2c')][_0x5d94('0x35')]){_0x4d3c20[_0x5d94('0x36')]=_['merge'](_0x4d3c20[_0x5d94('0x36')],{'$or':_[_0x5d94('0x25')](_0x46a6f0,function(_0x45f8b1){if(_0x45f8b1['type']!=='VIRTUAL'){var _0x1cd2b6={};_0x1cd2b6[_0x45f8b1['name']]={'$like':'%'+_0x350df9[_0x5d94('0x2c')][_0x5d94('0x35')]+'%'};return _0x1cd2b6;}})});}_0x4d3c20=_[_0x5d94('0x37')]({},_0x4d3c20,_0x350df9[_0x5d94('0x38')]);var _0x193ba7={'where':_0x4d3c20[_0x5d94('0x36')]};return db[_0x5d94('0x26')][_0x5d94('0x18')](_0x193ba7)[_0x5d94('0x1e')](function(_0x61263b){_0x20c887['count']=_0x61263b;if(_0x350df9['query'][_0x5d94('0x39')]){_0x4d3c20[_0x5d94('0x3a')]=[{'all':!![]}];}return db[_0x5d94('0x26')][_0x5d94('0x3b')](_0x4d3c20);})[_0x5d94('0x1e')](function(_0x303e3d){_0x20c887[_0x5d94('0x3c')]=_0x303e3d;return _0x20c887;})[_0x5d94('0x1e')](respondWithFilteredResult(_0x1cea9d,_0x4d3c20))['catch'](handleError(_0x1cea9d,null));};exports['show']=function(_0x348b13,_0x435633){var _0x32205b={'raw':!![],'where':{'id':_0x348b13[_0x5d94('0x3d')]['id']}},_0x10372b={};_0x10372b[_0x5d94('0x29')]=_[_0x5d94('0x2b')](db['CmCustomField']['rawAttributes']);_0x10372b[_0x5d94('0x2c')]=_[_0x5d94('0x2b')](_0x348b13[_0x5d94('0x2c')]);_0x10372b['filters']=_[_0x5d94('0x2e')](_0x10372b[_0x5d94('0x29')],_0x10372b[_0x5d94('0x2c')]);_0x32205b[_0x5d94('0x2f')]=_['intersection'](_0x10372b[_0x5d94('0x29')],qs[_0x5d94('0x30')](_0x348b13[_0x5d94('0x2c')][_0x5d94('0x30')]));_0x32205b[_0x5d94('0x2f')]=_0x32205b[_0x5d94('0x2f')]['length']?_0x32205b[_0x5d94('0x2f')]:_0x10372b['model'];if(_0x348b13[_0x5d94('0x2c')][_0x5d94('0x39')]){_0x32205b[_0x5d94('0x3a')]=[{'all':!![]}];}_0x32205b=_[_0x5d94('0x37')]({},_0x32205b,_0x348b13[_0x5d94('0x38')]);return db['CmCustomField'][_0x5d94('0x3e')](_0x32205b)['then'](handleEntityNotFound(_0x435633,null))[_0x5d94('0x1e')](respondWithResult(_0x435633,null))[_0x5d94('0x3f')](handleError(_0x435633,null));};exports[_0x5d94('0x40')]=function(_0x288dfd,_0x51729d){if(_0x288dfd[_0x5d94('0x41')]['id']){delete _0x288dfd['body']['id'];}return db['CmCustomField'][_0x5d94('0x3e')]({'where':{'id':_0x288dfd[_0x5d94('0x3d')]['id']}})['then'](handleEntityNotFound(_0x51729d,null))[_0x5d94('0x1e')](saveUpdates(_0x288dfd[_0x5d94('0x41')],null))[_0x5d94('0x1e')](respondWithResult(_0x51729d,null))[_0x5d94('0x3f')](handleError(_0x51729d,null));};exports['destroy']=function(_0x5b5dbf,_0x40b909){return db[_0x5d94('0x26')][_0x5d94('0x3e')]({'where':{'id':_0x5b5dbf[_0x5d94('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40b909,null))[_0x5d94('0x1e')](removeEntity(_0x40b909,null))[_0x5d94('0x3f')](handleError(_0x40b909,null));};exports[_0x5d94('0x42')]=function(_0x3899de,_0x30e9a4){var _0x34ee61;return db[_0x5d94('0x43')][_0x5d94('0x44')](function(_0x49299e){return db[_0x5d94('0x26')][_0x5d94('0x42')](_0x3899de[_0x5d94('0x41')],{'transaction':_0x49299e})[_0x5d94('0x1e')](function(_0x4fb813){_0x34ee61=_0x4fb813;var _0x5d6c04={'type':db[_0x5d94('0x45')][_0x5d94('0x46')],'transaction':_0x49299e};switch(_0x3899de[_0x5d94('0x41')][_0x5d94('0x28')]){case'text':_0x5d6c04[_0x5d94('0x28')]=db[_0x5d94('0x45')]['TEXT'];break;case'number':_0x5d6c04[_0x5d94('0x28')]=db[_0x5d94('0x45')][_0x5d94('0x47')];break;case _0x5d94('0x48'):_0x5d6c04[_0x5d94('0x28')]=db[_0x5d94('0x45')][_0x5d94('0x49')];_0x5d6c04[_0x5d94('0x4a')]=![];break;default:}return db[_0x5d94('0x43')][_0x5d94('0x4b')][_0x5d94('0x4c')](_0x5d94('0x4d'),util[_0x5d94('0x4e')]('cf_%d',_0x34ee61['id']),_0x5d6c04);})[_0x5d94('0x1e')](function(){return _0x34ee61;});})[_0x5d94('0x1e')](respondWithResult(_0x30e9a4,0xc9))[_0x5d94('0x3f')](handleError(_0x30e9a4,null));}; \ No newline at end of file +var _0x3038=['catch','show','params','find','update','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','then','stack','name','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','intersection','attributes','model','fields','length','nolimit','limit','sort','where','filters','filter','merge','options','includeAll','include','findAll'];(function(_0xf335e5,_0x41013d){var _0x19d5b2=function(_0x12b1cc){while(--_0x12b1cc){_0xf335e5['push'](_0xf335e5['shift']());}};_0x19d5b2(++_0x41013d);}(_0x3038,0x1a6));var _0x8303=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x3038[_0x596f6e];return _0x1e0803;};'use strict';var emlformat=require(_0x8303('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8303('0x1'));var jsonpatch=require(_0x8303('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8303('0x3'));var Mustache=require('mustache');var util=require(_0x8303('0x4'));var path=require(_0x8303('0x5'));var sox=require(_0x8303('0x6'));var csv=require(_0x8303('0x7'));var ejs=require(_0x8303('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8303('0x9'));var squel=require(_0x8303('0xa'));var crypto=require('crypto');var jsforce=require(_0x8303('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8303('0x7'));var querystring=require(_0x8303('0xc'));var Papa=require(_0x8303('0xd'));var Redis=require(_0x8303('0xe'));var authService=require(_0x8303('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8303('0x10'))(_0x8303('0x11'));var utils=require(_0x8303('0x12'));var config=require(_0x8303('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x402d75,_0x395cc8){_0x395cc8=_0x395cc8||0xcc;return function(_0x2c8438){if(_0x2c8438){return _0x402d75[_0x8303('0x14')](_0x395cc8);}return _0x402d75['status'](_0x395cc8)['end']();};}function respondWithResult(_0x4a4f0e,_0x431fe2){_0x431fe2=_0x431fe2||0xc8;return function(_0x3abaec){if(_0x3abaec){return _0x4a4f0e[_0x8303('0x15')](_0x431fe2)[_0x8303('0x16')](_0x3abaec);}};}function respondWithFilteredResult(_0x31091b,_0x49d280){return function(_0x610935){if(_0x610935){var _0x4e5fd6=typeof _0x49d280[_0x8303('0x17')]===_0x8303('0x18')&&typeof _0x49d280['limit']===_0x8303('0x18');var _0x55818e=_0x610935[_0x8303('0x19')];var _0x23e387=_0x4e5fd6?0x0:_0x49d280[_0x8303('0x17')];var _0x3d65a8=_0x4e5fd6?_0x610935[_0x8303('0x19')]:_0x49d280[_0x8303('0x17')]+_0x49d280['limit'];var _0x63f812;if(_0x3d65a8>=_0x55818e){_0x3d65a8=_0x55818e;_0x63f812=0xc8;}else{_0x63f812=0xce;}_0x31091b['status'](_0x63f812);return _0x31091b[_0x8303('0x1a')](_0x8303('0x1b'),_0x23e387+'-'+_0x3d65a8+'/'+_0x55818e)[_0x8303('0x16')](_0x610935);}return null;};}function patchUpdates(_0x57db37){return function(_0x15a661){try{jsonpatch[_0x8303('0x1c')](_0x15a661,_0x57db37,!![]);}catch(_0x143df5){return BPromise['reject'](_0x143df5);}return _0x15a661[_0x8303('0x1d')]();};}function saveUpdates(_0x2ef397,_0x826762){return function(_0x1b74ac){if(_0x1b74ac){return _0x1b74ac['update'](_0x2ef397)['then'](function(_0x5273d1){return _0x5273d1;});}return null;};}function removeEntity(_0x22c679,_0x32a0f1){return function(_0xebca89){if(_0xebca89){return _0xebca89['destroy']()[_0x8303('0x1e')](function(){_0x22c679[_0x8303('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32e749,_0x1f457c){return function(_0x5567d3){if(!_0x5567d3){_0x32e749[_0x8303('0x14')](0x194);}return _0x5567d3;};}function handleError(_0x41114c,_0x379522){_0x379522=_0x379522||0x1f4;return function(_0x45072a){logger['error'](_0x45072a[_0x8303('0x1f')]);if(_0x45072a[_0x8303('0x20')]){delete _0x45072a[_0x8303('0x20')];}_0x41114c[_0x8303('0x15')](_0x379522)['send'](_0x45072a);};}exports['index']=function(_0x58d90f,_0x252a61){var _0x5d2b31={},_0x5ebc9b={},_0x13f910={'count':0x0,'rows':[]};var _0x343893=_['map'](db[_0x8303('0x21')][_0x8303('0x22')],function(_0x81b0a0){return{'name':_0x81b0a0[_0x8303('0x23')],'type':_0x81b0a0[_0x8303('0x24')][_0x8303('0x25')]};});_0x5ebc9b['model']=_[_0x8303('0x26')](_[_0x8303('0x27')](_0x343893,_0x8303('0x20')),['name']);_0x5ebc9b[_0x8303('0x28')]=_[_0x8303('0x29')](_0x58d90f[_0x8303('0x28')]);_0x5ebc9b['filters']=_[_0x8303('0x2a')](_0x5ebc9b['model'],_0x5ebc9b[_0x8303('0x28')]);_0x5d2b31[_0x8303('0x2b')]=_[_0x8303('0x2a')](_0x5ebc9b[_0x8303('0x2c')],qs['fields'](_0x58d90f[_0x8303('0x28')][_0x8303('0x2d')]));_0x5d2b31[_0x8303('0x2b')]=_0x5d2b31[_0x8303('0x2b')][_0x8303('0x2e')]?_0x5d2b31[_0x8303('0x2b')]:_0x5ebc9b[_0x8303('0x2c')];if(!_0x58d90f[_0x8303('0x28')]['hasOwnProperty'](_0x8303('0x2f'))){_0x5d2b31[_0x8303('0x30')]=qs[_0x8303('0x30')](_0x58d90f[_0x8303('0x28')][_0x8303('0x30')]);_0x5d2b31[_0x8303('0x17')]=qs[_0x8303('0x17')](_0x58d90f['query']['offset']);}_0x5d2b31['order']=qs['sort'](_0x58d90f[_0x8303('0x28')][_0x8303('0x31')]);_0x5d2b31[_0x8303('0x32')]=qs[_0x8303('0x33')](_['pick'](_0x58d90f[_0x8303('0x28')],_0x5ebc9b[_0x8303('0x33')]),_0x343893);if(_0x58d90f[_0x8303('0x28')][_0x8303('0x34')]){_0x5d2b31['where']=_[_0x8303('0x35')](_0x5d2b31[_0x8303('0x32')],{'$or':_['map'](_0x343893,function(_0x56ff7e){if(_0x56ff7e[_0x8303('0x24')]!=='VIRTUAL'){var _0x3f7ef8={};_0x3f7ef8[_0x56ff7e[_0x8303('0x20')]]={'$like':'%'+_0x58d90f[_0x8303('0x28')][_0x8303('0x34')]+'%'};return _0x3f7ef8;}})});}_0x5d2b31=_['merge']({},_0x5d2b31,_0x58d90f[_0x8303('0x36')]);var _0x575e84={'where':_0x5d2b31['where']};return db['CmCustomField'][_0x8303('0x19')](_0x575e84)[_0x8303('0x1e')](function(_0x5a1c86){_0x13f910['count']=_0x5a1c86;if(_0x58d90f[_0x8303('0x28')][_0x8303('0x37')]){_0x5d2b31[_0x8303('0x38')]=[{'all':!![]}];}return db['CmCustomField'][_0x8303('0x39')](_0x5d2b31);})[_0x8303('0x1e')](function(_0x14f9b9){_0x13f910['rows']=_0x14f9b9;return _0x13f910;})[_0x8303('0x1e')](respondWithFilteredResult(_0x252a61,_0x5d2b31))[_0x8303('0x3a')](handleError(_0x252a61,null));};exports[_0x8303('0x3b')]=function(_0x4bb3fc,_0x1f808d){var _0x4cb858={'raw':!![],'where':{'id':_0x4bb3fc[_0x8303('0x3c')]['id']}},_0x14b731={};_0x14b731[_0x8303('0x2c')]=_[_0x8303('0x29')](db[_0x8303('0x21')]['rawAttributes']);_0x14b731[_0x8303('0x28')]=_['keys'](_0x4bb3fc[_0x8303('0x28')]);_0x14b731[_0x8303('0x33')]=_[_0x8303('0x2a')](_0x14b731[_0x8303('0x2c')],_0x14b731[_0x8303('0x28')]);_0x4cb858[_0x8303('0x2b')]=_[_0x8303('0x2a')](_0x14b731[_0x8303('0x2c')],qs[_0x8303('0x2d')](_0x4bb3fc[_0x8303('0x28')][_0x8303('0x2d')]));_0x4cb858[_0x8303('0x2b')]=_0x4cb858[_0x8303('0x2b')]['length']?_0x4cb858[_0x8303('0x2b')]:_0x14b731[_0x8303('0x2c')];if(_0x4bb3fc[_0x8303('0x28')][_0x8303('0x37')]){_0x4cb858[_0x8303('0x38')]=[{'all':!![]}];}_0x4cb858=_['merge']({},_0x4cb858,_0x4bb3fc[_0x8303('0x36')]);return db[_0x8303('0x21')][_0x8303('0x3d')](_0x4cb858)[_0x8303('0x1e')](handleEntityNotFound(_0x1f808d,null))[_0x8303('0x1e')](respondWithResult(_0x1f808d,null))[_0x8303('0x3a')](handleError(_0x1f808d,null));};exports[_0x8303('0x3e')]=function(_0x53fa56,_0x1b5c13){if(_0x53fa56[_0x8303('0x3f')]['id']){delete _0x53fa56[_0x8303('0x3f')]['id'];}return db[_0x8303('0x21')][_0x8303('0x3d')]({'where':{'id':_0x53fa56[_0x8303('0x3c')]['id']}})[_0x8303('0x1e')](handleEntityNotFound(_0x1b5c13,null))[_0x8303('0x1e')](saveUpdates(_0x53fa56[_0x8303('0x3f')],null))[_0x8303('0x1e')](respondWithResult(_0x1b5c13,null))[_0x8303('0x3a')](handleError(_0x1b5c13,null));};exports['destroy']=function(_0x55c212,_0x4ae871){return db[_0x8303('0x21')][_0x8303('0x3d')]({'where':{'id':_0x55c212[_0x8303('0x3c')]['id']}})[_0x8303('0x1e')](handleEntityNotFound(_0x4ae871,null))[_0x8303('0x1e')](removeEntity(_0x4ae871,null))[_0x8303('0x3a')](handleError(_0x4ae871,null));};exports[_0x8303('0x40')]=function(_0x55a57a,_0x121f76){var _0x4090a3;return db['sequelize'][_0x8303('0x41')](function(_0x182ecf){return db[_0x8303('0x21')][_0x8303('0x40')](_0x55a57a[_0x8303('0x3f')],{'transaction':_0x182ecf})[_0x8303('0x1e')](function(_0x4678cf){_0x4090a3=_0x4678cf;var _0x11a69c={'type':db[_0x8303('0x42')][_0x8303('0x43')],'transaction':_0x182ecf};switch(_0x55a57a['body'][_0x8303('0x24')]){case _0x8303('0x44'):_0x11a69c[_0x8303('0x24')]=db[_0x8303('0x42')][_0x8303('0x43')];break;case _0x8303('0x45'):_0x11a69c[_0x8303('0x24')]=db['Sequelize'][_0x8303('0x46')];break;case _0x8303('0x47'):_0x11a69c[_0x8303('0x24')]=db['Sequelize'][_0x8303('0x48')];_0x11a69c[_0x8303('0x49')]=![];break;default:}return db[_0x8303('0x4a')][_0x8303('0x4b')][_0x8303('0x4c')](_0x8303('0x4d'),util[_0x8303('0x4e')](_0x8303('0x4f'),_0x4090a3['id']),_0x11a69c);})['then'](function(){return _0x4090a3;});})[_0x8303('0x1e')](respondWithResult(_0x121f76,0xc9))[_0x8303('0x3a')](handleError(_0x121f76,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5ad92ec..5d259a6 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 _0x7c44=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','cm_custom_fields'];(function(_0x221f31,_0x5259a0){var _0x20b878=function(_0x1e8a59){while(--_0x1e8a59){_0x221f31['push'](_0x221f31['shift']());}};_0x20b878(++_0x5259a0);}(_0x7c44,0x16b));var _0x47c4=function(_0x24a007,_0x135279){_0x24a007=_0x24a007-0x0;var _0x5175d4=_0x7c44[_0x24a007];return _0x5175d4;};'use strict';var _=require(_0x47c4('0x0'));var util=require('util');var logger=require(_0x47c4('0x1'))(_0x47c4('0x2'));var moment=require(_0x47c4('0x3'));var BPromise=require('bluebird');var rp=require(_0x47c4('0x4'));var fs=require('fs');var path=require(_0x47c4('0x5'));var rimraf=require(_0x47c4('0x6'));var config=require(_0x47c4('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x47c4('0x8')]=function(_0x9b82fb,_0x12d837){return _0x9b82fb[_0x47c4('0x9')]('CmCustomField',attributes,{'tableName':_0x47c4('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67ba=['../../config/environment','define','CmCustomField','lodash','util','api','moment','path','rimraf'];(function(_0x17a232,_0x1569c9){var _0xc333f6=function(_0x23ad18){while(--_0x23ad18){_0x17a232['push'](_0x17a232['shift']());}};_0xc333f6(++_0x1569c9);}(_0x67ba,0x162));var _0xa67b=function(_0x336926,_0x111d92){_0x336926=_0x336926-0x0;var _0x3fcf2b=_0x67ba[_0x336926];return _0x3fcf2b;};'use strict';var _=require(_0xa67b('0x0'));var util=require(_0xa67b('0x1'));var logger=require('../../config/logger')(_0xa67b('0x2'));var moment=require(_0xa67b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa67b('0x4'));var rimraf=require(_0xa67b('0x5'));var config=require(_0xa67b('0x6'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x24bd98,_0x167ece){return _0x24bd98[_0xa67b('0x7')](_0xa67b('0x8'),attributes,{'tableName':'cm_custom_fields','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 37fa528..1eaffe5 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 _0xa4cc=['CmCustomField,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify','code','error'];(function(_0x31fd17,_0x50821b){var _0x2e166d=function(_0x533300){while(--_0x533300){_0x31fd17['push'](_0x31fd17['shift']());}};_0x2e166d(++_0x50821b);}(_0xa4cc,0x134));var _0xca4c=function(_0x17d84f,_0x4b29e3){_0x17d84f=_0x17d84f-0x0;var _0x314944=_0xa4cc[_0x17d84f];return _0x314944;};'use strict';var _=require('lodash');var util=require(_0xca4c('0x0'));var moment=require(_0xca4c('0x1'));var BPromise=require('bluebird');var rs=require(_0xca4c('0x2'));var fs=require('fs');var Redis=require(_0xca4c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xca4c('0x4'));var logger=require('../../config/logger')(_0xca4c('0x5'));var config=require(_0xca4c('0x6'));var jayson=require(_0xca4c('0x7'));var client=jayson[_0xca4c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c4844,_0x450b29,_0x9ba55f){return new BPromise(function(_0x209a1a,_0x4add2a){return client[_0xca4c('0x9')](_0x4c4844,_0x9ba55f)['then'](function(_0x328bfc){logger[_0xca4c('0xa')]('CmCustomField,\x20%s,\x20%s',_0x450b29,_0xca4c('0xb'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x450b29,_0xca4c('0xb'),JSON[_0xca4c('0xc')](_0x328bfc));if(_0x328bfc['error']){if(_0x328bfc['error'][_0xca4c('0xd')]===0x1f4){logger[_0xca4c('0xe')](_0xca4c('0xf'),_0x450b29,_0x328bfc[_0xca4c('0xe')][_0xca4c('0x10')]);return _0x4add2a(_0x328bfc[_0xca4c('0xe')][_0xca4c('0x10')]);}logger[_0xca4c('0xe')](_0xca4c('0xf'),_0x450b29,_0x328bfc[_0xca4c('0xe')][_0xca4c('0x10')]);return _0x209a1a(_0x328bfc[_0xca4c('0xe')][_0xca4c('0x10')]);}else{logger[_0xca4c('0xa')]('CmCustomField,\x20%s,\x20%s',_0x450b29,_0xca4c('0xb'));_0x209a1a(_0x328bfc[_0xca4c('0x11')][_0xca4c('0x10')]);}})[_0xca4c('0x12')](function(_0x544fdb){logger['error']('CmCustomField,\x20%s,\x20%s',_0x450b29,_0x544fdb);_0x4add2a(_0x544fdb);});});} \ No newline at end of file +var _0x0214=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x0214,0xf0));var _0x4021=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x0214[_0x10bcc4];return _0x2da988;};'use strict';var _=require(_0x4021('0x0'));var util=require(_0x4021('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4021('0x2'));var fs=require('fs');var Redis=require(_0x4021('0x3'));var db=require(_0x4021('0x4'))['db'];var utils=require(_0x4021('0x5'));var logger=require('../../config/logger')(_0x4021('0x6'));var config=require(_0x4021('0x7'));var jayson=require(_0x4021('0x8'));var client=jayson[_0x4021('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x400f07,_0x1bd1ca,_0x26da90){return new BPromise(function(_0x514d67,_0x195282){return client[_0x4021('0xa')](_0x400f07,_0x26da90)[_0x4021('0xb')](function(_0x5331d5){logger[_0x4021('0xc')](_0x4021('0xd'),_0x1bd1ca,'request\x20sent');logger[_0x4021('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1bd1ca,_0x4021('0xf'),JSON[_0x4021('0x10')](_0x5331d5));if(_0x5331d5[_0x4021('0x11')]){if(_0x5331d5[_0x4021('0x11')][_0x4021('0x12')]===0x1f4){logger[_0x4021('0x11')](_0x4021('0xd'),_0x1bd1ca,_0x5331d5[_0x4021('0x11')]['message']);return _0x195282(_0x5331d5[_0x4021('0x11')][_0x4021('0x13')]);}logger[_0x4021('0x11')](_0x4021('0xd'),_0x1bd1ca,_0x5331d5[_0x4021('0x11')]['message']);return _0x514d67(_0x5331d5[_0x4021('0x11')][_0x4021('0x13')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x1bd1ca,'request\x20sent');_0x514d67(_0x5331d5[_0x4021('0x14')]['message']);}})[_0x4021('0x15')](function(_0x14939d){logger[_0x4021('0x11')]('CmCustomField,\x20%s,\x20%s',_0x1bd1ca,_0x14939d);_0x195282(_0x14939d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index aed28f6..8850783 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 _0x56a6=['../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0xbfbb2,_0x45f5a9){var _0x82e12=function(_0x23efed){while(--_0x23efed){_0xbfbb2['push'](_0xbfbb2['shift']());}};_0x82e12(++_0x45f5a9);}(_0x56a6,0x17b));var _0x656a=function(_0x44dad5,_0x104af5){_0x44dad5=_0x44dad5-0x0;var _0x1fe1b9=_0x56a6[_0x44dad5];return _0x1fe1b9;};'use strict';var multer=require(_0x656a('0x0'));var util=require(_0x656a('0x1'));var path=require(_0x656a('0x2'));var timeout=require(_0x656a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x656a('0x4'));var auth=require(_0x656a('0x5'));var interaction=require(_0x656a('0x6'));var config=require('../../config/environment');var controller=require(_0x656a('0x7'));router[_0x656a('0x8')]('/',auth[_0x656a('0x9')](),controller['index']);router[_0x656a('0x8')](_0x656a('0xa'),auth[_0x656a('0x9')](),controller['show']);router[_0x656a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x656a('0xc')](_0x656a('0xa'),auth[_0x656a('0x9')](),controller[_0x656a('0xd')]);router['delete'](_0x656a('0xa'),auth[_0x656a('0x9')](),controller[_0x656a('0xe')]);module[_0x656a('0xf')]=router; \ No newline at end of file +var _0xf50b=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','update','delete'];(function(_0x10e457,_0x535790){var _0x584460=function(_0x23892b){while(--_0x23892b){_0x10e457['push'](_0x10e457['shift']());}};_0x584460(++_0x535790);}(_0xf50b,0xc8));var _0xbf50=function(_0x34460a,_0x39f40b){_0x34460a=_0x34460a-0x0;var _0x238591=_0xf50b[_0x34460a];return _0x238591;};'use strict';var multer=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var path=require('path');var timeout=require(_0xbf50('0x2'));var express=require(_0xbf50('0x3'));var router=express[_0xbf50('0x4')]();var fs_extra=require(_0xbf50('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf50('0x6'));var config=require('../../config/environment');var controller=require(_0xbf50('0x7'));router[_0xbf50('0x8')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0xa')]);router[_0xbf50('0x8')](_0xbf50('0xb'),auth[_0xbf50('0x9')](),controller['show']);router[_0xbf50('0xc')]('/',auth[_0xbf50('0x9')](),controller[_0xbf50('0xd')]);router['put']('/:id',auth[_0xbf50('0x9')](),controller[_0xbf50('0xe')]);router[_0xbf50('0xf')]('/:id',auth[_0xbf50('0x9')](),controller[_0xbf50('0x10')]);module[_0xbf50('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 8ff1d92..b4780b4 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 _0xa1d3=['moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0xeb1c75,_0x5a1a4a){var _0x476467=function(_0x239acf){while(--_0x239acf){_0xeb1c75['push'](_0xeb1c75['shift']());}};_0x476467(++_0x5a1a4a);}(_0xa1d3,0xb0));var _0x3a1d=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xa1d3[_0x3b5049];return _0x12454e;};'use strict';var moment=require(_0x3a1d('0x0'));var Sequelize=require(_0x3a1d('0x1'));module[_0x3a1d('0x2')]={'phone':{'type':Sequelize[_0x3a1d('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x3a1d('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3a1d('0x5')],'defaultValue':moment()[_0x3a1d('0x6')](_0x3a1d('0x7'))},'countbusyretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3a1d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3a1d('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x3a1d('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3a1d('0x8')],'unique':_0x3a1d('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3a1d('0xa')},'UserId':{'type':Sequelize[_0x3a1d('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x3a1d('0x8')],'unique':_0x3a1d('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3a1d('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdb2a=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xdb2a,0x183));var _0xadb2=function(_0x5d9b5f,_0x23ef05){_0x5d9b5f=_0x5d9b5f-0x0;var _0x3ed5ba=_0xdb2a[_0x5d9b5f];return _0x3ed5ba;};'use strict';var moment=require(_0xadb2('0x0'));var Sequelize=require(_0xadb2('0x1'));module[_0xadb2('0x2')]={'phone':{'type':Sequelize[_0xadb2('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xadb2('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xadb2('0x5')],'defaultValue':moment()[_0xadb2('0x6')](_0xadb2('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xadb2('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xadb2('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xadb2('0x5')]},'priority':{'type':Sequelize[_0xadb2('0x8')](0x2)[_0xadb2('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xadb2('0x8')],'unique':_0xadb2('0xa')},'ListId':{'type':Sequelize[_0xadb2('0x8')],'unique':_0xadb2('0xa')},'UserId':{'type':Sequelize[_0xadb2('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xadb2('0xa')},'CampaignId':{'type':Sequelize[_0xadb2('0x8')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xadb2('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xadb2('0x8')],'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 88468a1..4410d90 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 _0x2d59=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','concat','filters','$and','$or','$gte','$lt','$lte','$ne','$not','$notBetween','$notIn','$like','$notLike','$notILike','$contains','$contained','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','params','length','include','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','UserId','deleted','format','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','user','getVoiceQueues','preview','dialOrderByScheduledAt','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','scheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','List','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x4036d9,_0x2804ee){var _0x2d0bf1=function(_0x431fa9){while(--_0x431fa9){_0x4036d9['push'](_0x4036d9['shift']());}};_0x2d0bf1(++_0x2804ee);}(_0x2d59,0x104));var _0x92d5=function(_0x5466f3,_0x48a370){_0x5466f3=_0x5466f3-0x0;var _0x24f73c=_0x2d59[_0x5466f3];return _0x24f73c;};'use strict';var emlformat=require(_0x92d5('0x0'));var rimraf=require(_0x92d5('0x1'));var zipdir=require(_0x92d5('0x2'));var jsonpatch=require(_0x92d5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92d5('0x4'));var Mustache=require(_0x92d5('0x5'));var util=require(_0x92d5('0x6'));var path=require(_0x92d5('0x7'));var sox=require('sox');var csv=require(_0x92d5('0x8'));var ejs=require(_0x92d5('0x9'));var fs=require('fs');var fs_extra=require(_0x92d5('0xa'));var _=require(_0x92d5('0xb'));var squel=require(_0x92d5('0xc'));var crypto=require(_0x92d5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x92d5('0xe'));var toCsv=require(_0x92d5('0x8'));var querystring=require('querystring');var Papa=require(_0x92d5('0xf'));var Redis=require(_0x92d5('0x10'));var authService=require(_0x92d5('0x11'));var qs=require(_0x92d5('0x12'));var as=require(_0x92d5('0x13'));var hardwareService=require(_0x92d5('0x14'));var logger=require(_0x92d5('0x15'))(_0x92d5('0x16'));var utils=require(_0x92d5('0x17'));var config=require(_0x92d5('0x18'));var licenseUtil=require(_0x92d5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfc2792,_0x433087){_0x433087=_0x433087||0xcc;return function(_0x5480e8){if(_0x5480e8){return _0xfc2792[_0x92d5('0x1a')](_0x433087);}return _0xfc2792[_0x92d5('0x1b')](_0x433087)['end']();};}function respondWithResult(_0x28c3ca,_0x2d523b){_0x2d523b=_0x2d523b||0xc8;return function(_0x1dfb6e){if(_0x1dfb6e){return _0x28c3ca[_0x92d5('0x1b')](_0x2d523b)[_0x92d5('0x1c')](_0x1dfb6e);}};}function respondWithFilteredResult(_0x54f799,_0x149840){return function(_0x1d05d8){if(_0x1d05d8){var _0x131bc0=typeof _0x149840['offset']===_0x92d5('0x1d')&&typeof _0x149840[_0x92d5('0x1e')]==='undefined';var _0x142108=_0x1d05d8[_0x92d5('0x1f')];var _0x5319c4=_0x131bc0?0x0:_0x149840['offset'];var _0x31d5e7=_0x131bc0?_0x1d05d8[_0x92d5('0x1f')]:_0x149840[_0x92d5('0x20')]+_0x149840[_0x92d5('0x1e')];var _0x1359d6;if(_0x31d5e7>=_0x142108){_0x31d5e7=_0x142108;_0x1359d6=0xc8;}else{_0x1359d6=0xce;}_0x54f799[_0x92d5('0x1b')](_0x1359d6);return _0x54f799['set'](_0x92d5('0x21'),_0x5319c4+'-'+_0x31d5e7+'/'+_0x142108)[_0x92d5('0x1c')](_0x1d05d8);}return null;};}function patchUpdates(_0x2e57e8){return function(_0x2a666a){try{jsonpatch[_0x92d5('0x22')](_0x2a666a,_0x2e57e8,!![]);}catch(_0x3302af){return BPromise[_0x92d5('0x23')](_0x3302af);}return _0x2a666a[_0x92d5('0x24')]();};}function saveUpdates(_0xf501f9,_0x150728){return function(_0x3ca81d){if(_0x3ca81d){return _0x3ca81d[_0x92d5('0x25')](_0xf501f9)['then'](function(_0xea3039){return _0xea3039;});}return null;};}function removeEntity(_0x3b44dd,_0x380a4a){return function(_0x3f0e58){if(_0x3f0e58){return _0x3f0e58[_0x92d5('0x26')]()[_0x92d5('0x27')](function(){_0x3b44dd['status'](0xcc)[_0x92d5('0x28')]();});}};}function handleEntityNotFound(_0x2c5735,_0x205629){return function(_0x353683){if(!_0x353683){_0x2c5735[_0x92d5('0x1a')](0x194);}return _0x353683;};}function handleError(_0x48dd61,_0x126ca2){_0x126ca2=_0x126ca2||0x1f4;return function(_0x507a8e){logger['error'](_0x507a8e[_0x92d5('0x29')]);if(_0x507a8e[_0x92d5('0x2a')]){delete _0x507a8e[_0x92d5('0x2a')];}_0x48dd61[_0x92d5('0x1b')](_0x126ca2)[_0x92d5('0x2b')](_0x507a8e);};}exports['index']=function(_0x1dc2f7,_0x24f0df){var _0x4fb038={},_0x3e67c3={},_0x567283={'count':0x0,'rows':[]};var _0x8c2f30=_[_0x92d5('0x2c')](db[_0x92d5('0x2d')][_0x92d5('0x2e')],function(_0x4b3b54){return{'name':_0x4b3b54[_0x92d5('0x2f')],'type':_0x4b3b54['type'][_0x92d5('0x30')]};});_0x3e67c3[_0x92d5('0x31')]=_[_0x92d5('0x2c')](_0x8c2f30,'name');_0x3e67c3[_0x92d5('0x32')]=_[_0x92d5('0x33')](_0x1dc2f7['query']);_0x3e67c3['filters']=_['intersection'](_0x3e67c3[_0x92d5('0x31')],_0x3e67c3[_0x92d5('0x32')]);_0x3e67c3['filters']=_[_0x92d5('0x34')](_0x3e67c3[_0x92d5('0x35')],[_0x92d5('0x36'),_0x92d5('0x37'),'$gt',_0x92d5('0x38'),_0x92d5('0x39'),_0x92d5('0x3a'),_0x92d5('0x3b'),'$eq',_0x92d5('0x3c'),'$between',_0x92d5('0x3d'),'$in',_0x92d5('0x3e'),_0x92d5('0x3f'),_0x92d5('0x40'),'$iLike',_0x92d5('0x41'),_0x92d5('0x3f'),'$overlap',_0x92d5('0x42'),_0x92d5('0x43'),'$any']);_0x4fb038[_0x92d5('0x44')]=_[_0x92d5('0x45')](_0x3e67c3[_0x92d5('0x31')],qs[_0x92d5('0x46')](_0x1dc2f7['query']['fields']));_0x4fb038[_0x92d5('0x44')]=_0x4fb038[_0x92d5('0x44')]['length']?_0x4fb038[_0x92d5('0x44')]:_0x3e67c3[_0x92d5('0x31')];if(!_0x1dc2f7[_0x92d5('0x32')][_0x92d5('0x47')]('nolimit')){_0x4fb038[_0x92d5('0x1e')]=qs[_0x92d5('0x1e')](_0x1dc2f7['query'][_0x92d5('0x1e')]);_0x4fb038[_0x92d5('0x20')]=qs[_0x92d5('0x20')](_0x1dc2f7['query'][_0x92d5('0x20')]);}_0x4fb038[_0x92d5('0x48')]=qs[_0x92d5('0x49')](_0x1dc2f7[_0x92d5('0x32')][_0x92d5('0x49')]);_0x4fb038[_0x92d5('0x4a')]=qs[_0x92d5('0x35')](_[_0x92d5('0x4b')](_0x1dc2f7['query'],_0x3e67c3['filters']),_0x8c2f30);if(_0x1dc2f7[_0x92d5('0x32')][_0x92d5('0x4c')]){_0x4fb038[_0x92d5('0x4a')]=_[_0x92d5('0x4d')](_0x4fb038['where'],{'$or':_[_0x92d5('0x2c')](_0x8c2f30,function(_0x34dc34){if(_0x34dc34['type']!=='VIRTUAL'){var _0x46de38={};_0x46de38[_0x34dc34[_0x92d5('0x2a')]]={'$like':'%'+_0x1dc2f7['query'][_0x92d5('0x4c')]+'%'};return _0x46de38;}})});}_0x4fb038=_['merge']({},_0x4fb038,_0x1dc2f7[_0x92d5('0x4e')]);var _0x3fa909={'where':_0x4fb038[_0x92d5('0x4a')]};return db['CmHopper'][_0x92d5('0x1f')](_0x3fa909)[_0x92d5('0x27')](function(_0x29e069){_0x567283[_0x92d5('0x1f')]=_0x29e069;if(_0x1dc2f7[_0x92d5('0x32')][_0x92d5('0x4f')]){_0x4fb038['include']=[{'all':!![]}];}return db['CmHopper'][_0x92d5('0x50')](_0x4fb038);})[_0x92d5('0x27')](function(_0xe4d610){_0x567283['rows']=_0xe4d610;return _0x567283;})['then'](respondWithFilteredResult(_0x24f0df,_0x4fb038))[_0x92d5('0x51')](handleError(_0x24f0df,null));};exports['show']=function(_0x587eb2,_0x17beb8){var _0x47a802={'raw':!![],'where':{'id':_0x587eb2[_0x92d5('0x52')]['id']}},_0x18a1fb={};_0x18a1fb[_0x92d5('0x31')]=_[_0x92d5('0x33')](db[_0x92d5('0x2d')][_0x92d5('0x2e')]);_0x18a1fb[_0x92d5('0x32')]=_[_0x92d5('0x33')](_0x587eb2[_0x92d5('0x32')]);_0x18a1fb['filters']=_[_0x92d5('0x45')](_0x18a1fb[_0x92d5('0x31')],_0x18a1fb['query']);_0x47a802['attributes']=_[_0x92d5('0x45')](_0x18a1fb[_0x92d5('0x31')],qs[_0x92d5('0x46')](_0x587eb2['query']['fields']));_0x47a802[_0x92d5('0x44')]=_0x47a802[_0x92d5('0x44')][_0x92d5('0x53')]?_0x47a802['attributes']:_0x18a1fb[_0x92d5('0x31')];if(_0x587eb2['query'][_0x92d5('0x4f')]){_0x47a802[_0x92d5('0x54')]=[{'all':!![]}];}_0x47a802=_[_0x92d5('0x4d')]({},_0x47a802,_0x587eb2[_0x92d5('0x4e')]);return db['CmHopper'][_0x92d5('0x55')](_0x47a802)[_0x92d5('0x27')](handleEntityNotFound(_0x17beb8,null))[_0x92d5('0x27')](respondWithResult(_0x17beb8,null))[_0x92d5('0x51')](handleError(_0x17beb8,null));};exports['create']=function(_0x334649,_0x4281e3){return db[_0x92d5('0x2d')][_0x92d5('0x56')](_0x334649['body'],{})[_0x92d5('0x27')](respondWithResult(_0x4281e3,0xc9))[_0x92d5('0x51')](handleError(_0x4281e3,null));};exports['update']=function(_0xdb1e36,_0x3faaf7){if(_0xdb1e36[_0x92d5('0x57')]['id']){delete _0xdb1e36[_0x92d5('0x57')]['id'];}return db[_0x92d5('0x2d')][_0x92d5('0x55')]({'where':{'id':_0xdb1e36['params']['id']}})['then'](handleEntityNotFound(_0x3faaf7,null))['then'](saveUpdates(_0xdb1e36[_0x92d5('0x57')],null))[_0x92d5('0x27')](respondWithResult(_0x3faaf7,null))[_0x92d5('0x51')](handleError(_0x3faaf7,null));};exports[_0x92d5('0x58')]=function(_0x30e946,_0x57d0d3){return db[_0x92d5('0x2d')]['describe']()[_0x92d5('0x27')](respondWithResult(_0x57d0d3,null))[_0x92d5('0x51')](handleError(_0x57d0d3,null));};exports['destroy']=function(_0x2475c1,_0x1c7188){var _0x332262;return db[_0x92d5('0x2d')][_0x92d5('0x55')]({'where':{'id':_0x2475c1[_0x92d5('0x52')]['id']}})[_0x92d5('0x27')](handleEntityNotFound(_0x1c7188,null))[_0x92d5('0x27')](function(_0x4bfe84){if(_0x4bfe84){return _0x4bfe84[_0x92d5('0x26')]()[_0x92d5('0x27')](function(_0x3a813a){return _0x3a813a;});}})[_0x92d5('0x27')](function(_0x55355b){_0x332262=_0x55355b;if(_0x55355b){if(_0x55355b[_0x92d5('0x59')]||_0x55355b[_0x92d5('0x5a')]){return db[_0x55355b[_0x92d5('0x59')]?_0x92d5('0x5b'):_0x92d5('0x5c')]['find']({'where':{'id':_0x55355b[_0x92d5('0x59')]?_0x55355b[_0x92d5('0x59')]:_0x55355b[_0x92d5('0x5a')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x180160){var _0x434f20={};if(_0x180160){_[_0x92d5('0x4d')](_0x434f20,_['omit'](_0x332262[_0x92d5('0x5d')],[_0x92d5('0x5e'),_0x92d5('0x5f'),'id']));_0x434f20[_0x92d5('0x60')]=0x15;_0x434f20[_0x92d5('0x61')]='deleted';_0x434f20[_0x92d5('0x62')]=_0x180160[_0x92d5('0x2a')];_0x434f20[_0x92d5('0x63')]=_0x2475c1['user'][_0x92d5('0x2a')];_0x434f20[_0x92d5('0x64')]=_0x2475c1['user']['id'];_0x434f20[_0x92d5('0x65')]=!![];_0x434f20['deletedat']=moment()[_0x92d5('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x434f20[_0x92d5('0x67')]=_0x332262['phone'];_0x434f20[_0x92d5('0x68')]=_0x332262['VoiceQueueId']?_0x92d5('0x69'):_0x92d5('0x6a');return db[_0x92d5('0x6b')][_0x92d5('0x55')]({'where':{'id':_0x434f20[_0x92d5('0x6c')]},'attributes':[_0x92d5('0x6d'),_0x92d5('0x6e')]})[_0x92d5('0x27')](function(_0x249b22){if(!_[_0x92d5('0x6f')](_0x1c7188)&&!_[_0x92d5('0x6f')](_0x249b22['firstName'])){_0x434f20[_0x92d5('0x70')]=_0x249b22[_0x92d5('0x6d')];if(!_[_0x92d5('0x6f')](_0x249b22[_0x92d5('0x6e')])){_0x434f20[_0x92d5('0x70')]+='\x20'+_0x249b22[_0x92d5('0x6e')];}}})[_0x92d5('0x71')](function(){return db[_0x92d5('0x72')][_0x92d5('0x56')](_0x434f20);});}})[_0x92d5('0x27')](function(){return _0x1c7188['status'](0xcc)[_0x92d5('0x28')]();})['catch'](handleError(_0x1c7188,null));};exports[_0x92d5('0x73')]=function(_0x197e9c,_0x4e04f4,_0x1a5abc){var _0x361be0=[];return db[_0x92d5('0x6b')][_0x92d5('0x58')]()[_0x92d5('0x27')](function(_0x4397e6){_0x361be0=_[_0x92d5('0x33')](_0x4397e6);return _0x197e9c[_0x92d5('0x74')][_0x92d5('0x75')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x92d5('0x76')},'attributes':['id',_0x92d5('0x77')],'raw':!![]});})['then'](function(_0x591125){if(_0x591125&&_0x591125[_0x92d5('0x53')]){return db['sequelize'][_0x92d5('0x78')](function(_0x18e0ec){var _0x291989={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x92d5('0x66')](_0x92d5('0x79'))},'VoiceQueueId':{'$in':_[_0x92d5('0x2c')](_0x591125,'id')},'$or':[{'UserId':null},{'UserId':_0x197e9c['user']['id']}]};var _0x710b8e=[];if(_0x197e9c[_0x92d5('0x57')][_0x92d5('0x7a')]&&_0x197e9c['body']['direction']===_0x92d5('0x7b')){if(!_['isEmpty'](_0x197e9c[_0x92d5('0x57')][_0x92d5('0x7c')])){_0x291989['id']={'$in':_0x197e9c[_0x92d5('0x57')][_0x92d5('0x7c')]};}_0x710b8e=[[_0x92d5('0x7d'),'ASC'],[_0x92d5('0x7e'),_0x591125[0x0][_0x92d5('0x77')]===_0x92d5('0x7f')?_0x92d5('0x80'):_0x92d5('0x7f')],db[_0x92d5('0x81')][_0x92d5('0x82')](_0x92d5('0x83')),['id',_0x92d5('0x80')]];}else{if(!_['isEmpty'](_0x197e9c['body'][_0x92d5('0x7c')])){_0x291989['id']={'$notIn':_0x197e9c[_0x92d5('0x57')][_0x92d5('0x7c')]};}_0x710b8e=[[_0x92d5('0x7d'),_0x92d5('0x80')],[_0x92d5('0x7e'),_0x591125[0x0][_0x92d5('0x77')]],db[_0x92d5('0x81')][_0x92d5('0x82')](_0x92d5('0x84')),['id',_0x92d5('0x7f')]];}return db['CmHopper'][_0x92d5('0x85')]({'attributes':['id',_0x92d5('0x86')],'where':_0x291989,'order':_0x710b8e,'transaction':_0x18e0ec,'lock':_0x18e0ec[_0x92d5('0x87')][_0x92d5('0x88')],'include':[{'model':db['CmContact'],'as':_0x92d5('0x89'),'attributes':_0x361be0,'include':[{'model':db[_0x92d5('0x8a')],'as':'Company','attributes':['id',_0x92d5('0x2a')]}]},{'model':db['CmList'],'as':_0x92d5('0x8b'),'attributes':['id','name']},{'model':db[_0x92d5('0x5b')],'as':'Queue','attributes':['id',_0x92d5('0x2a'),'dialActive']}]})[_0x92d5('0x27')](function(_0x1fdb07){if(_0x1fdb07){return _0x1fdb07[_0x92d5('0x25')]({'UserId':_0x197e9c['user']['id']},{'transaction':_0x18e0ec});}});});}})[_0x92d5('0x27')](handleEntityNotFound(_0x4e04f4,null))[_0x92d5('0x27')](respondWithResult(_0x4e04f4,null))[_0x92d5('0x51')](handleError(_0x4e04f4,null));};exports[_0x92d5('0x8c')]=function(_0x457c13,_0x406e86,_0x434441){return _0x457c13[_0x92d5('0x74')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x92d5('0x76')},'attributes':['id'],'raw':!![]})[_0x92d5('0x27')](function(_0x1f85a5){if(_0x1f85a5&&_0x1f85a5[_0x92d5('0x53')]){return db[_0x92d5('0x2d')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x92d5('0x66')](_0x92d5('0x79'))},'VoiceQueueId':{'$in':_['map'](_0x1f85a5,'id')},'$or':[{'UserId':null},{'UserId':_0x457c13[_0x92d5('0x74')]['id']}]}});}return 0x0;})[_0x92d5('0x27')](function(_0x905f16){if(!_[_0x92d5('0x6f')](_0x905f16)&&_[_0x92d5('0x8d')](_0x905f16)){return _0x406e86[_0x92d5('0x1b')](0xc8)[_0x92d5('0x1c')]({'contacts':_0x905f16});}else{logger['error'](_0x92d5('0x8e'),_0x92d5('0x8c'),0x194,_0x92d5('0x8f'));_0x406e86[_0x92d5('0x1a')](0x194);}})[_0x92d5('0x51')](handleError(_0x406e86,null));}; \ No newline at end of file +var _0x0714=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','filters','intersection','concat','$and','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$like','$notLike','$notILike','$overlap','$contains','$any','fields','length','attributes','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','keys','getVoiceQueues','outbound','preview','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format'];(function(_0x3ff12f,_0x546507){var _0x178006=function(_0x504c66){while(--_0x504c66){_0x3ff12f['push'](_0x3ff12f['shift']());}};_0x178006(++_0x546507);}(_0x0714,0x127));var _0x4071=function(_0x2910e8,_0x6a6b54){_0x2910e8=_0x2910e8-0x0;var _0x6e5aba=_0x0714[_0x2910e8];return _0x6e5aba;};'use strict';var emlformat=require(_0x4071('0x0'));var rimraf=require(_0x4071('0x1'));var zipdir=require(_0x4071('0x2'));var jsonpatch=require(_0x4071('0x3'));var rp=require(_0x4071('0x4'));var moment=require('moment');var BPromise=require(_0x4071('0x5'));var Mustache=require(_0x4071('0x6'));var util=require(_0x4071('0x7'));var path=require('path');var sox=require(_0x4071('0x8'));var csv=require(_0x4071('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4071('0xa'));var squel=require('squel');var crypto=require(_0x4071('0xb'));var jsforce=require(_0x4071('0xc'));var deskjs=require(_0x4071('0xd'));var toCsv=require(_0x4071('0x9'));var querystring=require('querystring');var Papa=require(_0x4071('0xe'));var Redis=require(_0x4071('0xf'));var authService=require(_0x4071('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4071('0x11'));var hardwareService=require(_0x4071('0x12'));var logger=require('../../config/logger')(_0x4071('0x13'));var utils=require('../../config/utils');var config=require(_0x4071('0x14'));var licenseUtil=require(_0x4071('0x15'));var db=require(_0x4071('0x16'))['db'];function respondWithStatusCode(_0x91447f,_0x4be6c4){_0x4be6c4=_0x4be6c4||0xcc;return function(_0x17f049){if(_0x17f049){return _0x91447f[_0x4071('0x17')](_0x4be6c4);}return _0x91447f[_0x4071('0x18')](_0x4be6c4)[_0x4071('0x19')]();};}function respondWithResult(_0x5680df,_0x55d276){_0x55d276=_0x55d276||0xc8;return function(_0x11b0b9){if(_0x11b0b9){return _0x5680df[_0x4071('0x18')](_0x55d276)['json'](_0x11b0b9);}};}function respondWithFilteredResult(_0x446eb9,_0x349c39){return function(_0x477592){if(_0x477592){var _0x5b8d33=typeof _0x349c39['offset']==='undefined'&&typeof _0x349c39[_0x4071('0x1a')]==='undefined';var _0xae84c6=_0x477592[_0x4071('0x1b')];var _0x1d3b34=_0x5b8d33?0x0:_0x349c39[_0x4071('0x1c')];var _0x489bc9=_0x5b8d33?_0x477592['count']:_0x349c39['offset']+_0x349c39[_0x4071('0x1a')];var _0x4b8e99;if(_0x489bc9>=_0xae84c6){_0x489bc9=_0xae84c6;_0x4b8e99=0xc8;}else{_0x4b8e99=0xce;}_0x446eb9['status'](_0x4b8e99);return _0x446eb9[_0x4071('0x1d')](_0x4071('0x1e'),_0x1d3b34+'-'+_0x489bc9+'/'+_0xae84c6)[_0x4071('0x1f')](_0x477592);}return null;};}function patchUpdates(_0x27b7e9){return function(_0xb621fd){try{jsonpatch[_0x4071('0x20')](_0xb621fd,_0x27b7e9,!![]);}catch(_0x48ae0d){return BPromise[_0x4071('0x21')](_0x48ae0d);}return _0xb621fd[_0x4071('0x22')]();};}function saveUpdates(_0x3af553,_0x4fc3c2){return function(_0x283802){if(_0x283802){return _0x283802[_0x4071('0x23')](_0x3af553)[_0x4071('0x24')](function(_0x3ceb6d){return _0x3ceb6d;});}return null;};}function removeEntity(_0x4e72d0,_0x684015){return function(_0x4ed14b){if(_0x4ed14b){return _0x4ed14b['destroy']()[_0x4071('0x24')](function(){_0x4e72d0[_0x4071('0x18')](0xcc)[_0x4071('0x19')]();});}};}function handleEntityNotFound(_0x20f3a4,_0x4a3c03){return function(_0x47f93b){if(!_0x47f93b){_0x20f3a4[_0x4071('0x17')](0x194);}return _0x47f93b;};}function handleError(_0x44072c,_0x54bcf0){_0x54bcf0=_0x54bcf0||0x1f4;return function(_0x12f574){logger[_0x4071('0x25')](_0x12f574[_0x4071('0x26')]);if(_0x12f574[_0x4071('0x27')]){delete _0x12f574['name'];}_0x44072c[_0x4071('0x18')](_0x54bcf0)[_0x4071('0x28')](_0x12f574);};}exports[_0x4071('0x29')]=function(_0x4dd896,_0x40896c){var _0xea72ab={},_0x21acc6={},_0x5887c2={'count':0x0,'rows':[]};var _0x443050=_[_0x4071('0x2a')](db[_0x4071('0x2b')][_0x4071('0x2c')],function(_0x12c263){return{'name':_0x12c263[_0x4071('0x2d')],'type':_0x12c263['type'][_0x4071('0x2e')]};});_0x21acc6[_0x4071('0x2f')]=_[_0x4071('0x2a')](_0x443050,_0x4071('0x27'));_0x21acc6[_0x4071('0x30')]=_['keys'](_0x4dd896[_0x4071('0x30')]);_0x21acc6[_0x4071('0x31')]=_[_0x4071('0x32')](_0x21acc6[_0x4071('0x2f')],_0x21acc6[_0x4071('0x30')]);_0x21acc6[_0x4071('0x31')]=_[_0x4071('0x33')](_0x21acc6['filters'],[_0x4071('0x34'),_0x4071('0x35'),_0x4071('0x36'),'$gte',_0x4071('0x37'),'$lte',_0x4071('0x38'),_0x4071('0x39'),_0x4071('0x3a'),_0x4071('0x3b'),_0x4071('0x3c'),'$in','$notIn',_0x4071('0x3d'),_0x4071('0x3e'),'$iLike',_0x4071('0x3f'),_0x4071('0x3d'),_0x4071('0x40'),_0x4071('0x41'),'$contained',_0x4071('0x42')]);_0xea72ab['attributes']=_['intersection'](_0x21acc6[_0x4071('0x2f')],qs[_0x4071('0x43')](_0x4dd896[_0x4071('0x30')][_0x4071('0x43')]));_0xea72ab['attributes']=_0xea72ab['attributes'][_0x4071('0x44')]?_0xea72ab[_0x4071('0x45')]:_0x21acc6['model'];if(!_0x4dd896[_0x4071('0x30')]['hasOwnProperty']('nolimit')){_0xea72ab[_0x4071('0x1a')]=qs['limit'](_0x4dd896[_0x4071('0x30')][_0x4071('0x1a')]);_0xea72ab[_0x4071('0x1c')]=qs[_0x4071('0x1c')](_0x4dd896[_0x4071('0x30')][_0x4071('0x1c')]);}_0xea72ab[_0x4071('0x46')]=qs[_0x4071('0x47')](_0x4dd896[_0x4071('0x30')][_0x4071('0x47')]);_0xea72ab[_0x4071('0x48')]=qs['filters'](_[_0x4071('0x49')](_0x4dd896[_0x4071('0x30')],_0x21acc6[_0x4071('0x31')]),_0x443050);if(_0x4dd896['query']['filter']){_0xea72ab[_0x4071('0x48')]=_['merge'](_0xea72ab[_0x4071('0x48')],{'$or':_['map'](_0x443050,function(_0x2f5cbb){if(_0x2f5cbb[_0x4071('0x4a')]!==_0x4071('0x4b')){var _0x105dc2={};_0x105dc2[_0x2f5cbb[_0x4071('0x27')]]={'$like':'%'+_0x4dd896[_0x4071('0x30')][_0x4071('0x4c')]+'%'};return _0x105dc2;}})});}_0xea72ab=_[_0x4071('0x4d')]({},_0xea72ab,_0x4dd896[_0x4071('0x4e')]);var _0x285925={'where':_0xea72ab[_0x4071('0x48')]};return db['CmHopper'][_0x4071('0x1b')](_0x285925)[_0x4071('0x24')](function(_0x317551){_0x5887c2[_0x4071('0x1b')]=_0x317551;if(_0x4dd896[_0x4071('0x30')][_0x4071('0x4f')]){_0xea72ab[_0x4071('0x50')]=[{'all':!![]}];}return db[_0x4071('0x2b')][_0x4071('0x51')](_0xea72ab);})['then'](function(_0x5046e5){_0x5887c2[_0x4071('0x52')]=_0x5046e5;return _0x5887c2;})[_0x4071('0x24')](respondWithFilteredResult(_0x40896c,_0xea72ab))[_0x4071('0x53')](handleError(_0x40896c,null));};exports[_0x4071('0x54')]=function(_0x41b235,_0x4ff49){var _0x52710c={'raw':!![],'where':{'id':_0x41b235[_0x4071('0x55')]['id']}},_0x9bc657={};_0x9bc657['model']=_['keys'](db[_0x4071('0x2b')][_0x4071('0x2c')]);_0x9bc657['query']=_['keys'](_0x41b235[_0x4071('0x30')]);_0x9bc657[_0x4071('0x31')]=_[_0x4071('0x32')](_0x9bc657[_0x4071('0x2f')],_0x9bc657[_0x4071('0x30')]);_0x52710c[_0x4071('0x45')]=_['intersection'](_0x9bc657[_0x4071('0x2f')],qs['fields'](_0x41b235[_0x4071('0x30')][_0x4071('0x43')]));_0x52710c[_0x4071('0x45')]=_0x52710c['attributes'][_0x4071('0x44')]?_0x52710c[_0x4071('0x45')]:_0x9bc657[_0x4071('0x2f')];if(_0x41b235[_0x4071('0x30')][_0x4071('0x4f')]){_0x52710c['include']=[{'all':!![]}];}_0x52710c=_['merge']({},_0x52710c,_0x41b235[_0x4071('0x4e')]);return db[_0x4071('0x2b')][_0x4071('0x56')](_0x52710c)['then'](handleEntityNotFound(_0x4ff49,null))[_0x4071('0x24')](respondWithResult(_0x4ff49,null))[_0x4071('0x53')](handleError(_0x4ff49,null));};exports[_0x4071('0x57')]=function(_0x588123,_0x3e300c){return db['CmHopper'][_0x4071('0x57')](_0x588123[_0x4071('0x58')],{})['then'](respondWithResult(_0x3e300c,0xc9))[_0x4071('0x53')](handleError(_0x3e300c,null));};exports['update']=function(_0x5c88c8,_0x59fe22){if(_0x5c88c8[_0x4071('0x58')]['id']){delete _0x5c88c8[_0x4071('0x58')]['id'];}return db[_0x4071('0x2b')][_0x4071('0x56')]({'where':{'id':_0x5c88c8['params']['id']}})[_0x4071('0x24')](handleEntityNotFound(_0x59fe22,null))[_0x4071('0x24')](saveUpdates(_0x5c88c8[_0x4071('0x58')],null))[_0x4071('0x24')](respondWithResult(_0x59fe22,null))[_0x4071('0x53')](handleError(_0x59fe22,null));};exports[_0x4071('0x59')]=function(_0x37cdd3,_0x3fc6d5){return db[_0x4071('0x2b')][_0x4071('0x59')]()[_0x4071('0x24')](respondWithResult(_0x3fc6d5,null))['catch'](handleError(_0x3fc6d5,null));};exports[_0x4071('0x5a')]=function(_0x2fc03d,_0xdc54f7){var _0x20ff87;return db[_0x4071('0x2b')][_0x4071('0x56')]({'where':{'id':_0x2fc03d[_0x4071('0x55')]['id']}})['then'](handleEntityNotFound(_0xdc54f7,null))[_0x4071('0x24')](function(_0x35cd24){if(_0x35cd24){return _0x35cd24[_0x4071('0x5a')]()[_0x4071('0x24')](function(_0x407423){return _0x407423;});}})[_0x4071('0x24')](function(_0x551922){_0x20ff87=_0x551922;if(_0x551922){if(_0x551922[_0x4071('0x5b')]||_0x551922['CampaignId']){return db[_0x551922[_0x4071('0x5b')]?_0x4071('0x5c'):_0x4071('0x5d')][_0x4071('0x56')]({'where':{'id':_0x551922[_0x4071('0x5b')]?_0x551922[_0x4071('0x5b')]:_0x551922[_0x4071('0x5e')]},'attributes':['id','name'],'raw':!![]});}}})[_0x4071('0x24')](function(_0x136fbf){var _0x5ef833={};if(_0x136fbf){_['merge'](_0x5ef833,_[_0x4071('0x5f')](_0x20ff87[_0x4071('0x60')],['createdAt','updatedAt','id']));_0x5ef833[_0x4071('0x61')]=0x15;_0x5ef833[_0x4071('0x62')]=_0x4071('0x63');_0x5ef833[_0x4071('0x64')]=_0x136fbf[_0x4071('0x27')];_0x5ef833[_0x4071('0x65')]=_0x2fc03d[_0x4071('0x66')]['name'];_0x5ef833[_0x4071('0x67')]=_0x2fc03d[_0x4071('0x66')]['id'];_0x5ef833[_0x4071('0x63')]=!![];_0x5ef833[_0x4071('0x68')]=moment()[_0x4071('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ef833[_0x4071('0x6a')]=_0x20ff87[_0x4071('0x6b')];_0x5ef833[_0x4071('0x6c')]=_0x20ff87[_0x4071('0x5b')]?_0x4071('0x6d'):'ivr';return db[_0x4071('0x6e')]['find']({'where':{'id':_0x5ef833['ContactId']},'attributes':[_0x4071('0x6f'),_0x4071('0x70')]})[_0x4071('0x24')](function(_0x594d62){if(!_[_0x4071('0x71')](_0xdc54f7)&&!_[_0x4071('0x71')](_0x594d62['firstName'])){_0x5ef833[_0x4071('0x72')]=_0x594d62[_0x4071('0x6f')];if(!_['isNil'](_0x594d62[_0x4071('0x70')])){_0x5ef833['calleridname']+='\x20'+_0x594d62[_0x4071('0x70')];}}})['finally'](function(){return db[_0x4071('0x73')][_0x4071('0x57')](_0x5ef833);});}})[_0x4071('0x24')](function(){return _0xdc54f7[_0x4071('0x18')](0xcc)[_0x4071('0x19')]();})[_0x4071('0x53')](handleError(_0xdc54f7,null));};exports[_0x4071('0x74')]=function(_0x15229d,_0xf29ae9,_0xe69ee5){var _0x25bb4f=[];return db[_0x4071('0x6e')][_0x4071('0x59')]()[_0x4071('0x24')](function(_0x50870a){_0x25bb4f=_[_0x4071('0x75')](_0x50870a);return _0x15229d[_0x4071('0x66')][_0x4071('0x76')]({'where':{'type':_0x4071('0x77'),'dialActive':!![],'dialMethod':_0x4071('0x78')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x4071('0x24')](function(_0x4c7a1a){if(_0x4c7a1a&&_0x4c7a1a[_0x4071('0x44')]){return db[_0x4071('0x79')][_0x4071('0x7a')](function(_0x29af2a){var _0x5d07c4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x4071('0x7b'))},'VoiceQueueId':{'$in':_['map'](_0x4c7a1a,'id')},'$or':[{'UserId':null},{'UserId':_0x15229d['user']['id']}]};var _0xd2813f=[];if(_0x15229d[_0x4071('0x58')][_0x4071('0x7c')]&&_0x15229d[_0x4071('0x58')]['direction']===_0x4071('0x7d')){if(!_[_0x4071('0x7e')](_0x15229d['body'][_0x4071('0x7f')])){_0x5d07c4['id']={'$in':_0x15229d['body']['hopperIds']};}_0xd2813f=[[_0x4071('0x80'),_0x4071('0x81')],[_0x4071('0x82'),_0x4c7a1a[0x0][_0x4071('0x83')]===_0x4071('0x81')?'DESC':_0x4071('0x81')],db[_0x4071('0x79')][_0x4071('0x84')](_0x4071('0x85')),['id',_0x4071('0x86')]];}else{if(!_['isEmpty'](_0x15229d['body'][_0x4071('0x7f')])){_0x5d07c4['id']={'$notIn':_0x15229d[_0x4071('0x58')][_0x4071('0x7f')]};}_0xd2813f=[['priority','DESC'],[_0x4071('0x82'),_0x4c7a1a[0x0][_0x4071('0x83')]],db[_0x4071('0x79')]['literal'](_0x4071('0x87')),['id','ASC']];}return db[_0x4071('0x2b')]['findOne']({'attributes':['id',_0x4071('0x88')],'where':_0x5d07c4,'order':_0xd2813f,'transaction':_0x29af2a,'lock':_0x29af2a[_0x4071('0x89')][_0x4071('0x8a')],'include':[{'model':db[_0x4071('0x6e')],'as':_0x4071('0x8b'),'attributes':_0x25bb4f,'include':[{'model':db[_0x4071('0x8c')],'as':_0x4071('0x8d'),'attributes':['id',_0x4071('0x27')]}]},{'model':db[_0x4071('0x8e')],'as':_0x4071('0x8f'),'attributes':['id',_0x4071('0x27')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x4071('0x27'),'dialActive']}]})[_0x4071('0x24')](function(_0x4e8aef){if(_0x4e8aef){return _0x4e8aef[_0x4071('0x23')]({'UserId':_0x15229d[_0x4071('0x66')]['id']},{'transaction':_0x29af2a});}});});}})['then'](handleEntityNotFound(_0xf29ae9,null))[_0x4071('0x24')](respondWithResult(_0xf29ae9,null))[_0x4071('0x53')](handleError(_0xf29ae9,null));};exports[_0x4071('0x90')]=function(_0x1875e3,_0x19e99f,_0x242b93){return _0x1875e3['user'][_0x4071('0x76')]({'where':{'type':_0x4071('0x77'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x4071('0x24')](function(_0x20e4f){if(_0x20e4f&&_0x20e4f[_0x4071('0x44')]){return db[_0x4071('0x2b')][_0x4071('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4071('0x69')](_0x4071('0x7b'))},'VoiceQueueId':{'$in':_[_0x4071('0x2a')](_0x20e4f,'id')},'$or':[{'UserId':null},{'UserId':_0x1875e3['user']['id']}]}});}return 0x0;})[_0x4071('0x24')](function(_0x5e3bf8){if(!_[_0x4071('0x71')](_0x5e3bf8)&&_[_0x4071('0x91')](_0x5e3bf8)){return _0x19e99f[_0x4071('0x18')](0xc8)['json']({'contacts':_0x5e3bf8});}else{logger[_0x4071('0x25')](_0x4071('0x92'),_0x4071('0x90'),0x194,_0x4071('0x93'));_0x19e99f['sendStatus'](0x194);}})['catch'](handleError(_0x19e99f,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 28bd339..5f13f28 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 _0x4c60=['../../config/logger','api','bluebird','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c60,0xc1));var _0x04c6=function(_0x2fb4bf,_0x439ce4){_0x2fb4bf=_0x2fb4bf-0x0;var _0x16f258=_0x4c60[_0x2fb4bf];return _0x16f258;};'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'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x04c6('0xa')]},{'name':_0x04c6('0xb'),'fields':[_0x04c6('0xb')]},{'name':_0x04c6('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x1748c5,_0x16d662){var _0x40a181=function(_0x4caef7){while(--_0x4caef7){_0x1748c5['push'](_0x1748c5['shift']());}};_0x40a181(++_0x16d662);}(_0x2bd8,0x130));var _0x82bd=function(_0x5373c1,_0x55cdc2){_0x5373c1=_0x5373c1-0x0;var _0x1bb719=_0x2bd8[_0x5373c1];return _0x1bb719;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ae3ae81..d42a185 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 _0x50bb=['../../config/environment','jayson/promise','client','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','message','info','result','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowCmHopper','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','order','LOCK','UPDATE','keys','Agent','name','voicePause','length','UserId','push','body','includes','all','GetContactDialer','MoveContactManagedDialer','sequelize','transaction','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x50bb,0x1c6));var _0xb50b=function(_0x572fb4,_0x518463){_0x572fb4=_0x572fb4-0x0;var _0x324b50=_0x50bb[_0x572fb4];return _0x324b50;};'use strict';var _=require(_0xb50b('0x0'));var util=require(_0xb50b('0x1'));var moment=require(_0xb50b('0x2'));var BPromise=require(_0xb50b('0x3'));var rs=require(_0xb50b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb50b('0x5'))['db'];var utils=require(_0xb50b('0x6'));var logger=require('../../config/logger')(_0xb50b('0x7'));var config=require(_0xb50b('0x8'));var jayson=require(_0xb50b('0x9'));var client=jayson[_0xb50b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bdcd7,_0x87869d,_0x6419e3){return new BPromise(function(_0x29e505,_0x341ad6){return client['request'](_0x1bdcd7,_0x6419e3)[_0xb50b('0xb')](function(_0x22f60d){logger['info'](_0xb50b('0xc'),_0x87869d,_0xb50b('0xd'));logger[_0xb50b('0xe')](_0xb50b('0xf'),_0x87869d,_0xb50b('0xd'),JSON['stringify'](_0x22f60d));if(_0x22f60d[_0xb50b('0x10')]){if(_0x22f60d[_0xb50b('0x10')]['code']===0x1f4){logger[_0xb50b('0x10')](_0xb50b('0xc'),_0x87869d,_0x22f60d[_0xb50b('0x10')]['message']);return _0x341ad6(_0x22f60d[_0xb50b('0x10')][_0xb50b('0x11')]);}logger[_0xb50b('0x10')](_0xb50b('0xc'),_0x87869d,_0x22f60d[_0xb50b('0x10')][_0xb50b('0x11')]);return _0x29e505(_0x22f60d[_0xb50b('0x10')][_0xb50b('0x11')]);}else{logger[_0xb50b('0x12')]('CmHopper,\x20%s,\x20%s',_0x87869d,_0xb50b('0xd'));_0x29e505(_0x22f60d[_0xb50b('0x13')][_0xb50b('0x11')]);}})['catch'](function(_0x54952f){logger[_0xb50b('0x10')]('CmHopper,\x20%s,\x20%s',_0x87869d,_0x54952f);_0x341ad6(_0x54952f);});});}exports[_0xb50b('0x14')]=function(_0x5aa1f6){var _0x4aa680=this;return new Promise(function(_0x26fa7b,_0x118677){return db[_0xb50b('0x15')][_0xb50b('0x16')]({'raw':_0x5aa1f6[_0xb50b('0x17')]?_0x5aa1f6['options'][_0xb50b('0x18')]===undefined?!![]:![]:!![],'where':_0x5aa1f6['options']?_0x5aa1f6[_0xb50b('0x17')][_0xb50b('0x19')]||null:null,'attributes':_0x5aa1f6['options']?_0x5aa1f6['options']['attributes']||null:null,'limit':_0x5aa1f6['options']?_0x5aa1f6[_0xb50b('0x17')][_0xb50b('0x1a')]||null:null,'include':_0x5aa1f6['options']?_0x5aa1f6[_0xb50b('0x17')][_0xb50b('0x1b')]?_[_0xb50b('0x1c')](_0x5aa1f6[_0xb50b('0x17')]['include'],function(_0x4fa830){return{'model':db[_0x4fa830[_0xb50b('0x1d')]],'as':_0x4fa830['as'],'attributes':_0x4fa830[_0xb50b('0x1e')],'include':_0x4fa830['include']?_[_0xb50b('0x1c')](_0x4fa830[_0xb50b('0x1b')],function(_0x547ba5){return{'model':db[_0x547ba5['model']],'as':_0x547ba5['as'],'attributes':_0x547ba5[_0xb50b('0x1e')],'include':_0x547ba5[_0xb50b('0x1b')]?_[_0xb50b('0x1c')](_0x547ba5['include'],function(_0x3ba8b2){return{'model':db[_0x3ba8b2[_0xb50b('0x1d')]],'as':_0x3ba8b2['as'],'attributes':_0x3ba8b2[_0xb50b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb50b('0xb')](function(_0xeaa899){logger[_0xb50b('0x12')](_0xb50b('0x14'),_0x5aa1f6);logger[_0xb50b('0xe')](_0xb50b('0x14'),_0x5aa1f6,JSON[_0xb50b('0x1f')](_0xeaa899));_0x26fa7b(_0xeaa899);})[_0xb50b('0x20')](function(_0xc70a38){logger['error'](_0xb50b('0x14'),_0xc70a38[_0xb50b('0x11')],_0x5aa1f6);_0x118677(_0x4aa680[_0xb50b('0x10')](0x1f4,_0xc70a38[_0xb50b('0x11')]));});});};exports[_0xb50b('0x21')]=function(_0xd81c71){var _0x335a71=this;return new Promise(function(_0x21a4cb,_0x20ce31){return db[_0xb50b('0x15')]['find']({'raw':_0xd81c71[_0xb50b('0x17')]?_0xd81c71[_0xb50b('0x17')][_0xb50b('0x18')]===undefined?!![]:![]:!![],'where':_0xd81c71[_0xb50b('0x17')]?_0xd81c71[_0xb50b('0x17')][_0xb50b('0x19')]||null:null,'attributes':_0xd81c71[_0xb50b('0x17')]?_0xd81c71[_0xb50b('0x17')][_0xb50b('0x1e')]||null:null,'include':_0xd81c71['options']?_0xd81c71[_0xb50b('0x17')][_0xb50b('0x1b')]?_[_0xb50b('0x1c')](_0xd81c71[_0xb50b('0x17')][_0xb50b('0x1b')],function(_0x4214fe){return{'model':db[_0x4214fe[_0xb50b('0x1d')]],'as':_0x4214fe['as'],'attributes':_0x4214fe[_0xb50b('0x1e')],'include':_0x4214fe[_0xb50b('0x1b')]?_[_0xb50b('0x1c')](_0x4214fe[_0xb50b('0x1b')],function(_0x18979c){return{'model':db[_0x18979c[_0xb50b('0x1d')]],'as':_0x18979c['as'],'attributes':_0x18979c['attributes'],'include':_0x18979c[_0xb50b('0x1b')]?_['map'](_0x18979c['include'],function(_0x1ad1f8){return{'model':db[_0x1ad1f8['model']],'as':_0x1ad1f8['as'],'attributes':_0x1ad1f8[_0xb50b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb50b('0xb')](function(_0x41aa3d){logger['info'](_0xb50b('0x21'),_0xd81c71);logger[_0xb50b('0xe')](_0xb50b('0x21'),_0xd81c71,JSON[_0xb50b('0x1f')](_0x41aa3d));_0x21a4cb(_0x41aa3d);})['catch'](function(_0x2bb515){logger[_0xb50b('0x10')](_0xb50b('0x21'),_0x2bb515[_0xb50b('0x11')],_0xd81c71);_0x20ce31(_0x335a71[_0xb50b('0x10')](0x1f4,_0x2bb515[_0xb50b('0x11')]));});});};exports[_0xb50b('0x22')]=function(_0x30abd7){var _0x3fbfba=this;return new Promise(function(_0xb80411,_0x1f354f){return db['CmHopper']['create'](_0x30abd7['body'],{'raw':_0x30abd7['options']?_0x30abd7['options'][_0xb50b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55ed50){logger[_0xb50b('0x12')](_0xb50b('0x22'),_0x30abd7);logger[_0xb50b('0xe')](_0xb50b('0x22'),_0x30abd7,JSON['stringify'](_0x55ed50));_0xb80411(_0x55ed50);})[_0xb50b('0x20')](function(_0x119c88){logger[_0xb50b('0x10')](_0xb50b('0x22'),_0x119c88[_0xb50b('0x11')],_0x30abd7);_0x1f354f(_0x3fbfba[_0xb50b('0x10')](0x1f4,_0x119c88['message']));});});};exports[_0xb50b('0x23')]=function(_0x5204f7){var _0x4fa761=this;return new Promise(function(_0xd9bd4c,_0x17721f){return db[_0xb50b('0x15')][_0xb50b('0x24')](_0x5204f7['body'],{'raw':_0x5204f7[_0xb50b('0x17')]?_0x5204f7['options'][_0xb50b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5204f7['options']?_0x5204f7[_0xb50b('0x17')][_0xb50b('0x19')]||null:null,'attributes':_0x5204f7[_0xb50b('0x17')]?_0x5204f7[_0xb50b('0x17')][_0xb50b('0x1e')]||null:null,'limit':_0x5204f7['options']?_0x5204f7[_0xb50b('0x17')][_0xb50b('0x1a')]||null:null})[_0xb50b('0xb')](function(_0xbb472e){logger[_0xb50b('0x12')](_0xb50b('0x23'),_0x5204f7);logger[_0xb50b('0xe')](_0xb50b('0x23'),_0x5204f7,JSON['stringify'](_0xbb472e));_0xd9bd4c(_0xbb472e);})[_0xb50b('0x20')](function(_0x3d0f74){logger[_0xb50b('0x10')](_0xb50b('0x23'),_0x3d0f74[_0xb50b('0x11')],_0x5204f7);_0x17721f(_0x4fa761[_0xb50b('0x10')](0x1f4,_0x3d0f74[_0xb50b('0x11')]));});});};exports[_0xb50b('0x25')]=function(_0x572eea){var _0x15c3eb=this;return new Promise(function(_0x5b0353,_0x45eb41){return db[_0xb50b('0x15')][_0xb50b('0x26')]({'where':_0x572eea[_0xb50b('0x17')]?_0x572eea['options'][_0xb50b('0x19')]||null:null})['then'](function(_0x943480){logger[_0xb50b('0x12')](_0xb50b('0x25'),_0x572eea);logger[_0xb50b('0xe')](_0xb50b('0x25'),_0x572eea,JSON['stringify'](_0x943480));_0x5b0353(_0x943480);})[_0xb50b('0x20')](function(_0x301237){logger[_0xb50b('0x10')](_0xb50b('0x25'),_0x301237[_0xb50b('0x11')],_0x572eea);_0x45eb41(_0x15c3eb[_0xb50b('0x10')](0x1f4,_0x301237[_0xb50b('0x11')]));});});};exports['GetContactDialer']=function(_0x1a5d93){var _0x13fcc0=this;return new Promise(function(_0x58c7f3,_0x5f401f){return db[_0xb50b('0x27')][_0xb50b('0x28')]()[_0xb50b('0xb')](function(_0x1251e7){return db['sequelize']['transaction'](function(_0x2ad92f){return db[_0xb50b('0x15')]['findAll']({'where':_0x1a5d93[_0xb50b('0x17')]?_0x1a5d93['options'][_0xb50b('0x19')]||null:null,'attributes':_0x1a5d93[_0xb50b('0x17')]?_0x1a5d93[_0xb50b('0x17')][_0xb50b('0x1e')]||null:null,'limit':_0x1a5d93[_0xb50b('0x17')]?_0x1a5d93[_0xb50b('0x17')][_0xb50b('0x1a')]||null:null,'order':_0x1a5d93['options']?_0x1a5d93[_0xb50b('0x17')][_0xb50b('0x29')]||null:null,'transaction':_0x2ad92f,'lock':_0x2ad92f[_0xb50b('0x2a')][_0xb50b('0x2b')],'include':[{'model':db[_0xb50b('0x27')],'as':'Contact','attributes':_[_0xb50b('0x2c')](_0x1251e7)},{'model':db['User'],'as':_0xb50b('0x2d'),'attributes':['id',_0xb50b('0x2e'),_0xb50b('0x2f')]}]})[_0xb50b('0xb')](function(_0x513581){var _0x2ca71=[];var _0x530355=[];for(var _0x2cd291=0x0;_0x2cd291<_0x513581[_0xb50b('0x30')];_0x2cd291+=0x1){var _0x21bcfa=_0x513581[_0x2cd291][_0xb50b('0x31')];if(_0x21bcfa===null){_0x2ca71[_0xb50b('0x32')](_0x513581[_0x2cd291][_0xb50b('0x24')](_0x1a5d93[_0xb50b('0x33')],{'transaction':_0x2ad92f}));}else if(!_0x530355[_0xb50b('0x34')](_0x21bcfa)){_0x530355[_0xb50b('0x32')](_0x21bcfa);_0x2ca71[_0xb50b('0x32')](_0x513581[_0x2cd291][_0xb50b('0x24')](_0x1a5d93['body'],{'transaction':_0x2ad92f}));}}return BPromise[_0xb50b('0x35')](_0x2ca71);});})[_0xb50b('0xb')](function(_0xe254e5){logger[_0xb50b('0x12')](_0xb50b('0x36'),_0x1a5d93);logger[_0xb50b('0xe')](_0xb50b('0x36'),_0x1a5d93,JSON['stringify'](_0xe254e5));_0x58c7f3(_0xe254e5);})[_0xb50b('0x20')](function(_0x291282){logger[_0xb50b('0x10')](_0xb50b('0x36'),_0x291282[_0xb50b('0x11')],_0x1a5d93);_0x5f401f(_0x13fcc0[_0xb50b('0x10')](0x1f4,_0x291282[_0xb50b('0x11')]));});});});};exports[_0xb50b('0x37')]=function(_0x34abd8){var _0x15a9a9=this;return new Promise(function(_0x564bcd,_0xcbbf2a){return db[_0xb50b('0x38')][_0xb50b('0x39')](function(_0x3234de){return db['CmHopperFinal'][_0xb50b('0x3a')](_0x34abd8[_0xb50b('0x33')],{'raw':_0x34abd8['options']?_0x34abd8[_0xb50b('0x17')][_0xb50b('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3234de})[_0xb50b('0xb')](function(){return db[_0xb50b('0x15')][_0xb50b('0x26')]({'where':_0x34abd8['options']?_0x34abd8[_0xb50b('0x17')][_0xb50b('0x19')]||null:null,'transaction':_0x3234de});});})[_0xb50b('0xb')](function(_0x29d973){logger[_0xb50b('0x12')](_0xb50b('0x37'),_0x34abd8);logger[_0xb50b('0xe')](_0xb50b('0x37'),_0x34abd8,JSON[_0xb50b('0x1f')](_0x29d973));_0x564bcd(_0x29d973);})[_0xb50b('0x20')](function(_0x44139f){logger[_0xb50b('0x10')]('MoveContactManagedDialer',_0x44139f['message'],_0x34abd8);_0xcbbf2a(_0x15a9a9[_0xb50b('0x10')](0x1f4,_0x44139f[_0xb50b('0x11')]));});});};exports[_0xb50b('0x3b')]=function(_0x3359df){var _0x3d71aa=this;return new Promise(function(_0x7114ca,_0x2227dd){return db[_0xb50b('0x15')][_0xb50b('0x16')]({'raw':_0x3359df['options']?_0x3359df[_0xb50b('0x17')][_0xb50b('0x18')]===undefined?!![]:![]:!![],'where':_0x3359df['options']?_0x3359df[_0xb50b('0x17')][_0xb50b('0x19')]||null:null,'attributes':[[db[_0xb50b('0x38')]['fn'](_0xb50b('0x3c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb50b('0x3d')](_0xb50b('0x3e')+util['format']('\x22%s\x22',moment()['format'](_0xb50b('0x3f')))+_0xb50b('0x40')))),'contactsRescheduled']]})[_0xb50b('0xb')](function(_0x4c46a3){logger[_0xb50b('0x12')](_0xb50b('0x3b'),_0x3359df);logger['debug'](_0xb50b('0x3b'),_0x3359df,JSON['stringify'](_0x4c46a3));_0x7114ca(_0x4c46a3);})[_0xb50b('0x20')](function(_0x2b1d2c){logger['error']('CountReScheduled',_0x2b1d2c[_0xb50b('0x11')],_0x3359df);_0x2227dd(_0x3d71aa['error'](0x1f4,_0x2b1d2c['message']));});});};exports[_0xb50b('0x41')]=function(_0x49cbf1){var _0x29d676=this;return new Promise(function(_0x4b6ee3,_0x3b31ef){return db[_0xb50b('0x27')]['describe']()['then'](function(_0x2cd773){return db['sequelize'][_0xb50b('0x39')](function(_0x139cfd){return db[_0xb50b('0x15')][_0xb50b('0x16')]({'where':_0x49cbf1[_0xb50b('0x17')]?_0x49cbf1[_0xb50b('0x17')]['where']||null:null,'attributes':_0x49cbf1[_0xb50b('0x17')]?_0x49cbf1[_0xb50b('0x17')][_0xb50b('0x1e')]||null:null,'limit':0x1,'order':_0x49cbf1[_0xb50b('0x17')]?_0x49cbf1[_0xb50b('0x17')]['order']||null:null,'group':db[_0xb50b('0x15')][_0xb50b('0x31')],'transaction':_0x139cfd,'lock':_0x139cfd[_0xb50b('0x2a')][_0xb50b('0x2b')],'include':_0x49cbf1[_0xb50b('0x17')]?_0x49cbf1['options'][_0xb50b('0x1b')]?_[_0xb50b('0x1c')](_0x49cbf1[_0xb50b('0x17')][_0xb50b('0x1b')],function(_0x388a54){return{'model':db[_0x388a54[_0xb50b('0x1d')]],'as':_0x388a54['as'],'attributes':_0x388a54['attributes'],'include':_0x388a54['include']?_[_0xb50b('0x1c')](_0x388a54[_0xb50b('0x1b')],function(_0x234441){return{'model':db[_0x234441[_0xb50b('0x1d')]],'as':_0x234441['as'],'attributes':_0x234441[_0xb50b('0x1e')],'include':_0x234441['include']?_['map'](_0x234441[_0xb50b('0x1b')],function(_0x5021e6){return{'model':db[_0x5021e6[_0xb50b('0x1d')]],'as':_0x5021e6['as'],'attributes':_0x5021e6[_0xb50b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb50b('0xb')](function(_0x1431c6){var _0x186220=[];for(var _0x284e55=0x0;_0x284e55<_0x1431c6[_0xb50b('0x30')];_0x284e55+=0x1){_0x186220[_0xb50b('0x32')](_0x1431c6[_0x284e55][_0xb50b('0x24')](_0x49cbf1['body'],{'transaction':_0x139cfd}));}return BPromise[_0xb50b('0x35')](_0x186220);});})[_0xb50b('0xb')](function(_0x3c1d00){logger[_0xb50b('0x12')](_0xb50b('0x41'),_0x49cbf1);logger[_0xb50b('0xe')](_0xb50b('0x41'),_0x49cbf1,JSON[_0xb50b('0x1f')](_0x3c1d00));_0x4b6ee3(_0x3c1d00);})[_0xb50b('0x20')](function(_0x3f7c68){logger[_0xb50b('0x10')](_0xb50b('0x41'),_0x3f7c68[_0xb50b('0x11')],_0x49cbf1);_0x3b31ef(_0x29d676[_0xb50b('0x10')](0x1f4,_0x3f7c68[_0xb50b('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x237edb){var _0x45d0dc=this;return new Promise(function(_0x5e1a17,_0x378b6a){db[_0xb50b('0x27')][_0xb50b('0x28')]()[_0xb50b('0xb')](function(_0x3a4231){return db[_0xb50b('0x15')][_0xb50b('0x16')]({'raw':_0x237edb[_0xb50b('0x17')]?_0x237edb[_0xb50b('0x17')][_0xb50b('0x18')]===undefined?!![]:![]:!![],'where':_0x237edb[_0xb50b('0x17')]?_0x237edb[_0xb50b('0x17')][_0xb50b('0x19')]||null:null,'attributes':_0x237edb[_0xb50b('0x17')]?_0x237edb[_0xb50b('0x17')][_0xb50b('0x1e')]||null:null,'limit':_0x237edb[_0xb50b('0x17')]?_0x237edb[_0xb50b('0x17')][_0xb50b('0x1a')]||null:null,'include':_0x237edb[_0xb50b('0x17')]?_0x237edb[_0xb50b('0x17')]['include']?_['map'](_0x237edb[_0xb50b('0x17')][_0xb50b('0x1b')],function(_0x1f3247){return{'model':db[_0x1f3247[_0xb50b('0x1d')]],'as':_0x1f3247['as'],'attributes':_0x1f3247['as']==='Contact'?_['keys'](_0x3a4231):_0x1f3247[_0xb50b('0x1e')],'include':_0x1f3247[_0xb50b('0x1b')]?_[_0xb50b('0x1c')](_0x1f3247[_0xb50b('0x1b')],function(_0x50c16f){return{'model':db[_0x50c16f[_0xb50b('0x1d')]],'as':_0x50c16f['as'],'attributes':_0x50c16f[_0xb50b('0x1e')],'include':_0x50c16f[_0xb50b('0x1b')]?_[_0xb50b('0x1c')](_0x50c16f['include'],function(_0x4664bd){return{'model':db[_0x4664bd['model']],'as':_0x4664bd['as'],'attributes':_0x4664bd[_0xb50b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb50b('0xb')](function(_0x44e56f){logger['info'](_0xb50b('0x14'),_0x237edb);logger['debug'](_0xb50b('0x14'),_0x237edb,JSON[_0xb50b('0x1f')](_0x44e56f));_0x5e1a17(_0x44e56f);})[_0xb50b('0x20')](function(_0x212a2a){logger[_0xb50b('0x10')](_0xb50b('0x14'),_0x212a2a['message'],_0x237edb);_0x378b6a(_0x45d0dc[_0xb50b('0x10')](0x1f4,_0x212a2a[_0xb50b('0x11')]));});});});}; \ No newline at end of file +var _0xe760=['UPDATE','Contact','keys','User','length','UserId','push','includes','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','describe','transaction','LOCK','GetCmHopperPreview','CmContact','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowCmHopper','find','stringify','CreateCmHopper','create','body','update','UpdateCmHopper','DestroyCmHopper','destroy','sequelize','order'];(function(_0x219a8d,_0x2553d3){var _0x571e43=function(_0x51c994){while(--_0x51c994){_0x219a8d['push'](_0x219a8d['shift']());}};_0x571e43(++_0x2553d3);}(_0xe760,0x1bd));var _0x0e76=function(_0x3b2075,_0x428dc7){_0x3b2075=_0x3b2075-0x0;var _0x2ad33c=_0xe760[_0x3b2075];return _0x2ad33c;};'use strict';var _=require(_0x0e76('0x0'));var util=require(_0x0e76('0x1'));var moment=require(_0x0e76('0x2'));var BPromise=require(_0x0e76('0x3'));var rs=require(_0x0e76('0x4'));var fs=require('fs');var Redis=require(_0x0e76('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e76('0x6'))(_0x0e76('0x7'));var config=require(_0x0e76('0x8'));var jayson=require(_0x0e76('0x9'));var client=jayson[_0x0e76('0xa')][_0x0e76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37f9dc,_0x96c4aa,_0x4961de){return new BPromise(function(_0x312203,_0x1f55e0){return client[_0x0e76('0xc')](_0x37f9dc,_0x4961de)['then'](function(_0x7521be){logger['info'](_0x0e76('0xd'),_0x96c4aa,_0x0e76('0xe'));logger[_0x0e76('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x96c4aa,_0x0e76('0xe'),JSON['stringify'](_0x7521be));if(_0x7521be[_0x0e76('0x10')]){if(_0x7521be[_0x0e76('0x10')]['code']===0x1f4){logger[_0x0e76('0x10')](_0x0e76('0xd'),_0x96c4aa,_0x7521be[_0x0e76('0x10')][_0x0e76('0x11')]);return _0x1f55e0(_0x7521be[_0x0e76('0x10')]['message']);}logger[_0x0e76('0x10')](_0x0e76('0xd'),_0x96c4aa,_0x7521be['error'][_0x0e76('0x11')]);return _0x312203(_0x7521be[_0x0e76('0x10')][_0x0e76('0x11')]);}else{logger[_0x0e76('0x12')](_0x0e76('0xd'),_0x96c4aa,'request\x20sent');_0x312203(_0x7521be[_0x0e76('0x13')]['message']);}})[_0x0e76('0x14')](function(_0xcb843e){logger[_0x0e76('0x10')](_0x0e76('0xd'),_0x96c4aa,_0xcb843e);_0x1f55e0(_0xcb843e);});});}exports[_0x0e76('0x15')]=function(_0x58e6d2){var _0x14ffeb=this;return new Promise(function(_0x28f7bb,_0x1e9407){return db[_0x0e76('0x16')][_0x0e76('0x17')]({'raw':_0x58e6d2[_0x0e76('0x18')]?_0x58e6d2[_0x0e76('0x18')][_0x0e76('0x19')]===undefined?!![]:![]:!![],'where':_0x58e6d2[_0x0e76('0x18')]?_0x58e6d2['options'][_0x0e76('0x1a')]||null:null,'attributes':_0x58e6d2['options']?_0x58e6d2[_0x0e76('0x18')]['attributes']||null:null,'limit':_0x58e6d2[_0x0e76('0x18')]?_0x58e6d2[_0x0e76('0x18')][_0x0e76('0x1b')]||null:null,'include':_0x58e6d2[_0x0e76('0x18')]?_0x58e6d2[_0x0e76('0x18')][_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x58e6d2[_0x0e76('0x18')][_0x0e76('0x1c')],function(_0x58b25a){return{'model':db[_0x58b25a[_0x0e76('0x1e')]],'as':_0x58b25a['as'],'attributes':_0x58b25a[_0x0e76('0x1f')],'include':_0x58b25a['include']?_[_0x0e76('0x1d')](_0x58b25a[_0x0e76('0x1c')],function(_0x5bddcb){return{'model':db[_0x5bddcb[_0x0e76('0x1e')]],'as':_0x5bddcb['as'],'attributes':_0x5bddcb['attributes'],'include':_0x5bddcb['include']?_[_0x0e76('0x1d')](_0x5bddcb[_0x0e76('0x1c')],function(_0x334f76){return{'model':db[_0x334f76[_0x0e76('0x1e')]],'as':_0x334f76['as'],'attributes':_0x334f76['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e76('0x20')](function(_0x43a6d9){logger[_0x0e76('0x12')](_0x0e76('0x15'),_0x58e6d2);logger[_0x0e76('0xf')](_0x0e76('0x15'),_0x58e6d2,JSON['stringify'](_0x43a6d9));_0x28f7bb(_0x43a6d9);})[_0x0e76('0x14')](function(_0x33dbb3){logger[_0x0e76('0x10')](_0x0e76('0x15'),_0x33dbb3[_0x0e76('0x11')],_0x58e6d2);_0x1e9407(_0x14ffeb[_0x0e76('0x10')](0x1f4,_0x33dbb3[_0x0e76('0x11')]));});});};exports[_0x0e76('0x21')]=function(_0x3a7d6b){var _0x5de7d8=this;return new Promise(function(_0x379e1c,_0x1fc9e2){return db[_0x0e76('0x16')][_0x0e76('0x22')]({'raw':_0x3a7d6b[_0x0e76('0x18')]?_0x3a7d6b[_0x0e76('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3a7d6b['options']?_0x3a7d6b['options'][_0x0e76('0x1a')]||null:null,'attributes':_0x3a7d6b[_0x0e76('0x18')]?_0x3a7d6b[_0x0e76('0x18')][_0x0e76('0x1f')]||null:null,'include':_0x3a7d6b[_0x0e76('0x18')]?_0x3a7d6b[_0x0e76('0x18')][_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x3a7d6b[_0x0e76('0x18')][_0x0e76('0x1c')],function(_0x366da4){return{'model':db[_0x366da4['model']],'as':_0x366da4['as'],'attributes':_0x366da4['attributes'],'include':_0x366da4[_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x366da4[_0x0e76('0x1c')],function(_0x5a2a0d){return{'model':db[_0x5a2a0d[_0x0e76('0x1e')]],'as':_0x5a2a0d['as'],'attributes':_0x5a2a0d[_0x0e76('0x1f')],'include':_0x5a2a0d['include']?_[_0x0e76('0x1d')](_0x5a2a0d['include'],function(_0x600c65){return{'model':db[_0x600c65[_0x0e76('0x1e')]],'as':_0x600c65['as'],'attributes':_0x600c65[_0x0e76('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0e76('0x20')](function(_0x3ad136){logger['info'](_0x0e76('0x21'),_0x3a7d6b);logger[_0x0e76('0xf')](_0x0e76('0x21'),_0x3a7d6b,JSON[_0x0e76('0x23')](_0x3ad136));_0x379e1c(_0x3ad136);})['catch'](function(_0xd7c93e){logger['error'](_0x0e76('0x21'),_0xd7c93e[_0x0e76('0x11')],_0x3a7d6b);_0x1fc9e2(_0x5de7d8[_0x0e76('0x10')](0x1f4,_0xd7c93e[_0x0e76('0x11')]));});});};exports[_0x0e76('0x24')]=function(_0x4e3539){var _0x577e50=this;return new Promise(function(_0x6a36ce,_0xa509f9){return db[_0x0e76('0x16')][_0x0e76('0x25')](_0x4e3539[_0x0e76('0x26')],{'raw':_0x4e3539[_0x0e76('0x18')]?_0x4e3539[_0x0e76('0x18')][_0x0e76('0x19')]===undefined?!![]:![]:!![]})[_0x0e76('0x20')](function(_0x50bce2){logger[_0x0e76('0x12')](_0x0e76('0x24'),_0x4e3539);logger[_0x0e76('0xf')](_0x0e76('0x24'),_0x4e3539,JSON[_0x0e76('0x23')](_0x50bce2));_0x6a36ce(_0x50bce2);})[_0x0e76('0x14')](function(_0x21ce7a){logger[_0x0e76('0x10')]('CreateCmHopper',_0x21ce7a[_0x0e76('0x11')],_0x4e3539);_0xa509f9(_0x577e50[_0x0e76('0x10')](0x1f4,_0x21ce7a[_0x0e76('0x11')]));});});};exports['UpdateCmHopper']=function(_0x3cf361){var _0x535836=this;return new Promise(function(_0x93c69,_0x53112c){return db[_0x0e76('0x16')][_0x0e76('0x27')](_0x3cf361[_0x0e76('0x26')],{'raw':_0x3cf361['options']?_0x3cf361[_0x0e76('0x18')][_0x0e76('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cf361[_0x0e76('0x18')]?_0x3cf361[_0x0e76('0x18')]['where']||null:null,'attributes':_0x3cf361['options']?_0x3cf361[_0x0e76('0x18')][_0x0e76('0x1f')]||null:null,'limit':_0x3cf361[_0x0e76('0x18')]?_0x3cf361['options'][_0x0e76('0x1b')]||null:null})[_0x0e76('0x20')](function(_0x3bf713){logger[_0x0e76('0x12')](_0x0e76('0x28'),_0x3cf361);logger[_0x0e76('0xf')](_0x0e76('0x28'),_0x3cf361,JSON[_0x0e76('0x23')](_0x3bf713));_0x93c69(_0x3bf713);})['catch'](function(_0x1e3de4){logger[_0x0e76('0x10')](_0x0e76('0x28'),_0x1e3de4['message'],_0x3cf361);_0x53112c(_0x535836[_0x0e76('0x10')](0x1f4,_0x1e3de4[_0x0e76('0x11')]));});});};exports[_0x0e76('0x29')]=function(_0x5c559c){var _0x112dd2=this;return new Promise(function(_0x472b82,_0x22bdf3){return db['CmHopper'][_0x0e76('0x2a')]({'where':_0x5c559c['options']?_0x5c559c['options']['where']||null:null})[_0x0e76('0x20')](function(_0x4f7b7b){logger[_0x0e76('0x12')](_0x0e76('0x29'),_0x5c559c);logger[_0x0e76('0xf')]('DestroyCmHopper',_0x5c559c,JSON['stringify'](_0x4f7b7b));_0x472b82(_0x4f7b7b);})[_0x0e76('0x14')](function(_0x2cdfaa){logger[_0x0e76('0x10')]('DestroyCmHopper',_0x2cdfaa['message'],_0x5c559c);_0x22bdf3(_0x112dd2['error'](0x1f4,_0x2cdfaa['message']));});});};exports['GetContactDialer']=function(_0x1157d2){var _0x2e0392=this;return new Promise(function(_0x2e34b3,_0x2a797a){return db['CmContact']['describe']()['then'](function(_0x45abf3){return db[_0x0e76('0x2b')]['transaction'](function(_0x53f0b4){return db[_0x0e76('0x16')][_0x0e76('0x17')]({'where':_0x1157d2[_0x0e76('0x18')]?_0x1157d2[_0x0e76('0x18')]['where']||null:null,'attributes':_0x1157d2[_0x0e76('0x18')]?_0x1157d2[_0x0e76('0x18')][_0x0e76('0x1f')]||null:null,'limit':_0x1157d2[_0x0e76('0x18')]?_0x1157d2[_0x0e76('0x18')][_0x0e76('0x1b')]||null:null,'order':_0x1157d2[_0x0e76('0x18')]?_0x1157d2['options'][_0x0e76('0x2c')]||null:null,'transaction':_0x53f0b4,'lock':_0x53f0b4['LOCK'][_0x0e76('0x2d')],'include':[{'model':db['CmContact'],'as':_0x0e76('0x2e'),'attributes':_[_0x0e76('0x2f')](_0x45abf3)},{'model':db[_0x0e76('0x30')],'as':'Agent','attributes':['id','name','voicePause']}]})[_0x0e76('0x20')](function(_0x179f7b){var _0x45980d=[];var _0xc313e6=[];for(var _0x3dd16a=0x0;_0x3dd16a<_0x179f7b[_0x0e76('0x31')];_0x3dd16a+=0x1){var _0x566f48=_0x179f7b[_0x3dd16a][_0x0e76('0x32')];if(_0x566f48===null){_0x45980d[_0x0e76('0x33')](_0x179f7b[_0x3dd16a][_0x0e76('0x27')](_0x1157d2[_0x0e76('0x26')],{'transaction':_0x53f0b4}));}else if(!_0xc313e6[_0x0e76('0x34')](_0x566f48)){_0xc313e6[_0x0e76('0x33')](_0x566f48);_0x45980d['push'](_0x179f7b[_0x3dd16a][_0x0e76('0x27')](_0x1157d2[_0x0e76('0x26')],{'transaction':_0x53f0b4}));}}return BPromise[_0x0e76('0x35')](_0x45980d);});})[_0x0e76('0x20')](function(_0x3e2346){logger['info'](_0x0e76('0x36'),_0x1157d2);logger[_0x0e76('0xf')]('GetContactDialer',_0x1157d2,JSON[_0x0e76('0x23')](_0x3e2346));_0x2e34b3(_0x3e2346);})[_0x0e76('0x14')](function(_0x52d713){logger[_0x0e76('0x10')](_0x0e76('0x36'),_0x52d713['message'],_0x1157d2);_0x2a797a(_0x2e0392[_0x0e76('0x10')](0x1f4,_0x52d713[_0x0e76('0x11')]));});});});};exports[_0x0e76('0x37')]=function(_0x3233a8){var _0x580c37=this;return new Promise(function(_0x59c089,_0x1c886c){return db['sequelize']['transaction'](function(_0x4c3323){return db[_0x0e76('0x38')][_0x0e76('0x25')](_0x3233a8[_0x0e76('0x26')],{'raw':_0x3233a8[_0x0e76('0x18')]?_0x3233a8[_0x0e76('0x18')][_0x0e76('0x19')]===undefined?!![]:![]:!![],'transaction':_0x4c3323})[_0x0e76('0x20')](function(){return db[_0x0e76('0x16')]['destroy']({'where':_0x3233a8[_0x0e76('0x18')]?_0x3233a8['options'][_0x0e76('0x1a')]||null:null,'transaction':_0x4c3323});});})[_0x0e76('0x20')](function(_0x592696){logger[_0x0e76('0x12')]('MoveContactManagedDialer',_0x3233a8);logger[_0x0e76('0xf')](_0x0e76('0x37'),_0x3233a8,JSON['stringify'](_0x592696));_0x59c089(_0x592696);})[_0x0e76('0x14')](function(_0x191ba6){logger[_0x0e76('0x10')](_0x0e76('0x37'),_0x191ba6[_0x0e76('0x11')],_0x3233a8);_0x1c886c(_0x580c37['error'](0x1f4,_0x191ba6['message']));});});};exports[_0x0e76('0x39')]=function(_0x51af6f){var _0xfbeebd=this;return new Promise(function(_0x31a1ee,_0x4f773c){return db[_0x0e76('0x16')][_0x0e76('0x17')]({'raw':_0x51af6f['options']?_0x51af6f[_0x0e76('0x18')][_0x0e76('0x19')]===undefined?!![]:![]:!![],'where':_0x51af6f[_0x0e76('0x18')]?_0x51af6f[_0x0e76('0x18')][_0x0e76('0x1a')]||null:null,'attributes':[[db[_0x0e76('0x2b')]['fn'](_0x0e76('0x3a'),db[_0x0e76('0x2b')]['fn']('IF',db[_0x0e76('0x2b')][_0x0e76('0x3b')](_0x0e76('0x3c')+util[_0x0e76('0x3d')](_0x0e76('0x3e'),moment()['format'](_0x0e76('0x3f')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x0e76('0x20')](function(_0x2d4766){logger[_0x0e76('0x12')](_0x0e76('0x39'),_0x51af6f);logger[_0x0e76('0xf')](_0x0e76('0x39'),_0x51af6f,JSON[_0x0e76('0x23')](_0x2d4766));_0x31a1ee(_0x2d4766);})[_0x0e76('0x14')](function(_0x3622f4){logger['error'](_0x0e76('0x39'),_0x3622f4[_0x0e76('0x11')],_0x51af6f);_0x4f773c(_0xfbeebd[_0x0e76('0x10')](0x1f4,_0x3622f4['message']));});});};exports[_0x0e76('0x40')]=function(_0x112245){var _0x17499a=this;return new Promise(function(_0x32984c,_0x5b71e0){return db['CmContact'][_0x0e76('0x41')]()['then'](function(_0x2ff8c2){return db[_0x0e76('0x2b')][_0x0e76('0x42')](function(_0x380a4f){return db['CmHopper'][_0x0e76('0x17')]({'where':_0x112245['options']?_0x112245[_0x0e76('0x18')][_0x0e76('0x1a')]||null:null,'attributes':_0x112245[_0x0e76('0x18')]?_0x112245[_0x0e76('0x18')][_0x0e76('0x1f')]||null:null,'limit':0x1,'order':_0x112245[_0x0e76('0x18')]?_0x112245['options'][_0x0e76('0x2c')]||null:null,'group':db['CmHopper'][_0x0e76('0x32')],'transaction':_0x380a4f,'lock':_0x380a4f[_0x0e76('0x43')][_0x0e76('0x2d')],'include':_0x112245[_0x0e76('0x18')]?_0x112245['options'][_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x112245[_0x0e76('0x18')]['include'],function(_0x3de617){return{'model':db[_0x3de617[_0x0e76('0x1e')]],'as':_0x3de617['as'],'attributes':_0x3de617[_0x0e76('0x1f')],'include':_0x3de617[_0x0e76('0x1c')]?_['map'](_0x3de617[_0x0e76('0x1c')],function(_0x22c8e9){return{'model':db[_0x22c8e9[_0x0e76('0x1e')]],'as':_0x22c8e9['as'],'attributes':_0x22c8e9[_0x0e76('0x1f')],'include':_0x22c8e9[_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x22c8e9['include'],function(_0x59258e){return{'model':db[_0x59258e[_0x0e76('0x1e')]],'as':_0x59258e['as'],'attributes':_0x59258e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e76('0x20')](function(_0x5105e3){var _0x4bc3c9=[];for(var _0x3f6f72=0x0;_0x3f6f72<_0x5105e3[_0x0e76('0x31')];_0x3f6f72+=0x1){_0x4bc3c9[_0x0e76('0x33')](_0x5105e3[_0x3f6f72][_0x0e76('0x27')](_0x112245[_0x0e76('0x26')],{'transaction':_0x380a4f}));}return BPromise[_0x0e76('0x35')](_0x4bc3c9);});})['then'](function(_0x38f86a){logger['info'](_0x0e76('0x40'),_0x112245);logger[_0x0e76('0xf')](_0x0e76('0x40'),_0x112245,JSON[_0x0e76('0x23')](_0x38f86a));_0x32984c(_0x38f86a);})['catch'](function(_0x4b966c){logger[_0x0e76('0x10')](_0x0e76('0x40'),_0x4b966c['message'],_0x112245);_0x5b71e0(_0x17499a[_0x0e76('0x10')](0x1f4,_0x4b966c[_0x0e76('0x11')]));});});});};exports[_0x0e76('0x44')]=function(_0x1c92a4){var _0xe7f107=this;return new Promise(function(_0xa135af,_0x33fd64){db[_0x0e76('0x45')][_0x0e76('0x41')]()[_0x0e76('0x20')](function(_0x497fe6){return db['CmHopper'][_0x0e76('0x17')]({'raw':_0x1c92a4[_0x0e76('0x18')]?_0x1c92a4[_0x0e76('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1c92a4['options']?_0x1c92a4[_0x0e76('0x18')][_0x0e76('0x1a')]||null:null,'attributes':_0x1c92a4[_0x0e76('0x18')]?_0x1c92a4[_0x0e76('0x18')][_0x0e76('0x1f')]||null:null,'limit':_0x1c92a4[_0x0e76('0x18')]?_0x1c92a4[_0x0e76('0x18')][_0x0e76('0x1b')]||null:null,'include':_0x1c92a4[_0x0e76('0x18')]?_0x1c92a4['options'][_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x1c92a4[_0x0e76('0x18')][_0x0e76('0x1c')],function(_0x3f21df){return{'model':db[_0x3f21df[_0x0e76('0x1e')]],'as':_0x3f21df['as'],'attributes':_0x3f21df['as']===_0x0e76('0x2e')?_[_0x0e76('0x2f')](_0x497fe6):_0x3f21df[_0x0e76('0x1f')],'include':_0x3f21df[_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x3f21df[_0x0e76('0x1c')],function(_0x539c06){return{'model':db[_0x539c06[_0x0e76('0x1e')]],'as':_0x539c06['as'],'attributes':_0x539c06[_0x0e76('0x1f')],'include':_0x539c06[_0x0e76('0x1c')]?_[_0x0e76('0x1d')](_0x539c06[_0x0e76('0x1c')],function(_0x3464a0){return{'model':db[_0x3464a0[_0x0e76('0x1e')]],'as':_0x3464a0['as'],'attributes':_0x3464a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e76('0x20')](function(_0x48a5e9){logger[_0x0e76('0x12')](_0x0e76('0x15'),_0x1c92a4);logger[_0x0e76('0xf')]('GetCmHopper',_0x1c92a4,JSON['stringify'](_0x48a5e9));_0xa135af(_0x48a5e9);})['catch'](function(_0x5359c8){logger[_0x0e76('0x10')](_0x0e76('0x15'),_0x5359c8[_0x0e76('0x11')],_0x1c92a4);_0x33fd64(_0xe7f107[_0x0e76('0x10')](0x1f4,_0x5359c8[_0x0e76('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 722ec25..ef4ddd4 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 _0x8212=['index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8212,0x1d5));var _0x2821=function(_0x1c1d55,_0x3b577d){_0x1c1d55=_0x1c1d55-0x0;var _0x13c601=_0x8212[_0x1c1d55];return _0x13c601;};'use strict';var multer=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var path=require(_0x2821('0x2'));var timeout=require(_0x2821('0x3'));var express=require(_0x2821('0x4'));var router=express[_0x2821('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2821('0x6'));var interaction=require(_0x2821('0x7'));var config=require(_0x2821('0x8'));var controller=require('./cmHopper.controller');router[_0x2821('0x9')]('/',auth[_0x2821('0xa')](),controller[_0x2821('0xb')]);router[_0x2821('0x9')](_0x2821('0xc'),auth['isAuthenticated'](),controller[_0x2821('0xd')]);router['get'](_0x2821('0xe'),auth[_0x2821('0xa')](),controller[_0x2821('0xf')]);router['get'](_0x2821('0x10'),auth[_0x2821('0xa')](),controller[_0x2821('0x11')]);router[_0x2821('0x12')]('/',auth[_0x2821('0xa')](),controller[_0x2821('0x13')]);router[_0x2821('0x12')](_0x2821('0x14'),auth[_0x2821('0xa')](),controller[_0x2821('0x15')]);router[_0x2821('0x16')]('/:id',auth[_0x2821('0xa')](),controller[_0x2821('0x17')]);router['delete'](_0x2821('0x10'),auth[_0x2821('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x76c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','get','/describe','describe','/opencontacts','getOpenContacts','show','post','create','/preview','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x13afe7,_0x31e4ea){var _0xee18b8=function(_0x322a8c){while(--_0x322a8c){_0x13afe7['push'](_0x13afe7['shift']());}};_0xee18b8(++_0x31e4ea);}(_0x76c8,0x18e));var _0x876c=function(_0x2ebe17,_0x13d9c9){_0x2ebe17=_0x2ebe17-0x0;var _0x151f2e=_0x76c8[_0x2ebe17];return _0x151f2e;};'use strict';var multer=require(_0x876c('0x0'));var util=require(_0x876c('0x1'));var path=require(_0x876c('0x2'));var timeout=require(_0x876c('0x3'));var express=require(_0x876c('0x4'));var router=express[_0x876c('0x5')]();var fs_extra=require(_0x876c('0x6'));var auth=require(_0x876c('0x7'));var interaction=require(_0x876c('0x8'));var config=require(_0x876c('0x9'));var controller=require(_0x876c('0xa'));router['get']('/',auth[_0x876c('0xb')](),controller['index']);router[_0x876c('0xc')](_0x876c('0xd'),auth[_0x876c('0xb')](),controller[_0x876c('0xe')]);router[_0x876c('0xc')](_0x876c('0xf'),auth[_0x876c('0xb')](),controller[_0x876c('0x10')]);router[_0x876c('0xc')]('/:id',auth[_0x876c('0xb')](),controller[_0x876c('0x11')]);router[_0x876c('0x12')]('/',auth['isAuthenticated'](),controller[_0x876c('0x13')]);router[_0x876c('0x12')](_0x876c('0x14'),auth[_0x876c('0xb')](),controller['getPreview']);router[_0x876c('0x15')](_0x876c('0x16'),auth[_0x876c('0xb')](),controller[_0x876c('0x17')]);router[_0x876c('0x18')](_0x876c('0x16'),auth['isAuthenticated'](),controller[_0x876c('0x19')]);module[_0x876c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ba13216..cabda6e 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 _0xe7de=['contactListQueue','INTEGER','moment','sequelize','exports'];(function(_0x2c3aab,_0x1a4ede){var _0x5b3e5b=function(_0x301ecd){while(--_0x301ecd){_0x2c3aab['push'](_0x2c3aab['shift']());}};_0x5b3e5b(++_0x1a4ede);}(_0xe7de,0x165));var _0xee7d=function(_0x3ce1cf,_0x5c2af9){_0x3ce1cf=_0x3ce1cf-0x0;var _0x377aa4=_0xe7de[_0x3ce1cf];return _0x377aa4;};'use strict';var moment=require(_0xee7d('0x0'));var Sequelize=require(_0xee7d('0x1'));module[_0xee7d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xee7d('0x3')},'ListId':{'type':Sequelize[_0xee7d('0x4')],'unique':_0xee7d('0x3')},'VoiceQueueId':{'type':Sequelize[_0xee7d('0x4')],'unique':_0xee7d('0x3')}}; \ No newline at end of file +var _0x0db8=['contactListQueue','moment','exports','STRING','INTEGER'];(function(_0x3cab61,_0x481772){var _0x3a461a=function(_0x246a6f){while(--_0x246a6f){_0x3cab61['push'](_0x3cab61['shift']());}};_0x3a461a(++_0x481772);}(_0x0db8,0x1cd));var _0x80db=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0x0db8[_0xf33afd];return _0x5f432a;};'use strict';var moment=require(_0x80db('0x0'));var Sequelize=require('sequelize');module[_0x80db('0x1')]={'phone':{'type':Sequelize[_0x80db('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x80db('0x3')],'unique':_0x80db('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x80db('0x3')],'unique':_0x80db('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index d85ff90..388f915 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 _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','eml-format'];(function(_0x39622b,_0x235596){var _0x14b638=function(_0x42ebcc){while(--_0x42ebcc){_0x39622b['push'](_0x39622b['shift']());}};_0x14b638(++_0x235596);}(_0x9582,0x95));var _0x2958=function(_0x4d3443,_0x49b52b){_0x4d3443=_0x4d3443-0x0;var _0x5cd02e=_0x9582[_0x4d3443];return _0x5cd02e;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':!![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x24')]=function(_0x4a51b1,_0x1b6829){if(_0x4a51b1[_0x2958('0x49')]['id']){delete _0x4a51b1[_0x2958('0x49')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x4a51b1[_0x2958('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b6829,null))[_0x2958('0x25')](saveUpdates(_0x4a51b1[_0x2958('0x49')],null))[_0x2958('0x25')](respondWithResult(_0x1b6829,null))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports[_0x2958('0x26')]=function(_0x116068,_0x1794c7){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x116068[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1794c7,null))[_0x2958('0x25')](removeEntity(_0x1794c7,null))[_0x2958('0x44')](handleError(_0x1794c7,null));};exports[_0x2958('0x4a')]=function(_0x1bb780,_0xfce675){return db[_0x2958('0x2c')]['describe']()[_0x2958('0x25')](respondWithResult(_0xfce675,null))['catch'](handleError(_0xfce675,null));}; \ No newline at end of file +var _0xdb6e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','CmHopperBlack','findAll','rows','show','params','find','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1ea7f3,_0x5d84aa){var _0x109bd0=function(_0x516e79){while(--_0x516e79){_0x1ea7f3['push'](_0x1ea7f3['shift']());}};_0x109bd0(++_0x5d84aa);}(_0xdb6e,0xde));var _0xedb6=function(_0x47deb5,_0x537ac9){_0x47deb5=_0x47deb5-0x0;var _0x33d927=_0xdb6e[_0x47deb5];return _0x33d927;};'use strict';var emlformat=require(_0xedb6('0x0'));var rimraf=require(_0xedb6('0x1'));var zipdir=require(_0xedb6('0x2'));var jsonpatch=require(_0xedb6('0x3'));var rp=require(_0xedb6('0x4'));var moment=require(_0xedb6('0x5'));var BPromise=require(_0xedb6('0x6'));var Mustache=require(_0xedb6('0x7'));var util=require(_0xedb6('0x8'));var path=require(_0xedb6('0x9'));var sox=require(_0xedb6('0xa'));var csv=require(_0xedb6('0xb'));var ejs=require(_0xedb6('0xc'));var fs=require('fs');var fs_extra=require(_0xedb6('0xd'));var _=require(_0xedb6('0xe'));var squel=require(_0xedb6('0xf'));var crypto=require(_0xedb6('0x10'));var jsforce=require(_0xedb6('0x11'));var deskjs=require(_0xedb6('0x12'));var toCsv=require(_0xedb6('0xb'));var querystring=require(_0xedb6('0x13'));var Papa=require(_0xedb6('0x14'));var Redis=require(_0xedb6('0x15'));var authService=require(_0xedb6('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xedb6('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedb6('0x18'))(_0xedb6('0x19'));var utils=require(_0xedb6('0x1a'));var config=require(_0xedb6('0x1b'));var licenseUtil=require(_0xedb6('0x1c'));var db=require(_0xedb6('0x1d'))['db'];function respondWithStatusCode(_0x1e0b29,_0x4d4ff3){_0x4d4ff3=_0x4d4ff3||0xcc;return function(_0x16e1c5){if(_0x16e1c5){return _0x1e0b29[_0xedb6('0x1e')](_0x4d4ff3);}return _0x1e0b29[_0xedb6('0x1f')](_0x4d4ff3)[_0xedb6('0x20')]();};}function respondWithResult(_0x332593,_0x219eab){_0x219eab=_0x219eab||0xc8;return function(_0x567e64){if(_0x567e64){return _0x332593[_0xedb6('0x1f')](_0x219eab)[_0xedb6('0x21')](_0x567e64);}};}function respondWithFilteredResult(_0x5e1452,_0x2662f6){return function(_0x2be1b6){if(_0x2be1b6){var _0x5dad46=typeof _0x2662f6[_0xedb6('0x22')]===_0xedb6('0x23')&&typeof _0x2662f6[_0xedb6('0x24')]===_0xedb6('0x23');var _0x3923ab=_0x2be1b6[_0xedb6('0x25')];var _0x2f72dc=_0x5dad46?0x0:_0x2662f6[_0xedb6('0x22')];var _0x3e31f3=_0x5dad46?_0x2be1b6[_0xedb6('0x25')]:_0x2662f6[_0xedb6('0x22')]+_0x2662f6[_0xedb6('0x24')];var _0x10406e;if(_0x3e31f3>=_0x3923ab){_0x3e31f3=_0x3923ab;_0x10406e=0xc8;}else{_0x10406e=0xce;}_0x5e1452[_0xedb6('0x1f')](_0x10406e);return _0x5e1452[_0xedb6('0x26')](_0xedb6('0x27'),_0x2f72dc+'-'+_0x3e31f3+'/'+_0x3923ab)[_0xedb6('0x21')](_0x2be1b6);}return null;};}function patchUpdates(_0xf8572b){return function(_0x100a59){try{jsonpatch['apply'](_0x100a59,_0xf8572b,!![]);}catch(_0x49e21f){return BPromise[_0xedb6('0x28')](_0x49e21f);}return _0x100a59['save']();};}function saveUpdates(_0x5ca44a,_0x5da210){return function(_0x5a3d64){if(_0x5a3d64){return _0x5a3d64['update'](_0x5ca44a)['then'](function(_0x43c87c){return _0x43c87c;});}return null;};}function removeEntity(_0x3a6a54,_0xe50d1f){return function(_0x1e66bd){if(_0x1e66bd){return _0x1e66bd[_0xedb6('0x29')]()[_0xedb6('0x2a')](function(){_0x3a6a54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8015e,_0x2dc1e2){return function(_0x31a52a){if(!_0x31a52a){_0xe8015e[_0xedb6('0x1e')](0x194);}return _0x31a52a;};}function handleError(_0x1a3c02,_0x4dae74){_0x4dae74=_0x4dae74||0x1f4;return function(_0x58bfbb){logger[_0xedb6('0x2b')](_0x58bfbb['stack']);if(_0x58bfbb[_0xedb6('0x2c')]){delete _0x58bfbb['name'];}_0x1a3c02['status'](_0x4dae74)[_0xedb6('0x2d')](_0x58bfbb);};}exports[_0xedb6('0x2e')]=function(_0x51eb98,_0x1e4c74){var _0x23adf3={},_0x3f1844={},_0x47303b={'count':0x0,'rows':[]};var _0x4859ef=_[_0xedb6('0x2f')](db['CmHopperBlack'][_0xedb6('0x30')],function(_0x593aaa){return{'name':_0x593aaa[_0xedb6('0x31')],'type':_0x593aaa['type'][_0xedb6('0x32')]};});_0x3f1844[_0xedb6('0x33')]=_[_0xedb6('0x2f')](_0x4859ef,_0xedb6('0x2c'));_0x3f1844[_0xedb6('0x34')]=_[_0xedb6('0x35')](_0x51eb98['query']);_0x3f1844[_0xedb6('0x36')]=_[_0xedb6('0x37')](_0x3f1844['model'],_0x3f1844['query']);_0x23adf3['attributes']=_[_0xedb6('0x37')](_0x3f1844[_0xedb6('0x33')],qs[_0xedb6('0x38')](_0x51eb98['query']['fields']));_0x23adf3[_0xedb6('0x39')]=_0x23adf3['attributes'][_0xedb6('0x3a')]?_0x23adf3[_0xedb6('0x39')]:_0x3f1844['model'];if(!_0x51eb98[_0xedb6('0x34')][_0xedb6('0x3b')](_0xedb6('0x3c'))){_0x23adf3['limit']=qs['limit'](_0x51eb98[_0xedb6('0x34')]['limit']);_0x23adf3[_0xedb6('0x22')]=qs['offset'](_0x51eb98[_0xedb6('0x34')][_0xedb6('0x22')]);}_0x23adf3['order']=qs[_0xedb6('0x3d')](_0x51eb98[_0xedb6('0x34')][_0xedb6('0x3d')]);_0x23adf3[_0xedb6('0x3e')]=qs['filters'](_[_0xedb6('0x3f')](_0x51eb98[_0xedb6('0x34')],_0x3f1844[_0xedb6('0x36')]),_0x4859ef);if(_0x51eb98[_0xedb6('0x34')][_0xedb6('0x40')]){_0x23adf3['where']=_[_0xedb6('0x41')](_0x23adf3[_0xedb6('0x3e')],{'$or':_[_0xedb6('0x2f')](_0x4859ef,function(_0x3bce86){if(_0x3bce86['type']!==_0xedb6('0x42')){var _0x472fe1={};_0x472fe1[_0x3bce86[_0xedb6('0x2c')]]={'$like':'%'+_0x51eb98[_0xedb6('0x34')]['filter']+'%'};return _0x472fe1;}})});}_0x23adf3=_['merge']({},_0x23adf3,_0x51eb98['options']);var _0x2d6f16={'where':_0x23adf3[_0xedb6('0x3e')]};return db['CmHopperBlack'][_0xedb6('0x25')](_0x2d6f16)[_0xedb6('0x2a')](function(_0x52166a){_0x47303b[_0xedb6('0x25')]=_0x52166a;if(_0x51eb98[_0xedb6('0x34')][_0xedb6('0x43')]){_0x23adf3[_0xedb6('0x44')]=[{'all':!![]}];}return db[_0xedb6('0x45')][_0xedb6('0x46')](_0x23adf3);})[_0xedb6('0x2a')](function(_0x5b63ed){_0x47303b[_0xedb6('0x47')]=_0x5b63ed;return _0x47303b;})[_0xedb6('0x2a')](respondWithFilteredResult(_0x1e4c74,_0x23adf3))['catch'](handleError(_0x1e4c74,null));};exports[_0xedb6('0x48')]=function(_0x582df6,_0x105894){var _0x2c0c5c={'raw':!![],'where':{'id':_0x582df6[_0xedb6('0x49')]['id']}},_0x147459={};_0x147459[_0xedb6('0x33')]=_[_0xedb6('0x35')](db['CmHopperBlack'][_0xedb6('0x30')]);_0x147459[_0xedb6('0x34')]=_[_0xedb6('0x35')](_0x582df6[_0xedb6('0x34')]);_0x147459['filters']=_[_0xedb6('0x37')](_0x147459['model'],_0x147459[_0xedb6('0x34')]);_0x2c0c5c[_0xedb6('0x39')]=_['intersection'](_0x147459[_0xedb6('0x33')],qs['fields'](_0x582df6[_0xedb6('0x34')][_0xedb6('0x38')]));_0x2c0c5c[_0xedb6('0x39')]=_0x2c0c5c['attributes'][_0xedb6('0x3a')]?_0x2c0c5c['attributes']:_0x147459[_0xedb6('0x33')];if(_0x582df6['query'][_0xedb6('0x43')]){_0x2c0c5c[_0xedb6('0x44')]=[{'all':!![]}];}_0x2c0c5c=_['merge']({},_0x2c0c5c,_0x582df6['options']);return db[_0xedb6('0x45')][_0xedb6('0x4a')](_0x2c0c5c)[_0xedb6('0x2a')](handleEntityNotFound(_0x105894,null))[_0xedb6('0x2a')](respondWithResult(_0x105894,null))[_0xedb6('0x4b')](handleError(_0x105894,null));};exports[_0xedb6('0x4c')]=function(_0x2cf17f,_0x3a097f){if(_0x2cf17f[_0xedb6('0x4d')]['id']){delete _0x2cf17f[_0xedb6('0x4d')]['id'];}return db[_0xedb6('0x45')][_0xedb6('0x4a')]({'where':{'id':_0x2cf17f[_0xedb6('0x49')]['id']}})[_0xedb6('0x2a')](handleEntityNotFound(_0x3a097f,null))[_0xedb6('0x2a')](saveUpdates(_0x2cf17f[_0xedb6('0x4d')],null))[_0xedb6('0x2a')](respondWithResult(_0x3a097f,null))[_0xedb6('0x4b')](handleError(_0x3a097f,null));};exports[_0xedb6('0x29')]=function(_0x3ed0ff,_0x242aec){return db['CmHopperBlack']['find']({'where':{'id':_0x3ed0ff[_0xedb6('0x49')]['id']}})[_0xedb6('0x2a')](handleEntityNotFound(_0x242aec,null))[_0xedb6('0x2a')](removeEntity(_0x242aec,null))['catch'](handleError(_0x242aec,null));};exports['describe']=function(_0x5aee7e,_0x55c9f1){return db['CmHopperBlack'][_0xedb6('0x4e')]()['then'](respondWithResult(_0x55c9f1,null))[_0xedb6('0x4b')](handleError(_0x55c9f1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 23356de..198080e 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 _0x0bfd=['./cmHopperBlack.attributes','define','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0bfd,0x177));var _0xd0bf=function(_0x498b22,_0x131b18){_0x498b22=_0x498b22-0x0;var _0x327881=_0x0bfd[_0x498b22];return _0x327881;};'use strict';var _=require(_0xd0bf('0x0'));var util=require(_0xd0bf('0x1'));var logger=require(_0xd0bf('0x2'))(_0xd0bf('0x3'));var moment=require(_0xd0bf('0x4'));var BPromise=require(_0xd0bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0bf('0x6'));var rimraf=require(_0xd0bf('0x7'));var config=require(_0xd0bf('0x8'));var attributes=require(_0xd0bf('0x9'));module['exports']=function(_0x17bf6c,_0x21e21b){return _0x17bf6c[_0xd0bf('0xa')](_0xd0bf('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9de2=['moment','request-promise','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x3dd0e2,_0x17c0eb){var _0x5cee3b=function(_0x19522a){while(--_0x19522a){_0x3dd0e2['push'](_0x3dd0e2['shift']());}};_0x5cee3b(++_0x17c0eb);}(_0x9de2,0xb0));var _0x29de=function(_0x1fec94,_0x596748){_0x1fec94=_0x1fec94-0x0;var _0x5b3d14=_0x9de2[_0x1fec94];return _0x5b3d14;};'use strict';var _=require(_0x29de('0x0'));var util=require(_0x29de('0x1'));var logger=require(_0x29de('0x2'))(_0x29de('0x3'));var moment=require(_0x29de('0x4'));var BPromise=require('bluebird');var rp=require(_0x29de('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x29de('0x6'));var attributes=require(_0x29de('0x7'));module['exports']=function(_0x1bcde4,_0xf9677){return _0x1bcde4['define'](_0x29de('0x8'),attributes,{'tableName':_0x29de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index f192ba2..27e7675 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 _0x612a=['destroy','where','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','findAll','options','raw','attributes','limit','include','model','map','GetCmHopperBlack','UpdateCmHopperBlack','update','body'];(function(_0x372047,_0x7f5c2b){var _0x44f282=function(_0x5a3d1c){while(--_0x5a3d1c){_0x372047['push'](_0x372047['shift']());}};_0x44f282(++_0x7f5c2b);}(_0x612a,0xf3));var _0xa612=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x612a[_0x49052b];return _0x48c045;};'use strict';var _=require(_0xa612('0x0'));var util=require(_0xa612('0x1'));var moment=require(_0xa612('0x2'));var BPromise=require(_0xa612('0x3'));var rs=require(_0xa612('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa612('0x5'))['db'];var utils=require(_0xa612('0x6'));var logger=require(_0xa612('0x7'))('rpc');var config=require(_0xa612('0x8'));var jayson=require(_0xa612('0x9'));var client=jayson[_0xa612('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14df78,_0x26bfb5,_0x1f747c){return new BPromise(function(_0x3fd8e8,_0xa2fd03){return client[_0xa612('0xb')](_0x14df78,_0x1f747c)[_0xa612('0xc')](function(_0x4916c1){logger[_0xa612('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x26bfb5,_0xa612('0xe'));logger[_0xa612('0xf')](_0xa612('0x10'),_0x26bfb5,_0xa612('0xe'),JSON[_0xa612('0x11')](_0x4916c1));if(_0x4916c1[_0xa612('0x12')]){if(_0x4916c1[_0xa612('0x12')][_0xa612('0x13')]===0x1f4){logger[_0xa612('0x12')](_0xa612('0x14'),_0x26bfb5,_0x4916c1[_0xa612('0x12')]['message']);return _0xa2fd03(_0x4916c1['error'][_0xa612('0x15')]);}logger['error'](_0xa612('0x14'),_0x26bfb5,_0x4916c1[_0xa612('0x12')][_0xa612('0x15')]);return _0x3fd8e8(_0x4916c1[_0xa612('0x12')][_0xa612('0x15')]);}else{logger[_0xa612('0xd')](_0xa612('0x14'),_0x26bfb5,'request\x20sent');_0x3fd8e8(_0x4916c1[_0xa612('0x16')][_0xa612('0x15')]);}})[_0xa612('0x17')](function(_0x23d071){logger[_0xa612('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x26bfb5,_0x23d071);_0xa2fd03(_0x23d071);});});}exports['GetCmHopperBlack']=function(_0x11ac56){var _0x41d217=this;return new Promise(function(_0xb80179,_0x1e1995){return db[_0xa612('0x18')][_0xa612('0x19')]({'raw':_0x11ac56['options']?_0x11ac56[_0xa612('0x1a')][_0xa612('0x1b')]===undefined?!![]:![]:!![],'where':_0x11ac56[_0xa612('0x1a')]?_0x11ac56[_0xa612('0x1a')]['where']||null:null,'attributes':_0x11ac56['options']?_0x11ac56['options'][_0xa612('0x1c')]||null:null,'limit':_0x11ac56['options']?_0x11ac56[_0xa612('0x1a')][_0xa612('0x1d')]||null:null,'include':_0x11ac56[_0xa612('0x1a')]?_0x11ac56['options'][_0xa612('0x1e')]?_['map'](_0x11ac56[_0xa612('0x1a')][_0xa612('0x1e')],function(_0x10772a){return{'model':db[_0x10772a[_0xa612('0x1f')]],'as':_0x10772a['as'],'attributes':_0x10772a['attributes'],'include':_0x10772a['include']?_['map'](_0x10772a['include'],function(_0x4fcc87){return{'model':db[_0x4fcc87[_0xa612('0x1f')]],'as':_0x4fcc87['as'],'attributes':_0x4fcc87['attributes'],'include':_0x4fcc87['include']?_[_0xa612('0x20')](_0x4fcc87[_0xa612('0x1e')],function(_0x4e3b20){return{'model':db[_0x4e3b20[_0xa612('0x1f')]],'as':_0x4e3b20['as'],'attributes':_0x4e3b20[_0xa612('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa612('0xc')](function(_0xc5361c){logger[_0xa612('0xd')]('GetCmHopperBlack',_0x11ac56);logger['debug'](_0xa612('0x21'),_0x11ac56,JSON[_0xa612('0x11')](_0xc5361c));_0xb80179(_0xc5361c);})[_0xa612('0x17')](function(_0x116790){logger[_0xa612('0x12')](_0xa612('0x21'),_0x116790['message'],_0x11ac56);_0x1e1995(_0x41d217['error'](0x1f4,_0x116790[_0xa612('0x15')]));});});};exports[_0xa612('0x22')]=function(_0x37c3d8){var _0x59584f=this;return new Promise(function(_0x328bb4,_0x28c8f1){return db[_0xa612('0x18')][_0xa612('0x23')](_0x37c3d8[_0xa612('0x24')],{'raw':_0x37c3d8[_0xa612('0x1a')]?_0x37c3d8[_0xa612('0x1a')][_0xa612('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c3d8[_0xa612('0x1a')]?_0x37c3d8[_0xa612('0x1a')]['where']||null:null,'attributes':_0x37c3d8[_0xa612('0x1a')]?_0x37c3d8[_0xa612('0x1a')][_0xa612('0x1c')]||null:null,'limit':_0x37c3d8[_0xa612('0x1a')]?_0x37c3d8[_0xa612('0x1a')][_0xa612('0x1d')]||null:null})['then'](function(_0x171169){logger[_0xa612('0xd')](_0xa612('0x22'),_0x37c3d8);logger[_0xa612('0xf')]('UpdateCmHopperBlack',_0x37c3d8,JSON[_0xa612('0x11')](_0x171169));_0x328bb4(_0x171169);})[_0xa612('0x17')](function(_0x1a7edc){logger[_0xa612('0x12')](_0xa612('0x22'),_0x1a7edc[_0xa612('0x15')],_0x37c3d8);_0x28c8f1(_0x59584f[_0xa612('0x12')](0x1f4,_0x1a7edc[_0xa612('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x2b5713){var _0x23095d=this;return new Promise(function(_0x4d2660,_0x1d74ac){return db[_0xa612('0x18')][_0xa612('0x25')]({'where':_0x2b5713[_0xa612('0x1a')]?_0x2b5713[_0xa612('0x1a')][_0xa612('0x26')]||null:null})['then'](function(_0xf9de40){logger[_0xa612('0xd')](_0xa612('0x27'),_0x2b5713);logger[_0xa612('0xf')](_0xa612('0x27'),_0x2b5713,JSON['stringify'](_0xf9de40));_0x4d2660(_0xf9de40);})[_0xa612('0x17')](function(_0x519f87){logger[_0xa612('0x12')](_0xa612('0x27'),_0x519f87[_0xa612('0x15')],_0x2b5713);_0x1d74ac(_0x23095d[_0xa612('0x12')](0x1f4,_0x519f87[_0xa612('0x15')]));});});}; \ No newline at end of file +var _0xe672=['request\x20sent','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','then','debug','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x68fd48,_0x1e359f){var _0x4135c1=function(_0x47bb4b){while(--_0x47bb4b){_0x68fd48['push'](_0x68fd48['shift']());}};_0x4135c1(++_0x1e359f);}(_0xe672,0x165));var _0x2e67=function(_0x1fb9d4,_0x52daaa){_0x1fb9d4=_0x1fb9d4-0x0;var _0x1e9111=_0xe672[_0x1fb9d4];return _0x1e9111;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2e67('0x0'));var BPromise=require(_0x2e67('0x1'));var rs=require(_0x2e67('0x2'));var fs=require('fs');var Redis=require(_0x2e67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e67('0x4'));var logger=require(_0x2e67('0x5'))(_0x2e67('0x6'));var config=require('../../config/environment');var jayson=require(_0x2e67('0x7'));var client=jayson[_0x2e67('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x370684,_0x4de27d,_0x9cd2ba){return new BPromise(function(_0x1b55a1,_0x22dc4e){return client[_0x2e67('0x9')](_0x370684,_0x9cd2ba)['then'](function(_0x28b398){logger[_0x2e67('0xa')](_0x2e67('0xb'),_0x4de27d,'request\x20sent');logger['debug'](_0x2e67('0xc'),_0x4de27d,_0x2e67('0xd'),JSON[_0x2e67('0xe')](_0x28b398));if(_0x28b398[_0x2e67('0xf')]){if(_0x28b398['error'][_0x2e67('0x10')]===0x1f4){logger[_0x2e67('0xf')](_0x2e67('0xb'),_0x4de27d,_0x28b398[_0x2e67('0xf')][_0x2e67('0x11')]);return _0x22dc4e(_0x28b398[_0x2e67('0xf')]['message']);}logger[_0x2e67('0xf')](_0x2e67('0xb'),_0x4de27d,_0x28b398[_0x2e67('0xf')]['message']);return _0x1b55a1(_0x28b398['error'][_0x2e67('0x11')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x4de27d,'request\x20sent');_0x1b55a1(_0x28b398[_0x2e67('0x12')][_0x2e67('0x11')]);}})['catch'](function(_0x2ed18a){logger[_0x2e67('0xf')](_0x2e67('0xb'),_0x4de27d,_0x2ed18a);_0x22dc4e(_0x2ed18a);});});}exports[_0x2e67('0x13')]=function(_0x20a865){var _0x3d8e01=this;return new Promise(function(_0x7d2362,_0x57a22a){return db[_0x2e67('0x14')][_0x2e67('0x15')]({'raw':_0x20a865[_0x2e67('0x16')]?_0x20a865[_0x2e67('0x16')][_0x2e67('0x17')]===undefined?!![]:![]:!![],'where':_0x20a865[_0x2e67('0x16')]?_0x20a865['options'][_0x2e67('0x18')]||null:null,'attributes':_0x20a865[_0x2e67('0x16')]?_0x20a865[_0x2e67('0x16')]['attributes']||null:null,'limit':_0x20a865[_0x2e67('0x16')]?_0x20a865['options'][_0x2e67('0x19')]||null:null,'include':_0x20a865[_0x2e67('0x16')]?_0x20a865[_0x2e67('0x16')][_0x2e67('0x1a')]?_[_0x2e67('0x1b')](_0x20a865['options'][_0x2e67('0x1a')],function(_0x452289){return{'model':db[_0x452289[_0x2e67('0x1c')]],'as':_0x452289['as'],'attributes':_0x452289['attributes'],'include':_0x452289[_0x2e67('0x1a')]?_[_0x2e67('0x1b')](_0x452289[_0x2e67('0x1a')],function(_0x36807c){return{'model':db[_0x36807c[_0x2e67('0x1c')]],'as':_0x36807c['as'],'attributes':_0x36807c[_0x2e67('0x1d')],'include':_0x36807c['include']?_[_0x2e67('0x1b')](_0x36807c[_0x2e67('0x1a')],function(_0x134c93){return{'model':db[_0x134c93[_0x2e67('0x1c')]],'as':_0x134c93['as'],'attributes':_0x134c93[_0x2e67('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2e67('0x1e')](function(_0x514cdd){logger[_0x2e67('0xa')](_0x2e67('0x13'),_0x20a865);logger[_0x2e67('0x1f')](_0x2e67('0x13'),_0x20a865,JSON[_0x2e67('0xe')](_0x514cdd));_0x7d2362(_0x514cdd);})[_0x2e67('0x20')](function(_0x5f10e0){logger[_0x2e67('0xf')](_0x2e67('0x13'),_0x5f10e0['message'],_0x20a865);_0x57a22a(_0x3d8e01[_0x2e67('0xf')](0x1f4,_0x5f10e0[_0x2e67('0x11')]));});});};exports[_0x2e67('0x21')]=function(_0x2a7ad0){var _0x25b3c7=this;return new Promise(function(_0x264ef1,_0x459bdd){return db['CmHopperBlack'][_0x2e67('0x22')](_0x2a7ad0[_0x2e67('0x23')],{'raw':_0x2a7ad0[_0x2e67('0x16')]?_0x2a7ad0['options'][_0x2e67('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a7ad0[_0x2e67('0x16')]?_0x2a7ad0[_0x2e67('0x16')][_0x2e67('0x18')]||null:null,'attributes':_0x2a7ad0['options']?_0x2a7ad0[_0x2e67('0x16')]['attributes']||null:null,'limit':_0x2a7ad0[_0x2e67('0x16')]?_0x2a7ad0[_0x2e67('0x16')][_0x2e67('0x19')]||null:null})['then'](function(_0x30930f){logger[_0x2e67('0xa')](_0x2e67('0x21'),_0x2a7ad0);logger[_0x2e67('0x1f')](_0x2e67('0x21'),_0x2a7ad0,JSON[_0x2e67('0xe')](_0x30930f));_0x264ef1(_0x30930f);})[_0x2e67('0x20')](function(_0x48e5f8){logger[_0x2e67('0xf')]('UpdateCmHopperBlack',_0x48e5f8[_0x2e67('0x11')],_0x2a7ad0);_0x459bdd(_0x25b3c7[_0x2e67('0xf')](0x1f4,_0x48e5f8[_0x2e67('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x3a92c2){var _0x59c9c6=this;return new Promise(function(_0x48be1b,_0x9da13){return db[_0x2e67('0x14')]['destroy']({'where':_0x3a92c2[_0x2e67('0x16')]?_0x3a92c2[_0x2e67('0x16')][_0x2e67('0x18')]||null:null})[_0x2e67('0x1e')](function(_0x4f41f9){logger[_0x2e67('0xa')]('DestroyCmHopperBlack',_0x3a92c2);logger[_0x2e67('0x1f')](_0x2e67('0x24'),_0x3a92c2,JSON[_0x2e67('0xe')](_0x4f41f9));_0x48be1b(_0x4f41f9);})[_0x2e67('0x20')](function(_0x244944){logger[_0x2e67('0xf')](_0x2e67('0x24'),_0x244944[_0x2e67('0x11')],_0x3a92c2);_0x9da13(_0x59c9c6[_0x2e67('0xf')](0x1f4,_0x244944[_0x2e67('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ad8dfab..1f69c76 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 _0x3f8a=['describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x885072,_0x2b33d0){var _0x3a3b0a=function(_0xbfb52b){while(--_0xbfb52b){_0x885072['push'](_0x885072['shift']());}};_0x3a3b0a(++_0x2b33d0);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1a7836,_0x1035e1){_0x1a7836=_0x1a7836-0x0;var _0x16b138=_0x3f8a[_0x1a7836];return _0x16b138;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['put'](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x13')]);module[_0xa3f8('0x14')]=router; \ No newline at end of file +var _0xe3da=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer'];(function(_0x242b0f,_0x1fbfa4){var _0x46478e=function(_0x258133){while(--_0x258133){_0x242b0f['push'](_0x242b0f['shift']());}};_0x46478e(++_0x1fbfa4);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')](_0xae3d('0x12'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x13')]);router[_0xae3d('0x14')]('/:id',auth[_0xae3d('0xc')](),controller['destroy']);module[_0xae3d('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 7326f88..345372b 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 _0xb95b=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x3333ab,_0x2acf36){var _0x3e87b7=function(_0xe2e240){while(--_0xe2e240){_0x3333ab['push'](_0x3333ab['shift']());}};_0x3e87b7(++_0x2acf36);}(_0xb95b,0x1d2));var _0xbb95=function(_0x55c5d6,_0x49e581){_0x55c5d6=_0x55c5d6-0x0;var _0x4e921f=_0xb95b[_0x55c5d6];return _0x4e921f;};'use strict';var Sequelize=require(_0xbb95('0x0'));var moment=require(_0xbb95('0x1'));module[_0xbb95('0x2')]={'state':{'type':Sequelize[_0xbb95('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xbb95('0x4')]},'scheduledat':{'type':Sequelize[_0xbb95('0x5')]},'countbusyretry':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbb95('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbb95('0x4')]},'calleridname':{'type':Sequelize[_0xbb95('0x4')]},'starttime':{'type':Sequelize[_0xbb95('0x5')]},'responsetime':{'type':Sequelize[_0xbb95('0x5')]},'answertime':{'type':Sequelize[_0xbb95('0x5')]},'droptime':{'type':Sequelize[_0xbb95('0x5')]},'endtime':{'type':Sequelize[_0xbb95('0x5')]},'ringtime':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbb95('0x4')]},'campaign':{'type':Sequelize[_0xbb95('0x4')]},'campaigntype':{'type':Sequelize[_0xbb95('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xbb95('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xbb95('0x5')],'set':function(_0x5cd60d){var _0x5c6a93=this[_0xbb95('0x6')](_0xbb95('0x7'));if(_0x5c6a93&&_0x5cd60d){this[_0xbb95('0x8')]('followuptime',moment(_0x5cd60d)[_0xbb95('0x9')](moment(_0x5c6a93),_0xbb95('0xa')));}return this['setDataValue'](_0xbb95('0xb'),_0x5cd60d);}},'amd':{'type':Sequelize[_0xbb95('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xbb95('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbb95('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbb95('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbb95('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbb95('0x5')]},'deleted':{'type':Sequelize[_0xbb95('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbb95('0x5')]},'recallme':{'type':Sequelize[_0xbb95('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbb95('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb95('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x733b=['getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','DATE','INTEGER','STRING'];(function(_0xa46c62,_0x4dd30b){var _0x38652f=function(_0x5096bb){while(--_0x5096bb){_0xa46c62['push'](_0xa46c62['shift']());}};_0x38652f(++_0x4dd30b);}(_0x733b,0x1c2));var _0xb733=function(_0x1045f8,_0x215810){_0x1045f8=_0x1045f8-0x0;var _0x1ee15d=_0x733b[_0x1045f8];return _0x1ee15d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb733('0x0'));module[_0xb733('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb733('0x2')]},'countbusyretry':{'type':Sequelize[_0xb733('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb733('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb733('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb733('0x4')]},'originatecalleridname':{'type':Sequelize[_0xb733('0x4')]},'calleridnum':{'type':Sequelize[_0xb733('0x4')]},'calleridname':{'type':Sequelize[_0xb733('0x4')]},'starttime':{'type':Sequelize[_0xb733('0x2')]},'responsetime':{'type':Sequelize[_0xb733('0x2')]},'answertime':{'type':Sequelize[_0xb733('0x2')]},'droptime':{'type':Sequelize[_0xb733('0x2')]},'endtime':{'type':Sequelize[_0xb733('0x2')]},'ringtime':{'type':Sequelize[_0xb733('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb733('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb733('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb733('0x4')]},'campaign':{'type':Sequelize[_0xb733('0x4')]},'campaigntype':{'type':Sequelize[_0xb733('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb733('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb733('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5ab0be){var _0x3388cf=this[_0xb733('0x5')](_0xb733('0x6'));if(_0x3388cf&&_0x5ab0be){this[_0xb733('0x7')](_0xb733('0x8'),moment(_0x5ab0be)[_0xb733('0x9')](moment(_0x3388cf),_0xb733('0xa')));}return this[_0xb733('0x7')](_0xb733('0xb'),_0x5ab0be);}},'amd':{'type':Sequelize[_0xb733('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb733('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb733('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb733('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb733('0x2')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb733('0x2')]},'deleted':{'type':Sequelize[_0xb733('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb733('0x2')]},'recallme':{'type':Sequelize[_0xb733('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb733('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb733('0x3')],'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 e5b85e7..2ef5b25 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 _0x2675=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','describe','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','phone','from','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','group','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x18a5ac,_0x26ea67){var _0x309ce4=function(_0xfab31a){while(--_0xfab31a){_0x18a5ac['push'](_0x18a5ac['shift']());}};_0x309ce4(++_0x26ea67);}(_0x2675,0x75));var _0x5267=function(_0x1f1ea4,_0x495aa7){_0x1f1ea4=_0x1f1ea4-0x0;var _0x425a84=_0x2675[_0x1f1ea4];return _0x425a84;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['CmHopperFinal'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['CmHopperFinal'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['describe']=function(_0x12d6a8,_0x4ee826){return db['CmHopperFinal'][_0x5267('0x43')]()[_0x5267('0x22')](respondWithResult(_0x4ee826,null))['catch'](handleError(_0x4ee826,null));};exports['update']=function(_0x383ebe,_0xe0439e){if(_0x383ebe[_0x5267('0x44')][_0x5267('0x45')]){delete _0x383ebe[_0x5267('0x44')][_0x5267('0x45')];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'uniqueid':_0x383ebe[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0xe0439e,null))[_0x5267('0x22')](saveUpdates(_0x383ebe[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0xe0439e,null))[_0x5267('0x3d')](handleError(_0xe0439e,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x8636d0,_0x466d46,_0x371486){return db['CmHopperFinal'][_0x5267('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x8636d0[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4a')))),'noSuchContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),'busyContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x51')))),_0x5267('0x52')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x53')))),'abandonedContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x54')))),_0x5267('0x55')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x466d46,null))['then'](respondWithResult(_0x466d46,null))['catch'](handleError(_0x466d46,null));};exports[_0x5267('0x58')]=function(_0x5393e9,_0x3f5cda,_0x47059c){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x5393e9[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4a')))),_0x5267('0x59')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),_0x5267('0x5a')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x51')))),_0x5267('0x52')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x53')))),_0x5267('0x5b')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x3f5cda,null))[_0x5267('0x22')](respondWithResult(_0x3f5cda,null))[_0x5267('0x3d')](handleError(_0x3f5cda,null));};exports[_0x5267('0x5c')]=function(_0x21338f,_0x1103c5,_0x489b9a){return db['VoiceQueue']['find']({'where':{'id':_0x21338f[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x1103c5,null))[_0x5267('0x22')](function(_0x457d84){var _0x4974d1;if(_0x457d84){_0x4974d1=squel[_0x5267('0x5d')]()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')](['phone',_0x5267('0x61'),_0x5267('0x62'),'ListId',_0x5267('0x63'),_0x5267('0x64'),'updatedAt'],squel['select']()[_0x5267('0x65')](_0x5267('0x66'),'phone')['field'](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')](_0x5267('0x68'),_0x5267('0x62'))['field'](_0x5267('0x69'),_0x5267('0x6a'))['field'](_0x5267('0x6b'),_0x5267('0x63'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))['from']('cm_hopper_final')[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())['where'](_0x5267('0x6f'),_0x21338f['body'][_0x5267('0x70')][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x73'))[_0x5267('0x74')](_0x5267('0x5f'))[_0x5267('0x34')]('VoiceQueueId\x20=\x20?',_0x21338f[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))['group'](_0x5267('0x62')))[_0x5267('0x6e')]();return db['sequelize'][_0x5267('0x2c')](_0x4974d1);}return[];})[_0x5267('0x22')](respondWithResult(_0x1103c5,null))[_0x5267('0x3d')](handleError(_0x1103c5,null));};exports[_0x5267('0x78')]=function(_0xd18795,_0x37b007,_0x358543){return db['Campaign'][_0x5267('0x42')]({'where':{'id':_0xd18795[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x37b007,null))[_0x5267('0x22')](function(_0x1cdf9f){var _0x4dbaa2;if(_0x1cdf9f){_0x4dbaa2=squel['insert']()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')]([_0x5267('0x73'),'scheduledAt',_0x5267('0x62'),_0x5267('0x6a'),_0x5267('0x79'),_0x5267('0x64'),_0x5267('0x6c')],squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x66'),_0x5267('0x73'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')]('ANY_VALUE(ContactId)',_0x5267('0x62'))[_0x5267('0x65')](_0x5267('0x69'),_0x5267('0x6a'))[_0x5267('0x65')](_0x5267('0x7a'),_0x5267('0x79'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x7b'),_0xd18795[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x6f'),_0xd18795[_0x5267('0x44')][_0x5267('0x70')]['toString']())[_0x5267('0x34')](_0x5267('0x71'))[_0x5267('0x34')](_0x5267('0x7c'),squel[_0x5267('0x72')]()['field'](_0x5267('0x73'))[_0x5267('0x74')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0xd18795[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')]('CampaignId\x20=\x20?',_0xd18795['params']['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))[_0x5267('0x7d')](_0x5267('0x62')))['toString']();return db[_0x5267('0x48')]['query'](_0x4dbaa2);}return[];})['then'](respondWithResult(_0x37b007,null))[_0x5267('0x3d')](handleError(_0x37b007,null));};exports['checkContactHopper']=function(_0x5da8d6,_0x3ebe63,_0x321322){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x5da8d6['body'][_0x5267('0x63')],'CampaignId':_0x5da8d6['body'][_0x5267('0x79')],'ContactId':_0x5da8d6['body'][_0x5267('0x62')]}})[_0x5267('0x22')](handleEntityNotFound(_0x3ebe63,null))['then'](function(_0x1ae9fe){if(_0x1ae9fe){return _0x1ae9fe;}return null;})[_0x5267('0x22')](respondWithResult(_0x3ebe63,null))[_0x5267('0x3d')](handleError(_0x3ebe63,null));}; \ No newline at end of file +var _0xc1c6=['jsforce','desk.js','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','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2e8dd6,_0x48f05f){_0x2e8dd6=_0x2e8dd6-0x0;var _0x5f1ed5=_0xc1c6[_0x2e8dd6];return _0x5f1ed5;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['CmHopperFinal'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0e74bef..bf5063c 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 _0x25d7=['rimraf','./cmHopperFinal.attributes','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2e4212,_0x4eec34){var _0x10fa64=function(_0x3cdbf4){while(--_0x3cdbf4){_0x2e4212['push'](_0x2e4212['shift']());}};_0x10fa64(++_0x4eec34);}(_0x25d7,0x1d3));var _0x725d=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0x25d7[_0x2637ac];return _0x4a5758;};'use strict';var _=require(_0x725d('0x0'));var util=require(_0x725d('0x1'));var logger=require(_0x725d('0x2'))('api');var moment=require(_0x725d('0x3'));var BPromise=require(_0x725d('0x4'));var rp=require(_0x725d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x725d('0x6'));var config=require('../../config/environment');var attributes=require(_0x725d('0x7'));module['exports']=function(_0x469700,_0x13d17b){return _0x469700['define'](_0x725d('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x725d('0x9'),'fields':['calleridnum']},{'name':_0x725d('0xa'),'fields':[_0x725d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7921=['uniqueid','util','../../config/logger','path','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x19068f,_0x2a5921){var _0x569370=function(_0x25b24b){while(--_0x25b24b){_0x19068f['push'](_0x19068f['shift']());}};_0x569370(++_0x2a5921);}(_0x7921,0x114));var _0x1792=function(_0x2637f3,_0x55bbd0){_0x2637f3=_0x2637f3-0x0;var _0x1302bd=_0x7921[_0x2637f3];return _0x1302bd;};'use strict';var _=require('lodash');var util=require(_0x1792('0x0'));var logger=require(_0x1792('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1792('0x2'));var rimraf=require(_0x1792('0x3'));var config=require('../../config/environment');var attributes=require(_0x1792('0x4'));module[_0x1792('0x5')]=function(_0x4dbcbb,_0x3a3e0f){return _0x4dbcbb[_0x1792('0x6')](_0x1792('0x7'),attributes,{'tableName':_0x1792('0x8'),'paranoid':![],'indexes':[{'name':_0x1792('0x9'),'fields':[_0x1792('0x9')]},{'name':_0x1792('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8d53775..581aeb3 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(_0x219154,_0x9e9e2d){var _0x5a4737=function(_0x4b7282){while(--_0x4b7282){_0x219154['push'](_0x219154['shift']());}};_0x5a4737(++_0x9e9e2d);}(_0xb10b,0x12a));var _0xbb10=function(_0x48d3f8,_0x502a1b){_0x48d3f8=_0x48d3f8-0x0;var _0x3f6498=_0xb10b[_0x48d3f8];return _0x3f6498;};'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(_0x1a7446,_0x2fb462){var _0x508be1=function(_0xf06cf6){while(--_0xf06cf6){_0x1a7446['push'](_0x1a7446['shift']());}};_0x508be1(++_0x2fb462);}(_0x7a54,0x106));var _0x47a5=function(_0x577a9b,_0x264738){_0x577a9b=_0x577a9b-0x0;var _0x24e008=_0x7a54[_0x577a9b];return _0x24e008;};'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 8f1ebae..3e61137 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 _0xe205=['multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper'];(function(_0x1b1997,_0x3f15de){var _0x456aa0=function(_0x245031){while(--_0x245031){_0x1b1997['push'](_0x1b1997['shift']());}};_0x456aa0(++_0x3f15de);}(_0xe205,0xb0));var _0x5e20=function(_0x3da6eb,_0xed5f5){_0x3da6eb=_0x3da6eb-0x0;var _0x19aa32=_0xe205[_0x3da6eb];return _0x19aa32;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require('path');var timeout=require(_0x5e20('0x2'));var express=require('express');var router=express[_0x5e20('0x3')]();var fs_extra=require(_0x5e20('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e20('0x5'));var config=require(_0x5e20('0x6'));var controller=require(_0x5e20('0x7'));router[_0x5e20('0x8')]('/',auth[_0x5e20('0x9')](),controller['index']);router[_0x5e20('0x8')](_0x5e20('0xa'),auth[_0x5e20('0x9')](),controller[_0x5e20('0xb')]);router['get'](_0x5e20('0xc'),auth[_0x5e20('0x9')](),controller['show']);router[_0x5e20('0x8')](_0x5e20('0xd'),auth[_0x5e20('0x9')](),controller[_0x5e20('0xe')]);router[_0x5e20('0x8')](_0x5e20('0xf'),auth[_0x5e20('0x9')](),controller[_0x5e20('0x10')]);router[_0x5e20('0x11')](_0x5e20('0x12'),auth[_0x5e20('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x5e20('0x11')](_0x5e20('0x13'),auth[_0x5e20('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x5e20('0x11')](_0x5e20('0x14'),auth[_0x5e20('0x9')](),controller[_0x5e20('0x15')]);router['put'](_0x5e20('0xc'),auth[_0x5e20('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x6888=['post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0xd45da0,_0x3ef3b3){var _0x2a9939=function(_0x3d3103){while(--_0x3d3103){_0xd45da0['push'](_0xd45da0['shift']());}};_0x2a9939(++_0x3ef3b3);}(_0x6888,0x146));var _0x8688=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x6888[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x8688('0x0'));var util=require(_0x8688('0x1'));var path=require(_0x8688('0x2'));var timeout=require(_0x8688('0x3'));var express=require(_0x8688('0x4'));var router=express[_0x8688('0x5')]();var fs_extra=require(_0x8688('0x6'));var auth=require(_0x8688('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8688('0x8'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x8688('0x9')](),controller[_0x8688('0xa')]);router[_0x8688('0xb')](_0x8688('0xc'),auth[_0x8688('0x9')](),controller[_0x8688('0xd')]);router['get'](_0x8688('0xe'),auth[_0x8688('0x9')](),controller[_0x8688('0xf')]);router[_0x8688('0xb')](_0x8688('0x10'),auth[_0x8688('0x9')](),controller[_0x8688('0x11')]);router['get'](_0x8688('0x12'),auth[_0x8688('0x9')](),controller[_0x8688('0x13')]);router['post'](_0x8688('0x14'),auth[_0x8688('0x9')](),controller[_0x8688('0x15')]);router[_0x8688('0x16')]('/voice/campaign/moveContacts/:id',auth[_0x8688('0x9')](),controller[_0x8688('0x17')]);router[_0x8688('0x16')](_0x8688('0x18'),auth[_0x8688('0x9')](),controller[_0x8688('0x19')]);router[_0x8688('0x1a')](_0x8688('0xe'),auth[_0x8688('0x9')](),controller[_0x8688('0x1b')]);module[_0x8688('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7c75b1d..f060596 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 _0x4b41=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x4b41,0xe3));var _0x14b4=function(_0x586b87,_0x3d1c88){_0x586b87=_0x586b87-0x0;var _0x2aa087=_0x4b41[_0x586b87];return _0x2aa087;};'use strict';var Sequelize=require(_0x14b4('0x0'));module[_0x14b4('0x1')]={'state':{'type':Sequelize[_0x14b4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x14b4('0x3')]},'scheduledat':{'type':Sequelize[_0x14b4('0x4')]},'countbusyretry':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x14b4('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x14b4('0x3')]},'calleridnum':{'type':Sequelize[_0x14b4('0x3')]},'calleridname':{'type':Sequelize[_0x14b4('0x3')]},'starttime':{'type':Sequelize[_0x14b4('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x14b4('0x4')]},'droptime':{'type':Sequelize[_0x14b4('0x4')]},'endtime':{'type':Sequelize[_0x14b4('0x4')]},'ringtime':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x14b4('0x3')]},'membername':{'type':Sequelize[_0x14b4('0x3')]},'reason':{'type':Sequelize[_0x14b4('0x3')]},'amd':{'type':Sequelize[_0x14b4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x14b4('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x14b4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x14b4('0x4')]},'recallme':{'type':Sequelize[_0x14b4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x14b4('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x14b4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b89=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x26491b,_0x22c063){var _0x2b0153=function(_0x2e3825){while(--_0x2e3825){_0x26491b['push'](_0x26491b['shift']());}};_0x2b0153(++_0x22c063);}(_0x1b89,0xd0));var _0x91b8=function(_0x1fa90e,_0x407de4){_0x1fa90e=_0x1fa90e-0x0;var _0x26c506=_0x1b89[_0x1fa90e];return _0x26c506;};'use strict';var Sequelize=require(_0x91b8('0x0'));module[_0x91b8('0x1')]={'state':{'type':Sequelize[_0x91b8('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x91b8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x91b8('0x3')]},'originatecalleridname':{'type':Sequelize[_0x91b8('0x3')]},'calleridnum':{'type':Sequelize[_0x91b8('0x3')]},'calleridname':{'type':Sequelize[_0x91b8('0x3')]},'starttime':{'type':Sequelize[_0x91b8('0x4')]},'responsetime':{'type':Sequelize[_0x91b8('0x4')]},'answertime':{'type':Sequelize[_0x91b8('0x4')]},'droptime':{'type':Sequelize[_0x91b8('0x4')]},'endtime':{'type':Sequelize[_0x91b8('0x4')]},'ringtime':{'type':Sequelize[_0x91b8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x91b8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x91b8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x91b8('0x3')]},'campaign':{'type':Sequelize[_0x91b8('0x3')]},'campaigntype':{'type':Sequelize[_0x91b8('0x3')]},'membername':{'type':Sequelize[_0x91b8('0x3')]},'reason':{'type':Sequelize[_0x91b8('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x91b8('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x91b8('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x91b8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x91b8('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x91b8('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x91b8('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x91b8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x91b8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x91b8('0x2')],'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 5c97cf7..1af6a4c 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 _0x0022=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','CmHopperHistory','findAll','catch','show','params','rawAttributes','find','create','body','describe','update','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x582244,_0x33f08b){var _0x81f9e4=function(_0x1f63f8){while(--_0x1f63f8){_0x582244['push'](_0x582244['shift']());}};_0x81f9e4(++_0x33f08b);}(_0x0022,0x1b8));var _0x2002=function(_0x1c9fab,_0x4d6871){_0x1c9fab=_0x1c9fab-0x0;var _0x586f79=_0x0022[_0x1c9fab];return _0x586f79;};'use strict';var emlformat=require(_0x2002('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2002('0x1'));var jsonpatch=require(_0x2002('0x2'));var rp=require(_0x2002('0x3'));var moment=require(_0x2002('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2002('0x5'));var util=require(_0x2002('0x6'));var path=require(_0x2002('0x7'));var sox=require(_0x2002('0x8'));var csv=require(_0x2002('0x9'));var ejs=require(_0x2002('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2002('0xb'));var crypto=require(_0x2002('0xc'));var jsforce=require(_0x2002('0xd'));var deskjs=require(_0x2002('0xe'));var toCsv=require(_0x2002('0x9'));var querystring=require('querystring');var Papa=require(_0x2002('0xf'));var Redis=require(_0x2002('0x10'));var authService=require(_0x2002('0x11'));var qs=require(_0x2002('0x12'));var as=require(_0x2002('0x13'));var hardwareService=require(_0x2002('0x14'));var logger=require(_0x2002('0x15'))(_0x2002('0x16'));var utils=require(_0x2002('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2002('0x18'));var db=require(_0x2002('0x19'))['db'];function respondWithStatusCode(_0x16cae9,_0xf31461){_0xf31461=_0xf31461||0xcc;return function(_0x1bdb97){if(_0x1bdb97){return _0x16cae9[_0x2002('0x1a')](_0xf31461);}return _0x16cae9[_0x2002('0x1b')](_0xf31461)[_0x2002('0x1c')]();};}function respondWithResult(_0x2ed699,_0x311ce0){_0x311ce0=_0x311ce0||0xc8;return function(_0x846536){if(_0x846536){return _0x2ed699[_0x2002('0x1b')](_0x311ce0)[_0x2002('0x1d')](_0x846536);}};}function respondWithFilteredResult(_0x4c1929,_0x3da378){return function(_0xe511eb){if(_0xe511eb){var _0x27103f=typeof _0x3da378[_0x2002('0x1e')]===_0x2002('0x1f')&&typeof _0x3da378[_0x2002('0x20')]===_0x2002('0x1f');var _0x310669=_0xe511eb[_0x2002('0x21')];var _0x470b77=_0x27103f?0x0:_0x3da378['offset'];var _0x4a4ad4=_0x27103f?_0xe511eb[_0x2002('0x21')]:_0x3da378[_0x2002('0x1e')]+_0x3da378[_0x2002('0x20')];var _0x68a6c;if(_0x4a4ad4>=_0x310669){_0x4a4ad4=_0x310669;_0x68a6c=0xc8;}else{_0x68a6c=0xce;}_0x4c1929[_0x2002('0x1b')](_0x68a6c);return _0x4c1929['set'](_0x2002('0x22'),_0x470b77+'-'+_0x4a4ad4+'/'+_0x310669)['json'](_0xe511eb);}return null;};}function patchUpdates(_0x477a8f){return function(_0x5d9cbe){try{jsonpatch[_0x2002('0x23')](_0x5d9cbe,_0x477a8f,!![]);}catch(_0x56cbe7){return BPromise[_0x2002('0x24')](_0x56cbe7);}return _0x5d9cbe[_0x2002('0x25')]();};}function saveUpdates(_0x45e1ef,_0x62f323){return function(_0x4eaa21){if(_0x4eaa21){return _0x4eaa21['update'](_0x45e1ef)[_0x2002('0x26')](function(_0x52e46d){return _0x52e46d;});}return null;};}function removeEntity(_0x55949e,_0x4fe02a){return function(_0x3c7ccb){if(_0x3c7ccb){return _0x3c7ccb[_0x2002('0x27')]()['then'](function(){_0x55949e[_0x2002('0x1b')](0xcc)[_0x2002('0x1c')]();});}};}function handleEntityNotFound(_0x9dc60b,_0x3e6314){return function(_0x2a3c83){if(!_0x2a3c83){_0x9dc60b['sendStatus'](0x194);}return _0x2a3c83;};}function handleError(_0x613ddd,_0x236344){_0x236344=_0x236344||0x1f4;return function(_0x518486){logger[_0x2002('0x28')](_0x518486[_0x2002('0x29')]);if(_0x518486[_0x2002('0x2a')]){delete _0x518486[_0x2002('0x2a')];}_0x613ddd[_0x2002('0x1b')](_0x236344)[_0x2002('0x2b')](_0x518486);};}exports[_0x2002('0x2c')]=function(_0x5166b8,_0x3f52ed){var _0x1100dd={},_0x438dd2={},_0x16d40e={'count':0x0,'rows':[]};var _0x58b710=_[_0x2002('0x2d')](db['CmHopperHistory']['rawAttributes'],function(_0x39e0b4){return{'name':_0x39e0b4['fieldName'],'type':_0x39e0b4['type']['key']};});_0x438dd2[_0x2002('0x2e')]=_[_0x2002('0x2d')](_0x58b710,_0x2002('0x2a'));_0x438dd2[_0x2002('0x2f')]=_[_0x2002('0x30')](_0x5166b8[_0x2002('0x2f')]);_0x438dd2[_0x2002('0x31')]=_[_0x2002('0x32')](_0x438dd2[_0x2002('0x2e')],_0x438dd2[_0x2002('0x2f')]);_0x1100dd[_0x2002('0x33')]=_[_0x2002('0x32')](_0x438dd2[_0x2002('0x2e')],qs[_0x2002('0x34')](_0x5166b8['query'][_0x2002('0x34')]));_0x1100dd[_0x2002('0x33')]=_0x1100dd['attributes'][_0x2002('0x35')]?_0x1100dd['attributes']:_0x438dd2[_0x2002('0x2e')];if(!_0x5166b8[_0x2002('0x2f')][_0x2002('0x36')](_0x2002('0x37'))){_0x1100dd[_0x2002('0x20')]=qs[_0x2002('0x20')](_0x5166b8['query']['limit']);_0x1100dd[_0x2002('0x1e')]=qs[_0x2002('0x1e')](_0x5166b8[_0x2002('0x2f')][_0x2002('0x1e')]);}_0x1100dd[_0x2002('0x38')]=qs[_0x2002('0x39')](_0x5166b8[_0x2002('0x2f')]['sort']);_0x1100dd[_0x2002('0x3a')]=qs[_0x2002('0x31')](_['pick'](_0x5166b8[_0x2002('0x2f')],_0x438dd2['filters']),_0x58b710);if(_0x5166b8[_0x2002('0x2f')]['filter']){_0x1100dd[_0x2002('0x3a')]=_[_0x2002('0x3b')](_0x1100dd[_0x2002('0x3a')],{'$or':_[_0x2002('0x2d')](_0x58b710,function(_0x4231a6){if(_0x4231a6['type']!=='VIRTUAL'){var _0x116915={};_0x116915[_0x4231a6[_0x2002('0x2a')]]={'$like':'%'+_0x5166b8[_0x2002('0x2f')][_0x2002('0x3c')]+'%'};return _0x116915;}})});}_0x1100dd=_[_0x2002('0x3b')]({},_0x1100dd,_0x5166b8[_0x2002('0x3d')]);var _0xc60f59={'where':_0x1100dd[_0x2002('0x3a')]};return db['CmHopperHistory']['count'](_0xc60f59)[_0x2002('0x26')](function(_0x57f5db){_0x16d40e['count']=_0x57f5db;if(_0x5166b8['query'][_0x2002('0x3e')]){_0x1100dd[_0x2002('0x3f')]=[{'all':!![]}];}return db[_0x2002('0x40')][_0x2002('0x41')](_0x1100dd);})[_0x2002('0x26')](function(_0x955852){_0x16d40e['rows']=_0x955852;return _0x16d40e;})[_0x2002('0x26')](respondWithFilteredResult(_0x3f52ed,_0x1100dd))[_0x2002('0x42')](handleError(_0x3f52ed,null));};exports[_0x2002('0x43')]=function(_0x5cca80,_0x521b0d){var _0x11d6cf={'raw':!![],'where':{'id':_0x5cca80[_0x2002('0x44')]['id']}},_0x1fa7bc={};_0x1fa7bc[_0x2002('0x2e')]=_[_0x2002('0x30')](db[_0x2002('0x40')][_0x2002('0x45')]);_0x1fa7bc[_0x2002('0x2f')]=_['keys'](_0x5cca80['query']);_0x1fa7bc['filters']=_[_0x2002('0x32')](_0x1fa7bc[_0x2002('0x2e')],_0x1fa7bc['query']);_0x11d6cf[_0x2002('0x33')]=_[_0x2002('0x32')](_0x1fa7bc[_0x2002('0x2e')],qs[_0x2002('0x34')](_0x5cca80[_0x2002('0x2f')][_0x2002('0x34')]));_0x11d6cf[_0x2002('0x33')]=_0x11d6cf[_0x2002('0x33')][_0x2002('0x35')]?_0x11d6cf[_0x2002('0x33')]:_0x1fa7bc['model'];if(_0x5cca80['query'][_0x2002('0x3e')]){_0x11d6cf[_0x2002('0x3f')]=[{'all':!![]}];}_0x11d6cf=_['merge']({},_0x11d6cf,_0x5cca80['options']);return db[_0x2002('0x40')][_0x2002('0x46')](_0x11d6cf)[_0x2002('0x26')](handleEntityNotFound(_0x521b0d,null))[_0x2002('0x26')](respondWithResult(_0x521b0d,null))[_0x2002('0x42')](handleError(_0x521b0d,null));};exports[_0x2002('0x47')]=function(_0x267fbb,_0x1c907e){return db[_0x2002('0x40')][_0x2002('0x47')](_0x267fbb[_0x2002('0x48')],{})[_0x2002('0x26')](respondWithResult(_0x1c907e,0xc9))[_0x2002('0x42')](handleError(_0x1c907e,null));};exports['describe']=function(_0x3cb87d,_0x57a625){return db['CmHopperHistory'][_0x2002('0x49')]()[_0x2002('0x26')](respondWithResult(_0x57a625,null))[_0x2002('0x42')](handleError(_0x57a625,null));};exports[_0x2002('0x4a')]=function(_0x4c2548,_0x1f95b5){if(_0x4c2548[_0x2002('0x48')][_0x2002('0x4b')]){delete _0x4c2548[_0x2002('0x48')][_0x2002('0x4b')];}return db[_0x2002('0x40')]['find']({'where':{'uniqueid':_0x4c2548[_0x2002('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f95b5,null))[_0x2002('0x26')](saveUpdates(_0x4c2548['body'],null))['then'](respondWithResult(_0x1f95b5,null))[_0x2002('0x42')](handleError(_0x1f95b5,null));}; \ No newline at end of file +var _0x4c6c=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x23a25e,_0x1e4389){var _0x18e422=function(_0x2cfa50){while(--_0x2cfa50){_0x23a25e['push'](_0x23a25e['shift']());}};_0x18e422(++_0x1e4389);}(_0x4c6c,0x1e8));var _0xc4c6=function(_0x8dc0d3,_0x11eac2){_0x8dc0d3=_0x8dc0d3-0x0;var _0x25955c=_0x4c6c[_0x8dc0d3];return _0x25955c;};'use strict';var emlformat=require(_0xc4c6('0x0'));var rimraf=require(_0xc4c6('0x1'));var zipdir=require(_0xc4c6('0x2'));var jsonpatch=require(_0xc4c6('0x3'));var rp=require(_0xc4c6('0x4'));var moment=require(_0xc4c6('0x5'));var BPromise=require(_0xc4c6('0x6'));var Mustache=require(_0xc4c6('0x7'));var util=require(_0xc4c6('0x8'));var path=require(_0xc4c6('0x9'));var sox=require('sox');var csv=require(_0xc4c6('0xa'));var ejs=require(_0xc4c6('0xb'));var fs=require('fs');var fs_extra=require(_0xc4c6('0xc'));var _=require(_0xc4c6('0xd'));var squel=require(_0xc4c6('0xe'));var crypto=require(_0xc4c6('0xf'));var jsforce=require(_0xc4c6('0x10'));var deskjs=require(_0xc4c6('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc4c6('0x12'));var Papa=require('papaparse');var Redis=require(_0xc4c6('0x13'));var authService=require(_0xc4c6('0x14'));var qs=require(_0xc4c6('0x15'));var as=require(_0xc4c6('0x16'));var hardwareService=require(_0xc4c6('0x17'));var logger=require(_0xc4c6('0x18'))('api');var utils=require(_0xc4c6('0x19'));var config=require(_0xc4c6('0x1a'));var licenseUtil=require(_0xc4c6('0x1b'));var db=require(_0xc4c6('0x1c'))['db'];function respondWithStatusCode(_0x856312,_0x21bde3){_0x21bde3=_0x21bde3||0xcc;return function(_0x24fb27){if(_0x24fb27){return _0x856312['sendStatus'](_0x21bde3);}return _0x856312[_0xc4c6('0x1d')](_0x21bde3)[_0xc4c6('0x1e')]();};}function respondWithResult(_0xdf018,_0x19beae){_0x19beae=_0x19beae||0xc8;return function(_0x4264f9){if(_0x4264f9){return _0xdf018[_0xc4c6('0x1d')](_0x19beae)[_0xc4c6('0x1f')](_0x4264f9);}};}function respondWithFilteredResult(_0x488988,_0xea53b3){return function(_0x41ca54){if(_0x41ca54){var _0x4562d9=typeof _0xea53b3[_0xc4c6('0x20')]===_0xc4c6('0x21')&&typeof _0xea53b3[_0xc4c6('0x22')]===_0xc4c6('0x21');var _0x246d5a=_0x41ca54['count'];var _0xdb4202=_0x4562d9?0x0:_0xea53b3[_0xc4c6('0x20')];var _0x113eba=_0x4562d9?_0x41ca54[_0xc4c6('0x23')]:_0xea53b3['offset']+_0xea53b3[_0xc4c6('0x22')];var _0xecab00;if(_0x113eba>=_0x246d5a){_0x113eba=_0x246d5a;_0xecab00=0xc8;}else{_0xecab00=0xce;}_0x488988[_0xc4c6('0x1d')](_0xecab00);return _0x488988[_0xc4c6('0x24')]('Content-Range',_0xdb4202+'-'+_0x113eba+'/'+_0x246d5a)[_0xc4c6('0x1f')](_0x41ca54);}return null;};}function patchUpdates(_0xcd1339){return function(_0x3fc2ae){try{jsonpatch[_0xc4c6('0x25')](_0x3fc2ae,_0xcd1339,!![]);}catch(_0x57d926){return BPromise[_0xc4c6('0x26')](_0x57d926);}return _0x3fc2ae[_0xc4c6('0x27')]();};}function saveUpdates(_0x593533,_0x107115){return function(_0x4fe9f1){if(_0x4fe9f1){return _0x4fe9f1[_0xc4c6('0x28')](_0x593533)['then'](function(_0x4851fc){return _0x4851fc;});}return null;};}function removeEntity(_0x215317,_0x37a14f){return function(_0x36f00a){if(_0x36f00a){return _0x36f00a[_0xc4c6('0x29')]()[_0xc4c6('0x2a')](function(){_0x215317[_0xc4c6('0x1d')](0xcc)[_0xc4c6('0x1e')]();});}};}function handleEntityNotFound(_0x292965,_0x4e2b19){return function(_0x92937b){if(!_0x92937b){_0x292965[_0xc4c6('0x2b')](0x194);}return _0x92937b;};}function handleError(_0x588578,_0x112842){_0x112842=_0x112842||0x1f4;return function(_0x28032a){logger[_0xc4c6('0x2c')](_0x28032a[_0xc4c6('0x2d')]);if(_0x28032a[_0xc4c6('0x2e')]){delete _0x28032a[_0xc4c6('0x2e')];}_0x588578[_0xc4c6('0x1d')](_0x112842)['send'](_0x28032a);};}exports[_0xc4c6('0x2f')]=function(_0xf23548,_0x4d0f5e){var _0x289f6c={},_0x48a848={},_0x4399bc={'count':0x0,'rows':[]};var _0x570483=_[_0xc4c6('0x30')](db[_0xc4c6('0x31')][_0xc4c6('0x32')],function(_0x425078){return{'name':_0x425078[_0xc4c6('0x33')],'type':_0x425078[_0xc4c6('0x34')][_0xc4c6('0x35')]};});_0x48a848[_0xc4c6('0x36')]=_['map'](_0x570483,_0xc4c6('0x2e'));_0x48a848[_0xc4c6('0x37')]=_['keys'](_0xf23548[_0xc4c6('0x37')]);_0x48a848['filters']=_[_0xc4c6('0x38')](_0x48a848['model'],_0x48a848[_0xc4c6('0x37')]);_0x289f6c[_0xc4c6('0x39')]=_[_0xc4c6('0x38')](_0x48a848[_0xc4c6('0x36')],qs[_0xc4c6('0x3a')](_0xf23548[_0xc4c6('0x37')][_0xc4c6('0x3a')]));_0x289f6c['attributes']=_0x289f6c[_0xc4c6('0x39')][_0xc4c6('0x3b')]?_0x289f6c['attributes']:_0x48a848[_0xc4c6('0x36')];if(!_0xf23548['query'][_0xc4c6('0x3c')](_0xc4c6('0x3d'))){_0x289f6c[_0xc4c6('0x22')]=qs[_0xc4c6('0x22')](_0xf23548['query'][_0xc4c6('0x22')]);_0x289f6c[_0xc4c6('0x20')]=qs[_0xc4c6('0x20')](_0xf23548[_0xc4c6('0x37')][_0xc4c6('0x20')]);}_0x289f6c[_0xc4c6('0x3e')]=qs['sort'](_0xf23548[_0xc4c6('0x37')][_0xc4c6('0x3f')]);_0x289f6c[_0xc4c6('0x40')]=qs[_0xc4c6('0x41')](_[_0xc4c6('0x42')](_0xf23548[_0xc4c6('0x37')],_0x48a848['filters']),_0x570483);if(_0xf23548[_0xc4c6('0x37')][_0xc4c6('0x43')]){_0x289f6c[_0xc4c6('0x40')]=_['merge'](_0x289f6c[_0xc4c6('0x40')],{'$or':_[_0xc4c6('0x30')](_0x570483,function(_0x5aeb13){if(_0x5aeb13[_0xc4c6('0x34')]!==_0xc4c6('0x44')){var _0x1150e3={};_0x1150e3[_0x5aeb13['name']]={'$like':'%'+_0xf23548[_0xc4c6('0x37')]['filter']+'%'};return _0x1150e3;}})});}_0x289f6c=_[_0xc4c6('0x45')]({},_0x289f6c,_0xf23548[_0xc4c6('0x46')]);var _0x56171d={'where':_0x289f6c['where']};return db[_0xc4c6('0x31')][_0xc4c6('0x23')](_0x56171d)[_0xc4c6('0x2a')](function(_0x1ba66e){_0x4399bc[_0xc4c6('0x23')]=_0x1ba66e;if(_0xf23548['query']['includeAll']){_0x289f6c[_0xc4c6('0x47')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc4c6('0x48')](_0x289f6c);})['then'](function(_0x5506a7){_0x4399bc['rows']=_0x5506a7;return _0x4399bc;})[_0xc4c6('0x2a')](respondWithFilteredResult(_0x4d0f5e,_0x289f6c))[_0xc4c6('0x49')](handleError(_0x4d0f5e,null));};exports[_0xc4c6('0x4a')]=function(_0xad9b58,_0x11827f){var _0x3a313b={'raw':!![],'where':{'id':_0xad9b58[_0xc4c6('0x4b')]['id']}},_0x4ff07c={};_0x4ff07c['model']=_[_0xc4c6('0x4c')](db[_0xc4c6('0x31')][_0xc4c6('0x32')]);_0x4ff07c[_0xc4c6('0x37')]=_[_0xc4c6('0x4c')](_0xad9b58['query']);_0x4ff07c[_0xc4c6('0x41')]=_[_0xc4c6('0x38')](_0x4ff07c[_0xc4c6('0x36')],_0x4ff07c[_0xc4c6('0x37')]);_0x3a313b[_0xc4c6('0x39')]=_[_0xc4c6('0x38')](_0x4ff07c[_0xc4c6('0x36')],qs[_0xc4c6('0x3a')](_0xad9b58[_0xc4c6('0x37')]['fields']));_0x3a313b['attributes']=_0x3a313b['attributes'][_0xc4c6('0x3b')]?_0x3a313b[_0xc4c6('0x39')]:_0x4ff07c[_0xc4c6('0x36')];if(_0xad9b58[_0xc4c6('0x37')]['includeAll']){_0x3a313b[_0xc4c6('0x47')]=[{'all':!![]}];}_0x3a313b=_[_0xc4c6('0x45')]({},_0x3a313b,_0xad9b58['options']);return db[_0xc4c6('0x31')][_0xc4c6('0x4d')](_0x3a313b)['then'](handleEntityNotFound(_0x11827f,null))[_0xc4c6('0x2a')](respondWithResult(_0x11827f,null))['catch'](handleError(_0x11827f,null));};exports[_0xc4c6('0x4e')]=function(_0x384d97,_0x1e1ec5){return db['CmHopperHistory'][_0xc4c6('0x4e')](_0x384d97[_0xc4c6('0x4f')],{})[_0xc4c6('0x2a')](respondWithResult(_0x1e1ec5,0xc9))[_0xc4c6('0x49')](handleError(_0x1e1ec5,null));};exports[_0xc4c6('0x50')]=function(_0x30487e,_0x6d5007){return db['CmHopperHistory'][_0xc4c6('0x50')]()[_0xc4c6('0x2a')](respondWithResult(_0x6d5007,null))[_0xc4c6('0x49')](handleError(_0x6d5007,null));};exports[_0xc4c6('0x28')]=function(_0xd8ea4,_0x529dd2){if(_0xd8ea4[_0xc4c6('0x4f')][_0xc4c6('0x51')]){delete _0xd8ea4[_0xc4c6('0x4f')][_0xc4c6('0x51')];}return db[_0xc4c6('0x31')][_0xc4c6('0x4d')]({'where':{'uniqueid':_0xd8ea4[_0xc4c6('0x4b')]['id']}})[_0xc4c6('0x2a')](handleEntityNotFound(_0x529dd2,null))[_0xc4c6('0x2a')](saveUpdates(_0xd8ea4[_0xc4c6('0x4f')],null))[_0xc4c6('0x2a')](respondWithResult(_0x529dd2,null))[_0xc4c6('0x49')](handleError(_0x529dd2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 1dea5ec..85c4446 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 _0xfa4d=['uniqueid','lodash','util','api','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x582c9b,_0x16a48f){var _0x4c2616=function(_0xdd0cfe){while(--_0xdd0cfe){_0x582c9b['push'](_0x582c9b['shift']());}};_0x4c2616(++_0x16a48f);}(_0xfa4d,0x90));var _0xdfa4=function(_0xd5ee28,_0x3e9986){_0xd5ee28=_0xd5ee28-0x0;var _0x47ad37=_0xfa4d[_0xd5ee28];return _0x47ad37;};'use strict';var _=require(_0xdfa4('0x0'));var util=require(_0xdfa4('0x1'));var logger=require('../../config/logger')(_0xdfa4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfa4('0x3'));var rimraf=require(_0xdfa4('0x4'));var config=require(_0xdfa4('0x5'));var attributes=require(_0xdfa4('0x6'));module[_0xdfa4('0x7')]=function(_0x383a02,_0x3e1c11){return _0x383a02[_0xdfa4('0x8')](_0xdfa4('0x9'),attributes,{'tableName':_0xdfa4('0xa'),'paranoid':![],'indexes':[{'name':_0xdfa4('0xb'),'fields':[_0xdfa4('0xb')]},{'name':_0xdfa4('0xc'),'fields':[_0xdfa4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb91a=['api','moment','request-promise','path','../../config/environment','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x13ec2b,_0x40b664){var _0x1fb3f4=function(_0x3e91e9){while(--_0x3e91e9){_0x13ec2b['push'](_0x13ec2b['shift']());}};_0x1fb3f4(++_0x40b664);}(_0xb91a,0xe5));var _0xab91=function(_0x387047,_0x4befab){_0x387047=_0x387047-0x0;var _0x420758=_0xb91a[_0x387047];return _0x420758;};'use strict';var _=require('lodash');var util=require(_0xab91('0x0'));var logger=require(_0xab91('0x1'))(_0xab91('0x2'));var moment=require(_0xab91('0x3'));var BPromise=require('bluebird');var rp=require(_0xab91('0x4'));var fs=require('fs');var path=require(_0xab91('0x5'));var rimraf=require('rimraf');var config=require(_0xab91('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x1f99d4,_0x1cce1e){return _0x1f99d4['define'](_0xab91('0x7'),attributes,{'tableName':_0xab91('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xab91('0x9')]},{'name':_0xab91('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 a7d9ce4..8f800d5 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 _0xb458=['catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','findAll','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','AvgHandleTime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','`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','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4a141a,_0x2d4638){var _0x3a38f5=function(_0x15eb04){while(--_0x15eb04){_0x4a141a['push'](_0x4a141a['shift']());}};_0x3a38f5(++_0x2d4638);}(_0xb458,0xca));var _0x8b45=function(_0xd85e0d,_0x3de3de){_0xd85e0d=_0xd85e0d-0x0;var _0x3cd371=_0xb458[_0xd85e0d];return _0x3cd371;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var utils=require(_0x8b45('0x6'));var logger=require(_0x8b45('0x7'))(_0x8b45('0x8'));var config=require(_0x8b45('0x9'));var jayson=require(_0x8b45('0xa'));var client=jayson[_0x8b45('0xb')][_0x8b45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114de0,_0x15dcf4,_0x2f0c9e){return new BPromise(function(_0x1386a4,_0x54f299){return client[_0x8b45('0xd')](_0x114de0,_0x2f0c9e)['then'](function(_0x4a1617){logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));logger['debug'](_0x8b45('0x11'),_0x15dcf4,'request\x20sent',JSON[_0x8b45('0x12')](_0x4a1617));if(_0x4a1617[_0x8b45('0x13')]){if(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x14')]===0x1f4){logger[_0x8b45('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x15dcf4,_0x4a1617['error'][_0x8b45('0x15')]);return _0x54f299(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}logger[_0x8b45('0x13')](_0x8b45('0xf'),_0x15dcf4,_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);return _0x1386a4(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}else{logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));_0x1386a4(_0x4a1617[_0x8b45('0x16')][_0x8b45('0x15')]);}})[_0x8b45('0x17')](function(_0x59547e){logger['error'](_0x8b45('0xf'),_0x15dcf4,_0x59547e);_0x54f299(_0x59547e);});});}exports[_0x8b45('0x18')]=function(_0xfb84af){var _0x3a832e=this;return new Promise(function(_0x39bffe,_0x4cf9e5){return db[_0x8b45('0x19')]['create'](_0xfb84af[_0x8b45('0x1a')],{'raw':_0xfb84af['options']?_0xfb84af[_0x8b45('0x1b')][_0x8b45('0x1c')]===undefined?!![]:![]:!![]})[_0x8b45('0x1d')](function(_0x51fe21){logger[_0x8b45('0xe')](_0x8b45('0x18'),_0xfb84af);logger['debug'](_0x8b45('0x18'),_0xfb84af,JSON[_0x8b45('0x12')](_0x51fe21));_0x39bffe(_0x51fe21);})[_0x8b45('0x17')](function(_0x4e57a9){logger[_0x8b45('0x13')](_0x8b45('0x18'),_0x4e57a9[_0x8b45('0x15')],_0xfb84af);_0x4cf9e5(_0x3a832e['error'](0x1f4,_0x4e57a9[_0x8b45('0x15')]));});});};exports['AvgHandleTime']=function(_0x5cd08a){var _0x32bfc5=this;return new Promise(function(_0x102dcb,_0xbc5c09){return db[_0x8b45('0x19')][_0x8b45('0x1e')]({'raw':_0x5cd08a['options']?_0x5cd08a[_0x8b45('0x1b')][_0x8b45('0x1c')]===undefined?!![]:![]:!![],'where':_0x5cd08a['options']?_0x5cd08a['options']['where']||null:null,'attributes':[[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db['sequelize']['col']('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0x8b45('0x1f')]['fn']('IF',db['sequelize'][_0x8b45('0x21')](_0x8b45('0x22')))),_0x8b45('0x23')],[db[_0x8b45('0x1f')]['fn']('COUNT',db[_0x8b45('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x8b45('0x24')))),_0x8b45('0x25')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x26')))),_0x8b45('0x27')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x28'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x29')))),_0x8b45('0x2a')],[db['sequelize']['fn'](_0x8b45('0x28'),db[_0x8b45('0x1f')]['fn']('IF',db['sequelize'][_0x8b45('0x21')](_0x8b45('0x2b')))),_0x8b45('0x2c')]]})['then'](function(_0x5e978a){logger[_0x8b45('0xe')]('AvgHandleTime',_0x5cd08a);logger[_0x8b45('0x2d')]('AvgHandleTime',_0x5cd08a,JSON[_0x8b45('0x12')](_0x5e978a));_0x102dcb(_0x5e978a);})['catch'](function(_0x485be0){logger['error'](_0x8b45('0x2e'),_0x485be0[_0x8b45('0x15')],_0x5cd08a);_0xbc5c09(_0x32bfc5[_0x8b45('0x13')](0x1f4,_0x485be0[_0x8b45('0x15')]));});});};exports[_0x8b45('0x2f')]=function(_0x1355d4){var _0x533394=this;return new Promise(function(_0x1d9a50,_0x24961d){return db['CmHopperHistory']['findAll']({'raw':_0x1355d4[_0x8b45('0x1b')]?_0x1355d4[_0x8b45('0x1b')][_0x8b45('0x1c')]===undefined?!![]:![]:!![],'where':_0x1355d4[_0x8b45('0x1b')]?_0x1355d4[_0x8b45('0x1b')]['where']||null:null,'attributes':[['campaign',_0x8b45('0x30')],[db['sequelize']['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db['sequelize'][_0x8b45('0x21')](_0x8b45('0x31')))),'outboundNoSuchCallsDay'],[db[_0x8b45('0x1f')]['fn']('COUNT',db[_0x8b45('0x1f')]['fn']('IF',db['sequelize'][_0x8b45('0x21')](_0x8b45('0x32')))),_0x8b45('0x33')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x22')))),_0x8b45('0x34')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')]['literal'](_0x8b45('0x35')))),_0x8b45('0x36')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x37')))),_0x8b45('0x38')],[db[_0x8b45('0x1f')]['fn']('COUNT',db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x39')))),'outboundDropCallsDayTimeout'],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x3a')))),_0x8b45('0x3b')],[db[_0x8b45('0x1f')]['fn']('COUNT',db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x3c')))),_0x8b45('0x3d')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db['sequelize'][_0x8b45('0x21')](_0x8b45('0x3e')))),_0x8b45('0x3f')],[db[_0x8b45('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x40')))),'outboundOriginateFailureCallsDay'],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x41')))),_0x8b45('0x42')],[db['sequelize']['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x43')))),_0x8b45('0x44')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x45')))),_0x8b45('0x42')],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db['sequelize']['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x46')))),'outboundReCallsDay']],'group':[_0x8b45('0x47')]})[_0x8b45('0x1d')](function(_0xfa087b){logger[_0x8b45('0xe')](_0x8b45('0x2f'),_0x1355d4);logger[_0x8b45('0x2d')]('GetVoiceQueueHopperHistory',_0x1355d4,JSON[_0x8b45('0x12')](_0xfa087b));_0x1d9a50(_0xfa087b);})['catch'](function(_0x5b7193){logger[_0x8b45('0x13')](_0x8b45('0x2f'),_0x5b7193[_0x8b45('0x15')],_0x1355d4);_0x24961d(_0x533394[_0x8b45('0x13')](0x1f4,_0x5b7193['message']));});});};exports[_0x8b45('0x48')]=function(_0x4de2a7){var _0x2e423d=this;return new Promise(function(_0x2f1044,_0x47c8bc){return db['CmHopperHistory'][_0x8b45('0x1e')]({'raw':_0x4de2a7['options']?_0x4de2a7['options'][_0x8b45('0x1c')]===undefined?!![]:![]:!![],'where':_0x4de2a7[_0x8b45('0x1b')]?_0x4de2a7[_0x8b45('0x1b')]['where']||null:null,'attributes':[[_0x8b45('0x47'),'name'],[db[_0x8b45('0x1f')]['fn'](_0x8b45('0x20'),db[_0x8b45('0x1f')][_0x8b45('0x49')]('id')),'ivrTotalCallsDays'],[db[_0x8b45('0x1f')]['fn']('COUNT',db[_0x8b45('0x1f')]['fn']('IF',db[_0x8b45('0x1f')][_0x8b45('0x21')](_0x8b45('0x22')))),_0x8b45('0x4a')]],'group':[_0x8b45('0x47')]})[_0x8b45('0x1d')](function(_0x41a14d){logger[_0x8b45('0xe')](_0x8b45('0x48'),_0x4de2a7);logger[_0x8b45('0x2d')](_0x8b45('0x48'),_0x4de2a7,JSON[_0x8b45('0x12')](_0x41a14d));_0x2f1044(_0x41a14d);})[_0x8b45('0x17')](function(_0x4f0e2f){logger['error']('GetCampaignHopperHistory',_0x4f0e2f['message'],_0x4de2a7);_0x47c8bc(_0x2e423d[_0x8b45('0x13')](0x1f4,_0x4f0e2f['message']));});});}; \ No newline at end of file +var _0xe773=['CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','info','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch'];(function(_0x27ad07,_0x2d3d47){var _0x3148b4=function(_0x3e8f75){while(--_0x3e8f75){_0x27ad07['push'](_0x27ad07['shift']());}};_0x3148b4(++_0x2d3d47);}(_0xe773,0x19a));var _0x3e77=function(_0x3daa1a,_0x109bda){_0x3daa1a=_0x3daa1a-0x0;var _0x394e17=_0xe773[_0x3daa1a];return _0x394e17;};'use strict';var _=require('lodash');var util=require(_0x3e77('0x0'));var moment=require(_0x3e77('0x1'));var BPromise=require(_0x3e77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e77('0x3'));var db=require(_0x3e77('0x4'))['db'];var utils=require(_0x3e77('0x5'));var logger=require(_0x3e77('0x6'))(_0x3e77('0x7'));var config=require('../../config/environment');var jayson=require(_0x3e77('0x8'));var client=jayson[_0x3e77('0x9')][_0x3e77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x441fda,_0x7b7dfe,_0x22dd9a){return new BPromise(function(_0x4244af,_0x22bf10){return client[_0x3e77('0xb')](_0x441fda,_0x22dd9a)[_0x3e77('0xc')](function(_0x272f48){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x7b7dfe,_0x3e77('0xd'));logger[_0x3e77('0xe')](_0x3e77('0xf'),_0x7b7dfe,_0x3e77('0xd'),JSON[_0x3e77('0x10')](_0x272f48));if(_0x272f48['error']){if(_0x272f48[_0x3e77('0x11')]['code']===0x1f4){logger['error'](_0x3e77('0x12'),_0x7b7dfe,_0x272f48['error']['message']);return _0x22bf10(_0x272f48[_0x3e77('0x11')][_0x3e77('0x13')]);}logger[_0x3e77('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x7b7dfe,_0x272f48[_0x3e77('0x11')]['message']);return _0x4244af(_0x272f48[_0x3e77('0x11')][_0x3e77('0x13')]);}else{logger['info'](_0x3e77('0x12'),_0x7b7dfe,_0x3e77('0xd'));_0x4244af(_0x272f48[_0x3e77('0x14')][_0x3e77('0x13')]);}})[_0x3e77('0x15')](function(_0x2c42e7){logger['error'](_0x3e77('0x12'),_0x7b7dfe,_0x2c42e7);_0x22bf10(_0x2c42e7);});});}exports[_0x3e77('0x16')]=function(_0x35d890){var _0x6e0f11=this;return new Promise(function(_0x58b8ee,_0x521f95){return db[_0x3e77('0x17')]['create'](_0x35d890[_0x3e77('0x18')],{'raw':_0x35d890[_0x3e77('0x19')]?_0x35d890[_0x3e77('0x19')][_0x3e77('0x1a')]===undefined?!![]:![]:!![]})[_0x3e77('0xc')](function(_0x19c4e1){logger['info'](_0x3e77('0x16'),_0x35d890);logger[_0x3e77('0xe')](_0x3e77('0x16'),_0x35d890,JSON[_0x3e77('0x10')](_0x19c4e1));_0x58b8ee(_0x19c4e1);})[_0x3e77('0x15')](function(_0x289c3d){logger[_0x3e77('0x11')](_0x3e77('0x16'),_0x289c3d['message'],_0x35d890);_0x521f95(_0x6e0f11[_0x3e77('0x11')](0x1f4,_0x289c3d[_0x3e77('0x13')]));});});};exports[_0x3e77('0x1b')]=function(_0x1b2ce6){var _0x576d9d=this;return new Promise(function(_0x30873c,_0x320144){return db[_0x3e77('0x17')][_0x3e77('0x1c')]({'raw':_0x1b2ce6[_0x3e77('0x19')]?_0x1b2ce6[_0x3e77('0x19')][_0x3e77('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b2ce6[_0x3e77('0x19')]?_0x1b2ce6[_0x3e77('0x19')][_0x3e77('0x1d')]||null:null,'attributes':[[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db['sequelize'][_0x3e77('0x20')]('id')),_0x3e77('0x21')],[db['sequelize']['fn']('COUNT',db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x23')))),'predictiveIntervalAnsweredCalls'],[db[_0x3e77('0x1e')]['fn']('COUNT',db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x24')))),_0x3e77('0x25')],[db['sequelize']['fn'](_0x3e77('0x26'),db[_0x3e77('0x1e')]['fn']('IF',db['sequelize'][_0x3e77('0x22')](_0x3e77('0x27')))),_0x3e77('0x28')],[db['sequelize']['fn'](_0x3e77('0x26'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x29')))),_0x3e77('0x2a')]]})[_0x3e77('0xc')](function(_0x5a55d8){logger[_0x3e77('0x2b')](_0x3e77('0x1b'),_0x1b2ce6);logger[_0x3e77('0xe')](_0x3e77('0x1b'),_0x1b2ce6,JSON['stringify'](_0x5a55d8));_0x30873c(_0x5a55d8);})[_0x3e77('0x15')](function(_0x372bc){logger[_0x3e77('0x11')](_0x3e77('0x1b'),_0x372bc[_0x3e77('0x13')],_0x1b2ce6);_0x320144(_0x576d9d['error'](0x1f4,_0x372bc[_0x3e77('0x13')]));});});};exports[_0x3e77('0x2c')]=function(_0x4d8bc0){var _0x2159c3=this;return new Promise(function(_0x407350,_0x20a690){return db[_0x3e77('0x17')][_0x3e77('0x1c')]({'raw':_0x4d8bc0[_0x3e77('0x19')]?_0x4d8bc0[_0x3e77('0x19')][_0x3e77('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d8bc0[_0x3e77('0x19')]?_0x4d8bc0[_0x3e77('0x19')][_0x3e77('0x1d')]||null:null,'attributes':[['campaign',_0x3e77('0x2d')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db['sequelize']['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x2e')))),_0x3e77('0x2f')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db['sequelize'][_0x3e77('0x22')](_0x3e77('0x30')))),_0x3e77('0x31')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')]['literal'](_0x3e77('0x23')))),'outboundAnswerCallsDay'],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0x3e77('0x32')],[db['sequelize']['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x33')))),_0x3e77('0x34')],[db['sequelize']['fn']('COUNT',db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x35')))),_0x3e77('0x36')],[db[_0x3e77('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x37')))),_0x3e77('0x38')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x3e77('0x39')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')]['literal'](_0x3e77('0x3a')))),_0x3e77('0x3b')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x3c')))),_0x3e77('0x3d')],[db[_0x3e77('0x1e')]['fn']('COUNT',db[_0x3e77('0x1e')]['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x3e')))),'outboundRejectCallsDay'],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db['sequelize'][_0x3e77('0x22')](_0x3e77('0x3f')))),_0x3e77('0x40')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db['sequelize']['fn']('IF',db[_0x3e77('0x1e')][_0x3e77('0x22')](_0x3e77('0x41')))),_0x3e77('0x42')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db['sequelize'][_0x3e77('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x3e77('0x43')]],'group':[_0x3e77('0x44')]})[_0x3e77('0xc')](function(_0x1e3c3a){logger[_0x3e77('0x2b')](_0x3e77('0x2c'),_0x4d8bc0);logger[_0x3e77('0xe')](_0x3e77('0x2c'),_0x4d8bc0,JSON[_0x3e77('0x10')](_0x1e3c3a));_0x407350(_0x1e3c3a);})['catch'](function(_0x24346a){logger[_0x3e77('0x11')](_0x3e77('0x2c'),_0x24346a[_0x3e77('0x13')],_0x4d8bc0);_0x20a690(_0x2159c3[_0x3e77('0x11')](0x1f4,_0x24346a[_0x3e77('0x13')]));});});};exports[_0x3e77('0x45')]=function(_0x3757da){var _0x3c7255=this;return new Promise(function(_0x131542,_0x17047e){return db['CmHopperHistory'][_0x3e77('0x1c')]({'raw':_0x3757da['options']?_0x3757da[_0x3e77('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3757da[_0x3e77('0x19')]?_0x3757da[_0x3e77('0x19')][_0x3e77('0x1d')]||null:null,'attributes':[[_0x3e77('0x44'),_0x3e77('0x2d')],[db[_0x3e77('0x1e')]['fn'](_0x3e77('0x1f'),db['sequelize']['col']('id')),_0x3e77('0x46')],[db['sequelize']['fn'](_0x3e77('0x1f'),db[_0x3e77('0x1e')]['fn']('IF',db['sequelize'][_0x3e77('0x22')](_0x3e77('0x23')))),_0x3e77('0x47')]],'group':[_0x3e77('0x44')]})[_0x3e77('0xc')](function(_0x1c2d3d){logger[_0x3e77('0x2b')]('GetCampaignHopperHistory',_0x3757da);logger[_0x3e77('0xe')](_0x3e77('0x45'),_0x3757da,JSON[_0x3e77('0x10')](_0x1c2d3d));_0x131542(_0x1c2d3d);})[_0x3e77('0x15')](function(_0xda7bd5){logger[_0x3e77('0x11')](_0x3e77('0x45'),_0xda7bd5['message'],_0x3757da);_0x17047e(_0x3c7255['error'](0x1f4,_0xda7bd5[_0x3e77('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 1c520fd..5228ccb 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 _0x0d60=['/:id','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','/describe','get','show','create','put'];(function(_0x495f0b,_0x499f83){var _0xef44be=function(_0xea90c){while(--_0xea90c){_0x495f0b['push'](_0x495f0b['shift']());}};_0xef44be(++_0x499f83);}(_0x0d60,0xdb));var _0x00d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0d60[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x00d6('0x0'));var util=require(_0x00d6('0x1'));var path=require(_0x00d6('0x2'));var timeout=require(_0x00d6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x00d6('0x4'));var auth=require(_0x00d6('0x5'));var interaction=require(_0x00d6('0x6'));var config=require(_0x00d6('0x7'));var controller=require(_0x00d6('0x8'));router['get']('/',auth[_0x00d6('0x9')](),controller['index']);router['get'](_0x00d6('0xa'),auth[_0x00d6('0x9')](),controller['describe']);router[_0x00d6('0xb')]('/:id',auth[_0x00d6('0x9')](),controller[_0x00d6('0xc')]);router['post']('/',auth[_0x00d6('0x9')](),controller[_0x00d6('0xd')]);router[_0x00d6('0xe')](_0x00d6('0xf'),auth[_0x00d6('0x9')](),controller[_0x00d6('0x10')]);module[_0x00d6('0x11')]=router; \ No newline at end of file +var _0x7d4f=['get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x3e69ca,_0x11cacf){var _0x3d7d5d=function(_0x528349){while(--_0x528349){_0x3e69ca['push'](_0x3e69ca['shift']());}};_0x3d7d5d(++_0x11cacf);}(_0x7d4f,0x173));var _0xf7d4=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x7d4f[_0x5517c0];return _0x33803b;};'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(_0xf7d4('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d4('0x5'));var auth=require(_0xf7d4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7d4('0x7'));var controller=require(_0xf7d4('0x8'));router[_0xf7d4('0x9')]('/',auth[_0xf7d4('0xa')](),controller[_0xf7d4('0xb')]);router[_0xf7d4('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xf7d4('0xc'),auth[_0xf7d4('0xa')](),controller[_0xf7d4('0xd')]);router[_0xf7d4('0xe')]('/',auth[_0xf7d4('0xa')](),controller[_0xf7d4('0xf')]);router[_0xf7d4('0x10')]('/:id',auth[_0xf7d4('0xa')](),controller[_0xf7d4('0x11')]);module[_0xf7d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 3745d77..9d0957e 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 _0xca9e=['STRING','name','sequelize','exports'];(function(_0x4c0092,_0x14bc0e){var _0x5a2903=function(_0x14320b){while(--_0x14320b){_0x4c0092['push'](_0x4c0092['shift']());}};_0x5a2903(++_0x14bc0e);}(_0xca9e,0x136));var _0xeca9=function(_0x2b594e,_0x30987d){_0x2b594e=_0x2b594e-0x0;var _0xd82b91=_0xca9e[_0x2b594e];return _0xd82b91;};'use strict';var Sequelize=require(_0xeca9('0x0'));module[_0xeca9('0x1')]={'name':{'type':Sequelize[_0xeca9('0x2')],'unique':_0xeca9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeca9('0x2')]},'dialPrefix':{'type':Sequelize[_0xeca9('0x2')]}}; \ No newline at end of file +var _0x5447=['name','sequelize','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5447,0xf1));var _0x7544=function(_0x5350f5,_0x359a37){_0x5350f5=_0x5350f5-0x0;var _0x2b986a=_0x5447[_0x5350f5];return _0x2b986a;};'use strict';var Sequelize=require(_0x7544('0x0'));module['exports']={'name':{'type':Sequelize[_0x7544('0x1')],'unique':_0x7544('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7544('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 38f9d71..77ff66c 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 _0x5fab=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','user','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','fields','filter','removeDispositions','ids','addContacts','isArray','tags','join','push','each','omit','success','errors','message','getContacts','CmCustomField','CustomFields','CmContact','concat','format','raw','getContactsCsv','cf_%d','isEmpty','now','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','cf_%s','getCustomFields','findOne','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x5fab,0x134));var _0xb5fa=function(_0x37d172,_0x55b556){_0x37d172=_0x37d172-0x0;var _0xc6dac3=_0x5fab[_0x37d172];return _0xc6dac3;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require(_0xb5fa('0xc'));var fs=require('fs');var fs_extra=require(_0xb5fa('0xd'));var _=require('lodash');var squel=require(_0xb5fa('0xe'));var crypto=require(_0xb5fa('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0x10'));var Papa=require(_0xb5fa('0x11'));var Redis=require(_0xb5fa('0x12'));var authService=require(_0xb5fa('0x13'));var qs=require(_0xb5fa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5fa('0x15'));var logger=require(_0xb5fa('0x16'))('api');var utils=require(_0xb5fa('0x17'));var config=require(_0xb5fa('0x18'));var licenseUtil=require(_0xb5fa('0x19'));var db=require('../../mysqldb')['db'];config[_0xb5fa('0x1a')]=_[_0xb5fa('0x1b')](config[_0xb5fa('0x1a')],{'host':_0xb5fa('0x1c'),'port':0x18eb});var socket=require(_0xb5fa('0x1d'))(new Redis(config['redis']));require(_0xb5fa('0x1e'))[_0xb5fa('0x1f')](socket);function respondWithStatusCode(_0x46d4a0,_0x616416){_0x616416=_0x616416||0xcc;return function(_0x54bf41){if(_0x54bf41){return _0x46d4a0[_0xb5fa('0x20')](_0x616416);}return _0x46d4a0[_0xb5fa('0x21')](_0x616416)[_0xb5fa('0x22')]();};}function respondWithResult(_0x11406e,_0x355eb9){_0x355eb9=_0x355eb9||0xc8;return function(_0x3c9436){if(_0x3c9436){return _0x11406e[_0xb5fa('0x21')](_0x355eb9)[_0xb5fa('0x23')](_0x3c9436);}};}function respondWithFilteredResult(_0x112046,_0x4264b5){return function(_0x34f82d){if(_0x34f82d){var _0x4ffd99=typeof _0x4264b5[_0xb5fa('0x24')]==='undefined'&&typeof _0x4264b5[_0xb5fa('0x25')]==='undefined';var _0x42c343=_0x34f82d[_0xb5fa('0x26')];var _0x170bfb=_0x4ffd99?0x0:_0x4264b5[_0xb5fa('0x24')];var _0x5aa1f4=_0x4ffd99?_0x34f82d[_0xb5fa('0x26')]:_0x4264b5['offset']+_0x4264b5['limit'];var _0x38bad5;if(_0x5aa1f4>=_0x42c343){_0x5aa1f4=_0x42c343;_0x38bad5=0xc8;}else{_0x38bad5=0xce;}_0x112046[_0xb5fa('0x21')](_0x38bad5);return _0x112046['set'](_0xb5fa('0x27'),_0x170bfb+'-'+_0x5aa1f4+'/'+_0x42c343)['json'](_0x34f82d);}return null;};}function patchUpdates(_0x35c3e2){return function(_0x3737be){try{jsonpatch['apply'](_0x3737be,_0x35c3e2,!![]);}catch(_0x5045fd){return BPromise[_0xb5fa('0x28')](_0x5045fd);}return _0x3737be['save']();};}function saveUpdates(_0x15ade8,_0x41639a){return function(_0x181729){if(_0x181729){return _0x181729[_0xb5fa('0x29')](_0x15ade8)['then'](function(_0x4dfd2e){return _0x4dfd2e;});}return null;};}function removeEntity(_0x4d7313,_0xef741b){return function(_0x3ec4bc){if(_0x3ec4bc){return _0x3ec4bc[_0xb5fa('0x2a')]()[_0xb5fa('0x2b')](function(){var _0x5d441c=_0x3ec4bc[_0xb5fa('0x2c')]({'plain':!![]});var _0x577982='Lists';return db[_0xb5fa('0x2d')][_0xb5fa('0x2a')]({'where':{'type':_0x577982,'resourceId':_0x5d441c['id']}})['then'](function(){return _0x3ec4bc;});})['then'](function(){_0x4d7313['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d402c,_0x49ef3a){return function(_0x221660){if(!_0x221660){_0x1d402c['sendStatus'](0x194);}return _0x221660;};}function handleError(_0x17fbd9,_0x3a8458){_0x3a8458=_0x3a8458||0x1f4;return function(_0x4f5b54){logger[_0xb5fa('0x2e')](_0x4f5b54[_0xb5fa('0x2f')]);if(_0x4f5b54['name']){delete _0x4f5b54[_0xb5fa('0x30')];}_0x17fbd9['status'](_0x3a8458)[_0xb5fa('0x31')](_0x4f5b54);};}exports[_0xb5fa('0x32')]=function(_0x50afb3,_0x49cf63){var _0xfc307e={},_0xb20dc8={},_0x580fc1={'count':0x0,'rows':[]};var _0x39ee60=_['map'](db[_0xb5fa('0x33')][_0xb5fa('0x34')],function(_0x4c5e30){return{'name':_0x4c5e30[_0xb5fa('0x35')],'type':_0x4c5e30[_0xb5fa('0x36')][_0xb5fa('0x37')]};});_0xb20dc8[_0xb5fa('0x38')]=_[_0xb5fa('0x39')](_0x39ee60,_0xb5fa('0x30'));_0xb20dc8['query']=_[_0xb5fa('0x3a')](_0x50afb3['query']);_0xb20dc8[_0xb5fa('0x3b')]=_[_0xb5fa('0x3c')](_0xb20dc8[_0xb5fa('0x38')],_0xb20dc8['query']);_0xfc307e[_0xb5fa('0x3d')]=_[_0xb5fa('0x3c')](_0xb20dc8['model'],qs['fields'](_0x50afb3[_0xb5fa('0x3e')]['fields']));_0xfc307e[_0xb5fa('0x3d')]=_0xfc307e[_0xb5fa('0x3d')][_0xb5fa('0x3f')]?_0xfc307e[_0xb5fa('0x3d')]:_0xb20dc8[_0xb5fa('0x38')];if(!_0x50afb3[_0xb5fa('0x3e')][_0xb5fa('0x40')](_0xb5fa('0x41'))){_0xfc307e[_0xb5fa('0x25')]=qs[_0xb5fa('0x25')](_0x50afb3[_0xb5fa('0x3e')][_0xb5fa('0x25')]);_0xfc307e[_0xb5fa('0x24')]=qs[_0xb5fa('0x24')](_0x50afb3[_0xb5fa('0x3e')]['offset']);}_0xfc307e[_0xb5fa('0x42')]=qs[_0xb5fa('0x43')](_0x50afb3[_0xb5fa('0x3e')][_0xb5fa('0x43')]);_0xfc307e[_0xb5fa('0x44')]=qs[_0xb5fa('0x3b')](_[_0xb5fa('0x45')](_0x50afb3[_0xb5fa('0x3e')],_0xb20dc8[_0xb5fa('0x3b')]),_0x39ee60);if(_0x50afb3['query']['filter']){_0xfc307e[_0xb5fa('0x44')]=_[_0xb5fa('0x46')](_0xfc307e[_0xb5fa('0x44')],{'$or':_['map'](_0x39ee60,function(_0x2b4b15){if(_0x2b4b15[_0xb5fa('0x36')]!==_0xb5fa('0x47')){var _0x20eabb={};_0x20eabb[_0x2b4b15[_0xb5fa('0x30')]]={'$like':'%'+_0x50afb3['query']['filter']+'%'};return _0x20eabb;}})});}_0xfc307e=_[_0xb5fa('0x46')]({},_0xfc307e,_0x50afb3[_0xb5fa('0x48')]);var _0x4b9894={'where':_0xfc307e[_0xb5fa('0x44')]};return db['CmList'][_0xb5fa('0x26')](_0x4b9894)['then'](function(_0x5d53d0){_0x580fc1['count']=_0x5d53d0;if(_0x50afb3[_0xb5fa('0x3e')]['includeAll']){_0xfc307e['include']=[{'all':!![]}];}return db[_0xb5fa('0x33')][_0xb5fa('0x49')](_0xfc307e);})[_0xb5fa('0x2b')](function(_0x513110){_0x580fc1[_0xb5fa('0x4a')]=_0x513110;return _0x580fc1;})['then'](respondWithFilteredResult(_0x49cf63,_0xfc307e))['catch'](handleError(_0x49cf63,null));};exports[_0xb5fa('0x4b')]=function(_0x251d80,_0x39f139){var _0x919b3d={'raw':![],'where':{'id':_0x251d80[_0xb5fa('0x4c')]['id']}},_0x1f2450={};_0x1f2450[_0xb5fa('0x38')]=_['keys'](db[_0xb5fa('0x33')][_0xb5fa('0x34')]);_0x1f2450[_0xb5fa('0x3e')]=_[_0xb5fa('0x3a')](_0x251d80[_0xb5fa('0x3e')]);_0x1f2450[_0xb5fa('0x3b')]=_[_0xb5fa('0x3c')](_0x1f2450[_0xb5fa('0x38')],_0x1f2450['query']);_0x919b3d[_0xb5fa('0x3d')]=_[_0xb5fa('0x3c')](_0x1f2450['model'],qs['fields'](_0x251d80[_0xb5fa('0x3e')]['fields']));_0x919b3d[_0xb5fa('0x3d')]=_0x919b3d[_0xb5fa('0x3d')][_0xb5fa('0x3f')]?_0x919b3d[_0xb5fa('0x3d')]:_0x1f2450[_0xb5fa('0x38')];if(_0x251d80[_0xb5fa('0x3e')][_0xb5fa('0x4d')]){_0x919b3d[_0xb5fa('0x4e')]=[{'all':!![]}];}_0x919b3d=_[_0xb5fa('0x46')]({},_0x919b3d,_0x251d80[_0xb5fa('0x48')]);return db['CmList'][_0xb5fa('0x4f')](_0x919b3d)['then'](handleEntityNotFound(_0x39f139,null))[_0xb5fa('0x2b')](respondWithResult(_0x39f139,null))[_0xb5fa('0x50')](handleError(_0x39f139,null));};exports[_0xb5fa('0x51')]=function(_0x1e1852,_0x4ecbd5){return db[_0xb5fa('0x33')][_0xb5fa('0x51')](_0x1e1852[_0xb5fa('0x52')],{})[_0xb5fa('0x2b')](function(_0x2be94e){var _0x208b30=_0x1e1852[_0xb5fa('0x53')][_0xb5fa('0x2c')]({'plain':!![]});if(!_0x208b30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x208b30[_0xb5fa('0x54')]===_0xb5fa('0x53')){var _0x1a63ac=_0x2be94e[_0xb5fa('0x2c')]({'plain':!![]});var _0x2d7872=_0xb5fa('0x55');return db[_0xb5fa('0x56')][_0xb5fa('0x4f')]({'where':{'name':_0x2d7872,'userProfileId':_0x208b30[_0xb5fa('0x57')]},'raw':!![]})[_0xb5fa('0x2b')](function(_0x2112cb){if(_0x2112cb&&_0x2112cb[_0xb5fa('0x58')]===0x0){return db[_0xb5fa('0x2d')][_0xb5fa('0x51')]({'name':_0x1a63ac[_0xb5fa('0x30')],'resourceId':_0x1a63ac['id'],'type':_0x2112cb[_0xb5fa('0x30')],'sectionId':_0x2112cb['id']},{})[_0xb5fa('0x2b')](function(){return _0x2be94e;});}else{return _0x2be94e;}})[_0xb5fa('0x50')](function(_0xb89e52){logger['error'](_0xb5fa('0x59'),_0xb89e52);throw _0xb89e52;});}return _0x2be94e;})['then'](respondWithResult(_0x4ecbd5,0xc9))[_0xb5fa('0x50')](handleError(_0x4ecbd5,null));};exports['update']=function(_0x2b0fc0,_0x59ac02){if(_0x2b0fc0[_0xb5fa('0x52')]['id']){delete _0x2b0fc0[_0xb5fa('0x52')]['id'];}return db[_0xb5fa('0x33')][_0xb5fa('0x4f')]({'where':{'id':_0x2b0fc0['params']['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x59ac02,null))[_0xb5fa('0x2b')](saveUpdates(_0x2b0fc0[_0xb5fa('0x52')],null))[_0xb5fa('0x2b')](respondWithResult(_0x59ac02,null))['catch'](handleError(_0x59ac02,null));};exports[_0xb5fa('0x2a')]=function(_0x3da87d,_0x151136){return db[_0xb5fa('0x33')]['find']({'where':{'id':_0x3da87d['params']['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x151136,null))[_0xb5fa('0x2b')](removeEntity(_0x151136,null))[_0xb5fa('0x50')](handleError(_0x151136,null));};exports['describe']=function(_0x3da287,_0x29ee1c){return db['CmList'][_0xb5fa('0x5a')]()[_0xb5fa('0x2b')](respondWithResult(_0x29ee1c,null))[_0xb5fa('0x50')](handleError(_0x29ee1c,null));};exports[_0xb5fa('0x5b')]=function(_0x444883,_0x59797a,_0xe902a8){if(_0x444883['body']['id']){delete _0x444883[_0xb5fa('0x52')]['id'];}return db[_0xb5fa('0x33')]['find']({'where':{'id':_0x444883['params']['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x59797a,null))[_0xb5fa('0x2b')](function(_0x2434b5){if(_0x2434b5){_0x444883['body'][_0xb5fa('0x5c')]=_0x2434b5['id'];return db['Disposition'][_0xb5fa('0x51')](_0x444883[_0xb5fa('0x52')]);}})['then'](respondWithResult(_0x59797a,null))[_0xb5fa('0x50')](handleError(_0x59797a,null));};exports[_0xb5fa('0x5d')]=function(_0x1d93ff,_0x587a1f,_0x322124){var _0x1ba19={'raw':![],'where':{}};var _0x47f7f3={};var _0x5a56ce={'count':0x0,'rows':[]};return db[_0xb5fa('0x33')]['findOne']({'where':{'id':_0x1d93ff[_0xb5fa('0x4c')]['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x587a1f,null))[_0xb5fa('0x2b')](function(_0x21748e){if(_0x21748e){_0x47f7f3['model']=_[_0xb5fa('0x3a')](db[_0xb5fa('0x5e')][_0xb5fa('0x34')]);_0x47f7f3[_0xb5fa('0x3e')]=_['keys'](_0x1d93ff[_0xb5fa('0x3e')]);_0x47f7f3[_0xb5fa('0x3b')]=_[_0xb5fa('0x3c')](_0x47f7f3['model'],_0x47f7f3[_0xb5fa('0x3e')]);_0x1ba19['attributes']=_[_0xb5fa('0x3c')](_0x47f7f3['model'],qs[_0xb5fa('0x5f')](_0x1d93ff[_0xb5fa('0x3e')][_0xb5fa('0x5f')]));_0x1ba19[_0xb5fa('0x3d')]=_0x1ba19[_0xb5fa('0x3d')][_0xb5fa('0x3f')]?_0x1ba19[_0xb5fa('0x3d')]:_0x47f7f3['model'];if(!_0x1d93ff[_0xb5fa('0x3e')]['hasOwnProperty'](_0xb5fa('0x41'))){_0x1ba19[_0xb5fa('0x25')]=qs[_0xb5fa('0x25')](_0x1d93ff[_0xb5fa('0x3e')][_0xb5fa('0x25')]);_0x1ba19[_0xb5fa('0x24')]=qs[_0xb5fa('0x24')](_0x1d93ff[_0xb5fa('0x3e')][_0xb5fa('0x24')]);}_0x1ba19['order']=qs['sort'](_0x1d93ff[_0xb5fa('0x3e')][_0xb5fa('0x43')]);_0x1ba19['where']=qs[_0xb5fa('0x3b')](_[_0xb5fa('0x45')](_0x1d93ff['query'],_0x47f7f3[_0xb5fa('0x3b')]));_0x1ba19[_0xb5fa('0x44')][_0xb5fa('0x5c')]=_0x21748e['id'];if(_0x1d93ff[_0xb5fa('0x3e')][_0xb5fa('0x60')]){_0x1ba19[_0xb5fa('0x44')]=_['merge'](_0x1ba19[_0xb5fa('0x44')],{'$or':_[_0xb5fa('0x39')](_0x1ba19[_0xb5fa('0x3d')],function(_0x1548be){var _0x52ec39={};_0x52ec39[_0x1548be]={'$like':'%'+_0x1d93ff['query']['filter']+'%'};return _0x52ec39;})});}_0x1ba19=_['merge']({},_0x1ba19,_0x1d93ff[_0xb5fa('0x48')]);return db[_0xb5fa('0x5e')][_0xb5fa('0x26')]({'where':_0x1ba19[_0xb5fa('0x44')]})['then'](function(_0x2aa0be){_0x5a56ce[_0xb5fa('0x26')]=_0x2aa0be;if(_0x1d93ff['query'][_0xb5fa('0x4d')]){_0x1ba19[_0xb5fa('0x4e')]=[{'all':!![]}];}return db[_0xb5fa('0x5e')][_0xb5fa('0x49')](_0x1ba19);})[_0xb5fa('0x2b')](function(_0x39a8fa){_0x5a56ce[_0xb5fa('0x4a')]=_0x39a8fa;return _0x5a56ce;});}})['then'](respondWithFilteredResult(_0x587a1f,_0x1ba19))[_0xb5fa('0x50')](handleError(_0x587a1f,null));};exports[_0xb5fa('0x61')]=function(_0x247802,_0x343793,_0x4a63de){return db[_0xb5fa('0x33')]['find']({'where':{'id':_0x247802[_0xb5fa('0x4c')]['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x343793,null))[_0xb5fa('0x2b')](function(_0x2ae9dc){if(_0x2ae9dc){return _0x2ae9dc[_0xb5fa('0x61')](_0x247802[_0xb5fa('0x3e')][_0xb5fa('0x62')]);}})['then'](respondWithStatusCode(_0x343793,null))[_0xb5fa('0x50')](handleError(_0x343793,null));};exports[_0xb5fa('0x63')]=function(_0x4cd8c6,_0x25c74e,_0x6af92){return db[_0xb5fa('0x33')][_0xb5fa('0x4f')]({'where':{'id':_0x4cd8c6[_0xb5fa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25c74e,null))[_0xb5fa('0x2b')](function(_0x1742c5){if(_0x1742c5){var _0xd369aa=[];var _0x2491dc={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x2b903d){if(_0x4cd8c6[_0xb5fa('0x52')]['tags']&&_[_0xb5fa('0x64')](_0x4cd8c6[_0xb5fa('0x52')][_0xb5fa('0x65')])){if(_0x4cd8c6[_0xb5fa('0x52')][_0xb5fa('0x65')][_0xb5fa('0x3f')]){_0x4cd8c6[_0xb5fa('0x52')]['tags']=_0x4cd8c6['body']['tags'][_0xb5fa('0x66')](';')+';';}else{_0x4cd8c6[_0xb5fa('0x52')][_0xb5fa('0x65')]=null;}}else{_0x4cd8c6['body'][_0xb5fa('0x65')]=null;}if(_0x4cd8c6[_0xb5fa('0x52')]&&_['isArray'](_0x4cd8c6[_0xb5fa('0x52')])){for(var _0x1170c4=0x0;_0x1170c4<_0x4cd8c6[_0xb5fa('0x52')][_0xb5fa('0x3f')];_0x1170c4+=0x1){_0x4cd8c6[_0xb5fa('0x52')][_0x1170c4]['ListId']=_0x4cd8c6[_0xb5fa('0x4c')]['id'];_0xd369aa[_0xb5fa('0x67')](_0x4cd8c6['body'][_0x1170c4]);}return BPromise[_0xb5fa('0x68')](_0xd369aa,function(_0x140e1d){return db['CmContact'][_0xb5fa('0x51')](_[_0xb5fa('0x69')](_0x140e1d,[_0xb5fa('0x62'),'id'])||{},{'fields':_[_0xb5fa('0x3a')](_0x2b903d),'raw':!![]})[_0xb5fa('0x2b')](function(_0x4cffcc){_0x2491dc[_0xb5fa('0x6a')][_0xb5fa('0x67')](_0x4cffcc['dataValues']);})['catch'](function(_0x57079f){_0x2491dc[_0xb5fa('0x6b')][_0xb5fa('0x67')]({'data':_0x140e1d,'error':_0x57079f[_0xb5fa('0x6c')]});});})['then'](function(_0x1a1c85){return _0x2491dc;})[_0xb5fa('0x50')](function(_0x1c7217){return _0x1c7217;});}else{_0x25c74e[_0xb5fa('0x21')](0x190)[_0xb5fa('0x23')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xb5fa('0x2b')](respondWithResult(_0x25c74e,null))[_0xb5fa('0x50')](handleError(_0x25c74e,null));};exports[_0xb5fa('0x6d')]=function(_0x4f32bd,_0x17cd19,_0x12d0dd){var _0x5aa5a0;return db[_0xb5fa('0x33')][_0xb5fa('0x4f')]({'where':{'id':_0x4f32bd[_0xb5fa('0x4c')]['id']},'include':[{'model':db[_0xb5fa('0x6e')],'as':_0xb5fa('0x6f')}]})[_0xb5fa('0x2b')](handleEntityNotFound(_0x17cd19,null))[_0xb5fa('0x2b')](function(_0x185d7c){if(_0x185d7c){_0x5aa5a0=_0x185d7c;return db[_0xb5fa('0x70')][_0xb5fa('0x34')];}})[_0xb5fa('0x2b')](function(_0x586382){if(_0x586382){var _0x4cb12a={};var _0x2409e0={};_0x2409e0[_0xb5fa('0x38')]=_[_0xb5fa('0x71')](_[_0xb5fa('0x3a')](_0x586382),_['map'](_0x5aa5a0[_0xb5fa('0x6f')],function(_0x579c8d){return util[_0xb5fa('0x72')]('cf_%d',_0x579c8d['id']);}));_0x2409e0[_0xb5fa('0x3e')]=_[_0xb5fa('0x3a')](_0x4f32bd[_0xb5fa('0x3e')]);_0x2409e0[_0xb5fa('0x3b')]=_[_0xb5fa('0x3c')](_0x2409e0[_0xb5fa('0x38')],_0x2409e0[_0xb5fa('0x3e')]);_0x4cb12a[_0xb5fa('0x3d')]=_['intersection'](_0x2409e0['model'],qs[_0xb5fa('0x5f')](_0x4f32bd[_0xb5fa('0x3e')][_0xb5fa('0x5f')]));_0x4cb12a['attributes']=_0x4cb12a['attributes'][_0xb5fa('0x3f')]?_0x4cb12a[_0xb5fa('0x3d')]:_0x2409e0[_0xb5fa('0x38')];if(!_0x4f32bd[_0xb5fa('0x3e')]['hasOwnProperty'](_0xb5fa('0x41'))){_0x4cb12a[_0xb5fa('0x25')]=qs[_0xb5fa('0x25')](_0x4f32bd[_0xb5fa('0x3e')][_0xb5fa('0x25')]);_0x4cb12a[_0xb5fa('0x24')]=qs[_0xb5fa('0x24')](_0x4f32bd[_0xb5fa('0x3e')]['offset']);}_0x4cb12a[_0xb5fa('0x42')]=qs[_0xb5fa('0x43')](_0x4f32bd[_0xb5fa('0x3e')][_0xb5fa('0x43')]);_0x4cb12a[_0xb5fa('0x44')]=qs[_0xb5fa('0x3b')](_[_0xb5fa('0x45')](_0x4f32bd[_0xb5fa('0x3e')],_0x2409e0[_0xb5fa('0x3b')]));_0x4cb12a[_0xb5fa('0x73')]=!![];if(_0x4f32bd['query'][_0xb5fa('0x60')]){_0x4cb12a[_0xb5fa('0x44')]=_[_0xb5fa('0x46')](_0x4cb12a[_0xb5fa('0x44')],{'$or':_[_0xb5fa('0x39')](_0x4cb12a['attributes'],function(_0x3be10a){var _0x29e522={};_0x29e522[_0x3be10a]={'$like':'%'+_0x4f32bd[_0xb5fa('0x3e')][_0xb5fa('0x60')]+'%'};return _0x29e522;})});}_0x4cb12a=_[_0xb5fa('0x46')]({},_0x4cb12a,_0x4f32bd['options']);return _0x5aa5a0[_0xb5fa('0x6d')](_0x4cb12a);}})['then'](respondWithResult(_0x17cd19,null))[_0xb5fa('0x50')](handleError(_0x17cd19,null));};exports[_0xb5fa('0x74')]=function(_0x1c0305,_0x3bf3ef,_0x361d45){var _0x1d9ab0;return db['CmList']['find']({'where':{'id':_0x1c0305[_0xb5fa('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xb5fa('0x6f')}]})[_0xb5fa('0x2b')](handleEntityNotFound(_0x3bf3ef,null))[_0xb5fa('0x2b')](function(_0x20bee3){if(_0x20bee3){_0x1d9ab0=_0x20bee3;return db[_0xb5fa('0x70')][_0xb5fa('0x34')];}})[_0xb5fa('0x2b')](function(_0x1181a7){if(_0x1181a7){var _0x2b3855={};var _0x308f8a={};_0x308f8a[_0xb5fa('0x38')]=_[_0xb5fa('0x71')](_[_0xb5fa('0x3a')](_0x1181a7),_[_0xb5fa('0x39')](_0x1d9ab0['CustomFields'],function(_0x54a42e){return util[_0xb5fa('0x72')](_0xb5fa('0x75'),_0x54a42e['id']);}));_0x308f8a[_0xb5fa('0x3e')]=_['keys'](_0x1c0305['query']);_0x308f8a[_0xb5fa('0x3b')]=_[_0xb5fa('0x3c')](_0x308f8a[_0xb5fa('0x38')],_0x308f8a[_0xb5fa('0x3e')]);_0x2b3855['attributes']=_[_0xb5fa('0x3c')](_0x308f8a[_0xb5fa('0x38')],qs[_0xb5fa('0x5f')](_0x1c0305['query']['fields']));_0x2b3855['attributes']=_0x2b3855['attributes'][_0xb5fa('0x3f')]?_0x2b3855[_0xb5fa('0x3d')]:_0x308f8a[_0xb5fa('0x38')];if(!_0x1c0305['query'][_0xb5fa('0x40')]('nolimit')){_0x2b3855[_0xb5fa('0x25')]=qs['limit'](_0x1c0305['query'][_0xb5fa('0x25')]);_0x2b3855[_0xb5fa('0x24')]=qs['offset'](_0x1c0305[_0xb5fa('0x3e')]['offset']);}_0x2b3855[_0xb5fa('0x42')]=qs[_0xb5fa('0x43')](_0x1c0305['query'][_0xb5fa('0x43')]);_0x2b3855[_0xb5fa('0x44')]=qs['filters'](_['pick'](_0x1c0305[_0xb5fa('0x3e')],_0x308f8a[_0xb5fa('0x3b')]));_0x2b3855[_0xb5fa('0x73')]=!![];if(_0x1c0305[_0xb5fa('0x3e')]['filter']){_0x2b3855[_0xb5fa('0x44')]=_['merge'](_0x2b3855[_0xb5fa('0x44')],{'$or':_[_0xb5fa('0x39')](_0x2b3855[_0xb5fa('0x3d')],function(_0x4afdae){var _0x3baf85={};_0x3baf85[_0x4afdae]={'$like':'%'+_0x1c0305['query'][_0xb5fa('0x60')]+'%'};return _0x3baf85;})});}_0x2b3855=_['merge']({},_0x2b3855,_0x1c0305[_0xb5fa('0x48')]);return _0x1d9ab0[_0xb5fa('0x6d')](_0x2b3855);}})[_0xb5fa('0x2b')](function(_0x57cea9){if(!_[_0xb5fa('0x76')](_0x57cea9)){var _0x1b806a=toCsv(_0x57cea9);var _0x5461b9=Date[_0xb5fa('0x77')]();fs['writeFileSync'](util['format'](_0xb5fa('0x78'),_0x1d9ab0['id'],_0x5461b9),_0x1b806a);_0x3bf3ef['setHeader'](_0xb5fa('0x79'),_0xb5fa('0x7a')+util['format'](_0xb5fa('0x7b'),_0x1d9ab0['id'],_0x5461b9));_0x3bf3ef[_0xb5fa('0x7c')](_0xb5fa('0x7d'),_0xb5fa('0x7e'));return _0x3bf3ef[_0xb5fa('0x7f')](util[_0xb5fa('0x72')](_0xb5fa('0x78'),_0x1d9ab0['id'],_0x5461b9));}else{return _0x3bf3ef[_0xb5fa('0x20')](0xcc);}})[_0xb5fa('0x50')](handleError(_0x3bf3ef,null));};exports[_0xb5fa('0x80')]=function(_0x4573de,_0x1c9030,_0xb939b7){var _0x371540;delete _0x4573de['body']['id'];return db[_0xb5fa('0x33')]['findOne']({'where':{'id':_0x4573de[_0xb5fa('0x4c')]['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x1c9030,null))['then'](function(_0x5aeccf){if(_0x5aeccf){return db['sequelize'][_0xb5fa('0x81')](function(_0x2e718d){return db['CmCustomField'][_0xb5fa('0x51')](_0x4573de['body'],{'transaction':_0x2e718d})['then'](function(_0x1f076e){_0x371540=_0x1f076e;return _0x5aeccf[_0xb5fa('0x82')](_0x1f076e,{'transaction':_0x2e718d});})[_0xb5fa('0x2b')](function(){var _0x110573={'type':db['Sequelize']['TEXT'],'transaction':_0x2e718d};switch(_0x4573de['body']['type']){case _0xb5fa('0x83'):_0x110573['type']=db[_0xb5fa('0x84')][_0xb5fa('0x85')];break;case _0xb5fa('0x86'):_0x110573[_0xb5fa('0x36')]=db[_0xb5fa('0x84')][_0xb5fa('0x87')];break;case _0xb5fa('0x88'):_0x110573[_0xb5fa('0x36')]=db[_0xb5fa('0x84')][_0xb5fa('0x89')];_0x110573[_0xb5fa('0x8a')]=![];break;default:}return db[_0xb5fa('0x8b')]['queryInterface'][_0xb5fa('0x8c')](_0xb5fa('0x8d'),util[_0xb5fa('0x72')](_0xb5fa('0x8e'),_0x371540['id']),_0x110573);})[_0xb5fa('0x2b')](function(){return _0x371540;});});}})[_0xb5fa('0x2b')](respondWithResult(_0x1c9030,null))['catch'](handleError(_0x1c9030,null));};exports[_0xb5fa('0x8f')]=function(_0xf7e7fc,_0x45d6fa,_0x595d72){var _0x42b638={};var _0x26620f={};var _0x275f50;var _0x441dc8;return db[_0xb5fa('0x33')][_0xb5fa('0x90')]({'where':{'id':_0xf7e7fc['params']['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x45d6fa,null))['then'](function(_0xaab249){if(_0xaab249){_0x275f50=_0xaab249;_0x26620f[_0xb5fa('0x38')]=_['keys'](db['CmCustomField'][_0xb5fa('0x34')]);_0x26620f[_0xb5fa('0x3e')]=_[_0xb5fa('0x3a')](_0xf7e7fc[_0xb5fa('0x3e')]);_0x26620f['filters']=_[_0xb5fa('0x3c')](_0x26620f[_0xb5fa('0x38')],_0x26620f[_0xb5fa('0x3e')]);_0x42b638['attributes']=_[_0xb5fa('0x3c')](_0x26620f['model'],qs[_0xb5fa('0x5f')](_0xf7e7fc['query'][_0xb5fa('0x5f')]));_0x42b638[_0xb5fa('0x3d')]=_0x42b638[_0xb5fa('0x3d')][_0xb5fa('0x3f')]?_0x42b638['attributes']:_0x26620f[_0xb5fa('0x38')];_0x42b638[_0xb5fa('0x42')]=qs[_0xb5fa('0x43')](_0xf7e7fc['query'][_0xb5fa('0x43')]);_0x42b638[_0xb5fa('0x44')]=qs['filters'](_[_0xb5fa('0x45')](_0xf7e7fc[_0xb5fa('0x3e')],_0x26620f[_0xb5fa('0x3b')]));_0x42b638[_0xb5fa('0x44')]=_['merge'](_0x42b638[_0xb5fa('0x44')],{'$or':[{'ListId':_0xaab249['id']},{'ListId':null}]});if(_0xf7e7fc[_0xb5fa('0x3e')]['filter']){_0x42b638['where']=_[_0xb5fa('0x46')](_0x42b638[_0xb5fa('0x44')],{'$or':_[_0xb5fa('0x39')](_0x42b638[_0xb5fa('0x3d')],function(_0x1ce0ed){var _0x5dcee0={};_0x5dcee0[_0x1ce0ed]={'$like':'%'+_0xf7e7fc[_0xb5fa('0x3e')][_0xb5fa('0x60')]+'%'};return _0x5dcee0;})});}_0x42b638=_[_0xb5fa('0x46')]({},_0x42b638,_0xf7e7fc[_0xb5fa('0x48')]);return db[_0xb5fa('0x6e')][_0xb5fa('0x91')](_0x42b638);}})[_0xb5fa('0x2b')](respondWithResult(_0x45d6fa,null))['catch'](handleError(_0x45d6fa,null));};exports[_0xb5fa('0x92')]=function(_0x460f4a,_0x2f9052,_0x51972d){return db['CmList']['find']({'where':{'id':_0x460f4a[_0xb5fa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f9052,null))['then'](function(_0x20f935){if(_0x20f935){return _0x20f935['addAgents'](_0x460f4a[_0xb5fa('0x52')]['ids'],_[_0xb5fa('0x69')](_0x460f4a['body'],[_0xb5fa('0x62'),'id'])||{})[_0xb5fa('0x93')](function(_0x3338c5){for(var _0x3bca55=0x0;_0x3bca55<_0x460f4a[_0xb5fa('0x52')][_0xb5fa('0x62')]['length'];_0x3bca55+=0x1){socket['emit'](_0xb5fa('0x94'),{'UserId':Number(_0x460f4a[_0xb5fa('0x52')][_0xb5fa('0x62')][_0x3bca55]),'CmListId':Number(_0x460f4a['params']['id'])});}return _0x3338c5;});}})[_0xb5fa('0x2b')](respondWithResult(_0x2f9052,null))[_0xb5fa('0x50')](handleError(_0x2f9052,null));};exports[_0xb5fa('0x95')]=function(_0x315610,_0x13fde3,_0x1dd4ba){return db[_0xb5fa('0x33')]['find']({'where':{'id':_0x315610[_0xb5fa('0x4c')]['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x13fde3,null))['then'](function(_0x24a5e1){if(_0x24a5e1){return _0x24a5e1[_0xb5fa('0x95')](_0x315610[_0xb5fa('0x3e')][_0xb5fa('0x62')])[_0xb5fa('0x2b')](function(){if(_['isArray'](_0x315610[_0xb5fa('0x3e')][_0xb5fa('0x62')])){for(var _0x3fa0e0=0x0;_0x3fa0e0<_0x315610[_0xb5fa('0x3e')][_0xb5fa('0x62')][_0xb5fa('0x3f')];_0x3fa0e0+=0x1){socket[_0xb5fa('0x96')](_0xb5fa('0x97'),{'UserId':Number(_0x315610[_0xb5fa('0x3e')][_0xb5fa('0x62')][_0x3fa0e0]),'CmListId':Number(_0x315610[_0xb5fa('0x4c')]['id'])});}}else{socket[_0xb5fa('0x96')](_0xb5fa('0x97'),{'UserId':Number(_0x315610['query']['ids']),'CmListId':Number(_0x315610[_0xb5fa('0x4c')]['id'])});}});}})[_0xb5fa('0x2b')](respondWithStatusCode(_0x13fde3,null))[_0xb5fa('0x50')](handleError(_0x13fde3,null));};exports[_0xb5fa('0x98')]=function(_0x34d096,_0x5789cf,_0x2dd5d9){var _0x2e4850={};var _0x4fc676={};var _0x11ae69;var _0x548b39;return db['CmList'][_0xb5fa('0x90')]({'where':{'id':_0x34d096[_0xb5fa('0x4c')]['id']}})[_0xb5fa('0x2b')](handleEntityNotFound(_0x5789cf,null))[_0xb5fa('0x2b')](function(_0xb5e14d){if(_0xb5e14d){_0x11ae69=_0xb5e14d;_0x4fc676['model']=_['keys'](db[_0xb5fa('0x99')][_0xb5fa('0x34')]);_0x4fc676[_0xb5fa('0x3e')]=_[_0xb5fa('0x3a')](_0x34d096['query']);_0x4fc676[_0xb5fa('0x3b')]=_[_0xb5fa('0x3c')](_0x4fc676['model'],_0x4fc676[_0xb5fa('0x3e')]);_0x2e4850['attributes']=_[_0xb5fa('0x3c')](_0x4fc676[_0xb5fa('0x38')],qs[_0xb5fa('0x5f')](_0x34d096['query'][_0xb5fa('0x5f')]));_0x2e4850[_0xb5fa('0x3d')]=_0x2e4850[_0xb5fa('0x3d')][_0xb5fa('0x3f')]?_0x2e4850[_0xb5fa('0x3d')]:_0x4fc676[_0xb5fa('0x38')];_0x2e4850[_0xb5fa('0x42')]=qs[_0xb5fa('0x43')](_0x34d096[_0xb5fa('0x3e')][_0xb5fa('0x43')]);_0x2e4850[_0xb5fa('0x44')]=qs[_0xb5fa('0x3b')](_[_0xb5fa('0x45')](_0x34d096['query'],_0x4fc676[_0xb5fa('0x3b')]));if(_0x34d096[_0xb5fa('0x3e')]['filter']){_0x2e4850['where']=_['merge'](_0x2e4850['where'],{'$or':_[_0xb5fa('0x39')](_0x2e4850[_0xb5fa('0x3d')],function(_0x12ff9b){var _0x84df7b={};_0x84df7b[_0x12ff9b]={'$like':'%'+_0x34d096[_0xb5fa('0x3e')][_0xb5fa('0x60')]+'%'};return _0x84df7b;})});}_0x2e4850=_[_0xb5fa('0x46')]({},_0x2e4850,_0x34d096['options']);return _0x11ae69[_0xb5fa('0x98')](_0x2e4850);}})[_0xb5fa('0x2b')](function(_0x330277){if(_0x330277){_0x548b39=_0x330277[_0xb5fa('0x3f')];if(!_0x34d096[_0xb5fa('0x3e')][_0xb5fa('0x40')](_0xb5fa('0x41'))){_0x2e4850['limit']=qs[_0xb5fa('0x25')](_0x34d096[_0xb5fa('0x3e')]['limit']);_0x2e4850[_0xb5fa('0x24')]=qs[_0xb5fa('0x24')](_0x34d096[_0xb5fa('0x3e')][_0xb5fa('0x24')]);}return _0x11ae69['getAgents'](_0x2e4850);}})[_0xb5fa('0x2b')](function(_0x31c4f0){if(_0x31c4f0){return _0x31c4f0?{'count':_0x548b39,'rows':_0x31c4f0}:null;}})[_0xb5fa('0x2b')](respondWithResult(_0x5789cf,null))[_0xb5fa('0x50')](handleError(_0x5789cf,null));}; \ No newline at end of file +var _0xbc7a=['setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','stack','index','map','CmList','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','pick','ListId','removeDispositions','ids','CmContact','tags','join','isArray','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv'];(function(_0x3b7fb0,_0x553e21){var _0x3b7fc5=function(_0x286bdc){while(--_0x286bdc){_0x3b7fb0['push'](_0x3b7fb0['shift']());}};_0x3b7fc5(++_0x553e21);}(_0xbc7a,0x1e0));var _0xabc7=function(_0x6960e9,_0x9e9642){_0x6960e9=_0x6960e9-0x0;var _0x48191b=_0xbc7a[_0x6960e9];return _0x48191b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabc7('0x0'));var zipdir=require(_0xabc7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabc7('0x2'));var moment=require(_0xabc7('0x3'));var BPromise=require(_0xabc7('0x4'));var Mustache=require(_0xabc7('0x5'));var util=require(_0xabc7('0x6'));var path=require(_0xabc7('0x7'));var sox=require(_0xabc7('0x8'));var csv=require(_0xabc7('0x9'));var ejs=require(_0xabc7('0xa'));var fs=require('fs');var fs_extra=require(_0xabc7('0xb'));var _=require('lodash');var squel=require(_0xabc7('0xc'));var crypto=require(_0xabc7('0xd'));var jsforce=require(_0xabc7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xabc7('0x9'));var querystring=require(_0xabc7('0xf'));var Papa=require('papaparse');var Redis=require(_0xabc7('0x10'));var authService=require(_0xabc7('0x11'));var qs=require(_0xabc7('0x12'));var as=require(_0xabc7('0x13'));var hardwareService=require(_0xabc7('0x14'));var logger=require(_0xabc7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xabc7('0x16'));var licenseUtil=require(_0xabc7('0x17'));var db=require(_0xabc7('0x18'))['db'];config[_0xabc7('0x19')]=_[_0xabc7('0x1a')](config[_0xabc7('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xabc7('0x1b'))[_0xabc7('0x1c')](socket);function respondWithStatusCode(_0x247141,_0x463acd){_0x463acd=_0x463acd||0xcc;return function(_0x3bb7bf){if(_0x3bb7bf){return _0x247141[_0xabc7('0x1d')](_0x463acd);}return _0x247141[_0xabc7('0x1e')](_0x463acd)[_0xabc7('0x1f')]();};}function respondWithResult(_0x3c9aa5,_0x1d3091){_0x1d3091=_0x1d3091||0xc8;return function(_0x148484){if(_0x148484){return _0x3c9aa5[_0xabc7('0x1e')](_0x1d3091)[_0xabc7('0x20')](_0x148484);}};}function respondWithFilteredResult(_0x1f062f,_0xedb220){return function(_0x4b89dc){if(_0x4b89dc){var _0x34d2a1=typeof _0xedb220[_0xabc7('0x21')]===_0xabc7('0x22')&&typeof _0xedb220[_0xabc7('0x23')]===_0xabc7('0x22');var _0x26cda9=_0x4b89dc[_0xabc7('0x24')];var _0x1c986b=_0x34d2a1?0x0:_0xedb220['offset'];var _0x1ab0be=_0x34d2a1?_0x4b89dc['count']:_0xedb220[_0xabc7('0x21')]+_0xedb220[_0xabc7('0x23')];var _0x3905e0;if(_0x1ab0be>=_0x26cda9){_0x1ab0be=_0x26cda9;_0x3905e0=0xc8;}else{_0x3905e0=0xce;}_0x1f062f['status'](_0x3905e0);return _0x1f062f['set']('Content-Range',_0x1c986b+'-'+_0x1ab0be+'/'+_0x26cda9)[_0xabc7('0x20')](_0x4b89dc);}return null;};}function patchUpdates(_0x5192b5){return function(_0x4f3516){try{jsonpatch[_0xabc7('0x25')](_0x4f3516,_0x5192b5,!![]);}catch(_0x33d07a){return BPromise[_0xabc7('0x26')](_0x33d07a);}return _0x4f3516[_0xabc7('0x27')]();};}function saveUpdates(_0x2d9667,_0x244542){return function(_0x54add5){if(_0x54add5){return _0x54add5[_0xabc7('0x28')](_0x2d9667)[_0xabc7('0x29')](function(_0x554f37){return _0x554f37;});}return null;};}function removeEntity(_0x350aca,_0xd17f05){return function(_0x4335e3){if(_0x4335e3){return _0x4335e3[_0xabc7('0x2a')]()['then'](function(){var _0x212423=_0x4335e3[_0xabc7('0x2b')]({'plain':!![]});var _0x1bd128='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x1bd128,'resourceId':_0x212423['id']}})[_0xabc7('0x29')](function(){return _0x4335e3;});})[_0xabc7('0x29')](function(){_0x350aca[_0xabc7('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30776f,_0x24debd){return function(_0x37f4da){if(!_0x37f4da){_0x30776f['sendStatus'](0x194);}return _0x37f4da;};}function handleError(_0x164951,_0x1ebb24){_0x1ebb24=_0x1ebb24||0x1f4;return function(_0x145731){logger['error'](_0x145731[_0xabc7('0x2c')]);if(_0x145731['name']){delete _0x145731['name'];}_0x164951['status'](_0x1ebb24)['send'](_0x145731);};}exports[_0xabc7('0x2d')]=function(_0x20e46f,_0x47ad1e){var _0x1c669f={},_0x1aff4e={},_0x1a526b={'count':0x0,'rows':[]};var _0x36e097=_[_0xabc7('0x2e')](db[_0xabc7('0x2f')][_0xabc7('0x30')],function(_0x263ff0){return{'name':_0x263ff0[_0xabc7('0x31')],'type':_0x263ff0[_0xabc7('0x32')][_0xabc7('0x33')]};});_0x1aff4e[_0xabc7('0x34')]=_[_0xabc7('0x2e')](_0x36e097,'name');_0x1aff4e['query']=_[_0xabc7('0x35')](_0x20e46f[_0xabc7('0x36')]);_0x1aff4e[_0xabc7('0x37')]=_['intersection'](_0x1aff4e[_0xabc7('0x34')],_0x1aff4e['query']);_0x1c669f[_0xabc7('0x38')]=_[_0xabc7('0x39')](_0x1aff4e[_0xabc7('0x34')],qs[_0xabc7('0x3a')](_0x20e46f[_0xabc7('0x36')][_0xabc7('0x3a')]));_0x1c669f[_0xabc7('0x38')]=_0x1c669f[_0xabc7('0x38')][_0xabc7('0x3b')]?_0x1c669f[_0xabc7('0x38')]:_0x1aff4e[_0xabc7('0x34')];if(!_0x20e46f['query']['hasOwnProperty'](_0xabc7('0x3c'))){_0x1c669f[_0xabc7('0x23')]=qs[_0xabc7('0x23')](_0x20e46f[_0xabc7('0x36')][_0xabc7('0x23')]);_0x1c669f[_0xabc7('0x21')]=qs[_0xabc7('0x21')](_0x20e46f[_0xabc7('0x36')][_0xabc7('0x21')]);}_0x1c669f[_0xabc7('0x3d')]=qs[_0xabc7('0x3e')](_0x20e46f[_0xabc7('0x36')][_0xabc7('0x3e')]);_0x1c669f[_0xabc7('0x3f')]=qs['filters'](_['pick'](_0x20e46f[_0xabc7('0x36')],_0x1aff4e[_0xabc7('0x37')]),_0x36e097);if(_0x20e46f['query'][_0xabc7('0x40')]){_0x1c669f[_0xabc7('0x3f')]=_[_0xabc7('0x41')](_0x1c669f['where'],{'$or':_[_0xabc7('0x2e')](_0x36e097,function(_0x3a43bc){if(_0x3a43bc[_0xabc7('0x32')]!==_0xabc7('0x42')){var _0x269fc2={};_0x269fc2[_0x3a43bc[_0xabc7('0x43')]]={'$like':'%'+_0x20e46f[_0xabc7('0x36')][_0xabc7('0x40')]+'%'};return _0x269fc2;}})});}_0x1c669f=_[_0xabc7('0x41')]({},_0x1c669f,_0x20e46f[_0xabc7('0x44')]);var _0x1f04b={'where':_0x1c669f['where']};return db[_0xabc7('0x2f')][_0xabc7('0x24')](_0x1f04b)[_0xabc7('0x29')](function(_0x4ad295){_0x1a526b[_0xabc7('0x24')]=_0x4ad295;if(_0x20e46f[_0xabc7('0x36')][_0xabc7('0x45')]){_0x1c669f[_0xabc7('0x46')]=[{'all':!![]}];}return db[_0xabc7('0x2f')][_0xabc7('0x47')](_0x1c669f);})[_0xabc7('0x29')](function(_0x299825){_0x1a526b[_0xabc7('0x48')]=_0x299825;return _0x1a526b;})[_0xabc7('0x29')](respondWithFilteredResult(_0x47ad1e,_0x1c669f))[_0xabc7('0x49')](handleError(_0x47ad1e,null));};exports['show']=function(_0x4a8e23,_0x377ca2){var _0x4f4d67={'raw':![],'where':{'id':_0x4a8e23[_0xabc7('0x4a')]['id']}},_0x351209={};_0x351209[_0xabc7('0x34')]=_['keys'](db[_0xabc7('0x2f')]['rawAttributes']);_0x351209[_0xabc7('0x36')]=_['keys'](_0x4a8e23[_0xabc7('0x36')]);_0x351209[_0xabc7('0x37')]=_[_0xabc7('0x39')](_0x351209['model'],_0x351209['query']);_0x4f4d67[_0xabc7('0x38')]=_[_0xabc7('0x39')](_0x351209[_0xabc7('0x34')],qs[_0xabc7('0x3a')](_0x4a8e23[_0xabc7('0x36')][_0xabc7('0x3a')]));_0x4f4d67[_0xabc7('0x38')]=_0x4f4d67[_0xabc7('0x38')][_0xabc7('0x3b')]?_0x4f4d67['attributes']:_0x351209[_0xabc7('0x34')];if(_0x4a8e23[_0xabc7('0x36')][_0xabc7('0x45')]){_0x4f4d67[_0xabc7('0x46')]=[{'all':!![]}];}_0x4f4d67=_[_0xabc7('0x41')]({},_0x4f4d67,_0x4a8e23['options']);return db[_0xabc7('0x2f')]['find'](_0x4f4d67)[_0xabc7('0x29')](handleEntityNotFound(_0x377ca2,null))[_0xabc7('0x29')](respondWithResult(_0x377ca2,null))['catch'](handleError(_0x377ca2,null));};exports[_0xabc7('0x4b')]=function(_0x42c3a1,_0x3f6fef){return db[_0xabc7('0x2f')]['create'](_0x42c3a1['body'],{})['then'](function(_0x1f536d){var _0x1f3b2a=_0x42c3a1[_0xabc7('0x4c')][_0xabc7('0x2b')]({'plain':!![]});if(!_0x1f3b2a)throw new Error(_0xabc7('0x4d'));if(_0x1f3b2a['role']===_0xabc7('0x4c')){var _0x1ea85d=_0x1f536d[_0xabc7('0x2b')]({'plain':!![]});var _0x4cbb11='Lists';return db[_0xabc7('0x4e')][_0xabc7('0x4f')]({'where':{'name':_0x4cbb11,'userProfileId':_0x1f3b2a[_0xabc7('0x50')]},'raw':!![]})[_0xabc7('0x29')](function(_0x1dd1e6){if(_0x1dd1e6&&_0x1dd1e6[_0xabc7('0x51')]===0x0){return db[_0xabc7('0x52')]['create']({'name':_0x1ea85d['name'],'resourceId':_0x1ea85d['id'],'type':_0x1dd1e6[_0xabc7('0x43')],'sectionId':_0x1dd1e6['id']},{})[_0xabc7('0x29')](function(){return _0x1f536d;});}else{return _0x1f536d;}})['catch'](function(_0x3ba949){logger[_0xabc7('0x53')](_0xabc7('0x54'),_0x3ba949);throw _0x3ba949;});}return _0x1f536d;})[_0xabc7('0x29')](respondWithResult(_0x3f6fef,0xc9))['catch'](handleError(_0x3f6fef,null));};exports[_0xabc7('0x28')]=function(_0x623c9b,_0x36d24c){if(_0x623c9b['body']['id']){delete _0x623c9b[_0xabc7('0x55')]['id'];}return db[_0xabc7('0x2f')][_0xabc7('0x4f')]({'where':{'id':_0x623c9b[_0xabc7('0x4a')]['id']}})[_0xabc7('0x29')](handleEntityNotFound(_0x36d24c,null))['then'](saveUpdates(_0x623c9b[_0xabc7('0x55')],null))['then'](respondWithResult(_0x36d24c,null))[_0xabc7('0x49')](handleError(_0x36d24c,null));};exports['destroy']=function(_0x1ab920,_0x3a1d8e){return db[_0xabc7('0x2f')]['find']({'where':{'id':_0x1ab920[_0xabc7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a1d8e,null))[_0xabc7('0x29')](removeEntity(_0x3a1d8e,null))[_0xabc7('0x49')](handleError(_0x3a1d8e,null));};exports[_0xabc7('0x56')]=function(_0x5658e6,_0x295ea5){return db[_0xabc7('0x2f')]['describe']()['then'](respondWithResult(_0x295ea5,null))[_0xabc7('0x49')](handleError(_0x295ea5,null));};exports[_0xabc7('0x57')]=function(_0x39d1ce,_0x5f2bb6,_0x9eb346){if(_0x39d1ce[_0xabc7('0x55')]['id']){delete _0x39d1ce[_0xabc7('0x55')]['id'];}return db[_0xabc7('0x2f')]['find']({'where':{'id':_0x39d1ce[_0xabc7('0x4a')]['id']}})[_0xabc7('0x29')](handleEntityNotFound(_0x5f2bb6,null))[_0xabc7('0x29')](function(_0x1f2bb2){if(_0x1f2bb2){_0x39d1ce[_0xabc7('0x55')]['ListId']=_0x1f2bb2['id'];return db[_0xabc7('0x58')]['create'](_0x39d1ce[_0xabc7('0x55')]);}})[_0xabc7('0x29')](respondWithResult(_0x5f2bb6,null))[_0xabc7('0x49')](handleError(_0x5f2bb6,null));};exports[_0xabc7('0x59')]=function(_0xb7c779,_0x5d258a,_0x156687){var _0x203434={'raw':![],'where':{}};var _0x4726f6={};var _0x1e64d0={'count':0x0,'rows':[]};return db['CmList'][_0xabc7('0x5a')]({'where':{'id':_0xb7c779[_0xabc7('0x4a')]['id']}})[_0xabc7('0x29')](handleEntityNotFound(_0x5d258a,null))['then'](function(_0x341a0d){if(_0x341a0d){_0x4726f6[_0xabc7('0x34')]=_[_0xabc7('0x35')](db[_0xabc7('0x58')]['rawAttributes']);_0x4726f6[_0xabc7('0x36')]=_[_0xabc7('0x35')](_0xb7c779[_0xabc7('0x36')]);_0x4726f6[_0xabc7('0x37')]=_[_0xabc7('0x39')](_0x4726f6[_0xabc7('0x34')],_0x4726f6['query']);_0x203434['attributes']=_[_0xabc7('0x39')](_0x4726f6[_0xabc7('0x34')],qs['fields'](_0xb7c779[_0xabc7('0x36')]['fields']));_0x203434['attributes']=_0x203434[_0xabc7('0x38')]['length']?_0x203434[_0xabc7('0x38')]:_0x4726f6[_0xabc7('0x34')];if(!_0xb7c779[_0xabc7('0x36')][_0xabc7('0x5b')](_0xabc7('0x3c'))){_0x203434[_0xabc7('0x23')]=qs[_0xabc7('0x23')](_0xb7c779[_0xabc7('0x36')]['limit']);_0x203434[_0xabc7('0x21')]=qs[_0xabc7('0x21')](_0xb7c779[_0xabc7('0x36')][_0xabc7('0x21')]);}_0x203434['order']=qs['sort'](_0xb7c779[_0xabc7('0x36')]['sort']);_0x203434['where']=qs[_0xabc7('0x37')](_[_0xabc7('0x5c')](_0xb7c779[_0xabc7('0x36')],_0x4726f6[_0xabc7('0x37')]));_0x203434[_0xabc7('0x3f')][_0xabc7('0x5d')]=_0x341a0d['id'];if(_0xb7c779[_0xabc7('0x36')]['filter']){_0x203434['where']=_[_0xabc7('0x41')](_0x203434[_0xabc7('0x3f')],{'$or':_[_0xabc7('0x2e')](_0x203434[_0xabc7('0x38')],function(_0x68c47e){var _0x4eae77={};_0x4eae77[_0x68c47e]={'$like':'%'+_0xb7c779[_0xabc7('0x36')]['filter']+'%'};return _0x4eae77;})});}_0x203434=_[_0xabc7('0x41')]({},_0x203434,_0xb7c779[_0xabc7('0x44')]);return db[_0xabc7('0x58')][_0xabc7('0x24')]({'where':_0x203434[_0xabc7('0x3f')]})[_0xabc7('0x29')](function(_0x2809ce){_0x1e64d0['count']=_0x2809ce;if(_0xb7c779[_0xabc7('0x36')]['includeAll']){_0x203434[_0xabc7('0x46')]=[{'all':!![]}];}return db[_0xabc7('0x58')][_0xabc7('0x47')](_0x203434);})['then'](function(_0x176701){_0x1e64d0[_0xabc7('0x48')]=_0x176701;return _0x1e64d0;});}})[_0xabc7('0x29')](respondWithFilteredResult(_0x5d258a,_0x203434))['catch'](handleError(_0x5d258a,null));};exports['removeDispositions']=function(_0x2b2f1b,_0x676782,_0xa7b2f){return db[_0xabc7('0x2f')][_0xabc7('0x4f')]({'where':{'id':_0x2b2f1b[_0xabc7('0x4a')]['id']}})[_0xabc7('0x29')](handleEntityNotFound(_0x676782,null))[_0xabc7('0x29')](function(_0x5ec05e){if(_0x5ec05e){return _0x5ec05e[_0xabc7('0x5e')](_0x2b2f1b[_0xabc7('0x36')][_0xabc7('0x5f')]);}})[_0xabc7('0x29')](respondWithStatusCode(_0x676782,null))[_0xabc7('0x49')](handleError(_0x676782,null));};exports['addContacts']=function(_0x526836,_0x48d19d,_0x5c87dc){return db[_0xabc7('0x2f')]['find']({'where':{'id':_0x526836[_0xabc7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48d19d,null))[_0xabc7('0x29')](function(_0x11ce20){if(_0x11ce20){var _0x27e7d8=[];var _0x13f5fe={'success':[],'errors':[]};return db[_0xabc7('0x60')][_0xabc7('0x56')]()[_0xabc7('0x29')](function(_0x3584c4){if(_0x526836['body'][_0xabc7('0x61')]&&_['isArray'](_0x526836[_0xabc7('0x55')]['tags'])){if(_0x526836[_0xabc7('0x55')][_0xabc7('0x61')][_0xabc7('0x3b')]){_0x526836[_0xabc7('0x55')][_0xabc7('0x61')]=_0x526836[_0xabc7('0x55')][_0xabc7('0x61')][_0xabc7('0x62')](';')+';';}else{_0x526836[_0xabc7('0x55')]['tags']=null;}}else{_0x526836[_0xabc7('0x55')][_0xabc7('0x61')]=null;}if(_0x526836[_0xabc7('0x55')]&&_[_0xabc7('0x63')](_0x526836[_0xabc7('0x55')])){for(var _0x4293e9=0x0;_0x4293e9<_0x526836[_0xabc7('0x55')][_0xabc7('0x3b')];_0x4293e9+=0x1){_0x526836['body'][_0x4293e9][_0xabc7('0x5d')]=_0x526836[_0xabc7('0x4a')]['id'];_0x27e7d8[_0xabc7('0x64')](_0x526836[_0xabc7('0x55')][_0x4293e9]);}return BPromise[_0xabc7('0x65')](_0x27e7d8,function(_0x5315c9){return db[_0xabc7('0x60')][_0xabc7('0x4b')](_[_0xabc7('0x66')](_0x5315c9,[_0xabc7('0x5f'),'id'])||{},{'fields':_[_0xabc7('0x35')](_0x3584c4),'raw':!![]})[_0xabc7('0x29')](function(_0x4294e9){_0x13f5fe[_0xabc7('0x67')][_0xabc7('0x64')](_0x4294e9['dataValues']);})[_0xabc7('0x49')](function(_0x25dc77){_0x13f5fe[_0xabc7('0x68')]['push']({'data':_0x5315c9,'error':_0x25dc77[_0xabc7('0x69')]});});})['then'](function(_0x26bc46){return _0x13f5fe;})[_0xabc7('0x49')](function(_0x4a78c5){return _0x4a78c5;});}else{_0x48d19d[_0xabc7('0x1e')](0x190)[_0xabc7('0x20')]({'message':_0xabc7('0x6a')});}});}})[_0xabc7('0x29')](respondWithResult(_0x48d19d,null))[_0xabc7('0x49')](handleError(_0x48d19d,null));};exports[_0xabc7('0x6b')]=function(_0x58133f,_0x4c345b,_0x316b83){var _0x4d3da2;return db[_0xabc7('0x2f')][_0xabc7('0x4f')]({'where':{'id':_0x58133f['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xabc7('0x6c')}]})[_0xabc7('0x29')](handleEntityNotFound(_0x4c345b,null))['then'](function(_0x8d585f){if(_0x8d585f){_0x4d3da2=_0x8d585f;return db[_0xabc7('0x60')][_0xabc7('0x30')];}})[_0xabc7('0x29')](function(_0x596857){if(_0x596857){var _0xfef60f={};var _0x25c040={};_0x25c040['model']=_[_0xabc7('0x6d')](_[_0xabc7('0x35')](_0x596857),_[_0xabc7('0x2e')](_0x4d3da2['CustomFields'],function(_0x3f67f1){return util['format'](_0xabc7('0x6e'),_0x3f67f1['id']);}));_0x25c040[_0xabc7('0x36')]=_[_0xabc7('0x35')](_0x58133f[_0xabc7('0x36')]);_0x25c040['filters']=_[_0xabc7('0x39')](_0x25c040[_0xabc7('0x34')],_0x25c040['query']);_0xfef60f[_0xabc7('0x38')]=_[_0xabc7('0x39')](_0x25c040[_0xabc7('0x34')],qs['fields'](_0x58133f['query'][_0xabc7('0x3a')]));_0xfef60f[_0xabc7('0x38')]=_0xfef60f['attributes'][_0xabc7('0x3b')]?_0xfef60f[_0xabc7('0x38')]:_0x25c040[_0xabc7('0x34')];if(!_0x58133f['query']['hasOwnProperty'](_0xabc7('0x3c'))){_0xfef60f['limit']=qs[_0xabc7('0x23')](_0x58133f[_0xabc7('0x36')][_0xabc7('0x23')]);_0xfef60f[_0xabc7('0x21')]=qs[_0xabc7('0x21')](_0x58133f[_0xabc7('0x36')][_0xabc7('0x21')]);}_0xfef60f[_0xabc7('0x3d')]=qs[_0xabc7('0x3e')](_0x58133f[_0xabc7('0x36')]['sort']);_0xfef60f[_0xabc7('0x3f')]=qs[_0xabc7('0x37')](_[_0xabc7('0x5c')](_0x58133f[_0xabc7('0x36')],_0x25c040[_0xabc7('0x37')]));_0xfef60f[_0xabc7('0x6f')]=!![];if(_0x58133f[_0xabc7('0x36')][_0xabc7('0x40')]){_0xfef60f[_0xabc7('0x3f')]=_[_0xabc7('0x41')](_0xfef60f[_0xabc7('0x3f')],{'$or':_[_0xabc7('0x2e')](_0xfef60f[_0xabc7('0x38')],function(_0x30199c){var _0x57f78d={};_0x57f78d[_0x30199c]={'$like':'%'+_0x58133f[_0xabc7('0x36')][_0xabc7('0x40')]+'%'};return _0x57f78d;})});}_0xfef60f=_['merge']({},_0xfef60f,_0x58133f[_0xabc7('0x44')]);return _0x4d3da2[_0xabc7('0x6b')](_0xfef60f);}})[_0xabc7('0x29')](respondWithResult(_0x4c345b,null))['catch'](handleError(_0x4c345b,null));};exports[_0xabc7('0x70')]=function(_0x589ec3,_0x154451,_0x2f5a61){var _0x1754ff;return db[_0xabc7('0x2f')][_0xabc7('0x4f')]({'where':{'id':_0x589ec3[_0xabc7('0x4a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xabc7('0x6c')}]})['then'](handleEntityNotFound(_0x154451,null))[_0xabc7('0x29')](function(_0x4325b6){if(_0x4325b6){_0x1754ff=_0x4325b6;return db[_0xabc7('0x60')][_0xabc7('0x30')];}})[_0xabc7('0x29')](function(_0x35fcab){if(_0x35fcab){var _0x27175d={};var _0xcbf14f={};_0xcbf14f[_0xabc7('0x34')]=_[_0xabc7('0x6d')](_[_0xabc7('0x35')](_0x35fcab),_[_0xabc7('0x2e')](_0x1754ff[_0xabc7('0x6c')],function(_0x17e96a){return util[_0xabc7('0x71')](_0xabc7('0x6e'),_0x17e96a['id']);}));_0xcbf14f['query']=_[_0xabc7('0x35')](_0x589ec3['query']);_0xcbf14f[_0xabc7('0x37')]=_[_0xabc7('0x39')](_0xcbf14f['model'],_0xcbf14f[_0xabc7('0x36')]);_0x27175d[_0xabc7('0x38')]=_['intersection'](_0xcbf14f[_0xabc7('0x34')],qs[_0xabc7('0x3a')](_0x589ec3[_0xabc7('0x36')]['fields']));_0x27175d[_0xabc7('0x38')]=_0x27175d[_0xabc7('0x38')][_0xabc7('0x3b')]?_0x27175d['attributes']:_0xcbf14f[_0xabc7('0x34')];if(!_0x589ec3[_0xabc7('0x36')][_0xabc7('0x5b')]('nolimit')){_0x27175d[_0xabc7('0x23')]=qs[_0xabc7('0x23')](_0x589ec3[_0xabc7('0x36')][_0xabc7('0x23')]);_0x27175d[_0xabc7('0x21')]=qs[_0xabc7('0x21')](_0x589ec3[_0xabc7('0x36')][_0xabc7('0x21')]);}_0x27175d[_0xabc7('0x3d')]=qs[_0xabc7('0x3e')](_0x589ec3[_0xabc7('0x36')][_0xabc7('0x3e')]);_0x27175d[_0xabc7('0x3f')]=qs[_0xabc7('0x37')](_[_0xabc7('0x5c')](_0x589ec3[_0xabc7('0x36')],_0xcbf14f[_0xabc7('0x37')]));_0x27175d['raw']=!![];if(_0x589ec3[_0xabc7('0x36')][_0xabc7('0x40')]){_0x27175d[_0xabc7('0x3f')]=_['merge'](_0x27175d['where'],{'$or':_[_0xabc7('0x2e')](_0x27175d[_0xabc7('0x38')],function(_0x2631db){var _0x5a4e4a={};_0x5a4e4a[_0x2631db]={'$like':'%'+_0x589ec3[_0xabc7('0x36')][_0xabc7('0x40')]+'%'};return _0x5a4e4a;})});}_0x27175d=_[_0xabc7('0x41')]({},_0x27175d,_0x589ec3[_0xabc7('0x44')]);return _0x1754ff[_0xabc7('0x6b')](_0x27175d);}})[_0xabc7('0x29')](function(_0x1a5a93){if(!_[_0xabc7('0x72')](_0x1a5a93)){var _0x2c28d0=toCsv(_0x1a5a93);var _0x3de409=Date[_0xabc7('0x73')]();fs[_0xabc7('0x74')](util[_0xabc7('0x71')](_0xabc7('0x75'),_0x1754ff['id'],_0x3de409),_0x2c28d0);_0x154451['setHeader']('Content-disposition',_0xabc7('0x76')+util[_0xabc7('0x71')](_0xabc7('0x77'),_0x1754ff['id'],_0x3de409));_0x154451[_0xabc7('0x78')](_0xabc7('0x79'),_0xabc7('0x7a'));return _0x154451[_0xabc7('0x7b')](util[_0xabc7('0x71')](_0xabc7('0x75'),_0x1754ff['id'],_0x3de409));}else{return _0x154451[_0xabc7('0x1d')](0xcc);}})[_0xabc7('0x49')](handleError(_0x154451,null));};exports[_0xabc7('0x7c')]=function(_0x36d7db,_0x559b7,_0x1759d0){var _0x55937d;delete _0x36d7db[_0xabc7('0x55')]['id'];return db[_0xabc7('0x2f')][_0xabc7('0x5a')]({'where':{'id':_0x36d7db[_0xabc7('0x4a')]['id']}})[_0xabc7('0x29')](handleEntityNotFound(_0x559b7,null))[_0xabc7('0x29')](function(_0x90b9b6){if(_0x90b9b6){return db[_0xabc7('0x7d')][_0xabc7('0x7e')](function(_0x1cd64e){return db[_0xabc7('0x7f')][_0xabc7('0x4b')](_0x36d7db['body'],{'transaction':_0x1cd64e})[_0xabc7('0x29')](function(_0x4a0bf6){_0x55937d=_0x4a0bf6;return _0x90b9b6[_0xabc7('0x80')](_0x4a0bf6,{'transaction':_0x1cd64e});})[_0xabc7('0x29')](function(){var _0x4a5754={'type':db[_0xabc7('0x81')][_0xabc7('0x82')],'transaction':_0x1cd64e};switch(_0x36d7db[_0xabc7('0x55')][_0xabc7('0x32')]){case _0xabc7('0x83'):_0x4a5754[_0xabc7('0x32')]=db[_0xabc7('0x81')][_0xabc7('0x82')];break;case _0xabc7('0x84'):_0x4a5754['type']=db[_0xabc7('0x81')][_0xabc7('0x85')];break;case _0xabc7('0x86'):_0x4a5754[_0xabc7('0x32')]=db[_0xabc7('0x81')][_0xabc7('0x87')];_0x4a5754[_0xabc7('0x88')]=![];break;default:}return db[_0xabc7('0x7d')][_0xabc7('0x89')][_0xabc7('0x8a')](_0xabc7('0x8b'),util[_0xabc7('0x71')](_0xabc7('0x8c'),_0x55937d['id']),_0x4a5754);})[_0xabc7('0x29')](function(){return _0x55937d;});});}})[_0xabc7('0x29')](respondWithResult(_0x559b7,null))['catch'](handleError(_0x559b7,null));};exports[_0xabc7('0x8d')]=function(_0x23b238,_0x3a0719,_0x2e7aa1){var _0x56b83f={};var _0x54a3db={};var _0x56cf1d;var _0x451390;return db['CmList'][_0xabc7('0x5a')]({'where':{'id':_0x23b238[_0xabc7('0x4a')]['id']}})[_0xabc7('0x29')](handleEntityNotFound(_0x3a0719,null))[_0xabc7('0x29')](function(_0x1fe0a1){if(_0x1fe0a1){_0x56cf1d=_0x1fe0a1;_0x54a3db[_0xabc7('0x34')]=_[_0xabc7('0x35')](db[_0xabc7('0x7f')][_0xabc7('0x30')]);_0x54a3db[_0xabc7('0x36')]=_['keys'](_0x23b238['query']);_0x54a3db[_0xabc7('0x37')]=_[_0xabc7('0x39')](_0x54a3db[_0xabc7('0x34')],_0x54a3db[_0xabc7('0x36')]);_0x56b83f[_0xabc7('0x38')]=_[_0xabc7('0x39')](_0x54a3db[_0xabc7('0x34')],qs[_0xabc7('0x3a')](_0x23b238[_0xabc7('0x36')][_0xabc7('0x3a')]));_0x56b83f[_0xabc7('0x38')]=_0x56b83f[_0xabc7('0x38')][_0xabc7('0x3b')]?_0x56b83f[_0xabc7('0x38')]:_0x54a3db[_0xabc7('0x34')];_0x56b83f[_0xabc7('0x3d')]=qs[_0xabc7('0x3e')](_0x23b238['query'][_0xabc7('0x3e')]);_0x56b83f[_0xabc7('0x3f')]=qs[_0xabc7('0x37')](_[_0xabc7('0x5c')](_0x23b238[_0xabc7('0x36')],_0x54a3db[_0xabc7('0x37')]));_0x56b83f['where']=_[_0xabc7('0x41')](_0x56b83f[_0xabc7('0x3f')],{'$or':[{'ListId':_0x1fe0a1['id']},{'ListId':null}]});if(_0x23b238['query'][_0xabc7('0x40')]){_0x56b83f[_0xabc7('0x3f')]=_[_0xabc7('0x41')](_0x56b83f[_0xabc7('0x3f')],{'$or':_['map'](_0x56b83f[_0xabc7('0x38')],function(_0x19da1d){var _0x155f42={};_0x155f42[_0x19da1d]={'$like':'%'+_0x23b238[_0xabc7('0x36')][_0xabc7('0x40')]+'%'};return _0x155f42;})});}_0x56b83f=_[_0xabc7('0x41')]({},_0x56b83f,_0x23b238[_0xabc7('0x44')]);return db[_0xabc7('0x7f')][_0xabc7('0x8e')](_0x56b83f);}})[_0xabc7('0x29')](respondWithResult(_0x3a0719,null))[_0xabc7('0x49')](handleError(_0x3a0719,null));};exports[_0xabc7('0x8f')]=function(_0x218c5b,_0xc3c7db,_0x51bb57){return db[_0xabc7('0x2f')]['find']({'where':{'id':_0x218c5b['params']['id']}})['then'](handleEntityNotFound(_0xc3c7db,null))[_0xabc7('0x29')](function(_0x3d562d){if(_0x3d562d){return _0x3d562d[_0xabc7('0x8f')](_0x218c5b['body'][_0xabc7('0x5f')],_[_0xabc7('0x66')](_0x218c5b[_0xabc7('0x55')],[_0xabc7('0x5f'),'id'])||{})['spread'](function(_0x467bbe){for(var _0x59450b=0x0;_0x59450b<_0x218c5b[_0xabc7('0x55')][_0xabc7('0x5f')][_0xabc7('0x3b')];_0x59450b+=0x1){socket[_0xabc7('0x90')](_0xabc7('0x91'),{'UserId':Number(_0x218c5b['body'][_0xabc7('0x5f')][_0x59450b]),'CmListId':Number(_0x218c5b[_0xabc7('0x4a')]['id'])});}return _0x467bbe;});}})[_0xabc7('0x29')](respondWithResult(_0xc3c7db,null))[_0xabc7('0x49')](handleError(_0xc3c7db,null));};exports[_0xabc7('0x92')]=function(_0x27d226,_0x4c4cc1,_0x3cf508){return db[_0xabc7('0x2f')][_0xabc7('0x4f')]({'where':{'id':_0x27d226[_0xabc7('0x4a')]['id']}})[_0xabc7('0x29')](handleEntityNotFound(_0x4c4cc1,null))[_0xabc7('0x29')](function(_0xb2aa0f){if(_0xb2aa0f){return _0xb2aa0f['removeAgents'](_0x27d226[_0xabc7('0x36')][_0xabc7('0x5f')])[_0xabc7('0x29')](function(){if(_[_0xabc7('0x63')](_0x27d226[_0xabc7('0x36')][_0xabc7('0x5f')])){for(var _0xad670b=0x0;_0xad670b<_0x27d226[_0xabc7('0x36')]['ids'][_0xabc7('0x3b')];_0xad670b+=0x1){socket['emit'](_0xabc7('0x93'),{'UserId':Number(_0x27d226[_0xabc7('0x36')][_0xabc7('0x5f')][_0xad670b]),'CmListId':Number(_0x27d226[_0xabc7('0x4a')]['id'])});}}else{socket[_0xabc7('0x90')](_0xabc7('0x93'),{'UserId':Number(_0x27d226[_0xabc7('0x36')][_0xabc7('0x5f')]),'CmListId':Number(_0x27d226['params']['id'])});}});}})[_0xabc7('0x29')](respondWithStatusCode(_0x4c4cc1,null))[_0xabc7('0x49')](handleError(_0x4c4cc1,null));};exports['getAgents']=function(_0x23d201,_0x4d4058,_0x26e0d4){var _0x2fcb2c={};var _0x5200bd={};var _0x1683b4;var _0x1e559b;return db[_0xabc7('0x2f')][_0xabc7('0x5a')]({'where':{'id':_0x23d201[_0xabc7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4d4058,null))['then'](function(_0x4a6af7){if(_0x4a6af7){_0x1683b4=_0x4a6af7;_0x5200bd[_0xabc7('0x34')]=_[_0xabc7('0x35')](db[_0xabc7('0x94')]['rawAttributes']);_0x5200bd[_0xabc7('0x36')]=_['keys'](_0x23d201[_0xabc7('0x36')]);_0x5200bd['filters']=_[_0xabc7('0x39')](_0x5200bd['model'],_0x5200bd[_0xabc7('0x36')]);_0x2fcb2c['attributes']=_[_0xabc7('0x39')](_0x5200bd[_0xabc7('0x34')],qs[_0xabc7('0x3a')](_0x23d201[_0xabc7('0x36')][_0xabc7('0x3a')]));_0x2fcb2c[_0xabc7('0x38')]=_0x2fcb2c[_0xabc7('0x38')][_0xabc7('0x3b')]?_0x2fcb2c[_0xabc7('0x38')]:_0x5200bd['model'];_0x2fcb2c['order']=qs[_0xabc7('0x3e')](_0x23d201[_0xabc7('0x36')][_0xabc7('0x3e')]);_0x2fcb2c['where']=qs[_0xabc7('0x37')](_[_0xabc7('0x5c')](_0x23d201[_0xabc7('0x36')],_0x5200bd[_0xabc7('0x37')]));if(_0x23d201[_0xabc7('0x36')][_0xabc7('0x40')]){_0x2fcb2c[_0xabc7('0x3f')]=_[_0xabc7('0x41')](_0x2fcb2c[_0xabc7('0x3f')],{'$or':_[_0xabc7('0x2e')](_0x2fcb2c[_0xabc7('0x38')],function(_0x276c21){var _0x2155e2={};_0x2155e2[_0x276c21]={'$like':'%'+_0x23d201['query'][_0xabc7('0x40')]+'%'};return _0x2155e2;})});}_0x2fcb2c=_[_0xabc7('0x41')]({},_0x2fcb2c,_0x23d201[_0xabc7('0x44')]);return _0x1683b4['getAgents'](_0x2fcb2c);}})[_0xabc7('0x29')](function(_0x456760){if(_0x456760){_0x1e559b=_0x456760[_0xabc7('0x3b')];if(!_0x23d201['query'][_0xabc7('0x5b')](_0xabc7('0x3c'))){_0x2fcb2c['limit']=qs['limit'](_0x23d201[_0xabc7('0x36')]['limit']);_0x2fcb2c[_0xabc7('0x21')]=qs[_0xabc7('0x21')](_0x23d201['query']['offset']);}return _0x1683b4[_0xabc7('0x95')](_0x2fcb2c);}})[_0xabc7('0x29')](function(_0x5d2415){if(_0x5d2415){return _0x5d2415?{'count':_0x1e559b,'rows':_0x5d2415}:null;}})['then'](respondWithResult(_0x4d4058,null))['catch'](handleError(_0x4d4058,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 226eca2..9490bbe 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x4dcf4d,_0x267157){var _0xf8fde7=function(_0x5dfd7d){while(--_0x5dfd7d){_0x4dcf4d['push'](_0x4dcf4d['shift']());}};_0xf8fde7(++_0x267157);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x55ca,0x126));var _0xa55c=function(_0x484cb9,_0x103489){_0x484cb9=_0x484cb9-0x0;var _0x59517e=_0x55ca[_0x484cb9];return _0x59517e;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 212cece..3eddae0 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 _0x9c44=['request-promise','path','./cmList.attributes','define','CmList','cm_lists','../../config/logger','api','moment','bluebird'];(function(_0x53b2d7,_0x953a4c){var _0x2febcd=function(_0x588566){while(--_0x588566){_0x53b2d7['push'](_0x53b2d7['shift']());}};_0x2febcd(++_0x953a4c);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'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 +var _0xf4eb=['./cmList.attributes','exports','define','cm_lists','lodash','bluebird','rimraf','../../config/environment'];(function(_0x25e95a,_0x2efe4a){var _0x2b35e8=function(_0x1cd36a){while(--_0x1cd36a){_0x25e95a['push'](_0x25e95a['shift']());}};_0x2b35e8(++_0x2efe4a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x589d03,_0x3dd6f7){_0x589d03=_0x589d03-0x0;var _0x1f1cba=_0xf4eb[_0x589d03];return _0x1f1cba;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('CmList',attributes,{'tableName':_0xbf4e('0x7'),'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 6bc6a5d..d0f4f44 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 _0xad23=['http','redis','defaults','localhost','socket.io-emitter','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a0fac,_0x33da21){var _0xda0f69=function(_0x165e70){while(--_0x165e70){_0x5a0fac['push'](_0x5a0fac['shift']());}};_0xda0f69(++_0x33da21);}(_0xad23,0xbf));var _0x3ad2=function(_0x391019,_0x4e9ee6){_0x391019=_0x391019-0x0;var _0x72f1da=_0xad23[_0x391019];return _0x72f1da;};'use strict';var _=require(_0x3ad2('0x0'));var util=require('util');var moment=require(_0x3ad2('0x1'));var BPromise=require(_0x3ad2('0x2'));var rs=require(_0x3ad2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3ad2('0x4'));var logger=require(_0x3ad2('0x5'))(_0x3ad2('0x6'));var config=require(_0x3ad2('0x7'));var jayson=require(_0x3ad2('0x8'));var client=jayson['client'][_0x3ad2('0x9')]({'port':0x232a});config[_0x3ad2('0xa')]=_[_0x3ad2('0xb')](config['redis'],{'host':_0x3ad2('0xc'),'port':0x18eb});var socket=require(_0x3ad2('0xd'))(new Redis(config[_0x3ad2('0xa')]));require('./cmList.socket')[_0x3ad2('0xe')](socket);function respondWithRpcPromise(_0xa0ae6a,_0x27c4ee,_0x2f73dc){return new BPromise(function(_0x2fc94b,_0x52cd9f){return client['request'](_0xa0ae6a,_0x2f73dc)['then'](function(_0x3097dd){logger[_0x3ad2('0xf')](_0x3ad2('0x10'),_0x27c4ee,_0x3ad2('0x11'));logger[_0x3ad2('0x12')](_0x3ad2('0x13'),_0x27c4ee,'request\x20sent',JSON['stringify'](_0x3097dd));if(_0x3097dd[_0x3ad2('0x14')]){if(_0x3097dd[_0x3ad2('0x14')][_0x3ad2('0x15')]===0x1f4){logger[_0x3ad2('0x14')]('CmList,\x20%s,\x20%s',_0x27c4ee,_0x3097dd[_0x3ad2('0x14')]['message']);return _0x52cd9f(_0x3097dd[_0x3ad2('0x14')][_0x3ad2('0x16')]);}logger[_0x3ad2('0x14')](_0x3ad2('0x10'),_0x27c4ee,_0x3097dd[_0x3ad2('0x14')][_0x3ad2('0x16')]);return _0x2fc94b(_0x3097dd['error'][_0x3ad2('0x16')]);}else{logger[_0x3ad2('0xf')](_0x3ad2('0x10'),_0x27c4ee,_0x3ad2('0x11'));_0x2fc94b(_0x3097dd[_0x3ad2('0x17')][_0x3ad2('0x16')]);}})[_0x3ad2('0x18')](function(_0x44073f){logger[_0x3ad2('0x14')](_0x3ad2('0x10'),_0x27c4ee,_0x44073f);_0x52cd9f(_0x44073f);});});} \ No newline at end of file +var _0x9819=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1a8d2a,_0xdbe9b8){var _0x1cf709=function(_0x21e1a2){while(--_0x21e1a2){_0x1a8d2a['push'](_0x1a8d2a['shift']());}};_0x1cf709(++_0xdbe9b8);}(_0x9819,0x14a));var _0x9981=function(_0x23811e,_0xb073c2){_0x23811e=_0x23811e-0x0;var _0x1c20cc=_0x9819[_0x23811e];return _0x1c20cc;};'use strict';var _=require(_0x9981('0x0'));var util=require(_0x9981('0x1'));var moment=require(_0x9981('0x2'));var BPromise=require(_0x9981('0x3'));var rs=require(_0x9981('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9981('0x5'));var logger=require('../../config/logger')(_0x9981('0x6'));var config=require(_0x9981('0x7'));var jayson=require(_0x9981('0x8'));var client=jayson[_0x9981('0x9')][_0x9981('0xa')]({'port':0x232a});config[_0x9981('0xb')]=_[_0x9981('0xc')](config[_0x9981('0xb')],{'host':_0x9981('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9981('0xe'))['register'](socket);function respondWithRpcPromise(_0x1320bc,_0x139f94,_0x44508c){return new BPromise(function(_0x5a1a9e,_0xaf329b){return client[_0x9981('0xf')](_0x1320bc,_0x44508c)[_0x9981('0x10')](function(_0x415577){logger[_0x9981('0x11')](_0x9981('0x12'),_0x139f94,_0x9981('0x13'));logger[_0x9981('0x14')](_0x9981('0x15'),_0x139f94,'request\x20sent',JSON[_0x9981('0x16')](_0x415577));if(_0x415577['error']){if(_0x415577[_0x9981('0x17')][_0x9981('0x18')]===0x1f4){logger[_0x9981('0x17')](_0x9981('0x12'),_0x139f94,_0x415577[_0x9981('0x17')]['message']);return _0xaf329b(_0x415577[_0x9981('0x17')][_0x9981('0x19')]);}logger[_0x9981('0x17')]('CmList,\x20%s,\x20%s',_0x139f94,_0x415577[_0x9981('0x17')]['message']);return _0x5a1a9e(_0x415577[_0x9981('0x17')][_0x9981('0x19')]);}else{logger['info'](_0x9981('0x12'),_0x139f94,_0x9981('0x13'));_0x5a1a9e(_0x415577['result'][_0x9981('0x19')]);}})[_0x9981('0x1a')](function(_0x54d9c2){logger[_0x9981('0x17')]('CmList,\x20%s,\x20%s',_0x139f94,_0x54d9c2);_0xaf329b(_0x54d9c2);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f8b0492..223c7eb 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 _0x67dd=['removeListener','register','length','cmList:','./cmList.events','update','emit'];(function(_0x541f52,_0x2551b2){var _0x57d9e4=function(_0x7d1f30){while(--_0x7d1f30){_0x541f52['push'](_0x541f52['shift']());}};_0x57d9e4(++_0x2551b2);}(_0x67dd,0x193));var _0xd67d=function(_0x5543b1,_0x4c6f32){_0x5543b1=_0x5543b1-0x0;var _0x19fb46=_0x67dd[_0x5543b1];return _0x19fb46;};'use strict';var CmListEvents=require(_0xd67d('0x0'));var events=['save','remove',_0xd67d('0x1')];function createListener(_0x1b73d9,_0x4c5c55){return function(_0x387c3f){_0x4c5c55[_0xd67d('0x2')](_0x1b73d9,_0x387c3f);};}function removeListener(_0x89a83f,_0x2c645d){return function(){CmListEvents[_0xd67d('0x3')](_0x89a83f,_0x2c645d);};}exports[_0xd67d('0x4')]=function(_0x181ca8){for(var _0x6856eb=0x0,_0x51a82a=events[_0xd67d('0x5')];_0x6856eb<_0x51a82a;_0x6856eb++){var _0xd40251=events[_0x6856eb];var _0x1b625f=createListener(_0xd67d('0x6')+_0xd40251,_0x181ca8);CmListEvents['on'](_0xd40251,_0x1b625f);}}; \ No newline at end of file +var _0x3ab0=['cmList:','save','remove','emit','register','length'];(function(_0xb3b32d,_0xa4fcf6){var _0x27d6bd=function(_0x1eca11){while(--_0x1eca11){_0xb3b32d['push'](_0xb3b32d['shift']());}};_0x27d6bd(++_0xa4fcf6);}(_0x3ab0,0x1ed));var _0x03ab=function(_0x2a8973,_0x1640bb){_0x2a8973=_0x2a8973-0x0;var _0x5d9c47=_0x3ab0[_0x2a8973];return _0x5d9c47;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x03ab('0x0'),_0x03ab('0x1'),'update'];function createListener(_0x330277,_0x31310b){return function(_0x1f75cb){_0x31310b[_0x03ab('0x2')](_0x330277,_0x1f75cb);};}function removeListener(_0x1582aa,_0x2d7580){return function(){CmListEvents['removeListener'](_0x1582aa,_0x2d7580);};}exports[_0x03ab('0x3')]=function(_0x3a0d79){for(var _0x41fc09=0x0,_0x1db1ee=events[_0x03ab('0x4')];_0x41fc09<_0x1db1ee;_0x41fc09++){var _0x4a25dd=events[_0x41fc09];var _0x275aae=createListener(_0x03ab('0x5')+_0x4a25dd,_0x3a0d79);CmListEvents['on'](_0x4a25dd,_0x275aae);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 39c02a7..e08c0c4 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 _0xef44=['fs-extra','../../components/interaction/service','./cmList.controller','get','isAuthenticated','describe','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','addDisposition','post','addContacts','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','path','connect-timeout','Router'];(function(_0x26f9b8,_0xf432ed){var _0xf8331=function(_0x3046c4){while(--_0x3046c4){_0x26f9b8['push'](_0x26f9b8['shift']());}};_0xf8331(++_0xf432ed);}(_0xef44,0xe5));var _0x4ef4=function(_0x48c109,_0x80a4a1){_0x48c109=_0x48c109-0x0;var _0x300448=_0xef44[_0x48c109];return _0x300448;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ef4('0x0'));var timeout=require(_0x4ef4('0x1'));var express=require('express');var router=express[_0x4ef4('0x2')]();var fs_extra=require(_0x4ef4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4ef4('0x4'));var config=require('../../config/environment');var controller=require(_0x4ef4('0x5'));router[_0x4ef4('0x6')]('/',auth[_0x4ef4('0x7')](),controller['index']);router[_0x4ef4('0x6')]('/describe',auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x8')]);router[_0x4ef4('0x6')]('/:id',auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x9')]);router[_0x4ef4('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4ef4('0xa')]);router[_0x4ef4('0x6')](_0x4ef4('0xb'),auth['isAuthenticated'](),controller[_0x4ef4('0xc')]);router[_0x4ef4('0x6')](_0x4ef4('0xd'),auth['isAuthenticated'](),controller[_0x4ef4('0xe')]);router[_0x4ef4('0x6')](_0x4ef4('0xf'),auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x10')]);router[_0x4ef4('0x6')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x4ef4('0x7')](),controller['create']);router['post']('/:id/dispositions',auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x11')]);router[_0x4ef4('0x12')](_0x4ef4('0xb'),auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x13')]);router[_0x4ef4('0x12')]('/:id/fields',auth[_0x4ef4('0x7')](),controller['addCustomField']);router[_0x4ef4('0x12')](_0x4ef4('0x14'),auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x15')]);router[_0x4ef4('0x16')](_0x4ef4('0x17'),auth['isAuthenticated'](),controller[_0x4ef4('0x18')]);router[_0x4ef4('0x19')](_0x4ef4('0x17'),auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x1a')]);router[_0x4ef4('0x19')]('/:id/dispositions',auth[_0x4ef4('0x7')](),controller['removeDispositions']);router[_0x4ef4('0x19')](_0x4ef4('0x14'),auth[_0x4ef4('0x7')](),controller[_0x4ef4('0x1b')]);module[_0x4ef4('0x1c')]=router; \ No newline at end of file +var _0x75b8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router'];(function(_0x290f1e,_0x2ac65c){var _0x1e5893=function(_0x3079d4){while(--_0x3079d4){_0x290f1e['push'](_0x290f1e['shift']());}};_0x1e5893(++_0x2ac65c);}(_0x75b8,0x166));var _0x875b=function(_0xfd183f,_0x21bbde){_0xfd183f=_0xfd183f-0x0;var _0x40b42e=_0x75b8[_0xfd183f];return _0x40b42e;};'use strict';var multer=require(_0x875b('0x0'));var util=require(_0x875b('0x1'));var path=require(_0x875b('0x2'));var timeout=require('connect-timeout');var express=require(_0x875b('0x3'));var router=express[_0x875b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x875b('0x5'));var interaction=require(_0x875b('0x6'));var config=require(_0x875b('0x7'));var controller=require(_0x875b('0x8'));router[_0x875b('0x9')]('/',auth[_0x875b('0xa')](),controller[_0x875b('0xb')]);router['get'](_0x875b('0xc'),auth[_0x875b('0xa')](),controller[_0x875b('0xd')]);router[_0x875b('0x9')]('/:id',auth[_0x875b('0xa')](),controller[_0x875b('0xe')]);router[_0x875b('0x9')](_0x875b('0xf'),auth[_0x875b('0xa')](),controller['getDispositions']);router[_0x875b('0x9')](_0x875b('0x10'),auth[_0x875b('0xa')](),controller[_0x875b('0x11')]);router[_0x875b('0x9')]('/:id/contacts/csv',auth[_0x875b('0xa')](),controller[_0x875b('0x12')]);router[_0x875b('0x9')](_0x875b('0x13'),auth[_0x875b('0xa')](),controller[_0x875b('0x14')]);router[_0x875b('0x9')](_0x875b('0x15'),auth[_0x875b('0xa')](),controller[_0x875b('0x16')]);router[_0x875b('0x17')]('/',auth[_0x875b('0xa')](),controller['create']);router[_0x875b('0x17')](_0x875b('0xf'),auth[_0x875b('0xa')](),controller[_0x875b('0x18')]);router[_0x875b('0x17')](_0x875b('0x10'),auth[_0x875b('0xa')](),controller[_0x875b('0x19')]);router[_0x875b('0x17')](_0x875b('0x13'),auth[_0x875b('0xa')](),controller['addCustomField']);router[_0x875b('0x17')]('/:id/users',auth[_0x875b('0xa')](),controller['addAgents']);router['put'](_0x875b('0x1a'),auth[_0x875b('0xa')](),controller[_0x875b('0x1b')]);router[_0x875b('0x1c')](_0x875b('0x1a'),auth[_0x875b('0xa')](),controller[_0x875b('0x1d')]);router[_0x875b('0x1c')](_0x875b('0xf'),auth[_0x875b('0xa')](),controller[_0x875b('0x1e')]);router['delete'](_0x875b('0x15'),auth[_0x875b('0xa')](),controller[_0x875b('0x1f')]);module[_0x875b('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6c9264d..2921d9e 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 _0x29e0=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x4109e1,_0x57aa37){var _0x2f33c6=function(_0xc98a59){while(--_0xc98a59){_0x4109e1['push'](_0x4109e1['shift']());}};_0x2f33c6(++_0x57aa37);}(_0x29e0,0xe2));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x029e('0x0'));module[_0x029e('0x1')]={'name':{'type':Sequelize[_0x029e('0x2')],'get':function(_0x538035){return this[_0x029e('0x3')](_0x029e('0x4'));}},'field':{'type':Sequelize[_0x029e('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x029e('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x029e('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x73bf=['sequelize','VIRTUAL','getDataValue','STRING'];(function(_0x3c9e27,_0x4c4119){var _0x1d5b88=function(_0x24f97f){while(--_0x24f97f){_0x3c9e27['push'](_0x3c9e27['shift']());}};_0x1d5b88(++_0x4c4119);}(_0x73bf,0x1f4));var _0xf73b=function(_0x31d5fd,_0x18b167){_0x31d5fd=_0x31d5fd-0x0;var _0x413b1c=_0x73bf[_0x31d5fd];return _0x413b1c;};'use strict';var Sequelize=require(_0xf73b('0x0'));module['exports']={'name':{'type':Sequelize[_0xf73b('0x1')],'get':function(_0x1b6673){return this[_0xf73b('0x2')]('field');}},'field':{'type':Sequelize[_0xf73b('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xf73b('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 9656293..c395ff6 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3630c6,_0x23cefb){var _0x5434dc=function(_0x25794e){while(--_0x25794e){_0x3630c6['push'](_0x3630c6['shift']());}};_0x5434dc(++_0x23cefb);}(_0x7a54,0x106));var _0x47a5=function(_0x1d6d8b,_0x13ffd0){_0x1d6d8b=_0x1d6d8b-0x0;var _0x375828=_0x7a54[_0x1d6d8b];return _0x375828;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x54afc2,_0x4a941c){var _0x26751c=function(_0x40c414){while(--_0x40c414){_0x54afc2['push'](_0x54afc2['shift']());}};_0x26751c(++_0x4a941c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index fd669f7..b11ccda 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 _0x8f49=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','lodash'];(function(_0x12e880,_0x6f495b){var _0x42e8b1=function(_0x10b631){while(--_0x10b631){_0x12e880['push'](_0x12e880['shift']());}};_0x42e8b1(++_0x6f495b);}(_0x8f49,0xc2));var _0x98f4=function(_0xbd3fa6,_0x3f685f){_0xbd3fa6=_0xbd3fa6-0x0;var _0x3dc08e=_0x8f49[_0xbd3fa6];return _0x3dc08e;};'use strict';var _=require(_0x98f4('0x0'));var util=require(_0x98f4('0x1'));var logger=require(_0x98f4('0x2'))(_0x98f4('0x3'));var moment=require(_0x98f4('0x4'));var BPromise=require(_0x98f4('0x5'));var rp=require(_0x98f4('0x6'));var fs=require('fs');var path=require(_0x98f4('0x7'));var rimraf=require('rimraf');var config=require(_0x98f4('0x8'));var attributes=require(_0x98f4('0x9'));module[_0x98f4('0xa')]=function(_0x1a63fd,_0x28e81d){return _0x1a63fd[_0x98f4('0xb')](_0x98f4('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92ad=['Condition','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x7400ac,_0xac85b2){var _0x5c63c7=function(_0x463401){while(--_0x463401){_0x7400ac['push'](_0x7400ac['shift']());}};_0x5c63c7(++_0xac85b2);}(_0x92ad,0x90));var _0xd92a=function(_0x39805a,_0x238d9b){_0x39805a=_0x39805a-0x0;var _0x92ad86=_0x92ad[_0x39805a];return _0x92ad86;};'use strict';var _=require('lodash');var util=require(_0xd92a('0x0'));var logger=require('../../config/logger')(_0xd92a('0x1'));var moment=require(_0xd92a('0x2'));var BPromise=require(_0xd92a('0x3'));var rp=require(_0xd92a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd92a('0x5'));var config=require(_0xd92a('0x6'));var attributes=require(_0xd92a('0x7'));module[_0xd92a('0x8')]=function(_0xddc230,_0x5ad817){return _0xddc230[_0xd92a('0x9')](_0xd92a('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 50de73f..477574f 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 _0x7e9b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','util','moment','bluebird','randomstring'];(function(_0x3f3d0e,_0x8a0892){var _0x3b84ad=function(_0x3fae1c){while(--_0x3fae1c){_0x3f3d0e['push'](_0x3f3d0e['shift']());}};_0x3b84ad(++_0x8a0892);}(_0x7e9b,0xd8));var _0xb7e9=function(_0x196994,_0x20cd73){_0x196994=_0x196994-0x0;var _0x49f943=_0x7e9b[_0x196994];return _0x49f943;};'use strict';var _=require('lodash');var util=require(_0xb7e9('0x0'));var moment=require(_0xb7e9('0x1'));var BPromise=require(_0xb7e9('0x2'));var rs=require(_0xb7e9('0x3'));var fs=require('fs');var Redis=require(_0xb7e9('0x4'));var db=require(_0xb7e9('0x5'))['db'];var utils=require(_0xb7e9('0x6'));var logger=require(_0xb7e9('0x7'))('rpc');var config=require(_0xb7e9('0x8'));var jayson=require(_0xb7e9('0x9'));var client=jayson[_0xb7e9('0xa')][_0xb7e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb8c7e9,_0x372cf5,_0x38e7be){return new BPromise(function(_0x3e9ae9,_0x36ba06){return client['request'](_0xb8c7e9,_0x38e7be)[_0xb7e9('0xc')](function(_0x380320){logger['info'](_0xb7e9('0xd'),_0x372cf5,_0xb7e9('0xe'));logger[_0xb7e9('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x372cf5,_0xb7e9('0xe'),JSON['stringify'](_0x380320));if(_0x380320[_0xb7e9('0x10')]){if(_0x380320[_0xb7e9('0x10')]['code']===0x1f4){logger[_0xb7e9('0x10')](_0xb7e9('0xd'),_0x372cf5,_0x380320['error'][_0xb7e9('0x11')]);return _0x36ba06(_0x380320['error'][_0xb7e9('0x11')]);}logger[_0xb7e9('0x10')](_0xb7e9('0xd'),_0x372cf5,_0x380320[_0xb7e9('0x10')][_0xb7e9('0x11')]);return _0x3e9ae9(_0x380320[_0xb7e9('0x10')][_0xb7e9('0x11')]);}else{logger[_0xb7e9('0x12')](_0xb7e9('0xd'),_0x372cf5,_0xb7e9('0xe'));_0x3e9ae9(_0x380320[_0xb7e9('0x13')][_0xb7e9('0x11')]);}})['catch'](function(_0x5a18b4){logger[_0xb7e9('0x10')](_0xb7e9('0xd'),_0x372cf5,_0x5a18b4);_0x36ba06(_0x5a18b4);});});} \ No newline at end of file +var _0x09ce=['jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xaaa1c2,_0x827863){var _0x3da77e=function(_0x413e90){while(--_0x413e90){_0xaaa1c2['push'](_0xaaa1c2['shift']());}};_0x3da77e(++_0x827863);}(_0x09ce,0x15c));var _0xe09c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x09ce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe09c('0x0'));var util=require(_0xe09c('0x1'));var moment=require(_0xe09c('0x2'));var BPromise=require(_0xe09c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe09c('0x4'))['db'];var utils=require(_0xe09c('0x5'));var logger=require(_0xe09c('0x6'))(_0xe09c('0x7'));var config=require(_0xe09c('0x8'));var jayson=require(_0xe09c('0x9'));var client=jayson[_0xe09c('0xa')][_0xe09c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x133766,_0x43fc45,_0x5df0e3){return new BPromise(function(_0x13e98d,_0x2d2b0a){return client[_0xe09c('0xc')](_0x133766,_0x5df0e3)[_0xe09c('0xd')](function(_0x401ff6){logger[_0xe09c('0xe')](_0xe09c('0xf'),_0x43fc45,_0xe09c('0x10'));logger[_0xe09c('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0x43fc45,'request\x20sent',JSON['stringify'](_0x401ff6));if(_0x401ff6['error']){if(_0x401ff6['error']['code']===0x1f4){logger[_0xe09c('0x12')](_0xe09c('0xf'),_0x43fc45,_0x401ff6['error'][_0xe09c('0x13')]);return _0x2d2b0a(_0x401ff6[_0xe09c('0x12')][_0xe09c('0x13')]);}logger[_0xe09c('0x12')](_0xe09c('0xf'),_0x43fc45,_0x401ff6[_0xe09c('0x12')][_0xe09c('0x13')]);return _0x13e98d(_0x401ff6[_0xe09c('0x12')]['message']);}else{logger[_0xe09c('0xe')](_0xe09c('0xf'),_0x43fc45,'request\x20sent');_0x13e98d(_0x401ff6[_0xe09c('0x14')]['message']);}})['catch'](function(_0xffc617){logger[_0xe09c('0x12')](_0xe09c('0xf'),_0x43fc45,_0xffc617);_0x2d2b0a(_0xffc617);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d24a172..59dc808 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 _0xd6bd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x2f1512,_0x24af0e){var _0x15811b=function(_0x544323){while(--_0x544323){_0x2f1512['push'](_0x2f1512['shift']());}};_0x15811b(++_0x24af0e);}(_0xd6bd,0x64));var _0xdd6b=function(_0xd1179e,_0x5c65de){_0xd1179e=_0xd1179e-0x0;var _0x1c7c8e=_0xd6bd[_0xd1179e];return _0x1c7c8e;};'use strict';var multer=require(_0xdd6b('0x0'));var util=require('util');var path=require(_0xdd6b('0x1'));var timeout=require(_0xdd6b('0x2'));var express=require(_0xdd6b('0x3'));var router=express['Router']();var fs_extra=require(_0xdd6b('0x4'));var auth=require(_0xdd6b('0x5'));var interaction=require(_0xdd6b('0x6'));var config=require(_0xdd6b('0x7'));var controller=require(_0xdd6b('0x8'));router[_0xdd6b('0x9')](_0xdd6b('0xa'),auth[_0xdd6b('0xb')](),controller['update']);router[_0xdd6b('0xc')]('/:id',auth[_0xdd6b('0xb')](),controller[_0xdd6b('0xd')]);module[_0xdd6b('0xe')]=router; \ No newline at end of file +var _0xa705=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xa705,0xb5));var _0x5a70=function(_0x4331ad,_0x60d482){_0x4331ad=_0x4331ad-0x0;var _0x461642=_0xa705[_0x4331ad];return _0x461642;};'use strict';var multer=require(_0x5a70('0x0'));var util=require(_0x5a70('0x1'));var path=require(_0x5a70('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a70('0x3'));var router=express['Router']();var fs_extra=require(_0x5a70('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5a70('0x5'));var config=require(_0x5a70('0x6'));var controller=require('./condition.controller');router[_0x5a70('0x7')](_0x5a70('0x8'),auth[_0x5a70('0x9')](),controller[_0x5a70('0xa')]);router[_0x5a70('0xb')]('/:id',auth[_0x5a70('0x9')](),controller[_0x5a70('0xc')]);module[_0x5a70('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f1a2a4c..dc965c3 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 _0xb7e7=['STRING','sequelize'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb7e7[_0x50aa2e];return _0x5e07f0;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x570b40,_0x48947c){var _0x5be177=function(_0x29ce65){while(--_0x29ce65){_0x570b40['push'](_0x570b40['shift']());}};_0x5be177(++_0x48947c);}(_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 355c753..8965b5f 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 _0x428b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','index','Dashboard','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x428b,0x1ae));var _0xb428=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x428b[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0xb428('0x0'));var rimraf=require(_0xb428('0x1'));var zipdir=require(_0xb428('0x2'));var jsonpatch=require(_0xb428('0x3'));var rp=require(_0xb428('0x4'));var moment=require('moment');var BPromise=require(_0xb428('0x5'));var Mustache=require(_0xb428('0x6'));var util=require(_0xb428('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb428('0x8'));var ejs=require(_0xb428('0x9'));var fs=require('fs');var fs_extra=require(_0xb428('0xa'));var _=require('lodash');var squel=require(_0xb428('0xb'));var crypto=require(_0xb428('0xc'));var jsforce=require(_0xb428('0xd'));var deskjs=require(_0xb428('0xe'));var toCsv=require(_0xb428('0x8'));var querystring=require(_0xb428('0xf'));var Papa=require(_0xb428('0x10'));var Redis=require(_0xb428('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb428('0x12'));var hardwareService=require(_0xb428('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb428('0x14'));var config=require(_0xb428('0x15'));var licenseUtil=require(_0xb428('0x16'));var db=require('../../mysqldb')['db'];config[_0xb428('0x17')]=_['defaults'](config[_0xb428('0x17')],{'host':_0xb428('0x18'),'port':0x18eb});var socket=require(_0xb428('0x19'))(new Redis(config[_0xb428('0x17')]));require('./dashboard.socket')[_0xb428('0x1a')](socket);function respondWithStatusCode(_0x5cc80f,_0x510275){_0x510275=_0x510275||0xcc;return function(_0x567fdc){if(_0x567fdc){return _0x5cc80f[_0xb428('0x1b')](_0x510275);}return _0x5cc80f[_0xb428('0x1c')](_0x510275)['end']();};}function respondWithResult(_0x4ce3f9,_0x439190){_0x439190=_0x439190||0xc8;return function(_0x37ffa7){if(_0x37ffa7){return _0x4ce3f9[_0xb428('0x1c')](_0x439190)[_0xb428('0x1d')](_0x37ffa7);}};}function respondWithFilteredResult(_0x27e55e,_0x2df8de){return function(_0x5d69d9){if(_0x5d69d9){var _0x1bd48c=typeof _0x2df8de[_0xb428('0x1e')]==='undefined'&&typeof _0x2df8de[_0xb428('0x1f')]===_0xb428('0x20');var _0xab1271=_0x5d69d9['count'];var _0x101cce=_0x1bd48c?0x0:_0x2df8de[_0xb428('0x1e')];var _0x5d22aa=_0x1bd48c?_0x5d69d9[_0xb428('0x21')]:_0x2df8de[_0xb428('0x1e')]+_0x2df8de['limit'];var _0x344698;if(_0x5d22aa>=_0xab1271){_0x5d22aa=_0xab1271;_0x344698=0xc8;}else{_0x344698=0xce;}_0x27e55e[_0xb428('0x1c')](_0x344698);return _0x27e55e['set'](_0xb428('0x22'),_0x101cce+'-'+_0x5d22aa+'/'+_0xab1271)[_0xb428('0x1d')](_0x5d69d9);}return null;};}function patchUpdates(_0xe26385){return function(_0x4ed765){try{jsonpatch['apply'](_0x4ed765,_0xe26385,!![]);}catch(_0x43e8e1){return BPromise['reject'](_0x43e8e1);}return _0x4ed765['save']();};}function saveUpdates(_0x3050ef,_0x55f1f3){return function(_0x3a6b4b){if(_0x3a6b4b){return _0x3a6b4b['update'](_0x3050ef)[_0xb428('0x23')](function(_0x4429c8){return _0x4429c8;});}return null;};}function removeEntity(_0x44d334,_0x30e1ae){return function(_0x2ae5a5){if(_0x2ae5a5){return _0x2ae5a5[_0xb428('0x24')]()[_0xb428('0x23')](function(){var _0x86c54c=_0x2ae5a5[_0xb428('0x25')]({'plain':!![]});var _0x44e50f='CustomDashboards';return db[_0xb428('0x26')][_0xb428('0x24')]({'where':{'type':_0x44e50f,'resourceId':_0x86c54c['id']}})[_0xb428('0x23')](function(){return _0x2ae5a5;});})[_0xb428('0x23')](function(){_0x44d334[_0xb428('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231b48,_0x4a19a6){return function(_0x49c561){if(!_0x49c561){_0x231b48[_0xb428('0x1b')](0x194);}return _0x49c561;};}function handleError(_0x327222,_0x22f182){_0x22f182=_0x22f182||0x1f4;return function(_0x3b293f){logger[_0xb428('0x27')](_0x3b293f[_0xb428('0x28')]);if(_0x3b293f[_0xb428('0x29')]){delete _0x3b293f[_0xb428('0x29')];}_0x327222[_0xb428('0x1c')](_0x22f182)['send'](_0x3b293f);};}exports[_0xb428('0x2a')]=function(_0xcf6b2a,_0x5d3e23){var _0x24277c={},_0x223344={},_0x38df82={'count':0x0,'rows':[]};var _0x36321a=_['map'](db[_0xb428('0x2b')][_0xb428('0x2c')],function(_0x58d6ae){return{'name':_0x58d6ae['fieldName'],'type':_0x58d6ae[_0xb428('0x2d')]['key']};});_0x223344[_0xb428('0x2e')]=_['map'](_0x36321a,'name');_0x223344[_0xb428('0x2f')]=_[_0xb428('0x30')](_0xcf6b2a[_0xb428('0x2f')]);_0x223344[_0xb428('0x31')]=_['intersection'](_0x223344[_0xb428('0x2e')],_0x223344[_0xb428('0x2f')]);_0x24277c[_0xb428('0x32')]=_[_0xb428('0x33')](_0x223344['model'],qs[_0xb428('0x34')](_0xcf6b2a[_0xb428('0x2f')]['fields']));_0x24277c[_0xb428('0x32')]=_0x24277c[_0xb428('0x32')][_0xb428('0x35')]?_0x24277c[_0xb428('0x32')]:_0x223344[_0xb428('0x2e')];if(!_0xcf6b2a['query']['hasOwnProperty'](_0xb428('0x36'))){_0x24277c[_0xb428('0x1f')]=qs['limit'](_0xcf6b2a['query'][_0xb428('0x1f')]);_0x24277c[_0xb428('0x1e')]=qs[_0xb428('0x1e')](_0xcf6b2a[_0xb428('0x2f')][_0xb428('0x1e')]);}_0x24277c[_0xb428('0x37')]=qs['sort'](_0xcf6b2a[_0xb428('0x2f')][_0xb428('0x38')]);_0x24277c['where']=qs['filters'](_[_0xb428('0x39')](_0xcf6b2a[_0xb428('0x2f')],_0x223344[_0xb428('0x31')]),_0x36321a);if(_0xcf6b2a['query'][_0xb428('0x3a')]){_0x24277c[_0xb428('0x3b')]=_[_0xb428('0x3c')](_0x24277c[_0xb428('0x3b')],{'$or':_[_0xb428('0x3d')](_0x36321a,function(_0x5b7e91){if(_0x5b7e91[_0xb428('0x2d')]!==_0xb428('0x3e')){var _0x2b46fb={};_0x2b46fb[_0x5b7e91[_0xb428('0x29')]]={'$like':'%'+_0xcf6b2a[_0xb428('0x2f')][_0xb428('0x3a')]+'%'};return _0x2b46fb;}})});}_0x24277c=_[_0xb428('0x3c')]({},_0x24277c,_0xcf6b2a[_0xb428('0x3f')]);var _0x404b2a={'where':_0x24277c['where']};return db['Dashboard']['count'](_0x404b2a)['then'](function(_0x1f4001){_0x38df82[_0xb428('0x21')]=_0x1f4001;if(_0xcf6b2a[_0xb428('0x2f')][_0xb428('0x40')]){_0x24277c[_0xb428('0x41')]=[{'all':!![]}];}return db[_0xb428('0x2b')][_0xb428('0x42')](_0x24277c);})['then'](function(_0x19abfe){_0x38df82['rows']=_0x19abfe;return _0x38df82;})[_0xb428('0x23')](respondWithFilteredResult(_0x5d3e23,_0x24277c))[_0xb428('0x43')](handleError(_0x5d3e23,null));};exports['show']=function(_0x2bf570,_0x474961){var _0x5d575d={'raw':![],'where':{'id':_0x2bf570['params']['id']}},_0x1bd78b={};_0x1bd78b[_0xb428('0x2e')]=_[_0xb428('0x30')](db[_0xb428('0x2b')][_0xb428('0x2c')]);_0x1bd78b[_0xb428('0x2f')]=_[_0xb428('0x30')](_0x2bf570[_0xb428('0x2f')]);_0x1bd78b[_0xb428('0x31')]=_['intersection'](_0x1bd78b[_0xb428('0x2e')],_0x1bd78b[_0xb428('0x2f')]);_0x5d575d[_0xb428('0x32')]=_[_0xb428('0x33')](_0x1bd78b[_0xb428('0x2e')],qs[_0xb428('0x34')](_0x2bf570[_0xb428('0x2f')][_0xb428('0x34')]));_0x5d575d[_0xb428('0x32')]=_0x5d575d[_0xb428('0x32')]['length']?_0x5d575d[_0xb428('0x32')]:_0x1bd78b[_0xb428('0x2e')];if(_0x2bf570['query'][_0xb428('0x40')]){_0x5d575d['include']=[{'all':!![]}];}_0x5d575d=_[_0xb428('0x3c')]({},_0x5d575d,_0x2bf570[_0xb428('0x3f')]);return db[_0xb428('0x2b')][_0xb428('0x44')](_0x5d575d)[_0xb428('0x23')](handleEntityNotFound(_0x474961,null))[_0xb428('0x23')](respondWithResult(_0x474961,null))[_0xb428('0x43')](handleError(_0x474961,null));};exports[_0xb428('0x45')]=function(_0x40023c,_0x476081){return db[_0xb428('0x2b')][_0xb428('0x45')](_0x40023c[_0xb428('0x46')],{})[_0xb428('0x23')](function(_0x1c35ad){var _0x261f96=_0x40023c[_0xb428('0x47')][_0xb428('0x25')]({'plain':!![]});if(!_0x261f96)throw new Error(_0xb428('0x48'));if(_0x261f96[_0xb428('0x49')]===_0xb428('0x47')){var _0x2a67d9=_0x1c35ad['get']({'plain':!![]});var _0x270b71=_0xb428('0x4a');return db[_0xb428('0x4b')][_0xb428('0x44')]({'where':{'name':_0x270b71,'userProfileId':_0x261f96[_0xb428('0x4c')]},'raw':!![]})[_0xb428('0x23')](function(_0xe66fc8){if(_0xe66fc8&&_0xe66fc8['autoAssociation']===0x0){return db[_0xb428('0x26')][_0xb428('0x45')]({'name':_0x2a67d9[_0xb428('0x29')],'resourceId':_0x2a67d9['id'],'type':_0xe66fc8[_0xb428('0x29')],'sectionId':_0xe66fc8['id']},{})['then'](function(){return _0x1c35ad;});}else{return _0x1c35ad;}})[_0xb428('0x43')](function(_0x3ee225){logger['error'](_0xb428('0x4d'),_0x3ee225);throw _0x3ee225;});}return _0x1c35ad;})[_0xb428('0x23')](respondWithResult(_0x476081,0xc9))[_0xb428('0x43')](handleError(_0x476081,null));};exports[_0xb428('0x4e')]=function(_0x439b8e,_0xb877eb){var _0x4bde2c={'where':{'id':_0x439b8e[_0xb428('0x4f')]['id']}},_0x223cac={};_0x223cac[_0xb428('0x2e')]=_[_0xb428('0x30')](db['Dashboard'][_0xb428('0x2c')]);_0x4bde2c[_0xb428('0x32')]=_[_0xb428('0x33')](_0x223cac['model'],qs[_0xb428('0x34')](_0x439b8e[_0xb428('0x2f')]['fields']));_0x4bde2c[_0xb428('0x32')]=_0x4bde2c[_0xb428('0x32')][_0xb428('0x35')]?_0x4bde2c[_0xb428('0x32')]:_0x223cac[_0xb428('0x2e')];if(_0x439b8e[_0xb428('0x2f')][_0xb428('0x40')]){_0x4bde2c[_0xb428('0x41')]=[{'all':!![]}];}_0x4bde2c=_[_0xb428('0x3c')]({},_0x4bde2c,_0x439b8e['options']);return db[_0xb428('0x2b')][_0xb428('0x44')](_0x4bde2c)[_0xb428('0x23')](handleEntityNotFound(_0xb877eb,null))[_0xb428('0x23')](function(_0x2e2db5){if(_0x2e2db5){var _0x5ce0c5=_0x2e2db5[_0xb428('0x25')]({'plain':!![]});_0x5ce0c5=qs[_0xb428('0x50')](_0x5ce0c5,['id',_0xb428('0x51'),_0xb428('0x52')]);_0x439b8e['body']=_['omit'](_0x439b8e['body'],['id',_0xb428('0x51'),_0xb428('0x52')]);return db[_0xb428('0x2b')][_0xb428('0x45')](_['merge'](_0x5ce0c5,_0x439b8e['body']),{'include':_0x439b8e['query'][_0xb428('0x40')]?[{'all':!![]}]:undefined})[_0xb428('0x23')](function(_0x19daa1){var _0xf824d3=_0x439b8e[_0xb428('0x47')]['get']({'plain':!![]});if(!_0xf824d3)throw new Error(_0xb428('0x48'));if(_0xf824d3[_0xb428('0x49')]===_0xb428('0x47')){var _0x16671=_0x19daa1[_0xb428('0x25')]({'plain':!![]});var _0x13b8f9=_0xb428('0x4a');return db[_0xb428('0x4b')][_0xb428('0x44')]({'where':{'name':_0x13b8f9,'userProfileId':_0xf824d3[_0xb428('0x4c')]},'raw':!![]})[_0xb428('0x23')](function(_0x2046c4){if(_0x2046c4&&_0x2046c4['autoAssociation']===0x0){return db['UserProfileResource'][_0xb428('0x45')]({'name':_0x16671[_0xb428('0x29')],'resourceId':_0x16671['id'],'type':_0x2046c4[_0xb428('0x29')],'sectionId':_0x2046c4['id']},{})[_0xb428('0x23')](function(){return _0x19daa1;});}else{return _0x19daa1;}})[_0xb428('0x43')](function(_0x28a3f8){logger['error'](_0xb428('0x4d'),_0x28a3f8);throw _0x28a3f8;});}return _0x19daa1;});}})['then'](respondWithResult(_0xb877eb,0xc9))[_0xb428('0x43')](handleError(_0xb877eb,null));};exports['update']=function(_0x217f07,_0x3db271){if(_0x217f07['body']['id']){delete _0x217f07[_0xb428('0x46')]['id'];}return db['Dashboard'][_0xb428('0x44')]({'where':{'id':_0x217f07[_0xb428('0x4f')]['id']}})[_0xb428('0x23')](handleEntityNotFound(_0x3db271,null))['then'](saveUpdates(_0x217f07[_0xb428('0x46')],null))[_0xb428('0x23')](respondWithResult(_0x3db271,null))['catch'](handleError(_0x3db271,null));};exports['destroy']=function(_0x1c1602,_0x4f5678){return db[_0xb428('0x2b')]['find']({'where':{'id':_0x1c1602[_0xb428('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f5678,null))[_0xb428('0x23')](removeEntity(_0x4f5678,null))[_0xb428('0x43')](handleError(_0x4f5678,null));};function widgetAttributes(_0x590173){try{switch(_0x590173[_0xb428('0x2d')]){case'iframe':return[{'name':_0xb428('0x53'),'value':_0x590173[_0xb428('0x53')]||(_0x590173['attrs']&&_0x590173[_0xb428('0x54')][0x0]?_0x590173[_0xb428('0x54')][0x0]['value']:undefined)||'https://'}];case _0xb428('0x55'):return[{'name':_0xb428('0x56'),'value':_0x590173[_0xb428('0x56')]||(_0x590173[_0xb428('0x54')]&&_0x590173['attrs'][0x0]?_0x590173[_0xb428('0x54')][0x0]['value']:undefined)||''}];case _0xb428('0x57'):return[{'name':_0xb428('0x58'),'value':_0x590173[_0xb428('0x58')]||(_0x590173['attrs']&&_0x590173['attrs'][0x0]?_0x590173['attrs'][0x0][_0xb428('0x59')]:undefined)||_0xb428('0x5a')},{'name':_0xb428('0x5b'),'value':_0x590173[_0xb428('0x5b')]||(_0x590173[_0xb428('0x54')]&&_0x590173[_0xb428('0x54')][0x1]?_0x590173[_0xb428('0x54')][0x1][_0xb428('0x59')]:undefined)||_0xb428('0x5c')},{'name':'attrFontSize','value':_0x590173[_0xb428('0x5d')]||(_0x590173['attrs']&&_0x590173[_0xb428('0x54')][0x2]?_0x590173['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xb428('0x5e'),'value':_0x590173['attrMetric']||(_0x590173['attrs']&&_0x590173[_0xb428('0x54')][0x0]?_0x590173[_0xb428('0x54')][0x0]['value']:undefined)||_0xb428('0x5f')},{'name':_0xb428('0x60'),'value':_0x590173[_0xb428('0x60')]||(_0x590173[_0xb428('0x54')]&&_0x590173[_0xb428('0x54')][0x1]?_0x590173['attrs'][0x1][_0xb428('0x59')]:undefined)||[]},{'name':_0xb428('0x5d'),'value':_0x590173['attrFontSize']||(_0x590173[_0xb428('0x54')]&&_0x590173[_0xb428('0x54')][0x2]?_0x590173['attrs'][0x2][_0xb428('0x59')]:undefined)||0x14}];case _0xb428('0x61'):case _0xb428('0x62'):return[{'name':'attrSerie1','value':_0x590173[_0xb428('0x63')]||(_0x590173['attrs']&&_0x590173[_0xb428('0x54')][0x0]?_0x590173[_0xb428('0x54')][0x0][_0xb428('0x59')]:undefined)||_0xb428('0x5f')},{'name':_0xb428('0x64'),'value':_0x590173['attrSerie2']||(_0x590173[_0xb428('0x54')]&&_0x590173[_0xb428('0x54')][0x1]?_0x590173['attrs'][0x1][_0xb428('0x59')]:undefined)||null},{'name':_0xb428('0x65'),'value':_0x590173['attrSerie3']||(_0x590173[_0xb428('0x54')]&&_0x590173[_0xb428('0x54')][0x2]?_0x590173[_0xb428('0x54')][0x2][_0xb428('0x59')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x590173[_0xb428('0x60')]||(_0x590173[_0xb428('0x54')]&&_0x590173[_0xb428('0x54')][0x3]?_0x590173[_0xb428('0x54')][0x3][_0xb428('0x59')]:undefined)||[]}];case _0xb428('0x66'):return[{'name':'attrReport','type':_0x590173[_0xb428('0x67')]||(_0x590173['attrs']&&_0x590173['attrs'][0x0]?_0x590173['attrs'][0x0][_0xb428('0x2d')]:undefined)||null,'value':_0x590173[_0xb428('0x68')]||(_0x590173['attrs']&&_0x590173[_0xb428('0x54')][0x0]?_0x590173[_0xb428('0x54')][0x0][_0xb428('0x59')]:undefined)||null},{'name':'attrRefresh','value':_0x590173[_0xb428('0x69')]||(_0x590173[_0xb428('0x54')]&&_0x590173[_0xb428('0x54')][0x1]?_0x590173[_0xb428('0x54')][0x1][_0xb428('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x10e25e){logger[_0xb428('0x27')]('widgetAttributes:\x20%s',JSON[_0xb428('0x6a')](_0x10e25e));return[];}}exports[_0xb428('0x6b')]=function(_0x311a1d,_0x186a8d,_0x3d4713){if(_0x311a1d[_0xb428('0x46')]['id']){delete _0x311a1d['body']['id'];}return db[_0xb428('0x2b')][_0xb428('0x44')]({'where':{'id':_0x311a1d[_0xb428('0x4f')]['id']}})['then'](handleEntityNotFound(_0x186a8d,null))[_0xb428('0x23')](function(_0x46e894){if(_0x46e894){_0x311a1d[_0xb428('0x46')][_0xb428('0x6c')]=_0x46e894['id'];_0x311a1d[_0xb428('0x46')][_0xb428('0x54')]=widgetAttributes(_0x311a1d[_0xb428('0x46')]);return db[_0xb428('0x6d')][_0xb428('0x45')](_0x311a1d[_0xb428('0x46')]);}})['then'](respondWithResult(_0x186a8d,null))['catch'](handleError(_0x186a8d,null));};exports['getItems']=function(_0x540f57,_0x42dfb6,_0x5c1f84){var _0x3ef6d1={};var _0x525302={};var _0x5d8e7b;var _0x27c7a6;return db[_0xb428('0x2b')][_0xb428('0x6e')]({'where':{'id':_0x540f57['params']['id']}})['then'](handleEntityNotFound(_0x42dfb6,null))[_0xb428('0x23')](function(_0x3edfbf){if(_0x3edfbf){_0x5d8e7b=_0x3edfbf;_0x525302['model']=_[_0xb428('0x30')](db['DashboardItem']['rawAttributes']);_0x525302[_0xb428('0x2f')]=_['keys'](_0x540f57['query']);_0x525302[_0xb428('0x31')]=_[_0xb428('0x33')](_0x525302[_0xb428('0x2e')],_0x525302[_0xb428('0x2f')]);_0x3ef6d1[_0xb428('0x32')]=_[_0xb428('0x33')](_0x525302[_0xb428('0x2e')],qs[_0xb428('0x34')](_0x540f57[_0xb428('0x2f')][_0xb428('0x34')]));_0x3ef6d1[_0xb428('0x32')]=_0x3ef6d1[_0xb428('0x32')][_0xb428('0x35')]?_0x3ef6d1[_0xb428('0x32')]:_0x525302[_0xb428('0x2e')];_0x3ef6d1[_0xb428('0x37')]=qs[_0xb428('0x38')](_0x540f57['query']['sort']);_0x3ef6d1[_0xb428('0x3b')]=qs[_0xb428('0x31')](_['pick'](_0x540f57['query'],_0x525302[_0xb428('0x31')]));if(_0x540f57[_0xb428('0x2f')]['filter']){_0x3ef6d1[_0xb428('0x3b')]=_[_0xb428('0x3c')](_0x3ef6d1[_0xb428('0x3b')],{'$or':_[_0xb428('0x3d')](_0x3ef6d1[_0xb428('0x32')],function(_0x774dee){var _0x1a874b={};_0x1a874b[_0x774dee]={'$like':'%'+_0x540f57['query'][_0xb428('0x3a')]+'%'};return _0x1a874b;})});}_0x3ef6d1=_['merge']({},_0x3ef6d1,_0x540f57[_0xb428('0x3f')]);return _0x5d8e7b[_0xb428('0x6f')](_0x3ef6d1);}})['then'](function(_0x4aabf6){if(_0x4aabf6){_0x27c7a6=_0x4aabf6[_0xb428('0x35')];if(!_0x540f57[_0xb428('0x2f')]['hasOwnProperty'](_0xb428('0x36'))){_0x3ef6d1[_0xb428('0x1f')]=qs[_0xb428('0x1f')](_0x540f57[_0xb428('0x2f')]['limit']);_0x3ef6d1[_0xb428('0x1e')]=qs[_0xb428('0x1e')](_0x540f57[_0xb428('0x2f')][_0xb428('0x1e')]);}return _0x5d8e7b['getItems'](_0x3ef6d1);}})[_0xb428('0x23')](function(_0x457a4c){if(_0x457a4c){return _0x457a4c?{'count':_0x27c7a6,'rows':_0x457a4c}:null;}})[_0xb428('0x23')](respondWithResult(_0x42dfb6,null))[_0xb428('0x43')](handleError(_0x42dfb6,null));}; \ No newline at end of file +var _0xf22b=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','CustomDashboards','sendStatus','error','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x2bef05,_0x3e7a01){var _0x3e7eff=function(_0x3c7f61){while(--_0x3c7f61){_0x2bef05['push'](_0x2bef05['shift']());}};_0x3e7eff(++_0x3e7a01);}(_0xf22b,0x12d));var _0xbf22=function(_0x377153,_0x212973){_0x377153=_0x377153-0x0;var _0x44be7c=_0xf22b[_0x377153];return _0x44be7c;};'use strict';var emlformat=require(_0xbf22('0x0'));var rimraf=require(_0xbf22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf22('0x2'));var rp=require(_0xbf22('0x3'));var moment=require(_0xbf22('0x4'));var BPromise=require(_0xbf22('0x5'));var Mustache=require('mustache');var util=require(_0xbf22('0x6'));var path=require(_0xbf22('0x7'));var sox=require(_0xbf22('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf22('0x9'));var _=require(_0xbf22('0xa'));var squel=require(_0xbf22('0xb'));var crypto=require(_0xbf22('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf22('0xd'));var querystring=require(_0xbf22('0xe'));var Papa=require(_0xbf22('0xf'));var Redis=require(_0xbf22('0x10'));var authService=require(_0xbf22('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbf22('0x12'));var hardwareService=require(_0xbf22('0x13'));var logger=require(_0xbf22('0x14'))(_0xbf22('0x15'));var utils=require('../../config/utils');var config=require(_0xbf22('0x16'));var licenseUtil=require(_0xbf22('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xbf22('0x18')],{'host':_0xbf22('0x19'),'port':0x18eb});var socket=require(_0xbf22('0x1a'))(new Redis(config[_0xbf22('0x18')]));require('./dashboard.socket')[_0xbf22('0x1b')](socket);function respondWithStatusCode(_0x17ea2f,_0xd0b72){_0xd0b72=_0xd0b72||0xcc;return function(_0x57ce74){if(_0x57ce74){return _0x17ea2f['sendStatus'](_0xd0b72);}return _0x17ea2f[_0xbf22('0x1c')](_0xd0b72)[_0xbf22('0x1d')]();};}function respondWithResult(_0x2f26b2,_0x40aa50){_0x40aa50=_0x40aa50||0xc8;return function(_0x44b5ff){if(_0x44b5ff){return _0x2f26b2[_0xbf22('0x1c')](_0x40aa50)[_0xbf22('0x1e')](_0x44b5ff);}};}function respondWithFilteredResult(_0x5365b7,_0x460329){return function(_0x5e6134){if(_0x5e6134){var _0x358c14=typeof _0x460329[_0xbf22('0x1f')]===_0xbf22('0x20')&&typeof _0x460329[_0xbf22('0x21')]===_0xbf22('0x20');var _0x32da4c=_0x5e6134[_0xbf22('0x22')];var _0x29f727=_0x358c14?0x0:_0x460329[_0xbf22('0x1f')];var _0xfc4d69=_0x358c14?_0x5e6134[_0xbf22('0x22')]:_0x460329[_0xbf22('0x1f')]+_0x460329[_0xbf22('0x21')];var _0x5711e8;if(_0xfc4d69>=_0x32da4c){_0xfc4d69=_0x32da4c;_0x5711e8=0xc8;}else{_0x5711e8=0xce;}_0x5365b7['status'](_0x5711e8);return _0x5365b7[_0xbf22('0x23')](_0xbf22('0x24'),_0x29f727+'-'+_0xfc4d69+'/'+_0x32da4c)[_0xbf22('0x1e')](_0x5e6134);}return null;};}function patchUpdates(_0x3c80a9){return function(_0x1a98e6){try{jsonpatch[_0xbf22('0x25')](_0x1a98e6,_0x3c80a9,!![]);}catch(_0x1fe72c){return BPromise[_0xbf22('0x26')](_0x1fe72c);}return _0x1a98e6['save']();};}function saveUpdates(_0x11f4cf,_0x1ab8ef){return function(_0x9fe28a){if(_0x9fe28a){return _0x9fe28a[_0xbf22('0x27')](_0x11f4cf)[_0xbf22('0x28')](function(_0xed4e13){return _0xed4e13;});}return null;};}function removeEntity(_0x166542,_0x9975fe){return function(_0x425150){if(_0x425150){return _0x425150[_0xbf22('0x29')]()[_0xbf22('0x28')](function(){var _0x77ec1e=_0x425150[_0xbf22('0x2a')]({'plain':!![]});var _0x2b8c89=_0xbf22('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b8c89,'resourceId':_0x77ec1e['id']}})[_0xbf22('0x28')](function(){return _0x425150;});})[_0xbf22('0x28')](function(){_0x166542[_0xbf22('0x1c')](0xcc)[_0xbf22('0x1d')]();});}};}function handleEntityNotFound(_0x879b09,_0x2aaf33){return function(_0x3cd89a){if(!_0x3cd89a){_0x879b09[_0xbf22('0x2c')](0x194);}return _0x3cd89a;};}function handleError(_0x3850e5,_0x1d3666){_0x1d3666=_0x1d3666||0x1f4;return function(_0x272e84){logger[_0xbf22('0x2d')](_0x272e84[_0xbf22('0x2e')]);if(_0x272e84[_0xbf22('0x2f')]){delete _0x272e84[_0xbf22('0x2f')];}_0x3850e5['status'](_0x1d3666)[_0xbf22('0x30')](_0x272e84);};}exports[_0xbf22('0x31')]=function(_0x2e4e76,_0x50d517){var _0x4ee09e={},_0x1b7a7a={},_0x1e61c5={'count':0x0,'rows':[]};var _0x780cd1=_[_0xbf22('0x32')](db[_0xbf22('0x33')]['rawAttributes'],function(_0x1f416e){return{'name':_0x1f416e[_0xbf22('0x34')],'type':_0x1f416e[_0xbf22('0x35')][_0xbf22('0x36')]};});_0x1b7a7a[_0xbf22('0x37')]=_[_0xbf22('0x32')](_0x780cd1,_0xbf22('0x2f'));_0x1b7a7a[_0xbf22('0x38')]=_[_0xbf22('0x39')](_0x2e4e76[_0xbf22('0x38')]);_0x1b7a7a['filters']=_[_0xbf22('0x3a')](_0x1b7a7a[_0xbf22('0x37')],_0x1b7a7a[_0xbf22('0x38')]);_0x4ee09e[_0xbf22('0x3b')]=_[_0xbf22('0x3a')](_0x1b7a7a[_0xbf22('0x37')],qs[_0xbf22('0x3c')](_0x2e4e76[_0xbf22('0x38')]['fields']));_0x4ee09e[_0xbf22('0x3b')]=_0x4ee09e[_0xbf22('0x3b')][_0xbf22('0x3d')]?_0x4ee09e['attributes']:_0x1b7a7a['model'];if(!_0x2e4e76[_0xbf22('0x38')][_0xbf22('0x3e')](_0xbf22('0x3f'))){_0x4ee09e['limit']=qs[_0xbf22('0x21')](_0x2e4e76['query'][_0xbf22('0x21')]);_0x4ee09e[_0xbf22('0x1f')]=qs[_0xbf22('0x1f')](_0x2e4e76['query']['offset']);}_0x4ee09e[_0xbf22('0x40')]=qs['sort'](_0x2e4e76[_0xbf22('0x38')][_0xbf22('0x41')]);_0x4ee09e[_0xbf22('0x42')]=qs[_0xbf22('0x43')](_[_0xbf22('0x44')](_0x2e4e76[_0xbf22('0x38')],_0x1b7a7a[_0xbf22('0x43')]),_0x780cd1);if(_0x2e4e76[_0xbf22('0x38')][_0xbf22('0x45')]){_0x4ee09e[_0xbf22('0x42')]=_[_0xbf22('0x46')](_0x4ee09e[_0xbf22('0x42')],{'$or':_[_0xbf22('0x32')](_0x780cd1,function(_0x54c85a){if(_0x54c85a[_0xbf22('0x35')]!=='VIRTUAL'){var _0x467338={};_0x467338[_0x54c85a[_0xbf22('0x2f')]]={'$like':'%'+_0x2e4e76[_0xbf22('0x38')]['filter']+'%'};return _0x467338;}})});}_0x4ee09e=_[_0xbf22('0x46')]({},_0x4ee09e,_0x2e4e76[_0xbf22('0x47')]);var _0x4129e2={'where':_0x4ee09e[_0xbf22('0x42')]};return db[_0xbf22('0x33')][_0xbf22('0x22')](_0x4129e2)[_0xbf22('0x28')](function(_0x54e1dc){_0x1e61c5[_0xbf22('0x22')]=_0x54e1dc;if(_0x2e4e76[_0xbf22('0x38')][_0xbf22('0x48')]){_0x4ee09e[_0xbf22('0x49')]=[{'all':!![]}];}return db[_0xbf22('0x33')][_0xbf22('0x4a')](_0x4ee09e);})[_0xbf22('0x28')](function(_0x439086){_0x1e61c5[_0xbf22('0x4b')]=_0x439086;return _0x1e61c5;})[_0xbf22('0x28')](respondWithFilteredResult(_0x50d517,_0x4ee09e))['catch'](handleError(_0x50d517,null));};exports[_0xbf22('0x4c')]=function(_0x503036,_0x53f4d0){var _0x1e8a73={'raw':![],'where':{'id':_0x503036[_0xbf22('0x4d')]['id']}},_0x24d075={};_0x24d075[_0xbf22('0x37')]=_[_0xbf22('0x39')](db[_0xbf22('0x33')][_0xbf22('0x4e')]);_0x24d075[_0xbf22('0x38')]=_[_0xbf22('0x39')](_0x503036[_0xbf22('0x38')]);_0x24d075[_0xbf22('0x43')]=_['intersection'](_0x24d075[_0xbf22('0x37')],_0x24d075[_0xbf22('0x38')]);_0x1e8a73[_0xbf22('0x3b')]=_[_0xbf22('0x3a')](_0x24d075[_0xbf22('0x37')],qs[_0xbf22('0x3c')](_0x503036[_0xbf22('0x38')][_0xbf22('0x3c')]));_0x1e8a73[_0xbf22('0x3b')]=_0x1e8a73[_0xbf22('0x3b')]['length']?_0x1e8a73[_0xbf22('0x3b')]:_0x24d075[_0xbf22('0x37')];if(_0x503036[_0xbf22('0x38')][_0xbf22('0x48')]){_0x1e8a73[_0xbf22('0x49')]=[{'all':!![]}];}_0x1e8a73=_[_0xbf22('0x46')]({},_0x1e8a73,_0x503036[_0xbf22('0x47')]);return db['Dashboard'][_0xbf22('0x4f')](_0x1e8a73)[_0xbf22('0x28')](handleEntityNotFound(_0x53f4d0,null))[_0xbf22('0x28')](respondWithResult(_0x53f4d0,null))['catch'](handleError(_0x53f4d0,null));};exports['create']=function(_0x287eee,_0x450f9d){return db[_0xbf22('0x33')][_0xbf22('0x50')](_0x287eee[_0xbf22('0x51')],{})[_0xbf22('0x28')](function(_0x3eed03){var _0x5745e9=_0x287eee[_0xbf22('0x52')][_0xbf22('0x2a')]({'plain':!![]});if(!_0x5745e9)throw new Error(_0xbf22('0x53'));if(_0x5745e9[_0xbf22('0x54')]===_0xbf22('0x52')){var _0x4daf4b=_0x3eed03[_0xbf22('0x2a')]({'plain':!![]});var _0x2f1747='CustomDashboards';return db[_0xbf22('0x55')][_0xbf22('0x4f')]({'where':{'name':_0x2f1747,'userProfileId':_0x5745e9[_0xbf22('0x56')]},'raw':!![]})[_0xbf22('0x28')](function(_0x43437d){if(_0x43437d&&_0x43437d[_0xbf22('0x57')]===0x0){return db[_0xbf22('0x58')]['create']({'name':_0x4daf4b[_0xbf22('0x2f')],'resourceId':_0x4daf4b['id'],'type':_0x43437d['name'],'sectionId':_0x43437d['id']},{})[_0xbf22('0x28')](function(){return _0x3eed03;});}else{return _0x3eed03;}})[_0xbf22('0x59')](function(_0x200ccf){logger[_0xbf22('0x2d')](_0xbf22('0x5a'),_0x200ccf);throw _0x200ccf;});}return _0x3eed03;})[_0xbf22('0x28')](respondWithResult(_0x450f9d,0xc9))[_0xbf22('0x59')](handleError(_0x450f9d,null));};exports[_0xbf22('0x5b')]=function(_0x2ef047,_0x2ff76b){var _0x2d984c={'where':{'id':_0x2ef047[_0xbf22('0x4d')]['id']}},_0x3bf884={};_0x3bf884['model']=_[_0xbf22('0x39')](db['Dashboard'][_0xbf22('0x4e')]);_0x2d984c[_0xbf22('0x3b')]=_[_0xbf22('0x3a')](_0x3bf884[_0xbf22('0x37')],qs[_0xbf22('0x3c')](_0x2ef047['query'][_0xbf22('0x3c')]));_0x2d984c[_0xbf22('0x3b')]=_0x2d984c[_0xbf22('0x3b')][_0xbf22('0x3d')]?_0x2d984c[_0xbf22('0x3b')]:_0x3bf884[_0xbf22('0x37')];if(_0x2ef047[_0xbf22('0x38')][_0xbf22('0x48')]){_0x2d984c[_0xbf22('0x49')]=[{'all':!![]}];}_0x2d984c=_[_0xbf22('0x46')]({},_0x2d984c,_0x2ef047[_0xbf22('0x47')]);return db[_0xbf22('0x33')][_0xbf22('0x4f')](_0x2d984c)[_0xbf22('0x28')](handleEntityNotFound(_0x2ff76b,null))[_0xbf22('0x28')](function(_0x140919){if(_0x140919){var _0x3dbcd6=_0x140919[_0xbf22('0x2a')]({'plain':!![]});_0x3dbcd6=qs['omit'](_0x3dbcd6,['id',_0xbf22('0x5c'),'updatedAt']);_0x2ef047[_0xbf22('0x51')]=_['omit'](_0x2ef047['body'],['id',_0xbf22('0x5c'),_0xbf22('0x5d')]);return db[_0xbf22('0x33')][_0xbf22('0x50')](_[_0xbf22('0x46')](_0x3dbcd6,_0x2ef047[_0xbf22('0x51')]),{'include':_0x2ef047[_0xbf22('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0xbf22('0x28')](function(_0x4d48f3){var _0x22c39e=_0x2ef047[_0xbf22('0x52')][_0xbf22('0x2a')]({'plain':!![]});if(!_0x22c39e)throw new Error(_0xbf22('0x53'));if(_0x22c39e[_0xbf22('0x54')]==='user'){var _0x474820=_0x4d48f3['get']({'plain':!![]});var _0x4fe973=_0xbf22('0x2b');return db[_0xbf22('0x55')]['find']({'where':{'name':_0x4fe973,'userProfileId':_0x22c39e[_0xbf22('0x56')]},'raw':!![]})[_0xbf22('0x28')](function(_0x8352dd){if(_0x8352dd&&_0x8352dd[_0xbf22('0x57')]===0x0){return db['UserProfileResource'][_0xbf22('0x50')]({'name':_0x474820['name'],'resourceId':_0x474820['id'],'type':_0x8352dd['name'],'sectionId':_0x8352dd['id']},{})[_0xbf22('0x28')](function(){return _0x4d48f3;});}else{return _0x4d48f3;}})[_0xbf22('0x59')](function(_0x568b5b){logger[_0xbf22('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x568b5b);throw _0x568b5b;});}return _0x4d48f3;});}})[_0xbf22('0x28')](respondWithResult(_0x2ff76b,0xc9))[_0xbf22('0x59')](handleError(_0x2ff76b,null));};exports[_0xbf22('0x27')]=function(_0x3c68d9,_0x402435){if(_0x3c68d9['body']['id']){delete _0x3c68d9[_0xbf22('0x51')]['id'];}return db['Dashboard'][_0xbf22('0x4f')]({'where':{'id':_0x3c68d9['params']['id']}})['then'](handleEntityNotFound(_0x402435,null))[_0xbf22('0x28')](saveUpdates(_0x3c68d9['body'],null))[_0xbf22('0x28')](respondWithResult(_0x402435,null))[_0xbf22('0x59')](handleError(_0x402435,null));};exports['destroy']=function(_0x54b02c,_0x3218ff){return db[_0xbf22('0x33')]['find']({'where':{'id':_0x54b02c[_0xbf22('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3218ff,null))[_0xbf22('0x28')](removeEntity(_0x3218ff,null))[_0xbf22('0x59')](handleError(_0x3218ff,null));};function widgetAttributes(_0x19786e){try{switch(_0x19786e[_0xbf22('0x35')]){case'iframe':return[{'name':_0xbf22('0x5e'),'value':_0x19786e[_0xbf22('0x5e')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x0]?_0x19786e[_0xbf22('0x5f')][0x0][_0xbf22('0x60')]:undefined)||_0xbf22('0x61')}];case _0xbf22('0x62'):return[{'name':_0xbf22('0x63'),'value':_0x19786e['attrPath']||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e['attrs'][0x0]?_0x19786e[_0xbf22('0x5f')][0x0][_0xbf22('0x60')]:undefined)||''}];case _0xbf22('0x64'):return[{'name':_0xbf22('0x65'),'value':_0x19786e[_0xbf22('0x65')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x0]?_0x19786e['attrs'][0x0][_0xbf22('0x60')]:undefined)||'HH:mm:ss'},{'name':_0xbf22('0x66'),'value':_0x19786e[_0xbf22('0x66')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e['attrs'][0x1]?_0x19786e[_0xbf22('0x5f')][0x1][_0xbf22('0x60')]:undefined)||'0.00'},{'name':_0xbf22('0x67'),'value':_0x19786e[_0xbf22('0x67')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e['attrs'][0x2]?_0x19786e[_0xbf22('0x5f')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xbf22('0x68'),'value':_0x19786e['attrMetric']||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x0]?_0x19786e['attrs'][0x0]['value']:undefined)||'total'},{'name':_0xbf22('0x69'),'value':_0x19786e['attrVoiceQueues']||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x1]?_0x19786e[_0xbf22('0x5f')][0x1][_0xbf22('0x60')]:undefined)||[]},{'name':_0xbf22('0x67'),'value':_0x19786e[_0xbf22('0x67')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x2]?_0x19786e['attrs'][0x2][_0xbf22('0x60')]:undefined)||0x14}];case'multibar-chart':case _0xbf22('0x6a'):return[{'name':_0xbf22('0x6b'),'value':_0x19786e['attrSerie1']||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x0]?_0x19786e[_0xbf22('0x5f')][0x0][_0xbf22('0x60')]:undefined)||_0xbf22('0x6c')},{'name':_0xbf22('0x6d'),'value':_0x19786e[_0xbf22('0x6d')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x1]?_0x19786e[_0xbf22('0x5f')][0x1][_0xbf22('0x60')]:undefined)||null},{'name':_0xbf22('0x6e'),'value':_0x19786e[_0xbf22('0x6e')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x2]?_0x19786e[_0xbf22('0x5f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x19786e[_0xbf22('0x69')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e['attrs'][0x3]?_0x19786e[_0xbf22('0x5f')][0x3][_0xbf22('0x60')]:undefined)||[]}];case'web-report':return[{'name':_0xbf22('0x6f'),'type':_0x19786e[_0xbf22('0x70')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x0]?_0x19786e[_0xbf22('0x5f')][0x0]['type']:undefined)||null,'value':_0x19786e[_0xbf22('0x6f')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x0]?_0x19786e[_0xbf22('0x5f')][0x0][_0xbf22('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x19786e[_0xbf22('0x71')]||(_0x19786e[_0xbf22('0x5f')]&&_0x19786e[_0xbf22('0x5f')][0x1]?_0x19786e['attrs'][0x1][_0xbf22('0x60')]:undefined)||0x0}];default:return[];}}catch(_0xd41191){logger['error'](_0xbf22('0x72'),JSON[_0xbf22('0x73')](_0xd41191));return[];}}exports[_0xbf22('0x74')]=function(_0x532b6f,_0x5ccaf1,_0x43a4c6){if(_0x532b6f[_0xbf22('0x51')]['id']){delete _0x532b6f[_0xbf22('0x51')]['id'];}return db[_0xbf22('0x33')]['find']({'where':{'id':_0x532b6f['params']['id']}})[_0xbf22('0x28')](handleEntityNotFound(_0x5ccaf1,null))[_0xbf22('0x28')](function(_0x49d049){if(_0x49d049){_0x532b6f['body'][_0xbf22('0x75')]=_0x49d049['id'];_0x532b6f[_0xbf22('0x51')][_0xbf22('0x5f')]=widgetAttributes(_0x532b6f[_0xbf22('0x51')]);return db[_0xbf22('0x76')][_0xbf22('0x50')](_0x532b6f[_0xbf22('0x51')]);}})[_0xbf22('0x28')](respondWithResult(_0x5ccaf1,null))[_0xbf22('0x59')](handleError(_0x5ccaf1,null));};exports[_0xbf22('0x77')]=function(_0x38ff94,_0x3ad971,_0x5917d7){var _0x59b3b0={};var _0x6ec319={};var _0xf1f2d5;var _0x5ea0dc;return db[_0xbf22('0x33')][_0xbf22('0x78')]({'where':{'id':_0x38ff94[_0xbf22('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ad971,null))['then'](function(_0x1f7e1d){if(_0x1f7e1d){_0xf1f2d5=_0x1f7e1d;_0x6ec319[_0xbf22('0x37')]=_['keys'](db[_0xbf22('0x76')][_0xbf22('0x4e')]);_0x6ec319[_0xbf22('0x38')]=_[_0xbf22('0x39')](_0x38ff94[_0xbf22('0x38')]);_0x6ec319[_0xbf22('0x43')]=_[_0xbf22('0x3a')](_0x6ec319[_0xbf22('0x37')],_0x6ec319[_0xbf22('0x38')]);_0x59b3b0[_0xbf22('0x3b')]=_[_0xbf22('0x3a')](_0x6ec319['model'],qs['fields'](_0x38ff94[_0xbf22('0x38')][_0xbf22('0x3c')]));_0x59b3b0[_0xbf22('0x3b')]=_0x59b3b0[_0xbf22('0x3b')][_0xbf22('0x3d')]?_0x59b3b0[_0xbf22('0x3b')]:_0x6ec319[_0xbf22('0x37')];_0x59b3b0['order']=qs[_0xbf22('0x41')](_0x38ff94[_0xbf22('0x38')][_0xbf22('0x41')]);_0x59b3b0[_0xbf22('0x42')]=qs[_0xbf22('0x43')](_[_0xbf22('0x44')](_0x38ff94[_0xbf22('0x38')],_0x6ec319[_0xbf22('0x43')]));if(_0x38ff94[_0xbf22('0x38')][_0xbf22('0x45')]){_0x59b3b0[_0xbf22('0x42')]=_[_0xbf22('0x46')](_0x59b3b0[_0xbf22('0x42')],{'$or':_[_0xbf22('0x32')](_0x59b3b0[_0xbf22('0x3b')],function(_0x3556eb){var _0x88f22a={};_0x88f22a[_0x3556eb]={'$like':'%'+_0x38ff94['query'][_0xbf22('0x45')]+'%'};return _0x88f22a;})});}_0x59b3b0=_[_0xbf22('0x46')]({},_0x59b3b0,_0x38ff94['options']);return _0xf1f2d5[_0xbf22('0x77')](_0x59b3b0);}})[_0xbf22('0x28')](function(_0x28f01a){if(_0x28f01a){_0x5ea0dc=_0x28f01a['length'];if(!_0x38ff94['query']['hasOwnProperty'](_0xbf22('0x3f'))){_0x59b3b0['limit']=qs[_0xbf22('0x21')](_0x38ff94[_0xbf22('0x38')][_0xbf22('0x21')]);_0x59b3b0[_0xbf22('0x1f')]=qs[_0xbf22('0x1f')](_0x38ff94[_0xbf22('0x38')][_0xbf22('0x1f')]);}return _0xf1f2d5[_0xbf22('0x77')](_0x59b3b0);}})['then'](function(_0x52bc1c){if(_0x52bc1c){return _0x52bc1c?{'count':_0x5ea0dc,'rows':_0x52bc1c}:null;}})[_0xbf22('0x28')](respondWithResult(_0x3ad971,null))['catch'](handleError(_0x3ad971,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4e6f895..22c3e44 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 _0x806b=['update','remove','emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x1c4ca6,_0x39c3af){var _0x5a9283=function(_0x4aa612){while(--_0x4aa612){_0x1c4ca6['push'](_0x1c4ca6['shift']());}};_0x5a9283(++_0x39c3af);}(_0x806b,0x163));var _0xb806=function(_0xd95dd6,_0x5a9ed4){_0xd95dd6=_0xd95dd6-0x0;var _0x449b4f=_0x806b[_0xd95dd6];return _0x449b4f;};'use strict';var EventEmitter=require(_0xb806('0x0'));var Dashboard=require(_0xb806('0x1'))['db'][_0xb806('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb806('0x3')](0x0);var events={'afterCreate':_0xb806('0x4'),'afterUpdate':_0xb806('0x5'),'afterDestroy':_0xb806('0x6')};function emitEvent(_0x2cbd26){return function(_0x595117,_0x32c93c,_0x2ddaa3){DashboardEvents[_0xb806('0x7')](_0x2cbd26+':'+_0x595117['id'],_0x595117);DashboardEvents[_0xb806('0x7')](_0x2cbd26,_0x595117);_0x2ddaa3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb806('0x8')](e,emitEvent(event));}}module[_0xb806('0x9')]=DashboardEvents; \ No newline at end of file +var _0xa3db=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x406e73,_0x3a3f65){var _0x5ca6f2=function(_0x34b2b3){while(--_0x34b2b3){_0x406e73['push'](_0x406e73['shift']());}};_0x5ca6f2(++_0x3a3f65);}(_0xa3db,0x183));var _0xba3d=function(_0x1da92a,_0x4764df){_0x1da92a=_0x1da92a-0x0;var _0x28cfd9=_0xa3db[_0x1da92a];return _0x28cfd9;};'use strict';var EventEmitter=require(_0xba3d('0x0'));var Dashboard=require(_0xba3d('0x1'))['db'][_0xba3d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xba3d('0x3')](0x0);var events={'afterCreate':_0xba3d('0x4'),'afterUpdate':_0xba3d('0x5'),'afterDestroy':_0xba3d('0x6')};function emitEvent(_0x5999f7){return function(_0x272a97,_0x435821,_0x14488b){DashboardEvents['emit'](_0x5999f7+':'+_0x272a97['id'],_0x272a97);DashboardEvents[_0xba3d('0x7')](_0x5999f7,_0x272a97);_0x14488b(null);};}for(var e in events){if(events[_0xba3d('0x8')](e)){var event=events[e];Dashboard[_0xba3d('0x9')](e,emitEvent(event));}}module[_0xba3d('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 3a7152a..3af30b0 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 _0x6c5a=['exports','define','dashboards','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3ee1df,_0x5811db){var _0x1b0a59=function(_0x2db1d3){while(--_0x2db1d3){_0x3ee1df['push'](_0x3ee1df['shift']());}};_0x1b0a59(++_0x5811db);}(_0x6c5a,0x14d));var _0xa6c5=function(_0xa91a69,_0xe7b0eb){_0xa91a69=_0xa91a69-0x0;var _0x5244fe=_0x6c5a[_0xa91a69];return _0x5244fe;};'use strict';var _=require(_0xa6c5('0x0'));var util=require('util');var logger=require(_0xa6c5('0x1'))(_0xa6c5('0x2'));var moment=require(_0xa6c5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa6c5('0x4'));var fs=require('fs');var path=require(_0xa6c5('0x5'));var rimraf=require('rimraf');var config=require(_0xa6c5('0x6'));var attributes=require('./dashboard.attributes');module[_0xa6c5('0x7')]=function(_0x4de07f,_0x54f1a5){return _0x4de07f[_0xa6c5('0x8')]('Dashboard',attributes,{'tableName':_0xa6c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7dc=['request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','util','api','moment','bluebird'];(function(_0xc1787a,_0x567d50){var _0x3c175c=function(_0x1cfdec){while(--_0x1cfdec){_0xc1787a['push'](_0xc1787a['shift']());}};_0x3c175c(++_0x567d50);}(_0xf7dc,0x194));var _0xcf7d=function(_0x198551,_0xf36ad7){_0x198551=_0x198551-0x0;var _0xb0a394=_0xf7dc[_0x198551];return _0xb0a394;};'use strict';var _=require('lodash');var util=require(_0xcf7d('0x0'));var logger=require('../../config/logger')(_0xcf7d('0x1'));var moment=require(_0xcf7d('0x2'));var BPromise=require(_0xcf7d('0x3'));var rp=require(_0xcf7d('0x4'));var fs=require('fs');var path=require(_0xcf7d('0x5'));var rimraf=require(_0xcf7d('0x6'));var config=require(_0xcf7d('0x7'));var attributes=require(_0xcf7d('0x8'));module[_0xcf7d('0x9')]=function(_0x193629,_0x20e7e2){return _0x193629[_0xcf7d('0xa')](_0xcf7d('0xb'),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 2e36fb4..e4511c8 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 _0x46f7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x4ab863,_0x505ae8){var _0x8cee80=function(_0x441ab1){while(--_0x441ab1){_0x4ab863['push'](_0x4ab863['shift']());}};_0x8cee80(++_0x505ae8);}(_0x46f7,0x86));var _0x746f=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x46f7[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x746f('0x0'));var util=require('util');var moment=require(_0x746f('0x1'));var BPromise=require(_0x746f('0x2'));var rs=require(_0x746f('0x3'));var fs=require('fs');var Redis=require(_0x746f('0x4'));var db=require(_0x746f('0x5'))['db'];var utils=require(_0x746f('0x6'));var logger=require(_0x746f('0x7'))(_0x746f('0x8'));var config=require(_0x746f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x746f('0xa')][_0x746f('0xb')]({'port':0x232a});config[_0x746f('0xc')]=_['defaults'](config[_0x746f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x746f('0xc')]));require(_0x746f('0xd'))[_0x746f('0xe')](socket);function respondWithRpcPromise(_0x2613f9,_0x4e4ea6,_0xe3b2cc){return new BPromise(function(_0x152e6e,_0x313926){return client[_0x746f('0xf')](_0x2613f9,_0xe3b2cc)[_0x746f('0x10')](function(_0x1476f2){logger[_0x746f('0x11')](_0x746f('0x12'),_0x4e4ea6,_0x746f('0x13'));logger[_0x746f('0x14')](_0x746f('0x15'),_0x4e4ea6,_0x746f('0x13'),JSON[_0x746f('0x16')](_0x1476f2));if(_0x1476f2[_0x746f('0x17')]){if(_0x1476f2[_0x746f('0x17')][_0x746f('0x18')]===0x1f4){logger['error'](_0x746f('0x12'),_0x4e4ea6,_0x1476f2[_0x746f('0x17')]['message']);return _0x313926(_0x1476f2['error']['message']);}logger[_0x746f('0x17')](_0x746f('0x12'),_0x4e4ea6,_0x1476f2['error'][_0x746f('0x19')]);return _0x152e6e(_0x1476f2[_0x746f('0x17')][_0x746f('0x19')]);}else{logger[_0x746f('0x11')]('Dashboard,\x20%s,\x20%s',_0x4e4ea6,_0x746f('0x13'));_0x152e6e(_0x1476f2['result']['message']);}})[_0x746f('0x1a')](function(_0x3f8b41){logger['error'](_0x746f('0x12'),_0x4e4ea6,_0x3f8b41);_0x313926(_0x3f8b41);});});} \ No newline at end of file +var _0xe953=['info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','Dashboard,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe953,0xc9));var _0x3e95=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xe953[_0x47242d];return _0x30273a;};'use strict';var _=require(_0x3e95('0x0'));var util=require(_0x3e95('0x1'));var moment=require('moment');var BPromise=require(_0x3e95('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e95('0x3'));var db=require(_0x3e95('0x4'))['db'];var utils=require(_0x3e95('0x5'));var logger=require('../../config/logger')(_0x3e95('0x6'));var config=require(_0x3e95('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e95('0x8')]({'port':0x232a});config[_0x3e95('0x9')]=_[_0x3e95('0xa')](config['redis'],{'host':_0x3e95('0xb'),'port':0x18eb});var socket=require(_0x3e95('0xc'))(new Redis(config[_0x3e95('0x9')]));require('./dashboard.socket')[_0x3e95('0xd')](socket);function respondWithRpcPromise(_0x5ec90b,_0x29914a,_0x385302){return new BPromise(function(_0x26f46f,_0x222f5b){return client[_0x3e95('0xe')](_0x5ec90b,_0x385302)['then'](function(_0xbde32f){logger[_0x3e95('0xf')]('Dashboard,\x20%s,\x20%s',_0x29914a,_0x3e95('0x10'));logger[_0x3e95('0x11')](_0x3e95('0x12'),_0x29914a,_0x3e95('0x10'),JSON[_0x3e95('0x13')](_0xbde32f));if(_0xbde32f['error']){if(_0xbde32f['error']['code']===0x1f4){logger['error'](_0x3e95('0x14'),_0x29914a,_0xbde32f[_0x3e95('0x15')][_0x3e95('0x16')]);return _0x222f5b(_0xbde32f['error'][_0x3e95('0x16')]);}logger[_0x3e95('0x15')]('Dashboard,\x20%s,\x20%s',_0x29914a,_0xbde32f[_0x3e95('0x15')][_0x3e95('0x16')]);return _0x26f46f(_0xbde32f[_0x3e95('0x15')][_0x3e95('0x16')]);}else{logger[_0x3e95('0xf')](_0x3e95('0x14'),_0x29914a,_0x3e95('0x10'));_0x26f46f(_0xbde32f[_0x3e95('0x17')][_0x3e95('0x16')]);}})['catch'](function(_0x1b389e){logger[_0x3e95('0x15')]('Dashboard,\x20%s,\x20%s',_0x29914a,_0x1b389e);_0x222f5b(_0x1b389e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index f11a567..1132ae6 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 _0xa503=['save','remove','update','removeListener','register','length','dashboard:'];(function(_0x1e9816,_0x11bef5){var _0x41e572=function(_0x1928b2){while(--_0x1928b2){_0x1e9816['push'](_0x1e9816['shift']());}};_0x41e572(++_0x11bef5);}(_0xa503,0xaf));var _0x3a50=function(_0x3bdd8d,_0x35219c){_0x3bdd8d=_0x3bdd8d-0x0;var _0x5e66bb=_0xa503[_0x3bdd8d];return _0x5e66bb;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x3a50('0x0'),_0x3a50('0x1'),_0x3a50('0x2')];function createListener(_0x424be8,_0x44009d){return function(_0x4ef8d1){_0x44009d['emit'](_0x424be8,_0x4ef8d1);};}function removeListener(_0x10c90b,_0x17c355){return function(){DashboardEvents[_0x3a50('0x3')](_0x10c90b,_0x17c355);};}exports[_0x3a50('0x4')]=function(_0x36a45e){for(var _0x1e7875=0x0,_0x38835a=events[_0x3a50('0x5')];_0x1e7875<_0x38835a;_0x1e7875++){var _0x903ed5=events[_0x1e7875];var _0x4d1b2d=createListener(_0x3a50('0x6')+_0x903ed5,_0x36a45e);DashboardEvents['on'](_0x903ed5,_0x4d1b2d);}}; \ No newline at end of file +var _0x9f19=['./dashboard.events','save','remove','update','emit','removeListener','register','dashboard:'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9f19,0x170));var _0x99f1=function(_0x259c12,_0x1d8a2f){_0x259c12=_0x259c12-0x0;var _0x46e0f4=_0x9f19[_0x259c12];return _0x46e0f4;};'use strict';var DashboardEvents=require(_0x99f1('0x0'));var events=[_0x99f1('0x1'),_0x99f1('0x2'),_0x99f1('0x3')];function createListener(_0x5ef813,_0x404c3b){return function(_0x28d988){_0x404c3b[_0x99f1('0x4')](_0x5ef813,_0x28d988);};}function removeListener(_0x580b2e,_0x54453a){return function(){DashboardEvents[_0x99f1('0x5')](_0x580b2e,_0x54453a);};}exports[_0x99f1('0x6')]=function(_0x5d5c76){for(var _0x5079f7=0x0,_0x4dcf84=events['length'];_0x5079f7<_0x4dcf84;_0x5079f7++){var _0x2bdfa5=events[_0x5079f7];var _0x1dc214=createListener(_0x99f1('0x7')+_0x2bdfa5,_0x5d5c76);DashboardEvents['on'](_0x2bdfa5,_0x1dc214);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 80714b2..9f623ce 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 _0xd084=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','delete'];(function(_0x107f31,_0x526eaf){var _0x1eb4c5=function(_0x3b1bfd){while(--_0x3b1bfd){_0x107f31['push'](_0x107f31['shift']());}};_0x1eb4c5(++_0x526eaf);}(_0xd084,0xa8));var _0x4d08=function(_0x9ed899,_0x91fcc1){_0x9ed899=_0x9ed899-0x0;var _0x34f515=_0xd084[_0x9ed899];return _0x34f515;};'use strict';var multer=require('multer');var util=require(_0x4d08('0x0'));var path=require(_0x4d08('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d08('0x2'));var router=express[_0x4d08('0x3')]();var fs_extra=require(_0x4d08('0x4'));var auth=require(_0x4d08('0x5'));var interaction=require(_0x4d08('0x6'));var config=require(_0x4d08('0x7'));var controller=require(_0x4d08('0x8'));router[_0x4d08('0x9')]('/',auth[_0x4d08('0xa')](),controller['index']);router[_0x4d08('0x9')](_0x4d08('0xb'),auth[_0x4d08('0xa')](),controller[_0x4d08('0xc')]);router[_0x4d08('0x9')](_0x4d08('0xd'),auth[_0x4d08('0xa')](),controller[_0x4d08('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4d08('0xf')]);router[_0x4d08('0x10')](_0x4d08('0x11'),auth[_0x4d08('0xa')](),controller['clone']);router[_0x4d08('0x10')](_0x4d08('0xd'),auth['isAuthenticated'](),controller[_0x4d08('0x12')]);router[_0x4d08('0x13')](_0x4d08('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4d08('0x14')](_0x4d08('0xb'),auth[_0x4d08('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0453=['put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','show','/:id/items','create','post','/:id/clone','clone','addItem'];(function(_0x14e393,_0x5ef7b3){var _0x5b5ffa=function(_0x133c89){while(--_0x133c89){_0x14e393['push'](_0x14e393['shift']());}};_0x5b5ffa(++_0x5ef7b3);}(_0x0453,0x12f));var _0x3045=function(_0x1565fd,_0x5f662f){_0x1565fd=_0x1565fd-0x0;var _0x2589d4=_0x0453[_0x1565fd];return _0x2589d4;};'use strict';var multer=require(_0x3045('0x0'));var util=require(_0x3045('0x1'));var path=require(_0x3045('0x2'));var timeout=require(_0x3045('0x3'));var express=require(_0x3045('0x4'));var router=express[_0x3045('0x5')]();var fs_extra=require(_0x3045('0x6'));var auth=require(_0x3045('0x7'));var interaction=require(_0x3045('0x8'));var config=require(_0x3045('0x9'));var controller=require(_0x3045('0xa'));router['get']('/',auth[_0x3045('0xb')](),controller[_0x3045('0xc')]);router[_0x3045('0xd')](_0x3045('0xe'),auth[_0x3045('0xb')](),controller[_0x3045('0xf')]);router[_0x3045('0xd')](_0x3045('0x10'),auth[_0x3045('0xb')](),controller['getItems']);router['post']('/',auth[_0x3045('0xb')](),controller[_0x3045('0x11')]);router[_0x3045('0x12')](_0x3045('0x13'),auth[_0x3045('0xb')](),controller[_0x3045('0x14')]);router['post'](_0x3045('0x10'),auth[_0x3045('0xb')](),controller[_0x3045('0x15')]);router[_0x3045('0x16')](_0x3045('0xe'),auth[_0x3045('0xb')](),controller['update']);router[_0x3045('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3045('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 1d9294f..f83b3e5 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 _0x4975=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','long'];(function(_0x2ad0ca,_0x59624e){var _0x50ebb9=function(_0x5bd78d){while(--_0x5bd78d){_0x2ad0ca['push'](_0x2ad0ca['shift']());}};_0x50ebb9(++_0x59624e);}(_0x4975,0x86));var _0x5497=function(_0x1fd4b6,_0x56df2f){_0x1fd4b6=_0x1fd4b6-0x0;var _0x3a0be8=_0x4975[_0x1fd4b6];return _0x3a0be8;};'use strict';var Sequelize=require(_0x5497('0x0'));var squel=require('squel');var _=require(_0x5497('0x1'));module[_0x5497('0x2')]={'title':{'type':Sequelize[_0x5497('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5497('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5497('0x4')](_0x5497('0x5')),'get':function(){try{return JSON[_0x5497('0x6')](this[_0x5497('0x7')](_0x5497('0x8')));}catch(_0x5d5272){return[];}},'set':function(_0x539a27){try{this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')](_0x539a27));}catch(_0x674a2a){this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5497('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5497('0xb')]},'col':{'type':Sequelize[_0x5497('0xb')]},'background':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5497('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x7a54=['lodash','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x491518,_0x1bbe01){_0x491518=_0x491518-0x0;var _0x1bde0f=_0x7a54[_0x491518];return _0x1bde0f;};'use strict';var Sequelize=require(_0x47a5('0x0'));var squel=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));module['exports']={'title':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x47a5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x47a5('0x4')),'get':function(){try{return JSON[_0x47a5('0x5')](this[_0x47a5('0x6')](_0x47a5('0x7')));}catch(_0xfdf934){return[];}},'set':function(_0x545a97){try{this[_0x47a5('0x8')]('attrs',JSON[_0x47a5('0x9')](_0x545a97));}catch(_0x30e405){this['setDataValue'](_0x47a5('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x47a5('0xa')]},'col':{'type':Sequelize[_0x47a5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47a5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x47a5('0x3')]},'titleFontSize':{'type':Sequelize[_0x47a5('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index dfe8ab5..19c559e 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 _0x7064=['attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','update','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','model','DashboardItem','rawAttributes','query','keys','intersection','fields','attributes','includeAll','include','options','find','params','catch','type','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart'];(function(_0xf46205,_0x3227c6){var _0x1fa92f=function(_0x1cb4b6){while(--_0x1cb4b6){_0xf46205['push'](_0xf46205['shift']());}};_0x1fa92f(++_0x3227c6);}(_0x7064,0xc3));var _0x4706=function(_0x417b08,_0x509528){_0x417b08=_0x417b08-0x0;var _0x4d2713=_0x7064[_0x417b08];return _0x4d2713;};'use strict';var emlformat=require(_0x4706('0x0'));var rimraf=require(_0x4706('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4706('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4706('0x3'));var util=require(_0x4706('0x4'));var path=require(_0x4706('0x5'));var sox=require(_0x4706('0x6'));var csv=require(_0x4706('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4706('0x8'));var _=require('lodash');var squel=require(_0x4706('0x9'));var crypto=require(_0x4706('0xa'));var jsforce=require(_0x4706('0xb'));var deskjs=require(_0x4706('0xc'));var toCsv=require(_0x4706('0x7'));var querystring=require(_0x4706('0xd'));var Papa=require('papaparse');var Redis=require(_0x4706('0xe'));var authService=require(_0x4706('0xf'));var qs=require(_0x4706('0x10'));var as=require(_0x4706('0x11'));var hardwareService=require(_0x4706('0x12'));var logger=require(_0x4706('0x13'))(_0x4706('0x14'));var utils=require(_0x4706('0x15'));var config=require(_0x4706('0x16'));var licenseUtil=require(_0x4706('0x17'));var db=require(_0x4706('0x18'))['db'];config[_0x4706('0x19')]=_['defaults'](config[_0x4706('0x19')],{'host':_0x4706('0x1a'),'port':0x18eb});var socket=require(_0x4706('0x1b'))(new Redis(config['redis']));require(_0x4706('0x1c'))[_0x4706('0x1d')](socket);function respondWithStatusCode(_0x413f8f,_0x310c1a){_0x310c1a=_0x310c1a||0xcc;return function(_0x14ebc1){if(_0x14ebc1){return _0x413f8f[_0x4706('0x1e')](_0x310c1a);}return _0x413f8f[_0x4706('0x1f')](_0x310c1a)[_0x4706('0x20')]();};}function respondWithResult(_0x346579,_0x17e3d5){_0x17e3d5=_0x17e3d5||0xc8;return function(_0x2729ef){if(_0x2729ef){return _0x346579[_0x4706('0x1f')](_0x17e3d5)[_0x4706('0x21')](_0x2729ef);}};}function respondWithFilteredResult(_0x1d717e,_0x567e1f){return function(_0x156a9e){if(_0x156a9e){var _0x8267e7=typeof _0x567e1f[_0x4706('0x22')]===_0x4706('0x23')&&typeof _0x567e1f['limit']===_0x4706('0x23');var _0x206e90=_0x156a9e[_0x4706('0x24')];var _0x29942c=_0x8267e7?0x0:_0x567e1f[_0x4706('0x22')];var _0x1f7c2c=_0x8267e7?_0x156a9e[_0x4706('0x24')]:_0x567e1f[_0x4706('0x22')]+_0x567e1f[_0x4706('0x25')];var _0x46865f;if(_0x1f7c2c>=_0x206e90){_0x1f7c2c=_0x206e90;_0x46865f=0xc8;}else{_0x46865f=0xce;}_0x1d717e[_0x4706('0x1f')](_0x46865f);return _0x1d717e[_0x4706('0x26')](_0x4706('0x27'),_0x29942c+'-'+_0x1f7c2c+'/'+_0x206e90)['json'](_0x156a9e);}return null;};}function patchUpdates(_0x21e621){return function(_0x392561){try{jsonpatch[_0x4706('0x28')](_0x392561,_0x21e621,!![]);}catch(_0x39ffbe){return BPromise['reject'](_0x39ffbe);}return _0x392561[_0x4706('0x29')]();};}function saveUpdates(_0x38e3b9,_0x209ad2){return function(_0x24fd4d){if(_0x24fd4d){return _0x24fd4d['update'](_0x38e3b9)[_0x4706('0x2a')](function(_0xb97d0a){return _0xb97d0a;});}return null;};}function removeEntity(_0x178837,_0x4c42fa){return function(_0x200fed){if(_0x200fed){return _0x200fed[_0x4706('0x2b')]()['then'](function(){_0x178837[_0x4706('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1beff1,_0x1ccefb){return function(_0x108c8a){if(!_0x108c8a){_0x1beff1['sendStatus'](0x194);}return _0x108c8a;};}function handleError(_0x22c93e,_0x433d78){_0x433d78=_0x433d78||0x1f4;return function(_0x516d5e){logger['error'](_0x516d5e[_0x4706('0x2c')]);if(_0x516d5e['name']){delete _0x516d5e[_0x4706('0x2d')];}_0x22c93e[_0x4706('0x1f')](_0x433d78)[_0x4706('0x2e')](_0x516d5e);};}exports['show']=function(_0x1cb4a0,_0xba7a82){var _0x472468={'raw':![],'where':{'id':_0x1cb4a0['params']['id']}},_0x5b498e={};_0x5b498e[_0x4706('0x2f')]=_['keys'](db[_0x4706('0x30')][_0x4706('0x31')]);_0x5b498e[_0x4706('0x32')]=_[_0x4706('0x33')](_0x1cb4a0[_0x4706('0x32')]);_0x5b498e['filters']=_['intersection'](_0x5b498e['model'],_0x5b498e[_0x4706('0x32')]);_0x472468['attributes']=_[_0x4706('0x34')](_0x5b498e[_0x4706('0x2f')],qs[_0x4706('0x35')](_0x1cb4a0['query'][_0x4706('0x35')]));_0x472468['attributes']=_0x472468[_0x4706('0x36')]['length']?_0x472468[_0x4706('0x36')]:_0x5b498e['model'];if(_0x1cb4a0[_0x4706('0x32')][_0x4706('0x37')]){_0x472468[_0x4706('0x38')]=[{'all':!![]}];}_0x472468=_['merge']({},_0x472468,_0x1cb4a0[_0x4706('0x39')]);return db['DashboardItem'][_0x4706('0x3a')](_0x472468)[_0x4706('0x2a')](handleEntityNotFound(_0xba7a82,null))[_0x4706('0x2a')](respondWithResult(_0xba7a82,null))['catch'](handleError(_0xba7a82,null));};exports[_0x4706('0x2b')]=function(_0x53222b,_0x47e638){return db['DashboardItem'][_0x4706('0x3a')]({'where':{'id':_0x53222b[_0x4706('0x3b')]['id']}})[_0x4706('0x2a')](handleEntityNotFound(_0x47e638,null))[_0x4706('0x2a')](removeEntity(_0x47e638,null))[_0x4706('0x3c')](handleError(_0x47e638,null));};function widgetAttributes(_0x3ed9d8){try{switch(_0x3ed9d8[_0x4706('0x3d')]){case _0x4706('0x3e'):return[{'name':_0x4706('0x3f'),'value':_0x3ed9d8[_0x4706('0x3f')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x0]?_0x3ed9d8[_0x4706('0x40')][0x0]['value']:undefined)||'https://'}];case _0x4706('0x41'):return[{'name':'attrPath','value':_0x3ed9d8[_0x4706('0x42')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x0]?_0x3ed9d8['attrs'][0x0][_0x4706('0x43')]:undefined)||''}];case _0x4706('0x44'):return[{'name':_0x4706('0x45'),'value':_0x3ed9d8[_0x4706('0x45')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x0]?_0x3ed9d8[_0x4706('0x40')][0x0]['value']:undefined)||_0x4706('0x46')},{'name':_0x4706('0x47'),'value':_0x3ed9d8[_0x4706('0x47')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x1]?_0x3ed9d8['attrs'][0x1][_0x4706('0x43')]:undefined)||_0x4706('0x48')},{'name':_0x4706('0x49'),'value':_0x3ed9d8[_0x4706('0x49')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x2]?_0x3ed9d8[_0x4706('0x40')][0x2][_0x4706('0x43')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x3ed9d8[_0x4706('0x4a')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x0]?_0x3ed9d8[_0x4706('0x40')][0x0][_0x4706('0x43')]:undefined)||'total'},{'name':_0x4706('0x4b'),'value':_0x3ed9d8[_0x4706('0x4b')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x1]?_0x3ed9d8[_0x4706('0x40')][0x1][_0x4706('0x43')]:undefined)||[]},{'name':_0x4706('0x49'),'value':_0x3ed9d8['attrFontSize']||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8['attrs'][0x2]?_0x3ed9d8[_0x4706('0x40')][0x2]['value']:undefined)||0x14}];case _0x4706('0x4c'):case _0x4706('0x4d'):return[{'name':_0x4706('0x4e'),'value':_0x3ed9d8[_0x4706('0x4e')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x0]?_0x3ed9d8[_0x4706('0x40')][0x0][_0x4706('0x43')]:undefined)||_0x4706('0x4f')},{'name':_0x4706('0x50'),'value':_0x3ed9d8[_0x4706('0x50')]||(_0x3ed9d8['attrs']&&_0x3ed9d8[_0x4706('0x40')][0x1]?_0x3ed9d8['attrs'][0x1][_0x4706('0x43')]:undefined)||null},{'name':_0x4706('0x51'),'value':_0x3ed9d8[_0x4706('0x51')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x2]?_0x3ed9d8[_0x4706('0x40')][0x2]['value']:undefined)||null},{'name':_0x4706('0x4b'),'value':_0x3ed9d8[_0x4706('0x4b')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x3]?_0x3ed9d8[_0x4706('0x40')][0x3][_0x4706('0x43')]:undefined)||[]}];case _0x4706('0x52'):return[{'name':_0x4706('0x53'),'type':_0x3ed9d8[_0x4706('0x54')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x0]?_0x3ed9d8['attrs'][0x0][_0x4706('0x3d')]:undefined)||null,'value':_0x3ed9d8[_0x4706('0x53')]||(_0x3ed9d8['attrs']&&_0x3ed9d8['attrs'][0x0]?_0x3ed9d8[_0x4706('0x40')][0x0][_0x4706('0x43')]:undefined)||null},{'name':_0x4706('0x55'),'value':_0x3ed9d8[_0x4706('0x55')]||(_0x3ed9d8[_0x4706('0x40')]&&_0x3ed9d8[_0x4706('0x40')][0x1]?_0x3ed9d8['attrs'][0x1][_0x4706('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x488c63){logger[_0x4706('0x56')](_0x4706('0x57'),JSON['stringify'](_0x488c63));return[];}}exports[_0x4706('0x58')]=function(_0x4e4bb8,_0x3d2321){if(_0x4e4bb8[_0x4706('0x59')]){_0x4e4bb8[_0x4706('0x59')][_0x4706('0x40')]=widgetAttributes(_0x4e4bb8[_0x4706('0x59')]);}return db[_0x4706('0x30')]['create'](_0x4e4bb8[_0x4706('0x59')],{})[_0x4706('0x2a')](respondWithResult(_0x3d2321,0xc9))[_0x4706('0x3c')](handleError(_0x3d2321,null));};exports[_0x4706('0x5a')]=function(_0x1b82d2,_0x72da11){if(_0x1b82d2['body']['id']){delete _0x1b82d2[_0x4706('0x59')]['id'];}_0x1b82d2['body'][_0x4706('0x40')]=widgetAttributes(_0x1b82d2[_0x4706('0x59')]);return db[_0x4706('0x30')][_0x4706('0x3a')]({'where':{'id':_0x1b82d2['params']['id']}})[_0x4706('0x2a')](handleEntityNotFound(_0x72da11,null))[_0x4706('0x2a')](saveUpdates(_0x1b82d2[_0x4706('0x59')],null))[_0x4706('0x2a')](respondWithResult(_0x72da11,null))[_0x4706('0x3c')](handleError(_0x72da11,null));}; \ No newline at end of file +var _0xfd44=['attrSerie3','attrReport','attrRefresh','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','apply','reject','save','then','error','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','DashboardItem','catch','destroy','find','params','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2'];(function(_0xdf377,_0x4f5c7e){var _0x16a523=function(_0xab35ad){while(--_0xab35ad){_0xdf377['push'](_0xdf377['shift']());}};_0x16a523(++_0x4f5c7e);}(_0xfd44,0x1d2));var _0x4fd4=function(_0x189086,_0x38f4cc){_0x189086=_0x189086-0x0;var _0x14f7ac=_0xfd44[_0x189086];return _0x14f7ac;};'use strict';var emlformat=require(_0x4fd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fd4('0x1'));var jsonpatch=require(_0x4fd4('0x2'));var rp=require(_0x4fd4('0x3'));var moment=require(_0x4fd4('0x4'));var BPromise=require(_0x4fd4('0x5'));var Mustache=require(_0x4fd4('0x6'));var util=require('util');var path=require(_0x4fd4('0x7'));var sox=require(_0x4fd4('0x8'));var csv=require(_0x4fd4('0x9'));var ejs=require(_0x4fd4('0xa'));var fs=require('fs');var fs_extra=require(_0x4fd4('0xb'));var _=require(_0x4fd4('0xc'));var squel=require(_0x4fd4('0xd'));var crypto=require(_0x4fd4('0xe'));var jsforce=require(_0x4fd4('0xf'));var deskjs=require(_0x4fd4('0x10'));var toCsv=require(_0x4fd4('0x9'));var querystring=require('querystring');var Papa=require(_0x4fd4('0x11'));var Redis=require('ioredis');var authService=require(_0x4fd4('0x12'));var qs=require(_0x4fd4('0x13'));var as=require(_0x4fd4('0x14'));var hardwareService=require(_0x4fd4('0x15'));var logger=require(_0x4fd4('0x16'))(_0x4fd4('0x17'));var utils=require(_0x4fd4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4fd4('0x19'));var db=require(_0x4fd4('0x1a'))['db'];config[_0x4fd4('0x1b')]=_[_0x4fd4('0x1c')](config[_0x4fd4('0x1b')],{'host':_0x4fd4('0x1d'),'port':0x18eb});var socket=require(_0x4fd4('0x1e'))(new Redis(config[_0x4fd4('0x1b')]));require(_0x4fd4('0x1f'))[_0x4fd4('0x20')](socket);function respondWithStatusCode(_0x22d9ab,_0x95f2de){_0x95f2de=_0x95f2de||0xcc;return function(_0x403168){if(_0x403168){return _0x22d9ab['sendStatus'](_0x95f2de);}return _0x22d9ab[_0x4fd4('0x21')](_0x95f2de)[_0x4fd4('0x22')]();};}function respondWithResult(_0x250989,_0x48d00f){_0x48d00f=_0x48d00f||0xc8;return function(_0x3eb106){if(_0x3eb106){return _0x250989[_0x4fd4('0x21')](_0x48d00f)[_0x4fd4('0x23')](_0x3eb106);}};}function respondWithFilteredResult(_0x2b6f97,_0x3ac40b){return function(_0x196921){if(_0x196921){var _0x24008c=typeof _0x3ac40b[_0x4fd4('0x24')]===_0x4fd4('0x25')&&typeof _0x3ac40b[_0x4fd4('0x26')]===_0x4fd4('0x25');var _0x18c5bd=_0x196921[_0x4fd4('0x27')];var _0x86cdde=_0x24008c?0x0:_0x3ac40b['offset'];var _0x416195=_0x24008c?_0x196921[_0x4fd4('0x27')]:_0x3ac40b['offset']+_0x3ac40b[_0x4fd4('0x26')];var _0x3be63c;if(_0x416195>=_0x18c5bd){_0x416195=_0x18c5bd;_0x3be63c=0xc8;}else{_0x3be63c=0xce;}_0x2b6f97[_0x4fd4('0x21')](_0x3be63c);return _0x2b6f97['set']('Content-Range',_0x86cdde+'-'+_0x416195+'/'+_0x18c5bd)[_0x4fd4('0x23')](_0x196921);}return null;};}function patchUpdates(_0x1900f0){return function(_0x270448){try{jsonpatch[_0x4fd4('0x28')](_0x270448,_0x1900f0,!![]);}catch(_0x429e1b){return BPromise[_0x4fd4('0x29')](_0x429e1b);}return _0x270448[_0x4fd4('0x2a')]();};}function saveUpdates(_0x51a304,_0x50fbc5){return function(_0x35c717){if(_0x35c717){return _0x35c717['update'](_0x51a304)[_0x4fd4('0x2b')](function(_0x26ebcf){return _0x26ebcf;});}return null;};}function removeEntity(_0x5c750e,_0x3b774f){return function(_0x1d9880){if(_0x1d9880){return _0x1d9880['destroy']()[_0x4fd4('0x2b')](function(){_0x5c750e[_0x4fd4('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2466dc,_0x47ff7c){return function(_0x40a1d2){if(!_0x40a1d2){_0x2466dc['sendStatus'](0x194);}return _0x40a1d2;};}function handleError(_0x29a562,_0x5e6e15){_0x5e6e15=_0x5e6e15||0x1f4;return function(_0x157cee){logger[_0x4fd4('0x2c')](_0x157cee[_0x4fd4('0x2d')]);if(_0x157cee[_0x4fd4('0x2e')]){delete _0x157cee[_0x4fd4('0x2e')];}_0x29a562[_0x4fd4('0x21')](_0x5e6e15)[_0x4fd4('0x2f')](_0x157cee);};}exports['show']=function(_0x6642f7,_0x55d018){var _0x46c01a={'raw':![],'where':{'id':_0x6642f7['params']['id']}},_0x100982={};_0x100982[_0x4fd4('0x30')]=_[_0x4fd4('0x31')](db['DashboardItem'][_0x4fd4('0x32')]);_0x100982[_0x4fd4('0x33')]=_['keys'](_0x6642f7[_0x4fd4('0x33')]);_0x100982[_0x4fd4('0x34')]=_[_0x4fd4('0x35')](_0x100982[_0x4fd4('0x30')],_0x100982[_0x4fd4('0x33')]);_0x46c01a[_0x4fd4('0x36')]=_[_0x4fd4('0x35')](_0x100982[_0x4fd4('0x30')],qs[_0x4fd4('0x37')](_0x6642f7[_0x4fd4('0x33')]['fields']));_0x46c01a[_0x4fd4('0x36')]=_0x46c01a[_0x4fd4('0x36')][_0x4fd4('0x38')]?_0x46c01a[_0x4fd4('0x36')]:_0x100982[_0x4fd4('0x30')];if(_0x6642f7['query']['includeAll']){_0x46c01a[_0x4fd4('0x39')]=[{'all':!![]}];}_0x46c01a=_[_0x4fd4('0x3a')]({},_0x46c01a,_0x6642f7[_0x4fd4('0x3b')]);return db[_0x4fd4('0x3c')]['find'](_0x46c01a)[_0x4fd4('0x2b')](handleEntityNotFound(_0x55d018,null))['then'](respondWithResult(_0x55d018,null))[_0x4fd4('0x3d')](handleError(_0x55d018,null));};exports[_0x4fd4('0x3e')]=function(_0x5c3b92,_0x4d4be2){return db[_0x4fd4('0x3c')][_0x4fd4('0x3f')]({'where':{'id':_0x5c3b92[_0x4fd4('0x40')]['id']}})[_0x4fd4('0x2b')](handleEntityNotFound(_0x4d4be2,null))[_0x4fd4('0x2b')](removeEntity(_0x4d4be2,null))[_0x4fd4('0x3d')](handleError(_0x4d4be2,null));};function widgetAttributes(_0x1307da){try{switch(_0x1307da[_0x4fd4('0x41')]){case _0x4fd4('0x42'):return[{'name':_0x4fd4('0x43'),'value':_0x1307da[_0x4fd4('0x43')]||(_0x1307da['attrs']&&_0x1307da[_0x4fd4('0x44')][0x0]?_0x1307da[_0x4fd4('0x44')][0x0][_0x4fd4('0x45')]:undefined)||'https://'}];case _0x4fd4('0x46'):return[{'name':_0x4fd4('0x47'),'value':_0x1307da[_0x4fd4('0x47')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x0]?_0x1307da[_0x4fd4('0x44')][0x0]['value']:undefined)||''}];case _0x4fd4('0x48'):return[{'name':_0x4fd4('0x49'),'value':_0x1307da[_0x4fd4('0x49')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x0]?_0x1307da['attrs'][0x0][_0x4fd4('0x45')]:undefined)||_0x4fd4('0x4a')},{'name':_0x4fd4('0x4b'),'value':_0x1307da[_0x4fd4('0x4b')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da['attrs'][0x1]?_0x1307da[_0x4fd4('0x44')][0x1][_0x4fd4('0x45')]:undefined)||_0x4fd4('0x4c')},{'name':_0x4fd4('0x4d'),'value':_0x1307da[_0x4fd4('0x4d')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x2]?_0x1307da[_0x4fd4('0x44')][0x2][_0x4fd4('0x45')]:undefined)||0xc}];case _0x4fd4('0x4e'):return[{'name':_0x4fd4('0x4f'),'value':_0x1307da[_0x4fd4('0x4f')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x0]?_0x1307da[_0x4fd4('0x44')][0x0]['value']:undefined)||_0x4fd4('0x50')},{'name':_0x4fd4('0x51'),'value':_0x1307da[_0x4fd4('0x51')]||(_0x1307da['attrs']&&_0x1307da[_0x4fd4('0x44')][0x1]?_0x1307da[_0x4fd4('0x44')][0x1][_0x4fd4('0x45')]:undefined)||[]},{'name':_0x4fd4('0x4d'),'value':_0x1307da[_0x4fd4('0x4d')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x2]?_0x1307da[_0x4fd4('0x44')][0x2]['value']:undefined)||0x14}];case _0x4fd4('0x52'):case _0x4fd4('0x53'):return[{'name':'attrSerie1','value':_0x1307da[_0x4fd4('0x54')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da['attrs'][0x0]?_0x1307da['attrs'][0x0][_0x4fd4('0x45')]:undefined)||_0x4fd4('0x50')},{'name':_0x4fd4('0x55'),'value':_0x1307da[_0x4fd4('0x55')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da['attrs'][0x1]?_0x1307da[_0x4fd4('0x44')][0x1][_0x4fd4('0x45')]:undefined)||null},{'name':_0x4fd4('0x56'),'value':_0x1307da['attrSerie3']||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da['attrs'][0x2]?_0x1307da[_0x4fd4('0x44')][0x2][_0x4fd4('0x45')]:undefined)||null},{'name':_0x4fd4('0x51'),'value':_0x1307da[_0x4fd4('0x51')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x3]?_0x1307da[_0x4fd4('0x44')][0x3][_0x4fd4('0x45')]:undefined)||[]}];case'web-report':return[{'name':_0x4fd4('0x57'),'type':_0x1307da['reportType']||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x0]?_0x1307da['attrs'][0x0][_0x4fd4('0x41')]:undefined)||null,'value':_0x1307da[_0x4fd4('0x57')]||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x0]?_0x1307da[_0x4fd4('0x44')][0x0][_0x4fd4('0x45')]:undefined)||null},{'name':_0x4fd4('0x58'),'value':_0x1307da['attrRefresh']||(_0x1307da[_0x4fd4('0x44')]&&_0x1307da[_0x4fd4('0x44')][0x1]?_0x1307da[_0x4fd4('0x44')][0x1][_0x4fd4('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x253e64){logger[_0x4fd4('0x2c')]('widgetAttributes:\x20%s',JSON['stringify'](_0x253e64));return[];}}exports[_0x4fd4('0x59')]=function(_0x512b68,_0x1ec43e){if(_0x512b68[_0x4fd4('0x5a')]){_0x512b68[_0x4fd4('0x5a')][_0x4fd4('0x44')]=widgetAttributes(_0x512b68[_0x4fd4('0x5a')]);}return db[_0x4fd4('0x3c')][_0x4fd4('0x59')](_0x512b68['body'],{})['then'](respondWithResult(_0x1ec43e,0xc9))[_0x4fd4('0x3d')](handleError(_0x1ec43e,null));};exports[_0x4fd4('0x5b')]=function(_0x25b532,_0x58a38a){if(_0x25b532[_0x4fd4('0x5a')]['id']){delete _0x25b532['body']['id'];}_0x25b532['body'][_0x4fd4('0x44')]=widgetAttributes(_0x25b532[_0x4fd4('0x5a')]);return db[_0x4fd4('0x3c')][_0x4fd4('0x3f')]({'where':{'id':_0x25b532[_0x4fd4('0x40')]['id']}})[_0x4fd4('0x2b')](handleEntityNotFound(_0x58a38a,null))[_0x4fd4('0x2b')](saveUpdates(_0x25b532[_0x4fd4('0x5a')],null))[_0x4fd4('0x2b')](respondWithResult(_0x58a38a,null))['catch'](handleError(_0x58a38a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a2a7096..df3c8fb 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 _0xa8ce=['remove','emit','hasOwnProperty','exports','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x34ed96,_0x5f17d2){var _0x1717f0=function(_0x335697){while(--_0x335697){_0x34ed96['push'](_0x34ed96['shift']());}};_0x1717f0(++_0x5f17d2);}(_0xa8ce,0x1d8));var _0xea8c=function(_0x491f2a,_0x4aded4){_0x491f2a=_0x491f2a-0x0;var _0x3089af=_0xa8ce[_0x491f2a];return _0x3089af;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xea8c('0x0'))['db'][_0xea8c('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xea8c('0x2')](0x0);var events={'afterCreate':_0xea8c('0x3'),'afterUpdate':_0xea8c('0x4'),'afterDestroy':_0xea8c('0x5')};function emitEvent(_0x2877b2){return function(_0x13a8ac,_0x57643f,_0xced4b){DashboardItemEvents['emit'](_0x2877b2+':'+_0x13a8ac['id'],_0x13a8ac);DashboardItemEvents[_0xea8c('0x6')](_0x2877b2,_0x13a8ac);_0xced4b(null);};}for(var e in events){if(events[_0xea8c('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xea8c('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xe7de=['exports','events','../../mysqldb','save','remove','emit','hasOwnProperty','hook'];(function(_0x266b19,_0x4d3ef7){var _0x110655=function(_0x247fc2){while(--_0x247fc2){_0x266b19['push'](_0x266b19['shift']());}};_0x110655(++_0x4d3ef7);}(_0xe7de,0x1d1));var _0xee7d=function(_0x35dc3b,_0x1eafae){_0x35dc3b=_0x35dc3b-0x0;var _0x226439=_0xe7de[_0x35dc3b];return _0x226439;};'use strict';var EventEmitter=require(_0xee7d('0x0'));var DashboardItem=require(_0xee7d('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee7d('0x2'),'afterUpdate':'update','afterDestroy':_0xee7d('0x3')};function emitEvent(_0x412a84){return function(_0x5d64f,_0x4c8736,_0x5167fb){DashboardItemEvents[_0xee7d('0x4')](_0x412a84+':'+_0x5d64f['id'],_0x5d64f);DashboardItemEvents[_0xee7d('0x4')](_0x412a84,_0x5d64f);_0x5167fb(null);};}for(var e in events){if(events[_0xee7d('0x5')](e)){var event=events[e];DashboardItem[_0xee7d('0x6')](e,emitEvent(event));}}module[_0xee7d('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b0fc338..8f18d20 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 _0xa1ef=['lodash','util','../../config/logger','api','moment','bluebird','path','exports','define','DashboardItem','dashboard_items'];(function(_0x5a4bd2,_0x291b9b){var _0x4b1079=function(_0x501dc6){while(--_0x501dc6){_0x5a4bd2['push'](_0x5a4bd2['shift']());}};_0x4b1079(++_0x291b9b);}(_0xa1ef,0xb0));var _0xfa1e=function(_0x38bf74,_0x1164bd){_0x38bf74=_0x38bf74-0x0;var _0x414e5b=_0xa1ef[_0x38bf74];return _0x414e5b;};'use strict';var _=require(_0xfa1e('0x0'));var util=require(_0xfa1e('0x1'));var logger=require(_0xfa1e('0x2'))(_0xfa1e('0x3'));var moment=require(_0xfa1e('0x4'));var BPromise=require(_0xfa1e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa1e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0xfa1e('0x7')]=function(_0x3ebd3b,_0x4d0f48){return _0x3ebd3b[_0xfa1e('0x8')](_0xfa1e('0x9'),attributes,{'tableName':_0xfa1e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8ad=['bluebird','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger'];(function(_0x19e983,_0xb67e90){var _0x56d5f9=function(_0xed6675){while(--_0xed6675){_0x19e983['push'](_0x19e983['shift']());}};_0x56d5f9(++_0xb67e90);}(_0xa8ad,0x10c));var _0xda8a=function(_0x3aa16f,_0x58d908){_0x3aa16f=_0x3aa16f-0x0;var _0x14f69f=_0xa8ad[_0x3aa16f];return _0x14f69f;};'use strict';var _=require(_0xda8a('0x0'));var util=require('util');var logger=require(_0xda8a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xda8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda8a('0x3'));var config=require(_0xda8a('0x4'));var attributes=require(_0xda8a('0x5'));module[_0xda8a('0x6')]=function(_0x5e8b5e,_0x7fe7ff){return _0x5e8b5e[_0xda8a('0x7')](_0xda8a('0x8'),attributes,{'tableName':_0xda8a('0x9'),'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 b77e085..e3bec82 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 _0x64e0=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','DashboardItem,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2dbf69,_0x52c626){var _0x3dc208=function(_0x2f1e7b){while(--_0x2f1e7b){_0x2dbf69['push'](_0x2dbf69['shift']());}};_0x3dc208(++_0x52c626);}(_0x64e0,0x1f2));var _0x064e=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x64e0[_0x366e99];return _0x180bbe;};'use strict';var _=require(_0x064e('0x0'));var util=require(_0x064e('0x1'));var moment=require(_0x064e('0x2'));var BPromise=require(_0x064e('0x3'));var rs=require(_0x064e('0x4'));var fs=require('fs');var Redis=require(_0x064e('0x5'));var db=require(_0x064e('0x6'))['db'];var utils=require(_0x064e('0x7'));var logger=require(_0x064e('0x8'))('rpc');var config=require(_0x064e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x064e('0xa')]({'port':0x232a});config[_0x064e('0xb')]=_[_0x064e('0xc')](config['redis'],{'host':_0x064e('0xd'),'port':0x18eb});var socket=require(_0x064e('0xe'))(new Redis(config[_0x064e('0xb')]));require(_0x064e('0xf'))[_0x064e('0x10')](socket);function respondWithRpcPromise(_0x4867c2,_0x1bdd53,_0x5eb5f1){return new BPromise(function(_0x356f64,_0x300d22){return client[_0x064e('0x11')](_0x4867c2,_0x5eb5f1)[_0x064e('0x12')](function(_0x32b941){logger['info']('DashboardItem,\x20%s,\x20%s',_0x1bdd53,_0x064e('0x13'));logger[_0x064e('0x14')](_0x064e('0x15'),_0x1bdd53,_0x064e('0x13'),JSON[_0x064e('0x16')](_0x32b941));if(_0x32b941[_0x064e('0x17')]){if(_0x32b941[_0x064e('0x17')]['code']===0x1f4){logger[_0x064e('0x17')]('DashboardItem,\x20%s,\x20%s',_0x1bdd53,_0x32b941[_0x064e('0x17')][_0x064e('0x18')]);return _0x300d22(_0x32b941[_0x064e('0x17')][_0x064e('0x18')]);}logger[_0x064e('0x17')](_0x064e('0x19'),_0x1bdd53,_0x32b941[_0x064e('0x17')][_0x064e('0x18')]);return _0x356f64(_0x32b941[_0x064e('0x17')]['message']);}else{logger[_0x064e('0x1a')]('DashboardItem,\x20%s,\x20%s',_0x1bdd53,'request\x20sent');_0x356f64(_0x32b941['result'][_0x064e('0x18')]);}})[_0x064e('0x1b')](function(_0x465beb){logger[_0x064e('0x17')](_0x064e('0x19'),_0x1bdd53,_0x465beb);_0x300d22(_0x465beb);});});} \ No newline at end of file +var _0x0ae9=['then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','register','request'];(function(_0x58eca9,_0x219608){var _0x25a12e=function(_0x1d3695){while(--_0x1d3695){_0x58eca9['push'](_0x58eca9['shift']());}};_0x25a12e(++_0x219608);}(_0x0ae9,0x1be));var _0x90ae=function(_0x1666dd,_0x1e5822){_0x1666dd=_0x1666dd-0x0;var _0x41ad98=_0x0ae9[_0x1666dd];return _0x41ad98;};'use strict';var _=require('lodash');var util=require(_0x90ae('0x0'));var moment=require(_0x90ae('0x1'));var BPromise=require(_0x90ae('0x2'));var rs=require(_0x90ae('0x3'));var fs=require('fs');var Redis=require(_0x90ae('0x4'));var db=require(_0x90ae('0x5'))['db'];var utils=require(_0x90ae('0x6'));var logger=require(_0x90ae('0x7'))(_0x90ae('0x8'));var config=require(_0x90ae('0x9'));var jayson=require(_0x90ae('0xa'));var client=jayson[_0x90ae('0xb')][_0x90ae('0xc')]({'port':0x232a});config[_0x90ae('0xd')]=_[_0x90ae('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90ae('0xd')]));require(_0x90ae('0xf'))[_0x90ae('0x10')](socket);function respondWithRpcPromise(_0x5deb5b,_0x4f96ad,_0x2c8513){return new BPromise(function(_0x3e4d52,_0x8c80fc){return client[_0x90ae('0x11')](_0x5deb5b,_0x2c8513)[_0x90ae('0x12')](function(_0x1d9967){logger[_0x90ae('0x13')](_0x90ae('0x14'),_0x4f96ad,_0x90ae('0x15'));logger[_0x90ae('0x16')](_0x90ae('0x17'),_0x4f96ad,_0x90ae('0x15'),JSON[_0x90ae('0x18')](_0x1d9967));if(_0x1d9967[_0x90ae('0x19')]){if(_0x1d9967['error']['code']===0x1f4){logger[_0x90ae('0x19')](_0x90ae('0x14'),_0x4f96ad,_0x1d9967[_0x90ae('0x19')]['message']);return _0x8c80fc(_0x1d9967[_0x90ae('0x19')][_0x90ae('0x1a')]);}logger[_0x90ae('0x19')]('DashboardItem,\x20%s,\x20%s',_0x4f96ad,_0x1d9967[_0x90ae('0x19')]['message']);return _0x3e4d52(_0x1d9967[_0x90ae('0x19')][_0x90ae('0x1a')]);}else{logger[_0x90ae('0x13')](_0x90ae('0x14'),_0x4f96ad,_0x90ae('0x15'));_0x3e4d52(_0x1d9967[_0x90ae('0x1b')][_0x90ae('0x1a')]);}})[_0x90ae('0x1c')](function(_0x58643a){logger['error'](_0x90ae('0x14'),_0x4f96ad,_0x58643a);_0x8c80fc(_0x58643a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 2376c5f..d1e38cb 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 _0x305c=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x557f8e,_0x2dc6b9){var _0x237901=function(_0x2a061f){while(--_0x2a061f){_0x557f8e['push'](_0x557f8e['shift']());}};_0x237901(++_0x2dc6b9);}(_0x305c,0x126));var _0xc305=function(_0x43446f,_0x2af360){_0x43446f=_0x43446f-0x0;var _0x2a1369=_0x305c[_0x43446f];return _0x2a1369;};'use strict';var DashboardItemEvents=require(_0xc305('0x0'));var events=[_0xc305('0x1'),_0xc305('0x2'),_0xc305('0x3')];function createListener(_0x134bf5,_0x12880c){return function(_0x345302){_0x12880c[_0xc305('0x4')](_0x134bf5,_0x345302);};}function removeListener(_0x2795b0,_0x2003fb){return function(){DashboardItemEvents[_0xc305('0x5')](_0x2795b0,_0x2003fb);};}exports[_0xc305('0x6')]=function(_0x23bb4a){for(var _0x52d79f=0x0,_0x4b742d=events[_0xc305('0x7')];_0x52d79f<_0x4b742d;_0x52d79f++){var _0x32f2ca=events[_0x52d79f];var _0x21ab41=createListener(_0xc305('0x8')+_0x32f2ca,_0x23bb4a);DashboardItemEvents['on'](_0x32f2ca,_0x21ab41);}}; \ No newline at end of file +var _0x0e02=['removeListener','register','length','dashboardItem:','emit'];(function(_0x1ed857,_0x1841ae){var _0x1d5b95=function(_0x5d53d2){while(--_0x5d53d2){_0x1ed857['push'](_0x1ed857['shift']());}};_0x1d5b95(++_0x1841ae);}(_0x0e02,0x9a));var _0x20e0=function(_0x5d5df5,_0x243272){_0x5d5df5=_0x5d5df5-0x0;var _0x54e334=_0x0e02[_0x5d5df5];return _0x54e334;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove','update'];function createListener(_0x51c414,_0x5f2ca8){return function(_0x1a696b){_0x5f2ca8[_0x20e0('0x0')](_0x51c414,_0x1a696b);};}function removeListener(_0x2ac636,_0x498cfb){return function(){DashboardItemEvents[_0x20e0('0x1')](_0x2ac636,_0x498cfb);};}exports[_0x20e0('0x2')]=function(_0x34669a){for(var _0x5cdacf=0x0,_0x2202bf=events[_0x20e0('0x3')];_0x5cdacf<_0x2202bf;_0x5cdacf++){var _0x11dc04=events[_0x5cdacf];var _0xdd7249=createListener(_0x20e0('0x4')+_0x11dc04,_0x34669a);DashboardItemEvents['on'](_0x11dc04,_0xdd7249);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 93fc803..0e5bc59 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 _0xe843=['path','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','update','destroy','exports','util'];(function(_0x1671c7,_0x36f775){var _0x160b76=function(_0x547da6){while(--_0x547da6){_0x1671c7['push'](_0x1671c7['shift']());}};_0x160b76(++_0x36f775);}(_0xe843,0x16b));var _0x3e84=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe843[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x3e84('0x0'));var path=require(_0x3e84('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e84('0x2'));var auth=require(_0x3e84('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3e84('0x4'));var controller=require(_0x3e84('0x5'));router['get'](_0x3e84('0x6'),auth[_0x3e84('0x7')](),controller[_0x3e84('0x8')]);router[_0x3e84('0x9')]('/',auth[_0x3e84('0x7')](),controller['create']);router['put'](_0x3e84('0x6'),auth[_0x3e84('0x7')](),controller[_0x3e84('0xa')]);router['delete'](_0x3e84('0x6'),auth[_0x3e84('0x7')](),controller[_0x3e84('0xb')]);module[_0x3e84('0xc')]=router; \ No newline at end of file +var _0xabe3=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xabe3,0xe1));var _0x3abe=function(_0x58a73e,_0x219f97){_0x58a73e=_0x58a73e-0x0;var _0x3c9492=_0xabe3[_0x58a73e];return _0x3c9492;};'use strict';var multer=require(_0x3abe('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3abe('0x1'));var router=express[_0x3abe('0x2')]();var fs_extra=require(_0x3abe('0x3'));var auth=require(_0x3abe('0x4'));var interaction=require(_0x3abe('0x5'));var config=require(_0x3abe('0x6'));var controller=require(_0x3abe('0x7'));router['get'](_0x3abe('0x8'),auth[_0x3abe('0x9')](),controller[_0x3abe('0xa')]);router['post']('/',auth[_0x3abe('0x9')](),controller[_0x3abe('0xb')]);router[_0x3abe('0xc')](_0x3abe('0x8'),auth[_0x3abe('0x9')](),controller[_0x3abe('0xd')]);router[_0x3abe('0xe')](_0x3abe('0x8'),auth[_0x3abe('0x9')](),controller['destroy']);module[_0x3abe('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a4959b6..2f9f5fa 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 _0xd006=['ENUM','first','second','third','sequelize','STRING'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd006,0x1a8));var _0x6d00=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xd006[_0x32f9ca];return _0x52e083;};'use strict';var Sequelize=require(_0x6d00('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d00('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6d00('0x2')](_0x6d00('0x3'),_0x6d00('0x4'),_0x6d00('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x6d00('0x1')]}}; \ No newline at end of file +var _0x4b94=['second','third','STRING','sequelize','exports','ENUM','first'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x4b94,0x1a7));var _0x44b9=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x4b94[_0x817d9b];return _0x2752e1;};'use strict';var Sequelize=require(_0x44b9('0x0'));module[_0x44b9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x44b9('0x2')](_0x44b9('0x3'),_0x44b9('0x4'),_0x44b9('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x44b9('0x6')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ab5fd97..5ba6427 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 _0xa398=['order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','Disposition','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit'];(function(_0x27b1e9,_0x3f1758){var _0x2b98df=function(_0x1ed73f){while(--_0x1ed73f){_0x27b1e9['push'](_0x27b1e9['shift']());}};_0x2b98df(++_0x3f1758);}(_0xa398,0xbb));var _0x8a39=function(_0x275559,_0xaa7cd7){_0x275559=_0x275559-0x0;var _0x47befb=_0xa398[_0x275559];return _0x47befb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a39('0x0'));var rp=require(_0x8a39('0x1'));var moment=require(_0x8a39('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8a39('0x3'));var util=require('util');var path=require(_0x8a39('0x4'));var sox=require('sox');var csv=require(_0x8a39('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a39('0x6'));var squel=require(_0x8a39('0x7'));var crypto=require(_0x8a39('0x8'));var jsforce=require(_0x8a39('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8a39('0x5'));var querystring=require(_0x8a39('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a39('0xb'));var qs=require(_0x8a39('0xc'));var as=require(_0x8a39('0xd'));var hardwareService=require(_0x8a39('0xe'));var logger=require('../../config/logger')(_0x8a39('0xf'));var utils=require('../../config/utils');var config=require(_0x8a39('0x10'));var licenseUtil=require(_0x8a39('0x11'));var db=require(_0x8a39('0x12'))['db'];function respondWithStatusCode(_0x168713,_0x2331fa){_0x2331fa=_0x2331fa||0xcc;return function(_0xd08438){if(_0xd08438){return _0x168713[_0x8a39('0x13')](_0x2331fa);}return _0x168713[_0x8a39('0x14')](_0x2331fa)[_0x8a39('0x15')]();};}function respondWithResult(_0x170cab,_0x20e74b){_0x20e74b=_0x20e74b||0xc8;return function(_0x4f1063){if(_0x4f1063){return _0x170cab[_0x8a39('0x14')](_0x20e74b)['json'](_0x4f1063);}};}function respondWithFilteredResult(_0x3a616a,_0x445e87){return function(_0x486bb6){if(_0x486bb6){var _0x529e31=typeof _0x445e87[_0x8a39('0x16')]==='undefined'&&typeof _0x445e87[_0x8a39('0x17')]==='undefined';var _0x25e447=_0x486bb6[_0x8a39('0x18')];var _0x32a9e8=_0x529e31?0x0:_0x445e87[_0x8a39('0x16')];var _0x3c81fc=_0x529e31?_0x486bb6[_0x8a39('0x18')]:_0x445e87['offset']+_0x445e87[_0x8a39('0x17')];var _0x31f101;if(_0x3c81fc>=_0x25e447){_0x3c81fc=_0x25e447;_0x31f101=0xc8;}else{_0x31f101=0xce;}_0x3a616a['status'](_0x31f101);return _0x3a616a['set'](_0x8a39('0x19'),_0x32a9e8+'-'+_0x3c81fc+'/'+_0x25e447)[_0x8a39('0x1a')](_0x486bb6);}return null;};}function patchUpdates(_0x43b1c7){return function(_0x1bff44){try{jsonpatch[_0x8a39('0x1b')](_0x1bff44,_0x43b1c7,!![]);}catch(_0x2c69e6){return BPromise['reject'](_0x2c69e6);}return _0x1bff44[_0x8a39('0x1c')]();};}function saveUpdates(_0x44486b,_0x4e8f29){return function(_0x14299f){if(_0x14299f){return _0x14299f[_0x8a39('0x1d')](_0x44486b)[_0x8a39('0x1e')](function(_0x5e0603){return _0x5e0603;});}return null;};}function removeEntity(_0x556713,_0x4f608e){return function(_0x41b86f){if(_0x41b86f){return _0x41b86f[_0x8a39('0x1f')]()['then'](function(){var _0x21350a=_0x41b86f['get']({'plain':!![]});var _0x9d808d='Dispositions';return db['UserProfileResource'][_0x8a39('0x1f')]({'where':{'type':_0x9d808d,'resourceId':_0x21350a['id']}})[_0x8a39('0x1e')](function(){return _0x41b86f;});})[_0x8a39('0x1e')](function(){_0x556713[_0x8a39('0x14')](0xcc)[_0x8a39('0x15')]();});}};}function handleEntityNotFound(_0x367306,_0x469425){return function(_0xda6681){if(!_0xda6681){_0x367306['sendStatus'](0x194);}return _0xda6681;};}function handleError(_0x46bdb3,_0x96aea){_0x96aea=_0x96aea||0x1f4;return function(_0x4c4682){logger[_0x8a39('0x20')](_0x4c4682[_0x8a39('0x21')]);if(_0x4c4682['name']){delete _0x4c4682[_0x8a39('0x22')];}_0x46bdb3[_0x8a39('0x14')](_0x96aea)[_0x8a39('0x23')](_0x4c4682);};}exports['index']=function(_0x5ea084,_0x24a17d){var _0x2f2e38={},_0x4b702b={},_0x55dc9e={'count':0x0,'rows':[]};var _0x3b7cd8=_['map'](db[_0x8a39('0x24')]['rawAttributes'],function(_0x196882){return{'name':_0x196882['fieldName'],'type':_0x196882[_0x8a39('0x25')][_0x8a39('0x26')]};});_0x4b702b['model']=_[_0x8a39('0x27')](_0x3b7cd8,_0x8a39('0x22'));_0x4b702b[_0x8a39('0x28')]=_[_0x8a39('0x29')](_0x5ea084[_0x8a39('0x28')]);_0x4b702b[_0x8a39('0x2a')]=_[_0x8a39('0x2b')](_0x4b702b['model'],_0x4b702b['query']);_0x2f2e38[_0x8a39('0x2c')]=_[_0x8a39('0x2b')](_0x4b702b[_0x8a39('0x2d')],qs[_0x8a39('0x2e')](_0x5ea084['query'][_0x8a39('0x2e')]));_0x2f2e38[_0x8a39('0x2c')]=_0x2f2e38[_0x8a39('0x2c')][_0x8a39('0x2f')]?_0x2f2e38[_0x8a39('0x2c')]:_0x4b702b[_0x8a39('0x2d')];if(!_0x5ea084[_0x8a39('0x28')][_0x8a39('0x30')](_0x8a39('0x31'))){_0x2f2e38['limit']=qs[_0x8a39('0x17')](_0x5ea084[_0x8a39('0x28')][_0x8a39('0x17')]);_0x2f2e38[_0x8a39('0x16')]=qs['offset'](_0x5ea084['query']['offset']);}_0x2f2e38[_0x8a39('0x32')]=qs[_0x8a39('0x33')](_0x5ea084['query'][_0x8a39('0x33')]);_0x2f2e38['where']=qs[_0x8a39('0x2a')](_[_0x8a39('0x34')](_0x5ea084[_0x8a39('0x28')],_0x4b702b[_0x8a39('0x2a')]),_0x3b7cd8);if(_0x5ea084[_0x8a39('0x28')][_0x8a39('0x35')]){_0x2f2e38['where']=_[_0x8a39('0x36')](_0x2f2e38[_0x8a39('0x37')],{'$or':_['map'](_0x3b7cd8,function(_0x2099eb){if(_0x2099eb[_0x8a39('0x25')]!==_0x8a39('0x38')){var _0xf2cfeb={};_0xf2cfeb[_0x2099eb[_0x8a39('0x22')]]={'$like':'%'+_0x5ea084[_0x8a39('0x28')][_0x8a39('0x35')]+'%'};return _0xf2cfeb;}})});}_0x2f2e38=_[_0x8a39('0x36')]({},_0x2f2e38,_0x5ea084[_0x8a39('0x39')]);var _0xe458a9={'where':_0x2f2e38[_0x8a39('0x37')]};return db['Disposition']['count'](_0xe458a9)[_0x8a39('0x1e')](function(_0x54e947){_0x55dc9e[_0x8a39('0x18')]=_0x54e947;if(_0x5ea084[_0x8a39('0x28')][_0x8a39('0x3a')]){_0x2f2e38[_0x8a39('0x3b')]=[{'all':!![]}];}return db[_0x8a39('0x24')][_0x8a39('0x3c')](_0x2f2e38);})['then'](function(_0x747759){_0x55dc9e[_0x8a39('0x3d')]=_0x747759;return _0x55dc9e;})[_0x8a39('0x1e')](respondWithFilteredResult(_0x24a17d,_0x2f2e38))['catch'](handleError(_0x24a17d,null));};exports[_0x8a39('0x3e')]=function(_0x6d8c41,_0x5137c){var _0x429a52={'raw':!![],'where':{'id':_0x6d8c41[_0x8a39('0x3f')]['id']}},_0x55e3cf={};_0x55e3cf[_0x8a39('0x2d')]=_[_0x8a39('0x29')](db[_0x8a39('0x24')][_0x8a39('0x40')]);_0x55e3cf['query']=_['keys'](_0x6d8c41[_0x8a39('0x28')]);_0x55e3cf[_0x8a39('0x2a')]=_[_0x8a39('0x2b')](_0x55e3cf[_0x8a39('0x2d')],_0x55e3cf[_0x8a39('0x28')]);_0x429a52[_0x8a39('0x2c')]=_['intersection'](_0x55e3cf[_0x8a39('0x2d')],qs[_0x8a39('0x2e')](_0x6d8c41[_0x8a39('0x28')][_0x8a39('0x2e')]));_0x429a52[_0x8a39('0x2c')]=_0x429a52[_0x8a39('0x2c')]['length']?_0x429a52[_0x8a39('0x2c')]:_0x55e3cf[_0x8a39('0x2d')];if(_0x6d8c41['query']['includeAll']){_0x429a52[_0x8a39('0x3b')]=[{'all':!![]}];}_0x429a52=_[_0x8a39('0x36')]({},_0x429a52,_0x6d8c41[_0x8a39('0x39')]);return db[_0x8a39('0x24')][_0x8a39('0x41')](_0x429a52)[_0x8a39('0x1e')](handleEntityNotFound(_0x5137c,null))[_0x8a39('0x1e')](respondWithResult(_0x5137c,null))[_0x8a39('0x42')](handleError(_0x5137c,null));};exports[_0x8a39('0x43')]=function(_0x46b804,_0x524c1d){return db[_0x8a39('0x24')][_0x8a39('0x43')](_0x46b804['body'],{})[_0x8a39('0x1e')](function(_0x215180){var _0x5729df=_0x46b804['user'][_0x8a39('0x44')]({'plain':!![]});if(!_0x5729df)throw new Error(_0x8a39('0x45'));if(_0x5729df[_0x8a39('0x46')]===_0x8a39('0x47')){var _0x15d5be=_0x215180[_0x8a39('0x44')]({'plain':!![]});var _0x413e11=_0x8a39('0x48');return db[_0x8a39('0x49')][_0x8a39('0x41')]({'where':{'name':_0x413e11,'userProfileId':_0x5729df[_0x8a39('0x4a')]},'raw':!![]})[_0x8a39('0x1e')](function(_0x57046e){if(_0x57046e&&_0x57046e[_0x8a39('0x4b')]===0x0){return db[_0x8a39('0x4c')][_0x8a39('0x43')]({'name':_0x15d5be['name'],'resourceId':_0x15d5be['id'],'type':_0x57046e[_0x8a39('0x22')],'sectionId':_0x57046e['id']},{})[_0x8a39('0x1e')](function(){return _0x215180;});}else{return _0x215180;}})['catch'](function(_0x172031){logger['error'](_0x8a39('0x4d'),_0x172031);throw _0x172031;});}return _0x215180;})[_0x8a39('0x1e')](respondWithResult(_0x524c1d,0xc9))[_0x8a39('0x42')](handleError(_0x524c1d,null));};exports[_0x8a39('0x1d')]=function(_0xf36ecb,_0xa09e9){if(_0xf36ecb[_0x8a39('0x4e')]['id']){delete _0xf36ecb[_0x8a39('0x4e')]['id'];}return db[_0x8a39('0x24')][_0x8a39('0x41')]({'where':{'id':_0xf36ecb['params']['id']}})[_0x8a39('0x1e')](handleEntityNotFound(_0xa09e9,null))[_0x8a39('0x1e')](saveUpdates(_0xf36ecb[_0x8a39('0x4e')],null))[_0x8a39('0x1e')](respondWithResult(_0xa09e9,null))['catch'](handleError(_0xa09e9,null));};exports[_0x8a39('0x1f')]=function(_0x3bbdcb,_0x2dafa7){return db[_0x8a39('0x24')][_0x8a39('0x41')]({'where':{'id':_0x3bbdcb['params']['id']}})[_0x8a39('0x1e')](handleEntityNotFound(_0x2dafa7,null))['then'](removeEntity(_0x2dafa7,null))[_0x8a39('0x42')](handleError(_0x2dafa7,null));}; \ No newline at end of file +var _0x1987=['error','stack','name','send','index','map','Disposition','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','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','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Dispositions','UserProfileResource'];(function(_0x770077,_0x5b8f4d){var _0x3c0f6a=function(_0x303e74){while(--_0x303e74){_0x770077['push'](_0x770077['shift']());}};_0x3c0f6a(++_0x5b8f4d);}(_0x1987,0x1cd));var _0x7198=function(_0x31933a,_0x37ab77){_0x31933a=_0x31933a-0x0;var _0x498a62=_0x1987[_0x31933a];return _0x498a62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7198('0x0'));var zipdir=require(_0x7198('0x1'));var jsonpatch=require(_0x7198('0x2'));var rp=require('request-promise');var moment=require(_0x7198('0x3'));var BPromise=require(_0x7198('0x4'));var Mustache=require(_0x7198('0x5'));var util=require('util');var path=require(_0x7198('0x6'));var sox=require('sox');var csv=require(_0x7198('0x7'));var ejs=require(_0x7198('0x8'));var fs=require('fs');var fs_extra=require(_0x7198('0x9'));var _=require(_0x7198('0xa'));var squel=require(_0x7198('0xb'));var crypto=require(_0x7198('0xc'));var jsforce=require(_0x7198('0xd'));var deskjs=require(_0x7198('0xe'));var toCsv=require(_0x7198('0x7'));var querystring=require(_0x7198('0xf'));var Papa=require('papaparse');var Redis=require(_0x7198('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7198('0x11'));var as=require(_0x7198('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7198('0x13'))(_0x7198('0x14'));var utils=require(_0x7198('0x15'));var config=require(_0x7198('0x16'));var licenseUtil=require(_0x7198('0x17'));var db=require(_0x7198('0x18'))['db'];function respondWithStatusCode(_0xa57c58,_0x4f8415){_0x4f8415=_0x4f8415||0xcc;return function(_0x3ebea3){if(_0x3ebea3){return _0xa57c58[_0x7198('0x19')](_0x4f8415);}return _0xa57c58[_0x7198('0x1a')](_0x4f8415)[_0x7198('0x1b')]();};}function respondWithResult(_0x34c387,_0x38f92e){_0x38f92e=_0x38f92e||0xc8;return function(_0x35f2b8){if(_0x35f2b8){return _0x34c387['status'](_0x38f92e)['json'](_0x35f2b8);}};}function respondWithFilteredResult(_0x46509e,_0x5f23af){return function(_0x316f1f){if(_0x316f1f){var _0x3ab8cb=typeof _0x5f23af[_0x7198('0x1c')]===_0x7198('0x1d')&&typeof _0x5f23af[_0x7198('0x1e')]===_0x7198('0x1d');var _0x164c3a=_0x316f1f[_0x7198('0x1f')];var _0x15e84e=_0x3ab8cb?0x0:_0x5f23af[_0x7198('0x1c')];var _0x3fb6ec=_0x3ab8cb?_0x316f1f['count']:_0x5f23af['offset']+_0x5f23af[_0x7198('0x1e')];var _0x2b07b9;if(_0x3fb6ec>=_0x164c3a){_0x3fb6ec=_0x164c3a;_0x2b07b9=0xc8;}else{_0x2b07b9=0xce;}_0x46509e[_0x7198('0x1a')](_0x2b07b9);return _0x46509e[_0x7198('0x20')](_0x7198('0x21'),_0x15e84e+'-'+_0x3fb6ec+'/'+_0x164c3a)[_0x7198('0x22')](_0x316f1f);}return null;};}function patchUpdates(_0x12571c){return function(_0x574d1a){try{jsonpatch[_0x7198('0x23')](_0x574d1a,_0x12571c,!![]);}catch(_0x175d93){return BPromise['reject'](_0x175d93);}return _0x574d1a[_0x7198('0x24')]();};}function saveUpdates(_0x83b08d,_0x2df6bc){return function(_0x10fcf4){if(_0x10fcf4){return _0x10fcf4[_0x7198('0x25')](_0x83b08d)[_0x7198('0x26')](function(_0x157308){return _0x157308;});}return null;};}function removeEntity(_0xb17ee0,_0xc2580f){return function(_0x4a5185){if(_0x4a5185){return _0x4a5185[_0x7198('0x27')]()[_0x7198('0x26')](function(){var _0x4925c5=_0x4a5185[_0x7198('0x28')]({'plain':!![]});var _0x466aea=_0x7198('0x29');return db[_0x7198('0x2a')][_0x7198('0x27')]({'where':{'type':_0x466aea,'resourceId':_0x4925c5['id']}})[_0x7198('0x26')](function(){return _0x4a5185;});})['then'](function(){_0xb17ee0[_0x7198('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ecb1a,_0x1d663e){return function(_0x57b5e1){if(!_0x57b5e1){_0x5ecb1a[_0x7198('0x19')](0x194);}return _0x57b5e1;};}function handleError(_0x2dc564,_0x4928d5){_0x4928d5=_0x4928d5||0x1f4;return function(_0x47e233){logger[_0x7198('0x2b')](_0x47e233[_0x7198('0x2c')]);if(_0x47e233['name']){delete _0x47e233[_0x7198('0x2d')];}_0x2dc564['status'](_0x4928d5)[_0x7198('0x2e')](_0x47e233);};}exports[_0x7198('0x2f')]=function(_0x4e505c,_0x239247){var _0x4c2f12={},_0x8391ee={},_0x38de97={'count':0x0,'rows':[]};var _0x12ead4=_[_0x7198('0x30')](db[_0x7198('0x31')]['rawAttributes'],function(_0x520dd2){return{'name':_0x520dd2[_0x7198('0x32')],'type':_0x520dd2[_0x7198('0x33')]['key']};});_0x8391ee['model']=_[_0x7198('0x30')](_0x12ead4,_0x7198('0x2d'));_0x8391ee['query']=_[_0x7198('0x34')](_0x4e505c[_0x7198('0x35')]);_0x8391ee[_0x7198('0x36')]=_[_0x7198('0x37')](_0x8391ee[_0x7198('0x38')],_0x8391ee[_0x7198('0x35')]);_0x4c2f12['attributes']=_[_0x7198('0x37')](_0x8391ee['model'],qs[_0x7198('0x39')](_0x4e505c[_0x7198('0x35')]['fields']));_0x4c2f12['attributes']=_0x4c2f12[_0x7198('0x3a')][_0x7198('0x3b')]?_0x4c2f12[_0x7198('0x3a')]:_0x8391ee[_0x7198('0x38')];if(!_0x4e505c[_0x7198('0x35')]['hasOwnProperty']('nolimit')){_0x4c2f12['limit']=qs[_0x7198('0x1e')](_0x4e505c[_0x7198('0x35')][_0x7198('0x1e')]);_0x4c2f12[_0x7198('0x1c')]=qs[_0x7198('0x1c')](_0x4e505c[_0x7198('0x35')][_0x7198('0x1c')]);}_0x4c2f12[_0x7198('0x3c')]=qs[_0x7198('0x3d')](_0x4e505c['query'][_0x7198('0x3d')]);_0x4c2f12[_0x7198('0x3e')]=qs[_0x7198('0x36')](_[_0x7198('0x3f')](_0x4e505c[_0x7198('0x35')],_0x8391ee[_0x7198('0x36')]),_0x12ead4);if(_0x4e505c[_0x7198('0x35')][_0x7198('0x40')]){_0x4c2f12[_0x7198('0x3e')]=_[_0x7198('0x41')](_0x4c2f12[_0x7198('0x3e')],{'$or':_['map'](_0x12ead4,function(_0x3790de){if(_0x3790de[_0x7198('0x33')]!==_0x7198('0x42')){var _0x401a49={};_0x401a49[_0x3790de[_0x7198('0x2d')]]={'$like':'%'+_0x4e505c[_0x7198('0x35')][_0x7198('0x40')]+'%'};return _0x401a49;}})});}_0x4c2f12=_[_0x7198('0x41')]({},_0x4c2f12,_0x4e505c[_0x7198('0x43')]);var _0x2925b9={'where':_0x4c2f12[_0x7198('0x3e')]};return db['Disposition'][_0x7198('0x1f')](_0x2925b9)[_0x7198('0x26')](function(_0x3cf416){_0x38de97['count']=_0x3cf416;if(_0x4e505c[_0x7198('0x35')][_0x7198('0x44')]){_0x4c2f12[_0x7198('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x7198('0x46')](_0x4c2f12);})['then'](function(_0x4f1980){_0x38de97['rows']=_0x4f1980;return _0x38de97;})['then'](respondWithFilteredResult(_0x239247,_0x4c2f12))[_0x7198('0x47')](handleError(_0x239247,null));};exports[_0x7198('0x48')]=function(_0x184ed9,_0xaae06f){var _0x368291={'raw':!![],'where':{'id':_0x184ed9[_0x7198('0x49')]['id']}},_0x3c4d42={};_0x3c4d42[_0x7198('0x38')]=_['keys'](db[_0x7198('0x31')]['rawAttributes']);_0x3c4d42['query']=_['keys'](_0x184ed9[_0x7198('0x35')]);_0x3c4d42[_0x7198('0x36')]=_[_0x7198('0x37')](_0x3c4d42[_0x7198('0x38')],_0x3c4d42[_0x7198('0x35')]);_0x368291[_0x7198('0x3a')]=_['intersection'](_0x3c4d42[_0x7198('0x38')],qs['fields'](_0x184ed9[_0x7198('0x35')]['fields']));_0x368291['attributes']=_0x368291['attributes'][_0x7198('0x3b')]?_0x368291[_0x7198('0x3a')]:_0x3c4d42['model'];if(_0x184ed9[_0x7198('0x35')][_0x7198('0x44')]){_0x368291[_0x7198('0x45')]=[{'all':!![]}];}_0x368291=_[_0x7198('0x41')]({},_0x368291,_0x184ed9[_0x7198('0x43')]);return db[_0x7198('0x31')][_0x7198('0x4a')](_0x368291)[_0x7198('0x26')](handleEntityNotFound(_0xaae06f,null))[_0x7198('0x26')](respondWithResult(_0xaae06f,null))['catch'](handleError(_0xaae06f,null));};exports[_0x7198('0x4b')]=function(_0x2b9ca0,_0x5630e8){return db[_0x7198('0x31')][_0x7198('0x4b')](_0x2b9ca0[_0x7198('0x4c')],{})[_0x7198('0x26')](function(_0x169958){var _0x3f54f0=_0x2b9ca0[_0x7198('0x4d')][_0x7198('0x28')]({'plain':!![]});if(!_0x3f54f0)throw new Error(_0x7198('0x4e'));if(_0x3f54f0[_0x7198('0x4f')]===_0x7198('0x4d')){var _0x533507=_0x169958['get']({'plain':!![]});var _0x411cd6='Dispositions';return db[_0x7198('0x50')][_0x7198('0x4a')]({'where':{'name':_0x411cd6,'userProfileId':_0x3f54f0[_0x7198('0x51')]},'raw':!![]})['then'](function(_0x2c1fb8){if(_0x2c1fb8&&_0x2c1fb8[_0x7198('0x52')]===0x0){return db['UserProfileResource'][_0x7198('0x4b')]({'name':_0x533507[_0x7198('0x2d')],'resourceId':_0x533507['id'],'type':_0x2c1fb8[_0x7198('0x2d')],'sectionId':_0x2c1fb8['id']},{})[_0x7198('0x26')](function(){return _0x169958;});}else{return _0x169958;}})['catch'](function(_0x35b073){logger[_0x7198('0x2b')](_0x7198('0x53'),_0x35b073);throw _0x35b073;});}return _0x169958;})[_0x7198('0x26')](respondWithResult(_0x5630e8,0xc9))[_0x7198('0x47')](handleError(_0x5630e8,null));};exports[_0x7198('0x25')]=function(_0x5c1e84,_0x249cf5){if(_0x5c1e84['body']['id']){delete _0x5c1e84[_0x7198('0x4c')]['id'];}return db['Disposition']['find']({'where':{'id':_0x5c1e84['params']['id']}})[_0x7198('0x26')](handleEntityNotFound(_0x249cf5,null))['then'](saveUpdates(_0x5c1e84[_0x7198('0x4c')],null))[_0x7198('0x26')](respondWithResult(_0x249cf5,null))[_0x7198('0x47')](handleError(_0x249cf5,null));};exports[_0x7198('0x27')]=function(_0x3dd77d,_0x418cda){return db[_0x7198('0x31')][_0x7198('0x4a')]({'where':{'id':_0x3dd77d['params']['id']}})['then'](handleEntityNotFound(_0x418cda,null))[_0x7198('0x26')](removeEntity(_0x418cda,null))[_0x7198('0x47')](handleError(_0x418cda,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b392db6..fb39404 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 _0x1712=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_sms','SmsAccountId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x21c31d,_0x593c9d){var _0x4a9a62=function(_0xcd04f8){while(--_0xcd04f8){_0x21c31d['push'](_0x21c31d['shift']());}};_0x4a9a62(++_0x593c9d);}(_0x1712,0x1cb));var _0x2171=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0x1712[_0x4599b6];return _0x2e014c;};'use strict';var _=require(_0x2171('0x0'));var util=require(_0x2171('0x1'));var logger=require(_0x2171('0x2'))(_0x2171('0x3'));var moment=require(_0x2171('0x4'));var BPromise=require(_0x2171('0x5'));var rp=require(_0x2171('0x6'));var fs=require('fs');var path=require(_0x2171('0x7'));var rimraf=require(_0x2171('0x8'));var config=require(_0x2171('0x9'));var attributes=require(_0x2171('0xa'));module['exports']=function(_0x510463,_0x32b695){return _0x510463[_0x2171('0xb')](_0x2171('0xc'),attributes,{'tableName':_0x2171('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2171('0xe'),'fields':[_0x2171('0xf'),_0x2171('0x10')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x2171('0xf'),'MailAccountId']},{'unique':!![],'name':_0x2171('0x11'),'fields':['name',_0x2171('0x12')]},{'unique':!![],'name':_0x2171('0x13'),'fields':[_0x2171('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x2171('0x14'),'fields':[_0x2171('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':_0x2171('0x15'),'fields':[_0x2171('0xf'),_0x2171('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d23=['../../config/environment','./disposition.attributes','exports','Disposition','name_voice','ListId','name_chat','name','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x39a167,_0x26dee0){var _0x2ffd9f=function(_0x458cf9){while(--_0x458cf9){_0x39a167['push'](_0x39a167['shift']());}};_0x2ffd9f(++_0x26dee0);}(_0x7d23,0x16a));var _0x37d2=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x7d23[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x37d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x37d2('0x1'));var moment=require('moment');var BPromise=require(_0x37d2('0x2'));var rp=require(_0x37d2('0x3'));var fs=require('fs');var path=require(_0x37d2('0x4'));var rimraf=require(_0x37d2('0x5'));var config=require(_0x37d2('0x6'));var attributes=require(_0x37d2('0x7'));module[_0x37d2('0x8')]=function(_0x1b1a43,_0x28dfb9){return _0x1b1a43['define'](_0x37d2('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x37d2('0xa'),'fields':['name',_0x37d2('0xb')]},{'unique':!![],'name':_0x37d2('0xc'),'fields':[_0x37d2('0xd'),_0x37d2('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x37d2('0xd'),_0x37d2('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x37d2('0xd'),_0x37d2('0x10')]},{'unique':!![],'name':_0x37d2('0x11'),'fields':[_0x37d2('0xd'),_0x37d2('0x12')]},{'unique':!![],'name':_0x37d2('0x13'),'fields':[_0x37d2('0xd'),_0x37d2('0x14')]},{'unique':!![],'name':_0x37d2('0x15'),'fields':[_0x37d2('0xd'),_0x37d2('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 382c951..14e8ff0 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(_0x58f2a8,_0xe38d57){var _0x71c657=function(_0x45423e){while(--_0x45423e){_0x58f2a8['push'](_0x58f2a8['shift']());}};_0x71c657(++_0xe38d57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x52361a,_0x255b8f){var _0x48ab86=function(_0x20d0b6){while(--_0x20d0b6){_0x52361a['push'](_0x52361a['shift']());}};_0x48ab86(++_0x255b8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 b11e87f..58e4ef8 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 _0xcd40=['post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated'];(function(_0xb62d2d,_0x583a4a){var _0x7607ed=function(_0x523cbf){while(--_0x523cbf){_0xb62d2d['push'](_0xb62d2d['shift']());}};_0x7607ed(++_0x583a4a);}(_0xcd40,0x101));var _0x0cd4=function(_0x56e4b7,_0x4c0b79){_0x56e4b7=_0x56e4b7-0x0;var _0x463c26=_0xcd40[_0x56e4b7];return _0x463c26;};'use strict';var multer=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var path=require(_0x0cd4('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cd4('0x3'));var router=express[_0x0cd4('0x4')]();var fs_extra=require(_0x0cd4('0x5'));var auth=require(_0x0cd4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cd4('0x7'));var controller=require(_0x0cd4('0x8'));router[_0x0cd4('0x9')]('/',auth['isAuthenticated'](),controller[_0x0cd4('0xa')]);router['get'](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller['show']);router[_0x0cd4('0xd')]('/',auth['isAuthenticated'](),controller[_0x0cd4('0xe')]);router[_0x0cd4('0xf')](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller[_0x0cd4('0x10')]);router[_0x0cd4('0x11')](_0x0cd4('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf113=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf113,0x74));var _0x3f11=function(_0x1d37cc,_0x11cc3b){_0x1d37cc=_0x1d37cc-0x0;var _0xd4def3=_0xf113[_0x1d37cc];return _0xd4def3;};'use strict';var multer=require('multer');var util=require(_0x3f11('0x0'));var path=require(_0x3f11('0x1'));var timeout=require(_0x3f11('0x2'));var express=require(_0x3f11('0x3'));var router=express[_0x3f11('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f11('0x5'));var interaction=require(_0x3f11('0x6'));var config=require(_0x3f11('0x7'));var controller=require(_0x3f11('0x8'));router[_0x3f11('0x9')]('/',auth[_0x3f11('0xa')](),controller[_0x3f11('0xb')]);router[_0x3f11('0x9')]('/:id',auth[_0x3f11('0xa')](),controller[_0x3f11('0xc')]);router[_0x3f11('0xd')]('/',auth[_0x3f11('0xa')](),controller[_0x3f11('0xe')]);router[_0x3f11('0xf')](_0x3f11('0x10'),auth[_0x3f11('0xa')](),controller['update']);router['delete'](_0x3f11('0x10'),auth[_0x3f11('0xa')](),controller[_0x3f11('0x11')]);module[_0x3f11('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a0fe815..e994ee6 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 _0x27ba=['2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x440bd8,_0x18535f){var _0x2ce946=function(_0x162a69){while(--_0x162a69){_0x440bd8['push'](_0x440bd8['shift']());}};_0x2ce946(++_0x18535f);}(_0x27ba,0xaf));var _0xa27b=function(_0x2b4605,_0x1d71b7){_0x2b4605=_0x2b4605-0x0;var _0x4beeda=_0x27ba[_0x2b4605];return _0x4beeda;};'use strict';var Sequelize=require(_0xa27b('0x0'));module[_0xa27b('0x1')]={'name':{'type':Sequelize[_0xa27b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa27b('0x2')]},'ecm':{'type':Sequelize[_0xa27b('0x3')](_0xa27b('0x4'),'no'),'defaultValue':_0xa27b('0x4')},'headerinfo':{'type':Sequelize[_0xa27b('0x2')],'defaultValue':_0xa27b('0x5')},'localstationid':{'type':Sequelize[_0xa27b('0x2')],'unique':_0xa27b('0x6')},'minrate':{'type':Sequelize[_0xa27b('0x3')](_0xa27b('0x7'),_0xa27b('0x8'),_0xa27b('0x9'),_0xa27b('0xa'),_0xa27b('0xb'),_0xa27b('0xc')),'defaultValue':_0xa27b('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0xa27b('0x7'),_0xa27b('0x8'),_0xa27b('0x9'),_0xa27b('0xa'),_0xa27b('0xb'),_0xa27b('0xc')),'defaultValue':_0xa27b('0xc')},'modem':{'type':Sequelize[_0xa27b('0x2')],'defaultValue':_0xa27b('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa27b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa27b('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa27b('0x3')](_0xa27b('0xf'),_0xa27b('0x10'),_0xa27b('0x11'),_0xa27b('0x12')),'defaultValue':_0xa27b('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa27b('0x13')],'defaultValue':function(){return _0xa27b('0x14');}},'notificationSound':{'type':Sequelize[_0xa27b('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa27b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa27b('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa27b('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa27b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa27b('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa27b('0x15')],'defaultValue':![],'comment':_0xa27b('0x16'),'set':function(_0x1e9444){if(!_0x1e9444)this[_0xa27b('0x17')](_0xa27b('0x18'),null);this[_0xa27b('0x17')](_0xa27b('0x19'),_0x1e9444);}}}; \ No newline at end of file +var _0x6665=['IAX','DADHI','SIP','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','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','ENUM','2400','4800','9600','12000','14400'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x6665,0x1ee));var _0x5666=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x6665[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require('sequelize');module[_0x5666('0x0')]={'name':{'type':Sequelize[_0x5666('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5666('0x1')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x5666('0x2')},'headerinfo':{'type':Sequelize[_0x5666('0x1')],'defaultValue':_0x5666('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5666('0x4')](_0x5666('0x5'),_0x5666('0x6'),'7200',_0x5666('0x7'),_0x5666('0x8'),'14400'),'defaultValue':_0x5666('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0x5666('0x5'),_0x5666('0x6'),'7200',_0x5666('0x7'),'12000',_0x5666('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x5666('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x5666('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5666('0x4')]('SIP',_0x5666('0xa'),_0x5666('0xb'),'KHOMP'),'defaultValue':_0x5666('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5666('0xd')],'defaultValue':function(){return _0x5666('0xe');}},'notificationSound':{'type':Sequelize[_0x5666('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5666('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5666('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5666('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5666('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5666('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5666('0x12'),'set':function(_0x419500){if(!_0x419500)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5666('0x13')](_0x5666('0x14'),_0x419500);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 30b949c..3e0c5ef 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 _0x39c0=['limit','set','Content-Range','json','apply','save','update','destroy','get','FaxAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','exten','localstationid','app','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','key','createdAt','findById','FaxMessage','$gte','format','send','CmList','List','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','fax','Contacts','ListId','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./faxAccount.socket','register','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','status','offset','undefined'];(function(_0x28c308,_0x18d33c){var _0x4c4dab=function(_0x369190){while(--_0x369190){_0x28c308['push'](_0x28c308['shift']());}};_0x4c4dab(++_0x18d33c);}(_0x39c0,0x152));var _0x039c=function(_0x3b0f02,_0x3b8b27){_0x3b0f02=_0x3b0f02-0x0;var _0x530b16=_0x39c0[_0x3b0f02];return _0x530b16;};'use strict';var emlformat=require(_0x039c('0x0'));var rimraf=require(_0x039c('0x1'));var zipdir=require(_0x039c('0x2'));var jsonpatch=require(_0x039c('0x3'));var rp=require(_0x039c('0x4'));var moment=require(_0x039c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x039c('0x6'));var util=require(_0x039c('0x7'));var path=require('path');var sox=require(_0x039c('0x8'));var csv=require(_0x039c('0x9'));var ejs=require(_0x039c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x039c('0xb'));var crypto=require(_0x039c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x039c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x039c('0xe'));var authService=require(_0x039c('0xf'));var qs=require(_0x039c('0x10'));var as=require(_0x039c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x039c('0x12'))(_0x039c('0x13'));var utils=require(_0x039c('0x14'));var config=require(_0x039c('0x15'));var licenseUtil=require(_0x039c('0x16'));var db=require(_0x039c('0x17'))['db'];config['redis']=_[_0x039c('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x039c('0x19'))(new Redis(config['redis']));require(_0x039c('0x1a'))[_0x039c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x039c('0x1c')]({'port':0x232c});var client9002=jayson[_0x039c('0x1d')][_0x039c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1ddeff,_0x46bbb3,_0x3a26f9,_0x436c1b){return new BPromise(function(_0x472fab,_0x148664){var _0x58d3b9=_0x436c1b||client;return _0x58d3b9[_0x039c('0x1e')](_0x1ddeff,_0x3a26f9)[_0x039c('0x1f')](function(_0x675609){logger[_0x039c('0x20')](_0x039c('0x21'),_0x46bbb3,'request\x20sent');logger[_0x039c('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x46bbb3,'request\x20sent',JSON[_0x039c('0x23')](_0x675609));if(_0x675609['error']){if(_0x675609[_0x039c('0x24')][_0x039c('0x25')]===0x1f4){logger[_0x039c('0x24')](_0x039c('0x21'),_0x46bbb3,_0x675609['error'][_0x039c('0x26')]);return _0x148664(_0x675609[_0x039c('0x24')][_0x039c('0x26')]);}logger[_0x039c('0x24')]('FaxAccount,\x20%s,\x20%s',_0x46bbb3,_0x675609[_0x039c('0x24')][_0x039c('0x26')]);return _0x472fab(_0x675609[_0x039c('0x24')][_0x039c('0x26')]);}else{logger[_0x039c('0x20')](_0x039c('0x21'),_0x46bbb3,'request\x20sent');_0x472fab(_0x675609[_0x039c('0x27')][_0x039c('0x26')]);}})[_0x039c('0x28')](function(_0x558e3d){logger[_0x039c('0x24')](_0x039c('0x21'),_0x46bbb3,_0x558e3d);_0x148664(_0x558e3d);});});}function respondWithStatusCode(_0x20bd8a,_0xeff49b){_0xeff49b=_0xeff49b||0xcc;return function(_0x172a1f){if(_0x172a1f){return _0x20bd8a['sendStatus'](_0xeff49b);}return _0x20bd8a[_0x039c('0x29')](_0xeff49b)['end']();};}function respondWithResult(_0x23c0cb,_0x103f84){_0x103f84=_0x103f84||0xc8;return function(_0x388e07){if(_0x388e07){return _0x23c0cb[_0x039c('0x29')](_0x103f84)['json'](_0x388e07);}};}function respondWithFilteredResult(_0x574c94,_0x224104){return function(_0x2e2bd0){if(_0x2e2bd0){var _0x2b51f3=typeof _0x224104[_0x039c('0x2a')]===_0x039c('0x2b')&&typeof _0x224104[_0x039c('0x2c')]===_0x039c('0x2b');var _0x30b626=_0x2e2bd0['count'];var _0x5dbd4d=_0x2b51f3?0x0:_0x224104['offset'];var _0x47703f=_0x2b51f3?_0x2e2bd0['count']:_0x224104[_0x039c('0x2a')]+_0x224104[_0x039c('0x2c')];var _0x410cec;if(_0x47703f>=_0x30b626){_0x47703f=_0x30b626;_0x410cec=0xc8;}else{_0x410cec=0xce;}_0x574c94[_0x039c('0x29')](_0x410cec);return _0x574c94[_0x039c('0x2d')](_0x039c('0x2e'),_0x5dbd4d+'-'+_0x47703f+'/'+_0x30b626)[_0x039c('0x2f')](_0x2e2bd0);}return null;};}function patchUpdates(_0x36634d){return function(_0x3bced8){try{jsonpatch[_0x039c('0x30')](_0x3bced8,_0x36634d,!![]);}catch(_0x594adb){return BPromise['reject'](_0x594adb);}return _0x3bced8[_0x039c('0x31')]();};}function saveUpdates(_0x36dfd8,_0x210ec1){return function(_0x16f47c){if(_0x16f47c){return _0x16f47c[_0x039c('0x32')](_0x36dfd8)[_0x039c('0x1f')](function(_0x13b75c){return _0x13b75c;});}return null;};}function removeEntity(_0x2180a0,_0x7e534d){return function(_0x53b1ea){if(_0x53b1ea){return _0x53b1ea[_0x039c('0x33')]()[_0x039c('0x1f')](function(){var _0x2b3180=_0x53b1ea[_0x039c('0x34')]({'plain':!![]});var _0x368b08=_0x039c('0x35');return db['UserProfileResource'][_0x039c('0x33')]({'where':{'type':_0x368b08,'resourceId':_0x2b3180['id']}})['then'](function(){return _0x53b1ea;});})[_0x039c('0x1f')](function(){_0x2180a0[_0x039c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ad4bc,_0x12f13f){return function(_0x17cced){if(!_0x17cced){_0x2ad4bc['sendStatus'](0x194);}return _0x17cced;};}function handleError(_0x579129,_0x2ed6a9){_0x2ed6a9=_0x2ed6a9||0x1f4;return function(_0xce31ae){logger[_0x039c('0x24')](_0xce31ae[_0x039c('0x36')]);if(_0xce31ae[_0x039c('0x37')]){delete _0xce31ae['name'];}_0x579129['status'](_0x2ed6a9)['send'](_0xce31ae);};}exports[_0x039c('0x38')]=function(_0x44f9f3,_0x3e0428){var _0x30a0bc={'include':[{'model':db[_0x039c('0x39')],'as':_0x039c('0x3a')}]},_0x5885f9={},_0x1c1c9e={'count':0x0,'rows':[]};var _0xe75a8e=_[_0x039c('0x3b')](db[_0x039c('0x3c')][_0x039c('0x3d')],function(_0x9c60b){return{'name':_0x9c60b['fieldName'],'type':_0x9c60b[_0x039c('0x3e')]['key']};});_0x5885f9[_0x039c('0x3f')]=_[_0x039c('0x3b')](_0xe75a8e,'name');_0x5885f9[_0x039c('0x40')]=_[_0x039c('0x41')](_0x44f9f3[_0x039c('0x40')]);_0x5885f9['filters']=_['intersection'](_0x5885f9[_0x039c('0x3f')],_0x5885f9['query']);_0x30a0bc[_0x039c('0x42')]=_[_0x039c('0x43')](_0x5885f9['model'],qs[_0x039c('0x44')](_0x44f9f3['query']['fields']));_0x30a0bc[_0x039c('0x42')]=_0x30a0bc[_0x039c('0x42')][_0x039c('0x45')]?_0x30a0bc[_0x039c('0x42')]:_0x5885f9[_0x039c('0x3f')];if(!_0x44f9f3[_0x039c('0x40')][_0x039c('0x46')](_0x039c('0x47'))){_0x30a0bc[_0x039c('0x2c')]=qs[_0x039c('0x2c')](_0x44f9f3[_0x039c('0x40')]['limit']);_0x30a0bc[_0x039c('0x2a')]=qs['offset'](_0x44f9f3[_0x039c('0x40')][_0x039c('0x2a')]);}_0x30a0bc[_0x039c('0x48')]=qs[_0x039c('0x49')](_0x44f9f3[_0x039c('0x40')][_0x039c('0x49')]);_0x30a0bc[_0x039c('0x4a')]=qs[_0x039c('0x4b')](_[_0x039c('0x4c')](_0x44f9f3[_0x039c('0x40')],_0x5885f9[_0x039c('0x4b')]),_0xe75a8e);if(_0x44f9f3[_0x039c('0x40')][_0x039c('0x4d')]){_0x30a0bc['where']=_['merge'](_0x30a0bc['where'],{'$or':_[_0x039c('0x3b')](_0xe75a8e,function(_0x1fb964){if(_0x1fb964[_0x039c('0x3e')]!==_0x039c('0x4e')){var _0x1ba86e={};_0x1ba86e[_0x1fb964[_0x039c('0x37')]]={'$like':'%'+_0x44f9f3[_0x039c('0x40')]['filter']+'%'};return _0x1ba86e;}})});}_0x30a0bc=_[_0x039c('0x4f')]({},_0x30a0bc,_0x44f9f3[_0x039c('0x50')]);var _0x268070={'where':_0x30a0bc[_0x039c('0x4a')]};return db[_0x039c('0x3c')][_0x039c('0x51')](_0x268070)[_0x039c('0x1f')](function(_0x439417){_0x1c1c9e[_0x039c('0x51')]=_0x439417;if(_0x44f9f3['query'][_0x039c('0x52')]){_0x30a0bc[_0x039c('0x53')]=[{'all':!![]}];}return db[_0x039c('0x3c')]['findAll'](_0x30a0bc);})[_0x039c('0x1f')](function(_0x3e49e2){_0x1c1c9e[_0x039c('0x54')]=_0x3e49e2;return _0x1c1c9e;})['then'](respondWithFilteredResult(_0x3e0428,_0x30a0bc))['catch'](handleError(_0x3e0428,null));};exports['show']=function(_0x45c05f,_0x11b6d1){var _0x3f2615={'raw':![],'where':{'id':_0x45c05f[_0x039c('0x55')]['id']},'include':[{'model':db[_0x039c('0x39')],'as':_0x039c('0x3a')}]},_0x9c276b={};_0x9c276b[_0x039c('0x3f')]=_[_0x039c('0x41')](db[_0x039c('0x3c')][_0x039c('0x3d')]);_0x9c276b[_0x039c('0x40')]=_[_0x039c('0x41')](_0x45c05f['query']);_0x9c276b['filters']=_[_0x039c('0x43')](_0x9c276b[_0x039c('0x3f')],_0x9c276b[_0x039c('0x40')]);_0x3f2615[_0x039c('0x42')]=_[_0x039c('0x43')](_0x9c276b['model'],qs[_0x039c('0x44')](_0x45c05f[_0x039c('0x40')][_0x039c('0x44')]));_0x3f2615['attributes']=_0x3f2615[_0x039c('0x42')][_0x039c('0x45')]?_0x3f2615[_0x039c('0x42')]:_0x9c276b['model'];if(_0x45c05f[_0x039c('0x40')]['includeAll']){_0x3f2615[_0x039c('0x53')]=[{'all':!![]}];}_0x3f2615=_[_0x039c('0x4f')]({},_0x3f2615,_0x45c05f[_0x039c('0x50')]);return db[_0x039c('0x3c')][_0x039c('0x56')](_0x3f2615)[_0x039c('0x1f')](handleEntityNotFound(_0x11b6d1,null))['then'](respondWithResult(_0x11b6d1,null))[_0x039c('0x28')](handleError(_0x11b6d1,null));};exports[_0x039c('0x57')]=function(_0x2c79b2,_0x3357da){return db['FaxAccount']['create'](_0x2c79b2['body'],{})[_0x039c('0x1f')](function(_0x40081b){var _0x1458b9=_0x2c79b2[_0x039c('0x58')][_0x039c('0x34')]({'plain':!![]});if(!_0x1458b9)throw new Error(_0x039c('0x59'));if(_0x1458b9['role']==='user'){var _0x59ae8a=_0x40081b[_0x039c('0x34')]({'plain':!![]});var _0xe1d3e2='FaxAccounts';return db[_0x039c('0x5a')][_0x039c('0x56')]({'where':{'name':_0xe1d3e2,'userProfileId':_0x1458b9[_0x039c('0x5b')]},'raw':!![]})[_0x039c('0x1f')](function(_0x1b62e8){if(_0x1b62e8&&_0x1b62e8['autoAssociation']===0x0){return db[_0x039c('0x5c')][_0x039c('0x57')]({'name':_0x59ae8a[_0x039c('0x37')],'resourceId':_0x59ae8a['id'],'type':_0x1b62e8[_0x039c('0x37')],'sectionId':_0x1b62e8['id']},{})['then'](function(){return _0x40081b;});}else{return _0x40081b;}})[_0x039c('0x28')](function(_0x400e29){logger[_0x039c('0x24')](_0x039c('0x5d'),_0x400e29);throw _0x400e29;});}return _0x40081b;})[_0x039c('0x1f')](respondWithResult(_0x3357da,0xc9))[_0x039c('0x28')](handleError(_0x3357da,null));};exports[_0x039c('0x32')]=function(_0x2b856d,_0x46285e){if(_0x2b856d['body']['id']){delete _0x2b856d[_0x039c('0x5e')]['id'];}return db[_0x039c('0x3c')][_0x039c('0x56')]({'where':{'id':_0x2b856d[_0x039c('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x039c('0x3a')}]})[_0x039c('0x1f')](handleEntityNotFound(_0x46285e,null))[_0x039c('0x1f')](saveUpdates(_0x2b856d[_0x039c('0x5e')],null))['then'](respondWithResult(_0x46285e,null))[_0x039c('0x28')](handleError(_0x46285e,null));};exports[_0x039c('0x33')]=function(_0x1b6c00,_0x3e196d){return db[_0x039c('0x3c')][_0x039c('0x56')]({'where':{'id':_0x1b6c00[_0x039c('0x55')]['id']}})['then'](handleEntityNotFound(_0x3e196d,null))[_0x039c('0x1f')](removeEntity(_0x3e196d,null))[_0x039c('0x28')](handleError(_0x3e196d,null));};exports['describe']=function(_0x128be4,_0x56797d){return db[_0x039c('0x3c')][_0x039c('0x5f')]()['then'](respondWithResult(_0x56797d,null))['catch'](handleError(_0x56797d,null));};exports['addDisposition']=function(_0x53feed,_0x21f71e,_0x714e91){if(_0x53feed['body']['id']){delete _0x53feed[_0x039c('0x5e')]['id'];}return db[_0x039c('0x3c')][_0x039c('0x56')]({'where':{'id':_0x53feed[_0x039c('0x55')]['id']}})['then'](handleEntityNotFound(_0x21f71e,null))[_0x039c('0x1f')](function(_0x3a2ff2){if(_0x3a2ff2){_0x53feed[_0x039c('0x5e')][_0x039c('0x60')]=_0x3a2ff2['id'];return db[_0x039c('0x61')][_0x039c('0x57')](_0x53feed['body']);}})['then'](respondWithResult(_0x21f71e,null))[_0x039c('0x28')](handleError(_0x21f71e,null));};exports[_0x039c('0x62')]=function(_0x5d2c0b,_0x165b84,_0x4e3cf6){var _0x25d3fe={'raw':![],'where':{}};var _0x3fb4ef={};var _0xb0cfd9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x039c('0x63')]({'where':{'id':_0x5d2c0b[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x165b84,null))[_0x039c('0x1f')](function(_0x487d7b){if(_0x487d7b){_0x3fb4ef[_0x039c('0x3f')]=_[_0x039c('0x41')](db['Disposition'][_0x039c('0x3d')]);_0x3fb4ef[_0x039c('0x40')]=_[_0x039c('0x41')](_0x5d2c0b[_0x039c('0x40')]);_0x3fb4ef[_0x039c('0x4b')]=_[_0x039c('0x43')](_0x3fb4ef['model'],_0x3fb4ef['query']);_0x25d3fe[_0x039c('0x42')]=_[_0x039c('0x43')](_0x3fb4ef[_0x039c('0x3f')],qs[_0x039c('0x44')](_0x5d2c0b[_0x039c('0x40')][_0x039c('0x44')]));_0x25d3fe['attributes']=_0x25d3fe[_0x039c('0x42')][_0x039c('0x45')]?_0x25d3fe[_0x039c('0x42')]:_0x3fb4ef['model'];if(!_0x5d2c0b[_0x039c('0x40')]['hasOwnProperty'](_0x039c('0x47'))){_0x25d3fe['limit']=qs['limit'](_0x5d2c0b[_0x039c('0x40')]['limit']);_0x25d3fe[_0x039c('0x2a')]=qs[_0x039c('0x2a')](_0x5d2c0b[_0x039c('0x40')][_0x039c('0x2a')]);}_0x25d3fe['order']=qs[_0x039c('0x49')](_0x5d2c0b[_0x039c('0x40')]['sort']);_0x25d3fe[_0x039c('0x4a')]=qs[_0x039c('0x4b')](_[_0x039c('0x4c')](_0x5d2c0b['query'],_0x3fb4ef[_0x039c('0x4b')]));_0x25d3fe[_0x039c('0x4a')][_0x039c('0x60')]=_0x487d7b['id'];if(_0x5d2c0b['query'][_0x039c('0x4d')]){_0x25d3fe[_0x039c('0x4a')]=_['merge'](_0x25d3fe[_0x039c('0x4a')],{'$or':_['map'](_0x25d3fe[_0x039c('0x42')],function(_0x2b8c7f){var _0x26d7fb={};_0x26d7fb[_0x2b8c7f]={'$like':'%'+_0x5d2c0b[_0x039c('0x40')]['filter']+'%'};return _0x26d7fb;})});}_0x25d3fe=_[_0x039c('0x4f')]({},_0x25d3fe,_0x5d2c0b[_0x039c('0x50')]);return db[_0x039c('0x61')]['count']({'where':_0x25d3fe[_0x039c('0x4a')]})[_0x039c('0x1f')](function(_0x36cabb){_0xb0cfd9['count']=_0x36cabb;if(_0x5d2c0b['query'][_0x039c('0x52')]){_0x25d3fe[_0x039c('0x53')]=[{'all':!![]}];}return db[_0x039c('0x61')][_0x039c('0x64')](_0x25d3fe);})['then'](function(_0x51ec7b){_0xb0cfd9[_0x039c('0x54')]=_0x51ec7b;return _0xb0cfd9;});}})[_0x039c('0x1f')](respondWithFilteredResult(_0x165b84,_0x25d3fe))['catch'](handleError(_0x165b84,null));};exports[_0x039c('0x65')]=function(_0x1439c9,_0x6b09df,_0x412c18){return db[_0x039c('0x3c')][_0x039c('0x56')]({'where':{'id':_0x1439c9[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x6b09df,null))['then'](function(_0x3acaf7){if(_0x3acaf7){return _0x3acaf7[_0x039c('0x65')](_0x1439c9[_0x039c('0x40')]['ids']);}})[_0x039c('0x1f')](respondWithStatusCode(_0x6b09df,null))[_0x039c('0x28')](handleError(_0x6b09df,null));};exports[_0x039c('0x66')]=function(_0x1fc819,_0x162917,_0xa352d){if(_0x1fc819[_0x039c('0x5e')]['id']){delete _0x1fc819[_0x039c('0x5e')]['id'];}return db['FaxAccount'][_0x039c('0x56')]({'where':{'id':_0x1fc819[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x162917,null))[_0x039c('0x1f')](function(_0x145394){if(_0x145394){_0x1fc819[_0x039c('0x5e')][_0x039c('0x60')]=_0x145394['id'];return db[_0x039c('0x67')][_0x039c('0x57')](_0x1fc819[_0x039c('0x5e')]);}})[_0x039c('0x1f')](respondWithResult(_0x162917,null))[_0x039c('0x28')](handleError(_0x162917,null));};exports[_0x039c('0x68')]=function(_0x389f5f,_0x4df9e8,_0x431e0f){var _0x4e7b3c={'raw':![],'where':{}};var _0xbe3704={};var _0x26a27c={'count':0x0,'rows':[]};return db[_0x039c('0x3c')][_0x039c('0x63')]({'where':{'id':_0x389f5f[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x4df9e8,null))[_0x039c('0x1f')](function(_0x85d558){if(_0x85d558){_0xbe3704['model']=_[_0x039c('0x41')](db[_0x039c('0x67')]['rawAttributes']);_0xbe3704['query']=_[_0x039c('0x41')](_0x389f5f['query']);_0xbe3704[_0x039c('0x4b')]=_[_0x039c('0x43')](_0xbe3704[_0x039c('0x3f')],_0xbe3704[_0x039c('0x40')]);_0x4e7b3c[_0x039c('0x42')]=_['intersection'](_0xbe3704[_0x039c('0x3f')],qs[_0x039c('0x44')](_0x389f5f[_0x039c('0x40')][_0x039c('0x44')]));_0x4e7b3c['attributes']=_0x4e7b3c[_0x039c('0x42')][_0x039c('0x45')]?_0x4e7b3c[_0x039c('0x42')]:_0xbe3704['model'];if(!_0x389f5f['query'][_0x039c('0x46')]('nolimit')){_0x4e7b3c[_0x039c('0x2c')]=qs[_0x039c('0x2c')](_0x389f5f['query'][_0x039c('0x2c')]);_0x4e7b3c['offset']=qs['offset'](_0x389f5f['query'][_0x039c('0x2a')]);}_0x4e7b3c['order']=qs[_0x039c('0x49')](_0x389f5f[_0x039c('0x40')][_0x039c('0x49')]);_0x4e7b3c[_0x039c('0x4a')]=qs['filters'](_[_0x039c('0x4c')](_0x389f5f[_0x039c('0x40')],_0xbe3704[_0x039c('0x4b')]));_0x4e7b3c['where'][_0x039c('0x60')]=_0x85d558['id'];if(_0x389f5f[_0x039c('0x40')]['filter']){_0x4e7b3c[_0x039c('0x4a')]=_[_0x039c('0x4f')](_0x4e7b3c[_0x039c('0x4a')],{'$or':_[_0x039c('0x3b')](_0x4e7b3c['attributes'],function(_0xbfcf4e){var _0x1c7e78={};_0x1c7e78[_0xbfcf4e]={'$like':'%'+_0x389f5f[_0x039c('0x40')][_0x039c('0x4d')]+'%'};return _0x1c7e78;})});}_0x4e7b3c=_['merge']({},_0x4e7b3c,_0x389f5f[_0x039c('0x50')]);return db[_0x039c('0x67')][_0x039c('0x51')]({'where':_0x4e7b3c[_0x039c('0x4a')]})['then'](function(_0x1c5091){_0x26a27c[_0x039c('0x51')]=_0x1c5091;if(_0x389f5f[_0x039c('0x40')][_0x039c('0x52')]){_0x4e7b3c[_0x039c('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x039c('0x64')](_0x4e7b3c);})[_0x039c('0x1f')](function(_0x5918d1){_0x26a27c[_0x039c('0x54')]=_0x5918d1;return _0x26a27c;});}})[_0x039c('0x1f')](respondWithFilteredResult(_0x4df9e8,_0x4e7b3c))['catch'](handleError(_0x4df9e8,null));};exports[_0x039c('0x69')]=function(_0x5b0624,_0x46221a,_0x78e2c2){return db['FaxAccount'][_0x039c('0x56')]({'where':{'id':_0x5b0624[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x46221a,null))[_0x039c('0x1f')](function(_0x3b6f27){if(_0x3b6f27){return _0x3b6f27[_0x039c('0x69')](_0x5b0624[_0x039c('0x40')]['ids']);}})[_0x039c('0x1f')](respondWithStatusCode(_0x46221a,null))[_0x039c('0x28')](handleError(_0x46221a,null));};exports[_0x039c('0x6a')]=function(_0x193039,_0x1b430c,_0x31b96d){return db[_0x039c('0x6b')][_0x039c('0x56')]({'where':{'id':_0x193039[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x1b430c,null))[_0x039c('0x1f')](function(_0x372526){if(_0x372526){return _0x372526[_0x039c('0x6a')](_0x193039[_0x039c('0x5e')][_0x039c('0x6c')],_[_0x039c('0x6d')](_0x193039['body'],[_0x039c('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x1b430c,null))[_0x039c('0x28')](handleError(_0x1b430c,null));};exports[_0x039c('0x6e')]=function(_0x185033,_0x59c860,_0x4d6ad2){var _0x52223b={'raw':![],'where':{}};var _0x1de322={};var _0x31190a={'count':0x0,'rows':[]};return db[_0x039c('0x3c')][_0x039c('0x63')]({'where':{'id':_0x185033[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x59c860,null))[_0x039c('0x1f')](function(_0x52f18d){if(_0x52f18d){_0x1de322[_0x039c('0x3f')]=_[_0x039c('0x41')](db[_0x039c('0x6b')][_0x039c('0x3d')]);_0x1de322[_0x039c('0x40')]=_[_0x039c('0x41')](_0x185033[_0x039c('0x40')]);_0x1de322[_0x039c('0x4b')]=_['intersection'](_0x1de322[_0x039c('0x3f')],_0x1de322[_0x039c('0x40')]);_0x52223b['attributes']=_[_0x039c('0x43')](_0x1de322[_0x039c('0x3f')],qs[_0x039c('0x44')](_0x185033['query'][_0x039c('0x44')]));_0x52223b[_0x039c('0x42')]=_0x52223b[_0x039c('0x42')][_0x039c('0x45')]?_0x52223b[_0x039c('0x42')]:_0x1de322[_0x039c('0x3f')];if(!_0x185033['query'][_0x039c('0x46')](_0x039c('0x47'))){_0x52223b[_0x039c('0x2c')]=qs[_0x039c('0x2c')](_0x185033[_0x039c('0x40')]['limit']);_0x52223b[_0x039c('0x2a')]=qs[_0x039c('0x2a')](_0x185033[_0x039c('0x40')][_0x039c('0x2a')]);}_0x52223b['order']=qs[_0x039c('0x49')](_0x185033[_0x039c('0x40')][_0x039c('0x49')]);_0x52223b['where']=qs[_0x039c('0x4b')](_[_0x039c('0x4c')](_0x185033[_0x039c('0x40')],_0x1de322[_0x039c('0x4b')]));_0x52223b['where'][_0x039c('0x60')]=_0x52f18d['id'];if(_0x185033[_0x039c('0x40')][_0x039c('0x4d')]){_0x52223b[_0x039c('0x4a')]=_[_0x039c('0x4f')](_0x52223b[_0x039c('0x4a')],{'$or':_['map'](_0x52223b[_0x039c('0x42')],function(_0x47e432){var _0x5395f7={};_0x5395f7[_0x47e432]={'$like':'%'+_0x185033[_0x039c('0x40')][_0x039c('0x4d')]+'%'};return _0x5395f7;})});}_0x52223b=_['merge']({},_0x52223b,_0x185033['options']);return db['FaxInteraction'][_0x039c('0x51')]({'where':_0x52223b[_0x039c('0x4a')]})[_0x039c('0x1f')](function(_0x32f886){_0x31190a['count']=_0x32f886;if(_0x185033[_0x039c('0x40')][_0x039c('0x52')]){_0x52223b[_0x039c('0x53')]=[{'model':db[_0x039c('0x6f')],'as':_0x039c('0x70'),'required':![]},{'model':db[_0x039c('0x71')],'as':_0x039c('0x72'),'attributes':[_0x039c('0x37'),_0x039c('0x73'),'internal'],'required':![]},{'model':db[_0x039c('0x74')],'as':_0x039c('0x75'),'attributes':['id',_0x039c('0x37'),_0x039c('0x76')],'where':_0x185033[_0x039c('0x40')][_0x039c('0x77')]?{'id':_0x185033['query'][_0x039c('0x77')]}:undefined,'required':_0x185033[_0x039c('0x40')][_0x039c('0x77')]?!![]:![]}];}return db[_0x039c('0x6b')][_0x039c('0x64')](_0x52223b);})['then'](function(_0x475dfa){_0x31190a[_0x039c('0x54')]=_0x475dfa;return _0x31190a;});}})['then'](respondWithFilteredResult(_0x59c860,_0x52223b))[_0x039c('0x28')](handleError(_0x59c860,null));};exports[_0x039c('0x78')]=function(_0x17eb58,_0x5a2e60,_0x13fddc){return db['FaxAccount']['findOne']({'where':{'id':_0x17eb58[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x5a2e60,null))[_0x039c('0x1f')](function(_0x41c5f9){if(_0x41c5f9){return db['sequelize'][_0x039c('0x79')](function(_0xade9a1){return db[_0x039c('0x7a')][_0x039c('0x33')]({'where':{'FaxAccountId':_0x17eb58[_0x039c('0x55')]['id']},'transaction':_0xade9a1})[_0x039c('0x1f')](function(_0x5f5460){var _0x290a96=_[_0x039c('0x3b')](_0x17eb58['body'],function(_0x1dbee6){_0x1dbee6['FaxAccountId']=_0x17eb58[_0x039c('0x55')]['id'];return _0x1dbee6;});return db[_0x039c('0x7a')][_0x039c('0x7b')](_0x290a96,{'transaction':_0xade9a1});});})[_0x039c('0x1f')](function(){return db[_0x039c('0x7a')][_0x039c('0x7c')]({'where':{'FaxAccountId':_0x17eb58['params']['id']},'order':'priority'});});}})[_0x039c('0x1f')](respondWithResult(_0x5a2e60,null))[_0x039c('0x28')](handleError(_0x5a2e60,null));};exports[_0x039c('0x7d')]=function(_0x16dd01,_0x44b51f,_0x4d4e5c){var _0x338796={};var _0x55dd9b={};var _0x947aef;var _0x405700;return db[_0x039c('0x3c')][_0x039c('0x63')]({'where':{'id':_0x16dd01[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x44b51f,null))[_0x039c('0x1f')](function(_0x172bf0){if(_0x172bf0){_0x947aef=_0x172bf0;_0x55dd9b[_0x039c('0x3f')]=_[_0x039c('0x41')](db[_0x039c('0x7a')][_0x039c('0x3d')]);_0x55dd9b[_0x039c('0x40')]=_[_0x039c('0x41')](_0x16dd01[_0x039c('0x40')]);_0x55dd9b[_0x039c('0x4b')]=_[_0x039c('0x43')](_0x55dd9b['model'],_0x55dd9b['query']);_0x338796[_0x039c('0x42')]=_[_0x039c('0x43')](_0x55dd9b[_0x039c('0x3f')],qs['fields'](_0x16dd01[_0x039c('0x40')][_0x039c('0x44')]));_0x338796['attributes']=_0x338796['attributes'][_0x039c('0x45')]?_0x338796['attributes']:_0x55dd9b[_0x039c('0x3f')];_0x338796[_0x039c('0x48')]=qs[_0x039c('0x49')](_0x16dd01[_0x039c('0x40')][_0x039c('0x49')]);_0x338796[_0x039c('0x4a')]=qs['filters'](_[_0x039c('0x4c')](_0x16dd01[_0x039c('0x40')],_0x55dd9b['filters']));if(_0x16dd01[_0x039c('0x40')][_0x039c('0x4d')]){_0x338796['where']=_[_0x039c('0x4f')](_0x338796['where'],{'$or':_[_0x039c('0x3b')](_0x338796[_0x039c('0x42')],function(_0x1d6e84){var _0x4ccf47={};_0x4ccf47[_0x1d6e84]={'$like':'%'+_0x16dd01[_0x039c('0x40')]['filter']+'%'};return _0x4ccf47;})});}_0x338796=_[_0x039c('0x4f')]({},_0x338796,_0x16dd01[_0x039c('0x50')]);return _0x947aef[_0x039c('0x7d')](_0x338796);}})['then'](function(_0xf84887){if(_0xf84887){_0x405700=_0xf84887[_0x039c('0x45')];if(!_0x16dd01[_0x039c('0x40')][_0x039c('0x46')]('nolimit')){_0x338796[_0x039c('0x2c')]=qs['limit'](_0x16dd01[_0x039c('0x40')][_0x039c('0x2c')]);_0x338796[_0x039c('0x2a')]=qs[_0x039c('0x2a')](_0x16dd01[_0x039c('0x40')][_0x039c('0x2a')]);}return _0x947aef[_0x039c('0x7d')](_0x338796);}})[_0x039c('0x1f')](function(_0x58ad21){if(_0x58ad21){return _0x58ad21?{'count':_0x405700,'rows':_0x58ad21}:null;}})[_0x039c('0x1f')](respondWithResult(_0x44b51f,null))[_0x039c('0x28')](handleError(_0x44b51f,null));};function Extension(_0x3e3de0,_0x4604b2,_0x446cd0,_0x1c7c2c){this[_0x039c('0x7e')]='from-voip-provider';this[_0x039c('0x7f')]=_0x3e3de0[_0x039c('0x80')];this[_0x039c('0x81')]=_0x1c7c2c;this[_0x039c('0x3e')]='system';this['description']=_0x039c('0x82');this[_0x039c('0x60')]=_0x3e3de0['id'];this[_0x039c('0x83')]=_0x4604b2;this[_0x039c('0x84')]=_0x446cd0;}function createExtensionsReciveFax(_0x49d0d8){var _0x5a47cb=0x1;var _0x8fa32=[];_0x8fa32[_0x039c('0x85')](new Extension(_0x49d0d8,_0x5a47cb,'',_0x039c('0x86')));_0x5a47cb+=0x1;_0x8fa32['push'](new Extension(_0x49d0d8,_0x5a47cb,_0x039c('0x87'),_0x039c('0x88')));_0x5a47cb+=0x1;for(var _0x4fef8c in _0x49d0d8){if(_0x49d0d8[_0x039c('0x46')](_0x4fef8c)&&(_0x4fef8c===_0x039c('0x89')||_0x4fef8c==='localstationid'||_0x4fef8c===_0x039c('0x8a')||_0x4fef8c===_0x039c('0x8b')||_0x4fef8c==='headerinfo'||_0x4fef8c===_0x039c('0x8c')||_0x4fef8c===_0x039c('0x8d')||_0x4fef8c===_0x039c('0x8e')||_0x4fef8c===_0x039c('0x8f'))){_0x8fa32['push'](new Extension(_0x49d0d8,_0x5a47cb,_0x039c('0x90')+_0x4fef8c+')='+_0x49d0d8[_0x4fef8c],_0x039c('0x88')));_0x5a47cb+=0x1;}}_0x8fa32['push'](new Extension(_0x49d0d8,_0x5a47cb,'6',_0x039c('0x91')));_0x5a47cb+=0x1;_0x8fa32['push'](new Extension(_0x49d0d8,_0x5a47cb,_0x039c('0x92'),_0x039c('0x93')));_0x5a47cb=0x0;return _0x8fa32;}exports[_0x039c('0x94')]=function(_0x3be245,_0x2be484,_0x36e3cb){var _0x1228a5;return db[_0x039c('0x95')]['transaction'](function(_0x1a87b0){return db[_0x039c('0x3c')][_0x039c('0x57')](_0x3be245['body'],{'transaction':_0x1a87b0})[_0x039c('0x1f')](function(_0x43f32d){_0x1228a5=_0x43f32d[_0x039c('0x34')]({'plain':!![]});return db[_0x039c('0x96')][_0x039c('0x7b')](createExtensionsReciveFax(_0x1228a5),{'transaction':_0x1a87b0});});})[_0x039c('0x1f')](function(){return _0x1228a5;})['then'](respondWithResult(_0x2be484,null))['catch'](handleError(_0x2be484,null));};exports[_0x039c('0x97')]=function(_0x324afb,_0x4f74c7,_0x5a8453){var _0xe405c6;return db['sequelize'][_0x039c('0x79')](function(_0x560ad5){return db['FaxAccount'][_0x039c('0x32')](_0x324afb['body'],{'where':{'id':_0x324afb['body']['id']},'transaction':_0x560ad5})[_0x039c('0x1f')](function(_0x4100ed){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x324afb[_0x039c('0x5e')]['id']},'transaction':_0x560ad5})[_0x039c('0x1f')](function(_0x320be2){return db[_0x039c('0x96')][_0x039c('0x7b')](createExtensionsReciveFax(_['omit'](_0x324afb[_0x039c('0x5e')],[_0x039c('0x98'),_0x039c('0x99'),_0x039c('0x9a'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x560ad5});});});})[_0x039c('0x1f')](function(){return db[_0x039c('0x3c')][_0x039c('0x9b')](_0x324afb['body']['id']);})[_0x039c('0x1f')](respondWithResult(_0x4f74c7,null))[_0x039c('0x28')](handleError(_0x4f74c7,null));};exports['getMessages']=function(_0x5057b7,_0x29ac93,_0x269e74){var _0x2d6c0b={'raw':!![],'where':{}};var _0x4b987f={};var _0x537f56={'count':0x0,'rows':[]};return db[_0x039c('0x3c')][_0x039c('0x63')]({'where':{'id':_0x5057b7[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x29ac93,null))[_0x039c('0x1f')](function(_0x38c696){if(_0x38c696){_0x4b987f[_0x039c('0x3f')]=_[_0x039c('0x41')](db[_0x039c('0x9c')][_0x039c('0x3d')]);_0x4b987f[_0x039c('0x40')]=_[_0x039c('0x41')](_0x5057b7[_0x039c('0x40')]);_0x4b987f[_0x039c('0x4b')]=_[_0x039c('0x43')](_0x4b987f[_0x039c('0x3f')],_0x4b987f[_0x039c('0x40')]);_0x2d6c0b[_0x039c('0x42')]=_[_0x039c('0x43')](_0x4b987f['model'],qs[_0x039c('0x44')](_0x5057b7[_0x039c('0x40')][_0x039c('0x44')]));_0x2d6c0b[_0x039c('0x42')]=_0x2d6c0b['attributes'][_0x039c('0x45')]?_0x2d6c0b[_0x039c('0x42')]:_0x4b987f[_0x039c('0x3f')];if(!_0x5057b7[_0x039c('0x40')]['hasOwnProperty']('nolimit')){_0x2d6c0b['limit']=qs['limit'](_0x5057b7[_0x039c('0x40')][_0x039c('0x2c')]);_0x2d6c0b[_0x039c('0x2a')]=qs[_0x039c('0x2a')](_0x5057b7[_0x039c('0x40')][_0x039c('0x2a')]);}_0x2d6c0b[_0x039c('0x48')]=qs[_0x039c('0x49')](_0x5057b7[_0x039c('0x40')][_0x039c('0x49')]);_0x2d6c0b[_0x039c('0x4a')]=qs[_0x039c('0x4b')](_[_0x039c('0x4c')](_0x5057b7['query'],_0x4b987f['filters']));_0x2d6c0b[_0x039c('0x4a')][_0x039c('0x60')]=_0x38c696['id'];if(_0x5057b7[_0x039c('0x40')]['filter']){_0x2d6c0b[_0x039c('0x4a')]=_[_0x039c('0x4f')](_0x2d6c0b[_0x039c('0x4a')],{'$or':_[_0x039c('0x3b')](_0x2d6c0b[_0x039c('0x42')],function(_0x43dae4){var _0x515dfd={};_0x515dfd[_0x43dae4]={'$like':'%'+_0x5057b7[_0x039c('0x40')][_0x039c('0x4d')]+'%'};return _0x515dfd;})});}if(_0x5057b7[_0x039c('0x40')][_0x039c('0x9d')]){var _0x457d94=_0x5057b7[_0x039c('0x40')][_0x039c('0x9d')]['split'](',');var _0x3e3f14={};_0x3e3f14[_0x457d94[0x0]]={'$gte':moment(_0x457d94[0x1])[_0x039c('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2d6c0b['where']=_[_0x039c('0x4f')](_0x2d6c0b[_0x039c('0x4a')],_0x3e3f14);}_0x2d6c0b=_[_0x039c('0x4f')]({},_0x2d6c0b,_0x5057b7['options']);return db['FaxMessage']['count']({'where':_0x2d6c0b[_0x039c('0x4a')]})[_0x039c('0x1f')](function(_0x29249d){_0x537f56[_0x039c('0x51')]=_0x29249d;if(_0x5057b7[_0x039c('0x40')]['includeAll']){_0x2d6c0b[_0x039c('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0x039c('0x64')](_0x2d6c0b);})[_0x039c('0x1f')](function(_0x40aecb){_0x537f56[_0x039c('0x54')]=_0x40aecb;return _0x537f56;});}})[_0x039c('0x1f')](respondWithFilteredResult(_0x29ac93,_0x2d6c0b))[_0x039c('0x28')](handleError(_0x29ac93,null));};exports[_0x039c('0x9f')]=function(_0x4055c2,_0x4cf4b6,_0x4e3139){var _0x7e59d3,_0x105116={},_0x16cdaa;if(_0x4055c2['body']['to']){_0x16cdaa=_0x4055c2[_0x039c('0x5e')]['to'][0x0];}return db[_0x039c('0x3c')][_0x039c('0x56')]({'where':{'id':_0x4055c2[_0x039c('0x55')]['id']},'include':[{'model':db[_0x039c('0xa0')],'as':_0x039c('0xa1'),'include':[{'model':db[_0x039c('0x6f')],'as':'Contacts','where':{'fax':_0x16cdaa},'limit':0x1,'order':[[_0x039c('0xa2'),_0x039c('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x4cf4b6,null))[_0x039c('0x1f')](function(_0x5f25ed){_0x7e59d3=_0x5f25ed;if(_0x4055c2[_0x039c('0x5e')]['attachments']&&_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][_0x039c('0x45')]){for(var _0x3143b8=0x0;_0x3143b8<_0x4055c2['body'][_0x039c('0xa4')]['length'];_0x3143b8+=0x1){_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][_0x3143b8]={'filename':_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][_0x3143b8]['name'],'id':_0x4055c2[_0x039c('0x5e')]['attachments'][_0x3143b8]['id'],'path':path[_0x039c('0xa5')](config[_0x039c('0xa6')],_0x039c('0xa7'),_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][_0x3143b8][_0x039c('0xa8')])};}}return respondWithRpcPromise(_0x039c('0xa9'),_0x039c('0xa9'),{'FaxAccountId':_[_0x039c('0xaa')](_0x4055c2[_0x039c('0x55')]['id'])?undefined:_0x4055c2['params']['id'],'path':_['isNil'](_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][0x0][_0x039c('0xab')])?undefined:_0x4055c2['body'][_0x039c('0xa4')][0x0][_0x039c('0xab')],'fax':_['isNil'](_0x4055c2[_0x039c('0x5e')]['to'][0x0])?undefined:_0x4055c2['body']['to'][0x0]},client9002);})[_0x039c('0x1f')](function(){if(_0x7e59d3){if(_[_0x039c('0xaa')](_0x4055c2['body']['from'])){_0x4055c2[_0x039c('0x5e')]['from']=util[_0x039c('0x9e')]('\x22%s\x22\x20<%s>',_0x7e59d3[_0x039c('0x37')],_0x7e59d3[_0x039c('0xac')]);}if(_0x7e59d3[_0x039c('0xa1')]){if(_0x7e59d3['List'][_0x039c('0xad')]['length']){return _0x7e59d3[_0x039c('0xa1')][_0x039c('0xad')][0x0];}else{return db[_0x039c('0x6f')][_0x039c('0x57')](_[_0x039c('0x18')](_0x4055c2[_0x039c('0x5e')],{'firstName':_0x4055c2['body']['to'][0x0],'phone':_0x4055c2['body']['to'][0x0],'fax':_0x4055c2[_0x039c('0x5e')]['to'][0x0],'ListId':_0x7e59d3[_0x039c('0xae')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x039c('0xaf'));}})[_0x039c('0x1f')](function(_0x14bc74){if(_0x14bc74){return db[_0x039c('0x6b')][_0x039c('0x56')]({'where':{'ContactId':_0x14bc74['id'],'closed':![],'FaxAccountId':_0x7e59d3['id']}})[_0x039c('0x1f')](function(_0xe9ea97){if(_0xe9ea97){return[_0xe9ea97,![]];}return db[_0x039c('0x6b')][_0x039c('0x57')]({'UserId':_0x4055c2['user']['id'],'ContactId':_0x14bc74['id'],'FaxAccountId':_0x7e59d3['id'],'fax':_0x4055c2[_0x039c('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x039c('0x4f')](_0x4055c2[_0x039c('0x5e')],{'read':![],'body':_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][0x0][_0x039c('0xb0')],'FaxAccountId':_0x7e59d3['id'],'UserId':_0x4055c2['user']['id'],'ContactId':_0x14bc74['id'],'AttachmentId':_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x039c('0x9c')],'as':_0x039c('0xb1')}]})[_0x039c('0x1f')](function(_0x4bb73d){return[_0x4bb73d,!![]];});});}else{throw new Error(_0x039c('0xb2'));}})['spread'](function(_0x993c4c,_0x315fc8){if(_0x315fc8){return _0x993c4c;}return db[_0x039c('0x9c')][_0x039c('0x57')]({'direction':_0x039c('0xb3'),'read':![],'body':_0x4055c2[_0x039c('0x5e')]['attachments'][0x0]['filename'],'FaxAccountId':_0x7e59d3['id'],'FaxInteractionId':_0x993c4c['id'],'UserId':_0x4055c2[_0x039c('0x58')]['id'],'ContactId':_0x993c4c[_0x039c('0xb4')],'AttachmentId':_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][0x0]['id']})[_0x039c('0x1f')](function(_0x42571d){_0x993c4c[_0x039c('0xb5')]['Messages']=[];_0x993c4c[_0x039c('0xb5')][_0x039c('0xb1')][_0x039c('0x85')](_0x42571d[_0x039c('0xb5')]);return _0x993c4c;});})['then'](function(_0x4ed2cb){respondWithRpcPromise(_0x039c('0xb6'),'SendFax',{'FaxAccountId':_['isNil'](_0x4055c2[_0x039c('0x55')]['id'])?undefined:_0x4055c2[_0x039c('0x55')]['id'],'path':_[_0x039c('0xaa')](_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][0x0][_0x039c('0xab')])?undefined:_0x4055c2[_0x039c('0x5e')][_0x039c('0xa4')][0x0][_0x039c('0xab')],'fax':_['isNil'](_0x4055c2[_0x039c('0x5e')]['to'][0x0])?undefined:_0x4055c2[_0x039c('0x5e')]['to'][0x0],'AttachmentId':_0x4055c2['body'][_0x039c('0xa4')][0x0]['id']},client9002)[_0x039c('0x1f')](function(_0x5321df){logger[_0x039c('0x20')](_0x039c('0xb7'),_0x5321df);})[_0x039c('0x28')](function(_0x2ffe27){logger[_0x039c('0x20')](_0x039c('0xb7'),_0x2ffe27);});return _0x4ed2cb;})[_0x039c('0x1f')](respondWithResult(_0x4cf4b6,null))[_0x039c('0x28')](handleError(_0x4cf4b6,null));};exports[_0x039c('0xb8')]=function(_0x2506b4,_0x160a83,_0x581f13){return db[_0x039c('0x3c')][_0x039c('0x56')]({'where':{'id':_0x2506b4[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x160a83,null))[_0x039c('0x1f')](function(_0x5c13ea){if(_0x5c13ea){return _0x5c13ea['addAgents'](_0x2506b4[_0x039c('0x5e')]['ids'],_[_0x039c('0x6d')](_0x2506b4[_0x039c('0x5e')],[_0x039c('0x6c'),'id'])||{})[_0x039c('0xb9')](function(_0x356cff){for(var _0x3d89f1=0x0;_0x3d89f1<_0x2506b4[_0x039c('0x5e')][_0x039c('0x6c')][_0x039c('0x45')];_0x3d89f1+=0x1){socket[_0x039c('0xba')]('userFaxAccount:save',{'UserId':Number(_0x2506b4[_0x039c('0x5e')][_0x039c('0x6c')][_0x3d89f1]),'FaxAccountId':Number(_0x2506b4['params']['id'])});}return _0x356cff;});}})[_0x039c('0x1f')](respondWithResult(_0x160a83,null))[_0x039c('0x28')](handleError(_0x160a83,null));};exports['removeAgents']=function(_0x3e65e2,_0x316a92,_0x4ae108){return db[_0x039c('0x3c')][_0x039c('0x56')]({'where':{'id':_0x3e65e2[_0x039c('0x55')]['id']}})[_0x039c('0x1f')](handleEntityNotFound(_0x316a92,null))[_0x039c('0x1f')](function(_0x5d7a36){if(_0x5d7a36){return _0x5d7a36[_0x039c('0xbb')](_0x3e65e2['query'][_0x039c('0x6c')])['then'](function(){if(_[_0x039c('0xbc')](_0x3e65e2[_0x039c('0x40')][_0x039c('0x6c')])){for(var _0x337f05=0x0;_0x337f05<_0x3e65e2[_0x039c('0x40')][_0x039c('0x6c')]['length'];_0x337f05+=0x1){socket['emit'](_0x039c('0xbd'),{'UserId':Number(_0x3e65e2[_0x039c('0x40')][_0x039c('0x6c')][_0x337f05]),'FaxAccountId':Number(_0x3e65e2['params']['id'])});}}else{socket[_0x039c('0xba')](_0x039c('0xbd'),{'UserId':Number(_0x3e65e2['query'][_0x039c('0x6c')]),'FaxAccountId':Number(_0x3e65e2[_0x039c('0x55')]['id'])});}});}})[_0x039c('0x1f')](respondWithStatusCode(_0x316a92,null))[_0x039c('0x28')](handleError(_0x316a92,null));};exports[_0x039c('0xbe')]=function(_0x2e29cd,_0x364218,_0x274fbe){var _0x3fe45d={};var _0x1ad729={};var _0x177b42;var _0x5567e4;return db[_0x039c('0x3c')][_0x039c('0x63')]({'where':{'id':_0x2e29cd['params']['id']}})['then'](handleEntityNotFound(_0x364218,null))['then'](function(_0x541853){if(_0x541853){_0x177b42=_0x541853;_0x1ad729[_0x039c('0x3f')]=_[_0x039c('0x41')](db[_0x039c('0x71')][_0x039c('0x3d')]);_0x1ad729[_0x039c('0x40')]=_[_0x039c('0x41')](_0x2e29cd[_0x039c('0x40')]);_0x1ad729[_0x039c('0x4b')]=_[_0x039c('0x43')](_0x1ad729[_0x039c('0x3f')],_0x1ad729[_0x039c('0x40')]);_0x3fe45d['attributes']=_[_0x039c('0x43')](_0x1ad729[_0x039c('0x3f')],qs[_0x039c('0x44')](_0x2e29cd[_0x039c('0x40')][_0x039c('0x44')]));_0x3fe45d[_0x039c('0x42')]=_0x3fe45d[_0x039c('0x42')][_0x039c('0x45')]?_0x3fe45d[_0x039c('0x42')]:_0x1ad729[_0x039c('0x3f')];_0x3fe45d[_0x039c('0x48')]=qs[_0x039c('0x49')](_0x2e29cd[_0x039c('0x40')][_0x039c('0x49')]);_0x3fe45d[_0x039c('0x4a')]=qs[_0x039c('0x4b')](_['pick'](_0x2e29cd[_0x039c('0x40')],_0x1ad729[_0x039c('0x4b')]));if(_0x2e29cd[_0x039c('0x40')]['filter']){_0x3fe45d[_0x039c('0x4a')]=_[_0x039c('0x4f')](_0x3fe45d[_0x039c('0x4a')],{'$or':_[_0x039c('0x3b')](_0x3fe45d['attributes'],function(_0x7790f3){var _0x597097={};_0x597097[_0x7790f3]={'$like':'%'+_0x2e29cd[_0x039c('0x40')][_0x039c('0x4d')]+'%'};return _0x597097;})});}_0x3fe45d=_[_0x039c('0x4f')]({},_0x3fe45d,_0x2e29cd[_0x039c('0x50')]);return _0x177b42[_0x039c('0xbe')](_0x3fe45d);}})[_0x039c('0x1f')](function(_0x153049){if(_0x153049){_0x5567e4=_0x153049[_0x039c('0x45')];if(!_0x2e29cd[_0x039c('0x40')]['hasOwnProperty'](_0x039c('0x47'))){_0x3fe45d[_0x039c('0x2c')]=qs[_0x039c('0x2c')](_0x2e29cd['query'][_0x039c('0x2c')]);_0x3fe45d[_0x039c('0x2a')]=qs[_0x039c('0x2a')](_0x2e29cd['query'][_0x039c('0x2a')]);}return _0x177b42[_0x039c('0xbe')](_0x3fe45d);}})[_0x039c('0x1f')](function(_0x39bb38){if(_0x39bb38){return _0x39bb38?{'count':_0x5567e4,'rows':_0x39bb38}:null;}})[_0x039c('0x1f')](respondWithResult(_0x364218,null))[_0x039c('0x28')](handleError(_0x364218,null));}; \ No newline at end of file +var _0x9bb5=['register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','FaxAccounts','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','FaxAccount','includeAll','include','findAll','rows','catch','params','Pause','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','options','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','transaction','FaxApplication','destroy','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','type','Fax\x20Extension','push','Answer','Set','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','sequelize','VoiceExtension','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','List','DESC','attachments','join','basename','CheckAfterSend','isNil','from','format','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bb5,0xa1));var _0x59bb=function(_0x1f5340,_0x36d6e1){_0x1f5340=_0x1f5340-0x0;var _0x492df6=_0x9bb5[_0x1f5340];return _0x492df6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x59bb('0x0'));var jsonpatch=require(_0x59bb('0x1'));var rp=require(_0x59bb('0x2'));var moment=require(_0x59bb('0x3'));var BPromise=require(_0x59bb('0x4'));var Mustache=require(_0x59bb('0x5'));var util=require('util');var path=require(_0x59bb('0x6'));var sox=require(_0x59bb('0x7'));var csv=require(_0x59bb('0x8'));var ejs=require(_0x59bb('0x9'));var fs=require('fs');var fs_extra=require(_0x59bb('0xa'));var _=require('lodash');var squel=require(_0x59bb('0xb'));var crypto=require(_0x59bb('0xc'));var jsforce=require(_0x59bb('0xd'));var deskjs=require(_0x59bb('0xe'));var toCsv=require(_0x59bb('0x8'));var querystring=require(_0x59bb('0xf'));var Papa=require(_0x59bb('0x10'));var Redis=require(_0x59bb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x59bb('0x12'));var as=require(_0x59bb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x59bb('0x14'));var utils=require(_0x59bb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x59bb('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x59bb('0x17')](config['redis'],{'host':_0x59bb('0x18'),'port':0x18eb});var socket=require(_0x59bb('0x19'))(new Redis(config[_0x59bb('0x1a')]));require(_0x59bb('0x1b'))[_0x59bb('0x1c')](socket);var jayson=require(_0x59bb('0x1d'));var client=jayson[_0x59bb('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x59bb('0x1e')][_0x59bb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x53aa58,_0x2ec29d,_0x5d7e6b,_0x531967){return new BPromise(function(_0x1ce721,_0x1f39ec){var _0x464d83=_0x531967||client;return _0x464d83[_0x59bb('0x20')](_0x53aa58,_0x5d7e6b)['then'](function(_0x18650d){logger[_0x59bb('0x21')](_0x59bb('0x22'),_0x2ec29d,_0x59bb('0x23'));logger[_0x59bb('0x24')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2ec29d,'request\x20sent',JSON[_0x59bb('0x25')](_0x18650d));if(_0x18650d[_0x59bb('0x26')]){if(_0x18650d[_0x59bb('0x26')]['code']===0x1f4){logger[_0x59bb('0x26')](_0x59bb('0x22'),_0x2ec29d,_0x18650d['error']['message']);return _0x1f39ec(_0x18650d['error'][_0x59bb('0x27')]);}logger['error'](_0x59bb('0x22'),_0x2ec29d,_0x18650d[_0x59bb('0x26')][_0x59bb('0x27')]);return _0x1ce721(_0x18650d['error']['message']);}else{logger[_0x59bb('0x21')]('FaxAccount,\x20%s,\x20%s',_0x2ec29d,_0x59bb('0x23'));_0x1ce721(_0x18650d[_0x59bb('0x28')][_0x59bb('0x27')]);}})['catch'](function(_0x544412){logger[_0x59bb('0x26')](_0x59bb('0x22'),_0x2ec29d,_0x544412);_0x1f39ec(_0x544412);});});}function respondWithStatusCode(_0x4c34af,_0x28c400){_0x28c400=_0x28c400||0xcc;return function(_0x26d535){if(_0x26d535){return _0x4c34af[_0x59bb('0x29')](_0x28c400);}return _0x4c34af[_0x59bb('0x2a')](_0x28c400)['end']();};}function respondWithResult(_0x57b123,_0x41d35a){_0x41d35a=_0x41d35a||0xc8;return function(_0x44af04){if(_0x44af04){return _0x57b123[_0x59bb('0x2a')](_0x41d35a)[_0x59bb('0x2b')](_0x44af04);}};}function respondWithFilteredResult(_0x1bced9,_0x4f783f){return function(_0x28bce0){if(_0x28bce0){var _0x52a240=typeof _0x4f783f['offset']===_0x59bb('0x2c')&&typeof _0x4f783f['limit']==='undefined';var _0x3465da=_0x28bce0[_0x59bb('0x2d')];var _0x4a0b2e=_0x52a240?0x0:_0x4f783f[_0x59bb('0x2e')];var _0x119734=_0x52a240?_0x28bce0[_0x59bb('0x2d')]:_0x4f783f[_0x59bb('0x2e')]+_0x4f783f[_0x59bb('0x2f')];var _0x1f71c8;if(_0x119734>=_0x3465da){_0x119734=_0x3465da;_0x1f71c8=0xc8;}else{_0x1f71c8=0xce;}_0x1bced9[_0x59bb('0x2a')](_0x1f71c8);return _0x1bced9[_0x59bb('0x30')](_0x59bb('0x31'),_0x4a0b2e+'-'+_0x119734+'/'+_0x3465da)[_0x59bb('0x2b')](_0x28bce0);}return null;};}function patchUpdates(_0x4944d4){return function(_0x25aadb){try{jsonpatch[_0x59bb('0x32')](_0x25aadb,_0x4944d4,!![]);}catch(_0x3f48fb){return BPromise[_0x59bb('0x33')](_0x3f48fb);}return _0x25aadb[_0x59bb('0x34')]();};}function saveUpdates(_0x4d271c,_0x509519){return function(_0x57685d){if(_0x57685d){return _0x57685d[_0x59bb('0x35')](_0x4d271c)['then'](function(_0x18726f){return _0x18726f;});}return null;};}function removeEntity(_0x4b50bb,_0x4aff1b){return function(_0x4f5dcf){if(_0x4f5dcf){return _0x4f5dcf['destroy']()[_0x59bb('0x36')](function(){var _0x29986e=_0x4f5dcf[_0x59bb('0x37')]({'plain':!![]});var _0x26e2a2=_0x59bb('0x38');return db[_0x59bb('0x39')]['destroy']({'where':{'type':_0x26e2a2,'resourceId':_0x29986e['id']}})[_0x59bb('0x36')](function(){return _0x4f5dcf;});})[_0x59bb('0x36')](function(){_0x4b50bb[_0x59bb('0x2a')](0xcc)[_0x59bb('0x3a')]();});}};}function handleEntityNotFound(_0x187926,_0x2b2b4b){return function(_0x5c22a2){if(!_0x5c22a2){_0x187926['sendStatus'](0x194);}return _0x5c22a2;};}function handleError(_0x30835a,_0x2cfea5){_0x2cfea5=_0x2cfea5||0x1f4;return function(_0x4c5f7b){logger[_0x59bb('0x26')](_0x4c5f7b[_0x59bb('0x3b')]);if(_0x4c5f7b[_0x59bb('0x3c')]){delete _0x4c5f7b[_0x59bb('0x3c')];}_0x30835a['status'](_0x2cfea5)['send'](_0x4c5f7b);};}exports[_0x59bb('0x3d')]=function(_0x438bb9,_0x4def23){var _0x291b87={'include':[{'model':db['Pause'],'as':_0x59bb('0x3e')}]},_0x4f63c8={},_0x2c54bd={'count':0x0,'rows':[]};var _0x3dff22=_['map'](db['FaxAccount'][_0x59bb('0x3f')],function(_0x4b1094){return{'name':_0x4b1094['fieldName'],'type':_0x4b1094['type'][_0x59bb('0x40')]};});_0x4f63c8[_0x59bb('0x41')]=_[_0x59bb('0x42')](_0x3dff22,_0x59bb('0x3c'));_0x4f63c8[_0x59bb('0x43')]=_[_0x59bb('0x44')](_0x438bb9[_0x59bb('0x43')]);_0x4f63c8[_0x59bb('0x45')]=_[_0x59bb('0x46')](_0x4f63c8[_0x59bb('0x41')],_0x4f63c8[_0x59bb('0x43')]);_0x291b87[_0x59bb('0x47')]=_[_0x59bb('0x46')](_0x4f63c8[_0x59bb('0x41')],qs[_0x59bb('0x48')](_0x438bb9[_0x59bb('0x43')]['fields']));_0x291b87['attributes']=_0x291b87[_0x59bb('0x47')][_0x59bb('0x49')]?_0x291b87[_0x59bb('0x47')]:_0x4f63c8[_0x59bb('0x41')];if(!_0x438bb9['query'][_0x59bb('0x4a')](_0x59bb('0x4b'))){_0x291b87[_0x59bb('0x2f')]=qs[_0x59bb('0x2f')](_0x438bb9['query'][_0x59bb('0x2f')]);_0x291b87['offset']=qs['offset'](_0x438bb9[_0x59bb('0x43')][_0x59bb('0x2e')]);}_0x291b87[_0x59bb('0x4c')]=qs[_0x59bb('0x4d')](_0x438bb9[_0x59bb('0x43')][_0x59bb('0x4d')]);_0x291b87[_0x59bb('0x4e')]=qs[_0x59bb('0x45')](_[_0x59bb('0x4f')](_0x438bb9['query'],_0x4f63c8[_0x59bb('0x45')]),_0x3dff22);if(_0x438bb9[_0x59bb('0x43')]['filter']){_0x291b87['where']=_[_0x59bb('0x50')](_0x291b87[_0x59bb('0x4e')],{'$or':_[_0x59bb('0x42')](_0x3dff22,function(_0x40880a){if(_0x40880a['type']!=='VIRTUAL'){var _0x410c08={};_0x410c08[_0x40880a[_0x59bb('0x3c')]]={'$like':'%'+_0x438bb9['query'][_0x59bb('0x51')]+'%'};return _0x410c08;}})});}_0x291b87=_['merge']({},_0x291b87,_0x438bb9['options']);var _0x1100b2={'where':_0x291b87[_0x59bb('0x4e')]};return db[_0x59bb('0x52')][_0x59bb('0x2d')](_0x1100b2)[_0x59bb('0x36')](function(_0xdba189){_0x2c54bd['count']=_0xdba189;if(_0x438bb9[_0x59bb('0x43')][_0x59bb('0x53')]){_0x291b87[_0x59bb('0x54')]=[{'all':!![]}];}return db[_0x59bb('0x52')][_0x59bb('0x55')](_0x291b87);})[_0x59bb('0x36')](function(_0xf2681d){_0x2c54bd[_0x59bb('0x56')]=_0xf2681d;return _0x2c54bd;})[_0x59bb('0x36')](respondWithFilteredResult(_0x4def23,_0x291b87))[_0x59bb('0x57')](handleError(_0x4def23,null));};exports['show']=function(_0x1e3609,_0x4b209f){var _0x1d9d54={'raw':![],'where':{'id':_0x1e3609[_0x59bb('0x58')]['id']},'include':[{'model':db[_0x59bb('0x59')],'as':_0x59bb('0x3e')}]},_0x237498={};_0x237498[_0x59bb('0x41')]=_[_0x59bb('0x44')](db[_0x59bb('0x52')][_0x59bb('0x3f')]);_0x237498['query']=_[_0x59bb('0x44')](_0x1e3609[_0x59bb('0x43')]);_0x237498[_0x59bb('0x45')]=_[_0x59bb('0x46')](_0x237498[_0x59bb('0x41')],_0x237498[_0x59bb('0x43')]);_0x1d9d54['attributes']=_[_0x59bb('0x46')](_0x237498[_0x59bb('0x41')],qs[_0x59bb('0x48')](_0x1e3609[_0x59bb('0x43')][_0x59bb('0x48')]));_0x1d9d54['attributes']=_0x1d9d54['attributes'][_0x59bb('0x49')]?_0x1d9d54[_0x59bb('0x47')]:_0x237498[_0x59bb('0x41')];if(_0x1e3609['query']['includeAll']){_0x1d9d54[_0x59bb('0x54')]=[{'all':!![]}];}_0x1d9d54=_[_0x59bb('0x50')]({},_0x1d9d54,_0x1e3609['options']);return db[_0x59bb('0x52')]['find'](_0x1d9d54)[_0x59bb('0x36')](handleEntityNotFound(_0x4b209f,null))[_0x59bb('0x36')](respondWithResult(_0x4b209f,null))[_0x59bb('0x57')](handleError(_0x4b209f,null));};exports['create']=function(_0xec7e22,_0x50f5ad){return db[_0x59bb('0x52')]['create'](_0xec7e22[_0x59bb('0x5a')],{})[_0x59bb('0x36')](function(_0x4adeb6){var _0x56a180=_0xec7e22[_0x59bb('0x5b')][_0x59bb('0x37')]({'plain':!![]});if(!_0x56a180)throw new Error(_0x59bb('0x5c'));if(_0x56a180[_0x59bb('0x5d')]==='user'){var _0x11816d=_0x4adeb6['get']({'plain':!![]});var _0x6d69cb=_0x59bb('0x38');return db['UserProfileSection'][_0x59bb('0x5e')]({'where':{'name':_0x6d69cb,'userProfileId':_0x56a180['userProfileId']},'raw':!![]})['then'](function(_0x285048){if(_0x285048&&_0x285048[_0x59bb('0x5f')]===0x0){return db['UserProfileResource'][_0x59bb('0x60')]({'name':_0x11816d['name'],'resourceId':_0x11816d['id'],'type':_0x285048[_0x59bb('0x3c')],'sectionId':_0x285048['id']},{})[_0x59bb('0x36')](function(){return _0x4adeb6;});}else{return _0x4adeb6;}})[_0x59bb('0x57')](function(_0x4c0447){logger[_0x59bb('0x26')](_0x59bb('0x61'),_0x4c0447);throw _0x4c0447;});}return _0x4adeb6;})[_0x59bb('0x36')](respondWithResult(_0x50f5ad,0xc9))[_0x59bb('0x57')](handleError(_0x50f5ad,null));};exports[_0x59bb('0x35')]=function(_0x2cae04,_0x4dc404){if(_0x2cae04[_0x59bb('0x5a')]['id']){delete _0x2cae04[_0x59bb('0x5a')]['id'];}return db[_0x59bb('0x52')]['find']({'where':{'id':_0x2cae04[_0x59bb('0x58')]['id']},'include':[{'model':db[_0x59bb('0x59')],'as':_0x59bb('0x3e')}]})[_0x59bb('0x36')](handleEntityNotFound(_0x4dc404,null))[_0x59bb('0x36')](saveUpdates(_0x2cae04['body'],null))[_0x59bb('0x36')](respondWithResult(_0x4dc404,null))[_0x59bb('0x57')](handleError(_0x4dc404,null));};exports['destroy']=function(_0x4e094e,_0x18bae5){return db[_0x59bb('0x52')][_0x59bb('0x5e')]({'where':{'id':_0x4e094e['params']['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x18bae5,null))['then'](removeEntity(_0x18bae5,null))[_0x59bb('0x57')](handleError(_0x18bae5,null));};exports[_0x59bb('0x62')]=function(_0x46328f,_0x18a0d2){return db[_0x59bb('0x52')][_0x59bb('0x62')]()[_0x59bb('0x36')](respondWithResult(_0x18a0d2,null))[_0x59bb('0x57')](handleError(_0x18a0d2,null));};exports[_0x59bb('0x63')]=function(_0x25c5c2,_0x48ea9d,_0x22f29e){if(_0x25c5c2[_0x59bb('0x5a')]['id']){delete _0x25c5c2['body']['id'];}return db['FaxAccount'][_0x59bb('0x5e')]({'where':{'id':_0x25c5c2[_0x59bb('0x58')]['id']}})['then'](handleEntityNotFound(_0x48ea9d,null))[_0x59bb('0x36')](function(_0x34723b){if(_0x34723b){_0x25c5c2[_0x59bb('0x5a')][_0x59bb('0x64')]=_0x34723b['id'];return db[_0x59bb('0x65')][_0x59bb('0x60')](_0x25c5c2[_0x59bb('0x5a')]);}})[_0x59bb('0x36')](respondWithResult(_0x48ea9d,null))[_0x59bb('0x57')](handleError(_0x48ea9d,null));};exports['getDispositions']=function(_0x522b2c,_0x1d9a2e,_0xd11f6d){var _0x2dbc62={'raw':![],'where':{}};var _0x49268f={};var _0x1cff48={'count':0x0,'rows':[]};return db[_0x59bb('0x52')]['findOne']({'where':{'id':_0x522b2c['params']['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x1d9a2e,null))['then'](function(_0x483bca){if(_0x483bca){_0x49268f[_0x59bb('0x41')]=_[_0x59bb('0x44')](db[_0x59bb('0x65')][_0x59bb('0x3f')]);_0x49268f[_0x59bb('0x43')]=_['keys'](_0x522b2c['query']);_0x49268f['filters']=_['intersection'](_0x49268f[_0x59bb('0x41')],_0x49268f[_0x59bb('0x43')]);_0x2dbc62[_0x59bb('0x47')]=_[_0x59bb('0x46')](_0x49268f['model'],qs[_0x59bb('0x48')](_0x522b2c[_0x59bb('0x43')]['fields']));_0x2dbc62['attributes']=_0x2dbc62[_0x59bb('0x47')][_0x59bb('0x49')]?_0x2dbc62['attributes']:_0x49268f[_0x59bb('0x41')];if(!_0x522b2c[_0x59bb('0x43')][_0x59bb('0x4a')](_0x59bb('0x4b'))){_0x2dbc62[_0x59bb('0x2f')]=qs['limit'](_0x522b2c[_0x59bb('0x43')]['limit']);_0x2dbc62['offset']=qs['offset'](_0x522b2c[_0x59bb('0x43')]['offset']);}_0x2dbc62['order']=qs[_0x59bb('0x4d')](_0x522b2c[_0x59bb('0x43')][_0x59bb('0x4d')]);_0x2dbc62['where']=qs[_0x59bb('0x45')](_[_0x59bb('0x4f')](_0x522b2c[_0x59bb('0x43')],_0x49268f[_0x59bb('0x45')]));_0x2dbc62[_0x59bb('0x4e')][_0x59bb('0x64')]=_0x483bca['id'];if(_0x522b2c[_0x59bb('0x43')]['filter']){_0x2dbc62[_0x59bb('0x4e')]=_['merge'](_0x2dbc62['where'],{'$or':_[_0x59bb('0x42')](_0x2dbc62[_0x59bb('0x47')],function(_0x2e9d62){var _0x28e24c={};_0x28e24c[_0x2e9d62]={'$like':'%'+_0x522b2c['query'][_0x59bb('0x51')]+'%'};return _0x28e24c;})});}_0x2dbc62=_[_0x59bb('0x50')]({},_0x2dbc62,_0x522b2c[_0x59bb('0x66')]);return db['Disposition'][_0x59bb('0x2d')]({'where':_0x2dbc62[_0x59bb('0x4e')]})[_0x59bb('0x36')](function(_0x54f9fc){_0x1cff48[_0x59bb('0x2d')]=_0x54f9fc;if(_0x522b2c[_0x59bb('0x43')][_0x59bb('0x53')]){_0x2dbc62['include']=[{'all':!![]}];}return db['Disposition'][_0x59bb('0x55')](_0x2dbc62);})[_0x59bb('0x36')](function(_0x42519a){_0x1cff48['rows']=_0x42519a;return _0x1cff48;});}})['then'](respondWithFilteredResult(_0x1d9a2e,_0x2dbc62))[_0x59bb('0x57')](handleError(_0x1d9a2e,null));};exports[_0x59bb('0x67')]=function(_0xd30e80,_0x5b71b0,_0xe17b9e){return db[_0x59bb('0x52')]['find']({'where':{'id':_0xd30e80[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x5b71b0,null))[_0x59bb('0x36')](function(_0x25a8be){if(_0x25a8be){return _0x25a8be['removeDispositions'](_0xd30e80['query']['ids']);}})[_0x59bb('0x36')](respondWithStatusCode(_0x5b71b0,null))['catch'](handleError(_0x5b71b0,null));};exports[_0x59bb('0x68')]=function(_0xeeea79,_0xfc68ad,_0x71c1d6){if(_0xeeea79[_0x59bb('0x5a')]['id']){delete _0xeeea79[_0x59bb('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0xeeea79[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0xfc68ad,null))[_0x59bb('0x36')](function(_0x8c9c4f){if(_0x8c9c4f){_0xeeea79[_0x59bb('0x5a')]['FaxAccountId']=_0x8c9c4f['id'];return db['CannedAnswer'][_0x59bb('0x60')](_0xeeea79[_0x59bb('0x5a')]);}})[_0x59bb('0x36')](respondWithResult(_0xfc68ad,null))[_0x59bb('0x57')](handleError(_0xfc68ad,null));};exports[_0x59bb('0x69')]=function(_0x1f4e47,_0x3dd674,_0x1f768f){var _0x2f65d7={'raw':![],'where':{}};var _0x581f95={};var _0x4c1e91={'count':0x0,'rows':[]};return db[_0x59bb('0x52')][_0x59bb('0x6a')]({'where':{'id':_0x1f4e47[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x3dd674,null))[_0x59bb('0x36')](function(_0x806272){if(_0x806272){_0x581f95[_0x59bb('0x41')]=_[_0x59bb('0x44')](db[_0x59bb('0x6b')]['rawAttributes']);_0x581f95[_0x59bb('0x43')]=_[_0x59bb('0x44')](_0x1f4e47['query']);_0x581f95[_0x59bb('0x45')]=_['intersection'](_0x581f95[_0x59bb('0x41')],_0x581f95[_0x59bb('0x43')]);_0x2f65d7[_0x59bb('0x47')]=_[_0x59bb('0x46')](_0x581f95[_0x59bb('0x41')],qs['fields'](_0x1f4e47[_0x59bb('0x43')][_0x59bb('0x48')]));_0x2f65d7[_0x59bb('0x47')]=_0x2f65d7[_0x59bb('0x47')]['length']?_0x2f65d7[_0x59bb('0x47')]:_0x581f95['model'];if(!_0x1f4e47['query'][_0x59bb('0x4a')](_0x59bb('0x4b'))){_0x2f65d7[_0x59bb('0x2f')]=qs['limit'](_0x1f4e47['query'][_0x59bb('0x2f')]);_0x2f65d7[_0x59bb('0x2e')]=qs['offset'](_0x1f4e47[_0x59bb('0x43')][_0x59bb('0x2e')]);}_0x2f65d7[_0x59bb('0x4c')]=qs[_0x59bb('0x4d')](_0x1f4e47[_0x59bb('0x43')][_0x59bb('0x4d')]);_0x2f65d7[_0x59bb('0x4e')]=qs[_0x59bb('0x45')](_[_0x59bb('0x4f')](_0x1f4e47[_0x59bb('0x43')],_0x581f95[_0x59bb('0x45')]));_0x2f65d7['where'][_0x59bb('0x64')]=_0x806272['id'];if(_0x1f4e47[_0x59bb('0x43')][_0x59bb('0x51')]){_0x2f65d7['where']=_['merge'](_0x2f65d7['where'],{'$or':_[_0x59bb('0x42')](_0x2f65d7[_0x59bb('0x47')],function(_0x1aa029){var _0x425888={};_0x425888[_0x1aa029]={'$like':'%'+_0x1f4e47[_0x59bb('0x43')]['filter']+'%'};return _0x425888;})});}_0x2f65d7=_['merge']({},_0x2f65d7,_0x1f4e47['options']);return db[_0x59bb('0x6b')][_0x59bb('0x2d')]({'where':_0x2f65d7[_0x59bb('0x4e')]})[_0x59bb('0x36')](function(_0x1553e0){_0x4c1e91[_0x59bb('0x2d')]=_0x1553e0;if(_0x1f4e47['query'][_0x59bb('0x53')]){_0x2f65d7['include']=[{'all':!![]}];}return db[_0x59bb('0x6b')]['findAll'](_0x2f65d7);})[_0x59bb('0x36')](function(_0x4dc4ea){_0x4c1e91['rows']=_0x4dc4ea;return _0x4c1e91;});}})[_0x59bb('0x36')](respondWithFilteredResult(_0x3dd674,_0x2f65d7))[_0x59bb('0x57')](handleError(_0x3dd674,null));};exports[_0x59bb('0x6c')]=function(_0x308ab5,_0x535469,_0x2fd80a){return db['FaxAccount'][_0x59bb('0x5e')]({'where':{'id':_0x308ab5[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x535469,null))[_0x59bb('0x36')](function(_0x26411f){if(_0x26411f){return _0x26411f[_0x59bb('0x6c')](_0x308ab5['query'][_0x59bb('0x6d')]);}})['then'](respondWithStatusCode(_0x535469,null))['catch'](handleError(_0x535469,null));};exports[_0x59bb('0x6e')]=function(_0x11242f,_0xfe3ec7,_0x47b2e7){return db[_0x59bb('0x6f')][_0x59bb('0x5e')]({'where':{'id':_0x11242f['params']['id']}})['then'](handleEntityNotFound(_0xfe3ec7,null))['then'](function(_0x583e5b){if(_0x583e5b){return _0x583e5b[_0x59bb('0x6e')](_0x11242f[_0x59bb('0x5a')][_0x59bb('0x6d')],_[_0x59bb('0x70')](_0x11242f['body'],[_0x59bb('0x6d'),'id'])||{});}})['then'](respondWithResult(_0xfe3ec7,null))['catch'](handleError(_0xfe3ec7,null));};exports['getInteractions']=function(_0x1c4a11,_0x262053,_0x2d42df){var _0x349346={'raw':![],'where':{}};var _0x2c1ebb={};var _0x1e2676={'count':0x0,'rows':[]};return db[_0x59bb('0x52')][_0x59bb('0x6a')]({'where':{'id':_0x1c4a11[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x262053,null))[_0x59bb('0x36')](function(_0x5f0a83){if(_0x5f0a83){_0x2c1ebb['model']=_[_0x59bb('0x44')](db[_0x59bb('0x6f')][_0x59bb('0x3f')]);_0x2c1ebb[_0x59bb('0x43')]=_[_0x59bb('0x44')](_0x1c4a11['query']);_0x2c1ebb['filters']=_[_0x59bb('0x46')](_0x2c1ebb[_0x59bb('0x41')],_0x2c1ebb[_0x59bb('0x43')]);_0x349346[_0x59bb('0x47')]=_[_0x59bb('0x46')](_0x2c1ebb[_0x59bb('0x41')],qs[_0x59bb('0x48')](_0x1c4a11[_0x59bb('0x43')]['fields']));_0x349346[_0x59bb('0x47')]=_0x349346['attributes'][_0x59bb('0x49')]?_0x349346[_0x59bb('0x47')]:_0x2c1ebb['model'];if(!_0x1c4a11[_0x59bb('0x43')]['hasOwnProperty']('nolimit')){_0x349346[_0x59bb('0x2f')]=qs[_0x59bb('0x2f')](_0x1c4a11[_0x59bb('0x43')]['limit']);_0x349346[_0x59bb('0x2e')]=qs[_0x59bb('0x2e')](_0x1c4a11['query'][_0x59bb('0x2e')]);}_0x349346[_0x59bb('0x4c')]=qs['sort'](_0x1c4a11[_0x59bb('0x43')]['sort']);_0x349346[_0x59bb('0x4e')]=qs[_0x59bb('0x45')](_[_0x59bb('0x4f')](_0x1c4a11[_0x59bb('0x43')],_0x2c1ebb['filters']));_0x349346[_0x59bb('0x4e')][_0x59bb('0x64')]=_0x5f0a83['id'];if(_0x1c4a11[_0x59bb('0x43')][_0x59bb('0x51')]){_0x349346[_0x59bb('0x4e')]=_[_0x59bb('0x50')](_0x349346[_0x59bb('0x4e')],{'$or':_['map'](_0x349346[_0x59bb('0x47')],function(_0x5cb250){var _0x1cc3d3={};_0x1cc3d3[_0x5cb250]={'$like':'%'+_0x1c4a11[_0x59bb('0x43')][_0x59bb('0x51')]+'%'};return _0x1cc3d3;})});}_0x349346=_[_0x59bb('0x50')]({},_0x349346,_0x1c4a11['options']);return db[_0x59bb('0x6f')][_0x59bb('0x2d')]({'where':_0x349346['where']})[_0x59bb('0x36')](function(_0x2056f4){_0x1e2676[_0x59bb('0x2d')]=_0x2056f4;if(_0x1c4a11[_0x59bb('0x43')][_0x59bb('0x53')]){_0x349346[_0x59bb('0x54')]=[{'model':db[_0x59bb('0x71')],'as':_0x59bb('0x72'),'required':![]},{'model':db['User'],'as':_0x59bb('0x73'),'attributes':['name','fullname',_0x59bb('0x74')],'required':![]},{'model':db[_0x59bb('0x75')],'as':_0x59bb('0x76'),'attributes':['id',_0x59bb('0x3c'),_0x59bb('0x77')],'where':_0x1c4a11[_0x59bb('0x43')][_0x59bb('0x78')]?{'id':_0x1c4a11['query']['tag']}:undefined,'required':_0x1c4a11['query'][_0x59bb('0x78')]?!![]:![]}];}return db[_0x59bb('0x6f')][_0x59bb('0x55')](_0x349346);})[_0x59bb('0x36')](function(_0x30390c){_0x1e2676['rows']=_0x30390c;return _0x1e2676;});}})['then'](respondWithFilteredResult(_0x262053,_0x349346))[_0x59bb('0x57')](handleError(_0x262053,null));};exports['addApplications']=function(_0x25dfbe,_0x37821a,_0x3c0834){return db[_0x59bb('0x52')][_0x59bb('0x6a')]({'where':{'id':_0x25dfbe[_0x59bb('0x58')]['id']}})['then'](handleEntityNotFound(_0x37821a,null))['then'](function(_0x6e70bc){if(_0x6e70bc){return db['sequelize'][_0x59bb('0x79')](function(_0x4ce64b){return db[_0x59bb('0x7a')][_0x59bb('0x7b')]({'where':{'FaxAccountId':_0x25dfbe['params']['id']},'transaction':_0x4ce64b})[_0x59bb('0x36')](function(_0x5dbeed){var _0x1a669e=_[_0x59bb('0x42')](_0x25dfbe[_0x59bb('0x5a')],function(_0x318bac){_0x318bac['FaxAccountId']=_0x25dfbe['params']['id'];return _0x318bac;});return db[_0x59bb('0x7a')][_0x59bb('0x7c')](_0x1a669e,{'transaction':_0x4ce64b});});})[_0x59bb('0x36')](function(){return db['FaxApplication'][_0x59bb('0x7d')]({'where':{'FaxAccountId':_0x25dfbe['params']['id']},'order':_0x59bb('0x7e')});});}})['then'](respondWithResult(_0x37821a,null))['catch'](handleError(_0x37821a,null));};exports[_0x59bb('0x7f')]=function(_0x43a543,_0x597d8f,_0x121450){var _0x1d239a={};var _0x2970d8={};var _0x4b65ed;var _0x3a0fd7;return db[_0x59bb('0x52')][_0x59bb('0x6a')]({'where':{'id':_0x43a543[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x597d8f,null))[_0x59bb('0x36')](function(_0x146b8f){if(_0x146b8f){_0x4b65ed=_0x146b8f;_0x2970d8[_0x59bb('0x41')]=_[_0x59bb('0x44')](db['FaxApplication'][_0x59bb('0x3f')]);_0x2970d8[_0x59bb('0x43')]=_[_0x59bb('0x44')](_0x43a543['query']);_0x2970d8[_0x59bb('0x45')]=_['intersection'](_0x2970d8[_0x59bb('0x41')],_0x2970d8[_0x59bb('0x43')]);_0x1d239a['attributes']=_[_0x59bb('0x46')](_0x2970d8[_0x59bb('0x41')],qs[_0x59bb('0x48')](_0x43a543[_0x59bb('0x43')][_0x59bb('0x48')]));_0x1d239a['attributes']=_0x1d239a['attributes'][_0x59bb('0x49')]?_0x1d239a['attributes']:_0x2970d8['model'];_0x1d239a[_0x59bb('0x4c')]=qs[_0x59bb('0x4d')](_0x43a543[_0x59bb('0x43')]['sort']);_0x1d239a['where']=qs[_0x59bb('0x45')](_[_0x59bb('0x4f')](_0x43a543[_0x59bb('0x43')],_0x2970d8[_0x59bb('0x45')]));if(_0x43a543[_0x59bb('0x43')]['filter']){_0x1d239a[_0x59bb('0x4e')]=_[_0x59bb('0x50')](_0x1d239a[_0x59bb('0x4e')],{'$or':_[_0x59bb('0x42')](_0x1d239a['attributes'],function(_0x509871){var _0x44f43b={};_0x44f43b[_0x509871]={'$like':'%'+_0x43a543[_0x59bb('0x43')][_0x59bb('0x51')]+'%'};return _0x44f43b;})});}_0x1d239a=_[_0x59bb('0x50')]({},_0x1d239a,_0x43a543[_0x59bb('0x66')]);return _0x4b65ed['getApplications'](_0x1d239a);}})['then'](function(_0x4b16eb){if(_0x4b16eb){_0x3a0fd7=_0x4b16eb[_0x59bb('0x49')];if(!_0x43a543[_0x59bb('0x43')]['hasOwnProperty'](_0x59bb('0x4b'))){_0x1d239a[_0x59bb('0x2f')]=qs['limit'](_0x43a543[_0x59bb('0x43')][_0x59bb('0x2f')]);_0x1d239a[_0x59bb('0x2e')]=qs[_0x59bb('0x2e')](_0x43a543[_0x59bb('0x43')][_0x59bb('0x2e')]);}return _0x4b65ed[_0x59bb('0x7f')](_0x1d239a);}})[_0x59bb('0x36')](function(_0x467c5a){if(_0x467c5a){return _0x467c5a?{'count':_0x3a0fd7,'rows':_0x467c5a}:null;}})['then'](respondWithResult(_0x597d8f,null))[_0x59bb('0x57')](handleError(_0x597d8f,null));};function Extension(_0x581575,_0x3efb9c,_0xc536da,_0x54ac85){this[_0x59bb('0x80')]=_0x59bb('0x81');this[_0x59bb('0x82')]=_0x581575[_0x59bb('0x83')];this[_0x59bb('0x84')]=_0x54ac85;this[_0x59bb('0x85')]='system';this['description']=_0x59bb('0x86');this['FaxAccountId']=_0x581575['id'];this[_0x59bb('0x7e')]=_0x3efb9c;this['appdata']=_0xc536da;}function createExtensionsReciveFax(_0x26134f){var _0x4e9568=0x1;var _0x5c169f=[];_0x5c169f[_0x59bb('0x87')](new Extension(_0x26134f,_0x4e9568,'',_0x59bb('0x88')));_0x4e9568+=0x1;_0x5c169f[_0x59bb('0x87')](new Extension(_0x26134f,_0x4e9568,'CDR(type)=inbound-fax',_0x59bb('0x89')));_0x4e9568+=0x1;for(var _0x5f5294 in _0x26134f){if(_0x26134f[_0x59bb('0x4a')](_0x5f5294)&&(_0x5f5294==='ecm'||_0x5f5294===_0x59bb('0x83')||_0x5f5294==='gateway'||_0x5f5294===_0x59bb('0x8a')||_0x5f5294===_0x59bb('0x8b')||_0x5f5294==='maxrate'||_0x5f5294===_0x59bb('0x8c')||_0x5f5294==='modem'||_0x5f5294===_0x59bb('0x8d'))){_0x5c169f[_0x59bb('0x87')](new Extension(_0x26134f,_0x4e9568,_0x59bb('0x8e')+_0x5f5294+')='+_0x26134f[_0x5f5294],_0x59bb('0x89')));_0x4e9568+=0x1;}}_0x5c169f['push'](new Extension(_0x26134f,_0x4e9568,'6',_0x59bb('0x8f')));_0x4e9568+=0x1;_0x5c169f[_0x59bb('0x87')](new Extension(_0x26134f,_0x4e9568,_0x59bb('0x90'),_0x59bb('0x91')));_0x4e9568=0x0;return _0x5c169f;}exports['addAccountApplications']=function(_0x33975d,_0x323b71,_0x3176f9){var _0x1fd884;return db[_0x59bb('0x92')][_0x59bb('0x79')](function(_0x32a90d){return db[_0x59bb('0x52')]['create'](_0x33975d[_0x59bb('0x5a')],{'transaction':_0x32a90d})[_0x59bb('0x36')](function(_0x237e4e){_0x1fd884=_0x237e4e[_0x59bb('0x37')]({'plain':!![]});return db[_0x59bb('0x93')][_0x59bb('0x7c')](createExtensionsReciveFax(_0x1fd884),{'transaction':_0x32a90d});});})[_0x59bb('0x36')](function(){return _0x1fd884;})[_0x59bb('0x36')](respondWithResult(_0x323b71,null))['catch'](handleError(_0x323b71,null));};exports['updateAccountApplications']=function(_0x571bdd,_0x4cb5e2,_0xe9d59b){var _0x483cb4;return db[_0x59bb('0x92')]['transaction'](function(_0x333d89){return db[_0x59bb('0x52')][_0x59bb('0x35')](_0x571bdd[_0x59bb('0x5a')],{'where':{'id':_0x571bdd[_0x59bb('0x5a')]['id']},'transaction':_0x333d89})['then'](function(_0x1f64e4){return db[_0x59bb('0x93')][_0x59bb('0x7b')]({'where':{'FaxAccountId':_0x571bdd[_0x59bb('0x5a')]['id']},'transaction':_0x333d89})[_0x59bb('0x36')](function(_0x137dde){return db[_0x59bb('0x93')][_0x59bb('0x7c')](createExtensionsReciveFax(_[_0x59bb('0x70')](_0x571bdd[_0x59bb('0x5a')],[_0x59bb('0x94'),_0x59bb('0x40'),_0x59bb('0x95'),_0x59bb('0x96'),'TrunkId',_0x59bb('0x97')])),{'transaction':_0x333d89});});});})['then'](function(){return db[_0x59bb('0x52')][_0x59bb('0x98')](_0x571bdd[_0x59bb('0x5a')]['id']);})[_0x59bb('0x36')](respondWithResult(_0x4cb5e2,null))[_0x59bb('0x57')](handleError(_0x4cb5e2,null));};exports[_0x59bb('0x99')]=function(_0x3aabfe,_0x590d2b,_0x2e85f4){var _0x167ca7={'raw':!![],'where':{}};var _0x1c54f1={};var _0xcef8fa={'count':0x0,'rows':[]};return db[_0x59bb('0x52')][_0x59bb('0x6a')]({'where':{'id':_0x3aabfe[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x590d2b,null))[_0x59bb('0x36')](function(_0x50eca5){if(_0x50eca5){_0x1c54f1['model']=_[_0x59bb('0x44')](db[_0x59bb('0x9a')][_0x59bb('0x3f')]);_0x1c54f1[_0x59bb('0x43')]=_[_0x59bb('0x44')](_0x3aabfe[_0x59bb('0x43')]);_0x1c54f1['filters']=_['intersection'](_0x1c54f1[_0x59bb('0x41')],_0x1c54f1[_0x59bb('0x43')]);_0x167ca7[_0x59bb('0x47')]=_[_0x59bb('0x46')](_0x1c54f1[_0x59bb('0x41')],qs[_0x59bb('0x48')](_0x3aabfe[_0x59bb('0x43')]['fields']));_0x167ca7[_0x59bb('0x47')]=_0x167ca7[_0x59bb('0x47')][_0x59bb('0x49')]?_0x167ca7[_0x59bb('0x47')]:_0x1c54f1['model'];if(!_0x3aabfe[_0x59bb('0x43')][_0x59bb('0x4a')](_0x59bb('0x4b'))){_0x167ca7[_0x59bb('0x2f')]=qs[_0x59bb('0x2f')](_0x3aabfe[_0x59bb('0x43')][_0x59bb('0x2f')]);_0x167ca7[_0x59bb('0x2e')]=qs[_0x59bb('0x2e')](_0x3aabfe['query'][_0x59bb('0x2e')]);}_0x167ca7[_0x59bb('0x4c')]=qs[_0x59bb('0x4d')](_0x3aabfe[_0x59bb('0x43')][_0x59bb('0x4d')]);_0x167ca7[_0x59bb('0x4e')]=qs[_0x59bb('0x45')](_[_0x59bb('0x4f')](_0x3aabfe[_0x59bb('0x43')],_0x1c54f1['filters']));_0x167ca7[_0x59bb('0x4e')][_0x59bb('0x64')]=_0x50eca5['id'];if(_0x3aabfe[_0x59bb('0x43')][_0x59bb('0x51')]){_0x167ca7[_0x59bb('0x4e')]=_['merge'](_0x167ca7[_0x59bb('0x4e')],{'$or':_[_0x59bb('0x42')](_0x167ca7['attributes'],function(_0x1a4198){var _0x67c85a={};_0x67c85a[_0x1a4198]={'$like':'%'+_0x3aabfe[_0x59bb('0x43')][_0x59bb('0x51')]+'%'};return _0x67c85a;})});}if(_0x3aabfe['query'][_0x59bb('0x9b')]){var _0x7c9064=_0x3aabfe[_0x59bb('0x43')][_0x59bb('0x9b')][_0x59bb('0x9c')](',');var _0x441107={};_0x441107[_0x7c9064[0x0]]={'$gte':moment(_0x7c9064[0x1])['format'](_0x59bb('0x9d'))};_0x167ca7[_0x59bb('0x4e')]=_[_0x59bb('0x50')](_0x167ca7[_0x59bb('0x4e')],_0x441107);}_0x167ca7=_[_0x59bb('0x50')]({},_0x167ca7,_0x3aabfe[_0x59bb('0x66')]);return db[_0x59bb('0x9a')][_0x59bb('0x2d')]({'where':_0x167ca7['where']})[_0x59bb('0x36')](function(_0x58c141){_0xcef8fa[_0x59bb('0x2d')]=_0x58c141;if(_0x3aabfe[_0x59bb('0x43')][_0x59bb('0x53')]){_0x167ca7[_0x59bb('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x59bb('0x55')](_0x167ca7);})[_0x59bb('0x36')](function(_0x4d9615){_0xcef8fa['rows']=_0x4d9615;return _0xcef8fa;});}})['then'](respondWithFilteredResult(_0x590d2b,_0x167ca7))[_0x59bb('0x57')](handleError(_0x590d2b,null));};exports[_0x59bb('0x9e')]=function(_0x4858a4,_0x124886,_0x8de5ca){var _0x530e6a,_0x572c72={},_0x3742fc;if(_0x4858a4[_0x59bb('0x5a')]['to']){_0x3742fc=_0x4858a4['body']['to'][0x0];}return db['FaxAccount'][_0x59bb('0x5e')]({'where':{'id':_0x4858a4[_0x59bb('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x59bb('0x9f'),'include':[{'model':db[_0x59bb('0x71')],'as':'Contacts','where':{'fax':_0x3742fc},'limit':0x1,'order':[[_0x59bb('0x96'),_0x59bb('0xa0')]]}]}]})[_0x59bb('0x36')](handleEntityNotFound(_0x124886,null))[_0x59bb('0x36')](function(_0xdfbb9c){_0x530e6a=_0xdfbb9c;if(_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')]&&_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')][_0x59bb('0x49')]){for(var _0x1a060e=0x0;_0x1a060e<_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')][_0x59bb('0x49')];_0x1a060e+=0x1){_0x4858a4[_0x59bb('0x5a')]['attachments'][_0x1a060e]={'filename':_0x4858a4[_0x59bb('0x5a')]['attachments'][_0x1a060e]['name'],'id':_0x4858a4['body']['attachments'][_0x1a060e]['id'],'path':path[_0x59bb('0xa2')](config['root'],'server/files/attachments',_0x4858a4['body'][_0x59bb('0xa1')][_0x1a060e][_0x59bb('0xa3')])};}}return respondWithRpcPromise(_0x59bb('0xa4'),_0x59bb('0xa4'),{'FaxAccountId':_[_0x59bb('0xa5')](_0x4858a4[_0x59bb('0x58')]['id'])?undefined:_0x4858a4['params']['id'],'path':_[_0x59bb('0xa5')](_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')][0x0][_0x59bb('0x6')])?undefined:_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')][0x0]['path'],'fax':_[_0x59bb('0xa5')](_0x4858a4[_0x59bb('0x5a')]['to'][0x0])?undefined:_0x4858a4[_0x59bb('0x5a')]['to'][0x0]},client9002);})[_0x59bb('0x36')](function(){if(_0x530e6a){if(_['isNil'](_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa6')])){_0x4858a4['body']['from']=util[_0x59bb('0xa7')]('\x22%s\x22\x20<%s>',_0x530e6a[_0x59bb('0x3c')],_0x530e6a[_0x59bb('0xa8')]);}if(_0x530e6a[_0x59bb('0x9f')]){if(_0x530e6a['List'][_0x59bb('0xa9')][_0x59bb('0x49')]){return _0x530e6a['List'][_0x59bb('0xa9')][0x0];}else{return db[_0x59bb('0x71')][_0x59bb('0x60')](_[_0x59bb('0x17')](_0x4858a4['body'],{'firstName':_0x4858a4[_0x59bb('0x5a')]['to'][0x0],'phone':_0x4858a4[_0x59bb('0x5a')]['to'][0x0],'fax':_0x4858a4[_0x59bb('0x5a')]['to'][0x0],'ListId':_0x530e6a['ListId']}));}}else{throw new Error(_0x59bb('0xaa'));}}else{throw new Error(_0x59bb('0xab'));}})[_0x59bb('0x36')](function(_0x5058e9){if(_0x5058e9){return db[_0x59bb('0x6f')][_0x59bb('0x5e')]({'where':{'ContactId':_0x5058e9['id'],'closed':![],'FaxAccountId':_0x530e6a['id']}})[_0x59bb('0x36')](function(_0xc20359){if(_0xc20359){return[_0xc20359,![]];}return db[_0x59bb('0x6f')]['create']({'UserId':_0x4858a4[_0x59bb('0x5b')]['id'],'ContactId':_0x5058e9['id'],'FaxAccountId':_0x530e6a['id'],'fax':_0x4858a4[_0x59bb('0x5a')]['to'][0x0],'firstMsgDirection':_0x59bb('0xac'),'Messages':[_['merge'](_0x4858a4[_0x59bb('0x5a')],{'read':![],'body':_0x4858a4['body'][_0x59bb('0xa1')][0x0]['filename'],'FaxAccountId':_0x530e6a['id'],'UserId':_0x4858a4[_0x59bb('0x5b')]['id'],'ContactId':_0x5058e9['id'],'AttachmentId':_0x4858a4['body'][_0x59bb('0xa1')][0x0]['id']})]},{'include':[{'model':db[_0x59bb('0x9a')],'as':_0x59bb('0xad')}]})[_0x59bb('0x36')](function(_0x875799){return[_0x875799,!![]];});});}else{throw new Error(_0x59bb('0xae'));}})['spread'](function(_0x2ea8b2,_0x325ee8){if(_0x325ee8){return _0x2ea8b2;}return db[_0x59bb('0x9a')]['create']({'direction':_0x59bb('0xac'),'read':![],'body':_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')][0x0][_0x59bb('0xaf')],'FaxAccountId':_0x530e6a['id'],'FaxInteractionId':_0x2ea8b2['id'],'UserId':_0x4858a4[_0x59bb('0x5b')]['id'],'ContactId':_0x2ea8b2[_0x59bb('0xb0')],'AttachmentId':_0x4858a4[_0x59bb('0x5a')]['attachments'][0x0]['id']})['then'](function(_0x28add3){_0x2ea8b2[_0x59bb('0xb1')][_0x59bb('0xad')]=[];_0x2ea8b2[_0x59bb('0xb1')][_0x59bb('0xad')][_0x59bb('0x87')](_0x28add3[_0x59bb('0xb1')]);return _0x2ea8b2;});})[_0x59bb('0x36')](function(_0x1e5729){respondWithRpcPromise(_0x59bb('0xb2'),_0x59bb('0xb2'),{'FaxAccountId':_[_0x59bb('0xa5')](_0x4858a4[_0x59bb('0x58')]['id'])?undefined:_0x4858a4['params']['id'],'path':_[_0x59bb('0xa5')](_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')][0x0][_0x59bb('0x6')])?undefined:_0x4858a4[_0x59bb('0x5a')]['attachments'][0x0][_0x59bb('0x6')],'fax':_[_0x59bb('0xa5')](_0x4858a4[_0x59bb('0x5a')]['to'][0x0])?undefined:_0x4858a4[_0x59bb('0x5a')]['to'][0x0],'AttachmentId':_0x4858a4[_0x59bb('0x5a')][_0x59bb('0xa1')][0x0]['id']},client9002)[_0x59bb('0x36')](function(_0x37e644){logger[_0x59bb('0x21')]('SendFaxRpc,\x20%s',_0x37e644);})['catch'](function(_0x44cd74){logger[_0x59bb('0x21')](_0x59bb('0xb3'),_0x44cd74);});return _0x1e5729;})[_0x59bb('0x36')](respondWithResult(_0x124886,null))[_0x59bb('0x57')](handleError(_0x124886,null));};exports[_0x59bb('0xb4')]=function(_0x408e46,_0x1957a4,_0x18ea13){return db[_0x59bb('0x52')][_0x59bb('0x5e')]({'where':{'id':_0x408e46[_0x59bb('0x58')]['id']}})['then'](handleEntityNotFound(_0x1957a4,null))[_0x59bb('0x36')](function(_0x26daad){if(_0x26daad){return _0x26daad['addAgents'](_0x408e46[_0x59bb('0x5a')][_0x59bb('0x6d')],_[_0x59bb('0x70')](_0x408e46[_0x59bb('0x5a')],[_0x59bb('0x6d'),'id'])||{})[_0x59bb('0xb5')](function(_0x308386){for(var _0x7817f1=0x0;_0x7817f1<_0x408e46[_0x59bb('0x5a')][_0x59bb('0x6d')][_0x59bb('0x49')];_0x7817f1+=0x1){socket[_0x59bb('0xb6')](_0x59bb('0xb7'),{'UserId':Number(_0x408e46['body']['ids'][_0x7817f1]),'FaxAccountId':Number(_0x408e46['params']['id'])});}return _0x308386;});}})[_0x59bb('0x36')](respondWithResult(_0x1957a4,null))[_0x59bb('0x57')](handleError(_0x1957a4,null));};exports[_0x59bb('0xb8')]=function(_0x1f616a,_0x2f0e54,_0x1e2b2d){return db['FaxAccount'][_0x59bb('0x5e')]({'where':{'id':_0x1f616a['params']['id']}})['then'](handleEntityNotFound(_0x2f0e54,null))['then'](function(_0x1900f6){if(_0x1900f6){return _0x1900f6[_0x59bb('0xb8')](_0x1f616a[_0x59bb('0x43')][_0x59bb('0x6d')])[_0x59bb('0x36')](function(){if(_[_0x59bb('0xb9')](_0x1f616a['query'][_0x59bb('0x6d')])){for(var _0x303795=0x0;_0x303795<_0x1f616a[_0x59bb('0x43')]['ids']['length'];_0x303795+=0x1){socket[_0x59bb('0xb6')]('userFaxAccount:remove',{'UserId':Number(_0x1f616a[_0x59bb('0x43')][_0x59bb('0x6d')][_0x303795]),'FaxAccountId':Number(_0x1f616a['params']['id'])});}}else{socket[_0x59bb('0xb6')](_0x59bb('0xba'),{'UserId':Number(_0x1f616a[_0x59bb('0x43')]['ids']),'FaxAccountId':Number(_0x1f616a[_0x59bb('0x58')]['id'])});}});}})[_0x59bb('0x36')](respondWithStatusCode(_0x2f0e54,null))['catch'](handleError(_0x2f0e54,null));};exports[_0x59bb('0xbb')]=function(_0x3aec41,_0x194042,_0x93dcd){var _0x174e2d={};var _0x406bf7={};var _0x3f5f56;var _0x4eca47;return db[_0x59bb('0x52')]['findOne']({'where':{'id':_0x3aec41[_0x59bb('0x58')]['id']}})[_0x59bb('0x36')](handleEntityNotFound(_0x194042,null))[_0x59bb('0x36')](function(_0x790963){if(_0x790963){_0x3f5f56=_0x790963;_0x406bf7[_0x59bb('0x41')]=_[_0x59bb('0x44')](db[_0x59bb('0xbc')][_0x59bb('0x3f')]);_0x406bf7[_0x59bb('0x43')]=_[_0x59bb('0x44')](_0x3aec41[_0x59bb('0x43')]);_0x406bf7[_0x59bb('0x45')]=_[_0x59bb('0x46')](_0x406bf7['model'],_0x406bf7[_0x59bb('0x43')]);_0x174e2d[_0x59bb('0x47')]=_['intersection'](_0x406bf7['model'],qs[_0x59bb('0x48')](_0x3aec41[_0x59bb('0x43')][_0x59bb('0x48')]));_0x174e2d[_0x59bb('0x47')]=_0x174e2d[_0x59bb('0x47')][_0x59bb('0x49')]?_0x174e2d['attributes']:_0x406bf7[_0x59bb('0x41')];_0x174e2d[_0x59bb('0x4c')]=qs[_0x59bb('0x4d')](_0x3aec41[_0x59bb('0x43')][_0x59bb('0x4d')]);_0x174e2d[_0x59bb('0x4e')]=qs[_0x59bb('0x45')](_[_0x59bb('0x4f')](_0x3aec41[_0x59bb('0x43')],_0x406bf7[_0x59bb('0x45')]));if(_0x3aec41[_0x59bb('0x43')][_0x59bb('0x51')]){_0x174e2d[_0x59bb('0x4e')]=_['merge'](_0x174e2d[_0x59bb('0x4e')],{'$or':_['map'](_0x174e2d[_0x59bb('0x47')],function(_0x266b78){var _0x593381={};_0x593381[_0x266b78]={'$like':'%'+_0x3aec41[_0x59bb('0x43')][_0x59bb('0x51')]+'%'};return _0x593381;})});}_0x174e2d=_[_0x59bb('0x50')]({},_0x174e2d,_0x3aec41['options']);return _0x3f5f56[_0x59bb('0xbb')](_0x174e2d);}})[_0x59bb('0x36')](function(_0x4d332f){if(_0x4d332f){_0x4eca47=_0x4d332f[_0x59bb('0x49')];if(!_0x3aec41[_0x59bb('0x43')][_0x59bb('0x4a')](_0x59bb('0x4b'))){_0x174e2d[_0x59bb('0x2f')]=qs[_0x59bb('0x2f')](_0x3aec41['query'][_0x59bb('0x2f')]);_0x174e2d['offset']=qs[_0x59bb('0x2e')](_0x3aec41[_0x59bb('0x43')][_0x59bb('0x2e')]);}return _0x3f5f56[_0x59bb('0xbb')](_0x174e2d);}})[_0x59bb('0x36')](function(_0x4745b3){if(_0x4745b3){return _0x4745b3?{'count':_0x4eca47,'rows':_0x4745b3}:null;}})['then'](respondWithResult(_0x194042,null))['catch'](handleError(_0x194042,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2561dd1..6b5a014 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 _0xa7db=['../../mysqldb','FaxAccount','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x14b9cd,_0x34f39f){var _0x249c04=function(_0x41981e){while(--_0x41981e){_0x14b9cd['push'](_0x14b9cd['shift']());}};_0x249c04(++_0x34f39f);}(_0xa7db,0xbf));var _0xba7d=function(_0x3b5930,_0x2578be){_0x3b5930=_0x3b5930-0x0;var _0x4559f6=_0xa7db[_0x3b5930];return _0x4559f6;};'use strict';var EventEmitter=require(_0xba7d('0x0'));var FaxAccount=require(_0xba7d('0x1'))['db'][_0xba7d('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xba7d('0x3')};function emitEvent(_0xcfd2a5){return function(_0x1af692,_0x385fd6,_0x10f8b6){FaxAccountEvents['emit'](_0xcfd2a5+':'+_0x1af692['id'],_0x1af692);FaxAccountEvents[_0xba7d('0x4')](_0xcfd2a5,_0x1af692);_0x10f8b6(null);};}for(var e in events){if(events[_0xba7d('0x5')](e)){var event=events[e];FaxAccount[_0xba7d('0x6')](e,emitEvent(event));}}module[_0xba7d('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x920c=['hook','exports','../../mysqldb','FaxAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x1d5d3f,_0x3a9d08){var _0x6f9221=function(_0x1e9b5d){while(--_0x1e9b5d){_0x1d5d3f['push'](_0x1d5d3f['shift']());}};_0x6f9221(++_0x3a9d08);}(_0x920c,0x152));var _0xc920=function(_0x557b8f,_0x638782){_0x557b8f=_0x557b8f-0x0;var _0x5abd2d=_0x920c[_0x557b8f];return _0x5abd2d;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xc920('0x0'))['db'][_0xc920('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc920('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc920('0x3')};function emitEvent(_0x521133){return function(_0x9ef6,_0x599be7,_0x547074){FaxAccountEvents[_0xc920('0x4')](_0x521133+':'+_0x9ef6['id'],_0x9ef6);FaxAccountEvents[_0xc920('0x4')](_0x521133,_0x9ef6);_0x547074(null);};}for(var e in events){if(events[_0xc920('0x5')](e)){var event=events[e];FaxAccount[_0xc920('0x6')](e,emitEvent(event));}}module[_0xc920('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 62ef591..87bc05a 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 _0x95f9=['define','FaxAccount','fax_accounts','lodash','api','moment','bluebird','path','rimraf','./faxAccount.attributes','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x95f9,0x1e7));var _0x995f=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x95f9[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x995f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x995f('0x1'));var moment=require(_0x995f('0x2'));var BPromise=require(_0x995f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x995f('0x4'));var rimraf=require(_0x995f('0x5'));var config=require('../../config/environment');var attributes=require(_0x995f('0x6'));module[_0x995f('0x7')]=function(_0xbb640b,_0x39bbaf){return _0xbb640b[_0x995f('0x8')](_0x995f('0x9'),attributes,{'tableName':_0x995f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6892=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x6892,0x143));var _0x2689=function(_0x42e290,_0x5b9fb2){_0x42e290=_0x42e290-0x0;var _0x7aa312=_0x6892[_0x42e290];return _0x7aa312;};'use strict';var _=require(_0x2689('0x0'));var util=require(_0x2689('0x1'));var logger=require(_0x2689('0x2'))(_0x2689('0x3'));var moment=require('moment');var BPromise=require(_0x2689('0x4'));var rp=require(_0x2689('0x5'));var fs=require('fs');var path=require(_0x2689('0x6'));var rimraf=require('rimraf');var config=require(_0x2689('0x7'));var attributes=require(_0x2689('0x8'));module[_0x2689('0x9')]=function(_0x4f98a8,_0xb0e6d){return _0x4f98a8[_0x2689('0xa')](_0x2689('0xb'),attributes,{'tableName':_0x2689('0xc'),'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 5c14e31..86242d4 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 _0x6b64=['socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','CmContact','Contacts','DESC','FaxApplication','applications','Applications','orderBy','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','startRouting','Start','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost'];(function(_0x57fa91,_0x87ea8a){var _0x425572=function(_0x4b916a){while(--_0x4b916a){_0x57fa91['push'](_0x57fa91['shift']());}};_0x425572(++_0x87ea8a);}(_0x6b64,0xf6));var _0x46b6=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x6b64[_0x4f4d19];return _0x27a258;};'use strict';var _=require('lodash');var util=require(_0x46b6('0x0'));var moment=require(_0x46b6('0x1'));var BPromise=require(_0x46b6('0x2'));var rs=require(_0x46b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x46b6('0x5'))(_0x46b6('0x6'));var config=require(_0x46b6('0x7'));var jayson=require(_0x46b6('0x8'));var client=jayson[_0x46b6('0x9')]['http']({'port':0x232c});config[_0x46b6('0xa')]=_['defaults'](config[_0x46b6('0xa')],{'host':_0x46b6('0xb'),'port':0x18eb});var socket=require(_0x46b6('0xc'))(new Redis(config[_0x46b6('0xa')]));require(_0x46b6('0xd'))[_0x46b6('0xe')](socket);function respondWithRpcPromise(_0xe4e71b,_0x1ffa55,_0x22092c){return new BPromise(function(_0x19c7f4,_0x1cf6c1){return client[_0x46b6('0xf')](_0xe4e71b,_0x22092c)[_0x46b6('0x10')](function(_0x626f5f){logger[_0x46b6('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1ffa55,_0x46b6('0x12'));logger['debug'](_0x46b6('0x13'),_0x1ffa55,_0x46b6('0x12'),JSON[_0x46b6('0x14')](_0x626f5f));if(_0x626f5f[_0x46b6('0x15')]){if(_0x626f5f[_0x46b6('0x15')][_0x46b6('0x16')]===0x1f4){logger[_0x46b6('0x15')](_0x46b6('0x17'),_0x1ffa55,_0x626f5f['error'][_0x46b6('0x18')]);return _0x1cf6c1(_0x626f5f[_0x46b6('0x15')][_0x46b6('0x18')]);}logger[_0x46b6('0x15')](_0x46b6('0x17'),_0x1ffa55,_0x626f5f[_0x46b6('0x15')][_0x46b6('0x18')]);return _0x19c7f4(_0x626f5f[_0x46b6('0x15')][_0x46b6('0x18')]);}else{logger['info'](_0x46b6('0x17'),_0x1ffa55,_0x46b6('0x12'));_0x19c7f4(_0x626f5f['result'][_0x46b6('0x18')]);}})['catch'](function(_0x1424f7){logger[_0x46b6('0x15')]('FaxAccount,\x20%s,\x20%s',_0x1ffa55,_0x1424f7);_0x1cf6c1(_0x1424f7);});});}exports[_0x46b6('0x19')]=function(_0x1ccc86){var _0x3ba1c7=this;return new Promise(function(_0x5f34e9,_0x12db33){return db[_0x46b6('0x1a')][_0x46b6('0x1b')]({'raw':_0x1ccc86['options']?_0x1ccc86[_0x46b6('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1ccc86['options']?_0x1ccc86[_0x46b6('0x1c')][_0x46b6('0x1d')]||null:null,'attributes':_0x1ccc86['options']?_0x1ccc86[_0x46b6('0x1c')][_0x46b6('0x1e')]||null:null,'limit':_0x1ccc86[_0x46b6('0x1c')]?_0x1ccc86[_0x46b6('0x1c')][_0x46b6('0x1f')]||null:null,'include':_0x1ccc86['options']?_0x1ccc86[_0x46b6('0x1c')][_0x46b6('0x20')]?_[_0x46b6('0x21')](_0x1ccc86[_0x46b6('0x1c')][_0x46b6('0x20')],function(_0x59cbe2){return{'model':db[_0x59cbe2[_0x46b6('0x22')]],'as':_0x59cbe2['as'],'attributes':_0x59cbe2['attributes'],'include':_0x59cbe2['include']?_[_0x46b6('0x21')](_0x59cbe2[_0x46b6('0x20')],function(_0x101853){return{'model':db[_0x101853[_0x46b6('0x22')]],'as':_0x101853['as'],'attributes':_0x101853[_0x46b6('0x1e')],'include':_0x101853[_0x46b6('0x20')]?_[_0x46b6('0x21')](_0x101853[_0x46b6('0x20')],function(_0x26794d){return{'model':db[_0x26794d[_0x46b6('0x22')]],'as':_0x26794d['as'],'attributes':_0x26794d[_0x46b6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x46b6('0x10')](function(_0x5b043f){logger['info'](_0x46b6('0x19'),_0x1ccc86);logger['debug'](_0x46b6('0x19'),_0x1ccc86,JSON[_0x46b6('0x14')](_0x5b043f));_0x5f34e9(_0x5b043f);})['catch'](function(_0x51ecd9){logger['error'](_0x46b6('0x19'),_0x51ecd9[_0x46b6('0x18')],_0x1ccc86);_0x12db33(_0x3ba1c7[_0x46b6('0x15')](0x1f4,_0x51ecd9['message']));});});};exports[_0x46b6('0x23')]=function(_0x6d96f9,_0x37718c,_0x218ae6){var _0x430482=this;return new Promise(function(_0x5caecd,_0x1c9f9f){var _0x29cfb5={'body':_0x6d96f9[_0x46b6('0x24')],'channel':_0x46b6('0x25')};var _0x160e83=[];var _0x1b0ccd=[];var _0x1cbf6d={};return db['CmContact'][_0x46b6('0x26')]()[_0x46b6('0x10')](function(_0x44fd6e){if(!_0x44fd6e){throw new db[(_0x46b6('0x27'))][(_0x46b6('0x28'))](_0x46b6('0x29'));}_0x160e83=_['difference'](_[_0x46b6('0x2a')](_0x44fd6e),['createdAt',_0x46b6('0x2b')]);_0x1b0ccd=_[_0x46b6('0x2c')](_[_0x46b6('0x2a')](_0x44fd6e),['createdAt',_0x46b6('0x2b'),_0x46b6('0x2d'),'ListId']);if(_0x6d96f9[_0x46b6('0x24')]['id']){delete _0x6d96f9['body']['id'];}if(_[_0x46b6('0x2e')](_0x6d96f9['body'][_0x46b6('0x2f')])){throw new db[(_0x46b6('0x27'))][(_0x46b6('0x28'))](_0x46b6('0x30'));}if(_['isNil'](_0x6d96f9['body'][_0x46b6('0x24')])||_0x6d96f9[_0x46b6('0x24')][_0x46b6('0x24')]===''){throw new db[(_0x46b6('0x27'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x46b6('0x2e')](_0x6d96f9['body'][_0x46b6('0x31')])){throw new db[(_0x46b6('0x27'))]['ValidationError'](_0x46b6('0x32')+_0x1b0ccd);}if(!_[_0x46b6('0x33')](_0x1b0ccd,_0x6d96f9[_0x46b6('0x24')][_0x46b6('0x31')])){throw new db['Sequelize']['ValidationError'](_0x46b6('0x34')+_0x1b0ccd);}_0x1cbf6d[_0x6d96f9[_0x46b6('0x24')][_0x46b6('0x31')]]=_0x6d96f9[_0x46b6('0x24')][_0x46b6('0x2f')];})[_0x46b6('0x10')](function(){return db[_0x46b6('0x1a')][_0x46b6('0x35')]({'where':{'id':_0x6d96f9[_0x46b6('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x46b6('0x37'),'include':[{'model':db[_0x46b6('0x38')],'as':_0x46b6('0x39'),'where':_0x1cbf6d,'limit':0x1,'order':[[_0x46b6('0x2b'),_0x46b6('0x3a')]]}]},{'model':db[_0x46b6('0x3b')],'as':'Applications'}]});})[_0x46b6('0x10')](function(_0xc464ac){if(_0xc464ac&&_0xc464ac['List']){var _0x37db60=_0xc464ac['get']({'plain':!![]});_0x29cfb5[_0x46b6('0x36')]=_0x37db60;_0x29cfb5[_0x46b6('0x3c')]=_0x37db60[_0x46b6('0x3d')];_0x29cfb5['list']=_0x37db60[_0x46b6('0x37')];_0x29cfb5['applications']=_[_0x46b6('0x3e')](_0x29cfb5[_0x46b6('0x3c')],[_0x46b6('0x3f')],[_0x46b6('0x40')]);if(_0x29cfb5[_0x46b6('0x36')][_0x46b6('0x3d')]){delete _0x29cfb5[_0x46b6('0x36')]['Applications'];}if(_0x29cfb5[_0x46b6('0x36')][_0x46b6('0x37')]&&_0x29cfb5['account'][_0x46b6('0x37')][_0x46b6('0x39')][_0x46b6('0x41')]){return _0x29cfb5[_0x46b6('0x36')][_0x46b6('0x37')][_0x46b6('0x39')][0x0];}var _0x650b9f=_['defaults'](_0x6d96f9[_0x46b6('0x24')],{'firstName':_0x6d96f9[_0x46b6('0x24')][_0x46b6('0x2f')],'ListId':_0x37db60[_0x46b6('0x42')]});_0x650b9f[_0x6d96f9[_0x46b6('0x24')][_0x46b6('0x31')]]=_0x6d96f9[_0x46b6('0x24')]['from'];return db['CmContact'][_0x46b6('0x43')](_0x650b9f,{'fields':_0x160e83,'raw':!![]});}})['then'](function(_0x11700d){_0x29cfb5[_0x46b6('0x44')]=_0x11700d;if(_0x11700d){var _0x5dc27b={'ContactId':_0x11700d['id'],'FaxAccountId':_0x6d96f9[_0x46b6('0x36')]['id'],'fax':_0x11700d['fax']};return db['FaxInteraction'][_0x46b6('0x35')]({'where':{'ContactId':_0x11700d['id'],'closed':![],'FaxAccountId':_0x6d96f9['account']['id']}})[_0x46b6('0x10')](function(_0x5567e5){if(_0x5567e5){return[_0x5567e5,![]];}return db[_0x46b6('0x45')][_0x46b6('0x43')](_0x5dc27b)[_0x46b6('0x10')](function(_0x1d16c8){return[_0x1d16c8,!![]];});});}else{throw new Error(_0x46b6('0x46'));}})[_0x46b6('0x47')](function(_0x33bf9b,_0x47556a){var _0x353fb6=_0x33bf9b['get']({'plain':!![]});if(_0x47556a){if(_0x29cfb5[_0x46b6('0x36')][_0x46b6('0x48')]){_0x29cfb5[_0x46b6('0x3c')]['push']({'id':0x0,'priority':_0x29cfb5['applications'][_0x46b6('0x41')]+0x1,'app':'close','appdata':_0x46b6('0x49'),'interval':_0x46b6('0x4a')});}_0x353fb6['created']=!![];}else{_0x353fb6[_0x46b6('0x4b')]=![];}_0x29cfb5[_0x46b6('0x4c')]=_0x353fb6;return db[_0x46b6('0x4d')][_0x46b6('0x43')]({'body':_0x6d96f9[_0x46b6('0x24')]['body'],'FaxAccountId':_0x6d96f9[_0x46b6('0x36')]['id'],'FaxInteractionId':_0x33bf9b['id'],'direction':'in','ContactId':_0x33bf9b[_0x46b6('0x4e')],'AttachmentId':_0x6d96f9[_0x46b6('0x24')][_0x46b6('0x4f')]});})[_0x46b6('0x10')](function(_0x3bd808){_0x29cfb5['message']=_0x3bd808;if(_0x29cfb5['interaction'][_0x46b6('0x50')]){return db[_0x46b6('0x51')][_0x46b6('0x35')]({'attributes':['id',_0x46b6('0x52')],'where':{'id':_0x29cfb5[_0x46b6('0x4c')][_0x46b6('0x50')]}})[_0x46b6('0x10')](function(_0x15b6c1){if(_0x15b6c1){_0x29cfb5[_0x46b6('0x3c')][_0x46b6('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x15b6c1['name']+','+(_0x29cfb5[_0x46b6('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0x46b6('0x4a')});}return respondWithRpcPromise('Start',_0x46b6('0x54'),_0x29cfb5);});}return respondWithRpcPromise(_0x46b6('0x55'),_0x46b6('0x54'),_0x29cfb5);})['then'](function(_0x12ff69){_0x5caecd(_0x12ff69);})['catch'](function(_0xff6a9d){_0x1c9f9f(_0x430482[_0x46b6('0x15')](0x1f4,_0xff6a9d[_0x46b6('0x18')]));});});}; \ No newline at end of file +var _0x452d=['create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','created','interaction','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','CmList','List','Contacts','FaxApplication','Applications','get','applications','priority','asc','account','length','defaults'];(function(_0x57f522,_0x3a9333){var _0x189bbf=function(_0x2ab668){while(--_0x2ab668){_0x57f522['push'](_0x57f522['shift']());}};_0x189bbf(++_0x3a9333);}(_0x452d,0x16b));var _0xd452=function(_0xc5cdbc,_0x242b2a){_0xc5cdbc=_0xc5cdbc-0x0;var _0x4ae4a3=_0x452d[_0xc5cdbc];return _0x4ae4a3;};'use strict';var _=require(_0xd452('0x0'));var util=require(_0xd452('0x1'));var moment=require(_0xd452('0x2'));var BPromise=require(_0xd452('0x3'));var rs=require(_0xd452('0x4'));var fs=require('fs');var Redis=require(_0xd452('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd452('0x6'))(_0xd452('0x7'));var config=require('../../config/environment');var jayson=require(_0xd452('0x8'));var client=jayson[_0xd452('0x9')]['http']({'port':0x232c});config[_0xd452('0xa')]=_['defaults'](config[_0xd452('0xa')],{'host':_0xd452('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd452('0xa')]));require(_0xd452('0xc'))[_0xd452('0xd')](socket);function respondWithRpcPromise(_0x57155f,_0x406e1b,_0x33f183){return new BPromise(function(_0x2ed0f4,_0x1ef150){return client['request'](_0x57155f,_0x33f183)[_0xd452('0xe')](function(_0x2ab9c9){logger[_0xd452('0xf')](_0xd452('0x10'),_0x406e1b,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x406e1b,_0xd452('0x11'),JSON[_0xd452('0x12')](_0x2ab9c9));if(_0x2ab9c9[_0xd452('0x13')]){if(_0x2ab9c9[_0xd452('0x13')][_0xd452('0x14')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x406e1b,_0x2ab9c9[_0xd452('0x13')][_0xd452('0x15')]);return _0x1ef150(_0x2ab9c9[_0xd452('0x13')][_0xd452('0x15')]);}logger['error'](_0xd452('0x10'),_0x406e1b,_0x2ab9c9['error'][_0xd452('0x15')]);return _0x2ed0f4(_0x2ab9c9[_0xd452('0x13')][_0xd452('0x15')]);}else{logger[_0xd452('0xf')](_0xd452('0x10'),_0x406e1b,'request\x20sent');_0x2ed0f4(_0x2ab9c9[_0xd452('0x16')]['message']);}})['catch'](function(_0x1618f8){logger[_0xd452('0x13')]('FaxAccount,\x20%s,\x20%s',_0x406e1b,_0x1618f8);_0x1ef150(_0x1618f8);});});}exports[_0xd452('0x17')]=function(_0x325871){var _0x26db24=this;return new Promise(function(_0x1ba68b,_0x203c35){return db[_0xd452('0x18')][_0xd452('0x19')]({'raw':_0x325871['options']?_0x325871[_0xd452('0x1a')][_0xd452('0x1b')]===undefined?!![]:![]:!![],'where':_0x325871[_0xd452('0x1a')]?_0x325871['options'][_0xd452('0x1c')]||null:null,'attributes':_0x325871['options']?_0x325871[_0xd452('0x1a')][_0xd452('0x1d')]||null:null,'limit':_0x325871['options']?_0x325871[_0xd452('0x1a')][_0xd452('0x1e')]||null:null,'include':_0x325871[_0xd452('0x1a')]?_0x325871[_0xd452('0x1a')][_0xd452('0x1f')]?_[_0xd452('0x20')](_0x325871[_0xd452('0x1a')][_0xd452('0x1f')],function(_0x2062d1){return{'model':db[_0x2062d1['model']],'as':_0x2062d1['as'],'attributes':_0x2062d1[_0xd452('0x1d')],'include':_0x2062d1[_0xd452('0x1f')]?_[_0xd452('0x20')](_0x2062d1[_0xd452('0x1f')],function(_0xb5d064){return{'model':db[_0xb5d064['model']],'as':_0xb5d064['as'],'attributes':_0xb5d064[_0xd452('0x1d')],'include':_0xb5d064[_0xd452('0x1f')]?_[_0xd452('0x20')](_0xb5d064['include'],function(_0x2a9eee){return{'model':db[_0x2a9eee[_0xd452('0x21')]],'as':_0x2a9eee['as'],'attributes':_0x2a9eee[_0xd452('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd452('0xe')](function(_0x731284){logger[_0xd452('0xf')]('GetFaxAccount',_0x325871);logger['debug'](_0xd452('0x17'),_0x325871,JSON[_0xd452('0x12')](_0x731284));_0x1ba68b(_0x731284);})['catch'](function(_0x18171f){logger[_0xd452('0x13')](_0xd452('0x17'),_0x18171f['message'],_0x325871);_0x203c35(_0x26db24[_0xd452('0x13')](0x1f4,_0x18171f['message']));});});};exports[_0xd452('0x22')]=function(_0x5c078e,_0x297c4f,_0x1fad17){var _0xa24e39=this;return new Promise(function(_0x191cca,_0x3078fe){var _0x425bfd={'body':_0x5c078e[_0xd452('0x23')],'channel':_0xd452('0x24')};var _0x4faddb=[];var _0x58a4b6=[];var _0x184954={};return db[_0xd452('0x25')][_0xd452('0x26')]()[_0xd452('0xe')](function(_0x4286e8){if(!_0x4286e8){throw new db[(_0xd452('0x27'))][(_0xd452('0x28'))]('no\x20available\x20attributes');}_0x4faddb=_[_0xd452('0x29')](_[_0xd452('0x2a')](_0x4286e8),[_0xd452('0x2b'),_0xd452('0x2c')]);_0x58a4b6=_[_0xd452('0x29')](_[_0xd452('0x2a')](_0x4286e8),[_0xd452('0x2b'),'updatedAt',_0xd452('0x2d'),_0xd452('0x2e')]);if(_0x5c078e[_0xd452('0x23')]['id']){delete _0x5c078e[_0xd452('0x23')]['id'];}if(_[_0xd452('0x2f')](_0x5c078e[_0xd452('0x23')]['from'])){throw new db[(_0xd452('0x27'))]['ValidationError'](_0xd452('0x30'));}if(_[_0xd452('0x2f')](_0x5c078e[_0xd452('0x23')]['body'])||_0x5c078e[_0xd452('0x23')][_0xd452('0x23')]===''){throw new db['Sequelize']['ValidationError'](_0xd452('0x31'));}if(_[_0xd452('0x2f')](_0x5c078e[_0xd452('0x23')][_0xd452('0x32')])){throw new db[(_0xd452('0x27'))][(_0xd452('0x28'))](_0xd452('0x33')+_0x58a4b6);}if(!_['includes'](_0x58a4b6,_0x5c078e['body'][_0xd452('0x32')])){throw new db[(_0xd452('0x27'))][(_0xd452('0x28'))](_0xd452('0x34')+_0x58a4b6);}_0x184954[_0x5c078e[_0xd452('0x23')][_0xd452('0x32')]]=_0x5c078e[_0xd452('0x23')][_0xd452('0x35')];})[_0xd452('0xe')](function(){return db[_0xd452('0x18')][_0xd452('0x36')]({'where':{'id':_0x5c078e['account']['id']},'include':[{'model':db[_0xd452('0x37')],'as':_0xd452('0x38'),'include':[{'model':db['CmContact'],'as':_0xd452('0x39'),'where':_0x184954,'limit':0x1,'order':[[_0xd452('0x2c'),'DESC']]}]},{'model':db[_0xd452('0x3a')],'as':_0xd452('0x3b')}]});})[_0xd452('0xe')](function(_0x797f19){if(_0x797f19&&_0x797f19[_0xd452('0x38')]){var _0x3964ac=_0x797f19[_0xd452('0x3c')]({'plain':!![]});_0x425bfd['account']=_0x3964ac;_0x425bfd[_0xd452('0x3d')]=_0x3964ac[_0xd452('0x3b')];_0x425bfd['list']=_0x3964ac[_0xd452('0x38')];_0x425bfd[_0xd452('0x3d')]=_['orderBy'](_0x425bfd[_0xd452('0x3d')],[_0xd452('0x3e')],[_0xd452('0x3f')]);if(_0x425bfd[_0xd452('0x40')][_0xd452('0x3b')]){delete _0x425bfd['account']['Applications'];}if(_0x425bfd[_0xd452('0x40')]['List']&&_0x425bfd[_0xd452('0x40')][_0xd452('0x38')][_0xd452('0x39')][_0xd452('0x41')]){return _0x425bfd['account'][_0xd452('0x38')][_0xd452('0x39')][0x0];}var _0x2859ba=_[_0xd452('0x42')](_0x5c078e[_0xd452('0x23')],{'firstName':_0x5c078e[_0xd452('0x23')][_0xd452('0x35')],'ListId':_0x3964ac['ListId']});_0x2859ba[_0x5c078e['body'][_0xd452('0x32')]]=_0x5c078e[_0xd452('0x23')][_0xd452('0x35')];return db[_0xd452('0x25')][_0xd452('0x43')](_0x2859ba,{'fields':_0x4faddb,'raw':!![]});}})[_0xd452('0xe')](function(_0x52c1be){_0x425bfd[_0xd452('0x44')]=_0x52c1be;if(_0x52c1be){var _0x5155bf={'ContactId':_0x52c1be['id'],'FaxAccountId':_0x5c078e[_0xd452('0x40')]['id'],'fax':_0x52c1be[_0xd452('0x24')]};return db[_0xd452('0x45')][_0xd452('0x36')]({'where':{'ContactId':_0x52c1be['id'],'closed':![],'FaxAccountId':_0x5c078e[_0xd452('0x40')]['id']}})[_0xd452('0xe')](function(_0x3695d0){if(_0x3695d0){return[_0x3695d0,![]];}return db[_0xd452('0x45')][_0xd452('0x43')](_0x5155bf)[_0xd452('0xe')](function(_0x1d6bdb){return[_0x1d6bdb,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd452('0x46')](function(_0x5384d8,_0xd5546a){var _0x109a3d=_0x5384d8[_0xd452('0x3c')]({'plain':!![]});if(_0xd5546a){if(_0x425bfd[_0xd452('0x40')][_0xd452('0x47')]){_0x425bfd[_0xd452('0x3d')][_0xd452('0x48')]({'id':0x0,'priority':_0x425bfd[_0xd452('0x3d')]['length']+0x1,'app':_0xd452('0x49'),'appdata':_0xd452('0x4a'),'interval':'*,*,*,*'});}_0x109a3d['created']=!![];}else{_0x109a3d[_0xd452('0x4b')]=![];}_0x425bfd[_0xd452('0x4c')]=_0x109a3d;return db['FaxMessage'][_0xd452('0x43')]({'body':_0x5c078e[_0xd452('0x23')][_0xd452('0x23')],'FaxAccountId':_0x5c078e[_0xd452('0x40')]['id'],'FaxInteractionId':_0x5384d8['id'],'direction':'in','ContactId':_0x5384d8[_0xd452('0x4d')],'AttachmentId':_0x5c078e[_0xd452('0x23')][_0xd452('0x4e')]});})[_0xd452('0xe')](function(_0x10524e){_0x425bfd[_0xd452('0x15')]=_0x10524e;if(_0x425bfd[_0xd452('0x4c')][_0xd452('0x4f')]){return db['User'][_0xd452('0x36')]({'attributes':['id',_0xd452('0x50')],'where':{'id':_0x425bfd[_0xd452('0x4c')][_0xd452('0x4f')]}})[_0xd452('0xe')](function(_0x1e69b6){if(_0x1e69b6){_0x425bfd[_0xd452('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd452('0x51'),'appdata':_0x1e69b6[_0xd452('0x50')]+','+(_0x425bfd['account'][_0xd452('0x52')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd452('0x53'),_0xd452('0x54'),_0x425bfd);});}return respondWithRpcPromise(_0xd452('0x53'),_0xd452('0x54'),_0x425bfd);})[_0xd452('0xe')](function(_0x363d71){_0x191cca(_0x363d71);})[_0xd452('0x55')](function(_0x72ea33){_0x3078fe(_0xa24e39[_0xd452('0x13')](0x1f4,_0x72ea33[_0xd452('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 8096323..64e4db5 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 _0x9c85=['update','emit','removeListener','register','length','faxAccount:','remove'];(function(_0x5e7ee9,_0x4dbc4b){var _0xadb900=function(_0x5eecb3){while(--_0x5eecb3){_0x5e7ee9['push'](_0x5e7ee9['shift']());}};_0xadb900(++_0x4dbc4b);}(_0x9c85,0x1aa));var _0x59c8=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x9c85[_0x819464];return _0x49dcc0;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0x59c8('0x0'),_0x59c8('0x1')];function createListener(_0x3f80bc,_0x3f4df2){return function(_0x2387c4){_0x3f4df2[_0x59c8('0x2')](_0x3f80bc,_0x2387c4);};}function removeListener(_0x5429fe,_0x5727da){return function(){FaxAccountEvents[_0x59c8('0x3')](_0x5429fe,_0x5727da);};}exports[_0x59c8('0x4')]=function(_0x44eb60){for(var _0x2f484a=0x0,_0x5af0cd=events[_0x59c8('0x5')];_0x2f484a<_0x5af0cd;_0x2f484a++){var _0x5b104d=events[_0x2f484a];var _0xe928dc=createListener(_0x59c8('0x6')+_0x5b104d,_0x44eb60);FaxAccountEvents['on'](_0x5b104d,_0xe928dc);}}; \ No newline at end of file +var _0x7c02=['save','remove','emit','removeListener','faxAccount:','./faxAccount.events'];(function(_0xed6031,_0x75b701){var _0x26975e=function(_0x257fd0){while(--_0x257fd0){_0xed6031['push'](_0xed6031['shift']());}};_0x26975e(++_0x75b701);}(_0x7c02,0x1a3));var _0x27c0=function(_0x47b387,_0x509cef){_0x47b387=_0x47b387-0x0;var _0x48efb3=_0x7c02[_0x47b387];return _0x48efb3;};'use strict';var FaxAccountEvents=require(_0x27c0('0x0'));var events=[_0x27c0('0x1'),_0x27c0('0x2'),'update'];function createListener(_0x50abb9,_0x380b16){return function(_0x2bb0de){_0x380b16[_0x27c0('0x3')](_0x50abb9,_0x2bb0de);};}function removeListener(_0x5ca958,_0x5d8179){return function(){FaxAccountEvents[_0x27c0('0x4')](_0x5ca958,_0x5d8179);};}exports['register']=function(_0x225243){for(var _0x354226=0x0,_0x3064d5=events['length'];_0x354226<_0x3064d5;_0x354226++){var _0x158904=events[_0x354226];var _0x9b6068=createListener(_0x27c0('0x5')+_0x158904,_0x225243);FaxAccountEvents['on'](_0x158904,_0x9b6068);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9496c85..c65bc50 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(_0x5595e1,_0x21ddd8){var _0x47764a=function(_0x19c982){while(--_0x19c982){_0x5595e1['push'](_0x5595e1['shift']());}};_0x47764a(++_0x21ddd8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x33d744,_0x26877f){var _0x4422ae=function(_0x57cf4b){while(--_0x57cf4b){_0x33d744['push'](_0x33d744['shift']());}};_0x4422ae(++_0x26877f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 b4781b1..49a54c9 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 _0x2904=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x2eee73,_0x3eecc4){var _0xb94756=function(_0x5ecf5d){while(--_0x5ecf5d){_0x2eee73['push'](_0x2eee73['shift']());}};_0xb94756(++_0x3eecc4);}(_0x2904,0x106));var _0x4290=function(_0x28eba8,_0x3fdef0){_0x28eba8=_0x28eba8-0x0;var _0x2ebfa5=_0x2904[_0x28eba8];return _0x2ebfa5;};'use strict';var Sequelize=require('sequelize');module[_0x4290('0x0')]={'priority':{'type':Sequelize[_0x4290('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4290('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4290('0x3')]()},'description':{'type':Sequelize[_0x4290('0x2')]},'interval':{'type':Sequelize[_0x4290('0x2')],'defaultValue':_0x4290('0x4')}}; \ No newline at end of file +var _0x0845=['sequelize','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x5a84dc,_0x9ab5af){var _0x5bdfcc=function(_0x112ab0){while(--_0x112ab0){_0x5a84dc['push'](_0x5a84dc['shift']());}};_0x5bdfcc(++_0x9ab5af);}(_0x0845,0x1d6));var _0x5084=function(_0x1c50fc,_0x38fcb5){_0x1c50fc=_0x1c50fc-0x0;var _0x198cc6=_0x0845[_0x1c50fc];return _0x198cc6;};'use strict';var Sequelize=require(_0x5084('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5084('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5084('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5084('0x3')]()},'description':{'type':Sequelize[_0x5084('0x2')]},'interval':{'type':Sequelize[_0x5084('0x2')],'defaultValue':_0x5084('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e062c74..1abb692 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 _0x3e17=['fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','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','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','index','map','FaxApplication','rawAttributes'];(function(_0x171ba1,_0x7cade2){var _0x5422be=function(_0x29446c){while(--_0x29446c){_0x171ba1['push'](_0x171ba1['shift']());}};_0x5422be(++_0x7cade2);}(_0x3e17,0xb9));var _0x73e1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3e17[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73e1('0x0'));var jsonpatch=require(_0x73e1('0x1'));var rp=require(_0x73e1('0x2'));var moment=require(_0x73e1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x73e1('0x4'));var util=require('util');var path=require(_0x73e1('0x5'));var sox=require(_0x73e1('0x6'));var csv=require('to-csv');var ejs=require(_0x73e1('0x7'));var fs=require('fs');var fs_extra=require(_0x73e1('0x8'));var _=require(_0x73e1('0x9'));var squel=require(_0x73e1('0xa'));var crypto=require(_0x73e1('0xb'));var jsforce=require(_0x73e1('0xc'));var deskjs=require(_0x73e1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x73e1('0xe'));var Papa=require(_0x73e1('0xf'));var Redis=require(_0x73e1('0x10'));var authService=require(_0x73e1('0x11'));var qs=require(_0x73e1('0x12'));var as=require(_0x73e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73e1('0x14'))(_0x73e1('0x15'));var utils=require(_0x73e1('0x16'));var config=require(_0x73e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x73e1('0x18'))['db'];function respondWithStatusCode(_0x47a485,_0x182a77){_0x182a77=_0x182a77||0xcc;return function(_0x383f56){if(_0x383f56){return _0x47a485['sendStatus'](_0x182a77);}return _0x47a485['status'](_0x182a77)[_0x73e1('0x19')]();};}function respondWithResult(_0x58ebd3,_0x2506c3){_0x2506c3=_0x2506c3||0xc8;return function(_0x45f1d8){if(_0x45f1d8){return _0x58ebd3[_0x73e1('0x1a')](_0x2506c3)[_0x73e1('0x1b')](_0x45f1d8);}};}function respondWithFilteredResult(_0x14e8f4,_0x297e6f){return function(_0x4bd57f){if(_0x4bd57f){var _0x1ab830=typeof _0x297e6f[_0x73e1('0x1c')]===_0x73e1('0x1d')&&typeof _0x297e6f['limit']===_0x73e1('0x1d');var _0x17ae9a=_0x4bd57f[_0x73e1('0x1e')];var _0x2e67f8=_0x1ab830?0x0:_0x297e6f[_0x73e1('0x1c')];var _0x322f56=_0x1ab830?_0x4bd57f['count']:_0x297e6f[_0x73e1('0x1c')]+_0x297e6f[_0x73e1('0x1f')];var _0x25a1ef;if(_0x322f56>=_0x17ae9a){_0x322f56=_0x17ae9a;_0x25a1ef=0xc8;}else{_0x25a1ef=0xce;}_0x14e8f4[_0x73e1('0x1a')](_0x25a1ef);return _0x14e8f4[_0x73e1('0x20')](_0x73e1('0x21'),_0x2e67f8+'-'+_0x322f56+'/'+_0x17ae9a)[_0x73e1('0x1b')](_0x4bd57f);}return null;};}function patchUpdates(_0x2f30b8){return function(_0x3acd2b){try{jsonpatch[_0x73e1('0x22')](_0x3acd2b,_0x2f30b8,!![]);}catch(_0x46520a){return BPromise['reject'](_0x46520a);}return _0x3acd2b[_0x73e1('0x23')]();};}function saveUpdates(_0x23f152,_0x4b731b){return function(_0xfcebde){if(_0xfcebde){return _0xfcebde[_0x73e1('0x24')](_0x23f152)[_0x73e1('0x25')](function(_0xdb71ff){return _0xdb71ff;});}return null;};}function removeEntity(_0x528c10,_0x5899d6){return function(_0x5c0216){if(_0x5c0216){return _0x5c0216[_0x73e1('0x26')]()[_0x73e1('0x25')](function(){_0x528c10[_0x73e1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20d5a2,_0xdf5142){return function(_0x3ec030){if(!_0x3ec030){_0x20d5a2[_0x73e1('0x27')](0x194);}return _0x3ec030;};}function handleError(_0xeeab4c,_0x4a2d12){_0x4a2d12=_0x4a2d12||0x1f4;return function(_0x261a87){logger[_0x73e1('0x28')](_0x261a87['stack']);if(_0x261a87[_0x73e1('0x29')]){delete _0x261a87[_0x73e1('0x29')];}_0xeeab4c[_0x73e1('0x1a')](_0x4a2d12)['send'](_0x261a87);};}exports[_0x73e1('0x2a')]=function(_0x31413b,_0x4d46ef){var _0x244a04={},_0x259db3={},_0xe524c8={'count':0x0,'rows':[]};var _0x2d9ecc=_[_0x73e1('0x2b')](db[_0x73e1('0x2c')][_0x73e1('0x2d')],function(_0x4da2e7){return{'name':_0x4da2e7[_0x73e1('0x2e')],'type':_0x4da2e7[_0x73e1('0x2f')][_0x73e1('0x30')]};});_0x259db3[_0x73e1('0x31')]=_[_0x73e1('0x2b')](_0x2d9ecc,_0x73e1('0x29'));_0x259db3[_0x73e1('0x32')]=_['keys'](_0x31413b['query']);_0x259db3['filters']=_[_0x73e1('0x33')](_0x259db3[_0x73e1('0x31')],_0x259db3[_0x73e1('0x32')]);_0x244a04[_0x73e1('0x34')]=_['intersection'](_0x259db3['model'],qs[_0x73e1('0x35')](_0x31413b[_0x73e1('0x32')]['fields']));_0x244a04[_0x73e1('0x34')]=_0x244a04[_0x73e1('0x34')][_0x73e1('0x36')]?_0x244a04['attributes']:_0x259db3[_0x73e1('0x31')];if(!_0x31413b[_0x73e1('0x32')][_0x73e1('0x37')](_0x73e1('0x38'))){_0x244a04[_0x73e1('0x1f')]=qs[_0x73e1('0x1f')](_0x31413b[_0x73e1('0x32')][_0x73e1('0x1f')]);_0x244a04['offset']=qs['offset'](_0x31413b['query']['offset']);}_0x244a04[_0x73e1('0x39')]=qs[_0x73e1('0x3a')](_0x31413b[_0x73e1('0x32')][_0x73e1('0x3a')]);_0x244a04[_0x73e1('0x3b')]=qs[_0x73e1('0x3c')](_[_0x73e1('0x3d')](_0x31413b[_0x73e1('0x32')],_0x259db3['filters']),_0x2d9ecc);if(_0x31413b['query'][_0x73e1('0x3e')]){_0x244a04['where']=_[_0x73e1('0x3f')](_0x244a04[_0x73e1('0x3b')],{'$or':_[_0x73e1('0x2b')](_0x2d9ecc,function(_0x1fda9e){if(_0x1fda9e[_0x73e1('0x2f')]!==_0x73e1('0x40')){var _0x279337={};_0x279337[_0x1fda9e[_0x73e1('0x29')]]={'$like':'%'+_0x31413b[_0x73e1('0x32')][_0x73e1('0x3e')]+'%'};return _0x279337;}})});}_0x244a04=_[_0x73e1('0x3f')]({},_0x244a04,_0x31413b[_0x73e1('0x41')]);var _0x1c4cab={'where':_0x244a04['where']};return db['FaxApplication'][_0x73e1('0x1e')](_0x1c4cab)[_0x73e1('0x25')](function(_0x4bcc4e){_0xe524c8[_0x73e1('0x1e')]=_0x4bcc4e;if(_0x31413b[_0x73e1('0x32')]['includeAll']){_0x244a04[_0x73e1('0x42')]=[{'all':!![]}];}return db[_0x73e1('0x2c')][_0x73e1('0x43')](_0x244a04);})['then'](function(_0x138606){_0xe524c8[_0x73e1('0x44')]=_0x138606;return _0xe524c8;})[_0x73e1('0x25')](respondWithFilteredResult(_0x4d46ef,_0x244a04))[_0x73e1('0x45')](handleError(_0x4d46ef,null));};exports[_0x73e1('0x46')]=function(_0x4a9a34,_0x233bb4){var _0x5b59f5={'raw':!![],'where':{'id':_0x4a9a34[_0x73e1('0x47')]['id']}},_0x516878={};_0x516878[_0x73e1('0x31')]=_[_0x73e1('0x48')](db[_0x73e1('0x2c')]['rawAttributes']);_0x516878[_0x73e1('0x32')]=_[_0x73e1('0x48')](_0x4a9a34[_0x73e1('0x32')]);_0x516878[_0x73e1('0x3c')]=_[_0x73e1('0x33')](_0x516878[_0x73e1('0x31')],_0x516878[_0x73e1('0x32')]);_0x5b59f5[_0x73e1('0x34')]=_['intersection'](_0x516878[_0x73e1('0x31')],qs[_0x73e1('0x35')](_0x4a9a34[_0x73e1('0x32')][_0x73e1('0x35')]));_0x5b59f5[_0x73e1('0x34')]=_0x5b59f5[_0x73e1('0x34')][_0x73e1('0x36')]?_0x5b59f5['attributes']:_0x516878['model'];if(_0x4a9a34[_0x73e1('0x32')][_0x73e1('0x49')]){_0x5b59f5[_0x73e1('0x42')]=[{'all':!![]}];}_0x5b59f5=_[_0x73e1('0x3f')]({},_0x5b59f5,_0x4a9a34[_0x73e1('0x41')]);return db['FaxApplication'][_0x73e1('0x4a')](_0x5b59f5)['then'](handleEntityNotFound(_0x233bb4,null))['then'](respondWithResult(_0x233bb4,null))[_0x73e1('0x45')](handleError(_0x233bb4,null));};exports[_0x73e1('0x4b')]=function(_0x27a529,_0x54afa3){return db[_0x73e1('0x2c')][_0x73e1('0x4b')](_0x27a529[_0x73e1('0x4c')],{})[_0x73e1('0x25')](respondWithResult(_0x54afa3,0xc9))['catch'](handleError(_0x54afa3,null));};exports[_0x73e1('0x24')]=function(_0x390bc6,_0x225e4d){if(_0x390bc6[_0x73e1('0x4c')]['id']){delete _0x390bc6[_0x73e1('0x4c')]['id'];}return db['FaxApplication'][_0x73e1('0x4a')]({'where':{'id':_0x390bc6[_0x73e1('0x47')]['id']}})[_0x73e1('0x25')](handleEntityNotFound(_0x225e4d,null))[_0x73e1('0x25')](saveUpdates(_0x390bc6[_0x73e1('0x4c')],null))['then'](respondWithResult(_0x225e4d,null))[_0x73e1('0x45')](handleError(_0x225e4d,null));};exports['destroy']=function(_0x914b31,_0x376cf7){return db['FaxApplication']['find']({'where':{'id':_0x914b31[_0x73e1('0x47')]['id']}})['then'](handleEntityNotFound(_0x376cf7,null))[_0x73e1('0x25')](removeEntity(_0x376cf7,null))[_0x73e1('0x45')](handleError(_0x376cf7,null));}; \ No newline at end of file +var _0xa695=['then','error','name','send','index','map','FaxApplication','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','rawAttributes','intersection','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x436faa,_0x30eca2){var _0xfe3d39=function(_0xe6a90e){while(--_0xe6a90e){_0x436faa['push'](_0x436faa['shift']());}};_0xfe3d39(++_0x30eca2);}(_0xa695,0x108));var _0x5a69=function(_0xf1110c,_0x46ca8b){_0xf1110c=_0xf1110c-0x0;var _0x5a8b71=_0xa695[_0xf1110c];return _0x5a8b71;};'use strict';var emlformat=require(_0x5a69('0x0'));var rimraf=require(_0x5a69('0x1'));var zipdir=require(_0x5a69('0x2'));var jsonpatch=require(_0x5a69('0x3'));var rp=require('request-promise');var moment=require(_0x5a69('0x4'));var BPromise=require(_0x5a69('0x5'));var Mustache=require(_0x5a69('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5a69('0x7'));var csv=require(_0x5a69('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a69('0x9'));var _=require(_0x5a69('0xa'));var squel=require(_0x5a69('0xb'));var crypto=require(_0x5a69('0xc'));var jsforce=require(_0x5a69('0xd'));var deskjs=require(_0x5a69('0xe'));var toCsv=require(_0x5a69('0x8'));var querystring=require(_0x5a69('0xf'));var Papa=require(_0x5a69('0x10'));var Redis=require(_0x5a69('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5a69('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a69('0x13'));var logger=require(_0x5a69('0x14'))(_0x5a69('0x15'));var utils=require(_0x5a69('0x16'));var config=require(_0x5a69('0x17'));var licenseUtil=require(_0x5a69('0x18'));var db=require(_0x5a69('0x19'))['db'];function respondWithStatusCode(_0x4e725a,_0x7a7c5e){_0x7a7c5e=_0x7a7c5e||0xcc;return function(_0x49685e){if(_0x49685e){return _0x4e725a[_0x5a69('0x1a')](_0x7a7c5e);}return _0x4e725a[_0x5a69('0x1b')](_0x7a7c5e)[_0x5a69('0x1c')]();};}function respondWithResult(_0x1a44b8,_0x3a5a25){_0x3a5a25=_0x3a5a25||0xc8;return function(_0x5cf0a3){if(_0x5cf0a3){return _0x1a44b8[_0x5a69('0x1b')](_0x3a5a25)[_0x5a69('0x1d')](_0x5cf0a3);}};}function respondWithFilteredResult(_0x8f001b,_0x43eac2){return function(_0x19206b){if(_0x19206b){var _0xb510e3=typeof _0x43eac2[_0x5a69('0x1e')]===_0x5a69('0x1f')&&typeof _0x43eac2[_0x5a69('0x20')]===_0x5a69('0x1f');var _0xa10339=_0x19206b[_0x5a69('0x21')];var _0x4a4a6a=_0xb510e3?0x0:_0x43eac2['offset'];var _0x4a95a4=_0xb510e3?_0x19206b[_0x5a69('0x21')]:_0x43eac2[_0x5a69('0x1e')]+_0x43eac2['limit'];var _0x421db9;if(_0x4a95a4>=_0xa10339){_0x4a95a4=_0xa10339;_0x421db9=0xc8;}else{_0x421db9=0xce;}_0x8f001b[_0x5a69('0x1b')](_0x421db9);return _0x8f001b[_0x5a69('0x22')](_0x5a69('0x23'),_0x4a4a6a+'-'+_0x4a95a4+'/'+_0xa10339)[_0x5a69('0x1d')](_0x19206b);}return null;};}function patchUpdates(_0x5a6cc3){return function(_0x5e6046){try{jsonpatch[_0x5a69('0x24')](_0x5e6046,_0x5a6cc3,!![]);}catch(_0x4a405c){return BPromise[_0x5a69('0x25')](_0x4a405c);}return _0x5e6046[_0x5a69('0x26')]();};}function saveUpdates(_0xeb2e8d,_0x1387a0){return function(_0x1d8779){if(_0x1d8779){return _0x1d8779[_0x5a69('0x27')](_0xeb2e8d)[_0x5a69('0x28')](function(_0x1ab97d){return _0x1ab97d;});}return null;};}function removeEntity(_0x3c76e0,_0x4d1421){return function(_0x3bee7a){if(_0x3bee7a){return _0x3bee7a['destroy']()[_0x5a69('0x28')](function(){_0x3c76e0[_0x5a69('0x1b')](0xcc)[_0x5a69('0x1c')]();});}};}function handleEntityNotFound(_0x59d5c3,_0x2e4ae6){return function(_0x4cbfbd){if(!_0x4cbfbd){_0x59d5c3[_0x5a69('0x1a')](0x194);}return _0x4cbfbd;};}function handleError(_0x3c7071,_0x5aacda){_0x5aacda=_0x5aacda||0x1f4;return function(_0x503b85){logger[_0x5a69('0x29')](_0x503b85['stack']);if(_0x503b85[_0x5a69('0x2a')]){delete _0x503b85[_0x5a69('0x2a')];}_0x3c7071[_0x5a69('0x1b')](_0x5aacda)[_0x5a69('0x2b')](_0x503b85);};}exports[_0x5a69('0x2c')]=function(_0x2b3af5,_0x3e1f06){var _0x4d7dc6={},_0x40a939={},_0xadd3d2={'count':0x0,'rows':[]};var _0xbbed67=_[_0x5a69('0x2d')](db[_0x5a69('0x2e')]['rawAttributes'],function(_0x256b02){return{'name':_0x256b02['fieldName'],'type':_0x256b02[_0x5a69('0x2f')][_0x5a69('0x30')]};});_0x40a939[_0x5a69('0x31')]=_[_0x5a69('0x2d')](_0xbbed67,_0x5a69('0x2a'));_0x40a939['query']=_[_0x5a69('0x32')](_0x2b3af5[_0x5a69('0x33')]);_0x40a939[_0x5a69('0x34')]=_['intersection'](_0x40a939[_0x5a69('0x31')],_0x40a939[_0x5a69('0x33')]);_0x4d7dc6['attributes']=_['intersection'](_0x40a939['model'],qs[_0x5a69('0x35')](_0x2b3af5['query'][_0x5a69('0x35')]));_0x4d7dc6[_0x5a69('0x36')]=_0x4d7dc6['attributes'][_0x5a69('0x37')]?_0x4d7dc6['attributes']:_0x40a939[_0x5a69('0x31')];if(!_0x2b3af5[_0x5a69('0x33')][_0x5a69('0x38')](_0x5a69('0x39'))){_0x4d7dc6[_0x5a69('0x20')]=qs[_0x5a69('0x20')](_0x2b3af5[_0x5a69('0x33')]['limit']);_0x4d7dc6['offset']=qs[_0x5a69('0x1e')](_0x2b3af5['query'][_0x5a69('0x1e')]);}_0x4d7dc6[_0x5a69('0x3a')]=qs[_0x5a69('0x3b')](_0x2b3af5[_0x5a69('0x33')][_0x5a69('0x3b')]);_0x4d7dc6[_0x5a69('0x3c')]=qs['filters'](_['pick'](_0x2b3af5[_0x5a69('0x33')],_0x40a939[_0x5a69('0x34')]),_0xbbed67);if(_0x2b3af5[_0x5a69('0x33')]['filter']){_0x4d7dc6['where']=_[_0x5a69('0x3d')](_0x4d7dc6['where'],{'$or':_[_0x5a69('0x2d')](_0xbbed67,function(_0xff23f5){if(_0xff23f5[_0x5a69('0x2f')]!==_0x5a69('0x3e')){var _0x400764={};_0x400764[_0xff23f5[_0x5a69('0x2a')]]={'$like':'%'+_0x2b3af5['query'][_0x5a69('0x3f')]+'%'};return _0x400764;}})});}_0x4d7dc6=_[_0x5a69('0x3d')]({},_0x4d7dc6,_0x2b3af5[_0x5a69('0x40')]);var _0x548629={'where':_0x4d7dc6[_0x5a69('0x3c')]};return db[_0x5a69('0x2e')]['count'](_0x548629)['then'](function(_0x1db3b8){_0xadd3d2[_0x5a69('0x21')]=_0x1db3b8;if(_0x2b3af5[_0x5a69('0x33')][_0x5a69('0x41')]){_0x4d7dc6[_0x5a69('0x42')]=[{'all':!![]}];}return db[_0x5a69('0x2e')]['findAll'](_0x4d7dc6);})[_0x5a69('0x28')](function(_0x3d6311){_0xadd3d2[_0x5a69('0x43')]=_0x3d6311;return _0xadd3d2;})[_0x5a69('0x28')](respondWithFilteredResult(_0x3e1f06,_0x4d7dc6))[_0x5a69('0x44')](handleError(_0x3e1f06,null));};exports['show']=function(_0x3684ec,_0x3ad225){var _0x4a0da0={'raw':!![],'where':{'id':_0x3684ec[_0x5a69('0x45')]['id']}},_0x34f103={};_0x34f103['model']=_['keys'](db[_0x5a69('0x2e')][_0x5a69('0x46')]);_0x34f103[_0x5a69('0x33')]=_['keys'](_0x3684ec['query']);_0x34f103[_0x5a69('0x34')]=_[_0x5a69('0x47')](_0x34f103[_0x5a69('0x31')],_0x34f103[_0x5a69('0x33')]);_0x4a0da0[_0x5a69('0x36')]=_[_0x5a69('0x47')](_0x34f103['model'],qs[_0x5a69('0x35')](_0x3684ec[_0x5a69('0x33')][_0x5a69('0x35')]));_0x4a0da0[_0x5a69('0x36')]=_0x4a0da0['attributes'][_0x5a69('0x37')]?_0x4a0da0[_0x5a69('0x36')]:_0x34f103[_0x5a69('0x31')];if(_0x3684ec[_0x5a69('0x33')][_0x5a69('0x41')]){_0x4a0da0[_0x5a69('0x42')]=[{'all':!![]}];}_0x4a0da0=_[_0x5a69('0x3d')]({},_0x4a0da0,_0x3684ec['options']);return db[_0x5a69('0x2e')][_0x5a69('0x48')](_0x4a0da0)['then'](handleEntityNotFound(_0x3ad225,null))['then'](respondWithResult(_0x3ad225,null))['catch'](handleError(_0x3ad225,null));};exports[_0x5a69('0x49')]=function(_0x5c8483,_0x4eb4a6){return db['FaxApplication']['create'](_0x5c8483[_0x5a69('0x4a')],{})[_0x5a69('0x28')](respondWithResult(_0x4eb4a6,0xc9))[_0x5a69('0x44')](handleError(_0x4eb4a6,null));};exports[_0x5a69('0x27')]=function(_0x2d5f2d,_0x3262d4){if(_0x2d5f2d[_0x5a69('0x4a')]['id']){delete _0x2d5f2d[_0x5a69('0x4a')]['id'];}return db[_0x5a69('0x2e')][_0x5a69('0x48')]({'where':{'id':_0x2d5f2d[_0x5a69('0x45')]['id']}})[_0x5a69('0x28')](handleEntityNotFound(_0x3262d4,null))[_0x5a69('0x28')](saveUpdates(_0x2d5f2d['body'],null))[_0x5a69('0x28')](respondWithResult(_0x3262d4,null))[_0x5a69('0x44')](handleError(_0x3262d4,null));};exports[_0x5a69('0x4b')]=function(_0x10fe2a,_0x365718){return db[_0x5a69('0x2e')][_0x5a69('0x48')]({'where':{'id':_0x10fe2a['params']['id']}})[_0x5a69('0x28')](handleEntityNotFound(_0x365718,null))['then'](removeEntity(_0x365718,null))[_0x5a69('0x44')](handleError(_0x365718,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bc9ea88..9b31f6c 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 _0xc4c1=['lodash','util','api','bluebird','path','rimraf','./faxApplication.attributes','exports','define'];(function(_0x15f9da,_0x305920){var _0x1cb181=function(_0x1023a8){while(--_0x1023a8){_0x15f9da['push'](_0x15f9da['shift']());}};_0x1cb181(++_0x305920);}(_0xc4c1,0x132));var _0x1c4c=function(_0x4ad7bd,_0x4baf6f){_0x4ad7bd=_0x4ad7bd-0x0;var _0x12a88b=_0xc4c1[_0x4ad7bd];return _0x12a88b;};'use strict';var _=require(_0x1c4c('0x0'));var util=require(_0x1c4c('0x1'));var logger=require('../../config/logger')(_0x1c4c('0x2'));var moment=require('moment');var BPromise=require(_0x1c4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c4c('0x4'));var rimraf=require(_0x1c4c('0x5'));var config=require('../../config/environment');var attributes=require(_0x1c4c('0x6'));module[_0x1c4c('0x7')]=function(_0x3ae878,_0xf4bbe6){return _0x3ae878[_0x1c4c('0x8')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa432=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','FaxApplication','fax_applications'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xa432,0x84));var _0x2a43=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa432[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x2a43('0x0'));var util=require(_0x2a43('0x1'));var logger=require(_0x2a43('0x2'))(_0x2a43('0x3'));var moment=require(_0x2a43('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a43('0x5'));var rimraf=require(_0x2a43('0x6'));var config=require(_0x2a43('0x7'));var attributes=require('./faxApplication.attributes');module[_0x2a43('0x8')]=function(_0x80a8c4,_0x182de1){return _0x80a8c4['define'](_0x2a43('0x9'),attributes,{'tableName':_0x2a43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2a43('0xb'),'collate':_0x2a43('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 05df258..04b58ee 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 _0x0f10=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','body','options','attributes'];(function(_0x2b042e,_0x3f13d0){var _0x65de02=function(_0x168883){while(--_0x168883){_0x2b042e['push'](_0x2b042e['shift']());}};_0x65de02(++_0x3f13d0);}(_0x0f10,0x14b));var _0x00f1=function(_0x434fb5,_0x50c929){_0x434fb5=_0x434fb5-0x0;var _0x4a1857=_0x0f10[_0x434fb5];return _0x4a1857;};'use strict';var _=require(_0x00f1('0x0'));var util=require('util');var moment=require(_0x00f1('0x1'));var BPromise=require(_0x00f1('0x2'));var rs=require(_0x00f1('0x3'));var fs=require('fs');var Redis=require(_0x00f1('0x4'));var db=require(_0x00f1('0x5'))['db'];var utils=require(_0x00f1('0x6'));var logger=require('../../config/logger')(_0x00f1('0x7'));var config=require(_0x00f1('0x8'));var jayson=require(_0x00f1('0x9'));var client=jayson[_0x00f1('0xa')][_0x00f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19d9f6,_0x1057dc,_0x4cbaa5){return new BPromise(function(_0x7a0a58,_0x245976){return client[_0x00f1('0xc')](_0x19d9f6,_0x4cbaa5)[_0x00f1('0xd')](function(_0x8d3d0b){logger[_0x00f1('0xe')](_0x00f1('0xf'),_0x1057dc,_0x00f1('0x10'));logger[_0x00f1('0x11')](_0x00f1('0x12'),_0x1057dc,_0x00f1('0x10'),JSON[_0x00f1('0x13')](_0x8d3d0b));if(_0x8d3d0b['error']){if(_0x8d3d0b[_0x00f1('0x14')][_0x00f1('0x15')]===0x1f4){logger[_0x00f1('0x14')](_0x00f1('0xf'),_0x1057dc,_0x8d3d0b[_0x00f1('0x14')][_0x00f1('0x16')]);return _0x245976(_0x8d3d0b[_0x00f1('0x14')][_0x00f1('0x16')]);}logger[_0x00f1('0x14')]('FaxApplication,\x20%s,\x20%s',_0x1057dc,_0x8d3d0b[_0x00f1('0x14')][_0x00f1('0x16')]);return _0x7a0a58(_0x8d3d0b[_0x00f1('0x14')][_0x00f1('0x16')]);}else{logger[_0x00f1('0xe')]('FaxApplication,\x20%s,\x20%s',_0x1057dc,_0x00f1('0x10'));_0x7a0a58(_0x8d3d0b[_0x00f1('0x17')]['message']);}})['catch'](function(_0x2d3b1b){logger[_0x00f1('0x14')](_0x00f1('0xf'),_0x1057dc,_0x2d3b1b);_0x245976(_0x2d3b1b);});});}exports[_0x00f1('0x18')]=function(_0xb44537){var _0x22e4ff=this;return new Promise(function(_0x119dd7,_0x3747cd){return db[_0x00f1('0x19')]['update'](_0xb44537[_0x00f1('0x1a')],{'raw':_0xb44537['options']?_0xb44537[_0x00f1('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb44537[_0x00f1('0x1b')]?_0xb44537['options']['where']||null:null,'attributes':_0xb44537[_0x00f1('0x1b')]?_0xb44537[_0x00f1('0x1b')][_0x00f1('0x1c')]||null:null,'limit':_0xb44537['options']?_0xb44537['options']['limit']||null:null})[_0x00f1('0xd')](function(_0x649d3f){logger[_0x00f1('0xe')](_0x00f1('0x18'),_0xb44537);logger['debug'](_0x00f1('0x18'),_0xb44537,JSON[_0x00f1('0x13')](_0x649d3f));_0x119dd7(_0x649d3f);})[_0x00f1('0x1d')](function(_0x643faa){logger[_0x00f1('0x14')]('UpdateFaxApplication',_0x643faa[_0x00f1('0x16')],_0xb44537);_0x3747cd(_0x22e4ff[_0x00f1('0x14')](0x1f4,_0x643faa[_0x00f1('0x16')]));});});}; \ No newline at end of file +var _0xc978=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where'];(function(_0x551152,_0x498018){var _0x37c9d7=function(_0x488f77){while(--_0x488f77){_0x551152['push'](_0x551152['shift']());}};_0x37c9d7(++_0x498018);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('FaxApplication,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});}exports[_0x8c97('0x1a')]=function(_0x3f7ac7){var _0x18cffa=this;return new Promise(function(_0x3b57ed,_0x272010){return db[_0x8c97('0x1b')][_0x8c97('0x1c')](_0x3f7ac7[_0x8c97('0x1d')],{'raw':_0x3f7ac7[_0x8c97('0x1e')]?_0x3f7ac7[_0x8c97('0x1e')][_0x8c97('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7ac7[_0x8c97('0x1e')]?_0x3f7ac7[_0x8c97('0x1e')][_0x8c97('0x20')]||null:null,'attributes':_0x3f7ac7[_0x8c97('0x1e')]?_0x3f7ac7[_0x8c97('0x1e')]['attributes']||null:null,'limit':_0x3f7ac7[_0x8c97('0x1e')]?_0x3f7ac7[_0x8c97('0x1e')][_0x8c97('0x21')]||null:null})['then'](function(_0x4d4dc9){logger[_0x8c97('0x17')]('UpdateFaxApplication',_0x3f7ac7);logger[_0x8c97('0x11')](_0x8c97('0x1a'),_0x3f7ac7,JSON[_0x8c97('0x13')](_0x4d4dc9));_0x3b57ed(_0x4d4dc9);})[_0x8c97('0x19')](function(_0x354251){logger[_0x8c97('0x14')](_0x8c97('0x1a'),_0x354251['message'],_0x3f7ac7);_0x272010(_0x18cffa['error'](0x1f4,_0x354251[_0x8c97('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5389945..be33919 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x5e21b0,_0x468e2){var _0xf4a3b8=function(_0x58f005){while(--_0x58f005){_0x5e21b0['push'](_0x5e21b0['shift']());}};_0xf4a3b8(++_0x468e2);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x5eb8[_0x2fd69d];return _0x5d5ef3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c8103,_0x3ab41a){var _0x46ea95=function(_0x4a33fb){while(--_0x4a33fb){_0x1c8103['push'](_0x1c8103['shift']());}};_0x46ea95(++_0x3ab41a);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2c4ac87..d6a9bc1 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 _0x98d6=['sequelize','exports','STRING','DATE','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98d6,0xeb));var _0x698d=function(_0x201a14,_0x51aedb){_0x201a14=_0x201a14-0x0;var _0x120684=_0x98d6[_0x201a14];return _0x120684;};'use strict';var Sequelize=require(_0x698d('0x0'));module[_0x698d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x698d('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x698d('0x3')]},'fax':{'type':Sequelize[_0x698d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x698d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x698d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x698d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4620=['ENUM','sequelize','exports','BOOLEAN','DATE','STRING','out'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x4620,0xe1));var _0x0462=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x4620[_0xd0cd0b];return _0x59cced;};'use strict';var Sequelize=require(_0x0462('0x0'));module[_0x0462('0x1')]={'closed':{'type':Sequelize[_0x0462('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0462('0x3')]},'disposition':{'type':Sequelize[_0x0462('0x4')]},'secondDisposition':{'type':Sequelize[_0x0462('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0462('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x0462('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0462('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0462('0x6')]('in','out'),'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 596d78b..e19d095 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 _0xe195=['key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','field','color','tools_tags','select','u.fullname','ui.FaxInteractionId','from','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','operator','$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','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','sequelize','toString','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','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','push','all','rows','catch','show','params','merge','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','FaxInteractionId','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','addTags','spread','findAll','emit','removeTags','download','join','server','files','tmp','root','attachments','format','Attachment','createdAt','Messages','get','mkdirSync','basename','existsSync','pipe','log','err','eml-format','rimraf','fast-json-patch','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','Users','map','fullname','Tags','TagIds','forEach','index','FaxInteraction','rawAttributes','type'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe195,0x169));var _0x5e19=function(_0x1fa619,_0x5fccbd){_0x1fa619=_0x1fa619-0x0;var _0x161003=_0xe195[_0x1fa619];return _0x161003;};'use strict';var emlformat=require(_0x5e19('0x0'));var rimraf=require(_0x5e19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e19('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e19('0x3'));var path=require(_0x5e19('0x4'));var sox=require(_0x5e19('0x5'));var csv=require('to-csv');var ejs=require(_0x5e19('0x6'));var fs=require('fs');var fs_extra=require(_0x5e19('0x7'));var _=require(_0x5e19('0x8'));var squel=require('squel');var crypto=require(_0x5e19('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5e19('0xa'));var toCsv=require(_0x5e19('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5e19('0xc'));var authService=require(_0x5e19('0xd'));var qs=require(_0x5e19('0xe'));var as=require(_0x5e19('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e19('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e19('0x11'));var db=require(_0x5e19('0x12'))['db'];config['redis']=_[_0x5e19('0x13')](config[_0x5e19('0x14')],{'host':_0x5e19('0x15'),'port':0x18eb});var socket=require(_0x5e19('0x16'))(new Redis(config[_0x5e19('0x14')]));require(_0x5e19('0x17'))[_0x5e19('0x18')](socket);function respondWithStatusCode(_0x13eabb,_0x6d6d1){_0x6d6d1=_0x6d6d1||0xcc;return function(_0x49d342){if(_0x49d342){return _0x13eabb[_0x5e19('0x19')](_0x6d6d1);}return _0x13eabb[_0x5e19('0x1a')](_0x6d6d1)[_0x5e19('0x1b')]();};}function respondWithResult(_0x3269e1,_0x2809ce){_0x2809ce=_0x2809ce||0xc8;return function(_0x58d704){if(_0x58d704){return _0x3269e1['status'](_0x2809ce)[_0x5e19('0x1c')](_0x58d704);}};}function respondWithFilteredResult(_0x26b382,_0x35ed51){return function(_0x3bce8e){if(_0x3bce8e){var _0x201a9a=typeof _0x35ed51[_0x5e19('0x1d')]==='undefined'&&typeof _0x35ed51['limit']===_0x5e19('0x1e');var _0x4a320c=_0x3bce8e[_0x5e19('0x1f')];var _0x2c3e83=_0x201a9a?0x0:_0x35ed51[_0x5e19('0x1d')];var _0x156c35=_0x201a9a?_0x3bce8e[_0x5e19('0x1f')]:_0x35ed51[_0x5e19('0x1d')]+_0x35ed51[_0x5e19('0x20')];var _0x1e0d74;if(_0x156c35>=_0x4a320c){_0x156c35=_0x4a320c;_0x1e0d74=0xc8;}else{_0x1e0d74=0xce;}_0x26b382[_0x5e19('0x1a')](_0x1e0d74);return _0x26b382[_0x5e19('0x21')](_0x5e19('0x22'),_0x2c3e83+'-'+_0x156c35+'/'+_0x4a320c)['json'](_0x3bce8e);}return null;};}function patchUpdates(_0x6990a){return function(_0x361580){try{jsonpatch[_0x5e19('0x23')](_0x361580,_0x6990a,!![]);}catch(_0x28b14c){return BPromise[_0x5e19('0x24')](_0x28b14c);}return _0x361580[_0x5e19('0x25')]();};}function saveUpdates(_0x4cc68e,_0x40a30b){return function(_0x78e31b){if(_0x78e31b){return _0x78e31b[_0x5e19('0x26')](_0x4cc68e)[_0x5e19('0x27')](function(_0xa88d03){return _0xa88d03;});}return null;};}function removeEntity(_0x1cf035,_0x438d7c){return function(_0x46e3da){if(_0x46e3da){return _0x46e3da[_0x5e19('0x28')]()[_0x5e19('0x27')](function(){_0x1cf035[_0x5e19('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2feda2,_0x469031){return function(_0x595e71){if(!_0x595e71){_0x2feda2['sendStatus'](0x194);}return _0x595e71;};}function handleError(_0x10c129,_0x257b1e){_0x257b1e=_0x257b1e||0x1f4;return function(_0x19f67b){logger[_0x5e19('0x29')](_0x19f67b['stack']);if(_0x19f67b['name']){delete _0x19f67b[_0x5e19('0x2a')];}_0x10c129['status'](_0x257b1e)['send'](_0x19f67b);};}function getInteractionUsers(_0x3c185a,_0x5beecc){return new BPromise(function(_0x380daa,_0x3104da){try{if(_0x5beecc[_0x3c185a['id']]){_0x3c185a[_0x5e19('0x2b')]=_[_0x5e19('0x2c')](_0x5beecc[_0x3c185a['id']],function(_0x2e6e66){return{'id':_0x2e6e66['id'],'fullname':_0x2e6e66[_0x5e19('0x2d')]};});}}catch(_0x1e741c){_0x3104da(_0x1e741c);}_0x380daa(_0x3c185a);});}function getInteractionTags(_0x4f69aa,_0x288e83){return new BPromise(function(_0x1f5541,_0x3517fd){try{if(_0x4f69aa['TagIds']){_0x4f69aa[_0x5e19('0x2e')]=[];_0x4f69aa[_0x5e19('0x2f')]['split'](',')[_0x5e19('0x30')](function(_0x380784){_0x4f69aa[_0x5e19('0x2e')]['push'](_0x288e83[_0x380784]);});}delete _0x4f69aa[_0x5e19('0x2f')];}catch(_0x238223){_0x3517fd(_0x238223);}_0x1f5541(_0x4f69aa);});}function updateFaxInteraction(_0x20caf1,_0x1e21ba,_0x217b2f){return new BPromise(function(_0x3a96d9,_0x265477){return getInteractionUsers(_0x20caf1,_0x217b2f)[_0x5e19('0x27')](function(_0x22f048){return getInteractionTags(_0x22f048,_0x1e21ba);})[_0x5e19('0x27')](function(_0x19b611){_0x3a96d9(_0x19b611);})['catch'](function(_0x1c7a70){_0x265477(_0x1c7a70);});});}exports[_0x5e19('0x31')]=function(_0x18631f,_0x558f25){var _0x3c15bf={},_0x33fc64={},_0x11d033={'count':0x0,'rows':[]};var _0x29e3bc=_[_0x5e19('0x2c')](db[_0x5e19('0x32')][_0x5e19('0x33')],function(_0x5ec525){return{'name':_0x5ec525['fieldName'],'type':_0x5ec525[_0x5e19('0x34')][_0x5e19('0x35')]};});_0x33fc64['model']=_['map'](_0x29e3bc,_0x5e19('0x2a'));_0x33fc64['query']=_[_0x5e19('0x36')](_0x18631f[_0x5e19('0x37')]);_0x33fc64[_0x5e19('0x38')]=_[_0x5e19('0x39')](_0x33fc64[_0x5e19('0x3a')],_0x33fc64[_0x5e19('0x37')]);_0x3c15bf[_0x5e19('0x3b')]=_['intersection'](_0x33fc64['model'],qs['fields'](_0x18631f[_0x5e19('0x37')][_0x5e19('0x3c')]));_0x3c15bf[_0x5e19('0x3b')]=_0x3c15bf[_0x5e19('0x3b')][_0x5e19('0x3d')]?_0x3c15bf['attributes']:_0x33fc64['model'];if(!_0x18631f[_0x5e19('0x37')]['hasOwnProperty'](_0x5e19('0x3e'))){_0x3c15bf['limit']=qs[_0x5e19('0x20')](_0x18631f[_0x5e19('0x37')][_0x5e19('0x20')]);_0x3c15bf[_0x5e19('0x1d')]=qs['offset'](_0x18631f[_0x5e19('0x37')][_0x5e19('0x1d')]);}_0x3c15bf[_0x5e19('0x3f')]=qs[_0x5e19('0x40')](_0x18631f[_0x5e19('0x37')][_0x5e19('0x40')]);_0x3c15bf[_0x5e19('0x41')]=qs[_0x5e19('0x38')](_[_0x5e19('0x42')](_0x18631f['query'],_0x33fc64[_0x5e19('0x38')]),_0x29e3bc);var _0x2015e4=[];var _0x40efab=squel['select']()['field']('id')['field']('name')[_0x5e19('0x43')](_0x5e19('0x44'))['from'](_0x5e19('0x45'));var _0x401b8f=squel[_0x5e19('0x46')]()[_0x5e19('0x43')]('u.id')[_0x5e19('0x43')](_0x5e19('0x47'))['field'](_0x5e19('0x48'))[_0x5e19('0x49')]('user_has_fax_interactions','ui')[_0x5e19('0x4a')]('users','u',_0x5e19('0x4b'));var _0x5d2ec2=squel['select']()[_0x5e19('0x49')](_0x5e19('0x4c'),'i')['left_join'](_0x5e19('0x4d'),'c',_0x5e19('0x4e'))[_0x5e19('0x4a')](_0x5e19('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x5e19('0x4a')](_0x5e19('0x50'),'a',_0x5e19('0x51'))[_0x5e19('0x4a')](_0x5e19('0x52'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x5e19('0x4a')](_0x5e19('0x53'),'it',_0x5e19('0x54'))[_0x5e19('0x4a')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x4540d1=squel['expr']();var _0x2517a0=[];var _0x32a94d=squel[_0x5e19('0x55')]();var _0x1c99a7;if(_0x18631f[_0x5e19('0x37')][_0x5e19('0x56')]){_0x1c99a7=as[_0x5e19('0x57')](_0x18631f['query'][_0x5e19('0x56')]);var _0x589ac6=_0x1c99a7[_0x5e19('0x58')];for(var _0x26d83a=0x0;_0x26d83a<_0x1c99a7[_0x5e19('0x59')][_0x5e19('0x3d')];_0x26d83a++){var _0x44c9e7=_0x1c99a7[_0x5e19('0x59')][_0x26d83a];var _0x229ebf='i';var _0x465661=_[_0x5e19('0x5a')](_0x29e3bc,[_0x5e19('0x2a'),_0x44c9e7[_0x5e19('0x43')]]);if(!_0x465661){switch(_0x44c9e7['field']){case _0x5e19('0x5b'):if(_0x44c9e7['value']==0x1){_0x5d2ec2[_0x5e19('0x5c')]('`'+_0x44c9e7[_0x5e19('0x43')]+_0x5e19('0x5d'));}else{_0x5d2ec2[_0x5e19('0x5c')]('`'+_0x44c9e7[_0x5e19('0x43')]+'`\x20>\x200');}break;case'Contact':if(_0x44c9e7[_0x5e19('0x5e')]===_0x5e19('0x5f')){if(_0x44c9e7[_0x5e19('0x60')]['split']('\x20')['length']>0x1){_0x4540d1[_0x589ac6](_0x5e19('0x61'),qs['getFullTextValue'](_0x44c9e7[_0x5e19('0x60')]),null);}else{var _0x5ddc60='%'+_0x44c9e7[_0x5e19('0x60')]+'%';_0x4540d1[_0x589ac6](_0x5e19('0x62'),_0x5ddc60,_0x5ddc60,_0x5ddc60);}}else{_0x465661=_[_0x5e19('0x5a')](_0x29e3bc,[_0x5e19('0x2a'),_0x5e19('0x63')]);_0x44c9e7[_0x5e19('0x43')]=_0x5e19('0x63');_0x15de00=as[_0x5e19('0x64')](_0x229ebf,_0x465661['type'],_0x44c9e7);_0x4540d1[_0x589ac6](_0x15de00[_0x5e19('0x65')],_0x15de00[_0x5e19('0x60')]['start'],_0x15de00[_0x5e19('0x60')][_0x5e19('0x1b')]);}break;case'Tag':var _0x2cb881=_0x44c9e7[_0x5e19('0x60')][_0x5e19('0x66')](',')[_0x5e19('0x2c')](function(_0x2f6fc9){return Number(_0x2f6fc9);});_0x2cb881[_0x5e19('0x30')](function(_0x40b030){_0x32a94d['or'](_0x5e19('0x67'),'%,'+_0x40b030+',%');});_0x2517a0=_[_0x5e19('0x68')](_0x2517a0,_0x2cb881);break;case _0x5e19('0x69'):if(_0x44c9e7[_0x5e19('0x5e')]===_0x5e19('0x5f')){_0x4540d1[_0x589ac6](_0x5e19('0x6a'),'%'+_0x44c9e7[_0x5e19('0x60')]+'%',null);}else{_0x465661=_[_0x5e19('0x5a')](_0x29e3bc,[_0x5e19('0x2a'),_0x5e19('0x6b')]);_0x44c9e7[_0x5e19('0x43')]=_0x5e19('0x6b');_0x15de00=as[_0x5e19('0x64')](_0x229ebf,_0x465661['type'],_0x44c9e7);_0x4540d1[_0x589ac6](_0x15de00[_0x5e19('0x65')],_0x15de00[_0x5e19('0x60')][_0x5e19('0x6c')],_0x15de00['value'][_0x5e19('0x1b')]);}break;case _0x5e19('0x6d'):_0x15de00=as['buildExpression']('me',null,_0x44c9e7);_0x4540d1[_0x589ac6](_0x15de00[_0x5e19('0x65')],_0x15de00[_0x5e19('0x60')][_0x5e19('0x6c')],_0x15de00[_0x5e19('0x60')][_0x5e19('0x1b')]);break;}}else{var _0x15de00=as[_0x5e19('0x64')](_0x229ebf,_0x465661['type'],_0x44c9e7);_0x4540d1[_0x589ac6](_0x15de00[_0x5e19('0x65')],_0x15de00[_0x5e19('0x60')][_0x5e19('0x6c')],_0x15de00[_0x5e19('0x60')][_0x5e19('0x1b')]);}}}else{var _0x2ee39e=_(_0x18631f[_0x5e19('0x37')])['keys']()[_0x5e19('0x2c')](function(_0xa424eb){return _['some'](_0x29e3bc,[_0x5e19('0x2a'),_0xa424eb])?_0xa424eb:undefined;})['compact']()[_0x5e19('0x60')]();if(!_[_0x5e19('0x6e')](_0x2ee39e)){_0x2ee39e[_0x5e19('0x30')](function(_0x25329f){if(_0x25329f===_0x5e19('0x6f')){_0x5d2ec2[_0x5e19('0x41')](_0x5e19('0x70'),[][_0x5e19('0x71')](_0x18631f[_0x5e19('0x37')][_0x25329f]));}else if(_0x25329f==='createdAt'){var _0xf0e56c=JSON[_0x5e19('0x72')](_0x18631f['query'][_0x25329f])[_0x5e19('0x73')];var _0x3ecbd6=JSON[_0x5e19('0x72')](_0x18631f[_0x5e19('0x37')][_0x25329f])[_0x5e19('0x74')];_0x5d2ec2[_0x5e19('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xf0e56c,_0x3ecbd6);}else{if(_0x18631f['query'][_0x25329f]===_0x5e19('0x75')){_0x5d2ec2[_0x5e19('0x41')]('i.'+_0x25329f+_0x5e19('0x76'));}else{_0x5d2ec2[_0x5e19('0x41')]('i.'+_0x25329f+'\x20=\x20?',_0x18631f[_0x5e19('0x37')][_0x25329f]);}}});}if(_0x18631f[_0x5e19('0x37')][_0x5e19('0x77')]){if(_0x18631f[_0x5e19('0x37')][_0x5e19('0x77')]==0x1){_0x5d2ec2[_0x5e19('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x5d2ec2['having'](_0x5e19('0x78'));}}if(_0x18631f[_0x5e19('0x37')][_0x5e19('0x79')]){_0x2517a0=_['isArray'](_0x18631f[_0x5e19('0x37')]['tag'])?_0x18631f[_0x5e19('0x37')][_0x5e19('0x79')]:new Array(_0x18631f[_0x5e19('0x37')][_0x5e19('0x79')]);_0x2517a0['forEach'](function(_0x433f58){_0x32a94d['or'](_0x5e19('0x67'),'%,'+_0x433f58+',%');});}if(_0x18631f[_0x5e19('0x37')][_0x5e19('0x7a')]){var _0x2ccd47=_0x18631f[_0x5e19('0x37')][_0x5e19('0x7a')]['replace']('\x5c','\x5c\x5c')[_0x5e19('0x7b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2ccd47)){_0x4540d1['or'](_0x5e19('0x7c'),_0x2ccd47+'%')['or'](_0x5e19('0x7d'),_0x2ccd47+'%');}_0x4540d1['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2ccd47+'%');}}_0x5d2ec2[_0x5e19('0x41')](_0x4540d1);_0x5d2ec2['group']('i.id');var _0x3f98d6={'type':db[_0x5e19('0x7e')][_0x5e19('0x7f')][_0x5e19('0x80')],'raw':!![]};var _0x546e2e=_0x5d2ec2['clone']();_0x546e2e[_0x5e19('0x43')](_0x5e19('0x81'));_0x546e2e[_0x5e19('0x43')](_0x5e19('0x82'),'unreadMessages');if(_0x3c15bf[_0x5e19('0x3f')]){_0x3c15bf['order'][_0x5e19('0x30')](function(_0xbd464c){var _0x1acbdd=_0xbd464c[0x0]===_0x5e19('0x83')?_0xbd464c[0x0]:'i.'+_0xbd464c[0x0];_0x5d2ec2[_0x5e19('0x3f')](_0x1acbdd,_0xbd464c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x5e19('0x6e')](_0x2517a0)){_0x5d2ec2[_0x5e19('0x5c')](_0x32a94d);_0x546e2e[_0x5e19('0x41')](_0x5e19('0x84'),_0x2517a0);}BPromise[_0x5e19('0x85')]()['then'](function(){if(!_0x1c99a7){if(_0x18631f[_0x5e19('0x37')]['FaxAccountId'])return;_0x546e2e[_0x5e19('0x41')](_0x5e19('0x86'));_0x5d2ec2[_0x5e19('0x41')](_0x5e19('0x86'));return;}if(_0x18631f[_0x5e19('0x87')][_0x5e19('0x88')]!==_0x5e19('0x89'))return;return _0x18631f[_0x5e19('0x87')][_0x5e19('0x8a')]({'attributes':['id'],'raw':!![]})[_0x5e19('0x27')](function(_0x2dc5b5){if(_['isEmpty'](_0x2dc5b5)){_0x546e2e[_0x5e19('0x41')]('i.FaxAccountId\x20IS\x20NULL');_0x5d2ec2[_0x5e19('0x41')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x546e2e[_0x5e19('0x41')](_0x5e19('0x70'),_[_0x5e19('0x2c')](_0x2dc5b5,'id'));_0x5d2ec2[_0x5e19('0x41')](_0x5e19('0x70'),_['map'](_0x2dc5b5,'id'));}});})[_0x5e19('0x27')](function(){if(_0x18631f['user']['role']==='agent'&&!_0x1c99a7&&!_0x18631f['query']['FaxAccountId'])return[];return db[_0x5e19('0x8b')][_0x5e19('0x37')](_0x546e2e[_0x5e19('0x8c')](),_0x3f98d6);})[_0x5e19('0x27')](function(_0x4ee7b7){_0x11d033[_0x5e19('0x1f')]=_0x4ee7b7[_0x5e19('0x3d')];if(_0x11d033[_0x5e19('0x1f')]===0x0)return[];return db[_0x5e19('0x8b')][_0x5e19('0x37')](_0x40efab[_0x5e19('0x8c')](),_0x3f98d6)['then'](function(_0x82db2a){_0x2015e4=_['keyBy'](_0x82db2a,'id');_0x3f98d6=_['merge'](_0x3f98d6,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18631f[_0x5e19('0x37')][_0x5e19('0x3c')]){_0x3c15bf[_0x5e19('0x3b')][_0x5e19('0x30')](function(_0x59470d){_0x5d2ec2['field']('i.'+_0x59470d);});}else{_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x82'),'unreadMessages');_0x5d2ec2['field'](_0x5e19('0x8d'),_0x5e19('0x8e'));_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x8f'),_0x5e19('0x90'));_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x91'),_0x5e19('0x83'));_0x5d2ec2['field'](_0x5e19('0x92'));_0x5d2ec2['field'](_0x5e19('0x93'),_0x5e19('0x94'));_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x95'),_0x5e19('0x96'));_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x97'),_0x5e19('0x98'));_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x99'),_0x5e19('0x9a'));_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x9b'),_0x5e19('0x9c'));_0x5d2ec2[_0x5e19('0x43')]('c.fax',_0x5e19('0x9d'));_0x5d2ec2['field']('o.fullname','Owner.fullname');_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0x9e'),_0x5e19('0x9f'));_0x5d2ec2[_0x5e19('0x43')](_0x5e19('0xa0'),'TagIds');}if(_0x3c15bf[_0x5e19('0x20')])_0x5d2ec2['limit'](_0x3c15bf['limit']);if(_0x3c15bf[_0x5e19('0x1d')])_0x5d2ec2[_0x5e19('0x1d')](_0x3c15bf[_0x5e19('0x1d')]);return db[_0x5e19('0x8b')][_0x5e19('0x37')](_0x5d2ec2[_0x5e19('0x8c')](),_0x3f98d6);})[_0x5e19('0x27')](function(_0x11c3cf){if(_0x11c3cf[_0x5e19('0x3d')]>0x0)_0x401b8f[_0x5e19('0x41')](_0x5e19('0xa1'),_['map'](_0x11c3cf,'id'));return db[_0x5e19('0x8b')][_0x5e19('0x37')](_0x401b8f[_0x5e19('0x8c')](),_0x3f98d6)['then'](function(_0x20c476){var _0x1f5ec8=_[_0x5e19('0xa2')](_0x20c476,'FaxInteractionId');var _0x88bdad=[];_0x11c3cf[_0x5e19('0x30')](function(_0x2ef1af){_0x88bdad[_0x5e19('0xa3')](updateFaxInteraction(_0x2ef1af,_0x2015e4,_0x1f5ec8));});return BPromise[_0x5e19('0xa4')](_0x88bdad);});});})[_0x5e19('0x27')](function(_0x589c5e){_0x11d033[_0x5e19('0xa5')]=_0x589c5e;return _0x11d033;})[_0x5e19('0x27')](respondWithFilteredResult(_0x558f25,_0x3c15bf))[_0x5e19('0xa6')](handleError(_0x558f25,null));};exports[_0x5e19('0xa7')]=function(_0xa92506,_0x1e9d53){var _0x39a2cf={'raw':![],'where':{'id':_0xa92506[_0x5e19('0xa8')]['id']}},_0x200c0a={};_0x200c0a[_0x5e19('0x3a')]=_[_0x5e19('0x36')](db['FaxInteraction'][_0x5e19('0x33')]);_0x200c0a[_0x5e19('0x37')]=_['keys'](_0xa92506[_0x5e19('0x37')]);_0x200c0a[_0x5e19('0x38')]=_[_0x5e19('0x39')](_0x200c0a[_0x5e19('0x3a')],_0x200c0a[_0x5e19('0x37')]);_0x39a2cf[_0x5e19('0x3b')]=_[_0x5e19('0x39')](_0x200c0a[_0x5e19('0x3a')],qs[_0x5e19('0x3c')](_0xa92506['query'][_0x5e19('0x3c')]));_0x39a2cf['attributes']=_0x39a2cf['attributes'][_0x5e19('0x3d')]?_0x39a2cf[_0x5e19('0x3b')]:_0x200c0a[_0x5e19('0x3a')];if(_0xa92506[_0x5e19('0x37')]['includeAll']){_0x39a2cf['include']=[{'all':!![]}];}_0x39a2cf=_[_0x5e19('0xa9')]({},_0x39a2cf,_0xa92506[_0x5e19('0xaa')]);return db['FaxInteraction'][_0x5e19('0x5a')](_0x39a2cf)[_0x5e19('0x27')](handleEntityNotFound(_0x1e9d53,null))[_0x5e19('0x27')](respondWithResult(_0x1e9d53,null))[_0x5e19('0xa6')](handleError(_0x1e9d53,null));};exports['create']=function(_0x5992c7,_0x28576b){return db[_0x5e19('0x32')][_0x5e19('0xab')](_0x5992c7[_0x5e19('0x6d')],{})[_0x5e19('0x27')](respondWithResult(_0x28576b,0xc9))[_0x5e19('0xa6')](handleError(_0x28576b,null));};exports[_0x5e19('0x26')]=function(_0x44d037,_0x22eaab){if(_0x44d037['body']['id']){delete _0x44d037[_0x5e19('0x6d')]['id'];}return db[_0x5e19('0x32')][_0x5e19('0x5a')]({'where':{'id':_0x44d037[_0x5e19('0xa8')]['id']}})[_0x5e19('0x27')](handleEntityNotFound(_0x22eaab,null))[_0x5e19('0x27')](saveUpdates(_0x44d037[_0x5e19('0x6d')],null))['then'](respondWithResult(_0x22eaab,null))[_0x5e19('0xa6')](handleError(_0x22eaab,null));};exports[_0x5e19('0x28')]=function(_0x122a23,_0x3decd4){return db['FaxInteraction'][_0x5e19('0x5a')]({'where':{'id':_0x122a23['params']['id']}})['then'](handleEntityNotFound(_0x3decd4,null))['then'](removeEntity(_0x3decd4,null))[_0x5e19('0xa6')](handleError(_0x3decd4,null));};exports['describe']=function(_0x378a59,_0x12f5ac){return db['FaxInteraction'][_0x5e19('0xac')]()[_0x5e19('0x27')](respondWithResult(_0x12f5ac,null))[_0x5e19('0xa6')](handleError(_0x12f5ac,null));};exports[_0x5e19('0xad')]=function(_0x26ab1f,_0xcad5,_0x354e7f){return db[_0x5e19('0xae')][_0x5e19('0x5a')]({'where':{'id':_0x26ab1f['params']['id']}})['then'](handleEntityNotFound(_0xcad5,null))[_0x5e19('0x27')](function(_0x58205c){if(_0x58205c){return _0x58205c[_0x5e19('0xad')](_0x26ab1f[_0x5e19('0x6d')][_0x5e19('0xaf')],_[_0x5e19('0xb0')](_0x26ab1f[_0x5e19('0x6d')],[_0x5e19('0xaf'),'id'])||{});}})[_0x5e19('0x27')](respondWithResult(_0xcad5,null))['catch'](handleError(_0xcad5,null));};exports[_0x5e19('0xb1')]=function(_0x584e5f,_0x3fe357,_0xa99faf){var _0x4f1585={'raw':![],'where':{}};var _0x5f17fa={};var _0x5a041d={'count':0x0,'rows':[]};return db[_0x5e19('0x32')][_0x5e19('0xb2')]({'where':{'id':_0x584e5f[_0x5e19('0xa8')]['id']}})['then'](handleEntityNotFound(_0x3fe357,null))['then'](function(_0x4fb9c0){if(_0x4fb9c0){_0x5f17fa[_0x5e19('0x3a')]=_[_0x5e19('0x36')](db['FaxMessage']['rawAttributes']);_0x5f17fa[_0x5e19('0x37')]=_['keys'](_0x584e5f[_0x5e19('0x37')]);_0x5f17fa['filters']=_[_0x5e19('0x39')](_0x5f17fa[_0x5e19('0x3a')],_0x5f17fa[_0x5e19('0x37')]);_0x4f1585[_0x5e19('0x3b')]=_['intersection'](_0x5f17fa[_0x5e19('0x3a')],qs[_0x5e19('0x3c')](_0x584e5f[_0x5e19('0x37')][_0x5e19('0x3c')]));_0x4f1585[_0x5e19('0x3b')]=_0x4f1585[_0x5e19('0x3b')][_0x5e19('0x3d')]?_0x4f1585[_0x5e19('0x3b')]:_0x5f17fa[_0x5e19('0x3a')];if(!_0x584e5f[_0x5e19('0x37')][_0x5e19('0xb3')](_0x5e19('0x3e'))){_0x4f1585[_0x5e19('0x20')]=qs[_0x5e19('0x20')](_0x584e5f[_0x5e19('0x37')]['limit']);_0x4f1585[_0x5e19('0x1d')]=qs[_0x5e19('0x1d')](_0x584e5f[_0x5e19('0x37')]['offset']);}_0x4f1585['order']=qs['sort'](_0x584e5f['query']['sort']);_0x4f1585['where']=qs[_0x5e19('0x38')](_[_0x5e19('0x42')](_0x584e5f[_0x5e19('0x37')],_0x5f17fa[_0x5e19('0x38')]));_0x4f1585[_0x5e19('0x41')][_0x5e19('0xb4')]=_0x4fb9c0['id'];if(_0x584e5f['query'][_0x5e19('0x7a')]){_0x4f1585[_0x5e19('0x41')]=_[_0x5e19('0xa9')](_0x4f1585[_0x5e19('0x41')],{'$or':_[_0x5e19('0x2c')](_0x4f1585[_0x5e19('0x3b')],function(_0x36b898){var _0x4861cd={};_0x4861cd[_0x36b898]={'$like':'%'+_0x584e5f['query'][_0x5e19('0x7a')]+'%'};return _0x4861cd;})});}if(_0x584e5f['query'][_0x5e19('0x73')]){var _0x2b202a=_0x584e5f[_0x5e19('0x37')]['$gte'][_0x5e19('0x66')](',');var _0x2be8ae={};_0x2be8ae[_0x2b202a[0x0]]={'$gte':moment(_0x2b202a[0x1])['format'](_0x5e19('0xb5'))};_0x4f1585['where']=_['merge'](_0x4f1585['where'],_0x2be8ae);}_0x4f1585=_[_0x5e19('0xa9')]({},_0x4f1585,_0x584e5f[_0x5e19('0xaa')]);return db['FaxMessage']['count']({'where':_0x4f1585['where']})[_0x5e19('0x27')](function(_0x18648a){_0x5a041d[_0x5e19('0x1f')]=_0x18648a;if(_0x584e5f[_0x5e19('0x37')][_0x5e19('0xb6')]){_0x4f1585[_0x5e19('0xb7')]=[{'all':!![]}];}return db[_0x5e19('0xae')]['findAll'](_0x4f1585);})[_0x5e19('0x27')](function(_0x14ddf9){_0x5a041d[_0x5e19('0xa5')]=_0x14ddf9;return _0x5a041d;});}})[_0x5e19('0x27')](respondWithFilteredResult(_0x3fe357,_0x4f1585))[_0x5e19('0xa6')](handleError(_0x3fe357,null));};exports[_0x5e19('0xb8')]=function(_0x2b9bac,_0x4a1558,_0x3a6339){return db[_0x5e19('0x32')]['find']({'where':{'id':_0x2b9bac[_0x5e19('0xa8')]['id']}})[_0x5e19('0x27')](handleEntityNotFound(_0x4a1558,null))['then'](function(_0x2798af){if(_0x2798af){return _0x2798af['setTags'](_0x2b9bac[_0x5e19('0x6d')][_0x5e19('0xaf')],_[_0x5e19('0xb0')](_0x2b9bac[_0x5e19('0x6d')],[_0x5e19('0xaf'),'id'])||{})[_0x5e19('0xb9')](function(){return db['Tag'][_0x5e19('0xba')]({'attributes':['id',_0x5e19('0x2a'),_0x5e19('0x44')],'where':{'id':_0x2b9bac[_0x5e19('0x6d')][_0x5e19('0xaf')]}});})['then'](function(_0x2bcdd9){socket[_0x5e19('0xbb')]('faxInteractionTags:save',{'id':Number(_0x2b9bac[_0x5e19('0xa8')]['id']),'tags':_0x2bcdd9||[]});return{'id':Number(_0x2b9bac['params']['id']),'tags':_0x2bcdd9||[]};});}})['then'](respondWithResult(_0x4a1558,null))[_0x5e19('0xa6')](handleError(_0x4a1558,null));};exports['removeTags']=function(_0x46db81,_0x482644,_0x2c986d){return db[_0x5e19('0x32')][_0x5e19('0x5a')]({'where':{'id':_0x46db81[_0x5e19('0xa8')]['id']}})[_0x5e19('0x27')](handleEntityNotFound(_0x482644,null))[_0x5e19('0x27')](function(_0x55d5e0){if(_0x55d5e0){return _0x55d5e0[_0x5e19('0xbc')](_0x46db81[_0x5e19('0x37')][_0x5e19('0xaf')]);}})[_0x5e19('0x27')](respondWithStatusCode(_0x482644,null))['catch'](handleError(_0x482644,null));};exports[_0x5e19('0xbd')]=function(_0x268631,_0x49d7e9){var _0x21b619=moment()['unix']()[_0x5e19('0x8c')]();var _0x216169=path[_0x5e19('0xbe')](config['root'],_0x5e19('0xbf'),_0x5e19('0xc0'),_0x5e19('0xc1'));var _0x2d743b=path['join'](config[_0x5e19('0xc2')],_0x5e19('0xbf'),_0x5e19('0xc0'),_0x5e19('0xc3'));var _0x433503=path['join'](_0x216169,_0x21b619);var _0x5076bb=util[_0x5e19('0xc4')]('transcript-%d-%s.zip',_0x268631[_0x5e19('0xa8')]['id'],_0x21b619);var _0x4cfc65=path[_0x5e19('0xbe')](_0x216169,_0x5076bb);var _0x37e277=[];_0x37e277[_0x5e19('0xa3')]({'model':db[_0x5e19('0xc5')],'as':_0x5e19('0xc5'),'raw':!![]});var _0x5193bb=[{'model':db[_0x5e19('0xae')],'as':'Messages','attributes':['id',_0x5e19('0x6d'),_0x5e19('0xc6')],'include':_0x37e277}];return db[_0x5e19('0x32')]['find']({'where':{'id':_0x268631[_0x5e19('0xa8')]['id']},'include':_0x5193bb})['then'](handleEntityNotFound(_0x49d7e9,null))[_0x5e19('0x27')](function(_0x3d1c02){if(_0x3d1c02&&_0x3d1c02[_0x5e19('0xc7')]){var _0x5d895c=_0x3d1c02[_0x5e19('0xc8')]({'plain':!![]});fs[_0x5e19('0xc9')](_0x433503);for(var _0x42e456=0x0;_0x42e456<_0x5d895c['Messages']['length'];_0x42e456++){var _0x57f73a=_0x5d895c[_0x5e19('0xc7')][_0x42e456][_0x5e19('0xc5')];if(_0x57f73a){var _0x461b46=path[_0x5e19('0xbe')](_0x2d743b,_0x57f73a[_0x5e19('0xca')]);if(fs[_0x5e19('0xcb')](_0x461b46)){fs['createReadStream'](_0x461b46)[_0x5e19('0xcc')](fs['createWriteStream'](path[_0x5e19('0xbe')](_0x433503,_0x57f73a[_0x5e19('0xca')])));}}}return BPromise[_0x5e19('0x85')]()[_0x5e19('0x27')](function(){return new BPromise(function(_0x2967f9,_0x4248af){zipdir(_0x433503,{'saveTo':_0x4cfc65},function(_0x431f8c,_0x26fd55){if(_0x431f8c)return _0x4248af(_0x431f8c);return _0x2967f9(_0x26fd55);});})[_0x5e19('0x27')](function(){return new BPromise(function(_0x4c49c1,_0x2ef57f){rimraf(_0x433503,function(_0x1a8542){if(_0x1a8542)_0x2ef57f(_0x1a8542);return _0x4c49c1();});});})['then'](function(){return _0x49d7e9[_0x5e19('0xbd')](_0x4cfc65,_0x5076bb,function(_0x5dec15){if(_0x5dec15){console[_0x5e19('0xcd')](_0x5e19('0xce'),_0x5dec15);}else{fs['unlinkSync'](_0x4cfc65);}});});});}else{return _0x49d7e9['sendStatus'](0xc8);}})[_0x5e19('0xa6')](handleError(_0x49d7e9,null));}; \ No newline at end of file +var _0x84cc=['c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','params','FaxInteraction','rawAttributes','includeAll','include','options','create','destroy','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','hasOwnProperty','FaxInteractionId','findAll','rows','addTags','spread','Tag','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','basename','existsSync','createReadStream','log','err','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','send','map','TagIds','forEach','push','catch','index','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','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','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','text','start','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','buildExpression','some','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x84cc,0x1e7));var _0xc84c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x84cc[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xc84c('0x0'));var rimraf=require(_0xc84c('0x1'));var zipdir=require(_0xc84c('0x2'));var jsonpatch=require(_0xc84c('0x3'));var rp=require(_0xc84c('0x4'));var moment=require(_0xc84c('0x5'));var BPromise=require(_0xc84c('0x6'));var Mustache=require(_0xc84c('0x7'));var util=require(_0xc84c('0x8'));var path=require('path');var sox=require(_0xc84c('0x9'));var csv=require(_0xc84c('0xa'));var ejs=require(_0xc84c('0xb'));var fs=require('fs');var fs_extra=require(_0xc84c('0xc'));var _=require('lodash');var squel=require(_0xc84c('0xd'));var crypto=require(_0xc84c('0xe'));var jsforce=require(_0xc84c('0xf'));var deskjs=require(_0xc84c('0x10'));var toCsv=require(_0xc84c('0xa'));var querystring=require(_0xc84c('0x11'));var Papa=require('papaparse');var Redis=require(_0xc84c('0x12'));var authService=require(_0xc84c('0x13'));var qs=require(_0xc84c('0x14'));var as=require(_0xc84c('0x15'));var hardwareService=require(_0xc84c('0x16'));var logger=require('../../config/logger')(_0xc84c('0x17'));var utils=require(_0xc84c('0x18'));var config=require(_0xc84c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc84c('0x1a'))['db'];config[_0xc84c('0x1b')]=_[_0xc84c('0x1c')](config['redis'],{'host':_0xc84c('0x1d'),'port':0x18eb});var socket=require(_0xc84c('0x1e'))(new Redis(config['redis']));require(_0xc84c('0x1f'))['register'](socket);function respondWithStatusCode(_0x55c543,_0x449a03){_0x449a03=_0x449a03||0xcc;return function(_0x49d3e7){if(_0x49d3e7){return _0x55c543['sendStatus'](_0x449a03);}return _0x55c543[_0xc84c('0x20')](_0x449a03)[_0xc84c('0x21')]();};}function respondWithResult(_0x572d74,_0x5d7490){_0x5d7490=_0x5d7490||0xc8;return function(_0x3a3ff2){if(_0x3a3ff2){return _0x572d74['status'](_0x5d7490)['json'](_0x3a3ff2);}};}function respondWithFilteredResult(_0xdc3433,_0x52a8dc){return function(_0x2a34dd){if(_0x2a34dd){var _0x354985=typeof _0x52a8dc[_0xc84c('0x22')]===_0xc84c('0x23')&&typeof _0x52a8dc['limit']==='undefined';var _0x419e72=_0x2a34dd['count'];var _0x3e8cf5=_0x354985?0x0:_0x52a8dc['offset'];var _0x25fbc6=_0x354985?_0x2a34dd[_0xc84c('0x24')]:_0x52a8dc[_0xc84c('0x22')]+_0x52a8dc[_0xc84c('0x25')];var _0x52b48c;if(_0x25fbc6>=_0x419e72){_0x25fbc6=_0x419e72;_0x52b48c=0xc8;}else{_0x52b48c=0xce;}_0xdc3433[_0xc84c('0x20')](_0x52b48c);return _0xdc3433[_0xc84c('0x26')](_0xc84c('0x27'),_0x3e8cf5+'-'+_0x25fbc6+'/'+_0x419e72)[_0xc84c('0x28')](_0x2a34dd);}return null;};}function patchUpdates(_0x451c41){return function(_0x3aa268){try{jsonpatch[_0xc84c('0x29')](_0x3aa268,_0x451c41,!![]);}catch(_0xd42f51){return BPromise[_0xc84c('0x2a')](_0xd42f51);}return _0x3aa268[_0xc84c('0x2b')]();};}function saveUpdates(_0x5b9714,_0x46473c){return function(_0x55e4cd){if(_0x55e4cd){return _0x55e4cd[_0xc84c('0x2c')](_0x5b9714)[_0xc84c('0x2d')](function(_0x53fab1){return _0x53fab1;});}return null;};}function removeEntity(_0x37ba4d,_0x59cb0b){return function(_0x21612c){if(_0x21612c){return _0x21612c['destroy']()['then'](function(){_0x37ba4d[_0xc84c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493716,_0x42b82f){return function(_0x24939e){if(!_0x24939e){_0x493716[_0xc84c('0x2e')](0x194);}return _0x24939e;};}function handleError(_0x159778,_0x4a7f16){_0x4a7f16=_0x4a7f16||0x1f4;return function(_0x178a9f){logger['error'](_0x178a9f['stack']);if(_0x178a9f['name']){delete _0x178a9f['name'];}_0x159778[_0xc84c('0x20')](_0x4a7f16)[_0xc84c('0x2f')](_0x178a9f);};}function getInteractionUsers(_0x3f55e2,_0x21fe28){return new BPromise(function(_0x2726ea,_0x5c55ab){try{if(_0x21fe28[_0x3f55e2['id']]){_0x3f55e2['Users']=_[_0xc84c('0x30')](_0x21fe28[_0x3f55e2['id']],function(_0x48c77a){return{'id':_0x48c77a['id'],'fullname':_0x48c77a['fullname']};});}}catch(_0x27cd45){_0x5c55ab(_0x27cd45);}_0x2726ea(_0x3f55e2);});}function getInteractionTags(_0x71f588,_0xf95397){return new BPromise(function(_0x5828f1,_0x3ffa87){try{if(_0x71f588[_0xc84c('0x31')]){_0x71f588['Tags']=[];_0x71f588[_0xc84c('0x31')]['split'](',')[_0xc84c('0x32')](function(_0x2b6711){_0x71f588['Tags'][_0xc84c('0x33')](_0xf95397[_0x2b6711]);});}delete _0x71f588[_0xc84c('0x31')];}catch(_0x4fb470){_0x3ffa87(_0x4fb470);}_0x5828f1(_0x71f588);});}function updateFaxInteraction(_0x10bdc1,_0x1c06f6,_0x1c8e37){return new BPromise(function(_0x15ceda,_0x28e6c1){return getInteractionUsers(_0x10bdc1,_0x1c8e37)[_0xc84c('0x2d')](function(_0x136b22){return getInteractionTags(_0x136b22,_0x1c06f6);})[_0xc84c('0x2d')](function(_0x486d32){_0x15ceda(_0x486d32);})[_0xc84c('0x34')](function(_0x5e9fe5){_0x28e6c1(_0x5e9fe5);});});}exports[_0xc84c('0x35')]=function(_0x17b394,_0x439cc5){var _0x1c4163={},_0xfe1f4c={},_0x4834cf={'count':0x0,'rows':[]};var _0x4626f9=_[_0xc84c('0x30')](db['FaxInteraction']['rawAttributes'],function(_0x40429f){return{'name':_0x40429f[_0xc84c('0x36')],'type':_0x40429f[_0xc84c('0x37')][_0xc84c('0x38')]};});_0xfe1f4c[_0xc84c('0x39')]=_['map'](_0x4626f9,_0xc84c('0x3a'));_0xfe1f4c[_0xc84c('0x3b')]=_[_0xc84c('0x3c')](_0x17b394[_0xc84c('0x3b')]);_0xfe1f4c[_0xc84c('0x3d')]=_[_0xc84c('0x3e')](_0xfe1f4c[_0xc84c('0x39')],_0xfe1f4c['query']);_0x1c4163['attributes']=_['intersection'](_0xfe1f4c[_0xc84c('0x39')],qs['fields'](_0x17b394[_0xc84c('0x3b')][_0xc84c('0x3f')]));_0x1c4163['attributes']=_0x1c4163[_0xc84c('0x40')][_0xc84c('0x41')]?_0x1c4163[_0xc84c('0x40')]:_0xfe1f4c[_0xc84c('0x39')];if(!_0x17b394[_0xc84c('0x3b')]['hasOwnProperty'](_0xc84c('0x42'))){_0x1c4163[_0xc84c('0x25')]=qs[_0xc84c('0x25')](_0x17b394['query']['limit']);_0x1c4163[_0xc84c('0x22')]=qs[_0xc84c('0x22')](_0x17b394['query']['offset']);}_0x1c4163[_0xc84c('0x43')]=qs[_0xc84c('0x44')](_0x17b394[_0xc84c('0x3b')][_0xc84c('0x44')]);_0x1c4163[_0xc84c('0x45')]=qs[_0xc84c('0x3d')](_[_0xc84c('0x46')](_0x17b394[_0xc84c('0x3b')],_0xfe1f4c[_0xc84c('0x3d')]),_0x4626f9);var _0x135787=[];var _0xd60f38=squel[_0xc84c('0x47')]()['field']('id')[_0xc84c('0x48')](_0xc84c('0x3a'))['field'](_0xc84c('0x49'))[_0xc84c('0x4a')](_0xc84c('0x4b'));var _0x45d2a9=squel[_0xc84c('0x47')]()['field'](_0xc84c('0x4c'))[_0xc84c('0x48')](_0xc84c('0x4d'))[_0xc84c('0x48')](_0xc84c('0x4e'))['from'](_0xc84c('0x4f'),'ui')[_0xc84c('0x50')](_0xc84c('0x51'),'u',_0xc84c('0x52'));var _0x51d968=squel[_0xc84c('0x47')]()[_0xc84c('0x4a')](_0xc84c('0x53'),'i')[_0xc84c('0x50')](_0xc84c('0x54'),'c',_0xc84c('0x55'))[_0xc84c('0x50')](_0xc84c('0x51'),'o',_0xc84c('0x56'))[_0xc84c('0x50')](_0xc84c('0x57'),'a',_0xc84c('0x58'))[_0xc84c('0x50')](_0xc84c('0x59'),'me',_0xc84c('0x5a'))[_0xc84c('0x50')]('fax_interaction_has_tags','it',_0xc84c('0x5b'))[_0xc84c('0x50')](_0xc84c('0x4b'),'t',_0xc84c('0x5c'));var _0x265fbf=squel[_0xc84c('0x5d')]();var _0x410b44=[];var _0x11ae6d=squel[_0xc84c('0x5d')]();var _0xb35cb1;if(_0x17b394['query'][_0xc84c('0x5e')]){_0xb35cb1=as[_0xc84c('0x5f')](_0x17b394[_0xc84c('0x3b')][_0xc84c('0x5e')]);var _0x3876c6=_0xb35cb1['sqlOperator'];for(var _0x22e25f=0x0;_0x22e25f<_0xb35cb1[_0xc84c('0x60')]['length'];_0x22e25f++){var _0x177f25=_0xb35cb1['conditions'][_0x22e25f];var _0x25100f='i';var _0x29eb02=_[_0xc84c('0x61')](_0x4626f9,[_0xc84c('0x3a'),_0x177f25[_0xc84c('0x48')]]);if(!_0x29eb02){switch(_0x177f25[_0xc84c('0x48')]){case'unreadMessages':if(_0x177f25[_0xc84c('0x62')]==0x1){_0x51d968[_0xc84c('0x63')]('`'+_0x177f25['field']+_0xc84c('0x64'));}else{_0x51d968[_0xc84c('0x63')]('`'+_0x177f25[_0xc84c('0x48')]+_0xc84c('0x65'));}break;case _0xc84c('0x66'):if(_0x177f25[_0xc84c('0x67')]===_0xc84c('0x68')){if(_0x177f25[_0xc84c('0x62')][_0xc84c('0x69')]('\x20')['length']>0x1){_0x265fbf[_0x3876c6](_0xc84c('0x6a'),qs[_0xc84c('0x6b')](_0x177f25['value']),null);}else{var _0x3aa900='%'+_0x177f25[_0xc84c('0x62')]+'%';_0x265fbf[_0x3876c6](_0xc84c('0x6c'),_0x3aa900,_0x3aa900,_0x3aa900);}}else{_0x29eb02=_['find'](_0x4626f9,[_0xc84c('0x3a'),'ContactId']);_0x177f25['field']='ContactId';_0xf0816c=as['buildExpression'](_0x25100f,_0x29eb02[_0xc84c('0x37')],_0x177f25);_0x265fbf[_0x3876c6](_0xf0816c[_0xc84c('0x6d')],_0xf0816c[_0xc84c('0x62')][_0xc84c('0x6e')],_0xf0816c['value'][_0xc84c('0x21')]);}break;case'Tag':var _0x239381=_0x177f25[_0xc84c('0x62')][_0xc84c('0x69')](',')['map'](function(_0x2be649){return Number(_0x2be649);});_0x239381[_0xc84c('0x32')](function(_0x56b587){_0x11ae6d['or'](_0xc84c('0x6f'),'%,'+_0x56b587+',%');});_0x410b44=_[_0xc84c('0x70')](_0x410b44,_0x239381);break;case _0xc84c('0x71'):if(_0x177f25[_0xc84c('0x67')]===_0xc84c('0x68')){_0x265fbf[_0x3876c6](_0xc84c('0x72'),'%'+_0x177f25[_0xc84c('0x62')]+'%',null);}else{_0x29eb02=_[_0xc84c('0x61')](_0x4626f9,[_0xc84c('0x3a'),_0xc84c('0x73')]);_0x177f25[_0xc84c('0x48')]=_0xc84c('0x73');_0xf0816c=as['buildExpression'](_0x25100f,_0x29eb02[_0xc84c('0x37')],_0x177f25);_0x265fbf[_0x3876c6](_0xf0816c[_0xc84c('0x6d')],_0xf0816c[_0xc84c('0x62')][_0xc84c('0x6e')],_0xf0816c['value'][_0xc84c('0x21')]);}break;case _0xc84c('0x74'):_0xf0816c=as[_0xc84c('0x75')]('me',null,_0x177f25);_0x265fbf[_0x3876c6](_0xf0816c[_0xc84c('0x6d')],_0xf0816c['value']['start'],_0xf0816c[_0xc84c('0x62')]['end']);break;}}else{var _0xf0816c=as[_0xc84c('0x75')](_0x25100f,_0x29eb02[_0xc84c('0x37')],_0x177f25);_0x265fbf[_0x3876c6](_0xf0816c[_0xc84c('0x6d')],_0xf0816c[_0xc84c('0x62')][_0xc84c('0x6e')],_0xf0816c[_0xc84c('0x62')][_0xc84c('0x21')]);}}}else{var _0x24ee9f=_(_0x17b394[_0xc84c('0x3b')])['keys']()[_0xc84c('0x30')](function(_0x2e2826){return _[_0xc84c('0x76')](_0x4626f9,[_0xc84c('0x3a'),_0x2e2826])?_0x2e2826:undefined;})['compact']()[_0xc84c('0x62')]();if(!_[_0xc84c('0x77')](_0x24ee9f)){_0x24ee9f[_0xc84c('0x32')](function(_0xbe764e){if(_0xbe764e==='FaxAccountId'){_0x51d968[_0xc84c('0x45')]('i.FaxAccountId\x20IN\x20?',[][_0xc84c('0x78')](_0x17b394[_0xc84c('0x3b')][_0xbe764e]));}else if(_0xbe764e===_0xc84c('0x79')){var _0x317672=JSON[_0xc84c('0x7a')](_0x17b394[_0xc84c('0x3b')][_0xbe764e])['$gte'];var _0x3f2d6d=JSON[_0xc84c('0x7a')](_0x17b394[_0xc84c('0x3b')][_0xbe764e])[_0xc84c('0x7b')];_0x51d968[_0xc84c('0x45')](_0xc84c('0x7c'),_0x317672,_0x3f2d6d);}else{if(_0x17b394['query'][_0xbe764e]===_0xc84c('0x7d')){_0x51d968[_0xc84c('0x45')]('i.'+_0xbe764e+_0xc84c('0x7e'));}else{_0x51d968[_0xc84c('0x45')]('i.'+_0xbe764e+'\x20=\x20?',_0x17b394['query'][_0xbe764e]);}}});}if(_0x17b394['query'][_0xc84c('0x7f')]){if(_0x17b394[_0xc84c('0x3b')]['read']==0x1){_0x51d968[_0xc84c('0x63')](_0xc84c('0x80'));}else{_0x51d968['having'](_0xc84c('0x81'));}}if(_0x17b394[_0xc84c('0x3b')]['tag']){_0x410b44=_['isArray'](_0x17b394[_0xc84c('0x3b')][_0xc84c('0x82')])?_0x17b394[_0xc84c('0x3b')][_0xc84c('0x82')]:new Array(_0x17b394['query'][_0xc84c('0x82')]);_0x410b44[_0xc84c('0x32')](function(_0x52c1eb){_0x11ae6d['or'](_0xc84c('0x6f'),'%,'+_0x52c1eb+',%');});}if(_0x17b394[_0xc84c('0x3b')][_0xc84c('0x83')]){var _0xfe0a3e=_0x17b394[_0xc84c('0x3b')]['filter'][_0xc84c('0x84')]('\x5c','\x5c\x5c')[_0xc84c('0x84')](/'/g,'\x27\x27');if(qs[_0xc84c('0x85')](_0xfe0a3e)){_0x265fbf['or'](_0xc84c('0x86'),_0xfe0a3e+'%')['or']('i.fax\x20LIKE\x20?',_0xfe0a3e+'%');}_0x265fbf['or'](_0xc84c('0x87'),_0xfe0a3e+'%');}}_0x51d968[_0xc84c('0x45')](_0x265fbf);_0x51d968[_0xc84c('0x88')](_0xc84c('0x89'));var _0x200f28={'type':db[_0xc84c('0x8a')][_0xc84c('0x8b')]['SELECT'],'raw':!![]};var _0x539153=_0x51d968[_0xc84c('0x8c')]();_0x539153['field'](_0xc84c('0x89'));_0x539153[_0xc84c('0x48')](_0xc84c('0x8d'),_0xc84c('0x8e'));if(_0x1c4163[_0xc84c('0x43')]){_0x1c4163[_0xc84c('0x43')][_0xc84c('0x32')](function(_0x2e302f){var _0x10bb17=_0x2e302f[0x0]==='contactName'?_0x2e302f[0x0]:'i.'+_0x2e302f[0x0];_0x51d968[_0xc84c('0x43')](_0x10bb17,_0x2e302f[0x1]===_0xc84c('0x8f')?![]:!![]);});}if(!_[_0xc84c('0x77')](_0x410b44)){_0x51d968[_0xc84c('0x63')](_0x11ae6d);_0x539153['where'](_0xc84c('0x90'),_0x410b44);}BPromise[_0xc84c('0x91')]()[_0xc84c('0x2d')](function(){if(!_0xb35cb1){if(_0x17b394[_0xc84c('0x3b')]['FaxAccountId'])return;_0x539153[_0xc84c('0x45')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x51d968[_0xc84c('0x45')](_0xc84c('0x92'));return;}if(_0x17b394[_0xc84c('0x93')][_0xc84c('0x94')]!==_0xc84c('0x95'))return;return _0x17b394[_0xc84c('0x93')][_0xc84c('0x96')]({'attributes':['id'],'raw':!![]})[_0xc84c('0x2d')](function(_0x4e176f){if(_[_0xc84c('0x77')](_0x4e176f)){_0x539153[_0xc84c('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x51d968[_0xc84c('0x45')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x539153['where'](_0xc84c('0x97'),_['map'](_0x4e176f,'id'));_0x51d968[_0xc84c('0x45')](_0xc84c('0x97'),_[_0xc84c('0x30')](_0x4e176f,'id'));}});})[_0xc84c('0x2d')](function(){if(_0x17b394[_0xc84c('0x93')][_0xc84c('0x94')]==='agent'&&!_0xb35cb1&&!_0x17b394[_0xc84c('0x3b')]['FaxAccountId'])return[];return db[_0xc84c('0x98')][_0xc84c('0x3b')](_0x539153['toString'](),_0x200f28);})[_0xc84c('0x2d')](function(_0xd3f3b1){_0x4834cf[_0xc84c('0x24')]=_0xd3f3b1['length'];if(_0x4834cf[_0xc84c('0x24')]===0x0)return[];return db['sequelize'][_0xc84c('0x3b')](_0xd60f38[_0xc84c('0x99')](),_0x200f28)[_0xc84c('0x2d')](function(_0x1be783){_0x135787=_[_0xc84c('0x9a')](_0x1be783,'id');_0x200f28=_[_0xc84c('0x9b')](_0x200f28,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17b394[_0xc84c('0x3b')][_0xc84c('0x3f')]){_0x1c4163[_0xc84c('0x40')][_0xc84c('0x32')](function(_0x1b19ad){_0x51d968[_0xc84c('0x48')]('i.'+_0x1b19ad);});}else{_0x51d968[_0xc84c('0x48')](_0xc84c('0x8d'),_0xc84c('0x8e'));_0x51d968['field'](_0xc84c('0x9c'),_0xc84c('0x9d'));_0x51d968[_0xc84c('0x48')](_0xc84c('0x9e'),_0xc84c('0x9f'));_0x51d968[_0xc84c('0x48')]('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',_0xc84c('0xa0'));_0x51d968[_0xc84c('0x48')](_0xc84c('0xa1'));_0x51d968[_0xc84c('0x48')](_0xc84c('0xa2'),_0xc84c('0xa3'));_0x51d968[_0xc84c('0x48')](_0xc84c('0xa4'),_0xc84c('0xa5'));_0x51d968[_0xc84c('0x48')]('c.email',_0xc84c('0xa6'));_0x51d968['field'](_0xc84c('0xa7'),_0xc84c('0xa8'));_0x51d968['field'](_0xc84c('0xa9'),_0xc84c('0xaa'));_0x51d968[_0xc84c('0x48')]('c.fax',_0xc84c('0xab'));_0x51d968['field'](_0xc84c('0xac'),_0xc84c('0xad'));_0x51d968[_0xc84c('0x48')]('o.internal','Owner.internal');_0x51d968[_0xc84c('0x48')](_0xc84c('0xae'),_0xc84c('0x31'));}if(_0x1c4163[_0xc84c('0x25')])_0x51d968[_0xc84c('0x25')](_0x1c4163['limit']);if(_0x1c4163[_0xc84c('0x22')])_0x51d968[_0xc84c('0x22')](_0x1c4163[_0xc84c('0x22')]);return db[_0xc84c('0x98')]['query'](_0x51d968[_0xc84c('0x99')](),_0x200f28);})['then'](function(_0x32e8aa){if(_0x32e8aa[_0xc84c('0x41')]>0x0)_0x45d2a9['where'](_0xc84c('0xaf'),_[_0xc84c('0x30')](_0x32e8aa,'id'));return db[_0xc84c('0x98')][_0xc84c('0x3b')](_0x45d2a9[_0xc84c('0x99')](),_0x200f28)[_0xc84c('0x2d')](function(_0x245712){var _0x44fb01=_[_0xc84c('0xb0')](_0x245712,'FaxInteractionId');var _0x208524=[];_0x32e8aa['forEach'](function(_0x55107e){_0x208524['push'](updateFaxInteraction(_0x55107e,_0x135787,_0x44fb01));});return BPromise[_0xc84c('0xb1')](_0x208524);});});})[_0xc84c('0x2d')](function(_0x55a7a8){_0x4834cf['rows']=_0x55a7a8;return _0x4834cf;})['then'](respondWithFilteredResult(_0x439cc5,_0x1c4163))[_0xc84c('0x34')](handleError(_0x439cc5,null));};exports['show']=function(_0x26f725,_0x3ebca2){var _0x55abda={'raw':![],'where':{'id':_0x26f725[_0xc84c('0xb2')]['id']}},_0x3d8b11={};_0x3d8b11[_0xc84c('0x39')]=_['keys'](db[_0xc84c('0xb3')][_0xc84c('0xb4')]);_0x3d8b11[_0xc84c('0x3b')]=_[_0xc84c('0x3c')](_0x26f725[_0xc84c('0x3b')]);_0x3d8b11['filters']=_['intersection'](_0x3d8b11[_0xc84c('0x39')],_0x3d8b11[_0xc84c('0x3b')]);_0x55abda['attributes']=_[_0xc84c('0x3e')](_0x3d8b11['model'],qs[_0xc84c('0x3f')](_0x26f725[_0xc84c('0x3b')]['fields']));_0x55abda[_0xc84c('0x40')]=_0x55abda[_0xc84c('0x40')][_0xc84c('0x41')]?_0x55abda['attributes']:_0x3d8b11[_0xc84c('0x39')];if(_0x26f725[_0xc84c('0x3b')][_0xc84c('0xb5')]){_0x55abda[_0xc84c('0xb6')]=[{'all':!![]}];}_0x55abda=_[_0xc84c('0x9b')]({},_0x55abda,_0x26f725[_0xc84c('0xb7')]);return db[_0xc84c('0xb3')]['find'](_0x55abda)[_0xc84c('0x2d')](handleEntityNotFound(_0x3ebca2,null))[_0xc84c('0x2d')](respondWithResult(_0x3ebca2,null))['catch'](handleError(_0x3ebca2,null));};exports[_0xc84c('0xb8')]=function(_0x5215c5,_0x3a41f5){return db['FaxInteraction']['create'](_0x5215c5[_0xc84c('0x74')],{})[_0xc84c('0x2d')](respondWithResult(_0x3a41f5,0xc9))[_0xc84c('0x34')](handleError(_0x3a41f5,null));};exports[_0xc84c('0x2c')]=function(_0x4d27ba,_0x1d1fc2){if(_0x4d27ba[_0xc84c('0x74')]['id']){delete _0x4d27ba[_0xc84c('0x74')]['id'];}return db[_0xc84c('0xb3')][_0xc84c('0x61')]({'where':{'id':_0x4d27ba[_0xc84c('0xb2')]['id']}})['then'](handleEntityNotFound(_0x1d1fc2,null))['then'](saveUpdates(_0x4d27ba[_0xc84c('0x74')],null))[_0xc84c('0x2d')](respondWithResult(_0x1d1fc2,null))['catch'](handleError(_0x1d1fc2,null));};exports[_0xc84c('0xb9')]=function(_0x2dd592,_0x4acb82){return db[_0xc84c('0xb3')][_0xc84c('0x61')]({'where':{'id':_0x2dd592[_0xc84c('0xb2')]['id']}})[_0xc84c('0x2d')](handleEntityNotFound(_0x4acb82,null))[_0xc84c('0x2d')](removeEntity(_0x4acb82,null))[_0xc84c('0x34')](handleError(_0x4acb82,null));};exports[_0xc84c('0xba')]=function(_0x35ce2e,_0x44161b){return db[_0xc84c('0xb3')][_0xc84c('0xba')]()[_0xc84c('0x2d')](respondWithResult(_0x44161b,null))[_0xc84c('0x34')](handleError(_0x44161b,null));};exports[_0xc84c('0xbb')]=function(_0x356a77,_0x22a146,_0x10ff2c){return db['FaxMessage'][_0xc84c('0x61')]({'where':{'id':_0x356a77['params']['id']}})['then'](handleEntityNotFound(_0x22a146,null))['then'](function(_0x348070){if(_0x348070){return _0x348070[_0xc84c('0xbb')](_0x356a77[_0xc84c('0x74')][_0xc84c('0xbc')],_[_0xc84c('0xbd')](_0x356a77[_0xc84c('0x74')],[_0xc84c('0xbc'),'id'])||{});}})[_0xc84c('0x2d')](respondWithResult(_0x22a146,null))['catch'](handleError(_0x22a146,null));};exports[_0xc84c('0xbe')]=function(_0x1b4678,_0x3d0503,_0x138105){var _0x1e67e5={'raw':![],'where':{}};var _0x28bb4e={};var _0x224be4={'count':0x0,'rows':[]};return db[_0xc84c('0xb3')][_0xc84c('0xbf')]({'where':{'id':_0x1b4678[_0xc84c('0xb2')]['id']}})[_0xc84c('0x2d')](handleEntityNotFound(_0x3d0503,null))[_0xc84c('0x2d')](function(_0x22893d){if(_0x22893d){_0x28bb4e['model']=_[_0xc84c('0x3c')](db[_0xc84c('0xc0')][_0xc84c('0xb4')]);_0x28bb4e[_0xc84c('0x3b')]=_[_0xc84c('0x3c')](_0x1b4678[_0xc84c('0x3b')]);_0x28bb4e[_0xc84c('0x3d')]=_[_0xc84c('0x3e')](_0x28bb4e['model'],_0x28bb4e['query']);_0x1e67e5[_0xc84c('0x40')]=_[_0xc84c('0x3e')](_0x28bb4e[_0xc84c('0x39')],qs[_0xc84c('0x3f')](_0x1b4678['query']['fields']));_0x1e67e5[_0xc84c('0x40')]=_0x1e67e5[_0xc84c('0x40')][_0xc84c('0x41')]?_0x1e67e5[_0xc84c('0x40')]:_0x28bb4e[_0xc84c('0x39')];if(!_0x1b4678[_0xc84c('0x3b')][_0xc84c('0xc1')](_0xc84c('0x42'))){_0x1e67e5[_0xc84c('0x25')]=qs[_0xc84c('0x25')](_0x1b4678[_0xc84c('0x3b')][_0xc84c('0x25')]);_0x1e67e5[_0xc84c('0x22')]=qs[_0xc84c('0x22')](_0x1b4678['query']['offset']);}_0x1e67e5[_0xc84c('0x43')]=qs[_0xc84c('0x44')](_0x1b4678[_0xc84c('0x3b')][_0xc84c('0x44')]);_0x1e67e5[_0xc84c('0x45')]=qs[_0xc84c('0x3d')](_['pick'](_0x1b4678[_0xc84c('0x3b')],_0x28bb4e[_0xc84c('0x3d')]));_0x1e67e5[_0xc84c('0x45')][_0xc84c('0xc2')]=_0x22893d['id'];if(_0x1b4678[_0xc84c('0x3b')][_0xc84c('0x83')]){_0x1e67e5[_0xc84c('0x45')]=_['merge'](_0x1e67e5[_0xc84c('0x45')],{'$or':_[_0xc84c('0x30')](_0x1e67e5[_0xc84c('0x40')],function(_0x2a3bd1){var _0x5c08e9={};_0x5c08e9[_0x2a3bd1]={'$like':'%'+_0x1b4678[_0xc84c('0x3b')][_0xc84c('0x83')]+'%'};return _0x5c08e9;})});}if(_0x1b4678[_0xc84c('0x3b')]['$gte']){var _0x3cd108=_0x1b4678[_0xc84c('0x3b')]['$gte'][_0xc84c('0x69')](',');var _0x433243={};_0x433243[_0x3cd108[0x0]]={'$gte':moment(_0x3cd108[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1e67e5[_0xc84c('0x45')]=_[_0xc84c('0x9b')](_0x1e67e5[_0xc84c('0x45')],_0x433243);}_0x1e67e5=_[_0xc84c('0x9b')]({},_0x1e67e5,_0x1b4678['options']);return db[_0xc84c('0xc0')][_0xc84c('0x24')]({'where':_0x1e67e5[_0xc84c('0x45')]})[_0xc84c('0x2d')](function(_0x40517e){_0x224be4[_0xc84c('0x24')]=_0x40517e;if(_0x1b4678[_0xc84c('0x3b')]['includeAll']){_0x1e67e5[_0xc84c('0xb6')]=[{'all':!![]}];}return db[_0xc84c('0xc0')][_0xc84c('0xc3')](_0x1e67e5);})[_0xc84c('0x2d')](function(_0x10e72c){_0x224be4[_0xc84c('0xc4')]=_0x10e72c;return _0x224be4;});}})['then'](respondWithFilteredResult(_0x3d0503,_0x1e67e5))[_0xc84c('0x34')](handleError(_0x3d0503,null));};exports[_0xc84c('0xc5')]=function(_0x2f3129,_0x5732bc,_0x1467e5){return db[_0xc84c('0xb3')][_0xc84c('0x61')]({'where':{'id':_0x2f3129[_0xc84c('0xb2')]['id']}})['then'](handleEntityNotFound(_0x5732bc,null))['then'](function(_0x337138){if(_0x337138){return _0x337138['setTags'](_0x2f3129['body'][_0xc84c('0xbc')],_[_0xc84c('0xbd')](_0x2f3129[_0xc84c('0x74')],['ids','id'])||{})[_0xc84c('0xc6')](function(){return db[_0xc84c('0xc7')]['findAll']({'attributes':['id',_0xc84c('0x3a'),_0xc84c('0x49')],'where':{'id':_0x2f3129[_0xc84c('0x74')][_0xc84c('0xbc')]}});})[_0xc84c('0x2d')](function(_0x30d3c0){socket['emit'](_0xc84c('0xc8'),{'id':Number(_0x2f3129[_0xc84c('0xb2')]['id']),'tags':_0x30d3c0||[]});return{'id':Number(_0x2f3129[_0xc84c('0xb2')]['id']),'tags':_0x30d3c0||[]};});}})[_0xc84c('0x2d')](respondWithResult(_0x5732bc,null))[_0xc84c('0x34')](handleError(_0x5732bc,null));};exports[_0xc84c('0xc9')]=function(_0xd825da,_0x3338f7,_0x1e62bb){return db['FaxInteraction'][_0xc84c('0x61')]({'where':{'id':_0xd825da['params']['id']}})[_0xc84c('0x2d')](handleEntityNotFound(_0x3338f7,null))[_0xc84c('0x2d')](function(_0x219db3){if(_0x219db3){return _0x219db3[_0xc84c('0xc9')](_0xd825da[_0xc84c('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x3338f7,null))[_0xc84c('0x34')](handleError(_0x3338f7,null));};exports[_0xc84c('0xca')]=function(_0x577aa3,_0x91facb){var _0x509a2d=moment()[_0xc84c('0xcb')]()[_0xc84c('0x99')]();var _0x4116e3=path[_0xc84c('0xcc')](config[_0xc84c('0xcd')],_0xc84c('0xce'),'files',_0xc84c('0xcf'));var _0x22c12a=path[_0xc84c('0xcc')](config[_0xc84c('0xcd')],'server','files',_0xc84c('0xd0'));var _0x3ac65d=path['join'](_0x4116e3,_0x509a2d);var _0xd270fa=util[_0xc84c('0xd1')](_0xc84c('0xd2'),_0x577aa3[_0xc84c('0xb2')]['id'],_0x509a2d);var _0x5c8474=path[_0xc84c('0xcc')](_0x4116e3,_0xd270fa);var _0x4393c5=[];_0x4393c5[_0xc84c('0x33')]({'model':db['Attachment'],'as':_0xc84c('0xd3'),'raw':!![]});var _0x483ac2=[{'model':db[_0xc84c('0xc0')],'as':_0xc84c('0xd4'),'attributes':['id',_0xc84c('0x74'),'createdAt'],'include':_0x4393c5}];return db['FaxInteraction']['find']({'where':{'id':_0x577aa3[_0xc84c('0xb2')]['id']},'include':_0x483ac2})[_0xc84c('0x2d')](handleEntityNotFound(_0x91facb,null))[_0xc84c('0x2d')](function(_0x5d4ffb){if(_0x5d4ffb&&_0x5d4ffb['Messages']){var _0x25c388=_0x5d4ffb['get']({'plain':!![]});fs['mkdirSync'](_0x3ac65d);for(var _0x4f5e14=0x0;_0x4f5e14<_0x25c388[_0xc84c('0xd4')][_0xc84c('0x41')];_0x4f5e14++){var _0x14793c=_0x25c388[_0xc84c('0xd4')][_0x4f5e14][_0xc84c('0xd3')];if(_0x14793c){var _0x1e67bf=path[_0xc84c('0xcc')](_0x22c12a,_0x14793c[_0xc84c('0xd5')]);if(fs[_0xc84c('0xd6')](_0x1e67bf)){fs[_0xc84c('0xd7')](_0x1e67bf)['pipe'](fs['createWriteStream'](path[_0xc84c('0xcc')](_0x3ac65d,_0x14793c[_0xc84c('0xd5')])));}}}return BPromise[_0xc84c('0x91')]()[_0xc84c('0x2d')](function(){return new BPromise(function(_0x32ac71,_0x4cb0cc){zipdir(_0x3ac65d,{'saveTo':_0x5c8474},function(_0x57bc5d,_0x326b33){if(_0x57bc5d)return _0x4cb0cc(_0x57bc5d);return _0x32ac71(_0x326b33);});})[_0xc84c('0x2d')](function(){return new BPromise(function(_0x17d03d,_0x58c3e5){rimraf(_0x3ac65d,function(_0xf9ee20){if(_0xf9ee20)_0x58c3e5(_0xf9ee20);return _0x17d03d();});});})['then'](function(){return _0x91facb[_0xc84c('0xca')](_0x5c8474,_0xd270fa,function(_0x47622b){if(_0x47622b){console[_0xc84c('0xd8')](_0xc84c('0xd9'),_0x47622b);}else{fs['unlinkSync'](_0x5c8474);}});});});}else{return _0x91facb[_0xc84c('0x2e')](0xc8);}})['catch'](handleError(_0x91facb,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b64c53a..f646741 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 _0xad4e=['then','emit','catch','hasOwnProperty','hook','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll'];(function(_0x116df5,_0x3ada0e){var _0x2f71e6=function(_0x367e16){while(--_0x367e16){_0x116df5['push'](_0x116df5['shift']());}};_0x2f71e6(++_0x3ada0e);}(_0xad4e,0x1d5));var _0xead4=function(_0x30c7dc,_0x18b7a0){_0x30c7dc=_0x30c7dc-0x0;var _0x148109=_0xad4e[_0x30c7dc];return _0x148109;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0xead4('0x0')];var FaxMessage=require(_0xead4('0x1'))['db'][_0xead4('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xead4('0x3')](0x0);var events={'afterCreate':_0xead4('0x4'),'afterUpdate':_0xead4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x16f533){return function(_0x5a9c8b,_0x844176,_0x9b950d){_0x5a9c8b[_0xead4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45b475){_0x5a9c8b[_0xead4('0x7')](_0xead4('0x8'),_0x45b475[_0xead4('0x9')](function(_0x5041f9){return{'id':_0x5041f9['id']};}));return FaxMessage[_0xead4('0xa')]({'where':{'FaxInteractionId':_0x5a9c8b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xead4('0xb')](function(_0x4520a9){_0x5a9c8b[_0xead4('0x7')]('unreadMessages',_0x4520a9['length']);FaxInteractionEvents[_0xead4('0xc')](_0x16f533+':'+_0x5a9c8b['id'],_0x5a9c8b);FaxInteractionEvents[_0xead4('0xc')](_0x16f533,_0x5a9c8b);_0x9b950d(null);})[_0xead4('0xd')](_0x9b950d(null));};}for(var e in events){if(events[_0xead4('0xe')](e)){var event=events[e];FaxInteraction[_0xead4('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x1232=['update','getUsers','then','Users','map','setDataValue','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save'];(function(_0x31d646,_0x23b948){var _0x2c1879=function(_0x2f770c){while(--_0x2f770c){_0x31d646['push'](_0x31d646['shift']());}};_0x2c1879(++_0x23b948);}(_0x1232,0x19b));var _0x2123=function(_0x4dd125,_0x27c536){_0x4dd125=_0x4dd125-0x0;var _0x586a48=_0x1232[_0x4dd125];return _0x586a48;};'use strict';var EventEmitter=require(_0x2123('0x0'));var FaxInteraction=require(_0x2123('0x1'))['db'][_0x2123('0x2')];var FaxMessage=require(_0x2123('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2123('0x3')](0x0);var events={'afterCreate':_0x2123('0x4'),'afterUpdate':_0x2123('0x5'),'afterDestroy':'remove'};function emitEvent(_0x26e0b9){return function(_0x211a3c,_0x43e540,_0x2773fa){_0x211a3c[_0x2123('0x6')]({'attributes':['id'],'raw':!![]})[_0x2123('0x7')](function(_0x19e8cd){_0x211a3c['setDataValue'](_0x2123('0x8'),_0x19e8cd[_0x2123('0x9')](function(_0x1c798e){return{'id':_0x1c798e['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x211a3c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3c3cf2){_0x211a3c[_0x2123('0xa')]('unreadMessages',_0x3c3cf2[_0x2123('0xb')]);FaxInteractionEvents['emit'](_0x26e0b9+':'+_0x211a3c['id'],_0x211a3c);FaxInteractionEvents[_0x2123('0xc')](_0x26e0b9,_0x211a3c);_0x2773fa(null);})[_0x2123('0xd')](_0x2773fa(null));};}for(var e in events){if(events[_0x2123('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x2123('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7c26800..ad73970 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 _0x1bb4=['./faxInteraction.attributes','define','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x2e724e,_0x59aa97){_0x2e724e=_0x2e724e-0x0;var _0x283f49=_0x1bb4[_0x2e724e];return _0x283f49;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var logger=require(_0x41bb('0x2'))(_0x41bb('0x3'));var moment=require(_0x41bb('0x4'));var BPromise=require('bluebird');var rp=require(_0x41bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x41bb('0x7'));module['exports']=function(_0x232b17,_0x3ab646){return _0x232b17[_0x41bb('0x8')]('FaxInteraction',attributes,{'tableName':_0x41bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3dc644,_0x4af8b1,_0x22092e){if(_0x3dc644[_0x41bb('0xa')](_0x41bb('0xb'))){_0x3dc644['closedAt']=moment()[_0x41bb('0xc')](_0x41bb('0xd'));}_0x22092e(null,_0x3dc644);}}});}; \ No newline at end of file +var _0x1c3c=['exports','define','FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xc91b65,_0x2b93b0){var _0x5d2676=function(_0x3f6330){while(--_0x3f6330){_0xc91b65['push'](_0xc91b65['shift']());}};_0x5d2676(++_0x2b93b0);}(_0x1c3c,0x9d));var _0xc1c3=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x1c3c[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0xc1c3('0x0'));var logger=require(_0xc1c3('0x1'))(_0xc1c3('0x2'));var moment=require(_0xc1c3('0x3'));var BPromise=require(_0xc1c3('0x4'));var rp=require(_0xc1c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1c3('0x6'));var config=require(_0xc1c3('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xc1c3('0x8')]=function(_0x16e67c,_0x638567){return _0x16e67c[_0xc1c3('0x9')](_0xc1c3('0xa'),attributes,{'tableName':_0xc1c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23ff8a,_0x119224,_0x2b0bde){if(_0x23ff8a['changed'](_0xc1c3('0xc'))){_0x23ff8a[_0xc1c3('0xd')]=moment()['format'](_0xc1c3('0xe'));}_0x2b0bde(null,_0x23ff8a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 71c5baa..5b98f2f 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 _0xadd7=['defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x1f3972,_0x241258){var _0x7aaf19=function(_0x5a0489){while(--_0x5a0489){_0x1f3972['push'](_0x1f3972['shift']());}};_0x7aaf19(++_0x241258);}(_0xadd7,0x1ac));var _0x7add=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xadd7[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7add('0x0'));var util=require('util');var moment=require(_0x7add('0x1'));var BPromise=require(_0x7add('0x2'));var rs=require(_0x7add('0x3'));var fs=require('fs');var Redis=require(_0x7add('0x4'));var db=require(_0x7add('0x5'))['db'];var utils=require(_0x7add('0x6'));var logger=require(_0x7add('0x7'))(_0x7add('0x8'));var config=require(_0x7add('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7add('0xa')]({'port':0x232a});config[_0x7add('0xb')]=_[_0x7add('0xc')](config[_0x7add('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7add('0xd'))(new Redis(config[_0x7add('0xb')]));require(_0x7add('0xe'))[_0x7add('0xf')](socket);function respondWithRpcPromise(_0x57870e,_0x1af299,_0x31bafa){return new BPromise(function(_0x251e4c,_0x710f29){return client[_0x7add('0x10')](_0x57870e,_0x31bafa)[_0x7add('0x11')](function(_0x1f66ee){logger[_0x7add('0x12')](_0x7add('0x13'),_0x1af299,_0x7add('0x14'));logger[_0x7add('0x15')](_0x7add('0x16'),_0x1af299,_0x7add('0x14'),JSON[_0x7add('0x17')](_0x1f66ee));if(_0x1f66ee[_0x7add('0x18')]){if(_0x1f66ee[_0x7add('0x18')][_0x7add('0x19')]===0x1f4){logger[_0x7add('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x1af299,_0x1f66ee[_0x7add('0x18')][_0x7add('0x1a')]);return _0x710f29(_0x1f66ee['error']['message']);}logger[_0x7add('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x1af299,_0x1f66ee[_0x7add('0x18')][_0x7add('0x1a')]);return _0x251e4c(_0x1f66ee[_0x7add('0x18')][_0x7add('0x1a')]);}else{logger[_0x7add('0x12')](_0x7add('0x13'),_0x1af299,'request\x20sent');_0x251e4c(_0x1f66ee[_0x7add('0x1b')][_0x7add('0x1a')]);}})[_0x7add('0x1c')](function(_0x23fe3b){logger[_0x7add('0x18')](_0x7add('0x13'),_0x1af299,_0x23fe3b);_0x710f29(_0x23fe3b);});});}exports[_0x7add('0x1d')]=function(_0x429266){var _0x342532=this;return new Promise(function(_0x299e3e,_0x2f1b7b){return db[_0x7add('0x1e')]['update'](_0x429266[_0x7add('0x1f')],{'raw':_0x429266[_0x7add('0x20')]?_0x429266[_0x7add('0x20')][_0x7add('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x429266[_0x7add('0x20')]?_0x429266[_0x7add('0x20')][_0x7add('0x22')]||null:null,'attributes':_0x429266[_0x7add('0x20')]?_0x429266[_0x7add('0x20')][_0x7add('0x23')]||null:null,'limit':_0x429266[_0x7add('0x20')]?_0x429266['options'][_0x7add('0x24')]||null:null})[_0x7add('0x11')](function(_0x2795c0){logger[_0x7add('0x12')]('UpdateFaxInteraction',_0x429266);logger[_0x7add('0x15')]('UpdateFaxInteraction',_0x429266,JSON['stringify'](_0x2795c0));_0x299e3e(_0x2795c0);})[_0x7add('0x1c')](function(_0x421c1f){logger['error'](_0x7add('0x1d'),_0x421c1f[_0x7add('0x1a')],_0x429266);_0x2f1b7b(_0x342532['error'](0x1f4,_0x421c1f['message']));});});};exports[_0x7add('0x25')]=function(_0x32302e){return new Promise(function(_0x1a1fdd,_0x2a82c1){return db[_0x7add('0x1e')][_0x7add('0x26')]({'where':_0x32302e['options']?_0x32302e['options'][_0x7add('0x22')]||null:null})[_0x7add('0x11')](function(_0x50969e){if(_0x50969e){return _0x50969e[_0x7add('0x27')](_0x32302e[_0x7add('0x1f')]['ids'],_[_0x7add('0x28')](_0x32302e[_0x7add('0x1f')],[_0x7add('0x29'),'id'])||{});}})[_0x7add('0x2a')](function(_0x3e4d2b){logger[_0x7add('0x12')](_0x7add('0x2b'),_0x32302e);logger[_0x7add('0x15')](_0x7add('0x2b'),_0x32302e,JSON[_0x7add('0x17')](_0x3e4d2b));_0x1a1fdd(_0x3e4d2b);})[_0x7add('0x1c')](function(_0x4d8d03){logger[_0x7add('0x18')](_0x7add('0x2b'),_0x4d8d03['message'],_0x32302e);_0x2a82c1(_this[_0x7add('0x18')](0x1f4,_0x4d8d03[_0x7add('0x1a')]));});});}; \ No newline at end of file +var _0x5668=['result','catch','FaxInteraction','update','raw','options','where','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2953aa,_0x2d3ba1){var _0x556ec5=function(_0x4294a5){while(--_0x4294a5){_0x2953aa['push'](_0x2953aa['shift']());}};_0x556ec5(++_0x2d3ba1);}(_0x5668,0x1e9));var _0x8566=function(_0x3f6fde,_0x45320d){_0x3f6fde=_0x3f6fde-0x0;var _0x3fd468=_0x5668[_0x3f6fde];return _0x3fd468;};'use strict';var _=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var moment=require(_0x8566('0x2'));var BPromise=require(_0x8566('0x3'));var rs=require(_0x8566('0x4'));var fs=require('fs');var Redis=require(_0x8566('0x5'));var db=require(_0x8566('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8566('0x7'));var config=require('../../config/environment');var jayson=require(_0x8566('0x8'));var client=jayson[_0x8566('0x9')][_0x8566('0xa')]({'port':0x232a});config[_0x8566('0xb')]=_[_0x8566('0xc')](config[_0x8566('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8566('0xd'))(new Redis(config[_0x8566('0xb')]));require(_0x8566('0xe'))[_0x8566('0xf')](socket);function respondWithRpcPromise(_0x58101d,_0x2ba76a,_0x3743bb){return new BPromise(function(_0x182803,_0x5d75da){return client[_0x8566('0x10')](_0x58101d,_0x3743bb)[_0x8566('0x11')](function(_0x305cce){logger[_0x8566('0x12')](_0x8566('0x13'),_0x2ba76a,_0x8566('0x14'));logger[_0x8566('0x15')](_0x8566('0x16'),_0x2ba76a,_0x8566('0x14'),JSON[_0x8566('0x17')](_0x305cce));if(_0x305cce[_0x8566('0x18')]){if(_0x305cce['error'][_0x8566('0x19')]===0x1f4){logger['error'](_0x8566('0x13'),_0x2ba76a,_0x305cce[_0x8566('0x18')][_0x8566('0x1a')]);return _0x5d75da(_0x305cce[_0x8566('0x18')][_0x8566('0x1a')]);}logger[_0x8566('0x18')](_0x8566('0x13'),_0x2ba76a,_0x305cce[_0x8566('0x18')][_0x8566('0x1a')]);return _0x182803(_0x305cce['error'][_0x8566('0x1a')]);}else{logger['info'](_0x8566('0x13'),_0x2ba76a,_0x8566('0x14'));_0x182803(_0x305cce[_0x8566('0x1b')][_0x8566('0x1a')]);}})[_0x8566('0x1c')](function(_0x160f59){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2ba76a,_0x160f59);_0x5d75da(_0x160f59);});});}exports['UpdateFaxInteraction']=function(_0x1da2eb){var _0x8155ae=this;return new Promise(function(_0x2cd8ae,_0x275582){return db[_0x8566('0x1d')][_0x8566('0x1e')](_0x1da2eb['body'],{'raw':_0x1da2eb['options']?_0x1da2eb['options'][_0x8566('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1da2eb[_0x8566('0x20')]?_0x1da2eb[_0x8566('0x20')][_0x8566('0x21')]||null:null,'attributes':_0x1da2eb['options']?_0x1da2eb[_0x8566('0x20')][_0x8566('0x22')]||null:null,'limit':_0x1da2eb[_0x8566('0x20')]?_0x1da2eb['options']['limit']||null:null})[_0x8566('0x11')](function(_0x16e9ce){logger[_0x8566('0x12')](_0x8566('0x23'),_0x1da2eb);logger[_0x8566('0x15')](_0x8566('0x23'),_0x1da2eb,JSON['stringify'](_0x16e9ce));_0x2cd8ae(_0x16e9ce);})['catch'](function(_0x51aac2){logger[_0x8566('0x18')](_0x8566('0x23'),_0x51aac2[_0x8566('0x1a')],_0x1da2eb);_0x275582(_0x8155ae[_0x8566('0x18')](0x1f4,_0x51aac2[_0x8566('0x1a')]));});});};exports[_0x8566('0x24')]=function(_0x216d16){return new Promise(function(_0xcd9782,_0x5e4ea5){return db[_0x8566('0x1d')]['find']({'where':_0x216d16[_0x8566('0x20')]?_0x216d16[_0x8566('0x20')][_0x8566('0x21')]||null:null})[_0x8566('0x11')](function(_0x17d51e){if(_0x17d51e){return _0x17d51e[_0x8566('0x25')](_0x216d16[_0x8566('0x26')][_0x8566('0x27')],_[_0x8566('0x28')](_0x216d16[_0x8566('0x26')],[_0x8566('0x27'),'id'])||{});}})[_0x8566('0x29')](function(_0x34aef0){logger[_0x8566('0x12')]('AddTags',_0x216d16);logger[_0x8566('0x15')](_0x8566('0x2a'),_0x216d16,JSON[_0x8566('0x17')](_0x34aef0));_0xcd9782(_0x34aef0);})['catch'](function(_0x2e5bdd){logger['error'](_0x8566('0x2a'),_0x2e5bdd[_0x8566('0x1a')],_0x216d16);_0x5e4ea5(_this[_0x8566('0x18')](0x1f4,_0x2e5bdd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index cd809df..3cefa0a 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 _0x5f08=['./faxInteraction.events','emit','removeListener','register','faxInteraction:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f08,0x19a));var _0x85f0=function(_0x49a5f8,_0x280e99){_0x49a5f8=_0x49a5f8-0x0;var _0x2b557a=_0x5f08[_0x49a5f8];return _0x2b557a;};'use strict';var FaxInteractionEvents=require(_0x85f0('0x0'));var events=['save','remove','update'];function createListener(_0x559df1,_0x48403d){return function(_0x198868){_0x48403d[_0x85f0('0x1')](_0x559df1,_0x198868);};}function removeListener(_0x1ceda2,_0x13522f){return function(){FaxInteractionEvents[_0x85f0('0x2')](_0x1ceda2,_0x13522f);};}exports[_0x85f0('0x3')]=function(_0xfb557a){for(var _0x3674d4=0x0,_0x5c807a=events['length'];_0x3674d4<_0x5c807a;_0x3674d4++){var _0x60a886=events[_0x3674d4];var _0x4fa8ab=createListener(_0x85f0('0x4')+_0x60a886,_0xfb557a);FaxInteractionEvents['on'](_0x60a886,_0x4fa8ab);}}; \ No newline at end of file +var _0xf0a9=['update','emit','removeListener','register','length','./faxInteraction.events','save'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf0a9,0x1be));var _0x9f0a=function(_0x14ad55,_0x459976){_0x14ad55=_0x14ad55-0x0;var _0x27cedf=_0xf0a9[_0x14ad55];return _0x27cedf;};'use strict';var FaxInteractionEvents=require(_0x9f0a('0x0'));var events=[_0x9f0a('0x1'),'remove',_0x9f0a('0x2')];function createListener(_0x186a33,_0x4bb1aa){return function(_0x288520){_0x4bb1aa[_0x9f0a('0x3')](_0x186a33,_0x288520);};}function removeListener(_0x310e79,_0x153870){return function(){FaxInteractionEvents[_0x9f0a('0x4')](_0x310e79,_0x153870);};}exports[_0x9f0a('0x5')]=function(_0x38fc24){for(var _0x1de461=0x0,_0x2cffb3=events[_0x9f0a('0x6')];_0x1de461<_0x2cffb3;_0x1de461++){var _0x4e7309=events[_0x1de461];var _0x188936=createListener('faxInteraction:'+_0x4e7309,_0x38fc24);FaxInteractionEvents['on'](_0x4e7309,_0x188936);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 5b9e9ce..8c52a42 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 _0x7857=['isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get'];(function(_0x5bd46e,_0x560084){var _0x1fc263=function(_0x4fd207){while(--_0x4fd207){_0x5bd46e['push'](_0x5bd46e['shift']());}};_0x1fc263(++_0x560084);}(_0x7857,0x1a9));var _0x7785=function(_0x54a743,_0x50b856){_0x54a743=_0x54a743-0x0;var _0xb53223=_0x7857[_0x54a743];return _0xb53223;};'use strict';var multer=require(_0x7785('0x0'));var util=require(_0x7785('0x1'));var path=require('path');var timeout=require(_0x7785('0x2'));var express=require(_0x7785('0x3'));var router=express['Router']();var fs_extra=require(_0x7785('0x4'));var auth=require(_0x7785('0x5'));var interaction=require(_0x7785('0x6'));var config=require('../../config/environment');var controller=require(_0x7785('0x7'));router[_0x7785('0x8')]('/',auth[_0x7785('0x9')](),controller['index']);router['get'](_0x7785('0xa'),auth[_0x7785('0x9')](),controller['describe']);router[_0x7785('0x8')](_0x7785('0xb'),auth[_0x7785('0x9')](),controller[_0x7785('0xc')]);router['get'](_0x7785('0xd'),auth['isAuthenticated'](),controller[_0x7785('0xe')]);router[_0x7785('0x8')]('/:id/download',auth[_0x7785('0x9')](),controller[_0x7785('0xf')]);router[_0x7785('0x10')]('/',auth[_0x7785('0x9')](),controller[_0x7785('0x11')]);router[_0x7785('0x10')]('/:id/messages',auth[_0x7785('0x9')](),controller[_0x7785('0x12')]);router['post'](_0x7785('0x13'),auth[_0x7785('0x9')](),interaction['tracked']('fax',_0x7785('0x14')),controller[_0x7785('0x15')]);router[_0x7785('0x16')](_0x7785('0xb'),auth[_0x7785('0x9')](),interaction['tracked'](_0x7785('0x17'),_0x7785('0x18')),controller[_0x7785('0x19')]);router[_0x7785('0x1a')](_0x7785('0xb'),auth[_0x7785('0x9')](),interaction['tracked'](_0x7785('0x17'),_0x7785('0x1b')),controller[_0x7785('0x1c')]);router[_0x7785('0x1a')](_0x7785('0x13'),auth[_0x7785('0x9')](),controller[_0x7785('0x1d')]);module[_0x7785('0x1e')]=router; \ No newline at end of file +var _0xd2d9=['faxinteraction:update','update','faxinteraction:destroy','destroy','delete','removeTags','multer','util','path','express','Router','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2d9,0x172));var _0x9d2d=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0xd2d9[_0x568496];return _0x26c5c1;};'use strict';var multer=require(_0x9d2d('0x0'));var util=require(_0x9d2d('0x1'));var path=require(_0x9d2d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d2d('0x3'));var router=express[_0x9d2d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d2d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9d2d('0x6'));router[_0x9d2d('0x7')]('/',auth[_0x9d2d('0x8')](),controller[_0x9d2d('0x9')]);router['get'](_0x9d2d('0xa'),auth[_0x9d2d('0x8')](),controller['describe']);router['get'](_0x9d2d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9d2d('0x7')](_0x9d2d('0xc'),auth[_0x9d2d('0x8')](),controller[_0x9d2d('0xd')]);router['get'](_0x9d2d('0xe'),auth[_0x9d2d('0x8')](),controller[_0x9d2d('0xf')]);router[_0x9d2d('0x10')]('/',auth[_0x9d2d('0x8')](),controller['create']);router[_0x9d2d('0x10')](_0x9d2d('0xc'),auth[_0x9d2d('0x8')](),controller[_0x9d2d('0x11')]);router['post'](_0x9d2d('0x12'),auth['isAuthenticated'](),interaction[_0x9d2d('0x13')](_0x9d2d('0x14'),_0x9d2d('0x15')),controller['addTags']);router['put']('/:id',auth[_0x9d2d('0x8')](),interaction['tracked']('fax',_0x9d2d('0x16')),controller[_0x9d2d('0x17')]);router['delete']('/:id',auth[_0x9d2d('0x8')](),interaction[_0x9d2d('0x13')]('fax',_0x9d2d('0x18')),controller[_0x9d2d('0x19')]);router[_0x9d2d('0x1a')](_0x9d2d('0x12'),auth[_0x9d2d('0x8')](),controller[_0x9d2d('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index eba9ffb..7eaf3e3 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 _0x6282=['TEXT','medium','out','DATE','sequelize','exports'];(function(_0x2f5e4a,_0xdb9a){var _0x7d5457=function(_0x1fb6b6){while(--_0x1fb6b6){_0x2f5e4a['push'](_0x2f5e4a['shift']());}};_0x7d5457(++_0xdb9a);}(_0x6282,0x76));var _0x2628=function(_0x5df9f9,_0x392ebb){_0x5df9f9=_0x5df9f9-0x0;var _0x496e24=_0x6282[_0x5df9f9];return _0x496e24;};'use strict';var Sequelize=require(_0x2628('0x0'));module[_0x2628('0x1')]={'body':{'type':Sequelize[_0x2628('0x2')](_0x2628('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2628('0x4')),'defaultValue':_0x2628('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x2628('0x5')]}}; \ No newline at end of file +var _0x7119=['exports','medium','ENUM','out','TEXT'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7119,0x1c7));var _0x9711=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x7119[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require('sequelize');module[_0x9711('0x0')]={'body':{'type':Sequelize['TEXT'](_0x9711('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9711('0x2')]('in',_0x9711('0x3')),'defaultValue':_0x9711('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9711('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8a0c620..f63c34c 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 _0x4148=['http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','offset','undefined','count','limit','set','Content-Range','save','update','destroy','end','stack','name','index','map','FaxMessage','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','find','catch','body','describe','fax-interactions','accept','read','readAt','UserId','user','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','SIP/%s','channel','motionChannel','event','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','format','EventManager','rejectmessage','create','CmContact','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4148,0x104));var _0x8414=function(_0x537bcd,_0x13bae1){_0x537bcd=_0x537bcd-0x0;var _0x6cc881=_0x4148[_0x537bcd];return _0x6cc881;};'use strict';var emlformat=require(_0x8414('0x0'));var rimraf=require(_0x8414('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8414('0x2'));var rp=require(_0x8414('0x3'));var moment=require(_0x8414('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8414('0x5'));var util=require(_0x8414('0x6'));var path=require(_0x8414('0x7'));var sox=require('sox');var csv=require(_0x8414('0x8'));var ejs=require(_0x8414('0x9'));var fs=require('fs');var fs_extra=require(_0x8414('0xa'));var _=require(_0x8414('0xb'));var squel=require(_0x8414('0xc'));var crypto=require('crypto');var jsforce=require(_0x8414('0xd'));var deskjs=require(_0x8414('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8414('0xf'));var Redis=require(_0x8414('0x10'));var authService=require(_0x8414('0x11'));var qs=require(_0x8414('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8414('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8414('0x14'));var licenseUtil=require(_0x8414('0x15'));var db=require('../../mysqldb')['db'];config[_0x8414('0x16')]=_[_0x8414('0x17')](config[_0x8414('0x16')],{'host':_0x8414('0x18'),'port':0x18eb});var socket=require(_0x8414('0x19'))(new Redis(config[_0x8414('0x16')]));require(_0x8414('0x1a'))[_0x8414('0x1b')](socket);var jayson=require(_0x8414('0x1c'));var client=jayson[_0x8414('0x1d')][_0x8414('0x1e')]({'port':0x232c});var client9002=jayson[_0x8414('0x1d')][_0x8414('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5beb9b,_0x1c9f71,_0x19e07c,_0x3bf1e9){return new BPromise(function(_0x4b10ed,_0x3fc4cb){var _0xd4f8c0=_0x3bf1e9||client;return _0xd4f8c0[_0x8414('0x1f')](_0x5beb9b,_0x19e07c)[_0x8414('0x20')](function(_0x1158a1){logger[_0x8414('0x21')](_0x8414('0x22'),_0x1c9f71,_0x8414('0x23'));logger[_0x8414('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1c9f71,_0x8414('0x23'),JSON[_0x8414('0x25')](_0x1158a1));if(_0x1158a1[_0x8414('0x26')]){if(_0x1158a1['error'][_0x8414('0x27')]===0x1f4){logger['error'](_0x8414('0x22'),_0x1c9f71,_0x1158a1[_0x8414('0x26')]['message']);return _0x3fc4cb(_0x1158a1[_0x8414('0x26')][_0x8414('0x28')]);}logger[_0x8414('0x26')](_0x8414('0x22'),_0x1c9f71,_0x1158a1[_0x8414('0x26')][_0x8414('0x28')]);return _0x4b10ed(_0x1158a1[_0x8414('0x26')][_0x8414('0x28')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1c9f71,_0x8414('0x23'));_0x4b10ed(_0x1158a1['result'][_0x8414('0x28')]);}})['catch'](function(_0x2e36d2){logger['error'](_0x8414('0x22'),_0x1c9f71,_0x2e36d2);_0x3fc4cb(_0x2e36d2);});});}function respondWithStatusCode(_0x4145f0,_0x5e1df5){_0x5e1df5=_0x5e1df5||0xcc;return function(_0x2c7db0){if(_0x2c7db0){return _0x4145f0[_0x8414('0x29')](_0x5e1df5);}return _0x4145f0[_0x8414('0x2a')](_0x5e1df5)['end']();};}function respondWithResult(_0x203027,_0x8ca61f){_0x8ca61f=_0x8ca61f||0xc8;return function(_0x1c9b6c){if(_0x1c9b6c){return _0x203027[_0x8414('0x2a')](_0x8ca61f)['json'](_0x1c9b6c);}};}function respondWithFilteredResult(_0x2c1f74,_0x2928fe){return function(_0x2fa575){if(_0x2fa575){var _0x1e41b1=typeof _0x2928fe[_0x8414('0x2b')]==='undefined'&&typeof _0x2928fe['limit']===_0x8414('0x2c');var _0x3addd1=_0x2fa575[_0x8414('0x2d')];var _0x174c76=_0x1e41b1?0x0:_0x2928fe[_0x8414('0x2b')];var _0xd3570e=_0x1e41b1?_0x2fa575['count']:_0x2928fe['offset']+_0x2928fe[_0x8414('0x2e')];var _0x36638f;if(_0xd3570e>=_0x3addd1){_0xd3570e=_0x3addd1;_0x36638f=0xc8;}else{_0x36638f=0xce;}_0x2c1f74[_0x8414('0x2a')](_0x36638f);return _0x2c1f74[_0x8414('0x2f')](_0x8414('0x30'),_0x174c76+'-'+_0xd3570e+'/'+_0x3addd1)['json'](_0x2fa575);}return null;};}function patchUpdates(_0xc44ee5){return function(_0x13af16){try{jsonpatch['apply'](_0x13af16,_0xc44ee5,!![]);}catch(_0x2e4b8c){return BPromise['reject'](_0x2e4b8c);}return _0x13af16[_0x8414('0x31')]();};}function saveUpdates(_0x30ba10,_0x4eeddf){return function(_0x4b1294){if(_0x4b1294){return _0x4b1294[_0x8414('0x32')](_0x30ba10)[_0x8414('0x20')](function(_0x330f6a){return _0x330f6a;});}return null;};}function removeEntity(_0x139a3f,_0x4c793e){return function(_0x2b2b68){if(_0x2b2b68){return _0x2b2b68[_0x8414('0x33')]()[_0x8414('0x20')](function(){_0x139a3f[_0x8414('0x2a')](0xcc)[_0x8414('0x34')]();});}};}function handleEntityNotFound(_0x2354e8,_0x58552b){return function(_0x3bac15){if(!_0x3bac15){_0x2354e8[_0x8414('0x29')](0x194);}return _0x3bac15;};}function handleError(_0x56b8c7,_0x9ca9e2){_0x9ca9e2=_0x9ca9e2||0x1f4;return function(_0x452ffd){logger[_0x8414('0x26')](_0x452ffd[_0x8414('0x35')]);if(_0x452ffd['name']){delete _0x452ffd[_0x8414('0x36')];}_0x56b8c7[_0x8414('0x2a')](_0x9ca9e2)['send'](_0x452ffd);};}exports[_0x8414('0x37')]=function(_0x5173fb,_0x515988){var _0x50a3a5={},_0x7819ea={},_0x27a0e7={'count':0x0,'rows':[]};var _0x3c1dbe=_[_0x8414('0x38')](db[_0x8414('0x39')]['rawAttributes'],function(_0x5a6371){return{'name':_0x5a6371[_0x8414('0x3a')],'type':_0x5a6371[_0x8414('0x3b')][_0x8414('0x3c')]};});_0x7819ea['model']=_[_0x8414('0x38')](_0x3c1dbe,_0x8414('0x36'));_0x7819ea['query']=_[_0x8414('0x3d')](_0x5173fb[_0x8414('0x3e')]);_0x7819ea[_0x8414('0x3f')]=_[_0x8414('0x40')](_0x7819ea[_0x8414('0x41')],_0x7819ea[_0x8414('0x3e')]);_0x50a3a5[_0x8414('0x42')]=_[_0x8414('0x40')](_0x7819ea[_0x8414('0x41')],qs[_0x8414('0x43')](_0x5173fb['query'][_0x8414('0x43')]));_0x50a3a5[_0x8414('0x42')]=_0x50a3a5[_0x8414('0x42')][_0x8414('0x44')]?_0x50a3a5[_0x8414('0x42')]:_0x7819ea[_0x8414('0x41')];if(!_0x5173fb[_0x8414('0x3e')]['hasOwnProperty'](_0x8414('0x45'))){_0x50a3a5['limit']=qs[_0x8414('0x2e')](_0x5173fb[_0x8414('0x3e')][_0x8414('0x2e')]);_0x50a3a5[_0x8414('0x2b')]=qs['offset'](_0x5173fb[_0x8414('0x3e')][_0x8414('0x2b')]);}_0x50a3a5[_0x8414('0x46')]=qs[_0x8414('0x47')](_0x5173fb[_0x8414('0x3e')]['sort']);_0x50a3a5[_0x8414('0x48')]=qs[_0x8414('0x3f')](_[_0x8414('0x49')](_0x5173fb['query'],_0x7819ea['filters']),_0x3c1dbe);if(_0x5173fb[_0x8414('0x3e')][_0x8414('0x4a')]){_0x50a3a5[_0x8414('0x48')]=_[_0x8414('0x4b')](_0x50a3a5[_0x8414('0x48')],{'$or':_['map'](_0x3c1dbe,function(_0x30da60){if(_0x30da60['type']!==_0x8414('0x4c')){var _0x167584={};_0x167584[_0x30da60[_0x8414('0x36')]]={'$like':'%'+_0x5173fb[_0x8414('0x3e')]['filter']+'%'};return _0x167584;}})});}_0x50a3a5=_[_0x8414('0x4b')]({},_0x50a3a5,_0x5173fb['options']);var _0x3bbc9d={'where':_0x50a3a5['where']};return db['FaxMessage'][_0x8414('0x2d')](_0x3bbc9d)['then'](function(_0x5995a8){_0x27a0e7['count']=_0x5995a8;if(_0x5173fb['query'][_0x8414('0x4d')]){_0x50a3a5[_0x8414('0x4e')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x50a3a5);})[_0x8414('0x20')](function(_0x31ab5c){_0x27a0e7[_0x8414('0x4f')]=_0x31ab5c;return _0x27a0e7;})['then'](respondWithFilteredResult(_0x515988,_0x50a3a5))['catch'](handleError(_0x515988,null));};exports[_0x8414('0x50')]=function(_0x4ce935,_0x23eb0f){var _0xcc7d01={'raw':!![],'where':{'id':_0x4ce935[_0x8414('0x51')]['id']}},_0x2500c9={};_0x2500c9[_0x8414('0x41')]=_[_0x8414('0x3d')](db['FaxMessage'][_0x8414('0x52')]);_0x2500c9[_0x8414('0x3e')]=_[_0x8414('0x3d')](_0x4ce935[_0x8414('0x3e')]);_0x2500c9['filters']=_['intersection'](_0x2500c9[_0x8414('0x41')],_0x2500c9[_0x8414('0x3e')]);_0xcc7d01[_0x8414('0x42')]=_[_0x8414('0x40')](_0x2500c9[_0x8414('0x41')],qs['fields'](_0x4ce935['query'][_0x8414('0x43')]));_0xcc7d01[_0x8414('0x42')]=_0xcc7d01[_0x8414('0x42')][_0x8414('0x44')]?_0xcc7d01[_0x8414('0x42')]:_0x2500c9['model'];if(_0x4ce935['query'][_0x8414('0x4d')]){_0xcc7d01['include']=[{'all':!![]}];}_0xcc7d01=_['merge']({},_0xcc7d01,_0x4ce935['options']);return db['FaxMessage'][_0x8414('0x53')](_0xcc7d01)[_0x8414('0x20')](handleEntityNotFound(_0x23eb0f,null))['then'](respondWithResult(_0x23eb0f,null))[_0x8414('0x54')](handleError(_0x23eb0f,null));};exports[_0x8414('0x32')]=function(_0x39b90e,_0x583aba){if(_0x39b90e['body']['id']){delete _0x39b90e[_0x8414('0x55')]['id'];}return db[_0x8414('0x39')][_0x8414('0x53')]({'where':{'id':_0x39b90e['params']['id']}})[_0x8414('0x20')](handleEntityNotFound(_0x583aba,null))[_0x8414('0x20')](saveUpdates(_0x39b90e['body'],null))[_0x8414('0x20')](respondWithResult(_0x583aba,null))[_0x8414('0x54')](handleError(_0x583aba,null));};exports[_0x8414('0x33')]=function(_0x2ae7f4,_0x37a840){return db[_0x8414('0x39')][_0x8414('0x53')]({'where':{'id':_0x2ae7f4[_0x8414('0x51')]['id']}})[_0x8414('0x20')](handleEntityNotFound(_0x37a840,null))['then'](removeEntity(_0x37a840,null))[_0x8414('0x54')](handleError(_0x37a840,null));};exports[_0x8414('0x56')]=function(_0x53aba0,_0x1694c6){return db['FaxMessage']['describe']()[_0x8414('0x20')](respondWithResult(_0x1694c6,null))['catch'](handleError(_0x1694c6,null));};var interaction_log=require('../../config/logger')(_0x8414('0x57'));exports[_0x8414('0x58')]=function(_0x242623,_0xb11d6c,_0x1d6b5c){var _0x560d82={'agent':{},'channel':'fax'};if(_0x242623[_0x8414('0x55')]['id']){delete _0x242623[_0x8414('0x55')]['id'];}_0x242623[_0x8414('0x55')][_0x8414('0x59')]=!![];_0x242623[_0x8414('0x55')][_0x8414('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x242623[_0x8414('0x55')][_0x8414('0x5b')]=_0x242623['body'][_0x8414('0x5b')]||_0x242623[_0x8414('0x5c')]['id'];_0x560d82['agent']['id']=_0x242623['body']['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x242623[_0x8414('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb11d6c,null))[_0x8414('0x20')](saveUpdates(_0x242623['body'],null))[_0x8414('0x20')](function(_0x477697){if(_0x477697){_0x560d82['message']=_0x477697['get']({'plain':!![]});return db[_0x8414('0x5d')][_0x8414('0x53')]({'where':{'id':_0x477697[_0x8414('0x5e')]}});}return null;})[_0x8414('0x20')](handleEntityNotFound(_0xb11d6c,null))[_0x8414('0x20')](function(_0x1bd0b4){if(_0x1bd0b4){return _0x1bd0b4[_0x8414('0x32')]({'UserId':_0x242623['body']['UserId'],'read1stAt':_[_0x8414('0x5f')](_0x1bd0b4[_0x8414('0x60')])?moment()['format'](_0x8414('0x61')):undefined});}return null;})[_0x8414('0x20')](function(_0x4c92d0){if(_0x4c92d0){_0x560d82[_0x8414('0x62')]=_0x4c92d0[_0x8414('0x63')]({'plain':!![]});interaction_log[_0x8414('0x21')](_0x8414('0x64'),_0x242623[_0x8414('0x5c')]['id'],_0x242623[_0x8414('0x5c')][_0x8414('0x36')],_0x242623['user'][_0x8414('0x65')],_0x560d82['interaction']['id'],_0x242623[_0x8414('0x55')]?JSON[_0x8414('0x25')](_0x242623['body']):_0x8414('0x66'));return respondWithRpcPromise(_0x8414('0x67'),_0x8414('0x68'),_0x560d82);}return null;})[_0x8414('0x20')](function(_0x10ead8){var _0xfedd43=_0x8414('0x69')+_0x10ead8['message'][_0x8414('0x6a')];return db[_0x8414('0x6b')]['query'](_0xfedd43,{'type':db[_0x8414('0x6c')][_0x8414('0x6d')][_0x8414('0x6e')],'raw':!![]})['then'](function(_0x15ad19){return _0x15ad19;});})['then'](function(_0x416f3c){if(_0x416f3c){_0x560d82[_0x8414('0x28')][_0x8414('0x6f')]=_0x416f3c[0x0];if(!_0x242623[_0x8414('0x55')]['UserId'])return;return db[_0x8414('0x70')][_0x8414('0x53')]({'where':{'id':_0x242623[_0x8414('0x55')][_0x8414('0x5b')],'role':_0x8414('0x71')},'attributes':['id',_0x8414('0x36'),_0x8414('0x72'),'email',_0x8414('0x73')],'raw':!![]});}return null;})[_0x8414('0x20')](function(_0x55f47e){if(!_0x55f47e)return null;_0x560d82['message']['agent']=_0x55f47e;return _0x560d82;})[_0x8414('0x20')](function(_0x6541a4){if(_0x6541a4){if(_0x242623[_0x8414('0x55')][_0x8414('0x74')]){_0x560d82['message']['interface']=util['format'](_0x8414('0x75'),_0x242623['user'][_0x8414('0x36')]);_0x560d82['message'][_0x8414('0x76')]=_0x560d82[_0x8414('0x76')];_0x560d82[_0x8414('0x28')][_0x8414('0x77')]=_0x560d82[_0x8414('0x76')];_0x560d82['message'][_0x8414('0x78')]=_0x8414('0x58');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x560d82[_0x8414('0x28')]},client9002)['then'](function(){return _0x560d82;});}return _0x560d82;}return null;})['then'](respondWithResult(_0xb11d6c,null))['catch'](handleError(_0xb11d6c,null));};var interaction_log=require(_0x8414('0x13'))(_0x8414('0x57'));exports[_0x8414('0x79')]=function(_0x54fc5e,_0x5e123b,_0xd2eeef){var _0x5d461c={'agent':{},'channel':_0x8414('0x7a')};if(_0x54fc5e[_0x8414('0x55')]['id']){delete _0x54fc5e[_0x8414('0x55')]['id'];}_0x54fc5e['body'][_0x8414('0x5b')]=_0x54fc5e[_0x8414('0x55')][_0x8414('0x5b')]||_0x54fc5e[_0x8414('0x5c')]['id'];_0x5d461c[_0x8414('0x71')]['id']=_0x54fc5e[_0x8414('0x55')][_0x8414('0x5b')];return db[_0x8414('0x39')][_0x8414('0x53')]({'where':{'id':_0x54fc5e['params']['id'],'UserId':null}})[_0x8414('0x20')](handleEntityNotFound(_0x5e123b,null))[_0x8414('0x20')](function(_0x548063){if(_0x548063){_0x5d461c[_0x8414('0x28')]=_0x548063[_0x8414('0x63')]({'plain':!![]});return db[_0x8414('0x5d')]['find']({'where':{'id':_0x548063[_0x8414('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x5e123b,null))[_0x8414('0x20')](function(_0xfc1b23){if(_0xfc1b23){_0x5d461c['interaction']=_0xfc1b23[_0x8414('0x63')]({'plain':!![]});interaction_log[_0x8414('0x21')](_0x8414('0x7b'),_0x54fc5e[_0x8414('0x5c')]['id'],_0x54fc5e[_0x8414('0x5c')][_0x8414('0x36')],_0x54fc5e[_0x8414('0x5c')][_0x8414('0x65')],_0x5d461c[_0x8414('0x62')]['id'],_0x54fc5e[_0x8414('0x55')]?JSON['stringify'](_0x54fc5e[_0x8414('0x55')]):_0x8414('0x66'));return respondWithRpcPromise(_0x8414('0x7c'),_0x8414('0x7d'),_0x5d461c);}return null;})[_0x8414('0x20')](function(_0x26adac){var _0x2e8631=_0x8414('0x69')+_0x26adac[_0x8414('0x28')][_0x8414('0x6a')];return db[_0x8414('0x6b')][_0x8414('0x3e')](_0x2e8631,{'type':db['Sequelize'][_0x8414('0x6d')]['SELECT'],'raw':!![]})[_0x8414('0x20')](function(_0x341e9d){return _0x341e9d;});})['then'](function(_0x2479bf){if(_0x2479bf){_0x5d461c[_0x8414('0x28')][_0x8414('0x6f')]=_0x2479bf[0x0];if(!_0x54fc5e[_0x8414('0x55')]['UserId'])return;return db['User'][_0x8414('0x53')]({'where':{'id':_0x54fc5e['body']['UserId'],'role':_0x8414('0x71')},'attributes':['id','name','fullname','email',_0x8414('0x73')],'raw':!![]});}return null;})[_0x8414('0x20')](function(_0x24a2e0){if(!_0x24a2e0)return null;_0x5d461c[_0x8414('0x28')][_0x8414('0x71')]=_0x24a2e0;return _0x5d461c;})[_0x8414('0x20')](function(_0x3f01e4){if(_0x3f01e4){_0x3f01e4['message'][_0x8414('0x7e')]=util[_0x8414('0x7f')](_0x8414('0x75'),_0x54fc5e['user'][_0x8414('0x36')]);_0x3f01e4['message']['channel']=_0x5d461c['channel'];_0x3f01e4['message'][_0x8414('0x77')]=_0x5d461c[_0x8414('0x76')];_0x3f01e4[_0x8414('0x28')]['event']=_0x8414('0x79');respondWithRpcPromise('EventManager',_0x8414('0x80'),{'event':_0x8414('0x81'),'message':_0x3f01e4[_0x8414('0x28')]},client9002);return _0x5d461c;}return null;})[_0x8414('0x20')](respondWithResult(_0x5e123b,null))[_0x8414('0x54')](handleError(_0x5e123b,null));};exports[_0x8414('0x82')]=function(_0x20da75,_0x201a83){var _0x7364cf;return db[_0x8414('0x39')][_0x8414('0x82')](_0x20da75[_0x8414('0x55')],{})[_0x8414('0x20')](function(_0x498aab){_0x7364cf=_0x498aab;return db[_0x8414('0x83')]['findOne']({'where':{'id':_0x7364cf[_0x8414('0x6a')]}});})[_0x8414('0x20')](function(_0x4663c8){if(_['isNil'](_0x4663c8)){return;}else{_0x7364cf['fax']=_0x4663c8[_0x8414('0x7a')];return db[_0x8414('0x84')][_0x8414('0x85')]({'where':{'id':_0x7364cf['AttachmentId']}});}})[_0x8414('0x20')](function(_0x17e484){return respondWithRpcPromise(_0x8414('0x86'),_0x8414('0x86'),{'FaxAccountId':_[_0x8414('0x5f')](_0x20da75[_0x8414('0x55')])?undefined:_0x20da75[_0x8414('0x55')][_0x8414('0x87')],'path':_[_0x8414('0x5f')](_0x17e484)?undefined:util[_0x8414('0x7f')](_0x8414('0x88'),_0x17e484[_0x8414('0x89')]),'fax':_['isNil'](_0x7364cf[_0x8414('0x7a')])?undefined:_0x7364cf[_0x8414('0x7a')],'AttachmentId':_0x7364cf[_0x8414('0x8a')]},client9002);})[_0x8414('0x20')](respondWithResult(_0x201a83,0xc9))['catch'](handleError(_0x201a83,null));};exports[_0x8414('0x8b')]=function(_0x685816,_0x251d72){var _0x41b6a1=path[_0x8414('0x8c')](config[_0x8414('0x8d')],_0x8414('0x8e'),_0x8414('0x8f'),_0x8414('0x90'));return db[_0x8414('0x39')]['find']({'where':{'id':_0x685816[_0x8414('0x51')]['id']},'include':[{'model':db[_0x8414('0x84')],'as':'Attachment'}]})[_0x8414('0x20')](handleEntityNotFound(_0x251d72,null))[_0x8414('0x20')](function(_0x2dc639){if(_0x2dc639){return _0x251d72['download'](path['join'](_0x41b6a1,_0x2dc639[_0x8414('0x84')][_0x8414('0x89')]));}})['catch'](handleError(_0x251d72,null));}; \ No newline at end of file +var _0x6181=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FaxMessage','include','findAll','show','params','keys','length','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','ContactId','QueryTypes','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','fullname','rejectmessage','create','CmContact','Attachment','findOne','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','files','download','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service'];(function(_0x5da398,_0x13a526){var _0x4db43a=function(_0x377646){while(--_0x377646){_0x5da398['push'](_0x5da398['shift']());}};_0x4db43a(++_0x13a526);}(_0x6181,0x11c));var _0x1618=function(_0x29d3c6,_0x49d122){_0x29d3c6=_0x29d3c6-0x0;var _0x488491=_0x6181[_0x29d3c6];return _0x488491;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1618('0x0'));var zipdir=require(_0x1618('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1618('0x2'));var moment=require(_0x1618('0x3'));var BPromise=require(_0x1618('0x4'));var Mustache=require(_0x1618('0x5'));var util=require('util');var path=require(_0x1618('0x6'));var sox=require('sox');var csv=require(_0x1618('0x7'));var ejs=require(_0x1618('0x8'));var fs=require('fs');var fs_extra=require(_0x1618('0x9'));var _=require(_0x1618('0xa'));var squel=require(_0x1618('0xb'));var crypto=require(_0x1618('0xc'));var jsforce=require(_0x1618('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1618('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1618('0xe'));var authService=require(_0x1618('0xf'));var qs=require(_0x1618('0x10'));var as=require(_0x1618('0x11'));var hardwareService=require(_0x1618('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1618('0x13'));var config=require(_0x1618('0x14'));var licenseUtil=require(_0x1618('0x15'));var db=require(_0x1618('0x16'))['db'];config[_0x1618('0x17')]=_[_0x1618('0x18')](config[_0x1618('0x17')],{'host':_0x1618('0x19'),'port':0x18eb});var socket=require(_0x1618('0x1a'))(new Redis(config[_0x1618('0x17')]));require(_0x1618('0x1b'))[_0x1618('0x1c')](socket);var jayson=require(_0x1618('0x1d'));var client=jayson[_0x1618('0x1e')][_0x1618('0x1f')]({'port':0x232c});var client9002=jayson[_0x1618('0x1e')][_0x1618('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1248c6,_0x587a41,_0x5d62e0,_0x7cceb0){return new BPromise(function(_0x3c1687,_0x31db80){var _0xdf90ac=_0x7cceb0||client;return _0xdf90ac[_0x1618('0x20')](_0x1248c6,_0x5d62e0)[_0x1618('0x21')](function(_0x106a9f){logger[_0x1618('0x22')](_0x1618('0x23'),_0x587a41,_0x1618('0x24'));logger[_0x1618('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x587a41,'request\x20sent',JSON['stringify'](_0x106a9f));if(_0x106a9f[_0x1618('0x26')]){if(_0x106a9f[_0x1618('0x26')][_0x1618('0x27')]===0x1f4){logger[_0x1618('0x26')](_0x1618('0x23'),_0x587a41,_0x106a9f[_0x1618('0x26')]['message']);return _0x31db80(_0x106a9f[_0x1618('0x26')][_0x1618('0x28')]);}logger[_0x1618('0x26')]('FaxMessage,\x20%s,\x20%s',_0x587a41,_0x106a9f[_0x1618('0x26')]['message']);return _0x3c1687(_0x106a9f['error'][_0x1618('0x28')]);}else{logger[_0x1618('0x22')](_0x1618('0x23'),_0x587a41,_0x1618('0x24'));_0x3c1687(_0x106a9f[_0x1618('0x29')][_0x1618('0x28')]);}})[_0x1618('0x2a')](function(_0xe27335){logger[_0x1618('0x26')]('FaxMessage,\x20%s,\x20%s',_0x587a41,_0xe27335);_0x31db80(_0xe27335);});});}function respondWithStatusCode(_0x500564,_0x2b1ee5){_0x2b1ee5=_0x2b1ee5||0xcc;return function(_0x3665b9){if(_0x3665b9){return _0x500564['sendStatus'](_0x2b1ee5);}return _0x500564[_0x1618('0x2b')](_0x2b1ee5)[_0x1618('0x2c')]();};}function respondWithResult(_0xa8be9e,_0x29b271){_0x29b271=_0x29b271||0xc8;return function(_0x52968c){if(_0x52968c){return _0xa8be9e[_0x1618('0x2b')](_0x29b271)[_0x1618('0x2d')](_0x52968c);}};}function respondWithFilteredResult(_0x4cc66d,_0x1dad08){return function(_0x50f86e){if(_0x50f86e){var _0x267db6=typeof _0x1dad08[_0x1618('0x2e')]==='undefined'&&typeof _0x1dad08[_0x1618('0x2f')]===_0x1618('0x30');var _0x3e97c0=_0x50f86e[_0x1618('0x31')];var _0x58403c=_0x267db6?0x0:_0x1dad08[_0x1618('0x2e')];var _0xd37413=_0x267db6?_0x50f86e[_0x1618('0x31')]:_0x1dad08[_0x1618('0x2e')]+_0x1dad08[_0x1618('0x2f')];var _0x5c551c;if(_0xd37413>=_0x3e97c0){_0xd37413=_0x3e97c0;_0x5c551c=0xc8;}else{_0x5c551c=0xce;}_0x4cc66d[_0x1618('0x2b')](_0x5c551c);return _0x4cc66d[_0x1618('0x32')](_0x1618('0x33'),_0x58403c+'-'+_0xd37413+'/'+_0x3e97c0)[_0x1618('0x2d')](_0x50f86e);}return null;};}function patchUpdates(_0x437276){return function(_0x3a9b13){try{jsonpatch[_0x1618('0x34')](_0x3a9b13,_0x437276,!![]);}catch(_0x55e104){return BPromise[_0x1618('0x35')](_0x55e104);}return _0x3a9b13[_0x1618('0x36')]();};}function saveUpdates(_0x3860b4,_0x411b0b){return function(_0x14f791){if(_0x14f791){return _0x14f791[_0x1618('0x37')](_0x3860b4)[_0x1618('0x21')](function(_0x449154){return _0x449154;});}return null;};}function removeEntity(_0x111e46,_0x5b11f0){return function(_0x155bc9){if(_0x155bc9){return _0x155bc9[_0x1618('0x38')]()[_0x1618('0x21')](function(){_0x111e46[_0x1618('0x2b')](0xcc)[_0x1618('0x2c')]();});}};}function handleEntityNotFound(_0x8ccb04,_0x3a32c5){return function(_0x48cc0e){if(!_0x48cc0e){_0x8ccb04[_0x1618('0x39')](0x194);}return _0x48cc0e;};}function handleError(_0x49f667,_0x109322){_0x109322=_0x109322||0x1f4;return function(_0x232b4d){logger[_0x1618('0x26')](_0x232b4d['stack']);if(_0x232b4d['name']){delete _0x232b4d[_0x1618('0x3a')];}_0x49f667[_0x1618('0x2b')](_0x109322)['send'](_0x232b4d);};}exports[_0x1618('0x3b')]=function(_0x1d77b5,_0x1e31b7){var _0xb00ed9={},_0x1b0915={},_0xc4239e={'count':0x0,'rows':[]};var _0x364b9d=_[_0x1618('0x3c')](db['FaxMessage'][_0x1618('0x3d')],function(_0x320534){return{'name':_0x320534[_0x1618('0x3e')],'type':_0x320534['type'][_0x1618('0x3f')]};});_0x1b0915[_0x1618('0x40')]=_['map'](_0x364b9d,_0x1618('0x3a'));_0x1b0915[_0x1618('0x41')]=_['keys'](_0x1d77b5[_0x1618('0x41')]);_0x1b0915[_0x1618('0x42')]=_[_0x1618('0x43')](_0x1b0915[_0x1618('0x40')],_0x1b0915[_0x1618('0x41')]);_0xb00ed9[_0x1618('0x44')]=_[_0x1618('0x43')](_0x1b0915[_0x1618('0x40')],qs[_0x1618('0x45')](_0x1d77b5['query'][_0x1618('0x45')]));_0xb00ed9['attributes']=_0xb00ed9[_0x1618('0x44')]['length']?_0xb00ed9['attributes']:_0x1b0915[_0x1618('0x40')];if(!_0x1d77b5[_0x1618('0x41')][_0x1618('0x46')](_0x1618('0x47'))){_0xb00ed9[_0x1618('0x2f')]=qs['limit'](_0x1d77b5[_0x1618('0x41')]['limit']);_0xb00ed9[_0x1618('0x2e')]=qs['offset'](_0x1d77b5[_0x1618('0x41')][_0x1618('0x2e')]);}_0xb00ed9[_0x1618('0x48')]=qs[_0x1618('0x49')](_0x1d77b5[_0x1618('0x41')][_0x1618('0x49')]);_0xb00ed9[_0x1618('0x4a')]=qs[_0x1618('0x42')](_[_0x1618('0x4b')](_0x1d77b5[_0x1618('0x41')],_0x1b0915['filters']),_0x364b9d);if(_0x1d77b5[_0x1618('0x41')][_0x1618('0x4c')]){_0xb00ed9['where']=_[_0x1618('0x4d')](_0xb00ed9[_0x1618('0x4a')],{'$or':_[_0x1618('0x3c')](_0x364b9d,function(_0x5bde05){if(_0x5bde05[_0x1618('0x4e')]!==_0x1618('0x4f')){var _0x595f29={};_0x595f29[_0x5bde05[_0x1618('0x3a')]]={'$like':'%'+_0x1d77b5[_0x1618('0x41')][_0x1618('0x4c')]+'%'};return _0x595f29;}})});}_0xb00ed9=_[_0x1618('0x4d')]({},_0xb00ed9,_0x1d77b5[_0x1618('0x50')]);var _0x4d2c6e={'where':_0xb00ed9[_0x1618('0x4a')]};return db[_0x1618('0x51')]['count'](_0x4d2c6e)[_0x1618('0x21')](function(_0x3d3db7){_0xc4239e[_0x1618('0x31')]=_0x3d3db7;if(_0x1d77b5[_0x1618('0x41')]['includeAll']){_0xb00ed9[_0x1618('0x52')]=[{'all':!![]}];}return db[_0x1618('0x51')][_0x1618('0x53')](_0xb00ed9);})[_0x1618('0x21')](function(_0x51c8d8){_0xc4239e['rows']=_0x51c8d8;return _0xc4239e;})[_0x1618('0x21')](respondWithFilteredResult(_0x1e31b7,_0xb00ed9))[_0x1618('0x2a')](handleError(_0x1e31b7,null));};exports[_0x1618('0x54')]=function(_0x5ea7d8,_0x50cbea){var _0x4d7f08={'raw':!![],'where':{'id':_0x5ea7d8[_0x1618('0x55')]['id']}},_0x4b9aed={};_0x4b9aed[_0x1618('0x40')]=_[_0x1618('0x56')](db['FaxMessage'][_0x1618('0x3d')]);_0x4b9aed['query']=_[_0x1618('0x56')](_0x5ea7d8[_0x1618('0x41')]);_0x4b9aed[_0x1618('0x42')]=_['intersection'](_0x4b9aed[_0x1618('0x40')],_0x4b9aed['query']);_0x4d7f08[_0x1618('0x44')]=_[_0x1618('0x43')](_0x4b9aed[_0x1618('0x40')],qs['fields'](_0x5ea7d8['query']['fields']));_0x4d7f08[_0x1618('0x44')]=_0x4d7f08['attributes'][_0x1618('0x57')]?_0x4d7f08[_0x1618('0x44')]:_0x4b9aed[_0x1618('0x40')];if(_0x5ea7d8[_0x1618('0x41')]['includeAll']){_0x4d7f08[_0x1618('0x52')]=[{'all':!![]}];}_0x4d7f08=_['merge']({},_0x4d7f08,_0x5ea7d8[_0x1618('0x50')]);return db[_0x1618('0x51')][_0x1618('0x58')](_0x4d7f08)[_0x1618('0x21')](handleEntityNotFound(_0x50cbea,null))[_0x1618('0x21')](respondWithResult(_0x50cbea,null))['catch'](handleError(_0x50cbea,null));};exports[_0x1618('0x37')]=function(_0x5dfe09,_0x25cc1c){if(_0x5dfe09['body']['id']){delete _0x5dfe09[_0x1618('0x59')]['id'];}return db[_0x1618('0x51')][_0x1618('0x58')]({'where':{'id':_0x5dfe09['params']['id']}})['then'](handleEntityNotFound(_0x25cc1c,null))[_0x1618('0x21')](saveUpdates(_0x5dfe09['body'],null))[_0x1618('0x21')](respondWithResult(_0x25cc1c,null))[_0x1618('0x2a')](handleError(_0x25cc1c,null));};exports[_0x1618('0x38')]=function(_0x3702ce,_0x37814d){return db[_0x1618('0x51')][_0x1618('0x58')]({'where':{'id':_0x3702ce['params']['id']}})[_0x1618('0x21')](handleEntityNotFound(_0x37814d,null))['then'](removeEntity(_0x37814d,null))[_0x1618('0x2a')](handleError(_0x37814d,null));};exports['describe']=function(_0x316f0d,_0x452659){return db[_0x1618('0x51')][_0x1618('0x5a')]()['then'](respondWithResult(_0x452659,null))[_0x1618('0x2a')](handleError(_0x452659,null));};var interaction_log=require(_0x1618('0x5b'))(_0x1618('0x5c'));exports[_0x1618('0x5d')]=function(_0xdcfc77,_0x130879,_0x39e9cb){var _0x4aa19e={'agent':{},'channel':_0x1618('0x5e')};if(_0xdcfc77[_0x1618('0x59')]['id']){delete _0xdcfc77[_0x1618('0x59')]['id'];}_0xdcfc77[_0x1618('0x59')][_0x1618('0x5f')]=!![];_0xdcfc77[_0x1618('0x59')][_0x1618('0x60')]=moment()[_0x1618('0x61')](_0x1618('0x62'));_0xdcfc77[_0x1618('0x59')]['UserId']=_0xdcfc77['body'][_0x1618('0x63')]||_0xdcfc77['user']['id'];_0x4aa19e['agent']['id']=_0xdcfc77['body']['UserId'];return db[_0x1618('0x51')][_0x1618('0x58')]({'where':{'id':_0xdcfc77[_0x1618('0x55')]['id'],'UserId':null}})[_0x1618('0x21')](handleEntityNotFound(_0x130879,null))[_0x1618('0x21')](saveUpdates(_0xdcfc77['body'],null))[_0x1618('0x21')](function(_0xfef502){if(_0xfef502){_0x4aa19e[_0x1618('0x28')]=_0xfef502[_0x1618('0x64')]({'plain':!![]});return db[_0x1618('0x65')][_0x1618('0x58')]({'where':{'id':_0xfef502[_0x1618('0x66')]}});}return null;})[_0x1618('0x21')](handleEntityNotFound(_0x130879,null))['then'](function(_0x433f9f){if(_0x433f9f){return _0x433f9f[_0x1618('0x37')]({'UserId':_0xdcfc77[_0x1618('0x59')][_0x1618('0x63')],'read1stAt':_[_0x1618('0x67')](_0x433f9f[_0x1618('0x68')])?moment()['format'](_0x1618('0x62')):undefined});}return null;})[_0x1618('0x21')](function(_0x4cdfe7){if(_0x4cdfe7){_0x4aa19e[_0x1618('0x69')]=_0x4cdfe7[_0x1618('0x64')]({'plain':!![]});interaction_log[_0x1618('0x22')](_0x1618('0x6a'),_0xdcfc77[_0x1618('0x6b')]['id'],_0xdcfc77[_0x1618('0x6b')][_0x1618('0x3a')],_0xdcfc77['user'][_0x1618('0x6c')],_0x4aa19e[_0x1618('0x69')]['id'],_0xdcfc77[_0x1618('0x59')]?JSON[_0x1618('0x6d')](_0xdcfc77[_0x1618('0x59')]):'null');return respondWithRpcPromise(_0x1618('0x6e'),_0x1618('0x6f'),_0x4aa19e);}return null;})[_0x1618('0x21')](function(_0x284f52){var _0x410048='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x284f52[_0x1618('0x28')][_0x1618('0x70')];return db['sequelize'][_0x1618('0x41')](_0x410048,{'type':db['Sequelize'][_0x1618('0x71')]['SELECT'],'raw':!![]})[_0x1618('0x21')](function(_0x21ce70){return _0x21ce70;});})[_0x1618('0x21')](function(_0x381293){if(_0x381293){_0x4aa19e[_0x1618('0x28')][_0x1618('0x72')]=_0x381293[0x0];if(!_0xdcfc77['body'][_0x1618('0x63')])return;return db[_0x1618('0x73')]['find']({'where':{'id':_0xdcfc77[_0x1618('0x59')]['UserId'],'role':_0x1618('0x74')},'attributes':['id','name','fullname',_0x1618('0x75'),_0x1618('0x76')],'raw':!![]});}return null;})[_0x1618('0x21')](function(_0x555138){if(!_0x555138)return null;_0x4aa19e[_0x1618('0x28')][_0x1618('0x74')]=_0x555138;return _0x4aa19e;})[_0x1618('0x21')](function(_0x138e46){if(_0x138e46){if(_0xdcfc77['body'][_0x1618('0x77')]){_0x4aa19e[_0x1618('0x28')][_0x1618('0x78')]=util[_0x1618('0x61')](_0x1618('0x79'),_0xdcfc77[_0x1618('0x6b')][_0x1618('0x3a')]);_0x4aa19e[_0x1618('0x28')]['channel']=_0x4aa19e[_0x1618('0x7a')];_0x4aa19e['message'][_0x1618('0x7b')]=_0x4aa19e[_0x1618('0x7a')];_0x4aa19e[_0x1618('0x28')][_0x1618('0x7c')]=_0x1618('0x5d');return respondWithRpcPromise('EventManager',_0x1618('0x7d'),{'event':_0x1618('0x7e'),'message':_0x4aa19e[_0x1618('0x28')]},client9002)[_0x1618('0x21')](function(){return _0x4aa19e;});}return _0x4aa19e;}return null;})[_0x1618('0x21')](respondWithResult(_0x130879,null))[_0x1618('0x2a')](handleError(_0x130879,null));};var interaction_log=require(_0x1618('0x5b'))(_0x1618('0x5c'));exports[_0x1618('0x35')]=function(_0x192866,_0x117bc9,_0x3096c5){var _0x2b0b0a={'agent':{},'channel':'fax'};if(_0x192866['body']['id']){delete _0x192866[_0x1618('0x59')]['id'];}_0x192866[_0x1618('0x59')][_0x1618('0x63')]=_0x192866[_0x1618('0x59')][_0x1618('0x63')]||_0x192866[_0x1618('0x6b')]['id'];_0x2b0b0a[_0x1618('0x74')]['id']=_0x192866[_0x1618('0x59')]['UserId'];return db[_0x1618('0x51')][_0x1618('0x58')]({'where':{'id':_0x192866[_0x1618('0x55')]['id'],'UserId':null}})[_0x1618('0x21')](handleEntityNotFound(_0x117bc9,null))[_0x1618('0x21')](function(_0x53a63d){if(_0x53a63d){_0x2b0b0a[_0x1618('0x28')]=_0x53a63d[_0x1618('0x64')]({'plain':!![]});return db[_0x1618('0x65')][_0x1618('0x58')]({'where':{'id':_0x53a63d[_0x1618('0x66')]}});}return null;})[_0x1618('0x21')](handleEntityNotFound(_0x117bc9,null))[_0x1618('0x21')](function(_0x225797){if(_0x225797){_0x2b0b0a[_0x1618('0x69')]=_0x225797[_0x1618('0x64')]({'plain':!![]});interaction_log[_0x1618('0x22')](_0x1618('0x7f'),_0x192866['user']['id'],_0x192866[_0x1618('0x6b')][_0x1618('0x3a')],_0x192866[_0x1618('0x6b')]['role'],_0x2b0b0a[_0x1618('0x69')]['id'],_0x192866[_0x1618('0x59')]?JSON[_0x1618('0x6d')](_0x192866[_0x1618('0x59')]):_0x1618('0x80'));return respondWithRpcPromise(_0x1618('0x81'),_0x1618('0x82'),_0x2b0b0a);}return null;})[_0x1618('0x21')](function(_0x5a19b4){var _0x45557c=_0x1618('0x83')+_0x5a19b4['message'][_0x1618('0x70')];return db[_0x1618('0x84')][_0x1618('0x41')](_0x45557c,{'type':db[_0x1618('0x85')][_0x1618('0x71')][_0x1618('0x86')],'raw':!![]})[_0x1618('0x21')](function(_0x100c8c){return _0x100c8c;});})['then'](function(_0x2b9442){if(_0x2b9442){_0x2b0b0a[_0x1618('0x28')][_0x1618('0x72')]=_0x2b9442[0x0];if(!_0x192866[_0x1618('0x59')][_0x1618('0x63')])return;return db[_0x1618('0x73')][_0x1618('0x58')]({'where':{'id':_0x192866[_0x1618('0x59')]['UserId'],'role':_0x1618('0x74')},'attributes':['id',_0x1618('0x3a'),_0x1618('0x87'),'email',_0x1618('0x76')],'raw':!![]});}return null;})[_0x1618('0x21')](function(_0x5a66af){if(!_0x5a66af)return null;_0x2b0b0a[_0x1618('0x28')][_0x1618('0x74')]=_0x5a66af;return _0x2b0b0a;})[_0x1618('0x21')](function(_0x1bb916){if(_0x1bb916){_0x1bb916['message'][_0x1618('0x78')]=util['format']('SIP/%s',_0x192866['user'][_0x1618('0x3a')]);_0x1bb916[_0x1618('0x28')]['channel']=_0x2b0b0a[_0x1618('0x7a')];_0x1bb916[_0x1618('0x28')]['motionChannel']=_0x2b0b0a[_0x1618('0x7a')];_0x1bb916[_0x1618('0x28')]['event']=_0x1618('0x35');respondWithRpcPromise(_0x1618('0x7d'),_0x1618('0x7d'),{'event':_0x1618('0x88'),'message':_0x1bb916[_0x1618('0x28')]},client9002);return _0x2b0b0a;}return null;})[_0x1618('0x21')](respondWithResult(_0x117bc9,null))[_0x1618('0x2a')](handleError(_0x117bc9,null));};exports[_0x1618('0x89')]=function(_0x5ef7ee,_0x3cc2c1){var _0x55f27d;return db[_0x1618('0x51')][_0x1618('0x89')](_0x5ef7ee[_0x1618('0x59')],{})[_0x1618('0x21')](function(_0x1a5a42){_0x55f27d=_0x1a5a42;return db[_0x1618('0x8a')]['findOne']({'where':{'id':_0x55f27d[_0x1618('0x70')]}});})[_0x1618('0x21')](function(_0x1e7b35){if(_[_0x1618('0x67')](_0x1e7b35)){return;}else{_0x55f27d[_0x1618('0x5e')]=_0x1e7b35['fax'];return db[_0x1618('0x8b')][_0x1618('0x8c')]({'where':{'id':_0x55f27d['AttachmentId']}});}})[_0x1618('0x21')](function(_0x43a22d){return respondWithRpcPromise(_0x1618('0x8d'),_0x1618('0x8d'),{'FaxAccountId':_[_0x1618('0x67')](_0x5ef7ee[_0x1618('0x59')])?undefined:_0x5ef7ee[_0x1618('0x59')]['FaxAccountId'],'path':_[_0x1618('0x67')](_0x43a22d)?undefined:util[_0x1618('0x61')](_0x1618('0x8e'),_0x43a22d[_0x1618('0x8f')]),'fax':_['isNil'](_0x55f27d[_0x1618('0x5e')])?undefined:_0x55f27d[_0x1618('0x5e')],'AttachmentId':_0x55f27d[_0x1618('0x90')]},client9002);})[_0x1618('0x21')](respondWithResult(_0x3cc2c1,0xc9))[_0x1618('0x2a')](handleError(_0x3cc2c1,null));};exports['download']=function(_0x3c55fb,_0x253333){var _0x500647=path[_0x1618('0x91')](config[_0x1618('0x92')],_0x1618('0x93'),_0x1618('0x94'),'attachments');return db[_0x1618('0x51')][_0x1618('0x58')]({'where':{'id':_0x3c55fb['params']['id']},'include':[{'model':db[_0x1618('0x8b')],'as':_0x1618('0x8b')}]})['then'](handleEntityNotFound(_0x253333,null))[_0x1618('0x21')](function(_0x4af1b0){if(_0x4af1b0){return _0x253333[_0x1618('0x95')](path[_0x1618('0x91')](_0x500647,_0x4af1b0[_0x1618('0x8b')]['basename']));}})[_0x1618('0x2a')](handleError(_0x253333,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6442dd3..aa7213f 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 _0x202a=['update','hasOwnProperty','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xa202('0x0'))['db'][_0xa202('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa202('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa202('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4878f5){return function(_0x595945,_0x32f8b7,_0x1ce932){FaxMessageEvents['emit'](_0x4878f5+':'+_0x595945['id'],_0x595945);FaxMessageEvents['emit'](_0x4878f5,_0x595945);_0x1ce932(null);};}for(var e in events){if(events[_0xa202('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xc1c6=['../../mysqldb','FaxMessage','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x1d6a29,_0x1f9cf9){var _0x1d3206=function(_0x314ffd){while(--_0x314ffd){_0x1d6a29['push'](_0x1d6a29['shift']());}};_0x1d3206(++_0x1f9cf9);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3df545,_0x34422b){_0x3df545=_0x3df545-0x0;var _0x36f400=_0xc1c6[_0x3df545];return _0x36f400;};'use strict';var EventEmitter=require(_0x6c1c('0x0'));var FaxMessage=require(_0x6c1c('0x1'))['db'][_0x6c1c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c1c('0x3'),'afterUpdate':'update','afterDestroy':_0x6c1c('0x4')};function emitEvent(_0x40ff59){return function(_0x265d2c,_0x59f799,_0x56ed6f){FaxMessageEvents[_0x6c1c('0x5')](_0x40ff59+':'+_0x265d2c['id'],_0x265d2c);FaxMessageEvents['emit'](_0x40ff59,_0x265d2c);_0x56ed6f(null);};}for(var e in events){if(events[_0x6c1c('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x6c1c('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4d82879..6bb254d 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 _0xe139=['createdAt','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update'];(function(_0x322f4d,_0x2211c6){var _0x548443=function(_0x5f42a4){while(--_0x5f42a4){_0x322f4d['push'](_0x322f4d['shift']());}};_0x548443(++_0x2211c6);}(_0xe139,0x9e));var _0x9e13=function(_0x590a23,_0x26e8b4){_0x590a23=_0x590a23-0x0;var _0x19ff19=_0xe139[_0x590a23];return _0x19ff19;};'use strict';var _=require(_0x9e13('0x0'));var util=require(_0x9e13('0x1'));var logger=require('../../config/logger')(_0x9e13('0x2'));var moment=require(_0x9e13('0x3'));var BPromise=require(_0x9e13('0x4'));var rp=require(_0x9e13('0x5'));var fs=require('fs');var path=require(_0x9e13('0x6'));var rimraf=require(_0x9e13('0x7'));var config=require(_0x9e13('0x8'));var attributes=require(_0x9e13('0x9'));module['exports']=function(_0x3c2d3d,_0x50cdc0){return _0x3c2d3d['define'](_0x9e13('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x9e13('0xb'),'fields':['body'],'type':_0x9e13('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x370ded,_0x281d02,_0x561d01){var _0x1e124f=_0x3c2d3d[_0x9e13('0xd')];var _0x213652=_0x370ded['get']({'plain':!![]});if(_0x213652[_0x9e13('0xe')][_0x9e13('0xf')]()==='in'||_0x213652[_0x9e13('0xe')]['toLowerCase']()==='out'&&!_0x213652[_0x9e13('0x10')]&&!_[_0x9e13('0x11')](_0x213652[_0x9e13('0x12')])){_0x1e124f[_0x9e13('0x13')][_0x9e13('0x14')]({'where':{'id':_0x213652[_0x9e13('0x15')]}})[_0x9e13('0x16')](function(_0x570aef){if(_0x570aef){_0x570aef[_0x9e13('0x17')]({'lastMsgAt':_0x213652[_0x9e13('0x18')],'lastMsgDirection':_0x213652[_0x9e13('0xe')][_0x9e13('0xf')]()});}})['catch'](function(_0x3eea4b){console['error'](_0x3eea4b);});}_0x561d01();}},'charset':'utf8mb4','collate':_0x9e13('0x19')});}; \ No newline at end of file +var _0xeeb2=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x4d7f68,_0xb930b){var _0x2d0154=function(_0x4c7b07){while(--_0x4c7b07){_0x4d7f68['push'](_0x4d7f68['shift']());}};_0x2d0154(++_0xb930b);}(_0xeeb2,0x151));var _0x2eeb=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0xeeb2[_0x481af3];return _0x3354ea;};'use strict';var _=require(_0x2eeb('0x0'));var util=require(_0x2eeb('0x1'));var logger=require(_0x2eeb('0x2'))(_0x2eeb('0x3'));var moment=require(_0x2eeb('0x4'));var BPromise=require(_0x2eeb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2eeb('0x6'));var rimraf=require(_0x2eeb('0x7'));var config=require(_0x2eeb('0x8'));var attributes=require(_0x2eeb('0x9'));module['exports']=function(_0x4e3542,_0x745cd5){return _0x4e3542[_0x2eeb('0xa')]('FaxMessage',attributes,{'tableName':_0x2eeb('0xb'),'paranoid':![],'indexes':[{'name':_0x2eeb('0xc'),'fields':[_0x2eeb('0xd')],'type':_0x2eeb('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c5794,_0x5d50c5,_0x41b3b8){var _0x22ae37=_0x4e3542[_0x2eeb('0xf')];var _0x2c3ca8=_0x4c5794['get']({'plain':!![]});if(_0x2c3ca8[_0x2eeb('0x10')][_0x2eeb('0x11')]()==='in'||_0x2c3ca8[_0x2eeb('0x10')]['toLowerCase']()===_0x2eeb('0x12')&&!_0x2c3ca8['secret']&&!_['isNil'](_0x2c3ca8[_0x2eeb('0x13')])){_0x22ae37[_0x2eeb('0x14')][_0x2eeb('0x15')]({'where':{'id':_0x2c3ca8[_0x2eeb('0x16')]}})[_0x2eeb('0x17')](function(_0xe85b94){if(_0xe85b94){_0xe85b94[_0x2eeb('0x18')]({'lastMsgAt':_0x2c3ca8[_0x2eeb('0x19')],'lastMsgDirection':_0x2c3ca8[_0x2eeb('0x10')][_0x2eeb('0x11')]()});}})[_0x2eeb('0x1a')](function(_0x2b6d8c){console[_0x2eeb('0x1b')](_0x2b6d8c);});}_0x41b3b8();}},'charset':_0x2eeb('0x1c'),'collate':_0x2eeb('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6eb05c2..a1162e1 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 _0xe5b3=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','info'];(function(_0x3a8f12,_0x280c88){var _0xecdfce=function(_0x2017c4){while(--_0x2017c4){_0x3a8f12['push'](_0x3a8f12['shift']());}};_0xecdfce(++_0x280c88);}(_0xe5b3,0x133));var _0x3e5b=function(_0x53971a,_0xc7db60){_0x53971a=_0x53971a-0x0;var _0x447c20=_0xe5b3[_0x53971a];return _0x447c20;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});config[_0x3e5b('0xc')]=_['defaults'](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xd'),'port':0x18eb});var socket=require(_0x3e5b('0xe'))(new Redis(config[_0x3e5b('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1fef54,_0x3d3b6e,_0x22fc1a){return new BPromise(function(_0x17dee7,_0xeeaabc){return client['request'](_0x1fef54,_0x22fc1a)[_0x3e5b('0xf')](function(_0x52efbd){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,_0x3e5b('0x12'));logger[_0x3e5b('0x13')](_0x3e5b('0x14'),_0x3d3b6e,_0x3e5b('0x12'),JSON[_0x3e5b('0x15')](_0x52efbd));if(_0x52efbd['error']){if(_0x52efbd[_0x3e5b('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd[_0x3e5b('0x16')][_0x3e5b('0x17')]);return _0xeeaabc(_0x52efbd[_0x3e5b('0x16')]['message']);}logger[_0x3e5b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd['error'][_0x3e5b('0x17')]);return _0x17dee7(_0x52efbd[_0x3e5b('0x16')]['message']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,'request\x20sent');_0x17dee7(_0x52efbd[_0x3e5b('0x18')][_0x3e5b('0x17')]);}})['catch'](function(_0x4b189d){logger[_0x3e5b('0x16')](_0x3e5b('0x11'),_0x3d3b6e,_0x4b189d);_0xeeaabc(_0x4b189d);});});}exports[_0x3e5b('0x19')]=function(_0xff4aba){var _0x24de5b=this;return new Promise(function(_0x1564b5,_0x447d36){return db[_0x3e5b('0x1a')][_0x3e5b('0x1b')](_0xff4aba[_0x3e5b('0x1c')],{'raw':_0xff4aba[_0x3e5b('0x1d')]?_0xff4aba[_0x3e5b('0x1d')][_0x3e5b('0x1e')]===undefined?!![]:![]:!![]})[_0x3e5b('0xf')](function(_0x5b46d4){logger[_0x3e5b('0x10')](_0x3e5b('0x19'),_0xff4aba);logger[_0x3e5b('0x13')](_0x3e5b('0x19'),_0xff4aba,JSON['stringify'](_0x5b46d4));_0x1564b5(_0x5b46d4);})[_0x3e5b('0x1f')](function(_0x5b33bb){logger[_0x3e5b('0x16')](_0x3e5b('0x19'),_0x5b33bb['message'],_0xff4aba);_0x447d36(_0x24de5b[_0x3e5b('0x16')](0x1f4,_0x5b33bb[_0x3e5b('0x17')]));});});};exports[_0x3e5b('0x20')]=function(_0x3c8965){var _0x3bb749=this;return new Promise(function(_0x26c7f2,_0x160e87){return db[_0x3e5b('0x1a')]['update'](_0x3c8965[_0x3e5b('0x1c')],{'raw':_0x3c8965['options']?_0x3c8965[_0x3e5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x21')]||null:null,'attributes':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x22')]||null:null,'limit':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x23')]||null:null})[_0x3e5b('0xf')](function(_0x1e1565){logger['info'](_0x3e5b('0x20'),_0x3c8965);logger[_0x3e5b('0x13')](_0x3e5b('0x20'),_0x3c8965,JSON[_0x3e5b('0x15')](_0x1e1565));_0x26c7f2(_0x1e1565);})[_0x3e5b('0x1f')](function(_0x31e9f9){logger[_0x3e5b('0x16')]('UpdateFaxMessage',_0x31e9f9[_0x3e5b('0x17')],_0x3c8965);_0x160e87(_0x3bb749['error'](0x1f4,_0x31e9f9['message']));});});}; \ No newline at end of file +var _0x4bc3=['CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4bc3,0x16e));var _0x34bc=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x4bc3[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x41b2ff,_0x5de8b5,_0x5a478d){return new BPromise(function(_0x2b8112,_0x33025c){return client[_0x34bc('0x10')](_0x41b2ff,_0x5a478d)['then'](function(_0x41960e){logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));logger[_0x34bc('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5de8b5,_0x34bc('0x12'),JSON['stringify'](_0x41960e));if(_0x41960e[_0x34bc('0x14')]){if(_0x41960e[_0x34bc('0x14')][_0x34bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x41960e[_0x34bc('0x14')]['message']);return _0x33025c(_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);}logger[_0x34bc('0x14')](_0x34bc('0x11'),_0x5de8b5,_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);return _0x2b8112(_0x41960e['error']['message']);}else{logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));_0x2b8112(_0x41960e[_0x34bc('0x17')][_0x34bc('0x16')]);}})['catch'](function(_0x46aa24){logger[_0x34bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x46aa24);_0x33025c(_0x46aa24);});});}exports[_0x34bc('0x18')]=function(_0x9e9f14){var _0x4d2d5e=this;return new Promise(function(_0x14cec8,_0x26cdec){return db[_0x34bc('0x19')][_0x34bc('0x1a')](_0x9e9f14[_0x34bc('0x1b')],{'raw':_0x9e9f14[_0x34bc('0x1c')]?_0x9e9f14['options'][_0x34bc('0x1d')]===undefined?!![]:![]:!![]})[_0x34bc('0x1e')](function(_0x38882c){logger['info']('CreateFaxMessage',_0x9e9f14);logger[_0x34bc('0x13')](_0x34bc('0x18'),_0x9e9f14,JSON[_0x34bc('0x1f')](_0x38882c));_0x14cec8(_0x38882c);})[_0x34bc('0x20')](function(_0x13094a){logger[_0x34bc('0x14')](_0x34bc('0x18'),_0x13094a[_0x34bc('0x16')],_0x9e9f14);_0x26cdec(_0x4d2d5e[_0x34bc('0x14')](0x1f4,_0x13094a[_0x34bc('0x16')]));});});};exports[_0x34bc('0x21')]=function(_0x1edcb0){var _0x4fd589=this;return new Promise(function(_0x43e527,_0x48ec13){return db['FaxMessage'][_0x34bc('0x22')](_0x1edcb0['body'],{'raw':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edcb0['options']?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x23')]||null:null,'attributes':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x24')]||null:null,'limit':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0['options'][_0x34bc('0x25')]||null:null})[_0x34bc('0x1e')](function(_0x22aacc){logger[_0x34bc('0x26')](_0x34bc('0x21'),_0x1edcb0);logger[_0x34bc('0x13')]('UpdateFaxMessage',_0x1edcb0,JSON[_0x34bc('0x1f')](_0x22aacc));_0x43e527(_0x22aacc);})['catch'](function(_0x530748){logger[_0x34bc('0x14')]('UpdateFaxMessage',_0x530748[_0x34bc('0x16')],_0x1edcb0);_0x48ec13(_0x4fd589[_0x34bc('0x14')](0x1f4,_0x530748[_0x34bc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 39a5c11..4073eba 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 _0xdcfa=['save','remove','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0xdcfa,0x1ef));var _0xadcf=function(_0x34e4a0,_0x1fd446){_0x34e4a0=_0x34e4a0-0x0;var _0x3ead3e=_0xdcfa[_0x34e4a0];return _0x3ead3e;};'use strict';var FaxMessageEvents=require(_0xadcf('0x0'));var events=[_0xadcf('0x1'),_0xadcf('0x2'),_0xadcf('0x3')];function createListener(_0x163a68,_0x1fd979){return function(_0x6d779){_0x1fd979[_0xadcf('0x4')](_0x163a68,_0x6d779);};}function removeListener(_0x408619,_0x3a48aa){return function(){FaxMessageEvents[_0xadcf('0x5')](_0x408619,_0x3a48aa);};}exports[_0xadcf('0x6')]=function(_0x2f2795){for(var _0xaf9b47=0x0,_0x5befa0=events[_0xadcf('0x7')];_0xaf9b47<_0x5befa0;_0xaf9b47++){var _0x209ba2=events[_0xaf9b47];var _0x3437b7=createListener('faxMessage:'+_0x209ba2,_0x2f2795);FaxMessageEvents['on'](_0x209ba2,_0x3437b7);}}; \ No newline at end of file +var _0x95b0=['removeListener','length','faxMessage:','remove','emit'];(function(_0x214d8c,_0x242dc3){var _0x5a5060=function(_0x3dc1e0){while(--_0x3dc1e0){_0x214d8c['push'](_0x214d8c['shift']());}};_0x5a5060(++_0x242dc3);}(_0x95b0,0x184));var _0x095b=function(_0x55cdba,_0x131405){_0x55cdba=_0x55cdba-0x0;var _0x182f5a=_0x95b0[_0x55cdba];return _0x182f5a;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x095b('0x0'),'update'];function createListener(_0x556297,_0x1b0b23){return function(_0x13240c){_0x1b0b23[_0x095b('0x1')](_0x556297,_0x13240c);};}function removeListener(_0x5485fc,_0x4785b5){return function(){FaxMessageEvents[_0x095b('0x2')](_0x5485fc,_0x4785b5);};}exports['register']=function(_0x4f8b25){for(var _0x531a94=0x0,_0x4885c9=events[_0x095b('0x3')];_0x531a94<_0x4885c9;_0x531a94++){var _0x5a3ffb=events[_0x531a94];var _0x3d2667=createListener(_0x095b('0x4')+_0x5a3ffb,_0x4f8b25);FaxMessageEvents['on'](_0x5a3ffb,_0x3d2667);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 1dd7633..89d41ab 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 _0x6c76=['path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x6c76,0x184));var _0x66c7=function(_0x455aae,_0x1aa375){_0x455aae=_0x455aae-0x0;var _0x31bbef=_0x6c76[_0x455aae];return _0x31bbef;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./faxMessage.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['download']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),interaction[_0x66c7('0xe')](_0x66c7('0xf'),_0x66c7('0x10')),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);router[_0x66c7('0x12')](_0x66c7('0x14'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x15')]);router[_0x66c7('0x12')](_0x66c7('0x16'),auth[_0x66c7('0x8')](),controller['reject']);router[_0x66c7('0x17')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x18')]);module[_0x66c7('0x19')]=router; \ No newline at end of file +var _0x6f0d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','show','/:id/download','post','tracked','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports'];(function(_0x29e030,_0x1c60cd){var _0x375763=function(_0x16f5f8){while(--_0x16f5f8){_0x29e030['push'](_0x29e030['shift']());}};_0x375763(++_0x1c60cd);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1f80e7,_0x38fcf0){_0x1f80e7=_0x1f80e7-0x0;var _0x52b871=_0x6f0d[_0x1f80e7];return _0x52b871;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller['download']);router[_0xd6f0('0xf')]('/',auth[_0xd6f0('0x9')](),interaction[_0xd6f0('0x10')](_0xd6f0('0x11'),'faxmessage:create'),controller[_0xd6f0('0x12')]);router[_0xd6f0('0x13')](_0xd6f0('0x14'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x15')]);router[_0xd6f0('0x13')](_0xd6f0('0x16'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x17')]);router['put'](_0xd6f0('0x18'),auth[_0xd6f0('0x9')](),controller['reject']);router[_0xd6f0('0x19')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1a')]);module[_0xd6f0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 4124baf..36b0f4e 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 _0x1007=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x19b709,_0x373b44){var _0x29eb28=function(_0x4a66c4){while(--_0x4a66c4){_0x19b709['push'](_0x19b709['shift']());}};_0x29eb28(++_0x373b44);}(_0x1007,0x96));var _0x7100=function(_0x368fbb,_0x128405){_0x368fbb=_0x368fbb-0x0;var _0x11c4d3=_0x1007[_0x368fbb];return _0x11c4d3;};'use strict';var Sequelize=require(_0x7100('0x0'));module[_0x7100('0x1')]={'name':{'type':Sequelize[_0x7100('0x2')],'unique':_0x7100('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7100('0x4')]('rrmemory',_0x7100('0x5'),_0x7100('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf74=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xdf74,0x197));var _0x4df7=function(_0x5e75d8,_0x4f8b64){_0x5e75d8=_0x5e75d8-0x0;var _0x253560=_0xdf74[_0x5e75d8];return _0x253560;};'use strict';var Sequelize=require(_0x4df7('0x0'));module[_0x4df7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4df7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4df7('0x3')]},'timeout':{'type':Sequelize[_0x4df7('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4df7('0x5')](_0x4df7('0x6'),_0x4df7('0x7'),_0x4df7('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 77a08e0..1b042ea 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 _0x1302=['every','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','get','FaxQueues','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','FaxQueue','count','includeAll','include','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','User','select','field','tq.TeamId','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x1302,0x132));var _0x2130=function(_0x24f4d7,_0x3679ae){_0x24f4d7=_0x24f4d7-0x0;var _0x35b111=_0x1302[_0x24f4d7];return _0x35b111;};'use strict';var emlformat=require(_0x2130('0x0'));var rimraf=require(_0x2130('0x1'));var zipdir=require(_0x2130('0x2'));var jsonpatch=require(_0x2130('0x3'));var rp=require(_0x2130('0x4'));var moment=require(_0x2130('0x5'));var BPromise=require(_0x2130('0x6'));var Mustache=require(_0x2130('0x7'));var util=require(_0x2130('0x8'));var path=require(_0x2130('0x9'));var sox=require('sox');var csv=require(_0x2130('0xa'));var ejs=require(_0x2130('0xb'));var fs=require('fs');var fs_extra=require(_0x2130('0xc'));var _=require(_0x2130('0xd'));var squel=require(_0x2130('0xe'));var crypto=require('crypto');var jsforce=require(_0x2130('0xf'));var deskjs=require(_0x2130('0x10'));var toCsv=require(_0x2130('0xa'));var querystring=require(_0x2130('0x11'));var Papa=require(_0x2130('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2130('0x13'));var as=require(_0x2130('0x14'));var hardwareService=require(_0x2130('0x15'));var logger=require('../../config/logger')(_0x2130('0x16'));var utils=require(_0x2130('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2130('0x18'));var db=require(_0x2130('0x19'))['db'];config[_0x2130('0x1a')]=_[_0x2130('0x1b')](config['redis'],{'host':_0x2130('0x1c'),'port':0x18eb});var socket=require(_0x2130('0x1d'))(new Redis(config[_0x2130('0x1a')]));require(_0x2130('0x1e'))['register'](socket);function respondWithStatusCode(_0x372205,_0x21761b){_0x21761b=_0x21761b||0xcc;return function(_0x4ac460){if(_0x4ac460){return _0x372205['sendStatus'](_0x21761b);}return _0x372205[_0x2130('0x1f')](_0x21761b)[_0x2130('0x20')]();};}function respondWithResult(_0x2f8134,_0x56a2e7){_0x56a2e7=_0x56a2e7||0xc8;return function(_0xa64be3){if(_0xa64be3){return _0x2f8134[_0x2130('0x1f')](_0x56a2e7)[_0x2130('0x21')](_0xa64be3);}};}function respondWithFilteredResult(_0xa60d32,_0x45ffaf){return function(_0x4f3820){if(_0x4f3820){var _0x1e565c=typeof _0x45ffaf['offset']===_0x2130('0x22')&&typeof _0x45ffaf[_0x2130('0x23')]===_0x2130('0x22');var _0x22f5e7=_0x4f3820['count'];var _0x185fd0=_0x1e565c?0x0:_0x45ffaf[_0x2130('0x24')];var _0x193757=_0x1e565c?_0x4f3820['count']:_0x45ffaf[_0x2130('0x24')]+_0x45ffaf['limit'];var _0xb17a27;if(_0x193757>=_0x22f5e7){_0x193757=_0x22f5e7;_0xb17a27=0xc8;}else{_0xb17a27=0xce;}_0xa60d32[_0x2130('0x1f')](_0xb17a27);return _0xa60d32[_0x2130('0x25')](_0x2130('0x26'),_0x185fd0+'-'+_0x193757+'/'+_0x22f5e7)[_0x2130('0x21')](_0x4f3820);}return null;};}function patchUpdates(_0x2259fc){return function(_0x41aaaf){try{jsonpatch[_0x2130('0x27')](_0x41aaaf,_0x2259fc,!![]);}catch(_0x59a4e7){return BPromise[_0x2130('0x28')](_0x59a4e7);}return _0x41aaaf[_0x2130('0x29')]();};}function saveUpdates(_0x2220dd,_0x5d2568){return function(_0x144d37){if(_0x144d37){return _0x144d37[_0x2130('0x2a')](_0x2220dd)[_0x2130('0x2b')](function(_0x2b922c){return _0x2b922c;});}return null;};}function removeEntity(_0x4d1632,_0x7115b9){return function(_0x36b456){if(_0x36b456){return _0x36b456['destroy']()[_0x2130('0x2b')](function(){var _0x24e3fc=_0x36b456[_0x2130('0x2c')]({'plain':!![]});var _0x211b11=_0x2130('0x2d');return db['UserProfileResource'][_0x2130('0x2e')]({'where':{'type':_0x211b11,'resourceId':_0x24e3fc['id']}})[_0x2130('0x2b')](function(){return _0x36b456;});})['then'](function(){_0x4d1632[_0x2130('0x1f')](0xcc)[_0x2130('0x20')]();});}};}function handleEntityNotFound(_0x4032e7,_0x43e1cf){return function(_0x27bd95){if(!_0x27bd95){_0x4032e7[_0x2130('0x2f')](0x194);}return _0x27bd95;};}function handleError(_0x48e4e4,_0x10743e){_0x10743e=_0x10743e||0x1f4;return function(_0x4001b6){logger[_0x2130('0x30')](_0x4001b6[_0x2130('0x31')]);if(_0x4001b6[_0x2130('0x32')]){delete _0x4001b6[_0x2130('0x32')];}_0x48e4e4[_0x2130('0x1f')](_0x10743e)[_0x2130('0x33')](_0x4001b6);};}exports['index']=function(_0x457d7d,_0x253b45){var _0x2b0466={},_0x382354={},_0x1665b0={'count':0x0,'rows':[]};var _0x271bf5=_[_0x2130('0x34')](db['FaxQueue'][_0x2130('0x35')],function(_0xd6833b){return{'name':_0xd6833b[_0x2130('0x36')],'type':_0xd6833b[_0x2130('0x37')][_0x2130('0x38')]};});_0x382354[_0x2130('0x39')]=_[_0x2130('0x34')](_0x271bf5,_0x2130('0x32'));_0x382354[_0x2130('0x3a')]=_[_0x2130('0x3b')](_0x457d7d[_0x2130('0x3a')]);_0x382354['filters']=_[_0x2130('0x3c')](_0x382354[_0x2130('0x39')],_0x382354[_0x2130('0x3a')]);_0x2b0466['attributes']=_[_0x2130('0x3c')](_0x382354[_0x2130('0x39')],qs[_0x2130('0x3d')](_0x457d7d[_0x2130('0x3a')][_0x2130('0x3d')]));_0x2b0466[_0x2130('0x3e')]=_0x2b0466[_0x2130('0x3e')][_0x2130('0x3f')]?_0x2b0466['attributes']:_0x382354[_0x2130('0x39')];if(!_0x457d7d['query'][_0x2130('0x40')](_0x2130('0x41'))){_0x2b0466['limit']=qs[_0x2130('0x23')](_0x457d7d[_0x2130('0x3a')][_0x2130('0x23')]);_0x2b0466[_0x2130('0x24')]=qs[_0x2130('0x24')](_0x457d7d[_0x2130('0x3a')][_0x2130('0x24')]);}_0x2b0466[_0x2130('0x42')]=qs['sort'](_0x457d7d[_0x2130('0x3a')][_0x2130('0x43')]);_0x2b0466[_0x2130('0x44')]=qs[_0x2130('0x45')](_[_0x2130('0x46')](_0x457d7d[_0x2130('0x3a')],_0x382354[_0x2130('0x45')]),_0x271bf5);if(_0x457d7d['query']['filter']){_0x2b0466['where']=_[_0x2130('0x47')](_0x2b0466[_0x2130('0x44')],{'$or':_[_0x2130('0x34')](_0x271bf5,function(_0x2e2e72){if(_0x2e2e72[_0x2130('0x37')]!==_0x2130('0x48')){var _0x53c693={};_0x53c693[_0x2e2e72['name']]={'$like':'%'+_0x457d7d[_0x2130('0x3a')][_0x2130('0x49')]+'%'};return _0x53c693;}})});}_0x2b0466=_[_0x2130('0x47')]({},_0x2b0466,_0x457d7d[_0x2130('0x4a')]);var _0x546c1a={'where':_0x2b0466[_0x2130('0x44')]};return db[_0x2130('0x4b')][_0x2130('0x4c')](_0x546c1a)[_0x2130('0x2b')](function(_0x53b4e6){_0x1665b0[_0x2130('0x4c')]=_0x53b4e6;if(_0x457d7d[_0x2130('0x3a')][_0x2130('0x4d')]){_0x2b0466[_0x2130('0x4e')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x2b0466);})[_0x2130('0x2b')](function(_0x513558){_0x1665b0['rows']=_0x513558;return _0x1665b0;})['then'](respondWithFilteredResult(_0x253b45,_0x2b0466))['catch'](handleError(_0x253b45,null));};exports[_0x2130('0x4f')]=function(_0x57c887,_0x38a87a){var _0x3498e9={'raw':!![],'where':{'id':_0x57c887[_0x2130('0x50')]['id']}},_0x59ccde={};_0x59ccde[_0x2130('0x39')]=_[_0x2130('0x3b')](db[_0x2130('0x4b')][_0x2130('0x35')]);_0x59ccde[_0x2130('0x3a')]=_['keys'](_0x57c887[_0x2130('0x3a')]);_0x59ccde[_0x2130('0x45')]=_['intersection'](_0x59ccde['model'],_0x59ccde[_0x2130('0x3a')]);_0x3498e9['attributes']=_[_0x2130('0x3c')](_0x59ccde[_0x2130('0x39')],qs[_0x2130('0x3d')](_0x57c887[_0x2130('0x3a')][_0x2130('0x3d')]));_0x3498e9[_0x2130('0x3e')]=_0x3498e9[_0x2130('0x3e')]['length']?_0x3498e9[_0x2130('0x3e')]:_0x59ccde[_0x2130('0x39')];if(_0x57c887['query']['includeAll']){_0x3498e9[_0x2130('0x4e')]=[{'all':!![]}];}_0x3498e9=_[_0x2130('0x47')]({},_0x3498e9,_0x57c887[_0x2130('0x4a')]);return db['FaxQueue'][_0x2130('0x51')](_0x3498e9)[_0x2130('0x2b')](handleEntityNotFound(_0x38a87a,null))['then'](respondWithResult(_0x38a87a,null))[_0x2130('0x52')](handleError(_0x38a87a,null));};exports[_0x2130('0x53')]=function(_0x1db5ac,_0x4ae9d4){return db[_0x2130('0x4b')][_0x2130('0x53')](_0x1db5ac[_0x2130('0x54')],{})[_0x2130('0x2b')](function(_0x17c100){var _0x128339=_0x1db5ac[_0x2130('0x55')][_0x2130('0x2c')]({'plain':!![]});if(!_0x128339)throw new Error(_0x2130('0x56'));if(_0x128339[_0x2130('0x57')]===_0x2130('0x55')){var _0x149993=_0x17c100[_0x2130('0x2c')]({'plain':!![]});var _0x4254a3=_0x2130('0x2d');return db[_0x2130('0x58')][_0x2130('0x51')]({'where':{'name':_0x4254a3,'userProfileId':_0x128339[_0x2130('0x59')]},'raw':!![]})['then'](function(_0x35ac34){if(_0x35ac34&&_0x35ac34['autoAssociation']===0x0){return db['UserProfileResource'][_0x2130('0x53')]({'name':_0x149993[_0x2130('0x32')],'resourceId':_0x149993['id'],'type':_0x35ac34[_0x2130('0x32')],'sectionId':_0x35ac34['id']},{})[_0x2130('0x2b')](function(){return _0x17c100;});}else{return _0x17c100;}})[_0x2130('0x52')](function(_0x13f3fc){logger[_0x2130('0x30')](_0x2130('0x5a'),_0x13f3fc);throw _0x13f3fc;});}return _0x17c100;})[_0x2130('0x2b')](respondWithResult(_0x4ae9d4,0xc9))[_0x2130('0x52')](handleError(_0x4ae9d4,null));};exports[_0x2130('0x2a')]=function(_0x3bc528,_0x4cf04f){if(_0x3bc528[_0x2130('0x54')]['id']){delete _0x3bc528[_0x2130('0x54')]['id'];}return db[_0x2130('0x4b')][_0x2130('0x51')]({'where':{'id':_0x3bc528[_0x2130('0x50')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x4cf04f,null))['then'](saveUpdates(_0x3bc528[_0x2130('0x54')],null))[_0x2130('0x2b')](respondWithResult(_0x4cf04f,null))[_0x2130('0x52')](handleError(_0x4cf04f,null));};exports[_0x2130('0x2e')]=function(_0x564af7,_0x410b1d){return db['FaxQueue']['find']({'where':{'id':_0x564af7['params']['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x410b1d,null))[_0x2130('0x2b')](removeEntity(_0x410b1d,null))[_0x2130('0x52')](handleError(_0x410b1d,null));};exports['describe']=function(_0x5a3c3b,_0x44258d){return db[_0x2130('0x4b')][_0x2130('0x5b')]()[_0x2130('0x2b')](respondWithResult(_0x44258d,null))['catch'](handleError(_0x44258d,null));};exports[_0x2130('0x5c')]=function(_0x9f8568,_0x410ba6,_0x3472b3){var _0x4c3a82={'raw':!![],'where':{}},_0xc4c6e9={},_0x2b51d6;return db[_0x2130('0x4b')][_0x2130('0x5d')]({'where':{'id':_0x9f8568[_0x2130('0x50')]['id']}})['then'](handleEntityNotFound(_0x410ba6,null))[_0x2130('0x2b')](function(_0x147314){if(_0x147314){_0x2b51d6=_0x147314[_0x2130('0x2c')]({'plain':!![]});_0xc4c6e9[_0x2130('0x39')]=_[_0x2130('0x3b')](db[_0x2130('0x5e')]['rawAttributes']);_0xc4c6e9[_0x2130('0x3a')]=_['keys'](_0x9f8568[_0x2130('0x3a')]);_0xc4c6e9[_0x2130('0x45')]=_[_0x2130('0x3c')](_0xc4c6e9['model'],_0xc4c6e9[_0x2130('0x3a')]);_0x4c3a82[_0x2130('0x3e')]=_['intersection'](_0xc4c6e9[_0x2130('0x39')],qs['fields'](_0x9f8568['query'][_0x2130('0x3d')]));_0x4c3a82[_0x2130('0x3e')]=_0x4c3a82['attributes'][_0x2130('0x3f')]?_0x4c3a82[_0x2130('0x3e')]:_0xc4c6e9[_0x2130('0x39')];if(!_0x9f8568[_0x2130('0x3a')][_0x2130('0x40')](_0x2130('0x41'))){_0x4c3a82[_0x2130('0x23')]=qs['limit'](_0x9f8568['query'][_0x2130('0x23')]);_0x4c3a82['offset']=qs['offset'](_0x9f8568[_0x2130('0x3a')][_0x2130('0x24')]);}_0x4c3a82['order']=qs[_0x2130('0x43')](_0x9f8568[_0x2130('0x3a')][_0x2130('0x43')]);_0x4c3a82[_0x2130('0x44')]=qs[_0x2130('0x45')](_[_0x2130('0x46')](_0x9f8568[_0x2130('0x3a')],_0xc4c6e9[_0x2130('0x45')]));_0x4c3a82[_0x2130('0x44')][_0x2130('0x5f')]=_0x147314['id'];if(_0x9f8568[_0x2130('0x3a')][_0x2130('0x49')]){_0x4c3a82['where']=_[_0x2130('0x47')](_0x4c3a82['where'],{'$or':_[_0x2130('0x34')](_0x4c3a82[_0x2130('0x3e')],function(_0x4e9a43){var _0x3ed415={};_0x3ed415[_0x4e9a43]={'$like':'%'+_0x9f8568[_0x2130('0x3a')][_0x2130('0x49')]+'%'};return _0x3ed415;})});}_0x4c3a82=_[_0x2130('0x47')]({},_0x4c3a82,_0x9f8568[_0x2130('0x4a')]);return db['UserFaxQueue'][_0x2130('0x60')](_0x4c3a82);}})[_0x2130('0x2b')](function(_0x1aa533){if(_0x1aa533){return db['User']['findAndCountAll']({'where':{'id':_[_0x2130('0x34')](_0x1aa533,_0x2130('0x61')),'role':_0x2130('0x62')},'attributes':['id',_0x2130('0x32'),_0x2130('0x63'),_0x2130('0x64'),_0x2130('0x65')]});}})[_0x2130('0x2b')](function(_0x2d6440){if(_0x2d6440){return{'count':_0x2d6440[_0x2130('0x4c')],'rows':_[_0x2130('0x34')](_0x2d6440[_0x2130('0x66')],function(_0x325207){return{'membername':_0x325207[_0x2130('0x32')],'UserId':_0x325207['id'],'queue_name':_0x2b51d6[_0x2130('0x32')],'FaxQueueId':_0x2b51d6['id'],'interface':util[_0x2130('0x67')](_0x2130('0x68'),_0x2130('0x69'),_0x325207['name']),'penalty':0x0,'paused':_0x325207['faxPause'],'createdAt':_0x325207['createdAt'],'updatedAt':_0x325207['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2130('0x2b')](respondWithFilteredResult(_0x410ba6,_0x4c3a82))['catch'](handleError(_0x410ba6,null));};exports['getTeams']=function(_0x57b645,_0x31c6e8,_0xe9be30){var _0x5dd25a={};var _0x4ec120={};var _0x1c5e0b;var _0x275b3c;return db[_0x2130('0x4b')][_0x2130('0x5d')]({'where':{'id':_0x57b645[_0x2130('0x50')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x31c6e8,null))[_0x2130('0x2b')](function(_0x5a85bf){if(_0x5a85bf){_0x1c5e0b=_0x5a85bf;_0x4ec120[_0x2130('0x39')]=_['keys'](db[_0x2130('0x6a')][_0x2130('0x35')]);_0x4ec120[_0x2130('0x3a')]=_[_0x2130('0x3b')](_0x57b645[_0x2130('0x3a')]);_0x4ec120[_0x2130('0x45')]=_['intersection'](_0x4ec120[_0x2130('0x39')],_0x4ec120[_0x2130('0x3a')]);_0x5dd25a['attributes']=_[_0x2130('0x3c')](_0x4ec120[_0x2130('0x39')],qs['fields'](_0x57b645[_0x2130('0x3a')][_0x2130('0x3d')]));_0x5dd25a[_0x2130('0x3e')]=_0x5dd25a[_0x2130('0x3e')]['length']?_0x5dd25a[_0x2130('0x3e')]:_0x4ec120[_0x2130('0x39')];_0x5dd25a['order']=qs[_0x2130('0x43')](_0x57b645[_0x2130('0x3a')][_0x2130('0x43')]);_0x5dd25a[_0x2130('0x44')]=qs[_0x2130('0x45')](_['pick'](_0x57b645[_0x2130('0x3a')],_0x4ec120[_0x2130('0x45')]));if(_0x57b645[_0x2130('0x3a')][_0x2130('0x49')]){_0x5dd25a[_0x2130('0x44')]=_[_0x2130('0x47')](_0x5dd25a[_0x2130('0x44')],{'$or':_[_0x2130('0x34')](_0x5dd25a[_0x2130('0x3e')],function(_0x395e82){var _0x131b3f={};_0x131b3f[_0x395e82]={'$like':'%'+_0x57b645[_0x2130('0x3a')][_0x2130('0x49')]+'%'};return _0x131b3f;})});}_0x5dd25a=_['merge']({},_0x5dd25a,_0x57b645[_0x2130('0x4a')]);return _0x1c5e0b[_0x2130('0x6b')](_0x5dd25a);}})[_0x2130('0x2b')](function(_0x3f1d6a){if(_0x3f1d6a){_0x275b3c=_0x3f1d6a[_0x2130('0x3f')];if(!_0x57b645['query'][_0x2130('0x40')]('nolimit')){_0x5dd25a[_0x2130('0x23')]=qs[_0x2130('0x23')](_0x57b645[_0x2130('0x3a')][_0x2130('0x23')]);_0x5dd25a[_0x2130('0x24')]=qs[_0x2130('0x24')](_0x57b645[_0x2130('0x3a')][_0x2130('0x24')]);}return _0x1c5e0b[_0x2130('0x6b')](_0x5dd25a);}})[_0x2130('0x2b')](function(_0x46b7af){if(_0x46b7af){return _0x46b7af?{'count':_0x275b3c,'rows':_0x46b7af}:null;}})['then'](respondWithResult(_0x31c6e8,null))[_0x2130('0x52')](handleError(_0x31c6e8,null));};exports[_0x2130('0x6c')]=function(_0x14d574,_0x4c0152,_0x34bdfa){var _0x2a2fca=_0x14d574[_0x2130('0x54')][_0x2130('0x6d')];return db[_0x2130('0x6a')][_0x2130('0x60')]({'where':{'id':_0x2a2fca},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2130('0x6e'),'attributes':['id',_0x2130('0x32'),_0x2130('0x6f'),'voicePause',_0x2130('0x70')],'raw':!![]}]})[_0x2130('0x2b')](function(_0x3dc284){if(_0x3dc284){var _0x562e1f=_[_0x2130('0x71')](_0x3dc284,function(_0x24fdee){var _0x35fb4d=_0x24fdee['get']({'plain':!![]});return _0x35fb4d[_0x2130('0x6e')];});return db['FaxQueue'][_0x2130('0x51')]({'where':{'id':_0x14d574[_0x2130('0x50')]['id']}})[_0x2130('0x2b')](function(_0x506d2a){return db[_0x2130('0x72')][_0x2130('0x73')](function(_0x5732fa){return _0x506d2a['addTeams'](_0x2a2fca,{'transaction':_0x5732fa})['then'](function(){return BPromise[_0x2130('0x74')](_0x562e1f,function(_0x4b4205){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x4b4205['id'],'FaxQueueId':_0x14d574[_0x2130('0x50')]['id']},'transaction':_0x5732fa});});})[_0x2130('0x2b')](function(){_0x562e1f[_0x2130('0x75')](function(_0x388a79){socket[_0x2130('0x76')](_0x2130('0x77'),{'UserId':_0x388a79['id'],'FaxQueueId':_0x506d2a['id']});});});});});}})['then'](respondWithStatusCode(_0x4c0152,null))[_0x2130('0x52')](handleError(_0x4c0152,null));};exports['removeTeams']=function(_0xb55d51,_0x118098,_0x344c8c){return db[_0x2130('0x6a')][_0x2130('0x60')]({'where':{'id':_0xb55d51['query'][_0x2130('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x2130('0x78')],'as':_0x2130('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x2130('0x2b')](handleEntityNotFound(_0x118098,null))['then'](function(_0x2316f9){var _0x460dd0=_['map'](_0x2316f9,'id');var _0x437d30=[];var _0x45b850=[];var _0x492444=squel[_0x2130('0x79')]();_0x492444[_0x2130('0x7a')](_0x2130('0x7b'))['from'](_0x2130('0x7c'),'tq')[_0x2130('0x7d')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2130('0x44')](_0x2130('0x7e'),_0xb55d51[_0x2130('0x50')]['id']);for(var _0x4b1704=0x0;_0x4b1704<_0x2316f9[_0x2130('0x3f')];_0x4b1704+=0x1){let _0x505f7c=_0x2316f9[_0x4b1704];for(var _0x2cc918=0x0;_0x2cc918<_0x505f7c[_0x2130('0x6e')]['length'];_0x2cc918+=0x1){let _0x3edc9c=_0x505f7c[_0x2130('0x6e')][_0x2cc918];var _0x207b18=_0x492444[_0x2130('0x7f')]();_0x207b18[_0x2130('0x44')](_0x2130('0x80'),_0x3edc9c['id']);_0x45b850[_0x2130('0x81')](db[_0x2130('0x72')][_0x2130('0x3a')](_0x207b18[_0x2130('0x82')](),{'type':db[_0x2130('0x72')][_0x2130('0x83')]['SELECT']})[_0x2130('0x2b')](function(_0x32e71b){if(_0x32e71b[_0x2130('0x3f')]===0x1){return _0x3edc9c['id'];}else{var _0x5ec53b=_[_0x2130('0x84')](_[_0x2130('0x34')](_0x32e71b,'TeamId'),function(_0x14de3e){return _[_0x2130('0x85')](_0x460dd0,_0x14de3e);});if(_0x5ec53b){return _0x3edc9c['id'];}}}));}}return BPromise[_0x2130('0x86')](_0x45b850)['then'](function(_0xbb41a0){_0x437d30=_(_0x437d30)[_0x2130('0x87')](_0xbb41a0)[_0x2130('0x88')]()[_0x2130('0x89')]();return db[_0x2130('0x4b')][_0x2130('0x51')]({'where':{'id':_0xb55d51[_0x2130('0x50')]['id']}})[_0x2130('0x2b')](function(_0xf53641){return db['sequelize'][_0x2130('0x73')](function(_0x1843dd){return _0xf53641['removeTeams'](_0xb55d51[_0x2130('0x3a')][_0x2130('0x6d')],{'transaction':_0x1843dd})[_0x2130('0x2b')](function(){if(!_[_0x2130('0x8a')](_0x437d30)){return _0xf53641[_0x2130('0x8b')](_0x437d30,{'transaction':_0x1843dd});}})[_0x2130('0x2b')](function(){_0x437d30['forEach'](function(_0x1a61d0){socket[_0x2130('0x76')](_0x2130('0x8c'),{'UserId':_0x1a61d0,'FaxQueueId':_0xf53641['id']});});});});});});})[_0x2130('0x2b')](respondWithStatusCode(_0x118098,null))['catch'](handleError(_0x118098,null));};exports[_0x2130('0x8d')]=function(_0x14b765,_0x130828,_0x4850a7){return db[_0x2130('0x4b')][_0x2130('0x51')]({'where':{'id':_0x14b765[_0x2130('0x50')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x130828,null))['then'](function(_0x458767){if(_0x458767){return _0x458767['addAgents'](_0x14b765[_0x2130('0x54')][_0x2130('0x6d')],_[_0x2130('0x8e')](_0x14b765[_0x2130('0x54')],[_0x2130('0x6d'),'id'])||{})[_0x2130('0x8f')](function(_0x4eb485){for(var _0x9524c5=0x0;_0x9524c5<_0x14b765[_0x2130('0x54')]['ids'][_0x2130('0x3f')];_0x9524c5+=0x1){socket[_0x2130('0x76')](_0x2130('0x77'),{'UserId':Number(_0x14b765[_0x2130('0x54')]['ids'][_0x9524c5]),'FaxQueueId':Number(_0x14b765['params']['id'])});}return _0x4eb485;});}})[_0x2130('0x2b')](respondWithResult(_0x130828,null))[_0x2130('0x52')](handleError(_0x130828,null));};exports[_0x2130('0x8b')]=function(_0x3fa433,_0x5b08c2,_0x192ff8){return db[_0x2130('0x4b')][_0x2130('0x51')]({'where':{'id':_0x3fa433[_0x2130('0x50')]['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x5b08c2,null))[_0x2130('0x2b')](function(_0x1ff290){if(_0x1ff290){return _0x1ff290[_0x2130('0x8b')](_0x3fa433['query'][_0x2130('0x6d')])['then'](function(){if(_[_0x2130('0x90')](_0x3fa433[_0x2130('0x3a')]['ids'])){for(var _0x4f0446=0x0;_0x4f0446<_0x3fa433[_0x2130('0x3a')][_0x2130('0x6d')][_0x2130('0x3f')];_0x4f0446+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3fa433[_0x2130('0x3a')]['ids'][_0x4f0446]),'FaxQueueId':Number(_0x3fa433['params']['id'])});}}else{socket['emit'](_0x2130('0x8c'),{'UserId':Number(_0x3fa433[_0x2130('0x3a')][_0x2130('0x6d')]),'FaxQueueId':Number(_0x3fa433[_0x2130('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x5b08c2,null))[_0x2130('0x52')](handleError(_0x5b08c2,null));};exports[_0x2130('0x91')]=function(_0x131e49,_0x3508b6,_0x512356){var _0x3f2d1e={};var _0x4ecaab={};var _0x3db3ce;var _0x60becb;return db[_0x2130('0x4b')]['findOne']({'where':{'id':_0x131e49['params']['id']}})[_0x2130('0x2b')](handleEntityNotFound(_0x3508b6,null))[_0x2130('0x2b')](function(_0x2b40bb){if(_0x2b40bb){_0x3db3ce=_0x2b40bb;_0x4ecaab[_0x2130('0x39')]=_[_0x2130('0x3b')](db[_0x2130('0x78')]['rawAttributes']);_0x4ecaab['query']=_[_0x2130('0x3b')](_0x131e49[_0x2130('0x3a')]);_0x4ecaab[_0x2130('0x45')]=_['intersection'](_0x4ecaab[_0x2130('0x39')],_0x4ecaab[_0x2130('0x3a')]);_0x3f2d1e[_0x2130('0x3e')]=_[_0x2130('0x3c')](_0x4ecaab[_0x2130('0x39')],qs['fields'](_0x131e49['query'][_0x2130('0x3d')]));_0x3f2d1e[_0x2130('0x3e')]=_0x3f2d1e[_0x2130('0x3e')][_0x2130('0x3f')]?_0x3f2d1e[_0x2130('0x3e')]:_0x4ecaab[_0x2130('0x39')];_0x3f2d1e[_0x2130('0x42')]=qs[_0x2130('0x43')](_0x131e49['query'][_0x2130('0x43')]);_0x3f2d1e['where']=qs[_0x2130('0x45')](_[_0x2130('0x46')](_0x131e49[_0x2130('0x3a')],_0x4ecaab[_0x2130('0x45')]));if(_0x131e49['query']['filter']){_0x3f2d1e[_0x2130('0x44')]=_[_0x2130('0x47')](_0x3f2d1e[_0x2130('0x44')],{'$or':_['map'](_0x3f2d1e[_0x2130('0x3e')],function(_0x41ca12){var _0x293a01={};_0x293a01[_0x41ca12]={'$like':'%'+_0x131e49[_0x2130('0x3a')][_0x2130('0x49')]+'%'};return _0x293a01;})});}_0x3f2d1e=_['merge']({},_0x3f2d1e,_0x131e49[_0x2130('0x4a')]);return _0x3db3ce[_0x2130('0x91')](_0x3f2d1e);}})[_0x2130('0x2b')](function(_0x26a55b){if(_0x26a55b){_0x60becb=_0x26a55b['length'];if(!_0x131e49['query'][_0x2130('0x40')](_0x2130('0x41'))){_0x3f2d1e[_0x2130('0x23')]=qs['limit'](_0x131e49[_0x2130('0x3a')][_0x2130('0x23')]);_0x3f2d1e[_0x2130('0x24')]=qs[_0x2130('0x24')](_0x131e49[_0x2130('0x3a')][_0x2130('0x24')]);}return _0x3db3ce[_0x2130('0x91')](_0x3f2d1e);}})[_0x2130('0x2b')](function(_0x3f1c42){if(_0x3f1c42){return _0x3f1c42?{'count':_0x60becb,'rows':_0x3f1c42}:null;}})[_0x2130('0x2b')](respondWithResult(_0x3508b6,null))[_0x2130('0x52')](handleError(_0x3508b6,null));}; \ No newline at end of file +var _0xf6f3=['omit','spread','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','agent','faxPause','createdAt','format','SIP','updatedAt','getTeams','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','Team','select','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','removeAgents','addAgents'];(function(_0x2453d0,_0x1b2017){var _0x521fc8=function(_0xfc824f){while(--_0xfc824f){_0x2453d0['push'](_0x2453d0['shift']());}};_0x521fc8(++_0x1b2017);}(_0xf6f3,0x1ae));var _0x3f6f=function(_0x20cd08,_0x405a30){_0x20cd08=_0x20cd08-0x0;var _0x83b9b0=_0xf6f3[_0x20cd08];return _0x83b9b0;};'use strict';var emlformat=require(_0x3f6f('0x0'));var rimraf=require(_0x3f6f('0x1'));var zipdir=require(_0x3f6f('0x2'));var jsonpatch=require(_0x3f6f('0x3'));var rp=require(_0x3f6f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3f6f('0x5'));var path=require(_0x3f6f('0x6'));var sox=require(_0x3f6f('0x7'));var csv=require(_0x3f6f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f6f('0x9'));var squel=require('squel');var crypto=require(_0x3f6f('0xa'));var jsforce=require(_0x3f6f('0xb'));var deskjs=require(_0x3f6f('0xc'));var toCsv=require(_0x3f6f('0x8'));var querystring=require(_0x3f6f('0xd'));var Papa=require(_0x3f6f('0xe'));var Redis=require(_0x3f6f('0xf'));var authService=require(_0x3f6f('0x10'));var qs=require(_0x3f6f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f6f('0x12'));var logger=require(_0x3f6f('0x13'))(_0x3f6f('0x14'));var utils=require(_0x3f6f('0x15'));var config=require(_0x3f6f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3f6f('0x17')]=_[_0x3f6f('0x18')](config['redis'],{'host':_0x3f6f('0x19'),'port':0x18eb});var socket=require(_0x3f6f('0x1a'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x3f6f('0x1b')](socket);function respondWithStatusCode(_0x17c70f,_0x34a738){_0x34a738=_0x34a738||0xcc;return function(_0x1367c2){if(_0x1367c2){return _0x17c70f[_0x3f6f('0x1c')](_0x34a738);}return _0x17c70f[_0x3f6f('0x1d')](_0x34a738)[_0x3f6f('0x1e')]();};}function respondWithResult(_0x3d2db2,_0x1eab60){_0x1eab60=_0x1eab60||0xc8;return function(_0x10bba4){if(_0x10bba4){return _0x3d2db2[_0x3f6f('0x1d')](_0x1eab60)['json'](_0x10bba4);}};}function respondWithFilteredResult(_0x1c66d1,_0x44e5c3){return function(_0x3783ab){if(_0x3783ab){var _0xfc1d70=typeof _0x44e5c3['offset']==='undefined'&&typeof _0x44e5c3['limit']===_0x3f6f('0x1f');var _0x1d140a=_0x3783ab[_0x3f6f('0x20')];var _0x4cab90=_0xfc1d70?0x0:_0x44e5c3[_0x3f6f('0x21')];var _0x2db84c=_0xfc1d70?_0x3783ab['count']:_0x44e5c3['offset']+_0x44e5c3[_0x3f6f('0x22')];var _0x44ff9f;if(_0x2db84c>=_0x1d140a){_0x2db84c=_0x1d140a;_0x44ff9f=0xc8;}else{_0x44ff9f=0xce;}_0x1c66d1[_0x3f6f('0x1d')](_0x44ff9f);return _0x1c66d1[_0x3f6f('0x23')]('Content-Range',_0x4cab90+'-'+_0x2db84c+'/'+_0x1d140a)[_0x3f6f('0x24')](_0x3783ab);}return null;};}function patchUpdates(_0x2e7fa7){return function(_0x197064){try{jsonpatch[_0x3f6f('0x25')](_0x197064,_0x2e7fa7,!![]);}catch(_0x48042d){return BPromise[_0x3f6f('0x26')](_0x48042d);}return _0x197064[_0x3f6f('0x27')]();};}function saveUpdates(_0x2b3615,_0x215e05){return function(_0x1d542f){if(_0x1d542f){return _0x1d542f['update'](_0x2b3615)['then'](function(_0x26da6e){return _0x26da6e;});}return null;};}function removeEntity(_0x561444,_0x41badb){return function(_0x5c44b3){if(_0x5c44b3){return _0x5c44b3[_0x3f6f('0x28')]()[_0x3f6f('0x29')](function(){var _0x594355=_0x5c44b3[_0x3f6f('0x2a')]({'plain':!![]});var _0x481d7c='FaxQueues';return db[_0x3f6f('0x2b')]['destroy']({'where':{'type':_0x481d7c,'resourceId':_0x594355['id']}})[_0x3f6f('0x29')](function(){return _0x5c44b3;});})[_0x3f6f('0x29')](function(){_0x561444[_0x3f6f('0x1d')](0xcc)[_0x3f6f('0x1e')]();});}};}function handleEntityNotFound(_0x1a98ea,_0x26213a){return function(_0x1d74e1){if(!_0x1d74e1){_0x1a98ea['sendStatus'](0x194);}return _0x1d74e1;};}function handleError(_0x154a42,_0x310efd){_0x310efd=_0x310efd||0x1f4;return function(_0x1b3bb9){logger[_0x3f6f('0x2c')](_0x1b3bb9[_0x3f6f('0x2d')]);if(_0x1b3bb9['name']){delete _0x1b3bb9['name'];}_0x154a42[_0x3f6f('0x1d')](_0x310efd)[_0x3f6f('0x2e')](_0x1b3bb9);};}exports[_0x3f6f('0x2f')]=function(_0x3cbcb3,_0x45e77a){var _0x9ed076={},_0x232da8={},_0x162d41={'count':0x0,'rows':[]};var _0x3e07b2=_['map'](db[_0x3f6f('0x30')][_0x3f6f('0x31')],function(_0x53d4b1){return{'name':_0x53d4b1[_0x3f6f('0x32')],'type':_0x53d4b1[_0x3f6f('0x33')][_0x3f6f('0x34')]};});_0x232da8[_0x3f6f('0x35')]=_[_0x3f6f('0x36')](_0x3e07b2,_0x3f6f('0x37'));_0x232da8[_0x3f6f('0x38')]=_[_0x3f6f('0x39')](_0x3cbcb3[_0x3f6f('0x38')]);_0x232da8[_0x3f6f('0x3a')]=_[_0x3f6f('0x3b')](_0x232da8[_0x3f6f('0x35')],_0x232da8[_0x3f6f('0x38')]);_0x9ed076[_0x3f6f('0x3c')]=_[_0x3f6f('0x3b')](_0x232da8[_0x3f6f('0x35')],qs[_0x3f6f('0x3d')](_0x3cbcb3[_0x3f6f('0x38')][_0x3f6f('0x3d')]));_0x9ed076[_0x3f6f('0x3c')]=_0x9ed076[_0x3f6f('0x3c')]['length']?_0x9ed076[_0x3f6f('0x3c')]:_0x232da8[_0x3f6f('0x35')];if(!_0x3cbcb3[_0x3f6f('0x38')][_0x3f6f('0x3e')](_0x3f6f('0x3f'))){_0x9ed076[_0x3f6f('0x22')]=qs[_0x3f6f('0x22')](_0x3cbcb3[_0x3f6f('0x38')]['limit']);_0x9ed076[_0x3f6f('0x21')]=qs[_0x3f6f('0x21')](_0x3cbcb3[_0x3f6f('0x38')][_0x3f6f('0x21')]);}_0x9ed076['order']=qs[_0x3f6f('0x40')](_0x3cbcb3[_0x3f6f('0x38')][_0x3f6f('0x40')]);_0x9ed076['where']=qs[_0x3f6f('0x3a')](_[_0x3f6f('0x41')](_0x3cbcb3[_0x3f6f('0x38')],_0x232da8[_0x3f6f('0x3a')]),_0x3e07b2);if(_0x3cbcb3[_0x3f6f('0x38')][_0x3f6f('0x42')]){_0x9ed076[_0x3f6f('0x43')]=_[_0x3f6f('0x44')](_0x9ed076['where'],{'$or':_[_0x3f6f('0x36')](_0x3e07b2,function(_0x94e08f){if(_0x94e08f['type']!==_0x3f6f('0x45')){var _0xcc018={};_0xcc018[_0x94e08f['name']]={'$like':'%'+_0x3cbcb3[_0x3f6f('0x38')][_0x3f6f('0x42')]+'%'};return _0xcc018;}})});}_0x9ed076=_[_0x3f6f('0x44')]({},_0x9ed076,_0x3cbcb3[_0x3f6f('0x46')]);var _0x4961bb={'where':_0x9ed076[_0x3f6f('0x43')]};return db[_0x3f6f('0x30')][_0x3f6f('0x20')](_0x4961bb)['then'](function(_0x37d7d0){_0x162d41[_0x3f6f('0x20')]=_0x37d7d0;if(_0x3cbcb3[_0x3f6f('0x38')][_0x3f6f('0x47')]){_0x9ed076[_0x3f6f('0x48')]=[{'all':!![]}];}return db[_0x3f6f('0x30')][_0x3f6f('0x49')](_0x9ed076);})[_0x3f6f('0x29')](function(_0x5778e2){_0x162d41[_0x3f6f('0x4a')]=_0x5778e2;return _0x162d41;})[_0x3f6f('0x29')](respondWithFilteredResult(_0x45e77a,_0x9ed076))[_0x3f6f('0x4b')](handleError(_0x45e77a,null));};exports[_0x3f6f('0x4c')]=function(_0x1ec713,_0x8317e0){var _0x33d280={'raw':!![],'where':{'id':_0x1ec713[_0x3f6f('0x4d')]['id']}},_0x198661={};_0x198661[_0x3f6f('0x35')]=_[_0x3f6f('0x39')](db[_0x3f6f('0x30')][_0x3f6f('0x31')]);_0x198661['query']=_[_0x3f6f('0x39')](_0x1ec713[_0x3f6f('0x38')]);_0x198661[_0x3f6f('0x3a')]=_[_0x3f6f('0x3b')](_0x198661[_0x3f6f('0x35')],_0x198661[_0x3f6f('0x38')]);_0x33d280[_0x3f6f('0x3c')]=_[_0x3f6f('0x3b')](_0x198661[_0x3f6f('0x35')],qs[_0x3f6f('0x3d')](_0x1ec713[_0x3f6f('0x38')][_0x3f6f('0x3d')]));_0x33d280[_0x3f6f('0x3c')]=_0x33d280['attributes'][_0x3f6f('0x4e')]?_0x33d280[_0x3f6f('0x3c')]:_0x198661[_0x3f6f('0x35')];if(_0x1ec713[_0x3f6f('0x38')][_0x3f6f('0x47')]){_0x33d280['include']=[{'all':!![]}];}_0x33d280=_[_0x3f6f('0x44')]({},_0x33d280,_0x1ec713['options']);return db[_0x3f6f('0x30')][_0x3f6f('0x4f')](_0x33d280)[_0x3f6f('0x29')](handleEntityNotFound(_0x8317e0,null))[_0x3f6f('0x29')](respondWithResult(_0x8317e0,null))['catch'](handleError(_0x8317e0,null));};exports[_0x3f6f('0x50')]=function(_0x1337b6,_0x29c1e3){return db[_0x3f6f('0x30')]['create'](_0x1337b6[_0x3f6f('0x51')],{})[_0x3f6f('0x29')](function(_0x541bfe){var _0x4962eb=_0x1337b6[_0x3f6f('0x52')]['get']({'plain':!![]});if(!_0x4962eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4962eb[_0x3f6f('0x53')]===_0x3f6f('0x52')){var _0x2fa488=_0x541bfe[_0x3f6f('0x2a')]({'plain':!![]});var _0x2f51e6='FaxQueues';return db['UserProfileSection'][_0x3f6f('0x4f')]({'where':{'name':_0x2f51e6,'userProfileId':_0x4962eb[_0x3f6f('0x54')]},'raw':!![]})[_0x3f6f('0x29')](function(_0x14ef34){if(_0x14ef34&&_0x14ef34[_0x3f6f('0x55')]===0x0){return db[_0x3f6f('0x2b')][_0x3f6f('0x50')]({'name':_0x2fa488[_0x3f6f('0x37')],'resourceId':_0x2fa488['id'],'type':_0x14ef34[_0x3f6f('0x37')],'sectionId':_0x14ef34['id']},{})[_0x3f6f('0x29')](function(){return _0x541bfe;});}else{return _0x541bfe;}})[_0x3f6f('0x4b')](function(_0x496ff3){logger['error'](_0x3f6f('0x56'),_0x496ff3);throw _0x496ff3;});}return _0x541bfe;})['then'](respondWithResult(_0x29c1e3,0xc9))[_0x3f6f('0x4b')](handleError(_0x29c1e3,null));};exports[_0x3f6f('0x57')]=function(_0x557de6,_0x424170){if(_0x557de6[_0x3f6f('0x51')]['id']){delete _0x557de6[_0x3f6f('0x51')]['id'];}return db[_0x3f6f('0x30')][_0x3f6f('0x4f')]({'where':{'id':_0x557de6['params']['id']}})['then'](handleEntityNotFound(_0x424170,null))[_0x3f6f('0x29')](saveUpdates(_0x557de6[_0x3f6f('0x51')],null))[_0x3f6f('0x29')](respondWithResult(_0x424170,null))['catch'](handleError(_0x424170,null));};exports['destroy']=function(_0x1098e5,_0x2ccfd7){return db['FaxQueue'][_0x3f6f('0x4f')]({'where':{'id':_0x1098e5[_0x3f6f('0x4d')]['id']}})[_0x3f6f('0x29')](handleEntityNotFound(_0x2ccfd7,null))[_0x3f6f('0x29')](removeEntity(_0x2ccfd7,null))[_0x3f6f('0x4b')](handleError(_0x2ccfd7,null));};exports[_0x3f6f('0x58')]=function(_0x5c9dce,_0x3cf86d){return db['FaxQueue']['describe']()[_0x3f6f('0x29')](respondWithResult(_0x3cf86d,null))[_0x3f6f('0x4b')](handleError(_0x3cf86d,null));};exports[_0x3f6f('0x59')]=function(_0x34bc58,_0x2e1040,_0x3135d8){var _0x747459={'raw':!![],'where':{}},_0x13f1a6={},_0x4f8ed2;return db[_0x3f6f('0x30')][_0x3f6f('0x5a')]({'where':{'id':_0x34bc58['params']['id']}})[_0x3f6f('0x29')](handleEntityNotFound(_0x2e1040,null))['then'](function(_0x46f18b){if(_0x46f18b){_0x4f8ed2=_0x46f18b[_0x3f6f('0x2a')]({'plain':!![]});_0x13f1a6[_0x3f6f('0x35')]=_[_0x3f6f('0x39')](db[_0x3f6f('0x5b')][_0x3f6f('0x31')]);_0x13f1a6['query']=_[_0x3f6f('0x39')](_0x34bc58['query']);_0x13f1a6[_0x3f6f('0x3a')]=_[_0x3f6f('0x3b')](_0x13f1a6['model'],_0x13f1a6[_0x3f6f('0x38')]);_0x747459[_0x3f6f('0x3c')]=_[_0x3f6f('0x3b')](_0x13f1a6['model'],qs[_0x3f6f('0x3d')](_0x34bc58[_0x3f6f('0x38')][_0x3f6f('0x3d')]));_0x747459[_0x3f6f('0x3c')]=_0x747459[_0x3f6f('0x3c')][_0x3f6f('0x4e')]?_0x747459[_0x3f6f('0x3c')]:_0x13f1a6['model'];if(!_0x34bc58['query'][_0x3f6f('0x3e')](_0x3f6f('0x3f'))){_0x747459[_0x3f6f('0x22')]=qs['limit'](_0x34bc58[_0x3f6f('0x38')][_0x3f6f('0x22')]);_0x747459['offset']=qs['offset'](_0x34bc58[_0x3f6f('0x38')][_0x3f6f('0x21')]);}_0x747459['order']=qs[_0x3f6f('0x40')](_0x34bc58[_0x3f6f('0x38')][_0x3f6f('0x40')]);_0x747459[_0x3f6f('0x43')]=qs[_0x3f6f('0x3a')](_[_0x3f6f('0x41')](_0x34bc58[_0x3f6f('0x38')],_0x13f1a6[_0x3f6f('0x3a')]));_0x747459['where'][_0x3f6f('0x5c')]=_0x46f18b['id'];if(_0x34bc58[_0x3f6f('0x38')][_0x3f6f('0x42')]){_0x747459['where']=_[_0x3f6f('0x44')](_0x747459[_0x3f6f('0x43')],{'$or':_[_0x3f6f('0x36')](_0x747459[_0x3f6f('0x3c')],function(_0x48cee3){var _0x45682c={};_0x45682c[_0x48cee3]={'$like':'%'+_0x34bc58[_0x3f6f('0x38')][_0x3f6f('0x42')]+'%'};return _0x45682c;})});}_0x747459=_['merge']({},_0x747459,_0x34bc58[_0x3f6f('0x46')]);return db[_0x3f6f('0x5b')][_0x3f6f('0x49')](_0x747459);}})[_0x3f6f('0x29')](function(_0x5a5770){if(_0x5a5770){return db[_0x3f6f('0x5d')]['findAndCountAll']({'where':{'id':_[_0x3f6f('0x36')](_0x5a5770,_0x3f6f('0x5e')),'role':_0x3f6f('0x5f')},'attributes':['id',_0x3f6f('0x37'),_0x3f6f('0x60'),'updatedAt',_0x3f6f('0x61')]});}})['then'](function(_0x2cea29){if(_0x2cea29){return{'count':_0x2cea29[_0x3f6f('0x20')],'rows':_['map'](_0x2cea29[_0x3f6f('0x4a')],function(_0x33f329){return{'membername':_0x33f329[_0x3f6f('0x37')],'UserId':_0x33f329['id'],'queue_name':_0x4f8ed2[_0x3f6f('0x37')],'FaxQueueId':_0x4f8ed2['id'],'interface':util[_0x3f6f('0x62')]('%s/%s',_0x3f6f('0x63'),_0x33f329[_0x3f6f('0x37')]),'penalty':0x0,'paused':_0x33f329['faxPause'],'createdAt':_0x33f329['createdAt'],'updatedAt':_0x33f329[_0x3f6f('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3f6f('0x29')](respondWithFilteredResult(_0x2e1040,_0x747459))['catch'](handleError(_0x2e1040,null));};exports[_0x3f6f('0x65')]=function(_0x573fca,_0x4f4984,_0x56390d){var _0x3c6d10={};var _0x3c212e={};var _0x3ab014;var _0x11bdc7;return db[_0x3f6f('0x30')][_0x3f6f('0x5a')]({'where':{'id':_0x573fca[_0x3f6f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f4984,null))[_0x3f6f('0x29')](function(_0x4bb716){if(_0x4bb716){_0x3ab014=_0x4bb716;_0x3c212e[_0x3f6f('0x35')]=_[_0x3f6f('0x39')](db['Team']['rawAttributes']);_0x3c212e[_0x3f6f('0x38')]=_[_0x3f6f('0x39')](_0x573fca[_0x3f6f('0x38')]);_0x3c212e[_0x3f6f('0x3a')]=_[_0x3f6f('0x3b')](_0x3c212e[_0x3f6f('0x35')],_0x3c212e[_0x3f6f('0x38')]);_0x3c6d10['attributes']=_[_0x3f6f('0x3b')](_0x3c212e['model'],qs[_0x3f6f('0x3d')](_0x573fca[_0x3f6f('0x38')]['fields']));_0x3c6d10[_0x3f6f('0x3c')]=_0x3c6d10['attributes'][_0x3f6f('0x4e')]?_0x3c6d10[_0x3f6f('0x3c')]:_0x3c212e[_0x3f6f('0x35')];_0x3c6d10[_0x3f6f('0x66')]=qs['sort'](_0x573fca['query'][_0x3f6f('0x40')]);_0x3c6d10[_0x3f6f('0x43')]=qs[_0x3f6f('0x3a')](_[_0x3f6f('0x41')](_0x573fca['query'],_0x3c212e['filters']));if(_0x573fca[_0x3f6f('0x38')]['filter']){_0x3c6d10[_0x3f6f('0x43')]=_[_0x3f6f('0x44')](_0x3c6d10[_0x3f6f('0x43')],{'$or':_[_0x3f6f('0x36')](_0x3c6d10[_0x3f6f('0x3c')],function(_0x470917){var _0x4e18e5={};_0x4e18e5[_0x470917]={'$like':'%'+_0x573fca[_0x3f6f('0x38')][_0x3f6f('0x42')]+'%'};return _0x4e18e5;})});}_0x3c6d10=_[_0x3f6f('0x44')]({},_0x3c6d10,_0x573fca[_0x3f6f('0x46')]);return _0x3ab014[_0x3f6f('0x65')](_0x3c6d10);}})[_0x3f6f('0x29')](function(_0x5acca2){if(_0x5acca2){_0x11bdc7=_0x5acca2[_0x3f6f('0x4e')];if(!_0x573fca[_0x3f6f('0x38')][_0x3f6f('0x3e')]('nolimit')){_0x3c6d10[_0x3f6f('0x22')]=qs[_0x3f6f('0x22')](_0x573fca[_0x3f6f('0x38')]['limit']);_0x3c6d10[_0x3f6f('0x21')]=qs[_0x3f6f('0x21')](_0x573fca[_0x3f6f('0x38')][_0x3f6f('0x21')]);}return _0x3ab014[_0x3f6f('0x65')](_0x3c6d10);}})[_0x3f6f('0x29')](function(_0x4bbc1d){if(_0x4bbc1d){return _0x4bbc1d?{'count':_0x11bdc7,'rows':_0x4bbc1d}:null;}})[_0x3f6f('0x29')](respondWithResult(_0x4f4984,null))[_0x3f6f('0x4b')](handleError(_0x4f4984,null));};exports[_0x3f6f('0x67')]=function(_0x3cd541,_0x32fe05,_0x31c0b3){var _0x2eb690=_0x3cd541[_0x3f6f('0x51')][_0x3f6f('0x68')];return db['Team'][_0x3f6f('0x49')]({'where':{'id':_0x2eb690},'attributes':['id'],'include':[{'model':db[_0x3f6f('0x5d')],'as':_0x3f6f('0x69'),'attributes':['id',_0x3f6f('0x37'),_0x3f6f('0x6a'),_0x3f6f('0x6b'),_0x3f6f('0x6c')],'raw':!![]}]})[_0x3f6f('0x29')](function(_0x3d3734){if(_0x3d3734){var _0x7fec5e=_[_0x3f6f('0x6d')](_0x3d3734,function(_0x25cd90){var _0xcd4148=_0x25cd90[_0x3f6f('0x2a')]({'plain':!![]});return _0xcd4148[_0x3f6f('0x69')];});return db[_0x3f6f('0x30')][_0x3f6f('0x4f')]({'where':{'id':_0x3cd541[_0x3f6f('0x4d')]['id']}})['then'](function(_0x50e3ee){return db[_0x3f6f('0x6e')]['transaction'](function(_0x13fbc3){return _0x50e3ee[_0x3f6f('0x67')](_0x2eb690,{'transaction':_0x13fbc3})['then'](function(){return BPromise[_0x3f6f('0x6f')](_0x7fec5e,function(_0x56b7f9){return db[_0x3f6f('0x5b')][_0x3f6f('0x70')]({'where':{'UserId':_0x56b7f9['id'],'FaxQueueId':_0x3cd541[_0x3f6f('0x4d')]['id']},'transaction':_0x13fbc3});});})[_0x3f6f('0x29')](function(){_0x7fec5e[_0x3f6f('0x71')](function(_0x4aaf60){socket[_0x3f6f('0x72')](_0x3f6f('0x73'),{'UserId':_0x4aaf60['id'],'FaxQueueId':_0x50e3ee['id']});});});});});}})[_0x3f6f('0x29')](respondWithStatusCode(_0x32fe05,null))[_0x3f6f('0x4b')](handleError(_0x32fe05,null));};exports['removeTeams']=function(_0x2a2560,_0xba6f1b,_0x3c491e){return db[_0x3f6f('0x74')]['findAll']({'where':{'id':_0x2a2560[_0x3f6f('0x38')][_0x3f6f('0x68')]},'attributes':['id'],'include':[{'model':db[_0x3f6f('0x5d')],'as':_0x3f6f('0x69'),'attributes':['id'],'raw':!![]}]})[_0x3f6f('0x29')](handleEntityNotFound(_0xba6f1b,null))[_0x3f6f('0x29')](function(_0x596de8){var _0x4e33c6=_[_0x3f6f('0x36')](_0x596de8,'id');var _0x554ab7=[];var _0xd4fa6=[];var _0x408c25=squel[_0x3f6f('0x75')]();_0x408c25['field']('tq.TeamId')[_0x3f6f('0x76')](_0x3f6f('0x77'),'tq')[_0x3f6f('0x78')](_0x3f6f('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3f6f('0x7a'),_0x2a2560['params']['id']);for(var _0x15a11d=0x0;_0x15a11d<_0x596de8['length'];_0x15a11d+=0x1){let _0x5f4e5b=_0x596de8[_0x15a11d];for(var _0x357695=0x0;_0x357695<_0x5f4e5b[_0x3f6f('0x69')][_0x3f6f('0x4e')];_0x357695+=0x1){let _0x1dc698=_0x5f4e5b[_0x3f6f('0x69')][_0x357695];var _0x1fa57c=_0x408c25[_0x3f6f('0x7b')]();_0x1fa57c[_0x3f6f('0x43')](_0x3f6f('0x7c'),_0x1dc698['id']);_0xd4fa6[_0x3f6f('0x7d')](db[_0x3f6f('0x6e')]['query'](_0x1fa57c['toString'](),{'type':db[_0x3f6f('0x6e')]['QueryTypes'][_0x3f6f('0x7e')]})[_0x3f6f('0x29')](function(_0x36736c){if(_0x36736c[_0x3f6f('0x4e')]===0x1){return _0x1dc698['id'];}else{var _0x1437e2=_[_0x3f6f('0x7f')](_['map'](_0x36736c,_0x3f6f('0x80')),function(_0x300c55){return _[_0x3f6f('0x81')](_0x4e33c6,_0x300c55);});if(_0x1437e2){return _0x1dc698['id'];}}}));}}return BPromise[_0x3f6f('0x82')](_0xd4fa6)[_0x3f6f('0x29')](function(_0x4a3ac3){_0x554ab7=_(_0x554ab7)[_0x3f6f('0x83')](_0x4a3ac3)[_0x3f6f('0x84')]()[_0x3f6f('0x85')]();return db[_0x3f6f('0x30')]['find']({'where':{'id':_0x2a2560[_0x3f6f('0x4d')]['id']}})[_0x3f6f('0x29')](function(_0x47bb94){return db[_0x3f6f('0x6e')][_0x3f6f('0x86')](function(_0x2cb089){return _0x47bb94[_0x3f6f('0x87')](_0x2a2560[_0x3f6f('0x38')][_0x3f6f('0x68')],{'transaction':_0x2cb089})[_0x3f6f('0x29')](function(){if(!_['isEmpty'](_0x554ab7)){return _0x47bb94[_0x3f6f('0x88')](_0x554ab7,{'transaction':_0x2cb089});}})[_0x3f6f('0x29')](function(){_0x554ab7[_0x3f6f('0x71')](function(_0x2446d3){socket['emit']('userFaxQueue:remove',{'UserId':_0x2446d3,'FaxQueueId':_0x47bb94['id']});});});});});});})['then'](respondWithStatusCode(_0xba6f1b,null))[_0x3f6f('0x4b')](handleError(_0xba6f1b,null));};exports['addAgents']=function(_0x411897,_0xe228e9,_0x173965){return db[_0x3f6f('0x30')][_0x3f6f('0x4f')]({'where':{'id':_0x411897[_0x3f6f('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe228e9,null))[_0x3f6f('0x29')](function(_0x4a59af){if(_0x4a59af){return _0x4a59af[_0x3f6f('0x89')](_0x411897[_0x3f6f('0x51')][_0x3f6f('0x68')],_[_0x3f6f('0x8a')](_0x411897['body'],[_0x3f6f('0x68'),'id'])||{})[_0x3f6f('0x8b')](function(_0x7a20ce){for(var _0x32d961=0x0;_0x32d961<_0x411897[_0x3f6f('0x51')][_0x3f6f('0x68')]['length'];_0x32d961+=0x1){socket[_0x3f6f('0x72')](_0x3f6f('0x73'),{'UserId':Number(_0x411897[_0x3f6f('0x51')]['ids'][_0x32d961]),'FaxQueueId':Number(_0x411897['params']['id'])});}return _0x7a20ce;});}})['then'](respondWithResult(_0xe228e9,null))[_0x3f6f('0x4b')](handleError(_0xe228e9,null));};exports['removeAgents']=function(_0x440b0b,_0x38a020,_0x12a929){return db[_0x3f6f('0x30')][_0x3f6f('0x4f')]({'where':{'id':_0x440b0b[_0x3f6f('0x4d')]['id']}})[_0x3f6f('0x29')](handleEntityNotFound(_0x38a020,null))[_0x3f6f('0x29')](function(_0x36c791){if(_0x36c791){return _0x36c791[_0x3f6f('0x88')](_0x440b0b['query']['ids'])['then'](function(){if(_['isArray'](_0x440b0b[_0x3f6f('0x38')]['ids'])){for(var _0x2dcff9=0x0;_0x2dcff9<_0x440b0b[_0x3f6f('0x38')]['ids'][_0x3f6f('0x4e')];_0x2dcff9+=0x1){socket[_0x3f6f('0x72')](_0x3f6f('0x8c'),{'UserId':Number(_0x440b0b[_0x3f6f('0x38')]['ids'][_0x2dcff9]),'FaxQueueId':Number(_0x440b0b[_0x3f6f('0x4d')]['id'])});}}else{socket[_0x3f6f('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x440b0b[_0x3f6f('0x38')][_0x3f6f('0x68')]),'FaxQueueId':Number(_0x440b0b[_0x3f6f('0x4d')]['id'])});}});}})[_0x3f6f('0x29')](respondWithStatusCode(_0x38a020,null))[_0x3f6f('0x4b')](handleError(_0x38a020,null));};exports[_0x3f6f('0x8d')]=function(_0x1094d7,_0x400ec2,_0x3d81c3){var _0x3b5043={};var _0x3d7328={};var _0x4fa55b;var _0x4382b9;return db[_0x3f6f('0x30')][_0x3f6f('0x5a')]({'where':{'id':_0x1094d7[_0x3f6f('0x4d')]['id']}})[_0x3f6f('0x29')](handleEntityNotFound(_0x400ec2,null))[_0x3f6f('0x29')](function(_0x563d48){if(_0x563d48){_0x4fa55b=_0x563d48;_0x3d7328[_0x3f6f('0x35')]=_[_0x3f6f('0x39')](db[_0x3f6f('0x5d')][_0x3f6f('0x31')]);_0x3d7328[_0x3f6f('0x38')]=_['keys'](_0x1094d7[_0x3f6f('0x38')]);_0x3d7328['filters']=_[_0x3f6f('0x3b')](_0x3d7328[_0x3f6f('0x35')],_0x3d7328[_0x3f6f('0x38')]);_0x3b5043['attributes']=_[_0x3f6f('0x3b')](_0x3d7328['model'],qs[_0x3f6f('0x3d')](_0x1094d7[_0x3f6f('0x38')]['fields']));_0x3b5043[_0x3f6f('0x3c')]=_0x3b5043[_0x3f6f('0x3c')][_0x3f6f('0x4e')]?_0x3b5043[_0x3f6f('0x3c')]:_0x3d7328[_0x3f6f('0x35')];_0x3b5043[_0x3f6f('0x66')]=qs['sort'](_0x1094d7[_0x3f6f('0x38')]['sort']);_0x3b5043[_0x3f6f('0x43')]=qs[_0x3f6f('0x3a')](_[_0x3f6f('0x41')](_0x1094d7[_0x3f6f('0x38')],_0x3d7328['filters']));if(_0x1094d7['query'][_0x3f6f('0x42')]){_0x3b5043['where']=_[_0x3f6f('0x44')](_0x3b5043[_0x3f6f('0x43')],{'$or':_[_0x3f6f('0x36')](_0x3b5043['attributes'],function(_0xd78c73){var _0x4368de={};_0x4368de[_0xd78c73]={'$like':'%'+_0x1094d7['query'][_0x3f6f('0x42')]+'%'};return _0x4368de;})});}_0x3b5043=_[_0x3f6f('0x44')]({},_0x3b5043,_0x1094d7[_0x3f6f('0x46')]);return _0x4fa55b[_0x3f6f('0x8d')](_0x3b5043);}})[_0x3f6f('0x29')](function(_0x50641c){if(_0x50641c){_0x4382b9=_0x50641c[_0x3f6f('0x4e')];if(!_0x1094d7[_0x3f6f('0x38')][_0x3f6f('0x3e')](_0x3f6f('0x3f'))){_0x3b5043['limit']=qs[_0x3f6f('0x22')](_0x1094d7[_0x3f6f('0x38')]['limit']);_0x3b5043[_0x3f6f('0x21')]=qs[_0x3f6f('0x21')](_0x1094d7[_0x3f6f('0x38')][_0x3f6f('0x21')]);}return _0x4fa55b[_0x3f6f('0x8d')](_0x3b5043);}})[_0x3f6f('0x29')](function(_0x208fa4){if(_0x208fa4){return _0x208fa4?{'count':_0x4382b9,'rows':_0x208fa4}:null;}})[_0x3f6f('0x29')](respondWithResult(_0x400ec2,null))[_0x3f6f('0x4b')](handleError(_0x400ec2,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 591b0ce..7990cbb 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 _0x8505=['save','emit','hasOwnProperty','hook','exports','FaxQueue','setMaxListeners'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x8505,0x140));var _0x5850=function(_0x272a16,_0x139663){_0x272a16=_0x272a16-0x0;var _0x168446=_0x8505[_0x272a16];return _0x168446;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x5850('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5850('0x1')](0x0);var events={'afterCreate':_0x5850('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x442515){return function(_0x58ccef,_0x1f7ee1,_0x4a159d){FaxQueueEvents[_0x5850('0x3')](_0x442515+':'+_0x58ccef['id'],_0x58ccef);FaxQueueEvents['emit'](_0x442515,_0x58ccef);_0x4a159d(null);};}for(var e in events){if(events[_0x5850('0x4')](e)){var event=events[e];FaxQueue[_0x5850('0x5')](e,emitEvent(event));}}module[_0x5850('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xd83b=['../../mysqldb','FaxQueue','setMaxListeners','save','emit','hook'];(function(_0x347c4b,_0x2d5be4){var _0x26c7a7=function(_0x1c96d0){while(--_0x1c96d0){_0x347c4b['push'](_0x347c4b['shift']());}};_0x26c7a7(++_0x2d5be4);}(_0xd83b,0x174));var _0xbd83=function(_0x5397d8,_0x27675e){_0x5397d8=_0x5397d8-0x0;var _0x128e82=_0xd83b[_0x5397d8];return _0x128e82;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xbd83('0x0'))['db'][_0xbd83('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbd83('0x2')](0x0);var events={'afterCreate':_0xbd83('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3287fa){return function(_0x2a7a34,_0x1b937f,_0x16e69c){FaxQueueEvents['emit'](_0x3287fa+':'+_0x2a7a34['id'],_0x2a7a34);FaxQueueEvents[_0xbd83('0x4')](_0x3287fa,_0x2a7a34);_0x16e69c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xbd83('0x5')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 41d5645..2afc604 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 _0x6150=['fax_queues','util','../../config/logger','api','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6150,0x1f0));var _0x0615=function(_0x5174f3,_0x406dcd){_0x5174f3=_0x5174f3-0x0;var _0xd23dd2=_0x6150[_0x5174f3];return _0xd23dd2;};'use strict';var _=require('lodash');var util=require(_0x0615('0x0'));var logger=require(_0x0615('0x1'))(_0x0615('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0615('0x3'));var config=require(_0x0615('0x4'));var attributes=require(_0x0615('0x5'));module[_0x0615('0x6')]=function(_0x257155,_0x58986f){return _0x257155['define'](_0x0615('0x7'),attributes,{'tableName':_0x0615('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01b0=['rimraf','../../config/environment','exports','define','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x01b0,0x1d4));var _0x001b=function(_0x447074,_0x178349){_0x447074=_0x447074-0x0;var _0x576615=_0x01b0[_0x447074];return _0x576615;};'use strict';var _=require(_0x001b('0x0'));var util=require('util');var logger=require(_0x001b('0x1'))(_0x001b('0x2'));var moment=require(_0x001b('0x3'));var BPromise=require(_0x001b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x001b('0x5'));var config=require(_0x001b('0x6'));var attributes=require('./faxQueue.attributes');module[_0x001b('0x7')]=function(_0x3c248,_0x1c9b07){return _0x3c248[_0x001b('0x8')](_0x001b('0x9'),attributes,{'tableName':_0x001b('0xa'),'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 882439c..d7298ff 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 _0x3647=['attributes','include','model','map','GetFaxQueue','ShowFaxQueue','find','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxQueue','findAll','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3647,0x1c0));var _0x7364=function(_0x5da2bc,_0x4f92bd){_0x5da2bc=_0x5da2bc-0x0;var _0x20e29b=_0x3647[_0x5da2bc];return _0x20e29b;};'use strict';var _=require(_0x7364('0x0'));var util=require(_0x7364('0x1'));var moment=require(_0x7364('0x2'));var BPromise=require(_0x7364('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7364('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7364('0x5'));var logger=require(_0x7364('0x6'))(_0x7364('0x7'));var config=require(_0x7364('0x8'));var jayson=require(_0x7364('0x9'));var client=jayson[_0x7364('0xa')][_0x7364('0xb')]({'port':0x232a});config[_0x7364('0xc')]=_['defaults'](config[_0x7364('0xc')],{'host':_0x7364('0xd'),'port':0x18eb});var socket=require(_0x7364('0xe'))(new Redis(config['redis']));require(_0x7364('0xf'))[_0x7364('0x10')](socket);function respondWithRpcPromise(_0x56e672,_0x2bfaa7,_0x283201){return new BPromise(function(_0x452ac5,_0x4edcbf){return client['request'](_0x56e672,_0x283201)[_0x7364('0x11')](function(_0x148d98){logger[_0x7364('0x12')](_0x7364('0x13'),_0x2bfaa7,_0x7364('0x14'));logger[_0x7364('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2bfaa7,_0x7364('0x14'),JSON[_0x7364('0x16')](_0x148d98));if(_0x148d98[_0x7364('0x17')]){if(_0x148d98[_0x7364('0x17')][_0x7364('0x18')]===0x1f4){logger['error'](_0x7364('0x13'),_0x2bfaa7,_0x148d98[_0x7364('0x17')][_0x7364('0x19')]);return _0x4edcbf(_0x148d98['error'][_0x7364('0x19')]);}logger[_0x7364('0x17')]('FaxQueue,\x20%s,\x20%s',_0x2bfaa7,_0x148d98['error']['message']);return _0x452ac5(_0x148d98['error'][_0x7364('0x19')]);}else{logger[_0x7364('0x12')](_0x7364('0x13'),_0x2bfaa7,_0x7364('0x14'));_0x452ac5(_0x148d98[_0x7364('0x1a')][_0x7364('0x19')]);}})[_0x7364('0x1b')](function(_0x540c9d){logger[_0x7364('0x17')](_0x7364('0x13'),_0x2bfaa7,_0x540c9d);_0x4edcbf(_0x540c9d);});});}exports['GetFaxQueue']=function(_0x12d1e4){var _0x2bda67=this;return new Promise(function(_0x5846da,_0x3a102b){return db[_0x7364('0x1c')][_0x7364('0x1d')]({'raw':_0x12d1e4[_0x7364('0x1e')]?_0x12d1e4[_0x7364('0x1e')][_0x7364('0x1f')]===undefined?!![]:![]:!![],'where':_0x12d1e4['options']?_0x12d1e4[_0x7364('0x1e')]['where']||null:null,'attributes':_0x12d1e4[_0x7364('0x1e')]?_0x12d1e4['options'][_0x7364('0x20')]||null:null,'limit':_0x12d1e4[_0x7364('0x1e')]?_0x12d1e4[_0x7364('0x1e')]['limit']||null:null,'include':_0x12d1e4['options']?_0x12d1e4[_0x7364('0x1e')]['include']?_['map'](_0x12d1e4['options'][_0x7364('0x21')],function(_0x15532d){return{'model':db[_0x15532d[_0x7364('0x22')]],'as':_0x15532d['as'],'attributes':_0x15532d['attributes'],'include':_0x15532d[_0x7364('0x21')]?_[_0x7364('0x23')](_0x15532d[_0x7364('0x21')],function(_0x5d2310){return{'model':db[_0x5d2310[_0x7364('0x22')]],'as':_0x5d2310['as'],'attributes':_0x5d2310[_0x7364('0x20')],'include':_0x5d2310[_0x7364('0x21')]?_[_0x7364('0x23')](_0x5d2310[_0x7364('0x21')],function(_0x3f1975){return{'model':db[_0x3f1975[_0x7364('0x22')]],'as':_0x3f1975['as'],'attributes':_0x3f1975[_0x7364('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7364('0x11')](function(_0xb7f4ee){logger['info'](_0x7364('0x24'),_0x12d1e4);logger['debug']('GetFaxQueue',_0x12d1e4,JSON[_0x7364('0x16')](_0xb7f4ee));_0x5846da(_0xb7f4ee);})['catch'](function(_0x15a007){logger['error']('GetFaxQueue',_0x15a007[_0x7364('0x19')],_0x12d1e4);_0x3a102b(_0x2bda67['error'](0x1f4,_0x15a007[_0x7364('0x19')]));});});};exports[_0x7364('0x25')]=function(_0x2345d7){var _0x32c2d6=this;return new Promise(function(_0x218cc6,_0x36e7a0){return db['FaxQueue'][_0x7364('0x26')]({'raw':_0x2345d7['options']?_0x2345d7[_0x7364('0x1e')][_0x7364('0x1f')]===undefined?!![]:![]:!![],'where':_0x2345d7[_0x7364('0x1e')]?_0x2345d7[_0x7364('0x1e')][_0x7364('0x27')]||null:null,'attributes':_0x2345d7[_0x7364('0x1e')]?_0x2345d7[_0x7364('0x1e')]['attributes']||null:null,'include':_0x2345d7[_0x7364('0x1e')]?_0x2345d7['options'][_0x7364('0x21')]?_[_0x7364('0x23')](_0x2345d7[_0x7364('0x1e')][_0x7364('0x21')],function(_0x12eb6b){return{'model':db[_0x12eb6b[_0x7364('0x22')]],'as':_0x12eb6b['as'],'attributes':_0x12eb6b[_0x7364('0x20')],'include':_0x12eb6b[_0x7364('0x21')]?_[_0x7364('0x23')](_0x12eb6b[_0x7364('0x21')],function(_0x2329d6){return{'model':db[_0x2329d6[_0x7364('0x22')]],'as':_0x2329d6['as'],'attributes':_0x2329d6[_0x7364('0x20')],'include':_0x2329d6['include']?_[_0x7364('0x23')](_0x2329d6[_0x7364('0x21')],function(_0x4caaf9){return{'model':db[_0x4caaf9[_0x7364('0x22')]],'as':_0x4caaf9['as'],'attributes':_0x4caaf9[_0x7364('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7364('0x11')](function(_0x494909){logger['info'](_0x7364('0x25'),_0x2345d7);logger[_0x7364('0x15')](_0x7364('0x25'),_0x2345d7,JSON[_0x7364('0x16')](_0x494909));_0x218cc6(_0x494909);})[_0x7364('0x1b')](function(_0x3eba21){logger[_0x7364('0x17')](_0x7364('0x25'),_0x3eba21[_0x7364('0x19')],_0x2345d7);_0x36e7a0(_0x32c2d6['error'](0x1f4,_0x3eba21[_0x7364('0x19')]));});});}; \ No newline at end of file +var _0xc43c=['FaxQueue,\x20%s,\x20%s,\x20%s','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc43c,0x8d));var _0xcc43=function(_0x574287,_0x3eb5f9){_0x574287=_0x574287-0x0;var _0x219c80=_0xc43c[_0x574287];return _0x219c80;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var moment=require('moment');var BPromise=require(_0xcc43('0x2'));var rs=require(_0xcc43('0x3'));var fs=require('fs');var Redis=require(_0xcc43('0x4'));var db=require(_0xcc43('0x5'))['db'];var utils=require(_0xcc43('0x6'));var logger=require(_0xcc43('0x7'))(_0xcc43('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xcc43('0x9')](config[_0xcc43('0xa')],{'host':_0xcc43('0xb'),'port':0x18eb});var socket=require(_0xcc43('0xc'))(new Redis(config[_0xcc43('0xa')]));require(_0xcc43('0xd'))['register'](socket);function respondWithRpcPromise(_0x17de82,_0x167a66,_0x4bb670){return new BPromise(function(_0x3e4a0e,_0x12df36){return client[_0xcc43('0xe')](_0x17de82,_0x4bb670)[_0xcc43('0xf')](function(_0x527969){logger[_0xcc43('0x10')]('FaxQueue,\x20%s,\x20%s',_0x167a66,_0xcc43('0x11'));logger[_0xcc43('0x12')](_0xcc43('0x13'),_0x167a66,_0xcc43('0x11'),JSON['stringify'](_0x527969));if(_0x527969['error']){if(_0x527969[_0xcc43('0x14')][_0xcc43('0x15')]===0x1f4){logger[_0xcc43('0x14')](_0xcc43('0x16'),_0x167a66,_0x527969[_0xcc43('0x14')][_0xcc43('0x17')]);return _0x12df36(_0x527969['error'][_0xcc43('0x17')]);}logger['error'](_0xcc43('0x16'),_0x167a66,_0x527969[_0xcc43('0x14')][_0xcc43('0x17')]);return _0x3e4a0e(_0x527969[_0xcc43('0x14')][_0xcc43('0x17')]);}else{logger[_0xcc43('0x10')]('FaxQueue,\x20%s,\x20%s',_0x167a66,'request\x20sent');_0x3e4a0e(_0x527969[_0xcc43('0x18')][_0xcc43('0x17')]);}})[_0xcc43('0x19')](function(_0x3ab591){logger[_0xcc43('0x14')](_0xcc43('0x16'),_0x167a66,_0x3ab591);_0x12df36(_0x3ab591);});});}exports[_0xcc43('0x1a')]=function(_0x34c4d4){var _0xe49668=this;return new Promise(function(_0x33a8f0,_0x11726a){return db['FaxQueue'][_0xcc43('0x1b')]({'raw':_0x34c4d4[_0xcc43('0x1c')]?_0x34c4d4[_0xcc43('0x1c')][_0xcc43('0x1d')]===undefined?!![]:![]:!![],'where':_0x34c4d4[_0xcc43('0x1c')]?_0x34c4d4[_0xcc43('0x1c')][_0xcc43('0x1e')]||null:null,'attributes':_0x34c4d4[_0xcc43('0x1c')]?_0x34c4d4['options'][_0xcc43('0x1f')]||null:null,'limit':_0x34c4d4[_0xcc43('0x1c')]?_0x34c4d4[_0xcc43('0x1c')][_0xcc43('0x20')]||null:null,'include':_0x34c4d4[_0xcc43('0x1c')]?_0x34c4d4[_0xcc43('0x1c')][_0xcc43('0x21')]?_[_0xcc43('0x22')](_0x34c4d4[_0xcc43('0x1c')]['include'],function(_0x1f432d){return{'model':db[_0x1f432d['model']],'as':_0x1f432d['as'],'attributes':_0x1f432d[_0xcc43('0x1f')],'include':_0x1f432d[_0xcc43('0x21')]?_[_0xcc43('0x22')](_0x1f432d[_0xcc43('0x21')],function(_0x7b095b){return{'model':db[_0x7b095b[_0xcc43('0x23')]],'as':_0x7b095b['as'],'attributes':_0x7b095b[_0xcc43('0x1f')],'include':_0x7b095b['include']?_[_0xcc43('0x22')](_0x7b095b[_0xcc43('0x21')],function(_0x33263e){return{'model':db[_0x33263e[_0xcc43('0x23')]],'as':_0x33263e['as'],'attributes':_0x33263e[_0xcc43('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcc43('0xf')](function(_0x455228){logger[_0xcc43('0x10')]('GetFaxQueue',_0x34c4d4);logger[_0xcc43('0x12')](_0xcc43('0x1a'),_0x34c4d4,JSON['stringify'](_0x455228));_0x33a8f0(_0x455228);})['catch'](function(_0x25f76b){logger[_0xcc43('0x14')](_0xcc43('0x1a'),_0x25f76b[_0xcc43('0x17')],_0x34c4d4);_0x11726a(_0xe49668[_0xcc43('0x14')](0x1f4,_0x25f76b[_0xcc43('0x17')]));});});};exports[_0xcc43('0x24')]=function(_0x35dab8){var _0x50e0a2=this;return new Promise(function(_0x473f57,_0x393faa){return db[_0xcc43('0x25')][_0xcc43('0x26')]({'raw':_0x35dab8[_0xcc43('0x1c')]?_0x35dab8[_0xcc43('0x1c')][_0xcc43('0x1d')]===undefined?!![]:![]:!![],'where':_0x35dab8[_0xcc43('0x1c')]?_0x35dab8[_0xcc43('0x1c')][_0xcc43('0x1e')]||null:null,'attributes':_0x35dab8[_0xcc43('0x1c')]?_0x35dab8['options'][_0xcc43('0x1f')]||null:null,'include':_0x35dab8[_0xcc43('0x1c')]?_0x35dab8[_0xcc43('0x1c')][_0xcc43('0x21')]?_[_0xcc43('0x22')](_0x35dab8[_0xcc43('0x1c')]['include'],function(_0x5a3466){return{'model':db[_0x5a3466[_0xcc43('0x23')]],'as':_0x5a3466['as'],'attributes':_0x5a3466[_0xcc43('0x1f')],'include':_0x5a3466[_0xcc43('0x21')]?_[_0xcc43('0x22')](_0x5a3466[_0xcc43('0x21')],function(_0x25abba){return{'model':db[_0x25abba['model']],'as':_0x25abba['as'],'attributes':_0x25abba[_0xcc43('0x1f')],'include':_0x25abba[_0xcc43('0x21')]?_['map'](_0x25abba[_0xcc43('0x21')],function(_0x402c2c){return{'model':db[_0x402c2c[_0xcc43('0x23')]],'as':_0x402c2c['as'],'attributes':_0x402c2c[_0xcc43('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcc43('0xf')](function(_0x519491){logger[_0xcc43('0x10')](_0xcc43('0x24'),_0x35dab8);logger['debug']('ShowFaxQueue',_0x35dab8,JSON[_0xcc43('0x27')](_0x519491));_0x473f57(_0x519491);})[_0xcc43('0x19')](function(_0x31c633){logger['error']('ShowFaxQueue',_0x31c633[_0xcc43('0x17')],_0x35dab8);_0x393faa(_0x50e0a2[_0xcc43('0x14')](0x1f4,_0x31c633['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 9c8d44a..dc6939e 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 _0xd1e8=['faxQueue:','remove','update','length'];(function(_0x22f382,_0x5c0074){var _0x3e9276=function(_0x143a34){while(--_0x143a34){_0x22f382['push'](_0x22f382['shift']());}};_0x3e9276(++_0x5c0074);}(_0xd1e8,0x101));var _0x8d1e=function(_0x24563c,_0x49d7cd){_0x24563c=_0x24563c-0x0;var _0x14796e=_0xd1e8[_0x24563c];return _0x14796e;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x8d1e('0x0'),_0x8d1e('0x1')];function createListener(_0x211590,_0x1ef9ae){return function(_0x25b924){_0x1ef9ae['emit'](_0x211590,_0x25b924);};}function removeListener(_0x4a08d9,_0xe23267){return function(){FaxQueueEvents['removeListener'](_0x4a08d9,_0xe23267);};}exports['register']=function(_0x5426b5){for(var _0x38aa20=0x0,_0x242fd8=events[_0x8d1e('0x2')];_0x38aa20<_0x242fd8;_0x38aa20++){var _0x58919c=events[_0x38aa20];var _0x50672f=createListener(_0x8d1e('0x3')+_0x58919c,_0x5426b5);FaxQueueEvents['on'](_0x58919c,_0x50672f);}}; \ No newline at end of file +var _0x6631=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x2a02c2,_0x5f4587){var _0x21bc6f=function(_0x339c19){while(--_0x339c19){_0x2a02c2['push'](_0x2a02c2['shift']());}};_0x21bc6f(++_0x5f4587);}(_0x6631,0x134));var _0x1663=function(_0x873d4a,_0x564902){_0x873d4a=_0x873d4a-0x0;var _0x636a65=_0x6631[_0x873d4a];return _0x636a65;};'use strict';var FaxQueueEvents=require(_0x1663('0x0'));var events=[_0x1663('0x1'),_0x1663('0x2'),_0x1663('0x3')];function createListener(_0x3f563e,_0x26971d){return function(_0x5e5e43){_0x26971d[_0x1663('0x4')](_0x3f563e,_0x5e5e43);};}function removeListener(_0x1e2fcc,_0x232bfe){return function(){FaxQueueEvents[_0x1663('0x5')](_0x1e2fcc,_0x232bfe);};}exports[_0x1663('0x6')]=function(_0x1faf52){for(var _0x23a307=0x0,_0x347c23=events[_0x1663('0x7')];_0x23a307<_0x347c23;_0x23a307++){var _0x231edf=events[_0x23a307];var _0x8adcee=createListener(_0x1663('0x8')+_0x231edf,_0x1faf52);FaxQueueEvents['on'](_0x231edf,_0x8adcee);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 824e9c8..7159f58 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 _0x524e=['isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addAgents','update','removeTeams','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','describe','/:id'];(function(_0x44187e,_0x2cd21a){var _0x17b0f0=function(_0x44539b){while(--_0x44539b){_0x44187e['push'](_0x44187e['shift']());}};_0x17b0f0(++_0x2cd21a);}(_0x524e,0x15e));var _0xe524=function(_0x1e08c4,_0x1a02d1){_0x1e08c4=_0x1e08c4-0x0;var _0x421522=_0x524e[_0x1e08c4];return _0x421522;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x9')](_0xe524('0x10'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x9')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x9')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['getAgents']);router['post']('/',auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);router[_0xe524('0x16')](_0xe524('0x12'),auth[_0xe524('0xe')](),controller['addTeams']);router[_0xe524('0x16')]('/:id/users',auth[_0xe524('0xe')](),controller[_0xe524('0x17')]);router['put'](_0xe524('0xd'),auth['isAuthenticated'](),controller[_0xe524('0x18')]);router['delete'](_0xe524('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xe524('0x12'),auth['isAuthenticated'](),controller[_0xe524('0x19')]);router[_0xe524('0x1a')](_0xe524('0x14'),auth[_0xe524('0xe')](),controller['removeAgents']);module[_0xe524('0x1b')]=router; \ No newline at end of file +var _0xc6ac=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express'];(function(_0x562f04,_0x1126ec){var _0x230cf2=function(_0x4b58ad){while(--_0x4b58ad){_0x562f04['push'](_0x562f04['shift']());}};_0x230cf2(++_0x1126ec);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x56950f,_0x5f574c){_0x56950f=_0x56950f-0x0;var _0x5217ca=_0xc6ac[_0x56950f];return _0x5217ca;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0xb')](_0xcc6a('0x12'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0xb')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);router[_0xcc6a('0xb')](_0xcc6a('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xcc6a('0x17')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x18')]);router['post']('/:id/teams',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x19')]);router[_0xcc6a('0x17')](_0xcc6a('0x16'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1a')]);router[_0xcc6a('0x1b')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1c')]);router[_0xcc6a('0x1d')](_0xcc6a('0x14'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1e')]);router[_0xcc6a('0x1d')](_0xcc6a('0x16'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1f')]);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 e85daf2..d351b31 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 _0xbcc9=['STRING','DATE','sequelize'];(function(_0x3defcb,_0x22ed85){var _0x2ab690=function(_0x3d3491){while(--_0x3d3491){_0x3defcb['push'](_0x3defcb['shift']());}};_0x2ab690(++_0x22ed85);}(_0xbcc9,0x13d));var _0x9bcc=function(_0x1213eb,_0x254d44){_0x1213eb=_0x1213eb-0x0;var _0x1cb4bb=_0xbcc9[_0x1213eb];return _0x1cb4bb;};'use strict';var moment=require('moment');var Sequelize=require(_0x9bcc('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9bcc('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9bcc('0x2')]},'leaveAt':{'type':Sequelize[_0x9bcc('0x2')]},'acceptAt':{'type':Sequelize[_0x9bcc('0x2')]},'exitAt':{'type':Sequelize[_0x9bcc('0x2')]},'reason':{'type':Sequelize[_0x9bcc('0x1')]}}; \ No newline at end of file +var _0xb539=['sequelize','STRING','DATE','moment'];(function(_0x3a398f,_0x166681){var _0x24e696=function(_0x417fc8){while(--_0x417fc8){_0x3a398f['push'](_0x3a398f['shift']());}};_0x24e696(++_0x166681);}(_0xb539,0x8b));var _0x9b53=function(_0x126388,_0x2dc603){_0x126388=_0x126388-0x0;var _0x55ff77=_0xb539[_0x126388];return _0x55ff77;};'use strict';var moment=require(_0x9b53('0x0'));var Sequelize=require(_0x9b53('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9b53('0x2')]},'joinAt':{'type':Sequelize[_0x9b53('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9b53('0x3')]},'reason':{'type':Sequelize[_0x9b53('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index adf5472..212524b 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 _0xa1b9=['update','then','destroy','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save'];(function(_0x375f8c,_0x16fd00){var _0x2b3098=function(_0x335b50){while(--_0x335b50){_0x375f8c['push'](_0x375f8c['shift']());}};_0x2b3098(++_0x16fd00);}(_0xa1b9,0x71));var _0x9a1b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa1b9[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x9a1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a1b('0x1'));var jsonpatch=require(_0x9a1b('0x2'));var rp=require(_0x9a1b('0x3'));var moment=require(_0x9a1b('0x4'));var BPromise=require(_0x9a1b('0x5'));var Mustache=require(_0x9a1b('0x6'));var util=require(_0x9a1b('0x7'));var path=require('path');var sox=require(_0x9a1b('0x8'));var csv=require(_0x9a1b('0x9'));var ejs=require(_0x9a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x9a1b('0xb'));var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0x9'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a1b('0x18'));var db=require(_0x9a1b('0x19'))['db'];function respondWithStatusCode(_0x27062b,_0x5ee9d3){_0x5ee9d3=_0x5ee9d3||0xcc;return function(_0x1d016d){if(_0x1d016d){return _0x27062b[_0x9a1b('0x1a')](_0x5ee9d3);}return _0x27062b[_0x9a1b('0x1b')](_0x5ee9d3)[_0x9a1b('0x1c')]();};}function respondWithResult(_0x390ad9,_0x157b6f){_0x157b6f=_0x157b6f||0xc8;return function(_0x3fe388){if(_0x3fe388){return _0x390ad9[_0x9a1b('0x1b')](_0x157b6f)[_0x9a1b('0x1d')](_0x3fe388);}};}function respondWithFilteredResult(_0x101622,_0x5c397f){return function(_0x357cd9){if(_0x357cd9){var _0x2440fc=typeof _0x5c397f['offset']===_0x9a1b('0x1e')&&typeof _0x5c397f[_0x9a1b('0x1f')]===_0x9a1b('0x1e');var _0x1a7324=_0x357cd9[_0x9a1b('0x20')];var _0x478626=_0x2440fc?0x0:_0x5c397f[_0x9a1b('0x21')];var _0x599325=_0x2440fc?_0x357cd9[_0x9a1b('0x20')]:_0x5c397f[_0x9a1b('0x21')]+_0x5c397f[_0x9a1b('0x1f')];var _0x1f1dea;if(_0x599325>=_0x1a7324){_0x599325=_0x1a7324;_0x1f1dea=0xc8;}else{_0x1f1dea=0xce;}_0x101622[_0x9a1b('0x1b')](_0x1f1dea);return _0x101622['set'](_0x9a1b('0x22'),_0x478626+'-'+_0x599325+'/'+_0x1a7324)[_0x9a1b('0x1d')](_0x357cd9);}return null;};}function patchUpdates(_0x36c95c){return function(_0x1977a7){try{jsonpatch['apply'](_0x1977a7,_0x36c95c,!![]);}catch(_0x2ccb02){return BPromise[_0x9a1b('0x23')](_0x2ccb02);}return _0x1977a7[_0x9a1b('0x24')]();};}function saveUpdates(_0x13f828,_0x1c9ab3){return function(_0x327cac){if(_0x327cac){return _0x327cac[_0x9a1b('0x25')](_0x13f828)[_0x9a1b('0x26')](function(_0xb6b23a){return _0xb6b23a;});}return null;};}function removeEntity(_0x37971c,_0x5841c1){return function(_0x2439e9){if(_0x2439e9){return _0x2439e9[_0x9a1b('0x27')]()[_0x9a1b('0x26')](function(){_0x37971c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0ff3,_0x52fce9){return function(_0x17704b){if(!_0x17704b){_0x3b0ff3['sendStatus'](0x194);}return _0x17704b;};}function handleError(_0x5e65ce,_0x48e736){_0x48e736=_0x48e736||0x1f4;return function(_0x432a3d){logger['error'](_0x432a3d[_0x9a1b('0x28')]);if(_0x432a3d[_0x9a1b('0x29')]){delete _0x432a3d[_0x9a1b('0x29')];}_0x5e65ce[_0x9a1b('0x1b')](_0x48e736)[_0x9a1b('0x2a')](_0x432a3d);};}exports[_0x9a1b('0x2b')]=function(_0x1c13d6,_0x1453c4){var _0x4070aa={},_0x2d9ca8={},_0x56f3e8={'count':0x0,'rows':[]};var _0x5735a4=_[_0x9a1b('0x2c')](db[_0x9a1b('0x2d')]['rawAttributes'],function(_0x14ea6b){return{'name':_0x14ea6b[_0x9a1b('0x2e')],'type':_0x14ea6b[_0x9a1b('0x2f')][_0x9a1b('0x30')]};});_0x2d9ca8[_0x9a1b('0x31')]=_[_0x9a1b('0x2c')](_0x5735a4,_0x9a1b('0x29'));_0x2d9ca8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x1c13d6['query']);_0x2d9ca8[_0x9a1b('0x34')]=_['intersection'](_0x2d9ca8[_0x9a1b('0x31')],_0x2d9ca8[_0x9a1b('0x32')]);_0x4070aa[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x2d9ca8['model'],qs[_0x9a1b('0x37')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x37')]));_0x4070aa[_0x9a1b('0x35')]=_0x4070aa[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x4070aa[_0x9a1b('0x35')]:_0x2d9ca8[_0x9a1b('0x31')];if(!_0x1c13d6[_0x9a1b('0x32')]['hasOwnProperty'](_0x9a1b('0x39'))){_0x4070aa[_0x9a1b('0x1f')]=qs[_0x9a1b('0x1f')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x1f')]);_0x4070aa[_0x9a1b('0x21')]=qs[_0x9a1b('0x21')](_0x1c13d6['query'][_0x9a1b('0x21')]);}_0x4070aa[_0x9a1b('0x3a')]=qs[_0x9a1b('0x3b')](_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3b')]);_0x4070aa[_0x9a1b('0x3c')]=qs[_0x9a1b('0x34')](_[_0x9a1b('0x3d')](_0x1c13d6[_0x9a1b('0x32')],_0x2d9ca8['filters']),_0x5735a4);if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]){_0x4070aa['where']=_[_0x9a1b('0x3f')](_0x4070aa[_0x9a1b('0x3c')],{'$or':_['map'](_0x5735a4,function(_0x47bf8e){if(_0x47bf8e['type']!==_0x9a1b('0x40')){var _0x2adbb9={};_0x2adbb9[_0x47bf8e[_0x9a1b('0x29')]]={'$like':'%'+_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x3e')]+'%'};return _0x2adbb9;}})});}_0x4070aa=_['merge']({},_0x4070aa,_0x1c13d6[_0x9a1b('0x41')]);var _0xfa7f44={'where':_0x4070aa[_0x9a1b('0x3c')]};return db[_0x9a1b('0x2d')][_0x9a1b('0x20')](_0xfa7f44)[_0x9a1b('0x26')](function(_0x2faeeb){_0x56f3e8['count']=_0x2faeeb;if(_0x1c13d6[_0x9a1b('0x32')][_0x9a1b('0x42')]){_0x4070aa['include']=[{'all':!![]}];}return db[_0x9a1b('0x2d')][_0x9a1b('0x43')](_0x4070aa);})[_0x9a1b('0x26')](function(_0x69c499){_0x56f3e8['rows']=_0x69c499;return _0x56f3e8;})[_0x9a1b('0x26')](respondWithFilteredResult(_0x1453c4,_0x4070aa))[_0x9a1b('0x44')](handleError(_0x1453c4,null));};exports[_0x9a1b('0x45')]=function(_0x3ddcf6,_0x1863d8){var _0x18a606={'raw':!![],'where':{'id':_0x3ddcf6[_0x9a1b('0x46')]['id']}},_0x515bb8={};_0x515bb8[_0x9a1b('0x31')]=_[_0x9a1b('0x33')](db['FaxQueueReport'][_0x9a1b('0x47')]);_0x515bb8[_0x9a1b('0x32')]=_[_0x9a1b('0x33')](_0x3ddcf6[_0x9a1b('0x32')]);_0x515bb8[_0x9a1b('0x34')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],_0x515bb8['query']);_0x18a606[_0x9a1b('0x35')]=_[_0x9a1b('0x36')](_0x515bb8[_0x9a1b('0x31')],qs[_0x9a1b('0x37')](_0x3ddcf6['query'][_0x9a1b('0x37')]));_0x18a606[_0x9a1b('0x35')]=_0x18a606[_0x9a1b('0x35')][_0x9a1b('0x38')]?_0x18a606[_0x9a1b('0x35')]:_0x515bb8[_0x9a1b('0x31')];if(_0x3ddcf6[_0x9a1b('0x32')]['includeAll']){_0x18a606['include']=[{'all':!![]}];}_0x18a606=_[_0x9a1b('0x3f')]({},_0x18a606,_0x3ddcf6[_0x9a1b('0x41')]);return db['FaxQueueReport'][_0x9a1b('0x48')](_0x18a606)[_0x9a1b('0x26')](handleEntityNotFound(_0x1863d8,null))[_0x9a1b('0x26')](respondWithResult(_0x1863d8,null))['catch'](handleError(_0x1863d8,null));};exports['create']=function(_0x4a98c1,_0x31b879){return db[_0x9a1b('0x2d')]['create'](_0x4a98c1[_0x9a1b('0x49')],{})[_0x9a1b('0x26')](respondWithResult(_0x31b879,0xc9))['catch'](handleError(_0x31b879,null));};exports['update']=function(_0x23e3b8,_0x2ff4b5){if(_0x23e3b8['body']['id']){delete _0x23e3b8[_0x9a1b('0x49')]['id'];}return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x23e3b8[_0x9a1b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ff4b5,null))['then'](saveUpdates(_0x23e3b8['body'],null))[_0x9a1b('0x26')](respondWithResult(_0x2ff4b5,null))[_0x9a1b('0x44')](handleError(_0x2ff4b5,null));};exports[_0x9a1b('0x27')]=function(_0x3f9c17,_0x1a608a){return db[_0x9a1b('0x2d')][_0x9a1b('0x48')]({'where':{'id':_0x3f9c17[_0x9a1b('0x46')]['id']}})[_0x9a1b('0x26')](handleEntityNotFound(_0x1a608a,null))[_0x9a1b('0x26')](removeEntity(_0x1a608a,null))[_0x9a1b('0x44')](handleError(_0x1a608a,null));};exports[_0x9a1b('0x4a')]=function(_0x719389,_0x2bc22a){return db['FaxQueueReport']['describe']()[_0x9a1b('0x26')](respondWithResult(_0x2bc22a,null))[_0x9a1b('0x44')](handleError(_0x2bc22a,null));}; \ No newline at end of file +var _0x579c=['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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','order','sort','where','filters','pick','filter','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x579c,0xda));var _0xc579=function(_0x2220f5,_0x304508){_0x2220f5=_0x2220f5-0x0;var _0x161423=_0x579c[_0x2220f5];return _0x161423;};'use strict';var emlformat=require(_0xc579('0x0'));var rimraf=require(_0xc579('0x1'));var zipdir=require(_0xc579('0x2'));var jsonpatch=require(_0xc579('0x3'));var rp=require(_0xc579('0x4'));var moment=require('moment');var BPromise=require(_0xc579('0x5'));var Mustache=require('mustache');var util=require(_0xc579('0x6'));var path=require(_0xc579('0x7'));var sox=require(_0xc579('0x8'));var csv=require(_0xc579('0x9'));var ejs=require(_0xc579('0xa'));var fs=require('fs');var fs_extra=require(_0xc579('0xb'));var _=require(_0xc579('0xc'));var squel=require('squel');var crypto=require(_0xc579('0xd'));var jsforce=require(_0xc579('0xe'));var deskjs=require(_0xc579('0xf'));var toCsv=require(_0xc579('0x9'));var querystring=require(_0xc579('0x10'));var Papa=require(_0xc579('0x11'));var Redis=require(_0xc579('0x12'));var authService=require(_0xc579('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x14'));var hardwareService=require(_0xc579('0x15'));var logger=require(_0xc579('0x16'))(_0xc579('0x17'));var utils=require(_0xc579('0x18'));var config=require(_0xc579('0x19'));var licenseUtil=require(_0xc579('0x1a'));var db=require(_0xc579('0x1b'))['db'];function respondWithStatusCode(_0x421812,_0x441028){_0x441028=_0x441028||0xcc;return function(_0x448d51){if(_0x448d51){return _0x421812['sendStatus'](_0x441028);}return _0x421812[_0xc579('0x1c')](_0x441028)['end']();};}function respondWithResult(_0xf5400e,_0x59243e){_0x59243e=_0x59243e||0xc8;return function(_0x424e15){if(_0x424e15){return _0xf5400e['status'](_0x59243e)[_0xc579('0x1d')](_0x424e15);}};}function respondWithFilteredResult(_0x4b3635,_0x349e82){return function(_0x115276){if(_0x115276){var _0x567de5=typeof _0x349e82['offset']===_0xc579('0x1e')&&typeof _0x349e82[_0xc579('0x1f')]===_0xc579('0x1e');var _0x414ee7=_0x115276[_0xc579('0x20')];var _0x33d341=_0x567de5?0x0:_0x349e82[_0xc579('0x21')];var _0x3da8a1=_0x567de5?_0x115276[_0xc579('0x20')]:_0x349e82[_0xc579('0x21')]+_0x349e82['limit'];var _0x463f5e;if(_0x3da8a1>=_0x414ee7){_0x3da8a1=_0x414ee7;_0x463f5e=0xc8;}else{_0x463f5e=0xce;}_0x4b3635[_0xc579('0x1c')](_0x463f5e);return _0x4b3635['set'](_0xc579('0x22'),_0x33d341+'-'+_0x3da8a1+'/'+_0x414ee7)[_0xc579('0x1d')](_0x115276);}return null;};}function patchUpdates(_0x14fcdd){return function(_0x6501bc){try{jsonpatch[_0xc579('0x23')](_0x6501bc,_0x14fcdd,!![]);}catch(_0x4417e1){return BPromise[_0xc579('0x24')](_0x4417e1);}return _0x6501bc[_0xc579('0x25')]();};}function saveUpdates(_0x55781e,_0x92657f){return function(_0xad4889){if(_0xad4889){return _0xad4889[_0xc579('0x26')](_0x55781e)[_0xc579('0x27')](function(_0x1da86e){return _0x1da86e;});}return null;};}function removeEntity(_0x565a1b,_0x3634f2){return function(_0x3cf83f){if(_0x3cf83f){return _0x3cf83f[_0xc579('0x28')]()['then'](function(){_0x565a1b[_0xc579('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4610c2,_0x21a4db){return function(_0x4d758a){if(!_0x4d758a){_0x4610c2['sendStatus'](0x194);}return _0x4d758a;};}function handleError(_0x1f8e4b,_0x5b5f4e){_0x5b5f4e=_0x5b5f4e||0x1f4;return function(_0x532b33){logger['error'](_0x532b33[_0xc579('0x29')]);if(_0x532b33[_0xc579('0x2a')]){delete _0x532b33[_0xc579('0x2a')];}_0x1f8e4b[_0xc579('0x1c')](_0x5b5f4e)[_0xc579('0x2b')](_0x532b33);};}exports[_0xc579('0x2c')]=function(_0x45fef4,_0x5c272f){var _0x4d78bc={},_0x4a5f6={},_0x4897a1={'count':0x0,'rows':[]};var _0x314daa=_[_0xc579('0x2d')](db[_0xc579('0x2e')][_0xc579('0x2f')],function(_0x1ad8f7){return{'name':_0x1ad8f7[_0xc579('0x30')],'type':_0x1ad8f7[_0xc579('0x31')][_0xc579('0x32')]};});_0x4a5f6['model']=_[_0xc579('0x2d')](_0x314daa,_0xc579('0x2a'));_0x4a5f6[_0xc579('0x33')]=_[_0xc579('0x34')](_0x45fef4['query']);_0x4a5f6['filters']=_[_0xc579('0x35')](_0x4a5f6['model'],_0x4a5f6[_0xc579('0x33')]);_0x4d78bc[_0xc579('0x36')]=_[_0xc579('0x35')](_0x4a5f6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x45fef4['query'][_0xc579('0x38')]));_0x4d78bc['attributes']=_0x4d78bc[_0xc579('0x36')][_0xc579('0x39')]?_0x4d78bc['attributes']:_0x4a5f6[_0xc579('0x37')];if(!_0x45fef4[_0xc579('0x33')]['hasOwnProperty']('nolimit')){_0x4d78bc[_0xc579('0x1f')]=qs[_0xc579('0x1f')](_0x45fef4['query'][_0xc579('0x1f')]);_0x4d78bc[_0xc579('0x21')]=qs['offset'](_0x45fef4[_0xc579('0x33')]['offset']);}_0x4d78bc[_0xc579('0x3a')]=qs[_0xc579('0x3b')](_0x45fef4['query'][_0xc579('0x3b')]);_0x4d78bc[_0xc579('0x3c')]=qs[_0xc579('0x3d')](_[_0xc579('0x3e')](_0x45fef4[_0xc579('0x33')],_0x4a5f6[_0xc579('0x3d')]),_0x314daa);if(_0x45fef4['query'][_0xc579('0x3f')]){_0x4d78bc[_0xc579('0x3c')]=_['merge'](_0x4d78bc[_0xc579('0x3c')],{'$or':_[_0xc579('0x2d')](_0x314daa,function(_0x3f9bee){if(_0x3f9bee[_0xc579('0x31')]!=='VIRTUAL'){var _0x3f744f={};_0x3f744f[_0x3f9bee[_0xc579('0x2a')]]={'$like':'%'+_0x45fef4[_0xc579('0x33')]['filter']+'%'};return _0x3f744f;}})});}_0x4d78bc=_['merge']({},_0x4d78bc,_0x45fef4['options']);var _0x1ef28f={'where':_0x4d78bc[_0xc579('0x3c')]};return db[_0xc579('0x2e')][_0xc579('0x20')](_0x1ef28f)[_0xc579('0x27')](function(_0x2b60eb){_0x4897a1['count']=_0x2b60eb;if(_0x45fef4[_0xc579('0x33')]['includeAll']){_0x4d78bc[_0xc579('0x40')]=[{'all':!![]}];}return db[_0xc579('0x2e')][_0xc579('0x41')](_0x4d78bc);})[_0xc579('0x27')](function(_0x3d8f24){_0x4897a1[_0xc579('0x42')]=_0x3d8f24;return _0x4897a1;})[_0xc579('0x27')](respondWithFilteredResult(_0x5c272f,_0x4d78bc))[_0xc579('0x43')](handleError(_0x5c272f,null));};exports['show']=function(_0x2a2248,_0x2532a5){var _0x74b63d={'raw':!![],'where':{'id':_0x2a2248[_0xc579('0x44')]['id']}},_0x2449e6={};_0x2449e6[_0xc579('0x37')]=_['keys'](db[_0xc579('0x2e')][_0xc579('0x2f')]);_0x2449e6[_0xc579('0x33')]=_['keys'](_0x2a2248[_0xc579('0x33')]);_0x2449e6[_0xc579('0x3d')]=_[_0xc579('0x35')](_0x2449e6['model'],_0x2449e6[_0xc579('0x33')]);_0x74b63d['attributes']=_[_0xc579('0x35')](_0x2449e6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x2a2248['query'][_0xc579('0x38')]));_0x74b63d[_0xc579('0x36')]=_0x74b63d['attributes']['length']?_0x74b63d[_0xc579('0x36')]:_0x2449e6[_0xc579('0x37')];if(_0x2a2248[_0xc579('0x33')][_0xc579('0x45')]){_0x74b63d['include']=[{'all':!![]}];}_0x74b63d=_['merge']({},_0x74b63d,_0x2a2248[_0xc579('0x46')]);return db[_0xc579('0x2e')][_0xc579('0x47')](_0x74b63d)[_0xc579('0x27')](handleEntityNotFound(_0x2532a5,null))['then'](respondWithResult(_0x2532a5,null))[_0xc579('0x43')](handleError(_0x2532a5,null));};exports[_0xc579('0x48')]=function(_0x53eb6f,_0x40d790){return db['FaxQueueReport']['create'](_0x53eb6f['body'],{})[_0xc579('0x27')](respondWithResult(_0x40d790,0xc9))[_0xc579('0x43')](handleError(_0x40d790,null));};exports[_0xc579('0x26')]=function(_0x90a0d3,_0x1f9d15){if(_0x90a0d3['body']['id']){delete _0x90a0d3[_0xc579('0x49')]['id'];}return db[_0xc579('0x2e')][_0xc579('0x47')]({'where':{'id':_0x90a0d3['params']['id']}})['then'](handleEntityNotFound(_0x1f9d15,null))[_0xc579('0x27')](saveUpdates(_0x90a0d3[_0xc579('0x49')],null))[_0xc579('0x27')](respondWithResult(_0x1f9d15,null))[_0xc579('0x43')](handleError(_0x1f9d15,null));};exports[_0xc579('0x28')]=function(_0xe1a1d7,_0x138ab2){return db['FaxQueueReport']['find']({'where':{'id':_0xe1a1d7[_0xc579('0x44')]['id']}})[_0xc579('0x27')](handleEntityNotFound(_0x138ab2,null))['then'](removeEntity(_0x138ab2,null))[_0xc579('0x43')](handleError(_0x138ab2,null));};exports['describe']=function(_0x1e4872,_0x40017a){return db[_0xc579('0x2e')][_0xc579('0x4a')]()[_0xc579('0x27')](respondWithResult(_0x40017a,null))[_0xc579('0x43')](handleError(_0x40017a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index fb3f43c..c8013ef 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(_0x27fb03,_0x5bbcf5){var _0x21e862=function(_0x469672){while(--_0x469672){_0x27fb03['push'](_0x27fb03['shift']());}};_0x21e862(++_0x5bbcf5);}(_0x0295,0x1f0));var _0x5029=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x0295[_0x1fb1c1];return _0x1622df;};'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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4dda2d,_0x2fc512){var _0x50d5e8=function(_0x522ee7){while(--_0x522ee7){_0x4dda2d['push'](_0x4dda2d['shift']());}};_0x50d5e8(++_0x2fc512);}(_0xabce,0x103));var _0xeabc=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xabce[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index fab6b95..df1ca25 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 _0x925f=['message','result','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','where','attributes','limit','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s'];(function(_0x1c78dc,_0x2fe8ce){var _0x6812fd=function(_0x505e7a){while(--_0x505e7a){_0x1c78dc['push'](_0x1c78dc['shift']());}};_0x6812fd(++_0x2fe8ce);}(_0x925f,0x18d));var _0xf925=function(_0x2fe85a,_0x28c346){_0x2fe85a=_0x2fe85a-0x0;var _0x468e0f=_0x925f[_0x2fe85a];return _0x468e0f;};'use strict';var _=require('lodash');var util=require(_0xf925('0x0'));var moment=require(_0xf925('0x1'));var BPromise=require(_0xf925('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf925('0x3'));var logger=require(_0xf925('0x4'))(_0xf925('0x5'));var config=require(_0xf925('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf925('0x7')][_0xf925('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf3bf54,_0x1fddfb,_0x272604){return new BPromise(function(_0x4d0f15,_0x333f4a){return client[_0xf925('0x9')](_0xf3bf54,_0x272604)[_0xf925('0xa')](function(_0x37e68a){logger[_0xf925('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x1fddfb,_0xf925('0xc'));logger[_0xf925('0xd')](_0xf925('0xe'),_0x1fddfb,_0xf925('0xc'),JSON[_0xf925('0xf')](_0x37e68a));if(_0x37e68a[_0xf925('0x10')]){if(_0x37e68a[_0xf925('0x10')][_0xf925('0x11')]===0x1f4){logger['error'](_0xf925('0x12'),_0x1fddfb,_0x37e68a[_0xf925('0x10')][_0xf925('0x13')]);return _0x333f4a(_0x37e68a[_0xf925('0x10')][_0xf925('0x13')]);}logger[_0xf925('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x1fddfb,_0x37e68a[_0xf925('0x10')][_0xf925('0x13')]);return _0x4d0f15(_0x37e68a[_0xf925('0x10')][_0xf925('0x13')]);}else{logger[_0xf925('0xb')](_0xf925('0x12'),_0x1fddfb,'request\x20sent');_0x4d0f15(_0x37e68a[_0xf925('0x14')][_0xf925('0x13')]);}})['catch'](function(_0x490dad){logger[_0xf925('0x10')](_0xf925('0x12'),_0x1fddfb,_0x490dad);_0x333f4a(_0x490dad);});});}exports[_0xf925('0x15')]=function(_0x34095d){var _0x2fb814=this;return new Promise(function(_0x1194f5,_0x394806){return db[_0xf925('0x16')]['create'](_0x34095d[_0xf925('0x17')],{'raw':_0x34095d[_0xf925('0x18')]?_0x34095d[_0xf925('0x18')][_0xf925('0x19')]===undefined?!![]:![]:!![]})[_0xf925('0xa')](function(_0x30c867){logger['info'](_0xf925('0x15'),_0x34095d);logger[_0xf925('0xd')]('CreateFaxQueueReport',_0x34095d,JSON[_0xf925('0xf')](_0x30c867));_0x1194f5(_0x30c867);})['catch'](function(_0x26d3d9){logger[_0xf925('0x10')]('CreateFaxQueueReport',_0x26d3d9[_0xf925('0x13')],_0x34095d);_0x394806(_0x2fb814['error'](0x1f4,_0x26d3d9[_0xf925('0x13')]));});});};exports[_0xf925('0x1a')]=function(_0x31b5a0){var _0x10a1dd=this;return new Promise(function(_0x7893f2,_0x5bbdc7){return db[_0xf925('0x16')][_0xf925('0x1b')](_0x31b5a0[_0xf925('0x17')],{'raw':_0x31b5a0[_0xf925('0x18')]?_0x31b5a0[_0xf925('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31b5a0[_0xf925('0x18')]?_0x31b5a0[_0xf925('0x18')][_0xf925('0x1c')]||null:null,'attributes':_0x31b5a0[_0xf925('0x18')]?_0x31b5a0[_0xf925('0x18')][_0xf925('0x1d')]||null:null,'limit':_0x31b5a0[_0xf925('0x18')]?_0x31b5a0[_0xf925('0x18')][_0xf925('0x1e')]||null:null})['then'](function(_0x223ff6){logger[_0xf925('0xb')](_0xf925('0x1a'),_0x31b5a0);logger[_0xf925('0xd')]('UpdateFaxQueueReport',_0x31b5a0,JSON[_0xf925('0xf')](_0x223ff6));_0x7893f2(_0x223ff6);})[_0xf925('0x1f')](function(_0x5cc9b7){logger[_0xf925('0x10')](_0xf925('0x1a'),_0x5cc9b7['message'],_0x31b5a0);_0x5bbdc7(_0x10a1dd[_0xf925('0x10')](0x1f4,_0x5cc9b7[_0xf925('0x13')]));});});}; \ No newline at end of file +var _0x7df6=['raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','FaxQueueReport','body','options'];(function(_0x46b4b8,_0x30cbe3){var _0x3d72fd=function(_0x155cfb){while(--_0x155cfb){_0x46b4b8['push'](_0x46b4b8['shift']());}};_0x3d72fd(++_0x30cbe3);}(_0x7df6,0xa7));var _0x67df=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x7df6[_0xdd827a];return _0x2f46f1;};'use strict';var _=require('lodash');var util=require(_0x67df('0x0'));var moment=require(_0x67df('0x1'));var BPromise=require(_0x67df('0x2'));var rs=require(_0x67df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67df('0x4'))['db'];var utils=require(_0x67df('0x5'));var logger=require(_0x67df('0x6'))(_0x67df('0x7'));var config=require('../../config/environment');var jayson=require(_0x67df('0x8'));var client=jayson[_0x67df('0x9')][_0x67df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3441fd,_0x5dac73,_0x1fafc6){return new BPromise(function(_0x4f0a50,_0x143a9d){return client['request'](_0x3441fd,_0x1fafc6)[_0x67df('0xb')](function(_0x44f397){logger['info'](_0x67df('0xc'),_0x5dac73,_0x67df('0xd'));logger[_0x67df('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5dac73,_0x67df('0xd'),JSON[_0x67df('0xf')](_0x44f397));if(_0x44f397['error']){if(_0x44f397[_0x67df('0x10')][_0x67df('0x11')]===0x1f4){logger[_0x67df('0x10')](_0x67df('0xc'),_0x5dac73,_0x44f397[_0x67df('0x10')][_0x67df('0x12')]);return _0x143a9d(_0x44f397[_0x67df('0x10')][_0x67df('0x12')]);}logger[_0x67df('0x10')](_0x67df('0xc'),_0x5dac73,_0x44f397['error'][_0x67df('0x12')]);return _0x4f0a50(_0x44f397['error'][_0x67df('0x12')]);}else{logger[_0x67df('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x5dac73,'request\x20sent');_0x4f0a50(_0x44f397[_0x67df('0x14')]['message']);}})[_0x67df('0x15')](function(_0x1b4736){logger[_0x67df('0x10')](_0x67df('0xc'),_0x5dac73,_0x1b4736);_0x143a9d(_0x1b4736);});});}exports['CreateFaxQueueReport']=function(_0x1f4700){var _0x21e5aa=this;return new Promise(function(_0xfb1435,_0x2c36fa){return db[_0x67df('0x16')]['create'](_0x1f4700[_0x67df('0x17')],{'raw':_0x1f4700[_0x67df('0x18')]?_0x1f4700['options'][_0x67df('0x19')]===undefined?!![]:![]:!![]})[_0x67df('0xb')](function(_0x355459){logger[_0x67df('0x13')](_0x67df('0x1a'),_0x1f4700);logger[_0x67df('0xe')](_0x67df('0x1a'),_0x1f4700,JSON[_0x67df('0xf')](_0x355459));_0xfb1435(_0x355459);})['catch'](function(_0x275a1b){logger[_0x67df('0x10')]('CreateFaxQueueReport',_0x275a1b[_0x67df('0x12')],_0x1f4700);_0x2c36fa(_0x21e5aa[_0x67df('0x10')](0x1f4,_0x275a1b[_0x67df('0x12')]));});});};exports[_0x67df('0x1b')]=function(_0x47ec9c){var _0x29de5e=this;return new Promise(function(_0xe9bfc8,_0x1449e2){return db['FaxQueueReport'][_0x67df('0x1c')](_0x47ec9c[_0x67df('0x17')],{'raw':_0x47ec9c[_0x67df('0x18')]?_0x47ec9c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ec9c[_0x67df('0x18')]?_0x47ec9c[_0x67df('0x18')][_0x67df('0x1d')]||null:null,'attributes':_0x47ec9c[_0x67df('0x18')]?_0x47ec9c[_0x67df('0x18')][_0x67df('0x1e')]||null:null,'limit':_0x47ec9c[_0x67df('0x18')]?_0x47ec9c[_0x67df('0x18')][_0x67df('0x1f')]||null:null})[_0x67df('0xb')](function(_0x359da5){logger['info']('UpdateFaxQueueReport',_0x47ec9c);logger[_0x67df('0xe')](_0x67df('0x1b'),_0x47ec9c,JSON['stringify'](_0x359da5));_0xe9bfc8(_0x359da5);})[_0x67df('0x15')](function(_0x237eda){logger[_0x67df('0x10')](_0x67df('0x1b'),_0x237eda[_0x67df('0x12')],_0x47ec9c);_0x1449e2(_0x29de5e[_0x67df('0x10')](0x1f4,_0x237eda['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index acd90aa..1db17d3 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 _0x01a2=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3b584b,_0x39dc34){var _0x38559d=function(_0x2cbf9e){while(--_0x2cbf9e){_0x3b584b['push'](_0x3b584b['shift']());}};_0x38559d(++_0x39dc34);}(_0x01a2,0xa4));var _0x201a=function(_0x4fbaef,_0x4d9933){_0x4fbaef=_0x4fbaef-0x0;var _0x213724=_0x01a2[_0x4fbaef];return _0x213724;};'use strict';var multer=require(_0x201a('0x0'));var util=require(_0x201a('0x1'));var path=require(_0x201a('0x2'));var timeout=require(_0x201a('0x3'));var express=require(_0x201a('0x4'));var router=express[_0x201a('0x5')]();var fs_extra=require(_0x201a('0x6'));var auth=require(_0x201a('0x7'));var interaction=require(_0x201a('0x8'));var config=require('../../config/environment');var controller=require(_0x201a('0x9'));router[_0x201a('0xa')]('/',auth[_0x201a('0xb')](),controller[_0x201a('0xc')]);router[_0x201a('0xa')](_0x201a('0xd'),auth[_0x201a('0xb')](),controller[_0x201a('0xe')]);router[_0x201a('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x201a('0xb')](),controller[_0x201a('0xf')]);router[_0x201a('0x10')](_0x201a('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x201a('0x12')](_0x201a('0x11'),auth[_0x201a('0xb')](),controller[_0x201a('0x13')]);module[_0x201a('0x14')]=router; \ No newline at end of file +var _0x2cb8=['put','/:id','update','destroy','exports','multer','path','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create'];(function(_0x4637a3,_0x301219){var _0xb62e6c=function(_0x2d251f){while(--_0x2d251f){_0x4637a3['push'](_0x4637a3['shift']());}};_0xb62e6c(++_0x301219);}(_0x2cb8,0x135));var _0x82cb=function(_0x51ed50,_0x27ee7a){_0x51ed50=_0x51ed50-0x0;var _0x5e19b2=_0x2cb8[_0x51ed50];return _0x5e19b2;};'use strict';var multer=require(_0x82cb('0x0'));var util=require('util');var path=require(_0x82cb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x82cb('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x82cb('0x3'));var config=require(_0x82cb('0x4'));var controller=require(_0x82cb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x82cb('0x6')]);router[_0x82cb('0x7')](_0x82cb('0x8'),auth[_0x82cb('0x9')](),controller[_0x82cb('0xa')]);router['get']('/:id',auth[_0x82cb('0x9')](),controller[_0x82cb('0xb')]);router[_0x82cb('0xc')]('/',auth[_0x82cb('0x9')](),controller[_0x82cb('0xd')]);router[_0x82cb('0xe')](_0x82cb('0xf'),auth[_0x82cb('0x9')](),controller[_0x82cb('0x10')]);router['delete'](_0x82cb('0xf'),auth[_0x82cb('0x9')](),controller[_0x82cb('0x11')]);module[_0x82cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index b5b4175..f1a2f17 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3b0fcc,_0x134022){var _0x2c8df8=function(_0x330c2a){while(--_0x330c2a){_0x3b0fcc['push'](_0x3b0fcc['shift']());}};_0x2c8df8(++_0x134022);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x00bb[_0x5ddb1c];return _0x354adc;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x547e86,_0x432050){var _0x476078=function(_0x4b979d){while(--_0x4b979d){_0x547e86['push'](_0x547e86['shift']());}};_0x476078(++_0x432050);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index df02d04..0bb178b 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 _0x6cd4=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6cd4,0x17b));var _0x46cd=function(_0x27681a,_0x553d23){_0x27681a=_0x27681a-0x0;var _0x48ab0f=_0x6cd4[_0x27681a];return _0x48ab0f;};'use strict';var emlformat=require(_0x46cd('0x0'));var rimraf=require(_0x46cd('0x1'));var zipdir=require(_0x46cd('0x2'));var jsonpatch=require(_0x46cd('0x3'));var rp=require('request-promise');var moment=require(_0x46cd('0x4'));var BPromise=require(_0x46cd('0x5'));var Mustache=require(_0x46cd('0x6'));var util=require(_0x46cd('0x7'));var path=require(_0x46cd('0x8'));var sox=require(_0x46cd('0x9'));var csv=require('to-csv');var ejs=require(_0x46cd('0xa'));var fs=require('fs');var fs_extra=require(_0x46cd('0xb'));var _=require(_0x46cd('0xc'));var squel=require('squel');var crypto=require(_0x46cd('0xd'));var jsforce=require(_0x46cd('0xe'));var deskjs=require(_0x46cd('0xf'));var toCsv=require(_0x46cd('0x10'));var querystring=require(_0x46cd('0x11'));var Papa=require(_0x46cd('0x12'));var Redis=require('ioredis');var authService=require(_0x46cd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x46cd('0x14'));var hardwareService=require(_0x46cd('0x15'));var logger=require(_0x46cd('0x16'))(_0x46cd('0x17'));var utils=require(_0x46cd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x46cd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf1a775,_0x3853ed){_0x3853ed=_0x3853ed||0xcc;return function(_0x27059e){if(_0x27059e){return _0xf1a775[_0x46cd('0x1a')](_0x3853ed);}return _0xf1a775['status'](_0x3853ed)['end']();};}function respondWithResult(_0x3baf44,_0x2e925a){_0x2e925a=_0x2e925a||0xc8;return function(_0x26dcf5){if(_0x26dcf5){return _0x3baf44['status'](_0x2e925a)[_0x46cd('0x1b')](_0x26dcf5);}};}function respondWithFilteredResult(_0x2a7f5c,_0xafba6d){return function(_0xfd99ac){if(_0xfd99ac){var _0x3ded97=typeof _0xafba6d[_0x46cd('0x1c')]===_0x46cd('0x1d')&&typeof _0xafba6d[_0x46cd('0x1e')]===_0x46cd('0x1d');var _0x20d551=_0xfd99ac['count'];var _0x155c87=_0x3ded97?0x0:_0xafba6d[_0x46cd('0x1c')];var _0x155fa4=_0x3ded97?_0xfd99ac['count']:_0xafba6d[_0x46cd('0x1c')]+_0xafba6d[_0x46cd('0x1e')];var _0x42c1fd;if(_0x155fa4>=_0x20d551){_0x155fa4=_0x20d551;_0x42c1fd=0xc8;}else{_0x42c1fd=0xce;}_0x2a7f5c[_0x46cd('0x1f')](_0x42c1fd);return _0x2a7f5c[_0x46cd('0x20')](_0x46cd('0x21'),_0x155c87+'-'+_0x155fa4+'/'+_0x20d551)[_0x46cd('0x1b')](_0xfd99ac);}return null;};}function patchUpdates(_0xa943d4){return function(_0x47072d){try{jsonpatch[_0x46cd('0x22')](_0x47072d,_0xa943d4,!![]);}catch(_0x2fcfd4){return BPromise[_0x46cd('0x23')](_0x2fcfd4);}return _0x47072d['save']();};}function saveUpdates(_0x3532ed,_0x25780d){return function(_0x2b360b){if(_0x2b360b){return _0x2b360b[_0x46cd('0x24')](_0x3532ed)[_0x46cd('0x25')](function(_0x3bd596){return _0x3bd596;});}return null;};}function removeEntity(_0x30b2c2,_0x5889c3){return function(_0x147f45){if(_0x147f45){return _0x147f45['destroy']()[_0x46cd('0x25')](function(){_0x30b2c2[_0x46cd('0x1f')](0xcc)[_0x46cd('0x26')]();});}};}function handleEntityNotFound(_0x29a73e,_0x3dd02a){return function(_0x403a30){if(!_0x403a30){_0x29a73e[_0x46cd('0x1a')](0x194);}return _0x403a30;};}function handleError(_0x131cb6,_0x462bd0){_0x462bd0=_0x462bd0||0x1f4;return function(_0x214857){logger[_0x46cd('0x27')](_0x214857[_0x46cd('0x28')]);if(_0x214857[_0x46cd('0x29')]){delete _0x214857[_0x46cd('0x29')];}_0x131cb6[_0x46cd('0x1f')](_0x462bd0)[_0x46cd('0x2a')](_0x214857);};}exports[_0x46cd('0x2b')]=function(_0x291db8,_0x4fbd26){var _0x4dbd2b={},_0xd0bc42={},_0x9c3d02={'count':0x0,'rows':[]};var _0x571f89=_[_0x46cd('0x2c')](db[_0x46cd('0x2d')][_0x46cd('0x2e')],function(_0x192898){return{'name':_0x192898[_0x46cd('0x2f')],'type':_0x192898[_0x46cd('0x30')][_0x46cd('0x31')]};});_0xd0bc42['model']=_[_0x46cd('0x2c')](_0x571f89,'name');_0xd0bc42[_0x46cd('0x32')]=_['keys'](_0x291db8[_0x46cd('0x32')]);_0xd0bc42[_0x46cd('0x33')]=_[_0x46cd('0x34')](_0xd0bc42[_0x46cd('0x35')],_0xd0bc42['query']);_0x4dbd2b[_0x46cd('0x36')]=_['intersection'](_0xd0bc42['model'],qs['fields'](_0x291db8[_0x46cd('0x32')][_0x46cd('0x37')]));_0x4dbd2b[_0x46cd('0x36')]=_0x4dbd2b[_0x46cd('0x36')][_0x46cd('0x38')]?_0x4dbd2b[_0x46cd('0x36')]:_0xd0bc42[_0x46cd('0x35')];if(!_0x291db8['query']['hasOwnProperty'](_0x46cd('0x39'))){_0x4dbd2b[_0x46cd('0x1e')]=qs[_0x46cd('0x1e')](_0x291db8[_0x46cd('0x32')][_0x46cd('0x1e')]);_0x4dbd2b['offset']=qs[_0x46cd('0x1c')](_0x291db8[_0x46cd('0x32')][_0x46cd('0x1c')]);}_0x4dbd2b[_0x46cd('0x3a')]=qs['sort'](_0x291db8[_0x46cd('0x32')][_0x46cd('0x3b')]);_0x4dbd2b[_0x46cd('0x3c')]=qs['filters'](_[_0x46cd('0x3d')](_0x291db8['query'],_0xd0bc42[_0x46cd('0x33')]),_0x571f89);if(_0x291db8[_0x46cd('0x32')][_0x46cd('0x3e')]){_0x4dbd2b[_0x46cd('0x3c')]=_['merge'](_0x4dbd2b[_0x46cd('0x3c')],{'$or':_['map'](_0x571f89,function(_0xb6ab01){if(_0xb6ab01[_0x46cd('0x30')]!==_0x46cd('0x3f')){var _0x242b30={};_0x242b30[_0xb6ab01['name']]={'$like':'%'+_0x291db8[_0x46cd('0x32')]['filter']+'%'};return _0x242b30;}})});}_0x4dbd2b=_[_0x46cd('0x40')]({},_0x4dbd2b,_0x291db8[_0x46cd('0x41')]);var _0xc3560c={'where':_0x4dbd2b[_0x46cd('0x3c')]};return db['FaxTransferReport'][_0x46cd('0x42')](_0xc3560c)[_0x46cd('0x25')](function(_0x200ee0){_0x9c3d02['count']=_0x200ee0;if(_0x291db8[_0x46cd('0x32')][_0x46cd('0x43')]){_0x4dbd2b[_0x46cd('0x44')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x46cd('0x45')](_0x4dbd2b);})[_0x46cd('0x25')](function(_0x3ecf46){_0x9c3d02[_0x46cd('0x46')]=_0x3ecf46;return _0x9c3d02;})[_0x46cd('0x25')](respondWithFilteredResult(_0x4fbd26,_0x4dbd2b))[_0x46cd('0x47')](handleError(_0x4fbd26,null));};exports['show']=function(_0x5a97e7,_0x10e280){var _0x22716b={'raw':!![],'where':{'id':_0x5a97e7[_0x46cd('0x48')]['id']}},_0x378d86={};_0x378d86[_0x46cd('0x35')]=_[_0x46cd('0x49')](db[_0x46cd('0x2d')]['rawAttributes']);_0x378d86[_0x46cd('0x32')]=_[_0x46cd('0x49')](_0x5a97e7[_0x46cd('0x32')]);_0x378d86['filters']=_[_0x46cd('0x34')](_0x378d86[_0x46cd('0x35')],_0x378d86[_0x46cd('0x32')]);_0x22716b['attributes']=_[_0x46cd('0x34')](_0x378d86[_0x46cd('0x35')],qs['fields'](_0x5a97e7['query']['fields']));_0x22716b[_0x46cd('0x36')]=_0x22716b[_0x46cd('0x36')][_0x46cd('0x38')]?_0x22716b[_0x46cd('0x36')]:_0x378d86['model'];if(_0x5a97e7['query']['includeAll']){_0x22716b[_0x46cd('0x44')]=[{'all':!![]}];}_0x22716b=_[_0x46cd('0x40')]({},_0x22716b,_0x5a97e7[_0x46cd('0x41')]);return db['FaxTransferReport'][_0x46cd('0x4a')](_0x22716b)[_0x46cd('0x25')](handleEntityNotFound(_0x10e280,null))['then'](respondWithResult(_0x10e280,null))[_0x46cd('0x47')](handleError(_0x10e280,null));};exports[_0x46cd('0x4b')]=function(_0x93e335,_0x3baf9c){return db[_0x46cd('0x2d')]['create'](_0x93e335['body'],{})['then'](respondWithResult(_0x3baf9c,0xc9))[_0x46cd('0x47')](handleError(_0x3baf9c,null));};exports[_0x46cd('0x24')]=function(_0x4e5bcf,_0x4c64bd){if(_0x4e5bcf['body']['id']){delete _0x4e5bcf['body']['id'];}return db[_0x46cd('0x2d')][_0x46cd('0x4a')]({'where':{'id':_0x4e5bcf[_0x46cd('0x48')]['id']}})[_0x46cd('0x25')](handleEntityNotFound(_0x4c64bd,null))['then'](saveUpdates(_0x4e5bcf['body'],null))[_0x46cd('0x25')](respondWithResult(_0x4c64bd,null))['catch'](handleError(_0x4c64bd,null));};exports[_0x46cd('0x4c')]=function(_0x3e5238,_0x64425b){return db['FaxTransferReport'][_0x46cd('0x4a')]({'where':{'id':_0x3e5238[_0x46cd('0x48')]['id']}})['then'](handleEntityNotFound(_0x64425b,null))[_0x46cd('0x25')](removeEntity(_0x64425b,null))['catch'](handleError(_0x64425b,null));};exports['describe']=function(_0x4b5a4d,_0x58beda){return db[_0x46cd('0x2d')]['describe']()[_0x46cd('0x25')](respondWithResult(_0x58beda,null))['catch'](handleError(_0x58beda,null));}; \ No newline at end of file +var _0xe066=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','then','catch','show','params','include','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x455110,_0x57015b){var _0x544abf=function(_0x17e542){while(--_0x17e542){_0x455110['push'](_0x455110['shift']());}};_0x544abf(++_0x57015b);}(_0xe066,0x10c));var _0x6e06=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0xe066[_0x22cd0c];return _0x439eba;};'use strict';var emlformat=require(_0x6e06('0x0'));var rimraf=require(_0x6e06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6e06('0x2'));var moment=require(_0x6e06('0x3'));var BPromise=require(_0x6e06('0x4'));var Mustache=require(_0x6e06('0x5'));var util=require(_0x6e06('0x6'));var path=require(_0x6e06('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e06('0x8'));var fs=require('fs');var fs_extra=require(_0x6e06('0x9'));var _=require(_0x6e06('0xa'));var squel=require('squel');var crypto=require(_0x6e06('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6e06('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6e06('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6e06('0xe'));var qs=require(_0x6e06('0xf'));var as=require(_0x6e06('0x10'));var hardwareService=require(_0x6e06('0x11'));var logger=require(_0x6e06('0x12'))(_0x6e06('0x13'));var utils=require(_0x6e06('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6e06('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196386,_0x104e80){_0x104e80=_0x104e80||0xcc;return function(_0x1704f9){if(_0x1704f9){return _0x196386[_0x6e06('0x16')](_0x104e80);}return _0x196386[_0x6e06('0x17')](_0x104e80)[_0x6e06('0x18')]();};}function respondWithResult(_0x1cce0e,_0x5048aa){_0x5048aa=_0x5048aa||0xc8;return function(_0x434efa){if(_0x434efa){return _0x1cce0e[_0x6e06('0x17')](_0x5048aa)[_0x6e06('0x19')](_0x434efa);}};}function respondWithFilteredResult(_0x4c50c7,_0x465493){return function(_0x351b24){if(_0x351b24){var _0x21d73a=typeof _0x465493[_0x6e06('0x1a')]===_0x6e06('0x1b')&&typeof _0x465493[_0x6e06('0x1c')]==='undefined';var _0x1e71c5=_0x351b24[_0x6e06('0x1d')];var _0x1d087f=_0x21d73a?0x0:_0x465493[_0x6e06('0x1a')];var _0x43479d=_0x21d73a?_0x351b24[_0x6e06('0x1d')]:_0x465493[_0x6e06('0x1a')]+_0x465493[_0x6e06('0x1c')];var _0x513d04;if(_0x43479d>=_0x1e71c5){_0x43479d=_0x1e71c5;_0x513d04=0xc8;}else{_0x513d04=0xce;}_0x4c50c7['status'](_0x513d04);return _0x4c50c7[_0x6e06('0x1e')](_0x6e06('0x1f'),_0x1d087f+'-'+_0x43479d+'/'+_0x1e71c5)['json'](_0x351b24);}return null;};}function patchUpdates(_0x41768a){return function(_0x450ee6){try{jsonpatch[_0x6e06('0x20')](_0x450ee6,_0x41768a,!![]);}catch(_0x38fc6a){return BPromise[_0x6e06('0x21')](_0x38fc6a);}return _0x450ee6['save']();};}function saveUpdates(_0x12045f,_0x559257){return function(_0x1f2ed1){if(_0x1f2ed1){return _0x1f2ed1[_0x6e06('0x22')](_0x12045f)['then'](function(_0x5d5c48){return _0x5d5c48;});}return null;};}function removeEntity(_0x4a4be0,_0x2af31a){return function(_0x4705d6){if(_0x4705d6){return _0x4705d6[_0x6e06('0x23')]()['then'](function(){_0x4a4be0['status'](0xcc)[_0x6e06('0x18')]();});}};}function handleEntityNotFound(_0xc85354,_0x803ebb){return function(_0x3500e9){if(!_0x3500e9){_0xc85354[_0x6e06('0x16')](0x194);}return _0x3500e9;};}function handleError(_0x4797ab,_0x1ed91e){_0x1ed91e=_0x1ed91e||0x1f4;return function(_0x5962b6){logger[_0x6e06('0x24')](_0x5962b6[_0x6e06('0x25')]);if(_0x5962b6[_0x6e06('0x26')]){delete _0x5962b6[_0x6e06('0x26')];}_0x4797ab[_0x6e06('0x17')](_0x1ed91e)[_0x6e06('0x27')](_0x5962b6);};}exports[_0x6e06('0x28')]=function(_0x4cf9e5,_0x4c409f){var _0x4ff790={},_0xc5322e={},_0x19aa4c={'count':0x0,'rows':[]};var _0x56f15c=_[_0x6e06('0x29')](db[_0x6e06('0x2a')][_0x6e06('0x2b')],function(_0x48c3f9){return{'name':_0x48c3f9['fieldName'],'type':_0x48c3f9[_0x6e06('0x2c')][_0x6e06('0x2d')]};});_0xc5322e[_0x6e06('0x2e')]=_[_0x6e06('0x29')](_0x56f15c,_0x6e06('0x26'));_0xc5322e[_0x6e06('0x2f')]=_[_0x6e06('0x30')](_0x4cf9e5[_0x6e06('0x2f')]);_0xc5322e[_0x6e06('0x31')]=_[_0x6e06('0x32')](_0xc5322e['model'],_0xc5322e['query']);_0x4ff790['attributes']=_[_0x6e06('0x32')](_0xc5322e[_0x6e06('0x2e')],qs[_0x6e06('0x33')](_0x4cf9e5[_0x6e06('0x2f')][_0x6e06('0x33')]));_0x4ff790[_0x6e06('0x34')]=_0x4ff790[_0x6e06('0x34')][_0x6e06('0x35')]?_0x4ff790[_0x6e06('0x34')]:_0xc5322e['model'];if(!_0x4cf9e5[_0x6e06('0x2f')][_0x6e06('0x36')]('nolimit')){_0x4ff790[_0x6e06('0x1c')]=qs[_0x6e06('0x1c')](_0x4cf9e5[_0x6e06('0x2f')][_0x6e06('0x1c')]);_0x4ff790[_0x6e06('0x1a')]=qs['offset'](_0x4cf9e5[_0x6e06('0x2f')][_0x6e06('0x1a')]);}_0x4ff790[_0x6e06('0x37')]=qs[_0x6e06('0x38')](_0x4cf9e5[_0x6e06('0x2f')][_0x6e06('0x38')]);_0x4ff790[_0x6e06('0x39')]=qs[_0x6e06('0x31')](_['pick'](_0x4cf9e5[_0x6e06('0x2f')],_0xc5322e[_0x6e06('0x31')]),_0x56f15c);if(_0x4cf9e5[_0x6e06('0x2f')][_0x6e06('0x3a')]){_0x4ff790[_0x6e06('0x39')]=_[_0x6e06('0x3b')](_0x4ff790['where'],{'$or':_['map'](_0x56f15c,function(_0x3f34f4){if(_0x3f34f4[_0x6e06('0x2c')]!=='VIRTUAL'){var _0x33772e={};_0x33772e[_0x3f34f4['name']]={'$like':'%'+_0x4cf9e5[_0x6e06('0x2f')][_0x6e06('0x3a')]+'%'};return _0x33772e;}})});}_0x4ff790=_['merge']({},_0x4ff790,_0x4cf9e5[_0x6e06('0x3c')]);var _0x8f782c={'where':_0x4ff790['where']};return db['FaxTransferReport'][_0x6e06('0x1d')](_0x8f782c)['then'](function(_0x5c46ad){_0x19aa4c['count']=_0x5c46ad;if(_0x4cf9e5['query'][_0x6e06('0x3d')]){_0x4ff790['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x6e06('0x3e')](_0x4ff790);})[_0x6e06('0x3f')](function(_0xa05a58){_0x19aa4c['rows']=_0xa05a58;return _0x19aa4c;})[_0x6e06('0x3f')](respondWithFilteredResult(_0x4c409f,_0x4ff790))[_0x6e06('0x40')](handleError(_0x4c409f,null));};exports[_0x6e06('0x41')]=function(_0x4ed052,_0x2384b7){var _0x67fdf2={'raw':!![],'where':{'id':_0x4ed052[_0x6e06('0x42')]['id']}},_0x46a806={};_0x46a806['model']=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x46a806[_0x6e06('0x2f')]=_[_0x6e06('0x30')](_0x4ed052[_0x6e06('0x2f')]);_0x46a806[_0x6e06('0x31')]=_[_0x6e06('0x32')](_0x46a806[_0x6e06('0x2e')],_0x46a806['query']);_0x67fdf2[_0x6e06('0x34')]=_['intersection'](_0x46a806['model'],qs[_0x6e06('0x33')](_0x4ed052[_0x6e06('0x2f')]['fields']));_0x67fdf2[_0x6e06('0x34')]=_0x67fdf2[_0x6e06('0x34')]['length']?_0x67fdf2[_0x6e06('0x34')]:_0x46a806['model'];if(_0x4ed052[_0x6e06('0x2f')][_0x6e06('0x3d')]){_0x67fdf2[_0x6e06('0x43')]=[{'all':!![]}];}_0x67fdf2=_[_0x6e06('0x3b')]({},_0x67fdf2,_0x4ed052[_0x6e06('0x3c')]);return db[_0x6e06('0x2a')][_0x6e06('0x44')](_0x67fdf2)[_0x6e06('0x3f')](handleEntityNotFound(_0x2384b7,null))[_0x6e06('0x3f')](respondWithResult(_0x2384b7,null))[_0x6e06('0x40')](handleError(_0x2384b7,null));};exports[_0x6e06('0x45')]=function(_0x5b025c,_0x5ba3e6){return db[_0x6e06('0x2a')][_0x6e06('0x45')](_0x5b025c['body'],{})[_0x6e06('0x3f')](respondWithResult(_0x5ba3e6,0xc9))[_0x6e06('0x40')](handleError(_0x5ba3e6,null));};exports[_0x6e06('0x22')]=function(_0x227fba,_0x308356){if(_0x227fba[_0x6e06('0x46')]['id']){delete _0x227fba['body']['id'];}return db[_0x6e06('0x2a')]['find']({'where':{'id':_0x227fba[_0x6e06('0x42')]['id']}})[_0x6e06('0x3f')](handleEntityNotFound(_0x308356,null))['then'](saveUpdates(_0x227fba[_0x6e06('0x46')],null))['then'](respondWithResult(_0x308356,null))[_0x6e06('0x40')](handleError(_0x308356,null));};exports[_0x6e06('0x23')]=function(_0x34c996,_0x492e51){return db['FaxTransferReport'][_0x6e06('0x44')]({'where':{'id':_0x34c996['params']['id']}})[_0x6e06('0x3f')](handleEntityNotFound(_0x492e51,null))[_0x6e06('0x3f')](removeEntity(_0x492e51,null))[_0x6e06('0x40')](handleError(_0x492e51,null));};exports['describe']=function(_0x43f2e3,_0x3c264b){return db[_0x6e06('0x2a')]['describe']()[_0x6e06('0x3f')](respondWithResult(_0x3c264b,null))[_0x6e06('0x40')](handleError(_0x3c264b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0b41ced..9f72dca 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 _0x0ddf=['uniqueid','util','../../config/logger','api','moment','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0ddf,0x187));var _0xf0dd=function(_0x12473f,_0x2c946f){_0x12473f=_0x12473f-0x0;var _0x248bfe=_0x0ddf[_0x12473f];return _0x248bfe;};'use strict';var _=require('lodash');var util=require(_0xf0dd('0x0'));var logger=require(_0xf0dd('0x1'))(_0xf0dd('0x2'));var moment=require(_0xf0dd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf0dd('0x4'));var config=require(_0xf0dd('0x5'));var attributes=require(_0xf0dd('0x6'));module['exports']=function(_0x5c05ec,_0x4c3db2){return _0x5c05ec[_0xf0dd('0x7')](_0xf0dd('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf0dd('0x9'),'fields':[_0xf0dd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26c2=['moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','util','../../config/logger','api'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x26c2,0x1d6));var _0x226c=function(_0x58556a,_0x1dfc1f){_0x58556a=_0x58556a-0x0;var _0x583f1f=_0x26c2[_0x58556a];return _0x583f1f;};'use strict';var _=require('lodash');var util=require(_0x226c('0x0'));var logger=require(_0x226c('0x1'))(_0x226c('0x2'));var moment=require(_0x226c('0x3'));var BPromise=require('bluebird');var rp=require(_0x226c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x226c('0x5'));var config=require(_0x226c('0x6'));var attributes=require(_0x226c('0x7'));module[_0x226c('0x8')]=function(_0x2a5393,_0x114e59){return _0x2a5393[_0x226c('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x226c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ae72718..9db7c77 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 _0x09b7=['../../config/logger','rpc','jayson/promise','client','http','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xeaebfb,_0x3be923){var _0x46f027=function(_0x5a0113){while(--_0x5a0113){_0xeaebfb['push'](_0xeaebfb['shift']());}};_0x46f027(++_0x3be923);}(_0x09b7,0x19e));var _0x709b=function(_0x4c2d60,_0x92e137){_0x4c2d60=_0x4c2d60-0x0;var _0x29664f=_0x09b7[_0x4c2d60];return _0x29664f;};'use strict';var _=require(_0x709b('0x0'));var util=require('util');var moment=require(_0x709b('0x1'));var BPromise=require(_0x709b('0x2'));var rs=require(_0x709b('0x3'));var fs=require('fs');var Redis=require(_0x709b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x709b('0x5'));var logger=require(_0x709b('0x6'))(_0x709b('0x7'));var config=require('../../config/environment');var jayson=require(_0x709b('0x8'));var client=jayson[_0x709b('0x9')][_0x709b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4012,_0x4d60f4,_0x5d180c){return new BPromise(function(_0x178fef,_0x3064e3){return client['request'](_0x5a4012,_0x5d180c)['then'](function(_0x47cee7){logger[_0x709b('0xb')](_0x709b('0xc'),_0x4d60f4,_0x709b('0xd'));logger[_0x709b('0xe')](_0x709b('0xf'),_0x4d60f4,_0x709b('0xd'),JSON[_0x709b('0x10')](_0x47cee7));if(_0x47cee7[_0x709b('0x11')]){if(_0x47cee7[_0x709b('0x11')][_0x709b('0x12')]===0x1f4){logger[_0x709b('0x11')](_0x709b('0xc'),_0x4d60f4,_0x47cee7[_0x709b('0x11')]['message']);return _0x3064e3(_0x47cee7[_0x709b('0x11')][_0x709b('0x13')]);}logger[_0x709b('0x11')](_0x709b('0xc'),_0x4d60f4,_0x47cee7[_0x709b('0x11')][_0x709b('0x13')]);return _0x178fef(_0x47cee7[_0x709b('0x11')][_0x709b('0x13')]);}else{logger[_0x709b('0xb')](_0x709b('0xc'),_0x4d60f4,_0x709b('0xd'));_0x178fef(_0x47cee7[_0x709b('0x14')][_0x709b('0x13')]);}})['catch'](function(_0x816072){logger['error'](_0x709b('0xc'),_0x4d60f4,_0x816072);_0x3064e3(_0x816072);});});} \ No newline at end of file +var _0x0b45=['jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','rpc','../../config/environment'];(function(_0x7025b0,_0x9533f1){var _0x6e444c=function(_0x258fe9){while(--_0x258fe9){_0x7025b0['push'](_0x7025b0['shift']());}};_0x6e444c(++_0x9533f1);}(_0x0b45,0x102));var _0x50b4=function(_0x4703fb,_0x462d4a){_0x4703fb=_0x4703fb-0x0;var _0x3ae04=_0x0b45[_0x4703fb];return _0x3ae04;};'use strict';var _=require('lodash');var util=require(_0x50b4('0x0'));var moment=require(_0x50b4('0x1'));var BPromise=require(_0x50b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50b4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50b4('0x4'));var config=require(_0x50b4('0x5'));var jayson=require(_0x50b4('0x6'));var client=jayson[_0x50b4('0x7')][_0x50b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb031ad,_0x488300,_0x44fe32){return new BPromise(function(_0x321f92,_0x1bee61){return client[_0x50b4('0x9')](_0xb031ad,_0x44fe32)[_0x50b4('0xa')](function(_0x5a05ce){logger[_0x50b4('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x488300,_0x50b4('0xc'));logger[_0x50b4('0xd')](_0x50b4('0xe'),_0x488300,_0x50b4('0xc'),JSON[_0x50b4('0xf')](_0x5a05ce));if(_0x5a05ce[_0x50b4('0x10')]){if(_0x5a05ce['error'][_0x50b4('0x11')]===0x1f4){logger[_0x50b4('0x10')](_0x50b4('0x12'),_0x488300,_0x5a05ce[_0x50b4('0x10')][_0x50b4('0x13')]);return _0x1bee61(_0x5a05ce[_0x50b4('0x10')][_0x50b4('0x13')]);}logger[_0x50b4('0x10')](_0x50b4('0x12'),_0x488300,_0x5a05ce[_0x50b4('0x10')][_0x50b4('0x13')]);return _0x321f92(_0x5a05ce[_0x50b4('0x10')][_0x50b4('0x13')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x488300,_0x50b4('0xc'));_0x321f92(_0x5a05ce[_0x50b4('0x14')][_0x50b4('0x13')]);}})[_0x50b4('0x15')](function(_0x4148f2){logger[_0x50b4('0x10')](_0x50b4('0x12'),_0x488300,_0x4148f2);_0x1bee61(_0x4148f2);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 19db724..bc961ab 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 _0xddf0=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xddf0,0x1f2));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0ddf('0x0'));var util=require(_0x0ddf('0x1'));var path=require('path');var timeout=require(_0x0ddf('0x2'));var express=require(_0x0ddf('0x3'));var router=express[_0x0ddf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0ddf('0x5'));var interaction=require(_0x0ddf('0x6'));var config=require(_0x0ddf('0x7'));var controller=require(_0x0ddf('0x8'));router[_0x0ddf('0x9')]('/',auth[_0x0ddf('0xa')](),controller[_0x0ddf('0xb')]);router[_0x0ddf('0x9')](_0x0ddf('0xc'),auth[_0x0ddf('0xa')](),controller[_0x0ddf('0xd')]);router[_0x0ddf('0x9')](_0x0ddf('0xe'),auth[_0x0ddf('0xa')](),controller[_0x0ddf('0xf')]);router[_0x0ddf('0x10')]('/',auth[_0x0ddf('0xa')](),controller[_0x0ddf('0x11')]);router[_0x0ddf('0x12')](_0x0ddf('0xe'),auth[_0x0ddf('0xa')](),controller[_0x0ddf('0x13')]);router[_0x0ddf('0x14')](_0x0ddf('0xe'),auth[_0x0ddf('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8b58=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/describe'];(function(_0xe37cad,_0x9fcbdd){var _0x24593e=function(_0x4170bb){while(--_0x4170bb){_0xe37cad['push'](_0xe37cad['shift']());}};_0x24593e(++_0x9fcbdd);}(_0x8b58,0x15e));var _0x88b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x88b5('0x0'));var util=require(_0x88b5('0x1'));var path=require(_0x88b5('0x2'));var timeout=require(_0x88b5('0x3'));var express=require(_0x88b5('0x4'));var router=express[_0x88b5('0x5')]();var fs_extra=require(_0x88b5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x88b5('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x88b5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x88b5('0x8')](_0x88b5('0x9'),auth[_0x88b5('0xa')](),controller['describe']);router['get'](_0x88b5('0xb'),auth[_0x88b5('0xa')](),controller[_0x88b5('0xc')]);router[_0x88b5('0xd')]('/',auth[_0x88b5('0xa')](),controller[_0x88b5('0xe')]);router[_0x88b5('0xf')](_0x88b5('0xb'),auth[_0x88b5('0xa')](),controller[_0x88b5('0x10')]);router[_0x88b5('0x11')](_0x88b5('0xb'),auth['isAuthenticated'](),controller[_0x88b5('0x12')]);module[_0x88b5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index be54943..427a57c 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 _0xc735=['exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x475bb8,_0x4fdd92){var _0x1a7db5=function(_0x41b59a){while(--_0x41b59a){_0x475bb8['push'](_0x475bb8['shift']());}};_0x1a7db5(++_0x4fdd92);}(_0xc735,0xfe));var _0x5c73=function(_0x3bf7aa,_0x13b581){_0x3bf7aa=_0x3bf7aa-0x0;var _0x1b1379=_0xc735[_0x3bf7aa];return _0x1b1379;};'use strict';var multer=require('multer');var util=require(_0x5c73('0x0'));var path=require(_0x5c73('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c73('0x2')]();var fs_extra=require(_0x5c73('0x3'));var auth=require(_0x5c73('0x4'));var interaction=require(_0x5c73('0x5'));var config=require(_0x5c73('0x6'));var controller=require(_0x5c73('0x7'));router[_0x5c73('0x8')]('/',auth[_0x5c73('0x9')](),controller[_0x5c73('0xa')]);router['get'](_0x5c73('0xb'),auth[_0x5c73('0x9')](),controller[_0x5c73('0xc')]);router['get'](_0x5c73('0xd'),auth[_0x5c73('0x9')](),controller[_0x5c73('0xe')]);router[_0x5c73('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5c73('0xf')]);router[_0x5c73('0x10')]('/',auth[_0x5c73('0x9')](),controller[_0x5c73('0x11')]);router['post']('/:id/configurations',auth[_0x5c73('0x9')](),controller[_0x5c73('0x12')]);router[_0x5c73('0x13')](_0x5c73('0xb'),auth[_0x5c73('0x9')](),controller[_0x5c73('0x14')]);router[_0x5c73('0x15')](_0x5c73('0xb'),auth[_0x5c73('0x9')](),controller['destroy']);module[_0x5c73('0x16')]=router; \ No newline at end of file +var _0x5865=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x168a00,_0x5d138d){var _0x21b8a6=function(_0x3e4b8d){while(--_0x3e4b8d){_0x168a00['push'](_0x168a00['shift']());}};_0x21b8a6(++_0x5d138d);}(_0x5865,0x1b5));var _0x5586=function(_0x5e6e3e,_0x32f251){_0x5e6e3e=_0x5e6e3e-0x0;var _0x29b4d2=_0x5865[_0x5e6e3e];return _0x29b4d2;};'use strict';var multer=require(_0x5586('0x0'));var util=require(_0x5586('0x1'));var path=require('path');var timeout=require(_0x5586('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5586('0x3'));var auth=require(_0x5586('0x4'));var interaction=require(_0x5586('0x5'));var config=require(_0x5586('0x6'));var controller=require(_0x5586('0x7'));router['get']('/',auth[_0x5586('0x8')](),controller['index']);router[_0x5586('0x9')](_0x5586('0xa'),auth[_0x5586('0x8')](),controller[_0x5586('0xb')]);router[_0x5586('0x9')]('/:id/configurations',auth[_0x5586('0x8')](),controller[_0x5586('0xc')]);router[_0x5586('0x9')](_0x5586('0xd'),auth[_0x5586('0x8')](),controller['getFields']);router[_0x5586('0xe')]('/',auth['isAuthenticated'](),controller[_0x5586('0xf')]);router[_0x5586('0xe')](_0x5586('0x10'),auth['isAuthenticated'](),controller[_0x5586('0x11')]);router[_0x5586('0x12')](_0x5586('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5586('0x13')](_0x5586('0xa'),auth[_0x5586('0x8')](),controller[_0x5586('0x14')]);module[_0x5586('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index d42e576..b5e120e 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 _0x99bd=['ENUM','integrationTab','newTab','sequelize','exports','STRING','basic'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x99bd,0xff));var _0xd99b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x99bd[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0xd99b('0x0'));module[_0xd99b('0x1')]={'name':{'type':Sequelize[_0xd99b('0x2')]},'description':{'type':Sequelize[_0xd99b('0x2')]},'username':{'type':Sequelize[_0xd99b('0x2')]},'remoteUri':{'type':Sequelize[_0xd99b('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xd99b('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xd99b('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xd99b('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xd99b('0x2')]},'serverUrl':{'type':Sequelize[_0xd99b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd99b('0x4')](_0xd99b('0x5'),_0xd99b('0x6')),'defaultValue':_0xd99b('0x5')}}; \ No newline at end of file +var _0xb538=['basic','integrationTab','newTab','sequelize','STRING','ENUM'];(function(_0x1221c3,_0x461ff6){var _0x2908e1=function(_0x3b070f){while(--_0x3b070f){_0x1221c3['push'](_0x1221c3['shift']());}};_0x2908e1(++_0x461ff6);}(_0xb538,0x13b));var _0x8b53=function(_0x9e3d2f,_0x3d2c29){_0x9e3d2f=_0x9e3d2f-0x0;var _0x26dbb2=_0xb538[_0x9e3d2f];return _0x26dbb2;};'use strict';var Sequelize=require(_0x8b53('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8b53('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x8b53('0x2')](_0x8b53('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x8b53('0x1')]},'consumerKey':{'type':Sequelize[_0x8b53('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8b53('0x1')]},'tokenSecret':{'type':Sequelize[_0x8b53('0x1')]},'serverUrl':{'type':Sequelize[_0x8b53('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8b53('0x2')](_0x8b53('0x4'),_0x8b53('0x5')),'defaultValue':_0x8b53('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 82265a5..acfcf8a 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 _0x214f=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','create','body','update','find','findOne','sort','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','DeskConfiguration','getFields','priority','authType','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','username','password','toString','base64','concat','_embedded','entries','active','label','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x214f,0x69));var _0xf214=function(_0x31b639,_0xd2a6c8){_0x31b639=_0x31b639-0x0;var _0x29b52e=_0x214f[_0x31b639];return _0x29b52e;};'use strict';var emlformat=require(_0xf214('0x0'));var rimraf=require(_0xf214('0x1'));var zipdir=require(_0xf214('0x2'));var jsonpatch=require(_0xf214('0x3'));var rp=require(_0xf214('0x4'));var moment=require(_0xf214('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf214('0x6'));var util=require(_0xf214('0x7'));var path=require(_0xf214('0x8'));var sox=require(_0xf214('0x9'));var csv=require(_0xf214('0xa'));var ejs=require(_0xf214('0xb'));var fs=require('fs');var fs_extra=require(_0xf214('0xc'));var _=require(_0xf214('0xd'));var squel=require(_0xf214('0xe'));var crypto=require('crypto');var jsforce=require(_0xf214('0xf'));var deskjs=require(_0xf214('0x10'));var toCsv=require(_0xf214('0xa'));var querystring=require(_0xf214('0x11'));var Papa=require(_0xf214('0x12'));var Redis=require(_0xf214('0x13'));var authService=require(_0xf214('0x14'));var qs=require(_0xf214('0x15'));var as=require(_0xf214('0x16'));var hardwareService=require(_0xf214('0x17'));var logger=require(_0xf214('0x18'))(_0xf214('0x19'));var utils=require(_0xf214('0x1a'));var config=require(_0xf214('0x1b'));var licenseUtil=require(_0xf214('0x1c'));var db=require(_0xf214('0x1d'))['db'];var integrations=require(_0xf214('0x1e'));function respondWithStatusCode(_0x33c135,_0xedc153){_0xedc153=_0xedc153||0xcc;return function(_0x1aa9bf){if(_0x1aa9bf){return _0x33c135[_0xf214('0x1f')](_0xedc153);}return _0x33c135[_0xf214('0x20')](_0xedc153)[_0xf214('0x21')]();};}function respondWithResult(_0x1afeab,_0x1490b4){_0x1490b4=_0x1490b4||0xc8;return function(_0x78ab86){if(_0x78ab86){return _0x1afeab[_0xf214('0x20')](_0x1490b4)[_0xf214('0x22')](_0x78ab86);}};}function respondWithFilteredResult(_0x13df8f,_0x1b0e81){return function(_0x23492b){if(_0x23492b){var _0x5d8f64=typeof _0x1b0e81[_0xf214('0x23')]===_0xf214('0x24')&&typeof _0x1b0e81[_0xf214('0x25')]==='undefined';var _0x304beb=_0x23492b[_0xf214('0x26')];var _0x5615a4=_0x5d8f64?0x0:_0x1b0e81[_0xf214('0x23')];var _0x54836c=_0x5d8f64?_0x23492b[_0xf214('0x26')]:_0x1b0e81['offset']+_0x1b0e81[_0xf214('0x25')];var _0x23aa74;if(_0x54836c>=_0x304beb){_0x54836c=_0x304beb;_0x23aa74=0xc8;}else{_0x23aa74=0xce;}_0x13df8f[_0xf214('0x20')](_0x23aa74);return _0x13df8f[_0xf214('0x27')](_0xf214('0x28'),_0x5615a4+'-'+_0x54836c+'/'+_0x304beb)[_0xf214('0x22')](_0x23492b);}return null;};}function patchUpdates(_0x47d80f){return function(_0x4d14af){try{jsonpatch[_0xf214('0x29')](_0x4d14af,_0x47d80f,!![]);}catch(_0x3bcbb6){return BPromise[_0xf214('0x2a')](_0x3bcbb6);}return _0x4d14af[_0xf214('0x2b')]();};}function saveUpdates(_0x149812,_0x47c726){return function(_0xdde2ac){if(_0xdde2ac){return _0xdde2ac['update'](_0x149812)[_0xf214('0x2c')](function(_0x1b9a51){return _0x1b9a51;});}return null;};}function removeEntity(_0x281d93,_0x590837){return function(_0x24c809){if(_0x24c809){return _0x24c809[_0xf214('0x2d')]()[_0xf214('0x2c')](function(){_0x281d93['status'](0xcc)[_0xf214('0x21')]();});}};}function handleEntityNotFound(_0x454eb3,_0x1e0136){return function(_0x429b0a){if(!_0x429b0a){_0x454eb3[_0xf214('0x1f')](0x194);}return _0x429b0a;};}function handleError(_0x48b53a,_0xea9b09){_0xea9b09=_0xea9b09||0x1f4;return function(_0x47d776){logger[_0xf214('0x2e')](_0x47d776[_0xf214('0x2f')]);if(_0x47d776[_0xf214('0x30')]){delete _0x47d776['name'];}_0x48b53a[_0xf214('0x20')](_0xea9b09)[_0xf214('0x31')](_0x47d776);};}exports['index']=function(_0x318bd2,_0x33816d){var _0x46ba6b={},_0x42afd6={},_0x171b55={'count':0x0,'rows':[]};var _0x198a3f=_[_0xf214('0x32')](db[_0xf214('0x33')][_0xf214('0x34')],function(_0x55b236){return{'name':_0x55b236[_0xf214('0x35')],'type':_0x55b236[_0xf214('0x36')][_0xf214('0x37')]};});_0x42afd6[_0xf214('0x38')]=_['map'](_0x198a3f,_0xf214('0x30'));_0x42afd6['query']=_[_0xf214('0x39')](_0x318bd2[_0xf214('0x3a')]);_0x42afd6['filters']=_['intersection'](_0x42afd6[_0xf214('0x38')],_0x42afd6['query']);_0x46ba6b['attributes']=_[_0xf214('0x3b')](_0x42afd6['model'],qs[_0xf214('0x3c')](_0x318bd2[_0xf214('0x3a')]['fields']));_0x46ba6b[_0xf214('0x3d')]=_0x46ba6b[_0xf214('0x3d')]['length']?_0x46ba6b[_0xf214('0x3d')]:_0x42afd6[_0xf214('0x38')];if(!_0x318bd2[_0xf214('0x3a')]['hasOwnProperty'](_0xf214('0x3e'))){_0x46ba6b[_0xf214('0x25')]=qs['limit'](_0x318bd2[_0xf214('0x3a')]['limit']);_0x46ba6b[_0xf214('0x23')]=qs[_0xf214('0x23')](_0x318bd2[_0xf214('0x3a')][_0xf214('0x23')]);}_0x46ba6b[_0xf214('0x3f')]=qs['sort'](_0x318bd2[_0xf214('0x3a')]['sort']);_0x46ba6b[_0xf214('0x40')]=qs['filters'](_[_0xf214('0x41')](_0x318bd2[_0xf214('0x3a')],_0x42afd6[_0xf214('0x42')]),_0x198a3f);if(_0x318bd2[_0xf214('0x3a')][_0xf214('0x43')]){_0x46ba6b[_0xf214('0x40')]=_[_0xf214('0x44')](_0x46ba6b[_0xf214('0x40')],{'$or':_[_0xf214('0x32')](_0x198a3f,function(_0x299a61){if(_0x299a61[_0xf214('0x36')]!==_0xf214('0x45')){var _0x4fa6a2={};_0x4fa6a2[_0x299a61['name']]={'$like':'%'+_0x318bd2[_0xf214('0x3a')]['filter']+'%'};return _0x4fa6a2;}})});}_0x46ba6b=_[_0xf214('0x44')]({},_0x46ba6b,_0x318bd2[_0xf214('0x46')]);var _0x41c2c8={'where':_0x46ba6b[_0xf214('0x40')]};return db[_0xf214('0x33')][_0xf214('0x26')](_0x41c2c8)[_0xf214('0x2c')](function(_0x20e74f){_0x171b55['count']=_0x20e74f;if(_0x318bd2['query']['includeAll']){_0x46ba6b[_0xf214('0x47')]=[{'all':!![]}];}return db[_0xf214('0x33')][_0xf214('0x48')](_0x46ba6b);})[_0xf214('0x2c')](function(_0x249395){_0x171b55[_0xf214('0x49')]=_0x249395;return _0x171b55;})[_0xf214('0x2c')](respondWithFilteredResult(_0x33816d,_0x46ba6b))[_0xf214('0x4a')](handleError(_0x33816d,null));};exports['show']=function(_0x211d41,_0x2bb97c){var _0x4e2acf={'raw':![],'where':{'id':_0x211d41[_0xf214('0x4b')]['id']}},_0xa50f45={};_0xa50f45[_0xf214('0x38')]=_[_0xf214('0x39')](db[_0xf214('0x33')][_0xf214('0x34')]);_0xa50f45[_0xf214('0x3a')]=_[_0xf214('0x39')](_0x211d41[_0xf214('0x3a')]);_0xa50f45[_0xf214('0x42')]=_[_0xf214('0x3b')](_0xa50f45[_0xf214('0x38')],_0xa50f45[_0xf214('0x3a')]);_0x4e2acf[_0xf214('0x3d')]=_[_0xf214('0x3b')](_0xa50f45['model'],qs['fields'](_0x211d41[_0xf214('0x3a')][_0xf214('0x3c')]));_0x4e2acf[_0xf214('0x3d')]=_0x4e2acf[_0xf214('0x3d')][_0xf214('0x4c')]?_0x4e2acf[_0xf214('0x3d')]:_0xa50f45[_0xf214('0x38')];if(_0x211d41[_0xf214('0x3a')][_0xf214('0x4d')]){_0x4e2acf[_0xf214('0x47')]=[{'all':!![]}];}_0x4e2acf=_[_0xf214('0x44')]({},_0x4e2acf,_0x211d41['options']);return db[_0xf214('0x33')]['find'](_0x4e2acf)[_0xf214('0x2c')](handleEntityNotFound(_0x2bb97c,null))[_0xf214('0x2c')](respondWithResult(_0x2bb97c,null))[_0xf214('0x4a')](handleError(_0x2bb97c,null));};exports[_0xf214('0x4e')]=function(_0x31e100,_0x5ef0ec){return db[_0xf214('0x33')][_0xf214('0x4e')](_0x31e100[_0xf214('0x4f')],{})[_0xf214('0x2c')](respondWithResult(_0x5ef0ec,0xc9))[_0xf214('0x4a')](handleError(_0x5ef0ec,null));};exports[_0xf214('0x50')]=function(_0xa865bf,_0x31993f){if(_0xa865bf[_0xf214('0x4f')]['id']){delete _0xa865bf['body']['id'];}return db[_0xf214('0x33')]['find']({'where':{'id':_0xa865bf[_0xf214('0x4b')]['id']}})['then'](handleEntityNotFound(_0x31993f,null))[_0xf214('0x2c')](saveUpdates(_0xa865bf[_0xf214('0x4f')],null))[_0xf214('0x2c')](respondWithResult(_0x31993f,null))['catch'](handleError(_0x31993f,null));};exports[_0xf214('0x2d')]=function(_0x1aa5ba,_0xeeefc0){return db[_0xf214('0x33')][_0xf214('0x51')]({'where':{'id':_0x1aa5ba[_0xf214('0x4b')]['id']}})['then'](handleEntityNotFound(_0xeeefc0,null))['then'](removeEntity(_0xeeefc0,null))[_0xf214('0x4a')](handleError(_0xeeefc0,null));};exports['getConfigurations']=function(_0x4e77c7,_0x2ad031,_0x570883){var _0xf99ca5={};var _0x115fe5={};var _0x941799;var _0x4d8e97;return db[_0xf214('0x33')][_0xf214('0x52')]({'where':{'id':_0x4e77c7[_0xf214('0x4b')]['id']}})[_0xf214('0x2c')](handleEntityNotFound(_0x2ad031,null))[_0xf214('0x2c')](function(_0x26d5c1){if(_0x26d5c1){_0x941799=_0x26d5c1;_0x115fe5[_0xf214('0x38')]=_[_0xf214('0x39')](db['DeskConfiguration']['rawAttributes']);_0x115fe5[_0xf214('0x3a')]=_['keys'](_0x4e77c7[_0xf214('0x3a')]);_0x115fe5[_0xf214('0x42')]=_[_0xf214('0x3b')](_0x115fe5[_0xf214('0x38')],_0x115fe5['query']);_0xf99ca5[_0xf214('0x3d')]=_[_0xf214('0x3b')](_0x115fe5['model'],qs[_0xf214('0x3c')](_0x4e77c7[_0xf214('0x3a')][_0xf214('0x3c')]));_0xf99ca5[_0xf214('0x3d')]=_0xf99ca5[_0xf214('0x3d')][_0xf214('0x4c')]?_0xf99ca5['attributes']:_0x115fe5[_0xf214('0x38')];_0xf99ca5[_0xf214('0x3f')]=qs['sort'](_0x4e77c7[_0xf214('0x3a')][_0xf214('0x53')]);_0xf99ca5[_0xf214('0x40')]=qs[_0xf214('0x42')](_[_0xf214('0x41')](_0x4e77c7[_0xf214('0x3a')],_0x115fe5[_0xf214('0x42')]));if(_0x4e77c7[_0xf214('0x3a')]['filter']){_0xf99ca5[_0xf214('0x40')]=_['merge'](_0xf99ca5['where'],{'$or':_[_0xf214('0x32')](_0xf99ca5[_0xf214('0x3d')],function(_0x4d91de){var _0x6fd468={};_0x6fd468[_0x4d91de]={'$like':'%'+_0x4e77c7[_0xf214('0x3a')][_0xf214('0x43')]+'%'};return _0x6fd468;})});}_0xf99ca5=_[_0xf214('0x44')]({},_0xf99ca5,_0x4e77c7[_0xf214('0x46')]);return _0x941799[_0xf214('0x54')](_0xf99ca5);}})['then'](function(_0x1b0042){if(_0x1b0042){_0x4d8e97=_0x1b0042['length'];if(!_0x4e77c7[_0xf214('0x3a')][_0xf214('0x55')]('nolimit')){_0xf99ca5[_0xf214('0x25')]=qs[_0xf214('0x25')](_0x4e77c7[_0xf214('0x3a')][_0xf214('0x25')]);_0xf99ca5[_0xf214('0x23')]=qs[_0xf214('0x23')](_0x4e77c7[_0xf214('0x3a')][_0xf214('0x23')]);}return _0x941799[_0xf214('0x54')](_0xf99ca5);}})[_0xf214('0x2c')](function(_0x22cb24){if(_0x22cb24){return _0x22cb24?{'count':_0x4d8e97,'rows':_0x22cb24}:null;}})['then'](respondWithResult(_0x2ad031,null))[_0xf214('0x4a')](handleError(_0x2ad031,null));};exports[_0xf214('0x56')]=function(_0x5ec9dd,_0x25718b,_0xd5f879){if(_0x5ec9dd[_0xf214('0x4f')]['id']){delete _0x5ec9dd[_0xf214('0x4f')]['id'];}return db[_0xf214('0x33')]['findOne']({'where':{'id':_0x5ec9dd[_0xf214('0x4b')]['id']}})[_0xf214('0x2c')](handleEntityNotFound(_0x25718b,null))[_0xf214('0x2c')](function(_0x536ef7){if(_0x536ef7){_0x5ec9dd[_0xf214('0x4f')]['AccountId']=_0x536ef7['id'];_0x5ec9dd[_0xf214('0x4f')][_0xf214('0x57')]=integrations[_0xf214('0x58')](_0x5ec9dd['body'][_0xf214('0x59')],_0x5ec9dd['body'][_0xf214('0x36')]);_0x5ec9dd[_0xf214('0x4f')][_0xf214('0x5a')]=integrations['getDescriptions'](_0x5ec9dd[_0xf214('0x4f')][_0xf214('0x59')],_0x5ec9dd['body'][_0xf214('0x36')]);return db[_0xf214('0x5b')][_0xf214('0x4e')](_0x5ec9dd['body'],{'include':[{'model':db['DeskField'],'as':_0xf214('0x57')},{'model':db['DeskField'],'as':_0xf214('0x5a')}]});}return null;})[_0xf214('0x2c')](respondWithResult(_0x25718b,null))[_0xf214('0x4a')](handleError(_0x25718b,null));};exports[_0xf214('0x5c')]=function(_0x177d81,_0x39242b,_0x551707){var _0x44fbfe=[{'name':_0xf214('0x5d'),'label':_0xf214('0x5d'),'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 _0x24c290='';return db[_0xf214('0x33')][_0xf214('0x52')]({'where':{'id':_0x177d81[_0xf214('0x4b')]['id']},'attributes':['id','remoteUri',_0xf214('0x5e'),'username','password','consumerKey','consumerSecret',_0xf214('0x5f'),_0xf214('0x60')]})['then'](handleEntityNotFound(_0x39242b,null))[_0xf214('0x2c')](function(_0x4299f5){if(_0x4299f5){_0x24c290=_0x4299f5[_0xf214('0x61')];var _0x5e2031=_0x24c290[_0xf214('0x62')](-0x1);if(_0x5e2031==='/'){_0x24c290=_0x24c290[_0xf214('0x63')](0x0,_0x24c290[_0xf214('0x64')](_0x5e2031));}var _0x49c6ff={'method':_0xf214('0x65'),'uri':util[_0xf214('0x66')](_0xf214('0x67'),_0x24c290),'headers':{'Content-Type':'application/json','Accept':_0xf214('0x68')},'json':!![]};if(_0x4299f5[_0xf214('0x5e')]==='basic'){_0x49c6ff[_0xf214('0x69')][_0xf214('0x6a')]=util[_0xf214('0x66')](_0xf214('0x6b'),new Buffer(util[_0xf214('0x66')](_0xf214('0x6c'),_0x4299f5[_0xf214('0x6d')],_0x4299f5[_0xf214('0x6e')]))[_0xf214('0x6f')](_0xf214('0x70')));}return rp(_0x49c6ff)[_0xf214('0x2c')](function(_0x4e2bfd){return _0x44fbfe[_0xf214('0x71')](_[_0xf214('0x32')](_0x4e2bfd[_0xf214('0x72')][_0xf214('0x73')],function(_0x52cd01){return{'id':_0x52cd01[_0xf214('0x30')],'name':_0x52cd01[_0xf214('0x30')],'type':_0x52cd01[_0xf214('0x36')],'active':_0x52cd01[_0xf214('0x74')],'label':_0x52cd01[_0xf214('0x75')],'custom':!![]};}));});}})[_0xf214('0x2c')](function(_0xde87a7){return{'count':_0xde87a7[_0xf214('0x4c')],'rows':_0xde87a7};})[_0xf214('0x2c')](respondWithResult(_0x39242b,null))['catch'](function(_0x161333){var _0x59f498=_0x177d81[_0xf214('0x3a')][_0xf214('0x76')]?0x1f4:_0x161333[_0xf214('0x77')]||0x1f4;logger[_0xf214('0x2e')]('getFields,\x20%s,\x20%s,\x20%s',_0xf214('0x5c'),_0x59f498,JSON[_0xf214('0x78')](_0x161333));delete _0x161333[_0xf214('0x30')];if(_0x59f498===0x191){_0x59f498=0x190;}_0x39242b[_0xf214('0x20')](_0x59f498)[_0xf214('0x31')](_0x177d81[_0xf214('0x3a')][_0xf214('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x161333[_0xf214('0x77')]}:_0x161333);});}; \ No newline at end of file +var _0xcf26=['util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','DeskAccount','rawAttributes','type','key','model','map','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','include','rows','catch','show','keys','length','includeAll','create','body','update','find','params','findOne','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','Subjects','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','Authorization','Basic\x20%s','toString','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x1d25ef,_0x326e0c){var _0x307a11=function(_0x5ba199){while(--_0x5ba199){_0x1d25ef['push'](_0x1d25ef['shift']());}};_0x307a11(++_0x326e0c);}(_0xcf26,0x149));var _0x6cf2=function(_0x19c6a6,_0x36701d){_0x19c6a6=_0x19c6a6-0x0;var _0x29014=_0xcf26[_0x19c6a6];return _0x29014;};'use strict';var emlformat=require(_0x6cf2('0x0'));var rimraf=require(_0x6cf2('0x1'));var zipdir=require(_0x6cf2('0x2'));var jsonpatch=require(_0x6cf2('0x3'));var rp=require(_0x6cf2('0x4'));var moment=require(_0x6cf2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6cf2('0x6'));var util=require(_0x6cf2('0x7'));var path=require(_0x6cf2('0x8'));var sox=require(_0x6cf2('0x9'));var csv=require('to-csv');var ejs=require(_0x6cf2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6cf2('0xb'));var jsforce=require(_0x6cf2('0xc'));var deskjs=require(_0x6cf2('0xd'));var toCsv=require(_0x6cf2('0xe'));var querystring=require(_0x6cf2('0xf'));var Papa=require(_0x6cf2('0x10'));var Redis=require(_0x6cf2('0x11'));var authService=require(_0x6cf2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6cf2('0x13'));var hardwareService=require(_0x6cf2('0x14'));var logger=require(_0x6cf2('0x15'))(_0x6cf2('0x16'));var utils=require(_0x6cf2('0x17'));var config=require(_0x6cf2('0x18'));var licenseUtil=require(_0x6cf2('0x19'));var db=require(_0x6cf2('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x351bab,_0x143667){_0x143667=_0x143667||0xcc;return function(_0x5be92c){if(_0x5be92c){return _0x351bab[_0x6cf2('0x1b')](_0x143667);}return _0x351bab['status'](_0x143667)[_0x6cf2('0x1c')]();};}function respondWithResult(_0x3bb392,_0x576a42){_0x576a42=_0x576a42||0xc8;return function(_0x163083){if(_0x163083){return _0x3bb392['status'](_0x576a42)[_0x6cf2('0x1d')](_0x163083);}};}function respondWithFilteredResult(_0xeabe76,_0xdb86f9){return function(_0x4952bc){if(_0x4952bc){var _0xcdb789=typeof _0xdb86f9['offset']===_0x6cf2('0x1e')&&typeof _0xdb86f9[_0x6cf2('0x1f')]===_0x6cf2('0x1e');var _0x500cdd=_0x4952bc['count'];var _0xdbf0be=_0xcdb789?0x0:_0xdb86f9[_0x6cf2('0x20')];var _0x500a23=_0xcdb789?_0x4952bc[_0x6cf2('0x21')]:_0xdb86f9[_0x6cf2('0x20')]+_0xdb86f9[_0x6cf2('0x1f')];var _0x13eb8d;if(_0x500a23>=_0x500cdd){_0x500a23=_0x500cdd;_0x13eb8d=0xc8;}else{_0x13eb8d=0xce;}_0xeabe76[_0x6cf2('0x22')](_0x13eb8d);return _0xeabe76[_0x6cf2('0x23')](_0x6cf2('0x24'),_0xdbf0be+'-'+_0x500a23+'/'+_0x500cdd)[_0x6cf2('0x1d')](_0x4952bc);}return null;};}function patchUpdates(_0x2ab64d){return function(_0x157ecf){try{jsonpatch[_0x6cf2('0x25')](_0x157ecf,_0x2ab64d,!![]);}catch(_0x496bc4){return BPromise[_0x6cf2('0x26')](_0x496bc4);}return _0x157ecf[_0x6cf2('0x27')]();};}function saveUpdates(_0x20f04a,_0xc1f0c4){return function(_0x3050b4){if(_0x3050b4){return _0x3050b4['update'](_0x20f04a)[_0x6cf2('0x28')](function(_0x430bc7){return _0x430bc7;});}return null;};}function removeEntity(_0x5c5a79,_0x2277da){return function(_0x27f092){if(_0x27f092){return _0x27f092[_0x6cf2('0x29')]()[_0x6cf2('0x28')](function(){_0x5c5a79[_0x6cf2('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d461e,_0x2255e4){return function(_0x2b7c9f){if(!_0x2b7c9f){_0x5d461e[_0x6cf2('0x1b')](0x194);}return _0x2b7c9f;};}function handleError(_0x35da50,_0x47867f){_0x47867f=_0x47867f||0x1f4;return function(_0x36e663){logger[_0x6cf2('0x2a')](_0x36e663[_0x6cf2('0x2b')]);if(_0x36e663[_0x6cf2('0x2c')]){delete _0x36e663[_0x6cf2('0x2c')];}_0x35da50[_0x6cf2('0x22')](_0x47867f)['send'](_0x36e663);};}exports['index']=function(_0x4a82a7,_0x334adc){var _0x49a140={},_0x5ee1a1={},_0x344efc={'count':0x0,'rows':[]};var _0x73e014=_['map'](db[_0x6cf2('0x2d')][_0x6cf2('0x2e')],function(_0x1a51a5){return{'name':_0x1a51a5['fieldName'],'type':_0x1a51a5[_0x6cf2('0x2f')][_0x6cf2('0x30')]};});_0x5ee1a1[_0x6cf2('0x31')]=_[_0x6cf2('0x32')](_0x73e014,_0x6cf2('0x2c'));_0x5ee1a1['query']=_['keys'](_0x4a82a7['query']);_0x5ee1a1['filters']=_[_0x6cf2('0x33')](_0x5ee1a1[_0x6cf2('0x31')],_0x5ee1a1[_0x6cf2('0x34')]);_0x49a140[_0x6cf2('0x35')]=_[_0x6cf2('0x33')](_0x5ee1a1[_0x6cf2('0x31')],qs[_0x6cf2('0x36')](_0x4a82a7['query'][_0x6cf2('0x36')]));_0x49a140['attributes']=_0x49a140[_0x6cf2('0x35')]['length']?_0x49a140[_0x6cf2('0x35')]:_0x5ee1a1['model'];if(!_0x4a82a7['query'][_0x6cf2('0x37')](_0x6cf2('0x38'))){_0x49a140[_0x6cf2('0x1f')]=qs[_0x6cf2('0x1f')](_0x4a82a7['query']['limit']);_0x49a140[_0x6cf2('0x20')]=qs[_0x6cf2('0x20')](_0x4a82a7[_0x6cf2('0x34')][_0x6cf2('0x20')]);}_0x49a140[_0x6cf2('0x39')]=qs[_0x6cf2('0x3a')](_0x4a82a7[_0x6cf2('0x34')][_0x6cf2('0x3a')]);_0x49a140[_0x6cf2('0x3b')]=qs[_0x6cf2('0x3c')](_[_0x6cf2('0x3d')](_0x4a82a7[_0x6cf2('0x34')],_0x5ee1a1[_0x6cf2('0x3c')]),_0x73e014);if(_0x4a82a7[_0x6cf2('0x34')][_0x6cf2('0x3e')]){_0x49a140[_0x6cf2('0x3b')]=_['merge'](_0x49a140['where'],{'$or':_[_0x6cf2('0x32')](_0x73e014,function(_0x5721d4){if(_0x5721d4[_0x6cf2('0x2f')]!=='VIRTUAL'){var _0x224241={};_0x224241[_0x5721d4[_0x6cf2('0x2c')]]={'$like':'%'+_0x4a82a7['query'][_0x6cf2('0x3e')]+'%'};return _0x224241;}})});}_0x49a140=_['merge']({},_0x49a140,_0x4a82a7[_0x6cf2('0x3f')]);var _0x405ca5={'where':_0x49a140[_0x6cf2('0x3b')]};return db[_0x6cf2('0x2d')][_0x6cf2('0x21')](_0x405ca5)['then'](function(_0x225921){_0x344efc[_0x6cf2('0x21')]=_0x225921;if(_0x4a82a7['query']['includeAll']){_0x49a140[_0x6cf2('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x49a140);})[_0x6cf2('0x28')](function(_0x41179a){_0x344efc[_0x6cf2('0x41')]=_0x41179a;return _0x344efc;})[_0x6cf2('0x28')](respondWithFilteredResult(_0x334adc,_0x49a140))[_0x6cf2('0x42')](handleError(_0x334adc,null));};exports[_0x6cf2('0x43')]=function(_0x3b1149,_0x5e8d98){var _0x1e196b={'raw':![],'where':{'id':_0x3b1149['params']['id']}},_0x100820={};_0x100820[_0x6cf2('0x31')]=_[_0x6cf2('0x44')](db[_0x6cf2('0x2d')]['rawAttributes']);_0x100820[_0x6cf2('0x34')]=_[_0x6cf2('0x44')](_0x3b1149[_0x6cf2('0x34')]);_0x100820[_0x6cf2('0x3c')]=_[_0x6cf2('0x33')](_0x100820[_0x6cf2('0x31')],_0x100820[_0x6cf2('0x34')]);_0x1e196b[_0x6cf2('0x35')]=_[_0x6cf2('0x33')](_0x100820['model'],qs[_0x6cf2('0x36')](_0x3b1149['query'][_0x6cf2('0x36')]));_0x1e196b[_0x6cf2('0x35')]=_0x1e196b[_0x6cf2('0x35')][_0x6cf2('0x45')]?_0x1e196b['attributes']:_0x100820['model'];if(_0x3b1149[_0x6cf2('0x34')][_0x6cf2('0x46')]){_0x1e196b[_0x6cf2('0x40')]=[{'all':!![]}];}_0x1e196b=_['merge']({},_0x1e196b,_0x3b1149['options']);return db[_0x6cf2('0x2d')]['find'](_0x1e196b)[_0x6cf2('0x28')](handleEntityNotFound(_0x5e8d98,null))[_0x6cf2('0x28')](respondWithResult(_0x5e8d98,null))[_0x6cf2('0x42')](handleError(_0x5e8d98,null));};exports[_0x6cf2('0x47')]=function(_0x2612f1,_0x372971){return db[_0x6cf2('0x2d')][_0x6cf2('0x47')](_0x2612f1[_0x6cf2('0x48')],{})['then'](respondWithResult(_0x372971,0xc9))[_0x6cf2('0x42')](handleError(_0x372971,null));};exports[_0x6cf2('0x49')]=function(_0x89cea5,_0x18cfba){if(_0x89cea5[_0x6cf2('0x48')]['id']){delete _0x89cea5['body']['id'];}return db[_0x6cf2('0x2d')][_0x6cf2('0x4a')]({'where':{'id':_0x89cea5[_0x6cf2('0x4b')]['id']}})[_0x6cf2('0x28')](handleEntityNotFound(_0x18cfba,null))['then'](saveUpdates(_0x89cea5[_0x6cf2('0x48')],null))[_0x6cf2('0x28')](respondWithResult(_0x18cfba,null))[_0x6cf2('0x42')](handleError(_0x18cfba,null));};exports[_0x6cf2('0x29')]=function(_0x44b686,_0x5b8c27){return db[_0x6cf2('0x2d')][_0x6cf2('0x4a')]({'where':{'id':_0x44b686[_0x6cf2('0x4b')]['id']}})[_0x6cf2('0x28')](handleEntityNotFound(_0x5b8c27,null))[_0x6cf2('0x28')](removeEntity(_0x5b8c27,null))[_0x6cf2('0x42')](handleError(_0x5b8c27,null));};exports['getConfigurations']=function(_0x2d0bed,_0x3e8bdf,_0x18d50f){var _0x27d525={};var _0xdeee1b={};var _0x2763ad;var _0xdef523;return db[_0x6cf2('0x2d')][_0x6cf2('0x4c')]({'where':{'id':_0x2d0bed[_0x6cf2('0x4b')]['id']}})[_0x6cf2('0x28')](handleEntityNotFound(_0x3e8bdf,null))[_0x6cf2('0x28')](function(_0x4868cd){if(_0x4868cd){_0x2763ad=_0x4868cd;_0xdeee1b[_0x6cf2('0x31')]=_[_0x6cf2('0x44')](db['DeskConfiguration'][_0x6cf2('0x2e')]);_0xdeee1b['query']=_['keys'](_0x2d0bed[_0x6cf2('0x34')]);_0xdeee1b[_0x6cf2('0x3c')]=_[_0x6cf2('0x33')](_0xdeee1b[_0x6cf2('0x31')],_0xdeee1b['query']);_0x27d525[_0x6cf2('0x35')]=_[_0x6cf2('0x33')](_0xdeee1b[_0x6cf2('0x31')],qs['fields'](_0x2d0bed[_0x6cf2('0x34')][_0x6cf2('0x36')]));_0x27d525[_0x6cf2('0x35')]=_0x27d525[_0x6cf2('0x35')][_0x6cf2('0x45')]?_0x27d525['attributes']:_0xdeee1b['model'];_0x27d525['order']=qs[_0x6cf2('0x3a')](_0x2d0bed['query'][_0x6cf2('0x3a')]);_0x27d525['where']=qs['filters'](_[_0x6cf2('0x3d')](_0x2d0bed['query'],_0xdeee1b[_0x6cf2('0x3c')]));if(_0x2d0bed['query'][_0x6cf2('0x3e')]){_0x27d525[_0x6cf2('0x3b')]=_['merge'](_0x27d525[_0x6cf2('0x3b')],{'$or':_[_0x6cf2('0x32')](_0x27d525[_0x6cf2('0x35')],function(_0xe45a57){var _0x3f8a07={};_0x3f8a07[_0xe45a57]={'$like':'%'+_0x2d0bed['query'][_0x6cf2('0x3e')]+'%'};return _0x3f8a07;})});}_0x27d525=_['merge']({},_0x27d525,_0x2d0bed[_0x6cf2('0x3f')]);return _0x2763ad[_0x6cf2('0x4d')](_0x27d525);}})[_0x6cf2('0x28')](function(_0x22ad7a){if(_0x22ad7a){_0xdef523=_0x22ad7a[_0x6cf2('0x45')];if(!_0x2d0bed[_0x6cf2('0x34')][_0x6cf2('0x37')](_0x6cf2('0x38'))){_0x27d525[_0x6cf2('0x1f')]=qs[_0x6cf2('0x1f')](_0x2d0bed['query'][_0x6cf2('0x1f')]);_0x27d525[_0x6cf2('0x20')]=qs[_0x6cf2('0x20')](_0x2d0bed[_0x6cf2('0x34')]['offset']);}return _0x2763ad[_0x6cf2('0x4d')](_0x27d525);}})[_0x6cf2('0x28')](function(_0x4b433b){if(_0x4b433b){return _0x4b433b?{'count':_0xdef523,'rows':_0x4b433b}:null;}})[_0x6cf2('0x28')](respondWithResult(_0x3e8bdf,null))[_0x6cf2('0x42')](handleError(_0x3e8bdf,null));};exports[_0x6cf2('0x4e')]=function(_0x3f65df,_0x5025ca,_0x1ff76d){if(_0x3f65df[_0x6cf2('0x48')]['id']){delete _0x3f65df[_0x6cf2('0x48')]['id'];}return db[_0x6cf2('0x2d')][_0x6cf2('0x4c')]({'where':{'id':_0x3f65df['params']['id']}})[_0x6cf2('0x28')](handleEntityNotFound(_0x5025ca,null))['then'](function(_0x5d827e){if(_0x5d827e){_0x3f65df['body'][_0x6cf2('0x4f')]=_0x5d827e['id'];_0x3f65df['body']['Subjects']=integrations[_0x6cf2('0x50')](_0x3f65df[_0x6cf2('0x48')][_0x6cf2('0x51')],_0x3f65df[_0x6cf2('0x48')][_0x6cf2('0x2f')]);_0x3f65df['body'][_0x6cf2('0x52')]=integrations[_0x6cf2('0x53')](_0x3f65df[_0x6cf2('0x48')][_0x6cf2('0x51')],_0x3f65df[_0x6cf2('0x48')][_0x6cf2('0x2f')]);return db[_0x6cf2('0x54')]['create'](_0x3f65df[_0x6cf2('0x48')],{'include':[{'model':db[_0x6cf2('0x55')],'as':_0x6cf2('0x56')},{'model':db['DeskField'],'as':_0x6cf2('0x52')}]});}return null;})[_0x6cf2('0x28')](respondWithResult(_0x5025ca,null))[_0x6cf2('0x42')](handleError(_0x5025ca,null));};exports[_0x6cf2('0x57')]=function(_0x5d01cf,_0x22e9b5,_0xc3f537){var _0x2f1bf2=[{'name':_0x6cf2('0x58'),'label':_0x6cf2('0x58'),'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 _0x22c972='';return db[_0x6cf2('0x2d')][_0x6cf2('0x4c')]({'where':{'id':_0x5d01cf[_0x6cf2('0x4b')]['id']},'attributes':['id',_0x6cf2('0x59'),'authType',_0x6cf2('0x5a'),_0x6cf2('0x5b'),_0x6cf2('0x5c'),_0x6cf2('0x5d'),_0x6cf2('0x5e'),_0x6cf2('0x5f')]})[_0x6cf2('0x28')](handleEntityNotFound(_0x22e9b5,null))['then'](function(_0x14f552){if(_0x14f552){_0x22c972=_0x14f552[_0x6cf2('0x59')];var _0x619eab=_0x22c972['slice'](-0x1);if(_0x619eab==='/'){_0x22c972=_0x22c972[_0x6cf2('0x60')](0x0,_0x22c972[_0x6cf2('0x61')](_0x619eab));}var _0x4c0491={'method':'GET','uri':util[_0x6cf2('0x62')](_0x6cf2('0x63'),_0x22c972),'headers':{'Content-Type':_0x6cf2('0x64'),'Accept':_0x6cf2('0x64')},'json':!![]};if(_0x14f552[_0x6cf2('0x65')]==='basic'){_0x4c0491['headers'][_0x6cf2('0x66')]=util[_0x6cf2('0x62')](_0x6cf2('0x67'),new Buffer(util[_0x6cf2('0x62')]('%s:%s',_0x14f552[_0x6cf2('0x5a')],_0x14f552[_0x6cf2('0x5b')]))[_0x6cf2('0x68')]('base64'));}return rp(_0x4c0491)[_0x6cf2('0x28')](function(_0x5505d5){return _0x2f1bf2['concat'](_[_0x6cf2('0x32')](_0x5505d5['_embedded'][_0x6cf2('0x69')],function(_0x1a3f63){return{'id':_0x1a3f63[_0x6cf2('0x2c')],'name':_0x1a3f63[_0x6cf2('0x2c')],'type':_0x1a3f63[_0x6cf2('0x2f')],'active':_0x1a3f63[_0x6cf2('0x6a')],'label':_0x1a3f63[_0x6cf2('0x6b')],'custom':!![]};}));});}})[_0x6cf2('0x28')](function(_0x5df38c){return{'count':_0x5df38c[_0x6cf2('0x45')],'rows':_0x5df38c};})[_0x6cf2('0x28')](respondWithResult(_0x22e9b5,null))[_0x6cf2('0x42')](function(_0x1bd94c){var _0x3faac7=_0x5d01cf[_0x6cf2('0x34')][_0x6cf2('0x6c')]?0x1f4:_0x1bd94c[_0x6cf2('0x6d')]||0x1f4;logger[_0x6cf2('0x2a')](_0x6cf2('0x6e'),'getFields',_0x3faac7,JSON['stringify'](_0x1bd94c));delete _0x1bd94c[_0x6cf2('0x2c')];if(_0x3faac7===0x191){_0x3faac7=0x190;}_0x22e9b5['status'](_0x3faac7)[_0x6cf2('0x6f')](_0x5d01cf[_0x6cf2('0x34')][_0x6cf2('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x1bd94c['statusCode']}:_0x1bd94c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8d8f390..3d4f819 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 _0x46c7=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x46c7,0x13a));var _0x746c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x46c7[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x746c('0x0'));var util=require(_0x746c('0x1'));var logger=require(_0x746c('0x2'))(_0x746c('0x3'));var moment=require(_0x746c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x746c('0x5'));var rimraf=require('rimraf');var config=require(_0x746c('0x6'));var attributes=require(_0x746c('0x7'));var integrations=require(_0x746c('0x8'));module[_0x746c('0x9')]=function(_0x4e779d,_0x19cf63){return _0x4e779d[_0x746c('0xa')](_0x746c('0xb'),attributes,{'tableName':_0x746c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ed2=['path','../../components/integrations/configuration','define','DeskAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5d5d44,_0x322f78){var _0x4a76cd=function(_0x15e72b){while(--_0x15e72b){_0x5d5d44['push'](_0x5d5d44['shift']());}};_0x4a76cd(++_0x322f78);}(_0x7ed2,0x12d));var _0x27ed=function(_0x1c067d,_0x23cb65){_0x1c067d=_0x1c067d-0x0;var _0x3bbcbb=_0x7ed2[_0x1c067d];return _0x3bbcbb;};'use strict';var _=require(_0x27ed('0x0'));var util=require('util');var logger=require(_0x27ed('0x1'))('api');var moment=require(_0x27ed('0x2'));var BPromise=require(_0x27ed('0x3'));var rp=require(_0x27ed('0x4'));var fs=require('fs');var path=require(_0x27ed('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x27ed('0x6'));module['exports']=function(_0x1b6df7,_0x2787ee){return _0x1b6df7[_0x27ed('0x7')](_0x27ed('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 0a296d0..5f324ed 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 _0x003f=['findAll','options','raw','where','include','map','model','attributes','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','info','result','GetDeskAccount','DeskAccount'];(function(_0x3419c5,_0x5031ee){var _0x5d3f97=function(_0x5e10ab){while(--_0x5e10ab){_0x3419c5['push'](_0x3419c5['shift']());}};_0x5d3f97(++_0x5031ee);}(_0x003f,0x1bb));var _0xf003=function(_0x563857,_0x5ca0af){_0x563857=_0x563857-0x0;var _0x2dd922=_0x003f[_0x563857];return _0x2dd922;};'use strict';var _=require(_0xf003('0x0'));var util=require(_0xf003('0x1'));var moment=require(_0xf003('0x2'));var BPromise=require(_0xf003('0x3'));var rs=require(_0xf003('0x4'));var fs=require('fs');var Redis=require(_0xf003('0x5'));var db=require(_0xf003('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf003('0x7'))(_0xf003('0x8'));var config=require(_0xf003('0x9'));var jayson=require(_0xf003('0xa'));var client=jayson['client'][_0xf003('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21922c,_0x113ff6,_0x306556){return new BPromise(function(_0x2070a9,_0x59f492){return client[_0xf003('0xc')](_0x21922c,_0x306556)[_0xf003('0xd')](function(_0x45a229){logger['info']('DeskAccount,\x20%s,\x20%s',_0x113ff6,_0xf003('0xe'));logger[_0xf003('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x113ff6,'request\x20sent',JSON[_0xf003('0x10')](_0x45a229));if(_0x45a229[_0xf003('0x11')]){if(_0x45a229[_0xf003('0x11')][_0xf003('0x12')]===0x1f4){logger[_0xf003('0x11')](_0xf003('0x13'),_0x113ff6,_0x45a229[_0xf003('0x11')][_0xf003('0x14')]);return _0x59f492(_0x45a229[_0xf003('0x11')][_0xf003('0x14')]);}logger[_0xf003('0x11')](_0xf003('0x13'),_0x113ff6,_0x45a229['error']['message']);return _0x2070a9(_0x45a229[_0xf003('0x11')][_0xf003('0x14')]);}else{logger[_0xf003('0x15')](_0xf003('0x13'),_0x113ff6,_0xf003('0xe'));_0x2070a9(_0x45a229[_0xf003('0x16')][_0xf003('0x14')]);}})['catch'](function(_0x23a476){logger[_0xf003('0x11')](_0xf003('0x13'),_0x113ff6,_0x23a476);_0x59f492(_0x23a476);});});}exports[_0xf003('0x17')]=function(_0x38441d){var _0xb55d0c=this;return new Promise(function(_0x888052,_0x5a7bf5){return db[_0xf003('0x18')][_0xf003('0x19')]({'raw':_0x38441d['options']?_0x38441d[_0xf003('0x1a')][_0xf003('0x1b')]===undefined?!![]:![]:!![],'where':_0x38441d[_0xf003('0x1a')]?_0x38441d[_0xf003('0x1a')][_0xf003('0x1c')]||null:null,'attributes':_0x38441d[_0xf003('0x1a')]?_0x38441d['options']['attributes']||null:null,'limit':_0x38441d[_0xf003('0x1a')]?_0x38441d[_0xf003('0x1a')]['limit']||null:null,'include':_0x38441d[_0xf003('0x1a')]?_0x38441d[_0xf003('0x1a')][_0xf003('0x1d')]?_[_0xf003('0x1e')](_0x38441d[_0xf003('0x1a')][_0xf003('0x1d')],function(_0x594f2f){return{'model':db[_0x594f2f[_0xf003('0x1f')]],'as':_0x594f2f['as'],'attributes':_0x594f2f[_0xf003('0x20')],'include':_0x594f2f['include']?_[_0xf003('0x1e')](_0x594f2f['include'],function(_0x2e65d3){return{'model':db[_0x2e65d3[_0xf003('0x1f')]],'as':_0x2e65d3['as'],'attributes':_0x2e65d3[_0xf003('0x20')],'include':_0x2e65d3[_0xf003('0x1d')]?_['map'](_0x2e65d3[_0xf003('0x1d')],function(_0x42fbd2){return{'model':db[_0x42fbd2[_0xf003('0x1f')]],'as':_0x42fbd2['as'],'attributes':_0x42fbd2[_0xf003('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27ffd9){logger['info'](_0xf003('0x17'),_0x38441d);logger['debug'](_0xf003('0x17'),_0x38441d,JSON[_0xf003('0x10')](_0x27ffd9));_0x888052(_0x27ffd9);})[_0xf003('0x21')](function(_0x1365b2){logger[_0xf003('0x11')](_0xf003('0x17'),_0x1365b2[_0xf003('0x14')],_0x38441d);_0x5a7bf5(_0xb55d0c[_0xf003('0x11')](0x1f4,_0x1365b2[_0xf003('0x14')]));});});};exports[_0xf003('0x22')]=function(_0x2b381e){var _0x4926dd=this;return new Promise(function(_0x37c395,_0x4b264c){return db[_0xf003('0x18')][_0xf003('0x23')]({'raw':_0x2b381e[_0xf003('0x1a')]?_0x2b381e[_0xf003('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2b381e[_0xf003('0x1a')]?_0x2b381e['options']['where']||null:null,'attributes':_0x2b381e[_0xf003('0x1a')]?_0x2b381e[_0xf003('0x1a')]['attributes']||null:null,'include':_0x2b381e[_0xf003('0x1a')]?_0x2b381e['options'][_0xf003('0x1d')]?_[_0xf003('0x1e')](_0x2b381e[_0xf003('0x1a')][_0xf003('0x1d')],function(_0x258b49){return{'model':db[_0x258b49[_0xf003('0x1f')]],'as':_0x258b49['as'],'attributes':_0x258b49['attributes'],'include':_0x258b49[_0xf003('0x1d')]?_[_0xf003('0x1e')](_0x258b49[_0xf003('0x1d')],function(_0x5eddb3){return{'model':db[_0x5eddb3[_0xf003('0x1f')]],'as':_0x5eddb3['as'],'attributes':_0x5eddb3['attributes'],'include':_0x5eddb3[_0xf003('0x1d')]?_['map'](_0x5eddb3['include'],function(_0x511245){return{'model':db[_0x511245['model']],'as':_0x511245['as'],'attributes':_0x511245[_0xf003('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf003('0xd')](function(_0x30d406){logger['info'](_0xf003('0x22'),_0x2b381e);logger[_0xf003('0xf')](_0xf003('0x22'),_0x2b381e,JSON['stringify'](_0x30d406));_0x37c395(_0x30d406);})[_0xf003('0x21')](function(_0xe002d){logger[_0xf003('0x11')](_0xf003('0x22'),_0xe002d[_0xf003('0x14')],_0x2b381e);_0x4b264c(_0x4926dd[_0xf003('0x11')](0x1f4,_0xe002d[_0xf003('0x14')]));});});}; \ No newline at end of file +var _0xe959=['GetDeskAccount','ShowDeskAccount','DeskAccount','find','then','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','options','where','limit','map','attributes','include','model'];(function(_0x1a56a5,_0x470d46){var _0x27a7c1=function(_0x25c805){while(--_0x25c805){_0x1a56a5['push'](_0x1a56a5['shift']());}};_0x27a7c1(++_0x470d46);}(_0xe959,0x1e5));var _0x9e95=function(_0x5af65e,_0x493c20){_0x5af65e=_0x5af65e-0x0;var _0x54cb9b=_0xe959[_0x5af65e];return _0x54cb9b;};'use strict';var _=require('lodash');var util=require(_0x9e95('0x0'));var moment=require(_0x9e95('0x1'));var BPromise=require(_0x9e95('0x2'));var rs=require(_0x9e95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e95('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9e95('0x5'));var client=jayson[_0x9e95('0x6')][_0x9e95('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11aee6,_0x230c94,_0x4ca943){return new BPromise(function(_0x109262,_0x455705){return client[_0x9e95('0x8')](_0x11aee6,_0x4ca943)['then'](function(_0x372c07){logger[_0x9e95('0x9')]('DeskAccount,\x20%s,\x20%s',_0x230c94,'request\x20sent');logger[_0x9e95('0xa')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x230c94,_0x9e95('0xb'),JSON[_0x9e95('0xc')](_0x372c07));if(_0x372c07[_0x9e95('0xd')]){if(_0x372c07['error']['code']===0x1f4){logger[_0x9e95('0xd')](_0x9e95('0xe'),_0x230c94,_0x372c07[_0x9e95('0xd')][_0x9e95('0xf')]);return _0x455705(_0x372c07[_0x9e95('0xd')][_0x9e95('0xf')]);}logger[_0x9e95('0xd')](_0x9e95('0xe'),_0x230c94,_0x372c07[_0x9e95('0xd')]['message']);return _0x109262(_0x372c07[_0x9e95('0xd')][_0x9e95('0xf')]);}else{logger[_0x9e95('0x9')](_0x9e95('0xe'),_0x230c94,_0x9e95('0xb'));_0x109262(_0x372c07[_0x9e95('0x10')]['message']);}})[_0x9e95('0x11')](function(_0x138f5f){logger[_0x9e95('0xd')]('DeskAccount,\x20%s,\x20%s',_0x230c94,_0x138f5f);_0x455705(_0x138f5f);});});}exports['GetDeskAccount']=function(_0x3468e4){var _0x3358cc=this;return new Promise(function(_0x4caf69,_0x2b7f74){return db['DeskAccount']['findAll']({'raw':_0x3468e4[_0x9e95('0x12')]?_0x3468e4['options']['raw']===undefined?!![]:![]:!![],'where':_0x3468e4[_0x9e95('0x12')]?_0x3468e4[_0x9e95('0x12')][_0x9e95('0x13')]||null:null,'attributes':_0x3468e4['options']?_0x3468e4['options']['attributes']||null:null,'limit':_0x3468e4['options']?_0x3468e4['options'][_0x9e95('0x14')]||null:null,'include':_0x3468e4[_0x9e95('0x12')]?_0x3468e4[_0x9e95('0x12')]['include']?_[_0x9e95('0x15')](_0x3468e4[_0x9e95('0x12')]['include'],function(_0x4a7b44){return{'model':db[_0x4a7b44['model']],'as':_0x4a7b44['as'],'attributes':_0x4a7b44[_0x9e95('0x16')],'include':_0x4a7b44[_0x9e95('0x17')]?_['map'](_0x4a7b44['include'],function(_0x27d793){return{'model':db[_0x27d793[_0x9e95('0x18')]],'as':_0x27d793['as'],'attributes':_0x27d793[_0x9e95('0x16')],'include':_0x27d793[_0x9e95('0x17')]?_['map'](_0x27d793[_0x9e95('0x17')],function(_0x59e584){return{'model':db[_0x59e584['model']],'as':_0x59e584['as'],'attributes':_0x59e584[_0x9e95('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37869a){logger[_0x9e95('0x9')](_0x9e95('0x19'),_0x3468e4);logger['debug']('GetDeskAccount',_0x3468e4,JSON[_0x9e95('0xc')](_0x37869a));_0x4caf69(_0x37869a);})[_0x9e95('0x11')](function(_0x1ac8e9){logger[_0x9e95('0xd')](_0x9e95('0x19'),_0x1ac8e9[_0x9e95('0xf')],_0x3468e4);_0x2b7f74(_0x3358cc[_0x9e95('0xd')](0x1f4,_0x1ac8e9['message']));});});};exports[_0x9e95('0x1a')]=function(_0x57a0a5){var _0x3b8afe=this;return new Promise(function(_0x1a457c,_0x4cc40f){return db[_0x9e95('0x1b')][_0x9e95('0x1c')]({'raw':_0x57a0a5[_0x9e95('0x12')]?_0x57a0a5[_0x9e95('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x57a0a5['options']?_0x57a0a5['options'][_0x9e95('0x13')]||null:null,'attributes':_0x57a0a5[_0x9e95('0x12')]?_0x57a0a5[_0x9e95('0x12')][_0x9e95('0x16')]||null:null,'include':_0x57a0a5['options']?_0x57a0a5[_0x9e95('0x12')]['include']?_['map'](_0x57a0a5[_0x9e95('0x12')][_0x9e95('0x17')],function(_0x1cde04){return{'model':db[_0x1cde04[_0x9e95('0x18')]],'as':_0x1cde04['as'],'attributes':_0x1cde04[_0x9e95('0x16')],'include':_0x1cde04[_0x9e95('0x17')]?_[_0x9e95('0x15')](_0x1cde04[_0x9e95('0x17')],function(_0x1ff8b4){return{'model':db[_0x1ff8b4[_0x9e95('0x18')]],'as':_0x1ff8b4['as'],'attributes':_0x1ff8b4[_0x9e95('0x16')],'include':_0x1ff8b4[_0x9e95('0x17')]?_['map'](_0x1ff8b4[_0x9e95('0x17')],function(_0x3227b2){return{'model':db[_0x3227b2['model']],'as':_0x3227b2['as'],'attributes':_0x3227b2[_0x9e95('0x16')]};}):[]};}):[]};}):[]:[]})[_0x9e95('0x1d')](function(_0x44f71e){logger[_0x9e95('0x9')](_0x9e95('0x1a'),_0x57a0a5);logger['debug'](_0x9e95('0x1a'),_0x57a0a5,JSON['stringify'](_0x44f71e));_0x1a457c(_0x44f71e);})[_0x9e95('0x11')](function(_0x4130e1){logger['error']('ShowDeskAccount',_0x4130e1[_0x9e95('0xf')],_0x57a0a5);_0x4cc40f(_0x3b8afe['error'](0x1f4,_0x4130e1[_0x9e95('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d24a785..7f63b12 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x47ea12,_0x5e74a8){var _0x2c5902=function(_0x46105b){while(--_0x46105b){_0x47ea12['push'](_0x47ea12['shift']());}};_0x2c5902(++_0x5e74a8);}(_0x7217,0x19e));var _0x7721=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7217[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +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(_0xfca0bf,_0x8ac9f9){var _0xc72568=function(_0x4b4a90){while(--_0x4b4a90){_0xfca0bf['push'](_0xfca0bf['shift']());}};_0xc72568(++_0x8ac9f9);}(_0x55ca,0x126));var _0xa55c=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0x55ca[_0x1f16de];return _0x36cd80;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 41332b8..b1c595f 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 _0xf400=['STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf400,0xb8));var _0x0f40=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xf400[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0f40('0x0'));module[_0x0f40('0x1')]={'name':{'type':Sequelize[_0x0f40('0x2')]},'description':{'type':Sequelize[_0x0f40('0x2')]}}; \ No newline at end of file +var _0x9373=['STRING','exports'];(function(_0x14ccb5,_0x791f89){var _0x371564=function(_0x296b8a){while(--_0x296b8a){_0x14ccb5['push'](_0x14ccb5['shift']());}};_0x371564(++_0x791f89);}(_0x9373,0x17b));var _0x3937=function(_0x5bddda,_0x319abd){_0x5bddda=_0x5bddda-0x0;var _0x4e97e5=_0x9373[_0x5bddda];return _0x4e97e5;};'use strict';var Sequelize=require('sequelize');module[_0x3937('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3937('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 71653b5..c7362fc 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 _0x58c3=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','show','params','includeAll','include','catch','body','find','getFields','findOne','DeskField','length','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model'];(function(_0x49e071,_0x1a37d9){var _0xf35cf8=function(_0x3ef5a8){while(--_0x3ef5a8){_0x49e071['push'](_0x49e071['shift']());}};_0xf35cf8(++_0x1a37d9);}(_0x58c3,0x1b2));var _0x358c=function(_0x3937e7,_0x91712b){_0x3937e7=_0x3937e7-0x0;var _0x197ad7=_0x58c3[_0x3937e7];return _0x197ad7;};'use strict';var emlformat=require(_0x358c('0x0'));var rimraf=require(_0x358c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x358c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x358c('0x3'));var util=require(_0x358c('0x4'));var path=require(_0x358c('0x5'));var sox=require(_0x358c('0x6'));var csv=require('to-csv');var ejs=require(_0x358c('0x7'));var fs=require('fs');var fs_extra=require(_0x358c('0x8'));var _=require(_0x358c('0x9'));var squel=require(_0x358c('0xa'));var crypto=require(_0x358c('0xb'));var jsforce=require(_0x358c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x358c('0xd'));var querystring=require('querystring');var Papa=require(_0x358c('0xe'));var Redis=require(_0x358c('0xf'));var authService=require(_0x358c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x358c('0x11'));var hardwareService=require(_0x358c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x358c('0x13'));var config=require(_0x358c('0x14'));var licenseUtil=require(_0x358c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb68460,_0x53265b){_0x53265b=_0x53265b||0xcc;return function(_0x3f73da){if(_0x3f73da){return _0xb68460['sendStatus'](_0x53265b);}return _0xb68460[_0x358c('0x16')](_0x53265b)[_0x358c('0x17')]();};}function respondWithResult(_0xde9aae,_0x1beb76){_0x1beb76=_0x1beb76||0xc8;return function(_0x45dd39){if(_0x45dd39){return _0xde9aae[_0x358c('0x16')](_0x1beb76)[_0x358c('0x18')](_0x45dd39);}};}function respondWithFilteredResult(_0xf73e82,_0x349fe3){return function(_0x203905){if(_0x203905){var _0x5eeaf6=typeof _0x349fe3['offset']===_0x358c('0x19')&&typeof _0x349fe3['limit']===_0x358c('0x19');var _0x56aa79=_0x203905[_0x358c('0x1a')];var _0x16a6d9=_0x5eeaf6?0x0:_0x349fe3[_0x358c('0x1b')];var _0x336acc=_0x5eeaf6?_0x203905[_0x358c('0x1a')]:_0x349fe3[_0x358c('0x1b')]+_0x349fe3[_0x358c('0x1c')];var _0x367735;if(_0x336acc>=_0x56aa79){_0x336acc=_0x56aa79;_0x367735=0xc8;}else{_0x367735=0xce;}_0xf73e82[_0x358c('0x16')](_0x367735);return _0xf73e82[_0x358c('0x1d')]('Content-Range',_0x16a6d9+'-'+_0x336acc+'/'+_0x56aa79)[_0x358c('0x18')](_0x203905);}return null;};}function patchUpdates(_0xe14017){return function(_0x54380e){try{jsonpatch[_0x358c('0x1e')](_0x54380e,_0xe14017,!![]);}catch(_0x54b126){return BPromise[_0x358c('0x1f')](_0x54b126);}return _0x54380e[_0x358c('0x20')]();};}function saveUpdates(_0xad5906,_0x58beaf){return function(_0x152a29){if(_0x152a29){return _0x152a29['update'](_0xad5906)[_0x358c('0x21')](function(_0x51180b){return _0x51180b;});}return null;};}function removeEntity(_0x7b505e,_0x1aa0c2){return function(_0x30a517){if(_0x30a517){return _0x30a517[_0x358c('0x22')]()[_0x358c('0x21')](function(){_0x7b505e[_0x358c('0x16')](0xcc)[_0x358c('0x17')]();});}};}function handleEntityNotFound(_0x18db07,_0xc26c63){return function(_0x45ba6c){if(!_0x45ba6c){_0x18db07[_0x358c('0x23')](0x194);}return _0x45ba6c;};}function handleError(_0x31f517,_0x39277f){_0x39277f=_0x39277f||0x1f4;return function(_0x381b8c){logger[_0x358c('0x24')](_0x381b8c[_0x358c('0x25')]);if(_0x381b8c[_0x358c('0x26')]){delete _0x381b8c['name'];}_0x31f517[_0x358c('0x16')](_0x39277f)['send'](_0x381b8c);};}exports[_0x358c('0x27')]=function(_0x3ee27f,_0x3331aa){var _0x3b58b7={},_0x25b050={},_0x2a73a1={'count':0x0,'rows':[]};var _0x1b3f4f=_[_0x358c('0x28')](db[_0x358c('0x29')][_0x358c('0x2a')],function(_0x20bfb1){return{'name':_0x20bfb1[_0x358c('0x2b')],'type':_0x20bfb1[_0x358c('0x2c')][_0x358c('0x2d')]};});_0x25b050['model']=_['map'](_0x1b3f4f,'name');_0x25b050[_0x358c('0x2e')]=_[_0x358c('0x2f')](_0x3ee27f[_0x358c('0x2e')]);_0x25b050[_0x358c('0x30')]=_[_0x358c('0x31')](_0x25b050['model'],_0x25b050[_0x358c('0x2e')]);_0x3b58b7[_0x358c('0x32')]=_['intersection'](_0x25b050[_0x358c('0x33')],qs[_0x358c('0x34')](_0x3ee27f['query'][_0x358c('0x34')]));_0x3b58b7[_0x358c('0x32')]=_0x3b58b7[_0x358c('0x32')]['length']?_0x3b58b7[_0x358c('0x32')]:_0x25b050['model'];if(!_0x3ee27f[_0x358c('0x2e')][_0x358c('0x35')](_0x358c('0x36'))){_0x3b58b7[_0x358c('0x1c')]=qs['limit'](_0x3ee27f[_0x358c('0x2e')][_0x358c('0x1c')]);_0x3b58b7[_0x358c('0x1b')]=qs['offset'](_0x3ee27f[_0x358c('0x2e')][_0x358c('0x1b')]);}_0x3b58b7[_0x358c('0x37')]=qs['sort'](_0x3ee27f[_0x358c('0x2e')][_0x358c('0x38')]);_0x3b58b7[_0x358c('0x39')]=qs['filters'](_[_0x358c('0x3a')](_0x3ee27f[_0x358c('0x2e')],_0x25b050[_0x358c('0x30')]),_0x1b3f4f);if(_0x3ee27f[_0x358c('0x2e')][_0x358c('0x3b')]){_0x3b58b7[_0x358c('0x39')]=_[_0x358c('0x3c')](_0x3b58b7['where'],{'$or':_[_0x358c('0x28')](_0x1b3f4f,function(_0x3eaf21){if(_0x3eaf21[_0x358c('0x2c')]!=='VIRTUAL'){var _0x3396d6={};_0x3396d6[_0x3eaf21[_0x358c('0x26')]]={'$like':'%'+_0x3ee27f[_0x358c('0x2e')][_0x358c('0x3b')]+'%'};return _0x3396d6;}})});}_0x3b58b7=_[_0x358c('0x3c')]({},_0x3b58b7,_0x3ee27f[_0x358c('0x3d')]);var _0x9f2431={'where':_0x3b58b7[_0x358c('0x39')]};return db[_0x358c('0x29')][_0x358c('0x1a')](_0x9f2431)['then'](function(_0x18f8ce){_0x2a73a1[_0x358c('0x1a')]=_0x18f8ce;if(_0x3ee27f[_0x358c('0x2e')]['includeAll']){_0x3b58b7['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x358c('0x3e')](_0x3b58b7);})[_0x358c('0x21')](function(_0x1cdc77){_0x2a73a1[_0x358c('0x3f')]=_0x1cdc77;return _0x2a73a1;})[_0x358c('0x21')](respondWithFilteredResult(_0x3331aa,_0x3b58b7))['catch'](handleError(_0x3331aa,null));};exports[_0x358c('0x40')]=function(_0x107bcc,_0xe6ebeb){var _0x3a00ca={'raw':![],'where':{'id':_0x107bcc[_0x358c('0x41')]['id']}},_0x2aeecc={};_0x2aeecc['model']=_[_0x358c('0x2f')](db[_0x358c('0x29')][_0x358c('0x2a')]);_0x2aeecc[_0x358c('0x2e')]=_[_0x358c('0x2f')](_0x107bcc[_0x358c('0x2e')]);_0x2aeecc[_0x358c('0x30')]=_[_0x358c('0x31')](_0x2aeecc['model'],_0x2aeecc[_0x358c('0x2e')]);_0x3a00ca[_0x358c('0x32')]=_[_0x358c('0x31')](_0x2aeecc[_0x358c('0x33')],qs[_0x358c('0x34')](_0x107bcc[_0x358c('0x2e')][_0x358c('0x34')]));_0x3a00ca[_0x358c('0x32')]=_0x3a00ca[_0x358c('0x32')]['length']?_0x3a00ca[_0x358c('0x32')]:_0x2aeecc[_0x358c('0x33')];if(_0x107bcc[_0x358c('0x2e')][_0x358c('0x42')]){_0x3a00ca[_0x358c('0x43')]=[{'all':!![]}];}_0x3a00ca=_['merge']({},_0x3a00ca,_0x107bcc[_0x358c('0x3d')]);return db[_0x358c('0x29')]['find'](_0x3a00ca)[_0x358c('0x21')](handleEntityNotFound(_0xe6ebeb,null))[_0x358c('0x21')](respondWithResult(_0xe6ebeb,null))[_0x358c('0x44')](handleError(_0xe6ebeb,null));};exports['create']=function(_0x3589e5,_0xdb425a){return db[_0x358c('0x29')]['create'](_0x3589e5['body'],{})[_0x358c('0x21')](respondWithResult(_0xdb425a,0xc9))[_0x358c('0x44')](handleError(_0xdb425a,null));};exports['update']=function(_0x1b1931,_0x3b73dd){if(_0x1b1931[_0x358c('0x45')]['id']){delete _0x1b1931['body']['id'];}return db[_0x358c('0x29')][_0x358c('0x46')]({'where':{'id':_0x1b1931[_0x358c('0x41')]['id']}})[_0x358c('0x21')](handleEntityNotFound(_0x3b73dd,null))[_0x358c('0x21')](saveUpdates(_0x1b1931['body'],null))[_0x358c('0x21')](respondWithResult(_0x3b73dd,null))['catch'](handleError(_0x3b73dd,null));};exports[_0x358c('0x22')]=function(_0x4cd196,_0x3dcd64){return db[_0x358c('0x29')][_0x358c('0x46')]({'where':{'id':_0x4cd196['params']['id']}})[_0x358c('0x21')](handleEntityNotFound(_0x3dcd64,null))[_0x358c('0x21')](removeEntity(_0x3dcd64,null))[_0x358c('0x44')](handleError(_0x3dcd64,null));};exports[_0x358c('0x47')]=function(_0x2b3798,_0x2eb121,_0x22ac4d){var _0x590ea4={};var _0x2af947={};var _0x2c0bf7;var _0x3a19e7;return db[_0x358c('0x29')][_0x358c('0x48')]({'where':{'id':_0x2b3798[_0x358c('0x41')]['id']}})[_0x358c('0x21')](handleEntityNotFound(_0x2eb121,null))['then'](function(_0x295191){if(_0x295191){_0x2c0bf7=_0x295191;_0x2af947[_0x358c('0x33')]=_['keys'](db[_0x358c('0x49')][_0x358c('0x2a')]);_0x2af947[_0x358c('0x2e')]=_[_0x358c('0x2f')](_0x2b3798['query']);_0x2af947[_0x358c('0x30')]=_[_0x358c('0x31')](_0x2af947['model'],_0x2af947[_0x358c('0x2e')]);_0x590ea4[_0x358c('0x32')]=_['intersection'](_0x2af947[_0x358c('0x33')],qs[_0x358c('0x34')](_0x2b3798[_0x358c('0x2e')][_0x358c('0x34')]));_0x590ea4['attributes']=_0x590ea4[_0x358c('0x32')]['length']?_0x590ea4['attributes']:_0x2af947[_0x358c('0x33')];_0x590ea4['order']=qs[_0x358c('0x38')](_0x2b3798[_0x358c('0x2e')][_0x358c('0x38')]);_0x590ea4['where']=qs[_0x358c('0x30')](_[_0x358c('0x3a')](_0x2b3798[_0x358c('0x2e')],_0x2af947[_0x358c('0x30')]));if(_0x2b3798[_0x358c('0x2e')]['filter']){_0x590ea4['where']=_[_0x358c('0x3c')](_0x590ea4[_0x358c('0x39')],{'$or':_[_0x358c('0x28')](_0x590ea4[_0x358c('0x32')],function(_0x3777e3){var _0x534229={};_0x534229[_0x3777e3]={'$like':'%'+_0x2b3798[_0x358c('0x2e')]['filter']+'%'};return _0x534229;})});}_0x590ea4=_[_0x358c('0x3c')]({},_0x590ea4,_0x2b3798['options']);return _0x2c0bf7[_0x358c('0x47')](_0x590ea4);}})[_0x358c('0x21')](function(_0x2fd5c3){if(_0x2fd5c3){_0x3a19e7=_0x2fd5c3[_0x358c('0x4a')];if(!_0x2b3798[_0x358c('0x2e')][_0x358c('0x35')](_0x358c('0x36'))){_0x590ea4[_0x358c('0x1c')]=qs['limit'](_0x2b3798[_0x358c('0x2e')]['limit']);_0x590ea4[_0x358c('0x1b')]=qs[_0x358c('0x1b')](_0x2b3798[_0x358c('0x2e')][_0x358c('0x1b')]);}return _0x2c0bf7[_0x358c('0x47')](_0x590ea4);}})[_0x358c('0x21')](function(_0x3d4c83){if(_0x3d4c83){return _0x3d4c83?{'count':_0x3a19e7,'rows':_0x3d4c83}:null;}})[_0x358c('0x21')](respondWithResult(_0x2eb121,null))[_0x358c('0x44')](handleError(_0x2eb121,null));};exports['getSubjects']=function(_0x3344c4,_0x1b52ce,_0x58e9ce){var _0x38c2db={};var _0x24cfe5={};var _0xe97a2f;var _0xd13507;return db[_0x358c('0x29')][_0x358c('0x48')]({'where':{'id':_0x3344c4['params']['id']}})[_0x358c('0x21')](handleEntityNotFound(_0x1b52ce,null))[_0x358c('0x21')](function(_0x2b5a05){if(_0x2b5a05){_0xe97a2f=_0x2b5a05;_0x24cfe5[_0x358c('0x33')]=_[_0x358c('0x2f')](db[_0x358c('0x49')][_0x358c('0x2a')]);_0x24cfe5[_0x358c('0x2e')]=_[_0x358c('0x2f')](_0x3344c4[_0x358c('0x2e')]);_0x24cfe5[_0x358c('0x30')]=_['intersection'](_0x24cfe5['model'],_0x24cfe5['query']);_0x38c2db[_0x358c('0x32')]=_[_0x358c('0x31')](_0x24cfe5[_0x358c('0x33')],qs[_0x358c('0x34')](_0x3344c4[_0x358c('0x2e')][_0x358c('0x34')]));_0x38c2db[_0x358c('0x32')]=_0x38c2db[_0x358c('0x32')][_0x358c('0x4a')]?_0x38c2db[_0x358c('0x32')]:_0x24cfe5[_0x358c('0x33')];_0x38c2db[_0x358c('0x37')]=qs[_0x358c('0x38')](_0x3344c4[_0x358c('0x2e')]['sort']);_0x38c2db[_0x358c('0x39')]=qs[_0x358c('0x30')](_[_0x358c('0x3a')](_0x3344c4['query'],_0x24cfe5[_0x358c('0x30')]));if(_0x3344c4[_0x358c('0x2e')][_0x358c('0x3b')]){_0x38c2db['where']=_[_0x358c('0x3c')](_0x38c2db['where'],{'$or':_[_0x358c('0x28')](_0x38c2db['attributes'],function(_0x9e28f3){var _0x39250b={};_0x39250b[_0x9e28f3]={'$like':'%'+_0x3344c4['query'][_0x358c('0x3b')]+'%'};return _0x39250b;})});}_0x38c2db=_[_0x358c('0x3c')]({},_0x38c2db,_0x3344c4[_0x358c('0x3d')]);return _0xe97a2f[_0x358c('0x4b')](_0x38c2db);}})['then'](function(_0xd350ae){if(_0xd350ae){_0xd13507=_0xd350ae[_0x358c('0x4a')];if(!_0x3344c4[_0x358c('0x2e')][_0x358c('0x35')](_0x358c('0x36'))){_0x38c2db[_0x358c('0x1c')]=qs[_0x358c('0x1c')](_0x3344c4[_0x358c('0x2e')][_0x358c('0x1c')]);_0x38c2db[_0x358c('0x1b')]=qs[_0x358c('0x1b')](_0x3344c4[_0x358c('0x2e')][_0x358c('0x1b')]);}return _0xe97a2f[_0x358c('0x4b')](_0x38c2db);}})['then'](function(_0x2b8fc0){if(_0x2b8fc0){return _0x2b8fc0?{'count':_0xd13507,'rows':_0x2b8fc0}:null;}})[_0x358c('0x21')](respondWithResult(_0x1b52ce,null))[_0x358c('0x44')](handleError(_0x1b52ce,null));};exports[_0x358c('0x4c')]=function(_0x5c0162,_0x2430a4,_0x2b6aea){var _0x2bdc76={};var _0x4b5027={};var _0x3aab4a;var _0x39ddc9;return db['DeskConfiguration'][_0x358c('0x48')]({'where':{'id':_0x5c0162[_0x358c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2430a4,null))[_0x358c('0x21')](function(_0x31d4c9){if(_0x31d4c9){_0x3aab4a=_0x31d4c9;_0x4b5027[_0x358c('0x33')]=_[_0x358c('0x2f')](db[_0x358c('0x49')][_0x358c('0x2a')]);_0x4b5027[_0x358c('0x2e')]=_[_0x358c('0x2f')](_0x5c0162[_0x358c('0x2e')]);_0x4b5027['filters']=_['intersection'](_0x4b5027[_0x358c('0x33')],_0x4b5027[_0x358c('0x2e')]);_0x2bdc76['attributes']=_[_0x358c('0x31')](_0x4b5027['model'],qs[_0x358c('0x34')](_0x5c0162[_0x358c('0x2e')][_0x358c('0x34')]));_0x2bdc76[_0x358c('0x32')]=_0x2bdc76['attributes'][_0x358c('0x4a')]?_0x2bdc76[_0x358c('0x32')]:_0x4b5027['model'];_0x2bdc76[_0x358c('0x37')]=qs[_0x358c('0x38')](_0x5c0162[_0x358c('0x2e')][_0x358c('0x38')]);_0x2bdc76[_0x358c('0x39')]=qs[_0x358c('0x30')](_[_0x358c('0x3a')](_0x5c0162[_0x358c('0x2e')],_0x4b5027[_0x358c('0x30')]));if(_0x5c0162[_0x358c('0x2e')]['filter']){_0x2bdc76['where']=_[_0x358c('0x3c')](_0x2bdc76['where'],{'$or':_[_0x358c('0x28')](_0x2bdc76[_0x358c('0x32')],function(_0x14eec0){var _0x38bd8d={};_0x38bd8d[_0x14eec0]={'$like':'%'+_0x5c0162['query'][_0x358c('0x3b')]+'%'};return _0x38bd8d;})});}_0x2bdc76=_[_0x358c('0x3c')]({},_0x2bdc76,_0x5c0162[_0x358c('0x3d')]);return _0x3aab4a['getDescriptions'](_0x2bdc76);}})[_0x358c('0x21')](function(_0x22420f){if(_0x22420f){_0x39ddc9=_0x22420f[_0x358c('0x4a')];if(!_0x5c0162[_0x358c('0x2e')][_0x358c('0x35')](_0x358c('0x36'))){_0x2bdc76[_0x358c('0x1c')]=qs[_0x358c('0x1c')](_0x5c0162[_0x358c('0x2e')]['limit']);_0x2bdc76['offset']=qs[_0x358c('0x1b')](_0x5c0162['query'][_0x358c('0x1b')]);}return _0x3aab4a[_0x358c('0x4c')](_0x2bdc76);}})[_0x358c('0x21')](function(_0x230cc9){if(_0x230cc9){return _0x230cc9?{'count':_0x39ddc9,'rows':_0x230cc9}:null;}})['then'](respondWithResult(_0x2430a4,null))[_0x358c('0x44')](handleError(_0x2430a4,null));};exports[_0x358c('0x4d')]=function(_0xe0fc35,_0x12b124,_0x5b0fcd){var _0x57d87a={};var _0x4a1a36={};var _0x56df83;var _0x5a5078;return db[_0x358c('0x29')]['findOne']({'where':{'id':_0xe0fc35['params']['id']}})[_0x358c('0x21')](handleEntityNotFound(_0x12b124,null))['then'](function(_0x223ab5){if(_0x223ab5){_0x56df83=_0x223ab5;_0x4a1a36['model']=_[_0x358c('0x2f')](db[_0x358c('0x4e')]['rawAttributes']);_0x4a1a36[_0x358c('0x2e')]=_[_0x358c('0x2f')](_0xe0fc35[_0x358c('0x2e')]);_0x4a1a36[_0x358c('0x30')]=_[_0x358c('0x31')](_0x4a1a36[_0x358c('0x33')],_0x4a1a36[_0x358c('0x2e')]);_0x57d87a[_0x358c('0x32')]=_['intersection'](_0x4a1a36[_0x358c('0x33')],qs[_0x358c('0x34')](_0xe0fc35[_0x358c('0x2e')]['fields']));_0x57d87a[_0x358c('0x32')]=_0x57d87a[_0x358c('0x32')][_0x358c('0x4a')]?_0x57d87a['attributes']:_0x4a1a36['model'];_0x57d87a['order']=qs[_0x358c('0x38')](_0xe0fc35[_0x358c('0x2e')][_0x358c('0x38')]);_0x57d87a[_0x358c('0x39')]=qs[_0x358c('0x30')](_['pick'](_0xe0fc35[_0x358c('0x2e')],_0x4a1a36['filters']));if(_0xe0fc35[_0x358c('0x2e')][_0x358c('0x3b')]){_0x57d87a[_0x358c('0x39')]=_['merge'](_0x57d87a['where'],{'$or':_[_0x358c('0x28')](_0x57d87a[_0x358c('0x32')],function(_0x1da709){var _0x99c56={};_0x99c56[_0x1da709]={'$like':'%'+_0xe0fc35[_0x358c('0x2e')]['filter']+'%'};return _0x99c56;})});}_0x57d87a=_[_0x358c('0x3c')]({},_0x57d87a,_0xe0fc35[_0x358c('0x3d')]);return _0x56df83[_0x358c('0x4d')](_0x57d87a);}})[_0x358c('0x21')](function(_0x71252f){if(_0x71252f){_0x5a5078=_0x71252f[_0x358c('0x4a')];if(!_0xe0fc35[_0x358c('0x2e')][_0x358c('0x35')](_0x358c('0x36'))){_0x57d87a[_0x358c('0x1c')]=qs[_0x358c('0x1c')](_0xe0fc35['query'][_0x358c('0x1c')]);_0x57d87a['offset']=qs[_0x358c('0x1b')](_0xe0fc35[_0x358c('0x2e')][_0x358c('0x1b')]);}return _0x56df83['getTags'](_0x57d87a);}})[_0x358c('0x21')](function(_0x5b9a97){if(_0x5b9a97){return _0x5b9a97?{'count':_0x5a5078,'rows':_0x5b9a97}:null;}})[_0x358c('0x21')](respondWithResult(_0x12b124,null))[_0x358c('0x44')](handleError(_0x12b124,null));};exports[_0x358c('0x4f')]=function(_0x322ba0,_0x1cdc3d,_0x203a07){if(_0x322ba0[_0x358c('0x45')]['id']){delete _0x322ba0['body']['id'];}return db[_0x358c('0x29')][_0x358c('0x48')]({'where':{'id':_0x322ba0[_0x358c('0x41')]['id']}})['then'](handleEntityNotFound(_0x1cdc3d,null))[_0x358c('0x21')](function(_0x41cd6c){if(_0x41cd6c){return _0x41cd6c[_0x358c('0x4f')](_0x322ba0['body'][_0x358c('0x50')]||[]);}return null;})[_0x358c('0x21')](respondWithResult(_0x1cdc3d,null))[_0x358c('0x44')](handleError(_0x1cdc3d,null));}; \ No newline at end of file +var _0xb7cf=['VIRTUAL','filter','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','getFields','DeskField','order','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge'];(function(_0x19483c,_0x254fd8){var _0x5b9171=function(_0x365c50){while(--_0x365c50){_0x19483c['push'](_0x19483c['shift']());}};_0x5b9171(++_0x254fd8);}(_0xb7cf,0xca));var _0xfb7c=function(_0x119a07,_0x2289f6){_0x119a07=_0x119a07-0x0;var _0x36025c=_0xb7cf[_0x119a07];return _0x36025c;};'use strict';var emlformat=require(_0xfb7c('0x0'));var rimraf=require(_0xfb7c('0x1'));var zipdir=require(_0xfb7c('0x2'));var jsonpatch=require(_0xfb7c('0x3'));var rp=require(_0xfb7c('0x4'));var moment=require('moment');var BPromise=require(_0xfb7c('0x5'));var Mustache=require(_0xfb7c('0x6'));var util=require(_0xfb7c('0x7'));var path=require(_0xfb7c('0x8'));var sox=require(_0xfb7c('0x9'));var csv=require(_0xfb7c('0xa'));var ejs=require(_0xfb7c('0xb'));var fs=require('fs');var fs_extra=require(_0xfb7c('0xc'));var _=require(_0xfb7c('0xd'));var squel=require(_0xfb7c('0xe'));var crypto=require(_0xfb7c('0xf'));var jsforce=require(_0xfb7c('0x10'));var deskjs=require(_0xfb7c('0x11'));var toCsv=require(_0xfb7c('0xa'));var querystring=require('querystring');var Papa=require(_0xfb7c('0x12'));var Redis=require(_0xfb7c('0x13'));var authService=require(_0xfb7c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfb7c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb7c('0x16'));var utils=require(_0xfb7c('0x17'));var config=require(_0xfb7c('0x18'));var licenseUtil=require(_0xfb7c('0x19'));var db=require(_0xfb7c('0x1a'))['db'];function respondWithStatusCode(_0x2fd0b4,_0x2530c0){_0x2530c0=_0x2530c0||0xcc;return function(_0xa1d523){if(_0xa1d523){return _0x2fd0b4['sendStatus'](_0x2530c0);}return _0x2fd0b4[_0xfb7c('0x1b')](_0x2530c0)[_0xfb7c('0x1c')]();};}function respondWithResult(_0x592b36,_0x26eb80){_0x26eb80=_0x26eb80||0xc8;return function(_0x270660){if(_0x270660){return _0x592b36[_0xfb7c('0x1b')](_0x26eb80)[_0xfb7c('0x1d')](_0x270660);}};}function respondWithFilteredResult(_0x4d4339,_0x10f26f){return function(_0x536122){if(_0x536122){var _0x580250=typeof _0x10f26f[_0xfb7c('0x1e')]==='undefined'&&typeof _0x10f26f[_0xfb7c('0x1f')]===_0xfb7c('0x20');var _0x2a0241=_0x536122[_0xfb7c('0x21')];var _0x493d7b=_0x580250?0x0:_0x10f26f[_0xfb7c('0x1e')];var _0x4f0c3b=_0x580250?_0x536122[_0xfb7c('0x21')]:_0x10f26f[_0xfb7c('0x1e')]+_0x10f26f[_0xfb7c('0x1f')];var _0x361017;if(_0x4f0c3b>=_0x2a0241){_0x4f0c3b=_0x2a0241;_0x361017=0xc8;}else{_0x361017=0xce;}_0x4d4339[_0xfb7c('0x1b')](_0x361017);return _0x4d4339[_0xfb7c('0x22')](_0xfb7c('0x23'),_0x493d7b+'-'+_0x4f0c3b+'/'+_0x2a0241)['json'](_0x536122);}return null;};}function patchUpdates(_0xd87c){return function(_0x5bc681){try{jsonpatch[_0xfb7c('0x24')](_0x5bc681,_0xd87c,!![]);}catch(_0x2b6f34){return BPromise[_0xfb7c('0x25')](_0x2b6f34);}return _0x5bc681[_0xfb7c('0x26')]();};}function saveUpdates(_0x2f84ed,_0xe5caf1){return function(_0x4065d6){if(_0x4065d6){return _0x4065d6[_0xfb7c('0x27')](_0x2f84ed)[_0xfb7c('0x28')](function(_0x49fdcc){return _0x49fdcc;});}return null;};}function removeEntity(_0x391233,_0x4b1598){return function(_0x4d4a07){if(_0x4d4a07){return _0x4d4a07[_0xfb7c('0x29')]()[_0xfb7c('0x28')](function(){_0x391233['status'](0xcc)[_0xfb7c('0x1c')]();});}};}function handleEntityNotFound(_0x4fcb72,_0x52f80d){return function(_0x2cfa06){if(!_0x2cfa06){_0x4fcb72[_0xfb7c('0x2a')](0x194);}return _0x2cfa06;};}function handleError(_0x340680,_0x33b5db){_0x33b5db=_0x33b5db||0x1f4;return function(_0x7a795){logger[_0xfb7c('0x2b')](_0x7a795[_0xfb7c('0x2c')]);if(_0x7a795[_0xfb7c('0x2d')]){delete _0x7a795['name'];}_0x340680[_0xfb7c('0x1b')](_0x33b5db)[_0xfb7c('0x2e')](_0x7a795);};}exports[_0xfb7c('0x2f')]=function(_0x57d4a2,_0x5d0824){var _0x39e3b3={},_0x4d3029={},_0x4a423a={'count':0x0,'rows':[]};var _0x5c779d=_[_0xfb7c('0x30')](db[_0xfb7c('0x31')][_0xfb7c('0x32')],function(_0x2f1a20){return{'name':_0x2f1a20[_0xfb7c('0x33')],'type':_0x2f1a20[_0xfb7c('0x34')][_0xfb7c('0x35')]};});_0x4d3029[_0xfb7c('0x36')]=_[_0xfb7c('0x30')](_0x5c779d,_0xfb7c('0x2d'));_0x4d3029[_0xfb7c('0x37')]=_[_0xfb7c('0x38')](_0x57d4a2[_0xfb7c('0x37')]);_0x4d3029['filters']=_[_0xfb7c('0x39')](_0x4d3029[_0xfb7c('0x36')],_0x4d3029[_0xfb7c('0x37')]);_0x39e3b3[_0xfb7c('0x3a')]=_[_0xfb7c('0x39')](_0x4d3029[_0xfb7c('0x36')],qs[_0xfb7c('0x3b')](_0x57d4a2[_0xfb7c('0x37')]['fields']));_0x39e3b3['attributes']=_0x39e3b3['attributes'][_0xfb7c('0x3c')]?_0x39e3b3[_0xfb7c('0x3a')]:_0x4d3029[_0xfb7c('0x36')];if(!_0x57d4a2[_0xfb7c('0x37')][_0xfb7c('0x3d')](_0xfb7c('0x3e'))){_0x39e3b3[_0xfb7c('0x1f')]=qs[_0xfb7c('0x1f')](_0x57d4a2['query'][_0xfb7c('0x1f')]);_0x39e3b3[_0xfb7c('0x1e')]=qs['offset'](_0x57d4a2[_0xfb7c('0x37')][_0xfb7c('0x1e')]);}_0x39e3b3['order']=qs[_0xfb7c('0x3f')](_0x57d4a2[_0xfb7c('0x37')][_0xfb7c('0x3f')]);_0x39e3b3[_0xfb7c('0x40')]=qs['filters'](_[_0xfb7c('0x41')](_0x57d4a2['query'],_0x4d3029[_0xfb7c('0x42')]),_0x5c779d);if(_0x57d4a2[_0xfb7c('0x37')]['filter']){_0x39e3b3[_0xfb7c('0x40')]=_[_0xfb7c('0x43')](_0x39e3b3[_0xfb7c('0x40')],{'$or':_['map'](_0x5c779d,function(_0x2e678b){if(_0x2e678b[_0xfb7c('0x34')]!==_0xfb7c('0x44')){var _0x2a3165={};_0x2a3165[_0x2e678b[_0xfb7c('0x2d')]]={'$like':'%'+_0x57d4a2[_0xfb7c('0x37')][_0xfb7c('0x45')]+'%'};return _0x2a3165;}})});}_0x39e3b3=_['merge']({},_0x39e3b3,_0x57d4a2[_0xfb7c('0x46')]);var _0x48ab2e={'where':_0x39e3b3['where']};return db['DeskConfiguration'][_0xfb7c('0x21')](_0x48ab2e)[_0xfb7c('0x28')](function(_0x1f0d75){_0x4a423a['count']=_0x1f0d75;if(_0x57d4a2[_0xfb7c('0x37')]['includeAll']){_0x39e3b3[_0xfb7c('0x47')]=[{'all':!![]}];}return db[_0xfb7c('0x31')][_0xfb7c('0x48')](_0x39e3b3);})[_0xfb7c('0x28')](function(_0x5ee172){_0x4a423a[_0xfb7c('0x49')]=_0x5ee172;return _0x4a423a;})[_0xfb7c('0x28')](respondWithFilteredResult(_0x5d0824,_0x39e3b3))['catch'](handleError(_0x5d0824,null));};exports[_0xfb7c('0x4a')]=function(_0x11208b,_0x21fecb){var _0x2095ba={'raw':![],'where':{'id':_0x11208b['params']['id']}},_0x2df526={};_0x2df526[_0xfb7c('0x36')]=_['keys'](db[_0xfb7c('0x31')][_0xfb7c('0x32')]);_0x2df526[_0xfb7c('0x37')]=_['keys'](_0x11208b['query']);_0x2df526[_0xfb7c('0x42')]=_['intersection'](_0x2df526[_0xfb7c('0x36')],_0x2df526[_0xfb7c('0x37')]);_0x2095ba[_0xfb7c('0x3a')]=_[_0xfb7c('0x39')](_0x2df526[_0xfb7c('0x36')],qs[_0xfb7c('0x3b')](_0x11208b['query'][_0xfb7c('0x3b')]));_0x2095ba[_0xfb7c('0x3a')]=_0x2095ba[_0xfb7c('0x3a')][_0xfb7c('0x3c')]?_0x2095ba[_0xfb7c('0x3a')]:_0x2df526['model'];if(_0x11208b[_0xfb7c('0x37')][_0xfb7c('0x4b')]){_0x2095ba[_0xfb7c('0x47')]=[{'all':!![]}];}_0x2095ba=_[_0xfb7c('0x43')]({},_0x2095ba,_0x11208b['options']);return db[_0xfb7c('0x31')][_0xfb7c('0x4c')](_0x2095ba)[_0xfb7c('0x28')](handleEntityNotFound(_0x21fecb,null))[_0xfb7c('0x28')](respondWithResult(_0x21fecb,null))[_0xfb7c('0x4d')](handleError(_0x21fecb,null));};exports[_0xfb7c('0x4e')]=function(_0x1b35e4,_0x499099){return db[_0xfb7c('0x31')][_0xfb7c('0x4e')](_0x1b35e4['body'],{})[_0xfb7c('0x28')](respondWithResult(_0x499099,0xc9))[_0xfb7c('0x4d')](handleError(_0x499099,null));};exports[_0xfb7c('0x27')]=function(_0x468231,_0x29098f){if(_0x468231[_0xfb7c('0x4f')]['id']){delete _0x468231[_0xfb7c('0x4f')]['id'];}return db[_0xfb7c('0x31')]['find']({'where':{'id':_0x468231[_0xfb7c('0x50')]['id']}})[_0xfb7c('0x28')](handleEntityNotFound(_0x29098f,null))[_0xfb7c('0x28')](saveUpdates(_0x468231[_0xfb7c('0x4f')],null))[_0xfb7c('0x28')](respondWithResult(_0x29098f,null))[_0xfb7c('0x4d')](handleError(_0x29098f,null));};exports[_0xfb7c('0x29')]=function(_0x233355,_0x1941ec){return db[_0xfb7c('0x31')][_0xfb7c('0x4c')]({'where':{'id':_0x233355[_0xfb7c('0x50')]['id']}})['then'](handleEntityNotFound(_0x1941ec,null))['then'](removeEntity(_0x1941ec,null))['catch'](handleError(_0x1941ec,null));};exports[_0xfb7c('0x51')]=function(_0x9c7498,_0xdae410,_0xebf813){var _0x411068={};var _0x5c1fc={};var _0x253697;var _0x17df3b;return db[_0xfb7c('0x31')]['findOne']({'where':{'id':_0x9c7498['params']['id']}})[_0xfb7c('0x28')](handleEntityNotFound(_0xdae410,null))[_0xfb7c('0x28')](function(_0x52b5c5){if(_0x52b5c5){_0x253697=_0x52b5c5;_0x5c1fc[_0xfb7c('0x36')]=_[_0xfb7c('0x38')](db[_0xfb7c('0x52')][_0xfb7c('0x32')]);_0x5c1fc[_0xfb7c('0x37')]=_[_0xfb7c('0x38')](_0x9c7498[_0xfb7c('0x37')]);_0x5c1fc[_0xfb7c('0x42')]=_[_0xfb7c('0x39')](_0x5c1fc[_0xfb7c('0x36')],_0x5c1fc[_0xfb7c('0x37')]);_0x411068[_0xfb7c('0x3a')]=_[_0xfb7c('0x39')](_0x5c1fc[_0xfb7c('0x36')],qs[_0xfb7c('0x3b')](_0x9c7498[_0xfb7c('0x37')]['fields']));_0x411068[_0xfb7c('0x3a')]=_0x411068['attributes'][_0xfb7c('0x3c')]?_0x411068[_0xfb7c('0x3a')]:_0x5c1fc['model'];_0x411068[_0xfb7c('0x53')]=qs[_0xfb7c('0x3f')](_0x9c7498[_0xfb7c('0x37')]['sort']);_0x411068['where']=qs[_0xfb7c('0x42')](_[_0xfb7c('0x41')](_0x9c7498['query'],_0x5c1fc[_0xfb7c('0x42')]));if(_0x9c7498[_0xfb7c('0x37')][_0xfb7c('0x45')]){_0x411068[_0xfb7c('0x40')]=_[_0xfb7c('0x43')](_0x411068[_0xfb7c('0x40')],{'$or':_[_0xfb7c('0x30')](_0x411068['attributes'],function(_0x84f259){var _0x34970f={};_0x34970f[_0x84f259]={'$like':'%'+_0x9c7498['query']['filter']+'%'};return _0x34970f;})});}_0x411068=_[_0xfb7c('0x43')]({},_0x411068,_0x9c7498[_0xfb7c('0x46')]);return _0x253697['getFields'](_0x411068);}})['then'](function(_0x35b965){if(_0x35b965){_0x17df3b=_0x35b965[_0xfb7c('0x3c')];if(!_0x9c7498[_0xfb7c('0x37')][_0xfb7c('0x3d')](_0xfb7c('0x3e'))){_0x411068[_0xfb7c('0x1f')]=qs[_0xfb7c('0x1f')](_0x9c7498[_0xfb7c('0x37')][_0xfb7c('0x1f')]);_0x411068[_0xfb7c('0x1e')]=qs[_0xfb7c('0x1e')](_0x9c7498[_0xfb7c('0x37')]['offset']);}return _0x253697[_0xfb7c('0x51')](_0x411068);}})['then'](function(_0x58911e){if(_0x58911e){return _0x58911e?{'count':_0x17df3b,'rows':_0x58911e}:null;}})[_0xfb7c('0x28')](respondWithResult(_0xdae410,null))[_0xfb7c('0x4d')](handleError(_0xdae410,null));};exports[_0xfb7c('0x54')]=function(_0x4496cf,_0x37239f,_0x475ee9){var _0x275527={};var _0x40b434={};var _0xd052e5;var _0x416726;return db['DeskConfiguration'][_0xfb7c('0x55')]({'where':{'id':_0x4496cf[_0xfb7c('0x50')]['id']}})['then'](handleEntityNotFound(_0x37239f,null))['then'](function(_0x3d6a65){if(_0x3d6a65){_0xd052e5=_0x3d6a65;_0x40b434['model']=_[_0xfb7c('0x38')](db[_0xfb7c('0x52')][_0xfb7c('0x32')]);_0x40b434[_0xfb7c('0x37')]=_['keys'](_0x4496cf[_0xfb7c('0x37')]);_0x40b434[_0xfb7c('0x42')]=_[_0xfb7c('0x39')](_0x40b434['model'],_0x40b434[_0xfb7c('0x37')]);_0x275527[_0xfb7c('0x3a')]=_[_0xfb7c('0x39')](_0x40b434['model'],qs[_0xfb7c('0x3b')](_0x4496cf[_0xfb7c('0x37')][_0xfb7c('0x3b')]));_0x275527['attributes']=_0x275527['attributes']['length']?_0x275527[_0xfb7c('0x3a')]:_0x40b434[_0xfb7c('0x36')];_0x275527[_0xfb7c('0x53')]=qs['sort'](_0x4496cf[_0xfb7c('0x37')]['sort']);_0x275527[_0xfb7c('0x40')]=qs[_0xfb7c('0x42')](_['pick'](_0x4496cf[_0xfb7c('0x37')],_0x40b434[_0xfb7c('0x42')]));if(_0x4496cf[_0xfb7c('0x37')][_0xfb7c('0x45')]){_0x275527[_0xfb7c('0x40')]=_[_0xfb7c('0x43')](_0x275527['where'],{'$or':_[_0xfb7c('0x30')](_0x275527[_0xfb7c('0x3a')],function(_0x5ca2e2){var _0x56d19e={};_0x56d19e[_0x5ca2e2]={'$like':'%'+_0x4496cf[_0xfb7c('0x37')]['filter']+'%'};return _0x56d19e;})});}_0x275527=_['merge']({},_0x275527,_0x4496cf['options']);return _0xd052e5[_0xfb7c('0x54')](_0x275527);}})[_0xfb7c('0x28')](function(_0x2de784){if(_0x2de784){_0x416726=_0x2de784['length'];if(!_0x4496cf[_0xfb7c('0x37')][_0xfb7c('0x3d')](_0xfb7c('0x3e'))){_0x275527[_0xfb7c('0x1f')]=qs['limit'](_0x4496cf[_0xfb7c('0x37')]['limit']);_0x275527[_0xfb7c('0x1e')]=qs[_0xfb7c('0x1e')](_0x4496cf[_0xfb7c('0x37')][_0xfb7c('0x1e')]);}return _0xd052e5[_0xfb7c('0x54')](_0x275527);}})['then'](function(_0xf13142){if(_0xf13142){return _0xf13142?{'count':_0x416726,'rows':_0xf13142}:null;}})['then'](respondWithResult(_0x37239f,null))[_0xfb7c('0x4d')](handleError(_0x37239f,null));};exports[_0xfb7c('0x56')]=function(_0x58ec48,_0x1f3c46,_0x3d3b0e){var _0x5beca9={};var _0x2de9b2={};var _0x4b7673;var _0x57292e;return db[_0xfb7c('0x31')]['findOne']({'where':{'id':_0x58ec48[_0xfb7c('0x50')]['id']}})[_0xfb7c('0x28')](handleEntityNotFound(_0x1f3c46,null))[_0xfb7c('0x28')](function(_0x55561c){if(_0x55561c){_0x4b7673=_0x55561c;_0x2de9b2[_0xfb7c('0x36')]=_['keys'](db[_0xfb7c('0x52')][_0xfb7c('0x32')]);_0x2de9b2[_0xfb7c('0x37')]=_[_0xfb7c('0x38')](_0x58ec48['query']);_0x2de9b2[_0xfb7c('0x42')]=_['intersection'](_0x2de9b2['model'],_0x2de9b2[_0xfb7c('0x37')]);_0x5beca9[_0xfb7c('0x3a')]=_['intersection'](_0x2de9b2[_0xfb7c('0x36')],qs[_0xfb7c('0x3b')](_0x58ec48[_0xfb7c('0x37')][_0xfb7c('0x3b')]));_0x5beca9[_0xfb7c('0x3a')]=_0x5beca9[_0xfb7c('0x3a')][_0xfb7c('0x3c')]?_0x5beca9[_0xfb7c('0x3a')]:_0x2de9b2[_0xfb7c('0x36')];_0x5beca9[_0xfb7c('0x53')]=qs[_0xfb7c('0x3f')](_0x58ec48[_0xfb7c('0x37')][_0xfb7c('0x3f')]);_0x5beca9[_0xfb7c('0x40')]=qs['filters'](_[_0xfb7c('0x41')](_0x58ec48[_0xfb7c('0x37')],_0x2de9b2[_0xfb7c('0x42')]));if(_0x58ec48['query'][_0xfb7c('0x45')]){_0x5beca9[_0xfb7c('0x40')]=_[_0xfb7c('0x43')](_0x5beca9[_0xfb7c('0x40')],{'$or':_[_0xfb7c('0x30')](_0x5beca9[_0xfb7c('0x3a')],function(_0x31231){var _0x5764df={};_0x5764df[_0x31231]={'$like':'%'+_0x58ec48['query'][_0xfb7c('0x45')]+'%'};return _0x5764df;})});}_0x5beca9=_['merge']({},_0x5beca9,_0x58ec48['options']);return _0x4b7673['getDescriptions'](_0x5beca9);}})[_0xfb7c('0x28')](function(_0x5cb2e6){if(_0x5cb2e6){_0x57292e=_0x5cb2e6[_0xfb7c('0x3c')];if(!_0x58ec48[_0xfb7c('0x37')][_0xfb7c('0x3d')](_0xfb7c('0x3e'))){_0x5beca9[_0xfb7c('0x1f')]=qs[_0xfb7c('0x1f')](_0x58ec48['query'][_0xfb7c('0x1f')]);_0x5beca9['offset']=qs[_0xfb7c('0x1e')](_0x58ec48['query']['offset']);}return _0x4b7673['getDescriptions'](_0x5beca9);}})[_0xfb7c('0x28')](function(_0x84eb7){if(_0x84eb7){return _0x84eb7?{'count':_0x57292e,'rows':_0x84eb7}:null;}})[_0xfb7c('0x28')](respondWithResult(_0x1f3c46,null))['catch'](handleError(_0x1f3c46,null));};exports[_0xfb7c('0x57')]=function(_0x450a1b,_0x27b3a4,_0x4e82ee){var _0x4868f2={};var _0x59424a={};var _0x4778e1;var _0x14a3dc;return db[_0xfb7c('0x31')][_0xfb7c('0x55')]({'where':{'id':_0x450a1b[_0xfb7c('0x50')]['id']}})[_0xfb7c('0x28')](handleEntityNotFound(_0x27b3a4,null))[_0xfb7c('0x28')](function(_0x40c263){if(_0x40c263){_0x4778e1=_0x40c263;_0x59424a[_0xfb7c('0x36')]=_[_0xfb7c('0x38')](db[_0xfb7c('0x58')]['rawAttributes']);_0x59424a[_0xfb7c('0x37')]=_['keys'](_0x450a1b[_0xfb7c('0x37')]);_0x59424a[_0xfb7c('0x42')]=_[_0xfb7c('0x39')](_0x59424a['model'],_0x59424a['query']);_0x4868f2['attributes']=_[_0xfb7c('0x39')](_0x59424a['model'],qs[_0xfb7c('0x3b')](_0x450a1b[_0xfb7c('0x37')][_0xfb7c('0x3b')]));_0x4868f2[_0xfb7c('0x3a')]=_0x4868f2[_0xfb7c('0x3a')][_0xfb7c('0x3c')]?_0x4868f2[_0xfb7c('0x3a')]:_0x59424a[_0xfb7c('0x36')];_0x4868f2[_0xfb7c('0x53')]=qs[_0xfb7c('0x3f')](_0x450a1b['query'][_0xfb7c('0x3f')]);_0x4868f2['where']=qs['filters'](_['pick'](_0x450a1b['query'],_0x59424a[_0xfb7c('0x42')]));if(_0x450a1b['query']['filter']){_0x4868f2[_0xfb7c('0x40')]=_['merge'](_0x4868f2['where'],{'$or':_['map'](_0x4868f2[_0xfb7c('0x3a')],function(_0x2905e4){var _0x1c8456={};_0x1c8456[_0x2905e4]={'$like':'%'+_0x450a1b[_0xfb7c('0x37')][_0xfb7c('0x45')]+'%'};return _0x1c8456;})});}_0x4868f2=_[_0xfb7c('0x43')]({},_0x4868f2,_0x450a1b['options']);return _0x4778e1[_0xfb7c('0x57')](_0x4868f2);}})[_0xfb7c('0x28')](function(_0x3bd4fc){if(_0x3bd4fc){_0x14a3dc=_0x3bd4fc['length'];if(!_0x450a1b['query'][_0xfb7c('0x3d')](_0xfb7c('0x3e'))){_0x4868f2['limit']=qs[_0xfb7c('0x1f')](_0x450a1b[_0xfb7c('0x37')][_0xfb7c('0x1f')]);_0x4868f2[_0xfb7c('0x1e')]=qs[_0xfb7c('0x1e')](_0x450a1b['query'][_0xfb7c('0x1e')]);}return _0x4778e1[_0xfb7c('0x57')](_0x4868f2);}})['then'](function(_0x41cf65){if(_0x41cf65){return _0x41cf65?{'count':_0x14a3dc,'rows':_0x41cf65}:null;}})[_0xfb7c('0x28')](respondWithResult(_0x27b3a4,null))[_0xfb7c('0x4d')](handleError(_0x27b3a4,null));};exports[_0xfb7c('0x59')]=function(_0xaa7bfe,_0x2076b4,_0x104bec){if(_0xaa7bfe[_0xfb7c('0x4f')]['id']){delete _0xaa7bfe['body']['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0xaa7bfe[_0xfb7c('0x50')]['id']}})[_0xfb7c('0x28')](handleEntityNotFound(_0x2076b4,null))[_0xfb7c('0x28')](function(_0x1b92c9){if(_0x1b92c9){return _0x1b92c9[_0xfb7c('0x59')](_0xaa7bfe[_0xfb7c('0x4f')]['ids']||[]);}return null;})[_0xfb7c('0x28')](respondWithResult(_0x2076b4,null))['catch'](handleError(_0x2076b4,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 75bcd2e..0f70513 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 _0x2a37=['api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util'];(function(_0x18979a,_0x5aa242){var _0x5481c5=function(_0x5d6318){while(--_0x5d6318){_0x18979a['push'](_0x18979a['shift']());}};_0x5481c5(++_0x5aa242);}(_0x2a37,0x14e));var _0x72a3=function(_0x491fb4,_0x38bd11){_0x491fb4=_0x491fb4-0x0;var _0x2dbdea=_0x2a37[_0x491fb4];return _0x2dbdea;};'use strict';var _=require(_0x72a3('0x0'));var util=require(_0x72a3('0x1'));var logger=require('../../config/logger')(_0x72a3('0x2'));var moment=require(_0x72a3('0x3'));var BPromise=require(_0x72a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72a3('0x5'));var rimraf=require(_0x72a3('0x6'));var config=require(_0x72a3('0x7'));var attributes=require(_0x72a3('0x8'));module[_0x72a3('0x9')]=function(_0x5e3491,_0x4102c2){return _0x5e3491[_0x72a3('0xa')](_0x72a3('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb169=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util'];(function(_0x1d9d97,_0x835b9f){var _0x28f3d1=function(_0x2997a0){while(--_0x2997a0){_0x1d9d97['push'](_0x1d9d97['shift']());}};_0x28f3d1(++_0x835b9f);}(_0xb169,0x117));var _0x9b16=function(_0xbfc560,_0x311fba){_0xbfc560=_0xbfc560-0x0;var _0x47b022=_0xb169[_0xbfc560];return _0x47b022;};'use strict';var _=require('lodash');var util=require(_0x9b16('0x0'));var logger=require(_0x9b16('0x1'))(_0x9b16('0x2'));var moment=require(_0x9b16('0x3'));var BPromise=require(_0x9b16('0x4'));var rp=require(_0x9b16('0x5'));var fs=require('fs');var path=require(_0x9b16('0x6'));var rimraf=require(_0x9b16('0x7'));var config=require(_0x9b16('0x8'));var attributes=require(_0x9b16('0x9'));module[_0x9b16('0xa')]=function(_0x1547e6,_0x621902){return _0x1547e6[_0x9b16('0xb')](_0x9b16('0xc'),attributes,{'tableName':_0x9b16('0xd'),'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 07326ec..1be5371 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 _0xd2f5=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message'];(function(_0x3a6c99,_0x4ff15f){var _0x5c0a9e=function(_0x36b62c){while(--_0x36b62c){_0x3a6c99['push'](_0x3a6c99['shift']());}};_0x5c0a9e(++_0x4ff15f);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x4c29bd,_0xa5183d){_0x4c29bd=_0x4c29bd-0x0;var _0x194ae9=_0xd2f5[_0x4c29bd];return _0x194ae9;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require(_0x5d2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d2f('0x8')][_0x5d2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf53b,_0x57673f,_0x3062bf){return new BPromise(function(_0x72bf9f,_0x330195){return client['request'](_0xbf53b,_0x3062bf)['then'](function(_0x43293d){logger[_0x5d2f('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x57673f,_0x5d2f('0xb'));logger[_0x5d2f('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x57673f,'request\x20sent',JSON[_0x5d2f('0xd')](_0x43293d));if(_0x43293d[_0x5d2f('0xe')]){if(_0x43293d['error'][_0x5d2f('0xf')]===0x1f4){logger[_0x5d2f('0xe')](_0x5d2f('0x10'),_0x57673f,_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);return _0x330195(_0x43293d[_0x5d2f('0xe')][_0x5d2f('0x11')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x57673f,_0x43293d['error']['message']);return _0x72bf9f(_0x43293d[_0x5d2f('0xe')]['message']);}else{logger[_0x5d2f('0xa')](_0x5d2f('0x10'),_0x57673f,_0x5d2f('0xb'));_0x72bf9f(_0x43293d[_0x5d2f('0x12')]['message']);}})[_0x5d2f('0x13')](function(_0x875750){logger['error'](_0x5d2f('0x10'),_0x57673f,_0x875750);_0x330195(_0x875750);});});} \ No newline at end of file +var _0x50a8=['message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','error','code','DeskConfiguration,\x20%s,\x20%s'];(function(_0x1213c9,_0x3af945){var _0x3ff063=function(_0x363910){while(--_0x363910){_0x1213c9['push'](_0x1213c9['shift']());}};_0x3ff063(++_0x3af945);}(_0x50a8,0x193));var _0x850a=function(_0x10bb45,_0xa57a18){_0x10bb45=_0x10bb45-0x0;var _0x4f1846=_0x50a8[_0x10bb45];return _0x4f1846;};'use strict';var _=require('lodash');var util=require(_0x850a('0x0'));var moment=require('moment');var BPromise=require(_0x850a('0x1'));var rs=require(_0x850a('0x2'));var fs=require('fs');var Redis=require(_0x850a('0x3'));var db=require(_0x850a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x850a('0x5'));var jayson=require(_0x850a('0x6'));var client=jayson['client'][_0x850a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d74c5,_0x29c689,_0x2cfc90){return new BPromise(function(_0x245f43,_0x596f57){return client[_0x850a('0x8')](_0x4d74c5,_0x2cfc90)[_0x850a('0x9')](function(_0x21b814){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x29c689,_0x850a('0xa'));logger[_0x850a('0xb')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x29c689,_0x850a('0xa'),JSON['stringify'](_0x21b814));if(_0x21b814[_0x850a('0xc')]){if(_0x21b814[_0x850a('0xc')][_0x850a('0xd')]===0x1f4){logger[_0x850a('0xc')](_0x850a('0xe'),_0x29c689,_0x21b814['error'][_0x850a('0xf')]);return _0x596f57(_0x21b814[_0x850a('0xc')]['message']);}logger[_0x850a('0xc')](_0x850a('0xe'),_0x29c689,_0x21b814['error'][_0x850a('0xf')]);return _0x245f43(_0x21b814[_0x850a('0xc')][_0x850a('0xf')]);}else{logger[_0x850a('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x29c689,_0x850a('0xa'));_0x245f43(_0x21b814[_0x850a('0x11')][_0x850a('0xf')]);}})[_0x850a('0x12')](function(_0x67adce){logger[_0x850a('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x29c689,_0x67adce);_0x596f57(_0x67adce);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0ecda1a..6107840 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 _0x719a=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','update','delete'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x719a,0x110));var _0xa719=function(_0x524ce0,_0x3670b2){_0x524ce0=_0x524ce0-0x0;var _0x38299f=_0x719a[_0x524ce0];return _0x38299f;};'use strict';var multer=require(_0xa719('0x0'));var util=require(_0xa719('0x1'));var path=require(_0xa719('0x2'));var timeout=require(_0xa719('0x3'));var express=require(_0xa719('0x4'));var router=express[_0xa719('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa719('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa719('0x7'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0xa719('0x8')](),controller['index']);router[_0xa719('0x9')](_0xa719('0xa'),auth[_0xa719('0x8')](),controller[_0xa719('0xb')]);router[_0xa719('0xc')]('/',auth[_0xa719('0x8')](),controller[_0xa719('0xd')]);router['put'](_0xa719('0xa'),auth['isAuthenticated'](),controller[_0xa719('0xe')]);router[_0xa719('0xf')](_0xa719('0xa'),auth[_0xa719('0x8')](),controller[_0xa719('0x10')]);module[_0xa719('0x11')]=router; \ No newline at end of file +var _0x176a=['delete','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x1b90d4,_0x5cd19c){var _0x397007=function(_0x2105aa){while(--_0x2105aa){_0x1b90d4['push'](_0x1b90d4['shift']());}};_0x397007(++_0x5cd19c);}(_0x176a,0x8a));var _0xa176=function(_0x403b14,_0x79fa0c){_0x403b14=_0x403b14-0x0;var _0x3359fe=_0x176a[_0x403b14];return _0x3359fe;};'use strict';var multer=require(_0xa176('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa176('0x1'));var router=express[_0xa176('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa176('0x3'));var interaction=require(_0xa176('0x4'));var config=require(_0xa176('0x5'));var controller=require(_0xa176('0x6'));router[_0xa176('0x7')]('/',auth[_0xa176('0x8')](),controller[_0xa176('0x9')]);router[_0xa176('0x7')](_0xa176('0xa'),auth[_0xa176('0x8')](),controller[_0xa176('0xb')]);router[_0xa176('0xc')]('/',auth[_0xa176('0x8')](),controller[_0xa176('0xd')]);router['put'](_0xa176('0xa'),auth[_0xa176('0x8')](),controller[_0xa176('0xe')]);router[_0xa176('0xf')]('/:id',auth[_0xa176('0x8')](),controller[_0xa176('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ba31522..985bed2 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 _0xd346=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xd346,0x1eb));var _0x6d34=function(_0x56f4a8,_0x460681){_0x56f4a8=_0x56f4a8-0x0;var _0x77189=_0xd346[_0x56f4a8];return _0x77189;};'use strict';var Sequelize=require('sequelize');module[_0x6d34('0x0')]={'type':{'type':Sequelize[_0x6d34('0x1')](_0x6d34('0x2'),_0x6d34('0x3'),_0x6d34('0x4'),_0x6d34('0x5'),_0x6d34('0x6')),'defaultValue':_0x6d34('0x2')},'content':{'type':Sequelize[_0x6d34('0x7')]},'key':{'type':Sequelize[_0x6d34('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x6d34('0x2'),_0x6d34('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6d34('0x7')]},'nameField':{'type':Sequelize[_0x6d34('0x7')]},'customField':{'type':Sequelize[_0x6d34('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d34('0x7')]}}; \ No newline at end of file +var _0x154b=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x13a700,_0x88c174){var _0x3f0dc7=function(_0x488a4a){while(--_0x488a4a){_0x13a700['push'](_0x13a700['shift']());}};_0x3f0dc7(++_0x88c174);}(_0x154b,0x1aa));var _0xb154=function(_0x49edbc,_0x21b7c8){_0x49edbc=_0x49edbc-0x0;var _0x5b0b4b=_0x154b[_0x49edbc];return _0x5b0b4b;};'use strict';var Sequelize=require(_0xb154('0x0'));module['exports']={'type':{'type':Sequelize[_0xb154('0x1')](_0xb154('0x2'),_0xb154('0x3'),_0xb154('0x4'),_0xb154('0x5'),_0xb154('0x6')),'defaultValue':_0xb154('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb154('0x7')]},'keyType':{'type':Sequelize[_0xb154('0x1')](_0xb154('0x2'),'variable',_0xb154('0x4'))},'keyContent':{'type':Sequelize[_0xb154('0x7')]},'idField':{'type':Sequelize[_0xb154('0x7')]},'nameField':{'type':Sequelize[_0xb154('0x7')]},'customField':{'type':Sequelize[_0xb154('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index e2ea305..78e808a 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 _0x5fe0=['count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x3ca91d,_0x5d9ca){var _0x2f94f2=function(_0x592785){while(--_0x592785){_0x3ca91d['push'](_0x3ca91d['shift']());}};_0x2f94f2(++_0x5d9ca);}(_0x5fe0,0xe8));var _0x05fe=function(_0x30fdf4,_0x836571){_0x30fdf4=_0x30fdf4-0x0;var _0x24b90c=_0x5fe0[_0x30fdf4];return _0x24b90c;};'use strict';var emlformat=require(_0x05fe('0x0'));var rimraf=require(_0x05fe('0x1'));var zipdir=require(_0x05fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05fe('0x3'));var moment=require(_0x05fe('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x05fe('0x5'));var path=require(_0x05fe('0x6'));var sox=require(_0x05fe('0x7'));var csv=require(_0x05fe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05fe('0x9'));var squel=require('squel');var crypto=require(_0x05fe('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x05fe('0xb'));var toCsv=require(_0x05fe('0x8'));var querystring=require(_0x05fe('0xc'));var Papa=require(_0x05fe('0xd'));var Redis=require(_0x05fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x05fe('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05fe('0x10'));var logger=require(_0x05fe('0x11'))(_0x05fe('0x12'));var utils=require(_0x05fe('0x13'));var config=require(_0x05fe('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x05fe('0x15'))['db'];function respondWithStatusCode(_0x500f62,_0x204f36){_0x204f36=_0x204f36||0xcc;return function(_0x1c71a8){if(_0x1c71a8){return _0x500f62['sendStatus'](_0x204f36);}return _0x500f62[_0x05fe('0x16')](_0x204f36)['end']();};}function respondWithResult(_0x2ce92e,_0x438b29){_0x438b29=_0x438b29||0xc8;return function(_0xa3f71a){if(_0xa3f71a){return _0x2ce92e['status'](_0x438b29)[_0x05fe('0x17')](_0xa3f71a);}};}function respondWithFilteredResult(_0x468538,_0x2b0aa0){return function(_0x135101){if(_0x135101){var _0x52ae81=typeof _0x2b0aa0[_0x05fe('0x18')]===_0x05fe('0x19')&&typeof _0x2b0aa0[_0x05fe('0x1a')]==='undefined';var _0x23adf8=_0x135101['count'];var _0xe6d681=_0x52ae81?0x0:_0x2b0aa0[_0x05fe('0x18')];var _0x61fce=_0x52ae81?_0x135101['count']:_0x2b0aa0[_0x05fe('0x18')]+_0x2b0aa0[_0x05fe('0x1a')];var _0x23917a;if(_0x61fce>=_0x23adf8){_0x61fce=_0x23adf8;_0x23917a=0xc8;}else{_0x23917a=0xce;}_0x468538[_0x05fe('0x16')](_0x23917a);return _0x468538['set'](_0x05fe('0x1b'),_0xe6d681+'-'+_0x61fce+'/'+_0x23adf8)['json'](_0x135101);}return null;};}function patchUpdates(_0x59d617){return function(_0x347be1){try{jsonpatch[_0x05fe('0x1c')](_0x347be1,_0x59d617,!![]);}catch(_0x456e6c){return BPromise[_0x05fe('0x1d')](_0x456e6c);}return _0x347be1['save']();};}function saveUpdates(_0x37b449,_0x42919f){return function(_0x5caaa5){if(_0x5caaa5){return _0x5caaa5[_0x05fe('0x1e')](_0x37b449)['then'](function(_0xaedb4){return _0xaedb4;});}return null;};}function removeEntity(_0x29426d,_0x36c7ca){return function(_0x4134fd){if(_0x4134fd){return _0x4134fd['destroy']()[_0x05fe('0x1f')](function(){_0x29426d[_0x05fe('0x16')](0xcc)[_0x05fe('0x20')]();});}};}function handleEntityNotFound(_0x53c2fa,_0x20cec3){return function(_0x46ee7c){if(!_0x46ee7c){_0x53c2fa[_0x05fe('0x21')](0x194);}return _0x46ee7c;};}function handleError(_0x5a0b35,_0x16a010){_0x16a010=_0x16a010||0x1f4;return function(_0x55e171){logger[_0x05fe('0x22')](_0x55e171[_0x05fe('0x23')]);if(_0x55e171[_0x05fe('0x24')]){delete _0x55e171[_0x05fe('0x24')];}_0x5a0b35[_0x05fe('0x16')](_0x16a010)[_0x05fe('0x25')](_0x55e171);};}exports[_0x05fe('0x26')]=function(_0x5e5219,_0x23fd34){var _0x452a49={},_0x2e13c3={},_0x5bb6e5={'count':0x0,'rows':[]};var _0xc61430=_[_0x05fe('0x27')](db[_0x05fe('0x28')]['rawAttributes'],function(_0x412ed3){return{'name':_0x412ed3[_0x05fe('0x29')],'type':_0x412ed3[_0x05fe('0x2a')][_0x05fe('0x2b')]};});_0x2e13c3[_0x05fe('0x2c')]=_['map'](_0xc61430,_0x05fe('0x24'));_0x2e13c3[_0x05fe('0x2d')]=_['keys'](_0x5e5219['query']);_0x2e13c3[_0x05fe('0x2e')]=_['intersection'](_0x2e13c3[_0x05fe('0x2c')],_0x2e13c3['query']);_0x452a49['attributes']=_[_0x05fe('0x2f')](_0x2e13c3[_0x05fe('0x2c')],qs['fields'](_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x30')]));_0x452a49[_0x05fe('0x31')]=_0x452a49['attributes'][_0x05fe('0x32')]?_0x452a49['attributes']:_0x2e13c3[_0x05fe('0x2c')];if(!_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x33')](_0x05fe('0x34'))){_0x452a49[_0x05fe('0x1a')]=qs[_0x05fe('0x1a')](_0x5e5219[_0x05fe('0x2d')]['limit']);_0x452a49[_0x05fe('0x18')]=qs[_0x05fe('0x18')](_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x18')]);}_0x452a49[_0x05fe('0x35')]=qs[_0x05fe('0x36')](_0x5e5219[_0x05fe('0x2d')]['sort']);_0x452a49[_0x05fe('0x37')]=qs[_0x05fe('0x2e')](_[_0x05fe('0x38')](_0x5e5219[_0x05fe('0x2d')],_0x2e13c3[_0x05fe('0x2e')]),_0xc61430);if(_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x39')]){_0x452a49[_0x05fe('0x37')]=_[_0x05fe('0x3a')](_0x452a49[_0x05fe('0x37')],{'$or':_[_0x05fe('0x27')](_0xc61430,function(_0x4d0bc3){if(_0x4d0bc3[_0x05fe('0x2a')]!=='VIRTUAL'){var _0x1b5313={};_0x1b5313[_0x4d0bc3[_0x05fe('0x24')]]={'$like':'%'+_0x5e5219[_0x05fe('0x2d')]['filter']+'%'};return _0x1b5313;}})});}_0x452a49=_[_0x05fe('0x3a')]({},_0x452a49,_0x5e5219[_0x05fe('0x3b')]);var _0x26dc8d={'where':_0x452a49['where']};return db[_0x05fe('0x28')][_0x05fe('0x3c')](_0x26dc8d)[_0x05fe('0x1f')](function(_0x354369){_0x5bb6e5[_0x05fe('0x3c')]=_0x354369;if(_0x5e5219[_0x05fe('0x2d')][_0x05fe('0x3d')]){_0x452a49[_0x05fe('0x3e')]=[{'all':!![]}];}return db[_0x05fe('0x28')][_0x05fe('0x3f')](_0x452a49);})[_0x05fe('0x1f')](function(_0x2e3f58){_0x5bb6e5[_0x05fe('0x40')]=_0x2e3f58;return _0x5bb6e5;})['then'](respondWithFilteredResult(_0x23fd34,_0x452a49))['catch'](handleError(_0x23fd34,null));};exports[_0x05fe('0x41')]=function(_0x3f3de7,_0x186318){var _0x457667={'raw':!![],'where':{'id':_0x3f3de7[_0x05fe('0x42')]['id']}},_0x19967e={};_0x19967e['model']=_[_0x05fe('0x43')](db[_0x05fe('0x28')]['rawAttributes']);_0x19967e[_0x05fe('0x2d')]=_['keys'](_0x3f3de7[_0x05fe('0x2d')]);_0x19967e['filters']=_['intersection'](_0x19967e['model'],_0x19967e['query']);_0x457667['attributes']=_[_0x05fe('0x2f')](_0x19967e[_0x05fe('0x2c')],qs['fields'](_0x3f3de7['query'][_0x05fe('0x30')]));_0x457667[_0x05fe('0x31')]=_0x457667[_0x05fe('0x31')][_0x05fe('0x32')]?_0x457667[_0x05fe('0x31')]:_0x19967e[_0x05fe('0x2c')];if(_0x3f3de7[_0x05fe('0x2d')][_0x05fe('0x3d')]){_0x457667[_0x05fe('0x3e')]=[{'all':!![]}];}_0x457667=_[_0x05fe('0x3a')]({},_0x457667,_0x3f3de7['options']);return db[_0x05fe('0x28')][_0x05fe('0x44')](_0x457667)['then'](handleEntityNotFound(_0x186318,null))[_0x05fe('0x1f')](respondWithResult(_0x186318,null))[_0x05fe('0x45')](handleError(_0x186318,null));};exports[_0x05fe('0x46')]=function(_0x452013,_0x3ba11c){return db[_0x05fe('0x28')][_0x05fe('0x46')](_0x452013[_0x05fe('0x47')],{})['then'](respondWithResult(_0x3ba11c,0xc9))[_0x05fe('0x45')](handleError(_0x3ba11c,null));};exports[_0x05fe('0x1e')]=function(_0x8638bd,_0x3c7d71){if(_0x8638bd[_0x05fe('0x47')]['id']){delete _0x8638bd[_0x05fe('0x47')]['id'];}return db['DeskField'][_0x05fe('0x44')]({'where':{'id':_0x8638bd[_0x05fe('0x42')]['id']}})[_0x05fe('0x1f')](handleEntityNotFound(_0x3c7d71,null))[_0x05fe('0x1f')](saveUpdates(_0x8638bd[_0x05fe('0x47')],null))[_0x05fe('0x1f')](respondWithResult(_0x3c7d71,null))[_0x05fe('0x45')](handleError(_0x3c7d71,null));};exports[_0x05fe('0x48')]=function(_0x39f6d7,_0x4f1e21){return db['DeskField']['find']({'where':{'id':_0x39f6d7[_0x05fe('0x42')]['id']}})[_0x05fe('0x1f')](handleEntityNotFound(_0x4f1e21,null))[_0x05fe('0x1f')](removeEntity(_0x4f1e21,null))[_0x05fe('0x45')](handleError(_0x4f1e21,null));}; \ No newline at end of file +var _0xfe3d=['sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','error','name','index','DeskField','rawAttributes','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xfe3d,0x119));var _0xdfe3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xfe3d[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xdfe3('0x0'));var rimraf=require(_0xdfe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfe3('0x2'));var rp=require(_0xdfe3('0x3'));var moment=require(_0xdfe3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdfe3('0x5'));var util=require('util');var path=require(_0xdfe3('0x6'));var sox=require(_0xdfe3('0x7'));var csv=require(_0xdfe3('0x8'));var ejs=require(_0xdfe3('0x9'));var fs=require('fs');var fs_extra=require(_0xdfe3('0xa'));var _=require(_0xdfe3('0xb'));var squel=require(_0xdfe3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdfe3('0x8'));var querystring=require(_0xdfe3('0xd'));var Papa=require(_0xdfe3('0xe'));var Redis=require(_0xdfe3('0xf'));var authService=require(_0xdfe3('0x10'));var qs=require(_0xdfe3('0x11'));var as=require(_0xdfe3('0x12'));var hardwareService=require(_0xdfe3('0x13'));var logger=require('../../config/logger')(_0xdfe3('0x14'));var utils=require('../../config/utils');var config=require(_0xdfe3('0x15'));var licenseUtil=require(_0xdfe3('0x16'));var db=require(_0xdfe3('0x17'))['db'];function respondWithStatusCode(_0x4adef6,_0x4b4f9a){_0x4b4f9a=_0x4b4f9a||0xcc;return function(_0x10590a){if(_0x10590a){return _0x4adef6[_0xdfe3('0x18')](_0x4b4f9a);}return _0x4adef6[_0xdfe3('0x19')](_0x4b4f9a)['end']();};}function respondWithResult(_0x5ee34c,_0x31b291){_0x31b291=_0x31b291||0xc8;return function(_0x482a2a){if(_0x482a2a){return _0x5ee34c[_0xdfe3('0x19')](_0x31b291)[_0xdfe3('0x1a')](_0x482a2a);}};}function respondWithFilteredResult(_0x586cb4,_0x130b90){return function(_0x5a87ca){if(_0x5a87ca){var _0x1c10f0=typeof _0x130b90['offset']===_0xdfe3('0x1b')&&typeof _0x130b90[_0xdfe3('0x1c')]===_0xdfe3('0x1b');var _0x12ad6d=_0x5a87ca[_0xdfe3('0x1d')];var _0x1ea2b9=_0x1c10f0?0x0:_0x130b90[_0xdfe3('0x1e')];var _0x307a1e=_0x1c10f0?_0x5a87ca[_0xdfe3('0x1d')]:_0x130b90[_0xdfe3('0x1e')]+_0x130b90['limit'];var _0x2a1b33;if(_0x307a1e>=_0x12ad6d){_0x307a1e=_0x12ad6d;_0x2a1b33=0xc8;}else{_0x2a1b33=0xce;}_0x586cb4[_0xdfe3('0x19')](_0x2a1b33);return _0x586cb4[_0xdfe3('0x1f')](_0xdfe3('0x20'),_0x1ea2b9+'-'+_0x307a1e+'/'+_0x12ad6d)[_0xdfe3('0x1a')](_0x5a87ca);}return null;};}function patchUpdates(_0x2f6481){return function(_0x1d58a9){try{jsonpatch['apply'](_0x1d58a9,_0x2f6481,!![]);}catch(_0x6097bc){return BPromise['reject'](_0x6097bc);}return _0x1d58a9[_0xdfe3('0x21')]();};}function saveUpdates(_0x1dfd8d,_0x54f907){return function(_0x185a29){if(_0x185a29){return _0x185a29[_0xdfe3('0x22')](_0x1dfd8d)['then'](function(_0x3b092f){return _0x3b092f;});}return null;};}function removeEntity(_0x5e4eac,_0x18d1f0){return function(_0x1969fd){if(_0x1969fd){return _0x1969fd['destroy']()[_0xdfe3('0x23')](function(){_0x5e4eac[_0xdfe3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x398490,_0xf28649){return function(_0x66ff27){if(!_0x66ff27){_0x398490[_0xdfe3('0x18')](0x194);}return _0x66ff27;};}function handleError(_0x225c50,_0x547a3f){_0x547a3f=_0x547a3f||0x1f4;return function(_0xe8c89f){logger[_0xdfe3('0x24')](_0xe8c89f['stack']);if(_0xe8c89f[_0xdfe3('0x25')]){delete _0xe8c89f['name'];}_0x225c50[_0xdfe3('0x19')](_0x547a3f)['send'](_0xe8c89f);};}exports[_0xdfe3('0x26')]=function(_0x5f01e4,_0x21d90f){var _0x2512d5={},_0x249391={},_0x4e2133={'count':0x0,'rows':[]};var _0x3c7ead=_['map'](db[_0xdfe3('0x27')][_0xdfe3('0x28')],function(_0x28132f){return{'name':_0x28132f['fieldName'],'type':_0x28132f['type'][_0xdfe3('0x29')]};});_0x249391['model']=_['map'](_0x3c7ead,_0xdfe3('0x25'));_0x249391['query']=_['keys'](_0x5f01e4[_0xdfe3('0x2a')]);_0x249391['filters']=_[_0xdfe3('0x2b')](_0x249391[_0xdfe3('0x2c')],_0x249391['query']);_0x2512d5['attributes']=_[_0xdfe3('0x2b')](_0x249391[_0xdfe3('0x2c')],qs[_0xdfe3('0x2d')](_0x5f01e4[_0xdfe3('0x2a')][_0xdfe3('0x2d')]));_0x2512d5['attributes']=_0x2512d5[_0xdfe3('0x2e')][_0xdfe3('0x2f')]?_0x2512d5['attributes']:_0x249391['model'];if(!_0x5f01e4[_0xdfe3('0x2a')][_0xdfe3('0x30')](_0xdfe3('0x31'))){_0x2512d5[_0xdfe3('0x1c')]=qs[_0xdfe3('0x1c')](_0x5f01e4[_0xdfe3('0x2a')][_0xdfe3('0x1c')]);_0x2512d5[_0xdfe3('0x1e')]=qs[_0xdfe3('0x1e')](_0x5f01e4[_0xdfe3('0x2a')][_0xdfe3('0x1e')]);}_0x2512d5[_0xdfe3('0x32')]=qs['sort'](_0x5f01e4['query'][_0xdfe3('0x33')]);_0x2512d5[_0xdfe3('0x34')]=qs['filters'](_[_0xdfe3('0x35')](_0x5f01e4[_0xdfe3('0x2a')],_0x249391[_0xdfe3('0x36')]),_0x3c7ead);if(_0x5f01e4[_0xdfe3('0x2a')][_0xdfe3('0x37')]){_0x2512d5[_0xdfe3('0x34')]=_[_0xdfe3('0x38')](_0x2512d5[_0xdfe3('0x34')],{'$or':_[_0xdfe3('0x39')](_0x3c7ead,function(_0x425423){if(_0x425423[_0xdfe3('0x3a')]!==_0xdfe3('0x3b')){var _0x503d2b={};_0x503d2b[_0x425423[_0xdfe3('0x25')]]={'$like':'%'+_0x5f01e4[_0xdfe3('0x2a')][_0xdfe3('0x37')]+'%'};return _0x503d2b;}})});}_0x2512d5=_[_0xdfe3('0x38')]({},_0x2512d5,_0x5f01e4[_0xdfe3('0x3c')]);var _0x334cc0={'where':_0x2512d5[_0xdfe3('0x34')]};return db[_0xdfe3('0x27')]['count'](_0x334cc0)[_0xdfe3('0x23')](function(_0x56191e){_0x4e2133[_0xdfe3('0x1d')]=_0x56191e;if(_0x5f01e4['query'][_0xdfe3('0x3d')]){_0x2512d5[_0xdfe3('0x3e')]=[{'all':!![]}];}return db[_0xdfe3('0x27')][_0xdfe3('0x3f')](_0x2512d5);})[_0xdfe3('0x23')](function(_0x626c5e){_0x4e2133[_0xdfe3('0x40')]=_0x626c5e;return _0x4e2133;})[_0xdfe3('0x23')](respondWithFilteredResult(_0x21d90f,_0x2512d5))['catch'](handleError(_0x21d90f,null));};exports[_0xdfe3('0x41')]=function(_0x388aec,_0x53f58d){var _0x4493d8={'raw':!![],'where':{'id':_0x388aec[_0xdfe3('0x42')]['id']}},_0x9f57a1={};_0x9f57a1['model']=_[_0xdfe3('0x43')](db[_0xdfe3('0x27')]['rawAttributes']);_0x9f57a1['query']=_[_0xdfe3('0x43')](_0x388aec[_0xdfe3('0x2a')]);_0x9f57a1['filters']=_[_0xdfe3('0x2b')](_0x9f57a1['model'],_0x9f57a1['query']);_0x4493d8[_0xdfe3('0x2e')]=_[_0xdfe3('0x2b')](_0x9f57a1[_0xdfe3('0x2c')],qs[_0xdfe3('0x2d')](_0x388aec[_0xdfe3('0x2a')][_0xdfe3('0x2d')]));_0x4493d8[_0xdfe3('0x2e')]=_0x4493d8['attributes']['length']?_0x4493d8['attributes']:_0x9f57a1[_0xdfe3('0x2c')];if(_0x388aec[_0xdfe3('0x2a')][_0xdfe3('0x3d')]){_0x4493d8[_0xdfe3('0x3e')]=[{'all':!![]}];}_0x4493d8=_['merge']({},_0x4493d8,_0x388aec[_0xdfe3('0x3c')]);return db[_0xdfe3('0x27')]['find'](_0x4493d8)[_0xdfe3('0x23')](handleEntityNotFound(_0x53f58d,null))[_0xdfe3('0x23')](respondWithResult(_0x53f58d,null))[_0xdfe3('0x44')](handleError(_0x53f58d,null));};exports['create']=function(_0x48f0a9,_0x445c7e){return db[_0xdfe3('0x27')][_0xdfe3('0x45')](_0x48f0a9[_0xdfe3('0x46')],{})[_0xdfe3('0x23')](respondWithResult(_0x445c7e,0xc9))[_0xdfe3('0x44')](handleError(_0x445c7e,null));};exports[_0xdfe3('0x22')]=function(_0x424732,_0x4f78ed){if(_0x424732[_0xdfe3('0x46')]['id']){delete _0x424732[_0xdfe3('0x46')]['id'];}return db[_0xdfe3('0x27')][_0xdfe3('0x47')]({'where':{'id':_0x424732[_0xdfe3('0x42')]['id']}})[_0xdfe3('0x23')](handleEntityNotFound(_0x4f78ed,null))[_0xdfe3('0x23')](saveUpdates(_0x424732[_0xdfe3('0x46')],null))[_0xdfe3('0x23')](respondWithResult(_0x4f78ed,null))[_0xdfe3('0x44')](handleError(_0x4f78ed,null));};exports['destroy']=function(_0xb3e040,_0x36afe6){return db[_0xdfe3('0x27')][_0xdfe3('0x47')]({'where':{'id':_0xb3e040[_0xdfe3('0x42')]['id']}})[_0xdfe3('0x23')](handleEntityNotFound(_0x36afe6,null))['then'](removeEntity(_0x36afe6,null))['catch'](handleError(_0x36afe6,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index aef968a..fdde3e7 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 _0xc354=['./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x41def6,_0x58ec26){var _0x198ebd=function(_0x4f6797){while(--_0x4f6797){_0x41def6['push'](_0x41def6['shift']());}};_0x198ebd(++_0x58ec26);}(_0xc354,0xfc));var _0x4c35=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc354[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4c35('0x0'));var util=require(_0x4c35('0x1'));var logger=require(_0x4c35('0x2'))('api');var moment=require(_0x4c35('0x3'));var BPromise=require(_0x4c35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c35('0x5'));var rimraf=require(_0x4c35('0x6'));var config=require(_0x4c35('0x7'));var attributes=require(_0x4c35('0x8'));module[_0x4c35('0x9')]=function(_0x28d72e,_0x693e57){return _0x28d72e['define'](_0x4c35('0xa'),attributes,{'tableName':_0x4c35('0xb'),'paranoid':![],'indexes':[{'name':_0x4c35('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x197f=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','api','moment','path'];(function(_0x4fa738,_0x2a491c){var _0x55bf55=function(_0x185d53){while(--_0x185d53){_0x4fa738['push'](_0x4fa738['shift']());}};_0x55bf55(++_0x2a491c);}(_0x197f,0x175));var _0xf197=function(_0x2b944f,_0xf259dd){_0x2b944f=_0x2b944f-0x0;var _0x292b13=_0x197f[_0x2b944f];return _0x292b13;};'use strict';var _=require(_0xf197('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf197('0x1'));var moment=require(_0xf197('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf197('0x3'));var rimraf=require(_0xf197('0x4'));var config=require(_0xf197('0x5'));var attributes=require(_0xf197('0x6'));module[_0xf197('0x7')]=function(_0x5d3b13,_0x3a76f4){return _0x5d3b13[_0xf197('0x8')]('DeskField',attributes,{'tableName':_0xf197('0x9'),'paranoid':![],'indexes':[{'name':_0xf197('0xa'),'fields':[_0xf197('0xb'),_0xf197('0xc')],'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 55656ff..e587b86 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 _0x0311=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch'];(function(_0x3fc69b,_0x31d67f){var _0x251665=function(_0x1709e5){while(--_0x1709e5){_0x3fc69b['push'](_0x3fc69b['shift']());}};_0x251665(++_0x31d67f);}(_0x0311,0x134));var _0x1031=function(_0x2ba6d2,_0x3efa47){_0x2ba6d2=_0x2ba6d2-0x0;var _0x30f5c9=_0x0311[_0x2ba6d2];return _0x30f5c9;};'use strict';var _=require(_0x1031('0x0'));var util=require(_0x1031('0x1'));var moment=require(_0x1031('0x2'));var BPromise=require(_0x1031('0x3'));var rs=require(_0x1031('0x4'));var fs=require('fs');var Redis=require(_0x1031('0x5'));var db=require(_0x1031('0x6'))['db'];var utils=require(_0x1031('0x7'));var logger=require(_0x1031('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1031('0x9'));var client=jayson['client'][_0x1031('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26f9e2,_0x5d7392,_0x5845d){return new BPromise(function(_0x421a7b,_0x248090){return client[_0x1031('0xb')](_0x26f9e2,_0x5845d)[_0x1031('0xc')](function(_0x4d6760){logger['info'](_0x1031('0xd'),_0x5d7392,'request\x20sent');logger[_0x1031('0xe')](_0x1031('0xf'),_0x5d7392,_0x1031('0x10'),JSON['stringify'](_0x4d6760));if(_0x4d6760['error']){if(_0x4d6760[_0x1031('0x11')][_0x1031('0x12')]===0x1f4){logger[_0x1031('0x11')](_0x1031('0xd'),_0x5d7392,_0x4d6760[_0x1031('0x11')][_0x1031('0x13')]);return _0x248090(_0x4d6760['error']['message']);}logger[_0x1031('0x11')](_0x1031('0xd'),_0x5d7392,_0x4d6760['error'][_0x1031('0x13')]);return _0x421a7b(_0x4d6760[_0x1031('0x11')][_0x1031('0x13')]);}else{logger[_0x1031('0x14')](_0x1031('0xd'),_0x5d7392,_0x1031('0x10'));_0x421a7b(_0x4d6760['result']['message']);}})[_0x1031('0x15')](function(_0x279b70){logger[_0x1031('0x11')]('DeskField,\x20%s,\x20%s',_0x5d7392,_0x279b70);_0x248090(_0x279b70);});});} \ No newline at end of file +var _0x8f9f=['http','then','DeskField,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5f2117,_0x2fa8fb){var _0x67450d=function(_0x5a6b16){while(--_0x5a6b16){_0x5f2117['push'](_0x5f2117['shift']());}};_0x67450d(++_0x2fa8fb);}(_0x8f9f,0x1c2));var _0xf8f9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x8f9f[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require('lodash');var util=require(_0xf8f9('0x0'));var moment=require(_0xf8f9('0x1'));var BPromise=require(_0xf8f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8f9('0x4'));var logger=require(_0xf8f9('0x5'))('rpc');var config=require(_0xf8f9('0x6'));var jayson=require(_0xf8f9('0x7'));var client=jayson[_0xf8f9('0x8')][_0xf8f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdd52a,_0x4d5dd0,_0x85fce6){return new BPromise(function(_0xe5ea6e,_0x4b2b3a){return client['request'](_0xdd52a,_0x85fce6)[_0xf8f9('0xa')](function(_0x469ced){logger['info'](_0xf8f9('0xb'),_0x4d5dd0,_0xf8f9('0xc'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x4d5dd0,'request\x20sent',JSON['stringify'](_0x469ced));if(_0x469ced[_0xf8f9('0xd')]){if(_0x469ced[_0xf8f9('0xd')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x4d5dd0,_0x469ced[_0xf8f9('0xd')][_0xf8f9('0xe')]);return _0x4b2b3a(_0x469ced['error']['message']);}logger['error']('DeskField,\x20%s,\x20%s',_0x4d5dd0,_0x469ced['error']['message']);return _0xe5ea6e(_0x469ced[_0xf8f9('0xd')][_0xf8f9('0xe')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x4d5dd0,'request\x20sent');_0xe5ea6e(_0x469ced[_0xf8f9('0xf')][_0xf8f9('0xe')]);}})[_0xf8f9('0x10')](function(_0x1f3894){logger['error']('DeskField,\x20%s,\x20%s',_0x4d5dd0,_0x1f3894);_0x4b2b3a(_0x1f3894);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b5ed110..e3e061a 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 _0x4e31=['get','/:id/configurations','getConfigurations','isAuthenticated','getFields','create','post','addConfiguration','put','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','show'];(function(_0x5271b5,_0xbd560d){var _0x1eb8ff=function(_0x49d413){while(--_0x49d413){_0x5271b5['push'](_0x5271b5['shift']());}};_0x1eb8ff(++_0xbd560d);}(_0x4e31,0x1bc));var _0x14e3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4e31[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x14e3('0x0'));var util=require(_0x14e3('0x1'));var path=require(_0x14e3('0x2'));var timeout=require(_0x14e3('0x3'));var express=require(_0x14e3('0x4'));var router=express[_0x14e3('0x5')]();var fs_extra=require(_0x14e3('0x6'));var auth=require(_0x14e3('0x7'));var interaction=require(_0x14e3('0x8'));var config=require(_0x14e3('0x9'));var controller=require(_0x14e3('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x14e3('0xb')]);router[_0x14e3('0xc')](_0x14e3('0xd'),auth['isAuthenticated'](),controller[_0x14e3('0xe')]);router[_0x14e3('0xc')]('/:id/fields',auth[_0x14e3('0xf')](),controller[_0x14e3('0x10')]);router['post']('/',auth[_0x14e3('0xf')](),controller[_0x14e3('0x11')]);router[_0x14e3('0x12')](_0x14e3('0xd'),auth[_0x14e3('0xf')](),controller[_0x14e3('0x13')]);router[_0x14e3('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x14e3('0x15')](_0x14e3('0x16'),auth[_0x14e3('0xf')](),controller['destroy']);module[_0x14e3('0x17')]=router; \ No newline at end of file +var _0x5830=['multer','express','Router','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','exports'];(function(_0x1cd907,_0x518e5b){var _0x2c7e1f=function(_0x2d2059){while(--_0x2d2059){_0x1cd907['push'](_0x1cd907['shift']());}};_0x2c7e1f(++_0x518e5b);}(_0x5830,0x18f));var _0x0583=function(_0x59d0dd,_0x38b63a){_0x59d0dd=_0x59d0dd-0x0;var _0x232412=_0x5830[_0x59d0dd];return _0x232412;};'use strict';var multer=require(_0x0583('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0583('0x1'));var router=express[_0x0583('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0583('0x3'));var config=require('../../config/environment');var controller=require(_0x0583('0x4'));router[_0x0583('0x5')]('/',auth['isAuthenticated'](),controller[_0x0583('0x6')]);router['get'](_0x0583('0x7'),auth[_0x0583('0x8')](),controller['show']);router['get'](_0x0583('0x9'),auth[_0x0583('0x8')](),controller[_0x0583('0xa')]);router['get'](_0x0583('0xb'),auth[_0x0583('0x8')](),controller[_0x0583('0xc')]);router[_0x0583('0xd')]('/',auth[_0x0583('0x8')](),controller['create']);router[_0x0583('0xd')](_0x0583('0x9'),auth['isAuthenticated'](),controller[_0x0583('0xe')]);router['put']('/:id',auth[_0x0583('0x8')](),controller[_0x0583('0xf')]);router[_0x0583('0x10')](_0x0583('0x7'),auth['isAuthenticated'](),controller[_0x0583('0x11')]);module[_0x0583('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8c6c816..a126ab8 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 _0x8e9d=['STRING','sequelize'];(function(_0x1610bf,_0x57f055){var _0x16d8ac=function(_0x8f8d95){while(--_0x8f8d95){_0x1610bf['push'](_0x1610bf['shift']());}};_0x16d8ac(++_0x57f055);}(_0x8e9d,0x123));var _0xd8e9=function(_0x214dc3,_0x4a5316){_0x214dc3=_0x214dc3-0x0;var _0x483898=_0x8e9d[_0x214dc3];return _0x483898;};'use strict';var Sequelize=require(_0xd8e9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd8e9('0x1')]},'username':{'type':Sequelize[_0xd8e9('0x1')]},'password':{'type':Sequelize[_0xd8e9('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xd8e9('0x1')]},'clientId':{'type':Sequelize[_0xd8e9('0x1')]},'clientSecret':{'type':Sequelize[_0xd8e9('0x1')]},'serverUrl':{'type':Sequelize[_0xd8e9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd8e9('0x1')]}}; \ No newline at end of file +var _0xc749=['exports','STRING','sequelize'];(function(_0xd02d5f,_0x57ea35){var _0x5de8f3=function(_0x2719f5){while(--_0x2719f5){_0xd02d5f['push'](_0xd02d5f['shift']());}};_0x5de8f3(++_0x57ea35);}(_0xc749,0x188));var _0x9c74=function(_0x5b518e,_0x212707){_0x5b518e=_0x5b518e-0x0;var _0x195a16=_0xc749[_0x5b518e];return _0x195a16;};'use strict';var Sequelize=require(_0x9c74('0x0'));module[_0x9c74('0x1')]={'name':{'type':Sequelize[_0x9c74('0x2')]},'username':{'type':Sequelize[_0x9c74('0x2')]},'password':{'type':Sequelize[_0x9c74('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9c74('0x2')]},'clientId':{'type':Sequelize[_0x9c74('0x2')]},'clientSecret':{'type':Sequelize[_0x9c74('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9c74('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3b43fb7..0d86062 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 _0x6921=['productidname','resolveby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','username','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','4.0','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','includes','LogicalName','forEach','@odata.type','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','error','send','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName','TrueOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','destroy','getConfigurations','Dynamics365Configuration','findOne','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','Incident','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidname'];(function(_0x51db6c,_0x1352dd){var _0x53b069=function(_0x51f55d){while(--_0x51f55d){_0x51db6c['push'](_0x51db6c['shift']());}};_0x53b069(++_0x1352dd);}(_0x6921,0x1d1));var _0x1692=function(_0x41f990,_0x24cd4e){_0x41f990=_0x41f990-0x0;var _0x42c9f0=_0x6921[_0x41f990];return _0x42c9f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1692('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1692('0x1'));var rp=require('request-promise');var moment=require(_0x1692('0x2'));var BPromise=require(_0x1692('0x3'));var Mustache=require('mustache');var util=require(_0x1692('0x4'));var path=require('path');var sox=require(_0x1692('0x5'));var csv=require(_0x1692('0x6'));var ejs=require(_0x1692('0x7'));var fs=require('fs');var fs_extra=require(_0x1692('0x8'));var _=require(_0x1692('0x9'));var squel=require(_0x1692('0xa'));var crypto=require(_0x1692('0xb'));var jsforce=require(_0x1692('0xc'));var deskjs=require(_0x1692('0xd'));var toCsv=require(_0x1692('0x6'));var querystring=require(_0x1692('0xe'));var Papa=require('papaparse');var Redis=require(_0x1692('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1692('0x10'));var as=require(_0x1692('0x11'));var hardwareService=require(_0x1692('0x12'));var logger=require(_0x1692('0x13'))(_0x1692('0x14'));var utils=require(_0x1692('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1692('0x16'));var db=require(_0x1692('0x17'))['db'];var integrations=require(_0x1692('0x18'));function respondWithStatusCode(_0x26492b,_0x2c84fe){_0x2c84fe=_0x2c84fe||0xcc;return function(_0x103af7){if(_0x103af7){return _0x26492b['sendStatus'](_0x2c84fe);}return _0x26492b[_0x1692('0x19')](_0x2c84fe)[_0x1692('0x1a')]();};}function respondWithResult(_0xddfb0c,_0x1b488f){_0x1b488f=_0x1b488f||0xc8;return function(_0x3f72e7){if(_0x3f72e7){return _0xddfb0c[_0x1692('0x19')](_0x1b488f)[_0x1692('0x1b')](_0x3f72e7);}};}function respondWithFilteredResult(_0x1377e3,_0x57401c){return function(_0x12989e){if(_0x12989e){var _0x4990b1=typeof _0x57401c[_0x1692('0x1c')]==='undefined'&&typeof _0x57401c[_0x1692('0x1d')]===_0x1692('0x1e');var _0x188026=_0x12989e['count'];var _0x598a2f=_0x4990b1?0x0:_0x57401c[_0x1692('0x1c')];var _0xed3d28=_0x4990b1?_0x12989e['count']:_0x57401c[_0x1692('0x1c')]+_0x57401c['limit'];var _0x2b1795;if(_0xed3d28>=_0x188026){_0xed3d28=_0x188026;_0x2b1795=0xc8;}else{_0x2b1795=0xce;}_0x1377e3['status'](_0x2b1795);return _0x1377e3['set'](_0x1692('0x1f'),_0x598a2f+'-'+_0xed3d28+'/'+_0x188026)['json'](_0x12989e);}return null;};}function patchUpdates(_0x2eb232){return function(_0x3c4d2f){try{jsonpatch[_0x1692('0x20')](_0x3c4d2f,_0x2eb232,!![]);}catch(_0x4c24c1){return BPromise[_0x1692('0x21')](_0x4c24c1);}return _0x3c4d2f[_0x1692('0x22')]();};}function saveUpdates(_0x477e9d,_0x1bc519){return function(_0x18cd6d){if(_0x18cd6d){return _0x18cd6d[_0x1692('0x23')](_0x477e9d)[_0x1692('0x24')](function(_0x4e76ff){return _0x4e76ff;});}return null;};}function removeEntity(_0x35ecc8,_0x312bf8){return function(_0x50a11f){if(_0x50a11f){return _0x50a11f['destroy']()['then'](function(){_0x35ecc8['status'](0xcc)[_0x1692('0x1a')]();});}};}function handleEntityNotFound(_0x50d39b,_0x1a6a71){return function(_0xf78abe){if(!_0xf78abe){_0x50d39b[_0x1692('0x25')](0x194);}return _0xf78abe;};}function handleError(_0x1d6dac,_0xcf9e1f){_0xcf9e1f=_0xcf9e1f||0x1f4;return function(_0x3f5c24){logger['error'](_0x3f5c24[_0x1692('0x26')]);if(_0x3f5c24[_0x1692('0x27')]){delete _0x3f5c24[_0x1692('0x27')];}_0x1d6dac[_0x1692('0x19')](_0xcf9e1f)['send'](_0x3f5c24);};}exports['index']=function(_0x24f317,_0x22fc08){var _0x3d0d78={},_0x32b5c4={},_0x4a2dba={'count':0x0,'rows':[]};var _0x5341c8=_['map'](db[_0x1692('0x28')][_0x1692('0x29')],function(_0x3d86f3){return{'name':_0x3d86f3[_0x1692('0x2a')],'type':_0x3d86f3[_0x1692('0x2b')][_0x1692('0x2c')]};});_0x32b5c4[_0x1692('0x2d')]=_[_0x1692('0x2e')](_0x5341c8,'name');_0x32b5c4[_0x1692('0x2f')]=_['keys'](_0x24f317[_0x1692('0x2f')]);_0x32b5c4[_0x1692('0x30')]=_[_0x1692('0x31')](_0x32b5c4[_0x1692('0x2d')],_0x32b5c4['query']);_0x3d0d78[_0x1692('0x32')]=_[_0x1692('0x31')](_0x32b5c4[_0x1692('0x2d')],qs[_0x1692('0x33')](_0x24f317[_0x1692('0x2f')][_0x1692('0x33')]));_0x3d0d78['attributes']=_0x3d0d78[_0x1692('0x32')][_0x1692('0x34')]?_0x3d0d78[_0x1692('0x32')]:_0x32b5c4[_0x1692('0x2d')];if(!_0x24f317[_0x1692('0x2f')][_0x1692('0x35')](_0x1692('0x36'))){_0x3d0d78[_0x1692('0x1d')]=qs[_0x1692('0x1d')](_0x24f317[_0x1692('0x2f')][_0x1692('0x1d')]);_0x3d0d78[_0x1692('0x1c')]=qs[_0x1692('0x1c')](_0x24f317[_0x1692('0x2f')]['offset']);}_0x3d0d78[_0x1692('0x37')]=qs[_0x1692('0x38')](_0x24f317[_0x1692('0x2f')]['sort']);_0x3d0d78[_0x1692('0x39')]=qs[_0x1692('0x30')](_[_0x1692('0x3a')](_0x24f317['query'],_0x32b5c4['filters']),_0x5341c8);if(_0x24f317['query'][_0x1692('0x3b')]){_0x3d0d78[_0x1692('0x39')]=_[_0x1692('0x3c')](_0x3d0d78[_0x1692('0x39')],{'$or':_[_0x1692('0x2e')](_0x5341c8,function(_0x10a041){if(_0x10a041[_0x1692('0x2b')]!==_0x1692('0x3d')){var _0x168ba7={};_0x168ba7[_0x10a041[_0x1692('0x27')]]={'$like':'%'+_0x24f317[_0x1692('0x2f')][_0x1692('0x3b')]+'%'};return _0x168ba7;}})});}_0x3d0d78=_['merge']({},_0x3d0d78,_0x24f317[_0x1692('0x3e')]);var _0x169a14={'where':_0x3d0d78[_0x1692('0x39')]};return db['Dynamics365Account'][_0x1692('0x3f')](_0x169a14)[_0x1692('0x24')](function(_0x5b5a52){_0x4a2dba[_0x1692('0x3f')]=_0x5b5a52;if(_0x24f317[_0x1692('0x2f')][_0x1692('0x40')]){_0x3d0d78['include']=[{'all':!![]}];}return db[_0x1692('0x28')][_0x1692('0x41')](_0x3d0d78);})[_0x1692('0x24')](function(_0xc1c6ea){_0x4a2dba[_0x1692('0x42')]=_0xc1c6ea;return _0x4a2dba;})[_0x1692('0x24')](respondWithFilteredResult(_0x22fc08,_0x3d0d78))[_0x1692('0x43')](handleError(_0x22fc08,null));};exports[_0x1692('0x44')]=function(_0x503a65,_0x45eec0){var _0x36022e={'raw':![],'where':{'id':_0x503a65[_0x1692('0x45')]['id']}},_0x9f63be={};_0x9f63be[_0x1692('0x2d')]=_[_0x1692('0x46')](db[_0x1692('0x28')][_0x1692('0x29')]);_0x9f63be[_0x1692('0x2f')]=_[_0x1692('0x46')](_0x503a65[_0x1692('0x2f')]);_0x9f63be[_0x1692('0x30')]=_[_0x1692('0x31')](_0x9f63be[_0x1692('0x2d')],_0x9f63be['query']);_0x36022e[_0x1692('0x32')]=_['intersection'](_0x9f63be[_0x1692('0x2d')],qs[_0x1692('0x33')](_0x503a65[_0x1692('0x2f')][_0x1692('0x33')]));_0x36022e['attributes']=_0x36022e[_0x1692('0x32')][_0x1692('0x34')]?_0x36022e[_0x1692('0x32')]:_0x9f63be[_0x1692('0x2d')];if(_0x503a65[_0x1692('0x2f')][_0x1692('0x40')]){_0x36022e[_0x1692('0x47')]=[{'all':!![]}];}_0x36022e=_[_0x1692('0x3c')]({},_0x36022e,_0x503a65[_0x1692('0x3e')]);return db[_0x1692('0x28')]['find'](_0x36022e)['then'](handleEntityNotFound(_0x45eec0,null))[_0x1692('0x24')](respondWithResult(_0x45eec0,null))[_0x1692('0x43')](handleError(_0x45eec0,null));};exports[_0x1692('0x48')]=function(_0x2521c5,_0x19f8f3){return db[_0x1692('0x28')]['create'](_0x2521c5['body'],{})['then'](respondWithResult(_0x19f8f3,0xc9))[_0x1692('0x43')](handleError(_0x19f8f3,null));};exports[_0x1692('0x23')]=function(_0x38d869,_0x2aa158){if(_0x38d869[_0x1692('0x49')]['id']){delete _0x38d869['body']['id'];}return db['Dynamics365Account'][_0x1692('0x4a')]({'where':{'id':_0x38d869['params']['id']}})[_0x1692('0x24')](handleEntityNotFound(_0x2aa158,null))[_0x1692('0x24')](saveUpdates(_0x38d869['body'],null))[_0x1692('0x24')](respondWithResult(_0x2aa158,null))[_0x1692('0x43')](handleError(_0x2aa158,null));};exports[_0x1692('0x4b')]=function(_0x73e1b5,_0x275b53){return db[_0x1692('0x28')][_0x1692('0x4a')]({'where':{'id':_0x73e1b5[_0x1692('0x45')]['id']}})[_0x1692('0x24')](handleEntityNotFound(_0x275b53,null))[_0x1692('0x24')](removeEntity(_0x275b53,null))[_0x1692('0x43')](handleError(_0x275b53,null));};exports[_0x1692('0x4c')]=function(_0x4a0776,_0x2bbddf,_0x212acb){var _0x36fe7b={};var _0xa81da9={};var _0x2b10dc;var _0x3fc057;return db['Dynamics365Account']['findOne']({'where':{'id':_0x4a0776[_0x1692('0x45')]['id']}})[_0x1692('0x24')](handleEntityNotFound(_0x2bbddf,null))['then'](function(_0x17bdd5){if(_0x17bdd5){_0x2b10dc=_0x17bdd5;_0xa81da9[_0x1692('0x2d')]=_['keys'](db[_0x1692('0x4d')][_0x1692('0x29')]);_0xa81da9[_0x1692('0x2f')]=_[_0x1692('0x46')](_0x4a0776['query']);_0xa81da9[_0x1692('0x30')]=_[_0x1692('0x31')](_0xa81da9[_0x1692('0x2d')],_0xa81da9[_0x1692('0x2f')]);_0x36fe7b[_0x1692('0x32')]=_[_0x1692('0x31')](_0xa81da9['model'],qs[_0x1692('0x33')](_0x4a0776[_0x1692('0x2f')]['fields']));_0x36fe7b[_0x1692('0x32')]=_0x36fe7b['attributes'][_0x1692('0x34')]?_0x36fe7b[_0x1692('0x32')]:_0xa81da9[_0x1692('0x2d')];_0x36fe7b['order']=qs[_0x1692('0x38')](_0x4a0776[_0x1692('0x2f')][_0x1692('0x38')]);_0x36fe7b[_0x1692('0x39')]=qs['filters'](_[_0x1692('0x3a')](_0x4a0776['query'],_0xa81da9[_0x1692('0x30')]));if(_0x4a0776[_0x1692('0x2f')]['filter']){_0x36fe7b['where']=_[_0x1692('0x3c')](_0x36fe7b[_0x1692('0x39')],{'$or':_[_0x1692('0x2e')](_0x36fe7b['attributes'],function(_0x3fe168){var _0x3164aa={};_0x3164aa[_0x3fe168]={'$like':'%'+_0x4a0776['query'][_0x1692('0x3b')]+'%'};return _0x3164aa;})});}_0x36fe7b=_[_0x1692('0x3c')]({},_0x36fe7b,_0x4a0776['options']);return _0x2b10dc[_0x1692('0x4c')](_0x36fe7b);}})['then'](function(_0x8318c1){if(_0x8318c1){_0x3fc057=_0x8318c1[_0x1692('0x34')];if(!_0x4a0776[_0x1692('0x2f')][_0x1692('0x35')](_0x1692('0x36'))){_0x36fe7b[_0x1692('0x1d')]=qs[_0x1692('0x1d')](_0x4a0776[_0x1692('0x2f')][_0x1692('0x1d')]);_0x36fe7b['offset']=qs['offset'](_0x4a0776['query']['offset']);}return _0x2b10dc[_0x1692('0x4c')](_0x36fe7b);}})[_0x1692('0x24')](function(_0x1e41fb){if(_0x1e41fb){return _0x1e41fb?{'count':_0x3fc057,'rows':_0x1e41fb}:null;}})[_0x1692('0x24')](respondWithResult(_0x2bbddf,null))['catch'](handleError(_0x2bbddf,null));};exports['addConfiguration']=function(_0x94acad,_0xc18c3a,_0x3c955a){if(_0x94acad[_0x1692('0x49')]['id']){delete _0x94acad[_0x1692('0x49')]['id'];}return db[_0x1692('0x28')][_0x1692('0x4e')]({'where':{'id':_0x94acad['params']['id']}})[_0x1692('0x24')](handleEntityNotFound(_0xc18c3a,null))['then'](function(_0x7f9c63){if(_0x7f9c63){_0x94acad[_0x1692('0x49')][_0x1692('0x4f')]=_0x7f9c63['id'];_0x94acad['body']['Subjects']=integrations['getSubjects'](_0x94acad[_0x1692('0x49')][_0x1692('0x50')],_0x94acad[_0x1692('0x49')]['type']);_0x94acad[_0x1692('0x49')][_0x1692('0x51')]=integrations[_0x1692('0x52')](_0x94acad[_0x1692('0x49')][_0x1692('0x50')],_0x94acad[_0x1692('0x49')][_0x1692('0x2b')]);return db[_0x1692('0x4d')][_0x1692('0x48')](_0x94acad[_0x1692('0x49')],{'include':[{'model':db[_0x1692('0x53')],'as':'Subjects'},{'model':db[_0x1692('0x53')],'as':_0x1692('0x51')}]});}return null;})[_0x1692('0x24')](respondWithResult(_0xc18c3a,null))[_0x1692('0x43')](handleError(_0xc18c3a,null));};exports[_0x1692('0x54')]=function(_0x45414c,_0x2ed40f,_0x167a4b){var _0x2929bd=_0x45414c[_0x1692('0x2f')]['ticketType'];var _0x3e54be=_0x2929bd===_0x1692('0x55')?_0x1692('0x56'):'PhoneCall';var _0x5b9981='';var _0x92971e='';var _0x4b1356='';var _0x2d7982='';var _0x48f099='';var _0x2f2099='';var _0x2c0e94='';var _0x4c3196='';var _0x309023=['title',_0x1692('0x57'),_0x1692('0x58'),'ownerid',_0x1692('0x59'),_0x1692('0x5a'),_0x1692('0x5b'),_0x1692('0x5c'),'directioncode',_0x1692('0x5d')];var _0x5dbe93=[_0x1692('0x5e'),_0x1692('0x5f'),_0x1692('0x60'),'billedserviceunits',_0x1692('0x61'),_0x1692('0x62'),_0x1692('0x63'),_0x1692('0x64'),_0x1692('0x65'),_0x1692('0x66'),'createdbyname','createdbyyominame',_0x1692('0x67'),_0x1692('0x68'),_0x1692('0x69'),_0x1692('0x6a'),_0x1692('0x6b'),'customeridyominame',_0x1692('0x6c'),_0x1692('0x6d'),_0x1692('0x6e'),_0x1692('0x6f'),_0x1692('0x70'),'exchangerate',_0x1692('0x71'),_0x1692('0x72'),_0x1692('0x73'),_0x1692('0x74'),_0x1692('0x75'),'lastonholdtime','masteridname',_0x1692('0x76'),_0x1692('0x77'),_0x1692('0x78'),_0x1692('0x79'),_0x1692('0x7a'),_0x1692('0x7b'),_0x1692('0x7c'),_0x1692('0x7d'),_0x1692('0x7e'),'numberofchildincidents',_0x1692('0x7f'),_0x1692('0x80'),_0x1692('0x81'),'owneridtype',_0x1692('0x82'),'parentcaseidname',_0x1692('0x83'),'primarycontactidyominame','prioritycodename',_0x1692('0x84'),'productserialnumber',_0x1692('0x85'),'resolvebykpiidname','responseby',_0x1692('0x86'),_0x1692('0x87'),_0x1692('0x88'),_0x1692('0x89'),_0x1692('0x8a'),_0x1692('0x8b'),'statecode','statuscode',_0x1692('0x8c'),_0x1692('0x8d'),_0x1692('0x8e'),_0x1692('0x8f'),_0x1692('0x90'),'utcconversiontimezonecode',_0x1692('0x91')];var _0x4dbbfb=_0x309023['concat'](_0x5dbe93);return db[_0x1692('0x28')][_0x1692('0x4e')]({'where':{'id':_0x45414c['params']['id']},'attributes':['id',_0x1692('0x92'),'password',_0x1692('0x93'),_0x1692('0x94'),_0x1692('0x95'),_0x1692('0x96')]})[_0x1692('0x24')](handleEntityNotFound(_0x2ed40f,null))[_0x1692('0x24')](function(_0x276d40){if(_0x276d40){_0x4c3196=_0x276d40[_0x1692('0x93')];var _0x549d3c=_0x4c3196[_0x1692('0x97')](-0x1);if(_0x549d3c==='/'){_0x4c3196=_0x4c3196[_0x1692('0x98')](0x0,_0x4c3196[_0x1692('0x99')](_0x549d3c));}_0x2c0e94=util['format'](_0x1692('0x9a'),_0x4c3196);var _0x2a77de={'method':_0x1692('0x9b'),'uri':_0x1692('0x9c')+_0x276d40[_0x1692('0x94')]+_0x1692('0x9d'),'form':{'client_id':_0x276d40[_0x1692('0x95')],'resource':_0x4c3196,'username':_0x276d40[_0x1692('0x92')],'password':_0x276d40[_0x1692('0x9e')],'grant_type':_0x1692('0x9e'),'client_secret':_0x276d40['clientSecret']},'json':!![]};return rp(_0x2a77de);}})[_0x1692('0x24')](function(_0x247c6b){_0x2f2099=_0x247c6b[_0x1692('0x9f')];var _0x47ea08={'method':_0x1692('0xa0'),'uri':encodeURI(_0x2c0e94+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x3e54be+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2f2099,'If-None-Match':null,'OData-Version':_0x1692('0xa1')},'json':!![]};return rp(_0x47ea08);})['then'](function(_0x1a1023){var _0xedc31c=_0x1a1023['value'][0x0];var _0x4075ee=_0xedc31c[_0x1692('0xa2')];var _0x12bafb={'method':_0x1692('0xa0'),'uri':_0x2c0e94+_0x1692('0xa3')+_0x4075ee+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x1692('0xa4')+_0x2f2099,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12bafb);})[_0x1692('0x24')](function(_0x18567a){_0x5b9981=_0x18567a;_0x92971e=_0x5b9981[_0x1692('0xa5')];_0x92971e=_['remove'](_0x92971e,function(_0x6850b0){return!_0x4dbbfb[_0x1692('0xa6')](_0x6850b0[_0x1692('0xa7')]);});var _0x4e33b2=[];var _0x111893=[];_0x92971e[_0x1692('0xa8')](function(_0xfd0019){if(_0xfd0019[_0x1692('0xa9')]){var _0x4c82c8=_0xfd0019['@odata.type'][_0x1692('0x98')](_0xfd0019[_0x1692('0xa9')]['lastIndexOf']('.')+0x1);if(_0x4c82c8==='PicklistAttributeMetadata'){_0x4e33b2[_0x1692('0xaa')](getSelectList(_0x2c0e94,_0x2929bd,_0x111893,_0x5b9981[_0x1692('0xa2')],_0xfd0019['MetadataId'],_0x2f2099));}}});return Promise[_0x1692('0xab')](_0x4e33b2);})[_0x1692('0x24')](function(_0x5ad99d){_0x4b1356=_0x5ad99d[0x0];var _0x49fc46=[];var _0x15f0d3=[];_0x92971e[_0x1692('0xa8')](function(_0x5c618e){if(!_[_0x1692('0xac')](_0x5c618e[_0x1692('0xa9')])){var _0x439820=_0x5c618e[_0x1692('0xa9')][_0x1692('0x98')](_0x5c618e[_0x1692('0xa9')][_0x1692('0x99')]('.')+0x1);if(_0x439820==='BooleanAttributeMetadata'){_0x49fc46[_0x1692('0xaa')](getBooleanList(_0x2c0e94,_0x2929bd,_0x15f0d3,_0x5b9981['MetadataId'],_0x5c618e[_0x1692('0xa2')],_0x2f2099));}}});return Promise[_0x1692('0xab')](_0x49fc46);})[_0x1692('0x24')](function(_0x65a00f){_0x2d7982=_0x65a00f[0x0];var _0x2cf0a1=[];var _0x1581a2=[];_0x92971e['forEach'](function(_0xfb3789){if(_0xfb3789[_0x1692('0xa9')]){var _0x1c02bd=_0xfb3789['@odata.type'][_0x1692('0x98')](_0xfb3789['@odata.type'][_0x1692('0x99')]('.')+0x1);if(_0x1c02bd===_0x1692('0xad')||_0x1c02bd===_0x1692('0xae')||_0x1c02bd===_0x1692('0xaf')||_0x1c02bd===_0x1692('0xb0')||_0x1c02bd===_0x1692('0xb1')||_0x1c02bd===_0x1692('0xb2')||_0x1c02bd===_0x1692('0xb3')||_0x1c02bd==='EntityNameAttributeMetadata'||_0x1c02bd===_0x1692('0xb4')||_0x1c02bd===_0x1692('0xb5')){_0x2cf0a1[_0x1692('0xaa')](getInputList(_0x2c0e94,_0x2929bd,_0x1c02bd,_0x1581a2,_0x5b9981[_0x1692('0xa2')],_0xfb3789['MetadataId'],_0x2f2099));}}});return Promise[_0x1692('0xab')](_0x2cf0a1);})[_0x1692('0x24')](function(_0x5401ea){_0x48f099=_0x5401ea[0x0];var _0x4bc32a=_0x4b1356[_0x1692('0xb6')](_0x2d7982)[_0x1692('0xb6')](_0x48f099);var _0x446c3f={'count':_0x4bc32a[_0x1692('0x34')],'rows':_0x4bc32a};return _0x446c3f;})[_0x1692('0x24')](respondWithResult(_0x2ed40f,null))['catch'](function(_0x11a01c){var _0x404167=_0x45414c['query'][_0x1692('0xb7')]?0x1f4:_0x11a01c['statusCode']||0x1f4;logger[_0x1692('0xb8')](_0x11a01c[_0x1692('0x26')]);delete _0x11a01c[_0x1692('0x27')];if(_0x404167===0x191){_0x404167=0x190;}_0x2ed40f[_0x1692('0x19')](_0x404167)[_0x1692('0xb9')](_0x45414c[_0x1692('0x2f')][_0x1692('0xb7')]?{'message':'Wrong\x20credentials','statusCode':_0x11a01c[_0x1692('0xba')]}:_0x11a01c);});};function getSelectList(_0x480171,_0x3e3bd8,_0x2c51ae,_0x1f6acc,_0x96c4a7,_0x5da061){var _0x3add1e={'method':_0x1692('0xa0'),'uri':_0x480171+_0x1692('0xa3')+_0x1f6acc+_0x1692('0xbb')+_0x96c4a7+_0x1692('0xbc')+_0x1692('0xbd'),'headers':{'Authorization':_0x1692('0xa4')+_0x5da061,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3add1e)['then'](function(_0x4f92e7){var _0x313558=[];var _0x19ee20=_0x4f92e7[_0x1692('0xbe')][_0x1692('0xbf')];_0x19ee20[_0x1692('0xa8')](function(_0x50049f){_0x313558[_0x1692('0xaa')]({'name':_0x50049f[_0x1692('0xc0')][_0x1692('0xc1')]['Label'],'value':String(_0x50049f['Value'])});});var _0x580ab2={'id':_0x3e3bd8+'_'+_0x4f92e7['LogicalName'],'name':_0x4f92e7[_0x1692('0xc2')][_0x1692('0xc1')][_0x1692('0xc0')],'custom':![],'options':_0x313558};_0x2c51ae[_0x1692('0xaa')](_0x580ab2);return _0x2c51ae;});}function getBooleanList(_0x36260e,_0x4157e2,_0x3ea100,_0xb2302e,_0x35be57,_0x212059){var _0x7c6611={'method':'GET','uri':_0x36260e+_0x1692('0xa3')+_0xb2302e+')/Attributes('+_0x35be57+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x1692('0xa4')+_0x212059,'If-None-Match':null,'OData-Version':_0x1692('0xa1')},'json':!![]};return rp(_0x7c6611)[_0x1692('0x24')](function(_0x2c7106){var _0x73abc2=[];_0x73abc2[_0x1692('0xaa')]({'name':_0x2c7106['OptionSet'][_0x1692('0xc3')][_0x1692('0xc0')][_0x1692('0xc1')]['Label'],'value':'true'},{'name':_0x2c7106[_0x1692('0xbe')]['FalseOption'][_0x1692('0xc0')][_0x1692('0xc1')][_0x1692('0xc0')],'value':_0x1692('0xc4')});var _0x67c6fb={'id':_0x4157e2+'_'+_0x2c7106[_0x1692('0xa7')],'name':_0x2c7106[_0x1692('0xc2')][_0x1692('0xc1')][_0x1692('0xc0')],'custom':![],'options':_0x73abc2};_0x3ea100[_0x1692('0xaa')](_0x67c6fb);return _0x3ea100;});}function getInputList(_0xababd6,_0xebc392,_0x44e9d0,_0x476005,_0x1b79a6,_0x1851dd,_0x362e4e){var _0x235a51={'method':_0x1692('0xa0'),'uri':_0xababd6+_0x1692('0xa3')+_0x1b79a6+_0x1692('0xbb')+_0x1851dd+_0x1692('0xc5')+_0x44e9d0+_0x1692('0xc6'),'headers':{'Authorization':_0x1692('0xa4')+_0x362e4e,'If-None-Match':null,'OData-Version':_0x1692('0xa1')},'json':!![]};return rp(_0x235a51)[_0x1692('0x24')](function(_0x2a8c6e){var _0x3d9e56={'id':_0xebc392+'_'+_0x2a8c6e['LogicalName'],'name':_0x2a8c6e['DisplayName'][_0x1692('0xc1')]?_0x2a8c6e[_0x1692('0xc2')][_0x1692('0xc1')]['Label']:_0x2a8c6e[_0x1692('0xa7')],'custom':![],'options':[]};_0x476005[_0x1692('0xaa')](_0x3d9e56);return _0x476005;});} \ No newline at end of file +var _0x65f4=['util','path','to-csv','ejs','fs-extra','squel','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','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','Dynamics365Account','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','statusCode','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x65f4,0x19a));var _0x465f=function(_0x3d617e,_0x49c2fd){_0x3d617e=_0x3d617e-0x0;var _0x2dc030=_0x65f4[_0x3d617e];return _0x2dc030;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x465f('0x0'));var jsonpatch=require(_0x465f('0x1'));var rp=require(_0x465f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x465f('0x3'));var util=require(_0x465f('0x4'));var path=require(_0x465f('0x5'));var sox=require('sox');var csv=require(_0x465f('0x6'));var ejs=require(_0x465f('0x7'));var fs=require('fs');var fs_extra=require(_0x465f('0x8'));var _=require('lodash');var squel=require(_0x465f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x465f('0xa'));var toCsv=require(_0x465f('0x6'));var querystring=require(_0x465f('0xb'));var Papa=require(_0x465f('0xc'));var Redis=require(_0x465f('0xd'));var authService=require(_0x465f('0xe'));var qs=require(_0x465f('0xf'));var as=require(_0x465f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x465f('0x11'))(_0x465f('0x12'));var utils=require(_0x465f('0x13'));var config=require(_0x465f('0x14'));var licenseUtil=require(_0x465f('0x15'));var db=require(_0x465f('0x16'))['db'];var integrations=require(_0x465f('0x17'));function respondWithStatusCode(_0x2fce97,_0x30e5ba){_0x30e5ba=_0x30e5ba||0xcc;return function(_0x5937e6){if(_0x5937e6){return _0x2fce97['sendStatus'](_0x30e5ba);}return _0x2fce97[_0x465f('0x18')](_0x30e5ba)[_0x465f('0x19')]();};}function respondWithResult(_0x2cb09c,_0x3a6c49){_0x3a6c49=_0x3a6c49||0xc8;return function(_0x532e49){if(_0x532e49){return _0x2cb09c[_0x465f('0x18')](_0x3a6c49)[_0x465f('0x1a')](_0x532e49);}};}function respondWithFilteredResult(_0x52f29d,_0x5f25d0){return function(_0x20beae){if(_0x20beae){var _0x211ee2=typeof _0x5f25d0[_0x465f('0x1b')]===_0x465f('0x1c')&&typeof _0x5f25d0[_0x465f('0x1d')]==='undefined';var _0x2daf5b=_0x20beae[_0x465f('0x1e')];var _0x331e45=_0x211ee2?0x0:_0x5f25d0['offset'];var _0x119227=_0x211ee2?_0x20beae[_0x465f('0x1e')]:_0x5f25d0['offset']+_0x5f25d0[_0x465f('0x1d')];var _0x4d9fd1;if(_0x119227>=_0x2daf5b){_0x119227=_0x2daf5b;_0x4d9fd1=0xc8;}else{_0x4d9fd1=0xce;}_0x52f29d[_0x465f('0x18')](_0x4d9fd1);return _0x52f29d[_0x465f('0x1f')](_0x465f('0x20'),_0x331e45+'-'+_0x119227+'/'+_0x2daf5b)[_0x465f('0x1a')](_0x20beae);}return null;};}function patchUpdates(_0x3c5ad0){return function(_0x15d843){try{jsonpatch[_0x465f('0x21')](_0x15d843,_0x3c5ad0,!![]);}catch(_0x9a717d){return BPromise[_0x465f('0x22')](_0x9a717d);}return _0x15d843[_0x465f('0x23')]();};}function saveUpdates(_0x36f8eb,_0x4aa4a8){return function(_0x41e279){if(_0x41e279){return _0x41e279[_0x465f('0x24')](_0x36f8eb)[_0x465f('0x25')](function(_0x317aed){return _0x317aed;});}return null;};}function removeEntity(_0x1d6677,_0x2566e3){return function(_0x944e42){if(_0x944e42){return _0x944e42[_0x465f('0x26')]()[_0x465f('0x25')](function(){_0x1d6677[_0x465f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186fff,_0x329007){return function(_0x4fda81){if(!_0x4fda81){_0x186fff['sendStatus'](0x194);}return _0x4fda81;};}function handleError(_0xc45dc,_0x3cd248){_0x3cd248=_0x3cd248||0x1f4;return function(_0x2fc986){logger[_0x465f('0x27')](_0x2fc986[_0x465f('0x28')]);if(_0x2fc986[_0x465f('0x29')]){delete _0x2fc986[_0x465f('0x29')];}_0xc45dc[_0x465f('0x18')](_0x3cd248)[_0x465f('0x2a')](_0x2fc986);};}exports[_0x465f('0x2b')]=function(_0x5299c4,_0x222240){var _0x3ad80e={},_0x522fc3={},_0x13a058={'count':0x0,'rows':[]};var _0x4a6301=_[_0x465f('0x2c')](db['Dynamics365Account'][_0x465f('0x2d')],function(_0x205327){return{'name':_0x205327[_0x465f('0x2e')],'type':_0x205327[_0x465f('0x2f')]['key']};});_0x522fc3[_0x465f('0x30')]=_[_0x465f('0x2c')](_0x4a6301,_0x465f('0x29'));_0x522fc3['query']=_[_0x465f('0x31')](_0x5299c4[_0x465f('0x32')]);_0x522fc3[_0x465f('0x33')]=_['intersection'](_0x522fc3[_0x465f('0x30')],_0x522fc3[_0x465f('0x32')]);_0x3ad80e[_0x465f('0x34')]=_[_0x465f('0x35')](_0x522fc3[_0x465f('0x30')],qs['fields'](_0x5299c4['query'][_0x465f('0x36')]));_0x3ad80e[_0x465f('0x34')]=_0x3ad80e[_0x465f('0x34')]['length']?_0x3ad80e[_0x465f('0x34')]:_0x522fc3['model'];if(!_0x5299c4[_0x465f('0x32')][_0x465f('0x37')](_0x465f('0x38'))){_0x3ad80e[_0x465f('0x1d')]=qs[_0x465f('0x1d')](_0x5299c4[_0x465f('0x32')]['limit']);_0x3ad80e['offset']=qs[_0x465f('0x1b')](_0x5299c4[_0x465f('0x32')][_0x465f('0x1b')]);}_0x3ad80e[_0x465f('0x39')]=qs[_0x465f('0x3a')](_0x5299c4['query'][_0x465f('0x3a')]);_0x3ad80e[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x5299c4['query'],_0x522fc3['filters']),_0x4a6301);if(_0x5299c4[_0x465f('0x32')]['filter']){_0x3ad80e[_0x465f('0x3b')]=_[_0x465f('0x3d')](_0x3ad80e[_0x465f('0x3b')],{'$or':_[_0x465f('0x2c')](_0x4a6301,function(_0xbbb0ee){if(_0xbbb0ee['type']!==_0x465f('0x3e')){var _0x3d99dc={};_0x3d99dc[_0xbbb0ee[_0x465f('0x29')]]={'$like':'%'+_0x5299c4[_0x465f('0x32')]['filter']+'%'};return _0x3d99dc;}})});}_0x3ad80e=_[_0x465f('0x3d')]({},_0x3ad80e,_0x5299c4[_0x465f('0x3f')]);var _0x4b7289={'where':_0x3ad80e[_0x465f('0x3b')]};return db['Dynamics365Account'][_0x465f('0x1e')](_0x4b7289)['then'](function(_0x57f62a){_0x13a058[_0x465f('0x1e')]=_0x57f62a;if(_0x5299c4[_0x465f('0x32')][_0x465f('0x40')]){_0x3ad80e[_0x465f('0x41')]=[{'all':!![]}];}return db[_0x465f('0x42')]['findAll'](_0x3ad80e);})[_0x465f('0x25')](function(_0x411f3d){_0x13a058[_0x465f('0x43')]=_0x411f3d;return _0x13a058;})[_0x465f('0x25')](respondWithFilteredResult(_0x222240,_0x3ad80e))[_0x465f('0x44')](handleError(_0x222240,null));};exports[_0x465f('0x45')]=function(_0x50bf60,_0x39a47d){var _0x39d770={'raw':![],'where':{'id':_0x50bf60[_0x465f('0x46')]['id']}},_0x5745d2={};_0x5745d2[_0x465f('0x30')]=_[_0x465f('0x31')](db[_0x465f('0x42')][_0x465f('0x2d')]);_0x5745d2[_0x465f('0x32')]=_[_0x465f('0x31')](_0x50bf60[_0x465f('0x32')]);_0x5745d2[_0x465f('0x33')]=_[_0x465f('0x35')](_0x5745d2[_0x465f('0x30')],_0x5745d2[_0x465f('0x32')]);_0x39d770[_0x465f('0x34')]=_[_0x465f('0x35')](_0x5745d2[_0x465f('0x30')],qs[_0x465f('0x36')](_0x50bf60[_0x465f('0x32')][_0x465f('0x36')]));_0x39d770[_0x465f('0x34')]=_0x39d770[_0x465f('0x34')][_0x465f('0x47')]?_0x39d770[_0x465f('0x34')]:_0x5745d2[_0x465f('0x30')];if(_0x50bf60[_0x465f('0x32')][_0x465f('0x40')]){_0x39d770[_0x465f('0x41')]=[{'all':!![]}];}_0x39d770=_['merge']({},_0x39d770,_0x50bf60[_0x465f('0x3f')]);return db[_0x465f('0x42')][_0x465f('0x48')](_0x39d770)[_0x465f('0x25')](handleEntityNotFound(_0x39a47d,null))[_0x465f('0x25')](respondWithResult(_0x39a47d,null))[_0x465f('0x44')](handleError(_0x39a47d,null));};exports[_0x465f('0x49')]=function(_0x22d8b6,_0x13fe21){return db[_0x465f('0x42')][_0x465f('0x49')](_0x22d8b6[_0x465f('0x4a')],{})['then'](respondWithResult(_0x13fe21,0xc9))[_0x465f('0x44')](handleError(_0x13fe21,null));};exports[_0x465f('0x24')]=function(_0x1d7cc0,_0x3d7c25){if(_0x1d7cc0[_0x465f('0x4a')]['id']){delete _0x1d7cc0[_0x465f('0x4a')]['id'];}return db[_0x465f('0x42')][_0x465f('0x48')]({'where':{'id':_0x1d7cc0[_0x465f('0x46')]['id']}})[_0x465f('0x25')](handleEntityNotFound(_0x3d7c25,null))[_0x465f('0x25')](saveUpdates(_0x1d7cc0[_0x465f('0x4a')],null))[_0x465f('0x25')](respondWithResult(_0x3d7c25,null))[_0x465f('0x44')](handleError(_0x3d7c25,null));};exports[_0x465f('0x26')]=function(_0x1b55ad,_0x594d11){return db['Dynamics365Account'][_0x465f('0x48')]({'where':{'id':_0x1b55ad[_0x465f('0x46')]['id']}})['then'](handleEntityNotFound(_0x594d11,null))['then'](removeEntity(_0x594d11,null))[_0x465f('0x44')](handleError(_0x594d11,null));};exports[_0x465f('0x4b')]=function(_0x3c06ac,_0x4ce7a7,_0x2a671c){var _0x250a25={};var _0x3fb152={};var _0x341836;var _0x42e53a;return db[_0x465f('0x42')][_0x465f('0x4c')]({'where':{'id':_0x3c06ac[_0x465f('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ce7a7,null))[_0x465f('0x25')](function(_0x28f097){if(_0x28f097){_0x341836=_0x28f097;_0x3fb152[_0x465f('0x30')]=_[_0x465f('0x31')](db['Dynamics365Configuration']['rawAttributes']);_0x3fb152['query']=_[_0x465f('0x31')](_0x3c06ac[_0x465f('0x32')]);_0x3fb152[_0x465f('0x33')]=_[_0x465f('0x35')](_0x3fb152['model'],_0x3fb152[_0x465f('0x32')]);_0x250a25[_0x465f('0x34')]=_['intersection'](_0x3fb152[_0x465f('0x30')],qs[_0x465f('0x36')](_0x3c06ac[_0x465f('0x32')]['fields']));_0x250a25[_0x465f('0x34')]=_0x250a25[_0x465f('0x34')][_0x465f('0x47')]?_0x250a25[_0x465f('0x34')]:_0x3fb152[_0x465f('0x30')];_0x250a25['order']=qs[_0x465f('0x3a')](_0x3c06ac['query'][_0x465f('0x3a')]);_0x250a25[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x3c06ac['query'],_0x3fb152[_0x465f('0x33')]));if(_0x3c06ac[_0x465f('0x32')]['filter']){_0x250a25[_0x465f('0x3b')]=_[_0x465f('0x3d')](_0x250a25[_0x465f('0x3b')],{'$or':_[_0x465f('0x2c')](_0x250a25[_0x465f('0x34')],function(_0xeccd7d){var _0x2829c1={};_0x2829c1[_0xeccd7d]={'$like':'%'+_0x3c06ac[_0x465f('0x32')]['filter']+'%'};return _0x2829c1;})});}_0x250a25=_['merge']({},_0x250a25,_0x3c06ac[_0x465f('0x3f')]);return _0x341836[_0x465f('0x4b')](_0x250a25);}})[_0x465f('0x25')](function(_0x4603ea){if(_0x4603ea){_0x42e53a=_0x4603ea[_0x465f('0x47')];if(!_0x3c06ac[_0x465f('0x32')][_0x465f('0x37')](_0x465f('0x38'))){_0x250a25[_0x465f('0x1d')]=qs[_0x465f('0x1d')](_0x3c06ac[_0x465f('0x32')][_0x465f('0x1d')]);_0x250a25[_0x465f('0x1b')]=qs[_0x465f('0x1b')](_0x3c06ac[_0x465f('0x32')][_0x465f('0x1b')]);}return _0x341836[_0x465f('0x4b')](_0x250a25);}})[_0x465f('0x25')](function(_0x179630){if(_0x179630){return _0x179630?{'count':_0x42e53a,'rows':_0x179630}:null;}})[_0x465f('0x25')](respondWithResult(_0x4ce7a7,null))[_0x465f('0x44')](handleError(_0x4ce7a7,null));};exports['addConfiguration']=function(_0x4c7655,_0x3f6f28,_0x18721c){if(_0x4c7655[_0x465f('0x4a')]['id']){delete _0x4c7655[_0x465f('0x4a')]['id'];}return db['Dynamics365Account'][_0x465f('0x4c')]({'where':{'id':_0x4c7655['params']['id']}})['then'](handleEntityNotFound(_0x3f6f28,null))[_0x465f('0x25')](function(_0x832ba3){if(_0x832ba3){_0x4c7655[_0x465f('0x4a')][_0x465f('0x4d')]=_0x832ba3['id'];_0x4c7655[_0x465f('0x4a')][_0x465f('0x4e')]=integrations[_0x465f('0x4f')](_0x4c7655[_0x465f('0x4a')][_0x465f('0x50')],_0x4c7655['body']['type']);_0x4c7655[_0x465f('0x4a')][_0x465f('0x51')]=integrations[_0x465f('0x52')](_0x4c7655[_0x465f('0x4a')][_0x465f('0x50')],_0x4c7655[_0x465f('0x4a')][_0x465f('0x2f')]);return db[_0x465f('0x53')][_0x465f('0x49')](_0x4c7655[_0x465f('0x4a')],{'include':[{'model':db[_0x465f('0x54')],'as':_0x465f('0x4e')},{'model':db[_0x465f('0x54')],'as':'Descriptions'}]});}return null;})[_0x465f('0x25')](respondWithResult(_0x3f6f28,null))[_0x465f('0x44')](handleError(_0x3f6f28,null));};exports[_0x465f('0x55')]=function(_0x139e59,_0x12de31,_0x278a62){var _0x4486a1=_0x139e59['query']['ticketType'];var _0x53688f=_0x4486a1===_0x465f('0x56')?_0x465f('0x57'):_0x465f('0x58');var _0x1c2c22='';var _0x3898cf='';var _0x5d51c2='';var _0x217d2b='';var _0x4a833d='';var _0x1a5272='';var _0x5be8f4='';var _0x28d6ae='';var _0x3705d9=[_0x465f('0x59'),_0x465f('0x5a'),_0x465f('0x5b'),_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),_0x465f('0x5f'),'regardingobjectid',_0x465f('0x60'),'phonecall_activity_parties'];var _0x24f6a9=[_0x465f('0x61'),_0x465f('0x62'),_0x465f('0x63'),'billedserviceunits',_0x465f('0x64'),_0x465f('0x65'),'contractdetailidname',_0x465f('0x66'),_0x465f('0x67'),'createdbyexternalpartyyominame',_0x465f('0x68'),_0x465f('0x69'),_0x465f('0x6a'),_0x465f('0x6b'),'createdonbehalfbyyominame',_0x465f('0x6c'),_0x465f('0x6d'),_0x465f('0x6e'),_0x465f('0x6f'),'entitlementidname',_0x465f('0x70'),_0x465f('0x71'),_0x465f('0x72'),_0x465f('0x73'),_0x465f('0x74'),_0x465f('0x75'),_0x465f('0x76'),_0x465f('0x77'),_0x465f('0x78'),'lastonholdtime',_0x465f('0x79'),_0x465f('0x7a'),'modifiedbyexternalpartyyominame',_0x465f('0x7b'),_0x465f('0x7c'),_0x465f('0x7d'),_0x465f('0x7e'),_0x465f('0x7f'),_0x465f('0x80'),_0x465f('0x81'),_0x465f('0x82'),_0x465f('0x83'),_0x465f('0x84'),_0x465f('0x85'),_0x465f('0x86'),'owneridyominame',_0x465f('0x87'),_0x465f('0x88'),_0x465f('0x89'),_0x465f('0x8a'),_0x465f('0x8b'),_0x465f('0x8c'),_0x465f('0x8d'),_0x465f('0x8e'),_0x465f('0x8f'),'responsiblecontactidname','responsiblecontactidyominame',_0x465f('0x90'),_0x465f('0x91'),_0x465f('0x92'),'socialprofileidname','statecode',_0x465f('0x93'),_0x465f('0x94'),'ticketnumber',_0x465f('0x95'),_0x465f('0x96'),'traversedpath','utcconversiontimezonecode',_0x465f('0x97')];var _0x493d59=_0x3705d9['concat'](_0x24f6a9);return db[_0x465f('0x42')][_0x465f('0x4c')]({'where':{'id':_0x139e59[_0x465f('0x46')]['id']},'attributes':['id',_0x465f('0x98'),_0x465f('0x99'),_0x465f('0x9a'),_0x465f('0x9b'),_0x465f('0x9c'),_0x465f('0x9d')]})[_0x465f('0x25')](handleEntityNotFound(_0x12de31,null))['then'](function(_0x592c8b){if(_0x592c8b){_0x28d6ae=_0x592c8b[_0x465f('0x9a')];var _0x156548=_0x28d6ae[_0x465f('0x9e')](-0x1);if(_0x156548==='/'){_0x28d6ae=_0x28d6ae[_0x465f('0x9f')](0x0,_0x28d6ae[_0x465f('0xa0')](_0x156548));}_0x5be8f4=util[_0x465f('0xa1')](_0x465f('0xa2'),_0x28d6ae);var _0x5eb2fe={'method':'POST','uri':_0x465f('0xa3')+_0x592c8b[_0x465f('0x9b')]+_0x465f('0xa4'),'form':{'client_id':_0x592c8b[_0x465f('0x9c')],'resource':_0x28d6ae,'username':_0x592c8b['username'],'password':_0x592c8b[_0x465f('0x99')],'grant_type':'password','client_secret':_0x592c8b['clientSecret']},'json':!![]};return rp(_0x5eb2fe);}})['then'](function(_0x5d5a4f){_0x1a5272=_0x5d5a4f['access_token'];var _0x49f557={'method':_0x465f('0xa5'),'uri':encodeURI(_0x5be8f4+_0x465f('0xa6')+_0x53688f+'\x27'),'headers':{'Authorization':_0x465f('0xa7')+_0x1a5272,'If-None-Match':null,'OData-Version':_0x465f('0xa8')},'json':!![]};return rp(_0x49f557);})[_0x465f('0x25')](function(_0x4f53e4){var _0x2dcd1b=_0x4f53e4[_0x465f('0xa9')][0x0];var _0x30f55b=_0x2dcd1b['MetadataId'];var _0xa99b84={'method':_0x465f('0xa5'),'uri':_0x5be8f4+'EntityDefinitions('+_0x30f55b+_0x465f('0xaa'),'headers':{'Authorization':'Bearer\x20'+_0x1a5272,'If-None-Match':null,'OData-Version':_0x465f('0xa8')},'json':!![]};return rp(_0xa99b84);})[_0x465f('0x25')](function(_0x47a8fa){_0x1c2c22=_0x47a8fa;_0x3898cf=_0x1c2c22['Attributes'];_0x3898cf=_[_0x465f('0xab')](_0x3898cf,function(_0x4cf9ad){return!_0x493d59[_0x465f('0xac')](_0x4cf9ad[_0x465f('0xad')]);});var _0xa94d3c=[];var _0x90e322=[];_0x3898cf[_0x465f('0xae')](function(_0x397e1d){if(_0x397e1d[_0x465f('0xaf')]){var _0x548f2d=_0x397e1d[_0x465f('0xaf')]['substring'](_0x397e1d[_0x465f('0xaf')]['lastIndexOf']('.')+0x1);if(_0x548f2d===_0x465f('0xb0')){_0xa94d3c[_0x465f('0xb1')](getSelectList(_0x5be8f4,_0x4486a1,_0x90e322,_0x1c2c22[_0x465f('0xb2')],_0x397e1d[_0x465f('0xb2')],_0x1a5272));}}});return Promise[_0x465f('0xb3')](_0xa94d3c);})[_0x465f('0x25')](function(_0x4ca969){_0x5d51c2=_0x4ca969[0x0];var _0x1e1fa6=[];var _0x128f4d=[];_0x3898cf[_0x465f('0xae')](function(_0x351203){if(!_[_0x465f('0xb4')](_0x351203[_0x465f('0xaf')])){var _0x1f9131=_0x351203[_0x465f('0xaf')][_0x465f('0x9f')](_0x351203[_0x465f('0xaf')][_0x465f('0xa0')]('.')+0x1);if(_0x1f9131==='BooleanAttributeMetadata'){_0x1e1fa6['push'](getBooleanList(_0x5be8f4,_0x4486a1,_0x128f4d,_0x1c2c22[_0x465f('0xb2')],_0x351203['MetadataId'],_0x1a5272));}}});return Promise[_0x465f('0xb3')](_0x1e1fa6);})['then'](function(_0x19c155){_0x217d2b=_0x19c155[0x0];var _0x58a100=[];var _0x35be90=[];_0x3898cf[_0x465f('0xae')](function(_0x1e3ba4){if(_0x1e3ba4[_0x465f('0xaf')]){var _0x2d76f2=_0x1e3ba4[_0x465f('0xaf')]['substring'](_0x1e3ba4['@odata.type'][_0x465f('0xa0')]('.')+0x1);if(_0x2d76f2===_0x465f('0xb5')||_0x2d76f2==='DoubleAttributeMetadata'||_0x2d76f2===_0x465f('0xb6')||_0x2d76f2===_0x465f('0xb7')||_0x2d76f2===_0x465f('0xb8')||_0x2d76f2===_0x465f('0xb9')||_0x2d76f2===_0x465f('0xba')||_0x2d76f2===_0x465f('0xbb')||_0x2d76f2===_0x465f('0xbc')||_0x2d76f2==='DecimalAttributeMetadata'){_0x58a100['push'](getInputList(_0x5be8f4,_0x4486a1,_0x2d76f2,_0x35be90,_0x1c2c22[_0x465f('0xb2')],_0x1e3ba4['MetadataId'],_0x1a5272));}}});return Promise[_0x465f('0xb3')](_0x58a100);})[_0x465f('0x25')](function(_0x1de813){_0x4a833d=_0x1de813[0x0];var _0x3f7626=_0x5d51c2[_0x465f('0xbd')](_0x217d2b)[_0x465f('0xbd')](_0x4a833d);var _0x1ee306={'count':_0x3f7626[_0x465f('0x47')],'rows':_0x3f7626};return _0x1ee306;})['then'](respondWithResult(_0x12de31,null))[_0x465f('0x44')](function(_0x42cd76){var _0x5df896=_0x139e59[_0x465f('0x32')]['test']?0x1f4:_0x42cd76[_0x465f('0xbe')]||0x1f4;logger['error'](_0x42cd76[_0x465f('0x28')]);delete _0x42cd76[_0x465f('0x29')];if(_0x5df896===0x191){_0x5df896=0x190;}_0x12de31[_0x465f('0x18')](_0x5df896)[_0x465f('0x2a')](_0x139e59[_0x465f('0x32')][_0x465f('0xbf')]?{'message':_0x465f('0xc0'),'statusCode':_0x42cd76[_0x465f('0xbe')]}:_0x42cd76);});};function getSelectList(_0x35bb5b,_0x352e2a,_0x5badfa,_0x4201c4,_0x599954,_0x390b43){var _0x47f0e2={'method':'GET','uri':_0x35bb5b+_0x465f('0xc1')+_0x4201c4+_0x465f('0xc2')+_0x599954+_0x465f('0xc3')+_0x465f('0xc4'),'headers':{'Authorization':_0x465f('0xa7')+_0x390b43,'If-None-Match':null,'OData-Version':_0x465f('0xa8')},'json':!![]};return rp(_0x47f0e2)[_0x465f('0x25')](function(_0x148169){var _0xc680bd=[];var _0x8c373a=_0x148169[_0x465f('0xc5')][_0x465f('0xc6')];_0x8c373a[_0x465f('0xae')](function(_0x461274){_0xc680bd[_0x465f('0xb1')]({'name':_0x461274[_0x465f('0xc7')][_0x465f('0xc8')][_0x465f('0xc7')],'value':String(_0x461274['Value'])});});var _0x162e28={'id':_0x352e2a+'_'+_0x148169[_0x465f('0xad')],'name':_0x148169[_0x465f('0xc9')]['UserLocalizedLabel'][_0x465f('0xc7')],'custom':![],'options':_0xc680bd};_0x5badfa['push'](_0x162e28);return _0x5badfa;});}function getBooleanList(_0x13718f,_0x208147,_0x1aa2c7,_0x287070,_0x542888,_0x5f4fd2){var _0x3db564={'method':'GET','uri':_0x13718f+'EntityDefinitions('+_0x287070+_0x465f('0xc2')+_0x542888+_0x465f('0xca'),'headers':{'Authorization':_0x465f('0xa7')+_0x5f4fd2,'If-None-Match':null,'OData-Version':_0x465f('0xa8')},'json':!![]};return rp(_0x3db564)['then'](function(_0x4d7217){var _0x37dedd=[];_0x37dedd[_0x465f('0xb1')]({'name':_0x4d7217['OptionSet'][_0x465f('0xcb')]['Label'][_0x465f('0xc8')][_0x465f('0xc7')],'value':'true'},{'name':_0x4d7217[_0x465f('0xc5')][_0x465f('0xcc')]['Label']['UserLocalizedLabel']['Label'],'value':_0x465f('0xcd')});var _0x3b45ac={'id':_0x208147+'_'+_0x4d7217[_0x465f('0xad')],'name':_0x4d7217[_0x465f('0xc9')][_0x465f('0xc8')][_0x465f('0xc7')],'custom':![],'options':_0x37dedd};_0x1aa2c7[_0x465f('0xb1')](_0x3b45ac);return _0x1aa2c7;});}function getInputList(_0x34eb2f,_0xfade59,_0x329420,_0x1fdd97,_0x750d61,_0x298be5,_0x19e14e){var _0x402c05={'method':_0x465f('0xa5'),'uri':_0x34eb2f+_0x465f('0xc1')+_0x750d61+_0x465f('0xc2')+_0x298be5+_0x465f('0xce')+_0x329420+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x465f('0xa7')+_0x19e14e,'If-None-Match':null,'OData-Version':_0x465f('0xa8')},'json':!![]};return rp(_0x402c05)['then'](function(_0x27af42){var _0x12cd23={'id':_0xfade59+'_'+_0x27af42[_0x465f('0xad')],'name':_0x27af42[_0x465f('0xc9')][_0x465f('0xc8')]?_0x27af42['DisplayName']['UserLocalizedLabel'][_0x465f('0xc7')]:_0x27af42[_0x465f('0xad')],'custom':![],'options':[]};_0x1fdd97[_0x465f('0xb1')](_0x12cd23);return _0x1fdd97;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1b23d3d..5db15a7 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0xb09bed,_0x45db90){var _0x55927e=function(_0x5dc156){while(--_0x5dc156){_0xb09bed['push'](_0xb09bed['shift']());}};_0x55927e(++_0x45db90);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _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(_0x568697,_0x6990a9){var _0x43619c=function(_0x4730a5){while(--_0x4730a5){_0x568697['push'](_0x568697['shift']());}};_0x43619c(++_0x6990a9);}(_0xe706,0xa3));var _0x6e70=function(_0x3592ab,_0x4f669a){_0x3592ab=_0x3592ab-0x0;var _0x13298a=_0xe706[_0x3592ab];return _0x13298a;};'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 fee7e82..10e5103 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 _0x955f=['client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','stringify','find','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x104d23,_0x39fb6c){var _0x1988c5=function(_0x1c839f){while(--_0x1c839f){_0x104d23['push'](_0x104d23['shift']());}};_0x1988c5(++_0x39fb6c);}(_0x955f,0xff));var _0xf955=function(_0x24c5f3,_0x58dc38){_0x24c5f3=_0x24c5f3-0x0;var _0x371f9f=_0x955f[_0x24c5f3];return _0x371f9f;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require(_0xf955('0x5'));var db=require(_0xf955('0x6'))['db'];var utils=require(_0xf955('0x7'));var logger=require(_0xf955('0x8'))(_0xf955('0x9'));var config=require('../../config/environment');var jayson=require(_0xf955('0xa'));var client=jayson[_0xf955('0xb')][_0xf955('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1037b9,_0x30dbc6,_0x48ac34){return new BPromise(function(_0x257ef3,_0x409666){return client[_0xf955('0xd')](_0x1037b9,_0x48ac34)[_0xf955('0xe')](function(_0x4968c9){logger[_0xf955('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x30dbc6,_0xf955('0x10'));logger[_0xf955('0x11')](_0xf955('0x12'),_0x30dbc6,'request\x20sent',JSON['stringify'](_0x4968c9));if(_0x4968c9[_0xf955('0x13')]){if(_0x4968c9[_0xf955('0x13')][_0xf955('0x14')]===0x1f4){logger[_0xf955('0x13')](_0xf955('0x15'),_0x30dbc6,_0x4968c9[_0xf955('0x13')]['message']);return _0x409666(_0x4968c9[_0xf955('0x13')][_0xf955('0x16')]);}logger[_0xf955('0x13')](_0xf955('0x15'),_0x30dbc6,_0x4968c9[_0xf955('0x13')]['message']);return _0x257ef3(_0x4968c9[_0xf955('0x13')][_0xf955('0x16')]);}else{logger[_0xf955('0xf')](_0xf955('0x15'),_0x30dbc6,_0xf955('0x10'));_0x257ef3(_0x4968c9['result'][_0xf955('0x16')]);}})[_0xf955('0x17')](function(_0x24cb42){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x30dbc6,_0x24cb42);_0x409666(_0x24cb42);});});}exports[_0xf955('0x18')]=function(_0x29c381){var _0x824bf6=this;return new Promise(function(_0x5556a9,_0xc2e418){return db[_0xf955('0x19')][_0xf955('0x1a')]({'raw':_0x29c381['options']?_0x29c381[_0xf955('0x1b')][_0xf955('0x1c')]===undefined?!![]:![]:!![],'where':_0x29c381['options']?_0x29c381['options']['where']||null:null,'attributes':_0x29c381[_0xf955('0x1b')]?_0x29c381[_0xf955('0x1b')][_0xf955('0x1d')]||null:null,'limit':_0x29c381[_0xf955('0x1b')]?_0x29c381[_0xf955('0x1b')][_0xf955('0x1e')]||null:null,'include':_0x29c381['options']?_0x29c381[_0xf955('0x1b')][_0xf955('0x1f')]?_[_0xf955('0x20')](_0x29c381[_0xf955('0x1b')][_0xf955('0x1f')],function(_0x2e0c64){return{'model':db[_0x2e0c64[_0xf955('0x21')]],'as':_0x2e0c64['as'],'attributes':_0x2e0c64[_0xf955('0x1d')],'include':_0x2e0c64[_0xf955('0x1f')]?_[_0xf955('0x20')](_0x2e0c64[_0xf955('0x1f')],function(_0x24e24e){return{'model':db[_0x24e24e['model']],'as':_0x24e24e['as'],'attributes':_0x24e24e[_0xf955('0x1d')],'include':_0x24e24e[_0xf955('0x1f')]?_['map'](_0x24e24e[_0xf955('0x1f')],function(_0x520bc2){return{'model':db[_0x520bc2[_0xf955('0x21')]],'as':_0x520bc2['as'],'attributes':_0x520bc2[_0xf955('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf955('0xe')](function(_0x33ad6c){logger['info']('GetDynamics365Account',_0x29c381);logger[_0xf955('0x11')](_0xf955('0x18'),_0x29c381,JSON[_0xf955('0x22')](_0x33ad6c));_0x5556a9(_0x33ad6c);})[_0xf955('0x17')](function(_0x400e28){logger[_0xf955('0x13')](_0xf955('0x18'),_0x400e28[_0xf955('0x16')],_0x29c381);_0xc2e418(_0x824bf6[_0xf955('0x13')](0x1f4,_0x400e28[_0xf955('0x16')]));});});};exports['ShowDynamics365Account']=function(_0x3c24a1){var _0x3da70d=this;return new Promise(function(_0x7c77b3,_0x127857){return db['Dynamics365Account'][_0xf955('0x23')]({'raw':_0x3c24a1[_0xf955('0x1b')]?_0x3c24a1[_0xf955('0x1b')][_0xf955('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c24a1['options']?_0x3c24a1[_0xf955('0x1b')][_0xf955('0x24')]||null:null,'attributes':_0x3c24a1[_0xf955('0x1b')]?_0x3c24a1[_0xf955('0x1b')][_0xf955('0x1d')]||null:null,'include':_0x3c24a1[_0xf955('0x1b')]?_0x3c24a1[_0xf955('0x1b')][_0xf955('0x1f')]?_[_0xf955('0x20')](_0x3c24a1['options'][_0xf955('0x1f')],function(_0x588801){return{'model':db[_0x588801[_0xf955('0x21')]],'as':_0x588801['as'],'attributes':_0x588801[_0xf955('0x1d')],'include':_0x588801['include']?_[_0xf955('0x20')](_0x588801[_0xf955('0x1f')],function(_0x550cde){return{'model':db[_0x550cde[_0xf955('0x21')]],'as':_0x550cde['as'],'attributes':_0x550cde[_0xf955('0x1d')],'include':_0x550cde['include']?_['map'](_0x550cde[_0xf955('0x1f')],function(_0x337d36){return{'model':db[_0x337d36[_0xf955('0x21')]],'as':_0x337d36['as'],'attributes':_0x337d36[_0xf955('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf955('0xe')](function(_0x2fd7d6){logger[_0xf955('0xf')]('ShowDynamics365Account',_0x3c24a1);logger[_0xf955('0x11')](_0xf955('0x25'),_0x3c24a1,JSON[_0xf955('0x22')](_0x2fd7d6));_0x7c77b3(_0x2fd7d6);})[_0xf955('0x17')](function(_0x4a1671){logger[_0xf955('0x13')](_0xf955('0x25'),_0x4a1671[_0xf955('0x16')],_0x3c24a1);_0x127857(_0x3da70d[_0xf955('0x13')](0x1f4,_0x4a1671[_0xf955('0x16')]));});});}; \ No newline at end of file +var _0xa891=['stringify','error','code','message','info','result','GetDynamics365Account','Dynamics365Account','options','raw','attributes','include','map','model','debug','catch','find','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x5c3d51,_0xca4dc){var _0x50d63c=function(_0x525e84){while(--_0x525e84){_0x5c3d51['push'](_0x5c3d51['shift']());}};_0x50d63c(++_0xca4dc);}(_0xa891,0xe5));var _0x1a89=function(_0x5daf9c,_0x2017d7){_0x5daf9c=_0x5daf9c-0x0;var _0x1ed737=_0xa891[_0x5daf9c];return _0x1ed737;};'use strict';var _=require(_0x1a89('0x0'));var util=require(_0x1a89('0x1'));var moment=require(_0x1a89('0x2'));var BPromise=require(_0x1a89('0x3'));var rs=require(_0x1a89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a89('0x5'))['db'];var utils=require(_0x1a89('0x6'));var logger=require('../../config/logger')(_0x1a89('0x7'));var config=require(_0x1a89('0x8'));var jayson=require(_0x1a89('0x9'));var client=jayson[_0x1a89('0xa')][_0x1a89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dd9f0,_0x1f8960,_0x236377){return new BPromise(function(_0x4ee5a4,_0x432430){return client['request'](_0x3dd9f0,_0x236377)[_0x1a89('0xc')](function(_0x1df6e9){logger['info'](_0x1a89('0xd'),_0x1f8960,_0x1a89('0xe'));logger['debug'](_0x1a89('0xf'),_0x1f8960,_0x1a89('0xe'),JSON[_0x1a89('0x10')](_0x1df6e9));if(_0x1df6e9['error']){if(_0x1df6e9[_0x1a89('0x11')][_0x1a89('0x12')]===0x1f4){logger['error'](_0x1a89('0xd'),_0x1f8960,_0x1df6e9[_0x1a89('0x11')][_0x1a89('0x13')]);return _0x432430(_0x1df6e9[_0x1a89('0x11')][_0x1a89('0x13')]);}logger[_0x1a89('0x11')](_0x1a89('0xd'),_0x1f8960,_0x1df6e9['error'][_0x1a89('0x13')]);return _0x4ee5a4(_0x1df6e9[_0x1a89('0x11')]['message']);}else{logger[_0x1a89('0x14')](_0x1a89('0xd'),_0x1f8960,_0x1a89('0xe'));_0x4ee5a4(_0x1df6e9[_0x1a89('0x15')][_0x1a89('0x13')]);}})['catch'](function(_0x4ed215){logger[_0x1a89('0x11')](_0x1a89('0xd'),_0x1f8960,_0x4ed215);_0x432430(_0x4ed215);});});}exports[_0x1a89('0x16')]=function(_0xc9d93c){var _0x4f2e34=this;return new Promise(function(_0x66095f,_0x5556f1){return db[_0x1a89('0x17')]['findAll']({'raw':_0xc9d93c[_0x1a89('0x18')]?_0xc9d93c['options'][_0x1a89('0x19')]===undefined?!![]:![]:!![],'where':_0xc9d93c['options']?_0xc9d93c['options']['where']||null:null,'attributes':_0xc9d93c['options']?_0xc9d93c['options'][_0x1a89('0x1a')]||null:null,'limit':_0xc9d93c[_0x1a89('0x18')]?_0xc9d93c[_0x1a89('0x18')]['limit']||null:null,'include':_0xc9d93c[_0x1a89('0x18')]?_0xc9d93c[_0x1a89('0x18')][_0x1a89('0x1b')]?_[_0x1a89('0x1c')](_0xc9d93c[_0x1a89('0x18')]['include'],function(_0x415266){return{'model':db[_0x415266[_0x1a89('0x1d')]],'as':_0x415266['as'],'attributes':_0x415266[_0x1a89('0x1a')],'include':_0x415266['include']?_[_0x1a89('0x1c')](_0x415266['include'],function(_0x1ae652){return{'model':db[_0x1ae652[_0x1a89('0x1d')]],'as':_0x1ae652['as'],'attributes':_0x1ae652['attributes'],'include':_0x1ae652['include']?_[_0x1a89('0x1c')](_0x1ae652[_0x1a89('0x1b')],function(_0x29645b){return{'model':db[_0x29645b[_0x1a89('0x1d')]],'as':_0x29645b['as'],'attributes':_0x29645b[_0x1a89('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46e57a){logger[_0x1a89('0x14')](_0x1a89('0x16'),_0xc9d93c);logger[_0x1a89('0x1e')](_0x1a89('0x16'),_0xc9d93c,JSON[_0x1a89('0x10')](_0x46e57a));_0x66095f(_0x46e57a);})[_0x1a89('0x1f')](function(_0x2f33fe){logger[_0x1a89('0x11')]('GetDynamics365Account',_0x2f33fe[_0x1a89('0x13')],_0xc9d93c);_0x5556f1(_0x4f2e34[_0x1a89('0x11')](0x1f4,_0x2f33fe[_0x1a89('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x364408){var _0x34e6cd=this;return new Promise(function(_0x1fd2e4,_0x2bb794){return db[_0x1a89('0x17')][_0x1a89('0x20')]({'raw':_0x364408['options']?_0x364408[_0x1a89('0x18')][_0x1a89('0x19')]===undefined?!![]:![]:!![],'where':_0x364408['options']?_0x364408[_0x1a89('0x18')][_0x1a89('0x21')]||null:null,'attributes':_0x364408[_0x1a89('0x18')]?_0x364408[_0x1a89('0x18')][_0x1a89('0x1a')]||null:null,'include':_0x364408[_0x1a89('0x18')]?_0x364408[_0x1a89('0x18')][_0x1a89('0x1b')]?_['map'](_0x364408[_0x1a89('0x18')][_0x1a89('0x1b')],function(_0x1c8c84){return{'model':db[_0x1c8c84[_0x1a89('0x1d')]],'as':_0x1c8c84['as'],'attributes':_0x1c8c84['attributes'],'include':_0x1c8c84[_0x1a89('0x1b')]?_['map'](_0x1c8c84[_0x1a89('0x1b')],function(_0x25652d){return{'model':db[_0x25652d[_0x1a89('0x1d')]],'as':_0x25652d['as'],'attributes':_0x25652d['attributes'],'include':_0x25652d[_0x1a89('0x1b')]?_[_0x1a89('0x1c')](_0x25652d[_0x1a89('0x1b')],function(_0x1b7b91){return{'model':db[_0x1b7b91[_0x1a89('0x1d')]],'as':_0x1b7b91['as'],'attributes':_0x1b7b91['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a89('0xc')](function(_0x45d0f5){logger['info'](_0x1a89('0x22'),_0x364408);logger[_0x1a89('0x1e')](_0x1a89('0x22'),_0x364408,JSON[_0x1a89('0x10')](_0x45d0f5));_0x1fd2e4(_0x45d0f5);})['catch'](function(_0x549422){logger[_0x1a89('0x11')]('ShowDynamics365Account',_0x549422[_0x1a89('0x13')],_0x364408);_0x2bb794(_0x34e6cd[_0x1a89('0x11')](0x1f4,_0x549422[_0x1a89('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 730e57c..be0910b 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 _0xb6bd=['update','delete','destroy','multer','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id'];(function(_0xde7b14,_0x1741e4){var _0x58df0=function(_0x571af5){while(--_0x571af5){_0xde7b14['push'](_0xde7b14['shift']());}};_0x58df0(++_0x1741e4);}(_0xb6bd,0xd4));var _0xdb6b=function(_0xe0b6f1,_0xf337a5){_0xe0b6f1=_0xe0b6f1-0x0;var _0x1de78e=_0xb6bd[_0xe0b6f1];return _0x1de78e;};'use strict';var multer=require(_0xdb6b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdb6b('0x1'));var router=express[_0xdb6b('0x2')]();var fs_extra=require(_0xdb6b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdb6b('0x4'));var config=require('../../config/environment');var controller=require(_0xdb6b('0x5'));router[_0xdb6b('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdb6b('0x6')](_0xdb6b('0x7'),auth[_0xdb6b('0x8')](),controller['getFields']);router[_0xdb6b('0x6')](_0xdb6b('0x9'),auth[_0xdb6b('0x8')](),controller[_0xdb6b('0xa')]);router['get'](_0xdb6b('0xb'),auth[_0xdb6b('0x8')](),controller[_0xdb6b('0xc')]);router[_0xdb6b('0xd')]('/',auth[_0xdb6b('0x8')](),controller[_0xdb6b('0xe')]);router['put'](_0xdb6b('0xf'),auth[_0xdb6b('0x8')](),controller[_0xdb6b('0x10')]);router[_0xdb6b('0x11')](_0xdb6b('0xf'),auth[_0xdb6b('0x8')](),controller[_0xdb6b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8761=['getSubjects','getDescriptions','post','create','put','update','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x57a8f5,_0x288b50){var _0x586807=function(_0x207681){while(--_0x207681){_0x57a8f5['push'](_0x57a8f5['shift']());}};_0x586807(++_0x288b50);}(_0x8761,0x168));var _0x1876=function(_0x296122,_0x13c444){_0x296122=_0x296122-0x0;var _0x556346=_0x8761[_0x296122];return _0x556346;};'use strict';var multer=require('multer');var util=require(_0x1876('0x0'));var path=require('path');var timeout=require(_0x1876('0x1'));var express=require('express');var router=express[_0x1876('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1876('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1876('0x4'));var controller=require(_0x1876('0x5'));router[_0x1876('0x6')]('/',auth[_0x1876('0x7')](),controller[_0x1876('0x8')]);router[_0x1876('0x6')](_0x1876('0x9'),auth['isAuthenticated'](),controller[_0x1876('0xa')]);router[_0x1876('0x6')](_0x1876('0xb'),auth[_0x1876('0x7')](),controller[_0x1876('0xc')]);router[_0x1876('0x6')](_0x1876('0xd'),auth['isAuthenticated'](),controller[_0x1876('0xe')]);router[_0x1876('0x6')]('/:id/descriptions',auth[_0x1876('0x7')](),controller[_0x1876('0xf')]);router[_0x1876('0x10')]('/',auth[_0x1876('0x7')](),controller[_0x1876('0x11')]);router[_0x1876('0x12')]('/:id',auth[_0x1876('0x7')](),controller[_0x1876('0x13')]);router['delete'](_0x1876('0x9'),auth[_0x1876('0x7')](),controller[_0x1876('0x14')]);module[_0x1876('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 07767df..741e0d1 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 _0x54b0=['ENUM','phonecall','incident','sequelize','exports','STRING'];(function(_0x4160d2,_0x30cafa){var _0x5841fb=function(_0x1cc0f2){while(--_0x1cc0f2){_0x4160d2['push'](_0x4160d2['shift']());}};_0x5841fb(++_0x30cafa);}(_0x54b0,0x17d));var _0x054b=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x54b0[_0xfb0cfd];return _0x2fd8aa;};'use strict';var Sequelize=require(_0x054b('0x0'));module[_0x054b('0x1')]={'name':{'type':Sequelize[_0x054b('0x2')]},'description':{'type':Sequelize[_0x054b('0x2')]},'ticketType':{'type':Sequelize[_0x054b('0x3')]('incident',_0x054b('0x4')),'defaultValue':_0x054b('0x5')}}; \ No newline at end of file +var _0x14e2=['sequelize','exports','ENUM','incident','phonecall'];(function(_0x5a3b6f,_0xae57ea){var _0x219c8a=function(_0x28bca0){while(--_0x28bca0){_0x5a3b6f['push'](_0x5a3b6f['shift']());}};_0x219c8a(++_0xae57ea);}(_0x14e2,0x1b3));var _0x214e=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x14e2[_0x128450];return _0x4d80ed;};'use strict';var Sequelize=require(_0x214e('0x0'));module[_0x214e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x214e('0x2')](_0x214e('0x3'),_0x214e('0x4')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9fdd5a6..1d748e7 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 _0x3e18=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','findAll','rows','show','find','create','update','body','params','catch','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','then'];(function(_0x4c633f,_0x4068d1){var _0x9d98d3=function(_0x5b6908){while(--_0x5b6908){_0x4c633f['push'](_0x4c633f['shift']());}};_0x9d98d3(++_0x4068d1);}(_0x3e18,0x1cc));var _0x83e1=function(_0x42bd48,_0x1f657f){_0x42bd48=_0x42bd48-0x0;var _0x38bea9=_0x3e18[_0x42bd48];return _0x38bea9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83e1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83e1('0x1'));var rp=require(_0x83e1('0x2'));var moment=require(_0x83e1('0x3'));var BPromise=require(_0x83e1('0x4'));var Mustache=require(_0x83e1('0x5'));var util=require(_0x83e1('0x6'));var path=require(_0x83e1('0x7'));var sox=require(_0x83e1('0x8'));var csv=require(_0x83e1('0x9'));var ejs=require(_0x83e1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83e1('0xb'));var squel=require(_0x83e1('0xc'));var crypto=require(_0x83e1('0xd'));var jsforce=require(_0x83e1('0xe'));var deskjs=require(_0x83e1('0xf'));var toCsv=require(_0x83e1('0x9'));var querystring=require('querystring');var Papa=require(_0x83e1('0x10'));var Redis=require(_0x83e1('0x11'));var authService=require(_0x83e1('0x12'));var qs=require(_0x83e1('0x13'));var as=require(_0x83e1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x83e1('0x15'));var utils=require(_0x83e1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x83e1('0x17'));var db=require(_0x83e1('0x18'))['db'];function respondWithStatusCode(_0x1e2d68,_0x5e1c3e){_0x5e1c3e=_0x5e1c3e||0xcc;return function(_0x2bb108){if(_0x2bb108){return _0x1e2d68[_0x83e1('0x19')](_0x5e1c3e);}return _0x1e2d68[_0x83e1('0x1a')](_0x5e1c3e)[_0x83e1('0x1b')]();};}function respondWithResult(_0x59451e,_0x2ebf34){_0x2ebf34=_0x2ebf34||0xc8;return function(_0x22b57d){if(_0x22b57d){return _0x59451e[_0x83e1('0x1a')](_0x2ebf34)['json'](_0x22b57d);}};}function respondWithFilteredResult(_0x52fe83,_0x3e0964){return function(_0x246ab6){if(_0x246ab6){var _0x7e94fb=typeof _0x3e0964[_0x83e1('0x1c')]===_0x83e1('0x1d')&&typeof _0x3e0964['limit']===_0x83e1('0x1d');var _0x28099c=_0x246ab6[_0x83e1('0x1e')];var _0x2b0687=_0x7e94fb?0x0:_0x3e0964[_0x83e1('0x1c')];var _0xcf506f=_0x7e94fb?_0x246ab6['count']:_0x3e0964[_0x83e1('0x1c')]+_0x3e0964['limit'];var _0x12c664;if(_0xcf506f>=_0x28099c){_0xcf506f=_0x28099c;_0x12c664=0xc8;}else{_0x12c664=0xce;}_0x52fe83[_0x83e1('0x1a')](_0x12c664);return _0x52fe83[_0x83e1('0x1f')](_0x83e1('0x20'),_0x2b0687+'-'+_0xcf506f+'/'+_0x28099c)[_0x83e1('0x21')](_0x246ab6);}return null;};}function patchUpdates(_0x2ea4bb){return function(_0xc88e88){try{jsonpatch[_0x83e1('0x22')](_0xc88e88,_0x2ea4bb,!![]);}catch(_0x57f364){return BPromise[_0x83e1('0x23')](_0x57f364);}return _0xc88e88[_0x83e1('0x24')]();};}function saveUpdates(_0x5632b9,_0x417308){return function(_0x153935){if(_0x153935){return _0x153935['update'](_0x5632b9)[_0x83e1('0x25')](function(_0x7fcdfa){return _0x7fcdfa;});}return null;};}function removeEntity(_0x407af4,_0x2bea26){return function(_0x25a87d){if(_0x25a87d){return _0x25a87d[_0x83e1('0x26')]()[_0x83e1('0x25')](function(){_0x407af4[_0x83e1('0x1a')](0xcc)[_0x83e1('0x1b')]();});}};}function handleEntityNotFound(_0x5cc194,_0x859538){return function(_0x2e72c4){if(!_0x2e72c4){_0x5cc194['sendStatus'](0x194);}return _0x2e72c4;};}function handleError(_0x5bbbaf,_0x48ae6e){_0x48ae6e=_0x48ae6e||0x1f4;return function(_0x291f84){logger[_0x83e1('0x27')](_0x291f84[_0x83e1('0x28')]);if(_0x291f84[_0x83e1('0x29')]){delete _0x291f84[_0x83e1('0x29')];}_0x5bbbaf['status'](_0x48ae6e)[_0x83e1('0x2a')](_0x291f84);};}exports[_0x83e1('0x2b')]=function(_0x257ac8,_0x248a8c){var _0x2cf176={},_0x829d15={},_0x2a8c14={'count':0x0,'rows':[]};var _0x593aa4=_[_0x83e1('0x2c')](db['Dynamics365Configuration'][_0x83e1('0x2d')],function(_0x422193){return{'name':_0x422193[_0x83e1('0x2e')],'type':_0x422193[_0x83e1('0x2f')]['key']};});_0x829d15['model']=_[_0x83e1('0x2c')](_0x593aa4,_0x83e1('0x29'));_0x829d15[_0x83e1('0x30')]=_[_0x83e1('0x31')](_0x257ac8[_0x83e1('0x30')]);_0x829d15[_0x83e1('0x32')]=_['intersection'](_0x829d15[_0x83e1('0x33')],_0x829d15[_0x83e1('0x30')]);_0x2cf176[_0x83e1('0x34')]=_[_0x83e1('0x35')](_0x829d15[_0x83e1('0x33')],qs[_0x83e1('0x36')](_0x257ac8['query'][_0x83e1('0x36')]));_0x2cf176['attributes']=_0x2cf176['attributes'][_0x83e1('0x37')]?_0x2cf176[_0x83e1('0x34')]:_0x829d15['model'];if(!_0x257ac8[_0x83e1('0x30')][_0x83e1('0x38')](_0x83e1('0x39'))){_0x2cf176['limit']=qs['limit'](_0x257ac8[_0x83e1('0x30')][_0x83e1('0x3a')]);_0x2cf176['offset']=qs[_0x83e1('0x1c')](_0x257ac8[_0x83e1('0x30')][_0x83e1('0x1c')]);}_0x2cf176[_0x83e1('0x3b')]=qs[_0x83e1('0x3c')](_0x257ac8[_0x83e1('0x30')]['sort']);_0x2cf176[_0x83e1('0x3d')]=qs[_0x83e1('0x32')](_[_0x83e1('0x3e')](_0x257ac8[_0x83e1('0x30')],_0x829d15['filters']),_0x593aa4);if(_0x257ac8['query'][_0x83e1('0x3f')]){_0x2cf176['where']=_['merge'](_0x2cf176[_0x83e1('0x3d')],{'$or':_[_0x83e1('0x2c')](_0x593aa4,function(_0x505139){if(_0x505139[_0x83e1('0x2f')]!==_0x83e1('0x40')){var _0x11c796={};_0x11c796[_0x505139[_0x83e1('0x29')]]={'$like':'%'+_0x257ac8[_0x83e1('0x30')][_0x83e1('0x3f')]+'%'};return _0x11c796;}})});}_0x2cf176=_[_0x83e1('0x41')]({},_0x2cf176,_0x257ac8[_0x83e1('0x42')]);var _0x54f5e4={'where':_0x2cf176['where']};return db[_0x83e1('0x43')][_0x83e1('0x1e')](_0x54f5e4)['then'](function(_0x5ecbdb){_0x2a8c14['count']=_0x5ecbdb;if(_0x257ac8['query'][_0x83e1('0x44')]){_0x2cf176['include']=[{'all':!![]}];}return db[_0x83e1('0x43')][_0x83e1('0x45')](_0x2cf176);})['then'](function(_0x29b873){_0x2a8c14[_0x83e1('0x46')]=_0x29b873;return _0x2a8c14;})[_0x83e1('0x25')](respondWithFilteredResult(_0x248a8c,_0x2cf176))['catch'](handleError(_0x248a8c,null));};exports[_0x83e1('0x47')]=function(_0x16f521,_0x193081){var _0x4568d5={'raw':![],'where':{'id':_0x16f521['params']['id']}},_0x4d1598={};_0x4d1598[_0x83e1('0x33')]=_[_0x83e1('0x31')](db[_0x83e1('0x43')][_0x83e1('0x2d')]);_0x4d1598[_0x83e1('0x30')]=_[_0x83e1('0x31')](_0x16f521[_0x83e1('0x30')]);_0x4d1598[_0x83e1('0x32')]=_[_0x83e1('0x35')](_0x4d1598[_0x83e1('0x33')],_0x4d1598['query']);_0x4568d5['attributes']=_[_0x83e1('0x35')](_0x4d1598['model'],qs[_0x83e1('0x36')](_0x16f521[_0x83e1('0x30')]['fields']));_0x4568d5[_0x83e1('0x34')]=_0x4568d5[_0x83e1('0x34')]['length']?_0x4568d5[_0x83e1('0x34')]:_0x4d1598[_0x83e1('0x33')];if(_0x16f521[_0x83e1('0x30')][_0x83e1('0x44')]){_0x4568d5['include']=[{'all':!![]}];}_0x4568d5=_[_0x83e1('0x41')]({},_0x4568d5,_0x16f521[_0x83e1('0x42')]);return db[_0x83e1('0x43')][_0x83e1('0x48')](_0x4568d5)['then'](handleEntityNotFound(_0x193081,null))[_0x83e1('0x25')](respondWithResult(_0x193081,null))['catch'](handleError(_0x193081,null));};exports['create']=function(_0x21ae5e,_0x55ac41){return db[_0x83e1('0x43')][_0x83e1('0x49')](_0x21ae5e['body'],{})[_0x83e1('0x25')](respondWithResult(_0x55ac41,0xc9))['catch'](handleError(_0x55ac41,null));};exports[_0x83e1('0x4a')]=function(_0x44e0d5,_0x34cf49){if(_0x44e0d5[_0x83e1('0x4b')]['id']){delete _0x44e0d5[_0x83e1('0x4b')]['id'];}return db[_0x83e1('0x43')][_0x83e1('0x48')]({'where':{'id':_0x44e0d5[_0x83e1('0x4c')]['id']}})[_0x83e1('0x25')](handleEntityNotFound(_0x34cf49,null))[_0x83e1('0x25')](saveUpdates(_0x44e0d5[_0x83e1('0x4b')],null))[_0x83e1('0x25')](respondWithResult(_0x34cf49,null))['catch'](handleError(_0x34cf49,null));};exports['destroy']=function(_0x45da7a,_0x5068d1){return db[_0x83e1('0x43')][_0x83e1('0x48')]({'where':{'id':_0x45da7a[_0x83e1('0x4c')]['id']}})[_0x83e1('0x25')](handleEntityNotFound(_0x5068d1,null))[_0x83e1('0x25')](removeEntity(_0x5068d1,null))[_0x83e1('0x4d')](handleError(_0x5068d1,null));};exports[_0x83e1('0x4e')]=function(_0x2b9311,_0x19a931,_0x535a02){var _0x20462f={};var _0x4440f5={};var _0x3ba238;var _0xc5fc1e;return db[_0x83e1('0x43')][_0x83e1('0x4f')]({'where':{'id':_0x2b9311[_0x83e1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x19a931,null))[_0x83e1('0x25')](function(_0x196d3c){if(_0x196d3c){_0x3ba238=_0x196d3c;_0x4440f5[_0x83e1('0x33')]=_[_0x83e1('0x31')](db[_0x83e1('0x50')][_0x83e1('0x2d')]);_0x4440f5[_0x83e1('0x30')]=_[_0x83e1('0x31')](_0x2b9311[_0x83e1('0x30')]);_0x4440f5[_0x83e1('0x32')]=_[_0x83e1('0x35')](_0x4440f5['model'],_0x4440f5[_0x83e1('0x30')]);_0x20462f[_0x83e1('0x34')]=_[_0x83e1('0x35')](_0x4440f5[_0x83e1('0x33')],qs[_0x83e1('0x36')](_0x2b9311[_0x83e1('0x30')]['fields']));_0x20462f[_0x83e1('0x34')]=_0x20462f['attributes'][_0x83e1('0x37')]?_0x20462f[_0x83e1('0x34')]:_0x4440f5['model'];_0x20462f['order']=qs[_0x83e1('0x3c')](_0x2b9311[_0x83e1('0x30')]['sort']);_0x20462f[_0x83e1('0x3d')]=qs[_0x83e1('0x32')](_[_0x83e1('0x3e')](_0x2b9311['query'],_0x4440f5['filters']));if(_0x2b9311[_0x83e1('0x30')][_0x83e1('0x3f')]){_0x20462f[_0x83e1('0x3d')]=_['merge'](_0x20462f[_0x83e1('0x3d')],{'$or':_[_0x83e1('0x2c')](_0x20462f['attributes'],function(_0x3d9f34){var _0x337a0d={};_0x337a0d[_0x3d9f34]={'$like':'%'+_0x2b9311[_0x83e1('0x30')][_0x83e1('0x3f')]+'%'};return _0x337a0d;})});}_0x20462f=_['merge']({},_0x20462f,_0x2b9311['options']);return _0x3ba238[_0x83e1('0x4e')](_0x20462f);}})[_0x83e1('0x25')](function(_0xd19472){if(_0xd19472){_0xc5fc1e=_0xd19472[_0x83e1('0x37')];if(!_0x2b9311[_0x83e1('0x30')][_0x83e1('0x38')](_0x83e1('0x39'))){_0x20462f[_0x83e1('0x3a')]=qs[_0x83e1('0x3a')](_0x2b9311[_0x83e1('0x30')]['limit']);_0x20462f[_0x83e1('0x1c')]=qs[_0x83e1('0x1c')](_0x2b9311[_0x83e1('0x30')][_0x83e1('0x1c')]);}return _0x3ba238[_0x83e1('0x4e')](_0x20462f);}})[_0x83e1('0x25')](function(_0x59adb1){if(_0x59adb1){return _0x59adb1?{'count':_0xc5fc1e,'rows':_0x59adb1}:null;}})[_0x83e1('0x25')](respondWithResult(_0x19a931,null))['catch'](handleError(_0x19a931,null));};exports['getSubjects']=function(_0x1564d5,_0x4e5299,_0x461375){var _0x57fc12={};var _0x3e3876={};var _0x43d78a;var _0x5d1d8f;return db[_0x83e1('0x43')][_0x83e1('0x4f')]({'where':{'id':_0x1564d5[_0x83e1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e5299,null))['then'](function(_0x926295){if(_0x926295){_0x43d78a=_0x926295;_0x3e3876[_0x83e1('0x33')]=_['keys'](db[_0x83e1('0x50')][_0x83e1('0x2d')]);_0x3e3876[_0x83e1('0x30')]=_['keys'](_0x1564d5['query']);_0x3e3876['filters']=_[_0x83e1('0x35')](_0x3e3876[_0x83e1('0x33')],_0x3e3876['query']);_0x57fc12['attributes']=_['intersection'](_0x3e3876['model'],qs[_0x83e1('0x36')](_0x1564d5[_0x83e1('0x30')][_0x83e1('0x36')]));_0x57fc12[_0x83e1('0x34')]=_0x57fc12[_0x83e1('0x34')]['length']?_0x57fc12[_0x83e1('0x34')]:_0x3e3876[_0x83e1('0x33')];_0x57fc12[_0x83e1('0x3b')]=qs[_0x83e1('0x3c')](_0x1564d5[_0x83e1('0x30')]['sort']);_0x57fc12[_0x83e1('0x3d')]=qs[_0x83e1('0x32')](_[_0x83e1('0x3e')](_0x1564d5[_0x83e1('0x30')],_0x3e3876[_0x83e1('0x32')]));if(_0x1564d5[_0x83e1('0x30')][_0x83e1('0x3f')]){_0x57fc12['where']=_[_0x83e1('0x41')](_0x57fc12[_0x83e1('0x3d')],{'$or':_[_0x83e1('0x2c')](_0x57fc12['attributes'],function(_0x24bb33){var _0xa116f1={};_0xa116f1[_0x24bb33]={'$like':'%'+_0x1564d5[_0x83e1('0x30')][_0x83e1('0x3f')]+'%'};return _0xa116f1;})});}_0x57fc12=_['merge']({},_0x57fc12,_0x1564d5['options']);return _0x43d78a[_0x83e1('0x51')](_0x57fc12);}})[_0x83e1('0x25')](function(_0x4b05dc){if(_0x4b05dc){_0x5d1d8f=_0x4b05dc[_0x83e1('0x37')];if(!_0x1564d5[_0x83e1('0x30')][_0x83e1('0x38')](_0x83e1('0x39'))){_0x57fc12[_0x83e1('0x3a')]=qs[_0x83e1('0x3a')](_0x1564d5['query'][_0x83e1('0x3a')]);_0x57fc12[_0x83e1('0x1c')]=qs[_0x83e1('0x1c')](_0x1564d5['query'][_0x83e1('0x1c')]);}return _0x43d78a[_0x83e1('0x51')](_0x57fc12);}})[_0x83e1('0x25')](function(_0x2bf9d0){if(_0x2bf9d0){return _0x2bf9d0?{'count':_0x5d1d8f,'rows':_0x2bf9d0}:null;}})[_0x83e1('0x25')](respondWithResult(_0x4e5299,null))[_0x83e1('0x4d')](handleError(_0x4e5299,null));};exports[_0x83e1('0x52')]=function(_0x5762c4,_0x49eff4,_0x249a89){var _0x58f0ef={};var _0x4e92e5={};var _0xe8a626;var _0x44c888;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5762c4[_0x83e1('0x4c')]['id']}})[_0x83e1('0x25')](handleEntityNotFound(_0x49eff4,null))['then'](function(_0xaa4c12){if(_0xaa4c12){_0xe8a626=_0xaa4c12;_0x4e92e5[_0x83e1('0x33')]=_['keys'](db[_0x83e1('0x50')][_0x83e1('0x2d')]);_0x4e92e5['query']=_['keys'](_0x5762c4['query']);_0x4e92e5[_0x83e1('0x32')]=_[_0x83e1('0x35')](_0x4e92e5['model'],_0x4e92e5[_0x83e1('0x30')]);_0x58f0ef[_0x83e1('0x34')]=_[_0x83e1('0x35')](_0x4e92e5[_0x83e1('0x33')],qs[_0x83e1('0x36')](_0x5762c4['query']['fields']));_0x58f0ef[_0x83e1('0x34')]=_0x58f0ef[_0x83e1('0x34')][_0x83e1('0x37')]?_0x58f0ef[_0x83e1('0x34')]:_0x4e92e5[_0x83e1('0x33')];_0x58f0ef[_0x83e1('0x3b')]=qs[_0x83e1('0x3c')](_0x5762c4['query'][_0x83e1('0x3c')]);_0x58f0ef[_0x83e1('0x3d')]=qs[_0x83e1('0x32')](_['pick'](_0x5762c4[_0x83e1('0x30')],_0x4e92e5[_0x83e1('0x32')]));if(_0x5762c4[_0x83e1('0x30')][_0x83e1('0x3f')]){_0x58f0ef['where']=_[_0x83e1('0x41')](_0x58f0ef[_0x83e1('0x3d')],{'$or':_[_0x83e1('0x2c')](_0x58f0ef[_0x83e1('0x34')],function(_0x5de47b){var _0x430f13={};_0x430f13[_0x5de47b]={'$like':'%'+_0x5762c4['query'][_0x83e1('0x3f')]+'%'};return _0x430f13;})});}_0x58f0ef=_[_0x83e1('0x41')]({},_0x58f0ef,_0x5762c4[_0x83e1('0x42')]);return _0xe8a626['getDescriptions'](_0x58f0ef);}})[_0x83e1('0x25')](function(_0x32e6ac){if(_0x32e6ac){_0x44c888=_0x32e6ac['length'];if(!_0x5762c4[_0x83e1('0x30')][_0x83e1('0x38')](_0x83e1('0x39'))){_0x58f0ef[_0x83e1('0x3a')]=qs[_0x83e1('0x3a')](_0x5762c4['query'][_0x83e1('0x3a')]);_0x58f0ef[_0x83e1('0x1c')]=qs[_0x83e1('0x1c')](_0x5762c4[_0x83e1('0x30')][_0x83e1('0x1c')]);}return _0xe8a626[_0x83e1('0x52')](_0x58f0ef);}})[_0x83e1('0x25')](function(_0x42c95f){if(_0x42c95f){return _0x42c95f?{'count':_0x44c888,'rows':_0x42c95f}:null;}})[_0x83e1('0x25')](respondWithResult(_0x49eff4,null))[_0x83e1('0x4d')](handleError(_0x49eff4,null));}; \ No newline at end of file +var _0xcbb6=['nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','getFields','Dynamics365Field','pick','getSubjects','findOne','getDescriptions','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2f5235,_0x5ba3b8){var _0x34d3bc=function(_0x142ec2){while(--_0x142ec2){_0x2f5235['push'](_0x2f5235['shift']());}};_0x34d3bc(++_0x5ba3b8);}(_0xcbb6,0x69));var _0x6cbb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcbb6[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x6cbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6cbb('0x1'));var BPromise=require(_0x6cbb('0x2'));var Mustache=require(_0x6cbb('0x3'));var util=require(_0x6cbb('0x4'));var path=require(_0x6cbb('0x5'));var sox=require(_0x6cbb('0x6'));var csv=require(_0x6cbb('0x7'));var ejs=require(_0x6cbb('0x8'));var fs=require('fs');var fs_extra=require(_0x6cbb('0x9'));var _=require('lodash');var squel=require(_0x6cbb('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6cbb('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6cbb('0xc'));var Papa=require(_0x6cbb('0xd'));var Redis=require(_0x6cbb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6cbb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cbb('0x10'));var logger=require(_0x6cbb('0x11'))(_0x6cbb('0x12'));var utils=require(_0x6cbb('0x13'));var config=require(_0x6cbb('0x14'));var licenseUtil=require(_0x6cbb('0x15'));var db=require(_0x6cbb('0x16'))['db'];function respondWithStatusCode(_0x12dd34,_0x2576ef){_0x2576ef=_0x2576ef||0xcc;return function(_0x384bf1){if(_0x384bf1){return _0x12dd34[_0x6cbb('0x17')](_0x2576ef);}return _0x12dd34[_0x6cbb('0x18')](_0x2576ef)[_0x6cbb('0x19')]();};}function respondWithResult(_0x1bfe78,_0x1a3fdd){_0x1a3fdd=_0x1a3fdd||0xc8;return function(_0x1a9a1a){if(_0x1a9a1a){return _0x1bfe78[_0x6cbb('0x18')](_0x1a3fdd)[_0x6cbb('0x1a')](_0x1a9a1a);}};}function respondWithFilteredResult(_0x4b80d2,_0x551f62){return function(_0x2b8d0b){if(_0x2b8d0b){var _0x4f81f1=typeof _0x551f62['offset']===_0x6cbb('0x1b')&&typeof _0x551f62[_0x6cbb('0x1c')]===_0x6cbb('0x1b');var _0x33fe3e=_0x2b8d0b[_0x6cbb('0x1d')];var _0x5e063a=_0x4f81f1?0x0:_0x551f62[_0x6cbb('0x1e')];var _0x5ce736=_0x4f81f1?_0x2b8d0b[_0x6cbb('0x1d')]:_0x551f62[_0x6cbb('0x1e')]+_0x551f62[_0x6cbb('0x1c')];var _0x965928;if(_0x5ce736>=_0x33fe3e){_0x5ce736=_0x33fe3e;_0x965928=0xc8;}else{_0x965928=0xce;}_0x4b80d2['status'](_0x965928);return _0x4b80d2[_0x6cbb('0x1f')](_0x6cbb('0x20'),_0x5e063a+'-'+_0x5ce736+'/'+_0x33fe3e)[_0x6cbb('0x1a')](_0x2b8d0b);}return null;};}function patchUpdates(_0x4b57c4){return function(_0x5d3158){try{jsonpatch[_0x6cbb('0x21')](_0x5d3158,_0x4b57c4,!![]);}catch(_0xcb0012){return BPromise[_0x6cbb('0x22')](_0xcb0012);}return _0x5d3158[_0x6cbb('0x23')]();};}function saveUpdates(_0x528c5b,_0x477217){return function(_0x2d376a){if(_0x2d376a){return _0x2d376a[_0x6cbb('0x24')](_0x528c5b)[_0x6cbb('0x25')](function(_0x15dbae){return _0x15dbae;});}return null;};}function removeEntity(_0x4e0311,_0x3effcc){return function(_0x247dc4){if(_0x247dc4){return _0x247dc4['destroy']()['then'](function(){_0x4e0311[_0x6cbb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19346a,_0x13af12){return function(_0x2cf484){if(!_0x2cf484){_0x19346a['sendStatus'](0x194);}return _0x2cf484;};}function handleError(_0xf5e52d,_0x754e26){_0x754e26=_0x754e26||0x1f4;return function(_0x7a77c9){logger['error'](_0x7a77c9[_0x6cbb('0x26')]);if(_0x7a77c9[_0x6cbb('0x27')]){delete _0x7a77c9[_0x6cbb('0x27')];}_0xf5e52d['status'](_0x754e26)[_0x6cbb('0x28')](_0x7a77c9);};}exports[_0x6cbb('0x29')]=function(_0x4eabcf,_0x34d4f4){var _0xdcfc94={},_0x3d4592={},_0xdfc2b5={'count':0x0,'rows':[]};var _0x1fe146=_[_0x6cbb('0x2a')](db[_0x6cbb('0x2b')][_0x6cbb('0x2c')],function(_0x24550a){return{'name':_0x24550a[_0x6cbb('0x2d')],'type':_0x24550a[_0x6cbb('0x2e')][_0x6cbb('0x2f')]};});_0x3d4592[_0x6cbb('0x30')]=_[_0x6cbb('0x2a')](_0x1fe146,_0x6cbb('0x27'));_0x3d4592['query']=_[_0x6cbb('0x31')](_0x4eabcf[_0x6cbb('0x32')]);_0x3d4592[_0x6cbb('0x33')]=_[_0x6cbb('0x34')](_0x3d4592['model'],_0x3d4592[_0x6cbb('0x32')]);_0xdcfc94[_0x6cbb('0x35')]=_[_0x6cbb('0x34')](_0x3d4592['model'],qs[_0x6cbb('0x36')](_0x4eabcf[_0x6cbb('0x32')][_0x6cbb('0x36')]));_0xdcfc94['attributes']=_0xdcfc94[_0x6cbb('0x35')][_0x6cbb('0x37')]?_0xdcfc94[_0x6cbb('0x35')]:_0x3d4592[_0x6cbb('0x30')];if(!_0x4eabcf[_0x6cbb('0x32')][_0x6cbb('0x38')](_0x6cbb('0x39'))){_0xdcfc94[_0x6cbb('0x1c')]=qs['limit'](_0x4eabcf[_0x6cbb('0x32')]['limit']);_0xdcfc94[_0x6cbb('0x1e')]=qs['offset'](_0x4eabcf[_0x6cbb('0x32')][_0x6cbb('0x1e')]);}_0xdcfc94[_0x6cbb('0x3a')]=qs[_0x6cbb('0x3b')](_0x4eabcf[_0x6cbb('0x32')][_0x6cbb('0x3b')]);_0xdcfc94[_0x6cbb('0x3c')]=qs[_0x6cbb('0x33')](_['pick'](_0x4eabcf['query'],_0x3d4592[_0x6cbb('0x33')]),_0x1fe146);if(_0x4eabcf['query'][_0x6cbb('0x3d')]){_0xdcfc94[_0x6cbb('0x3c')]=_[_0x6cbb('0x3e')](_0xdcfc94[_0x6cbb('0x3c')],{'$or':_[_0x6cbb('0x2a')](_0x1fe146,function(_0x6aa10d){if(_0x6aa10d[_0x6cbb('0x2e')]!=='VIRTUAL'){var _0x26c13e={};_0x26c13e[_0x6aa10d[_0x6cbb('0x27')]]={'$like':'%'+_0x4eabcf['query']['filter']+'%'};return _0x26c13e;}})});}_0xdcfc94=_[_0x6cbb('0x3e')]({},_0xdcfc94,_0x4eabcf[_0x6cbb('0x3f')]);var _0x3ef2e6={'where':_0xdcfc94['where']};return db[_0x6cbb('0x2b')][_0x6cbb('0x1d')](_0x3ef2e6)[_0x6cbb('0x25')](function(_0x333823){_0xdfc2b5[_0x6cbb('0x1d')]=_0x333823;if(_0x4eabcf[_0x6cbb('0x32')][_0x6cbb('0x40')]){_0xdcfc94[_0x6cbb('0x41')]=[{'all':!![]}];}return db[_0x6cbb('0x2b')][_0x6cbb('0x42')](_0xdcfc94);})[_0x6cbb('0x25')](function(_0x705f23){_0xdfc2b5[_0x6cbb('0x43')]=_0x705f23;return _0xdfc2b5;})['then'](respondWithFilteredResult(_0x34d4f4,_0xdcfc94))['catch'](handleError(_0x34d4f4,null));};exports[_0x6cbb('0x44')]=function(_0x24e1d7,_0x3f2b77){var _0x362e9c={'raw':![],'where':{'id':_0x24e1d7[_0x6cbb('0x45')]['id']}},_0x4d1323={};_0x4d1323[_0x6cbb('0x30')]=_['keys'](db[_0x6cbb('0x2b')][_0x6cbb('0x2c')]);_0x4d1323[_0x6cbb('0x32')]=_[_0x6cbb('0x31')](_0x24e1d7[_0x6cbb('0x32')]);_0x4d1323['filters']=_[_0x6cbb('0x34')](_0x4d1323['model'],_0x4d1323['query']);_0x362e9c[_0x6cbb('0x35')]=_['intersection'](_0x4d1323[_0x6cbb('0x30')],qs[_0x6cbb('0x36')](_0x24e1d7[_0x6cbb('0x32')][_0x6cbb('0x36')]));_0x362e9c[_0x6cbb('0x35')]=_0x362e9c['attributes'][_0x6cbb('0x37')]?_0x362e9c['attributes']:_0x4d1323[_0x6cbb('0x30')];if(_0x24e1d7['query']['includeAll']){_0x362e9c[_0x6cbb('0x41')]=[{'all':!![]}];}_0x362e9c=_[_0x6cbb('0x3e')]({},_0x362e9c,_0x24e1d7[_0x6cbb('0x3f')]);return db[_0x6cbb('0x2b')][_0x6cbb('0x46')](_0x362e9c)[_0x6cbb('0x25')](handleEntityNotFound(_0x3f2b77,null))[_0x6cbb('0x25')](respondWithResult(_0x3f2b77,null))['catch'](handleError(_0x3f2b77,null));};exports[_0x6cbb('0x47')]=function(_0x3dc80d,_0x20bf9f){return db[_0x6cbb('0x2b')][_0x6cbb('0x47')](_0x3dc80d[_0x6cbb('0x48')],{})[_0x6cbb('0x25')](respondWithResult(_0x20bf9f,0xc9))[_0x6cbb('0x49')](handleError(_0x20bf9f,null));};exports[_0x6cbb('0x24')]=function(_0x30410e,_0x478799){if(_0x30410e[_0x6cbb('0x48')]['id']){delete _0x30410e[_0x6cbb('0x48')]['id'];}return db[_0x6cbb('0x2b')]['find']({'where':{'id':_0x30410e[_0x6cbb('0x45')]['id']}})[_0x6cbb('0x25')](handleEntityNotFound(_0x478799,null))[_0x6cbb('0x25')](saveUpdates(_0x30410e['body'],null))[_0x6cbb('0x25')](respondWithResult(_0x478799,null))[_0x6cbb('0x49')](handleError(_0x478799,null));};exports[_0x6cbb('0x4a')]=function(_0x4155dc,_0x1b0f84){return db[_0x6cbb('0x2b')][_0x6cbb('0x46')]({'where':{'id':_0x4155dc[_0x6cbb('0x45')]['id']}})[_0x6cbb('0x25')](handleEntityNotFound(_0x1b0f84,null))[_0x6cbb('0x25')](removeEntity(_0x1b0f84,null))['catch'](handleError(_0x1b0f84,null));};exports[_0x6cbb('0x4b')]=function(_0x11b72d,_0x1d3c88,_0x4a1da9){var _0x3c3ecc={};var _0x550fc3={};var _0x4d8188;var _0x2aedac;return db[_0x6cbb('0x2b')]['findOne']({'where':{'id':_0x11b72d[_0x6cbb('0x45')]['id']}})[_0x6cbb('0x25')](handleEntityNotFound(_0x1d3c88,null))[_0x6cbb('0x25')](function(_0x2e711e){if(_0x2e711e){_0x4d8188=_0x2e711e;_0x550fc3[_0x6cbb('0x30')]=_[_0x6cbb('0x31')](db[_0x6cbb('0x4c')][_0x6cbb('0x2c')]);_0x550fc3[_0x6cbb('0x32')]=_[_0x6cbb('0x31')](_0x11b72d[_0x6cbb('0x32')]);_0x550fc3[_0x6cbb('0x33')]=_['intersection'](_0x550fc3[_0x6cbb('0x30')],_0x550fc3['query']);_0x3c3ecc[_0x6cbb('0x35')]=_[_0x6cbb('0x34')](_0x550fc3[_0x6cbb('0x30')],qs[_0x6cbb('0x36')](_0x11b72d['query'][_0x6cbb('0x36')]));_0x3c3ecc['attributes']=_0x3c3ecc['attributes'][_0x6cbb('0x37')]?_0x3c3ecc[_0x6cbb('0x35')]:_0x550fc3[_0x6cbb('0x30')];_0x3c3ecc[_0x6cbb('0x3a')]=qs[_0x6cbb('0x3b')](_0x11b72d[_0x6cbb('0x32')][_0x6cbb('0x3b')]);_0x3c3ecc['where']=qs[_0x6cbb('0x33')](_[_0x6cbb('0x4d')](_0x11b72d[_0x6cbb('0x32')],_0x550fc3[_0x6cbb('0x33')]));if(_0x11b72d[_0x6cbb('0x32')][_0x6cbb('0x3d')]){_0x3c3ecc[_0x6cbb('0x3c')]=_[_0x6cbb('0x3e')](_0x3c3ecc[_0x6cbb('0x3c')],{'$or':_[_0x6cbb('0x2a')](_0x3c3ecc[_0x6cbb('0x35')],function(_0x2085c8){var _0x38d1e8={};_0x38d1e8[_0x2085c8]={'$like':'%'+_0x11b72d[_0x6cbb('0x32')]['filter']+'%'};return _0x38d1e8;})});}_0x3c3ecc=_[_0x6cbb('0x3e')]({},_0x3c3ecc,_0x11b72d['options']);return _0x4d8188[_0x6cbb('0x4b')](_0x3c3ecc);}})[_0x6cbb('0x25')](function(_0x3af1b0){if(_0x3af1b0){_0x2aedac=_0x3af1b0[_0x6cbb('0x37')];if(!_0x11b72d['query'][_0x6cbb('0x38')](_0x6cbb('0x39'))){_0x3c3ecc[_0x6cbb('0x1c')]=qs[_0x6cbb('0x1c')](_0x11b72d[_0x6cbb('0x32')]['limit']);_0x3c3ecc[_0x6cbb('0x1e')]=qs[_0x6cbb('0x1e')](_0x11b72d['query'][_0x6cbb('0x1e')]);}return _0x4d8188[_0x6cbb('0x4b')](_0x3c3ecc);}})['then'](function(_0x360a3e){if(_0x360a3e){return _0x360a3e?{'count':_0x2aedac,'rows':_0x360a3e}:null;}})[_0x6cbb('0x25')](respondWithResult(_0x1d3c88,null))['catch'](handleError(_0x1d3c88,null));};exports['getSubjects']=function(_0x5dad60,_0x54bc6a,_0x3e3e70){var _0x4b8716={};var _0x655716={};var _0x2ee41c;var _0x47f848;return db[_0x6cbb('0x2b')]['findOne']({'where':{'id':_0x5dad60[_0x6cbb('0x45')]['id']}})[_0x6cbb('0x25')](handleEntityNotFound(_0x54bc6a,null))[_0x6cbb('0x25')](function(_0x9c8328){if(_0x9c8328){_0x2ee41c=_0x9c8328;_0x655716[_0x6cbb('0x30')]=_[_0x6cbb('0x31')](db[_0x6cbb('0x4c')][_0x6cbb('0x2c')]);_0x655716[_0x6cbb('0x32')]=_[_0x6cbb('0x31')](_0x5dad60[_0x6cbb('0x32')]);_0x655716[_0x6cbb('0x33')]=_[_0x6cbb('0x34')](_0x655716[_0x6cbb('0x30')],_0x655716[_0x6cbb('0x32')]);_0x4b8716[_0x6cbb('0x35')]=_[_0x6cbb('0x34')](_0x655716[_0x6cbb('0x30')],qs[_0x6cbb('0x36')](_0x5dad60[_0x6cbb('0x32')][_0x6cbb('0x36')]));_0x4b8716[_0x6cbb('0x35')]=_0x4b8716[_0x6cbb('0x35')][_0x6cbb('0x37')]?_0x4b8716[_0x6cbb('0x35')]:_0x655716[_0x6cbb('0x30')];_0x4b8716['order']=qs['sort'](_0x5dad60[_0x6cbb('0x32')][_0x6cbb('0x3b')]);_0x4b8716[_0x6cbb('0x3c')]=qs[_0x6cbb('0x33')](_[_0x6cbb('0x4d')](_0x5dad60[_0x6cbb('0x32')],_0x655716[_0x6cbb('0x33')]));if(_0x5dad60[_0x6cbb('0x32')][_0x6cbb('0x3d')]){_0x4b8716[_0x6cbb('0x3c')]=_[_0x6cbb('0x3e')](_0x4b8716['where'],{'$or':_[_0x6cbb('0x2a')](_0x4b8716[_0x6cbb('0x35')],function(_0x256284){var _0x1c2ea0={};_0x1c2ea0[_0x256284]={'$like':'%'+_0x5dad60[_0x6cbb('0x32')]['filter']+'%'};return _0x1c2ea0;})});}_0x4b8716=_['merge']({},_0x4b8716,_0x5dad60['options']);return _0x2ee41c[_0x6cbb('0x4e')](_0x4b8716);}})['then'](function(_0x3df972){if(_0x3df972){_0x47f848=_0x3df972[_0x6cbb('0x37')];if(!_0x5dad60['query']['hasOwnProperty'](_0x6cbb('0x39'))){_0x4b8716[_0x6cbb('0x1c')]=qs[_0x6cbb('0x1c')](_0x5dad60['query'][_0x6cbb('0x1c')]);_0x4b8716[_0x6cbb('0x1e')]=qs['offset'](_0x5dad60[_0x6cbb('0x32')][_0x6cbb('0x1e')]);}return _0x2ee41c[_0x6cbb('0x4e')](_0x4b8716);}})[_0x6cbb('0x25')](function(_0xe65315){if(_0xe65315){return _0xe65315?{'count':_0x47f848,'rows':_0xe65315}:null;}})[_0x6cbb('0x25')](respondWithResult(_0x54bc6a,null))[_0x6cbb('0x49')](handleError(_0x54bc6a,null));};exports['getDescriptions']=function(_0x404ced,_0x26cacc,_0x23ad19){var _0x2edeee={};var _0x400b10={};var _0xb670e6;var _0x298bac;return db['Dynamics365Configuration'][_0x6cbb('0x4f')]({'where':{'id':_0x404ced[_0x6cbb('0x45')]['id']}})['then'](handleEntityNotFound(_0x26cacc,null))['then'](function(_0xf78885){if(_0xf78885){_0xb670e6=_0xf78885;_0x400b10[_0x6cbb('0x30')]=_[_0x6cbb('0x31')](db[_0x6cbb('0x4c')][_0x6cbb('0x2c')]);_0x400b10[_0x6cbb('0x32')]=_[_0x6cbb('0x31')](_0x404ced[_0x6cbb('0x32')]);_0x400b10[_0x6cbb('0x33')]=_['intersection'](_0x400b10[_0x6cbb('0x30')],_0x400b10['query']);_0x2edeee[_0x6cbb('0x35')]=_[_0x6cbb('0x34')](_0x400b10[_0x6cbb('0x30')],qs['fields'](_0x404ced[_0x6cbb('0x32')][_0x6cbb('0x36')]));_0x2edeee['attributes']=_0x2edeee['attributes'][_0x6cbb('0x37')]?_0x2edeee[_0x6cbb('0x35')]:_0x400b10[_0x6cbb('0x30')];_0x2edeee[_0x6cbb('0x3a')]=qs[_0x6cbb('0x3b')](_0x404ced[_0x6cbb('0x32')][_0x6cbb('0x3b')]);_0x2edeee['where']=qs[_0x6cbb('0x33')](_[_0x6cbb('0x4d')](_0x404ced[_0x6cbb('0x32')],_0x400b10[_0x6cbb('0x33')]));if(_0x404ced[_0x6cbb('0x32')][_0x6cbb('0x3d')]){_0x2edeee['where']=_[_0x6cbb('0x3e')](_0x2edeee[_0x6cbb('0x3c')],{'$or':_['map'](_0x2edeee[_0x6cbb('0x35')],function(_0x398aa3){var _0x3a51f8={};_0x3a51f8[_0x398aa3]={'$like':'%'+_0x404ced['query']['filter']+'%'};return _0x3a51f8;})});}_0x2edeee=_['merge']({},_0x2edeee,_0x404ced[_0x6cbb('0x3f')]);return _0xb670e6[_0x6cbb('0x50')](_0x2edeee);}})['then'](function(_0x4ea57d){if(_0x4ea57d){_0x298bac=_0x4ea57d[_0x6cbb('0x37')];if(!_0x404ced[_0x6cbb('0x32')][_0x6cbb('0x38')](_0x6cbb('0x39'))){_0x2edeee['limit']=qs[_0x6cbb('0x1c')](_0x404ced[_0x6cbb('0x32')][_0x6cbb('0x1c')]);_0x2edeee[_0x6cbb('0x1e')]=qs['offset'](_0x404ced[_0x6cbb('0x32')]['offset']);}return _0xb670e6['getDescriptions'](_0x2edeee);}})[_0x6cbb('0x25')](function(_0x2e9210){if(_0x2e9210){return _0x2e9210?{'count':_0x298bac,'rows':_0x2e9210}:null;}})['then'](respondWithResult(_0x26cacc,null))['catch'](handleError(_0x26cacc,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a22b229..08057f7 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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4d86f8,_0x451855){var _0x35cac3=function(_0x2f3611){while(--_0x2f3611){_0x4d86f8['push'](_0x4d86f8['shift']());}};_0x35cac3(++_0x451855);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4d9aa4,_0x1c5048){_0x4d9aa4=_0x4d9aa4-0x0;var _0x171014=_0xd6d6[_0x4d9aa4];return _0x171014;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x4b84[_0x4bfade];return _0x272465;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 709a154..d1d96f9 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 _0xf612=['rpc','../../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','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xf612,0x1f3));var _0x2f61=function(_0x3e45fd,_0x183448){_0x3e45fd=_0x3e45fd-0x0;var _0x2eb0e7=_0xf612[_0x3e45fd];return _0x2eb0e7;};'use strict';var _=require('lodash');var util=require(_0x2f61('0x0'));var moment=require(_0x2f61('0x1'));var BPromise=require(_0x2f61('0x2'));var rs=require(_0x2f61('0x3'));var fs=require('fs');var Redis=require(_0x2f61('0x4'));var db=require(_0x2f61('0x5'))['db'];var utils=require(_0x2f61('0x6'));var logger=require('../../config/logger')(_0x2f61('0x7'));var config=require(_0x2f61('0x8'));var jayson=require(_0x2f61('0x9'));var client=jayson[_0x2f61('0xa')][_0x2f61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x142a4d,_0x1ecaf3,_0xdf9485){return new BPromise(function(_0x383d33,_0x2ec0c9){return client[_0x2f61('0xc')](_0x142a4d,_0xdf9485)[_0x2f61('0xd')](function(_0x586048){logger[_0x2f61('0xe')](_0x2f61('0xf'),_0x1ecaf3,_0x2f61('0x10'));logger[_0x2f61('0x11')](_0x2f61('0x12'),_0x1ecaf3,_0x2f61('0x10'),JSON[_0x2f61('0x13')](_0x586048));if(_0x586048['error']){if(_0x586048[_0x2f61('0x14')][_0x2f61('0x15')]===0x1f4){logger[_0x2f61('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1ecaf3,_0x586048[_0x2f61('0x14')][_0x2f61('0x16')]);return _0x2ec0c9(_0x586048[_0x2f61('0x14')][_0x2f61('0x16')]);}logger[_0x2f61('0x14')](_0x2f61('0xf'),_0x1ecaf3,_0x586048[_0x2f61('0x14')][_0x2f61('0x16')]);return _0x383d33(_0x586048[_0x2f61('0x14')][_0x2f61('0x16')]);}else{logger[_0x2f61('0xe')](_0x2f61('0xf'),_0x1ecaf3,_0x2f61('0x10'));_0x383d33(_0x586048['result'][_0x2f61('0x16')]);}})['catch'](function(_0x13eb82){logger[_0x2f61('0x14')](_0x2f61('0xf'),_0x1ecaf3,_0x13eb82);_0x2ec0c9(_0x13eb82);});});} \ No newline at end of file +var _0x3cda=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','ioredis'];(function(_0x26c1a8,_0x32cfc2){var _0x1a7ef7=function(_0x2bda20){while(--_0x2bda20){_0x26c1a8['push'](_0x26c1a8['shift']());}};_0x1a7ef7(++_0x32cfc2);}(_0x3cda,0x88));var _0xa3cd=function(_0x1652b7,_0xcd7dd5){_0x1652b7=_0x1652b7-0x0;var _0x54632e=_0x3cda[_0x1652b7];return _0x54632e;};'use strict';var _=require(_0xa3cd('0x0'));var util=require(_0xa3cd('0x1'));var moment=require('moment');var BPromise=require(_0xa3cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3cd('0x3'));var db=require(_0xa3cd('0x4'))['db'];var utils=require(_0xa3cd('0x5'));var logger=require(_0xa3cd('0x6'))('rpc');var config=require(_0xa3cd('0x7'));var jayson=require(_0xa3cd('0x8'));var client=jayson[_0xa3cd('0x9')][_0xa3cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470f55,_0x411e49,_0x69bd4f){return new BPromise(function(_0x397885,_0x3207b7){return client['request'](_0x470f55,_0x69bd4f)[_0xa3cd('0xb')](function(_0x14fffd){logger['info'](_0xa3cd('0xc'),_0x411e49,_0xa3cd('0xd'));logger[_0xa3cd('0xe')](_0xa3cd('0xf'),_0x411e49,_0xa3cd('0xd'),JSON['stringify'](_0x14fffd));if(_0x14fffd[_0xa3cd('0x10')]){if(_0x14fffd[_0xa3cd('0x10')][_0xa3cd('0x11')]===0x1f4){logger[_0xa3cd('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x411e49,_0x14fffd[_0xa3cd('0x10')][_0xa3cd('0x12')]);return _0x3207b7(_0x14fffd[_0xa3cd('0x10')][_0xa3cd('0x12')]);}logger['error'](_0xa3cd('0xc'),_0x411e49,_0x14fffd[_0xa3cd('0x10')][_0xa3cd('0x12')]);return _0x397885(_0x14fffd[_0xa3cd('0x10')]['message']);}else{logger['info'](_0xa3cd('0xc'),_0x411e49,'request\x20sent');_0x397885(_0x14fffd[_0xa3cd('0x13')][_0xa3cd('0x12')]);}})['catch'](function(_0x36cf5c){logger[_0xa3cd('0x10')](_0xa3cd('0xc'),_0x411e49,_0x36cf5c);_0x3207b7(_0x36cf5c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 663eaf8..89e669d 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 _0x076f=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x076f,0x82));var _0xf076=function(_0x2997b1,_0x473872){_0x2997b1=_0x2997b1-0x0;var _0x93fd0a=_0x076f[_0x2997b1];return _0x93fd0a;};'use strict';var multer=require(_0xf076('0x0'));var util=require('util');var path=require(_0xf076('0x1'));var timeout=require(_0xf076('0x2'));var express=require(_0xf076('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf076('0x4'));var interaction=require(_0xf076('0x5'));var config=require('../../config/environment');var controller=require(_0xf076('0x6'));router[_0xf076('0x7')]('/',auth[_0xf076('0x8')](),controller[_0xf076('0x9')]);router[_0xf076('0x7')](_0xf076('0xa'),auth[_0xf076('0x8')](),controller[_0xf076('0xb')]);router['post']('/',auth[_0xf076('0x8')](),controller[_0xf076('0xc')]);router[_0xf076('0xd')](_0xf076('0xa'),auth[_0xf076('0x8')](),controller[_0xf076('0xe')]);router[_0xf076('0xf')](_0xf076('0xa'),auth[_0xf076('0x8')](),controller[_0xf076('0x10')]);module[_0xf076('0x11')]=router; \ No newline at end of file +var _0x6554=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create'];(function(_0x218f74,_0x121e77){var _0x571054=function(_0x58544d){while(--_0x58544d){_0x218f74['push'](_0x218f74['shift']());}};_0x571054(++_0x121e77);}(_0x6554,0x11e));var _0x4655=function(_0x37b83f,_0x29a8f7){_0x37b83f=_0x37b83f-0x0;var _0x1fbac1=_0x6554[_0x37b83f];return _0x1fbac1;};'use strict';var multer=require(_0x4655('0x0'));var util=require('util');var path=require(_0x4655('0x1'));var timeout=require(_0x4655('0x2'));var express=require(_0x4655('0x3'));var router=express[_0x4655('0x4')]();var fs_extra=require(_0x4655('0x5'));var auth=require(_0x4655('0x6'));var interaction=require(_0x4655('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x4655('0x8')]('/',auth[_0x4655('0x9')](),controller[_0x4655('0xa')]);router['get']('/:id',auth[_0x4655('0x9')](),controller[_0x4655('0xb')]);router[_0x4655('0xc')]('/',auth['isAuthenticated'](),controller[_0x4655('0xd')]);router[_0x4655('0xe')](_0x4655('0xf'),auth[_0x4655('0x9')](),controller[_0x4655('0x10')]);router[_0x4655('0x11')](_0x4655('0xf'),auth[_0x4655('0x9')](),controller[_0x4655('0x12')]);module[_0x4655('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 8ea9214..5015d70 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 _0x696a=['picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x696a,0x159));var _0xa696=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x696a[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0xa696('0x0'));module[_0xa696('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa696('0x2'),_0xa696('0x3'),_0xa696('0x4'),_0xa696('0x5'),_0xa696('0x6')),'defaultValue':_0xa696('0x2')},'content':{'type':Sequelize[_0xa696('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa696('0x2'),'variable',_0xa696('0x4'))},'keyContent':{'type':Sequelize[_0xa696('0x7')]},'idField':{'type':Sequelize[_0xa696('0x7')]},'nameField':{'type':Sequelize[_0xa696('0x7')]},'customField':{'type':Sequelize[_0xa696('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa696('0x7')]}}; \ No newline at end of file +var _0x66b5=['string','picklist','STRING','variable','BOOLEAN','ENUM'];(function(_0x43afe5,_0x3d8925){var _0x37da4d=function(_0x187907){while(--_0x187907){_0x43afe5['push'](_0x43afe5['shift']());}};_0x37da4d(++_0x3d8925);}(_0x66b5,0xd7));var _0x566b=function(_0x15f824,_0x2674c4){_0x15f824=_0x15f824-0x0;var _0x3a7e8f=_0x66b5[_0x15f824];return _0x3a7e8f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x566b('0x0')](_0x566b('0x1'),'variable','customVariable','keyValue',_0x566b('0x2')),'defaultValue':_0x566b('0x1')},'content':{'type':Sequelize[_0x566b('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x566b('0x0')](_0x566b('0x1'),_0x566b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x566b('0x3')]},'idField':{'type':Sequelize[_0x566b('0x3')]},'nameField':{'type':Sequelize[_0x566b('0x3')]},'customField':{'type':Sequelize[_0x566b('0x5')],'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 6b2f093..f8a07b2 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 _0xf15b=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','index','Dynamics365Field','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format'];(function(_0x1f7bb0,_0x2f731f){var _0x227595=function(_0x19d925){while(--_0x19d925){_0x1f7bb0['push'](_0x1f7bb0['shift']());}};_0x227595(++_0x2f731f);}(_0xf15b,0x16c));var _0xbf15=function(_0x3c0fb0,_0x30329f){_0x3c0fb0=_0x3c0fb0-0x0;var _0x726751=_0xf15b[_0x3c0fb0];return _0x726751;};'use strict';var emlformat=require(_0xbf15('0x0'));var rimraf=require(_0xbf15('0x1'));var zipdir=require(_0xbf15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf15('0x3'));var moment=require(_0xbf15('0x4'));var BPromise=require(_0xbf15('0x5'));var Mustache=require(_0xbf15('0x6'));var util=require('util');var path=require(_0xbf15('0x7'));var sox=require(_0xbf15('0x8'));var csv=require('to-csv');var ejs=require(_0xbf15('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf15('0xa'));var squel=require('squel');var crypto=require(_0xbf15('0xb'));var jsforce=require(_0xbf15('0xc'));var deskjs=require(_0xbf15('0xd'));var toCsv=require(_0xbf15('0xe'));var querystring=require(_0xbf15('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbf15('0x10'));var qs=require(_0xbf15('0x11'));var as=require(_0xbf15('0x12'));var hardwareService=require(_0xbf15('0x13'));var logger=require(_0xbf15('0x14'))(_0xbf15('0x15'));var utils=require(_0xbf15('0x16'));var config=require(_0xbf15('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf15('0x18'))['db'];function respondWithStatusCode(_0x437849,_0x57404d){_0x57404d=_0x57404d||0xcc;return function(_0x4b81f5){if(_0x4b81f5){return _0x437849[_0xbf15('0x19')](_0x57404d);}return _0x437849[_0xbf15('0x1a')](_0x57404d)[_0xbf15('0x1b')]();};}function respondWithResult(_0x4ad4b4,_0x1e817c){_0x1e817c=_0x1e817c||0xc8;return function(_0x53b743){if(_0x53b743){return _0x4ad4b4[_0xbf15('0x1a')](_0x1e817c)['json'](_0x53b743);}};}function respondWithFilteredResult(_0x38625,_0x15a1ef){return function(_0x4f958b){if(_0x4f958b){var _0x52cfce=typeof _0x15a1ef[_0xbf15('0x1c')]===_0xbf15('0x1d')&&typeof _0x15a1ef[_0xbf15('0x1e')]==='undefined';var _0x5418d6=_0x4f958b['count'];var _0x53d264=_0x52cfce?0x0:_0x15a1ef[_0xbf15('0x1c')];var _0x37e385=_0x52cfce?_0x4f958b[_0xbf15('0x1f')]:_0x15a1ef[_0xbf15('0x1c')]+_0x15a1ef['limit'];var _0x13fdb1;if(_0x37e385>=_0x5418d6){_0x37e385=_0x5418d6;_0x13fdb1=0xc8;}else{_0x13fdb1=0xce;}_0x38625['status'](_0x13fdb1);return _0x38625[_0xbf15('0x20')]('Content-Range',_0x53d264+'-'+_0x37e385+'/'+_0x5418d6)['json'](_0x4f958b);}return null;};}function patchUpdates(_0x269676){return function(_0x131cd3){try{jsonpatch[_0xbf15('0x21')](_0x131cd3,_0x269676,!![]);}catch(_0x105e9a){return BPromise[_0xbf15('0x22')](_0x105e9a);}return _0x131cd3[_0xbf15('0x23')]();};}function saveUpdates(_0x1bbe12,_0x2227d9){return function(_0x55302c){if(_0x55302c){return _0x55302c['update'](_0x1bbe12)[_0xbf15('0x24')](function(_0x5bdd8b){return _0x5bdd8b;});}return null;};}function removeEntity(_0xfe3dff,_0x7817fd){return function(_0x3f2e2f){if(_0x3f2e2f){return _0x3f2e2f[_0xbf15('0x25')]()[_0xbf15('0x24')](function(){_0xfe3dff[_0xbf15('0x1a')](0xcc)[_0xbf15('0x1b')]();});}};}function handleEntityNotFound(_0x558749,_0x45b515){return function(_0x21f8ee){if(!_0x21f8ee){_0x558749['sendStatus'](0x194);}return _0x21f8ee;};}function handleError(_0x4ddedc,_0x3665b0){_0x3665b0=_0x3665b0||0x1f4;return function(_0x3bef39){logger['error'](_0x3bef39[_0xbf15('0x26')]);if(_0x3bef39[_0xbf15('0x27')]){delete _0x3bef39['name'];}_0x4ddedc[_0xbf15('0x1a')](_0x3665b0)['send'](_0x3bef39);};}exports[_0xbf15('0x28')]=function(_0x512373,_0x31214f){var _0x3319c9={},_0x32b2af={},_0x44d09a={'count':0x0,'rows':[]};var _0x2c73f4=_['map'](db[_0xbf15('0x29')][_0xbf15('0x2a')],function(_0x9a4d33){return{'name':_0x9a4d33['fieldName'],'type':_0x9a4d33[_0xbf15('0x2b')]['key']};});_0x32b2af[_0xbf15('0x2c')]=_[_0xbf15('0x2d')](_0x2c73f4,_0xbf15('0x27'));_0x32b2af['query']=_[_0xbf15('0x2e')](_0x512373[_0xbf15('0x2f')]);_0x32b2af[_0xbf15('0x30')]=_[_0xbf15('0x31')](_0x32b2af[_0xbf15('0x2c')],_0x32b2af[_0xbf15('0x2f')]);_0x3319c9['attributes']=_[_0xbf15('0x31')](_0x32b2af[_0xbf15('0x2c')],qs[_0xbf15('0x32')](_0x512373[_0xbf15('0x2f')][_0xbf15('0x32')]));_0x3319c9[_0xbf15('0x33')]=_0x3319c9[_0xbf15('0x33')][_0xbf15('0x34')]?_0x3319c9[_0xbf15('0x33')]:_0x32b2af[_0xbf15('0x2c')];if(!_0x512373[_0xbf15('0x2f')][_0xbf15('0x35')](_0xbf15('0x36'))){_0x3319c9[_0xbf15('0x1e')]=qs[_0xbf15('0x1e')](_0x512373[_0xbf15('0x2f')][_0xbf15('0x1e')]);_0x3319c9[_0xbf15('0x1c')]=qs[_0xbf15('0x1c')](_0x512373[_0xbf15('0x2f')][_0xbf15('0x1c')]);}_0x3319c9[_0xbf15('0x37')]=qs[_0xbf15('0x38')](_0x512373['query'][_0xbf15('0x38')]);_0x3319c9[_0xbf15('0x39')]=qs[_0xbf15('0x30')](_['pick'](_0x512373[_0xbf15('0x2f')],_0x32b2af[_0xbf15('0x30')]),_0x2c73f4);if(_0x512373[_0xbf15('0x2f')][_0xbf15('0x3a')]){_0x3319c9[_0xbf15('0x39')]=_[_0xbf15('0x3b')](_0x3319c9['where'],{'$or':_[_0xbf15('0x2d')](_0x2c73f4,function(_0x49213c){if(_0x49213c[_0xbf15('0x2b')]!==_0xbf15('0x3c')){var _0x43985e={};_0x43985e[_0x49213c['name']]={'$like':'%'+_0x512373[_0xbf15('0x2f')][_0xbf15('0x3a')]+'%'};return _0x43985e;}})});}_0x3319c9=_[_0xbf15('0x3b')]({},_0x3319c9,_0x512373[_0xbf15('0x3d')]);var _0x360f4f={'where':_0x3319c9[_0xbf15('0x39')]};return db[_0xbf15('0x29')]['count'](_0x360f4f)['then'](function(_0x538040){_0x44d09a[_0xbf15('0x1f')]=_0x538040;if(_0x512373['query'][_0xbf15('0x3e')]){_0x3319c9[_0xbf15('0x3f')]=[{'all':!![]}];}return db[_0xbf15('0x29')][_0xbf15('0x40')](_0x3319c9);})[_0xbf15('0x24')](function(_0x3b07ac){_0x44d09a[_0xbf15('0x41')]=_0x3b07ac;return _0x44d09a;})['then'](respondWithFilteredResult(_0x31214f,_0x3319c9))[_0xbf15('0x42')](handleError(_0x31214f,null));};exports[_0xbf15('0x43')]=function(_0x347107,_0x3912f3){var _0x5dc63e={'raw':!![],'where':{'id':_0x347107[_0xbf15('0x44')]['id']}},_0x361483={};_0x361483[_0xbf15('0x2c')]=_[_0xbf15('0x2e')](db[_0xbf15('0x29')][_0xbf15('0x2a')]);_0x361483[_0xbf15('0x2f')]=_[_0xbf15('0x2e')](_0x347107['query']);_0x361483[_0xbf15('0x30')]=_[_0xbf15('0x31')](_0x361483[_0xbf15('0x2c')],_0x361483['query']);_0x5dc63e[_0xbf15('0x33')]=_[_0xbf15('0x31')](_0x361483[_0xbf15('0x2c')],qs[_0xbf15('0x32')](_0x347107[_0xbf15('0x2f')][_0xbf15('0x32')]));_0x5dc63e['attributes']=_0x5dc63e[_0xbf15('0x33')]['length']?_0x5dc63e[_0xbf15('0x33')]:_0x361483[_0xbf15('0x2c')];if(_0x347107[_0xbf15('0x2f')]['includeAll']){_0x5dc63e[_0xbf15('0x3f')]=[{'all':!![]}];}_0x5dc63e=_[_0xbf15('0x3b')]({},_0x5dc63e,_0x347107[_0xbf15('0x3d')]);return db[_0xbf15('0x29')][_0xbf15('0x45')](_0x5dc63e)[_0xbf15('0x24')](handleEntityNotFound(_0x3912f3,null))[_0xbf15('0x24')](respondWithResult(_0x3912f3,null))[_0xbf15('0x42')](handleError(_0x3912f3,null));};exports['create']=function(_0x247333,_0x1a1b64){return db[_0xbf15('0x29')][_0xbf15('0x46')](_0x247333['body'],{})[_0xbf15('0x24')](respondWithResult(_0x1a1b64,0xc9))[_0xbf15('0x42')](handleError(_0x1a1b64,null));};exports[_0xbf15('0x47')]=function(_0x287337,_0x1da3d7){if(_0x287337[_0xbf15('0x48')]['id']){delete _0x287337[_0xbf15('0x48')]['id'];}return db[_0xbf15('0x29')][_0xbf15('0x45')]({'where':{'id':_0x287337[_0xbf15('0x44')]['id']}})['then'](handleEntityNotFound(_0x1da3d7,null))['then'](saveUpdates(_0x287337['body'],null))[_0xbf15('0x24')](respondWithResult(_0x1da3d7,null))[_0xbf15('0x42')](handleError(_0x1da3d7,null));};exports[_0xbf15('0x25')]=function(_0x43a130,_0x465c96){return db[_0xbf15('0x29')][_0xbf15('0x45')]({'where':{'id':_0x43a130[_0xbf15('0x44')]['id']}})[_0xbf15('0x24')](handleEntityNotFound(_0x465c96,null))[_0xbf15('0x24')](removeEntity(_0x465c96,null))[_0xbf15('0x42')](handleError(_0x465c96,null));}; \ No newline at end of file +var _0x4025=['../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','catch','show','keys','includeAll','options','find','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4025,0xb8));var _0x5402=function(_0x161a0f,_0x3a034a){_0x161a0f=_0x161a0f-0x0;var _0x3437cb=_0x4025[_0x161a0f];return _0x3437cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5402('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5402('0x1'));var rp=require(_0x5402('0x2'));var moment=require(_0x5402('0x3'));var BPromise=require(_0x5402('0x4'));var Mustache=require('mustache');var util=require(_0x5402('0x5'));var path=require('path');var sox=require(_0x5402('0x6'));var csv=require('to-csv');var ejs=require(_0x5402('0x7'));var fs=require('fs');var fs_extra=require(_0x5402('0x8'));var _=require(_0x5402('0x9'));var squel=require(_0x5402('0xa'));var crypto=require(_0x5402('0xb'));var jsforce=require(_0x5402('0xc'));var deskjs=require(_0x5402('0xd'));var toCsv=require(_0x5402('0xe'));var querystring=require(_0x5402('0xf'));var Papa=require('papaparse');var Redis=require(_0x5402('0x10'));var authService=require(_0x5402('0x11'));var qs=require(_0x5402('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5402('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5402('0x14'));var config=require(_0x5402('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560c53,_0x3213b3){_0x3213b3=_0x3213b3||0xcc;return function(_0x34d7b1){if(_0x34d7b1){return _0x560c53[_0x5402('0x16')](_0x3213b3);}return _0x560c53['status'](_0x3213b3)[_0x5402('0x17')]();};}function respondWithResult(_0x2e9015,_0x5a643e){_0x5a643e=_0x5a643e||0xc8;return function(_0x49d558){if(_0x49d558){return _0x2e9015[_0x5402('0x18')](_0x5a643e)[_0x5402('0x19')](_0x49d558);}};}function respondWithFilteredResult(_0x103c31,_0x48c362){return function(_0x48a606){if(_0x48a606){var _0x1492ff=typeof _0x48c362[_0x5402('0x1a')]==='undefined'&&typeof _0x48c362[_0x5402('0x1b')]===_0x5402('0x1c');var _0x9f2a9d=_0x48a606[_0x5402('0x1d')];var _0x587f6e=_0x1492ff?0x0:_0x48c362[_0x5402('0x1a')];var _0x5d56db=_0x1492ff?_0x48a606[_0x5402('0x1d')]:_0x48c362[_0x5402('0x1a')]+_0x48c362['limit'];var _0x127532;if(_0x5d56db>=_0x9f2a9d){_0x5d56db=_0x9f2a9d;_0x127532=0xc8;}else{_0x127532=0xce;}_0x103c31['status'](_0x127532);return _0x103c31[_0x5402('0x1e')]('Content-Range',_0x587f6e+'-'+_0x5d56db+'/'+_0x9f2a9d)[_0x5402('0x19')](_0x48a606);}return null;};}function patchUpdates(_0x2f42d7){return function(_0x1b840b){try{jsonpatch['apply'](_0x1b840b,_0x2f42d7,!![]);}catch(_0x3a02db){return BPromise[_0x5402('0x1f')](_0x3a02db);}return _0x1b840b[_0x5402('0x20')]();};}function saveUpdates(_0x2c8ef5,_0x4fe7b4){return function(_0x2580b9){if(_0x2580b9){return _0x2580b9[_0x5402('0x21')](_0x2c8ef5)[_0x5402('0x22')](function(_0x512bcd){return _0x512bcd;});}return null;};}function removeEntity(_0x7f004f,_0x275843){return function(_0x45fd5c){if(_0x45fd5c){return _0x45fd5c[_0x5402('0x23')]()[_0x5402('0x22')](function(){_0x7f004f[_0x5402('0x18')](0xcc)[_0x5402('0x17')]();});}};}function handleEntityNotFound(_0x5e8e20,_0x5958ad){return function(_0x58aeb2){if(!_0x58aeb2){_0x5e8e20['sendStatus'](0x194);}return _0x58aeb2;};}function handleError(_0x298672,_0x4ad495){_0x4ad495=_0x4ad495||0x1f4;return function(_0x17657b){logger['error'](_0x17657b['stack']);if(_0x17657b[_0x5402('0x24')]){delete _0x17657b[_0x5402('0x24')];}_0x298672[_0x5402('0x18')](_0x4ad495)[_0x5402('0x25')](_0x17657b);};}exports['index']=function(_0x29f231,_0x4dd9aa){var _0x9ef0cf={},_0x2c062b={},_0xa74efa={'count':0x0,'rows':[]};var _0x5337cb=_[_0x5402('0x26')](db[_0x5402('0x27')][_0x5402('0x28')],function(_0x897950){return{'name':_0x897950[_0x5402('0x29')],'type':_0x897950[_0x5402('0x2a')][_0x5402('0x2b')]};});_0x2c062b[_0x5402('0x2c')]=_[_0x5402('0x26')](_0x5337cb,_0x5402('0x24'));_0x2c062b[_0x5402('0x2d')]=_['keys'](_0x29f231[_0x5402('0x2d')]);_0x2c062b[_0x5402('0x2e')]=_[_0x5402('0x2f')](_0x2c062b[_0x5402('0x2c')],_0x2c062b[_0x5402('0x2d')]);_0x9ef0cf[_0x5402('0x30')]=_[_0x5402('0x2f')](_0x2c062b[_0x5402('0x2c')],qs[_0x5402('0x31')](_0x29f231['query']['fields']));_0x9ef0cf['attributes']=_0x9ef0cf[_0x5402('0x30')][_0x5402('0x32')]?_0x9ef0cf['attributes']:_0x2c062b['model'];if(!_0x29f231['query'][_0x5402('0x33')](_0x5402('0x34'))){_0x9ef0cf['limit']=qs[_0x5402('0x1b')](_0x29f231['query'][_0x5402('0x1b')]);_0x9ef0cf[_0x5402('0x1a')]=qs[_0x5402('0x1a')](_0x29f231[_0x5402('0x2d')]['offset']);}_0x9ef0cf['order']=qs['sort'](_0x29f231[_0x5402('0x2d')][_0x5402('0x35')]);_0x9ef0cf[_0x5402('0x36')]=qs[_0x5402('0x2e')](_['pick'](_0x29f231[_0x5402('0x2d')],_0x2c062b[_0x5402('0x2e')]),_0x5337cb);if(_0x29f231['query'][_0x5402('0x37')]){_0x9ef0cf[_0x5402('0x36')]=_['merge'](_0x9ef0cf[_0x5402('0x36')],{'$or':_[_0x5402('0x26')](_0x5337cb,function(_0x508a0d){if(_0x508a0d[_0x5402('0x2a')]!==_0x5402('0x38')){var _0x45a2d3={};_0x45a2d3[_0x508a0d[_0x5402('0x24')]]={'$like':'%'+_0x29f231[_0x5402('0x2d')][_0x5402('0x37')]+'%'};return _0x45a2d3;}})});}_0x9ef0cf=_[_0x5402('0x39')]({},_0x9ef0cf,_0x29f231['options']);var _0x1ae951={'where':_0x9ef0cf['where']};return db['Dynamics365Field'][_0x5402('0x1d')](_0x1ae951)[_0x5402('0x22')](function(_0x3d9a5a){_0xa74efa[_0x5402('0x1d')]=_0x3d9a5a;if(_0x29f231[_0x5402('0x2d')]['includeAll']){_0x9ef0cf[_0x5402('0x3a')]=[{'all':!![]}];}return db[_0x5402('0x27')]['findAll'](_0x9ef0cf);})[_0x5402('0x22')](function(_0x517d83){_0xa74efa['rows']=_0x517d83;return _0xa74efa;})['then'](respondWithFilteredResult(_0x4dd9aa,_0x9ef0cf))[_0x5402('0x3b')](handleError(_0x4dd9aa,null));};exports[_0x5402('0x3c')]=function(_0x450390,_0x27d2fa){var _0x3c7de7={'raw':!![],'where':{'id':_0x450390['params']['id']}},_0x35f65e={};_0x35f65e[_0x5402('0x2c')]=_[_0x5402('0x3d')](db['Dynamics365Field'][_0x5402('0x28')]);_0x35f65e[_0x5402('0x2d')]=_[_0x5402('0x3d')](_0x450390[_0x5402('0x2d')]);_0x35f65e[_0x5402('0x2e')]=_[_0x5402('0x2f')](_0x35f65e[_0x5402('0x2c')],_0x35f65e['query']);_0x3c7de7['attributes']=_[_0x5402('0x2f')](_0x35f65e[_0x5402('0x2c')],qs[_0x5402('0x31')](_0x450390['query'][_0x5402('0x31')]));_0x3c7de7[_0x5402('0x30')]=_0x3c7de7[_0x5402('0x30')][_0x5402('0x32')]?_0x3c7de7[_0x5402('0x30')]:_0x35f65e['model'];if(_0x450390[_0x5402('0x2d')][_0x5402('0x3e')]){_0x3c7de7[_0x5402('0x3a')]=[{'all':!![]}];}_0x3c7de7=_[_0x5402('0x39')]({},_0x3c7de7,_0x450390[_0x5402('0x3f')]);return db[_0x5402('0x27')][_0x5402('0x40')](_0x3c7de7)[_0x5402('0x22')](handleEntityNotFound(_0x27d2fa,null))['then'](respondWithResult(_0x27d2fa,null))[_0x5402('0x3b')](handleError(_0x27d2fa,null));};exports['create']=function(_0x42cab7,_0x2acb8a){return db[_0x5402('0x27')][_0x5402('0x41')](_0x42cab7[_0x5402('0x42')],{})[_0x5402('0x22')](respondWithResult(_0x2acb8a,0xc9))['catch'](handleError(_0x2acb8a,null));};exports['update']=function(_0xb833cb,_0x34f3fb){if(_0xb833cb['body']['id']){delete _0xb833cb[_0x5402('0x42')]['id'];}return db[_0x5402('0x27')][_0x5402('0x40')]({'where':{'id':_0xb833cb[_0x5402('0x43')]['id']}})[_0x5402('0x22')](handleEntityNotFound(_0x34f3fb,null))['then'](saveUpdates(_0xb833cb['body'],null))['then'](respondWithResult(_0x34f3fb,null))['catch'](handleError(_0x34f3fb,null));};exports[_0x5402('0x23')]=function(_0x5ed0df,_0x51a2ac){return db[_0x5402('0x27')][_0x5402('0x40')]({'where':{'id':_0x5ed0df[_0x5402('0x43')]['id']}})[_0x5402('0x22')](handleEntityNotFound(_0x51a2ac,null))[_0x5402('0x22')](removeEntity(_0x51a2ac,null))[_0x5402('0x3b')](handleError(_0x51a2ac,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6ab062f..9f5183c 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 _0xefdc=['api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x43df9c,_0x5e5f0a){var _0x1acf5b=function(_0x5ae72b){while(--_0x5ae72b){_0x43df9c['push'](_0x43df9c['shift']());}};_0x1acf5b(++_0x5e5f0a);}(_0xefdc,0x124));var _0xcefd=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xefdc[_0x485b5a];return _0xd2b34d;};'use strict';var _=require('lodash');var util=require(_0xcefd('0x0'));var logger=require(_0xcefd('0x1'))(_0xcefd('0x2'));var moment=require('moment');var BPromise=require(_0xcefd('0x3'));var rp=require(_0xcefd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcefd('0x5'));var config=require(_0xcefd('0x6'));var attributes=require(_0xcefd('0x7'));module['exports']=function(_0x4b6a9f,_0x477ef1){return _0x4b6a9f[_0xcefd('0x8')](_0xcefd('0x9'),attributes,{'tableName':_0xcefd('0xa'),'paranoid':![],'indexes':[{'name':_0xcefd('0xb'),'fields':[_0xcefd('0xc'),_0xcefd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0fa6=['idField','util','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x5b92f2,_0x56b0e8){var _0x1a6380=function(_0x1ccfbf){while(--_0x1ccfbf){_0x5b92f2['push'](_0x5b92f2['shift']());}};_0x1a6380(++_0x56b0e8);}(_0x0fa6,0x1e2));var _0x60fa=function(_0x362fc6,_0x492248){_0x362fc6=_0x362fc6-0x0;var _0x4450ed=_0x0fa6[_0x362fc6];return _0x4450ed;};'use strict';var _=require('lodash');var util=require(_0x60fa('0x0'));var logger=require('../../config/logger')(_0x60fa('0x1'));var moment=require(_0x60fa('0x2'));var BPromise=require(_0x60fa('0x3'));var rp=require(_0x60fa('0x4'));var fs=require('fs');var path=require(_0x60fa('0x5'));var rimraf=require(_0x60fa('0x6'));var config=require('../../config/environment');var attributes=require(_0x60fa('0x7'));module[_0x60fa('0x8')]=function(_0x3b0e31,_0x884470){return _0x3b0e31[_0x60fa('0x9')](_0x60fa('0xa'),attributes,{'tableName':_0x60fa('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x60fa('0xc'),'FieldId'],'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 41694e7..34307e9 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 _0xa0c2=['jayson/promise','http','request','then','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4507c1,_0xa8d71a){var _0x3d3b03=function(_0x438bca){while(--_0x438bca){_0x4507c1['push'](_0x4507c1['shift']());}};_0x3d3b03(++_0xa8d71a);}(_0xa0c2,0x1ec));var _0x2a0c=function(_0x27c440,_0x11240f){_0x27c440=_0x27c440-0x0;var _0x451096=_0xa0c2[_0x27c440];return _0x451096;};'use strict';var _=require(_0x2a0c('0x0'));var util=require('util');var moment=require(_0x2a0c('0x1'));var BPromise=require(_0x2a0c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a0c('0x3'));var db=require(_0x2a0c('0x4'))['db'];var utils=require(_0x2a0c('0x5'));var logger=require(_0x2a0c('0x6'))('rpc');var config=require(_0x2a0c('0x7'));var jayson=require(_0x2a0c('0x8'));var client=jayson['client'][_0x2a0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x327622,_0x5b1fd4,_0x149431){return new BPromise(function(_0x325451,_0x36b0e9){return client[_0x2a0c('0xa')](_0x327622,_0x149431)[_0x2a0c('0xb')](function(_0x4e8827){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x5b1fd4,_0x2a0c('0xc'));logger['debug'](_0x2a0c('0xd'),_0x5b1fd4,_0x2a0c('0xc'),JSON['stringify'](_0x4e8827));if(_0x4e8827['error']){if(_0x4e8827[_0x2a0c('0xe')][_0x2a0c('0xf')]===0x1f4){logger['error'](_0x2a0c('0x10'),_0x5b1fd4,_0x4e8827[_0x2a0c('0xe')][_0x2a0c('0x11')]);return _0x36b0e9(_0x4e8827['error'][_0x2a0c('0x11')]);}logger[_0x2a0c('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x5b1fd4,_0x4e8827['error'][_0x2a0c('0x11')]);return _0x325451(_0x4e8827[_0x2a0c('0xe')][_0x2a0c('0x11')]);}else{logger[_0x2a0c('0x12')](_0x2a0c('0x10'),_0x5b1fd4,_0x2a0c('0xc'));_0x325451(_0x4e8827[_0x2a0c('0x13')][_0x2a0c('0x11')]);}})['catch'](function(_0x594afb){logger[_0x2a0c('0xe')](_0x2a0c('0x10'),_0x5b1fd4,_0x594afb);_0x36b0e9(_0x594afb);});});} \ No newline at end of file +var _0xf5c5=['http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x425088,_0x14330d){var _0x26e736=function(_0x42219f){while(--_0x42219f){_0x425088['push'](_0x425088['shift']());}};_0x26e736(++_0x14330d);}(_0xf5c5,0x108));var _0x5f5c=function(_0x28a240,_0x45fe8e){_0x28a240=_0x28a240-0x0;var _0x7ee9d0=_0xf5c5[_0x28a240];return _0x7ee9d0;};'use strict';var _=require(_0x5f5c('0x0'));var util=require('util');var moment=require(_0x5f5c('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f5c('0x2'));var fs=require('fs');var Redis=require(_0x5f5c('0x3'));var db=require(_0x5f5c('0x4'))['db'];var utils=require(_0x5f5c('0x5'));var logger=require('../../config/logger')(_0x5f5c('0x6'));var config=require(_0x5f5c('0x7'));var jayson=require(_0x5f5c('0x8'));var client=jayson['client'][_0x5f5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a025d,_0x15e0a6,_0x249d75){return new BPromise(function(_0x5e0771,_0x2b4763){return client[_0x5f5c('0xa')](_0x4a025d,_0x249d75)[_0x5f5c('0xb')](function(_0x29ebb0){logger['info'](_0x5f5c('0xc'),_0x15e0a6,_0x5f5c('0xd'));logger[_0x5f5c('0xe')](_0x5f5c('0xf'),_0x15e0a6,'request\x20sent',JSON[_0x5f5c('0x10')](_0x29ebb0));if(_0x29ebb0['error']){if(_0x29ebb0[_0x5f5c('0x11')]['code']===0x1f4){logger['error'](_0x5f5c('0xc'),_0x15e0a6,_0x29ebb0['error'][_0x5f5c('0x12')]);return _0x2b4763(_0x29ebb0['error'][_0x5f5c('0x12')]);}logger[_0x5f5c('0x11')](_0x5f5c('0xc'),_0x15e0a6,_0x29ebb0[_0x5f5c('0x11')][_0x5f5c('0x12')]);return _0x5e0771(_0x29ebb0[_0x5f5c('0x11')]['message']);}else{logger['info'](_0x5f5c('0xc'),_0x15e0a6,_0x5f5c('0xd'));_0x5e0771(_0x29ebb0[_0x5f5c('0x13')][_0x5f5c('0x12')]);}})[_0x5f5c('0x14')](function(_0x7c7adb){logger[_0x5f5c('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x15e0a6,_0x7c7adb);_0x2b4763(_0x7c7adb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 92d42bc..5d6faba 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 _0xf8f9=['../../components/interaction/service','isAuthenticated','index','get','/:id/fields','post','/:id/configurations','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x29d693,_0x543881){var _0x3bf170=function(_0x17b324){while(--_0x17b324){_0x29d693['push'](_0x29d693['shift']());}};_0x3bf170(++_0x543881);}(_0xf8f9,0x91));var _0x9f8f=function(_0x41ba2c,_0xf0543e){_0x41ba2c=_0x41ba2c-0x0;var _0x54a57f=_0xf8f9[_0x41ba2c];return _0x54a57f;};'use strict';var multer=require('multer');var util=require(_0x9f8f('0x0'));var path=require(_0x9f8f('0x1'));var timeout=require(_0x9f8f('0x2'));var express=require(_0x9f8f('0x3'));var router=express[_0x9f8f('0x4')]();var fs_extra=require(_0x9f8f('0x5'));var auth=require(_0x9f8f('0x6'));var interaction=require(_0x9f8f('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x9f8f('0x8')](),controller[_0x9f8f('0x9')]);router[_0x9f8f('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x9f8f('0x8')](),controller['getConfigurations']);router[_0x9f8f('0xa')](_0x9f8f('0xb'),auth[_0x9f8f('0x8')](),controller['getFields']);router['post']('/',auth[_0x9f8f('0x8')](),controller['create']);router[_0x9f8f('0xc')](_0x9f8f('0xd'),auth[_0x9f8f('0x8')](),controller[_0x9f8f('0xe')]);router[_0x9f8f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9f8f('0x10')]);router[_0x9f8f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9f8f('0x12')]=router; \ No newline at end of file +var _0x0650=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer'];(function(_0x3001a9,_0x27248f){var _0x223baa=function(_0x200a17){while(--_0x200a17){_0x3001a9['push'](_0x3001a9['shift']());}};_0x223baa(++_0x27248f);}(_0x0650,0x14f));var _0x0065=function(_0x2c753c,_0x3378e7){_0x2c753c=_0x2c753c-0x0;var _0x23ba20=_0x0650[_0x2c753c];return _0x23ba20;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0065('0x1'));var express=require(_0x0065('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0065('0x3'));var interaction=require(_0x0065('0x4'));var config=require('../../config/environment');var controller=require(_0x0065('0x5'));router[_0x0065('0x6')]('/',auth[_0x0065('0x7')](),controller[_0x0065('0x8')]);router['get'](_0x0065('0x9'),auth[_0x0065('0x7')](),controller[_0x0065('0xa')]);router[_0x0065('0x6')](_0x0065('0xb'),auth[_0x0065('0x7')](),controller['getConfigurations']);router[_0x0065('0x6')](_0x0065('0xc'),auth[_0x0065('0x7')](),controller[_0x0065('0xd')]);router[_0x0065('0xe')]('/',auth[_0x0065('0x7')](),controller[_0x0065('0xf')]);router[_0x0065('0xe')](_0x0065('0xb'),auth['isAuthenticated'](),controller[_0x0065('0x10')]);router[_0x0065('0x11')](_0x0065('0x9'),auth['isAuthenticated'](),controller[_0x0065('0x12')]);router['delete'](_0x0065('0x9'),auth[_0x0065('0x7')](),controller[_0x0065('0x13')]);module[_0x0065('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 38edbf9..3eb0dcf 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 _0xfff0=['username','exports','STRING'];(function(_0x42eef9,_0x465269){var _0x157ba3=function(_0x330226){while(--_0x330226){_0x42eef9['push'](_0x42eef9['shift']());}};_0x157ba3(++_0x465269);}(_0xfff0,0x139));var _0x0fff=function(_0x16e726,_0x400bf2){_0x16e726=_0x16e726-0x0;var _0x41f94f=_0xfff0[_0x16e726];return _0x41f94f;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')]},'description':{'type':Sequelize[_0x0fff('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0fff('0x2')},'apiKey':{'type':Sequelize[_0x0fff('0x1')]},'remoteUri':{'type':Sequelize[_0x0fff('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2a07=['sequelize','exports','STRING','remoteUri'];(function(_0x30ba61,_0x48b905){var _0x7300ad=function(_0x3b4f73){while(--_0x3b4f73){_0x30ba61['push'](_0x30ba61['shift']());}};_0x7300ad(++_0x48b905);}(_0x2a07,0x74));var _0x72a0=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x2a07[_0x516ffb];return _0x319667;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'name':{'type':Sequelize[_0x72a0('0x2')]},'description':{'type':Sequelize[_0x72a0('0x2')]},'username':{'type':Sequelize[_0x72a0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x72a0('0x2')]},'remoteUri':{'type':Sequelize[_0x72a0('0x2')],'unique':_0x72a0('0x3')},'serverUrl':{'type':Sequelize[_0x72a0('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 f6f215d..1f03bdb 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e5e=['Basic\x20%s','%s:X','apiKey','toString','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','include','rows','catch','show','params','attributes','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x9e5e[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require(_0xe9e5('0x0'));var rimraf=require(_0xe9e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9e5('0x2'));var rp=require(_0xe9e5('0x3'));var moment=require(_0xe9e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9e5('0x5'));var util=require('util');var path=require(_0xe9e5('0x6'));var sox=require(_0xe9e5('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9e5('0x8'));var _=require(_0xe9e5('0x9'));var squel=require('squel');var crypto=require(_0xe9e5('0xa'));var jsforce=require(_0xe9e5('0xb'));var deskjs=require(_0xe9e5('0xc'));var toCsv=require(_0xe9e5('0xd'));var querystring=require(_0xe9e5('0xe'));var Papa=require(_0xe9e5('0xf'));var Redis=require(_0xe9e5('0x10'));var authService=require(_0xe9e5('0x11'));var qs=require(_0xe9e5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9e5('0x13'));var logger=require(_0xe9e5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe9e5('0x15'))['db'];var integrations=require(_0xe9e5('0x16'));function respondWithStatusCode(_0x42dcba,_0x272b49){_0x272b49=_0x272b49||0xcc;return function(_0x269ac4){if(_0x269ac4){return _0x42dcba[_0xe9e5('0x17')](_0x272b49);}return _0x42dcba[_0xe9e5('0x18')](_0x272b49)[_0xe9e5('0x19')]();};}function respondWithResult(_0x3097da,_0xfe19e8){_0xfe19e8=_0xfe19e8||0xc8;return function(_0x5c901a){if(_0x5c901a){return _0x3097da[_0xe9e5('0x18')](_0xfe19e8)[_0xe9e5('0x1a')](_0x5c901a);}};}function respondWithFilteredResult(_0x35c830,_0x3f0990){return function(_0x17990d){if(_0x17990d){var _0x695c52=typeof _0x3f0990[_0xe9e5('0x1b')]===_0xe9e5('0x1c')&&typeof _0x3f0990[_0xe9e5('0x1d')]===_0xe9e5('0x1c');var _0x4d779e=_0x17990d[_0xe9e5('0x1e')];var _0x30550=_0x695c52?0x0:_0x3f0990[_0xe9e5('0x1b')];var _0x3ad9f9=_0x695c52?_0x17990d[_0xe9e5('0x1e')]:_0x3f0990[_0xe9e5('0x1b')]+_0x3f0990[_0xe9e5('0x1d')];var _0x44e60d;if(_0x3ad9f9>=_0x4d779e){_0x3ad9f9=_0x4d779e;_0x44e60d=0xc8;}else{_0x44e60d=0xce;}_0x35c830[_0xe9e5('0x18')](_0x44e60d);return _0x35c830[_0xe9e5('0x1f')]('Content-Range',_0x30550+'-'+_0x3ad9f9+'/'+_0x4d779e)['json'](_0x17990d);}return null;};}function patchUpdates(_0x559d10){return function(_0x106b21){try{jsonpatch[_0xe9e5('0x20')](_0x106b21,_0x559d10,!![]);}catch(_0x2935a4){return BPromise[_0xe9e5('0x21')](_0x2935a4);}return _0x106b21[_0xe9e5('0x22')]();};}function saveUpdates(_0xb2a983,_0x22d394){return function(_0x15db4b){if(_0x15db4b){return _0x15db4b[_0xe9e5('0x23')](_0xb2a983)[_0xe9e5('0x24')](function(_0x1b9d2f){return _0x1b9d2f;});}return null;};}function removeEntity(_0x4c0fb9,_0x252fdc){return function(_0x579d9a){if(_0x579d9a){return _0x579d9a[_0xe9e5('0x25')]()['then'](function(){_0x4c0fb9[_0xe9e5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac8fc,_0x5e84dc){return function(_0xf88884){if(!_0xf88884){_0x5ac8fc[_0xe9e5('0x17')](0x194);}return _0xf88884;};}function handleError(_0x338076,_0x327cb2){_0x327cb2=_0x327cb2||0x1f4;return function(_0x3fcab2){logger[_0xe9e5('0x26')](_0x3fcab2[_0xe9e5('0x27')]);if(_0x3fcab2[_0xe9e5('0x28')]){delete _0x3fcab2[_0xe9e5('0x28')];}_0x338076[_0xe9e5('0x18')](_0x327cb2)['send'](_0x3fcab2);};}exports[_0xe9e5('0x29')]=function(_0x56f728,_0xe7d11e){var _0x18969d={},_0x554bcb={},_0x4161e9={'count':0x0,'rows':[]};var _0x881d0d=_[_0xe9e5('0x2a')](db['FreshdeskAccount'][_0xe9e5('0x2b')],function(_0x5d0593){return{'name':_0x5d0593[_0xe9e5('0x2c')],'type':_0x5d0593[_0xe9e5('0x2d')]['key']};});_0x554bcb[_0xe9e5('0x2e')]=_[_0xe9e5('0x2a')](_0x881d0d,'name');_0x554bcb[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x56f728[_0xe9e5('0x2f')]);_0x554bcb[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],_0x554bcb['query']);_0x18969d['attributes']=_[_0xe9e5('0x32')](_0x554bcb[_0xe9e5('0x2e')],qs['fields'](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x18969d['attributes']=_0x18969d['attributes'][_0xe9e5('0x34')]?_0x18969d['attributes']:_0x554bcb['model'];if(!_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x35')](_0xe9e5('0x36'))){_0x18969d[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x18969d[_0xe9e5('0x1b')]=qs[_0xe9e5('0x1b')](_0x56f728[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}_0x18969d[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x56f728['query'][_0xe9e5('0x38')]);_0x18969d[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_[_0xe9e5('0x3a')](_0x56f728[_0xe9e5('0x2f')],_0x554bcb[_0xe9e5('0x31')]),_0x881d0d);if(_0x56f728['query'][_0xe9e5('0x3b')]){_0x18969d[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x18969d['where'],{'$or':_[_0xe9e5('0x2a')](_0x881d0d,function(_0x352903){if(_0x352903[_0xe9e5('0x2d')]!==_0xe9e5('0x3d')){var _0x3353d6={};_0x3353d6[_0x352903[_0xe9e5('0x28')]]={'$like':'%'+_0x56f728[_0xe9e5('0x2f')]['filter']+'%'};return _0x3353d6;}})});}_0x18969d=_['merge']({},_0x18969d,_0x56f728[_0xe9e5('0x3e')]);var _0x304571={'where':_0x18969d[_0xe9e5('0x39')]};return db[_0xe9e5('0x3f')][_0xe9e5('0x1e')](_0x304571)['then'](function(_0x2c44eb){_0x4161e9['count']=_0x2c44eb;if(_0x56f728[_0xe9e5('0x2f')]['includeAll']){_0x18969d[_0xe9e5('0x40')]=[{'all':!![]}];}return db[_0xe9e5('0x3f')]['findAll'](_0x18969d);})[_0xe9e5('0x24')](function(_0x47c5ea){_0x4161e9[_0xe9e5('0x41')]=_0x47c5ea;return _0x4161e9;})[_0xe9e5('0x24')](respondWithFilteredResult(_0xe7d11e,_0x18969d))[_0xe9e5('0x42')](handleError(_0xe7d11e,null));};exports[_0xe9e5('0x43')]=function(_0x10572d,_0x2bc934){var _0x1601fd={'raw':![],'where':{'id':_0x10572d[_0xe9e5('0x44')]['id']}},_0x147741={};_0x147741[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db['FreshdeskAccount'][_0xe9e5('0x2b')]);_0x147741[_0xe9e5('0x2f')]=_[_0xe9e5('0x30')](_0x10572d[_0xe9e5('0x2f')]);_0x147741['filters']=_['intersection'](_0x147741[_0xe9e5('0x2e')],_0x147741['query']);_0x1601fd[_0xe9e5('0x45')]=_[_0xe9e5('0x32')](_0x147741[_0xe9e5('0x2e')],qs[_0xe9e5('0x33')](_0x10572d[_0xe9e5('0x2f')]['fields']));_0x1601fd[_0xe9e5('0x45')]=_0x1601fd['attributes']['length']?_0x1601fd['attributes']:_0x147741[_0xe9e5('0x2e')];if(_0x10572d[_0xe9e5('0x2f')][_0xe9e5('0x46')]){_0x1601fd[_0xe9e5('0x40')]=[{'all':!![]}];}_0x1601fd=_[_0xe9e5('0x3c')]({},_0x1601fd,_0x10572d[_0xe9e5('0x3e')]);return db[_0xe9e5('0x3f')][_0xe9e5('0x47')](_0x1601fd)['then'](handleEntityNotFound(_0x2bc934,null))[_0xe9e5('0x24')](respondWithResult(_0x2bc934,null))[_0xe9e5('0x42')](handleError(_0x2bc934,null));};exports[_0xe9e5('0x48')]=function(_0x441839,_0x2b785e){return db[_0xe9e5('0x3f')][_0xe9e5('0x48')](_0x441839['body'],{})['then'](respondWithResult(_0x2b785e,0xc9))[_0xe9e5('0x42')](handleError(_0x2b785e,null));};exports['update']=function(_0x1dc5cf,_0x20be8f){if(_0x1dc5cf[_0xe9e5('0x49')]['id']){delete _0x1dc5cf['body']['id'];}return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x1dc5cf[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x20be8f,null))['then'](saveUpdates(_0x1dc5cf[_0xe9e5('0x49')],null))[_0xe9e5('0x24')](respondWithResult(_0x20be8f,null))[_0xe9e5('0x42')](handleError(_0x20be8f,null));};exports[_0xe9e5('0x25')]=function(_0x3f532d,_0x23cee5){return db[_0xe9e5('0x3f')][_0xe9e5('0x47')]({'where':{'id':_0x3f532d[_0xe9e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x23cee5,null))['then'](removeEntity(_0x23cee5,null))[_0xe9e5('0x42')](handleError(_0x23cee5,null));};exports[_0xe9e5('0x4a')]=function(_0x275022,_0x3b673d,_0x219f73){var _0x19ad88={};var _0x42ce27={};var _0x28439f;var _0x47d74b;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x275022[_0xe9e5('0x44')]['id']}})[_0xe9e5('0x24')](handleEntityNotFound(_0x3b673d,null))[_0xe9e5('0x24')](function(_0x198ce0){if(_0x198ce0){_0x28439f=_0x198ce0;_0x42ce27[_0xe9e5('0x2e')]=_[_0xe9e5('0x30')](db[_0xe9e5('0x4b')]['rawAttributes']);_0x42ce27[_0xe9e5('0x2f')]=_['keys'](_0x275022[_0xe9e5('0x2f')]);_0x42ce27[_0xe9e5('0x31')]=_[_0xe9e5('0x32')](_0x42ce27['model'],_0x42ce27[_0xe9e5('0x2f')]);_0x19ad88[_0xe9e5('0x45')]=_['intersection'](_0x42ce27['model'],qs[_0xe9e5('0x33')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x33')]));_0x19ad88[_0xe9e5('0x45')]=_0x19ad88[_0xe9e5('0x45')][_0xe9e5('0x34')]?_0x19ad88[_0xe9e5('0x45')]:_0x42ce27['model'];_0x19ad88[_0xe9e5('0x37')]=qs[_0xe9e5('0x38')](_0x275022[_0xe9e5('0x2f')]['sort']);_0x19ad88[_0xe9e5('0x39')]=qs[_0xe9e5('0x31')](_['pick'](_0x275022[_0xe9e5('0x2f')],_0x42ce27[_0xe9e5('0x31')]));if(_0x275022[_0xe9e5('0x2f')]['filter']){_0x19ad88[_0xe9e5('0x39')]=_[_0xe9e5('0x3c')](_0x19ad88[_0xe9e5('0x39')],{'$or':_[_0xe9e5('0x2a')](_0x19ad88[_0xe9e5('0x45')],function(_0x33ea59){var _0x10b48b={};_0x10b48b[_0x33ea59]={'$like':'%'+_0x275022[_0xe9e5('0x2f')]['filter']+'%'};return _0x10b48b;})});}_0x19ad88=_['merge']({},_0x19ad88,_0x275022[_0xe9e5('0x3e')]);return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})[_0xe9e5('0x24')](function(_0x24e116){if(_0x24e116){_0x47d74b=_0x24e116[_0xe9e5('0x34')];if(!_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x35')]('nolimit')){_0x19ad88[_0xe9e5('0x1d')]=qs[_0xe9e5('0x1d')](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1d')]);_0x19ad88['offset']=qs['offset'](_0x275022[_0xe9e5('0x2f')][_0xe9e5('0x1b')]);}return _0x28439f[_0xe9e5('0x4a')](_0x19ad88);}})['then'](function(_0x49d6bb){if(_0x49d6bb){return _0x49d6bb?{'count':_0x47d74b,'rows':_0x49d6bb}:null;}})['then'](respondWithResult(_0x3b673d,null))[_0xe9e5('0x42')](handleError(_0x3b673d,null));};exports[_0xe9e5('0x4c')]=function(_0x335685,_0x19bcd6,_0x2da8ad){if(_0x335685[_0xe9e5('0x49')]['id']){delete _0x335685[_0xe9e5('0x49')]['id'];}return db['FreshdeskAccount'][_0xe9e5('0x4d')]({'where':{'id':_0x335685['params']['id']}})['then'](handleEntityNotFound(_0x19bcd6,null))[_0xe9e5('0x24')](function(_0x1e3373){if(_0x1e3373){_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4e')]=_0x1e3373['id'];_0x335685[_0xe9e5('0x49')][_0xe9e5('0x4f')]=integrations[_0xe9e5('0x50')](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685['body'][_0xe9e5('0x2d')]);_0x335685[_0xe9e5('0x49')]['Descriptions']=integrations['getDescriptions'](_0x335685[_0xe9e5('0x49')][_0xe9e5('0x51')],_0x335685[_0xe9e5('0x49')][_0xe9e5('0x2d')]);return db[_0xe9e5('0x4b')][_0xe9e5('0x48')](_0x335685[_0xe9e5('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe9e5('0x4f')},{'model':db[_0xe9e5('0x52')],'as':_0xe9e5('0x53')}]});}return null;})[_0xe9e5('0x24')](respondWithResult(_0x19bcd6,null))[_0xe9e5('0x42')](handleError(_0x19bcd6,null));};exports[_0xe9e5('0x54')]=function(_0x15d799,_0x17dcb9,_0x3f655c){var _0x54ba7e='';return db[_0xe9e5('0x3f')]['findOne']({'where':{'id':_0x15d799['params']['id']},'attributes':['id',_0xe9e5('0x55'),'apiKey']})[_0xe9e5('0x24')](handleEntityNotFound(_0x17dcb9,null))[_0xe9e5('0x24')](function(_0x4aa632){if(_0x4aa632){_0x54ba7e=_0x4aa632[_0xe9e5('0x55')];var _0x50ee97=_0x54ba7e[_0xe9e5('0x56')](-0x1);if(_0x50ee97==='/'){_0x54ba7e=_0x54ba7e[_0xe9e5('0x57')](0x0,_0x54ba7e[_0xe9e5('0x58')](_0x50ee97));}return rp({'method':_0xe9e5('0x59'),'uri':util['format'](_0xe9e5('0x5a'),_0x54ba7e,_0xe9e5('0x5b')),'headers':{'Authorization':util[_0xe9e5('0x5c')](_0xe9e5('0x5d'),new Buffer(util['format'](_0xe9e5('0x5e'),_0x4aa632[_0xe9e5('0x5f')]))[_0xe9e5('0x60')]('base64'))},'json':!![]});}})[_0xe9e5('0x24')](function(_0x3b89b2){if(_0x3b89b2){var _0x59c87e=['requester','subject',_0xe9e5('0x61'),_0xe9e5('0x62'),'status',_0xe9e5('0x63'),_0xe9e5('0x64'),_0xe9e5('0x65'),_0xe9e5('0x66'),_0xe9e5('0x64'),'company'];_[_0xe9e5('0x67')](_0x3b89b2,function(_0x500f14){return _0x59c87e[_0xe9e5('0x68')](_0x500f14[_0xe9e5('0x28')])||!_0x500f14[_0xe9e5('0x69')]&&_0x500f14[_0xe9e5('0x2d')]!=='custom_text'&&_0x500f14[_0xe9e5('0x2d')]!==_0xe9e5('0x6a');});return{'count':_0x3b89b2['length'],'rows':_['map'](_0x3b89b2,function(_0x272f6d){return{'id':_0x272f6d[_0xe9e5('0x28')],'name':_0x272f6d[_0xe9e5('0x6b')],'custom':!_0x272f6d[_0xe9e5('0x69')],'options':_0x272f6d['choices']?_[_0xe9e5('0x2a')](_0x272f6d[_0xe9e5('0x6c')],function(_0x2e8bdf){return{'name':_[_0xe9e5('0x6d')](_0x2e8bdf),'value':_0x2e8bdf};}):[]};})};}})[_0xe9e5('0x24')](respondWithResult(_0x17dcb9,null))[_0xe9e5('0x42')](function(_0x26b885){var _0x58302a=_0x15d799[_0xe9e5('0x2f')]['test']?0x1f4:_0x26b885[_0xe9e5('0x6e')]||0x1f4;logger['error'](_0xe9e5('0x6f'),_0xe9e5('0x54'),_0x58302a,JSON['stringify'](_0x26b885));delete _0x26b885[_0xe9e5('0x28')];if(_0x58302a===0x191){_0x58302a=0x190;}_0x17dcb9[_0xe9e5('0x18')](_0x58302a)[_0xe9e5('0x70')](_0x15d799['query'][_0xe9e5('0x71')]?{'message':_0xe9e5('0x72'),'statusCode':_0x26b885[_0xe9e5('0x6e')]}:_0x26b885);});}; \ No newline at end of file +var _0xd87e=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','FreshdeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','toString','base64','requester','subject','agent','description','priority','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0xbdcd4e,_0x17dae4){var _0x196fa3=function(_0x1990d8){while(--_0x1990d8){_0xbdcd4e['push'](_0xbdcd4e['shift']());}};_0x196fa3(++_0x17dae4);}(_0xd87e,0x1bf));var _0xed87=function(_0xeee8f2,_0x351024){_0xeee8f2=_0xeee8f2-0x0;var _0x16102b=_0xd87e[_0xeee8f2];return _0x16102b;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['FreshdeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['FreshdeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57')]})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x48fcc7){if(_0x48fcc7){_0x5136c9=_0x48fcc7[_0xed87('0x56')];var _0x471521=_0x5136c9[_0xed87('0x58')](-0x1);if(_0x471521==='/'){_0x5136c9=_0x5136c9[_0xed87('0x59')](0x0,_0x5136c9[_0xed87('0x5a')](_0x471521));}return rp({'method':_0xed87('0x5b'),'uri':util[_0xed87('0x5c')](_0xed87('0x5d'),_0x5136c9,_0xed87('0x5e')),'headers':{'Authorization':util[_0xed87('0x5c')]('Basic\x20%s',new Buffer(util['format']('%s:X',_0x48fcc7[_0xed87('0x57')]))[_0xed87('0x5f')](_0xed87('0x60')))},'json':!![]});}})[_0xed87('0x3f')](function(_0xb13b0b){if(_0xb13b0b){var _0x57aecd=[_0xed87('0x61'),_0xed87('0x62'),_0xed87('0x63'),_0xed87('0x64'),_0xed87('0x19'),_0xed87('0x65'),'group','source',_0xed87('0x66'),_0xed87('0x67'),_0xed87('0x68')];_[_0xed87('0x69')](_0xb13b0b,function(_0x720d5d){return _0x57aecd[_0xed87('0x6a')](_0x720d5d[_0xed87('0x27')])||!_0x720d5d[_0xed87('0x6b')]&&_0x720d5d[_0xed87('0x2b')]!==_0xed87('0x6c')&&_0x720d5d[_0xed87('0x2b')]!==_0xed87('0x6d');});return{'count':_0xb13b0b['length'],'rows':_[_0xed87('0x2e')](_0xb13b0b,function(_0x1ac999){return{'id':_0x1ac999[_0xed87('0x27')],'name':_0x1ac999[_0xed87('0x6e')],'custom':!_0x1ac999[_0xed87('0x6b')],'options':_0x1ac999[_0xed87('0x6f')]?_['map'](_0x1ac999[_0xed87('0x6f')],function(_0x1b8f9d){return{'name':_[_0xed87('0x70')](_0x1b8f9d),'value':_0x1b8f9d};}):[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))['catch'](function(_0x54277b){var _0x4bfca0=_0x2686cd['query']['test']?0x1f4:_0x54277b[_0xed87('0x71')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x72'),_0xed87('0x55'),_0x4bfca0,JSON[_0xed87('0x73')](_0x54277b));delete _0x54277b[_0xed87('0x27')];if(_0x4bfca0===0x191){_0x4bfca0=0x190;}_0x566ace[_0xed87('0x19')](_0x4bfca0)[_0xed87('0x74')](_0x2686cd[_0xed87('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x54277b[_0xed87('0x71')]}:_0x54277b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9d5fd3a..f5932ce 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 _0x84be=['../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x84be,0x18c));var _0xe84b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x84be[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require(_0xe84b('0x0'));var logger=require(_0xe84b('0x1'))(_0xe84b('0x2'));var moment=require(_0xe84b('0x3'));var BPromise=require(_0xe84b('0x4'));var rp=require(_0xe84b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe84b('0x6'));var config=require(_0xe84b('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xe84b('0x8'));module[_0xe84b('0x9')]=function(_0x1e2d7f,_0x4a9279){return _0x1e2d7f[_0xe84b('0xa')](_0xe84b('0xb'),attributes,{'tableName':_0xe84b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e75=['bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','FreshdeskAccount','int_freshdesk_accounts','api','moment'];(function(_0x3507e,_0x542059){var _0x26e787=function(_0x17def0){while(--_0x17def0){_0x3507e['push'](_0x3507e['shift']());}};_0x26e787(++_0x542059);}(_0x5e75,0x1b7));var _0x55e7=function(_0x196061,_0x5876bc){_0x196061=_0x196061-0x0;var _0x3afb7b=_0x5e75[_0x196061];return _0x3afb7b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x55e7('0x0'));var moment=require(_0x55e7('0x1'));var BPromise=require(_0x55e7('0x2'));var rp=require(_0x55e7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55e7('0x4'));var config=require(_0x55e7('0x5'));var attributes=require(_0x55e7('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x366f1b,_0x12049f){return _0x366f1b['define'](_0x55e7('0x7'),attributes,{'tableName':_0x55e7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index a403007..fa2a79f 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 _0x6d29=['limit','include','map','model','then','GetFreshdeskAccount','stringify','catch','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','FreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0x427444,_0xf966d1){var _0x356dca=function(_0x28b183){while(--_0x28b183){_0x427444['push'](_0x427444['shift']());}};_0x356dca(++_0xf966d1);}(_0x6d29,0x157));var _0x96d2=function(_0x1b0e66,_0x552dce){_0x1b0e66=_0x1b0e66-0x0;var _0x43f2a8=_0x6d29[_0x1b0e66];return _0x43f2a8;};'use strict';var _=require(_0x96d2('0x0'));var util=require(_0x96d2('0x1'));var moment=require('moment');var BPromise=require(_0x96d2('0x2'));var rs=require(_0x96d2('0x3'));var fs=require('fs');var Redis=require(_0x96d2('0x4'));var db=require(_0x96d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x96d2('0x6'))(_0x96d2('0x7'));var config=require(_0x96d2('0x8'));var jayson=require(_0x96d2('0x9'));var client=jayson['client'][_0x96d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e2ebe,_0x5d1b93,_0x2cf6d4){return new BPromise(function(_0x2cae71,_0x4794b0){return client[_0x96d2('0xb')](_0x4e2ebe,_0x2cf6d4)['then'](function(_0xbcd84c){logger[_0x96d2('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x5d1b93,_0x96d2('0xd'));logger[_0x96d2('0xe')](_0x96d2('0xf'),_0x5d1b93,'request\x20sent',JSON['stringify'](_0xbcd84c));if(_0xbcd84c[_0x96d2('0x10')]){if(_0xbcd84c[_0x96d2('0x10')][_0x96d2('0x11')]===0x1f4){logger[_0x96d2('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5d1b93,_0xbcd84c['error'][_0x96d2('0x12')]);return _0x4794b0(_0xbcd84c[_0x96d2('0x10')][_0x96d2('0x12')]);}logger[_0x96d2('0x10')](_0x96d2('0x13'),_0x5d1b93,_0xbcd84c[_0x96d2('0x10')][_0x96d2('0x12')]);return _0x2cae71(_0xbcd84c['error']['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x5d1b93,'request\x20sent');_0x2cae71(_0xbcd84c[_0x96d2('0x14')][_0x96d2('0x12')]);}})['catch'](function(_0x55042f){logger[_0x96d2('0x10')](_0x96d2('0x13'),_0x5d1b93,_0x55042f);_0x4794b0(_0x55042f);});});}exports['GetFreshdeskAccount']=function(_0x3af18b){var _0x317f8a=this;return new Promise(function(_0x5b69b9,_0x32282d){return db[_0x96d2('0x15')][_0x96d2('0x16')]({'raw':_0x3af18b[_0x96d2('0x17')]?_0x3af18b[_0x96d2('0x17')][_0x96d2('0x18')]===undefined?!![]:![]:!![],'where':_0x3af18b[_0x96d2('0x17')]?_0x3af18b[_0x96d2('0x17')][_0x96d2('0x19')]||null:null,'attributes':_0x3af18b[_0x96d2('0x17')]?_0x3af18b[_0x96d2('0x17')][_0x96d2('0x1a')]||null:null,'limit':_0x3af18b[_0x96d2('0x17')]?_0x3af18b['options'][_0x96d2('0x1b')]||null:null,'include':_0x3af18b['options']?_0x3af18b[_0x96d2('0x17')][_0x96d2('0x1c')]?_[_0x96d2('0x1d')](_0x3af18b[_0x96d2('0x17')][_0x96d2('0x1c')],function(_0x2cf49f){return{'model':db[_0x2cf49f[_0x96d2('0x1e')]],'as':_0x2cf49f['as'],'attributes':_0x2cf49f[_0x96d2('0x1a')],'include':_0x2cf49f['include']?_[_0x96d2('0x1d')](_0x2cf49f[_0x96d2('0x1c')],function(_0x94c9f7){return{'model':db[_0x94c9f7[_0x96d2('0x1e')]],'as':_0x94c9f7['as'],'attributes':_0x94c9f7[_0x96d2('0x1a')],'include':_0x94c9f7[_0x96d2('0x1c')]?_[_0x96d2('0x1d')](_0x94c9f7[_0x96d2('0x1c')],function(_0x18cbc9){return{'model':db[_0x18cbc9[_0x96d2('0x1e')]],'as':_0x18cbc9['as'],'attributes':_0x18cbc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x96d2('0x1f')](function(_0x1b136f){logger[_0x96d2('0xc')]('GetFreshdeskAccount',_0x3af18b);logger['debug'](_0x96d2('0x20'),_0x3af18b,JSON[_0x96d2('0x21')](_0x1b136f));_0x5b69b9(_0x1b136f);})[_0x96d2('0x22')](function(_0x5aa50c){logger['error'](_0x96d2('0x20'),_0x5aa50c[_0x96d2('0x12')],_0x3af18b);_0x32282d(_0x317f8a[_0x96d2('0x10')](0x1f4,_0x5aa50c[_0x96d2('0x12')]));});});};exports[_0x96d2('0x23')]=function(_0x39f80a){var _0x45a44e=this;return new Promise(function(_0xbfc85b,_0x2649ba){return db[_0x96d2('0x15')][_0x96d2('0x24')]({'raw':_0x39f80a[_0x96d2('0x17')]?_0x39f80a[_0x96d2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x39f80a[_0x96d2('0x17')]?_0x39f80a[_0x96d2('0x17')]['where']||null:null,'attributes':_0x39f80a[_0x96d2('0x17')]?_0x39f80a[_0x96d2('0x17')][_0x96d2('0x1a')]||null:null,'include':_0x39f80a[_0x96d2('0x17')]?_0x39f80a[_0x96d2('0x17')][_0x96d2('0x1c')]?_[_0x96d2('0x1d')](_0x39f80a[_0x96d2('0x17')][_0x96d2('0x1c')],function(_0x556823){return{'model':db[_0x556823['model']],'as':_0x556823['as'],'attributes':_0x556823['attributes'],'include':_0x556823['include']?_['map'](_0x556823[_0x96d2('0x1c')],function(_0x403951){return{'model':db[_0x403951[_0x96d2('0x1e')]],'as':_0x403951['as'],'attributes':_0x403951[_0x96d2('0x1a')],'include':_0x403951[_0x96d2('0x1c')]?_[_0x96d2('0x1d')](_0x403951[_0x96d2('0x1c')],function(_0x190974){return{'model':db[_0x190974[_0x96d2('0x1e')]],'as':_0x190974['as'],'attributes':_0x190974['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f297b){logger[_0x96d2('0xc')](_0x96d2('0x23'),_0x39f80a);logger[_0x96d2('0xe')]('ShowFreshdeskAccount',_0x39f80a,JSON['stringify'](_0x4f297b));_0xbfc85b(_0x4f297b);})[_0x96d2('0x22')](function(_0x2a83e9){logger[_0x96d2('0x10')](_0x96d2('0x23'),_0x2a83e9[_0x96d2('0x12')],_0x39f80a);_0x2649ba(_0x45a44e[_0x96d2('0x10')](0x1f4,_0x2a83e9[_0x96d2('0x12')]));});});}; \ No newline at end of file +var _0xd1c5=['model','ShowFreshdeskAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x4413cf,_0x3f70e8){var _0x9a1479=function(_0x5b4b2b){while(--_0x5b4b2b){_0x4413cf['push'](_0x4413cf['shift']());}};_0x9a1479(++_0x3f70e8);}(_0xd1c5,0x18f));var _0x5d1c=function(_0x2e2d2d,_0x1a9d6b){_0x2e2d2d=_0x2e2d2d-0x0;var _0x424f97=_0xd1c5[_0x2e2d2d];return _0x424f97;};'use strict';var _=require(_0x5d1c('0x0'));var util=require(_0x5d1c('0x1'));var moment=require('moment');var BPromise=require(_0x5d1c('0x2'));var rs=require(_0x5d1c('0x3'));var fs=require('fs');var Redis=require(_0x5d1c('0x4'));var db=require(_0x5d1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d1c('0x6'))(_0x5d1c('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d1c('0x8'));var client=jayson[_0x5d1c('0x9')][_0x5d1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d5255,_0x4535fc,_0x1a1081){return new BPromise(function(_0x2edd7b,_0x52c8d8){return client[_0x5d1c('0xb')](_0x2d5255,_0x1a1081)[_0x5d1c('0xc')](function(_0x3b0b83){logger[_0x5d1c('0xd')](_0x5d1c('0xe'),_0x4535fc,_0x5d1c('0xf'));logger[_0x5d1c('0x10')](_0x5d1c('0x11'),_0x4535fc,_0x5d1c('0xf'),JSON[_0x5d1c('0x12')](_0x3b0b83));if(_0x3b0b83[_0x5d1c('0x13')]){if(_0x3b0b83['error'][_0x5d1c('0x14')]===0x1f4){logger[_0x5d1c('0x13')](_0x5d1c('0xe'),_0x4535fc,_0x3b0b83[_0x5d1c('0x13')]['message']);return _0x52c8d8(_0x3b0b83[_0x5d1c('0x13')][_0x5d1c('0x15')]);}logger[_0x5d1c('0x13')](_0x5d1c('0xe'),_0x4535fc,_0x3b0b83[_0x5d1c('0x13')][_0x5d1c('0x15')]);return _0x2edd7b(_0x3b0b83['error'][_0x5d1c('0x15')]);}else{logger[_0x5d1c('0xd')](_0x5d1c('0xe'),_0x4535fc,'request\x20sent');_0x2edd7b(_0x3b0b83[_0x5d1c('0x16')]['message']);}})['catch'](function(_0x5c108c){logger[_0x5d1c('0x13')](_0x5d1c('0xe'),_0x4535fc,_0x5c108c);_0x52c8d8(_0x5c108c);});});}exports[_0x5d1c('0x17')]=function(_0x34a958){var _0x243c5a=this;return new Promise(function(_0x225651,_0x59c085){return db[_0x5d1c('0x18')][_0x5d1c('0x19')]({'raw':_0x34a958[_0x5d1c('0x1a')]?_0x34a958[_0x5d1c('0x1a')][_0x5d1c('0x1b')]===undefined?!![]:![]:!![],'where':_0x34a958[_0x5d1c('0x1a')]?_0x34a958[_0x5d1c('0x1a')][_0x5d1c('0x1c')]||null:null,'attributes':_0x34a958['options']?_0x34a958[_0x5d1c('0x1a')][_0x5d1c('0x1d')]||null:null,'limit':_0x34a958['options']?_0x34a958['options'][_0x5d1c('0x1e')]||null:null,'include':_0x34a958[_0x5d1c('0x1a')]?_0x34a958['options'][_0x5d1c('0x1f')]?_[_0x5d1c('0x20')](_0x34a958['options'][_0x5d1c('0x1f')],function(_0x1a26df){return{'model':db[_0x1a26df['model']],'as':_0x1a26df['as'],'attributes':_0x1a26df['attributes'],'include':_0x1a26df[_0x5d1c('0x1f')]?_[_0x5d1c('0x20')](_0x1a26df[_0x5d1c('0x1f')],function(_0x6015af){return{'model':db[_0x6015af[_0x5d1c('0x21')]],'as':_0x6015af['as'],'attributes':_0x6015af[_0x5d1c('0x1d')],'include':_0x6015af[_0x5d1c('0x1f')]?_[_0x5d1c('0x20')](_0x6015af['include'],function(_0x5bb6d8){return{'model':db[_0x5bb6d8[_0x5d1c('0x21')]],'as':_0x5bb6d8['as'],'attributes':_0x5bb6d8[_0x5d1c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5d1c('0xc')](function(_0x307fcd){logger['info']('GetFreshdeskAccount',_0x34a958);logger[_0x5d1c('0x10')]('GetFreshdeskAccount',_0x34a958,JSON[_0x5d1c('0x12')](_0x307fcd));_0x225651(_0x307fcd);})['catch'](function(_0x1d5ff2){logger['error']('GetFreshdeskAccount',_0x1d5ff2[_0x5d1c('0x15')],_0x34a958);_0x59c085(_0x243c5a[_0x5d1c('0x13')](0x1f4,_0x1d5ff2[_0x5d1c('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x62ecd3){var _0x297e2e=this;return new Promise(function(_0x18572c,_0x3e46fc){return db[_0x5d1c('0x18')]['find']({'raw':_0x62ecd3[_0x5d1c('0x1a')]?_0x62ecd3['options'][_0x5d1c('0x1b')]===undefined?!![]:![]:!![],'where':_0x62ecd3[_0x5d1c('0x1a')]?_0x62ecd3[_0x5d1c('0x1a')][_0x5d1c('0x1c')]||null:null,'attributes':_0x62ecd3['options']?_0x62ecd3['options'][_0x5d1c('0x1d')]||null:null,'include':_0x62ecd3['options']?_0x62ecd3['options']['include']?_[_0x5d1c('0x20')](_0x62ecd3[_0x5d1c('0x1a')]['include'],function(_0x48fccb){return{'model':db[_0x48fccb['model']],'as':_0x48fccb['as'],'attributes':_0x48fccb[_0x5d1c('0x1d')],'include':_0x48fccb[_0x5d1c('0x1f')]?_[_0x5d1c('0x20')](_0x48fccb[_0x5d1c('0x1f')],function(_0x52abd1){return{'model':db[_0x52abd1['model']],'as':_0x52abd1['as'],'attributes':_0x52abd1[_0x5d1c('0x1d')],'include':_0x52abd1[_0x5d1c('0x1f')]?_['map'](_0x52abd1['include'],function(_0xf2d482){return{'model':db[_0xf2d482['model']],'as':_0xf2d482['as'],'attributes':_0xf2d482['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d1c('0xc')](function(_0x1904f6){logger[_0x5d1c('0xd')](_0x5d1c('0x22'),_0x62ecd3);logger[_0x5d1c('0x10')](_0x5d1c('0x22'),_0x62ecd3,JSON[_0x5d1c('0x12')](_0x1904f6));_0x18572c(_0x1904f6);})[_0x5d1c('0x23')](function(_0xd92d3){logger[_0x5d1c('0x13')](_0x5d1c('0x22'),_0xd92d3[_0x5d1c('0x15')],_0x62ecd3);_0x3e46fc(_0x297e2e[_0x5d1c('0x13')](0x1f4,_0xd92d3['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9f0832f..b43b5a8 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 _0x8c9f=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','update','delete','destroy','exports','multer'];(function(_0x11abc5,_0x3f4663){var _0x31fc2b=function(_0x46b09a){while(--_0x46b09a){_0x11abc5['push'](_0x11abc5['shift']());}};_0x31fc2b(++_0x3f4663);}(_0x8c9f,0x133));var _0xf8c9=function(_0x14b69e,_0xbcb34c){_0x14b69e=_0x14b69e-0x0;var _0x5525ae=_0x8c9f[_0x14b69e];return _0x5525ae;};'use strict';var multer=require(_0xf8c9('0x0'));var util=require(_0xf8c9('0x1'));var path=require(_0xf8c9('0x2'));var timeout=require(_0xf8c9('0x3'));var express=require(_0xf8c9('0x4'));var router=express['Router']();var fs_extra=require(_0xf8c9('0x5'));var auth=require(_0xf8c9('0x6'));var interaction=require(_0xf8c9('0x7'));var config=require(_0xf8c9('0x8'));var controller=require(_0xf8c9('0x9'));router[_0xf8c9('0xa')]('/',auth[_0xf8c9('0xb')](),controller['index']);router[_0xf8c9('0xa')](_0xf8c9('0xc'),auth[_0xf8c9('0xb')](),controller[_0xf8c9('0xd')]);router[_0xf8c9('0xa')](_0xf8c9('0xe'),auth['isAuthenticated'](),controller[_0xf8c9('0xf')]);router['get'](_0xf8c9('0x10'),auth[_0xf8c9('0xb')](),controller[_0xf8c9('0x11')]);router[_0xf8c9('0xa')](_0xf8c9('0x12'),auth[_0xf8c9('0xb')](),controller[_0xf8c9('0x13')]);router[_0xf8c9('0xa')](_0xf8c9('0x14'),auth[_0xf8c9('0xb')](),controller[_0xf8c9('0x15')]);router[_0xf8c9('0x16')]('/',auth[_0xf8c9('0xb')](),controller['create']);router[_0xf8c9('0x16')](_0xf8c9('0x14'),auth['isAuthenticated'](),controller['setTags']);router[_0xf8c9('0x17')]('/:id',auth[_0xf8c9('0xb')](),controller[_0xf8c9('0x18')]);router[_0xf8c9('0x19')]('/:id',auth[_0xf8c9('0xb')](),controller[_0xf8c9('0x1a')]);module[_0xf8c9('0x1b')]=router; \ No newline at end of file +var _0xed63=['setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0xed63,0x14b));var _0x3ed6=function(_0x496b68,_0x3b0803){_0x496b68=_0x496b68-0x0;var _0x2d8693=_0xed63[_0x496b68];return _0x2d8693;};'use strict';var multer=require(_0x3ed6('0x0'));var util=require(_0x3ed6('0x1'));var path=require('path');var timeout=require(_0x3ed6('0x2'));var express=require('express');var router=express[_0x3ed6('0x3')]();var fs_extra=require(_0x3ed6('0x4'));var auth=require(_0x3ed6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ed6('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x3ed6('0x7')]('/',auth[_0x3ed6('0x8')](),controller[_0x3ed6('0x9')]);router[_0x3ed6('0x7')](_0x3ed6('0xa'),auth[_0x3ed6('0x8')](),controller[_0x3ed6('0xb')]);router[_0x3ed6('0x7')]('/:id/fields',auth[_0x3ed6('0x8')](),controller[_0x3ed6('0xc')]);router[_0x3ed6('0x7')](_0x3ed6('0xd'),auth['isAuthenticated'](),controller[_0x3ed6('0xe')]);router[_0x3ed6('0x7')]('/:id/descriptions',auth[_0x3ed6('0x8')](),controller[_0x3ed6('0xf')]);router['get'](_0x3ed6('0x10'),auth[_0x3ed6('0x8')](),controller['getTags']);router[_0x3ed6('0x11')]('/',auth[_0x3ed6('0x8')](),controller[_0x3ed6('0x12')]);router[_0x3ed6('0x11')](_0x3ed6('0x10'),auth[_0x3ed6('0x8')](),controller[_0x3ed6('0x13')]);router[_0x3ed6('0x14')](_0x3ed6('0xa'),auth[_0x3ed6('0x8')](),controller[_0x3ed6('0x15')]);router[_0x3ed6('0x16')]('/:id',auth[_0x3ed6('0x8')](),controller[_0x3ed6('0x17')]);module[_0x3ed6('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 66e9dcc..6340d4e 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 _0xd8e7=['sequelize','exports'];(function(_0x4745d6,_0x3e49ea){var _0x3432c1=function(_0x5d637e){while(--_0x5d637e){_0x4745d6['push'](_0x4745d6['shift']());}};_0x3432c1(++_0x3e49ea);}(_0xd8e7,0x86));var _0x7d8e=function(_0x37c990,_0x4d43a5){_0x37c990=_0x37c990-0x0;var _0x1f1012=_0xd8e7[_0x37c990];return _0x1f1012;};'use strict';var Sequelize=require(_0x7d8e('0x0'));module[_0x7d8e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x659c=['STRING','sequelize','exports'];(function(_0x1dc863,_0x5ad75f){var _0x2f13a0=function(_0xdc7735){while(--_0xdc7735){_0x1dc863['push'](_0x1dc863['shift']());}};_0x2f13a0(++_0x5ad75f);}(_0x659c,0xb8));var _0xc659=function(_0x315861,_0x735b4){_0x315861=_0x315861-0x0;var _0x3e2b76=_0x659c[_0x315861];return _0x3e2b76;};'use strict';var Sequelize=require(_0xc659('0x0'));module[_0xc659('0x1')]={'name':{'type':Sequelize[_0xc659('0x2')]},'description':{'type':Sequelize[_0xc659('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7fe4238..7b6b800 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 _0x9b87=['map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','FreshdeskConfiguration','includeAll','show','length','include','find','catch','create','body','params','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','save','update','destroy','then','stack','name','send','index'];(function(_0x678fa7,_0x3728e1){var _0x57329b=function(_0x553ffc){while(--_0x553ffc){_0x678fa7['push'](_0x678fa7['shift']());}};_0x57329b(++_0x3728e1);}(_0x9b87,0x11a));var _0x79b8=function(_0x512738,_0x52ef6b){_0x512738=_0x512738-0x0;var _0x1bdb2b=_0x9b87[_0x512738];return _0x1bdb2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x79b8('0x0'));var zipdir=require(_0x79b8('0x1'));var jsonpatch=require(_0x79b8('0x2'));var rp=require(_0x79b8('0x3'));var moment=require(_0x79b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x79b8('0x5'));var util=require(_0x79b8('0x6'));var path=require(_0x79b8('0x7'));var sox=require(_0x79b8('0x8'));var csv=require('to-csv');var ejs=require(_0x79b8('0x9'));var fs=require('fs');var fs_extra=require(_0x79b8('0xa'));var _=require(_0x79b8('0xb'));var squel=require(_0x79b8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0xd'));var Papa=require(_0x79b8('0xe'));var Redis=require('ioredis');var authService=require(_0x79b8('0xf'));var qs=require(_0x79b8('0x10'));var as=require(_0x79b8('0x11'));var hardwareService=require(_0x79b8('0x12'));var logger=require('../../config/logger')(_0x79b8('0x13'));var utils=require(_0x79b8('0x14'));var config=require(_0x79b8('0x15'));var licenseUtil=require(_0x79b8('0x16'));var db=require(_0x79b8('0x17'))['db'];function respondWithStatusCode(_0x5240b5,_0x1bbdc2){_0x1bbdc2=_0x1bbdc2||0xcc;return function(_0x1d3494){if(_0x1d3494){return _0x5240b5[_0x79b8('0x18')](_0x1bbdc2);}return _0x5240b5['status'](_0x1bbdc2)[_0x79b8('0x19')]();};}function respondWithResult(_0x28db3e,_0xd1720e){_0xd1720e=_0xd1720e||0xc8;return function(_0x57d235){if(_0x57d235){return _0x28db3e[_0x79b8('0x1a')](_0xd1720e)['json'](_0x57d235);}};}function respondWithFilteredResult(_0x5880b2,_0x3d4c55){return function(_0x2d402a){if(_0x2d402a){var _0x4130c7=typeof _0x3d4c55[_0x79b8('0x1b')]==='undefined'&&typeof _0x3d4c55[_0x79b8('0x1c')]===_0x79b8('0x1d');var _0x13a8b0=_0x2d402a[_0x79b8('0x1e')];var _0x31e278=_0x4130c7?0x0:_0x3d4c55[_0x79b8('0x1b')];var _0x116730=_0x4130c7?_0x2d402a[_0x79b8('0x1e')]:_0x3d4c55[_0x79b8('0x1b')]+_0x3d4c55['limit'];var _0x35e738;if(_0x116730>=_0x13a8b0){_0x116730=_0x13a8b0;_0x35e738=0xc8;}else{_0x35e738=0xce;}_0x5880b2['status'](_0x35e738);return _0x5880b2[_0x79b8('0x1f')](_0x79b8('0x20'),_0x31e278+'-'+_0x116730+'/'+_0x13a8b0)[_0x79b8('0x21')](_0x2d402a);}return null;};}function patchUpdates(_0x44d3e2){return function(_0x52d242){try{jsonpatch['apply'](_0x52d242,_0x44d3e2,!![]);}catch(_0x56f653){return BPromise['reject'](_0x56f653);}return _0x52d242[_0x79b8('0x22')]();};}function saveUpdates(_0x25da02,_0x2c4ad5){return function(_0x4f470d){if(_0x4f470d){return _0x4f470d[_0x79b8('0x23')](_0x25da02)['then'](function(_0x6ad2c2){return _0x6ad2c2;});}return null;};}function removeEntity(_0x41bd44,_0x30c98d){return function(_0x3b85ed){if(_0x3b85ed){return _0x3b85ed[_0x79b8('0x24')]()[_0x79b8('0x25')](function(){_0x41bd44[_0x79b8('0x1a')](0xcc)[_0x79b8('0x19')]();});}};}function handleEntityNotFound(_0x152995,_0x47594d){return function(_0xca99d7){if(!_0xca99d7){_0x152995['sendStatus'](0x194);}return _0xca99d7;};}function handleError(_0x2bd77c,_0x4e71bf){_0x4e71bf=_0x4e71bf||0x1f4;return function(_0x4b9ced){logger['error'](_0x4b9ced[_0x79b8('0x26')]);if(_0x4b9ced[_0x79b8('0x27')]){delete _0x4b9ced[_0x79b8('0x27')];}_0x2bd77c[_0x79b8('0x1a')](_0x4e71bf)[_0x79b8('0x28')](_0x4b9ced);};}exports[_0x79b8('0x29')]=function(_0x2fd102,_0x2b0d72){var _0x2c3b8a={},_0x1f99bf={},_0x366966={'count':0x0,'rows':[]};var _0x25b7d6=_[_0x79b8('0x2a')](db['FreshdeskConfiguration'][_0x79b8('0x2b')],function(_0x3f24a7){return{'name':_0x3f24a7[_0x79b8('0x2c')],'type':_0x3f24a7['type'][_0x79b8('0x2d')]};});_0x1f99bf[_0x79b8('0x2e')]=_[_0x79b8('0x2a')](_0x25b7d6,_0x79b8('0x27'));_0x1f99bf['query']=_[_0x79b8('0x2f')](_0x2fd102[_0x79b8('0x30')]);_0x1f99bf[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x1f99bf[_0x79b8('0x2e')],_0x1f99bf[_0x79b8('0x30')]);_0x2c3b8a['attributes']=_['intersection'](_0x1f99bf['model'],qs[_0x79b8('0x33')](_0x2fd102[_0x79b8('0x30')][_0x79b8('0x33')]));_0x2c3b8a[_0x79b8('0x34')]=_0x2c3b8a[_0x79b8('0x34')]['length']?_0x2c3b8a[_0x79b8('0x34')]:_0x1f99bf['model'];if(!_0x2fd102[_0x79b8('0x30')][_0x79b8('0x35')](_0x79b8('0x36'))){_0x2c3b8a[_0x79b8('0x1c')]=qs['limit'](_0x2fd102[_0x79b8('0x30')][_0x79b8('0x1c')]);_0x2c3b8a[_0x79b8('0x1b')]=qs['offset'](_0x2fd102[_0x79b8('0x30')][_0x79b8('0x1b')]);}_0x2c3b8a[_0x79b8('0x37')]=qs['sort'](_0x2fd102['query'][_0x79b8('0x38')]);_0x2c3b8a[_0x79b8('0x39')]=qs[_0x79b8('0x31')](_['pick'](_0x2fd102[_0x79b8('0x30')],_0x1f99bf[_0x79b8('0x31')]),_0x25b7d6);if(_0x2fd102[_0x79b8('0x30')][_0x79b8('0x3a')]){_0x2c3b8a[_0x79b8('0x39')]=_['merge'](_0x2c3b8a[_0x79b8('0x39')],{'$or':_[_0x79b8('0x2a')](_0x25b7d6,function(_0x145967){if(_0x145967[_0x79b8('0x3b')]!==_0x79b8('0x3c')){var _0x14bfb3={};_0x14bfb3[_0x145967['name']]={'$like':'%'+_0x2fd102['query']['filter']+'%'};return _0x14bfb3;}})});}_0x2c3b8a=_[_0x79b8('0x3d')]({},_0x2c3b8a,_0x2fd102[_0x79b8('0x3e')]);var _0x28c1cc={'where':_0x2c3b8a[_0x79b8('0x39')]};return db[_0x79b8('0x3f')][_0x79b8('0x1e')](_0x28c1cc)['then'](function(_0x37a498){_0x366966[_0x79b8('0x1e')]=_0x37a498;if(_0x2fd102[_0x79b8('0x30')][_0x79b8('0x40')]){_0x2c3b8a['include']=[{'all':!![]}];}return db[_0x79b8('0x3f')]['findAll'](_0x2c3b8a);})[_0x79b8('0x25')](function(_0x44a3f2){_0x366966['rows']=_0x44a3f2;return _0x366966;})[_0x79b8('0x25')](respondWithFilteredResult(_0x2b0d72,_0x2c3b8a))['catch'](handleError(_0x2b0d72,null));};exports[_0x79b8('0x41')]=function(_0x368b58,_0x584417){var _0x12a83a={'raw':![],'where':{'id':_0x368b58['params']['id']}},_0x1d246c={};_0x1d246c[_0x79b8('0x2e')]=_[_0x79b8('0x2f')](db[_0x79b8('0x3f')][_0x79b8('0x2b')]);_0x1d246c[_0x79b8('0x30')]=_[_0x79b8('0x2f')](_0x368b58[_0x79b8('0x30')]);_0x1d246c['filters']=_['intersection'](_0x1d246c[_0x79b8('0x2e')],_0x1d246c[_0x79b8('0x30')]);_0x12a83a['attributes']=_['intersection'](_0x1d246c[_0x79b8('0x2e')],qs[_0x79b8('0x33')](_0x368b58[_0x79b8('0x30')]['fields']));_0x12a83a[_0x79b8('0x34')]=_0x12a83a['attributes'][_0x79b8('0x42')]?_0x12a83a[_0x79b8('0x34')]:_0x1d246c[_0x79b8('0x2e')];if(_0x368b58[_0x79b8('0x30')][_0x79b8('0x40')]){_0x12a83a[_0x79b8('0x43')]=[{'all':!![]}];}_0x12a83a=_[_0x79b8('0x3d')]({},_0x12a83a,_0x368b58[_0x79b8('0x3e')]);return db[_0x79b8('0x3f')][_0x79b8('0x44')](_0x12a83a)['then'](handleEntityNotFound(_0x584417,null))[_0x79b8('0x25')](respondWithResult(_0x584417,null))[_0x79b8('0x45')](handleError(_0x584417,null));};exports[_0x79b8('0x46')]=function(_0x51247e,_0x31de78){return db[_0x79b8('0x3f')][_0x79b8('0x46')](_0x51247e[_0x79b8('0x47')],{})[_0x79b8('0x25')](respondWithResult(_0x31de78,0xc9))[_0x79b8('0x45')](handleError(_0x31de78,null));};exports[_0x79b8('0x23')]=function(_0x252a1f,_0x3f7cdf){if(_0x252a1f['body']['id']){delete _0x252a1f['body']['id'];}return db['FreshdeskConfiguration'][_0x79b8('0x44')]({'where':{'id':_0x252a1f['params']['id']}})[_0x79b8('0x25')](handleEntityNotFound(_0x3f7cdf,null))[_0x79b8('0x25')](saveUpdates(_0x252a1f['body'],null))['then'](respondWithResult(_0x3f7cdf,null))[_0x79b8('0x45')](handleError(_0x3f7cdf,null));};exports[_0x79b8('0x24')]=function(_0x3ff0d1,_0x49b713){return db[_0x79b8('0x3f')][_0x79b8('0x44')]({'where':{'id':_0x3ff0d1[_0x79b8('0x48')]['id']}})[_0x79b8('0x25')](handleEntityNotFound(_0x49b713,null))[_0x79b8('0x25')](removeEntity(_0x49b713,null))['catch'](handleError(_0x49b713,null));};exports[_0x79b8('0x49')]=function(_0x27bc53,_0x3c376b,_0x416979){var _0x146081={};var _0x37d1df={};var _0x4a8abe;var _0x1e74a4;return db[_0x79b8('0x3f')][_0x79b8('0x4a')]({'where':{'id':_0x27bc53['params']['id']}})[_0x79b8('0x25')](handleEntityNotFound(_0x3c376b,null))[_0x79b8('0x25')](function(_0x38852b){if(_0x38852b){_0x4a8abe=_0x38852b;_0x37d1df['model']=_[_0x79b8('0x2f')](db[_0x79b8('0x4b')][_0x79b8('0x2b')]);_0x37d1df['query']=_['keys'](_0x27bc53[_0x79b8('0x30')]);_0x37d1df['filters']=_[_0x79b8('0x32')](_0x37d1df[_0x79b8('0x2e')],_0x37d1df['query']);_0x146081[_0x79b8('0x34')]=_['intersection'](_0x37d1df[_0x79b8('0x2e')],qs[_0x79b8('0x33')](_0x27bc53[_0x79b8('0x30')]['fields']));_0x146081[_0x79b8('0x34')]=_0x146081[_0x79b8('0x34')]['length']?_0x146081[_0x79b8('0x34')]:_0x37d1df['model'];_0x146081[_0x79b8('0x37')]=qs['sort'](_0x27bc53[_0x79b8('0x30')][_0x79b8('0x38')]);_0x146081[_0x79b8('0x39')]=qs[_0x79b8('0x31')](_[_0x79b8('0x4c')](_0x27bc53['query'],_0x37d1df[_0x79b8('0x31')]));if(_0x27bc53[_0x79b8('0x30')][_0x79b8('0x3a')]){_0x146081[_0x79b8('0x39')]=_[_0x79b8('0x3d')](_0x146081['where'],{'$or':_['map'](_0x146081[_0x79b8('0x34')],function(_0x48636b){var _0x3e3a40={};_0x3e3a40[_0x48636b]={'$like':'%'+_0x27bc53[_0x79b8('0x30')][_0x79b8('0x3a')]+'%'};return _0x3e3a40;})});}_0x146081=_[_0x79b8('0x3d')]({},_0x146081,_0x27bc53[_0x79b8('0x3e')]);return _0x4a8abe[_0x79b8('0x49')](_0x146081);}})[_0x79b8('0x25')](function(_0x3ffca0){if(_0x3ffca0){_0x1e74a4=_0x3ffca0[_0x79b8('0x42')];if(!_0x27bc53[_0x79b8('0x30')][_0x79b8('0x35')](_0x79b8('0x36'))){_0x146081[_0x79b8('0x1c')]=qs[_0x79b8('0x1c')](_0x27bc53[_0x79b8('0x30')][_0x79b8('0x1c')]);_0x146081[_0x79b8('0x1b')]=qs[_0x79b8('0x1b')](_0x27bc53['query'][_0x79b8('0x1b')]);}return _0x4a8abe[_0x79b8('0x49')](_0x146081);}})[_0x79b8('0x25')](function(_0x2ab553){if(_0x2ab553){return _0x2ab553?{'count':_0x1e74a4,'rows':_0x2ab553}:null;}})['then'](respondWithResult(_0x3c376b,null))['catch'](handleError(_0x3c376b,null));};exports[_0x79b8('0x4d')]=function(_0x4b532d,_0x50f9a0,_0x288558){var _0x52ebe0={};var _0xde2074={};var _0x481468;var _0x1e7cc3;return db[_0x79b8('0x3f')][_0x79b8('0x4a')]({'where':{'id':_0x4b532d['params']['id']}})[_0x79b8('0x25')](handleEntityNotFound(_0x50f9a0,null))[_0x79b8('0x25')](function(_0x2d0673){if(_0x2d0673){_0x481468=_0x2d0673;_0xde2074[_0x79b8('0x2e')]=_[_0x79b8('0x2f')](db[_0x79b8('0x4b')]['rawAttributes']);_0xde2074[_0x79b8('0x30')]=_[_0x79b8('0x2f')](_0x4b532d['query']);_0xde2074['filters']=_[_0x79b8('0x32')](_0xde2074['model'],_0xde2074['query']);_0x52ebe0[_0x79b8('0x34')]=_['intersection'](_0xde2074['model'],qs[_0x79b8('0x33')](_0x4b532d[_0x79b8('0x30')][_0x79b8('0x33')]));_0x52ebe0[_0x79b8('0x34')]=_0x52ebe0[_0x79b8('0x34')][_0x79b8('0x42')]?_0x52ebe0[_0x79b8('0x34')]:_0xde2074[_0x79b8('0x2e')];_0x52ebe0[_0x79b8('0x37')]=qs[_0x79b8('0x38')](_0x4b532d[_0x79b8('0x30')][_0x79b8('0x38')]);_0x52ebe0[_0x79b8('0x39')]=qs['filters'](_[_0x79b8('0x4c')](_0x4b532d[_0x79b8('0x30')],_0xde2074['filters']));if(_0x4b532d[_0x79b8('0x30')][_0x79b8('0x3a')]){_0x52ebe0[_0x79b8('0x39')]=_['merge'](_0x52ebe0['where'],{'$or':_[_0x79b8('0x2a')](_0x52ebe0[_0x79b8('0x34')],function(_0x2b63a6){var _0x2f23d8={};_0x2f23d8[_0x2b63a6]={'$like':'%'+_0x4b532d['query']['filter']+'%'};return _0x2f23d8;})});}_0x52ebe0=_[_0x79b8('0x3d')]({},_0x52ebe0,_0x4b532d[_0x79b8('0x3e')]);return _0x481468[_0x79b8('0x4d')](_0x52ebe0);}})[_0x79b8('0x25')](function(_0x31af2f){if(_0x31af2f){_0x1e7cc3=_0x31af2f[_0x79b8('0x42')];if(!_0x4b532d[_0x79b8('0x30')]['hasOwnProperty'](_0x79b8('0x36'))){_0x52ebe0[_0x79b8('0x1c')]=qs['limit'](_0x4b532d['query'][_0x79b8('0x1c')]);_0x52ebe0[_0x79b8('0x1b')]=qs[_0x79b8('0x1b')](_0x4b532d[_0x79b8('0x30')][_0x79b8('0x1b')]);}return _0x481468[_0x79b8('0x4d')](_0x52ebe0);}})[_0x79b8('0x25')](function(_0x33a10a){if(_0x33a10a){return _0x33a10a?{'count':_0x1e7cc3,'rows':_0x33a10a}:null;}})[_0x79b8('0x25')](respondWithResult(_0x50f9a0,null))[_0x79b8('0x45')](handleError(_0x50f9a0,null));};exports[_0x79b8('0x4e')]=function(_0xc7524e,_0x3e68e0,_0x123f6a){var _0x45f5cb={};var _0x21b1c6={};var _0x3f6ee9;var _0x105d66;return db[_0x79b8('0x3f')][_0x79b8('0x4a')]({'where':{'id':_0xc7524e['params']['id']}})[_0x79b8('0x25')](handleEntityNotFound(_0x3e68e0,null))['then'](function(_0x43123c){if(_0x43123c){_0x3f6ee9=_0x43123c;_0x21b1c6['model']=_[_0x79b8('0x2f')](db[_0x79b8('0x4b')][_0x79b8('0x2b')]);_0x21b1c6['query']=_[_0x79b8('0x2f')](_0xc7524e['query']);_0x21b1c6[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x21b1c6[_0x79b8('0x2e')],_0x21b1c6[_0x79b8('0x30')]);_0x45f5cb[_0x79b8('0x34')]=_[_0x79b8('0x32')](_0x21b1c6[_0x79b8('0x2e')],qs['fields'](_0xc7524e['query'][_0x79b8('0x33')]));_0x45f5cb[_0x79b8('0x34')]=_0x45f5cb[_0x79b8('0x34')][_0x79b8('0x42')]?_0x45f5cb[_0x79b8('0x34')]:_0x21b1c6['model'];_0x45f5cb[_0x79b8('0x37')]=qs[_0x79b8('0x38')](_0xc7524e[_0x79b8('0x30')][_0x79b8('0x38')]);_0x45f5cb[_0x79b8('0x39')]=qs[_0x79b8('0x31')](_[_0x79b8('0x4c')](_0xc7524e[_0x79b8('0x30')],_0x21b1c6[_0x79b8('0x31')]));if(_0xc7524e[_0x79b8('0x30')][_0x79b8('0x3a')]){_0x45f5cb['where']=_[_0x79b8('0x3d')](_0x45f5cb[_0x79b8('0x39')],{'$or':_[_0x79b8('0x2a')](_0x45f5cb[_0x79b8('0x34')],function(_0x30cd73){var _0x2ed912={};_0x2ed912[_0x30cd73]={'$like':'%'+_0xc7524e[_0x79b8('0x30')][_0x79b8('0x3a')]+'%'};return _0x2ed912;})});}_0x45f5cb=_[_0x79b8('0x3d')]({},_0x45f5cb,_0xc7524e[_0x79b8('0x3e')]);return _0x3f6ee9['getDescriptions'](_0x45f5cb);}})[_0x79b8('0x25')](function(_0x348cac){if(_0x348cac){_0x105d66=_0x348cac[_0x79b8('0x42')];if(!_0xc7524e[_0x79b8('0x30')]['hasOwnProperty'](_0x79b8('0x36'))){_0x45f5cb[_0x79b8('0x1c')]=qs[_0x79b8('0x1c')](_0xc7524e[_0x79b8('0x30')]['limit']);_0x45f5cb['offset']=qs[_0x79b8('0x1b')](_0xc7524e[_0x79b8('0x30')][_0x79b8('0x1b')]);}return _0x3f6ee9[_0x79b8('0x4e')](_0x45f5cb);}})[_0x79b8('0x25')](function(_0x5509af){if(_0x5509af){return _0x5509af?{'count':_0x105d66,'rows':_0x5509af}:null;}})[_0x79b8('0x25')](respondWithResult(_0x3e68e0,null))[_0x79b8('0x45')](handleError(_0x3e68e0,null));};exports[_0x79b8('0x4f')]=function(_0xde794b,_0x1982c5,_0x569007){var _0x467f73={};var _0x261c27={};var _0x4ae4df;var _0x18a01f;return db[_0x79b8('0x3f')]['findOne']({'where':{'id':_0xde794b[_0x79b8('0x48')]['id']}})['then'](handleEntityNotFound(_0x1982c5,null))[_0x79b8('0x25')](function(_0x579e13){if(_0x579e13){_0x4ae4df=_0x579e13;_0x261c27[_0x79b8('0x2e')]=_[_0x79b8('0x2f')](db['Tag'][_0x79b8('0x2b')]);_0x261c27[_0x79b8('0x30')]=_[_0x79b8('0x2f')](_0xde794b['query']);_0x261c27[_0x79b8('0x31')]=_[_0x79b8('0x32')](_0x261c27['model'],_0x261c27[_0x79b8('0x30')]);_0x467f73['attributes']=_[_0x79b8('0x32')](_0x261c27[_0x79b8('0x2e')],qs[_0x79b8('0x33')](_0xde794b[_0x79b8('0x30')]['fields']));_0x467f73[_0x79b8('0x34')]=_0x467f73[_0x79b8('0x34')]['length']?_0x467f73[_0x79b8('0x34')]:_0x261c27[_0x79b8('0x2e')];_0x467f73['order']=qs['sort'](_0xde794b[_0x79b8('0x30')][_0x79b8('0x38')]);_0x467f73[_0x79b8('0x39')]=qs[_0x79b8('0x31')](_[_0x79b8('0x4c')](_0xde794b[_0x79b8('0x30')],_0x261c27[_0x79b8('0x31')]));if(_0xde794b[_0x79b8('0x30')][_0x79b8('0x3a')]){_0x467f73[_0x79b8('0x39')]=_[_0x79b8('0x3d')](_0x467f73['where'],{'$or':_[_0x79b8('0x2a')](_0x467f73['attributes'],function(_0x337b6b){var _0x4ffdb2={};_0x4ffdb2[_0x337b6b]={'$like':'%'+_0xde794b[_0x79b8('0x30')][_0x79b8('0x3a')]+'%'};return _0x4ffdb2;})});}_0x467f73=_[_0x79b8('0x3d')]({},_0x467f73,_0xde794b[_0x79b8('0x3e')]);return _0x4ae4df[_0x79b8('0x4f')](_0x467f73);}})[_0x79b8('0x25')](function(_0x4f1772){if(_0x4f1772){_0x18a01f=_0x4f1772[_0x79b8('0x42')];if(!_0xde794b[_0x79b8('0x30')][_0x79b8('0x35')](_0x79b8('0x36'))){_0x467f73[_0x79b8('0x1c')]=qs[_0x79b8('0x1c')](_0xde794b[_0x79b8('0x30')]['limit']);_0x467f73[_0x79b8('0x1b')]=qs[_0x79b8('0x1b')](_0xde794b[_0x79b8('0x30')][_0x79b8('0x1b')]);}return _0x4ae4df[_0x79b8('0x4f')](_0x467f73);}})[_0x79b8('0x25')](function(_0x2042a3){if(_0x2042a3){return _0x2042a3?{'count':_0x18a01f,'rows':_0x2042a3}:null;}})[_0x79b8('0x25')](respondWithResult(_0x1982c5,null))[_0x79b8('0x45')](handleError(_0x1982c5,null));};exports[_0x79b8('0x50')]=function(_0x2621ca,_0x43da78,_0x324be7){if(_0x2621ca['body']['id']){delete _0x2621ca[_0x79b8('0x47')]['id'];}return db[_0x79b8('0x3f')][_0x79b8('0x4a')]({'where':{'id':_0x2621ca[_0x79b8('0x48')]['id']}})['then'](handleEntityNotFound(_0x43da78,null))[_0x79b8('0x25')](function(_0x2fdf5b){if(_0x2fdf5b){return _0x2fdf5b[_0x79b8('0x50')](_0x2621ca[_0x79b8('0x47')]['ids']||[]);}return null;})['then'](respondWithResult(_0x43da78,null))[_0x79b8('0x45')](handleError(_0x43da78,null));}; \ No newline at end of file +var _0xf20b=['reject','save','update','end','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','then','includeAll','include','findAll','catch','attributes','intersection','find','create','body','destroy','params','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x49a4c1,_0x12383f){var _0x16e2ea=function(_0x460dd1){while(--_0x460dd1){_0x49a4c1['push'](_0x49a4c1['shift']());}};_0x16e2ea(++_0x12383f);}(_0xf20b,0xd7));var _0xbf20=function(_0x58d719,_0x43ca2a){_0x58d719=_0x58d719-0x0;var _0x4e8384=_0xf20b[_0x58d719];return _0x4e8384;};'use strict';var emlformat=require(_0xbf20('0x0'));var rimraf=require(_0xbf20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf20('0x2'));var rp=require(_0xbf20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf20('0x4'));var util=require('util');var path=require(_0xbf20('0x5'));var sox=require(_0xbf20('0x6'));var csv=require(_0xbf20('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf20('0x8'));var _=require('lodash');var squel=require(_0xbf20('0x9'));var crypto=require(_0xbf20('0xa'));var jsforce=require(_0xbf20('0xb'));var deskjs=require(_0xbf20('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbf20('0xd'));var Papa=require(_0xbf20('0xe'));var Redis=require('ioredis');var authService=require(_0xbf20('0xf'));var qs=require(_0xbf20('0x10'));var as=require(_0xbf20('0x11'));var hardwareService=require(_0xbf20('0x12'));var logger=require(_0xbf20('0x13'))(_0xbf20('0x14'));var utils=require(_0xbf20('0x15'));var config=require(_0xbf20('0x16'));var licenseUtil=require(_0xbf20('0x17'));var db=require(_0xbf20('0x18'))['db'];function respondWithStatusCode(_0x52615e,_0x83d121){_0x83d121=_0x83d121||0xcc;return function(_0x16dac){if(_0x16dac){return _0x52615e[_0xbf20('0x19')](_0x83d121);}return _0x52615e[_0xbf20('0x1a')](_0x83d121)['end']();};}function respondWithResult(_0x3690c8,_0x12fc89){_0x12fc89=_0x12fc89||0xc8;return function(_0x30f52e){if(_0x30f52e){return _0x3690c8[_0xbf20('0x1a')](_0x12fc89)['json'](_0x30f52e);}};}function respondWithFilteredResult(_0x33b728,_0x439c41){return function(_0x1bce6c){if(_0x1bce6c){var _0xf4e489=typeof _0x439c41['offset']===_0xbf20('0x1b')&&typeof _0x439c41[_0xbf20('0x1c')]===_0xbf20('0x1b');var _0x23513d=_0x1bce6c[_0xbf20('0x1d')];var _0x1fa04f=_0xf4e489?0x0:_0x439c41[_0xbf20('0x1e')];var _0x973cf1=_0xf4e489?_0x1bce6c['count']:_0x439c41[_0xbf20('0x1e')]+_0x439c41[_0xbf20('0x1c')];var _0x54fe1b;if(_0x973cf1>=_0x23513d){_0x973cf1=_0x23513d;_0x54fe1b=0xc8;}else{_0x54fe1b=0xce;}_0x33b728['status'](_0x54fe1b);return _0x33b728[_0xbf20('0x1f')](_0xbf20('0x20'),_0x1fa04f+'-'+_0x973cf1+'/'+_0x23513d)[_0xbf20('0x21')](_0x1bce6c);}return null;};}function patchUpdates(_0x45e804){return function(_0x56deb0){try{jsonpatch['apply'](_0x56deb0,_0x45e804,!![]);}catch(_0x27c8a1){return BPromise[_0xbf20('0x22')](_0x27c8a1);}return _0x56deb0[_0xbf20('0x23')]();};}function saveUpdates(_0x8263fd,_0x59407b){return function(_0x45022f){if(_0x45022f){return _0x45022f[_0xbf20('0x24')](_0x8263fd)['then'](function(_0x2a799f){return _0x2a799f;});}return null;};}function removeEntity(_0x362643,_0x2fa21c){return function(_0x515b45){if(_0x515b45){return _0x515b45['destroy']()['then'](function(){_0x362643[_0xbf20('0x1a')](0xcc)[_0xbf20('0x25')]();});}};}function handleEntityNotFound(_0x1d3b10,_0x5eb802){return function(_0x220656){if(!_0x220656){_0x1d3b10[_0xbf20('0x19')](0x194);}return _0x220656;};}function handleError(_0x6a0b6a,_0x192960){_0x192960=_0x192960||0x1f4;return function(_0x15da04){logger['error'](_0x15da04[_0xbf20('0x26')]);if(_0x15da04[_0xbf20('0x27')]){delete _0x15da04[_0xbf20('0x27')];}_0x6a0b6a[_0xbf20('0x1a')](_0x192960)[_0xbf20('0x28')](_0x15da04);};}exports[_0xbf20('0x29')]=function(_0x52d12a,_0x348f3a){var _0xc74903={},_0x4c9735={},_0x1cf0b0={'count':0x0,'rows':[]};var _0x4d0a60=_[_0xbf20('0x2a')](db[_0xbf20('0x2b')][_0xbf20('0x2c')],function(_0x431bda){return{'name':_0x431bda[_0xbf20('0x2d')],'type':_0x431bda[_0xbf20('0x2e')][_0xbf20('0x2f')]};});_0x4c9735[_0xbf20('0x30')]=_['map'](_0x4d0a60,'name');_0x4c9735[_0xbf20('0x31')]=_[_0xbf20('0x32')](_0x52d12a[_0xbf20('0x31')]);_0x4c9735['filters']=_['intersection'](_0x4c9735['model'],_0x4c9735[_0xbf20('0x31')]);_0xc74903['attributes']=_['intersection'](_0x4c9735[_0xbf20('0x30')],qs[_0xbf20('0x33')](_0x52d12a[_0xbf20('0x31')][_0xbf20('0x33')]));_0xc74903['attributes']=_0xc74903['attributes'][_0xbf20('0x34')]?_0xc74903['attributes']:_0x4c9735[_0xbf20('0x30')];if(!_0x52d12a[_0xbf20('0x31')][_0xbf20('0x35')](_0xbf20('0x36'))){_0xc74903[_0xbf20('0x1c')]=qs[_0xbf20('0x1c')](_0x52d12a[_0xbf20('0x31')][_0xbf20('0x1c')]);_0xc74903[_0xbf20('0x1e')]=qs['offset'](_0x52d12a[_0xbf20('0x31')][_0xbf20('0x1e')]);}_0xc74903['order']=qs['sort'](_0x52d12a[_0xbf20('0x31')][_0xbf20('0x37')]);_0xc74903[_0xbf20('0x38')]=qs[_0xbf20('0x39')](_[_0xbf20('0x3a')](_0x52d12a[_0xbf20('0x31')],_0x4c9735[_0xbf20('0x39')]),_0x4d0a60);if(_0x52d12a[_0xbf20('0x31')]['filter']){_0xc74903[_0xbf20('0x38')]=_[_0xbf20('0x3b')](_0xc74903[_0xbf20('0x38')],{'$or':_['map'](_0x4d0a60,function(_0x41c5e7){if(_0x41c5e7[_0xbf20('0x2e')]!=='VIRTUAL'){var _0x2f7c28={};_0x2f7c28[_0x41c5e7['name']]={'$like':'%'+_0x52d12a[_0xbf20('0x31')][_0xbf20('0x3c')]+'%'};return _0x2f7c28;}})});}_0xc74903=_['merge']({},_0xc74903,_0x52d12a[_0xbf20('0x3d')]);var _0x34b30d={'where':_0xc74903['where']};return db['FreshdeskConfiguration']['count'](_0x34b30d)[_0xbf20('0x3e')](function(_0x3bee5d){_0x1cf0b0[_0xbf20('0x1d')]=_0x3bee5d;if(_0x52d12a['query'][_0xbf20('0x3f')]){_0xc74903[_0xbf20('0x40')]=[{'all':!![]}];}return db[_0xbf20('0x2b')][_0xbf20('0x41')](_0xc74903);})['then'](function(_0x4caafd){_0x1cf0b0['rows']=_0x4caafd;return _0x1cf0b0;})[_0xbf20('0x3e')](respondWithFilteredResult(_0x348f3a,_0xc74903))[_0xbf20('0x42')](handleError(_0x348f3a,null));};exports['show']=function(_0x48cfc4,_0x2bc75b){var _0x153f3c={'raw':![],'where':{'id':_0x48cfc4['params']['id']}},_0x489b02={};_0x489b02[_0xbf20('0x30')]=_[_0xbf20('0x32')](db['FreshdeskConfiguration'][_0xbf20('0x2c')]);_0x489b02['query']=_['keys'](_0x48cfc4[_0xbf20('0x31')]);_0x489b02['filters']=_['intersection'](_0x489b02['model'],_0x489b02[_0xbf20('0x31')]);_0x153f3c[_0xbf20('0x43')]=_[_0xbf20('0x44')](_0x489b02[_0xbf20('0x30')],qs[_0xbf20('0x33')](_0x48cfc4[_0xbf20('0x31')][_0xbf20('0x33')]));_0x153f3c['attributes']=_0x153f3c[_0xbf20('0x43')][_0xbf20('0x34')]?_0x153f3c['attributes']:_0x489b02['model'];if(_0x48cfc4[_0xbf20('0x31')][_0xbf20('0x3f')]){_0x153f3c[_0xbf20('0x40')]=[{'all':!![]}];}_0x153f3c=_[_0xbf20('0x3b')]({},_0x153f3c,_0x48cfc4[_0xbf20('0x3d')]);return db[_0xbf20('0x2b')][_0xbf20('0x45')](_0x153f3c)[_0xbf20('0x3e')](handleEntityNotFound(_0x2bc75b,null))[_0xbf20('0x3e')](respondWithResult(_0x2bc75b,null))[_0xbf20('0x42')](handleError(_0x2bc75b,null));};exports[_0xbf20('0x46')]=function(_0x2bc171,_0x3c61e8){return db[_0xbf20('0x2b')]['create'](_0x2bc171[_0xbf20('0x47')],{})['then'](respondWithResult(_0x3c61e8,0xc9))['catch'](handleError(_0x3c61e8,null));};exports[_0xbf20('0x24')]=function(_0x176b7e,_0x22500e){if(_0x176b7e[_0xbf20('0x47')]['id']){delete _0x176b7e[_0xbf20('0x47')]['id'];}return db['FreshdeskConfiguration'][_0xbf20('0x45')]({'where':{'id':_0x176b7e['params']['id']}})['then'](handleEntityNotFound(_0x22500e,null))[_0xbf20('0x3e')](saveUpdates(_0x176b7e['body'],null))[_0xbf20('0x3e')](respondWithResult(_0x22500e,null))[_0xbf20('0x42')](handleError(_0x22500e,null));};exports[_0xbf20('0x48')]=function(_0x4fa443,_0x54d2e7){return db[_0xbf20('0x2b')]['find']({'where':{'id':_0x4fa443[_0xbf20('0x49')]['id']}})[_0xbf20('0x3e')](handleEntityNotFound(_0x54d2e7,null))[_0xbf20('0x3e')](removeEntity(_0x54d2e7,null))[_0xbf20('0x42')](handleError(_0x54d2e7,null));};exports[_0xbf20('0x4a')]=function(_0x2814ca,_0x4d1895,_0x1df604){var _0x1b0108={};var _0x375321={};var _0x192e8d;var _0x2acd55;return db[_0xbf20('0x2b')][_0xbf20('0x4b')]({'where':{'id':_0x2814ca[_0xbf20('0x49')]['id']}})[_0xbf20('0x3e')](handleEntityNotFound(_0x4d1895,null))[_0xbf20('0x3e')](function(_0x6aec47){if(_0x6aec47){_0x192e8d=_0x6aec47;_0x375321[_0xbf20('0x30')]=_[_0xbf20('0x32')](db[_0xbf20('0x4c')][_0xbf20('0x2c')]);_0x375321[_0xbf20('0x31')]=_['keys'](_0x2814ca['query']);_0x375321[_0xbf20('0x39')]=_['intersection'](_0x375321[_0xbf20('0x30')],_0x375321['query']);_0x1b0108['attributes']=_[_0xbf20('0x44')](_0x375321['model'],qs['fields'](_0x2814ca[_0xbf20('0x31')]['fields']));_0x1b0108[_0xbf20('0x43')]=_0x1b0108[_0xbf20('0x43')]['length']?_0x1b0108[_0xbf20('0x43')]:_0x375321['model'];_0x1b0108[_0xbf20('0x4d')]=qs[_0xbf20('0x37')](_0x2814ca['query']['sort']);_0x1b0108[_0xbf20('0x38')]=qs[_0xbf20('0x39')](_['pick'](_0x2814ca[_0xbf20('0x31')],_0x375321[_0xbf20('0x39')]));if(_0x2814ca['query'][_0xbf20('0x3c')]){_0x1b0108[_0xbf20('0x38')]=_[_0xbf20('0x3b')](_0x1b0108[_0xbf20('0x38')],{'$or':_[_0xbf20('0x2a')](_0x1b0108[_0xbf20('0x43')],function(_0x3fa719){var _0x351975={};_0x351975[_0x3fa719]={'$like':'%'+_0x2814ca[_0xbf20('0x31')]['filter']+'%'};return _0x351975;})});}_0x1b0108=_[_0xbf20('0x3b')]({},_0x1b0108,_0x2814ca['options']);return _0x192e8d['getFields'](_0x1b0108);}})[_0xbf20('0x3e')](function(_0xafe340){if(_0xafe340){_0x2acd55=_0xafe340[_0xbf20('0x34')];if(!_0x2814ca['query'][_0xbf20('0x35')](_0xbf20('0x36'))){_0x1b0108[_0xbf20('0x1c')]=qs[_0xbf20('0x1c')](_0x2814ca['query'][_0xbf20('0x1c')]);_0x1b0108[_0xbf20('0x1e')]=qs[_0xbf20('0x1e')](_0x2814ca['query'][_0xbf20('0x1e')]);}return _0x192e8d[_0xbf20('0x4a')](_0x1b0108);}})[_0xbf20('0x3e')](function(_0xec8faa){if(_0xec8faa){return _0xec8faa?{'count':_0x2acd55,'rows':_0xec8faa}:null;}})[_0xbf20('0x3e')](respondWithResult(_0x4d1895,null))[_0xbf20('0x42')](handleError(_0x4d1895,null));};exports[_0xbf20('0x4e')]=function(_0x4d9b78,_0x14cdc1,_0x489661){var _0x3ffa20={};var _0x4a9dc0={};var _0x3dca65;var _0x5836c7;return db[_0xbf20('0x2b')][_0xbf20('0x4b')]({'where':{'id':_0x4d9b78['params']['id']}})[_0xbf20('0x3e')](handleEntityNotFound(_0x14cdc1,null))[_0xbf20('0x3e')](function(_0x1aed52){if(_0x1aed52){_0x3dca65=_0x1aed52;_0x4a9dc0[_0xbf20('0x30')]=_[_0xbf20('0x32')](db[_0xbf20('0x4c')][_0xbf20('0x2c')]);_0x4a9dc0[_0xbf20('0x31')]=_[_0xbf20('0x32')](_0x4d9b78[_0xbf20('0x31')]);_0x4a9dc0[_0xbf20('0x39')]=_[_0xbf20('0x44')](_0x4a9dc0[_0xbf20('0x30')],_0x4a9dc0[_0xbf20('0x31')]);_0x3ffa20[_0xbf20('0x43')]=_[_0xbf20('0x44')](_0x4a9dc0['model'],qs[_0xbf20('0x33')](_0x4d9b78[_0xbf20('0x31')][_0xbf20('0x33')]));_0x3ffa20[_0xbf20('0x43')]=_0x3ffa20['attributes'][_0xbf20('0x34')]?_0x3ffa20[_0xbf20('0x43')]:_0x4a9dc0[_0xbf20('0x30')];_0x3ffa20[_0xbf20('0x4d')]=qs['sort'](_0x4d9b78[_0xbf20('0x31')][_0xbf20('0x37')]);_0x3ffa20['where']=qs[_0xbf20('0x39')](_[_0xbf20('0x3a')](_0x4d9b78[_0xbf20('0x31')],_0x4a9dc0['filters']));if(_0x4d9b78['query'][_0xbf20('0x3c')]){_0x3ffa20[_0xbf20('0x38')]=_[_0xbf20('0x3b')](_0x3ffa20[_0xbf20('0x38')],{'$or':_[_0xbf20('0x2a')](_0x3ffa20['attributes'],function(_0x7cc634){var _0x56eb04={};_0x56eb04[_0x7cc634]={'$like':'%'+_0x4d9b78['query'][_0xbf20('0x3c')]+'%'};return _0x56eb04;})});}_0x3ffa20=_['merge']({},_0x3ffa20,_0x4d9b78['options']);return _0x3dca65['getSubjects'](_0x3ffa20);}})[_0xbf20('0x3e')](function(_0x3c1831){if(_0x3c1831){_0x5836c7=_0x3c1831[_0xbf20('0x34')];if(!_0x4d9b78[_0xbf20('0x31')]['hasOwnProperty']('nolimit')){_0x3ffa20[_0xbf20('0x1c')]=qs[_0xbf20('0x1c')](_0x4d9b78[_0xbf20('0x31')]['limit']);_0x3ffa20[_0xbf20('0x1e')]=qs[_0xbf20('0x1e')](_0x4d9b78['query']['offset']);}return _0x3dca65[_0xbf20('0x4e')](_0x3ffa20);}})[_0xbf20('0x3e')](function(_0x1eaf10){if(_0x1eaf10){return _0x1eaf10?{'count':_0x5836c7,'rows':_0x1eaf10}:null;}})[_0xbf20('0x3e')](respondWithResult(_0x14cdc1,null))[_0xbf20('0x42')](handleError(_0x14cdc1,null));};exports[_0xbf20('0x4f')]=function(_0x3e87fe,_0x2ad9bf,_0xd692af){var _0xe198e9={};var _0x3f5af8={};var _0x5dc29d;var _0x5d7611;return db['FreshdeskConfiguration'][_0xbf20('0x4b')]({'where':{'id':_0x3e87fe[_0xbf20('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ad9bf,null))[_0xbf20('0x3e')](function(_0x3aa508){if(_0x3aa508){_0x5dc29d=_0x3aa508;_0x3f5af8['model']=_[_0xbf20('0x32')](db['FreshdeskField'][_0xbf20('0x2c')]);_0x3f5af8['query']=_[_0xbf20('0x32')](_0x3e87fe[_0xbf20('0x31')]);_0x3f5af8[_0xbf20('0x39')]=_[_0xbf20('0x44')](_0x3f5af8[_0xbf20('0x30')],_0x3f5af8[_0xbf20('0x31')]);_0xe198e9['attributes']=_[_0xbf20('0x44')](_0x3f5af8['model'],qs[_0xbf20('0x33')](_0x3e87fe['query'][_0xbf20('0x33')]));_0xe198e9[_0xbf20('0x43')]=_0xe198e9[_0xbf20('0x43')]['length']?_0xe198e9[_0xbf20('0x43')]:_0x3f5af8[_0xbf20('0x30')];_0xe198e9[_0xbf20('0x4d')]=qs[_0xbf20('0x37')](_0x3e87fe['query']['sort']);_0xe198e9['where']=qs[_0xbf20('0x39')](_[_0xbf20('0x3a')](_0x3e87fe[_0xbf20('0x31')],_0x3f5af8[_0xbf20('0x39')]));if(_0x3e87fe[_0xbf20('0x31')][_0xbf20('0x3c')]){_0xe198e9[_0xbf20('0x38')]=_[_0xbf20('0x3b')](_0xe198e9['where'],{'$or':_[_0xbf20('0x2a')](_0xe198e9[_0xbf20('0x43')],function(_0x5d8b48){var _0x49142c={};_0x49142c[_0x5d8b48]={'$like':'%'+_0x3e87fe[_0xbf20('0x31')][_0xbf20('0x3c')]+'%'};return _0x49142c;})});}_0xe198e9=_[_0xbf20('0x3b')]({},_0xe198e9,_0x3e87fe['options']);return _0x5dc29d[_0xbf20('0x4f')](_0xe198e9);}})['then'](function(_0x83abe7){if(_0x83abe7){_0x5d7611=_0x83abe7[_0xbf20('0x34')];if(!_0x3e87fe['query']['hasOwnProperty'](_0xbf20('0x36'))){_0xe198e9[_0xbf20('0x1c')]=qs[_0xbf20('0x1c')](_0x3e87fe[_0xbf20('0x31')][_0xbf20('0x1c')]);_0xe198e9[_0xbf20('0x1e')]=qs[_0xbf20('0x1e')](_0x3e87fe[_0xbf20('0x31')][_0xbf20('0x1e')]);}return _0x5dc29d[_0xbf20('0x4f')](_0xe198e9);}})[_0xbf20('0x3e')](function(_0x3ea055){if(_0x3ea055){return _0x3ea055?{'count':_0x5d7611,'rows':_0x3ea055}:null;}})[_0xbf20('0x3e')](respondWithResult(_0x2ad9bf,null))['catch'](handleError(_0x2ad9bf,null));};exports[_0xbf20('0x50')]=function(_0x185d9d,_0x36a483,_0x494d5b){var _0x29637e={};var _0x3cbe37={};var _0x47c32b;var _0x3e4f47;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x185d9d['params']['id']}})[_0xbf20('0x3e')](handleEntityNotFound(_0x36a483,null))[_0xbf20('0x3e')](function(_0x5c2574){if(_0x5c2574){_0x47c32b=_0x5c2574;_0x3cbe37[_0xbf20('0x30')]=_[_0xbf20('0x32')](db[_0xbf20('0x51')][_0xbf20('0x2c')]);_0x3cbe37[_0xbf20('0x31')]=_[_0xbf20('0x32')](_0x185d9d['query']);_0x3cbe37[_0xbf20('0x39')]=_['intersection'](_0x3cbe37[_0xbf20('0x30')],_0x3cbe37[_0xbf20('0x31')]);_0x29637e[_0xbf20('0x43')]=_[_0xbf20('0x44')](_0x3cbe37['model'],qs['fields'](_0x185d9d[_0xbf20('0x31')][_0xbf20('0x33')]));_0x29637e[_0xbf20('0x43')]=_0x29637e[_0xbf20('0x43')][_0xbf20('0x34')]?_0x29637e['attributes']:_0x3cbe37[_0xbf20('0x30')];_0x29637e[_0xbf20('0x4d')]=qs[_0xbf20('0x37')](_0x185d9d[_0xbf20('0x31')][_0xbf20('0x37')]);_0x29637e['where']=qs[_0xbf20('0x39')](_[_0xbf20('0x3a')](_0x185d9d[_0xbf20('0x31')],_0x3cbe37[_0xbf20('0x39')]));if(_0x185d9d[_0xbf20('0x31')][_0xbf20('0x3c')]){_0x29637e[_0xbf20('0x38')]=_[_0xbf20('0x3b')](_0x29637e[_0xbf20('0x38')],{'$or':_['map'](_0x29637e[_0xbf20('0x43')],function(_0x423847){var _0x3066fc={};_0x3066fc[_0x423847]={'$like':'%'+_0x185d9d[_0xbf20('0x31')][_0xbf20('0x3c')]+'%'};return _0x3066fc;})});}_0x29637e=_['merge']({},_0x29637e,_0x185d9d[_0xbf20('0x3d')]);return _0x47c32b[_0xbf20('0x50')](_0x29637e);}})['then'](function(_0x32ad36){if(_0x32ad36){_0x3e4f47=_0x32ad36[_0xbf20('0x34')];if(!_0x185d9d[_0xbf20('0x31')][_0xbf20('0x35')](_0xbf20('0x36'))){_0x29637e[_0xbf20('0x1c')]=qs[_0xbf20('0x1c')](_0x185d9d[_0xbf20('0x31')][_0xbf20('0x1c')]);_0x29637e[_0xbf20('0x1e')]=qs[_0xbf20('0x1e')](_0x185d9d['query'][_0xbf20('0x1e')]);}return _0x47c32b[_0xbf20('0x50')](_0x29637e);}})[_0xbf20('0x3e')](function(_0x137fd9){if(_0x137fd9){return _0x137fd9?{'count':_0x3e4f47,'rows':_0x137fd9}:null;}})['then'](respondWithResult(_0x36a483,null))[_0xbf20('0x42')](handleError(_0x36a483,null));};exports[_0xbf20('0x52')]=function(_0x1dbff2,_0x39b126,_0x505b70){if(_0x1dbff2[_0xbf20('0x47')]['id']){delete _0x1dbff2[_0xbf20('0x47')]['id'];}return db[_0xbf20('0x2b')][_0xbf20('0x4b')]({'where':{'id':_0x1dbff2[_0xbf20('0x49')]['id']}})[_0xbf20('0x3e')](handleEntityNotFound(_0x39b126,null))[_0xbf20('0x3e')](function(_0x1f88f5){if(_0x1f88f5){return _0x1f88f5[_0xbf20('0x52')](_0x1dbff2['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x39b126,null))[_0xbf20('0x42')](handleError(_0x39b126,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f59b345..6686bd1 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 _0x945f=['moment','request-promise','rimraf','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x72035e,_0xa6bc51){var _0x1912aa=function(_0x127cd5){while(--_0x127cd5){_0x72035e['push'](_0x72035e['shift']());}};_0x1912aa(++_0xa6bc51);}(_0x945f,0xe6));var _0xf945=function(_0x33d49a,_0x4e574d){_0x33d49a=_0x33d49a-0x0;var _0x319746=_0x945f[_0x33d49a];return _0x319746;};'use strict';var _=require(_0xf945('0x0'));var util=require(_0xf945('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf945('0x2'));var BPromise=require('bluebird');var rp=require(_0xf945('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf945('0x4'));var config=require('../../config/environment');var attributes=require(_0xf945('0x5'));module['exports']=function(_0x1c03d5,_0x5dee09){return _0x1c03d5['define'](_0xf945('0x6'),attributes,{'tableName':_0xf945('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x371b=['path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x371b,0x10e));var _0xb371=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x371b[_0x1895b7];return _0x1aecdc;};'use strict';var _=require(_0xb371('0x0'));var util=require('util');var logger=require(_0xb371('0x1'))('api');var moment=require(_0xb371('0x2'));var BPromise=require(_0xb371('0x3'));var rp=require(_0xb371('0x4'));var fs=require('fs');var path=require(_0xb371('0x5'));var rimraf=require(_0xb371('0x6'));var config=require('../../config/environment');var attributes=require(_0xb371('0x7'));module['exports']=function(_0x522a72,_0x30bf7e){return _0x522a72[_0xb371('0x8')](_0xb371('0x9'),attributes,{'tableName':_0xb371('0xa'),'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 f66057d..9947458 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 _0x2c35=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x514a2e,_0x55f88c){var _0xc048b2=function(_0x1db5bd){while(--_0x1db5bd){_0x514a2e['push'](_0x514a2e['shift']());}};_0xc048b2(++_0x55f88c);}(_0x2c35,0x7a));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c3('0x0'));var util=require(_0x52c3('0x1'));var moment=require(_0x52c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x52c3('0x3'));var fs=require('fs');var Redis=require(_0x52c3('0x4'));var db=require(_0x52c3('0x5'))['db'];var utils=require(_0x52c3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x52c3('0x7'));var jayson=require(_0x52c3('0x8'));var client=jayson['client'][_0x52c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d1d97,_0x5e9ceb,_0x3fe70b){return new BPromise(function(_0x38d096,_0x5c2b37){return client[_0x52c3('0xa')](_0x2d1d97,_0x3fe70b)[_0x52c3('0xb')](function(_0x189f89){logger[_0x52c3('0xc')](_0x52c3('0xd'),_0x5e9ceb,'request\x20sent');logger[_0x52c3('0xe')](_0x52c3('0xf'),_0x5e9ceb,_0x52c3('0x10'),JSON[_0x52c3('0x11')](_0x189f89));if(_0x189f89[_0x52c3('0x12')]){if(_0x189f89[_0x52c3('0x12')][_0x52c3('0x13')]===0x1f4){logger[_0x52c3('0x12')](_0x52c3('0xd'),_0x5e9ceb,_0x189f89[_0x52c3('0x12')][_0x52c3('0x14')]);return _0x5c2b37(_0x189f89[_0x52c3('0x12')][_0x52c3('0x14')]);}logger[_0x52c3('0x12')](_0x52c3('0xd'),_0x5e9ceb,_0x189f89['error'][_0x52c3('0x14')]);return _0x38d096(_0x189f89[_0x52c3('0x12')]['message']);}else{logger[_0x52c3('0xc')](_0x52c3('0xd'),_0x5e9ceb,_0x52c3('0x10'));_0x38d096(_0x189f89[_0x52c3('0x15')]['message']);}})[_0x52c3('0x16')](function(_0x2fb343){logger[_0x52c3('0x12')](_0x52c3('0xd'),_0x5e9ceb,_0x2fb343);_0x5c2b37(_0x2fb343);});});} \ No newline at end of file +var _0x906d=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird'];(function(_0xd2a045,_0x3bbcd4){var _0x5b2280=function(_0xd92183){while(--_0xd92183){_0xd2a045['push'](_0xd2a045['shift']());}};_0x5b2280(++_0x3bbcd4);}(_0x906d,0x1dd));var _0xd906=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x906d[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require(_0xd906('0x0'));var moment=require(_0xd906('0x1'));var BPromise=require(_0xd906('0x2'));var rs=require(_0xd906('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd906('0x4'));var logger=require(_0xd906('0x5'))(_0xd906('0x6'));var config=require(_0xd906('0x7'));var jayson=require(_0xd906('0x8'));var client=jayson[_0xd906('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x138648,_0x11a115,_0x3d71b8){return new BPromise(function(_0x1699d7,_0x1db0b1){return client[_0xd906('0xa')](_0x138648,_0x3d71b8)['then'](function(_0x494325){logger['info'](_0xd906('0xb'),_0x11a115,_0xd906('0xc'));logger['debug'](_0xd906('0xd'),_0x11a115,_0xd906('0xc'),JSON[_0xd906('0xe')](_0x494325));if(_0x494325['error']){if(_0x494325[_0xd906('0xf')][_0xd906('0x10')]===0x1f4){logger[_0xd906('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11a115,_0x494325[_0xd906('0xf')][_0xd906('0x11')]);return _0x1db0b1(_0x494325[_0xd906('0xf')][_0xd906('0x11')]);}logger[_0xd906('0xf')](_0xd906('0xb'),_0x11a115,_0x494325[_0xd906('0xf')][_0xd906('0x11')]);return _0x1699d7(_0x494325[_0xd906('0xf')][_0xd906('0x11')]);}else{logger[_0xd906('0x12')](_0xd906('0xb'),_0x11a115,'request\x20sent');_0x1699d7(_0x494325['result'][_0xd906('0x11')]);}})[_0xd906('0x13')](function(_0x18eab2){logger[_0xd906('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11a115,_0x18eab2);_0x1db0b1(_0x18eab2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 92fdb4d..5787f3a 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 _0x04ff=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','post','isAuthenticated','create','put','/:id','delete','destroy','multer','path','connect-timeout'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x04ff,0x1d9));var _0xf04f=function(_0x11b7d9,_0x12b7c3){_0x11b7d9=_0x11b7d9-0x0;var _0x19b4c5=_0x04ff[_0x11b7d9];return _0x19b4c5;};'use strict';var multer=require(_0xf04f('0x0'));var util=require('util');var path=require(_0xf04f('0x1'));var timeout=require(_0xf04f('0x2'));var express=require(_0xf04f('0x3'));var router=express['Router']();var fs_extra=require(_0xf04f('0x4'));var auth=require(_0xf04f('0x5'));var interaction=require(_0xf04f('0x6'));var config=require(_0xf04f('0x7'));var controller=require(_0xf04f('0x8'));router[_0xf04f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf04f('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf04f('0xa')]('/',auth[_0xf04f('0xb')](),controller[_0xf04f('0xc')]);router[_0xf04f('0xd')](_0xf04f('0xe'),auth[_0xf04f('0xb')](),controller['update']);router[_0xf04f('0xf')](_0xf04f('0xe'),auth[_0xf04f('0xb')](),controller[_0xf04f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x87a6=['destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x45adb4,_0x2abb06){var _0x137296=function(_0x552ec9){while(--_0x552ec9){_0x45adb4['push'](_0x45adb4['shift']());}};_0x137296(++_0x2abb06);}(_0x87a6,0xb2));var _0x687a=function(_0x1c1acf,_0xa5b22b){_0x1c1acf=_0x1c1acf-0x0;var _0x129328=_0x87a6[_0x1c1acf];return _0x129328;};'use strict';var multer=require(_0x687a('0x0'));var util=require('util');var path=require(_0x687a('0x1'));var timeout=require('connect-timeout');var express=require(_0x687a('0x2'));var router=express['Router']();var fs_extra=require(_0x687a('0x3'));var auth=require(_0x687a('0x4'));var interaction=require(_0x687a('0x5'));var config=require(_0x687a('0x6'));var controller=require(_0x687a('0x7'));router[_0x687a('0x8')]('/',auth[_0x687a('0x9')](),controller[_0x687a('0xa')]);router[_0x687a('0x8')](_0x687a('0xb'),auth[_0x687a('0x9')](),controller['show']);router[_0x687a('0xc')]('/',auth[_0x687a('0x9')](),controller['create']);router[_0x687a('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x687a('0x9')](),controller[_0x687a('0xe')]);module[_0x687a('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 8136fc5..16f7f7e 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 _0xe558=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x7d0412,_0x5a7a0d){var _0x3baf99=function(_0x41afef){while(--_0x41afef){_0x7d0412['push'](_0x7d0412['shift']());}};_0x3baf99(++_0x5a7a0d);}(_0xe558,0x195));var _0x8e55=function(_0xb19d92,_0x5449ec){_0xb19d92=_0xb19d92-0x0;var _0x15e62d=_0xe558[_0xb19d92];return _0x15e62d;};'use strict';var Sequelize=require(_0x8e55('0x0'));module[_0x8e55('0x1')]={'type':{'type':Sequelize[_0x8e55('0x2')]('string',_0x8e55('0x3'),_0x8e55('0x4'),_0x8e55('0x5'),_0x8e55('0x6')),'defaultValue':_0x8e55('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8e55('0x8')]},'keyType':{'type':Sequelize[_0x8e55('0x2')]('string',_0x8e55('0x3'),_0x8e55('0x4'))},'keyContent':{'type':Sequelize[_0x8e55('0x8')]},'idField':{'type':Sequelize[_0x8e55('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8e55('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2757=['BOOLEAN','exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x2757,0x1b1));var _0x7275=function(_0x1447c5,_0xff480f){_0x1447c5=_0x1447c5-0x0;var _0x558a44=_0x2757[_0x1447c5];return _0x558a44;};'use strict';var Sequelize=require('sequelize');module[_0x7275('0x0')]={'type':{'type':Sequelize[_0x7275('0x1')]('string','variable',_0x7275('0x2'),_0x7275('0x3'),_0x7275('0x4')),'defaultValue':_0x7275('0x5')},'content':{'type':Sequelize[_0x7275('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7275('0x1')](_0x7275('0x5'),_0x7275('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7275('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7275('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7275('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8850d7e..52b242a 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 _0xd757=['type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName'];(function(_0x500160,_0x21743f){var _0x5305b3=function(_0x501c02){while(--_0x501c02){_0x500160['push'](_0x500160['shift']());}};_0x5305b3(++_0x21743f);}(_0xd757,0x1e5));var _0x7d75=function(_0x227479,_0x1a5dfe){_0x227479=_0x227479-0x0;var _0x167b23=_0xd757[_0x227479];return _0x167b23;};'use strict';var emlformat=require(_0x7d75('0x0'));var rimraf=require(_0x7d75('0x1'));var zipdir=require(_0x7d75('0x2'));var jsonpatch=require(_0x7d75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d75('0x4'));var Mustache=require(_0x7d75('0x5'));var util=require('util');var path=require(_0x7d75('0x6'));var sox=require(_0x7d75('0x7'));var csv=require(_0x7d75('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d75('0x9'));var squel=require(_0x7d75('0xa'));var crypto=require(_0x7d75('0xb'));var jsforce=require(_0x7d75('0xc'));var deskjs=require(_0x7d75('0xd'));var toCsv=require(_0x7d75('0x8'));var querystring=require(_0x7d75('0xe'));var Papa=require(_0x7d75('0xf'));var Redis=require(_0x7d75('0x10'));var authService=require(_0x7d75('0x11'));var qs=require(_0x7d75('0x12'));var as=require(_0x7d75('0x13'));var hardwareService=require(_0x7d75('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7d75('0x15'));var config=require(_0x7d75('0x16'));var licenseUtil=require(_0x7d75('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e7b97,_0x3a5ca5){_0x3a5ca5=_0x3a5ca5||0xcc;return function(_0x5c9fcf){if(_0x5c9fcf){return _0x3e7b97[_0x7d75('0x18')](_0x3a5ca5);}return _0x3e7b97[_0x7d75('0x19')](_0x3a5ca5)[_0x7d75('0x1a')]();};}function respondWithResult(_0x43e546,_0x2b5d23){_0x2b5d23=_0x2b5d23||0xc8;return function(_0x3be8b2){if(_0x3be8b2){return _0x43e546['status'](_0x2b5d23)[_0x7d75('0x1b')](_0x3be8b2);}};}function respondWithFilteredResult(_0x1a460b,_0x14100f){return function(_0x1a9778){if(_0x1a9778){var _0x44041e=typeof _0x14100f[_0x7d75('0x1c')]==='undefined'&&typeof _0x14100f[_0x7d75('0x1d')]==='undefined';var _0x3896c3=_0x1a9778[_0x7d75('0x1e')];var _0x40edfc=_0x44041e?0x0:_0x14100f[_0x7d75('0x1c')];var _0x356b44=_0x44041e?_0x1a9778[_0x7d75('0x1e')]:_0x14100f[_0x7d75('0x1c')]+_0x14100f[_0x7d75('0x1d')];var _0x55b89d;if(_0x356b44>=_0x3896c3){_0x356b44=_0x3896c3;_0x55b89d=0xc8;}else{_0x55b89d=0xce;}_0x1a460b['status'](_0x55b89d);return _0x1a460b[_0x7d75('0x1f')](_0x7d75('0x20'),_0x40edfc+'-'+_0x356b44+'/'+_0x3896c3)[_0x7d75('0x1b')](_0x1a9778);}return null;};}function patchUpdates(_0xbb0322){return function(_0x47a5f0){try{jsonpatch[_0x7d75('0x21')](_0x47a5f0,_0xbb0322,!![]);}catch(_0x31bfa8){return BPromise[_0x7d75('0x22')](_0x31bfa8);}return _0x47a5f0[_0x7d75('0x23')]();};}function saveUpdates(_0x232c46,_0x187093){return function(_0x486ce1){if(_0x486ce1){return _0x486ce1[_0x7d75('0x24')](_0x232c46)[_0x7d75('0x25')](function(_0x1c0327){return _0x1c0327;});}return null;};}function removeEntity(_0x3be591,_0x21211b){return function(_0x323e20){if(_0x323e20){return _0x323e20[_0x7d75('0x26')]()[_0x7d75('0x25')](function(){_0x3be591[_0x7d75('0x19')](0xcc)[_0x7d75('0x1a')]();});}};}function handleEntityNotFound(_0x3103d6,_0x5a1218){return function(_0xec279d){if(!_0xec279d){_0x3103d6[_0x7d75('0x18')](0x194);}return _0xec279d;};}function handleError(_0x4f67e6,_0x19a230){_0x19a230=_0x19a230||0x1f4;return function(_0x50d798){logger[_0x7d75('0x27')](_0x50d798[_0x7d75('0x28')]);if(_0x50d798[_0x7d75('0x29')]){delete _0x50d798[_0x7d75('0x29')];}_0x4f67e6[_0x7d75('0x19')](_0x19a230)['send'](_0x50d798);};}exports[_0x7d75('0x2a')]=function(_0x31055c,_0x2f783b){var _0xb0c225={},_0x1121a6={},_0x11ba6c={'count':0x0,'rows':[]};var _0x5dd4f1=_[_0x7d75('0x2b')](db[_0x7d75('0x2c')][_0x7d75('0x2d')],function(_0x2a1c5b){return{'name':_0x2a1c5b[_0x7d75('0x2e')],'type':_0x2a1c5b[_0x7d75('0x2f')][_0x7d75('0x30')]};});_0x1121a6['model']=_['map'](_0x5dd4f1,'name');_0x1121a6[_0x7d75('0x31')]=_['keys'](_0x31055c[_0x7d75('0x31')]);_0x1121a6[_0x7d75('0x32')]=_[_0x7d75('0x33')](_0x1121a6[_0x7d75('0x34')],_0x1121a6[_0x7d75('0x31')]);_0xb0c225['attributes']=_[_0x7d75('0x33')](_0x1121a6[_0x7d75('0x34')],qs[_0x7d75('0x35')](_0x31055c[_0x7d75('0x31')][_0x7d75('0x35')]));_0xb0c225[_0x7d75('0x36')]=_0xb0c225[_0x7d75('0x36')][_0x7d75('0x37')]?_0xb0c225[_0x7d75('0x36')]:_0x1121a6[_0x7d75('0x34')];if(!_0x31055c['query'][_0x7d75('0x38')](_0x7d75('0x39'))){_0xb0c225[_0x7d75('0x1d')]=qs[_0x7d75('0x1d')](_0x31055c[_0x7d75('0x31')][_0x7d75('0x1d')]);_0xb0c225['offset']=qs[_0x7d75('0x1c')](_0x31055c[_0x7d75('0x31')]['offset']);}_0xb0c225['order']=qs[_0x7d75('0x3a')](_0x31055c[_0x7d75('0x31')][_0x7d75('0x3a')]);_0xb0c225[_0x7d75('0x3b')]=qs[_0x7d75('0x32')](_[_0x7d75('0x3c')](_0x31055c['query'],_0x1121a6[_0x7d75('0x32')]),_0x5dd4f1);if(_0x31055c[_0x7d75('0x31')]['filter']){_0xb0c225[_0x7d75('0x3b')]=_[_0x7d75('0x3d')](_0xb0c225[_0x7d75('0x3b')],{'$or':_[_0x7d75('0x2b')](_0x5dd4f1,function(_0x30aeab){if(_0x30aeab[_0x7d75('0x2f')]!==_0x7d75('0x3e')){var _0x815d03={};_0x815d03[_0x30aeab[_0x7d75('0x29')]]={'$like':'%'+_0x31055c[_0x7d75('0x31')][_0x7d75('0x3f')]+'%'};return _0x815d03;}})});}_0xb0c225=_[_0x7d75('0x3d')]({},_0xb0c225,_0x31055c[_0x7d75('0x40')]);var _0x35ac15={'where':_0xb0c225[_0x7d75('0x3b')]};return db[_0x7d75('0x2c')][_0x7d75('0x1e')](_0x35ac15)[_0x7d75('0x25')](function(_0x304c32){_0x11ba6c[_0x7d75('0x1e')]=_0x304c32;if(_0x31055c['query']['includeAll']){_0xb0c225[_0x7d75('0x41')]=[{'all':!![]}];}return db[_0x7d75('0x2c')][_0x7d75('0x42')](_0xb0c225);})[_0x7d75('0x25')](function(_0x222ece){_0x11ba6c[_0x7d75('0x43')]=_0x222ece;return _0x11ba6c;})[_0x7d75('0x25')](respondWithFilteredResult(_0x2f783b,_0xb0c225))['catch'](handleError(_0x2f783b,null));};exports[_0x7d75('0x44')]=function(_0x23e6f9,_0x42a57e){var _0x5edd82={'raw':!![],'where':{'id':_0x23e6f9[_0x7d75('0x45')]['id']}},_0x2e1f36={};_0x2e1f36[_0x7d75('0x34')]=_[_0x7d75('0x46')](db[_0x7d75('0x2c')][_0x7d75('0x2d')]);_0x2e1f36[_0x7d75('0x31')]=_[_0x7d75('0x46')](_0x23e6f9[_0x7d75('0x31')]);_0x2e1f36[_0x7d75('0x32')]=_[_0x7d75('0x33')](_0x2e1f36['model'],_0x2e1f36[_0x7d75('0x31')]);_0x5edd82['attributes']=_['intersection'](_0x2e1f36[_0x7d75('0x34')],qs['fields'](_0x23e6f9[_0x7d75('0x31')][_0x7d75('0x35')]));_0x5edd82['attributes']=_0x5edd82[_0x7d75('0x36')][_0x7d75('0x37')]?_0x5edd82[_0x7d75('0x36')]:_0x2e1f36[_0x7d75('0x34')];if(_0x23e6f9[_0x7d75('0x31')][_0x7d75('0x47')]){_0x5edd82[_0x7d75('0x41')]=[{'all':!![]}];}_0x5edd82=_[_0x7d75('0x3d')]({},_0x5edd82,_0x23e6f9['options']);return db[_0x7d75('0x2c')][_0x7d75('0x48')](_0x5edd82)[_0x7d75('0x25')](handleEntityNotFound(_0x42a57e,null))['then'](respondWithResult(_0x42a57e,null))[_0x7d75('0x49')](handleError(_0x42a57e,null));};exports[_0x7d75('0x4a')]=function(_0x34ff66,_0x277788){return db[_0x7d75('0x2c')][_0x7d75('0x4a')](_0x34ff66['body'],{})[_0x7d75('0x25')](respondWithResult(_0x277788,0xc9))[_0x7d75('0x49')](handleError(_0x277788,null));};exports[_0x7d75('0x24')]=function(_0x31b9be,_0x4cb900){if(_0x31b9be[_0x7d75('0x4b')]['id']){delete _0x31b9be['body']['id'];}return db[_0x7d75('0x2c')][_0x7d75('0x48')]({'where':{'id':_0x31b9be[_0x7d75('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cb900,null))[_0x7d75('0x25')](saveUpdates(_0x31b9be['body'],null))[_0x7d75('0x25')](respondWithResult(_0x4cb900,null))['catch'](handleError(_0x4cb900,null));};exports[_0x7d75('0x26')]=function(_0x27a11f,_0x1009eb){return db['FreshdeskField'][_0x7d75('0x48')]({'where':{'id':_0x27a11f['params']['id']}})[_0x7d75('0x25')](handleEntityNotFound(_0x1009eb,null))[_0x7d75('0x25')](removeEntity(_0x1009eb,null))[_0x7d75('0x49')](handleError(_0x1009eb,null));}; \ No newline at end of file +var _0xb332=['includeAll','findAll','rows','show','keys','find','body','params','destroy','catch','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','name','index','map','FreshdeskField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options'];(function(_0x26b74c,_0x317fea){var _0x334d91=function(_0x5d6129){while(--_0x5d6129){_0x26b74c['push'](_0x26b74c['shift']());}};_0x334d91(++_0x317fea);}(_0xb332,0xd9));var _0x2b33=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0xb332[_0x52085a];return _0x5afc1a;};'use strict';var emlformat=require(_0x2b33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b33('0x1'));var jsonpatch=require(_0x2b33('0x2'));var rp=require('request-promise');var moment=require(_0x2b33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b33('0x4'));var util=require('util');var path=require(_0x2b33('0x5'));var sox=require('sox');var csv=require(_0x2b33('0x6'));var ejs=require(_0x2b33('0x7'));var fs=require('fs');var fs_extra=require(_0x2b33('0x8'));var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x6'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0x3969cb,_0xca2248){_0xca2248=_0xca2248||0xcc;return function(_0x4df129){if(_0x4df129){return _0x3969cb[_0x2b33('0x17')](_0xca2248);}return _0x3969cb[_0x2b33('0x18')](_0xca2248)[_0x2b33('0x19')]();};}function respondWithResult(_0x4ef886,_0x173c75){_0x173c75=_0x173c75||0xc8;return function(_0x4d39db){if(_0x4d39db){return _0x4ef886[_0x2b33('0x18')](_0x173c75)[_0x2b33('0x1a')](_0x4d39db);}};}function respondWithFilteredResult(_0x233cd9,_0x57aea7){return function(_0x52693f){if(_0x52693f){var _0x1d8e75=typeof _0x57aea7[_0x2b33('0x1b')]===_0x2b33('0x1c')&&typeof _0x57aea7[_0x2b33('0x1d')]===_0x2b33('0x1c');var _0x4d69d0=_0x52693f['count'];var _0x59f0b6=_0x1d8e75?0x0:_0x57aea7[_0x2b33('0x1b')];var _0x4f10c4=_0x1d8e75?_0x52693f['count']:_0x57aea7[_0x2b33('0x1b')]+_0x57aea7[_0x2b33('0x1d')];var _0x205d8f;if(_0x4f10c4>=_0x4d69d0){_0x4f10c4=_0x4d69d0;_0x205d8f=0xc8;}else{_0x205d8f=0xce;}_0x233cd9['status'](_0x205d8f);return _0x233cd9[_0x2b33('0x1e')]('Content-Range',_0x59f0b6+'-'+_0x4f10c4+'/'+_0x4d69d0)[_0x2b33('0x1a')](_0x52693f);}return null;};}function patchUpdates(_0x2565be){return function(_0x8c8dc2){try{jsonpatch[_0x2b33('0x1f')](_0x8c8dc2,_0x2565be,!![]);}catch(_0x233ba6){return BPromise[_0x2b33('0x20')](_0x233ba6);}return _0x8c8dc2[_0x2b33('0x21')]();};}function saveUpdates(_0x4fb725,_0x23024c){return function(_0x1d9c98){if(_0x1d9c98){return _0x1d9c98[_0x2b33('0x22')](_0x4fb725)[_0x2b33('0x23')](function(_0x58998e){return _0x58998e;});}return null;};}function removeEntity(_0x1c27d4,_0x27f1b8){return function(_0x2605e6){if(_0x2605e6){return _0x2605e6['destroy']()[_0x2b33('0x23')](function(){_0x1c27d4[_0x2b33('0x18')](0xcc)[_0x2b33('0x19')]();});}};}function handleEntityNotFound(_0x32b835,_0x4df3d4){return function(_0x2ec9db){if(!_0x2ec9db){_0x32b835['sendStatus'](0x194);}return _0x2ec9db;};}function handleError(_0x373e27,_0x483cf4){_0x483cf4=_0x483cf4||0x1f4;return function(_0x2e74d0){logger[_0x2b33('0x24')](_0x2e74d0['stack']);if(_0x2e74d0[_0x2b33('0x25')]){delete _0x2e74d0['name'];}_0x373e27[_0x2b33('0x18')](_0x483cf4)['send'](_0x2e74d0);};}exports[_0x2b33('0x26')]=function(_0xa109f4,_0x9482a){var _0x268c1d={},_0xaa6643={},_0x312d4d={'count':0x0,'rows':[]};var _0x2be034=_[_0x2b33('0x27')](db[_0x2b33('0x28')][_0x2b33('0x29')],function(_0x4cf72f){return{'name':_0x4cf72f['fieldName'],'type':_0x4cf72f[_0x2b33('0x2a')][_0x2b33('0x2b')]};});_0xaa6643[_0x2b33('0x2c')]=_[_0x2b33('0x27')](_0x2be034,_0x2b33('0x25'));_0xaa6643['query']=_['keys'](_0xa109f4[_0x2b33('0x2d')]);_0xaa6643[_0x2b33('0x2e')]=_[_0x2b33('0x2f')](_0xaa6643[_0x2b33('0x2c')],_0xaa6643[_0x2b33('0x2d')]);_0x268c1d[_0x2b33('0x30')]=_['intersection'](_0xaa6643[_0x2b33('0x2c')],qs['fields'](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x31')]));_0x268c1d[_0x2b33('0x30')]=_0x268c1d[_0x2b33('0x30')][_0x2b33('0x32')]?_0x268c1d[_0x2b33('0x30')]:_0xaa6643[_0x2b33('0x2c')];if(!_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x33')](_0x2b33('0x34'))){_0x268c1d[_0x2b33('0x1d')]=qs[_0x2b33('0x1d')](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x1d')]);_0x268c1d[_0x2b33('0x1b')]=qs[_0x2b33('0x1b')](_0xa109f4['query']['offset']);}_0x268c1d['order']=qs[_0x2b33('0x35')](_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x35')]);_0x268c1d[_0x2b33('0x36')]=qs[_0x2b33('0x2e')](_['pick'](_0xa109f4['query'],_0xaa6643[_0x2b33('0x2e')]),_0x2be034);if(_0xa109f4['query'][_0x2b33('0x37')]){_0x268c1d[_0x2b33('0x36')]=_[_0x2b33('0x38')](_0x268c1d[_0x2b33('0x36')],{'$or':_[_0x2b33('0x27')](_0x2be034,function(_0x40a109){if(_0x40a109[_0x2b33('0x2a')]!==_0x2b33('0x39')){var _0x21557c={};_0x21557c[_0x40a109[_0x2b33('0x25')]]={'$like':'%'+_0xa109f4['query'][_0x2b33('0x37')]+'%'};return _0x21557c;}})});}_0x268c1d=_[_0x2b33('0x38')]({},_0x268c1d,_0xa109f4[_0x2b33('0x3a')]);var _0x5b7c32={'where':_0x268c1d['where']};return db[_0x2b33('0x28')]['count'](_0x5b7c32)[_0x2b33('0x23')](function(_0x23a27c){_0x312d4d['count']=_0x23a27c;if(_0xa109f4[_0x2b33('0x2d')][_0x2b33('0x3b')]){_0x268c1d['include']=[{'all':!![]}];}return db[_0x2b33('0x28')][_0x2b33('0x3c')](_0x268c1d);})['then'](function(_0x2168b6){_0x312d4d[_0x2b33('0x3d')]=_0x2168b6;return _0x312d4d;})[_0x2b33('0x23')](respondWithFilteredResult(_0x9482a,_0x268c1d))['catch'](handleError(_0x9482a,null));};exports[_0x2b33('0x3e')]=function(_0x26928a,_0x2b1c29){var _0x22f321={'raw':!![],'where':{'id':_0x26928a['params']['id']}},_0x22ce0c={};_0x22ce0c[_0x2b33('0x2c')]=_[_0x2b33('0x3f')](db[_0x2b33('0x28')]['rawAttributes']);_0x22ce0c[_0x2b33('0x2d')]=_[_0x2b33('0x3f')](_0x26928a[_0x2b33('0x2d')]);_0x22ce0c[_0x2b33('0x2e')]=_['intersection'](_0x22ce0c[_0x2b33('0x2c')],_0x22ce0c[_0x2b33('0x2d')]);_0x22f321['attributes']=_['intersection'](_0x22ce0c['model'],qs[_0x2b33('0x31')](_0x26928a['query'][_0x2b33('0x31')]));_0x22f321[_0x2b33('0x30')]=_0x22f321[_0x2b33('0x30')][_0x2b33('0x32')]?_0x22f321[_0x2b33('0x30')]:_0x22ce0c[_0x2b33('0x2c')];if(_0x26928a[_0x2b33('0x2d')][_0x2b33('0x3b')]){_0x22f321['include']=[{'all':!![]}];}_0x22f321=_[_0x2b33('0x38')]({},_0x22f321,_0x26928a[_0x2b33('0x3a')]);return db[_0x2b33('0x28')][_0x2b33('0x40')](_0x22f321)[_0x2b33('0x23')](handleEntityNotFound(_0x2b1c29,null))[_0x2b33('0x23')](respondWithResult(_0x2b1c29,null))['catch'](handleError(_0x2b1c29,null));};exports['create']=function(_0x57cb02,_0x493123){return db[_0x2b33('0x28')]['create'](_0x57cb02[_0x2b33('0x41')],{})['then'](respondWithResult(_0x493123,0xc9))['catch'](handleError(_0x493123,null));};exports[_0x2b33('0x22')]=function(_0xd15da9,_0x357724){if(_0xd15da9['body']['id']){delete _0xd15da9[_0x2b33('0x41')]['id'];}return db['FreshdeskField'][_0x2b33('0x40')]({'where':{'id':_0xd15da9[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0x357724,null))[_0x2b33('0x23')](saveUpdates(_0xd15da9[_0x2b33('0x41')],null))[_0x2b33('0x23')](respondWithResult(_0x357724,null))['catch'](handleError(_0x357724,null));};exports[_0x2b33('0x43')]=function(_0x27f766,_0xc3fd2e){return db['FreshdeskField'][_0x2b33('0x40')]({'where':{'id':_0x27f766[_0x2b33('0x42')]['id']}})[_0x2b33('0x23')](handleEntityNotFound(_0xc3fd2e,null))['then'](removeEntity(_0xc3fd2e,null))[_0x2b33('0x44')](handleError(_0xc3fd2e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 51c6cc8..a759841 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 _0xe95c=['FieldId','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x6be029,_0x1ebc18){var _0xe2df60=function(_0x48f7ca){while(--_0x48f7ca){_0x6be029['push'](_0x6be029['shift']());}};_0xe2df60(++_0x1ebc18);}(_0xe95c,0x1a5));var _0xce95=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xe95c[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0xce95('0x0'));var util=require(_0xce95('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xce95('0x2'));var BPromise=require('bluebird');var rp=require(_0xce95('0x3'));var fs=require('fs');var path=require(_0xce95('0x4'));var rimraf=require(_0xce95('0x5'));var config=require(_0xce95('0x6'));var attributes=require(_0xce95('0x7'));module[_0xce95('0x8')]=function(_0x4dc6c6,_0x5bc18d){return _0x4dc6c6[_0xce95('0x9')](_0xce95('0xa'),attributes,{'tableName':_0xce95('0xb'),'paranoid':![],'indexes':[{'name':_0xce95('0xc'),'fields':[_0xce95('0xd'),_0xce95('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd4b=['exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x33bf63,_0x2e5f24){var _0x1e9e8f=function(_0x333bfe){while(--_0x333bfe){_0x33bf63['push'](_0x33bf63['shift']());}};_0x1e9e8f(++_0x2e5f24);}(_0xdd4b,0xbc));var _0xbdd4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xdd4b[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbdd4('0x0'))(_0xbdd4('0x1'));var moment=require('moment');var BPromise=require(_0xbdd4('0x2'));var rp=require(_0xbdd4('0x3'));var fs=require('fs');var path=require(_0xbdd4('0x4'));var rimraf=require(_0xbdd4('0x5'));var config=require(_0xbdd4('0x6'));var attributes=require(_0xbdd4('0x7'));module[_0xbdd4('0x8')]=function(_0x17e603,_0x5f4088){return _0x17e603['define'](_0xbdd4('0x9'),attributes,{'tableName':_0xbdd4('0xa'),'paranoid':![],'indexes':[{'name':_0xbdd4('0xb'),'fields':[_0xbdd4('0xc'),_0xbdd4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 5543932..2bb5d73 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 _0x7e84=['bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7e84,0x1b2));var _0x47e8=function(_0x3778c3,_0x3cd37a){_0x3778c3=_0x3778c3-0x0;var _0x1ba749=_0x7e84[_0x3778c3];return _0x1ba749;};'use strict';var _=require(_0x47e8('0x0'));var util=require(_0x47e8('0x1'));var moment=require(_0x47e8('0x2'));var BPromise=require(_0x47e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x47e8('0x5'))('rpc');var config=require(_0x47e8('0x6'));var jayson=require(_0x47e8('0x7'));var client=jayson[_0x47e8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ef15d,_0x2af739,_0x20bfac){return new BPromise(function(_0x5ec405,_0x3e5459){return client[_0x47e8('0x9')](_0x4ef15d,_0x20bfac)[_0x47e8('0xa')](function(_0x26c5bc){logger['info'](_0x47e8('0xb'),_0x2af739,'request\x20sent');logger[_0x47e8('0xc')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x2af739,'request\x20sent',JSON[_0x47e8('0xd')](_0x26c5bc));if(_0x26c5bc['error']){if(_0x26c5bc[_0x47e8('0xe')][_0x47e8('0xf')]===0x1f4){logger['error'](_0x47e8('0xb'),_0x2af739,_0x26c5bc[_0x47e8('0xe')][_0x47e8('0x10')]);return _0x3e5459(_0x26c5bc[_0x47e8('0xe')][_0x47e8('0x10')]);}logger[_0x47e8('0xe')](_0x47e8('0xb'),_0x2af739,_0x26c5bc[_0x47e8('0xe')][_0x47e8('0x10')]);return _0x5ec405(_0x26c5bc[_0x47e8('0xe')][_0x47e8('0x10')]);}else{logger[_0x47e8('0x11')](_0x47e8('0xb'),_0x2af739,'request\x20sent');_0x5ec405(_0x26c5bc['result'][_0x47e8('0x10')]);}})[_0x47e8('0x12')](function(_0xae3230){logger[_0x47e8('0xe')](_0x47e8('0xb'),_0x2af739,_0xae3230);_0x3e5459(_0xae3230);});});} \ No newline at end of file +var _0x3fb6=['request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x560841,_0x2db4c5){var _0x78a11=function(_0x233f1c){while(--_0x233f1c){_0x560841['push'](_0x560841['shift']());}};_0x78a11(++_0x2db4c5);}(_0x3fb6,0xe4));var _0x63fb=function(_0x529fd9,_0x299f1c){_0x529fd9=_0x529fd9-0x0;var _0x1e4344=_0x3fb6[_0x529fd9];return _0x1e4344;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x63fb('0x0'));var fs=require('fs');var Redis=require(_0x63fb('0x1'));var db=require(_0x63fb('0x2'))['db'];var utils=require(_0x63fb('0x3'));var logger=require(_0x63fb('0x4'))(_0x63fb('0x5'));var config=require('../../config/environment');var jayson=require(_0x63fb('0x6'));var client=jayson['client'][_0x63fb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42c50b,_0xc8a8cd,_0x5ca84c){return new BPromise(function(_0x269ee8,_0x386fba){return client[_0x63fb('0x8')](_0x42c50b,_0x5ca84c)[_0x63fb('0x9')](function(_0x4edcb9){logger[_0x63fb('0xa')](_0x63fb('0xb'),_0xc8a8cd,_0x63fb('0xc'));logger['debug'](_0x63fb('0xd'),_0xc8a8cd,_0x63fb('0xc'),JSON['stringify'](_0x4edcb9));if(_0x4edcb9[_0x63fb('0xe')]){if(_0x4edcb9[_0x63fb('0xe')]['code']===0x1f4){logger[_0x63fb('0xe')](_0x63fb('0xb'),_0xc8a8cd,_0x4edcb9[_0x63fb('0xe')][_0x63fb('0xf')]);return _0x386fba(_0x4edcb9['error']['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0xc8a8cd,_0x4edcb9[_0x63fb('0xe')]['message']);return _0x269ee8(_0x4edcb9['error']['message']);}else{logger[_0x63fb('0xa')](_0x63fb('0xb'),_0xc8a8cd,_0x63fb('0xc'));_0x269ee8(_0x4edcb9['result'][_0x63fb('0xf')]);}})['catch'](function(_0x5a0c4e){logger['error']('FreshdeskField,\x20%s,\x20%s',_0xc8a8cd,_0x5a0c4e);_0x386fba(_0x5a0c4e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index aa2e0f1..12c5c85 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 _0x44a3=['getFields','post','addConfiguration','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x52b671,_0x196334){var _0xd11aaa=function(_0xe726cb){while(--_0xe726cb){_0x52b671['push'](_0x52b671['shift']());}};_0xd11aaa(++_0x196334);}(_0x44a3,0x1a9));var _0x344a=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x44a3[_0x3ed054];return _0x16dd95;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/fields',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),controller['create']);router[_0x344a('0x10')]('/:id/configurations',auth[_0x344a('0xb')](),controller[_0x344a('0x11')]);router['put']('/:id',auth[_0x344a('0xb')](),controller[_0x344a('0x12')]);router[_0x344a('0x13')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x351d=['index','/:id','/:id/configurations','getFields','create','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x351d,0x90));var _0xd351=function(_0x3d0e93,_0x5b4dbe){_0x3d0e93=_0x3d0e93-0x0;var _0x283b0d=_0x351d[_0x3d0e93];return _0x283b0d;};'use strict';var multer=require(_0xd351('0x0'));var util=require('util');var path=require(_0xd351('0x1'));var timeout=require(_0xd351('0x2'));var express=require(_0xd351('0x3'));var router=express['Router']();var fs_extra=require(_0xd351('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0xd351('0x7')]('/',auth[_0xd351('0x8')](),controller[_0xd351('0x9')]);router['get'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['show']);router[_0xd351('0x7')](_0xd351('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd351('0x7')]('/:id/fields',auth[_0xd351('0x8')](),controller[_0xd351('0xc')]);router['post']('/',auth[_0xd351('0x8')](),controller[_0xd351('0xd')]);router['post'](_0xd351('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xd351('0xe')](_0xd351('0xa'),auth[_0xd351('0x8')](),controller[_0xd351('0xf')]);router['delete'](_0xd351('0xa'),auth[_0xd351('0x8')](),controller['destroy']);module[_0xd351('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5dba9e1..813fdd4 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 _0x33af=['exports','STRING','username','remoteUri'];(function(_0x913da,_0x4363a7){var _0x22a6e1=function(_0x2e6d6f){while(--_0x2e6d6f){_0x913da['push'](_0x913da['shift']());}};_0x22a6e1(++_0x4363a7);}(_0x33af,0xec));var _0xf33a=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x33af[_0x65c903];return _0x23e1d7;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xf61e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2df049,_0x54c54b){var _0x214f50=function(_0x5bdb17){while(--_0x5bdb17){_0x2df049['push'](_0x2df049['shift']());}};_0x214f50(++_0x54c54b);}(_0xf61e,0x191));var _0xef61=function(_0x227c98,_0x237ccc){_0x227c98=_0x227c98-0x0;var _0x4cbfa1=_0xf61e[_0x227c98];return _0x4cbfa1;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'name':{'type':Sequelize[_0xef61('0x2')]},'description':{'type':Sequelize[_0xef61('0x2')]},'username':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x3')},'apiKey':{'type':Sequelize[_0xef61('0x2')]},'remoteUri':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x4')},'serverUrl':{'type':Sequelize[_0xef61('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index c79745c..1a51072 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 _0xef3a=['merge','VIRTUAL','options','includeAll','rows','catch','params','find','create','body','getConfigurations','findOne','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','username','lastIndexOf','GET','format','%s%s','/api/selector/owners','apiKey','users','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','Content-Range','json','apply','save','update','then','destroy','end','error','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xef3a,0xe3));var _0xaef3=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0xef3a[_0x35b7d4];return _0x4e8cee;};'use strict';var emlformat=require(_0xaef3('0x0'));var rimraf=require(_0xaef3('0x1'));var zipdir=require(_0xaef3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaef3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaef3('0x4'));var util=require(_0xaef3('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaef3('0x6'));var fs=require('fs');var fs_extra=require(_0xaef3('0x7'));var _=require(_0xaef3('0x8'));var squel=require(_0xaef3('0x9'));var crypto=require(_0xaef3('0xa'));var jsforce=require(_0xaef3('0xb'));var deskjs=require(_0xaef3('0xc'));var toCsv=require(_0xaef3('0xd'));var querystring=require('querystring');var Papa=require(_0xaef3('0xe'));var Redis=require('ioredis');var authService=require(_0xaef3('0xf'));var qs=require(_0xaef3('0x10'));var as=require(_0xaef3('0x11'));var hardwareService=require(_0xaef3('0x12'));var logger=require(_0xaef3('0x13'))(_0xaef3('0x14'));var utils=require('../../config/utils');var config=require(_0xaef3('0x15'));var licenseUtil=require(_0xaef3('0x16'));var db=require(_0xaef3('0x17'))['db'];var integrations=require(_0xaef3('0x18'));function respondWithStatusCode(_0xa272df,_0xef83df){_0xef83df=_0xef83df||0xcc;return function(_0x3633d7){if(_0x3633d7){return _0xa272df[_0xaef3('0x19')](_0xef83df);}return _0xa272df['status'](_0xef83df)['end']();};}function respondWithResult(_0x1bf8b8,_0x24f078){_0x24f078=_0x24f078||0xc8;return function(_0x167a6d){if(_0x167a6d){return _0x1bf8b8[_0xaef3('0x1a')](_0x24f078)['json'](_0x167a6d);}};}function respondWithFilteredResult(_0x11a14d,_0x5b23c5){return function(_0x5d4508){if(_0x5d4508){var _0x79af41=typeof _0x5b23c5[_0xaef3('0x1b')]===_0xaef3('0x1c')&&typeof _0x5b23c5['limit']===_0xaef3('0x1c');var _0x1a380a=_0x5d4508[_0xaef3('0x1d')];var _0x5438b9=_0x79af41?0x0:_0x5b23c5[_0xaef3('0x1b')];var _0x5bd7c6=_0x79af41?_0x5d4508[_0xaef3('0x1d')]:_0x5b23c5[_0xaef3('0x1b')]+_0x5b23c5['limit'];var _0x56e4bb;if(_0x5bd7c6>=_0x1a380a){_0x5bd7c6=_0x1a380a;_0x56e4bb=0xc8;}else{_0x56e4bb=0xce;}_0x11a14d['status'](_0x56e4bb);return _0x11a14d['set'](_0xaef3('0x1e'),_0x5438b9+'-'+_0x5bd7c6+'/'+_0x1a380a)[_0xaef3('0x1f')](_0x5d4508);}return null;};}function patchUpdates(_0x22c246){return function(_0x2b8bf7){try{jsonpatch[_0xaef3('0x20')](_0x2b8bf7,_0x22c246,!![]);}catch(_0x330393){return BPromise['reject'](_0x330393);}return _0x2b8bf7[_0xaef3('0x21')]();};}function saveUpdates(_0x71b05,_0xc55986){return function(_0x2b1297){if(_0x2b1297){return _0x2b1297[_0xaef3('0x22')](_0x71b05)[_0xaef3('0x23')](function(_0x24b970){return _0x24b970;});}return null;};}function removeEntity(_0x5b0796,_0x5f52fc){return function(_0x489d75){if(_0x489d75){return _0x489d75[_0xaef3('0x24')]()[_0xaef3('0x23')](function(){_0x5b0796[_0xaef3('0x1a')](0xcc)[_0xaef3('0x25')]();});}};}function handleEntityNotFound(_0x186783,_0x588c41){return function(_0x51b323){if(!_0x51b323){_0x186783[_0xaef3('0x19')](0x194);}return _0x51b323;};}function handleError(_0xa5079c,_0x33d7de){_0x33d7de=_0x33d7de||0x1f4;return function(_0x68b6c1){logger[_0xaef3('0x26')](_0x68b6c1['stack']);if(_0x68b6c1[_0xaef3('0x27')]){delete _0x68b6c1['name'];}_0xa5079c['status'](_0x33d7de)[_0xaef3('0x28')](_0x68b6c1);};}exports['index']=function(_0x217987,_0x214618){var _0x421d51={},_0xef029d={},_0x463d4e={'count':0x0,'rows':[]};var _0x481265=_[_0xaef3('0x29')](db[_0xaef3('0x2a')][_0xaef3('0x2b')],function(_0x4de6d1){return{'name':_0x4de6d1[_0xaef3('0x2c')],'type':_0x4de6d1[_0xaef3('0x2d')][_0xaef3('0x2e')]};});_0xef029d['model']=_['map'](_0x481265,_0xaef3('0x27'));_0xef029d[_0xaef3('0x2f')]=_[_0xaef3('0x30')](_0x217987[_0xaef3('0x2f')]);_0xef029d[_0xaef3('0x31')]=_[_0xaef3('0x32')](_0xef029d[_0xaef3('0x33')],_0xef029d['query']);_0x421d51['attributes']=_[_0xaef3('0x32')](_0xef029d[_0xaef3('0x33')],qs['fields'](_0x217987[_0xaef3('0x2f')][_0xaef3('0x34')]));_0x421d51[_0xaef3('0x35')]=_0x421d51['attributes'][_0xaef3('0x36')]?_0x421d51[_0xaef3('0x35')]:_0xef029d[_0xaef3('0x33')];if(!_0x217987[_0xaef3('0x2f')][_0xaef3('0x37')](_0xaef3('0x38'))){_0x421d51['limit']=qs['limit'](_0x217987[_0xaef3('0x2f')][_0xaef3('0x39')]);_0x421d51[_0xaef3('0x1b')]=qs[_0xaef3('0x1b')](_0x217987[_0xaef3('0x2f')][_0xaef3('0x1b')]);}_0x421d51[_0xaef3('0x3a')]=qs[_0xaef3('0x3b')](_0x217987[_0xaef3('0x2f')]['sort']);_0x421d51[_0xaef3('0x3c')]=qs[_0xaef3('0x31')](_['pick'](_0x217987['query'],_0xef029d[_0xaef3('0x31')]),_0x481265);if(_0x217987[_0xaef3('0x2f')]['filter']){_0x421d51[_0xaef3('0x3c')]=_[_0xaef3('0x3d')](_0x421d51[_0xaef3('0x3c')],{'$or':_[_0xaef3('0x29')](_0x481265,function(_0x2f1d16){if(_0x2f1d16[_0xaef3('0x2d')]!==_0xaef3('0x3e')){var _0x574b06={};_0x574b06[_0x2f1d16['name']]={'$like':'%'+_0x217987[_0xaef3('0x2f')]['filter']+'%'};return _0x574b06;}})});}_0x421d51=_[_0xaef3('0x3d')]({},_0x421d51,_0x217987[_0xaef3('0x3f')]);var _0x5cb5bb={'where':_0x421d51['where']};return db[_0xaef3('0x2a')][_0xaef3('0x1d')](_0x5cb5bb)['then'](function(_0x220e2a){_0x463d4e[_0xaef3('0x1d')]=_0x220e2a;if(_0x217987[_0xaef3('0x2f')][_0xaef3('0x40')]){_0x421d51['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x421d51);})[_0xaef3('0x23')](function(_0x1131d4){_0x463d4e[_0xaef3('0x41')]=_0x1131d4;return _0x463d4e;})[_0xaef3('0x23')](respondWithFilteredResult(_0x214618,_0x421d51))[_0xaef3('0x42')](handleError(_0x214618,null));};exports['show']=function(_0x1535a1,_0x7d84d0){var _0x427b21={'raw':![],'where':{'id':_0x1535a1[_0xaef3('0x43')]['id']}},_0x4d9ca3={};_0x4d9ca3['model']=_[_0xaef3('0x30')](db[_0xaef3('0x2a')][_0xaef3('0x2b')]);_0x4d9ca3[_0xaef3('0x2f')]=_[_0xaef3('0x30')](_0x1535a1[_0xaef3('0x2f')]);_0x4d9ca3[_0xaef3('0x31')]=_[_0xaef3('0x32')](_0x4d9ca3[_0xaef3('0x33')],_0x4d9ca3[_0xaef3('0x2f')]);_0x427b21[_0xaef3('0x35')]=_[_0xaef3('0x32')](_0x4d9ca3['model'],qs[_0xaef3('0x34')](_0x1535a1[_0xaef3('0x2f')][_0xaef3('0x34')]));_0x427b21[_0xaef3('0x35')]=_0x427b21[_0xaef3('0x35')]['length']?_0x427b21['attributes']:_0x4d9ca3[_0xaef3('0x33')];if(_0x1535a1[_0xaef3('0x2f')][_0xaef3('0x40')]){_0x427b21['include']=[{'all':!![]}];}_0x427b21=_[_0xaef3('0x3d')]({},_0x427b21,_0x1535a1[_0xaef3('0x3f')]);return db['FreshsalesAccount'][_0xaef3('0x44')](_0x427b21)[_0xaef3('0x23')](handleEntityNotFound(_0x7d84d0,null))[_0xaef3('0x23')](respondWithResult(_0x7d84d0,null))['catch'](handleError(_0x7d84d0,null));};exports[_0xaef3('0x45')]=function(_0x44be58,_0x2049c1){return db[_0xaef3('0x2a')][_0xaef3('0x45')](_0x44be58['body'],{})[_0xaef3('0x23')](respondWithResult(_0x2049c1,0xc9))[_0xaef3('0x42')](handleError(_0x2049c1,null));};exports['update']=function(_0x55587f,_0x4021ba){if(_0x55587f[_0xaef3('0x46')]['id']){delete _0x55587f[_0xaef3('0x46')]['id'];}return db[_0xaef3('0x2a')][_0xaef3('0x44')]({'where':{'id':_0x55587f['params']['id']}})['then'](handleEntityNotFound(_0x4021ba,null))[_0xaef3('0x23')](saveUpdates(_0x55587f[_0xaef3('0x46')],null))[_0xaef3('0x23')](respondWithResult(_0x4021ba,null))[_0xaef3('0x42')](handleError(_0x4021ba,null));};exports[_0xaef3('0x24')]=function(_0x230ac9,_0x1d63ba){return db[_0xaef3('0x2a')][_0xaef3('0x44')]({'where':{'id':_0x230ac9['params']['id']}})['then'](handleEntityNotFound(_0x1d63ba,null))[_0xaef3('0x23')](removeEntity(_0x1d63ba,null))[_0xaef3('0x42')](handleError(_0x1d63ba,null));};exports[_0xaef3('0x47')]=function(_0x307a2b,_0xaed9ae,_0x2a0b2c){var _0xe91526={};var _0xd8b818={};var _0x352e89;var _0xa19cdd;return db[_0xaef3('0x2a')][_0xaef3('0x48')]({'where':{'id':_0x307a2b['params']['id']}})[_0xaef3('0x23')](handleEntityNotFound(_0xaed9ae,null))[_0xaef3('0x23')](function(_0x2c8d84){if(_0x2c8d84){_0x352e89=_0x2c8d84;_0xd8b818[_0xaef3('0x33')]=_[_0xaef3('0x30')](db['FreshsalesConfiguration'][_0xaef3('0x2b')]);_0xd8b818['query']=_[_0xaef3('0x30')](_0x307a2b[_0xaef3('0x2f')]);_0xd8b818[_0xaef3('0x31')]=_[_0xaef3('0x32')](_0xd8b818[_0xaef3('0x33')],_0xd8b818[_0xaef3('0x2f')]);_0xe91526[_0xaef3('0x35')]=_[_0xaef3('0x32')](_0xd8b818[_0xaef3('0x33')],qs['fields'](_0x307a2b['query']['fields']));_0xe91526[_0xaef3('0x35')]=_0xe91526['attributes'][_0xaef3('0x36')]?_0xe91526[_0xaef3('0x35')]:_0xd8b818[_0xaef3('0x33')];_0xe91526[_0xaef3('0x3a')]=qs[_0xaef3('0x3b')](_0x307a2b[_0xaef3('0x2f')]['sort']);_0xe91526['where']=qs[_0xaef3('0x31')](_['pick'](_0x307a2b[_0xaef3('0x2f')],_0xd8b818['filters']));if(_0x307a2b['query'][_0xaef3('0x49')]){_0xe91526['where']=_[_0xaef3('0x3d')](_0xe91526['where'],{'$or':_['map'](_0xe91526['attributes'],function(_0x534782){var _0xb0a975={};_0xb0a975[_0x534782]={'$like':'%'+_0x307a2b['query'][_0xaef3('0x49')]+'%'};return _0xb0a975;})});}_0xe91526=_[_0xaef3('0x3d')]({},_0xe91526,_0x307a2b['options']);return _0x352e89[_0xaef3('0x47')](_0xe91526);}})[_0xaef3('0x23')](function(_0x1fee59){if(_0x1fee59){_0xa19cdd=_0x1fee59[_0xaef3('0x36')];if(!_0x307a2b[_0xaef3('0x2f')][_0xaef3('0x37')](_0xaef3('0x38'))){_0xe91526['limit']=qs['limit'](_0x307a2b['query'][_0xaef3('0x39')]);_0xe91526[_0xaef3('0x1b')]=qs[_0xaef3('0x1b')](_0x307a2b[_0xaef3('0x2f')][_0xaef3('0x1b')]);}return _0x352e89[_0xaef3('0x47')](_0xe91526);}})[_0xaef3('0x23')](function(_0x45c6f6){if(_0x45c6f6){return _0x45c6f6?{'count':_0xa19cdd,'rows':_0x45c6f6}:null;}})[_0xaef3('0x23')](respondWithResult(_0xaed9ae,null))[_0xaef3('0x42')](handleError(_0xaed9ae,null));};exports[_0xaef3('0x4a')]=function(_0x5e1667,_0x447576,_0x3eb93b){if(_0x5e1667['body']['id']){delete _0x5e1667[_0xaef3('0x46')]['id'];}return db['FreshsalesAccount'][_0xaef3('0x48')]({'where':{'id':_0x5e1667['params']['id']}})['then'](handleEntityNotFound(_0x447576,null))[_0xaef3('0x23')](function(_0x908ce9){if(_0x908ce9){_0x5e1667[_0xaef3('0x46')][_0xaef3('0x4b')]=_0x908ce9['id'];_0x5e1667[_0xaef3('0x46')][_0xaef3('0x4c')]=integrations[_0xaef3('0x4d')](_0x5e1667[_0xaef3('0x46')][_0xaef3('0x4e')],_0x5e1667[_0xaef3('0x46')][_0xaef3('0x2d')]);_0x5e1667[_0xaef3('0x46')]['Descriptions']=integrations[_0xaef3('0x4f')](_0x5e1667['body'][_0xaef3('0x4e')],_0x5e1667[_0xaef3('0x46')][_0xaef3('0x2d')]);return db['FreshsalesConfiguration'][_0xaef3('0x45')](_0x5e1667[_0xaef3('0x46')],{'include':[{'model':db[_0xaef3('0x50')],'as':_0xaef3('0x4c')},{'model':db['FreshsalesField'],'as':_0xaef3('0x51')}]});}return null;})[_0xaef3('0x23')](respondWithResult(_0x447576,null))[_0xaef3('0x42')](handleError(_0x447576,null));};exports['getFields']=function(_0x2d2985,_0x2d725f,_0x2de80e){var _0x2a86c8='';var _0x2032c9='';return db[_0xaef3('0x2a')][_0xaef3('0x48')]({'where':{'id':_0x2d2985[_0xaef3('0x43')]['id']},'attributes':['id',_0xaef3('0x52'),'remoteUri','apiKey']})[_0xaef3('0x23')](handleEntityNotFound(_0x2d725f,null))[_0xaef3('0x23')](function(_0xd877e4){if(_0xd877e4){_0x2032c9=_0xd877e4[_0xaef3('0x52')];_0x2a86c8=_0xd877e4['remoteUri'];var _0x3c8d75=_0xd877e4['remoteUri']['slice'](-0x1);if(_0x3c8d75==='/'){_0x2a86c8=_0x2a86c8['substring'](0x0,_0x2a86c8[_0xaef3('0x53')](_0x3c8d75));}return rp({'method':_0xaef3('0x54'),'uri':util[_0xaef3('0x55')](_0xaef3('0x56'),_0x2a86c8,_0xaef3('0x57')),'headers':{'Authorization':'Token\x20token='+_0xd877e4[_0xaef3('0x58')]},'json':!![]});}})[_0xaef3('0x23')](function(_0x36c228){if(_0x36c228){var _0x10d99d=_0x36c228[_0xaef3('0x59')];var _0x234468=![];var _0x435a39=null;for(_0x435a39=0x0;_0x435a39<_0x10d99d[_0xaef3('0x36')];_0x435a39++){if(_0x10d99d[_0x435a39]['email']===_0x2032c9){_0x234468=!![];}}if(_0x234468){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x2d725f,null))['catch'](function(_0xcef33c){var _0x3c35b2=_0x2d2985['query'][_0xaef3('0x5a')]?0x1f4:_0xcef33c['statusCode']||0x1f4;logger['error'](_0xaef3('0x5b'),_0xaef3('0x5c'),_0x3c35b2,JSON[_0xaef3('0x5d')](_0xcef33c));delete _0xcef33c[_0xaef3('0x27')];if(_0x3c35b2===0x191){_0x3c35b2=0x190;}_0x2d725f['status'](_0x3c35b2)[_0xaef3('0x28')](_0x2d2985[_0xaef3('0x2f')]['test']?{'message':_0xaef3('0x5e'),'statusCode':_0xcef33c[_0xaef3('0x5f')]}:_0xcef33c);});}; \ No newline at end of file +var _0xaa05=['GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','length','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','FreshsalesConfiguration','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0xaa05,0xe6));var _0x5aa0=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xaa05[_0x3fb9dd];return _0x20136a;};'use strict';var emlformat=require(_0x5aa0('0x0'));var rimraf=require(_0x5aa0('0x1'));var zipdir=require(_0x5aa0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5aa0('0x3'));var moment=require('moment');var BPromise=require(_0x5aa0('0x4'));var Mustache=require(_0x5aa0('0x5'));var util=require(_0x5aa0('0x6'));var path=require(_0x5aa0('0x7'));var sox=require(_0x5aa0('0x8'));var csv=require(_0x5aa0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5aa0('0xa'));var squel=require(_0x5aa0('0xb'));var crypto=require(_0x5aa0('0xc'));var jsforce=require(_0x5aa0('0xd'));var deskjs=require(_0x5aa0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5aa0('0xf'));var Papa=require(_0x5aa0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5aa0('0x11'));var as=require(_0x5aa0('0x12'));var hardwareService=require(_0x5aa0('0x13'));var logger=require(_0x5aa0('0x14'))(_0x5aa0('0x15'));var utils=require(_0x5aa0('0x16'));var config=require(_0x5aa0('0x17'));var licenseUtil=require(_0x5aa0('0x18'));var db=require(_0x5aa0('0x19'))['db'];var integrations=require(_0x5aa0('0x1a'));function respondWithStatusCode(_0x3dafd3,_0x2e0348){_0x2e0348=_0x2e0348||0xcc;return function(_0x51c627){if(_0x51c627){return _0x3dafd3[_0x5aa0('0x1b')](_0x2e0348);}return _0x3dafd3[_0x5aa0('0x1c')](_0x2e0348)[_0x5aa0('0x1d')]();};}function respondWithResult(_0x2c083b,_0x52a11a){_0x52a11a=_0x52a11a||0xc8;return function(_0x1153f9){if(_0x1153f9){return _0x2c083b[_0x5aa0('0x1c')](_0x52a11a)['json'](_0x1153f9);}};}function respondWithFilteredResult(_0x3fdc34,_0xed8c2e){return function(_0x349b73){if(_0x349b73){var _0x35ecfb=typeof _0xed8c2e[_0x5aa0('0x1e')]==='undefined'&&typeof _0xed8c2e['limit']===_0x5aa0('0x1f');var _0xc10045=_0x349b73['count'];var _0x2dec66=_0x35ecfb?0x0:_0xed8c2e['offset'];var _0x3d4e27=_0x35ecfb?_0x349b73[_0x5aa0('0x20')]:_0xed8c2e['offset']+_0xed8c2e[_0x5aa0('0x21')];var _0x3ceb97;if(_0x3d4e27>=_0xc10045){_0x3d4e27=_0xc10045;_0x3ceb97=0xc8;}else{_0x3ceb97=0xce;}_0x3fdc34[_0x5aa0('0x1c')](_0x3ceb97);return _0x3fdc34[_0x5aa0('0x22')](_0x5aa0('0x23'),_0x2dec66+'-'+_0x3d4e27+'/'+_0xc10045)[_0x5aa0('0x24')](_0x349b73);}return null;};}function patchUpdates(_0x406cc9){return function(_0x2327ae){try{jsonpatch[_0x5aa0('0x25')](_0x2327ae,_0x406cc9,!![]);}catch(_0x50de46){return BPromise[_0x5aa0('0x26')](_0x50de46);}return _0x2327ae[_0x5aa0('0x27')]();};}function saveUpdates(_0x1d36fe,_0x26e35f){return function(_0x87d991){if(_0x87d991){return _0x87d991[_0x5aa0('0x28')](_0x1d36fe)[_0x5aa0('0x29')](function(_0x366e09){return _0x366e09;});}return null;};}function removeEntity(_0x3ba504,_0x2e8656){return function(_0x5aad26){if(_0x5aad26){return _0x5aad26['destroy']()[_0x5aa0('0x29')](function(){_0x3ba504[_0x5aa0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f403,_0x312a99){return function(_0x7eaf7e){if(!_0x7eaf7e){_0x22f403[_0x5aa0('0x1b')](0x194);}return _0x7eaf7e;};}function handleError(_0x2abd69,_0x8affa6){_0x8affa6=_0x8affa6||0x1f4;return function(_0x1ffac0){logger[_0x5aa0('0x2a')](_0x1ffac0[_0x5aa0('0x2b')]);if(_0x1ffac0['name']){delete _0x1ffac0[_0x5aa0('0x2c')];}_0x2abd69['status'](_0x8affa6)[_0x5aa0('0x2d')](_0x1ffac0);};}exports[_0x5aa0('0x2e')]=function(_0x3202b4,_0x56568b){var _0x19191d={},_0x279db7={},_0x4db12f={'count':0x0,'rows':[]};var _0x176512=_[_0x5aa0('0x2f')](db[_0x5aa0('0x30')][_0x5aa0('0x31')],function(_0x5e2747){return{'name':_0x5e2747[_0x5aa0('0x32')],'type':_0x5e2747[_0x5aa0('0x33')][_0x5aa0('0x34')]};});_0x279db7[_0x5aa0('0x35')]=_[_0x5aa0('0x2f')](_0x176512,'name');_0x279db7[_0x5aa0('0x36')]=_[_0x5aa0('0x37')](_0x3202b4[_0x5aa0('0x36')]);_0x279db7['filters']=_[_0x5aa0('0x38')](_0x279db7['model'],_0x279db7['query']);_0x19191d[_0x5aa0('0x39')]=_['intersection'](_0x279db7[_0x5aa0('0x35')],qs[_0x5aa0('0x3a')](_0x3202b4['query'][_0x5aa0('0x3a')]));_0x19191d['attributes']=_0x19191d[_0x5aa0('0x39')]['length']?_0x19191d[_0x5aa0('0x39')]:_0x279db7[_0x5aa0('0x35')];if(!_0x3202b4['query'][_0x5aa0('0x3b')]('nolimit')){_0x19191d[_0x5aa0('0x21')]=qs[_0x5aa0('0x21')](_0x3202b4[_0x5aa0('0x36')][_0x5aa0('0x21')]);_0x19191d[_0x5aa0('0x1e')]=qs[_0x5aa0('0x1e')](_0x3202b4['query']['offset']);}_0x19191d[_0x5aa0('0x3c')]=qs[_0x5aa0('0x3d')](_0x3202b4[_0x5aa0('0x36')]['sort']);_0x19191d[_0x5aa0('0x3e')]=qs[_0x5aa0('0x3f')](_[_0x5aa0('0x40')](_0x3202b4[_0x5aa0('0x36')],_0x279db7[_0x5aa0('0x3f')]),_0x176512);if(_0x3202b4[_0x5aa0('0x36')][_0x5aa0('0x41')]){_0x19191d[_0x5aa0('0x3e')]=_['merge'](_0x19191d['where'],{'$or':_[_0x5aa0('0x2f')](_0x176512,function(_0x4e1a83){if(_0x4e1a83['type']!==_0x5aa0('0x42')){var _0x207869={};_0x207869[_0x4e1a83[_0x5aa0('0x2c')]]={'$like':'%'+_0x3202b4[_0x5aa0('0x36')]['filter']+'%'};return _0x207869;}})});}_0x19191d=_[_0x5aa0('0x43')]({},_0x19191d,_0x3202b4['options']);var _0x4b6b40={'where':_0x19191d[_0x5aa0('0x3e')]};return db[_0x5aa0('0x30')]['count'](_0x4b6b40)[_0x5aa0('0x29')](function(_0xf806a1){_0x4db12f['count']=_0xf806a1;if(_0x3202b4['query'][_0x5aa0('0x44')]){_0x19191d[_0x5aa0('0x45')]=[{'all':!![]}];}return db[_0x5aa0('0x30')][_0x5aa0('0x46')](_0x19191d);})['then'](function(_0x3165bb){_0x4db12f[_0x5aa0('0x47')]=_0x3165bb;return _0x4db12f;})[_0x5aa0('0x29')](respondWithFilteredResult(_0x56568b,_0x19191d))[_0x5aa0('0x48')](handleError(_0x56568b,null));};exports[_0x5aa0('0x49')]=function(_0x10709b,_0x257526){var _0x335f64={'raw':![],'where':{'id':_0x10709b[_0x5aa0('0x4a')]['id']}},_0x26cdf4={};_0x26cdf4[_0x5aa0('0x35')]=_['keys'](db[_0x5aa0('0x30')][_0x5aa0('0x31')]);_0x26cdf4[_0x5aa0('0x36')]=_[_0x5aa0('0x37')](_0x10709b[_0x5aa0('0x36')]);_0x26cdf4[_0x5aa0('0x3f')]=_[_0x5aa0('0x38')](_0x26cdf4['model'],_0x26cdf4[_0x5aa0('0x36')]);_0x335f64[_0x5aa0('0x39')]=_[_0x5aa0('0x38')](_0x26cdf4[_0x5aa0('0x35')],qs[_0x5aa0('0x3a')](_0x10709b[_0x5aa0('0x36')][_0x5aa0('0x3a')]));_0x335f64[_0x5aa0('0x39')]=_0x335f64[_0x5aa0('0x39')]['length']?_0x335f64[_0x5aa0('0x39')]:_0x26cdf4[_0x5aa0('0x35')];if(_0x10709b[_0x5aa0('0x36')][_0x5aa0('0x44')]){_0x335f64['include']=[{'all':!![]}];}_0x335f64=_['merge']({},_0x335f64,_0x10709b[_0x5aa0('0x4b')]);return db[_0x5aa0('0x30')][_0x5aa0('0x4c')](_0x335f64)[_0x5aa0('0x29')](handleEntityNotFound(_0x257526,null))['then'](respondWithResult(_0x257526,null))[_0x5aa0('0x48')](handleError(_0x257526,null));};exports[_0x5aa0('0x4d')]=function(_0x9512f5,_0x44262a){return db[_0x5aa0('0x30')][_0x5aa0('0x4d')](_0x9512f5['body'],{})[_0x5aa0('0x29')](respondWithResult(_0x44262a,0xc9))[_0x5aa0('0x48')](handleError(_0x44262a,null));};exports[_0x5aa0('0x28')]=function(_0x4a2f67,_0x13e125){if(_0x4a2f67[_0x5aa0('0x4e')]['id']){delete _0x4a2f67['body']['id'];}return db[_0x5aa0('0x30')][_0x5aa0('0x4c')]({'where':{'id':_0x4a2f67['params']['id']}})['then'](handleEntityNotFound(_0x13e125,null))[_0x5aa0('0x29')](saveUpdates(_0x4a2f67['body'],null))['then'](respondWithResult(_0x13e125,null))[_0x5aa0('0x48')](handleError(_0x13e125,null));};exports[_0x5aa0('0x4f')]=function(_0x27415a,_0x551cab){return db[_0x5aa0('0x30')][_0x5aa0('0x4c')]({'where':{'id':_0x27415a[_0x5aa0('0x4a')]['id']}})[_0x5aa0('0x29')](handleEntityNotFound(_0x551cab,null))[_0x5aa0('0x29')](removeEntity(_0x551cab,null))['catch'](handleError(_0x551cab,null));};exports[_0x5aa0('0x50')]=function(_0x348249,_0x5be60a,_0x223ffb){var _0x4b6a3f={};var _0x3bde36={};var _0x388e63;var _0x5bd360;return db[_0x5aa0('0x30')][_0x5aa0('0x51')]({'where':{'id':_0x348249[_0x5aa0('0x4a')]['id']}})[_0x5aa0('0x29')](handleEntityNotFound(_0x5be60a,null))[_0x5aa0('0x29')](function(_0x1b1218){if(_0x1b1218){_0x388e63=_0x1b1218;_0x3bde36[_0x5aa0('0x35')]=_[_0x5aa0('0x37')](db['FreshsalesConfiguration'][_0x5aa0('0x31')]);_0x3bde36[_0x5aa0('0x36')]=_[_0x5aa0('0x37')](_0x348249[_0x5aa0('0x36')]);_0x3bde36[_0x5aa0('0x3f')]=_[_0x5aa0('0x38')](_0x3bde36['model'],_0x3bde36[_0x5aa0('0x36')]);_0x4b6a3f[_0x5aa0('0x39')]=_['intersection'](_0x3bde36[_0x5aa0('0x35')],qs[_0x5aa0('0x3a')](_0x348249[_0x5aa0('0x36')][_0x5aa0('0x3a')]));_0x4b6a3f[_0x5aa0('0x39')]=_0x4b6a3f[_0x5aa0('0x39')][_0x5aa0('0x52')]?_0x4b6a3f[_0x5aa0('0x39')]:_0x3bde36[_0x5aa0('0x35')];_0x4b6a3f[_0x5aa0('0x3c')]=qs['sort'](_0x348249[_0x5aa0('0x36')][_0x5aa0('0x3d')]);_0x4b6a3f[_0x5aa0('0x3e')]=qs['filters'](_[_0x5aa0('0x40')](_0x348249[_0x5aa0('0x36')],_0x3bde36[_0x5aa0('0x3f')]));if(_0x348249[_0x5aa0('0x36')][_0x5aa0('0x41')]){_0x4b6a3f[_0x5aa0('0x3e')]=_[_0x5aa0('0x43')](_0x4b6a3f[_0x5aa0('0x3e')],{'$or':_[_0x5aa0('0x2f')](_0x4b6a3f[_0x5aa0('0x39')],function(_0x181f62){var _0x22c064={};_0x22c064[_0x181f62]={'$like':'%'+_0x348249['query'][_0x5aa0('0x41')]+'%'};return _0x22c064;})});}_0x4b6a3f=_[_0x5aa0('0x43')]({},_0x4b6a3f,_0x348249[_0x5aa0('0x4b')]);return _0x388e63[_0x5aa0('0x50')](_0x4b6a3f);}})[_0x5aa0('0x29')](function(_0x4cced6){if(_0x4cced6){_0x5bd360=_0x4cced6['length'];if(!_0x348249[_0x5aa0('0x36')][_0x5aa0('0x3b')](_0x5aa0('0x53'))){_0x4b6a3f[_0x5aa0('0x21')]=qs[_0x5aa0('0x21')](_0x348249[_0x5aa0('0x36')][_0x5aa0('0x21')]);_0x4b6a3f[_0x5aa0('0x1e')]=qs[_0x5aa0('0x1e')](_0x348249[_0x5aa0('0x36')][_0x5aa0('0x1e')]);}return _0x388e63[_0x5aa0('0x50')](_0x4b6a3f);}})[_0x5aa0('0x29')](function(_0x1bb5a0){if(_0x1bb5a0){return _0x1bb5a0?{'count':_0x5bd360,'rows':_0x1bb5a0}:null;}})['then'](respondWithResult(_0x5be60a,null))[_0x5aa0('0x48')](handleError(_0x5be60a,null));};exports[_0x5aa0('0x54')]=function(_0x5949ae,_0x5ca1a6,_0x7b3fa6){if(_0x5949ae['body']['id']){delete _0x5949ae[_0x5aa0('0x4e')]['id'];}return db['FreshsalesAccount'][_0x5aa0('0x51')]({'where':{'id':_0x5949ae['params']['id']}})['then'](handleEntityNotFound(_0x5ca1a6,null))[_0x5aa0('0x29')](function(_0x3a98c9){if(_0x3a98c9){_0x5949ae[_0x5aa0('0x4e')][_0x5aa0('0x55')]=_0x3a98c9['id'];_0x5949ae[_0x5aa0('0x4e')][_0x5aa0('0x56')]=integrations['getSubjects'](_0x5949ae[_0x5aa0('0x4e')]['channel'],_0x5949ae['body'][_0x5aa0('0x33')]);_0x5949ae['body'][_0x5aa0('0x57')]=integrations[_0x5aa0('0x58')](_0x5949ae[_0x5aa0('0x4e')]['channel'],_0x5949ae[_0x5aa0('0x4e')][_0x5aa0('0x33')]);return db[_0x5aa0('0x59')][_0x5aa0('0x4d')](_0x5949ae[_0x5aa0('0x4e')],{'include':[{'model':db['FreshsalesField'],'as':_0x5aa0('0x56')},{'model':db['FreshsalesField'],'as':_0x5aa0('0x57')}]});}return null;})[_0x5aa0('0x29')](respondWithResult(_0x5ca1a6,null))[_0x5aa0('0x48')](handleError(_0x5ca1a6,null));};exports[_0x5aa0('0x5a')]=function(_0x333f39,_0x100f3c,_0x4a1bd7){var _0x4d1fa0='';var _0x465cc6='';return db[_0x5aa0('0x30')]['findOne']({'where':{'id':_0x333f39[_0x5aa0('0x4a')]['id']},'attributes':['id',_0x5aa0('0x5b'),_0x5aa0('0x5c'),_0x5aa0('0x5d')]})[_0x5aa0('0x29')](handleEntityNotFound(_0x100f3c,null))[_0x5aa0('0x29')](function(_0x6c09b6){if(_0x6c09b6){_0x465cc6=_0x6c09b6[_0x5aa0('0x5b')];_0x4d1fa0=_0x6c09b6['remoteUri'];var _0x177d99=_0x6c09b6['remoteUri'][_0x5aa0('0x5e')](-0x1);if(_0x177d99==='/'){_0x4d1fa0=_0x4d1fa0[_0x5aa0('0x5f')](0x0,_0x4d1fa0[_0x5aa0('0x60')](_0x177d99));}return rp({'method':_0x5aa0('0x61'),'uri':util[_0x5aa0('0x62')](_0x5aa0('0x63'),_0x4d1fa0,_0x5aa0('0x64')),'headers':{'Authorization':'Token\x20token='+_0x6c09b6[_0x5aa0('0x5d')]},'json':!![]});}})[_0x5aa0('0x29')](function(_0x236b09){if(_0x236b09){var _0x2f1af6=_0x236b09[_0x5aa0('0x65')];var _0x276fda=![];var _0x1c17c0=null;for(_0x1c17c0=0x0;_0x1c17c0<_0x2f1af6[_0x5aa0('0x52')];_0x1c17c0++){if(_0x2f1af6[_0x1c17c0][_0x5aa0('0x66')]===_0x465cc6){_0x276fda=!![];}}if(_0x276fda){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5aa0('0x67')});}}})[_0x5aa0('0x29')](respondWithResult(_0x100f3c,null))[_0x5aa0('0x48')](function(_0x4b5819){var _0x1208ee=_0x333f39['query'][_0x5aa0('0x68')]?0x1f4:_0x4b5819['statusCode']||0x1f4;logger[_0x5aa0('0x2a')](_0x5aa0('0x69'),'getFields',_0x1208ee,JSON[_0x5aa0('0x6a')](_0x4b5819));delete _0x4b5819[_0x5aa0('0x2c')];if(_0x1208ee===0x191){_0x1208ee=0x190;}_0x100f3c[_0x5aa0('0x1c')](_0x1208ee)[_0x5aa0('0x2d')](_0x333f39['query'][_0x5aa0('0x68')]?{'message':_0x5aa0('0x6b'),'statusCode':_0x4b5819[_0x5aa0('0x6c')]}:_0x4b5819);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e7235a1..2c118db 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 _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x96e0b2,_0x198920){var _0x1f68d1=function(_0x235550){while(--_0x235550){_0x96e0b2['push'](_0x96e0b2['shift']());}};_0x1f68d1(++_0x198920);}(_0x9536,0x179));var _0x6953=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0x9536[_0x3132e8];return _0x43eb8c;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));var integrations=require(_0x6953('0x9'));module['exports']=function(_0x2b273e,_0x2bb026){return _0x2b273e[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xfcf0,0x138));var _0x0fcf=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xfcf0[_0x51e79c];return _0x2467be;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));var integrations=require(_0x0fcf('0x9'));module[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return _0x1a7b03[_0x0fcf('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x0fcf('0xc'),'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 c0f7cbd..45471cc 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 _0x4991=['where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw'];(function(_0x35aa31,_0x1a898d){var _0x4afc40=function(_0x522ebd){while(--_0x522ebd){_0x35aa31['push'](_0x35aa31['shift']());}};_0x4afc40(++_0x1a898d);}(_0x4991,0xf7));var _0x1499=function(_0x281ca5,_0x46f921){_0x281ca5=_0x281ca5-0x0;var _0x796a84=_0x4991[_0x281ca5];return _0x796a84;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['FreshsalesAccount'][_0x1499('0x16')]({'raw':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'limit':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1b')]||null:null,'include':_0x1e45a9[_0x1499('0x17')]?_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x1e45a9[_0x1499('0x17')][_0x1499('0x1c')],function(_0x2c7f57){return{'model':db[_0x2c7f57['model']],'as':_0x2c7f57['as'],'attributes':_0x2c7f57[_0x1499('0x1a')],'include':_0x2c7f57[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x2c7f57[_0x1499('0x1c')],function(_0x3968e0){return{'model':db[_0x3968e0[_0x1499('0x1e')]],'as':_0x3968e0['as'],'attributes':_0x3968e0['attributes'],'include':_0x3968e0['include']?_[_0x1499('0x1d')](_0x3968e0[_0x1499('0x1c')],function(_0x3b9259){return{'model':db[_0x3b9259[_0x1499('0x1e')]],'as':_0x3b9259['as'],'attributes':_0x3b9259[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5ed1){logger['info']('GetFreshsalesAccount',_0x1e45a9);logger['debug'](_0x1499('0x15'),_0x1e45a9,JSON[_0x1499('0x11')](_0x3e5ed1));_0x5b9859(_0x3e5ed1);})[_0x1499('0x1f')](function(_0x1b460b){logger[_0x1499('0x12')](_0x1499('0x15'),_0x1b460b[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533['error'](0x1f4,_0x1b460b[_0x1499('0x13')]));});});};exports[_0x1499('0x20')]=function(_0x39995b){var _0x5b59ea=this;return new Promise(function(_0x2dae84,_0x16466c){return db['FreshsalesAccount'][_0x1499('0x21')]({'raw':_0x39995b[_0x1499('0x17')]?_0x39995b['options'][_0x1499('0x18')]===undefined?!![]:![]:!![],'where':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x19')]||null:null,'attributes':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1a')]||null:null,'include':_0x39995b[_0x1499('0x17')]?_0x39995b[_0x1499('0x17')][_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x39995b[_0x1499('0x17')][_0x1499('0x1c')],function(_0x3f4c1a){return{'model':db[_0x3f4c1a[_0x1499('0x1e')]],'as':_0x3f4c1a['as'],'attributes':_0x3f4c1a[_0x1499('0x1a')],'include':_0x3f4c1a[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x3f4c1a[_0x1499('0x1c')],function(_0x29e89e){return{'model':db[_0x29e89e['model']],'as':_0x29e89e['as'],'attributes':_0x29e89e[_0x1499('0x1a')],'include':_0x29e89e[_0x1499('0x1c')]?_[_0x1499('0x1d')](_0x29e89e[_0x1499('0x1c')],function(_0x31251c){return{'model':db[_0x31251c[_0x1499('0x1e')]],'as':_0x31251c['as'],'attributes':_0x31251c[_0x1499('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1499('0xc')](function(_0x12cf93){logger[_0x1499('0xd')](_0x1499('0x20'),_0x39995b);logger['debug']('ShowFreshsalesAccount',_0x39995b,JSON[_0x1499('0x11')](_0x12cf93));_0x2dae84(_0x12cf93);})['catch'](function(_0x29bb8f){logger['error'](_0x1499('0x20'),_0x29bb8f[_0x1499('0x13')],_0x39995b);_0x16466c(_0x5b59ea[_0x1499('0x12')](0x1f4,_0x29bb8f[_0x1499('0x13')]));});});}; \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshsalesAccount','lodash','util'];(function(_0x37a4e1,_0x5d1a15){var _0x414a5d=function(_0x8cf7da){while(--_0x8cf7da){_0x37a4e1['push'](_0x37a4e1['shift']());}};_0x414a5d(++_0x5d1a15);}(_0xdb28,0x106));var _0x8db2=function(_0x5d5334,_0x26e21d){_0x5d5334=_0x5d5334-0x0;var _0x1e842b=_0xdb28[_0x5d5334];return _0x1e842b;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['FreshsalesAccount'][_0x8db2('0x17')]({'raw':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x19')]===undefined?!![]:![]:!![],'where':_0x3fddc2['options']?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1a')]||null:null,'attributes':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1b')]||null:null,'limit':_0x3fddc2['options']?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1c')]||null:null,'include':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x3fddc2[_0x8db2('0x18')]['include'],function(_0x256202){return{'model':db[_0x256202['model']],'as':_0x256202['as'],'attributes':_0x256202['attributes'],'include':_0x256202['include']?_['map'](_0x256202[_0x8db2('0x1d')],function(_0x29b5cd){return{'model':db[_0x29b5cd[_0x8db2('0x1f')]],'as':_0x29b5cd['as'],'attributes':_0x29b5cd[_0x8db2('0x1b')],'include':_0x29b5cd[_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x29b5cd['include'],function(_0x3544ba){return{'model':db[_0x3544ba[_0x8db2('0x1f')]],'as':_0x3544ba['as'],'attributes':_0x3544ba[_0x8db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0xc')](function(_0x483aee){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')](_0x8db2('0x16'),_0x3fddc2,JSON[_0x8db2('0x10')](_0x483aee));_0x46ce14(_0x483aee);})[_0x8db2('0x15')](function(_0xa54ea3){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0xa54ea3['message'],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0xa54ea3['message']));});});};exports['ShowFreshsalesAccount']=function(_0x302188){var _0x25ed2c=this;return new Promise(function(_0xcc8a66,_0x49b2b3){return db[_0x8db2('0x20')]['find']({'raw':_0x302188[_0x8db2('0x18')]?_0x302188[_0x8db2('0x18')][_0x8db2('0x19')]===undefined?!![]:![]:!![],'where':_0x302188['options']?_0x302188['options'][_0x8db2('0x1a')]||null:null,'attributes':_0x302188[_0x8db2('0x18')]?_0x302188['options']['attributes']||null:null,'include':_0x302188[_0x8db2('0x18')]?_0x302188[_0x8db2('0x18')][_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x302188[_0x8db2('0x18')][_0x8db2('0x1d')],function(_0x101711){return{'model':db[_0x101711[_0x8db2('0x1f')]],'as':_0x101711['as'],'attributes':_0x101711[_0x8db2('0x1b')],'include':_0x101711[_0x8db2('0x1d')]?_['map'](_0x101711[_0x8db2('0x1d')],function(_0x304a72){return{'model':db[_0x304a72['model']],'as':_0x304a72['as'],'attributes':_0x304a72[_0x8db2('0x1b')],'include':_0x304a72[_0x8db2('0x1d')]?_['map'](_0x304a72['include'],function(_0x3c1983){return{'model':db[_0x3c1983['model']],'as':_0x3c1983['as'],'attributes':_0x3c1983[_0x8db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0xc')](function(_0x26717d){logger[_0x8db2('0x14')]('ShowFreshsalesAccount',_0x302188);logger[_0x8db2('0xf')]('ShowFreshsalesAccount',_0x302188,JSON[_0x8db2('0x10')](_0x26717d));_0xcc8a66(_0x26717d);})[_0x8db2('0x15')](function(_0x2c8bc9){logger[_0x8db2('0x11')]('ShowFreshsalesAccount',_0x2c8bc9['message'],_0x302188);_0x49b2b3(_0x25ed2c[_0x8db2('0x11')](0x1f4,_0x2c8bc9[_0x8db2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index fc82bf6..ca15c6f 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 _0x9ad1=['create','put','update','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','getSubjects','getDescriptions','/:id/fields','getFields','post'];(function(_0x5baa6d,_0x32779d){var _0xef22e2=function(_0x8edadd){while(--_0x8edadd){_0x5baa6d['push'](_0x5baa6d['shift']());}};_0xef22e2(++_0x32779d);}(_0x9ad1,0x15a));var _0x19ad=function(_0x45d04a,_0x3fb67e){_0x45d04a=_0x45d04a-0x0;var _0x353a4e=_0x9ad1[_0x45d04a];return _0x353a4e;};'use strict';var multer=require(_0x19ad('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x19ad('0x1'));var express=require(_0x19ad('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x19ad('0x3'));var interaction=require(_0x19ad('0x4'));var config=require(_0x19ad('0x5'));var controller=require(_0x19ad('0x6'));router[_0x19ad('0x7')]('/',auth[_0x19ad('0x8')](),controller['index']);router[_0x19ad('0x7')](_0x19ad('0x9'),auth[_0x19ad('0x8')](),controller['show']);router[_0x19ad('0x7')]('/:id/subjects',auth[_0x19ad('0x8')](),controller[_0x19ad('0xa')]);router[_0x19ad('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x19ad('0xb')]);router['get'](_0x19ad('0xc'),auth[_0x19ad('0x8')](),controller[_0x19ad('0xd')]);router[_0x19ad('0xe')]('/',auth[_0x19ad('0x8')](),controller[_0x19ad('0xf')]);router[_0x19ad('0x10')](_0x19ad('0x9'),auth[_0x19ad('0x8')](),controller[_0x19ad('0x11')]);router['delete'](_0x19ad('0x9'),auth[_0x19ad('0x8')](),controller['destroy']);module[_0x19ad('0x12')]=router; \ No newline at end of file +var _0xbce1=['show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated'];(function(_0x24ab82,_0x3078f3){var _0x2f27ca=function(_0x41de37){while(--_0x41de37){_0x24ab82['push'](_0x24ab82['shift']());}};_0x2f27ca(++_0x3078f3);}(_0xbce1,0xfc));var _0x1bce=function(_0x8a29e0,_0x351328){_0x8a29e0=_0x8a29e0-0x0;var _0x485218=_0xbce1[_0x8a29e0];return _0x485218;};'use strict';var multer=require(_0x1bce('0x0'));var util=require(_0x1bce('0x1'));var path=require('path');var timeout=require(_0x1bce('0x2'));var express=require(_0x1bce('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1bce('0x4'));var interaction=require(_0x1bce('0x5'));var config=require(_0x1bce('0x6'));var controller=require(_0x1bce('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1bce('0x8')]);router[_0x1bce('0x9')](_0x1bce('0xa'),auth[_0x1bce('0xb')](),controller[_0x1bce('0xc')]);router['get'](_0x1bce('0xd'),auth[_0x1bce('0xb')](),controller['getSubjects']);router[_0x1bce('0x9')](_0x1bce('0xe'),auth[_0x1bce('0xb')](),controller[_0x1bce('0xf')]);router[_0x1bce('0x9')](_0x1bce('0x10'),auth[_0x1bce('0xb')](),controller['getFields']);router[_0x1bce('0x11')]('/',auth[_0x1bce('0xb')](),controller[_0x1bce('0x12')]);router[_0x1bce('0x13')](_0x1bce('0xa'),auth['isAuthenticated'](),controller[_0x1bce('0x14')]);router[_0x1bce('0x15')]('/:id',auth[_0x1bce('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 9c75c0a..a9e0249 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 _0x4e6d=['sequelize','exports','STRING'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x4e6d,0xfc));var _0xd4e6=function(_0xab0515,_0x4b8ab2){_0xab0515=_0xab0515-0x0;var _0x443d59=_0x4e6d[_0xab0515];return _0x443d59;};'use strict';var Sequelize=require(_0xd4e6('0x0'));module[_0xd4e6('0x1')]={'name':{'type':Sequelize[_0xd4e6('0x2')]},'description':{'type':Sequelize[_0xd4e6('0x2')]}}; \ No newline at end of file +var _0x50ea=['sequelize','exports','STRING'];(function(_0x258c47,_0x864edd){var _0x239d3a=function(_0x57c285){while(--_0x57c285){_0x258c47['push'](_0x258c47['shift']());}};_0x239d3a(++_0x864edd);}(_0x50ea,0x99));var _0xa50e=function(_0x28ae59,_0x2d67a7){_0x28ae59=_0x28ae59-0x0;var _0x51e4ed=_0x50ea[_0x28ae59];return _0x51e4ed;};'use strict';var Sequelize=require(_0xa50e('0x0'));module[_0xa50e('0x1')]={'name':{'type':Sequelize[_0xa50e('0x2')]},'description':{'type':Sequelize[_0xa50e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 2f6e3aa..766da44 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 _0x0565=['create','body','FreshsalesField','getSubjects','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','FreshsalesConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','find','catch'];(function(_0x40f2a8,_0x44a2ba){var _0x5ae307=function(_0xb509af){while(--_0xb509af){_0x40f2a8['push'](_0x40f2a8['shift']());}};_0x5ae307(++_0x44a2ba);}(_0x0565,0x1e6));var _0x5056=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x0565[_0x9fd887];return _0x1a54ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5056('0x0'));var zipdir=require(_0x5056('0x1'));var jsonpatch=require(_0x5056('0x2'));var rp=require(_0x5056('0x3'));var moment=require(_0x5056('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5056('0x5'));var util=require(_0x5056('0x6'));var path=require(_0x5056('0x7'));var sox=require(_0x5056('0x8'));var csv=require(_0x5056('0x9'));var ejs=require(_0x5056('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5056('0xb'));var squel=require(_0x5056('0xc'));var crypto=require(_0x5056('0xd'));var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5056('0x10'));var qs=require(_0x5056('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x12'));var logger=require(_0x5056('0x13'))(_0x5056('0x14'));var utils=require(_0x5056('0x15'));var config=require(_0x5056('0x16'));var licenseUtil=require(_0x5056('0x17'));var db=require(_0x5056('0x18'))['db'];function respondWithStatusCode(_0x42bfb5,_0x4babe0){_0x4babe0=_0x4babe0||0xcc;return function(_0x2c949b){if(_0x2c949b){return _0x42bfb5[_0x5056('0x19')](_0x4babe0);}return _0x42bfb5['status'](_0x4babe0)[_0x5056('0x1a')]();};}function respondWithResult(_0x1a8012,_0x591b29){_0x591b29=_0x591b29||0xc8;return function(_0x4399e4){if(_0x4399e4){return _0x1a8012[_0x5056('0x1b')](_0x591b29)[_0x5056('0x1c')](_0x4399e4);}};}function respondWithFilteredResult(_0x40821f,_0x1253b0){return function(_0x4a677d){if(_0x4a677d){var _0x2de184=typeof _0x1253b0[_0x5056('0x1d')]==='undefined'&&typeof _0x1253b0[_0x5056('0x1e')]===_0x5056('0x1f');var _0x15c494=_0x4a677d['count'];var _0xb2e6e7=_0x2de184?0x0:_0x1253b0[_0x5056('0x1d')];var _0x413219=_0x2de184?_0x4a677d[_0x5056('0x20')]:_0x1253b0[_0x5056('0x1d')]+_0x1253b0[_0x5056('0x1e')];var _0x5cf589;if(_0x413219>=_0x15c494){_0x413219=_0x15c494;_0x5cf589=0xc8;}else{_0x5cf589=0xce;}_0x40821f[_0x5056('0x1b')](_0x5cf589);return _0x40821f[_0x5056('0x21')](_0x5056('0x22'),_0xb2e6e7+'-'+_0x413219+'/'+_0x15c494)[_0x5056('0x1c')](_0x4a677d);}return null;};}function patchUpdates(_0x79d84){return function(_0x56aa52){try{jsonpatch[_0x5056('0x23')](_0x56aa52,_0x79d84,!![]);}catch(_0x591ba4){return BPromise['reject'](_0x591ba4);}return _0x56aa52[_0x5056('0x24')]();};}function saveUpdates(_0x177fb5,_0x166259){return function(_0x20eb92){if(_0x20eb92){return _0x20eb92[_0x5056('0x25')](_0x177fb5)[_0x5056('0x26')](function(_0x2f6836){return _0x2f6836;});}return null;};}function removeEntity(_0x40fbcd,_0x4ae7a9){return function(_0xdc14d4){if(_0xdc14d4){return _0xdc14d4[_0x5056('0x27')]()[_0x5056('0x26')](function(){_0x40fbcd[_0x5056('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bf8b3,_0x45e7b1){return function(_0x325eb8){if(!_0x325eb8){_0x3bf8b3['sendStatus'](0x194);}return _0x325eb8;};}function handleError(_0x3ba152,_0x234dbd){_0x234dbd=_0x234dbd||0x1f4;return function(_0x16d364){logger[_0x5056('0x28')](_0x16d364[_0x5056('0x29')]);if(_0x16d364['name']){delete _0x16d364[_0x5056('0x2a')];}_0x3ba152[_0x5056('0x1b')](_0x234dbd)[_0x5056('0x2b')](_0x16d364);};}exports['index']=function(_0x1d05e,_0x267777){var _0x23b998={},_0x8c330b={},_0x3242f0={'count':0x0,'rows':[]};var _0x598a87=_['map'](db[_0x5056('0x2c')][_0x5056('0x2d')],function(_0x2c70ac){return{'name':_0x2c70ac[_0x5056('0x2e')],'type':_0x2c70ac['type'][_0x5056('0x2f')]};});_0x8c330b[_0x5056('0x30')]=_[_0x5056('0x31')](_0x598a87,_0x5056('0x2a'));_0x8c330b[_0x5056('0x32')]=_[_0x5056('0x33')](_0x1d05e[_0x5056('0x32')]);_0x8c330b[_0x5056('0x34')]=_[_0x5056('0x35')](_0x8c330b[_0x5056('0x30')],_0x8c330b[_0x5056('0x32')]);_0x23b998[_0x5056('0x36')]=_[_0x5056('0x35')](_0x8c330b[_0x5056('0x30')],qs[_0x5056('0x37')](_0x1d05e['query'][_0x5056('0x37')]));_0x23b998[_0x5056('0x36')]=_0x23b998[_0x5056('0x36')][_0x5056('0x38')]?_0x23b998[_0x5056('0x36')]:_0x8c330b[_0x5056('0x30')];if(!_0x1d05e['query'][_0x5056('0x39')](_0x5056('0x3a'))){_0x23b998[_0x5056('0x1e')]=qs[_0x5056('0x1e')](_0x1d05e[_0x5056('0x32')][_0x5056('0x1e')]);_0x23b998['offset']=qs[_0x5056('0x1d')](_0x1d05e[_0x5056('0x32')][_0x5056('0x1d')]);}_0x23b998[_0x5056('0x3b')]=qs['sort'](_0x1d05e[_0x5056('0x32')][_0x5056('0x3c')]);_0x23b998[_0x5056('0x3d')]=qs[_0x5056('0x34')](_[_0x5056('0x3e')](_0x1d05e['query'],_0x8c330b[_0x5056('0x34')]),_0x598a87);if(_0x1d05e[_0x5056('0x32')][_0x5056('0x3f')]){_0x23b998['where']=_[_0x5056('0x40')](_0x23b998[_0x5056('0x3d')],{'$or':_[_0x5056('0x31')](_0x598a87,function(_0x11339d){if(_0x11339d[_0x5056('0x41')]!==_0x5056('0x42')){var _0x3c46fc={};_0x3c46fc[_0x11339d['name']]={'$like':'%'+_0x1d05e[_0x5056('0x32')][_0x5056('0x3f')]+'%'};return _0x3c46fc;}})});}_0x23b998=_[_0x5056('0x40')]({},_0x23b998,_0x1d05e[_0x5056('0x43')]);var _0x5a3ef0={'where':_0x23b998[_0x5056('0x3d')]};return db[_0x5056('0x2c')]['count'](_0x5a3ef0)[_0x5056('0x26')](function(_0x26e5b2){_0x3242f0['count']=_0x26e5b2;if(_0x1d05e[_0x5056('0x32')][_0x5056('0x44')]){_0x23b998[_0x5056('0x45')]=[{'all':!![]}];}return db[_0x5056('0x2c')][_0x5056('0x46')](_0x23b998);})[_0x5056('0x26')](function(_0x5ada35){_0x3242f0['rows']=_0x5ada35;return _0x3242f0;})['then'](respondWithFilteredResult(_0x267777,_0x23b998))['catch'](handleError(_0x267777,null));};exports['show']=function(_0x2f4e86,_0xd726e9){var _0x2b7bf8={'raw':![],'where':{'id':_0x2f4e86[_0x5056('0x47')]['id']}},_0x4d693a={};_0x4d693a[_0x5056('0x30')]=_[_0x5056('0x33')](db[_0x5056('0x2c')]['rawAttributes']);_0x4d693a[_0x5056('0x32')]=_[_0x5056('0x33')](_0x2f4e86[_0x5056('0x32')]);_0x4d693a[_0x5056('0x34')]=_[_0x5056('0x35')](_0x4d693a[_0x5056('0x30')],_0x4d693a[_0x5056('0x32')]);_0x2b7bf8[_0x5056('0x36')]=_[_0x5056('0x35')](_0x4d693a['model'],qs[_0x5056('0x37')](_0x2f4e86[_0x5056('0x32')][_0x5056('0x37')]));_0x2b7bf8[_0x5056('0x36')]=_0x2b7bf8['attributes'][_0x5056('0x38')]?_0x2b7bf8[_0x5056('0x36')]:_0x4d693a[_0x5056('0x30')];if(_0x2f4e86[_0x5056('0x32')]['includeAll']){_0x2b7bf8[_0x5056('0x45')]=[{'all':!![]}];}_0x2b7bf8=_[_0x5056('0x40')]({},_0x2b7bf8,_0x2f4e86[_0x5056('0x43')]);return db[_0x5056('0x2c')][_0x5056('0x48')](_0x2b7bf8)['then'](handleEntityNotFound(_0xd726e9,null))[_0x5056('0x26')](respondWithResult(_0xd726e9,null))[_0x5056('0x49')](handleError(_0xd726e9,null));};exports[_0x5056('0x4a')]=function(_0x473b4f,_0xc0ecb4){return db[_0x5056('0x2c')]['create'](_0x473b4f['body'],{})[_0x5056('0x26')](respondWithResult(_0xc0ecb4,0xc9))[_0x5056('0x49')](handleError(_0xc0ecb4,null));};exports['update']=function(_0x2a6ad0,_0x27f1a9){if(_0x2a6ad0[_0x5056('0x4b')]['id']){delete _0x2a6ad0['body']['id'];}return db['FreshsalesConfiguration'][_0x5056('0x48')]({'where':{'id':_0x2a6ad0[_0x5056('0x47')]['id']}})[_0x5056('0x26')](handleEntityNotFound(_0x27f1a9,null))[_0x5056('0x26')](saveUpdates(_0x2a6ad0[_0x5056('0x4b')],null))[_0x5056('0x26')](respondWithResult(_0x27f1a9,null))['catch'](handleError(_0x27f1a9,null));};exports['destroy']=function(_0x13f4f6,_0xc92005){return db[_0x5056('0x2c')][_0x5056('0x48')]({'where':{'id':_0x13f4f6[_0x5056('0x47')]['id']}})['then'](handleEntityNotFound(_0xc92005,null))['then'](removeEntity(_0xc92005,null))[_0x5056('0x49')](handleError(_0xc92005,null));};exports['getSubjects']=function(_0x38477a,_0x57a1a1,_0x4d4654){var _0x614892={};var _0x51ce37={};var _0x154ca6;var _0x530005;return db[_0x5056('0x2c')]['findOne']({'where':{'id':_0x38477a[_0x5056('0x47')]['id']}})[_0x5056('0x26')](handleEntityNotFound(_0x57a1a1,null))[_0x5056('0x26')](function(_0x19b72e){if(_0x19b72e){_0x154ca6=_0x19b72e;_0x51ce37[_0x5056('0x30')]=_['keys'](db[_0x5056('0x4c')][_0x5056('0x2d')]);_0x51ce37[_0x5056('0x32')]=_[_0x5056('0x33')](_0x38477a['query']);_0x51ce37[_0x5056('0x34')]=_[_0x5056('0x35')](_0x51ce37[_0x5056('0x30')],_0x51ce37[_0x5056('0x32')]);_0x614892[_0x5056('0x36')]=_[_0x5056('0x35')](_0x51ce37[_0x5056('0x30')],qs[_0x5056('0x37')](_0x38477a[_0x5056('0x32')][_0x5056('0x37')]));_0x614892[_0x5056('0x36')]=_0x614892['attributes']['length']?_0x614892[_0x5056('0x36')]:_0x51ce37[_0x5056('0x30')];_0x614892[_0x5056('0x3b')]=qs[_0x5056('0x3c')](_0x38477a['query'][_0x5056('0x3c')]);_0x614892[_0x5056('0x3d')]=qs['filters'](_[_0x5056('0x3e')](_0x38477a[_0x5056('0x32')],_0x51ce37[_0x5056('0x34')]));if(_0x38477a[_0x5056('0x32')]['filter']){_0x614892['where']=_[_0x5056('0x40')](_0x614892['where'],{'$or':_[_0x5056('0x31')](_0x614892['attributes'],function(_0x54c508){var _0x3fc0b5={};_0x3fc0b5[_0x54c508]={'$like':'%'+_0x38477a[_0x5056('0x32')][_0x5056('0x3f')]+'%'};return _0x3fc0b5;})});}_0x614892=_[_0x5056('0x40')]({},_0x614892,_0x38477a[_0x5056('0x43')]);return _0x154ca6[_0x5056('0x4d')](_0x614892);}})['then'](function(_0x3a50c3){if(_0x3a50c3){_0x530005=_0x3a50c3[_0x5056('0x38')];if(!_0x38477a['query']['hasOwnProperty'](_0x5056('0x3a'))){_0x614892[_0x5056('0x1e')]=qs[_0x5056('0x1e')](_0x38477a['query'][_0x5056('0x1e')]);_0x614892['offset']=qs['offset'](_0x38477a[_0x5056('0x32')][_0x5056('0x1d')]);}return _0x154ca6[_0x5056('0x4d')](_0x614892);}})[_0x5056('0x26')](function(_0x42105c){if(_0x42105c){return _0x42105c?{'count':_0x530005,'rows':_0x42105c}:null;}})[_0x5056('0x26')](respondWithResult(_0x57a1a1,null))[_0x5056('0x49')](handleError(_0x57a1a1,null));};exports[_0x5056('0x4e')]=function(_0x62529c,_0x3a5c22,_0x515b3a){var _0x161284={};var _0x16765f={};var _0x56b89c;var _0x18b109;return db[_0x5056('0x2c')]['findOne']({'where':{'id':_0x62529c[_0x5056('0x47')]['id']}})[_0x5056('0x26')](handleEntityNotFound(_0x3a5c22,null))['then'](function(_0x543eef){if(_0x543eef){_0x56b89c=_0x543eef;_0x16765f[_0x5056('0x30')]=_[_0x5056('0x33')](db[_0x5056('0x4c')][_0x5056('0x2d')]);_0x16765f[_0x5056('0x32')]=_['keys'](_0x62529c[_0x5056('0x32')]);_0x16765f['filters']=_['intersection'](_0x16765f[_0x5056('0x30')],_0x16765f[_0x5056('0x32')]);_0x161284[_0x5056('0x36')]=_[_0x5056('0x35')](_0x16765f[_0x5056('0x30')],qs['fields'](_0x62529c[_0x5056('0x32')][_0x5056('0x37')]));_0x161284[_0x5056('0x36')]=_0x161284['attributes'][_0x5056('0x38')]?_0x161284[_0x5056('0x36')]:_0x16765f[_0x5056('0x30')];_0x161284[_0x5056('0x3b')]=qs[_0x5056('0x3c')](_0x62529c[_0x5056('0x32')][_0x5056('0x3c')]);_0x161284[_0x5056('0x3d')]=qs[_0x5056('0x34')](_['pick'](_0x62529c['query'],_0x16765f[_0x5056('0x34')]));if(_0x62529c[_0x5056('0x32')][_0x5056('0x3f')]){_0x161284['where']=_[_0x5056('0x40')](_0x161284[_0x5056('0x3d')],{'$or':_[_0x5056('0x31')](_0x161284[_0x5056('0x36')],function(_0x4c3927){var _0x30e9a={};_0x30e9a[_0x4c3927]={'$like':'%'+_0x62529c[_0x5056('0x32')][_0x5056('0x3f')]+'%'};return _0x30e9a;})});}_0x161284=_[_0x5056('0x40')]({},_0x161284,_0x62529c[_0x5056('0x43')]);return _0x56b89c['getDescriptions'](_0x161284);}})[_0x5056('0x26')](function(_0x2e9992){if(_0x2e9992){_0x18b109=_0x2e9992[_0x5056('0x38')];if(!_0x62529c['query'][_0x5056('0x39')]('nolimit')){_0x161284[_0x5056('0x1e')]=qs[_0x5056('0x1e')](_0x62529c[_0x5056('0x32')][_0x5056('0x1e')]);_0x161284['offset']=qs[_0x5056('0x1d')](_0x62529c[_0x5056('0x32')]['offset']);}return _0x56b89c[_0x5056('0x4e')](_0x161284);}})[_0x5056('0x26')](function(_0x4048a4){if(_0x4048a4){return _0x4048a4?{'count':_0x18b109,'rows':_0x4048a4}:null;}})['then'](respondWithResult(_0x3a5c22,null))[_0x5056('0x49')](handleError(_0x3a5c22,null));};exports['getFields']=function(_0x426ed9,_0xb8bcf1,_0x436961){var _0x5f4a49={};var _0x19e6cd={};var _0x11b0bb;var _0x5ce834;return db[_0x5056('0x2c')]['findOne']({'where':{'id':_0x426ed9[_0x5056('0x47')]['id']}})['then'](handleEntityNotFound(_0xb8bcf1,null))['then'](function(_0x1f2119){if(_0x1f2119){_0x11b0bb=_0x1f2119;_0x19e6cd[_0x5056('0x30')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x19e6cd[_0x5056('0x32')]=_[_0x5056('0x33')](_0x426ed9[_0x5056('0x32')]);_0x19e6cd['filters']=_[_0x5056('0x35')](_0x19e6cd[_0x5056('0x30')],_0x19e6cd[_0x5056('0x32')]);_0x5f4a49[_0x5056('0x36')]=_['intersection'](_0x19e6cd[_0x5056('0x30')],qs[_0x5056('0x37')](_0x426ed9[_0x5056('0x32')][_0x5056('0x37')]));_0x5f4a49['attributes']=_0x5f4a49[_0x5056('0x36')][_0x5056('0x38')]?_0x5f4a49[_0x5056('0x36')]:_0x19e6cd[_0x5056('0x30')];_0x5f4a49['order']=qs['sort'](_0x426ed9[_0x5056('0x32')][_0x5056('0x3c')]);_0x5f4a49['where']=qs[_0x5056('0x34')](_[_0x5056('0x3e')](_0x426ed9[_0x5056('0x32')],_0x19e6cd[_0x5056('0x34')]));if(_0x426ed9[_0x5056('0x32')][_0x5056('0x3f')]){_0x5f4a49[_0x5056('0x3d')]=_[_0x5056('0x40')](_0x5f4a49[_0x5056('0x3d')],{'$or':_[_0x5056('0x31')](_0x5f4a49['attributes'],function(_0x320c8d){var _0xba391c={};_0xba391c[_0x320c8d]={'$like':'%'+_0x426ed9[_0x5056('0x32')][_0x5056('0x3f')]+'%'};return _0xba391c;})});}_0x5f4a49=_[_0x5056('0x40')]({},_0x5f4a49,_0x426ed9[_0x5056('0x43')]);return _0x11b0bb[_0x5056('0x4f')](_0x5f4a49);}})['then'](function(_0x51846f){if(_0x51846f){_0x5ce834=_0x51846f[_0x5056('0x38')];if(!_0x426ed9[_0x5056('0x32')]['hasOwnProperty'](_0x5056('0x3a'))){_0x5f4a49[_0x5056('0x1e')]=qs[_0x5056('0x1e')](_0x426ed9[_0x5056('0x32')][_0x5056('0x1e')]);_0x5f4a49[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x426ed9[_0x5056('0x32')][_0x5056('0x1d')]);}return _0x11b0bb[_0x5056('0x4f')](_0x5f4a49);}})['then'](function(_0x3c7f4f){if(_0x3c7f4f){return _0x3c7f4f?{'count':_0x5ce834,'rows':_0x3c7f4f}:null;}})[_0x5056('0x26')](respondWithResult(_0xb8bcf1,null))[_0x5056('0x49')](handleError(_0xb8bcf1,null));}; \ No newline at end of file +var _0xf87c=['getDescriptions','getFields','FreshsalesField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','rows','show','params','include','find','create','body','catch','destroy','getSubjects','findOne','filter','hasOwnProperty'];(function(_0x525bbd,_0x3c3a0f){var _0x4ae62f=function(_0x5dc26f){while(--_0x5dc26f){_0x525bbd['push'](_0x525bbd['shift']());}};_0x4ae62f(++_0x3c3a0f);}(_0xf87c,0x1a2));var _0xcf87=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xf87c[_0x49ca18];return _0x145d54;};'use strict';var emlformat=require(_0xcf87('0x0'));var rimraf=require(_0xcf87('0x1'));var zipdir=require(_0xcf87('0x2'));var jsonpatch=require(_0xcf87('0x3'));var rp=require(_0xcf87('0x4'));var moment=require(_0xcf87('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcf87('0x6'));var util=require(_0xcf87('0x7'));var path=require('path');var sox=require(_0xcf87('0x8'));var csv=require(_0xcf87('0x9'));var ejs=require(_0xcf87('0xa'));var fs=require('fs');var fs_extra=require(_0xcf87('0xb'));var _=require('lodash');var squel=require(_0xcf87('0xc'));var crypto=require(_0xcf87('0xd'));var jsforce=require(_0xcf87('0xe'));var deskjs=require(_0xcf87('0xf'));var toCsv=require(_0xcf87('0x9'));var querystring=require(_0xcf87('0x10'));var Papa=require(_0xcf87('0x11'));var Redis=require(_0xcf87('0x12'));var authService=require(_0xcf87('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcf87('0x14'));var hardwareService=require(_0xcf87('0x15'));var logger=require('../../config/logger')(_0xcf87('0x16'));var utils=require(_0xcf87('0x17'));var config=require(_0xcf87('0x18'));var licenseUtil=require(_0xcf87('0x19'));var db=require(_0xcf87('0x1a'))['db'];function respondWithStatusCode(_0x39d267,_0x43946b){_0x43946b=_0x43946b||0xcc;return function(_0x4fe3bf){if(_0x4fe3bf){return _0x39d267[_0xcf87('0x1b')](_0x43946b);}return _0x39d267[_0xcf87('0x1c')](_0x43946b)[_0xcf87('0x1d')]();};}function respondWithResult(_0x494997,_0x121d72){_0x121d72=_0x121d72||0xc8;return function(_0x115071){if(_0x115071){return _0x494997[_0xcf87('0x1c')](_0x121d72)[_0xcf87('0x1e')](_0x115071);}};}function respondWithFilteredResult(_0x2c7548,_0x2d8f79){return function(_0x49329b){if(_0x49329b){var _0x3fb738=typeof _0x2d8f79[_0xcf87('0x1f')]===_0xcf87('0x20')&&typeof _0x2d8f79[_0xcf87('0x21')]==='undefined';var _0xc016b0=_0x49329b['count'];var _0x572921=_0x3fb738?0x0:_0x2d8f79[_0xcf87('0x1f')];var _0x25c651=_0x3fb738?_0x49329b['count']:_0x2d8f79[_0xcf87('0x1f')]+_0x2d8f79[_0xcf87('0x21')];var _0x3f6c95;if(_0x25c651>=_0xc016b0){_0x25c651=_0xc016b0;_0x3f6c95=0xc8;}else{_0x3f6c95=0xce;}_0x2c7548[_0xcf87('0x1c')](_0x3f6c95);return _0x2c7548['set'](_0xcf87('0x22'),_0x572921+'-'+_0x25c651+'/'+_0xc016b0)[_0xcf87('0x1e')](_0x49329b);}return null;};}function patchUpdates(_0xe055c0){return function(_0x598846){try{jsonpatch[_0xcf87('0x23')](_0x598846,_0xe055c0,!![]);}catch(_0x72a59a){return BPromise[_0xcf87('0x24')](_0x72a59a);}return _0x598846[_0xcf87('0x25')]();};}function saveUpdates(_0x2cc256,_0x103497){return function(_0x4a6b8f){if(_0x4a6b8f){return _0x4a6b8f[_0xcf87('0x26')](_0x2cc256)[_0xcf87('0x27')](function(_0x3f9f9b){return _0x3f9f9b;});}return null;};}function removeEntity(_0x303175,_0x4a8297){return function(_0x4cc30a){if(_0x4cc30a){return _0x4cc30a['destroy']()['then'](function(){_0x303175[_0xcf87('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x472d79,_0x3fd00d){return function(_0x2be804){if(!_0x2be804){_0x472d79[_0xcf87('0x1b')](0x194);}return _0x2be804;};}function handleError(_0x10221d,_0x1498e8){_0x1498e8=_0x1498e8||0x1f4;return function(_0x3d1fb0){logger['error'](_0x3d1fb0[_0xcf87('0x28')]);if(_0x3d1fb0[_0xcf87('0x29')]){delete _0x3d1fb0[_0xcf87('0x29')];}_0x10221d[_0xcf87('0x1c')](_0x1498e8)[_0xcf87('0x2a')](_0x3d1fb0);};}exports['index']=function(_0x24f334,_0x157f7a){var _0x4d202f={},_0x1333ec={},_0x183e01={'count':0x0,'rows':[]};var _0x54f40f=_[_0xcf87('0x2b')](db[_0xcf87('0x2c')][_0xcf87('0x2d')],function(_0x21c320){return{'name':_0x21c320[_0xcf87('0x2e')],'type':_0x21c320[_0xcf87('0x2f')][_0xcf87('0x30')]};});_0x1333ec[_0xcf87('0x31')]=_['map'](_0x54f40f,_0xcf87('0x29'));_0x1333ec[_0xcf87('0x32')]=_[_0xcf87('0x33')](_0x24f334['query']);_0x1333ec[_0xcf87('0x34')]=_[_0xcf87('0x35')](_0x1333ec[_0xcf87('0x31')],_0x1333ec[_0xcf87('0x32')]);_0x4d202f[_0xcf87('0x36')]=_[_0xcf87('0x35')](_0x1333ec[_0xcf87('0x31')],qs[_0xcf87('0x37')](_0x24f334[_0xcf87('0x32')][_0xcf87('0x37')]));_0x4d202f['attributes']=_0x4d202f['attributes'][_0xcf87('0x38')]?_0x4d202f[_0xcf87('0x36')]:_0x1333ec[_0xcf87('0x31')];if(!_0x24f334['query']['hasOwnProperty'](_0xcf87('0x39'))){_0x4d202f[_0xcf87('0x21')]=qs['limit'](_0x24f334[_0xcf87('0x32')][_0xcf87('0x21')]);_0x4d202f[_0xcf87('0x1f')]=qs[_0xcf87('0x1f')](_0x24f334['query'][_0xcf87('0x1f')]);}_0x4d202f[_0xcf87('0x3a')]=qs['sort'](_0x24f334[_0xcf87('0x32')][_0xcf87('0x3b')]);_0x4d202f[_0xcf87('0x3c')]=qs[_0xcf87('0x34')](_[_0xcf87('0x3d')](_0x24f334[_0xcf87('0x32')],_0x1333ec[_0xcf87('0x34')]),_0x54f40f);if(_0x24f334['query']['filter']){_0x4d202f[_0xcf87('0x3c')]=_[_0xcf87('0x3e')](_0x4d202f[_0xcf87('0x3c')],{'$or':_['map'](_0x54f40f,function(_0x24d419){if(_0x24d419['type']!==_0xcf87('0x3f')){var _0x1025ae={};_0x1025ae[_0x24d419[_0xcf87('0x29')]]={'$like':'%'+_0x24f334[_0xcf87('0x32')]['filter']+'%'};return _0x1025ae;}})});}_0x4d202f=_[_0xcf87('0x3e')]({},_0x4d202f,_0x24f334[_0xcf87('0x40')]);var _0x31f31a={'where':_0x4d202f['where']};return db[_0xcf87('0x2c')][_0xcf87('0x41')](_0x31f31a)[_0xcf87('0x27')](function(_0x42175b){_0x183e01[_0xcf87('0x41')]=_0x42175b;if(_0x24f334[_0xcf87('0x32')][_0xcf87('0x42')]){_0x4d202f['include']=[{'all':!![]}];}return db[_0xcf87('0x2c')]['findAll'](_0x4d202f);})[_0xcf87('0x27')](function(_0x2e8b5a){_0x183e01[_0xcf87('0x43')]=_0x2e8b5a;return _0x183e01;})[_0xcf87('0x27')](respondWithFilteredResult(_0x157f7a,_0x4d202f))['catch'](handleError(_0x157f7a,null));};exports[_0xcf87('0x44')]=function(_0x42413a,_0x3b65f5){var _0x2fe7e1={'raw':![],'where':{'id':_0x42413a[_0xcf87('0x45')]['id']}},_0x4fb036={};_0x4fb036[_0xcf87('0x31')]=_[_0xcf87('0x33')](db['FreshsalesConfiguration'][_0xcf87('0x2d')]);_0x4fb036[_0xcf87('0x32')]=_[_0xcf87('0x33')](_0x42413a[_0xcf87('0x32')]);_0x4fb036['filters']=_[_0xcf87('0x35')](_0x4fb036[_0xcf87('0x31')],_0x4fb036[_0xcf87('0x32')]);_0x2fe7e1[_0xcf87('0x36')]=_[_0xcf87('0x35')](_0x4fb036['model'],qs['fields'](_0x42413a[_0xcf87('0x32')][_0xcf87('0x37')]));_0x2fe7e1[_0xcf87('0x36')]=_0x2fe7e1['attributes'][_0xcf87('0x38')]?_0x2fe7e1[_0xcf87('0x36')]:_0x4fb036[_0xcf87('0x31')];if(_0x42413a[_0xcf87('0x32')][_0xcf87('0x42')]){_0x2fe7e1[_0xcf87('0x46')]=[{'all':!![]}];}_0x2fe7e1=_['merge']({},_0x2fe7e1,_0x42413a['options']);return db[_0xcf87('0x2c')][_0xcf87('0x47')](_0x2fe7e1)[_0xcf87('0x27')](handleEntityNotFound(_0x3b65f5,null))[_0xcf87('0x27')](respondWithResult(_0x3b65f5,null))['catch'](handleError(_0x3b65f5,null));};exports[_0xcf87('0x48')]=function(_0x2cd713,_0x5bd140){return db['FreshsalesConfiguration'][_0xcf87('0x48')](_0x2cd713[_0xcf87('0x49')],{})[_0xcf87('0x27')](respondWithResult(_0x5bd140,0xc9))[_0xcf87('0x4a')](handleError(_0x5bd140,null));};exports[_0xcf87('0x26')]=function(_0x38d861,_0x53dffa){if(_0x38d861[_0xcf87('0x49')]['id']){delete _0x38d861[_0xcf87('0x49')]['id'];}return db[_0xcf87('0x2c')][_0xcf87('0x47')]({'where':{'id':_0x38d861[_0xcf87('0x45')]['id']}})['then'](handleEntityNotFound(_0x53dffa,null))['then'](saveUpdates(_0x38d861[_0xcf87('0x49')],null))['then'](respondWithResult(_0x53dffa,null))[_0xcf87('0x4a')](handleError(_0x53dffa,null));};exports[_0xcf87('0x4b')]=function(_0x4c7280,_0x57a396){return db[_0xcf87('0x2c')]['find']({'where':{'id':_0x4c7280[_0xcf87('0x45')]['id']}})['then'](handleEntityNotFound(_0x57a396,null))[_0xcf87('0x27')](removeEntity(_0x57a396,null))[_0xcf87('0x4a')](handleError(_0x57a396,null));};exports[_0xcf87('0x4c')]=function(_0x24ccc3,_0x5de815,_0x32ddee){var _0x5bfb06={};var _0x5c57c5={};var _0x5ce008;var _0x56e60a;return db['FreshsalesConfiguration'][_0xcf87('0x4d')]({'where':{'id':_0x24ccc3[_0xcf87('0x45')]['id']}})[_0xcf87('0x27')](handleEntityNotFound(_0x5de815,null))['then'](function(_0x481ce8){if(_0x481ce8){_0x5ce008=_0x481ce8;_0x5c57c5[_0xcf87('0x31')]=_[_0xcf87('0x33')](db['FreshsalesField'][_0xcf87('0x2d')]);_0x5c57c5[_0xcf87('0x32')]=_[_0xcf87('0x33')](_0x24ccc3[_0xcf87('0x32')]);_0x5c57c5['filters']=_[_0xcf87('0x35')](_0x5c57c5[_0xcf87('0x31')],_0x5c57c5[_0xcf87('0x32')]);_0x5bfb06['attributes']=_[_0xcf87('0x35')](_0x5c57c5[_0xcf87('0x31')],qs[_0xcf87('0x37')](_0x24ccc3[_0xcf87('0x32')]['fields']));_0x5bfb06['attributes']=_0x5bfb06['attributes'][_0xcf87('0x38')]?_0x5bfb06[_0xcf87('0x36')]:_0x5c57c5['model'];_0x5bfb06[_0xcf87('0x3a')]=qs[_0xcf87('0x3b')](_0x24ccc3[_0xcf87('0x32')][_0xcf87('0x3b')]);_0x5bfb06['where']=qs[_0xcf87('0x34')](_['pick'](_0x24ccc3[_0xcf87('0x32')],_0x5c57c5['filters']));if(_0x24ccc3['query'][_0xcf87('0x4e')]){_0x5bfb06[_0xcf87('0x3c')]=_['merge'](_0x5bfb06[_0xcf87('0x3c')],{'$or':_[_0xcf87('0x2b')](_0x5bfb06[_0xcf87('0x36')],function(_0x14b107){var _0x3874fc={};_0x3874fc[_0x14b107]={'$like':'%'+_0x24ccc3[_0xcf87('0x32')]['filter']+'%'};return _0x3874fc;})});}_0x5bfb06=_['merge']({},_0x5bfb06,_0x24ccc3['options']);return _0x5ce008[_0xcf87('0x4c')](_0x5bfb06);}})[_0xcf87('0x27')](function(_0x164025){if(_0x164025){_0x56e60a=_0x164025[_0xcf87('0x38')];if(!_0x24ccc3[_0xcf87('0x32')][_0xcf87('0x4f')]('nolimit')){_0x5bfb06['limit']=qs['limit'](_0x24ccc3[_0xcf87('0x32')]['limit']);_0x5bfb06[_0xcf87('0x1f')]=qs[_0xcf87('0x1f')](_0x24ccc3[_0xcf87('0x32')][_0xcf87('0x1f')]);}return _0x5ce008['getSubjects'](_0x5bfb06);}})['then'](function(_0x40cfd4){if(_0x40cfd4){return _0x40cfd4?{'count':_0x56e60a,'rows':_0x40cfd4}:null;}})[_0xcf87('0x27')](respondWithResult(_0x5de815,null))[_0xcf87('0x4a')](handleError(_0x5de815,null));};exports['getDescriptions']=function(_0x5714fc,_0x4709b5,_0x21f4e0){var _0x50df03={};var _0x32c8f7={};var _0x5bca7b;var _0x5463bc;return db['FreshsalesConfiguration'][_0xcf87('0x4d')]({'where':{'id':_0x5714fc[_0xcf87('0x45')]['id']}})['then'](handleEntityNotFound(_0x4709b5,null))[_0xcf87('0x27')](function(_0x44adf9){if(_0x44adf9){_0x5bca7b=_0x44adf9;_0x32c8f7[_0xcf87('0x31')]=_[_0xcf87('0x33')](db['FreshsalesField']['rawAttributes']);_0x32c8f7['query']=_['keys'](_0x5714fc[_0xcf87('0x32')]);_0x32c8f7[_0xcf87('0x34')]=_['intersection'](_0x32c8f7[_0xcf87('0x31')],_0x32c8f7[_0xcf87('0x32')]);_0x50df03[_0xcf87('0x36')]=_[_0xcf87('0x35')](_0x32c8f7[_0xcf87('0x31')],qs[_0xcf87('0x37')](_0x5714fc[_0xcf87('0x32')][_0xcf87('0x37')]));_0x50df03[_0xcf87('0x36')]=_0x50df03[_0xcf87('0x36')][_0xcf87('0x38')]?_0x50df03[_0xcf87('0x36')]:_0x32c8f7[_0xcf87('0x31')];_0x50df03[_0xcf87('0x3a')]=qs[_0xcf87('0x3b')](_0x5714fc[_0xcf87('0x32')][_0xcf87('0x3b')]);_0x50df03[_0xcf87('0x3c')]=qs[_0xcf87('0x34')](_[_0xcf87('0x3d')](_0x5714fc[_0xcf87('0x32')],_0x32c8f7['filters']));if(_0x5714fc[_0xcf87('0x32')][_0xcf87('0x4e')]){_0x50df03[_0xcf87('0x3c')]=_[_0xcf87('0x3e')](_0x50df03['where'],{'$or':_[_0xcf87('0x2b')](_0x50df03[_0xcf87('0x36')],function(_0x487b5f){var _0x3427b1={};_0x3427b1[_0x487b5f]={'$like':'%'+_0x5714fc[_0xcf87('0x32')][_0xcf87('0x4e')]+'%'};return _0x3427b1;})});}_0x50df03=_['merge']({},_0x50df03,_0x5714fc[_0xcf87('0x40')]);return _0x5bca7b[_0xcf87('0x50')](_0x50df03);}})[_0xcf87('0x27')](function(_0xc32020){if(_0xc32020){_0x5463bc=_0xc32020[_0xcf87('0x38')];if(!_0x5714fc[_0xcf87('0x32')][_0xcf87('0x4f')]('nolimit')){_0x50df03[_0xcf87('0x21')]=qs[_0xcf87('0x21')](_0x5714fc['query'][_0xcf87('0x21')]);_0x50df03[_0xcf87('0x1f')]=qs[_0xcf87('0x1f')](_0x5714fc[_0xcf87('0x32')][_0xcf87('0x1f')]);}return _0x5bca7b[_0xcf87('0x50')](_0x50df03);}})[_0xcf87('0x27')](function(_0x2b8dae){if(_0x2b8dae){return _0x2b8dae?{'count':_0x5463bc,'rows':_0x2b8dae}:null;}})['then'](respondWithResult(_0x4709b5,null))['catch'](handleError(_0x4709b5,null));};exports[_0xcf87('0x51')]=function(_0x593d96,_0x286426,_0x509af9){var _0x3d05cf={};var _0x2b3dc4={};var _0x28290c;var _0x2f4214;return db[_0xcf87('0x2c')][_0xcf87('0x4d')]({'where':{'id':_0x593d96[_0xcf87('0x45')]['id']}})[_0xcf87('0x27')](handleEntityNotFound(_0x286426,null))[_0xcf87('0x27')](function(_0x77f35){if(_0x77f35){_0x28290c=_0x77f35;_0x2b3dc4[_0xcf87('0x31')]=_[_0xcf87('0x33')](db[_0xcf87('0x52')][_0xcf87('0x2d')]);_0x2b3dc4[_0xcf87('0x32')]=_[_0xcf87('0x33')](_0x593d96[_0xcf87('0x32')]);_0x2b3dc4[_0xcf87('0x34')]=_[_0xcf87('0x35')](_0x2b3dc4[_0xcf87('0x31')],_0x2b3dc4[_0xcf87('0x32')]);_0x3d05cf[_0xcf87('0x36')]=_['intersection'](_0x2b3dc4[_0xcf87('0x31')],qs[_0xcf87('0x37')](_0x593d96[_0xcf87('0x32')][_0xcf87('0x37')]));_0x3d05cf[_0xcf87('0x36')]=_0x3d05cf[_0xcf87('0x36')]['length']?_0x3d05cf[_0xcf87('0x36')]:_0x2b3dc4[_0xcf87('0x31')];_0x3d05cf[_0xcf87('0x3a')]=qs[_0xcf87('0x3b')](_0x593d96[_0xcf87('0x32')][_0xcf87('0x3b')]);_0x3d05cf['where']=qs['filters'](_[_0xcf87('0x3d')](_0x593d96[_0xcf87('0x32')],_0x2b3dc4[_0xcf87('0x34')]));if(_0x593d96[_0xcf87('0x32')]['filter']){_0x3d05cf[_0xcf87('0x3c')]=_['merge'](_0x3d05cf[_0xcf87('0x3c')],{'$or':_['map'](_0x3d05cf[_0xcf87('0x36')],function(_0x53bbbe){var _0x336070={};_0x336070[_0x53bbbe]={'$like':'%'+_0x593d96[_0xcf87('0x32')]['filter']+'%'};return _0x336070;})});}_0x3d05cf=_[_0xcf87('0x3e')]({},_0x3d05cf,_0x593d96[_0xcf87('0x40')]);return _0x28290c['getFields'](_0x3d05cf);}})[_0xcf87('0x27')](function(_0x175362){if(_0x175362){_0x2f4214=_0x175362[_0xcf87('0x38')];if(!_0x593d96[_0xcf87('0x32')][_0xcf87('0x4f')](_0xcf87('0x39'))){_0x3d05cf['limit']=qs[_0xcf87('0x21')](_0x593d96[_0xcf87('0x32')]['limit']);_0x3d05cf[_0xcf87('0x1f')]=qs[_0xcf87('0x1f')](_0x593d96['query']['offset']);}return _0x28290c[_0xcf87('0x51')](_0x3d05cf);}})[_0xcf87('0x27')](function(_0x52d12b){if(_0x52d12b){return _0x52d12b?{'count':_0x2f4214,'rows':_0x52d12b}:null;}})[_0xcf87('0x27')](respondWithResult(_0x286426,null))[_0xcf87('0x4a')](handleError(_0x286426,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 38ffc89..e331a50 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 _0x73cd=['int_freshsales_configurations','lodash','util','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0x73cd,0xf1));var _0xd73c=function(_0x5087b7,_0x117485){_0x5087b7=_0x5087b7-0x0;var _0x3b4c2b=_0x73cd[_0x5087b7];return _0x3b4c2b;};'use strict';var _=require(_0xd73c('0x0'));var util=require(_0xd73c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd73c('0x2'));var rp=require(_0xd73c('0x3'));var fs=require('fs');var path=require(_0xd73c('0x4'));var rimraf=require(_0xd73c('0x5'));var config=require('../../config/environment');var attributes=require(_0xd73c('0x6'));module['exports']=function(_0x2a5fe3,_0x1432b6){return _0x2a5fe3[_0xd73c('0x7')](_0xd73c('0x8'),attributes,{'tableName':_0xd73c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x196b=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','bluebird'];(function(_0x5a65a9,_0x2e451f){var _0x150f0e=function(_0x47e036){while(--_0x47e036){_0x5a65a9['push'](_0x5a65a9['shift']());}};_0x150f0e(++_0x2e451f);}(_0x196b,0xc8));var _0xb196=function(_0x34f07e,_0x30d18f){_0x34f07e=_0x34f07e-0x0;var _0x575676=_0x196b[_0x34f07e];return _0x575676;};'use strict';var _=require('lodash');var util=require(_0xb196('0x0'));var logger=require(_0xb196('0x1'))(_0xb196('0x2'));var moment=require('moment');var BPromise=require(_0xb196('0x3'));var rp=require(_0xb196('0x4'));var fs=require('fs');var path=require(_0xb196('0x5'));var rimraf=require(_0xb196('0x6'));var config=require(_0xb196('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xb196('0x8')]=function(_0x3d6ab5,_0x358955){return _0x3d6ab5[_0xb196('0x9')](_0xb196('0xa'),attributes,{'tableName':_0xb196('0xb'),'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 23c7bc2..e12e106 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 _0xdc77=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x39105a,_0xecbbd){var _0x3a2602=function(_0x1b53d6){while(--_0x1b53d6){_0x39105a['push'](_0x39105a['shift']());}};_0x3a2602(++_0xecbbd);}(_0xdc77,0x13d));var _0x7dc7=function(_0x416273,_0x440206){_0x416273=_0x416273-0x0;var _0xe91519=_0xdc77[_0x416273];return _0xe91519;};'use strict';var _=require(_0x7dc7('0x0'));var util=require(_0x7dc7('0x1'));var moment=require('moment');var BPromise=require(_0x7dc7('0x2'));var rs=require(_0x7dc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7dc7('0x4'));var logger=require(_0x7dc7('0x5'))(_0x7dc7('0x6'));var config=require(_0x7dc7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7dc7('0x8')][_0x7dc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a25d,_0x1d557e,_0xc0daad){return new BPromise(function(_0x1d04fd,_0x20c326){return client[_0x7dc7('0xa')](_0x35a25d,_0xc0daad)[_0x7dc7('0xb')](function(_0x4b29f5){logger[_0x7dc7('0xc')](_0x7dc7('0xd'),_0x1d557e,'request\x20sent');logger[_0x7dc7('0xe')](_0x7dc7('0xf'),_0x1d557e,_0x7dc7('0x10'),JSON[_0x7dc7('0x11')](_0x4b29f5));if(_0x4b29f5[_0x7dc7('0x12')]){if(_0x4b29f5['error'][_0x7dc7('0x13')]===0x1f4){logger[_0x7dc7('0x12')](_0x7dc7('0xd'),_0x1d557e,_0x4b29f5[_0x7dc7('0x12')][_0x7dc7('0x14')]);return _0x20c326(_0x4b29f5['error']['message']);}logger[_0x7dc7('0x12')](_0x7dc7('0xd'),_0x1d557e,_0x4b29f5[_0x7dc7('0x12')]['message']);return _0x1d04fd(_0x4b29f5[_0x7dc7('0x12')][_0x7dc7('0x14')]);}else{logger[_0x7dc7('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1d557e,'request\x20sent');_0x1d04fd(_0x4b29f5[_0x7dc7('0x15')][_0x7dc7('0x14')]);}})[_0x7dc7('0x16')](function(_0x329583){logger['error'](_0x7dc7('0xd'),_0x1d557e,_0x329583);_0x20c326(_0x329583);});});} \ No newline at end of file +var _0xd05f=['message','info','request\x20sent','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0xd05f,0x1d0));var _0xfd05=function(_0x369c2d,_0x1ddf92){_0x369c2d=_0x369c2d-0x0;var _0x1e3145=_0xd05f[_0x369c2d];return _0x1e3145;};'use strict';var _=require(_0xfd05('0x0'));var util=require(_0xfd05('0x1'));var moment=require(_0xfd05('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd05('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd05('0x5'))(_0xfd05('0x6'));var config=require(_0xfd05('0x7'));var jayson=require(_0xfd05('0x8'));var client=jayson[_0xfd05('0x9')][_0xfd05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39dc80,_0x111289,_0x848f59){return new BPromise(function(_0x2a35dc,_0x225eda){return client[_0xfd05('0xb')](_0x39dc80,_0x848f59)[_0xfd05('0xc')](function(_0x3dfdc3){logger['info'](_0xfd05('0xd'),_0x111289,'request\x20sent');logger[_0xfd05('0xe')](_0xfd05('0xf'),_0x111289,'request\x20sent',JSON[_0xfd05('0x10')](_0x3dfdc3));if(_0x3dfdc3['error']){if(_0x3dfdc3[_0xfd05('0x11')][_0xfd05('0x12')]===0x1f4){logger[_0xfd05('0x11')](_0xfd05('0xd'),_0x111289,_0x3dfdc3['error'][_0xfd05('0x13')]);return _0x225eda(_0x3dfdc3[_0xfd05('0x11')][_0xfd05('0x13')]);}logger[_0xfd05('0x11')](_0xfd05('0xd'),_0x111289,_0x3dfdc3[_0xfd05('0x11')][_0xfd05('0x13')]);return _0x2a35dc(_0x3dfdc3[_0xfd05('0x11')][_0xfd05('0x13')]);}else{logger[_0xfd05('0x14')](_0xfd05('0xd'),_0x111289,_0xfd05('0x15'));_0x2a35dc(_0x3dfdc3['result'][_0xfd05('0x13')]);}})[_0xfd05('0x16')](function(_0x131603){logger[_0xfd05('0x11')](_0xfd05('0xd'),_0x111289,_0x131603);_0x225eda(_0x131603);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f9d0261..c667313 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 _0x4016=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','util','path','fs-extra'];(function(_0x435f4a,_0x1b4461){var _0x258fbd=function(_0x25186a){while(--_0x25186a){_0x435f4a['push'](_0x435f4a['shift']());}};_0x258fbd(++_0x1b4461);}(_0x4016,0x131));var _0x6401=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4016[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x6401('0x0'));var path=require(_0x6401('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6401('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6401('0x3'));var config=require(_0x6401('0x4'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x6401('0x5')](),controller[_0x6401('0x6')]);router['get'](_0x6401('0x7'),auth['isAuthenticated'](),controller[_0x6401('0x8')]);router['post']('/',auth[_0x6401('0x5')](),controller[_0x6401('0x9')]);router[_0x6401('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6401('0xb')]);router[_0x6401('0xc')](_0x6401('0x7'),auth['isAuthenticated'](),controller[_0x6401('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6737=['delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','post','create','put','update'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x6737,0xe2));var _0x7673=function(_0x28e70c,_0x39faed){_0x28e70c=_0x28e70c-0x0;var _0x5bbb4d=_0x6737[_0x28e70c];return _0x5bbb4d;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7673('0xa')]('/',auth['isAuthenticated'](),controller[_0x7673('0xb')]);router[_0x7673('0xc')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);router[_0x7673('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 33d6e1c..9e71a64 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 _0x9378=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist','string','STRING'];(function(_0x9d03f0,_0x1641f8){var _0x1f3bd8=function(_0x511bbf){while(--_0x511bbf){_0x9d03f0['push'](_0x9d03f0['shift']());}};_0x1f3bd8(++_0x1641f8);}(_0x9378,0x133));var _0x8937=function(_0x295edd,_0x5bc802){_0x295edd=_0x295edd-0x0;var _0x203322=_0x9378[_0x295edd];return _0x203322;};'use strict';var Sequelize=require(_0x8937('0x0'));module[_0x8937('0x1')]={'type':{'type':Sequelize[_0x8937('0x2')]('string',_0x8937('0x3'),_0x8937('0x4'),'keyValue',_0x8937('0x5')),'defaultValue':_0x8937('0x6')},'content':{'type':Sequelize[_0x8937('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8937('0x2')]('string',_0x8937('0x3'),_0x8937('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8937('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8937('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8937('0x7')]}}; \ No newline at end of file +var _0xe18d=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x1d5628,_0xd4930b){var _0x43254a=function(_0x4aaa03){while(--_0x4aaa03){_0x1d5628['push'](_0x1d5628['shift']());}};_0x43254a(++_0xd4930b);}(_0xe18d,0x6a));var _0xde18=function(_0x3f9439,_0x2cfd04){_0x3f9439=_0x3f9439-0x0;var _0x271861=_0xe18d[_0x3f9439];return _0x271861;};'use strict';var Sequelize=require(_0xde18('0x0'));module[_0xde18('0x1')]={'type':{'type':Sequelize[_0xde18('0x2')]('string',_0xde18('0x3'),_0xde18('0x4'),_0xde18('0x5'),'picklist'),'defaultValue':_0xde18('0x6')},'content':{'type':Sequelize[_0xde18('0x7')]},'key':{'type':Sequelize[_0xde18('0x7')]},'keyType':{'type':Sequelize[_0xde18('0x2')](_0xde18('0x6'),_0xde18('0x3'),_0xde18('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde18('0x7')]},'nameField':{'type':Sequelize[_0xde18('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde18('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 899c36e..563ceb7 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 _0xf920=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xdeb064,_0x2bd0eb){var _0x191b7d=function(_0x392faa){while(--_0x392faa){_0xdeb064['push'](_0xdeb064['shift']());}};_0x191b7d(++_0x2bd0eb);}(_0xf920,0x16d));var _0x0f92=function(_0x37db9f,_0x4c93ed){_0x37db9f=_0x37db9f-0x0;var _0x48fb29=_0xf920[_0x37db9f];return _0x48fb29;};'use strict';var emlformat=require(_0x0f92('0x0'));var rimraf=require(_0x0f92('0x1'));var zipdir=require(_0x0f92('0x2'));var jsonpatch=require(_0x0f92('0x3'));var rp=require(_0x0f92('0x4'));var moment=require(_0x0f92('0x5'));var BPromise=require(_0x0f92('0x6'));var Mustache=require(_0x0f92('0x7'));var util=require(_0x0f92('0x8'));var path=require(_0x0f92('0x9'));var sox=require('sox');var csv=require(_0x0f92('0xa'));var ejs=require(_0x0f92('0xb'));var fs=require('fs');var fs_extra=require(_0x0f92('0xc'));var _=require(_0x0f92('0xd'));var squel=require(_0x0f92('0xe'));var crypto=require(_0x0f92('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0f92('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f92('0x11'));var qs=require(_0x0f92('0x12'));var as=require(_0x0f92('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f92('0x14'))(_0x0f92('0x15'));var utils=require(_0x0f92('0x16'));var config=require(_0x0f92('0x17'));var licenseUtil=require(_0x0f92('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5df702,_0x17ecab){_0x17ecab=_0x17ecab||0xcc;return function(_0x21d31c){if(_0x21d31c){return _0x5df702[_0x0f92('0x19')](_0x17ecab);}return _0x5df702['status'](_0x17ecab)['end']();};}function respondWithResult(_0x149d44,_0xe5cb48){_0xe5cb48=_0xe5cb48||0xc8;return function(_0x85e50c){if(_0x85e50c){return _0x149d44[_0x0f92('0x1a')](_0xe5cb48)[_0x0f92('0x1b')](_0x85e50c);}};}function respondWithFilteredResult(_0x19041d,_0x7cb020){return function(_0x144f5a){if(_0x144f5a){var _0x3065ed=typeof _0x7cb020[_0x0f92('0x1c')]===_0x0f92('0x1d')&&typeof _0x7cb020[_0x0f92('0x1e')]===_0x0f92('0x1d');var _0x5729b3=_0x144f5a[_0x0f92('0x1f')];var _0x304089=_0x3065ed?0x0:_0x7cb020[_0x0f92('0x1c')];var _0x8f1f55=_0x3065ed?_0x144f5a[_0x0f92('0x1f')]:_0x7cb020[_0x0f92('0x1c')]+_0x7cb020[_0x0f92('0x1e')];var _0x14ba82;if(_0x8f1f55>=_0x5729b3){_0x8f1f55=_0x5729b3;_0x14ba82=0xc8;}else{_0x14ba82=0xce;}_0x19041d['status'](_0x14ba82);return _0x19041d[_0x0f92('0x20')](_0x0f92('0x21'),_0x304089+'-'+_0x8f1f55+'/'+_0x5729b3)[_0x0f92('0x1b')](_0x144f5a);}return null;};}function patchUpdates(_0x26a22b){return function(_0x3ac598){try{jsonpatch[_0x0f92('0x22')](_0x3ac598,_0x26a22b,!![]);}catch(_0x19a603){return BPromise[_0x0f92('0x23')](_0x19a603);}return _0x3ac598['save']();};}function saveUpdates(_0x17349f,_0x28c51b){return function(_0x56cf27){if(_0x56cf27){return _0x56cf27[_0x0f92('0x24')](_0x17349f)[_0x0f92('0x25')](function(_0x5bf9d8){return _0x5bf9d8;});}return null;};}function removeEntity(_0x5651c2,_0x422be8){return function(_0x412618){if(_0x412618){return _0x412618[_0x0f92('0x26')]()['then'](function(){_0x5651c2[_0x0f92('0x1a')](0xcc)[_0x0f92('0x27')]();});}};}function handleEntityNotFound(_0x4c4bb2,_0x118f73){return function(_0x170808){if(!_0x170808){_0x4c4bb2[_0x0f92('0x19')](0x194);}return _0x170808;};}function handleError(_0x2ab9f4,_0x3e2d6b){_0x3e2d6b=_0x3e2d6b||0x1f4;return function(_0x3fe24c){logger[_0x0f92('0x28')](_0x3fe24c[_0x0f92('0x29')]);if(_0x3fe24c[_0x0f92('0x2a')]){delete _0x3fe24c['name'];}_0x2ab9f4[_0x0f92('0x1a')](_0x3e2d6b)[_0x0f92('0x2b')](_0x3fe24c);};}exports[_0x0f92('0x2c')]=function(_0x58066f,_0x5f1696){var _0x8ac88c={},_0x465dae={},_0x45a687={'count':0x0,'rows':[]};var _0x383b74=_[_0x0f92('0x2d')](db[_0x0f92('0x2e')][_0x0f92('0x2f')],function(_0x5191b7){return{'name':_0x5191b7['fieldName'],'type':_0x5191b7[_0x0f92('0x30')][_0x0f92('0x31')]};});_0x465dae[_0x0f92('0x32')]=_[_0x0f92('0x2d')](_0x383b74,'name');_0x465dae[_0x0f92('0x33')]=_[_0x0f92('0x34')](_0x58066f[_0x0f92('0x33')]);_0x465dae[_0x0f92('0x35')]=_[_0x0f92('0x36')](_0x465dae[_0x0f92('0x32')],_0x465dae[_0x0f92('0x33')]);_0x8ac88c[_0x0f92('0x37')]=_[_0x0f92('0x36')](_0x465dae[_0x0f92('0x32')],qs[_0x0f92('0x38')](_0x58066f[_0x0f92('0x33')]['fields']));_0x8ac88c[_0x0f92('0x37')]=_0x8ac88c[_0x0f92('0x37')][_0x0f92('0x39')]?_0x8ac88c[_0x0f92('0x37')]:_0x465dae[_0x0f92('0x32')];if(!_0x58066f[_0x0f92('0x33')][_0x0f92('0x3a')](_0x0f92('0x3b'))){_0x8ac88c[_0x0f92('0x1e')]=qs[_0x0f92('0x1e')](_0x58066f[_0x0f92('0x33')][_0x0f92('0x1e')]);_0x8ac88c['offset']=qs[_0x0f92('0x1c')](_0x58066f['query']['offset']);}_0x8ac88c[_0x0f92('0x3c')]=qs['sort'](_0x58066f['query'][_0x0f92('0x3d')]);_0x8ac88c[_0x0f92('0x3e')]=qs[_0x0f92('0x35')](_[_0x0f92('0x3f')](_0x58066f[_0x0f92('0x33')],_0x465dae[_0x0f92('0x35')]),_0x383b74);if(_0x58066f['query'][_0x0f92('0x40')]){_0x8ac88c[_0x0f92('0x3e')]=_[_0x0f92('0x41')](_0x8ac88c[_0x0f92('0x3e')],{'$or':_['map'](_0x383b74,function(_0xb81a98){if(_0xb81a98[_0x0f92('0x30')]!==_0x0f92('0x42')){var _0x5c8b2f={};_0x5c8b2f[_0xb81a98[_0x0f92('0x2a')]]={'$like':'%'+_0x58066f[_0x0f92('0x33')][_0x0f92('0x40')]+'%'};return _0x5c8b2f;}})});}_0x8ac88c=_['merge']({},_0x8ac88c,_0x58066f[_0x0f92('0x43')]);var _0x53ce63={'where':_0x8ac88c[_0x0f92('0x3e')]};return db[_0x0f92('0x2e')][_0x0f92('0x1f')](_0x53ce63)[_0x0f92('0x25')](function(_0xafb1b4){_0x45a687['count']=_0xafb1b4;if(_0x58066f['query'][_0x0f92('0x44')]){_0x8ac88c[_0x0f92('0x45')]=[{'all':!![]}];}return db[_0x0f92('0x2e')][_0x0f92('0x46')](_0x8ac88c);})[_0x0f92('0x25')](function(_0x576eb2){_0x45a687[_0x0f92('0x47')]=_0x576eb2;return _0x45a687;})[_0x0f92('0x25')](respondWithFilteredResult(_0x5f1696,_0x8ac88c))[_0x0f92('0x48')](handleError(_0x5f1696,null));};exports[_0x0f92('0x49')]=function(_0x347601,_0x3857e6){var _0x10475d={'raw':!![],'where':{'id':_0x347601[_0x0f92('0x4a')]['id']}},_0x356b62={};_0x356b62[_0x0f92('0x32')]=_[_0x0f92('0x34')](db[_0x0f92('0x2e')][_0x0f92('0x2f')]);_0x356b62[_0x0f92('0x33')]=_[_0x0f92('0x34')](_0x347601['query']);_0x356b62['filters']=_[_0x0f92('0x36')](_0x356b62[_0x0f92('0x32')],_0x356b62[_0x0f92('0x33')]);_0x10475d[_0x0f92('0x37')]=_[_0x0f92('0x36')](_0x356b62[_0x0f92('0x32')],qs[_0x0f92('0x38')](_0x347601['query'][_0x0f92('0x38')]));_0x10475d['attributes']=_0x10475d['attributes'][_0x0f92('0x39')]?_0x10475d[_0x0f92('0x37')]:_0x356b62[_0x0f92('0x32')];if(_0x347601[_0x0f92('0x33')][_0x0f92('0x44')]){_0x10475d[_0x0f92('0x45')]=[{'all':!![]}];}_0x10475d=_['merge']({},_0x10475d,_0x347601[_0x0f92('0x43')]);return db['FreshsalesField']['find'](_0x10475d)[_0x0f92('0x25')](handleEntityNotFound(_0x3857e6,null))[_0x0f92('0x25')](respondWithResult(_0x3857e6,null))['catch'](handleError(_0x3857e6,null));};exports[_0x0f92('0x4b')]=function(_0x4a31bc,_0x44a0a2){return db[_0x0f92('0x2e')][_0x0f92('0x4b')](_0x4a31bc[_0x0f92('0x4c')],{})[_0x0f92('0x25')](respondWithResult(_0x44a0a2,0xc9))[_0x0f92('0x48')](handleError(_0x44a0a2,null));};exports[_0x0f92('0x24')]=function(_0x3ddd15,_0x2b1f4b){if(_0x3ddd15[_0x0f92('0x4c')]['id']){delete _0x3ddd15[_0x0f92('0x4c')]['id'];}return db[_0x0f92('0x2e')][_0x0f92('0x4d')]({'where':{'id':_0x3ddd15[_0x0f92('0x4a')]['id']}})[_0x0f92('0x25')](handleEntityNotFound(_0x2b1f4b,null))['then'](saveUpdates(_0x3ddd15[_0x0f92('0x4c')],null))['then'](respondWithResult(_0x2b1f4b,null))[_0x0f92('0x48')](handleError(_0x2b1f4b,null));};exports[_0x0f92('0x26')]=function(_0x13f54d,_0x1e3dd8){return db['FreshsalesField'][_0x0f92('0x4d')]({'where':{'id':_0x13f54d[_0x0f92('0x4a')]['id']}})[_0x0f92('0x25')](handleEntityNotFound(_0x1e3dd8,null))['then'](removeEntity(_0x1e3dd8,null))['catch'](handleError(_0x1e3dd8,null));}; \ No newline at end of file +var _0x998d=['find','create','body','update','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/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','FreshsalesField','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x998d,0xe5));var _0xd998=function(_0x51499c,_0xa0edc5){_0x51499c=_0x51499c-0x0;var _0x2d4e07=_0x998d[_0x51499c];return _0x2d4e07;};'use strict';var emlformat=require(_0xd998('0x0'));var rimraf=require(_0xd998('0x1'));var zipdir=require(_0xd998('0x2'));var jsonpatch=require(_0xd998('0x3'));var rp=require(_0xd998('0x4'));var moment=require(_0xd998('0x5'));var BPromise=require(_0xd998('0x6'));var Mustache=require(_0xd998('0x7'));var util=require(_0xd998('0x8'));var path=require(_0xd998('0x9'));var sox=require('sox');var csv=require(_0xd998('0xa'));var ejs=require(_0xd998('0xb'));var fs=require('fs');var fs_extra=require(_0xd998('0xc'));var _=require('lodash');var squel=require(_0xd998('0xd'));var crypto=require(_0xd998('0xe'));var jsforce=require(_0xd998('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd998('0xa'));var querystring=require(_0xd998('0x10'));var Papa=require(_0xd998('0x11'));var Redis=require(_0xd998('0x12'));var authService=require(_0xd998('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd998('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd998('0x15'))('api');var utils=require(_0xd998('0x16'));var config=require(_0xd998('0x17'));var licenseUtil=require(_0xd998('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1253c5,_0x580dc1){_0x580dc1=_0x580dc1||0xcc;return function(_0x396dbc){if(_0x396dbc){return _0x1253c5[_0xd998('0x19')](_0x580dc1);}return _0x1253c5[_0xd998('0x1a')](_0x580dc1)[_0xd998('0x1b')]();};}function respondWithResult(_0x3c388c,_0x3e7042){_0x3e7042=_0x3e7042||0xc8;return function(_0x519ac5){if(_0x519ac5){return _0x3c388c[_0xd998('0x1a')](_0x3e7042)[_0xd998('0x1c')](_0x519ac5);}};}function respondWithFilteredResult(_0x308a45,_0x271276){return function(_0x2fe193){if(_0x2fe193){var _0x5d2023=typeof _0x271276[_0xd998('0x1d')]==='undefined'&&typeof _0x271276['limit']===_0xd998('0x1e');var _0x4fd679=_0x2fe193['count'];var _0xc3309c=_0x5d2023?0x0:_0x271276[_0xd998('0x1d')];var _0x426a66=_0x5d2023?_0x2fe193[_0xd998('0x1f')]:_0x271276[_0xd998('0x1d')]+_0x271276[_0xd998('0x20')];var _0x5739a8;if(_0x426a66>=_0x4fd679){_0x426a66=_0x4fd679;_0x5739a8=0xc8;}else{_0x5739a8=0xce;}_0x308a45[_0xd998('0x1a')](_0x5739a8);return _0x308a45[_0xd998('0x21')](_0xd998('0x22'),_0xc3309c+'-'+_0x426a66+'/'+_0x4fd679)[_0xd998('0x1c')](_0x2fe193);}return null;};}function patchUpdates(_0x3faabf){return function(_0x2878fb){try{jsonpatch['apply'](_0x2878fb,_0x3faabf,!![]);}catch(_0x4ef710){return BPromise[_0xd998('0x23')](_0x4ef710);}return _0x2878fb[_0xd998('0x24')]();};}function saveUpdates(_0x1b0fb8,_0x33bfad){return function(_0x35295d){if(_0x35295d){return _0x35295d['update'](_0x1b0fb8)[_0xd998('0x25')](function(_0x495187){return _0x495187;});}return null;};}function removeEntity(_0x294d41,_0x152bb7){return function(_0x878ca8){if(_0x878ca8){return _0x878ca8[_0xd998('0x26')]()['then'](function(){_0x294d41['status'](0xcc)[_0xd998('0x1b')]();});}};}function handleEntityNotFound(_0x5b111d,_0x557178){return function(_0x51781c){if(!_0x51781c){_0x5b111d['sendStatus'](0x194);}return _0x51781c;};}function handleError(_0x4ef13f,_0x4dba76){_0x4dba76=_0x4dba76||0x1f4;return function(_0x273800){logger[_0xd998('0x27')](_0x273800[_0xd998('0x28')]);if(_0x273800[_0xd998('0x29')]){delete _0x273800[_0xd998('0x29')];}_0x4ef13f[_0xd998('0x1a')](_0x4dba76)[_0xd998('0x2a')](_0x273800);};}exports['index']=function(_0x142a01,_0x2e2a3e){var _0x3a0cd1={},_0x126cb5={},_0x2e6646={'count':0x0,'rows':[]};var _0x869c00=_['map'](db[_0xd998('0x2b')][_0xd998('0x2c')],function(_0x27126c){return{'name':_0x27126c[_0xd998('0x2d')],'type':_0x27126c['type']['key']};});_0x126cb5[_0xd998('0x2e')]=_[_0xd998('0x2f')](_0x869c00,_0xd998('0x29'));_0x126cb5[_0xd998('0x30')]=_[_0xd998('0x31')](_0x142a01[_0xd998('0x30')]);_0x126cb5[_0xd998('0x32')]=_[_0xd998('0x33')](_0x126cb5['model'],_0x126cb5['query']);_0x3a0cd1[_0xd998('0x34')]=_[_0xd998('0x33')](_0x126cb5[_0xd998('0x2e')],qs[_0xd998('0x35')](_0x142a01[_0xd998('0x30')]['fields']));_0x3a0cd1[_0xd998('0x34')]=_0x3a0cd1[_0xd998('0x34')][_0xd998('0x36')]?_0x3a0cd1[_0xd998('0x34')]:_0x126cb5[_0xd998('0x2e')];if(!_0x142a01[_0xd998('0x30')][_0xd998('0x37')](_0xd998('0x38'))){_0x3a0cd1[_0xd998('0x20')]=qs[_0xd998('0x20')](_0x142a01[_0xd998('0x30')]['limit']);_0x3a0cd1[_0xd998('0x1d')]=qs[_0xd998('0x1d')](_0x142a01[_0xd998('0x30')][_0xd998('0x1d')]);}_0x3a0cd1['order']=qs['sort'](_0x142a01[_0xd998('0x30')][_0xd998('0x39')]);_0x3a0cd1[_0xd998('0x3a')]=qs[_0xd998('0x32')](_['pick'](_0x142a01[_0xd998('0x30')],_0x126cb5[_0xd998('0x32')]),_0x869c00);if(_0x142a01[_0xd998('0x30')][_0xd998('0x3b')]){_0x3a0cd1['where']=_['merge'](_0x3a0cd1[_0xd998('0x3a')],{'$or':_[_0xd998('0x2f')](_0x869c00,function(_0x4ba764){if(_0x4ba764[_0xd998('0x3c')]!==_0xd998('0x3d')){var _0x3baede={};_0x3baede[_0x4ba764[_0xd998('0x29')]]={'$like':'%'+_0x142a01[_0xd998('0x30')][_0xd998('0x3b')]+'%'};return _0x3baede;}})});}_0x3a0cd1=_[_0xd998('0x3e')]({},_0x3a0cd1,_0x142a01[_0xd998('0x3f')]);var _0x12d76d={'where':_0x3a0cd1[_0xd998('0x3a')]};return db[_0xd998('0x2b')][_0xd998('0x1f')](_0x12d76d)[_0xd998('0x25')](function(_0x1aace7){_0x2e6646[_0xd998('0x1f')]=_0x1aace7;if(_0x142a01[_0xd998('0x30')][_0xd998('0x40')]){_0x3a0cd1['include']=[{'all':!![]}];}return db[_0xd998('0x2b')][_0xd998('0x41')](_0x3a0cd1);})[_0xd998('0x25')](function(_0x2ea979){_0x2e6646[_0xd998('0x42')]=_0x2ea979;return _0x2e6646;})[_0xd998('0x25')](respondWithFilteredResult(_0x2e2a3e,_0x3a0cd1))[_0xd998('0x43')](handleError(_0x2e2a3e,null));};exports[_0xd998('0x44')]=function(_0x426484,_0x1fb646){var _0x2350c1={'raw':!![],'where':{'id':_0x426484[_0xd998('0x45')]['id']}},_0x4b9e8b={};_0x4b9e8b[_0xd998('0x2e')]=_['keys'](db['FreshsalesField'][_0xd998('0x2c')]);_0x4b9e8b['query']=_[_0xd998('0x31')](_0x426484[_0xd998('0x30')]);_0x4b9e8b[_0xd998('0x32')]=_[_0xd998('0x33')](_0x4b9e8b[_0xd998('0x2e')],_0x4b9e8b[_0xd998('0x30')]);_0x2350c1[_0xd998('0x34')]=_[_0xd998('0x33')](_0x4b9e8b[_0xd998('0x2e')],qs['fields'](_0x426484[_0xd998('0x30')][_0xd998('0x35')]));_0x2350c1[_0xd998('0x34')]=_0x2350c1[_0xd998('0x34')][_0xd998('0x36')]?_0x2350c1[_0xd998('0x34')]:_0x4b9e8b[_0xd998('0x2e')];if(_0x426484[_0xd998('0x30')][_0xd998('0x40')]){_0x2350c1[_0xd998('0x46')]=[{'all':!![]}];}_0x2350c1=_['merge']({},_0x2350c1,_0x426484[_0xd998('0x3f')]);return db[_0xd998('0x2b')][_0xd998('0x47')](_0x2350c1)[_0xd998('0x25')](handleEntityNotFound(_0x1fb646,null))[_0xd998('0x25')](respondWithResult(_0x1fb646,null))[_0xd998('0x43')](handleError(_0x1fb646,null));};exports['create']=function(_0x188580,_0x25783f){return db[_0xd998('0x2b')][_0xd998('0x48')](_0x188580[_0xd998('0x49')],{})[_0xd998('0x25')](respondWithResult(_0x25783f,0xc9))[_0xd998('0x43')](handleError(_0x25783f,null));};exports[_0xd998('0x4a')]=function(_0x24dff9,_0x3dfa52){if(_0x24dff9[_0xd998('0x49')]['id']){delete _0x24dff9[_0xd998('0x49')]['id'];}return db[_0xd998('0x2b')][_0xd998('0x47')]({'where':{'id':_0x24dff9[_0xd998('0x45')]['id']}})[_0xd998('0x25')](handleEntityNotFound(_0x3dfa52,null))[_0xd998('0x25')](saveUpdates(_0x24dff9[_0xd998('0x49')],null))[_0xd998('0x25')](respondWithResult(_0x3dfa52,null))[_0xd998('0x43')](handleError(_0x3dfa52,null));};exports[_0xd998('0x26')]=function(_0x5707b1,_0x389c6e){return db[_0xd998('0x2b')]['find']({'where':{'id':_0x5707b1[_0xd998('0x45')]['id']}})[_0xd998('0x25')](handleEntityNotFound(_0x389c6e,null))[_0xd998('0x25')](removeEntity(_0x389c6e,null))[_0xd998('0x43')](handleError(_0x389c6e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e985eaa..f9bf075 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 _0xe98f=['freshsales_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','rimraf','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields'];(function(_0x326627,_0x3af3dd){var _0x44bf84=function(_0x1ce30d){while(--_0x1ce30d){_0x326627['push'](_0x326627['shift']());}};_0x44bf84(++_0x3af3dd);}(_0xe98f,0xde));var _0xfe98=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe98f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfe98('0x0'));var util=require('util');var logger=require(_0xfe98('0x1'))('api');var moment=require(_0xfe98('0x2'));var BPromise=require(_0xfe98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe98('0x4'));var config=require('../../config/environment');var attributes=require(_0xfe98('0x5'));module[_0xfe98('0x6')]=function(_0x4a2baa,_0x3aab59){return _0x4a2baa['define'](_0xfe98('0x7'),attributes,{'tableName':_0xfe98('0x8'),'paranoid':![],'indexes':[{'name':_0xfe98('0x9'),'fields':['idField',_0xfe98('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4849=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','idField'];(function(_0x5335b6,_0x4cfae2){var _0xba70c2=function(_0x4bc460){while(--_0x4bc460){_0x5335b6['push'](_0x5335b6['shift']());}};_0xba70c2(++_0x4cfae2);}(_0x4849,0xf8));var _0x9484=function(_0x344b12,_0x7ec234){_0x344b12=_0x344b12-0x0;var _0x469e93=_0x4849[_0x344b12];return _0x469e93;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var logger=require(_0x9484('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9484('0x3'));var rp=require(_0x9484('0x4'));var fs=require('fs');var path=require(_0x9484('0x5'));var rimraf=require(_0x9484('0x6'));var config=require(_0x9484('0x7'));var attributes=require(_0x9484('0x8'));module[_0x9484('0x9')]=function(_0x94e9bd,_0xc4337e){return _0x94e9bd['define']('FreshsalesField',attributes,{'tableName':_0x9484('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x9484('0xb'),_0x9484('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 66f25d5..6abe49a 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 _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x347d48,_0x5ead49){var _0xf205e4=function(_0x364a6e){while(--_0x364a6e){_0x347d48['push'](_0x347d48['shift']());}};_0xf205e4(++_0x5ead49);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'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);});});} \ No newline at end of file +var _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0xac854f,_0xfc99e2){var _0x5d14d1=function(_0x22fe4b){while(--_0x22fe4b){_0xac854f['push'](_0xac854f['shift']());}};_0x5d14d1(++_0xfc99e2);}(_0x4c60,0xc1));var _0x04c6=function(_0x3002d5,_0x3f2f72){_0x3002d5=_0x3002d5-0x0;var _0x4290a4=_0x4c60[_0x3002d5];return _0x4290a4;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9e67cb2..c52124e 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x15bfa0,_0x339911){var _0x40027d=function(_0x1bbdd2){while(--_0x1bbdd2){_0x15bfa0['push'](_0x15bfa0['shift']());}};_0x40027d(++_0x339911);}(_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/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2f17a4,_0xfc693a){var _0x1c72f3=function(_0x343156){while(--_0x343156){_0x2f17a4['push'](_0x2f17a4['shift']());}};_0x1c72f3(++_0xfc693a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ee101eb..1092934 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 _0xf194=['ENUM','integrationTab','newTab','exports','STRING','username'];(function(_0x2c4cee,_0xed54d6){var _0x4cad54=function(_0x5ee3bd){while(--_0x5ee3bd){_0x2c4cee['push'](_0x2c4cee['shift']());}};_0x4cad54(++_0xed54d6);}(_0xf194,0x19b));var _0x4f19=function(_0x11144b,_0x86b46e){_0x11144b=_0x11144b-0x0;var _0x962885=_0xf194[_0x11144b];return _0x962885;};'use strict';var Sequelize=require('sequelize');module[_0x4f19('0x0')]={'name':{'type':Sequelize[_0x4f19('0x1')]},'description':{'type':Sequelize[_0x4f19('0x1')]},'username':{'type':Sequelize[_0x4f19('0x1')],'unique':_0x4f19('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4f19('0x1')]},'clientId':{'type':Sequelize[_0x4f19('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x4f19('0x1')]},'serverUrl':{'type':Sequelize[_0x4f19('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4f19('0x3')](_0x4f19('0x4'),_0x4f19('0x5')),'defaultValue':_0x4f19('0x4')}}; \ No newline at end of file +var _0x45bb=['newTab','sequelize','exports','STRING','username'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x45bb,0x79));var _0xb45b=function(_0x32a7f3,_0xc419a){_0x32a7f3=_0x32a7f3-0x0;var _0x1e0523=_0x45bb[_0x32a7f3];return _0x1e0523;};'use strict';var Sequelize=require(_0xb45b('0x0'));module[_0xb45b('0x1')]={'name':{'type':Sequelize[_0xb45b('0x2')]},'description':{'type':Sequelize[_0xb45b('0x2')]},'username':{'type':Sequelize[_0xb45b('0x2')],'unique':_0xb45b('0x3')},'remoteUri':{'type':Sequelize[_0xb45b('0x2')]},'password':{'type':Sequelize[_0xb45b('0x2')]},'clientId':{'type':Sequelize[_0xb45b('0x2')]},'clientSecret':{'type':Sequelize[_0xb45b('0x2')]},'securityToken':{'type':Sequelize[_0xb45b('0x2')]},'serverUrl':{'type':Sequelize[_0xb45b('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xb45b('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 55551de..d420591 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 _0x9b45=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','SalesforceAccount','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','clientId','clientSecret','username','securityToken','slice','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','textarea','remove','includes','label','custom','picklistValues','value','true','False','false','test','statusCode','Wrong\x20credentials','fast-json-patch','moment','bluebird','mustache','util','path','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x952f0,_0x2fcd7b){var _0x3786ae=function(_0x573712){while(--_0x573712){_0x952f0['push'](_0x952f0['shift']());}};_0x3786ae(++_0x2fcd7b);}(_0x9b45,0xe7));var _0x59b4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9b45[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x59b4('0x0'));var rp=require('request-promise');var moment=require(_0x59b4('0x1'));var BPromise=require(_0x59b4('0x2'));var Mustache=require(_0x59b4('0x3'));var util=require(_0x59b4('0x4'));var path=require(_0x59b4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x59b4('0x6'));var crypto=require('crypto');var jsforce=require(_0x59b4('0x7'));var deskjs=require(_0x59b4('0x8'));var toCsv=require(_0x59b4('0x9'));var querystring=require(_0x59b4('0xa'));var Papa=require(_0x59b4('0xb'));var Redis=require(_0x59b4('0xc'));var authService=require(_0x59b4('0xd'));var qs=require(_0x59b4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59b4('0xf'));var logger=require(_0x59b4('0x10'))(_0x59b4('0x11'));var utils=require(_0x59b4('0x12'));var config=require(_0x59b4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x59b4('0x14'))['db'];var integrations=require(_0x59b4('0x15'));function respondWithStatusCode(_0x3824b2,_0x130249){_0x130249=_0x130249||0xcc;return function(_0x56e554){if(_0x56e554){return _0x3824b2[_0x59b4('0x16')](_0x130249);}return _0x3824b2[_0x59b4('0x17')](_0x130249)['end']();};}function respondWithResult(_0x3e9624,_0x5cb7d2){_0x5cb7d2=_0x5cb7d2||0xc8;return function(_0x5ce881){if(_0x5ce881){return _0x3e9624[_0x59b4('0x17')](_0x5cb7d2)['json'](_0x5ce881);}};}function respondWithFilteredResult(_0xff9711,_0x1a1bb8){return function(_0x40cb14){if(_0x40cb14){var _0x52f378=typeof _0x1a1bb8['offset']===_0x59b4('0x18')&&typeof _0x1a1bb8[_0x59b4('0x19')]===_0x59b4('0x18');var _0x4623b3=_0x40cb14['count'];var _0x132a6a=_0x52f378?0x0:_0x1a1bb8[_0x59b4('0x1a')];var _0x207ecf=_0x52f378?_0x40cb14[_0x59b4('0x1b')]:_0x1a1bb8[_0x59b4('0x1a')]+_0x1a1bb8['limit'];var _0x1a7c78;if(_0x207ecf>=_0x4623b3){_0x207ecf=_0x4623b3;_0x1a7c78=0xc8;}else{_0x1a7c78=0xce;}_0xff9711[_0x59b4('0x17')](_0x1a7c78);return _0xff9711['set'](_0x59b4('0x1c'),_0x132a6a+'-'+_0x207ecf+'/'+_0x4623b3)[_0x59b4('0x1d')](_0x40cb14);}return null;};}function patchUpdates(_0x308cd1){return function(_0x32e3ab){try{jsonpatch['apply'](_0x32e3ab,_0x308cd1,!![]);}catch(_0x9a8b0d){return BPromise[_0x59b4('0x1e')](_0x9a8b0d);}return _0x32e3ab[_0x59b4('0x1f')]();};}function saveUpdates(_0x4ede36,_0x5bdb9a){return function(_0x10045c){if(_0x10045c){return _0x10045c[_0x59b4('0x20')](_0x4ede36)[_0x59b4('0x21')](function(_0x1b45d7){return _0x1b45d7;});}return null;};}function removeEntity(_0x2e5c4c,_0x5afb86){return function(_0x1424ac){if(_0x1424ac){return _0x1424ac[_0x59b4('0x22')]()[_0x59b4('0x21')](function(){_0x2e5c4c[_0x59b4('0x17')](0xcc)[_0x59b4('0x23')]();});}};}function handleEntityNotFound(_0x1d60cb,_0x187d40){return function(_0x55255f){if(!_0x55255f){_0x1d60cb['sendStatus'](0x194);}return _0x55255f;};}function handleError(_0x3498b6,_0x44e278){_0x44e278=_0x44e278||0x1f4;return function(_0x500c5e){logger[_0x59b4('0x24')](_0x500c5e['stack']);if(_0x500c5e[_0x59b4('0x25')]){delete _0x500c5e[_0x59b4('0x25')];}_0x3498b6[_0x59b4('0x17')](_0x44e278)[_0x59b4('0x26')](_0x500c5e);};}exports[_0x59b4('0x27')]=function(_0x2ebf71,_0x59df12){var _0x289b1b={},_0x2c6d7e={},_0x4e87a3={'count':0x0,'rows':[]};var _0x3dd259=_[_0x59b4('0x28')](db['SalesforceAccount']['rawAttributes'],function(_0x2cecac){return{'name':_0x2cecac[_0x59b4('0x29')],'type':_0x2cecac[_0x59b4('0x2a')][_0x59b4('0x2b')]};});_0x2c6d7e[_0x59b4('0x2c')]=_['map'](_0x3dd259,_0x59b4('0x25'));_0x2c6d7e[_0x59b4('0x2d')]=_[_0x59b4('0x2e')](_0x2ebf71['query']);_0x2c6d7e['filters']=_['intersection'](_0x2c6d7e[_0x59b4('0x2c')],_0x2c6d7e[_0x59b4('0x2d')]);_0x289b1b[_0x59b4('0x2f')]=_[_0x59b4('0x30')](_0x2c6d7e[_0x59b4('0x2c')],qs[_0x59b4('0x31')](_0x2ebf71[_0x59b4('0x2d')][_0x59b4('0x31')]));_0x289b1b[_0x59b4('0x2f')]=_0x289b1b[_0x59b4('0x2f')]['length']?_0x289b1b[_0x59b4('0x2f')]:_0x2c6d7e[_0x59b4('0x2c')];if(!_0x2ebf71[_0x59b4('0x2d')][_0x59b4('0x32')](_0x59b4('0x33'))){_0x289b1b['limit']=qs[_0x59b4('0x19')](_0x2ebf71[_0x59b4('0x2d')][_0x59b4('0x19')]);_0x289b1b[_0x59b4('0x1a')]=qs[_0x59b4('0x1a')](_0x2ebf71[_0x59b4('0x2d')][_0x59b4('0x1a')]);}_0x289b1b[_0x59b4('0x34')]=qs[_0x59b4('0x35')](_0x2ebf71[_0x59b4('0x2d')]['sort']);_0x289b1b['where']=qs['filters'](_[_0x59b4('0x36')](_0x2ebf71['query'],_0x2c6d7e[_0x59b4('0x37')]),_0x3dd259);if(_0x2ebf71['query'][_0x59b4('0x38')]){_0x289b1b[_0x59b4('0x39')]=_['merge'](_0x289b1b['where'],{'$or':_[_0x59b4('0x28')](_0x3dd259,function(_0x543cc8){if(_0x543cc8['type']!==_0x59b4('0x3a')){var _0x12c24f={};_0x12c24f[_0x543cc8['name']]={'$like':'%'+_0x2ebf71[_0x59b4('0x2d')][_0x59b4('0x38')]+'%'};return _0x12c24f;}})});}_0x289b1b=_[_0x59b4('0x3b')]({},_0x289b1b,_0x2ebf71['options']);var _0x6be5fa={'where':_0x289b1b[_0x59b4('0x39')]};return db[_0x59b4('0x3c')][_0x59b4('0x1b')](_0x6be5fa)['then'](function(_0x2bf2de){_0x4e87a3[_0x59b4('0x1b')]=_0x2bf2de;if(_0x2ebf71[_0x59b4('0x2d')][_0x59b4('0x3d')]){_0x289b1b['include']=[{'all':!![]}];}return db[_0x59b4('0x3c')][_0x59b4('0x3e')](_0x289b1b);})['then'](function(_0x5c0f15){_0x4e87a3[_0x59b4('0x3f')]=_0x5c0f15;return _0x4e87a3;})[_0x59b4('0x21')](respondWithFilteredResult(_0x59df12,_0x289b1b))[_0x59b4('0x40')](handleError(_0x59df12,null));};exports[_0x59b4('0x41')]=function(_0x1632c9,_0x3f9400){var _0x53192a={'raw':![],'where':{'id':_0x1632c9[_0x59b4('0x42')]['id']}},_0x495569={};_0x495569['model']=_[_0x59b4('0x2e')](db['SalesforceAccount']['rawAttributes']);_0x495569['query']=_[_0x59b4('0x2e')](_0x1632c9[_0x59b4('0x2d')]);_0x495569[_0x59b4('0x37')]=_[_0x59b4('0x30')](_0x495569[_0x59b4('0x2c')],_0x495569[_0x59b4('0x2d')]);_0x53192a['attributes']=_[_0x59b4('0x30')](_0x495569[_0x59b4('0x2c')],qs[_0x59b4('0x31')](_0x1632c9[_0x59b4('0x2d')][_0x59b4('0x31')]));_0x53192a[_0x59b4('0x2f')]=_0x53192a[_0x59b4('0x2f')]['length']?_0x53192a['attributes']:_0x495569[_0x59b4('0x2c')];if(_0x1632c9[_0x59b4('0x2d')][_0x59b4('0x3d')]){_0x53192a[_0x59b4('0x43')]=[{'all':!![]}];}_0x53192a=_[_0x59b4('0x3b')]({},_0x53192a,_0x1632c9[_0x59b4('0x44')]);return db[_0x59b4('0x3c')][_0x59b4('0x45')](_0x53192a)[_0x59b4('0x21')](handleEntityNotFound(_0x3f9400,null))['then'](respondWithResult(_0x3f9400,null))['catch'](handleError(_0x3f9400,null));};exports['create']=function(_0x391f96,_0x1b5468){return db['SalesforceAccount'][_0x59b4('0x46')](_0x391f96[_0x59b4('0x47')],{})[_0x59b4('0x21')](respondWithResult(_0x1b5468,0xc9))['catch'](handleError(_0x1b5468,null));};exports[_0x59b4('0x20')]=function(_0x4e678f,_0x230f00){if(_0x4e678f[_0x59b4('0x47')]['id']){delete _0x4e678f[_0x59b4('0x47')]['id'];}return db[_0x59b4('0x3c')][_0x59b4('0x45')]({'where':{'id':_0x4e678f[_0x59b4('0x42')]['id']}})[_0x59b4('0x21')](handleEntityNotFound(_0x230f00,null))[_0x59b4('0x21')](saveUpdates(_0x4e678f['body'],null))[_0x59b4('0x21')](respondWithResult(_0x230f00,null))[_0x59b4('0x40')](handleError(_0x230f00,null));};exports['destroy']=function(_0x334d82,_0x44712b){return db[_0x59b4('0x3c')][_0x59b4('0x45')]({'where':{'id':_0x334d82[_0x59b4('0x42')]['id']}})[_0x59b4('0x21')](handleEntityNotFound(_0x44712b,null))[_0x59b4('0x21')](removeEntity(_0x44712b,null))[_0x59b4('0x40')](handleError(_0x44712b,null));};exports[_0x59b4('0x48')]=function(_0x32413a,_0x437110,_0x53487b){var _0x282e70={};var _0x545df3={};var _0x5857a0;var _0x60df49;return db[_0x59b4('0x3c')][_0x59b4('0x49')]({'where':{'id':_0x32413a[_0x59b4('0x42')]['id']}})[_0x59b4('0x21')](handleEntityNotFound(_0x437110,null))[_0x59b4('0x21')](function(_0x4c251c){if(_0x4c251c){_0x5857a0=_0x4c251c;_0x545df3['model']=_['keys'](db[_0x59b4('0x4a')]['rawAttributes']);_0x545df3[_0x59b4('0x2d')]=_[_0x59b4('0x2e')](_0x32413a[_0x59b4('0x2d')]);_0x545df3[_0x59b4('0x37')]=_[_0x59b4('0x30')](_0x545df3['model'],_0x545df3[_0x59b4('0x2d')]);_0x282e70[_0x59b4('0x2f')]=_[_0x59b4('0x30')](_0x545df3['model'],qs['fields'](_0x32413a[_0x59b4('0x2d')][_0x59b4('0x31')]));_0x282e70[_0x59b4('0x2f')]=_0x282e70[_0x59b4('0x2f')][_0x59b4('0x4b')]?_0x282e70[_0x59b4('0x2f')]:_0x545df3['model'];_0x282e70[_0x59b4('0x34')]=qs[_0x59b4('0x35')](_0x32413a[_0x59b4('0x2d')][_0x59b4('0x35')]);_0x282e70[_0x59b4('0x39')]=qs['filters'](_['pick'](_0x32413a[_0x59b4('0x2d')],_0x545df3[_0x59b4('0x37')]));if(_0x32413a['query']['filter']){_0x282e70[_0x59b4('0x39')]=_['merge'](_0x282e70['where'],{'$or':_[_0x59b4('0x28')](_0x282e70[_0x59b4('0x2f')],function(_0x24c7ea){var _0x5f026b={};_0x5f026b[_0x24c7ea]={'$like':'%'+_0x32413a[_0x59b4('0x2d')][_0x59b4('0x38')]+'%'};return _0x5f026b;})});}_0x282e70=_[_0x59b4('0x3b')]({},_0x282e70,_0x32413a[_0x59b4('0x44')]);return _0x5857a0[_0x59b4('0x48')](_0x282e70);}})[_0x59b4('0x21')](function(_0x4143a1){if(_0x4143a1){_0x60df49=_0x4143a1['length'];if(!_0x32413a[_0x59b4('0x2d')][_0x59b4('0x32')](_0x59b4('0x33'))){_0x282e70[_0x59b4('0x19')]=qs[_0x59b4('0x19')](_0x32413a[_0x59b4('0x2d')][_0x59b4('0x19')]);_0x282e70['offset']=qs['offset'](_0x32413a[_0x59b4('0x2d')][_0x59b4('0x1a')]);}return _0x5857a0[_0x59b4('0x48')](_0x282e70);}})[_0x59b4('0x21')](function(_0x14564e){if(_0x14564e){return _0x14564e?{'count':_0x60df49,'rows':_0x14564e}:null;}})[_0x59b4('0x21')](respondWithResult(_0x437110,null))[_0x59b4('0x40')](handleError(_0x437110,null));};exports[_0x59b4('0x4c')]=function(_0x4ef19e,_0x12d1a1,_0x4ac940){if(_0x4ef19e[_0x59b4('0x47')]['id']){delete _0x4ef19e[_0x59b4('0x47')]['id'];}return db[_0x59b4('0x3c')][_0x59b4('0x49')]({'where':{'id':_0x4ef19e['params']['id']}})[_0x59b4('0x21')](handleEntityNotFound(_0x12d1a1,null))['then'](function(_0x1dcc78){if(_0x1dcc78){_0x4ef19e[_0x59b4('0x47')][_0x59b4('0x4d')]=_0x1dcc78['id'];_0x4ef19e[_0x59b4('0x47')][_0x59b4('0x4e')]=integrations[_0x59b4('0x4f')](_0x4ef19e[_0x59b4('0x47')][_0x59b4('0x50')],_0x4ef19e[_0x59b4('0x47')][_0x59b4('0x2a')]);_0x4ef19e[_0x59b4('0x47')]['Descriptions']=integrations[_0x59b4('0x51')](_0x4ef19e[_0x59b4('0x47')][_0x59b4('0x50')],_0x4ef19e['body'][_0x59b4('0x2a')]);return db[_0x59b4('0x4a')]['create'](_0x4ef19e[_0x59b4('0x47')],{'include':[{'model':db[_0x59b4('0x52')],'as':_0x59b4('0x4e')},{'model':db[_0x59b4('0x52')],'as':_0x59b4('0x53')}]});}return null;})[_0x59b4('0x21')](respondWithResult(_0x12d1a1,null))[_0x59b4('0x40')](handleError(_0x12d1a1,null));};exports[_0x59b4('0x54')]=function(_0x4df68c,_0x47b951,_0x3e1e5f){var _0x54e8ac;var _0x5a02ef='';var _0x25b527=_0x59b4('0x55');return db[_0x59b4('0x3c')][_0x59b4('0x49')]({'where':{'id':_0x4df68c[_0x59b4('0x42')]['id']},'attributes':['id','remoteUri',_0x59b4('0x56'),_0x59b4('0x57'),_0x59b4('0x58'),'password',_0x59b4('0x59')]})[_0x59b4('0x21')](handleEntityNotFound(_0x47b951,null))[_0x59b4('0x21')](function(_0x45da2d){if(_0x45da2d){_0x5a02ef=_0x45da2d['remoteUri'];var _0x4698d1=_0x5a02ef[_0x59b4('0x5a')](-0x1);if(_0x4698d1==='/'){_0x5a02ef=_0x5a02ef['substring'](0x0,_0x5a02ef[_0x59b4('0x5b')](_0x4698d1));}_0x54e8ac=new jsforce[(_0x59b4('0x5c'))]({'oauth2':{'loginUrl':_0x5a02ef,'clientId':_0x45da2d[_0x59b4('0x56')],'clientSecret':_0x45da2d[_0x59b4('0x57')]}});return _0x54e8ac['login'](_0x45da2d[_0x59b4('0x58')],_0x45da2d[_0x59b4('0x5d')][_0x59b4('0x5e')](_0x45da2d['securityToken']));}})[_0x59b4('0x21')](function(_0x3b0f72){if(_0x3b0f72){if(!_[_0x59b4('0x5f')](_0x4df68c[_0x59b4('0x2d')][_0x59b4('0x60')])){_0x25b527=_0x4df68c[_0x59b4('0x2d')][_0x59b4('0x60')];}return _0x54e8ac[_0x59b4('0x61')](_0x25b527)[_0x59b4('0x62')]();}})['then'](function(_0xe58246){var _0x2d66c2=[_0x59b4('0x63'),_0x59b4('0x64'),_0x59b4('0x65'),_0x59b4('0x66'),_0x59b4('0x67'),'Description'];var _0x181b53=[_0x59b4('0x68'),_0x59b4('0x69'),_0x59b4('0x6a'),_0x59b4('0x6b'),'email',_0x59b4('0x6c'),'phone'];if(_0xe58246){_[_0x59b4('0x6d')](_0xe58246['fields'],function(_0x1c272d){return _0x2d66c2[_0x59b4('0x6e')](_0x1c272d[_0x59b4('0x25')])||!_0x181b53[_0x59b4('0x6e')](_0x1c272d[_0x59b4('0x2a')]);});return{'count':_0xe58246['fields']['length'],'rows':_[_0x59b4('0x28')](_0xe58246['fields'],function(_0x1e8811){return{'id':_0x1e8811[_0x59b4('0x25')],'name':_0x1e8811[_0x59b4('0x6f')],'custom':_0x1e8811[_0x59b4('0x70')],'options':_0x1e8811[_0x59b4('0x71')][_0x59b4('0x4b')]>0x0?_[_0x59b4('0x28')](_0x1e8811['picklistValues'],function(_0x594804){return{'name':_0x594804['label'],'value':_0x594804[_0x59b4('0x72')]};}):_0x1e8811['type']==_0x59b4('0x6b')?[{'name':'True','value':_0x59b4('0x73')},{'name':_0x59b4('0x74'),'value':_0x59b4('0x75')}]:[]};})};}})[_0x59b4('0x21')](respondWithResult(_0x47b951,null))['catch'](function(_0xe77763){var _0x4c9ab7=_0x4df68c[_0x59b4('0x2d')][_0x59b4('0x76')]?0x1f4:_0xe77763[_0x59b4('0x77')]||0x1f4;logger[_0x59b4('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x59b4('0x54'),_0x4c9ab7,JSON['stringify'](_0xe77763));delete _0xe77763[_0x59b4('0x25')];if(_0x4c9ab7===0x191){_0x4c9ab7=0x190;}_0x47b951[_0x59b4('0x17')](_0x4c9ab7)[_0x59b4('0x26')](_0x4df68c[_0x59b4('0x2d')][_0x59b4('0x76')]?{'message':_0x59b4('0x78'),'statusCode':_0xe77763['statusCode']}:_0xe77763);});}; \ No newline at end of file +var _0xe3b1=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','destroy','then','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','query','keys','filters','intersection','model','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','fields','includeAll','find','catch','body','params','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','Descriptions','getDescriptions','channel','Subjects','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','Connection','login','username','concat','isNil','ticketType','OwnerId','IsReminderSet','string','int','picklist','boolean','textarea','includes','picklistValues','label','value','True','true','False','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x1b20a4,_0x184b47){var _0x3bb21c=function(_0x62c0a3){while(--_0x62c0a3){_0x1b20a4['push'](_0x1b20a4['shift']());}};_0x3bb21c(++_0x184b47);}(_0xe3b1,0xd1));var _0x1e3b=function(_0x3314e1,_0xbaff6a){_0x3314e1=_0x3314e1-0x0;var _0x4cc6d1=_0xe3b1[_0x3314e1];return _0x4cc6d1;};'use strict';var emlformat=require(_0x1e3b('0x0'));var rimraf=require(_0x1e3b('0x1'));var zipdir=require(_0x1e3b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e3b('0x3'));var moment=require(_0x1e3b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e3b('0x5'));var util=require(_0x1e3b('0x6'));var path=require(_0x1e3b('0x7'));var sox=require(_0x1e3b('0x8'));var csv=require(_0x1e3b('0x9'));var ejs=require(_0x1e3b('0xa'));var fs=require('fs');var fs_extra=require(_0x1e3b('0xb'));var _=require(_0x1e3b('0xc'));var squel=require(_0x1e3b('0xd'));var crypto=require('crypto');var jsforce=require(_0x1e3b('0xe'));var deskjs=require(_0x1e3b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1e3b('0x10'));var Papa=require('papaparse');var Redis=require(_0x1e3b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1e3b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e3b('0x13'));var logger=require(_0x1e3b('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e3b('0x15'));var db=require(_0x1e3b('0x16'))['db'];var integrations=require(_0x1e3b('0x17'));function respondWithStatusCode(_0x45102e,_0x49902a){_0x49902a=_0x49902a||0xcc;return function(_0x4ba7ce){if(_0x4ba7ce){return _0x45102e[_0x1e3b('0x18')](_0x49902a);}return _0x45102e[_0x1e3b('0x19')](_0x49902a)[_0x1e3b('0x1a')]();};}function respondWithResult(_0x1dd32c,_0x5d87ee){_0x5d87ee=_0x5d87ee||0xc8;return function(_0xf9a6b1){if(_0xf9a6b1){return _0x1dd32c[_0x1e3b('0x19')](_0x5d87ee)['json'](_0xf9a6b1);}};}function respondWithFilteredResult(_0x48bdf2,_0x3b97f5){return function(_0x25854a){if(_0x25854a){var _0x4d71f1=typeof _0x3b97f5[_0x1e3b('0x1b')]===_0x1e3b('0x1c')&&typeof _0x3b97f5[_0x1e3b('0x1d')]===_0x1e3b('0x1c');var _0x27ef8f=_0x25854a['count'];var _0x34628d=_0x4d71f1?0x0:_0x3b97f5['offset'];var _0x39de19=_0x4d71f1?_0x25854a[_0x1e3b('0x1e')]:_0x3b97f5['offset']+_0x3b97f5[_0x1e3b('0x1d')];var _0x1c749b;if(_0x39de19>=_0x27ef8f){_0x39de19=_0x27ef8f;_0x1c749b=0xc8;}else{_0x1c749b=0xce;}_0x48bdf2[_0x1e3b('0x19')](_0x1c749b);return _0x48bdf2[_0x1e3b('0x1f')]('Content-Range',_0x34628d+'-'+_0x39de19+'/'+_0x27ef8f)['json'](_0x25854a);}return null;};}function patchUpdates(_0x31a4ab){return function(_0x481adb){try{jsonpatch['apply'](_0x481adb,_0x31a4ab,!![]);}catch(_0x2c11ac){return BPromise[_0x1e3b('0x20')](_0x2c11ac);}return _0x481adb[_0x1e3b('0x21')]();};}function saveUpdates(_0xeb3f39,_0x520c6d){return function(_0x353cd1){if(_0x353cd1){return _0x353cd1[_0x1e3b('0x22')](_0xeb3f39)['then'](function(_0x948973){return _0x948973;});}return null;};}function removeEntity(_0x5e1f2b,_0x19b4aa){return function(_0x2515ba){if(_0x2515ba){return _0x2515ba[_0x1e3b('0x23')]()[_0x1e3b('0x24')](function(){_0x5e1f2b[_0x1e3b('0x19')](0xcc)[_0x1e3b('0x1a')]();});}};}function handleEntityNotFound(_0x3f7d2e,_0x1484e5){return function(_0x28e273){if(!_0x28e273){_0x3f7d2e['sendStatus'](0x194);}return _0x28e273;};}function handleError(_0x3f72e0,_0x2719ea){_0x2719ea=_0x2719ea||0x1f4;return function(_0x3a0547){logger['error'](_0x3a0547[_0x1e3b('0x25')]);if(_0x3a0547[_0x1e3b('0x26')]){delete _0x3a0547[_0x1e3b('0x26')];}_0x3f72e0[_0x1e3b('0x19')](_0x2719ea)[_0x1e3b('0x27')](_0x3a0547);};}exports[_0x1e3b('0x28')]=function(_0x500a98,_0x4ab4f6){var _0x4f08e3={},_0x31af60={},_0x23e28e={'count':0x0,'rows':[]};var _0x134d64=_[_0x1e3b('0x29')](db[_0x1e3b('0x2a')][_0x1e3b('0x2b')],function(_0x97c37d){return{'name':_0x97c37d['fieldName'],'type':_0x97c37d[_0x1e3b('0x2c')]['key']};});_0x31af60['model']=_[_0x1e3b('0x29')](_0x134d64,_0x1e3b('0x26'));_0x31af60[_0x1e3b('0x2d')]=_[_0x1e3b('0x2e')](_0x500a98['query']);_0x31af60[_0x1e3b('0x2f')]=_[_0x1e3b('0x30')](_0x31af60[_0x1e3b('0x31')],_0x31af60['query']);_0x4f08e3[_0x1e3b('0x32')]=_[_0x1e3b('0x30')](_0x31af60[_0x1e3b('0x31')],qs['fields'](_0x500a98[_0x1e3b('0x2d')]['fields']));_0x4f08e3[_0x1e3b('0x32')]=_0x4f08e3[_0x1e3b('0x32')][_0x1e3b('0x33')]?_0x4f08e3[_0x1e3b('0x32')]:_0x31af60[_0x1e3b('0x31')];if(!_0x500a98[_0x1e3b('0x2d')]['hasOwnProperty'](_0x1e3b('0x34'))){_0x4f08e3[_0x1e3b('0x1d')]=qs[_0x1e3b('0x1d')](_0x500a98[_0x1e3b('0x2d')][_0x1e3b('0x1d')]);_0x4f08e3[_0x1e3b('0x1b')]=qs[_0x1e3b('0x1b')](_0x500a98[_0x1e3b('0x2d')]['offset']);}_0x4f08e3['order']=qs[_0x1e3b('0x35')](_0x500a98['query'][_0x1e3b('0x35')]);_0x4f08e3[_0x1e3b('0x36')]=qs['filters'](_[_0x1e3b('0x37')](_0x500a98[_0x1e3b('0x2d')],_0x31af60['filters']),_0x134d64);if(_0x500a98[_0x1e3b('0x2d')][_0x1e3b('0x38')]){_0x4f08e3[_0x1e3b('0x36')]=_[_0x1e3b('0x39')](_0x4f08e3[_0x1e3b('0x36')],{'$or':_[_0x1e3b('0x29')](_0x134d64,function(_0x43197a){if(_0x43197a[_0x1e3b('0x2c')]!==_0x1e3b('0x3a')){var _0x1ba017={};_0x1ba017[_0x43197a['name']]={'$like':'%'+_0x500a98['query'][_0x1e3b('0x38')]+'%'};return _0x1ba017;}})});}_0x4f08e3=_[_0x1e3b('0x39')]({},_0x4f08e3,_0x500a98[_0x1e3b('0x3b')]);var _0x395bee={'where':_0x4f08e3[_0x1e3b('0x36')]};return db[_0x1e3b('0x2a')]['count'](_0x395bee)[_0x1e3b('0x24')](function(_0x4d2de0){_0x23e28e[_0x1e3b('0x1e')]=_0x4d2de0;if(_0x500a98[_0x1e3b('0x2d')]['includeAll']){_0x4f08e3[_0x1e3b('0x3c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x1e3b('0x3d')](_0x4f08e3);})[_0x1e3b('0x24')](function(_0x559591){_0x23e28e[_0x1e3b('0x3e')]=_0x559591;return _0x23e28e;})['then'](respondWithFilteredResult(_0x4ab4f6,_0x4f08e3))['catch'](handleError(_0x4ab4f6,null));};exports['show']=function(_0x1d0dcf,_0x188c97){var _0x562c91={'raw':![],'where':{'id':_0x1d0dcf['params']['id']}},_0x325f1c={};_0x325f1c[_0x1e3b('0x31')]=_[_0x1e3b('0x2e')](db['SalesforceAccount'][_0x1e3b('0x2b')]);_0x325f1c[_0x1e3b('0x2d')]=_[_0x1e3b('0x2e')](_0x1d0dcf['query']);_0x325f1c['filters']=_[_0x1e3b('0x30')](_0x325f1c[_0x1e3b('0x31')],_0x325f1c[_0x1e3b('0x2d')]);_0x562c91['attributes']=_[_0x1e3b('0x30')](_0x325f1c[_0x1e3b('0x31')],qs['fields'](_0x1d0dcf[_0x1e3b('0x2d')][_0x1e3b('0x3f')]));_0x562c91['attributes']=_0x562c91[_0x1e3b('0x32')]['length']?_0x562c91[_0x1e3b('0x32')]:_0x325f1c[_0x1e3b('0x31')];if(_0x1d0dcf[_0x1e3b('0x2d')][_0x1e3b('0x40')]){_0x562c91['include']=[{'all':!![]}];}_0x562c91=_[_0x1e3b('0x39')]({},_0x562c91,_0x1d0dcf[_0x1e3b('0x3b')]);return db[_0x1e3b('0x2a')][_0x1e3b('0x41')](_0x562c91)[_0x1e3b('0x24')](handleEntityNotFound(_0x188c97,null))['then'](respondWithResult(_0x188c97,null))[_0x1e3b('0x42')](handleError(_0x188c97,null));};exports['create']=function(_0x556ba0,_0x2d257d){return db[_0x1e3b('0x2a')]['create'](_0x556ba0[_0x1e3b('0x43')],{})[_0x1e3b('0x24')](respondWithResult(_0x2d257d,0xc9))['catch'](handleError(_0x2d257d,null));};exports['update']=function(_0x3be7bf,_0x350fc3){if(_0x3be7bf[_0x1e3b('0x43')]['id']){delete _0x3be7bf[_0x1e3b('0x43')]['id'];}return db[_0x1e3b('0x2a')]['find']({'where':{'id':_0x3be7bf[_0x1e3b('0x44')]['id']}})['then'](handleEntityNotFound(_0x350fc3,null))[_0x1e3b('0x24')](saveUpdates(_0x3be7bf[_0x1e3b('0x43')],null))[_0x1e3b('0x24')](respondWithResult(_0x350fc3,null))[_0x1e3b('0x42')](handleError(_0x350fc3,null));};exports[_0x1e3b('0x23')]=function(_0x49f5ca,_0x55c81a){return db[_0x1e3b('0x2a')][_0x1e3b('0x41')]({'where':{'id':_0x49f5ca['params']['id']}})['then'](handleEntityNotFound(_0x55c81a,null))['then'](removeEntity(_0x55c81a,null))[_0x1e3b('0x42')](handleError(_0x55c81a,null));};exports[_0x1e3b('0x45')]=function(_0x56f041,_0x29a434,_0x1270e3){var _0x2a47ff={};var _0x34612e={};var _0xb441ea;var _0x577703;return db[_0x1e3b('0x2a')][_0x1e3b('0x46')]({'where':{'id':_0x56f041[_0x1e3b('0x44')]['id']}})[_0x1e3b('0x24')](handleEntityNotFound(_0x29a434,null))[_0x1e3b('0x24')](function(_0x342dff){if(_0x342dff){_0xb441ea=_0x342dff;_0x34612e[_0x1e3b('0x31')]=_[_0x1e3b('0x2e')](db[_0x1e3b('0x47')][_0x1e3b('0x2b')]);_0x34612e[_0x1e3b('0x2d')]=_[_0x1e3b('0x2e')](_0x56f041['query']);_0x34612e[_0x1e3b('0x2f')]=_[_0x1e3b('0x30')](_0x34612e['model'],_0x34612e['query']);_0x2a47ff[_0x1e3b('0x32')]=_[_0x1e3b('0x30')](_0x34612e[_0x1e3b('0x31')],qs[_0x1e3b('0x3f')](_0x56f041[_0x1e3b('0x2d')][_0x1e3b('0x3f')]));_0x2a47ff[_0x1e3b('0x32')]=_0x2a47ff['attributes']['length']?_0x2a47ff[_0x1e3b('0x32')]:_0x34612e[_0x1e3b('0x31')];_0x2a47ff['order']=qs['sort'](_0x56f041[_0x1e3b('0x2d')][_0x1e3b('0x35')]);_0x2a47ff[_0x1e3b('0x36')]=qs[_0x1e3b('0x2f')](_[_0x1e3b('0x37')](_0x56f041[_0x1e3b('0x2d')],_0x34612e[_0x1e3b('0x2f')]));if(_0x56f041[_0x1e3b('0x2d')]['filter']){_0x2a47ff['where']=_['merge'](_0x2a47ff['where'],{'$or':_[_0x1e3b('0x29')](_0x2a47ff['attributes'],function(_0x1712b1){var _0x129113={};_0x129113[_0x1712b1]={'$like':'%'+_0x56f041[_0x1e3b('0x2d')][_0x1e3b('0x38')]+'%'};return _0x129113;})});}_0x2a47ff=_[_0x1e3b('0x39')]({},_0x2a47ff,_0x56f041['options']);return _0xb441ea[_0x1e3b('0x45')](_0x2a47ff);}})[_0x1e3b('0x24')](function(_0x49b0e7){if(_0x49b0e7){_0x577703=_0x49b0e7[_0x1e3b('0x33')];if(!_0x56f041[_0x1e3b('0x2d')][_0x1e3b('0x48')]('nolimit')){_0x2a47ff[_0x1e3b('0x1d')]=qs[_0x1e3b('0x1d')](_0x56f041[_0x1e3b('0x2d')]['limit']);_0x2a47ff[_0x1e3b('0x1b')]=qs['offset'](_0x56f041[_0x1e3b('0x2d')][_0x1e3b('0x1b')]);}return _0xb441ea[_0x1e3b('0x45')](_0x2a47ff);}})[_0x1e3b('0x24')](function(_0x9e36f0){if(_0x9e36f0){return _0x9e36f0?{'count':_0x577703,'rows':_0x9e36f0}:null;}})[_0x1e3b('0x24')](respondWithResult(_0x29a434,null))[_0x1e3b('0x42')](handleError(_0x29a434,null));};exports[_0x1e3b('0x49')]=function(_0x3e31a9,_0x498a,_0x44c221){if(_0x3e31a9[_0x1e3b('0x43')]['id']){delete _0x3e31a9[_0x1e3b('0x43')]['id'];}return db[_0x1e3b('0x2a')][_0x1e3b('0x46')]({'where':{'id':_0x3e31a9[_0x1e3b('0x44')]['id']}})[_0x1e3b('0x24')](handleEntityNotFound(_0x498a,null))['then'](function(_0x42c024){if(_0x42c024){_0x3e31a9[_0x1e3b('0x43')]['AccountId']=_0x42c024['id'];_0x3e31a9[_0x1e3b('0x43')]['Subjects']=integrations['getSubjects'](_0x3e31a9['body']['channel'],_0x3e31a9[_0x1e3b('0x43')][_0x1e3b('0x2c')]);_0x3e31a9[_0x1e3b('0x43')][_0x1e3b('0x4a')]=integrations[_0x1e3b('0x4b')](_0x3e31a9[_0x1e3b('0x43')][_0x1e3b('0x4c')],_0x3e31a9[_0x1e3b('0x43')][_0x1e3b('0x2c')]);return db[_0x1e3b('0x47')]['create'](_0x3e31a9['body'],{'include':[{'model':db['SalesforceField'],'as':_0x1e3b('0x4d')},{'model':db[_0x1e3b('0x4e')],'as':_0x1e3b('0x4a')}]});}return null;})[_0x1e3b('0x24')](respondWithResult(_0x498a,null))[_0x1e3b('0x42')](handleError(_0x498a,null));};exports[_0x1e3b('0x4f')]=function(_0x48f95f,_0x51e2c9,_0x52a769){var _0x1f46d7;var _0x273111='';var _0x39ead9=_0x1e3b('0x50');return db[_0x1e3b('0x2a')][_0x1e3b('0x46')]({'where':{'id':_0x48f95f[_0x1e3b('0x44')]['id']},'attributes':['id',_0x1e3b('0x51'),_0x1e3b('0x52'),_0x1e3b('0x53'),'username',_0x1e3b('0x54'),_0x1e3b('0x55')]})[_0x1e3b('0x24')](handleEntityNotFound(_0x51e2c9,null))[_0x1e3b('0x24')](function(_0x1e83e0){if(_0x1e83e0){_0x273111=_0x1e83e0[_0x1e3b('0x51')];var _0x1d1e14=_0x273111[_0x1e3b('0x56')](-0x1);if(_0x1d1e14==='/'){_0x273111=_0x273111[_0x1e3b('0x57')](0x0,_0x273111['lastIndexOf'](_0x1d1e14));}_0x1f46d7=new jsforce[(_0x1e3b('0x58'))]({'oauth2':{'loginUrl':_0x273111,'clientId':_0x1e83e0[_0x1e3b('0x52')],'clientSecret':_0x1e83e0['clientSecret']}});return _0x1f46d7[_0x1e3b('0x59')](_0x1e83e0[_0x1e3b('0x5a')],_0x1e83e0['password'][_0x1e3b('0x5b')](_0x1e83e0['securityToken']));}})[_0x1e3b('0x24')](function(_0x274119){if(_0x274119){if(!_[_0x1e3b('0x5c')](_0x48f95f[_0x1e3b('0x2d')][_0x1e3b('0x5d')])){_0x39ead9=_0x48f95f[_0x1e3b('0x2d')][_0x1e3b('0x5d')];}return _0x1f46d7['sobject'](_0x39ead9)['describe']();}})[_0x1e3b('0x24')](function(_0x5c6c53){var _0x170b6d=[_0x1e3b('0x5e'),'ActivityDate',_0x1e3b('0x5f'),'IsRecurrence','Subject','Description'];var _0x3ab8ba=[_0x1e3b('0x60'),_0x1e3b('0x61'),_0x1e3b('0x62'),_0x1e3b('0x63'),'email',_0x1e3b('0x64'),'phone'];if(_0x5c6c53){_['remove'](_0x5c6c53[_0x1e3b('0x3f')],function(_0x506e38){return _0x170b6d[_0x1e3b('0x65')](_0x506e38[_0x1e3b('0x26')])||!_0x3ab8ba[_0x1e3b('0x65')](_0x506e38[_0x1e3b('0x2c')]);});return{'count':_0x5c6c53[_0x1e3b('0x3f')][_0x1e3b('0x33')],'rows':_[_0x1e3b('0x29')](_0x5c6c53['fields'],function(_0x5176b3){return{'id':_0x5176b3[_0x1e3b('0x26')],'name':_0x5176b3['label'],'custom':_0x5176b3['custom'],'options':_0x5176b3[_0x1e3b('0x66')][_0x1e3b('0x33')]>0x0?_[_0x1e3b('0x29')](_0x5176b3[_0x1e3b('0x66')],function(_0xe3481d){return{'name':_0xe3481d[_0x1e3b('0x67')],'value':_0xe3481d[_0x1e3b('0x68')]};}):_0x5176b3[_0x1e3b('0x2c')]==_0x1e3b('0x63')?[{'name':_0x1e3b('0x69'),'value':_0x1e3b('0x6a')},{'name':_0x1e3b('0x6b'),'value':'false'}]:[]};})};}})[_0x1e3b('0x24')](respondWithResult(_0x51e2c9,null))[_0x1e3b('0x42')](function(_0x54fac4){var _0x12fcd4=_0x48f95f[_0x1e3b('0x2d')]['test']?0x1f4:_0x54fac4[_0x1e3b('0x6c')]||0x1f4;logger[_0x1e3b('0x6d')](_0x1e3b('0x6e'),_0x1e3b('0x4f'),_0x12fcd4,JSON[_0x1e3b('0x6f')](_0x54fac4));delete _0x54fac4[_0x1e3b('0x26')];if(_0x12fcd4===0x191){_0x12fcd4=0x190;}_0x51e2c9[_0x1e3b('0x19')](_0x12fcd4)[_0x1e3b('0x27')](_0x48f95f['query'][_0x1e3b('0x70')]?{'message':_0x1e3b('0x71'),'statusCode':_0x54fac4[_0x1e3b('0x6c')]}:_0x54fac4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7ae69f1..4263ab1 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 _0x0e7a=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x0e7a,0xff));var _0xa0e7=function(_0x5d7d06,_0x423126){_0x5d7d06=_0x5d7d06-0x0;var _0xe8eacc=_0x0e7a[_0x5d7d06];return _0xe8eacc;};'use strict';var _=require(_0xa0e7('0x0'));var util=require(_0xa0e7('0x1'));var logger=require(_0xa0e7('0x2'))(_0xa0e7('0x3'));var moment=require('moment');var BPromise=require(_0xa0e7('0x4'));var rp=require(_0xa0e7('0x5'));var fs=require('fs');var path=require(_0xa0e7('0x6'));var rimraf=require(_0xa0e7('0x7'));var config=require(_0xa0e7('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xa0e7('0x9'));module[_0xa0e7('0xa')]=function(_0x3caf55,_0x3fab03){return _0x3caf55[_0xa0e7('0xb')](_0xa0e7('0xc'),attributes,{'tableName':_0xa0e7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdff5=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment'];(function(_0x27ca15,_0x28e089){var _0x571cd8=function(_0xae9ef8){while(--_0xae9ef8){_0x27ca15['push'](_0x27ca15['shift']());}};_0x571cd8(++_0x28e089);}(_0xdff5,0x100));var _0x5dff=function(_0x424d4d,_0x1f6eea){_0x424d4d=_0x424d4d-0x0;var _0x2ef02d=_0xdff5[_0x424d4d];return _0x2ef02d;};'use strict';var _=require('lodash');var util=require(_0x5dff('0x0'));var logger=require(_0x5dff('0x1'))(_0x5dff('0x2'));var moment=require(_0x5dff('0x3'));var BPromise=require(_0x5dff('0x4'));var rp=require(_0x5dff('0x5'));var fs=require('fs');var path=require(_0x5dff('0x6'));var rimraf=require(_0x5dff('0x7'));var config=require(_0x5dff('0x8'));var attributes=require(_0x5dff('0x9'));var integrations=require(_0x5dff('0xa'));module['exports']=function(_0x5999bc,_0x2bb5c8){return _0x5999bc['define'](_0x5dff('0xb'),attributes,{'tableName':_0x5dff('0xc'),'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 f864389..5aca4fc 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 _0x5453=['catch','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','GetSalesforceAccount','find','raw','ShowSalesforceAccount','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0x5453,0x117));var _0x3545=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5453[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x3545('0x0'));var moment=require(_0x3545('0x1'));var BPromise=require('bluebird');var rs=require(_0x3545('0x2'));var fs=require('fs');var Redis=require(_0x3545('0x3'));var db=require(_0x3545('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3545('0x5'));var config=require(_0x3545('0x6'));var jayson=require(_0x3545('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31760f,_0x51f587,_0x5a4401){return new BPromise(function(_0x4b5067,_0x1c1829){return client[_0x3545('0x8')](_0x31760f,_0x5a4401)[_0x3545('0x9')](function(_0x1d2ad7){logger[_0x3545('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x51f587,'request\x20sent');logger[_0x3545('0xb')](_0x3545('0xc'),_0x51f587,'request\x20sent',JSON[_0x3545('0xd')](_0x1d2ad7));if(_0x1d2ad7[_0x3545('0xe')]){if(_0x1d2ad7[_0x3545('0xe')][_0x3545('0xf')]===0x1f4){logger[_0x3545('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x51f587,_0x1d2ad7[_0x3545('0xe')][_0x3545('0x10')]);return _0x1c1829(_0x1d2ad7['error']['message']);}logger[_0x3545('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x51f587,_0x1d2ad7[_0x3545('0xe')][_0x3545('0x10')]);return _0x4b5067(_0x1d2ad7[_0x3545('0xe')][_0x3545('0x10')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x51f587,'request\x20sent');_0x4b5067(_0x1d2ad7[_0x3545('0x11')][_0x3545('0x10')]);}})[_0x3545('0x12')](function(_0xb1a268){logger[_0x3545('0xe')](_0x3545('0x13'),_0x51f587,_0xb1a268);_0x1c1829(_0xb1a268);});});}exports['GetSalesforceAccount']=function(_0x4da1bc){var _0xdd14fc=this;return new Promise(function(_0x2512d1,_0x3fd451){return db[_0x3545('0x14')][_0x3545('0x15')]({'raw':_0x4da1bc['options']?_0x4da1bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x4da1bc[_0x3545('0x16')]?_0x4da1bc['options'][_0x3545('0x17')]||null:null,'attributes':_0x4da1bc[_0x3545('0x16')]?_0x4da1bc['options'][_0x3545('0x18')]||null:null,'limit':_0x4da1bc['options']?_0x4da1bc[_0x3545('0x16')][_0x3545('0x19')]||null:null,'include':_0x4da1bc[_0x3545('0x16')]?_0x4da1bc[_0x3545('0x16')][_0x3545('0x1a')]?_[_0x3545('0x1b')](_0x4da1bc[_0x3545('0x16')][_0x3545('0x1a')],function(_0x510127){return{'model':db[_0x510127[_0x3545('0x1c')]],'as':_0x510127['as'],'attributes':_0x510127['attributes'],'include':_0x510127[_0x3545('0x1a')]?_['map'](_0x510127['include'],function(_0x151e7f){return{'model':db[_0x151e7f[_0x3545('0x1c')]],'as':_0x151e7f['as'],'attributes':_0x151e7f[_0x3545('0x18')],'include':_0x151e7f[_0x3545('0x1a')]?_['map'](_0x151e7f[_0x3545('0x1a')],function(_0x49ceec){return{'model':db[_0x49ceec[_0x3545('0x1c')]],'as':_0x49ceec['as'],'attributes':_0x49ceec[_0x3545('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56656f){logger['info']('GetSalesforceAccount',_0x4da1bc);logger[_0x3545('0xb')](_0x3545('0x1d'),_0x4da1bc,JSON[_0x3545('0xd')](_0x56656f));_0x2512d1(_0x56656f);})[_0x3545('0x12')](function(_0x298257){logger[_0x3545('0xe')](_0x3545('0x1d'),_0x298257['message'],_0x4da1bc);_0x3fd451(_0xdd14fc[_0x3545('0xe')](0x1f4,_0x298257[_0x3545('0x10')]));});});};exports['ShowSalesforceAccount']=function(_0x5acde1){var _0x2b9009=this;return new Promise(function(_0xcee28a,_0x56e1a5){return db[_0x3545('0x14')][_0x3545('0x1e')]({'raw':_0x5acde1[_0x3545('0x16')]?_0x5acde1[_0x3545('0x16')][_0x3545('0x1f')]===undefined?!![]:![]:!![],'where':_0x5acde1[_0x3545('0x16')]?_0x5acde1[_0x3545('0x16')][_0x3545('0x17')]||null:null,'attributes':_0x5acde1[_0x3545('0x16')]?_0x5acde1[_0x3545('0x16')][_0x3545('0x18')]||null:null,'include':_0x5acde1[_0x3545('0x16')]?_0x5acde1[_0x3545('0x16')][_0x3545('0x1a')]?_[_0x3545('0x1b')](_0x5acde1[_0x3545('0x16')]['include'],function(_0x2e3c9f){return{'model':db[_0x2e3c9f[_0x3545('0x1c')]],'as':_0x2e3c9f['as'],'attributes':_0x2e3c9f[_0x3545('0x18')],'include':_0x2e3c9f[_0x3545('0x1a')]?_[_0x3545('0x1b')](_0x2e3c9f[_0x3545('0x1a')],function(_0x36ebaf){return{'model':db[_0x36ebaf[_0x3545('0x1c')]],'as':_0x36ebaf['as'],'attributes':_0x36ebaf[_0x3545('0x18')],'include':_0x36ebaf[_0x3545('0x1a')]?_[_0x3545('0x1b')](_0x36ebaf[_0x3545('0x1a')],function(_0xa75a0b){return{'model':db[_0xa75a0b['model']],'as':_0xa75a0b['as'],'attributes':_0xa75a0b[_0x3545('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3545('0x9')](function(_0x3ae6f7){logger[_0x3545('0xa')](_0x3545('0x20'),_0x5acde1);logger['debug']('ShowSalesforceAccount',_0x5acde1,JSON[_0x3545('0xd')](_0x3ae6f7));_0xcee28a(_0x3ae6f7);})[_0x3545('0x12')](function(_0x260d98){logger['error'](_0x3545('0x20'),_0x260d98[_0x3545('0x10')],_0x5acde1);_0x56e1a5(_0x2b9009[_0x3545('0xe')](0x1f4,_0x260d98[_0x3545('0x10')]));});});}; \ No newline at end of file +var _0x36eb=['client','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','map','include','model','then','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x36eb,0x1b1));var _0xb36e=function(_0x4a0200,_0x5c7c86){_0x4a0200=_0x4a0200-0x0;var _0x5d8781=_0x36eb[_0x4a0200];return _0x5d8781;};'use strict';var _=require(_0xb36e('0x0'));var util=require(_0xb36e('0x1'));var moment=require(_0xb36e('0x2'));var BPromise=require(_0xb36e('0x3'));var rs=require(_0xb36e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb36e('0x5'))['db'];var utils=require(_0xb36e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb36e('0x7'));var jayson=require(_0xb36e('0x8'));var client=jayson[_0xb36e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301b6e,_0x170ea1,_0x589edc){return new BPromise(function(_0x30b0a1,_0x40b12e){return client['request'](_0x301b6e,_0x589edc)['then'](function(_0xea9d69){logger[_0xb36e('0xa')](_0xb36e('0xb'),_0x170ea1,_0xb36e('0xc'));logger[_0xb36e('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x170ea1,_0xb36e('0xc'),JSON[_0xb36e('0xe')](_0xea9d69));if(_0xea9d69[_0xb36e('0xf')]){if(_0xea9d69[_0xb36e('0xf')][_0xb36e('0x10')]===0x1f4){logger['error'](_0xb36e('0xb'),_0x170ea1,_0xea9d69['error'][_0xb36e('0x11')]);return _0x40b12e(_0xea9d69[_0xb36e('0xf')]['message']);}logger[_0xb36e('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x170ea1,_0xea9d69[_0xb36e('0xf')][_0xb36e('0x11')]);return _0x30b0a1(_0xea9d69[_0xb36e('0xf')][_0xb36e('0x11')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x170ea1,'request\x20sent');_0x30b0a1(_0xea9d69[_0xb36e('0x12')]['message']);}})[_0xb36e('0x13')](function(_0x1317e1){logger[_0xb36e('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x170ea1,_0x1317e1);_0x40b12e(_0x1317e1);});});}exports[_0xb36e('0x14')]=function(_0x2354ad){var _0x48d921=this;return new Promise(function(_0x2bdbd6,_0x36fdc7){return db[_0xb36e('0x15')][_0xb36e('0x16')]({'raw':_0x2354ad[_0xb36e('0x17')]?_0x2354ad[_0xb36e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2354ad[_0xb36e('0x17')]?_0x2354ad[_0xb36e('0x17')][_0xb36e('0x18')]||null:null,'attributes':_0x2354ad[_0xb36e('0x17')]?_0x2354ad[_0xb36e('0x17')][_0xb36e('0x19')]||null:null,'limit':_0x2354ad[_0xb36e('0x17')]?_0x2354ad['options'][_0xb36e('0x1a')]||null:null,'include':_0x2354ad['options']?_0x2354ad[_0xb36e('0x17')]['include']?_[_0xb36e('0x1b')](_0x2354ad[_0xb36e('0x17')][_0xb36e('0x1c')],function(_0x30cd64){return{'model':db[_0x30cd64[_0xb36e('0x1d')]],'as':_0x30cd64['as'],'attributes':_0x30cd64['attributes'],'include':_0x30cd64['include']?_[_0xb36e('0x1b')](_0x30cd64[_0xb36e('0x1c')],function(_0x1b1a11){return{'model':db[_0x1b1a11[_0xb36e('0x1d')]],'as':_0x1b1a11['as'],'attributes':_0x1b1a11[_0xb36e('0x19')],'include':_0x1b1a11[_0xb36e('0x1c')]?_[_0xb36e('0x1b')](_0x1b1a11[_0xb36e('0x1c')],function(_0x54a4e5){return{'model':db[_0x54a4e5[_0xb36e('0x1d')]],'as':_0x54a4e5['as'],'attributes':_0x54a4e5[_0xb36e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb36e('0x1e')](function(_0x38a45f){logger[_0xb36e('0xa')](_0xb36e('0x14'),_0x2354ad);logger[_0xb36e('0xd')](_0xb36e('0x14'),_0x2354ad,JSON['stringify'](_0x38a45f));_0x2bdbd6(_0x38a45f);})[_0xb36e('0x13')](function(_0x523f14){logger['error'](_0xb36e('0x14'),_0x523f14[_0xb36e('0x11')],_0x2354ad);_0x36fdc7(_0x48d921['error'](0x1f4,_0x523f14['message']));});});};exports[_0xb36e('0x1f')]=function(_0xc5a721){var _0x43c776=this;return new Promise(function(_0x58c274,_0x239f2d){return db[_0xb36e('0x15')][_0xb36e('0x20')]({'raw':_0xc5a721[_0xb36e('0x17')]?_0xc5a721[_0xb36e('0x17')][_0xb36e('0x21')]===undefined?!![]:![]:!![],'where':_0xc5a721[_0xb36e('0x17')]?_0xc5a721[_0xb36e('0x17')]['where']||null:null,'attributes':_0xc5a721[_0xb36e('0x17')]?_0xc5a721['options'][_0xb36e('0x19')]||null:null,'include':_0xc5a721[_0xb36e('0x17')]?_0xc5a721[_0xb36e('0x17')][_0xb36e('0x1c')]?_[_0xb36e('0x1b')](_0xc5a721[_0xb36e('0x17')][_0xb36e('0x1c')],function(_0x401b41){return{'model':db[_0x401b41[_0xb36e('0x1d')]],'as':_0x401b41['as'],'attributes':_0x401b41[_0xb36e('0x19')],'include':_0x401b41['include']?_[_0xb36e('0x1b')](_0x401b41['include'],function(_0xf2f91f){return{'model':db[_0xf2f91f[_0xb36e('0x1d')]],'as':_0xf2f91f['as'],'attributes':_0xf2f91f[_0xb36e('0x19')],'include':_0xf2f91f[_0xb36e('0x1c')]?_[_0xb36e('0x1b')](_0xf2f91f[_0xb36e('0x1c')],function(_0x1495f8){return{'model':db[_0x1495f8['model']],'as':_0x1495f8['as'],'attributes':_0x1495f8[_0xb36e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb36e('0x1e')](function(_0x5aba6b){logger['info']('ShowSalesforceAccount',_0xc5a721);logger['debug'](_0xb36e('0x1f'),_0xc5a721,JSON[_0xb36e('0xe')](_0x5aba6b));_0x58c274(_0x5aba6b);})['catch'](function(_0x23873d){logger[_0xb36e('0xf')]('ShowSalesforceAccount',_0x23873d[_0xb36e('0x11')],_0xc5a721);_0x239f2d(_0x43c776[_0xb36e('0xf')](0x1f4,_0x23873d['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f58f75d..59e9d03 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0x0b0e[_0x2d460c];return _0xf6fc4c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x3d9fde,_0x462e6b){var _0x448356=function(_0x7f5f91){while(--_0x7f5f91){_0x3d9fde['push'](_0x3d9fde['shift']());}};_0x448356(++_0x462e6b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index ef4e85b..b0b8e64 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 _0x38a5=['STRING','sequelize','exports','Task','ENUM','contact_lead','contact','lead','account'];(function(_0x1f3953,_0x4080f8){var _0x2ace26=function(_0x237da9){while(--_0x237da9){_0x1f3953['push'](_0x1f3953['shift']());}};_0x2ace26(++_0x4080f8);}(_0x38a5,0x133));var _0x538a=function(_0x3cd1db,_0x3c207a){_0x3cd1db=_0x3cd1db-0x0;var _0x4b1383=_0x38a5[_0x3cd1db];return _0x4b1383;};'use strict';var Sequelize=require(_0x538a('0x0'));module[_0x538a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task','Case'),'defaultValue':_0x538a('0x2')},'moduleSearch':{'type':Sequelize[_0x538a('0x3')](_0x538a('0x4'),_0x538a('0x5'),_0x538a('0x6'),'account_contact_lead',_0x538a('0x7')),'defaultValue':_0x538a('0x4')},'moduleCreate':{'type':Sequelize[_0x538a('0x3')]('nothing',_0x538a('0x5'),_0x538a('0x6'),_0x538a('0x7')),'defaultValue':_0x538a('0x6')},'leadId':{'type':Sequelize[_0x538a('0x8')]},'additionalSearchAccount':{'type':Sequelize[_0x538a('0x8')]},'additionalSearchContact':{'type':Sequelize[_0x538a('0x8')]},'additionalSearchLead':{'type':Sequelize[_0x538a('0x8')]}}; \ No newline at end of file +var _0x1cf0=['lead','sequelize','exports','STRING','Task','contact_lead','account_contact_lead','account','ENUM','nothing','contact'];(function(_0x3ae0a5,_0x24ac21){var _0x1aa36d=function(_0x576553){while(--_0x576553){_0x3ae0a5['push'](_0x3ae0a5['shift']());}};_0x1aa36d(++_0x24ac21);}(_0x1cf0,0x16c));var _0x01cf=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x1cf0[_0x1f7201];return _0x289fd2;};'use strict';var Sequelize=require(_0x01cf('0x0'));module[_0x01cf('0x1')]={'name':{'type':Sequelize[_0x01cf('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x01cf('0x3'),'Case'),'defaultValue':_0x01cf('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x01cf('0x4'),'contact','lead',_0x01cf('0x5'),_0x01cf('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x01cf('0x7')](_0x01cf('0x8'),_0x01cf('0x9'),_0x01cf('0xa'),_0x01cf('0x6')),'defaultValue':_0x01cf('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x01cf('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x01cf('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6c34929..6a743da 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 _0x7eea=['error','stack','name','index','map','SalesforceConfiguration','fieldName','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','where','type','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','update','body','getFields','SalesforceField','filter','merge','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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','count','set','apply','reject','save','then','destroy'];(function(_0x16662,_0x16b318){var _0x341dbf=function(_0x1cac58){while(--_0x1cac58){_0x16662['push'](_0x16662['shift']());}};_0x341dbf(++_0x16b318);}(_0x7eea,0x7e));var _0xa7ee=function(_0x346f97,_0x3d04ca){_0x346f97=_0x346f97-0x0;var _0xbcd6a1=_0x7eea[_0x346f97];return _0xbcd6a1;};'use strict';var emlformat=require(_0xa7ee('0x0'));var rimraf=require(_0xa7ee('0x1'));var zipdir=require(_0xa7ee('0x2'));var jsonpatch=require(_0xa7ee('0x3'));var rp=require(_0xa7ee('0x4'));var moment=require(_0xa7ee('0x5'));var BPromise=require(_0xa7ee('0x6'));var Mustache=require(_0xa7ee('0x7'));var util=require(_0xa7ee('0x8'));var path=require(_0xa7ee('0x9'));var sox=require(_0xa7ee('0xa'));var csv=require('to-csv');var ejs=require(_0xa7ee('0xb'));var fs=require('fs');var fs_extra=require(_0xa7ee('0xc'));var _=require(_0xa7ee('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa7ee('0xe'));var deskjs=require(_0xa7ee('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa7ee('0x10'));var Papa=require('papaparse');var Redis=require(_0xa7ee('0x11'));var authService=require(_0xa7ee('0x12'));var qs=require(_0xa7ee('0x13'));var as=require(_0xa7ee('0x14'));var hardwareService=require(_0xa7ee('0x15'));var logger=require(_0xa7ee('0x16'))(_0xa7ee('0x17'));var utils=require(_0xa7ee('0x18'));var config=require(_0xa7ee('0x19'));var licenseUtil=require(_0xa7ee('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57eced,_0x1cc55a){_0x1cc55a=_0x1cc55a||0xcc;return function(_0x34a222){if(_0x34a222){return _0x57eced[_0xa7ee('0x1b')](_0x1cc55a);}return _0x57eced[_0xa7ee('0x1c')](_0x1cc55a)[_0xa7ee('0x1d')]();};}function respondWithResult(_0x360978,_0x58099d){_0x58099d=_0x58099d||0xc8;return function(_0x1393ff){if(_0x1393ff){return _0x360978[_0xa7ee('0x1c')](_0x58099d)[_0xa7ee('0x1e')](_0x1393ff);}};}function respondWithFilteredResult(_0x35965d,_0x51dcf8){return function(_0x18f35e){if(_0x18f35e){var _0x4c72c7=typeof _0x51dcf8[_0xa7ee('0x1f')]===_0xa7ee('0x20')&&typeof _0x51dcf8['limit']===_0xa7ee('0x20');var _0x14fc05=_0x18f35e[_0xa7ee('0x21')];var _0x3ac695=_0x4c72c7?0x0:_0x51dcf8[_0xa7ee('0x1f')];var _0x1c7206=_0x4c72c7?_0x18f35e[_0xa7ee('0x21')]:_0x51dcf8['offset']+_0x51dcf8['limit'];var _0x2a354e;if(_0x1c7206>=_0x14fc05){_0x1c7206=_0x14fc05;_0x2a354e=0xc8;}else{_0x2a354e=0xce;}_0x35965d['status'](_0x2a354e);return _0x35965d[_0xa7ee('0x22')]('Content-Range',_0x3ac695+'-'+_0x1c7206+'/'+_0x14fc05)[_0xa7ee('0x1e')](_0x18f35e);}return null;};}function patchUpdates(_0x2486ef){return function(_0x5c9394){try{jsonpatch[_0xa7ee('0x23')](_0x5c9394,_0x2486ef,!![]);}catch(_0x38209a){return BPromise[_0xa7ee('0x24')](_0x38209a);}return _0x5c9394[_0xa7ee('0x25')]();};}function saveUpdates(_0x370de4,_0xb25c0b){return function(_0xe91731){if(_0xe91731){return _0xe91731['update'](_0x370de4)[_0xa7ee('0x26')](function(_0x184d6c){return _0x184d6c;});}return null;};}function removeEntity(_0x572e41,_0x41b358){return function(_0x59ab20){if(_0x59ab20){return _0x59ab20[_0xa7ee('0x27')]()['then'](function(){_0x572e41[_0xa7ee('0x1c')](0xcc)[_0xa7ee('0x1d')]();});}};}function handleEntityNotFound(_0x22ca14,_0xcf8663){return function(_0x77f9d){if(!_0x77f9d){_0x22ca14[_0xa7ee('0x1b')](0x194);}return _0x77f9d;};}function handleError(_0x4ae473,_0x2de0eb){_0x2de0eb=_0x2de0eb||0x1f4;return function(_0x29977c){logger[_0xa7ee('0x28')](_0x29977c[_0xa7ee('0x29')]);if(_0x29977c[_0xa7ee('0x2a')]){delete _0x29977c[_0xa7ee('0x2a')];}_0x4ae473[_0xa7ee('0x1c')](_0x2de0eb)['send'](_0x29977c);};}exports[_0xa7ee('0x2b')]=function(_0x4d1b2b,_0x34b8ed){var _0x24221e={},_0x4d1ae7={},_0x4bce56={'count':0x0,'rows':[]};var _0x384084=_[_0xa7ee('0x2c')](db[_0xa7ee('0x2d')]['rawAttributes'],function(_0x29e5a6){return{'name':_0x29e5a6[_0xa7ee('0x2e')],'type':_0x29e5a6['type']['key']};});_0x4d1ae7[_0xa7ee('0x2f')]=_['map'](_0x384084,_0xa7ee('0x2a'));_0x4d1ae7['query']=_[_0xa7ee('0x30')](_0x4d1b2b[_0xa7ee('0x31')]);_0x4d1ae7[_0xa7ee('0x32')]=_[_0xa7ee('0x33')](_0x4d1ae7['model'],_0x4d1ae7['query']);_0x24221e['attributes']=_[_0xa7ee('0x33')](_0x4d1ae7['model'],qs['fields'](_0x4d1b2b[_0xa7ee('0x31')][_0xa7ee('0x34')]));_0x24221e[_0xa7ee('0x35')]=_0x24221e['attributes'][_0xa7ee('0x36')]?_0x24221e[_0xa7ee('0x35')]:_0x4d1ae7['model'];if(!_0x4d1b2b['query']['hasOwnProperty'](_0xa7ee('0x37'))){_0x24221e[_0xa7ee('0x38')]=qs[_0xa7ee('0x38')](_0x4d1b2b[_0xa7ee('0x31')][_0xa7ee('0x38')]);_0x24221e[_0xa7ee('0x1f')]=qs[_0xa7ee('0x1f')](_0x4d1b2b[_0xa7ee('0x31')][_0xa7ee('0x1f')]);}_0x24221e[_0xa7ee('0x39')]=qs['sort'](_0x4d1b2b[_0xa7ee('0x31')][_0xa7ee('0x3a')]);_0x24221e['where']=qs['filters'](_[_0xa7ee('0x3b')](_0x4d1b2b[_0xa7ee('0x31')],_0x4d1ae7[_0xa7ee('0x32')]),_0x384084);if(_0x4d1b2b[_0xa7ee('0x31')]['filter']){_0x24221e[_0xa7ee('0x3c')]=_['merge'](_0x24221e[_0xa7ee('0x3c')],{'$or':_[_0xa7ee('0x2c')](_0x384084,function(_0xb2e226){if(_0xb2e226[_0xa7ee('0x3d')]!=='VIRTUAL'){var _0x168822={};_0x168822[_0xb2e226[_0xa7ee('0x2a')]]={'$like':'%'+_0x4d1b2b[_0xa7ee('0x31')]['filter']+'%'};return _0x168822;}})});}_0x24221e=_['merge']({},_0x24221e,_0x4d1b2b[_0xa7ee('0x3e')]);var _0xcf9f61={'where':_0x24221e[_0xa7ee('0x3c')]};return db[_0xa7ee('0x2d')][_0xa7ee('0x21')](_0xcf9f61)[_0xa7ee('0x26')](function(_0x52d46e){_0x4bce56[_0xa7ee('0x21')]=_0x52d46e;if(_0x4d1b2b[_0xa7ee('0x31')][_0xa7ee('0x3f')]){_0x24221e['include']=[{'all':!![]}];}return db[_0xa7ee('0x2d')][_0xa7ee('0x40')](_0x24221e);})[_0xa7ee('0x26')](function(_0x1f379b){_0x4bce56[_0xa7ee('0x41')]=_0x1f379b;return _0x4bce56;})[_0xa7ee('0x26')](respondWithFilteredResult(_0x34b8ed,_0x24221e))[_0xa7ee('0x42')](handleError(_0x34b8ed,null));};exports[_0xa7ee('0x43')]=function(_0x1f9f47,_0x51c7e3){var _0x43fbc1={'raw':![],'where':{'id':_0x1f9f47[_0xa7ee('0x44')]['id']}},_0x378de4={};_0x378de4[_0xa7ee('0x2f')]=_[_0xa7ee('0x30')](db[_0xa7ee('0x2d')][_0xa7ee('0x45')]);_0x378de4[_0xa7ee('0x31')]=_[_0xa7ee('0x30')](_0x1f9f47[_0xa7ee('0x31')]);_0x378de4[_0xa7ee('0x32')]=_[_0xa7ee('0x33')](_0x378de4[_0xa7ee('0x2f')],_0x378de4[_0xa7ee('0x31')]);_0x43fbc1[_0xa7ee('0x35')]=_[_0xa7ee('0x33')](_0x378de4['model'],qs['fields'](_0x1f9f47[_0xa7ee('0x31')][_0xa7ee('0x34')]));_0x43fbc1[_0xa7ee('0x35')]=_0x43fbc1[_0xa7ee('0x35')][_0xa7ee('0x36')]?_0x43fbc1[_0xa7ee('0x35')]:_0x378de4[_0xa7ee('0x2f')];if(_0x1f9f47[_0xa7ee('0x31')][_0xa7ee('0x3f')]){_0x43fbc1[_0xa7ee('0x46')]=[{'all':!![]}];}_0x43fbc1=_['merge']({},_0x43fbc1,_0x1f9f47['options']);return db[_0xa7ee('0x2d')][_0xa7ee('0x47')](_0x43fbc1)[_0xa7ee('0x26')](handleEntityNotFound(_0x51c7e3,null))[_0xa7ee('0x26')](respondWithResult(_0x51c7e3,null))[_0xa7ee('0x42')](handleError(_0x51c7e3,null));};exports[_0xa7ee('0x48')]=function(_0x5090b1,_0x34aebf){return db['SalesforceConfiguration'][_0xa7ee('0x48')](_0x5090b1['body'],{})['then'](respondWithResult(_0x34aebf,0xc9))['catch'](handleError(_0x34aebf,null));};exports[_0xa7ee('0x49')]=function(_0x412d3d,_0x80ae57){if(_0x412d3d[_0xa7ee('0x4a')]['id']){delete _0x412d3d[_0xa7ee('0x4a')]['id'];}return db[_0xa7ee('0x2d')][_0xa7ee('0x47')]({'where':{'id':_0x412d3d[_0xa7ee('0x44')]['id']}})[_0xa7ee('0x26')](handleEntityNotFound(_0x80ae57,null))[_0xa7ee('0x26')](saveUpdates(_0x412d3d['body'],null))['then'](respondWithResult(_0x80ae57,null))[_0xa7ee('0x42')](handleError(_0x80ae57,null));};exports[_0xa7ee('0x27')]=function(_0x174b30,_0x422c89){return db[_0xa7ee('0x2d')][_0xa7ee('0x47')]({'where':{'id':_0x174b30[_0xa7ee('0x44')]['id']}})[_0xa7ee('0x26')](handleEntityNotFound(_0x422c89,null))[_0xa7ee('0x26')](removeEntity(_0x422c89,null))['catch'](handleError(_0x422c89,null));};exports[_0xa7ee('0x4b')]=function(_0x89ef20,_0xc9d8ae,_0x4ae78f){var _0x546fbe={};var _0x491119={};var _0x56d0c1;var _0x39c6e9;return db[_0xa7ee('0x2d')]['findOne']({'where':{'id':_0x89ef20[_0xa7ee('0x44')]['id']}})[_0xa7ee('0x26')](handleEntityNotFound(_0xc9d8ae,null))[_0xa7ee('0x26')](function(_0x3ce5e1){if(_0x3ce5e1){_0x56d0c1=_0x3ce5e1;_0x491119[_0xa7ee('0x2f')]=_[_0xa7ee('0x30')](db[_0xa7ee('0x4c')][_0xa7ee('0x45')]);_0x491119[_0xa7ee('0x31')]=_['keys'](_0x89ef20[_0xa7ee('0x31')]);_0x491119['filters']=_[_0xa7ee('0x33')](_0x491119[_0xa7ee('0x2f')],_0x491119[_0xa7ee('0x31')]);_0x546fbe[_0xa7ee('0x35')]=_['intersection'](_0x491119[_0xa7ee('0x2f')],qs[_0xa7ee('0x34')](_0x89ef20['query']['fields']));_0x546fbe[_0xa7ee('0x35')]=_0x546fbe['attributes'][_0xa7ee('0x36')]?_0x546fbe[_0xa7ee('0x35')]:_0x491119[_0xa7ee('0x2f')];_0x546fbe[_0xa7ee('0x39')]=qs[_0xa7ee('0x3a')](_0x89ef20[_0xa7ee('0x31')]['sort']);_0x546fbe[_0xa7ee('0x3c')]=qs[_0xa7ee('0x32')](_[_0xa7ee('0x3b')](_0x89ef20[_0xa7ee('0x31')],_0x491119[_0xa7ee('0x32')]));if(_0x89ef20[_0xa7ee('0x31')][_0xa7ee('0x4d')]){_0x546fbe['where']=_[_0xa7ee('0x4e')](_0x546fbe[_0xa7ee('0x3c')],{'$or':_['map'](_0x546fbe[_0xa7ee('0x35')],function(_0x2a6a22){var _0x22c4e6={};_0x22c4e6[_0x2a6a22]={'$like':'%'+_0x89ef20[_0xa7ee('0x31')][_0xa7ee('0x4d')]+'%'};return _0x22c4e6;})});}_0x546fbe=_[_0xa7ee('0x4e')]({},_0x546fbe,_0x89ef20[_0xa7ee('0x3e')]);return _0x56d0c1[_0xa7ee('0x4b')](_0x546fbe);}})[_0xa7ee('0x26')](function(_0x5ea65d){if(_0x5ea65d){_0x39c6e9=_0x5ea65d[_0xa7ee('0x36')];if(!_0x89ef20[_0xa7ee('0x31')][_0xa7ee('0x4f')]('nolimit')){_0x546fbe[_0xa7ee('0x38')]=qs[_0xa7ee('0x38')](_0x89ef20[_0xa7ee('0x31')][_0xa7ee('0x38')]);_0x546fbe[_0xa7ee('0x1f')]=qs[_0xa7ee('0x1f')](_0x89ef20[_0xa7ee('0x31')][_0xa7ee('0x1f')]);}return _0x56d0c1[_0xa7ee('0x4b')](_0x546fbe);}})[_0xa7ee('0x26')](function(_0x2e2f43){if(_0x2e2f43){return _0x2e2f43?{'count':_0x39c6e9,'rows':_0x2e2f43}:null;}})[_0xa7ee('0x26')](respondWithResult(_0xc9d8ae,null))[_0xa7ee('0x42')](handleError(_0xc9d8ae,null));};exports[_0xa7ee('0x50')]=function(_0x4becec,_0x34443c,_0x283e88){var _0x543bb1={};var _0x5706f8={};var _0x4fc176;var _0xb0593d;return db[_0xa7ee('0x2d')][_0xa7ee('0x51')]({'where':{'id':_0x4becec[_0xa7ee('0x44')]['id']}})[_0xa7ee('0x26')](handleEntityNotFound(_0x34443c,null))[_0xa7ee('0x26')](function(_0x141f99){if(_0x141f99){_0x4fc176=_0x141f99;_0x5706f8[_0xa7ee('0x2f')]=_[_0xa7ee('0x30')](db[_0xa7ee('0x4c')][_0xa7ee('0x45')]);_0x5706f8['query']=_[_0xa7ee('0x30')](_0x4becec['query']);_0x5706f8[_0xa7ee('0x32')]=_['intersection'](_0x5706f8[_0xa7ee('0x2f')],_0x5706f8[_0xa7ee('0x31')]);_0x543bb1[_0xa7ee('0x35')]=_[_0xa7ee('0x33')](_0x5706f8[_0xa7ee('0x2f')],qs[_0xa7ee('0x34')](_0x4becec[_0xa7ee('0x31')][_0xa7ee('0x34')]));_0x543bb1['attributes']=_0x543bb1['attributes'][_0xa7ee('0x36')]?_0x543bb1[_0xa7ee('0x35')]:_0x5706f8[_0xa7ee('0x2f')];_0x543bb1[_0xa7ee('0x39')]=qs[_0xa7ee('0x3a')](_0x4becec[_0xa7ee('0x31')][_0xa7ee('0x3a')]);_0x543bb1['where']=qs[_0xa7ee('0x32')](_[_0xa7ee('0x3b')](_0x4becec[_0xa7ee('0x31')],_0x5706f8[_0xa7ee('0x32')]));if(_0x4becec[_0xa7ee('0x31')][_0xa7ee('0x4d')]){_0x543bb1[_0xa7ee('0x3c')]=_[_0xa7ee('0x4e')](_0x543bb1['where'],{'$or':_['map'](_0x543bb1[_0xa7ee('0x35')],function(_0x5e3e29){var _0x466637={};_0x466637[_0x5e3e29]={'$like':'%'+_0x4becec[_0xa7ee('0x31')]['filter']+'%'};return _0x466637;})});}_0x543bb1=_['merge']({},_0x543bb1,_0x4becec[_0xa7ee('0x3e')]);return _0x4fc176['getSubjects'](_0x543bb1);}})['then'](function(_0x4c1c28){if(_0x4c1c28){_0xb0593d=_0x4c1c28[_0xa7ee('0x36')];if(!_0x4becec[_0xa7ee('0x31')][_0xa7ee('0x4f')](_0xa7ee('0x37'))){_0x543bb1[_0xa7ee('0x38')]=qs[_0xa7ee('0x38')](_0x4becec[_0xa7ee('0x31')]['limit']);_0x543bb1[_0xa7ee('0x1f')]=qs['offset'](_0x4becec[_0xa7ee('0x31')][_0xa7ee('0x1f')]);}return _0x4fc176[_0xa7ee('0x50')](_0x543bb1);}})[_0xa7ee('0x26')](function(_0x246446){if(_0x246446){return _0x246446?{'count':_0xb0593d,'rows':_0x246446}:null;}})['then'](respondWithResult(_0x34443c,null))['catch'](handleError(_0x34443c,null));};exports[_0xa7ee('0x52')]=function(_0x884ad9,_0x41822e,_0x261263){var _0x150fbb={};var _0x2ca97e={};var _0x50b022;var _0x165d2c;return db[_0xa7ee('0x2d')][_0xa7ee('0x51')]({'where':{'id':_0x884ad9[_0xa7ee('0x44')]['id']}})[_0xa7ee('0x26')](handleEntityNotFound(_0x41822e,null))[_0xa7ee('0x26')](function(_0x4b475b){if(_0x4b475b){_0x50b022=_0x4b475b;_0x2ca97e[_0xa7ee('0x2f')]=_[_0xa7ee('0x30')](db[_0xa7ee('0x4c')][_0xa7ee('0x45')]);_0x2ca97e['query']=_[_0xa7ee('0x30')](_0x884ad9[_0xa7ee('0x31')]);_0x2ca97e['filters']=_[_0xa7ee('0x33')](_0x2ca97e['model'],_0x2ca97e[_0xa7ee('0x31')]);_0x150fbb[_0xa7ee('0x35')]=_[_0xa7ee('0x33')](_0x2ca97e[_0xa7ee('0x2f')],qs['fields'](_0x884ad9['query'][_0xa7ee('0x34')]));_0x150fbb[_0xa7ee('0x35')]=_0x150fbb[_0xa7ee('0x35')][_0xa7ee('0x36')]?_0x150fbb[_0xa7ee('0x35')]:_0x2ca97e[_0xa7ee('0x2f')];_0x150fbb[_0xa7ee('0x39')]=qs[_0xa7ee('0x3a')](_0x884ad9['query'][_0xa7ee('0x3a')]);_0x150fbb[_0xa7ee('0x3c')]=qs[_0xa7ee('0x32')](_[_0xa7ee('0x3b')](_0x884ad9[_0xa7ee('0x31')],_0x2ca97e[_0xa7ee('0x32')]));if(_0x884ad9['query'][_0xa7ee('0x4d')]){_0x150fbb[_0xa7ee('0x3c')]=_[_0xa7ee('0x4e')](_0x150fbb['where'],{'$or':_[_0xa7ee('0x2c')](_0x150fbb[_0xa7ee('0x35')],function(_0x116881){var _0x314413={};_0x314413[_0x116881]={'$like':'%'+_0x884ad9['query']['filter']+'%'};return _0x314413;})});}_0x150fbb=_[_0xa7ee('0x4e')]({},_0x150fbb,_0x884ad9['options']);return _0x50b022[_0xa7ee('0x52')](_0x150fbb);}})[_0xa7ee('0x26')](function(_0x5e22f9){if(_0x5e22f9){_0x165d2c=_0x5e22f9[_0xa7ee('0x36')];if(!_0x884ad9[_0xa7ee('0x31')][_0xa7ee('0x4f')](_0xa7ee('0x37'))){_0x150fbb[_0xa7ee('0x38')]=qs[_0xa7ee('0x38')](_0x884ad9[_0xa7ee('0x31')][_0xa7ee('0x38')]);_0x150fbb[_0xa7ee('0x1f')]=qs['offset'](_0x884ad9['query']['offset']);}return _0x50b022['getDescriptions'](_0x150fbb);}})[_0xa7ee('0x26')](function(_0x1081db){if(_0x1081db){return _0x1081db?{'count':_0x165d2c,'rows':_0x1081db}:null;}})[_0xa7ee('0x26')](respondWithResult(_0x41822e,null))[_0xa7ee('0x42')](handleError(_0x41822e,null));}; \ No newline at end of file +var _0x330c=['lodash','squel','crypto','jsforce','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','index','map','rawAttributes','fieldName','type','model','name','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','includeAll','include','catch','show','params','SalesforceConfiguration','find','create','body','findOne','length','order','options','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x25e548,_0x12638e){var _0x142cc4=function(_0x359ac3){while(--_0x359ac3){_0x25e548['push'](_0x25e548['shift']());}};_0x142cc4(++_0x12638e);}(_0x330c,0x186));var _0xc330=function(_0x1d3956,_0x4e9a1b){_0x1d3956=_0x1d3956-0x0;var _0x23623a=_0x330c[_0x1d3956];return _0x23623a;};'use strict';var emlformat=require(_0xc330('0x0'));var rimraf=require(_0xc330('0x1'));var zipdir=require(_0xc330('0x2'));var jsonpatch=require(_0xc330('0x3'));var rp=require('request-promise');var moment=require(_0xc330('0x4'));var BPromise=require(_0xc330('0x5'));var Mustache=require(_0xc330('0x6'));var util=require(_0xc330('0x7'));var path=require(_0xc330('0x8'));var sox=require(_0xc330('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc330('0xa'));var squel=require(_0xc330('0xb'));var crypto=require(_0xc330('0xc'));var jsforce=require(_0xc330('0xd'));var deskjs=require(_0xc330('0xe'));var toCsv=require(_0xc330('0xf'));var querystring=require(_0xc330('0x10'));var Papa=require('papaparse');var Redis=require(_0xc330('0x11'));var authService=require(_0xc330('0x12'));var qs=require(_0xc330('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc330('0x14'));var logger=require(_0xc330('0x15'))(_0xc330('0x16'));var utils=require(_0xc330('0x17'));var config=require(_0xc330('0x18'));var licenseUtil=require(_0xc330('0x19'));var db=require(_0xc330('0x1a'))['db'];function respondWithStatusCode(_0x167b72,_0x32ef69){_0x32ef69=_0x32ef69||0xcc;return function(_0x48d215){if(_0x48d215){return _0x167b72['sendStatus'](_0x32ef69);}return _0x167b72[_0xc330('0x1b')](_0x32ef69)[_0xc330('0x1c')]();};}function respondWithResult(_0x5066d8,_0x425c1a){_0x425c1a=_0x425c1a||0xc8;return function(_0x27fa30){if(_0x27fa30){return _0x5066d8[_0xc330('0x1b')](_0x425c1a)[_0xc330('0x1d')](_0x27fa30);}};}function respondWithFilteredResult(_0x37675c,_0xdd6f7f){return function(_0xdc5b8e){if(_0xdc5b8e){var _0x28d4ee=typeof _0xdd6f7f[_0xc330('0x1e')]==='undefined'&&typeof _0xdd6f7f[_0xc330('0x1f')]===_0xc330('0x20');var _0x50dc06=_0xdc5b8e[_0xc330('0x21')];var _0x3f3d74=_0x28d4ee?0x0:_0xdd6f7f[_0xc330('0x1e')];var _0x259adc=_0x28d4ee?_0xdc5b8e[_0xc330('0x21')]:_0xdd6f7f['offset']+_0xdd6f7f[_0xc330('0x1f')];var _0x4a4b30;if(_0x259adc>=_0x50dc06){_0x259adc=_0x50dc06;_0x4a4b30=0xc8;}else{_0x4a4b30=0xce;}_0x37675c[_0xc330('0x1b')](_0x4a4b30);return _0x37675c[_0xc330('0x22')](_0xc330('0x23'),_0x3f3d74+'-'+_0x259adc+'/'+_0x50dc06)[_0xc330('0x1d')](_0xdc5b8e);}return null;};}function patchUpdates(_0x44492b){return function(_0x332738){try{jsonpatch[_0xc330('0x24')](_0x332738,_0x44492b,!![]);}catch(_0xf685c7){return BPromise[_0xc330('0x25')](_0xf685c7);}return _0x332738[_0xc330('0x26')]();};}function saveUpdates(_0x5a90e8,_0x53d75d){return function(_0x379b64){if(_0x379b64){return _0x379b64[_0xc330('0x27')](_0x5a90e8)[_0xc330('0x28')](function(_0x3b9770){return _0x3b9770;});}return null;};}function removeEntity(_0x162107,_0x46caae){return function(_0x2fbfc5){if(_0x2fbfc5){return _0x2fbfc5[_0xc330('0x29')]()[_0xc330('0x28')](function(){_0x162107[_0xc330('0x1b')](0xcc)[_0xc330('0x1c')]();});}};}function handleEntityNotFound(_0x248132,_0x2e773d){return function(_0x5e4654){if(!_0x5e4654){_0x248132[_0xc330('0x2a')](0x194);}return _0x5e4654;};}function handleError(_0x5a9cd9,_0x3e8e97){_0x3e8e97=_0x3e8e97||0x1f4;return function(_0x2aaf78){logger[_0xc330('0x2b')](_0x2aaf78['stack']);if(_0x2aaf78['name']){delete _0x2aaf78['name'];}_0x5a9cd9['status'](_0x3e8e97)['send'](_0x2aaf78);};}exports[_0xc330('0x2c')]=function(_0x25784c,_0x2afc95){var _0x339dfb={},_0x381fe5={},_0x1982f4={'count':0x0,'rows':[]};var _0x47e836=_[_0xc330('0x2d')](db['SalesforceConfiguration'][_0xc330('0x2e')],function(_0x205e81){return{'name':_0x205e81[_0xc330('0x2f')],'type':_0x205e81[_0xc330('0x30')]['key']};});_0x381fe5[_0xc330('0x31')]=_[_0xc330('0x2d')](_0x47e836,_0xc330('0x32'));_0x381fe5['query']=_[_0xc330('0x33')](_0x25784c[_0xc330('0x34')]);_0x381fe5['filters']=_[_0xc330('0x35')](_0x381fe5[_0xc330('0x31')],_0x381fe5[_0xc330('0x34')]);_0x339dfb[_0xc330('0x36')]=_[_0xc330('0x35')](_0x381fe5[_0xc330('0x31')],qs[_0xc330('0x37')](_0x25784c['query'][_0xc330('0x37')]));_0x339dfb[_0xc330('0x36')]=_0x339dfb['attributes']['length']?_0x339dfb['attributes']:_0x381fe5['model'];if(!_0x25784c['query'][_0xc330('0x38')](_0xc330('0x39'))){_0x339dfb['limit']=qs[_0xc330('0x1f')](_0x25784c[_0xc330('0x34')][_0xc330('0x1f')]);_0x339dfb[_0xc330('0x1e')]=qs[_0xc330('0x1e')](_0x25784c['query'][_0xc330('0x1e')]);}_0x339dfb['order']=qs[_0xc330('0x3a')](_0x25784c['query'][_0xc330('0x3a')]);_0x339dfb['where']=qs['filters'](_[_0xc330('0x3b')](_0x25784c[_0xc330('0x34')],_0x381fe5[_0xc330('0x3c')]),_0x47e836);if(_0x25784c[_0xc330('0x34')][_0xc330('0x3d')]){_0x339dfb[_0xc330('0x3e')]=_[_0xc330('0x3f')](_0x339dfb[_0xc330('0x3e')],{'$or':_[_0xc330('0x2d')](_0x47e836,function(_0x531cfd){if(_0x531cfd[_0xc330('0x30')]!=='VIRTUAL'){var _0x36294a={};_0x36294a[_0x531cfd[_0xc330('0x32')]]={'$like':'%'+_0x25784c[_0xc330('0x34')]['filter']+'%'};return _0x36294a;}})});}_0x339dfb=_[_0xc330('0x3f')]({},_0x339dfb,_0x25784c['options']);var _0x1f7acf={'where':_0x339dfb['where']};return db['SalesforceConfiguration']['count'](_0x1f7acf)['then'](function(_0x3df5fc){_0x1982f4[_0xc330('0x21')]=_0x3df5fc;if(_0x25784c[_0xc330('0x34')][_0xc330('0x40')]){_0x339dfb[_0xc330('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x339dfb);})['then'](function(_0x340bd0){_0x1982f4['rows']=_0x340bd0;return _0x1982f4;})[_0xc330('0x28')](respondWithFilteredResult(_0x2afc95,_0x339dfb))[_0xc330('0x42')](handleError(_0x2afc95,null));};exports[_0xc330('0x43')]=function(_0x28145a,_0x51dba0){var _0x3673a2={'raw':![],'where':{'id':_0x28145a[_0xc330('0x44')]['id']}},_0x4a8b19={};_0x4a8b19[_0xc330('0x31')]=_[_0xc330('0x33')](db['SalesforceConfiguration'][_0xc330('0x2e')]);_0x4a8b19[_0xc330('0x34')]=_[_0xc330('0x33')](_0x28145a[_0xc330('0x34')]);_0x4a8b19[_0xc330('0x3c')]=_[_0xc330('0x35')](_0x4a8b19['model'],_0x4a8b19[_0xc330('0x34')]);_0x3673a2[_0xc330('0x36')]=_['intersection'](_0x4a8b19[_0xc330('0x31')],qs['fields'](_0x28145a['query']['fields']));_0x3673a2[_0xc330('0x36')]=_0x3673a2[_0xc330('0x36')]['length']?_0x3673a2[_0xc330('0x36')]:_0x4a8b19['model'];if(_0x28145a['query'][_0xc330('0x40')]){_0x3673a2[_0xc330('0x41')]=[{'all':!![]}];}_0x3673a2=_[_0xc330('0x3f')]({},_0x3673a2,_0x28145a['options']);return db[_0xc330('0x45')][_0xc330('0x46')](_0x3673a2)[_0xc330('0x28')](handleEntityNotFound(_0x51dba0,null))[_0xc330('0x28')](respondWithResult(_0x51dba0,null))['catch'](handleError(_0x51dba0,null));};exports[_0xc330('0x47')]=function(_0x2be159,_0x47df37){return db[_0xc330('0x45')][_0xc330('0x47')](_0x2be159['body'],{})[_0xc330('0x28')](respondWithResult(_0x47df37,0xc9))[_0xc330('0x42')](handleError(_0x47df37,null));};exports[_0xc330('0x27')]=function(_0x52749f,_0x1be0cb){if(_0x52749f[_0xc330('0x48')]['id']){delete _0x52749f[_0xc330('0x48')]['id'];}return db[_0xc330('0x45')][_0xc330('0x46')]({'where':{'id':_0x52749f[_0xc330('0x44')]['id']}})[_0xc330('0x28')](handleEntityNotFound(_0x1be0cb,null))['then'](saveUpdates(_0x52749f[_0xc330('0x48')],null))['then'](respondWithResult(_0x1be0cb,null))[_0xc330('0x42')](handleError(_0x1be0cb,null));};exports['destroy']=function(_0x31e696,_0x3fa30b){return db[_0xc330('0x45')][_0xc330('0x46')]({'where':{'id':_0x31e696[_0xc330('0x44')]['id']}})['then'](handleEntityNotFound(_0x3fa30b,null))[_0xc330('0x28')](removeEntity(_0x3fa30b,null))[_0xc330('0x42')](handleError(_0x3fa30b,null));};exports['getFields']=function(_0x359394,_0x5da054,_0x555ff0){var _0x471b18={};var _0x3a2b4f={};var _0x355c9e;var _0x12695a;return db['SalesforceConfiguration'][_0xc330('0x49')]({'where':{'id':_0x359394[_0xc330('0x44')]['id']}})[_0xc330('0x28')](handleEntityNotFound(_0x5da054,null))[_0xc330('0x28')](function(_0x56afd2){if(_0x56afd2){_0x355c9e=_0x56afd2;_0x3a2b4f[_0xc330('0x31')]=_[_0xc330('0x33')](db['SalesforceField'][_0xc330('0x2e')]);_0x3a2b4f[_0xc330('0x34')]=_['keys'](_0x359394[_0xc330('0x34')]);_0x3a2b4f[_0xc330('0x3c')]=_['intersection'](_0x3a2b4f[_0xc330('0x31')],_0x3a2b4f['query']);_0x471b18[_0xc330('0x36')]=_['intersection'](_0x3a2b4f[_0xc330('0x31')],qs[_0xc330('0x37')](_0x359394['query'][_0xc330('0x37')]));_0x471b18[_0xc330('0x36')]=_0x471b18['attributes'][_0xc330('0x4a')]?_0x471b18[_0xc330('0x36')]:_0x3a2b4f[_0xc330('0x31')];_0x471b18[_0xc330('0x4b')]=qs[_0xc330('0x3a')](_0x359394[_0xc330('0x34')][_0xc330('0x3a')]);_0x471b18[_0xc330('0x3e')]=qs[_0xc330('0x3c')](_[_0xc330('0x3b')](_0x359394['query'],_0x3a2b4f[_0xc330('0x3c')]));if(_0x359394[_0xc330('0x34')][_0xc330('0x3d')]){_0x471b18[_0xc330('0x3e')]=_[_0xc330('0x3f')](_0x471b18['where'],{'$or':_[_0xc330('0x2d')](_0x471b18[_0xc330('0x36')],function(_0x253a96){var _0x34739b={};_0x34739b[_0x253a96]={'$like':'%'+_0x359394['query'][_0xc330('0x3d')]+'%'};return _0x34739b;})});}_0x471b18=_[_0xc330('0x3f')]({},_0x471b18,_0x359394[_0xc330('0x4c')]);return _0x355c9e['getFields'](_0x471b18);}})['then'](function(_0x64fa0c){if(_0x64fa0c){_0x12695a=_0x64fa0c[_0xc330('0x4a')];if(!_0x359394[_0xc330('0x34')]['hasOwnProperty'](_0xc330('0x39'))){_0x471b18[_0xc330('0x1f')]=qs[_0xc330('0x1f')](_0x359394[_0xc330('0x34')][_0xc330('0x1f')]);_0x471b18[_0xc330('0x1e')]=qs[_0xc330('0x1e')](_0x359394[_0xc330('0x34')]['offset']);}return _0x355c9e['getFields'](_0x471b18);}})[_0xc330('0x28')](function(_0x8af592){if(_0x8af592){return _0x8af592?{'count':_0x12695a,'rows':_0x8af592}:null;}})[_0xc330('0x28')](respondWithResult(_0x5da054,null))[_0xc330('0x42')](handleError(_0x5da054,null));};exports[_0xc330('0x4d')]=function(_0x1d6aa3,_0x8fc0db,_0x3232c1){var _0x36df3c={};var _0x33af13={};var _0x1cf007;var _0x19975a;return db[_0xc330('0x45')][_0xc330('0x49')]({'where':{'id':_0x1d6aa3[_0xc330('0x44')]['id']}})[_0xc330('0x28')](handleEntityNotFound(_0x8fc0db,null))[_0xc330('0x28')](function(_0x5cfa19){if(_0x5cfa19){_0x1cf007=_0x5cfa19;_0x33af13[_0xc330('0x31')]=_[_0xc330('0x33')](db[_0xc330('0x4e')][_0xc330('0x2e')]);_0x33af13[_0xc330('0x34')]=_[_0xc330('0x33')](_0x1d6aa3[_0xc330('0x34')]);_0x33af13[_0xc330('0x3c')]=_[_0xc330('0x35')](_0x33af13[_0xc330('0x31')],_0x33af13[_0xc330('0x34')]);_0x36df3c[_0xc330('0x36')]=_['intersection'](_0x33af13[_0xc330('0x31')],qs[_0xc330('0x37')](_0x1d6aa3['query']['fields']));_0x36df3c[_0xc330('0x36')]=_0x36df3c[_0xc330('0x36')][_0xc330('0x4a')]?_0x36df3c[_0xc330('0x36')]:_0x33af13[_0xc330('0x31')];_0x36df3c[_0xc330('0x4b')]=qs[_0xc330('0x3a')](_0x1d6aa3[_0xc330('0x34')][_0xc330('0x3a')]);_0x36df3c['where']=qs[_0xc330('0x3c')](_['pick'](_0x1d6aa3[_0xc330('0x34')],_0x33af13[_0xc330('0x3c')]));if(_0x1d6aa3[_0xc330('0x34')]['filter']){_0x36df3c['where']=_[_0xc330('0x3f')](_0x36df3c[_0xc330('0x3e')],{'$or':_[_0xc330('0x2d')](_0x36df3c['attributes'],function(_0x1eb997){var _0x50eaf6={};_0x50eaf6[_0x1eb997]={'$like':'%'+_0x1d6aa3['query'][_0xc330('0x3d')]+'%'};return _0x50eaf6;})});}_0x36df3c=_[_0xc330('0x3f')]({},_0x36df3c,_0x1d6aa3['options']);return _0x1cf007['getSubjects'](_0x36df3c);}})[_0xc330('0x28')](function(_0x2ebd40){if(_0x2ebd40){_0x19975a=_0x2ebd40['length'];if(!_0x1d6aa3[_0xc330('0x34')]['hasOwnProperty']('nolimit')){_0x36df3c[_0xc330('0x1f')]=qs['limit'](_0x1d6aa3[_0xc330('0x34')][_0xc330('0x1f')]);_0x36df3c[_0xc330('0x1e')]=qs[_0xc330('0x1e')](_0x1d6aa3[_0xc330('0x34')][_0xc330('0x1e')]);}return _0x1cf007[_0xc330('0x4d')](_0x36df3c);}})[_0xc330('0x28')](function(_0x18f42d){if(_0x18f42d){return _0x18f42d?{'count':_0x19975a,'rows':_0x18f42d}:null;}})[_0xc330('0x28')](respondWithResult(_0x8fc0db,null))['catch'](handleError(_0x8fc0db,null));};exports[_0xc330('0x4f')]=function(_0x1b4f3f,_0x67e7b8,_0xf8ebd9){var _0x1742ad={};var _0x2c9a53={};var _0x1aea70;var _0x52c37f;return db[_0xc330('0x45')]['findOne']({'where':{'id':_0x1b4f3f['params']['id']}})[_0xc330('0x28')](handleEntityNotFound(_0x67e7b8,null))[_0xc330('0x28')](function(_0x23f938){if(_0x23f938){_0x1aea70=_0x23f938;_0x2c9a53[_0xc330('0x31')]=_[_0xc330('0x33')](db[_0xc330('0x4e')][_0xc330('0x2e')]);_0x2c9a53[_0xc330('0x34')]=_[_0xc330('0x33')](_0x1b4f3f[_0xc330('0x34')]);_0x2c9a53['filters']=_[_0xc330('0x35')](_0x2c9a53[_0xc330('0x31')],_0x2c9a53[_0xc330('0x34')]);_0x1742ad[_0xc330('0x36')]=_['intersection'](_0x2c9a53[_0xc330('0x31')],qs[_0xc330('0x37')](_0x1b4f3f[_0xc330('0x34')][_0xc330('0x37')]));_0x1742ad[_0xc330('0x36')]=_0x1742ad['attributes'][_0xc330('0x4a')]?_0x1742ad[_0xc330('0x36')]:_0x2c9a53[_0xc330('0x31')];_0x1742ad[_0xc330('0x4b')]=qs[_0xc330('0x3a')](_0x1b4f3f['query'][_0xc330('0x3a')]);_0x1742ad[_0xc330('0x3e')]=qs[_0xc330('0x3c')](_[_0xc330('0x3b')](_0x1b4f3f['query'],_0x2c9a53[_0xc330('0x3c')]));if(_0x1b4f3f[_0xc330('0x34')][_0xc330('0x3d')]){_0x1742ad[_0xc330('0x3e')]=_[_0xc330('0x3f')](_0x1742ad['where'],{'$or':_[_0xc330('0x2d')](_0x1742ad[_0xc330('0x36')],function(_0x230fa7){var _0x23c2f7={};_0x23c2f7[_0x230fa7]={'$like':'%'+_0x1b4f3f['query'][_0xc330('0x3d')]+'%'};return _0x23c2f7;})});}_0x1742ad=_['merge']({},_0x1742ad,_0x1b4f3f['options']);return _0x1aea70[_0xc330('0x4f')](_0x1742ad);}})[_0xc330('0x28')](function(_0x4f44e5){if(_0x4f44e5){_0x52c37f=_0x4f44e5['length'];if(!_0x1b4f3f[_0xc330('0x34')][_0xc330('0x38')]('nolimit')){_0x1742ad[_0xc330('0x1f')]=qs[_0xc330('0x1f')](_0x1b4f3f['query']['limit']);_0x1742ad[_0xc330('0x1e')]=qs[_0xc330('0x1e')](_0x1b4f3f['query'][_0xc330('0x1e')]);}return _0x1aea70['getDescriptions'](_0x1742ad);}})[_0xc330('0x28')](function(_0x16ab0b){if(_0x16ab0b){return _0x16ab0b?{'count':_0x52c37f,'rows':_0x16ab0b}:null;}})[_0xc330('0x28')](respondWithResult(_0x67e7b8,null))['catch'](handleError(_0x67e7b8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index d51f2f7..4a8f057 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 _0xa748=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0xa748,0x1f4));var _0x8a74=function(_0x2afb07,_0x524dc0){_0x2afb07=_0x2afb07-0x0;var _0x2613ad=_0xa748[_0x2afb07];return _0x2613ad;};'use strict';var _=require(_0x8a74('0x0'));var util=require(_0x8a74('0x1'));var logger=require(_0x8a74('0x2'))(_0x8a74('0x3'));var moment=require(_0x8a74('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a74('0x5'));var rimraf=require(_0x8a74('0x6'));var config=require(_0x8a74('0x7'));var attributes=require(_0x8a74('0x8'));module[_0x8a74('0x9')]=function(_0x2d3cd1,_0x4c495f){return _0x2d3cd1[_0x8a74('0xa')](_0x8a74('0xb'),attributes,{'tableName':_0x8a74('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa34=['../../config/logger','api','bluebird','request-promise','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash'];(function(_0x319fc1,_0x29179b){var _0xb768af=function(_0x3509ac){while(--_0x3509ac){_0x319fc1['push'](_0x319fc1['shift']());}};_0xb768af(++_0x29179b);}(_0xfa34,0x1d5));var _0x4fa3=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0xfa34[_0x65c903];return _0x23e1d7;};'use strict';var _=require(_0x4fa3('0x0'));var util=require('util');var logger=require(_0x4fa3('0x1'))(_0x4fa3('0x2'));var moment=require('moment');var BPromise=require(_0x4fa3('0x3'));var rp=require(_0x4fa3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fa3('0x5'));var config=require('../../config/environment');var attributes=require(_0x4fa3('0x6'));module[_0x4fa3('0x7')]=function(_0x4c4c0c,_0x8c8011){return _0x4c4c0c[_0x4fa3('0x8')](_0x4fa3('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 454d878..473c0fa 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 _0x671e=['stringify','error','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x921c5d,_0x1d5c42){var _0x2bd305=function(_0x5159e1){while(--_0x5159e1){_0x921c5d['push'](_0x921c5d['shift']());}};_0x2bd305(++_0x1d5c42);}(_0x671e,0x195));var _0xe671=function(_0x51aa5b,_0x512fc0){_0x51aa5b=_0x51aa5b-0x0;var _0x5066d8=_0x671e[_0x51aa5b];return _0x5066d8;};'use strict';var _=require(_0xe671('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe671('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe671('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe671('0x3'))(_0xe671('0x4'));var config=require(_0xe671('0x5'));var jayson=require(_0xe671('0x6'));var client=jayson[_0xe671('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c3f06,_0x1f2d54,_0x240b58){return new BPromise(function(_0x4e0554,_0x2f0bda){return client[_0xe671('0x8')](_0x2c3f06,_0x240b58)['then'](function(_0xd3a54d){logger['info'](_0xe671('0x9'),_0x1f2d54,_0xe671('0xa'));logger[_0xe671('0xb')](_0xe671('0xc'),_0x1f2d54,_0xe671('0xa'),JSON[_0xe671('0xd')](_0xd3a54d));if(_0xd3a54d[_0xe671('0xe')]){if(_0xd3a54d['error']['code']===0x1f4){logger[_0xe671('0xe')](_0xe671('0x9'),_0x1f2d54,_0xd3a54d[_0xe671('0xe')]['message']);return _0x2f0bda(_0xd3a54d['error']['message']);}logger[_0xe671('0xe')](_0xe671('0x9'),_0x1f2d54,_0xd3a54d[_0xe671('0xe')][_0xe671('0xf')]);return _0x4e0554(_0xd3a54d[_0xe671('0xe')][_0xe671('0xf')]);}else{logger[_0xe671('0x10')](_0xe671('0x9'),_0x1f2d54,_0xe671('0xa'));_0x4e0554(_0xd3a54d[_0xe671('0x11')][_0xe671('0xf')]);}})[_0xe671('0x12')](function(_0x4ed00d){logger[_0xe671('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f2d54,_0x4ed00d);_0x2f0bda(_0x4ed00d);});});} \ No newline at end of file +var _0x9e18=['../../config/logger','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e2487,_0x45b827){var _0x4dcb5e=function(_0x39e9d7){while(--_0x39e9d7){_0x5e2487['push'](_0x5e2487['shift']());}};_0x4dcb5e(++_0x45b827);}(_0x9e18,0x142));var _0x89e1=function(_0x117417,_0x214c67){_0x117417=_0x117417-0x0;var _0x5ba86d=_0x9e18[_0x117417];return _0x5ba86d;};'use strict';var _=require(_0x89e1('0x0'));var util=require(_0x89e1('0x1'));var moment=require(_0x89e1('0x2'));var BPromise=require(_0x89e1('0x3'));var rs=require(_0x89e1('0x4'));var fs=require('fs');var Redis=require(_0x89e1('0x5'));var db=require(_0x89e1('0x6'))['db'];var utils=require(_0x89e1('0x7'));var logger=require(_0x89e1('0x8'))('rpc');var config=require(_0x89e1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x89e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2694f5,_0x3a7234,_0x1d29e4){return new BPromise(function(_0x599382,_0xac5984){return client[_0x89e1('0xb')](_0x2694f5,_0x1d29e4)[_0x89e1('0xc')](function(_0xc99c99){logger[_0x89e1('0xd')](_0x89e1('0xe'),_0x3a7234,_0x89e1('0xf'));logger[_0x89e1('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3a7234,_0x89e1('0xf'),JSON[_0x89e1('0x11')](_0xc99c99));if(_0xc99c99[_0x89e1('0x12')]){if(_0xc99c99[_0x89e1('0x12')]['code']===0x1f4){logger[_0x89e1('0x12')](_0x89e1('0xe'),_0x3a7234,_0xc99c99[_0x89e1('0x12')][_0x89e1('0x13')]);return _0xac5984(_0xc99c99[_0x89e1('0x12')]['message']);}logger[_0x89e1('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3a7234,_0xc99c99['error'][_0x89e1('0x13')]);return _0x599382(_0xc99c99['error'][_0x89e1('0x13')]);}else{logger[_0x89e1('0xd')](_0x89e1('0xe'),_0x3a7234,_0x89e1('0xf'));_0x599382(_0xc99c99[_0x89e1('0x14')][_0x89e1('0x13')]);}})[_0x89e1('0x15')](function(_0x786558){logger[_0x89e1('0x12')](_0x89e1('0xe'),_0x3a7234,_0x786558);_0xac5984(_0x786558);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index af50c64..34b731f 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 _0xd957=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd957,0x161));var _0x7d95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd957[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7d95('0x0'));var util=require(_0x7d95('0x1'));var path=require(_0x7d95('0x2'));var timeout=require('connect-timeout');var express=require(_0x7d95('0x3'));var router=express[_0x7d95('0x4')]();var fs_extra=require(_0x7d95('0x5'));var auth=require(_0x7d95('0x6'));var interaction=require(_0x7d95('0x7'));var config=require(_0x7d95('0x8'));var controller=require(_0x7d95('0x9'));router[_0x7d95('0xa')]('/',auth[_0x7d95('0xb')](),controller['index']);router[_0x7d95('0xa')](_0x7d95('0xc'),auth[_0x7d95('0xb')](),controller[_0x7d95('0xd')]);router[_0x7d95('0xe')]('/',auth['isAuthenticated'](),controller[_0x7d95('0xf')]);router[_0x7d95('0x10')](_0x7d95('0xc'),auth[_0x7d95('0xb')](),controller[_0x7d95('0x11')]);router[_0x7d95('0x12')]('/:id',auth[_0x7d95('0xb')](),controller[_0x7d95('0x13')]);module[_0x7d95('0x14')]=router; \ No newline at end of file +var _0xb2a8=['put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','post','create'];(function(_0x11986d,_0x12a6f0){var _0xbf58a5=function(_0x58da34){while(--_0x58da34){_0x11986d['push'](_0x11986d['shift']());}};_0xbf58a5(++_0x12a6f0);}(_0xb2a8,0xe1));var _0x8b2a=function(_0x46d14b,_0x147907){_0x46d14b=_0x46d14b-0x0;var _0x367dfd=_0xb2a8[_0x46d14b];return _0x367dfd;};'use strict';var multer=require(_0x8b2a('0x0'));var util=require(_0x8b2a('0x1'));var path=require('path');var timeout=require(_0x8b2a('0x2'));var express=require('express');var router=express[_0x8b2a('0x3')]();var fs_extra=require(_0x8b2a('0x4'));var auth=require(_0x8b2a('0x5'));var interaction=require(_0x8b2a('0x6'));var config=require(_0x8b2a('0x7'));var controller=require(_0x8b2a('0x8'));router[_0x8b2a('0x9')]('/',auth[_0x8b2a('0xa')](),controller['index']);router[_0x8b2a('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8b2a('0xb')]('/',auth[_0x8b2a('0xa')](),controller[_0x8b2a('0xc')]);router[_0x8b2a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8b2a('0xe')]);router[_0x8b2a('0xf')]('/:id',auth[_0x8b2a('0xa')](),controller['destroy']);module[_0x8b2a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 1dc2cb8..c811886 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 _0x5957=['ENUM','customVariable','picklist','string','STRING','variable','sequelize','exports'];(function(_0x31942a,_0x4972ff){var _0x5d051e=function(_0x295d08){while(--_0x295d08){_0x31942a['push'](_0x31942a['shift']());}};_0x5d051e(++_0x4972ff);}(_0x5957,0x136));var _0x7595=function(_0x3ce5b5,_0xf0b1a3){_0x3ce5b5=_0x3ce5b5-0x0;var _0x338f7b=_0x5957[_0x3ce5b5];return _0x338f7b;};'use strict';var Sequelize=require(_0x7595('0x0'));module[_0x7595('0x1')]={'type':{'type':Sequelize[_0x7595('0x2')]('string','variable',_0x7595('0x3'),'keyValue',_0x7595('0x4')),'defaultValue':_0x7595('0x5')},'content':{'type':Sequelize[_0x7595('0x6')]},'key':{'type':Sequelize[_0x7595('0x6')]},'keyType':{'type':Sequelize[_0x7595('0x2')](_0x7595('0x5'),_0x7595('0x7'),_0x7595('0x3'))},'keyContent':{'type':Sequelize[_0x7595('0x6')]},'idField':{'type':Sequelize[_0x7595('0x6')]},'variableName':{'type':Sequelize[_0x7595('0x6')]}}; \ No newline at end of file +var _0xf7e0=['string','variable','keyValue','STRING','customVariable','exports','ENUM'];(function(_0x21624b,_0x3b5101){var _0x4d5cf1=function(_0x46ba1a){while(--_0x46ba1a){_0x21624b['push'](_0x21624b['shift']());}};_0x4d5cf1(++_0x3b5101);}(_0xf7e0,0x116));var _0x0f7e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf7e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0x0f7e('0x0')]={'type':{'type':Sequelize[_0x0f7e('0x1')](_0x0f7e('0x2'),_0x0f7e('0x3'),'customVariable',_0x0f7e('0x4'),'picklist'),'defaultValue':_0x0f7e('0x2')},'content':{'type':Sequelize[_0x0f7e('0x5')]},'key':{'type':Sequelize[_0x0f7e('0x5')]},'keyType':{'type':Sequelize[_0x0f7e('0x1')](_0x0f7e('0x2'),_0x0f7e('0x3'),_0x0f7e('0x6'))},'keyContent':{'type':Sequelize[_0x0f7e('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x0f7e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index fe73464..fbd3f4e 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 _0x971f=['../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','update','then','destroy','error','name','send','index','map','SalesforceField','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x1e0d29,_0x1f5fab){var _0x4d395c=function(_0x30533d){while(--_0x30533d){_0x1e0d29['push'](_0x1e0d29['shift']());}};_0x4d395c(++_0x1f5fab);}(_0x971f,0xf8));var _0xf971=function(_0x2501c9,_0x54b5c0){_0x2501c9=_0x2501c9-0x0;var _0x4fcdf0=_0x971f[_0x2501c9];return _0x4fcdf0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf971('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf971('0x1'));var BPromise=require(_0xf971('0x2'));var Mustache=require(_0xf971('0x3'));var util=require(_0xf971('0x4'));var path=require(_0xf971('0x5'));var sox=require(_0xf971('0x6'));var csv=require(_0xf971('0x7'));var ejs=require(_0xf971('0x8'));var fs=require('fs');var fs_extra=require(_0xf971('0x9'));var _=require(_0xf971('0xa'));var squel=require(_0xf971('0xb'));var crypto=require('crypto');var jsforce=require(_0xf971('0xc'));var deskjs=require(_0xf971('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf971('0xe'));var authService=require(_0xf971('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf971('0x10'));var logger=require(_0xf971('0x11'))(_0xf971('0x12'));var utils=require('../../config/utils');var config=require(_0xf971('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf971('0x14'))['db'];function respondWithStatusCode(_0x1f0704,_0x4533ee){_0x4533ee=_0x4533ee||0xcc;return function(_0x390fc4){if(_0x390fc4){return _0x1f0704[_0xf971('0x15')](_0x4533ee);}return _0x1f0704[_0xf971('0x16')](_0x4533ee)[_0xf971('0x17')]();};}function respondWithResult(_0x23953a,_0x1d9b4b){_0x1d9b4b=_0x1d9b4b||0xc8;return function(_0xed07ae){if(_0xed07ae){return _0x23953a[_0xf971('0x16')](_0x1d9b4b)['json'](_0xed07ae);}};}function respondWithFilteredResult(_0x3c2975,_0x501598){return function(_0x3cccdc){if(_0x3cccdc){var _0x418bc8=typeof _0x501598[_0xf971('0x18')]==='undefined'&&typeof _0x501598[_0xf971('0x19')]===_0xf971('0x1a');var _0x5e4c3f=_0x3cccdc[_0xf971('0x1b')];var _0x2fc1d9=_0x418bc8?0x0:_0x501598[_0xf971('0x18')];var _0x5c5143=_0x418bc8?_0x3cccdc[_0xf971('0x1b')]:_0x501598['offset']+_0x501598[_0xf971('0x19')];var _0x5e757c;if(_0x5c5143>=_0x5e4c3f){_0x5c5143=_0x5e4c3f;_0x5e757c=0xc8;}else{_0x5e757c=0xce;}_0x3c2975[_0xf971('0x16')](_0x5e757c);return _0x3c2975['set'](_0xf971('0x1c'),_0x2fc1d9+'-'+_0x5c5143+'/'+_0x5e4c3f)[_0xf971('0x1d')](_0x3cccdc);}return null;};}function patchUpdates(_0x78d0ef){return function(_0x3d57c7){try{jsonpatch[_0xf971('0x1e')](_0x3d57c7,_0x78d0ef,!![]);}catch(_0x2e0213){return BPromise['reject'](_0x2e0213);}return _0x3d57c7['save']();};}function saveUpdates(_0x2958f5,_0x290230){return function(_0x407569){if(_0x407569){return _0x407569[_0xf971('0x1f')](_0x2958f5)[_0xf971('0x20')](function(_0x4df644){return _0x4df644;});}return null;};}function removeEntity(_0x384111,_0x235254){return function(_0x49d219){if(_0x49d219){return _0x49d219[_0xf971('0x21')]()[_0xf971('0x20')](function(){_0x384111['status'](0xcc)[_0xf971('0x17')]();});}};}function handleEntityNotFound(_0x31766b,_0x2bc16d){return function(_0x3ada5e){if(!_0x3ada5e){_0x31766b[_0xf971('0x15')](0x194);}return _0x3ada5e;};}function handleError(_0x539e25,_0x34f5dc){_0x34f5dc=_0x34f5dc||0x1f4;return function(_0x295402){logger[_0xf971('0x22')](_0x295402['stack']);if(_0x295402[_0xf971('0x23')]){delete _0x295402[_0xf971('0x23')];}_0x539e25[_0xf971('0x16')](_0x34f5dc)[_0xf971('0x24')](_0x295402);};}exports[_0xf971('0x25')]=function(_0x3328b3,_0x143b33){var _0x33def1={},_0x5b41cb={},_0x45bd6b={'count':0x0,'rows':[]};var _0x31a132=_[_0xf971('0x26')](db[_0xf971('0x27')]['rawAttributes'],function(_0x54e58c){return{'name':_0x54e58c['fieldName'],'type':_0x54e58c[_0xf971('0x28')][_0xf971('0x29')]};});_0x5b41cb['model']=_[_0xf971('0x26')](_0x31a132,'name');_0x5b41cb[_0xf971('0x2a')]=_['keys'](_0x3328b3[_0xf971('0x2a')]);_0x5b41cb[_0xf971('0x2b')]=_[_0xf971('0x2c')](_0x5b41cb['model'],_0x5b41cb['query']);_0x33def1[_0xf971('0x2d')]=_[_0xf971('0x2c')](_0x5b41cb['model'],qs[_0xf971('0x2e')](_0x3328b3[_0xf971('0x2a')][_0xf971('0x2e')]));_0x33def1['attributes']=_0x33def1[_0xf971('0x2d')][_0xf971('0x2f')]?_0x33def1[_0xf971('0x2d')]:_0x5b41cb[_0xf971('0x30')];if(!_0x3328b3[_0xf971('0x2a')][_0xf971('0x31')]('nolimit')){_0x33def1[_0xf971('0x19')]=qs[_0xf971('0x19')](_0x3328b3[_0xf971('0x2a')]['limit']);_0x33def1['offset']=qs[_0xf971('0x18')](_0x3328b3['query'][_0xf971('0x18')]);}_0x33def1['order']=qs[_0xf971('0x32')](_0x3328b3['query'][_0xf971('0x32')]);_0x33def1['where']=qs['filters'](_['pick'](_0x3328b3['query'],_0x5b41cb['filters']),_0x31a132);if(_0x3328b3[_0xf971('0x2a')][_0xf971('0x33')]){_0x33def1[_0xf971('0x34')]=_[_0xf971('0x35')](_0x33def1['where'],{'$or':_[_0xf971('0x26')](_0x31a132,function(_0x410f87){if(_0x410f87[_0xf971('0x28')]!==_0xf971('0x36')){var _0x3f45b0={};_0x3f45b0[_0x410f87[_0xf971('0x23')]]={'$like':'%'+_0x3328b3[_0xf971('0x2a')][_0xf971('0x33')]+'%'};return _0x3f45b0;}})});}_0x33def1=_['merge']({},_0x33def1,_0x3328b3['options']);var _0x1ae422={'where':_0x33def1[_0xf971('0x34')]};return db['SalesforceField'][_0xf971('0x1b')](_0x1ae422)[_0xf971('0x20')](function(_0xa82a60){_0x45bd6b[_0xf971('0x1b')]=_0xa82a60;if(_0x3328b3[_0xf971('0x2a')][_0xf971('0x37')]){_0x33def1[_0xf971('0x38')]=[{'all':!![]}];}return db[_0xf971('0x27')][_0xf971('0x39')](_0x33def1);})['then'](function(_0x41598d){_0x45bd6b[_0xf971('0x3a')]=_0x41598d;return _0x45bd6b;})[_0xf971('0x20')](respondWithFilteredResult(_0x143b33,_0x33def1))[_0xf971('0x3b')](handleError(_0x143b33,null));};exports[_0xf971('0x3c')]=function(_0x2e7a0e,_0xed43af){var _0xc63e18={'raw':!![],'where':{'id':_0x2e7a0e[_0xf971('0x3d')]['id']}},_0x680ac7={};_0x680ac7[_0xf971('0x30')]=_[_0xf971('0x3e')](db[_0xf971('0x27')][_0xf971('0x3f')]);_0x680ac7[_0xf971('0x2a')]=_[_0xf971('0x3e')](_0x2e7a0e[_0xf971('0x2a')]);_0x680ac7['filters']=_['intersection'](_0x680ac7[_0xf971('0x30')],_0x680ac7[_0xf971('0x2a')]);_0xc63e18[_0xf971('0x2d')]=_[_0xf971('0x2c')](_0x680ac7['model'],qs['fields'](_0x2e7a0e[_0xf971('0x2a')][_0xf971('0x2e')]));_0xc63e18['attributes']=_0xc63e18[_0xf971('0x2d')]['length']?_0xc63e18[_0xf971('0x2d')]:_0x680ac7[_0xf971('0x30')];if(_0x2e7a0e[_0xf971('0x2a')]['includeAll']){_0xc63e18[_0xf971('0x38')]=[{'all':!![]}];}_0xc63e18=_[_0xf971('0x35')]({},_0xc63e18,_0x2e7a0e['options']);return db['SalesforceField'][_0xf971('0x40')](_0xc63e18)['then'](handleEntityNotFound(_0xed43af,null))[_0xf971('0x20')](respondWithResult(_0xed43af,null))[_0xf971('0x3b')](handleError(_0xed43af,null));};exports['create']=function(_0x21d130,_0x33a7cb){return db['SalesforceField'][_0xf971('0x41')](_0x21d130['body'],{})['then'](respondWithResult(_0x33a7cb,0xc9))[_0xf971('0x3b')](handleError(_0x33a7cb,null));};exports['update']=function(_0x796a9,_0x480d61){if(_0x796a9[_0xf971('0x42')]['id']){delete _0x796a9['body']['id'];}return db['SalesforceField'][_0xf971('0x40')]({'where':{'id':_0x796a9['params']['id']}})[_0xf971('0x20')](handleEntityNotFound(_0x480d61,null))['then'](saveUpdates(_0x796a9[_0xf971('0x42')],null))[_0xf971('0x20')](respondWithResult(_0x480d61,null))[_0xf971('0x3b')](handleError(_0x480d61,null));};exports['destroy']=function(_0x34bae8,_0x151f16){return db[_0xf971('0x27')]['find']({'where':{'id':_0x34bae8[_0xf971('0x3d')]['id']}})[_0xf971('0x20')](handleEntityNotFound(_0x151f16,null))[_0xf971('0x20')](removeEntity(_0x151f16,null))[_0xf971('0x3b')](handleError(_0x151f16,null));}; \ No newline at end of file +var _0x45a8=['destroy','error','stack','name','index','SalesforceField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x45a8,0x113));var _0x845a=function(_0x47d439,_0x2918ec){_0x47d439=_0x47d439-0x0;var _0x1415ec=_0x45a8[_0x47d439];return _0x1415ec;};'use strict';var emlformat=require(_0x845a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x845a('0x1'));var jsonpatch=require(_0x845a('0x2'));var rp=require(_0x845a('0x3'));var moment=require('moment');var BPromise=require(_0x845a('0x4'));var Mustache=require(_0x845a('0x5'));var util=require(_0x845a('0x6'));var path=require(_0x845a('0x7'));var sox=require(_0x845a('0x8'));var csv=require(_0x845a('0x9'));var ejs=require(_0x845a('0xa'));var fs=require('fs');var fs_extra=require(_0x845a('0xb'));var _=require(_0x845a('0xc'));var squel=require(_0x845a('0xd'));var crypto=require(_0x845a('0xe'));var jsforce=require(_0x845a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x845a('0x10'));var Papa=require(_0x845a('0x11'));var Redis=require('ioredis');var authService=require(_0x845a('0x12'));var qs=require(_0x845a('0x13'));var as=require(_0x845a('0x14'));var hardwareService=require(_0x845a('0x15'));var logger=require(_0x845a('0x16'))(_0x845a('0x17'));var utils=require(_0x845a('0x18'));var config=require(_0x845a('0x19'));var licenseUtil=require(_0x845a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x78ccbf,_0x96439e){_0x96439e=_0x96439e||0xcc;return function(_0x5afbfd){if(_0x5afbfd){return _0x78ccbf[_0x845a('0x1b')](_0x96439e);}return _0x78ccbf[_0x845a('0x1c')](_0x96439e)[_0x845a('0x1d')]();};}function respondWithResult(_0x37e364,_0x12069a){_0x12069a=_0x12069a||0xc8;return function(_0x357337){if(_0x357337){return _0x37e364[_0x845a('0x1c')](_0x12069a)[_0x845a('0x1e')](_0x357337);}};}function respondWithFilteredResult(_0x1d168d,_0x27b485){return function(_0x1ed761){if(_0x1ed761){var _0x32f95f=typeof _0x27b485[_0x845a('0x1f')]==='undefined'&&typeof _0x27b485[_0x845a('0x20')]===_0x845a('0x21');var _0x371daa=_0x1ed761[_0x845a('0x22')];var _0x5e72cd=_0x32f95f?0x0:_0x27b485['offset'];var _0x3fad73=_0x32f95f?_0x1ed761[_0x845a('0x22')]:_0x27b485[_0x845a('0x1f')]+_0x27b485['limit'];var _0x223ef4;if(_0x3fad73>=_0x371daa){_0x3fad73=_0x371daa;_0x223ef4=0xc8;}else{_0x223ef4=0xce;}_0x1d168d[_0x845a('0x1c')](_0x223ef4);return _0x1d168d[_0x845a('0x23')](_0x845a('0x24'),_0x5e72cd+'-'+_0x3fad73+'/'+_0x371daa)[_0x845a('0x1e')](_0x1ed761);}return null;};}function patchUpdates(_0x35fcc5){return function(_0x1a846b){try{jsonpatch[_0x845a('0x25')](_0x1a846b,_0x35fcc5,!![]);}catch(_0x463f05){return BPromise[_0x845a('0x26')](_0x463f05);}return _0x1a846b[_0x845a('0x27')]();};}function saveUpdates(_0x1efe02,_0x3210dc){return function(_0x7fa941){if(_0x7fa941){return _0x7fa941['update'](_0x1efe02)[_0x845a('0x28')](function(_0xfcf39){return _0xfcf39;});}return null;};}function removeEntity(_0xf927d5,_0x5e66e3){return function(_0x22bc34){if(_0x22bc34){return _0x22bc34[_0x845a('0x29')]()[_0x845a('0x28')](function(){_0xf927d5[_0x845a('0x1c')](0xcc)[_0x845a('0x1d')]();});}};}function handleEntityNotFound(_0x4977dd,_0x185bc1){return function(_0xcb0fd4){if(!_0xcb0fd4){_0x4977dd[_0x845a('0x1b')](0x194);}return _0xcb0fd4;};}function handleError(_0x2bdb2e,_0x4a4b04){_0x4a4b04=_0x4a4b04||0x1f4;return function(_0x2a92ac){logger[_0x845a('0x2a')](_0x2a92ac[_0x845a('0x2b')]);if(_0x2a92ac[_0x845a('0x2c')]){delete _0x2a92ac[_0x845a('0x2c')];}_0x2bdb2e['status'](_0x4a4b04)['send'](_0x2a92ac);};}exports[_0x845a('0x2d')]=function(_0x1e1884,_0x3cf507){var _0x2e88b8={},_0xed92b7={},_0x17288d={'count':0x0,'rows':[]};var _0x449ca2=_['map'](db[_0x845a('0x2e')]['rawAttributes'],function(_0xb7a9ae){return{'name':_0xb7a9ae[_0x845a('0x2f')],'type':_0xb7a9ae[_0x845a('0x30')][_0x845a('0x31')]};});_0xed92b7[_0x845a('0x32')]=_['map'](_0x449ca2,_0x845a('0x2c'));_0xed92b7[_0x845a('0x33')]=_[_0x845a('0x34')](_0x1e1884[_0x845a('0x33')]);_0xed92b7['filters']=_[_0x845a('0x35')](_0xed92b7[_0x845a('0x32')],_0xed92b7[_0x845a('0x33')]);_0x2e88b8[_0x845a('0x36')]=_[_0x845a('0x35')](_0xed92b7[_0x845a('0x32')],qs[_0x845a('0x37')](_0x1e1884[_0x845a('0x33')]['fields']));_0x2e88b8[_0x845a('0x36')]=_0x2e88b8[_0x845a('0x36')][_0x845a('0x38')]?_0x2e88b8[_0x845a('0x36')]:_0xed92b7[_0x845a('0x32')];if(!_0x1e1884[_0x845a('0x33')][_0x845a('0x39')](_0x845a('0x3a'))){_0x2e88b8[_0x845a('0x20')]=qs[_0x845a('0x20')](_0x1e1884[_0x845a('0x33')][_0x845a('0x20')]);_0x2e88b8['offset']=qs[_0x845a('0x1f')](_0x1e1884['query'][_0x845a('0x1f')]);}_0x2e88b8[_0x845a('0x3b')]=qs[_0x845a('0x3c')](_0x1e1884[_0x845a('0x33')][_0x845a('0x3c')]);_0x2e88b8[_0x845a('0x3d')]=qs[_0x845a('0x3e')](_[_0x845a('0x3f')](_0x1e1884['query'],_0xed92b7[_0x845a('0x3e')]),_0x449ca2);if(_0x1e1884[_0x845a('0x33')]['filter']){_0x2e88b8[_0x845a('0x3d')]=_[_0x845a('0x40')](_0x2e88b8['where'],{'$or':_[_0x845a('0x41')](_0x449ca2,function(_0x117605){if(_0x117605['type']!==_0x845a('0x42')){var _0x131cdc={};_0x131cdc[_0x117605[_0x845a('0x2c')]]={'$like':'%'+_0x1e1884[_0x845a('0x33')]['filter']+'%'};return _0x131cdc;}})});}_0x2e88b8=_['merge']({},_0x2e88b8,_0x1e1884['options']);var _0x3b692={'where':_0x2e88b8[_0x845a('0x3d')]};return db[_0x845a('0x2e')][_0x845a('0x22')](_0x3b692)['then'](function(_0xa0d067){_0x17288d[_0x845a('0x22')]=_0xa0d067;if(_0x1e1884[_0x845a('0x33')][_0x845a('0x43')]){_0x2e88b8[_0x845a('0x44')]=[{'all':!![]}];}return db['SalesforceField'][_0x845a('0x45')](_0x2e88b8);})[_0x845a('0x28')](function(_0xb6018){_0x17288d[_0x845a('0x46')]=_0xb6018;return _0x17288d;})[_0x845a('0x28')](respondWithFilteredResult(_0x3cf507,_0x2e88b8))['catch'](handleError(_0x3cf507,null));};exports[_0x845a('0x47')]=function(_0x42eec9,_0xcab8bb){var _0x5de84c={'raw':!![],'where':{'id':_0x42eec9[_0x845a('0x48')]['id']}},_0x581342={};_0x581342['model']=_[_0x845a('0x34')](db['SalesforceField'][_0x845a('0x49')]);_0x581342[_0x845a('0x33')]=_[_0x845a('0x34')](_0x42eec9[_0x845a('0x33')]);_0x581342[_0x845a('0x3e')]=_[_0x845a('0x35')](_0x581342[_0x845a('0x32')],_0x581342[_0x845a('0x33')]);_0x5de84c[_0x845a('0x36')]=_[_0x845a('0x35')](_0x581342[_0x845a('0x32')],qs[_0x845a('0x37')](_0x42eec9[_0x845a('0x33')][_0x845a('0x37')]));_0x5de84c[_0x845a('0x36')]=_0x5de84c['attributes'][_0x845a('0x38')]?_0x5de84c[_0x845a('0x36')]:_0x581342[_0x845a('0x32')];if(_0x42eec9['query'][_0x845a('0x43')]){_0x5de84c[_0x845a('0x44')]=[{'all':!![]}];}_0x5de84c=_['merge']({},_0x5de84c,_0x42eec9['options']);return db['SalesforceField']['find'](_0x5de84c)[_0x845a('0x28')](handleEntityNotFound(_0xcab8bb,null))[_0x845a('0x28')](respondWithResult(_0xcab8bb,null))[_0x845a('0x4a')](handleError(_0xcab8bb,null));};exports[_0x845a('0x4b')]=function(_0x1e8e51,_0x4dfaf1){return db[_0x845a('0x2e')][_0x845a('0x4b')](_0x1e8e51[_0x845a('0x4c')],{})[_0x845a('0x28')](respondWithResult(_0x4dfaf1,0xc9))[_0x845a('0x4a')](handleError(_0x4dfaf1,null));};exports[_0x845a('0x4d')]=function(_0x1d7dd7,_0x35ce02){if(_0x1d7dd7['body']['id']){delete _0x1d7dd7['body']['id'];}return db[_0x845a('0x2e')][_0x845a('0x4e')]({'where':{'id':_0x1d7dd7[_0x845a('0x48')]['id']}})[_0x845a('0x28')](handleEntityNotFound(_0x35ce02,null))[_0x845a('0x28')](saveUpdates(_0x1d7dd7[_0x845a('0x4c')],null))[_0x845a('0x28')](respondWithResult(_0x35ce02,null))[_0x845a('0x4a')](handleError(_0x35ce02,null));};exports['destroy']=function(_0x51e7e2,_0x59af20){return db[_0x845a('0x2e')][_0x845a('0x4e')]({'where':{'id':_0x51e7e2[_0x845a('0x48')]['id']}})[_0x845a('0x28')](handleEntityNotFound(_0x59af20,null))[_0x845a('0x28')](removeEntity(_0x59af20,null))[_0x845a('0x4a')](handleError(_0x59af20,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 772cf0e..3c4113a 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 _0x4a58=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId'];(function(_0x5d09b0,_0x134448){var _0x398eaf=function(_0x311aa9){while(--_0x311aa9){_0x5d09b0['push'](_0x5d09b0['shift']());}};_0x398eaf(++_0x134448);}(_0x4a58,0xc4));var _0x84a5=function(_0x32fc16,_0x26b884){_0x32fc16=_0x32fc16-0x0;var _0x262a81=_0x4a58[_0x32fc16];return _0x262a81;};'use strict';var _=require(_0x84a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x84a5('0x1'));var moment=require(_0x84a5('0x2'));var BPromise=require(_0x84a5('0x3'));var rp=require(_0x84a5('0x4'));var fs=require('fs');var path=require(_0x84a5('0x5'));var rimraf=require('rimraf');var config=require(_0x84a5('0x6'));var attributes=require(_0x84a5('0x7'));module[_0x84a5('0x8')]=function(_0xfde622,_0x522131){return _0xfde622[_0x84a5('0x9')](_0x84a5('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x84a5('0xb'),'fields':[_0x84a5('0xc'),_0x84a5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69c1=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intSalesforceField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69c1,0x1d4));var _0x169c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x69c1[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x169c('0x0'));var util=require('util');var logger=require(_0x169c('0x1'))(_0x169c('0x2'));var moment=require(_0x169c('0x3'));var BPromise=require(_0x169c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x169c('0x5'));var rimraf=require('rimraf');var config=require(_0x169c('0x6'));var attributes=require(_0x169c('0x7'));module[_0x169c('0x8')]=function(_0x206eda,_0x15444b){return _0x206eda[_0x169c('0x9')](_0x169c('0xa'),attributes,{'tableName':_0x169c('0xb'),'paranoid':![],'indexes':[{'name':_0x169c('0xc'),'fields':[_0x169c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 1977ae2..0d014dc 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 _0x03b8=['SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x98f07a,_0x374ea9){var _0x2f6672=function(_0x4ae8b9){while(--_0x4ae8b9){_0x98f07a['push'](_0x98f07a['shift']());}};_0x2f6672(++_0x374ea9);}(_0x03b8,0x104));var _0x803b=function(_0x197c44,_0x11ded9){_0x197c44=_0x197c44-0x0;var _0x2d159a=_0x03b8[_0x197c44];return _0x2d159a;};'use strict';var _=require('lodash');var util=require(_0x803b('0x0'));var moment=require(_0x803b('0x1'));var BPromise=require(_0x803b('0x2'));var rs=require(_0x803b('0x3'));var fs=require('fs');var Redis=require(_0x803b('0x4'));var db=require(_0x803b('0x5'))['db'];var utils=require(_0x803b('0x6'));var logger=require(_0x803b('0x7'))(_0x803b('0x8'));var config=require(_0x803b('0x9'));var jayson=require(_0x803b('0xa'));var client=jayson[_0x803b('0xb')][_0x803b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x229bf0,_0x26411d,_0xc44aa3){return new BPromise(function(_0x5d6870,_0x61de6){return client['request'](_0x229bf0,_0xc44aa3)[_0x803b('0xd')](function(_0xb18835){logger[_0x803b('0xe')](_0x803b('0xf'),_0x26411d,'request\x20sent');logger[_0x803b('0x10')](_0x803b('0x11'),_0x26411d,_0x803b('0x12'),JSON[_0x803b('0x13')](_0xb18835));if(_0xb18835['error']){if(_0xb18835[_0x803b('0x14')][_0x803b('0x15')]===0x1f4){logger[_0x803b('0x14')](_0x803b('0xf'),_0x26411d,_0xb18835['error'][_0x803b('0x16')]);return _0x61de6(_0xb18835[_0x803b('0x14')][_0x803b('0x16')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x26411d,_0xb18835['error'][_0x803b('0x16')]);return _0x5d6870(_0xb18835[_0x803b('0x14')][_0x803b('0x16')]);}else{logger[_0x803b('0xe')]('SalesforceField,\x20%s,\x20%s',_0x26411d,_0x803b('0x12'));_0x5d6870(_0xb18835[_0x803b('0x17')][_0x803b('0x16')]);}})[_0x803b('0x18')](function(_0xc89b40){logger['error'](_0x803b('0xf'),_0x26411d,_0xc89b40);_0x61de6(_0xc89b40);});});} \ No newline at end of file +var _0xc168=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0xc168,0x91));var _0x8c16=function(_0x5d7385,_0x4a9fdd){_0x5d7385=_0x5d7385-0x0;var _0x183773=_0xc168[_0x5d7385];return _0x183773;};'use strict';var _=require(_0x8c16('0x0'));var util=require(_0x8c16('0x1'));var moment=require(_0x8c16('0x2'));var BPromise=require(_0x8c16('0x3'));var rs=require(_0x8c16('0x4'));var fs=require('fs');var Redis=require(_0x8c16('0x5'));var db=require(_0x8c16('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c16('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c16('0x8'));var client=jayson['client'][_0x8c16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x287286,_0x3d01a5,_0x4c7186){return new BPromise(function(_0x242d9f,_0x3b6861){return client[_0x8c16('0xa')](_0x287286,_0x4c7186)[_0x8c16('0xb')](function(_0x332e27){logger[_0x8c16('0xc')](_0x8c16('0xd'),_0x3d01a5,'request\x20sent');logger[_0x8c16('0xe')](_0x8c16('0xf'),_0x3d01a5,'request\x20sent',JSON[_0x8c16('0x10')](_0x332e27));if(_0x332e27[_0x8c16('0x11')]){if(_0x332e27['error'][_0x8c16('0x12')]===0x1f4){logger[_0x8c16('0x11')](_0x8c16('0xd'),_0x3d01a5,_0x332e27[_0x8c16('0x11')][_0x8c16('0x13')]);return _0x3b6861(_0x332e27[_0x8c16('0x11')][_0x8c16('0x13')]);}logger[_0x8c16('0x11')](_0x8c16('0xd'),_0x3d01a5,_0x332e27[_0x8c16('0x11')][_0x8c16('0x13')]);return _0x242d9f(_0x332e27[_0x8c16('0x11')]['message']);}else{logger[_0x8c16('0xc')](_0x8c16('0xd'),_0x3d01a5,_0x8c16('0x14'));_0x242d9f(_0x332e27[_0x8c16('0x15')][_0x8c16('0x13')]);}})[_0x8c16('0x16')](function(_0x34f649){logger['error'](_0x8c16('0xd'),_0x3d01a5,_0x34f649);_0x3b6861(_0x34f649);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ebe279e..55ecc19 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 _0xd88b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3c07b2,_0x1cf31b){var _0x222452=function(_0x504e88){while(--_0x504e88){_0x3c07b2['push'](_0x3c07b2['shift']());}};_0x222452(++_0x1cf31b);}(_0xd88b,0x104));var _0xbd88=function(_0x396644,_0x3c8fb9){_0x396644=_0x396644-0x0;var _0x5187c2=_0xd88b[_0x396644];return _0x5187c2;};'use strict';var multer=require(_0xbd88('0x0'));var util=require(_0xbd88('0x1'));var path=require(_0xbd88('0x2'));var timeout=require(_0xbd88('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd88('0x4'));var auth=require(_0xbd88('0x5'));var interaction=require(_0xbd88('0x6'));var config=require(_0xbd88('0x7'));var controller=require('./intServicenowAccount.controller');router[_0xbd88('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbd88('0x8')]('/:id',auth[_0xbd88('0x9')](),controller['show']);router[_0xbd88('0x8')](_0xbd88('0xa'),auth[_0xbd88('0x9')](),controller[_0xbd88('0xb')]);router[_0xbd88('0x8')](_0xbd88('0xc'),auth[_0xbd88('0x9')](),controller[_0xbd88('0xd')]);router[_0xbd88('0xe')]('/',auth[_0xbd88('0x9')](),controller[_0xbd88('0xf')]);router[_0xbd88('0xe')](_0xbd88('0xa'),auth[_0xbd88('0x9')](),controller['addConfiguration']);router[_0xbd88('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xbd88('0x11')]);router[_0xbd88('0x12')](_0xbd88('0x13'),auth[_0xbd88('0x9')](),controller[_0xbd88('0x14')]);module[_0xbd88('0x15')]=router; \ No newline at end of file +var _0x2bb0=['destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x43714a,_0x408cd7){var _0x544d7f=function(_0x3e8d0c){while(--_0x3e8d0c){_0x43714a['push'](_0x43714a['shift']());}};_0x544d7f(++_0x408cd7);}(_0x2bb0,0xf3));var _0x02bb=function(_0x5d8414,_0x26f9a8){_0x5d8414=_0x5d8414-0x0;var _0x2f33d6=_0x2bb0[_0x5d8414];return _0x2f33d6;};'use strict';var multer=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var path=require(_0x02bb('0x2'));var timeout=require('connect-timeout');var express=require(_0x02bb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x02bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x02bb('0x5'));var controller=require(_0x02bb('0x6'));router[_0x02bb('0x7')]('/',auth[_0x02bb('0x8')](),controller[_0x02bb('0x9')]);router[_0x02bb('0x7')](_0x02bb('0xa'),auth['isAuthenticated'](),controller[_0x02bb('0xb')]);router[_0x02bb('0x7')](_0x02bb('0xc'),auth['isAuthenticated'](),controller[_0x02bb('0xd')]);router['get'](_0x02bb('0xe'),auth[_0x02bb('0x8')](),controller['getFields']);router[_0x02bb('0xf')]('/',auth[_0x02bb('0x8')](),controller[_0x02bb('0x10')]);router['post'](_0x02bb('0xc'),auth['isAuthenticated'](),controller[_0x02bb('0x11')]);router[_0x02bb('0x12')](_0x02bb('0xa'),auth['isAuthenticated'](),controller[_0x02bb('0x13')]);router[_0x02bb('0x14')](_0x02bb('0xa'),auth['isAuthenticated'](),controller[_0x02bb('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 f02d5b7..6438845 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 _0xfedb=['remoteUri','sequelize','exports','STRING','username'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfedb,0x196));var _0xbfed=function(_0x302e35,_0x2bb611){_0x302e35=_0x302e35-0x0;var _0x4714e1=_0xfedb[_0x302e35];return _0x4714e1;};'use strict';var Sequelize=require(_0xbfed('0x0'));module[_0xbfed('0x1')]={'name':{'type':Sequelize[_0xbfed('0x2')]},'description':{'type':Sequelize[_0xbfed('0x2')]},'username':{'type':Sequelize[_0xbfed('0x2')],'unique':_0xbfed('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbfed('0x2')]},'remoteUri':{'type':Sequelize[_0xbfed('0x2')],'unique':_0xbfed('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8e9a=['remoteUri','sequelize','exports','STRING'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x8e9a,0x1a1));var _0xa8e9=function(_0x36c144,_0x11d2fa){_0x36c144=_0x36c144-0x0;var _0x5da0e2=_0x8e9a[_0x36c144];return _0x5da0e2;};'use strict';var Sequelize=require(_0xa8e9('0x0'));module[_0xa8e9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa8e9('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xa8e9('0x2')]},'email':{'type':Sequelize[_0xa8e9('0x2')]},'remoteUri':{'type':Sequelize[_0xa8e9('0x2')],'unique':_0xa8e9('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 9b0e927..3523e0e 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 _0x14aa=['internalType','ServiceNow\x20error:\x20','test','error','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','result','inactive','false','eml-format','zip-dir','moment','bluebird','util','path','to-csv','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','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','findOne','ServicenowConfiguration','getConfigurations','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','subcategory','close_code','notify','incident_state','category','parent','made_sla','caused_by','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','opened_at','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','correlation_id','username','serverUrl','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','label','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom'];(function(_0x4d9f21,_0x2f3d04){var _0x53faba=function(_0x5723a4){while(--_0x5723a4){_0x4d9f21['push'](_0x4d9f21['shift']());}};_0x53faba(++_0x2f3d04);}(_0x14aa,0xc1));var _0xa14a=function(_0x2d08e3,_0x5661ec){_0x2d08e3=_0x2d08e3-0x0;var _0x2e8094=_0x14aa[_0x2d08e3];return _0x2e8094;};'use strict';var emlformat=require(_0xa14a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa14a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa14a('0x2'));var BPromise=require(_0xa14a('0x3'));var Mustache=require('mustache');var util=require(_0xa14a('0x4'));var path=require(_0xa14a('0x5'));var sox=require('sox');var csv=require(_0xa14a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa14a('0x7'));var squel=require(_0xa14a('0x8'));var crypto=require(_0xa14a('0x9'));var jsforce=require(_0xa14a('0xa'));var deskjs=require(_0xa14a('0xb'));var toCsv=require(_0xa14a('0x6'));var querystring=require(_0xa14a('0xc'));var Papa=require(_0xa14a('0xd'));var Redis=require(_0xa14a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa14a('0xf'));var as=require(_0xa14a('0x10'));var hardwareService=require(_0xa14a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa14a('0x12'));var config=require(_0xa14a('0x13'));var licenseUtil=require(_0xa14a('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa14a('0x15'));function respondWithStatusCode(_0xc53c68,_0xb53f17){_0xb53f17=_0xb53f17||0xcc;return function(_0x1d7acf){if(_0x1d7acf){return _0xc53c68['sendStatus'](_0xb53f17);}return _0xc53c68[_0xa14a('0x16')](_0xb53f17)[_0xa14a('0x17')]();};}function respondWithResult(_0x192dfe,_0x502687){_0x502687=_0x502687||0xc8;return function(_0xf8d0f6){if(_0xf8d0f6){return _0x192dfe['status'](_0x502687)[_0xa14a('0x18')](_0xf8d0f6);}};}function respondWithFilteredResult(_0x3689e5,_0x487d75){return function(_0x115a4d){if(_0x115a4d){var _0x1900b4=typeof _0x487d75[_0xa14a('0x19')]==='undefined'&&typeof _0x487d75[_0xa14a('0x1a')]===_0xa14a('0x1b');var _0xfde99d=_0x115a4d[_0xa14a('0x1c')];var _0x480231=_0x1900b4?0x0:_0x487d75[_0xa14a('0x19')];var _0x3e91a3=_0x1900b4?_0x115a4d[_0xa14a('0x1c')]:_0x487d75['offset']+_0x487d75[_0xa14a('0x1a')];var _0x44f470;if(_0x3e91a3>=_0xfde99d){_0x3e91a3=_0xfde99d;_0x44f470=0xc8;}else{_0x44f470=0xce;}_0x3689e5[_0xa14a('0x16')](_0x44f470);return _0x3689e5[_0xa14a('0x1d')](_0xa14a('0x1e'),_0x480231+'-'+_0x3e91a3+'/'+_0xfde99d)[_0xa14a('0x18')](_0x115a4d);}return null;};}function patchUpdates(_0x24bd77){return function(_0x4002c9){try{jsonpatch[_0xa14a('0x1f')](_0x4002c9,_0x24bd77,!![]);}catch(_0x55752a){return BPromise[_0xa14a('0x20')](_0x55752a);}return _0x4002c9[_0xa14a('0x21')]();};}function saveUpdates(_0x3694db,_0x15a505){return function(_0x31c0f5){if(_0x31c0f5){return _0x31c0f5[_0xa14a('0x22')](_0x3694db)[_0xa14a('0x23')](function(_0x5075a4){return _0x5075a4;});}return null;};}function removeEntity(_0x2413cc,_0x416026){return function(_0x403f74){if(_0x403f74){return _0x403f74[_0xa14a('0x24')]()['then'](function(){_0x2413cc[_0xa14a('0x16')](0xcc)[_0xa14a('0x17')]();});}};}function handleEntityNotFound(_0x18f8e8,_0xfa7beb){return function(_0x37d4f6){if(!_0x37d4f6){_0x18f8e8[_0xa14a('0x25')](0x194);}return _0x37d4f6;};}function handleError(_0x5198a9,_0x19525d){_0x19525d=_0x19525d||0x1f4;return function(_0x4663a3){logger['error'](_0x4663a3[_0xa14a('0x26')]);if(_0x4663a3[_0xa14a('0x27')]){delete _0x4663a3[_0xa14a('0x27')];}_0x5198a9[_0xa14a('0x16')](_0x19525d)[_0xa14a('0x28')](_0x4663a3);};}exports['index']=function(_0x1c5228,_0x18515f){var _0x49c284={},_0x250737={},_0x3474df={'count':0x0,'rows':[]};var _0x419d9c=_['map'](db[_0xa14a('0x29')][_0xa14a('0x2a')],function(_0x577db1){return{'name':_0x577db1[_0xa14a('0x2b')],'type':_0x577db1[_0xa14a('0x2c')][_0xa14a('0x2d')]};});_0x250737[_0xa14a('0x2e')]=_['map'](_0x419d9c,_0xa14a('0x27'));_0x250737[_0xa14a('0x2f')]=_[_0xa14a('0x30')](_0x1c5228[_0xa14a('0x2f')]);_0x250737[_0xa14a('0x31')]=_[_0xa14a('0x32')](_0x250737['model'],_0x250737[_0xa14a('0x2f')]);_0x49c284[_0xa14a('0x33')]=_[_0xa14a('0x32')](_0x250737[_0xa14a('0x2e')],qs['fields'](_0x1c5228['query'][_0xa14a('0x34')]));_0x49c284[_0xa14a('0x33')]=_0x49c284['attributes']['length']?_0x49c284[_0xa14a('0x33')]:_0x250737[_0xa14a('0x2e')];if(!_0x1c5228[_0xa14a('0x2f')][_0xa14a('0x35')](_0xa14a('0x36'))){_0x49c284[_0xa14a('0x1a')]=qs[_0xa14a('0x1a')](_0x1c5228[_0xa14a('0x2f')][_0xa14a('0x1a')]);_0x49c284['offset']=qs[_0xa14a('0x19')](_0x1c5228[_0xa14a('0x2f')]['offset']);}_0x49c284[_0xa14a('0x37')]=qs[_0xa14a('0x38')](_0x1c5228['query']['sort']);_0x49c284[_0xa14a('0x39')]=qs[_0xa14a('0x31')](_[_0xa14a('0x3a')](_0x1c5228['query'],_0x250737[_0xa14a('0x31')]),_0x419d9c);if(_0x1c5228[_0xa14a('0x2f')]['filter']){_0x49c284['where']=_['merge'](_0x49c284[_0xa14a('0x39')],{'$or':_[_0xa14a('0x3b')](_0x419d9c,function(_0x649311){if(_0x649311[_0xa14a('0x2c')]!==_0xa14a('0x3c')){var _0x218499={};_0x218499[_0x649311[_0xa14a('0x27')]]={'$like':'%'+_0x1c5228[_0xa14a('0x2f')][_0xa14a('0x3d')]+'%'};return _0x218499;}})});}_0x49c284=_[_0xa14a('0x3e')]({},_0x49c284,_0x1c5228[_0xa14a('0x3f')]);var _0x3545f8={'where':_0x49c284[_0xa14a('0x39')]};return db[_0xa14a('0x29')]['count'](_0x3545f8)['then'](function(_0x2ba25d){_0x3474df['count']=_0x2ba25d;if(_0x1c5228['query'][_0xa14a('0x40')]){_0x49c284[_0xa14a('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xa14a('0x42')](_0x49c284);})[_0xa14a('0x23')](function(_0x13a715){_0x3474df[_0xa14a('0x43')]=_0x13a715;return _0x3474df;})[_0xa14a('0x23')](respondWithFilteredResult(_0x18515f,_0x49c284))[_0xa14a('0x44')](handleError(_0x18515f,null));};exports[_0xa14a('0x45')]=function(_0x1d18c1,_0x408de3){var _0x1acb1f={'raw':![],'where':{'id':_0x1d18c1[_0xa14a('0x46')]['id']}},_0x5a6517={};_0x5a6517['model']=_[_0xa14a('0x30')](db[_0xa14a('0x29')][_0xa14a('0x2a')]);_0x5a6517[_0xa14a('0x2f')]=_[_0xa14a('0x30')](_0x1d18c1['query']);_0x5a6517[_0xa14a('0x31')]=_[_0xa14a('0x32')](_0x5a6517[_0xa14a('0x2e')],_0x5a6517[_0xa14a('0x2f')]);_0x1acb1f['attributes']=_[_0xa14a('0x32')](_0x5a6517[_0xa14a('0x2e')],qs[_0xa14a('0x34')](_0x1d18c1[_0xa14a('0x2f')][_0xa14a('0x34')]));_0x1acb1f['attributes']=_0x1acb1f[_0xa14a('0x33')][_0xa14a('0x47')]?_0x1acb1f[_0xa14a('0x33')]:_0x5a6517['model'];if(_0x1d18c1[_0xa14a('0x2f')]['includeAll']){_0x1acb1f[_0xa14a('0x41')]=[{'all':!![]}];}_0x1acb1f=_[_0xa14a('0x3e')]({},_0x1acb1f,_0x1d18c1[_0xa14a('0x3f')]);return db[_0xa14a('0x29')][_0xa14a('0x48')](_0x1acb1f)['then'](handleEntityNotFound(_0x408de3,null))[_0xa14a('0x23')](respondWithResult(_0x408de3,null))[_0xa14a('0x44')](handleError(_0x408de3,null));};exports[_0xa14a('0x49')]=function(_0x44a7db,_0x5ec261){return db[_0xa14a('0x29')]['create'](_0x44a7db[_0xa14a('0x4a')],{})[_0xa14a('0x23')](respondWithResult(_0x5ec261,0xc9))[_0xa14a('0x44')](handleError(_0x5ec261,null));};exports[_0xa14a('0x22')]=function(_0x5122b0,_0x113e18){if(_0x5122b0[_0xa14a('0x4a')]['id']){delete _0x5122b0[_0xa14a('0x4a')]['id'];}return db['ServicenowAccount'][_0xa14a('0x48')]({'where':{'id':_0x5122b0[_0xa14a('0x46')]['id']}})['then'](handleEntityNotFound(_0x113e18,null))[_0xa14a('0x23')](saveUpdates(_0x5122b0['body'],null))[_0xa14a('0x23')](respondWithResult(_0x113e18,null))[_0xa14a('0x44')](handleError(_0x113e18,null));};exports[_0xa14a('0x24')]=function(_0x8f6f08,_0x2c3396){return db['ServicenowAccount'][_0xa14a('0x48')]({'where':{'id':_0x8f6f08[_0xa14a('0x46')]['id']}})[_0xa14a('0x23')](handleEntityNotFound(_0x2c3396,null))['then'](removeEntity(_0x2c3396,null))[_0xa14a('0x44')](handleError(_0x2c3396,null));};exports['getConfigurations']=function(_0x19fafd,_0x4b84c4,_0x5cc9f0){var _0x2073a3={};var _0x504b4f={};var _0x617998;var _0x5e5e3b;return db[_0xa14a('0x29')][_0xa14a('0x4b')]({'where':{'id':_0x19fafd['params']['id']}})[_0xa14a('0x23')](handleEntityNotFound(_0x4b84c4,null))[_0xa14a('0x23')](function(_0x1ce975){if(_0x1ce975){_0x617998=_0x1ce975;_0x504b4f[_0xa14a('0x2e')]=_[_0xa14a('0x30')](db[_0xa14a('0x4c')]['rawAttributes']);_0x504b4f[_0xa14a('0x2f')]=_[_0xa14a('0x30')](_0x19fafd[_0xa14a('0x2f')]);_0x504b4f[_0xa14a('0x31')]=_[_0xa14a('0x32')](_0x504b4f[_0xa14a('0x2e')],_0x504b4f[_0xa14a('0x2f')]);_0x2073a3['attributes']=_[_0xa14a('0x32')](_0x504b4f[_0xa14a('0x2e')],qs['fields'](_0x19fafd[_0xa14a('0x2f')][_0xa14a('0x34')]));_0x2073a3['attributes']=_0x2073a3[_0xa14a('0x33')][_0xa14a('0x47')]?_0x2073a3[_0xa14a('0x33')]:_0x504b4f[_0xa14a('0x2e')];_0x2073a3['order']=qs[_0xa14a('0x38')](_0x19fafd[_0xa14a('0x2f')]['sort']);_0x2073a3[_0xa14a('0x39')]=qs[_0xa14a('0x31')](_[_0xa14a('0x3a')](_0x19fafd[_0xa14a('0x2f')],_0x504b4f[_0xa14a('0x31')]));if(_0x19fafd[_0xa14a('0x2f')][_0xa14a('0x3d')]){_0x2073a3[_0xa14a('0x39')]=_['merge'](_0x2073a3[_0xa14a('0x39')],{'$or':_[_0xa14a('0x3b')](_0x2073a3[_0xa14a('0x33')],function(_0x541690){var _0x4af851={};_0x4af851[_0x541690]={'$like':'%'+_0x19fafd[_0xa14a('0x2f')][_0xa14a('0x3d')]+'%'};return _0x4af851;})});}_0x2073a3=_[_0xa14a('0x3e')]({},_0x2073a3,_0x19fafd[_0xa14a('0x3f')]);return _0x617998['getConfigurations'](_0x2073a3);}})['then'](function(_0x500d19){if(_0x500d19){_0x5e5e3b=_0x500d19[_0xa14a('0x47')];if(!_0x19fafd['query'][_0xa14a('0x35')](_0xa14a('0x36'))){_0x2073a3['limit']=qs[_0xa14a('0x1a')](_0x19fafd[_0xa14a('0x2f')][_0xa14a('0x1a')]);_0x2073a3[_0xa14a('0x19')]=qs['offset'](_0x19fafd[_0xa14a('0x2f')][_0xa14a('0x19')]);}return _0x617998[_0xa14a('0x4d')](_0x2073a3);}})['then'](function(_0x5d5c26){if(_0x5d5c26){return _0x5d5c26?{'count':_0x5e5e3b,'rows':_0x5d5c26}:null;}})[_0xa14a('0x23')](respondWithResult(_0x4b84c4,null))[_0xa14a('0x44')](handleError(_0x4b84c4,null));};exports['addConfiguration']=function(_0x3fddfd,_0x23fbd6,_0xad29a1){if(_0x3fddfd['body']['id']){delete _0x3fddfd[_0xa14a('0x4a')]['id'];}return db[_0xa14a('0x29')][_0xa14a('0x4b')]({'where':{'id':_0x3fddfd[_0xa14a('0x46')]['id']}})[_0xa14a('0x23')](handleEntityNotFound(_0x23fbd6,null))[_0xa14a('0x23')](function(_0x460c87){if(_0x460c87){_0x3fddfd[_0xa14a('0x4a')]['AccountId']=_0x460c87['id'];_0x3fddfd[_0xa14a('0x4a')][_0xa14a('0x4e')]=integrations[_0xa14a('0x4f')](_0x3fddfd[_0xa14a('0x4a')][_0xa14a('0x50')],_0x3fddfd[_0xa14a('0x4a')][_0xa14a('0x2c')]);_0x3fddfd[_0xa14a('0x4a')][_0xa14a('0x51')]=integrations[_0xa14a('0x52')](_0x3fddfd['body']['channel'],_0x3fddfd['body'][_0xa14a('0x2c')]);return db[_0xa14a('0x4c')][_0xa14a('0x49')](_0x3fddfd[_0xa14a('0x4a')],{'include':[{'model':db[_0xa14a('0x53')],'as':_0xa14a('0x4e')},{'model':db[_0xa14a('0x53')],'as':_0xa14a('0x51')}]});}return null;})[_0xa14a('0x23')](respondWithResult(_0x23fbd6,null))[_0xa14a('0x44')](handleError(_0x23fbd6,null));};exports[_0xa14a('0x54')]=function(_0x14f9af,_0x22d5b3,_0x3efd99){var _0x51c855=['made_sla',_0xa14a('0x55'),'knowledge',_0xa14a('0x56'),_0xa14a('0x57'),_0xa14a('0x58'),_0xa14a('0x59'),'severity',_0xa14a('0x5a')];var _0x4c9ad5=[_0xa14a('0x5b'),_0xa14a('0x5c'),_0xa14a('0x5d'),'watch_list','upon_reject',_0xa14a('0x5e'),'child_incidents',_0xa14a('0x55'),_0xa14a('0x5f'),_0xa14a('0x60'),_0xa14a('0x61'),_0xa14a('0x62'),_0xa14a('0x63'),_0xa14a('0x64'),_0xa14a('0x65'),_0xa14a('0x66'),_0xa14a('0x67'),_0xa14a('0x68'),_0xa14a('0x69'),_0xa14a('0x37'),_0xa14a('0x6a'),_0xa14a('0x6b'),_0xa14a('0x6c'),_0xa14a('0x6d'),'impact',_0xa14a('0x6e'),_0xa14a('0x6f'),_0xa14a('0x70'),_0xa14a('0x71'),_0xa14a('0x72'),_0xa14a('0x73'),'time_worked','expected_start',_0xa14a('0x74'),'business_duration',_0xa14a('0x75'),'work_end',_0xa14a('0x76'),_0xa14a('0x77'),_0xa14a('0x78'),_0xa14a('0x79'),_0xa14a('0x56'),_0xa14a('0x7a'),'short_description',_0xa14a('0x57'),_0xa14a('0x7b'),_0xa14a('0x7c'),_0xa14a('0x7d'),_0xa14a('0x7e'),_0xa14a('0x7f'),_0xa14a('0x80'),_0xa14a('0x81'),'calendar_duration','notify','sys_class_name',_0xa14a('0x82'),_0xa14a('0x83'),_0xa14a('0x84'),_0xa14a('0x85'),_0xa14a('0x86'),_0xa14a('0x87'),_0xa14a('0x88'),_0xa14a('0x59'),_0xa14a('0x89'),_0xa14a('0x8a'),_0xa14a('0x8b'),_0xa14a('0x8c'),_0xa14a('0x8d'),'assigned_to','severity',_0xa14a('0x8e'),_0xa14a('0x8f'),_0xa14a('0x90'),_0xa14a('0x91'),'due_date','sys_mod_count',_0xa14a('0x92'),_0xa14a('0x93'),_0xa14a('0x94'),'upon_approval',_0xa14a('0x95'),'location',_0xa14a('0x5a')];var _0x720759='';var _0x2e9f7a='';var _0x49d3b6=[];var _0x10843b='';var _0x48cc17='';var _0x40720d=[];var _0x1373a0='';var _0x2178cd='';var _0x50dc3e={};var _0x1355ac='';return db[_0xa14a('0x29')]['findOne']({'where':{'id':_0x14f9af[_0xa14a('0x46')]['id']},'attributes':['id',_0xa14a('0x96'),'password','email','remoteUri',_0xa14a('0x97')]})[_0xa14a('0x23')](handleEntityNotFound(_0x22d5b3,null))[_0xa14a('0x23')](function(_0x41ac45){if(_0x41ac45){_0x1355ac=_0x41ac45[_0xa14a('0x98')];var _0x2ba357=_0x1355ac['slice'](-0x1);if(_0x2ba357==='/'){_0x1355ac=_0x1355ac[_0xa14a('0x99')](0x0,_0x1355ac[_0xa14a('0x9a')](_0x2ba357));}_0x2178cd=util[_0xa14a('0x9b')](_0xa14a('0x9c'),_0x1355ac);_0x1373a0=util[_0xa14a('0x9b')](_0xa14a('0x9d'),_0x1355ac);_0x50dc3e={'user':_0x41ac45[_0xa14a('0x96')],'pass':_0x41ac45['password']};var _0x24efd2={'method':_0xa14a('0x9e'),'uri':_0x2178cd+_0xa14a('0x9f'),'auth':_0x50dc3e,'json':!![]};return rp(_0x24efd2);}})[_0xa14a('0x23')](function(_0x51403e){if(_0x51403e['result']['length']>0x0){_0x720759=_0x51403e['result'];}console[_0xa14a('0xa0')]('incident\x20table\x20objects',_0x720759);_0x40720d=[];_0x2e9f7a=Object[_0xa14a('0xa1')]([],_0x720759);_[_0xa14a('0xa2')](_0x2e9f7a,function(_0x18ced4){return!_0x51c855[_0xa14a('0xa3')](_0x18ced4['name']);});_0x2e9f7a[_0xa14a('0xa4')](function(_0x18f45e){var _0x329923=createFieldObject(_0x1373a0,_0x50dc3e,_0x18f45e['internalType'],_0x18f45e[_0xa14a('0x27')],_0x18f45e[_0xa14a('0xa5')],![]);_0x40720d['push'](_0x329923);});return Promise['all'](_0x40720d);})['then'](function(_0x16f146){_0x49d3b6=_0x16f146;_0x10843b=Object[_0xa14a('0xa1')]([],_0x720759);console[_0xa14a('0xa0')]('TCL:\x20_object',_0x720759);_['remove'](_0x10843b,function(_0x29d32f){return _0x4c9ad5[_0xa14a('0xa3')](_0x29d32f['name']);});console[_0xa14a('0xa0')](_0xa14a('0xa6'),_0x10843b);_0x40720d=[];_0x10843b[_0xa14a('0xa4')](function(_0x4f929c){var _0x31d9f6=createFieldObject(_0x1373a0,_0x50dc3e,_0x4f929c[_0xa14a('0xa7')],_0x4f929c[_0xa14a('0x27')],_0x4f929c[_0xa14a('0xa5')],!![]);_0x40720d['push'](_0x31d9f6);});return Promise['all'](_0x40720d);})[_0xa14a('0x23')](function(_0x3ef71b){_0x48cc17=_0x3ef71b;var _0x536171=_0x49d3b6['concat'](_0x48cc17);return{'count':_0x536171[_0xa14a('0x47')],'rows':_0x536171};})[_0xa14a('0x23')](respondWithResult(_0x22d5b3,null))[_0xa14a('0x44')](function(_0x2bd5a6){console[_0xa14a('0xa0')](_0xa14a('0xa8')+_0x2bd5a6);var _0x169708=_0x14f9af['query'][_0xa14a('0xa9')]?0x1f4:_0x2bd5a6['statusCode']||0x1f4;logger[_0xa14a('0xaa')](_0x2bd5a6['stack']);delete _0x2bd5a6[_0xa14a('0x27')];if(_0x169708===0x191){_0x169708=0x190;}_0x22d5b3[_0xa14a('0x16')](_0x169708)['send'](_0x14f9af['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2bd5a6[_0xa14a('0xab')]}:_0x2bd5a6);});};function createFieldObject(_0x327aee,_0x36d109,_0x497d27,_0x30a128,_0x36e0b0,_0x3df82d){return new Promise(function(_0x400efd,_0x21b64c){var _0x2f1a3e={'id':_0x30a128,'name':_0x36e0b0,'custom':_0x3df82d};if(_0x497d27===_0xa14a('0xac')){_0x2f1a3e[_0xa14a('0x3f')]=[{'name':_0xa14a('0xad'),'value':_0xa14a('0xae')},{'name':_0xa14a('0xaf'),'value':'false'}];_0x400efd(_0x2f1a3e);}else{var _0x458628={'method':'GET','uri':_0x327aee+_0xa14a('0xb0')+_0x30a128,'auth':_0x36d109,'json':!![]};return rp(_0x458628)['then'](function(_0x12c674){var _0x2d33ff=[];if(_0x12c674[_0xa14a('0xb1')][_0xa14a('0x47')]>0x0){_0x12c674['result']['forEach'](function(_0x9bf2c1){if(_0x9bf2c1[_0xa14a('0xb2')]===_0xa14a('0xb3')){var _0x1d7c66={'name':_0x9bf2c1[_0xa14a('0xa5')],'value':_0x9bf2c1['value']};_0x2d33ff['push'](_0x1d7c66);}});}_0x2f1a3e[_0xa14a('0x3f')]=_0x2d33ff;if(_0x2f1a3e[_0xa14a('0x3f')][_0xa14a('0x47')]>0x0){_0x400efd(_0x2f1a3e);}else{if(_0x3df82d==![]){_0x400efd();}else{_0x400efd(_0x2f1a3e);}}});}});} \ No newline at end of file +var _0xadb4=['offset','undefined','limit','count','set','Content-Range','reject','update','then','error','name','index','map','rawAttributes','type','keys','filters','model','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','ServicenowAccount','findAll','catch','show','params','fields','create','body','find','getConfigurations','ServicenowConfiguration','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ServicenowField','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','state','sys_created_by','closed_at','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','sys_id','contact_type','reopened_by','urgency','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','slice','substring','lastIndexOf','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','concat','ServiceNow\x20error:\x20','test','statusCode','stack','send','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xadb4,0x14b));var _0x4adb=function(_0x3ee195,_0x4783f8){_0x3ee195=_0x3ee195-0x0;var _0x44c03b=_0xadb4[_0x3ee195];return _0x44c03b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4adb('0x0'));var jsonpatch=require(_0x4adb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4adb('0x2'));var Mustache=require(_0x4adb('0x3'));var util=require('util');var path=require('path');var sox=require(_0x4adb('0x4'));var csv=require(_0x4adb('0x5'));var ejs=require(_0x4adb('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4adb('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4adb('0x8'));var toCsv=require(_0x4adb('0x5'));var querystring=require('querystring');var Papa=require(_0x4adb('0x9'));var Redis=require('ioredis');var authService=require(_0x4adb('0xa'));var qs=require(_0x4adb('0xb'));var as=require(_0x4adb('0xc'));var hardwareService=require(_0x4adb('0xd'));var logger=require(_0x4adb('0xe'))('api');var utils=require(_0x4adb('0xf'));var config=require(_0x4adb('0x10'));var licenseUtil=require(_0x4adb('0x11'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4adb('0x12'));function respondWithStatusCode(_0x24d418,_0x228699){_0x228699=_0x228699||0xcc;return function(_0x56f5b5){if(_0x56f5b5){return _0x24d418[_0x4adb('0x13')](_0x228699);}return _0x24d418['status'](_0x228699)[_0x4adb('0x14')]();};}function respondWithResult(_0x23578a,_0x46967a){_0x46967a=_0x46967a||0xc8;return function(_0x4950a0){if(_0x4950a0){return _0x23578a[_0x4adb('0x15')](_0x46967a)[_0x4adb('0x16')](_0x4950a0);}};}function respondWithFilteredResult(_0x3633aa,_0x404aae){return function(_0x2c94df){if(_0x2c94df){var _0x156e79=typeof _0x404aae[_0x4adb('0x17')]===_0x4adb('0x18')&&typeof _0x404aae[_0x4adb('0x19')]===_0x4adb('0x18');var _0x2706ec=_0x2c94df[_0x4adb('0x1a')];var _0x25e12c=_0x156e79?0x0:_0x404aae[_0x4adb('0x17')];var _0x42c068=_0x156e79?_0x2c94df['count']:_0x404aae['offset']+_0x404aae[_0x4adb('0x19')];var _0xe12935;if(_0x42c068>=_0x2706ec){_0x42c068=_0x2706ec;_0xe12935=0xc8;}else{_0xe12935=0xce;}_0x3633aa[_0x4adb('0x15')](_0xe12935);return _0x3633aa[_0x4adb('0x1b')](_0x4adb('0x1c'),_0x25e12c+'-'+_0x42c068+'/'+_0x2706ec)[_0x4adb('0x16')](_0x2c94df);}return null;};}function patchUpdates(_0x269a7c){return function(_0x3583ad){try{jsonpatch['apply'](_0x3583ad,_0x269a7c,!![]);}catch(_0x31e615){return BPromise[_0x4adb('0x1d')](_0x31e615);}return _0x3583ad['save']();};}function saveUpdates(_0x559cda,_0x137cf0){return function(_0x22b384){if(_0x22b384){return _0x22b384[_0x4adb('0x1e')](_0x559cda)[_0x4adb('0x1f')](function(_0x20ac7c){return _0x20ac7c;});}return null;};}function removeEntity(_0x509408,_0x57161d){return function(_0x1ce7ee){if(_0x1ce7ee){return _0x1ce7ee['destroy']()[_0x4adb('0x1f')](function(){_0x509408[_0x4adb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33e6c8,_0x19ac9a){return function(_0x167808){if(!_0x167808){_0x33e6c8[_0x4adb('0x13')](0x194);}return _0x167808;};}function handleError(_0x17e822,_0x43404f){_0x43404f=_0x43404f||0x1f4;return function(_0x3c4464){logger[_0x4adb('0x20')](_0x3c4464['stack']);if(_0x3c4464[_0x4adb('0x21')]){delete _0x3c4464[_0x4adb('0x21')];}_0x17e822[_0x4adb('0x15')](_0x43404f)['send'](_0x3c4464);};}exports[_0x4adb('0x22')]=function(_0x31a8f3,_0x1fc00d){var _0xfa085e={},_0x126345={},_0x1933ce={'count':0x0,'rows':[]};var _0x5e04c5=_[_0x4adb('0x23')](db['ServicenowAccount'][_0x4adb('0x24')],function(_0xeb81c9){return{'name':_0xeb81c9['fieldName'],'type':_0xeb81c9[_0x4adb('0x25')]['key']};});_0x126345['model']=_[_0x4adb('0x23')](_0x5e04c5,_0x4adb('0x21'));_0x126345['query']=_[_0x4adb('0x26')](_0x31a8f3['query']);_0x126345[_0x4adb('0x27')]=_['intersection'](_0x126345[_0x4adb('0x28')],_0x126345[_0x4adb('0x29')]);_0xfa085e[_0x4adb('0x2a')]=_[_0x4adb('0x2b')](_0x126345[_0x4adb('0x28')],qs['fields'](_0x31a8f3[_0x4adb('0x29')]['fields']));_0xfa085e[_0x4adb('0x2a')]=_0xfa085e[_0x4adb('0x2a')][_0x4adb('0x2c')]?_0xfa085e[_0x4adb('0x2a')]:_0x126345['model'];if(!_0x31a8f3[_0x4adb('0x29')][_0x4adb('0x2d')](_0x4adb('0x2e'))){_0xfa085e[_0x4adb('0x19')]=qs[_0x4adb('0x19')](_0x31a8f3[_0x4adb('0x29')][_0x4adb('0x19')]);_0xfa085e['offset']=qs[_0x4adb('0x17')](_0x31a8f3[_0x4adb('0x29')][_0x4adb('0x17')]);}_0xfa085e['order']=qs['sort'](_0x31a8f3[_0x4adb('0x29')][_0x4adb('0x2f')]);_0xfa085e[_0x4adb('0x30')]=qs[_0x4adb('0x27')](_['pick'](_0x31a8f3[_0x4adb('0x29')],_0x126345[_0x4adb('0x27')]),_0x5e04c5);if(_0x31a8f3[_0x4adb('0x29')][_0x4adb('0x31')]){_0xfa085e[_0x4adb('0x30')]=_[_0x4adb('0x32')](_0xfa085e[_0x4adb('0x30')],{'$or':_['map'](_0x5e04c5,function(_0x4c27d7){if(_0x4c27d7[_0x4adb('0x25')]!==_0x4adb('0x33')){var _0x1a9b8b={};_0x1a9b8b[_0x4c27d7[_0x4adb('0x21')]]={'$like':'%'+_0x31a8f3[_0x4adb('0x29')][_0x4adb('0x31')]+'%'};return _0x1a9b8b;}})});}_0xfa085e=_[_0x4adb('0x32')]({},_0xfa085e,_0x31a8f3[_0x4adb('0x34')]);var _0x283a77={'where':_0xfa085e[_0x4adb('0x30')]};return db['ServicenowAccount'][_0x4adb('0x1a')](_0x283a77)[_0x4adb('0x1f')](function(_0x5c3a3f){_0x1933ce[_0x4adb('0x1a')]=_0x5c3a3f;if(_0x31a8f3[_0x4adb('0x29')][_0x4adb('0x35')]){_0xfa085e[_0x4adb('0x36')]=[{'all':!![]}];}return db[_0x4adb('0x37')][_0x4adb('0x38')](_0xfa085e);})[_0x4adb('0x1f')](function(_0x2a4510){_0x1933ce['rows']=_0x2a4510;return _0x1933ce;})[_0x4adb('0x1f')](respondWithFilteredResult(_0x1fc00d,_0xfa085e))[_0x4adb('0x39')](handleError(_0x1fc00d,null));};exports[_0x4adb('0x3a')]=function(_0x354825,_0x564eaa){var _0x320655={'raw':![],'where':{'id':_0x354825[_0x4adb('0x3b')]['id']}},_0x116697={};_0x116697[_0x4adb('0x28')]=_[_0x4adb('0x26')](db['ServicenowAccount'][_0x4adb('0x24')]);_0x116697[_0x4adb('0x29')]=_[_0x4adb('0x26')](_0x354825[_0x4adb('0x29')]);_0x116697[_0x4adb('0x27')]=_[_0x4adb('0x2b')](_0x116697[_0x4adb('0x28')],_0x116697[_0x4adb('0x29')]);_0x320655[_0x4adb('0x2a')]=_[_0x4adb('0x2b')](_0x116697['model'],qs[_0x4adb('0x3c')](_0x354825[_0x4adb('0x29')][_0x4adb('0x3c')]));_0x320655[_0x4adb('0x2a')]=_0x320655['attributes']['length']?_0x320655['attributes']:_0x116697[_0x4adb('0x28')];if(_0x354825[_0x4adb('0x29')][_0x4adb('0x35')]){_0x320655[_0x4adb('0x36')]=[{'all':!![]}];}_0x320655=_[_0x4adb('0x32')]({},_0x320655,_0x354825[_0x4adb('0x34')]);return db[_0x4adb('0x37')]['find'](_0x320655)[_0x4adb('0x1f')](handleEntityNotFound(_0x564eaa,null))['then'](respondWithResult(_0x564eaa,null))[_0x4adb('0x39')](handleError(_0x564eaa,null));};exports[_0x4adb('0x3d')]=function(_0x52ba3f,_0x3b953a){return db['ServicenowAccount'][_0x4adb('0x3d')](_0x52ba3f[_0x4adb('0x3e')],{})['then'](respondWithResult(_0x3b953a,0xc9))['catch'](handleError(_0x3b953a,null));};exports[_0x4adb('0x1e')]=function(_0x4c636d,_0x681be9){if(_0x4c636d['body']['id']){delete _0x4c636d[_0x4adb('0x3e')]['id'];}return db[_0x4adb('0x37')][_0x4adb('0x3f')]({'where':{'id':_0x4c636d['params']['id']}})[_0x4adb('0x1f')](handleEntityNotFound(_0x681be9,null))[_0x4adb('0x1f')](saveUpdates(_0x4c636d[_0x4adb('0x3e')],null))[_0x4adb('0x1f')](respondWithResult(_0x681be9,null))['catch'](handleError(_0x681be9,null));};exports['destroy']=function(_0x5533ec,_0x418909){return db['ServicenowAccount'][_0x4adb('0x3f')]({'where':{'id':_0x5533ec[_0x4adb('0x3b')]['id']}})[_0x4adb('0x1f')](handleEntityNotFound(_0x418909,null))[_0x4adb('0x1f')](removeEntity(_0x418909,null))[_0x4adb('0x39')](handleError(_0x418909,null));};exports[_0x4adb('0x40')]=function(_0x5496b0,_0x466e58,_0xc18c97){var _0x16ad49={};var _0x21cdcd={};var _0x41d8ad;var _0x3ea570;return db[_0x4adb('0x37')]['findOne']({'where':{'id':_0x5496b0[_0x4adb('0x3b')]['id']}})[_0x4adb('0x1f')](handleEntityNotFound(_0x466e58,null))['then'](function(_0x415cda){if(_0x415cda){_0x41d8ad=_0x415cda;_0x21cdcd[_0x4adb('0x28')]=_['keys'](db[_0x4adb('0x41')][_0x4adb('0x24')]);_0x21cdcd['query']=_[_0x4adb('0x26')](_0x5496b0[_0x4adb('0x29')]);_0x21cdcd[_0x4adb('0x27')]=_[_0x4adb('0x2b')](_0x21cdcd[_0x4adb('0x28')],_0x21cdcd[_0x4adb('0x29')]);_0x16ad49[_0x4adb('0x2a')]=_[_0x4adb('0x2b')](_0x21cdcd[_0x4adb('0x28')],qs['fields'](_0x5496b0[_0x4adb('0x29')][_0x4adb('0x3c')]));_0x16ad49[_0x4adb('0x2a')]=_0x16ad49[_0x4adb('0x2a')][_0x4adb('0x2c')]?_0x16ad49[_0x4adb('0x2a')]:_0x21cdcd[_0x4adb('0x28')];_0x16ad49[_0x4adb('0x42')]=qs[_0x4adb('0x2f')](_0x5496b0[_0x4adb('0x29')][_0x4adb('0x2f')]);_0x16ad49[_0x4adb('0x30')]=qs['filters'](_[_0x4adb('0x43')](_0x5496b0[_0x4adb('0x29')],_0x21cdcd[_0x4adb('0x27')]));if(_0x5496b0[_0x4adb('0x29')][_0x4adb('0x31')]){_0x16ad49[_0x4adb('0x30')]=_[_0x4adb('0x32')](_0x16ad49[_0x4adb('0x30')],{'$or':_[_0x4adb('0x23')](_0x16ad49['attributes'],function(_0x490b92){var _0x24c914={};_0x24c914[_0x490b92]={'$like':'%'+_0x5496b0[_0x4adb('0x29')][_0x4adb('0x31')]+'%'};return _0x24c914;})});}_0x16ad49=_[_0x4adb('0x32')]({},_0x16ad49,_0x5496b0[_0x4adb('0x34')]);return _0x41d8ad[_0x4adb('0x40')](_0x16ad49);}})['then'](function(_0x3ddd29){if(_0x3ddd29){_0x3ea570=_0x3ddd29[_0x4adb('0x2c')];if(!_0x5496b0[_0x4adb('0x29')][_0x4adb('0x2d')](_0x4adb('0x2e'))){_0x16ad49[_0x4adb('0x19')]=qs[_0x4adb('0x19')](_0x5496b0[_0x4adb('0x29')]['limit']);_0x16ad49[_0x4adb('0x17')]=qs[_0x4adb('0x17')](_0x5496b0['query'][_0x4adb('0x17')]);}return _0x41d8ad[_0x4adb('0x40')](_0x16ad49);}})[_0x4adb('0x1f')](function(_0x284d0c){if(_0x284d0c){return _0x284d0c?{'count':_0x3ea570,'rows':_0x284d0c}:null;}})[_0x4adb('0x1f')](respondWithResult(_0x466e58,null))['catch'](handleError(_0x466e58,null));};exports[_0x4adb('0x44')]=function(_0x192fd5,_0x280243,_0x2e3e32){if(_0x192fd5[_0x4adb('0x3e')]['id']){delete _0x192fd5[_0x4adb('0x3e')]['id'];}return db[_0x4adb('0x37')][_0x4adb('0x45')]({'where':{'id':_0x192fd5[_0x4adb('0x3b')]['id']}})[_0x4adb('0x1f')](handleEntityNotFound(_0x280243,null))[_0x4adb('0x1f')](function(_0x5b85e9){if(_0x5b85e9){_0x192fd5[_0x4adb('0x3e')][_0x4adb('0x46')]=_0x5b85e9['id'];_0x192fd5['body'][_0x4adb('0x47')]=integrations[_0x4adb('0x48')](_0x192fd5[_0x4adb('0x3e')]['channel'],_0x192fd5[_0x4adb('0x3e')][_0x4adb('0x25')]);_0x192fd5[_0x4adb('0x3e')]['Descriptions']=integrations[_0x4adb('0x49')](_0x192fd5[_0x4adb('0x3e')][_0x4adb('0x4a')],_0x192fd5[_0x4adb('0x3e')]['type']);return db[_0x4adb('0x41')]['create'](_0x192fd5['body'],{'include':[{'model':db['ServicenowField'],'as':_0x4adb('0x47')},{'model':db[_0x4adb('0x4b')],'as':_0x4adb('0x4c')}]});}return null;})[_0x4adb('0x1f')](respondWithResult(_0x280243,null))[_0x4adb('0x39')](handleError(_0x280243,null));};exports[_0x4adb('0x4d')]=function(_0x5aa4d4,_0x3c9c2f,_0x38be9a){var _0x4dbbcb=[_0x4adb('0x4e'),'hold_reason',_0x4adb('0x4f'),_0x4adb('0x50'),_0x4adb('0x51'),_0x4adb('0x52'),_0x4adb('0x53'),_0x4adb('0x54'),_0x4adb('0x55')];var _0x318e6e=[_0x4adb('0x56'),_0x4adb('0x4e'),_0x4adb('0x57'),_0x4adb('0x58'),_0x4adb('0x59'),_0x4adb('0x5a'),_0x4adb('0x5b'),_0x4adb('0x5c'),_0x4adb('0x5d'),_0x4adb('0x5e'),_0x4adb('0x5f'),_0x4adb('0x60'),'opened_by',_0x4adb('0x61'),_0x4adb('0x62'),'sys_domain',_0x4adb('0x63'),_0x4adb('0x64'),_0x4adb('0x4f'),'order','calendar_stc',_0x4adb('0x65'),'cmdb_ci',_0x4adb('0x66'),_0x4adb('0x67'),_0x4adb('0x68'),_0x4adb('0x69'),_0x4adb('0x6a'),'priority',_0x4adb('0x6b'),_0x4adb('0x6c'),'time_worked',_0x4adb('0x6d'),_0x4adb('0x6e'),_0x4adb('0x6f'),_0x4adb('0x70'),'work_end','reopened_time','resolved_at',_0x4adb('0x71'),_0x4adb('0x72'),_0x4adb('0x50'),'work_notes',_0x4adb('0x73'),_0x4adb('0x51'),_0x4adb('0x74'),_0x4adb('0x75'),_0x4adb('0x76'),_0x4adb('0x77'),'business_stc',_0x4adb('0x78'),_0x4adb('0x79'),_0x4adb('0x7a'),_0x4adb('0x52'),_0x4adb('0x7b'),_0x4adb('0x7c'),'closed_by','follow_up','parent_incident',_0x4adb('0x7d'),_0x4adb('0x7e'),_0x4adb('0x7f'),_0x4adb('0x53'),_0x4adb('0x80'),'problem_id','company','reassignment_count',_0x4adb('0x81'),_0x4adb('0x82'),_0x4adb('0x54'),_0x4adb('0x83'),'sla_due',_0x4adb('0x84'),_0x4adb('0x85'),_0x4adb('0x86'),'sys_mod_count',_0x4adb('0x87'),_0x4adb('0x88'),_0x4adb('0x89'),_0x4adb('0x8a'),_0x4adb('0x8b'),_0x4adb('0x8c'),_0x4adb('0x55')];var _0x10e338='';var _0x5ad69e='';var _0x26ccec=[];var _0x3b03b3='';var _0x329b7d='';var _0x151654=[];var _0x58e3ea='';var _0x552920='';var _0x41a857={};var _0x8b724f='';return db[_0x4adb('0x37')]['findOne']({'where':{'id':_0x5aa4d4[_0x4adb('0x3b')]['id']},'attributes':['id',_0x4adb('0x8d'),_0x4adb('0x8e'),_0x4adb('0x8f'),'remoteUri',_0x4adb('0x90')]})[_0x4adb('0x1f')](handleEntityNotFound(_0x3c9c2f,null))[_0x4adb('0x1f')](function(_0xe7e47c){if(_0xe7e47c){_0x8b724f=_0xe7e47c['remoteUri'];var _0x228c82=_0x8b724f[_0x4adb('0x91')](-0x1);if(_0x228c82==='/'){_0x8b724f=_0x8b724f[_0x4adb('0x92')](0x0,_0x8b724f[_0x4adb('0x93')](_0x228c82));}_0x552920=util['format']('%s/api/now/doc/table/schema/',_0x8b724f);_0x58e3ea=util['format'](_0x4adb('0x94'),_0x8b724f);_0x41a857={'user':_0xe7e47c['username'],'pass':_0xe7e47c['password']};var _0x3813f3={'method':_0x4adb('0x95'),'uri':_0x552920+_0x4adb('0x96'),'auth':_0x41a857,'json':!![]};return rp(_0x3813f3);}})[_0x4adb('0x1f')](function(_0x4090b3){if(_0x4090b3[_0x4adb('0x97')][_0x4adb('0x2c')]>0x0){_0x10e338=_0x4090b3['result'];}console[_0x4adb('0x98')](_0x4adb('0x99'),_0x10e338);_0x151654=[];_0x5ad69e=Object[_0x4adb('0x9a')]([],_0x10e338);_['remove'](_0x5ad69e,function(_0x3fc100){return!_0x4dbbcb[_0x4adb('0x9b')](_0x3fc100[_0x4adb('0x21')]);});_0x5ad69e[_0x4adb('0x9c')](function(_0x1c6a62){var _0x1c353f=createFieldObject(_0x58e3ea,_0x41a857,_0x1c6a62[_0x4adb('0x9d')],_0x1c6a62['name'],_0x1c6a62[_0x4adb('0x9e')],![]);_0x151654[_0x4adb('0x9f')](_0x1c353f);});return Promise[_0x4adb('0xa0')](_0x151654);})[_0x4adb('0x1f')](function(_0x4d70c5){_0x26ccec=_0x4d70c5;_0x3b03b3=Object[_0x4adb('0x9a')]([],_0x10e338);console[_0x4adb('0x98')](_0x4adb('0xa1'),_0x10e338);_[_0x4adb('0xa2')](_0x3b03b3,function(_0x4c3d72){return _0x318e6e[_0x4adb('0x9b')](_0x4c3d72[_0x4adb('0x21')]);});console[_0x4adb('0x98')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3b03b3);_0x151654=[];_0x3b03b3[_0x4adb('0x9c')](function(_0x3f270d){var _0x1d7f6a=createFieldObject(_0x58e3ea,_0x41a857,_0x3f270d[_0x4adb('0x9d')],_0x3f270d[_0x4adb('0x21')],_0x3f270d[_0x4adb('0x9e')],!![]);_0x151654[_0x4adb('0x9f')](_0x1d7f6a);});return Promise[_0x4adb('0xa0')](_0x151654);})[_0x4adb('0x1f')](function(_0x2cd42d){_0x329b7d=_0x2cd42d;var _0x5f566d=_0x26ccec[_0x4adb('0xa3')](_0x329b7d);return{'count':_0x5f566d[_0x4adb('0x2c')],'rows':_0x5f566d};})[_0x4adb('0x1f')](respondWithResult(_0x3c9c2f,null))[_0x4adb('0x39')](function(_0x5dd5bf){console[_0x4adb('0x98')](_0x4adb('0xa4')+_0x5dd5bf);var _0x537601=_0x5aa4d4['query'][_0x4adb('0xa5')]?0x1f4:_0x5dd5bf[_0x4adb('0xa6')]||0x1f4;logger['error'](_0x5dd5bf[_0x4adb('0xa7')]);delete _0x5dd5bf[_0x4adb('0x21')];if(_0x537601===0x191){_0x537601=0x190;}_0x3c9c2f['status'](_0x537601)[_0x4adb('0xa8')](_0x5aa4d4[_0x4adb('0x29')][_0x4adb('0xa5')]?{'message':_0x4adb('0xa9'),'statusCode':_0x5dd5bf['statusCode']}:_0x5dd5bf);});};function createFieldObject(_0x101a65,_0x7eb988,_0x4b9f52,_0x5a89d7,_0x2408c5,_0xf5130b){return new Promise(function(_0xa32af8,_0x902e33){var _0x106bd3={'id':_0x5a89d7,'name':_0x2408c5,'custom':_0xf5130b};if(_0x4b9f52==='boolean'){_0x106bd3[_0x4adb('0x34')]=[{'name':_0x4adb('0xaa'),'value':_0x4adb('0xab')},{'name':_0x4adb('0xac'),'value':_0x4adb('0xad')}];_0xa32af8(_0x106bd3);}else{var _0x42174b={'method':_0x4adb('0x95'),'uri':_0x101a65+_0x4adb('0xae')+_0x5a89d7,'auth':_0x7eb988,'json':!![]};return rp(_0x42174b)['then'](function(_0x418149){var _0x12ad54=[];if(_0x418149[_0x4adb('0x97')]['length']>0x0){_0x418149[_0x4adb('0x97')][_0x4adb('0x9c')](function(_0x1fb3ad){if(_0x1fb3ad[_0x4adb('0xaf')]==='false'){var _0x35cec1={'name':_0x1fb3ad[_0x4adb('0x9e')],'value':_0x1fb3ad[_0x4adb('0xb0')]};_0x12ad54[_0x4adb('0x9f')](_0x35cec1);}});}_0x106bd3[_0x4adb('0x34')]=_0x12ad54;if(_0x106bd3['options'][_0x4adb('0x2c')]>0x0){_0xa32af8(_0x106bd3);}else{if(_0xf5130b==![]){_0xa32af8();}else{_0xa32af8(_0x106bd3);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f14f9f2..6746fc9 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(_0x4bc24e,_0x47647d){var _0x429e3c=function(_0x5a9198){while(--_0x5a9198){_0x4bc24e['push'](_0x4bc24e['shift']());}};_0x429e3c(++_0x47647d);}(_0x5d17,0x114));var _0x75d1=function(_0x352de7,_0x42d665){_0x352de7=_0x352de7-0x0;var _0x76cff2=_0x5d17[_0x352de7];return _0x76cff2;};'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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xf494,0x1c6));var _0x4f49=function(_0x4be73a,_0x54e0a1){_0x4be73a=_0x4be73a-0x0;var _0x42001b=_0xf494[_0x4be73a];return _0x42001b;};'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'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index e7c1be9..600c332 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 _0x2506=['message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','include','map','model','attributes','stringify','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x40c85b,_0x4157a2){var _0x1b448f=function(_0x16795e){while(--_0x16795e){_0x40c85b['push'](_0x40c85b['shift']());}};_0x1b448f(++_0x4157a2);}(_0x2506,0x182));var _0x6250=function(_0x2139cc,_0x21abf4){_0x2139cc=_0x2139cc-0x0;var _0x101d64=_0x2506[_0x2139cc];return _0x101d64;};'use strict';var _=require(_0x6250('0x0'));var util=require(_0x6250('0x1'));var moment=require(_0x6250('0x2'));var BPromise=require(_0x6250('0x3'));var rs=require(_0x6250('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6250('0x5'))['db'];var utils=require(_0x6250('0x6'));var logger=require('../../config/logger')(_0x6250('0x7'));var config=require(_0x6250('0x8'));var jayson=require(_0x6250('0x9'));var client=jayson[_0x6250('0xa')][_0x6250('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe95b2a,_0x13ce01,_0x2d4349){return new BPromise(function(_0x28f4d6,_0x4efcbf){return client[_0x6250('0xc')](_0xe95b2a,_0x2d4349)[_0x6250('0xd')](function(_0x3a98eb){logger[_0x6250('0xe')](_0x6250('0xf'),_0x13ce01,_0x6250('0x10'));logger[_0x6250('0x11')](_0x6250('0x12'),_0x13ce01,_0x6250('0x10'),JSON['stringify'](_0x3a98eb));if(_0x3a98eb['error']){if(_0x3a98eb[_0x6250('0x13')][_0x6250('0x14')]===0x1f4){logger[_0x6250('0x13')](_0x6250('0xf'),_0x13ce01,_0x3a98eb[_0x6250('0x13')][_0x6250('0x15')]);return _0x4efcbf(_0x3a98eb[_0x6250('0x13')]['message']);}logger[_0x6250('0x13')](_0x6250('0xf'),_0x13ce01,_0x3a98eb[_0x6250('0x13')]['message']);return _0x28f4d6(_0x3a98eb['error'][_0x6250('0x15')]);}else{logger[_0x6250('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x13ce01,'request\x20sent');_0x28f4d6(_0x3a98eb[_0x6250('0x16')][_0x6250('0x15')]);}})[_0x6250('0x17')](function(_0x1691f3){logger[_0x6250('0x13')](_0x6250('0xf'),_0x13ce01,_0x1691f3);_0x4efcbf(_0x1691f3);});});}exports[_0x6250('0x18')]=function(_0x34c9c8){var _0x54b1a9=this;return new Promise(function(_0x5d133d,_0x5231b6){return db[_0x6250('0x19')][_0x6250('0x1a')]({'raw':_0x34c9c8[_0x6250('0x1b')]?_0x34c9c8[_0x6250('0x1b')][_0x6250('0x1c')]===undefined?!![]:![]:!![],'where':_0x34c9c8['options']?_0x34c9c8[_0x6250('0x1b')]['where']||null:null,'attributes':_0x34c9c8[_0x6250('0x1b')]?_0x34c9c8[_0x6250('0x1b')]['attributes']||null:null,'limit':_0x34c9c8[_0x6250('0x1b')]?_0x34c9c8['options']['limit']||null:null,'include':_0x34c9c8[_0x6250('0x1b')]?_0x34c9c8[_0x6250('0x1b')][_0x6250('0x1d')]?_[_0x6250('0x1e')](_0x34c9c8[_0x6250('0x1b')][_0x6250('0x1d')],function(_0x495eba){return{'model':db[_0x495eba[_0x6250('0x1f')]],'as':_0x495eba['as'],'attributes':_0x495eba[_0x6250('0x20')],'include':_0x495eba['include']?_[_0x6250('0x1e')](_0x495eba['include'],function(_0x405fee){return{'model':db[_0x405fee['model']],'as':_0x405fee['as'],'attributes':_0x405fee['attributes'],'include':_0x405fee['include']?_[_0x6250('0x1e')](_0x405fee[_0x6250('0x1d')],function(_0x26ea66){return{'model':db[_0x26ea66[_0x6250('0x1f')]],'as':_0x26ea66['as'],'attributes':_0x26ea66['attributes']};}):[]};}):[]};}):[]:[]})[_0x6250('0xd')](function(_0x5e53cf){logger['info']('GetServicenowAccount',_0x34c9c8);logger[_0x6250('0x11')]('GetServicenowAccount',_0x34c9c8,JSON[_0x6250('0x21')](_0x5e53cf));_0x5d133d(_0x5e53cf);})[_0x6250('0x17')](function(_0x16fa94){logger[_0x6250('0x13')](_0x6250('0x18'),_0x16fa94[_0x6250('0x15')],_0x34c9c8);_0x5231b6(_0x54b1a9['error'](0x1f4,_0x16fa94[_0x6250('0x15')]));});});};exports[_0x6250('0x22')]=function(_0x2de1c8){var _0x13e210=this;return new Promise(function(_0x4a9d40,_0x11f64a){return db[_0x6250('0x19')][_0x6250('0x23')]({'raw':_0x2de1c8[_0x6250('0x1b')]?_0x2de1c8[_0x6250('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2de1c8['options']?_0x2de1c8[_0x6250('0x1b')][_0x6250('0x24')]||null:null,'attributes':_0x2de1c8[_0x6250('0x1b')]?_0x2de1c8[_0x6250('0x1b')][_0x6250('0x20')]||null:null,'include':_0x2de1c8[_0x6250('0x1b')]?_0x2de1c8[_0x6250('0x1b')]['include']?_[_0x6250('0x1e')](_0x2de1c8[_0x6250('0x1b')][_0x6250('0x1d')],function(_0x2b9f3e){return{'model':db[_0x2b9f3e[_0x6250('0x1f')]],'as':_0x2b9f3e['as'],'attributes':_0x2b9f3e[_0x6250('0x20')],'include':_0x2b9f3e[_0x6250('0x1d')]?_['map'](_0x2b9f3e[_0x6250('0x1d')],function(_0x51edb2){return{'model':db[_0x51edb2['model']],'as':_0x51edb2['as'],'attributes':_0x51edb2[_0x6250('0x20')],'include':_0x51edb2['include']?_['map'](_0x51edb2[_0x6250('0x1d')],function(_0x2b6376){return{'model':db[_0x2b6376[_0x6250('0x1f')]],'as':_0x2b6376['as'],'attributes':_0x2b6376['attributes']};}):[]};}):[]};}):[]:[]})[_0x6250('0xd')](function(_0x354770){logger[_0x6250('0xe')](_0x6250('0x22'),_0x2de1c8);logger['debug'](_0x6250('0x22'),_0x2de1c8,JSON['stringify'](_0x354770));_0x4a9d40(_0x354770);})[_0x6250('0x17')](function(_0x1b27d7){logger['error'](_0x6250('0x22'),_0x1b27d7[_0x6250('0x15')],_0x2de1c8);_0x11f64a(_0x13e210['error'](0x1f4,_0x1b27d7[_0x6250('0x15')]));});});}; \ No newline at end of file +var _0x5fee=['find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','debug','ShowServicenowAccount'];(function(_0x19a90e,_0xe14b0b){var _0xa49b11=function(_0x560f76){while(--_0x560f76){_0x19a90e['push'](_0x19a90e['shift']());}};_0xa49b11(++_0xe14b0b);}(_0x5fee,0x101));var _0xe5fe=function(_0x50b90d,_0x30a809){_0x50b90d=_0x50b90d-0x0;var _0x33153f=_0x5fee[_0x50b90d];return _0x33153f;};'use strict';var _=require(_0xe5fe('0x0'));var util=require(_0xe5fe('0x1'));var moment=require('moment');var BPromise=require(_0xe5fe('0x2'));var rs=require(_0xe5fe('0x3'));var fs=require('fs');var Redis=require(_0xe5fe('0x4'));var db=require(_0xe5fe('0x5'))['db'];var utils=require(_0xe5fe('0x6'));var logger=require(_0xe5fe('0x7'))(_0xe5fe('0x8'));var config=require(_0xe5fe('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47c851,_0x52c7f9,_0x1412d1){return new BPromise(function(_0x3d17e6,_0x48104e){return client['request'](_0x47c851,_0x1412d1)[_0xe5fe('0xa')](function(_0x3aa706){logger[_0xe5fe('0xb')](_0xe5fe('0xc'),_0x52c7f9,_0xe5fe('0xd'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x52c7f9,'request\x20sent',JSON[_0xe5fe('0xe')](_0x3aa706));if(_0x3aa706['error']){if(_0x3aa706['error']['code']===0x1f4){logger[_0xe5fe('0xf')](_0xe5fe('0xc'),_0x52c7f9,_0x3aa706[_0xe5fe('0xf')][_0xe5fe('0x10')]);return _0x48104e(_0x3aa706['error']['message']);}logger[_0xe5fe('0xf')](_0xe5fe('0xc'),_0x52c7f9,_0x3aa706[_0xe5fe('0xf')][_0xe5fe('0x10')]);return _0x3d17e6(_0x3aa706[_0xe5fe('0xf')][_0xe5fe('0x10')]);}else{logger[_0xe5fe('0xb')](_0xe5fe('0xc'),_0x52c7f9,'request\x20sent');_0x3d17e6(_0x3aa706[_0xe5fe('0x11')][_0xe5fe('0x10')]);}})[_0xe5fe('0x12')](function(_0xb79a70){logger[_0xe5fe('0xf')](_0xe5fe('0xc'),_0x52c7f9,_0xb79a70);_0x48104e(_0xb79a70);});});}exports[_0xe5fe('0x13')]=function(_0x14540e){var _0x9c971a=this;return new Promise(function(_0x2e9da6,_0x3053e4){return db[_0xe5fe('0x14')][_0xe5fe('0x15')]({'raw':_0x14540e[_0xe5fe('0x16')]?_0x14540e[_0xe5fe('0x16')][_0xe5fe('0x17')]===undefined?!![]:![]:!![],'where':_0x14540e[_0xe5fe('0x16')]?_0x14540e[_0xe5fe('0x16')][_0xe5fe('0x18')]||null:null,'attributes':_0x14540e[_0xe5fe('0x16')]?_0x14540e[_0xe5fe('0x16')][_0xe5fe('0x19')]||null:null,'limit':_0x14540e[_0xe5fe('0x16')]?_0x14540e[_0xe5fe('0x16')]['limit']||null:null,'include':_0x14540e[_0xe5fe('0x16')]?_0x14540e[_0xe5fe('0x16')][_0xe5fe('0x1a')]?_[_0xe5fe('0x1b')](_0x14540e[_0xe5fe('0x16')][_0xe5fe('0x1a')],function(_0x457d53){return{'model':db[_0x457d53[_0xe5fe('0x1c')]],'as':_0x457d53['as'],'attributes':_0x457d53[_0xe5fe('0x19')],'include':_0x457d53[_0xe5fe('0x1a')]?_[_0xe5fe('0x1b')](_0x457d53[_0xe5fe('0x1a')],function(_0x2fbe60){return{'model':db[_0x2fbe60[_0xe5fe('0x1c')]],'as':_0x2fbe60['as'],'attributes':_0x2fbe60[_0xe5fe('0x19')],'include':_0x2fbe60[_0xe5fe('0x1a')]?_[_0xe5fe('0x1b')](_0x2fbe60[_0xe5fe('0x1a')],function(_0x2aa201){return{'model':db[_0x2aa201['model']],'as':_0x2aa201['as'],'attributes':_0x2aa201['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45da5b){logger[_0xe5fe('0xb')]('GetServicenowAccount',_0x14540e);logger[_0xe5fe('0x1d')]('GetServicenowAccount',_0x14540e,JSON[_0xe5fe('0xe')](_0x45da5b));_0x2e9da6(_0x45da5b);})['catch'](function(_0x3b9af8){logger[_0xe5fe('0xf')](_0xe5fe('0x13'),_0x3b9af8[_0xe5fe('0x10')],_0x14540e);_0x3053e4(_0x9c971a['error'](0x1f4,_0x3b9af8[_0xe5fe('0x10')]));});});};exports[_0xe5fe('0x1e')]=function(_0x56beb5){var _0x9f21db=this;return new Promise(function(_0x204a27,_0x570bf5){return db['ServicenowAccount'][_0xe5fe('0x1f')]({'raw':_0x56beb5[_0xe5fe('0x16')]?_0x56beb5[_0xe5fe('0x16')][_0xe5fe('0x17')]===undefined?!![]:![]:!![],'where':_0x56beb5[_0xe5fe('0x16')]?_0x56beb5['options'][_0xe5fe('0x18')]||null:null,'attributes':_0x56beb5[_0xe5fe('0x16')]?_0x56beb5['options']['attributes']||null:null,'include':_0x56beb5[_0xe5fe('0x16')]?_0x56beb5[_0xe5fe('0x16')]['include']?_['map'](_0x56beb5[_0xe5fe('0x16')][_0xe5fe('0x1a')],function(_0x556c4e){return{'model':db[_0x556c4e[_0xe5fe('0x1c')]],'as':_0x556c4e['as'],'attributes':_0x556c4e[_0xe5fe('0x19')],'include':_0x556c4e[_0xe5fe('0x1a')]?_[_0xe5fe('0x1b')](_0x556c4e[_0xe5fe('0x1a')],function(_0x2215bb){return{'model':db[_0x2215bb['model']],'as':_0x2215bb['as'],'attributes':_0x2215bb[_0xe5fe('0x19')],'include':_0x2215bb['include']?_['map'](_0x2215bb[_0xe5fe('0x1a')],function(_0x34994b){return{'model':db[_0x34994b[_0xe5fe('0x1c')]],'as':_0x34994b['as'],'attributes':_0x34994b[_0xe5fe('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47b7df){logger['info'](_0xe5fe('0x1e'),_0x56beb5);logger[_0xe5fe('0x1d')]('ShowServicenowAccount',_0x56beb5,JSON[_0xe5fe('0xe')](_0x47b7df));_0x204a27(_0x47b7df);})[_0xe5fe('0x12')](function(_0x49187b){logger[_0xe5fe('0xf')](_0xe5fe('0x1e'),_0x49187b[_0xe5fe('0x10')],_0x56beb5);_0x570bf5(_0x9f21db[_0xe5fe('0xf')](0x1f4,_0x49187b[_0xe5fe('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b103638..52b8a22 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 _0x4352=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x4352,0xe3));var _0x2435=function(_0x16d0dd,_0x37decb){_0x16d0dd=_0x16d0dd-0x0;var _0xaeb930=_0x4352[_0x16d0dd];return _0xaeb930;};'use strict';var multer=require(_0x2435('0x0'));var util=require('util');var path=require(_0x2435('0x1'));var timeout=require(_0x2435('0x2'));var express=require(_0x2435('0x3'));var router=express[_0x2435('0x4')]();var fs_extra=require(_0x2435('0x5'));var auth=require(_0x2435('0x6'));var interaction=require(_0x2435('0x7'));var config=require(_0x2435('0x8'));var controller=require(_0x2435('0x9'));router[_0x2435('0xa')]('/',auth[_0x2435('0xb')](),controller[_0x2435('0xc')]);router['get'](_0x2435('0xd'),auth[_0x2435('0xb')](),controller['show']);router[_0x2435('0xa')](_0x2435('0xe'),auth['isAuthenticated'](),controller[_0x2435('0xf')]);router[_0x2435('0xa')]('/:id/subjects',auth[_0x2435('0xb')](),controller[_0x2435('0x10')]);router['get'](_0x2435('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x2435('0x12')]);router[_0x2435('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2435('0x14')](_0x2435('0xd'),auth['isAuthenticated'](),controller[_0x2435('0x15')]);module[_0x2435('0x16')]=router; \ No newline at end of file +var _0xd316=['delete','/:id','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update'];(function(_0x12e6e5,_0x39855b){var _0x4ef6ce=function(_0x3e06f3){while(--_0x3e06f3){_0x12e6e5['push'](_0x12e6e5['shift']());}};_0x4ef6ce(++_0x39855b);}(_0xd316,0x117));var _0x6d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd316[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d31('0x0'));var timeout=require(_0x6d31('0x1'));var express=require('express');var router=express[_0x6d31('0x2')]();var fs_extra=require(_0x6d31('0x3'));var auth=require(_0x6d31('0x4'));var interaction=require(_0x6d31('0x5'));var config=require(_0x6d31('0x6'));var controller=require(_0x6d31('0x7'));router['get']('/',auth[_0x6d31('0x8')](),controller[_0x6d31('0x9')]);router[_0x6d31('0xa')]('/:id',auth[_0x6d31('0x8')](),controller[_0x6d31('0xb')]);router[_0x6d31('0xa')](_0x6d31('0xc'),auth['isAuthenticated'](),controller[_0x6d31('0xd')]);router['get'](_0x6d31('0xe'),auth['isAuthenticated'](),controller[_0x6d31('0xf')]);router[_0x6d31('0xa')](_0x6d31('0x10'),auth[_0x6d31('0x8')](),controller['getDescriptions']);router[_0x6d31('0x11')]('/',auth[_0x6d31('0x8')](),controller[_0x6d31('0x12')]);router['put']('/:id',auth[_0x6d31('0x8')](),controller[_0x6d31('0x13')]);router[_0x6d31('0x14')](_0x6d31('0x15'),auth[_0x6d31('0x8')](),controller['destroy']);module[_0x6d31('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7885bef..f3f7ee9 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 _0x54cd=['STRING','sequelize'];(function(_0x56a08f,_0xf1297c){var _0x59c0c3=function(_0xeff387){while(--_0xeff387){_0x56a08f['push'](_0x56a08f['shift']());}};_0x59c0c3(++_0xf1297c);}(_0x54cd,0x1d9));var _0xd54c=function(_0x521495,_0x333d7e){_0x521495=_0x521495-0x0;var _0x4ea89b=_0x54cd[_0x521495];return _0x4ea89b;};'use strict';var Sequelize=require(_0xd54c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd54c('0x1')]}}; \ No newline at end of file +var _0x5f48=['STRING','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5f48,0xe5));var _0x85f4=function(_0x2225d6,_0x5aab3a){_0x2225d6=_0x2225d6-0x0;var _0x1613ed=_0x5f48[_0x2225d6];return _0x1613ed;};'use strict';var Sequelize=require('sequelize');module[_0x85f4('0x0')]={'name':{'type':Sequelize[_0x85f4('0x1')]},'description':{'type':Sequelize[_0x85f4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8c8fe7f..6aac8e1 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 _0xa32c=['length','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields'];(function(_0x1621d7,_0x768b72){var _0x284b9e=function(_0x399c3f){while(--_0x399c3f){_0x1621d7['push'](_0x1621d7['shift']());}};_0x284b9e(++_0x768b72);}(_0xa32c,0xbe));var _0xca32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa32c[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca32('0x0'));var zipdir=require(_0xca32('0x1'));var jsonpatch=require(_0xca32('0x2'));var rp=require('request-promise');var moment=require(_0xca32('0x3'));var BPromise=require(_0xca32('0x4'));var Mustache=require('mustache');var util=require(_0xca32('0x5'));var path=require(_0xca32('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca32('0x7'));var fs=require('fs');var fs_extra=require(_0xca32('0x8'));var _=require(_0xca32('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xca32('0xa'));var deskjs=require(_0xca32('0xb'));var toCsv=require(_0xca32('0xc'));var querystring=require(_0xca32('0xd'));var Papa=require(_0xca32('0xe'));var Redis=require(_0xca32('0xf'));var authService=require(_0xca32('0x10'));var qs=require(_0xca32('0x11'));var as=require(_0xca32('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca32('0x13'))(_0xca32('0x14'));var utils=require(_0xca32('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xca32('0x16'));var db=require(_0xca32('0x17'))['db'];function respondWithStatusCode(_0xcf9ed1,_0xf865e2){_0xf865e2=_0xf865e2||0xcc;return function(_0x2ddb51){if(_0x2ddb51){return _0xcf9ed1[_0xca32('0x18')](_0xf865e2);}return _0xcf9ed1[_0xca32('0x19')](_0xf865e2)[_0xca32('0x1a')]();};}function respondWithResult(_0x562bd4,_0x5d47e5){_0x5d47e5=_0x5d47e5||0xc8;return function(_0x49b7ef){if(_0x49b7ef){return _0x562bd4[_0xca32('0x19')](_0x5d47e5)['json'](_0x49b7ef);}};}function respondWithFilteredResult(_0x70e317,_0x208dba){return function(_0x5bfc93){if(_0x5bfc93){var _0x5b3d41=typeof _0x208dba[_0xca32('0x1b')]===_0xca32('0x1c')&&typeof _0x208dba[_0xca32('0x1d')]===_0xca32('0x1c');var _0x2d99bd=_0x5bfc93[_0xca32('0x1e')];var _0x2c64b4=_0x5b3d41?0x0:_0x208dba['offset'];var _0x5960e4=_0x5b3d41?_0x5bfc93[_0xca32('0x1e')]:_0x208dba['offset']+_0x208dba[_0xca32('0x1d')];var _0x3cd533;if(_0x5960e4>=_0x2d99bd){_0x5960e4=_0x2d99bd;_0x3cd533=0xc8;}else{_0x3cd533=0xce;}_0x70e317[_0xca32('0x19')](_0x3cd533);return _0x70e317['set'](_0xca32('0x1f'),_0x2c64b4+'-'+_0x5960e4+'/'+_0x2d99bd)[_0xca32('0x20')](_0x5bfc93);}return null;};}function patchUpdates(_0x955756){return function(_0x2d3fdd){try{jsonpatch['apply'](_0x2d3fdd,_0x955756,!![]);}catch(_0x4d8b39){return BPromise[_0xca32('0x21')](_0x4d8b39);}return _0x2d3fdd[_0xca32('0x22')]();};}function saveUpdates(_0x552802,_0x2b4ced){return function(_0x23dbef){if(_0x23dbef){return _0x23dbef[_0xca32('0x23')](_0x552802)[_0xca32('0x24')](function(_0x21d9ca){return _0x21d9ca;});}return null;};}function removeEntity(_0x3cc64a,_0x32d448){return function(_0x5a49f2){if(_0x5a49f2){return _0x5a49f2['destroy']()[_0xca32('0x24')](function(){_0x3cc64a[_0xca32('0x19')](0xcc)[_0xca32('0x1a')]();});}};}function handleEntityNotFound(_0x1908a5,_0x1107d3){return function(_0x15ee3d){if(!_0x15ee3d){_0x1908a5[_0xca32('0x18')](0x194);}return _0x15ee3d;};}function handleError(_0x4b9eb4,_0x6ad3a7){_0x6ad3a7=_0x6ad3a7||0x1f4;return function(_0x3c061b){logger[_0xca32('0x25')](_0x3c061b[_0xca32('0x26')]);if(_0x3c061b[_0xca32('0x27')]){delete _0x3c061b['name'];}_0x4b9eb4[_0xca32('0x19')](_0x6ad3a7)[_0xca32('0x28')](_0x3c061b);};}exports[_0xca32('0x29')]=function(_0x25ab60,_0x32f7af){var _0x1665e0={},_0x32c8f1={},_0x5981da={'count':0x0,'rows':[]};var _0x20a801=_['map'](db[_0xca32('0x2a')][_0xca32('0x2b')],function(_0x50d4f8){return{'name':_0x50d4f8[_0xca32('0x2c')],'type':_0x50d4f8['type'][_0xca32('0x2d')]};});_0x32c8f1[_0xca32('0x2e')]=_[_0xca32('0x2f')](_0x20a801,'name');_0x32c8f1[_0xca32('0x30')]=_[_0xca32('0x31')](_0x25ab60[_0xca32('0x30')]);_0x32c8f1[_0xca32('0x32')]=_['intersection'](_0x32c8f1[_0xca32('0x2e')],_0x32c8f1[_0xca32('0x30')]);_0x1665e0[_0xca32('0x33')]=_['intersection'](_0x32c8f1['model'],qs[_0xca32('0x34')](_0x25ab60['query'][_0xca32('0x34')]));_0x1665e0['attributes']=_0x1665e0[_0xca32('0x33')][_0xca32('0x35')]?_0x1665e0['attributes']:_0x32c8f1[_0xca32('0x2e')];if(!_0x25ab60[_0xca32('0x30')]['hasOwnProperty'](_0xca32('0x36'))){_0x1665e0[_0xca32('0x1d')]=qs['limit'](_0x25ab60['query'][_0xca32('0x1d')]);_0x1665e0[_0xca32('0x1b')]=qs[_0xca32('0x1b')](_0x25ab60[_0xca32('0x30')][_0xca32('0x1b')]);}_0x1665e0[_0xca32('0x37')]=qs[_0xca32('0x38')](_0x25ab60[_0xca32('0x30')][_0xca32('0x38')]);_0x1665e0[_0xca32('0x39')]=qs[_0xca32('0x32')](_[_0xca32('0x3a')](_0x25ab60[_0xca32('0x30')],_0x32c8f1[_0xca32('0x32')]),_0x20a801);if(_0x25ab60['query'][_0xca32('0x3b')]){_0x1665e0['where']=_['merge'](_0x1665e0[_0xca32('0x39')],{'$or':_['map'](_0x20a801,function(_0xaff082){if(_0xaff082[_0xca32('0x3c')]!=='VIRTUAL'){var _0x5f3851={};_0x5f3851[_0xaff082['name']]={'$like':'%'+_0x25ab60['query'][_0xca32('0x3b')]+'%'};return _0x5f3851;}})});}_0x1665e0=_[_0xca32('0x3d')]({},_0x1665e0,_0x25ab60[_0xca32('0x3e')]);var _0x28d608={'where':_0x1665e0['where']};return db['ServicenowConfiguration']['count'](_0x28d608)[_0xca32('0x24')](function(_0x57685b){_0x5981da[_0xca32('0x1e')]=_0x57685b;if(_0x25ab60['query'][_0xca32('0x3f')]){_0x1665e0[_0xca32('0x40')]=[{'all':!![]}];}return db[_0xca32('0x2a')][_0xca32('0x41')](_0x1665e0);})[_0xca32('0x24')](function(_0x17626a){_0x5981da[_0xca32('0x42')]=_0x17626a;return _0x5981da;})[_0xca32('0x24')](respondWithFilteredResult(_0x32f7af,_0x1665e0))[_0xca32('0x43')](handleError(_0x32f7af,null));};exports[_0xca32('0x44')]=function(_0x4e7c31,_0x496b74){var _0x2fd52d={'raw':![],'where':{'id':_0x4e7c31[_0xca32('0x45')]['id']}},_0x5c2359={};_0x5c2359[_0xca32('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0xca32('0x2b')]);_0x5c2359[_0xca32('0x30')]=_[_0xca32('0x31')](_0x4e7c31[_0xca32('0x30')]);_0x5c2359['filters']=_['intersection'](_0x5c2359[_0xca32('0x2e')],_0x5c2359[_0xca32('0x30')]);_0x2fd52d[_0xca32('0x33')]=_[_0xca32('0x46')](_0x5c2359[_0xca32('0x2e')],qs[_0xca32('0x34')](_0x4e7c31[_0xca32('0x30')][_0xca32('0x34')]));_0x2fd52d['attributes']=_0x2fd52d['attributes']['length']?_0x2fd52d[_0xca32('0x33')]:_0x5c2359[_0xca32('0x2e')];if(_0x4e7c31[_0xca32('0x30')][_0xca32('0x3f')]){_0x2fd52d[_0xca32('0x40')]=[{'all':!![]}];}_0x2fd52d=_['merge']({},_0x2fd52d,_0x4e7c31['options']);return db[_0xca32('0x2a')][_0xca32('0x47')](_0x2fd52d)[_0xca32('0x24')](handleEntityNotFound(_0x496b74,null))[_0xca32('0x24')](respondWithResult(_0x496b74,null))[_0xca32('0x43')](handleError(_0x496b74,null));};exports[_0xca32('0x48')]=function(_0x142868,_0x1a22e2){return db[_0xca32('0x2a')][_0xca32('0x48')](_0x142868[_0xca32('0x49')],{})[_0xca32('0x24')](respondWithResult(_0x1a22e2,0xc9))[_0xca32('0x43')](handleError(_0x1a22e2,null));};exports[_0xca32('0x23')]=function(_0x39c301,_0x47e3d2){if(_0x39c301['body']['id']){delete _0x39c301[_0xca32('0x49')]['id'];}return db[_0xca32('0x2a')][_0xca32('0x47')]({'where':{'id':_0x39c301['params']['id']}})[_0xca32('0x24')](handleEntityNotFound(_0x47e3d2,null))[_0xca32('0x24')](saveUpdates(_0x39c301[_0xca32('0x49')],null))['then'](respondWithResult(_0x47e3d2,null))[_0xca32('0x43')](handleError(_0x47e3d2,null));};exports[_0xca32('0x4a')]=function(_0xee8193,_0x24188d){return db[_0xca32('0x2a')][_0xca32('0x47')]({'where':{'id':_0xee8193['params']['id']}})[_0xca32('0x24')](handleEntityNotFound(_0x24188d,null))[_0xca32('0x24')](removeEntity(_0x24188d,null))['catch'](handleError(_0x24188d,null));};exports[_0xca32('0x4b')]=function(_0x4ad713,_0x547c3e,_0x3a77ab){var _0x3289fb={};var _0x14db48={};var _0x15e5f4;var _0x2d6374;return db['ServicenowConfiguration'][_0xca32('0x4c')]({'where':{'id':_0x4ad713[_0xca32('0x45')]['id']}})['then'](handleEntityNotFound(_0x547c3e,null))['then'](function(_0x4c075f){if(_0x4c075f){_0x15e5f4=_0x4c075f;_0x14db48[_0xca32('0x2e')]=_['keys'](db[_0xca32('0x4d')][_0xca32('0x2b')]);_0x14db48[_0xca32('0x30')]=_['keys'](_0x4ad713[_0xca32('0x30')]);_0x14db48[_0xca32('0x32')]=_[_0xca32('0x46')](_0x14db48['model'],_0x14db48[_0xca32('0x30')]);_0x3289fb[_0xca32('0x33')]=_[_0xca32('0x46')](_0x14db48['model'],qs['fields'](_0x4ad713[_0xca32('0x30')]['fields']));_0x3289fb[_0xca32('0x33')]=_0x3289fb[_0xca32('0x33')][_0xca32('0x35')]?_0x3289fb[_0xca32('0x33')]:_0x14db48[_0xca32('0x2e')];_0x3289fb[_0xca32('0x37')]=qs[_0xca32('0x38')](_0x4ad713[_0xca32('0x30')][_0xca32('0x38')]);_0x3289fb[_0xca32('0x39')]=qs[_0xca32('0x32')](_[_0xca32('0x3a')](_0x4ad713[_0xca32('0x30')],_0x14db48[_0xca32('0x32')]));if(_0x4ad713[_0xca32('0x30')][_0xca32('0x3b')]){_0x3289fb[_0xca32('0x39')]=_['merge'](_0x3289fb[_0xca32('0x39')],{'$or':_[_0xca32('0x2f')](_0x3289fb['attributes'],function(_0x213342){var _0x4a3b76={};_0x4a3b76[_0x213342]={'$like':'%'+_0x4ad713[_0xca32('0x30')][_0xca32('0x3b')]+'%'};return _0x4a3b76;})});}_0x3289fb=_[_0xca32('0x3d')]({},_0x3289fb,_0x4ad713[_0xca32('0x3e')]);return _0x15e5f4[_0xca32('0x4b')](_0x3289fb);}})['then'](function(_0x140f1e){if(_0x140f1e){_0x2d6374=_0x140f1e[_0xca32('0x35')];if(!_0x4ad713['query']['hasOwnProperty']('nolimit')){_0x3289fb[_0xca32('0x1d')]=qs['limit'](_0x4ad713[_0xca32('0x30')]['limit']);_0x3289fb[_0xca32('0x1b')]=qs[_0xca32('0x1b')](_0x4ad713['query'][_0xca32('0x1b')]);}return _0x15e5f4[_0xca32('0x4b')](_0x3289fb);}})[_0xca32('0x24')](function(_0x5cbed6){if(_0x5cbed6){return _0x5cbed6?{'count':_0x2d6374,'rows':_0x5cbed6}:null;}})[_0xca32('0x24')](respondWithResult(_0x547c3e,null))['catch'](handleError(_0x547c3e,null));};exports[_0xca32('0x4e')]=function(_0x257c8c,_0x32d7a2,_0x3ca3ae){var _0xb064ee={};var _0x23119a={};var _0x443d7a;var _0x435f72;return db['ServicenowConfiguration'][_0xca32('0x4c')]({'where':{'id':_0x257c8c[_0xca32('0x45')]['id']}})['then'](handleEntityNotFound(_0x32d7a2,null))['then'](function(_0x3081b8){if(_0x3081b8){_0x443d7a=_0x3081b8;_0x23119a[_0xca32('0x2e')]=_[_0xca32('0x31')](db[_0xca32('0x4d')]['rawAttributes']);_0x23119a[_0xca32('0x30')]=_[_0xca32('0x31')](_0x257c8c[_0xca32('0x30')]);_0x23119a[_0xca32('0x32')]=_[_0xca32('0x46')](_0x23119a[_0xca32('0x2e')],_0x23119a[_0xca32('0x30')]);_0xb064ee[_0xca32('0x33')]=_[_0xca32('0x46')](_0x23119a['model'],qs['fields'](_0x257c8c[_0xca32('0x30')][_0xca32('0x34')]));_0xb064ee['attributes']=_0xb064ee[_0xca32('0x33')][_0xca32('0x35')]?_0xb064ee['attributes']:_0x23119a['model'];_0xb064ee[_0xca32('0x37')]=qs[_0xca32('0x38')](_0x257c8c[_0xca32('0x30')][_0xca32('0x38')]);_0xb064ee['where']=qs['filters'](_['pick'](_0x257c8c[_0xca32('0x30')],_0x23119a[_0xca32('0x32')]));if(_0x257c8c['query'][_0xca32('0x3b')]){_0xb064ee[_0xca32('0x39')]=_[_0xca32('0x3d')](_0xb064ee[_0xca32('0x39')],{'$or':_['map'](_0xb064ee[_0xca32('0x33')],function(_0xb4f2e8){var _0x45ad24={};_0x45ad24[_0xb4f2e8]={'$like':'%'+_0x257c8c[_0xca32('0x30')][_0xca32('0x3b')]+'%'};return _0x45ad24;})});}_0xb064ee=_['merge']({},_0xb064ee,_0x257c8c['options']);return _0x443d7a[_0xca32('0x4e')](_0xb064ee);}})['then'](function(_0x1ccacb){if(_0x1ccacb){_0x435f72=_0x1ccacb[_0xca32('0x35')];if(!_0x257c8c['query']['hasOwnProperty'](_0xca32('0x36'))){_0xb064ee['limit']=qs[_0xca32('0x1d')](_0x257c8c['query'][_0xca32('0x1d')]);_0xb064ee[_0xca32('0x1b')]=qs[_0xca32('0x1b')](_0x257c8c['query']['offset']);}return _0x443d7a[_0xca32('0x4e')](_0xb064ee);}})[_0xca32('0x24')](function(_0x55b313){if(_0x55b313){return _0x55b313?{'count':_0x435f72,'rows':_0x55b313}:null;}})['then'](respondWithResult(_0x32d7a2,null))[_0xca32('0x43')](handleError(_0x32d7a2,null));};exports[_0xca32('0x4f')]=function(_0x46d02e,_0x41ab99,_0x2240a1){var _0x4dae4b={};var _0x5263f8={};var _0x3c8856;var _0x272f9f;return db[_0xca32('0x2a')]['findOne']({'where':{'id':_0x46d02e[_0xca32('0x45')]['id']}})[_0xca32('0x24')](handleEntityNotFound(_0x41ab99,null))[_0xca32('0x24')](function(_0xfc00fc){if(_0xfc00fc){_0x3c8856=_0xfc00fc;_0x5263f8[_0xca32('0x2e')]=_[_0xca32('0x31')](db[_0xca32('0x4d')]['rawAttributes']);_0x5263f8[_0xca32('0x30')]=_[_0xca32('0x31')](_0x46d02e[_0xca32('0x30')]);_0x5263f8[_0xca32('0x32')]=_['intersection'](_0x5263f8[_0xca32('0x2e')],_0x5263f8[_0xca32('0x30')]);_0x4dae4b[_0xca32('0x33')]=_[_0xca32('0x46')](_0x5263f8['model'],qs[_0xca32('0x34')](_0x46d02e['query'][_0xca32('0x34')]));_0x4dae4b[_0xca32('0x33')]=_0x4dae4b[_0xca32('0x33')]['length']?_0x4dae4b[_0xca32('0x33')]:_0x5263f8[_0xca32('0x2e')];_0x4dae4b[_0xca32('0x37')]=qs[_0xca32('0x38')](_0x46d02e[_0xca32('0x30')][_0xca32('0x38')]);_0x4dae4b['where']=qs[_0xca32('0x32')](_['pick'](_0x46d02e[_0xca32('0x30')],_0x5263f8['filters']));if(_0x46d02e[_0xca32('0x30')][_0xca32('0x3b')]){_0x4dae4b[_0xca32('0x39')]=_[_0xca32('0x3d')](_0x4dae4b['where'],{'$or':_['map'](_0x4dae4b[_0xca32('0x33')],function(_0x477393){var _0x8a8f61={};_0x8a8f61[_0x477393]={'$like':'%'+_0x46d02e[_0xca32('0x30')][_0xca32('0x3b')]+'%'};return _0x8a8f61;})});}_0x4dae4b=_['merge']({},_0x4dae4b,_0x46d02e[_0xca32('0x3e')]);return _0x3c8856[_0xca32('0x4f')](_0x4dae4b);}})[_0xca32('0x24')](function(_0x1d971c){if(_0x1d971c){_0x272f9f=_0x1d971c[_0xca32('0x35')];if(!_0x46d02e[_0xca32('0x30')][_0xca32('0x50')](_0xca32('0x36'))){_0x4dae4b['limit']=qs[_0xca32('0x1d')](_0x46d02e[_0xca32('0x30')][_0xca32('0x1d')]);_0x4dae4b[_0xca32('0x1b')]=qs[_0xca32('0x1b')](_0x46d02e[_0xca32('0x30')][_0xca32('0x1b')]);}return _0x3c8856['getDescriptions'](_0x4dae4b);}})['then'](function(_0x38ed48){if(_0x38ed48){return _0x38ed48?{'count':_0x272f9f,'rows':_0x38ed48}:null;}})[_0xca32('0x24')](respondWithResult(_0x41ab99,null))[_0xca32('0x43')](handleError(_0x41ab99,null));}; \ No newline at end of file +var _0x1571=['stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','options','then','includeAll','include','findAll','rows','show','params','merge','catch','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','ServicenowField','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy'];(function(_0x1bcb83,_0x280bb1){var _0x428eba=function(_0x10ebf7){while(--_0x10ebf7){_0x1bcb83['push'](_0x1bcb83['shift']());}};_0x428eba(++_0x280bb1);}(_0x1571,0xc4));var _0x1157=function(_0x54e9cd,_0x16ae73){_0x54e9cd=_0x54e9cd-0x0;var _0x343ae7=_0x1571[_0x54e9cd];return _0x343ae7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1157('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1157('0x1'));var rp=require(_0x1157('0x2'));var moment=require(_0x1157('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1157('0x4'));var util=require(_0x1157('0x5'));var path=require(_0x1157('0x6'));var sox=require(_0x1157('0x7'));var csv=require(_0x1157('0x8'));var ejs=require(_0x1157('0x9'));var fs=require('fs');var fs_extra=require(_0x1157('0xa'));var _=require(_0x1157('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1157('0xc'));var deskjs=require(_0x1157('0xd'));var toCsv=require(_0x1157('0x8'));var querystring=require('querystring');var Papa=require(_0x1157('0xe'));var Redis=require(_0x1157('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1157('0x10'));var as=require(_0x1157('0x11'));var hardwareService=require(_0x1157('0x12'));var logger=require(_0x1157('0x13'))(_0x1157('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1157('0x15'));var db=require(_0x1157('0x16'))['db'];function respondWithStatusCode(_0x2825b7,_0x1a0f08){_0x1a0f08=_0x1a0f08||0xcc;return function(_0x65c695){if(_0x65c695){return _0x2825b7[_0x1157('0x17')](_0x1a0f08);}return _0x2825b7[_0x1157('0x18')](_0x1a0f08)['end']();};}function respondWithResult(_0x3a5d6b,_0x527f72){_0x527f72=_0x527f72||0xc8;return function(_0x21af71){if(_0x21af71){return _0x3a5d6b[_0x1157('0x18')](_0x527f72)[_0x1157('0x19')](_0x21af71);}};}function respondWithFilteredResult(_0x5c8c19,_0x327f7d){return function(_0x37ec6a){if(_0x37ec6a){var _0x4cf54c=typeof _0x327f7d[_0x1157('0x1a')]===_0x1157('0x1b')&&typeof _0x327f7d[_0x1157('0x1c')]===_0x1157('0x1b');var _0x40b7aa=_0x37ec6a[_0x1157('0x1d')];var _0x2979a8=_0x4cf54c?0x0:_0x327f7d[_0x1157('0x1a')];var _0x10d666=_0x4cf54c?_0x37ec6a[_0x1157('0x1d')]:_0x327f7d[_0x1157('0x1a')]+_0x327f7d[_0x1157('0x1c')];var _0x397f7d;if(_0x10d666>=_0x40b7aa){_0x10d666=_0x40b7aa;_0x397f7d=0xc8;}else{_0x397f7d=0xce;}_0x5c8c19[_0x1157('0x18')](_0x397f7d);return _0x5c8c19['set'](_0x1157('0x1e'),_0x2979a8+'-'+_0x10d666+'/'+_0x40b7aa)['json'](_0x37ec6a);}return null;};}function patchUpdates(_0x5a56e0){return function(_0xede97d){try{jsonpatch['apply'](_0xede97d,_0x5a56e0,!![]);}catch(_0x16390c){return BPromise[_0x1157('0x1f')](_0x16390c);}return _0xede97d[_0x1157('0x20')]();};}function saveUpdates(_0x17387f,_0x265d12){return function(_0x30511c){if(_0x30511c){return _0x30511c[_0x1157('0x21')](_0x17387f)['then'](function(_0x21d50b){return _0x21d50b;});}return null;};}function removeEntity(_0x3a11b5,_0x181ff7){return function(_0x31989e){if(_0x31989e){return _0x31989e[_0x1157('0x22')]()['then'](function(){_0x3a11b5[_0x1157('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fe3c,_0x5a5924){return function(_0xe1c21d){if(!_0xe1c21d){_0x36fe3c[_0x1157('0x17')](0x194);}return _0xe1c21d;};}function handleError(_0x5de34f,_0x2ee8d6){_0x2ee8d6=_0x2ee8d6||0x1f4;return function(_0x3f6a40){logger['error'](_0x3f6a40[_0x1157('0x23')]);if(_0x3f6a40[_0x1157('0x24')]){delete _0x3f6a40[_0x1157('0x24')];}_0x5de34f[_0x1157('0x18')](_0x2ee8d6)[_0x1157('0x25')](_0x3f6a40);};}exports[_0x1157('0x26')]=function(_0x388abd,_0x543562){var _0x1a0d3a={},_0x2d9ae2={},_0x3f2ec4={'count':0x0,'rows':[]};var _0x5dbfa5=_[_0x1157('0x27')](db[_0x1157('0x28')][_0x1157('0x29')],function(_0x2748fd){return{'name':_0x2748fd[_0x1157('0x2a')],'type':_0x2748fd[_0x1157('0x2b')]['key']};});_0x2d9ae2[_0x1157('0x2c')]=_['map'](_0x5dbfa5,_0x1157('0x24'));_0x2d9ae2['query']=_[_0x1157('0x2d')](_0x388abd[_0x1157('0x2e')]);_0x2d9ae2['filters']=_[_0x1157('0x2f')](_0x2d9ae2[_0x1157('0x2c')],_0x2d9ae2[_0x1157('0x2e')]);_0x1a0d3a[_0x1157('0x30')]=_[_0x1157('0x2f')](_0x2d9ae2['model'],qs['fields'](_0x388abd['query'][_0x1157('0x31')]));_0x1a0d3a['attributes']=_0x1a0d3a[_0x1157('0x30')][_0x1157('0x32')]?_0x1a0d3a[_0x1157('0x30')]:_0x2d9ae2['model'];if(!_0x388abd['query']['hasOwnProperty'](_0x1157('0x33'))){_0x1a0d3a[_0x1157('0x1c')]=qs[_0x1157('0x1c')](_0x388abd[_0x1157('0x2e')][_0x1157('0x1c')]);_0x1a0d3a[_0x1157('0x1a')]=qs[_0x1157('0x1a')](_0x388abd['query'][_0x1157('0x1a')]);}_0x1a0d3a[_0x1157('0x34')]=qs[_0x1157('0x35')](_0x388abd[_0x1157('0x2e')]['sort']);_0x1a0d3a[_0x1157('0x36')]=qs[_0x1157('0x37')](_[_0x1157('0x38')](_0x388abd['query'],_0x2d9ae2[_0x1157('0x37')]),_0x5dbfa5);if(_0x388abd[_0x1157('0x2e')][_0x1157('0x39')]){_0x1a0d3a['where']=_['merge'](_0x1a0d3a[_0x1157('0x36')],{'$or':_[_0x1157('0x27')](_0x5dbfa5,function(_0x20a2e6){if(_0x20a2e6[_0x1157('0x2b')]!=='VIRTUAL'){var _0x19a815={};_0x19a815[_0x20a2e6[_0x1157('0x24')]]={'$like':'%'+_0x388abd[_0x1157('0x2e')][_0x1157('0x39')]+'%'};return _0x19a815;}})});}_0x1a0d3a=_['merge']({},_0x1a0d3a,_0x388abd[_0x1157('0x3a')]);var _0xfac10d={'where':_0x1a0d3a[_0x1157('0x36')]};return db[_0x1157('0x28')][_0x1157('0x1d')](_0xfac10d)[_0x1157('0x3b')](function(_0x400f55){_0x3f2ec4['count']=_0x400f55;if(_0x388abd['query'][_0x1157('0x3c')]){_0x1a0d3a[_0x1157('0x3d')]=[{'all':!![]}];}return db[_0x1157('0x28')][_0x1157('0x3e')](_0x1a0d3a);})[_0x1157('0x3b')](function(_0x3b25af){_0x3f2ec4[_0x1157('0x3f')]=_0x3b25af;return _0x3f2ec4;})[_0x1157('0x3b')](respondWithFilteredResult(_0x543562,_0x1a0d3a))['catch'](handleError(_0x543562,null));};exports[_0x1157('0x40')]=function(_0x427995,_0x11ba6b){var _0x253602={'raw':![],'where':{'id':_0x427995[_0x1157('0x41')]['id']}},_0x1f4a66={};_0x1f4a66[_0x1157('0x2c')]=_[_0x1157('0x2d')](db[_0x1157('0x28')][_0x1157('0x29')]);_0x1f4a66[_0x1157('0x2e')]=_[_0x1157('0x2d')](_0x427995[_0x1157('0x2e')]);_0x1f4a66[_0x1157('0x37')]=_[_0x1157('0x2f')](_0x1f4a66[_0x1157('0x2c')],_0x1f4a66['query']);_0x253602['attributes']=_['intersection'](_0x1f4a66[_0x1157('0x2c')],qs[_0x1157('0x31')](_0x427995[_0x1157('0x2e')][_0x1157('0x31')]));_0x253602['attributes']=_0x253602['attributes']['length']?_0x253602['attributes']:_0x1f4a66[_0x1157('0x2c')];if(_0x427995[_0x1157('0x2e')][_0x1157('0x3c')]){_0x253602['include']=[{'all':!![]}];}_0x253602=_[_0x1157('0x42')]({},_0x253602,_0x427995[_0x1157('0x3a')]);return db[_0x1157('0x28')]['find'](_0x253602)['then'](handleEntityNotFound(_0x11ba6b,null))[_0x1157('0x3b')](respondWithResult(_0x11ba6b,null))[_0x1157('0x43')](handleError(_0x11ba6b,null));};exports[_0x1157('0x44')]=function(_0x502505,_0x388b7f){return db[_0x1157('0x28')][_0x1157('0x44')](_0x502505[_0x1157('0x45')],{})[_0x1157('0x3b')](respondWithResult(_0x388b7f,0xc9))['catch'](handleError(_0x388b7f,null));};exports[_0x1157('0x21')]=function(_0x2d4e98,_0x131d9c){if(_0x2d4e98[_0x1157('0x45')]['id']){delete _0x2d4e98[_0x1157('0x45')]['id'];}return db[_0x1157('0x28')][_0x1157('0x46')]({'where':{'id':_0x2d4e98['params']['id']}})['then'](handleEntityNotFound(_0x131d9c,null))[_0x1157('0x3b')](saveUpdates(_0x2d4e98[_0x1157('0x45')],null))[_0x1157('0x3b')](respondWithResult(_0x131d9c,null))[_0x1157('0x43')](handleError(_0x131d9c,null));};exports['destroy']=function(_0x10664a,_0x312cb6){return db['ServicenowConfiguration'][_0x1157('0x46')]({'where':{'id':_0x10664a['params']['id']}})['then'](handleEntityNotFound(_0x312cb6,null))[_0x1157('0x3b')](removeEntity(_0x312cb6,null))[_0x1157('0x43')](handleError(_0x312cb6,null));};exports[_0x1157('0x47')]=function(_0x303bf9,_0x5c4a08,_0x3b16ef){var _0x41c563={};var _0x212623={};var _0x3a7a1a;var _0x3a366;return db[_0x1157('0x28')][_0x1157('0x48')]({'where':{'id':_0x303bf9[_0x1157('0x41')]['id']}})[_0x1157('0x3b')](handleEntityNotFound(_0x5c4a08,null))['then'](function(_0x34a8e2){if(_0x34a8e2){_0x3a7a1a=_0x34a8e2;_0x212623[_0x1157('0x2c')]=_[_0x1157('0x2d')](db['ServicenowField'][_0x1157('0x29')]);_0x212623[_0x1157('0x2e')]=_['keys'](_0x303bf9[_0x1157('0x2e')]);_0x212623[_0x1157('0x37')]=_[_0x1157('0x2f')](_0x212623[_0x1157('0x2c')],_0x212623['query']);_0x41c563['attributes']=_[_0x1157('0x2f')](_0x212623[_0x1157('0x2c')],qs['fields'](_0x303bf9['query'][_0x1157('0x31')]));_0x41c563[_0x1157('0x30')]=_0x41c563['attributes'][_0x1157('0x32')]?_0x41c563[_0x1157('0x30')]:_0x212623['model'];_0x41c563[_0x1157('0x34')]=qs[_0x1157('0x35')](_0x303bf9[_0x1157('0x2e')]['sort']);_0x41c563[_0x1157('0x36')]=qs[_0x1157('0x37')](_[_0x1157('0x38')](_0x303bf9['query'],_0x212623[_0x1157('0x37')]));if(_0x303bf9[_0x1157('0x2e')][_0x1157('0x39')]){_0x41c563[_0x1157('0x36')]=_[_0x1157('0x42')](_0x41c563[_0x1157('0x36')],{'$or':_[_0x1157('0x27')](_0x41c563[_0x1157('0x30')],function(_0x4d84b7){var _0x4e941b={};_0x4e941b[_0x4d84b7]={'$like':'%'+_0x303bf9[_0x1157('0x2e')][_0x1157('0x39')]+'%'};return _0x4e941b;})});}_0x41c563=_[_0x1157('0x42')]({},_0x41c563,_0x303bf9[_0x1157('0x3a')]);return _0x3a7a1a[_0x1157('0x47')](_0x41c563);}})[_0x1157('0x3b')](function(_0x47fa40){if(_0x47fa40){_0x3a366=_0x47fa40[_0x1157('0x32')];if(!_0x303bf9['query'][_0x1157('0x49')](_0x1157('0x33'))){_0x41c563[_0x1157('0x1c')]=qs['limit'](_0x303bf9[_0x1157('0x2e')][_0x1157('0x1c')]);_0x41c563[_0x1157('0x1a')]=qs[_0x1157('0x1a')](_0x303bf9[_0x1157('0x2e')][_0x1157('0x1a')]);}return _0x3a7a1a['getFields'](_0x41c563);}})['then'](function(_0x4ca00a){if(_0x4ca00a){return _0x4ca00a?{'count':_0x3a366,'rows':_0x4ca00a}:null;}})['then'](respondWithResult(_0x5c4a08,null))['catch'](handleError(_0x5c4a08,null));};exports['getSubjects']=function(_0x354a88,_0x304e59,_0x26a3ef){var _0x52715e={};var _0x88d577={};var _0x1d3677;var _0x3c1b14;return db[_0x1157('0x28')][_0x1157('0x48')]({'where':{'id':_0x354a88[_0x1157('0x41')]['id']}})[_0x1157('0x3b')](handleEntityNotFound(_0x304e59,null))[_0x1157('0x3b')](function(_0x202331){if(_0x202331){_0x1d3677=_0x202331;_0x88d577[_0x1157('0x2c')]=_['keys'](db['ServicenowField'][_0x1157('0x29')]);_0x88d577[_0x1157('0x2e')]=_[_0x1157('0x2d')](_0x354a88[_0x1157('0x2e')]);_0x88d577['filters']=_[_0x1157('0x2f')](_0x88d577['model'],_0x88d577['query']);_0x52715e[_0x1157('0x30')]=_['intersection'](_0x88d577[_0x1157('0x2c')],qs[_0x1157('0x31')](_0x354a88[_0x1157('0x2e')][_0x1157('0x31')]));_0x52715e[_0x1157('0x30')]=_0x52715e['attributes'][_0x1157('0x32')]?_0x52715e[_0x1157('0x30')]:_0x88d577['model'];_0x52715e[_0x1157('0x34')]=qs[_0x1157('0x35')](_0x354a88['query'][_0x1157('0x35')]);_0x52715e[_0x1157('0x36')]=qs['filters'](_['pick'](_0x354a88[_0x1157('0x2e')],_0x88d577[_0x1157('0x37')]));if(_0x354a88[_0x1157('0x2e')][_0x1157('0x39')]){_0x52715e[_0x1157('0x36')]=_[_0x1157('0x42')](_0x52715e[_0x1157('0x36')],{'$or':_[_0x1157('0x27')](_0x52715e[_0x1157('0x30')],function(_0xd9e3c8){var _0x211af8={};_0x211af8[_0xd9e3c8]={'$like':'%'+_0x354a88[_0x1157('0x2e')][_0x1157('0x39')]+'%'};return _0x211af8;})});}_0x52715e=_[_0x1157('0x42')]({},_0x52715e,_0x354a88[_0x1157('0x3a')]);return _0x1d3677[_0x1157('0x4a')](_0x52715e);}})[_0x1157('0x3b')](function(_0x4745de){if(_0x4745de){_0x3c1b14=_0x4745de['length'];if(!_0x354a88['query'][_0x1157('0x49')]('nolimit')){_0x52715e[_0x1157('0x1c')]=qs[_0x1157('0x1c')](_0x354a88['query'][_0x1157('0x1c')]);_0x52715e[_0x1157('0x1a')]=qs[_0x1157('0x1a')](_0x354a88['query'][_0x1157('0x1a')]);}return _0x1d3677[_0x1157('0x4a')](_0x52715e);}})[_0x1157('0x3b')](function(_0x5a859a){if(_0x5a859a){return _0x5a859a?{'count':_0x3c1b14,'rows':_0x5a859a}:null;}})[_0x1157('0x3b')](respondWithResult(_0x304e59,null))[_0x1157('0x43')](handleError(_0x304e59,null));};exports[_0x1157('0x4b')]=function(_0x175b0d,_0x23dcfd,_0xafdc4b){var _0x543acc={};var _0x3cbfb2={};var _0x59890f;var _0x271e55;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x175b0d[_0x1157('0x41')]['id']}})[_0x1157('0x3b')](handleEntityNotFound(_0x23dcfd,null))[_0x1157('0x3b')](function(_0x52730a){if(_0x52730a){_0x59890f=_0x52730a;_0x3cbfb2[_0x1157('0x2c')]=_[_0x1157('0x2d')](db[_0x1157('0x4c')][_0x1157('0x29')]);_0x3cbfb2[_0x1157('0x2e')]=_['keys'](_0x175b0d[_0x1157('0x2e')]);_0x3cbfb2[_0x1157('0x37')]=_['intersection'](_0x3cbfb2[_0x1157('0x2c')],_0x3cbfb2['query']);_0x543acc[_0x1157('0x30')]=_['intersection'](_0x3cbfb2[_0x1157('0x2c')],qs['fields'](_0x175b0d['query'][_0x1157('0x31')]));_0x543acc[_0x1157('0x30')]=_0x543acc[_0x1157('0x30')][_0x1157('0x32')]?_0x543acc['attributes']:_0x3cbfb2[_0x1157('0x2c')];_0x543acc['order']=qs[_0x1157('0x35')](_0x175b0d[_0x1157('0x2e')][_0x1157('0x35')]);_0x543acc[_0x1157('0x36')]=qs[_0x1157('0x37')](_[_0x1157('0x38')](_0x175b0d[_0x1157('0x2e')],_0x3cbfb2[_0x1157('0x37')]));if(_0x175b0d[_0x1157('0x2e')][_0x1157('0x39')]){_0x543acc[_0x1157('0x36')]=_[_0x1157('0x42')](_0x543acc['where'],{'$or':_[_0x1157('0x27')](_0x543acc[_0x1157('0x30')],function(_0x32dc0a){var _0xfd0d7e={};_0xfd0d7e[_0x32dc0a]={'$like':'%'+_0x175b0d[_0x1157('0x2e')][_0x1157('0x39')]+'%'};return _0xfd0d7e;})});}_0x543acc=_[_0x1157('0x42')]({},_0x543acc,_0x175b0d[_0x1157('0x3a')]);return _0x59890f[_0x1157('0x4b')](_0x543acc);}})[_0x1157('0x3b')](function(_0x3498dd){if(_0x3498dd){_0x271e55=_0x3498dd[_0x1157('0x32')];if(!_0x175b0d[_0x1157('0x2e')][_0x1157('0x49')](_0x1157('0x33'))){_0x543acc[_0x1157('0x1c')]=qs['limit'](_0x175b0d['query']['limit']);_0x543acc[_0x1157('0x1a')]=qs[_0x1157('0x1a')](_0x175b0d['query']['offset']);}return _0x59890f[_0x1157('0x4b')](_0x543acc);}})[_0x1157('0x3b')](function(_0x3d0a94){if(_0x3d0a94){return _0x3d0a94?{'count':_0x271e55,'rows':_0x3d0a94}:null;}})[_0x1157('0x3b')](respondWithResult(_0x23dcfd,null))['catch'](handleError(_0x23dcfd,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b6007f5..deb393e 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 _0xceb0=['moment','request-promise','path','rimraf','exports','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0xceb0,0x173));var _0x0ceb=function(_0x46c471,_0x231d57){_0x46c471=_0x46c471-0x0;var _0x594c02=_0xceb0[_0x46c471];return _0x594c02;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0ceb('0x0'));var BPromise=require('bluebird');var rp=require(_0x0ceb('0x1'));var fs=require('fs');var path=require(_0x0ceb('0x2'));var rimraf=require(_0x0ceb('0x3'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0x0ceb('0x4')]=function(_0x218237,_0x3f650d){return _0x218237['define'](_0x0ceb('0x5'),attributes,{'tableName':_0x0ceb('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57c3=['path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','request-promise'];(function(_0x25f693,_0x314e3e){var _0x2fdd78=function(_0x167245){while(--_0x167245){_0x25f693['push'](_0x25f693['shift']());}};_0x2fdd78(++_0x314e3e);}(_0x57c3,0xc2));var _0x357c=function(_0x5d7375,_0x358589){_0x5d7375=_0x5d7375-0x0;var _0x3f0da4=_0x57c3[_0x5d7375];return _0x3f0da4;};'use strict';var _=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var logger=require(_0x357c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x357c('0x3'));var fs=require('fs');var path=require(_0x357c('0x4'));var rimraf=require(_0x357c('0x5'));var config=require(_0x357c('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x357c('0x7')]=function(_0x4ef0ce,_0x26c35d){return _0x4ef0ce[_0x357c('0x8')](_0x357c('0x9'),attributes,{'tableName':_0x357c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index eb1c670..9f99e0d 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 _0xf95f=['../../config/logger','../../config/environment','client','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0xf95f,0x142));var _0xff95=function(_0x188741,_0x243906){_0x188741=_0x188741-0x0;var _0x5e9290=_0xf95f[_0x188741];return _0x5e9290;};'use strict';var _=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var moment=require(_0xff95('0x2'));var BPromise=require(_0xff95('0x3'));var rs=require(_0xff95('0x4'));var fs=require('fs');var Redis=require(_0xff95('0x5'));var db=require(_0xff95('0x6'))['db'];var utils=require(_0xff95('0x7'));var logger=require(_0xff95('0x8'))('rpc');var config=require(_0xff95('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314fb4,_0x781e05,_0x2b9ce9){return new BPromise(function(_0x1a42b2,_0x198a51){return client[_0xff95('0xb')](_0x314fb4,_0x2b9ce9)[_0xff95('0xc')](function(_0xa2a50d){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x781e05,_0xff95('0xd'));logger[_0xff95('0xe')](_0xff95('0xf'),_0x781e05,_0xff95('0xd'),JSON[_0xff95('0x10')](_0xa2a50d));if(_0xa2a50d[_0xff95('0x11')]){if(_0xa2a50d[_0xff95('0x11')]['code']===0x1f4){logger['error'](_0xff95('0x12'),_0x781e05,_0xa2a50d[_0xff95('0x11')]['message']);return _0x198a51(_0xa2a50d[_0xff95('0x11')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x781e05,_0xa2a50d[_0xff95('0x11')][_0xff95('0x13')]);return _0x1a42b2(_0xa2a50d[_0xff95('0x11')][_0xff95('0x13')]);}else{logger[_0xff95('0x14')](_0xff95('0x12'),_0x781e05,'request\x20sent');_0x1a42b2(_0xa2a50d['result'][_0xff95('0x13')]);}})[_0xff95('0x15')](function(_0x83e644){logger[_0xff95('0x11')](_0xff95('0x12'),_0x781e05,_0x83e644);_0x198a51(_0x83e644);});});} \ No newline at end of file +var _0x11d1=['then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1355d6,_0x23a0fd){var _0x25f058=function(_0x4d05e7){while(--_0x4d05e7){_0x1355d6['push'](_0x1355d6['shift']());}};_0x25f058(++_0x23a0fd);}(_0x11d1,0x184));var _0x111d=function(_0x28ac29,_0x1498a9){_0x28ac29=_0x28ac29-0x0;var _0x22a330=_0x11d1[_0x28ac29];return _0x22a330;};'use strict';var _=require(_0x111d('0x0'));var util=require('util');var moment=require(_0x111d('0x1'));var BPromise=require(_0x111d('0x2'));var rs=require(_0x111d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x111d('0x4'))['db'];var utils=require(_0x111d('0x5'));var logger=require(_0x111d('0x6'))('rpc');var config=require(_0x111d('0x7'));var jayson=require(_0x111d('0x8'));var client=jayson[_0x111d('0x9')][_0x111d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12b249,_0x497138,_0x4af8b4){return new BPromise(function(_0x1ba64c,_0xdf4197){return client['request'](_0x12b249,_0x4af8b4)[_0x111d('0xb')](function(_0xe864cf){logger['info'](_0x111d('0xc'),_0x497138,_0x111d('0xd'));logger[_0x111d('0xe')](_0x111d('0xf'),_0x497138,_0x111d('0xd'),JSON[_0x111d('0x10')](_0xe864cf));if(_0xe864cf[_0x111d('0x11')]){if(_0xe864cf[_0x111d('0x11')]['code']===0x1f4){logger[_0x111d('0x11')](_0x111d('0xc'),_0x497138,_0xe864cf[_0x111d('0x11')]['message']);return _0xdf4197(_0xe864cf['error'][_0x111d('0x12')]);}logger[_0x111d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497138,_0xe864cf['error'][_0x111d('0x12')]);return _0x1ba64c(_0xe864cf[_0x111d('0x11')]['message']);}else{logger['info'](_0x111d('0xc'),_0x497138,'request\x20sent');_0x1ba64c(_0xe864cf[_0x111d('0x13')]['message']);}})[_0x111d('0x14')](function(_0x38b393){logger[_0x111d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497138,_0x38b393);_0xdf4197(_0x38b393);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5fdda49..ba605da 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 _0xd934=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete'];(function(_0x43ee39,_0x4eeed6){var _0x1f7f2f=function(_0x5d338f){while(--_0x5d338f){_0x43ee39['push'](_0x43ee39['shift']());}};_0x1f7f2f(++_0x4eeed6);}(_0xd934,0xd3));var _0x4d93=function(_0x6d51f1,_0x18a489){_0x6d51f1=_0x6d51f1-0x0;var _0x36d899=_0xd934[_0x6d51f1];return _0x36d899;};'use strict';var multer=require(_0x4d93('0x0'));var util=require(_0x4d93('0x1'));var path=require(_0x4d93('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d93('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d93('0x4'));var interaction=require(_0x4d93('0x5'));var config=require(_0x4d93('0x6'));var controller=require(_0x4d93('0x7'));router[_0x4d93('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d93('0x9')]);router[_0x4d93('0x8')](_0x4d93('0xa'),auth['isAuthenticated'](),controller[_0x4d93('0xb')]);router[_0x4d93('0xc')]('/',auth[_0x4d93('0xd')](),controller[_0x4d93('0xe')]);router['put'](_0x4d93('0xa'),auth[_0x4d93('0xd')](),controller[_0x4d93('0xf')]);router[_0x4d93('0x10')](_0x4d93('0xa'),auth['isAuthenticated'](),controller[_0x4d93('0x11')]);module[_0x4d93('0x12')]=router; \ No newline at end of file +var _0xeb71=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x51abe7,_0x2a933f){var _0x5c409d=function(_0x28e570){while(--_0x28e570){_0x51abe7['push'](_0x51abe7['shift']());}};_0x5c409d(++_0x2a933f);}(_0xeb71,0x6c));var _0x1eb7=function(_0x2c99e9,_0x51940d){_0x2c99e9=_0x2c99e9-0x0;var _0x4f621e=_0xeb71[_0x2c99e9];return _0x4f621e;};'use strict';var multer=require(_0x1eb7('0x0'));var util=require(_0x1eb7('0x1'));var path=require(_0x1eb7('0x2'));var timeout=require(_0x1eb7('0x3'));var express=require(_0x1eb7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1eb7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1eb7('0x6'));var controller=require('./intServicenowField.controller');router[_0x1eb7('0x7')]('/',auth['isAuthenticated'](),controller[_0x1eb7('0x8')]);router[_0x1eb7('0x7')]('/:id',auth[_0x1eb7('0x9')](),controller['show']);router[_0x1eb7('0xa')]('/',auth['isAuthenticated'](),controller[_0x1eb7('0xb')]);router[_0x1eb7('0xc')](_0x1eb7('0xd'),auth[_0x1eb7('0x9')](),controller[_0x1eb7('0xe')]);router[_0x1eb7('0xf')](_0x1eb7('0xd'),auth['isAuthenticated'](),controller[_0x1eb7('0x10')]);module[_0x1eb7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3883261..8f500f7 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 _0xb097=['ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xb097,0x12e));var _0x7b09=function(_0x4e9043,_0x2be7e4){_0x4e9043=_0x4e9043-0x0;var _0x91490f=_0xb097[_0x4e9043];return _0x91490f;};'use strict';var Sequelize=require(_0x7b09('0x0'));module[_0x7b09('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x7b09('0x2'),_0x7b09('0x3'),_0x7b09('0x4'),_0x7b09('0x5')),'defaultValue':_0x7b09('0x6')},'content':{'type':Sequelize[_0x7b09('0x7')]},'key':{'type':Sequelize[_0x7b09('0x7')]},'keyType':{'type':Sequelize[_0x7b09('0x8')](_0x7b09('0x6'),_0x7b09('0x2'),_0x7b09('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7b09('0x7')]},'customField':{'type':Sequelize[_0x7b09('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7b09('0x7')]}}; \ No newline at end of file +var _0x0725=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x46ae87,_0x4bd053){var _0x303fcc=function(_0xf522b9){while(--_0xf522b9){_0x46ae87['push'](_0x46ae87['shift']());}};_0x303fcc(++_0x4bd053);}(_0x0725,0xf5));var _0x5072=function(_0x119c65,_0x33e2ad){_0x119c65=_0x119c65-0x0;var _0x3c2903=_0x0725[_0x119c65];return _0x3c2903;};'use strict';var Sequelize=require(_0x5072('0x0'));module['exports']={'type':{'type':Sequelize[_0x5072('0x1')](_0x5072('0x2'),_0x5072('0x3'),_0x5072('0x4'),'keyValue',_0x5072('0x5')),'defaultValue':_0x5072('0x2')},'content':{'type':Sequelize[_0x5072('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5072('0x1')]('string',_0x5072('0x3'),_0x5072('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5072('0x6')]},'nameField':{'type':Sequelize[_0x5072('0x6')]},'customField':{'type':Sequelize[_0x5072('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 59504ee..4865425 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 _0xdb17=['nolimit','order','sort','where','filter','merge','VIRTUAL','rows','catch','show','includeAll','include','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length'];(function(_0x3d7cb0,_0x15551e){var _0x4c4a0a=function(_0x520055){while(--_0x520055){_0x3d7cb0['push'](_0x3d7cb0['shift']());}};_0x4c4a0a(++_0x15551e);}(_0xdb17,0x145));var _0x7db1=function(_0x5eb6cc,_0x345385){_0x5eb6cc=_0x5eb6cc-0x0;var _0x3aac0d=_0xdb17[_0x5eb6cc];return _0x3aac0d;};'use strict';var emlformat=require(_0x7db1('0x0'));var rimraf=require(_0x7db1('0x1'));var zipdir=require(_0x7db1('0x2'));var jsonpatch=require(_0x7db1('0x3'));var rp=require(_0x7db1('0x4'));var moment=require(_0x7db1('0x5'));var BPromise=require(_0x7db1('0x6'));var Mustache=require(_0x7db1('0x7'));var util=require(_0x7db1('0x8'));var path=require(_0x7db1('0x9'));var sox=require(_0x7db1('0xa'));var csv=require(_0x7db1('0xb'));var ejs=require(_0x7db1('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7db1('0xd'));var squel=require(_0x7db1('0xe'));var crypto=require('crypto');var jsforce=require(_0x7db1('0xf'));var deskjs=require(_0x7db1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7db1('0x11'));var Papa=require(_0x7db1('0x12'));var Redis=require(_0x7db1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7db1('0x14'));var as=require(_0x7db1('0x15'));var hardwareService=require(_0x7db1('0x16'));var logger=require(_0x7db1('0x17'))(_0x7db1('0x18'));var utils=require(_0x7db1('0x19'));var config=require(_0x7db1('0x1a'));var licenseUtil=require(_0x7db1('0x1b'));var db=require(_0x7db1('0x1c'))['db'];function respondWithStatusCode(_0x3e0062,_0xa8114f){_0xa8114f=_0xa8114f||0xcc;return function(_0x9ceb6){if(_0x9ceb6){return _0x3e0062[_0x7db1('0x1d')](_0xa8114f);}return _0x3e0062[_0x7db1('0x1e')](_0xa8114f)['end']();};}function respondWithResult(_0x3d7183,_0xd1ee28){_0xd1ee28=_0xd1ee28||0xc8;return function(_0x45c005){if(_0x45c005){return _0x3d7183[_0x7db1('0x1e')](_0xd1ee28)['json'](_0x45c005);}};}function respondWithFilteredResult(_0x4efe1b,_0x3d2aa0){return function(_0xd0bc18){if(_0xd0bc18){var _0x519cff=typeof _0x3d2aa0[_0x7db1('0x1f')]===_0x7db1('0x20')&&typeof _0x3d2aa0[_0x7db1('0x21')]===_0x7db1('0x20');var _0x83c7b9=_0xd0bc18[_0x7db1('0x22')];var _0x4dc1f8=_0x519cff?0x0:_0x3d2aa0[_0x7db1('0x1f')];var _0x7058b4=_0x519cff?_0xd0bc18['count']:_0x3d2aa0[_0x7db1('0x1f')]+_0x3d2aa0[_0x7db1('0x21')];var _0x1d70b4;if(_0x7058b4>=_0x83c7b9){_0x7058b4=_0x83c7b9;_0x1d70b4=0xc8;}else{_0x1d70b4=0xce;}_0x4efe1b[_0x7db1('0x1e')](_0x1d70b4);return _0x4efe1b['set'](_0x7db1('0x23'),_0x4dc1f8+'-'+_0x7058b4+'/'+_0x83c7b9)[_0x7db1('0x24')](_0xd0bc18);}return null;};}function patchUpdates(_0x24bb28){return function(_0x3b0da7){try{jsonpatch[_0x7db1('0x25')](_0x3b0da7,_0x24bb28,!![]);}catch(_0x545d88){return BPromise[_0x7db1('0x26')](_0x545d88);}return _0x3b0da7[_0x7db1('0x27')]();};}function saveUpdates(_0x4a6fb3,_0x3f5f5e){return function(_0x29ad35){if(_0x29ad35){return _0x29ad35[_0x7db1('0x28')](_0x4a6fb3)[_0x7db1('0x29')](function(_0xb7d1ba){return _0xb7d1ba;});}return null;};}function removeEntity(_0x2c53cf,_0x3ee410){return function(_0x41b73f){if(_0x41b73f){return _0x41b73f[_0x7db1('0x2a')]()['then'](function(){_0x2c53cf[_0x7db1('0x1e')](0xcc)[_0x7db1('0x2b')]();});}};}function handleEntityNotFound(_0x1a4818,_0x5464ef){return function(_0x49e191){if(!_0x49e191){_0x1a4818['sendStatus'](0x194);}return _0x49e191;};}function handleError(_0x4045b0,_0x533eb2){_0x533eb2=_0x533eb2||0x1f4;return function(_0x1410c3){logger['error'](_0x1410c3[_0x7db1('0x2c')]);if(_0x1410c3['name']){delete _0x1410c3[_0x7db1('0x2d')];}_0x4045b0[_0x7db1('0x1e')](_0x533eb2)['send'](_0x1410c3);};}exports['index']=function(_0x3afebf,_0x15f4c9){var _0x4fb89f={},_0x1e5e7c={},_0x14f32b={'count':0x0,'rows':[]};var _0x5b8604=_['map'](db[_0x7db1('0x2e')][_0x7db1('0x2f')],function(_0x55057e){return{'name':_0x55057e[_0x7db1('0x30')],'type':_0x55057e[_0x7db1('0x31')][_0x7db1('0x32')]};});_0x1e5e7c[_0x7db1('0x33')]=_[_0x7db1('0x34')](_0x5b8604,_0x7db1('0x2d'));_0x1e5e7c[_0x7db1('0x35')]=_[_0x7db1('0x36')](_0x3afebf[_0x7db1('0x35')]);_0x1e5e7c[_0x7db1('0x37')]=_['intersection'](_0x1e5e7c['model'],_0x1e5e7c['query']);_0x4fb89f[_0x7db1('0x38')]=_[_0x7db1('0x39')](_0x1e5e7c['model'],qs[_0x7db1('0x3a')](_0x3afebf[_0x7db1('0x35')]['fields']));_0x4fb89f[_0x7db1('0x38')]=_0x4fb89f[_0x7db1('0x38')][_0x7db1('0x3b')]?_0x4fb89f[_0x7db1('0x38')]:_0x1e5e7c[_0x7db1('0x33')];if(!_0x3afebf[_0x7db1('0x35')]['hasOwnProperty'](_0x7db1('0x3c'))){_0x4fb89f[_0x7db1('0x21')]=qs['limit'](_0x3afebf[_0x7db1('0x35')][_0x7db1('0x21')]);_0x4fb89f[_0x7db1('0x1f')]=qs[_0x7db1('0x1f')](_0x3afebf[_0x7db1('0x35')]['offset']);}_0x4fb89f[_0x7db1('0x3d')]=qs[_0x7db1('0x3e')](_0x3afebf[_0x7db1('0x35')]['sort']);_0x4fb89f[_0x7db1('0x3f')]=qs['filters'](_['pick'](_0x3afebf[_0x7db1('0x35')],_0x1e5e7c[_0x7db1('0x37')]),_0x5b8604);if(_0x3afebf[_0x7db1('0x35')][_0x7db1('0x40')]){_0x4fb89f[_0x7db1('0x3f')]=_[_0x7db1('0x41')](_0x4fb89f['where'],{'$or':_[_0x7db1('0x34')](_0x5b8604,function(_0x54fe6d){if(_0x54fe6d['type']!==_0x7db1('0x42')){var _0x2ff58d={};_0x2ff58d[_0x54fe6d['name']]={'$like':'%'+_0x3afebf[_0x7db1('0x35')][_0x7db1('0x40')]+'%'};return _0x2ff58d;}})});}_0x4fb89f=_[_0x7db1('0x41')]({},_0x4fb89f,_0x3afebf['options']);var _0x2533b9={'where':_0x4fb89f[_0x7db1('0x3f')]};return db[_0x7db1('0x2e')]['count'](_0x2533b9)[_0x7db1('0x29')](function(_0x11af45){_0x14f32b[_0x7db1('0x22')]=_0x11af45;if(_0x3afebf[_0x7db1('0x35')]['includeAll']){_0x4fb89f['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x4fb89f);})[_0x7db1('0x29')](function(_0x159980){_0x14f32b[_0x7db1('0x43')]=_0x159980;return _0x14f32b;})['then'](respondWithFilteredResult(_0x15f4c9,_0x4fb89f))[_0x7db1('0x44')](handleError(_0x15f4c9,null));};exports[_0x7db1('0x45')]=function(_0x1d7efd,_0x2c9be6){var _0x18a5a3={'raw':!![],'where':{'id':_0x1d7efd['params']['id']}},_0x23a9f6={};_0x23a9f6[_0x7db1('0x33')]=_[_0x7db1('0x36')](db[_0x7db1('0x2e')]['rawAttributes']);_0x23a9f6[_0x7db1('0x35')]=_[_0x7db1('0x36')](_0x1d7efd[_0x7db1('0x35')]);_0x23a9f6[_0x7db1('0x37')]=_[_0x7db1('0x39')](_0x23a9f6[_0x7db1('0x33')],_0x23a9f6[_0x7db1('0x35')]);_0x18a5a3[_0x7db1('0x38')]=_[_0x7db1('0x39')](_0x23a9f6['model'],qs['fields'](_0x1d7efd[_0x7db1('0x35')][_0x7db1('0x3a')]));_0x18a5a3[_0x7db1('0x38')]=_0x18a5a3[_0x7db1('0x38')][_0x7db1('0x3b')]?_0x18a5a3['attributes']:_0x23a9f6['model'];if(_0x1d7efd[_0x7db1('0x35')][_0x7db1('0x46')]){_0x18a5a3[_0x7db1('0x47')]=[{'all':!![]}];}_0x18a5a3=_[_0x7db1('0x41')]({},_0x18a5a3,_0x1d7efd[_0x7db1('0x48')]);return db[_0x7db1('0x2e')][_0x7db1('0x49')](_0x18a5a3)[_0x7db1('0x29')](handleEntityNotFound(_0x2c9be6,null))['then'](respondWithResult(_0x2c9be6,null))[_0x7db1('0x44')](handleError(_0x2c9be6,null));};exports[_0x7db1('0x4a')]=function(_0x317545,_0x47e028){return db[_0x7db1('0x2e')][_0x7db1('0x4a')](_0x317545['body'],{})[_0x7db1('0x29')](respondWithResult(_0x47e028,0xc9))[_0x7db1('0x44')](handleError(_0x47e028,null));};exports[_0x7db1('0x28')]=function(_0x1804f3,_0x14579a){if(_0x1804f3[_0x7db1('0x4b')]['id']){delete _0x1804f3['body']['id'];}return db[_0x7db1('0x2e')][_0x7db1('0x49')]({'where':{'id':_0x1804f3[_0x7db1('0x4c')]['id']}})[_0x7db1('0x29')](handleEntityNotFound(_0x14579a,null))[_0x7db1('0x29')](saveUpdates(_0x1804f3['body'],null))[_0x7db1('0x29')](respondWithResult(_0x14579a,null))[_0x7db1('0x44')](handleError(_0x14579a,null));};exports[_0x7db1('0x2a')]=function(_0x3e198b,_0x2fe459){return db[_0x7db1('0x2e')][_0x7db1('0x49')]({'where':{'id':_0x3e198b[_0x7db1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2fe459,null))[_0x7db1('0x29')](removeEntity(_0x2fe459,null))[_0x7db1('0x44')](handleError(_0x2fe459,null));}; \ No newline at end of file +var _0x944f=['fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','ServicenowField','findAll','catch','params','length','create','body','find','eml-format','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x477e17,_0x2f1dd1){var _0x603934=function(_0x19e49f){while(--_0x19e49f){_0x477e17['push'](_0x477e17['shift']());}};_0x603934(++_0x2f1dd1);}(_0x944f,0x65));var _0xf944=function(_0x48c9fe,_0x4f32c9){_0x48c9fe=_0x48c9fe-0x0;var _0xa3ed1c=_0x944f[_0x48c9fe];return _0xa3ed1c;};'use strict';var emlformat=require(_0xf944('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf944('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf944('0x2'));var BPromise=require(_0xf944('0x3'));var Mustache=require(_0xf944('0x4'));var util=require('util');var path=require(_0xf944('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf944('0x6'));var fs=require('fs');var fs_extra=require(_0xf944('0x7'));var _=require(_0xf944('0x8'));var squel=require(_0xf944('0x9'));var crypto=require(_0xf944('0xa'));var jsforce=require(_0xf944('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf944('0xc'));var querystring=require('querystring');var Papa=require(_0xf944('0xd'));var Redis=require(_0xf944('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf944('0xf'));var hardwareService=require(_0xf944('0x10'));var logger=require(_0xf944('0x11'))(_0xf944('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf944('0x13'))['db'];function respondWithStatusCode(_0x20878a,_0x5959ba){_0x5959ba=_0x5959ba||0xcc;return function(_0x3bd61c){if(_0x3bd61c){return _0x20878a[_0xf944('0x14')](_0x5959ba);}return _0x20878a['status'](_0x5959ba)[_0xf944('0x15')]();};}function respondWithResult(_0x397aa2,_0x206874){_0x206874=_0x206874||0xc8;return function(_0x50c435){if(_0x50c435){return _0x397aa2[_0xf944('0x16')](_0x206874)[_0xf944('0x17')](_0x50c435);}};}function respondWithFilteredResult(_0xec03ca,_0x3cb6e6){return function(_0x3911ff){if(_0x3911ff){var _0x55952e=typeof _0x3cb6e6['offset']===_0xf944('0x18')&&typeof _0x3cb6e6[_0xf944('0x19')]==='undefined';var _0x4bb8dc=_0x3911ff['count'];var _0x5b3d75=_0x55952e?0x0:_0x3cb6e6[_0xf944('0x1a')];var _0x38ec7b=_0x55952e?_0x3911ff[_0xf944('0x1b')]:_0x3cb6e6[_0xf944('0x1a')]+_0x3cb6e6[_0xf944('0x19')];var _0x4c9c3c;if(_0x38ec7b>=_0x4bb8dc){_0x38ec7b=_0x4bb8dc;_0x4c9c3c=0xc8;}else{_0x4c9c3c=0xce;}_0xec03ca[_0xf944('0x16')](_0x4c9c3c);return _0xec03ca[_0xf944('0x1c')]('Content-Range',_0x5b3d75+'-'+_0x38ec7b+'/'+_0x4bb8dc)[_0xf944('0x17')](_0x3911ff);}return null;};}function patchUpdates(_0xe7ff24){return function(_0x45d490){try{jsonpatch[_0xf944('0x1d')](_0x45d490,_0xe7ff24,!![]);}catch(_0x4331b9){return BPromise[_0xf944('0x1e')](_0x4331b9);}return _0x45d490['save']();};}function saveUpdates(_0x52371e,_0x22a50a){return function(_0x13caff){if(_0x13caff){return _0x13caff[_0xf944('0x1f')](_0x52371e)[_0xf944('0x20')](function(_0x4489d4){return _0x4489d4;});}return null;};}function removeEntity(_0x546a73,_0xa58312){return function(_0x750327){if(_0x750327){return _0x750327[_0xf944('0x21')]()[_0xf944('0x20')](function(){_0x546a73[_0xf944('0x16')](0xcc)[_0xf944('0x15')]();});}};}function handleEntityNotFound(_0x1babf5,_0x4a1866){return function(_0x40f441){if(!_0x40f441){_0x1babf5[_0xf944('0x14')](0x194);}return _0x40f441;};}function handleError(_0x4d0b63,_0x1a89c1){_0x1a89c1=_0x1a89c1||0x1f4;return function(_0x28d247){logger[_0xf944('0x22')](_0x28d247[_0xf944('0x23')]);if(_0x28d247[_0xf944('0x24')]){delete _0x28d247[_0xf944('0x24')];}_0x4d0b63[_0xf944('0x16')](_0x1a89c1)[_0xf944('0x25')](_0x28d247);};}exports[_0xf944('0x26')]=function(_0x513ccd,_0x9b9b52){var _0x544bee={},_0x320f98={},_0xda413f={'count':0x0,'rows':[]};var _0x24a936=_[_0xf944('0x27')](db['ServicenowField'][_0xf944('0x28')],function(_0x3b8bde){return{'name':_0x3b8bde[_0xf944('0x29')],'type':_0x3b8bde[_0xf944('0x2a')][_0xf944('0x2b')]};});_0x320f98['model']=_['map'](_0x24a936,_0xf944('0x24'));_0x320f98[_0xf944('0x2c')]=_[_0xf944('0x2d')](_0x513ccd[_0xf944('0x2c')]);_0x320f98['filters']=_[_0xf944('0x2e')](_0x320f98['model'],_0x320f98[_0xf944('0x2c')]);_0x544bee[_0xf944('0x2f')]=_[_0xf944('0x2e')](_0x320f98[_0xf944('0x30')],qs[_0xf944('0x31')](_0x513ccd[_0xf944('0x2c')][_0xf944('0x31')]));_0x544bee[_0xf944('0x2f')]=_0x544bee['attributes']['length']?_0x544bee[_0xf944('0x2f')]:_0x320f98[_0xf944('0x30')];if(!_0x513ccd[_0xf944('0x2c')][_0xf944('0x32')](_0xf944('0x33'))){_0x544bee['limit']=qs[_0xf944('0x19')](_0x513ccd[_0xf944('0x2c')][_0xf944('0x19')]);_0x544bee[_0xf944('0x1a')]=qs[_0xf944('0x1a')](_0x513ccd[_0xf944('0x2c')][_0xf944('0x1a')]);}_0x544bee[_0xf944('0x34')]=qs[_0xf944('0x35')](_0x513ccd[_0xf944('0x2c')]['sort']);_0x544bee[_0xf944('0x36')]=qs[_0xf944('0x37')](_[_0xf944('0x38')](_0x513ccd[_0xf944('0x2c')],_0x320f98['filters']),_0x24a936);if(_0x513ccd[_0xf944('0x2c')][_0xf944('0x39')]){_0x544bee['where']=_['merge'](_0x544bee[_0xf944('0x36')],{'$or':_[_0xf944('0x27')](_0x24a936,function(_0x5c0afe){if(_0x5c0afe[_0xf944('0x2a')]!==_0xf944('0x3a')){var _0x23b3c5={};_0x23b3c5[_0x5c0afe[_0xf944('0x24')]]={'$like':'%'+_0x513ccd[_0xf944('0x2c')][_0xf944('0x39')]+'%'};return _0x23b3c5;}})});}_0x544bee=_[_0xf944('0x3b')]({},_0x544bee,_0x513ccd[_0xf944('0x3c')]);var _0x294d43={'where':_0x544bee[_0xf944('0x36')]};return db['ServicenowField'][_0xf944('0x1b')](_0x294d43)[_0xf944('0x20')](function(_0x4b30fa){_0xda413f[_0xf944('0x1b')]=_0x4b30fa;if(_0x513ccd[_0xf944('0x2c')][_0xf944('0x3d')]){_0x544bee[_0xf944('0x3e')]=[{'all':!![]}];}return db[_0xf944('0x3f')][_0xf944('0x40')](_0x544bee);})[_0xf944('0x20')](function(_0x11bbdb){_0xda413f['rows']=_0x11bbdb;return _0xda413f;})[_0xf944('0x20')](respondWithFilteredResult(_0x9b9b52,_0x544bee))[_0xf944('0x41')](handleError(_0x9b9b52,null));};exports['show']=function(_0x146b6a,_0x238bbe){var _0x37aa2b={'raw':!![],'where':{'id':_0x146b6a[_0xf944('0x42')]['id']}},_0xff7428={};_0xff7428[_0xf944('0x30')]=_[_0xf944('0x2d')](db[_0xf944('0x3f')][_0xf944('0x28')]);_0xff7428['query']=_[_0xf944('0x2d')](_0x146b6a[_0xf944('0x2c')]);_0xff7428[_0xf944('0x37')]=_[_0xf944('0x2e')](_0xff7428[_0xf944('0x30')],_0xff7428[_0xf944('0x2c')]);_0x37aa2b[_0xf944('0x2f')]=_[_0xf944('0x2e')](_0xff7428[_0xf944('0x30')],qs[_0xf944('0x31')](_0x146b6a[_0xf944('0x2c')]['fields']));_0x37aa2b[_0xf944('0x2f')]=_0x37aa2b[_0xf944('0x2f')][_0xf944('0x43')]?_0x37aa2b[_0xf944('0x2f')]:_0xff7428[_0xf944('0x30')];if(_0x146b6a[_0xf944('0x2c')][_0xf944('0x3d')]){_0x37aa2b[_0xf944('0x3e')]=[{'all':!![]}];}_0x37aa2b=_[_0xf944('0x3b')]({},_0x37aa2b,_0x146b6a[_0xf944('0x3c')]);return db[_0xf944('0x3f')]['find'](_0x37aa2b)[_0xf944('0x20')](handleEntityNotFound(_0x238bbe,null))[_0xf944('0x20')](respondWithResult(_0x238bbe,null))['catch'](handleError(_0x238bbe,null));};exports['create']=function(_0x3bbe0d,_0x3f29a3){return db[_0xf944('0x3f')][_0xf944('0x44')](_0x3bbe0d['body'],{})['then'](respondWithResult(_0x3f29a3,0xc9))[_0xf944('0x41')](handleError(_0x3f29a3,null));};exports[_0xf944('0x1f')]=function(_0x4ef76a,_0x1c7f10){if(_0x4ef76a[_0xf944('0x45')]['id']){delete _0x4ef76a[_0xf944('0x45')]['id'];}return db['ServicenowField'][_0xf944('0x46')]({'where':{'id':_0x4ef76a[_0xf944('0x42')]['id']}})[_0xf944('0x20')](handleEntityNotFound(_0x1c7f10,null))[_0xf944('0x20')](saveUpdates(_0x4ef76a['body'],null))[_0xf944('0x20')](respondWithResult(_0x1c7f10,null))[_0xf944('0x41')](handleError(_0x1c7f10,null));};exports['destroy']=function(_0x455785,_0x23583d){return db[_0xf944('0x3f')]['find']({'where':{'id':_0x455785['params']['id']}})[_0xf944('0x20')](handleEntityNotFound(_0x23583d,null))[_0xf944('0x20')](removeEntity(_0x23583d,null))['catch'](handleError(_0x23583d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index abfcf7c..74feaf0 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 _0xb783=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','util','../../config/logger','api','moment'];(function(_0x595d91,_0x2b440e){var _0x1540db=function(_0x3accaa){while(--_0x3accaa){_0x595d91['push'](_0x595d91['shift']());}};_0x1540db(++_0x2b440e);}(_0xb783,0xc0));var _0x3b78=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb783[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x3b78('0x0'));var logger=require(_0x3b78('0x1'))(_0x3b78('0x2'));var moment=require(_0x3b78('0x3'));var BPromise=require(_0x3b78('0x4'));var rp=require(_0x3b78('0x5'));var fs=require('fs');var path=require(_0x3b78('0x6'));var rimraf=require(_0x3b78('0x7'));var config=require(_0x3b78('0x8'));var attributes=require(_0x3b78('0x9'));module[_0x3b78('0xa')]=function(_0x46ed60,_0x3ea4e5){return _0x46ed60[_0x3b78('0xb')]('ServicenowField',attributes,{'tableName':_0x3b78('0xc'),'paranoid':![],'indexes':[{'name':_0x3b78('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea2a=['bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','define','idField','FieldId','util','../../config/logger'];(function(_0x5af934,_0x54e1d2){var _0x26a09e=function(_0x5c1a14){while(--_0x5c1a14){_0x5af934['push'](_0x5af934['shift']());}};_0x26a09e(++_0x54e1d2);}(_0xea2a,0xbc));var _0xaea2=function(_0x366441,_0x39efc4){_0x366441=_0x366441-0x0;var _0x152826=_0xea2a[_0x366441];return _0x152826;};'use strict';var _=require('lodash');var util=require(_0xaea2('0x0'));var logger=require(_0xaea2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xaea2('0x2'));var rp=require(_0xaea2('0x3'));var fs=require('fs');var path=require(_0xaea2('0x4'));var rimraf=require('rimraf');var config=require(_0xaea2('0x5'));var attributes=require(_0xaea2('0x6'));module['exports']=function(_0x56c264,_0x3fca24){return _0x56c264[_0xaea2('0x7')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xaea2('0x8'),_0xaea2('0x9')],'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 7fb4a4e..c4e9c76 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x153e7d,_0x10a35f){var _0x3c22dd=function(_0x4d33f6){while(--_0x4d33f6){_0x153e7d['push'](_0x153e7d['shift']());}};_0x3c22dd(++_0x10a35f);}(_0xda3f,0xec));var _0xfda3=function(_0x1ae698,_0x26d039){_0x1ae698=_0x1ae698-0x0;var _0x3f77fd=_0xda3f[_0x1ae698];return _0x3f77fd;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5d3a27,_0x4d283a){var _0x9f99d2=function(_0x5d2844){while(--_0x5d2844){_0x5d3a27['push'](_0x5d3a27['shift']());}};_0x9f99d2(++_0x4d283a);}(_0xaa88,0x137));var _0x8aa8=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0xaa88[_0x2d4661];return _0x42ed1e;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 718ba9c..a894073 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2c115f,_0x2c7039){var _0x4b25ea=function(_0x41a9fb){while(--_0x41a9fb){_0x2c115f['push'](_0x2c115f['shift']());}};_0x4b25ea(++_0x2c7039);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 _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(_0x2a3c72,_0x347aca){var _0x3cf37f=function(_0x424b78){while(--_0x424b78){_0x2a3c72['push'](_0x2a3c72['shift']());}};_0x3cf37f(++_0x347aca);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index eccd41b..0a7e0ef 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(_0x2c6acd,_0x570abf){var _0x239938=function(_0xe3039){while(--_0xe3039){_0x2c6acd['push'](_0x2c6acd['shift']());}};_0x239938(++_0x570abf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x1e652c,_0x4b1f84){var _0x270b2c=function(_0x47a166){while(--_0x47a166){_0x1e652c['push'](_0x1e652c['shift']());}};_0x270b2c(++_0x4b1f84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 51014e0..4c31ea6 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 _0x4796=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','destroy','getConfigurations','SugarcrmConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','Calls','module_fields','remove','includes','label','endsWith','values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x4796,0x17c));var _0x6479=function(_0x34b4f1,_0x542b67){_0x34b4f1=_0x34b4f1-0x0;var _0xd0e4c0=_0x4796[_0x34b4f1];return _0xd0e4c0;};'use strict';var emlformat=require(_0x6479('0x0'));var rimraf=require(_0x6479('0x1'));var zipdir=require(_0x6479('0x2'));var jsonpatch=require(_0x6479('0x3'));var rp=require(_0x6479('0x4'));var moment=require(_0x6479('0x5'));var BPromise=require(_0x6479('0x6'));var Mustache=require(_0x6479('0x7'));var util=require('util');var path=require(_0x6479('0x8'));var sox=require(_0x6479('0x9'));var csv=require(_0x6479('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6479('0xb'));var _=require(_0x6479('0xc'));var squel=require(_0x6479('0xd'));var crypto=require(_0x6479('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6479('0xa'));var querystring=require(_0x6479('0xf'));var Papa=require(_0x6479('0x10'));var Redis=require(_0x6479('0x11'));var authService=require(_0x6479('0x12'));var qs=require(_0x6479('0x13'));var as=require(_0x6479('0x14'));var hardwareService=require(_0x6479('0x15'));var logger=require(_0x6479('0x16'))('api');var utils=require(_0x6479('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6479('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6479('0x19'));function respondWithStatusCode(_0x3be5fb,_0x34a7b4){_0x34a7b4=_0x34a7b4||0xcc;return function(_0x543802){if(_0x543802){return _0x3be5fb[_0x6479('0x1a')](_0x34a7b4);}return _0x3be5fb[_0x6479('0x1b')](_0x34a7b4)[_0x6479('0x1c')]();};}function respondWithResult(_0x107a62,_0x34f63b){_0x34f63b=_0x34f63b||0xc8;return function(_0x16f925){if(_0x16f925){return _0x107a62[_0x6479('0x1b')](_0x34f63b)['json'](_0x16f925);}};}function respondWithFilteredResult(_0x316888,_0x2060ed){return function(_0x1c8530){if(_0x1c8530){var _0x2fb837=typeof _0x2060ed[_0x6479('0x1d')]==='undefined'&&typeof _0x2060ed[_0x6479('0x1e')]===_0x6479('0x1f');var _0x4dde9e=_0x1c8530[_0x6479('0x20')];var _0x2ae112=_0x2fb837?0x0:_0x2060ed[_0x6479('0x1d')];var _0x49e01f=_0x2fb837?_0x1c8530['count']:_0x2060ed[_0x6479('0x1d')]+_0x2060ed[_0x6479('0x1e')];var _0x4e33e3;if(_0x49e01f>=_0x4dde9e){_0x49e01f=_0x4dde9e;_0x4e33e3=0xc8;}else{_0x4e33e3=0xce;}_0x316888['status'](_0x4e33e3);return _0x316888[_0x6479('0x21')](_0x6479('0x22'),_0x2ae112+'-'+_0x49e01f+'/'+_0x4dde9e)[_0x6479('0x23')](_0x1c8530);}return null;};}function patchUpdates(_0x340f8f){return function(_0xa63940){try{jsonpatch[_0x6479('0x24')](_0xa63940,_0x340f8f,!![]);}catch(_0x2d1cfc){return BPromise[_0x6479('0x25')](_0x2d1cfc);}return _0xa63940[_0x6479('0x26')]();};}function saveUpdates(_0x1b4212,_0x540b19){return function(_0x21d90b){if(_0x21d90b){return _0x21d90b[_0x6479('0x27')](_0x1b4212)[_0x6479('0x28')](function(_0x45b7ff){return _0x45b7ff;});}return null;};}function removeEntity(_0x2fea21,_0x4cd885){return function(_0x538db2){if(_0x538db2){return _0x538db2['destroy']()[_0x6479('0x28')](function(){_0x2fea21[_0x6479('0x1b')](0xcc)[_0x6479('0x1c')]();});}};}function handleEntityNotFound(_0x41b7c5,_0x1e95b6){return function(_0x4591b2){if(!_0x4591b2){_0x41b7c5[_0x6479('0x1a')](0x194);}return _0x4591b2;};}function handleError(_0xdf68ac,_0x5856ac){_0x5856ac=_0x5856ac||0x1f4;return function(_0x4b9b53){logger[_0x6479('0x29')](_0x4b9b53[_0x6479('0x2a')]);if(_0x4b9b53[_0x6479('0x2b')]){delete _0x4b9b53[_0x6479('0x2b')];}_0xdf68ac[_0x6479('0x1b')](_0x5856ac)[_0x6479('0x2c')](_0x4b9b53);};}exports[_0x6479('0x2d')]=function(_0xdb401,_0x11db36){var _0x50a834={},_0x13fc03={},_0x5b1992={'count':0x0,'rows':[]};var _0x45313f=_[_0x6479('0x2e')](db[_0x6479('0x2f')][_0x6479('0x30')],function(_0x302d19){return{'name':_0x302d19['fieldName'],'type':_0x302d19[_0x6479('0x31')][_0x6479('0x32')]};});_0x13fc03[_0x6479('0x33')]=_[_0x6479('0x2e')](_0x45313f,_0x6479('0x2b'));_0x13fc03[_0x6479('0x34')]=_[_0x6479('0x35')](_0xdb401[_0x6479('0x34')]);_0x13fc03[_0x6479('0x36')]=_[_0x6479('0x37')](_0x13fc03[_0x6479('0x33')],_0x13fc03[_0x6479('0x34')]);_0x50a834[_0x6479('0x38')]=_[_0x6479('0x37')](_0x13fc03[_0x6479('0x33')],qs[_0x6479('0x39')](_0xdb401[_0x6479('0x34')][_0x6479('0x39')]));_0x50a834[_0x6479('0x38')]=_0x50a834[_0x6479('0x38')][_0x6479('0x3a')]?_0x50a834['attributes']:_0x13fc03[_0x6479('0x33')];if(!_0xdb401[_0x6479('0x34')]['hasOwnProperty'](_0x6479('0x3b'))){_0x50a834[_0x6479('0x1e')]=qs[_0x6479('0x1e')](_0xdb401[_0x6479('0x34')]['limit']);_0x50a834[_0x6479('0x1d')]=qs[_0x6479('0x1d')](_0xdb401['query']['offset']);}_0x50a834[_0x6479('0x3c')]=qs[_0x6479('0x3d')](_0xdb401[_0x6479('0x34')][_0x6479('0x3d')]);_0x50a834[_0x6479('0x3e')]=qs[_0x6479('0x36')](_[_0x6479('0x3f')](_0xdb401[_0x6479('0x34')],_0x13fc03['filters']),_0x45313f);if(_0xdb401['query'][_0x6479('0x40')]){_0x50a834[_0x6479('0x3e')]=_['merge'](_0x50a834[_0x6479('0x3e')],{'$or':_[_0x6479('0x2e')](_0x45313f,function(_0x4575d9){if(_0x4575d9[_0x6479('0x31')]!==_0x6479('0x41')){var _0x53f84a={};_0x53f84a[_0x4575d9[_0x6479('0x2b')]]={'$like':'%'+_0xdb401['query'][_0x6479('0x40')]+'%'};return _0x53f84a;}})});}_0x50a834=_['merge']({},_0x50a834,_0xdb401[_0x6479('0x42')]);var _0x239c75={'where':_0x50a834['where']};return db[_0x6479('0x2f')]['count'](_0x239c75)[_0x6479('0x28')](function(_0x38c155){_0x5b1992[_0x6479('0x20')]=_0x38c155;if(_0xdb401[_0x6479('0x34')][_0x6479('0x43')]){_0x50a834[_0x6479('0x44')]=[{'all':!![]}];}return db[_0x6479('0x2f')][_0x6479('0x45')](_0x50a834);})[_0x6479('0x28')](function(_0x3cb072){_0x5b1992[_0x6479('0x46')]=_0x3cb072;return _0x5b1992;})[_0x6479('0x28')](respondWithFilteredResult(_0x11db36,_0x50a834))[_0x6479('0x47')](handleError(_0x11db36,null));};exports[_0x6479('0x48')]=function(_0x4567d7,_0x3416ef){var _0x283438={'raw':![],'where':{'id':_0x4567d7[_0x6479('0x49')]['id']}},_0x32c5fb={};_0x32c5fb['model']=_['keys'](db[_0x6479('0x2f')][_0x6479('0x30')]);_0x32c5fb['query']=_[_0x6479('0x35')](_0x4567d7['query']);_0x32c5fb['filters']=_[_0x6479('0x37')](_0x32c5fb[_0x6479('0x33')],_0x32c5fb[_0x6479('0x34')]);_0x283438[_0x6479('0x38')]=_[_0x6479('0x37')](_0x32c5fb['model'],qs['fields'](_0x4567d7[_0x6479('0x34')][_0x6479('0x39')]));_0x283438[_0x6479('0x38')]=_0x283438[_0x6479('0x38')]['length']?_0x283438[_0x6479('0x38')]:_0x32c5fb[_0x6479('0x33')];if(_0x4567d7[_0x6479('0x34')][_0x6479('0x43')]){_0x283438[_0x6479('0x44')]=[{'all':!![]}];}_0x283438=_[_0x6479('0x4a')]({},_0x283438,_0x4567d7[_0x6479('0x42')]);return db['SugarcrmAccount'][_0x6479('0x4b')](_0x283438)[_0x6479('0x28')](handleEntityNotFound(_0x3416ef,null))[_0x6479('0x28')](respondWithResult(_0x3416ef,null))['catch'](handleError(_0x3416ef,null));};exports[_0x6479('0x4c')]=function(_0x215e84,_0x15357a){return db[_0x6479('0x2f')][_0x6479('0x4c')](_0x215e84[_0x6479('0x4d')],{})[_0x6479('0x28')](respondWithResult(_0x15357a,0xc9))[_0x6479('0x47')](handleError(_0x15357a,null));};exports['update']=function(_0x3faa1b,_0x5399f5){if(_0x3faa1b['body']['id']){delete _0x3faa1b[_0x6479('0x4d')]['id'];}return db[_0x6479('0x2f')][_0x6479('0x4b')]({'where':{'id':_0x3faa1b[_0x6479('0x49')]['id']}})['then'](handleEntityNotFound(_0x5399f5,null))['then'](saveUpdates(_0x3faa1b['body'],null))[_0x6479('0x28')](respondWithResult(_0x5399f5,null))[_0x6479('0x47')](handleError(_0x5399f5,null));};exports[_0x6479('0x4e')]=function(_0x9f969c,_0x52c3e2){return db['SugarcrmAccount'][_0x6479('0x4b')]({'where':{'id':_0x9f969c[_0x6479('0x49')]['id']}})[_0x6479('0x28')](handleEntityNotFound(_0x52c3e2,null))[_0x6479('0x28')](removeEntity(_0x52c3e2,null))[_0x6479('0x47')](handleError(_0x52c3e2,null));};exports[_0x6479('0x4f')]=function(_0x76c0f9,_0x3389d3,_0x58fa60){var _0x4b8ee4={};var _0x36325b={};var _0x5f4843;var _0x13df04;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x76c0f9['params']['id']}})['then'](handleEntityNotFound(_0x3389d3,null))[_0x6479('0x28')](function(_0x1e7868){if(_0x1e7868){_0x5f4843=_0x1e7868;_0x36325b[_0x6479('0x33')]=_['keys'](db[_0x6479('0x50')][_0x6479('0x30')]);_0x36325b[_0x6479('0x34')]=_[_0x6479('0x35')](_0x76c0f9[_0x6479('0x34')]);_0x36325b[_0x6479('0x36')]=_[_0x6479('0x37')](_0x36325b['model'],_0x36325b['query']);_0x4b8ee4[_0x6479('0x38')]=_[_0x6479('0x37')](_0x36325b[_0x6479('0x33')],qs['fields'](_0x76c0f9[_0x6479('0x34')][_0x6479('0x39')]));_0x4b8ee4['attributes']=_0x4b8ee4[_0x6479('0x38')][_0x6479('0x3a')]?_0x4b8ee4[_0x6479('0x38')]:_0x36325b['model'];_0x4b8ee4['order']=qs[_0x6479('0x3d')](_0x76c0f9['query'][_0x6479('0x3d')]);_0x4b8ee4[_0x6479('0x3e')]=qs[_0x6479('0x36')](_['pick'](_0x76c0f9[_0x6479('0x34')],_0x36325b[_0x6479('0x36')]));if(_0x76c0f9[_0x6479('0x34')][_0x6479('0x40')]){_0x4b8ee4[_0x6479('0x3e')]=_['merge'](_0x4b8ee4[_0x6479('0x3e')],{'$or':_[_0x6479('0x2e')](_0x4b8ee4[_0x6479('0x38')],function(_0x3fb8c6){var _0x5c2857={};_0x5c2857[_0x3fb8c6]={'$like':'%'+_0x76c0f9['query'][_0x6479('0x40')]+'%'};return _0x5c2857;})});}_0x4b8ee4=_[_0x6479('0x4a')]({},_0x4b8ee4,_0x76c0f9['options']);return _0x5f4843[_0x6479('0x4f')](_0x4b8ee4);}})[_0x6479('0x28')](function(_0xdb45ab){if(_0xdb45ab){_0x13df04=_0xdb45ab[_0x6479('0x3a')];if(!_0x76c0f9[_0x6479('0x34')][_0x6479('0x51')](_0x6479('0x3b'))){_0x4b8ee4[_0x6479('0x1e')]=qs[_0x6479('0x1e')](_0x76c0f9[_0x6479('0x34')][_0x6479('0x1e')]);_0x4b8ee4[_0x6479('0x1d')]=qs[_0x6479('0x1d')](_0x76c0f9[_0x6479('0x34')]['offset']);}return _0x5f4843[_0x6479('0x4f')](_0x4b8ee4);}})[_0x6479('0x28')](function(_0x4fb5e0){if(_0x4fb5e0){return _0x4fb5e0?{'count':_0x13df04,'rows':_0x4fb5e0}:null;}})[_0x6479('0x28')](respondWithResult(_0x3389d3,null))['catch'](handleError(_0x3389d3,null));};exports[_0x6479('0x52')]=function(_0x54f61e,_0x75a64c,_0x396bf7){if(_0x54f61e[_0x6479('0x4d')]['id']){delete _0x54f61e[_0x6479('0x4d')]['id'];}return db['SugarcrmAccount'][_0x6479('0x53')]({'where':{'id':_0x54f61e['params']['id']}})['then'](handleEntityNotFound(_0x75a64c,null))[_0x6479('0x28')](function(_0x2855a7){if(_0x2855a7){_0x54f61e[_0x6479('0x4d')][_0x6479('0x54')]=_0x2855a7['id'];_0x54f61e['body']['Subjects']=integrations['getSubjects'](_0x54f61e['body'][_0x6479('0x55')],_0x54f61e[_0x6479('0x4d')][_0x6479('0x31')]);_0x54f61e[_0x6479('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x54f61e[_0x6479('0x4d')][_0x6479('0x55')],_0x54f61e[_0x6479('0x4d')][_0x6479('0x31')]);return db['SugarcrmConfiguration'][_0x6479('0x4c')](_0x54f61e[_0x6479('0x4d')],{'include':[{'model':db[_0x6479('0x56')],'as':'Subjects'},{'model':db[_0x6479('0x56')],'as':_0x6479('0x57')}]});}return null;})[_0x6479('0x28')](respondWithResult(_0x75a64c,null))[_0x6479('0x47')](handleError(_0x75a64c,null));};exports[_0x6479('0x58')]=function(_0x45cf93,_0x24c6b6,_0x174384){var _0x1f6256='';var _0x423809=['id',_0x6479('0x2b'),_0x6479('0x59'),_0x6479('0x5a'),_0x6479('0x5b'),_0x6479('0x5c'),_0x6479('0x5d'),_0x6479('0x5e'),_0x6479('0x5f'),_0x6479('0x60'),_0x6479('0x61'),_0x6479('0x62')];return db[_0x6479('0x2f')][_0x6479('0x53')]({'where':{'id':_0x45cf93['params']['id']},'attributes':['id',_0x6479('0x63'),_0x6479('0x64'),'remoteUri']})['then'](handleEntityNotFound(_0x24c6b6,null))[_0x6479('0x28')](function(_0x3ba188){if(_0x3ba188){_0x1f6256=_0x3ba188[_0x6479('0x65')];var _0x1315f6=_0x1f6256[_0x6479('0x66')](-0x1);if(_0x1315f6==='/'){_0x1f6256=_0x1f6256[_0x6479('0x67')](0x0,_0x1f6256[_0x6479('0x68')](_0x1315f6));}return rp({'method':_0x6479('0x69'),'uri':util[_0x6479('0x6a')]('%s%s',_0x1f6256,_0x6479('0x6b')),'json':!![],'form':{'method':_0x6479('0x6c'),'input_type':_0x6479('0x6d'),'response_type':_0x6479('0x6d'),'rest_data':JSON[_0x6479('0x6e')]({'user_auth':{'user_name':_0x3ba188['username'],'password':_0x3ba188[_0x6479('0x64')],'encryption':_0x6479('0x6f')},'application':_0x6479('0x70')})}});}})[_0x6479('0x28')](function(_0x3413ee){if(_0x3413ee&&_0x3413ee[_0x6479('0x2b')]!==_0x6479('0x71')&&_0x3413ee[_0x6479('0x2b')]!==_0x6479('0x72')){return rp({'method':'POST','uri':util[_0x6479('0x6a')](_0x6479('0x73'),_0x1f6256,_0x6479('0x6b')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x6479('0x6d'),'rest_data':JSON[_0x6479('0x6e')]({'session':_0x3413ee['id'],'module_name':_0x6479('0x74')})}})[_0x6479('0x28')](function(_0x30a634){if(_0x30a634){var _0x50bafe=_['values'](_0x30a634[_0x6479('0x75')]);_[_0x6479('0x76')](_0x50bafe,function(_0x1357c8){return _0x423809[_0x6479('0x77')](_0x1357c8[_0x6479('0x2b')]);});return{'count':_0x50bafe[_0x6479('0x3a')],'rows':_['map'](_0x50bafe,function(_0x5f0f47){return{'id':_0x5f0f47[_0x6479('0x2b')],'name':_0x5f0f47[_0x6479('0x78')],'custom':_[_0x6479('0x79')](_0x5f0f47[_0x6479('0x2b')],'_c')?!![]:![],'options':_0x5f0f47[_0x6479('0x42')]?_['map'](_[_0x6479('0x7a')](_0x5f0f47[_0x6479('0x42')]),function(_0x1b681d){return{'name':_0x1b681d['value'],'value':_0x1b681d[_0x6479('0x2b')]};}):[]};})};}})[_0x6479('0x28')](respondWithResult(_0x24c6b6,null))[_0x6479('0x47')](function(_0x125646){var _0x56e641=_0x45cf93['query'][_0x6479('0x7b')]?0x1f4:_0x125646[_0x6479('0x7c')]||0x1f4;logger['error'](_0x6479('0x7d'),_0x6479('0x58'),_0x56e641,JSON[_0x6479('0x6e')](_0x125646));delete _0x125646['name'];if(_0x56e641===0x191){_0x56e641=0x190;}_0x24c6b6[_0x6479('0x1b')](_0x56e641)['send'](_0x45cf93[_0x6479('0x34')][_0x6479('0x7b')]?{'message':_0x6479('0x7e'),'statusCode':_0x125646['statusCode']}:_0x125646);});}else{var _0x48cc8b=0x1f4;_0x24c6b6['status'](_0x48cc8b)[_0x6479('0x2c')]({'message':_0x6479('0x7e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2e2e=['rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','SugarcrmAccount','includeAll','include','findAll','show','params','find','catch','create','body','getConfigurations','SugarcrmConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','username','password','remoteUri','slice','POST','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','format','%s%s','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','endsWith','options','value','test','statusCode','Wrong\x20credentials','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e2e,0x15e));var _0xe2e2=function(_0x58f129,_0x56ed52){_0x58f129=_0x58f129-0x0;var _0x1bc885=_0x2e2e[_0x58f129];return _0x1bc885;};'use strict';var emlformat=require(_0xe2e2('0x0'));var rimraf=require(_0xe2e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2e2('0x2'));var rp=require(_0xe2e2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe2e2('0x4'));var util=require(_0xe2e2('0x5'));var path=require('path');var sox=require(_0xe2e2('0x6'));var csv=require(_0xe2e2('0x7'));var ejs=require(_0xe2e2('0x8'));var fs=require('fs');var fs_extra=require(_0xe2e2('0x9'));var _=require(_0xe2e2('0xa'));var squel=require(_0xe2e2('0xb'));var crypto=require(_0xe2e2('0xc'));var jsforce=require(_0xe2e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe2e2('0x7'));var querystring=require(_0xe2e2('0xe'));var Papa=require(_0xe2e2('0xf'));var Redis=require(_0xe2e2('0x10'));var authService=require(_0xe2e2('0x11'));var qs=require(_0xe2e2('0x12'));var as=require(_0xe2e2('0x13'));var hardwareService=require(_0xe2e2('0x14'));var logger=require(_0xe2e2('0x15'))(_0xe2e2('0x16'));var utils=require(_0xe2e2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe2e2('0x18'))['db'];var integrations=require(_0xe2e2('0x19'));function respondWithStatusCode(_0x1f62ab,_0x452402){_0x452402=_0x452402||0xcc;return function(_0x3a4600){if(_0x3a4600){return _0x1f62ab[_0xe2e2('0x1a')](_0x452402);}return _0x1f62ab[_0xe2e2('0x1b')](_0x452402)[_0xe2e2('0x1c')]();};}function respondWithResult(_0x5e292f,_0x2c7bbf){_0x2c7bbf=_0x2c7bbf||0xc8;return function(_0x3ea948){if(_0x3ea948){return _0x5e292f[_0xe2e2('0x1b')](_0x2c7bbf)['json'](_0x3ea948);}};}function respondWithFilteredResult(_0x4dbad0,_0x1dc1a8){return function(_0x514589){if(_0x514589){var _0x460e84=typeof _0x1dc1a8[_0xe2e2('0x1d')]==='undefined'&&typeof _0x1dc1a8['limit']===_0xe2e2('0x1e');var _0x195c98=_0x514589['count'];var _0x1c44e9=_0x460e84?0x0:_0x1dc1a8[_0xe2e2('0x1d')];var _0x389b37=_0x460e84?_0x514589[_0xe2e2('0x1f')]:_0x1dc1a8['offset']+_0x1dc1a8[_0xe2e2('0x20')];var _0x335f57;if(_0x389b37>=_0x195c98){_0x389b37=_0x195c98;_0x335f57=0xc8;}else{_0x335f57=0xce;}_0x4dbad0[_0xe2e2('0x1b')](_0x335f57);return _0x4dbad0[_0xe2e2('0x21')](_0xe2e2('0x22'),_0x1c44e9+'-'+_0x389b37+'/'+_0x195c98)[_0xe2e2('0x23')](_0x514589);}return null;};}function patchUpdates(_0x3112b7){return function(_0x1a28b0){try{jsonpatch[_0xe2e2('0x24')](_0x1a28b0,_0x3112b7,!![]);}catch(_0x144be8){return BPromise[_0xe2e2('0x25')](_0x144be8);}return _0x1a28b0[_0xe2e2('0x26')]();};}function saveUpdates(_0x1d690b,_0x37af09){return function(_0xae0932){if(_0xae0932){return _0xae0932[_0xe2e2('0x27')](_0x1d690b)[_0xe2e2('0x28')](function(_0x32c01d){return _0x32c01d;});}return null;};}function removeEntity(_0x18fdbe,_0x588e79){return function(_0x4230a2){if(_0x4230a2){return _0x4230a2[_0xe2e2('0x29')]()[_0xe2e2('0x28')](function(){_0x18fdbe[_0xe2e2('0x1b')](0xcc)[_0xe2e2('0x1c')]();});}};}function handleEntityNotFound(_0x583dad,_0x356164){return function(_0x4ceb89){if(!_0x4ceb89){_0x583dad[_0xe2e2('0x1a')](0x194);}return _0x4ceb89;};}function handleError(_0x5468f6,_0x55a642){_0x55a642=_0x55a642||0x1f4;return function(_0x424179){logger[_0xe2e2('0x2a')](_0x424179[_0xe2e2('0x2b')]);if(_0x424179[_0xe2e2('0x2c')]){delete _0x424179[_0xe2e2('0x2c')];}_0x5468f6[_0xe2e2('0x1b')](_0x55a642)[_0xe2e2('0x2d')](_0x424179);};}exports[_0xe2e2('0x2e')]=function(_0x6534a7,_0x3a986d){var _0x36423b={},_0x4caebd={},_0x1ccf6e={'count':0x0,'rows':[]};var _0x377728=_['map'](db['SugarcrmAccount'][_0xe2e2('0x2f')],function(_0xd70277){return{'name':_0xd70277['fieldName'],'type':_0xd70277[_0xe2e2('0x30')][_0xe2e2('0x31')]};});_0x4caebd[_0xe2e2('0x32')]=_[_0xe2e2('0x33')](_0x377728,_0xe2e2('0x2c'));_0x4caebd[_0xe2e2('0x34')]=_[_0xe2e2('0x35')](_0x6534a7['query']);_0x4caebd['filters']=_[_0xe2e2('0x36')](_0x4caebd[_0xe2e2('0x32')],_0x4caebd['query']);_0x36423b[_0xe2e2('0x37')]=_[_0xe2e2('0x36')](_0x4caebd[_0xe2e2('0x32')],qs[_0xe2e2('0x38')](_0x6534a7[_0xe2e2('0x34')][_0xe2e2('0x38')]));_0x36423b[_0xe2e2('0x37')]=_0x36423b['attributes'][_0xe2e2('0x39')]?_0x36423b['attributes']:_0x4caebd[_0xe2e2('0x32')];if(!_0x6534a7['query'][_0xe2e2('0x3a')]('nolimit')){_0x36423b[_0xe2e2('0x20')]=qs[_0xe2e2('0x20')](_0x6534a7[_0xe2e2('0x34')][_0xe2e2('0x20')]);_0x36423b[_0xe2e2('0x1d')]=qs[_0xe2e2('0x1d')](_0x6534a7[_0xe2e2('0x34')][_0xe2e2('0x1d')]);}_0x36423b[_0xe2e2('0x3b')]=qs[_0xe2e2('0x3c')](_0x6534a7['query'][_0xe2e2('0x3c')]);_0x36423b[_0xe2e2('0x3d')]=qs[_0xe2e2('0x3e')](_[_0xe2e2('0x3f')](_0x6534a7[_0xe2e2('0x34')],_0x4caebd[_0xe2e2('0x3e')]),_0x377728);if(_0x6534a7[_0xe2e2('0x34')][_0xe2e2('0x40')]){_0x36423b[_0xe2e2('0x3d')]=_[_0xe2e2('0x41')](_0x36423b[_0xe2e2('0x3d')],{'$or':_[_0xe2e2('0x33')](_0x377728,function(_0x3bde06){if(_0x3bde06['type']!==_0xe2e2('0x42')){var _0x342219={};_0x342219[_0x3bde06[_0xe2e2('0x2c')]]={'$like':'%'+_0x6534a7[_0xe2e2('0x34')][_0xe2e2('0x40')]+'%'};return _0x342219;}})});}_0x36423b=_[_0xe2e2('0x41')]({},_0x36423b,_0x6534a7['options']);var _0x4b4133={'where':_0x36423b['where']};return db[_0xe2e2('0x43')][_0xe2e2('0x1f')](_0x4b4133)[_0xe2e2('0x28')](function(_0x2019c4){_0x1ccf6e[_0xe2e2('0x1f')]=_0x2019c4;if(_0x6534a7['query'][_0xe2e2('0x44')]){_0x36423b[_0xe2e2('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xe2e2('0x46')](_0x36423b);})[_0xe2e2('0x28')](function(_0x418c06){_0x1ccf6e['rows']=_0x418c06;return _0x1ccf6e;})[_0xe2e2('0x28')](respondWithFilteredResult(_0x3a986d,_0x36423b))['catch'](handleError(_0x3a986d,null));};exports[_0xe2e2('0x47')]=function(_0x1777b9,_0x3e1f00){var _0x1226a9={'raw':![],'where':{'id':_0x1777b9[_0xe2e2('0x48')]['id']}},_0x31733c={};_0x31733c[_0xe2e2('0x32')]=_[_0xe2e2('0x35')](db[_0xe2e2('0x43')][_0xe2e2('0x2f')]);_0x31733c[_0xe2e2('0x34')]=_[_0xe2e2('0x35')](_0x1777b9[_0xe2e2('0x34')]);_0x31733c[_0xe2e2('0x3e')]=_[_0xe2e2('0x36')](_0x31733c['model'],_0x31733c[_0xe2e2('0x34')]);_0x1226a9[_0xe2e2('0x37')]=_['intersection'](_0x31733c[_0xe2e2('0x32')],qs[_0xe2e2('0x38')](_0x1777b9[_0xe2e2('0x34')][_0xe2e2('0x38')]));_0x1226a9[_0xe2e2('0x37')]=_0x1226a9[_0xe2e2('0x37')]['length']?_0x1226a9['attributes']:_0x31733c[_0xe2e2('0x32')];if(_0x1777b9[_0xe2e2('0x34')][_0xe2e2('0x44')]){_0x1226a9[_0xe2e2('0x45')]=[{'all':!![]}];}_0x1226a9=_[_0xe2e2('0x41')]({},_0x1226a9,_0x1777b9['options']);return db['SugarcrmAccount'][_0xe2e2('0x49')](_0x1226a9)[_0xe2e2('0x28')](handleEntityNotFound(_0x3e1f00,null))[_0xe2e2('0x28')](respondWithResult(_0x3e1f00,null))[_0xe2e2('0x4a')](handleError(_0x3e1f00,null));};exports[_0xe2e2('0x4b')]=function(_0x38f610,_0x769d6d){return db[_0xe2e2('0x43')][_0xe2e2('0x4b')](_0x38f610[_0xe2e2('0x4c')],{})[_0xe2e2('0x28')](respondWithResult(_0x769d6d,0xc9))[_0xe2e2('0x4a')](handleError(_0x769d6d,null));};exports[_0xe2e2('0x27')]=function(_0x50421f,_0xb1ee4a){if(_0x50421f['body']['id']){delete _0x50421f[_0xe2e2('0x4c')]['id'];}return db[_0xe2e2('0x43')][_0xe2e2('0x49')]({'where':{'id':_0x50421f['params']['id']}})[_0xe2e2('0x28')](handleEntityNotFound(_0xb1ee4a,null))[_0xe2e2('0x28')](saveUpdates(_0x50421f[_0xe2e2('0x4c')],null))[_0xe2e2('0x28')](respondWithResult(_0xb1ee4a,null))[_0xe2e2('0x4a')](handleError(_0xb1ee4a,null));};exports['destroy']=function(_0x1cad7a,_0x1def69){return db[_0xe2e2('0x43')]['find']({'where':{'id':_0x1cad7a[_0xe2e2('0x48')]['id']}})[_0xe2e2('0x28')](handleEntityNotFound(_0x1def69,null))[_0xe2e2('0x28')](removeEntity(_0x1def69,null))[_0xe2e2('0x4a')](handleError(_0x1def69,null));};exports[_0xe2e2('0x4d')]=function(_0x5d1034,_0x5aa291,_0x57d7e1){var _0x397908={};var _0xc7d21={};var _0x389067;var _0x37e6f7;return db[_0xe2e2('0x43')]['findOne']({'where':{'id':_0x5d1034['params']['id']}})[_0xe2e2('0x28')](handleEntityNotFound(_0x5aa291,null))[_0xe2e2('0x28')](function(_0x528270){if(_0x528270){_0x389067=_0x528270;_0xc7d21[_0xe2e2('0x32')]=_[_0xe2e2('0x35')](db[_0xe2e2('0x4e')]['rawAttributes']);_0xc7d21['query']=_[_0xe2e2('0x35')](_0x5d1034[_0xe2e2('0x34')]);_0xc7d21['filters']=_[_0xe2e2('0x36')](_0xc7d21[_0xe2e2('0x32')],_0xc7d21['query']);_0x397908['attributes']=_[_0xe2e2('0x36')](_0xc7d21[_0xe2e2('0x32')],qs[_0xe2e2('0x38')](_0x5d1034[_0xe2e2('0x34')][_0xe2e2('0x38')]));_0x397908[_0xe2e2('0x37')]=_0x397908['attributes'][_0xe2e2('0x39')]?_0x397908[_0xe2e2('0x37')]:_0xc7d21[_0xe2e2('0x32')];_0x397908[_0xe2e2('0x3b')]=qs['sort'](_0x5d1034[_0xe2e2('0x34')][_0xe2e2('0x3c')]);_0x397908['where']=qs['filters'](_['pick'](_0x5d1034[_0xe2e2('0x34')],_0xc7d21[_0xe2e2('0x3e')]));if(_0x5d1034[_0xe2e2('0x34')][_0xe2e2('0x40')]){_0x397908[_0xe2e2('0x3d')]=_[_0xe2e2('0x41')](_0x397908['where'],{'$or':_[_0xe2e2('0x33')](_0x397908[_0xe2e2('0x37')],function(_0x243597){var _0x505e81={};_0x505e81[_0x243597]={'$like':'%'+_0x5d1034[_0xe2e2('0x34')][_0xe2e2('0x40')]+'%'};return _0x505e81;})});}_0x397908=_[_0xe2e2('0x41')]({},_0x397908,_0x5d1034['options']);return _0x389067[_0xe2e2('0x4d')](_0x397908);}})[_0xe2e2('0x28')](function(_0xbf1c47){if(_0xbf1c47){_0x37e6f7=_0xbf1c47[_0xe2e2('0x39')];if(!_0x5d1034[_0xe2e2('0x34')][_0xe2e2('0x3a')](_0xe2e2('0x4f'))){_0x397908[_0xe2e2('0x20')]=qs[_0xe2e2('0x20')](_0x5d1034[_0xe2e2('0x34')][_0xe2e2('0x20')]);_0x397908[_0xe2e2('0x1d')]=qs['offset'](_0x5d1034[_0xe2e2('0x34')][_0xe2e2('0x1d')]);}return _0x389067[_0xe2e2('0x4d')](_0x397908);}})[_0xe2e2('0x28')](function(_0x4a649b){if(_0x4a649b){return _0x4a649b?{'count':_0x37e6f7,'rows':_0x4a649b}:null;}})[_0xe2e2('0x28')](respondWithResult(_0x5aa291,null))[_0xe2e2('0x4a')](handleError(_0x5aa291,null));};exports[_0xe2e2('0x50')]=function(_0x447c1a,_0x238aa2,_0x4c5e90){if(_0x447c1a[_0xe2e2('0x4c')]['id']){delete _0x447c1a[_0xe2e2('0x4c')]['id'];}return db[_0xe2e2('0x43')]['findOne']({'where':{'id':_0x447c1a[_0xe2e2('0x48')]['id']}})['then'](handleEntityNotFound(_0x238aa2,null))[_0xe2e2('0x28')](function(_0x3a8cad){if(_0x3a8cad){_0x447c1a['body']['AccountId']=_0x3a8cad['id'];_0x447c1a['body'][_0xe2e2('0x51')]=integrations[_0xe2e2('0x52')](_0x447c1a[_0xe2e2('0x4c')][_0xe2e2('0x53')],_0x447c1a[_0xe2e2('0x4c')]['type']);_0x447c1a['body']['Descriptions']=integrations['getDescriptions'](_0x447c1a[_0xe2e2('0x4c')][_0xe2e2('0x53')],_0x447c1a[_0xe2e2('0x4c')][_0xe2e2('0x30')]);return db[_0xe2e2('0x4e')]['create'](_0x447c1a['body'],{'include':[{'model':db[_0xe2e2('0x54')],'as':_0xe2e2('0x51')},{'model':db[_0xe2e2('0x54')],'as':_0xe2e2('0x55')}]});}return null;})[_0xe2e2('0x28')](respondWithResult(_0x238aa2,null))[_0xe2e2('0x4a')](handleError(_0x238aa2,null));};exports[_0xe2e2('0x56')]=function(_0x14bc3e,_0x4b0d38,_0x10b4cf){var _0x2e700e='';var _0x47bdc2=['id',_0xe2e2('0x2c'),_0xe2e2('0x57'),'created_by',_0xe2e2('0x58'),_0xe2e2('0x59'),_0xe2e2('0x5a'),_0xe2e2('0x5b'),'parent_id',_0xe2e2('0x5c'),_0xe2e2('0x5d'),'direction'];return db[_0xe2e2('0x43')]['findOne']({'where':{'id':_0x14bc3e[_0xe2e2('0x48')]['id']},'attributes':['id',_0xe2e2('0x5e'),_0xe2e2('0x5f'),_0xe2e2('0x60')]})['then'](handleEntityNotFound(_0x4b0d38,null))[_0xe2e2('0x28')](function(_0x11a6d5){if(_0x11a6d5){_0x2e700e=_0x11a6d5[_0xe2e2('0x60')];var _0x21739d=_0x2e700e[_0xe2e2('0x61')](-0x1);if(_0x21739d==='/'){_0x2e700e=_0x2e700e['substring'](0x0,_0x2e700e['lastIndexOf'](_0x21739d));}return rp({'method':_0xe2e2('0x62'),'uri':util['format']('%s%s',_0x2e700e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xe2e2('0x63'),'response_type':'JSON','rest_data':JSON[_0xe2e2('0x64')]({'user_auth':{'user_name':_0x11a6d5[_0xe2e2('0x5e')],'password':_0x11a6d5[_0xe2e2('0x5f')],'encryption':_0xe2e2('0x65')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xe2e2('0x28')](function(_0x14be86){if(_0x14be86&&_0x14be86['name']!==_0xe2e2('0x66')&&_0x14be86[_0xe2e2('0x2c')]!==_0xe2e2('0x67')){return rp({'method':_0xe2e2('0x62'),'uri':util[_0xe2e2('0x68')](_0xe2e2('0x69'),_0x2e700e,_0xe2e2('0x6a')),'json':!![],'form':{'method':_0xe2e2('0x6b'),'input_type':_0xe2e2('0x63'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x14be86['id'],'module_name':'Calls'})}})[_0xe2e2('0x28')](function(_0x2dca05){if(_0x2dca05){var _0x35857a=_[_0xe2e2('0x6c')](_0x2dca05[_0xe2e2('0x6d')]);_[_0xe2e2('0x6e')](_0x35857a,function(_0x15f46){return _0x47bdc2['includes'](_0x15f46[_0xe2e2('0x2c')]);});return{'count':_0x35857a['length'],'rows':_[_0xe2e2('0x33')](_0x35857a,function(_0x25c374){return{'id':_0x25c374[_0xe2e2('0x2c')],'name':_0x25c374['label'],'custom':_[_0xe2e2('0x6f')](_0x25c374[_0xe2e2('0x2c')],'_c')?!![]:![],'options':_0x25c374[_0xe2e2('0x70')]?_[_0xe2e2('0x33')](_[_0xe2e2('0x6c')](_0x25c374[_0xe2e2('0x70')]),function(_0x49eb0a){return{'name':_0x49eb0a[_0xe2e2('0x71')],'value':_0x49eb0a[_0xe2e2('0x2c')]};}):[]};})};}})[_0xe2e2('0x28')](respondWithResult(_0x4b0d38,null))[_0xe2e2('0x4a')](function(_0x1f85a6){var _0x236095=_0x14bc3e[_0xe2e2('0x34')][_0xe2e2('0x72')]?0x1f4:_0x1f85a6[_0xe2e2('0x73')]||0x1f4;logger[_0xe2e2('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xe2e2('0x56'),_0x236095,JSON[_0xe2e2('0x64')](_0x1f85a6));delete _0x1f85a6[_0xe2e2('0x2c')];if(_0x236095===0x191){_0x236095=0x190;}_0x4b0d38[_0xe2e2('0x1b')](_0x236095)[_0xe2e2('0x2d')](_0x14bc3e['query'][_0xe2e2('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x1f85a6[_0xe2e2('0x73')]}:_0x1f85a6);});}else{var _0x17312=0x1f4;_0x4b0d38[_0xe2e2('0x1b')](_0x17312)['send']({'message':_0xe2e2('0x74'),'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 32830d9..41662e6 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 _0xef35=['moment','bluebird','../../config/environment','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger'];(function(_0x201498,_0x2ee6b4){var _0x23f348=function(_0x3280f9){while(--_0x3280f9){_0x201498['push'](_0x201498['shift']());}};_0x23f348(++_0x2ee6b4);}(_0xef35,0xa8));var _0x5ef3=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0xef35[_0x57b236];return _0x4feb29;};'use strict';var _=require(_0x5ef3('0x0'));var util=require(_0x5ef3('0x1'));var logger=require(_0x5ef3('0x2'))('api');var moment=require(_0x5ef3('0x3'));var BPromise=require(_0x5ef3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ef3('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x5ef3('0x6'));module[_0x5ef3('0x7')]=function(_0xffaa70,_0x4b3014){return _0xffaa70[_0x5ef3('0x8')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc217=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc217,0x15d));var _0x7c21=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xc217[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0x7c21('0x0'));var util=require('util');var logger=require(_0x7c21('0x1'))(_0x7c21('0x2'));var moment=require(_0x7c21('0x3'));var BPromise=require(_0x7c21('0x4'));var rp=require(_0x7c21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c21('0x6'));var config=require(_0x7c21('0x7'));var attributes=require(_0x7c21('0x8'));var integrations=require(_0x7c21('0x9'));module[_0x7c21('0xa')]=function(_0x30713e,_0x9a0f8b){return _0x30713e['define'](_0x7c21('0xb'),attributes,{'tableName':_0x7c21('0xc'),'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 1d075f9..3a84713 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 _0x7359=['model','attributes','ShowSugarcrmAccount','SugarcrmAccount','find','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','include','map'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7359,0x1e2));var _0x9735=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x7359[_0x8de54f];return _0x14cba4;};'use strict';var _=require('lodash');var util=require(_0x9735('0x0'));var moment=require(_0x9735('0x1'));var BPromise=require(_0x9735('0x2'));var rs=require(_0x9735('0x3'));var fs=require('fs');var Redis=require(_0x9735('0x4'));var db=require(_0x9735('0x5'))['db'];var utils=require(_0x9735('0x6'));var logger=require(_0x9735('0x7'))(_0x9735('0x8'));var config=require(_0x9735('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9735('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30b9ca,_0x39814c,_0x52db4d){return new BPromise(function(_0x227373,_0x5e945c){return client['request'](_0x30b9ca,_0x52db4d)[_0x9735('0xb')](function(_0x2c0d3e){logger[_0x9735('0xc')](_0x9735('0xd'),_0x39814c,_0x9735('0xe'));logger['debug'](_0x9735('0xf'),_0x39814c,_0x9735('0xe'),JSON['stringify'](_0x2c0d3e));if(_0x2c0d3e[_0x9735('0x10')]){if(_0x2c0d3e[_0x9735('0x10')][_0x9735('0x11')]===0x1f4){logger[_0x9735('0x10')](_0x9735('0xd'),_0x39814c,_0x2c0d3e[_0x9735('0x10')]['message']);return _0x5e945c(_0x2c0d3e[_0x9735('0x10')]['message']);}logger[_0x9735('0x10')](_0x9735('0xd'),_0x39814c,_0x2c0d3e['error']['message']);return _0x227373(_0x2c0d3e[_0x9735('0x10')][_0x9735('0x12')]);}else{logger[_0x9735('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x39814c,_0x9735('0xe'));_0x227373(_0x2c0d3e[_0x9735('0x13')][_0x9735('0x12')]);}})[_0x9735('0x14')](function(_0x4f5a80){logger[_0x9735('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x39814c,_0x4f5a80);_0x5e945c(_0x4f5a80);});});}exports[_0x9735('0x15')]=function(_0x5b0063){var _0x52ff0a=this;return new Promise(function(_0x54f594,_0x3b52f7){return db['SugarcrmAccount'][_0x9735('0x16')]({'raw':_0x5b0063[_0x9735('0x17')]?_0x5b0063[_0x9735('0x17')][_0x9735('0x18')]===undefined?!![]:![]:!![],'where':_0x5b0063[_0x9735('0x17')]?_0x5b0063[_0x9735('0x17')][_0x9735('0x19')]||null:null,'attributes':_0x5b0063[_0x9735('0x17')]?_0x5b0063[_0x9735('0x17')]['attributes']||null:null,'limit':_0x5b0063[_0x9735('0x17')]?_0x5b0063[_0x9735('0x17')]['limit']||null:null,'include':_0x5b0063[_0x9735('0x17')]?_0x5b0063[_0x9735('0x17')][_0x9735('0x1a')]?_[_0x9735('0x1b')](_0x5b0063[_0x9735('0x17')]['include'],function(_0x34e162){return{'model':db[_0x34e162[_0x9735('0x1c')]],'as':_0x34e162['as'],'attributes':_0x34e162[_0x9735('0x1d')],'include':_0x34e162[_0x9735('0x1a')]?_['map'](_0x34e162[_0x9735('0x1a')],function(_0x44a8b6){return{'model':db[_0x44a8b6[_0x9735('0x1c')]],'as':_0x44a8b6['as'],'attributes':_0x44a8b6[_0x9735('0x1d')],'include':_0x44a8b6[_0x9735('0x1a')]?_[_0x9735('0x1b')](_0x44a8b6['include'],function(_0x3e0e78){return{'model':db[_0x3e0e78[_0x9735('0x1c')]],'as':_0x3e0e78['as'],'attributes':_0x3e0e78['attributes']};}):[]};}):[]};}):[]:[]})[_0x9735('0xb')](function(_0x23824a){logger['info'](_0x9735('0x15'),_0x5b0063);logger['debug']('GetSugarcrmAccount',_0x5b0063,JSON['stringify'](_0x23824a));_0x54f594(_0x23824a);})['catch'](function(_0x33a64b){logger[_0x9735('0x10')](_0x9735('0x15'),_0x33a64b[_0x9735('0x12')],_0x5b0063);_0x3b52f7(_0x52ff0a[_0x9735('0x10')](0x1f4,_0x33a64b['message']));});});};exports[_0x9735('0x1e')]=function(_0x180e15){var _0x286d6d=this;return new Promise(function(_0x4c208b,_0x276f34){return db[_0x9735('0x1f')][_0x9735('0x20')]({'raw':_0x180e15[_0x9735('0x17')]?_0x180e15[_0x9735('0x17')][_0x9735('0x18')]===undefined?!![]:![]:!![],'where':_0x180e15[_0x9735('0x17')]?_0x180e15[_0x9735('0x17')]['where']||null:null,'attributes':_0x180e15[_0x9735('0x17')]?_0x180e15[_0x9735('0x17')][_0x9735('0x1d')]||null:null,'include':_0x180e15[_0x9735('0x17')]?_0x180e15['options'][_0x9735('0x1a')]?_[_0x9735('0x1b')](_0x180e15[_0x9735('0x17')][_0x9735('0x1a')],function(_0x287cb2){return{'model':db[_0x287cb2['model']],'as':_0x287cb2['as'],'attributes':_0x287cb2[_0x9735('0x1d')],'include':_0x287cb2[_0x9735('0x1a')]?_[_0x9735('0x1b')](_0x287cb2[_0x9735('0x1a')],function(_0x2d7bcc){return{'model':db[_0x2d7bcc[_0x9735('0x1c')]],'as':_0x2d7bcc['as'],'attributes':_0x2d7bcc['attributes'],'include':_0x2d7bcc[_0x9735('0x1a')]?_['map'](_0x2d7bcc[_0x9735('0x1a')],function(_0x4d9db6){return{'model':db[_0x4d9db6[_0x9735('0x1c')]],'as':_0x4d9db6['as'],'attributes':_0x4d9db6['attributes']};}):[]};}):[]};}):[]:[]})[_0x9735('0xb')](function(_0x5f0021){logger[_0x9735('0xc')]('ShowSugarcrmAccount',_0x180e15);logger[_0x9735('0x21')](_0x9735('0x1e'),_0x180e15,JSON['stringify'](_0x5f0021));_0x4c208b(_0x5f0021);})[_0x9735('0x14')](function(_0xe84089){logger[_0x9735('0x10')](_0x9735('0x1e'),_0xe84089[_0x9735('0x12')],_0x180e15);_0x276f34(_0x286d6d['error'](0x1f4,_0xe84089[_0x9735('0x12')]));});});}; \ No newline at end of file +var _0xec35=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','findAll','options','where','attributes','limit','include','model','map','ShowSugarcrmAccount','SugarcrmAccount','raw','stringify','lodash','util','moment','bluebird'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0xec35,0x149));var _0x5ec3=function(_0x16754b,_0x12eb0c){_0x16754b=_0x16754b-0x0;var _0x3ea568=_0xec35[_0x16754b];return _0x3ea568;};'use strict';var _=require(_0x5ec3('0x0'));var util=require(_0x5ec3('0x1'));var moment=require(_0x5ec3('0x2'));var BPromise=require(_0x5ec3('0x3'));var rs=require(_0x5ec3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ec3('0x5'))['db'];var utils=require(_0x5ec3('0x6'));var logger=require(_0x5ec3('0x7'))(_0x5ec3('0x8'));var config=require(_0x5ec3('0x9'));var jayson=require(_0x5ec3('0xa'));var client=jayson[_0x5ec3('0xb')][_0x5ec3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x162d51,_0x16663d,_0x58832c){return new BPromise(function(_0x81ec06,_0x5d5cb0){return client['request'](_0x162d51,_0x58832c)[_0x5ec3('0xd')](function(_0x3bbc2a){logger[_0x5ec3('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x16663d,_0x5ec3('0xf'));logger[_0x5ec3('0x10')](_0x5ec3('0x11'),_0x16663d,_0x5ec3('0xf'),JSON['stringify'](_0x3bbc2a));if(_0x3bbc2a[_0x5ec3('0x12')]){if(_0x3bbc2a[_0x5ec3('0x12')][_0x5ec3('0x13')]===0x1f4){logger[_0x5ec3('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x16663d,_0x3bbc2a[_0x5ec3('0x12')][_0x5ec3('0x14')]);return _0x5d5cb0(_0x3bbc2a[_0x5ec3('0x12')]['message']);}logger[_0x5ec3('0x12')](_0x5ec3('0x15'),_0x16663d,_0x3bbc2a[_0x5ec3('0x12')][_0x5ec3('0x14')]);return _0x81ec06(_0x3bbc2a[_0x5ec3('0x12')][_0x5ec3('0x14')]);}else{logger[_0x5ec3('0xe')](_0x5ec3('0x15'),_0x16663d,_0x5ec3('0xf'));_0x81ec06(_0x3bbc2a[_0x5ec3('0x16')]['message']);}})[_0x5ec3('0x17')](function(_0x19b1ff){logger[_0x5ec3('0x12')](_0x5ec3('0x15'),_0x16663d,_0x19b1ff);_0x5d5cb0(_0x19b1ff);});});}exports[_0x5ec3('0x18')]=function(_0xe775e6){var _0x47b6bd=this;return new Promise(function(_0x9ef4ef,_0x9b0359){return db['SugarcrmAccount'][_0x5ec3('0x19')]({'raw':_0xe775e6[_0x5ec3('0x1a')]?_0xe775e6['options']['raw']===undefined?!![]:![]:!![],'where':_0xe775e6[_0x5ec3('0x1a')]?_0xe775e6[_0x5ec3('0x1a')][_0x5ec3('0x1b')]||null:null,'attributes':_0xe775e6['options']?_0xe775e6[_0x5ec3('0x1a')][_0x5ec3('0x1c')]||null:null,'limit':_0xe775e6['options']?_0xe775e6['options'][_0x5ec3('0x1d')]||null:null,'include':_0xe775e6[_0x5ec3('0x1a')]?_0xe775e6[_0x5ec3('0x1a')][_0x5ec3('0x1e')]?_['map'](_0xe775e6[_0x5ec3('0x1a')][_0x5ec3('0x1e')],function(_0x4eadb1){return{'model':db[_0x4eadb1[_0x5ec3('0x1f')]],'as':_0x4eadb1['as'],'attributes':_0x4eadb1[_0x5ec3('0x1c')],'include':_0x4eadb1[_0x5ec3('0x1e')]?_['map'](_0x4eadb1[_0x5ec3('0x1e')],function(_0xa09823){return{'model':db[_0xa09823[_0x5ec3('0x1f')]],'as':_0xa09823['as'],'attributes':_0xa09823[_0x5ec3('0x1c')],'include':_0xa09823[_0x5ec3('0x1e')]?_[_0x5ec3('0x20')](_0xa09823['include'],function(_0x1f1dfa){return{'model':db[_0x1f1dfa[_0x5ec3('0x1f')]],'as':_0x1f1dfa['as'],'attributes':_0x1f1dfa[_0x5ec3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ec3('0xd')](function(_0x1d8dc2){logger['info'](_0x5ec3('0x18'),_0xe775e6);logger[_0x5ec3('0x10')](_0x5ec3('0x18'),_0xe775e6,JSON['stringify'](_0x1d8dc2));_0x9ef4ef(_0x1d8dc2);})[_0x5ec3('0x17')](function(_0x1c6b3c){logger[_0x5ec3('0x12')](_0x5ec3('0x18'),_0x1c6b3c[_0x5ec3('0x14')],_0xe775e6);_0x9b0359(_0x47b6bd['error'](0x1f4,_0x1c6b3c['message']));});});};exports[_0x5ec3('0x21')]=function(_0x1fddbc){var _0x508dad=this;return new Promise(function(_0x3d1735,_0x1cd731){return db[_0x5ec3('0x22')]['find']({'raw':_0x1fddbc['options']?_0x1fddbc[_0x5ec3('0x1a')][_0x5ec3('0x23')]===undefined?!![]:![]:!![],'where':_0x1fddbc[_0x5ec3('0x1a')]?_0x1fddbc[_0x5ec3('0x1a')][_0x5ec3('0x1b')]||null:null,'attributes':_0x1fddbc[_0x5ec3('0x1a')]?_0x1fddbc[_0x5ec3('0x1a')][_0x5ec3('0x1c')]||null:null,'include':_0x1fddbc['options']?_0x1fddbc['options']['include']?_[_0x5ec3('0x20')](_0x1fddbc[_0x5ec3('0x1a')]['include'],function(_0x98a967){return{'model':db[_0x98a967['model']],'as':_0x98a967['as'],'attributes':_0x98a967[_0x5ec3('0x1c')],'include':_0x98a967[_0x5ec3('0x1e')]?_[_0x5ec3('0x20')](_0x98a967[_0x5ec3('0x1e')],function(_0x351ddf){return{'model':db[_0x351ddf[_0x5ec3('0x1f')]],'as':_0x351ddf['as'],'attributes':_0x351ddf[_0x5ec3('0x1c')],'include':_0x351ddf[_0x5ec3('0x1e')]?_['map'](_0x351ddf['include'],function(_0x420f76){return{'model':db[_0x420f76[_0x5ec3('0x1f')]],'as':_0x420f76['as'],'attributes':_0x420f76['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ddf48){logger[_0x5ec3('0xe')]('ShowSugarcrmAccount',_0x1fddbc);logger[_0x5ec3('0x10')](_0x5ec3('0x21'),_0x1fddbc,JSON[_0x5ec3('0x24')](_0x5ddf48));_0x3d1735(_0x5ddf48);})['catch'](function(_0x50588d){logger[_0x5ec3('0x12')](_0x5ec3('0x21'),_0x50588d[_0x5ec3('0x14')],_0x1fddbc);_0x1cd731(_0x508dad[_0x5ec3('0x12')](0x1f4,_0x50588d[_0x5ec3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b854c05..a8ff612 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 _0x95a6=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','put','update','delete','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get'];(function(_0x152c94,_0x1b9c39){var _0x4c46e8=function(_0xc758f1){while(--_0xc758f1){_0x152c94['push'](_0x152c94['shift']());}};_0x4c46e8(++_0x1b9c39);}(_0x95a6,0xfc));var _0x695a=function(_0x315b3e,_0x55acff){_0x315b3e=_0x315b3e-0x0;var _0xa3397=_0x95a6[_0x315b3e];return _0xa3397;};'use strict';var multer=require(_0x695a('0x0'));var util=require('util');var path=require(_0x695a('0x1'));var timeout=require('connect-timeout');var express=require(_0x695a('0x2'));var router=express['Router']();var fs_extra=require(_0x695a('0x3'));var auth=require(_0x695a('0x4'));var interaction=require(_0x695a('0x5'));var config=require('../../config/environment');var controller=require(_0x695a('0x6'));router[_0x695a('0x7')]('/',auth[_0x695a('0x8')](),controller['index']);router[_0x695a('0x7')](_0x695a('0x9'),auth[_0x695a('0x8')](),controller[_0x695a('0xa')]);router[_0x695a('0x7')](_0x695a('0xb'),auth[_0x695a('0x8')](),controller[_0x695a('0xc')]);router[_0x695a('0x7')](_0x695a('0xd'),auth[_0x695a('0x8')](),controller[_0x695a('0xe')]);router['get'](_0x695a('0xf'),auth[_0x695a('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x695a('0x8')](),controller['create']);router[_0x695a('0x10')](_0x695a('0x9'),auth['isAuthenticated'](),controller[_0x695a('0x11')]);router[_0x695a('0x12')](_0x695a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x695a('0x13')]=router; \ No newline at end of file +var _0xd104=['update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xd104,0x169));var _0x4d10=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd104[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x4d10('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d10('0x1'));var router=express[_0x4d10('0x2')]();var fs_extra=require(_0x4d10('0x3'));var auth=require(_0x4d10('0x4'));var interaction=require(_0x4d10('0x5'));var config=require(_0x4d10('0x6'));var controller=require(_0x4d10('0x7'));router[_0x4d10('0x8')]('/',auth[_0x4d10('0x9')](),controller['index']);router[_0x4d10('0x8')](_0x4d10('0xa'),auth[_0x4d10('0x9')](),controller[_0x4d10('0xb')]);router[_0x4d10('0x8')](_0x4d10('0xc'),auth[_0x4d10('0x9')](),controller['getFields']);router[_0x4d10('0x8')]('/:id/subjects',auth[_0x4d10('0x9')](),controller[_0x4d10('0xd')]);router[_0x4d10('0x8')](_0x4d10('0xe'),auth['isAuthenticated'](),controller[_0x4d10('0xf')]);router[_0x4d10('0x10')]('/',auth[_0x4d10('0x9')](),controller['create']);router['put'](_0x4d10('0xa'),auth[_0x4d10('0x9')](),controller[_0x4d10('0x11')]);router[_0x4d10('0x12')](_0x4d10('0xa'),auth[_0x4d10('0x9')](),controller[_0x4d10('0x13')]);module[_0x4d10('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 9fc7878..a8483cc 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 _0x3a1e=['exports','STRING','sequelize'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0x3a1e,0x71));var _0xe3a1=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0x3a1e[_0xa98302];return _0x1ad8e3;};'use strict';var Sequelize=require(_0xe3a1('0x0'));module[_0xe3a1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe3a1('0x2')]}}; \ No newline at end of file +var _0x8bf9=['sequelize','exports','STRING'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0x8bf9,0x1e0));var _0x98bf=function(_0x4008f0,_0x17f1b2){_0x4008f0=_0x4008f0-0x0;var _0xb42e88=_0x8bf9[_0x4008f0];return _0xb42e88;};'use strict';var Sequelize=require(_0x98bf('0x0'));module[_0x98bf('0x1')]={'name':{'type':Sequelize[_0x98bf('0x2')]},'description':{'type':Sequelize[_0x98bf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f9dcf23..74ed595 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 _0x006e=['stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','show','keys','find','create','body','catch','params','SugarcrmField','getFields','getSubjects','hasOwnProperty','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','then','sendStatus'];(function(_0x43564b,_0x25a3aa){var _0x3375e4=function(_0x2bc55d){while(--_0x2bc55d){_0x43564b['push'](_0x43564b['shift']());}};_0x3375e4(++_0x25a3aa);}(_0x006e,0xc0));var _0xe006=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x006e[_0x1f239e];return _0x826971;};'use strict';var emlformat=require(_0xe006('0x0'));var rimraf=require(_0xe006('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe006('0x2'));var rp=require(_0xe006('0x3'));var moment=require(_0xe006('0x4'));var BPromise=require(_0xe006('0x5'));var Mustache=require(_0xe006('0x6'));var util=require('util');var path=require(_0xe006('0x7'));var sox=require(_0xe006('0x8'));var csv=require(_0xe006('0x9'));var ejs=require(_0xe006('0xa'));var fs=require('fs');var fs_extra=require(_0xe006('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe006('0xc'));var jsforce=require(_0xe006('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe006('0xe'));var Papa=require('papaparse');var Redis=require(_0xe006('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe006('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe006('0x11'));var logger=require(_0xe006('0x12'))(_0xe006('0x13'));var utils=require(_0xe006('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe006('0x15'));var db=require(_0xe006('0x16'))['db'];function respondWithStatusCode(_0xf8cc8b,_0x292770){_0x292770=_0x292770||0xcc;return function(_0x332c9e){if(_0x332c9e){return _0xf8cc8b['sendStatus'](_0x292770);}return _0xf8cc8b[_0xe006('0x17')](_0x292770)['end']();};}function respondWithResult(_0x484696,_0xed9829){_0xed9829=_0xed9829||0xc8;return function(_0x2aec5d){if(_0x2aec5d){return _0x484696[_0xe006('0x17')](_0xed9829)[_0xe006('0x18')](_0x2aec5d);}};}function respondWithFilteredResult(_0x41cc9b,_0x363e5a){return function(_0x1406fa){if(_0x1406fa){var _0x3430a5=typeof _0x363e5a[_0xe006('0x19')]==='undefined'&&typeof _0x363e5a[_0xe006('0x1a')]===_0xe006('0x1b');var _0xa60acf=_0x1406fa[_0xe006('0x1c')];var _0xd09dc6=_0x3430a5?0x0:_0x363e5a[_0xe006('0x19')];var _0x55852e=_0x3430a5?_0x1406fa[_0xe006('0x1c')]:_0x363e5a[_0xe006('0x19')]+_0x363e5a[_0xe006('0x1a')];var _0x420aae;if(_0x55852e>=_0xa60acf){_0x55852e=_0xa60acf;_0x420aae=0xc8;}else{_0x420aae=0xce;}_0x41cc9b[_0xe006('0x17')](_0x420aae);return _0x41cc9b[_0xe006('0x1d')]('Content-Range',_0xd09dc6+'-'+_0x55852e+'/'+_0xa60acf)[_0xe006('0x18')](_0x1406fa);}return null;};}function patchUpdates(_0x44327){return function(_0x1d1c84){try{jsonpatch[_0xe006('0x1e')](_0x1d1c84,_0x44327,!![]);}catch(_0x52f60a){return BPromise['reject'](_0x52f60a);}return _0x1d1c84[_0xe006('0x1f')]();};}function saveUpdates(_0x4325d0,_0x1db662){return function(_0x430912){if(_0x430912){return _0x430912[_0xe006('0x20')](_0x4325d0)['then'](function(_0x27b69e){return _0x27b69e;});}return null;};}function removeEntity(_0x2e08e4,_0x2521bb){return function(_0x20a082){if(_0x20a082){return _0x20a082[_0xe006('0x21')]()[_0xe006('0x22')](function(){_0x2e08e4[_0xe006('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddfed,_0x4e6513){return function(_0x3b4e6d){if(!_0x3b4e6d){_0x1ddfed[_0xe006('0x23')](0x194);}return _0x3b4e6d;};}function handleError(_0x28b8c5,_0x16576c){_0x16576c=_0x16576c||0x1f4;return function(_0x4defdd){logger['error'](_0x4defdd[_0xe006('0x24')]);if(_0x4defdd[_0xe006('0x25')]){delete _0x4defdd[_0xe006('0x25')];}_0x28b8c5[_0xe006('0x17')](_0x16576c)[_0xe006('0x26')](_0x4defdd);};}exports[_0xe006('0x27')]=function(_0x113499,_0x4dab1b){var _0x388f88={},_0x1b71b8={},_0x389354={'count':0x0,'rows':[]};var _0x9299aa=_['map'](db[_0xe006('0x28')][_0xe006('0x29')],function(_0x383436){return{'name':_0x383436['fieldName'],'type':_0x383436[_0xe006('0x2a')][_0xe006('0x2b')]};});_0x1b71b8[_0xe006('0x2c')]=_['map'](_0x9299aa,_0xe006('0x25'));_0x1b71b8[_0xe006('0x2d')]=_['keys'](_0x113499[_0xe006('0x2d')]);_0x1b71b8[_0xe006('0x2e')]=_[_0xe006('0x2f')](_0x1b71b8[_0xe006('0x2c')],_0x1b71b8['query']);_0x388f88[_0xe006('0x30')]=_[_0xe006('0x2f')](_0x1b71b8[_0xe006('0x2c')],qs[_0xe006('0x31')](_0x113499[_0xe006('0x2d')][_0xe006('0x31')]));_0x388f88['attributes']=_0x388f88['attributes'][_0xe006('0x32')]?_0x388f88[_0xe006('0x30')]:_0x1b71b8[_0xe006('0x2c')];if(!_0x113499[_0xe006('0x2d')]['hasOwnProperty'](_0xe006('0x33'))){_0x388f88[_0xe006('0x1a')]=qs[_0xe006('0x1a')](_0x113499[_0xe006('0x2d')]['limit']);_0x388f88[_0xe006('0x19')]=qs[_0xe006('0x19')](_0x113499[_0xe006('0x2d')][_0xe006('0x19')]);}_0x388f88[_0xe006('0x34')]=qs['sort'](_0x113499[_0xe006('0x2d')][_0xe006('0x35')]);_0x388f88[_0xe006('0x36')]=qs['filters'](_[_0xe006('0x37')](_0x113499[_0xe006('0x2d')],_0x1b71b8[_0xe006('0x2e')]),_0x9299aa);if(_0x113499[_0xe006('0x2d')][_0xe006('0x38')]){_0x388f88[_0xe006('0x36')]=_[_0xe006('0x39')](_0x388f88['where'],{'$or':_[_0xe006('0x3a')](_0x9299aa,function(_0x546baf){if(_0x546baf[_0xe006('0x2a')]!=='VIRTUAL'){var _0x25a62d={};_0x25a62d[_0x546baf['name']]={'$like':'%'+_0x113499[_0xe006('0x2d')]['filter']+'%'};return _0x25a62d;}})});}_0x388f88=_['merge']({},_0x388f88,_0x113499[_0xe006('0x3b')]);var _0x4d97e2={'where':_0x388f88[_0xe006('0x36')]};return db[_0xe006('0x28')][_0xe006('0x1c')](_0x4d97e2)[_0xe006('0x22')](function(_0x3ceb11){_0x389354[_0xe006('0x1c')]=_0x3ceb11;if(_0x113499[_0xe006('0x2d')][_0xe006('0x3c')]){_0x388f88[_0xe006('0x3d')]=[{'all':!![]}];}return db[_0xe006('0x28')]['findAll'](_0x388f88);})[_0xe006('0x22')](function(_0x4e5eb0){_0x389354[_0xe006('0x3e')]=_0x4e5eb0;return _0x389354;})[_0xe006('0x22')](respondWithFilteredResult(_0x4dab1b,_0x388f88))['catch'](handleError(_0x4dab1b,null));};exports[_0xe006('0x3f')]=function(_0x46ea10,_0x5b36dc){var _0x443272={'raw':![],'where':{'id':_0x46ea10['params']['id']}},_0x34191={};_0x34191[_0xe006('0x2c')]=_[_0xe006('0x40')](db[_0xe006('0x28')][_0xe006('0x29')]);_0x34191[_0xe006('0x2d')]=_[_0xe006('0x40')](_0x46ea10[_0xe006('0x2d')]);_0x34191[_0xe006('0x2e')]=_[_0xe006('0x2f')](_0x34191['model'],_0x34191[_0xe006('0x2d')]);_0x443272[_0xe006('0x30')]=_[_0xe006('0x2f')](_0x34191['model'],qs[_0xe006('0x31')](_0x46ea10[_0xe006('0x2d')][_0xe006('0x31')]));_0x443272[_0xe006('0x30')]=_0x443272[_0xe006('0x30')]['length']?_0x443272[_0xe006('0x30')]:_0x34191[_0xe006('0x2c')];if(_0x46ea10[_0xe006('0x2d')][_0xe006('0x3c')]){_0x443272[_0xe006('0x3d')]=[{'all':!![]}];}_0x443272=_[_0xe006('0x39')]({},_0x443272,_0x46ea10[_0xe006('0x3b')]);return db[_0xe006('0x28')][_0xe006('0x41')](_0x443272)['then'](handleEntityNotFound(_0x5b36dc,null))[_0xe006('0x22')](respondWithResult(_0x5b36dc,null))['catch'](handleError(_0x5b36dc,null));};exports[_0xe006('0x42')]=function(_0x449489,_0x499c8c){return db[_0xe006('0x28')][_0xe006('0x42')](_0x449489[_0xe006('0x43')],{})['then'](respondWithResult(_0x499c8c,0xc9))[_0xe006('0x44')](handleError(_0x499c8c,null));};exports['update']=function(_0x104664,_0x344f76){if(_0x104664[_0xe006('0x43')]['id']){delete _0x104664[_0xe006('0x43')]['id'];}return db[_0xe006('0x28')]['find']({'where':{'id':_0x104664[_0xe006('0x45')]['id']}})[_0xe006('0x22')](handleEntityNotFound(_0x344f76,null))[_0xe006('0x22')](saveUpdates(_0x104664[_0xe006('0x43')],null))[_0xe006('0x22')](respondWithResult(_0x344f76,null))[_0xe006('0x44')](handleError(_0x344f76,null));};exports['destroy']=function(_0x25cacf,_0x43d11c){return db[_0xe006('0x28')]['find']({'where':{'id':_0x25cacf['params']['id']}})[_0xe006('0x22')](handleEntityNotFound(_0x43d11c,null))[_0xe006('0x22')](removeEntity(_0x43d11c,null))[_0xe006('0x44')](handleError(_0x43d11c,null));};exports['getFields']=function(_0x161345,_0x148ce8,_0x37a922){var _0x16e571={};var _0x47715b={};var _0x3b8d96;var _0x2e17f7;return db[_0xe006('0x28')]['findOne']({'where':{'id':_0x161345[_0xe006('0x45')]['id']}})['then'](handleEntityNotFound(_0x148ce8,null))[_0xe006('0x22')](function(_0x510f4b){if(_0x510f4b){_0x3b8d96=_0x510f4b;_0x47715b[_0xe006('0x2c')]=_[_0xe006('0x40')](db[_0xe006('0x46')][_0xe006('0x29')]);_0x47715b['query']=_[_0xe006('0x40')](_0x161345[_0xe006('0x2d')]);_0x47715b[_0xe006('0x2e')]=_['intersection'](_0x47715b[_0xe006('0x2c')],_0x47715b[_0xe006('0x2d')]);_0x16e571[_0xe006('0x30')]=_[_0xe006('0x2f')](_0x47715b[_0xe006('0x2c')],qs[_0xe006('0x31')](_0x161345[_0xe006('0x2d')][_0xe006('0x31')]));_0x16e571[_0xe006('0x30')]=_0x16e571['attributes'][_0xe006('0x32')]?_0x16e571[_0xe006('0x30')]:_0x47715b[_0xe006('0x2c')];_0x16e571['order']=qs[_0xe006('0x35')](_0x161345[_0xe006('0x2d')][_0xe006('0x35')]);_0x16e571['where']=qs['filters'](_[_0xe006('0x37')](_0x161345[_0xe006('0x2d')],_0x47715b[_0xe006('0x2e')]));if(_0x161345[_0xe006('0x2d')][_0xe006('0x38')]){_0x16e571['where']=_[_0xe006('0x39')](_0x16e571['where'],{'$or':_['map'](_0x16e571[_0xe006('0x30')],function(_0x2d0b4b){var _0x436e7d={};_0x436e7d[_0x2d0b4b]={'$like':'%'+_0x161345['query']['filter']+'%'};return _0x436e7d;})});}_0x16e571=_[_0xe006('0x39')]({},_0x16e571,_0x161345['options']);return _0x3b8d96[_0xe006('0x47')](_0x16e571);}})['then'](function(_0x2ead74){if(_0x2ead74){_0x2e17f7=_0x2ead74[_0xe006('0x32')];if(!_0x161345['query']['hasOwnProperty'](_0xe006('0x33'))){_0x16e571['limit']=qs[_0xe006('0x1a')](_0x161345[_0xe006('0x2d')]['limit']);_0x16e571[_0xe006('0x19')]=qs['offset'](_0x161345['query']['offset']);}return _0x3b8d96[_0xe006('0x47')](_0x16e571);}})[_0xe006('0x22')](function(_0x133363){if(_0x133363){return _0x133363?{'count':_0x2e17f7,'rows':_0x133363}:null;}})[_0xe006('0x22')](respondWithResult(_0x148ce8,null))[_0xe006('0x44')](handleError(_0x148ce8,null));};exports[_0xe006('0x48')]=function(_0x1f6773,_0x18ec10,_0x263910){var _0x3698e9={};var _0x3870f9={};var _0x2734f6;var _0x28afc8;return db[_0xe006('0x28')]['findOne']({'where':{'id':_0x1f6773['params']['id']}})[_0xe006('0x22')](handleEntityNotFound(_0x18ec10,null))[_0xe006('0x22')](function(_0x2ebf73){if(_0x2ebf73){_0x2734f6=_0x2ebf73;_0x3870f9['model']=_['keys'](db[_0xe006('0x46')][_0xe006('0x29')]);_0x3870f9[_0xe006('0x2d')]=_[_0xe006('0x40')](_0x1f6773['query']);_0x3870f9['filters']=_[_0xe006('0x2f')](_0x3870f9[_0xe006('0x2c')],_0x3870f9[_0xe006('0x2d')]);_0x3698e9[_0xe006('0x30')]=_[_0xe006('0x2f')](_0x3870f9['model'],qs['fields'](_0x1f6773[_0xe006('0x2d')][_0xe006('0x31')]));_0x3698e9[_0xe006('0x30')]=_0x3698e9['attributes'][_0xe006('0x32')]?_0x3698e9[_0xe006('0x30')]:_0x3870f9[_0xe006('0x2c')];_0x3698e9[_0xe006('0x34')]=qs[_0xe006('0x35')](_0x1f6773[_0xe006('0x2d')][_0xe006('0x35')]);_0x3698e9[_0xe006('0x36')]=qs[_0xe006('0x2e')](_[_0xe006('0x37')](_0x1f6773[_0xe006('0x2d')],_0x3870f9[_0xe006('0x2e')]));if(_0x1f6773[_0xe006('0x2d')]['filter']){_0x3698e9['where']=_[_0xe006('0x39')](_0x3698e9[_0xe006('0x36')],{'$or':_[_0xe006('0x3a')](_0x3698e9[_0xe006('0x30')],function(_0x13c345){var _0x49a999={};_0x49a999[_0x13c345]={'$like':'%'+_0x1f6773[_0xe006('0x2d')][_0xe006('0x38')]+'%'};return _0x49a999;})});}_0x3698e9=_[_0xe006('0x39')]({},_0x3698e9,_0x1f6773[_0xe006('0x3b')]);return _0x2734f6[_0xe006('0x48')](_0x3698e9);}})[_0xe006('0x22')](function(_0x4b2a6c){if(_0x4b2a6c){_0x28afc8=_0x4b2a6c[_0xe006('0x32')];if(!_0x1f6773[_0xe006('0x2d')][_0xe006('0x49')](_0xe006('0x33'))){_0x3698e9[_0xe006('0x1a')]=qs['limit'](_0x1f6773[_0xe006('0x2d')][_0xe006('0x1a')]);_0x3698e9['offset']=qs[_0xe006('0x19')](_0x1f6773['query']['offset']);}return _0x2734f6[_0xe006('0x48')](_0x3698e9);}})['then'](function(_0x4a7068){if(_0x4a7068){return _0x4a7068?{'count':_0x28afc8,'rows':_0x4a7068}:null;}})[_0xe006('0x22')](respondWithResult(_0x18ec10,null))[_0xe006('0x44')](handleError(_0x18ec10,null));};exports['getDescriptions']=function(_0x183d7d,_0x58ba11,_0x24016b){var _0x4d9ed5={};var _0x3cb07e={};var _0x16a32c;var _0x3812fd;return db[_0xe006('0x28')][_0xe006('0x4a')]({'where':{'id':_0x183d7d[_0xe006('0x45')]['id']}})[_0xe006('0x22')](handleEntityNotFound(_0x58ba11,null))['then'](function(_0x38775c){if(_0x38775c){_0x16a32c=_0x38775c;_0x3cb07e['model']=_[_0xe006('0x40')](db[_0xe006('0x46')][_0xe006('0x29')]);_0x3cb07e[_0xe006('0x2d')]=_[_0xe006('0x40')](_0x183d7d[_0xe006('0x2d')]);_0x3cb07e[_0xe006('0x2e')]=_[_0xe006('0x2f')](_0x3cb07e[_0xe006('0x2c')],_0x3cb07e[_0xe006('0x2d')]);_0x4d9ed5[_0xe006('0x30')]=_[_0xe006('0x2f')](_0x3cb07e[_0xe006('0x2c')],qs[_0xe006('0x31')](_0x183d7d[_0xe006('0x2d')][_0xe006('0x31')]));_0x4d9ed5[_0xe006('0x30')]=_0x4d9ed5[_0xe006('0x30')][_0xe006('0x32')]?_0x4d9ed5[_0xe006('0x30')]:_0x3cb07e['model'];_0x4d9ed5['order']=qs['sort'](_0x183d7d[_0xe006('0x2d')][_0xe006('0x35')]);_0x4d9ed5['where']=qs[_0xe006('0x2e')](_[_0xe006('0x37')](_0x183d7d[_0xe006('0x2d')],_0x3cb07e['filters']));if(_0x183d7d[_0xe006('0x2d')]['filter']){_0x4d9ed5[_0xe006('0x36')]=_['merge'](_0x4d9ed5[_0xe006('0x36')],{'$or':_[_0xe006('0x3a')](_0x4d9ed5[_0xe006('0x30')],function(_0xf8ab2a){var _0xc53aa9={};_0xc53aa9[_0xf8ab2a]={'$like':'%'+_0x183d7d[_0xe006('0x2d')][_0xe006('0x38')]+'%'};return _0xc53aa9;})});}_0x4d9ed5=_[_0xe006('0x39')]({},_0x4d9ed5,_0x183d7d['options']);return _0x16a32c[_0xe006('0x4b')](_0x4d9ed5);}})[_0xe006('0x22')](function(_0x126955){if(_0x126955){_0x3812fd=_0x126955[_0xe006('0x32')];if(!_0x183d7d['query']['hasOwnProperty'](_0xe006('0x33'))){_0x4d9ed5['limit']=qs['limit'](_0x183d7d[_0xe006('0x2d')]['limit']);_0x4d9ed5[_0xe006('0x19')]=qs[_0xe006('0x19')](_0x183d7d[_0xe006('0x2d')][_0xe006('0x19')]);}return _0x16a32c[_0xe006('0x4b')](_0x4d9ed5);}})[_0xe006('0x22')](function(_0x4036bb){if(_0x4036bb){return _0x4036bb?{'count':_0x3812fd,'rows':_0x4036bb}:null;}})[_0xe006('0x22')](respondWithResult(_0x58ba11,null))[_0xe006('0x44')](handleError(_0x58ba11,null));}; \ No newline at end of file +var _0x69c7=['querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','SugarcrmConfiguration','findAll','rows','catch','show','length','includeAll','create','body','find','params','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js'];(function(_0x12c128,_0x300fba){var _0xf4e6ea=function(_0x3da639){while(--_0x3da639){_0x12c128['push'](_0x12c128['shift']());}};_0xf4e6ea(++_0x300fba);}(_0x69c7,0x12c));var _0x769c=function(_0x350e3d,_0x126558){_0x350e3d=_0x350e3d-0x0;var _0x3caae5=_0x69c7[_0x350e3d];return _0x3caae5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x769c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x769c('0x1'));var rp=require('request-promise');var moment=require(_0x769c('0x2'));var BPromise=require(_0x769c('0x3'));var Mustache=require(_0x769c('0x4'));var util=require('util');var path=require(_0x769c('0x5'));var sox=require('sox');var csv=require(_0x769c('0x6'));var ejs=require(_0x769c('0x7'));var fs=require('fs');var fs_extra=require(_0x769c('0x8'));var _=require(_0x769c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x769c('0xa'));var deskjs=require(_0x769c('0xb'));var toCsv=require(_0x769c('0x6'));var querystring=require(_0x769c('0xc'));var Papa=require(_0x769c('0xd'));var Redis=require(_0x769c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x769c('0xf'));var logger=require(_0x769c('0x10'))(_0x769c('0x11'));var utils=require(_0x769c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x769c('0x13'));var db=require(_0x769c('0x14'))['db'];function respondWithStatusCode(_0xb498ba,_0xb29713){_0xb29713=_0xb29713||0xcc;return function(_0x5201a7){if(_0x5201a7){return _0xb498ba[_0x769c('0x15')](_0xb29713);}return _0xb498ba[_0x769c('0x16')](_0xb29713)[_0x769c('0x17')]();};}function respondWithResult(_0x504df8,_0x4094d7){_0x4094d7=_0x4094d7||0xc8;return function(_0x184795){if(_0x184795){return _0x504df8[_0x769c('0x16')](_0x4094d7)[_0x769c('0x18')](_0x184795);}};}function respondWithFilteredResult(_0x2d2e49,_0x272c5e){return function(_0x408f20){if(_0x408f20){var _0x325e17=typeof _0x272c5e[_0x769c('0x19')]===_0x769c('0x1a')&&typeof _0x272c5e[_0x769c('0x1b')]==='undefined';var _0x2f86f8=_0x408f20[_0x769c('0x1c')];var _0x3e9c31=_0x325e17?0x0:_0x272c5e['offset'];var _0x1219e7=_0x325e17?_0x408f20[_0x769c('0x1c')]:_0x272c5e[_0x769c('0x19')]+_0x272c5e[_0x769c('0x1b')];var _0x14e7a1;if(_0x1219e7>=_0x2f86f8){_0x1219e7=_0x2f86f8;_0x14e7a1=0xc8;}else{_0x14e7a1=0xce;}_0x2d2e49['status'](_0x14e7a1);return _0x2d2e49[_0x769c('0x1d')](_0x769c('0x1e'),_0x3e9c31+'-'+_0x1219e7+'/'+_0x2f86f8)[_0x769c('0x18')](_0x408f20);}return null;};}function patchUpdates(_0x4ca485){return function(_0x5c3509){try{jsonpatch[_0x769c('0x1f')](_0x5c3509,_0x4ca485,!![]);}catch(_0x5b686d){return BPromise[_0x769c('0x20')](_0x5b686d);}return _0x5c3509[_0x769c('0x21')]();};}function saveUpdates(_0xa20e23,_0x4fc51a){return function(_0x365bff){if(_0x365bff){return _0x365bff[_0x769c('0x22')](_0xa20e23)[_0x769c('0x23')](function(_0x1c455c){return _0x1c455c;});}return null;};}function removeEntity(_0x36d42a,_0x29c4b9){return function(_0x2a3c3d){if(_0x2a3c3d){return _0x2a3c3d[_0x769c('0x24')]()[_0x769c('0x23')](function(){_0x36d42a[_0x769c('0x16')](0xcc)[_0x769c('0x17')]();});}};}function handleEntityNotFound(_0x1c1590,_0x23c8ca){return function(_0xa68a55){if(!_0xa68a55){_0x1c1590[_0x769c('0x15')](0x194);}return _0xa68a55;};}function handleError(_0x508113,_0x2d8e09){_0x2d8e09=_0x2d8e09||0x1f4;return function(_0x1d9da7){logger[_0x769c('0x25')](_0x1d9da7['stack']);if(_0x1d9da7[_0x769c('0x26')]){delete _0x1d9da7['name'];}_0x508113['status'](_0x2d8e09)['send'](_0x1d9da7);};}exports[_0x769c('0x27')]=function(_0x14f46a,_0x174c8f){var _0x4e745c={},_0x234c24={},_0x1a1b45={'count':0x0,'rows':[]};var _0x37db10=_['map'](db['SugarcrmConfiguration'][_0x769c('0x28')],function(_0x28654f){return{'name':_0x28654f['fieldName'],'type':_0x28654f[_0x769c('0x29')][_0x769c('0x2a')]};});_0x234c24[_0x769c('0x2b')]=_[_0x769c('0x2c')](_0x37db10,_0x769c('0x26'));_0x234c24[_0x769c('0x2d')]=_[_0x769c('0x2e')](_0x14f46a[_0x769c('0x2d')]);_0x234c24[_0x769c('0x2f')]=_[_0x769c('0x30')](_0x234c24[_0x769c('0x2b')],_0x234c24[_0x769c('0x2d')]);_0x4e745c['attributes']=_[_0x769c('0x30')](_0x234c24['model'],qs['fields'](_0x14f46a[_0x769c('0x2d')][_0x769c('0x31')]));_0x4e745c[_0x769c('0x32')]=_0x4e745c[_0x769c('0x32')]['length']?_0x4e745c['attributes']:_0x234c24[_0x769c('0x2b')];if(!_0x14f46a['query'][_0x769c('0x33')]('nolimit')){_0x4e745c[_0x769c('0x1b')]=qs[_0x769c('0x1b')](_0x14f46a[_0x769c('0x2d')]['limit']);_0x4e745c['offset']=qs[_0x769c('0x19')](_0x14f46a[_0x769c('0x2d')]['offset']);}_0x4e745c[_0x769c('0x34')]=qs[_0x769c('0x35')](_0x14f46a[_0x769c('0x2d')]['sort']);_0x4e745c[_0x769c('0x36')]=qs[_0x769c('0x2f')](_[_0x769c('0x37')](_0x14f46a[_0x769c('0x2d')],_0x234c24[_0x769c('0x2f')]),_0x37db10);if(_0x14f46a['query'][_0x769c('0x38')]){_0x4e745c[_0x769c('0x36')]=_[_0x769c('0x39')](_0x4e745c[_0x769c('0x36')],{'$or':_[_0x769c('0x2c')](_0x37db10,function(_0x30ba7a){if(_0x30ba7a[_0x769c('0x29')]!==_0x769c('0x3a')){var _0x21f485={};_0x21f485[_0x30ba7a[_0x769c('0x26')]]={'$like':'%'+_0x14f46a['query'][_0x769c('0x38')]+'%'};return _0x21f485;}})});}_0x4e745c=_['merge']({},_0x4e745c,_0x14f46a[_0x769c('0x3b')]);var _0x4e1ac8={'where':_0x4e745c[_0x769c('0x36')]};return db['SugarcrmConfiguration'][_0x769c('0x1c')](_0x4e1ac8)['then'](function(_0x2cad42){_0x1a1b45[_0x769c('0x1c')]=_0x2cad42;if(_0x14f46a['query']['includeAll']){_0x4e745c[_0x769c('0x3c')]=[{'all':!![]}];}return db[_0x769c('0x3d')][_0x769c('0x3e')](_0x4e745c);})[_0x769c('0x23')](function(_0x1d04c2){_0x1a1b45[_0x769c('0x3f')]=_0x1d04c2;return _0x1a1b45;})[_0x769c('0x23')](respondWithFilteredResult(_0x174c8f,_0x4e745c))[_0x769c('0x40')](handleError(_0x174c8f,null));};exports[_0x769c('0x41')]=function(_0x4a534b,_0xcdf54d){var _0x45ebeb={'raw':![],'where':{'id':_0x4a534b['params']['id']}},_0x27713d={};_0x27713d['model']=_[_0x769c('0x2e')](db['SugarcrmConfiguration'][_0x769c('0x28')]);_0x27713d['query']=_[_0x769c('0x2e')](_0x4a534b[_0x769c('0x2d')]);_0x27713d['filters']=_[_0x769c('0x30')](_0x27713d[_0x769c('0x2b')],_0x27713d[_0x769c('0x2d')]);_0x45ebeb[_0x769c('0x32')]=_[_0x769c('0x30')](_0x27713d[_0x769c('0x2b')],qs[_0x769c('0x31')](_0x4a534b[_0x769c('0x2d')][_0x769c('0x31')]));_0x45ebeb[_0x769c('0x32')]=_0x45ebeb[_0x769c('0x32')][_0x769c('0x42')]?_0x45ebeb[_0x769c('0x32')]:_0x27713d[_0x769c('0x2b')];if(_0x4a534b[_0x769c('0x2d')][_0x769c('0x43')]){_0x45ebeb['include']=[{'all':!![]}];}_0x45ebeb=_['merge']({},_0x45ebeb,_0x4a534b[_0x769c('0x3b')]);return db[_0x769c('0x3d')]['find'](_0x45ebeb)[_0x769c('0x23')](handleEntityNotFound(_0xcdf54d,null))[_0x769c('0x23')](respondWithResult(_0xcdf54d,null))['catch'](handleError(_0xcdf54d,null));};exports['create']=function(_0x25b323,_0x4cf4e2){return db['SugarcrmConfiguration'][_0x769c('0x44')](_0x25b323[_0x769c('0x45')],{})[_0x769c('0x23')](respondWithResult(_0x4cf4e2,0xc9))[_0x769c('0x40')](handleError(_0x4cf4e2,null));};exports[_0x769c('0x22')]=function(_0x2f5edb,_0x4c264f){if(_0x2f5edb[_0x769c('0x45')]['id']){delete _0x2f5edb[_0x769c('0x45')]['id'];}return db[_0x769c('0x3d')][_0x769c('0x46')]({'where':{'id':_0x2f5edb[_0x769c('0x47')]['id']}})[_0x769c('0x23')](handleEntityNotFound(_0x4c264f,null))[_0x769c('0x23')](saveUpdates(_0x2f5edb[_0x769c('0x45')],null))['then'](respondWithResult(_0x4c264f,null))['catch'](handleError(_0x4c264f,null));};exports[_0x769c('0x24')]=function(_0x1c60fa,_0x49fd2f){return db[_0x769c('0x3d')]['find']({'where':{'id':_0x1c60fa[_0x769c('0x47')]['id']}})['then'](handleEntityNotFound(_0x49fd2f,null))[_0x769c('0x23')](removeEntity(_0x49fd2f,null))[_0x769c('0x40')](handleError(_0x49fd2f,null));};exports[_0x769c('0x48')]=function(_0x56c356,_0x5af7ca,_0x523d44){var _0x1c3639={};var _0x2ad409={};var _0x2b45c4;var _0x453ef4;return db[_0x769c('0x3d')][_0x769c('0x49')]({'where':{'id':_0x56c356['params']['id']}})[_0x769c('0x23')](handleEntityNotFound(_0x5af7ca,null))[_0x769c('0x23')](function(_0x5ebdf8){if(_0x5ebdf8){_0x2b45c4=_0x5ebdf8;_0x2ad409['model']=_[_0x769c('0x2e')](db[_0x769c('0x4a')]['rawAttributes']);_0x2ad409['query']=_[_0x769c('0x2e')](_0x56c356[_0x769c('0x2d')]);_0x2ad409[_0x769c('0x2f')]=_[_0x769c('0x30')](_0x2ad409[_0x769c('0x2b')],_0x2ad409[_0x769c('0x2d')]);_0x1c3639[_0x769c('0x32')]=_[_0x769c('0x30')](_0x2ad409[_0x769c('0x2b')],qs[_0x769c('0x31')](_0x56c356[_0x769c('0x2d')][_0x769c('0x31')]));_0x1c3639[_0x769c('0x32')]=_0x1c3639[_0x769c('0x32')]['length']?_0x1c3639['attributes']:_0x2ad409[_0x769c('0x2b')];_0x1c3639[_0x769c('0x34')]=qs[_0x769c('0x35')](_0x56c356[_0x769c('0x2d')]['sort']);_0x1c3639[_0x769c('0x36')]=qs[_0x769c('0x2f')](_[_0x769c('0x37')](_0x56c356[_0x769c('0x2d')],_0x2ad409[_0x769c('0x2f')]));if(_0x56c356[_0x769c('0x2d')][_0x769c('0x38')]){_0x1c3639[_0x769c('0x36')]=_[_0x769c('0x39')](_0x1c3639[_0x769c('0x36')],{'$or':_[_0x769c('0x2c')](_0x1c3639[_0x769c('0x32')],function(_0x2e6752){var _0x2ec689={};_0x2ec689[_0x2e6752]={'$like':'%'+_0x56c356[_0x769c('0x2d')][_0x769c('0x38')]+'%'};return _0x2ec689;})});}_0x1c3639=_[_0x769c('0x39')]({},_0x1c3639,_0x56c356[_0x769c('0x3b')]);return _0x2b45c4[_0x769c('0x48')](_0x1c3639);}})[_0x769c('0x23')](function(_0x5d39c1){if(_0x5d39c1){_0x453ef4=_0x5d39c1[_0x769c('0x42')];if(!_0x56c356[_0x769c('0x2d')]['hasOwnProperty'](_0x769c('0x4b'))){_0x1c3639[_0x769c('0x1b')]=qs[_0x769c('0x1b')](_0x56c356[_0x769c('0x2d')]['limit']);_0x1c3639[_0x769c('0x19')]=qs[_0x769c('0x19')](_0x56c356['query'][_0x769c('0x19')]);}return _0x2b45c4['getFields'](_0x1c3639);}})[_0x769c('0x23')](function(_0x39a812){if(_0x39a812){return _0x39a812?{'count':_0x453ef4,'rows':_0x39a812}:null;}})['then'](respondWithResult(_0x5af7ca,null))[_0x769c('0x40')](handleError(_0x5af7ca,null));};exports['getSubjects']=function(_0x1e7a2a,_0x536277,_0x3d9566){var _0x2b7c25={};var _0x128aec={};var _0x2d8c21;var _0x4e6adf;return db[_0x769c('0x3d')][_0x769c('0x49')]({'where':{'id':_0x1e7a2a[_0x769c('0x47')]['id']}})[_0x769c('0x23')](handleEntityNotFound(_0x536277,null))[_0x769c('0x23')](function(_0x557c2d){if(_0x557c2d){_0x2d8c21=_0x557c2d;_0x128aec[_0x769c('0x2b')]=_[_0x769c('0x2e')](db[_0x769c('0x4a')][_0x769c('0x28')]);_0x128aec[_0x769c('0x2d')]=_[_0x769c('0x2e')](_0x1e7a2a[_0x769c('0x2d')]);_0x128aec[_0x769c('0x2f')]=_[_0x769c('0x30')](_0x128aec[_0x769c('0x2b')],_0x128aec[_0x769c('0x2d')]);_0x2b7c25[_0x769c('0x32')]=_[_0x769c('0x30')](_0x128aec[_0x769c('0x2b')],qs[_0x769c('0x31')](_0x1e7a2a['query'][_0x769c('0x31')]));_0x2b7c25[_0x769c('0x32')]=_0x2b7c25[_0x769c('0x32')]['length']?_0x2b7c25[_0x769c('0x32')]:_0x128aec['model'];_0x2b7c25[_0x769c('0x34')]=qs['sort'](_0x1e7a2a['query'][_0x769c('0x35')]);_0x2b7c25[_0x769c('0x36')]=qs['filters'](_['pick'](_0x1e7a2a[_0x769c('0x2d')],_0x128aec['filters']));if(_0x1e7a2a[_0x769c('0x2d')][_0x769c('0x38')]){_0x2b7c25[_0x769c('0x36')]=_[_0x769c('0x39')](_0x2b7c25[_0x769c('0x36')],{'$or':_['map'](_0x2b7c25[_0x769c('0x32')],function(_0x4f18e0){var _0x32457b={};_0x32457b[_0x4f18e0]={'$like':'%'+_0x1e7a2a[_0x769c('0x2d')][_0x769c('0x38')]+'%'};return _0x32457b;})});}_0x2b7c25=_[_0x769c('0x39')]({},_0x2b7c25,_0x1e7a2a['options']);return _0x2d8c21[_0x769c('0x4c')](_0x2b7c25);}})[_0x769c('0x23')](function(_0x1c57fb){if(_0x1c57fb){_0x4e6adf=_0x1c57fb['length'];if(!_0x1e7a2a['query'][_0x769c('0x33')]('nolimit')){_0x2b7c25[_0x769c('0x1b')]=qs[_0x769c('0x1b')](_0x1e7a2a[_0x769c('0x2d')][_0x769c('0x1b')]);_0x2b7c25[_0x769c('0x19')]=qs[_0x769c('0x19')](_0x1e7a2a[_0x769c('0x2d')][_0x769c('0x19')]);}return _0x2d8c21[_0x769c('0x4c')](_0x2b7c25);}})['then'](function(_0x1c0997){if(_0x1c0997){return _0x1c0997?{'count':_0x4e6adf,'rows':_0x1c0997}:null;}})['then'](respondWithResult(_0x536277,null))['catch'](handleError(_0x536277,null));};exports[_0x769c('0x4d')]=function(_0x4fdb94,_0x168f41,_0x5d8dd3){var _0xfe5991={};var _0x3ca6ab={};var _0x72d554;var _0x167a4f;return db[_0x769c('0x3d')][_0x769c('0x49')]({'where':{'id':_0x4fdb94[_0x769c('0x47')]['id']}})['then'](handleEntityNotFound(_0x168f41,null))[_0x769c('0x23')](function(_0x1999ee){if(_0x1999ee){_0x72d554=_0x1999ee;_0x3ca6ab[_0x769c('0x2b')]=_['keys'](db[_0x769c('0x4a')][_0x769c('0x28')]);_0x3ca6ab[_0x769c('0x2d')]=_['keys'](_0x4fdb94['query']);_0x3ca6ab[_0x769c('0x2f')]=_[_0x769c('0x30')](_0x3ca6ab[_0x769c('0x2b')],_0x3ca6ab['query']);_0xfe5991[_0x769c('0x32')]=_[_0x769c('0x30')](_0x3ca6ab[_0x769c('0x2b')],qs[_0x769c('0x31')](_0x4fdb94[_0x769c('0x2d')][_0x769c('0x31')]));_0xfe5991[_0x769c('0x32')]=_0xfe5991[_0x769c('0x32')]['length']?_0xfe5991[_0x769c('0x32')]:_0x3ca6ab[_0x769c('0x2b')];_0xfe5991[_0x769c('0x34')]=qs[_0x769c('0x35')](_0x4fdb94[_0x769c('0x2d')][_0x769c('0x35')]);_0xfe5991[_0x769c('0x36')]=qs[_0x769c('0x2f')](_[_0x769c('0x37')](_0x4fdb94[_0x769c('0x2d')],_0x3ca6ab[_0x769c('0x2f')]));if(_0x4fdb94['query'][_0x769c('0x38')]){_0xfe5991[_0x769c('0x36')]=_[_0x769c('0x39')](_0xfe5991['where'],{'$or':_['map'](_0xfe5991[_0x769c('0x32')],function(_0x2199a6){var _0x3658b4={};_0x3658b4[_0x2199a6]={'$like':'%'+_0x4fdb94['query']['filter']+'%'};return _0x3658b4;})});}_0xfe5991=_['merge']({},_0xfe5991,_0x4fdb94[_0x769c('0x3b')]);return _0x72d554[_0x769c('0x4d')](_0xfe5991);}})[_0x769c('0x23')](function(_0x1942b9){if(_0x1942b9){_0x167a4f=_0x1942b9['length'];if(!_0x4fdb94['query'][_0x769c('0x33')](_0x769c('0x4b'))){_0xfe5991[_0x769c('0x1b')]=qs[_0x769c('0x1b')](_0x4fdb94['query'][_0x769c('0x1b')]);_0xfe5991[_0x769c('0x19')]=qs[_0x769c('0x19')](_0x4fdb94['query'][_0x769c('0x19')]);}return _0x72d554[_0x769c('0x4d')](_0xfe5991);}})['then'](function(_0x279401){if(_0x279401){return _0x279401?{'count':_0x167a4f,'rows':_0x279401}:null;}})['then'](respondWithResult(_0x168f41,null))[_0x769c('0x40')](handleError(_0x168f41,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 468bed6..9f8ad6c 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 _0x4db4=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x4db4,0xbc));var _0x44db=function(_0xde1e9a,_0x283e75){_0xde1e9a=_0xde1e9a-0x0;var _0x1f8500=_0x4db4[_0xde1e9a];return _0x1f8500;};'use strict';var _=require(_0x44db('0x0'));var util=require(_0x44db('0x1'));var logger=require(_0x44db('0x2'))(_0x44db('0x3'));var moment=require(_0x44db('0x4'));var BPromise=require(_0x44db('0x5'));var rp=require(_0x44db('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x44db('0x7'));module[_0x44db('0x8')]=function(_0x42386a,_0x3c3d27){return _0x42386a[_0x44db('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x44db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b1e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x3ddb26,_0x316b94){var _0xed946d=function(_0x273c4d){while(--_0x273c4d){_0x3ddb26['push'](_0x3ddb26['shift']());}};_0xed946d(++_0x316b94);}(_0x8b1e,0xcf));var _0xe8b1=function(_0xa69b69,_0x4d5c26){_0xa69b69=_0xa69b69-0x0;var _0xeb61e8=_0x8b1e[_0xa69b69];return _0xeb61e8;};'use strict';var _=require(_0xe8b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe8b1('0x1'));var moment=require(_0xe8b1('0x2'));var BPromise=require(_0xe8b1('0x3'));var rp=require(_0xe8b1('0x4'));var fs=require('fs');var path=require(_0xe8b1('0x5'));var rimraf=require(_0xe8b1('0x6'));var config=require(_0xe8b1('0x7'));var attributes=require(_0xe8b1('0x8'));module[_0xe8b1('0x9')]=function(_0x24dd69,_0x5e22c6){return _0x24dd69[_0xe8b1('0xa')](_0xe8b1('0xb'),attributes,{'tableName':_0xe8b1('0xc'),'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 037a7af..7d83352 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 _0xa595=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x3e9ece,_0x4a93b6){var _0x172c29=function(_0x1d51e1){while(--_0x1d51e1){_0x3e9ece['push'](_0x3e9ece['shift']());}};_0x172c29(++_0x4a93b6);}(_0xa595,0x12a));var _0x5a59=function(_0x3f19b8,_0x34cd0a){_0x3f19b8=_0x3f19b8-0x0;var _0x5d6fad=_0xa595[_0x3f19b8];return _0x5d6fad;};'use strict';var _=require(_0x5a59('0x0'));var util=require(_0x5a59('0x1'));var moment=require(_0x5a59('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a59('0x3'));var fs=require('fs');var Redis=require(_0x5a59('0x4'));var db=require(_0x5a59('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a59('0x6'))('rpc');var config=require(_0x5a59('0x7'));var jayson=require(_0x5a59('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29d395,_0x2c83a1,_0x52aedb){return new BPromise(function(_0x1517cb,_0x52838a){return client[_0x5a59('0x9')](_0x29d395,_0x52aedb)[_0x5a59('0xa')](function(_0x1b1fa5){logger[_0x5a59('0xb')](_0x5a59('0xc'),_0x2c83a1,_0x5a59('0xd'));logger[_0x5a59('0xe')](_0x5a59('0xf'),_0x2c83a1,'request\x20sent',JSON['stringify'](_0x1b1fa5));if(_0x1b1fa5[_0x5a59('0x10')]){if(_0x1b1fa5[_0x5a59('0x10')][_0x5a59('0x11')]===0x1f4){logger[_0x5a59('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c83a1,_0x1b1fa5[_0x5a59('0x10')][_0x5a59('0x12')]);return _0x52838a(_0x1b1fa5[_0x5a59('0x10')][_0x5a59('0x12')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c83a1,_0x1b1fa5[_0x5a59('0x10')]['message']);return _0x1517cb(_0x1b1fa5[_0x5a59('0x10')][_0x5a59('0x12')]);}else{logger[_0x5a59('0xb')](_0x5a59('0xc'),_0x2c83a1,_0x5a59('0xd'));_0x1517cb(_0x1b1fa5[_0x5a59('0x13')][_0x5a59('0x12')]);}})[_0x5a59('0x14')](function(_0x25d0bf){logger[_0x5a59('0x10')](_0x5a59('0xc'),_0x2c83a1,_0x25d0bf);_0x52838a(_0x25d0bf);});});} \ No newline at end of file +var _0x0c2d=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a6930,_0x1d329e){var _0x9ebbe8=function(_0x1a7698){while(--_0x1a7698){_0x3a6930['push'](_0x3a6930['shift']());}};_0x9ebbe8(++_0x1d329e);}(_0x0c2d,0x1be));var _0xd0c2=function(_0x33b0bb,_0x44a96c){_0x33b0bb=_0x33b0bb-0x0;var _0x2932d1=_0x0c2d[_0x33b0bb];return _0x2932d1;};'use strict';var _=require(_0xd0c2('0x0'));var util=require(_0xd0c2('0x1'));var moment=require('moment');var BPromise=require(_0xd0c2('0x2'));var rs=require(_0xd0c2('0x3'));var fs=require('fs');var Redis=require(_0xd0c2('0x4'));var db=require(_0xd0c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd0c2('0x6'));var config=require(_0xd0c2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd0c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f4ffb,_0x44504f,_0x1ad95f){return new BPromise(function(_0x4a06b5,_0x2d659b){return client[_0xd0c2('0x9')](_0x1f4ffb,_0x1ad95f)['then'](function(_0x2f0439){logger['info'](_0xd0c2('0xa'),_0x44504f,'request\x20sent');logger['debug'](_0xd0c2('0xb'),_0x44504f,_0xd0c2('0xc'),JSON[_0xd0c2('0xd')](_0x2f0439));if(_0x2f0439[_0xd0c2('0xe')]){if(_0x2f0439[_0xd0c2('0xe')][_0xd0c2('0xf')]===0x1f4){logger[_0xd0c2('0xe')](_0xd0c2('0xa'),_0x44504f,_0x2f0439[_0xd0c2('0xe')][_0xd0c2('0x10')]);return _0x2d659b(_0x2f0439[_0xd0c2('0xe')][_0xd0c2('0x10')]);}logger['error'](_0xd0c2('0xa'),_0x44504f,_0x2f0439[_0xd0c2('0xe')][_0xd0c2('0x10')]);return _0x4a06b5(_0x2f0439['error'][_0xd0c2('0x10')]);}else{logger[_0xd0c2('0x11')](_0xd0c2('0xa'),_0x44504f,'request\x20sent');_0x4a06b5(_0x2f0439[_0xd0c2('0x12')]['message']);}})[_0xd0c2('0x13')](function(_0x358b90){logger[_0xd0c2('0xe')](_0xd0c2('0xa'),_0x44504f,_0x358b90);_0x2d659b(_0x358b90);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d01558f..ec36a6e 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 _0x7098=['fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','create','put','/:id','delete','destroy','multer','util','path','express','Router'];(function(_0x22b189,_0x38f234){var _0x1d180a=function(_0x562a31){while(--_0x562a31){_0x22b189['push'](_0x22b189['shift']());}};_0x1d180a(++_0x38f234);}(_0x7098,0xa5));var _0x8709=function(_0x1eba6a,_0x48fb2b){_0x1eba6a=_0x1eba6a-0x0;var _0x49aa98=_0x7098[_0x1eba6a];return _0x49aa98;};'use strict';var multer=require(_0x8709('0x0'));var util=require(_0x8709('0x1'));var path=require(_0x8709('0x2'));var timeout=require('connect-timeout');var express=require(_0x8709('0x3'));var router=express[_0x8709('0x4')]();var fs_extra=require(_0x8709('0x5'));var auth=require(_0x8709('0x6'));var interaction=require(_0x8709('0x7'));var config=require('../../config/environment');var controller=require(_0x8709('0x8'));router['get']('/',auth[_0x8709('0x9')](),controller[_0x8709('0xa')]);router[_0x8709('0xb')]('/:id',auth[_0x8709('0x9')](),controller['show']);router['post']('/',auth[_0x8709('0x9')](),controller[_0x8709('0xc')]);router[_0x8709('0xd')](_0x8709('0xe'),auth[_0x8709('0x9')](),controller['update']);router[_0x8709('0xf')](_0x8709('0xe'),auth[_0x8709('0x9')](),controller[_0x8709('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcc7b=['Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','create','put','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x37cca2,_0x28e492){var _0x2dfe50=function(_0x2327db){while(--_0x2327db){_0x37cca2['push'](_0x37cca2['shift']());}};_0x2dfe50(++_0x28e492);}(_0xcc7b,0x1dd));var _0xbcc7=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xcc7b[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xbcc7('0x0'));var util=require(_0xbcc7('0x1'));var path=require('path');var timeout=require(_0xbcc7('0x2'));var express=require('express');var router=express[_0xbcc7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbcc7('0x4'));var interaction=require(_0xbcc7('0x5'));var config=require('../../config/environment');var controller=require(_0xbcc7('0x6'));router[_0xbcc7('0x7')]('/',auth[_0xbcc7('0x8')](),controller['index']);router[_0xbcc7('0x7')]('/:id',auth[_0xbcc7('0x8')](),controller['show']);router['post']('/',auth[_0xbcc7('0x8')](),controller[_0xbcc7('0x9')]);router[_0xbcc7('0xa')](_0xbcc7('0xb'),auth[_0xbcc7('0x8')](),controller[_0xbcc7('0xc')]);router[_0xbcc7('0xd')](_0xbcc7('0xb'),auth[_0xbcc7('0x8')](),controller[_0xbcc7('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 80310fd..1268c44 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 _0x288a=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist','STRING','variable'];(function(_0x147317,_0x53abc2){var _0x1ef42b=function(_0x46175c){while(--_0x46175c){_0x147317['push'](_0x147317['shift']());}};_0x1ef42b(++_0x53abc2);}(_0x288a,0xc7));var _0xa288=function(_0x196967,_0x42720a){_0x196967=_0x196967-0x0;var _0x24b193=_0x288a[_0x196967];return _0x24b193;};'use strict';var Sequelize=require(_0xa288('0x0'));module[_0xa288('0x1')]={'type':{'type':Sequelize[_0xa288('0x2')](_0xa288('0x3'),'variable',_0xa288('0x4'),'keyValue',_0xa288('0x5')),'defaultValue':_0xa288('0x3')},'content':{'type':Sequelize[_0xa288('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa288('0x2')](_0xa288('0x3'),_0xa288('0x7'),_0xa288('0x4'))},'keyContent':{'type':Sequelize[_0xa288('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa288('0x6')]},'customField':{'type':Sequelize[_0xa288('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa288('0x6')]}}; \ No newline at end of file +var _0x1699=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2b2c9b,_0x4363cb){var _0x1a312e=function(_0x2d446c){while(--_0x2d446c){_0x2b2c9b['push'](_0x2b2c9b['shift']());}};_0x1a312e(++_0x4363cb);}(_0x1699,0x13d));var _0x9169=function(_0x1ae975,_0x70b40e){_0x1ae975=_0x1ae975-0x0;var _0x2576ca=_0x1699[_0x1ae975];return _0x2576ca;};'use strict';var Sequelize=require(_0x9169('0x0'));module[_0x9169('0x1')]={'type':{'type':Sequelize[_0x9169('0x2')](_0x9169('0x3'),_0x9169('0x4'),_0x9169('0x5'),_0x9169('0x6'),_0x9169('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9169('0x8')]},'key':{'type':Sequelize[_0x9169('0x8')]},'keyType':{'type':Sequelize[_0x9169('0x2')](_0x9169('0x3'),_0x9169('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x9169('0x8')]},'idField':{'type':Sequelize[_0x9169('0x8')]},'nameField':{'type':Sequelize[_0x9169('0x8')]},'customField':{'type':Sequelize[_0x9169('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9169('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 765be59..20f38cb 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 _0x8af8=['options','includeAll','findAll','rows','catch','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x12ec65,_0x5bd7c9){var _0x28502f=function(_0x3958de){while(--_0x3958de){_0x12ec65['push'](_0x12ec65['shift']());}};_0x28502f(++_0x5bd7c9);}(_0x8af8,0x1c7));var _0x88af=function(_0x543de2,_0x150eb2){_0x543de2=_0x543de2-0x0;var _0x28af80=_0x8af8[_0x543de2];return _0x28af80;};'use strict';var emlformat=require(_0x88af('0x0'));var rimraf=require(_0x88af('0x1'));var zipdir=require(_0x88af('0x2'));var jsonpatch=require(_0x88af('0x3'));var rp=require(_0x88af('0x4'));var moment=require('moment');var BPromise=require(_0x88af('0x5'));var Mustache=require(_0x88af('0x6'));var util=require(_0x88af('0x7'));var path=require(_0x88af('0x8'));var sox=require(_0x88af('0x9'));var csv=require(_0x88af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x88af('0xb'));var crypto=require(_0x88af('0xc'));var jsforce=require(_0x88af('0xd'));var deskjs=require(_0x88af('0xe'));var toCsv=require(_0x88af('0xa'));var querystring=require(_0x88af('0xf'));var Papa=require(_0x88af('0x10'));var Redis=require(_0x88af('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x88af('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88af('0x13'));var logger=require(_0x88af('0x14'))(_0x88af('0x15'));var utils=require(_0x88af('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x88af('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x188f21,_0x544b7d){_0x544b7d=_0x544b7d||0xcc;return function(_0x2d716b){if(_0x2d716b){return _0x188f21[_0x88af('0x18')](_0x544b7d);}return _0x188f21[_0x88af('0x19')](_0x544b7d)['end']();};}function respondWithResult(_0x3236c4,_0x18e0f9){_0x18e0f9=_0x18e0f9||0xc8;return function(_0x5a610c){if(_0x5a610c){return _0x3236c4['status'](_0x18e0f9)[_0x88af('0x1a')](_0x5a610c);}};}function respondWithFilteredResult(_0x40cd76,_0x262b24){return function(_0x2545ec){if(_0x2545ec){var _0x319316=typeof _0x262b24[_0x88af('0x1b')]===_0x88af('0x1c')&&typeof _0x262b24['limit']===_0x88af('0x1c');var _0x2a949b=_0x2545ec['count'];var _0x39f0f3=_0x319316?0x0:_0x262b24[_0x88af('0x1b')];var _0x1b8bb6=_0x319316?_0x2545ec[_0x88af('0x1d')]:_0x262b24[_0x88af('0x1b')]+_0x262b24[_0x88af('0x1e')];var _0x2bf8df;if(_0x1b8bb6>=_0x2a949b){_0x1b8bb6=_0x2a949b;_0x2bf8df=0xc8;}else{_0x2bf8df=0xce;}_0x40cd76[_0x88af('0x19')](_0x2bf8df);return _0x40cd76[_0x88af('0x1f')](_0x88af('0x20'),_0x39f0f3+'-'+_0x1b8bb6+'/'+_0x2a949b)[_0x88af('0x1a')](_0x2545ec);}return null;};}function patchUpdates(_0x9c5a4a){return function(_0x165812){try{jsonpatch[_0x88af('0x21')](_0x165812,_0x9c5a4a,!![]);}catch(_0x247660){return BPromise[_0x88af('0x22')](_0x247660);}return _0x165812['save']();};}function saveUpdates(_0x35479f,_0xea1578){return function(_0x50a067){if(_0x50a067){return _0x50a067[_0x88af('0x23')](_0x35479f)['then'](function(_0x2eab93){return _0x2eab93;});}return null;};}function removeEntity(_0x152ac7,_0xf49257){return function(_0xbbfe97){if(_0xbbfe97){return _0xbbfe97['destroy']()[_0x88af('0x24')](function(){_0x152ac7[_0x88af('0x19')](0xcc)[_0x88af('0x25')]();});}};}function handleEntityNotFound(_0x1d2168,_0x3d19d9){return function(_0x5d0f57){if(!_0x5d0f57){_0x1d2168[_0x88af('0x18')](0x194);}return _0x5d0f57;};}function handleError(_0x3c7eb6,_0x4b5c0e){_0x4b5c0e=_0x4b5c0e||0x1f4;return function(_0x27463b){logger[_0x88af('0x26')](_0x27463b[_0x88af('0x27')]);if(_0x27463b['name']){delete _0x27463b[_0x88af('0x28')];}_0x3c7eb6[_0x88af('0x19')](_0x4b5c0e)[_0x88af('0x29')](_0x27463b);};}exports['index']=function(_0x2a9d20,_0x47baff){var _0xff76c7={},_0x5c04cc={},_0x5773a7={'count':0x0,'rows':[]};var _0x26440a=_[_0x88af('0x2a')](db[_0x88af('0x2b')][_0x88af('0x2c')],function(_0x59590f){return{'name':_0x59590f[_0x88af('0x2d')],'type':_0x59590f[_0x88af('0x2e')]['key']};});_0x5c04cc[_0x88af('0x2f')]=_[_0x88af('0x2a')](_0x26440a,_0x88af('0x28'));_0x5c04cc[_0x88af('0x30')]=_['keys'](_0x2a9d20[_0x88af('0x30')]);_0x5c04cc[_0x88af('0x31')]=_['intersection'](_0x5c04cc[_0x88af('0x2f')],_0x5c04cc[_0x88af('0x30')]);_0xff76c7['attributes']=_[_0x88af('0x32')](_0x5c04cc[_0x88af('0x2f')],qs['fields'](_0x2a9d20[_0x88af('0x30')][_0x88af('0x33')]));_0xff76c7[_0x88af('0x34')]=_0xff76c7[_0x88af('0x34')][_0x88af('0x35')]?_0xff76c7[_0x88af('0x34')]:_0x5c04cc['model'];if(!_0x2a9d20['query'][_0x88af('0x36')](_0x88af('0x37'))){_0xff76c7['limit']=qs[_0x88af('0x1e')](_0x2a9d20[_0x88af('0x30')][_0x88af('0x1e')]);_0xff76c7['offset']=qs['offset'](_0x2a9d20[_0x88af('0x30')]['offset']);}_0xff76c7[_0x88af('0x38')]=qs['sort'](_0x2a9d20[_0x88af('0x30')][_0x88af('0x39')]);_0xff76c7[_0x88af('0x3a')]=qs[_0x88af('0x31')](_[_0x88af('0x3b')](_0x2a9d20['query'],_0x5c04cc[_0x88af('0x31')]),_0x26440a);if(_0x2a9d20['query'][_0x88af('0x3c')]){_0xff76c7[_0x88af('0x3a')]=_['merge'](_0xff76c7[_0x88af('0x3a')],{'$or':_[_0x88af('0x2a')](_0x26440a,function(_0x55ccf4){if(_0x55ccf4[_0x88af('0x2e')]!==_0x88af('0x3d')){var _0x1cc0fd={};_0x1cc0fd[_0x55ccf4[_0x88af('0x28')]]={'$like':'%'+_0x2a9d20[_0x88af('0x30')][_0x88af('0x3c')]+'%'};return _0x1cc0fd;}})});}_0xff76c7=_[_0x88af('0x3e')]({},_0xff76c7,_0x2a9d20[_0x88af('0x3f')]);var _0x5e6696={'where':_0xff76c7['where']};return db[_0x88af('0x2b')]['count'](_0x5e6696)['then'](function(_0x408a76){_0x5773a7[_0x88af('0x1d')]=_0x408a76;if(_0x2a9d20[_0x88af('0x30')][_0x88af('0x40')]){_0xff76c7['include']=[{'all':!![]}];}return db[_0x88af('0x2b')][_0x88af('0x41')](_0xff76c7);})['then'](function(_0x5edd24){_0x5773a7[_0x88af('0x42')]=_0x5edd24;return _0x5773a7;})[_0x88af('0x24')](respondWithFilteredResult(_0x47baff,_0xff76c7))[_0x88af('0x43')](handleError(_0x47baff,null));};exports['show']=function(_0x152710,_0x3bd060){var _0x3a19be={'raw':!![],'where':{'id':_0x152710[_0x88af('0x44')]['id']}},_0x394d18={};_0x394d18['model']=_['keys'](db[_0x88af('0x2b')][_0x88af('0x2c')]);_0x394d18['query']=_[_0x88af('0x45')](_0x152710[_0x88af('0x30')]);_0x394d18['filters']=_[_0x88af('0x32')](_0x394d18[_0x88af('0x2f')],_0x394d18[_0x88af('0x30')]);_0x3a19be[_0x88af('0x34')]=_[_0x88af('0x32')](_0x394d18[_0x88af('0x2f')],qs[_0x88af('0x33')](_0x152710[_0x88af('0x30')]['fields']));_0x3a19be[_0x88af('0x34')]=_0x3a19be[_0x88af('0x34')][_0x88af('0x35')]?_0x3a19be[_0x88af('0x34')]:_0x394d18[_0x88af('0x2f')];if(_0x152710[_0x88af('0x30')]['includeAll']){_0x3a19be['include']=[{'all':!![]}];}_0x3a19be=_['merge']({},_0x3a19be,_0x152710[_0x88af('0x3f')]);return db[_0x88af('0x2b')][_0x88af('0x46')](_0x3a19be)['then'](handleEntityNotFound(_0x3bd060,null))[_0x88af('0x24')](respondWithResult(_0x3bd060,null))[_0x88af('0x43')](handleError(_0x3bd060,null));};exports['create']=function(_0x58a778,_0x459202){return db['SugarcrmField'][_0x88af('0x47')](_0x58a778[_0x88af('0x48')],{})['then'](respondWithResult(_0x459202,0xc9))[_0x88af('0x43')](handleError(_0x459202,null));};exports['update']=function(_0xa6e7e3,_0x3400fd){if(_0xa6e7e3[_0x88af('0x48')]['id']){delete _0xa6e7e3[_0x88af('0x48')]['id'];}return db[_0x88af('0x2b')][_0x88af('0x46')]({'where':{'id':_0xa6e7e3[_0x88af('0x44')]['id']}})[_0x88af('0x24')](handleEntityNotFound(_0x3400fd,null))['then'](saveUpdates(_0xa6e7e3['body'],null))[_0x88af('0x24')](respondWithResult(_0x3400fd,null))[_0x88af('0x43')](handleError(_0x3400fd,null));};exports[_0x88af('0x49')]=function(_0x51ae08,_0x5a5c3f){return db[_0x88af('0x2b')][_0x88af('0x46')]({'where':{'id':_0x51ae08[_0x88af('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a5c3f,null))[_0x88af('0x24')](removeEntity(_0x5a5c3f,null))[_0x88af('0x43')](handleError(_0x5a5c3f,null));}; \ No newline at end of file +var _0x28b0=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','rows','catch','params','find','create','body','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','query','keys','intersection'];(function(_0x5873a3,_0xa098b0){var _0x212f15=function(_0x3111ec){while(--_0x3111ec){_0x5873a3['push'](_0x5873a3['shift']());}};_0x212f15(++_0xa098b0);}(_0x28b0,0x9f));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x028b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x028b('0x1'));var moment=require('moment');var BPromise=require(_0x028b('0x2'));var Mustache=require(_0x028b('0x3'));var util=require('util');var path=require(_0x028b('0x4'));var sox=require(_0x028b('0x5'));var csv=require(_0x028b('0x6'));var ejs=require(_0x028b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x028b('0x8'));var squel=require(_0x028b('0x9'));var crypto=require(_0x028b('0xa'));var jsforce=require(_0x028b('0xb'));var deskjs=require(_0x028b('0xc'));var toCsv=require(_0x028b('0x6'));var querystring=require(_0x028b('0xd'));var Papa=require(_0x028b('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x028b('0xf'));var as=require(_0x028b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x028b('0x11'));var config=require(_0x028b('0x12'));var licenseUtil=require(_0x028b('0x13'));var db=require(_0x028b('0x14'))['db'];function respondWithStatusCode(_0x2da6fb,_0x5cc5b5){_0x5cc5b5=_0x5cc5b5||0xcc;return function(_0x510125){if(_0x510125){return _0x2da6fb['sendStatus'](_0x5cc5b5);}return _0x2da6fb[_0x028b('0x15')](_0x5cc5b5)['end']();};}function respondWithResult(_0x13d00d,_0x20fc15){_0x20fc15=_0x20fc15||0xc8;return function(_0x26368b){if(_0x26368b){return _0x13d00d[_0x028b('0x15')](_0x20fc15)[_0x028b('0x16')](_0x26368b);}};}function respondWithFilteredResult(_0x2c025a,_0x3dff78){return function(_0x218cda){if(_0x218cda){var _0xba1fdd=typeof _0x3dff78[_0x028b('0x17')]==='undefined'&&typeof _0x3dff78[_0x028b('0x18')]===_0x028b('0x19');var _0x97f925=_0x218cda[_0x028b('0x1a')];var _0x49def6=_0xba1fdd?0x0:_0x3dff78[_0x028b('0x17')];var _0x5de775=_0xba1fdd?_0x218cda[_0x028b('0x1a')]:_0x3dff78[_0x028b('0x17')]+_0x3dff78['limit'];var _0x271281;if(_0x5de775>=_0x97f925){_0x5de775=_0x97f925;_0x271281=0xc8;}else{_0x271281=0xce;}_0x2c025a['status'](_0x271281);return _0x2c025a[_0x028b('0x1b')](_0x028b('0x1c'),_0x49def6+'-'+_0x5de775+'/'+_0x97f925)[_0x028b('0x16')](_0x218cda);}return null;};}function patchUpdates(_0x2f82d3){return function(_0x566fc0){try{jsonpatch[_0x028b('0x1d')](_0x566fc0,_0x2f82d3,!![]);}catch(_0x383f70){return BPromise['reject'](_0x383f70);}return _0x566fc0['save']();};}function saveUpdates(_0x4f759f,_0x4fba39){return function(_0x292619){if(_0x292619){return _0x292619[_0x028b('0x1e')](_0x4f759f)[_0x028b('0x1f')](function(_0x3b21d4){return _0x3b21d4;});}return null;};}function removeEntity(_0x209cde,_0x519a38){return function(_0x3ba0d0){if(_0x3ba0d0){return _0x3ba0d0[_0x028b('0x20')]()[_0x028b('0x1f')](function(){_0x209cde[_0x028b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7a5b,_0xa79c87){return function(_0x871c6a){if(!_0x871c6a){_0x4a7a5b['sendStatus'](0x194);}return _0x871c6a;};}function handleError(_0x180adf,_0x2cbcb1){_0x2cbcb1=_0x2cbcb1||0x1f4;return function(_0x10ed42){logger[_0x028b('0x21')](_0x10ed42[_0x028b('0x22')]);if(_0x10ed42[_0x028b('0x23')]){delete _0x10ed42['name'];}_0x180adf[_0x028b('0x15')](_0x2cbcb1)[_0x028b('0x24')](_0x10ed42);};}exports[_0x028b('0x25')]=function(_0x5c7ed8,_0x26a3af){var _0x1cbd96={},_0x4a5f34={},_0x12c485={'count':0x0,'rows':[]};var _0x126d67=_[_0x028b('0x26')](db[_0x028b('0x27')][_0x028b('0x28')],function(_0x458514){return{'name':_0x458514[_0x028b('0x29')],'type':_0x458514['type']['key']};});_0x4a5f34['model']=_['map'](_0x126d67,'name');_0x4a5f34[_0x028b('0x2a')]=_[_0x028b('0x2b')](_0x5c7ed8[_0x028b('0x2a')]);_0x4a5f34['filters']=_[_0x028b('0x2c')](_0x4a5f34[_0x028b('0x2d')],_0x4a5f34['query']);_0x1cbd96[_0x028b('0x2e')]=_['intersection'](_0x4a5f34[_0x028b('0x2d')],qs['fields'](_0x5c7ed8['query'][_0x028b('0x2f')]));_0x1cbd96['attributes']=_0x1cbd96[_0x028b('0x2e')][_0x028b('0x30')]?_0x1cbd96['attributes']:_0x4a5f34[_0x028b('0x2d')];if(!_0x5c7ed8[_0x028b('0x2a')][_0x028b('0x31')](_0x028b('0x32'))){_0x1cbd96['limit']=qs[_0x028b('0x18')](_0x5c7ed8['query'][_0x028b('0x18')]);_0x1cbd96[_0x028b('0x17')]=qs['offset'](_0x5c7ed8['query'][_0x028b('0x17')]);}_0x1cbd96[_0x028b('0x33')]=qs['sort'](_0x5c7ed8[_0x028b('0x2a')][_0x028b('0x34')]);_0x1cbd96[_0x028b('0x35')]=qs[_0x028b('0x36')](_[_0x028b('0x37')](_0x5c7ed8['query'],_0x4a5f34['filters']),_0x126d67);if(_0x5c7ed8[_0x028b('0x2a')][_0x028b('0x38')]){_0x1cbd96['where']=_['merge'](_0x1cbd96['where'],{'$or':_['map'](_0x126d67,function(_0x1a160a){if(_0x1a160a[_0x028b('0x39')]!==_0x028b('0x3a')){var _0x309990={};_0x309990[_0x1a160a[_0x028b('0x23')]]={'$like':'%'+_0x5c7ed8['query'][_0x028b('0x38')]+'%'};return _0x309990;}})});}_0x1cbd96=_[_0x028b('0x3b')]({},_0x1cbd96,_0x5c7ed8[_0x028b('0x3c')]);var _0x39d26a={'where':_0x1cbd96[_0x028b('0x35')]};return db[_0x028b('0x27')][_0x028b('0x1a')](_0x39d26a)[_0x028b('0x1f')](function(_0x248604){_0x12c485[_0x028b('0x1a')]=_0x248604;if(_0x5c7ed8['query']['includeAll']){_0x1cbd96[_0x028b('0x3d')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x1cbd96);})[_0x028b('0x1f')](function(_0x5c3eb0){_0x12c485[_0x028b('0x3e')]=_0x5c3eb0;return _0x12c485;})[_0x028b('0x1f')](respondWithFilteredResult(_0x26a3af,_0x1cbd96))[_0x028b('0x3f')](handleError(_0x26a3af,null));};exports['show']=function(_0xccaf06,_0x1bcf3c){var _0x46e362={'raw':!![],'where':{'id':_0xccaf06[_0x028b('0x40')]['id']}},_0x4b5e56={};_0x4b5e56['model']=_[_0x028b('0x2b')](db['SugarcrmField'][_0x028b('0x28')]);_0x4b5e56[_0x028b('0x2a')]=_[_0x028b('0x2b')](_0xccaf06[_0x028b('0x2a')]);_0x4b5e56['filters']=_['intersection'](_0x4b5e56[_0x028b('0x2d')],_0x4b5e56[_0x028b('0x2a')]);_0x46e362['attributes']=_['intersection'](_0x4b5e56[_0x028b('0x2d')],qs[_0x028b('0x2f')](_0xccaf06[_0x028b('0x2a')][_0x028b('0x2f')]));_0x46e362[_0x028b('0x2e')]=_0x46e362['attributes']['length']?_0x46e362[_0x028b('0x2e')]:_0x4b5e56[_0x028b('0x2d')];if(_0xccaf06[_0x028b('0x2a')]['includeAll']){_0x46e362[_0x028b('0x3d')]=[{'all':!![]}];}_0x46e362=_[_0x028b('0x3b')]({},_0x46e362,_0xccaf06[_0x028b('0x3c')]);return db[_0x028b('0x27')][_0x028b('0x41')](_0x46e362)['then'](handleEntityNotFound(_0x1bcf3c,null))[_0x028b('0x1f')](respondWithResult(_0x1bcf3c,null))[_0x028b('0x3f')](handleError(_0x1bcf3c,null));};exports['create']=function(_0x327f7b,_0x283e2f){return db[_0x028b('0x27')][_0x028b('0x42')](_0x327f7b[_0x028b('0x43')],{})[_0x028b('0x1f')](respondWithResult(_0x283e2f,0xc9))[_0x028b('0x3f')](handleError(_0x283e2f,null));};exports[_0x028b('0x1e')]=function(_0x2b0121,_0x209e64){if(_0x2b0121[_0x028b('0x43')]['id']){delete _0x2b0121[_0x028b('0x43')]['id'];}return db[_0x028b('0x27')][_0x028b('0x41')]({'where':{'id':_0x2b0121[_0x028b('0x40')]['id']}})[_0x028b('0x1f')](handleEntityNotFound(_0x209e64,null))[_0x028b('0x1f')](saveUpdates(_0x2b0121['body'],null))['then'](respondWithResult(_0x209e64,null))['catch'](handleError(_0x209e64,null));};exports[_0x028b('0x20')]=function(_0x2f5954,_0x3b9ed9){return db[_0x028b('0x27')][_0x028b('0x41')]({'where':{'id':_0x2f5954[_0x028b('0x40')]['id']}})[_0x028b('0x1f')](handleEntityNotFound(_0x3b9ed9,null))[_0x028b('0x1f')](removeEntity(_0x3b9ed9,null))[_0x028b('0x3f')](handleError(_0x3b9ed9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index afe572c..f7cfb2e 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 _0x7608=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','api','moment','bluebird'];(function(_0x521500,_0x4cc29f){var _0x4c0a73=function(_0xfbfda){while(--_0xfbfda){_0x521500['push'](_0x521500['shift']());}};_0x4c0a73(++_0x4cc29f);}(_0x7608,0x141));var _0x8760=function(_0x2658d4,_0x1b8068){_0x2658d4=_0x2658d4-0x0;var _0x439613=_0x7608[_0x2658d4];return _0x439613;};'use strict';var _=require(_0x8760('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8760('0x1'));var moment=require(_0x8760('0x2'));var BPromise=require(_0x8760('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8760('0x4'));var config=require(_0x8760('0x5'));var attributes=require(_0x8760('0x6'));module[_0x8760('0x7')]=function(_0x493187,_0x26c5a9){return _0x493187[_0x8760('0x8')](_0x8760('0x9'),attributes,{'tableName':_0x8760('0xa'),'paranoid':![],'indexes':[{'name':_0x8760('0xb'),'fields':['idField',_0x8760('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7504=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId'];(function(_0x3cd52b,_0x12133a){var _0x176384=function(_0x369ecd){while(--_0x369ecd){_0x3cd52b['push'](_0x3cd52b['shift']());}};_0x176384(++_0x12133a);}(_0x7504,0x99));var _0x4750=function(_0x15b084,_0x563d51){_0x15b084=_0x15b084-0x0;var _0xa91087=_0x7504[_0x15b084];return _0xa91087;};'use strict';var _=require(_0x4750('0x0'));var util=require(_0x4750('0x1'));var logger=require(_0x4750('0x2'))(_0x4750('0x3'));var moment=require(_0x4750('0x4'));var BPromise=require(_0x4750('0x5'));var rp=require(_0x4750('0x6'));var fs=require('fs');var path=require(_0x4750('0x7'));var rimraf=require(_0x4750('0x8'));var config=require(_0x4750('0x9'));var attributes=require(_0x4750('0xa'));module[_0x4750('0xb')]=function(_0x3d23e1,_0x437f19){return _0x3d23e1[_0x4750('0xc')](_0x4750('0xd'),attributes,{'tableName':_0x4750('0xe'),'paranoid':![],'indexes':[{'name':_0x4750('0xf'),'fields':['idField',_0x4750('0x10')],'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 1f6f1ca..dd216c5 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 _0xe99c=['stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x21be30,_0x470620){var _0x5874d8=function(_0xebaa72){while(--_0xebaa72){_0x21be30['push'](_0x21be30['shift']());}};_0x5874d8(++_0x470620);}(_0xe99c,0xef));var _0xce99=function(_0x5cb217,_0x313725){_0x5cb217=_0x5cb217-0x0;var _0x522b42=_0xe99c[_0x5cb217];return _0x522b42;};'use strict';var _=require(_0xce99('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xce99('0x1'));var rs=require(_0xce99('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce99('0x3'));var logger=require(_0xce99('0x4'))('rpc');var config=require(_0xce99('0x5'));var jayson=require(_0xce99('0x6'));var client=jayson[_0xce99('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7e32,_0x28d97c,_0xc39b31){return new BPromise(function(_0x3a1685,_0x538eb6){return client[_0xce99('0x8')](_0x2c7e32,_0xc39b31)[_0xce99('0x9')](function(_0x5e814f){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x28d97c,_0xce99('0xa'));logger[_0xce99('0xb')](_0xce99('0xc'),_0x28d97c,_0xce99('0xa'),JSON[_0xce99('0xd')](_0x5e814f));if(_0x5e814f[_0xce99('0xe')]){if(_0x5e814f[_0xce99('0xe')][_0xce99('0xf')]===0x1f4){logger['error'](_0xce99('0x10'),_0x28d97c,_0x5e814f[_0xce99('0xe')][_0xce99('0x11')]);return _0x538eb6(_0x5e814f[_0xce99('0xe')][_0xce99('0x11')]);}logger[_0xce99('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x28d97c,_0x5e814f[_0xce99('0xe')][_0xce99('0x11')]);return _0x3a1685(_0x5e814f[_0xce99('0xe')][_0xce99('0x11')]);}else{logger[_0xce99('0x12')](_0xce99('0x10'),_0x28d97c,'request\x20sent');_0x3a1685(_0x5e814f[_0xce99('0x13')][_0xce99('0x11')]);}})[_0xce99('0x14')](function(_0x55a631){logger[_0xce99('0xe')](_0xce99('0x10'),_0x28d97c,_0x55a631);_0x538eb6(_0x55a631);});});} \ No newline at end of file +var _0xf649=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf649,0x83));var _0x9f64=function(_0x2393e0,_0x4d6f45){_0x2393e0=_0x2393e0-0x0;var _0xcc810f=_0xf649[_0x2393e0];return _0xcc810f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f64('0x0'));var BPromise=require(_0x9f64('0x1'));var rs=require(_0x9f64('0x2'));var fs=require('fs');var Redis=require(_0x9f64('0x3'));var db=require(_0x9f64('0x4'))['db'];var utils=require(_0x9f64('0x5'));var logger=require(_0x9f64('0x6'))(_0x9f64('0x7'));var config=require(_0x9f64('0x8'));var jayson=require(_0x9f64('0x9'));var client=jayson[_0x9f64('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x485511,_0x13c3cc,_0x3aadf2){return new BPromise(function(_0x5200df,_0x2886b5){return client[_0x9f64('0xb')](_0x485511,_0x3aadf2)[_0x9f64('0xc')](function(_0x107a41){logger[_0x9f64('0xd')](_0x9f64('0xe'),_0x13c3cc,_0x9f64('0xf'));logger[_0x9f64('0x10')](_0x9f64('0x11'),_0x13c3cc,'request\x20sent',JSON[_0x9f64('0x12')](_0x107a41));if(_0x107a41[_0x9f64('0x13')]){if(_0x107a41[_0x9f64('0x13')][_0x9f64('0x14')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x13c3cc,_0x107a41[_0x9f64('0x13')]['message']);return _0x2886b5(_0x107a41['error'][_0x9f64('0x15')]);}logger[_0x9f64('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x13c3cc,_0x107a41['error'][_0x9f64('0x15')]);return _0x5200df(_0x107a41[_0x9f64('0x13')]['message']);}else{logger[_0x9f64('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x13c3cc,_0x9f64('0xf'));_0x5200df(_0x107a41[_0x9f64('0x16')][_0x9f64('0x15')]);}})[_0x9f64('0x17')](function(_0x3608e9){logger['error'](_0x9f64('0xe'),_0x13c3cc,_0x3608e9);_0x2886b5(_0x3608e9);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ca8dfa6..6a274d4 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 _0x5c68=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getFields','post'];(function(_0x26b345,_0x132eac){var _0x375338=function(_0x5cfbc9){while(--_0x5cfbc9){_0x26b345['push'](_0x26b345['shift']());}};_0x375338(++_0x132eac);}(_0x5c68,0x1e9));var _0x85c6=function(_0x422b45,_0x3839f3){_0x422b45=_0x422b45-0x0;var _0x57f450=_0x5c68[_0x422b45];return _0x57f450;};'use strict';var multer=require(_0x85c6('0x0'));var util=require(_0x85c6('0x1'));var path=require(_0x85c6('0x2'));var timeout=require(_0x85c6('0x3'));var express=require(_0x85c6('0x4'));var router=express[_0x85c6('0x5')]();var fs_extra=require(_0x85c6('0x6'));var auth=require(_0x85c6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x85c6('0x8'));var controller=require(_0x85c6('0x9'));router[_0x85c6('0xa')]('/',auth[_0x85c6('0xb')](),controller[_0x85c6('0xc')]);router[_0x85c6('0xa')](_0x85c6('0xd'),auth[_0x85c6('0xb')](),controller['show']);router[_0x85c6('0xa')](_0x85c6('0xe'),auth[_0x85c6('0xb')](),controller['getConfigurations']);router[_0x85c6('0xa')]('/:id/fields',auth[_0x85c6('0xb')](),controller[_0x85c6('0xf')]);router[_0x85c6('0x10')]('/',auth[_0x85c6('0xb')](),controller[_0x85c6('0x11')]);router['post'](_0x85c6('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x85c6('0x12')](_0x85c6('0xd'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x13')]);router['delete'](_0x85c6('0xd'),auth[_0x85c6('0xb')](),controller[_0x85c6('0x14')]);module[_0x85c6('0x15')]=router; \ No newline at end of file +var _0x2bbb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x50cef3,_0xac8367){var _0x4cab90=function(_0x11628a){while(--_0x11628a){_0x50cef3['push'](_0x50cef3['shift']());}};_0x4cab90(++_0xac8367);}(_0x2bbb,0x85));var _0xb2bb=function(_0x8d06c6,_0x4f778b){_0x8d06c6=_0x8d06c6-0x0;var _0x5d129f=_0x2bbb[_0x8d06c6];return _0x5d129f;};'use strict';var multer=require('multer');var util=require(_0xb2bb('0x0'));var path=require(_0xb2bb('0x1'));var timeout=require(_0xb2bb('0x2'));var express=require('express');var router=express[_0xb2bb('0x3')]();var fs_extra=require(_0xb2bb('0x4'));var auth=require(_0xb2bb('0x5'));var interaction=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var controller=require(_0xb2bb('0x8'));router['get']('/',auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xa')]);router['get'](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xc')]);router[_0xb2bb('0xd')]('/:id/configurations',auth[_0xb2bb('0x9')](),controller['getConfigurations']);router[_0xb2bb('0xd')](_0xb2bb('0xe'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xf')]);router[_0xb2bb('0x10')]('/',auth['isAuthenticated'](),controller[_0xb2bb('0x11')]);router['post'](_0xb2bb('0x12'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0x13')]);router[_0xb2bb('0x14')](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller['update']);router[_0xb2bb('0x15')](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c091c48..aa6821b 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 _0x2387=['STRING','HelpDesk','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2387,0x89));var _0x7238=function(_0x19baa8,_0x2a7220){_0x19baa8=_0x19baa8-0x0;var _0x54ce25=_0x2387[_0x19baa8];return _0x54ce25;};'use strict';var Sequelize=require(_0x7238('0x0'));module['exports']={'name':{'type':Sequelize[_0x7238('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7238('0x1')]},'username':{'type':Sequelize[_0x7238('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7238('0x1')],'allowNull':![],'defaultValue':_0x7238('0x2')},'remoteUri':{'type':Sequelize[_0x7238('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7238('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xba8b=['exports','STRING','HelpDesk','sequelize'];(function(_0x11b2b8,_0x4985ea){var _0xf98b2a=function(_0x200bb1){while(--_0x200bb1){_0x11b2b8['push'](_0x11b2b8['shift']());}};_0xf98b2a(++_0x4985ea);}(_0xba8b,0xcb));var _0xbba8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xba8b[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xbba8('0x0'));module[_0xbba8('0x1')]={'name':{'type':Sequelize[_0xbba8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbba8('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbba8('0x2')],'allowNull':![],'defaultValue':_0xbba8('0x3')},'remoteUri':{'type':Sequelize[_0xbba8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7a038a8..956b027 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 _0xf0e1=['sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','body','find','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','getFields','description','accessKey','username','remoteUri','slice','substring','format','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','autogenerated','remove','includes','editable','label','startsWith','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0xcc69c5,_0x5b35b2){var _0x14ec59=function(_0x4377ec){while(--_0x4377ec){_0xcc69c5['push'](_0xcc69c5['shift']());}};_0x14ec59(++_0x5b35b2);}(_0xf0e1,0x158));var _0x1f0e=function(_0xa8369a,_0x3d2319){_0xa8369a=_0xa8369a-0x0;var _0x4b74b7=_0xf0e1[_0xa8369a];return _0x4b74b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f0e('0x0'));var zipdir=require(_0x1f0e('0x1'));var jsonpatch=require(_0x1f0e('0x2'));var rp=require(_0x1f0e('0x3'));var moment=require(_0x1f0e('0x4'));var BPromise=require(_0x1f0e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1f0e('0x6'));var sox=require(_0x1f0e('0x7'));var csv=require('to-csv');var ejs=require(_0x1f0e('0x8'));var fs=require('fs');var fs_extra=require(_0x1f0e('0x9'));var _=require('lodash');var squel=require(_0x1f0e('0xa'));var crypto=require(_0x1f0e('0xb'));var jsforce=require(_0x1f0e('0xc'));var deskjs=require(_0x1f0e('0xd'));var toCsv=require(_0x1f0e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1f0e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1f0e('0x10'));var as=require(_0x1f0e('0x11'));var hardwareService=require(_0x1f0e('0x12'));var logger=require(_0x1f0e('0x13'))(_0x1f0e('0x14'));var utils=require('../../config/utils');var config=require(_0x1f0e('0x15'));var licenseUtil=require(_0x1f0e('0x16'));var db=require(_0x1f0e('0x17'))['db'];var integrations=require(_0x1f0e('0x18'));function respondWithStatusCode(_0x4b19ab,_0x202bfd){_0x202bfd=_0x202bfd||0xcc;return function(_0x19a2e0){if(_0x19a2e0){return _0x4b19ab['sendStatus'](_0x202bfd);}return _0x4b19ab[_0x1f0e('0x19')](_0x202bfd)[_0x1f0e('0x1a')]();};}function respondWithResult(_0x4e85e0,_0x5d33bb){_0x5d33bb=_0x5d33bb||0xc8;return function(_0x2c972f){if(_0x2c972f){return _0x4e85e0[_0x1f0e('0x19')](_0x5d33bb)[_0x1f0e('0x1b')](_0x2c972f);}};}function respondWithFilteredResult(_0x3bb3e0,_0x5d7c2e){return function(_0x252a35){if(_0x252a35){var _0x3aeb1e=typeof _0x5d7c2e[_0x1f0e('0x1c')]===_0x1f0e('0x1d')&&typeof _0x5d7c2e[_0x1f0e('0x1e')]===_0x1f0e('0x1d');var _0x3e83a6=_0x252a35[_0x1f0e('0x1f')];var _0x52dc3c=_0x3aeb1e?0x0:_0x5d7c2e[_0x1f0e('0x1c')];var _0x2a1a65=_0x3aeb1e?_0x252a35[_0x1f0e('0x1f')]:_0x5d7c2e[_0x1f0e('0x1c')]+_0x5d7c2e['limit'];var _0x599bd7;if(_0x2a1a65>=_0x3e83a6){_0x2a1a65=_0x3e83a6;_0x599bd7=0xc8;}else{_0x599bd7=0xce;}_0x3bb3e0[_0x1f0e('0x19')](_0x599bd7);return _0x3bb3e0[_0x1f0e('0x20')](_0x1f0e('0x21'),_0x52dc3c+'-'+_0x2a1a65+'/'+_0x3e83a6)['json'](_0x252a35);}return null;};}function patchUpdates(_0x1ac526){return function(_0x4ceb11){try{jsonpatch[_0x1f0e('0x22')](_0x4ceb11,_0x1ac526,!![]);}catch(_0x22fb61){return BPromise['reject'](_0x22fb61);}return _0x4ceb11[_0x1f0e('0x23')]();};}function saveUpdates(_0x39ce54,_0x12475b){return function(_0x3520ca){if(_0x3520ca){return _0x3520ca[_0x1f0e('0x24')](_0x39ce54)[_0x1f0e('0x25')](function(_0x4949e9){return _0x4949e9;});}return null;};}function removeEntity(_0x67f17a,_0x343448){return function(_0x598935){if(_0x598935){return _0x598935[_0x1f0e('0x26')]()[_0x1f0e('0x25')](function(){_0x67f17a[_0x1f0e('0x19')](0xcc)[_0x1f0e('0x1a')]();});}};}function handleEntityNotFound(_0x4554a9,_0x2ae542){return function(_0x400056){if(!_0x400056){_0x4554a9[_0x1f0e('0x27')](0x194);}return _0x400056;};}function handleError(_0x58feb9,_0x2b4872){_0x2b4872=_0x2b4872||0x1f4;return function(_0x364f75){logger[_0x1f0e('0x28')](_0x364f75[_0x1f0e('0x29')]);if(_0x364f75[_0x1f0e('0x2a')]){delete _0x364f75[_0x1f0e('0x2a')];}_0x58feb9[_0x1f0e('0x19')](_0x2b4872)[_0x1f0e('0x2b')](_0x364f75);};}exports[_0x1f0e('0x2c')]=function(_0x360328,_0x429d9c){var _0x3b1b66={},_0xd94ae8={},_0xc59bf3={'count':0x0,'rows':[]};var _0x5da38c=_[_0x1f0e('0x2d')](db[_0x1f0e('0x2e')][_0x1f0e('0x2f')],function(_0x555511){return{'name':_0x555511[_0x1f0e('0x30')],'type':_0x555511[_0x1f0e('0x31')]['key']};});_0xd94ae8[_0x1f0e('0x32')]=_[_0x1f0e('0x2d')](_0x5da38c,_0x1f0e('0x2a'));_0xd94ae8['query']=_[_0x1f0e('0x33')](_0x360328['query']);_0xd94ae8[_0x1f0e('0x34')]=_[_0x1f0e('0x35')](_0xd94ae8[_0x1f0e('0x32')],_0xd94ae8[_0x1f0e('0x36')]);_0x3b1b66[_0x1f0e('0x37')]=_[_0x1f0e('0x35')](_0xd94ae8[_0x1f0e('0x32')],qs['fields'](_0x360328[_0x1f0e('0x36')][_0x1f0e('0x38')]));_0x3b1b66['attributes']=_0x3b1b66[_0x1f0e('0x37')]['length']?_0x3b1b66[_0x1f0e('0x37')]:_0xd94ae8[_0x1f0e('0x32')];if(!_0x360328[_0x1f0e('0x36')]['hasOwnProperty'](_0x1f0e('0x39'))){_0x3b1b66[_0x1f0e('0x1e')]=qs[_0x1f0e('0x1e')](_0x360328[_0x1f0e('0x36')][_0x1f0e('0x1e')]);_0x3b1b66[_0x1f0e('0x1c')]=qs[_0x1f0e('0x1c')](_0x360328['query'][_0x1f0e('0x1c')]);}_0x3b1b66[_0x1f0e('0x3a')]=qs[_0x1f0e('0x3b')](_0x360328['query'][_0x1f0e('0x3b')]);_0x3b1b66[_0x1f0e('0x3c')]=qs[_0x1f0e('0x34')](_[_0x1f0e('0x3d')](_0x360328[_0x1f0e('0x36')],_0xd94ae8['filters']),_0x5da38c);if(_0x360328[_0x1f0e('0x36')][_0x1f0e('0x3e')]){_0x3b1b66[_0x1f0e('0x3c')]=_[_0x1f0e('0x3f')](_0x3b1b66['where'],{'$or':_[_0x1f0e('0x2d')](_0x5da38c,function(_0x397324){if(_0x397324['type']!==_0x1f0e('0x40')){var _0x1f54c7={};_0x1f54c7[_0x397324[_0x1f0e('0x2a')]]={'$like':'%'+_0x360328[_0x1f0e('0x36')][_0x1f0e('0x3e')]+'%'};return _0x1f54c7;}})});}_0x3b1b66=_[_0x1f0e('0x3f')]({},_0x3b1b66,_0x360328[_0x1f0e('0x41')]);var _0x3b70cd={'where':_0x3b1b66['where']};return db[_0x1f0e('0x2e')]['count'](_0x3b70cd)[_0x1f0e('0x25')](function(_0x283a49){_0xc59bf3[_0x1f0e('0x1f')]=_0x283a49;if(_0x360328[_0x1f0e('0x36')][_0x1f0e('0x42')]){_0x3b1b66['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x1f0e('0x43')](_0x3b1b66);})[_0x1f0e('0x25')](function(_0x1e2683){_0xc59bf3[_0x1f0e('0x44')]=_0x1e2683;return _0xc59bf3;})['then'](respondWithFilteredResult(_0x429d9c,_0x3b1b66))[_0x1f0e('0x45')](handleError(_0x429d9c,null));};exports[_0x1f0e('0x46')]=function(_0x45c661,_0x5e3647){var _0x5a1f44={'raw':![],'where':{'id':_0x45c661[_0x1f0e('0x47')]['id']}},_0x5bd82d={};_0x5bd82d[_0x1f0e('0x32')]=_[_0x1f0e('0x33')](db['VtigerAccount'][_0x1f0e('0x2f')]);_0x5bd82d[_0x1f0e('0x36')]=_[_0x1f0e('0x33')](_0x45c661[_0x1f0e('0x36')]);_0x5bd82d['filters']=_[_0x1f0e('0x35')](_0x5bd82d[_0x1f0e('0x32')],_0x5bd82d[_0x1f0e('0x36')]);_0x5a1f44[_0x1f0e('0x37')]=_[_0x1f0e('0x35')](_0x5bd82d[_0x1f0e('0x32')],qs[_0x1f0e('0x38')](_0x45c661[_0x1f0e('0x36')][_0x1f0e('0x38')]));_0x5a1f44[_0x1f0e('0x37')]=_0x5a1f44['attributes'][_0x1f0e('0x48')]?_0x5a1f44['attributes']:_0x5bd82d[_0x1f0e('0x32')];if(_0x45c661['query'][_0x1f0e('0x42')]){_0x5a1f44[_0x1f0e('0x49')]=[{'all':!![]}];}_0x5a1f44=_[_0x1f0e('0x3f')]({},_0x5a1f44,_0x45c661[_0x1f0e('0x41')]);return db[_0x1f0e('0x2e')]['find'](_0x5a1f44)[_0x1f0e('0x25')](handleEntityNotFound(_0x5e3647,null))['then'](respondWithResult(_0x5e3647,null))[_0x1f0e('0x45')](handleError(_0x5e3647,null));};exports['create']=function(_0x1b0a1e,_0x11fe29){return db[_0x1f0e('0x2e')]['create'](_0x1b0a1e['body'],{})[_0x1f0e('0x25')](respondWithResult(_0x11fe29,0xc9))['catch'](handleError(_0x11fe29,null));};exports[_0x1f0e('0x24')]=function(_0x3977fc,_0x527113){if(_0x3977fc['body']['id']){delete _0x3977fc[_0x1f0e('0x4a')]['id'];}return db[_0x1f0e('0x2e')][_0x1f0e('0x4b')]({'where':{'id':_0x3977fc[_0x1f0e('0x47')]['id']}})[_0x1f0e('0x25')](handleEntityNotFound(_0x527113,null))[_0x1f0e('0x25')](saveUpdates(_0x3977fc[_0x1f0e('0x4a')],null))[_0x1f0e('0x25')](respondWithResult(_0x527113,null))['catch'](handleError(_0x527113,null));};exports[_0x1f0e('0x26')]=function(_0x9960ce,_0x1b6951){return db[_0x1f0e('0x2e')][_0x1f0e('0x4b')]({'where':{'id':_0x9960ce[_0x1f0e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b6951,null))['then'](removeEntity(_0x1b6951,null))[_0x1f0e('0x45')](handleError(_0x1b6951,null));};exports[_0x1f0e('0x4c')]=function(_0x25c518,_0x159dfa,_0x5deeb4){var _0x34d3be={};var _0x485f12={};var _0x49d3f1;var _0x4fa4d0;return db[_0x1f0e('0x2e')][_0x1f0e('0x4d')]({'where':{'id':_0x25c518[_0x1f0e('0x47')]['id']}})[_0x1f0e('0x25')](handleEntityNotFound(_0x159dfa,null))[_0x1f0e('0x25')](function(_0x452d0a){if(_0x452d0a){_0x49d3f1=_0x452d0a;_0x485f12['model']=_['keys'](db[_0x1f0e('0x4e')][_0x1f0e('0x2f')]);_0x485f12['query']=_[_0x1f0e('0x33')](_0x25c518[_0x1f0e('0x36')]);_0x485f12[_0x1f0e('0x34')]=_[_0x1f0e('0x35')](_0x485f12[_0x1f0e('0x32')],_0x485f12[_0x1f0e('0x36')]);_0x34d3be[_0x1f0e('0x37')]=_['intersection'](_0x485f12[_0x1f0e('0x32')],qs[_0x1f0e('0x38')](_0x25c518[_0x1f0e('0x36')]['fields']));_0x34d3be['attributes']=_0x34d3be[_0x1f0e('0x37')][_0x1f0e('0x48')]?_0x34d3be[_0x1f0e('0x37')]:_0x485f12[_0x1f0e('0x32')];_0x34d3be['order']=qs[_0x1f0e('0x3b')](_0x25c518['query'][_0x1f0e('0x3b')]);_0x34d3be[_0x1f0e('0x3c')]=qs[_0x1f0e('0x34')](_[_0x1f0e('0x3d')](_0x25c518[_0x1f0e('0x36')],_0x485f12[_0x1f0e('0x34')]));if(_0x25c518[_0x1f0e('0x36')][_0x1f0e('0x3e')]){_0x34d3be['where']=_['merge'](_0x34d3be[_0x1f0e('0x3c')],{'$or':_['map'](_0x34d3be[_0x1f0e('0x37')],function(_0x12b7bb){var _0x1b97d6={};_0x1b97d6[_0x12b7bb]={'$like':'%'+_0x25c518['query']['filter']+'%'};return _0x1b97d6;})});}_0x34d3be=_[_0x1f0e('0x3f')]({},_0x34d3be,_0x25c518[_0x1f0e('0x41')]);return _0x49d3f1[_0x1f0e('0x4c')](_0x34d3be);}})[_0x1f0e('0x25')](function(_0x1efe50){if(_0x1efe50){_0x4fa4d0=_0x1efe50[_0x1f0e('0x48')];if(!_0x25c518[_0x1f0e('0x36')][_0x1f0e('0x4f')](_0x1f0e('0x39'))){_0x34d3be[_0x1f0e('0x1e')]=qs[_0x1f0e('0x1e')](_0x25c518[_0x1f0e('0x36')]['limit']);_0x34d3be['offset']=qs[_0x1f0e('0x1c')](_0x25c518['query'][_0x1f0e('0x1c')]);}return _0x49d3f1[_0x1f0e('0x4c')](_0x34d3be);}})[_0x1f0e('0x25')](function(_0x24acdd){if(_0x24acdd){return _0x24acdd?{'count':_0x4fa4d0,'rows':_0x24acdd}:null;}})[_0x1f0e('0x25')](respondWithResult(_0x159dfa,null))['catch'](handleError(_0x159dfa,null));};exports[_0x1f0e('0x50')]=function(_0x40f60b,_0x2d1553,_0x2c5099){if(_0x40f60b[_0x1f0e('0x4a')]['id']){delete _0x40f60b[_0x1f0e('0x4a')]['id'];}return db[_0x1f0e('0x2e')][_0x1f0e('0x4d')]({'where':{'id':_0x40f60b[_0x1f0e('0x47')]['id']}})[_0x1f0e('0x25')](handleEntityNotFound(_0x2d1553,null))[_0x1f0e('0x25')](function(_0x29e139){if(_0x29e139){_0x40f60b['body'][_0x1f0e('0x51')]=_0x29e139['id'];_0x40f60b['body'][_0x1f0e('0x52')]=integrations['getSubjects'](_0x40f60b[_0x1f0e('0x4a')]['channel'],_0x40f60b[_0x1f0e('0x4a')][_0x1f0e('0x31')]);_0x40f60b[_0x1f0e('0x4a')][_0x1f0e('0x53')]=integrations[_0x1f0e('0x54')](_0x40f60b[_0x1f0e('0x4a')][_0x1f0e('0x55')],_0x40f60b['body'][_0x1f0e('0x31')]);return db['VtigerConfiguration']['create'](_0x40f60b['body'],{'include':[{'model':db[_0x1f0e('0x56')],'as':_0x1f0e('0x52')},{'model':db[_0x1f0e('0x56')],'as':'Descriptions'}]});}return null;})[_0x1f0e('0x25')](respondWithResult(_0x2d1553,null))[_0x1f0e('0x45')](handleError(_0x2d1553,null));};var md5=require('md5');exports[_0x1f0e('0x57')]=function(_0x4d33f8,_0x41d68b,_0x910248){var _0x365545=null;var _0x267e22=null;var _0x41f46c=null;var _0x365062=null;var _0x2b8940='';return db[_0x1f0e('0x2e')][_0x1f0e('0x4d')]({'where':{'id':_0x4d33f8['params']['id']},'attributes':['id',_0x1f0e('0x2a'),'username',_0x1f0e('0x58'),'moduleName','remoteUri','serverUrl',_0x1f0e('0x59')]})[_0x1f0e('0x25')](handleEntityNotFound(_0x41d68b,null))['then'](function(_0x1758c1){if(_0x1758c1){_0x365545=_0x1758c1[_0x1f0e('0x5a')];_0x267e22=_0x1758c1[_0x1f0e('0x59')];_0x41f46c=_0x1758c1['moduleName'];_0x2b8940=_0x1758c1[_0x1f0e('0x5b')];var _0x5357b6=_0x2b8940[_0x1f0e('0x5c')](-0x1);if(_0x5357b6==='/'){_0x2b8940=_0x2b8940[_0x1f0e('0x5d')](0x0,_0x2b8940['lastIndexOf'](_0x5357b6));}_0x365062=util[_0x1f0e('0x5e')](_0x1f0e('0x5f'),_0x2b8940);var _0x572e5e={'method':_0x1f0e('0x60'),'uri':_0x365062,'qs':{'operation':_0x1f0e('0x61'),'username':_0x1758c1['username']},'json':!![]};return rp(_0x572e5e);}})[_0x1f0e('0x25')](function(_0x55c27c){if(_0x55c27c[_0x1f0e('0x62')]){var _0x1d268d={'method':'POST','uri':_0x365062,'form':{'operation':_0x1f0e('0x63'),'username':_0x365545,'accessKey':md5(_0x55c27c[_0x1f0e('0x64')][_0x1f0e('0x65')]+_0x267e22)},'json':!![]};return rp(_0x1d268d);}})[_0x1f0e('0x25')](function(_0x300cc4){if(_0x300cc4[_0x1f0e('0x62')]){var _0x1a1a3f={'method':_0x1f0e('0x60'),'uri':_0x365062,'qs':{'operation':_0x1f0e('0x66'),'username':_0x365545,'sessionName':_0x300cc4[_0x1f0e('0x64')][_0x1f0e('0x67')],'elementType':_0x41f46c},'json':!![]};return rp(_0x1a1a3f);}})[_0x1f0e('0x25')](function(_0x215518){if(_0x215518[_0x1f0e('0x62')]){var _0x4f404c=[_0x1f0e('0x68'),'reference','owner'];_[_0x1f0e('0x69')](_0x215518[_0x1f0e('0x64')][_0x1f0e('0x38')],function(_0x3e164c){return _0x4f404c[_0x1f0e('0x6a')](_0x3e164c[_0x1f0e('0x31')]['name']);});_['remove'](_0x215518[_0x1f0e('0x64')][_0x1f0e('0x38')],function(_0x1b50de){return _0x1b50de[_0x1f0e('0x6b')]==='false';});return{'count':_0x215518[_0x1f0e('0x64')][_0x1f0e('0x38')][_0x1f0e('0x48')],'rows':_[_0x1f0e('0x2d')](_0x215518[_0x1f0e('0x64')][_0x1f0e('0x38')],function(_0xae0dbb){return{'id':_0xae0dbb['name'],'name':_0xae0dbb[_0x1f0e('0x6c')],'custom':_[_0x1f0e('0x6d')](_0xae0dbb[_0x1f0e('0x2a')],'cf_')?!![]:![],'options':_0xae0dbb[_0x1f0e('0x31')][_0x1f0e('0x2a')]===_0x1f0e('0x6e')&&_0xae0dbb[_0x1f0e('0x31')][_0x1f0e('0x6f')]['length']>0x0?_['map'](_0xae0dbb[_0x1f0e('0x31')][_0x1f0e('0x6f')],function(_0x1e1ea9){return{'name':_0x1e1ea9[_0x1f0e('0x6c')],'value':_0x1e1ea9[_0x1f0e('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x41d68b,null))[_0x1f0e('0x45')](function(_0x48abfd){console['log'](_0x1f0e('0x71')+_0x48abfd);var _0xdfa4e2=_0x4d33f8['query'][_0x1f0e('0x72')]?0x1f4:_0x48abfd[_0x1f0e('0x73')]||0x1f4;logger[_0x1f0e('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x1f0e('0x57'),_0xdfa4e2,JSON[_0x1f0e('0x74')](_0x48abfd));delete _0x48abfd[_0x1f0e('0x2a')];if(_0xdfa4e2===0x191){_0xdfa4e2=0x190;}_0x41d68b[_0x1f0e('0x19')](_0xdfa4e2)[_0x1f0e('0x2b')](_0x4d33f8[_0x1f0e('0x36')][_0x1f0e('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x48abfd[_0x1f0e('0x73')]}:_0x48abfd);});}; \ No newline at end of file +var _0x47b1=['getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','keys','options','find','create','body','params','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','type','channel','VtigerField','md5','getFields','findOne','description','moduleName','remoteUri','serverUrl','username','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','describe','sessionName','success','autogenerated','reference','remove','editable','false','startsWith','cf_','picklistValues','label','value','test'];(function(_0x5f077a,_0x230f88){var _0x407bf4=function(_0x39322a){while(--_0x39322a){_0x5f077a['push'](_0x5f077a['shift']());}};_0x407bf4(++_0x230f88);}(_0x47b1,0x16a));var _0x147b=function(_0x2fd8f1,_0x34b475){_0x2fd8f1=_0x2fd8f1-0x0;var _0x2fb46d=_0x47b1[_0x2fd8f1];return _0x2fb46d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x147b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x147b('0x1'));var rp=require(_0x147b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x147b('0x3'));var path=require(_0x147b('0x4'));var sox=require(_0x147b('0x5'));var csv=require('to-csv');var ejs=require(_0x147b('0x6'));var fs=require('fs');var fs_extra=require(_0x147b('0x7'));var _=require(_0x147b('0x8'));var squel=require(_0x147b('0x9'));var crypto=require('crypto');var jsforce=require(_0x147b('0xa'));var deskjs=require(_0x147b('0xb'));var toCsv=require(_0x147b('0xc'));var querystring=require('querystring');var Papa=require(_0x147b('0xd'));var Redis=require(_0x147b('0xe'));var authService=require(_0x147b('0xf'));var qs=require(_0x147b('0x10'));var as=require(_0x147b('0x11'));var hardwareService=require(_0x147b('0x12'));var logger=require(_0x147b('0x13'))('api');var utils=require(_0x147b('0x14'));var config=require(_0x147b('0x15'));var licenseUtil=require(_0x147b('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b5155,_0x27f16a){_0x27f16a=_0x27f16a||0xcc;return function(_0x5f3e8e){if(_0x5f3e8e){return _0x5b5155[_0x147b('0x17')](_0x27f16a);}return _0x5b5155[_0x147b('0x18')](_0x27f16a)[_0x147b('0x19')]();};}function respondWithResult(_0x837043,_0x43a58e){_0x43a58e=_0x43a58e||0xc8;return function(_0x30125a){if(_0x30125a){return _0x837043[_0x147b('0x18')](_0x43a58e)['json'](_0x30125a);}};}function respondWithFilteredResult(_0x5068a3,_0x55436e){return function(_0xb0466f){if(_0xb0466f){var _0x42a2aa=typeof _0x55436e[_0x147b('0x1a')]===_0x147b('0x1b')&&typeof _0x55436e[_0x147b('0x1c')]===_0x147b('0x1b');var _0x51d532=_0xb0466f[_0x147b('0x1d')];var _0x255eba=_0x42a2aa?0x0:_0x55436e[_0x147b('0x1a')];var _0x6bc2ab=_0x42a2aa?_0xb0466f[_0x147b('0x1d')]:_0x55436e[_0x147b('0x1a')]+_0x55436e[_0x147b('0x1c')];var _0xd12e9c;if(_0x6bc2ab>=_0x51d532){_0x6bc2ab=_0x51d532;_0xd12e9c=0xc8;}else{_0xd12e9c=0xce;}_0x5068a3[_0x147b('0x18')](_0xd12e9c);return _0x5068a3['set'](_0x147b('0x1e'),_0x255eba+'-'+_0x6bc2ab+'/'+_0x51d532)[_0x147b('0x1f')](_0xb0466f);}return null;};}function patchUpdates(_0x3acc99){return function(_0x294007){try{jsonpatch['apply'](_0x294007,_0x3acc99,!![]);}catch(_0x420015){return BPromise[_0x147b('0x20')](_0x420015);}return _0x294007[_0x147b('0x21')]();};}function saveUpdates(_0x18e9c1,_0x46b2be){return function(_0x72e868){if(_0x72e868){return _0x72e868[_0x147b('0x22')](_0x18e9c1)[_0x147b('0x23')](function(_0x5dde33){return _0x5dde33;});}return null;};}function removeEntity(_0x34d9c4,_0x2e07d5){return function(_0x5be8e9){if(_0x5be8e9){return _0x5be8e9[_0x147b('0x24')]()['then'](function(){_0x34d9c4[_0x147b('0x18')](0xcc)[_0x147b('0x19')]();});}};}function handleEntityNotFound(_0x3d6883,_0x184113){return function(_0x515140){if(!_0x515140){_0x3d6883[_0x147b('0x17')](0x194);}return _0x515140;};}function handleError(_0x547d9b,_0x33a414){_0x33a414=_0x33a414||0x1f4;return function(_0x119b3f){logger[_0x147b('0x25')](_0x119b3f[_0x147b('0x26')]);if(_0x119b3f[_0x147b('0x27')]){delete _0x119b3f[_0x147b('0x27')];}_0x547d9b[_0x147b('0x18')](_0x33a414)['send'](_0x119b3f);};}exports[_0x147b('0x28')]=function(_0x2c2dbd,_0x593f6e){var _0x38b90c={},_0x30afaf={},_0x14b7ad={'count':0x0,'rows':[]};var _0x2f3484=_[_0x147b('0x29')](db[_0x147b('0x2a')][_0x147b('0x2b')],function(_0x51abc6){return{'name':_0x51abc6[_0x147b('0x2c')],'type':_0x51abc6['type'][_0x147b('0x2d')]};});_0x30afaf[_0x147b('0x2e')]=_[_0x147b('0x29')](_0x2f3484,_0x147b('0x27'));_0x30afaf[_0x147b('0x2f')]=_['keys'](_0x2c2dbd[_0x147b('0x2f')]);_0x30afaf[_0x147b('0x30')]=_[_0x147b('0x31')](_0x30afaf[_0x147b('0x2e')],_0x30afaf[_0x147b('0x2f')]);_0x38b90c[_0x147b('0x32')]=_[_0x147b('0x31')](_0x30afaf[_0x147b('0x2e')],qs['fields'](_0x2c2dbd[_0x147b('0x2f')][_0x147b('0x33')]));_0x38b90c[_0x147b('0x32')]=_0x38b90c[_0x147b('0x32')][_0x147b('0x34')]?_0x38b90c[_0x147b('0x32')]:_0x30afaf[_0x147b('0x2e')];if(!_0x2c2dbd['query'][_0x147b('0x35')](_0x147b('0x36'))){_0x38b90c[_0x147b('0x1c')]=qs[_0x147b('0x1c')](_0x2c2dbd[_0x147b('0x2f')][_0x147b('0x1c')]);_0x38b90c[_0x147b('0x1a')]=qs[_0x147b('0x1a')](_0x2c2dbd[_0x147b('0x2f')]['offset']);}_0x38b90c[_0x147b('0x37')]=qs[_0x147b('0x38')](_0x2c2dbd[_0x147b('0x2f')][_0x147b('0x38')]);_0x38b90c[_0x147b('0x39')]=qs[_0x147b('0x30')](_[_0x147b('0x3a')](_0x2c2dbd[_0x147b('0x2f')],_0x30afaf[_0x147b('0x30')]),_0x2f3484);if(_0x2c2dbd[_0x147b('0x2f')][_0x147b('0x3b')]){_0x38b90c[_0x147b('0x39')]=_[_0x147b('0x3c')](_0x38b90c[_0x147b('0x39')],{'$or':_[_0x147b('0x29')](_0x2f3484,function(_0x54d177){if(_0x54d177['type']!==_0x147b('0x3d')){var _0xdcd194={};_0xdcd194[_0x54d177['name']]={'$like':'%'+_0x2c2dbd['query'][_0x147b('0x3b')]+'%'};return _0xdcd194;}})});}_0x38b90c=_[_0x147b('0x3c')]({},_0x38b90c,_0x2c2dbd['options']);var _0x1b9d36={'where':_0x38b90c[_0x147b('0x39')]};return db[_0x147b('0x2a')]['count'](_0x1b9d36)[_0x147b('0x23')](function(_0x313d42){_0x14b7ad['count']=_0x313d42;if(_0x2c2dbd[_0x147b('0x2f')][_0x147b('0x3e')]){_0x38b90c[_0x147b('0x3f')]=[{'all':!![]}];}return db[_0x147b('0x2a')]['findAll'](_0x38b90c);})[_0x147b('0x23')](function(_0x4ce652){_0x14b7ad[_0x147b('0x40')]=_0x4ce652;return _0x14b7ad;})[_0x147b('0x23')](respondWithFilteredResult(_0x593f6e,_0x38b90c))[_0x147b('0x41')](handleError(_0x593f6e,null));};exports['show']=function(_0x35ad82,_0x8a1bdb){var _0xb94b4a={'raw':![],'where':{'id':_0x35ad82['params']['id']}},_0xdabf2a={};_0xdabf2a[_0x147b('0x2e')]=_[_0x147b('0x42')](db[_0x147b('0x2a')][_0x147b('0x2b')]);_0xdabf2a['query']=_[_0x147b('0x42')](_0x35ad82[_0x147b('0x2f')]);_0xdabf2a[_0x147b('0x30')]=_[_0x147b('0x31')](_0xdabf2a[_0x147b('0x2e')],_0xdabf2a[_0x147b('0x2f')]);_0xb94b4a[_0x147b('0x32')]=_[_0x147b('0x31')](_0xdabf2a['model'],qs[_0x147b('0x33')](_0x35ad82[_0x147b('0x2f')]['fields']));_0xb94b4a['attributes']=_0xb94b4a[_0x147b('0x32')][_0x147b('0x34')]?_0xb94b4a[_0x147b('0x32')]:_0xdabf2a[_0x147b('0x2e')];if(_0x35ad82[_0x147b('0x2f')][_0x147b('0x3e')]){_0xb94b4a[_0x147b('0x3f')]=[{'all':!![]}];}_0xb94b4a=_[_0x147b('0x3c')]({},_0xb94b4a,_0x35ad82[_0x147b('0x43')]);return db['VtigerAccount'][_0x147b('0x44')](_0xb94b4a)['then'](handleEntityNotFound(_0x8a1bdb,null))['then'](respondWithResult(_0x8a1bdb,null))[_0x147b('0x41')](handleError(_0x8a1bdb,null));};exports[_0x147b('0x45')]=function(_0x3b3ccc,_0x1434e9){return db[_0x147b('0x2a')]['create'](_0x3b3ccc[_0x147b('0x46')],{})[_0x147b('0x23')](respondWithResult(_0x1434e9,0xc9))[_0x147b('0x41')](handleError(_0x1434e9,null));};exports[_0x147b('0x22')]=function(_0x289c72,_0x3f1c56){if(_0x289c72['body']['id']){delete _0x289c72[_0x147b('0x46')]['id'];}return db['VtigerAccount'][_0x147b('0x44')]({'where':{'id':_0x289c72[_0x147b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f1c56,null))[_0x147b('0x23')](saveUpdates(_0x289c72['body'],null))[_0x147b('0x23')](respondWithResult(_0x3f1c56,null))['catch'](handleError(_0x3f1c56,null));};exports[_0x147b('0x24')]=function(_0x79c465,_0x54d749){return db['VtigerAccount'][_0x147b('0x44')]({'where':{'id':_0x79c465[_0x147b('0x47')]['id']}})[_0x147b('0x23')](handleEntityNotFound(_0x54d749,null))[_0x147b('0x23')](removeEntity(_0x54d749,null))[_0x147b('0x41')](handleError(_0x54d749,null));};exports[_0x147b('0x48')]=function(_0x579d18,_0xf1c642,_0x402b16){var _0x1923c9={};var _0xa14d87={};var _0x233552;var _0x989d6c;return db[_0x147b('0x2a')]['findOne']({'where':{'id':_0x579d18[_0x147b('0x47')]['id']}})[_0x147b('0x23')](handleEntityNotFound(_0xf1c642,null))[_0x147b('0x23')](function(_0x53ec8c){if(_0x53ec8c){_0x233552=_0x53ec8c;_0xa14d87[_0x147b('0x2e')]=_[_0x147b('0x42')](db[_0x147b('0x49')][_0x147b('0x2b')]);_0xa14d87[_0x147b('0x2f')]=_[_0x147b('0x42')](_0x579d18[_0x147b('0x2f')]);_0xa14d87['filters']=_[_0x147b('0x31')](_0xa14d87['model'],_0xa14d87[_0x147b('0x2f')]);_0x1923c9[_0x147b('0x32')]=_[_0x147b('0x31')](_0xa14d87['model'],qs[_0x147b('0x33')](_0x579d18[_0x147b('0x2f')][_0x147b('0x33')]));_0x1923c9[_0x147b('0x32')]=_0x1923c9[_0x147b('0x32')][_0x147b('0x34')]?_0x1923c9[_0x147b('0x32')]:_0xa14d87[_0x147b('0x2e')];_0x1923c9[_0x147b('0x37')]=qs[_0x147b('0x38')](_0x579d18[_0x147b('0x2f')][_0x147b('0x38')]);_0x1923c9[_0x147b('0x39')]=qs[_0x147b('0x30')](_['pick'](_0x579d18['query'],_0xa14d87['filters']));if(_0x579d18[_0x147b('0x2f')][_0x147b('0x3b')]){_0x1923c9[_0x147b('0x39')]=_[_0x147b('0x3c')](_0x1923c9[_0x147b('0x39')],{'$or':_[_0x147b('0x29')](_0x1923c9['attributes'],function(_0x15c701){var _0x32ffb3={};_0x32ffb3[_0x15c701]={'$like':'%'+_0x579d18['query'][_0x147b('0x3b')]+'%'};return _0x32ffb3;})});}_0x1923c9=_[_0x147b('0x3c')]({},_0x1923c9,_0x579d18[_0x147b('0x43')]);return _0x233552['getConfigurations'](_0x1923c9);}})['then'](function(_0x2aa574){if(_0x2aa574){_0x989d6c=_0x2aa574[_0x147b('0x34')];if(!_0x579d18[_0x147b('0x2f')][_0x147b('0x35')](_0x147b('0x36'))){_0x1923c9[_0x147b('0x1c')]=qs[_0x147b('0x1c')](_0x579d18[_0x147b('0x2f')][_0x147b('0x1c')]);_0x1923c9[_0x147b('0x1a')]=qs[_0x147b('0x1a')](_0x579d18[_0x147b('0x2f')][_0x147b('0x1a')]);}return _0x233552[_0x147b('0x48')](_0x1923c9);}})[_0x147b('0x23')](function(_0x4779be){if(_0x4779be){return _0x4779be?{'count':_0x989d6c,'rows':_0x4779be}:null;}})[_0x147b('0x23')](respondWithResult(_0xf1c642,null))[_0x147b('0x41')](handleError(_0xf1c642,null));};exports[_0x147b('0x4a')]=function(_0x1d7af6,_0x56cf2c,_0x3b7a5d){if(_0x1d7af6[_0x147b('0x46')]['id']){delete _0x1d7af6[_0x147b('0x46')]['id'];}return db[_0x147b('0x2a')]['findOne']({'where':{'id':_0x1d7af6[_0x147b('0x47')]['id']}})[_0x147b('0x23')](handleEntityNotFound(_0x56cf2c,null))[_0x147b('0x23')](function(_0x24111d){if(_0x24111d){_0x1d7af6[_0x147b('0x46')][_0x147b('0x4b')]=_0x24111d['id'];_0x1d7af6[_0x147b('0x46')][_0x147b('0x4c')]=integrations[_0x147b('0x4d')](_0x1d7af6[_0x147b('0x46')]['channel'],_0x1d7af6[_0x147b('0x46')][_0x147b('0x4e')]);_0x1d7af6[_0x147b('0x46')]['Descriptions']=integrations['getDescriptions'](_0x1d7af6[_0x147b('0x46')][_0x147b('0x4f')],_0x1d7af6[_0x147b('0x46')][_0x147b('0x4e')]);return db['VtigerConfiguration'][_0x147b('0x45')](_0x1d7af6[_0x147b('0x46')],{'include':[{'model':db['VtigerField'],'as':_0x147b('0x4c')},{'model':db[_0x147b('0x50')],'as':'Descriptions'}]});}return null;})[_0x147b('0x23')](respondWithResult(_0x56cf2c,null))[_0x147b('0x41')](handleError(_0x56cf2c,null));};var md5=require(_0x147b('0x51'));exports[_0x147b('0x52')]=function(_0x410d26,_0x1b8206,_0x251849){var _0xfe2083=null;var _0x23034f=null;var _0x2280bc=null;var _0x863176=null;var _0x163ee8='';return db[_0x147b('0x2a')][_0x147b('0x53')]({'where':{'id':_0x410d26[_0x147b('0x47')]['id']},'attributes':['id',_0x147b('0x27'),'username',_0x147b('0x54'),_0x147b('0x55'),_0x147b('0x56'),_0x147b('0x57'),'accessKey']})[_0x147b('0x23')](handleEntityNotFound(_0x1b8206,null))[_0x147b('0x23')](function(_0x1e21c8){if(_0x1e21c8){_0xfe2083=_0x1e21c8[_0x147b('0x58')];_0x23034f=_0x1e21c8[_0x147b('0x59')];_0x2280bc=_0x1e21c8[_0x147b('0x55')];_0x163ee8=_0x1e21c8[_0x147b('0x56')];var _0x56c654=_0x163ee8[_0x147b('0x5a')](-0x1);if(_0x56c654==='/'){_0x163ee8=_0x163ee8['substring'](0x0,_0x163ee8[_0x147b('0x5b')](_0x56c654));}_0x863176=util[_0x147b('0x5c')](_0x147b('0x5d'),_0x163ee8);var _0x117bfc={'method':_0x147b('0x5e'),'uri':_0x863176,'qs':{'operation':_0x147b('0x5f'),'username':_0x1e21c8[_0x147b('0x58')]},'json':!![]};return rp(_0x117bfc);}})[_0x147b('0x23')](function(_0x2a0218){if(_0x2a0218['success']){var _0xd159d={'method':_0x147b('0x60'),'uri':_0x863176,'form':{'operation':_0x147b('0x61'),'username':_0xfe2083,'accessKey':md5(_0x2a0218[_0x147b('0x62')][_0x147b('0x63')]+_0x23034f)},'json':!![]};return rp(_0xd159d);}})[_0x147b('0x23')](function(_0x111ac0){if(_0x111ac0['success']){var _0x3ae64b={'method':_0x147b('0x5e'),'uri':_0x863176,'qs':{'operation':_0x147b('0x64'),'username':_0xfe2083,'sessionName':_0x111ac0[_0x147b('0x62')][_0x147b('0x65')],'elementType':_0x2280bc},'json':!![]};return rp(_0x3ae64b);}})[_0x147b('0x23')](function(_0x566d57){if(_0x566d57[_0x147b('0x66')]){var _0x246b45=[_0x147b('0x67'),_0x147b('0x68'),'owner'];_[_0x147b('0x69')](_0x566d57[_0x147b('0x62')][_0x147b('0x33')],function(_0x1ba4f3){return _0x246b45['includes'](_0x1ba4f3[_0x147b('0x4e')][_0x147b('0x27')]);});_[_0x147b('0x69')](_0x566d57['result'][_0x147b('0x33')],function(_0x2d1015){return _0x2d1015[_0x147b('0x6a')]===_0x147b('0x6b');});return{'count':_0x566d57['result'][_0x147b('0x33')][_0x147b('0x34')],'rows':_['map'](_0x566d57[_0x147b('0x62')]['fields'],function(_0xbdbde8){return{'id':_0xbdbde8[_0x147b('0x27')],'name':_0xbdbde8['label'],'custom':_[_0x147b('0x6c')](_0xbdbde8['name'],_0x147b('0x6d'))?!![]:![],'options':_0xbdbde8[_0x147b('0x4e')][_0x147b('0x27')]==='picklist'&&_0xbdbde8[_0x147b('0x4e')][_0x147b('0x6e')][_0x147b('0x34')]>0x0?_[_0x147b('0x29')](_0xbdbde8[_0x147b('0x4e')][_0x147b('0x6e')],function(_0x451e7f){return{'name':_0x451e7f[_0x147b('0x6f')],'value':_0x451e7f[_0x147b('0x70')]};}):[]};})};}})[_0x147b('0x23')](respondWithResult(_0x1b8206,null))[_0x147b('0x41')](function(_0x29a8da){console['log']('vTiger\x20error:\x20'+_0x29a8da);var _0x105f02=_0x410d26[_0x147b('0x2f')][_0x147b('0x71')]?0x1f4:_0x29a8da['statusCode']||0x1f4;logger[_0x147b('0x25')](_0x147b('0x72'),'getFields',_0x105f02,JSON[_0x147b('0x73')](_0x29a8da));delete _0x29a8da['name'];if(_0x105f02===0x191){_0x105f02=0x190;}_0x1b8206[_0x147b('0x18')](_0x105f02)[_0x147b('0x74')](_0x410d26[_0x147b('0x2f')][_0x147b('0x71')]?{'message':_0x147b('0x75'),'statusCode':_0x29a8da[_0x147b('0x76')]}:_0x29a8da);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e8e90ec..7dd6574 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 _0xbd15=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x4264a1,_0x4a9513){var _0x386365=function(_0x2b621e){while(--_0x2b621e){_0x4264a1['push'](_0x4264a1['shift']());}};_0x386365(++_0x4a9513);}(_0xbd15,0x178));var _0x5bd1=function(_0x28b78c,_0x1b406d){_0x28b78c=_0x28b78c-0x0;var _0x1c4f79=_0xbd15[_0x28b78c];return _0x1c4f79;};'use strict';var _=require(_0x5bd1('0x0'));var util=require(_0x5bd1('0x1'));var logger=require(_0x5bd1('0x2'))(_0x5bd1('0x3'));var moment=require(_0x5bd1('0x4'));var BPromise=require(_0x5bd1('0x5'));var rp=require(_0x5bd1('0x6'));var fs=require('fs');var path=require(_0x5bd1('0x7'));var rimraf=require(_0x5bd1('0x8'));var config=require(_0x5bd1('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x5bd1('0xa'));module['exports']=function(_0x43cfdc,_0x4d070a){return _0x43cfdc[_0x5bd1('0xb')](_0x5bd1('0xc'),attributes,{'tableName':_0x5bd1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2096=['VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xd1daa6,_0x30815b){var _0x1fe791=function(_0x35a318){while(--_0x35a318){_0xd1daa6['push'](_0xd1daa6['shift']());}};_0x1fe791(++_0x30815b);}(_0x2096,0x9c));var _0x6209=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x2096[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x6209('0x0'));var util=require('util');var logger=require(_0x6209('0x1'))(_0x6209('0x2'));var moment=require('moment');var BPromise=require(_0x6209('0x3'));var rp=require(_0x6209('0x4'));var fs=require('fs');var path=require(_0x6209('0x5'));var rimraf=require(_0x6209('0x6'));var config=require(_0x6209('0x7'));var attributes=require(_0x6209('0x8'));var integrations=require(_0x6209('0x9'));module[_0x6209('0xa')]=function(_0x25c4d3,_0x55960b){return _0x25c4d3[_0x6209('0xb')](_0x6209('0xc'),attributes,{'tableName':_0x6209('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 2b73a3e..c3107c3 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 _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'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')]('VtigerAccount,\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);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xbee3=['VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','where','ShowVtigerAccount','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0xbee3,0xd5));var _0x3bee=function(_0x552203,_0x530526){_0x552203=_0x552203-0x0;var _0x3dab1e=_0xbee3[_0x552203];return _0x3dab1e;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});}exports[_0x3bee('0x13')]=function(_0xfdba3b){var _0x631ff8=this;return new Promise(function(_0x49095a,_0x30a1de){return db[_0x3bee('0x14')][_0x3bee('0x15')]({'raw':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')][_0x3bee('0x17')]===undefined?!![]:![]:!![],'where':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b['options']['where']||null:null,'attributes':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')]['attributes']||null:null,'limit':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')][_0x3bee('0x18')]||null:null,'include':_0xfdba3b[_0x3bee('0x16')]?_0xfdba3b[_0x3bee('0x16')][_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0xfdba3b['options'][_0x3bee('0x19')],function(_0x1ed0c1){return{'model':db[_0x1ed0c1[_0x3bee('0x1b')]],'as':_0x1ed0c1['as'],'attributes':_0x1ed0c1[_0x3bee('0x1c')],'include':_0x1ed0c1['include']?_[_0x3bee('0x1a')](_0x1ed0c1[_0x3bee('0x19')],function(_0x1e0111){return{'model':db[_0x1e0111['model']],'as':_0x1e0111['as'],'attributes':_0x1e0111['attributes'],'include':_0x1e0111[_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0x1e0111['include'],function(_0x2c0e50){return{'model':db[_0x2c0e50[_0x3bee('0x1b')]],'as':_0x2c0e50['as'],'attributes':_0x2c0e50[_0x3bee('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1984c4){logger[_0x3bee('0xa')](_0x3bee('0x13'),_0xfdba3b);logger['debug'](_0x3bee('0x13'),_0xfdba3b,JSON[_0x3bee('0x1d')](_0x1984c4));_0x49095a(_0x1984c4);})[_0x3bee('0x12')](function(_0x496abd){logger[_0x3bee('0xf')](_0x3bee('0x13'),_0x496abd[_0x3bee('0x11')],_0xfdba3b);_0x30a1de(_0x631ff8[_0x3bee('0xf')](0x1f4,_0x496abd[_0x3bee('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x564e45){var _0x3fbc8c=this;return new Promise(function(_0x1e1529,_0x10bae0){return db[_0x3bee('0x14')]['find']({'raw':_0x564e45['options']?_0x564e45[_0x3bee('0x16')][_0x3bee('0x17')]===undefined?!![]:![]:!![],'where':_0x564e45['options']?_0x564e45['options'][_0x3bee('0x1e')]||null:null,'attributes':_0x564e45[_0x3bee('0x16')]?_0x564e45[_0x3bee('0x16')][_0x3bee('0x1c')]||null:null,'include':_0x564e45[_0x3bee('0x16')]?_0x564e45[_0x3bee('0x16')][_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0x564e45[_0x3bee('0x16')][_0x3bee('0x19')],function(_0x569675){return{'model':db[_0x569675['model']],'as':_0x569675['as'],'attributes':_0x569675[_0x3bee('0x1c')],'include':_0x569675['include']?_['map'](_0x569675[_0x3bee('0x19')],function(_0x1bc332){return{'model':db[_0x1bc332[_0x3bee('0x1b')]],'as':_0x1bc332['as'],'attributes':_0x1bc332[_0x3bee('0x1c')],'include':_0x1bc332[_0x3bee('0x19')]?_[_0x3bee('0x1a')](_0x1bc332[_0x3bee('0x19')],function(_0x10ace5){return{'model':db[_0x10ace5['model']],'as':_0x10ace5['as'],'attributes':_0x10ace5[_0x3bee('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3bee('0x9')](function(_0x5f046a){logger[_0x3bee('0xa')](_0x3bee('0x1f'),_0x564e45);logger[_0x3bee('0xd')](_0x3bee('0x1f'),_0x564e45,JSON[_0x3bee('0x1d')](_0x5f046a));_0x1e1529(_0x5f046a);})['catch'](function(_0x57a895){logger[_0x3bee('0xf')](_0x3bee('0x1f'),_0x57a895[_0x3bee('0x11')],_0x564e45);_0x10bae0(_0x3fbc8c[_0x3bee('0xf')](0x1f4,_0x57a895[_0x3bee('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 671f9a7..4955bf8 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 _0x6ce6=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x498478,_0x51253a){var _0x272636=function(_0x229a25){while(--_0x229a25){_0x498478['push'](_0x498478['shift']());}};_0x272636(++_0x51253a);}(_0x6ce6,0x72));var _0x66ce=function(_0x5b97d1,_0xbe5e96){_0x5b97d1=_0x5b97d1-0x0;var _0x46b053=_0x6ce6[_0x5b97d1];return _0x46b053;};'use strict';var multer=require('multer');var util=require(_0x66ce('0x0'));var path=require(_0x66ce('0x1'));var timeout=require(_0x66ce('0x2'));var express=require(_0x66ce('0x3'));var router=express[_0x66ce('0x4')]();var fs_extra=require(_0x66ce('0x5'));var auth=require(_0x66ce('0x6'));var interaction=require(_0x66ce('0x7'));var config=require(_0x66ce('0x8'));var controller=require(_0x66ce('0x9'));router[_0x66ce('0xa')]('/',auth[_0x66ce('0xb')](),controller[_0x66ce('0xc')]);router['get']('/:id',auth[_0x66ce('0xb')](),controller[_0x66ce('0xd')]);router[_0x66ce('0xa')](_0x66ce('0xe'),auth[_0x66ce('0xb')](),controller[_0x66ce('0xf')]);router['get'](_0x66ce('0x10'),auth[_0x66ce('0xb')](),controller['getSubjects']);router[_0x66ce('0xa')](_0x66ce('0x11'),auth[_0x66ce('0xb')](),controller[_0x66ce('0x12')]);router[_0x66ce('0x13')]('/',auth[_0x66ce('0xb')](),controller[_0x66ce('0x14')]);router['put']('/:id',auth[_0x66ce('0xb')](),controller[_0x66ce('0x15')]);router[_0x66ce('0x16')](_0x66ce('0x17'),auth['isAuthenticated'](),controller[_0x66ce('0x18')]);module[_0x66ce('0x19')]=router; \ No newline at end of file +var _0x7a81=['./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xa6cc7c,_0x3bdfd3){var _0xb5ccd2=function(_0x49923e){while(--_0x49923e){_0xa6cc7c['push'](_0xa6cc7c['shift']());}};_0xb5ccd2(++_0x3bdfd3);}(_0x7a81,0x82));var _0x17a8=function(_0x379978,_0x4a8b1f){_0x379978=_0x379978-0x0;var _0x399c7a=_0x7a81[_0x379978];return _0x399c7a;};'use strict';var multer=require(_0x17a8('0x0'));var util=require(_0x17a8('0x1'));var path=require(_0x17a8('0x2'));var timeout=require(_0x17a8('0x3'));var express=require(_0x17a8('0x4'));var router=express['Router']();var fs_extra=require(_0x17a8('0x5'));var auth=require(_0x17a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x17a8('0x7'));var controller=require(_0x17a8('0x8'));router[_0x17a8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x17a8('0x9')]('/:id',auth[_0x17a8('0xa')](),controller[_0x17a8('0xb')]);router[_0x17a8('0x9')](_0x17a8('0xc'),auth[_0x17a8('0xa')](),controller[_0x17a8('0xd')]);router[_0x17a8('0x9')]('/:id/subjects',auth[_0x17a8('0xa')](),controller[_0x17a8('0xe')]);router[_0x17a8('0x9')]('/:id/descriptions',auth[_0x17a8('0xa')](),controller[_0x17a8('0xf')]);router[_0x17a8('0x10')]('/',auth['isAuthenticated'](),controller[_0x17a8('0x11')]);router[_0x17a8('0x12')](_0x17a8('0x13'),auth[_0x17a8('0xa')](),controller[_0x17a8('0x14')]);router[_0x17a8('0x15')](_0x17a8('0x13'),auth[_0x17a8('0xa')](),controller[_0x17a8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c328556..6150bb1 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 _0x4a54=['STRING','exports'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x4a54,0x7d));var _0x44a5=function(_0x3f192e,_0x1cd39e){_0x3f192e=_0x3f192e-0x0;var _0x2b55ff=_0x4a54[_0x3f192e];return _0x2b55ff;};'use strict';var Sequelize=require('sequelize');module[_0x44a5('0x0')]={'name':{'type':Sequelize[_0x44a5('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0eca=['sequelize','exports','STRING'];(function(_0x31f26b,_0x3a02ea){var _0x21d90e=function(_0xb7184b){while(--_0xb7184b){_0x31f26b['push'](_0x31f26b['shift']());}};_0x21d90e(++_0x3a02ea);}(_0x0eca,0x156));var _0xa0ec=function(_0x23fb8b,_0x5ad627){_0x23fb8b=_0x23fb8b-0x0;var _0x9c821b=_0x0eca[_0x23fb8b];return _0x9c821b;};'use strict';var Sequelize=require(_0xa0ec('0x0'));module[_0xa0ec('0x1')]={'name':{'type':Sequelize[_0xa0ec('0x2')]},'description':{'type':Sequelize[_0xa0ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4bb1c2f..2319d2c 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 _0xa3bc=['body','getFields','VtigerField','getSubjects','findOne','getDescriptions','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','VtigerConfiguration','include','findAll','rows','catch','params','rawAttributes','options','find','create'];(function(_0x5dbdc8,_0xda6130){var _0x3b82a7=function(_0x439417){while(--_0x439417){_0x5dbdc8['push'](_0x5dbdc8['shift']());}};_0x3b82a7(++_0xda6130);}(_0xa3bc,0xe7));var _0xca3b=function(_0xd33d63,_0x74ba26){_0xd33d63=_0xd33d63-0x0;var _0x1032f3=_0xa3bc[_0xd33d63];return _0x1032f3;};'use strict';var emlformat=require(_0xca3b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xca3b('0x1'));var rp=require('request-promise');var moment=require(_0xca3b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xca3b('0x3'));var util=require(_0xca3b('0x4'));var path=require('path');var sox=require(_0xca3b('0x5'));var csv=require(_0xca3b('0x6'));var ejs=require(_0xca3b('0x7'));var fs=require('fs');var fs_extra=require(_0xca3b('0x8'));var _=require('lodash');var squel=require(_0xca3b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xca3b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca3b('0xb'));var Redis=require(_0xca3b('0xc'));var authService=require(_0xca3b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xca3b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca3b('0xf'))(_0xca3b('0x10'));var utils=require(_0xca3b('0x11'));var config=require(_0xca3b('0x12'));var licenseUtil=require(_0xca3b('0x13'));var db=require(_0xca3b('0x14'))['db'];function respondWithStatusCode(_0x27056c,_0x34a68e){_0x34a68e=_0x34a68e||0xcc;return function(_0x568c3f){if(_0x568c3f){return _0x27056c[_0xca3b('0x15')](_0x34a68e);}return _0x27056c[_0xca3b('0x16')](_0x34a68e)[_0xca3b('0x17')]();};}function respondWithResult(_0x25d05f,_0x247d32){_0x247d32=_0x247d32||0xc8;return function(_0x2b96f9){if(_0x2b96f9){return _0x25d05f[_0xca3b('0x16')](_0x247d32)['json'](_0x2b96f9);}};}function respondWithFilteredResult(_0x13c54c,_0x1c6c84){return function(_0x1693c6){if(_0x1693c6){var _0x1079e4=typeof _0x1c6c84[_0xca3b('0x18')]===_0xca3b('0x19')&&typeof _0x1c6c84['limit']===_0xca3b('0x19');var _0x423434=_0x1693c6[_0xca3b('0x1a')];var _0x1c8530=_0x1079e4?0x0:_0x1c6c84[_0xca3b('0x18')];var _0x5c9cd3=_0x1079e4?_0x1693c6[_0xca3b('0x1a')]:_0x1c6c84[_0xca3b('0x18')]+_0x1c6c84[_0xca3b('0x1b')];var _0x59c552;if(_0x5c9cd3>=_0x423434){_0x5c9cd3=_0x423434;_0x59c552=0xc8;}else{_0x59c552=0xce;}_0x13c54c['status'](_0x59c552);return _0x13c54c[_0xca3b('0x1c')]('Content-Range',_0x1c8530+'-'+_0x5c9cd3+'/'+_0x423434)[_0xca3b('0x1d')](_0x1693c6);}return null;};}function patchUpdates(_0x3807d2){return function(_0x1df409){try{jsonpatch[_0xca3b('0x1e')](_0x1df409,_0x3807d2,!![]);}catch(_0x44ca03){return BPromise[_0xca3b('0x1f')](_0x44ca03);}return _0x1df409[_0xca3b('0x20')]();};}function saveUpdates(_0x375631,_0x1701e0){return function(_0x5a71ff){if(_0x5a71ff){return _0x5a71ff[_0xca3b('0x21')](_0x375631)[_0xca3b('0x22')](function(_0xc7f3b7){return _0xc7f3b7;});}return null;};}function removeEntity(_0x440e73,_0x4f7f3c){return function(_0x415e72){if(_0x415e72){return _0x415e72[_0xca3b('0x23')]()['then'](function(){_0x440e73[_0xca3b('0x16')](0xcc)[_0xca3b('0x17')]();});}};}function handleEntityNotFound(_0x2b8b7,_0xbde5ab){return function(_0x261d0e){if(!_0x261d0e){_0x2b8b7[_0xca3b('0x15')](0x194);}return _0x261d0e;};}function handleError(_0x23b91f,_0x49ca1c){_0x49ca1c=_0x49ca1c||0x1f4;return function(_0x3c8e12){logger[_0xca3b('0x24')](_0x3c8e12[_0xca3b('0x25')]);if(_0x3c8e12['name']){delete _0x3c8e12[_0xca3b('0x26')];}_0x23b91f[_0xca3b('0x16')](_0x49ca1c)['send'](_0x3c8e12);};}exports[_0xca3b('0x27')]=function(_0x1d0a3b,_0xd0f9b4){var _0x3733f4={},_0x445572={},_0x321246={'count':0x0,'rows':[]};var _0x3d6694=_[_0xca3b('0x28')](db['VtigerConfiguration']['rawAttributes'],function(_0x1e0869){return{'name':_0x1e0869[_0xca3b('0x29')],'type':_0x1e0869[_0xca3b('0x2a')]['key']};});_0x445572['model']=_[_0xca3b('0x28')](_0x3d6694,_0xca3b('0x26'));_0x445572[_0xca3b('0x2b')]=_[_0xca3b('0x2c')](_0x1d0a3b['query']);_0x445572['filters']=_[_0xca3b('0x2d')](_0x445572[_0xca3b('0x2e')],_0x445572[_0xca3b('0x2b')]);_0x3733f4[_0xca3b('0x2f')]=_[_0xca3b('0x2d')](_0x445572[_0xca3b('0x2e')],qs[_0xca3b('0x30')](_0x1d0a3b[_0xca3b('0x2b')]['fields']));_0x3733f4[_0xca3b('0x2f')]=_0x3733f4[_0xca3b('0x2f')][_0xca3b('0x31')]?_0x3733f4[_0xca3b('0x2f')]:_0x445572[_0xca3b('0x2e')];if(!_0x1d0a3b['query'][_0xca3b('0x32')](_0xca3b('0x33'))){_0x3733f4[_0xca3b('0x1b')]=qs['limit'](_0x1d0a3b[_0xca3b('0x2b')][_0xca3b('0x1b')]);_0x3733f4[_0xca3b('0x18')]=qs[_0xca3b('0x18')](_0x1d0a3b[_0xca3b('0x2b')]['offset']);}_0x3733f4[_0xca3b('0x34')]=qs[_0xca3b('0x35')](_0x1d0a3b[_0xca3b('0x2b')][_0xca3b('0x35')]);_0x3733f4[_0xca3b('0x36')]=qs[_0xca3b('0x37')](_[_0xca3b('0x38')](_0x1d0a3b['query'],_0x445572[_0xca3b('0x37')]),_0x3d6694);if(_0x1d0a3b[_0xca3b('0x2b')]['filter']){_0x3733f4[_0xca3b('0x36')]=_[_0xca3b('0x39')](_0x3733f4['where'],{'$or':_[_0xca3b('0x28')](_0x3d6694,function(_0x2c5c32){if(_0x2c5c32[_0xca3b('0x2a')]!=='VIRTUAL'){var _0x1acfdc={};_0x1acfdc[_0x2c5c32[_0xca3b('0x26')]]={'$like':'%'+_0x1d0a3b['query'][_0xca3b('0x3a')]+'%'};return _0x1acfdc;}})});}_0x3733f4=_[_0xca3b('0x39')]({},_0x3733f4,_0x1d0a3b['options']);var _0x5c8361={'where':_0x3733f4[_0xca3b('0x36')]};return db[_0xca3b('0x3b')][_0xca3b('0x1a')](_0x5c8361)[_0xca3b('0x22')](function(_0x39e629){_0x321246[_0xca3b('0x1a')]=_0x39e629;if(_0x1d0a3b[_0xca3b('0x2b')]['includeAll']){_0x3733f4[_0xca3b('0x3c')]=[{'all':!![]}];}return db[_0xca3b('0x3b')][_0xca3b('0x3d')](_0x3733f4);})[_0xca3b('0x22')](function(_0x52181a){_0x321246[_0xca3b('0x3e')]=_0x52181a;return _0x321246;})[_0xca3b('0x22')](respondWithFilteredResult(_0xd0f9b4,_0x3733f4))[_0xca3b('0x3f')](handleError(_0xd0f9b4,null));};exports['show']=function(_0x3658fb,_0x451805){var _0x574af8={'raw':![],'where':{'id':_0x3658fb[_0xca3b('0x40')]['id']}},_0x3a7c50={};_0x3a7c50[_0xca3b('0x2e')]=_[_0xca3b('0x2c')](db[_0xca3b('0x3b')][_0xca3b('0x41')]);_0x3a7c50[_0xca3b('0x2b')]=_[_0xca3b('0x2c')](_0x3658fb[_0xca3b('0x2b')]);_0x3a7c50[_0xca3b('0x37')]=_[_0xca3b('0x2d')](_0x3a7c50['model'],_0x3a7c50[_0xca3b('0x2b')]);_0x574af8[_0xca3b('0x2f')]=_[_0xca3b('0x2d')](_0x3a7c50[_0xca3b('0x2e')],qs['fields'](_0x3658fb['query'][_0xca3b('0x30')]));_0x574af8['attributes']=_0x574af8[_0xca3b('0x2f')][_0xca3b('0x31')]?_0x574af8[_0xca3b('0x2f')]:_0x3a7c50[_0xca3b('0x2e')];if(_0x3658fb[_0xca3b('0x2b')]['includeAll']){_0x574af8[_0xca3b('0x3c')]=[{'all':!![]}];}_0x574af8=_[_0xca3b('0x39')]({},_0x574af8,_0x3658fb[_0xca3b('0x42')]);return db['VtigerConfiguration'][_0xca3b('0x43')](_0x574af8)[_0xca3b('0x22')](handleEntityNotFound(_0x451805,null))[_0xca3b('0x22')](respondWithResult(_0x451805,null))['catch'](handleError(_0x451805,null));};exports[_0xca3b('0x44')]=function(_0x4e22bc,_0x5be6d4){return db[_0xca3b('0x3b')][_0xca3b('0x44')](_0x4e22bc[_0xca3b('0x45')],{})[_0xca3b('0x22')](respondWithResult(_0x5be6d4,0xc9))['catch'](handleError(_0x5be6d4,null));};exports[_0xca3b('0x21')]=function(_0x125c62,_0x2c5c07){if(_0x125c62[_0xca3b('0x45')]['id']){delete _0x125c62[_0xca3b('0x45')]['id'];}return db[_0xca3b('0x3b')]['find']({'where':{'id':_0x125c62[_0xca3b('0x40')]['id']}})[_0xca3b('0x22')](handleEntityNotFound(_0x2c5c07,null))[_0xca3b('0x22')](saveUpdates(_0x125c62[_0xca3b('0x45')],null))['then'](respondWithResult(_0x2c5c07,null))[_0xca3b('0x3f')](handleError(_0x2c5c07,null));};exports[_0xca3b('0x23')]=function(_0x5acf4e,_0x5c13d0){return db['VtigerConfiguration']['find']({'where':{'id':_0x5acf4e[_0xca3b('0x40')]['id']}})[_0xca3b('0x22')](handleEntityNotFound(_0x5c13d0,null))[_0xca3b('0x22')](removeEntity(_0x5c13d0,null))['catch'](handleError(_0x5c13d0,null));};exports[_0xca3b('0x46')]=function(_0x3983a8,_0x2dc1a5,_0x503d13){var _0x570567={};var _0x750292={};var _0x5f1b18;var _0xcdd29;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x3983a8[_0xca3b('0x40')]['id']}})[_0xca3b('0x22')](handleEntityNotFound(_0x2dc1a5,null))[_0xca3b('0x22')](function(_0x392870){if(_0x392870){_0x5f1b18=_0x392870;_0x750292['model']=_[_0xca3b('0x2c')](db[_0xca3b('0x47')][_0xca3b('0x41')]);_0x750292['query']=_[_0xca3b('0x2c')](_0x3983a8['query']);_0x750292[_0xca3b('0x37')]=_[_0xca3b('0x2d')](_0x750292[_0xca3b('0x2e')],_0x750292[_0xca3b('0x2b')]);_0x570567[_0xca3b('0x2f')]=_['intersection'](_0x750292[_0xca3b('0x2e')],qs[_0xca3b('0x30')](_0x3983a8['query'][_0xca3b('0x30')]));_0x570567['attributes']=_0x570567[_0xca3b('0x2f')][_0xca3b('0x31')]?_0x570567[_0xca3b('0x2f')]:_0x750292[_0xca3b('0x2e')];_0x570567['order']=qs[_0xca3b('0x35')](_0x3983a8[_0xca3b('0x2b')][_0xca3b('0x35')]);_0x570567[_0xca3b('0x36')]=qs['filters'](_[_0xca3b('0x38')](_0x3983a8[_0xca3b('0x2b')],_0x750292[_0xca3b('0x37')]));if(_0x3983a8[_0xca3b('0x2b')]['filter']){_0x570567['where']=_['merge'](_0x570567[_0xca3b('0x36')],{'$or':_['map'](_0x570567[_0xca3b('0x2f')],function(_0x108d1a){var _0x541ad1={};_0x541ad1[_0x108d1a]={'$like':'%'+_0x3983a8[_0xca3b('0x2b')][_0xca3b('0x3a')]+'%'};return _0x541ad1;})});}_0x570567=_[_0xca3b('0x39')]({},_0x570567,_0x3983a8['options']);return _0x5f1b18['getFields'](_0x570567);}})[_0xca3b('0x22')](function(_0x385645){if(_0x385645){_0xcdd29=_0x385645[_0xca3b('0x31')];if(!_0x3983a8[_0xca3b('0x2b')][_0xca3b('0x32')](_0xca3b('0x33'))){_0x570567[_0xca3b('0x1b')]=qs['limit'](_0x3983a8['query'][_0xca3b('0x1b')]);_0x570567[_0xca3b('0x18')]=qs[_0xca3b('0x18')](_0x3983a8[_0xca3b('0x2b')][_0xca3b('0x18')]);}return _0x5f1b18[_0xca3b('0x46')](_0x570567);}})[_0xca3b('0x22')](function(_0x4a4bd6){if(_0x4a4bd6){return _0x4a4bd6?{'count':_0xcdd29,'rows':_0x4a4bd6}:null;}})[_0xca3b('0x22')](respondWithResult(_0x2dc1a5,null))['catch'](handleError(_0x2dc1a5,null));};exports[_0xca3b('0x48')]=function(_0xa7c49e,_0x561c37,_0x1304ec){var _0x25994f={};var _0x197ac1={};var _0x613e4;var _0x33e1f5;return db[_0xca3b('0x3b')][_0xca3b('0x49')]({'where':{'id':_0xa7c49e['params']['id']}})[_0xca3b('0x22')](handleEntityNotFound(_0x561c37,null))[_0xca3b('0x22')](function(_0xe4a5c7){if(_0xe4a5c7){_0x613e4=_0xe4a5c7;_0x197ac1[_0xca3b('0x2e')]=_['keys'](db[_0xca3b('0x47')][_0xca3b('0x41')]);_0x197ac1[_0xca3b('0x2b')]=_[_0xca3b('0x2c')](_0xa7c49e[_0xca3b('0x2b')]);_0x197ac1[_0xca3b('0x37')]=_[_0xca3b('0x2d')](_0x197ac1[_0xca3b('0x2e')],_0x197ac1[_0xca3b('0x2b')]);_0x25994f['attributes']=_[_0xca3b('0x2d')](_0x197ac1[_0xca3b('0x2e')],qs['fields'](_0xa7c49e['query']['fields']));_0x25994f['attributes']=_0x25994f['attributes'][_0xca3b('0x31')]?_0x25994f[_0xca3b('0x2f')]:_0x197ac1[_0xca3b('0x2e')];_0x25994f['order']=qs[_0xca3b('0x35')](_0xa7c49e[_0xca3b('0x2b')][_0xca3b('0x35')]);_0x25994f[_0xca3b('0x36')]=qs[_0xca3b('0x37')](_[_0xca3b('0x38')](_0xa7c49e[_0xca3b('0x2b')],_0x197ac1[_0xca3b('0x37')]));if(_0xa7c49e['query'][_0xca3b('0x3a')]){_0x25994f[_0xca3b('0x36')]=_[_0xca3b('0x39')](_0x25994f[_0xca3b('0x36')],{'$or':_['map'](_0x25994f[_0xca3b('0x2f')],function(_0x59b014){var _0x184019={};_0x184019[_0x59b014]={'$like':'%'+_0xa7c49e[_0xca3b('0x2b')][_0xca3b('0x3a')]+'%'};return _0x184019;})});}_0x25994f=_['merge']({},_0x25994f,_0xa7c49e[_0xca3b('0x42')]);return _0x613e4['getSubjects'](_0x25994f);}})[_0xca3b('0x22')](function(_0x2fb7df){if(_0x2fb7df){_0x33e1f5=_0x2fb7df[_0xca3b('0x31')];if(!_0xa7c49e['query']['hasOwnProperty']('nolimit')){_0x25994f['limit']=qs[_0xca3b('0x1b')](_0xa7c49e[_0xca3b('0x2b')][_0xca3b('0x1b')]);_0x25994f[_0xca3b('0x18')]=qs['offset'](_0xa7c49e[_0xca3b('0x2b')]['offset']);}return _0x613e4[_0xca3b('0x48')](_0x25994f);}})['then'](function(_0x4f33e8){if(_0x4f33e8){return _0x4f33e8?{'count':_0x33e1f5,'rows':_0x4f33e8}:null;}})[_0xca3b('0x22')](respondWithResult(_0x561c37,null))['catch'](handleError(_0x561c37,null));};exports[_0xca3b('0x4a')]=function(_0x2b6016,_0x2372d9,_0xcf9436){var _0x55ae4c={};var _0x15214f={};var _0x1b54e7;var _0x50a3ff;return db[_0xca3b('0x3b')][_0xca3b('0x49')]({'where':{'id':_0x2b6016['params']['id']}})['then'](handleEntityNotFound(_0x2372d9,null))['then'](function(_0x23dbc5){if(_0x23dbc5){_0x1b54e7=_0x23dbc5;_0x15214f[_0xca3b('0x2e')]=_[_0xca3b('0x2c')](db[_0xca3b('0x47')][_0xca3b('0x41')]);_0x15214f[_0xca3b('0x2b')]=_[_0xca3b('0x2c')](_0x2b6016[_0xca3b('0x2b')]);_0x15214f['filters']=_['intersection'](_0x15214f[_0xca3b('0x2e')],_0x15214f[_0xca3b('0x2b')]);_0x55ae4c[_0xca3b('0x2f')]=_[_0xca3b('0x2d')](_0x15214f[_0xca3b('0x2e')],qs['fields'](_0x2b6016[_0xca3b('0x2b')][_0xca3b('0x30')]));_0x55ae4c[_0xca3b('0x2f')]=_0x55ae4c['attributes'][_0xca3b('0x31')]?_0x55ae4c[_0xca3b('0x2f')]:_0x15214f[_0xca3b('0x2e')];_0x55ae4c['order']=qs[_0xca3b('0x35')](_0x2b6016[_0xca3b('0x2b')][_0xca3b('0x35')]);_0x55ae4c[_0xca3b('0x36')]=qs[_0xca3b('0x37')](_[_0xca3b('0x38')](_0x2b6016['query'],_0x15214f[_0xca3b('0x37')]));if(_0x2b6016[_0xca3b('0x2b')][_0xca3b('0x3a')]){_0x55ae4c['where']=_[_0xca3b('0x39')](_0x55ae4c[_0xca3b('0x36')],{'$or':_[_0xca3b('0x28')](_0x55ae4c['attributes'],function(_0x201593){var _0x5ae092={};_0x5ae092[_0x201593]={'$like':'%'+_0x2b6016[_0xca3b('0x2b')][_0xca3b('0x3a')]+'%'};return _0x5ae092;})});}_0x55ae4c=_[_0xca3b('0x39')]({},_0x55ae4c,_0x2b6016[_0xca3b('0x42')]);return _0x1b54e7[_0xca3b('0x4a')](_0x55ae4c);}})['then'](function(_0x4c61e7){if(_0x4c61e7){_0x50a3ff=_0x4c61e7[_0xca3b('0x31')];if(!_0x2b6016[_0xca3b('0x2b')]['hasOwnProperty'](_0xca3b('0x33'))){_0x55ae4c[_0xca3b('0x1b')]=qs[_0xca3b('0x1b')](_0x2b6016[_0xca3b('0x2b')][_0xca3b('0x1b')]);_0x55ae4c[_0xca3b('0x18')]=qs[_0xca3b('0x18')](_0x2b6016[_0xca3b('0x2b')][_0xca3b('0x18')]);}return _0x1b54e7[_0xca3b('0x4a')](_0x55ae4c);}})[_0xca3b('0x22')](function(_0x577282){if(_0x577282){return _0x577282?{'count':_0x50a3ff,'rows':_0x577282}:null;}})[_0xca3b('0x22')](respondWithResult(_0x2372d9,null))[_0xca3b('0x3f')](handleError(_0x2372d9,null));}; \ No newline at end of file +var _0x7ef9=['includeAll','include','findAll','rows','show','params','fields','find','catch','body','update','getFields','findOne','VtigerField','rawAttributes','getSubjects','hasOwnProperty','getDescriptions','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','VtigerConfiguration'];(function(_0x4acf89,_0x262cef){var _0x2c2a24=function(_0x2a82af){while(--_0x2a82af){_0x4acf89['push'](_0x4acf89['shift']());}};_0x2c2a24(++_0x262cef);}(_0x7ef9,0x13e));var _0x97ef=function(_0x40291e,_0x2a1245){_0x40291e=_0x40291e-0x0;var _0x3e0d18=_0x7ef9[_0x40291e];return _0x3e0d18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97ef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97ef('0x1'));var rp=require('request-promise');var moment=require(_0x97ef('0x2'));var BPromise=require(_0x97ef('0x3'));var Mustache=require(_0x97ef('0x4'));var util=require('util');var path=require(_0x97ef('0x5'));var sox=require(_0x97ef('0x6'));var csv=require(_0x97ef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97ef('0x8'));var _=require('lodash');var squel=require(_0x97ef('0x9'));var crypto=require(_0x97ef('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x97ef('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x97ef('0xb'));var authService=require(_0x97ef('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x97ef('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97ef('0xe'))(_0x97ef('0xf'));var utils=require('../../config/utils');var config=require(_0x97ef('0x10'));var licenseUtil=require(_0x97ef('0x11'));var db=require(_0x97ef('0x12'))['db'];function respondWithStatusCode(_0xd5883d,_0x18d37e){_0x18d37e=_0x18d37e||0xcc;return function(_0x56c06d){if(_0x56c06d){return _0xd5883d[_0x97ef('0x13')](_0x18d37e);}return _0xd5883d[_0x97ef('0x14')](_0x18d37e)['end']();};}function respondWithResult(_0xc1bdc6,_0x5b07c7){_0x5b07c7=_0x5b07c7||0xc8;return function(_0x37bdb1){if(_0x37bdb1){return _0xc1bdc6[_0x97ef('0x14')](_0x5b07c7)['json'](_0x37bdb1);}};}function respondWithFilteredResult(_0x1dc8f3,_0x13b858){return function(_0x53e1c9){if(_0x53e1c9){var _0x1fdb09=typeof _0x13b858[_0x97ef('0x15')]===_0x97ef('0x16')&&typeof _0x13b858[_0x97ef('0x17')]==='undefined';var _0x251ece=_0x53e1c9[_0x97ef('0x18')];var _0x3c0b3b=_0x1fdb09?0x0:_0x13b858[_0x97ef('0x15')];var _0x45ec28=_0x1fdb09?_0x53e1c9['count']:_0x13b858[_0x97ef('0x15')]+_0x13b858[_0x97ef('0x17')];var _0x454efe;if(_0x45ec28>=_0x251ece){_0x45ec28=_0x251ece;_0x454efe=0xc8;}else{_0x454efe=0xce;}_0x1dc8f3[_0x97ef('0x14')](_0x454efe);return _0x1dc8f3[_0x97ef('0x19')](_0x97ef('0x1a'),_0x3c0b3b+'-'+_0x45ec28+'/'+_0x251ece)[_0x97ef('0x1b')](_0x53e1c9);}return null;};}function patchUpdates(_0x1724a5){return function(_0x5e4543){try{jsonpatch[_0x97ef('0x1c')](_0x5e4543,_0x1724a5,!![]);}catch(_0x1de69a){return BPromise[_0x97ef('0x1d')](_0x1de69a);}return _0x5e4543[_0x97ef('0x1e')]();};}function saveUpdates(_0x339376,_0x280b65){return function(_0x49794a){if(_0x49794a){return _0x49794a['update'](_0x339376)[_0x97ef('0x1f')](function(_0x57d693){return _0x57d693;});}return null;};}function removeEntity(_0x528ad3,_0x1d1281){return function(_0x4b484f){if(_0x4b484f){return _0x4b484f[_0x97ef('0x20')]()['then'](function(){_0x528ad3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c414,_0x2a6833){return function(_0x5923e9){if(!_0x5923e9){_0x18c414[_0x97ef('0x13')](0x194);}return _0x5923e9;};}function handleError(_0x536add,_0x515f60){_0x515f60=_0x515f60||0x1f4;return function(_0x112781){logger[_0x97ef('0x21')](_0x112781['stack']);if(_0x112781[_0x97ef('0x22')]){delete _0x112781[_0x97ef('0x22')];}_0x536add[_0x97ef('0x14')](_0x515f60)[_0x97ef('0x23')](_0x112781);};}exports['index']=function(_0x30905e,_0x185f15){var _0x433842={},_0x1fdcee={},_0x2b93b8={'count':0x0,'rows':[]};var _0x5189fb=_['map'](db['VtigerConfiguration']['rawAttributes'],function(_0x5bb884){return{'name':_0x5bb884[_0x97ef('0x24')],'type':_0x5bb884[_0x97ef('0x25')][_0x97ef('0x26')]};});_0x1fdcee[_0x97ef('0x27')]=_[_0x97ef('0x28')](_0x5189fb,_0x97ef('0x22'));_0x1fdcee[_0x97ef('0x29')]=_[_0x97ef('0x2a')](_0x30905e[_0x97ef('0x29')]);_0x1fdcee[_0x97ef('0x2b')]=_['intersection'](_0x1fdcee[_0x97ef('0x27')],_0x1fdcee[_0x97ef('0x29')]);_0x433842[_0x97ef('0x2c')]=_[_0x97ef('0x2d')](_0x1fdcee[_0x97ef('0x27')],qs['fields'](_0x30905e[_0x97ef('0x29')]['fields']));_0x433842[_0x97ef('0x2c')]=_0x433842[_0x97ef('0x2c')][_0x97ef('0x2e')]?_0x433842[_0x97ef('0x2c')]:_0x1fdcee[_0x97ef('0x27')];if(!_0x30905e[_0x97ef('0x29')]['hasOwnProperty'](_0x97ef('0x2f'))){_0x433842[_0x97ef('0x17')]=qs[_0x97ef('0x17')](_0x30905e[_0x97ef('0x29')][_0x97ef('0x17')]);_0x433842[_0x97ef('0x15')]=qs[_0x97ef('0x15')](_0x30905e[_0x97ef('0x29')]['offset']);}_0x433842[_0x97ef('0x30')]=qs[_0x97ef('0x31')](_0x30905e[_0x97ef('0x29')][_0x97ef('0x31')]);_0x433842['where']=qs['filters'](_[_0x97ef('0x32')](_0x30905e[_0x97ef('0x29')],_0x1fdcee[_0x97ef('0x2b')]),_0x5189fb);if(_0x30905e[_0x97ef('0x29')][_0x97ef('0x33')]){_0x433842[_0x97ef('0x34')]=_['merge'](_0x433842['where'],{'$or':_['map'](_0x5189fb,function(_0x1877f5){if(_0x1877f5[_0x97ef('0x25')]!==_0x97ef('0x35')){var _0x14d6ca={};_0x14d6ca[_0x1877f5['name']]={'$like':'%'+_0x30905e[_0x97ef('0x29')]['filter']+'%'};return _0x14d6ca;}})});}_0x433842=_[_0x97ef('0x36')]({},_0x433842,_0x30905e[_0x97ef('0x37')]);var _0x279d5c={'where':_0x433842[_0x97ef('0x34')]};return db[_0x97ef('0x38')]['count'](_0x279d5c)['then'](function(_0x4e54d5){_0x2b93b8[_0x97ef('0x18')]=_0x4e54d5;if(_0x30905e[_0x97ef('0x29')][_0x97ef('0x39')]){_0x433842[_0x97ef('0x3a')]=[{'all':!![]}];}return db[_0x97ef('0x38')][_0x97ef('0x3b')](_0x433842);})[_0x97ef('0x1f')](function(_0x2b0a31){_0x2b93b8[_0x97ef('0x3c')]=_0x2b0a31;return _0x2b93b8;})[_0x97ef('0x1f')](respondWithFilteredResult(_0x185f15,_0x433842))['catch'](handleError(_0x185f15,null));};exports[_0x97ef('0x3d')]=function(_0x471f80,_0x3f18bd){var _0x2df5e3={'raw':![],'where':{'id':_0x471f80[_0x97ef('0x3e')]['id']}},_0x44bb22={};_0x44bb22[_0x97ef('0x27')]=_[_0x97ef('0x2a')](db['VtigerConfiguration']['rawAttributes']);_0x44bb22[_0x97ef('0x29')]=_[_0x97ef('0x2a')](_0x471f80['query']);_0x44bb22[_0x97ef('0x2b')]=_[_0x97ef('0x2d')](_0x44bb22['model'],_0x44bb22[_0x97ef('0x29')]);_0x2df5e3[_0x97ef('0x2c')]=_[_0x97ef('0x2d')](_0x44bb22['model'],qs[_0x97ef('0x3f')](_0x471f80[_0x97ef('0x29')][_0x97ef('0x3f')]));_0x2df5e3['attributes']=_0x2df5e3[_0x97ef('0x2c')]['length']?_0x2df5e3[_0x97ef('0x2c')]:_0x44bb22[_0x97ef('0x27')];if(_0x471f80['query'][_0x97ef('0x39')]){_0x2df5e3[_0x97ef('0x3a')]=[{'all':!![]}];}_0x2df5e3=_[_0x97ef('0x36')]({},_0x2df5e3,_0x471f80[_0x97ef('0x37')]);return db[_0x97ef('0x38')][_0x97ef('0x40')](_0x2df5e3)[_0x97ef('0x1f')](handleEntityNotFound(_0x3f18bd,null))[_0x97ef('0x1f')](respondWithResult(_0x3f18bd,null))[_0x97ef('0x41')](handleError(_0x3f18bd,null));};exports['create']=function(_0x189b70,_0x3ee246){return db[_0x97ef('0x38')]['create'](_0x189b70[_0x97ef('0x42')],{})[_0x97ef('0x1f')](respondWithResult(_0x3ee246,0xc9))[_0x97ef('0x41')](handleError(_0x3ee246,null));};exports[_0x97ef('0x43')]=function(_0x43c5ea,_0x15ad26){if(_0x43c5ea[_0x97ef('0x42')]['id']){delete _0x43c5ea[_0x97ef('0x42')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x43c5ea[_0x97ef('0x3e')]['id']}})[_0x97ef('0x1f')](handleEntityNotFound(_0x15ad26,null))['then'](saveUpdates(_0x43c5ea[_0x97ef('0x42')],null))[_0x97ef('0x1f')](respondWithResult(_0x15ad26,null))[_0x97ef('0x41')](handleError(_0x15ad26,null));};exports['destroy']=function(_0x2791cd,_0x568901){return db['VtigerConfiguration'][_0x97ef('0x40')]({'where':{'id':_0x2791cd['params']['id']}})[_0x97ef('0x1f')](handleEntityNotFound(_0x568901,null))[_0x97ef('0x1f')](removeEntity(_0x568901,null))[_0x97ef('0x41')](handleError(_0x568901,null));};exports[_0x97ef('0x44')]=function(_0x57c949,_0x19e90e,_0x4caedc){var _0x1602f1={};var _0x1c960e={};var _0x2b4337;var _0x1a4d36;return db[_0x97ef('0x38')][_0x97ef('0x45')]({'where':{'id':_0x57c949['params']['id']}})[_0x97ef('0x1f')](handleEntityNotFound(_0x19e90e,null))[_0x97ef('0x1f')](function(_0x1301f1){if(_0x1301f1){_0x2b4337=_0x1301f1;_0x1c960e[_0x97ef('0x27')]=_['keys'](db[_0x97ef('0x46')][_0x97ef('0x47')]);_0x1c960e[_0x97ef('0x29')]=_[_0x97ef('0x2a')](_0x57c949[_0x97ef('0x29')]);_0x1c960e[_0x97ef('0x2b')]=_[_0x97ef('0x2d')](_0x1c960e[_0x97ef('0x27')],_0x1c960e[_0x97ef('0x29')]);_0x1602f1['attributes']=_[_0x97ef('0x2d')](_0x1c960e['model'],qs[_0x97ef('0x3f')](_0x57c949[_0x97ef('0x29')]['fields']));_0x1602f1[_0x97ef('0x2c')]=_0x1602f1[_0x97ef('0x2c')][_0x97ef('0x2e')]?_0x1602f1[_0x97ef('0x2c')]:_0x1c960e[_0x97ef('0x27')];_0x1602f1[_0x97ef('0x30')]=qs[_0x97ef('0x31')](_0x57c949['query']['sort']);_0x1602f1[_0x97ef('0x34')]=qs['filters'](_['pick'](_0x57c949[_0x97ef('0x29')],_0x1c960e[_0x97ef('0x2b')]));if(_0x57c949[_0x97ef('0x29')]['filter']){_0x1602f1['where']=_['merge'](_0x1602f1[_0x97ef('0x34')],{'$or':_[_0x97ef('0x28')](_0x1602f1[_0x97ef('0x2c')],function(_0x8f9dba){var _0x35ddd5={};_0x35ddd5[_0x8f9dba]={'$like':'%'+_0x57c949[_0x97ef('0x29')][_0x97ef('0x33')]+'%'};return _0x35ddd5;})});}_0x1602f1=_['merge']({},_0x1602f1,_0x57c949['options']);return _0x2b4337[_0x97ef('0x44')](_0x1602f1);}})[_0x97ef('0x1f')](function(_0x207880){if(_0x207880){_0x1a4d36=_0x207880[_0x97ef('0x2e')];if(!_0x57c949[_0x97ef('0x29')]['hasOwnProperty'](_0x97ef('0x2f'))){_0x1602f1['limit']=qs[_0x97ef('0x17')](_0x57c949[_0x97ef('0x29')][_0x97ef('0x17')]);_0x1602f1[_0x97ef('0x15')]=qs['offset'](_0x57c949[_0x97ef('0x29')][_0x97ef('0x15')]);}return _0x2b4337[_0x97ef('0x44')](_0x1602f1);}})[_0x97ef('0x1f')](function(_0x22cd52){if(_0x22cd52){return _0x22cd52?{'count':_0x1a4d36,'rows':_0x22cd52}:null;}})[_0x97ef('0x1f')](respondWithResult(_0x19e90e,null))[_0x97ef('0x41')](handleError(_0x19e90e,null));};exports['getSubjects']=function(_0x5d3c95,_0x1de419,_0x1b6026){var _0x223c30={};var _0x3830b1={};var _0x35fcad;var _0x115a95;return db[_0x97ef('0x38')][_0x97ef('0x45')]({'where':{'id':_0x5d3c95['params']['id']}})[_0x97ef('0x1f')](handleEntityNotFound(_0x1de419,null))[_0x97ef('0x1f')](function(_0x24440d){if(_0x24440d){_0x35fcad=_0x24440d;_0x3830b1[_0x97ef('0x27')]=_[_0x97ef('0x2a')](db['VtigerField'][_0x97ef('0x47')]);_0x3830b1['query']=_[_0x97ef('0x2a')](_0x5d3c95[_0x97ef('0x29')]);_0x3830b1[_0x97ef('0x2b')]=_[_0x97ef('0x2d')](_0x3830b1[_0x97ef('0x27')],_0x3830b1['query']);_0x223c30['attributes']=_[_0x97ef('0x2d')](_0x3830b1['model'],qs[_0x97ef('0x3f')](_0x5d3c95[_0x97ef('0x29')]['fields']));_0x223c30[_0x97ef('0x2c')]=_0x223c30[_0x97ef('0x2c')]['length']?_0x223c30[_0x97ef('0x2c')]:_0x3830b1[_0x97ef('0x27')];_0x223c30[_0x97ef('0x30')]=qs[_0x97ef('0x31')](_0x5d3c95[_0x97ef('0x29')]['sort']);_0x223c30[_0x97ef('0x34')]=qs['filters'](_[_0x97ef('0x32')](_0x5d3c95[_0x97ef('0x29')],_0x3830b1[_0x97ef('0x2b')]));if(_0x5d3c95['query'][_0x97ef('0x33')]){_0x223c30['where']=_['merge'](_0x223c30[_0x97ef('0x34')],{'$or':_[_0x97ef('0x28')](_0x223c30[_0x97ef('0x2c')],function(_0x23203b){var _0x18c3b5={};_0x18c3b5[_0x23203b]={'$like':'%'+_0x5d3c95[_0x97ef('0x29')]['filter']+'%'};return _0x18c3b5;})});}_0x223c30=_[_0x97ef('0x36')]({},_0x223c30,_0x5d3c95[_0x97ef('0x37')]);return _0x35fcad[_0x97ef('0x48')](_0x223c30);}})[_0x97ef('0x1f')](function(_0x459729){if(_0x459729){_0x115a95=_0x459729[_0x97ef('0x2e')];if(!_0x5d3c95[_0x97ef('0x29')][_0x97ef('0x49')](_0x97ef('0x2f'))){_0x223c30['limit']=qs['limit'](_0x5d3c95[_0x97ef('0x29')]['limit']);_0x223c30[_0x97ef('0x15')]=qs[_0x97ef('0x15')](_0x5d3c95[_0x97ef('0x29')][_0x97ef('0x15')]);}return _0x35fcad[_0x97ef('0x48')](_0x223c30);}})[_0x97ef('0x1f')](function(_0x11f602){if(_0x11f602){return _0x11f602?{'count':_0x115a95,'rows':_0x11f602}:null;}})[_0x97ef('0x1f')](respondWithResult(_0x1de419,null))[_0x97ef('0x41')](handleError(_0x1de419,null));};exports[_0x97ef('0x4a')]=function(_0x17c1c3,_0x5012c4,_0x2ecc5a){var _0x5b4524={};var _0x5cf814={};var _0x4934ec;var _0x40f930;return db[_0x97ef('0x38')]['findOne']({'where':{'id':_0x17c1c3[_0x97ef('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5012c4,null))[_0x97ef('0x1f')](function(_0x999b1f){if(_0x999b1f){_0x4934ec=_0x999b1f;_0x5cf814[_0x97ef('0x27')]=_[_0x97ef('0x2a')](db[_0x97ef('0x46')][_0x97ef('0x47')]);_0x5cf814[_0x97ef('0x29')]=_[_0x97ef('0x2a')](_0x17c1c3[_0x97ef('0x29')]);_0x5cf814[_0x97ef('0x2b')]=_[_0x97ef('0x2d')](_0x5cf814[_0x97ef('0x27')],_0x5cf814[_0x97ef('0x29')]);_0x5b4524[_0x97ef('0x2c')]=_[_0x97ef('0x2d')](_0x5cf814['model'],qs[_0x97ef('0x3f')](_0x17c1c3[_0x97ef('0x29')][_0x97ef('0x3f')]));_0x5b4524[_0x97ef('0x2c')]=_0x5b4524[_0x97ef('0x2c')]['length']?_0x5b4524[_0x97ef('0x2c')]:_0x5cf814[_0x97ef('0x27')];_0x5b4524[_0x97ef('0x30')]=qs[_0x97ef('0x31')](_0x17c1c3[_0x97ef('0x29')][_0x97ef('0x31')]);_0x5b4524[_0x97ef('0x34')]=qs[_0x97ef('0x2b')](_['pick'](_0x17c1c3[_0x97ef('0x29')],_0x5cf814[_0x97ef('0x2b')]));if(_0x17c1c3['query'][_0x97ef('0x33')]){_0x5b4524[_0x97ef('0x34')]=_[_0x97ef('0x36')](_0x5b4524[_0x97ef('0x34')],{'$or':_[_0x97ef('0x28')](_0x5b4524[_0x97ef('0x2c')],function(_0x3fb848){var _0x1e5209={};_0x1e5209[_0x3fb848]={'$like':'%'+_0x17c1c3['query'][_0x97ef('0x33')]+'%'};return _0x1e5209;})});}_0x5b4524=_['merge']({},_0x5b4524,_0x17c1c3[_0x97ef('0x37')]);return _0x4934ec[_0x97ef('0x4a')](_0x5b4524);}})[_0x97ef('0x1f')](function(_0x2bb158){if(_0x2bb158){_0x40f930=_0x2bb158['length'];if(!_0x17c1c3['query'][_0x97ef('0x49')](_0x97ef('0x2f'))){_0x5b4524['limit']=qs[_0x97ef('0x17')](_0x17c1c3['query'][_0x97ef('0x17')]);_0x5b4524[_0x97ef('0x15')]=qs[_0x97ef('0x15')](_0x17c1c3['query']['offset']);}return _0x4934ec[_0x97ef('0x4a')](_0x5b4524);}})[_0x97ef('0x1f')](function(_0x29b9bd){if(_0x29b9bd){return _0x29b9bd?{'count':_0x40f930,'rows':_0x29b9bd}:null;}})[_0x97ef('0x1f')](respondWithResult(_0x5012c4,null))['catch'](handleError(_0x5012c4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6c43bbe..556c6f9 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 _0x9a43=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x535705,_0xf08764){var _0x3149f6=function(_0x4cd3d3){while(--_0x4cd3d3){_0x535705['push'](_0x535705['shift']());}};_0x3149f6(++_0xf08764);}(_0x9a43,0x1cf));var _0x39a4=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x9a43[_0x8c8176];return _0x4dc47b;};'use strict';var _=require(_0x39a4('0x0'));var util=require(_0x39a4('0x1'));var logger=require(_0x39a4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x39a4('0x3'));var rp=require(_0x39a4('0x4'));var fs=require('fs');var path=require(_0x39a4('0x5'));var rimraf=require(_0x39a4('0x6'));var config=require(_0x39a4('0x7'));var attributes=require(_0x39a4('0x8'));module[_0x39a4('0x9')]=function(_0x34d0e8,_0x15b310){return _0x34d0e8[_0x39a4('0xa')](_0x39a4('0xb'),attributes,{'tableName':_0x39a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8edc=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8edc,0x1a2));var _0xc8ed=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x8edc[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xc8ed('0x0'));var util=require(_0xc8ed('0x1'));var logger=require(_0xc8ed('0x2'))(_0xc8ed('0x3'));var moment=require(_0xc8ed('0x4'));var BPromise=require(_0xc8ed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8ed('0x6'));var rimraf=require(_0xc8ed('0x7'));var config=require(_0xc8ed('0x8'));var attributes=require(_0xc8ed('0x9'));module[_0xc8ed('0xa')]=function(_0x1373e9,_0x33ba27){return _0x1373e9['define'](_0xc8ed('0xb'),attributes,{'tableName':_0xc8ed('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 cdb5385..a589a0f 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 _0xdf1b=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xc775ea,_0x5e5895){var _0x5b5e4b=function(_0x4992b7){while(--_0x4992b7){_0xc775ea['push'](_0xc775ea['shift']());}};_0x5b5e4b(++_0x5e5895);}(_0xdf1b,0x167));var _0xbdf1=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0xdf1b[_0x4eec9b];return _0x2e3849;};'use strict';var _=require(_0xbdf1('0x0'));var util=require('util');var moment=require(_0xbdf1('0x1'));var BPromise=require(_0xbdf1('0x2'));var rs=require(_0xbdf1('0x3'));var fs=require('fs');var Redis=require(_0xbdf1('0x4'));var db=require(_0xbdf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdf1('0x6'))(_0xbdf1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbdf1('0x8')][_0xbdf1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x371f2c,_0x35d3f9,_0x1d5c39){return new BPromise(function(_0x3d9b01,_0xdb29bd){return client['request'](_0x371f2c,_0x1d5c39)[_0xbdf1('0xa')](function(_0x3f23a7){logger[_0xbdf1('0xb')](_0xbdf1('0xc'),_0x35d3f9,'request\x20sent');logger[_0xbdf1('0xd')](_0xbdf1('0xe'),_0x35d3f9,_0xbdf1('0xf'),JSON[_0xbdf1('0x10')](_0x3f23a7));if(_0x3f23a7[_0xbdf1('0x11')]){if(_0x3f23a7[_0xbdf1('0x11')][_0xbdf1('0x12')]===0x1f4){logger[_0xbdf1('0x11')](_0xbdf1('0xc'),_0x35d3f9,_0x3f23a7[_0xbdf1('0x11')]['message']);return _0xdb29bd(_0x3f23a7[_0xbdf1('0x11')][_0xbdf1('0x13')]);}logger['error'](_0xbdf1('0xc'),_0x35d3f9,_0x3f23a7[_0xbdf1('0x11')][_0xbdf1('0x13')]);return _0x3d9b01(_0x3f23a7[_0xbdf1('0x11')][_0xbdf1('0x13')]);}else{logger['info'](_0xbdf1('0xc'),_0x35d3f9,_0xbdf1('0xf'));_0x3d9b01(_0x3f23a7[_0xbdf1('0x14')][_0xbdf1('0x13')]);}})['catch'](function(_0x5d4952){logger['error'](_0xbdf1('0xc'),_0x35d3f9,_0x5d4952);_0xdb29bd(_0x5d4952);});});} \ No newline at end of file +var _0x0fa4=['error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4ec043,_0x2f109f){var _0x1b208c=function(_0x315476){while(--_0x315476){_0x4ec043['push'](_0x4ec043['shift']());}};_0x1b208c(++_0x2f109f);}(_0x0fa4,0x131));var _0x40fa=function(_0x475575,_0x30d540){_0x475575=_0x475575-0x0;var _0x53e8d8=_0x0fa4[_0x475575];return _0x53e8d8;};'use strict';var _=require('lodash');var util=require(_0x40fa('0x0'));var moment=require(_0x40fa('0x1'));var BPromise=require('bluebird');var rs=require(_0x40fa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40fa('0x3'))['db'];var utils=require(_0x40fa('0x4'));var logger=require(_0x40fa('0x5'))(_0x40fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x40fa('0x7'));var client=jayson[_0x40fa('0x8')][_0x40fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2efd7d,_0xfe556,_0x1f18a9){return new BPromise(function(_0x49ef74,_0x8a78a9){return client[_0x40fa('0xa')](_0x2efd7d,_0x1f18a9)[_0x40fa('0xb')](function(_0x1eb632){logger[_0x40fa('0xc')](_0x40fa('0xd'),_0xfe556,_0x40fa('0xe'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xfe556,_0x40fa('0xe'),JSON['stringify'](_0x1eb632));if(_0x1eb632[_0x40fa('0xf')]){if(_0x1eb632[_0x40fa('0xf')][_0x40fa('0x10')]===0x1f4){logger[_0x40fa('0xf')](_0x40fa('0xd'),_0xfe556,_0x1eb632[_0x40fa('0xf')][_0x40fa('0x11')]);return _0x8a78a9(_0x1eb632['error'][_0x40fa('0x11')]);}logger[_0x40fa('0xf')](_0x40fa('0xd'),_0xfe556,_0x1eb632['error'][_0x40fa('0x11')]);return _0x49ef74(_0x1eb632[_0x40fa('0xf')][_0x40fa('0x11')]);}else{logger[_0x40fa('0xc')](_0x40fa('0xd'),_0xfe556,'request\x20sent');_0x49ef74(_0x1eb632[_0x40fa('0x12')][_0x40fa('0x11')]);}})[_0x40fa('0x13')](function(_0x2057e6){logger[_0x40fa('0xf')](_0x40fa('0xd'),_0xfe556,_0x2057e6);_0x8a78a9(_0x2057e6);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4cf5033..0c69791 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 _0x3c84=['show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x3c84,0x10a));var _0x43c8=function(_0x434d56,_0xe593d8){_0x434d56=_0x434d56-0x0;var _0x1c7a02=_0x3c84[_0x434d56];return _0x1c7a02;};'use strict';var multer=require(_0x43c8('0x0'));var util=require(_0x43c8('0x1'));var path=require(_0x43c8('0x2'));var timeout=require(_0x43c8('0x3'));var express=require(_0x43c8('0x4'));var router=express[_0x43c8('0x5')]();var fs_extra=require(_0x43c8('0x6'));var auth=require(_0x43c8('0x7'));var interaction=require(_0x43c8('0x8'));var config=require(_0x43c8('0x9'));var controller=require('./intVtigerField.controller');router[_0x43c8('0xa')]('/',auth[_0x43c8('0xb')](),controller[_0x43c8('0xc')]);router['get'](_0x43c8('0xd'),auth[_0x43c8('0xb')](),controller[_0x43c8('0xe')]);router['post']('/',auth[_0x43c8('0xb')](),controller[_0x43c8('0xf')]);router[_0x43c8('0x10')]('/:id',auth[_0x43c8('0xb')](),controller[_0x43c8('0x11')]);router[_0x43c8('0x12')](_0x43c8('0xd'),auth[_0x43c8('0xb')](),controller['destroy']);module[_0x43c8('0x13')]=router; \ No newline at end of file +var _0x5083=['multer','util','path','express','Router','fs-extra','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x2328fb,_0x1993be){var _0x42cf51=function(_0x139508){while(--_0x139508){_0x2328fb['push'](_0x2328fb['shift']());}};_0x42cf51(++_0x1993be);}(_0x5083,0x156));var _0x3508=function(_0x45782d,_0xa6dce4){_0x45782d=_0x45782d-0x0;var _0x5ad3cc=_0x5083[_0x45782d];return _0x5ad3cc;};'use strict';var multer=require(_0x3508('0x0'));var util=require(_0x3508('0x1'));var path=require(_0x3508('0x2'));var timeout=require('connect-timeout');var express=require(_0x3508('0x3'));var router=express[_0x3508('0x4')]();var fs_extra=require(_0x3508('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3508('0x6'));router[_0x3508('0x7')]('/',auth[_0x3508('0x8')](),controller[_0x3508('0x9')]);router[_0x3508('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3508('0xa')]);router[_0x3508('0xb')]('/',auth[_0x3508('0x8')](),controller[_0x3508('0xc')]);router[_0x3508('0xd')](_0x3508('0xe'),auth[_0x3508('0x8')](),controller[_0x3508('0xf')]);router[_0x3508('0x10')]('/:id',auth[_0x3508('0x8')](),controller[_0x3508('0x11')]);module[_0x3508('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 608fbab..3eb101c 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 _0x3e10=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x2a1304,_0x2fb7e0){var _0x3352d3=function(_0x3ae71f){while(--_0x3ae71f){_0x2a1304['push'](_0x2a1304['shift']());}};_0x3352d3(++_0x2fb7e0);}(_0x3e10,0x1bb));var _0x03e1=function(_0x197954,_0x3f61d0){_0x197954=_0x197954-0x0;var _0x231d54=_0x3e10[_0x197954];return _0x231d54;};'use strict';var Sequelize=require(_0x03e1('0x0'));module[_0x03e1('0x1')]={'type':{'type':Sequelize[_0x03e1('0x2')](_0x03e1('0x3'),'variable',_0x03e1('0x4'),_0x03e1('0x5'),_0x03e1('0x6')),'defaultValue':_0x03e1('0x3')},'content':{'type':Sequelize[_0x03e1('0x7')]},'key':{'type':Sequelize[_0x03e1('0x7')]},'keyType':{'type':Sequelize[_0x03e1('0x2')](_0x03e1('0x3'),_0x03e1('0x8'),_0x03e1('0x4'))},'keyContent':{'type':Sequelize[_0x03e1('0x7')]},'idField':{'type':Sequelize[_0x03e1('0x7')]},'nameField':{'type':Sequelize[_0x03e1('0x7')]},'customField':{'type':Sequelize[_0x03e1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x03e1('0x7')]}}; \ No newline at end of file +var _0x2aaa=['BOOLEAN','sequelize','exports','string','customVariable','STRING','ENUM','variable'];(function(_0x53f60a,_0x2b76c5){var _0x91fa4a=function(_0x28d7d7){while(--_0x28d7d7){_0x53f60a['push'](_0x53f60a['shift']());}};_0x91fa4a(++_0x2b76c5);}(_0x2aaa,0x129));var _0xa2aa=function(_0x51360a,_0x435326){_0x51360a=_0x51360a-0x0;var _0x2b3962=_0x2aaa[_0x51360a];return _0x2b3962;};'use strict';var Sequelize=require(_0xa2aa('0x0'));module[_0xa2aa('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa2aa('0x2'),'variable',_0xa2aa('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa2aa('0x4')]},'key':{'type':Sequelize[_0xa2aa('0x4')]},'keyType':{'type':Sequelize[_0xa2aa('0x5')](_0xa2aa('0x2'),_0xa2aa('0x6'),_0xa2aa('0x3'))},'keyContent':{'type':Sequelize[_0xa2aa('0x4')]},'idField':{'type':Sequelize[_0xa2aa('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa2aa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f13ce58..438c9c7 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 _0x9d05=['rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','name','send','map','VtigerField','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x9d05,0x16d));var _0x59d0=function(_0x291f4d,_0x2b17ee){_0x291f4d=_0x291f4d-0x0;var _0xd4ae5f=_0x9d05[_0x291f4d];return _0xd4ae5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59d0('0x0'));var zipdir=require(_0x59d0('0x1'));var jsonpatch=require(_0x59d0('0x2'));var rp=require(_0x59d0('0x3'));var moment=require(_0x59d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x59d0('0x5'));var util=require('util');var path=require(_0x59d0('0x6'));var sox=require(_0x59d0('0x7'));var csv=require(_0x59d0('0x8'));var ejs=require(_0x59d0('0x9'));var fs=require('fs');var fs_extra=require(_0x59d0('0xa'));var _=require(_0x59d0('0xb'));var squel=require(_0x59d0('0xc'));var crypto=require(_0x59d0('0xd'));var jsforce=require(_0x59d0('0xe'));var deskjs=require(_0x59d0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x59d0('0x10'));var Papa=require(_0x59d0('0x11'));var Redis=require(_0x59d0('0x12'));var authService=require(_0x59d0('0x13'));var qs=require(_0x59d0('0x14'));var as=require(_0x59d0('0x15'));var hardwareService=require(_0x59d0('0x16'));var logger=require(_0x59d0('0x17'))(_0x59d0('0x18'));var utils=require('../../config/utils');var config=require(_0x59d0('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x59d0('0x1a'))['db'];function respondWithStatusCode(_0x5c5d2c,_0x46371e){_0x46371e=_0x46371e||0xcc;return function(_0x8f367f){if(_0x8f367f){return _0x5c5d2c[_0x59d0('0x1b')](_0x46371e);}return _0x5c5d2c[_0x59d0('0x1c')](_0x46371e)[_0x59d0('0x1d')]();};}function respondWithResult(_0x2b8b6d,_0x55be69){_0x55be69=_0x55be69||0xc8;return function(_0x1f20de){if(_0x1f20de){return _0x2b8b6d[_0x59d0('0x1c')](_0x55be69)[_0x59d0('0x1e')](_0x1f20de);}};}function respondWithFilteredResult(_0x3ff11d,_0x4676c8){return function(_0x3eeb02){if(_0x3eeb02){var _0x816938=typeof _0x4676c8[_0x59d0('0x1f')]===_0x59d0('0x20')&&typeof _0x4676c8[_0x59d0('0x21')]===_0x59d0('0x20');var _0x121eaf=_0x3eeb02[_0x59d0('0x22')];var _0x14bb8c=_0x816938?0x0:_0x4676c8[_0x59d0('0x1f')];var _0x3490c6=_0x816938?_0x3eeb02[_0x59d0('0x22')]:_0x4676c8[_0x59d0('0x1f')]+_0x4676c8[_0x59d0('0x21')];var _0x561933;if(_0x3490c6>=_0x121eaf){_0x3490c6=_0x121eaf;_0x561933=0xc8;}else{_0x561933=0xce;}_0x3ff11d[_0x59d0('0x1c')](_0x561933);return _0x3ff11d[_0x59d0('0x23')](_0x59d0('0x24'),_0x14bb8c+'-'+_0x3490c6+'/'+_0x121eaf)[_0x59d0('0x1e')](_0x3eeb02);}return null;};}function patchUpdates(_0x52ef16){return function(_0x167104){try{jsonpatch[_0x59d0('0x25')](_0x167104,_0x52ef16,!![]);}catch(_0x3e6783){return BPromise[_0x59d0('0x26')](_0x3e6783);}return _0x167104['save']();};}function saveUpdates(_0x140196,_0x4ea5f1){return function(_0x217627){if(_0x217627){return _0x217627[_0x59d0('0x27')](_0x140196)['then'](function(_0x2ec42a){return _0x2ec42a;});}return null;};}function removeEntity(_0xbe7b92,_0x3410c6){return function(_0x184942){if(_0x184942){return _0x184942[_0x59d0('0x28')]()['then'](function(){_0xbe7b92[_0x59d0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6e0ed7,_0x3570a1){return function(_0x30d798){if(!_0x30d798){_0x6e0ed7['sendStatus'](0x194);}return _0x30d798;};}function handleError(_0x2f9f2c,_0x5b684c){_0x5b684c=_0x5b684c||0x1f4;return function(_0x488539){logger[_0x59d0('0x29')](_0x488539['stack']);if(_0x488539[_0x59d0('0x2a')]){delete _0x488539[_0x59d0('0x2a')];}_0x2f9f2c[_0x59d0('0x1c')](_0x5b684c)[_0x59d0('0x2b')](_0x488539);};}exports['index']=function(_0x44476d,_0x22ff65){var _0x474261={},_0x322f36={},_0x22779e={'count':0x0,'rows':[]};var _0x51f211=_[_0x59d0('0x2c')](db[_0x59d0('0x2d')]['rawAttributes'],function(_0x77b2d5){return{'name':_0x77b2d5['fieldName'],'type':_0x77b2d5['type'][_0x59d0('0x2e')]};});_0x322f36[_0x59d0('0x2f')]=_[_0x59d0('0x2c')](_0x51f211,_0x59d0('0x2a'));_0x322f36[_0x59d0('0x30')]=_[_0x59d0('0x31')](_0x44476d['query']);_0x322f36[_0x59d0('0x32')]=_[_0x59d0('0x33')](_0x322f36[_0x59d0('0x2f')],_0x322f36[_0x59d0('0x30')]);_0x474261[_0x59d0('0x34')]=_[_0x59d0('0x33')](_0x322f36[_0x59d0('0x2f')],qs[_0x59d0('0x35')](_0x44476d[_0x59d0('0x30')][_0x59d0('0x35')]));_0x474261['attributes']=_0x474261[_0x59d0('0x34')][_0x59d0('0x36')]?_0x474261[_0x59d0('0x34')]:_0x322f36[_0x59d0('0x2f')];if(!_0x44476d[_0x59d0('0x30')][_0x59d0('0x37')]('nolimit')){_0x474261['limit']=qs['limit'](_0x44476d[_0x59d0('0x30')][_0x59d0('0x21')]);_0x474261['offset']=qs['offset'](_0x44476d[_0x59d0('0x30')]['offset']);}_0x474261['order']=qs[_0x59d0('0x38')](_0x44476d[_0x59d0('0x30')][_0x59d0('0x38')]);_0x474261[_0x59d0('0x39')]=qs['filters'](_['pick'](_0x44476d[_0x59d0('0x30')],_0x322f36[_0x59d0('0x32')]),_0x51f211);if(_0x44476d[_0x59d0('0x30')][_0x59d0('0x3a')]){_0x474261['where']=_[_0x59d0('0x3b')](_0x474261[_0x59d0('0x39')],{'$or':_[_0x59d0('0x2c')](_0x51f211,function(_0x144367){if(_0x144367[_0x59d0('0x3c')]!=='VIRTUAL'){var _0x39212d={};_0x39212d[_0x144367[_0x59d0('0x2a')]]={'$like':'%'+_0x44476d[_0x59d0('0x30')][_0x59d0('0x3a')]+'%'};return _0x39212d;}})});}_0x474261=_['merge']({},_0x474261,_0x44476d[_0x59d0('0x3d')]);var _0x4c84dc={'where':_0x474261[_0x59d0('0x39')]};return db[_0x59d0('0x2d')]['count'](_0x4c84dc)[_0x59d0('0x3e')](function(_0x469140){_0x22779e['count']=_0x469140;if(_0x44476d['query'][_0x59d0('0x3f')]){_0x474261['include']=[{'all':!![]}];}return db['VtigerField'][_0x59d0('0x40')](_0x474261);})[_0x59d0('0x3e')](function(_0x46cb15){_0x22779e[_0x59d0('0x41')]=_0x46cb15;return _0x22779e;})[_0x59d0('0x3e')](respondWithFilteredResult(_0x22ff65,_0x474261))[_0x59d0('0x42')](handleError(_0x22ff65,null));};exports[_0x59d0('0x43')]=function(_0x13c5ae,_0x39f262){var _0x3e16c8={'raw':!![],'where':{'id':_0x13c5ae[_0x59d0('0x44')]['id']}},_0x272b3b={};_0x272b3b[_0x59d0('0x2f')]=_[_0x59d0('0x31')](db['VtigerField'][_0x59d0('0x45')]);_0x272b3b['query']=_[_0x59d0('0x31')](_0x13c5ae[_0x59d0('0x30')]);_0x272b3b[_0x59d0('0x32')]=_[_0x59d0('0x33')](_0x272b3b[_0x59d0('0x2f')],_0x272b3b['query']);_0x3e16c8[_0x59d0('0x34')]=_[_0x59d0('0x33')](_0x272b3b[_0x59d0('0x2f')],qs[_0x59d0('0x35')](_0x13c5ae[_0x59d0('0x30')][_0x59d0('0x35')]));_0x3e16c8['attributes']=_0x3e16c8[_0x59d0('0x34')][_0x59d0('0x36')]?_0x3e16c8[_0x59d0('0x34')]:_0x272b3b['model'];if(_0x13c5ae[_0x59d0('0x30')][_0x59d0('0x3f')]){_0x3e16c8['include']=[{'all':!![]}];}_0x3e16c8=_[_0x59d0('0x3b')]({},_0x3e16c8,_0x13c5ae[_0x59d0('0x3d')]);return db[_0x59d0('0x2d')][_0x59d0('0x46')](_0x3e16c8)[_0x59d0('0x3e')](handleEntityNotFound(_0x39f262,null))['then'](respondWithResult(_0x39f262,null))['catch'](handleError(_0x39f262,null));};exports[_0x59d0('0x47')]=function(_0x5d1417,_0xe69daa){return db[_0x59d0('0x2d')][_0x59d0('0x47')](_0x5d1417['body'],{})['then'](respondWithResult(_0xe69daa,0xc9))[_0x59d0('0x42')](handleError(_0xe69daa,null));};exports[_0x59d0('0x27')]=function(_0x3b392b,_0x5774aa){if(_0x3b392b['body']['id']){delete _0x3b392b[_0x59d0('0x48')]['id'];}return db[_0x59d0('0x2d')][_0x59d0('0x46')]({'where':{'id':_0x3b392b['params']['id']}})[_0x59d0('0x3e')](handleEntityNotFound(_0x5774aa,null))[_0x59d0('0x3e')](saveUpdates(_0x3b392b['body'],null))[_0x59d0('0x3e')](respondWithResult(_0x5774aa,null))[_0x59d0('0x42')](handleError(_0x5774aa,null));};exports['destroy']=function(_0xc33bc3,_0x1f1eb1){return db[_0x59d0('0x2d')][_0x59d0('0x46')]({'where':{'id':_0xc33bc3['params']['id']}})[_0x59d0('0x3e')](handleEntityNotFound(_0x1f1eb1,null))[_0x59d0('0x3e')](removeEntity(_0x1f1eb1,null))['catch'](handleError(_0x1f1eb1,null));}; \ No newline at end of file +var _0x579c=['request-promise','bluebird','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','order','sort','where','filters','pick','filter','include','findAll','rows','catch','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x579c,0xda));var _0xc579=function(_0x86babd,_0x25b0e4){_0x86babd=_0x86babd-0x0;var _0x97ba25=_0x579c[_0x86babd];return _0x97ba25;};'use strict';var emlformat=require(_0xc579('0x0'));var rimraf=require(_0xc579('0x1'));var zipdir=require(_0xc579('0x2'));var jsonpatch=require(_0xc579('0x3'));var rp=require(_0xc579('0x4'));var moment=require('moment');var BPromise=require(_0xc579('0x5'));var Mustache=require('mustache');var util=require(_0xc579('0x6'));var path=require(_0xc579('0x7'));var sox=require(_0xc579('0x8'));var csv=require(_0xc579('0x9'));var ejs=require(_0xc579('0xa'));var fs=require('fs');var fs_extra=require(_0xc579('0xb'));var _=require(_0xc579('0xc'));var squel=require('squel');var crypto=require(_0xc579('0xd'));var jsforce=require(_0xc579('0xe'));var deskjs=require(_0xc579('0xf'));var toCsv=require(_0xc579('0x9'));var querystring=require(_0xc579('0x10'));var Papa=require(_0xc579('0x11'));var Redis=require(_0xc579('0x12'));var authService=require(_0xc579('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x14'));var hardwareService=require(_0xc579('0x15'));var logger=require(_0xc579('0x16'))(_0xc579('0x17'));var utils=require(_0xc579('0x18'));var config=require(_0xc579('0x19'));var licenseUtil=require(_0xc579('0x1a'));var db=require(_0xc579('0x1b'))['db'];function respondWithStatusCode(_0x421812,_0x441028){_0x441028=_0x441028||0xcc;return function(_0x448d51){if(_0x448d51){return _0x421812['sendStatus'](_0x441028);}return _0x421812[_0xc579('0x1c')](_0x441028)['end']();};}function respondWithResult(_0xf5400e,_0x59243e){_0x59243e=_0x59243e||0xc8;return function(_0x424e15){if(_0x424e15){return _0xf5400e['status'](_0x59243e)[_0xc579('0x1d')](_0x424e15);}};}function respondWithFilteredResult(_0x4b3635,_0x349e82){return function(_0x115276){if(_0x115276){var _0x567de5=typeof _0x349e82['offset']===_0xc579('0x1e')&&typeof _0x349e82[_0xc579('0x1f')]===_0xc579('0x1e');var _0x414ee7=_0x115276[_0xc579('0x20')];var _0x33d341=_0x567de5?0x0:_0x349e82[_0xc579('0x21')];var _0x3da8a1=_0x567de5?_0x115276[_0xc579('0x20')]:_0x349e82[_0xc579('0x21')]+_0x349e82['limit'];var _0x463f5e;if(_0x3da8a1>=_0x414ee7){_0x3da8a1=_0x414ee7;_0x463f5e=0xc8;}else{_0x463f5e=0xce;}_0x4b3635[_0xc579('0x1c')](_0x463f5e);return _0x4b3635['set'](_0xc579('0x22'),_0x33d341+'-'+_0x3da8a1+'/'+_0x414ee7)[_0xc579('0x1d')](_0x115276);}return null;};}function patchUpdates(_0x14fcdd){return function(_0x6501bc){try{jsonpatch[_0xc579('0x23')](_0x6501bc,_0x14fcdd,!![]);}catch(_0x4417e1){return BPromise[_0xc579('0x24')](_0x4417e1);}return _0x6501bc[_0xc579('0x25')]();};}function saveUpdates(_0x55781e,_0x92657f){return function(_0xad4889){if(_0xad4889){return _0xad4889[_0xc579('0x26')](_0x55781e)[_0xc579('0x27')](function(_0x1da86e){return _0x1da86e;});}return null;};}function removeEntity(_0x565a1b,_0x3634f2){return function(_0x3cf83f){if(_0x3cf83f){return _0x3cf83f[_0xc579('0x28')]()['then'](function(){_0x565a1b[_0xc579('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4610c2,_0x21a4db){return function(_0x4d758a){if(!_0x4d758a){_0x4610c2['sendStatus'](0x194);}return _0x4d758a;};}function handleError(_0x1f8e4b,_0x5b5f4e){_0x5b5f4e=_0x5b5f4e||0x1f4;return function(_0x532b33){logger['error'](_0x532b33[_0xc579('0x29')]);if(_0x532b33[_0xc579('0x2a')]){delete _0x532b33[_0xc579('0x2a')];}_0x1f8e4b[_0xc579('0x1c')](_0x5b5f4e)[_0xc579('0x2b')](_0x532b33);};}exports[_0xc579('0x2c')]=function(_0x45fef4,_0x5c272f){var _0x4d78bc={},_0x4a5f6={},_0x4897a1={'count':0x0,'rows':[]};var _0x314daa=_[_0xc579('0x2d')](db[_0xc579('0x2e')][_0xc579('0x2f')],function(_0x1ad8f7){return{'name':_0x1ad8f7[_0xc579('0x30')],'type':_0x1ad8f7[_0xc579('0x31')][_0xc579('0x32')]};});_0x4a5f6['model']=_[_0xc579('0x2d')](_0x314daa,_0xc579('0x2a'));_0x4a5f6[_0xc579('0x33')]=_[_0xc579('0x34')](_0x45fef4['query']);_0x4a5f6['filters']=_[_0xc579('0x35')](_0x4a5f6['model'],_0x4a5f6[_0xc579('0x33')]);_0x4d78bc[_0xc579('0x36')]=_[_0xc579('0x35')](_0x4a5f6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x45fef4['query'][_0xc579('0x38')]));_0x4d78bc['attributes']=_0x4d78bc[_0xc579('0x36')][_0xc579('0x39')]?_0x4d78bc['attributes']:_0x4a5f6[_0xc579('0x37')];if(!_0x45fef4[_0xc579('0x33')]['hasOwnProperty']('nolimit')){_0x4d78bc[_0xc579('0x1f')]=qs[_0xc579('0x1f')](_0x45fef4['query'][_0xc579('0x1f')]);_0x4d78bc[_0xc579('0x21')]=qs['offset'](_0x45fef4[_0xc579('0x33')]['offset']);}_0x4d78bc[_0xc579('0x3a')]=qs[_0xc579('0x3b')](_0x45fef4['query'][_0xc579('0x3b')]);_0x4d78bc[_0xc579('0x3c')]=qs[_0xc579('0x3d')](_[_0xc579('0x3e')](_0x45fef4[_0xc579('0x33')],_0x4a5f6[_0xc579('0x3d')]),_0x314daa);if(_0x45fef4['query'][_0xc579('0x3f')]){_0x4d78bc[_0xc579('0x3c')]=_['merge'](_0x4d78bc[_0xc579('0x3c')],{'$or':_[_0xc579('0x2d')](_0x314daa,function(_0x3f9bee){if(_0x3f9bee[_0xc579('0x31')]!=='VIRTUAL'){var _0x3f744f={};_0x3f744f[_0x3f9bee[_0xc579('0x2a')]]={'$like':'%'+_0x45fef4[_0xc579('0x33')]['filter']+'%'};return _0x3f744f;}})});}_0x4d78bc=_['merge']({},_0x4d78bc,_0x45fef4['options']);var _0x1ef28f={'where':_0x4d78bc[_0xc579('0x3c')]};return db[_0xc579('0x2e')][_0xc579('0x20')](_0x1ef28f)[_0xc579('0x27')](function(_0x2b60eb){_0x4897a1['count']=_0x2b60eb;if(_0x45fef4[_0xc579('0x33')]['includeAll']){_0x4d78bc[_0xc579('0x40')]=[{'all':!![]}];}return db[_0xc579('0x2e')][_0xc579('0x41')](_0x4d78bc);})[_0xc579('0x27')](function(_0x3d8f24){_0x4897a1[_0xc579('0x42')]=_0x3d8f24;return _0x4897a1;})[_0xc579('0x27')](respondWithFilteredResult(_0x5c272f,_0x4d78bc))[_0xc579('0x43')](handleError(_0x5c272f,null));};exports['show']=function(_0x2a2248,_0x2532a5){var _0x74b63d={'raw':!![],'where':{'id':_0x2a2248[_0xc579('0x44')]['id']}},_0x2449e6={};_0x2449e6[_0xc579('0x37')]=_['keys'](db[_0xc579('0x2e')][_0xc579('0x2f')]);_0x2449e6[_0xc579('0x33')]=_['keys'](_0x2a2248[_0xc579('0x33')]);_0x2449e6[_0xc579('0x3d')]=_[_0xc579('0x35')](_0x2449e6['model'],_0x2449e6[_0xc579('0x33')]);_0x74b63d['attributes']=_[_0xc579('0x35')](_0x2449e6[_0xc579('0x37')],qs[_0xc579('0x38')](_0x2a2248['query'][_0xc579('0x38')]));_0x74b63d[_0xc579('0x36')]=_0x74b63d['attributes']['length']?_0x74b63d[_0xc579('0x36')]:_0x2449e6[_0xc579('0x37')];if(_0x2a2248[_0xc579('0x33')][_0xc579('0x45')]){_0x74b63d['include']=[{'all':!![]}];}_0x74b63d=_['merge']({},_0x74b63d,_0x2a2248[_0xc579('0x46')]);return db[_0xc579('0x2e')][_0xc579('0x47')](_0x74b63d)[_0xc579('0x27')](handleEntityNotFound(_0x2532a5,null))['then'](respondWithResult(_0x2532a5,null))[_0xc579('0x43')](handleError(_0x2532a5,null));};exports[_0xc579('0x48')]=function(_0x53eb6f,_0x40d790){return db['VtigerField']['create'](_0x53eb6f['body'],{})[_0xc579('0x27')](respondWithResult(_0x40d790,0xc9))[_0xc579('0x43')](handleError(_0x40d790,null));};exports[_0xc579('0x26')]=function(_0x90a0d3,_0x1f9d15){if(_0x90a0d3['body']['id']){delete _0x90a0d3[_0xc579('0x49')]['id'];}return db[_0xc579('0x2e')][_0xc579('0x47')]({'where':{'id':_0x90a0d3['params']['id']}})['then'](handleEntityNotFound(_0x1f9d15,null))[_0xc579('0x27')](saveUpdates(_0x90a0d3[_0xc579('0x49')],null))[_0xc579('0x27')](respondWithResult(_0x1f9d15,null))[_0xc579('0x43')](handleError(_0x1f9d15,null));};exports[_0xc579('0x28')]=function(_0xe1a1d7,_0x138ab2){return db['VtigerField']['find']({'where':{'id':_0xe1a1d7[_0xc579('0x44')]['id']}})[_0xc579('0x27')](handleEntityNotFound(_0x138ab2,null))['then'](removeEntity(_0x138ab2,null))[_0xc579('0x43')](handleError(_0x138ab2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f6540d2..bfa5079 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 _0xe8e6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','api'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xe8e6,0xf5));var _0x6e8e=function(_0x5963aa,_0x20fee4){_0x5963aa=_0x5963aa-0x0;var _0x1b7060=_0xe8e6[_0x5963aa];return _0x1b7060;};'use strict';var _=require(_0x6e8e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6e8e('0x1'));var moment=require(_0x6e8e('0x2'));var BPromise=require(_0x6e8e('0x3'));var rp=require(_0x6e8e('0x4'));var fs=require('fs');var path=require(_0x6e8e('0x5'));var rimraf=require(_0x6e8e('0x6'));var config=require(_0x6e8e('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x6e8e('0x8')]=function(_0x53ad97,_0xc9b57){return _0x53ad97['define']('VtigerField',attributes,{'tableName':_0x6e8e('0x9'),'paranoid':![],'indexes':[{'name':_0x6e8e('0xa'),'fields':[_0x6e8e('0xb'),_0x6e8e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27c6=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','vtiger_unique_index'];(function(_0x305299,_0x37f799){var _0x16210e=function(_0x19f1a){while(--_0x19f1a){_0x305299['push'](_0x305299['shift']());}};_0x16210e(++_0x37f799);}(_0x27c6,0x1b4));var _0x627c=function(_0x2c1890,_0x1dc021){_0x2c1890=_0x2c1890-0x0;var _0x57c112=_0x27c6[_0x2c1890];return _0x57c112;};'use strict';var _=require(_0x627c('0x0'));var util=require(_0x627c('0x1'));var logger=require(_0x627c('0x2'))('api');var moment=require(_0x627c('0x3'));var BPromise=require(_0x627c('0x4'));var rp=require(_0x627c('0x5'));var fs=require('fs');var path=require(_0x627c('0x6'));var rimraf=require(_0x627c('0x7'));var config=require(_0x627c('0x8'));var attributes=require('./intVtigerField.attributes');module[_0x627c('0x9')]=function(_0x587a07,_0x513ede){return _0x587a07[_0x627c('0xa')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x627c('0xb'),'fields':[_0x627c('0xc'),_0x627c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 26ac00c..8937eeb 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 _0x6733=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util'];(function(_0x24ac81,_0x3e46e7){var _0x13e204=function(_0x3ed8c3){while(--_0x3ed8c3){_0x24ac81['push'](_0x24ac81['shift']());}};_0x13e204(++_0x3e46e7);}(_0x6733,0x71));var _0x3673=function(_0xf13ca6,_0x5735ea){_0xf13ca6=_0xf13ca6-0x0;var _0x4a4387=_0x6733[_0xf13ca6];return _0x4a4387;};'use strict';var _=require(_0x3673('0x0'));var util=require(_0x3673('0x1'));var moment=require(_0x3673('0x2'));var BPromise=require(_0x3673('0x3'));var rs=require(_0x3673('0x4'));var fs=require('fs');var Redis=require(_0x3673('0x5'));var db=require(_0x3673('0x6'))['db'];var utils=require(_0x3673('0x7'));var logger=require(_0x3673('0x8'))(_0x3673('0x9'));var config=require(_0x3673('0xa'));var jayson=require(_0x3673('0xb'));var client=jayson['client'][_0x3673('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a2756,_0x3a6e09,_0x41b724){return new BPromise(function(_0x233234,_0x2b838f){return client[_0x3673('0xd')](_0x4a2756,_0x41b724)[_0x3673('0xe')](function(_0x54a5b7){logger[_0x3673('0xf')](_0x3673('0x10'),_0x3a6e09,_0x3673('0x11'));logger[_0x3673('0x12')](_0x3673('0x13'),_0x3a6e09,_0x3673('0x11'),JSON['stringify'](_0x54a5b7));if(_0x54a5b7[_0x3673('0x14')]){if(_0x54a5b7[_0x3673('0x14')]['code']===0x1f4){logger[_0x3673('0x14')]('VtigerField,\x20%s,\x20%s',_0x3a6e09,_0x54a5b7[_0x3673('0x14')][_0x3673('0x15')]);return _0x2b838f(_0x54a5b7['error'][_0x3673('0x15')]);}logger[_0x3673('0x14')](_0x3673('0x10'),_0x3a6e09,_0x54a5b7[_0x3673('0x14')][_0x3673('0x15')]);return _0x233234(_0x54a5b7[_0x3673('0x14')][_0x3673('0x15')]);}else{logger[_0x3673('0xf')](_0x3673('0x10'),_0x3a6e09,_0x3673('0x11'));_0x233234(_0x54a5b7[_0x3673('0x16')]['message']);}})['catch'](function(_0x2c47ad){logger[_0x3673('0x14')](_0x3673('0x10'),_0x3a6e09,_0x2c47ad);_0x2b838f(_0x2c47ad);});});} \ No newline at end of file +var _0x889c=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x472260,_0x55e796){var _0x5c890b=function(_0x533801){while(--_0x533801){_0x472260['push'](_0x472260['shift']());}};_0x5c890b(++_0x55e796);}(_0x889c,0x180));var _0xc889=function(_0x32a617,_0x4c8f62){_0x32a617=_0x32a617-0x0;var _0x5412da=_0x889c[_0x32a617];return _0x5412da;};'use strict';var _=require(_0xc889('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc889('0x1'));var rs=require(_0xc889('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc889('0x3'))['db'];var utils=require(_0xc889('0x4'));var logger=require(_0xc889('0x5'))(_0xc889('0x6'));var config=require(_0xc889('0x7'));var jayson=require(_0xc889('0x8'));var client=jayson[_0xc889('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x509d30,_0x5d15bd,_0x2d665e){return new BPromise(function(_0x3548f3,_0x6d8ae5){return client[_0xc889('0xa')](_0x509d30,_0x2d665e)[_0xc889('0xb')](function(_0x11cf1b){logger[_0xc889('0xc')]('VtigerField,\x20%s,\x20%s',_0x5d15bd,_0xc889('0xd'));logger[_0xc889('0xe')](_0xc889('0xf'),_0x5d15bd,'request\x20sent',JSON[_0xc889('0x10')](_0x11cf1b));if(_0x11cf1b[_0xc889('0x11')]){if(_0x11cf1b['error'][_0xc889('0x12')]===0x1f4){logger['error'](_0xc889('0x13'),_0x5d15bd,_0x11cf1b['error'][_0xc889('0x14')]);return _0x6d8ae5(_0x11cf1b[_0xc889('0x11')]['message']);}logger[_0xc889('0x11')](_0xc889('0x13'),_0x5d15bd,_0x11cf1b['error'][_0xc889('0x14')]);return _0x3548f3(_0x11cf1b[_0xc889('0x11')][_0xc889('0x14')]);}else{logger[_0xc889('0xc')](_0xc889('0x13'),_0x5d15bd,'request\x20sent');_0x3548f3(_0x11cf1b[_0xc889('0x15')]['message']);}})[_0xc889('0x16')](function(_0x2855e0){logger['error'](_0xc889('0x13'),_0x5d15bd,_0x2855e0);_0x6d8ae5(_0x2855e0);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6d0afe4..97de51c 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 _0x8c97=['/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x3311ae,_0x362cee){var _0x107949=function(_0x2082a3){while(--_0x2082a3){_0x3311ae['push'](_0x3311ae['shift']());}};_0x107949(++_0x362cee);}(_0x8c97,0x158));var _0x78c9=function(_0x3b3b0b,_0x7126b6){_0x3b3b0b=_0x3b3b0b-0x0;var _0x575ad6=_0x8c97[_0x3b3b0b];return _0x575ad6;};'use strict';var multer=require('multer');var util=require(_0x78c9('0x0'));var path=require(_0x78c9('0x1'));var timeout=require(_0x78c9('0x2'));var express=require(_0x78c9('0x3'));var router=express['Router']();var fs_extra=require(_0x78c9('0x4'));var auth=require(_0x78c9('0x5'));var interaction=require(_0x78c9('0x6'));var config=require(_0x78c9('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x78c9('0x8')](),controller[_0x78c9('0x9')]);router[_0x78c9('0xa')](_0x78c9('0xb'),auth['isAuthenticated'](),controller[_0x78c9('0xc')]);router[_0x78c9('0xa')](_0x78c9('0xd'),auth[_0x78c9('0x8')](),controller['getConfigurations']);router[_0x78c9('0xa')](_0x78c9('0xe'),auth[_0x78c9('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x78c9('0xf')](_0x78c9('0xd'),auth[_0x78c9('0x8')](),controller[_0x78c9('0x10')]);router[_0x78c9('0x11')](_0x78c9('0xb'),auth['isAuthenticated'](),controller[_0x78c9('0x12')]);router[_0x78c9('0x13')]('/:id',auth[_0x78c9('0x8')](),controller['destroy']);module[_0x78c9('0x14')]=router; \ No newline at end of file +var _0xb040=['post','create','addConfiguration','put','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields'];(function(_0x15d4f9,_0x137db9){var _0x4d1033=function(_0x2df74c){while(--_0x2df74c){_0x15d4f9['push'](_0x15d4f9['shift']());}};_0x4d1033(++_0x137db9);}(_0xb040,0x156));var _0x0b04=function(_0x20aaa9,_0x9976d9){_0x20aaa9=_0x20aaa9-0x0;var _0x5c2ff1=_0xb040[_0x20aaa9];return _0x5c2ff1;};'use strict';var multer=require(_0x0b04('0x0'));var util=require('util');var path=require(_0x0b04('0x1'));var timeout=require(_0x0b04('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0b04('0x3'));var interaction=require(_0x0b04('0x4'));var config=require(_0x0b04('0x5'));var controller=require(_0x0b04('0x6'));router[_0x0b04('0x7')]('/',auth['isAuthenticated'](),controller[_0x0b04('0x8')]);router[_0x0b04('0x7')](_0x0b04('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0b04('0x7')](_0x0b04('0xa'),auth[_0x0b04('0xb')](),controller[_0x0b04('0xc')]);router[_0x0b04('0x7')](_0x0b04('0xd'),auth[_0x0b04('0xb')](),controller[_0x0b04('0xe')]);router[_0x0b04('0xf')]('/',auth[_0x0b04('0xb')](),controller[_0x0b04('0x10')]);router['post'](_0x0b04('0xa'),auth[_0x0b04('0xb')](),controller[_0x0b04('0x11')]);router[_0x0b04('0x12')](_0x0b04('0x9'),auth[_0x0b04('0xb')](),controller['update']);router[_0x0b04('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0b04('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 99811a7..aa4225a 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 _0xaf11=['exports','STRING','username','remoteUri','ENUM','password','integrationTab','sequelize'];(function(_0x354ab1,_0xec5b21){var _0x9918a1=function(_0x1becca){while(--_0x1becca){_0x354ab1['push'](_0x354ab1['shift']());}};_0x9918a1(++_0xec5b21);}(_0xaf11,0x12f));var _0x1af1=function(_0x1da8c7,_0x2c878e){_0x1da8c7=_0x1da8c7-0x0;var _0x134df5=_0xaf11[_0x1da8c7];return _0x134df5;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'name':{'type':Sequelize[_0x1af1('0x2')]},'description':{'type':Sequelize[_0x1af1('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1af1('0x3')},'password':{'type':Sequelize[_0x1af1('0x2')]},'token':{'type':Sequelize[_0x1af1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1af1('0x4')},'authType':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x6'),'token'),'defaultValue':_0x1af1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x7'),'newTab'),'defaultValue':_0x1af1('0x7')}}; \ No newline at end of file +var _0x1623=['password','integrationTab','newTab','sequelize','STRING','username','ENUM','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x442e46,_0x28c2fb){_0x442e46=_0x442e46-0x0;var _0x12b4ca=_0x1623[_0x442e46];return _0x12b4ca;};'use strict';var Sequelize=require(_0x3162('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3162('0x1')]},'username':{'type':Sequelize[_0x3162('0x1')],'unique':_0x3162('0x2')},'password':{'type':Sequelize[_0x3162('0x1')]},'token':{'type':Sequelize[_0x3162('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x3162('0x3')]('password',_0x3162('0x4')),'defaultValue':_0x3162('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x6'),_0x3162('0x7')),'defaultValue':_0x3162('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c292d8d..1968b4d 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 _0x9348=['authType','remoteUri','substring','lastIndexOf','%s/%s','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','username','token'];(function(_0x4e68c1,_0x2b9927){var _0x484431=function(_0x364e09){while(--_0x364e09){_0x4e68c1['push'](_0x4e68c1['shift']());}};_0x484431(++_0x2b9927);}(_0x9348,0x10d));var _0x8934=function(_0x2ead91,_0x80a706){_0x2ead91=_0x2ead91-0x0;var _0x15d7b6=_0x9348[_0x2ead91];return _0x15d7b6;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x68427d,_0x108eab){_0x108eab=_0x108eab||0xcc;return function(_0x46bca5){if(_0x46bca5){return _0x68427d[_0x8934('0x19')](_0x108eab);}return _0x68427d[_0x8934('0x1a')](_0x108eab)[_0x8934('0x1b')]();};}function respondWithResult(_0x5b560f,_0x254720){_0x254720=_0x254720||0xc8;return function(_0x38230a){if(_0x38230a){return _0x5b560f[_0x8934('0x1a')](_0x254720)[_0x8934('0x1c')](_0x38230a);}};}function respondWithFilteredResult(_0x34d4dc,_0x41e6a9){return function(_0x2a5b04){if(_0x2a5b04){var _0x357cf8=typeof _0x41e6a9['offset']===_0x8934('0x1d')&&typeof _0x41e6a9[_0x8934('0x1e')]===_0x8934('0x1d');var _0x5de8f0=_0x2a5b04['count'];var _0x597eed=_0x357cf8?0x0:_0x41e6a9[_0x8934('0x1f')];var _0x51f9ed=_0x357cf8?_0x2a5b04[_0x8934('0x20')]:_0x41e6a9[_0x8934('0x1f')]+_0x41e6a9[_0x8934('0x1e')];var _0x36c3b9;if(_0x51f9ed>=_0x5de8f0){_0x51f9ed=_0x5de8f0;_0x36c3b9=0xc8;}else{_0x36c3b9=0xce;}_0x34d4dc[_0x8934('0x1a')](_0x36c3b9);return _0x34d4dc['set'](_0x8934('0x21'),_0x597eed+'-'+_0x51f9ed+'/'+_0x5de8f0)['json'](_0x2a5b04);}return null;};}function patchUpdates(_0x476c6c){return function(_0x34f4e7){try{jsonpatch[_0x8934('0x22')](_0x34f4e7,_0x476c6c,!![]);}catch(_0x379445){return BPromise[_0x8934('0x23')](_0x379445);}return _0x34f4e7[_0x8934('0x24')]();};}function saveUpdates(_0x36fe20,_0x4f4a9b){return function(_0xe763c6){if(_0xe763c6){return _0xe763c6[_0x8934('0x25')](_0x36fe20)[_0x8934('0x26')](function(_0x343e09){return _0x343e09;});}return null;};}function removeEntity(_0x43b89a,_0x5e593b){return function(_0x3cf295){if(_0x3cf295){return _0x3cf295[_0x8934('0x27')]()[_0x8934('0x26')](function(){_0x43b89a['status'](0xcc)[_0x8934('0x1b')]();});}};}function handleEntityNotFound(_0x561df2,_0x14c5f0){return function(_0x1783ce){if(!_0x1783ce){_0x561df2[_0x8934('0x19')](0x194);}return _0x1783ce;};}function handleError(_0x5ef0ed,_0x1fd5eb){_0x1fd5eb=_0x1fd5eb||0x1f4;return function(_0x15910b){logger[_0x8934('0x28')](_0x15910b[_0x8934('0x29')]);if(_0x15910b['name']){delete _0x15910b[_0x8934('0x2a')];}_0x5ef0ed[_0x8934('0x1a')](_0x1fd5eb)[_0x8934('0x2b')](_0x15910b);};}exports[_0x8934('0x2c')]=function(_0x44972b,_0x20d448){var _0x3f328a={},_0x457634={},_0x9c6a71={'count':0x0,'rows':[]};var _0x18938a=_['map'](db[_0x8934('0x2d')][_0x8934('0x2e')],function(_0x54d28d){return{'name':_0x54d28d[_0x8934('0x2f')],'type':_0x54d28d[_0x8934('0x30')][_0x8934('0x31')]};});_0x457634[_0x8934('0x32')]=_['map'](_0x18938a,_0x8934('0x2a'));_0x457634[_0x8934('0x33')]=_[_0x8934('0x34')](_0x44972b[_0x8934('0x33')]);_0x457634[_0x8934('0x35')]=_['intersection'](_0x457634[_0x8934('0x32')],_0x457634['query']);_0x3f328a['attributes']=_[_0x8934('0x36')](_0x457634[_0x8934('0x32')],qs[_0x8934('0x37')](_0x44972b[_0x8934('0x33')]['fields']));_0x3f328a[_0x8934('0x38')]=_0x3f328a[_0x8934('0x38')][_0x8934('0x39')]?_0x3f328a[_0x8934('0x38')]:_0x457634[_0x8934('0x32')];if(!_0x44972b['query'][_0x8934('0x3a')](_0x8934('0x3b'))){_0x3f328a['limit']=qs['limit'](_0x44972b[_0x8934('0x33')][_0x8934('0x1e')]);_0x3f328a['offset']=qs['offset'](_0x44972b[_0x8934('0x33')][_0x8934('0x1f')]);}_0x3f328a[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x44972b[_0x8934('0x33')][_0x8934('0x3d')]);_0x3f328a[_0x8934('0x3e')]=qs[_0x8934('0x35')](_[_0x8934('0x3f')](_0x44972b[_0x8934('0x33')],_0x457634[_0x8934('0x35')]),_0x18938a);if(_0x44972b['query'][_0x8934('0x40')]){_0x3f328a[_0x8934('0x3e')]=_['merge'](_0x3f328a[_0x8934('0x3e')],{'$or':_[_0x8934('0x41')](_0x18938a,function(_0x414091){if(_0x414091[_0x8934('0x30')]!==_0x8934('0x42')){var _0x5b0307={};_0x5b0307[_0x414091['name']]={'$like':'%'+_0x44972b['query'][_0x8934('0x40')]+'%'};return _0x5b0307;}})});}_0x3f328a=_[_0x8934('0x43')]({},_0x3f328a,_0x44972b[_0x8934('0x44')]);var _0x53581b={'where':_0x3f328a[_0x8934('0x3e')]};return db['ZendeskAccount']['count'](_0x53581b)[_0x8934('0x26')](function(_0x1f36d0){_0x9c6a71['count']=_0x1f36d0;if(_0x44972b['query'][_0x8934('0x45')]){_0x3f328a[_0x8934('0x46')]=[{'all':!![]}];}return db[_0x8934('0x2d')]['findAll'](_0x3f328a);})[_0x8934('0x26')](function(_0x5e543c){_0x9c6a71[_0x8934('0x47')]=_0x5e543c;return _0x9c6a71;})['then'](respondWithFilteredResult(_0x20d448,_0x3f328a))[_0x8934('0x48')](handleError(_0x20d448,null));};exports[_0x8934('0x49')]=function(_0x83be9e,_0x566d67){var _0xefdfab={'raw':![],'where':{'id':_0x83be9e[_0x8934('0x4a')]['id']}},_0x350d04={};_0x350d04[_0x8934('0x32')]=_['keys'](db[_0x8934('0x2d')][_0x8934('0x2e')]);_0x350d04[_0x8934('0x33')]=_[_0x8934('0x34')](_0x83be9e[_0x8934('0x33')]);_0x350d04[_0x8934('0x35')]=_[_0x8934('0x36')](_0x350d04[_0x8934('0x32')],_0x350d04['query']);_0xefdfab['attributes']=_['intersection'](_0x350d04[_0x8934('0x32')],qs[_0x8934('0x37')](_0x83be9e['query'][_0x8934('0x37')]));_0xefdfab['attributes']=_0xefdfab[_0x8934('0x38')][_0x8934('0x39')]?_0xefdfab['attributes']:_0x350d04[_0x8934('0x32')];if(_0x83be9e[_0x8934('0x33')][_0x8934('0x45')]){_0xefdfab[_0x8934('0x46')]=[{'all':!![]}];}_0xefdfab=_['merge']({},_0xefdfab,_0x83be9e[_0x8934('0x44')]);return db[_0x8934('0x2d')]['find'](_0xefdfab)[_0x8934('0x26')](handleEntityNotFound(_0x566d67,null))[_0x8934('0x26')](respondWithResult(_0x566d67,null))[_0x8934('0x48')](handleError(_0x566d67,null));};exports[_0x8934('0x4b')]=function(_0x406d0a,_0x419e30){return db[_0x8934('0x2d')][_0x8934('0x4b')](_0x406d0a[_0x8934('0x4c')],{})[_0x8934('0x26')](respondWithResult(_0x419e30,0xc9))[_0x8934('0x48')](handleError(_0x419e30,null));};exports[_0x8934('0x25')]=function(_0x2c322d,_0x2febf5){if(_0x2c322d[_0x8934('0x4c')]['id']){delete _0x2c322d[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x4d')]({'where':{'id':_0x2c322d['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x2febf5,null))[_0x8934('0x26')](saveUpdates(_0x2c322d['body'],null))['then'](respondWithResult(_0x2febf5,null))['catch'](handleError(_0x2febf5,null));};exports['destroy']=function(_0x3610a0,_0x15310a){return db[_0x8934('0x2d')]['find']({'where':{'id':_0x3610a0['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x15310a,null))['then'](removeEntity(_0x15310a,null))['catch'](handleError(_0x15310a,null));};exports[_0x8934('0x4e')]=function(_0x2778f9,_0x173bc1,_0x334f27){var _0x21ca17={};var _0x1b66d8={};var _0x3902fb;var _0x575bd7;return db[_0x8934('0x2d')]['findOne']({'where':{'id':_0x2778f9[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x173bc1,null))[_0x8934('0x26')](function(_0x3df31e){if(_0x3df31e){_0x3902fb=_0x3df31e;_0x1b66d8[_0x8934('0x32')]=_[_0x8934('0x34')](db[_0x8934('0x4f')][_0x8934('0x2e')]);_0x1b66d8['query']=_[_0x8934('0x34')](_0x2778f9[_0x8934('0x33')]);_0x1b66d8[_0x8934('0x35')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],_0x1b66d8['query']);_0x21ca17[_0x8934('0x38')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],qs['fields'](_0x2778f9[_0x8934('0x33')][_0x8934('0x37')]));_0x21ca17[_0x8934('0x38')]=_0x21ca17['attributes']['length']?_0x21ca17['attributes']:_0x1b66d8[_0x8934('0x32')];_0x21ca17[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x2778f9['query'][_0x8934('0x3d')]);_0x21ca17[_0x8934('0x3e')]=qs['filters'](_['pick'](_0x2778f9[_0x8934('0x33')],_0x1b66d8[_0x8934('0x35')]));if(_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]){_0x21ca17['where']=_['merge'](_0x21ca17['where'],{'$or':_['map'](_0x21ca17[_0x8934('0x38')],function(_0x2b8837){var _0x18d08e={};_0x18d08e[_0x2b8837]={'$like':'%'+_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]+'%'};return _0x18d08e;})});}_0x21ca17=_[_0x8934('0x43')]({},_0x21ca17,_0x2778f9['options']);return _0x3902fb[_0x8934('0x4e')](_0x21ca17);}})[_0x8934('0x26')](function(_0x4991bd){if(_0x4991bd){_0x575bd7=_0x4991bd[_0x8934('0x39')];if(!_0x2778f9['query'][_0x8934('0x3a')]('nolimit')){_0x21ca17[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x2778f9[_0x8934('0x33')][_0x8934('0x1e')]);_0x21ca17[_0x8934('0x1f')]=qs[_0x8934('0x1f')](_0x2778f9[_0x8934('0x33')]['offset']);}return _0x3902fb['getConfigurations'](_0x21ca17);}})[_0x8934('0x26')](function(_0x3a0378){if(_0x3a0378){return _0x3a0378?{'count':_0x575bd7,'rows':_0x3a0378}:null;}})[_0x8934('0x26')](respondWithResult(_0x173bc1,null))[_0x8934('0x48')](handleError(_0x173bc1,null));};exports[_0x8934('0x50')]=function(_0x18850a,_0x35c437,_0x112957){if(_0x18850a[_0x8934('0x4c')]['id']){delete _0x18850a[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x18850a[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x35c437,null))['then'](function(_0x5c2819){if(_0x5c2819){_0x18850a[_0x8934('0x4c')][_0x8934('0x52')]=_0x5c2819['id'];_0x18850a[_0x8934('0x4c')][_0x8934('0x53')]=integrations[_0x8934('0x54')](_0x18850a[_0x8934('0x4c')][_0x8934('0x55')],_0x18850a['body'][_0x8934('0x30')]);_0x18850a[_0x8934('0x4c')]['Descriptions']=integrations[_0x8934('0x56')](_0x18850a['body'][_0x8934('0x55')],_0x18850a[_0x8934('0x4c')][_0x8934('0x30')]);return db['ZendeskConfiguration'][_0x8934('0x4b')](_0x18850a[_0x8934('0x4c')],{'include':[{'model':db['ZendeskField'],'as':_0x8934('0x53')},{'model':db['ZendeskField'],'as':_0x8934('0x57')}]});}return null;})['then'](respondWithResult(_0x35c437,null))[_0x8934('0x48')](handleError(_0x35c437,null));};exports[_0x8934('0x58')]=function(_0x24b0ce,_0x5ea4fe,_0x196372){var _0xfbad9='';return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x24b0ce['params']['id']},'attributes':['id',_0x8934('0x59'),'password',_0x8934('0x5a'),_0x8934('0x5b'),_0x8934('0x5c')]})[_0x8934('0x26')](handleEntityNotFound(_0x5ea4fe,null))['then'](function(_0xc2799d){if(_0xc2799d){_0xfbad9=_0xc2799d[_0x8934('0x5c')];var _0xd880ba=_0xfbad9['slice'](-0x1);if(_0xd880ba==='/'){_0xfbad9=_0xfbad9[_0x8934('0x5d')](0x0,_0xfbad9[_0x8934('0x5e')](_0xd880ba));}var _0x2acd18={'method':'GET','uri':util['format'](_0x8934('0x5f'),_0xfbad9,_0x8934('0x60')),'json':!![]};switch(_0xc2799d[_0x8934('0x5b')]){case _0x8934('0x61'):_0x2acd18[_0x8934('0x62')]={'Authorization':util[_0x8934('0x63')](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')](_0x8934('0x65'),_0xc2799d['username'],_0xc2799d[_0x8934('0x61')]))[_0x8934('0x66')](_0x8934('0x67')))};break;case _0x8934('0x5a'):_0x2acd18[_0x8934('0x62')]={'Authorization':util['format'](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')]('%s/token:%s',_0xc2799d[_0x8934('0x59')],_0xc2799d['token']))['toString']('base64'))};break;default:throw new db[(_0x8934('0x68'))][(_0x8934('0x69'))](_0x8934('0x6a'));}return rp(_0x2acd18);}})['then'](function(_0x2c289b){if(_0x2c289b){var _0x1d3372=['subject',_0x8934('0x6b'),_0x8934('0x6c'),_0x8934('0x6d')];_[_0x8934('0x6e')](_0x2c289b[_0x8934('0x60')],function(_0x324722){return _0x1d3372[_0x8934('0x6f')](_0x324722[_0x8934('0x30')]);});return{'count':_0x2c289b[_0x8934('0x60')][_0x8934('0x39')],'rows':_['map'](_0x2c289b[_0x8934('0x60')],function(_0x31e7d1){return{'id':_0x31e7d1['id'],'name':_0x31e7d1[_0x8934('0x70')]>0x7?_0x31e7d1[_0x8934('0x71')]:_0x31e7d1[_0x8934('0x30')],'custom':_0x31e7d1[_0x8934('0x70')]>0x7?!![]:![],'options':_0x31e7d1[_0x8934('0x72')]?_0x31e7d1['system_field_options']:_0x31e7d1[_0x8934('0x73')]?_0x31e7d1[_0x8934('0x73')]:[]};})};}})[_0x8934('0x26')](respondWithResult(_0x5ea4fe,null))[_0x8934('0x48')](function(_0x9de459){var _0xdf0ab2=_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?0x1f4:_0x9de459[_0x8934('0x75')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8934('0x58'),_0xdf0ab2,JSON[_0x8934('0x76')](_0x9de459));delete _0x9de459['name'];if(_0xdf0ab2===0x191){_0xdf0ab2=0x190;}_0x5ea4fe[_0x8934('0x1a')](_0xdf0ab2)[_0x8934('0x2b')](_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?{'message':_0x8934('0x77'),'statusCode':_0x9de459[_0x8934('0x75')]}:_0x9de459);});}; \ No newline at end of file +var _0x351d=['Subjects','Descriptions','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','%s/%s','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','catch','params','include','find','create','body','update','findOne','ZendeskConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','ZendeskField'];(function(_0x13321a,_0x273c96){var _0x452c07=function(_0x3c653c){while(--_0x3c653c){_0x13321a['push'](_0x13321a['shift']());}};_0x452c07(++_0x273c96);}(_0x351d,0x90));var _0xd351=function(_0xd30440,_0x12fce8){_0xd30440=_0xd30440-0x0;var _0x4dbdd6=_0x351d[_0xd30440];return _0x4dbdd6;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd351('0x13'));function respondWithStatusCode(_0x15549a,_0x23445f){_0x23445f=_0x23445f||0xcc;return function(_0x1eb2a9){if(_0x1eb2a9){return _0x15549a['sendStatus'](_0x23445f);}return _0x15549a[_0xd351('0x14')](_0x23445f)[_0xd351('0x15')]();};}function respondWithResult(_0x597d7c,_0xc5a145){_0xc5a145=_0xc5a145||0xc8;return function(_0xb106ef){if(_0xb106ef){return _0x597d7c[_0xd351('0x14')](_0xc5a145)[_0xd351('0x16')](_0xb106ef);}};}function respondWithFilteredResult(_0x3867fb,_0x4d238c){return function(_0x9f790f){if(_0x9f790f){var _0x49d8bb=typeof _0x4d238c['offset']===_0xd351('0x17')&&typeof _0x4d238c['limit']===_0xd351('0x17');var _0x1de35f=_0x9f790f[_0xd351('0x18')];var _0x4c6693=_0x49d8bb?0x0:_0x4d238c[_0xd351('0x19')];var _0x2bfc53=_0x49d8bb?_0x9f790f[_0xd351('0x18')]:_0x4d238c[_0xd351('0x19')]+_0x4d238c['limit'];var _0xc2d2c0;if(_0x2bfc53>=_0x1de35f){_0x2bfc53=_0x1de35f;_0xc2d2c0=0xc8;}else{_0xc2d2c0=0xce;}_0x3867fb['status'](_0xc2d2c0);return _0x3867fb['set'](_0xd351('0x1a'),_0x4c6693+'-'+_0x2bfc53+'/'+_0x1de35f)['json'](_0x9f790f);}return null;};}function patchUpdates(_0x33b1e5){return function(_0x2d75dd){try{jsonpatch[_0xd351('0x1b')](_0x2d75dd,_0x33b1e5,!![]);}catch(_0x42631b){return BPromise[_0xd351('0x1c')](_0x42631b);}return _0x2d75dd['save']();};}function saveUpdates(_0x18625b,_0xbbc58){return function(_0x241265){if(_0x241265){return _0x241265['update'](_0x18625b)[_0xd351('0x1d')](function(_0x2d9aa0){return _0x2d9aa0;});}return null;};}function removeEntity(_0x365bbc,_0x59fb6d){return function(_0x1ce279){if(_0x1ce279){return _0x1ce279[_0xd351('0x1e')]()[_0xd351('0x1d')](function(){_0x365bbc[_0xd351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f7f3,_0x483c92){return function(_0x358bff){if(!_0x358bff){_0x40f7f3[_0xd351('0x1f')](0x194);}return _0x358bff;};}function handleError(_0x54f471,_0x2648d0){_0x2648d0=_0x2648d0||0x1f4;return function(_0x55b4d3){logger['error'](_0x55b4d3[_0xd351('0x20')]);if(_0x55b4d3['name']){delete _0x55b4d3['name'];}_0x54f471[_0xd351('0x14')](_0x2648d0)['send'](_0x55b4d3);};}exports[_0xd351('0x21')]=function(_0x2ddae8,_0x407b50){var _0x4d3f48={},_0x71ce9c={},_0x4aa902={'count':0x0,'rows':[]};var _0x1c826b=_['map'](db['ZendeskAccount'][_0xd351('0x22')],function(_0x38c82f){return{'name':_0x38c82f[_0xd351('0x23')],'type':_0x38c82f[_0xd351('0x24')]['key']};});_0x71ce9c[_0xd351('0x25')]=_[_0xd351('0x26')](_0x1c826b,_0xd351('0x27'));_0x71ce9c[_0xd351('0x28')]=_[_0xd351('0x29')](_0x2ddae8[_0xd351('0x28')]);_0x71ce9c[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],_0x71ce9c['query']);_0x4d3f48[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x2ddae8['query'][_0xd351('0x2d')]));_0x4d3f48[_0xd351('0x2c')]=_0x4d3f48[_0xd351('0x2c')][_0xd351('0x2e')]?_0x4d3f48[_0xd351('0x2c')]:_0x71ce9c[_0xd351('0x25')];if(!_0x2ddae8[_0xd351('0x28')][_0xd351('0x2f')](_0xd351('0x30'))){_0x4d3f48['limit']=qs['limit'](_0x2ddae8[_0xd351('0x28')][_0xd351('0x31')]);_0x4d3f48[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x2ddae8[_0xd351('0x28')][_0xd351('0x19')]);}_0x4d3f48['order']=qs['sort'](_0x2ddae8[_0xd351('0x28')]['sort']);_0x4d3f48[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x2ddae8[_0xd351('0x28')],_0x71ce9c[_0xd351('0x2a')]),_0x1c826b);if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]){_0x4d3f48[_0xd351('0x32')]=_[_0xd351('0x35')](_0x4d3f48[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x1c826b,function(_0x4b15db){if(_0x4b15db[_0xd351('0x24')]!=='VIRTUAL'){var _0x22631={};_0x22631[_0x4b15db[_0xd351('0x27')]]={'$like':'%'+_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]+'%'};return _0x22631;}})});}_0x4d3f48=_[_0xd351('0x35')]({},_0x4d3f48,_0x2ddae8[_0xd351('0x36')]);var _0x545bfc={'where':_0x4d3f48[_0xd351('0x32')]};return db[_0xd351('0x37')]['count'](_0x545bfc)[_0xd351('0x1d')](function(_0x2d8ea8){_0x4aa902[_0xd351('0x18')]=_0x2d8ea8;if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x38')]){_0x4d3f48['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xd351('0x39')](_0x4d3f48);})[_0xd351('0x1d')](function(_0x5dae6d){_0x4aa902['rows']=_0x5dae6d;return _0x4aa902;})[_0xd351('0x1d')](respondWithFilteredResult(_0x407b50,_0x4d3f48))[_0xd351('0x3a')](handleError(_0x407b50,null));};exports['show']=function(_0x570d57,_0x46af23){var _0x18f9d1={'raw':![],'where':{'id':_0x570d57[_0xd351('0x3b')]['id']}},_0x3b8526={};_0x3b8526[_0xd351('0x25')]=_[_0xd351('0x29')](db[_0xd351('0x37')][_0xd351('0x22')]);_0x3b8526[_0xd351('0x28')]=_['keys'](_0x570d57['query']);_0x3b8526[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],_0x3b8526[_0xd351('0x28')]);_0x18f9d1[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x570d57[_0xd351('0x28')][_0xd351('0x2d')]));_0x18f9d1[_0xd351('0x2c')]=_0x18f9d1[_0xd351('0x2c')][_0xd351('0x2e')]?_0x18f9d1[_0xd351('0x2c')]:_0x3b8526[_0xd351('0x25')];if(_0x570d57[_0xd351('0x28')]['includeAll']){_0x18f9d1[_0xd351('0x3c')]=[{'all':!![]}];}_0x18f9d1=_[_0xd351('0x35')]({},_0x18f9d1,_0x570d57[_0xd351('0x36')]);return db['ZendeskAccount'][_0xd351('0x3d')](_0x18f9d1)[_0xd351('0x1d')](handleEntityNotFound(_0x46af23,null))[_0xd351('0x1d')](respondWithResult(_0x46af23,null))[_0xd351('0x3a')](handleError(_0x46af23,null));};exports[_0xd351('0x3e')]=function(_0x5bc86a,_0x5adea4){return db['ZendeskAccount'][_0xd351('0x3e')](_0x5bc86a[_0xd351('0x3f')],{})['then'](respondWithResult(_0x5adea4,0xc9))['catch'](handleError(_0x5adea4,null));};exports[_0xd351('0x40')]=function(_0x444206,_0x2af877){if(_0x444206['body']['id']){delete _0x444206[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')]['find']({'where':{'id':_0x444206[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2af877,null))[_0xd351('0x1d')](saveUpdates(_0x444206[_0xd351('0x3f')],null))['then'](respondWithResult(_0x2af877,null))['catch'](handleError(_0x2af877,null));};exports[_0xd351('0x1e')]=function(_0x58ce5a,_0xf9f375){return db[_0xd351('0x37')][_0xd351('0x3d')]({'where':{'id':_0x58ce5a['params']['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0xf9f375,null))['then'](removeEntity(_0xf9f375,null))['catch'](handleError(_0xf9f375,null));};exports['getConfigurations']=function(_0x7e4bad,_0x292af3,_0x334029){var _0x5a2e9b={};var _0x554e3a={};var _0x1748f0;var _0x42f248;return db['ZendeskAccount'][_0xd351('0x41')]({'where':{'id':_0x7e4bad[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x292af3,null))[_0xd351('0x1d')](function(_0x59ab0f){if(_0x59ab0f){_0x1748f0=_0x59ab0f;_0x554e3a[_0xd351('0x25')]=_['keys'](db[_0xd351('0x42')][_0xd351('0x22')]);_0x554e3a[_0xd351('0x28')]=_[_0xd351('0x29')](_0x7e4bad[_0xd351('0x28')]);_0x554e3a[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x554e3a['model'],_0x554e3a['query']);_0x5a2e9b[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x554e3a['model'],qs[_0xd351('0x2d')](_0x7e4bad[_0xd351('0x28')][_0xd351('0x2d')]));_0x5a2e9b['attributes']=_0x5a2e9b[_0xd351('0x2c')]['length']?_0x5a2e9b['attributes']:_0x554e3a[_0xd351('0x25')];_0x5a2e9b[_0xd351('0x43')]=qs['sort'](_0x7e4bad[_0xd351('0x28')][_0xd351('0x44')]);_0x5a2e9b[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x7e4bad[_0xd351('0x28')],_0x554e3a['filters']));if(_0x7e4bad[_0xd351('0x28')][_0xd351('0x34')]){_0x5a2e9b[_0xd351('0x32')]=_[_0xd351('0x35')](_0x5a2e9b[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x5a2e9b[_0xd351('0x2c')],function(_0x4b2029){var _0x24dcdb={};_0x24dcdb[_0x4b2029]={'$like':'%'+_0x7e4bad['query'][_0xd351('0x34')]+'%'};return _0x24dcdb;})});}_0x5a2e9b=_[_0xd351('0x35')]({},_0x5a2e9b,_0x7e4bad[_0xd351('0x36')]);return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x4eaf18){if(_0x4eaf18){_0x42f248=_0x4eaf18[_0xd351('0x2e')];if(!_0x7e4bad['query'][_0xd351('0x2f')](_0xd351('0x30'))){_0x5a2e9b[_0xd351('0x31')]=qs[_0xd351('0x31')](_0x7e4bad[_0xd351('0x28')]['limit']);_0x5a2e9b['offset']=qs[_0xd351('0x19')](_0x7e4bad[_0xd351('0x28')]['offset']);}return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x2718e9){if(_0x2718e9){return _0x2718e9?{'count':_0x42f248,'rows':_0x2718e9}:null;}})['then'](respondWithResult(_0x292af3,null))[_0xd351('0x3a')](handleError(_0x292af3,null));};exports[_0xd351('0x46')]=function(_0x284d12,_0x5dbdef,_0x5d13ec){if(_0x284d12['body']['id']){delete _0x284d12[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x284d12[_0xd351('0x3b')]['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0x5dbdef,null))[_0xd351('0x1d')](function(_0x2c83fe){if(_0x2c83fe){_0x284d12['body'][_0xd351('0x47')]=_0x2c83fe['id'];_0x284d12['body']['Subjects']=integrations[_0xd351('0x48')](_0x284d12[_0xd351('0x3f')]['channel'],_0x284d12[_0xd351('0x3f')]['type']);_0x284d12['body']['Descriptions']=integrations[_0xd351('0x49')](_0x284d12[_0xd351('0x3f')][_0xd351('0x4a')],_0x284d12['body'][_0xd351('0x24')]);return db[_0xd351('0x42')][_0xd351('0x3e')](_0x284d12[_0xd351('0x3f')],{'include':[{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4c')},{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4d')}]});}return null;})[_0xd351('0x1d')](respondWithResult(_0x5dbdef,null))[_0xd351('0x3a')](handleError(_0x5dbdef,null));};exports[_0xd351('0x4e')]=function(_0x4d20af,_0x2fcede,_0x2d59a5){var _0x431e91='';return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x4d20af[_0xd351('0x3b')]['id']},'attributes':['id','username',_0xd351('0x4f'),_0xd351('0x50'),'authType','remoteUri']})[_0xd351('0x1d')](handleEntityNotFound(_0x2fcede,null))[_0xd351('0x1d')](function(_0x44dc58){if(_0x44dc58){_0x431e91=_0x44dc58[_0xd351('0x51')];var _0x1db455=_0x431e91[_0xd351('0x52')](-0x1);if(_0x1db455==='/'){_0x431e91=_0x431e91[_0xd351('0x53')](0x0,_0x431e91[_0xd351('0x54')](_0x1db455));}var _0x3ce2b9={'method':'GET','uri':util[_0xd351('0x55')](_0xd351('0x56'),_0x431e91,'ticket_fields'),'json':!![]};switch(_0x44dc58[_0xd351('0x57')]){case'password':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util['format'](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5a'),_0x44dc58[_0xd351('0x5b')],_0x44dc58[_0xd351('0x4f')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;case'token':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util[_0xd351('0x55')](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5e'),_0x44dc58['username'],_0x44dc58[_0xd351('0x50')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;default:throw new db['Sequelize'][(_0xd351('0x5f'))](_0xd351('0x60'));}return rp(_0x3ce2b9);}})[_0xd351('0x1d')](function(_0x3f0d27){if(_0x3f0d27){var _0x3635ad=[_0xd351('0x61'),_0xd351('0x62'),_0xd351('0x63'),_0xd351('0x64')];_['remove'](_0x3f0d27[_0xd351('0x65')],function(_0x190a00){return _0x3635ad['includes'](_0x190a00[_0xd351('0x24')]);});return{'count':_0x3f0d27['ticket_fields']['length'],'rows':_['map'](_0x3f0d27[_0xd351('0x65')],function(_0x3367f8){return{'id':_0x3367f8['id'],'name':_0x3367f8[_0xd351('0x66')]>0x7?_0x3367f8['title']:_0x3367f8[_0xd351('0x24')],'custom':_0x3367f8['position']>0x7?!![]:![],'options':_0x3367f8[_0xd351('0x67')]?_0x3367f8['system_field_options']:_0x3367f8[_0xd351('0x68')]?_0x3367f8[_0xd351('0x68')]:[]};})};}})[_0xd351('0x1d')](respondWithResult(_0x2fcede,null))[_0xd351('0x3a')](function(_0x35b148){var _0x1bb955=_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?0x1f4:_0x35b148[_0xd351('0x6a')]||0x1f4;logger[_0xd351('0x6b')](_0xd351('0x6c'),_0xd351('0x4e'),_0x1bb955,JSON['stringify'](_0x35b148));delete _0x35b148[_0xd351('0x27')];if(_0x1bb955===0x191){_0x1bb955=0x190;}_0x2fcede[_0xd351('0x14')](_0x1bb955)[_0xd351('0x6d')](_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x35b148[_0xd351('0x6a')]}:_0x35b148);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f1630a5..43141a4 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 _0xd351=['bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1290cf,_0x51d26f){var _0x17e951=function(_0xc5b20a){while(--_0xc5b20a){_0x1290cf['push'](_0x1290cf['shift']());}};_0x17e951(++_0x51d26f);}(_0xd351,0x1a8));var _0x1d35=function(_0xe45141,_0x5ae0db){_0xe45141=_0xe45141-0x0;var _0x586856=_0xd351[_0xe45141];return _0x586856;};'use strict';var _=require(_0x1d35('0x0'));var util=require(_0x1d35('0x1'));var logger=require(_0x1d35('0x2'))(_0x1d35('0x3'));var moment=require(_0x1d35('0x4'));var BPromise=require(_0x1d35('0x5'));var rp=require(_0x1d35('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d35('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x1d35('0x8'));module[_0x1d35('0x9')]=function(_0x3a65bb,_0x47138f){return _0x3a65bb[_0x1d35('0xa')](_0x1d35('0xb'),attributes,{'tableName':_0x1d35('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa879=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','int_zendesk_accounts'];(function(_0x5bf427,_0x1187df){var _0x294876=function(_0x3a84c6){while(--_0x3a84c6){_0x5bf427['push'](_0x5bf427['shift']());}};_0x294876(++_0x1187df);}(_0xa879,0xbe));var _0x9a87=function(_0x26b0bd,_0xd99b02){_0x26b0bd=_0x26b0bd-0x0;var _0x5ab9b1=_0xa879[_0x26b0bd];return _0x5ab9b1;};'use strict';var _=require(_0x9a87('0x0'));var util=require(_0x9a87('0x1'));var logger=require(_0x9a87('0x2'))(_0x9a87('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a87('0x4'));var rimraf=require(_0x9a87('0x5'));var config=require(_0x9a87('0x6'));var attributes=require(_0x9a87('0x7'));var integrations=require(_0x9a87('0x8'));module['exports']=function(_0x51a1de,_0x3639f6){return _0x51a1de['define']('ZendeskAccount',attributes,{'tableName':_0x9a87('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 47d9de2..8d97b95 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 _0xe29d=['message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowZendeskAccount','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xe29d,0x1a7));var _0xde29=function(_0x16799e,_0x814583){_0x16799e=_0x16799e-0x0;var _0x1a9eb4=_0xe29d[_0x16799e];return _0x1a9eb4;};'use strict';var _=require(_0xde29('0x0'));var util=require(_0xde29('0x1'));var moment=require(_0xde29('0x2'));var BPromise=require('bluebird');var rs=require(_0xde29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde29('0x4'))['db'];var utils=require(_0xde29('0x5'));var logger=require(_0xde29('0x6'))('rpc');var config=require(_0xde29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xde29('0x8')][_0xde29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29b12e,_0x2ebef9,_0x2d6e06){return new BPromise(function(_0x2b2843,_0x1133fc){return client[_0xde29('0xa')](_0x29b12e,_0x2d6e06)[_0xde29('0xb')](function(_0x10e3d5){logger[_0xde29('0xc')](_0xde29('0xd'),_0x2ebef9,_0xde29('0xe'));logger['debug'](_0xde29('0xf'),_0x2ebef9,_0xde29('0xe'),JSON[_0xde29('0x10')](_0x10e3d5));if(_0x10e3d5[_0xde29('0x11')]){if(_0x10e3d5[_0xde29('0x11')][_0xde29('0x12')]===0x1f4){logger[_0xde29('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x2ebef9,_0x10e3d5[_0xde29('0x11')][_0xde29('0x13')]);return _0x1133fc(_0x10e3d5[_0xde29('0x11')][_0xde29('0x13')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2ebef9,_0x10e3d5[_0xde29('0x11')]['message']);return _0x2b2843(_0x10e3d5[_0xde29('0x11')][_0xde29('0x13')]);}else{logger[_0xde29('0xc')](_0xde29('0xd'),_0x2ebef9,_0xde29('0xe'));_0x2b2843(_0x10e3d5['result'][_0xde29('0x13')]);}})[_0xde29('0x14')](function(_0x147960){logger[_0xde29('0x11')](_0xde29('0xd'),_0x2ebef9,_0x147960);_0x1133fc(_0x147960);});});}exports[_0xde29('0x15')]=function(_0x41f259){var _0x37d6b0=this;return new Promise(function(_0x3f6a49,_0x2713a3){return db[_0xde29('0x16')][_0xde29('0x17')]({'raw':_0x41f259[_0xde29('0x18')]?_0x41f259[_0xde29('0x18')][_0xde29('0x19')]===undefined?!![]:![]:!![],'where':_0x41f259[_0xde29('0x18')]?_0x41f259['options']['where']||null:null,'attributes':_0x41f259[_0xde29('0x18')]?_0x41f259[_0xde29('0x18')][_0xde29('0x1a')]||null:null,'limit':_0x41f259[_0xde29('0x18')]?_0x41f259[_0xde29('0x18')][_0xde29('0x1b')]||null:null,'include':_0x41f259['options']?_0x41f259[_0xde29('0x18')][_0xde29('0x1c')]?_[_0xde29('0x1d')](_0x41f259['options'][_0xde29('0x1c')],function(_0x43bde9){return{'model':db[_0x43bde9['model']],'as':_0x43bde9['as'],'attributes':_0x43bde9['attributes'],'include':_0x43bde9[_0xde29('0x1c')]?_['map'](_0x43bde9[_0xde29('0x1c')],function(_0x2b146f){return{'model':db[_0x2b146f[_0xde29('0x1e')]],'as':_0x2b146f['as'],'attributes':_0x2b146f['attributes'],'include':_0x2b146f[_0xde29('0x1c')]?_['map'](_0x2b146f[_0xde29('0x1c')],function(_0x70c2b2){return{'model':db[_0x70c2b2['model']],'as':_0x70c2b2['as'],'attributes':_0x70c2b2['attributes']};}):[]};}):[]};}):[]:[]})[_0xde29('0xb')](function(_0x2a0cec){logger['info'](_0xde29('0x15'),_0x41f259);logger[_0xde29('0x1f')](_0xde29('0x15'),_0x41f259,JSON[_0xde29('0x10')](_0x2a0cec));_0x3f6a49(_0x2a0cec);})[_0xde29('0x14')](function(_0x213ea5){logger[_0xde29('0x11')](_0xde29('0x15'),_0x213ea5[_0xde29('0x13')],_0x41f259);_0x2713a3(_0x37d6b0[_0xde29('0x11')](0x1f4,_0x213ea5[_0xde29('0x13')]));});});};exports[_0xde29('0x20')]=function(_0x163ef5){var _0x58686d=this;return new Promise(function(_0x28bfd4,_0x142b2b){return db[_0xde29('0x16')]['find']({'raw':_0x163ef5[_0xde29('0x18')]?_0x163ef5[_0xde29('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x163ef5[_0xde29('0x18')]?_0x163ef5[_0xde29('0x18')][_0xde29('0x21')]||null:null,'attributes':_0x163ef5['options']?_0x163ef5[_0xde29('0x18')][_0xde29('0x1a')]||null:null,'include':_0x163ef5[_0xde29('0x18')]?_0x163ef5[_0xde29('0x18')]['include']?_[_0xde29('0x1d')](_0x163ef5['options'][_0xde29('0x1c')],function(_0x5b28f8){return{'model':db[_0x5b28f8[_0xde29('0x1e')]],'as':_0x5b28f8['as'],'attributes':_0x5b28f8[_0xde29('0x1a')],'include':_0x5b28f8[_0xde29('0x1c')]?_['map'](_0x5b28f8[_0xde29('0x1c')],function(_0x48df05){return{'model':db[_0x48df05['model']],'as':_0x48df05['as'],'attributes':_0x48df05['attributes'],'include':_0x48df05[_0xde29('0x1c')]?_[_0xde29('0x1d')](_0x48df05['include'],function(_0x31335f){return{'model':db[_0x31335f[_0xde29('0x1e')]],'as':_0x31335f['as'],'attributes':_0x31335f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x13e4d4){logger[_0xde29('0xc')]('ShowZendeskAccount',_0x163ef5);logger['debug'](_0xde29('0x20'),_0x163ef5,JSON[_0xde29('0x10')](_0x13e4d4));_0x28bfd4(_0x13e4d4);})[_0xde29('0x14')](function(_0xbe7c4e){logger['error']('ShowZendeskAccount',_0xbe7c4e[_0xde29('0x13')],_0x163ef5);_0x142b2b(_0x58686d[_0xde29('0x11')](0x1f4,_0xbe7c4e[_0xde29('0x13')]));});});}; \ No newline at end of file +var _0x1169=['attributes','limit','include','map','model','catch','ShowZendeskAccount','ZendeskAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetZendeskAccount','findAll','raw','options','where'];(function(_0x4a2cc2,_0x1fbafa){var _0x3f5f5c=function(_0x1e2583){while(--_0x1e2583){_0x4a2cc2['push'](_0x4a2cc2['shift']());}};_0x3f5f5c(++_0x1fbafa);}(_0x1169,0x68));var _0x9116=function(_0x1255a9,_0x3ab5ab){_0x1255a9=_0x1255a9-0x0;var _0x4e8d61=_0x1169[_0x1255a9];return _0x4e8d61;};'use strict';var _=require(_0x9116('0x0'));var util=require(_0x9116('0x1'));var moment=require('moment');var BPromise=require(_0x9116('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9116('0x3'));var db=require(_0x9116('0x4'))['db'];var utils=require(_0x9116('0x5'));var logger=require('../../config/logger')(_0x9116('0x6'));var config=require(_0x9116('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9116('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xce8dec,_0xe0fe69,_0x1061f3){return new BPromise(function(_0x19e723,_0x42502f){return client['request'](_0xce8dec,_0x1061f3)[_0x9116('0x9')](function(_0x5d6484){logger[_0x9116('0xa')](_0x9116('0xb'),_0xe0fe69,'request\x20sent');logger[_0x9116('0xc')](_0x9116('0xd'),_0xe0fe69,_0x9116('0xe'),JSON[_0x9116('0xf')](_0x5d6484));if(_0x5d6484['error']){if(_0x5d6484[_0x9116('0x10')][_0x9116('0x11')]===0x1f4){logger[_0x9116('0x10')](_0x9116('0xb'),_0xe0fe69,_0x5d6484['error'][_0x9116('0x12')]);return _0x42502f(_0x5d6484[_0x9116('0x10')]['message']);}logger[_0x9116('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0xe0fe69,_0x5d6484[_0x9116('0x10')][_0x9116('0x12')]);return _0x19e723(_0x5d6484['error']['message']);}else{logger[_0x9116('0xa')](_0x9116('0xb'),_0xe0fe69,_0x9116('0xe'));_0x19e723(_0x5d6484['result'][_0x9116('0x12')]);}})['catch'](function(_0x339f76){logger['error'](_0x9116('0xb'),_0xe0fe69,_0x339f76);_0x42502f(_0x339f76);});});}exports[_0x9116('0x13')]=function(_0x9066ac){var _0x4917f9=this;return new Promise(function(_0x151c14,_0xa0fa58){return db['ZendeskAccount'][_0x9116('0x14')]({'raw':_0x9066ac['options']?_0x9066ac['options'][_0x9116('0x15')]===undefined?!![]:![]:!![],'where':_0x9066ac[_0x9116('0x16')]?_0x9066ac[_0x9116('0x16')][_0x9116('0x17')]||null:null,'attributes':_0x9066ac[_0x9116('0x16')]?_0x9066ac[_0x9116('0x16')][_0x9116('0x18')]||null:null,'limit':_0x9066ac[_0x9116('0x16')]?_0x9066ac[_0x9116('0x16')][_0x9116('0x19')]||null:null,'include':_0x9066ac['options']?_0x9066ac['options'][_0x9116('0x1a')]?_['map'](_0x9066ac['options'][_0x9116('0x1a')],function(_0xc13e7c){return{'model':db[_0xc13e7c['model']],'as':_0xc13e7c['as'],'attributes':_0xc13e7c[_0x9116('0x18')],'include':_0xc13e7c[_0x9116('0x1a')]?_[_0x9116('0x1b')](_0xc13e7c[_0x9116('0x1a')],function(_0x4c28fc){return{'model':db[_0x4c28fc[_0x9116('0x1c')]],'as':_0x4c28fc['as'],'attributes':_0x4c28fc[_0x9116('0x18')],'include':_0x4c28fc[_0x9116('0x1a')]?_[_0x9116('0x1b')](_0x4c28fc[_0x9116('0x1a')],function(_0x382ef4){return{'model':db[_0x382ef4[_0x9116('0x1c')]],'as':_0x382ef4['as'],'attributes':_0x382ef4[_0x9116('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46bc20){logger[_0x9116('0xa')](_0x9116('0x13'),_0x9066ac);logger['debug']('GetZendeskAccount',_0x9066ac,JSON['stringify'](_0x46bc20));_0x151c14(_0x46bc20);})[_0x9116('0x1d')](function(_0x257257){logger['error'](_0x9116('0x13'),_0x257257['message'],_0x9066ac);_0xa0fa58(_0x4917f9[_0x9116('0x10')](0x1f4,_0x257257['message']));});});};exports[_0x9116('0x1e')]=function(_0x1036c1){var _0xd94d2=this;return new Promise(function(_0xf3e514,_0x1f8640){return db[_0x9116('0x1f')]['find']({'raw':_0x1036c1[_0x9116('0x16')]?_0x1036c1[_0x9116('0x16')][_0x9116('0x15')]===undefined?!![]:![]:!![],'where':_0x1036c1['options']?_0x1036c1[_0x9116('0x16')]['where']||null:null,'attributes':_0x1036c1['options']?_0x1036c1[_0x9116('0x16')]['attributes']||null:null,'include':_0x1036c1[_0x9116('0x16')]?_0x1036c1[_0x9116('0x16')][_0x9116('0x1a')]?_[_0x9116('0x1b')](_0x1036c1[_0x9116('0x16')][_0x9116('0x1a')],function(_0x498eb2){return{'model':db[_0x498eb2[_0x9116('0x1c')]],'as':_0x498eb2['as'],'attributes':_0x498eb2[_0x9116('0x18')],'include':_0x498eb2[_0x9116('0x1a')]?_['map'](_0x498eb2[_0x9116('0x1a')],function(_0x9e39fc){return{'model':db[_0x9e39fc['model']],'as':_0x9e39fc['as'],'attributes':_0x9e39fc[_0x9116('0x18')],'include':_0x9e39fc[_0x9116('0x1a')]?_[_0x9116('0x1b')](_0x9e39fc[_0x9116('0x1a')],function(_0x1f2408){return{'model':db[_0x1f2408[_0x9116('0x1c')]],'as':_0x1f2408['as'],'attributes':_0x1f2408[_0x9116('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5345d3){logger[_0x9116('0xa')](_0x9116('0x1e'),_0x1036c1);logger[_0x9116('0xc')](_0x9116('0x1e'),_0x1036c1,JSON[_0x9116('0xf')](_0x5345d3));_0xf3e514(_0x5345d3);})[_0x9116('0x1d')](function(_0x42005e){logger[_0x9116('0x10')](_0x9116('0x1e'),_0x42005e[_0x9116('0x12')],_0x1036c1);_0x1f8640(_0xd94d2[_0x9116('0x10')](0x1f4,_0x42005e[_0x9116('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 0023823..ee6d9e6 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 _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file +var _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x0abf,0xe8));var _0xf0ab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0abf[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3b6d561..f88cf9b 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 _0x276f=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x276f,0x104));var _0xf276=function(_0xf86be9,_0x228f5f){_0xf86be9=_0xf86be9-0x0;var _0x39137e=_0x276f[_0xf86be9];return _0x39137e;};'use strict';var Sequelize=require(_0xf276('0x0'));module['exports']={'name':{'type':Sequelize[_0xf276('0x1')]},'description':{'type':Sequelize[_0xf276('0x1')]}}; \ No newline at end of file +var _0x23e7=['exports','STRING','sequelize'];(function(_0x9890d1,_0x19301d){var _0x36681c=function(_0x5298d4){while(--_0x5298d4){_0x9890d1['push'](_0x9890d1['shift']());}};_0x36681c(++_0x19301d);}(_0x23e7,0x137));var _0x723e=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x23e7[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0x723e('0x0'));module[_0x723e('0x1')]={'name':{'type':Sequelize[_0x723e('0x2')]},'description':{'type':Sequelize[_0x723e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b77e200..b2f4d23 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 _0xc8d0=['ids','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags'];(function(_0x2352d4,_0x14ef5a){var _0x300590=function(_0x4cd2d3){while(--_0x4cd2d3){_0x2352d4['push'](_0x2352d4['shift']());}};_0x300590(++_0x14ef5a);}(_0xc8d0,0xaf));var _0x0c8d=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0xc8d0[_0x57eb2d];return _0xd8e18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c8d('0x0'));var zipdir=require(_0x0c8d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0c8d('0x2'));var BPromise=require(_0x0c8d('0x3'));var Mustache=require('mustache');var util=require(_0x0c8d('0x4'));var path=require(_0x0c8d('0x5'));var sox=require(_0x0c8d('0x6'));var csv=require(_0x0c8d('0x7'));var ejs=require(_0x0c8d('0x8'));var fs=require('fs');var fs_extra=require(_0x0c8d('0x9'));var _=require(_0x0c8d('0xa'));var squel=require('squel');var crypto=require(_0x0c8d('0xb'));var jsforce=require(_0x0c8d('0xc'));var deskjs=require(_0x0c8d('0xd'));var toCsv=require(_0x0c8d('0x7'));var querystring=require(_0x0c8d('0xe'));var Papa=require(_0x0c8d('0xf'));var Redis=require(_0x0c8d('0x10'));var authService=require(_0x0c8d('0x11'));var qs=require(_0x0c8d('0x12'));var as=require(_0x0c8d('0x13'));var hardwareService=require(_0x0c8d('0x14'));var logger=require(_0x0c8d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0c8d('0x16'));var licenseUtil=require(_0x0c8d('0x17'));var db=require(_0x0c8d('0x18'))['db'];function respondWithStatusCode(_0x23ce15,_0x55cbbe){_0x55cbbe=_0x55cbbe||0xcc;return function(_0x558032){if(_0x558032){return _0x23ce15['sendStatus'](_0x55cbbe);}return _0x23ce15[_0x0c8d('0x19')](_0x55cbbe)[_0x0c8d('0x1a')]();};}function respondWithResult(_0x20e042,_0x300821){_0x300821=_0x300821||0xc8;return function(_0x1f859f){if(_0x1f859f){return _0x20e042[_0x0c8d('0x19')](_0x300821)[_0x0c8d('0x1b')](_0x1f859f);}};}function respondWithFilteredResult(_0x303f28,_0x50a1f6){return function(_0x529495){if(_0x529495){var _0x33c9fb=typeof _0x50a1f6[_0x0c8d('0x1c')]==='undefined'&&typeof _0x50a1f6[_0x0c8d('0x1d')]===_0x0c8d('0x1e');var _0x1ebfdc=_0x529495[_0x0c8d('0x1f')];var _0x2ce21c=_0x33c9fb?0x0:_0x50a1f6[_0x0c8d('0x1c')];var _0x33796a=_0x33c9fb?_0x529495[_0x0c8d('0x1f')]:_0x50a1f6[_0x0c8d('0x1c')]+_0x50a1f6[_0x0c8d('0x1d')];var _0x3614a2;if(_0x33796a>=_0x1ebfdc){_0x33796a=_0x1ebfdc;_0x3614a2=0xc8;}else{_0x3614a2=0xce;}_0x303f28['status'](_0x3614a2);return _0x303f28[_0x0c8d('0x20')](_0x0c8d('0x21'),_0x2ce21c+'-'+_0x33796a+'/'+_0x1ebfdc)[_0x0c8d('0x1b')](_0x529495);}return null;};}function patchUpdates(_0x52fb0d){return function(_0x30819b){try{jsonpatch[_0x0c8d('0x22')](_0x30819b,_0x52fb0d,!![]);}catch(_0x36dd9a){return BPromise[_0x0c8d('0x23')](_0x36dd9a);}return _0x30819b[_0x0c8d('0x24')]();};}function saveUpdates(_0x4f8afb,_0x3703ab){return function(_0x3514c0){if(_0x3514c0){return _0x3514c0[_0x0c8d('0x25')](_0x4f8afb)[_0x0c8d('0x26')](function(_0x3926c1){return _0x3926c1;});}return null;};}function removeEntity(_0x46ec86,_0x176903){return function(_0x58f4ab){if(_0x58f4ab){return _0x58f4ab[_0x0c8d('0x27')]()[_0x0c8d('0x26')](function(){_0x46ec86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e825c,_0x154670){return function(_0x1df975){if(!_0x1df975){_0x7e825c[_0x0c8d('0x28')](0x194);}return _0x1df975;};}function handleError(_0x2305a5,_0x5cf270){_0x5cf270=_0x5cf270||0x1f4;return function(_0x483056){logger[_0x0c8d('0x29')](_0x483056['stack']);if(_0x483056[_0x0c8d('0x2a')]){delete _0x483056[_0x0c8d('0x2a')];}_0x2305a5['status'](_0x5cf270)[_0x0c8d('0x2b')](_0x483056);};}exports['index']=function(_0x3074aa,_0x47e023){var _0x5ec4c0={},_0x51dc8b={},_0x2e59b9={'count':0x0,'rows':[]};var _0x5dc3a6=_[_0x0c8d('0x2c')](db[_0x0c8d('0x2d')][_0x0c8d('0x2e')],function(_0x55227b){return{'name':_0x55227b[_0x0c8d('0x2f')],'type':_0x55227b['type'][_0x0c8d('0x30')]};});_0x51dc8b[_0x0c8d('0x31')]=_['map'](_0x5dc3a6,'name');_0x51dc8b[_0x0c8d('0x32')]=_['keys'](_0x3074aa[_0x0c8d('0x32')]);_0x51dc8b[_0x0c8d('0x33')]=_[_0x0c8d('0x34')](_0x51dc8b[_0x0c8d('0x31')],_0x51dc8b[_0x0c8d('0x32')]);_0x5ec4c0[_0x0c8d('0x35')]=_[_0x0c8d('0x34')](_0x51dc8b['model'],qs[_0x0c8d('0x36')](_0x3074aa['query']['fields']));_0x5ec4c0[_0x0c8d('0x35')]=_0x5ec4c0[_0x0c8d('0x35')][_0x0c8d('0x37')]?_0x5ec4c0[_0x0c8d('0x35')]:_0x51dc8b[_0x0c8d('0x31')];if(!_0x3074aa[_0x0c8d('0x32')][_0x0c8d('0x38')]('nolimit')){_0x5ec4c0[_0x0c8d('0x1d')]=qs[_0x0c8d('0x1d')](_0x3074aa[_0x0c8d('0x32')][_0x0c8d('0x1d')]);_0x5ec4c0[_0x0c8d('0x1c')]=qs[_0x0c8d('0x1c')](_0x3074aa[_0x0c8d('0x32')]['offset']);}_0x5ec4c0[_0x0c8d('0x39')]=qs[_0x0c8d('0x3a')](_0x3074aa['query'][_0x0c8d('0x3a')]);_0x5ec4c0[_0x0c8d('0x3b')]=qs['filters'](_[_0x0c8d('0x3c')](_0x3074aa[_0x0c8d('0x32')],_0x51dc8b[_0x0c8d('0x33')]),_0x5dc3a6);if(_0x3074aa[_0x0c8d('0x32')][_0x0c8d('0x3d')]){_0x5ec4c0[_0x0c8d('0x3b')]=_[_0x0c8d('0x3e')](_0x5ec4c0[_0x0c8d('0x3b')],{'$or':_[_0x0c8d('0x2c')](_0x5dc3a6,function(_0x85df7b){if(_0x85df7b[_0x0c8d('0x3f')]!==_0x0c8d('0x40')){var _0x211323={};_0x211323[_0x85df7b['name']]={'$like':'%'+_0x3074aa[_0x0c8d('0x32')]['filter']+'%'};return _0x211323;}})});}_0x5ec4c0=_[_0x0c8d('0x3e')]({},_0x5ec4c0,_0x3074aa[_0x0c8d('0x41')]);var _0x34177b={'where':_0x5ec4c0['where']};return db[_0x0c8d('0x2d')]['count'](_0x34177b)['then'](function(_0x37e726){_0x2e59b9['count']=_0x37e726;if(_0x3074aa[_0x0c8d('0x32')][_0x0c8d('0x42')]){_0x5ec4c0[_0x0c8d('0x43')]=[{'all':!![]}];}return db[_0x0c8d('0x2d')][_0x0c8d('0x44')](_0x5ec4c0);})[_0x0c8d('0x26')](function(_0x23d400){_0x2e59b9[_0x0c8d('0x45')]=_0x23d400;return _0x2e59b9;})[_0x0c8d('0x26')](respondWithFilteredResult(_0x47e023,_0x5ec4c0))[_0x0c8d('0x46')](handleError(_0x47e023,null));};exports[_0x0c8d('0x47')]=function(_0x43be26,_0x107da6){var _0x15e8c4={'raw':![],'where':{'id':_0x43be26['params']['id']}},_0x5cefaa={};_0x5cefaa[_0x0c8d('0x31')]=_[_0x0c8d('0x48')](db['ZendeskConfiguration'][_0x0c8d('0x2e')]);_0x5cefaa['query']=_[_0x0c8d('0x48')](_0x43be26['query']);_0x5cefaa[_0x0c8d('0x33')]=_[_0x0c8d('0x34')](_0x5cefaa[_0x0c8d('0x31')],_0x5cefaa[_0x0c8d('0x32')]);_0x15e8c4[_0x0c8d('0x35')]=_[_0x0c8d('0x34')](_0x5cefaa['model'],qs[_0x0c8d('0x36')](_0x43be26[_0x0c8d('0x32')][_0x0c8d('0x36')]));_0x15e8c4[_0x0c8d('0x35')]=_0x15e8c4[_0x0c8d('0x35')][_0x0c8d('0x37')]?_0x15e8c4[_0x0c8d('0x35')]:_0x5cefaa[_0x0c8d('0x31')];if(_0x43be26[_0x0c8d('0x32')]['includeAll']){_0x15e8c4['include']=[{'all':!![]}];}_0x15e8c4=_['merge']({},_0x15e8c4,_0x43be26[_0x0c8d('0x41')]);return db[_0x0c8d('0x2d')][_0x0c8d('0x49')](_0x15e8c4)['then'](handleEntityNotFound(_0x107da6,null))[_0x0c8d('0x26')](respondWithResult(_0x107da6,null))['catch'](handleError(_0x107da6,null));};exports[_0x0c8d('0x4a')]=function(_0x3e934d,_0x196d1a){return db[_0x0c8d('0x2d')][_0x0c8d('0x4a')](_0x3e934d[_0x0c8d('0x4b')],{})[_0x0c8d('0x26')](respondWithResult(_0x196d1a,0xc9))[_0x0c8d('0x46')](handleError(_0x196d1a,null));};exports[_0x0c8d('0x25')]=function(_0x36a9f9,_0x196191){if(_0x36a9f9[_0x0c8d('0x4b')]['id']){delete _0x36a9f9[_0x0c8d('0x4b')]['id'];}return db[_0x0c8d('0x2d')]['find']({'where':{'id':_0x36a9f9[_0x0c8d('0x4c')]['id']}})[_0x0c8d('0x26')](handleEntityNotFound(_0x196191,null))[_0x0c8d('0x26')](saveUpdates(_0x36a9f9[_0x0c8d('0x4b')],null))[_0x0c8d('0x26')](respondWithResult(_0x196191,null))[_0x0c8d('0x46')](handleError(_0x196191,null));};exports['destroy']=function(_0x220b07,_0x1f9dd5){return db[_0x0c8d('0x2d')]['find']({'where':{'id':_0x220b07[_0x0c8d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f9dd5,null))[_0x0c8d('0x26')](removeEntity(_0x1f9dd5,null))[_0x0c8d('0x46')](handleError(_0x1f9dd5,null));};exports[_0x0c8d('0x4d')]=function(_0x3403eb,_0x39c81c,_0x40a255){var _0x2263a7={};var _0x4ae1de={};var _0x42183c;var _0x4e65e5;return db[_0x0c8d('0x2d')][_0x0c8d('0x4e')]({'where':{'id':_0x3403eb['params']['id']}})[_0x0c8d('0x26')](handleEntityNotFound(_0x39c81c,null))['then'](function(_0x18b999){if(_0x18b999){_0x42183c=_0x18b999;_0x4ae1de[_0x0c8d('0x31')]=_[_0x0c8d('0x48')](db[_0x0c8d('0x4f')][_0x0c8d('0x2e')]);_0x4ae1de['query']=_[_0x0c8d('0x48')](_0x3403eb[_0x0c8d('0x32')]);_0x4ae1de[_0x0c8d('0x33')]=_[_0x0c8d('0x34')](_0x4ae1de[_0x0c8d('0x31')],_0x4ae1de[_0x0c8d('0x32')]);_0x2263a7[_0x0c8d('0x35')]=_[_0x0c8d('0x34')](_0x4ae1de[_0x0c8d('0x31')],qs[_0x0c8d('0x36')](_0x3403eb['query']['fields']));_0x2263a7[_0x0c8d('0x35')]=_0x2263a7[_0x0c8d('0x35')][_0x0c8d('0x37')]?_0x2263a7['attributes']:_0x4ae1de[_0x0c8d('0x31')];_0x2263a7[_0x0c8d('0x39')]=qs[_0x0c8d('0x3a')](_0x3403eb[_0x0c8d('0x32')][_0x0c8d('0x3a')]);_0x2263a7['where']=qs['filters'](_[_0x0c8d('0x3c')](_0x3403eb['query'],_0x4ae1de[_0x0c8d('0x33')]));if(_0x3403eb[_0x0c8d('0x32')]['filter']){_0x2263a7[_0x0c8d('0x3b')]=_[_0x0c8d('0x3e')](_0x2263a7['where'],{'$or':_[_0x0c8d('0x2c')](_0x2263a7['attributes'],function(_0x519e47){var _0x1a17b9={};_0x1a17b9[_0x519e47]={'$like':'%'+_0x3403eb[_0x0c8d('0x32')][_0x0c8d('0x3d')]+'%'};return _0x1a17b9;})});}_0x2263a7=_[_0x0c8d('0x3e')]({},_0x2263a7,_0x3403eb[_0x0c8d('0x41')]);return _0x42183c[_0x0c8d('0x4d')](_0x2263a7);}})['then'](function(_0x228ddf){if(_0x228ddf){_0x4e65e5=_0x228ddf['length'];if(!_0x3403eb[_0x0c8d('0x32')][_0x0c8d('0x38')](_0x0c8d('0x50'))){_0x2263a7['limit']=qs['limit'](_0x3403eb[_0x0c8d('0x32')][_0x0c8d('0x1d')]);_0x2263a7[_0x0c8d('0x1c')]=qs[_0x0c8d('0x1c')](_0x3403eb['query'][_0x0c8d('0x1c')]);}return _0x42183c['getFields'](_0x2263a7);}})['then'](function(_0xfde13c){if(_0xfde13c){return _0xfde13c?{'count':_0x4e65e5,'rows':_0xfde13c}:null;}})[_0x0c8d('0x26')](respondWithResult(_0x39c81c,null))[_0x0c8d('0x46')](handleError(_0x39c81c,null));};exports[_0x0c8d('0x51')]=function(_0x559486,_0x4fde0d,_0x507427){var _0x27402={};var _0x152e61={};var _0x409fe5;var _0x49ca48;return db['ZendeskConfiguration'][_0x0c8d('0x4e')]({'where':{'id':_0x559486[_0x0c8d('0x4c')]['id']}})[_0x0c8d('0x26')](handleEntityNotFound(_0x4fde0d,null))[_0x0c8d('0x26')](function(_0x1cdfaa){if(_0x1cdfaa){_0x409fe5=_0x1cdfaa;_0x152e61[_0x0c8d('0x31')]=_[_0x0c8d('0x48')](db[_0x0c8d('0x4f')][_0x0c8d('0x2e')]);_0x152e61[_0x0c8d('0x32')]=_[_0x0c8d('0x48')](_0x559486['query']);_0x152e61[_0x0c8d('0x33')]=_[_0x0c8d('0x34')](_0x152e61[_0x0c8d('0x31')],_0x152e61[_0x0c8d('0x32')]);_0x27402[_0x0c8d('0x35')]=_[_0x0c8d('0x34')](_0x152e61[_0x0c8d('0x31')],qs[_0x0c8d('0x36')](_0x559486[_0x0c8d('0x32')][_0x0c8d('0x36')]));_0x27402['attributes']=_0x27402[_0x0c8d('0x35')]['length']?_0x27402['attributes']:_0x152e61[_0x0c8d('0x31')];_0x27402[_0x0c8d('0x39')]=qs[_0x0c8d('0x3a')](_0x559486[_0x0c8d('0x32')][_0x0c8d('0x3a')]);_0x27402[_0x0c8d('0x3b')]=qs[_0x0c8d('0x33')](_[_0x0c8d('0x3c')](_0x559486[_0x0c8d('0x32')],_0x152e61[_0x0c8d('0x33')]));if(_0x559486[_0x0c8d('0x32')][_0x0c8d('0x3d')]){_0x27402['where']=_[_0x0c8d('0x3e')](_0x27402[_0x0c8d('0x3b')],{'$or':_[_0x0c8d('0x2c')](_0x27402[_0x0c8d('0x35')],function(_0x3a0516){var _0x30a49b={};_0x30a49b[_0x3a0516]={'$like':'%'+_0x559486[_0x0c8d('0x32')][_0x0c8d('0x3d')]+'%'};return _0x30a49b;})});}_0x27402=_[_0x0c8d('0x3e')]({},_0x27402,_0x559486[_0x0c8d('0x41')]);return _0x409fe5[_0x0c8d('0x51')](_0x27402);}})[_0x0c8d('0x26')](function(_0x3ba20f){if(_0x3ba20f){_0x49ca48=_0x3ba20f[_0x0c8d('0x37')];if(!_0x559486['query'][_0x0c8d('0x38')]('nolimit')){_0x27402['limit']=qs[_0x0c8d('0x1d')](_0x559486[_0x0c8d('0x32')][_0x0c8d('0x1d')]);_0x27402['offset']=qs[_0x0c8d('0x1c')](_0x559486[_0x0c8d('0x32')]['offset']);}return _0x409fe5['getSubjects'](_0x27402);}})[_0x0c8d('0x26')](function(_0x4a3e4a){if(_0x4a3e4a){return _0x4a3e4a?{'count':_0x49ca48,'rows':_0x4a3e4a}:null;}})[_0x0c8d('0x26')](respondWithResult(_0x4fde0d,null))[_0x0c8d('0x46')](handleError(_0x4fde0d,null));};exports[_0x0c8d('0x52')]=function(_0x5875cb,_0x3c8bdf,_0x382086){var _0x58406b={};var _0x5dd91d={};var _0x3cc416;var _0x203e16;return db['ZendeskConfiguration'][_0x0c8d('0x4e')]({'where':{'id':_0x5875cb[_0x0c8d('0x4c')]['id']}})[_0x0c8d('0x26')](handleEntityNotFound(_0x3c8bdf,null))[_0x0c8d('0x26')](function(_0x281685){if(_0x281685){_0x3cc416=_0x281685;_0x5dd91d[_0x0c8d('0x31')]=_[_0x0c8d('0x48')](db['ZendeskField']['rawAttributes']);_0x5dd91d['query']=_[_0x0c8d('0x48')](_0x5875cb[_0x0c8d('0x32')]);_0x5dd91d['filters']=_[_0x0c8d('0x34')](_0x5dd91d['model'],_0x5dd91d[_0x0c8d('0x32')]);_0x58406b[_0x0c8d('0x35')]=_[_0x0c8d('0x34')](_0x5dd91d[_0x0c8d('0x31')],qs[_0x0c8d('0x36')](_0x5875cb[_0x0c8d('0x32')][_0x0c8d('0x36')]));_0x58406b[_0x0c8d('0x35')]=_0x58406b[_0x0c8d('0x35')][_0x0c8d('0x37')]?_0x58406b['attributes']:_0x5dd91d[_0x0c8d('0x31')];_0x58406b['order']=qs[_0x0c8d('0x3a')](_0x5875cb[_0x0c8d('0x32')][_0x0c8d('0x3a')]);_0x58406b[_0x0c8d('0x3b')]=qs[_0x0c8d('0x33')](_['pick'](_0x5875cb[_0x0c8d('0x32')],_0x5dd91d['filters']));if(_0x5875cb[_0x0c8d('0x32')][_0x0c8d('0x3d')]){_0x58406b[_0x0c8d('0x3b')]=_[_0x0c8d('0x3e')](_0x58406b[_0x0c8d('0x3b')],{'$or':_[_0x0c8d('0x2c')](_0x58406b[_0x0c8d('0x35')],function(_0xd324a1){var _0x3896ba={};_0x3896ba[_0xd324a1]={'$like':'%'+_0x5875cb[_0x0c8d('0x32')]['filter']+'%'};return _0x3896ba;})});}_0x58406b=_[_0x0c8d('0x3e')]({},_0x58406b,_0x5875cb[_0x0c8d('0x41')]);return _0x3cc416[_0x0c8d('0x52')](_0x58406b);}})[_0x0c8d('0x26')](function(_0x17fa2d){if(_0x17fa2d){_0x203e16=_0x17fa2d[_0x0c8d('0x37')];if(!_0x5875cb[_0x0c8d('0x32')][_0x0c8d('0x38')](_0x0c8d('0x50'))){_0x58406b['limit']=qs[_0x0c8d('0x1d')](_0x5875cb[_0x0c8d('0x32')][_0x0c8d('0x1d')]);_0x58406b[_0x0c8d('0x1c')]=qs[_0x0c8d('0x1c')](_0x5875cb['query'][_0x0c8d('0x1c')]);}return _0x3cc416[_0x0c8d('0x52')](_0x58406b);}})[_0x0c8d('0x26')](function(_0x48b9d0){if(_0x48b9d0){return _0x48b9d0?{'count':_0x203e16,'rows':_0x48b9d0}:null;}})[_0x0c8d('0x26')](respondWithResult(_0x3c8bdf,null))[_0x0c8d('0x46')](handleError(_0x3c8bdf,null));};exports[_0x0c8d('0x53')]=function(_0x7662ab,_0x6151f3,_0x55871c){var _0x273c49={};var _0x23b61c={};var _0x2f832e;var _0x3b1cb4;return db[_0x0c8d('0x2d')][_0x0c8d('0x4e')]({'where':{'id':_0x7662ab['params']['id']}})[_0x0c8d('0x26')](handleEntityNotFound(_0x6151f3,null))[_0x0c8d('0x26')](function(_0x3ba478){if(_0x3ba478){_0x2f832e=_0x3ba478;_0x23b61c['model']=_[_0x0c8d('0x48')](db[_0x0c8d('0x54')][_0x0c8d('0x2e')]);_0x23b61c[_0x0c8d('0x32')]=_['keys'](_0x7662ab['query']);_0x23b61c[_0x0c8d('0x33')]=_['intersection'](_0x23b61c[_0x0c8d('0x31')],_0x23b61c[_0x0c8d('0x32')]);_0x273c49[_0x0c8d('0x35')]=_[_0x0c8d('0x34')](_0x23b61c[_0x0c8d('0x31')],qs[_0x0c8d('0x36')](_0x7662ab[_0x0c8d('0x32')][_0x0c8d('0x36')]));_0x273c49[_0x0c8d('0x35')]=_0x273c49[_0x0c8d('0x35')][_0x0c8d('0x37')]?_0x273c49['attributes']:_0x23b61c[_0x0c8d('0x31')];_0x273c49[_0x0c8d('0x39')]=qs[_0x0c8d('0x3a')](_0x7662ab[_0x0c8d('0x32')][_0x0c8d('0x3a')]);_0x273c49['where']=qs[_0x0c8d('0x33')](_[_0x0c8d('0x3c')](_0x7662ab['query'],_0x23b61c[_0x0c8d('0x33')]));if(_0x7662ab[_0x0c8d('0x32')][_0x0c8d('0x3d')]){_0x273c49[_0x0c8d('0x3b')]=_['merge'](_0x273c49['where'],{'$or':_['map'](_0x273c49[_0x0c8d('0x35')],function(_0x50c603){var _0x56c67d={};_0x56c67d[_0x50c603]={'$like':'%'+_0x7662ab[_0x0c8d('0x32')][_0x0c8d('0x3d')]+'%'};return _0x56c67d;})});}_0x273c49=_[_0x0c8d('0x3e')]({},_0x273c49,_0x7662ab[_0x0c8d('0x41')]);return _0x2f832e[_0x0c8d('0x53')](_0x273c49);}})[_0x0c8d('0x26')](function(_0x1eed15){if(_0x1eed15){_0x3b1cb4=_0x1eed15[_0x0c8d('0x37')];if(!_0x7662ab[_0x0c8d('0x32')][_0x0c8d('0x38')](_0x0c8d('0x50'))){_0x273c49[_0x0c8d('0x1d')]=qs[_0x0c8d('0x1d')](_0x7662ab[_0x0c8d('0x32')][_0x0c8d('0x1d')]);_0x273c49['offset']=qs['offset'](_0x7662ab[_0x0c8d('0x32')][_0x0c8d('0x1c')]);}return _0x2f832e[_0x0c8d('0x53')](_0x273c49);}})[_0x0c8d('0x26')](function(_0x4ac2fa){if(_0x4ac2fa){return _0x4ac2fa?{'count':_0x3b1cb4,'rows':_0x4ac2fa}:null;}})[_0x0c8d('0x26')](respondWithResult(_0x6151f3,null))[_0x0c8d('0x46')](handleError(_0x6151f3,null));};exports[_0x0c8d('0x55')]=function(_0x15f124,_0x165355,_0x5f0741){if(_0x15f124['body']['id']){delete _0x15f124[_0x0c8d('0x4b')]['id'];}return db[_0x0c8d('0x2d')][_0x0c8d('0x4e')]({'where':{'id':_0x15f124[_0x0c8d('0x4c')]['id']}})[_0x0c8d('0x26')](handleEntityNotFound(_0x165355,null))[_0x0c8d('0x26')](function(_0x589300){if(_0x589300){return _0x589300[_0x0c8d('0x55')](_0x15f124[_0x0c8d('0x4b')][_0x0c8d('0x56')]||[]);}return null;})[_0x0c8d('0x26')](respondWithResult(_0x165355,null))['catch'](handleError(_0x165355,null));}; \ No newline at end of file +var _0x5435=['fs-extra','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','undefined','limit','count','offset','status','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','ZendeskConfiguration','include','findAll','rows','params','merge','find','catch','create','body','getFields','ZendeskField','findOne','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x19cc0f,_0xc5c6a9){var _0x468a03=function(_0x1699e1){while(--_0x1699e1){_0x19cc0f['push'](_0x19cc0f['shift']());}};_0x468a03(++_0xc5c6a9);}(_0x5435,0x17b));var _0x5543=function(_0xf0a1de,_0x456175){_0xf0a1de=_0xf0a1de-0x0;var _0x3ea83b=_0x5435[_0xf0a1de];return _0x3ea83b;};'use strict';var emlformat=require(_0x5543('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5543('0x1'));var jsonpatch=require(_0x5543('0x2'));var rp=require(_0x5543('0x3'));var moment=require(_0x5543('0x4'));var BPromise=require(_0x5543('0x5'));var Mustache=require(_0x5543('0x6'));var util=require(_0x5543('0x7'));var path=require(_0x5543('0x8'));var sox=require('sox');var csv=require(_0x5543('0x9'));var ejs=require(_0x5543('0xa'));var fs=require('fs');var fs_extra=require(_0x5543('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5543('0x9'));var querystring=require(_0x5543('0xc'));var Papa=require(_0x5543('0xd'));var Redis=require(_0x5543('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5543('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5543('0x10'));var logger=require(_0x5543('0x11'))(_0x5543('0x12'));var utils=require(_0x5543('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5543('0x14'))['db'];function respondWithStatusCode(_0x1078a3,_0x4a6ad6){_0x4a6ad6=_0x4a6ad6||0xcc;return function(_0x34443a){if(_0x34443a){return _0x1078a3['sendStatus'](_0x4a6ad6);}return _0x1078a3['status'](_0x4a6ad6)[_0x5543('0x15')]();};}function respondWithResult(_0x9fef47,_0x474574){_0x474574=_0x474574||0xc8;return function(_0x1cb41f){if(_0x1cb41f){return _0x9fef47['status'](_0x474574)[_0x5543('0x16')](_0x1cb41f);}};}function respondWithFilteredResult(_0x1d5dbb,_0x5a088b){return function(_0x6f7881){if(_0x6f7881){var _0x9835ad=typeof _0x5a088b['offset']===_0x5543('0x17')&&typeof _0x5a088b[_0x5543('0x18')]===_0x5543('0x17');var _0x298504=_0x6f7881[_0x5543('0x19')];var _0x349bac=_0x9835ad?0x0:_0x5a088b[_0x5543('0x1a')];var _0x29e5f5=_0x9835ad?_0x6f7881[_0x5543('0x19')]:_0x5a088b['offset']+_0x5a088b[_0x5543('0x18')];var _0x4083f7;if(_0x29e5f5>=_0x298504){_0x29e5f5=_0x298504;_0x4083f7=0xc8;}else{_0x4083f7=0xce;}_0x1d5dbb[_0x5543('0x1b')](_0x4083f7);return _0x1d5dbb['set'](_0x5543('0x1c'),_0x349bac+'-'+_0x29e5f5+'/'+_0x298504)[_0x5543('0x16')](_0x6f7881);}return null;};}function patchUpdates(_0x21d51e){return function(_0x2bf2c3){try{jsonpatch[_0x5543('0x1d')](_0x2bf2c3,_0x21d51e,!![]);}catch(_0x5cdf06){return BPromise['reject'](_0x5cdf06);}return _0x2bf2c3['save']();};}function saveUpdates(_0x42d996,_0x5cd1c7){return function(_0xfdbc23){if(_0xfdbc23){return _0xfdbc23[_0x5543('0x1e')](_0x42d996)[_0x5543('0x1f')](function(_0x3b4678){return _0x3b4678;});}return null;};}function removeEntity(_0x579cd4,_0x147f75){return function(_0x577179){if(_0x577179){return _0x577179[_0x5543('0x20')]()['then'](function(){_0x579cd4['status'](0xcc)[_0x5543('0x15')]();});}};}function handleEntityNotFound(_0x19550f,_0x2c8d1e){return function(_0x4e6f5d){if(!_0x4e6f5d){_0x19550f[_0x5543('0x21')](0x194);}return _0x4e6f5d;};}function handleError(_0x56fb81,_0x3ffe07){_0x3ffe07=_0x3ffe07||0x1f4;return function(_0x16cbf5){logger[_0x5543('0x22')](_0x16cbf5[_0x5543('0x23')]);if(_0x16cbf5['name']){delete _0x16cbf5[_0x5543('0x24')];}_0x56fb81[_0x5543('0x1b')](_0x3ffe07)[_0x5543('0x25')](_0x16cbf5);};}exports[_0x5543('0x26')]=function(_0x33be49,_0x25ea97){var _0x5ecc95={},_0x2c96d3={},_0x1e1017={'count':0x0,'rows':[]};var _0x121623=_['map'](db['ZendeskConfiguration'][_0x5543('0x27')],function(_0x1f58eb){return{'name':_0x1f58eb['fieldName'],'type':_0x1f58eb[_0x5543('0x28')]['key']};});_0x2c96d3[_0x5543('0x29')]=_[_0x5543('0x2a')](_0x121623,_0x5543('0x24'));_0x2c96d3[_0x5543('0x2b')]=_[_0x5543('0x2c')](_0x33be49[_0x5543('0x2b')]);_0x2c96d3[_0x5543('0x2d')]=_[_0x5543('0x2e')](_0x2c96d3[_0x5543('0x29')],_0x2c96d3[_0x5543('0x2b')]);_0x5ecc95[_0x5543('0x2f')]=_[_0x5543('0x2e')](_0x2c96d3[_0x5543('0x29')],qs['fields'](_0x33be49[_0x5543('0x2b')][_0x5543('0x30')]));_0x5ecc95[_0x5543('0x2f')]=_0x5ecc95[_0x5543('0x2f')][_0x5543('0x31')]?_0x5ecc95[_0x5543('0x2f')]:_0x2c96d3['model'];if(!_0x33be49[_0x5543('0x2b')][_0x5543('0x32')](_0x5543('0x33'))){_0x5ecc95[_0x5543('0x18')]=qs[_0x5543('0x18')](_0x33be49[_0x5543('0x2b')][_0x5543('0x18')]);_0x5ecc95['offset']=qs[_0x5543('0x1a')](_0x33be49[_0x5543('0x2b')][_0x5543('0x1a')]);}_0x5ecc95['order']=qs['sort'](_0x33be49[_0x5543('0x2b')][_0x5543('0x34')]);_0x5ecc95[_0x5543('0x35')]=qs[_0x5543('0x2d')](_[_0x5543('0x36')](_0x33be49['query'],_0x2c96d3[_0x5543('0x2d')]),_0x121623);if(_0x33be49['query']['filter']){_0x5ecc95[_0x5543('0x35')]=_['merge'](_0x5ecc95['where'],{'$or':_[_0x5543('0x2a')](_0x121623,function(_0x4ee0ef){if(_0x4ee0ef['type']!==_0x5543('0x37')){var _0x318e29={};_0x318e29[_0x4ee0ef[_0x5543('0x24')]]={'$like':'%'+_0x33be49['query'][_0x5543('0x38')]+'%'};return _0x318e29;}})});}_0x5ecc95=_['merge']({},_0x5ecc95,_0x33be49[_0x5543('0x39')]);var _0x3907a1={'where':_0x5ecc95[_0x5543('0x35')]};return db[_0x5543('0x3a')][_0x5543('0x19')](_0x3907a1)[_0x5543('0x1f')](function(_0x472d27){_0x1e1017[_0x5543('0x19')]=_0x472d27;if(_0x33be49[_0x5543('0x2b')]['includeAll']){_0x5ecc95[_0x5543('0x3b')]=[{'all':!![]}];}return db[_0x5543('0x3a')][_0x5543('0x3c')](_0x5ecc95);})[_0x5543('0x1f')](function(_0x6ca042){_0x1e1017[_0x5543('0x3d')]=_0x6ca042;return _0x1e1017;})['then'](respondWithFilteredResult(_0x25ea97,_0x5ecc95))['catch'](handleError(_0x25ea97,null));};exports['show']=function(_0xeb6144,_0x94e5ac){var _0x53521f={'raw':![],'where':{'id':_0xeb6144[_0x5543('0x3e')]['id']}},_0x158d10={};_0x158d10[_0x5543('0x29')]=_[_0x5543('0x2c')](db[_0x5543('0x3a')][_0x5543('0x27')]);_0x158d10[_0x5543('0x2b')]=_[_0x5543('0x2c')](_0xeb6144[_0x5543('0x2b')]);_0x158d10[_0x5543('0x2d')]=_[_0x5543('0x2e')](_0x158d10['model'],_0x158d10[_0x5543('0x2b')]);_0x53521f[_0x5543('0x2f')]=_[_0x5543('0x2e')](_0x158d10[_0x5543('0x29')],qs[_0x5543('0x30')](_0xeb6144['query'][_0x5543('0x30')]));_0x53521f[_0x5543('0x2f')]=_0x53521f[_0x5543('0x2f')]['length']?_0x53521f['attributes']:_0x158d10['model'];if(_0xeb6144['query']['includeAll']){_0x53521f['include']=[{'all':!![]}];}_0x53521f=_[_0x5543('0x3f')]({},_0x53521f,_0xeb6144[_0x5543('0x39')]);return db[_0x5543('0x3a')][_0x5543('0x40')](_0x53521f)[_0x5543('0x1f')](handleEntityNotFound(_0x94e5ac,null))[_0x5543('0x1f')](respondWithResult(_0x94e5ac,null))[_0x5543('0x41')](handleError(_0x94e5ac,null));};exports[_0x5543('0x42')]=function(_0xc41375,_0x1066ce){return db[_0x5543('0x3a')]['create'](_0xc41375[_0x5543('0x43')],{})[_0x5543('0x1f')](respondWithResult(_0x1066ce,0xc9))[_0x5543('0x41')](handleError(_0x1066ce,null));};exports[_0x5543('0x1e')]=function(_0x5e5518,_0x203498){if(_0x5e5518['body']['id']){delete _0x5e5518[_0x5543('0x43')]['id'];}return db[_0x5543('0x3a')]['find']({'where':{'id':_0x5e5518[_0x5543('0x3e')]['id']}})['then'](handleEntityNotFound(_0x203498,null))['then'](saveUpdates(_0x5e5518['body'],null))[_0x5543('0x1f')](respondWithResult(_0x203498,null))[_0x5543('0x41')](handleError(_0x203498,null));};exports[_0x5543('0x20')]=function(_0x4ea4ff,_0x5810df){return db[_0x5543('0x3a')][_0x5543('0x40')]({'where':{'id':_0x4ea4ff['params']['id']}})[_0x5543('0x1f')](handleEntityNotFound(_0x5810df,null))['then'](removeEntity(_0x5810df,null))['catch'](handleError(_0x5810df,null));};exports[_0x5543('0x44')]=function(_0x3cbe90,_0x93b998,_0x32909b){var _0x4b8e49={};var _0x2c8573={};var _0x1c965f;var _0x25ce87;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3cbe90['params']['id']}})['then'](handleEntityNotFound(_0x93b998,null))[_0x5543('0x1f')](function(_0xb4e5d){if(_0xb4e5d){_0x1c965f=_0xb4e5d;_0x2c8573[_0x5543('0x29')]=_['keys'](db[_0x5543('0x45')][_0x5543('0x27')]);_0x2c8573[_0x5543('0x2b')]=_[_0x5543('0x2c')](_0x3cbe90['query']);_0x2c8573[_0x5543('0x2d')]=_['intersection'](_0x2c8573[_0x5543('0x29')],_0x2c8573[_0x5543('0x2b')]);_0x4b8e49[_0x5543('0x2f')]=_['intersection'](_0x2c8573[_0x5543('0x29')],qs[_0x5543('0x30')](_0x3cbe90['query']['fields']));_0x4b8e49['attributes']=_0x4b8e49[_0x5543('0x2f')][_0x5543('0x31')]?_0x4b8e49[_0x5543('0x2f')]:_0x2c8573[_0x5543('0x29')];_0x4b8e49['order']=qs[_0x5543('0x34')](_0x3cbe90['query'][_0x5543('0x34')]);_0x4b8e49[_0x5543('0x35')]=qs['filters'](_[_0x5543('0x36')](_0x3cbe90[_0x5543('0x2b')],_0x2c8573[_0x5543('0x2d')]));if(_0x3cbe90[_0x5543('0x2b')]['filter']){_0x4b8e49[_0x5543('0x35')]=_['merge'](_0x4b8e49[_0x5543('0x35')],{'$or':_[_0x5543('0x2a')](_0x4b8e49['attributes'],function(_0xe002b9){var _0x19a19f={};_0x19a19f[_0xe002b9]={'$like':'%'+_0x3cbe90['query'][_0x5543('0x38')]+'%'};return _0x19a19f;})});}_0x4b8e49=_['merge']({},_0x4b8e49,_0x3cbe90[_0x5543('0x39')]);return _0x1c965f[_0x5543('0x44')](_0x4b8e49);}})['then'](function(_0x5750e6){if(_0x5750e6){_0x25ce87=_0x5750e6[_0x5543('0x31')];if(!_0x3cbe90[_0x5543('0x2b')][_0x5543('0x32')](_0x5543('0x33'))){_0x4b8e49[_0x5543('0x18')]=qs[_0x5543('0x18')](_0x3cbe90[_0x5543('0x2b')][_0x5543('0x18')]);_0x4b8e49[_0x5543('0x1a')]=qs[_0x5543('0x1a')](_0x3cbe90[_0x5543('0x2b')]['offset']);}return _0x1c965f['getFields'](_0x4b8e49);}})[_0x5543('0x1f')](function(_0x12a586){if(_0x12a586){return _0x12a586?{'count':_0x25ce87,'rows':_0x12a586}:null;}})[_0x5543('0x1f')](respondWithResult(_0x93b998,null))[_0x5543('0x41')](handleError(_0x93b998,null));};exports['getSubjects']=function(_0xc77a2a,_0x3a2a16,_0x5bbcc3){var _0x104a96={};var _0xa0d7e={};var _0x52c73e;var _0x16da4f;return db[_0x5543('0x3a')][_0x5543('0x46')]({'where':{'id':_0xc77a2a[_0x5543('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3a2a16,null))[_0x5543('0x1f')](function(_0x555191){if(_0x555191){_0x52c73e=_0x555191;_0xa0d7e[_0x5543('0x29')]=_[_0x5543('0x2c')](db['ZendeskField']['rawAttributes']);_0xa0d7e[_0x5543('0x2b')]=_['keys'](_0xc77a2a['query']);_0xa0d7e[_0x5543('0x2d')]=_['intersection'](_0xa0d7e[_0x5543('0x29')],_0xa0d7e[_0x5543('0x2b')]);_0x104a96[_0x5543('0x2f')]=_[_0x5543('0x2e')](_0xa0d7e['model'],qs['fields'](_0xc77a2a[_0x5543('0x2b')]['fields']));_0x104a96[_0x5543('0x2f')]=_0x104a96[_0x5543('0x2f')][_0x5543('0x31')]?_0x104a96[_0x5543('0x2f')]:_0xa0d7e[_0x5543('0x29')];_0x104a96[_0x5543('0x47')]=qs[_0x5543('0x34')](_0xc77a2a[_0x5543('0x2b')]['sort']);_0x104a96[_0x5543('0x35')]=qs[_0x5543('0x2d')](_['pick'](_0xc77a2a[_0x5543('0x2b')],_0xa0d7e[_0x5543('0x2d')]));if(_0xc77a2a['query']['filter']){_0x104a96['where']=_['merge'](_0x104a96['where'],{'$or':_[_0x5543('0x2a')](_0x104a96[_0x5543('0x2f')],function(_0x5a1197){var _0x2eec00={};_0x2eec00[_0x5a1197]={'$like':'%'+_0xc77a2a[_0x5543('0x2b')][_0x5543('0x38')]+'%'};return _0x2eec00;})});}_0x104a96=_[_0x5543('0x3f')]({},_0x104a96,_0xc77a2a['options']);return _0x52c73e[_0x5543('0x48')](_0x104a96);}})['then'](function(_0x258c5c){if(_0x258c5c){_0x16da4f=_0x258c5c[_0x5543('0x31')];if(!_0xc77a2a['query'][_0x5543('0x32')]('nolimit')){_0x104a96[_0x5543('0x18')]=qs['limit'](_0xc77a2a[_0x5543('0x2b')][_0x5543('0x18')]);_0x104a96[_0x5543('0x1a')]=qs[_0x5543('0x1a')](_0xc77a2a[_0x5543('0x2b')][_0x5543('0x1a')]);}return _0x52c73e[_0x5543('0x48')](_0x104a96);}})[_0x5543('0x1f')](function(_0x2b68e4){if(_0x2b68e4){return _0x2b68e4?{'count':_0x16da4f,'rows':_0x2b68e4}:null;}})[_0x5543('0x1f')](respondWithResult(_0x3a2a16,null))[_0x5543('0x41')](handleError(_0x3a2a16,null));};exports[_0x5543('0x49')]=function(_0xb14bc5,_0x15afc8,_0x26c4fa){var _0x524d02={};var _0x2e0740={};var _0x20f359;var _0x4f4dd1;return db['ZendeskConfiguration'][_0x5543('0x46')]({'where':{'id':_0xb14bc5[_0x5543('0x3e')]['id']}})[_0x5543('0x1f')](handleEntityNotFound(_0x15afc8,null))[_0x5543('0x1f')](function(_0xc59e62){if(_0xc59e62){_0x20f359=_0xc59e62;_0x2e0740['model']=_[_0x5543('0x2c')](db['ZendeskField']['rawAttributes']);_0x2e0740[_0x5543('0x2b')]=_[_0x5543('0x2c')](_0xb14bc5['query']);_0x2e0740[_0x5543('0x2d')]=_[_0x5543('0x2e')](_0x2e0740[_0x5543('0x29')],_0x2e0740['query']);_0x524d02['attributes']=_[_0x5543('0x2e')](_0x2e0740[_0x5543('0x29')],qs[_0x5543('0x30')](_0xb14bc5[_0x5543('0x2b')][_0x5543('0x30')]));_0x524d02[_0x5543('0x2f')]=_0x524d02[_0x5543('0x2f')][_0x5543('0x31')]?_0x524d02[_0x5543('0x2f')]:_0x2e0740['model'];_0x524d02[_0x5543('0x47')]=qs[_0x5543('0x34')](_0xb14bc5[_0x5543('0x2b')][_0x5543('0x34')]);_0x524d02['where']=qs['filters'](_[_0x5543('0x36')](_0xb14bc5[_0x5543('0x2b')],_0x2e0740[_0x5543('0x2d')]));if(_0xb14bc5[_0x5543('0x2b')][_0x5543('0x38')]){_0x524d02[_0x5543('0x35')]=_[_0x5543('0x3f')](_0x524d02[_0x5543('0x35')],{'$or':_[_0x5543('0x2a')](_0x524d02[_0x5543('0x2f')],function(_0x480bb7){var _0x5adbc6={};_0x5adbc6[_0x480bb7]={'$like':'%'+_0xb14bc5[_0x5543('0x2b')]['filter']+'%'};return _0x5adbc6;})});}_0x524d02=_[_0x5543('0x3f')]({},_0x524d02,_0xb14bc5['options']);return _0x20f359[_0x5543('0x49')](_0x524d02);}})[_0x5543('0x1f')](function(_0x304b18){if(_0x304b18){_0x4f4dd1=_0x304b18[_0x5543('0x31')];if(!_0xb14bc5[_0x5543('0x2b')]['hasOwnProperty'](_0x5543('0x33'))){_0x524d02[_0x5543('0x18')]=qs[_0x5543('0x18')](_0xb14bc5['query'][_0x5543('0x18')]);_0x524d02['offset']=qs[_0x5543('0x1a')](_0xb14bc5[_0x5543('0x2b')]['offset']);}return _0x20f359[_0x5543('0x49')](_0x524d02);}})['then'](function(_0x32ffd8){if(_0x32ffd8){return _0x32ffd8?{'count':_0x4f4dd1,'rows':_0x32ffd8}:null;}})['then'](respondWithResult(_0x15afc8,null))[_0x5543('0x41')](handleError(_0x15afc8,null));};exports[_0x5543('0x4a')]=function(_0x51ba37,_0x276a74,_0x26d10a){var _0x554123={};var _0x37679c={};var _0x476102;var _0x92a45f;return db['ZendeskConfiguration'][_0x5543('0x46')]({'where':{'id':_0x51ba37[_0x5543('0x3e')]['id']}})['then'](handleEntityNotFound(_0x276a74,null))[_0x5543('0x1f')](function(_0x3eb38a){if(_0x3eb38a){_0x476102=_0x3eb38a;_0x37679c[_0x5543('0x29')]=_[_0x5543('0x2c')](db[_0x5543('0x4b')][_0x5543('0x27')]);_0x37679c['query']=_[_0x5543('0x2c')](_0x51ba37['query']);_0x37679c[_0x5543('0x2d')]=_['intersection'](_0x37679c['model'],_0x37679c[_0x5543('0x2b')]);_0x554123[_0x5543('0x2f')]=_[_0x5543('0x2e')](_0x37679c['model'],qs[_0x5543('0x30')](_0x51ba37[_0x5543('0x2b')][_0x5543('0x30')]));_0x554123[_0x5543('0x2f')]=_0x554123['attributes'][_0x5543('0x31')]?_0x554123[_0x5543('0x2f')]:_0x37679c[_0x5543('0x29')];_0x554123[_0x5543('0x47')]=qs['sort'](_0x51ba37[_0x5543('0x2b')]['sort']);_0x554123['where']=qs[_0x5543('0x2d')](_[_0x5543('0x36')](_0x51ba37[_0x5543('0x2b')],_0x37679c[_0x5543('0x2d')]));if(_0x51ba37['query']['filter']){_0x554123[_0x5543('0x35')]=_['merge'](_0x554123[_0x5543('0x35')],{'$or':_[_0x5543('0x2a')](_0x554123[_0x5543('0x2f')],function(_0x3a5a14){var _0x636ad1={};_0x636ad1[_0x3a5a14]={'$like':'%'+_0x51ba37[_0x5543('0x2b')][_0x5543('0x38')]+'%'};return _0x636ad1;})});}_0x554123=_['merge']({},_0x554123,_0x51ba37[_0x5543('0x39')]);return _0x476102[_0x5543('0x4a')](_0x554123);}})[_0x5543('0x1f')](function(_0x2ef420){if(_0x2ef420){_0x92a45f=_0x2ef420[_0x5543('0x31')];if(!_0x51ba37[_0x5543('0x2b')]['hasOwnProperty'](_0x5543('0x33'))){_0x554123[_0x5543('0x18')]=qs[_0x5543('0x18')](_0x51ba37['query']['limit']);_0x554123['offset']=qs[_0x5543('0x1a')](_0x51ba37[_0x5543('0x2b')]['offset']);}return _0x476102[_0x5543('0x4a')](_0x554123);}})['then'](function(_0xcdd973){if(_0xcdd973){return _0xcdd973?{'count':_0x92a45f,'rows':_0xcdd973}:null;}})[_0x5543('0x1f')](respondWithResult(_0x276a74,null))[_0x5543('0x41')](handleError(_0x276a74,null));};exports[_0x5543('0x4c')]=function(_0x5b2996,_0x2cd56a,_0xeac986){if(_0x5b2996[_0x5543('0x43')]['id']){delete _0x5b2996[_0x5543('0x43')]['id'];}return db[_0x5543('0x3a')]['findOne']({'where':{'id':_0x5b2996[_0x5543('0x3e')]['id']}})[_0x5543('0x1f')](handleEntityNotFound(_0x2cd56a,null))[_0x5543('0x1f')](function(_0x478531){if(_0x478531){return _0x478531[_0x5543('0x4c')](_0x5b2996['body'][_0x5543('0x4d')]||[]);}return null;})[_0x5543('0x1f')](respondWithResult(_0x2cd56a,null))[_0x5543('0x41')](handleError(_0x2cd56a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5458bc7..0eed41f 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 _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x53adb5,_0xbc1ed){var _0x2b24ea=function(_0x4d3dcf){while(--_0x4d3dcf){_0x53adb5['push'](_0x53adb5['shift']());}};_0x2b24ea(++_0xbc1ed);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2bb9b3,_0x1d2c25){_0x2bb9b3=_0x2bb9b3-0x0;var _0x601b6=_0x5eb8[_0x2bb9b3];return _0x601b6;};'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 +var _0xef0f=['moment','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x2945bf,_0x4b9ab4){var _0x1c78bb=function(_0xff0f4){while(--_0xff0f4){_0x2945bf['push'](_0x2945bf['shift']());}};_0x1c78bb(++_0x4b9ab4);}(_0xef0f,0x168));var _0xfef0=function(_0x4251c9,_0x4051f3){_0x4251c9=_0x4251c9-0x0;var _0x4f5c6e=_0xef0f[_0x4251c9];return _0x4f5c6e;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d37cd7a..448c45f 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 _0xea36=['info','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3a4d40,_0x3d08d8){var _0x4283d8=function(_0x47eb33){while(--_0x47eb33){_0x3a4d40['push'](_0x3a4d40['shift']());}};_0x4283d8(++_0x3d08d8);}(_0xea36,0x120));var _0x6ea3=function(_0x5a6a59,_0x3b7ce0){_0x5a6a59=_0x5a6a59-0x0;var _0x1b4ce2=_0xea36[_0x5a6a59];return _0x1b4ce2;};'use strict';var _=require('lodash');var util=require(_0x6ea3('0x0'));var moment=require(_0x6ea3('0x1'));var BPromise=require(_0x6ea3('0x2'));var rs=require(_0x6ea3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ea3('0x4'))(_0x6ea3('0x5'));var config=require(_0x6ea3('0x6'));var jayson=require(_0x6ea3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1545d3,_0x1d223b,_0x4cbe82){return new BPromise(function(_0x38db2d,_0x546d69){return client[_0x6ea3('0x8')](_0x1545d3,_0x4cbe82)['then'](function(_0x1e1911){logger['info'](_0x6ea3('0x9'),_0x1d223b,_0x6ea3('0xa'));logger[_0x6ea3('0xb')](_0x6ea3('0xc'),_0x1d223b,_0x6ea3('0xa'),JSON[_0x6ea3('0xd')](_0x1e1911));if(_0x1e1911[_0x6ea3('0xe')]){if(_0x1e1911[_0x6ea3('0xe')]['code']===0x1f4){logger[_0x6ea3('0xe')](_0x6ea3('0x9'),_0x1d223b,_0x1e1911[_0x6ea3('0xe')][_0x6ea3('0xf')]);return _0x546d69(_0x1e1911[_0x6ea3('0xe')][_0x6ea3('0xf')]);}logger['error'](_0x6ea3('0x9'),_0x1d223b,_0x1e1911[_0x6ea3('0xe')][_0x6ea3('0xf')]);return _0x38db2d(_0x1e1911[_0x6ea3('0xe')][_0x6ea3('0xf')]);}else{logger[_0x6ea3('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d223b,_0x6ea3('0xa'));_0x38db2d(_0x1e1911[_0x6ea3('0x11')][_0x6ea3('0xf')]);}})[_0x6ea3('0x12')](function(_0x267856){logger[_0x6ea3('0xe')](_0x6ea3('0x9'),_0x1d223b,_0x267856);_0x546d69(_0x267856);});});} \ No newline at end of file +var _0x7737=['info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3b5aee,_0x15f6e0){var _0x571d3f=function(_0x33fa70){while(--_0x33fa70){_0x3b5aee['push'](_0x3b5aee['shift']());}};_0x571d3f(++_0x15f6e0);}(_0x7737,0x167));var _0x7773=function(_0x44c742,_0x5d69a4){_0x44c742=_0x44c742-0x0;var _0x40fcf0=_0x7737[_0x44c742];return _0x40fcf0;};'use strict';var _=require('lodash');var util=require(_0x7773('0x0'));var moment=require(_0x7773('0x1'));var BPromise=require(_0x7773('0x2'));var rs=require(_0x7773('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7773('0x4'))['db'];var utils=require(_0x7773('0x5'));var logger=require(_0x7773('0x6'))(_0x7773('0x7'));var config=require(_0x7773('0x8'));var jayson=require(_0x7773('0x9'));var client=jayson[_0x7773('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b6317,_0x578bf0,_0x84cc00){return new BPromise(function(_0x4c895f,_0x1f8a23){return client['request'](_0x2b6317,_0x84cc00)[_0x7773('0xb')](function(_0x1bc754){logger['info'](_0x7773('0xc'),_0x578bf0,_0x7773('0xd'));logger[_0x7773('0xe')](_0x7773('0xf'),_0x578bf0,'request\x20sent',JSON['stringify'](_0x1bc754));if(_0x1bc754[_0x7773('0x10')]){if(_0x1bc754[_0x7773('0x10')][_0x7773('0x11')]===0x1f4){logger[_0x7773('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x578bf0,_0x1bc754['error'][_0x7773('0x12')]);return _0x1f8a23(_0x1bc754[_0x7773('0x10')][_0x7773('0x12')]);}logger['error'](_0x7773('0xc'),_0x578bf0,_0x1bc754['error'][_0x7773('0x12')]);return _0x4c895f(_0x1bc754['error']['message']);}else{logger[_0x7773('0x13')](_0x7773('0xc'),_0x578bf0,_0x7773('0xd'));_0x4c895f(_0x1bc754[_0x7773('0x14')][_0x7773('0x12')]);}})['catch'](function(_0x8557d8){logger[_0x7773('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x578bf0,_0x8557d8);_0x1f8a23(_0x8557d8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 13ab3de..26472c4 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 _0x2b64=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x13e724,_0x296739){var _0x334a44=function(_0x28f54e){while(--_0x28f54e){_0x13e724['push'](_0x13e724['shift']());}};_0x334a44(++_0x296739);}(_0x2b64,0x120));var _0x42b6=function(_0x46be1a,_0x17d81d){_0x46be1a=_0x46be1a-0x0;var _0x30196d=_0x2b64[_0x46be1a];return _0x30196d;};'use strict';var multer=require(_0x42b6('0x0'));var util=require(_0x42b6('0x1'));var path=require(_0x42b6('0x2'));var timeout=require(_0x42b6('0x3'));var express=require(_0x42b6('0x4'));var router=express[_0x42b6('0x5')]();var fs_extra=require(_0x42b6('0x6'));var auth=require(_0x42b6('0x7'));var interaction=require(_0x42b6('0x8'));var config=require(_0x42b6('0x9'));var controller=require(_0x42b6('0xa'));router[_0x42b6('0xb')]('/',auth[_0x42b6('0xc')](),controller['index']);router[_0x42b6('0xb')]('/:id',auth[_0x42b6('0xc')](),controller[_0x42b6('0xd')]);router[_0x42b6('0xe')]('/',auth['isAuthenticated'](),controller[_0x42b6('0xf')]);router[_0x42b6('0x10')](_0x42b6('0x11'),auth[_0x42b6('0xc')](),controller[_0x42b6('0x12')]);router[_0x42b6('0x13')](_0x42b6('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x42b6('0x14')]=router; \ No newline at end of file +var _0x4cd8=['./intZendeskField.controller','isAuthenticated','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x418dae,_0x23990d){var _0x5600c6=function(_0x2de097){while(--_0x2de097){_0x418dae['push'](_0x418dae['shift']());}};_0x5600c6(++_0x23990d);}(_0x4cd8,0xd8));var _0x84cd=function(_0x5cbb32,_0x233ace){_0x5cbb32=_0x5cbb32-0x0;var _0x49363c=_0x4cd8[_0x5cbb32];return _0x49363c;};'use strict';var multer=require(_0x84cd('0x0'));var util=require(_0x84cd('0x1'));var path=require(_0x84cd('0x2'));var timeout=require(_0x84cd('0x3'));var express=require(_0x84cd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x84cd('0x5'));var interaction=require(_0x84cd('0x6'));var config=require(_0x84cd('0x7'));var controller=require(_0x84cd('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x84cd('0x9')](),controller['show']);router[_0x84cd('0xa')]('/',auth['isAuthenticated'](),controller[_0x84cd('0xb')]);router['put'](_0x84cd('0xc'),auth[_0x84cd('0x9')](),controller[_0x84cd('0xd')]);router[_0x84cd('0xe')](_0x84cd('0xc'),auth['isAuthenticated'](),controller[_0x84cd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 70ba020..1d5723f 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 _0xd841=['customVariable','STRING','BOOLEAN','exports','string','variable','keyValue'];(function(_0x38ce2a,_0x86fc07){var _0x35b473=function(_0x2b55cf){while(--_0x2b55cf){_0x38ce2a['push'](_0x38ce2a['shift']());}};_0x35b473(++_0x86fc07);}(_0xd841,0x137));var _0x1d84=function(_0x269089,_0x256030){_0x269089=_0x269089-0x0;var _0x3187c4=_0xd841[_0x269089];return _0x3187c4;};'use strict';var Sequelize=require('sequelize');module[_0x1d84('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1d84('0x1'),_0x1d84('0x2'),'customVariable',_0x1d84('0x3'),'picklist'),'defaultValue':_0x1d84('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1d84('0x1'),_0x1d84('0x2'),_0x1d84('0x4'))},'keyContent':{'type':Sequelize[_0x1d84('0x5')]},'idField':{'type':Sequelize[_0x1d84('0x5')]},'nameField':{'type':Sequelize[_0x1d84('0x5')]},'customField':{'type':Sequelize[_0x1d84('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d84('0x5')]}}; \ No newline at end of file +var _0xf014=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf014,0xf5));var _0x4f01=function(_0x1bbe54,_0xdc2c1b){_0x1bbe54=_0x1bbe54-0x0;var _0x1c5952=_0xf014[_0x1bbe54];return _0x1c5952;};'use strict';var Sequelize=require(_0x4f01('0x0'));module[_0x4f01('0x1')]={'type':{'type':Sequelize[_0x4f01('0x2')](_0x4f01('0x3'),_0x4f01('0x4'),_0x4f01('0x5'),_0x4f01('0x6'),'picklist'),'defaultValue':_0x4f01('0x3')},'content':{'type':Sequelize[_0x4f01('0x7')]},'key':{'type':Sequelize[_0x4f01('0x7')]},'keyType':{'type':Sequelize[_0x4f01('0x2')](_0x4f01('0x3'),_0x4f01('0x4'),_0x4f01('0x5'))},'keyContent':{'type':Sequelize[_0x4f01('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4f01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f01('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 832bdf4..fd42304 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 _0x20cb=['includeAll','include','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','index','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','map','VIRTUAL','findAll','rows','catch','show','params'];(function(_0x66a2aa,_0x43001c){var _0x3933e7=function(_0x587bd1){while(--_0x587bd1){_0x66a2aa['push'](_0x66a2aa['shift']());}};_0x3933e7(++_0x43001c);}(_0x20cb,0x12a));var _0xb20c=function(_0x1a45a2,_0x174dec){_0x1a45a2=_0x1a45a2-0x0;var _0x18a4a3=_0x20cb[_0x1a45a2];return _0x18a4a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb20c('0x0'));var zipdir=require(_0xb20c('0x1'));var jsonpatch=require(_0xb20c('0x2'));var rp=require(_0xb20c('0x3'));var moment=require('moment');var BPromise=require(_0xb20c('0x4'));var Mustache=require(_0xb20c('0x5'));var util=require(_0xb20c('0x6'));var path=require(_0xb20c('0x7'));var sox=require(_0xb20c('0x8'));var csv=require(_0xb20c('0x9'));var ejs=require(_0xb20c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb20c('0xb'));var crypto=require(_0xb20c('0xc'));var jsforce=require(_0xb20c('0xd'));var deskjs=require(_0xb20c('0xe'));var toCsv=require(_0xb20c('0x9'));var querystring=require(_0xb20c('0xf'));var Papa=require(_0xb20c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb20c('0x11'))(_0xb20c('0x12'));var utils=require(_0xb20c('0x13'));var config=require(_0xb20c('0x14'));var licenseUtil=require(_0xb20c('0x15'));var db=require(_0xb20c('0x16'))['db'];function respondWithStatusCode(_0x3885c4,_0x6c5064){_0x6c5064=_0x6c5064||0xcc;return function(_0x560fd7){if(_0x560fd7){return _0x3885c4[_0xb20c('0x17')](_0x6c5064);}return _0x3885c4[_0xb20c('0x18')](_0x6c5064)['end']();};}function respondWithResult(_0x452f6e,_0x2d9a53){_0x2d9a53=_0x2d9a53||0xc8;return function(_0x1b42c2){if(_0x1b42c2){return _0x452f6e[_0xb20c('0x18')](_0x2d9a53)[_0xb20c('0x19')](_0x1b42c2);}};}function respondWithFilteredResult(_0x29dd46,_0x51e0c2){return function(_0x18660b){if(_0x18660b){var _0x198fc9=typeof _0x51e0c2[_0xb20c('0x1a')]==='undefined'&&typeof _0x51e0c2[_0xb20c('0x1b')]===_0xb20c('0x1c');var _0x20c096=_0x18660b['count'];var _0x5ebd68=_0x198fc9?0x0:_0x51e0c2[_0xb20c('0x1a')];var _0x400b3a=_0x198fc9?_0x18660b[_0xb20c('0x1d')]:_0x51e0c2[_0xb20c('0x1a')]+_0x51e0c2[_0xb20c('0x1b')];var _0x23f95d;if(_0x400b3a>=_0x20c096){_0x400b3a=_0x20c096;_0x23f95d=0xc8;}else{_0x23f95d=0xce;}_0x29dd46[_0xb20c('0x18')](_0x23f95d);return _0x29dd46[_0xb20c('0x1e')](_0xb20c('0x1f'),_0x5ebd68+'-'+_0x400b3a+'/'+_0x20c096)[_0xb20c('0x19')](_0x18660b);}return null;};}function patchUpdates(_0x303c71){return function(_0x12a544){try{jsonpatch[_0xb20c('0x20')](_0x12a544,_0x303c71,!![]);}catch(_0x372742){return BPromise[_0xb20c('0x21')](_0x372742);}return _0x12a544['save']();};}function saveUpdates(_0x34c0f4,_0x164caa){return function(_0x3aadad){if(_0x3aadad){return _0x3aadad[_0xb20c('0x22')](_0x34c0f4)[_0xb20c('0x23')](function(_0x20acb8){return _0x20acb8;});}return null;};}function removeEntity(_0x569b09,_0x420b5b){return function(_0x1c1bca){if(_0x1c1bca){return _0x1c1bca['destroy']()[_0xb20c('0x23')](function(){_0x569b09['status'](0xcc)[_0xb20c('0x24')]();});}};}function handleEntityNotFound(_0x62d0d6,_0x8a6529){return function(_0x1ddf3a){if(!_0x1ddf3a){_0x62d0d6[_0xb20c('0x17')](0x194);}return _0x1ddf3a;};}function handleError(_0x397efe,_0x289cda){_0x289cda=_0x289cda||0x1f4;return function(_0x408236){logger[_0xb20c('0x25')](_0x408236[_0xb20c('0x26')]);if(_0x408236[_0xb20c('0x27')]){delete _0x408236['name'];}_0x397efe[_0xb20c('0x18')](_0x289cda)['send'](_0x408236);};}exports[_0xb20c('0x28')]=function(_0x5397da,_0x260958){var _0x2d1261={},_0x569bcc={},_0x2e1800={'count':0x0,'rows':[]};var _0x3e9848=_['map'](db[_0xb20c('0x29')][_0xb20c('0x2a')],function(_0x2038c2){return{'name':_0x2038c2[_0xb20c('0x2b')],'type':_0x2038c2[_0xb20c('0x2c')][_0xb20c('0x2d')]};});_0x569bcc[_0xb20c('0x2e')]=_['map'](_0x3e9848,_0xb20c('0x27'));_0x569bcc[_0xb20c('0x2f')]=_[_0xb20c('0x30')](_0x5397da[_0xb20c('0x2f')]);_0x569bcc['filters']=_['intersection'](_0x569bcc[_0xb20c('0x2e')],_0x569bcc['query']);_0x2d1261['attributes']=_[_0xb20c('0x31')](_0x569bcc['model'],qs[_0xb20c('0x32')](_0x5397da[_0xb20c('0x2f')][_0xb20c('0x32')]));_0x2d1261['attributes']=_0x2d1261[_0xb20c('0x33')][_0xb20c('0x34')]?_0x2d1261[_0xb20c('0x33')]:_0x569bcc[_0xb20c('0x2e')];if(!_0x5397da[_0xb20c('0x2f')]['hasOwnProperty'](_0xb20c('0x35'))){_0x2d1261[_0xb20c('0x1b')]=qs[_0xb20c('0x1b')](_0x5397da['query'][_0xb20c('0x1b')]);_0x2d1261[_0xb20c('0x1a')]=qs[_0xb20c('0x1a')](_0x5397da[_0xb20c('0x2f')][_0xb20c('0x1a')]);}_0x2d1261[_0xb20c('0x36')]=qs[_0xb20c('0x37')](_0x5397da[_0xb20c('0x2f')]['sort']);_0x2d1261['where']=qs['filters'](_['pick'](_0x5397da[_0xb20c('0x2f')],_0x569bcc[_0xb20c('0x38')]),_0x3e9848);if(_0x5397da[_0xb20c('0x2f')][_0xb20c('0x39')]){_0x2d1261[_0xb20c('0x3a')]=_[_0xb20c('0x3b')](_0x2d1261[_0xb20c('0x3a')],{'$or':_[_0xb20c('0x3c')](_0x3e9848,function(_0x5a63f6){if(_0x5a63f6[_0xb20c('0x2c')]!==_0xb20c('0x3d')){var _0x9fbafd={};_0x9fbafd[_0x5a63f6[_0xb20c('0x27')]]={'$like':'%'+_0x5397da[_0xb20c('0x2f')]['filter']+'%'};return _0x9fbafd;}})});}_0x2d1261=_[_0xb20c('0x3b')]({},_0x2d1261,_0x5397da['options']);var _0x5923cd={'where':_0x2d1261[_0xb20c('0x3a')]};return db[_0xb20c('0x29')][_0xb20c('0x1d')](_0x5923cd)[_0xb20c('0x23')](function(_0x48bd58){_0x2e1800['count']=_0x48bd58;if(_0x5397da['query']['includeAll']){_0x2d1261['include']=[{'all':!![]}];}return db[_0xb20c('0x29')][_0xb20c('0x3e')](_0x2d1261);})['then'](function(_0x22aa28){_0x2e1800[_0xb20c('0x3f')]=_0x22aa28;return _0x2e1800;})['then'](respondWithFilteredResult(_0x260958,_0x2d1261))[_0xb20c('0x40')](handleError(_0x260958,null));};exports[_0xb20c('0x41')]=function(_0x47a73b,_0x15f5f8){var _0x1b2448={'raw':!![],'where':{'id':_0x47a73b[_0xb20c('0x42')]['id']}},_0x155ae2={};_0x155ae2[_0xb20c('0x2e')]=_['keys'](db[_0xb20c('0x29')][_0xb20c('0x2a')]);_0x155ae2['query']=_['keys'](_0x47a73b[_0xb20c('0x2f')]);_0x155ae2[_0xb20c('0x38')]=_['intersection'](_0x155ae2['model'],_0x155ae2[_0xb20c('0x2f')]);_0x1b2448[_0xb20c('0x33')]=_['intersection'](_0x155ae2[_0xb20c('0x2e')],qs['fields'](_0x47a73b[_0xb20c('0x2f')]['fields']));_0x1b2448['attributes']=_0x1b2448['attributes'][_0xb20c('0x34')]?_0x1b2448[_0xb20c('0x33')]:_0x155ae2[_0xb20c('0x2e')];if(_0x47a73b['query'][_0xb20c('0x43')]){_0x1b2448[_0xb20c('0x44')]=[{'all':!![]}];}_0x1b2448=_[_0xb20c('0x3b')]({},_0x1b2448,_0x47a73b[_0xb20c('0x45')]);return db[_0xb20c('0x29')][_0xb20c('0x46')](_0x1b2448)['then'](handleEntityNotFound(_0x15f5f8,null))[_0xb20c('0x23')](respondWithResult(_0x15f5f8,null))[_0xb20c('0x40')](handleError(_0x15f5f8,null));};exports['create']=function(_0x59222f,_0x5ef150){return db['ZendeskField'][_0xb20c('0x47')](_0x59222f['body'],{})[_0xb20c('0x23')](respondWithResult(_0x5ef150,0xc9))[_0xb20c('0x40')](handleError(_0x5ef150,null));};exports[_0xb20c('0x22')]=function(_0x588816,_0x1118e8){if(_0x588816[_0xb20c('0x48')]['id']){delete _0x588816['body']['id'];}return db[_0xb20c('0x29')]['find']({'where':{'id':_0x588816[_0xb20c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1118e8,null))[_0xb20c('0x23')](saveUpdates(_0x588816[_0xb20c('0x48')],null))[_0xb20c('0x23')](respondWithResult(_0x1118e8,null))[_0xb20c('0x40')](handleError(_0x1118e8,null));};exports['destroy']=function(_0x1abc46,_0x19a888){return db[_0xb20c('0x29')][_0xb20c('0x46')]({'where':{'id':_0x1abc46[_0xb20c('0x42')]['id']}})[_0xb20c('0x23')](handleEntityNotFound(_0x19a888,null))[_0xb20c('0x23')](removeEntity(_0x19a888,null))[_0xb20c('0x40')](handleError(_0x19a888,null));}; \ No newline at end of file +var _0x552e=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update'];(function(_0x54a346,_0x41abbf){var _0x1e8f4e=function(_0x305cbe){while(--_0x305cbe){_0x54a346['push'](_0x54a346['shift']());}};_0x1e8f4e(++_0x41abbf);}(_0x552e,0x138));var _0xe552=function(_0x1038e2,_0x5f4ea5){_0x1038e2=_0x1038e2-0x0;var _0x12f332=_0x552e[_0x1038e2];return _0x12f332;};'use strict';var emlformat=require(_0xe552('0x0'));var rimraf=require(_0xe552('0x1'));var zipdir=require(_0xe552('0x2'));var jsonpatch=require(_0xe552('0x3'));var rp=require(_0xe552('0x4'));var moment=require(_0xe552('0x5'));var BPromise=require(_0xe552('0x6'));var Mustache=require(_0xe552('0x7'));var util=require(_0xe552('0x8'));var path=require(_0xe552('0x9'));var sox=require('sox');var csv=require(_0xe552('0xa'));var ejs=require(_0xe552('0xb'));var fs=require('fs');var fs_extra=require(_0xe552('0xc'));var _=require(_0xe552('0xd'));var squel=require(_0xe552('0xe'));var crypto=require('crypto');var jsforce=require(_0xe552('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe552('0xa'));var querystring=require(_0xe552('0x10'));var Papa=require(_0xe552('0x11'));var Redis=require(_0xe552('0x12'));var authService=require(_0xe552('0x13'));var qs=require(_0xe552('0x14'));var as=require(_0xe552('0x15'));var hardwareService=require(_0xe552('0x16'));var logger=require(_0xe552('0x17'))(_0xe552('0x18'));var utils=require(_0xe552('0x19'));var config=require(_0xe552('0x1a'));var licenseUtil=require(_0xe552('0x1b'));var db=require(_0xe552('0x1c'))['db'];function respondWithStatusCode(_0xfbc742,_0x9038d1){_0x9038d1=_0x9038d1||0xcc;return function(_0x145f07){if(_0x145f07){return _0xfbc742[_0xe552('0x1d')](_0x9038d1);}return _0xfbc742['status'](_0x9038d1)['end']();};}function respondWithResult(_0x91b486,_0x45b2db){_0x45b2db=_0x45b2db||0xc8;return function(_0x1eb38e){if(_0x1eb38e){return _0x91b486[_0xe552('0x1e')](_0x45b2db)[_0xe552('0x1f')](_0x1eb38e);}};}function respondWithFilteredResult(_0x2e3f1c,_0x3db61d){return function(_0x4e593b){if(_0x4e593b){var _0x288b1f=typeof _0x3db61d[_0xe552('0x20')]==='undefined'&&typeof _0x3db61d[_0xe552('0x21')]==='undefined';var _0x454ddb=_0x4e593b[_0xe552('0x22')];var _0x20eab1=_0x288b1f?0x0:_0x3db61d[_0xe552('0x20')];var _0xe9d83e=_0x288b1f?_0x4e593b['count']:_0x3db61d[_0xe552('0x20')]+_0x3db61d[_0xe552('0x21')];var _0x3b201b;if(_0xe9d83e>=_0x454ddb){_0xe9d83e=_0x454ddb;_0x3b201b=0xc8;}else{_0x3b201b=0xce;}_0x2e3f1c[_0xe552('0x1e')](_0x3b201b);return _0x2e3f1c[_0xe552('0x23')](_0xe552('0x24'),_0x20eab1+'-'+_0xe9d83e+'/'+_0x454ddb)[_0xe552('0x1f')](_0x4e593b);}return null;};}function patchUpdates(_0x1ac096){return function(_0x4aeead){try{jsonpatch[_0xe552('0x25')](_0x4aeead,_0x1ac096,!![]);}catch(_0x1faf12){return BPromise[_0xe552('0x26')](_0x1faf12);}return _0x4aeead[_0xe552('0x27')]();};}function saveUpdates(_0x439364,_0x33e6ca){return function(_0xa6d7e2){if(_0xa6d7e2){return _0xa6d7e2['update'](_0x439364)['then'](function(_0x3be27f){return _0x3be27f;});}return null;};}function removeEntity(_0x4dea53,_0x534f49){return function(_0x292dac){if(_0x292dac){return _0x292dac[_0xe552('0x28')]()[_0xe552('0x29')](function(){_0x4dea53[_0xe552('0x1e')](0xcc)[_0xe552('0x2a')]();});}};}function handleEntityNotFound(_0xd53e8,_0x142e07){return function(_0xe129a9){if(!_0xe129a9){_0xd53e8['sendStatus'](0x194);}return _0xe129a9;};}function handleError(_0x3b2b3a,_0xd54618){_0xd54618=_0xd54618||0x1f4;return function(_0x2650da){logger[_0xe552('0x2b')](_0x2650da[_0xe552('0x2c')]);if(_0x2650da[_0xe552('0x2d')]){delete _0x2650da[_0xe552('0x2d')];}_0x3b2b3a['status'](_0xd54618)[_0xe552('0x2e')](_0x2650da);};}exports[_0xe552('0x2f')]=function(_0xa9607b,_0x59cb20){var _0x37a3bc={},_0x18b2c1={},_0x2c0101={'count':0x0,'rows':[]};var _0x40b45e=_[_0xe552('0x30')](db[_0xe552('0x31')][_0xe552('0x32')],function(_0x22e480){return{'name':_0x22e480['fieldName'],'type':_0x22e480[_0xe552('0x33')][_0xe552('0x34')]};});_0x18b2c1[_0xe552('0x35')]=_[_0xe552('0x30')](_0x40b45e,'name');_0x18b2c1[_0xe552('0x36')]=_['keys'](_0xa9607b['query']);_0x18b2c1['filters']=_[_0xe552('0x37')](_0x18b2c1['model'],_0x18b2c1[_0xe552('0x36')]);_0x37a3bc[_0xe552('0x38')]=_[_0xe552('0x37')](_0x18b2c1[_0xe552('0x35')],qs['fields'](_0xa9607b['query'][_0xe552('0x39')]));_0x37a3bc[_0xe552('0x38')]=_0x37a3bc[_0xe552('0x38')][_0xe552('0x3a')]?_0x37a3bc['attributes']:_0x18b2c1['model'];if(!_0xa9607b['query'][_0xe552('0x3b')](_0xe552('0x3c'))){_0x37a3bc['limit']=qs['limit'](_0xa9607b[_0xe552('0x36')][_0xe552('0x21')]);_0x37a3bc[_0xe552('0x20')]=qs[_0xe552('0x20')](_0xa9607b['query'][_0xe552('0x20')]);}_0x37a3bc['order']=qs[_0xe552('0x3d')](_0xa9607b[_0xe552('0x36')][_0xe552('0x3d')]);_0x37a3bc['where']=qs[_0xe552('0x3e')](_['pick'](_0xa9607b[_0xe552('0x36')],_0x18b2c1['filters']),_0x40b45e);if(_0xa9607b[_0xe552('0x36')]['filter']){_0x37a3bc[_0xe552('0x3f')]=_['merge'](_0x37a3bc['where'],{'$or':_[_0xe552('0x30')](_0x40b45e,function(_0x2fb439){if(_0x2fb439[_0xe552('0x33')]!==_0xe552('0x40')){var _0x316352={};_0x316352[_0x2fb439['name']]={'$like':'%'+_0xa9607b[_0xe552('0x36')][_0xe552('0x41')]+'%'};return _0x316352;}})});}_0x37a3bc=_[_0xe552('0x42')]({},_0x37a3bc,_0xa9607b['options']);var _0x4d3a45={'where':_0x37a3bc[_0xe552('0x3f')]};return db[_0xe552('0x31')][_0xe552('0x22')](_0x4d3a45)[_0xe552('0x29')](function(_0x2082f7){_0x2c0101['count']=_0x2082f7;if(_0xa9607b[_0xe552('0x36')][_0xe552('0x43')]){_0x37a3bc[_0xe552('0x44')]=[{'all':!![]}];}return db['ZendeskField'][_0xe552('0x45')](_0x37a3bc);})[_0xe552('0x29')](function(_0x4193f8){_0x2c0101[_0xe552('0x46')]=_0x4193f8;return _0x2c0101;})['then'](respondWithFilteredResult(_0x59cb20,_0x37a3bc))[_0xe552('0x47')](handleError(_0x59cb20,null));};exports['show']=function(_0x1ba246,_0x5dbfa9){var _0x5b6e02={'raw':!![],'where':{'id':_0x1ba246[_0xe552('0x48')]['id']}},_0x4f04c2={};_0x4f04c2['model']=_['keys'](db[_0xe552('0x31')][_0xe552('0x32')]);_0x4f04c2[_0xe552('0x36')]=_[_0xe552('0x49')](_0x1ba246[_0xe552('0x36')]);_0x4f04c2[_0xe552('0x3e')]=_['intersection'](_0x4f04c2[_0xe552('0x35')],_0x4f04c2[_0xe552('0x36')]);_0x5b6e02[_0xe552('0x38')]=_['intersection'](_0x4f04c2[_0xe552('0x35')],qs['fields'](_0x1ba246[_0xe552('0x36')]['fields']));_0x5b6e02[_0xe552('0x38')]=_0x5b6e02[_0xe552('0x38')][_0xe552('0x3a')]?_0x5b6e02[_0xe552('0x38')]:_0x4f04c2['model'];if(_0x1ba246['query']['includeAll']){_0x5b6e02[_0xe552('0x44')]=[{'all':!![]}];}_0x5b6e02=_[_0xe552('0x42')]({},_0x5b6e02,_0x1ba246['options']);return db[_0xe552('0x31')][_0xe552('0x4a')](_0x5b6e02)[_0xe552('0x29')](handleEntityNotFound(_0x5dbfa9,null))['then'](respondWithResult(_0x5dbfa9,null))[_0xe552('0x47')](handleError(_0x5dbfa9,null));};exports[_0xe552('0x4b')]=function(_0x40d9d4,_0x1371dd){return db[_0xe552('0x31')][_0xe552('0x4b')](_0x40d9d4[_0xe552('0x4c')],{})[_0xe552('0x29')](respondWithResult(_0x1371dd,0xc9))[_0xe552('0x47')](handleError(_0x1371dd,null));};exports[_0xe552('0x4d')]=function(_0x24de01,_0x98cf87){if(_0x24de01[_0xe552('0x4c')]['id']){delete _0x24de01[_0xe552('0x4c')]['id'];}return db[_0xe552('0x31')][_0xe552('0x4a')]({'where':{'id':_0x24de01[_0xe552('0x48')]['id']}})[_0xe552('0x29')](handleEntityNotFound(_0x98cf87,null))['then'](saveUpdates(_0x24de01[_0xe552('0x4c')],null))[_0xe552('0x29')](respondWithResult(_0x98cf87,null))[_0xe552('0x47')](handleError(_0x98cf87,null));};exports[_0xe552('0x28')]=function(_0x2ad82f,_0x27ecb0){return db[_0xe552('0x31')]['find']({'where':{'id':_0x2ad82f['params']['id']}})[_0xe552('0x29')](handleEntityNotFound(_0x27ecb0,null))['then'](removeEntity(_0x27ecb0,null))[_0xe552('0x47')](handleError(_0x27ecb0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6127d62..de82002 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 _0x5da9=['zendesk_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields'];(function(_0x366c7c,_0x1a731d){var _0x543cce=function(_0x46bcce){while(--_0x46bcce){_0x366c7c['push'](_0x366c7c['shift']());}};_0x543cce(++_0x1a731d);}(_0x5da9,0x65));var _0x95da=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x5da9[_0x467488];return _0x56107f;};'use strict';var _=require('lodash');var util=require(_0x95da('0x0'));var logger=require('../../config/logger')(_0x95da('0x1'));var moment=require(_0x95da('0x2'));var BPromise=require(_0x95da('0x3'));var rp=require(_0x95da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95da('0x5'));var config=require(_0x95da('0x6'));var attributes=require(_0x95da('0x7'));module['exports']=function(_0x971328,_0x2d5b6e){return _0x971328[_0x95da('0x8')](_0x95da('0x9'),attributes,{'tableName':_0x95da('0xa'),'paranoid':![],'indexes':[{'name':_0x95da('0xb'),'fields':[_0x95da('0xc'),_0x95da('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b8c=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0x4debaf,_0x536f13){var _0x20ba90=function(_0x5b2a92){while(--_0x5b2a92){_0x4debaf['push'](_0x4debaf['shift']());}};_0x20ba90(++_0x536f13);}(_0x5b8c,0x9a));var _0xc5b8=function(_0x940009,_0x32b94b){_0x940009=_0x940009-0x0;var _0x1529d2=_0x5b8c[_0x940009];return _0x1529d2;};'use strict';var _=require(_0xc5b8('0x0'));var util=require(_0xc5b8('0x1'));var logger=require(_0xc5b8('0x2'))('api');var moment=require(_0xc5b8('0x3'));var BPromise=require(_0xc5b8('0x4'));var rp=require(_0xc5b8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5b8('0x6'));var config=require(_0xc5b8('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x4965ee,_0x14ddc8){return _0x4965ee[_0xc5b8('0x8')](_0xc5b8('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xc5b8('0xa'),'fields':[_0xc5b8('0xb'),_0xc5b8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5f58eb7..195d829 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 _0x968d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e8f93,_0xc1ac4e){var _0x83b217=function(_0x1b0add){while(--_0x1b0add){_0x5e8f93['push'](_0x5e8f93['shift']());}};_0x83b217(++_0xc1ac4e);}(_0x968d,0xa2));var _0xd968=function(_0x5b36a3,_0x204b19){_0x5b36a3=_0x5b36a3-0x0;var _0x47a069=_0x968d[_0x5b36a3];return _0x47a069;};'use strict';var _=require(_0xd968('0x0'));var util=require(_0xd968('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd968('0x2'));var fs=require('fs');var Redis=require(_0xd968('0x3'));var db=require(_0xd968('0x4'))['db'];var utils=require(_0xd968('0x5'));var logger=require(_0xd968('0x6'))(_0xd968('0x7'));var config=require(_0xd968('0x8'));var jayson=require(_0xd968('0x9'));var client=jayson[_0xd968('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c39ac,_0x5296cd,_0x1800ab){return new BPromise(function(_0x16f3fc,_0x564dfe){return client[_0xd968('0xb')](_0x5c39ac,_0x1800ab)['then'](function(_0x2fdbc2){logger['info']('ZendeskField,\x20%s,\x20%s',_0x5296cd,_0xd968('0xc'));logger[_0xd968('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5296cd,_0xd968('0xc'),JSON[_0xd968('0xe')](_0x2fdbc2));if(_0x2fdbc2[_0xd968('0xf')]){if(_0x2fdbc2[_0xd968('0xf')][_0xd968('0x10')]===0x1f4){logger['error'](_0xd968('0x11'),_0x5296cd,_0x2fdbc2['error'][_0xd968('0x12')]);return _0x564dfe(_0x2fdbc2[_0xd968('0xf')][_0xd968('0x12')]);}logger[_0xd968('0xf')](_0xd968('0x11'),_0x5296cd,_0x2fdbc2[_0xd968('0xf')][_0xd968('0x12')]);return _0x16f3fc(_0x2fdbc2[_0xd968('0xf')][_0xd968('0x12')]);}else{logger[_0xd968('0x13')](_0xd968('0x11'),_0x5296cd,_0xd968('0xc'));_0x16f3fc(_0x2fdbc2[_0xd968('0x14')]['message']);}})['catch'](function(_0xd8ac6a){logger['error'](_0xd968('0x11'),_0x5296cd,_0xd8ac6a);_0x564dfe(_0xd8ac6a);});});} \ No newline at end of file +var _0xdcbd=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4a2371,_0x282f36){var _0x1f13fd=function(_0x57d836){while(--_0x57d836){_0x4a2371['push'](_0x4a2371['shift']());}};_0x1f13fd(++_0x282f36);}(_0xdcbd,0x1de));var _0xddcb=function(_0x347732,_0x45a6df){_0x347732=_0x347732-0x0;var _0x3f81b9=_0xdcbd[_0x347732];return _0x3f81b9;};'use strict';var _=require(_0xddcb('0x0'));var util=require(_0xddcb('0x1'));var moment=require(_0xddcb('0x2'));var BPromise=require(_0xddcb('0x3'));var rs=require(_0xddcb('0x4'));var fs=require('fs');var Redis=require(_0xddcb('0x5'));var db=require(_0xddcb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xddcb('0x7'))('rpc');var config=require(_0xddcb('0x8'));var jayson=require(_0xddcb('0x9'));var client=jayson[_0xddcb('0xa')][_0xddcb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea96b5,_0x5850b3,_0x4347c7){return new BPromise(function(_0x173081,_0x2607c3){return client[_0xddcb('0xc')](_0xea96b5,_0x4347c7)[_0xddcb('0xd')](function(_0x343f43){logger[_0xddcb('0xe')](_0xddcb('0xf'),_0x5850b3,'request\x20sent');logger['debug'](_0xddcb('0x10'),_0x5850b3,_0xddcb('0x11'),JSON[_0xddcb('0x12')](_0x343f43));if(_0x343f43[_0xddcb('0x13')]){if(_0x343f43['error'][_0xddcb('0x14')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x5850b3,_0x343f43[_0xddcb('0x13')][_0xddcb('0x15')]);return _0x2607c3(_0x343f43[_0xddcb('0x13')][_0xddcb('0x15')]);}logger[_0xddcb('0x13')](_0xddcb('0xf'),_0x5850b3,_0x343f43['error'][_0xddcb('0x15')]);return _0x173081(_0x343f43[_0xddcb('0x13')][_0xddcb('0x15')]);}else{logger[_0xddcb('0xe')](_0xddcb('0xf'),_0x5850b3,_0xddcb('0x11'));_0x173081(_0x343f43['result']['message']);}})['catch'](function(_0x511679){logger[_0xddcb('0x13')]('ZendeskField,\x20%s,\x20%s',_0x5850b3,_0x511679);_0x2607c3(_0x511679);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 22eb6db..5b762e4 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 _0x2b81=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer'];(function(_0x12e605,_0x5c3f8c){var _0x118a07=function(_0x40af61){while(--_0x40af61){_0x12e605['push'](_0x12e605['shift']());}};_0x118a07(++_0x5c3f8c);}(_0x2b81,0x95));var _0x12b8=function(_0x182cbd,_0x3b513a){_0x182cbd=_0x182cbd-0x0;var _0x48ade4=_0x2b81[_0x182cbd];return _0x48ade4;};'use strict';var multer=require(_0x12b8('0x0'));var util=require(_0x12b8('0x1'));var path=require(_0x12b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x12b8('0x3'));var router=express[_0x12b8('0x4')]();var fs_extra=require(_0x12b8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x12b8('0x6'));var config=require(_0x12b8('0x7'));var controller=require(_0x12b8('0x8'));router[_0x12b8('0x9')]('/',auth['isAuthenticated'](),controller[_0x12b8('0xa')]);router[_0x12b8('0x9')](_0x12b8('0xb'),auth[_0x12b8('0xc')](),controller[_0x12b8('0xd')]);router[_0x12b8('0x9')]('/:id/configurations',auth[_0x12b8('0xc')](),controller[_0x12b8('0xe')]);router[_0x12b8('0x9')](_0x12b8('0xf'),auth[_0x12b8('0xc')](),controller[_0x12b8('0x10')]);router[_0x12b8('0x11')]('/',auth[_0x12b8('0xc')](),controller[_0x12b8('0x12')]);router[_0x12b8('0x11')](_0x12b8('0x13'),auth[_0x12b8('0xc')](),controller['addConfiguration']);router[_0x12b8('0x14')](_0x12b8('0xb'),auth[_0x12b8('0xc')](),controller[_0x12b8('0x15')]);router[_0x12b8('0x16')](_0x12b8('0xb'),auth[_0x12b8('0xc')](),controller[_0x12b8('0x17')]);module[_0x12b8('0x18')]=router; \ No newline at end of file +var _0x5f21=['Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','put','update','destroy','exports','util','connect-timeout'];(function(_0x1158d5,_0x4e7ee8){var _0x3e9d61=function(_0x182cc7){while(--_0x182cc7){_0x1158d5['push'](_0x1158d5['shift']());}};_0x3e9d61(++_0x4e7ee8);}(_0x5f21,0xe8));var _0x15f2=function(_0x49cfcc,_0xf15540){_0x49cfcc=_0x49cfcc-0x0;var _0x44d1cc=_0x5f21[_0x49cfcc];return _0x44d1cc;};'use strict';var multer=require('multer');var util=require(_0x15f2('0x0'));var path=require('path');var timeout=require(_0x15f2('0x1'));var express=require('express');var router=express[_0x15f2('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x15f2('0x3'));var config=require(_0x15f2('0x4'));var controller=require(_0x15f2('0x5'));router[_0x15f2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x15f2('0x6')](_0x15f2('0x7'),auth[_0x15f2('0x8')](),controller[_0x15f2('0x9')]);router[_0x15f2('0x6')](_0x15f2('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x15f2('0x6')](_0x15f2('0xb'),auth[_0x15f2('0x8')](),controller['getFields']);router[_0x15f2('0xc')]('/',auth[_0x15f2('0x8')](),controller[_0x15f2('0xd')]);router[_0x15f2('0xc')](_0x15f2('0xa'),auth[_0x15f2('0x8')](),controller['addConfiguration']);router[_0x15f2('0xe')](_0x15f2('0x7'),auth[_0x15f2('0x8')](),controller[_0x15f2('0xf')]);router['delete'](_0x15f2('0x7'),auth['isAuthenticated'](),controller[_0x15f2('0x10')]);module[_0x15f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index dd7b989..c8ec9cb 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 _0xd0bb=['exports','STRING','sequelize'];(function(_0x418646,_0x202937){var _0x59747e=function(_0x533409){while(--_0x533409){_0x418646['push'](_0x418646['shift']());}};_0x59747e(++_0x202937);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0xd0bb[_0x5c18ef];return _0x33789d;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4522=['STRING'];(function(_0x3f8157,_0x34cc64){var _0x27aead=function(_0x275a3a){while(--_0x275a3a){_0x3f8157['push'](_0x3f8157['shift']());}};_0x27aead(++_0x34cc64);}(_0x4522,0x1a0));var _0x2452=function(_0x4fdd4b,_0x401390){_0x4fdd4b=_0x4fdd4b-0x0;var _0x3cd78d=_0x4522[_0x4fdd4b];return _0x3cd78d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 13a460e..dc752f3 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 _0x9389=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','findOne','ZohoConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','ZohoAccount','rawAttributes','type','key'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x9389,0xcc));var _0x9938=function(_0x3976a2,_0x497ca9){_0x3976a2=_0x3976a2-0x0;var _0x56564a=_0x9389[_0x3976a2];return _0x56564a;};'use strict';var emlformat=require(_0x9938('0x0'));var rimraf=require(_0x9938('0x1'));var zipdir=require(_0x9938('0x2'));var jsonpatch=require(_0x9938('0x3'));var rp=require(_0x9938('0x4'));var moment=require(_0x9938('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9938('0x6'));var util=require(_0x9938('0x7'));var path=require(_0x9938('0x8'));var sox=require(_0x9938('0x9'));var csv=require(_0x9938('0xa'));var ejs=require(_0x9938('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9938('0xc'));var squel=require(_0x9938('0xd'));var crypto=require(_0x9938('0xe'));var jsforce=require(_0x9938('0xf'));var deskjs=require(_0x9938('0x10'));var toCsv=require(_0x9938('0xa'));var querystring=require(_0x9938('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9938('0x12'));var qs=require(_0x9938('0x13'));var as=require(_0x9938('0x14'));var hardwareService=require(_0x9938('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x9938('0x16'));var config=require(_0x9938('0x17'));var licenseUtil=require(_0x9938('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9938('0x19'));function respondWithStatusCode(_0x203ffa,_0x4eb146){_0x4eb146=_0x4eb146||0xcc;return function(_0x3ef11b){if(_0x3ef11b){return _0x203ffa[_0x9938('0x1a')](_0x4eb146);}return _0x203ffa[_0x9938('0x1b')](_0x4eb146)['end']();};}function respondWithResult(_0x661a21,_0x1707b3){_0x1707b3=_0x1707b3||0xc8;return function(_0x297b13){if(_0x297b13){return _0x661a21[_0x9938('0x1b')](_0x1707b3)[_0x9938('0x1c')](_0x297b13);}};}function respondWithFilteredResult(_0x427f0b,_0x422f19){return function(_0x4740cf){if(_0x4740cf){var _0x4db2d0=typeof _0x422f19['offset']==='undefined'&&typeof _0x422f19[_0x9938('0x1d')]===_0x9938('0x1e');var _0x5c977d=_0x4740cf[_0x9938('0x1f')];var _0xbff28=_0x4db2d0?0x0:_0x422f19['offset'];var _0x3509df=_0x4db2d0?_0x4740cf[_0x9938('0x1f')]:_0x422f19[_0x9938('0x20')]+_0x422f19[_0x9938('0x1d')];var _0x415ba2;if(_0x3509df>=_0x5c977d){_0x3509df=_0x5c977d;_0x415ba2=0xc8;}else{_0x415ba2=0xce;}_0x427f0b[_0x9938('0x1b')](_0x415ba2);return _0x427f0b[_0x9938('0x21')](_0x9938('0x22'),_0xbff28+'-'+_0x3509df+'/'+_0x5c977d)[_0x9938('0x1c')](_0x4740cf);}return null;};}function patchUpdates(_0x311382){return function(_0xf1b26e){try{jsonpatch['apply'](_0xf1b26e,_0x311382,!![]);}catch(_0x48ab58){return BPromise['reject'](_0x48ab58);}return _0xf1b26e[_0x9938('0x23')]();};}function saveUpdates(_0x4cd263,_0x685a03){return function(_0x2a263b){if(_0x2a263b){return _0x2a263b[_0x9938('0x24')](_0x4cd263)[_0x9938('0x25')](function(_0x190945){return _0x190945;});}return null;};}function removeEntity(_0x462e0e,_0xe34e4b){return function(_0x5a054f){if(_0x5a054f){return _0x5a054f[_0x9938('0x26')]()[_0x9938('0x25')](function(){_0x462e0e['status'](0xcc)[_0x9938('0x27')]();});}};}function handleEntityNotFound(_0x490595,_0x577997){return function(_0x35c8f7){if(!_0x35c8f7){_0x490595[_0x9938('0x1a')](0x194);}return _0x35c8f7;};}function handleError(_0x12ff71,_0x313e12){_0x313e12=_0x313e12||0x1f4;return function(_0x132d8e){logger[_0x9938('0x28')](_0x132d8e[_0x9938('0x29')]);if(_0x132d8e['name']){delete _0x132d8e[_0x9938('0x2a')];}_0x12ff71[_0x9938('0x1b')](_0x313e12)['send'](_0x132d8e);};}exports[_0x9938('0x2b')]=function(_0x163554,_0x8b7e5){var _0x5a3375={},_0x2aced2={},_0x4b0050={'count':0x0,'rows':[]};var _0x39fee1=_['map'](db[_0x9938('0x2c')][_0x9938('0x2d')],function(_0x13699c){return{'name':_0x13699c['fieldName'],'type':_0x13699c[_0x9938('0x2e')][_0x9938('0x2f')]};});_0x2aced2[_0x9938('0x30')]=_['map'](_0x39fee1,_0x9938('0x2a'));_0x2aced2[_0x9938('0x31')]=_['keys'](_0x163554['query']);_0x2aced2[_0x9938('0x32')]=_[_0x9938('0x33')](_0x2aced2[_0x9938('0x30')],_0x2aced2[_0x9938('0x31')]);_0x5a3375[_0x9938('0x34')]=_[_0x9938('0x33')](_0x2aced2[_0x9938('0x30')],qs['fields'](_0x163554['query'][_0x9938('0x35')]));_0x5a3375[_0x9938('0x34')]=_0x5a3375['attributes'][_0x9938('0x36')]?_0x5a3375['attributes']:_0x2aced2[_0x9938('0x30')];if(!_0x163554[_0x9938('0x31')][_0x9938('0x37')]('nolimit')){_0x5a3375['limit']=qs[_0x9938('0x1d')](_0x163554['query'][_0x9938('0x1d')]);_0x5a3375[_0x9938('0x20')]=qs[_0x9938('0x20')](_0x163554[_0x9938('0x31')][_0x9938('0x20')]);}_0x5a3375[_0x9938('0x38')]=qs[_0x9938('0x39')](_0x163554[_0x9938('0x31')][_0x9938('0x39')]);_0x5a3375[_0x9938('0x3a')]=qs[_0x9938('0x32')](_[_0x9938('0x3b')](_0x163554[_0x9938('0x31')],_0x2aced2['filters']),_0x39fee1);if(_0x163554[_0x9938('0x31')][_0x9938('0x3c')]){_0x5a3375['where']=_[_0x9938('0x3d')](_0x5a3375['where'],{'$or':_[_0x9938('0x3e')](_0x39fee1,function(_0x206932){if(_0x206932[_0x9938('0x2e')]!==_0x9938('0x3f')){var _0x1a52cc={};_0x1a52cc[_0x206932[_0x9938('0x2a')]]={'$like':'%'+_0x163554[_0x9938('0x31')][_0x9938('0x3c')]+'%'};return _0x1a52cc;}})});}_0x5a3375=_[_0x9938('0x3d')]({},_0x5a3375,_0x163554[_0x9938('0x40')]);var _0xdf91fc={'where':_0x5a3375['where']};return db['ZohoAccount']['count'](_0xdf91fc)[_0x9938('0x25')](function(_0x5a7f2e){_0x4b0050['count']=_0x5a7f2e;if(_0x163554[_0x9938('0x31')][_0x9938('0x41')]){_0x5a3375[_0x9938('0x42')]=[{'all':!![]}];}return db[_0x9938('0x2c')]['findAll'](_0x5a3375);})[_0x9938('0x25')](function(_0x32d860){_0x4b0050['rows']=_0x32d860;return _0x4b0050;})['then'](respondWithFilteredResult(_0x8b7e5,_0x5a3375))[_0x9938('0x43')](handleError(_0x8b7e5,null));};exports['show']=function(_0x20ccb3,_0x420505){var _0x2b90f3={'raw':![],'where':{'id':_0x20ccb3[_0x9938('0x44')]['id']}},_0x18a501={};_0x18a501['model']=_[_0x9938('0x45')](db[_0x9938('0x2c')][_0x9938('0x2d')]);_0x18a501[_0x9938('0x31')]=_['keys'](_0x20ccb3[_0x9938('0x31')]);_0x18a501[_0x9938('0x32')]=_['intersection'](_0x18a501[_0x9938('0x30')],_0x18a501[_0x9938('0x31')]);_0x2b90f3['attributes']=_[_0x9938('0x33')](_0x18a501['model'],qs[_0x9938('0x35')](_0x20ccb3['query']['fields']));_0x2b90f3[_0x9938('0x34')]=_0x2b90f3[_0x9938('0x34')][_0x9938('0x36')]?_0x2b90f3[_0x9938('0x34')]:_0x18a501['model'];if(_0x20ccb3[_0x9938('0x31')][_0x9938('0x41')]){_0x2b90f3['include']=[{'all':!![]}];}_0x2b90f3=_['merge']({},_0x2b90f3,_0x20ccb3[_0x9938('0x40')]);return db['ZohoAccount'][_0x9938('0x46')](_0x2b90f3)[_0x9938('0x25')](handleEntityNotFound(_0x420505,null))['then'](respondWithResult(_0x420505,null))['catch'](handleError(_0x420505,null));};exports[_0x9938('0x47')]=function(_0x23e704,_0x3a3c90){return db[_0x9938('0x2c')][_0x9938('0x47')](_0x23e704[_0x9938('0x48')],{})['then'](respondWithResult(_0x3a3c90,0xc9))[_0x9938('0x43')](handleError(_0x3a3c90,null));};exports[_0x9938('0x24')]=function(_0xac163,_0x395987){if(_0xac163['body']['id']){delete _0xac163[_0x9938('0x48')]['id'];}return db[_0x9938('0x2c')]['find']({'where':{'id':_0xac163['params']['id']}})['then'](handleEntityNotFound(_0x395987,null))[_0x9938('0x25')](saveUpdates(_0xac163[_0x9938('0x48')],null))['then'](respondWithResult(_0x395987,null))[_0x9938('0x43')](handleError(_0x395987,null));};exports[_0x9938('0x26')]=function(_0x288fff,_0x5a89a4){return db['ZohoAccount'][_0x9938('0x46')]({'where':{'id':_0x288fff[_0x9938('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a89a4,null))['then'](removeEntity(_0x5a89a4,null))[_0x9938('0x43')](handleError(_0x5a89a4,null));};exports['getConfigurations']=function(_0x3ddc90,_0x51d9b9,_0x105bbc){var _0x3c7eaa={};var _0x442a62={};var _0x1720f1;var _0x576b5e;return db[_0x9938('0x2c')][_0x9938('0x49')]({'where':{'id':_0x3ddc90['params']['id']}})[_0x9938('0x25')](handleEntityNotFound(_0x51d9b9,null))[_0x9938('0x25')](function(_0x12a798){if(_0x12a798){_0x1720f1=_0x12a798;_0x442a62['model']=_[_0x9938('0x45')](db[_0x9938('0x4a')]['rawAttributes']);_0x442a62[_0x9938('0x31')]=_['keys'](_0x3ddc90[_0x9938('0x31')]);_0x442a62['filters']=_[_0x9938('0x33')](_0x442a62[_0x9938('0x30')],_0x442a62[_0x9938('0x31')]);_0x3c7eaa['attributes']=_[_0x9938('0x33')](_0x442a62['model'],qs[_0x9938('0x35')](_0x3ddc90['query'][_0x9938('0x35')]));_0x3c7eaa[_0x9938('0x34')]=_0x3c7eaa[_0x9938('0x34')]['length']?_0x3c7eaa[_0x9938('0x34')]:_0x442a62['model'];_0x3c7eaa[_0x9938('0x38')]=qs[_0x9938('0x39')](_0x3ddc90[_0x9938('0x31')][_0x9938('0x39')]);_0x3c7eaa[_0x9938('0x3a')]=qs[_0x9938('0x32')](_[_0x9938('0x3b')](_0x3ddc90['query'],_0x442a62[_0x9938('0x32')]));if(_0x3ddc90[_0x9938('0x31')][_0x9938('0x3c')]){_0x3c7eaa[_0x9938('0x3a')]=_[_0x9938('0x3d')](_0x3c7eaa[_0x9938('0x3a')],{'$or':_[_0x9938('0x3e')](_0x3c7eaa[_0x9938('0x34')],function(_0x2bd39a){var _0x7fc631={};_0x7fc631[_0x2bd39a]={'$like':'%'+_0x3ddc90[_0x9938('0x31')]['filter']+'%'};return _0x7fc631;})});}_0x3c7eaa=_[_0x9938('0x3d')]({},_0x3c7eaa,_0x3ddc90[_0x9938('0x40')]);return _0x1720f1[_0x9938('0x4b')](_0x3c7eaa);}})['then'](function(_0x224887){if(_0x224887){_0x576b5e=_0x224887[_0x9938('0x36')];if(!_0x3ddc90[_0x9938('0x31')][_0x9938('0x37')](_0x9938('0x4c'))){_0x3c7eaa[_0x9938('0x1d')]=qs[_0x9938('0x1d')](_0x3ddc90[_0x9938('0x31')][_0x9938('0x1d')]);_0x3c7eaa[_0x9938('0x20')]=qs[_0x9938('0x20')](_0x3ddc90[_0x9938('0x31')][_0x9938('0x20')]);}return _0x1720f1[_0x9938('0x4b')](_0x3c7eaa);}})[_0x9938('0x25')](function(_0x53bc1c){if(_0x53bc1c){return _0x53bc1c?{'count':_0x576b5e,'rows':_0x53bc1c}:null;}})[_0x9938('0x25')](respondWithResult(_0x51d9b9,null))[_0x9938('0x43')](handleError(_0x51d9b9,null));};exports[_0x9938('0x4d')]=function(_0x38cc42,_0x2e1eeb,_0x36fdf7){if(_0x38cc42[_0x9938('0x48')]['id']){delete _0x38cc42['body']['id'];}return db['ZohoAccount'][_0x9938('0x49')]({'where':{'id':_0x38cc42['params']['id']}})[_0x9938('0x25')](handleEntityNotFound(_0x2e1eeb,null))[_0x9938('0x25')](function(_0x1693e7){if(_0x1693e7){_0x38cc42[_0x9938('0x48')][_0x9938('0x4e')]=_0x1693e7['id'];_0x38cc42[_0x9938('0x48')][_0x9938('0x4f')]=integrations[_0x9938('0x50')](_0x38cc42[_0x9938('0x48')][_0x9938('0x51')],_0x38cc42[_0x9938('0x48')][_0x9938('0x2e')]);_0x38cc42[_0x9938('0x48')][_0x9938('0x52')]=integrations[_0x9938('0x53')](_0x38cc42[_0x9938('0x48')][_0x9938('0x51')],_0x38cc42[_0x9938('0x48')][_0x9938('0x2e')]);return db[_0x9938('0x4a')][_0x9938('0x47')](_0x38cc42[_0x9938('0x48')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x9938('0x52')}]});}return null;})['then'](respondWithResult(_0x2e1eeb,null))['catch'](handleError(_0x2e1eeb,null));};function getAccessToken(_0x1a8cf8){return new Promise(function(_0x1b091b,_0x1d739b){var _0xb352ae;switch(_0x1a8cf8['zone']){case'US':_0xb352ae=_0x9938('0x54');break;case'AU':_0xb352ae='https://accounts.zoho.com.au';break;case'EU':_0xb352ae=_0x9938('0x55');break;case'IN':_0xb352ae=_0x9938('0x56');break;case'CN':_0xb352ae=_0x9938('0x57');break;default:_0xb352ae=_0x9938('0x55');break;}var _0x5bedca={'method':_0x9938('0x58'),'uri':_0xb352ae+'/oauth/v2/token','qs':{'refresh_token':_0x1a8cf8[_0x9938('0x59')],'client_id':_0x1a8cf8[_0x9938('0x5a')],'client_secret':_0x1a8cf8[_0x9938('0x5b')],'grant_type':_0x9938('0x5c')},'json':!![]};return rp(_0x5bedca)[_0x9938('0x25')](function(_0x17a418){if(_0x17a418[_0x9938('0x5d')]){_0x1b091b(_0x17a418[_0x9938('0x5d')]);}else{_0x1d739b(_0x9938('0x5e'));}})['catch'](function(_0x4d6076){_0x1d739b(_0x4d6076);});});}exports[_0x9938('0x5f')]=function(_0x435cc4,_0x1393ce,_0xdc08cc){var _0x2da5d8,_0x72e23c,_0x28382a,_0x38fc7e,_0x3208b7;return db[_0x9938('0x2c')][_0x9938('0x49')]({'where':{'id':_0x435cc4[_0x9938('0x44')]['id']},'attributes':['id',_0x9938('0x60'),'zone',_0x9938('0x5a'),_0x9938('0x5b'),_0x9938('0x61'),_0x9938('0x62'),'refreshToken']})[_0x9938('0x25')](handleEntityNotFound(_0x1393ce,null))[_0x9938('0x25')](function(_0x4e1ed0){_0x3208b7=_0x4e1ed0;_0x2da5d8=_0x3208b7['host'];_0x72e23c=_0x2da5d8===_0x9938('0x63')?'eu':_0x9938('0x64');_0x28382a=_0x3208b7[_0x9938('0x61')];var _0x2399c0=_0x28382a[_0x9938('0x65')](-0x1);if(_0x2399c0==='/'||_0x2399c0==='\x5c'||_0x2399c0===':'){_0x28382a=_0x28382a[_0x9938('0x66')](0x0,_0x28382a[_0x9938('0x67')](_0x2399c0));}if(!_0x3208b7['refreshToken']){throw new Error(_0x9938('0x68'));}return getAccessToken(_0x3208b7);})[_0x9938('0x25')](function(_0x7c57e2){if(_0x7c57e2){return rp({'method':_0x9938('0x69'),'uri':util['format'](_0x9938('0x6a'),_0x72e23c),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x7c57e2},'json':!![]});}})[_0x9938('0x25')](function(_0x41ec7b){if(_0x41ec7b){if(_0x41ec7b[_0x9938('0x6b')]&&_0x41ec7b['response']['error']){throw new Error(_0x41ec7b[_0x9938('0x6b')][_0x9938('0x28')][_0x9938('0x6c')]);}var _0x5ca0aa=[];var _0xfacbd9=[];var _0x46d39b=[_0x9938('0x6d'),'Subject',_0x9938('0x6e'),_0x9938('0x6f'),'Call_Duration',_0x9938('0x70'),_0x9938('0x71'),_0x9938('0x72')];_0xfacbd9=_['remove'](_0x41ec7b['fields'],function(_0x186472){return _0x46d39b[_0x9938('0x73')](_0x186472['api_name']);});for(var _0x1088ca=0x0;_0x1088ca<_0xfacbd9[_0x9938('0x36')];_0x1088ca++){if(_0xfacbd9[_0x1088ca]['system_mandatory']===![]){_0x5ca0aa[_0x9938('0x74')]({'id':_0xfacbd9[_0x1088ca]['id'],'name':_0xfacbd9[_0x1088ca][_0x9938('0x75')],'custom':_0xfacbd9[_0x1088ca][_0x9938('0x76')],'options':_0xfacbd9[_0x1088ca][_0x9938('0x77')]==='picklist'&&_0xfacbd9[_0x1088ca][_0x9938('0x78')]['length']>-0x1?_[_0x9938('0x3e')](_0xfacbd9[_0x1088ca][_0x9938('0x78')],function(_0x3a30ae){return{'name':_0x3a30ae,'value':_0x3a30ae};}):[]});}}return{'count':_0x5ca0aa[_0x9938('0x36')],'rows':_0x5ca0aa};}else{return{'count':0x0,'rows':[]};}})[_0x9938('0x25')](respondWithResult(_0x1393ce,null))[_0x9938('0x43')](function(_0x22d7c3){var _0x550b64=_0x435cc4[_0x9938('0x31')][_0x9938('0x79')]?0x1f4:_0x22d7c3[_0x9938('0x7a')]||0x1f4;logger[_0x9938('0x28')](_0x9938('0x7b'),_0x9938('0x5f'),_0x550b64,JSON[_0x9938('0x7c')](_0x22d7c3));delete _0x22d7c3[_0x9938('0x2a')];if(_0x550b64===0x191){_0x550b64=0x190;}_0x1393ce[_0x9938('0x1b')](_0x550b64)['send'](_0x435cc4['query'][_0x9938('0x79')]?{'message':_0x9938('0x7d'),'statusCode':_0x22d7c3[_0x9938('0x7a')]}:_0x22d7c3);});}; \ No newline at end of file +var _0xcfd1=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','include','rows','params','includeAll','options','catch','create','body','update','find','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','code','zoho.eu','com','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x3f3724,_0x4ddfe8){var _0x324c7f=function(_0x345b3a){while(--_0x345b3a){_0x3f3724['push'](_0x3f3724['shift']());}};_0x324c7f(++_0x4ddfe8);}(_0xcfd1,0x164));var _0x1cfd=function(_0x4690f1,_0x10f22f){_0x4690f1=_0x4690f1-0x0;var _0x5c2b55=_0xcfd1[_0x4690f1];return _0x5c2b55;};'use strict';var emlformat=require(_0x1cfd('0x0'));var rimraf=require(_0x1cfd('0x1'));var zipdir=require(_0x1cfd('0x2'));var jsonpatch=require(_0x1cfd('0x3'));var rp=require(_0x1cfd('0x4'));var moment=require(_0x1cfd('0x5'));var BPromise=require(_0x1cfd('0x6'));var Mustache=require('mustache');var util=require(_0x1cfd('0x7'));var path=require(_0x1cfd('0x8'));var sox=require(_0x1cfd('0x9'));var csv=require(_0x1cfd('0xa'));var ejs=require(_0x1cfd('0xb'));var fs=require('fs');var fs_extra=require(_0x1cfd('0xc'));var _=require(_0x1cfd('0xd'));var squel=require(_0x1cfd('0xe'));var crypto=require('crypto');var jsforce=require(_0x1cfd('0xf'));var deskjs=require(_0x1cfd('0x10'));var toCsv=require(_0x1cfd('0xa'));var querystring=require('querystring');var Papa=require(_0x1cfd('0x11'));var Redis=require(_0x1cfd('0x12'));var authService=require(_0x1cfd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1cfd('0x14'));var hardwareService=require(_0x1cfd('0x15'));var logger=require('../../config/logger')(_0x1cfd('0x16'));var utils=require(_0x1cfd('0x17'));var config=require(_0x1cfd('0x18'));var licenseUtil=require(_0x1cfd('0x19'));var db=require(_0x1cfd('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xe65651,_0x5c68ab){_0x5c68ab=_0x5c68ab||0xcc;return function(_0x4e492f){if(_0x4e492f){return _0xe65651[_0x1cfd('0x1b')](_0x5c68ab);}return _0xe65651[_0x1cfd('0x1c')](_0x5c68ab)[_0x1cfd('0x1d')]();};}function respondWithResult(_0x178625,_0x14741b){_0x14741b=_0x14741b||0xc8;return function(_0x2617da){if(_0x2617da){return _0x178625['status'](_0x14741b)[_0x1cfd('0x1e')](_0x2617da);}};}function respondWithFilteredResult(_0x543ea3,_0x1a271){return function(_0x1d5dc4){if(_0x1d5dc4){var _0xa0ac5c=typeof _0x1a271[_0x1cfd('0x1f')]===_0x1cfd('0x20')&&typeof _0x1a271[_0x1cfd('0x21')]===_0x1cfd('0x20');var _0x3364be=_0x1d5dc4[_0x1cfd('0x22')];var _0x5d8183=_0xa0ac5c?0x0:_0x1a271[_0x1cfd('0x1f')];var _0x1d0051=_0xa0ac5c?_0x1d5dc4['count']:_0x1a271[_0x1cfd('0x1f')]+_0x1a271[_0x1cfd('0x21')];var _0xd0108;if(_0x1d0051>=_0x3364be){_0x1d0051=_0x3364be;_0xd0108=0xc8;}else{_0xd0108=0xce;}_0x543ea3['status'](_0xd0108);return _0x543ea3[_0x1cfd('0x23')]('Content-Range',_0x5d8183+'-'+_0x1d0051+'/'+_0x3364be)[_0x1cfd('0x1e')](_0x1d5dc4);}return null;};}function patchUpdates(_0x174bf3){return function(_0x19c6f8){try{jsonpatch[_0x1cfd('0x24')](_0x19c6f8,_0x174bf3,!![]);}catch(_0x52680f){return BPromise[_0x1cfd('0x25')](_0x52680f);}return _0x19c6f8['save']();};}function saveUpdates(_0x4d2fc2,_0x36edd9){return function(_0x73224c){if(_0x73224c){return _0x73224c['update'](_0x4d2fc2)[_0x1cfd('0x26')](function(_0x1b36f7){return _0x1b36f7;});}return null;};}function removeEntity(_0xd024f1,_0x34c3d6){return function(_0x460f05){if(_0x460f05){return _0x460f05[_0x1cfd('0x27')]()['then'](function(){_0xd024f1[_0x1cfd('0x1c')](0xcc)[_0x1cfd('0x1d')]();});}};}function handleEntityNotFound(_0x2e4b1c,_0x5cb70c){return function(_0x148b25){if(!_0x148b25){_0x2e4b1c[_0x1cfd('0x1b')](0x194);}return _0x148b25;};}function handleError(_0x316b57,_0x3e1595){_0x3e1595=_0x3e1595||0x1f4;return function(_0x946205){logger[_0x1cfd('0x28')](_0x946205[_0x1cfd('0x29')]);if(_0x946205[_0x1cfd('0x2a')]){delete _0x946205[_0x1cfd('0x2a')];}_0x316b57[_0x1cfd('0x1c')](_0x3e1595)['send'](_0x946205);};}exports[_0x1cfd('0x2b')]=function(_0x58119e,_0x42b2ff){var _0x1f0527={},_0x40610e={},_0x52733f={'count':0x0,'rows':[]};var _0x4e8d0c=_['map'](db[_0x1cfd('0x2c')][_0x1cfd('0x2d')],function(_0x55eb7d){return{'name':_0x55eb7d[_0x1cfd('0x2e')],'type':_0x55eb7d[_0x1cfd('0x2f')]['key']};});_0x40610e[_0x1cfd('0x30')]=_[_0x1cfd('0x31')](_0x4e8d0c,_0x1cfd('0x2a'));_0x40610e[_0x1cfd('0x32')]=_[_0x1cfd('0x33')](_0x58119e['query']);_0x40610e[_0x1cfd('0x34')]=_[_0x1cfd('0x35')](_0x40610e['model'],_0x40610e['query']);_0x1f0527[_0x1cfd('0x36')]=_[_0x1cfd('0x35')](_0x40610e[_0x1cfd('0x30')],qs[_0x1cfd('0x37')](_0x58119e[_0x1cfd('0x32')][_0x1cfd('0x37')]));_0x1f0527[_0x1cfd('0x36')]=_0x1f0527[_0x1cfd('0x36')][_0x1cfd('0x38')]?_0x1f0527[_0x1cfd('0x36')]:_0x40610e['model'];if(!_0x58119e[_0x1cfd('0x32')][_0x1cfd('0x39')](_0x1cfd('0x3a'))){_0x1f0527['limit']=qs['limit'](_0x58119e['query'][_0x1cfd('0x21')]);_0x1f0527[_0x1cfd('0x1f')]=qs['offset'](_0x58119e[_0x1cfd('0x32')]['offset']);}_0x1f0527[_0x1cfd('0x3b')]=qs[_0x1cfd('0x3c')](_0x58119e[_0x1cfd('0x32')][_0x1cfd('0x3c')]);_0x1f0527['where']=qs[_0x1cfd('0x34')](_[_0x1cfd('0x3d')](_0x58119e[_0x1cfd('0x32')],_0x40610e['filters']),_0x4e8d0c);if(_0x58119e[_0x1cfd('0x32')]['filter']){_0x1f0527['where']=_[_0x1cfd('0x3e')](_0x1f0527[_0x1cfd('0x3f')],{'$or':_[_0x1cfd('0x31')](_0x4e8d0c,function(_0x91e312){if(_0x91e312[_0x1cfd('0x2f')]!==_0x1cfd('0x40')){var _0x2ab9d2={};_0x2ab9d2[_0x91e312[_0x1cfd('0x2a')]]={'$like':'%'+_0x58119e['query']['filter']+'%'};return _0x2ab9d2;}})});}_0x1f0527=_[_0x1cfd('0x3e')]({},_0x1f0527,_0x58119e['options']);var _0x52bdd1={'where':_0x1f0527['where']};return db[_0x1cfd('0x2c')][_0x1cfd('0x22')](_0x52bdd1)[_0x1cfd('0x26')](function(_0x13e1fc){_0x52733f['count']=_0x13e1fc;if(_0x58119e['query']['includeAll']){_0x1f0527[_0x1cfd('0x41')]=[{'all':!![]}];}return db[_0x1cfd('0x2c')]['findAll'](_0x1f0527);})[_0x1cfd('0x26')](function(_0x5711f1){_0x52733f[_0x1cfd('0x42')]=_0x5711f1;return _0x52733f;})[_0x1cfd('0x26')](respondWithFilteredResult(_0x42b2ff,_0x1f0527))['catch'](handleError(_0x42b2ff,null));};exports['show']=function(_0x447b36,_0x447921){var _0x188437={'raw':![],'where':{'id':_0x447b36[_0x1cfd('0x43')]['id']}},_0x14458f={};_0x14458f['model']=_[_0x1cfd('0x33')](db[_0x1cfd('0x2c')][_0x1cfd('0x2d')]);_0x14458f[_0x1cfd('0x32')]=_[_0x1cfd('0x33')](_0x447b36[_0x1cfd('0x32')]);_0x14458f['filters']=_[_0x1cfd('0x35')](_0x14458f[_0x1cfd('0x30')],_0x14458f[_0x1cfd('0x32')]);_0x188437[_0x1cfd('0x36')]=_[_0x1cfd('0x35')](_0x14458f[_0x1cfd('0x30')],qs[_0x1cfd('0x37')](_0x447b36[_0x1cfd('0x32')]['fields']));_0x188437[_0x1cfd('0x36')]=_0x188437[_0x1cfd('0x36')]['length']?_0x188437[_0x1cfd('0x36')]:_0x14458f[_0x1cfd('0x30')];if(_0x447b36['query'][_0x1cfd('0x44')]){_0x188437[_0x1cfd('0x41')]=[{'all':!![]}];}_0x188437=_[_0x1cfd('0x3e')]({},_0x188437,_0x447b36[_0x1cfd('0x45')]);return db[_0x1cfd('0x2c')]['find'](_0x188437)[_0x1cfd('0x26')](handleEntityNotFound(_0x447921,null))[_0x1cfd('0x26')](respondWithResult(_0x447921,null))[_0x1cfd('0x46')](handleError(_0x447921,null));};exports[_0x1cfd('0x47')]=function(_0x22631f,_0x133422){return db['ZohoAccount']['create'](_0x22631f[_0x1cfd('0x48')],{})[_0x1cfd('0x26')](respondWithResult(_0x133422,0xc9))[_0x1cfd('0x46')](handleError(_0x133422,null));};exports[_0x1cfd('0x49')]=function(_0x4acc5e,_0x2ec97e){if(_0x4acc5e[_0x1cfd('0x48')]['id']){delete _0x4acc5e[_0x1cfd('0x48')]['id'];}return db[_0x1cfd('0x2c')][_0x1cfd('0x4a')]({'where':{'id':_0x4acc5e[_0x1cfd('0x43')]['id']}})[_0x1cfd('0x26')](handleEntityNotFound(_0x2ec97e,null))[_0x1cfd('0x26')](saveUpdates(_0x4acc5e[_0x1cfd('0x48')],null))[_0x1cfd('0x26')](respondWithResult(_0x2ec97e,null))[_0x1cfd('0x46')](handleError(_0x2ec97e,null));};exports[_0x1cfd('0x27')]=function(_0xf91916,_0x4182e7){return db[_0x1cfd('0x2c')]['find']({'where':{'id':_0xf91916[_0x1cfd('0x43')]['id']}})[_0x1cfd('0x26')](handleEntityNotFound(_0x4182e7,null))['then'](removeEntity(_0x4182e7,null))[_0x1cfd('0x46')](handleError(_0x4182e7,null));};exports['getConfigurations']=function(_0x29e01d,_0x1dff86,_0x31556e){var _0x3d7cf0={};var _0x5b2519={};var _0x290d37;var _0x5cf2cf;return db[_0x1cfd('0x2c')][_0x1cfd('0x4b')]({'where':{'id':_0x29e01d[_0x1cfd('0x43')]['id']}})[_0x1cfd('0x26')](handleEntityNotFound(_0x1dff86,null))[_0x1cfd('0x26')](function(_0x246d35){if(_0x246d35){_0x290d37=_0x246d35;_0x5b2519['model']=_[_0x1cfd('0x33')](db[_0x1cfd('0x4c')][_0x1cfd('0x2d')]);_0x5b2519['query']=_[_0x1cfd('0x33')](_0x29e01d[_0x1cfd('0x32')]);_0x5b2519[_0x1cfd('0x34')]=_['intersection'](_0x5b2519['model'],_0x5b2519['query']);_0x3d7cf0['attributes']=_[_0x1cfd('0x35')](_0x5b2519['model'],qs[_0x1cfd('0x37')](_0x29e01d['query'][_0x1cfd('0x37')]));_0x3d7cf0['attributes']=_0x3d7cf0['attributes'][_0x1cfd('0x38')]?_0x3d7cf0[_0x1cfd('0x36')]:_0x5b2519[_0x1cfd('0x30')];_0x3d7cf0[_0x1cfd('0x3b')]=qs[_0x1cfd('0x3c')](_0x29e01d[_0x1cfd('0x32')][_0x1cfd('0x3c')]);_0x3d7cf0[_0x1cfd('0x3f')]=qs[_0x1cfd('0x34')](_[_0x1cfd('0x3d')](_0x29e01d['query'],_0x5b2519[_0x1cfd('0x34')]));if(_0x29e01d[_0x1cfd('0x32')]['filter']){_0x3d7cf0['where']=_[_0x1cfd('0x3e')](_0x3d7cf0[_0x1cfd('0x3f')],{'$or':_['map'](_0x3d7cf0[_0x1cfd('0x36')],function(_0x1089d1){var _0x842a64={};_0x842a64[_0x1089d1]={'$like':'%'+_0x29e01d[_0x1cfd('0x32')]['filter']+'%'};return _0x842a64;})});}_0x3d7cf0=_['merge']({},_0x3d7cf0,_0x29e01d['options']);return _0x290d37[_0x1cfd('0x4d')](_0x3d7cf0);}})[_0x1cfd('0x26')](function(_0x13f26d){if(_0x13f26d){_0x5cf2cf=_0x13f26d[_0x1cfd('0x38')];if(!_0x29e01d[_0x1cfd('0x32')]['hasOwnProperty'](_0x1cfd('0x3a'))){_0x3d7cf0[_0x1cfd('0x21')]=qs[_0x1cfd('0x21')](_0x29e01d[_0x1cfd('0x32')]['limit']);_0x3d7cf0['offset']=qs['offset'](_0x29e01d['query'][_0x1cfd('0x1f')]);}return _0x290d37[_0x1cfd('0x4d')](_0x3d7cf0);}})[_0x1cfd('0x26')](function(_0x4f66c3){if(_0x4f66c3){return _0x4f66c3?{'count':_0x5cf2cf,'rows':_0x4f66c3}:null;}})[_0x1cfd('0x26')](respondWithResult(_0x1dff86,null))[_0x1cfd('0x46')](handleError(_0x1dff86,null));};exports[_0x1cfd('0x4e')]=function(_0x4e3387,_0x3c0307,_0x354582){if(_0x4e3387['body']['id']){delete _0x4e3387[_0x1cfd('0x48')]['id'];}return db[_0x1cfd('0x2c')][_0x1cfd('0x4b')]({'where':{'id':_0x4e3387['params']['id']}})[_0x1cfd('0x26')](handleEntityNotFound(_0x3c0307,null))[_0x1cfd('0x26')](function(_0x13e662){if(_0x13e662){_0x4e3387[_0x1cfd('0x48')][_0x1cfd('0x4f')]=_0x13e662['id'];_0x4e3387[_0x1cfd('0x48')]['Subjects']=integrations[_0x1cfd('0x50')](_0x4e3387[_0x1cfd('0x48')][_0x1cfd('0x51')],_0x4e3387['body']['type']);_0x4e3387[_0x1cfd('0x48')][_0x1cfd('0x52')]=integrations[_0x1cfd('0x53')](_0x4e3387['body'][_0x1cfd('0x51')],_0x4e3387[_0x1cfd('0x48')][_0x1cfd('0x2f')]);return db[_0x1cfd('0x4c')]['create'](_0x4e3387['body'],{'include':[{'model':db[_0x1cfd('0x54')],'as':_0x1cfd('0x55')},{'model':db[_0x1cfd('0x54')],'as':_0x1cfd('0x52')}]});}return null;})[_0x1cfd('0x26')](respondWithResult(_0x3c0307,null))[_0x1cfd('0x46')](handleError(_0x3c0307,null));};function getAccessToken(_0x11b3b1){return new Promise(function(_0x4cf7b4,_0x5756f9){var _0x1ec869;switch(_0x11b3b1['zone']){case'US':_0x1ec869=_0x1cfd('0x56');break;case'AU':_0x1ec869=_0x1cfd('0x57');break;case'EU':_0x1ec869=_0x1cfd('0x58');break;case'IN':_0x1ec869='https://accounts.zoho.in';break;case'CN':_0x1ec869='https://accounts.zoho.com.cn';break;default:_0x1ec869=_0x1cfd('0x58');break;}var _0x4fb270={'method':'POST','uri':_0x1ec869+'/oauth/v2/token','qs':{'refresh_token':_0x11b3b1[_0x1cfd('0x59')],'client_id':_0x11b3b1[_0x1cfd('0x5a')],'client_secret':_0x11b3b1[_0x1cfd('0x5b')],'grant_type':_0x1cfd('0x5c')},'json':!![]};return rp(_0x4fb270)[_0x1cfd('0x26')](function(_0x581d6e){if(_0x581d6e[_0x1cfd('0x5d')]){_0x4cf7b4(_0x581d6e[_0x1cfd('0x5d')]);}else{_0x5756f9(_0x1cfd('0x5e'));}})[_0x1cfd('0x46')](function(_0x31d143){_0x5756f9(_0x31d143);});});}exports['getFields']=function(_0x34a4d1,_0x18963f,_0x1ce4f6){var _0x5eec2a,_0x3180e7,_0x35defe,_0x4aa4f2,_0x21230f;return db[_0x1cfd('0x2c')]['findOne']({'where':{'id':_0x34a4d1[_0x1cfd('0x43')]['id']},'attributes':['id',_0x1cfd('0x5f'),_0x1cfd('0x60'),_0x1cfd('0x5a'),_0x1cfd('0x5b'),_0x1cfd('0x61'),_0x1cfd('0x62'),_0x1cfd('0x59')]})[_0x1cfd('0x26')](handleEntityNotFound(_0x18963f,null))[_0x1cfd('0x26')](function(_0x5cdf8c){_0x21230f=_0x5cdf8c;_0x5eec2a=_0x21230f[_0x1cfd('0x5f')];_0x3180e7=_0x5eec2a===_0x1cfd('0x63')?'eu':_0x1cfd('0x64');_0x35defe=_0x21230f[_0x1cfd('0x61')];var _0x3107bf=_0x35defe['slice'](-0x1);if(_0x3107bf==='/'||_0x3107bf==='\x5c'||_0x3107bf===':'){_0x35defe=_0x35defe[_0x1cfd('0x65')](0x0,_0x35defe['lastIndexOf'](_0x3107bf));}if(!_0x21230f[_0x1cfd('0x59')]){throw new Error(_0x1cfd('0x66'));}return getAccessToken(_0x21230f);})[_0x1cfd('0x26')](function(_0xf28fb2){if(_0xf28fb2){return rp({'method':_0x1cfd('0x67'),'uri':util[_0x1cfd('0x68')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3180e7),'qs':{'module':_0x1cfd('0x69')},'headers':{'Authorization':_0x1cfd('0x6a')+_0xf28fb2},'json':!![]});}})[_0x1cfd('0x26')](function(_0x38e4db){if(_0x38e4db){if(_0x38e4db[_0x1cfd('0x6b')]&&_0x38e4db[_0x1cfd('0x6b')][_0x1cfd('0x28')]){throw new Error(_0x38e4db[_0x1cfd('0x6b')][_0x1cfd('0x28')][_0x1cfd('0x6c')]);}var _0x1dc938=[];var _0x226636=[];var _0x3d84d4=['Owner',_0x1cfd('0x6d'),_0x1cfd('0x6e'),_0x1cfd('0x6f'),'Call_Duration',_0x1cfd('0x70'),'Call_Start_Time',_0x1cfd('0x71')];_0x226636=_[_0x1cfd('0x72')](_0x38e4db['fields'],function(_0x35e89e){return _0x3d84d4[_0x1cfd('0x73')](_0x35e89e[_0x1cfd('0x74')]);});for(var _0x179d57=0x0;_0x179d57<_0x226636[_0x1cfd('0x38')];_0x179d57++){if(_0x226636[_0x179d57][_0x1cfd('0x75')]===![]){_0x1dc938[_0x1cfd('0x76')]({'id':_0x226636[_0x179d57]['id'],'name':_0x226636[_0x179d57]['display_label'],'custom':_0x226636[_0x179d57]['custom_field'],'options':_0x226636[_0x179d57][_0x1cfd('0x77')]===_0x1cfd('0x78')&&_0x226636[_0x179d57][_0x1cfd('0x79')][_0x1cfd('0x38')]>-0x1?_['map'](_0x226636[_0x179d57]['pick_list_values'],function(_0x17b4b1){return{'name':_0x17b4b1,'value':_0x17b4b1};}):[]});}}return{'count':_0x1dc938[_0x1cfd('0x38')],'rows':_0x1dc938};}else{return{'count':0x0,'rows':[]};}})[_0x1cfd('0x26')](respondWithResult(_0x18963f,null))[_0x1cfd('0x46')](function(_0x562c3b){var _0x27d7fe=_0x34a4d1[_0x1cfd('0x32')][_0x1cfd('0x7a')]?0x1f4:_0x562c3b[_0x1cfd('0x7b')]||0x1f4;logger[_0x1cfd('0x28')](_0x1cfd('0x7c'),_0x1cfd('0x7d'),_0x27d7fe,JSON[_0x1cfd('0x7e')](_0x562c3b));delete _0x562c3b[_0x1cfd('0x2a')];if(_0x27d7fe===0x191){_0x27d7fe=0x190;}_0x18963f[_0x1cfd('0x1c')](_0x27d7fe)['send'](_0x34a4d1[_0x1cfd('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x562c3b[_0x1cfd('0x7b')]}:_0x562c3b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f195cf8..b374fee 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 _0xeac6=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','substring','https://accounts.zoho.in','authorization_code','then','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','slice','lastIndexOf','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xeac6,0x7f));var _0x6eac=function(_0x20fa58,_0x4d78bd){_0x20fa58=_0x20fa58-0x0;var _0x479e32=_0xeac6[_0x20fa58];return _0x479e32;};'use strict';var _=require('lodash');var util=require(_0x6eac('0x0'));var logger=require(_0x6eac('0x1'))('api');var moment=require(_0x6eac('0x2'));var BPromise=require('bluebird');var rp=require(_0x6eac('0x3'));var fs=require('fs');var path=require(_0x6eac('0x4'));var rimraf=require(_0x6eac('0x5'));var config=require(_0x6eac('0x6'));var attributes=require(_0x6eac('0x7'));var integrations=require(_0x6eac('0x8'));module['exports']=function(_0x4c701b,_0x4f71bf){return _0x4c701b[_0x6eac('0x9')](_0x6eac('0xa'),attributes,{'tableName':_0x6eac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x428129,_0x1c17bf,_0x189e32){if(_0x428129[_0x6eac('0xc')](_0x6eac('0xd'))||_0x428129[_0x6eac('0xc')]('serverUrl')||_0x428129['changed'](_0x6eac('0xe'))||_0x428129[_0x6eac('0xc')]('clientSecret')||_0x428129[_0x6eac('0xc')](_0x6eac('0xf'))||_0x428129['changed']('host')){var _0x58ebc7,_0x5d50f6;_0x58ebc7=_0x428129[_0x6eac('0x10')];var _0x3ce2e8=_0x58ebc7[_0x6eac('0x11')](-0x1);if(_0x3ce2e8==='/'||_0x3ce2e8==='\x5c'||_0x3ce2e8===':'){_0x58ebc7=_0x58ebc7['substring'](0x0,_0x58ebc7[_0x6eac('0x12')](_0x3ce2e8));}switch(_0x428129[_0x6eac('0xd')]){case'US':_0x5d50f6='https://accounts.zoho.com';break;case'AU':_0x5d50f6='https://accounts.zoho.com.au';break;case'IN':_0x5d50f6='https://accounts.zoho.in';break;case'CN':_0x5d50f6=_0x6eac('0x13');break;default:_0x5d50f6=_0x6eac('0x14');break;}var _0x55f969={'method':_0x6eac('0x15'),'uri':_0x5d50f6+_0x6eac('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x428129[_0x6eac('0xe')],'client_secret':_0x428129[_0x6eac('0x17')],'redirect_uri':_0x428129[_0x6eac('0x10')],'code':_0x428129[_0x6eac('0xf')]},'headers':{'Content-Type':_0x6eac('0x18')}};return rp(_0x55f969)['then'](function(_0x2ecc5c){var _0x9e7ca2=JSON[_0x6eac('0x19')](_0x2ecc5c);if(_0x9e7ca2[_0x6eac('0x1a')]){_0x428129[_0x6eac('0x1b')]=_0x9e7ca2['refresh_token'];logger[_0x6eac('0x1c')](util[_0x6eac('0x1d')](_0x6eac('0x1e'),_0x428129[_0x6eac('0x1f')],_0x428129['id']));}else{logger[_0x6eac('0x20')](util['format'](_0x6eac('0x21'),_0x428129[_0x6eac('0x1f')],_0x428129['id']),util[_0x6eac('0x22')](_0x9e7ca2,{'showHidden':![],'depth':null}));}return _0x189e32(null,_0x1c17bf);})['catch'](function(_0x885840){logger[_0x6eac('0x20')](util[_0x6eac('0x1d')](_0x6eac('0x21'),_0x428129[_0x6eac('0x1f')],_0x428129['id']),util[_0x6eac('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x189e32(_0x885840);});}else{return _0x189e32(null,_0x1c17bf);}},'beforeUpdate':function(_0x5bd4f1,_0x440503,_0x1996db){if(_0x5bd4f1[_0x6eac('0xc')](_0x6eac('0xd'))||_0x5bd4f1[_0x6eac('0xc')](_0x6eac('0x10'))||_0x5bd4f1['changed'](_0x6eac('0xe'))||_0x5bd4f1[_0x6eac('0xc')](_0x6eac('0x17'))||_0x5bd4f1[_0x6eac('0xc')]('code')||_0x5bd4f1[_0x6eac('0xc')](_0x6eac('0x23'))){var _0x398535,_0x1d7fcf;_0x398535=_0x5bd4f1[_0x6eac('0x10')];var _0x5a1457=_0x398535[_0x6eac('0x11')](-0x1);if(_0x5a1457==='/'||_0x5a1457==='\x5c'||_0x5a1457===':'){_0x398535=_0x398535[_0x6eac('0x24')](0x0,_0x398535['lastIndexOf'](_0x5a1457));}switch(_0x5bd4f1[_0x6eac('0xd')]){case'US':_0x1d7fcf='https://accounts.zoho.com';break;case'AU':_0x1d7fcf='https://accounts.zoho.com.au';break;case'IN':_0x1d7fcf=_0x6eac('0x25');break;case'CN':_0x1d7fcf=_0x6eac('0x13');break;default:_0x1d7fcf=_0x6eac('0x14');break;}var _0x2e6cc1={'method':_0x6eac('0x15'),'uri':_0x1d7fcf+_0x6eac('0x16'),'form':{'grant_type':_0x6eac('0x26'),'client_id':_0x5bd4f1[_0x6eac('0xe')],'client_secret':_0x5bd4f1['clientSecret'],'redirect_uri':_0x5bd4f1[_0x6eac('0x10')],'code':_0x5bd4f1['code']},'headers':{'Content-Type':_0x6eac('0x18')}};return rp(_0x2e6cc1)[_0x6eac('0x27')](function(_0x192f3d){var _0x1563e3=JSON[_0x6eac('0x19')](_0x192f3d);if(_0x1563e3[_0x6eac('0x1a')]){_0x5bd4f1[_0x6eac('0x1b')]=_0x1563e3[_0x6eac('0x1a')];logger[_0x6eac('0x1c')](util[_0x6eac('0x1d')](_0x6eac('0x1e'),_0x5bd4f1[_0x6eac('0x1f')],_0x5bd4f1['id']));}else{logger[_0x6eac('0x20')](util[_0x6eac('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5bd4f1['name'],_0x5bd4f1['id']),util[_0x6eac('0x22')](_0x1563e3,{'showHidden':![],'depth':null}));}return _0x1996db(null,_0x440503);})['catch'](function(_0x4bdf4a){logger[_0x6eac('0x20')](util[_0x6eac('0x1d')](_0x6eac('0x21'),_0x5bd4f1['name'],_0x5bd4f1['id']),util[_0x6eac('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x1996db(_0x4bdf4a);});}else{return _0x1996db(null,_0x440503);}}}});}; \ No newline at end of file +var _0x737c=['/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','refreshToken','refresh_token','info','format','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','clientId','clientSecret','https://accounts.zoho.in','then','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','changed','zone','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST'];(function(_0x4b4c68,_0x14d416){var _0x1686e6=function(_0x56ab6c){while(--_0x56ab6c){_0x4b4c68['push'](_0x4b4c68['shift']());}};_0x1686e6(++_0x14d416);}(_0x737c,0x196));var _0xc737=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x737c[_0x3b6652];return _0x14d39f;};'use strict';var _=require(_0xc737('0x0'));var util=require(_0xc737('0x1'));var logger=require(_0xc737('0x2'))(_0xc737('0x3'));var moment=require(_0xc737('0x4'));var BPromise=require(_0xc737('0x5'));var rp=require(_0xc737('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc737('0x7'));var config=require(_0xc737('0x8'));var attributes=require(_0xc737('0x9'));var integrations=require(_0xc737('0xa'));module['exports']=function(_0x58cf55,_0x561dd6){return _0x58cf55[_0xc737('0xb')](_0xc737('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x208e42,_0x48ca11,_0x4e5f1d){if(_0x208e42[_0xc737('0xd')](_0xc737('0xe'))||_0x208e42['changed']('serverUrl')||_0x208e42[_0xc737('0xd')]('clientId')||_0x208e42[_0xc737('0xd')]('clientSecret')||_0x208e42[_0xc737('0xd')]('code')||_0x208e42[_0xc737('0xd')](_0xc737('0xf'))){var _0x23d542,_0x365809;_0x23d542=_0x208e42[_0xc737('0x10')];var _0x845b37=_0x23d542[_0xc737('0x11')](-0x1);if(_0x845b37==='/'||_0x845b37==='\x5c'||_0x845b37===':'){_0x23d542=_0x23d542[_0xc737('0x12')](0x0,_0x23d542[_0xc737('0x13')](_0x845b37));}switch(_0x208e42[_0xc737('0xe')]){case'US':_0x365809=_0xc737('0x14');break;case'AU':_0x365809=_0xc737('0x15');break;case'IN':_0x365809='https://accounts.zoho.in';break;case'CN':_0x365809=_0xc737('0x16');break;default:_0x365809='https://accounts.zoho.eu';break;}var _0xa8eee={'method':_0xc737('0x17'),'uri':_0x365809+_0xc737('0x18'),'form':{'grant_type':_0xc737('0x19'),'client_id':_0x208e42['clientId'],'client_secret':_0x208e42['clientSecret'],'redirect_uri':_0x208e42[_0xc737('0x10')],'code':_0x208e42[_0xc737('0x1a')]},'headers':{'Content-Type':_0xc737('0x1b')}};return rp(_0xa8eee)['then'](function(_0x2b2ac5){var _0x56999d=JSON['parse'](_0x2b2ac5);if(_0x56999d['refresh_token']){_0x208e42[_0xc737('0x1c')]=_0x56999d[_0xc737('0x1d')];logger[_0xc737('0x1e')](util[_0xc737('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x208e42[_0xc737('0x20')],_0x208e42['id']));}else{logger['error'](util[_0xc737('0x1f')](_0xc737('0x21'),_0x208e42[_0xc737('0x20')],_0x208e42['id']),util[_0xc737('0x22')](_0x56999d,{'showHidden':![],'depth':null}));}return _0x4e5f1d(null,_0x48ca11);})[_0xc737('0x23')](function(_0x3d24fe){logger['error'](util[_0xc737('0x1f')](_0xc737('0x21'),_0x208e42[_0xc737('0x20')],_0x208e42['id']),util[_0xc737('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4e5f1d(_0x3d24fe);});}else{return _0x4e5f1d(null,_0x48ca11);}},'beforeUpdate':function(_0x461cd7,_0x5f4da4,_0x27092c){if(_0x461cd7[_0xc737('0xd')](_0xc737('0xe'))||_0x461cd7['changed'](_0xc737('0x10'))||_0x461cd7[_0xc737('0xd')](_0xc737('0x24'))||_0x461cd7[_0xc737('0xd')](_0xc737('0x25'))||_0x461cd7[_0xc737('0xd')](_0xc737('0x1a'))||_0x461cd7['changed']('host')){var _0x2a4174,_0x22dca8;_0x2a4174=_0x461cd7[_0xc737('0x10')];var _0x29cfe7=_0x2a4174[_0xc737('0x11')](-0x1);if(_0x29cfe7==='/'||_0x29cfe7==='\x5c'||_0x29cfe7===':'){_0x2a4174=_0x2a4174[_0xc737('0x12')](0x0,_0x2a4174['lastIndexOf'](_0x29cfe7));}switch(_0x461cd7[_0xc737('0xe')]){case'US':_0x22dca8=_0xc737('0x14');break;case'AU':_0x22dca8=_0xc737('0x15');break;case'IN':_0x22dca8=_0xc737('0x26');break;case'CN':_0x22dca8=_0xc737('0x16');break;default:_0x22dca8='https://accounts.zoho.eu';break;}var _0x38b311={'method':_0xc737('0x17'),'uri':_0x22dca8+_0xc737('0x18'),'form':{'grant_type':_0xc737('0x19'),'client_id':_0x461cd7[_0xc737('0x24')],'client_secret':_0x461cd7[_0xc737('0x25')],'redirect_uri':_0x461cd7[_0xc737('0x10')],'code':_0x461cd7[_0xc737('0x1a')]},'headers':{'Content-Type':_0xc737('0x1b')}};return rp(_0x38b311)[_0xc737('0x27')](function(_0x147718){var _0x1672e3=JSON[_0xc737('0x28')](_0x147718);if(_0x1672e3[_0xc737('0x1d')]){_0x461cd7['refreshToken']=_0x1672e3[_0xc737('0x1d')];logger[_0xc737('0x1e')](util['format'](_0xc737('0x29'),_0x461cd7[_0xc737('0x20')],_0x461cd7['id']));}else{logger[_0xc737('0x2a')](util[_0xc737('0x1f')](_0xc737('0x21'),_0x461cd7[_0xc737('0x20')],_0x461cd7['id']),util[_0xc737('0x22')](_0x1672e3,{'showHidden':![],'depth':null}));}return _0x27092c(null,_0x5f4da4);})[_0xc737('0x23')](function(_0xdbbd6e){logger[_0xc737('0x2a')](util[_0xc737('0x1f')](_0xc737('0x21'),_0x461cd7[_0xc737('0x20')],_0x461cd7['id']),util[_0xc737('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x27092c(_0xdbbd6e);});}else{return _0x27092c(null,_0x5f4da4);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 52a0031..ed54578 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 _0xcf37=['info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','map','model','include','GetZohoAccount','ShowZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x530c47,_0x2a736a){var _0x3c6fd4=function(_0x27cde2){while(--_0x27cde2){_0x530c47['push'](_0x530c47['shift']());}};_0x3c6fd4(++_0x2a736a);}(_0xcf37,0xdc));var _0x7cf3=function(_0x710679,_0x342bc8){_0x710679=_0x710679-0x0;var _0x5a7dd0=_0xcf37[_0x710679];return _0x5a7dd0;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var moment=require(_0x7cf3('0x1'));var BPromise=require(_0x7cf3('0x2'));var rs=require(_0x7cf3('0x3'));var fs=require('fs');var Redis=require(_0x7cf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cf3('0x5'));var logger=require(_0x7cf3('0x6'))(_0x7cf3('0x7'));var config=require(_0x7cf3('0x8'));var jayson=require(_0x7cf3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd617,_0x5be340,_0x78b9a4){return new BPromise(function(_0x53502d,_0x110c99){return client['request'](_0x4fd617,_0x78b9a4)[_0x7cf3('0xa')](function(_0x377577){logger[_0x7cf3('0xb')](_0x7cf3('0xc'),_0x5be340,_0x7cf3('0xd'));logger[_0x7cf3('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5be340,_0x7cf3('0xd'),JSON[_0x7cf3('0xf')](_0x377577));if(_0x377577[_0x7cf3('0x10')]){if(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x11')]===0x1f4){logger['error'](_0x7cf3('0xc'),_0x5be340,_0x377577['error'][_0x7cf3('0x12')]);return _0x110c99(_0x377577['error'][_0x7cf3('0x12')]);}logger[_0x7cf3('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x5be340,_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);return _0x53502d(_0x377577[_0x7cf3('0x10')][_0x7cf3('0x12')]);}else{logger['info'](_0x7cf3('0xc'),_0x5be340,'request\x20sent');_0x53502d(_0x377577[_0x7cf3('0x13')][_0x7cf3('0x12')]);}})[_0x7cf3('0x14')](function(_0x14aef6){logger[_0x7cf3('0x10')](_0x7cf3('0xc'),_0x5be340,_0x14aef6);_0x110c99(_0x14aef6);});});}exports['GetZohoAccount']=function(_0x59515b){var _0xd7e354=this;return new Promise(function(_0x28895b,_0x1dc831){return db['ZohoAccount'][_0x7cf3('0x15')]({'raw':_0x59515b[_0x7cf3('0x16')]?_0x59515b[_0x7cf3('0x16')][_0x7cf3('0x17')]===undefined?!![]:![]:!![],'where':_0x59515b[_0x7cf3('0x16')]?_0x59515b['options'][_0x7cf3('0x18')]||null:null,'attributes':_0x59515b[_0x7cf3('0x16')]?_0x59515b[_0x7cf3('0x16')][_0x7cf3('0x19')]||null:null,'limit':_0x59515b[_0x7cf3('0x16')]?_0x59515b['options'][_0x7cf3('0x1a')]||null:null,'include':_0x59515b[_0x7cf3('0x16')]?_0x59515b['options']['include']?_['map'](_0x59515b[_0x7cf3('0x16')]['include'],function(_0x35f8b9){return{'model':db[_0x35f8b9['model']],'as':_0x35f8b9['as'],'attributes':_0x35f8b9[_0x7cf3('0x19')],'include':_0x35f8b9['include']?_[_0x7cf3('0x1b')](_0x35f8b9['include'],function(_0x945d95){return{'model':db[_0x945d95[_0x7cf3('0x1c')]],'as':_0x945d95['as'],'attributes':_0x945d95[_0x7cf3('0x19')],'include':_0x945d95[_0x7cf3('0x1d')]?_[_0x7cf3('0x1b')](_0x945d95[_0x7cf3('0x1d')],function(_0x3080dc){return{'model':db[_0x3080dc[_0x7cf3('0x1c')]],'as':_0x3080dc['as'],'attributes':_0x3080dc[_0x7cf3('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cbd7c){logger[_0x7cf3('0xb')](_0x7cf3('0x1e'),_0x59515b);logger[_0x7cf3('0xe')]('GetZohoAccount',_0x59515b,JSON[_0x7cf3('0xf')](_0x4cbd7c));_0x28895b(_0x4cbd7c);})[_0x7cf3('0x14')](function(_0x565ef7){logger[_0x7cf3('0x10')](_0x7cf3('0x1e'),_0x565ef7[_0x7cf3('0x12')],_0x59515b);_0x1dc831(_0xd7e354[_0x7cf3('0x10')](0x1f4,_0x565ef7[_0x7cf3('0x12')]));});});};exports[_0x7cf3('0x1f')]=function(_0x206488){var _0x422582=this;return new Promise(function(_0x41b5c4,_0x1e3ca5){return db['ZohoAccount'][_0x7cf3('0x20')]({'raw':_0x206488['options']?_0x206488[_0x7cf3('0x16')][_0x7cf3('0x17')]===undefined?!![]:![]:!![],'where':_0x206488[_0x7cf3('0x16')]?_0x206488['options'][_0x7cf3('0x18')]||null:null,'attributes':_0x206488[_0x7cf3('0x16')]?_0x206488['options'][_0x7cf3('0x19')]||null:null,'include':_0x206488[_0x7cf3('0x16')]?_0x206488[_0x7cf3('0x16')][_0x7cf3('0x1d')]?_[_0x7cf3('0x1b')](_0x206488[_0x7cf3('0x16')]['include'],function(_0x38fb92){return{'model':db[_0x38fb92[_0x7cf3('0x1c')]],'as':_0x38fb92['as'],'attributes':_0x38fb92[_0x7cf3('0x19')],'include':_0x38fb92[_0x7cf3('0x1d')]?_['map'](_0x38fb92[_0x7cf3('0x1d')],function(_0x14f61c){return{'model':db[_0x14f61c[_0x7cf3('0x1c')]],'as':_0x14f61c['as'],'attributes':_0x14f61c[_0x7cf3('0x19')],'include':_0x14f61c[_0x7cf3('0x1d')]?_[_0x7cf3('0x1b')](_0x14f61c[_0x7cf3('0x1d')],function(_0x1ef775){return{'model':db[_0x1ef775[_0x7cf3('0x1c')]],'as':_0x1ef775['as'],'attributes':_0x1ef775[_0x7cf3('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x528e3c){logger['info'](_0x7cf3('0x1f'),_0x206488);logger[_0x7cf3('0xe')](_0x7cf3('0x1f'),_0x206488,JSON[_0x7cf3('0xf')](_0x528e3c));_0x41b5c4(_0x528e3c);})[_0x7cf3('0x14')](function(_0x3918d6){logger[_0x7cf3('0x10')](_0x7cf3('0x1f'),_0x3918d6[_0x7cf3('0x12')],_0x206488);_0x1e3ca5(_0x422582['error'](0x1f4,_0x3918d6['message']));});});}; \ No newline at end of file +var _0x9512=['model','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x564075,_0x21d912){var _0x404e4b=function(_0x2539f0){while(--_0x2539f0){_0x564075['push'](_0x564075['shift']());}};_0x404e4b(++_0x21d912);}(_0x9512,0x75));var _0x2951=function(_0x456be1,_0x248c6e){_0x456be1=_0x456be1-0x0;var _0x43fa66=_0x9512[_0x456be1];return _0x43fa66;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var moment=require(_0x2951('0x2'));var BPromise=require(_0x2951('0x3'));var rs=require(_0x2951('0x4'));var fs=require('fs');var Redis=require(_0x2951('0x5'));var db=require(_0x2951('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2951('0x7'))(_0x2951('0x8'));var config=require(_0x2951('0x9'));var jayson=require(_0x2951('0xa'));var client=jayson[_0x2951('0xb')][_0x2951('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b50d9,_0x59d947,_0x2c2c11){return new BPromise(function(_0x2c5ad6,_0x3e1a01){return client[_0x2951('0xd')](_0x1b50d9,_0x2c2c11)[_0x2951('0xe')](function(_0x113b97){logger['info'](_0x2951('0xf'),_0x59d947,_0x2951('0x10'));logger[_0x2951('0x11')](_0x2951('0x12'),_0x59d947,'request\x20sent',JSON[_0x2951('0x13')](_0x113b97));if(_0x113b97[_0x2951('0x14')]){if(_0x113b97[_0x2951('0x14')][_0x2951('0x15')]===0x1f4){logger[_0x2951('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x59d947,_0x113b97[_0x2951('0x14')][_0x2951('0x16')]);return _0x3e1a01(_0x113b97[_0x2951('0x14')][_0x2951('0x16')]);}logger[_0x2951('0x14')](_0x2951('0xf'),_0x59d947,_0x113b97[_0x2951('0x14')][_0x2951('0x16')]);return _0x2c5ad6(_0x113b97[_0x2951('0x14')][_0x2951('0x16')]);}else{logger[_0x2951('0x17')](_0x2951('0xf'),_0x59d947,_0x2951('0x10'));_0x2c5ad6(_0x113b97['result'][_0x2951('0x16')]);}})[_0x2951('0x18')](function(_0x18e89d){logger[_0x2951('0x14')](_0x2951('0xf'),_0x59d947,_0x18e89d);_0x3e1a01(_0x18e89d);});});}exports[_0x2951('0x19')]=function(_0x4a9cb2){var _0x3ef33b=this;return new Promise(function(_0xdbc682,_0x3b1d7f){return db[_0x2951('0x1a')][_0x2951('0x1b')]({'raw':_0x4a9cb2['options']?_0x4a9cb2['options'][_0x2951('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a9cb2[_0x2951('0x1d')]?_0x4a9cb2[_0x2951('0x1d')][_0x2951('0x1e')]||null:null,'attributes':_0x4a9cb2['options']?_0x4a9cb2['options'][_0x2951('0x1f')]||null:null,'limit':_0x4a9cb2['options']?_0x4a9cb2[_0x2951('0x1d')][_0x2951('0x20')]||null:null,'include':_0x4a9cb2[_0x2951('0x1d')]?_0x4a9cb2[_0x2951('0x1d')][_0x2951('0x21')]?_[_0x2951('0x22')](_0x4a9cb2['options'][_0x2951('0x21')],function(_0x3e86b0){return{'model':db[_0x3e86b0['model']],'as':_0x3e86b0['as'],'attributes':_0x3e86b0[_0x2951('0x1f')],'include':_0x3e86b0[_0x2951('0x21')]?_[_0x2951('0x22')](_0x3e86b0[_0x2951('0x21')],function(_0x5ee6e2){return{'model':db[_0x5ee6e2[_0x2951('0x23')]],'as':_0x5ee6e2['as'],'attributes':_0x5ee6e2[_0x2951('0x1f')],'include':_0x5ee6e2[_0x2951('0x21')]?_[_0x2951('0x22')](_0x5ee6e2[_0x2951('0x21')],function(_0x263380){return{'model':db[_0x263380[_0x2951('0x23')]],'as':_0x263380['as'],'attributes':_0x263380[_0x2951('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2951('0xe')](function(_0x509f3e){logger[_0x2951('0x17')](_0x2951('0x19'),_0x4a9cb2);logger['debug'](_0x2951('0x19'),_0x4a9cb2,JSON[_0x2951('0x13')](_0x509f3e));_0xdbc682(_0x509f3e);})[_0x2951('0x18')](function(_0xd55127){logger[_0x2951('0x14')](_0x2951('0x19'),_0xd55127['message'],_0x4a9cb2);_0x3b1d7f(_0x3ef33b[_0x2951('0x14')](0x1f4,_0xd55127[_0x2951('0x16')]));});});};exports['ShowZohoAccount']=function(_0x1012e3){var _0x4365eb=this;return new Promise(function(_0x55c053,_0x2b1b12){return db[_0x2951('0x1a')][_0x2951('0x24')]({'raw':_0x1012e3['options']?_0x1012e3[_0x2951('0x1d')][_0x2951('0x1c')]===undefined?!![]:![]:!![],'where':_0x1012e3[_0x2951('0x1d')]?_0x1012e3[_0x2951('0x1d')][_0x2951('0x1e')]||null:null,'attributes':_0x1012e3['options']?_0x1012e3['options'][_0x2951('0x1f')]||null:null,'include':_0x1012e3[_0x2951('0x1d')]?_0x1012e3['options'][_0x2951('0x21')]?_[_0x2951('0x22')](_0x1012e3[_0x2951('0x1d')]['include'],function(_0x18e1f1){return{'model':db[_0x18e1f1[_0x2951('0x23')]],'as':_0x18e1f1['as'],'attributes':_0x18e1f1['attributes'],'include':_0x18e1f1[_0x2951('0x21')]?_[_0x2951('0x22')](_0x18e1f1[_0x2951('0x21')],function(_0x4e0847){return{'model':db[_0x4e0847[_0x2951('0x23')]],'as':_0x4e0847['as'],'attributes':_0x4e0847[_0x2951('0x1f')],'include':_0x4e0847['include']?_['map'](_0x4e0847[_0x2951('0x21')],function(_0x1b5889){return{'model':db[_0x1b5889[_0x2951('0x23')]],'as':_0x1b5889['as'],'attributes':_0x1b5889[_0x2951('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2951('0xe')](function(_0x4bddcb){logger['info'](_0x2951('0x25'),_0x1012e3);logger[_0x2951('0x11')]('ShowZohoAccount',_0x1012e3,JSON['stringify'](_0x4bddcb));_0x55c053(_0x4bddcb);})[_0x2951('0x18')](function(_0xd12e3e){logger[_0x2951('0x14')](_0x2951('0x25'),_0xd12e3e['message'],_0x1012e3);_0x2b1b12(_0x4365eb[_0x2951('0x14')](0x1f4,_0xd12e3e[_0x2951('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4cc3ad2..a915b48 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 _0xcd1d=['../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','delete','multer','util','path','connect-timeout','express'];(function(_0x527ded,_0x42ffb6){var _0xe278c6=function(_0x643f7c){while(--_0x643f7c){_0x527ded['push'](_0x527ded['shift']());}};_0xe278c6(++_0x42ffb6);}(_0xcd1d,0xb6));var _0xdcd1=function(_0x1a2abb,_0x33f559){_0x1a2abb=_0x1a2abb-0x0;var _0x53109a=_0xcd1d[_0x1a2abb];return _0x53109a;};'use strict';var multer=require(_0xdcd1('0x0'));var util=require(_0xdcd1('0x1'));var path=require(_0xdcd1('0x2'));var timeout=require(_0xdcd1('0x3'));var express=require(_0xdcd1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdcd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdcd1('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xdcd1('0x7')]('/',auth['isAuthenticated'](),controller[_0xdcd1('0x8')]);router[_0xdcd1('0x7')](_0xdcd1('0x9'),auth[_0xdcd1('0xa')](),controller['show']);router['get'](_0xdcd1('0xb'),auth[_0xdcd1('0xa')](),controller['getFields']);router[_0xdcd1('0x7')](_0xdcd1('0xc'),auth[_0xdcd1('0xa')](),controller['getSubjects']);router[_0xdcd1('0x7')](_0xdcd1('0xd'),auth[_0xdcd1('0xa')](),controller[_0xdcd1('0xe')]);router['post']('/',auth[_0xdcd1('0xa')](),controller[_0xdcd1('0xf')]);router['put'](_0xdcd1('0x9'),auth[_0xdcd1('0xa')](),controller['update']);router[_0xdcd1('0x10')](_0xdcd1('0x9'),auth[_0xdcd1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdf2a=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/descriptions','post'];(function(_0x5cfb92,_0x5797e6){var _0x1cd7c2=function(_0x1bb452){while(--_0x1bb452){_0x5cfb92['push'](_0x5cfb92['shift']());}};_0x1cd7c2(++_0x5797e6);}(_0xdf2a,0x12a));var _0xadf2=function(_0x3fd773,_0x5521ba){_0x3fd773=_0x3fd773-0x0;var _0x12d32f=_0xdf2a[_0x3fd773];return _0x12d32f;};'use strict';var multer=require(_0xadf2('0x0'));var util=require(_0xadf2('0x1'));var path=require(_0xadf2('0x2'));var timeout=require(_0xadf2('0x3'));var express=require(_0xadf2('0x4'));var router=express[_0xadf2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xadf2('0x6'));var interaction=require(_0xadf2('0x7'));var config=require(_0xadf2('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0xadf2('0x9')]('/',auth[_0xadf2('0xa')](),controller[_0xadf2('0xb')]);router[_0xadf2('0x9')](_0xadf2('0xc'),auth[_0xadf2('0xa')](),controller[_0xadf2('0xd')]);router[_0xadf2('0x9')]('/:id/fields',auth[_0xadf2('0xa')](),controller[_0xadf2('0xe')]);router[_0xadf2('0x9')]('/:id/subjects',auth[_0xadf2('0xa')](),controller['getSubjects']);router['get'](_0xadf2('0xf'),auth[_0xadf2('0xa')](),controller['getDescriptions']);router[_0xadf2('0x10')]('/',auth[_0xadf2('0xa')](),controller['create']);router[_0xadf2('0x11')](_0xadf2('0xc'),auth[_0xadf2('0xa')](),controller[_0xadf2('0x12')]);router[_0xadf2('0x13')](_0xadf2('0xc'),auth[_0xadf2('0xa')](),controller['destroy']);module[_0xadf2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index c6a20c2..b498d60 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 _0xa2d7=['nothing','lead','contact_lead','sequelize','exports','STRING','ENUM','contact'];(function(_0x193927,_0x545c88){var _0x1d21b1=function(_0x55ab7d){while(--_0x55ab7d){_0x193927['push'](_0x193927['shift']());}};_0x1d21b1(++_0x545c88);}(_0xa2d7,0xbb));var _0x7a2d=function(_0x4dae98,_0x1374bf){_0x4dae98=_0x4dae98-0x0;var _0x6294a7=_0xa2d7[_0x4dae98];return _0x6294a7;};'use strict';var Sequelize=require(_0x7a2d('0x0'));module[_0x7a2d('0x1')]={'name':{'type':Sequelize[_0x7a2d('0x2')]},'moduleCreate':{'type':Sequelize[_0x7a2d('0x3')]('lead',_0x7a2d('0x4'),_0x7a2d('0x5')),'defaultValue':_0x7a2d('0x6')},'moduleSearch':{'type':Sequelize[_0x7a2d('0x3')]('contact_lead',_0x7a2d('0x4'),_0x7a2d('0x6')),'defaultValue':_0x7a2d('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x35b5=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x53c5ec,_0x5ec701){var _0x434d49=function(_0x3d4240){while(--_0x3d4240){_0x53c5ec['push'](_0x53c5ec['shift']());}};_0x434d49(++_0x5ec701);}(_0x35b5,0x14a));var _0x535b=function(_0x5a3362,_0x138ef2){_0x5a3362=_0x5a3362-0x0;var _0x13d464=_0x35b5[_0x5a3362];return _0x13d464;};'use strict';var Sequelize=require(_0x535b('0x0'));module[_0x535b('0x1')]={'name':{'type':Sequelize[_0x535b('0x2')]},'moduleCreate':{'type':Sequelize[_0x535b('0x3')](_0x535b('0x4'),_0x535b('0x5'),_0x535b('0x6')),'defaultValue':_0x535b('0x4')},'moduleSearch':{'type':Sequelize[_0x535b('0x3')](_0x535b('0x7'),_0x535b('0x5'),'lead'),'defaultValue':_0x535b('0x7')},'description':{'type':Sequelize[_0x535b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 940902e..b319d5a 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 _0x684b=['create','body','update','getFields','ZohoField','getSubjects','findOne','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','name','index','map','ZohoConfiguration','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','rawAttributes','length','options','find'];(function(_0x1e2671,_0x4cf90a){var _0x492489=function(_0x1440b6){while(--_0x1440b6){_0x1e2671['push'](_0x1e2671['shift']());}};_0x492489(++_0x4cf90a);}(_0x684b,0xad));var _0xb684=function(_0x5d6fb4,_0x23df56){_0x5d6fb4=_0x5d6fb4-0x0;var _0x4d3363=_0x684b[_0x5d6fb4];return _0x4d3363;};'use strict';var emlformat=require(_0xb684('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb684('0x1'));var jsonpatch=require(_0xb684('0x2'));var rp=require(_0xb684('0x3'));var moment=require(_0xb684('0x4'));var BPromise=require(_0xb684('0x5'));var Mustache=require(_0xb684('0x6'));var util=require(_0xb684('0x7'));var path=require('path');var sox=require(_0xb684('0x8'));var csv=require(_0xb684('0x9'));var ejs=require(_0xb684('0xa'));var fs=require('fs');var fs_extra=require(_0xb684('0xb'));var _=require(_0xb684('0xc'));var squel=require('squel');var crypto=require(_0xb684('0xd'));var jsforce=require(_0xb684('0xe'));var deskjs=require(_0xb684('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb684('0x10'));var Papa=require(_0xb684('0x11'));var Redis=require(_0xb684('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb684('0x13'));var as=require(_0xb684('0x14'));var hardwareService=require(_0xb684('0x15'));var logger=require(_0xb684('0x16'))(_0xb684('0x17'));var utils=require(_0xb684('0x18'));var config=require(_0xb684('0x19'));var licenseUtil=require(_0xb684('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6c74,_0x216c3e){_0x216c3e=_0x216c3e||0xcc;return function(_0x53333f){if(_0x53333f){return _0x5d6c74[_0xb684('0x1b')](_0x216c3e);}return _0x5d6c74[_0xb684('0x1c')](_0x216c3e)['end']();};}function respondWithResult(_0x110b1e,_0x13be7a){_0x13be7a=_0x13be7a||0xc8;return function(_0x53bd6c){if(_0x53bd6c){return _0x110b1e['status'](_0x13be7a)[_0xb684('0x1d')](_0x53bd6c);}};}function respondWithFilteredResult(_0x22dbd1,_0x481427){return function(_0x37fa8e){if(_0x37fa8e){var _0x4b0dd8=typeof _0x481427[_0xb684('0x1e')]===_0xb684('0x1f')&&typeof _0x481427[_0xb684('0x20')]===_0xb684('0x1f');var _0x15d9df=_0x37fa8e[_0xb684('0x21')];var _0x551d87=_0x4b0dd8?0x0:_0x481427[_0xb684('0x1e')];var _0x1279fb=_0x4b0dd8?_0x37fa8e[_0xb684('0x21')]:_0x481427['offset']+_0x481427[_0xb684('0x20')];var _0x53967c;if(_0x1279fb>=_0x15d9df){_0x1279fb=_0x15d9df;_0x53967c=0xc8;}else{_0x53967c=0xce;}_0x22dbd1[_0xb684('0x1c')](_0x53967c);return _0x22dbd1[_0xb684('0x22')]('Content-Range',_0x551d87+'-'+_0x1279fb+'/'+_0x15d9df)[_0xb684('0x1d')](_0x37fa8e);}return null;};}function patchUpdates(_0x447136){return function(_0x244595){try{jsonpatch[_0xb684('0x23')](_0x244595,_0x447136,!![]);}catch(_0xfd637c){return BPromise[_0xb684('0x24')](_0xfd637c);}return _0x244595[_0xb684('0x25')]();};}function saveUpdates(_0x1d8654,_0x4016a0){return function(_0x281da6){if(_0x281da6){return _0x281da6['update'](_0x1d8654)[_0xb684('0x26')](function(_0x19b9a7){return _0x19b9a7;});}return null;};}function removeEntity(_0x339175,_0x3fccdf){return function(_0x2d5cb2){if(_0x2d5cb2){return _0x2d5cb2[_0xb684('0x27')]()[_0xb684('0x26')](function(){_0x339175[_0xb684('0x1c')](0xcc)[_0xb684('0x28')]();});}};}function handleEntityNotFound(_0xaf12ff,_0xaa1678){return function(_0x15d0e0){if(!_0x15d0e0){_0xaf12ff['sendStatus'](0x194);}return _0x15d0e0;};}function handleError(_0x274c2d,_0x5cacb8){_0x5cacb8=_0x5cacb8||0x1f4;return function(_0x5cd1b2){logger[_0xb684('0x29')](_0x5cd1b2[_0xb684('0x2a')]);if(_0x5cd1b2[_0xb684('0x2b')]){delete _0x5cd1b2[_0xb684('0x2b')];}_0x274c2d['status'](_0x5cacb8)['send'](_0x5cd1b2);};}exports[_0xb684('0x2c')]=function(_0x24e850,_0x5c3ecc){var _0x5195a5={},_0x2dac56={},_0x5f11ca={'count':0x0,'rows':[]};var _0x526563=_[_0xb684('0x2d')](db[_0xb684('0x2e')]['rawAttributes'],function(_0x1ffc9b){return{'name':_0x1ffc9b['fieldName'],'type':_0x1ffc9b[_0xb684('0x2f')]['key']};});_0x2dac56['model']=_[_0xb684('0x2d')](_0x526563,_0xb684('0x2b'));_0x2dac56[_0xb684('0x30')]=_[_0xb684('0x31')](_0x24e850[_0xb684('0x30')]);_0x2dac56[_0xb684('0x32')]=_['intersection'](_0x2dac56['model'],_0x2dac56[_0xb684('0x30')]);_0x5195a5['attributes']=_[_0xb684('0x33')](_0x2dac56[_0xb684('0x34')],qs[_0xb684('0x35')](_0x24e850[_0xb684('0x30')][_0xb684('0x35')]));_0x5195a5[_0xb684('0x36')]=_0x5195a5[_0xb684('0x36')]['length']?_0x5195a5[_0xb684('0x36')]:_0x2dac56[_0xb684('0x34')];if(!_0x24e850[_0xb684('0x30')][_0xb684('0x37')]('nolimit')){_0x5195a5[_0xb684('0x20')]=qs['limit'](_0x24e850[_0xb684('0x30')][_0xb684('0x20')]);_0x5195a5['offset']=qs[_0xb684('0x1e')](_0x24e850[_0xb684('0x30')]['offset']);}_0x5195a5[_0xb684('0x38')]=qs[_0xb684('0x39')](_0x24e850[_0xb684('0x30')][_0xb684('0x39')]);_0x5195a5['where']=qs[_0xb684('0x32')](_[_0xb684('0x3a')](_0x24e850[_0xb684('0x30')],_0x2dac56[_0xb684('0x32')]),_0x526563);if(_0x24e850[_0xb684('0x30')][_0xb684('0x3b')]){_0x5195a5[_0xb684('0x3c')]=_['merge'](_0x5195a5['where'],{'$or':_[_0xb684('0x2d')](_0x526563,function(_0x2eb794){if(_0x2eb794[_0xb684('0x2f')]!==_0xb684('0x3d')){var _0x48e2d9={};_0x48e2d9[_0x2eb794[_0xb684('0x2b')]]={'$like':'%'+_0x24e850['query']['filter']+'%'};return _0x48e2d9;}})});}_0x5195a5=_[_0xb684('0x3e')]({},_0x5195a5,_0x24e850['options']);var _0x494cb3={'where':_0x5195a5[_0xb684('0x3c')]};return db[_0xb684('0x2e')][_0xb684('0x21')](_0x494cb3)['then'](function(_0x4e2fb7){_0x5f11ca[_0xb684('0x21')]=_0x4e2fb7;if(_0x24e850['query'][_0xb684('0x3f')]){_0x5195a5[_0xb684('0x40')]=[{'all':!![]}];}return db[_0xb684('0x2e')]['findAll'](_0x5195a5);})[_0xb684('0x26')](function(_0x5e195e){_0x5f11ca[_0xb684('0x41')]=_0x5e195e;return _0x5f11ca;})[_0xb684('0x26')](respondWithFilteredResult(_0x5c3ecc,_0x5195a5))[_0xb684('0x42')](handleError(_0x5c3ecc,null));};exports[_0xb684('0x43')]=function(_0x1064e5,_0x1bbe5d){var _0x4a9bf9={'raw':![],'where':{'id':_0x1064e5[_0xb684('0x44')]['id']}},_0x389d5b={};_0x389d5b[_0xb684('0x34')]=_[_0xb684('0x31')](db[_0xb684('0x2e')][_0xb684('0x45')]);_0x389d5b[_0xb684('0x30')]=_[_0xb684('0x31')](_0x1064e5['query']);_0x389d5b[_0xb684('0x32')]=_['intersection'](_0x389d5b[_0xb684('0x34')],_0x389d5b['query']);_0x4a9bf9[_0xb684('0x36')]=_[_0xb684('0x33')](_0x389d5b[_0xb684('0x34')],qs[_0xb684('0x35')](_0x1064e5[_0xb684('0x30')]['fields']));_0x4a9bf9['attributes']=_0x4a9bf9[_0xb684('0x36')][_0xb684('0x46')]?_0x4a9bf9['attributes']:_0x389d5b[_0xb684('0x34')];if(_0x1064e5[_0xb684('0x30')][_0xb684('0x3f')]){_0x4a9bf9[_0xb684('0x40')]=[{'all':!![]}];}_0x4a9bf9=_['merge']({},_0x4a9bf9,_0x1064e5[_0xb684('0x47')]);return db[_0xb684('0x2e')][_0xb684('0x48')](_0x4a9bf9)['then'](handleEntityNotFound(_0x1bbe5d,null))[_0xb684('0x26')](respondWithResult(_0x1bbe5d,null))[_0xb684('0x42')](handleError(_0x1bbe5d,null));};exports[_0xb684('0x49')]=function(_0x4e0cc1,_0x559663){return db[_0xb684('0x2e')][_0xb684('0x49')](_0x4e0cc1[_0xb684('0x4a')],{})[_0xb684('0x26')](respondWithResult(_0x559663,0xc9))[_0xb684('0x42')](handleError(_0x559663,null));};exports[_0xb684('0x4b')]=function(_0x2a16a3,_0x3ec4d5){if(_0x2a16a3[_0xb684('0x4a')]['id']){delete _0x2a16a3['body']['id'];}return db['ZohoConfiguration'][_0xb684('0x48')]({'where':{'id':_0x2a16a3[_0xb684('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ec4d5,null))[_0xb684('0x26')](saveUpdates(_0x2a16a3[_0xb684('0x4a')],null))[_0xb684('0x26')](respondWithResult(_0x3ec4d5,null))['catch'](handleError(_0x3ec4d5,null));};exports[_0xb684('0x27')]=function(_0x18c06a,_0x35aedc){return db[_0xb684('0x2e')][_0xb684('0x48')]({'where':{'id':_0x18c06a[_0xb684('0x44')]['id']}})['then'](handleEntityNotFound(_0x35aedc,null))[_0xb684('0x26')](removeEntity(_0x35aedc,null))[_0xb684('0x42')](handleError(_0x35aedc,null));};exports[_0xb684('0x4c')]=function(_0x2631f5,_0x5aee05,_0x231005){var _0x4071ac={};var _0x4dd696={};var _0x13f8e2;var _0x217969;return db[_0xb684('0x2e')]['findOne']({'where':{'id':_0x2631f5[_0xb684('0x44')]['id']}})[_0xb684('0x26')](handleEntityNotFound(_0x5aee05,null))[_0xb684('0x26')](function(_0x136bf2){if(_0x136bf2){_0x13f8e2=_0x136bf2;_0x4dd696['model']=_[_0xb684('0x31')](db[_0xb684('0x4d')][_0xb684('0x45')]);_0x4dd696[_0xb684('0x30')]=_[_0xb684('0x31')](_0x2631f5['query']);_0x4dd696[_0xb684('0x32')]=_[_0xb684('0x33')](_0x4dd696[_0xb684('0x34')],_0x4dd696['query']);_0x4071ac[_0xb684('0x36')]=_[_0xb684('0x33')](_0x4dd696['model'],qs['fields'](_0x2631f5[_0xb684('0x30')][_0xb684('0x35')]));_0x4071ac['attributes']=_0x4071ac[_0xb684('0x36')][_0xb684('0x46')]?_0x4071ac[_0xb684('0x36')]:_0x4dd696[_0xb684('0x34')];_0x4071ac[_0xb684('0x38')]=qs[_0xb684('0x39')](_0x2631f5['query'][_0xb684('0x39')]);_0x4071ac[_0xb684('0x3c')]=qs[_0xb684('0x32')](_[_0xb684('0x3a')](_0x2631f5[_0xb684('0x30')],_0x4dd696[_0xb684('0x32')]));if(_0x2631f5['query']['filter']){_0x4071ac[_0xb684('0x3c')]=_[_0xb684('0x3e')](_0x4071ac[_0xb684('0x3c')],{'$or':_['map'](_0x4071ac[_0xb684('0x36')],function(_0x4516c6){var _0x32f69f={};_0x32f69f[_0x4516c6]={'$like':'%'+_0x2631f5[_0xb684('0x30')][_0xb684('0x3b')]+'%'};return _0x32f69f;})});}_0x4071ac=_['merge']({},_0x4071ac,_0x2631f5['options']);return _0x13f8e2[_0xb684('0x4c')](_0x4071ac);}})[_0xb684('0x26')](function(_0x41dbad){if(_0x41dbad){_0x217969=_0x41dbad[_0xb684('0x46')];if(!_0x2631f5['query'][_0xb684('0x37')]('nolimit')){_0x4071ac[_0xb684('0x20')]=qs[_0xb684('0x20')](_0x2631f5[_0xb684('0x30')]['limit']);_0x4071ac[_0xb684('0x1e')]=qs[_0xb684('0x1e')](_0x2631f5[_0xb684('0x30')][_0xb684('0x1e')]);}return _0x13f8e2[_0xb684('0x4c')](_0x4071ac);}})[_0xb684('0x26')](function(_0x4cbc88){if(_0x4cbc88){return _0x4cbc88?{'count':_0x217969,'rows':_0x4cbc88}:null;}})['then'](respondWithResult(_0x5aee05,null))[_0xb684('0x42')](handleError(_0x5aee05,null));};exports[_0xb684('0x4e')]=function(_0x526ee2,_0x3cbaa5,_0xd867d1){var _0x349ea7={};var _0x559bfb={};var _0x212387;var _0x4d5a46;return db[_0xb684('0x2e')][_0xb684('0x4f')]({'where':{'id':_0x526ee2['params']['id']}})[_0xb684('0x26')](handleEntityNotFound(_0x3cbaa5,null))[_0xb684('0x26')](function(_0x39d7a2){if(_0x39d7a2){_0x212387=_0x39d7a2;_0x559bfb[_0xb684('0x34')]=_[_0xb684('0x31')](db[_0xb684('0x4d')][_0xb684('0x45')]);_0x559bfb[_0xb684('0x30')]=_[_0xb684('0x31')](_0x526ee2[_0xb684('0x30')]);_0x559bfb['filters']=_[_0xb684('0x33')](_0x559bfb[_0xb684('0x34')],_0x559bfb[_0xb684('0x30')]);_0x349ea7['attributes']=_[_0xb684('0x33')](_0x559bfb[_0xb684('0x34')],qs[_0xb684('0x35')](_0x526ee2[_0xb684('0x30')][_0xb684('0x35')]));_0x349ea7[_0xb684('0x36')]=_0x349ea7[_0xb684('0x36')][_0xb684('0x46')]?_0x349ea7[_0xb684('0x36')]:_0x559bfb[_0xb684('0x34')];_0x349ea7['order']=qs[_0xb684('0x39')](_0x526ee2[_0xb684('0x30')][_0xb684('0x39')]);_0x349ea7['where']=qs['filters'](_[_0xb684('0x3a')](_0x526ee2['query'],_0x559bfb[_0xb684('0x32')]));if(_0x526ee2['query'][_0xb684('0x3b')]){_0x349ea7[_0xb684('0x3c')]=_[_0xb684('0x3e')](_0x349ea7[_0xb684('0x3c')],{'$or':_['map'](_0x349ea7[_0xb684('0x36')],function(_0x381dd2){var _0x3cf194={};_0x3cf194[_0x381dd2]={'$like':'%'+_0x526ee2[_0xb684('0x30')][_0xb684('0x3b')]+'%'};return _0x3cf194;})});}_0x349ea7=_[_0xb684('0x3e')]({},_0x349ea7,_0x526ee2[_0xb684('0x47')]);return _0x212387[_0xb684('0x4e')](_0x349ea7);}})[_0xb684('0x26')](function(_0x569078){if(_0x569078){_0x4d5a46=_0x569078[_0xb684('0x46')];if(!_0x526ee2[_0xb684('0x30')][_0xb684('0x37')](_0xb684('0x50'))){_0x349ea7['limit']=qs['limit'](_0x526ee2[_0xb684('0x30')][_0xb684('0x20')]);_0x349ea7['offset']=qs[_0xb684('0x1e')](_0x526ee2[_0xb684('0x30')]['offset']);}return _0x212387[_0xb684('0x4e')](_0x349ea7);}})['then'](function(_0x461369){if(_0x461369){return _0x461369?{'count':_0x4d5a46,'rows':_0x461369}:null;}})['then'](respondWithResult(_0x3cbaa5,null))['catch'](handleError(_0x3cbaa5,null));};exports['getDescriptions']=function(_0x3d0afb,_0x127d6b,_0x52c54a){var _0x5cbbdc={};var _0x120eb6={};var _0x2c8dfa;var _0x4f5dbd;return db[_0xb684('0x2e')][_0xb684('0x4f')]({'where':{'id':_0x3d0afb[_0xb684('0x44')]['id']}})[_0xb684('0x26')](handleEntityNotFound(_0x127d6b,null))[_0xb684('0x26')](function(_0x5c5911){if(_0x5c5911){_0x2c8dfa=_0x5c5911;_0x120eb6['model']=_[_0xb684('0x31')](db[_0xb684('0x4d')][_0xb684('0x45')]);_0x120eb6[_0xb684('0x30')]=_['keys'](_0x3d0afb[_0xb684('0x30')]);_0x120eb6[_0xb684('0x32')]=_[_0xb684('0x33')](_0x120eb6[_0xb684('0x34')],_0x120eb6[_0xb684('0x30')]);_0x5cbbdc[_0xb684('0x36')]=_[_0xb684('0x33')](_0x120eb6['model'],qs[_0xb684('0x35')](_0x3d0afb['query'][_0xb684('0x35')]));_0x5cbbdc[_0xb684('0x36')]=_0x5cbbdc[_0xb684('0x36')]['length']?_0x5cbbdc['attributes']:_0x120eb6['model'];_0x5cbbdc[_0xb684('0x38')]=qs['sort'](_0x3d0afb['query']['sort']);_0x5cbbdc[_0xb684('0x3c')]=qs[_0xb684('0x32')](_[_0xb684('0x3a')](_0x3d0afb['query'],_0x120eb6[_0xb684('0x32')]));if(_0x3d0afb['query']['filter']){_0x5cbbdc[_0xb684('0x3c')]=_[_0xb684('0x3e')](_0x5cbbdc['where'],{'$or':_[_0xb684('0x2d')](_0x5cbbdc[_0xb684('0x36')],function(_0x5a558d){var _0x548b4b={};_0x548b4b[_0x5a558d]={'$like':'%'+_0x3d0afb[_0xb684('0x30')][_0xb684('0x3b')]+'%'};return _0x548b4b;})});}_0x5cbbdc=_[_0xb684('0x3e')]({},_0x5cbbdc,_0x3d0afb['options']);return _0x2c8dfa[_0xb684('0x51')](_0x5cbbdc);}})[_0xb684('0x26')](function(_0x19923d){if(_0x19923d){_0x4f5dbd=_0x19923d['length'];if(!_0x3d0afb[_0xb684('0x30')][_0xb684('0x37')](_0xb684('0x50'))){_0x5cbbdc[_0xb684('0x20')]=qs[_0xb684('0x20')](_0x3d0afb[_0xb684('0x30')][_0xb684('0x20')]);_0x5cbbdc[_0xb684('0x1e')]=qs['offset'](_0x3d0afb['query'][_0xb684('0x1e')]);}return _0x2c8dfa['getDescriptions'](_0x5cbbdc);}})[_0xb684('0x26')](function(_0x31aef8){if(_0x31aef8){return _0x31aef8?{'count':_0x4f5dbd,'rows':_0x31aef8}:null;}})[_0xb684('0x26')](respondWithResult(_0x127d6b,null))[_0xb684('0x42')](handleError(_0x127d6b,null));}; \ No newline at end of file +var _0x84df=['hasOwnProperty','order','sort','where','merge','filter','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','getFields','ZohoField','rawAttributes','pick','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','ZohoConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3a34cc,_0x5c8d6c){var _0x6fe3f2=function(_0x5dc815){while(--_0x5dc815){_0x3a34cc['push'](_0x3a34cc['shift']());}};_0x6fe3f2(++_0x5c8d6c);}(_0x84df,0xb7));var _0xf84d=function(_0xa087f5,_0x34fd10){_0xa087f5=_0xa087f5-0x0;var _0x4c8806=_0x84df[_0xa087f5];return _0x4c8806;};'use strict';var emlformat=require(_0xf84d('0x0'));var rimraf=require(_0xf84d('0x1'));var zipdir=require(_0xf84d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf84d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf84d('0x4'));var util=require(_0xf84d('0x5'));var path=require(_0xf84d('0x6'));var sox=require(_0xf84d('0x7'));var csv=require(_0xf84d('0x8'));var ejs=require(_0xf84d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf84d('0xa'));var squel=require(_0xf84d('0xb'));var crypto=require(_0xf84d('0xc'));var jsforce=require(_0xf84d('0xd'));var deskjs=require(_0xf84d('0xe'));var toCsv=require(_0xf84d('0x8'));var querystring=require(_0xf84d('0xf'));var Papa=require(_0xf84d('0x10'));var Redis=require('ioredis');var authService=require(_0xf84d('0x11'));var qs=require(_0xf84d('0x12'));var as=require(_0xf84d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf84d('0x14'));var utils=require(_0xf84d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf84d('0x16'));var db=require(_0xf84d('0x17'))['db'];function respondWithStatusCode(_0x481b28,_0x2f3c8e){_0x2f3c8e=_0x2f3c8e||0xcc;return function(_0x5959e2){if(_0x5959e2){return _0x481b28[_0xf84d('0x18')](_0x2f3c8e);}return _0x481b28[_0xf84d('0x19')](_0x2f3c8e)['end']();};}function respondWithResult(_0x4dd9a8,_0x1b4bb6){_0x1b4bb6=_0x1b4bb6||0xc8;return function(_0x1e2949){if(_0x1e2949){return _0x4dd9a8[_0xf84d('0x19')](_0x1b4bb6)[_0xf84d('0x1a')](_0x1e2949);}};}function respondWithFilteredResult(_0x4f8862,_0x1628f6){return function(_0x1bc742){if(_0x1bc742){var _0x584f69=typeof _0x1628f6[_0xf84d('0x1b')]===_0xf84d('0x1c')&&typeof _0x1628f6[_0xf84d('0x1d')]===_0xf84d('0x1c');var _0x79b633=_0x1bc742[_0xf84d('0x1e')];var _0x56f4b3=_0x584f69?0x0:_0x1628f6[_0xf84d('0x1b')];var _0x51f24a=_0x584f69?_0x1bc742[_0xf84d('0x1e')]:_0x1628f6['offset']+_0x1628f6[_0xf84d('0x1d')];var _0x46e477;if(_0x51f24a>=_0x79b633){_0x51f24a=_0x79b633;_0x46e477=0xc8;}else{_0x46e477=0xce;}_0x4f8862[_0xf84d('0x19')](_0x46e477);return _0x4f8862[_0xf84d('0x1f')](_0xf84d('0x20'),_0x56f4b3+'-'+_0x51f24a+'/'+_0x79b633)['json'](_0x1bc742);}return null;};}function patchUpdates(_0xc7c00e){return function(_0x2258e9){try{jsonpatch[_0xf84d('0x21')](_0x2258e9,_0xc7c00e,!![]);}catch(_0xd47319){return BPromise['reject'](_0xd47319);}return _0x2258e9[_0xf84d('0x22')]();};}function saveUpdates(_0x1a4537,_0x49e8e3){return function(_0x241e61){if(_0x241e61){return _0x241e61[_0xf84d('0x23')](_0x1a4537)['then'](function(_0x3a756e){return _0x3a756e;});}return null;};}function removeEntity(_0x158d5c,_0x27df20){return function(_0x4fd2e7){if(_0x4fd2e7){return _0x4fd2e7[_0xf84d('0x24')]()['then'](function(){_0x158d5c['status'](0xcc)[_0xf84d('0x25')]();});}};}function handleEntityNotFound(_0x3827ae,_0x4e223b){return function(_0x1e8598){if(!_0x1e8598){_0x3827ae[_0xf84d('0x18')](0x194);}return _0x1e8598;};}function handleError(_0x2ded4d,_0x21099d){_0x21099d=_0x21099d||0x1f4;return function(_0x46d527){logger['error'](_0x46d527[_0xf84d('0x26')]);if(_0x46d527[_0xf84d('0x27')]){delete _0x46d527[_0xf84d('0x27')];}_0x2ded4d['status'](_0x21099d)[_0xf84d('0x28')](_0x46d527);};}exports[_0xf84d('0x29')]=function(_0x567a59,_0x4b74c1){var _0x10b64c={},_0x3d8671={},_0x18e869={'count':0x0,'rows':[]};var _0x15327c=_[_0xf84d('0x2a')](db[_0xf84d('0x2b')]['rawAttributes'],function(_0x3730ba){return{'name':_0x3730ba[_0xf84d('0x2c')],'type':_0x3730ba[_0xf84d('0x2d')]['key']};});_0x3d8671[_0xf84d('0x2e')]=_['map'](_0x15327c,'name');_0x3d8671[_0xf84d('0x2f')]=_[_0xf84d('0x30')](_0x567a59['query']);_0x3d8671[_0xf84d('0x31')]=_[_0xf84d('0x32')](_0x3d8671[_0xf84d('0x2e')],_0x3d8671['query']);_0x10b64c[_0xf84d('0x33')]=_[_0xf84d('0x32')](_0x3d8671['model'],qs[_0xf84d('0x34')](_0x567a59[_0xf84d('0x2f')][_0xf84d('0x34')]));_0x10b64c['attributes']=_0x10b64c[_0xf84d('0x33')][_0xf84d('0x35')]?_0x10b64c[_0xf84d('0x33')]:_0x3d8671['model'];if(!_0x567a59['query'][_0xf84d('0x36')]('nolimit')){_0x10b64c[_0xf84d('0x1d')]=qs['limit'](_0x567a59[_0xf84d('0x2f')][_0xf84d('0x1d')]);_0x10b64c[_0xf84d('0x1b')]=qs[_0xf84d('0x1b')](_0x567a59['query'][_0xf84d('0x1b')]);}_0x10b64c[_0xf84d('0x37')]=qs[_0xf84d('0x38')](_0x567a59[_0xf84d('0x2f')][_0xf84d('0x38')]);_0x10b64c[_0xf84d('0x39')]=qs[_0xf84d('0x31')](_['pick'](_0x567a59['query'],_0x3d8671[_0xf84d('0x31')]),_0x15327c);if(_0x567a59[_0xf84d('0x2f')]['filter']){_0x10b64c[_0xf84d('0x39')]=_[_0xf84d('0x3a')](_0x10b64c[_0xf84d('0x39')],{'$or':_[_0xf84d('0x2a')](_0x15327c,function(_0x3bcedf){if(_0x3bcedf[_0xf84d('0x2d')]!=='VIRTUAL'){var _0x27a0c1={};_0x27a0c1[_0x3bcedf[_0xf84d('0x27')]]={'$like':'%'+_0x567a59[_0xf84d('0x2f')][_0xf84d('0x3b')]+'%'};return _0x27a0c1;}})});}_0x10b64c=_[_0xf84d('0x3a')]({},_0x10b64c,_0x567a59[_0xf84d('0x3c')]);var _0x5d6dcd={'where':_0x10b64c[_0xf84d('0x39')]};return db[_0xf84d('0x2b')][_0xf84d('0x1e')](_0x5d6dcd)[_0xf84d('0x3d')](function(_0x43e5c4){_0x18e869['count']=_0x43e5c4;if(_0x567a59[_0xf84d('0x2f')][_0xf84d('0x3e')]){_0x10b64c['include']=[{'all':!![]}];}return db[_0xf84d('0x2b')][_0xf84d('0x3f')](_0x10b64c);})['then'](function(_0x31c735){_0x18e869[_0xf84d('0x40')]=_0x31c735;return _0x18e869;})[_0xf84d('0x3d')](respondWithFilteredResult(_0x4b74c1,_0x10b64c))[_0xf84d('0x41')](handleError(_0x4b74c1,null));};exports[_0xf84d('0x42')]=function(_0x9b42a7,_0x51e488){var _0x14a2ff={'raw':![],'where':{'id':_0x9b42a7[_0xf84d('0x43')]['id']}},_0x2e75c1={};_0x2e75c1[_0xf84d('0x2e')]=_[_0xf84d('0x30')](db[_0xf84d('0x2b')]['rawAttributes']);_0x2e75c1[_0xf84d('0x2f')]=_[_0xf84d('0x30')](_0x9b42a7['query']);_0x2e75c1[_0xf84d('0x31')]=_[_0xf84d('0x32')](_0x2e75c1[_0xf84d('0x2e')],_0x2e75c1[_0xf84d('0x2f')]);_0x14a2ff[_0xf84d('0x33')]=_[_0xf84d('0x32')](_0x2e75c1[_0xf84d('0x2e')],qs[_0xf84d('0x34')](_0x9b42a7[_0xf84d('0x2f')][_0xf84d('0x34')]));_0x14a2ff['attributes']=_0x14a2ff[_0xf84d('0x33')][_0xf84d('0x35')]?_0x14a2ff[_0xf84d('0x33')]:_0x2e75c1['model'];if(_0x9b42a7[_0xf84d('0x2f')][_0xf84d('0x3e')]){_0x14a2ff['include']=[{'all':!![]}];}_0x14a2ff=_['merge']({},_0x14a2ff,_0x9b42a7[_0xf84d('0x3c')]);return db['ZohoConfiguration'][_0xf84d('0x44')](_0x14a2ff)[_0xf84d('0x3d')](handleEntityNotFound(_0x51e488,null))[_0xf84d('0x3d')](respondWithResult(_0x51e488,null))['catch'](handleError(_0x51e488,null));};exports['create']=function(_0x562d83,_0x136b66){return db[_0xf84d('0x2b')][_0xf84d('0x45')](_0x562d83[_0xf84d('0x46')],{})['then'](respondWithResult(_0x136b66,0xc9))[_0xf84d('0x41')](handleError(_0x136b66,null));};exports[_0xf84d('0x23')]=function(_0x45ca1d,_0x4fdfab){if(_0x45ca1d[_0xf84d('0x46')]['id']){delete _0x45ca1d[_0xf84d('0x46')]['id'];}return db[_0xf84d('0x2b')][_0xf84d('0x44')]({'where':{'id':_0x45ca1d[_0xf84d('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fdfab,null))[_0xf84d('0x3d')](saveUpdates(_0x45ca1d[_0xf84d('0x46')],null))['then'](respondWithResult(_0x4fdfab,null))[_0xf84d('0x41')](handleError(_0x4fdfab,null));};exports[_0xf84d('0x24')]=function(_0x383cf6,_0x473655){return db['ZohoConfiguration'][_0xf84d('0x44')]({'where':{'id':_0x383cf6[_0xf84d('0x43')]['id']}})[_0xf84d('0x3d')](handleEntityNotFound(_0x473655,null))[_0xf84d('0x3d')](removeEntity(_0x473655,null))[_0xf84d('0x41')](handleError(_0x473655,null));};exports[_0xf84d('0x47')]=function(_0x1a636d,_0x3c1516,_0x2406fb){var _0x1dd7fa={};var _0x2f250b={};var _0x342295;var _0x51e489;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1a636d['params']['id']}})[_0xf84d('0x3d')](handleEntityNotFound(_0x3c1516,null))[_0xf84d('0x3d')](function(_0x41feb4){if(_0x41feb4){_0x342295=_0x41feb4;_0x2f250b[_0xf84d('0x2e')]=_[_0xf84d('0x30')](db[_0xf84d('0x48')][_0xf84d('0x49')]);_0x2f250b[_0xf84d('0x2f')]=_[_0xf84d('0x30')](_0x1a636d[_0xf84d('0x2f')]);_0x2f250b['filters']=_[_0xf84d('0x32')](_0x2f250b['model'],_0x2f250b[_0xf84d('0x2f')]);_0x1dd7fa['attributes']=_['intersection'](_0x2f250b['model'],qs[_0xf84d('0x34')](_0x1a636d['query'][_0xf84d('0x34')]));_0x1dd7fa['attributes']=_0x1dd7fa[_0xf84d('0x33')][_0xf84d('0x35')]?_0x1dd7fa['attributes']:_0x2f250b['model'];_0x1dd7fa[_0xf84d('0x37')]=qs[_0xf84d('0x38')](_0x1a636d[_0xf84d('0x2f')][_0xf84d('0x38')]);_0x1dd7fa[_0xf84d('0x39')]=qs['filters'](_[_0xf84d('0x4a')](_0x1a636d[_0xf84d('0x2f')],_0x2f250b['filters']));if(_0x1a636d[_0xf84d('0x2f')][_0xf84d('0x3b')]){_0x1dd7fa[_0xf84d('0x39')]=_[_0xf84d('0x3a')](_0x1dd7fa[_0xf84d('0x39')],{'$or':_['map'](_0x1dd7fa[_0xf84d('0x33')],function(_0x5326f5){var _0x9b57a9={};_0x9b57a9[_0x5326f5]={'$like':'%'+_0x1a636d[_0xf84d('0x2f')][_0xf84d('0x3b')]+'%'};return _0x9b57a9;})});}_0x1dd7fa=_[_0xf84d('0x3a')]({},_0x1dd7fa,_0x1a636d[_0xf84d('0x3c')]);return _0x342295[_0xf84d('0x47')](_0x1dd7fa);}})[_0xf84d('0x3d')](function(_0x321bba){if(_0x321bba){_0x51e489=_0x321bba[_0xf84d('0x35')];if(!_0x1a636d[_0xf84d('0x2f')][_0xf84d('0x36')]('nolimit')){_0x1dd7fa[_0xf84d('0x1d')]=qs[_0xf84d('0x1d')](_0x1a636d['query'][_0xf84d('0x1d')]);_0x1dd7fa[_0xf84d('0x1b')]=qs[_0xf84d('0x1b')](_0x1a636d[_0xf84d('0x2f')][_0xf84d('0x1b')]);}return _0x342295[_0xf84d('0x47')](_0x1dd7fa);}})['then'](function(_0x822e95){if(_0x822e95){return _0x822e95?{'count':_0x51e489,'rows':_0x822e95}:null;}})[_0xf84d('0x3d')](respondWithResult(_0x3c1516,null))[_0xf84d('0x41')](handleError(_0x3c1516,null));};exports[_0xf84d('0x4b')]=function(_0x24d633,_0x2c5b2f,_0x26d042){var _0x1acc7d={};var _0x9a6149={};var _0x49207c;var _0x5eb261;return db[_0xf84d('0x2b')][_0xf84d('0x4c')]({'where':{'id':_0x24d633[_0xf84d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c5b2f,null))['then'](function(_0x29085c){if(_0x29085c){_0x49207c=_0x29085c;_0x9a6149[_0xf84d('0x2e')]=_['keys'](db[_0xf84d('0x48')]['rawAttributes']);_0x9a6149[_0xf84d('0x2f')]=_['keys'](_0x24d633[_0xf84d('0x2f')]);_0x9a6149[_0xf84d('0x31')]=_[_0xf84d('0x32')](_0x9a6149['model'],_0x9a6149[_0xf84d('0x2f')]);_0x1acc7d['attributes']=_[_0xf84d('0x32')](_0x9a6149[_0xf84d('0x2e')],qs['fields'](_0x24d633[_0xf84d('0x2f')][_0xf84d('0x34')]));_0x1acc7d[_0xf84d('0x33')]=_0x1acc7d[_0xf84d('0x33')]['length']?_0x1acc7d[_0xf84d('0x33')]:_0x9a6149['model'];_0x1acc7d[_0xf84d('0x37')]=qs[_0xf84d('0x38')](_0x24d633[_0xf84d('0x2f')][_0xf84d('0x38')]);_0x1acc7d[_0xf84d('0x39')]=qs[_0xf84d('0x31')](_[_0xf84d('0x4a')](_0x24d633[_0xf84d('0x2f')],_0x9a6149[_0xf84d('0x31')]));if(_0x24d633[_0xf84d('0x2f')]['filter']){_0x1acc7d[_0xf84d('0x39')]=_[_0xf84d('0x3a')](_0x1acc7d[_0xf84d('0x39')],{'$or':_[_0xf84d('0x2a')](_0x1acc7d[_0xf84d('0x33')],function(_0x31dc94){var _0x27014a={};_0x27014a[_0x31dc94]={'$like':'%'+_0x24d633[_0xf84d('0x2f')][_0xf84d('0x3b')]+'%'};return _0x27014a;})});}_0x1acc7d=_['merge']({},_0x1acc7d,_0x24d633[_0xf84d('0x3c')]);return _0x49207c[_0xf84d('0x4b')](_0x1acc7d);}})['then'](function(_0x20b117){if(_0x20b117){_0x5eb261=_0x20b117[_0xf84d('0x35')];if(!_0x24d633[_0xf84d('0x2f')][_0xf84d('0x36')](_0xf84d('0x4d'))){_0x1acc7d[_0xf84d('0x1d')]=qs['limit'](_0x24d633[_0xf84d('0x2f')]['limit']);_0x1acc7d[_0xf84d('0x1b')]=qs[_0xf84d('0x1b')](_0x24d633[_0xf84d('0x2f')][_0xf84d('0x1b')]);}return _0x49207c[_0xf84d('0x4b')](_0x1acc7d);}})['then'](function(_0x3a8c2c){if(_0x3a8c2c){return _0x3a8c2c?{'count':_0x5eb261,'rows':_0x3a8c2c}:null;}})['then'](respondWithResult(_0x2c5b2f,null))[_0xf84d('0x41')](handleError(_0x2c5b2f,null));};exports['getDescriptions']=function(_0x46ccae,_0x9d5b63,_0x235736){var _0x14f544={};var _0x341106={};var _0x2b826c;var _0x2bb007;return db['ZohoConfiguration'][_0xf84d('0x4c')]({'where':{'id':_0x46ccae[_0xf84d('0x43')]['id']}})[_0xf84d('0x3d')](handleEntityNotFound(_0x9d5b63,null))[_0xf84d('0x3d')](function(_0x45027a){if(_0x45027a){_0x2b826c=_0x45027a;_0x341106[_0xf84d('0x2e')]=_[_0xf84d('0x30')](db[_0xf84d('0x48')][_0xf84d('0x49')]);_0x341106[_0xf84d('0x2f')]=_[_0xf84d('0x30')](_0x46ccae[_0xf84d('0x2f')]);_0x341106[_0xf84d('0x31')]=_[_0xf84d('0x32')](_0x341106[_0xf84d('0x2e')],_0x341106[_0xf84d('0x2f')]);_0x14f544[_0xf84d('0x33')]=_[_0xf84d('0x32')](_0x341106[_0xf84d('0x2e')],qs[_0xf84d('0x34')](_0x46ccae['query'][_0xf84d('0x34')]));_0x14f544['attributes']=_0x14f544[_0xf84d('0x33')]['length']?_0x14f544[_0xf84d('0x33')]:_0x341106[_0xf84d('0x2e')];_0x14f544[_0xf84d('0x37')]=qs['sort'](_0x46ccae[_0xf84d('0x2f')][_0xf84d('0x38')]);_0x14f544['where']=qs[_0xf84d('0x31')](_['pick'](_0x46ccae[_0xf84d('0x2f')],_0x341106[_0xf84d('0x31')]));if(_0x46ccae[_0xf84d('0x2f')][_0xf84d('0x3b')]){_0x14f544['where']=_[_0xf84d('0x3a')](_0x14f544[_0xf84d('0x39')],{'$or':_[_0xf84d('0x2a')](_0x14f544['attributes'],function(_0x5eed17){var _0x3eb46a={};_0x3eb46a[_0x5eed17]={'$like':'%'+_0x46ccae[_0xf84d('0x2f')]['filter']+'%'};return _0x3eb46a;})});}_0x14f544=_[_0xf84d('0x3a')]({},_0x14f544,_0x46ccae['options']);return _0x2b826c[_0xf84d('0x4e')](_0x14f544);}})['then'](function(_0x5b6c6e){if(_0x5b6c6e){_0x2bb007=_0x5b6c6e['length'];if(!_0x46ccae[_0xf84d('0x2f')]['hasOwnProperty'](_0xf84d('0x4d'))){_0x14f544[_0xf84d('0x1d')]=qs[_0xf84d('0x1d')](_0x46ccae[_0xf84d('0x2f')]['limit']);_0x14f544[_0xf84d('0x1b')]=qs[_0xf84d('0x1b')](_0x46ccae[_0xf84d('0x2f')][_0xf84d('0x1b')]);}return _0x2b826c[_0xf84d('0x4e')](_0x14f544);}})[_0xf84d('0x3d')](function(_0x292685){if(_0x292685){return _0x292685?{'count':_0x2bb007,'rows':_0x292685}:null;}})['then'](respondWithResult(_0x9d5b63,null))['catch'](handleError(_0x9d5b63,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 79539e5..200ac8f 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 _0xb9ff=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb9ff,0x1e4));var _0xfb9f=function(_0x1647b5,_0x96fc4e){_0x1647b5=_0x1647b5-0x0;var _0x4c72e4=_0xb9ff[_0x1647b5];return _0x4c72e4;};'use strict';var _=require(_0xfb9f('0x0'));var util=require(_0xfb9f('0x1'));var logger=require(_0xfb9f('0x2'))(_0xfb9f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb9f('0x4'));var fs=require('fs');var path=require(_0xfb9f('0x5'));var rimraf=require(_0xfb9f('0x6'));var config=require(_0xfb9f('0x7'));var attributes=require(_0xfb9f('0x8'));module[_0xfb9f('0x9')]=function(_0x3ebbf2,_0x4fbfde){return _0x3ebbf2['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe42=['path','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash','util','moment','bluebird'];(function(_0x5ca784,_0x28bea2){var _0x5aa579=function(_0x531234){while(--_0x531234){_0x5ca784['push'](_0x5ca784['shift']());}};_0x5aa579(++_0x28bea2);}(_0xbe42,0x10a));var _0x2be4=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0xbe42[_0x4defd6];return _0x4c9276;};'use strict';var _=require(_0x2be4('0x0'));var util=require(_0x2be4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2be4('0x2'));var BPromise=require(_0x2be4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2be4('0x4'));var rimraf=require('rimraf');var config=require(_0x2be4('0x5'));var attributes=require(_0x2be4('0x6'));module['exports']=function(_0x2b9157,_0x34627b){return _0x2b9157[_0x2be4('0x7')](_0x2be4('0x8'),attributes,{'tableName':_0x2be4('0x9'),'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 2aec952..e4a4d9a 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 _0x583a=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xd3a823,_0x4ad32e){var _0x54b98a=function(_0x4657eb){while(--_0x4657eb){_0xd3a823['push'](_0xd3a823['shift']());}};_0x54b98a(++_0x4ad32e);}(_0x583a,0x13a));var _0xa583=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x583a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xa583('0x0'));var util=require(_0xa583('0x1'));var moment=require('moment');var BPromise=require(_0xa583('0x2'));var rs=require(_0xa583('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa583('0x4'))['db'];var utils=require(_0xa583('0x5'));var logger=require(_0xa583('0x6'))(_0xa583('0x7'));var config=require(_0xa583('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa583('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eebb5,_0x54ee9c,_0x5aad15){return new BPromise(function(_0x25f11e,_0x287116){return client[_0xa583('0xa')](_0x1eebb5,_0x5aad15)['then'](function(_0x4c70cd){logger[_0xa583('0xb')](_0xa583('0xc'),_0x54ee9c,_0xa583('0xd'));logger[_0xa583('0xe')](_0xa583('0xf'),_0x54ee9c,_0xa583('0xd'),JSON[_0xa583('0x10')](_0x4c70cd));if(_0x4c70cd[_0xa583('0x11')]){if(_0x4c70cd[_0xa583('0x11')][_0xa583('0x12')]===0x1f4){logger[_0xa583('0x11')](_0xa583('0xc'),_0x54ee9c,_0x4c70cd[_0xa583('0x11')]['message']);return _0x287116(_0x4c70cd[_0xa583('0x11')][_0xa583('0x13')]);}logger[_0xa583('0x11')](_0xa583('0xc'),_0x54ee9c,_0x4c70cd[_0xa583('0x11')][_0xa583('0x13')]);return _0x25f11e(_0x4c70cd[_0xa583('0x11')][_0xa583('0x13')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x54ee9c,'request\x20sent');_0x25f11e(_0x4c70cd[_0xa583('0x14')]['message']);}})[_0xa583('0x15')](function(_0xd083af){logger['error'](_0xa583('0xc'),_0x54ee9c,_0xd083af);_0x287116(_0xd083af);});});} \ No newline at end of file +var _0x9e3a=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9e3a,0x109));var _0xa9e3=function(_0x5ccdc1,_0x82dc18){_0x5ccdc1=_0x5ccdc1-0x0;var _0x2a5c44=_0x9e3a[_0x5ccdc1];return _0x2a5c44;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa9e3('0x0'));var BPromise=require(_0xa9e3('0x1'));var rs=require(_0xa9e3('0x2'));var fs=require('fs');var Redis=require(_0xa9e3('0x3'));var db=require(_0xa9e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9e3('0x5'))(_0xa9e3('0x6'));var config=require('../../config/environment');var jayson=require(_0xa9e3('0x7'));var client=jayson[_0xa9e3('0x8')][_0xa9e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50eb98,_0x1bd35b,_0x558f7f){return new BPromise(function(_0x4049bf,_0x5cd110){return client[_0xa9e3('0xa')](_0x50eb98,_0x558f7f)[_0xa9e3('0xb')](function(_0x2d63c8){logger[_0xa9e3('0xc')](_0xa9e3('0xd'),_0x1bd35b,_0xa9e3('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1bd35b,'request\x20sent',JSON[_0xa9e3('0xf')](_0x2d63c8));if(_0x2d63c8[_0xa9e3('0x10')]){if(_0x2d63c8[_0xa9e3('0x10')][_0xa9e3('0x11')]===0x1f4){logger[_0xa9e3('0x10')](_0xa9e3('0xd'),_0x1bd35b,_0x2d63c8[_0xa9e3('0x10')][_0xa9e3('0x12')]);return _0x5cd110(_0x2d63c8[_0xa9e3('0x10')][_0xa9e3('0x12')]);}logger[_0xa9e3('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x1bd35b,_0x2d63c8[_0xa9e3('0x10')][_0xa9e3('0x12')]);return _0x4049bf(_0x2d63c8[_0xa9e3('0x10')][_0xa9e3('0x12')]);}else{logger[_0xa9e3('0xc')](_0xa9e3('0xd'),_0x1bd35b,_0xa9e3('0xe'));_0x4049bf(_0x2d63c8['result'][_0xa9e3('0x12')]);}})[_0xa9e3('0x13')](function(_0x4a3665){logger[_0xa9e3('0x10')](_0xa9e3('0xd'),_0x1bd35b,_0x4a3665);_0x5cd110(_0x4a3665);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0cfbc76..b8f85aa 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 _0xc65f=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x577acd,_0x2dddb2){var _0x2bfd74=function(_0x39d069){while(--_0x39d069){_0x577acd['push'](_0x577acd['shift']());}};_0x2bfd74(++_0x2dddb2);}(_0xc65f,0x12b));var _0xfc65=function(_0x44bfb9,_0x5f083d){_0x44bfb9=_0x44bfb9-0x0;var _0x2abcce=_0xc65f[_0x44bfb9];return _0x2abcce;};'use strict';var multer=require(_0xfc65('0x0'));var util=require(_0xfc65('0x1'));var path=require(_0xfc65('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc65('0x3'));var interaction=require(_0xfc65('0x4'));var config=require(_0xfc65('0x5'));var controller=require(_0xfc65('0x6'));router[_0xfc65('0x7')]('/',auth['isAuthenticated'](),controller[_0xfc65('0x8')]);router[_0xfc65('0x7')](_0xfc65('0x9'),auth[_0xfc65('0xa')](),controller[_0xfc65('0xb')]);router[_0xfc65('0xc')]('/',auth[_0xfc65('0xa')](),controller[_0xfc65('0xd')]);router[_0xfc65('0xe')](_0xfc65('0x9'),auth[_0xfc65('0xa')](),controller[_0xfc65('0xf')]);router['delete'](_0xfc65('0x9'),auth['isAuthenticated'](),controller[_0xfc65('0x10')]);module[_0xfc65('0x11')]=router; \ No newline at end of file +var _0x0a73=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a449d,_0xf51481){var _0x37193d=function(_0x1c50bc){while(--_0x1c50bc){_0x5a449d['push'](_0x5a449d['shift']());}};_0x37193d(++_0xf51481);}(_0x0a73,0xd3));var _0x30a7=function(_0x12c076,_0x5bef17){_0x12c076=_0x12c076-0x0;var _0x2ddd18=_0x0a73[_0x12c076];return _0x2ddd18;};'use strict';var multer=require(_0x30a7('0x0'));var util=require(_0x30a7('0x1'));var path=require(_0x30a7('0x2'));var timeout=require(_0x30a7('0x3'));var express=require(_0x30a7('0x4'));var router=express[_0x30a7('0x5')]();var fs_extra=require(_0x30a7('0x6'));var auth=require(_0x30a7('0x7'));var interaction=require(_0x30a7('0x8'));var config=require(_0x30a7('0x9'));var controller=require(_0x30a7('0xa'));router[_0x30a7('0xb')]('/',auth[_0x30a7('0xc')](),controller[_0x30a7('0xd')]);router['get']('/:id',auth[_0x30a7('0xc')](),controller[_0x30a7('0xe')]);router[_0x30a7('0xf')]('/',auth['isAuthenticated'](),controller[_0x30a7('0x10')]);router[_0x30a7('0x11')](_0x30a7('0x12'),auth['isAuthenticated'](),controller[_0x30a7('0x13')]);router[_0x30a7('0x14')](_0x30a7('0x12'),auth[_0x30a7('0xc')](),controller[_0x30a7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 015f7b3..5d8c373 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 _0x4ba9=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x48b5ed,_0x1ceeff){var _0x2fad75=function(_0x50a129){while(--_0x50a129){_0x48b5ed['push'](_0x48b5ed['shift']());}};_0x2fad75(++_0x1ceeff);}(_0x4ba9,0x196));var _0x94ba=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x4ba9[_0x470bfb];return _0x2f5d97;};'use strict';var Sequelize=require(_0x94ba('0x0'));module[_0x94ba('0x1')]={'type':{'type':Sequelize['ENUM'](_0x94ba('0x2'),_0x94ba('0x3'),_0x94ba('0x4'),_0x94ba('0x5'),_0x94ba('0x6')),'defaultValue':_0x94ba('0x2')},'content':{'type':Sequelize[_0x94ba('0x7')]},'key':{'type':Sequelize[_0x94ba('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x94ba('0x2'),_0x94ba('0x3'),_0x94ba('0x4'))},'keyContent':{'type':Sequelize[_0x94ba('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x94ba('0x7')]},'customField':{'type':Sequelize[_0x94ba('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x94ba('0x7')]}}; \ No newline at end of file +var _0xa627=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x5577ee,_0x403326){var _0x2ee678=function(_0x1cda14){while(--_0x1cda14){_0x5577ee['push'](_0x5577ee['shift']());}};_0x2ee678(++_0x403326);}(_0xa627,0xd4));var _0x7a62=function(_0x4ca22b,_0x1df40d){_0x4ca22b=_0x4ca22b-0x0;var _0xd70020=_0xa627[_0x4ca22b];return _0xd70020;};'use strict';var Sequelize=require(_0x7a62('0x0'));module[_0x7a62('0x1')]={'type':{'type':Sequelize[_0x7a62('0x2')](_0x7a62('0x3'),_0x7a62('0x4'),_0x7a62('0x5'),'keyValue',_0x7a62('0x6')),'defaultValue':_0x7a62('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7a62('0x7')]},'keyType':{'type':Sequelize[_0x7a62('0x2')]('string',_0x7a62('0x4'),_0x7a62('0x5'))},'keyContent':{'type':Sequelize[_0x7a62('0x7')]},'idField':{'type':Sequelize[_0x7a62('0x7')]},'nameField':{'type':Sequelize[_0x7a62('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 27893ea..9209177 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 _0x29b6=['type','options','count','include','findAll','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','status','end','json','offset','limit','undefined','set','apply','reject','update','then','destroy','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','map'];(function(_0x2183ca,_0x3778a9){var _0x21d00e=function(_0x2fb048){while(--_0x2fb048){_0x2183ca['push'](_0x2183ca['shift']());}};_0x21d00e(++_0x3778a9);}(_0x29b6,0x17e));var _0x629b=function(_0x43c4f7,_0x362d33){_0x43c4f7=_0x43c4f7-0x0;var _0x376c42=_0x29b6[_0x43c4f7];return _0x376c42;};'use strict';var emlformat=require(_0x629b('0x0'));var rimraf=require(_0x629b('0x1'));var zipdir=require(_0x629b('0x2'));var jsonpatch=require(_0x629b('0x3'));var rp=require(_0x629b('0x4'));var moment=require(_0x629b('0x5'));var BPromise=require(_0x629b('0x6'));var Mustache=require(_0x629b('0x7'));var util=require(_0x629b('0x8'));var path=require(_0x629b('0x9'));var sox=require('sox');var csv=require(_0x629b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x629b('0xb'));var _=require(_0x629b('0xc'));var squel=require(_0x629b('0xd'));var crypto=require(_0x629b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x629b('0xf'));var toCsv=require(_0x629b('0xa'));var querystring=require('querystring');var Papa=require(_0x629b('0x10'));var Redis=require(_0x629b('0x11'));var authService=require(_0x629b('0x12'));var qs=require(_0x629b('0x13'));var as=require(_0x629b('0x14'));var hardwareService=require(_0x629b('0x15'));var logger=require(_0x629b('0x16'))(_0x629b('0x17'));var utils=require(_0x629b('0x18'));var config=require(_0x629b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d9f28,_0x20acc7){_0x20acc7=_0x20acc7||0xcc;return function(_0x39c5fa){if(_0x39c5fa){return _0x2d9f28['sendStatus'](_0x20acc7);}return _0x2d9f28[_0x629b('0x1a')](_0x20acc7)[_0x629b('0x1b')]();};}function respondWithResult(_0x3c34f9,_0x1fef01){_0x1fef01=_0x1fef01||0xc8;return function(_0x519ea9){if(_0x519ea9){return _0x3c34f9[_0x629b('0x1a')](_0x1fef01)[_0x629b('0x1c')](_0x519ea9);}};}function respondWithFilteredResult(_0x2cfbe3,_0xa79d91){return function(_0x2c1f4f){if(_0x2c1f4f){var _0x4ba9ae=typeof _0xa79d91[_0x629b('0x1d')]==='undefined'&&typeof _0xa79d91[_0x629b('0x1e')]===_0x629b('0x1f');var _0x204bb4=_0x2c1f4f['count'];var _0x7f24d3=_0x4ba9ae?0x0:_0xa79d91['offset'];var _0x1c93a1=_0x4ba9ae?_0x2c1f4f['count']:_0xa79d91[_0x629b('0x1d')]+_0xa79d91['limit'];var _0x38c832;if(_0x1c93a1>=_0x204bb4){_0x1c93a1=_0x204bb4;_0x38c832=0xc8;}else{_0x38c832=0xce;}_0x2cfbe3[_0x629b('0x1a')](_0x38c832);return _0x2cfbe3[_0x629b('0x20')]('Content-Range',_0x7f24d3+'-'+_0x1c93a1+'/'+_0x204bb4)[_0x629b('0x1c')](_0x2c1f4f);}return null;};}function patchUpdates(_0x52808e){return function(_0x303403){try{jsonpatch[_0x629b('0x21')](_0x303403,_0x52808e,!![]);}catch(_0x16d70a){return BPromise[_0x629b('0x22')](_0x16d70a);}return _0x303403['save']();};}function saveUpdates(_0x33e46e,_0x4f644f){return function(_0x17bb01){if(_0x17bb01){return _0x17bb01[_0x629b('0x23')](_0x33e46e)[_0x629b('0x24')](function(_0x5f2d6d){return _0x5f2d6d;});}return null;};}function removeEntity(_0x457813,_0x1e773e){return function(_0x37d997){if(_0x37d997){return _0x37d997[_0x629b('0x25')]()[_0x629b('0x24')](function(){_0x457813[_0x629b('0x1a')](0xcc)[_0x629b('0x1b')]();});}};}function handleEntityNotFound(_0x547b3c,_0x5ca40d){return function(_0x5ca552){if(!_0x5ca552){_0x547b3c['sendStatus'](0x194);}return _0x5ca552;};}function handleError(_0x3e1e25,_0x31c0b3){_0x31c0b3=_0x31c0b3||0x1f4;return function(_0xf68af8){logger[_0x629b('0x26')](_0xf68af8[_0x629b('0x27')]);if(_0xf68af8[_0x629b('0x28')]){delete _0xf68af8['name'];}_0x3e1e25[_0x629b('0x1a')](_0x31c0b3)[_0x629b('0x29')](_0xf68af8);};}exports[_0x629b('0x2a')]=function(_0x12d5fc,_0x12cc51){var _0x16c365={},_0x3ef549={},_0x34e2e7={'count':0x0,'rows':[]};var _0x55aad1=_['map'](db[_0x629b('0x2b')][_0x629b('0x2c')],function(_0x4b1391){return{'name':_0x4b1391[_0x629b('0x2d')],'type':_0x4b1391['type'][_0x629b('0x2e')]};});_0x3ef549[_0x629b('0x2f')]=_['map'](_0x55aad1,_0x629b('0x28'));_0x3ef549[_0x629b('0x30')]=_[_0x629b('0x31')](_0x12d5fc[_0x629b('0x30')]);_0x3ef549[_0x629b('0x32')]=_[_0x629b('0x33')](_0x3ef549['model'],_0x3ef549[_0x629b('0x30')]);_0x16c365[_0x629b('0x34')]=_[_0x629b('0x33')](_0x3ef549[_0x629b('0x2f')],qs[_0x629b('0x35')](_0x12d5fc[_0x629b('0x30')][_0x629b('0x35')]));_0x16c365[_0x629b('0x34')]=_0x16c365[_0x629b('0x34')][_0x629b('0x36')]?_0x16c365[_0x629b('0x34')]:_0x3ef549[_0x629b('0x2f')];if(!_0x12d5fc[_0x629b('0x30')]['hasOwnProperty']('nolimit')){_0x16c365[_0x629b('0x1e')]=qs[_0x629b('0x1e')](_0x12d5fc[_0x629b('0x30')][_0x629b('0x1e')]);_0x16c365['offset']=qs[_0x629b('0x1d')](_0x12d5fc[_0x629b('0x30')][_0x629b('0x1d')]);}_0x16c365[_0x629b('0x37')]=qs['sort'](_0x12d5fc[_0x629b('0x30')][_0x629b('0x38')]);_0x16c365[_0x629b('0x39')]=qs[_0x629b('0x32')](_[_0x629b('0x3a')](_0x12d5fc['query'],_0x3ef549[_0x629b('0x32')]),_0x55aad1);if(_0x12d5fc[_0x629b('0x30')][_0x629b('0x3b')]){_0x16c365[_0x629b('0x39')]=_[_0x629b('0x3c')](_0x16c365[_0x629b('0x39')],{'$or':_[_0x629b('0x3d')](_0x55aad1,function(_0x44bb6c){if(_0x44bb6c[_0x629b('0x3e')]!=='VIRTUAL'){var _0x3b2506={};_0x3b2506[_0x44bb6c[_0x629b('0x28')]]={'$like':'%'+_0x12d5fc['query'][_0x629b('0x3b')]+'%'};return _0x3b2506;}})});}_0x16c365=_[_0x629b('0x3c')]({},_0x16c365,_0x12d5fc[_0x629b('0x3f')]);var _0x4571e2={'where':_0x16c365['where']};return db['ZohoField'][_0x629b('0x40')](_0x4571e2)[_0x629b('0x24')](function(_0x35f9e4){_0x34e2e7[_0x629b('0x40')]=_0x35f9e4;if(_0x12d5fc[_0x629b('0x30')]['includeAll']){_0x16c365[_0x629b('0x41')]=[{'all':!![]}];}return db[_0x629b('0x2b')][_0x629b('0x42')](_0x16c365);})[_0x629b('0x24')](function(_0x1ac038){_0x34e2e7['rows']=_0x1ac038;return _0x34e2e7;})['then'](respondWithFilteredResult(_0x12cc51,_0x16c365))[_0x629b('0x43')](handleError(_0x12cc51,null));};exports[_0x629b('0x44')]=function(_0x190e24,_0x5bda2){var _0xeed218={'raw':!![],'where':{'id':_0x190e24[_0x629b('0x45')]['id']}},_0x40cfae={};_0x40cfae[_0x629b('0x2f')]=_['keys'](db[_0x629b('0x2b')][_0x629b('0x2c')]);_0x40cfae[_0x629b('0x30')]=_[_0x629b('0x31')](_0x190e24[_0x629b('0x30')]);_0x40cfae['filters']=_['intersection'](_0x40cfae[_0x629b('0x2f')],_0x40cfae[_0x629b('0x30')]);_0xeed218[_0x629b('0x34')]=_[_0x629b('0x33')](_0x40cfae['model'],qs[_0x629b('0x35')](_0x190e24['query'][_0x629b('0x35')]));_0xeed218[_0x629b('0x34')]=_0xeed218['attributes'][_0x629b('0x36')]?_0xeed218[_0x629b('0x34')]:_0x40cfae[_0x629b('0x2f')];if(_0x190e24[_0x629b('0x30')][_0x629b('0x46')]){_0xeed218[_0x629b('0x41')]=[{'all':!![]}];}_0xeed218=_['merge']({},_0xeed218,_0x190e24['options']);return db[_0x629b('0x2b')][_0x629b('0x47')](_0xeed218)[_0x629b('0x24')](handleEntityNotFound(_0x5bda2,null))[_0x629b('0x24')](respondWithResult(_0x5bda2,null))[_0x629b('0x43')](handleError(_0x5bda2,null));};exports[_0x629b('0x48')]=function(_0x19bdad,_0x503c57){return db['ZohoField'][_0x629b('0x48')](_0x19bdad['body'],{})[_0x629b('0x24')](respondWithResult(_0x503c57,0xc9))['catch'](handleError(_0x503c57,null));};exports[_0x629b('0x23')]=function(_0x1cbdad,_0x286d90){if(_0x1cbdad[_0x629b('0x49')]['id']){delete _0x1cbdad[_0x629b('0x49')]['id'];}return db[_0x629b('0x2b')][_0x629b('0x47')]({'where':{'id':_0x1cbdad[_0x629b('0x45')]['id']}})['then'](handleEntityNotFound(_0x286d90,null))[_0x629b('0x24')](saveUpdates(_0x1cbdad['body'],null))[_0x629b('0x24')](respondWithResult(_0x286d90,null))[_0x629b('0x43')](handleError(_0x286d90,null));};exports['destroy']=function(_0x28cd8b,_0x5abb2b){return db['ZohoField'][_0x629b('0x47')]({'where':{'id':_0x28cd8b[_0x629b('0x45')]['id']}})[_0x629b('0x24')](handleEntityNotFound(_0x5abb2b,null))[_0x629b('0x24')](removeEntity(_0x5abb2b,null))['catch'](handleError(_0x5abb2b,null));}; \ No newline at end of file +var _0x93b3=['destroy','end','error','stack','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','name','merge','options','ZohoField','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then'];(function(_0x2179f2,_0x2dff7c){var _0x236d1b=function(_0x3a0e47){while(--_0x3a0e47){_0x2179f2['push'](_0x2179f2['shift']());}};_0x236d1b(++_0x2dff7c);}(_0x93b3,0x1ae));var _0x393b=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x93b3[_0x48f7cf];return _0xc201c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x393b('0x0'));var zipdir=require(_0x393b('0x1'));var jsonpatch=require(_0x393b('0x2'));var rp=require(_0x393b('0x3'));var moment=require('moment');var BPromise=require(_0x393b('0x4'));var Mustache=require(_0x393b('0x5'));var util=require(_0x393b('0x6'));var path=require(_0x393b('0x7'));var sox=require(_0x393b('0x8'));var csv=require(_0x393b('0x9'));var ejs=require(_0x393b('0xa'));var fs=require('fs');var fs_extra=require(_0x393b('0xb'));var _=require(_0x393b('0xc'));var squel=require('squel');var crypto=require(_0x393b('0xd'));var jsforce=require(_0x393b('0xe'));var deskjs=require(_0x393b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x393b('0x10'));var Papa=require('papaparse');var Redis=require(_0x393b('0x11'));var authService=require(_0x393b('0x12'));var qs=require(_0x393b('0x13'));var as=require(_0x393b('0x14'));var hardwareService=require(_0x393b('0x15'));var logger=require(_0x393b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x393b('0x17'));var licenseUtil=require(_0x393b('0x18'));var db=require(_0x393b('0x19'))['db'];function respondWithStatusCode(_0x476219,_0x43f089){_0x43f089=_0x43f089||0xcc;return function(_0x23a35d){if(_0x23a35d){return _0x476219[_0x393b('0x1a')](_0x43f089);}return _0x476219[_0x393b('0x1b')](_0x43f089)['end']();};}function respondWithResult(_0x1d37f7,_0x2b0d29){_0x2b0d29=_0x2b0d29||0xc8;return function(_0x122d5a){if(_0x122d5a){return _0x1d37f7[_0x393b('0x1b')](_0x2b0d29)[_0x393b('0x1c')](_0x122d5a);}};}function respondWithFilteredResult(_0x42e512,_0x44be3d){return function(_0xc9b535){if(_0xc9b535){var _0x6a21fa=typeof _0x44be3d[_0x393b('0x1d')]===_0x393b('0x1e')&&typeof _0x44be3d[_0x393b('0x1f')]===_0x393b('0x1e');var _0x23c8a0=_0xc9b535[_0x393b('0x20')];var _0x563ad2=_0x6a21fa?0x0:_0x44be3d['offset'];var _0x261d76=_0x6a21fa?_0xc9b535[_0x393b('0x20')]:_0x44be3d[_0x393b('0x1d')]+_0x44be3d['limit'];var _0x2a031c;if(_0x261d76>=_0x23c8a0){_0x261d76=_0x23c8a0;_0x2a031c=0xc8;}else{_0x2a031c=0xce;}_0x42e512['status'](_0x2a031c);return _0x42e512['set']('Content-Range',_0x563ad2+'-'+_0x261d76+'/'+_0x23c8a0)[_0x393b('0x1c')](_0xc9b535);}return null;};}function patchUpdates(_0x4e87fc){return function(_0x4579ed){try{jsonpatch[_0x393b('0x21')](_0x4579ed,_0x4e87fc,!![]);}catch(_0xe86e2e){return BPromise[_0x393b('0x22')](_0xe86e2e);}return _0x4579ed[_0x393b('0x23')]();};}function saveUpdates(_0x4205a6,_0x24814d){return function(_0x15e82c){if(_0x15e82c){return _0x15e82c[_0x393b('0x24')](_0x4205a6)[_0x393b('0x25')](function(_0x29b72e){return _0x29b72e;});}return null;};}function removeEntity(_0x4e7a25,_0x4b3377){return function(_0x443ce4){if(_0x443ce4){return _0x443ce4[_0x393b('0x26')]()[_0x393b('0x25')](function(){_0x4e7a25[_0x393b('0x1b')](0xcc)[_0x393b('0x27')]();});}};}function handleEntityNotFound(_0x3ba571,_0x438701){return function(_0x4191a3){if(!_0x4191a3){_0x3ba571[_0x393b('0x1a')](0x194);}return _0x4191a3;};}function handleError(_0x5abeab,_0x4b6fce){_0x4b6fce=_0x4b6fce||0x1f4;return function(_0x1e86a1){logger[_0x393b('0x28')](_0x1e86a1[_0x393b('0x29')]);if(_0x1e86a1['name']){delete _0x1e86a1['name'];}_0x5abeab[_0x393b('0x1b')](_0x4b6fce)[_0x393b('0x2a')](_0x1e86a1);};}exports[_0x393b('0x2b')]=function(_0x38ca27,_0x4e3bc8){var _0xc925d4={},_0xed5781={},_0xe861d2={'count':0x0,'rows':[]};var _0x196f29=_[_0x393b('0x2c')](db['ZohoField']['rawAttributes'],function(_0x25791a){return{'name':_0x25791a[_0x393b('0x2d')],'type':_0x25791a['type'][_0x393b('0x2e')]};});_0xed5781[_0x393b('0x2f')]=_['map'](_0x196f29,'name');_0xed5781[_0x393b('0x30')]=_[_0x393b('0x31')](_0x38ca27[_0x393b('0x30')]);_0xed5781[_0x393b('0x32')]=_[_0x393b('0x33')](_0xed5781[_0x393b('0x2f')],_0xed5781[_0x393b('0x30')]);_0xc925d4[_0x393b('0x34')]=_[_0x393b('0x33')](_0xed5781[_0x393b('0x2f')],qs[_0x393b('0x35')](_0x38ca27[_0x393b('0x30')][_0x393b('0x35')]));_0xc925d4[_0x393b('0x34')]=_0xc925d4[_0x393b('0x34')][_0x393b('0x36')]?_0xc925d4[_0x393b('0x34')]:_0xed5781[_0x393b('0x2f')];if(!_0x38ca27['query'][_0x393b('0x37')](_0x393b('0x38'))){_0xc925d4['limit']=qs[_0x393b('0x1f')](_0x38ca27['query']['limit']);_0xc925d4[_0x393b('0x1d')]=qs[_0x393b('0x1d')](_0x38ca27['query'][_0x393b('0x1d')]);}_0xc925d4[_0x393b('0x39')]=qs[_0x393b('0x3a')](_0x38ca27[_0x393b('0x30')]['sort']);_0xc925d4[_0x393b('0x3b')]=qs[_0x393b('0x32')](_['pick'](_0x38ca27['query'],_0xed5781['filters']),_0x196f29);if(_0x38ca27['query'][_0x393b('0x3c')]){_0xc925d4[_0x393b('0x3b')]=_['merge'](_0xc925d4['where'],{'$or':_[_0x393b('0x2c')](_0x196f29,function(_0x135248){if(_0x135248[_0x393b('0x3d')]!==_0x393b('0x3e')){var _0x131ee1={};_0x131ee1[_0x135248[_0x393b('0x3f')]]={'$like':'%'+_0x38ca27[_0x393b('0x30')][_0x393b('0x3c')]+'%'};return _0x131ee1;}})});}_0xc925d4=_[_0x393b('0x40')]({},_0xc925d4,_0x38ca27[_0x393b('0x41')]);var _0x52c618={'where':_0xc925d4[_0x393b('0x3b')]};return db[_0x393b('0x42')][_0x393b('0x20')](_0x52c618)[_0x393b('0x25')](function(_0x3ce597){_0xe861d2[_0x393b('0x20')]=_0x3ce597;if(_0x38ca27[_0x393b('0x30')][_0x393b('0x43')]){_0xc925d4[_0x393b('0x44')]=[{'all':!![]}];}return db[_0x393b('0x42')][_0x393b('0x45')](_0xc925d4);})[_0x393b('0x25')](function(_0x29daa3){_0xe861d2[_0x393b('0x46')]=_0x29daa3;return _0xe861d2;})[_0x393b('0x25')](respondWithFilteredResult(_0x4e3bc8,_0xc925d4))[_0x393b('0x47')](handleError(_0x4e3bc8,null));};exports[_0x393b('0x48')]=function(_0x22eafe,_0x39ff65){var _0x13c0c0={'raw':!![],'where':{'id':_0x22eafe['params']['id']}},_0x4a14a1={};_0x4a14a1[_0x393b('0x2f')]=_[_0x393b('0x31')](db[_0x393b('0x42')][_0x393b('0x49')]);_0x4a14a1[_0x393b('0x30')]=_[_0x393b('0x31')](_0x22eafe[_0x393b('0x30')]);_0x4a14a1['filters']=_[_0x393b('0x33')](_0x4a14a1[_0x393b('0x2f')],_0x4a14a1[_0x393b('0x30')]);_0x13c0c0['attributes']=_[_0x393b('0x33')](_0x4a14a1['model'],qs['fields'](_0x22eafe[_0x393b('0x30')][_0x393b('0x35')]));_0x13c0c0['attributes']=_0x13c0c0[_0x393b('0x34')][_0x393b('0x36')]?_0x13c0c0['attributes']:_0x4a14a1['model'];if(_0x22eafe['query'][_0x393b('0x43')]){_0x13c0c0[_0x393b('0x44')]=[{'all':!![]}];}_0x13c0c0=_[_0x393b('0x40')]({},_0x13c0c0,_0x22eafe[_0x393b('0x41')]);return db[_0x393b('0x42')][_0x393b('0x4a')](_0x13c0c0)[_0x393b('0x25')](handleEntityNotFound(_0x39ff65,null))[_0x393b('0x25')](respondWithResult(_0x39ff65,null))['catch'](handleError(_0x39ff65,null));};exports[_0x393b('0x4b')]=function(_0x213a8b,_0x359aa9){return db[_0x393b('0x42')][_0x393b('0x4b')](_0x213a8b[_0x393b('0x4c')],{})['then'](respondWithResult(_0x359aa9,0xc9))[_0x393b('0x47')](handleError(_0x359aa9,null));};exports[_0x393b('0x24')]=function(_0x5322e0,_0x5e7702){if(_0x5322e0[_0x393b('0x4c')]['id']){delete _0x5322e0[_0x393b('0x4c')]['id'];}return db[_0x393b('0x42')][_0x393b('0x4a')]({'where':{'id':_0x5322e0[_0x393b('0x4d')]['id']}})[_0x393b('0x25')](handleEntityNotFound(_0x5e7702,null))[_0x393b('0x25')](saveUpdates(_0x5322e0[_0x393b('0x4c')],null))[_0x393b('0x25')](respondWithResult(_0x5e7702,null))[_0x393b('0x47')](handleError(_0x5e7702,null));};exports['destroy']=function(_0x4dcf22,_0x331b9f){return db[_0x393b('0x42')]['find']({'where':{'id':_0x4dcf22[_0x393b('0x4d')]['id']}})[_0x393b('0x25')](handleEntityNotFound(_0x331b9f,null))[_0x393b('0x25')](removeEntity(_0x331b9f,null))[_0x393b('0x47')](handleError(_0x331b9f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1fbfd13..031bd9b 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 _0xacf4=['bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','../../config/logger','api','moment'];(function(_0x3cd73a,_0x2c8520){var _0x513638=function(_0x4f584c){while(--_0x4f584c){_0x3cd73a['push'](_0x3cd73a['shift']());}};_0x513638(++_0x2c8520);}(_0xacf4,0xe7));var _0x4acf=function(_0x4fa33e,_0x2ccf45){_0x4fa33e=_0x4fa33e-0x0;var _0x24c603=_0xacf4[_0x4fa33e];return _0x24c603;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','util','api','bluebird','request-promise','path'];(function(_0x1436d5,_0x233def){var _0x2f2225=function(_0x29f5a1){while(--_0x29f5a1){_0x1436d5['push'](_0x1436d5['shift']());}};_0x2f2225(++_0x233def);}(_0x7096,0x10c));var _0x6709=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7096[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 4402d5c..a35b8ac 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 _0xcc11=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x524fd6,_0x3d0065){var _0xe4bd21=function(_0x2dea76){while(--_0x2dea76){_0x524fd6['push'](_0x524fd6['shift']());}};_0xe4bd21(++_0x3d0065);}(_0xcc11,0xe2));var _0x1cc1=function(_0x13647c,_0x4822a7){_0x13647c=_0x13647c-0x0;var _0x341ecb=_0xcc11[_0x13647c];return _0x341ecb;};'use strict';var _=require(_0x1cc1('0x0'));var util=require(_0x1cc1('0x1'));var moment=require(_0x1cc1('0x2'));var BPromise=require('bluebird');var rs=require(_0x1cc1('0x3'));var fs=require('fs');var Redis=require(_0x1cc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cc1('0x5'));var logger=require('../../config/logger')(_0x1cc1('0x6'));var config=require('../../config/environment');var jayson=require(_0x1cc1('0x7'));var client=jayson[_0x1cc1('0x8')][_0x1cc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xde78b1,_0x5b27bf,_0x51a4f0){return new BPromise(function(_0x422b0f,_0xd27026){return client[_0x1cc1('0xa')](_0xde78b1,_0x51a4f0)[_0x1cc1('0xb')](function(_0x10ea7f){logger[_0x1cc1('0xc')](_0x1cc1('0xd'),_0x5b27bf,_0x1cc1('0xe'));logger[_0x1cc1('0xf')](_0x1cc1('0x10'),_0x5b27bf,_0x1cc1('0xe'),JSON[_0x1cc1('0x11')](_0x10ea7f));if(_0x10ea7f[_0x1cc1('0x12')]){if(_0x10ea7f['error'][_0x1cc1('0x13')]===0x1f4){logger[_0x1cc1('0x12')](_0x1cc1('0xd'),_0x5b27bf,_0x10ea7f[_0x1cc1('0x12')]['message']);return _0xd27026(_0x10ea7f[_0x1cc1('0x12')]['message']);}logger[_0x1cc1('0x12')](_0x1cc1('0xd'),_0x5b27bf,_0x10ea7f[_0x1cc1('0x12')][_0x1cc1('0x14')]);return _0x422b0f(_0x10ea7f[_0x1cc1('0x12')][_0x1cc1('0x14')]);}else{logger[_0x1cc1('0xc')]('ZohoField,\x20%s,\x20%s',_0x5b27bf,_0x1cc1('0xe'));_0x422b0f(_0x10ea7f['result']['message']);}})[_0x1cc1('0x15')](function(_0x1de43d){logger['error'](_0x1cc1('0xd'),_0x5b27bf,_0x1de43d);_0xd27026(_0x1de43d);});});} \ No newline at end of file +var _0xcc39=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc39,0x11f));var _0x9cc3=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xcc39[_0x421cf8];return _0x145c48;};'use strict';var _=require(_0x9cc3('0x0'));var util=require('util');var moment=require(_0x9cc3('0x1'));var BPromise=require(_0x9cc3('0x2'));var rs=require(_0x9cc3('0x3'));var fs=require('fs');var Redis=require(_0x9cc3('0x4'));var db=require(_0x9cc3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9cc3('0x6'));var config=require('../../config/environment');var jayson=require(_0x9cc3('0x7'));var client=jayson['client'][_0x9cc3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24eb5c,_0x5e61a4,_0x4b3323){return new BPromise(function(_0x32416d,_0x3f52a2){return client['request'](_0x24eb5c,_0x4b3323)[_0x9cc3('0x9')](function(_0x4698ec){logger[_0x9cc3('0xa')](_0x9cc3('0xb'),_0x5e61a4,'request\x20sent');logger[_0x9cc3('0xc')](_0x9cc3('0xd'),_0x5e61a4,_0x9cc3('0xe'),JSON[_0x9cc3('0xf')](_0x4698ec));if(_0x4698ec[_0x9cc3('0x10')]){if(_0x4698ec[_0x9cc3('0x10')]['code']===0x1f4){logger[_0x9cc3('0x10')](_0x9cc3('0xb'),_0x5e61a4,_0x4698ec['error'][_0x9cc3('0x11')]);return _0x3f52a2(_0x4698ec[_0x9cc3('0x10')][_0x9cc3('0x11')]);}logger[_0x9cc3('0x10')]('ZohoField,\x20%s,\x20%s',_0x5e61a4,_0x4698ec[_0x9cc3('0x10')]['message']);return _0x32416d(_0x4698ec[_0x9cc3('0x10')][_0x9cc3('0x11')]);}else{logger[_0x9cc3('0xa')]('ZohoField,\x20%s,\x20%s',_0x5e61a4,'request\x20sent');_0x32416d(_0x4698ec['result']['message']);}})[_0x9cc3('0x12')](function(_0x1baed7){logger['error'](_0x9cc3('0xb'),_0x5e61a4,_0x1baed7);_0x3f52a2(_0x1baed7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 27807b2..3a1bb51 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xfb0801,_0x1ae851){var _0x1699c3=function(_0x2d47fb){while(--_0x2d47fb){_0xfb0801['push'](_0xfb0801['shift']());}};_0x1699c3(++_0x1ae851);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x350875,_0xa49c33){var _0x28b7be=function(_0x1f5de9){while(--_0x1f5de9){_0x350875['push'](_0x350875['shift']());}};_0x28b7be(++_0xa49c33);}(_0x70e0,0x17b));var _0x070e=function(_0x14ba2e,_0x2a1df2){_0x14ba2e=_0x14ba2e-0x0;var _0x2be224=_0x70e0[_0x14ba2e];return _0x2be224;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 1c0a3a8..2297870 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 _0x08e0=['STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize','exports'];(function(_0x57547e,_0x1b3bb2){var _0x41819f=function(_0x26411d){while(--_0x26411d){_0x57547e['push'](_0x57547e['shift']());}};_0x41819f(++_0x1b3bb2);}(_0x08e0,0x16a));var _0x008e=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x08e0[_0x2cc711];return _0x31a52e;};'use strict';var Sequelize=require(_0x008e('0x0'));module[_0x008e('0x1')]={'name':{'type':Sequelize[_0x008e('0x2')],'allowNull':![],'unique':_0x008e('0x3')},'version':{'type':Sequelize[_0x008e('0x2')],'allowNull':![],'unique':_0x008e('0x3')},'main':{'type':Sequelize[_0x008e('0x2')],'defaultValue':_0x008e('0x4')},'filename':{'type':Sequelize[_0x008e('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x008e('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x008e('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x008e('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x008e('0x2')],'unique':_0x008e('0x6')},'description':{'type':Sequelize[_0x008e('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x008e('0x2')]},'link':{'type':Sequelize[_0x008e('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x3ee7=['BOOLEAN','state','exports','STRING','app.js','INTEGER'];(function(_0x3fe91d,_0x565475){var _0x3fbdb=function(_0x54f18a){while(--_0x54f18a){_0x3fe91d['push'](_0x3fe91d['shift']());}};_0x3fbdb(++_0x565475);}(_0x3ee7,0x98));var _0x73ee=function(_0xe9ec94,_0x2b2574){_0xe9ec94=_0xe9ec94-0x0;var _0xad5914=_0x3ee7[_0xe9ec94];return _0xad5914;};'use strict';var Sequelize=require('sequelize');module[_0x73ee('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x73ee('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x73ee('0x1')],'defaultValue':_0x73ee('0x2')},'filename':{'type':Sequelize[_0x73ee('0x1')]},'path':{'type':Sequelize[_0x73ee('0x1')]},'type':{'type':Sequelize[_0x73ee('0x1')]},'size':{'type':Sequelize[_0x73ee('0x3')]},'active':{'type':Sequelize[_0x73ee('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x73ee('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x73ee('0x1')],'unique':_0x73ee('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x73ee('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x73ee('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c3739cf..0d4df35 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 _0x57ca=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','Integration','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment'];(function(_0x4bc362,_0x103a3b){var _0x1768ae=function(_0x213fca){while(--_0x213fca){_0x4bc362['push'](_0x4bc362['shift']());}};_0x1768ae(++_0x103a3b);}(_0x57ca,0x108));var _0xa57c=function(_0x34a1e2,_0x1a58aa){_0x34a1e2=_0x34a1e2-0x0;var _0x39763e=_0x57ca[_0x34a1e2];return _0x39763e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['Integration']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['Integration'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x5496,0x175));var _0x6549=function(_0x244503,_0x4b4c98){_0x244503=_0x244503-0x0;var _0x28a68d=_0x5496[_0x244503];return _0x28a68d;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index cc3cfa7..d63e7a9 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 _0x5a61=['moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash','api'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x5a61,0x1ab));var _0x15a6=function(_0x2384b7,_0x233c1a){_0x2384b7=_0x2384b7-0x0;var _0x1b58ac=_0x5a61[_0x2384b7];return _0x1b58ac;};'use strict';var _=require(_0x15a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x15a6('0x1'));var moment=require(_0x15a6('0x2'));var BPromise=require(_0x15a6('0x3'));var rp=require(_0x15a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15a6('0x5'));var config=require(_0x15a6('0x6'));var attributes=require(_0x15a6('0x7'));module[_0x15a6('0x8')]=function(_0x2de4aa,_0xa7c054){return _0x2de4aa[_0x15a6('0x9')](_0x15a6('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba73=['path','rimraf','../../config/environment','./integration.attributes','exports','integrations','../../config/logger','api'];(function(_0xf48fb8,_0x1789e2){var _0x32dbaf=function(_0xf04581){while(--_0xf04581){_0xf48fb8['push'](_0xf48fb8['shift']());}};_0x32dbaf(++_0x1789e2);}(_0xba73,0x1e6));var _0x3ba7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba73[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ba7('0x0'))(_0x3ba7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ba7('0x2'));var rimraf=require(_0x3ba7('0x3'));var config=require(_0x3ba7('0x4'));var attributes=require(_0x3ba7('0x5'));module[_0x3ba7('0x6')]=function(_0x372883,_0x40dd4c){return _0x372883['define']('Integration',attributes,{'tableName':_0x3ba7('0x7'),'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 2a9f0f4..9d26840 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x11e5d7,_0x21840c){var _0x162a61=function(_0x4335c2){while(--_0x4335c2){_0x11e5d7['push'](_0x11e5d7['shift']());}};_0x162a61(++_0x21840c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x25f03d,_0x547946){_0x25f03d=_0x25f03d-0x0;var _0x43c943=_0x5f2f[_0x25f03d];return _0x43c943;};'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')]('Integration,\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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5ae4b6,_0x31540b){var _0x26ad27=function(_0x189703){while(--_0x189703){_0x5ae4b6['push'](_0x5ae4b6['shift']());}};_0x26ad27(++_0x31540b);}(_0x14a0,0x8e));var _0x014a=function(_0x1f57d0,_0x1391c4){_0x1f57d0=_0x1f57d0-0x0;var _0x362865=_0x14a0[_0x1f57d0];return _0x362865;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 864ea8f..7a41bf4 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33feb1,_0x4a5b06){var _0x71df44=function(_0x59a09c){while(--_0x59a09c){_0x33feb1['push'](_0x33feb1['shift']());}};_0x71df44(++_0x4a5b06);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x182f28,_0x3a76a0){_0x182f28=_0x182f28-0x0;var _0x1d277f=_0xc6ac[_0x182f28];return _0x1d277f;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xda2d,0x102));var _0xdda2=function(_0x1a8d16,_0x404a25){_0x1a8d16=_0x1a8d16-0x0;var _0x3b06e8=_0xda2d[_0x1a8d16];return _0x3b06e8;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a1c0e5a..4d647e0 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 _0x0a0b=['BOOLEAN','TEXT','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3959e2,_0x51325a){var _0x3efca3=function(_0x5577cc){while(--_0x5577cc){_0x3959e2['push'](_0x3959e2['shift']());}};_0x3efca3(++_0x51325a);}(_0x0a0b,0x1bd));var _0xb0a0=function(_0x3c6616,_0x44f53a){_0x3c6616=_0x3c6616-0x0;var _0x502821=_0x0a0b[_0x3c6616];return _0x502821;};'use strict';var Sequelize=require(_0xb0a0('0x0'));module[_0xb0a0('0x1')]={'integration':{'type':Sequelize[_0xb0a0('0x2')]},'eventChannel':{'type':Sequelize[_0xb0a0('0x2')]},'exitStatus':{'type':Sequelize[_0xb0a0('0x2')]},'ticketId':{'type':Sequelize[_0xb0a0('0x2')]},'integrationId':{'type':Sequelize[_0xb0a0('0x3')]},'contacts':{'type':Sequelize[_0xb0a0('0x2')]},'uniqueid':{'type':Sequelize[_0xb0a0('0x2')]},'calleridnum':{'type':Sequelize[_0xb0a0('0x2')]},'calleridname':{'type':Sequelize[_0xb0a0('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb0a0('0x2')]},'membername':{'type':Sequelize[_0xb0a0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb0a0('0x4')]},'agentconnectAt':{'type':Sequelize[_0xb0a0('0x4')]},'holdtime':{'type':Sequelize[_0xb0a0('0x3')]},'agentcomplete':{'type':Sequelize[_0xb0a0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb0a0('0x4')]},'talktime':{'type':Sequelize[_0xb0a0('0x3')]},'agentacw':{'type':Sequelize[_0xb0a0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb0a0('0x3')]},'reason':{'type':Sequelize[_0xb0a0('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb0a0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb0a0('0x4')]},'agentdump':{'type':Sequelize[_0xb0a0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb0a0('0x4')]},'lastevent':{'type':Sequelize[_0xb0a0('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb0a0('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb0a0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb0a0('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb0a0('0x2')]},'destchannelstate':{'type':Sequelize[_0xb0a0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb0a0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb0a0('0x2')]},'destcalleridname':{'type':Sequelize[_0xb0a0('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xb0a0('0x2')]},'destaccountcode':{'type':Sequelize[_0xb0a0('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xb0a0('0x2')]},'messageId':{'type':Sequelize[_0xb0a0('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xb0a0('0x2')]},'from':{'type':Sequelize[_0xb0a0('0x2')]},'to':{'type':Sequelize[_0xb0a0('0x2')]},'cc':{'type':Sequelize[_0xb0a0('0x2')]},'attachment':{'type':Sequelize[_0xb0a0('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xb0a0('0x6')]},'status':{'type':Sequelize['ENUM'](_0xb0a0('0x7'),'SENDING',_0xb0a0('0x8'),_0xb0a0('0x9'))},'url':{'type':Sequelize[_0xb0a0('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xb0a0('0x2')]},'projectId':{'type':Sequelize[_0xb0a0('0x3')]}}; \ No newline at end of file +var _0x947c=['sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED'];(function(_0x26d74d,_0x3c6b97){var _0xbcf628=function(_0x59c4c2){while(--_0x59c4c2){_0x26d74d['push'](_0x26d74d['shift']());}};_0xbcf628(++_0x3c6b97);}(_0x947c,0x14a));var _0xc947=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x947c[_0x496738];return _0xee1381;};'use strict';var Sequelize=require(_0xc947('0x0'));module['exports']={'integration':{'type':Sequelize[_0xc947('0x1')]},'eventChannel':{'type':Sequelize[_0xc947('0x1')]},'exitStatus':{'type':Sequelize[_0xc947('0x1')]},'ticketId':{'type':Sequelize[_0xc947('0x1')]},'integrationId':{'type':Sequelize[_0xc947('0x2')]},'contacts':{'type':Sequelize[_0xc947('0x1')]},'uniqueid':{'type':Sequelize[_0xc947('0x1')]},'calleridnum':{'type':Sequelize[_0xc947('0x1')]},'calleridname':{'type':Sequelize[_0xc947('0x1')]},'queue':{'type':Sequelize[_0xc947('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc947('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc947('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc947('0x3')]},'holdtime':{'type':Sequelize[_0xc947('0x2')]},'agentcomplete':{'type':Sequelize[_0xc947('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc947('0x3')]},'talktime':{'type':Sequelize[_0xc947('0x2')]},'agentacw':{'type':Sequelize[_0xc947('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc947('0x2')]},'reason':{'type':Sequelize[_0xc947('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xc947('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc947('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc947('0x3')]},'lastevent':{'type':Sequelize[_0xc947('0x1')]},'channel':{'type':Sequelize[_0xc947('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc947('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc947('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc947('0x1')]},'exten':{'type':Sequelize[_0xc947('0x1')]},'priority':{'type':Sequelize[_0xc947('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc947('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc947('0x1')]},'destcalleridnum':{'type':Sequelize[_0xc947('0x1')]},'destcalleridname':{'type':Sequelize[_0xc947('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc947('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xc947('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc947('0x1')]},'destexten':{'type':Sequelize[_0xc947('0x1')]},'destpriority':{'type':Sequelize[_0xc947('0x1')]},'destuniqueid':{'type':Sequelize[_0xc947('0x1')]},'messageId':{'type':Sequelize[_0xc947('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xc947('0x1')]},'from':{'type':Sequelize[_0xc947('0x1')]},'to':{'type':Sequelize[_0xc947('0x1')]},'cc':{'type':Sequelize[_0xc947('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xc947('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xc947('0x6')](_0xc947('0x7'),_0xc947('0x8'),_0xc947('0x9'),_0xc947('0xa'))},'url':{'type':Sequelize[_0xc947('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xc947('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 3f90c2d..fed31d4 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 _0xf179=['includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','IntegrationReport'];(function(_0x3ef14d,_0x54eef6){var _0x2f24ba=function(_0x1874d5){while(--_0x1874d5){_0x3ef14d['push'](_0x3ef14d['shift']());}};_0x2f24ba(++_0x54eef6);}(_0xf179,0x14a));var _0x9f17=function(_0x268a29,_0x5c7b8a){_0x268a29=_0x268a29-0x0;var _0x5779f8=_0xf179[_0x268a29];return _0x5779f8;};'use strict';var emlformat=require(_0x9f17('0x0'));var rimraf=require(_0x9f17('0x1'));var zipdir=require(_0x9f17('0x2'));var jsonpatch=require(_0x9f17('0x3'));var rp=require(_0x9f17('0x4'));var moment=require(_0x9f17('0x5'));var BPromise=require(_0x9f17('0x6'));var Mustache=require('mustache');var util=require(_0x9f17('0x7'));var path=require('path');var sox=require(_0x9f17('0x8'));var csv=require(_0x9f17('0x9'));var ejs=require(_0x9f17('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9f17('0xb'));var crypto=require(_0x9f17('0xc'));var jsforce=require(_0x9f17('0xd'));var deskjs=require(_0x9f17('0xe'));var toCsv=require(_0x9f17('0x9'));var querystring=require(_0x9f17('0xf'));var Papa=require(_0x9f17('0x10'));var Redis=require('ioredis');var authService=require(_0x9f17('0x11'));var qs=require(_0x9f17('0x12'));var as=require(_0x9f17('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f17('0x14'))(_0x9f17('0x15'));var utils=require(_0x9f17('0x16'));var config=require(_0x9f17('0x17'));var licenseUtil=require(_0x9f17('0x18'));var db=require(_0x9f17('0x19'))['db'];function respondWithStatusCode(_0x2b50ac,_0x3b8059){_0x3b8059=_0x3b8059||0xcc;return function(_0x4cbb1d){if(_0x4cbb1d){return _0x2b50ac[_0x9f17('0x1a')](_0x3b8059);}return _0x2b50ac[_0x9f17('0x1b')](_0x3b8059)[_0x9f17('0x1c')]();};}function respondWithResult(_0x5c7647,_0x4f0027){_0x4f0027=_0x4f0027||0xc8;return function(_0x3d85da){if(_0x3d85da){return _0x5c7647[_0x9f17('0x1b')](_0x4f0027)['json'](_0x3d85da);}};}function respondWithFilteredResult(_0x36e21c,_0x52915b){return function(_0x1ecb18){if(_0x1ecb18){var _0x7fc27e=typeof _0x52915b[_0x9f17('0x1d')]===_0x9f17('0x1e')&&typeof _0x52915b[_0x9f17('0x1f')]==='undefined';var _0x54b6f0=_0x1ecb18[_0x9f17('0x20')];var _0x2deba1=_0x7fc27e?0x0:_0x52915b[_0x9f17('0x1d')];var _0x2a5554=_0x7fc27e?_0x1ecb18['count']:_0x52915b[_0x9f17('0x1d')]+_0x52915b[_0x9f17('0x1f')];var _0x4208ee;if(_0x2a5554>=_0x54b6f0){_0x2a5554=_0x54b6f0;_0x4208ee=0xc8;}else{_0x4208ee=0xce;}_0x36e21c[_0x9f17('0x1b')](_0x4208ee);return _0x36e21c[_0x9f17('0x21')](_0x9f17('0x22'),_0x2deba1+'-'+_0x2a5554+'/'+_0x54b6f0)[_0x9f17('0x23')](_0x1ecb18);}return null;};}function patchUpdates(_0x2beee3){return function(_0x726c9c){try{jsonpatch['apply'](_0x726c9c,_0x2beee3,!![]);}catch(_0x415613){return BPromise[_0x9f17('0x24')](_0x415613);}return _0x726c9c[_0x9f17('0x25')]();};}function saveUpdates(_0x4968db,_0x537349){return function(_0x587433){if(_0x587433){return _0x587433[_0x9f17('0x26')](_0x4968db)[_0x9f17('0x27')](function(_0x461ce9){return _0x461ce9;});}return null;};}function removeEntity(_0x3a25d5,_0x248b91){return function(_0x1796e6){if(_0x1796e6){return _0x1796e6['destroy']()[_0x9f17('0x27')](function(){_0x3a25d5[_0x9f17('0x1b')](0xcc)[_0x9f17('0x1c')]();});}};}function handleEntityNotFound(_0x2da7e6,_0x237169){return function(_0x472ad6){if(!_0x472ad6){_0x2da7e6[_0x9f17('0x1a')](0x194);}return _0x472ad6;};}function handleError(_0x571e8b,_0xa12cda){_0xa12cda=_0xa12cda||0x1f4;return function(_0x5d94b9){logger[_0x9f17('0x28')](_0x5d94b9[_0x9f17('0x29')]);if(_0x5d94b9[_0x9f17('0x2a')]){delete _0x5d94b9[_0x9f17('0x2a')];}_0x571e8b[_0x9f17('0x1b')](_0xa12cda)['send'](_0x5d94b9);};}exports[_0x9f17('0x2b')]=function(_0x570add,_0xb0309){var _0x246715={},_0x13b987={},_0x497688={'count':0x0,'rows':[]};var _0x44c382=_[_0x9f17('0x2c')](db['IntegrationReport'][_0x9f17('0x2d')],function(_0x476712){return{'name':_0x476712[_0x9f17('0x2e')],'type':_0x476712['type'][_0x9f17('0x2f')]};});_0x13b987[_0x9f17('0x30')]=_[_0x9f17('0x2c')](_0x44c382,_0x9f17('0x2a'));_0x13b987[_0x9f17('0x31')]=_[_0x9f17('0x32')](_0x570add['query']);_0x13b987[_0x9f17('0x33')]=_[_0x9f17('0x34')](_0x13b987['model'],_0x13b987[_0x9f17('0x31')]);_0x246715['attributes']=_[_0x9f17('0x34')](_0x13b987['model'],qs[_0x9f17('0x35')](_0x570add[_0x9f17('0x31')][_0x9f17('0x35')]));_0x246715[_0x9f17('0x36')]=_0x246715[_0x9f17('0x36')]['length']?_0x246715['attributes']:_0x13b987['model'];if(!_0x570add[_0x9f17('0x31')][_0x9f17('0x37')](_0x9f17('0x38'))){_0x246715[_0x9f17('0x1f')]=qs['limit'](_0x570add[_0x9f17('0x31')][_0x9f17('0x1f')]);_0x246715['offset']=qs[_0x9f17('0x1d')](_0x570add[_0x9f17('0x31')][_0x9f17('0x1d')]);}_0x246715[_0x9f17('0x39')]=qs[_0x9f17('0x3a')](_0x570add['query'][_0x9f17('0x3a')]);_0x246715[_0x9f17('0x3b')]=qs[_0x9f17('0x33')](_[_0x9f17('0x3c')](_0x570add[_0x9f17('0x31')],_0x13b987[_0x9f17('0x33')]),_0x44c382);if(_0x570add[_0x9f17('0x31')][_0x9f17('0x3d')]){_0x246715[_0x9f17('0x3b')]=_['merge'](_0x246715[_0x9f17('0x3b')],{'$or':_[_0x9f17('0x2c')](_0x44c382,function(_0xc31100){if(_0xc31100[_0x9f17('0x3e')]!=='VIRTUAL'){var _0x3e36bd={};_0x3e36bd[_0xc31100[_0x9f17('0x2a')]]={'$like':'%'+_0x570add[_0x9f17('0x31')]['filter']+'%'};return _0x3e36bd;}})});}_0x246715=_[_0x9f17('0x3f')]({},_0x246715,_0x570add['options']);var _0x1538dd={'where':_0x246715[_0x9f17('0x3b')]};return db[_0x9f17('0x40')][_0x9f17('0x20')](_0x1538dd)['then'](function(_0x457d78){_0x497688[_0x9f17('0x20')]=_0x457d78;if(_0x570add[_0x9f17('0x31')][_0x9f17('0x41')]){_0x246715[_0x9f17('0x42')]=[{'all':!![]}];}return db[_0x9f17('0x40')][_0x9f17('0x43')](_0x246715);})[_0x9f17('0x27')](function(_0x2702ab){_0x497688[_0x9f17('0x44')]=_0x2702ab;return _0x497688;})[_0x9f17('0x27')](respondWithFilteredResult(_0xb0309,_0x246715))[_0x9f17('0x45')](handleError(_0xb0309,null));};exports[_0x9f17('0x46')]=function(_0x280983,_0x59164e){var _0x4eb294={'raw':![],'where':{'id':_0x280983[_0x9f17('0x47')]['id']}},_0x5b4529={};_0x5b4529[_0x9f17('0x30')]=_[_0x9f17('0x32')](db[_0x9f17('0x40')]['rawAttributes']);_0x5b4529[_0x9f17('0x31')]=_[_0x9f17('0x32')](_0x280983[_0x9f17('0x31')]);_0x5b4529[_0x9f17('0x33')]=_[_0x9f17('0x34')](_0x5b4529[_0x9f17('0x30')],_0x5b4529[_0x9f17('0x31')]);_0x4eb294[_0x9f17('0x36')]=_[_0x9f17('0x34')](_0x5b4529[_0x9f17('0x30')],qs[_0x9f17('0x35')](_0x280983[_0x9f17('0x31')][_0x9f17('0x35')]));_0x4eb294['attributes']=_0x4eb294['attributes'][_0x9f17('0x48')]?_0x4eb294[_0x9f17('0x36')]:_0x5b4529[_0x9f17('0x30')];if(_0x280983[_0x9f17('0x31')][_0x9f17('0x41')]){_0x4eb294['include']=[{'all':!![]}];}_0x4eb294=_[_0x9f17('0x3f')]({},_0x4eb294,_0x280983[_0x9f17('0x49')]);return db['IntegrationReport']['find'](_0x4eb294)[_0x9f17('0x27')](handleEntityNotFound(_0x59164e,null))[_0x9f17('0x27')](respondWithResult(_0x59164e,null))[_0x9f17('0x45')](handleError(_0x59164e,null));};exports['create']=function(_0x1dbe11,_0x56e812){return db['IntegrationReport'][_0x9f17('0x4a')](_0x1dbe11[_0x9f17('0x4b')],{})['then'](respondWithResult(_0x56e812,0xc9))[_0x9f17('0x45')](handleError(_0x56e812,null));};exports[_0x9f17('0x26')]=function(_0x597cd4,_0x54b098){if(_0x597cd4[_0x9f17('0x4b')]['id']){delete _0x597cd4[_0x9f17('0x4b')]['id'];}return db[_0x9f17('0x40')][_0x9f17('0x4c')]({'where':{'id':_0x597cd4['params']['id']}})[_0x9f17('0x27')](handleEntityNotFound(_0x54b098,null))[_0x9f17('0x27')](saveUpdates(_0x597cd4[_0x9f17('0x4b')],null))[_0x9f17('0x27')](respondWithResult(_0x54b098,null))['catch'](handleError(_0x54b098,null));};exports[_0x9f17('0x4d')]=function(_0x3ef5cd,_0x2454c8){return db[_0x9f17('0x40')][_0x9f17('0x4c')]({'where':{'id':_0x3ef5cd[_0x9f17('0x47')]['id']}})[_0x9f17('0x27')](handleEntityNotFound(_0x2454c8,null))[_0x9f17('0x27')](removeEntity(_0x2454c8,null))[_0x9f17('0x45')](handleError(_0x2454c8,null));};exports[_0x9f17('0x4e')]=function(_0x46ab60,_0x47707f){return db[_0x9f17('0x40')][_0x9f17('0x4e')]()[_0x9f17('0x27')](respondWithResult(_0x47707f,null))[_0x9f17('0x45')](handleError(_0x47707f,null));}; \ No newline at end of file +var _0x8b93=['findAll','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','IntegrationReport','includeAll','include'];(function(_0x17797f,_0x5d3b05){var _0x187a1f=function(_0x5d427b){while(--_0x5d427b){_0x17797f['push'](_0x17797f['shift']());}};_0x187a1f(++_0x5d3b05);}(_0x8b93,0x128));var _0x38b9=function(_0xa3257,_0xce9286){_0xa3257=_0xa3257-0x0;var _0x3ee620=_0x8b93[_0xa3257];return _0x3ee620;};'use strict';var emlformat=require(_0x38b9('0x0'));var rimraf=require(_0x38b9('0x1'));var zipdir=require(_0x38b9('0x2'));var jsonpatch=require(_0x38b9('0x3'));var rp=require('request-promise');var moment=require(_0x38b9('0x4'));var BPromise=require(_0x38b9('0x5'));var Mustache=require('mustache');var util=require(_0x38b9('0x6'));var path=require(_0x38b9('0x7'));var sox=require(_0x38b9('0x8'));var csv=require('to-csv');var ejs=require(_0x38b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38b9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38b9('0xb'));var deskjs=require(_0x38b9('0xc'));var toCsv=require(_0x38b9('0xd'));var querystring=require(_0x38b9('0xe'));var Papa=require('papaparse');var Redis=require(_0x38b9('0xf'));var authService=require(_0x38b9('0x10'));var qs=require(_0x38b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38b9('0x12'));var logger=require(_0x38b9('0x13'))(_0x38b9('0x14'));var utils=require('../../config/utils');var config=require(_0x38b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51a144,_0x43f02f){_0x43f02f=_0x43f02f||0xcc;return function(_0x100459){if(_0x100459){return _0x51a144[_0x38b9('0x16')](_0x43f02f);}return _0x51a144['status'](_0x43f02f)['end']();};}function respondWithResult(_0x289a6e,_0x5a2385){_0x5a2385=_0x5a2385||0xc8;return function(_0x1fff6b){if(_0x1fff6b){return _0x289a6e[_0x38b9('0x17')](_0x5a2385)[_0x38b9('0x18')](_0x1fff6b);}};}function respondWithFilteredResult(_0x403a2b,_0x13008c){return function(_0x73398b){if(_0x73398b){var _0x3fffef=typeof _0x13008c[_0x38b9('0x19')]===_0x38b9('0x1a')&&typeof _0x13008c['limit']==='undefined';var _0x5e17b0=_0x73398b[_0x38b9('0x1b')];var _0x46cea9=_0x3fffef?0x0:_0x13008c[_0x38b9('0x19')];var _0x5e6c9b=_0x3fffef?_0x73398b[_0x38b9('0x1b')]:_0x13008c[_0x38b9('0x19')]+_0x13008c[_0x38b9('0x1c')];var _0x10c176;if(_0x5e6c9b>=_0x5e17b0){_0x5e6c9b=_0x5e17b0;_0x10c176=0xc8;}else{_0x10c176=0xce;}_0x403a2b[_0x38b9('0x17')](_0x10c176);return _0x403a2b[_0x38b9('0x1d')](_0x38b9('0x1e'),_0x46cea9+'-'+_0x5e6c9b+'/'+_0x5e17b0)[_0x38b9('0x18')](_0x73398b);}return null;};}function patchUpdates(_0x271981){return function(_0x564df3){try{jsonpatch[_0x38b9('0x1f')](_0x564df3,_0x271981,!![]);}catch(_0x570ce0){return BPromise['reject'](_0x570ce0);}return _0x564df3[_0x38b9('0x20')]();};}function saveUpdates(_0x305e00,_0x4add70){return function(_0x53b856){if(_0x53b856){return _0x53b856[_0x38b9('0x21')](_0x305e00)[_0x38b9('0x22')](function(_0x3cc913){return _0x3cc913;});}return null;};}function removeEntity(_0x2c7024,_0x977ae1){return function(_0x47bcf0){if(_0x47bcf0){return _0x47bcf0[_0x38b9('0x23')]()[_0x38b9('0x22')](function(){_0x2c7024[_0x38b9('0x17')](0xcc)[_0x38b9('0x24')]();});}};}function handleEntityNotFound(_0x5adae8,_0x247e56){return function(_0x29448c){if(!_0x29448c){_0x5adae8[_0x38b9('0x16')](0x194);}return _0x29448c;};}function handleError(_0x34e3f3,_0x51b2ee){_0x51b2ee=_0x51b2ee||0x1f4;return function(_0x5f3663){logger[_0x38b9('0x25')](_0x5f3663['stack']);if(_0x5f3663[_0x38b9('0x26')]){delete _0x5f3663[_0x38b9('0x26')];}_0x34e3f3['status'](_0x51b2ee)[_0x38b9('0x27')](_0x5f3663);};}exports[_0x38b9('0x28')]=function(_0x560f69,_0x38cb2c){var _0xa5761={},_0x135365={},_0x5ca6a0={'count':0x0,'rows':[]};var _0x33012b=_[_0x38b9('0x29')](db['IntegrationReport'][_0x38b9('0x2a')],function(_0x1044c2){return{'name':_0x1044c2[_0x38b9('0x2b')],'type':_0x1044c2[_0x38b9('0x2c')][_0x38b9('0x2d')]};});_0x135365[_0x38b9('0x2e')]=_[_0x38b9('0x29')](_0x33012b,_0x38b9('0x26'));_0x135365[_0x38b9('0x2f')]=_['keys'](_0x560f69['query']);_0x135365['filters']=_[_0x38b9('0x30')](_0x135365['model'],_0x135365['query']);_0xa5761[_0x38b9('0x31')]=_[_0x38b9('0x30')](_0x135365[_0x38b9('0x2e')],qs[_0x38b9('0x32')](_0x560f69[_0x38b9('0x2f')][_0x38b9('0x32')]));_0xa5761[_0x38b9('0x31')]=_0xa5761[_0x38b9('0x31')][_0x38b9('0x33')]?_0xa5761['attributes']:_0x135365['model'];if(!_0x560f69[_0x38b9('0x2f')]['hasOwnProperty'](_0x38b9('0x34'))){_0xa5761['limit']=qs['limit'](_0x560f69[_0x38b9('0x2f')][_0x38b9('0x1c')]);_0xa5761[_0x38b9('0x19')]=qs[_0x38b9('0x19')](_0x560f69[_0x38b9('0x2f')][_0x38b9('0x19')]);}_0xa5761[_0x38b9('0x35')]=qs[_0x38b9('0x36')](_0x560f69['query'][_0x38b9('0x36')]);_0xa5761[_0x38b9('0x37')]=qs[_0x38b9('0x38')](_[_0x38b9('0x39')](_0x560f69[_0x38b9('0x2f')],_0x135365['filters']),_0x33012b);if(_0x560f69[_0x38b9('0x2f')]['filter']){_0xa5761[_0x38b9('0x37')]=_[_0x38b9('0x3a')](_0xa5761['where'],{'$or':_[_0x38b9('0x29')](_0x33012b,function(_0x385706){if(_0x385706[_0x38b9('0x2c')]!=='VIRTUAL'){var _0x1c7be2={};_0x1c7be2[_0x385706[_0x38b9('0x26')]]={'$like':'%'+_0x560f69[_0x38b9('0x2f')][_0x38b9('0x3b')]+'%'};return _0x1c7be2;}})});}_0xa5761=_['merge']({},_0xa5761,_0x560f69[_0x38b9('0x3c')]);var _0x18a1fa={'where':_0xa5761[_0x38b9('0x37')]};return db[_0x38b9('0x3d')][_0x38b9('0x1b')](_0x18a1fa)[_0x38b9('0x22')](function(_0x36a212){_0x5ca6a0[_0x38b9('0x1b')]=_0x36a212;if(_0x560f69[_0x38b9('0x2f')][_0x38b9('0x3e')]){_0xa5761[_0x38b9('0x3f')]=[{'all':!![]}];}return db[_0x38b9('0x3d')][_0x38b9('0x40')](_0xa5761);})['then'](function(_0x1ed061){_0x5ca6a0['rows']=_0x1ed061;return _0x5ca6a0;})[_0x38b9('0x22')](respondWithFilteredResult(_0x38cb2c,_0xa5761))[_0x38b9('0x41')](handleError(_0x38cb2c,null));};exports['show']=function(_0x57f19a,_0x3ef378){var _0x23228f={'raw':![],'where':{'id':_0x57f19a[_0x38b9('0x42')]['id']}},_0x35eeb6={};_0x35eeb6[_0x38b9('0x2e')]=_[_0x38b9('0x43')](db[_0x38b9('0x3d')][_0x38b9('0x2a')]);_0x35eeb6[_0x38b9('0x2f')]=_[_0x38b9('0x43')](_0x57f19a[_0x38b9('0x2f')]);_0x35eeb6[_0x38b9('0x38')]=_[_0x38b9('0x30')](_0x35eeb6[_0x38b9('0x2e')],_0x35eeb6['query']);_0x23228f[_0x38b9('0x31')]=_['intersection'](_0x35eeb6[_0x38b9('0x2e')],qs[_0x38b9('0x32')](_0x57f19a[_0x38b9('0x2f')][_0x38b9('0x32')]));_0x23228f[_0x38b9('0x31')]=_0x23228f[_0x38b9('0x31')][_0x38b9('0x33')]?_0x23228f[_0x38b9('0x31')]:_0x35eeb6['model'];if(_0x57f19a[_0x38b9('0x2f')][_0x38b9('0x3e')]){_0x23228f[_0x38b9('0x3f')]=[{'all':!![]}];}_0x23228f=_['merge']({},_0x23228f,_0x57f19a[_0x38b9('0x3c')]);return db['IntegrationReport'][_0x38b9('0x44')](_0x23228f)[_0x38b9('0x22')](handleEntityNotFound(_0x3ef378,null))['then'](respondWithResult(_0x3ef378,null))[_0x38b9('0x41')](handleError(_0x3ef378,null));};exports[_0x38b9('0x45')]=function(_0xf3826c,_0x263adf){return db[_0x38b9('0x3d')][_0x38b9('0x45')](_0xf3826c[_0x38b9('0x46')],{})[_0x38b9('0x22')](respondWithResult(_0x263adf,0xc9))[_0x38b9('0x41')](handleError(_0x263adf,null));};exports[_0x38b9('0x21')]=function(_0x2609af,_0x49ec48){if(_0x2609af[_0x38b9('0x46')]['id']){delete _0x2609af['body']['id'];}return db[_0x38b9('0x3d')]['find']({'where':{'id':_0x2609af[_0x38b9('0x42')]['id']}})[_0x38b9('0x22')](handleEntityNotFound(_0x49ec48,null))[_0x38b9('0x22')](saveUpdates(_0x2609af[_0x38b9('0x46')],null))[_0x38b9('0x22')](respondWithResult(_0x49ec48,null))['catch'](handleError(_0x49ec48,null));};exports[_0x38b9('0x23')]=function(_0x3277da,_0x28ea18){return db['IntegrationReport'][_0x38b9('0x44')]({'where':{'id':_0x3277da[_0x38b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x28ea18,null))[_0x38b9('0x22')](removeEntity(_0x28ea18,null))[_0x38b9('0x41')](handleError(_0x28ea18,null));};exports[_0x38b9('0x47')]=function(_0x187886,_0x479a6a){return db[_0x38b9('0x3d')][_0x38b9('0x47')]()[_0x38b9('0x22')](respondWithResult(_0x479a6a,null))[_0x38b9('0x41')](handleError(_0x479a6a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3388ec7..ae07c83 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 _0xbb04=['define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x515bab,_0x5f574c){var _0x51e5ba=function(_0x1409fb){while(--_0x1409fb){_0x515bab['push'](_0x515bab['shift']());}};_0x51e5ba(++_0x5f574c);}(_0xbb04,0x91));var _0x4bb0=function(_0x127316,_0x2774a8){_0x127316=_0x127316-0x0;var _0x34d919=_0xbb04[_0x127316];return _0x34d919;};'use strict';var _=require(_0x4bb0('0x0'));var util=require(_0x4bb0('0x1'));var logger=require(_0x4bb0('0x2'))(_0x4bb0('0x3'));var moment=require(_0x4bb0('0x4'));var BPromise=require(_0x4bb0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bb0('0x6'));var rimraf=require(_0x4bb0('0x7'));var config=require(_0x4bb0('0x8'));var attributes=require(_0x4bb0('0x9'));module[_0x4bb0('0xa')]=function(_0x12a125,_0x2618b9){return _0x12a125[_0x4bb0('0xb')](_0x4bb0('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a93=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','util'];(function(_0x42aa60,_0xbe06a3){var _0x353207=function(_0xc9b00c){while(--_0xc9b00c){_0x42aa60['push'](_0x42aa60['shift']());}};_0x353207(++_0xbe06a3);}(_0x6a93,0xa7));var _0x36a9=function(_0x514854,_0x3ecd33){_0x514854=_0x514854-0x0;var _0x19b3e6=_0x6a93[_0x514854];return _0x19b3e6;};'use strict';var _=require('lodash');var util=require(_0x36a9('0x0'));var logger=require(_0x36a9('0x1'))('api');var moment=require(_0x36a9('0x2'));var BPromise=require(_0x36a9('0x3'));var rp=require(_0x36a9('0x4'));var fs=require('fs');var path=require(_0x36a9('0x5'));var rimraf=require(_0x36a9('0x6'));var config=require(_0x36a9('0x7'));var attributes=require(_0x36a9('0x8'));module['exports']=function(_0x3a37d7,_0x485538){return _0x3a37d7[_0x36a9('0x9')](_0x36a9('0xa'),attributes,{'tableName':_0x36a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 00da174..0106b80 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x75fa7,_0x5d3421){var _0x4d7dd2=function(_0x1537d1){while(--_0x1537d1){_0x75fa7['push'](_0x75fa7['shift']());}};_0x4d7dd2(++_0x5d3421);}(_0xabce,0x103));var _0xeabc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xabce[_0x2df507];return _0x1f7167;};'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')]('IntegrationReport,\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 +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(_0x48ef9c,_0xbeb74e){var _0x2d119d=function(_0x274463){while(--_0x274463){_0x48ef9c['push'](_0x48ef9c['shift']());}};_0x2d119d(++_0xbeb74e);}(_0x57ca,0x108));var _0xa57c=function(_0x27acb0,_0x4bc9eb){_0x27acb0=_0x27acb0-0x0;var _0x2c3e10=_0x57ca[_0x27acb0];return _0x2c3e10;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3613c63..6267703 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 _0x96aa=['create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post'];(function(_0x3cb9ae,_0x2c6ac5){var _0x43c532=function(_0x22ad58){while(--_0x22ad58){_0x3cb9ae['push'](_0x3cb9ae['shift']());}};_0x43c532(++_0x2c6ac5);}(_0x96aa,0x67));var _0xa96a=function(_0x1a857e,_0x43a387){_0x1a857e=_0x1a857e-0x0;var _0xa24af9=_0x96aa[_0x1a857e];return _0xa24af9;};'use strict';var multer=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var path=require('path');var timeout=require(_0xa96a('0x2'));var express=require(_0xa96a('0x3'));var router=express[_0xa96a('0x4')]();var fs_extra=require(_0xa96a('0x5'));var auth=require(_0xa96a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa96a('0x7'));var controller=require(_0xa96a('0x8'));router['get']('/',auth[_0xa96a('0x9')](),controller[_0xa96a('0xa')]);router[_0xa96a('0xb')](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller[_0xa96a('0xd')]);router[_0xa96a('0xb')](_0xa96a('0xe'),auth[_0xa96a('0x9')](),controller[_0xa96a('0xf')]);router[_0xa96a('0x10')]('/',auth['isAuthenticated'](),controller[_0xa96a('0x11')]);router['post'](_0xa96a('0xe'),auth[_0xa96a('0x9')](),controller['addInterval']);router[_0xa96a('0x10')](_0xa96a('0x12'),auth[_0xa96a('0x9')](),controller[_0xa96a('0x13')]);router[_0xa96a('0x14')](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller[_0xa96a('0x15')]);router[_0xa96a('0x16')](_0xa96a('0xc'),auth[_0xa96a('0x9')](),controller[_0xa96a('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc2b2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xc2b2,0xd3));var _0x2c2b=function(_0x25c487,_0x606615){_0x25c487=_0x25c487-0x0;var _0xe55bd7=_0xc2b2[_0x25c487];return _0xe55bd7;};'use strict';var multer=require(_0x2c2b('0x0'));var util=require(_0x2c2b('0x1'));var path=require(_0x2c2b('0x2'));var timeout=require(_0x2c2b('0x3'));var express=require(_0x2c2b('0x4'));var router=express[_0x2c2b('0x5')]();var fs_extra=require(_0x2c2b('0x6'));var auth=require(_0x2c2b('0x7'));var interaction=require(_0x2c2b('0x8'));var config=require('../../config/environment');var controller=require(_0x2c2b('0x9'));router[_0x2c2b('0xa')]('/',auth[_0x2c2b('0xb')](),controller[_0x2c2b('0xc')]);router[_0x2c2b('0xa')]('/:id',auth[_0x2c2b('0xb')](),controller[_0x2c2b('0xd')]);router['get'](_0x2c2b('0xe'),auth[_0x2c2b('0xb')](),controller[_0x2c2b('0xf')]);router[_0x2c2b('0x10')]('/',auth[_0x2c2b('0xb')](),controller[_0x2c2b('0x11')]);router[_0x2c2b('0x10')]('/:id/sub_intervals',auth[_0x2c2b('0xb')](),controller[_0x2c2b('0x12')]);router[_0x2c2b('0x10')](_0x2c2b('0x13'),auth[_0x2c2b('0xb')](),controller[_0x2c2b('0x14')]);router[_0x2c2b('0x15')]('/:id',auth[_0x2c2b('0xb')](),controller[_0x2c2b('0x16')]);router[_0x2c2b('0x17')]('/:id',auth[_0x2c2b('0xb')](),controller[_0x2c2b('0x18')]);module[_0x2c2b('0x19')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 0033389..f7ce132 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 _0x5871=['STRING','sequelize','exports'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0x5871,0x193));var _0x1587=function(_0x473a48,_0x3b4a6b){_0x473a48=_0x473a48-0x0;var _0x11fdb1=_0x5871[_0x473a48];return _0x11fdb1;};'use strict';var Sequelize=require(_0x1587('0x0'));module[_0x1587('0x1')]={'name':{'type':Sequelize[_0x1587('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1587('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa3ab=['sequelize','STRING'];(function(_0x49f701,_0x2924cc){var _0x58541a=function(_0x4708db){while(--_0x4708db){_0x49f701['push'](_0x49f701['shift']());}};_0x58541a(++_0x2924cc);}(_0xa3ab,0xcc));var _0xba3a=function(_0x4cb5cb,_0x213119){_0x4cb5cb=_0x4cb5cb-0x0;var _0x12b516=_0xa3ab[_0x4cb5cb];return _0x12b516;};'use strict';var Sequelize=require(_0xba3a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba3a('0x1')]},'interval':{'type':Sequelize[_0xba3a('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 103158d..ac9076c 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 _0xc6d7=['limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getIntervals','findOne','addIntervals','sequelize','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined'];(function(_0x47e102,_0x1c9448){var _0x62da49=function(_0x2d34b8){while(--_0x2d34b8){_0x47e102['push'](_0x47e102['shift']());}};_0x62da49(++_0x1c9448);}(_0xc6d7,0x9c));var _0x7c6d=function(_0x2cf677,_0x413dba){_0x2cf677=_0x2cf677-0x0;var _0x8dca79=_0xc6d7[_0x2cf677];return _0x8dca79;};'use strict';var emlformat=require(_0x7c6d('0x0'));var rimraf=require(_0x7c6d('0x1'));var zipdir=require(_0x7c6d('0x2'));var jsonpatch=require(_0x7c6d('0x3'));var rp=require('request-promise');var moment=require(_0x7c6d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7c6d('0x5'));var sox=require(_0x7c6d('0x6'));var csv=require(_0x7c6d('0x7'));var ejs=require(_0x7c6d('0x8'));var fs=require('fs');var fs_extra=require(_0x7c6d('0x9'));var _=require(_0x7c6d('0xa'));var squel=require(_0x7c6d('0xb'));var crypto=require(_0x7c6d('0xc'));var jsforce=require(_0x7c6d('0xd'));var deskjs=require(_0x7c6d('0xe'));var toCsv=require(_0x7c6d('0x7'));var querystring=require(_0x7c6d('0xf'));var Papa=require(_0x7c6d('0x10'));var Redis=require(_0x7c6d('0x11'));var authService=require(_0x7c6d('0x12'));var qs=require(_0x7c6d('0x13'));var as=require(_0x7c6d('0x14'));var hardwareService=require(_0x7c6d('0x15'));var logger=require(_0x7c6d('0x16'))(_0x7c6d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7c6d('0x18'));var db=require(_0x7c6d('0x19'))['db'];var extensions=require(_0x7c6d('0x1a'));function respondWithStatusCode(_0x7bbe8a,_0x497327){_0x497327=_0x497327||0xcc;return function(_0x1c8b71){if(_0x1c8b71){return _0x7bbe8a['sendStatus'](_0x497327);}return _0x7bbe8a[_0x7c6d('0x1b')](_0x497327)[_0x7c6d('0x1c')]();};}function respondWithResult(_0x256f07,_0x3556fa){_0x3556fa=_0x3556fa||0xc8;return function(_0x4e4177){if(_0x4e4177){return _0x256f07[_0x7c6d('0x1b')](_0x3556fa)[_0x7c6d('0x1d')](_0x4e4177);}};}function respondWithFilteredResult(_0x1a23ac,_0x524a20){return function(_0x264f14){if(_0x264f14){var _0x2e74e1=typeof _0x524a20[_0x7c6d('0x1e')]===_0x7c6d('0x1f')&&typeof _0x524a20[_0x7c6d('0x20')]===_0x7c6d('0x1f');var _0x3a138e=_0x264f14[_0x7c6d('0x21')];var _0x4ed19d=_0x2e74e1?0x0:_0x524a20[_0x7c6d('0x1e')];var _0xd41fec=_0x2e74e1?_0x264f14['count']:_0x524a20[_0x7c6d('0x1e')]+_0x524a20[_0x7c6d('0x20')];var _0x307858;if(_0xd41fec>=_0x3a138e){_0xd41fec=_0x3a138e;_0x307858=0xc8;}else{_0x307858=0xce;}_0x1a23ac[_0x7c6d('0x1b')](_0x307858);return _0x1a23ac[_0x7c6d('0x22')](_0x7c6d('0x23'),_0x4ed19d+'-'+_0xd41fec+'/'+_0x3a138e)[_0x7c6d('0x1d')](_0x264f14);}return null;};}function patchUpdates(_0x26cc9c){return function(_0x291340){try{jsonpatch[_0x7c6d('0x24')](_0x291340,_0x26cc9c,!![]);}catch(_0x2462a6){return BPromise[_0x7c6d('0x25')](_0x2462a6);}return _0x291340[_0x7c6d('0x26')]();};}function saveUpdates(_0x3447a1,_0x245551){return function(_0x1229ab){if(_0x1229ab){return _0x1229ab[_0x7c6d('0x27')](_0x3447a1)['then'](function(_0x5bc0a4){return _0x5bc0a4;});}return null;};}function removeEntity(_0x36b767,_0x6b1fce){return function(_0x5d8fed){if(_0x5d8fed){return _0x5d8fed[_0x7c6d('0x28')]()[_0x7c6d('0x29')](function(){var _0x3c4fff=_0x5d8fed[_0x7c6d('0x2a')]({'plain':!![]});var _0x13266c='Intervals';return db[_0x7c6d('0x2b')][_0x7c6d('0x28')]({'where':{'type':_0x13266c,'resourceId':_0x3c4fff['id']}})[_0x7c6d('0x29')](function(){return _0x5d8fed;});})[_0x7c6d('0x29')](function(){_0x36b767[_0x7c6d('0x1b')](0xcc)[_0x7c6d('0x1c')]();});}};}function handleEntityNotFound(_0x377c8a,_0x35c1ff){return function(_0x474644){if(!_0x474644){_0x377c8a[_0x7c6d('0x2c')](0x194);}return _0x474644;};}function handleError(_0x1b5e82,_0x11324c){_0x11324c=_0x11324c||0x1f4;return function(_0x41090e){logger[_0x7c6d('0x2d')](_0x41090e[_0x7c6d('0x2e')]);if(_0x41090e[_0x7c6d('0x2f')]){delete _0x41090e['name'];}_0x1b5e82[_0x7c6d('0x1b')](_0x11324c)[_0x7c6d('0x30')](_0x41090e);};}exports[_0x7c6d('0x31')]=function(_0x3577f9,_0x46077a){var _0x227915={},_0x55fc2e={},_0x35b028={'count':0x0,'rows':[]};var _0x3f009a=_[_0x7c6d('0x32')](db[_0x7c6d('0x33')][_0x7c6d('0x34')],function(_0x20f7df){return{'name':_0x20f7df[_0x7c6d('0x35')],'type':_0x20f7df[_0x7c6d('0x36')][_0x7c6d('0x37')]};});_0x55fc2e[_0x7c6d('0x38')]=_[_0x7c6d('0x32')](_0x3f009a,_0x7c6d('0x2f'));_0x55fc2e[_0x7c6d('0x39')]=_['keys'](_0x3577f9['query']);_0x55fc2e[_0x7c6d('0x3a')]=_[_0x7c6d('0x3b')](_0x55fc2e[_0x7c6d('0x38')],_0x55fc2e[_0x7c6d('0x39')]);_0x227915[_0x7c6d('0x3c')]=_[_0x7c6d('0x3b')](_0x55fc2e[_0x7c6d('0x38')],qs[_0x7c6d('0x3d')](_0x3577f9[_0x7c6d('0x39')][_0x7c6d('0x3d')]));_0x227915['attributes']=_0x227915[_0x7c6d('0x3c')][_0x7c6d('0x3e')]?_0x227915[_0x7c6d('0x3c')]:_0x55fc2e[_0x7c6d('0x38')];if(!_0x3577f9[_0x7c6d('0x39')][_0x7c6d('0x3f')](_0x7c6d('0x40'))){_0x227915[_0x7c6d('0x20')]=qs[_0x7c6d('0x20')](_0x3577f9[_0x7c6d('0x39')][_0x7c6d('0x20')]);_0x227915['offset']=qs[_0x7c6d('0x1e')](_0x3577f9[_0x7c6d('0x39')][_0x7c6d('0x1e')]);}_0x227915[_0x7c6d('0x41')]=qs[_0x7c6d('0x42')](_0x3577f9[_0x7c6d('0x39')][_0x7c6d('0x42')]);_0x227915[_0x7c6d('0x43')]=qs['filters'](_[_0x7c6d('0x44')](_0x3577f9['query'],_0x55fc2e[_0x7c6d('0x3a')]),_0x3f009a);if(_0x3577f9[_0x7c6d('0x39')][_0x7c6d('0x45')]){_0x227915['where']=_['merge'](_0x227915['where'],{'$or':_['map'](_0x3f009a,function(_0x29fa9d){if(_0x29fa9d[_0x7c6d('0x36')]!==_0x7c6d('0x46')){var _0x5e8d8c={};_0x5e8d8c[_0x29fa9d['name']]={'$like':'%'+_0x3577f9[_0x7c6d('0x39')]['filter']+'%'};return _0x5e8d8c;}})});}_0x227915=_[_0x7c6d('0x47')]({},_0x227915,_0x3577f9[_0x7c6d('0x48')]);var _0x3b5732={'where':_0x227915['where']};return db[_0x7c6d('0x33')][_0x7c6d('0x21')](_0x3b5732)[_0x7c6d('0x29')](function(_0x24084b){_0x35b028[_0x7c6d('0x21')]=_0x24084b;if(_0x3577f9['query'][_0x7c6d('0x49')]){_0x227915[_0x7c6d('0x4a')]=[{'all':!![]}];}return db[_0x7c6d('0x33')]['findAll'](_0x227915);})[_0x7c6d('0x29')](function(_0xa382cb){_0x35b028['rows']=_0xa382cb;return _0x35b028;})[_0x7c6d('0x29')](respondWithFilteredResult(_0x46077a,_0x227915))[_0x7c6d('0x4b')](handleError(_0x46077a,null));};exports['show']=function(_0x4df840,_0x44fa53){var _0x599fc2={'raw':!![],'where':{'id':_0x4df840[_0x7c6d('0x4c')]['id']}},_0x362bb1={};_0x362bb1[_0x7c6d('0x38')]=_[_0x7c6d('0x4d')](db[_0x7c6d('0x33')][_0x7c6d('0x34')]);_0x362bb1[_0x7c6d('0x39')]=_[_0x7c6d('0x4d')](_0x4df840[_0x7c6d('0x39')]);_0x362bb1[_0x7c6d('0x3a')]=_['intersection'](_0x362bb1[_0x7c6d('0x38')],_0x362bb1[_0x7c6d('0x39')]);_0x599fc2[_0x7c6d('0x3c')]=_[_0x7c6d('0x3b')](_0x362bb1[_0x7c6d('0x38')],qs['fields'](_0x4df840[_0x7c6d('0x39')][_0x7c6d('0x3d')]));_0x599fc2[_0x7c6d('0x3c')]=_0x599fc2[_0x7c6d('0x3c')]['length']?_0x599fc2['attributes']:_0x362bb1[_0x7c6d('0x38')];if(_0x4df840[_0x7c6d('0x39')][_0x7c6d('0x49')]){_0x599fc2[_0x7c6d('0x4a')]=[{'all':!![]}];}_0x599fc2=_[_0x7c6d('0x47')]({},_0x599fc2,_0x4df840[_0x7c6d('0x48')]);return db[_0x7c6d('0x33')]['find'](_0x599fc2)['then'](handleEntityNotFound(_0x44fa53,null))[_0x7c6d('0x29')](respondWithResult(_0x44fa53,null))[_0x7c6d('0x4b')](handleError(_0x44fa53,null));};exports[_0x7c6d('0x4e')]=function(_0x28fe65,_0x2a33fb){return db[_0x7c6d('0x33')][_0x7c6d('0x4e')](_0x28fe65[_0x7c6d('0x4f')],{})[_0x7c6d('0x29')](function(_0x39f2c1){var _0x8dc8d7=_0x28fe65[_0x7c6d('0x50')][_0x7c6d('0x2a')]({'plain':!![]});if(!_0x8dc8d7)throw new Error(_0x7c6d('0x51'));if(_0x8dc8d7['role']===_0x7c6d('0x50')){var _0x5216a7=_0x39f2c1[_0x7c6d('0x2a')]({'plain':!![]});var _0x3727d6=_0x7c6d('0x52');return db[_0x7c6d('0x53')][_0x7c6d('0x54')]({'where':{'name':_0x3727d6,'userProfileId':_0x8dc8d7[_0x7c6d('0x55')]},'raw':!![]})[_0x7c6d('0x29')](function(_0x2812e9){if(_0x2812e9&&_0x2812e9[_0x7c6d('0x56')]===0x0){return db[_0x7c6d('0x2b')]['create']({'name':_0x5216a7[_0x7c6d('0x2f')],'resourceId':_0x5216a7['id'],'type':_0x2812e9[_0x7c6d('0x2f')],'sectionId':_0x2812e9['id']},{})['then'](function(){return _0x39f2c1;});}else{return _0x39f2c1;}})[_0x7c6d('0x4b')](function(_0x1ed753){logger[_0x7c6d('0x2d')](_0x7c6d('0x57'),_0x1ed753);throw _0x1ed753;});}return _0x39f2c1;})[_0x7c6d('0x29')](respondWithResult(_0x2a33fb,0xc9))[_0x7c6d('0x4b')](handleError(_0x2a33fb,null));};exports[_0x7c6d('0x27')]=function(_0x5bc08e,_0x494ef2){if(_0x5bc08e['body']['id']){delete _0x5bc08e[_0x7c6d('0x4f')]['id'];}return db[_0x7c6d('0x33')]['find']({'where':{'id':_0x5bc08e[_0x7c6d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x494ef2,null))[_0x7c6d('0x29')](saveUpdates(_0x5bc08e[_0x7c6d('0x4f')],null))[_0x7c6d('0x29')](respondWithResult(_0x494ef2,null))['catch'](handleError(_0x494ef2,null));};exports[_0x7c6d('0x28')]=function(_0x3ac2b9,_0x5141fb){return db[_0x7c6d('0x33')][_0x7c6d('0x54')]({'where':{'id':_0x3ac2b9[_0x7c6d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5141fb,null))[_0x7c6d('0x29')](removeEntity(_0x5141fb,null))[_0x7c6d('0x4b')](handleError(_0x5141fb,null));};exports['addInterval']=function(_0x87dd0,_0x1e832c,_0x175093){if(_0x87dd0[_0x7c6d('0x4f')]['id']){delete _0x87dd0[_0x7c6d('0x4f')]['id'];}return db[_0x7c6d('0x33')][_0x7c6d('0x54')]({'where':{'id':_0x87dd0[_0x7c6d('0x4c')]['id']}})[_0x7c6d('0x29')](handleEntityNotFound(_0x1e832c,null))[_0x7c6d('0x29')](function(_0xf90c09){if(_0xf90c09){_0x87dd0[_0x7c6d('0x4f')]['IntervalId']=_0xf90c09['id'];return db[_0x7c6d('0x33')][_0x7c6d('0x4e')](_0x87dd0[_0x7c6d('0x4f')]);}})[_0x7c6d('0x29')](respondWithResult(_0x1e832c,null))['catch'](handleError(_0x1e832c,null));};exports[_0x7c6d('0x58')]=function(_0x3d8cba,_0x5de5aa,_0x31e460){var _0x5c7283={};var _0x15891f={};var _0x30ae54;var _0xf2b2ef;return db[_0x7c6d('0x33')][_0x7c6d('0x59')]({'where':{'id':_0x3d8cba[_0x7c6d('0x4c')]['id']}})[_0x7c6d('0x29')](handleEntityNotFound(_0x5de5aa,null))['then'](function(_0xdc06cb){if(_0xdc06cb){_0x30ae54=_0xdc06cb;_0x15891f[_0x7c6d('0x38')]=_[_0x7c6d('0x4d')](db[_0x7c6d('0x33')][_0x7c6d('0x34')]);_0x15891f[_0x7c6d('0x39')]=_['keys'](_0x3d8cba[_0x7c6d('0x39')]);_0x15891f[_0x7c6d('0x3a')]=_[_0x7c6d('0x3b')](_0x15891f[_0x7c6d('0x38')],_0x15891f[_0x7c6d('0x39')]);_0x5c7283[_0x7c6d('0x3c')]=_[_0x7c6d('0x3b')](_0x15891f[_0x7c6d('0x38')],qs[_0x7c6d('0x3d')](_0x3d8cba[_0x7c6d('0x39')][_0x7c6d('0x3d')]));_0x5c7283[_0x7c6d('0x3c')]=_0x5c7283[_0x7c6d('0x3c')][_0x7c6d('0x3e')]?_0x5c7283[_0x7c6d('0x3c')]:_0x15891f[_0x7c6d('0x38')];_0x5c7283['order']=qs[_0x7c6d('0x42')](_0x3d8cba['query'][_0x7c6d('0x42')]);_0x5c7283[_0x7c6d('0x43')]=qs[_0x7c6d('0x3a')](_[_0x7c6d('0x44')](_0x3d8cba[_0x7c6d('0x39')],_0x15891f[_0x7c6d('0x3a')]));if(_0x3d8cba[_0x7c6d('0x39')][_0x7c6d('0x45')]){_0x5c7283[_0x7c6d('0x43')]=_[_0x7c6d('0x47')](_0x5c7283[_0x7c6d('0x43')],{'$or':_['map'](_0x5c7283[_0x7c6d('0x3c')],function(_0x221f80){var _0x45a634={};_0x45a634[_0x221f80]={'$like':'%'+_0x3d8cba['query'][_0x7c6d('0x45')]+'%'};return _0x45a634;})});}_0x5c7283=_[_0x7c6d('0x47')]({},_0x5c7283,_0x3d8cba[_0x7c6d('0x48')]);return _0x30ae54[_0x7c6d('0x58')](_0x5c7283);}})[_0x7c6d('0x29')](function(_0x3cf000){if(_0x3cf000){_0xf2b2ef=_0x3cf000[_0x7c6d('0x3e')];if(!_0x3d8cba[_0x7c6d('0x39')][_0x7c6d('0x3f')](_0x7c6d('0x40'))){_0x5c7283[_0x7c6d('0x20')]=qs['limit'](_0x3d8cba[_0x7c6d('0x39')][_0x7c6d('0x20')]);_0x5c7283[_0x7c6d('0x1e')]=qs[_0x7c6d('0x1e')](_0x3d8cba['query'][_0x7c6d('0x1e')]);}return _0x30ae54['getIntervals'](_0x5c7283);}})[_0x7c6d('0x29')](function(_0x38a1b6){if(_0x38a1b6){return _0x38a1b6?{'count':_0xf2b2ef,'rows':_0x38a1b6}:null;}})['then'](respondWithResult(_0x5de5aa,null))[_0x7c6d('0x4b')](handleError(_0x5de5aa,null));};exports[_0x7c6d('0x5a')]=function(_0x426dcc,_0x5d96b1,_0x229cbe){return db[_0x7c6d('0x33')]['findOne']({'where':{'id':_0x426dcc['params']['id']}})[_0x7c6d('0x29')](handleEntityNotFound(_0x5d96b1,null))[_0x7c6d('0x29')](function(_0x4cf6bc){if(_0x4cf6bc){return db[_0x7c6d('0x5b')]['transaction'](function(_0x11dc7f){return db[_0x7c6d('0x33')][_0x7c6d('0x28')]({'where':{'IntervalId':_0x426dcc['params']['id']},'transaction':_0x11dc7f})[_0x7c6d('0x29')](function(_0x4f02a2){var _0x44e86a=_[_0x7c6d('0x32')](_0x426dcc[_0x7c6d('0x4f')],function(_0x259d12){delete _0x259d12['id'];_0x259d12['IntervalId']=_0x426dcc['params']['id'];return _0x259d12;});return db[_0x7c6d('0x33')][_0x7c6d('0x5c')](_0x44e86a,{'transaction':_0x11dc7f});});})[_0x7c6d('0x29')](function(){return db[_0x7c6d('0x33')][_0x7c6d('0x5d')]({'where':{'IntervalId':_0x426dcc[_0x7c6d('0x4c')]['id']}});});}})[_0x7c6d('0x29')](respondWithResult(_0x5d96b1,null))['catch'](handleError(_0x5d96b1,null));}; \ No newline at end of file +var _0x3ff1=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','Intervals','error','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','IntervalId','getIntervals','pick','nolimit','addIntervals','findOne','sequelize','rimraf','zip-dir','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x3ff1,0x97));var _0x13ff=function(_0x2d44e2,_0x3c31b2){_0x2d44e2=_0x2d44e2-0x0;var _0x45d176=_0x3ff1[_0x2d44e2];return _0x45d176;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13ff('0x0'));var zipdir=require(_0x13ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13ff('0x2'));var moment=require(_0x13ff('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x13ff('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x13ff('0x5'));var ejs=require(_0x13ff('0x6'));var fs=require('fs');var fs_extra=require(_0x13ff('0x7'));var _=require(_0x13ff('0x8'));var squel=require(_0x13ff('0x9'));var crypto=require(_0x13ff('0xa'));var jsforce=require(_0x13ff('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13ff('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x13ff('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x13ff('0xd'));var hardwareService=require(_0x13ff('0xe'));var logger=require(_0x13ff('0xf'))('api');var utils=require(_0x13ff('0x10'));var config=require(_0x13ff('0x11'));var licenseUtil=require(_0x13ff('0x12'));var db=require('../../mysqldb')['db'];var extensions=require(_0x13ff('0x13'));function respondWithStatusCode(_0x507334,_0x3c7f13){_0x3c7f13=_0x3c7f13||0xcc;return function(_0x288f7f){if(_0x288f7f){return _0x507334[_0x13ff('0x14')](_0x3c7f13);}return _0x507334[_0x13ff('0x15')](_0x3c7f13)[_0x13ff('0x16')]();};}function respondWithResult(_0x4413c3,_0x56de14){_0x56de14=_0x56de14||0xc8;return function(_0xb06653){if(_0xb06653){return _0x4413c3['status'](_0x56de14)[_0x13ff('0x17')](_0xb06653);}};}function respondWithFilteredResult(_0x39cab2,_0x2dc2a1){return function(_0x1beddb){if(_0x1beddb){var _0x3dfc42=typeof _0x2dc2a1[_0x13ff('0x18')]===_0x13ff('0x19')&&typeof _0x2dc2a1[_0x13ff('0x1a')]==='undefined';var _0x45e1f4=_0x1beddb[_0x13ff('0x1b')];var _0x4fd466=_0x3dfc42?0x0:_0x2dc2a1[_0x13ff('0x18')];var _0x5b31b0=_0x3dfc42?_0x1beddb[_0x13ff('0x1b')]:_0x2dc2a1[_0x13ff('0x18')]+_0x2dc2a1['limit'];var _0x1a55eb;if(_0x5b31b0>=_0x45e1f4){_0x5b31b0=_0x45e1f4;_0x1a55eb=0xc8;}else{_0x1a55eb=0xce;}_0x39cab2[_0x13ff('0x15')](_0x1a55eb);return _0x39cab2[_0x13ff('0x1c')]('Content-Range',_0x4fd466+'-'+_0x5b31b0+'/'+_0x45e1f4)[_0x13ff('0x17')](_0x1beddb);}return null;};}function patchUpdates(_0x2324d1){return function(_0x306b50){try{jsonpatch[_0x13ff('0x1d')](_0x306b50,_0x2324d1,!![]);}catch(_0x556321){return BPromise[_0x13ff('0x1e')](_0x556321);}return _0x306b50['save']();};}function saveUpdates(_0x5edb0f,_0x1afce1){return function(_0x4d2cde){if(_0x4d2cde){return _0x4d2cde['update'](_0x5edb0f)[_0x13ff('0x1f')](function(_0x1aa5e6){return _0x1aa5e6;});}return null;};}function removeEntity(_0x366139,_0x2ef3dc){return function(_0x180fc3){if(_0x180fc3){return _0x180fc3[_0x13ff('0x20')]()[_0x13ff('0x1f')](function(){var _0x387cdf=_0x180fc3[_0x13ff('0x21')]({'plain':!![]});var _0x5cc426=_0x13ff('0x22');return db['UserProfileResource'][_0x13ff('0x20')]({'where':{'type':_0x5cc426,'resourceId':_0x387cdf['id']}})[_0x13ff('0x1f')](function(){return _0x180fc3;});})[_0x13ff('0x1f')](function(){_0x366139[_0x13ff('0x15')](0xcc)[_0x13ff('0x16')]();});}};}function handleEntityNotFound(_0x1686e3,_0x5715df){return function(_0x2e6eaa){if(!_0x2e6eaa){_0x1686e3[_0x13ff('0x14')](0x194);}return _0x2e6eaa;};}function handleError(_0x393878,_0x2c1d5a){_0x2c1d5a=_0x2c1d5a||0x1f4;return function(_0x3485a0){logger[_0x13ff('0x23')](_0x3485a0[_0x13ff('0x24')]);if(_0x3485a0[_0x13ff('0x25')]){delete _0x3485a0[_0x13ff('0x25')];}_0x393878[_0x13ff('0x15')](_0x2c1d5a)[_0x13ff('0x26')](_0x3485a0);};}exports[_0x13ff('0x27')]=function(_0x5499d4,_0x967bc1){var _0x493ac={},_0x9ed5cc={},_0x1d4661={'count':0x0,'rows':[]};var _0x4aab9a=_[_0x13ff('0x28')](db[_0x13ff('0x29')][_0x13ff('0x2a')],function(_0xd0438d){return{'name':_0xd0438d['fieldName'],'type':_0xd0438d[_0x13ff('0x2b')][_0x13ff('0x2c')]};});_0x9ed5cc[_0x13ff('0x2d')]=_['map'](_0x4aab9a,_0x13ff('0x25'));_0x9ed5cc[_0x13ff('0x2e')]=_[_0x13ff('0x2f')](_0x5499d4['query']);_0x9ed5cc[_0x13ff('0x30')]=_[_0x13ff('0x31')](_0x9ed5cc[_0x13ff('0x2d')],_0x9ed5cc[_0x13ff('0x2e')]);_0x493ac[_0x13ff('0x32')]=_[_0x13ff('0x31')](_0x9ed5cc[_0x13ff('0x2d')],qs[_0x13ff('0x33')](_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x33')]));_0x493ac['attributes']=_0x493ac['attributes'][_0x13ff('0x34')]?_0x493ac['attributes']:_0x9ed5cc[_0x13ff('0x2d')];if(!_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x35')]('nolimit')){_0x493ac['limit']=qs[_0x13ff('0x1a')](_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x1a')]);_0x493ac[_0x13ff('0x18')]=qs[_0x13ff('0x18')](_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x18')]);}_0x493ac[_0x13ff('0x36')]=qs[_0x13ff('0x37')](_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x37')]);_0x493ac[_0x13ff('0x38')]=qs['filters'](_['pick'](_0x5499d4['query'],_0x9ed5cc[_0x13ff('0x30')]),_0x4aab9a);if(_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x39')]){_0x493ac[_0x13ff('0x38')]=_[_0x13ff('0x3a')](_0x493ac[_0x13ff('0x38')],{'$or':_['map'](_0x4aab9a,function(_0x3a71d8){if(_0x3a71d8['type']!==_0x13ff('0x3b')){var _0xf7794f={};_0xf7794f[_0x3a71d8['name']]={'$like':'%'+_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x39')]+'%'};return _0xf7794f;}})});}_0x493ac=_[_0x13ff('0x3a')]({},_0x493ac,_0x5499d4[_0x13ff('0x3c')]);var _0x25892d={'where':_0x493ac[_0x13ff('0x38')]};return db[_0x13ff('0x29')][_0x13ff('0x1b')](_0x25892d)[_0x13ff('0x1f')](function(_0x7947e1){_0x1d4661['count']=_0x7947e1;if(_0x5499d4[_0x13ff('0x2e')][_0x13ff('0x3d')]){_0x493ac[_0x13ff('0x3e')]=[{'all':!![]}];}return db['Interval'][_0x13ff('0x3f')](_0x493ac);})[_0x13ff('0x1f')](function(_0x25920f){_0x1d4661[_0x13ff('0x40')]=_0x25920f;return _0x1d4661;})[_0x13ff('0x1f')](respondWithFilteredResult(_0x967bc1,_0x493ac))[_0x13ff('0x41')](handleError(_0x967bc1,null));};exports['show']=function(_0x6f8a34,_0x117151){var _0x35f336={'raw':!![],'where':{'id':_0x6f8a34['params']['id']}},_0x124f87={};_0x124f87[_0x13ff('0x2d')]=_['keys'](db[_0x13ff('0x29')][_0x13ff('0x2a')]);_0x124f87[_0x13ff('0x2e')]=_[_0x13ff('0x2f')](_0x6f8a34['query']);_0x124f87[_0x13ff('0x30')]=_['intersection'](_0x124f87[_0x13ff('0x2d')],_0x124f87[_0x13ff('0x2e')]);_0x35f336[_0x13ff('0x32')]=_['intersection'](_0x124f87['model'],qs[_0x13ff('0x33')](_0x6f8a34['query'][_0x13ff('0x33')]));_0x35f336['attributes']=_0x35f336[_0x13ff('0x32')][_0x13ff('0x34')]?_0x35f336[_0x13ff('0x32')]:_0x124f87[_0x13ff('0x2d')];if(_0x6f8a34['query'][_0x13ff('0x3d')]){_0x35f336[_0x13ff('0x3e')]=[{'all':!![]}];}_0x35f336=_[_0x13ff('0x3a')]({},_0x35f336,_0x6f8a34[_0x13ff('0x3c')]);return db[_0x13ff('0x29')][_0x13ff('0x42')](_0x35f336)[_0x13ff('0x1f')](handleEntityNotFound(_0x117151,null))[_0x13ff('0x1f')](respondWithResult(_0x117151,null))[_0x13ff('0x41')](handleError(_0x117151,null));};exports[_0x13ff('0x43')]=function(_0x5936f5,_0x46aacf){return db[_0x13ff('0x29')][_0x13ff('0x43')](_0x5936f5['body'],{})['then'](function(_0x162848){var _0x592e73=_0x5936f5[_0x13ff('0x44')]['get']({'plain':!![]});if(!_0x592e73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x592e73[_0x13ff('0x45')]==='user'){var _0x15ae71=_0x162848[_0x13ff('0x21')]({'plain':!![]});var _0x69423f='Intervals';return db[_0x13ff('0x46')][_0x13ff('0x42')]({'where':{'name':_0x69423f,'userProfileId':_0x592e73['userProfileId']},'raw':!![]})[_0x13ff('0x1f')](function(_0x26a8e0){if(_0x26a8e0&&_0x26a8e0['autoAssociation']===0x0){return db[_0x13ff('0x47')][_0x13ff('0x43')]({'name':_0x15ae71['name'],'resourceId':_0x15ae71['id'],'type':_0x26a8e0[_0x13ff('0x25')],'sectionId':_0x26a8e0['id']},{})['then'](function(){return _0x162848;});}else{return _0x162848;}})[_0x13ff('0x41')](function(_0x3e205d){logger[_0x13ff('0x23')](_0x13ff('0x48'),_0x3e205d);throw _0x3e205d;});}return _0x162848;})[_0x13ff('0x1f')](respondWithResult(_0x46aacf,0xc9))[_0x13ff('0x41')](handleError(_0x46aacf,null));};exports[_0x13ff('0x49')]=function(_0x2201c0,_0x5a6c9e){if(_0x2201c0['body']['id']){delete _0x2201c0[_0x13ff('0x4a')]['id'];}return db['Interval'][_0x13ff('0x42')]({'where':{'id':_0x2201c0[_0x13ff('0x4b')]['id']}})[_0x13ff('0x1f')](handleEntityNotFound(_0x5a6c9e,null))[_0x13ff('0x1f')](saveUpdates(_0x2201c0[_0x13ff('0x4a')],null))[_0x13ff('0x1f')](respondWithResult(_0x5a6c9e,null))[_0x13ff('0x41')](handleError(_0x5a6c9e,null));};exports[_0x13ff('0x20')]=function(_0x2221c0,_0x24ca01){return db[_0x13ff('0x29')][_0x13ff('0x42')]({'where':{'id':_0x2221c0[_0x13ff('0x4b')]['id']}})[_0x13ff('0x1f')](handleEntityNotFound(_0x24ca01,null))[_0x13ff('0x1f')](removeEntity(_0x24ca01,null))['catch'](handleError(_0x24ca01,null));};exports['addInterval']=function(_0xce0f9a,_0x52060d,_0x3dbdc7){if(_0xce0f9a[_0x13ff('0x4a')]['id']){delete _0xce0f9a[_0x13ff('0x4a')]['id'];}return db[_0x13ff('0x29')]['find']({'where':{'id':_0xce0f9a['params']['id']}})[_0x13ff('0x1f')](handleEntityNotFound(_0x52060d,null))[_0x13ff('0x1f')](function(_0x21ea81){if(_0x21ea81){_0xce0f9a[_0x13ff('0x4a')][_0x13ff('0x4c')]=_0x21ea81['id'];return db[_0x13ff('0x29')][_0x13ff('0x43')](_0xce0f9a[_0x13ff('0x4a')]);}})[_0x13ff('0x1f')](respondWithResult(_0x52060d,null))[_0x13ff('0x41')](handleError(_0x52060d,null));};exports[_0x13ff('0x4d')]=function(_0x2e5648,_0x126a0,_0x3b45fa){var _0x4d845e={};var _0x28f7cf={};var _0x5cd295;var _0x13ed3e;return db[_0x13ff('0x29')]['findOne']({'where':{'id':_0x2e5648[_0x13ff('0x4b')]['id']}})[_0x13ff('0x1f')](handleEntityNotFound(_0x126a0,null))['then'](function(_0x5b6fdd){if(_0x5b6fdd){_0x5cd295=_0x5b6fdd;_0x28f7cf[_0x13ff('0x2d')]=_[_0x13ff('0x2f')](db[_0x13ff('0x29')]['rawAttributes']);_0x28f7cf[_0x13ff('0x2e')]=_[_0x13ff('0x2f')](_0x2e5648[_0x13ff('0x2e')]);_0x28f7cf[_0x13ff('0x30')]=_['intersection'](_0x28f7cf[_0x13ff('0x2d')],_0x28f7cf[_0x13ff('0x2e')]);_0x4d845e[_0x13ff('0x32')]=_[_0x13ff('0x31')](_0x28f7cf[_0x13ff('0x2d')],qs[_0x13ff('0x33')](_0x2e5648[_0x13ff('0x2e')][_0x13ff('0x33')]));_0x4d845e[_0x13ff('0x32')]=_0x4d845e['attributes'][_0x13ff('0x34')]?_0x4d845e[_0x13ff('0x32')]:_0x28f7cf[_0x13ff('0x2d')];_0x4d845e['order']=qs[_0x13ff('0x37')](_0x2e5648[_0x13ff('0x2e')]['sort']);_0x4d845e['where']=qs[_0x13ff('0x30')](_[_0x13ff('0x4e')](_0x2e5648[_0x13ff('0x2e')],_0x28f7cf[_0x13ff('0x30')]));if(_0x2e5648[_0x13ff('0x2e')]['filter']){_0x4d845e[_0x13ff('0x38')]=_[_0x13ff('0x3a')](_0x4d845e[_0x13ff('0x38')],{'$or':_[_0x13ff('0x28')](_0x4d845e[_0x13ff('0x32')],function(_0x1249e7){var _0x4a3bfd={};_0x4a3bfd[_0x1249e7]={'$like':'%'+_0x2e5648[_0x13ff('0x2e')][_0x13ff('0x39')]+'%'};return _0x4a3bfd;})});}_0x4d845e=_[_0x13ff('0x3a')]({},_0x4d845e,_0x2e5648[_0x13ff('0x3c')]);return _0x5cd295[_0x13ff('0x4d')](_0x4d845e);}})[_0x13ff('0x1f')](function(_0x9b0d04){if(_0x9b0d04){_0x13ed3e=_0x9b0d04['length'];if(!_0x2e5648['query'][_0x13ff('0x35')](_0x13ff('0x4f'))){_0x4d845e[_0x13ff('0x1a')]=qs[_0x13ff('0x1a')](_0x2e5648['query'][_0x13ff('0x1a')]);_0x4d845e[_0x13ff('0x18')]=qs[_0x13ff('0x18')](_0x2e5648[_0x13ff('0x2e')][_0x13ff('0x18')]);}return _0x5cd295['getIntervals'](_0x4d845e);}})['then'](function(_0xe817be){if(_0xe817be){return _0xe817be?{'count':_0x13ed3e,'rows':_0xe817be}:null;}})['then'](respondWithResult(_0x126a0,null))['catch'](handleError(_0x126a0,null));};exports[_0x13ff('0x50')]=function(_0x562036,_0x16ec1a,_0x478a2c){return db[_0x13ff('0x29')][_0x13ff('0x51')]({'where':{'id':_0x562036['params']['id']}})[_0x13ff('0x1f')](handleEntityNotFound(_0x16ec1a,null))['then'](function(_0x120f2f){if(_0x120f2f){return db[_0x13ff('0x52')]['transaction'](function(_0x10c3b2){return db[_0x13ff('0x29')][_0x13ff('0x20')]({'where':{'IntervalId':_0x562036[_0x13ff('0x4b')]['id']},'transaction':_0x10c3b2})[_0x13ff('0x1f')](function(_0x30a5af){var _0x42e1ad=_[_0x13ff('0x28')](_0x562036[_0x13ff('0x4a')],function(_0x137aa9){delete _0x137aa9['id'];_0x137aa9[_0x13ff('0x4c')]=_0x562036['params']['id'];return _0x137aa9;});return db[_0x13ff('0x29')]['bulkCreate'](_0x42e1ad,{'transaction':_0x10c3b2});});})[_0x13ff('0x1f')](function(){return db[_0x13ff('0x29')][_0x13ff('0x3f')]({'where':{'IntervalId':_0x562036[_0x13ff('0x4b')]['id']}});});}})[_0x13ff('0x1f')](respondWithResult(_0x16ec1a,null))[_0x13ff('0x41')](handleError(_0x16ec1a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7f577be..582a9c4 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 _0x20fb=['../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./interval.attributes'];(function(_0x1d04b5,_0x30792c){var _0x161342=function(_0x94ff92){while(--_0x94ff92){_0x1d04b5['push'](_0x1d04b5['shift']());}};_0x161342(++_0x30792c);}(_0x20fb,0x1b2));var _0xb20f=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x20fb[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0xb20f('0x0'));var util=require(_0xb20f('0x1'));var logger=require(_0xb20f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb20f('0x3'));var rp=require(_0xb20f('0x4'));var fs=require('fs');var path=require(_0xb20f('0x5'));var rimraf=require('rimraf');var config=require(_0xb20f('0x6'));var attributes=require(_0xb20f('0x7'));var extensions=require(_0xb20f('0x8'));module['exports']=function(_0x3b41cb,_0x3da3c6){return _0x3b41cb[_0xb20f('0x9')](_0xb20f('0xa'),attributes,{'tableName':_0xb20f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x41099a,_0x2e7cce){extensions[_0xb20f('0xc')](_0x3b41cb,_0x41099a);},'afterBulkCreate':function(_0x134063,_0xc49174,_0x301913){_0x301913();extensions[_0xb20f('0xc')](_0x3b41cb,_0x134063[0x0]);},'afterUpdate':function(_0x4be2b3,_0x534de0){extensions['rewrite'](_0x3b41cb,_0x4be2b3);},'afterDestroy':function(_0x19f497,_0x36caa7){extensions[_0xb20f('0xc')](_0x3b41cb,_0x19f497);}}});}; \ No newline at end of file +var _0x5074=['bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','util','../../config/logger','moment'];(function(_0x1b7da4,_0x1ca527){var _0x4868ab=function(_0x42ea8e){while(--_0x42ea8e){_0x1b7da4['push'](_0x1b7da4['shift']());}};_0x4868ab(++_0x1ca527);}(_0x5074,0x1e7));var _0x4507=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x5074[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0x4507('0x0'));var logger=require(_0x4507('0x1'))('api');var moment=require(_0x4507('0x2'));var BPromise=require(_0x4507('0x3'));var rp=require(_0x4507('0x4'));var fs=require('fs');var path=require(_0x4507('0x5'));var rimraf=require(_0x4507('0x6'));var config=require(_0x4507('0x7'));var attributes=require(_0x4507('0x8'));var extensions=require(_0x4507('0x9'));module[_0x4507('0xa')]=function(_0x4a1134,_0x32401a){return _0x4a1134['define'](_0x4507('0xb'),attributes,{'tableName':_0x4507('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf6b7a9,_0x2dc466){extensions['rewrite'](_0x4a1134,_0xf6b7a9);},'afterBulkCreate':function(_0xd4e669,_0x3dc6a4,_0x145216){_0x145216();extensions[_0x4507('0xd')](_0x4a1134,_0xd4e669[0x0]);},'afterUpdate':function(_0x4f39c8,_0x2905b1){extensions[_0x4507('0xd')](_0x4a1134,_0x4f39c8);},'afterDestroy':function(_0x3036b3,_0x5727ea){extensions[_0x4507('0xd')](_0x4a1134,_0x3036b3);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f87dd5a..4217bda 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(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 cc83042..47d90e7 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'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 +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18474f,_0x51e0f9){_0x18474f=_0x18474f-0x0;var _0xab5297=_0x0b0e[_0x18474f];return _0xab5297;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('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 45dd294..b1f56b4 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 _0xe7b9=['x-forwarded-for','connection','socket','remoteAddress','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','base64','setEncoding','utf8','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers'];(function(_0x2674dc,_0x4bd6af){var _0x1565ae=function(_0x38657b){while(--_0x38657b){_0x2674dc['push'](_0x2674dc['shift']());}};_0x1565ae(++_0x4bd6af);}(_0xe7b9,0x15c));var _0x9e7b=function(_0x14c7c3,_0x59c8c3){_0x14c7c3=_0x14c7c3-0x0;var _0x514f94=_0xe7b9[_0x14c7c3];return _0x514f94;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0x9e7b('0x0'));var USERNAME=_0x9e7b('0x1');var PASSWORD=_0x9e7b('0x2');function openIssue(_0x177e73,_0x14320c){var _0x157020={'fields':{'project':{'key':_0x177e73[_0x9e7b('0x3')]||_0x9e7b('0x4')},'summary':(_0x177e73['summary']||'Report')+_0x9e7b('0x5')+_0x177e73['ip'],'description':_0x177e73['description']||JSON[_0x9e7b('0x6')](_0x177e73),'issuetype':{'name':_0x177e73[_0x9e7b('0x7')]||_0x9e7b('0x8')}}};_0x157020[_0x9e7b('0x9')][_0x9e7b('0xa')]=_0x177e73[_0x9e7b('0xb')];_0x157020[_0x9e7b('0x9')][_0x9e7b('0xc')]=_0x177e73[_0x9e7b('0xd')];_0x157020[_0x9e7b('0x9')][_0x9e7b('0xe')]=_0x177e73[_0x9e7b('0xf')];_0x157020[_0x9e7b('0x9')][_0x9e7b('0x10')]=_0x177e73[_0x9e7b('0x11')];_0x157020[_0x9e7b('0x9')][_0x9e7b('0x12')]=_0x177e73[_0x9e7b('0x13')];_0x157020[_0x9e7b('0x9')][_0x9e7b('0x14')]=_0x177e73['ip'];var _0x137979={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x9e7b('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x9e7b('0x16'),'Authorization':_0x9e7b('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9e7b('0x18'))}};var _0x4e2266=JSON[_0x9e7b('0x6')](_0x157020);var _0x528f5b=https['request'](_0x137979,function(_0x1df49c){_0x1df49c[_0x9e7b('0x19')](_0x9e7b('0x1a'));var _0x5e17a1='';_0x1df49c['on']('data',function(_0x54e0f1){_0x5e17a1+=_0x54e0f1;});_0x1df49c['on'](_0x9e7b('0x1b'),function(){if(_0x14320c){return _0x14320c[_0x9e7b('0x1c')](_0x1df49c[_0x9e7b('0x1d')])[_0x9e7b('0x1e')](JSON[_0x9e7b('0x1f')](_0x5e17a1));}});});_0x528f5b['on']('error',function(_0x6fbbc2){if(_0x14320c){return _0x14320c['status'](0x1f4)[_0x9e7b('0x1e')]({'errors':[{'message':_0x9e7b('0x20'),'type':_0x9e7b('0x21')}]});}});_0x528f5b[_0x9e7b('0x22')](_0x4e2266);_0x528f5b[_0x9e7b('0x1b')]();}exports[_0x9e7b('0x23')]=openIssue;exports[_0x9e7b('0x24')]=function(_0x3f26ce,_0x31f3ce){_0x3f26ce[_0x9e7b('0x25')]['ip']=_0x3f26ce[_0x9e7b('0x26')][_0x9e7b('0x27')]||_0x3f26ce[_0x9e7b('0x28')]['remoteAddress']||_0x3f26ce[_0x9e7b('0x29')]['remoteAddress']||_0x3f26ce[_0x9e7b('0x28')]['socket'][_0x9e7b('0x2a')];return openIssue(_0x3f26ce[_0x9e7b('0x25')],_0x31f3ce);}; \ No newline at end of file +var _0xfc8f=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','connection','socket','remoteAddress','bluebird','https','../../config/logger','key','MOTGUI','summary','Report','description','customfield_11500','email','customfield_11501','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','stringify','setEncoding','utf8','data','end','status','statusCode','json'];(function(_0x45c23a,_0x5e3160){var _0x5372f1=function(_0x37f92d){while(--_0x37f92d){_0x45c23a['push'](_0x45c23a['shift']());}};_0x5372f1(++_0x5e3160);}(_0xfc8f,0x138));var _0xffc8=function(_0x5be680,_0x211a48){_0x5be680=_0x5be680-0x0;var _0x4d5a97=_0xfc8f[_0x5be680];return _0x4d5a97;};'use strict';var BPromise=require(_0xffc8('0x0'));var https=require(_0xffc8('0x1'));var logger=require(_0xffc8('0x2'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x47e4c1,_0x3519fc){var _0x4e63c0={'fields':{'project':{'key':_0x47e4c1[_0xffc8('0x3')]||_0xffc8('0x4')},'summary':(_0x47e4c1[_0xffc8('0x5')]||_0xffc8('0x6'))+'\x20from\x20'+_0x47e4c1['ip'],'description':_0x47e4c1[_0xffc8('0x7')]||JSON['stringify'](_0x47e4c1),'issuetype':{'name':_0x47e4c1['issuetype']||'Bug'}}};_0x4e63c0['fields'][_0xffc8('0x8')]=_0x47e4c1[_0xffc8('0x9')];_0x4e63c0['fields'][_0xffc8('0xa')]=_0x47e4c1['oldToken'];_0x4e63c0[_0xffc8('0xb')][_0xffc8('0xc')]=_0x47e4c1[_0xffc8('0xd')];_0x4e63c0[_0xffc8('0xb')][_0xffc8('0xe')]=_0x47e4c1[_0xffc8('0xf')];_0x4e63c0[_0xffc8('0xb')][_0xffc8('0x10')]=_0x47e4c1[_0xffc8('0x11')];_0x4e63c0[_0xffc8('0xb')][_0xffc8('0x12')]=_0x47e4c1['ip'];var _0x2d5317={'host':_0xffc8('0x13'),'port':0x1bb,'path':_0xffc8('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xffc8('0x15'),'Authorization':_0xffc8('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xffc8('0x17'))}};var _0x24a523=JSON[_0xffc8('0x18')](_0x4e63c0);var _0xc97906=https['request'](_0x2d5317,function(_0x1c6a1f){_0x1c6a1f[_0xffc8('0x19')](_0xffc8('0x1a'));var _0xd972a6='';_0x1c6a1f['on'](_0xffc8('0x1b'),function(_0x50e6e8){_0xd972a6+=_0x50e6e8;});_0x1c6a1f['on'](_0xffc8('0x1c'),function(){if(_0x3519fc){return _0x3519fc[_0xffc8('0x1d')](_0x1c6a1f[_0xffc8('0x1e')])[_0xffc8('0x1f')](JSON['parse'](_0xd972a6));}});});_0xc97906['on'](_0xffc8('0x20'),function(_0x29b0cb){if(_0x3519fc){return _0x3519fc[_0xffc8('0x1d')](0x1f4)['json']({'errors':[{'message':_0xffc8('0x21'),'type':_0xffc8('0x22')}]});}});_0xc97906[_0xffc8('0x23')](_0x24a523);_0xc97906[_0xffc8('0x1c')]();}exports[_0xffc8('0x24')]=openIssue;exports[_0xffc8('0x25')]=function(_0x1a4891,_0x4aeec9){_0x1a4891[_0xffc8('0x26')]['ip']=_0x1a4891[_0xffc8('0x27')]['x-forwarded-for']||_0x1a4891[_0xffc8('0x28')]['remoteAddress']||_0x1a4891[_0xffc8('0x29')][_0xffc8('0x2a')]||_0x1a4891[_0xffc8('0x28')][_0xffc8('0x29')]['remoteAddress'];return openIssue(_0x1a4891[_0xffc8('0x26')],_0x4aeec9);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 27bfe84..508587a 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 _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0xe6bbe2,_0x4eeae3){var _0x1414f3=function(_0x3aef68){while(--_0x3aef68){_0xe6bbe2['push'](_0xe6bbe2['shift']());}};_0x1414f3(++_0x4eeae3);}(_0xee5b,0x1f4));var _0xbee5=function(_0x12309f,_0x364865){_0x12309f=_0x12309f-0x0;var _0x4aa419=_0xee5b[_0x12309f];return _0x4aa419;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file +var _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x59dd23,_0x43e145){var _0x1b3358=function(_0x95a866){while(--_0x95a866){_0x59dd23['push'](_0x59dd23['shift']());}};_0x1b3358(++_0x43e145);}(_0x41bb,0xc5));var _0xb41b=function(_0x4eb16a,_0x1c2974){_0x4eb16a=_0x4eb16a-0x0;var _0x2b43f0=_0x41bb[_0x4eb16a];return _0x2b43f0;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8552505..7d1bdac 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x224e5e,_0x994ff7){_0x224e5e=_0x224e5e-0x0;var _0x388374=_0x7a54[_0x224e5e];return _0x388374;};'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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x54eb8b,_0x76ca0e){_0x54eb8b=_0x54eb8b-0x0;var _0x4d4aa8=_0x7a54[_0x54eb8b];return _0x4d4aa8;};'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 03d0b9d..007422d 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 _0x44ff=['show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch'];(function(_0xeceed2,_0x1167ab){var _0x2ddb79=function(_0x4d5760){while(--_0x4d5760){_0xeceed2['push'](_0xeceed2['shift']());}};_0x2ddb79(++_0x1167ab);}(_0x44ff,0x1c3));var _0xf44f=function(_0x3c9eee,_0x144f4a){_0x3c9eee=_0x3c9eee-0x0;var _0x2eb293=_0x44ff[_0x3c9eee];return _0x2eb293;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf44f('0x0'));var zipdir=require(_0xf44f('0x1'));var jsonpatch=require(_0xf44f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf44f('0x3'));var path=require(_0xf44f('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf44f('0x5'));var fs=require('fs');var fs_extra=require(_0xf44f('0x6'));var _=require(_0xf44f('0x7'));var squel=require('squel');var crypto=require(_0xf44f('0x8'));var jsforce=require(_0xf44f('0x9'));var deskjs=require(_0xf44f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf44f('0xb'));var Papa=require(_0xf44f('0xc'));var Redis=require(_0xf44f('0xd'));var authService=require(_0xf44f('0xe'));var qs=require(_0xf44f('0xf'));var as=require(_0xf44f('0x10'));var hardwareService=require(_0xf44f('0x11'));var logger=require(_0xf44f('0x12'))(_0xf44f('0x13'));var utils=require(_0xf44f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf44f('0x15'));var db=require(_0xf44f('0x16'))['db'];function respondWithStatusCode(_0x23b73a,_0x34d3da){_0x34d3da=_0x34d3da||0xcc;return function(_0x10176f){if(_0x10176f){return _0x23b73a[_0xf44f('0x17')](_0x34d3da);}return _0x23b73a[_0xf44f('0x18')](_0x34d3da)['end']();};}function respondWithResult(_0x5d2b86,_0x17e828){_0x17e828=_0x17e828||0xc8;return function(_0x5f20aa){if(_0x5f20aa){return _0x5d2b86['status'](_0x17e828)['json'](_0x5f20aa);}};}function respondWithFilteredResult(_0x3aa2b8,_0x1d2d77){return function(_0x409907){if(_0x409907){var _0x1a5ce4=typeof _0x1d2d77['offset']===_0xf44f('0x19')&&typeof _0x1d2d77['limit']===_0xf44f('0x19');var _0x40e414=_0x409907[_0xf44f('0x1a')];var _0x15e5b6=_0x1a5ce4?0x0:_0x1d2d77['offset'];var _0x4f0338=_0x1a5ce4?_0x409907['count']:_0x1d2d77['offset']+_0x1d2d77[_0xf44f('0x1b')];var _0x4f0292;if(_0x4f0338>=_0x40e414){_0x4f0338=_0x40e414;_0x4f0292=0xc8;}else{_0x4f0292=0xce;}_0x3aa2b8['status'](_0x4f0292);return _0x3aa2b8[_0xf44f('0x1c')](_0xf44f('0x1d'),_0x15e5b6+'-'+_0x4f0338+'/'+_0x40e414)[_0xf44f('0x1e')](_0x409907);}return null;};}function patchUpdates(_0x515ea6){return function(_0x1c317e){try{jsonpatch[_0xf44f('0x1f')](_0x1c317e,_0x515ea6,!![]);}catch(_0x5eb768){return BPromise[_0xf44f('0x20')](_0x5eb768);}return _0x1c317e['save']();};}function saveUpdates(_0x1cc24e,_0x166acd){return function(_0x3e0b9c){if(_0x3e0b9c){return _0x3e0b9c['update'](_0x1cc24e)[_0xf44f('0x21')](function(_0x1b9dc9){return _0x1b9dc9;});}return null;};}function removeEntity(_0x329ed3,_0x58d4af){return function(_0x1ba9c0){if(_0x1ba9c0){return _0x1ba9c0[_0xf44f('0x22')]()[_0xf44f('0x21')](function(){_0x329ed3[_0xf44f('0x18')](0xcc)[_0xf44f('0x23')]();});}};}function handleEntityNotFound(_0x5313f5,_0x3c04fe){return function(_0x2a17e0){if(!_0x2a17e0){_0x5313f5[_0xf44f('0x17')](0x194);}return _0x2a17e0;};}function handleError(_0x2fe533,_0x5b9c45){_0x5b9c45=_0x5b9c45||0x1f4;return function(_0x1af2a2){logger[_0xf44f('0x24')](_0x1af2a2[_0xf44f('0x25')]);if(_0x1af2a2[_0xf44f('0x26')]){delete _0x1af2a2[_0xf44f('0x26')];}_0x2fe533[_0xf44f('0x18')](_0x5b9c45)['send'](_0x1af2a2);};}exports[_0xf44f('0x27')]=function(_0x5255eb,_0x2f5075){var _0x14e6cf={},_0x5a5a83={},_0x544f32={'count':0x0,'rows':[]};var _0x11d199=_[_0xf44f('0x28')](db[_0xf44f('0x29')][_0xf44f('0x2a')],function(_0x549fdd){return{'name':_0x549fdd[_0xf44f('0x2b')],'type':_0x549fdd[_0xf44f('0x2c')]['key']};});_0x5a5a83[_0xf44f('0x2d')]=_[_0xf44f('0x28')](_0x11d199,_0xf44f('0x26'));_0x5a5a83[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x5255eb[_0xf44f('0x2e')]);_0x5a5a83[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],_0x5a5a83[_0xf44f('0x2e')]);_0x14e6cf['attributes']=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],qs['fields'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x32')]));_0x14e6cf[_0xf44f('0x33')]=_0x14e6cf[_0xf44f('0x33')][_0xf44f('0x34')]?_0x14e6cf['attributes']:_0x5a5a83[_0xf44f('0x2d')];if(!_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x35')](_0xf44f('0x36'))){_0x14e6cf[_0xf44f('0x1b')]=qs[_0xf44f('0x1b')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x1b')]);_0x14e6cf[_0xf44f('0x37')]=qs['offset'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x37')]);}_0x14e6cf[_0xf44f('0x38')]=qs[_0xf44f('0x39')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x39')]);_0x14e6cf[_0xf44f('0x3a')]=qs[_0xf44f('0x30')](_[_0xf44f('0x3b')](_0x5255eb[_0xf44f('0x2e')],_0x5a5a83[_0xf44f('0x30')]),_0x11d199);if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x3c')]){_0x14e6cf[_0xf44f('0x3a')]=_[_0xf44f('0x3d')](_0x14e6cf[_0xf44f('0x3a')],{'$or':_[_0xf44f('0x28')](_0x11d199,function(_0x37f274){if(_0x37f274[_0xf44f('0x2c')]!==_0xf44f('0x3e')){var _0x460308={};_0x460308[_0x37f274[_0xf44f('0x26')]]={'$like':'%'+_0x5255eb[_0xf44f('0x2e')]['filter']+'%'};return _0x460308;}})});}_0x14e6cf=_[_0xf44f('0x3d')]({},_0x14e6cf,_0x5255eb[_0xf44f('0x3f')]);var _0x1df436={'where':_0x14e6cf[_0xf44f('0x3a')]};return db['JscriptyAnswerReport'][_0xf44f('0x1a')](_0x1df436)['then'](function(_0x54fd2f){_0x544f32[_0xf44f('0x1a')]=_0x54fd2f;if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x40')]){_0x14e6cf[_0xf44f('0x41')]=[{'all':!![]}];}return db[_0xf44f('0x29')]['findAll'](_0x14e6cf);})[_0xf44f('0x21')](function(_0x32e8e0){_0x544f32['rows']=_0x32e8e0;return _0x544f32;})[_0xf44f('0x21')](respondWithFilteredResult(_0x2f5075,_0x14e6cf))[_0xf44f('0x42')](handleError(_0x2f5075,null));};exports[_0xf44f('0x43')]=function(_0x524d57,_0x11c508){var _0x502a21={'raw':!![],'where':{'id':_0x524d57[_0xf44f('0x44')]['id']}},_0x28717a={};_0x28717a['model']=_[_0xf44f('0x2f')](db[_0xf44f('0x29')][_0xf44f('0x2a')]);_0x28717a[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x524d57[_0xf44f('0x2e')]);_0x28717a[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x28717a['model'],_0x28717a[_0xf44f('0x2e')]);_0x502a21[_0xf44f('0x33')]=_[_0xf44f('0x31')](_0x28717a[_0xf44f('0x2d')],qs[_0xf44f('0x32')](_0x524d57[_0xf44f('0x2e')]['fields']));_0x502a21[_0xf44f('0x33')]=_0x502a21[_0xf44f('0x33')][_0xf44f('0x34')]?_0x502a21['attributes']:_0x28717a[_0xf44f('0x2d')];if(_0x524d57['query'][_0xf44f('0x40')]){_0x502a21[_0xf44f('0x41')]=[{'all':!![]}];}_0x502a21=_[_0xf44f('0x3d')]({},_0x502a21,_0x524d57['options']);return db[_0xf44f('0x29')][_0xf44f('0x45')](_0x502a21)[_0xf44f('0x21')](handleEntityNotFound(_0x11c508,null))['then'](respondWithResult(_0x11c508,null))['catch'](handleError(_0x11c508,null));};exports[_0xf44f('0x46')]=function(_0x2cb20c,_0x193dbd){return db[_0xf44f('0x29')][_0xf44f('0x46')](_0x2cb20c[_0xf44f('0x47')],{})[_0xf44f('0x21')](respondWithResult(_0x193dbd,0xc9))['catch'](handleError(_0x193dbd,null));};exports[_0xf44f('0x48')]=function(_0x30e382,_0x5a80fc){if(_0x30e382['body']['id']){delete _0x30e382['body']['id'];}return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x30e382[_0xf44f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a80fc,null))['then'](saveUpdates(_0x30e382[_0xf44f('0x47')],null))[_0xf44f('0x21')](respondWithResult(_0x5a80fc,null))[_0xf44f('0x42')](handleError(_0x5a80fc,null));};exports[_0xf44f('0x22')]=function(_0x1ecff0,_0x55a038){return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x1ecff0['params']['id']}})[_0xf44f('0x21')](handleEntityNotFound(_0x55a038,null))['then'](removeEntity(_0x55a038,null))[_0xf44f('0x42')](handleError(_0x55a038,null));};exports[_0xf44f('0x49')]=function(_0x300fe0,_0x26ea85){return db[_0xf44f('0x29')][_0xf44f('0x49')]()[_0xf44f('0x21')](respondWithResult(_0x26ea85,null))['catch'](handleError(_0x26ea85,null));}; \ No newline at end of file +var _0x723e=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','JscriptyAnswerReport','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x2ef0b4,_0x5318d7){var _0x59173e=function(_0x1a6688){while(--_0x1a6688){_0x2ef0b4['push'](_0x2ef0b4['shift']());}};_0x59173e(++_0x5318d7);}(_0x723e,0x179));var _0xe723=function(_0x141e26,_0x18b19c){_0x141e26=_0x141e26-0x0;var _0xf0d405=_0x723e[_0x141e26];return _0xf0d405;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe723('0x0'));var zipdir=require(_0xe723('0x1'));var jsonpatch=require(_0xe723('0x2'));var rp=require(_0xe723('0x3'));var moment=require(_0xe723('0x4'));var BPromise=require(_0xe723('0x5'));var Mustache=require(_0xe723('0x6'));var util=require(_0xe723('0x7'));var path=require(_0xe723('0x8'));var sox=require(_0xe723('0x9'));var csv=require('to-csv');var ejs=require(_0xe723('0xa'));var fs=require('fs');var fs_extra=require(_0xe723('0xb'));var _=require(_0xe723('0xc'));var squel=require(_0xe723('0xd'));var crypto=require(_0xe723('0xe'));var jsforce=require(_0xe723('0xf'));var deskjs=require(_0xe723('0x10'));var toCsv=require(_0xe723('0x11'));var querystring=require('querystring');var Papa=require(_0xe723('0x12'));var Redis=require(_0xe723('0x13'));var authService=require(_0xe723('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe723('0x15'));var hardwareService=require(_0xe723('0x16'));var logger=require(_0xe723('0x17'))('api');var utils=require(_0xe723('0x18'));var config=require(_0xe723('0x19'));var licenseUtil=require(_0xe723('0x1a'));var db=require(_0xe723('0x1b'))['db'];function respondWithStatusCode(_0x236b69,_0x5c066c){_0x5c066c=_0x5c066c||0xcc;return function(_0x29a1e){if(_0x29a1e){return _0x236b69['sendStatus'](_0x5c066c);}return _0x236b69['status'](_0x5c066c)['end']();};}function respondWithResult(_0x57bc0e,_0x75c12c){_0x75c12c=_0x75c12c||0xc8;return function(_0x30b2ba){if(_0x30b2ba){return _0x57bc0e[_0xe723('0x1c')](_0x75c12c)[_0xe723('0x1d')](_0x30b2ba);}};}function respondWithFilteredResult(_0xf29a39,_0x5aec97){return function(_0x23d0b2){if(_0x23d0b2){var _0xbf5ca3=typeof _0x5aec97[_0xe723('0x1e')]===_0xe723('0x1f')&&typeof _0x5aec97[_0xe723('0x20')]===_0xe723('0x1f');var _0x2cd7ca=_0x23d0b2[_0xe723('0x21')];var _0x17e2c1=_0xbf5ca3?0x0:_0x5aec97[_0xe723('0x1e')];var _0x2057d7=_0xbf5ca3?_0x23d0b2[_0xe723('0x21')]:_0x5aec97[_0xe723('0x1e')]+_0x5aec97[_0xe723('0x20')];var _0x5e8a90;if(_0x2057d7>=_0x2cd7ca){_0x2057d7=_0x2cd7ca;_0x5e8a90=0xc8;}else{_0x5e8a90=0xce;}_0xf29a39['status'](_0x5e8a90);return _0xf29a39[_0xe723('0x22')](_0xe723('0x23'),_0x17e2c1+'-'+_0x2057d7+'/'+_0x2cd7ca)['json'](_0x23d0b2);}return null;};}function patchUpdates(_0x28caca){return function(_0x2762e2){try{jsonpatch['apply'](_0x2762e2,_0x28caca,!![]);}catch(_0x472502){return BPromise['reject'](_0x472502);}return _0x2762e2[_0xe723('0x24')]();};}function saveUpdates(_0x43ccfc,_0x3b82b2){return function(_0x1fe43d){if(_0x1fe43d){return _0x1fe43d[_0xe723('0x25')](_0x43ccfc)[_0xe723('0x26')](function(_0x25f7d2){return _0x25f7d2;});}return null;};}function removeEntity(_0x15196c,_0x1228f2){return function(_0x19bd0c){if(_0x19bd0c){return _0x19bd0c[_0xe723('0x27')]()[_0xe723('0x26')](function(){_0x15196c['status'](0xcc)[_0xe723('0x28')]();});}};}function handleEntityNotFound(_0x59f095,_0xa258f3){return function(_0x3ffa15){if(!_0x3ffa15){_0x59f095[_0xe723('0x29')](0x194);}return _0x3ffa15;};}function handleError(_0xe7e271,_0x1f81ec){_0x1f81ec=_0x1f81ec||0x1f4;return function(_0x598f15){logger[_0xe723('0x2a')](_0x598f15['stack']);if(_0x598f15['name']){delete _0x598f15[_0xe723('0x2b')];}_0xe7e271['status'](_0x1f81ec)[_0xe723('0x2c')](_0x598f15);};}exports[_0xe723('0x2d')]=function(_0x335c66,_0x4d55cc){var _0x1edbb2={},_0x45e162={},_0x48a97a={'count':0x0,'rows':[]};var _0x3c8c56=_['map'](db['JscriptyAnswerReport'][_0xe723('0x2e')],function(_0x2c2240){return{'name':_0x2c2240[_0xe723('0x2f')],'type':_0x2c2240[_0xe723('0x30')]['key']};});_0x45e162['model']=_[_0xe723('0x31')](_0x3c8c56,'name');_0x45e162[_0xe723('0x32')]=_[_0xe723('0x33')](_0x335c66[_0xe723('0x32')]);_0x45e162[_0xe723('0x34')]=_[_0xe723('0x35')](_0x45e162[_0xe723('0x36')],_0x45e162[_0xe723('0x32')]);_0x1edbb2[_0xe723('0x37')]=_[_0xe723('0x35')](_0x45e162[_0xe723('0x36')],qs[_0xe723('0x38')](_0x335c66[_0xe723('0x32')][_0xe723('0x38')]));_0x1edbb2[_0xe723('0x37')]=_0x1edbb2['attributes'][_0xe723('0x39')]?_0x1edbb2['attributes']:_0x45e162[_0xe723('0x36')];if(!_0x335c66[_0xe723('0x32')]['hasOwnProperty']('nolimit')){_0x1edbb2[_0xe723('0x20')]=qs[_0xe723('0x20')](_0x335c66[_0xe723('0x32')][_0xe723('0x20')]);_0x1edbb2[_0xe723('0x1e')]=qs[_0xe723('0x1e')](_0x335c66['query'][_0xe723('0x1e')]);}_0x1edbb2[_0xe723('0x3a')]=qs[_0xe723('0x3b')](_0x335c66[_0xe723('0x32')][_0xe723('0x3b')]);_0x1edbb2[_0xe723('0x3c')]=qs[_0xe723('0x34')](_[_0xe723('0x3d')](_0x335c66[_0xe723('0x32')],_0x45e162[_0xe723('0x34')]),_0x3c8c56);if(_0x335c66[_0xe723('0x32')][_0xe723('0x3e')]){_0x1edbb2[_0xe723('0x3c')]=_[_0xe723('0x3f')](_0x1edbb2[_0xe723('0x3c')],{'$or':_[_0xe723('0x31')](_0x3c8c56,function(_0x5c5027){if(_0x5c5027[_0xe723('0x30')]!==_0xe723('0x40')){var _0x68eda5={};_0x68eda5[_0x5c5027[_0xe723('0x2b')]]={'$like':'%'+_0x335c66['query']['filter']+'%'};return _0x68eda5;}})});}_0x1edbb2=_[_0xe723('0x3f')]({},_0x1edbb2,_0x335c66[_0xe723('0x41')]);var _0xc0c2c7={'where':_0x1edbb2[_0xe723('0x3c')]};return db['JscriptyAnswerReport']['count'](_0xc0c2c7)[_0xe723('0x26')](function(_0x2f1618){_0x48a97a[_0xe723('0x21')]=_0x2f1618;if(_0x335c66[_0xe723('0x32')][_0xe723('0x42')]){_0x1edbb2[_0xe723('0x43')]=[{'all':!![]}];}return db[_0xe723('0x44')][_0xe723('0x45')](_0x1edbb2);})[_0xe723('0x26')](function(_0x5b0c89){_0x48a97a['rows']=_0x5b0c89;return _0x48a97a;})[_0xe723('0x26')](respondWithFilteredResult(_0x4d55cc,_0x1edbb2))['catch'](handleError(_0x4d55cc,null));};exports['show']=function(_0x18f4a1,_0x55530b){var _0x36272={'raw':!![],'where':{'id':_0x18f4a1[_0xe723('0x46')]['id']}},_0x42bd2f={};_0x42bd2f[_0xe723('0x36')]=_[_0xe723('0x33')](db[_0xe723('0x44')][_0xe723('0x2e')]);_0x42bd2f['query']=_['keys'](_0x18f4a1[_0xe723('0x32')]);_0x42bd2f['filters']=_[_0xe723('0x35')](_0x42bd2f['model'],_0x42bd2f[_0xe723('0x32')]);_0x36272[_0xe723('0x37')]=_[_0xe723('0x35')](_0x42bd2f[_0xe723('0x36')],qs[_0xe723('0x38')](_0x18f4a1[_0xe723('0x32')][_0xe723('0x38')]));_0x36272[_0xe723('0x37')]=_0x36272[_0xe723('0x37')]['length']?_0x36272['attributes']:_0x42bd2f[_0xe723('0x36')];if(_0x18f4a1[_0xe723('0x32')][_0xe723('0x42')]){_0x36272['include']=[{'all':!![]}];}_0x36272=_['merge']({},_0x36272,_0x18f4a1['options']);return db[_0xe723('0x44')][_0xe723('0x47')](_0x36272)[_0xe723('0x26')](handleEntityNotFound(_0x55530b,null))['then'](respondWithResult(_0x55530b,null))[_0xe723('0x48')](handleError(_0x55530b,null));};exports[_0xe723('0x49')]=function(_0x1cb2b2,_0x38bd1a){return db[_0xe723('0x44')]['create'](_0x1cb2b2[_0xe723('0x4a')],{})['then'](respondWithResult(_0x38bd1a,0xc9))[_0xe723('0x48')](handleError(_0x38bd1a,null));};exports['update']=function(_0x52f42e,_0x1590fe){if(_0x52f42e[_0xe723('0x4a')]['id']){delete _0x52f42e[_0xe723('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0xe723('0x47')]({'where':{'id':_0x52f42e['params']['id']}})[_0xe723('0x26')](handleEntityNotFound(_0x1590fe,null))[_0xe723('0x26')](saveUpdates(_0x52f42e[_0xe723('0x4a')],null))[_0xe723('0x26')](respondWithResult(_0x1590fe,null))[_0xe723('0x48')](handleError(_0x1590fe,null));};exports[_0xe723('0x27')]=function(_0x41e1c4,_0x16cb50){return db[_0xe723('0x44')]['find']({'where':{'id':_0x41e1c4[_0xe723('0x46')]['id']}})[_0xe723('0x26')](handleEntityNotFound(_0x16cb50,null))['then'](removeEntity(_0x16cb50,null))[_0xe723('0x48')](handleError(_0x16cb50,null));};exports[_0xe723('0x4b')]=function(_0x56e92a,_0x126ca5){return db['JscriptyAnswerReport']['describe']()[_0xe723('0x26')](respondWithResult(_0x126ca5,null))[_0xe723('0x48')](handleError(_0x126ca5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index da0ca93..ce37f27 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 _0x89d5=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33730c,_0x3d39a4){var _0x231965=function(_0x153af7){while(--_0x153af7){_0x33730c['push'](_0x33730c['shift']());}};_0x231965(++_0x3d39a4);}(_0x89d5,0x13b));var _0x589d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x89d5[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x589d('0x0'));var util=require(_0x589d('0x1'));var logger=require(_0x589d('0x2'))(_0x589d('0x3'));var moment=require(_0x589d('0x4'));var BPromise=require(_0x589d('0x5'));var rp=require(_0x589d('0x6'));var fs=require('fs');var path=require(_0x589d('0x7'));var rimraf=require(_0x589d('0x8'));var config=require(_0x589d('0x9'));var attributes=require(_0x589d('0xa'));module[_0x589d('0xb')]=function(_0x23be50,_0x4f8d64){return _0x23be50[_0x589d('0xc')]('JscriptyAnswerReport',attributes,{'tableName':_0x589d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf24f=['report_jscripty_answers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x2bd211,_0x522300){var _0x5b963e=function(_0x553314){while(--_0x553314){_0x2bd211['push'](_0x2bd211['shift']());}};_0x5b963e(++_0x522300);}(_0xf24f,0x1b1));var _0xff24=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xf24f[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xff24('0x0'));var util=require('util');var logger=require(_0xff24('0x1'))(_0xff24('0x2'));var moment=require('moment');var BPromise=require(_0xff24('0x3'));var rp=require(_0xff24('0x4'));var fs=require('fs');var path=require(_0xff24('0x5'));var rimraf=require(_0xff24('0x6'));var config=require('../../config/environment');var attributes=require(_0xff24('0x7'));module[_0xff24('0x8')]=function(_0x466182,_0xa9ba4){return _0x466182[_0xff24('0x9')](_0xff24('0xa'),attributes,{'tableName':_0xff24('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 57a6d9a..f110a00 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 _0x4bcb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4b1638,_0x1ec7c8){var _0x3af181=function(_0x1c7135){while(--_0x1c7135){_0x4b1638['push'](_0x4b1638['shift']());}};_0x3af181(++_0x1ec7c8);}(_0x4bcb,0x14c));var _0xb4bc=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0x4bcb[_0x4c260a];return _0x17bbdd;};'use strict';var _=require('lodash');var util=require(_0xb4bc('0x0'));var moment=require(_0xb4bc('0x1'));var BPromise=require(_0xb4bc('0x2'));var rs=require(_0xb4bc('0x3'));var fs=require('fs');var Redis=require(_0xb4bc('0x4'));var db=require(_0xb4bc('0x5'))['db'];var utils=require(_0xb4bc('0x6'));var logger=require(_0xb4bc('0x7'))(_0xb4bc('0x8'));var config=require(_0xb4bc('0x9'));var jayson=require(_0xb4bc('0xa'));var client=jayson['client'][_0xb4bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ac199,_0x59d7b3,_0x13db26){return new BPromise(function(_0x251788,_0x3ab5dc){return client[_0xb4bc('0xc')](_0x1ac199,_0x13db26)[_0xb4bc('0xd')](function(_0xee7fd4){logger[_0xb4bc('0xe')](_0xb4bc('0xf'),_0x59d7b3,_0xb4bc('0x10'));logger['debug'](_0xb4bc('0x11'),_0x59d7b3,_0xb4bc('0x10'),JSON[_0xb4bc('0x12')](_0xee7fd4));if(_0xee7fd4['error']){if(_0xee7fd4[_0xb4bc('0x13')][_0xb4bc('0x14')]===0x1f4){logger[_0xb4bc('0x13')](_0xb4bc('0xf'),_0x59d7b3,_0xee7fd4[_0xb4bc('0x13')][_0xb4bc('0x15')]);return _0x3ab5dc(_0xee7fd4[_0xb4bc('0x13')]['message']);}logger[_0xb4bc('0x13')](_0xb4bc('0xf'),_0x59d7b3,_0xee7fd4[_0xb4bc('0x13')][_0xb4bc('0x15')]);return _0x251788(_0xee7fd4[_0xb4bc('0x13')][_0xb4bc('0x15')]);}else{logger['info'](_0xb4bc('0xf'),_0x59d7b3,_0xb4bc('0x10'));_0x251788(_0xee7fd4[_0xb4bc('0x16')][_0xb4bc('0x15')]);}})[_0xb4bc('0x17')](function(_0xf03ec0){logger['error'](_0xb4bc('0xf'),_0x59d7b3,_0xf03ec0);_0x3ab5dc(_0xf03ec0);});});} \ No newline at end of file +var _0x33c7=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0x33c7,0x1be));var _0x733c=function(_0x149319,_0x4182b5){_0x149319=_0x149319-0x0;var _0x4637c9=_0x33c7[_0x149319];return _0x4637c9;};'use strict';var _=require(_0x733c('0x0'));var util=require(_0x733c('0x1'));var moment=require(_0x733c('0x2'));var BPromise=require('bluebird');var rs=require(_0x733c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x733c('0x4'))['db'];var utils=require(_0x733c('0x5'));var logger=require(_0x733c('0x6'))(_0x733c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x733c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4caa77,_0x1cadac,_0x52ba75){return new BPromise(function(_0xf51a00,_0x414f34){return client[_0x733c('0x9')](_0x4caa77,_0x52ba75)[_0x733c('0xa')](function(_0x3b00ef){logger[_0x733c('0xb')](_0x733c('0xc'),_0x1cadac,_0x733c('0xd'));logger['debug'](_0x733c('0xe'),_0x1cadac,_0x733c('0xd'),JSON['stringify'](_0x3b00ef));if(_0x3b00ef['error']){if(_0x3b00ef[_0x733c('0xf')]['code']===0x1f4){logger[_0x733c('0xf')](_0x733c('0xc'),_0x1cadac,_0x3b00ef[_0x733c('0xf')][_0x733c('0x10')]);return _0x414f34(_0x3b00ef[_0x733c('0xf')][_0x733c('0x10')]);}logger[_0x733c('0xf')](_0x733c('0xc'),_0x1cadac,_0x3b00ef[_0x733c('0xf')]['message']);return _0xf51a00(_0x3b00ef[_0x733c('0xf')]['message']);}else{logger[_0x733c('0xb')](_0x733c('0xc'),_0x1cadac,_0x733c('0xd'));_0xf51a00(_0x3b00ef[_0x733c('0x11')][_0x733c('0x10')]);}})[_0x733c('0x12')](function(_0x144c0d){logger[_0x733c('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1cadac,_0x144c0d);_0x414f34(_0x144c0d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a782973..ad3804d 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 _0xe2c2=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','getSummary','post','/:id/clone','clone','put','update','delete','exports','multer','util'];(function(_0x4d73cf,_0x39838a){var _0x166c14=function(_0x42c052){while(--_0x42c052){_0x4d73cf['push'](_0x4d73cf['shift']());}};_0x166c14(++_0x39838a);}(_0xe2c2,0x1ec));var _0x2e2c=function(_0x24921c,_0x580364){_0x24921c=_0x24921c-0x0;var _0x11bd15=_0xe2c2[_0x24921c];return _0x11bd15;};'use strict';var multer=require(_0x2e2c('0x0'));var util=require(_0x2e2c('0x1'));var path=require(_0x2e2c('0x2'));var timeout=require(_0x2e2c('0x3'));var express=require(_0x2e2c('0x4'));var router=express['Router']();var fs_extra=require(_0x2e2c('0x5'));var auth=require(_0x2e2c('0x6'));var interaction=require(_0x2e2c('0x7'));var config=require(_0x2e2c('0x8'));var controller=require(_0x2e2c('0x9'));router[_0x2e2c('0xa')]('/',auth[_0x2e2c('0xb')](),controller[_0x2e2c('0xc')]);router[_0x2e2c('0xa')](_0x2e2c('0xd'),auth[_0x2e2c('0xb')](),controller['show']);router[_0x2e2c('0xa')](_0x2e2c('0xe'),auth[_0x2e2c('0xb')](),controller[_0x2e2c('0xf')]);router[_0x2e2c('0xa')](_0x2e2c('0x10'),auth[_0x2e2c('0xb')](),controller[_0x2e2c('0x11')]);router[_0x2e2c('0xa')]('/:id/summary',auth[_0x2e2c('0xb')](),timeout('30s'),controller[_0x2e2c('0x12')]);router[_0x2e2c('0x13')]('/',auth[_0x2e2c('0xb')](),controller['create']);router[_0x2e2c('0x13')](_0x2e2c('0x14'),auth[_0x2e2c('0xb')](),controller[_0x2e2c('0x15')]);router[_0x2e2c('0x16')](_0x2e2c('0xd'),auth[_0x2e2c('0xb')](),controller[_0x2e2c('0x17')]);router[_0x2e2c('0x18')](_0x2e2c('0xd'),auth[_0x2e2c('0xb')](),controller['destroy']);module[_0x2e2c('0x19')]=router; \ No newline at end of file +var _0x4534=['destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','post','create','clone','put','update','delete'];(function(_0x3301d9,_0x4d2198){var _0x10f894=function(_0x29608a){while(--_0x29608a){_0x3301d9['push'](_0x3301d9['shift']());}};_0x10f894(++_0x4d2198);}(_0x4534,0x181));var _0x4453=function(_0x1103f0,_0x5ad368){_0x1103f0=_0x1103f0-0x0;var _0xdb841=_0x4534[_0x1103f0];return _0xdb841;};'use strict';var multer=require(_0x4453('0x0'));var util=require(_0x4453('0x1'));var path=require('path');var timeout=require(_0x4453('0x2'));var express=require('express');var router=express[_0x4453('0x3')]();var fs_extra=require(_0x4453('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4453('0x5'));var config=require(_0x4453('0x6'));var controller=require(_0x4453('0x7'));router['get']('/',auth[_0x4453('0x8')](),controller['index']);router[_0x4453('0x9')](_0x4453('0xa'),auth[_0x4453('0x8')](),controller[_0x4453('0xb')]);router[_0x4453('0x9')](_0x4453('0xc'),auth['isAuthenticated'](),controller[_0x4453('0xd')]);router[_0x4453('0x9')](_0x4453('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4453('0x9')](_0x4453('0xf'),auth[_0x4453('0x8')](),timeout(_0x4453('0x10')),controller['getSummary']);router[_0x4453('0x11')]('/',auth[_0x4453('0x8')](),controller[_0x4453('0x12')]);router['post']('/:id/clone',auth[_0x4453('0x8')](),controller[_0x4453('0x13')]);router[_0x4453('0x14')](_0x4453('0xa'),auth[_0x4453('0x8')](),controller[_0x4453('0x15')]);router[_0x4453('0x16')](_0x4453('0xa'),auth['isAuthenticated'](),controller[_0x4453('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 182a7f5..638044e 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 _0x3977=['getDataValue','BOOLEAN','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x36876f,_0x23f166){var _0x554c06=function(_0x3e10c8){while(--_0x3e10c8){_0x36876f['push'](_0x36876f['shift']());}};_0x554c06(++_0x23f166);}(_0x3977,0x12d));var _0x7397=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3977[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require('util');module[_0x7397('0x0')]={'name':{'type':Sequelize[_0x7397('0x1')],'unique':_0x7397('0x2')},'description':{'type':Sequelize[_0x7397('0x1')]},'formData':{'type':Sequelize[_0x7397('0x3')](_0x7397('0x4')),'set':function(_0x1b8e80){if(_[_0x7397('0x5')](_0x1b8e80)){this[_0x7397('0x6')](_0x7397('0x7'),JSON[_0x7397('0x8')](_0x1b8e80));}else if(_[_0x7397('0x9')](_0x1b8e80)){this[_0x7397('0x6')](_0x7397('0x7'),_0x1b8e80);}else{this[_0x7397('0x6')](_0x7397('0x7'),util['format'](_0x7397('0xa'),this['getDataValue'](_0x7397('0x2'))||'',this[_0x7397('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7397('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xf160=['sequelize','util','exports','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x2376ca,_0x5ad6e7){var _0x3fae05=function(_0x434f30){while(--_0x434f30){_0x2376ca['push'](_0x2376ca['shift']());}};_0x3fae05(++_0x5ad6e7);}(_0xf160,0x159));var _0x0f16=function(_0x212aa2,_0x35effb){_0x212aa2=_0x212aa2-0x0;var _0x487f6d=_0xf160[_0x212aa2];return _0x487f6d;};'use strict';var Sequelize=require(_0x0f16('0x0'));var _=require('lodash');var util=require(_0x0f16('0x1'));module[_0x0f16('0x2')]={'name':{'type':Sequelize[_0x0f16('0x3')],'unique':_0x0f16('0x4')},'description':{'type':Sequelize[_0x0f16('0x3')]},'formData':{'type':Sequelize[_0x0f16('0x5')]('long'),'set':function(_0x318ef9){if(_[_0x0f16('0x6')](_0x318ef9)){this[_0x0f16('0x7')](_0x0f16('0x8'),JSON[_0x0f16('0x9')](_0x318ef9));}else if(_[_0x0f16('0xa')](_0x318ef9)){this[_0x0f16('0x7')]('formData',_0x318ef9);}else{this['setDataValue'](_0x0f16('0x8'),util['format'](_0x0f16('0xb'),this[_0x0f16('0xc')]('name')||'',this['getDataValue'](_0x0f16('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0f16('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0f16('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 438ab92..da6fede 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 _0x61d0=['filter','options','include','findAll','catch','show','params','keys','rawAttributes','length','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','omit','createdAt','updatedAt','includeAll','getSessions','findOne','nolimit','order','JscriptySessionReport','getAnswers','ProjectId','JscriptyAnswerReport','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','format','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','sort','where','pick'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x61d0,0x187));var _0x061d=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x61d0[_0x31df6f];return _0x31e353;};'use strict';var emlformat=require(_0x061d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x061d('0x1'));var jsonpatch=require(_0x061d('0x2'));var rp=require('request-promise');var moment=require(_0x061d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x061d('0x4'));var util=require(_0x061d('0x5'));var path=require('path');var sox=require(_0x061d('0x6'));var csv=require(_0x061d('0x7'));var ejs=require(_0x061d('0x8'));var fs=require('fs');var fs_extra=require(_0x061d('0x9'));var _=require(_0x061d('0xa'));var squel=require(_0x061d('0xb'));var crypto=require(_0x061d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x061d('0xd'));var Papa=require('papaparse');var Redis=require(_0x061d('0xe'));var authService=require(_0x061d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x061d('0x10'));var hardwareService=require(_0x061d('0x11'));var logger=require(_0x061d('0x12'))(_0x061d('0x13'));var utils=require(_0x061d('0x14'));var config=require(_0x061d('0x15'));var licenseUtil=require(_0x061d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fed5f,_0x35c760){_0x35c760=_0x35c760||0xcc;return function(_0x1bbe47){if(_0x1bbe47){return _0x3fed5f[_0x061d('0x17')](_0x35c760);}return _0x3fed5f[_0x061d('0x18')](_0x35c760)[_0x061d('0x19')]();};}function respondWithResult(_0x458a54,_0x34e021){_0x34e021=_0x34e021||0xc8;return function(_0x46fd62){if(_0x46fd62){return _0x458a54[_0x061d('0x18')](_0x34e021)['json'](_0x46fd62);}};}function respondWithFilteredResult(_0x155a37,_0x1afe85){return function(_0x457423){if(_0x457423){var _0x4f926b=typeof _0x1afe85[_0x061d('0x1a')]==='undefined'&&typeof _0x1afe85['limit']===_0x061d('0x1b');var _0x25f253=_0x457423[_0x061d('0x1c')];var _0x3ef34b=_0x4f926b?0x0:_0x1afe85['offset'];var _0x135c0a=_0x4f926b?_0x457423[_0x061d('0x1c')]:_0x1afe85[_0x061d('0x1a')]+_0x1afe85['limit'];var _0x207b0a;if(_0x135c0a>=_0x25f253){_0x135c0a=_0x25f253;_0x207b0a=0xc8;}else{_0x207b0a=0xce;}_0x155a37[_0x061d('0x18')](_0x207b0a);return _0x155a37[_0x061d('0x1d')](_0x061d('0x1e'),_0x3ef34b+'-'+_0x135c0a+'/'+_0x25f253)['json'](_0x457423);}return null;};}function patchUpdates(_0x17b8ed){return function(_0x2ffca2){try{jsonpatch['apply'](_0x2ffca2,_0x17b8ed,!![]);}catch(_0x464ef8){return BPromise[_0x061d('0x1f')](_0x464ef8);}return _0x2ffca2[_0x061d('0x20')]();};}function saveUpdates(_0x2efddf,_0xc3ded6){return function(_0x45e2eb){if(_0x45e2eb){return _0x45e2eb[_0x061d('0x21')](_0x2efddf)[_0x061d('0x22')](function(_0x47ef80){return _0x47ef80;});}return null;};}function removeEntity(_0x358d87,_0x3cd49a){return function(_0x5512f9){if(_0x5512f9){return _0x5512f9[_0x061d('0x23')]()[_0x061d('0x22')](function(){var _0x5b884a=_0x5512f9['get']({'plain':!![]});var _0x300b39=_0x061d('0x24');return db[_0x061d('0x25')][_0x061d('0x23')]({'where':{'type':_0x300b39,'resourceId':_0x5b884a['id']}})[_0x061d('0x22')](function(){return _0x5512f9;});})[_0x061d('0x22')](function(){_0x358d87['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d189c,_0x16f1db){return function(_0x5be49a){if(!_0x5be49a){_0x2d189c[_0x061d('0x17')](0x194);}return _0x5be49a;};}function handleError(_0x4bcb93,_0xed0570){_0xed0570=_0xed0570||0x1f4;return function(_0x1d3d76){logger[_0x061d('0x26')](_0x1d3d76[_0x061d('0x27')]);if(_0x1d3d76[_0x061d('0x28')]){delete _0x1d3d76[_0x061d('0x28')];}_0x4bcb93[_0x061d('0x18')](_0xed0570)[_0x061d('0x29')](_0x1d3d76);};}exports[_0x061d('0x2a')]=function(_0x16f00c,_0x2526d5){var _0xbf9d7b={},_0x4c17ca={},_0x17fd4a={'count':0x0,'rows':[]};var _0x2c754b=_[_0x061d('0x2b')](db[_0x061d('0x2c')]['rawAttributes'],function(_0x3fa14e){return{'name':_0x3fa14e['fieldName'],'type':_0x3fa14e[_0x061d('0x2d')]['key']};});_0x4c17ca[_0x061d('0x2e')]=_[_0x061d('0x2b')](_0x2c754b,'name');_0x4c17ca[_0x061d('0x2f')]=_['keys'](_0x16f00c[_0x061d('0x2f')]);_0x4c17ca[_0x061d('0x30')]=_[_0x061d('0x31')](_0x4c17ca[_0x061d('0x2e')],_0x4c17ca[_0x061d('0x2f')]);_0xbf9d7b['attributes']=_[_0x061d('0x31')](_0x4c17ca[_0x061d('0x2e')],qs[_0x061d('0x32')](_0x16f00c[_0x061d('0x2f')][_0x061d('0x32')]));_0xbf9d7b[_0x061d('0x33')]=_0xbf9d7b[_0x061d('0x33')]['length']?_0xbf9d7b[_0x061d('0x33')]:_0x4c17ca[_0x061d('0x2e')];if(!_0x16f00c['query'][_0x061d('0x34')]('nolimit')){_0xbf9d7b[_0x061d('0x35')]=qs[_0x061d('0x35')](_0x16f00c[_0x061d('0x2f')]['limit']);_0xbf9d7b[_0x061d('0x1a')]=qs[_0x061d('0x1a')](_0x16f00c[_0x061d('0x2f')][_0x061d('0x1a')]);}_0xbf9d7b['order']=qs[_0x061d('0x36')](_0x16f00c[_0x061d('0x2f')][_0x061d('0x36')]);_0xbf9d7b[_0x061d('0x37')]=qs[_0x061d('0x30')](_[_0x061d('0x38')](_0x16f00c[_0x061d('0x2f')],_0x4c17ca[_0x061d('0x30')]),_0x2c754b);if(_0x16f00c[_0x061d('0x2f')]['filter']){_0xbf9d7b[_0x061d('0x37')]=_['merge'](_0xbf9d7b[_0x061d('0x37')],{'$or':_['map'](_0x2c754b,function(_0x1e6646){if(_0x1e6646[_0x061d('0x2d')]!=='VIRTUAL'){var _0x55bc1e={};_0x55bc1e[_0x1e6646['name']]={'$like':'%'+_0x16f00c[_0x061d('0x2f')][_0x061d('0x39')]+'%'};return _0x55bc1e;}})});}_0xbf9d7b=_['merge']({},_0xbf9d7b,_0x16f00c[_0x061d('0x3a')]);var _0x34ce07={'where':_0xbf9d7b[_0x061d('0x37')]};return db[_0x061d('0x2c')][_0x061d('0x1c')](_0x34ce07)[_0x061d('0x22')](function(_0x14f6ab){_0x17fd4a[_0x061d('0x1c')]=_0x14f6ab;if(_0x16f00c[_0x061d('0x2f')]['includeAll']){_0xbf9d7b[_0x061d('0x3b')]=[{'all':!![]}];}return db['JscriptyProject'][_0x061d('0x3c')](_0xbf9d7b);})[_0x061d('0x22')](function(_0xd6ce34){_0x17fd4a['rows']=_0xd6ce34;return _0x17fd4a;})[_0x061d('0x22')](respondWithFilteredResult(_0x2526d5,_0xbf9d7b))[_0x061d('0x3d')](handleError(_0x2526d5,null));};exports[_0x061d('0x3e')]=function(_0x480327,_0x283757){var _0x1a6eae={'raw':![],'where':{'id':_0x480327[_0x061d('0x3f')]['id']}},_0x37d632={};_0x37d632[_0x061d('0x2e')]=_[_0x061d('0x40')](db[_0x061d('0x2c')][_0x061d('0x41')]);_0x37d632[_0x061d('0x2f')]=_[_0x061d('0x40')](_0x480327[_0x061d('0x2f')]);_0x37d632[_0x061d('0x30')]=_[_0x061d('0x31')](_0x37d632['model'],_0x37d632['query']);_0x1a6eae[_0x061d('0x33')]=_['intersection'](_0x37d632[_0x061d('0x2e')],qs[_0x061d('0x32')](_0x480327[_0x061d('0x2f')][_0x061d('0x32')]));_0x1a6eae[_0x061d('0x33')]=_0x1a6eae[_0x061d('0x33')][_0x061d('0x42')]?_0x1a6eae[_0x061d('0x33')]:_0x37d632[_0x061d('0x2e')];if(_0x480327['query']['includeAll']){_0x1a6eae['include']=[{'all':!![]}];}_0x1a6eae=_[_0x061d('0x43')]({},_0x1a6eae,_0x480327[_0x061d('0x3a')]);return db[_0x061d('0x2c')][_0x061d('0x44')](_0x1a6eae)[_0x061d('0x22')](handleEntityNotFound(_0x283757,null))[_0x061d('0x22')](respondWithResult(_0x283757,null))[_0x061d('0x3d')](handleError(_0x283757,null));};exports[_0x061d('0x45')]=function(_0x577ff6,_0xb20df5){return db['JscriptyProject'][_0x061d('0x45')](_0x577ff6[_0x061d('0x46')],{})[_0x061d('0x22')](function(_0x135d89){var _0x297941=_0x577ff6[_0x061d('0x47')][_0x061d('0x48')]({'plain':!![]});if(!_0x297941)throw new Error(_0x061d('0x49'));if(_0x297941[_0x061d('0x4a')]===_0x061d('0x47')){var _0x5caf08=_0x135d89['get']({'plain':!![]});var _0x447428=_0x061d('0x24');return db[_0x061d('0x4b')]['find']({'where':{'name':_0x447428,'userProfileId':_0x297941['userProfileId']},'raw':!![]})[_0x061d('0x22')](function(_0x255dad){if(_0x255dad&&_0x255dad[_0x061d('0x4c')]===0x0){return db[_0x061d('0x25')]['create']({'name':_0x5caf08['name'],'resourceId':_0x5caf08['id'],'type':_0x255dad[_0x061d('0x28')],'sectionId':_0x255dad['id']},{})[_0x061d('0x22')](function(){return _0x135d89;});}else{return _0x135d89;}})[_0x061d('0x3d')](function(_0xb3051f){logger[_0x061d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb3051f);throw _0xb3051f;});}return _0x135d89;})['then'](respondWithResult(_0xb20df5,0xc9))['catch'](handleError(_0xb20df5,null));};exports['clone']=function(_0x2dd832,_0x15b578){var _0x2f86de={'where':{'id':_0x2dd832[_0x061d('0x3f')]['id']}},_0x17e213={};_0x17e213[_0x061d('0x2e')]=_[_0x061d('0x40')](db['JscriptyProject'][_0x061d('0x41')]);_0x2f86de[_0x061d('0x33')]=_[_0x061d('0x31')](_0x17e213[_0x061d('0x2e')],qs[_0x061d('0x32')](_0x2dd832[_0x061d('0x2f')]['fields']));_0x2f86de[_0x061d('0x33')]=_0x2f86de[_0x061d('0x33')][_0x061d('0x42')]?_0x2f86de[_0x061d('0x33')]:_0x17e213['model'];if(_0x2dd832[_0x061d('0x2f')]['includeAll']){_0x2f86de[_0x061d('0x3b')]=[{'all':!![]}];}_0x2f86de=_[_0x061d('0x43')]({},_0x2f86de,_0x2dd832[_0x061d('0x3a')]);return db['JscriptyProject'][_0x061d('0x44')](_0x2f86de)['then'](handleEntityNotFound(_0x15b578,null))[_0x061d('0x22')](function(_0x4114c2){if(_0x4114c2){var _0x348523=_0x4114c2[_0x061d('0x48')]({'plain':!![]});_0x348523=qs[_0x061d('0x4d')](_0x348523,['id',_0x061d('0x4e'),_0x061d('0x4f')]);_0x2dd832[_0x061d('0x46')]=_['omit'](_0x2dd832['body'],['id',_0x061d('0x4e'),_0x061d('0x4f')]);return db[_0x061d('0x2c')][_0x061d('0x45')](_[_0x061d('0x43')](_0x348523,_0x2dd832[_0x061d('0x46')]),{'include':_0x2dd832['query'][_0x061d('0x50')]?[{'all':!![]}]:undefined})[_0x061d('0x22')](function(_0x508a95){var _0x195e04=_0x2dd832[_0x061d('0x47')]['get']({'plain':!![]});if(!_0x195e04)throw new Error(_0x061d('0x49'));if(_0x195e04[_0x061d('0x4a')]===_0x061d('0x47')){var _0x2a78e9=_0x508a95['get']({'plain':!![]});var _0x28f5f5=_0x061d('0x24');return db[_0x061d('0x4b')]['find']({'where':{'name':_0x28f5f5,'userProfileId':_0x195e04['userProfileId']},'raw':!![]})[_0x061d('0x22')](function(_0xd4c747){if(_0xd4c747&&_0xd4c747[_0x061d('0x4c')]===0x0){return db[_0x061d('0x25')][_0x061d('0x45')]({'name':_0x2a78e9[_0x061d('0x28')],'resourceId':_0x2a78e9['id'],'type':_0xd4c747[_0x061d('0x28')],'sectionId':_0xd4c747['id']},{})[_0x061d('0x22')](function(){return _0x508a95;});}else{return _0x508a95;}})[_0x061d('0x3d')](function(_0x8a3f19){logger[_0x061d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8a3f19);throw _0x8a3f19;});}return _0x508a95;});}})['then'](respondWithResult(_0x15b578,0xc9))['catch'](handleError(_0x15b578,null));};exports['update']=function(_0x5f7e5e,_0x25347e){if(_0x5f7e5e['body']['id']){delete _0x5f7e5e[_0x061d('0x46')]['id'];}return db[_0x061d('0x2c')]['find']({'where':{'id':_0x5f7e5e[_0x061d('0x3f')]['id']}})[_0x061d('0x22')](handleEntityNotFound(_0x25347e,null))[_0x061d('0x22')](saveUpdates(_0x5f7e5e[_0x061d('0x46')],null))[_0x061d('0x22')](respondWithResult(_0x25347e,null))['catch'](handleError(_0x25347e,null));};exports[_0x061d('0x23')]=function(_0x17a5fc,_0x4ce30c){return db[_0x061d('0x2c')]['find']({'where':{'id':_0x17a5fc['params']['id']}})[_0x061d('0x22')](handleEntityNotFound(_0x4ce30c,null))['then'](removeEntity(_0x4ce30c,null))[_0x061d('0x3d')](handleError(_0x4ce30c,null));};exports[_0x061d('0x51')]=function(_0x195cfc,_0x3ff255,_0x19ebbe){var _0x10eef5={'raw':!![],'where':{}};var _0x21355f={};var _0x47c890={'count':0x0,'rows':[]};return db[_0x061d('0x2c')][_0x061d('0x52')]({'where':{'id':_0x195cfc['params']['id']}})[_0x061d('0x22')](handleEntityNotFound(_0x3ff255,null))['then'](function(_0x50fba5){if(_0x50fba5){_0x21355f[_0x061d('0x2e')]=_['keys'](db['JscriptySessionReport'][_0x061d('0x41')]);_0x21355f['query']=_['keys'](_0x195cfc[_0x061d('0x2f')]);_0x21355f[_0x061d('0x30')]=_['intersection'](_0x21355f[_0x061d('0x2e')],_0x21355f[_0x061d('0x2f')]);_0x10eef5['attributes']=_[_0x061d('0x31')](_0x21355f['model'],qs[_0x061d('0x32')](_0x195cfc['query']['fields']));_0x10eef5[_0x061d('0x33')]=_0x10eef5[_0x061d('0x33')][_0x061d('0x42')]?_0x10eef5[_0x061d('0x33')]:_0x21355f[_0x061d('0x2e')];if(!_0x195cfc[_0x061d('0x2f')][_0x061d('0x34')](_0x061d('0x53'))){_0x10eef5[_0x061d('0x35')]=qs[_0x061d('0x35')](_0x195cfc[_0x061d('0x2f')][_0x061d('0x35')]);_0x10eef5[_0x061d('0x1a')]=qs[_0x061d('0x1a')](_0x195cfc[_0x061d('0x2f')][_0x061d('0x1a')]);}_0x10eef5[_0x061d('0x54')]=qs[_0x061d('0x36')](_0x195cfc['query'][_0x061d('0x36')]);_0x10eef5[_0x061d('0x37')]=qs[_0x061d('0x30')](_[_0x061d('0x38')](_0x195cfc[_0x061d('0x2f')],_0x21355f['filters']));_0x10eef5[_0x061d('0x37')]['ProjectId']=_0x50fba5['id'];if(_0x195cfc['query']['filter']){_0x10eef5[_0x061d('0x37')]=_['merge'](_0x10eef5[_0x061d('0x37')],{'$or':_[_0x061d('0x2b')](_0x10eef5[_0x061d('0x33')],function(_0x101e5f){var _0x43047c={};_0x43047c[_0x101e5f]={'$like':'%'+_0x195cfc[_0x061d('0x2f')]['filter']+'%'};return _0x43047c;})});}_0x10eef5=_[_0x061d('0x43')]({},_0x10eef5,_0x195cfc[_0x061d('0x3a')]);return db[_0x061d('0x55')][_0x061d('0x1c')]({'where':_0x10eef5[_0x061d('0x37')]})['then'](function(_0x43e8fc){_0x47c890[_0x061d('0x1c')]=_0x43e8fc;if(_0x195cfc[_0x061d('0x2f')][_0x061d('0x50')]){_0x10eef5[_0x061d('0x3b')]=[{'all':!![]}];}return db[_0x061d('0x55')]['findAll'](_0x10eef5);})['then'](function(_0x3b32f9){_0x47c890['rows']=_0x3b32f9;return _0x47c890;});}})[_0x061d('0x22')](respondWithFilteredResult(_0x3ff255,_0x10eef5))[_0x061d('0x3d')](handleError(_0x3ff255,null));};exports[_0x061d('0x56')]=function(_0x7ceeec,_0x22fff5,_0x2cc07c){var _0x53bedf={'raw':!![],'where':{}};var _0x85c49e={};var _0x5630f3={'count':0x0,'rows':[]};return db[_0x061d('0x2c')][_0x061d('0x52')]({'where':{'id':_0x7ceeec[_0x061d('0x3f')]['id']}})[_0x061d('0x22')](handleEntityNotFound(_0x22fff5,null))[_0x061d('0x22')](function(_0x17ac5f){if(_0x17ac5f){_0x85c49e[_0x061d('0x2e')]=_[_0x061d('0x40')](db['JscriptyAnswerReport']['rawAttributes']);_0x85c49e[_0x061d('0x2f')]=_['keys'](_0x7ceeec[_0x061d('0x2f')]);_0x85c49e[_0x061d('0x30')]=_[_0x061d('0x31')](_0x85c49e['model'],_0x85c49e[_0x061d('0x2f')]);_0x53bedf[_0x061d('0x33')]=_['intersection'](_0x85c49e[_0x061d('0x2e')],qs[_0x061d('0x32')](_0x7ceeec[_0x061d('0x2f')][_0x061d('0x32')]));_0x53bedf[_0x061d('0x33')]=_0x53bedf[_0x061d('0x33')]['length']?_0x53bedf[_0x061d('0x33')]:_0x85c49e['model'];if(!_0x7ceeec[_0x061d('0x2f')][_0x061d('0x34')](_0x061d('0x53'))){_0x53bedf[_0x061d('0x35')]=qs['limit'](_0x7ceeec[_0x061d('0x2f')]['limit']);_0x53bedf['offset']=qs['offset'](_0x7ceeec[_0x061d('0x2f')]['offset']);}_0x53bedf[_0x061d('0x54')]=qs[_0x061d('0x36')](_0x7ceeec[_0x061d('0x2f')][_0x061d('0x36')]);_0x53bedf[_0x061d('0x37')]=qs[_0x061d('0x30')](_[_0x061d('0x38')](_0x7ceeec[_0x061d('0x2f')],_0x85c49e[_0x061d('0x30')]));_0x53bedf[_0x061d('0x37')][_0x061d('0x57')]=_0x17ac5f['id'];if(_0x7ceeec[_0x061d('0x2f')][_0x061d('0x39')]){_0x53bedf[_0x061d('0x37')]=_[_0x061d('0x43')](_0x53bedf[_0x061d('0x37')],{'$or':_[_0x061d('0x2b')](_0x53bedf['attributes'],function(_0x5019f0){var _0x51ce36={};_0x51ce36[_0x5019f0]={'$like':'%'+_0x7ceeec['query']['filter']+'%'};return _0x51ce36;})});}_0x53bedf=_[_0x061d('0x43')]({},_0x53bedf,_0x7ceeec[_0x061d('0x3a')]);return db[_0x061d('0x58')][_0x061d('0x1c')]({'where':_0x53bedf[_0x061d('0x37')]})[_0x061d('0x22')](function(_0x208b59){_0x5630f3[_0x061d('0x1c')]=_0x208b59;if(_0x7ceeec[_0x061d('0x2f')][_0x061d('0x50')]){_0x53bedf[_0x061d('0x3b')]=[{'all':!![]}];}return db[_0x061d('0x58')]['findAll'](_0x53bedf);})[_0x061d('0x22')](function(_0x3bee32){_0x5630f3['rows']=_0x3bee32;return _0x5630f3;});}})[_0x061d('0x22')](respondWithFilteredResult(_0x22fff5,_0x53bedf))[_0x061d('0x3d')](handleError(_0x22fff5,null));};function char(_0x7dc176){return'number'===typeof _0x7dc176?String[_0x061d('0x59')][_0x061d('0x5a')](null,arguments):_0x7dc176;}function needsEncapsulation(_0x5443ea){return!!_0x5443ea&&(_0x5443ea[_0x061d('0x5b')]()[_0x061d('0x5c')](char(0xd))>=0x0||_0x5443ea[_0x061d('0x5b')]()[_0x061d('0x5c')](char(0xa))>=0x0||_0x5443ea[_0x061d('0x5b')]()[_0x061d('0x5c')](char(0x2c))>=0x0||_0x5443ea[_0x061d('0x5b')]()[_0x061d('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x573b77){var _0x469c8e=char(0x22),_0x3902af='\x5c'+char(0x22),_0x368f55=_0x573b77['toString']()[_0x061d('0x5d')](new RegExp(_0x469c8e,'g'),_0x3902af);return _0x469c8e+_0x368f55+_0x469c8e;}exports[_0x061d('0x5e')]=function(_0x1ed2e9,_0x1cfb5f,_0x3151e8){var _0x4c4d61,_0x7a59e4;var _0x1e35b0={'where':{'ProjectId':_0x1ed2e9[_0x061d('0x3f')]['id']}};if(_0x1ed2e9[_0x061d('0x2f')][_0x061d('0x5f')]){_0x1e35b0['where'][_0x061d('0x60')]=JSON[_0x061d('0x61')](_0x1ed2e9[_0x061d('0x2f')][_0x061d('0x5f')]);}return db[_0x061d('0x55')][_0x061d('0x3c')](_0x1e35b0)['then'](handleEntityNotFound(_0x1cfb5f,null))[_0x061d('0x22')](function(_0x189fba){if(_0x189fba){_0x4c4d61=_0x189fba;return db[_0x061d('0x62')][_0x061d('0x3c')]({'where':{'SessionId':{'$in':_['map'](_0x4c4d61,'id')},'ProjectId':_0x1ed2e9[_0x061d('0x3f')]['id']},'order':_0x061d('0x63')});}})[_0x061d('0x22')](handleEntityNotFound(_0x1cfb5f,null))['then'](function(_0x1f69ec){if(_0x1f69ec){_0x7a59e4=_0x1f69ec;var _0x3c3c0e={};for(var _0x231ebb=0x0,_0x4c96fc=_0x7a59e4[_0x061d('0x42')];_0x231ebb<_0x4c96fc;_0x231ebb++){if(!_0x3c3c0e[_0x061d('0x34')](_0x7a59e4[_0x231ebb][_0x061d('0x64')])){_0x3c3c0e[_0x7a59e4[_0x231ebb][_0x061d('0x64')]]=needsEncapsulation(_0x7a59e4[_0x231ebb]['question'])?encapsulate(_0x7a59e4[_0x231ebb][_0x061d('0x65')]):_0x7a59e4[_0x231ebb][_0x061d('0x65')];}}var _0x1590fa=[],_0x1cfd2c={};for(var _0x60915c=0x0,_0x5d82c8=_0x4c4d61[_0x061d('0x42')];_0x60915c<_0x5d82c8;_0x60915c++){_0x1cfd2c={'ProjectId':_0x1ed2e9['params']['id'],'SessionId':_0x4c4d61[_0x60915c]['id'],'StartTime':moment(_0x4c4d61[_0x60915c][_0x061d('0x60')])['format'](_0x061d('0x66'))};for(var _0xb03c89=0x0,_0x1855a4=_0x7a59e4[_0x061d('0x42')];_0xb03c89<_0x1855a4;_0xb03c89++){if(_0x7a59e4[_0xb03c89][_0x061d('0x67')]==_0x4c4d61[_0x60915c]['id']&&_0x3c3c0e[_0x061d('0x34')](_0x7a59e4[_0xb03c89][_0x061d('0x64')])){_0x1cfd2c[_0x3c3c0e[_0x7a59e4[_0xb03c89][_0x061d('0x64')]]]=_0x7a59e4[_0xb03c89][_0x061d('0x68')];}}for(var _0x30c62c in _0x3c3c0e){if(!_0x1cfd2c['hasOwnProperty'](_0x3c3c0e[_0x30c62c])){_0x1cfd2c[_0x3c3c0e[_0x30c62c]]=null;}}_0x1590fa['push'](_0x1cfd2c);}return _0x1590fa;}})['then'](function(_0x3b5d07){if(!_['isEmpty'](_0x3b5d07)){var _0x3a2a18=toCsv(_0x3b5d07);var _0x55562a=Date[_0x061d('0x69')]();fs[_0x061d('0x6a')](util[_0x061d('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1ed2e9[_0x061d('0x3f')]['id'],_0x55562a),_0x3a2a18);_0x1cfb5f[_0x061d('0x6c')]('Content-disposition',_0x061d('0x6d')+util['format'](_0x061d('0x6e'),_0x1ed2e9[_0x061d('0x3f')]['id'],_0x55562a));_0x1cfb5f[_0x061d('0x6c')]('Content-type','text/csv');return _0x1cfb5f[_0x061d('0x6f')](util[_0x061d('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1ed2e9[_0x061d('0x3f')]['id'],_0x55562a));}else{return _0x1cfb5f[_0x061d('0x17')](0xcc);}})['catch'](handleError(_0x1cfb5f,null));}; \ No newline at end of file +var _0xfb8a=['JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Projects','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','createdAt','UserProfileSection','getSessions','findOne'];(function(_0x17be84,_0x20ee64){var _0x4c632b=function(_0x1fc1e2){while(--_0x1fc1e2){_0x17be84['push'](_0x17be84['shift']());}};_0x4c632b(++_0x20ee64);}(_0xfb8a,0x109));var _0xafb8=function(_0x1fbc6d,_0x59e4af){_0x1fbc6d=_0x1fbc6d-0x0;var _0x1c702e=_0xfb8a[_0x1fbc6d];return _0x1c702e;};'use strict';var emlformat=require(_0xafb8('0x0'));var rimraf=require(_0xafb8('0x1'));var zipdir=require(_0xafb8('0x2'));var jsonpatch=require(_0xafb8('0x3'));var rp=require('request-promise');var moment=require(_0xafb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xafb8('0x5'));var util=require(_0xafb8('0x6'));var path=require(_0xafb8('0x7'));var sox=require(_0xafb8('0x8'));var csv=require(_0xafb8('0x9'));var ejs=require(_0xafb8('0xa'));var fs=require('fs');var fs_extra=require(_0xafb8('0xb'));var _=require(_0xafb8('0xc'));var squel=require(_0xafb8('0xd'));var crypto=require(_0xafb8('0xe'));var jsforce=require(_0xafb8('0xf'));var deskjs=require(_0xafb8('0x10'));var toCsv=require(_0xafb8('0x9'));var querystring=require(_0xafb8('0x11'));var Papa=require('papaparse');var Redis=require(_0xafb8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xafb8('0x13'));var as=require(_0xafb8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xafb8('0x15'));var config=require(_0xafb8('0x16'));var licenseUtil=require(_0xafb8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249fb4,_0x5bcc25){_0x5bcc25=_0x5bcc25||0xcc;return function(_0x117262){if(_0x117262){return _0x249fb4[_0xafb8('0x18')](_0x5bcc25);}return _0x249fb4[_0xafb8('0x19')](_0x5bcc25)['end']();};}function respondWithResult(_0x3010c5,_0x560fef){_0x560fef=_0x560fef||0xc8;return function(_0x20efb8){if(_0x20efb8){return _0x3010c5[_0xafb8('0x19')](_0x560fef)[_0xafb8('0x1a')](_0x20efb8);}};}function respondWithFilteredResult(_0x4223a5,_0x40e7d8){return function(_0x1816aa){if(_0x1816aa){var _0x322c81=typeof _0x40e7d8[_0xafb8('0x1b')]===_0xafb8('0x1c')&&typeof _0x40e7d8[_0xafb8('0x1d')]===_0xafb8('0x1c');var _0x5f246b=_0x1816aa[_0xafb8('0x1e')];var _0x5ce21d=_0x322c81?0x0:_0x40e7d8[_0xafb8('0x1b')];var _0x5435e4=_0x322c81?_0x1816aa[_0xafb8('0x1e')]:_0x40e7d8[_0xafb8('0x1b')]+_0x40e7d8[_0xafb8('0x1d')];var _0x25512c;if(_0x5435e4>=_0x5f246b){_0x5435e4=_0x5f246b;_0x25512c=0xc8;}else{_0x25512c=0xce;}_0x4223a5['status'](_0x25512c);return _0x4223a5[_0xafb8('0x1f')](_0xafb8('0x20'),_0x5ce21d+'-'+_0x5435e4+'/'+_0x5f246b)[_0xafb8('0x1a')](_0x1816aa);}return null;};}function patchUpdates(_0x33dcd9){return function(_0x243810){try{jsonpatch[_0xafb8('0x21')](_0x243810,_0x33dcd9,!![]);}catch(_0x111686){return BPromise['reject'](_0x111686);}return _0x243810['save']();};}function saveUpdates(_0x35f751,_0x5e9ee6){return function(_0x5e9e93){if(_0x5e9e93){return _0x5e9e93[_0xafb8('0x22')](_0x35f751)[_0xafb8('0x23')](function(_0x409c6c){return _0x409c6c;});}return null;};}function removeEntity(_0x1741ee,_0x34d97a){return function(_0x7be8bf){if(_0x7be8bf){return _0x7be8bf[_0xafb8('0x24')]()['then'](function(){var _0x274c35=_0x7be8bf['get']({'plain':!![]});var _0x16ce44='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x16ce44,'resourceId':_0x274c35['id']}})[_0xafb8('0x23')](function(){return _0x7be8bf;});})['then'](function(){_0x1741ee['status'](0xcc)[_0xafb8('0x25')]();});}};}function handleEntityNotFound(_0x39e973,_0x24ae22){return function(_0x117f43){if(!_0x117f43){_0x39e973[_0xafb8('0x18')](0x194);}return _0x117f43;};}function handleError(_0x41e676,_0x2de522){_0x2de522=_0x2de522||0x1f4;return function(_0x40a707){logger['error'](_0x40a707[_0xafb8('0x26')]);if(_0x40a707[_0xafb8('0x27')]){delete _0x40a707[_0xafb8('0x27')];}_0x41e676[_0xafb8('0x19')](_0x2de522)[_0xafb8('0x28')](_0x40a707);};}exports[_0xafb8('0x29')]=function(_0x334bbf,_0x35591e){var _0x5c43e5={},_0x3f3f53={},_0x47e819={'count':0x0,'rows':[]};var _0x42d1be=_[_0xafb8('0x2a')](db[_0xafb8('0x2b')][_0xafb8('0x2c')],function(_0x1eb47b){return{'name':_0x1eb47b[_0xafb8('0x2d')],'type':_0x1eb47b[_0xafb8('0x2e')][_0xafb8('0x2f')]};});_0x3f3f53['model']=_[_0xafb8('0x2a')](_0x42d1be,_0xafb8('0x27'));_0x3f3f53[_0xafb8('0x30')]=_[_0xafb8('0x31')](_0x334bbf[_0xafb8('0x30')]);_0x3f3f53[_0xafb8('0x32')]=_[_0xafb8('0x33')](_0x3f3f53[_0xafb8('0x34')],_0x3f3f53[_0xafb8('0x30')]);_0x5c43e5['attributes']=_[_0xafb8('0x33')](_0x3f3f53[_0xafb8('0x34')],qs[_0xafb8('0x35')](_0x334bbf['query'][_0xafb8('0x35')]));_0x5c43e5['attributes']=_0x5c43e5[_0xafb8('0x36')][_0xafb8('0x37')]?_0x5c43e5[_0xafb8('0x36')]:_0x3f3f53[_0xafb8('0x34')];if(!_0x334bbf[_0xafb8('0x30')][_0xafb8('0x38')](_0xafb8('0x39'))){_0x5c43e5['limit']=qs[_0xafb8('0x1d')](_0x334bbf['query'][_0xafb8('0x1d')]);_0x5c43e5[_0xafb8('0x1b')]=qs['offset'](_0x334bbf[_0xafb8('0x30')]['offset']);}_0x5c43e5[_0xafb8('0x3a')]=qs[_0xafb8('0x3b')](_0x334bbf['query']['sort']);_0x5c43e5['where']=qs[_0xafb8('0x32')](_[_0xafb8('0x3c')](_0x334bbf[_0xafb8('0x30')],_0x3f3f53['filters']),_0x42d1be);if(_0x334bbf[_0xafb8('0x30')][_0xafb8('0x3d')]){_0x5c43e5[_0xafb8('0x3e')]=_[_0xafb8('0x3f')](_0x5c43e5[_0xafb8('0x3e')],{'$or':_[_0xafb8('0x2a')](_0x42d1be,function(_0x564a40){if(_0x564a40[_0xafb8('0x2e')]!==_0xafb8('0x40')){var _0x1d3ce3={};_0x1d3ce3[_0x564a40[_0xafb8('0x27')]]={'$like':'%'+_0x334bbf[_0xafb8('0x30')][_0xafb8('0x3d')]+'%'};return _0x1d3ce3;}})});}_0x5c43e5=_['merge']({},_0x5c43e5,_0x334bbf[_0xafb8('0x41')]);var _0x4db9ec={'where':_0x5c43e5[_0xafb8('0x3e')]};return db[_0xafb8('0x2b')]['count'](_0x4db9ec)[_0xafb8('0x23')](function(_0xafcdeb){_0x47e819[_0xafb8('0x1e')]=_0xafcdeb;if(_0x334bbf[_0xafb8('0x30')]['includeAll']){_0x5c43e5[_0xafb8('0x42')]=[{'all':!![]}];}return db[_0xafb8('0x2b')][_0xafb8('0x43')](_0x5c43e5);})[_0xafb8('0x23')](function(_0x1b92f5){_0x47e819[_0xafb8('0x44')]=_0x1b92f5;return _0x47e819;})['then'](respondWithFilteredResult(_0x35591e,_0x5c43e5))[_0xafb8('0x45')](handleError(_0x35591e,null));};exports[_0xafb8('0x46')]=function(_0xa21567,_0x1f0bbc){var _0x17e783={'raw':![],'where':{'id':_0xa21567[_0xafb8('0x47')]['id']}},_0x39f54e={};_0x39f54e[_0xafb8('0x34')]=_['keys'](db[_0xafb8('0x2b')][_0xafb8('0x2c')]);_0x39f54e['query']=_[_0xafb8('0x31')](_0xa21567[_0xafb8('0x30')]);_0x39f54e[_0xafb8('0x32')]=_[_0xafb8('0x33')](_0x39f54e[_0xafb8('0x34')],_0x39f54e['query']);_0x17e783[_0xafb8('0x36')]=_[_0xafb8('0x33')](_0x39f54e['model'],qs[_0xafb8('0x35')](_0xa21567[_0xafb8('0x30')]['fields']));_0x17e783[_0xafb8('0x36')]=_0x17e783[_0xafb8('0x36')][_0xafb8('0x37')]?_0x17e783[_0xafb8('0x36')]:_0x39f54e['model'];if(_0xa21567[_0xafb8('0x30')][_0xafb8('0x48')]){_0x17e783[_0xafb8('0x42')]=[{'all':!![]}];}_0x17e783=_[_0xafb8('0x3f')]({},_0x17e783,_0xa21567[_0xafb8('0x41')]);return db[_0xafb8('0x2b')]['find'](_0x17e783)[_0xafb8('0x23')](handleEntityNotFound(_0x1f0bbc,null))[_0xafb8('0x23')](respondWithResult(_0x1f0bbc,null))[_0xafb8('0x45')](handleError(_0x1f0bbc,null));};exports[_0xafb8('0x49')]=function(_0x47434a,_0x351b38){return db[_0xafb8('0x2b')][_0xafb8('0x49')](_0x47434a[_0xafb8('0x4a')],{})[_0xafb8('0x23')](function(_0x2bb642){var _0x389df4=_0x47434a[_0xafb8('0x4b')]['get']({'plain':!![]});if(!_0x389df4)throw new Error(_0xafb8('0x4c'));if(_0x389df4[_0xafb8('0x4d')]===_0xafb8('0x4b')){var _0x2b9a28=_0x2bb642[_0xafb8('0x4e')]({'plain':!![]});var _0x2603c8=_0xafb8('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x2603c8,'userProfileId':_0x389df4[_0xafb8('0x50')]},'raw':!![]})[_0xafb8('0x23')](function(_0x384510){if(_0x384510&&_0x384510[_0xafb8('0x51')]===0x0){return db[_0xafb8('0x52')][_0xafb8('0x49')]({'name':_0x2b9a28[_0xafb8('0x27')],'resourceId':_0x2b9a28['id'],'type':_0x384510[_0xafb8('0x27')],'sectionId':_0x384510['id']},{})[_0xafb8('0x23')](function(){return _0x2bb642;});}else{return _0x2bb642;}})[_0xafb8('0x45')](function(_0x3ca8f2){logger['error'](_0xafb8('0x53'),_0x3ca8f2);throw _0x3ca8f2;});}return _0x2bb642;})[_0xafb8('0x23')](respondWithResult(_0x351b38,0xc9))[_0xafb8('0x45')](handleError(_0x351b38,null));};exports['clone']=function(_0x3562de,_0x9137ee){var _0x13e6a3={'where':{'id':_0x3562de[_0xafb8('0x47')]['id']}},_0x2b92a8={};_0x2b92a8[_0xafb8('0x34')]=_[_0xafb8('0x31')](db['JscriptyProject'][_0xafb8('0x2c')]);_0x13e6a3[_0xafb8('0x36')]=_[_0xafb8('0x33')](_0x2b92a8[_0xafb8('0x34')],qs[_0xafb8('0x35')](_0x3562de[_0xafb8('0x30')][_0xafb8('0x35')]));_0x13e6a3['attributes']=_0x13e6a3[_0xafb8('0x36')][_0xafb8('0x37')]?_0x13e6a3[_0xafb8('0x36')]:_0x2b92a8[_0xafb8('0x34')];if(_0x3562de[_0xafb8('0x30')][_0xafb8('0x48')]){_0x13e6a3[_0xafb8('0x42')]=[{'all':!![]}];}_0x13e6a3=_['merge']({},_0x13e6a3,_0x3562de['options']);return db['JscriptyProject'][_0xafb8('0x54')](_0x13e6a3)[_0xafb8('0x23')](handleEntityNotFound(_0x9137ee,null))[_0xafb8('0x23')](function(_0xfec0c7){if(_0xfec0c7){var _0x43e537=_0xfec0c7[_0xafb8('0x4e')]({'plain':!![]});_0x43e537=qs['omit'](_0x43e537,['id',_0xafb8('0x55'),'updatedAt']);_0x3562de['body']=_['omit'](_0x3562de[_0xafb8('0x4a')],['id','createdAt','updatedAt']);return db[_0xafb8('0x2b')][_0xafb8('0x49')](_[_0xafb8('0x3f')](_0x43e537,_0x3562de[_0xafb8('0x4a')]),{'include':_0x3562de[_0xafb8('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0xafb8('0x23')](function(_0x2c72f8){var _0x5c390a=_0x3562de[_0xafb8('0x4b')]['get']({'plain':!![]});if(!_0x5c390a)throw new Error(_0xafb8('0x4c'));if(_0x5c390a[_0xafb8('0x4d')]===_0xafb8('0x4b')){var _0x17e7e4=_0x2c72f8[_0xafb8('0x4e')]({'plain':!![]});var _0x1c856c='Projects';return db[_0xafb8('0x56')]['find']({'where':{'name':_0x1c856c,'userProfileId':_0x5c390a[_0xafb8('0x50')]},'raw':!![]})[_0xafb8('0x23')](function(_0xb0eec7){if(_0xb0eec7&&_0xb0eec7[_0xafb8('0x51')]===0x0){return db[_0xafb8('0x52')][_0xafb8('0x49')]({'name':_0x17e7e4['name'],'resourceId':_0x17e7e4['id'],'type':_0xb0eec7[_0xafb8('0x27')],'sectionId':_0xb0eec7['id']},{})[_0xafb8('0x23')](function(){return _0x2c72f8;});}else{return _0x2c72f8;}})[_0xafb8('0x45')](function(_0x241c22){logger['error'](_0xafb8('0x53'),_0x241c22);throw _0x241c22;});}return _0x2c72f8;});}})[_0xafb8('0x23')](respondWithResult(_0x9137ee,0xc9))[_0xafb8('0x45')](handleError(_0x9137ee,null));};exports[_0xafb8('0x22')]=function(_0x21ed97,_0x1a2a10){if(_0x21ed97[_0xafb8('0x4a')]['id']){delete _0x21ed97[_0xafb8('0x4a')]['id'];}return db[_0xafb8('0x2b')][_0xafb8('0x54')]({'where':{'id':_0x21ed97[_0xafb8('0x47')]['id']}})[_0xafb8('0x23')](handleEntityNotFound(_0x1a2a10,null))['then'](saveUpdates(_0x21ed97['body'],null))[_0xafb8('0x23')](respondWithResult(_0x1a2a10,null))[_0xafb8('0x45')](handleError(_0x1a2a10,null));};exports['destroy']=function(_0xcca3f7,_0x55f825){return db['JscriptyProject'][_0xafb8('0x54')]({'where':{'id':_0xcca3f7[_0xafb8('0x47')]['id']}})['then'](handleEntityNotFound(_0x55f825,null))['then'](removeEntity(_0x55f825,null))[_0xafb8('0x45')](handleError(_0x55f825,null));};exports[_0xafb8('0x57')]=function(_0x4a6635,_0x208294,_0x42074e){var _0x1d0291={'raw':!![],'where':{}};var _0x3dd9d4={};var _0x23c2e0={'count':0x0,'rows':[]};return db[_0xafb8('0x2b')][_0xafb8('0x58')]({'where':{'id':_0x4a6635[_0xafb8('0x47')]['id']}})[_0xafb8('0x23')](handleEntityNotFound(_0x208294,null))['then'](function(_0x49515e){if(_0x49515e){_0x3dd9d4[_0xafb8('0x34')]=_[_0xafb8('0x31')](db[_0xafb8('0x59')]['rawAttributes']);_0x3dd9d4['query']=_[_0xafb8('0x31')](_0x4a6635[_0xafb8('0x30')]);_0x3dd9d4[_0xafb8('0x32')]=_['intersection'](_0x3dd9d4[_0xafb8('0x34')],_0x3dd9d4[_0xafb8('0x30')]);_0x1d0291[_0xafb8('0x36')]=_[_0xafb8('0x33')](_0x3dd9d4[_0xafb8('0x34')],qs[_0xafb8('0x35')](_0x4a6635[_0xafb8('0x30')][_0xafb8('0x35')]));_0x1d0291[_0xafb8('0x36')]=_0x1d0291[_0xafb8('0x36')]['length']?_0x1d0291[_0xafb8('0x36')]:_0x3dd9d4[_0xafb8('0x34')];if(!_0x4a6635[_0xafb8('0x30')]['hasOwnProperty'](_0xafb8('0x39'))){_0x1d0291[_0xafb8('0x1d')]=qs[_0xafb8('0x1d')](_0x4a6635[_0xafb8('0x30')][_0xafb8('0x1d')]);_0x1d0291[_0xafb8('0x1b')]=qs[_0xafb8('0x1b')](_0x4a6635['query'][_0xafb8('0x1b')]);}_0x1d0291[_0xafb8('0x3a')]=qs[_0xafb8('0x3b')](_0x4a6635[_0xafb8('0x30')][_0xafb8('0x3b')]);_0x1d0291['where']=qs[_0xafb8('0x32')](_[_0xafb8('0x3c')](_0x4a6635['query'],_0x3dd9d4[_0xafb8('0x32')]));_0x1d0291[_0xafb8('0x3e')]['ProjectId']=_0x49515e['id'];if(_0x4a6635['query'][_0xafb8('0x3d')]){_0x1d0291[_0xafb8('0x3e')]=_[_0xafb8('0x3f')](_0x1d0291['where'],{'$or':_[_0xafb8('0x2a')](_0x1d0291['attributes'],function(_0x3fe7b7){var _0x188c4c={};_0x188c4c[_0x3fe7b7]={'$like':'%'+_0x4a6635[_0xafb8('0x30')][_0xafb8('0x3d')]+'%'};return _0x188c4c;})});}_0x1d0291=_[_0xafb8('0x3f')]({},_0x1d0291,_0x4a6635[_0xafb8('0x41')]);return db[_0xafb8('0x59')][_0xafb8('0x1e')]({'where':_0x1d0291[_0xafb8('0x3e')]})[_0xafb8('0x23')](function(_0x196e49){_0x23c2e0[_0xafb8('0x1e')]=_0x196e49;if(_0x4a6635[_0xafb8('0x30')]['includeAll']){_0x1d0291[_0xafb8('0x42')]=[{'all':!![]}];}return db[_0xafb8('0x59')][_0xafb8('0x43')](_0x1d0291);})[_0xafb8('0x23')](function(_0x20c479){_0x23c2e0[_0xafb8('0x44')]=_0x20c479;return _0x23c2e0;});}})[_0xafb8('0x23')](respondWithFilteredResult(_0x208294,_0x1d0291))[_0xafb8('0x45')](handleError(_0x208294,null));};exports[_0xafb8('0x5a')]=function(_0x11c42e,_0x2c3adc,_0x29a30c){var _0x160d9a={'raw':!![],'where':{}};var _0x28c359={};var _0x18d449={'count':0x0,'rows':[]};return db[_0xafb8('0x2b')][_0xafb8('0x58')]({'where':{'id':_0x11c42e[_0xafb8('0x47')]['id']}})[_0xafb8('0x23')](handleEntityNotFound(_0x2c3adc,null))[_0xafb8('0x23')](function(_0x192550){if(_0x192550){_0x28c359['model']=_[_0xafb8('0x31')](db[_0xafb8('0x5b')][_0xafb8('0x2c')]);_0x28c359[_0xafb8('0x30')]=_['keys'](_0x11c42e['query']);_0x28c359[_0xafb8('0x32')]=_[_0xafb8('0x33')](_0x28c359[_0xafb8('0x34')],_0x28c359[_0xafb8('0x30')]);_0x160d9a[_0xafb8('0x36')]=_[_0xafb8('0x33')](_0x28c359[_0xafb8('0x34')],qs[_0xafb8('0x35')](_0x11c42e[_0xafb8('0x30')][_0xafb8('0x35')]));_0x160d9a[_0xafb8('0x36')]=_0x160d9a['attributes']['length']?_0x160d9a['attributes']:_0x28c359[_0xafb8('0x34')];if(!_0x11c42e[_0xafb8('0x30')][_0xafb8('0x38')](_0xafb8('0x39'))){_0x160d9a['limit']=qs['limit'](_0x11c42e[_0xafb8('0x30')][_0xafb8('0x1d')]);_0x160d9a[_0xafb8('0x1b')]=qs[_0xafb8('0x1b')](_0x11c42e[_0xafb8('0x30')][_0xafb8('0x1b')]);}_0x160d9a[_0xafb8('0x3a')]=qs[_0xafb8('0x3b')](_0x11c42e['query'][_0xafb8('0x3b')]);_0x160d9a[_0xafb8('0x3e')]=qs['filters'](_[_0xafb8('0x3c')](_0x11c42e[_0xafb8('0x30')],_0x28c359['filters']));_0x160d9a[_0xafb8('0x3e')][_0xafb8('0x5c')]=_0x192550['id'];if(_0x11c42e[_0xafb8('0x30')][_0xafb8('0x3d')]){_0x160d9a[_0xafb8('0x3e')]=_['merge'](_0x160d9a['where'],{'$or':_['map'](_0x160d9a['attributes'],function(_0x4aab3a){var _0x2480f0={};_0x2480f0[_0x4aab3a]={'$like':'%'+_0x11c42e[_0xafb8('0x30')][_0xafb8('0x3d')]+'%'};return _0x2480f0;})});}_0x160d9a=_[_0xafb8('0x3f')]({},_0x160d9a,_0x11c42e['options']);return db[_0xafb8('0x5b')][_0xafb8('0x1e')]({'where':_0x160d9a[_0xafb8('0x3e')]})[_0xafb8('0x23')](function(_0x4d6a23){_0x18d449[_0xafb8('0x1e')]=_0x4d6a23;if(_0x11c42e[_0xafb8('0x30')][_0xafb8('0x48')]){_0x160d9a['include']=[{'all':!![]}];}return db[_0xafb8('0x5b')][_0xafb8('0x43')](_0x160d9a);})[_0xafb8('0x23')](function(_0x58bf87){_0x18d449[_0xafb8('0x44')]=_0x58bf87;return _0x18d449;});}})[_0xafb8('0x23')](respondWithFilteredResult(_0x2c3adc,_0x160d9a))[_0xafb8('0x45')](handleError(_0x2c3adc,null));};function char(_0x34d2c0){return'number'===typeof _0x34d2c0?String['fromCharCode'][_0xafb8('0x21')](null,arguments):_0x34d2c0;}function needsEncapsulation(_0xfcfe04){return!!_0xfcfe04&&(_0xfcfe04[_0xafb8('0x5d')]()[_0xafb8('0x5e')](char(0xd))>=0x0||_0xfcfe04['toString']()[_0xafb8('0x5e')](char(0xa))>=0x0||_0xfcfe04[_0xafb8('0x5d')]()[_0xafb8('0x5e')](char(0x2c))>=0x0||_0xfcfe04[_0xafb8('0x5d')]()[_0xafb8('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x452606){var _0x4e1c70=char(0x22),_0x21d4c3='\x5c'+char(0x22),_0x406270=_0x452606[_0xafb8('0x5d')]()['replace'](new RegExp(_0x4e1c70,'g'),_0x21d4c3);return _0x4e1c70+_0x406270+_0x4e1c70;}exports[_0xafb8('0x5f')]=function(_0x4c5124,_0x496bff,_0x20ab4b){var _0x353d65,_0x577305;var _0x2b6b7f={'where':{'ProjectId':_0x4c5124['params']['id']}};if(_0x4c5124[_0xafb8('0x30')]['startTime']){_0x2b6b7f[_0xafb8('0x3e')][_0xafb8('0x60')]=JSON[_0xafb8('0x61')](_0x4c5124[_0xafb8('0x30')][_0xafb8('0x62')]);}return db['JscriptySessionReport'][_0xafb8('0x43')](_0x2b6b7f)[_0xafb8('0x23')](handleEntityNotFound(_0x496bff,null))['then'](function(_0x3a4d53){if(_0x3a4d53){_0x353d65=_0x3a4d53;return db[_0xafb8('0x63')][_0xafb8('0x43')]({'where':{'SessionId':{'$in':_[_0xafb8('0x2a')](_0x353d65,'id')},'ProjectId':_0x4c5124[_0xafb8('0x47')]['id']},'order':_0xafb8('0x64')});}})[_0xafb8('0x23')](handleEntityNotFound(_0x496bff,null))[_0xafb8('0x23')](function(_0xb82bb4){if(_0xb82bb4){_0x577305=_0xb82bb4;var _0x7758df={};for(var _0x1bacb8=0x0,_0x1c8c7b=_0x577305['length'];_0x1bacb8<_0x1c8c7b;_0x1bacb8++){if(!_0x7758df['hasOwnProperty'](_0x577305[_0x1bacb8][_0xafb8('0x65')])){_0x7758df[_0x577305[_0x1bacb8][_0xafb8('0x65')]]=needsEncapsulation(_0x577305[_0x1bacb8]['question'])?encapsulate(_0x577305[_0x1bacb8][_0xafb8('0x66')]):_0x577305[_0x1bacb8]['question'];}}var _0x1031b9=[],_0x5a6b0d={};for(var _0x3d42c3=0x0,_0x58ab09=_0x353d65[_0xafb8('0x37')];_0x3d42c3<_0x58ab09;_0x3d42c3++){_0x5a6b0d={'ProjectId':_0x4c5124[_0xafb8('0x47')]['id'],'SessionId':_0x353d65[_0x3d42c3]['id'],'StartTime':moment(_0x353d65[_0x3d42c3][_0xafb8('0x60')])[_0xafb8('0x67')](_0xafb8('0x68'))};for(var _0x3a176d=0x0,_0x1df57e=_0x577305[_0xafb8('0x37')];_0x3a176d<_0x1df57e;_0x3a176d++){if(_0x577305[_0x3a176d][_0xafb8('0x69')]==_0x353d65[_0x3d42c3]['id']&&_0x7758df['hasOwnProperty'](_0x577305[_0x3a176d][_0xafb8('0x65')])){_0x5a6b0d[_0x7758df[_0x577305[_0x3a176d]['questionId']]]=_0x577305[_0x3a176d]['answer'];}}for(var _0x9137fb in _0x7758df){if(!_0x5a6b0d[_0xafb8('0x38')](_0x7758df[_0x9137fb])){_0x5a6b0d[_0x7758df[_0x9137fb]]=null;}}_0x1031b9[_0xafb8('0x6a')](_0x5a6b0d);}return _0x1031b9;}})[_0xafb8('0x23')](function(_0x13aabf){if(!_[_0xafb8('0x6b')](_0x13aabf)){var _0x278b41=toCsv(_0x13aabf);var _0x3e322f=Date[_0xafb8('0x6c')]();fs[_0xafb8('0x6d')](util[_0xafb8('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4c5124[_0xafb8('0x47')]['id'],_0x3e322f),_0x278b41);_0x496bff[_0xafb8('0x6e')](_0xafb8('0x6f'),_0xafb8('0x70')+util['format'](_0xafb8('0x71'),_0x4c5124[_0xafb8('0x47')]['id'],_0x3e322f));_0x496bff['setHeader'](_0xafb8('0x72'),_0xafb8('0x73'));return _0x496bff[_0xafb8('0x74')](util['format'](_0xafb8('0x75'),_0x4c5124[_0xafb8('0x47')]['id'],_0x3e322f));}else{return _0x496bff[_0xafb8('0x18')](0xcc);}})[_0xafb8('0x45')](handleError(_0x496bff,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index de37f60..f3760f5 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 _0x1670=['lodash','util','api','bluebird','request-promise','path','rimraf','exports','define','JscriptyProject','jscripty_projects'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x1670,0x9a));var _0x0167=function(_0x48398f,_0x5a697b){_0x48398f=_0x48398f-0x0;var _0x1d6f0a=_0x1670[_0x48398f];return _0x1d6f0a;};'use strict';var _=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var logger=require('../../config/logger')(_0x0167('0x2'));var moment=require('moment');var BPromise=require(_0x0167('0x3'));var rp=require(_0x0167('0x4'));var fs=require('fs');var path=require(_0x0167('0x5'));var rimraf=require(_0x0167('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x0167('0x7')]=function(_0x1ae650,_0x295e51){return _0x1ae650[_0x0167('0x8')](_0x0167('0x9'),attributes,{'tableName':_0x0167('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9f=['util','../../config/logger','bluebird','path','JscriptyProject'];(function(_0x4c18fa,_0x1c7211){var _0xa6bad2=function(_0x5254ad){while(--_0x5254ad){_0x4c18fa['push'](_0x4c18fa['shift']());}};_0xa6bad2(++_0x1c7211);}(_0x0a9f,0x64));var _0xf0a9=function(_0x5f1de4,_0x47c201){_0x5f1de4=_0x5f1de4-0x0;var _0x1aeaf0=_0x0a9f[_0x5f1de4];return _0x1aeaf0;};'use strict';var _=require('lodash');var util=require(_0xf0a9('0x0'));var logger=require(_0xf0a9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf0a9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0a9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x5343c2,_0x2502a2){return _0x5343c2['define'](_0xf0a9('0x4'),attributes,{'tableName':'jscripty_projects','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 10a3c84..db7277e 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xac4a,0x13f));var _0xaac4=function(_0x51e4f3,_0x55b33a){_0x51e4f3=_0x51e4f3-0x0;var _0x1a446c=_0xac4a[_0x51e4f3];return _0x1a446c;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0xda3f,0xec));var _0xfda3=function(_0x50c6b5,_0xb168cb){_0x50c6b5=_0x50c6b5-0x0;var _0x23f637=_0xda3f[_0x50c6b5];return _0x23f637;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index bc11a92..210ea14 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 _0xa91e=['get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xa91e,0x1ea));var _0xea91=function(_0xf777af,_0x4f40e9){_0xf777af=_0xf777af-0x0;var _0x4d2f70=_0xa91e[_0xf777af];return _0x4d2f70;};'use strict';var multer=require(_0xea91('0x0'));var util=require(_0xea91('0x1'));var path=require('path');var timeout=require(_0xea91('0x2'));var express=require(_0xea91('0x3'));var router=express[_0xea91('0x4')]();var fs_extra=require(_0xea91('0x5'));var auth=require(_0xea91('0x6'));var interaction=require(_0xea91('0x7'));var config=require(_0xea91('0x8'));var controller=require(_0xea91('0x9'));router[_0xea91('0xa')]('/',auth['isAuthenticated'](),controller[_0xea91('0xb')]);router[_0xea91('0xa')](_0xea91('0xc'),auth[_0xea91('0xd')](),controller[_0xea91('0xe')]);router[_0xea91('0xa')](_0xea91('0xf'),auth[_0xea91('0xd')](),controller['show']);router[_0xea91('0x10')]('/',auth['isAuthenticated'](),controller[_0xea91('0x11')]);router[_0xea91('0x12')](_0xea91('0xf'),auth['isAuthenticated'](),controller[_0xea91('0x13')]);router['delete'](_0xea91('0xf'),auth[_0xea91('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf7f0=['isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x381899,_0x1a0bc8){var _0xc50f6=function(_0x4c6f7a){while(--_0x4c6f7a){_0x381899['push'](_0x381899['shift']());}};_0xc50f6(++_0x1a0bc8);}(_0xf7f0,0x1d4));var _0x0f7f=function(_0x486567,_0x453216){_0x486567=_0x486567-0x0;var _0x422284=_0xf7f0[_0x486567];return _0x422284;};'use strict';var multer=require(_0x0f7f('0x0'));var util=require(_0x0f7f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0f7f('0x2'));var router=express['Router']();var fs_extra=require(_0x0f7f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0f7f('0x4'));var config=require(_0x0f7f('0x5'));var controller=require(_0x0f7f('0x6'));router['get']('/',auth[_0x0f7f('0x7')](),controller['index']);router[_0x0f7f('0x8')](_0x0f7f('0x9'),auth['isAuthenticated'](),controller[_0x0f7f('0xa')]);router[_0x0f7f('0x8')](_0x0f7f('0xb'),auth[_0x0f7f('0x7')](),controller[_0x0f7f('0xc')]);router[_0x0f7f('0xd')]('/',auth[_0x0f7f('0x7')](),controller[_0x0f7f('0xe')]);router[_0x0f7f('0xf')]('/:id',auth[_0x0f7f('0x7')](),controller[_0x0f7f('0x10')]);router['delete'](_0x0f7f('0xb'),auth[_0x0f7f('0x7')](),controller[_0x0f7f('0x11')]);module[_0x0f7f('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b6e7ba2..049ecfc 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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x86cb44,_0x258106){_0x86cb44=_0x86cb44-0x0;var _0x202fdd=_0x7a54[_0x86cb44];return _0x202fdd;};'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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0x1b9f74,_0x5613d1){_0x1b9f74=_0x1b9f74-0x0;var _0x14b23f=_0x7a54[_0x1b9f74];return _0x14b23f;};'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 9eabc77..825a210 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 _0x1f84=['fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','JscriptyQuestionReport','includeAll','include','catch','params','keys','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes'];(function(_0x373dd6,_0x28a9e4){var _0x229d2f=function(_0x39c16e){while(--_0x39c16e){_0x373dd6['push'](_0x373dd6['shift']());}};_0x229d2f(++_0x28a9e4);}(_0x1f84,0xaa));var _0x41f8=function(_0x3711e2,_0x1468e1){_0x3711e2=_0x3711e2-0x0;var _0x18a556=_0x1f84[_0x3711e2];return _0x18a556;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41f8('0x1'));var rp=require(_0x41f8('0x2'));var moment=require(_0x41f8('0x3'));var BPromise=require(_0x41f8('0x4'));var Mustache=require(_0x41f8('0x5'));var util=require(_0x41f8('0x6'));var path=require(_0x41f8('0x7'));var sox=require('sox');var csv=require(_0x41f8('0x8'));var ejs=require(_0x41f8('0x9'));var fs=require('fs');var fs_extra=require(_0x41f8('0xa'));var _=require(_0x41f8('0xb'));var squel=require(_0x41f8('0xc'));var crypto=require(_0x41f8('0xd'));var jsforce=require(_0x41f8('0xe'));var deskjs=require(_0x41f8('0xf'));var toCsv=require(_0x41f8('0x8'));var querystring=require('querystring');var Papa=require(_0x41f8('0x10'));var Redis=require(_0x41f8('0x11'));var authService=require(_0x41f8('0x12'));var qs=require(_0x41f8('0x13'));var as=require(_0x41f8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41f8('0x15'))('api');var utils=require(_0x41f8('0x16'));var config=require(_0x41f8('0x17'));var licenseUtil=require(_0x41f8('0x18'));var db=require(_0x41f8('0x19'))['db'];function respondWithStatusCode(_0x4cae58,_0x3d9f15){_0x3d9f15=_0x3d9f15||0xcc;return function(_0x16e823){if(_0x16e823){return _0x4cae58[_0x41f8('0x1a')](_0x3d9f15);}return _0x4cae58[_0x41f8('0x1b')](_0x3d9f15)['end']();};}function respondWithResult(_0x21afaf,_0x49828e){_0x49828e=_0x49828e||0xc8;return function(_0x5072a9){if(_0x5072a9){return _0x21afaf[_0x41f8('0x1b')](_0x49828e)[_0x41f8('0x1c')](_0x5072a9);}};}function respondWithFilteredResult(_0x351903,_0x3c6de6){return function(_0x47e126){if(_0x47e126){var _0xf0b4c0=typeof _0x3c6de6[_0x41f8('0x1d')]==='undefined'&&typeof _0x3c6de6[_0x41f8('0x1e')]===_0x41f8('0x1f');var _0x3f0774=_0x47e126[_0x41f8('0x20')];var _0x500450=_0xf0b4c0?0x0:_0x3c6de6['offset'];var _0x23dd6e=_0xf0b4c0?_0x47e126[_0x41f8('0x20')]:_0x3c6de6[_0x41f8('0x1d')]+_0x3c6de6[_0x41f8('0x1e')];var _0x16981d;if(_0x23dd6e>=_0x3f0774){_0x23dd6e=_0x3f0774;_0x16981d=0xc8;}else{_0x16981d=0xce;}_0x351903[_0x41f8('0x1b')](_0x16981d);return _0x351903[_0x41f8('0x21')]('Content-Range',_0x500450+'-'+_0x23dd6e+'/'+_0x3f0774)['json'](_0x47e126);}return null;};}function patchUpdates(_0x52139e){return function(_0x38227b){try{jsonpatch['apply'](_0x38227b,_0x52139e,!![]);}catch(_0x2a1c6b){return BPromise[_0x41f8('0x22')](_0x2a1c6b);}return _0x38227b[_0x41f8('0x23')]();};}function saveUpdates(_0x400224,_0x529adf){return function(_0x493d84){if(_0x493d84){return _0x493d84[_0x41f8('0x24')](_0x400224)[_0x41f8('0x25')](function(_0x5b5968){return _0x5b5968;});}return null;};}function removeEntity(_0x492be3,_0x273dd9){return function(_0x1a7c96){if(_0x1a7c96){return _0x1a7c96[_0x41f8('0x26')]()['then'](function(){_0x492be3[_0x41f8('0x1b')](0xcc)[_0x41f8('0x27')]();});}};}function handleEntityNotFound(_0x57c90e,_0x37761f){return function(_0x1b60b0){if(!_0x1b60b0){_0x57c90e['sendStatus'](0x194);}return _0x1b60b0;};}function handleError(_0x41343d,_0x58edba){_0x58edba=_0x58edba||0x1f4;return function(_0x5dc0c2){logger['error'](_0x5dc0c2[_0x41f8('0x28')]);if(_0x5dc0c2[_0x41f8('0x29')]){delete _0x5dc0c2[_0x41f8('0x29')];}_0x41343d['status'](_0x58edba)[_0x41f8('0x2a')](_0x5dc0c2);};}exports[_0x41f8('0x2b')]=function(_0x5de5f6,_0x5dfbf4){var _0x1a8afb={},_0x5156dd={},_0x505557={'count':0x0,'rows':[]};var _0x1dfb37=_[_0x41f8('0x2c')](db['JscriptyQuestionReport'][_0x41f8('0x2d')],function(_0x37dd3f){return{'name':_0x37dd3f[_0x41f8('0x2e')],'type':_0x37dd3f['type']['key']};});_0x5156dd[_0x41f8('0x2f')]=_[_0x41f8('0x2c')](_0x1dfb37,_0x41f8('0x29'));_0x5156dd[_0x41f8('0x30')]=_['keys'](_0x5de5f6[_0x41f8('0x30')]);_0x5156dd[_0x41f8('0x31')]=_[_0x41f8('0x32')](_0x5156dd[_0x41f8('0x2f')],_0x5156dd[_0x41f8('0x30')]);_0x1a8afb[_0x41f8('0x33')]=_['intersection'](_0x5156dd[_0x41f8('0x2f')],qs[_0x41f8('0x34')](_0x5de5f6[_0x41f8('0x30')][_0x41f8('0x34')]));_0x1a8afb[_0x41f8('0x33')]=_0x1a8afb[_0x41f8('0x33')][_0x41f8('0x35')]?_0x1a8afb[_0x41f8('0x33')]:_0x5156dd['model'];if(!_0x5de5f6[_0x41f8('0x30')][_0x41f8('0x36')]('nolimit')){_0x1a8afb[_0x41f8('0x1e')]=qs[_0x41f8('0x1e')](_0x5de5f6[_0x41f8('0x30')]['limit']);_0x1a8afb[_0x41f8('0x1d')]=qs[_0x41f8('0x1d')](_0x5de5f6[_0x41f8('0x30')][_0x41f8('0x1d')]);}_0x1a8afb[_0x41f8('0x37')]=qs[_0x41f8('0x38')](_0x5de5f6[_0x41f8('0x30')][_0x41f8('0x38')]);_0x1a8afb[_0x41f8('0x39')]=qs[_0x41f8('0x31')](_['pick'](_0x5de5f6[_0x41f8('0x30')],_0x5156dd[_0x41f8('0x31')]),_0x1dfb37);if(_0x5de5f6[_0x41f8('0x30')][_0x41f8('0x3a')]){_0x1a8afb[_0x41f8('0x39')]=_[_0x41f8('0x3b')](_0x1a8afb['where'],{'$or':_[_0x41f8('0x2c')](_0x1dfb37,function(_0x4b8d0a){if(_0x4b8d0a[_0x41f8('0x3c')]!=='VIRTUAL'){var _0x14bd30={};_0x14bd30[_0x4b8d0a['name']]={'$like':'%'+_0x5de5f6['query'][_0x41f8('0x3a')]+'%'};return _0x14bd30;}})});}_0x1a8afb=_['merge']({},_0x1a8afb,_0x5de5f6['options']);var _0x286562={'where':_0x1a8afb[_0x41f8('0x39')]};return db[_0x41f8('0x3d')][_0x41f8('0x20')](_0x286562)[_0x41f8('0x25')](function(_0xc8b82a){_0x505557['count']=_0xc8b82a;if(_0x5de5f6[_0x41f8('0x30')][_0x41f8('0x3e')]){_0x1a8afb[_0x41f8('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x1a8afb);})['then'](function(_0x315fb8){_0x505557['rows']=_0x315fb8;return _0x505557;})[_0x41f8('0x25')](respondWithFilteredResult(_0x5dfbf4,_0x1a8afb))[_0x41f8('0x40')](handleError(_0x5dfbf4,null));};exports['show']=function(_0x5184ea,_0x533166){var _0x493c73={'raw':!![],'where':{'id':_0x5184ea[_0x41f8('0x41')]['id']}},_0x55bed0={};_0x55bed0[_0x41f8('0x2f')]=_[_0x41f8('0x42')](db['JscriptyQuestionReport']['rawAttributes']);_0x55bed0[_0x41f8('0x30')]=_[_0x41f8('0x42')](_0x5184ea[_0x41f8('0x30')]);_0x55bed0[_0x41f8('0x31')]=_['intersection'](_0x55bed0['model'],_0x55bed0[_0x41f8('0x30')]);_0x493c73[_0x41f8('0x33')]=_[_0x41f8('0x32')](_0x55bed0[_0x41f8('0x2f')],qs[_0x41f8('0x34')](_0x5184ea[_0x41f8('0x30')][_0x41f8('0x34')]));_0x493c73[_0x41f8('0x33')]=_0x493c73[_0x41f8('0x33')][_0x41f8('0x35')]?_0x493c73['attributes']:_0x55bed0['model'];if(_0x5184ea[_0x41f8('0x30')][_0x41f8('0x3e')]){_0x493c73[_0x41f8('0x3f')]=[{'all':!![]}];}_0x493c73=_[_0x41f8('0x3b')]({},_0x493c73,_0x5184ea[_0x41f8('0x43')]);return db[_0x41f8('0x3d')][_0x41f8('0x44')](_0x493c73)['then'](handleEntityNotFound(_0x533166,null))[_0x41f8('0x25')](respondWithResult(_0x533166,null))[_0x41f8('0x40')](handleError(_0x533166,null));};exports[_0x41f8('0x45')]=function(_0x582339,_0x2de17c){return db['JscriptyQuestionReport'][_0x41f8('0x45')](_0x582339['body'],{})[_0x41f8('0x25')](respondWithResult(_0x2de17c,0xc9))['catch'](handleError(_0x2de17c,null));};exports[_0x41f8('0x24')]=function(_0x49f043,_0x4571dd){if(_0x49f043[_0x41f8('0x46')]['id']){delete _0x49f043[_0x41f8('0x46')]['id'];}return db[_0x41f8('0x3d')]['find']({'where':{'id':_0x49f043[_0x41f8('0x41')]['id']}})['then'](handleEntityNotFound(_0x4571dd,null))[_0x41f8('0x25')](saveUpdates(_0x49f043[_0x41f8('0x46')],null))[_0x41f8('0x25')](respondWithResult(_0x4571dd,null))[_0x41f8('0x40')](handleError(_0x4571dd,null));};exports[_0x41f8('0x26')]=function(_0x39bcc0,_0x1dc829){return db[_0x41f8('0x3d')]['find']({'where':{'id':_0x39bcc0[_0x41f8('0x41')]['id']}})[_0x41f8('0x25')](handleEntityNotFound(_0x1dc829,null))[_0x41f8('0x25')](removeEntity(_0x1dc829,null))[_0x41f8('0x40')](handleError(_0x1dc829,null));};exports['describe']=function(_0x4be4ef,_0x3404b1){return db[_0x41f8('0x3d')][_0x41f8('0x47')]()[_0x41f8('0x25')](respondWithResult(_0x3404b1,null))[_0x41f8('0x40')](handleError(_0x3404b1,null));}; \ No newline at end of file +var _0xf74d=['undefined','limit','count','offset','set','save','then','destroy','error','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x5cbb1a,_0x3b1d15){var _0x529ea6=function(_0x1589c5){while(--_0x1589c5){_0x5cbb1a['push'](_0x5cbb1a['shift']());}};_0x529ea6(++_0x3b1d15);}(_0xf74d,0x10a));var _0xdf74=function(_0x3259f9,_0x3dcf7c){_0x3259f9=_0x3259f9-0x0;var _0x2c2c2a=_0xf74d[_0x3259f9];return _0x2c2c2a;};'use strict';var emlformat=require(_0xdf74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf74('0x1'));var jsonpatch=require(_0xdf74('0x2'));var rp=require(_0xdf74('0x3'));var moment=require(_0xdf74('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdf74('0x5'));var sox=require(_0xdf74('0x6'));var csv=require(_0xdf74('0x7'));var ejs=require(_0xdf74('0x8'));var fs=require('fs');var fs_extra=require(_0xdf74('0x9'));var _=require(_0xdf74('0xa'));var squel=require(_0xdf74('0xb'));var crypto=require(_0xdf74('0xc'));var jsforce=require(_0xdf74('0xd'));var deskjs=require(_0xdf74('0xe'));var toCsv=require(_0xdf74('0x7'));var querystring=require(_0xdf74('0xf'));var Papa=require(_0xdf74('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdf74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf74('0x12'));var utils=require(_0xdf74('0x13'));var config=require(_0xdf74('0x14'));var licenseUtil=require(_0xdf74('0x15'));var db=require(_0xdf74('0x16'))['db'];function respondWithStatusCode(_0x1227a2,_0x5fc49c){_0x5fc49c=_0x5fc49c||0xcc;return function(_0x5bbf8f){if(_0x5bbf8f){return _0x1227a2[_0xdf74('0x17')](_0x5fc49c);}return _0x1227a2['status'](_0x5fc49c)['end']();};}function respondWithResult(_0x1b3090,_0x10384d){_0x10384d=_0x10384d||0xc8;return function(_0x4e08eb){if(_0x4e08eb){return _0x1b3090[_0xdf74('0x18')](_0x10384d)[_0xdf74('0x19')](_0x4e08eb);}};}function respondWithFilteredResult(_0xe67725,_0x285783){return function(_0x5681e1){if(_0x5681e1){var _0x4b3e1c=typeof _0x285783['offset']===_0xdf74('0x1a')&&typeof _0x285783[_0xdf74('0x1b')]===_0xdf74('0x1a');var _0x43a150=_0x5681e1[_0xdf74('0x1c')];var _0x14a290=_0x4b3e1c?0x0:_0x285783[_0xdf74('0x1d')];var _0x233230=_0x4b3e1c?_0x5681e1[_0xdf74('0x1c')]:_0x285783['offset']+_0x285783[_0xdf74('0x1b')];var _0x4554dd;if(_0x233230>=_0x43a150){_0x233230=_0x43a150;_0x4554dd=0xc8;}else{_0x4554dd=0xce;}_0xe67725[_0xdf74('0x18')](_0x4554dd);return _0xe67725[_0xdf74('0x1e')]('Content-Range',_0x14a290+'-'+_0x233230+'/'+_0x43a150)[_0xdf74('0x19')](_0x5681e1);}return null;};}function patchUpdates(_0x9777f5){return function(_0x2341e2){try{jsonpatch['apply'](_0x2341e2,_0x9777f5,!![]);}catch(_0xb43b5){return BPromise['reject'](_0xb43b5);}return _0x2341e2[_0xdf74('0x1f')]();};}function saveUpdates(_0x2b922c,_0x2392b9){return function(_0x5af182){if(_0x5af182){return _0x5af182['update'](_0x2b922c)[_0xdf74('0x20')](function(_0x3d4c03){return _0x3d4c03;});}return null;};}function removeEntity(_0x34d440,_0x1a9cb2){return function(_0x3d2a45){if(_0x3d2a45){return _0x3d2a45[_0xdf74('0x21')]()[_0xdf74('0x20')](function(){_0x34d440[_0xdf74('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3fa0,_0xea49f){return function(_0x40c5b6){if(!_0x40c5b6){_0x3f3fa0[_0xdf74('0x17')](0x194);}return _0x40c5b6;};}function handleError(_0x1a4a06,_0x4acbbc){_0x4acbbc=_0x4acbbc||0x1f4;return function(_0x5ab188){logger[_0xdf74('0x22')](_0x5ab188['stack']);if(_0x5ab188[_0xdf74('0x23')]){delete _0x5ab188[_0xdf74('0x23')];}_0x1a4a06[_0xdf74('0x18')](_0x4acbbc)[_0xdf74('0x24')](_0x5ab188);};}exports[_0xdf74('0x25')]=function(_0x3b9cfa,_0x3bd7f4){var _0x7aae3a={},_0x20fa2b={},_0x12588e={'count':0x0,'rows':[]};var _0x14ea90=_['map'](db[_0xdf74('0x26')][_0xdf74('0x27')],function(_0x457bcd){return{'name':_0x457bcd[_0xdf74('0x28')],'type':_0x457bcd[_0xdf74('0x29')][_0xdf74('0x2a')]};});_0x20fa2b[_0xdf74('0x2b')]=_[_0xdf74('0x2c')](_0x14ea90,_0xdf74('0x23'));_0x20fa2b[_0xdf74('0x2d')]=_[_0xdf74('0x2e')](_0x3b9cfa[_0xdf74('0x2d')]);_0x20fa2b['filters']=_[_0xdf74('0x2f')](_0x20fa2b[_0xdf74('0x2b')],_0x20fa2b[_0xdf74('0x2d')]);_0x7aae3a[_0xdf74('0x30')]=_[_0xdf74('0x2f')](_0x20fa2b[_0xdf74('0x2b')],qs[_0xdf74('0x31')](_0x3b9cfa[_0xdf74('0x2d')][_0xdf74('0x31')]));_0x7aae3a[_0xdf74('0x30')]=_0x7aae3a['attributes'][_0xdf74('0x32')]?_0x7aae3a[_0xdf74('0x30')]:_0x20fa2b[_0xdf74('0x2b')];if(!_0x3b9cfa[_0xdf74('0x2d')][_0xdf74('0x33')](_0xdf74('0x34'))){_0x7aae3a[_0xdf74('0x1b')]=qs[_0xdf74('0x1b')](_0x3b9cfa[_0xdf74('0x2d')][_0xdf74('0x1b')]);_0x7aae3a['offset']=qs[_0xdf74('0x1d')](_0x3b9cfa[_0xdf74('0x2d')][_0xdf74('0x1d')]);}_0x7aae3a[_0xdf74('0x35')]=qs[_0xdf74('0x36')](_0x3b9cfa[_0xdf74('0x2d')]['sort']);_0x7aae3a[_0xdf74('0x37')]=qs[_0xdf74('0x38')](_[_0xdf74('0x39')](_0x3b9cfa['query'],_0x20fa2b[_0xdf74('0x38')]),_0x14ea90);if(_0x3b9cfa['query'][_0xdf74('0x3a')]){_0x7aae3a['where']=_[_0xdf74('0x3b')](_0x7aae3a[_0xdf74('0x37')],{'$or':_[_0xdf74('0x2c')](_0x14ea90,function(_0x5a0d70){if(_0x5a0d70['type']!==_0xdf74('0x3c')){var _0x3d7537={};_0x3d7537[_0x5a0d70[_0xdf74('0x23')]]={'$like':'%'+_0x3b9cfa[_0xdf74('0x2d')]['filter']+'%'};return _0x3d7537;}})});}_0x7aae3a=_[_0xdf74('0x3b')]({},_0x7aae3a,_0x3b9cfa[_0xdf74('0x3d')]);var _0x3df7ab={'where':_0x7aae3a[_0xdf74('0x37')]};return db[_0xdf74('0x26')][_0xdf74('0x1c')](_0x3df7ab)[_0xdf74('0x20')](function(_0xcc7bd3){_0x12588e[_0xdf74('0x1c')]=_0xcc7bd3;if(_0x3b9cfa[_0xdf74('0x2d')][_0xdf74('0x3e')]){_0x7aae3a[_0xdf74('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x7aae3a);})[_0xdf74('0x20')](function(_0x3f1975){_0x12588e[_0xdf74('0x40')]=_0x3f1975;return _0x12588e;})[_0xdf74('0x20')](respondWithFilteredResult(_0x3bd7f4,_0x7aae3a))[_0xdf74('0x41')](handleError(_0x3bd7f4,null));};exports[_0xdf74('0x42')]=function(_0x19bc97,_0x31d81b){var _0x25c04c={'raw':!![],'where':{'id':_0x19bc97[_0xdf74('0x43')]['id']}},_0x1ed8e6={};_0x1ed8e6['model']=_['keys'](db[_0xdf74('0x26')][_0xdf74('0x27')]);_0x1ed8e6['query']=_[_0xdf74('0x2e')](_0x19bc97[_0xdf74('0x2d')]);_0x1ed8e6['filters']=_[_0xdf74('0x2f')](_0x1ed8e6[_0xdf74('0x2b')],_0x1ed8e6['query']);_0x25c04c[_0xdf74('0x30')]=_[_0xdf74('0x2f')](_0x1ed8e6[_0xdf74('0x2b')],qs[_0xdf74('0x31')](_0x19bc97[_0xdf74('0x2d')][_0xdf74('0x31')]));_0x25c04c[_0xdf74('0x30')]=_0x25c04c[_0xdf74('0x30')][_0xdf74('0x32')]?_0x25c04c[_0xdf74('0x30')]:_0x1ed8e6[_0xdf74('0x2b')];if(_0x19bc97[_0xdf74('0x2d')][_0xdf74('0x3e')]){_0x25c04c[_0xdf74('0x3f')]=[{'all':!![]}];}_0x25c04c=_[_0xdf74('0x3b')]({},_0x25c04c,_0x19bc97['options']);return db['JscriptyQuestionReport'][_0xdf74('0x44')](_0x25c04c)[_0xdf74('0x20')](handleEntityNotFound(_0x31d81b,null))['then'](respondWithResult(_0x31d81b,null))[_0xdf74('0x41')](handleError(_0x31d81b,null));};exports['create']=function(_0x115ce1,_0x391ff8){return db['JscriptyQuestionReport'][_0xdf74('0x45')](_0x115ce1[_0xdf74('0x46')],{})['then'](respondWithResult(_0x391ff8,0xc9))[_0xdf74('0x41')](handleError(_0x391ff8,null));};exports[_0xdf74('0x47')]=function(_0x3ea603,_0x125a95){if(_0x3ea603[_0xdf74('0x46')]['id']){delete _0x3ea603[_0xdf74('0x46')]['id'];}return db[_0xdf74('0x26')][_0xdf74('0x44')]({'where':{'id':_0x3ea603['params']['id']}})[_0xdf74('0x20')](handleEntityNotFound(_0x125a95,null))[_0xdf74('0x20')](saveUpdates(_0x3ea603['body'],null))[_0xdf74('0x20')](respondWithResult(_0x125a95,null))[_0xdf74('0x41')](handleError(_0x125a95,null));};exports['destroy']=function(_0x4e8af6,_0x12237a){return db[_0xdf74('0x26')][_0xdf74('0x44')]({'where':{'id':_0x4e8af6[_0xdf74('0x43')]['id']}})['then'](handleEntityNotFound(_0x12237a,null))[_0xdf74('0x20')](removeEntity(_0x12237a,null))[_0xdf74('0x41')](handleError(_0x12237a,null));};exports[_0xdf74('0x48')]=function(_0x2d6ecd,_0xe3dc36){return db['JscriptyQuestionReport']['describe']()[_0xdf74('0x20')](respondWithResult(_0xe3dc36,null))['catch'](handleError(_0xe3dc36,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3365932..9810429 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 _0x79d8=['report_jscripty_questions','util','../../config/logger','bluebird','path','../../config/environment','exports','define'];(function(_0x38e0bf,_0x5b6f95){var _0x2bd58e=function(_0x2fa5b8){while(--_0x2fa5b8){_0x38e0bf['push'](_0x38e0bf['shift']());}};_0x2bd58e(++_0x5b6f95);}(_0x79d8,0x151));var _0x879d=function(_0x140128,_0x21a536){_0x140128=_0x140128-0x0;var _0x655d02=_0x79d8[_0x140128];return _0x655d02;};'use strict';var _=require('lodash');var util=require(_0x879d('0x0'));var logger=require(_0x879d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x879d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x879d('0x3'));var rimraf=require('rimraf');var config=require(_0x879d('0x4'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x879d('0x5')]=function(_0x26915e,_0x533953){return _0x26915e[_0x879d('0x6')]('JscriptyQuestionReport',attributes,{'tableName':_0x879d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x744d=['../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x4f36ca,_0x3b40dc){var _0x5383fb=function(_0x43687d){while(--_0x43687d){_0x4f36ca['push'](_0x4f36ca['shift']());}};_0x5383fb(++_0x3b40dc);}(_0x744d,0x14e));var _0xd744=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x744d[_0x1bf809];return _0x1caa4e;};'use strict';var _=require(_0xd744('0x0'));var util=require(_0xd744('0x1'));var logger=require(_0xd744('0x2'))(_0xd744('0x3'));var moment=require(_0xd744('0x4'));var BPromise=require('bluebird');var rp=require(_0xd744('0x5'));var fs=require('fs');var path=require(_0xd744('0x6'));var rimraf=require(_0xd744('0x7'));var config=require('../../config/environment');var attributes=require(_0xd744('0x8'));module[_0xd744('0x9')]=function(_0x36a764,_0x18e740){return _0x36a764['define'](_0xd744('0xa'),attributes,{'tableName':_0xd744('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 a9a2f35..3628a93 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 _0x74d1=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x1b0061,_0x263d7c){var _0x5a1383=function(_0x35dddc){while(--_0x35dddc){_0x1b0061['push'](_0x1b0061['shift']());}};_0x5a1383(++_0x263d7c);}(_0x74d1,0x14a));var _0x174d=function(_0x2ff273,_0x4f77de){_0x2ff273=_0x2ff273-0x0;var _0x1b7126=_0x74d1[_0x2ff273];return _0x1b7126;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x174d('0x0'));var BPromise=require(_0x174d('0x1'));var rs=require(_0x174d('0x2'));var fs=require('fs');var Redis=require(_0x174d('0x3'));var db=require(_0x174d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x174d('0x5'))(_0x174d('0x6'));var config=require('../../config/environment');var jayson=require(_0x174d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9bb9,_0x197990,_0x5cf23b){return new BPromise(function(_0x1c3fac,_0x36fb75){return client[_0x174d('0x8')](_0x2c9bb9,_0x5cf23b)[_0x174d('0x9')](function(_0x4e8718){logger[_0x174d('0xa')](_0x174d('0xb'),_0x197990,_0x174d('0xc'));logger['debug'](_0x174d('0xd'),_0x197990,_0x174d('0xc'),JSON[_0x174d('0xe')](_0x4e8718));if(_0x4e8718['error']){if(_0x4e8718[_0x174d('0xf')][_0x174d('0x10')]===0x1f4){logger[_0x174d('0xf')](_0x174d('0xb'),_0x197990,_0x4e8718[_0x174d('0xf')][_0x174d('0x11')]);return _0x36fb75(_0x4e8718[_0x174d('0xf')]['message']);}logger[_0x174d('0xf')](_0x174d('0xb'),_0x197990,_0x4e8718[_0x174d('0xf')][_0x174d('0x11')]);return _0x1c3fac(_0x4e8718[_0x174d('0xf')][_0x174d('0x11')]);}else{logger[_0x174d('0xa')](_0x174d('0xb'),_0x197990,_0x174d('0xc'));_0x1c3fac(_0x4e8718['result'][_0x174d('0x11')]);}})['catch'](function(_0x6f36a2){logger[_0x174d('0xf')](_0x174d('0xb'),_0x197990,_0x6f36a2);_0x36fb75(_0x6f36a2);});});} \ No newline at end of file +var _0xa0a3=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x4bd65f,_0x1ddd12){var _0x20df85=function(_0x535fe9){while(--_0x535fe9){_0x4bd65f['push'](_0x4bd65f['shift']());}};_0x20df85(++_0x1ddd12);}(_0xa0a3,0x181));var _0x3a0a=function(_0x33d062,_0xfb4cf8){_0x33d062=_0x33d062-0x0;var _0x1e24dc=_0xa0a3[_0x33d062];return _0x1e24dc;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a0a('0x4'));var logger=require('../../config/logger')(_0x3a0a('0x5'));var config=require(_0x3a0a('0x6'));var jayson=require(_0x3a0a('0x7'));var client=jayson[_0x3a0a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x544865,_0x524a6f,_0x40c014){return new BPromise(function(_0x10d126,_0x2121af){return client[_0x3a0a('0x9')](_0x544865,_0x40c014)[_0x3a0a('0xa')](function(_0x5d264a){logger[_0x3a0a('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x524a6f,_0x3a0a('0xc'));logger[_0x3a0a('0xd')](_0x3a0a('0xe'),_0x524a6f,'request\x20sent',JSON[_0x3a0a('0xf')](_0x5d264a));if(_0x5d264a['error']){if(_0x5d264a['error']['code']===0x1f4){logger[_0x3a0a('0x10')](_0x3a0a('0x11'),_0x524a6f,_0x5d264a['error'][_0x3a0a('0x12')]);return _0x2121af(_0x5d264a[_0x3a0a('0x10')][_0x3a0a('0x12')]);}logger[_0x3a0a('0x10')](_0x3a0a('0x11'),_0x524a6f,_0x5d264a[_0x3a0a('0x10')]['message']);return _0x10d126(_0x5d264a[_0x3a0a('0x10')][_0x3a0a('0x12')]);}else{logger[_0x3a0a('0xb')](_0x3a0a('0x11'),_0x524a6f,_0x3a0a('0xc'));_0x10d126(_0x5d264a[_0x3a0a('0x13')][_0x3a0a('0x12')]);}})[_0x3a0a('0x14')](function(_0x21e0f2){logger[_0x3a0a('0x10')](_0x3a0a('0x11'),_0x524a6f,_0x21e0f2);_0x2121af(_0x21e0f2);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8dc2bf4..2dac359 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 _0xd2f5=['../../config/environment','get','describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1aaf0d,_0x55d489){var _0x436a88=function(_0x599a7a){while(--_0x599a7a){_0x1aaf0d['push'](_0x1aaf0d['shift']());}};_0x436a88(++_0x55d489);}(_0xd2f5,0xd5));var _0x5d2f=function(_0x7160a5,_0x27d25e){_0x7160a5=_0x7160a5-0x0;var _0x30e658=_0xd2f5[_0x7160a5];return _0x30e658;};'use strict';var multer=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var path=require(_0x5d2f('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d2f('0x3'));var router=express['Router']();var fs_extra=require(_0x5d2f('0x4'));var auth=require(_0x5d2f('0x5'));var interaction=require(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x5d2f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5d2f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5d2f('0x9')]);router[_0x5d2f('0x8')](_0x5d2f('0xa'),auth[_0x5d2f('0xb')](),controller[_0x5d2f('0xc')]);router[_0x5d2f('0x8')](_0x5d2f('0xd'),auth[_0x5d2f('0xb')](),controller[_0x5d2f('0xe')]);router[_0x5d2f('0xf')]('/',auth[_0x5d2f('0xb')](),controller[_0x5d2f('0x10')]);router[_0x5d2f('0x11')](_0x5d2f('0xa'),auth['isAuthenticated'](),controller[_0x5d2f('0x12')]);router[_0x5d2f('0x13')](_0x5d2f('0xa'),auth[_0x5d2f('0xb')](),controller[_0x5d2f('0x14')]);module[_0x5d2f('0x15')]=router; \ No newline at end of file +var _0x16b1=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0xd158dc,_0x128608){var _0x12d25f=function(_0x2e9d2b){while(--_0x2e9d2b){_0xd158dc['push'](_0xd158dc['shift']());}};_0x12d25f(++_0x128608);}(_0x16b1,0x1f4));var _0x116b=function(_0x57402c,_0x4a4a76){_0x57402c=_0x57402c-0x0;var _0x4e8c03=_0x16b1[_0x57402c];return _0x4e8c03;};'use strict';var multer=require(_0x116b('0x0'));var util=require(_0x116b('0x1'));var path=require(_0x116b('0x2'));var timeout=require(_0x116b('0x3'));var express=require(_0x116b('0x4'));var router=express[_0x116b('0x5')]();var fs_extra=require(_0x116b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x116b('0x7'));var config=require(_0x116b('0x8'));var controller=require(_0x116b('0x9'));router[_0x116b('0xa')]('/',auth['isAuthenticated'](),controller[_0x116b('0xb')]);router[_0x116b('0xa')](_0x116b('0xc'),auth[_0x116b('0xd')](),controller[_0x116b('0xe')]);router[_0x116b('0xa')](_0x116b('0xf'),auth[_0x116b('0xd')](),controller[_0x116b('0x10')]);router[_0x116b('0xa')](_0x116b('0x11'),auth['isAuthenticated'](),controller[_0x116b('0x12')]);router[_0x116b('0x13')]('/',auth[_0x116b('0xd')](),controller[_0x116b('0x14')]);router['put'](_0x116b('0xf'),auth[_0x116b('0xd')](),controller[_0x116b('0x15')]);router['delete'](_0x116b('0xf'),auth[_0x116b('0xd')](),controller[_0x116b('0x16')]);module[_0x116b('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 0a69c16..9540bfa 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 _0x2ab6=['STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x14f833,_0x347cb7){var _0x5c98bf=function(_0x6d7422){while(--_0x6d7422){_0x14f833['push'](_0x14f833['shift']());}};_0x5c98bf(++_0x347cb7);}(_0x2ab6,0x19c));var _0x62ab=function(_0xf86b3c,_0x59a25d){_0xf86b3c=_0xf86b3c-0x0;var _0x358c6e=_0x2ab6[_0xf86b3c];return _0x358c6e;};'use strict';var moment=require('moment');var Sequelize=require(_0x62ab('0x0'));module[_0x62ab('0x1')]={'starttime':{'type':Sequelize[_0x62ab('0x2')],'set':function(_0x372839){this[_0x62ab('0x3')](_0x62ab('0x4'),_0x372839);this['setDataValue'](_0x62ab('0x5'),moment()[_0x62ab('0x6')](_0x62ab('0x7')));}},'endtime':{'type':Sequelize[_0x62ab('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x62ab('0x8')]},'queue':{'type':Sequelize[_0x62ab('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x62ab('0x8')]},'calleridnum':{'type':Sequelize[_0x62ab('0x8')]},'completed':{'type':Sequelize[_0x62ab('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x2d6a=['endtime','STRING','moment','exports','starttime'];(function(_0x501e96,_0x5e6da0){var _0x4b6f13=function(_0x3b9689){while(--_0x3b9689){_0x501e96['push'](_0x501e96['shift']());}};_0x4b6f13(++_0x5e6da0);}(_0x2d6a,0x106));var _0xa2d6=function(_0x370315,_0x5b8898){_0x370315=_0x370315-0x0;var _0x564adb=_0x2d6a[_0x370315];return _0x564adb;};'use strict';var moment=require(_0xa2d6('0x0'));var Sequelize=require('sequelize');module[_0xa2d6('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x30118a){this['setDataValue'](_0xa2d6('0x2'),_0x30118a);this['setDataValue'](_0xa2d6('0x3'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xa2d6('0x4')]},'projectname':{'type':Sequelize[_0xa2d6('0x4')]},'queue':{'type':Sequelize[_0xa2d6('0x4')]},'uniqueid':{'type':Sequelize[_0xa2d6('0x4')]},'calleridname':{'type':Sequelize[_0xa2d6('0x4')]},'calleridnum':{'type':Sequelize[_0xa2d6('0x4')]},'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 90e3ed5..b36f9ab 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 _0xc573=['describe','getQuestions','JscriptyQuestionReport','hasOwnProperty','SessionId','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','JscriptySessionReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','show','rawAttributes','merge','find','catch','create','body','params'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xc573,0x9b));var _0x3c57=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xc573[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c57('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c57('0x1'));var rp=require(_0x3c57('0x2'));var moment=require('moment');var BPromise=require(_0x3c57('0x3'));var Mustache=require('mustache');var util=require(_0x3c57('0x4'));var path=require('path');var sox=require(_0x3c57('0x5'));var csv=require(_0x3c57('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c57('0x7'));var _=require(_0x3c57('0x8'));var squel=require(_0x3c57('0x9'));var crypto=require(_0x3c57('0xa'));var jsforce=require(_0x3c57('0xb'));var deskjs=require(_0x3c57('0xc'));var toCsv=require(_0x3c57('0x6'));var querystring=require(_0x3c57('0xd'));var Papa=require(_0x3c57('0xe'));var Redis=require('ioredis');var authService=require(_0x3c57('0xf'));var qs=require(_0x3c57('0x10'));var as=require(_0x3c57('0x11'));var hardwareService=require(_0x3c57('0x12'));var logger=require('../../config/logger')(_0x3c57('0x13'));var utils=require(_0x3c57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3c57('0x15'))['db'];function respondWithStatusCode(_0x41f9be,_0x51075){_0x51075=_0x51075||0xcc;return function(_0x36f57d){if(_0x36f57d){return _0x41f9be['sendStatus'](_0x51075);}return _0x41f9be[_0x3c57('0x16')](_0x51075)[_0x3c57('0x17')]();};}function respondWithResult(_0x38cd4c,_0x99122c){_0x99122c=_0x99122c||0xc8;return function(_0x4f452e){if(_0x4f452e){return _0x38cd4c[_0x3c57('0x16')](_0x99122c)['json'](_0x4f452e);}};}function respondWithFilteredResult(_0x419360,_0x4d1217){return function(_0x39d0f2){if(_0x39d0f2){var _0x2eb424=typeof _0x4d1217['offset']===_0x3c57('0x18')&&typeof _0x4d1217[_0x3c57('0x19')]===_0x3c57('0x18');var _0x3064e1=_0x39d0f2[_0x3c57('0x1a')];var _0x1f78eb=_0x2eb424?0x0:_0x4d1217[_0x3c57('0x1b')];var _0x1357e4=_0x2eb424?_0x39d0f2[_0x3c57('0x1a')]:_0x4d1217[_0x3c57('0x1b')]+_0x4d1217['limit'];var _0x50c152;if(_0x1357e4>=_0x3064e1){_0x1357e4=_0x3064e1;_0x50c152=0xc8;}else{_0x50c152=0xce;}_0x419360[_0x3c57('0x16')](_0x50c152);return _0x419360[_0x3c57('0x1c')](_0x3c57('0x1d'),_0x1f78eb+'-'+_0x1357e4+'/'+_0x3064e1)[_0x3c57('0x1e')](_0x39d0f2);}return null;};}function patchUpdates(_0x3092eb){return function(_0xfdabae){try{jsonpatch[_0x3c57('0x1f')](_0xfdabae,_0x3092eb,!![]);}catch(_0x4ad352){return BPromise[_0x3c57('0x20')](_0x4ad352);}return _0xfdabae['save']();};}function saveUpdates(_0x25d8d2,_0x5c48fe){return function(_0x11ffba){if(_0x11ffba){return _0x11ffba[_0x3c57('0x21')](_0x25d8d2)[_0x3c57('0x22')](function(_0x29fce6){return _0x29fce6;});}return null;};}function removeEntity(_0x277a20,_0x1aac8d){return function(_0x5afc07){if(_0x5afc07){return _0x5afc07[_0x3c57('0x23')]()[_0x3c57('0x22')](function(){_0x277a20[_0x3c57('0x16')](0xcc)[_0x3c57('0x17')]();});}};}function handleEntityNotFound(_0x3a95a4,_0x355a49){return function(_0x1514b3){if(!_0x1514b3){_0x3a95a4[_0x3c57('0x24')](0x194);}return _0x1514b3;};}function handleError(_0x18c9cc,_0x23b7a1){_0x23b7a1=_0x23b7a1||0x1f4;return function(_0x352fdf){logger[_0x3c57('0x25')](_0x352fdf[_0x3c57('0x26')]);if(_0x352fdf[_0x3c57('0x27')]){delete _0x352fdf[_0x3c57('0x27')];}_0x18c9cc[_0x3c57('0x16')](_0x23b7a1)[_0x3c57('0x28')](_0x352fdf);};}exports['index']=function(_0xa75a0c,_0x597799){var _0x24e823={},_0x532257={},_0x322edb={'count':0x0,'rows':[]};var _0x4df615=_[_0x3c57('0x29')](db[_0x3c57('0x2a')]['rawAttributes'],function(_0x1630f9){return{'name':_0x1630f9['fieldName'],'type':_0x1630f9[_0x3c57('0x2b')][_0x3c57('0x2c')]};});_0x532257[_0x3c57('0x2d')]=_[_0x3c57('0x29')](_0x4df615,_0x3c57('0x27'));_0x532257[_0x3c57('0x2e')]=_[_0x3c57('0x2f')](_0xa75a0c[_0x3c57('0x2e')]);_0x532257[_0x3c57('0x30')]=_[_0x3c57('0x31')](_0x532257[_0x3c57('0x2d')],_0x532257[_0x3c57('0x2e')]);_0x24e823['attributes']=_[_0x3c57('0x31')](_0x532257[_0x3c57('0x2d')],qs[_0x3c57('0x32')](_0xa75a0c[_0x3c57('0x2e')][_0x3c57('0x32')]));_0x24e823[_0x3c57('0x33')]=_0x24e823['attributes'][_0x3c57('0x34')]?_0x24e823[_0x3c57('0x33')]:_0x532257[_0x3c57('0x2d')];if(!_0xa75a0c['query']['hasOwnProperty']('nolimit')){_0x24e823[_0x3c57('0x19')]=qs[_0x3c57('0x19')](_0xa75a0c['query']['limit']);_0x24e823[_0x3c57('0x1b')]=qs[_0x3c57('0x1b')](_0xa75a0c[_0x3c57('0x2e')][_0x3c57('0x1b')]);}_0x24e823[_0x3c57('0x35')]=qs[_0x3c57('0x36')](_0xa75a0c[_0x3c57('0x2e')][_0x3c57('0x36')]);_0x24e823['where']=qs['filters'](_[_0x3c57('0x37')](_0xa75a0c[_0x3c57('0x2e')],_0x532257[_0x3c57('0x30')]),_0x4df615);if(_0xa75a0c[_0x3c57('0x2e')][_0x3c57('0x38')]){_0x24e823[_0x3c57('0x39')]=_['merge'](_0x24e823[_0x3c57('0x39')],{'$or':_[_0x3c57('0x29')](_0x4df615,function(_0x24bab4){if(_0x24bab4['type']!==_0x3c57('0x3a')){var _0x439774={};_0x439774[_0x24bab4[_0x3c57('0x27')]]={'$like':'%'+_0xa75a0c['query'][_0x3c57('0x38')]+'%'};return _0x439774;}})});}_0x24e823=_['merge']({},_0x24e823,_0xa75a0c[_0x3c57('0x3b')]);var _0x4b3409={'where':_0x24e823[_0x3c57('0x39')]};return db[_0x3c57('0x2a')][_0x3c57('0x1a')](_0x4b3409)[_0x3c57('0x22')](function(_0x466a32){_0x322edb[_0x3c57('0x1a')]=_0x466a32;if(_0xa75a0c[_0x3c57('0x2e')]['includeAll']){_0x24e823['include']=[{'all':!![]}];}return db[_0x3c57('0x2a')][_0x3c57('0x3c')](_0x24e823);})[_0x3c57('0x22')](function(_0x439ee6){_0x322edb[_0x3c57('0x3d')]=_0x439ee6;return _0x322edb;})['then'](respondWithFilteredResult(_0x597799,_0x24e823))['catch'](handleError(_0x597799,null));};exports[_0x3c57('0x3e')]=function(_0x32e110,_0x5f247d){var _0x3fbac5={'raw':!![],'where':{'id':_0x32e110['params']['id']}},_0x121f25={};_0x121f25[_0x3c57('0x2d')]=_[_0x3c57('0x2f')](db[_0x3c57('0x2a')][_0x3c57('0x3f')]);_0x121f25[_0x3c57('0x2e')]=_[_0x3c57('0x2f')](_0x32e110['query']);_0x121f25[_0x3c57('0x30')]=_[_0x3c57('0x31')](_0x121f25[_0x3c57('0x2d')],_0x121f25[_0x3c57('0x2e')]);_0x3fbac5[_0x3c57('0x33')]=_['intersection'](_0x121f25[_0x3c57('0x2d')],qs[_0x3c57('0x32')](_0x32e110['query'][_0x3c57('0x32')]));_0x3fbac5[_0x3c57('0x33')]=_0x3fbac5[_0x3c57('0x33')][_0x3c57('0x34')]?_0x3fbac5[_0x3c57('0x33')]:_0x121f25[_0x3c57('0x2d')];if(_0x32e110[_0x3c57('0x2e')]['includeAll']){_0x3fbac5['include']=[{'all':!![]}];}_0x3fbac5=_[_0x3c57('0x40')]({},_0x3fbac5,_0x32e110[_0x3c57('0x3b')]);return db['JscriptySessionReport'][_0x3c57('0x41')](_0x3fbac5)[_0x3c57('0x22')](handleEntityNotFound(_0x5f247d,null))[_0x3c57('0x22')](respondWithResult(_0x5f247d,null))[_0x3c57('0x42')](handleError(_0x5f247d,null));};exports[_0x3c57('0x43')]=function(_0x51a19d,_0x1a3c3b){return db[_0x3c57('0x2a')][_0x3c57('0x43')](_0x51a19d[_0x3c57('0x44')],{})['then'](respondWithResult(_0x1a3c3b,0xc9))[_0x3c57('0x42')](handleError(_0x1a3c3b,null));};exports[_0x3c57('0x21')]=function(_0x135292,_0x3e3288){if(_0x135292[_0x3c57('0x44')]['id']){delete _0x135292['body']['id'];}return db[_0x3c57('0x2a')][_0x3c57('0x41')]({'where':{'id':_0x135292[_0x3c57('0x45')]['id']}})[_0x3c57('0x22')](handleEntityNotFound(_0x3e3288,null))['then'](saveUpdates(_0x135292[_0x3c57('0x44')],null))[_0x3c57('0x22')](respondWithResult(_0x3e3288,null))[_0x3c57('0x42')](handleError(_0x3e3288,null));};exports[_0x3c57('0x23')]=function(_0x52ef9c,_0x4def67){return db['JscriptySessionReport'][_0x3c57('0x41')]({'where':{'id':_0x52ef9c[_0x3c57('0x45')]['id']}})[_0x3c57('0x22')](handleEntityNotFound(_0x4def67,null))[_0x3c57('0x22')](removeEntity(_0x4def67,null))[_0x3c57('0x42')](handleError(_0x4def67,null));};exports[_0x3c57('0x46')]=function(_0x332ead,_0x1c9b1e){return db[_0x3c57('0x2a')][_0x3c57('0x46')]()['then'](respondWithResult(_0x1c9b1e,null))[_0x3c57('0x42')](handleError(_0x1c9b1e,null));};exports[_0x3c57('0x47')]=function(_0x53b7d3,_0x166489,_0x3b3442){var _0x189310={'raw':!![],'where':{}};var _0x55f9c6={};var _0x3c5519={'count':0x0,'rows':[]};return db[_0x3c57('0x2a')]['findOne']({'where':{'id':_0x53b7d3['params']['id']}})[_0x3c57('0x22')](handleEntityNotFound(_0x166489,null))[_0x3c57('0x22')](function(_0x4ca3cc){if(_0x4ca3cc){_0x55f9c6[_0x3c57('0x2d')]=_[_0x3c57('0x2f')](db[_0x3c57('0x48')]['rawAttributes']);_0x55f9c6[_0x3c57('0x2e')]=_[_0x3c57('0x2f')](_0x53b7d3['query']);_0x55f9c6['filters']=_[_0x3c57('0x31')](_0x55f9c6[_0x3c57('0x2d')],_0x55f9c6[_0x3c57('0x2e')]);_0x189310[_0x3c57('0x33')]=_[_0x3c57('0x31')](_0x55f9c6[_0x3c57('0x2d')],qs[_0x3c57('0x32')](_0x53b7d3[_0x3c57('0x2e')]['fields']));_0x189310[_0x3c57('0x33')]=_0x189310[_0x3c57('0x33')][_0x3c57('0x34')]?_0x189310[_0x3c57('0x33')]:_0x55f9c6[_0x3c57('0x2d')];if(!_0x53b7d3[_0x3c57('0x2e')][_0x3c57('0x49')]('nolimit')){_0x189310[_0x3c57('0x19')]=qs[_0x3c57('0x19')](_0x53b7d3[_0x3c57('0x2e')]['limit']);_0x189310[_0x3c57('0x1b')]=qs[_0x3c57('0x1b')](_0x53b7d3[_0x3c57('0x2e')]['offset']);}_0x189310[_0x3c57('0x35')]=qs[_0x3c57('0x36')](_0x53b7d3[_0x3c57('0x2e')][_0x3c57('0x36')]);_0x189310[_0x3c57('0x39')]=qs['filters'](_[_0x3c57('0x37')](_0x53b7d3['query'],_0x55f9c6['filters']));_0x189310[_0x3c57('0x39')][_0x3c57('0x4a')]=_0x4ca3cc['id'];if(_0x53b7d3[_0x3c57('0x2e')][_0x3c57('0x38')]){_0x189310[_0x3c57('0x39')]=_['merge'](_0x189310[_0x3c57('0x39')],{'$or':_[_0x3c57('0x29')](_0x189310[_0x3c57('0x33')],function(_0x5571ec){var _0x529ddd={};_0x529ddd[_0x5571ec]={'$like':'%'+_0x53b7d3[_0x3c57('0x2e')][_0x3c57('0x38')]+'%'};return _0x529ddd;})});}_0x189310=_[_0x3c57('0x40')]({},_0x189310,_0x53b7d3['options']);return db['JscriptyQuestionReport']['count']({'where':_0x189310['where']})[_0x3c57('0x22')](function(_0x376353){_0x3c5519['count']=_0x376353;if(_0x53b7d3[_0x3c57('0x2e')]['includeAll']){_0x189310['include']=[{'all':!![]}];}return db[_0x3c57('0x48')][_0x3c57('0x3c')](_0x189310);})['then'](function(_0x3cf30b){_0x3c5519[_0x3c57('0x3d')]=_0x3cf30b;return _0x3c5519;});}})[_0x3c57('0x22')](respondWithFilteredResult(_0x166489,_0x189310))[_0x3c57('0x42')](handleError(_0x166489,null));}; \ No newline at end of file +var _0x2559=['squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','JscriptySessionReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x10bdcb,_0x30262b){var _0x2df2cb=function(_0x33cee8){while(--_0x33cee8){_0x10bdcb['push'](_0x10bdcb['shift']());}};_0x2df2cb(++_0x30262b);}(_0x2559,0x1b3));var _0x9255=function(_0x30c747,_0x501595){_0x30c747=_0x30c747-0x0;var _0x28fe59=_0x2559[_0x30c747];return _0x28fe59;};'use strict';var emlformat=require(_0x9255('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9255('0x1'));var moment=require('moment');var BPromise=require(_0x9255('0x2'));var Mustache=require(_0x9255('0x3'));var util=require(_0x9255('0x4'));var path=require(_0x9255('0x5'));var sox=require('sox');var csv=require(_0x9255('0x6'));var ejs=require(_0x9255('0x7'));var fs=require('fs');var fs_extra=require(_0x9255('0x8'));var _=require('lodash');var squel=require(_0x9255('0x9'));var crypto=require('crypto');var jsforce=require(_0x9255('0xa'));var deskjs=require(_0x9255('0xb'));var toCsv=require(_0x9255('0x6'));var querystring=require('querystring');var Papa=require(_0x9255('0xc'));var Redis=require(_0x9255('0xd'));var authService=require(_0x9255('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9255('0xf'));var logger=require(_0x9255('0x10'))(_0x9255('0x11'));var utils=require(_0x9255('0x12'));var config=require(_0x9255('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2642a1,_0x84743c){_0x84743c=_0x84743c||0xcc;return function(_0x2458fd){if(_0x2458fd){return _0x2642a1['sendStatus'](_0x84743c);}return _0x2642a1[_0x9255('0x14')](_0x84743c)[_0x9255('0x15')]();};}function respondWithResult(_0x46336b,_0x5ab57a){_0x5ab57a=_0x5ab57a||0xc8;return function(_0x1e2481){if(_0x1e2481){return _0x46336b[_0x9255('0x14')](_0x5ab57a)[_0x9255('0x16')](_0x1e2481);}};}function respondWithFilteredResult(_0x2bca0b,_0x2595e2){return function(_0x4c4ea3){if(_0x4c4ea3){var _0x28ce91=typeof _0x2595e2[_0x9255('0x17')]==='undefined'&&typeof _0x2595e2[_0x9255('0x18')]===_0x9255('0x19');var _0x3382f1=_0x4c4ea3['count'];var _0x42c331=_0x28ce91?0x0:_0x2595e2[_0x9255('0x17')];var _0x2f1fb0=_0x28ce91?_0x4c4ea3[_0x9255('0x1a')]:_0x2595e2[_0x9255('0x17')]+_0x2595e2['limit'];var _0x549233;if(_0x2f1fb0>=_0x3382f1){_0x2f1fb0=_0x3382f1;_0x549233=0xc8;}else{_0x549233=0xce;}_0x2bca0b[_0x9255('0x14')](_0x549233);return _0x2bca0b['set'](_0x9255('0x1b'),_0x42c331+'-'+_0x2f1fb0+'/'+_0x3382f1)[_0x9255('0x16')](_0x4c4ea3);}return null;};}function patchUpdates(_0x2c4f36){return function(_0x3e206a){try{jsonpatch[_0x9255('0x1c')](_0x3e206a,_0x2c4f36,!![]);}catch(_0x3abf10){return BPromise[_0x9255('0x1d')](_0x3abf10);}return _0x3e206a[_0x9255('0x1e')]();};}function saveUpdates(_0x28ca33,_0x30771b){return function(_0x118b98){if(_0x118b98){return _0x118b98[_0x9255('0x1f')](_0x28ca33)[_0x9255('0x20')](function(_0x11ca1b){return _0x11ca1b;});}return null;};}function removeEntity(_0xfe90ed,_0x56e8d2){return function(_0x1bb60c){if(_0x1bb60c){return _0x1bb60c[_0x9255('0x21')]()[_0x9255('0x20')](function(){_0xfe90ed['status'](0xcc)[_0x9255('0x15')]();});}};}function handleEntityNotFound(_0xb87b71,_0x408f38){return function(_0x2697a0){if(!_0x2697a0){_0xb87b71[_0x9255('0x22')](0x194);}return _0x2697a0;};}function handleError(_0x46c414,_0x4f4756){_0x4f4756=_0x4f4756||0x1f4;return function(_0x1529e8){logger[_0x9255('0x23')](_0x1529e8[_0x9255('0x24')]);if(_0x1529e8[_0x9255('0x25')]){delete _0x1529e8[_0x9255('0x25')];}_0x46c414[_0x9255('0x14')](_0x4f4756)['send'](_0x1529e8);};}exports[_0x9255('0x26')]=function(_0x3d0244,_0x41579c){var _0x2ff4ef={},_0x5a5ab1={},_0x1de4ac={'count':0x0,'rows':[]};var _0x5459b1=_[_0x9255('0x27')](db[_0x9255('0x28')][_0x9255('0x29')],function(_0x4f6914){return{'name':_0x4f6914['fieldName'],'type':_0x4f6914[_0x9255('0x2a')]['key']};});_0x5a5ab1[_0x9255('0x2b')]=_[_0x9255('0x27')](_0x5459b1,'name');_0x5a5ab1['query']=_['keys'](_0x3d0244[_0x9255('0x2c')]);_0x5a5ab1[_0x9255('0x2d')]=_[_0x9255('0x2e')](_0x5a5ab1[_0x9255('0x2b')],_0x5a5ab1['query']);_0x2ff4ef[_0x9255('0x2f')]=_[_0x9255('0x2e')](_0x5a5ab1['model'],qs['fields'](_0x3d0244[_0x9255('0x2c')][_0x9255('0x30')]));_0x2ff4ef[_0x9255('0x2f')]=_0x2ff4ef[_0x9255('0x2f')][_0x9255('0x31')]?_0x2ff4ef[_0x9255('0x2f')]:_0x5a5ab1['model'];if(!_0x3d0244[_0x9255('0x2c')][_0x9255('0x32')]('nolimit')){_0x2ff4ef['limit']=qs[_0x9255('0x18')](_0x3d0244[_0x9255('0x2c')]['limit']);_0x2ff4ef[_0x9255('0x17')]=qs[_0x9255('0x17')](_0x3d0244[_0x9255('0x2c')]['offset']);}_0x2ff4ef[_0x9255('0x33')]=qs['sort'](_0x3d0244[_0x9255('0x2c')][_0x9255('0x34')]);_0x2ff4ef[_0x9255('0x35')]=qs[_0x9255('0x2d')](_[_0x9255('0x36')](_0x3d0244[_0x9255('0x2c')],_0x5a5ab1['filters']),_0x5459b1);if(_0x3d0244[_0x9255('0x2c')]['filter']){_0x2ff4ef[_0x9255('0x35')]=_[_0x9255('0x37')](_0x2ff4ef[_0x9255('0x35')],{'$or':_['map'](_0x5459b1,function(_0x1d9247){if(_0x1d9247[_0x9255('0x2a')]!=='VIRTUAL'){var _0x3147e6={};_0x3147e6[_0x1d9247[_0x9255('0x25')]]={'$like':'%'+_0x3d0244[_0x9255('0x2c')][_0x9255('0x38')]+'%'};return _0x3147e6;}})});}_0x2ff4ef=_[_0x9255('0x37')]({},_0x2ff4ef,_0x3d0244[_0x9255('0x39')]);var _0x32dc8e={'where':_0x2ff4ef['where']};return db[_0x9255('0x28')]['count'](_0x32dc8e)[_0x9255('0x20')](function(_0x2a5c7f){_0x1de4ac[_0x9255('0x1a')]=_0x2a5c7f;if(_0x3d0244[_0x9255('0x2c')][_0x9255('0x3a')]){_0x2ff4ef[_0x9255('0x3b')]=[{'all':!![]}];}return db[_0x9255('0x28')][_0x9255('0x3c')](_0x2ff4ef);})[_0x9255('0x20')](function(_0x160a36){_0x1de4ac[_0x9255('0x3d')]=_0x160a36;return _0x1de4ac;})[_0x9255('0x20')](respondWithFilteredResult(_0x41579c,_0x2ff4ef))[_0x9255('0x3e')](handleError(_0x41579c,null));};exports[_0x9255('0x3f')]=function(_0x11b6d7,_0x2754dc){var _0x2f58d6={'raw':!![],'where':{'id':_0x11b6d7[_0x9255('0x40')]['id']}},_0x14ef48={};_0x14ef48['model']=_['keys'](db[_0x9255('0x28')][_0x9255('0x29')]);_0x14ef48['query']=_[_0x9255('0x41')](_0x11b6d7[_0x9255('0x2c')]);_0x14ef48[_0x9255('0x2d')]=_[_0x9255('0x2e')](_0x14ef48['model'],_0x14ef48[_0x9255('0x2c')]);_0x2f58d6[_0x9255('0x2f')]=_['intersection'](_0x14ef48[_0x9255('0x2b')],qs[_0x9255('0x30')](_0x11b6d7[_0x9255('0x2c')][_0x9255('0x30')]));_0x2f58d6[_0x9255('0x2f')]=_0x2f58d6['attributes'][_0x9255('0x31')]?_0x2f58d6['attributes']:_0x14ef48[_0x9255('0x2b')];if(_0x11b6d7[_0x9255('0x2c')]['includeAll']){_0x2f58d6[_0x9255('0x3b')]=[{'all':!![]}];}_0x2f58d6=_[_0x9255('0x37')]({},_0x2f58d6,_0x11b6d7['options']);return db[_0x9255('0x28')][_0x9255('0x42')](_0x2f58d6)[_0x9255('0x20')](handleEntityNotFound(_0x2754dc,null))[_0x9255('0x20')](respondWithResult(_0x2754dc,null))[_0x9255('0x3e')](handleError(_0x2754dc,null));};exports[_0x9255('0x43')]=function(_0x3569a5,_0x5891c4){return db[_0x9255('0x28')]['create'](_0x3569a5[_0x9255('0x44')],{})[_0x9255('0x20')](respondWithResult(_0x5891c4,0xc9))[_0x9255('0x3e')](handleError(_0x5891c4,null));};exports['update']=function(_0x1e4d26,_0x5bb319){if(_0x1e4d26[_0x9255('0x44')]['id']){delete _0x1e4d26[_0x9255('0x44')]['id'];}return db[_0x9255('0x28')]['find']({'where':{'id':_0x1e4d26[_0x9255('0x40')]['id']}})[_0x9255('0x20')](handleEntityNotFound(_0x5bb319,null))[_0x9255('0x20')](saveUpdates(_0x1e4d26[_0x9255('0x44')],null))[_0x9255('0x20')](respondWithResult(_0x5bb319,null))[_0x9255('0x3e')](handleError(_0x5bb319,null));};exports[_0x9255('0x21')]=function(_0xef0ccf,_0x2c99a1){return db['JscriptySessionReport']['find']({'where':{'id':_0xef0ccf['params']['id']}})[_0x9255('0x20')](handleEntityNotFound(_0x2c99a1,null))[_0x9255('0x20')](removeEntity(_0x2c99a1,null))['catch'](handleError(_0x2c99a1,null));};exports['describe']=function(_0x455547,_0x4c13f4){return db['JscriptySessionReport'][_0x9255('0x45')]()[_0x9255('0x20')](respondWithResult(_0x4c13f4,null))[_0x9255('0x3e')](handleError(_0x4c13f4,null));};exports[_0x9255('0x46')]=function(_0x15834a,_0x54ad4b,_0x907c59){var _0x33bac3={'raw':!![],'where':{}};var _0x17d77c={};var _0x11e64b={'count':0x0,'rows':[]};return db[_0x9255('0x28')][_0x9255('0x47')]({'where':{'id':_0x15834a[_0x9255('0x40')]['id']}})[_0x9255('0x20')](handleEntityNotFound(_0x54ad4b,null))[_0x9255('0x20')](function(_0x13fa88){if(_0x13fa88){_0x17d77c[_0x9255('0x2b')]=_[_0x9255('0x41')](db[_0x9255('0x48')][_0x9255('0x29')]);_0x17d77c['query']=_[_0x9255('0x41')](_0x15834a['query']);_0x17d77c[_0x9255('0x2d')]=_[_0x9255('0x2e')](_0x17d77c[_0x9255('0x2b')],_0x17d77c[_0x9255('0x2c')]);_0x33bac3[_0x9255('0x2f')]=_[_0x9255('0x2e')](_0x17d77c[_0x9255('0x2b')],qs[_0x9255('0x30')](_0x15834a[_0x9255('0x2c')][_0x9255('0x30')]));_0x33bac3[_0x9255('0x2f')]=_0x33bac3[_0x9255('0x2f')]['length']?_0x33bac3[_0x9255('0x2f')]:_0x17d77c['model'];if(!_0x15834a[_0x9255('0x2c')][_0x9255('0x32')]('nolimit')){_0x33bac3[_0x9255('0x18')]=qs[_0x9255('0x18')](_0x15834a['query'][_0x9255('0x18')]);_0x33bac3[_0x9255('0x17')]=qs[_0x9255('0x17')](_0x15834a[_0x9255('0x2c')][_0x9255('0x17')]);}_0x33bac3[_0x9255('0x33')]=qs[_0x9255('0x34')](_0x15834a[_0x9255('0x2c')][_0x9255('0x34')]);_0x33bac3[_0x9255('0x35')]=qs[_0x9255('0x2d')](_[_0x9255('0x36')](_0x15834a[_0x9255('0x2c')],_0x17d77c[_0x9255('0x2d')]));_0x33bac3['where'][_0x9255('0x49')]=_0x13fa88['id'];if(_0x15834a[_0x9255('0x2c')][_0x9255('0x38')]){_0x33bac3[_0x9255('0x35')]=_['merge'](_0x33bac3['where'],{'$or':_[_0x9255('0x27')](_0x33bac3['attributes'],function(_0x2c372c){var _0x2df3a5={};_0x2df3a5[_0x2c372c]={'$like':'%'+_0x15834a[_0x9255('0x2c')][_0x9255('0x38')]+'%'};return _0x2df3a5;})});}_0x33bac3=_[_0x9255('0x37')]({},_0x33bac3,_0x15834a[_0x9255('0x39')]);return db['JscriptyQuestionReport'][_0x9255('0x1a')]({'where':_0x33bac3['where']})['then'](function(_0x3b9cf5){_0x11e64b['count']=_0x3b9cf5;if(_0x15834a[_0x9255('0x2c')][_0x9255('0x3a')]){_0x33bac3[_0x9255('0x3b')]=[{'all':!![]}];}return db[_0x9255('0x48')]['findAll'](_0x33bac3);})[_0x9255('0x20')](function(_0x92ebab){_0x11e64b['rows']=_0x92ebab;return _0x11e64b;});}})[_0x9255('0x20')](respondWithFilteredResult(_0x54ad4b,_0x33bac3))['catch'](handleError(_0x54ad4b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 741810d..dd7e20a 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 _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4bbe69,_0x4fc24d){_0x4bbe69=_0x4bbe69-0x0;var _0x9e6430=_0xb4c7[_0x4bbe69];return _0x9e6430;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x0309,0x165));var _0x9030=function(_0xfc7f4e,_0x14b8d6){_0xfc7f4e=_0xfc7f4e-0x0;var _0x3fb89b=_0x0309[_0xfc7f4e];return _0x3fb89b;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4cb44cc..33d789a 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 _0xafb9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x1c0e92,_0x214d47){var _0x18dd1a=function(_0x45e0db){while(--_0x45e0db){_0x1c0e92['push'](_0x1c0e92['shift']());}};_0x18dd1a(++_0x214d47);}(_0xafb9,0x68));var _0x9afb=function(_0x1e0983,_0x42b665){_0x1e0983=_0x1e0983-0x0;var _0x5b0c96=_0xafb9[_0x1e0983];return _0x5b0c96;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});} \ No newline at end of file +var _0x4e2e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f492b,_0x47b2ae){var _0x485a7d=function(_0x335752){while(--_0x335752){_0x1f492b['push'](_0x1f492b['shift']());}};_0x485a7d(++_0x47b2ae);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0xeaca85,_0xc0082d){_0xeaca85=_0xeaca85-0x0;var _0x5d5f33=_0x4e2e[_0xeaca85];return _0x5d5f33;};'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);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9ca0408..d76aef3 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 _0x7024=['get','put','/:id','isAuthenticated','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./license.controller'];(function(_0x31ddff,_0x332c4f){var _0xabf5b=function(_0x3b08c0){while(--_0x3b08c0){_0x31ddff['push'](_0x31ddff['shift']());}};_0xabf5b(++_0x332c4f);}(_0x7024,0xa1));var _0x4702=function(_0x287dbe,_0x4ed17a){_0x287dbe=_0x287dbe-0x0;var _0x271aff=_0x7024[_0x287dbe];return _0x271aff;};'use strict';var multer=require(_0x4702('0x0'));var util=require('util');var path=require(_0x4702('0x1'));var timeout=require(_0x4702('0x2'));var express=require(_0x4702('0x3'));var router=express[_0x4702('0x4')]();var fs_extra=require(_0x4702('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4702('0x6'));var config=require('../../config/environment');var controller=require(_0x4702('0x7'));router[_0x4702('0x8')]('/',controller['index']);router[_0x4702('0x9')](_0x4702('0xa'),auth[_0x4702('0xb')](),controller[_0x4702('0xc')]);module['exports']=router; \ No newline at end of file +var _0x6927=['../../components/auth/service','../../config/environment','./license.controller','get','put','/:id','update','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5653eb,_0x4bbb3a){var _0x58d272=function(_0x338f36){while(--_0x338f36){_0x5653eb['push'](_0x5653eb['shift']());}};_0x58d272(++_0x4bbb3a);}(_0x6927,0xf6));var _0x7692=function(_0x286729,_0x145047){_0x286729=_0x286729-0x0;var _0x36e7af=_0x6927[_0x286729];return _0x36e7af;};'use strict';var multer=require(_0x7692('0x0'));var util=require('util');var path=require(_0x7692('0x1'));var timeout=require(_0x7692('0x2'));var express=require(_0x7692('0x3'));var router=express[_0x7692('0x4')]();var fs_extra=require(_0x7692('0x5'));var auth=require(_0x7692('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7692('0x7'));var controller=require(_0x7692('0x8'));router[_0x7692('0x9')]('/',controller['index']);router[_0x7692('0xa')](_0x7692('0xb'),auth['isAuthenticated'](),controller[_0x7692('0xc')]);module[_0x7692('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a01576c..040f0ad 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 _0xd77a=['exports','STRING'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd77a,0x1d8));var _0xad77=function(_0x290b44,_0x35b67b){_0x290b44=_0x290b44-0x0;var _0x4f99ad=_0xd77a[_0x290b44];return _0x4f99ad;};'use strict';var Sequelize=require('sequelize');module[_0xad77('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xad77('0x1')]},'data2':{'type':Sequelize[_0xad77('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x07b9=['TEXT','STRING','INTEGER'];(function(_0x43cc8e,_0x427ca6){var _0x5bc4d5=function(_0x476fd7){while(--_0x476fd7){_0x43cc8e['push'](_0x43cc8e['shift']());}};_0x5bc4d5(++_0x427ca6);}(_0x07b9,0xcc));var _0x907b=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x07b9[_0x999b85];return _0x1d7124;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x907b('0x0')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x907b('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x907b('0x2')],'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 e905754..23d9d5f 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 _0x5fc3=['mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','model','keys','License','query','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5fc3,0xa8));var _0x35fc=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0x5fc3[_0x512c83];return _0x1f7f25;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}var utilLicense=require('../../config/license/util');exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={'raw':!![],'where':{'id':0x1}},_0x3735da={};_0x3735da[_0x35fc('0x29')]=_[_0x35fc('0x2a')](db[_0x35fc('0x2b')]['rawAttributes']);_0x3735da[_0x35fc('0x2c')]=_[_0x35fc('0x2a')](_0x645eac[_0x35fc('0x2c')]);_0x3735da['filters']=_[_0x35fc('0x2d')](_0x3735da[_0x35fc('0x29')],_0x3735da[_0x35fc('0x2c')]);_0x9f3c8a[_0x35fc('0x2e')]=_[_0x35fc('0x2d')](_0x3735da[_0x35fc('0x29')],qs[_0x35fc('0x2f')](_0x645eac[_0x35fc('0x2c')][_0x35fc('0x2f')]));_0x9f3c8a[_0x35fc('0x2e')]=_0x9f3c8a['attributes']['length']?_0x9f3c8a[_0x35fc('0x2e')]:_0x3735da['model'];_0x9f3c8a=_[_0x35fc('0x30')]({},_0x9f3c8a,_0x645eac[_0x35fc('0x31')]);return utilLicense[_0x35fc('0x32')](_0x9f3c8a)[_0x35fc('0x24')](respondWithResult(_0x383837,null))[_0x35fc('0x33')](handleError(_0x383837,null));};exports[_0x35fc('0x23')]=function(_0x4e43b4,_0x3fe193){if(_0x4e43b4[_0x35fc('0x34')]['id']){delete _0x4e43b4[_0x35fc('0x34')]['id'];}return db[_0x35fc('0x2b')][_0x35fc('0x35')]({'where':{'id':_0x4e43b4[_0x35fc('0x36')]['id']}})['then'](handleEntityNotFound(_0x3fe193,null))[_0x35fc('0x24')](function(_0x38193d){var _0x1fecdf=_0x38193d['get']({'plain':!![]});return utilLicense[_0x35fc('0x37')](_0x1fecdf,_0x4e43b4['body'][_0x35fc('0x38')]);})[_0x35fc('0x24')](function(_0x266a11){if(!_0x266a11[_0x35fc('0x39')]){return saveUpdates(_0x4e43b4['body'],null);}return _0x266a11;})['then'](respondWithResult(_0x3fe193,null))['catch'](handleError(_0x3fe193,null));}; \ No newline at end of file +var _0x53ec=['Content-Range','apply','reject','save','then','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x141cf2,_0x36b3c1){var _0x4e96e6=function(_0xd5ea0b){while(--_0xd5ea0b){_0x141cf2['push'](_0x141cf2['shift']());}};_0x4e96e6(++_0x36b3c1);}(_0x53ec,0x192));var _0xc53e=function(_0x430524,_0x23b611){_0x430524=_0x430524-0x0;var _0x3a726d=_0x53ec[_0x430524];return _0x3a726d;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}var utilLicense=require('../../config/license/util');exports[_0xc53e('0x28')]=function(_0x5112d2,_0x5ce216){var _0x8f0ee6={'raw':!![],'where':{'id':0x1}},_0x6a62b0={};_0x6a62b0[_0xc53e('0x29')]=_[_0xc53e('0x2a')](db[_0xc53e('0x2b')][_0xc53e('0x2c')]);_0x6a62b0[_0xc53e('0x2d')]=_[_0xc53e('0x2a')](_0x5112d2['query']);_0x6a62b0[_0xc53e('0x2e')]=_[_0xc53e('0x2f')](_0x6a62b0[_0xc53e('0x29')],_0x6a62b0['query']);_0x8f0ee6[_0xc53e('0x30')]=_['intersection'](_0x6a62b0[_0xc53e('0x29')],qs[_0xc53e('0x31')](_0x5112d2['query']['fields']));_0x8f0ee6[_0xc53e('0x30')]=_0x8f0ee6[_0xc53e('0x30')][_0xc53e('0x32')]?_0x8f0ee6[_0xc53e('0x30')]:_0x6a62b0[_0xc53e('0x29')];_0x8f0ee6=_[_0xc53e('0x33')]({},_0x8f0ee6,_0x5112d2[_0xc53e('0x34')]);return utilLicense[_0xc53e('0x35')](_0x8f0ee6)['then'](respondWithResult(_0x5ce216,null))[_0xc53e('0x36')](handleError(_0x5ce216,null));};exports[_0xc53e('0x37')]=function(_0x19020b,_0x17ad32){if(_0x19020b[_0xc53e('0x38')]['id']){delete _0x19020b[_0xc53e('0x38')]['id'];}return db[_0xc53e('0x2b')][_0xc53e('0x39')]({'where':{'id':_0x19020b[_0xc53e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x17ad32,null))[_0xc53e('0x24')](function(_0x48d7d0){var _0x1059f3=_0x48d7d0[_0xc53e('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x1059f3,_0x19020b[_0xc53e('0x38')][_0xc53e('0x3c')]);})[_0xc53e('0x24')](function(_0x5ed90b){if(!_0x5ed90b[_0xc53e('0x3d')]){return saveUpdates(_0x19020b[_0xc53e('0x38')],null);}return _0x5ed90b;})[_0xc53e('0x24')](respondWithResult(_0x17ad32,null))[_0xc53e('0x36')](handleError(_0x17ad32,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 00bf0bb..879b8ea 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 _0x376a=['moment','path','rimraf','../../config/environment','exports','License','lodash','../../config/logger','api'];(function(_0x223195,_0x518e9e){var _0x59d1cf=function(_0x347044){while(--_0x347044){_0x223195['push'](_0x223195['shift']());}};_0x59d1cf(++_0x518e9e);}(_0x376a,0x153));var _0xa376=function(_0x54882f,_0x41d7e9){_0x54882f=_0x54882f-0x0;var _0x37f30f=_0x376a[_0x54882f];return _0x37f30f;};'use strict';var _=require(_0xa376('0x0'));var util=require('util');var logger=require(_0xa376('0x1'))(_0xa376('0x2'));var moment=require(_0xa376('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa376('0x4'));var rimraf=require(_0xa376('0x5'));var config=require(_0xa376('0x6'));var attributes=require('./license.attributes');module[_0xa376('0x7')]=function(_0x2106f7,_0x2f5213){return _0x2106f7['define'](_0xa376('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeda7=['util','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','License','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeda7,0x81));var _0x7eda=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xeda7[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var logger=require('../../config/logger')(_0x7eda('0x2'));var moment=require(_0x7eda('0x3'));var BPromise=require('bluebird');var rp=require(_0x7eda('0x4'));var fs=require('fs');var path=require(_0x7eda('0x5'));var rimraf=require(_0x7eda('0x6'));var config=require(_0x7eda('0x7'));var attributes=require(_0x7eda('0x8'));module['exports']=function(_0x18f1ef,_0x31bb85){return _0x18f1ef['define'](_0x7eda('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 401d36f..7319d69 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 _0x9e81=['lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5e3ac6,_0x5ca30a){var _0x558860=function(_0x79e7bc){while(--_0x79e7bc){_0x5e3ac6['push'](_0x5e3ac6['shift']());}};_0x558860(++_0x5ca30a);}(_0x9e81,0x1d4));var _0x19e8=function(_0x2de59e,_0x24b766){_0x2de59e=_0x2de59e-0x0;var _0x534d4b=_0x9e81[_0x2de59e];return _0x534d4b;};'use strict';var _=require(_0x19e8('0x0'));var util=require(_0x19e8('0x1'));var moment=require(_0x19e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19e8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x19e8('0x4'))(_0x19e8('0x5'));var config=require('../../config/environment');var jayson=require(_0x19e8('0x6'));var client=jayson[_0x19e8('0x7')][_0x19e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37bd90,_0x2169a6,_0x4d8b23){return new BPromise(function(_0x17c166,_0x1c17ca){return client['request'](_0x37bd90,_0x4d8b23)[_0x19e8('0x9')](function(_0x344ad7){logger[_0x19e8('0xa')](_0x19e8('0xb'),_0x2169a6,_0x19e8('0xc'));logger[_0x19e8('0xd')](_0x19e8('0xe'),_0x2169a6,_0x19e8('0xc'),JSON[_0x19e8('0xf')](_0x344ad7));if(_0x344ad7[_0x19e8('0x10')]){if(_0x344ad7[_0x19e8('0x10')]['code']===0x1f4){logger[_0x19e8('0x10')](_0x19e8('0xb'),_0x2169a6,_0x344ad7[_0x19e8('0x10')]['message']);return _0x1c17ca(_0x344ad7[_0x19e8('0x10')][_0x19e8('0x11')]);}logger[_0x19e8('0x10')](_0x19e8('0xb'),_0x2169a6,_0x344ad7['error'][_0x19e8('0x11')]);return _0x17c166(_0x344ad7[_0x19e8('0x10')][_0x19e8('0x11')]);}else{logger[_0x19e8('0xa')](_0x19e8('0xb'),_0x2169a6,_0x19e8('0xc'));_0x17c166(_0x344ad7['result']['message']);}})['catch'](function(_0x1c008a){logger[_0x19e8('0x10')](_0x19e8('0xb'),_0x2169a6,_0x1c008a);_0x1c17ca(_0x1c008a);});});} \ No newline at end of file +var _0x3f3d=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0xfad1a7,_0x2e3b8d){var _0x571012=function(_0x33255d){while(--_0x33255d){_0xfad1a7['push'](_0xfad1a7['shift']());}};_0x571012(++_0x2e3b8d);}(_0x3f3d,0x144));var _0xd3f3=function(_0xa80908,_0x1fbb08){_0xa80908=_0xa80908-0x0;var _0x1e8bed=_0x3f3d[_0xa80908];return _0x1e8bed;};'use strict';var _=require(_0xd3f3('0x0'));var util=require('util');var moment=require(_0xd3f3('0x1'));var BPromise=require(_0xd3f3('0x2'));var rs=require(_0xd3f3('0x3'));var fs=require('fs');var Redis=require(_0xd3f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3f3('0x5'));var config=require(_0xd3f3('0x6'));var jayson=require(_0xd3f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31a961,_0x57b920,_0x47de49){return new BPromise(function(_0x43af12,_0x200899){return client['request'](_0x31a961,_0x47de49)[_0xd3f3('0x8')](function(_0x4fbb5a){logger[_0xd3f3('0x9')](_0xd3f3('0xa'),_0x57b920,_0xd3f3('0xb'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x57b920,_0xd3f3('0xb'),JSON['stringify'](_0x4fbb5a));if(_0x4fbb5a['error']){if(_0x4fbb5a[_0xd3f3('0xc')][_0xd3f3('0xd')]===0x1f4){logger[_0xd3f3('0xc')](_0xd3f3('0xa'),_0x57b920,_0x4fbb5a[_0xd3f3('0xc')][_0xd3f3('0xe')]);return _0x200899(_0x4fbb5a[_0xd3f3('0xc')]['message']);}logger['error'](_0xd3f3('0xa'),_0x57b920,_0x4fbb5a[_0xd3f3('0xc')][_0xd3f3('0xe')]);return _0x43af12(_0x4fbb5a['error'][_0xd3f3('0xe')]);}else{logger[_0xd3f3('0x9')]('License,\x20%s,\x20%s',_0x57b920,_0xd3f3('0xb'));_0x43af12(_0x4fbb5a[_0xd3f3('0xf')][_0xd3f3('0xe')]);}})['catch'](function(_0x5636f4){logger['error'](_0xd3f3('0xa'),_0x57b920,_0x5636f4);_0x200899(_0x5636f4);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0000416..eed6777 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 _0x481f=['create','/:id/in_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','removeSmtp','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getAnswers','getImap','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x481f,0x1b1));var _0xf481=function(_0x59cadd,_0x1a2146){_0x59cadd=_0x59cadd-0x0;var _0x435eaf=_0x481f[_0x59cadd];return _0x435eaf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf481('0x0'));var timeout=require(_0xf481('0x1'));var express=require(_0xf481('0x2'));var router=express['Router']();var fs_extra=require(_0xf481('0x3'));var auth=require(_0xf481('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf481('0x5'));var controller=require(_0xf481('0x6'));router[_0xf481('0x7')]('/',auth[_0xf481('0x8')](),controller[_0xf481('0x9')]);router['get'](_0xf481('0xa'),auth['isAuthenticated'](),controller[_0xf481('0xb')]);router['get']('/:id',auth[_0xf481('0x8')](),controller[_0xf481('0xc')]);router[_0xf481('0x7')](_0xf481('0xd'),auth[_0xf481('0x8')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xf481('0x8')](),controller[_0xf481('0xe')]);router['get']('/:id/in_servers',auth[_0xf481('0x8')](),controller[_0xf481('0xf')]);router[_0xf481('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0xf481('0x7')](_0xf481('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xf481('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf481('0x7')](_0xf481('0x12'),auth[_0xf481('0x8')](),controller[_0xf481('0x13')]);router[_0xf481('0x7')](_0xf481('0x14'),auth['isAuthenticated'](),controller['verifySmtp']);router['get'](_0xf481('0x15'),auth[_0xf481('0x8')](),controller[_0xf481('0x16')]);router[_0xf481('0x17')](_0xf481('0xd'),auth['isAuthenticated'](),controller[_0xf481('0x18')]);router[_0xf481('0x17')](_0xf481('0x19'),auth[_0xf481('0x8')](),controller[_0xf481('0x1a')]);router['post']('/',auth[_0xf481('0x8')](),controller[_0xf481('0x1b')]);router[_0xf481('0x17')](_0xf481('0x1c'),auth[_0xf481('0x8')](),controller['addImap']);router['post']('/:id/out_servers',auth[_0xf481('0x8')](),controller[_0xf481('0x1d')]);router[_0xf481('0x17')](_0xf481('0x10'),auth[_0xf481('0x8')](),controller[_0xf481('0x1e')]);router[_0xf481('0x17')](_0xf481('0x11'),auth[_0xf481('0x8')](),controller[_0xf481('0x1f')]);router['post'](_0xf481('0x20'),auth[_0xf481('0x8')](),controller[_0xf481('0x21')]);router['post']('/:id/users',auth[_0xf481('0x8')](),controller[_0xf481('0x22')]);router[_0xf481('0x23')](_0xf481('0x24'),auth[_0xf481('0x8')](),controller[_0xf481('0x25')]);router[_0xf481('0x26')](_0xf481('0xd'),auth['isAuthenticated'](),controller[_0xf481('0x27')]);router[_0xf481('0x26')](_0xf481('0x19'),auth['isAuthenticated'](),controller[_0xf481('0x28')]);router['delete'](_0xf481('0x1c'),auth['isAuthenticated'](),controller[_0xf481('0x29')]);router[_0xf481('0x26')](_0xf481('0x2a'),auth[_0xf481('0x8')](),controller[_0xf481('0x2b')]);router[_0xf481('0x26')](_0xf481('0x24'),auth[_0xf481('0x8')](),controller['destroy']);router['delete'](_0xf481('0x15'),auth[_0xf481('0x8')](),controller[_0xf481('0x2c')]);module[_0xf481('0x2d')]=router; \ No newline at end of file +var _0xf4bf=['getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications'];(function(_0x502f25,_0xd2bdee){var _0x1d542=function(_0xc53de4){while(--_0xc53de4){_0x502f25['push'](_0x502f25['shift']());}};_0x1d542(++_0xd2bdee);}(_0xf4bf,0x1b8));var _0xff4b=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0xf4bf[_0x32e649];return _0x14d386;};'use strict';var multer=require(_0xff4b('0x0'));var util=require(_0xff4b('0x1'));var path=require('path');var timeout=require(_0xff4b('0x2'));var express=require(_0xff4b('0x3'));var router=express['Router']();var fs_extra=require(_0xff4b('0x4'));var auth=require(_0xff4b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xff4b('0x6'));router[_0xff4b('0x7')]('/',auth[_0xff4b('0x8')](),controller['index']);router[_0xff4b('0x7')](_0xff4b('0x9'),auth[_0xff4b('0x8')](),controller[_0xff4b('0xa')]);router[_0xff4b('0x7')]('/:id',auth[_0xff4b('0x8')](),controller['show']);router[_0xff4b('0x7')](_0xff4b('0xb'),auth[_0xff4b('0x8')](),controller[_0xff4b('0xc')]);router['get'](_0xff4b('0xd'),auth[_0xff4b('0x8')](),controller[_0xff4b('0xe')]);router['get']('/:id/in_servers',auth['isAuthenticated'](),controller[_0xff4b('0xf')]);router['get'](_0xff4b('0x10'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x11')]);router[_0xff4b('0x7')](_0xff4b('0x12'),auth[_0xff4b('0x8')](),controller['getInteractions']);router[_0xff4b('0x7')](_0xff4b('0x13'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x14')]);router[_0xff4b('0x7')](_0xff4b('0x15'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x16')]);router[_0xff4b('0x7')](_0xff4b('0x17'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x18')]);router[_0xff4b('0x7')](_0xff4b('0x19'),auth[_0xff4b('0x8')](),controller['getAgents']);router[_0xff4b('0x1a')](_0xff4b('0xb'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x1b')]);router[_0xff4b('0x1a')]('/:id/canned_answers',auth[_0xff4b('0x8')](),controller['addAnswer']);router[_0xff4b('0x1a')]('/',auth[_0xff4b('0x8')](),controller[_0xff4b('0x1c')]);router[_0xff4b('0x1a')](_0xff4b('0x1d'),auth['isAuthenticated'](),controller[_0xff4b('0x1e')]);router['post'](_0xff4b('0x10'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x1f')]);router['post'](_0xff4b('0x12'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x20')]);router[_0xff4b('0x1a')](_0xff4b('0x13'),auth['isAuthenticated'](),controller[_0xff4b('0x21')]);router[_0xff4b('0x1a')](_0xff4b('0x22'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x23')]);router[_0xff4b('0x1a')](_0xff4b('0x19'),auth['isAuthenticated'](),controller[_0xff4b('0x24')]);router[_0xff4b('0x25')](_0xff4b('0x26'),auth['isAuthenticated'](),controller[_0xff4b('0x27')]);router[_0xff4b('0x28')](_0xff4b('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xff4b('0xd'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x29')]);router[_0xff4b('0x28')](_0xff4b('0x1d'),auth[_0xff4b('0x8')](),controller['removeImap']);router[_0xff4b('0x28')](_0xff4b('0x10'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x2a')]);router[_0xff4b('0x28')](_0xff4b('0x26'),auth[_0xff4b('0x8')](),controller[_0xff4b('0x2b')]);router['delete'](_0xff4b('0x19'),auth['isAuthenticated'](),controller[_0xff4b('0x2c')]);module[_0xff4b('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 41225da..6f79079 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 _0xa5ca=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x15a3d3,_0x1fe368){var _0x1fa778=function(_0x3ad80a){while(--_0x3ad80a){_0x15a3d3['push'](_0x15a3d3['shift']());}};_0x1fa778(++_0x1fe368);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5ca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaa5c('0x0'));module[_0xaa5c('0x1')]={'description':{'type':Sequelize[_0xaa5c('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xaa5c('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xaa5c('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xaa5c('0x4')]},'markAsUnread':{'type':Sequelize[_0xaa5c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xaa5c('0x4')],'defaultValue':function(){return _0xaa5c('0x5');}},'notificationSound':{'type':Sequelize[_0xaa5c('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaa5c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaa5c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaa5c('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa5c('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xaa5c('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xaa5c('0x3')],'defaultValue':![],'comment':_0xaa5c('0x8'),'set':function(_0x3a3df7){if(!_0x3a3df7)this[_0xaa5c('0x9')](_0xaa5c('0xa'),null);this[_0xaa5c('0x9')](_0xaa5c('0xb'),_0x3a3df7);}}}; \ No newline at end of file +var _0x4491=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER'];(function(_0x1fddaf,_0x1968d7){var _0x22283d=function(_0x54b68a){while(--_0x54b68a){_0x1fddaf['push'](_0x1fddaf['shift']());}};_0x22283d(++_0x1968d7);}(_0x4491,0x1bb));var _0x1449=function(_0x11b895,_0x174e61){_0x11b895=_0x11b895-0x0;var _0x366333=_0x4491[_0x11b895];return _0x366333;};'use strict';var Sequelize=require(_0x1449('0x0'));module['exports']={'description':{'type':Sequelize[_0x1449('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x1449('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1449('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1449('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1449('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x1449('0x3')]},'markAsUnread':{'type':Sequelize[_0x1449('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1449('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x1449('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1449('0x3')],'defaultValue':function(){return _0x1449('0x6');}},'notificationSound':{'type':Sequelize[_0x1449('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1449('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1449('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1449('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1449('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1449('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x1449('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1449('0x9'),'set':function(_0x383523){if(!_0x383523)this['setDataValue'](_0x1449('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x383523);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 49e0fc1..81635b6 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 _0x692b=['VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailAccount.socket','register','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','name','send','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','findAll','params','Smtp','Pause','keys','includeAll','include','find','body','Imap','MailServerOut','MailServerIn','describe','addDisposition','Disposition','create','getDispositions','findOne','hasOwnProperty','options','removeDispositions','ids','MailAccountId','CannedAnswer','getAnswers','rows','removeAnswers','key','email','ListId','active','description','cservice','user','cuser','password','cpassword','authentication','host','port','service','pass','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','order','CmContact','Contact','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','bulkCreate','MailApplication','findAndCountAll','priority','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','updatedAt','DESC','isNil','from','format','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp'];(function(_0x2b271c,_0xbd09d5){var _0x52bb38=function(_0xc6e454){while(--_0xc6e454){_0x2b271c['push'](_0x2b271c['shift']());}};_0x52bb38(++_0xbd09d5);}(_0x692b,0xd9));var _0xb692=function(_0x1c3ab8,_0x38aacf){_0x1c3ab8=_0x1c3ab8-0x0;var _0x4f9c01=_0x692b[_0x1c3ab8];return _0x4f9c01;};'use strict';var emlformat=require(_0xb692('0x0'));var rimraf=require(_0xb692('0x1'));var zipdir=require(_0xb692('0x2'));var jsonpatch=require(_0xb692('0x3'));var rp=require(_0xb692('0x4'));var moment=require('moment');var BPromise=require(_0xb692('0x5'));var Mustache=require(_0xb692('0x6'));var util=require(_0xb692('0x7'));var path=require(_0xb692('0x8'));var sox=require(_0xb692('0x9'));var csv=require(_0xb692('0xa'));var ejs=require(_0xb692('0xb'));var fs=require('fs');var fs_extra=require(_0xb692('0xc'));var _=require(_0xb692('0xd'));var squel=require(_0xb692('0xe'));var crypto=require('crypto');var jsforce=require(_0xb692('0xf'));var deskjs=require(_0xb692('0x10'));var toCsv=require(_0xb692('0xa'));var querystring=require(_0xb692('0x11'));var Papa=require('papaparse');var htmlToText=require(_0xb692('0x12'));var juice=require(_0xb692('0x13'));var Redis=require(_0xb692('0x14'));var authService=require(_0xb692('0x15'));var qs=require(_0xb692('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb692('0x17'))('api');var utils=require(_0xb692('0x18'));var config=require(_0xb692('0x19'));var licenseUtil=require(_0xb692('0x1a'));var db=require('../../mysqldb')['db'];config[_0xb692('0x1b')]=_[_0xb692('0x1c')](config[_0xb692('0x1b')],{'host':_0xb692('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb692('0x1b')]));require(_0xb692('0x1e'))[_0xb692('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb692('0x20')][_0xb692('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x1e5c5b,_0x62df6a,_0x3d33b2,_0x51a61d){return new BPromise(function(_0x5258b7,_0x475b20){var _0x49e66f=_0x51a61d||client;return _0x49e66f['request'](_0x1e5c5b,_0x3d33b2)['then'](function(_0x11d0ee){logger[_0xb692('0x22')](_0xb692('0x23'),_0x62df6a,_0xb692('0x24'));logger[_0xb692('0x25')](_0xb692('0x26'),_0x62df6a,_0xb692('0x24'),JSON[_0xb692('0x27')](_0x11d0ee));if(_0x11d0ee[_0xb692('0x28')]){if(_0x11d0ee['error'][_0xb692('0x29')]===0x1f4){logger[_0xb692('0x28')](_0xb692('0x23'),_0x62df6a,_0x11d0ee[_0xb692('0x28')][_0xb692('0x2a')]);return _0x475b20(_0x11d0ee[_0xb692('0x28')][_0xb692('0x2a')]);}logger[_0xb692('0x28')](_0xb692('0x23'),_0x62df6a,_0x11d0ee[_0xb692('0x28')][_0xb692('0x2a')]);return _0x5258b7(_0x11d0ee['error'][_0xb692('0x2a')]);}else{logger[_0xb692('0x22')](_0xb692('0x23'),_0x62df6a,'request\x20sent');_0x5258b7(_0x11d0ee[_0xb692('0x2b')][_0xb692('0x2a')]);}})[_0xb692('0x2c')](function(_0x2b010d){logger[_0xb692('0x28')](_0xb692('0x23'),_0x62df6a,_0x2b010d);_0x475b20(_0x2b010d);});});}function respondWithStatusCode(_0x1cf3a3,_0x2ba0fc){_0x2ba0fc=_0x2ba0fc||0xcc;return function(_0x28a45c){if(_0x28a45c){return _0x1cf3a3['sendStatus'](_0x2ba0fc);}return _0x1cf3a3[_0xb692('0x2d')](_0x2ba0fc)['end']();};}function respondWithResult(_0x146f19,_0x557c7b){_0x557c7b=_0x557c7b||0xc8;return function(_0xbf3a99){if(_0xbf3a99){return _0x146f19[_0xb692('0x2d')](_0x557c7b)[_0xb692('0x2e')](_0xbf3a99);}};}function respondWithFilteredResult(_0x492bc9,_0x2d73e2){return function(_0x4aeb00){if(_0x4aeb00){var _0x1a15bb=typeof _0x2d73e2[_0xb692('0x2f')]===_0xb692('0x30')&&typeof _0x2d73e2[_0xb692('0x31')]===_0xb692('0x30');var _0x18aa0f=_0x4aeb00['count'];var _0x524b01=_0x1a15bb?0x0:_0x2d73e2[_0xb692('0x2f')];var _0x3d6ae5=_0x1a15bb?_0x4aeb00[_0xb692('0x32')]:_0x2d73e2[_0xb692('0x2f')]+_0x2d73e2[_0xb692('0x31')];var _0x250f77;if(_0x3d6ae5>=_0x18aa0f){_0x3d6ae5=_0x18aa0f;_0x250f77=0xc8;}else{_0x250f77=0xce;}_0x492bc9[_0xb692('0x2d')](_0x250f77);return _0x492bc9[_0xb692('0x33')](_0xb692('0x34'),_0x524b01+'-'+_0x3d6ae5+'/'+_0x18aa0f)['json'](_0x4aeb00);}return null;};}function patchUpdates(_0x4504a9){return function(_0x4613bd){try{jsonpatch[_0xb692('0x35')](_0x4613bd,_0x4504a9,!![]);}catch(_0x3333f2){return BPromise[_0xb692('0x36')](_0x3333f2);}return _0x4613bd[_0xb692('0x37')]();};}function saveUpdates(_0x1f23df,_0x1a287f){return function(_0x3306a2){if(_0x3306a2){return _0x3306a2[_0xb692('0x38')](_0x1f23df)[_0xb692('0x39')](function(_0x3e551b){return _0x3e551b;});}return null;};}function removeEntity(_0x19ca0a,_0x49c4cf){return function(_0x1717db){if(_0x1717db){return _0x1717db[_0xb692('0x3a')]()[_0xb692('0x39')](function(){var _0x487b6d=_0x1717db[_0xb692('0x3b')]({'plain':!![]});var _0x158eff='MailAccounts';return db[_0xb692('0x3c')][_0xb692('0x3a')]({'where':{'type':_0x158eff,'resourceId':_0x487b6d['id']}})[_0xb692('0x39')](function(){return _0x1717db;});})[_0xb692('0x39')](function(){_0x19ca0a['status'](0xcc)[_0xb692('0x3d')]();});}};}function handleEntityNotFound(_0x31dff0,_0x2a9378){return function(_0x21f56e){if(!_0x21f56e){_0x31dff0[_0xb692('0x3e')](0x194);}return _0x21f56e;};}function handleError(_0x54ed66,_0x58e288){_0x58e288=_0x58e288||0x1f4;return function(_0x2e7cc2){logger[_0xb692('0x28')](_0x2e7cc2['stack']);if(_0x2e7cc2[_0xb692('0x3f')]){delete _0x2e7cc2[_0xb692('0x3f')];}_0x54ed66[_0xb692('0x2d')](_0x58e288)[_0xb692('0x40')](_0x2e7cc2);};}exports['index']=function(_0x3f4dee,_0x16ae73){var _0x3589ed={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0xb692('0x41')}]},_0x314fd5={},_0x403df0={'count':0x0,'rows':[]};var _0x3ce22b=_[_0xb692('0x42')](db[_0xb692('0x43')][_0xb692('0x44')],function(_0x353ecf){return{'name':_0x353ecf[_0xb692('0x45')],'type':_0x353ecf[_0xb692('0x46')]['key']};});_0x314fd5['model']=_['map'](_0x3ce22b,_0xb692('0x3f'));_0x314fd5['query']=_['keys'](_0x3f4dee[_0xb692('0x47')]);_0x314fd5[_0xb692('0x48')]=_[_0xb692('0x49')](_0x314fd5[_0xb692('0x4a')],_0x314fd5['query']);_0x3589ed[_0xb692('0x4b')]=_['intersection'](_0x314fd5[_0xb692('0x4a')],qs[_0xb692('0x4c')](_0x3f4dee[_0xb692('0x47')][_0xb692('0x4c')]));_0x3589ed[_0xb692('0x4b')]=_0x3589ed[_0xb692('0x4b')][_0xb692('0x4d')]?_0x3589ed[_0xb692('0x4b')]:_0x314fd5[_0xb692('0x4a')];if(!_0x3f4dee['query']['hasOwnProperty'](_0xb692('0x4e'))){_0x3589ed[_0xb692('0x31')]=qs[_0xb692('0x31')](_0x3f4dee['query'][_0xb692('0x31')]);_0x3589ed[_0xb692('0x2f')]=qs[_0xb692('0x2f')](_0x3f4dee[_0xb692('0x47')][_0xb692('0x2f')]);}_0x3589ed['order']=qs[_0xb692('0x4f')](_0x3f4dee[_0xb692('0x47')]['sort']);_0x3589ed[_0xb692('0x50')]=qs[_0xb692('0x48')](_[_0xb692('0x51')](_0x3f4dee[_0xb692('0x47')],_0x314fd5[_0xb692('0x48')]),_0x3ce22b);if(_0x3f4dee[_0xb692('0x47')][_0xb692('0x52')]){_0x3589ed['where']=_[_0xb692('0x53')](_0x3589ed[_0xb692('0x50')],{'$or':_[_0xb692('0x42')](_0x3ce22b,function(_0x535048){if(_0x535048[_0xb692('0x46')]!==_0xb692('0x54')){var _0xeb4ac4={};_0xeb4ac4[_0x535048[_0xb692('0x3f')]]={'$like':'%'+_0x3f4dee[_0xb692('0x47')][_0xb692('0x52')]+'%'};return _0xeb4ac4;}})});}_0x3589ed=_['merge']({},_0x3589ed,_0x3f4dee['options']);var _0x3f56fb={'where':_0x3589ed[_0xb692('0x50')]};return db[_0xb692('0x43')][_0xb692('0x32')](_0x3f56fb)['then'](function(_0x1df807){_0x403df0[_0xb692('0x32')]=_0x1df807;if(_0x3f4dee['query']['includeAll']){_0x3589ed['include']=[{'all':!![]}];}return db['MailAccount'][_0xb692('0x55')](_0x3589ed);})[_0xb692('0x39')](function(_0x445ff0){_0x403df0['rows']=_0x445ff0;return _0x403df0;})[_0xb692('0x39')](respondWithFilteredResult(_0x16ae73,_0x3589ed))[_0xb692('0x2c')](handleError(_0x16ae73,null));};exports['show']=function(_0x120e43,_0x4602f1){var _0x43592a={'raw':![],'where':{'id':_0x120e43[_0xb692('0x56')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xb692('0x57')},{'model':db[_0xb692('0x58')],'as':_0xb692('0x41')}]},_0x4762b1={};_0x4762b1[_0xb692('0x4a')]=_[_0xb692('0x59')](db[_0xb692('0x43')][_0xb692('0x44')]);_0x4762b1[_0xb692('0x47')]=_['keys'](_0x120e43['query']);_0x4762b1['filters']=_['intersection'](_0x4762b1[_0xb692('0x4a')],_0x4762b1[_0xb692('0x47')]);_0x43592a[_0xb692('0x4b')]=_[_0xb692('0x49')](_0x4762b1['model'],qs[_0xb692('0x4c')](_0x120e43[_0xb692('0x47')][_0xb692('0x4c')]));_0x43592a['attributes']=_0x43592a[_0xb692('0x4b')][_0xb692('0x4d')]?_0x43592a['attributes']:_0x4762b1[_0xb692('0x4a')];if(_0x120e43[_0xb692('0x47')][_0xb692('0x5a')]){_0x43592a[_0xb692('0x5b')]=[{'all':!![]}];}_0x43592a=_['merge']({},_0x43592a,_0x120e43['options']);return db[_0xb692('0x43')][_0xb692('0x5c')](_0x43592a)[_0xb692('0x39')](handleEntityNotFound(_0x4602f1,null))[_0xb692('0x39')](respondWithResult(_0x4602f1,null))[_0xb692('0x2c')](handleError(_0x4602f1,null));};exports['update']=function(_0x1c46c6,_0x1e5a02){if(_0x1c46c6[_0xb692('0x5d')]['id']){delete _0x1c46c6[_0xb692('0x5d')]['id'];}return db[_0xb692('0x43')]['find']({'where':{'id':_0x1c46c6['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xb692('0x5e')},{'model':db[_0xb692('0x5f')],'as':_0xb692('0x57')},{'model':db[_0xb692('0x58')],'as':_0xb692('0x41')}]})['then'](handleEntityNotFound(_0x1e5a02,null))[_0xb692('0x39')](saveUpdates(_0x1c46c6[_0xb692('0x5d')],null))[_0xb692('0x39')](function(_0x4375fd){if(_0x4375fd&&_0x1c46c6['body'][_0xb692('0x5e')]){return db[_0xb692('0x60')]['update'](_0x1c46c6[_0xb692('0x5d')][_0xb692('0x5e')],{'where':{'MailAccountId':_0x4375fd['id']}})[_0xb692('0x39')](function(){return _0x4375fd;});}return _0x4375fd;})[_0xb692('0x39')](function(_0xa5b20d){if(_0xa5b20d&&_0x1c46c6[_0xb692('0x5d')][_0xb692('0x57')]){return db['MailServerOut']['update'](_0x1c46c6['body'][_0xb692('0x57')],{'where':{'MailAccountId':_0xa5b20d['id']}})['then'](function(){return _0xa5b20d;});}return _0xa5b20d;})[_0xb692('0x39')](respondWithResult(_0x1e5a02,null))[_0xb692('0x2c')](handleError(_0x1e5a02,null));};exports[_0xb692('0x61')]=function(_0x289035,_0x224135){return db[_0xb692('0x43')][_0xb692('0x61')]()[_0xb692('0x39')](respondWithResult(_0x224135,null))[_0xb692('0x2c')](handleError(_0x224135,null));};exports[_0xb692('0x62')]=function(_0x15d3af,_0x2bfcad,_0x1410b0){if(_0x15d3af['body']['id']){delete _0x15d3af[_0xb692('0x5d')]['id'];}return db[_0xb692('0x43')][_0xb692('0x5c')]({'where':{'id':_0x15d3af[_0xb692('0x56')]['id']}})['then'](handleEntityNotFound(_0x2bfcad,null))['then'](function(_0x50eba5){if(_0x50eba5){_0x15d3af[_0xb692('0x5d')]['MailAccountId']=_0x50eba5['id'];return db[_0xb692('0x63')][_0xb692('0x64')](_0x15d3af['body']);}})['then'](respondWithResult(_0x2bfcad,null))[_0xb692('0x2c')](handleError(_0x2bfcad,null));};exports[_0xb692('0x65')]=function(_0x57788c,_0x57d114,_0x558c57){var _0x15e524={'raw':![],'where':{}};var _0x540a8d={};var _0x3c7c2b={'count':0x0,'rows':[]};return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x57788c[_0xb692('0x56')]['id']}})['then'](handleEntityNotFound(_0x57d114,null))[_0xb692('0x39')](function(_0x1cb1b7){if(_0x1cb1b7){_0x540a8d[_0xb692('0x4a')]=_[_0xb692('0x59')](db[_0xb692('0x63')][_0xb692('0x44')]);_0x540a8d['query']=_[_0xb692('0x59')](_0x57788c['query']);_0x540a8d[_0xb692('0x48')]=_['intersection'](_0x540a8d[_0xb692('0x4a')],_0x540a8d[_0xb692('0x47')]);_0x15e524[_0xb692('0x4b')]=_[_0xb692('0x49')](_0x540a8d['model'],qs[_0xb692('0x4c')](_0x57788c['query'][_0xb692('0x4c')]));_0x15e524[_0xb692('0x4b')]=_0x15e524[_0xb692('0x4b')][_0xb692('0x4d')]?_0x15e524[_0xb692('0x4b')]:_0x540a8d[_0xb692('0x4a')];if(!_0x57788c[_0xb692('0x47')][_0xb692('0x67')](_0xb692('0x4e'))){_0x15e524[_0xb692('0x31')]=qs['limit'](_0x57788c[_0xb692('0x47')]['limit']);_0x15e524[_0xb692('0x2f')]=qs[_0xb692('0x2f')](_0x57788c[_0xb692('0x47')][_0xb692('0x2f')]);}_0x15e524['order']=qs[_0xb692('0x4f')](_0x57788c[_0xb692('0x47')][_0xb692('0x4f')]);_0x15e524[_0xb692('0x50')]=qs[_0xb692('0x48')](_[_0xb692('0x51')](_0x57788c[_0xb692('0x47')],_0x540a8d[_0xb692('0x48')]));_0x15e524['where']['MailAccountId']=_0x1cb1b7['id'];if(_0x57788c['query'][_0xb692('0x52')]){_0x15e524[_0xb692('0x50')]=_[_0xb692('0x53')](_0x15e524['where'],{'$or':_[_0xb692('0x42')](_0x15e524[_0xb692('0x4b')],function(_0x1724d3){var _0x457ee2={};_0x457ee2[_0x1724d3]={'$like':'%'+_0x57788c[_0xb692('0x47')][_0xb692('0x52')]+'%'};return _0x457ee2;})});}_0x15e524=_[_0xb692('0x53')]({},_0x15e524,_0x57788c[_0xb692('0x68')]);return db['Disposition']['count']({'where':_0x15e524[_0xb692('0x50')]})[_0xb692('0x39')](function(_0x2d31cc){_0x3c7c2b[_0xb692('0x32')]=_0x2d31cc;if(_0x57788c[_0xb692('0x47')][_0xb692('0x5a')]){_0x15e524[_0xb692('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0xb692('0x55')](_0x15e524);})[_0xb692('0x39')](function(_0x3610de){_0x3c7c2b['rows']=_0x3610de;return _0x3c7c2b;});}})['then'](respondWithFilteredResult(_0x57d114,_0x15e524))[_0xb692('0x2c')](handleError(_0x57d114,null));};exports[_0xb692('0x69')]=function(_0x504856,_0x26070d,_0x1d26d1){return db[_0xb692('0x43')][_0xb692('0x5c')]({'where':{'id':_0x504856['params']['id']}})['then'](handleEntityNotFound(_0x26070d,null))[_0xb692('0x39')](function(_0x3e46bd){if(_0x3e46bd){return _0x3e46bd[_0xb692('0x69')](_0x504856[_0xb692('0x47')][_0xb692('0x6a')]);}})[_0xb692('0x39')](respondWithStatusCode(_0x26070d,null))[_0xb692('0x2c')](handleError(_0x26070d,null));};exports['addAnswer']=function(_0x180e6e,_0x5209fd,_0x4d8fac){if(_0x180e6e[_0xb692('0x5d')]['id']){delete _0x180e6e[_0xb692('0x5d')]['id'];}return db['MailAccount'][_0xb692('0x5c')]({'where':{'id':_0x180e6e[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x5209fd,null))[_0xb692('0x39')](function(_0x13f356){if(_0x13f356){_0x180e6e[_0xb692('0x5d')][_0xb692('0x6b')]=_0x13f356['id'];return db[_0xb692('0x6c')]['create'](_0x180e6e[_0xb692('0x5d')]);}})[_0xb692('0x39')](respondWithResult(_0x5209fd,null))['catch'](handleError(_0x5209fd,null));};exports[_0xb692('0x6d')]=function(_0x1dfbe4,_0x38dcee,_0x2a58f7){var _0xbdf6c={'raw':![],'where':{}};var _0x560aea={};var _0x2ef03c={'count':0x0,'rows':[]};return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x1dfbe4['params']['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x38dcee,null))[_0xb692('0x39')](function(_0x2bf9f0){if(_0x2bf9f0){_0x560aea[_0xb692('0x4a')]=_[_0xb692('0x59')](db[_0xb692('0x6c')][_0xb692('0x44')]);_0x560aea[_0xb692('0x47')]=_['keys'](_0x1dfbe4[_0xb692('0x47')]);_0x560aea['filters']=_['intersection'](_0x560aea[_0xb692('0x4a')],_0x560aea[_0xb692('0x47')]);_0xbdf6c[_0xb692('0x4b')]=_[_0xb692('0x49')](_0x560aea[_0xb692('0x4a')],qs['fields'](_0x1dfbe4[_0xb692('0x47')]['fields']));_0xbdf6c[_0xb692('0x4b')]=_0xbdf6c[_0xb692('0x4b')]['length']?_0xbdf6c[_0xb692('0x4b')]:_0x560aea[_0xb692('0x4a')];if(!_0x1dfbe4[_0xb692('0x47')][_0xb692('0x67')]('nolimit')){_0xbdf6c[_0xb692('0x31')]=qs[_0xb692('0x31')](_0x1dfbe4[_0xb692('0x47')][_0xb692('0x31')]);_0xbdf6c[_0xb692('0x2f')]=qs[_0xb692('0x2f')](_0x1dfbe4[_0xb692('0x47')][_0xb692('0x2f')]);}_0xbdf6c['order']=qs[_0xb692('0x4f')](_0x1dfbe4[_0xb692('0x47')]['sort']);_0xbdf6c[_0xb692('0x50')]=qs[_0xb692('0x48')](_[_0xb692('0x51')](_0x1dfbe4[_0xb692('0x47')],_0x560aea['filters']));_0xbdf6c['where'][_0xb692('0x6b')]=_0x2bf9f0['id'];if(_0x1dfbe4[_0xb692('0x47')][_0xb692('0x52')]){_0xbdf6c[_0xb692('0x50')]=_['merge'](_0xbdf6c[_0xb692('0x50')],{'$or':_[_0xb692('0x42')](_0xbdf6c[_0xb692('0x4b')],function(_0x1da8fb){var _0x291c45={};_0x291c45[_0x1da8fb]={'$like':'%'+_0x1dfbe4[_0xb692('0x47')]['filter']+'%'};return _0x291c45;})});}_0xbdf6c=_[_0xb692('0x53')]({},_0xbdf6c,_0x1dfbe4['options']);return db['CannedAnswer'][_0xb692('0x32')]({'where':_0xbdf6c[_0xb692('0x50')]})[_0xb692('0x39')](function(_0x4993cc){_0x2ef03c[_0xb692('0x32')]=_0x4993cc;if(_0x1dfbe4[_0xb692('0x47')][_0xb692('0x5a')]){_0xbdf6c['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xb692('0x55')](_0xbdf6c);})['then'](function(_0x405c0c){_0x2ef03c[_0xb692('0x6e')]=_0x405c0c;return _0x2ef03c;});}})[_0xb692('0x39')](respondWithFilteredResult(_0x38dcee,_0xbdf6c))[_0xb692('0x2c')](handleError(_0x38dcee,null));};exports[_0xb692('0x6f')]=function(_0x35c188,_0xc6d2ae,_0x10c5e0){return db[_0xb692('0x43')]['find']({'where':{'id':_0x35c188[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0xc6d2ae,null))[_0xb692('0x39')](function(_0x46febd){if(_0x46febd){return _0x46febd['removeAnswers'](_0x35c188['query']['ids']);}})[_0xb692('0x39')](respondWithStatusCode(_0xc6d2ae,null))['catch'](handleError(_0xc6d2ae,null));};exports[_0xb692('0x64')]=function(_0x6ed017,_0x44e1e2){var _0x48bce4={'name':_0x6ed017[_0xb692('0x5d')][_0xb692('0x3f')],'key':_0x6ed017[_0xb692('0x5d')][_0xb692('0x70')],'email':_0x6ed017[_0xb692('0x5d')][_0xb692('0x71')],'ListId':_0x6ed017[_0xb692('0x5d')][_0xb692('0x72')],'active':!_['isNil'](_0x6ed017[_0xb692('0x5d')][_0xb692('0x73')])?_0x6ed017[_0xb692('0x5d')][_0xb692('0x73')]:!![],'description':_0x6ed017[_0xb692('0x5d')][_0xb692('0x74')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x6ed017[_0xb692('0x5d')][_0xb692('0x75')])){if(_0x6ed017[_0xb692('0x5d')]['cauthentication']){_0x48bce4[_0xb692('0x5e')][_0xb692('0x76')]=_0x48bce4['Smtp'][_0xb692('0x76')]=_0x6ed017[_0xb692('0x5d')][_0xb692('0x77')];_0x48bce4[_0xb692('0x5e')][_0xb692('0x78')]=_0x48bce4[_0xb692('0x57')]['pass']=_0x6ed017[_0xb692('0x5d')][_0xb692('0x79')];}else{_0x48bce4[_0xb692('0x5e')]['authentication']=_0x48bce4['Smtp'][_0xb692('0x7a')]=![];}_0x48bce4[_0xb692('0x5e')]['host']=_0x6ed017[_0xb692('0x5d')][_0xb692('0x5e')][_0xb692('0x7b')];_0x48bce4['Imap'][_0xb692('0x7c')]=_0x6ed017['body'][_0xb692('0x5e')]['port'];_0x48bce4[_0xb692('0x57')][_0xb692('0x7b')]=_0x6ed017[_0xb692('0x5d')][_0xb692('0x57')][_0xb692('0x7b')];_0x48bce4[_0xb692('0x57')][_0xb692('0x7c')]=_0x6ed017[_0xb692('0x5d')]['Smtp'][_0xb692('0x7c')];}else{_0x48bce4[_0xb692('0x5e')][_0xb692('0x7d')]=_0x48bce4[_0xb692('0x57')][_0xb692('0x7d')]=_0x6ed017[_0xb692('0x5d')][_0xb692('0x75')];_0x48bce4[_0xb692('0x5e')][_0xb692('0x76')]=_0x48bce4['Smtp'][_0xb692('0x76')]=_0x6ed017[_0xb692('0x5d')]['cuser'];_0x48bce4['Imap'][_0xb692('0x78')]=_0x48bce4['Smtp'][_0xb692('0x7e')]=_0x6ed017[_0xb692('0x5d')][_0xb692('0x79')];}return db[_0xb692('0x43')][_0xb692('0x64')](_0x48bce4,{'include':[{'model':db[_0xb692('0x5f')],'as':_0xb692('0x57')},{'model':db[_0xb692('0x60')],'as':_0xb692('0x5e')}]})['then'](function(_0x2d8b4e){var _0x3af2ac=_0x6ed017[_0xb692('0x76')][_0xb692('0x3b')]({'plain':!![]});if(!_0x3af2ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3af2ac[_0xb692('0x7f')]===_0xb692('0x76')){var _0x1a4bd2=_0x2d8b4e[_0xb692('0x3b')]({'plain':!![]});return db[_0xb692('0x80')][_0xb692('0x5c')]({'where':{'name':_0xb692('0x81'),'userProfileId':_0x3af2ac[_0xb692('0x82')]},'raw':!![]})[_0xb692('0x39')](function(_0x3201d8){if(_0x3201d8&&_0x3201d8[_0xb692('0x83')]===0x0){return db[_0xb692('0x3c')]['create']({'name':_0x1a4bd2[_0xb692('0x3f')],'resourceId':_0x1a4bd2['id'],'type':_0x3201d8[_0xb692('0x3f')],'sectionId':_0x3201d8['id']},{})[_0xb692('0x39')](function(){return _0x2d8b4e;});}else{return _0x2d8b4e;}})[_0xb692('0x2c')](function(_0x2df20f){logger['error'](_0xb692('0x84'),_0x2df20f);throw _0x2df20f;});}return _0x2d8b4e;})['then'](respondWithResult(_0x44e1e2,0xc9))[_0xb692('0x2c')](handleError(_0x44e1e2,null));};exports[_0xb692('0x85')]=function(_0x37b398,_0x2f5b91,_0x17988d){return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x37b398[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x2f5b91,null))[_0xb692('0x39')](function(_0x47bfe6){if(_0x47bfe6){return _0x47bfe6[_0xb692('0x85')]();}return null;})[_0xb692('0x39')](respondWithResult(_0x2f5b91,null))[_0xb692('0x2c')](handleError(_0x2f5b91,null));};exports[_0xb692('0x86')]=function(_0x3924a9,_0x4931fc,_0x56cbdb){if(_0x3924a9[_0xb692('0x5d')]['id']){delete _0x3924a9['body']['id'];}return db[_0xb692('0x43')]['find']({'where':{'id':_0x3924a9[_0xb692('0x56')]['id']}})['then'](handleEntityNotFound(_0x4931fc,null))[_0xb692('0x39')](function(_0x120872){if(_0x120872){_0x3924a9['body'][_0xb692('0x6b')]=_0x120872['id'];return db['MailServerIn'][_0xb692('0x64')](_0x3924a9['body']);}})[_0xb692('0x39')](respondWithResult(_0x4931fc,null))[_0xb692('0x2c')](handleError(_0x4931fc,null));};exports[_0xb692('0x87')]=function(_0x878ac1,_0xa72ad7,_0xb01aab){return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x878ac1[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0xa72ad7,null))[_0xb692('0x39')](function(_0x55b6dd){if(_0x55b6dd){return _0x55b6dd[_0xb692('0x88')](null);}return null;})[_0xb692('0x39')](respondWithStatusCode(_0xa72ad7,null))[_0xb692('0x2c')](handleError(_0xa72ad7,null));};exports[_0xb692('0x89')]=function(_0xf3b505,_0x4875eb,_0x2b7d04){return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0xf3b505[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x4875eb,null))[_0xb692('0x39')](function(_0x34f95f){if(_0x34f95f){return _0x34f95f[_0xb692('0x89')]();}return null;})[_0xb692('0x39')](respondWithResult(_0x4875eb,null))[_0xb692('0x2c')](handleError(_0x4875eb,null));};exports[_0xb692('0x8a')]=function(_0x66f98d,_0x35bd2c,_0x482018){if(_0x66f98d[_0xb692('0x5d')]['id']){delete _0x66f98d[_0xb692('0x5d')]['id'];}return db[_0xb692('0x43')][_0xb692('0x5c')]({'where':{'id':_0x66f98d['params']['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x35bd2c,null))[_0xb692('0x39')](function(_0x4128b5){if(_0x4128b5){_0x66f98d['body'][_0xb692('0x6b')]=_0x4128b5['id'];return db[_0xb692('0x5f')][_0xb692('0x64')](_0x66f98d[_0xb692('0x5d')]);}})[_0xb692('0x39')](respondWithResult(_0x35bd2c,null))['catch'](handleError(_0x35bd2c,null));};exports[_0xb692('0x8b')]=function(_0xa48bb0,_0x4b9383,_0x4947ef){return db['MailAccount'][_0xb692('0x66')]({'where':{'id':_0xa48bb0['params']['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x4b9383,null))[_0xb692('0x39')](function(_0x103e58){if(_0x103e58){return _0x103e58[_0xb692('0x8c')](null);}return null;})[_0xb692('0x39')](respondWithStatusCode(_0x4b9383,null))[_0xb692('0x2c')](handleError(_0x4b9383,null));};exports[_0xb692('0x8d')]=function(_0x107eaa,_0x279804,_0x62c220){return db['MailInteraction'][_0xb692('0x5c')]({'where':{'id':_0x107eaa[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x279804,null))['then'](function(_0x2c26bd){if(_0x2c26bd){return _0x2c26bd['addInteraction'](_0x107eaa['body'][_0xb692('0x6a')],_[_0xb692('0x8e')](_0x107eaa[_0xb692('0x5d')],[_0xb692('0x6a'),'id'])||{});}})[_0xb692('0x39')](respondWithResult(_0x279804,null))[_0xb692('0x2c')](handleError(_0x279804,null));};exports[_0xb692('0x8f')]=function(_0x587e76,_0x36953c,_0x44b39d){var _0x458967={'raw':![],'where':{}};var _0x1d99b={};var _0x2ae74f={'count':0x0,'rows':[]};return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x587e76[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x36953c,null))[_0xb692('0x39')](function(_0x2f8a76){if(_0x2f8a76){_0x1d99b[_0xb692('0x4a')]=_[_0xb692('0x59')](db[_0xb692('0x90')][_0xb692('0x44')]);_0x1d99b[_0xb692('0x47')]=_[_0xb692('0x59')](_0x587e76[_0xb692('0x47')]);_0x1d99b[_0xb692('0x48')]=_[_0xb692('0x49')](_0x1d99b[_0xb692('0x4a')],_0x1d99b[_0xb692('0x47')]);_0x458967[_0xb692('0x4b')]=_[_0xb692('0x49')](_0x1d99b[_0xb692('0x4a')],qs[_0xb692('0x4c')](_0x587e76[_0xb692('0x47')][_0xb692('0x4c')]));_0x458967[_0xb692('0x4b')]=_0x458967[_0xb692('0x4b')][_0xb692('0x4d')]?_0x458967['attributes']:_0x1d99b[_0xb692('0x4a')];if(!_0x587e76[_0xb692('0x47')]['hasOwnProperty'](_0xb692('0x4e'))){_0x458967[_0xb692('0x31')]=qs[_0xb692('0x31')](_0x587e76[_0xb692('0x47')][_0xb692('0x31')]);_0x458967[_0xb692('0x2f')]=qs[_0xb692('0x2f')](_0x587e76[_0xb692('0x47')]['offset']);}_0x458967[_0xb692('0x91')]=qs[_0xb692('0x4f')](_0x587e76[_0xb692('0x47')]['sort']);_0x458967[_0xb692('0x50')]=qs[_0xb692('0x48')](_[_0xb692('0x51')](_0x587e76[_0xb692('0x47')],_0x1d99b[_0xb692('0x48')]));_0x458967[_0xb692('0x50')][_0xb692('0x6b')]=_0x2f8a76['id'];if(_0x587e76['query']['filter']){_0x458967['where']=_[_0xb692('0x53')](_0x458967['where'],{'$or':_['map'](_0x458967[_0xb692('0x4b')],function(_0x2bdd0d){var _0x147530={};_0x147530[_0x2bdd0d]={'$like':'%'+_0x587e76[_0xb692('0x47')][_0xb692('0x52')]+'%'};return _0x147530;})});}_0x458967=_['merge']({},_0x458967,_0x587e76[_0xb692('0x68')]);return db['MailInteraction']['count']({'where':_0x458967[_0xb692('0x50')]})[_0xb692('0x39')](function(_0x41d314){_0x2ae74f[_0xb692('0x32')]=_0x41d314;if(_0x587e76[_0xb692('0x47')][_0xb692('0x5a')]){_0x458967[_0xb692('0x5b')]=[{'model':db[_0xb692('0x92')],'as':_0xb692('0x93'),'required':![]},{'model':db['User'],'as':_0xb692('0x94'),'attributes':['name','fullname',_0xb692('0x95')],'required':![]},{'model':db[_0xb692('0x96')],'as':'Tags','attributes':['id',_0xb692('0x3f'),_0xb692('0x97')],'where':_0x587e76[_0xb692('0x47')][_0xb692('0x98')]?{'id':_0x587e76[_0xb692('0x47')]['tag']}:undefined,'required':_0x587e76['query']['tag']?!![]:![]}];}return db[_0xb692('0x90')][_0xb692('0x55')](_0x458967);})[_0xb692('0x39')](function(_0x51bbb3){_0x2ae74f[_0xb692('0x6e')]=_0x51bbb3;return _0x2ae74f;});}})[_0xb692('0x39')](respondWithFilteredResult(_0x36953c,_0x458967))[_0xb692('0x2c')](handleError(_0x36953c,null));};exports[_0xb692('0x99')]=function(_0x33b4f6,_0x3fda4d,_0x3ccfa2){return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x33b4f6[_0xb692('0x56')]['id']}})['then'](handleEntityNotFound(_0x3fda4d,null))['then'](function(_0x4914f5){if(_0x4914f5){return db[_0xb692('0x9a')][_0xb692('0x9b')](function(_0x3af98d){return db['MailApplication'][_0xb692('0x3a')]({'where':{'MailAccountId':_0x33b4f6['params']['id']},'transaction':_0x3af98d})['then'](function(_0x4e4ba6){var _0x5a5ece=_['map'](_0x33b4f6[_0xb692('0x5d')],function(_0x210193){_0x210193[_0xb692('0x6b')]=_0x33b4f6[_0xb692('0x56')]['id'];return _0x210193;});return db['MailApplication'][_0xb692('0x9c')](_0x5a5ece,{'transaction':_0x3af98d});});})[_0xb692('0x39')](function(){return db[_0xb692('0x9d')][_0xb692('0x9e')]({'where':{'MailAccountId':_0x33b4f6[_0xb692('0x56')]['id']},'order':_0xb692('0x9f')});});}})[_0xb692('0x39')](respondWithResult(_0x3fda4d,null))['catch'](handleError(_0x3fda4d,null));};exports[_0xb692('0xa0')]=function(_0x4fdccf,_0x5a7686,_0xfd5b18){var _0x1851c6={};var _0x5dd188={};var _0x337767;var _0x433410;return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x4fdccf[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x5a7686,null))[_0xb692('0x39')](function(_0x5f2a78){if(_0x5f2a78){_0x337767=_0x5f2a78;_0x5dd188[_0xb692('0x4a')]=_[_0xb692('0x59')](db[_0xb692('0x9d')]['rawAttributes']);_0x5dd188[_0xb692('0x47')]=_[_0xb692('0x59')](_0x4fdccf[_0xb692('0x47')]);_0x5dd188[_0xb692('0x48')]=_['intersection'](_0x5dd188[_0xb692('0x4a')],_0x5dd188[_0xb692('0x47')]);_0x1851c6[_0xb692('0x4b')]=_['intersection'](_0x5dd188[_0xb692('0x4a')],qs[_0xb692('0x4c')](_0x4fdccf['query'][_0xb692('0x4c')]));_0x1851c6['attributes']=_0x1851c6['attributes'][_0xb692('0x4d')]?_0x1851c6['attributes']:_0x5dd188['model'];_0x1851c6[_0xb692('0x91')]=qs['sort'](_0x4fdccf[_0xb692('0x47')][_0xb692('0x4f')]);_0x1851c6[_0xb692('0x50')]=qs[_0xb692('0x48')](_['pick'](_0x4fdccf['query'],_0x5dd188[_0xb692('0x48')]));if(_0x4fdccf[_0xb692('0x47')][_0xb692('0x52')]){_0x1851c6[_0xb692('0x50')]=_[_0xb692('0x53')](_0x1851c6[_0xb692('0x50')],{'$or':_[_0xb692('0x42')](_0x1851c6[_0xb692('0x4b')],function(_0x3403c9){var _0x26a911={};_0x26a911[_0x3403c9]={'$like':'%'+_0x4fdccf[_0xb692('0x47')][_0xb692('0x52')]+'%'};return _0x26a911;})});}_0x1851c6=_[_0xb692('0x53')]({},_0x1851c6,_0x4fdccf[_0xb692('0x68')]);return _0x337767['getApplications'](_0x1851c6);}})[_0xb692('0x39')](function(_0x274884){if(_0x274884){_0x433410=_0x274884[_0xb692('0x4d')];if(!_0x4fdccf[_0xb692('0x47')]['hasOwnProperty'](_0xb692('0x4e'))){_0x1851c6['limit']=qs[_0xb692('0x31')](_0x4fdccf[_0xb692('0x47')]['limit']);_0x1851c6[_0xb692('0x2f')]=qs[_0xb692('0x2f')](_0x4fdccf[_0xb692('0x47')][_0xb692('0x2f')]);}return _0x337767[_0xb692('0xa0')](_0x1851c6);}})[_0xb692('0x39')](function(_0x1052dd){if(_0x1052dd){return _0x1052dd?{'count':_0x433410,'rows':_0x1052dd}:null;}})[_0xb692('0x39')](respondWithResult(_0x5a7686,null))['catch'](handleError(_0x5a7686,null));};exports[_0xb692('0xa1')]=function(_0x5f5b0b,_0x220abe,_0x32baf9){var _0x467194={'raw':!![],'where':{}};var _0x4f15ac={};var _0x37d4de={'count':0x0,'rows':[]};return db[_0xb692('0x43')][_0xb692('0x66')]({'where':{'id':_0x5f5b0b[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x220abe,null))[_0xb692('0x39')](function(_0xd52b79){if(_0xd52b79){_0x4f15ac[_0xb692('0x4a')]=_[_0xb692('0x59')](db['MailMessage'][_0xb692('0x44')]);_0x4f15ac[_0xb692('0x47')]=_[_0xb692('0x59')](_0x5f5b0b[_0xb692('0x47')]);_0x4f15ac['filters']=_[_0xb692('0x49')](_0x4f15ac[_0xb692('0x4a')],_0x4f15ac[_0xb692('0x47')]);_0x467194[_0xb692('0x4b')]=_[_0xb692('0x49')](_0x4f15ac[_0xb692('0x4a')],qs[_0xb692('0x4c')](_0x5f5b0b[_0xb692('0x47')][_0xb692('0x4c')]));_0x467194['attributes']=_0x467194[_0xb692('0x4b')]['length']?_0x467194[_0xb692('0x4b')]:_0x4f15ac[_0xb692('0x4a')];if(!_0x5f5b0b['query'][_0xb692('0x67')](_0xb692('0x4e'))){_0x467194[_0xb692('0x31')]=qs[_0xb692('0x31')](_0x5f5b0b['query'][_0xb692('0x31')]);_0x467194[_0xb692('0x2f')]=qs[_0xb692('0x2f')](_0x5f5b0b['query'][_0xb692('0x2f')]);}_0x467194[_0xb692('0x91')]=qs[_0xb692('0x4f')](_0x5f5b0b[_0xb692('0x47')][_0xb692('0x4f')]);_0x467194[_0xb692('0x50')]=qs[_0xb692('0x48')](_['pick'](_0x5f5b0b[_0xb692('0x47')],_0x4f15ac['filters']));_0x467194[_0xb692('0x50')]['MailAccountId']=_0xd52b79['id'];if(_0x5f5b0b[_0xb692('0x47')]['filter']){_0x467194[_0xb692('0x50')]=_['merge'](_0x467194[_0xb692('0x50')],{'$or':_['map'](_0x467194[_0xb692('0x4b')],function(_0xcc0014){var _0x632bc9={};_0x632bc9[_0xcc0014]={'$like':'%'+_0x5f5b0b['query']['filter']+'%'};return _0x632bc9;})});}if(_0x5f5b0b[_0xb692('0x47')]['$gte']){var _0x258cff=_0x5f5b0b[_0xb692('0x47')][_0xb692('0xa2')][_0xb692('0xa3')](',');var _0x4b6963={};_0x4b6963[_0x258cff[0x0]]={'$gte':moment(_0x258cff[0x1])['format'](_0xb692('0xa4'))};_0x467194[_0xb692('0x50')]=_[_0xb692('0x53')](_0x467194[_0xb692('0x50')],_0x4b6963);}_0x467194=_[_0xb692('0x53')]({},_0x467194,_0x5f5b0b[_0xb692('0x68')]);return db[_0xb692('0xa5')]['count']({'where':_0x467194[_0xb692('0x50')]})[_0xb692('0x39')](function(_0x1ea2f9){_0x37d4de[_0xb692('0x32')]=_0x1ea2f9;if(_0x5f5b0b['query']['includeAll']){_0x467194[_0xb692('0x5b')]=[{'all':!![]}];}return db[_0xb692('0xa5')][_0xb692('0x55')](_0x467194);})[_0xb692('0x39')](function(_0x175747){if(_0x5f5b0b['query'][_0xb692('0xa6')]==='true'){for(var _0xa103c2=0x0;_0xa103c2<_0x175747['length'];_0xa103c2++){_0x175747[_0xa103c2][_0xb692('0x5d')]=juice(_0x175747[_0xa103c2][_0xb692('0x5d')]);}}_0x37d4de['rows']=_0x175747;return _0x37d4de;});}})[_0xb692('0x39')](respondWithFilteredResult(_0x220abe,_0x467194))[_0xb692('0x2c')](handleError(_0x220abe,null));};exports['send']=function(_0x4cf227,_0x168ca5,_0x327b04){var _0x1f4bb9,_0xec55db={},_0x1ad464;if(_0x4cf227[_0xb692('0x5d')]['to']){_0x1ad464=_0x4cf227[_0xb692('0x5d')]['to'][_0xb692('0xa3')](',')[0x0];}return db[_0xb692('0x43')]['find']({'where':{'id':_0x4cf227[_0xb692('0x56')]['id']},'include':[{'model':db[_0xb692('0xa7')],'as':_0xb692('0xa8'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x1ad464},'limit':0x1,'order':[[_0xb692('0xa9'),_0xb692('0xaa')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x168ca5,null))[_0xb692('0x39')](function(_0x46b8d7){if(_0x46b8d7){_0x1f4bb9=_0x46b8d7;if(_0x46b8d7[_0xb692('0x57')]){if(_[_0xb692('0xab')](_0x4cf227['body'][_0xb692('0xac')])){_0x4cf227[_0xb692('0x5d')][_0xb692('0xac')]=util[_0xb692('0xad')](_0xb692('0xae'),_0x46b8d7[_0xb692('0x3f')],_0x46b8d7[_0xb692('0x71')]||_0x46b8d7['Smtp'][_0xb692('0x76')]);}if(_0x4cf227[_0xb692('0x5d')]['attachments']&&_0x4cf227['body'][_0xb692('0xaf')]['length']){for(var _0x164800=0x0;_0x164800<_0x4cf227[_0xb692('0x5d')][_0xb692('0xaf')][_0xb692('0x4d')];_0x164800+=0x1){_0x4cf227[_0xb692('0x5d')][_0xb692('0xaf')][_0x164800]={'filename':_0x4cf227[_0xb692('0x5d')]['attachments'][_0x164800][_0xb692('0x3f')],'path':path['join'](config[_0xb692('0xb0')],_0xb692('0xb1'),_0x4cf227[_0xb692('0x5d')][_0xb692('0xaf')][_0x164800][_0xb692('0xb2')])};}}var _0x43a646={'tls':{'rejectUnauthorized':![]}};if(_[_0xb692('0xab')](_0x46b8d7[_0xb692('0x57')][_0xb692('0x7d')])){if(_0x46b8d7['Smtp'][_0xb692('0x7a')]){_0x43a646[_0xb692('0xb3')]={'user':_0x46b8d7[_0xb692('0x57')]['user'],'pass':_0x46b8d7[_0xb692('0x57')][_0xb692('0x7e')]};}_0x43a646['host']=_0x46b8d7[_0xb692('0x57')][_0xb692('0x7b')];_0x43a646[_0xb692('0x7c')]=_0x46b8d7[_0xb692('0x57')][_0xb692('0x7c')];_0x43a646['secure']=_0x46b8d7[_0xb692('0x57')][_0xb692('0xb4')];}else{_0x43a646['service']=_0x46b8d7['Smtp'][_0xb692('0x7d')];_0x43a646['auth']={'user':_0x46b8d7[_0xb692('0x57')][_0xb692('0x76')],'pass':_0x46b8d7['Smtp'][_0xb692('0x7e')]};}return respondWithRpcPromise('SendMail',_0xb692('0xb5'),{'account':_0x43a646,'message':_0x4cf227['body']});}else{throw new Error(_0xb692('0xb6'));}}})[_0xb692('0x39')](function(_0x1678fa){if(_0x1678fa){_0xec55db=_0x1678fa;if(_0x1f4bb9[_0xb692('0xa8')]){if(_0x1f4bb9[_0xb692('0xa8')][_0xb692('0xb7')]['length']){return _0x1f4bb9['List']['Contacts'][0x0];}else{return db[_0xb692('0x92')][_0xb692('0x64')](_['defaults'](_0x4cf227[_0xb692('0x5d')],{'firstName':_0x4cf227['body']['to'],'email':_0x4cf227[_0xb692('0x5d')]['to'],'phone':_0x4cf227[_0xb692('0x5d')]['to'],'ListId':_0x1f4bb9[_0xb692('0x72')]}));}}else{throw new Error(_0xb692('0xb6'));}}})[_0xb692('0x39')](function(_0x350019){if(_0x350019){var _0x1c7267={'UserId':_0x4cf227[_0xb692('0x76')]['id'],'ContactId':_0x350019['id'],'MailAccountId':_0x1f4bb9['id'],'inReplyTo':_0xec55db[_0xb692('0xb8')],'to':_0x4cf227[_0xb692('0x5d')][_0xb692('0xac')],'cc':_0x4cf227[_0xb692('0x5d')]['cc'],'subject':_0x4cf227[_0xb692('0x5d')][_0xb692('0xb9')],'attach':_0x4cf227[_0xb692('0x5d')][_0xb692('0xba')],'firstMsgDirection':_0xb692('0xbb'),'lastMsgAt':moment()[_0xb692('0xad')](_0xb692('0xa4')),'lastMsgDirection':_0xb692('0xbb'),'Messages':[_[_0xb692('0x53')](_0x4cf227[_0xb692('0x5d')],{'messageId':_0xec55db['messageId'],'sentAt':moment()['format'](_0xb692('0xa4')),'read':!![],'MailAccountId':_0x1f4bb9['id'],'UserId':_0x4cf227[_0xb692('0x76')]['id'],'ContactId':_0x350019['id']})]};if(_0x4cf227[_0xb692('0x5d')][_0xb692('0xbc')]){_0x1c7267=_[_0xb692('0x53')](_0x1c7267,_0x4cf227[_0xb692('0x5d')][_0xb692('0xbc')]);}return db[_0xb692('0x90')][_0xb692('0x64')](_0x1c7267,{'include':[{'model':db['MailMessage'],'as':_0xb692('0xbd')}]});}})['then'](respondWithResult(_0x168ca5,null))[_0xb692('0x2c')](handleError(_0x168ca5,null));};exports[_0xb692('0xbe')]=function(_0x4e77c9,_0x5a6fc0,_0x9ec48d){return db['MailAccount'][_0xb692('0x5c')]({'where':{'id':_0x4e77c9[_0xb692('0x56')]['id']},'include':[{'model':db[_0xb692('0x5f')],'as':'Smtp','raw':!![]}]})[_0xb692('0x39')](handleEntityNotFound(_0x5a6fc0,null))[_0xb692('0x39')](function(_0x29da6f){if(_0x29da6f&&_0x29da6f[_0xb692('0x57')]){var _0xb22274={'id':_0x29da6f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x29da6f[_0xb692('0x57')][_0xb692('0x7d')]){_0xb22274[_0xb692('0x7d')]=_0x29da6f[_0xb692('0x57')][_0xb692('0x7d')];}else{_0xb22274[_0xb692('0x7b')]=_0x29da6f[_0xb692('0x57')][_0xb692('0x7b')];_0xb22274[_0xb692('0x7c')]=_0x29da6f['Smtp'][_0xb692('0x7c')];_0xb22274[_0xb692('0xb4')]=_0x29da6f[_0xb692('0x57')][_0xb692('0xb4')];}if(_0x29da6f[_0xb692('0x57')]['authentication']){_0xb22274[_0xb692('0xb3')]={'user':_0x29da6f[_0xb692('0x57')][_0xb692('0x76')],'pass':_0x29da6f[_0xb692('0x57')][_0xb692('0x7e')]};}return respondWithRpcPromise(_0xb692('0xbf'),_0xb692('0xbe'),{'account':_0xb22274});}})[_0xb692('0x39')](respondWithResult(_0x5a6fc0,null))['catch'](handleError(_0x5a6fc0,null));};exports[_0xb692('0x3a')]=function(_0x5d45c8,_0x327aa0){return db[_0xb692('0x43')][_0xb692('0x5c')]({'where':{'id':_0x5d45c8[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x327aa0,null))[_0xb692('0x39')](function(_0xb939eb){if(_0xb939eb&&_0xb939eb[_0xb692('0x7d')]){throw new db[(_0xb692('0xc0'))][(_0xb692('0xc1'))](_0xb692('0xc2'));}return _0xb939eb;})[_0xb692('0x39')](removeEntity(_0x327aa0,null))[_0xb692('0x2c')](handleError(_0x327aa0,null));};exports[_0xb692('0xc3')]=function(_0x3f1544,_0x53531b,_0x5207db){return db[_0xb692('0x43')]['find']({'where':{'id':_0x3f1544[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x53531b,null))[_0xb692('0x39')](function(_0x16465a){if(_0x16465a){return _0x16465a['addAgents'](_0x3f1544[_0xb692('0x5d')][_0xb692('0x6a')],_[_0xb692('0x8e')](_0x3f1544['body'],[_0xb692('0x6a'),'id'])||{})[_0xb692('0xc4')](function(_0x1e45db){for(var _0xafd72b=0x0;_0xafd72b<_0x3f1544['body']['ids']['length'];_0xafd72b+=0x1){socket[_0xb692('0xc5')](_0xb692('0xc6'),{'UserId':Number(_0x3f1544[_0xb692('0x5d')][_0xb692('0x6a')][_0xafd72b]),'MailAccountId':Number(_0x3f1544[_0xb692('0x56')]['id'])});}return _0x1e45db;});}})[_0xb692('0x39')](respondWithResult(_0x53531b,null))[_0xb692('0x2c')](handleError(_0x53531b,null));};exports['removeAgents']=function(_0x3b748d,_0x3d071a,_0x538b14){return db[_0xb692('0x43')][_0xb692('0x5c')]({'where':{'id':_0x3b748d['params']['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x3d071a,null))[_0xb692('0x39')](function(_0x18e50e){if(_0x18e50e){return _0x18e50e[_0xb692('0xc7')](_0x3b748d[_0xb692('0x47')][_0xb692('0x6a')])[_0xb692('0x39')](function(){if(_[_0xb692('0xc8')](_0x3b748d[_0xb692('0x47')][_0xb692('0x6a')])){for(var _0x20df9b=0x0;_0x20df9b<_0x3b748d[_0xb692('0x47')]['ids'][_0xb692('0x4d')];_0x20df9b+=0x1){socket['emit'](_0xb692('0xc9'),{'UserId':Number(_0x3b748d[_0xb692('0x47')]['ids'][_0x20df9b]),'MailAccountId':Number(_0x3b748d['params']['id'])});}}else{socket[_0xb692('0xc5')](_0xb692('0xc9'),{'UserId':Number(_0x3b748d[_0xb692('0x47')][_0xb692('0x6a')]),'MailAccountId':Number(_0x3b748d['params']['id'])});}});}})[_0xb692('0x39')](respondWithStatusCode(_0x3d071a,null))['catch'](handleError(_0x3d071a,null));};exports[_0xb692('0xca')]=function(_0x50d65e,_0x2868cc,_0x3bf1d7){var _0x5f48a5={};var _0x41d247={};var _0x1edbfa;var _0x484b51;return db['MailAccount'][_0xb692('0x66')]({'where':{'id':_0x50d65e[_0xb692('0x56')]['id']}})[_0xb692('0x39')](handleEntityNotFound(_0x2868cc,null))[_0xb692('0x39')](function(_0x3d7b5e){if(_0x3d7b5e){_0x1edbfa=_0x3d7b5e;_0x41d247['model']=_[_0xb692('0x59')](db[_0xb692('0xcb')][_0xb692('0x44')]);_0x41d247['query']=_[_0xb692('0x59')](_0x50d65e['query']);_0x41d247[_0xb692('0x48')]=_['intersection'](_0x41d247[_0xb692('0x4a')],_0x41d247[_0xb692('0x47')]);_0x5f48a5[_0xb692('0x4b')]=_[_0xb692('0x49')](_0x41d247[_0xb692('0x4a')],qs['fields'](_0x50d65e[_0xb692('0x47')]['fields']));_0x5f48a5[_0xb692('0x4b')]=_0x5f48a5[_0xb692('0x4b')][_0xb692('0x4d')]?_0x5f48a5['attributes']:_0x41d247[_0xb692('0x4a')];_0x5f48a5['order']=qs[_0xb692('0x4f')](_0x50d65e[_0xb692('0x47')][_0xb692('0x4f')]);_0x5f48a5[_0xb692('0x50')]=qs['filters'](_['pick'](_0x50d65e['query'],_0x41d247[_0xb692('0x48')]));if(_0x50d65e['query'][_0xb692('0x52')]){_0x5f48a5['where']=_[_0xb692('0x53')](_0x5f48a5[_0xb692('0x50')],{'$or':_[_0xb692('0x42')](_0x5f48a5[_0xb692('0x4b')],function(_0x520bfb){var _0x5d5ca9={};_0x5d5ca9[_0x520bfb]={'$like':'%'+_0x50d65e['query'][_0xb692('0x52')]+'%'};return _0x5d5ca9;})});}_0x5f48a5=_['merge']({},_0x5f48a5,_0x50d65e[_0xb692('0x68')]);return _0x1edbfa[_0xb692('0xca')](_0x5f48a5);}})['then'](function(_0x443468){if(_0x443468){_0x484b51=_0x443468['length'];if(!_0x50d65e['query'][_0xb692('0x67')](_0xb692('0x4e'))){_0x5f48a5[_0xb692('0x31')]=qs[_0xb692('0x31')](_0x50d65e[_0xb692('0x47')][_0xb692('0x31')]);_0x5f48a5['offset']=qs[_0xb692('0x2f')](_0x50d65e[_0xb692('0x47')]['offset']);}return _0x1edbfa[_0xb692('0xca')](_0x5f48a5);}})[_0xb692('0x39')](function(_0x1d012b){if(_0x1d012b){return _0x1d012b?{'count':_0x484b51,'rows':_0x1d012b}:null;}})[_0xb692('0x39')](respondWithResult(_0x2868cc,null))[_0xb692('0x2c')](handleError(_0x2868cc,null));}; \ No newline at end of file +var _0xf559=['verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','querystring','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','offset','limit','undefined','status','set','Content-Range','apply','save','update','then','destroy','MailAccounts','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','count','include','findAll','rows','show','mandatoryDispositionPause','includeAll','find','body','params','describe','MailAccountId','create','getDispositions','Disposition','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','email','ListId','active','isNil','cservice','user','cuser','password','pass','authentication','host','port','service','cpassword','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','MailMessage','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','Contacts','defaults','messageId','attach','out','format','Interaction','Messages','VerifySmtp'];(function(_0x57de63,_0x516f89){var _0xce9a21=function(_0x23e45c){while(--_0x23e45c){_0x57de63['push'](_0x57de63['shift']());}};_0xce9a21(++_0x516f89);}(_0xf559,0x18c));var _0x9f55=function(_0x207ca2,_0xe16bf9){_0x207ca2=_0x207ca2-0x0;var _0x59c037=_0xf559[_0x207ca2];return _0x59c037;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f55('0x0'));var zipdir=require(_0x9f55('0x1'));var jsonpatch=require(_0x9f55('0x2'));var rp=require(_0x9f55('0x3'));var moment=require(_0x9f55('0x4'));var BPromise=require(_0x9f55('0x5'));var Mustache=require('mustache');var util=require(_0x9f55('0x6'));var path=require(_0x9f55('0x7'));var sox=require(_0x9f55('0x8'));var csv=require(_0x9f55('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9f55('0xa'));var crypto=require(_0x9f55('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f55('0x9'));var querystring=require(_0x9f55('0xc'));var Papa=require(_0x9f55('0xd'));var htmlToText=require('html-to-text');var juice=require(_0x9f55('0xe'));var Redis=require(_0x9f55('0xf'));var authService=require(_0x9f55('0x10'));var qs=require(_0x9f55('0x11'));var as=require(_0x9f55('0x12'));var hardwareService=require(_0x9f55('0x13'));var logger=require(_0x9f55('0x14'))(_0x9f55('0x15'));var utils=require(_0x9f55('0x16'));var config=require(_0x9f55('0x17'));var licenseUtil=require(_0x9f55('0x18'));var db=require(_0x9f55('0x19'))['db'];config[_0x9f55('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f55('0x1b'))(new Redis(config[_0x9f55('0x1a')]));require('./mailAccount.socket')[_0x9f55('0x1c')](socket);var jayson=require(_0x9f55('0x1d'));var client=jayson[_0x9f55('0x1e')]['http']({'port':0x232b});function respondWithRpcPromise(_0x576f5e,_0x5c5c28,_0x38057b,_0x40ed2e){return new BPromise(function(_0x47730d,_0x216991){var _0x886e00=_0x40ed2e||client;return _0x886e00['request'](_0x576f5e,_0x38057b)['then'](function(_0x4d0fe0){logger[_0x9f55('0x1f')](_0x9f55('0x20'),_0x5c5c28,_0x9f55('0x21'));logger[_0x9f55('0x22')](_0x9f55('0x23'),_0x5c5c28,_0x9f55('0x21'),JSON[_0x9f55('0x24')](_0x4d0fe0));if(_0x4d0fe0[_0x9f55('0x25')]){if(_0x4d0fe0[_0x9f55('0x25')]['code']===0x1f4){logger[_0x9f55('0x25')](_0x9f55('0x20'),_0x5c5c28,_0x4d0fe0[_0x9f55('0x25')]['message']);return _0x216991(_0x4d0fe0[_0x9f55('0x25')][_0x9f55('0x26')]);}logger[_0x9f55('0x25')](_0x9f55('0x20'),_0x5c5c28,_0x4d0fe0[_0x9f55('0x25')]['message']);return _0x47730d(_0x4d0fe0[_0x9f55('0x25')]['message']);}else{logger[_0x9f55('0x1f')](_0x9f55('0x20'),_0x5c5c28,_0x9f55('0x21'));_0x47730d(_0x4d0fe0['result'][_0x9f55('0x26')]);}})[_0x9f55('0x27')](function(_0x131a49){logger[_0x9f55('0x25')](_0x9f55('0x20'),_0x5c5c28,_0x131a49);_0x216991(_0x131a49);});});}function respondWithStatusCode(_0x38a384,_0x42c751){_0x42c751=_0x42c751||0xcc;return function(_0x5435ac){if(_0x5435ac){return _0x38a384[_0x9f55('0x28')](_0x42c751);}return _0x38a384['status'](_0x42c751)[_0x9f55('0x29')]();};}function respondWithResult(_0x4b0026,_0x10c5b8){_0x10c5b8=_0x10c5b8||0xc8;return function(_0x190769){if(_0x190769){return _0x4b0026['status'](_0x10c5b8)[_0x9f55('0x2a')](_0x190769);}};}function respondWithFilteredResult(_0x5f0fc2,_0x2fbcb6){return function(_0x44ab7c){if(_0x44ab7c){var _0x5763e6=typeof _0x2fbcb6[_0x9f55('0x2b')]==='undefined'&&typeof _0x2fbcb6[_0x9f55('0x2c')]===_0x9f55('0x2d');var _0x3b48e0=_0x44ab7c['count'];var _0x5809f9=_0x5763e6?0x0:_0x2fbcb6[_0x9f55('0x2b')];var _0x280fb5=_0x5763e6?_0x44ab7c['count']:_0x2fbcb6[_0x9f55('0x2b')]+_0x2fbcb6[_0x9f55('0x2c')];var _0x5122b0;if(_0x280fb5>=_0x3b48e0){_0x280fb5=_0x3b48e0;_0x5122b0=0xc8;}else{_0x5122b0=0xce;}_0x5f0fc2[_0x9f55('0x2e')](_0x5122b0);return _0x5f0fc2[_0x9f55('0x2f')](_0x9f55('0x30'),_0x5809f9+'-'+_0x280fb5+'/'+_0x3b48e0)['json'](_0x44ab7c);}return null;};}function patchUpdates(_0x121535){return function(_0x5598b4){try{jsonpatch[_0x9f55('0x31')](_0x5598b4,_0x121535,!![]);}catch(_0x46f7dc){return BPromise['reject'](_0x46f7dc);}return _0x5598b4[_0x9f55('0x32')]();};}function saveUpdates(_0x18fcd5,_0x581dca){return function(_0x3e3065){if(_0x3e3065){return _0x3e3065[_0x9f55('0x33')](_0x18fcd5)[_0x9f55('0x34')](function(_0x3badab){return _0x3badab;});}return null;};}function removeEntity(_0x1a36b5,_0x1f79af){return function(_0x190354){if(_0x190354){return _0x190354[_0x9f55('0x35')]()[_0x9f55('0x34')](function(){var _0x5d3ee7=_0x190354['get']({'plain':!![]});var _0x1f1e11=_0x9f55('0x36');return db[_0x9f55('0x37')][_0x9f55('0x35')]({'where':{'type':_0x1f1e11,'resourceId':_0x5d3ee7['id']}})[_0x9f55('0x34')](function(){return _0x190354;});})['then'](function(){_0x1a36b5['status'](0xcc)[_0x9f55('0x29')]();});}};}function handleEntityNotFound(_0x45ebb5,_0x2e3022){return function(_0x41f90d){if(!_0x41f90d){_0x45ebb5[_0x9f55('0x28')](0x194);}return _0x41f90d;};}function handleError(_0x1496aa,_0xa0088){_0xa0088=_0xa0088||0x1f4;return function(_0x27b8cc){logger[_0x9f55('0x25')](_0x27b8cc[_0x9f55('0x38')]);if(_0x27b8cc[_0x9f55('0x39')]){delete _0x27b8cc[_0x9f55('0x39')];}_0x1496aa['status'](_0xa0088)[_0x9f55('0x3a')](_0x27b8cc);};}exports['index']=function(_0x45f2ef,_0x92d1b4){var _0x4500fd={'include':[{'model':db[_0x9f55('0x3b')],'as':_0x9f55('0x3c')},{'model':db[_0x9f55('0x3d')],'as':_0x9f55('0x3e')},{'model':db[_0x9f55('0x3f')],'as':'mandatoryDispositionPause'}]},_0x56f122={},_0x513832={'count':0x0,'rows':[]};var _0x391e8a=_['map'](db[_0x9f55('0x40')][_0x9f55('0x41')],function(_0x5bf5bf){return{'name':_0x5bf5bf[_0x9f55('0x42')],'type':_0x5bf5bf[_0x9f55('0x43')][_0x9f55('0x44')]};});_0x56f122[_0x9f55('0x45')]=_[_0x9f55('0x46')](_0x391e8a,_0x9f55('0x39'));_0x56f122[_0x9f55('0x47')]=_[_0x9f55('0x48')](_0x45f2ef[_0x9f55('0x47')]);_0x56f122[_0x9f55('0x49')]=_[_0x9f55('0x4a')](_0x56f122[_0x9f55('0x45')],_0x56f122[_0x9f55('0x47')]);_0x4500fd[_0x9f55('0x4b')]=_[_0x9f55('0x4a')](_0x56f122['model'],qs[_0x9f55('0x4c')](_0x45f2ef[_0x9f55('0x47')]['fields']));_0x4500fd[_0x9f55('0x4b')]=_0x4500fd[_0x9f55('0x4b')][_0x9f55('0x4d')]?_0x4500fd[_0x9f55('0x4b')]:_0x56f122[_0x9f55('0x45')];if(!_0x45f2ef[_0x9f55('0x47')][_0x9f55('0x4e')]('nolimit')){_0x4500fd[_0x9f55('0x2c')]=qs[_0x9f55('0x2c')](_0x45f2ef[_0x9f55('0x47')][_0x9f55('0x2c')]);_0x4500fd[_0x9f55('0x2b')]=qs['offset'](_0x45f2ef[_0x9f55('0x47')][_0x9f55('0x2b')]);}_0x4500fd[_0x9f55('0x4f')]=qs[_0x9f55('0x50')](_0x45f2ef['query'][_0x9f55('0x50')]);_0x4500fd['where']=qs['filters'](_[_0x9f55('0x51')](_0x45f2ef['query'],_0x56f122[_0x9f55('0x49')]),_0x391e8a);if(_0x45f2ef[_0x9f55('0x47')][_0x9f55('0x52')]){_0x4500fd['where']=_[_0x9f55('0x53')](_0x4500fd[_0x9f55('0x54')],{'$or':_[_0x9f55('0x46')](_0x391e8a,function(_0x11468f){if(_0x11468f[_0x9f55('0x43')]!==_0x9f55('0x55')){var _0x11863c={};_0x11863c[_0x11468f[_0x9f55('0x39')]]={'$like':'%'+_0x45f2ef['query']['filter']+'%'};return _0x11863c;}})});}_0x4500fd=_[_0x9f55('0x53')]({},_0x4500fd,_0x45f2ef[_0x9f55('0x56')]);var _0x1b3d6b={'where':_0x4500fd['where']};return db[_0x9f55('0x40')][_0x9f55('0x57')](_0x1b3d6b)[_0x9f55('0x34')](function(_0x179cc1){_0x513832['count']=_0x179cc1;if(_0x45f2ef['query']['includeAll']){_0x4500fd[_0x9f55('0x58')]=[{'all':!![]}];}return db[_0x9f55('0x40')][_0x9f55('0x59')](_0x4500fd);})[_0x9f55('0x34')](function(_0x49bf64){_0x513832[_0x9f55('0x5a')]=_0x49bf64;return _0x513832;})[_0x9f55('0x34')](respondWithFilteredResult(_0x92d1b4,_0x4500fd))[_0x9f55('0x27')](handleError(_0x92d1b4,null));};exports[_0x9f55('0x5b')]=function(_0x55f03e,_0x5af741){var _0x2a0933={'raw':![],'where':{'id':_0x55f03e['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x9f55('0x3c')},{'model':db[_0x9f55('0x3d')],'as':_0x9f55('0x3e')},{'model':db[_0x9f55('0x3f')],'as':_0x9f55('0x5c')}]},_0x5c8b6f={};_0x5c8b6f[_0x9f55('0x45')]=_['keys'](db['MailAccount'][_0x9f55('0x41')]);_0x5c8b6f['query']=_[_0x9f55('0x48')](_0x55f03e['query']);_0x5c8b6f[_0x9f55('0x49')]=_[_0x9f55('0x4a')](_0x5c8b6f[_0x9f55('0x45')],_0x5c8b6f['query']);_0x2a0933['attributes']=_['intersection'](_0x5c8b6f['model'],qs[_0x9f55('0x4c')](_0x55f03e[_0x9f55('0x47')]['fields']));_0x2a0933['attributes']=_0x2a0933[_0x9f55('0x4b')]['length']?_0x2a0933['attributes']:_0x5c8b6f[_0x9f55('0x45')];if(_0x55f03e['query'][_0x9f55('0x5d')]){_0x2a0933[_0x9f55('0x58')]=[{'all':!![]}];}_0x2a0933=_[_0x9f55('0x53')]({},_0x2a0933,_0x55f03e[_0x9f55('0x56')]);return db['MailAccount'][_0x9f55('0x5e')](_0x2a0933)[_0x9f55('0x34')](handleEntityNotFound(_0x5af741,null))[_0x9f55('0x34')](respondWithResult(_0x5af741,null))['catch'](handleError(_0x5af741,null));};exports[_0x9f55('0x33')]=function(_0x5c2fbf,_0x3843f0){if(_0x5c2fbf['body']['id']){delete _0x5c2fbf[_0x9f55('0x5f')]['id'];}return db[_0x9f55('0x40')][_0x9f55('0x5e')]({'where':{'id':_0x5c2fbf[_0x9f55('0x60')]['id']},'include':[{'model':db[_0x9f55('0x3b')],'as':_0x9f55('0x3c')},{'model':db['MailServerOut'],'as':_0x9f55('0x3e')},{'model':db[_0x9f55('0x3f')],'as':_0x9f55('0x5c')}]})[_0x9f55('0x34')](handleEntityNotFound(_0x3843f0,null))[_0x9f55('0x34')](saveUpdates(_0x5c2fbf[_0x9f55('0x5f')],null))[_0x9f55('0x34')](function(_0xb2d7b7){if(_0xb2d7b7&&_0x5c2fbf[_0x9f55('0x5f')][_0x9f55('0x3c')]){return db[_0x9f55('0x3b')][_0x9f55('0x33')](_0x5c2fbf[_0x9f55('0x5f')]['Imap'],{'where':{'MailAccountId':_0xb2d7b7['id']}})[_0x9f55('0x34')](function(){return _0xb2d7b7;});}return _0xb2d7b7;})[_0x9f55('0x34')](function(_0x2d2f8e){if(_0x2d2f8e&&_0x5c2fbf[_0x9f55('0x5f')][_0x9f55('0x3e')]){return db[_0x9f55('0x3d')][_0x9f55('0x33')](_0x5c2fbf['body'][_0x9f55('0x3e')],{'where':{'MailAccountId':_0x2d2f8e['id']}})[_0x9f55('0x34')](function(){return _0x2d2f8e;});}return _0x2d2f8e;})[_0x9f55('0x34')](respondWithResult(_0x3843f0,null))[_0x9f55('0x27')](handleError(_0x3843f0,null));};exports['describe']=function(_0x16a510,_0x1a6a3b){return db[_0x9f55('0x40')][_0x9f55('0x61')]()[_0x9f55('0x34')](respondWithResult(_0x1a6a3b,null))['catch'](handleError(_0x1a6a3b,null));};exports['addDisposition']=function(_0x377774,_0x52ac2b,_0x1f04a2){if(_0x377774['body']['id']){delete _0x377774[_0x9f55('0x5f')]['id'];}return db[_0x9f55('0x40')]['find']({'where':{'id':_0x377774['params']['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x52ac2b,null))[_0x9f55('0x34')](function(_0x2c65c0){if(_0x2c65c0){_0x377774[_0x9f55('0x5f')][_0x9f55('0x62')]=_0x2c65c0['id'];return db['Disposition'][_0x9f55('0x63')](_0x377774[_0x9f55('0x5f')]);}})[_0x9f55('0x34')](respondWithResult(_0x52ac2b,null))[_0x9f55('0x27')](handleError(_0x52ac2b,null));};exports[_0x9f55('0x64')]=function(_0x575f0f,_0x51968d,_0x508ba1){var _0x11aaea={'raw':![],'where':{}};var _0x52ef9c={};var _0x3702fe={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x575f0f[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x51968d,null))[_0x9f55('0x34')](function(_0x14e003){if(_0x14e003){_0x52ef9c['model']=_['keys'](db[_0x9f55('0x65')][_0x9f55('0x41')]);_0x52ef9c[_0x9f55('0x47')]=_['keys'](_0x575f0f[_0x9f55('0x47')]);_0x52ef9c['filters']=_[_0x9f55('0x4a')](_0x52ef9c[_0x9f55('0x45')],_0x52ef9c[_0x9f55('0x47')]);_0x11aaea[_0x9f55('0x4b')]=_['intersection'](_0x52ef9c['model'],qs[_0x9f55('0x4c')](_0x575f0f[_0x9f55('0x47')]['fields']));_0x11aaea[_0x9f55('0x4b')]=_0x11aaea[_0x9f55('0x4b')][_0x9f55('0x4d')]?_0x11aaea['attributes']:_0x52ef9c['model'];if(!_0x575f0f[_0x9f55('0x47')][_0x9f55('0x4e')](_0x9f55('0x66'))){_0x11aaea[_0x9f55('0x2c')]=qs[_0x9f55('0x2c')](_0x575f0f['query']['limit']);_0x11aaea[_0x9f55('0x2b')]=qs['offset'](_0x575f0f[_0x9f55('0x47')][_0x9f55('0x2b')]);}_0x11aaea['order']=qs[_0x9f55('0x50')](_0x575f0f['query'][_0x9f55('0x50')]);_0x11aaea['where']=qs[_0x9f55('0x49')](_[_0x9f55('0x51')](_0x575f0f[_0x9f55('0x47')],_0x52ef9c[_0x9f55('0x49')]));_0x11aaea[_0x9f55('0x54')][_0x9f55('0x62')]=_0x14e003['id'];if(_0x575f0f[_0x9f55('0x47')][_0x9f55('0x52')]){_0x11aaea[_0x9f55('0x54')]=_[_0x9f55('0x53')](_0x11aaea[_0x9f55('0x54')],{'$or':_[_0x9f55('0x46')](_0x11aaea[_0x9f55('0x4b')],function(_0x34fa8c){var _0x1f1b4b={};_0x1f1b4b[_0x34fa8c]={'$like':'%'+_0x575f0f[_0x9f55('0x47')]['filter']+'%'};return _0x1f1b4b;})});}_0x11aaea=_[_0x9f55('0x53')]({},_0x11aaea,_0x575f0f[_0x9f55('0x56')]);return db[_0x9f55('0x65')][_0x9f55('0x57')]({'where':_0x11aaea[_0x9f55('0x54')]})[_0x9f55('0x34')](function(_0x58eea8){_0x3702fe['count']=_0x58eea8;if(_0x575f0f[_0x9f55('0x47')]['includeAll']){_0x11aaea[_0x9f55('0x58')]=[{'all':!![]}];}return db[_0x9f55('0x65')][_0x9f55('0x59')](_0x11aaea);})[_0x9f55('0x34')](function(_0x14ac5a){_0x3702fe[_0x9f55('0x5a')]=_0x14ac5a;return _0x3702fe;});}})['then'](respondWithFilteredResult(_0x51968d,_0x11aaea))[_0x9f55('0x27')](handleError(_0x51968d,null));};exports[_0x9f55('0x67')]=function(_0x11d591,_0x75d440,_0x4f9dbb){return db[_0x9f55('0x40')]['find']({'where':{'id':_0x11d591[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x75d440,null))['then'](function(_0x14b51d){if(_0x14b51d){return _0x14b51d[_0x9f55('0x67')](_0x11d591['query']['ids']);}})['then'](respondWithStatusCode(_0x75d440,null))['catch'](handleError(_0x75d440,null));};exports[_0x9f55('0x68')]=function(_0x434db7,_0x32e649,_0x19ea12){if(_0x434db7[_0x9f55('0x5f')]['id']){delete _0x434db7['body']['id'];}return db[_0x9f55('0x40')][_0x9f55('0x5e')]({'where':{'id':_0x434db7[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x32e649,null))[_0x9f55('0x34')](function(_0xdcfa6d){if(_0xdcfa6d){_0x434db7['body'][_0x9f55('0x62')]=_0xdcfa6d['id'];return db[_0x9f55('0x69')]['create'](_0x434db7['body']);}})['then'](respondWithResult(_0x32e649,null))[_0x9f55('0x27')](handleError(_0x32e649,null));};exports[_0x9f55('0x6a')]=function(_0x734593,_0x2b6b4f,_0x51b3fd){var _0x5231eb={'raw':![],'where':{}};var _0x561b77={};var _0x16bff3={'count':0x0,'rows':[]};return db['MailAccount'][_0x9f55('0x6b')]({'where':{'id':_0x734593[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x2b6b4f,null))[_0x9f55('0x34')](function(_0x4a2184){if(_0x4a2184){_0x561b77[_0x9f55('0x45')]=_[_0x9f55('0x48')](db[_0x9f55('0x69')][_0x9f55('0x41')]);_0x561b77[_0x9f55('0x47')]=_['keys'](_0x734593['query']);_0x561b77[_0x9f55('0x49')]=_['intersection'](_0x561b77[_0x9f55('0x45')],_0x561b77['query']);_0x5231eb['attributes']=_['intersection'](_0x561b77[_0x9f55('0x45')],qs[_0x9f55('0x4c')](_0x734593[_0x9f55('0x47')][_0x9f55('0x4c')]));_0x5231eb[_0x9f55('0x4b')]=_0x5231eb[_0x9f55('0x4b')][_0x9f55('0x4d')]?_0x5231eb['attributes']:_0x561b77[_0x9f55('0x45')];if(!_0x734593[_0x9f55('0x47')][_0x9f55('0x4e')](_0x9f55('0x66'))){_0x5231eb[_0x9f55('0x2c')]=qs[_0x9f55('0x2c')](_0x734593['query']['limit']);_0x5231eb['offset']=qs[_0x9f55('0x2b')](_0x734593['query'][_0x9f55('0x2b')]);}_0x5231eb['order']=qs[_0x9f55('0x50')](_0x734593['query'][_0x9f55('0x50')]);_0x5231eb[_0x9f55('0x54')]=qs[_0x9f55('0x49')](_[_0x9f55('0x51')](_0x734593['query'],_0x561b77[_0x9f55('0x49')]));_0x5231eb[_0x9f55('0x54')][_0x9f55('0x62')]=_0x4a2184['id'];if(_0x734593[_0x9f55('0x47')][_0x9f55('0x52')]){_0x5231eb[_0x9f55('0x54')]=_[_0x9f55('0x53')](_0x5231eb[_0x9f55('0x54')],{'$or':_[_0x9f55('0x46')](_0x5231eb[_0x9f55('0x4b')],function(_0x5aa63a){var _0x402408={};_0x402408[_0x5aa63a]={'$like':'%'+_0x734593[_0x9f55('0x47')][_0x9f55('0x52')]+'%'};return _0x402408;})});}_0x5231eb=_[_0x9f55('0x53')]({},_0x5231eb,_0x734593[_0x9f55('0x56')]);return db[_0x9f55('0x69')][_0x9f55('0x57')]({'where':_0x5231eb[_0x9f55('0x54')]})[_0x9f55('0x34')](function(_0x53e65c){_0x16bff3[_0x9f55('0x57')]=_0x53e65c;if(_0x734593[_0x9f55('0x47')][_0x9f55('0x5d')]){_0x5231eb[_0x9f55('0x58')]=[{'all':!![]}];}return db[_0x9f55('0x69')][_0x9f55('0x59')](_0x5231eb);})[_0x9f55('0x34')](function(_0x9b518c){_0x16bff3['rows']=_0x9b518c;return _0x16bff3;});}})['then'](respondWithFilteredResult(_0x2b6b4f,_0x5231eb))[_0x9f55('0x27')](handleError(_0x2b6b4f,null));};exports[_0x9f55('0x6c')]=function(_0x9fa4c3,_0x44a30b,_0x479fd3){return db[_0x9f55('0x40')]['find']({'where':{'id':_0x9fa4c3[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x44a30b,null))[_0x9f55('0x34')](function(_0x4c2ce0){if(_0x4c2ce0){return _0x4c2ce0[_0x9f55('0x6c')](_0x9fa4c3[_0x9f55('0x47')][_0x9f55('0x6d')]);}})[_0x9f55('0x34')](respondWithStatusCode(_0x44a30b,null))[_0x9f55('0x27')](handleError(_0x44a30b,null));};exports[_0x9f55('0x63')]=function(_0x592d68,_0x3e9758){var _0x428a2b={'name':_0x592d68[_0x9f55('0x5f')][_0x9f55('0x39')],'key':_0x592d68[_0x9f55('0x5f')]['key'],'email':_0x592d68['body'][_0x9f55('0x6e')],'ListId':_0x592d68[_0x9f55('0x5f')][_0x9f55('0x6f')],'active':!_['isNil'](_0x592d68['body'][_0x9f55('0x70')])?_0x592d68[_0x9f55('0x5f')][_0x9f55('0x70')]:!![],'description':_0x592d68['body']['description']||null,'Imap':{},'Smtp':{}};if(_[_0x9f55('0x71')](_0x592d68[_0x9f55('0x5f')][_0x9f55('0x72')])){if(_0x592d68[_0x9f55('0x5f')]['cauthentication']){_0x428a2b[_0x9f55('0x3c')][_0x9f55('0x73')]=_0x428a2b[_0x9f55('0x3e')][_0x9f55('0x73')]=_0x592d68[_0x9f55('0x5f')][_0x9f55('0x74')];_0x428a2b['Imap'][_0x9f55('0x75')]=_0x428a2b[_0x9f55('0x3e')][_0x9f55('0x76')]=_0x592d68[_0x9f55('0x5f')]['cpassword'];}else{_0x428a2b[_0x9f55('0x3c')][_0x9f55('0x77')]=_0x428a2b[_0x9f55('0x3e')][_0x9f55('0x77')]=![];}_0x428a2b['Imap'][_0x9f55('0x78')]=_0x592d68[_0x9f55('0x5f')][_0x9f55('0x3c')][_0x9f55('0x78')];_0x428a2b[_0x9f55('0x3c')][_0x9f55('0x79')]=_0x592d68[_0x9f55('0x5f')]['Imap']['port'];_0x428a2b['Smtp'][_0x9f55('0x78')]=_0x592d68['body'][_0x9f55('0x3e')][_0x9f55('0x78')];_0x428a2b['Smtp'][_0x9f55('0x79')]=_0x592d68[_0x9f55('0x5f')]['Smtp']['port'];}else{_0x428a2b['Imap'][_0x9f55('0x7a')]=_0x428a2b[_0x9f55('0x3e')][_0x9f55('0x7a')]=_0x592d68[_0x9f55('0x5f')][_0x9f55('0x72')];_0x428a2b[_0x9f55('0x3c')]['user']=_0x428a2b[_0x9f55('0x3e')][_0x9f55('0x73')]=_0x592d68[_0x9f55('0x5f')][_0x9f55('0x74')];_0x428a2b[_0x9f55('0x3c')][_0x9f55('0x75')]=_0x428a2b[_0x9f55('0x3e')]['pass']=_0x592d68[_0x9f55('0x5f')][_0x9f55('0x7b')];}return db['MailAccount']['create'](_0x428a2b,{'include':[{'model':db[_0x9f55('0x3d')],'as':_0x9f55('0x3e')},{'model':db[_0x9f55('0x3b')],'as':_0x9f55('0x3c')}]})[_0x9f55('0x34')](function(_0x53fb18){var _0x44934e=_0x592d68[_0x9f55('0x73')][_0x9f55('0x7c')]({'plain':!![]});if(!_0x44934e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44934e[_0x9f55('0x7d')]===_0x9f55('0x73')){var _0x165328=_0x53fb18[_0x9f55('0x7c')]({'plain':!![]});return db[_0x9f55('0x7e')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x44934e['userProfileId']},'raw':!![]})[_0x9f55('0x34')](function(_0x329e8e){if(_0x329e8e&&_0x329e8e['autoAssociation']===0x0){return db[_0x9f55('0x37')][_0x9f55('0x63')]({'name':_0x165328['name'],'resourceId':_0x165328['id'],'type':_0x329e8e['name'],'sectionId':_0x329e8e['id']},{})[_0x9f55('0x34')](function(){return _0x53fb18;});}else{return _0x53fb18;}})[_0x9f55('0x27')](function(_0x1da23d){logger[_0x9f55('0x25')](_0x9f55('0x7f'),_0x1da23d);throw _0x1da23d;});}return _0x53fb18;})[_0x9f55('0x34')](respondWithResult(_0x3e9758,0xc9))['catch'](handleError(_0x3e9758,null));};exports[_0x9f55('0x80')]=function(_0x392892,_0x1a6439,_0xc0995){return db[_0x9f55('0x40')][_0x9f55('0x6b')]({'where':{'id':_0x392892[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x1a6439,null))[_0x9f55('0x34')](function(_0x5e3c18){if(_0x5e3c18){return _0x5e3c18[_0x9f55('0x80')]();}return null;})[_0x9f55('0x34')](respondWithResult(_0x1a6439,null))['catch'](handleError(_0x1a6439,null));};exports[_0x9f55('0x81')]=function(_0x271158,_0x55349b,_0x57f68){if(_0x271158[_0x9f55('0x5f')]['id']){delete _0x271158['body']['id'];}return db[_0x9f55('0x40')][_0x9f55('0x5e')]({'where':{'id':_0x271158[_0x9f55('0x60')]['id']}})['then'](handleEntityNotFound(_0x55349b,null))['then'](function(_0x1f212d){if(_0x1f212d){_0x271158[_0x9f55('0x5f')][_0x9f55('0x62')]=_0x1f212d['id'];return db[_0x9f55('0x3b')][_0x9f55('0x63')](_0x271158[_0x9f55('0x5f')]);}})[_0x9f55('0x34')](respondWithResult(_0x55349b,null))[_0x9f55('0x27')](handleError(_0x55349b,null));};exports[_0x9f55('0x82')]=function(_0x80a1c8,_0x3e3136,_0x37382e){return db[_0x9f55('0x40')][_0x9f55('0x6b')]({'where':{'id':_0x80a1c8[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x3e3136,null))['then'](function(_0x3a2f8c){if(_0x3a2f8c){return _0x3a2f8c[_0x9f55('0x83')](null);}return null;})[_0x9f55('0x34')](respondWithStatusCode(_0x3e3136,null))['catch'](handleError(_0x3e3136,null));};exports[_0x9f55('0x84')]=function(_0x1c42b0,_0x27534e,_0x2c8bd5){return db[_0x9f55('0x40')]['findOne']({'where':{'id':_0x1c42b0[_0x9f55('0x60')]['id']}})['then'](handleEntityNotFound(_0x27534e,null))[_0x9f55('0x34')](function(_0xea6a0){if(_0xea6a0){return _0xea6a0[_0x9f55('0x84')]();}return null;})[_0x9f55('0x34')](respondWithResult(_0x27534e,null))[_0x9f55('0x27')](handleError(_0x27534e,null));};exports['addSmtp']=function(_0x1cf682,_0x4b172d,_0x1bab3d){if(_0x1cf682[_0x9f55('0x5f')]['id']){delete _0x1cf682[_0x9f55('0x5f')]['id'];}return db[_0x9f55('0x40')]['find']({'where':{'id':_0x1cf682[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x4b172d,null))[_0x9f55('0x34')](function(_0x35ecdb){if(_0x35ecdb){_0x1cf682[_0x9f55('0x5f')][_0x9f55('0x62')]=_0x35ecdb['id'];return db[_0x9f55('0x3d')][_0x9f55('0x63')](_0x1cf682[_0x9f55('0x5f')]);}})[_0x9f55('0x34')](respondWithResult(_0x4b172d,null))[_0x9f55('0x27')](handleError(_0x4b172d,null));};exports[_0x9f55('0x85')]=function(_0x9b9b0,_0x35f36c,_0x1ec6bf){return db[_0x9f55('0x40')]['findOne']({'where':{'id':_0x9b9b0['params']['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x35f36c,null))[_0x9f55('0x34')](function(_0x39b68f){if(_0x39b68f){return _0x39b68f[_0x9f55('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x35f36c,null))[_0x9f55('0x27')](handleError(_0x35f36c,null));};exports[_0x9f55('0x87')]=function(_0x553c8d,_0xab9632,_0x575971){return db['MailInteraction'][_0x9f55('0x5e')]({'where':{'id':_0x553c8d[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0xab9632,null))['then'](function(_0x5621ae){if(_0x5621ae){return _0x5621ae[_0x9f55('0x87')](_0x553c8d[_0x9f55('0x5f')][_0x9f55('0x6d')],_['omit'](_0x553c8d[_0x9f55('0x5f')],[_0x9f55('0x6d'),'id'])||{});}})['then'](respondWithResult(_0xab9632,null))[_0x9f55('0x27')](handleError(_0xab9632,null));};exports[_0x9f55('0x88')]=function(_0x947e98,_0x314b2d,_0x48845a){var _0x20c858={'raw':![],'where':{}};var _0x38cec1={};var _0x187a0b={'count':0x0,'rows':[]};return db[_0x9f55('0x40')][_0x9f55('0x6b')]({'where':{'id':_0x947e98[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x314b2d,null))[_0x9f55('0x34')](function(_0x5c155e){if(_0x5c155e){_0x38cec1[_0x9f55('0x45')]=_[_0x9f55('0x48')](db[_0x9f55('0x89')]['rawAttributes']);_0x38cec1[_0x9f55('0x47')]=_[_0x9f55('0x48')](_0x947e98[_0x9f55('0x47')]);_0x38cec1[_0x9f55('0x49')]=_[_0x9f55('0x4a')](_0x38cec1[_0x9f55('0x45')],_0x38cec1[_0x9f55('0x47')]);_0x20c858[_0x9f55('0x4b')]=_['intersection'](_0x38cec1[_0x9f55('0x45')],qs['fields'](_0x947e98[_0x9f55('0x47')][_0x9f55('0x4c')]));_0x20c858['attributes']=_0x20c858[_0x9f55('0x4b')][_0x9f55('0x4d')]?_0x20c858[_0x9f55('0x4b')]:_0x38cec1[_0x9f55('0x45')];if(!_0x947e98[_0x9f55('0x47')][_0x9f55('0x4e')](_0x9f55('0x66'))){_0x20c858[_0x9f55('0x2c')]=qs[_0x9f55('0x2c')](_0x947e98['query'][_0x9f55('0x2c')]);_0x20c858['offset']=qs['offset'](_0x947e98[_0x9f55('0x47')][_0x9f55('0x2b')]);}_0x20c858[_0x9f55('0x4f')]=qs['sort'](_0x947e98[_0x9f55('0x47')][_0x9f55('0x50')]);_0x20c858[_0x9f55('0x54')]=qs[_0x9f55('0x49')](_['pick'](_0x947e98[_0x9f55('0x47')],_0x38cec1['filters']));_0x20c858[_0x9f55('0x54')][_0x9f55('0x62')]=_0x5c155e['id'];if(_0x947e98['query'][_0x9f55('0x52')]){_0x20c858[_0x9f55('0x54')]=_[_0x9f55('0x53')](_0x20c858[_0x9f55('0x54')],{'$or':_[_0x9f55('0x46')](_0x20c858[_0x9f55('0x4b')],function(_0x1fbac5){var _0x2472d8={};_0x2472d8[_0x1fbac5]={'$like':'%'+_0x947e98[_0x9f55('0x47')][_0x9f55('0x52')]+'%'};return _0x2472d8;})});}_0x20c858=_[_0x9f55('0x53')]({},_0x20c858,_0x947e98[_0x9f55('0x56')]);return db[_0x9f55('0x89')][_0x9f55('0x57')]({'where':_0x20c858[_0x9f55('0x54')]})[_0x9f55('0x34')](function(_0x5f18de){_0x187a0b[_0x9f55('0x57')]=_0x5f18de;if(_0x947e98['query'][_0x9f55('0x5d')]){_0x20c858['include']=[{'model':db[_0x9f55('0x8a')],'as':_0x9f55('0x8b'),'required':![]},{'model':db[_0x9f55('0x8c')],'as':_0x9f55('0x8d'),'attributes':['name',_0x9f55('0x8e'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9f55('0x39'),'color'],'where':_0x947e98[_0x9f55('0x47')]['tag']?{'id':_0x947e98[_0x9f55('0x47')][_0x9f55('0x8f')]}:undefined,'required':_0x947e98[_0x9f55('0x47')][_0x9f55('0x8f')]?!![]:![]}];}return db[_0x9f55('0x89')][_0x9f55('0x59')](_0x20c858);})[_0x9f55('0x34')](function(_0x194fda){_0x187a0b[_0x9f55('0x5a')]=_0x194fda;return _0x187a0b;});}})['then'](respondWithFilteredResult(_0x314b2d,_0x20c858))['catch'](handleError(_0x314b2d,null));};exports[_0x9f55('0x90')]=function(_0x3bd732,_0x146125,_0x10bfc6){return db['MailAccount'][_0x9f55('0x6b')]({'where':{'id':_0x3bd732[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x146125,null))[_0x9f55('0x34')](function(_0x1a0d7c){if(_0x1a0d7c){return db[_0x9f55('0x91')][_0x9f55('0x92')](function(_0x17d8e1){return db[_0x9f55('0x93')][_0x9f55('0x35')]({'where':{'MailAccountId':_0x3bd732[_0x9f55('0x60')]['id']},'transaction':_0x17d8e1})[_0x9f55('0x34')](function(_0x53f02d){var _0x5768a9=_[_0x9f55('0x46')](_0x3bd732[_0x9f55('0x5f')],function(_0x4f7571){_0x4f7571['MailAccountId']=_0x3bd732[_0x9f55('0x60')]['id'];return _0x4f7571;});return db[_0x9f55('0x93')]['bulkCreate'](_0x5768a9,{'transaction':_0x17d8e1});});})['then'](function(){return db[_0x9f55('0x93')][_0x9f55('0x94')]({'where':{'MailAccountId':_0x3bd732[_0x9f55('0x60')]['id']},'order':_0x9f55('0x95')});});}})[_0x9f55('0x34')](respondWithResult(_0x146125,null))[_0x9f55('0x27')](handleError(_0x146125,null));};exports['getApplications']=function(_0x57fc37,_0x1e6953,_0x402753){var _0x4c373d={};var _0x3f9d17={};var _0x4070f7;var _0x3fbb20;return db[_0x9f55('0x40')][_0x9f55('0x6b')]({'where':{'id':_0x57fc37[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x1e6953,null))[_0x9f55('0x34')](function(_0x3d653b){if(_0x3d653b){_0x4070f7=_0x3d653b;_0x3f9d17['model']=_['keys'](db[_0x9f55('0x93')]['rawAttributes']);_0x3f9d17[_0x9f55('0x47')]=_[_0x9f55('0x48')](_0x57fc37[_0x9f55('0x47')]);_0x3f9d17[_0x9f55('0x49')]=_[_0x9f55('0x4a')](_0x3f9d17[_0x9f55('0x45')],_0x3f9d17[_0x9f55('0x47')]);_0x4c373d[_0x9f55('0x4b')]=_[_0x9f55('0x4a')](_0x3f9d17[_0x9f55('0x45')],qs['fields'](_0x57fc37['query'][_0x9f55('0x4c')]));_0x4c373d[_0x9f55('0x4b')]=_0x4c373d[_0x9f55('0x4b')]['length']?_0x4c373d[_0x9f55('0x4b')]:_0x3f9d17[_0x9f55('0x45')];_0x4c373d[_0x9f55('0x4f')]=qs[_0x9f55('0x50')](_0x57fc37[_0x9f55('0x47')]['sort']);_0x4c373d['where']=qs['filters'](_[_0x9f55('0x51')](_0x57fc37[_0x9f55('0x47')],_0x3f9d17[_0x9f55('0x49')]));if(_0x57fc37[_0x9f55('0x47')][_0x9f55('0x52')]){_0x4c373d['where']=_[_0x9f55('0x53')](_0x4c373d[_0x9f55('0x54')],{'$or':_['map'](_0x4c373d[_0x9f55('0x4b')],function(_0x57db7c){var _0x5693fc={};_0x5693fc[_0x57db7c]={'$like':'%'+_0x57fc37[_0x9f55('0x47')]['filter']+'%'};return _0x5693fc;})});}_0x4c373d=_[_0x9f55('0x53')]({},_0x4c373d,_0x57fc37[_0x9f55('0x56')]);return _0x4070f7[_0x9f55('0x96')](_0x4c373d);}})['then'](function(_0x2d9a5c){if(_0x2d9a5c){_0x3fbb20=_0x2d9a5c[_0x9f55('0x4d')];if(!_0x57fc37['query'][_0x9f55('0x4e')](_0x9f55('0x66'))){_0x4c373d[_0x9f55('0x2c')]=qs[_0x9f55('0x2c')](_0x57fc37[_0x9f55('0x47')]['limit']);_0x4c373d[_0x9f55('0x2b')]=qs[_0x9f55('0x2b')](_0x57fc37[_0x9f55('0x47')][_0x9f55('0x2b')]);}return _0x4070f7[_0x9f55('0x96')](_0x4c373d);}})[_0x9f55('0x34')](function(_0x1ec18c){if(_0x1ec18c){return _0x1ec18c?{'count':_0x3fbb20,'rows':_0x1ec18c}:null;}})['then'](respondWithResult(_0x1e6953,null))[_0x9f55('0x27')](handleError(_0x1e6953,null));};exports['getMessages']=function(_0x283895,_0x580b54,_0x165a6d){var _0x51137c={'raw':!![],'where':{}};var _0x41e4e7={};var _0x4ef774={'count':0x0,'rows':[]};return db['MailAccount'][_0x9f55('0x6b')]({'where':{'id':_0x283895[_0x9f55('0x60')]['id']}})['then'](handleEntityNotFound(_0x580b54,null))[_0x9f55('0x34')](function(_0x4b4009){if(_0x4b4009){_0x41e4e7['model']=_['keys'](db[_0x9f55('0x97')][_0x9f55('0x41')]);_0x41e4e7[_0x9f55('0x47')]=_[_0x9f55('0x48')](_0x283895['query']);_0x41e4e7['filters']=_[_0x9f55('0x4a')](_0x41e4e7[_0x9f55('0x45')],_0x41e4e7['query']);_0x51137c[_0x9f55('0x4b')]=_[_0x9f55('0x4a')](_0x41e4e7['model'],qs['fields'](_0x283895['query'][_0x9f55('0x4c')]));_0x51137c[_0x9f55('0x4b')]=_0x51137c[_0x9f55('0x4b')][_0x9f55('0x4d')]?_0x51137c[_0x9f55('0x4b')]:_0x41e4e7[_0x9f55('0x45')];if(!_0x283895['query']['hasOwnProperty']('nolimit')){_0x51137c[_0x9f55('0x2c')]=qs[_0x9f55('0x2c')](_0x283895['query'][_0x9f55('0x2c')]);_0x51137c['offset']=qs[_0x9f55('0x2b')](_0x283895['query']['offset']);}_0x51137c['order']=qs['sort'](_0x283895[_0x9f55('0x47')][_0x9f55('0x50')]);_0x51137c[_0x9f55('0x54')]=qs[_0x9f55('0x49')](_[_0x9f55('0x51')](_0x283895[_0x9f55('0x47')],_0x41e4e7[_0x9f55('0x49')]));_0x51137c[_0x9f55('0x54')][_0x9f55('0x62')]=_0x4b4009['id'];if(_0x283895[_0x9f55('0x47')]['filter']){_0x51137c['where']=_[_0x9f55('0x53')](_0x51137c['where'],{'$or':_[_0x9f55('0x46')](_0x51137c['attributes'],function(_0x4dfa58){var _0x5bd0ec={};_0x5bd0ec[_0x4dfa58]={'$like':'%'+_0x283895[_0x9f55('0x47')][_0x9f55('0x52')]+'%'};return _0x5bd0ec;})});}if(_0x283895[_0x9f55('0x47')]['$gte']){var _0xe83653=_0x283895['query']['$gte'][_0x9f55('0x98')](',');var _0x47772f={};_0x47772f[_0xe83653[0x0]]={'$gte':moment(_0xe83653[0x1])['format'](_0x9f55('0x99'))};_0x51137c[_0x9f55('0x54')]=_[_0x9f55('0x53')](_0x51137c[_0x9f55('0x54')],_0x47772f);}_0x51137c=_[_0x9f55('0x53')]({},_0x51137c,_0x283895[_0x9f55('0x56')]);return db[_0x9f55('0x97')][_0x9f55('0x57')]({'where':_0x51137c[_0x9f55('0x54')]})[_0x9f55('0x34')](function(_0x391153){_0x4ef774[_0x9f55('0x57')]=_0x391153;if(_0x283895['query']['includeAll']){_0x51137c[_0x9f55('0x58')]=[{'all':!![]}];}return db[_0x9f55('0x97')][_0x9f55('0x59')](_0x51137c);})[_0x9f55('0x34')](function(_0x171cab){if(_0x283895[_0x9f55('0x47')][_0x9f55('0x9a')]===_0x9f55('0x9b')){for(var _0x28ea74=0x0;_0x28ea74<_0x171cab[_0x9f55('0x4d')];_0x28ea74++){_0x171cab[_0x28ea74][_0x9f55('0x5f')]=juice(_0x171cab[_0x28ea74]['body']);}}_0x4ef774[_0x9f55('0x5a')]=_0x171cab;return _0x4ef774;});}})['then'](respondWithFilteredResult(_0x580b54,_0x51137c))[_0x9f55('0x27')](handleError(_0x580b54,null));};exports[_0x9f55('0x3a')]=function(_0x3bb41c,_0x31d609,_0x499246){var _0x4344ec,_0x355973={},_0x35d223;if(_0x3bb41c[_0x9f55('0x5f')]['to']){_0x35d223=_0x3bb41c[_0x9f55('0x5f')]['to'][_0x9f55('0x98')](',')[0x0];}return db[_0x9f55('0x40')][_0x9f55('0x5e')]({'where':{'id':_0x3bb41c[_0x9f55('0x60')]['id']},'include':[{'model':db[_0x9f55('0x9c')],'as':'List','include':[{'model':db[_0x9f55('0x8a')],'as':'Contacts','where':{'email':_0x35d223},'limit':0x1,'order':[[_0x9f55('0x9d'),_0x9f55('0x9e')]]}]},{'model':db[_0x9f55('0x3d')],'as':_0x9f55('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x31d609,null))['then'](function(_0x59f7a5){if(_0x59f7a5){_0x4344ec=_0x59f7a5;if(_0x59f7a5[_0x9f55('0x3e')]){if(_[_0x9f55('0x71')](_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0x9f')])){_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0x9f')]=util['format'](_0x9f55('0xa0'),_0x59f7a5[_0x9f55('0x39')],_0x59f7a5[_0x9f55('0x6e')]||_0x59f7a5['Smtp'][_0x9f55('0x73')]);}if(_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0xa1')]&&_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0xa1')][_0x9f55('0x4d')]){for(var _0x27511b=0x0;_0x27511b<_0x3bb41c[_0x9f55('0x5f')]['attachments'][_0x9f55('0x4d')];_0x27511b+=0x1){_0x3bb41c[_0x9f55('0x5f')]['attachments'][_0x27511b]={'filename':_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0xa1')][_0x27511b][_0x9f55('0x39')],'path':path[_0x9f55('0xa2')](config[_0x9f55('0xa3')],'server/files/attachments',_0x3bb41c['body'][_0x9f55('0xa1')][_0x27511b][_0x9f55('0xa4')])};}}var _0x320d25={'tls':{'rejectUnauthorized':![]}};if(_[_0x9f55('0x71')](_0x59f7a5['Smtp']['service'])){if(_0x59f7a5['Smtp'][_0x9f55('0x77')]){_0x320d25[_0x9f55('0xa5')]={'user':_0x59f7a5['Smtp'][_0x9f55('0x73')],'pass':_0x59f7a5[_0x9f55('0x3e')][_0x9f55('0x76')]};}_0x320d25[_0x9f55('0x78')]=_0x59f7a5[_0x9f55('0x3e')]['host'];_0x320d25['port']=_0x59f7a5['Smtp'][_0x9f55('0x79')];_0x320d25[_0x9f55('0xa6')]=_0x59f7a5[_0x9f55('0x3e')][_0x9f55('0xa6')];}else{_0x320d25[_0x9f55('0x7a')]=_0x59f7a5['Smtp'][_0x9f55('0x7a')];_0x320d25[_0x9f55('0xa5')]={'user':_0x59f7a5[_0x9f55('0x3e')]['user'],'pass':_0x59f7a5[_0x9f55('0x3e')]['pass']};}return respondWithRpcPromise(_0x9f55('0xa7'),_0x9f55('0xa8'),{'account':_0x320d25,'message':_0x3bb41c[_0x9f55('0x5f')]});}else{throw new Error(_0x9f55('0xa9'));}}})['then'](function(_0x196a9b){if(_0x196a9b){_0x355973=_0x196a9b;if(_0x4344ec[_0x9f55('0xaa')]){if(_0x4344ec[_0x9f55('0xaa')][_0x9f55('0xab')][_0x9f55('0x4d')]){return _0x4344ec['List'][_0x9f55('0xab')][0x0];}else{return db[_0x9f55('0x8a')]['create'](_[_0x9f55('0xac')](_0x3bb41c['body'],{'firstName':_0x3bb41c[_0x9f55('0x5f')]['to'],'email':_0x3bb41c['body']['to'],'phone':_0x3bb41c[_0x9f55('0x5f')]['to'],'ListId':_0x4344ec['ListId']}));}}else{throw new Error(_0x9f55('0xa9'));}}})[_0x9f55('0x34')](function(_0x22930e){if(_0x22930e){var _0x4754e4={'UserId':_0x3bb41c[_0x9f55('0x73')]['id'],'ContactId':_0x22930e['id'],'MailAccountId':_0x4344ec['id'],'inReplyTo':_0x355973[_0x9f55('0xad')],'to':_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0x9f')],'cc':_0x3bb41c[_0x9f55('0x5f')]['cc'],'subject':_0x3bb41c[_0x9f55('0x5f')]['subject'],'attach':_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0xae')],'firstMsgDirection':_0x9f55('0xaf'),'lastMsgAt':moment()[_0x9f55('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x9f55('0xaf'),'Messages':[_[_0x9f55('0x53')](_0x3bb41c[_0x9f55('0x5f')],{'messageId':_0x355973[_0x9f55('0xad')],'sentAt':moment()[_0x9f55('0xb0')](_0x9f55('0x99')),'read':!![],'MailAccountId':_0x4344ec['id'],'UserId':_0x3bb41c[_0x9f55('0x73')]['id'],'ContactId':_0x22930e['id']})]};if(_0x3bb41c[_0x9f55('0x5f')]['Interaction']){_0x4754e4=_[_0x9f55('0x53')](_0x4754e4,_0x3bb41c[_0x9f55('0x5f')][_0x9f55('0xb1')]);}return db['MailInteraction'][_0x9f55('0x63')](_0x4754e4,{'include':[{'model':db[_0x9f55('0x97')],'as':_0x9f55('0xb2')}]});}})['then'](respondWithResult(_0x31d609,null))[_0x9f55('0x27')](handleError(_0x31d609,null));};exports['verifySmtp']=function(_0x27be62,_0x1918f3,_0x387831){return db[_0x9f55('0x40')]['find']({'where':{'id':_0x27be62['params']['id']},'include':[{'model':db[_0x9f55('0x3d')],'as':_0x9f55('0x3e'),'raw':!![]}]})[_0x9f55('0x34')](handleEntityNotFound(_0x1918f3,null))[_0x9f55('0x34')](function(_0x116c56){if(_0x116c56&&_0x116c56['Smtp']){var _0xfd5b98={'id':_0x116c56['id'],'tls':{'rejectUnauthorized':![]}};if(_0x116c56[_0x9f55('0x3e')]['service']){_0xfd5b98[_0x9f55('0x7a')]=_0x116c56[_0x9f55('0x3e')][_0x9f55('0x7a')];}else{_0xfd5b98['host']=_0x116c56[_0x9f55('0x3e')][_0x9f55('0x78')];_0xfd5b98[_0x9f55('0x79')]=_0x116c56['Smtp']['port'];_0xfd5b98[_0x9f55('0xa6')]=_0x116c56[_0x9f55('0x3e')][_0x9f55('0xa6')];}if(_0x116c56[_0x9f55('0x3e')][_0x9f55('0x77')]){_0xfd5b98['auth']={'user':_0x116c56[_0x9f55('0x3e')]['user'],'pass':_0x116c56[_0x9f55('0x3e')][_0x9f55('0x76')]};}return respondWithRpcPromise(_0x9f55('0xb3'),_0x9f55('0xb4'),{'account':_0xfd5b98});}})[_0x9f55('0x34')](respondWithResult(_0x1918f3,null))[_0x9f55('0x27')](handleError(_0x1918f3,null));};exports['destroy']=function(_0x308624,_0x1f9ae4){return db[_0x9f55('0x40')][_0x9f55('0x5e')]({'where':{'id':_0x308624[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x1f9ae4,null))[_0x9f55('0x34')](function(_0x5d3981){if(_0x5d3981&&_0x5d3981[_0x9f55('0x7a')]){throw new db[(_0x9f55('0xb5'))][(_0x9f55('0xb6'))](_0x9f55('0xb7'));}return _0x5d3981;})[_0x9f55('0x34')](removeEntity(_0x1f9ae4,null))[_0x9f55('0x27')](handleError(_0x1f9ae4,null));};exports[_0x9f55('0xb8')]=function(_0x1ab73a,_0x283611,_0x4bd09a){return db[_0x9f55('0x40')]['find']({'where':{'id':_0x1ab73a['params']['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x283611,null))['then'](function(_0x3199c1){if(_0x3199c1){return _0x3199c1['addAgents'](_0x1ab73a[_0x9f55('0x5f')][_0x9f55('0x6d')],_[_0x9f55('0xb9')](_0x1ab73a[_0x9f55('0x5f')],[_0x9f55('0x6d'),'id'])||{})[_0x9f55('0xba')](function(_0x57e7f0){for(var _0x2f70af=0x0;_0x2f70af<_0x1ab73a['body'][_0x9f55('0x6d')][_0x9f55('0x4d')];_0x2f70af+=0x1){socket[_0x9f55('0xbb')]('userMailAccount:save',{'UserId':Number(_0x1ab73a[_0x9f55('0x5f')][_0x9f55('0x6d')][_0x2f70af]),'MailAccountId':Number(_0x1ab73a['params']['id'])});}return _0x57e7f0;});}})[_0x9f55('0x34')](respondWithResult(_0x283611,null))[_0x9f55('0x27')](handleError(_0x283611,null));};exports[_0x9f55('0xbc')]=function(_0x161d17,_0x222c1e,_0x2ffdcb){return db[_0x9f55('0x40')][_0x9f55('0x5e')]({'where':{'id':_0x161d17['params']['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x222c1e,null))['then'](function(_0x15848f){if(_0x15848f){return _0x15848f['removeAgents'](_0x161d17[_0x9f55('0x47')]['ids'])[_0x9f55('0x34')](function(){if(_[_0x9f55('0xbd')](_0x161d17['query']['ids'])){for(var _0x2dd1d8=0x0;_0x2dd1d8<_0x161d17[_0x9f55('0x47')][_0x9f55('0x6d')]['length'];_0x2dd1d8+=0x1){socket[_0x9f55('0xbb')](_0x9f55('0xbe'),{'UserId':Number(_0x161d17[_0x9f55('0x47')][_0x9f55('0x6d')][_0x2dd1d8]),'MailAccountId':Number(_0x161d17[_0x9f55('0x60')]['id'])});}}else{socket['emit'](_0x9f55('0xbe'),{'UserId':Number(_0x161d17['query']['ids']),'MailAccountId':Number(_0x161d17['params']['id'])});}});}})[_0x9f55('0x34')](respondWithStatusCode(_0x222c1e,null))[_0x9f55('0x27')](handleError(_0x222c1e,null));};exports[_0x9f55('0xbf')]=function(_0x5ed8cc,_0x110310,_0x2f6c78){var _0xcdeaff={};var _0x50f849={};var _0x2deacb;var _0x193a26;return db[_0x9f55('0x40')]['findOne']({'where':{'id':_0x5ed8cc[_0x9f55('0x60')]['id']}})[_0x9f55('0x34')](handleEntityNotFound(_0x110310,null))[_0x9f55('0x34')](function(_0x4b3442){if(_0x4b3442){_0x2deacb=_0x4b3442;_0x50f849['model']=_[_0x9f55('0x48')](db[_0x9f55('0x8c')][_0x9f55('0x41')]);_0x50f849[_0x9f55('0x47')]=_['keys'](_0x5ed8cc[_0x9f55('0x47')]);_0x50f849[_0x9f55('0x49')]=_['intersection'](_0x50f849[_0x9f55('0x45')],_0x50f849[_0x9f55('0x47')]);_0xcdeaff[_0x9f55('0x4b')]=_[_0x9f55('0x4a')](_0x50f849[_0x9f55('0x45')],qs[_0x9f55('0x4c')](_0x5ed8cc['query'][_0x9f55('0x4c')]));_0xcdeaff['attributes']=_0xcdeaff[_0x9f55('0x4b')][_0x9f55('0x4d')]?_0xcdeaff[_0x9f55('0x4b')]:_0x50f849['model'];_0xcdeaff[_0x9f55('0x4f')]=qs[_0x9f55('0x50')](_0x5ed8cc[_0x9f55('0x47')][_0x9f55('0x50')]);_0xcdeaff[_0x9f55('0x54')]=qs[_0x9f55('0x49')](_[_0x9f55('0x51')](_0x5ed8cc[_0x9f55('0x47')],_0x50f849[_0x9f55('0x49')]));if(_0x5ed8cc[_0x9f55('0x47')][_0x9f55('0x52')]){_0xcdeaff['where']=_[_0x9f55('0x53')](_0xcdeaff[_0x9f55('0x54')],{'$or':_[_0x9f55('0x46')](_0xcdeaff[_0x9f55('0x4b')],function(_0x36a99c){var _0x53b190={};_0x53b190[_0x36a99c]={'$like':'%'+_0x5ed8cc[_0x9f55('0x47')][_0x9f55('0x52')]+'%'};return _0x53b190;})});}_0xcdeaff=_[_0x9f55('0x53')]({},_0xcdeaff,_0x5ed8cc[_0x9f55('0x56')]);return _0x2deacb[_0x9f55('0xbf')](_0xcdeaff);}})[_0x9f55('0x34')](function(_0x19b3fa){if(_0x19b3fa){_0x193a26=_0x19b3fa[_0x9f55('0x4d')];if(!_0x5ed8cc[_0x9f55('0x47')][_0x9f55('0x4e')](_0x9f55('0x66'))){_0xcdeaff[_0x9f55('0x2c')]=qs['limit'](_0x5ed8cc[_0x9f55('0x47')][_0x9f55('0x2c')]);_0xcdeaff['offset']=qs['offset'](_0x5ed8cc[_0x9f55('0x47')]['offset']);}return _0x2deacb[_0x9f55('0xbf')](_0xcdeaff);}})['then'](function(_0xfd42fe){if(_0xfd42fe){return _0xfd42fe?{'count':_0x193a26,'rows':_0xfd42fe}:null;}})[_0x9f55('0x34')](respondWithResult(_0x110310,null))[_0x9f55('0x27')](handleError(_0x110310,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 18f0d29..b8214d3 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 _0x9d76=['exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9d76,0x76));var _0x69d7=function(_0x1b826d,_0x3ba842){_0x1b826d=_0x1b826d-0x0;var _0x5b0d83=_0x9d76[_0x1b826d];return _0x5b0d83;};'use strict';var EventEmitter=require(_0x69d7('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x69d7('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x69d7('0x2')](0x0);var events={'afterCreate':_0x69d7('0x3'),'afterUpdate':_0x69d7('0x4'),'afterDestroy':_0x69d7('0x5')};function emitEvent(_0x1ec147){return function(_0x501e6e,_0x564797,_0xe17afc){MailAccountEvents[_0x69d7('0x6')](_0x1ec147+':'+_0x501e6e['id'],_0x501e6e);MailAccountEvents[_0x69d7('0x6')](_0x1ec147,_0x501e6e);_0xe17afc(null);};}for(var e in events){if(events[_0x69d7('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x69d7('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xef4d=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x74d101,_0x3e2c2b){var _0x477e96=function(_0x474b4c){while(--_0x474b4c){_0x74d101['push'](_0x74d101['shift']());}};_0x477e96(++_0x3e2c2b);}(_0xef4d,0x165));var _0xdef4=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xef4d[_0x1abb09];return _0xea1c07;};'use strict';var EventEmitter=require(_0xdef4('0x0'));var MailAccount=require(_0xdef4('0x1'))['db'][_0xdef4('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xdef4('0x3')](0x0);var events={'afterCreate':_0xdef4('0x4'),'afterUpdate':_0xdef4('0x5'),'afterDestroy':_0xdef4('0x6')};function emitEvent(_0x313693){return function(_0x71c4c5,_0x267244,_0x2f501c){MailAccountEvents[_0xdef4('0x7')](_0x313693+':'+_0x71c4c5['id'],_0x71c4c5);MailAccountEvents[_0xdef4('0x7')](_0x313693,_0x71c4c5);_0x2f501c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xdef4('0x8')](e,emitEvent(event));}}module[_0xdef4('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index ae2f630..8f7cf71 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 _0x9bf0=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailAccount','lodash'];(function(_0x1139d0,_0x41e5f8){var _0xcc01a6=function(_0x504ffa){while(--_0x504ffa){_0x1139d0['push'](_0x1139d0['shift']());}};_0xcc01a6(++_0x41e5f8);}(_0x9bf0,0x15d));var _0x09bf=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x9bf0[_0x286726];return _0xcd4fe9;};'use strict';var _=require(_0x09bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x09bf('0x1'));var moment=require(_0x09bf('0x2'));var BPromise=require(_0x09bf('0x3'));var rp=require(_0x09bf('0x4'));var fs=require('fs');var path=require(_0x09bf('0x5'));var rimraf=require('rimraf');var config=require(_0x09bf('0x6'));var attributes=require('./mailAccount.attributes');module[_0x09bf('0x7')]=function(_0x137117,_0x2906b3){return _0x137117[_0x09bf('0x8')](_0x09bf('0x9'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6357=['moment','bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x6357,0x1b6));var _0x7635=function(_0x23bf7f,_0x578f6c){_0x23bf7f=_0x23bf7f-0x0;var _0x64b00e=_0x6357[_0x23bf7f];return _0x64b00e;};'use strict';var _=require(_0x7635('0x0'));var util=require(_0x7635('0x1'));var logger=require(_0x7635('0x2'))(_0x7635('0x3'));var moment=require(_0x7635('0x4'));var BPromise=require(_0x7635('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7635('0x6'));var rimraf=require(_0x7635('0x7'));var config=require(_0x7635('0x8'));var attributes=require(_0x7635('0x9'));module['exports']=function(_0xb915fa,_0x517efb){return _0xb915fa[_0x7635('0xa')](_0x7635('0xb'),attributes,{'tableName':_0x7635('0xc'),'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 473ad75..9b7e583 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 _0xda7b=['interaction','created','attachments','originTo','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetMailAccount','findAll','options','raw','where','include','map','model','attributes','ShowMailAccount','NotifyMailAccount','mail','difference','keys','createdAt','CompanyId','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','account','CmList','List','CmContact','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','get','omit','list','applications','orderBy','priority','push','length','close','autoclose','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda7b,0x150));var _0xbda7=function(_0x39a764,_0x361f14){_0x39a764=_0x39a764-0x0;var _0xe0579e=_0xda7b[_0x39a764];return _0xe0579e;};'use strict';var _=require(_0xbda7('0x0'));var util=require(_0xbda7('0x1'));var moment=require(_0xbda7('0x2'));var BPromise=require(_0xbda7('0x3'));var rs=require(_0xbda7('0x4'));var fs=require('fs');var Redis=require(_0xbda7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbda7('0x6'));var config=require(_0xbda7('0x7'));var jayson=require(_0xbda7('0x8'));var client=jayson[_0xbda7('0x9')]['http']({'port':0x232c});config[_0xbda7('0xa')]=_[_0xbda7('0xb')](config[_0xbda7('0xa')],{'host':_0xbda7('0xc'),'port':0x18eb});var socket=require(_0xbda7('0xd'))(new Redis(config['redis']));require(_0xbda7('0xe'))['register'](socket);function respondWithRpcPromise(_0x24e311,_0x258ea6,_0x549a80){return new BPromise(function(_0x1aec90,_0x368a39){return client['request'](_0x24e311,_0x549a80)[_0xbda7('0xf')](function(_0x2b478d){logger['info'](_0xbda7('0x10'),_0x258ea6,'request\x20sent');logger[_0xbda7('0x11')](_0xbda7('0x12'),_0x258ea6,'request\x20sent',JSON[_0xbda7('0x13')](_0x2b478d));if(_0x2b478d[_0xbda7('0x14')]){if(_0x2b478d[_0xbda7('0x14')]['code']===0x1f4){logger[_0xbda7('0x14')]('MailAccount,\x20%s,\x20%s',_0x258ea6,_0x2b478d[_0xbda7('0x14')][_0xbda7('0x15')]);return _0x368a39(_0x2b478d[_0xbda7('0x14')][_0xbda7('0x15')]);}logger[_0xbda7('0x14')](_0xbda7('0x10'),_0x258ea6,_0x2b478d[_0xbda7('0x14')][_0xbda7('0x15')]);return _0x1aec90(_0x2b478d[_0xbda7('0x14')][_0xbda7('0x15')]);}else{logger[_0xbda7('0x16')](_0xbda7('0x10'),_0x258ea6,_0xbda7('0x17'));_0x1aec90(_0x2b478d[_0xbda7('0x18')]['message']);}})[_0xbda7('0x19')](function(_0x383aa0){logger[_0xbda7('0x14')](_0xbda7('0x10'),_0x258ea6,_0x383aa0);_0x368a39(_0x383aa0);});});}exports[_0xbda7('0x1a')]=function(_0x502fef){var _0x3027e2=this;return new Promise(function(_0xfff2f1,_0x112e29){return db['MailAccount'][_0xbda7('0x1b')]({'raw':_0x502fef[_0xbda7('0x1c')]?_0x502fef[_0xbda7('0x1c')][_0xbda7('0x1d')]===undefined?!![]:![]:!![],'where':_0x502fef['options']?_0x502fef[_0xbda7('0x1c')][_0xbda7('0x1e')]||null:null,'attributes':_0x502fef[_0xbda7('0x1c')]?_0x502fef[_0xbda7('0x1c')]['attributes']||null:null,'limit':_0x502fef[_0xbda7('0x1c')]?_0x502fef[_0xbda7('0x1c')]['limit']||null:null,'include':_0x502fef['options']?_0x502fef[_0xbda7('0x1c')][_0xbda7('0x1f')]?_[_0xbda7('0x20')](_0x502fef['options'][_0xbda7('0x1f')],function(_0x18b3cb){return{'model':db[_0x18b3cb[_0xbda7('0x21')]],'as':_0x18b3cb['as'],'attributes':_0x18b3cb['attributes'],'include':_0x18b3cb['include']?_['map'](_0x18b3cb[_0xbda7('0x1f')],function(_0x4b72be){return{'model':db[_0x4b72be[_0xbda7('0x21')]],'as':_0x4b72be['as'],'attributes':_0x4b72be[_0xbda7('0x22')],'include':_0x4b72be['include']?_['map'](_0x4b72be['include'],function(_0xf88345){return{'model':db[_0xf88345[_0xbda7('0x21')]],'as':_0xf88345['as'],'attributes':_0xf88345[_0xbda7('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46d4d9){logger[_0xbda7('0x16')](_0xbda7('0x1a'),_0x502fef);logger[_0xbda7('0x11')]('GetMailAccount',_0x502fef,JSON['stringify'](_0x46d4d9));_0xfff2f1(_0x46d4d9);})[_0xbda7('0x19')](function(_0x301b8b){logger[_0xbda7('0x14')](_0xbda7('0x1a'),_0x301b8b['message'],_0x502fef);_0x112e29(_0x3027e2['error'](0x1f4,_0x301b8b[_0xbda7('0x15')]));});});};exports[_0xbda7('0x23')]=function(_0x358b74){var _0x294583=this;return new Promise(function(_0x150f51,_0x164f69){return db['MailAccount']['find']({'raw':_0x358b74[_0xbda7('0x1c')]?_0x358b74[_0xbda7('0x1c')][_0xbda7('0x1d')]===undefined?!![]:![]:!![],'where':_0x358b74[_0xbda7('0x1c')]?_0x358b74['options'][_0xbda7('0x1e')]||null:null,'attributes':_0x358b74[_0xbda7('0x1c')]?_0x358b74['options'][_0xbda7('0x22')]||null:null,'include':_0x358b74[_0xbda7('0x1c')]?_0x358b74['options']['include']?_['map'](_0x358b74['options']['include'],function(_0x5e1760){return{'model':db[_0x5e1760['model']],'as':_0x5e1760['as'],'attributes':_0x5e1760[_0xbda7('0x22')],'include':_0x5e1760[_0xbda7('0x1f')]?_[_0xbda7('0x20')](_0x5e1760[_0xbda7('0x1f')],function(_0x143b74){return{'model':db[_0x143b74[_0xbda7('0x21')]],'as':_0x143b74['as'],'attributes':_0x143b74['attributes'],'include':_0x143b74['include']?_[_0xbda7('0x20')](_0x143b74[_0xbda7('0x1f')],function(_0x467a2f){return{'model':db[_0x467a2f[_0xbda7('0x21')]],'as':_0x467a2f['as'],'attributes':_0x467a2f[_0xbda7('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbda7('0xf')](function(_0x3662ed){logger[_0xbda7('0x16')](_0xbda7('0x23'),_0x358b74);logger[_0xbda7('0x11')]('ShowMailAccount',_0x358b74,JSON[_0xbda7('0x13')](_0x3662ed));_0x150f51(_0x3662ed);})['catch'](function(_0x55e3ff){logger[_0xbda7('0x14')](_0xbda7('0x23'),_0x55e3ff['message'],_0x358b74);_0x164f69(_0x294583[_0xbda7('0x14')](0x1f4,_0x55e3ff[_0xbda7('0x15')]));});});};exports[_0xbda7('0x24')]=function(_0xfe61fc){var _0x4cd615=this;return new Promise(function(_0xe8c732,_0x15d745){var _0x3c9dfd={'body':_0xfe61fc['body'],'channel':_0xbda7('0x25')};var _0x320095=_[_0xbda7('0x26')](_[_0xbda7('0x27')](db['CmContact']['rawAttributes']),[_0xbda7('0x28'),'updatedAt',_0xbda7('0x29'),'ListId']);var _0x58ebc0=![];if(_0xfe61fc[_0xbda7('0x2a')]['id']){delete _0xfe61fc[_0xbda7('0x2a')]['id'];}if(_[_0xbda7('0x2b')](_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x2c')])){return _0x15d745(_0x4cd615[_0xbda7('0x14')](0x1f4,_0xbda7('0x2d')));}if(_['isNil'](_0xfe61fc['body'][_0xbda7('0x2a')])||_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x2a')]===''){return _0x15d745(_0x4cd615[_0xbda7('0x14')](0x1f4,_0xbda7('0x2e')));}if(_[_0xbda7('0x2b')](_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x2f')])){return _0x15d745(_0x4cd615[_0xbda7('0x14')](0x1f4,_0xbda7('0x30')+_0x320095));}if(!_[_0xbda7('0x31')](_0x320095,_0xfe61fc[_0xbda7('0x2a')]['mapKey'])){return _0x15d745(_0x4cd615[_0xbda7('0x14')](0x1f4,_0xbda7('0x32')+_0x320095));}var _0x343cac={};_0x343cac[_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x2f')]]=_0xfe61fc[_0xbda7('0x2a')]['from'];return db['MailAccount'][_0xbda7('0x33')]({'where':{'id':_0xfe61fc[_0xbda7('0x34')]['id']},'include':[{'model':db[_0xbda7('0x35')],'as':_0xbda7('0x36'),'include':[{'model':db[_0xbda7('0x37')],'as':_0xbda7('0x38'),'where':_0x343cac,'limit':0x1,'order':[[_0xbda7('0x39'),_0xbda7('0x3a')]]}]},{'model':db['MailApplication'],'as':_0xbda7('0x3b')},{'model':db[_0xbda7('0x3c')],'as':_0xbda7('0x3d')}]})[_0xbda7('0xf')](function(_0x50664d){if(_0x50664d&&_0x50664d['List']){var _0x556bdb=_0x50664d[_0xbda7('0x3e')]({'plain':!![]});_0x3c9dfd['account']=_[_0xbda7('0x3f')](_0x556bdb,[_0xbda7('0x3b'),_0xbda7('0x36')]);_0x3c9dfd['applications']=_0x556bdb['Applications'];_0x3c9dfd[_0xbda7('0x40')]=_0x556bdb[_0xbda7('0x36')];_0x3c9dfd[_0xbda7('0x41')]=_[_0xbda7('0x42')](_0x3c9dfd[_0xbda7('0x41')],[_0xbda7('0x43')],['asc']);if(_0x3c9dfd['account']&&_0x3c9dfd[_0xbda7('0x34')]['autoclose']){_0x3c9dfd[_0xbda7('0x41')][_0xbda7('0x44')]({'id':0x0,'priority':_0x3c9dfd[_0xbda7('0x41')][_0xbda7('0x45')]+0x1,'app':_0xbda7('0x46'),'appdata':_0xbda7('0x47'),'interval':'*,*,*,*'});}if(_0x3c9dfd[_0xbda7('0x34')][_0xbda7('0x3b')]){delete _0x3c9dfd[_0xbda7('0x34')]['Applications'];}if(_0x3c9dfd[_0xbda7('0x34')][_0xbda7('0x36')]){delete _0x3c9dfd[_0xbda7('0x34')][_0xbda7('0x36')];}if(_0x556bdb[_0xbda7('0x36')][_0xbda7('0x38')]['length']){return _0x556bdb[_0xbda7('0x36')][_0xbda7('0x38')][0x0];}var _0x58c82c=_[_0xbda7('0xb')](_0xfe61fc[_0xbda7('0x2a')],{'firstName':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x2c')],'ListId':_0x556bdb['ListId']});_0x58c82c[_0xfe61fc[_0xbda7('0x2a')]['mapKey']]=_0xfe61fc['body'][_0xbda7('0x2c')];return db[_0xbda7('0x37')][_0xbda7('0x48')](_0x58c82c);}else{throw new Error(_0xbda7('0x49'));}})['then'](function(_0x587a4b){_0x3c9dfd[_0xbda7('0x4a')]=_0x587a4b;if(_0x587a4b){if(!_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')]['messageId']){_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x4b')]=rs[_0xbda7('0x4c')]()+'\x20'+_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x2c')];}var _0x19c26d={'ContactId':_0x587a4b['id'],'MailAccountId':_0xfe61fc['account']['id'],'inReplyTo':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x4b')],'to':_0xfe61fc['body']['message'][_0xbda7('0x2c')],'cc':_0xfe61fc['body']['message']['cc'],'subject':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')]['subject'],'attach':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x4d')],'lastMsgAt':moment()[_0xbda7('0x4e')](_0xbda7('0x4f')),'lastMsgDirection':'in'};return db[_0xbda7('0x50')]['find']({'where':{'closed':![],'MailAccountId':_0xfe61fc[_0xbda7('0x34')]['id']},'include':[{'model':db[_0xbda7('0x51')],'as':_0xbda7('0x52'),'attributes':[_0xbda7('0x4b')],'where':{'messageId':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x53')]}}]})[_0xbda7('0xf')](function(_0xdf7b2f){if(_0xdf7b2f){return[_0xdf7b2f,![]];}return db['MailInteraction'][_0xbda7('0x48')](_0x19c26d)['then'](function(_0x2e3b62){return[_0x2e3b62,!![]];});});}else{throw new Error(_0xbda7('0x54'));}})[_0xbda7('0x55')](function(_0x1ff6d1,_0x1b56d5){if(_0x1ff6d1){_0x58ebc0=_0x1b56d5;if(!_0x1b56d5){return _0x1ff6d1[_0xbda7('0x56')]({'inReplyTo':_0xfe61fc['body'][_0xbda7('0x15')][_0xbda7('0x4b')],'to':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x2c')],'cc':_0xfe61fc[_0xbda7('0x2a')]['message']['cc'],'subject':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x57')],'attach':_0x1ff6d1['attach']?_0x1ff6d1['attach']:_0xfe61fc['body'][_0xbda7('0x15')][_0xbda7('0x4d')],'substatus':null,'substatusAt':moment()[_0xbda7('0x4e')](_0xbda7('0x4f')),'lastMsgAt':moment()['format'](_0xbda7('0x4f')),'lastMsgDirection':'in'});}else{return _0x1ff6d1;}}})[_0xbda7('0xf')](function(_0x5ce059){_0x3c9dfd[_0xbda7('0x58')]=_0x5ce059['get']({'plain':!![]});_0x3c9dfd[_0xbda7('0x58')][_0xbda7('0x59')]=_0x58ebc0;return db['MailMessage']['create']({'body':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x2a')],'MailAccountId':_0xfe61fc[_0xbda7('0x34')]['id'],'MailInteractionId':_0x5ce059['id'],'direction':'in','ContactId':_0x3c9dfd['contact']['id'],'messageId':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')]['messageId'],'from':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x2c')],'to':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')]['to'],'cc':_0xfe61fc['body'][_0xbda7('0x15')]['cc'],'subject':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x57')],'attach':_0xfe61fc['body'][_0xbda7('0x15')]['attach'],'Attachments':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x5a')],'originTo':_0xfe61fc['body'][_0xbda7('0x15')][_0xbda7('0x5b')],'originCc':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')]['originCc'],'bcc':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x5c')],'ChatWebsiteId':_0xfe61fc[_0xbda7('0x2a')]['message'][_0xbda7('0x5d')]||null,'originChannel':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')]['originChannel']||_0xbda7('0x5e'),'ChatOfflineMessageId':_0xfe61fc[_0xbda7('0x2a')][_0xbda7('0x15')][_0xbda7('0x5f')]||null},{'include':[{'model':db[_0xbda7('0x60')],'as':_0xbda7('0x61')}]});})[_0xbda7('0xf')](function(_0x12ac51){_0x3c9dfd[_0xbda7('0x15')]=_0x12ac51;if(_0x3c9dfd[_0xbda7('0x58')]['UserId']){return db[_0xbda7('0x62')][_0xbda7('0x33')]({'attributes':['id',_0xbda7('0x63')],'where':{'id':_0x3c9dfd[_0xbda7('0x58')][_0xbda7('0x64')]}})[_0xbda7('0xf')](function(_0x5d7abd){if(_0x5d7abd){_0x3c9dfd[_0xbda7('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xbda7('0x65'),'appdata':_0x5d7abd['name']+','+(_0x3c9dfd[_0xbda7('0x34')][_0xbda7('0x66')]||0xa),'interval':_0xbda7('0x67')});}return respondWithRpcPromise(_0xbda7('0x68'),_0xbda7('0x69'),_0x3c9dfd);});}return respondWithRpcPromise(_0xbda7('0x68'),_0xbda7('0x69'),_0x3c9dfd);})['then'](function(_0x3d4d77){_0xe8c732(_0x3d4d77);})[_0xbda7('0x19')](function(_0x3f75d1){_0x15d745(_0x4cd615[_0xbda7('0x14')](0x1f4,_0x3f75d1['message']));});});}; \ No newline at end of file +var _0xeb9a=['name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','model','map','stringify','ShowMailAccount','find','raw','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','get','account','omit','applications','list','orderBy','priority','push','length','close','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','Contact\x20not\x20found','spread','update','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User'];(function(_0x52df69,_0x45a692){var _0x4664df=function(_0x37b073){while(--_0x37b073){_0x52df69['push'](_0x52df69['shift']());}};_0x4664df(++_0x45a692);}(_0xeb9a,0x6f));var _0xaeb9=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xeb9a[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0xaeb9('0x0'));var util=require(_0xaeb9('0x1'));var moment=require(_0xaeb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xaeb9('0x3'));var fs=require('fs');var Redis=require(_0xaeb9('0x4'));var db=require(_0xaeb9('0x5'))['db'];var utils=require(_0xaeb9('0x6'));var logger=require(_0xaeb9('0x7'))(_0xaeb9('0x8'));var config=require(_0xaeb9('0x9'));var jayson=require(_0xaeb9('0xa'));var client=jayson['client'][_0xaeb9('0xb')]({'port':0x232c});config['redis']=_[_0xaeb9('0xc')](config['redis'],{'host':_0xaeb9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaeb9('0xe')]));require('./mailAccount.socket')[_0xaeb9('0xf')](socket);function respondWithRpcPromise(_0x3e1fb4,_0x14838b,_0x1c2a84){return new BPromise(function(_0x2bee4e,_0x15e017){return client['request'](_0x3e1fb4,_0x1c2a84)[_0xaeb9('0x10')](function(_0x38f782){logger[_0xaeb9('0x11')](_0xaeb9('0x12'),_0x14838b,'request\x20sent');logger[_0xaeb9('0x13')](_0xaeb9('0x14'),_0x14838b,_0xaeb9('0x15'),JSON['stringify'](_0x38f782));if(_0x38f782['error']){if(_0x38f782[_0xaeb9('0x16')][_0xaeb9('0x17')]===0x1f4){logger[_0xaeb9('0x16')](_0xaeb9('0x12'),_0x14838b,_0x38f782[_0xaeb9('0x16')][_0xaeb9('0x18')]);return _0x15e017(_0x38f782[_0xaeb9('0x16')][_0xaeb9('0x18')]);}logger[_0xaeb9('0x16')]('MailAccount,\x20%s,\x20%s',_0x14838b,_0x38f782[_0xaeb9('0x16')][_0xaeb9('0x18')]);return _0x2bee4e(_0x38f782[_0xaeb9('0x16')][_0xaeb9('0x18')]);}else{logger[_0xaeb9('0x11')](_0xaeb9('0x12'),_0x14838b,_0xaeb9('0x15'));_0x2bee4e(_0x38f782[_0xaeb9('0x19')][_0xaeb9('0x18')]);}})[_0xaeb9('0x1a')](function(_0xe58ab8){logger['error'](_0xaeb9('0x12'),_0x14838b,_0xe58ab8);_0x15e017(_0xe58ab8);});});}exports[_0xaeb9('0x1b')]=function(_0x10a05f){var _0x5dde19=this;return new Promise(function(_0x29ea4c,_0x2d2cf1){return db[_0xaeb9('0x1c')][_0xaeb9('0x1d')]({'raw':_0x10a05f[_0xaeb9('0x1e')]?_0x10a05f[_0xaeb9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x10a05f['options']?_0x10a05f['options'][_0xaeb9('0x1f')]||null:null,'attributes':_0x10a05f[_0xaeb9('0x1e')]?_0x10a05f['options'][_0xaeb9('0x20')]||null:null,'limit':_0x10a05f[_0xaeb9('0x1e')]?_0x10a05f[_0xaeb9('0x1e')][_0xaeb9('0x21')]||null:null,'include':_0x10a05f['options']?_0x10a05f[_0xaeb9('0x1e')][_0xaeb9('0x22')]?_['map'](_0x10a05f[_0xaeb9('0x1e')]['include'],function(_0x3d3f91){return{'model':db[_0x3d3f91[_0xaeb9('0x23')]],'as':_0x3d3f91['as'],'attributes':_0x3d3f91[_0xaeb9('0x20')],'include':_0x3d3f91[_0xaeb9('0x22')]?_[_0xaeb9('0x24')](_0x3d3f91['include'],function(_0x5b2d95){return{'model':db[_0x5b2d95[_0xaeb9('0x23')]],'as':_0x5b2d95['as'],'attributes':_0x5b2d95[_0xaeb9('0x20')],'include':_0x5b2d95[_0xaeb9('0x22')]?_[_0xaeb9('0x24')](_0x5b2d95[_0xaeb9('0x22')],function(_0xefe399){return{'model':db[_0xefe399[_0xaeb9('0x23')]],'as':_0xefe399['as'],'attributes':_0xefe399['attributes']};}):[]};}):[]};}):[]:[]})[_0xaeb9('0x10')](function(_0x258fb9){logger[_0xaeb9('0x11')]('GetMailAccount',_0x10a05f);logger[_0xaeb9('0x13')](_0xaeb9('0x1b'),_0x10a05f,JSON[_0xaeb9('0x25')](_0x258fb9));_0x29ea4c(_0x258fb9);})['catch'](function(_0x29ef52){logger[_0xaeb9('0x16')](_0xaeb9('0x1b'),_0x29ef52[_0xaeb9('0x18')],_0x10a05f);_0x2d2cf1(_0x5dde19[_0xaeb9('0x16')](0x1f4,_0x29ef52['message']));});});};exports[_0xaeb9('0x26')]=function(_0x21896a){var _0x48792e=this;return new Promise(function(_0x173c8a,_0x587b6f){return db[_0xaeb9('0x1c')][_0xaeb9('0x27')]({'raw':_0x21896a[_0xaeb9('0x1e')]?_0x21896a[_0xaeb9('0x1e')][_0xaeb9('0x28')]===undefined?!![]:![]:!![],'where':_0x21896a[_0xaeb9('0x1e')]?_0x21896a[_0xaeb9('0x1e')][_0xaeb9('0x1f')]||null:null,'attributes':_0x21896a[_0xaeb9('0x1e')]?_0x21896a[_0xaeb9('0x1e')][_0xaeb9('0x20')]||null:null,'include':_0x21896a[_0xaeb9('0x1e')]?_0x21896a[_0xaeb9('0x1e')]['include']?_[_0xaeb9('0x24')](_0x21896a['options'][_0xaeb9('0x22')],function(_0x2ee782){return{'model':db[_0x2ee782[_0xaeb9('0x23')]],'as':_0x2ee782['as'],'attributes':_0x2ee782['attributes'],'include':_0x2ee782['include']?_[_0xaeb9('0x24')](_0x2ee782['include'],function(_0x3d1a65){return{'model':db[_0x3d1a65[_0xaeb9('0x23')]],'as':_0x3d1a65['as'],'attributes':_0x3d1a65[_0xaeb9('0x20')],'include':_0x3d1a65[_0xaeb9('0x22')]?_[_0xaeb9('0x24')](_0x3d1a65[_0xaeb9('0x22')],function(_0x44cc91){return{'model':db[_0x44cc91[_0xaeb9('0x23')]],'as':_0x44cc91['as'],'attributes':_0x44cc91[_0xaeb9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaeb9('0x10')](function(_0x13d672){logger[_0xaeb9('0x11')]('ShowMailAccount',_0x21896a);logger['debug'](_0xaeb9('0x26'),_0x21896a,JSON[_0xaeb9('0x25')](_0x13d672));_0x173c8a(_0x13d672);})['catch'](function(_0x2dac55){logger['error'](_0xaeb9('0x26'),_0x2dac55[_0xaeb9('0x18')],_0x21896a);_0x587b6f(_0x48792e[_0xaeb9('0x16')](0x1f4,_0x2dac55[_0xaeb9('0x18')]));});});};exports[_0xaeb9('0x29')]=function(_0x5eb2a0){var _0x33fd3f=this;return new Promise(function(_0x4c658a,_0x3a5b91){var _0x38a72f={'body':_0x5eb2a0[_0xaeb9('0x2a')],'channel':_0xaeb9('0x2b')};var _0x6e1306=_[_0xaeb9('0x2c')](_[_0xaeb9('0x2d')](db[_0xaeb9('0x2e')][_0xaeb9('0x2f')]),[_0xaeb9('0x30'),_0xaeb9('0x31'),_0xaeb9('0x32'),_0xaeb9('0x33')]);var _0x806f8=![];if(_0x5eb2a0['body']['id']){delete _0x5eb2a0[_0xaeb9('0x2a')]['id'];}if(_['isNil'](_0x5eb2a0['body'][_0xaeb9('0x34')])){return _0x3a5b91(_0x33fd3f[_0xaeb9('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xaeb9('0x35')](_0x5eb2a0['body']['body'])||_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x2a')]===''){return _0x3a5b91(_0x33fd3f[_0xaeb9('0x16')](0x1f4,_0xaeb9('0x36')));}if(_[_0xaeb9('0x35')](_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x37')])){return _0x3a5b91(_0x33fd3f[_0xaeb9('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6e1306));}if(!_[_0xaeb9('0x38')](_0x6e1306,_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x37')])){return _0x3a5b91(_0x33fd3f['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6e1306));}var _0x41140e={};_0x41140e[_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x37')]]=_0x5eb2a0['body'][_0xaeb9('0x34')];return db[_0xaeb9('0x1c')][_0xaeb9('0x27')]({'where':{'id':_0x5eb2a0['account']['id']},'include':[{'model':db[_0xaeb9('0x39')],'as':_0xaeb9('0x3a'),'include':[{'model':db[_0xaeb9('0x2e')],'as':_0xaeb9('0x3b'),'where':_0x41140e,'limit':0x1,'order':[[_0xaeb9('0x31'),_0xaeb9('0x3c')]]}]},{'model':db[_0xaeb9('0x3d')],'as':_0xaeb9('0x3e')},{'model':db[_0xaeb9('0x3f')],'as':'Smtp'}]})['then'](function(_0x3972a8){if(_0x3972a8&&_0x3972a8[_0xaeb9('0x3a')]){var _0x330756=_0x3972a8[_0xaeb9('0x40')]({'plain':!![]});_0x38a72f[_0xaeb9('0x41')]=_[_0xaeb9('0x42')](_0x330756,[_0xaeb9('0x3e'),_0xaeb9('0x3a')]);_0x38a72f[_0xaeb9('0x43')]=_0x330756['Applications'];_0x38a72f[_0xaeb9('0x44')]=_0x330756[_0xaeb9('0x3a')];_0x38a72f[_0xaeb9('0x43')]=_[_0xaeb9('0x45')](_0x38a72f[_0xaeb9('0x43')],[_0xaeb9('0x46')],['asc']);if(_0x38a72f['account']&&_0x38a72f[_0xaeb9('0x41')]['autoclose']){_0x38a72f[_0xaeb9('0x43')][_0xaeb9('0x47')]({'id':0x0,'priority':_0x38a72f[_0xaeb9('0x43')][_0xaeb9('0x48')]+0x1,'app':_0xaeb9('0x49'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x38a72f['account'][_0xaeb9('0x3e')]){delete _0x38a72f['account'][_0xaeb9('0x3e')];}if(_0x38a72f[_0xaeb9('0x41')]['List']){delete _0x38a72f['account'][_0xaeb9('0x3a')];}if(_0x330756[_0xaeb9('0x3a')][_0xaeb9('0x3b')]['length']){return _0x330756[_0xaeb9('0x3a')][_0xaeb9('0x3b')][0x0];}var _0xcee898=_['defaults'](_0x5eb2a0[_0xaeb9('0x2a')],{'firstName':_0x5eb2a0['body']['from'],'ListId':_0x330756[_0xaeb9('0x33')]});_0xcee898[_0x5eb2a0['body']['mapKey']]=_0x5eb2a0['body']['from'];return db['CmContact']['create'](_0xcee898);}else{throw new Error(_0xaeb9('0x4a'));}})[_0xaeb9('0x10')](function(_0x502299){_0x38a72f[_0xaeb9('0x4b')]=_0x502299;if(_0x502299){if(!_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')][_0xaeb9('0x4c')]){_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')][_0xaeb9('0x4c')]=rs[_0xaeb9('0x4d')]()+'\x20'+_0x5eb2a0['body']['message']['from'];}var _0x4d627c={'ContactId':_0x502299['id'],'MailAccountId':_0x5eb2a0[_0xaeb9('0x41')]['id'],'inReplyTo':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['messageId'],'to':_0x5eb2a0[_0xaeb9('0x2a')]['message'][_0xaeb9('0x34')],'cc':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['cc'],'subject':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')][_0xaeb9('0x4e')],'attach':_0x5eb2a0['body'][_0xaeb9('0x18')][_0xaeb9('0x4f')],'lastMsgAt':moment()[_0xaeb9('0x50')](_0xaeb9('0x51')),'lastMsgDirection':'in'};return db[_0xaeb9('0x52')][_0xaeb9('0x27')]({'where':{'closed':![],'MailAccountId':_0x5eb2a0[_0xaeb9('0x41')]['id']},'include':[{'model':db[_0xaeb9('0x53')],'as':'Messages','attributes':[_0xaeb9('0x4c')],'where':{'messageId':_0x5eb2a0[_0xaeb9('0x2a')]['message'][_0xaeb9('0x54')]}}]})['then'](function(_0x364e2a){if(_0x364e2a){return[_0x364e2a,![]];}return db[_0xaeb9('0x52')][_0xaeb9('0x55')](_0x4d627c)[_0xaeb9('0x10')](function(_0x458721){return[_0x458721,!![]];});});}else{throw new Error(_0xaeb9('0x56'));}})[_0xaeb9('0x57')](function(_0x452f94,_0x11a916){if(_0x452f94){_0x806f8=_0x11a916;if(!_0x11a916){return _0x452f94[_0xaeb9('0x58')]({'inReplyTo':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['messageId'],'to':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['from'],'cc':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['cc'],'subject':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['subject'],'attach':_0x452f94[_0xaeb9('0x4f')]?_0x452f94['attach']:_0x5eb2a0['body']['message'][_0xaeb9('0x4f')],'substatus':null,'substatusAt':moment()['format'](_0xaeb9('0x51')),'lastMsgAt':moment()[_0xaeb9('0x50')](_0xaeb9('0x51')),'lastMsgDirection':'in'});}else{return _0x452f94;}}})['then'](function(_0x35a7d6){_0x38a72f[_0xaeb9('0x59')]=_0x35a7d6[_0xaeb9('0x40')]({'plain':!![]});_0x38a72f[_0xaeb9('0x59')][_0xaeb9('0x5a')]=_0x806f8;return db[_0xaeb9('0x53')]['create']({'body':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x2a')],'MailAccountId':_0x5eb2a0[_0xaeb9('0x41')]['id'],'MailInteractionId':_0x35a7d6['id'],'direction':'in','ContactId':_0x38a72f['contact']['id'],'messageId':_0x5eb2a0[_0xaeb9('0x2a')]['message'][_0xaeb9('0x4c')],'from':_0x5eb2a0[_0xaeb9('0x2a')]['message']['from'],'to':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['to'],'cc':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')]['cc'],'subject':_0x5eb2a0['body'][_0xaeb9('0x18')]['subject'],'attach':_0x5eb2a0['body'][_0xaeb9('0x18')][_0xaeb9('0x4f')],'Attachments':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')][_0xaeb9('0x5b')],'originTo':_0x5eb2a0['body'][_0xaeb9('0x18')][_0xaeb9('0x5c')],'originCc':_0x5eb2a0[_0xaeb9('0x2a')]['message'][_0xaeb9('0x5d')],'bcc':_0x5eb2a0['body'][_0xaeb9('0x18')]['bcc'],'ChatWebsiteId':_0x5eb2a0[_0xaeb9('0x2a')][_0xaeb9('0x18')][_0xaeb9('0x5e')]||null,'originChannel':_0x5eb2a0['body']['message'][_0xaeb9('0x5f')]||_0xaeb9('0x60'),'ChatOfflineMessageId':_0x5eb2a0['body'][_0xaeb9('0x18')][_0xaeb9('0x61')]||null},{'include':[{'model':db['Attachment'],'as':_0xaeb9('0x62')}]});})[_0xaeb9('0x10')](function(_0x433d15){_0x38a72f[_0xaeb9('0x18')]=_0x433d15;if(_0x38a72f[_0xaeb9('0x59')][_0xaeb9('0x63')]){return db[_0xaeb9('0x64')]['find']({'attributes':['id',_0xaeb9('0x65')],'where':{'id':_0x38a72f['interaction'][_0xaeb9('0x63')]}})[_0xaeb9('0x10')](function(_0x2829ef){if(_0x2829ef){_0x38a72f[_0xaeb9('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xaeb9('0x66'),'appdata':_0x2829ef[_0xaeb9('0x65')]+','+(_0x38a72f[_0xaeb9('0x41')][_0xaeb9('0x67')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xaeb9('0x68'),_0xaeb9('0x69'),_0x38a72f);});}return respondWithRpcPromise(_0xaeb9('0x68'),'startRouting',_0x38a72f);})[_0xaeb9('0x10')](function(_0x29ae30){_0x4c658a(_0x29ae30);})[_0xaeb9('0x1a')](function(_0xfdaa88){_0x3a5b91(_0x33fd3f[_0xaeb9('0x16')](0x1f4,_0xfdaa88[_0xaeb9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1f3e7a5..ca43502 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 _0x666b=['save','remove','update','emit','removeListener','register','length','./mailAccount.events'];(function(_0x4738d7,_0x46a6e0){var _0x27ab9b=function(_0x1e1e69){while(--_0x1e1e69){_0x4738d7['push'](_0x4738d7['shift']());}};_0x27ab9b(++_0x46a6e0);}(_0x666b,0x107));var _0xb666=function(_0x25ddfa,_0xbc4e37){_0x25ddfa=_0x25ddfa-0x0;var _0x10ce7b=_0x666b[_0x25ddfa];return _0x10ce7b;};'use strict';var MailAccountEvents=require(_0xb666('0x0'));var events=[_0xb666('0x1'),_0xb666('0x2'),_0xb666('0x3')];function createListener(_0x277565,_0x370382){return function(_0x1c25e0){_0x370382[_0xb666('0x4')](_0x277565,_0x1c25e0);};}function removeListener(_0x5aac6f,_0x583c12){return function(){MailAccountEvents[_0xb666('0x5')](_0x5aac6f,_0x583c12);};}exports[_0xb666('0x6')]=function(_0x382f22){for(var _0x4eb821=0x0,_0x1ca011=events[_0xb666('0x7')];_0x4eb821<_0x1ca011;_0x4eb821++){var _0x160374=events[_0x4eb821];var _0x472997=createListener('mailAccount:'+_0x160374,_0x382f22);MailAccountEvents['on'](_0x160374,_0x472997);}}; \ No newline at end of file +var _0x845a=['save','remove','update','emit','removeListener','register','length','./mailAccount.events'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x845a,0x1af));var _0xa845=function(_0x243f2c,_0x1a8bcf){_0x243f2c=_0x243f2c-0x0;var _0x1a2ae7=_0x845a[_0x243f2c];return _0x1a2ae7;};'use strict';var MailAccountEvents=require(_0xa845('0x0'));var events=[_0xa845('0x1'),_0xa845('0x2'),_0xa845('0x3')];function createListener(_0x820fe7,_0x2a071e){return function(_0x1e5e76){_0x2a071e[_0xa845('0x4')](_0x820fe7,_0x1e5e76);};}function removeListener(_0x55de42,_0xe455c9){return function(){MailAccountEvents[_0xa845('0x5')](_0x55de42,_0xe455c9);};}exports[_0xa845('0x6')]=function(_0x2ec57f){for(var _0x11fdee=0x0,_0x5bc811=events[_0xa845('0x7')];_0x11fdee<_0x5bc811;_0x11fdee++){var _0x228c45=events[_0x11fdee];var _0x5711bf=createListener('mailAccount:'+_0x228c45,_0x2ec57f);MailAccountEvents['on'](_0x228c45,_0x5711bf);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 86719a5..b8f312b 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 _0xa64a=['./mailApplication.controller','/:id','isAuthenticated','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x33ed0c,_0x53b83b){var _0x4dd462=function(_0x5a9b96){while(--_0x5a9b96){_0x33ed0c['push'](_0x33ed0c['shift']());}};_0x4dd462(++_0x53b83b);}(_0xa64a,0x156));var _0xaa64=function(_0x319906,_0x49ed19){_0x319906=_0x319906-0x0;var _0xfca318=_0xa64a[_0x319906];return _0xfca318;};'use strict';var multer=require(_0xaa64('0x0'));var util=require(_0xaa64('0x1'));var path=require('path');var timeout=require(_0xaa64('0x2'));var express=require(_0xaa64('0x3'));var router=express[_0xaa64('0x4')]();var fs_extra=require(_0xaa64('0x5'));var auth=require(_0xaa64('0x6'));var interaction=require(_0xaa64('0x7'));var config=require('../../config/environment');var controller=require(_0xaa64('0x8'));router['get'](_0xaa64('0x9'),auth[_0xaa64('0xa')](),controller['show']);router['put'](_0xaa64('0x9'),auth['isAuthenticated'](),controller[_0xaa64('0xb')]);router[_0xaa64('0xc')](_0xaa64('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa64('0xd')]=router; \ No newline at end of file +var _0x5efa=['put','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x2612fb,_0x2b0140){var _0x40e7f3=function(_0x41267f){while(--_0x41267f){_0x2612fb['push'](_0x2612fb['shift']());}};_0x40e7f3(++_0x2b0140);}(_0x5efa,0x1a7));var _0xa5ef=function(_0x19e1b8,_0x1571c8){_0x19e1b8=_0x19e1b8-0x0;var _0x446d87=_0x5efa[_0x19e1b8];return _0x446d87;};'use strict';var multer=require(_0xa5ef('0x0'));var util=require(_0xa5ef('0x1'));var path=require('path');var timeout=require(_0xa5ef('0x2'));var express=require(_0xa5ef('0x3'));var router=express['Router']();var fs_extra=require(_0xa5ef('0x4'));var auth=require(_0xa5ef('0x5'));var interaction=require(_0xa5ef('0x6'));var config=require('../../config/environment');var controller=require(_0xa5ef('0x7'));router[_0xa5ef('0x8')](_0xa5ef('0x9'),auth[_0xa5ef('0xa')](),controller[_0xa5ef('0xb')]);router[_0xa5ef('0xc')](_0xa5ef('0x9'),auth[_0xa5ef('0xa')](),controller[_0xa5ef('0xd')]);router[_0xa5ef('0xe')](_0xa5ef('0x9'),auth[_0xa5ef('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 807aa36..53036c0 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 _0x031a=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x354338,_0x3708a9){var _0x308c9a=function(_0x2b8907){while(--_0x2b8907){_0x354338['push'](_0x354338['shift']());}};_0x308c9a(++_0x3708a9);}(_0x031a,0x1a2));var _0xa031=function(_0x5ae04c,_0x3b69b1){_0x5ae04c=_0x5ae04c-0x0;var _0x207104=_0x031a[_0x5ae04c];return _0x207104;};'use strict';var Sequelize=require(_0xa031('0x0'));module[_0xa031('0x1')]={'priority':{'type':Sequelize[_0xa031('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa031('0x3')],'allowNull':![],'defaultValue':_0xa031('0x4')},'appdata':{'type':Sequelize[_0xa031('0x5')]()},'description':{'type':Sequelize[_0xa031('0x3')]},'interval':{'type':Sequelize[_0xa031('0x3')],'defaultValue':_0xa031('0x6')}}; \ No newline at end of file +var _0x4eda=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4eda,0xc1));var _0xa4ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4eda[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa4ed('0x0'));module[_0xa4ed('0x1')]={'priority':{'type':Sequelize[_0xa4ed('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa4ed('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa4ed('0x4')]()},'description':{'type':Sequelize[_0xa4ed('0x3')]},'interval':{'type':Sequelize[_0xa4ed('0x3')],'defaultValue':_0xa4ed('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 456b137..b065748 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2f09f7,_0x461707){_0x2f09f7=_0x2f09f7-0x0;var _0x1b266c=_0xbdb7[_0x2f09f7];return _0x1b266c;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x12e9f8,_0x48ce4c){var _0xadc04d=function(_0x243be0){while(--_0x243be0){_0x12e9f8['push'](_0x12e9f8['shift']());}};_0xadc04d(++_0x48ce4c);}(_0xda3f,0xec));var _0xfda3=function(_0x4fc405,_0x4ead30){_0x4fc405=_0x4fc405-0x0;var _0x54ccb6=_0xda3f[_0x4fc405];return _0x54ccb6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 2fdb588..eb7ba53 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 _0x5400=['utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MailApplication','utf8mb4'];(function(_0x1a696e,_0x225ada){var _0x477235=function(_0x918948){while(--_0x918948){_0x1a696e['push'](_0x1a696e['shift']());}};_0x477235(++_0x225ada);}(_0x5400,0x91));var _0x0540=function(_0x1519ec,_0x26ab64){_0x1519ec=_0x1519ec-0x0;var _0x4ebabc=_0x5400[_0x1519ec];return _0x4ebabc;};'use strict';var _=require(_0x0540('0x0'));var util=require(_0x0540('0x1'));var logger=require('../../config/logger')(_0x0540('0x2'));var moment=require('moment');var BPromise=require(_0x0540('0x3'));var rp=require(_0x0540('0x4'));var fs=require('fs');var path=require(_0x0540('0x5'));var rimraf=require(_0x0540('0x6'));var config=require(_0x0540('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x720610,_0x105467){return _0x720610[_0x0540('0x8')](_0x0540('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0540('0xa'),'collate':_0x0540('0xb')});}; \ No newline at end of file +var _0x8e32=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x54b458,_0x4da21b){var _0x18d704=function(_0x3ca278){while(--_0x3ca278){_0x54b458['push'](_0x54b458['shift']());}};_0x18d704(++_0x4da21b);}(_0x8e32,0xee));var _0x28e3=function(_0x12156e,_0x550b21){_0x12156e=_0x12156e-0x0;var _0x55ada7=_0x8e32[_0x12156e];return _0x55ada7;};'use strict';var _=require(_0x28e3('0x0'));var util=require('util');var logger=require(_0x28e3('0x1'))(_0x28e3('0x2'));var moment=require(_0x28e3('0x3'));var BPromise=require(_0x28e3('0x4'));var rp=require(_0x28e3('0x5'));var fs=require('fs');var path=require(_0x28e3('0x6'));var rimraf=require(_0x28e3('0x7'));var config=require(_0x28e3('0x8'));var attributes=require('./mailApplication.attributes');module[_0x28e3('0x9')]=function(_0x2ad813,_0x4ab366){return _0x2ad813[_0x28e3('0xa')](_0x28e3('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28e3('0xc'),'collate':_0x28e3('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5c0efc5..5ef0947 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 _0x6727=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','then'];(function(_0x541190,_0x37da1b){var _0x1ce607=function(_0x59fcda){while(--_0x59fcda){_0x541190['push'](_0x541190['shift']());}};_0x1ce607(++_0x37da1b);}(_0x6727,0x17a));var _0x7672=function(_0x37492c,_0x347305){_0x37492c=_0x37492c-0x0;var _0x389090=_0x6727[_0x37492c];return _0x389090;};'use strict';var _=require(_0x7672('0x0'));var util=require(_0x7672('0x1'));var moment=require(_0x7672('0x2'));var BPromise=require(_0x7672('0x3'));var rs=require(_0x7672('0x4'));var fs=require('fs');var Redis=require(_0x7672('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7672('0x6'));var logger=require('../../config/logger')(_0x7672('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7672('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fb21d,_0x3abea8,_0x7429ca){return new BPromise(function(_0x4474c1,_0x3636de){return client['request'](_0x2fb21d,_0x7429ca)['then'](function(_0x4775c0){logger[_0x7672('0x9')](_0x7672('0xa'),_0x3abea8,_0x7672('0xb'));logger[_0x7672('0xc')](_0x7672('0xd'),_0x3abea8,_0x7672('0xb'),JSON[_0x7672('0xe')](_0x4775c0));if(_0x4775c0[_0x7672('0xf')]){if(_0x4775c0[_0x7672('0xf')][_0x7672('0x10')]===0x1f4){logger[_0x7672('0xf')](_0x7672('0xa'),_0x3abea8,_0x4775c0[_0x7672('0xf')][_0x7672('0x11')]);return _0x3636de(_0x4775c0[_0x7672('0xf')][_0x7672('0x11')]);}logger[_0x7672('0xf')](_0x7672('0xa'),_0x3abea8,_0x4775c0[_0x7672('0xf')][_0x7672('0x11')]);return _0x4474c1(_0x4775c0['error'][_0x7672('0x11')]);}else{logger[_0x7672('0x9')](_0x7672('0xa'),_0x3abea8,_0x7672('0xb'));_0x4474c1(_0x4775c0[_0x7672('0x12')][_0x7672('0x11')]);}})['catch'](function(_0x4a22c1){logger[_0x7672('0xf')]('MailApplication,\x20%s,\x20%s',_0x3abea8,_0x4a22c1);_0x3636de(_0x4a22c1);});});}exports[_0x7672('0x13')]=function(_0x530424){var _0x4dd172=this;return new Promise(function(_0x455e32,_0x15929f){return db[_0x7672('0x14')]['update'](_0x530424[_0x7672('0x15')],{'raw':_0x530424['options']?_0x530424[_0x7672('0x16')][_0x7672('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x530424[_0x7672('0x16')]?_0x530424[_0x7672('0x16')][_0x7672('0x18')]||null:null,'attributes':_0x530424['options']?_0x530424[_0x7672('0x16')][_0x7672('0x19')]||null:null,'limit':_0x530424[_0x7672('0x16')]?_0x530424[_0x7672('0x16')][_0x7672('0x1a')]||null:null})[_0x7672('0x1b')](function(_0x239d9f){logger[_0x7672('0x9')](_0x7672('0x13'),_0x530424);logger[_0x7672('0xc')](_0x7672('0x13'),_0x530424,JSON[_0x7672('0xe')](_0x239d9f));_0x455e32(_0x239d9f);})[_0x7672('0x1c')](function(_0x451b3a){logger['error'](_0x7672('0x13'),_0x451b3a['message'],_0x530424);_0x15929f(_0x4dd172[_0x7672('0xf')](0x1f4,_0x451b3a['message']));});});}; \ No newline at end of file +var _0xe0c7=['update','body','options','raw','limit','then','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailApplication,\x20%s,\x20%s','request\x20sent','result','UpdateMailApplication','MailApplication'];(function(_0x36fc10,_0x2a1710){var _0x4db52b=function(_0x5679e9){while(--_0x5679e9){_0x36fc10['push'](_0x36fc10['shift']());}};_0x4db52b(++_0x2a1710);}(_0xe0c7,0x1ba));var _0x7e0c=function(_0x229f5a,_0x2e25b7){_0x229f5a=_0x229f5a-0x0;var _0x52566e=_0xe0c7[_0x229f5a];return _0x52566e;};'use strict';var _=require('lodash');var util=require(_0x7e0c('0x0'));var moment=require('moment');var BPromise=require(_0x7e0c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e0c('0x2'));var db=require(_0x7e0c('0x3'))['db'];var utils=require(_0x7e0c('0x4'));var logger=require('../../config/logger')(_0x7e0c('0x5'));var config=require(_0x7e0c('0x6'));var jayson=require(_0x7e0c('0x7'));var client=jayson[_0x7e0c('0x8')][_0x7e0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f0bb1,_0x1d6c1e,_0x18ed2c){return new BPromise(function(_0x56c036,_0x51ec62){return client['request'](_0x5f0bb1,_0x18ed2c)['then'](function(_0x51c22c){logger[_0x7e0c('0xa')]('MailApplication,\x20%s,\x20%s',_0x1d6c1e,'request\x20sent');logger[_0x7e0c('0xb')](_0x7e0c('0xc'),_0x1d6c1e,'request\x20sent',JSON[_0x7e0c('0xd')](_0x51c22c));if(_0x51c22c[_0x7e0c('0xe')]){if(_0x51c22c[_0x7e0c('0xe')][_0x7e0c('0xf')]===0x1f4){logger[_0x7e0c('0xe')]('MailApplication,\x20%s,\x20%s',_0x1d6c1e,_0x51c22c['error'][_0x7e0c('0x10')]);return _0x51ec62(_0x51c22c[_0x7e0c('0xe')][_0x7e0c('0x10')]);}logger['error'](_0x7e0c('0x11'),_0x1d6c1e,_0x51c22c[_0x7e0c('0xe')][_0x7e0c('0x10')]);return _0x56c036(_0x51c22c[_0x7e0c('0xe')][_0x7e0c('0x10')]);}else{logger[_0x7e0c('0xa')](_0x7e0c('0x11'),_0x1d6c1e,_0x7e0c('0x12'));_0x56c036(_0x51c22c[_0x7e0c('0x13')][_0x7e0c('0x10')]);}})['catch'](function(_0x7f7802){logger[_0x7e0c('0xe')]('MailApplication,\x20%s,\x20%s',_0x1d6c1e,_0x7f7802);_0x51ec62(_0x7f7802);});});}exports[_0x7e0c('0x14')]=function(_0x3315aa){var _0x5c8aab=this;return new Promise(function(_0x83e422,_0x4a06ab){return db[_0x7e0c('0x15')][_0x7e0c('0x16')](_0x3315aa[_0x7e0c('0x17')],{'raw':_0x3315aa[_0x7e0c('0x18')]?_0x3315aa[_0x7e0c('0x18')][_0x7e0c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3315aa[_0x7e0c('0x18')]?_0x3315aa[_0x7e0c('0x18')]['where']||null:null,'attributes':_0x3315aa[_0x7e0c('0x18')]?_0x3315aa[_0x7e0c('0x18')]['attributes']||null:null,'limit':_0x3315aa[_0x7e0c('0x18')]?_0x3315aa[_0x7e0c('0x18')][_0x7e0c('0x1a')]||null:null})[_0x7e0c('0x1b')](function(_0x3a41ab){logger[_0x7e0c('0xa')](_0x7e0c('0x14'),_0x3315aa);logger[_0x7e0c('0xb')](_0x7e0c('0x14'),_0x3315aa,JSON[_0x7e0c('0xd')](_0x3a41ab));_0x83e422(_0x3a41ab);})[_0x7e0c('0x1c')](function(_0x21a517){logger[_0x7e0c('0xe')](_0x7e0c('0x14'),_0x21a517[_0x7e0c('0x10')],_0x3315aa);_0x4a06ab(_0x5c8aab[_0x7e0c('0xe')](0x1f4,_0x21a517[_0x7e0c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ed5d320..35ec2d3 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 _0xad1e=['/:id/download','post','create','addMessage','/:id/tags','tracked','mail','addTags','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages'];(function(_0x241232,_0x362e7a){var _0x586711=function(_0x2fd162){while(--_0x2fd162){_0x241232['push'](_0x241232['shift']());}};_0x586711(++_0x362e7a);}(_0xad1e,0xb0));var _0xead1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xad1e[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0xead1('0x0'));var router=express[_0xead1('0x1')]();var auth=require(_0xead1('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xead1('0x3'));router[_0xead1('0x4')]('/',auth[_0xead1('0x5')](),controller[_0xead1('0x6')]);router[_0xead1('0x4')](_0xead1('0x7'),auth[_0xead1('0x5')](),controller[_0xead1('0x8')]);router[_0xead1('0x4')](_0xead1('0x9'),auth[_0xead1('0x5')](),controller[_0xead1('0xa')]);router[_0xead1('0x4')](_0xead1('0xb'),auth[_0xead1('0x5')](),controller[_0xead1('0xc')]);router[_0xead1('0x4')](_0xead1('0xd'),auth[_0xead1('0x5')](),controller['download']);router[_0xead1('0xe')]('/',auth[_0xead1('0x5')](),controller[_0xead1('0xf')]);router[_0xead1('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0xead1('0x10')]);router[_0xead1('0xe')](_0xead1('0x11'),auth[_0xead1('0x5')](),interaction[_0xead1('0x12')](_0xead1('0x13'),'mailinteraction:addtags'),controller[_0xead1('0x14')]);router['put'](_0xead1('0x9'),auth[_0xead1('0x5')](),interaction[_0xead1('0x12')](_0xead1('0x13'),_0xead1('0x15')),controller['update']);router[_0xead1('0x16')]('/:id',auth[_0xead1('0x5')](),interaction[_0xead1('0x12')](_0xead1('0x13'),_0xead1('0x17')),controller[_0xead1('0x18')]);router[_0xead1('0x16')](_0xead1('0x11'),auth[_0xead1('0x5')](),controller[_0xead1('0x19')]);module[_0xead1('0x1a')]=router; \ No newline at end of file +var _0xd44b=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mailinteraction:addtags','addTags','tracked','update','delete','mail','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x54c516,_0x420575){var _0x2583c0=function(_0x4171e4){while(--_0x4171e4){_0x54c516['push'](_0x54c516['shift']());}};_0x2583c0(++_0x420575);}(_0xd44b,0xce));var _0xbd44=function(_0x199869,_0x6b5f7d){_0x199869=_0x199869-0x0;var _0x1583f9=_0xd44b[_0x199869];return _0x1583f9;};'use strict';var express=require(_0xbd44('0x0'));var router=express['Router']();var auth=require(_0xbd44('0x1'));var interaction=require(_0xbd44('0x2'));var controller=require(_0xbd44('0x3'));router[_0xbd44('0x4')]('/',auth[_0xbd44('0x5')](),controller[_0xbd44('0x6')]);router[_0xbd44('0x4')](_0xbd44('0x7'),auth['isAuthenticated'](),controller[_0xbd44('0x8')]);router[_0xbd44('0x4')](_0xbd44('0x9'),auth['isAuthenticated'](),controller[_0xbd44('0xa')]);router[_0xbd44('0x4')](_0xbd44('0xb'),auth[_0xbd44('0x5')](),controller[_0xbd44('0xc')]);router[_0xbd44('0x4')](_0xbd44('0xd'),auth[_0xbd44('0x5')](),controller[_0xbd44('0xe')]);router[_0xbd44('0xf')]('/',auth['isAuthenticated'](),controller[_0xbd44('0x10')]);router[_0xbd44('0xf')](_0xbd44('0xb'),auth['isAuthenticated'](),controller[_0xbd44('0x11')]);router[_0xbd44('0xf')](_0xbd44('0x12'),auth['isAuthenticated'](),interaction['tracked']('mail',_0xbd44('0x13')),controller[_0xbd44('0x14')]);router['put'](_0xbd44('0x9'),auth[_0xbd44('0x5')](),interaction[_0xbd44('0x15')]('mail','mailinteraction:update'),controller[_0xbd44('0x16')]);router[_0xbd44('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xbd44('0x15')](_0xbd44('0x18'),'mailinteraction:destroy'),controller['destroy']);router[_0xbd44('0x17')](_0xbd44('0x12'),auth[_0xbd44('0x5')](),controller[_0xbd44('0x19')]);module[_0xbd44('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index c9b6a4e..1841ebe 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 _0xe5a0=['DATE','STRING','TEXT','long','BOOLEAN','out','ENUM','sequelize','iconv'];(function(_0x54d5d3,_0x151e51){var _0x48d972=function(_0x34388d){while(--_0x34388d){_0x54d5d3['push'](_0x54d5d3['shift']());}};_0x48d972(++_0x151e51);}(_0xe5a0,0xcd));var _0x0e5a=function(_0x3b6077,_0x195add){_0x3b6077=_0x3b6077-0x0;var _0x418c28=_0xe5a0[_0x3b6077];return _0x418c28;};'use strict';var Sequelize=require(_0x0e5a('0x0'));var iconv=require(_0x0e5a('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0e5a('0x2')]},'disposition':{'type':Sequelize[_0x0e5a('0x3')]},'secondDisposition':{'type':Sequelize[_0x0e5a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0e5a('0x3')]},'note':{'type':Sequelize[_0x0e5a('0x3')]},'inReplyTo':{'type':Sequelize[_0x0e5a('0x3')](0x1fe)},'to':{'type':Sequelize[_0x0e5a('0x3')]},'cc':{'type':Sequelize[_0x0e5a('0x4')](_0x0e5a('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x0e5a('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0e5a('0x2')]},'substatus':{'type':Sequelize[_0x0e5a('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x0e5a('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x0e5a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0e5a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x0e5a('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0e5a('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x559f=['ENUM','out','sequelize','iconv','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x3c2312,_0x2c20ec){var _0x21c46c=function(_0x3578e0){while(--_0x3578e0){_0x3c2312['push'](_0x3c2312['shift']());}};_0x21c46c(++_0x2c20ec);}(_0x559f,0xf5));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf559('0x0'));var iconv=require(_0xf559('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf559('0x2')]},'disposition':{'type':Sequelize[_0xf559('0x3')]},'secondDisposition':{'type':Sequelize[_0xf559('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf559('0x3')]},'note':{'type':Sequelize[_0xf559('0x3')]},'inReplyTo':{'type':Sequelize[_0xf559('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf559('0x4')](_0xf559('0x5'))},'subject':{'type':Sequelize[_0xf559('0x4')]()},'attach':{'type':Sequelize[_0xf559('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf559('0x2')]},'substatus':{'type':Sequelize[_0xf559('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xf559('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf559('0x7')]('in',_0xf559('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf559('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf559('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf559('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 91ecb97..94e268c 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(_0x36154a,_0x2cf98c){var _0x61104e=function(_0x1e23ed){while(--_0x1e23ed){_0x36154a['push'](_0x36154a['shift']());}};_0x61104e(++_0x2cf98c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x299c15,_0x287ea3){var _0x578cfb=function(_0x2cd794){while(--_0x2cd794){_0x299c15['push'](_0x299c15['shift']());}};_0x578cfb(++_0x287ea3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 dbbaa13..93f6ca7 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 _0xfcda=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5e9d1f,_0x37c578){var _0x895bea=function(_0x4e10bc){while(--_0x4e10bc){_0x5e9d1f['push'](_0x5e9d1f['shift']());}};_0x895bea(++_0x37c578);}(_0xfcda,0x132));var _0xafcd=function(_0xcd3753,_0x5f170f){_0xcd3753=_0xcd3753-0x0;var _0x4831f1=_0xfcda[_0xcd3753];return _0x4831f1;};'use strict';var EventEmitter=require(_0xafcd('0x0'));var MailInteraction=require(_0xafcd('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xafcd('0x1'))['db'][_0xafcd('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xafcd('0x3')](0x0);var events={'afterCreate':_0xafcd('0x4'),'afterUpdate':'update','afterDestroy':_0xafcd('0x5')};function emitEvent(_0x42e7e8){return function(_0x196388,_0x51e9a0,_0x330371){_0x196388[_0xafcd('0x6')]({'attributes':['id'],'raw':!![]})[_0xafcd('0x7')](function(_0x2b69a7){_0x196388['setDataValue'](_0xafcd('0x8'),_0x2b69a7[_0xafcd('0x9')](function(_0x26e315){return{'id':_0x26e315['id']};}));return MailMessage[_0xafcd('0xa')]({'where':{'MailInteractionId':_0x196388['id'],'direction':'in','read':![]},'raw':!![]});})[_0xafcd('0x7')](function(_0x4dab44){_0x196388[_0xafcd('0xb')](_0xafcd('0xc'),_0x4dab44[_0xafcd('0xd')]);MailInteractionEvents[_0xafcd('0xe')](_0x42e7e8+':'+_0x196388['id'],_0x196388);MailInteractionEvents[_0xafcd('0xe')](_0x42e7e8,_0x196388);_0x330371(null);})[_0xafcd('0xf')](_0x330371(null));};}for(var e in events){if(events[_0xafcd('0x10')](e)){var event=events[e];MailInteraction[_0xafcd('0x11')](e,emitEvent(event));}}module[_0xafcd('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x0df3=['hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','catch'];(function(_0x3341a5,_0xee8867){var _0x3af5c9=function(_0x36ad63){while(--_0x36ad63){_0x3341a5['push'](_0x3341a5['shift']());}};_0x3af5c9(++_0xee8867);}(_0x0df3,0x73));var _0x30df=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x0df3[_0x26fc81];return _0x9feece;};'use strict';var EventEmitter=require(_0x30df('0x0'));var MailInteraction=require(_0x30df('0x1'))['db'][_0x30df('0x2')];var MailMessage=require(_0x30df('0x1'))['db'][_0x30df('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x30df('0x4'),'afterDestroy':_0x30df('0x5')};function emitEvent(_0x233d13){return function(_0x26f017,_0x9f762e,_0x20ef62){_0x26f017[_0x30df('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32a720){_0x26f017[_0x30df('0x7')]('Users',_0x32a720[_0x30df('0x8')](function(_0x4c8238){return{'id':_0x4c8238['id']};}));return MailMessage[_0x30df('0x9')]({'where':{'MailInteractionId':_0x26f017['id'],'direction':'in','read':![]},'raw':!![]});})[_0x30df('0xa')](function(_0x11e871){_0x26f017[_0x30df('0x7')](_0x30df('0xb'),_0x11e871['length']);MailInteractionEvents['emit'](_0x233d13+':'+_0x26f017['id'],_0x26f017);MailInteractionEvents['emit'](_0x233d13,_0x26f017);_0x20ef62(null);})[_0x30df('0xc')](_0x20ef62(null));};}for(var e in events){if(events[_0x30df('0xd')](e)){var event=events[e];MailInteraction[_0x30df('0xe')](e,emitEvent(event));}}module[_0x30df('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 276df89..fd4ae9a 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 _0x1e2a=['MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get'];(function(_0x553d8f,_0x55b0fe){var _0x8545b7=function(_0x384675){while(--_0x384675){_0x553d8f['push'](_0x553d8f['shift']());}};_0x8545b7(++_0x55b0fe);}(_0x1e2a,0xd0));var _0xa1e2=function(_0x13a696,_0x148dba){_0x13a696=_0x13a696-0x0;var _0x1d7817=_0x1e2a[_0x13a696];return _0x1d7817;};'use strict';var _=require(_0xa1e2('0x0'));var util=require(_0xa1e2('0x1'));var logger=require(_0xa1e2('0x2'))(_0xa1e2('0x3'));var moment=require('moment');var BPromise=require(_0xa1e2('0x4'));var rp=require(_0xa1e2('0x5'));var fs=require('fs');var path=require(_0xa1e2('0x6'));var rimraf=require(_0xa1e2('0x7'));var config=require(_0xa1e2('0x8'));var attributes=require(_0xa1e2('0x9'));module[_0xa1e2('0xa')]=function(_0x1e0a1a,_0x1202f8){return _0x1e0a1a['define'](_0xa1e2('0xb'),attributes,{'tableName':_0xa1e2('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xa1e2('0xd'),'to'],'type':_0xa1e2('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x263592,_0x2781f6,_0x217503){if(_0x263592['substatus']){_0x263592[_0xa1e2('0xf')]=moment()[_0xa1e2('0x10')](_0xa1e2('0x11'));}if(_0x263592[_0xa1e2('0x12')]){_0x263592[_0xa1e2('0x13')]=moment()[_0xa1e2('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x217503(null,_0x2781f6);},'beforeUpdate':function(_0x47a02c,_0x308066,_0x435150){if(_0x47a02c[_0xa1e2('0x14')](_0xa1e2('0x15'))){_0x47a02c['substatusAt']=_0x47a02c['substatus']?moment()[_0xa1e2('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x47a02c[_0xa1e2('0x14')](_0xa1e2('0x12'))){_0x47a02c[_0xa1e2('0x13')]=moment()[_0xa1e2('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x47a02c[_0xa1e2('0x15')]=null;_0x47a02c['substatusAt']=null;}_0x435150(null,_0x47a02c);},'afterUpdate':function(_0x393877,_0x117456,_0x9c3432){var _0x25dc3d=_0x1e0a1a[_0xa1e2('0x16')];var _0x544025=_0x393877[_0xa1e2('0x17')]({'plain':!![]});if(_0x544025[_0xa1e2('0x12')]){return _0x25dc3d[_0xa1e2('0x18')][_0xa1e2('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x544025['id']}})[_0xa1e2('0x1a')](function(){_0x9c3432();})[_0xa1e2('0x1b')](function(_0x2badf0){_0x9c3432(_0x2badf0);});}else{_0x9c3432();}}},'charset':_0xa1e2('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x72f8=['format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','then','catch','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt'];(function(_0xbb91d2,_0x4cad6c){var _0x3726c9=function(_0x4565c4){while(--_0x4565c4){_0xbb91d2['push'](_0xbb91d2['shift']());}};_0x3726c9(++_0x4cad6c);}(_0x72f8,0x136));var _0x872f=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x72f8[_0x5d860f];return _0x236490;};'use strict';var _=require(_0x872f('0x0'));var util=require(_0x872f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x872f('0x2'));var BPromise=require(_0x872f('0x3'));var rp=require(_0x872f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x872f('0x5'));var config=require(_0x872f('0x6'));var attributes=require(_0x872f('0x7'));module[_0x872f('0x8')]=function(_0x15d7b4,_0x26bf00){return _0x15d7b4[_0x872f('0x9')](_0x872f('0xa'),attributes,{'tableName':_0x872f('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x872f('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x502885,_0x58b56f,_0x3bfafd){if(_0x502885[_0x872f('0xd')]){_0x502885[_0x872f('0xe')]=moment()[_0x872f('0xf')](_0x872f('0x10'));}if(_0x502885[_0x872f('0x11')]){_0x502885[_0x872f('0x12')]=moment()['format'](_0x872f('0x10'));}_0x3bfafd(null,_0x58b56f);},'beforeUpdate':function(_0x2598b6,_0x243556,_0x486892){if(_0x2598b6[_0x872f('0x13')](_0x872f('0xd'))){_0x2598b6[_0x872f('0xe')]=_0x2598b6['substatus']?moment()[_0x872f('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2598b6[_0x872f('0x13')]('closed')){_0x2598b6[_0x872f('0x12')]=moment()[_0x872f('0xf')](_0x872f('0x10'));_0x2598b6[_0x872f('0xd')]=null;_0x2598b6[_0x872f('0xe')]=null;}_0x486892(null,_0x2598b6);},'afterUpdate':function(_0x440e13,_0x1f3873,_0x410fa8){var _0x376caf=_0x15d7b4[_0x872f('0x14')];var _0x1b856d=_0x440e13[_0x872f('0x15')]({'plain':!![]});if(_0x1b856d[_0x872f('0x11')]){return _0x376caf[_0x872f('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x1b856d['id']}})[_0x872f('0x17')](function(){_0x410fa8();})[_0x872f('0x18')](function(_0x49871f){_0x410fa8(_0x49871f);});}else{_0x410fa8();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5033c96..3280908 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 _0x08e2=['options','raw','where','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x08e2,0x8c));var _0x208e=function(_0x1d49c2,_0x3189df){_0x1d49c2=_0x1d49c2-0x0;var _0x23f855=_0x08e2[_0x1d49c2];return _0x23f855;};'use strict';var _=require(_0x208e('0x0'));var util=require(_0x208e('0x1'));var moment=require(_0x208e('0x2'));var BPromise=require(_0x208e('0x3'));var rs=require(_0x208e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x208e('0x5'))['db'];var utils=require(_0x208e('0x6'));var logger=require(_0x208e('0x7'))(_0x208e('0x8'));var config=require(_0x208e('0x9'));var jayson=require(_0x208e('0xa'));var client=jayson[_0x208e('0xb')][_0x208e('0xc')]({'port':0x232a});config[_0x208e('0xd')]=_['defaults'](config['redis'],{'host':_0x208e('0xe'),'port':0x18eb});var socket=require(_0x208e('0xf'))(new Redis(config[_0x208e('0xd')]));require(_0x208e('0x10'))['register'](socket);function respondWithRpcPromise(_0x9ff28a,_0x17afc0,_0x5336fb){return new BPromise(function(_0x2cf0f3,_0x5c8231){return client['request'](_0x9ff28a,_0x5336fb)[_0x208e('0x11')](function(_0x1d887f){logger[_0x208e('0x12')](_0x208e('0x13'),_0x17afc0,_0x208e('0x14'));logger[_0x208e('0x15')](_0x208e('0x16'),_0x17afc0,_0x208e('0x14'),JSON['stringify'](_0x1d887f));if(_0x1d887f[_0x208e('0x17')]){if(_0x1d887f[_0x208e('0x17')][_0x208e('0x18')]===0x1f4){logger['error'](_0x208e('0x13'),_0x17afc0,_0x1d887f[_0x208e('0x17')]['message']);return _0x5c8231(_0x1d887f[_0x208e('0x17')]['message']);}logger[_0x208e('0x17')](_0x208e('0x13'),_0x17afc0,_0x1d887f[_0x208e('0x17')][_0x208e('0x19')]);return _0x2cf0f3(_0x1d887f[_0x208e('0x17')][_0x208e('0x19')]);}else{logger['info'](_0x208e('0x13'),_0x17afc0,_0x208e('0x14'));_0x2cf0f3(_0x1d887f[_0x208e('0x1a')][_0x208e('0x19')]);}})[_0x208e('0x1b')](function(_0x3cab96){logger[_0x208e('0x17')](_0x208e('0x13'),_0x17afc0,_0x3cab96);_0x5c8231(_0x3cab96);});});}exports[_0x208e('0x1c')]=function(_0x25ac96){var _0x2d41b1=this;return new Promise(function(_0x368cb6,_0x3c7a0a){return db[_0x208e('0x1d')][_0x208e('0x1e')](_0x25ac96[_0x208e('0x1f')],{'raw':_0x25ac96[_0x208e('0x20')]?_0x25ac96[_0x208e('0x20')][_0x208e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25ac96[_0x208e('0x20')]?_0x25ac96[_0x208e('0x20')][_0x208e('0x22')]||null:null,'attributes':_0x25ac96['options']?_0x25ac96[_0x208e('0x20')]['attributes']||null:null,'limit':_0x25ac96[_0x208e('0x20')]?_0x25ac96[_0x208e('0x20')]['limit']||null:null})[_0x208e('0x11')](function(_0x32ca3c){logger[_0x208e('0x12')](_0x208e('0x1c'),_0x25ac96);logger[_0x208e('0x15')](_0x208e('0x1c'),_0x25ac96,JSON['stringify'](_0x32ca3c));_0x368cb6(_0x32ca3c);})['catch'](function(_0x1c35d0){logger[_0x208e('0x17')](_0x208e('0x1c'),_0x1c35d0['message'],_0x25ac96);_0x3c7a0a(_0x2d41b1[_0x208e('0x17')](0x1f4,_0x1c35d0[_0x208e('0x19')]));});});};exports[_0x208e('0x23')]=function(_0x3e32ef){return new Promise(function(_0x6cddfa,_0x486c2d){return db[_0x208e('0x1d')][_0x208e('0x24')]({'where':_0x3e32ef[_0x208e('0x20')]?_0x3e32ef[_0x208e('0x20')][_0x208e('0x22')]||null:null})[_0x208e('0x11')](function(_0x870b76){if(_0x870b76){return _0x870b76[_0x208e('0x25')](_0x3e32ef[_0x208e('0x1f')][_0x208e('0x26')],_[_0x208e('0x27')](_0x3e32ef[_0x208e('0x1f')],[_0x208e('0x26'),'id'])||{});}})[_0x208e('0x28')](function(_0x554725){logger[_0x208e('0x12')](_0x208e('0x29'),_0x3e32ef);logger['debug'](_0x208e('0x29'),_0x3e32ef,JSON[_0x208e('0x2a')](_0x554725));_0x6cddfa(_0x554725);})[_0x208e('0x1b')](function(_0xe942b1){logger[_0x208e('0x17')]('AddTags',_0xe942b1[_0x208e('0x19')],_0x3e32ef);_0x486c2d(_this['error'](0x1f4,_0xe942b1[_0x208e('0x19')]));});});}; \ No newline at end of file +var _0xc1ad=['defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x28a42d,_0x121d28){var _0x30c70b=function(_0x18c674){while(--_0x18c674){_0x28a42d['push'](_0x28a42d['shift']());}};_0x30c70b(++_0x121d28);}(_0xc1ad,0x1d8));var _0xdc1a=function(_0x4b766f,_0x5eac4b){_0x4b766f=_0x4b766f-0x0;var _0x28e3ec=_0xc1ad[_0x4b766f];return _0x28e3ec;};'use strict';var _=require(_0xdc1a('0x0'));var util=require(_0xdc1a('0x1'));var moment=require(_0xdc1a('0x2'));var BPromise=require(_0xdc1a('0x3'));var rs=require(_0xdc1a('0x4'));var fs=require('fs');var Redis=require(_0xdc1a('0x5'));var db=require(_0xdc1a('0x6'))['db'];var utils=require(_0xdc1a('0x7'));var logger=require(_0xdc1a('0x8'))(_0xdc1a('0x9'));var config=require('../../config/environment');var jayson=require(_0xdc1a('0xa'));var client=jayson[_0xdc1a('0xb')]['http']({'port':0x232a});config['redis']=_[_0xdc1a('0xc')](config[_0xdc1a('0xd')],{'host':_0xdc1a('0xe'),'port':0x18eb});var socket=require(_0xdc1a('0xf'))(new Redis(config[_0xdc1a('0xd')]));require(_0xdc1a('0x10'))[_0xdc1a('0x11')](socket);function respondWithRpcPromise(_0xf8a06b,_0x10fb57,_0x2384a4){return new BPromise(function(_0x26a0ad,_0x182c55){return client['request'](_0xf8a06b,_0x2384a4)[_0xdc1a('0x12')](function(_0x4f27ab){logger[_0xdc1a('0x13')](_0xdc1a('0x14'),_0x10fb57,_0xdc1a('0x15'));logger['debug'](_0xdc1a('0x16'),_0x10fb57,_0xdc1a('0x15'),JSON[_0xdc1a('0x17')](_0x4f27ab));if(_0x4f27ab[_0xdc1a('0x18')]){if(_0x4f27ab[_0xdc1a('0x18')][_0xdc1a('0x19')]===0x1f4){logger[_0xdc1a('0x18')](_0xdc1a('0x14'),_0x10fb57,_0x4f27ab['error']['message']);return _0x182c55(_0x4f27ab[_0xdc1a('0x18')][_0xdc1a('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x10fb57,_0x4f27ab[_0xdc1a('0x18')]['message']);return _0x26a0ad(_0x4f27ab[_0xdc1a('0x18')]['message']);}else{logger[_0xdc1a('0x13')](_0xdc1a('0x14'),_0x10fb57,_0xdc1a('0x15'));_0x26a0ad(_0x4f27ab[_0xdc1a('0x1b')][_0xdc1a('0x1a')]);}})[_0xdc1a('0x1c')](function(_0x533719){logger[_0xdc1a('0x18')]('MailInteraction,\x20%s,\x20%s',_0x10fb57,_0x533719);_0x182c55(_0x533719);});});}exports['UpdateMailInteraction']=function(_0x1dfc3d){var _0x13dc76=this;return new Promise(function(_0x205f93,_0x72f933){return db['MailInteraction'][_0xdc1a('0x1d')](_0x1dfc3d[_0xdc1a('0x1e')],{'raw':_0x1dfc3d[_0xdc1a('0x1f')]?_0x1dfc3d['options'][_0xdc1a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dfc3d[_0xdc1a('0x1f')]?_0x1dfc3d['options'][_0xdc1a('0x21')]||null:null,'attributes':_0x1dfc3d[_0xdc1a('0x1f')]?_0x1dfc3d[_0xdc1a('0x1f')][_0xdc1a('0x22')]||null:null,'limit':_0x1dfc3d['options']?_0x1dfc3d['options']['limit']||null:null})['then'](function(_0x3bdda4){logger[_0xdc1a('0x13')](_0xdc1a('0x23'),_0x1dfc3d);logger['debug'](_0xdc1a('0x23'),_0x1dfc3d,JSON[_0xdc1a('0x17')](_0x3bdda4));_0x205f93(_0x3bdda4);})['catch'](function(_0x3239c7){logger[_0xdc1a('0x18')](_0xdc1a('0x23'),_0x3239c7[_0xdc1a('0x1a')],_0x1dfc3d);_0x72f933(_0x13dc76['error'](0x1f4,_0x3239c7[_0xdc1a('0x1a')]));});});};exports[_0xdc1a('0x24')]=function(_0x59894d){return new Promise(function(_0x429603,_0x3de76f){return db[_0xdc1a('0x25')][_0xdc1a('0x26')]({'where':_0x59894d[_0xdc1a('0x1f')]?_0x59894d[_0xdc1a('0x1f')][_0xdc1a('0x21')]||null:null})[_0xdc1a('0x12')](function(_0x37557f){if(_0x37557f){return _0x37557f[_0xdc1a('0x27')](_0x59894d['body'][_0xdc1a('0x28')],_[_0xdc1a('0x29')](_0x59894d[_0xdc1a('0x1e')],[_0xdc1a('0x28'),'id'])||{});}})['spread'](function(_0x1b6406){logger['info'](_0xdc1a('0x2a'),_0x59894d);logger[_0xdc1a('0x2b')](_0xdc1a('0x2a'),_0x59894d,JSON[_0xdc1a('0x17')](_0x1b6406));_0x429603(_0x1b6406);})[_0xdc1a('0x1c')](function(_0x4bad0f){logger[_0xdc1a('0x18')](_0xdc1a('0x2a'),_0x4bad0f[_0xdc1a('0x1a')],_0x59894d);_0x3de76f(_this[_0xdc1a('0x18')](0x1f4,_0x4bad0f[_0xdc1a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e1a4d30..91267a7 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 _0xbf7d=['save','remove','update','emit','register','mailInteraction:','./mailInteraction.events'];(function(_0x4c2163,_0x3fb6f5){var _0x102d32=function(_0x10dea1){while(--_0x10dea1){_0x4c2163['push'](_0x4c2163['shift']());}};_0x102d32(++_0x3fb6f5);}(_0xbf7d,0xd1));var _0xdbf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf7d[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0xdbf7('0x0'));var events=[_0xdbf7('0x1'),_0xdbf7('0x2'),_0xdbf7('0x3')];function createListener(_0x42874d,_0x45ea74){return function(_0x343ad8){_0x45ea74[_0xdbf7('0x4')](_0x42874d,_0x343ad8);};}function removeListener(_0x3ac2f6,_0x5e32b5){return function(){MailInteractionEvents['removeListener'](_0x3ac2f6,_0x5e32b5);};}exports[_0xdbf7('0x5')]=function(_0x257d30){for(var _0xea2125=0x0,_0x3965c0=events['length'];_0xea2125<_0x3965c0;_0xea2125++){var _0x4f8922=events[_0xea2125];var _0x1e9475=createListener(_0xdbf7('0x6')+_0x4f8922,_0x257d30);MailInteractionEvents['on'](_0x4f8922,_0x1e9475);}}; \ No newline at end of file +var _0x5d75=['register','length','mailInteraction:','./mailInteraction.events','remove','update','emit','removeListener'];(function(_0x558f9f,_0x2036ca){var _0x4fa18b=function(_0x1b8c4a){while(--_0x1b8c4a){_0x558f9f['push'](_0x558f9f['shift']());}};_0x4fa18b(++_0x2036ca);}(_0x5d75,0xfb));var _0x55d7=function(_0x35599c,_0x2bb723){_0x35599c=_0x35599c-0x0;var _0x3d5569=_0x5d75[_0x35599c];return _0x3d5569;};'use strict';var MailInteractionEvents=require(_0x55d7('0x0'));var events=['save',_0x55d7('0x1'),_0x55d7('0x2')];function createListener(_0xec049,_0x1f3d54){return function(_0x35d792){_0x1f3d54[_0x55d7('0x3')](_0xec049,_0x35d792);};}function removeListener(_0xb441d1,_0x542428){return function(){MailInteractionEvents[_0x55d7('0x4')](_0xb441d1,_0x542428);};}exports[_0x55d7('0x5')]=function(_0xd62f31){for(var _0x2fb77d=0x0,_0x4815ee=events[_0x55d7('0x6')];_0x2fb77d<_0x4815ee;_0x2fb77d++){var _0x5ffd67=events[_0x2fb77d];var _0x1924a0=createListener(_0x55d7('0x7')+_0x5ffd67,_0xd62f31);MailInteractionEvents['on'](_0x5ffd67,_0x1924a0);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ce8c937..a9a9d1b 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 _0x4a2e=['get','index','/describe','describe','isAuthenticated','show','/:id/download','download','tracked','mail','create','/:id','update','put','accept','/:id/reject','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2b2cdf,_0xff30e7){var _0x3c1af7=function(_0x17120d){while(--_0x17120d){_0x2b2cdf['push'](_0x2b2cdf['shift']());}};_0x3c1af7(++_0xff30e7);}(_0x4a2e,0x125));var _0xe4a2=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0x4a2e[_0x45346d];return _0x5ce7ca;};'use strict';var multer=require(_0xe4a2('0x0'));var util=require(_0xe4a2('0x1'));var path=require(_0xe4a2('0x2'));var timeout=require('connect-timeout');var express=require(_0xe4a2('0x3'));var router=express[_0xe4a2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe4a2('0x5'));var interaction=require(_0xe4a2('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xe4a2('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4a2('0x8')]);router['get'](_0xe4a2('0x9'),auth['isAuthenticated'](),controller[_0xe4a2('0xa')]);router['get']('/:id',auth[_0xe4a2('0xb')](),controller[_0xe4a2('0xc')]);router[_0xe4a2('0x7')](_0xe4a2('0xd'),auth[_0xe4a2('0xb')](),controller[_0xe4a2('0xe')]);router['post']('/',auth[_0xe4a2('0xb')](),interaction[_0xe4a2('0xf')](_0xe4a2('0x10'),'mailmessage:create'),controller[_0xe4a2('0x11')]);router['put'](_0xe4a2('0x12'),auth[_0xe4a2('0xb')](),controller[_0xe4a2('0x13')]);router[_0xe4a2('0x14')]('/:id/accept',auth[_0xe4a2('0xb')](),controller[_0xe4a2('0x15')]);router[_0xe4a2('0x14')](_0xe4a2('0x16'),auth[_0xe4a2('0xb')](),controller['reject']);router['delete'](_0xe4a2('0x12'),auth[_0xe4a2('0xb')](),controller[_0xe4a2('0x17')]);module[_0xe4a2('0x18')]=router; \ No newline at end of file +var _0x5bc5=['download','post','tracked','mail','mailmessage:create','put','update','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x5bc5,0xb2));var _0x55bc=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x5bc5[_0x2e7f96];return _0x315277;};'use strict';var multer=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var path=require(_0x55bc('0x2'));var timeout=require(_0x55bc('0x3'));var express=require(_0x55bc('0x4'));var router=express[_0x55bc('0x5')]();var fs_extra=require(_0x55bc('0x6'));var auth=require(_0x55bc('0x7'));var interaction=require(_0x55bc('0x8'));var config=require(_0x55bc('0x9'));var controller=require(_0x55bc('0xa'));router[_0x55bc('0xb')]('/',auth[_0x55bc('0xc')](),controller['index']);router[_0x55bc('0xb')](_0x55bc('0xd'),auth[_0x55bc('0xc')](),controller[_0x55bc('0xe')]);router['get'](_0x55bc('0xf'),auth[_0x55bc('0xc')](),controller[_0x55bc('0x10')]);router[_0x55bc('0xb')](_0x55bc('0x11'),auth[_0x55bc('0xc')](),controller[_0x55bc('0x12')]);router[_0x55bc('0x13')]('/',auth['isAuthenticated'](),interaction[_0x55bc('0x14')](_0x55bc('0x15'),_0x55bc('0x16')),controller['create']);router[_0x55bc('0x17')]('/:id',auth[_0x55bc('0xc')](),controller[_0x55bc('0x18')]);router[_0x55bc('0x17')]('/:id/accept',auth[_0x55bc('0xc')](),controller['accept']);router[_0x55bc('0x17')](_0x55bc('0x19'),auth[_0x55bc('0xc')](),controller['reject']);router[_0x55bc('0x1a')](_0x55bc('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x55bc('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 d844a85..e74f1df 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 _0x3f72=['long','medium','BOOLEAN','ENUM','STRING','DATE','INTEGER','Email','Chat','lodash','exports','TEXT'];(function(_0x868a3e,_0x4d9a10){var _0x1cfdfe=function(_0x41234b){while(--_0x41234b){_0x868a3e['push'](_0x868a3e['shift']());}};_0x1cfdfe(++_0x4d9a10);}(_0x3f72,0xbd));var _0x23f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3f72[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x23f7('0x0'));module[_0x23f7('0x1')]={'body':{'type':Sequelize[_0x23f7('0x2')](_0x23f7('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x23f7('0x4'))},'read':{'type':Sequelize[_0x23f7('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x23f7('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x23f7('0x7')](0x1fe)},'from':{'type':Sequelize[_0x23f7('0x7')]},'to':{'type':Sequelize[_0x23f7('0x2')](_0x23f7('0x3'))},'cc':{'type':Sequelize[_0x23f7('0x2')](_0x23f7('0x3'))},'bcc':{'type':Sequelize[_0x23f7('0x2')](_0x23f7('0x3'))},'subject':{'type':Sequelize[_0x23f7('0x2')]},'sentAt':{'type':Sequelize[_0x23f7('0x8')]},'attach':{'type':Sequelize[_0x23f7('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x23f7('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x23f7('0x8')]},'originTo':{'type':Sequelize[_0x23f7('0x2')]('long')},'originCc':{'type':Sequelize[_0x23f7('0x2')](_0x23f7('0x3'))},'originChannel':{'type':Sequelize[_0x23f7('0x6')](_0x23f7('0xa'),_0x23f7('0xb')),'defaultValue':_0x23f7('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x9a1f=['Email','Chat','lodash','exports','long','TEXT','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x529234,_0x38b7e9){var _0x4b8f85=function(_0x40bc92){while(--_0x40bc92){_0x529234['push'](_0x529234['shift']());}};_0x4b8f85(++_0x38b7e9);}(_0x9a1f,0x146));var _0xf9a1=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x9a1f[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf9a1('0x0'));module[_0xf9a1('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf9a1('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf9a1('0x3')]('medium')},'read':{'type':Sequelize[_0xf9a1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf9a1('0x5')]('in',_0xf9a1('0x6')),'defaultValue':_0xf9a1('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf9a1('0x7')](0x1fe)},'from':{'type':Sequelize[_0xf9a1('0x7')]},'to':{'type':Sequelize[_0xf9a1('0x3')](_0xf9a1('0x2'))},'cc':{'type':Sequelize[_0xf9a1('0x3')](_0xf9a1('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0xf9a1('0x2'))},'subject':{'type':Sequelize[_0xf9a1('0x3')]},'sentAt':{'type':Sequelize[_0xf9a1('0x8')]},'attach':{'type':Sequelize[_0xf9a1('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xf9a1('0x3')](_0xf9a1('0x2'))},'originCc':{'type':Sequelize[_0xf9a1('0x3')](_0xf9a1('0x2'))},'originChannel':{'type':Sequelize[_0xf9a1('0x5')](_0xf9a1('0xa'),_0xf9a1('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 2d95967..f4fc6ce 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 _0x6312=['service','host','secure','auth','pass','user','attachments','root','server/files/attachments','basename','List','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','read','readAt','format','UserId','agent','get','MailInteraction','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','internal','interface','motionChannel','event','rejectmessage','download','unix','toString','join','files','tmp','server','message-%s.eml','bcc','subject','createdAt','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','util','path','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','offset','limit','undefined','count','Content-Range','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','params','find','update','body','describe','secret','split','MailAccount','MailAccountId','CmList','CmContact','Contacts','updatedAt','MailServerOut','isNil','Smtp'];(function(_0x288168,_0x3d336a){var _0x252eb0=function(_0x354281){while(--_0x354281){_0x288168['push'](_0x288168['shift']());}};_0x252eb0(++_0x3d336a);}(_0x6312,0x18e));var _0x2631=function(_0xfbc494,_0x44ff81){_0xfbc494=_0xfbc494-0x0;var _0x37690c=_0x6312[_0xfbc494];return _0x37690c;};'use strict';var emlformat=require(_0x2631('0x0'));var moment=require(_0x2631('0x1'));var BPromise=require('bluebird');var util=require(_0x2631('0x2'));var path=require(_0x2631('0x3'));var fs=require('fs');var _=require(_0x2631('0x4'));var Redis=require('ioredis');var htmlToText=require(_0x2631('0x5'));var qs=require(_0x2631('0x6'));var logger=require('../../config/logger')(_0x2631('0x7'));var interaction_log=require(_0x2631('0x8'))(_0x2631('0x9'));var config=require(_0x2631('0xa'));var db=require(_0x2631('0xb'))['db'];config['redis']=_[_0x2631('0xc')](config[_0x2631('0xd')],{'host':_0x2631('0xe'),'port':0x18eb});var socket=require(_0x2631('0xf'))(new Redis(config['redis']));require(_0x2631('0x10'))[_0x2631('0x11')](socket);var jayson=require(_0x2631('0x12'));var client=jayson[_0x2631('0x13')][_0x2631('0x14')]({'port':0x232c});var client9003=jayson[_0x2631('0x13')]['http']({'port':0x232b});var client9002=jayson['client'][_0x2631('0x14')]({'port':0x232a});function respondWithRpcPromise(_0xbc71d0,_0x256726,_0x13ec68,_0x11def5){return new BPromise(function(_0x7b8bc,_0x32197d){var _0x3f2b72=_0x11def5||client;return _0x3f2b72[_0x2631('0x15')](_0xbc71d0,_0x13ec68)[_0x2631('0x16')](function(_0x1f639c){logger['info'](_0x2631('0x17'),_0x256726,_0x2631('0x18'));logger[_0x2631('0x19')](_0x2631('0x1a'),_0x256726,_0x2631('0x18'),JSON[_0x2631('0x1b')](_0x1f639c));if(_0x1f639c[_0x2631('0x1c')]){if(_0x1f639c[_0x2631('0x1c')][_0x2631('0x1d')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x256726,_0x1f639c[_0x2631('0x1c')][_0x2631('0x1e')]);return _0x32197d(_0x1f639c[_0x2631('0x1c')][_0x2631('0x1e')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x256726,_0x1f639c[_0x2631('0x1c')]['message']);return _0x7b8bc(_0x1f639c['error']['message']);}else{logger[_0x2631('0x1f')](_0x2631('0x17'),_0x256726,_0x2631('0x18'));_0x7b8bc(_0x1f639c[_0x2631('0x20')][_0x2631('0x1e')]);}})[_0x2631('0x21')](function(_0x2cf7aa){logger[_0x2631('0x1c')](_0x2631('0x17'),_0x256726,_0x2cf7aa);_0x32197d(_0x2cf7aa);});});}function respondWithResult(_0x5b0f9f,_0x364c68){_0x364c68=_0x364c68||0xc8;return function(_0x265d3f){if(_0x265d3f){return _0x5b0f9f[_0x2631('0x22')](_0x364c68)[_0x2631('0x23')](_0x265d3f);}};}function respondWithFilteredResult(_0x5a9328,_0x2d5703){return function(_0x2c7e40){if(_0x2c7e40){var _0x506a03=typeof _0x2d5703[_0x2631('0x24')]==='undefined'&&typeof _0x2d5703[_0x2631('0x25')]===_0x2631('0x26');var _0x41d2e7=_0x2c7e40[_0x2631('0x27')];var _0x350544=_0x506a03?0x0:_0x2d5703[_0x2631('0x24')];var _0x297590=_0x506a03?_0x2c7e40['count']:_0x2d5703[_0x2631('0x24')]+_0x2d5703[_0x2631('0x25')];var _0x21504b;if(_0x297590>=_0x41d2e7){_0x297590=_0x41d2e7;_0x21504b=0xc8;}else{_0x21504b=0xce;}_0x5a9328[_0x2631('0x22')](_0x21504b);return _0x5a9328['set'](_0x2631('0x28'),_0x350544+'-'+_0x297590+'/'+_0x41d2e7)[_0x2631('0x23')](_0x2c7e40);}return null;};}function saveUpdates(_0x374d70){return function(_0x22c18d){if(_0x22c18d){return _0x22c18d['update'](_0x374d70)[_0x2631('0x16')](function(_0x1c253e){return _0x1c253e;});}return null;};}function removeEntity(_0x1754e9){return function(_0x3bcbdf){if(_0x3bcbdf){return _0x3bcbdf[_0x2631('0x29')]()['then'](function(){_0x1754e9[_0x2631('0x22')](0xcc)[_0x2631('0x2a')]();});}};}function handleEntityNotFound(_0x2b2283){return function(_0x38e774){if(!_0x38e774){_0x2b2283[_0x2631('0x2b')](0x194);}return _0x38e774;};}function handleError(_0x1446d9,_0x3c074d){_0x3c074d=_0x3c074d||0x1f4;return function(_0x3ea5fe){logger['error'](_0x3ea5fe[_0x2631('0x2c')]);if(_0x3ea5fe[_0x2631('0x2d')]){delete _0x3ea5fe[_0x2631('0x2d')];}_0x1446d9[_0x2631('0x22')](_0x3c074d)['send'](_0x3ea5fe);};}exports[_0x2631('0x2e')]=function(_0x2d1b26,_0x3a0693){var _0x26320={},_0x20d0bf={},_0x5e5bf7={'count':0x0,'rows':[]};var _0x50eb5e=_[_0x2631('0x2f')](db[_0x2631('0x30')][_0x2631('0x31')],function(_0x1ea85e){return{'name':_0x1ea85e['fieldName'],'type':_0x1ea85e[_0x2631('0x32')][_0x2631('0x33')]};});_0x20d0bf[_0x2631('0x34')]=_[_0x2631('0x2f')](_0x50eb5e,_0x2631('0x2d'));_0x20d0bf[_0x2631('0x35')]=_[_0x2631('0x36')](_0x2d1b26[_0x2631('0x35')]);_0x20d0bf[_0x2631('0x37')]=_[_0x2631('0x38')](_0x20d0bf[_0x2631('0x34')],_0x20d0bf[_0x2631('0x35')]);_0x26320['attributes']=_[_0x2631('0x38')](_0x20d0bf['model'],qs['fields'](_0x2d1b26['query'][_0x2631('0x39')]));_0x26320[_0x2631('0x3a')]=_0x26320[_0x2631('0x3a')][_0x2631('0x3b')]?_0x26320[_0x2631('0x3a')]:_0x20d0bf[_0x2631('0x34')];if(!_0x2d1b26['query'][_0x2631('0x3c')](_0x2631('0x3d'))){_0x26320[_0x2631('0x25')]=qs[_0x2631('0x25')](_0x2d1b26[_0x2631('0x35')]['limit']);_0x26320['offset']=qs[_0x2631('0x24')](_0x2d1b26[_0x2631('0x35')]['offset']);}_0x26320[_0x2631('0x3e')]=qs[_0x2631('0x3f')](_0x2d1b26[_0x2631('0x35')]['sort']);_0x26320[_0x2631('0x40')]=qs[_0x2631('0x37')](_[_0x2631('0x41')](_0x2d1b26[_0x2631('0x35')],_0x20d0bf[_0x2631('0x37')]),_0x50eb5e);if(_0x2d1b26[_0x2631('0x35')]['filter']){_0x26320[_0x2631('0x40')]=_[_0x2631('0x42')](_0x26320['where'],{'$or':_[_0x2631('0x2f')](_0x50eb5e,function(_0x337fae){if(_0x337fae[_0x2631('0x32')]!=='VIRTUAL'){var _0x57ae41={};_0x57ae41[_0x337fae['name']]={'$like':'%'+_0x2d1b26['query'][_0x2631('0x43')]+'%'};return _0x57ae41;}})});}_0x26320=_[_0x2631('0x42')]({},_0x26320,_0x2d1b26[_0x2631('0x44')]);var _0x559dd0={'where':_0x26320[_0x2631('0x40')]};return db[_0x2631('0x30')][_0x2631('0x27')](_0x559dd0)[_0x2631('0x16')](function(_0x4e40f6){_0x5e5bf7['count']=_0x4e40f6;if(_0x2d1b26['query'][_0x2631('0x45')]){_0x26320[_0x2631('0x46')]=[{'all':!![]}];}return db[_0x2631('0x30')]['findAll'](_0x26320);})['then'](function(_0x4de8e8){_0x5e5bf7[_0x2631('0x47')]=_0x4de8e8;return _0x5e5bf7;})[_0x2631('0x16')](respondWithFilteredResult(_0x3a0693,_0x26320))[_0x2631('0x21')](handleError(_0x3a0693,null));};exports['show']=function(_0x2aedf1,_0x5bca62){var _0x5ce8e6={'raw':!![],'where':{'id':_0x2aedf1[_0x2631('0x48')]['id']}},_0x113754={};_0x113754['model']=_[_0x2631('0x36')](db[_0x2631('0x30')][_0x2631('0x31')]);_0x113754[_0x2631('0x35')]=_[_0x2631('0x36')](_0x2aedf1[_0x2631('0x35')]);_0x113754['filters']=_[_0x2631('0x38')](_0x113754[_0x2631('0x34')],_0x113754[_0x2631('0x35')]);_0x5ce8e6[_0x2631('0x3a')]=_['intersection'](_0x113754['model'],qs['fields'](_0x2aedf1['query']['fields']));_0x5ce8e6[_0x2631('0x3a')]=_0x5ce8e6[_0x2631('0x3a')][_0x2631('0x3b')]?_0x5ce8e6[_0x2631('0x3a')]:_0x113754[_0x2631('0x34')];if(_0x2aedf1[_0x2631('0x35')]['includeAll']){_0x5ce8e6[_0x2631('0x46')]=[{'all':!![]}];}_0x5ce8e6=_['merge']({},_0x5ce8e6,_0x2aedf1[_0x2631('0x44')]);return db[_0x2631('0x30')][_0x2631('0x49')](_0x5ce8e6)[_0x2631('0x16')](handleEntityNotFound(_0x5bca62,null))[_0x2631('0x16')](respondWithResult(_0x5bca62,null))['catch'](handleError(_0x5bca62,null));};exports[_0x2631('0x4a')]=function(_0x29b788,_0x5a89c9){if(_0x29b788[_0x2631('0x4b')]['id']){delete _0x29b788[_0x2631('0x4b')]['id'];}return db[_0x2631('0x30')][_0x2631('0x49')]({'where':{'id':_0x29b788[_0x2631('0x48')]['id']}})[_0x2631('0x16')](handleEntityNotFound(_0x5a89c9,null))['then'](saveUpdates(_0x29b788['body'],null))[_0x2631('0x16')](respondWithResult(_0x5a89c9,null))['catch'](handleError(_0x5a89c9,null));};exports[_0x2631('0x29')]=function(_0x270846,_0x3a5378){return db['MailMessage'][_0x2631('0x49')]({'where':{'id':_0x270846[_0x2631('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a5378,null))[_0x2631('0x16')](removeEntity(_0x3a5378,null))[_0x2631('0x21')](handleError(_0x3a5378,null));};exports[_0x2631('0x4c')]=function(_0x1e52c4,_0x7f8843){return db[_0x2631('0x30')]['describe']()[_0x2631('0x16')](respondWithResult(_0x7f8843,null))[_0x2631('0x21')](handleError(_0x7f8843,null));};exports['create']=function(_0x2f3232,_0x26369){return db[_0x2631('0x30')]['create'](_0x2f3232[_0x2631('0x4b')])[_0x2631('0x16')](function(_0x40c97f){if(_0x40c97f){if(_0x40c97f['direction']==='out'&&!_0x40c97f[_0x2631('0x4d')]){var _0x30fdc7,_0x2c2bbb,_0x38597e;if(_0x2f3232[_0x2631('0x4b')]['to']){_0x2c2bbb=_0x2f3232['body']['to'][_0x2631('0x4e')](',')[0x0];}return db[_0x2631('0x4f')]['findOne']({'where':{'id':_0x40c97f[_0x2631('0x50')]},'include':[{'model':db[_0x2631('0x51')],'as':'List','include':[{'model':db[_0x2631('0x52')],'as':_0x2631('0x53'),'where':{'email':_0x2c2bbb},'limit':0x1,'order':[[_0x2631('0x54'),'DESC']]}]},{'model':db[_0x2631('0x55')],'as':'Smtp','raw':!![]}]})[_0x2631('0x16')](function(_0x26acd5){_0x30fdc7=_0x26acd5;if(_0x30fdc7&&_0x30fdc7['Smtp']){var _0x3823a7={'tls':{'rejectUnauthorized':![]}};if(_[_0x2631('0x56')](_0x30fdc7[_0x2631('0x57')][_0x2631('0x58')])){_0x3823a7[_0x2631('0x59')]=_0x30fdc7[_0x2631('0x57')][_0x2631('0x59')];_0x3823a7['port']=_0x30fdc7[_0x2631('0x57')]['port'];_0x3823a7['secure']=_0x30fdc7[_0x2631('0x57')][_0x2631('0x5a')];if(_0x30fdc7[_0x2631('0x57')]['authentication']){_0x3823a7[_0x2631('0x5b')]={'user':_0x30fdc7['Smtp']['user'],'pass':_0x30fdc7[_0x2631('0x57')][_0x2631('0x5c')]};}}else{_0x3823a7['service']=_0x30fdc7['Smtp'][_0x2631('0x58')];_0x3823a7['auth']={'user':_0x30fdc7[_0x2631('0x57')][_0x2631('0x5d')],'pass':_0x30fdc7['Smtp'][_0x2631('0x5c')]};_0x3823a7[_0x2631('0x5a')]=_0x30fdc7[_0x2631('0x57')]['secure'];}if(_0x2f3232[_0x2631('0x4b')]['attachments']&&_0x2f3232[_0x2631('0x4b')][_0x2631('0x5e')][_0x2631('0x3b')]){for(var _0x3aa346=0x0;_0x3aa346<_0x2f3232['body'][_0x2631('0x5e')][_0x2631('0x3b')];_0x3aa346+=0x1){_0x2f3232[_0x2631('0x4b')][_0x2631('0x5e')][_0x3aa346]={'filename':_0x2f3232[_0x2631('0x4b')]['attachments'][_0x3aa346][_0x2631('0x2d')],'path':path['join'](config[_0x2631('0x5f')],_0x2631('0x60'),_0x2f3232[_0x2631('0x4b')][_0x2631('0x5e')][_0x3aa346][_0x2631('0x61')])};}}_0x38597e={'account':_0x3823a7,'message':_0x2f3232['body']};return;}})[_0x2631('0x16')](function(){if(_0x30fdc7[_0x2631('0x62')]){if(_0x30fdc7[_0x2631('0x62')][_0x2631('0x53')][_0x2631('0x3b')]){return _0x30fdc7[_0x2631('0x62')]['Contacts'][0x0];}else{return db[_0x2631('0x52')]['create'](_[_0x2631('0xc')](_0x2f3232[_0x2631('0x4b')],{'firstName':_0x2f3232[_0x2631('0x4b')]['to'],'email':_0x2f3232[_0x2631('0x4b')]['to'],'phone':_0x2f3232[_0x2631('0x4b')]['to'],'ListId':_0x30fdc7['ListId']}));}}else{throw new Error(_0x2631('0x63'));}})[_0x2631('0x16')](function(){if(_0x38597e){return respondWithRpcPromise(_0x2631('0x64'),'sendMail',_0x38597e,client9003)['then'](function(_0xf345e4){return _0x40c97f[_0x2631('0x4a')]({'read':!![],'messageId':_0xf345e4[_0x2631('0x65')],'sentAt':moment()['format'](_0x2631('0x66'))});})[_0x2631('0x21')](function(_0x2fa34e){logger[_0x2631('0x1c')]('%s',JSON[_0x2631('0x1b')](_0x2fa34e));return _0x40c97f;});}return _0x40c97f;});}return _0x40c97f;}})[_0x2631('0x16')](respondWithResult(_0x26369,0xc9))[_0x2631('0x21')](handleError(_0x26369,null));};exports['accept']=function(_0xfb5e1c,_0x31c370){var _0x3e4e83={'agent':{},'channel':'mail'};if(_0xfb5e1c[_0x2631('0x4b')]['id']){delete _0xfb5e1c[_0x2631('0x4b')]['id'];}_0xfb5e1c['body'][_0x2631('0x67')]=!![];_0xfb5e1c[_0x2631('0x4b')][_0x2631('0x68')]=moment()[_0x2631('0x69')](_0x2631('0x66'));_0xfb5e1c[_0x2631('0x4b')][_0x2631('0x6a')]=_0xfb5e1c[_0x2631('0x4b')][_0x2631('0x6a')]||_0xfb5e1c['user']['id'];_0x3e4e83[_0x2631('0x6b')]['id']=_0xfb5e1c[_0x2631('0x4b')][_0x2631('0x6a')];return db[_0x2631('0x30')]['find']({'where':{'id':_0xfb5e1c[_0x2631('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31c370,null))['then'](saveUpdates(_0xfb5e1c[_0x2631('0x4b')],null))['then'](function(_0x16fd0e){if(_0x16fd0e){_0x3e4e83[_0x2631('0x1e')]=_0x16fd0e[_0x2631('0x6c')]({'plain':!![]});return db[_0x2631('0x6d')][_0x2631('0x49')]({'where':{'id':_0x16fd0e['MailInteractionId']}});}return null;})[_0x2631('0x16')](handleEntityNotFound(_0x31c370,null))[_0x2631('0x16')](function(_0x10eb90){if(_0x10eb90){return _0x10eb90['update']({'UserId':_0xfb5e1c['body'][_0x2631('0x6a')],'read1stAt':_[_0x2631('0x56')](_0x10eb90[_0x2631('0x6e')])?moment()['format'](_0x2631('0x66')):undefined});}return null;})[_0x2631('0x16')](function(_0x33f68a){if(_0x33f68a){_0x3e4e83['interaction']=_0x33f68a[_0x2631('0x6c')]({'plain':!![]});interaction_log[_0x2631('0x1f')](_0x2631('0x6f'),_0xfb5e1c['user']['id'],_0xfb5e1c[_0x2631('0x5d')][_0x2631('0x2d')],_0xfb5e1c[_0x2631('0x5d')][_0x2631('0x70')],_0x3e4e83[_0x2631('0x71')]['id'],_0xfb5e1c[_0x2631('0x4b')]?JSON[_0x2631('0x1b')](_0xfb5e1c[_0x2631('0x4b')]):_0x2631('0x72'));return respondWithRpcPromise('AcceptMessage',_0x2631('0x73'),_0x3e4e83);}return null;})[_0x2631('0x16')](function(_0xb890f1){var _0x24b4d1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb890f1[_0x2631('0x1e')][_0x2631('0x74')];return db[_0x2631('0x75')]['query'](_0x24b4d1,{'type':db[_0x2631('0x76')][_0x2631('0x77')][_0x2631('0x78')],'raw':!![]})[_0x2631('0x16')](function(_0x1f93e0){return _0x1f93e0;});})[_0x2631('0x16')](function(_0xdeb5d1){if(_0xdeb5d1){_0x3e4e83[_0x2631('0x1e')][_0x2631('0x79')]=_0xdeb5d1[0x0];if(!_0xfb5e1c[_0x2631('0x4b')][_0x2631('0x6a')])return;return db['User'][_0x2631('0x49')]({'where':{'id':_0xfb5e1c[_0x2631('0x4b')]['UserId'],'role':_0x2631('0x6b')},'attributes':['id',_0x2631('0x2d'),_0x2631('0x7a'),_0x2631('0x7b'),'internal'],'raw':!![]});}return null;})[_0x2631('0x16')](function(_0x42e17a){if(!_0x42e17a)return null;_0x3e4e83['message']['agent']=_0x42e17a;return _0x3e4e83;})['then'](function(_0x4bda36){if(_0x4bda36){if(_0xfb5e1c[_0x2631('0x4b')]['manual']){_0x3e4e83[_0x2631('0x1e')]['interface']=util['format'](_0x2631('0x7c'),_0xfb5e1c[_0x2631('0x5d')][_0x2631('0x2d')]);_0x3e4e83[_0x2631('0x1e')][_0x2631('0x7d')]=_0x3e4e83[_0x2631('0x7d')];_0x3e4e83[_0x2631('0x1e')]['motionChannel']=_0x3e4e83['channel'];_0x3e4e83['message']['event']='accept';_0x3e4e83['message'][_0x2631('0x4b')]=htmlToText[_0x2631('0x7e')](_0x3e4e83[_0x2631('0x1e')][_0x2631('0x4b')]);return respondWithRpcPromise(_0x2631('0x7f'),_0x2631('0x7f'),{'event':_0x2631('0x80'),'message':_0x3e4e83[_0x2631('0x1e')]},client9002)[_0x2631('0x16')](function(){return _0x3e4e83;});}return _0x3e4e83;}return null;})[_0x2631('0x16')](respondWithResult(_0x31c370,null))[_0x2631('0x21')](handleError(_0x31c370,null));};exports[_0x2631('0x81')]=function(_0x195fd2,_0x42d86c){var _0x1ad356={'agent':{},'channel':_0x2631('0x82')};if(_0x195fd2[_0x2631('0x4b')]['id']){delete _0x195fd2[_0x2631('0x4b')]['id'];}_0x195fd2[_0x2631('0x4b')]['UserId']=_0x195fd2[_0x2631('0x4b')][_0x2631('0x6a')]||_0x195fd2[_0x2631('0x5d')]['id'];_0x1ad356['agent']['id']=_0x195fd2[_0x2631('0x4b')][_0x2631('0x6a')];return db[_0x2631('0x30')][_0x2631('0x49')]({'where':{'id':_0x195fd2[_0x2631('0x48')]['id'],'UserId':null}})[_0x2631('0x16')](handleEntityNotFound(_0x42d86c,null))[_0x2631('0x16')](function(_0x21c76c){if(_0x21c76c){_0x1ad356[_0x2631('0x1e')]=_0x21c76c['get']({'plain':!![]});return db[_0x2631('0x6d')][_0x2631('0x49')]({'where':{'id':_0x21c76c[_0x2631('0x83')]}});}return null;})[_0x2631('0x16')](handleEntityNotFound(_0x42d86c,null))[_0x2631('0x16')](function(_0x346f1f){if(_0x346f1f){_0x1ad356['interaction']=_0x346f1f[_0x2631('0x6c')]({'plain':!![]});interaction_log['info'](_0x2631('0x84'),_0x195fd2[_0x2631('0x5d')]['id'],_0x195fd2['user'][_0x2631('0x2d')],_0x195fd2['user']['role'],_0x1ad356[_0x2631('0x71')]['id'],_0x195fd2[_0x2631('0x4b')]?JSON[_0x2631('0x1b')](_0x195fd2[_0x2631('0x4b')]):_0x2631('0x72'));return respondWithRpcPromise(_0x2631('0x85'),_0x2631('0x86'),_0x1ad356);}return null;})[_0x2631('0x16')](function(_0x7090c8){var _0x21a499='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7090c8[_0x2631('0x1e')][_0x2631('0x74')];return db['sequelize'][_0x2631('0x35')](_0x21a499,{'type':db[_0x2631('0x76')][_0x2631('0x77')]['SELECT'],'raw':!![]})['then'](function(_0x551d2f){return _0x551d2f;});})[_0x2631('0x16')](function(_0x6ecc34){if(_0x6ecc34){_0x1ad356[_0x2631('0x1e')]['contact']=_0x6ecc34[0x0];if(!_0x195fd2[_0x2631('0x4b')][_0x2631('0x6a')])return;return db[_0x2631('0x87')][_0x2631('0x49')]({'where':{'id':_0x195fd2[_0x2631('0x4b')][_0x2631('0x6a')],'role':_0x2631('0x6b')},'attributes':['id',_0x2631('0x2d'),_0x2631('0x7a'),_0x2631('0x7b'),_0x2631('0x88')],'raw':!![]});}return null;})['then'](function(_0x4d6bb6){if(!_0x4d6bb6)return null;_0x1ad356[_0x2631('0x1e')]['agent']=_0x4d6bb6;return _0x1ad356;})[_0x2631('0x16')](function(_0x49be55){if(_0x49be55){_0x49be55[_0x2631('0x1e')][_0x2631('0x89')]=util['format']('SIP/%s',_0x195fd2['user']['name']);_0x49be55[_0x2631('0x1e')][_0x2631('0x7d')]=_0x1ad356['channel'];_0x49be55['message'][_0x2631('0x8a')]=_0x1ad356[_0x2631('0x7d')];_0x49be55[_0x2631('0x1e')][_0x2631('0x8b')]=_0x2631('0x81');_0x49be55[_0x2631('0x1e')]['body']=htmlToText[_0x2631('0x7e')](_0x1ad356[_0x2631('0x1e')]['body']);respondWithRpcPromise(_0x2631('0x7f'),_0x2631('0x7f'),{'event':_0x2631('0x8c'),'message':_0x49be55[_0x2631('0x1e')]},client9002);return _0x1ad356;}return null;})[_0x2631('0x16')](respondWithResult(_0x42d86c,null))[_0x2631('0x21')](handleError(_0x42d86c,null));};exports[_0x2631('0x8d')]=function(_0x2e15d7,_0x78bb83){var _0x444f66=moment()[_0x2631('0x8e')]()[_0x2631('0x8f')]();var _0x51a761=path[_0x2631('0x90')](config[_0x2631('0x5f')],'server',_0x2631('0x91'),_0x2631('0x92'));var _0x7cee68=path[_0x2631('0x90')](config['root'],_0x2631('0x93'),_0x2631('0x91'),_0x2631('0x5e'));var _0x59a7b5=util[_0x2631('0x69')](_0x2631('0x94'),_0x444f66);return db[_0x2631('0x30')][_0x2631('0x49')]({'where':{'id':_0x2e15d7[_0x2631('0x48')]['id']},'attributes':['id','body','from','to','cc',_0x2631('0x95'),_0x2631('0x96'),_0x2631('0x97')],'include':_0x2e15d7[_0x2631('0x35')]['attachments']?[{'model':db['Attachment'],'as':_0x2631('0x98')}]:undefined})[_0x2631('0x16')](handleEntityNotFound(_0x78bb83,null))[_0x2631('0x16')](function(_0x570781){if(_0x570781){var _0x4ec116=_0x570781;var _0x31f696={'from':_0x4ec116[_0x2631('0x99')],'to':_0x4ec116['to'],'subject':_0x4ec116[_0x2631('0x96')],'html':_0x4ec116['body'],'headers':{'Date':moment(_0x4ec116['createdAt'])['format'](_0x2631('0x9a'))},'attachments':[]};if(_0x570781['cc']){_0x31f696[_0x2631('0x9b')]['Cc']=_0x570781['cc'];}if(_0x570781['bcc']){_0x31f696[_0x2631('0x9b')][_0x2631('0x9c')]=_0x570781[_0x2631('0x95')];}return new BPromise(function(_0x2ffe4f,_0x5ccaf2){if(_0x570781[_0x2631('0x98')]){for(var _0x1a8772=0x0;_0x1a8772<_0x570781['Attachments'][_0x2631('0x3b')];_0x1a8772++){var _0x43ad01=_0x570781['Attachments'][_0x1a8772];var _0x461de2=path['join'](_0x7cee68,_0x43ad01['basename']);if(fs[_0x2631('0x9d')](_0x461de2)){_0x31f696['attachments'][_0x2631('0x9e')]({'name':_0x43ad01[_0x2631('0x2d')],'contentType':_0x43ad01[_0x2631('0x32')],'data':fs[_0x2631('0x9f')](_0x461de2)});}}}emlformat[_0x2631('0xa0')](_0x31f696,function(_0x369654,_0x5693dd){if(_0x369654)return _0x5ccaf2(_0x369654);fs[_0x2631('0xa1')](path['join'](_0x51a761,_0x59a7b5),_0x5693dd);return _0x2ffe4f(_0x5693dd);});});}})[_0x2631('0x16')](function(_0x2811b9){if(_0x2811b9){return _0x78bb83[_0x2631('0x8d')](path[_0x2631('0x90')](_0x51a761,_0x59a7b5),_0x59a7b5,function(_0x430a9f){if(!_0x430a9f)fs['unlinkSync'](path['join'](_0x51a761,_0x59a7b5));});}})[_0x2631('0x21')](handleError(_0x78bb83,null));}; \ No newline at end of file +var _0xdbf8=['pass','service','attachments','join','root','server/files/attachments','ListId','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','agent','MailInteraction','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','RejectMessage','rejectMessage','QueryTypes','contact','User','SIP/%s','download','unix','toString','server','files','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','push','readFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','offset','undefined','count','limit','update','destroy','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','length','body','find','describe','create','direction','out','secret','split','MailAccountId','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','host','port','secure','auth','user'];(function(_0x3d0a72,_0xd5dcd1){var _0xdf079c=function(_0x327842){while(--_0x327842){_0x3d0a72['push'](_0x3d0a72['shift']());}};_0xdf079c(++_0xd5dcd1);}(_0xdbf8,0x179));var _0x8dbf=function(_0x540ae1,_0x2659ab){_0x540ae1=_0x540ae1-0x0;var _0x116c60=_0xdbf8[_0x540ae1];return _0x116c60;};'use strict';var emlformat=require(_0x8dbf('0x0'));var moment=require(_0x8dbf('0x1'));var BPromise=require(_0x8dbf('0x2'));var util=require('util');var path=require(_0x8dbf('0x3'));var fs=require('fs');var _=require(_0x8dbf('0x4'));var Redis=require(_0x8dbf('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x8dbf('0x6'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x8dbf('0x7'))(_0x8dbf('0x8'));var config=require(_0x8dbf('0x9'));var db=require(_0x8dbf('0xa'))['db'];config[_0x8dbf('0xb')]=_[_0x8dbf('0xc')](config[_0x8dbf('0xb')],{'host':_0x8dbf('0xd'),'port':0x18eb});var socket=require(_0x8dbf('0xe'))(new Redis(config[_0x8dbf('0xb')]));require(_0x8dbf('0xf'))[_0x8dbf('0x10')](socket);var jayson=require(_0x8dbf('0x11'));var client=jayson[_0x8dbf('0x12')][_0x8dbf('0x13')]({'port':0x232c});var client9003=jayson[_0x8dbf('0x12')][_0x8dbf('0x13')]({'port':0x232b});var client9002=jayson[_0x8dbf('0x12')][_0x8dbf('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x57b178,_0x5aa895,_0x198cec,_0x31eaad){return new BPromise(function(_0x19893f,_0x9a2c64){var _0x9dbc0=_0x31eaad||client;return _0x9dbc0[_0x8dbf('0x14')](_0x57b178,_0x198cec)[_0x8dbf('0x15')](function(_0x1a858e){logger[_0x8dbf('0x16')](_0x8dbf('0x17'),_0x5aa895,_0x8dbf('0x18'));logger[_0x8dbf('0x19')](_0x8dbf('0x1a'),_0x5aa895,'request\x20sent',JSON[_0x8dbf('0x1b')](_0x1a858e));if(_0x1a858e[_0x8dbf('0x1c')]){if(_0x1a858e[_0x8dbf('0x1c')]['code']===0x1f4){logger[_0x8dbf('0x1c')](_0x8dbf('0x17'),_0x5aa895,_0x1a858e[_0x8dbf('0x1c')][_0x8dbf('0x1d')]);return _0x9a2c64(_0x1a858e[_0x8dbf('0x1c')][_0x8dbf('0x1d')]);}logger[_0x8dbf('0x1c')](_0x8dbf('0x17'),_0x5aa895,_0x1a858e[_0x8dbf('0x1c')][_0x8dbf('0x1d')]);return _0x19893f(_0x1a858e[_0x8dbf('0x1c')]['message']);}else{logger[_0x8dbf('0x16')]('MailMessage,\x20%s,\x20%s',_0x5aa895,'request\x20sent');_0x19893f(_0x1a858e['result'][_0x8dbf('0x1d')]);}})[_0x8dbf('0x1e')](function(_0x459c0a){logger['error']('MailMessage,\x20%s,\x20%s',_0x5aa895,_0x459c0a);_0x9a2c64(_0x459c0a);});});}function respondWithResult(_0x3315be,_0x52820d){_0x52820d=_0x52820d||0xc8;return function(_0x54d052){if(_0x54d052){return _0x3315be[_0x8dbf('0x1f')](_0x52820d)[_0x8dbf('0x20')](_0x54d052);}};}function respondWithFilteredResult(_0x4184cf,_0x2436ed){return function(_0x49f750){if(_0x49f750){var _0x2b6d42=typeof _0x2436ed[_0x8dbf('0x21')]===_0x8dbf('0x22')&&typeof _0x2436ed['limit']==='undefined';var _0x3c46e8=_0x49f750[_0x8dbf('0x23')];var _0x26df74=_0x2b6d42?0x0:_0x2436ed[_0x8dbf('0x21')];var _0x249d98=_0x2b6d42?_0x49f750[_0x8dbf('0x23')]:_0x2436ed[_0x8dbf('0x21')]+_0x2436ed[_0x8dbf('0x24')];var _0x470079;if(_0x249d98>=_0x3c46e8){_0x249d98=_0x3c46e8;_0x470079=0xc8;}else{_0x470079=0xce;}_0x4184cf[_0x8dbf('0x1f')](_0x470079);return _0x4184cf['set']('Content-Range',_0x26df74+'-'+_0x249d98+'/'+_0x3c46e8)['json'](_0x49f750);}return null;};}function saveUpdates(_0x550b07){return function(_0xcd46b4){if(_0xcd46b4){return _0xcd46b4[_0x8dbf('0x25')](_0x550b07)['then'](function(_0x18bc5e){return _0x18bc5e;});}return null;};}function removeEntity(_0x155b08){return function(_0x3d6976){if(_0x3d6976){return _0x3d6976[_0x8dbf('0x26')]()['then'](function(){_0x155b08[_0x8dbf('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd689f6){return function(_0x5c7849){if(!_0x5c7849){_0xd689f6['sendStatus'](0x194);}return _0x5c7849;};}function handleError(_0x149707,_0x1f2f57){_0x1f2f57=_0x1f2f57||0x1f4;return function(_0x3e8ab0){logger['error'](_0x3e8ab0[_0x8dbf('0x27')]);if(_0x3e8ab0[_0x8dbf('0x28')]){delete _0x3e8ab0[_0x8dbf('0x28')];}_0x149707[_0x8dbf('0x1f')](_0x1f2f57)[_0x8dbf('0x29')](_0x3e8ab0);};}exports[_0x8dbf('0x2a')]=function(_0x20a3de,_0x45cf35){var _0x1ed980={},_0x5f2051={},_0xe5fad7={'count':0x0,'rows':[]};var _0x16667d=_[_0x8dbf('0x2b')](db[_0x8dbf('0x2c')][_0x8dbf('0x2d')],function(_0x3a18f4){return{'name':_0x3a18f4[_0x8dbf('0x2e')],'type':_0x3a18f4[_0x8dbf('0x2f')][_0x8dbf('0x30')]};});_0x5f2051[_0x8dbf('0x31')]=_[_0x8dbf('0x2b')](_0x16667d,_0x8dbf('0x28'));_0x5f2051[_0x8dbf('0x32')]=_[_0x8dbf('0x33')](_0x20a3de['query']);_0x5f2051[_0x8dbf('0x34')]=_[_0x8dbf('0x35')](_0x5f2051[_0x8dbf('0x31')],_0x5f2051[_0x8dbf('0x32')]);_0x1ed980[_0x8dbf('0x36')]=_[_0x8dbf('0x35')](_0x5f2051[_0x8dbf('0x31')],qs['fields'](_0x20a3de[_0x8dbf('0x32')][_0x8dbf('0x37')]));_0x1ed980[_0x8dbf('0x36')]=_0x1ed980[_0x8dbf('0x36')]['length']?_0x1ed980['attributes']:_0x5f2051[_0x8dbf('0x31')];if(!_0x20a3de[_0x8dbf('0x32')][_0x8dbf('0x38')]('nolimit')){_0x1ed980[_0x8dbf('0x24')]=qs[_0x8dbf('0x24')](_0x20a3de['query']['limit']);_0x1ed980[_0x8dbf('0x21')]=qs[_0x8dbf('0x21')](_0x20a3de['query'][_0x8dbf('0x21')]);}_0x1ed980[_0x8dbf('0x39')]=qs[_0x8dbf('0x3a')](_0x20a3de[_0x8dbf('0x32')][_0x8dbf('0x3a')]);_0x1ed980[_0x8dbf('0x3b')]=qs[_0x8dbf('0x34')](_[_0x8dbf('0x3c')](_0x20a3de[_0x8dbf('0x32')],_0x5f2051[_0x8dbf('0x34')]),_0x16667d);if(_0x20a3de[_0x8dbf('0x32')][_0x8dbf('0x3d')]){_0x1ed980['where']=_['merge'](_0x1ed980[_0x8dbf('0x3b')],{'$or':_['map'](_0x16667d,function(_0x3e6f3e){if(_0x3e6f3e[_0x8dbf('0x2f')]!==_0x8dbf('0x3e')){var _0x5b66e0={};_0x5b66e0[_0x3e6f3e[_0x8dbf('0x28')]]={'$like':'%'+_0x20a3de['query'][_0x8dbf('0x3d')]+'%'};return _0x5b66e0;}})});}_0x1ed980=_[_0x8dbf('0x3f')]({},_0x1ed980,_0x20a3de[_0x8dbf('0x40')]);var _0x42d4ca={'where':_0x1ed980['where']};return db['MailMessage'][_0x8dbf('0x23')](_0x42d4ca)['then'](function(_0x258688){_0xe5fad7[_0x8dbf('0x23')]=_0x258688;if(_0x20a3de[_0x8dbf('0x32')]['includeAll']){_0x1ed980[_0x8dbf('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0x8dbf('0x42')](_0x1ed980);})[_0x8dbf('0x15')](function(_0x3bbe6b){_0xe5fad7[_0x8dbf('0x43')]=_0x3bbe6b;return _0xe5fad7;})[_0x8dbf('0x15')](respondWithFilteredResult(_0x45cf35,_0x1ed980))[_0x8dbf('0x1e')](handleError(_0x45cf35,null));};exports[_0x8dbf('0x44')]=function(_0x1f1418,_0x33cd30){var _0x335b5d={'raw':!![],'where':{'id':_0x1f1418[_0x8dbf('0x45')]['id']}},_0x736d6e={};_0x736d6e[_0x8dbf('0x31')]=_['keys'](db[_0x8dbf('0x2c')][_0x8dbf('0x2d')]);_0x736d6e[_0x8dbf('0x32')]=_['keys'](_0x1f1418[_0x8dbf('0x32')]);_0x736d6e[_0x8dbf('0x34')]=_[_0x8dbf('0x35')](_0x736d6e[_0x8dbf('0x31')],_0x736d6e[_0x8dbf('0x32')]);_0x335b5d[_0x8dbf('0x36')]=_[_0x8dbf('0x35')](_0x736d6e[_0x8dbf('0x31')],qs[_0x8dbf('0x37')](_0x1f1418[_0x8dbf('0x32')][_0x8dbf('0x37')]));_0x335b5d[_0x8dbf('0x36')]=_0x335b5d['attributes'][_0x8dbf('0x46')]?_0x335b5d[_0x8dbf('0x36')]:_0x736d6e[_0x8dbf('0x31')];if(_0x1f1418['query']['includeAll']){_0x335b5d[_0x8dbf('0x41')]=[{'all':!![]}];}_0x335b5d=_[_0x8dbf('0x3f')]({},_0x335b5d,_0x1f1418[_0x8dbf('0x40')]);return db[_0x8dbf('0x2c')]['find'](_0x335b5d)[_0x8dbf('0x15')](handleEntityNotFound(_0x33cd30,null))[_0x8dbf('0x15')](respondWithResult(_0x33cd30,null))[_0x8dbf('0x1e')](handleError(_0x33cd30,null));};exports['update']=function(_0x10d220,_0x495e07){if(_0x10d220[_0x8dbf('0x47')]['id']){delete _0x10d220[_0x8dbf('0x47')]['id'];}return db[_0x8dbf('0x2c')][_0x8dbf('0x48')]({'where':{'id':_0x10d220[_0x8dbf('0x45')]['id']}})[_0x8dbf('0x15')](handleEntityNotFound(_0x495e07,null))[_0x8dbf('0x15')](saveUpdates(_0x10d220[_0x8dbf('0x47')],null))[_0x8dbf('0x15')](respondWithResult(_0x495e07,null))[_0x8dbf('0x1e')](handleError(_0x495e07,null));};exports[_0x8dbf('0x26')]=function(_0xfdecaf,_0x2ed0e3){return db[_0x8dbf('0x2c')][_0x8dbf('0x48')]({'where':{'id':_0xfdecaf[_0x8dbf('0x45')]['id']}})[_0x8dbf('0x15')](handleEntityNotFound(_0x2ed0e3,null))[_0x8dbf('0x15')](removeEntity(_0x2ed0e3,null))[_0x8dbf('0x1e')](handleError(_0x2ed0e3,null));};exports[_0x8dbf('0x49')]=function(_0x457bc1,_0x2330b3){return db[_0x8dbf('0x2c')][_0x8dbf('0x49')]()['then'](respondWithResult(_0x2330b3,null))['catch'](handleError(_0x2330b3,null));};exports[_0x8dbf('0x4a')]=function(_0x5b9075,_0x4ca940){return db[_0x8dbf('0x2c')]['create'](_0x5b9075[_0x8dbf('0x47')])[_0x8dbf('0x15')](function(_0x5df134){if(_0x5df134){if(_0x5df134[_0x8dbf('0x4b')]===_0x8dbf('0x4c')&&!_0x5df134[_0x8dbf('0x4d')]){var _0x42af3a,_0x1a2b21,_0x5cc758;if(_0x5b9075['body']['to']){_0x1a2b21=_0x5b9075[_0x8dbf('0x47')]['to'][_0x8dbf('0x4e')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x5df134[_0x8dbf('0x4f')]},'include':[{'model':db['CmList'],'as':_0x8dbf('0x50'),'include':[{'model':db[_0x8dbf('0x51')],'as':_0x8dbf('0x52'),'where':{'email':_0x1a2b21},'limit':0x1,'order':[[_0x8dbf('0x53'),'DESC']]}]},{'model':db[_0x8dbf('0x54')],'as':'Smtp','raw':!![]}]})[_0x8dbf('0x15')](function(_0x89e28e){_0x42af3a=_0x89e28e;if(_0x42af3a&&_0x42af3a[_0x8dbf('0x55')]){var _0x1a9ffd={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x42af3a[_0x8dbf('0x55')]['service'])){_0x1a9ffd[_0x8dbf('0x56')]=_0x42af3a[_0x8dbf('0x55')][_0x8dbf('0x56')];_0x1a9ffd[_0x8dbf('0x57')]=_0x42af3a[_0x8dbf('0x55')][_0x8dbf('0x57')];_0x1a9ffd[_0x8dbf('0x58')]=_0x42af3a[_0x8dbf('0x55')][_0x8dbf('0x58')];if(_0x42af3a[_0x8dbf('0x55')]['authentication']){_0x1a9ffd[_0x8dbf('0x59')]={'user':_0x42af3a['Smtp'][_0x8dbf('0x5a')],'pass':_0x42af3a['Smtp'][_0x8dbf('0x5b')]};}}else{_0x1a9ffd['service']=_0x42af3a[_0x8dbf('0x55')][_0x8dbf('0x5c')];_0x1a9ffd[_0x8dbf('0x59')]={'user':_0x42af3a[_0x8dbf('0x55')]['user'],'pass':_0x42af3a[_0x8dbf('0x55')][_0x8dbf('0x5b')]};_0x1a9ffd[_0x8dbf('0x58')]=_0x42af3a[_0x8dbf('0x55')][_0x8dbf('0x58')];}if(_0x5b9075[_0x8dbf('0x47')][_0x8dbf('0x5d')]&&_0x5b9075[_0x8dbf('0x47')][_0x8dbf('0x5d')][_0x8dbf('0x46')]){for(var _0x36a9d1=0x0;_0x36a9d1<_0x5b9075[_0x8dbf('0x47')][_0x8dbf('0x5d')][_0x8dbf('0x46')];_0x36a9d1+=0x1){_0x5b9075[_0x8dbf('0x47')][_0x8dbf('0x5d')][_0x36a9d1]={'filename':_0x5b9075[_0x8dbf('0x47')][_0x8dbf('0x5d')][_0x36a9d1]['name'],'path':path[_0x8dbf('0x5e')](config[_0x8dbf('0x5f')],_0x8dbf('0x60'),_0x5b9075[_0x8dbf('0x47')]['attachments'][_0x36a9d1]['basename'])};}}_0x5cc758={'account':_0x1a9ffd,'message':_0x5b9075[_0x8dbf('0x47')]};return;}})[_0x8dbf('0x15')](function(){if(_0x42af3a['List']){if(_0x42af3a[_0x8dbf('0x50')][_0x8dbf('0x52')][_0x8dbf('0x46')]){return _0x42af3a['List']['Contacts'][0x0];}else{return db[_0x8dbf('0x51')][_0x8dbf('0x4a')](_[_0x8dbf('0xc')](_0x5b9075[_0x8dbf('0x47')],{'firstName':_0x5b9075['body']['to'],'email':_0x5b9075['body']['to'],'phone':_0x5b9075[_0x8dbf('0x47')]['to'],'ListId':_0x42af3a[_0x8dbf('0x61')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x8dbf('0x15')](function(){if(_0x5cc758){return respondWithRpcPromise('SendMail',_0x8dbf('0x62'),_0x5cc758,client9003)['then'](function(_0xb413fd){return _0x5df134[_0x8dbf('0x25')]({'read':!![],'messageId':_0xb413fd[_0x8dbf('0x63')],'sentAt':moment()['format'](_0x8dbf('0x64'))});})['catch'](function(_0x95337d){logger['error']('%s',JSON[_0x8dbf('0x1b')](_0x95337d));return _0x5df134;});}return _0x5df134;});}return _0x5df134;}})[_0x8dbf('0x15')](respondWithResult(_0x4ca940,0xc9))['catch'](handleError(_0x4ca940,null));};exports[_0x8dbf('0x65')]=function(_0x8ac046,_0x2b0b5f){var _0x16667f={'agent':{},'channel':_0x8dbf('0x66')};if(_0x8ac046[_0x8dbf('0x47')]['id']){delete _0x8ac046[_0x8dbf('0x47')]['id'];}_0x8ac046['body'][_0x8dbf('0x67')]=!![];_0x8ac046[_0x8dbf('0x47')][_0x8dbf('0x68')]=moment()[_0x8dbf('0x69')](_0x8dbf('0x64'));_0x8ac046['body']['UserId']=_0x8ac046['body'][_0x8dbf('0x6a')]||_0x8ac046[_0x8dbf('0x5a')]['id'];_0x16667f[_0x8dbf('0x6b')]['id']=_0x8ac046[_0x8dbf('0x47')][_0x8dbf('0x6a')];return db[_0x8dbf('0x2c')][_0x8dbf('0x48')]({'where':{'id':_0x8ac046[_0x8dbf('0x45')]['id'],'UserId':null}})[_0x8dbf('0x15')](handleEntityNotFound(_0x2b0b5f,null))['then'](saveUpdates(_0x8ac046[_0x8dbf('0x47')],null))[_0x8dbf('0x15')](function(_0x1e5dc3){if(_0x1e5dc3){_0x16667f[_0x8dbf('0x1d')]=_0x1e5dc3['get']({'plain':!![]});return db[_0x8dbf('0x6c')]['find']({'where':{'id':_0x1e5dc3['MailInteractionId']}});}return null;})[_0x8dbf('0x15')](handleEntityNotFound(_0x2b0b5f,null))[_0x8dbf('0x15')](function(_0x45cfc4){if(_0x45cfc4){return _0x45cfc4[_0x8dbf('0x25')]({'UserId':_0x8ac046['body'][_0x8dbf('0x6a')],'read1stAt':_[_0x8dbf('0x6d')](_0x45cfc4[_0x8dbf('0x6e')])?moment()['format'](_0x8dbf('0x64')):undefined});}return null;})[_0x8dbf('0x15')](function(_0x2d325e){if(_0x2d325e){_0x16667f[_0x8dbf('0x6f')]=_0x2d325e[_0x8dbf('0x70')]({'plain':!![]});interaction_log[_0x8dbf('0x16')](_0x8dbf('0x71'),_0x8ac046[_0x8dbf('0x5a')]['id'],_0x8ac046['user'][_0x8dbf('0x28')],_0x8ac046[_0x8dbf('0x5a')][_0x8dbf('0x72')],_0x16667f[_0x8dbf('0x6f')]['id'],_0x8ac046['body']?JSON['stringify'](_0x8ac046['body']):_0x8dbf('0x73'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x16667f);}return null;})['then'](function(_0x4767f4){var _0x221f7f=_0x8dbf('0x74')+_0x4767f4['message'][_0x8dbf('0x75')];return db[_0x8dbf('0x76')][_0x8dbf('0x32')](_0x221f7f,{'type':db[_0x8dbf('0x77')]['QueryTypes']['SELECT'],'raw':!![]})[_0x8dbf('0x15')](function(_0x41ee44){return _0x41ee44;});})[_0x8dbf('0x15')](function(_0x1bd2b8){if(_0x1bd2b8){_0x16667f['message']['contact']=_0x1bd2b8[0x0];if(!_0x8ac046['body'][_0x8dbf('0x6a')])return;return db['User'][_0x8dbf('0x48')]({'where':{'id':_0x8ac046[_0x8dbf('0x47')][_0x8dbf('0x6a')],'role':_0x8dbf('0x6b')},'attributes':['id',_0x8dbf('0x28'),_0x8dbf('0x78'),_0x8dbf('0x79'),_0x8dbf('0x7a')],'raw':!![]});}return null;})[_0x8dbf('0x15')](function(_0x2247ed){if(!_0x2247ed)return null;_0x16667f[_0x8dbf('0x1d')][_0x8dbf('0x6b')]=_0x2247ed;return _0x16667f;})[_0x8dbf('0x15')](function(_0x1a272e){if(_0x1a272e){if(_0x8ac046[_0x8dbf('0x47')][_0x8dbf('0x7b')]){_0x16667f[_0x8dbf('0x1d')][_0x8dbf('0x7c')]=util[_0x8dbf('0x69')]('SIP/%s',_0x8ac046['user'][_0x8dbf('0x28')]);_0x16667f['message'][_0x8dbf('0x7d')]=_0x16667f[_0x8dbf('0x7d')];_0x16667f[_0x8dbf('0x1d')][_0x8dbf('0x7e')]=_0x16667f[_0x8dbf('0x7d')];_0x16667f[_0x8dbf('0x1d')][_0x8dbf('0x7f')]=_0x8dbf('0x65');_0x16667f[_0x8dbf('0x1d')]['body']=htmlToText[_0x8dbf('0x80')](_0x16667f[_0x8dbf('0x1d')]['body']);return respondWithRpcPromise(_0x8dbf('0x81'),_0x8dbf('0x81'),{'event':_0x8dbf('0x82'),'message':_0x16667f[_0x8dbf('0x1d')]},client9002)[_0x8dbf('0x15')](function(){return _0x16667f;});}return _0x16667f;}return null;})[_0x8dbf('0x15')](respondWithResult(_0x2b0b5f,null))[_0x8dbf('0x1e')](handleError(_0x2b0b5f,null));};exports[_0x8dbf('0x83')]=function(_0x31f434,_0x3e74e1){var _0x49b1b0={'agent':{},'channel':_0x8dbf('0x66')};if(_0x31f434[_0x8dbf('0x47')]['id']){delete _0x31f434[_0x8dbf('0x47')]['id'];}_0x31f434[_0x8dbf('0x47')][_0x8dbf('0x6a')]=_0x31f434[_0x8dbf('0x47')][_0x8dbf('0x6a')]||_0x31f434[_0x8dbf('0x5a')]['id'];_0x49b1b0['agent']['id']=_0x31f434[_0x8dbf('0x47')][_0x8dbf('0x6a')];return db[_0x8dbf('0x2c')]['find']({'where':{'id':_0x31f434[_0x8dbf('0x45')]['id'],'UserId':null}})[_0x8dbf('0x15')](handleEntityNotFound(_0x3e74e1,null))['then'](function(_0x381888){if(_0x381888){_0x49b1b0[_0x8dbf('0x1d')]=_0x381888[_0x8dbf('0x70')]({'plain':!![]});return db[_0x8dbf('0x6c')][_0x8dbf('0x48')]({'where':{'id':_0x381888[_0x8dbf('0x84')]}});}return null;})[_0x8dbf('0x15')](handleEntityNotFound(_0x3e74e1,null))['then'](function(_0x4fdbb8){if(_0x4fdbb8){_0x49b1b0[_0x8dbf('0x6f')]=_0x4fdbb8[_0x8dbf('0x70')]({'plain':!![]});interaction_log[_0x8dbf('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x31f434['user']['id'],_0x31f434[_0x8dbf('0x5a')][_0x8dbf('0x28')],_0x31f434[_0x8dbf('0x5a')][_0x8dbf('0x72')],_0x49b1b0[_0x8dbf('0x6f')]['id'],_0x31f434[_0x8dbf('0x47')]?JSON['stringify'](_0x31f434[_0x8dbf('0x47')]):'null');return respondWithRpcPromise(_0x8dbf('0x85'),_0x8dbf('0x86'),_0x49b1b0);}return null;})[_0x8dbf('0x15')](function(_0x2eda6a){var _0x30ed8d=_0x8dbf('0x74')+_0x2eda6a[_0x8dbf('0x1d')][_0x8dbf('0x75')];return db[_0x8dbf('0x76')]['query'](_0x30ed8d,{'type':db[_0x8dbf('0x77')][_0x8dbf('0x87')]['SELECT'],'raw':!![]})[_0x8dbf('0x15')](function(_0x655801){return _0x655801;});})[_0x8dbf('0x15')](function(_0x9b3b9b){if(_0x9b3b9b){_0x49b1b0[_0x8dbf('0x1d')][_0x8dbf('0x88')]=_0x9b3b9b[0x0];if(!_0x31f434[_0x8dbf('0x47')]['UserId'])return;return db[_0x8dbf('0x89')][_0x8dbf('0x48')]({'where':{'id':_0x31f434[_0x8dbf('0x47')][_0x8dbf('0x6a')],'role':'agent'},'attributes':['id',_0x8dbf('0x28'),_0x8dbf('0x78'),'email',_0x8dbf('0x7a')],'raw':!![]});}return null;})['then'](function(_0x35766a){if(!_0x35766a)return null;_0x49b1b0[_0x8dbf('0x1d')][_0x8dbf('0x6b')]=_0x35766a;return _0x49b1b0;})['then'](function(_0x484142){if(_0x484142){_0x484142['message'][_0x8dbf('0x7c')]=util['format'](_0x8dbf('0x8a'),_0x31f434['user'][_0x8dbf('0x28')]);_0x484142[_0x8dbf('0x1d')][_0x8dbf('0x7d')]=_0x49b1b0['channel'];_0x484142['message'][_0x8dbf('0x7e')]=_0x49b1b0[_0x8dbf('0x7d')];_0x484142['message'][_0x8dbf('0x7f')]=_0x8dbf('0x83');_0x484142[_0x8dbf('0x1d')][_0x8dbf('0x47')]=htmlToText[_0x8dbf('0x80')](_0x49b1b0[_0x8dbf('0x1d')][_0x8dbf('0x47')]);respondWithRpcPromise(_0x8dbf('0x81'),_0x8dbf('0x81'),{'event':'rejectmessage','message':_0x484142['message']},client9002);return _0x49b1b0;}return null;})[_0x8dbf('0x15')](respondWithResult(_0x3e74e1,null))['catch'](handleError(_0x3e74e1,null));};exports[_0x8dbf('0x8b')]=function(_0x672386,_0x10695d){var _0x2b745=moment()[_0x8dbf('0x8c')]()[_0x8dbf('0x8d')]();var _0x5081c3=path[_0x8dbf('0x5e')](config[_0x8dbf('0x5f')],_0x8dbf('0x8e'),_0x8dbf('0x8f'),'tmp');var _0x3f34bf=path['join'](config[_0x8dbf('0x5f')],_0x8dbf('0x8e'),_0x8dbf('0x8f'),_0x8dbf('0x5d'));var _0x3f8e1e=util['format']('message-%s.eml',_0x2b745);return db[_0x8dbf('0x2c')][_0x8dbf('0x48')]({'where':{'id':_0x672386[_0x8dbf('0x45')]['id']},'attributes':['id','body','from','to','cc',_0x8dbf('0x90'),_0x8dbf('0x91'),_0x8dbf('0x92')],'include':_0x672386['query'][_0x8dbf('0x5d')]?[{'model':db[_0x8dbf('0x93')],'as':_0x8dbf('0x94')}]:undefined})['then'](handleEntityNotFound(_0x10695d,null))['then'](function(_0x215c8b){if(_0x215c8b){var _0x4d7170=_0x215c8b;var _0x48a5b4={'from':_0x4d7170['from'],'to':_0x4d7170['to'],'subject':_0x4d7170[_0x8dbf('0x91')],'html':_0x4d7170[_0x8dbf('0x47')],'headers':{'Date':moment(_0x4d7170[_0x8dbf('0x92')])['format'](_0x8dbf('0x95'))},'attachments':[]};if(_0x215c8b['cc']){_0x48a5b4[_0x8dbf('0x96')]['Cc']=_0x215c8b['cc'];}if(_0x215c8b[_0x8dbf('0x90')]){_0x48a5b4[_0x8dbf('0x96')]['Bcc']=_0x215c8b['bcc'];}return new BPromise(function(_0xb7a7a7,_0x1009dd){if(_0x215c8b['Attachments']){for(var _0x5f2625=0x0;_0x5f2625<_0x215c8b[_0x8dbf('0x94')][_0x8dbf('0x46')];_0x5f2625++){var _0x3bc0eb=_0x215c8b[_0x8dbf('0x94')][_0x5f2625];var _0x2e7d14=path[_0x8dbf('0x5e')](_0x3f34bf,_0x3bc0eb[_0x8dbf('0x97')]);if(fs[_0x8dbf('0x98')](_0x2e7d14)){_0x48a5b4[_0x8dbf('0x5d')][_0x8dbf('0x99')]({'name':_0x3bc0eb['name'],'contentType':_0x3bc0eb[_0x8dbf('0x2f')],'data':fs[_0x8dbf('0x9a')](_0x2e7d14)});}}}emlformat['build'](_0x48a5b4,function(_0x209a23,_0xefbf33){if(_0x209a23)return _0x1009dd(_0x209a23);fs['writeFileSync'](path[_0x8dbf('0x5e')](_0x5081c3,_0x3f8e1e),_0xefbf33);return _0xb7a7a7(_0xefbf33);});});}})[_0x8dbf('0x15')](function(_0x42eac6){if(_0x42eac6){return _0x10695d['download'](path[_0x8dbf('0x5e')](_0x5081c3,_0x3f8e1e),_0x3f8e1e,function(_0x5784d6){if(!_0x5784d6)fs[_0x8dbf('0x9b')](path[_0x8dbf('0x5e')](_0x5081c3,_0x3f8e1e));});}})[_0x8dbf('0x1e')](handleError(_0x10695d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5f31321..d3c4f28 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 _0xacee=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x27eaac,_0x36e8ac){var _0x9f8f5b=function(_0xbcddb3){while(--_0xbcddb3){_0x27eaac['push'](_0x27eaac['shift']());}};_0x9f8f5b(++_0x36e8ac);}(_0xacee,0x90));var _0xeace=function(_0x3c1d91,_0x5da635){_0x3c1d91=_0x3c1d91-0x0;var _0x129f6c=_0xacee[_0x3c1d91];return _0x129f6c;};'use strict';var EventEmitter=require(_0xeace('0x0'));var MailMessage=require(_0xeace('0x1'))['db'][_0xeace('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xeace('0x3')](0x0);var events={'afterCreate':_0xeace('0x4'),'afterUpdate':_0xeace('0x5'),'afterDestroy':_0xeace('0x6')};function emitEvent(_0x31184a){return function(_0x2c3de7,_0x45093b,_0x467727){MailMessageEvents[_0xeace('0x7')](_0x31184a+':'+_0x2c3de7['id'],_0x2c3de7);MailMessageEvents[_0xeace('0x7')](_0x31184a,_0x2c3de7);_0x467727(null);};}for(var e in events){if(events[_0xeace('0x8')](e)){var event=events[e];MailMessage[_0xeace('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x3e1d=['exports','events','../../mysqldb','MailMessage','save','update','remove','emit','hook'];(function(_0x3cd96f,_0x3e81f3){var _0xb89761=function(_0x2c644f){while(--_0x2c644f){_0x3cd96f['push'](_0x3cd96f['shift']());}};_0xb89761(++_0x3e81f3);}(_0x3e1d,0x6d));var _0xd3e1=function(_0x39aae5,_0xfd2f27){_0x39aae5=_0x39aae5-0x0;var _0x266f9f=_0x3e1d[_0x39aae5];return _0x266f9f;};'use strict';var EventEmitter=require(_0xd3e1('0x0'));var MailMessage=require(_0xd3e1('0x1'))['db'][_0xd3e1('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd3e1('0x3'),'afterUpdate':_0xd3e1('0x4'),'afterDestroy':_0xd3e1('0x5')};function emitEvent(_0x3920c0){return function(_0x447fdc,_0x5e4fd2,_0x479e41){MailMessageEvents['emit'](_0x3920c0+':'+_0x447fdc['id'],_0x447fdc);MailMessageEvents[_0xd3e1('0x6')](_0x3920c0,_0x447fdc);_0x479e41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xd3e1('0x7')](e,emitEvent(event));}}module[_0xd3e1('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 21288fe..3721c6f 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 _0xfb60=['body','fromString','models','direction','toLowerCase','out','UserId','MailInteraction','MailInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','html-to-text','path','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT'];(function(_0x266f3d,_0x10cd9b){var _0x3d082e=function(_0x10ea27){while(--_0x10ea27){_0x266f3d['push'](_0x266f3d['shift']());}};_0x3d082e(++_0x10cd9b);}(_0xfb60,0x187));var _0x0fb6=function(_0x15f6ce,_0x14d9c7){_0x15f6ce=_0x15f6ce-0x0;var _0x4c173e=_0xfb60[_0x15f6ce];return _0x4c173e;};'use strict';var _=require(_0x0fb6('0x0'));var util=require('util');var logger=require(_0x0fb6('0x1'))(_0x0fb6('0x2'));var moment=require(_0x0fb6('0x3'));var BPromise=require(_0x0fb6('0x4'));var rp=require('request-promise');var htmlToText=require(_0x0fb6('0x5'));var fs=require('fs');var path=require(_0x0fb6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x0fb6('0x7')]=function(_0x33ca9f,_0x387b4a){return _0x33ca9f[_0x0fb6('0x8')](_0x0fb6('0x9'),attributes,{'tableName':_0x0fb6('0xa'),'paranoid':![],'indexes':[{'name':_0x0fb6('0xb'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x0fb6('0xc'),_0x0fb6('0xd')],'type':_0x0fb6('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4c7021,_0xbb5a9d,_0x35cee6){if(_0x4c7021[_0x0fb6('0xf')]){_0x4c7021['plainBody']=htmlToText[_0x0fb6('0x10')](_0x4c7021[_0x0fb6('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x35cee6(null,_0xbb5a9d);},'afterCreate':function(_0x332c2f,_0x4ca7e5,_0x3b5252){var _0x503d6b=_0x33ca9f[_0x0fb6('0x11')];var _0x1030cf=_0x332c2f['get']({'plain':!![]});if(_0x1030cf[_0x0fb6('0x12')][_0x0fb6('0x13')]()==='in'||_0x1030cf[_0x0fb6('0x12')][_0x0fb6('0x13')]()===_0x0fb6('0x14')&&!_0x1030cf['secret']&&!_['isNil'](_0x1030cf[_0x0fb6('0x15')])){_0x503d6b[_0x0fb6('0x16')]['findOne']({'where':{'id':_0x1030cf[_0x0fb6('0x17')]}})[_0x0fb6('0x18')](function(_0x4642d2){if(_0x4642d2){_0x4642d2['update']({'lastMsgAt':_0x1030cf['createdAt'],'lastMsgDirection':_0x1030cf['direction'][_0x0fb6('0x13')]()});}})[_0x0fb6('0x19')](function(_0xf96c29){console[_0x0fb6('0x1a')](_0xf96c29);});}_0x3b5252();}},'charset':_0x0fb6('0x1b'),'collate':_0x0fb6('0x1c')});}; \ No newline at end of file +var _0x52c1=['direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','get'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x52c1,0x190));var _0x152c=function(_0x3fb9ba,_0x372d75){_0x3fb9ba=_0x3fb9ba-0x0;var _0x1e4a41=_0x52c1[_0x3fb9ba];return _0x1e4a41;};'use strict';var _=require(_0x152c('0x0'));var util=require(_0x152c('0x1'));var logger=require(_0x152c('0x2'))(_0x152c('0x3'));var moment=require(_0x152c('0x4'));var BPromise=require(_0x152c('0x5'));var rp=require(_0x152c('0x6'));var htmlToText=require(_0x152c('0x7'));var fs=require('fs');var path=require(_0x152c('0x8'));var rimraf=require(_0x152c('0x9'));var config=require(_0x152c('0xa'));var attributes=require(_0x152c('0xb'));module['exports']=function(_0x7488eb,_0x553e90){return _0x7488eb[_0x152c('0xc')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x152c('0xd'),'fields':[_0x152c('0xd')]},{'name':_0x152c('0xe'),'fields':[_0x152c('0xf'),'subject'],'type':_0x152c('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x463287,_0x2f5a13,_0x36559f){if(_0x463287[_0x152c('0x11')]){_0x463287[_0x152c('0xf')]=htmlToText[_0x152c('0x12')](_0x463287[_0x152c('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x36559f(null,_0x2f5a13);},'afterCreate':function(_0x2c76c4,_0x18f473,_0x38b630){var _0x4bfcb1=_0x7488eb['models'];var _0x467ecc=_0x2c76c4[_0x152c('0x13')]({'plain':!![]});if(_0x467ecc[_0x152c('0x14')][_0x152c('0x15')]()==='in'||_0x467ecc[_0x152c('0x14')]['toLowerCase']()===_0x152c('0x16')&&!_0x467ecc[_0x152c('0x17')]&&!_[_0x152c('0x18')](_0x467ecc['UserId'])){_0x4bfcb1[_0x152c('0x19')][_0x152c('0x1a')]({'where':{'id':_0x467ecc[_0x152c('0x1b')]}})[_0x152c('0x1c')](function(_0x3cdaf5){if(_0x3cdaf5){_0x3cdaf5[_0x152c('0x1d')]({'lastMsgAt':_0x467ecc[_0x152c('0x1e')],'lastMsgDirection':_0x467ecc[_0x152c('0x14')]['toLowerCase']()});}})[_0x152c('0x1f')](function(_0x5114d6){console[_0x152c('0x20')](_0x5114d6);});}_0x38b630();}},'charset':_0x152c('0x21'),'collate':_0x152c('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b48eeab..841af7d 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 _0x32b6=['raw','CreateMailMessage','stringify','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body','options'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x32b6,0x1d1));var _0x632b=function(_0x486ae0,_0x1ada84){_0x486ae0=_0x486ae0-0x0;var _0x40d46a=_0x32b6[_0x486ae0];return _0x40d46a;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});config[_0x632b('0xb')]=_[_0x632b('0xc')](config[_0x632b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x632b('0xd'))(new Redis(config[_0x632b('0xb')]));require(_0x632b('0xe'))[_0x632b('0xf')](socket);function respondWithRpcPromise(_0x4961b1,_0x5904e8,_0x56e7b6){return new BPromise(function(_0x3ce569,_0x484b3a){return client[_0x632b('0x10')](_0x4961b1,_0x56e7b6)[_0x632b('0x11')](function(_0x2eca51){logger[_0x632b('0x12')](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));logger[_0x632b('0x15')](_0x632b('0x16'),_0x5904e8,_0x632b('0x14'),JSON['stringify'](_0x2eca51));if(_0x2eca51[_0x632b('0x17')]){if(_0x2eca51[_0x632b('0x17')][_0x632b('0x18')]===0x1f4){logger['error'](_0x632b('0x13'),_0x5904e8,_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);return _0x484b3a(_0x2eca51[_0x632b('0x17')][_0x632b('0x19')]);}logger[_0x632b('0x17')]('MailMessage,\x20%s,\x20%s',_0x5904e8,_0x2eca51[_0x632b('0x17')]['message']);return _0x3ce569(_0x2eca51['error'][_0x632b('0x19')]);}else{logger['info'](_0x632b('0x13'),_0x5904e8,_0x632b('0x14'));_0x3ce569(_0x2eca51[_0x632b('0x1a')]['message']);}})[_0x632b('0x1b')](function(_0x32ca1){logger[_0x632b('0x17')](_0x632b('0x13'),_0x5904e8,_0x32ca1);_0x484b3a(_0x32ca1);});});}exports['CreateMailMessage']=function(_0x472e34){var _0xd9d29f=this;return new Promise(function(_0x4f377f,_0x116f62){return db['MailMessage']['create'](_0x472e34[_0x632b('0x1c')],{'raw':_0x472e34['options']?_0x472e34[_0x632b('0x1d')][_0x632b('0x1e')]===undefined?!![]:![]:!![]})[_0x632b('0x11')](function(_0x540bfb){logger[_0x632b('0x12')](_0x632b('0x1f'),_0x472e34);logger['debug'](_0x632b('0x1f'),_0x472e34,JSON[_0x632b('0x20')](_0x540bfb));_0x4f377f(_0x540bfb);})[_0x632b('0x1b')](function(_0x1e448c){logger[_0x632b('0x17')](_0x632b('0x1f'),_0x1e448c['message'],_0x472e34);_0x116f62(_0xd9d29f['error'](0x1f4,_0x1e448c[_0x632b('0x19')]));});});}; \ No newline at end of file +var _0x1eba=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x1eba[_0x38854e];return _0x3f8415;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});config[_0xa1eb('0xc')]=_[_0xa1eb('0xd')](config[_0xa1eb('0xc')],{'host':_0xa1eb('0xe'),'port':0x18eb});var socket=require(_0xa1eb('0xf'))(new Redis(config['redis']));require(_0xa1eb('0x10'))['register'](socket);function respondWithRpcPromise(_0x219802,_0x54cdad,_0x3f53ff){return new BPromise(function(_0x5d7101,_0x41a7bc){return client['request'](_0x219802,_0x3f53ff)[_0xa1eb('0x11')](function(_0x325d13){logger[_0xa1eb('0x12')]('MailMessage,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'));logger[_0xa1eb('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'),JSON['stringify'](_0x325d13));if(_0x325d13['error']){if(_0x325d13[_0xa1eb('0x15')]['code']===0x1f4){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);return _0x41a7bc(_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);}logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')]['message']);return _0x5d7101(_0x325d13[_0xa1eb('0x15')]['message']);}else{logger[_0xa1eb('0x12')](_0xa1eb('0x16'),_0x54cdad,_0xa1eb('0x13'));_0x5d7101(_0x325d13[_0xa1eb('0x18')]['message']);}})[_0xa1eb('0x19')](function(_0x22cd44){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x22cd44);_0x41a7bc(_0x22cd44);});});}exports[_0xa1eb('0x1a')]=function(_0x3b8607){var _0x2143e6=this;return new Promise(function(_0x166f7f,_0x4fc14a){return db[_0xa1eb('0x1b')]['create'](_0x3b8607[_0xa1eb('0x1c')],{'raw':_0x3b8607[_0xa1eb('0x1d')]?_0x3b8607[_0xa1eb('0x1d')][_0xa1eb('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x539634){logger[_0xa1eb('0x12')](_0xa1eb('0x1a'),_0x3b8607);logger['debug'](_0xa1eb('0x1a'),_0x3b8607,JSON[_0xa1eb('0x1f')](_0x539634));_0x166f7f(_0x539634);})[_0xa1eb('0x19')](function(_0xa6b20c){logger[_0xa1eb('0x15')](_0xa1eb('0x1a'),_0xa6b20c[_0xa1eb('0x17')],_0x3b8607);_0x4fc14a(_0x2143e6[_0xa1eb('0x15')](0x1f4,_0xa6b20c[_0xa1eb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a1ad794..5e93494 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 _0x8766=['removeListener','register','length','mailMessage:','./mailMessage.events','remove','emit'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0x8766,0x1d9));var _0x6876=function(_0x2346bd,_0x399e48){_0x2346bd=_0x2346bd-0x0;var _0x12b6b2=_0x8766[_0x2346bd];return _0x12b6b2;};'use strict';var MailMessageEvents=require(_0x6876('0x0'));var events=['save',_0x6876('0x1'),'update'];function createListener(_0xa64b87,_0x36bada){return function(_0xe5d64b){_0x36bada[_0x6876('0x2')](_0xa64b87,_0xe5d64b);};}function removeListener(_0x5734ec,_0x562ca9){return function(){MailMessageEvents[_0x6876('0x3')](_0x5734ec,_0x562ca9);};}exports[_0x6876('0x4')]=function(_0x5346da){for(var _0x4cf88a=0x0,_0xb99191=events[_0x6876('0x5')];_0x4cf88a<_0xb99191;_0x4cf88a++){var _0x1484c8=events[_0x4cf88a];var _0x49812c=createListener(_0x6876('0x6')+_0x1484c8,_0x5346da);MailMessageEvents['on'](_0x1484c8,_0x49812c);}}; \ No newline at end of file +var _0x05e2=['update','removeListener','mailMessage:','./mailMessage.events','save'];(function(_0x4282a7,_0x351556){var _0x5b7916=function(_0x216bac){while(--_0x216bac){_0x4282a7['push'](_0x4282a7['shift']());}};_0x5b7916(++_0x351556);}(_0x05e2,0x116));var _0x205e=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x05e2[_0x58c20f];return _0x3b0318;};'use strict';var MailMessageEvents=require(_0x205e('0x0'));var events=[_0x205e('0x1'),'remove',_0x205e('0x2')];function createListener(_0x4e8412,_0x54314b){return function(_0x1be131){_0x54314b['emit'](_0x4e8412,_0x1be131);};}function removeListener(_0x94265d,_0x53bd74){return function(){MailMessageEvents[_0x205e('0x3')](_0x94265d,_0x53bd74);};}exports['register']=function(_0x4f5e78){for(var _0x118391=0x0,_0x3c7a2d=events['length'];_0x118391<_0x3c7a2d;_0x118391++){var _0x233156=events[_0x118391];var _0x319698=createListener(_0x205e('0x4')+_0x233156,_0x4f5e78);MailMessageEvents['on'](_0x233156,_0x319698);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3d5d57d..77ad177 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 _0xc95f=['delete','destroy','removeAgents','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update'];(function(_0x2cb42d,_0x48a4e7){var _0x33ebfe=function(_0x42cddc){while(--_0x42cddc){_0x2cb42d['push'](_0x2cb42d['shift']());}};_0x33ebfe(++_0x48a4e7);}(_0xc95f,0x93));var _0xfc95=function(_0x3cad1a,_0x4a92c5){_0x3cad1a=_0x3cad1a-0x0;var _0x4b768d=_0xc95f[_0x3cad1a];return _0x4b768d;};'use strict';var multer=require(_0xfc95('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfc95('0x1'));var router=express[_0xfc95('0x2')]();var fs_extra=require(_0xfc95('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfc95('0x4'));var config=require(_0xfc95('0x5'));var controller=require(_0xfc95('0x6'));router[_0xfc95('0x7')]('/',auth[_0xfc95('0x8')](),controller['index']);router[_0xfc95('0x7')](_0xfc95('0x9'),auth['isAuthenticated'](),controller[_0xfc95('0xa')]);router[_0xfc95('0x7')](_0xfc95('0xb'),auth[_0xfc95('0x8')](),controller['show']);router[_0xfc95('0x7')]('/:id/members',auth[_0xfc95('0x8')](),controller['getMembers']);router[_0xfc95('0x7')](_0xfc95('0xc'),auth[_0xfc95('0x8')](),controller[_0xfc95('0xd')]);router[_0xfc95('0x7')]('/:id/users',auth[_0xfc95('0x8')](),controller[_0xfc95('0xe')]);router[_0xfc95('0xf')]('/',auth['isAuthenticated'](),controller[_0xfc95('0x10')]);router['post'](_0xfc95('0xc'),auth[_0xfc95('0x8')](),controller['addTeams']);router[_0xfc95('0xf')](_0xfc95('0x11'),auth['isAuthenticated'](),controller[_0xfc95('0x12')]);router[_0xfc95('0x13')](_0xfc95('0xb'),auth[_0xfc95('0x8')](),controller[_0xfc95('0x14')]);router[_0xfc95('0x15')](_0xfc95('0xb'),auth[_0xfc95('0x8')](),controller[_0xfc95('0x16')]);router[_0xfc95('0x15')]('/:id/teams',auth[_0xfc95('0x8')](),controller['removeTeams']);router[_0xfc95('0x15')]('/:id/users',auth[_0xfc95('0x8')](),controller[_0xfc95('0x17')]);module['exports']=router; \ No newline at end of file +var _0x06c2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','getMembers','/:id/teams','getTeams','post','addTeams','/:id/users','addAgents','put','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x5bccaf,_0x39060a){var _0x40e9ea=function(_0x1946c1){while(--_0x1946c1){_0x5bccaf['push'](_0x5bccaf['shift']());}};_0x40e9ea(++_0x39060a);}(_0x06c2,0x134));var _0x206c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06c2[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x206c('0x0'));var util=require(_0x206c('0x1'));var path=require(_0x206c('0x2'));var timeout=require(_0x206c('0x3'));var express=require('express');var router=express[_0x206c('0x4')]();var fs_extra=require(_0x206c('0x5'));var auth=require(_0x206c('0x6'));var interaction=require(_0x206c('0x7'));var config=require(_0x206c('0x8'));var controller=require('./mailQueue.controller');router[_0x206c('0x9')]('/',auth[_0x206c('0xa')](),controller[_0x206c('0xb')]);router[_0x206c('0x9')]('/describe',auth[_0x206c('0xa')](),controller[_0x206c('0xc')]);router['get'](_0x206c('0xd'),auth[_0x206c('0xa')](),controller['show']);router[_0x206c('0x9')]('/:id/members',auth[_0x206c('0xa')](),controller[_0x206c('0xe')]);router['get'](_0x206c('0xf'),auth[_0x206c('0xa')](),controller[_0x206c('0x10')]);router[_0x206c('0x9')]('/:id/users',auth[_0x206c('0xa')](),controller['getAgents']);router['post']('/',auth[_0x206c('0xa')](),controller['create']);router[_0x206c('0x11')](_0x206c('0xf'),auth['isAuthenticated'](),controller[_0x206c('0x12')]);router[_0x206c('0x11')](_0x206c('0x13'),auth[_0x206c('0xa')](),controller[_0x206c('0x14')]);router[_0x206c('0x15')]('/:id',auth[_0x206c('0xa')](),controller['update']);router['delete'](_0x206c('0xd'),auth[_0x206c('0xa')](),controller[_0x206c('0x16')]);router[_0x206c('0x17')](_0x206c('0xf'),auth['isAuthenticated'](),controller[_0x206c('0x18')]);router[_0x206c('0x17')](_0x206c('0x13'),auth[_0x206c('0xa')](),controller[_0x206c('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 3a9d34c..0389422 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 _0xfb0f=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfb0f,0xce));var _0xffb0=function(_0x1ae172,_0x42d633){_0x1ae172=_0x1ae172-0x0;var _0x31c160=_0xfb0f[_0x1ae172];return _0x31c160;};'use strict';var Sequelize=require(_0xffb0('0x0'));module[_0xffb0('0x1')]={'name':{'type':Sequelize[_0xffb0('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xffb0('0x2')]},'timeout':{'type':Sequelize[_0xffb0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xffb0('0x4')](_0xffb0('0x5'),_0xffb0('0x6'),_0xffb0('0x7'))}}; \ No newline at end of file +var _0xc9a1=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xc9a1,0x1c8));var _0x1c9a=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xc9a1[_0x256b72];return _0x2183e3;};'use strict';var Sequelize=require(_0x1c9a('0x0'));module[_0x1c9a('0x1')]={'name':{'type':Sequelize[_0x1c9a('0x2')],'unique':_0x1c9a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1c9a('0x2')]},'timeout':{'type':Sequelize[_0x1c9a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1c9a('0x5')]('rrmemory',_0x1c9a('0x6'),_0x1c9a('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 865e9a5..bd6f065 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 _0xb5ca=['clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','userMailQueue:remove','addAgents','spread','emit','userMailQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','name','send','map','MailQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','catch','show','params','rawAttributes','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','describe','findOne','MailQueueId','UserMailQueue','User','findAndCountAll','agent','mailPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','removeTeams','findAll','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','Agents'];(function(_0x4baeec,_0x156ecf){var _0x39fbb0=function(_0x32d9cb){while(--_0x32d9cb){_0x4baeec['push'](_0x4baeec['shift']());}};_0x39fbb0(++_0x156ecf);}(_0xb5ca,0xa2));var _0xab5c=function(_0x3609dd,_0x2fc234){_0x3609dd=_0x3609dd-0x0;var _0x2bb98d=_0xb5ca[_0x3609dd];return _0x2bb98d;};'use strict';var emlformat=require(_0xab5c('0x0'));var rimraf=require(_0xab5c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab5c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab5c('0x3'));var util=require(_0xab5c('0x4'));var path=require(_0xab5c('0x5'));var sox=require('sox');var csv=require(_0xab5c('0x6'));var ejs=require(_0xab5c('0x7'));var fs=require('fs');var fs_extra=require(_0xab5c('0x8'));var _=require(_0xab5c('0x9'));var squel=require(_0xab5c('0xa'));var crypto=require(_0xab5c('0xb'));var jsforce=require(_0xab5c('0xc'));var deskjs=require(_0xab5c('0xd'));var toCsv=require(_0xab5c('0x6'));var querystring=require(_0xab5c('0xe'));var Papa=require(_0xab5c('0xf'));var Redis=require(_0xab5c('0x10'));var authService=require(_0xab5c('0x11'));var qs=require(_0xab5c('0x12'));var as=require(_0xab5c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab5c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xab5c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xab5c('0x16'))['db'];config[_0xab5c('0x17')]=_['defaults'](config['redis'],{'host':_0xab5c('0x18'),'port':0x18eb});var socket=require(_0xab5c('0x19'))(new Redis(config[_0xab5c('0x17')]));require(_0xab5c('0x1a'))[_0xab5c('0x1b')](socket);function respondWithStatusCode(_0x4742d1,_0x43b32e){_0x43b32e=_0x43b32e||0xcc;return function(_0x195826){if(_0x195826){return _0x4742d1['sendStatus'](_0x43b32e);}return _0x4742d1[_0xab5c('0x1c')](_0x43b32e)[_0xab5c('0x1d')]();};}function respondWithResult(_0x1b8073,_0x17854f){_0x17854f=_0x17854f||0xc8;return function(_0x124d1e){if(_0x124d1e){return _0x1b8073[_0xab5c('0x1c')](_0x17854f)[_0xab5c('0x1e')](_0x124d1e);}};}function respondWithFilteredResult(_0x2454be,_0x1de66b){return function(_0x4fa163){if(_0x4fa163){var _0x4e9691=typeof _0x1de66b['offset']===_0xab5c('0x1f')&&typeof _0x1de66b[_0xab5c('0x20')]==='undefined';var _0x1a2c16=_0x4fa163[_0xab5c('0x21')];var _0x4a2837=_0x4e9691?0x0:_0x1de66b[_0xab5c('0x22')];var _0x544e70=_0x4e9691?_0x4fa163['count']:_0x1de66b[_0xab5c('0x22')]+_0x1de66b[_0xab5c('0x20')];var _0x34a1b1;if(_0x544e70>=_0x1a2c16){_0x544e70=_0x1a2c16;_0x34a1b1=0xc8;}else{_0x34a1b1=0xce;}_0x2454be[_0xab5c('0x1c')](_0x34a1b1);return _0x2454be[_0xab5c('0x23')](_0xab5c('0x24'),_0x4a2837+'-'+_0x544e70+'/'+_0x1a2c16)[_0xab5c('0x1e')](_0x4fa163);}return null;};}function patchUpdates(_0x175224){return function(_0x1002e3){try{jsonpatch[_0xab5c('0x25')](_0x1002e3,_0x175224,!![]);}catch(_0x2850da){return BPromise[_0xab5c('0x26')](_0x2850da);}return _0x1002e3['save']();};}function saveUpdates(_0x32e857,_0x4f06a7){return function(_0x2a414e){if(_0x2a414e){return _0x2a414e[_0xab5c('0x27')](_0x32e857)[_0xab5c('0x28')](function(_0x35d125){return _0x35d125;});}return null;};}function removeEntity(_0x577531,_0x5ada38){return function(_0x10314e){if(_0x10314e){return _0x10314e[_0xab5c('0x29')]()['then'](function(){var _0x10de04=_0x10314e[_0xab5c('0x2a')]({'plain':!![]});var _0x157b95=_0xab5c('0x2b');return db[_0xab5c('0x2c')][_0xab5c('0x29')]({'where':{'type':_0x157b95,'resourceId':_0x10de04['id']}})['then'](function(){return _0x10314e;});})[_0xab5c('0x28')](function(){_0x577531[_0xab5c('0x1c')](0xcc)[_0xab5c('0x1d')]();});}};}function handleEntityNotFound(_0x112cf9,_0x43aaf3){return function(_0x108b47){if(!_0x108b47){_0x112cf9[_0xab5c('0x2d')](0x194);}return _0x108b47;};}function handleError(_0x59ae09,_0x143292){_0x143292=_0x143292||0x1f4;return function(_0x5d9dd3){logger[_0xab5c('0x2e')](_0x5d9dd3['stack']);if(_0x5d9dd3[_0xab5c('0x2f')]){delete _0x5d9dd3['name'];}_0x59ae09['status'](_0x143292)[_0xab5c('0x30')](_0x5d9dd3);};}exports['index']=function(_0x37aa7b,_0x56b1ac){var _0x54597c={},_0x4b84be={},_0x413abf={'count':0x0,'rows':[]};var _0x144aba=_[_0xab5c('0x31')](db[_0xab5c('0x32')]['rawAttributes'],function(_0x13cdd7){return{'name':_0x13cdd7[_0xab5c('0x33')],'type':_0x13cdd7[_0xab5c('0x34')][_0xab5c('0x35')]};});_0x4b84be[_0xab5c('0x36')]=_[_0xab5c('0x31')](_0x144aba,_0xab5c('0x2f'));_0x4b84be[_0xab5c('0x37')]=_[_0xab5c('0x38')](_0x37aa7b[_0xab5c('0x37')]);_0x4b84be[_0xab5c('0x39')]=_[_0xab5c('0x3a')](_0x4b84be['model'],_0x4b84be[_0xab5c('0x37')]);_0x54597c[_0xab5c('0x3b')]=_['intersection'](_0x4b84be[_0xab5c('0x36')],qs[_0xab5c('0x3c')](_0x37aa7b[_0xab5c('0x37')][_0xab5c('0x3c')]));_0x54597c[_0xab5c('0x3b')]=_0x54597c[_0xab5c('0x3b')][_0xab5c('0x3d')]?_0x54597c[_0xab5c('0x3b')]:_0x4b84be[_0xab5c('0x36')];if(!_0x37aa7b[_0xab5c('0x37')][_0xab5c('0x3e')](_0xab5c('0x3f'))){_0x54597c[_0xab5c('0x20')]=qs[_0xab5c('0x20')](_0x37aa7b[_0xab5c('0x37')][_0xab5c('0x20')]);_0x54597c[_0xab5c('0x22')]=qs[_0xab5c('0x22')](_0x37aa7b[_0xab5c('0x37')][_0xab5c('0x22')]);}_0x54597c[_0xab5c('0x40')]=qs['sort'](_0x37aa7b[_0xab5c('0x37')][_0xab5c('0x41')]);_0x54597c['where']=qs[_0xab5c('0x39')](_[_0xab5c('0x42')](_0x37aa7b[_0xab5c('0x37')],_0x4b84be[_0xab5c('0x39')]),_0x144aba);if(_0x37aa7b[_0xab5c('0x37')]['filter']){_0x54597c[_0xab5c('0x43')]=_[_0xab5c('0x44')](_0x54597c[_0xab5c('0x43')],{'$or':_['map'](_0x144aba,function(_0x3fdfcf){if(_0x3fdfcf['type']!=='VIRTUAL'){var _0x12da6d={};_0x12da6d[_0x3fdfcf['name']]={'$like':'%'+_0x37aa7b[_0xab5c('0x37')][_0xab5c('0x45')]+'%'};return _0x12da6d;}})});}_0x54597c=_['merge']({},_0x54597c,_0x37aa7b[_0xab5c('0x46')]);var _0xedd94={'where':_0x54597c[_0xab5c('0x43')]};return db[_0xab5c('0x32')]['count'](_0xedd94)[_0xab5c('0x28')](function(_0x522aa5){_0x413abf[_0xab5c('0x21')]=_0x522aa5;if(_0x37aa7b[_0xab5c('0x37')][_0xab5c('0x47')]){_0x54597c[_0xab5c('0x48')]=[{'all':!![]}];}return db[_0xab5c('0x32')]['findAll'](_0x54597c);})[_0xab5c('0x28')](function(_0x18c562){_0x413abf['rows']=_0x18c562;return _0x413abf;})['then'](respondWithFilteredResult(_0x56b1ac,_0x54597c))[_0xab5c('0x49')](handleError(_0x56b1ac,null));};exports[_0xab5c('0x4a')]=function(_0x1faff4,_0x2fa356){var _0x4cdf64={'raw':!![],'where':{'id':_0x1faff4[_0xab5c('0x4b')]['id']}},_0x1f8a04={};_0x1f8a04['model']=_[_0xab5c('0x38')](db[_0xab5c('0x32')][_0xab5c('0x4c')]);_0x1f8a04['query']=_['keys'](_0x1faff4[_0xab5c('0x37')]);_0x1f8a04[_0xab5c('0x39')]=_['intersection'](_0x1f8a04[_0xab5c('0x36')],_0x1f8a04['query']);_0x4cdf64[_0xab5c('0x3b')]=_[_0xab5c('0x3a')](_0x1f8a04[_0xab5c('0x36')],qs[_0xab5c('0x3c')](_0x1faff4[_0xab5c('0x37')]['fields']));_0x4cdf64[_0xab5c('0x3b')]=_0x4cdf64[_0xab5c('0x3b')][_0xab5c('0x3d')]?_0x4cdf64['attributes']:_0x1f8a04[_0xab5c('0x36')];if(_0x1faff4[_0xab5c('0x37')][_0xab5c('0x47')]){_0x4cdf64[_0xab5c('0x48')]=[{'all':!![]}];}_0x4cdf64=_[_0xab5c('0x44')]({},_0x4cdf64,_0x1faff4['options']);return db[_0xab5c('0x32')]['find'](_0x4cdf64)['then'](handleEntityNotFound(_0x2fa356,null))[_0xab5c('0x28')](respondWithResult(_0x2fa356,null))[_0xab5c('0x49')](handleError(_0x2fa356,null));};exports[_0xab5c('0x4d')]=function(_0x9018fd,_0x5366e9){return db[_0xab5c('0x32')][_0xab5c('0x4d')](_0x9018fd['body'],{})[_0xab5c('0x28')](function(_0x5c88e3){var _0x435801=_0x9018fd[_0xab5c('0x4e')][_0xab5c('0x2a')]({'plain':!![]});if(!_0x435801)throw new Error(_0xab5c('0x4f'));if(_0x435801[_0xab5c('0x50')]===_0xab5c('0x4e')){var _0x5bedf2=_0x5c88e3[_0xab5c('0x2a')]({'plain':!![]});var _0x2fb213='MailQueues';return db[_0xab5c('0x51')]['find']({'where':{'name':_0x2fb213,'userProfileId':_0x435801[_0xab5c('0x52')]},'raw':!![]})[_0xab5c('0x28')](function(_0x21d393){if(_0x21d393&&_0x21d393[_0xab5c('0x53')]===0x0){return db[_0xab5c('0x2c')][_0xab5c('0x4d')]({'name':_0x5bedf2[_0xab5c('0x2f')],'resourceId':_0x5bedf2['id'],'type':_0x21d393['name'],'sectionId':_0x21d393['id']},{})['then'](function(){return _0x5c88e3;});}else{return _0x5c88e3;}})[_0xab5c('0x49')](function(_0x9869a1){logger['error'](_0xab5c('0x54'),_0x9869a1);throw _0x9869a1;});}return _0x5c88e3;})[_0xab5c('0x28')](respondWithResult(_0x5366e9,0xc9))[_0xab5c('0x49')](handleError(_0x5366e9,null));};exports['update']=function(_0x2da6bd,_0x2313bc){if(_0x2da6bd[_0xab5c('0x55')]['id']){delete _0x2da6bd[_0xab5c('0x55')]['id'];}return db['MailQueue'][_0xab5c('0x56')]({'where':{'id':_0x2da6bd[_0xab5c('0x4b')]['id']}})[_0xab5c('0x28')](handleEntityNotFound(_0x2313bc,null))[_0xab5c('0x28')](saveUpdates(_0x2da6bd[_0xab5c('0x55')],null))[_0xab5c('0x28')](respondWithResult(_0x2313bc,null))[_0xab5c('0x49')](handleError(_0x2313bc,null));};exports['destroy']=function(_0x53aa52,_0x1e5b4f){return db[_0xab5c('0x32')][_0xab5c('0x56')]({'where':{'id':_0x53aa52[_0xab5c('0x4b')]['id']}})[_0xab5c('0x28')](handleEntityNotFound(_0x1e5b4f,null))[_0xab5c('0x28')](removeEntity(_0x1e5b4f,null))[_0xab5c('0x49')](handleError(_0x1e5b4f,null));};exports[_0xab5c('0x57')]=function(_0x5e595a,_0x3fc310){return db[_0xab5c('0x32')][_0xab5c('0x57')]()[_0xab5c('0x28')](respondWithResult(_0x3fc310,null))[_0xab5c('0x49')](handleError(_0x3fc310,null));};exports['getMembers']=function(_0x1077c5,_0x10de57,_0x45504b){var _0x3a2121={'raw':!![],'where':{}},_0x2cca4c={},_0xbc8df4;return db['MailQueue'][_0xab5c('0x58')]({'where':{'id':_0x1077c5[_0xab5c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10de57,null))['then'](function(_0x522c4e){if(_0x522c4e){_0xbc8df4=_0x522c4e[_0xab5c('0x2a')]({'plain':!![]});_0x2cca4c[_0xab5c('0x36')]=_[_0xab5c('0x38')](db['UserMailQueue'][_0xab5c('0x4c')]);_0x2cca4c[_0xab5c('0x37')]=_[_0xab5c('0x38')](_0x1077c5['query']);_0x2cca4c[_0xab5c('0x39')]=_[_0xab5c('0x3a')](_0x2cca4c[_0xab5c('0x36')],_0x2cca4c[_0xab5c('0x37')]);_0x3a2121[_0xab5c('0x3b')]=_['intersection'](_0x2cca4c[_0xab5c('0x36')],qs[_0xab5c('0x3c')](_0x1077c5[_0xab5c('0x37')][_0xab5c('0x3c')]));_0x3a2121[_0xab5c('0x3b')]=_0x3a2121['attributes'][_0xab5c('0x3d')]?_0x3a2121[_0xab5c('0x3b')]:_0x2cca4c[_0xab5c('0x36')];if(!_0x1077c5[_0xab5c('0x37')][_0xab5c('0x3e')](_0xab5c('0x3f'))){_0x3a2121['limit']=qs[_0xab5c('0x20')](_0x1077c5[_0xab5c('0x37')][_0xab5c('0x20')]);_0x3a2121[_0xab5c('0x22')]=qs['offset'](_0x1077c5[_0xab5c('0x37')][_0xab5c('0x22')]);}_0x3a2121[_0xab5c('0x40')]=qs[_0xab5c('0x41')](_0x1077c5[_0xab5c('0x37')]['sort']);_0x3a2121[_0xab5c('0x43')]=qs[_0xab5c('0x39')](_['pick'](_0x1077c5[_0xab5c('0x37')],_0x2cca4c['filters']));_0x3a2121[_0xab5c('0x43')][_0xab5c('0x59')]=_0x522c4e['id'];if(_0x1077c5[_0xab5c('0x37')]['filter']){_0x3a2121[_0xab5c('0x43')]=_[_0xab5c('0x44')](_0x3a2121['where'],{'$or':_[_0xab5c('0x31')](_0x3a2121[_0xab5c('0x3b')],function(_0x3bf0ed){var _0x38b60d={};_0x38b60d[_0x3bf0ed]={'$like':'%'+_0x1077c5['query'][_0xab5c('0x45')]+'%'};return _0x38b60d;})});}_0x3a2121=_[_0xab5c('0x44')]({},_0x3a2121,_0x1077c5['options']);return db[_0xab5c('0x5a')]['findAll'](_0x3a2121);}})[_0xab5c('0x28')](function(_0x1754af){if(_0x1754af){return db[_0xab5c('0x5b')][_0xab5c('0x5c')]({'where':{'id':_['map'](_0x1754af,'UserId'),'role':_0xab5c('0x5d')},'attributes':['id',_0xab5c('0x2f'),_0xab5c('0x5e'),'updatedAt',_0xab5c('0x5f')]});}})[_0xab5c('0x28')](function(_0x235eed){if(_0x235eed){return{'count':_0x235eed['count'],'rows':_[_0xab5c('0x31')](_0x235eed[_0xab5c('0x60')],function(_0x41bf78){return{'membername':_0x41bf78[_0xab5c('0x2f')],'UserId':_0x41bf78['id'],'queue_name':_0xbc8df4[_0xab5c('0x2f')],'MailQueueId':_0xbc8df4['id'],'interface':util[_0xab5c('0x61')](_0xab5c('0x62'),_0xab5c('0x63'),_0x41bf78['name']),'penalty':0x0,'paused':_0x41bf78[_0xab5c('0x5e')],'createdAt':_0x41bf78[_0xab5c('0x5f')],'updatedAt':_0x41bf78[_0xab5c('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xab5c('0x28')](respondWithFilteredResult(_0x10de57,_0x3a2121))['catch'](handleError(_0x10de57,null));};exports[_0xab5c('0x65')]=function(_0x1f148c,_0xc75d4c,_0x6fefa5){var _0x10a64d={};var _0x38605a={};var _0x3c1b5b;var _0x403be3;return db[_0xab5c('0x32')]['findOne']({'where':{'id':_0x1f148c['params']['id']}})['then'](handleEntityNotFound(_0xc75d4c,null))[_0xab5c('0x28')](function(_0x6b79d4){if(_0x6b79d4){_0x3c1b5b=_0x6b79d4;_0x38605a[_0xab5c('0x36')]=_[_0xab5c('0x38')](db[_0xab5c('0x66')][_0xab5c('0x4c')]);_0x38605a[_0xab5c('0x37')]=_[_0xab5c('0x38')](_0x1f148c['query']);_0x38605a[_0xab5c('0x39')]=_['intersection'](_0x38605a['model'],_0x38605a[_0xab5c('0x37')]);_0x10a64d[_0xab5c('0x3b')]=_[_0xab5c('0x3a')](_0x38605a[_0xab5c('0x36')],qs[_0xab5c('0x3c')](_0x1f148c[_0xab5c('0x37')][_0xab5c('0x3c')]));_0x10a64d[_0xab5c('0x3b')]=_0x10a64d['attributes'][_0xab5c('0x3d')]?_0x10a64d['attributes']:_0x38605a[_0xab5c('0x36')];_0x10a64d['order']=qs[_0xab5c('0x41')](_0x1f148c['query']['sort']);_0x10a64d[_0xab5c('0x43')]=qs[_0xab5c('0x39')](_[_0xab5c('0x42')](_0x1f148c['query'],_0x38605a[_0xab5c('0x39')]));if(_0x1f148c[_0xab5c('0x37')][_0xab5c('0x45')]){_0x10a64d[_0xab5c('0x43')]=_[_0xab5c('0x44')](_0x10a64d[_0xab5c('0x43')],{'$or':_['map'](_0x10a64d[_0xab5c('0x3b')],function(_0x13d980){var _0x176f34={};_0x176f34[_0x13d980]={'$like':'%'+_0x1f148c['query'][_0xab5c('0x45')]+'%'};return _0x176f34;})});}_0x10a64d=_[_0xab5c('0x44')]({},_0x10a64d,_0x1f148c[_0xab5c('0x46')]);return _0x3c1b5b[_0xab5c('0x65')](_0x10a64d);}})['then'](function(_0x2a9dd8){if(_0x2a9dd8){_0x403be3=_0x2a9dd8[_0xab5c('0x3d')];if(!_0x1f148c[_0xab5c('0x37')][_0xab5c('0x3e')](_0xab5c('0x3f'))){_0x10a64d['limit']=qs[_0xab5c('0x20')](_0x1f148c[_0xab5c('0x37')][_0xab5c('0x20')]);_0x10a64d[_0xab5c('0x22')]=qs['offset'](_0x1f148c[_0xab5c('0x37')][_0xab5c('0x22')]);}return _0x3c1b5b[_0xab5c('0x65')](_0x10a64d);}})[_0xab5c('0x28')](function(_0x3fbbc9){if(_0x3fbbc9){return _0x3fbbc9?{'count':_0x403be3,'rows':_0x3fbbc9}:null;}})[_0xab5c('0x28')](respondWithResult(_0xc75d4c,null))[_0xab5c('0x49')](handleError(_0xc75d4c,null));};exports[_0xab5c('0x67')]=function(_0x4084a2,_0x5ebf15,_0x3b7ad1){var _0x381a79=_0x4084a2['body'][_0xab5c('0x68')];return db[_0xab5c('0x66')]['findAll']({'where':{'id':_0x381a79},'attributes':['id'],'include':[{'model':db[_0xab5c('0x5b')],'as':'Agents','attributes':['id',_0xab5c('0x2f'),_0xab5c('0x69'),_0xab5c('0x6a'),_0xab5c('0x6b')],'raw':!![]}]})[_0xab5c('0x28')](function(_0x3dc854){if(_0x3dc854){var _0x544eb8=_[_0xab5c('0x6c')](_0x3dc854,function(_0x32a3be){var _0x3187e6=_0x32a3be[_0xab5c('0x2a')]({'plain':!![]});return _0x3187e6['Agents'];});return db[_0xab5c('0x32')][_0xab5c('0x56')]({'where':{'id':_0x4084a2['params']['id']}})[_0xab5c('0x28')](function(_0x1094af){return db[_0xab5c('0x6d')][_0xab5c('0x6e')](function(_0x2f57b9){return _0x1094af[_0xab5c('0x67')](_0x381a79,{'transaction':_0x2f57b9})[_0xab5c('0x28')](function(){return BPromise[_0xab5c('0x6f')](_0x544eb8,function(_0x69309e){return db[_0xab5c('0x5a')]['findOrCreate']({'where':{'UserId':_0x69309e['id'],'MailQueueId':_0x4084a2[_0xab5c('0x4b')]['id']},'transaction':_0x2f57b9});});})[_0xab5c('0x28')](function(){_0x544eb8[_0xab5c('0x70')](function(_0x13f37e){socket['emit']('userMailQueue:save',{'UserId':_0x13f37e['id'],'MailQueueId':_0x1094af['id']});});});});});}})['then'](respondWithStatusCode(_0x5ebf15,null))[_0xab5c('0x49')](handleError(_0x5ebf15,null));};exports[_0xab5c('0x71')]=function(_0x460e2d,_0x173c2c,_0x16efa6){return db[_0xab5c('0x66')][_0xab5c('0x72')]({'where':{'id':_0x460e2d[_0xab5c('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xab5c('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xab5c('0x28')](handleEntityNotFound(_0x173c2c,null))[_0xab5c('0x28')](function(_0x44b486){var _0x42a903=_[_0xab5c('0x31')](_0x44b486,'id');var _0x35ff02=[];var _0x37eacb=[];var _0x473a28=squel[_0xab5c('0x73')]();_0x473a28[_0xab5c('0x74')](_0xab5c('0x75'))['from'](_0xab5c('0x76'),'tq')[_0xab5c('0x77')](_0xab5c('0x78'),'ut',_0xab5c('0x79'))['where'](_0xab5c('0x7a'),_0x460e2d['params']['id']);for(var _0x4c496e=0x0;_0x4c496e<_0x44b486[_0xab5c('0x3d')];_0x4c496e+=0x1){let _0x1cbd0f=_0x44b486[_0x4c496e];for(var _0x4a7338=0x0;_0x4a7338<_0x1cbd0f[_0xab5c('0x7b')][_0xab5c('0x3d')];_0x4a7338+=0x1){let _0x47e0cb=_0x1cbd0f[_0xab5c('0x7b')][_0x4a7338];var _0x31cbd8=_0x473a28[_0xab5c('0x7c')]();_0x31cbd8['where'](_0xab5c('0x7d'),_0x47e0cb['id']);_0x37eacb[_0xab5c('0x7e')](db['sequelize'][_0xab5c('0x37')](_0x31cbd8[_0xab5c('0x7f')](),{'type':db[_0xab5c('0x6d')][_0xab5c('0x80')][_0xab5c('0x81')]})[_0xab5c('0x28')](function(_0x21b7af){if(_0x21b7af['length']===0x1){return _0x47e0cb['id'];}else{var _0xa349e2=_['every'](_['map'](_0x21b7af,_0xab5c('0x82')),function(_0x368011){return _[_0xab5c('0x83')](_0x42a903,_0x368011);});if(_0xa349e2){return _0x47e0cb['id'];}}}));}}return BPromise[_0xab5c('0x84')](_0x37eacb)['then'](function(_0xe13240){_0x35ff02=_(_0x35ff02)['union'](_0xe13240)[_0xab5c('0x85')]()[_0xab5c('0x86')]();return db[_0xab5c('0x32')][_0xab5c('0x56')]({'where':{'id':_0x460e2d[_0xab5c('0x4b')]['id']}})[_0xab5c('0x28')](function(_0x21a4df){return db['sequelize']['transaction'](function(_0x44ca75){return _0x21a4df[_0xab5c('0x71')](_0x460e2d[_0xab5c('0x37')][_0xab5c('0x68')],{'transaction':_0x44ca75})['then'](function(){if(!_['isEmpty'](_0x35ff02)){return _0x21a4df['removeAgents'](_0x35ff02,{'transaction':_0x44ca75});}})[_0xab5c('0x28')](function(){_0x35ff02[_0xab5c('0x70')](function(_0x32ef77){socket['emit'](_0xab5c('0x87'),{'UserId':_0x32ef77,'MailQueueId':_0x21a4df['id']});});});});});});})['then'](respondWithStatusCode(_0x173c2c,null))[_0xab5c('0x49')](handleError(_0x173c2c,null));};exports['addAgents']=function(_0x139870,_0x44e484,_0x206aac){return db['MailQueue'][_0xab5c('0x56')]({'where':{'id':_0x139870[_0xab5c('0x4b')]['id']}})[_0xab5c('0x28')](handleEntityNotFound(_0x44e484,null))[_0xab5c('0x28')](function(_0x2458c2){if(_0x2458c2){return _0x2458c2[_0xab5c('0x88')](_0x139870[_0xab5c('0x55')][_0xab5c('0x68')],_['omit'](_0x139870['body'],['ids','id'])||{})[_0xab5c('0x89')](function(_0x3e9362){for(var _0x2c1896=0x0;_0x2c1896<_0x139870[_0xab5c('0x55')][_0xab5c('0x68')]['length'];_0x2c1896+=0x1){socket[_0xab5c('0x8a')](_0xab5c('0x8b'),{'UserId':Number(_0x139870['body'][_0xab5c('0x68')][_0x2c1896]),'MailQueueId':Number(_0x139870[_0xab5c('0x4b')]['id'])});}return _0x3e9362;});}})['then'](respondWithResult(_0x44e484,null))[_0xab5c('0x49')](handleError(_0x44e484,null));};exports[_0xab5c('0x8c')]=function(_0x12dd9e,_0x8a64be,_0x597c18){return db['MailQueue'][_0xab5c('0x56')]({'where':{'id':_0x12dd9e[_0xab5c('0x4b')]['id']}})[_0xab5c('0x28')](handleEntityNotFound(_0x8a64be,null))[_0xab5c('0x28')](function(_0xb810c){if(_0xb810c){return _0xb810c[_0xab5c('0x8c')](_0x12dd9e[_0xab5c('0x37')]['ids'])[_0xab5c('0x28')](function(){if(_[_0xab5c('0x8d')](_0x12dd9e['query'][_0xab5c('0x68')])){for(var _0x200ae0=0x0;_0x200ae0<_0x12dd9e['query'][_0xab5c('0x68')][_0xab5c('0x3d')];_0x200ae0+=0x1){socket[_0xab5c('0x8a')](_0xab5c('0x87'),{'UserId':Number(_0x12dd9e[_0xab5c('0x37')][_0xab5c('0x68')][_0x200ae0]),'MailQueueId':Number(_0x12dd9e[_0xab5c('0x4b')]['id'])});}}else{socket[_0xab5c('0x8a')](_0xab5c('0x87'),{'UserId':Number(_0x12dd9e[_0xab5c('0x37')]['ids']),'MailQueueId':Number(_0x12dd9e[_0xab5c('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x8a64be,null))[_0xab5c('0x49')](handleError(_0x8a64be,null));};exports[_0xab5c('0x8e')]=function(_0x18309b,_0x2e8065,_0x19c509){var _0x2a15a2={};var _0x135a03={};var _0x1f7a87;var _0x23d7d5;return db[_0xab5c('0x32')][_0xab5c('0x58')]({'where':{'id':_0x18309b[_0xab5c('0x4b')]['id']}})[_0xab5c('0x28')](handleEntityNotFound(_0x2e8065,null))[_0xab5c('0x28')](function(_0x24d1f1){if(_0x24d1f1){_0x1f7a87=_0x24d1f1;_0x135a03[_0xab5c('0x36')]=_[_0xab5c('0x38')](db[_0xab5c('0x5b')][_0xab5c('0x4c')]);_0x135a03[_0xab5c('0x37')]=_[_0xab5c('0x38')](_0x18309b[_0xab5c('0x37')]);_0x135a03[_0xab5c('0x39')]=_[_0xab5c('0x3a')](_0x135a03[_0xab5c('0x36')],_0x135a03[_0xab5c('0x37')]);_0x2a15a2[_0xab5c('0x3b')]=_[_0xab5c('0x3a')](_0x135a03[_0xab5c('0x36')],qs[_0xab5c('0x3c')](_0x18309b['query']['fields']));_0x2a15a2['attributes']=_0x2a15a2[_0xab5c('0x3b')][_0xab5c('0x3d')]?_0x2a15a2[_0xab5c('0x3b')]:_0x135a03[_0xab5c('0x36')];_0x2a15a2['order']=qs['sort'](_0x18309b['query'][_0xab5c('0x41')]);_0x2a15a2[_0xab5c('0x43')]=qs[_0xab5c('0x39')](_['pick'](_0x18309b[_0xab5c('0x37')],_0x135a03[_0xab5c('0x39')]));if(_0x18309b[_0xab5c('0x37')]['filter']){_0x2a15a2[_0xab5c('0x43')]=_[_0xab5c('0x44')](_0x2a15a2[_0xab5c('0x43')],{'$or':_[_0xab5c('0x31')](_0x2a15a2[_0xab5c('0x3b')],function(_0x420033){var _0x4f6521={};_0x4f6521[_0x420033]={'$like':'%'+_0x18309b[_0xab5c('0x37')]['filter']+'%'};return _0x4f6521;})});}_0x2a15a2=_[_0xab5c('0x44')]({},_0x2a15a2,_0x18309b[_0xab5c('0x46')]);return _0x1f7a87['getAgents'](_0x2a15a2);}})[_0xab5c('0x28')](function(_0x60edb1){if(_0x60edb1){_0x23d7d5=_0x60edb1['length'];if(!_0x18309b[_0xab5c('0x37')][_0xab5c('0x3e')]('nolimit')){_0x2a15a2[_0xab5c('0x20')]=qs[_0xab5c('0x20')](_0x18309b[_0xab5c('0x37')][_0xab5c('0x20')]);_0x2a15a2[_0xab5c('0x22')]=qs[_0xab5c('0x22')](_0x18309b[_0xab5c('0x37')]['offset']);}return _0x1f7a87[_0xab5c('0x8e')](_0x2a15a2);}})[_0xab5c('0x28')](function(_0x126116){if(_0x126116){return _0x126116?{'count':_0x23d7d5,'rows':_0x126116}:null;}})[_0xab5c('0x28')](respondWithResult(_0x2e8065,null))[_0xab5c('0x49')](handleError(_0x2e8065,null));}; \ No newline at end of file +var _0xcd56=['User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','mailPause','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','localhost','redis','./mailQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','nolimit','MailQueueId'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xcd56,0x1c9));var _0x6cd5=function(_0x34f209,_0x2cba3a){_0x34f209=_0x34f209-0x0;var _0x232b53=_0xcd56[_0x34f209];return _0x232b53;};'use strict';var emlformat=require(_0x6cd5('0x0'));var rimraf=require(_0x6cd5('0x1'));var zipdir=require(_0x6cd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cd5('0x3'));var moment=require(_0x6cd5('0x4'));var BPromise=require(_0x6cd5('0x5'));var Mustache=require(_0x6cd5('0x6'));var util=require(_0x6cd5('0x7'));var path=require(_0x6cd5('0x8'));var sox=require(_0x6cd5('0x9'));var csv=require(_0x6cd5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cd5('0xb'));var _=require(_0x6cd5('0xc'));var squel=require(_0x6cd5('0xd'));var crypto=require(_0x6cd5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6cd5('0xa'));var querystring=require(_0x6cd5('0xf'));var Papa=require(_0x6cd5('0x10'));var Redis=require(_0x6cd5('0x11'));var authService=require(_0x6cd5('0x12'));var qs=require(_0x6cd5('0x13'));var as=require(_0x6cd5('0x14'));var hardwareService=require(_0x6cd5('0x15'));var logger=require(_0x6cd5('0x16'))('api');var utils=require(_0x6cd5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6cd5('0x18'));var db=require(_0x6cd5('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6cd5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cd5('0x1b')]));require(_0x6cd5('0x1c'))['register'](socket);function respondWithStatusCode(_0x120e0d,_0x6409fd){_0x6409fd=_0x6409fd||0xcc;return function(_0x5b8403){if(_0x5b8403){return _0x120e0d[_0x6cd5('0x1d')](_0x6409fd);}return _0x120e0d[_0x6cd5('0x1e')](_0x6409fd)[_0x6cd5('0x1f')]();};}function respondWithResult(_0x6e6e5b,_0x25ae85){_0x25ae85=_0x25ae85||0xc8;return function(_0x772789){if(_0x772789){return _0x6e6e5b[_0x6cd5('0x1e')](_0x25ae85)[_0x6cd5('0x20')](_0x772789);}};}function respondWithFilteredResult(_0xc2f863,_0x568733){return function(_0xb696b9){if(_0xb696b9){var _0xe42af0=typeof _0x568733[_0x6cd5('0x21')]==='undefined'&&typeof _0x568733[_0x6cd5('0x22')]===_0x6cd5('0x23');var _0x1e2309=_0xb696b9[_0x6cd5('0x24')];var _0x536b8a=_0xe42af0?0x0:_0x568733[_0x6cd5('0x21')];var _0x1065b6=_0xe42af0?_0xb696b9[_0x6cd5('0x24')]:_0x568733[_0x6cd5('0x21')]+_0x568733['limit'];var _0x37a469;if(_0x1065b6>=_0x1e2309){_0x1065b6=_0x1e2309;_0x37a469=0xc8;}else{_0x37a469=0xce;}_0xc2f863['status'](_0x37a469);return _0xc2f863[_0x6cd5('0x25')](_0x6cd5('0x26'),_0x536b8a+'-'+_0x1065b6+'/'+_0x1e2309)[_0x6cd5('0x20')](_0xb696b9);}return null;};}function patchUpdates(_0x48e8a7){return function(_0x3a06e8){try{jsonpatch['apply'](_0x3a06e8,_0x48e8a7,!![]);}catch(_0x40841e){return BPromise['reject'](_0x40841e);}return _0x3a06e8[_0x6cd5('0x27')]();};}function saveUpdates(_0x234648,_0x2feb60){return function(_0x4e502a){if(_0x4e502a){return _0x4e502a[_0x6cd5('0x28')](_0x234648)[_0x6cd5('0x29')](function(_0x50d340){return _0x50d340;});}return null;};}function removeEntity(_0x2e9494,_0x1df9d3){return function(_0x195e8d){if(_0x195e8d){return _0x195e8d['destroy']()['then'](function(){var _0x4d098f=_0x195e8d[_0x6cd5('0x2a')]({'plain':!![]});var _0x1268c6=_0x6cd5('0x2b');return db[_0x6cd5('0x2c')]['destroy']({'where':{'type':_0x1268c6,'resourceId':_0x4d098f['id']}})[_0x6cd5('0x29')](function(){return _0x195e8d;});})[_0x6cd5('0x29')](function(){_0x2e9494[_0x6cd5('0x1e')](0xcc)[_0x6cd5('0x1f')]();});}};}function handleEntityNotFound(_0x1394ce,_0x1ea81d){return function(_0x29e071){if(!_0x29e071){_0x1394ce[_0x6cd5('0x1d')](0x194);}return _0x29e071;};}function handleError(_0x4db049,_0x32cd7c){_0x32cd7c=_0x32cd7c||0x1f4;return function(_0x22b1ef){logger[_0x6cd5('0x2d')](_0x22b1ef[_0x6cd5('0x2e')]);if(_0x22b1ef[_0x6cd5('0x2f')]){delete _0x22b1ef[_0x6cd5('0x2f')];}_0x4db049['status'](_0x32cd7c)[_0x6cd5('0x30')](_0x22b1ef);};}exports[_0x6cd5('0x31')]=function(_0x4c2112,_0x536708){var _0x3899f6={},_0x983fa8={},_0x22c62e={'count':0x0,'rows':[]};var _0x141af7=_['map'](db[_0x6cd5('0x32')][_0x6cd5('0x33')],function(_0x2c5bf1){return{'name':_0x2c5bf1[_0x6cd5('0x34')],'type':_0x2c5bf1[_0x6cd5('0x35')]['key']};});_0x983fa8[_0x6cd5('0x36')]=_[_0x6cd5('0x37')](_0x141af7,_0x6cd5('0x2f'));_0x983fa8['query']=_[_0x6cd5('0x38')](_0x4c2112[_0x6cd5('0x39')]);_0x983fa8[_0x6cd5('0x3a')]=_['intersection'](_0x983fa8[_0x6cd5('0x36')],_0x983fa8[_0x6cd5('0x39')]);_0x3899f6[_0x6cd5('0x3b')]=_[_0x6cd5('0x3c')](_0x983fa8[_0x6cd5('0x36')],qs[_0x6cd5('0x3d')](_0x4c2112['query'][_0x6cd5('0x3d')]));_0x3899f6[_0x6cd5('0x3b')]=_0x3899f6[_0x6cd5('0x3b')][_0x6cd5('0x3e')]?_0x3899f6[_0x6cd5('0x3b')]:_0x983fa8[_0x6cd5('0x36')];if(!_0x4c2112['query'][_0x6cd5('0x3f')]('nolimit')){_0x3899f6['limit']=qs['limit'](_0x4c2112[_0x6cd5('0x39')]['limit']);_0x3899f6[_0x6cd5('0x21')]=qs[_0x6cd5('0x21')](_0x4c2112['query']['offset']);}_0x3899f6[_0x6cd5('0x40')]=qs[_0x6cd5('0x41')](_0x4c2112[_0x6cd5('0x39')][_0x6cd5('0x41')]);_0x3899f6[_0x6cd5('0x42')]=qs[_0x6cd5('0x3a')](_[_0x6cd5('0x43')](_0x4c2112['query'],_0x983fa8[_0x6cd5('0x3a')]),_0x141af7);if(_0x4c2112[_0x6cd5('0x39')][_0x6cd5('0x44')]){_0x3899f6[_0x6cd5('0x42')]=_[_0x6cd5('0x45')](_0x3899f6[_0x6cd5('0x42')],{'$or':_[_0x6cd5('0x37')](_0x141af7,function(_0x5d50e0){if(_0x5d50e0['type']!==_0x6cd5('0x46')){var _0x5b78f1={};_0x5b78f1[_0x5d50e0['name']]={'$like':'%'+_0x4c2112[_0x6cd5('0x39')]['filter']+'%'};return _0x5b78f1;}})});}_0x3899f6=_[_0x6cd5('0x45')]({},_0x3899f6,_0x4c2112[_0x6cd5('0x47')]);var _0x1e039a={'where':_0x3899f6[_0x6cd5('0x42')]};return db[_0x6cd5('0x32')][_0x6cd5('0x24')](_0x1e039a)['then'](function(_0x44dde2){_0x22c62e[_0x6cd5('0x24')]=_0x44dde2;if(_0x4c2112['query'][_0x6cd5('0x48')]){_0x3899f6[_0x6cd5('0x49')]=[{'all':!![]}];}return db[_0x6cd5('0x32')][_0x6cd5('0x4a')](_0x3899f6);})[_0x6cd5('0x29')](function(_0x313890){_0x22c62e[_0x6cd5('0x4b')]=_0x313890;return _0x22c62e;})[_0x6cd5('0x29')](respondWithFilteredResult(_0x536708,_0x3899f6))[_0x6cd5('0x4c')](handleError(_0x536708,null));};exports['show']=function(_0x2b033e,_0x59a038){var _0x1e4b34={'raw':!![],'where':{'id':_0x2b033e[_0x6cd5('0x4d')]['id']}},_0x1d96e3={};_0x1d96e3[_0x6cd5('0x36')]=_['keys'](db[_0x6cd5('0x32')]['rawAttributes']);_0x1d96e3[_0x6cd5('0x39')]=_['keys'](_0x2b033e[_0x6cd5('0x39')]);_0x1d96e3['filters']=_[_0x6cd5('0x3c')](_0x1d96e3[_0x6cd5('0x36')],_0x1d96e3[_0x6cd5('0x39')]);_0x1e4b34[_0x6cd5('0x3b')]=_[_0x6cd5('0x3c')](_0x1d96e3[_0x6cd5('0x36')],qs[_0x6cd5('0x3d')](_0x2b033e[_0x6cd5('0x39')]['fields']));_0x1e4b34[_0x6cd5('0x3b')]=_0x1e4b34[_0x6cd5('0x3b')][_0x6cd5('0x3e')]?_0x1e4b34[_0x6cd5('0x3b')]:_0x1d96e3[_0x6cd5('0x36')];if(_0x2b033e['query'][_0x6cd5('0x48')]){_0x1e4b34[_0x6cd5('0x49')]=[{'all':!![]}];}_0x1e4b34=_[_0x6cd5('0x45')]({},_0x1e4b34,_0x2b033e[_0x6cd5('0x47')]);return db[_0x6cd5('0x32')][_0x6cd5('0x4e')](_0x1e4b34)[_0x6cd5('0x29')](handleEntityNotFound(_0x59a038,null))['then'](respondWithResult(_0x59a038,null))[_0x6cd5('0x4c')](handleError(_0x59a038,null));};exports['create']=function(_0x1aced5,_0x44167c){return db[_0x6cd5('0x32')][_0x6cd5('0x4f')](_0x1aced5[_0x6cd5('0x50')],{})[_0x6cd5('0x29')](function(_0x37308e){var _0x320654=_0x1aced5[_0x6cd5('0x51')][_0x6cd5('0x2a')]({'plain':!![]});if(!_0x320654)throw new Error(_0x6cd5('0x52'));if(_0x320654[_0x6cd5('0x53')]===_0x6cd5('0x51')){var _0x137253=_0x37308e[_0x6cd5('0x2a')]({'plain':!![]});var _0x1cf1b1=_0x6cd5('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x1cf1b1,'userProfileId':_0x320654['userProfileId']},'raw':!![]})['then'](function(_0xa44dc4){if(_0xa44dc4&&_0xa44dc4[_0x6cd5('0x54')]===0x0){return db['UserProfileResource'][_0x6cd5('0x4f')]({'name':_0x137253[_0x6cd5('0x2f')],'resourceId':_0x137253['id'],'type':_0xa44dc4[_0x6cd5('0x2f')],'sectionId':_0xa44dc4['id']},{})[_0x6cd5('0x29')](function(){return _0x37308e;});}else{return _0x37308e;}})[_0x6cd5('0x4c')](function(_0x44a160){logger[_0x6cd5('0x2d')](_0x6cd5('0x55'),_0x44a160);throw _0x44a160;});}return _0x37308e;})[_0x6cd5('0x29')](respondWithResult(_0x44167c,0xc9))[_0x6cd5('0x4c')](handleError(_0x44167c,null));};exports[_0x6cd5('0x28')]=function(_0x45ffdf,_0x4b66d9){if(_0x45ffdf[_0x6cd5('0x50')]['id']){delete _0x45ffdf[_0x6cd5('0x50')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x45ffdf[_0x6cd5('0x4d')]['id']}})[_0x6cd5('0x29')](handleEntityNotFound(_0x4b66d9,null))[_0x6cd5('0x29')](saveUpdates(_0x45ffdf[_0x6cd5('0x50')],null))['then'](respondWithResult(_0x4b66d9,null))[_0x6cd5('0x4c')](handleError(_0x4b66d9,null));};exports['destroy']=function(_0x4392ab,_0x2ace7a){return db[_0x6cd5('0x32')][_0x6cd5('0x4e')]({'where':{'id':_0x4392ab['params']['id']}})[_0x6cd5('0x29')](handleEntityNotFound(_0x2ace7a,null))[_0x6cd5('0x29')](removeEntity(_0x2ace7a,null))[_0x6cd5('0x4c')](handleError(_0x2ace7a,null));};exports[_0x6cd5('0x56')]=function(_0x30942a,_0x5658b2){return db['MailQueue'][_0x6cd5('0x56')]()['then'](respondWithResult(_0x5658b2,null))[_0x6cd5('0x4c')](handleError(_0x5658b2,null));};exports['getMembers']=function(_0x3d50ba,_0xe53d5c,_0x511c02){var _0x334b3c={'raw':!![],'where':{}},_0x125356={},_0xa4b5f2;return db[_0x6cd5('0x32')][_0x6cd5('0x57')]({'where':{'id':_0x3d50ba['params']['id']}})[_0x6cd5('0x29')](handleEntityNotFound(_0xe53d5c,null))[_0x6cd5('0x29')](function(_0x164ccd){if(_0x164ccd){_0xa4b5f2=_0x164ccd[_0x6cd5('0x2a')]({'plain':!![]});_0x125356['model']=_['keys'](db[_0x6cd5('0x58')]['rawAttributes']);_0x125356['query']=_[_0x6cd5('0x38')](_0x3d50ba['query']);_0x125356[_0x6cd5('0x3a')]=_[_0x6cd5('0x3c')](_0x125356['model'],_0x125356['query']);_0x334b3c['attributes']=_[_0x6cd5('0x3c')](_0x125356['model'],qs['fields'](_0x3d50ba['query'][_0x6cd5('0x3d')]));_0x334b3c[_0x6cd5('0x3b')]=_0x334b3c[_0x6cd5('0x3b')][_0x6cd5('0x3e')]?_0x334b3c[_0x6cd5('0x3b')]:_0x125356[_0x6cd5('0x36')];if(!_0x3d50ba['query'][_0x6cd5('0x3f')](_0x6cd5('0x59'))){_0x334b3c['limit']=qs[_0x6cd5('0x22')](_0x3d50ba['query'][_0x6cd5('0x22')]);_0x334b3c[_0x6cd5('0x21')]=qs['offset'](_0x3d50ba[_0x6cd5('0x39')][_0x6cd5('0x21')]);}_0x334b3c[_0x6cd5('0x40')]=qs['sort'](_0x3d50ba['query'][_0x6cd5('0x41')]);_0x334b3c['where']=qs['filters'](_[_0x6cd5('0x43')](_0x3d50ba[_0x6cd5('0x39')],_0x125356[_0x6cd5('0x3a')]));_0x334b3c[_0x6cd5('0x42')][_0x6cd5('0x5a')]=_0x164ccd['id'];if(_0x3d50ba['query'][_0x6cd5('0x44')]){_0x334b3c[_0x6cd5('0x42')]=_[_0x6cd5('0x45')](_0x334b3c[_0x6cd5('0x42')],{'$or':_[_0x6cd5('0x37')](_0x334b3c[_0x6cd5('0x3b')],function(_0x3d0d81){var _0x5d76d8={};_0x5d76d8[_0x3d0d81]={'$like':'%'+_0x3d50ba[_0x6cd5('0x39')][_0x6cd5('0x44')]+'%'};return _0x5d76d8;})});}_0x334b3c=_[_0x6cd5('0x45')]({},_0x334b3c,_0x3d50ba[_0x6cd5('0x47')]);return db[_0x6cd5('0x58')][_0x6cd5('0x4a')](_0x334b3c);}})[_0x6cd5('0x29')](function(_0x2f4393){if(_0x2f4393){return db[_0x6cd5('0x5b')][_0x6cd5('0x5c')]({'where':{'id':_[_0x6cd5('0x37')](_0x2f4393,_0x6cd5('0x5d')),'role':_0x6cd5('0x5e')},'attributes':['id',_0x6cd5('0x2f'),'mailPause',_0x6cd5('0x5f'),_0x6cd5('0x60')]});}})['then'](function(_0x71ed2){if(_0x71ed2){return{'count':_0x71ed2[_0x6cd5('0x24')],'rows':_['map'](_0x71ed2[_0x6cd5('0x4b')],function(_0x43b86d){return{'membername':_0x43b86d[_0x6cd5('0x2f')],'UserId':_0x43b86d['id'],'queue_name':_0xa4b5f2[_0x6cd5('0x2f')],'MailQueueId':_0xa4b5f2['id'],'interface':util[_0x6cd5('0x61')]('%s/%s','SIP',_0x43b86d[_0x6cd5('0x2f')]),'penalty':0x0,'paused':_0x43b86d[_0x6cd5('0x62')],'createdAt':_0x43b86d[_0x6cd5('0x60')],'updatedAt':_0x43b86d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6cd5('0x29')](respondWithFilteredResult(_0xe53d5c,_0x334b3c))['catch'](handleError(_0xe53d5c,null));};exports['getTeams']=function(_0x3f1516,_0x572325,_0x260751){var _0x4de5a7={};var _0x48eef3={};var _0x52e44a;var _0x52a49c;return db[_0x6cd5('0x32')][_0x6cd5('0x57')]({'where':{'id':_0x3f1516[_0x6cd5('0x4d')]['id']}})[_0x6cd5('0x29')](handleEntityNotFound(_0x572325,null))[_0x6cd5('0x29')](function(_0x5b434d){if(_0x5b434d){_0x52e44a=_0x5b434d;_0x48eef3[_0x6cd5('0x36')]=_[_0x6cd5('0x38')](db[_0x6cd5('0x63')][_0x6cd5('0x33')]);_0x48eef3[_0x6cd5('0x39')]=_[_0x6cd5('0x38')](_0x3f1516[_0x6cd5('0x39')]);_0x48eef3['filters']=_['intersection'](_0x48eef3[_0x6cd5('0x36')],_0x48eef3[_0x6cd5('0x39')]);_0x4de5a7[_0x6cd5('0x3b')]=_['intersection'](_0x48eef3['model'],qs[_0x6cd5('0x3d')](_0x3f1516[_0x6cd5('0x39')][_0x6cd5('0x3d')]));_0x4de5a7[_0x6cd5('0x3b')]=_0x4de5a7['attributes'][_0x6cd5('0x3e')]?_0x4de5a7[_0x6cd5('0x3b')]:_0x48eef3[_0x6cd5('0x36')];_0x4de5a7[_0x6cd5('0x40')]=qs[_0x6cd5('0x41')](_0x3f1516[_0x6cd5('0x39')][_0x6cd5('0x41')]);_0x4de5a7[_0x6cd5('0x42')]=qs[_0x6cd5('0x3a')](_[_0x6cd5('0x43')](_0x3f1516[_0x6cd5('0x39')],_0x48eef3['filters']));if(_0x3f1516['query'][_0x6cd5('0x44')]){_0x4de5a7['where']=_[_0x6cd5('0x45')](_0x4de5a7['where'],{'$or':_['map'](_0x4de5a7['attributes'],function(_0x5a9633){var _0x3c5a4b={};_0x3c5a4b[_0x5a9633]={'$like':'%'+_0x3f1516[_0x6cd5('0x39')]['filter']+'%'};return _0x3c5a4b;})});}_0x4de5a7=_['merge']({},_0x4de5a7,_0x3f1516[_0x6cd5('0x47')]);return _0x52e44a[_0x6cd5('0x64')](_0x4de5a7);}})[_0x6cd5('0x29')](function(_0x287886){if(_0x287886){_0x52a49c=_0x287886[_0x6cd5('0x3e')];if(!_0x3f1516[_0x6cd5('0x39')][_0x6cd5('0x3f')]('nolimit')){_0x4de5a7['limit']=qs[_0x6cd5('0x22')](_0x3f1516[_0x6cd5('0x39')][_0x6cd5('0x22')]);_0x4de5a7[_0x6cd5('0x21')]=qs['offset'](_0x3f1516[_0x6cd5('0x39')][_0x6cd5('0x21')]);}return _0x52e44a[_0x6cd5('0x64')](_0x4de5a7);}})[_0x6cd5('0x29')](function(_0x3675bb){if(_0x3675bb){return _0x3675bb?{'count':_0x52a49c,'rows':_0x3675bb}:null;}})[_0x6cd5('0x29')](respondWithResult(_0x572325,null))['catch'](handleError(_0x572325,null));};exports[_0x6cd5('0x65')]=function(_0x116339,_0x595015,_0x1125df){var _0x4d0674=_0x116339[_0x6cd5('0x50')][_0x6cd5('0x66')];return db['Team'][_0x6cd5('0x4a')]({'where':{'id':_0x4d0674},'attributes':['id'],'include':[{'model':db[_0x6cd5('0x5b')],'as':_0x6cd5('0x67'),'attributes':['id',_0x6cd5('0x2f'),_0x6cd5('0x68'),'voicePause',_0x6cd5('0x69')],'raw':!![]}]})[_0x6cd5('0x29')](function(_0x179a9e){if(_0x179a9e){var _0xb78572=_[_0x6cd5('0x6a')](_0x179a9e,function(_0x1944d6){var _0x4fe769=_0x1944d6[_0x6cd5('0x2a')]({'plain':!![]});return _0x4fe769[_0x6cd5('0x67')];});return db[_0x6cd5('0x32')][_0x6cd5('0x4e')]({'where':{'id':_0x116339[_0x6cd5('0x4d')]['id']}})[_0x6cd5('0x29')](function(_0x52f7d8){return db[_0x6cd5('0x6b')][_0x6cd5('0x6c')](function(_0x4ef84d){return _0x52f7d8[_0x6cd5('0x65')](_0x4d0674,{'transaction':_0x4ef84d})[_0x6cd5('0x29')](function(){return BPromise[_0x6cd5('0x6d')](_0xb78572,function(_0x34e0b3){return db[_0x6cd5('0x58')][_0x6cd5('0x6e')]({'where':{'UserId':_0x34e0b3['id'],'MailQueueId':_0x116339[_0x6cd5('0x4d')]['id']},'transaction':_0x4ef84d});});})[_0x6cd5('0x29')](function(){_0xb78572[_0x6cd5('0x6f')](function(_0x546f42){socket['emit'](_0x6cd5('0x70'),{'UserId':_0x546f42['id'],'MailQueueId':_0x52f7d8['id']});});});});});}})[_0x6cd5('0x29')](respondWithStatusCode(_0x595015,null))[_0x6cd5('0x4c')](handleError(_0x595015,null));};exports[_0x6cd5('0x71')]=function(_0x3fbb06,_0x221edd,_0x2c58c1){return db[_0x6cd5('0x63')][_0x6cd5('0x4a')]({'where':{'id':_0x3fbb06[_0x6cd5('0x39')][_0x6cd5('0x66')]},'attributes':['id'],'include':[{'model':db[_0x6cd5('0x5b')],'as':_0x6cd5('0x67'),'attributes':['id'],'raw':!![]}]})[_0x6cd5('0x29')](handleEntityNotFound(_0x221edd,null))['then'](function(_0x4b8b8e){var _0x554c88=_['map'](_0x4b8b8e,'id');var _0x9ec26a=[];var _0x286ccf=[];var _0x4ac209=squel['select']();_0x4ac209['field']('tq.TeamId')[_0x6cd5('0x72')](_0x6cd5('0x73'),'tq')[_0x6cd5('0x74')](_0x6cd5('0x75'),'ut',_0x6cd5('0x76'))[_0x6cd5('0x42')]('MailQueueId\x20=\x20?',_0x3fbb06[_0x6cd5('0x4d')]['id']);for(var _0x1077af=0x0;_0x1077af<_0x4b8b8e[_0x6cd5('0x3e')];_0x1077af+=0x1){let _0x12ef88=_0x4b8b8e[_0x1077af];for(var _0x441132=0x0;_0x441132<_0x12ef88[_0x6cd5('0x67')][_0x6cd5('0x3e')];_0x441132+=0x1){let _0x10336a=_0x12ef88[_0x6cd5('0x67')][_0x441132];var _0x30c02f=_0x4ac209[_0x6cd5('0x77')]();_0x30c02f[_0x6cd5('0x42')]('ut.UserId\x20=\x20?',_0x10336a['id']);_0x286ccf[_0x6cd5('0x78')](db[_0x6cd5('0x6b')][_0x6cd5('0x39')](_0x30c02f[_0x6cd5('0x79')](),{'type':db[_0x6cd5('0x6b')][_0x6cd5('0x7a')]['SELECT']})['then'](function(_0x391308){if(_0x391308[_0x6cd5('0x3e')]===0x1){return _0x10336a['id'];}else{var _0x5949b1=_[_0x6cd5('0x7b')](_[_0x6cd5('0x37')](_0x391308,_0x6cd5('0x7c')),function(_0x35deef){return _[_0x6cd5('0x7d')](_0x554c88,_0x35deef);});if(_0x5949b1){return _0x10336a['id'];}}}));}}return BPromise[_0x6cd5('0x7e')](_0x286ccf)[_0x6cd5('0x29')](function(_0x1f79f7){_0x9ec26a=_(_0x9ec26a)['union'](_0x1f79f7)[_0x6cd5('0x7f')]()[_0x6cd5('0x80')]();return db[_0x6cd5('0x32')][_0x6cd5('0x4e')]({'where':{'id':_0x3fbb06['params']['id']}})[_0x6cd5('0x29')](function(_0x497ae4){return db[_0x6cd5('0x6b')][_0x6cd5('0x6c')](function(_0x2339de){return _0x497ae4[_0x6cd5('0x71')](_0x3fbb06[_0x6cd5('0x39')][_0x6cd5('0x66')],{'transaction':_0x2339de})[_0x6cd5('0x29')](function(){if(!_['isEmpty'](_0x9ec26a)){return _0x497ae4[_0x6cd5('0x81')](_0x9ec26a,{'transaction':_0x2339de});}})[_0x6cd5('0x29')](function(){_0x9ec26a[_0x6cd5('0x6f')](function(_0x1ebd0c){socket[_0x6cd5('0x82')](_0x6cd5('0x83'),{'UserId':_0x1ebd0c,'MailQueueId':_0x497ae4['id']});});});});});});})[_0x6cd5('0x29')](respondWithStatusCode(_0x221edd,null))[_0x6cd5('0x4c')](handleError(_0x221edd,null));};exports[_0x6cd5('0x84')]=function(_0x5be21e,_0x1f304b,_0x5c918a){return db[_0x6cd5('0x32')][_0x6cd5('0x4e')]({'where':{'id':_0x5be21e[_0x6cd5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f304b,null))[_0x6cd5('0x29')](function(_0x190ffa){if(_0x190ffa){return _0x190ffa[_0x6cd5('0x84')](_0x5be21e[_0x6cd5('0x50')][_0x6cd5('0x66')],_[_0x6cd5('0x85')](_0x5be21e[_0x6cd5('0x50')],['ids','id'])||{})[_0x6cd5('0x86')](function(_0x114e7b){for(var _0x4c4a1c=0x0;_0x4c4a1c<_0x5be21e[_0x6cd5('0x50')][_0x6cd5('0x66')][_0x6cd5('0x3e')];_0x4c4a1c+=0x1){socket['emit'](_0x6cd5('0x70'),{'UserId':Number(_0x5be21e[_0x6cd5('0x50')][_0x6cd5('0x66')][_0x4c4a1c]),'MailQueueId':Number(_0x5be21e['params']['id'])});}return _0x114e7b;});}})[_0x6cd5('0x29')](respondWithResult(_0x1f304b,null))[_0x6cd5('0x4c')](handleError(_0x1f304b,null));};exports[_0x6cd5('0x81')]=function(_0x421263,_0x2a92d5,_0x372138){return db[_0x6cd5('0x32')][_0x6cd5('0x4e')]({'where':{'id':_0x421263[_0x6cd5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2a92d5,null))[_0x6cd5('0x29')](function(_0x205e00){if(_0x205e00){return _0x205e00[_0x6cd5('0x81')](_0x421263['query'][_0x6cd5('0x66')])[_0x6cd5('0x29')](function(){if(_[_0x6cd5('0x87')](_0x421263[_0x6cd5('0x39')][_0x6cd5('0x66')])){for(var _0x27dcf7=0x0;_0x27dcf7<_0x421263[_0x6cd5('0x39')][_0x6cd5('0x66')][_0x6cd5('0x3e')];_0x27dcf7+=0x1){socket[_0x6cd5('0x82')](_0x6cd5('0x83'),{'UserId':Number(_0x421263[_0x6cd5('0x39')][_0x6cd5('0x66')][_0x27dcf7]),'MailQueueId':Number(_0x421263['params']['id'])});}}else{socket[_0x6cd5('0x82')](_0x6cd5('0x83'),{'UserId':Number(_0x421263[_0x6cd5('0x39')][_0x6cd5('0x66')]),'MailQueueId':Number(_0x421263[_0x6cd5('0x4d')]['id'])});}});}})[_0x6cd5('0x29')](respondWithStatusCode(_0x2a92d5,null))[_0x6cd5('0x4c')](handleError(_0x2a92d5,null));};exports[_0x6cd5('0x88')]=function(_0x3469e8,_0x5edc20,_0x37d57f){var _0x56392b={};var _0x53b78d={};var _0x116268;var _0x4bcb7a;return db[_0x6cd5('0x32')][_0x6cd5('0x57')]({'where':{'id':_0x3469e8[_0x6cd5('0x4d')]['id']}})[_0x6cd5('0x29')](handleEntityNotFound(_0x5edc20,null))[_0x6cd5('0x29')](function(_0x3269f8){if(_0x3269f8){_0x116268=_0x3269f8;_0x53b78d[_0x6cd5('0x36')]=_['keys'](db[_0x6cd5('0x5b')][_0x6cd5('0x33')]);_0x53b78d['query']=_[_0x6cd5('0x38')](_0x3469e8['query']);_0x53b78d[_0x6cd5('0x3a')]=_[_0x6cd5('0x3c')](_0x53b78d['model'],_0x53b78d['query']);_0x56392b['attributes']=_[_0x6cd5('0x3c')](_0x53b78d[_0x6cd5('0x36')],qs[_0x6cd5('0x3d')](_0x3469e8[_0x6cd5('0x39')]['fields']));_0x56392b[_0x6cd5('0x3b')]=_0x56392b[_0x6cd5('0x3b')][_0x6cd5('0x3e')]?_0x56392b[_0x6cd5('0x3b')]:_0x53b78d['model'];_0x56392b['order']=qs['sort'](_0x3469e8['query'][_0x6cd5('0x41')]);_0x56392b[_0x6cd5('0x42')]=qs['filters'](_['pick'](_0x3469e8['query'],_0x53b78d[_0x6cd5('0x3a')]));if(_0x3469e8[_0x6cd5('0x39')]['filter']){_0x56392b[_0x6cd5('0x42')]=_[_0x6cd5('0x45')](_0x56392b[_0x6cd5('0x42')],{'$or':_[_0x6cd5('0x37')](_0x56392b[_0x6cd5('0x3b')],function(_0x32889e){var _0x2cfcc8={};_0x2cfcc8[_0x32889e]={'$like':'%'+_0x3469e8['query']['filter']+'%'};return _0x2cfcc8;})});}_0x56392b=_[_0x6cd5('0x45')]({},_0x56392b,_0x3469e8[_0x6cd5('0x47')]);return _0x116268[_0x6cd5('0x88')](_0x56392b);}})[_0x6cd5('0x29')](function(_0x17a8cc){if(_0x17a8cc){_0x4bcb7a=_0x17a8cc['length'];if(!_0x3469e8[_0x6cd5('0x39')][_0x6cd5('0x3f')](_0x6cd5('0x59'))){_0x56392b[_0x6cd5('0x22')]=qs['limit'](_0x3469e8[_0x6cd5('0x39')][_0x6cd5('0x22')]);_0x56392b[_0x6cd5('0x21')]=qs[_0x6cd5('0x21')](_0x3469e8['query'][_0x6cd5('0x21')]);}return _0x116268['getAgents'](_0x56392b);}})['then'](function(_0x1f547b){if(_0x1f547b){return _0x1f547b?{'count':_0x4bcb7a,'rows':_0x1f547b}:null;}})[_0x6cd5('0x29')](respondWithResult(_0x5edc20,null))[_0x6cd5('0x4c')](handleError(_0x5edc20,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index af60b5e..59bb953 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 _0xbc0b=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x34190e,_0x50ecc7){var _0x41a4e6=function(_0x4a9ad9){while(--_0x4a9ad9){_0x34190e['push'](_0x34190e['shift']());}};_0x41a4e6(++_0x50ecc7);}(_0xbc0b,0x9c));var _0xbbc0=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xbc0b[_0x35da42];return _0x370035;};'use strict';var EventEmitter=require(_0xbbc0('0x0'));var MailQueue=require(_0xbbc0('0x1'))['db'][_0xbbc0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbbc0('0x3')](0x0);var events={'afterCreate':_0xbbc0('0x4'),'afterUpdate':_0xbbc0('0x5'),'afterDestroy':_0xbbc0('0x6')};function emitEvent(_0x654e63){return function(_0x56bca3,_0x4e7517,_0x38d590){MailQueueEvents[_0xbbc0('0x7')](_0x654e63+':'+_0x56bca3['id'],_0x56bca3);MailQueueEvents[_0xbbc0('0x7')](_0x654e63,_0x56bca3);_0x38d590(null);};}for(var e in events){if(events[_0xbbc0('0x8')](e)){var event=events[e];MailQueue[_0xbbc0('0x9')](e,emitEvent(event));}}module[_0xbbc0('0xa')]=MailQueueEvents; \ No newline at end of file +var _0x4068=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x3080ea,_0x44309e){var _0xc1abcc=function(_0x360890){while(--_0x360890){_0x3080ea['push'](_0x3080ea['shift']());}};_0xc1abcc(++_0x44309e);}(_0x4068,0x1a3));var _0x8406=function(_0x5783ed,_0x2b4638){_0x5783ed=_0x5783ed-0x0;var _0x531630=_0x4068[_0x5783ed];return _0x531630;};'use strict';var EventEmitter=require(_0x8406('0x0'));var MailQueue=require(_0x8406('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8406('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8406('0x3'),'afterDestroy':_0x8406('0x4')};function emitEvent(_0x5b03c7){return function(_0x39925e,_0x4fd494,_0x23351f){MailQueueEvents[_0x8406('0x5')](_0x5b03c7+':'+_0x39925e['id'],_0x39925e);MailQueueEvents[_0x8406('0x5')](_0x5b03c7,_0x39925e);_0x23351f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x8406('0x6')](e,emitEvent(event));}}module[_0x8406('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d830531..2ad8b32 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 _0xebb9=['request-promise','path','../../config/environment','define','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird'];(function(_0x5f2c85,_0x2f84e6){var _0x906b37=function(_0x168026){while(--_0x168026){_0x5f2c85['push'](_0x5f2c85['shift']());}};_0x906b37(++_0x2f84e6);}(_0xebb9,0xc4));var _0x9ebb=function(_0x44d693,_0x358df9){_0x44d693=_0x44d693-0x0;var _0x51e5df=_0xebb9[_0x44d693];return _0x51e5df;};'use strict';var _=require(_0x9ebb('0x0'));var util=require('util');var logger=require(_0x9ebb('0x1'))(_0x9ebb('0x2'));var moment=require('moment');var BPromise=require(_0x9ebb('0x3'));var rp=require(_0x9ebb('0x4'));var fs=require('fs');var path=require(_0x9ebb('0x5'));var rimraf=require('rimraf');var config=require(_0x9ebb('0x6'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x12474a,_0x4ca1d6){return _0x12474a[_0x9ebb('0x7')](_0x9ebb('0x8'),attributes,{'tableName':_0x9ebb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf574=['./mailQueue.attributes','exports','MailQueue','mail_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x20786a,_0x4698e2){var _0x380d1a=function(_0x3033d7){while(--_0x3033d7){_0x20786a['push'](_0x20786a['shift']());}};_0x380d1a(++_0x4698e2);}(_0xf574,0x1f3));var _0x4f57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf574[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f57('0x0'))(_0x4f57('0x1'));var moment=require(_0x4f57('0x2'));var BPromise=require(_0x4f57('0x3'));var rp=require(_0x4f57('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f57('0x5'));var config=require(_0x4f57('0x6'));var attributes=require(_0x4f57('0x7'));module[_0x4f57('0x8')]=function(_0x1db40d,_0x38cc3c){return _0x1db40d['define'](_0x4f57('0x9'),attributes,{'tableName':_0x4f57('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 67a65fc..9727d1b 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 _0xd332=['limit','include','map','model','then','GetMailQueue','ShowMailQueue','find','raw','where','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','findAll','options','attributes'];(function(_0x23b87c,_0x3132ac){var _0x3d15d6=function(_0x335323){while(--_0x335323){_0x23b87c['push'](_0x23b87c['shift']());}};_0x3d15d6(++_0x3132ac);}(_0xd332,0xaf));var _0x2d33=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xd332[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x2d33('0x0'));var moment=require(_0x2d33('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d33('0x2'));var fs=require('fs');var Redis=require(_0x2d33('0x3'));var db=require(_0x2d33('0x4'))['db'];var utils=require(_0x2d33('0x5'));var logger=require(_0x2d33('0x6'))(_0x2d33('0x7'));var config=require(_0x2d33('0x8'));var jayson=require(_0x2d33('0x9'));var client=jayson[_0x2d33('0xa')][_0x2d33('0xb')]({'port':0x232a});config[_0x2d33('0xc')]=_['defaults'](config[_0x2d33('0xc')],{'host':_0x2d33('0xd'),'port':0x18eb});var socket=require(_0x2d33('0xe'))(new Redis(config[_0x2d33('0xc')]));require(_0x2d33('0xf'))[_0x2d33('0x10')](socket);function respondWithRpcPromise(_0xcde150,_0x3cca96,_0x1c6859){return new BPromise(function(_0x4198df,_0x31d1e3){return client[_0x2d33('0x11')](_0xcde150,_0x1c6859)['then'](function(_0x30f854){logger[_0x2d33('0x12')](_0x2d33('0x13'),_0x3cca96,_0x2d33('0x14'));logger[_0x2d33('0x15')](_0x2d33('0x16'),_0x3cca96,_0x2d33('0x14'),JSON[_0x2d33('0x17')](_0x30f854));if(_0x30f854['error']){if(_0x30f854[_0x2d33('0x18')]['code']===0x1f4){logger['error'](_0x2d33('0x13'),_0x3cca96,_0x30f854['error']['message']);return _0x31d1e3(_0x30f854[_0x2d33('0x18')][_0x2d33('0x19')]);}logger['error'](_0x2d33('0x13'),_0x3cca96,_0x30f854['error'][_0x2d33('0x19')]);return _0x4198df(_0x30f854[_0x2d33('0x18')][_0x2d33('0x19')]);}else{logger['info'](_0x2d33('0x13'),_0x3cca96,_0x2d33('0x14'));_0x4198df(_0x30f854[_0x2d33('0x1a')][_0x2d33('0x19')]);}})['catch'](function(_0x24e5b8){logger['error'](_0x2d33('0x13'),_0x3cca96,_0x24e5b8);_0x31d1e3(_0x24e5b8);});});}exports['GetMailQueue']=function(_0x97ec16){var _0x4c9fdf=this;return new Promise(function(_0x2681af,_0x151347){return db['MailQueue'][_0x2d33('0x1b')]({'raw':_0x97ec16[_0x2d33('0x1c')]?_0x97ec16[_0x2d33('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x97ec16[_0x2d33('0x1c')]?_0x97ec16[_0x2d33('0x1c')]['where']||null:null,'attributes':_0x97ec16['options']?_0x97ec16['options'][_0x2d33('0x1d')]||null:null,'limit':_0x97ec16['options']?_0x97ec16['options'][_0x2d33('0x1e')]||null:null,'include':_0x97ec16[_0x2d33('0x1c')]?_0x97ec16[_0x2d33('0x1c')][_0x2d33('0x1f')]?_[_0x2d33('0x20')](_0x97ec16['options']['include'],function(_0x38c6bf){return{'model':db[_0x38c6bf['model']],'as':_0x38c6bf['as'],'attributes':_0x38c6bf['attributes'],'include':_0x38c6bf[_0x2d33('0x1f')]?_[_0x2d33('0x20')](_0x38c6bf[_0x2d33('0x1f')],function(_0x232341){return{'model':db[_0x232341[_0x2d33('0x21')]],'as':_0x232341['as'],'attributes':_0x232341['attributes'],'include':_0x232341[_0x2d33('0x1f')]?_['map'](_0x232341[_0x2d33('0x1f')],function(_0x56d20e){return{'model':db[_0x56d20e['model']],'as':_0x56d20e['as'],'attributes':_0x56d20e[_0x2d33('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2d33('0x22')](function(_0x7a2e35){logger[_0x2d33('0x12')]('GetMailQueue',_0x97ec16);logger['debug'](_0x2d33('0x23'),_0x97ec16,JSON['stringify'](_0x7a2e35));_0x2681af(_0x7a2e35);})['catch'](function(_0x27dc50){logger[_0x2d33('0x18')](_0x2d33('0x23'),_0x27dc50[_0x2d33('0x19')],_0x97ec16);_0x151347(_0x4c9fdf[_0x2d33('0x18')](0x1f4,_0x27dc50['message']));});});};exports[_0x2d33('0x24')]=function(_0x576c2d){var _0x4cfb12=this;return new Promise(function(_0xdbac7d,_0x2f4279){return db['MailQueue'][_0x2d33('0x25')]({'raw':_0x576c2d['options']?_0x576c2d[_0x2d33('0x1c')][_0x2d33('0x26')]===undefined?!![]:![]:!![],'where':_0x576c2d[_0x2d33('0x1c')]?_0x576c2d[_0x2d33('0x1c')][_0x2d33('0x27')]||null:null,'attributes':_0x576c2d[_0x2d33('0x1c')]?_0x576c2d[_0x2d33('0x1c')][_0x2d33('0x1d')]||null:null,'include':_0x576c2d[_0x2d33('0x1c')]?_0x576c2d[_0x2d33('0x1c')][_0x2d33('0x1f')]?_[_0x2d33('0x20')](_0x576c2d['options'][_0x2d33('0x1f')],function(_0x47ea26){return{'model':db[_0x47ea26['model']],'as':_0x47ea26['as'],'attributes':_0x47ea26[_0x2d33('0x1d')],'include':_0x47ea26['include']?_[_0x2d33('0x20')](_0x47ea26[_0x2d33('0x1f')],function(_0xdd4dc5){return{'model':db[_0xdd4dc5[_0x2d33('0x21')]],'as':_0xdd4dc5['as'],'attributes':_0xdd4dc5[_0x2d33('0x1d')],'include':_0xdd4dc5[_0x2d33('0x1f')]?_[_0x2d33('0x20')](_0xdd4dc5[_0x2d33('0x1f')],function(_0x27c098){return{'model':db[_0x27c098[_0x2d33('0x21')]],'as':_0x27c098['as'],'attributes':_0x27c098[_0x2d33('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2d33('0x22')](function(_0x627c86){logger['info'](_0x2d33('0x24'),_0x576c2d);logger[_0x2d33('0x15')](_0x2d33('0x24'),_0x576c2d,JSON[_0x2d33('0x17')](_0x627c86));_0xdbac7d(_0x627c86);})[_0x2d33('0x28')](function(_0x546480){logger['error'](_0x2d33('0x24'),_0x546480[_0x2d33('0x19')],_0x576c2d);_0x2f4279(_0x4cfb12[_0x2d33('0x18')](0x1f4,_0x546480[_0x2d33('0x19')]));});});}; \ No newline at end of file +var _0x08e5=['request\x20sent','stringify','error','code','message','catch','GetMailQueue','MailQueue','options','raw','where','map','attributes','include','model','info','ShowMailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2439e8,_0x1895c1){var _0x223598=function(_0x3e2830){while(--_0x3e2830){_0x2439e8['push'](_0x2439e8['shift']());}};_0x223598(++_0x1895c1);}(_0x08e5,0x1a9));var _0x508e=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x08e5[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x508e('0x0'));var util=require(_0x508e('0x1'));var moment=require('moment');var BPromise=require(_0x508e('0x2'));var rs=require(_0x508e('0x3'));var fs=require('fs');var Redis=require(_0x508e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x508e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x508e('0x6'));var client=jayson[_0x508e('0x7')]['http']({'port':0x232a});config[_0x508e('0x8')]=_[_0x508e('0x9')](config[_0x508e('0x8')],{'host':_0x508e('0xa'),'port':0x18eb});var socket=require(_0x508e('0xb'))(new Redis(config[_0x508e('0x8')]));require(_0x508e('0xc'))[_0x508e('0xd')](socket);function respondWithRpcPromise(_0x1bdc39,_0x1f5899,_0x4eadb0){return new BPromise(function(_0x57da6c,_0x59cca5){return client[_0x508e('0xe')](_0x1bdc39,_0x4eadb0)[_0x508e('0xf')](function(_0x541948){logger['info'](_0x508e('0x10'),_0x1f5899,'request\x20sent');logger[_0x508e('0x11')](_0x508e('0x12'),_0x1f5899,_0x508e('0x13'),JSON[_0x508e('0x14')](_0x541948));if(_0x541948[_0x508e('0x15')]){if(_0x541948[_0x508e('0x15')][_0x508e('0x16')]===0x1f4){logger[_0x508e('0x15')](_0x508e('0x10'),_0x1f5899,_0x541948['error']['message']);return _0x59cca5(_0x541948[_0x508e('0x15')][_0x508e('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x1f5899,_0x541948[_0x508e('0x15')][_0x508e('0x17')]);return _0x57da6c(_0x541948[_0x508e('0x15')][_0x508e('0x17')]);}else{logger['info'](_0x508e('0x10'),_0x1f5899,_0x508e('0x13'));_0x57da6c(_0x541948['result'][_0x508e('0x17')]);}})[_0x508e('0x18')](function(_0x212890){logger[_0x508e('0x15')](_0x508e('0x10'),_0x1f5899,_0x212890);_0x59cca5(_0x212890);});});}exports[_0x508e('0x19')]=function(_0x5a6e39){var _0xe860c9=this;return new Promise(function(_0x3b6358,_0x4f2734){return db[_0x508e('0x1a')]['findAll']({'raw':_0x5a6e39[_0x508e('0x1b')]?_0x5a6e39[_0x508e('0x1b')][_0x508e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a6e39[_0x508e('0x1b')]?_0x5a6e39[_0x508e('0x1b')][_0x508e('0x1d')]||null:null,'attributes':_0x5a6e39[_0x508e('0x1b')]?_0x5a6e39[_0x508e('0x1b')]['attributes']||null:null,'limit':_0x5a6e39[_0x508e('0x1b')]?_0x5a6e39[_0x508e('0x1b')]['limit']||null:null,'include':_0x5a6e39[_0x508e('0x1b')]?_0x5a6e39[_0x508e('0x1b')]['include']?_[_0x508e('0x1e')](_0x5a6e39[_0x508e('0x1b')]['include'],function(_0x2b8bcf){return{'model':db[_0x2b8bcf['model']],'as':_0x2b8bcf['as'],'attributes':_0x2b8bcf[_0x508e('0x1f')],'include':_0x2b8bcf[_0x508e('0x20')]?_[_0x508e('0x1e')](_0x2b8bcf[_0x508e('0x20')],function(_0x1695d6){return{'model':db[_0x1695d6['model']],'as':_0x1695d6['as'],'attributes':_0x1695d6[_0x508e('0x1f')],'include':_0x1695d6[_0x508e('0x20')]?_[_0x508e('0x1e')](_0x1695d6[_0x508e('0x20')],function(_0x5a1bff){return{'model':db[_0x5a1bff[_0x508e('0x21')]],'as':_0x5a1bff['as'],'attributes':_0x5a1bff[_0x508e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x508e('0xf')](function(_0x183c81){logger[_0x508e('0x22')](_0x508e('0x19'),_0x5a6e39);logger[_0x508e('0x11')](_0x508e('0x19'),_0x5a6e39,JSON[_0x508e('0x14')](_0x183c81));_0x3b6358(_0x183c81);})[_0x508e('0x18')](function(_0xdca256){logger['error'](_0x508e('0x19'),_0xdca256[_0x508e('0x17')],_0x5a6e39);_0x4f2734(_0xe860c9[_0x508e('0x15')](0x1f4,_0xdca256[_0x508e('0x17')]));});});};exports[_0x508e('0x23')]=function(_0x3503b7){var _0x379373=this;return new Promise(function(_0xc0e7cf,_0x34539c){return db[_0x508e('0x1a')][_0x508e('0x24')]({'raw':_0x3503b7[_0x508e('0x1b')]?_0x3503b7['options']['raw']===undefined?!![]:![]:!![],'where':_0x3503b7[_0x508e('0x1b')]?_0x3503b7[_0x508e('0x1b')]['where']||null:null,'attributes':_0x3503b7[_0x508e('0x1b')]?_0x3503b7[_0x508e('0x1b')][_0x508e('0x1f')]||null:null,'include':_0x3503b7['options']?_0x3503b7[_0x508e('0x1b')]['include']?_[_0x508e('0x1e')](_0x3503b7['options'][_0x508e('0x20')],function(_0x4808b8){return{'model':db[_0x4808b8['model']],'as':_0x4808b8['as'],'attributes':_0x4808b8['attributes'],'include':_0x4808b8[_0x508e('0x20')]?_['map'](_0x4808b8[_0x508e('0x20')],function(_0x420a9a){return{'model':db[_0x420a9a[_0x508e('0x21')]],'as':_0x420a9a['as'],'attributes':_0x420a9a[_0x508e('0x1f')],'include':_0x420a9a[_0x508e('0x20')]?_['map'](_0x420a9a[_0x508e('0x20')],function(_0x4f8685){return{'model':db[_0x4f8685[_0x508e('0x21')]],'as':_0x4f8685['as'],'attributes':_0x4f8685[_0x508e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x508e('0xf')](function(_0x34b531){logger[_0x508e('0x22')](_0x508e('0x23'),_0x3503b7);logger[_0x508e('0x11')](_0x508e('0x23'),_0x3503b7,JSON[_0x508e('0x14')](_0x34b531));_0xc0e7cf(_0x34b531);})[_0x508e('0x18')](function(_0x59d225){logger['error'](_0x508e('0x23'),_0x59d225[_0x508e('0x17')],_0x3503b7);_0x34539c(_0x379373[_0x508e('0x15')](0x1f4,_0x59d225[_0x508e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ac97045..f346dfb 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 _0x390a=['remove','update','emit','removeListener','register','length','./mailQueue.events','save'];(function(_0x2db29b,_0x48a2ed){var _0x15c35f=function(_0x30a4a8){while(--_0x30a4a8){_0x2db29b['push'](_0x2db29b['shift']());}};_0x15c35f(++_0x48a2ed);}(_0x390a,0xbe));var _0xa390=function(_0x57b8eb,_0x2cd01e){_0x57b8eb=_0x57b8eb-0x0;var _0x27edd2=_0x390a[_0x57b8eb];return _0x27edd2;};'use strict';var MailQueueEvents=require(_0xa390('0x0'));var events=[_0xa390('0x1'),_0xa390('0x2'),_0xa390('0x3')];function createListener(_0x4308bb,_0x16bb7d){return function(_0x26c992){_0x16bb7d[_0xa390('0x4')](_0x4308bb,_0x26c992);};}function removeListener(_0x1a1a62,_0x2d2584){return function(){MailQueueEvents[_0xa390('0x5')](_0x1a1a62,_0x2d2584);};}exports[_0xa390('0x6')]=function(_0x1cc859){for(var _0x50f4f3=0x0,_0x212916=events[_0xa390('0x7')];_0x50f4f3<_0x212916;_0x50f4f3++){var _0x55a074=events[_0x50f4f3];var _0x3783bf=createListener('mailQueue:'+_0x55a074,_0x1cc859);MailQueueEvents['on'](_0x55a074,_0x3783bf);}}; \ No newline at end of file +var _0x7a2b=['save','removeListener','register','length','./mailQueue.events'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x7a2b,0x7c));var _0xb7a2=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x7a2b[_0x18ab2a];return _0x16dcee;};'use strict';var MailQueueEvents=require(_0xb7a2('0x0'));var events=[_0xb7a2('0x1'),'remove','update'];function createListener(_0x4b4fb8,_0x50c07d){return function(_0x24fca1){_0x50c07d['emit'](_0x4b4fb8,_0x24fca1);};}function removeListener(_0x211d4e,_0x32b369){return function(){MailQueueEvents[_0xb7a2('0x2')](_0x211d4e,_0x32b369);};}exports[_0xb7a2('0x3')]=function(_0x2cdf6d){for(var _0x1d5fd0=0x0,_0x2fcc5d=events[_0xb7a2('0x4')];_0x1d5fd0<_0x2fcc5d;_0x1d5fd0++){var _0x298983=events[_0x1d5fd0];var _0x5ce32a=createListener('mailQueue:'+_0x298983,_0x2cdf6d);MailQueueEvents['on'](_0x298983,_0x5ce32a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1e96154..8e188af 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 _0x52ad=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','update'];(function(_0x23521f,_0x661e98){var _0x3db7ff=function(_0x1aeb70){while(--_0x1aeb70){_0x23521f['push'](_0x23521f['shift']());}};_0x3db7ff(++_0x661e98);}(_0x52ad,0xd5));var _0xd52a=function(_0x28b320,_0x507d19){_0x28b320=_0x28b320-0x0;var _0x53ef4e=_0x52ad[_0x28b320];return _0x53ef4e;};'use strict';var multer=require(_0xd52a('0x0'));var util=require(_0xd52a('0x1'));var path=require(_0xd52a('0x2'));var timeout=require(_0xd52a('0x3'));var express=require(_0xd52a('0x4'));var router=express[_0xd52a('0x5')]();var fs_extra=require(_0xd52a('0x6'));var auth=require(_0xd52a('0x7'));var interaction=require(_0xd52a('0x8'));var config=require(_0xd52a('0x9'));var controller=require('./mailQueueReport.controller');router[_0xd52a('0xa')]('/',auth[_0xd52a('0xb')](),controller[_0xd52a('0xc')]);router['get']('/describe',auth[_0xd52a('0xb')](),controller[_0xd52a('0xd')]);router[_0xd52a('0xa')]('/:id',auth[_0xd52a('0xb')](),controller[_0xd52a('0xe')]);router[_0xd52a('0xf')]('/',auth[_0xd52a('0xb')](),controller[_0xd52a('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd52a('0x11')]);router[_0xd52a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd52a('0x13')]);module[_0xd52a('0x14')]=router; \ No newline at end of file +var _0x1e0d=['show','post','update','delete','destroy','exports','path','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x3efe47,_0x27a6bb){var _0x39cf0a=function(_0xa1ccc5){while(--_0xa1ccc5){_0x3efe47['push'](_0x3efe47['shift']());}};_0x39cf0a(++_0x27a6bb);}(_0x1e0d,0x1a6));var _0xd1e0=function(_0x5b3666,_0x48a406){_0x5b3666=_0x5b3666-0x0;var _0x3eb3f1=_0x1e0d[_0x5b3666];return _0x3eb3f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd1e0('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd1e0('0x1'));var auth=require(_0xd1e0('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xd1e0('0x3'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0xd1e0('0x4')](),controller['index']);router[_0xd1e0('0x5')]('/describe',auth[_0xd1e0('0x4')](),controller['describe']);router[_0xd1e0('0x5')](_0xd1e0('0x6'),auth['isAuthenticated'](),controller[_0xd1e0('0x7')]);router[_0xd1e0('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd1e0('0x6'),auth['isAuthenticated'](),controller[_0xd1e0('0x9')]);router[_0xd1e0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd1e0('0xb')]);module[_0xd1e0('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a8167ca..425d676 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 _0xd336=['sequelize','exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd336,0xc2));var _0x6d33=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xd336[_0x2eb5bc];return _0x51c7b1;};'use strict';var moment=require(_0x6d33('0x0'));var Sequelize=require(_0x6d33('0x1'));module[_0x6d33('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6d33('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6d33('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6d33('0x3')]}}; \ No newline at end of file +var _0x05ba=['STRING','DATE','exports'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x05ba,0x1a6));var _0xa05b=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x05ba[_0x3fa7d3];return _0x4c51bd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa05b('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa05b('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa05b('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa05b('0x2')]},'reason':{'type':Sequelize[_0xa05b('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index dfb5435..f82f71f 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 _0x4991=['hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','MailQueueReport','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','zip-dir','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/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x5ad803,_0x2017f2){var _0x5daa5c=function(_0x59c986){while(--_0x59c986){_0x5ad803['push'](_0x5ad803['shift']());}};_0x5daa5c(++_0x2017f2);}(_0x4991,0xf7));var _0x1499=function(_0x4d7084,_0x32912e){_0x4d7084=_0x4d7084-0x0;var _0x15c385=_0x4991[_0x4d7084];return _0x15c385;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['MailQueueReport'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':!![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));};exports[_0x1499('0x4a')]=function(_0x9f0520,_0x278178){return db['MailQueueReport'][_0x1499('0x4a')]()[_0x1499('0x24')](respondWithResult(_0x278178,null))['catch'](handleError(_0x278178,null));}; \ No newline at end of file +var _0x7bd0=['model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','MailQueueReport','findAll','rows','show','keys','length','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x5d1547,_0x1d622d){var _0x5c2fe4=function(_0x3fee54){while(--_0x3fee54){_0x5d1547['push'](_0x5d1547['shift']());}};_0x5c2fe4(++_0x1d622d);}(_0x7bd0,0x111));var _0x07bd=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x7bd0[_0x5fa520];return _0x1bf6c4;};'use strict';var emlformat=require(_0x07bd('0x0'));var rimraf=require(_0x07bd('0x1'));var zipdir=require(_0x07bd('0x2'));var jsonpatch=require(_0x07bd('0x3'));var rp=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var BPromise=require(_0x07bd('0x6'));var Mustache=require(_0x07bd('0x7'));var util=require('util');var path=require(_0x07bd('0x8'));var sox=require(_0x07bd('0x9'));var csv=require(_0x07bd('0xa'));var ejs=require(_0x07bd('0xb'));var fs=require('fs');var fs_extra=require(_0x07bd('0xc'));var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xa'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var licenseUtil=require(_0x07bd('0x19'));var db=require(_0x07bd('0x1a'))['db'];function respondWithStatusCode(_0x1eff6c,_0x10aa2e){_0x10aa2e=_0x10aa2e||0xcc;return function(_0x2b8409){if(_0x2b8409){return _0x1eff6c['sendStatus'](_0x10aa2e);}return _0x1eff6c['status'](_0x10aa2e)[_0x07bd('0x1b')]();};}function respondWithResult(_0x3fe523,_0x1c59c2){_0x1c59c2=_0x1c59c2||0xc8;return function(_0x247f3f){if(_0x247f3f){return _0x3fe523[_0x07bd('0x1c')](_0x1c59c2)[_0x07bd('0x1d')](_0x247f3f);}};}function respondWithFilteredResult(_0x2c9166,_0x49d962){return function(_0x418444){if(_0x418444){var _0x505839=typeof _0x49d962[_0x07bd('0x1e')]===_0x07bd('0x1f')&&typeof _0x49d962[_0x07bd('0x20')]===_0x07bd('0x1f');var _0x8aa645=_0x418444['count'];var _0x3f9f0b=_0x505839?0x0:_0x49d962[_0x07bd('0x1e')];var _0x4948f4=_0x505839?_0x418444[_0x07bd('0x21')]:_0x49d962[_0x07bd('0x1e')]+_0x49d962[_0x07bd('0x20')];var _0x2fcc59;if(_0x4948f4>=_0x8aa645){_0x4948f4=_0x8aa645;_0x2fcc59=0xc8;}else{_0x2fcc59=0xce;}_0x2c9166[_0x07bd('0x1c')](_0x2fcc59);return _0x2c9166[_0x07bd('0x22')](_0x07bd('0x23'),_0x3f9f0b+'-'+_0x4948f4+'/'+_0x8aa645)[_0x07bd('0x1d')](_0x418444);}return null;};}function patchUpdates(_0x29a52e){return function(_0x50109f){try{jsonpatch[_0x07bd('0x24')](_0x50109f,_0x29a52e,!![]);}catch(_0x227807){return BPromise[_0x07bd('0x25')](_0x227807);}return _0x50109f[_0x07bd('0x26')]();};}function saveUpdates(_0x16d0e6,_0x47bd50){return function(_0x4c673a){if(_0x4c673a){return _0x4c673a[_0x07bd('0x27')](_0x16d0e6)['then'](function(_0x2b0dee){return _0x2b0dee;});}return null;};}function removeEntity(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(_0x4165bc){return _0x4165bc[_0x07bd('0x28')]()[_0x07bd('0x29')](function(){_0x480c9c[_0x07bd('0x1c')](0xcc)[_0x07bd('0x1b')]();});}};}function handleEntityNotFound(_0x43cbc8,_0x557042){return function(_0x180b43){if(!_0x180b43){_0x43cbc8[_0x07bd('0x2a')](0x194);}return _0x180b43;};}function handleError(_0x3db9d0,_0x2a7202){_0x2a7202=_0x2a7202||0x1f4;return function(_0x12ce26){logger[_0x07bd('0x2b')](_0x12ce26['stack']);if(_0x12ce26['name']){delete _0x12ce26['name'];}_0x3db9d0[_0x07bd('0x1c')](_0x2a7202)[_0x07bd('0x2c')](_0x12ce26);};}exports[_0x07bd('0x2d')]=function(_0x51efa8,_0x1a3aa9){var _0x400cc0={},_0x253dc0={},_0x46ed12={'count':0x0,'rows':[]};var _0x3f9424=_[_0x07bd('0x2e')](db['MailQueueReport'][_0x07bd('0x2f')],function(_0x20cc94){return{'name':_0x20cc94[_0x07bd('0x30')],'type':_0x20cc94[_0x07bd('0x31')][_0x07bd('0x32')]};});_0x253dc0[_0x07bd('0x33')]=_[_0x07bd('0x2e')](_0x3f9424,_0x07bd('0x34'));_0x253dc0['query']=_['keys'](_0x51efa8[_0x07bd('0x35')]);_0x253dc0[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x253dc0['model'],_0x253dc0[_0x07bd('0x35')]);_0x400cc0[_0x07bd('0x38')]=_[_0x07bd('0x37')](_0x253dc0['model'],qs['fields'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x39')]));_0x400cc0[_0x07bd('0x38')]=_0x400cc0[_0x07bd('0x38')]['length']?_0x400cc0[_0x07bd('0x38')]:_0x253dc0[_0x07bd('0x33')];if(!_0x51efa8[_0x07bd('0x35')]['hasOwnProperty'](_0x07bd('0x3a'))){_0x400cc0[_0x07bd('0x20')]=qs['limit'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x20')]);_0x400cc0[_0x07bd('0x1e')]=qs[_0x07bd('0x1e')](_0x51efa8['query']['offset']);}_0x400cc0[_0x07bd('0x3b')]=qs['sort'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3c')]);_0x400cc0[_0x07bd('0x3d')]=qs[_0x07bd('0x36')](_[_0x07bd('0x3e')](_0x51efa8[_0x07bd('0x35')],_0x253dc0[_0x07bd('0x36')]),_0x3f9424);if(_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3f')]){_0x400cc0[_0x07bd('0x3d')]=_[_0x07bd('0x40')](_0x400cc0[_0x07bd('0x3d')],{'$or':_[_0x07bd('0x2e')](_0x3f9424,function(_0x51e8e2){if(_0x51e8e2[_0x07bd('0x31')]!==_0x07bd('0x41')){var _0x220a8e={};_0x220a8e[_0x51e8e2[_0x07bd('0x34')]]={'$like':'%'+_0x51efa8['query'][_0x07bd('0x3f')]+'%'};return _0x220a8e;}})});}_0x400cc0=_[_0x07bd('0x40')]({},_0x400cc0,_0x51efa8[_0x07bd('0x42')]);var _0x408a0a={'where':_0x400cc0[_0x07bd('0x3d')]};return db['MailQueueReport']['count'](_0x408a0a)[_0x07bd('0x29')](function(_0x88e174){_0x46ed12[_0x07bd('0x21')]=_0x88e174;if(_0x51efa8[_0x07bd('0x35')]['includeAll']){_0x400cc0[_0x07bd('0x43')]=[{'all':!![]}];}return db[_0x07bd('0x44')][_0x07bd('0x45')](_0x400cc0);})[_0x07bd('0x29')](function(_0x318b7c){_0x46ed12[_0x07bd('0x46')]=_0x318b7c;return _0x46ed12;})[_0x07bd('0x29')](respondWithFilteredResult(_0x1a3aa9,_0x400cc0))['catch'](handleError(_0x1a3aa9,null));};exports[_0x07bd('0x47')]=function(_0x7b1042,_0x33389b){var _0x3a5827={'raw':!![],'where':{'id':_0x7b1042['params']['id']}},_0x418f26={};_0x418f26[_0x07bd('0x33')]=_[_0x07bd('0x48')](db[_0x07bd('0x44')][_0x07bd('0x2f')]);_0x418f26[_0x07bd('0x35')]=_['keys'](_0x7b1042[_0x07bd('0x35')]);_0x418f26[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],_0x418f26['query']);_0x3a5827['attributes']=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],qs[_0x07bd('0x39')](_0x7b1042[_0x07bd('0x35')][_0x07bd('0x39')]));_0x3a5827[_0x07bd('0x38')]=_0x3a5827[_0x07bd('0x38')][_0x07bd('0x49')]?_0x3a5827[_0x07bd('0x38')]:_0x418f26['model'];if(_0x7b1042['query'][_0x07bd('0x4a')]){_0x3a5827[_0x07bd('0x43')]=[{'all':!![]}];}_0x3a5827=_[_0x07bd('0x40')]({},_0x3a5827,_0x7b1042[_0x07bd('0x42')]);return db[_0x07bd('0x44')][_0x07bd('0x4b')](_0x3a5827)['then'](handleEntityNotFound(_0x33389b,null))[_0x07bd('0x29')](respondWithResult(_0x33389b,null))[_0x07bd('0x4c')](handleError(_0x33389b,null));};exports[_0x07bd('0x4d')]=function(_0x39823e,_0x7755e2){return db[_0x07bd('0x44')]['create'](_0x39823e[_0x07bd('0x4e')],{})[_0x07bd('0x29')](respondWithResult(_0x7755e2,0xc9))[_0x07bd('0x4c')](handleError(_0x7755e2,null));};exports[_0x07bd('0x27')]=function(_0x1d05ad,_0xc96a7d){if(_0x1d05ad[_0x07bd('0x4e')]['id']){delete _0x1d05ad[_0x07bd('0x4e')]['id'];}return db[_0x07bd('0x44')][_0x07bd('0x4b')]({'where':{'id':_0x1d05ad[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0xc96a7d,null))['then'](saveUpdates(_0x1d05ad[_0x07bd('0x4e')],null))[_0x07bd('0x29')](respondWithResult(_0xc96a7d,null))[_0x07bd('0x4c')](handleError(_0xc96a7d,null));};exports['destroy']=function(_0x51c9f4,_0x1e7a6e){return db['MailQueueReport'][_0x07bd('0x4b')]({'where':{'id':_0x51c9f4[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0x1e7a6e,null))[_0x07bd('0x29')](removeEntity(_0x1e7a6e,null))[_0x07bd('0x4c')](handleError(_0x1e7a6e,null));};exports[_0x07bd('0x50')]=function(_0x2cadbb,_0x157eb4){return db['MailQueueReport'][_0x07bd('0x50')]()[_0x07bd('0x29')](respondWithResult(_0x157eb4,null))[_0x07bd('0x4c')](handleError(_0x157eb4,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1ac757d..3da8cb3 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 _0xf1db=['./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf1db,0x191));var _0xbf1d=function(_0x3bd6c6,_0x3b5c29){_0x3bd6c6=_0x3bd6c6-0x0;var _0x417c20=_0xf1db[_0x3bd6c6];return _0x417c20;};'use strict';var _=require(_0xbf1d('0x0'));var util=require(_0xbf1d('0x1'));var logger=require(_0xbf1d('0x2'))('api');var moment=require(_0xbf1d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf1d('0x4'));var config=require(_0xbf1d('0x5'));var attributes=require(_0xbf1d('0x6'));module[_0xbf1d('0x7')]=function(_0x2d3623,_0x462a90){return _0x2d3623['define'](_0xbf1d('0x8'),attributes,{'tableName':_0xbf1d('0x9'),'paranoid':![],'indexes':[{'name':_0xbf1d('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf924=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x34e858,_0x2412b3){var _0x8aaa05=function(_0x391476){while(--_0x391476){_0x34e858['push'](_0x34e858['shift']());}};_0x8aaa05(++_0x2412b3);}(_0xf924,0x107));var _0x4f92=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0xf924[_0x4c06ac];return _0x2333cb;};'use strict';var _=require(_0x4f92('0x0'));var util=require(_0x4f92('0x1'));var logger=require(_0x4f92('0x2'))(_0x4f92('0x3'));var moment=require(_0x4f92('0x4'));var BPromise=require(_0x4f92('0x5'));var rp=require(_0x4f92('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f92('0x7'));var config=require(_0x4f92('0x8'));var attributes=require(_0x4f92('0x9'));module['exports']=function(_0x49af92,_0x28b843){return _0x49af92[_0x4f92('0xa')](_0x4f92('0xb'),attributes,{'tableName':_0x4f92('0xc'),'paranoid':![],'indexes':[{'name':_0x4f92('0xd'),'fields':[_0x4f92('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3a39a48..a9e8bd6 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(_0xe34f46,_0x4e605b){var _0x181ec8=function(_0x560f98){while(--_0x560f98){_0xe34f46['push'](_0xe34f46['shift']());}};_0x181ec8(++_0x4e605b);}(_0xadb5,0xad));var _0x5adb=function(_0x3ffb36,_0x4adf49){_0x3ffb36=_0x3ffb36-0x0;var _0x5b8a76=_0xadb5[_0x3ffb36];return _0x5b8a76;};'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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x365521,_0xba360d){var _0x2cfabf=function(_0xa78e75){while(--_0xa78e75){_0x365521['push'](_0x365521['shift']());}};_0x2cfabf(++_0xba360d);}(_0x7a54,0x106));var _0x47a5=function(_0x126bc9,_0x1aecd4){_0x126bc9=_0x126bc9-0x0;var _0x3e470d=_0x7a54[_0x126bc9];return _0x3e470d;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5e36fdd..0e435cb 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2e3841,_0x21af93){var _0x496fe0=function(_0x19876c){while(--_0x19876c){_0x2e3841['push'](_0x2e3841['shift']());}};_0x496fe0(++_0x21af93);}(_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(_0x103584,_0xd3dd15){var _0x23ca01=function(_0x1bca4d){while(--_0x1bca4d){_0x103584['push'](_0x103584['shift']());}};_0x23ca01(++_0xd3dd15);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 95f1e62..36158f2 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 _0x407f=['INTEGER','INBOX','STRING','BOOLEAN'];(function(_0x7dd2aa,_0x178fb4){var _0x5e528f=function(_0x3c7123){while(--_0x3c7123){_0x7dd2aa['push'](_0x7dd2aa['shift']());}};_0x5e528f(++_0x178fb4);}(_0x407f,0xc2));var _0xf407=function(_0x4262c2,_0x2941d0){_0x4262c2=_0x4262c2-0x0;var _0x5d98ea=_0x407f[_0x4262c2];return _0x5d98ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf407('0x0')]},'authentication':{'type':Sequelize[_0xf407('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf407('0x0')]},'password':{'type':Sequelize[_0xf407('0x0')]},'port':{'type':Sequelize[_0xf407('0x2')]},'tls':{'type':Sequelize[_0xf407('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf407('0x0')],'defaultValue':_0xf407('0x3')},'connTimeout':{'type':Sequelize[_0xf407('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf407('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf407('0x0')]}}; \ No newline at end of file +var _0xcecc=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x22a11b,_0x7bace3){var _0xc02525=function(_0x2f3a76){while(--_0x2f3a76){_0x22a11b['push'](_0x22a11b['shift']());}};_0xc02525(++_0x7bace3);}(_0xcecc,0x186));var _0xccec=function(_0x394b2a,_0x912368){_0x394b2a=_0x394b2a-0x0;var _0x4b9034=_0xcecc[_0x394b2a];return _0x4b9034;};'use strict';var Sequelize=require(_0xccec('0x0'));module['exports']={'description':{'type':Sequelize[_0xccec('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xccec('0x1')]},'password':{'type':Sequelize[_0xccec('0x1')]},'port':{'type':Sequelize[_0xccec('0x2')]},'tls':{'type':Sequelize[_0xccec('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xccec('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xccec('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c93f576..0c5fb79 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 _0xba18=['MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x190472,_0x567961){var _0x5d5232=function(_0x13c5a8){while(--_0x13c5a8){_0x190472['push'](_0x190472['shift']());}};_0x5d5232(++_0x567961);}(_0xba18,0x106));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require('util');var logger=require(_0x8ba1('0x1'))(_0x8ba1('0x2'));var moment=require(_0x8ba1('0x3'));var BPromise=require(_0x8ba1('0x4'));var rp=require(_0x8ba1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ba1('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x8ba1('0x7')]=function(_0x63ec9e,_0x595ef3){return _0x63ec9e['define'](_0x8ba1('0x8'),attributes,{'tableName':_0x8ba1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ed=['./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x91ed,0x1dd));var _0xd91e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x91ed[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd91e('0x0'));var util=require(_0xd91e('0x1'));var logger=require(_0xd91e('0x2'))(_0xd91e('0x3'));var moment=require(_0xd91e('0x4'));var BPromise=require(_0xd91e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd91e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd91e('0x7'));module[_0xd91e('0x8')]=function(_0x34b25f,_0x26e716){return _0x34b25f['define'](_0xd91e('0x9'),attributes,{'tableName':_0xd91e('0xa'),'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 241cb5c..3378763 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 _0x6324=['info','result','catch','GetMailServerIn','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x6324,0x142));var _0x4632=function(_0x461886,_0x4fc171){_0x461886=_0x461886-0x0;var _0x295e0a=_0x6324[_0x461886];return _0x295e0a;};'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']('MailServerIn,\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')]('MailServerIn,\x20%s,\x20%s',_0x4a15b2,_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);return _0x44dd6d(_0x47824c[_0x4632('0xf')][_0x4632('0x12')]);}else{logger[_0x4632('0x13')]('MailServerIn,\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);});});}exports[_0x4632('0x16')]=function(_0x1a94c0){var _0x5b28b7=this;return new Promise(function(_0x3cddfa,_0x1894bb){return db['MailServerIn']['findAll']({'raw':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x18')]===undefined?!![]:![]:!![],'where':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x19')]||null:null,'attributes':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1a')]||null:null,'limit':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1b')]||null:null,'include':_0x1a94c0[_0x4632('0x17')]?_0x1a94c0[_0x4632('0x17')][_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x1a94c0[_0x4632('0x17')][_0x4632('0x1c')],function(_0x380a9f){return{'model':db[_0x380a9f[_0x4632('0x1e')]],'as':_0x380a9f['as'],'attributes':_0x380a9f[_0x4632('0x1a')],'include':_0x380a9f[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0x380a9f[_0x4632('0x1c')],function(_0xb074d){return{'model':db[_0xb074d[_0x4632('0x1e')]],'as':_0xb074d['as'],'attributes':_0xb074d[_0x4632('0x1a')],'include':_0xb074d[_0x4632('0x1c')]?_[_0x4632('0x1d')](_0xb074d[_0x4632('0x1c')],function(_0x22d0f5){return{'model':db[_0x22d0f5[_0x4632('0x1e')]],'as':_0x22d0f5['as'],'attributes':_0x22d0f5[_0x4632('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57798a){logger[_0x4632('0x13')](_0x4632('0x16'),_0x1a94c0);logger[_0x4632('0xc')](_0x4632('0x16'),_0x1a94c0,JSON[_0x4632('0xe')](_0x57798a));_0x3cddfa(_0x57798a);})[_0x4632('0x15')](function(_0x3570b2){logger['error'](_0x4632('0x16'),_0x3570b2[_0x4632('0x12')],_0x1a94c0);_0x1894bb(_0x5b28b7['error'](0x1f4,_0x3570b2[_0x4632('0x12')]));});});}; \ No newline at end of file +var _0x4a00=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','GetMailServerIn','MailServerIn','findAll','options','raw','limit','include','map','model','attributes','then','debug','stringify'];(function(_0x3d75b6,_0x1e188c){var _0x3bfb58=function(_0x39798a){while(--_0x39798a){_0x3d75b6['push'](_0x3d75b6['shift']());}};_0x3bfb58(++_0x1e188c);}(_0x4a00,0xc6));var _0x04a0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4a00[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x04a0('0x0'));var util=require(_0x04a0('0x1'));var moment=require(_0x04a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x04a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x04a0('0x4'));var logger=require(_0x04a0('0x5'))(_0x04a0('0x6'));var config=require(_0x04a0('0x7'));var jayson=require(_0x04a0('0x8'));var client=jayson[_0x04a0('0x9')][_0x04a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c38da,_0x40126f,_0x519879){return new BPromise(function(_0x13b953,_0x3be55e){return client[_0x04a0('0xb')](_0x3c38da,_0x519879)['then'](function(_0x49829d){logger[_0x04a0('0xc')](_0x04a0('0xd'),_0x40126f,'request\x20sent');logger['debug'](_0x04a0('0xe'),_0x40126f,'request\x20sent',JSON['stringify'](_0x49829d));if(_0x49829d[_0x04a0('0xf')]){if(_0x49829d[_0x04a0('0xf')][_0x04a0('0x10')]===0x1f4){logger[_0x04a0('0xf')]('MailServerIn,\x20%s,\x20%s',_0x40126f,_0x49829d[_0x04a0('0xf')][_0x04a0('0x11')]);return _0x3be55e(_0x49829d[_0x04a0('0xf')]['message']);}logger[_0x04a0('0xf')](_0x04a0('0xd'),_0x40126f,_0x49829d[_0x04a0('0xf')][_0x04a0('0x11')]);return _0x13b953(_0x49829d[_0x04a0('0xf')][_0x04a0('0x11')]);}else{logger[_0x04a0('0xc')](_0x04a0('0xd'),_0x40126f,_0x04a0('0x12'));_0x13b953(_0x49829d['result']['message']);}})[_0x04a0('0x13')](function(_0x9ad3dd){logger[_0x04a0('0xf')](_0x04a0('0xd'),_0x40126f,_0x9ad3dd);_0x3be55e(_0x9ad3dd);});});}exports[_0x04a0('0x14')]=function(_0x5e8470){var _0x186b78=this;return new Promise(function(_0x20b51a,_0xff1ced){return db[_0x04a0('0x15')][_0x04a0('0x16')]({'raw':_0x5e8470[_0x04a0('0x17')]?_0x5e8470['options'][_0x04a0('0x18')]===undefined?!![]:![]:!![],'where':_0x5e8470[_0x04a0('0x17')]?_0x5e8470[_0x04a0('0x17')]['where']||null:null,'attributes':_0x5e8470['options']?_0x5e8470[_0x04a0('0x17')]['attributes']||null:null,'limit':_0x5e8470[_0x04a0('0x17')]?_0x5e8470[_0x04a0('0x17')][_0x04a0('0x19')]||null:null,'include':_0x5e8470[_0x04a0('0x17')]?_0x5e8470[_0x04a0('0x17')][_0x04a0('0x1a')]?_[_0x04a0('0x1b')](_0x5e8470[_0x04a0('0x17')]['include'],function(_0x3376cb){return{'model':db[_0x3376cb[_0x04a0('0x1c')]],'as':_0x3376cb['as'],'attributes':_0x3376cb[_0x04a0('0x1d')],'include':_0x3376cb['include']?_[_0x04a0('0x1b')](_0x3376cb[_0x04a0('0x1a')],function(_0x3fce91){return{'model':db[_0x3fce91[_0x04a0('0x1c')]],'as':_0x3fce91['as'],'attributes':_0x3fce91[_0x04a0('0x1d')],'include':_0x3fce91['include']?_['map'](_0x3fce91[_0x04a0('0x1a')],function(_0x5d3d75){return{'model':db[_0x5d3d75['model']],'as':_0x5d3d75['as'],'attributes':_0x5d3d75[_0x04a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x04a0('0x1e')](function(_0x391ec0){logger[_0x04a0('0xc')](_0x04a0('0x14'),_0x5e8470);logger[_0x04a0('0x1f')]('GetMailServerIn',_0x5e8470,JSON[_0x04a0('0x20')](_0x391ec0));_0x20b51a(_0x391ec0);})[_0x04a0('0x13')](function(_0x13a1f7){logger[_0x04a0('0xf')](_0x04a0('0x14'),_0x13a1f7[_0x04a0('0x11')],_0x5e8470);_0xff1ced(_0x186b78[_0x04a0('0xf')](0x1f4,_0x13a1f7[_0x04a0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index cd169a4..81a3aa4 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 3ca6207..bfc478a 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 _0xeda7=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xeda7,0x196));var _0x7eda=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xeda7[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0x7eda('0x0'));module[_0x7eda('0x1')]={'description':{'type':Sequelize[_0x7eda('0x2')]},'host':{'type':Sequelize[_0x7eda('0x2')]},'user':{'type':Sequelize[_0x7eda('0x2')]},'pass':{'type':Sequelize[_0x7eda('0x2')]},'port':{'type':Sequelize[_0x7eda('0x3')]},'secure':{'type':Sequelize[_0x7eda('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x7eda('0x2')]},'authentication':{'type':Sequelize[_0x7eda('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8a03=['sequelize','exports','STRING','BOOLEAN'];(function(_0x451a6e,_0x27516a){var _0x458d25=function(_0x9906d8){while(--_0x9906d8){_0x451a6e['push'](_0x451a6e['shift']());}};_0x458d25(++_0x27516a);}(_0x8a03,0xf0));var _0x38a0=function(_0x147130,_0x5f32ea){_0x147130=_0x147130-0x0;var _0x1b95f4=_0x8a03[_0x147130];return _0x1b95f4;};'use strict';var Sequelize=require(_0x38a0('0x0'));module[_0x38a0('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x38a0('0x2')]},'pass':{'type':Sequelize[_0x38a0('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x38a0('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x38a0('0x2')]},'authentication':{'type':Sequelize[_0x38a0('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 c405f95..cced7b3 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 _0x7654=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','keys','create','body','update','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x18c95a,_0x579fae){var _0x227a07=function(_0x738268){while(--_0x738268){_0x18c95a['push'](_0x18c95a['shift']());}};_0x227a07(++_0x579fae);}(_0x7654,0x1ca));var _0x4765=function(_0x1ed6c5,_0x4e3a32){_0x1ed6c5=_0x1ed6c5-0x0;var _0x195f67=_0x7654[_0x1ed6c5];return _0x195f67;};'use strict';var emlformat=require(_0x4765('0x0'));var rimraf=require(_0x4765('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4765('0x2'));var rp=require(_0x4765('0x3'));var moment=require(_0x4765('0x4'));var BPromise=require(_0x4765('0x5'));var Mustache=require('mustache');var util=require(_0x4765('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4765('0x7'));var _=require('lodash');var squel=require(_0x4765('0x8'));var crypto=require(_0x4765('0x9'));var jsforce=require(_0x4765('0xa'));var deskjs=require(_0x4765('0xb'));var toCsv=require(_0x4765('0xc'));var querystring=require('querystring');var Papa=require(_0x4765('0xd'));var Redis=require('ioredis');var authService=require(_0x4765('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4765('0xf'));var hardwareService=require(_0x4765('0x10'));var logger=require('../../config/logger')(_0x4765('0x11'));var utils=require(_0x4765('0x12'));var config=require(_0x4765('0x13'));var licenseUtil=require(_0x4765('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeacd38,_0x21d17d){_0x21d17d=_0x21d17d||0xcc;return function(_0x5c1fb5){if(_0x5c1fb5){return _0xeacd38[_0x4765('0x15')](_0x21d17d);}return _0xeacd38[_0x4765('0x16')](_0x21d17d)['end']();};}function respondWithResult(_0x49464d,_0xbc6941){_0xbc6941=_0xbc6941||0xc8;return function(_0x212021){if(_0x212021){return _0x49464d[_0x4765('0x16')](_0xbc6941)[_0x4765('0x17')](_0x212021);}};}function respondWithFilteredResult(_0x2fe9f4,_0x10c196){return function(_0x25b286){if(_0x25b286){var _0x5ba5ef=typeof _0x10c196[_0x4765('0x18')]===_0x4765('0x19')&&typeof _0x10c196[_0x4765('0x1a')]===_0x4765('0x19');var _0x1a329=_0x25b286[_0x4765('0x1b')];var _0x3d4412=_0x5ba5ef?0x0:_0x10c196[_0x4765('0x18')];var _0x1e66b1=_0x5ba5ef?_0x25b286[_0x4765('0x1b')]:_0x10c196[_0x4765('0x18')]+_0x10c196[_0x4765('0x1a')];var _0x138260;if(_0x1e66b1>=_0x1a329){_0x1e66b1=_0x1a329;_0x138260=0xc8;}else{_0x138260=0xce;}_0x2fe9f4[_0x4765('0x16')](_0x138260);return _0x2fe9f4[_0x4765('0x1c')](_0x4765('0x1d'),_0x3d4412+'-'+_0x1e66b1+'/'+_0x1a329)[_0x4765('0x17')](_0x25b286);}return null;};}function patchUpdates(_0x23f531){return function(_0x83b4e5){try{jsonpatch[_0x4765('0x1e')](_0x83b4e5,_0x23f531,!![]);}catch(_0x4d4dd8){return BPromise['reject'](_0x4d4dd8);}return _0x83b4e5[_0x4765('0x1f')]();};}function saveUpdates(_0x2051b6,_0xcda078){return function(_0x5be7f5){if(_0x5be7f5){return _0x5be7f5['update'](_0x2051b6)[_0x4765('0x20')](function(_0x20e47e){return _0x20e47e;});}return null;};}function removeEntity(_0x589a19,_0x395568){return function(_0x15cb43){if(_0x15cb43){return _0x15cb43['destroy']()[_0x4765('0x20')](function(){_0x589a19['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e0a4,_0x414cf0){return function(_0x51be6d){if(!_0x51be6d){_0x49e0a4['sendStatus'](0x194);}return _0x51be6d;};}function handleError(_0x3432ab,_0x4a97aa){_0x4a97aa=_0x4a97aa||0x1f4;return function(_0x108780){logger[_0x4765('0x21')](_0x108780[_0x4765('0x22')]);if(_0x108780[_0x4765('0x23')]){delete _0x108780['name'];}_0x3432ab[_0x4765('0x16')](_0x4a97aa)[_0x4765('0x24')](_0x108780);};}exports[_0x4765('0x25')]=function(_0x56d2b9,_0xa0d46b){var _0x2991c5={},_0x15a090={},_0x31cb26={'count':0x0,'rows':[]};var _0x4219c6=_[_0x4765('0x26')](db[_0x4765('0x27')][_0x4765('0x28')],function(_0x147471){return{'name':_0x147471[_0x4765('0x29')],'type':_0x147471[_0x4765('0x2a')][_0x4765('0x2b')]};});_0x15a090[_0x4765('0x2c')]=_['map'](_0x4219c6,_0x4765('0x23'));_0x15a090[_0x4765('0x2d')]=_['keys'](_0x56d2b9['query']);_0x15a090[_0x4765('0x2e')]=_[_0x4765('0x2f')](_0x15a090['model'],_0x15a090['query']);_0x2991c5[_0x4765('0x30')]=_[_0x4765('0x2f')](_0x15a090['model'],qs[_0x4765('0x31')](_0x56d2b9[_0x4765('0x2d')][_0x4765('0x31')]));_0x2991c5[_0x4765('0x30')]=_0x2991c5['attributes'][_0x4765('0x32')]?_0x2991c5[_0x4765('0x30')]:_0x15a090['model'];if(!_0x56d2b9[_0x4765('0x2d')]['hasOwnProperty']('nolimit')){_0x2991c5['limit']=qs['limit'](_0x56d2b9[_0x4765('0x2d')][_0x4765('0x1a')]);_0x2991c5['offset']=qs[_0x4765('0x18')](_0x56d2b9['query']['offset']);}_0x2991c5[_0x4765('0x33')]=qs[_0x4765('0x34')](_0x56d2b9[_0x4765('0x2d')]['sort']);_0x2991c5[_0x4765('0x35')]=qs['filters'](_[_0x4765('0x36')](_0x56d2b9[_0x4765('0x2d')],_0x15a090[_0x4765('0x2e')]),_0x4219c6);if(_0x56d2b9['query']['filter']){_0x2991c5['where']=_[_0x4765('0x37')](_0x2991c5[_0x4765('0x35')],{'$or':_[_0x4765('0x26')](_0x4219c6,function(_0x11d804){if(_0x11d804['type']!==_0x4765('0x38')){var _0x5ec8bc={};_0x5ec8bc[_0x11d804['name']]={'$like':'%'+_0x56d2b9['query'][_0x4765('0x39')]+'%'};return _0x5ec8bc;}})});}_0x2991c5=_[_0x4765('0x37')]({},_0x2991c5,_0x56d2b9[_0x4765('0x3a')]);var _0x5a294c={'where':_0x2991c5[_0x4765('0x35')]};return db[_0x4765('0x27')][_0x4765('0x1b')](_0x5a294c)[_0x4765('0x20')](function(_0x54cd0b){_0x31cb26['count']=_0x54cd0b;if(_0x56d2b9[_0x4765('0x2d')]['includeAll']){_0x2991c5[_0x4765('0x3b')]=[{'all':!![]}];}return db[_0x4765('0x27')]['findAll'](_0x2991c5);})[_0x4765('0x20')](function(_0x2f02f3){_0x31cb26[_0x4765('0x3c')]=_0x2f02f3;return _0x31cb26;})['then'](respondWithFilteredResult(_0xa0d46b,_0x2991c5))[_0x4765('0x3d')](handleError(_0xa0d46b,null));};exports['show']=function(_0x4d02e8,_0x142a0d){var _0x15a393={'raw':!![],'where':{'id':_0x4d02e8[_0x4765('0x3e')]['id']}},_0x3abfd5={};_0x3abfd5[_0x4765('0x2c')]=_['keys'](db['MailServerOut'][_0x4765('0x28')]);_0x3abfd5[_0x4765('0x2d')]=_[_0x4765('0x3f')](_0x4d02e8[_0x4765('0x2d')]);_0x3abfd5[_0x4765('0x2e')]=_[_0x4765('0x2f')](_0x3abfd5['model'],_0x3abfd5[_0x4765('0x2d')]);_0x15a393[_0x4765('0x30')]=_[_0x4765('0x2f')](_0x3abfd5[_0x4765('0x2c')],qs[_0x4765('0x31')](_0x4d02e8['query']['fields']));_0x15a393[_0x4765('0x30')]=_0x15a393['attributes'][_0x4765('0x32')]?_0x15a393[_0x4765('0x30')]:_0x3abfd5[_0x4765('0x2c')];if(_0x4d02e8['query']['includeAll']){_0x15a393[_0x4765('0x3b')]=[{'all':!![]}];}_0x15a393=_['merge']({},_0x15a393,_0x4d02e8[_0x4765('0x3a')]);return db['MailServerOut']['find'](_0x15a393)['then'](handleEntityNotFound(_0x142a0d,null))['then'](respondWithResult(_0x142a0d,null))[_0x4765('0x3d')](handleError(_0x142a0d,null));};exports[_0x4765('0x40')]=function(_0x53c285,_0x7ddd2b){return db[_0x4765('0x27')][_0x4765('0x40')](_0x53c285[_0x4765('0x41')],{})[_0x4765('0x20')](respondWithResult(_0x7ddd2b,0xc9))[_0x4765('0x3d')](handleError(_0x7ddd2b,null));};exports[_0x4765('0x42')]=function(_0xc1a095,_0x46b294){if(_0xc1a095['body']['id']){delete _0xc1a095[_0x4765('0x41')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0xc1a095[_0x4765('0x3e')]['id']}})[_0x4765('0x20')](handleEntityNotFound(_0x46b294,null))[_0x4765('0x20')](saveUpdates(_0xc1a095[_0x4765('0x41')],null))['then'](respondWithResult(_0x46b294,null))[_0x4765('0x3d')](handleError(_0x46b294,null));};exports['destroy']=function(_0x34747c,_0xda7993){return db[_0x4765('0x27')][_0x4765('0x43')]({'where':{'id':_0x34747c[_0x4765('0x3e')]['id']}})[_0x4765('0x20')](handleEntityNotFound(_0xda7993,null))[_0x4765('0x20')](removeEntity(_0xda7993,null))[_0x4765('0x3d')](handleError(_0xda7993,null));}; \ No newline at end of file +var _0xc801=['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','end','offset','undefined','limit','count','status','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc801,0x1c5));var _0x1c80=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xc801[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x1c80('0x0'));var rimraf=require(_0x1c80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c80('0x2'));var rp=require(_0x1c80('0x3'));var moment=require('moment');var BPromise=require(_0x1c80('0x4'));var Mustache=require(_0x1c80('0x5'));var util=require(_0x1c80('0x6'));var path=require(_0x1c80('0x7'));var sox=require(_0x1c80('0x8'));var csv=require(_0x1c80('0x9'));var ejs=require(_0x1c80('0xa'));var fs=require('fs');var fs_extra=require(_0x1c80('0xb'));var _=require(_0x1c80('0xc'));var squel=require(_0x1c80('0xd'));var crypto=require(_0x1c80('0xe'));var jsforce=require(_0x1c80('0xf'));var deskjs=require(_0x1c80('0x10'));var toCsv=require(_0x1c80('0x9'));var querystring=require(_0x1c80('0x11'));var Papa=require(_0x1c80('0x12'));var Redis=require('ioredis');var authService=require(_0x1c80('0x13'));var qs=require(_0x1c80('0x14'));var as=require(_0x1c80('0x15'));var hardwareService=require(_0x1c80('0x16'));var logger=require(_0x1c80('0x17'))(_0x1c80('0x18'));var utils=require(_0x1c80('0x19'));var config=require(_0x1c80('0x1a'));var licenseUtil=require(_0x1c80('0x1b'));var db=require(_0x1c80('0x1c'))['db'];function respondWithStatusCode(_0x370bbf,_0x1224a5){_0x1224a5=_0x1224a5||0xcc;return function(_0x49ff07){if(_0x49ff07){return _0x370bbf[_0x1c80('0x1d')](_0x1224a5);}return _0x370bbf['status'](_0x1224a5)[_0x1c80('0x1e')]();};}function respondWithResult(_0x28ac53,_0xadc3b3){_0xadc3b3=_0xadc3b3||0xc8;return function(_0x52ca13){if(_0x52ca13){return _0x28ac53['status'](_0xadc3b3)['json'](_0x52ca13);}};}function respondWithFilteredResult(_0x2a557a,_0x346c13){return function(_0x24b2e2){if(_0x24b2e2){var _0x4ddf7d=typeof _0x346c13[_0x1c80('0x1f')]===_0x1c80('0x20')&&typeof _0x346c13[_0x1c80('0x21')]===_0x1c80('0x20');var _0x2f77b8=_0x24b2e2[_0x1c80('0x22')];var _0x5c1c36=_0x4ddf7d?0x0:_0x346c13[_0x1c80('0x1f')];var _0x488f05=_0x4ddf7d?_0x24b2e2[_0x1c80('0x22')]:_0x346c13[_0x1c80('0x1f')]+_0x346c13[_0x1c80('0x21')];var _0x2f8146;if(_0x488f05>=_0x2f77b8){_0x488f05=_0x2f77b8;_0x2f8146=0xc8;}else{_0x2f8146=0xce;}_0x2a557a[_0x1c80('0x23')](_0x2f8146);return _0x2a557a['set'](_0x1c80('0x24'),_0x5c1c36+'-'+_0x488f05+'/'+_0x2f77b8)['json'](_0x24b2e2);}return null;};}function patchUpdates(_0xff016){return function(_0x39b74c){try{jsonpatch['apply'](_0x39b74c,_0xff016,!![]);}catch(_0x1ea9be){return BPromise['reject'](_0x1ea9be);}return _0x39b74c[_0x1c80('0x25')]();};}function saveUpdates(_0x43fefd,_0x9e6e2b){return function(_0x229091){if(_0x229091){return _0x229091[_0x1c80('0x26')](_0x43fefd)['then'](function(_0x3ba99d){return _0x3ba99d;});}return null;};}function removeEntity(_0x353b69,_0x4c9f5a){return function(_0xad4154){if(_0xad4154){return _0xad4154[_0x1c80('0x27')]()[_0x1c80('0x28')](function(){_0x353b69['status'](0xcc)[_0x1c80('0x1e')]();});}};}function handleEntityNotFound(_0xb8c2f0,_0x330cea){return function(_0x593484){if(!_0x593484){_0xb8c2f0['sendStatus'](0x194);}return _0x593484;};}function handleError(_0x5e3b08,_0x575077){_0x575077=_0x575077||0x1f4;return function(_0x255ba7){logger[_0x1c80('0x29')](_0x255ba7[_0x1c80('0x2a')]);if(_0x255ba7['name']){delete _0x255ba7[_0x1c80('0x2b')];}_0x5e3b08['status'](_0x575077)[_0x1c80('0x2c')](_0x255ba7);};}exports[_0x1c80('0x2d')]=function(_0x59e33f,_0x48a541){var _0xb5f81e={},_0x306621={},_0x582887={'count':0x0,'rows':[]};var _0x2d3a8c=_[_0x1c80('0x2e')](db[_0x1c80('0x2f')][_0x1c80('0x30')],function(_0x444dd7){return{'name':_0x444dd7['fieldName'],'type':_0x444dd7[_0x1c80('0x31')][_0x1c80('0x32')]};});_0x306621[_0x1c80('0x33')]=_['map'](_0x2d3a8c,_0x1c80('0x2b'));_0x306621[_0x1c80('0x34')]=_[_0x1c80('0x35')](_0x59e33f['query']);_0x306621[_0x1c80('0x36')]=_[_0x1c80('0x37')](_0x306621[_0x1c80('0x33')],_0x306621[_0x1c80('0x34')]);_0xb5f81e[_0x1c80('0x38')]=_['intersection'](_0x306621[_0x1c80('0x33')],qs['fields'](_0x59e33f[_0x1c80('0x34')][_0x1c80('0x39')]));_0xb5f81e[_0x1c80('0x38')]=_0xb5f81e[_0x1c80('0x38')]['length']?_0xb5f81e[_0x1c80('0x38')]:_0x306621[_0x1c80('0x33')];if(!_0x59e33f[_0x1c80('0x34')][_0x1c80('0x3a')](_0x1c80('0x3b'))){_0xb5f81e[_0x1c80('0x21')]=qs[_0x1c80('0x21')](_0x59e33f[_0x1c80('0x34')][_0x1c80('0x21')]);_0xb5f81e[_0x1c80('0x1f')]=qs['offset'](_0x59e33f[_0x1c80('0x34')][_0x1c80('0x1f')]);}_0xb5f81e[_0x1c80('0x3c')]=qs[_0x1c80('0x3d')](_0x59e33f['query'][_0x1c80('0x3d')]);_0xb5f81e[_0x1c80('0x3e')]=qs[_0x1c80('0x36')](_[_0x1c80('0x3f')](_0x59e33f[_0x1c80('0x34')],_0x306621[_0x1c80('0x36')]),_0x2d3a8c);if(_0x59e33f[_0x1c80('0x34')][_0x1c80('0x40')]){_0xb5f81e[_0x1c80('0x3e')]=_[_0x1c80('0x41')](_0xb5f81e[_0x1c80('0x3e')],{'$or':_[_0x1c80('0x2e')](_0x2d3a8c,function(_0x5260f2){if(_0x5260f2[_0x1c80('0x31')]!==_0x1c80('0x42')){var _0x358515={};_0x358515[_0x5260f2[_0x1c80('0x2b')]]={'$like':'%'+_0x59e33f['query'][_0x1c80('0x40')]+'%'};return _0x358515;}})});}_0xb5f81e=_[_0x1c80('0x41')]({},_0xb5f81e,_0x59e33f[_0x1c80('0x43')]);var _0x143e99={'where':_0xb5f81e[_0x1c80('0x3e')]};return db[_0x1c80('0x2f')][_0x1c80('0x22')](_0x143e99)[_0x1c80('0x28')](function(_0x3639b1){_0x582887['count']=_0x3639b1;if(_0x59e33f['query'][_0x1c80('0x44')]){_0xb5f81e[_0x1c80('0x45')]=[{'all':!![]}];}return db[_0x1c80('0x2f')][_0x1c80('0x46')](_0xb5f81e);})[_0x1c80('0x28')](function(_0x33a7c7){_0x582887[_0x1c80('0x47')]=_0x33a7c7;return _0x582887;})[_0x1c80('0x28')](respondWithFilteredResult(_0x48a541,_0xb5f81e))[_0x1c80('0x48')](handleError(_0x48a541,null));};exports[_0x1c80('0x49')]=function(_0x57563f,_0x3f759b){var _0x132ac8={'raw':!![],'where':{'id':_0x57563f[_0x1c80('0x4a')]['id']}},_0x3add06={};_0x3add06['model']=_['keys'](db[_0x1c80('0x2f')][_0x1c80('0x30')]);_0x3add06[_0x1c80('0x34')]=_['keys'](_0x57563f[_0x1c80('0x34')]);_0x3add06[_0x1c80('0x36')]=_[_0x1c80('0x37')](_0x3add06[_0x1c80('0x33')],_0x3add06[_0x1c80('0x34')]);_0x132ac8['attributes']=_[_0x1c80('0x37')](_0x3add06['model'],qs['fields'](_0x57563f[_0x1c80('0x34')][_0x1c80('0x39')]));_0x132ac8[_0x1c80('0x38')]=_0x132ac8[_0x1c80('0x38')]['length']?_0x132ac8[_0x1c80('0x38')]:_0x3add06['model'];if(_0x57563f['query'][_0x1c80('0x44')]){_0x132ac8['include']=[{'all':!![]}];}_0x132ac8=_[_0x1c80('0x41')]({},_0x132ac8,_0x57563f[_0x1c80('0x43')]);return db[_0x1c80('0x2f')][_0x1c80('0x4b')](_0x132ac8)['then'](handleEntityNotFound(_0x3f759b,null))[_0x1c80('0x28')](respondWithResult(_0x3f759b,null))['catch'](handleError(_0x3f759b,null));};exports['create']=function(_0x3e52ce,_0x192f76){return db[_0x1c80('0x2f')]['create'](_0x3e52ce[_0x1c80('0x4c')],{})[_0x1c80('0x28')](respondWithResult(_0x192f76,0xc9))[_0x1c80('0x48')](handleError(_0x192f76,null));};exports['update']=function(_0x4f7a36,_0x59d309){if(_0x4f7a36['body']['id']){delete _0x4f7a36['body']['id'];}return db[_0x1c80('0x2f')][_0x1c80('0x4b')]({'where':{'id':_0x4f7a36['params']['id']}})[_0x1c80('0x28')](handleEntityNotFound(_0x59d309,null))['then'](saveUpdates(_0x4f7a36[_0x1c80('0x4c')],null))[_0x1c80('0x28')](respondWithResult(_0x59d309,null))['catch'](handleError(_0x59d309,null));};exports[_0x1c80('0x27')]=function(_0x986565,_0x207ac8){return db[_0x1c80('0x2f')][_0x1c80('0x4b')]({'where':{'id':_0x986565[_0x1c80('0x4a')]['id']}})['then'](handleEntityNotFound(_0x207ac8,null))['then'](removeEntity(_0x207ac8,null))[_0x1c80('0x48')](handleError(_0x207ac8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 724de57..b2cfe73 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 _0x651e=['../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x314ddd,_0x22bd22){var _0x3dd016=function(_0x53d776){while(--_0x53d776){_0x314ddd['push'](_0x314ddd['shift']());}};_0x3dd016(++_0x22bd22);}(_0x651e,0x101));var _0xe651=function(_0x42bb29,_0x277699){_0x42bb29=_0x42bb29-0x0;var _0x43f9b3=_0x651e[_0x42bb29];return _0x43f9b3;};'use strict';var _=require(_0xe651('0x0'));var util=require(_0xe651('0x1'));var logger=require(_0xe651('0x2'))('api');var moment=require(_0xe651('0x3'));var BPromise=require(_0xe651('0x4'));var rp=require(_0xe651('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe651('0x6'));var config=require(_0xe651('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xe651('0x8')]=function(_0x45b94b,_0x3e3468){return _0x45b94b[_0xe651('0x9')](_0xe651('0xa'),attributes,{'tableName':_0xe651('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3abe=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','moment','bluebird','request-promise','path'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x3abe,0x125));var _0xe3ab=function(_0x3f2ac1,_0x5ad944){_0x3f2ac1=_0x3f2ac1-0x0;var _0x1539c3=_0x3abe[_0x3f2ac1];return _0x1539c3;};'use strict';var _=require(_0xe3ab('0x0'));var util=require(_0xe3ab('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe3ab('0x2'));var BPromise=require(_0xe3ab('0x3'));var rp=require(_0xe3ab('0x4'));var fs=require('fs');var path=require(_0xe3ab('0x5'));var rimraf=require(_0xe3ab('0x6'));var config=require(_0xe3ab('0x7'));var attributes=require(_0xe3ab('0x8'));module[_0xe3ab('0x9')]=function(_0x3a81f1,_0xe0e486){return _0x3a81f1[_0xe3ab('0xa')](_0xe3ab('0xb'),attributes,{'tableName':_0xe3ab('0xc'),'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 dca5f23..47d6e04 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x10b1c0,_0x4cfb85){var _0x20e53c=function(_0x1c4800){while(--_0x1c4800){_0x10b1c0['push'](_0x10b1c0['shift']());}};_0x20e53c(++_0x4cfb85);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x22b039,_0x5f0203){var _0x4dd9f2=function(_0x1b062f){while(--_0x1b062f){_0x22b039['push'](_0x22b039['shift']());}};_0x4dd9f2(++_0x5f0203);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a4169,_0x53aa8e){_0x5a4169=_0x5a4169-0x0;var _0x3e6b94=_0x5f2f[_0x5a4169];return _0x3e6b94;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a33b13e..da19e85 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 _0x3743=['index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x56c29e,_0x772bc7){var _0x3c817a=function(_0x5a067f){while(--_0x5a067f){_0x56c29e['push'](_0x56c29e['shift']());}};_0x3c817a(++_0x772bc7);}(_0x3743,0x106));var _0x3374=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x3743[_0x4ea6af];return _0x4cb1e6;};'use strict';var multer=require(_0x3374('0x0'));var util=require('util');var path=require(_0x3374('0x1'));var timeout=require(_0x3374('0x2'));var express=require(_0x3374('0x3'));var router=express[_0x3374('0x4')]();var fs_extra=require(_0x3374('0x5'));var auth=require(_0x3374('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3374('0x7'));var controller=require(_0x3374('0x8'));router[_0x3374('0x9')]('/',auth[_0x3374('0xa')](),controller[_0x3374('0xb')]);router['get'](_0x3374('0xc'),auth[_0x3374('0xa')](),controller['describe']);router[_0x3374('0x9')](_0x3374('0xd'),auth[_0x3374('0xa')](),controller[_0x3374('0xe')]);router['post']('/',auth[_0x3374('0xa')](),controller[_0x3374('0xf')]);router[_0x3374('0x10')](_0x3374('0xd'),auth[_0x3374('0xa')](),controller[_0x3374('0x11')]);router[_0x3374('0x12')](_0x3374('0xd'),auth[_0x3374('0xa')](),controller[_0x3374('0x13')]);module[_0x3374('0x14')]=router; \ No newline at end of file +var _0x021c=['index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated'];(function(_0x2c9871,_0xe896ff){var _0x270b78=function(_0xc9803d){while(--_0xc9803d){_0x2c9871['push'](_0x2c9871['shift']());}};_0x270b78(++_0xe896ff);}(_0x021c,0x123));var _0xc021=function(_0x5c2bef,_0x16806e){_0x5c2bef=_0x5c2bef-0x0;var _0xd60cc1=_0x021c[_0x5c2bef];return _0xd60cc1;};'use strict';var multer=require(_0xc021('0x0'));var util=require('util');var path=require(_0xc021('0x1'));var timeout=require(_0xc021('0x2'));var express=require(_0xc021('0x3'));var router=express['Router']();var fs_extra=require(_0xc021('0x4'));var auth=require(_0xc021('0x5'));var interaction=require(_0xc021('0x6'));var config=require('../../config/environment');var controller=require(_0xc021('0x7'));router['get']('/',auth[_0xc021('0x8')](),controller[_0xc021('0x9')]);router[_0xc021('0xa')](_0xc021('0xb'),auth['isAuthenticated'](),controller[_0xc021('0xc')]);router[_0xc021('0xa')](_0xc021('0xd'),auth['isAuthenticated'](),controller[_0xc021('0xe')]);router['post']('/',auth[_0xc021('0x8')](),controller['create']);router[_0xc021('0xf')](_0xc021('0xd'),auth['isAuthenticated'](),controller[_0xc021('0x10')]);router[_0xc021('0x11')](_0xc021('0xd'),auth[_0xc021('0x8')](),controller[_0xc021('0x12')]);module[_0xc021('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4d0edef..324ac37 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 _0x3e24=['exports','STRING','name','sequelize'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x3e24,0x167));var _0x43e2=function(_0x575941,_0x4023a6){_0x575941=_0x575941-0x0;var _0xe3076c=_0x3e24[_0x575941];return _0xe3076c;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')],'unique':_0x43e2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43e2('0x2')]}}; \ No newline at end of file +var _0x9fe7=['exports','name','sequelize'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0x9fe7,0x1df));var _0x79fe=function(_0x8d7c19,_0x49500d){_0x8d7c19=_0x8d7c19-0x0;var _0x5ed8c9=_0x9fe7[_0x8d7c19];return _0x5ed8c9;};'use strict';var Sequelize=require(_0x79fe('0x0'));module[_0x79fe('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x79fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3f72a6b..ce83a5e 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 _0x805f=['limit','set','Content-Range','json','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','type','VIRTUAL','filter','options','MailSubstatus','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count'];(function(_0x396a35,_0x5ec210){var _0x5651ad=function(_0x1c9fa6){while(--_0x1c9fa6){_0x396a35['push'](_0x396a35['shift']());}};_0x5651ad(++_0x5ec210);}(_0x805f,0xbd));var _0xf805=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x805f[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xf805('0x0'));var rimraf=require(_0xf805('0x1'));var zipdir=require(_0xf805('0x2'));var jsonpatch=require(_0xf805('0x3'));var rp=require(_0xf805('0x4'));var moment=require(_0xf805('0x5'));var BPromise=require(_0xf805('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf805('0x7'));var sox=require(_0xf805('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf805('0x9'));var _=require(_0xf805('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf805('0xb'));var deskjs=require(_0xf805('0xc'));var toCsv=require(_0xf805('0xd'));var querystring=require(_0xf805('0xe'));var Papa=require(_0xf805('0xf'));var Redis=require('ioredis');var authService=require(_0xf805('0x10'));var qs=require(_0xf805('0x11'));var as=require(_0xf805('0x12'));var hardwareService=require(_0xf805('0x13'));var logger=require(_0xf805('0x14'))(_0xf805('0x15'));var utils=require('../../config/utils');var config=require(_0xf805('0x16'));var licenseUtil=require(_0xf805('0x17'));var db=require(_0xf805('0x18'))['db'];function respondWithStatusCode(_0x2e2ba9,_0x1e5b24){_0x1e5b24=_0x1e5b24||0xcc;return function(_0x5bfdb5){if(_0x5bfdb5){return _0x2e2ba9['sendStatus'](_0x1e5b24);}return _0x2e2ba9[_0xf805('0x19')](_0x1e5b24)[_0xf805('0x1a')]();};}function respondWithResult(_0xf55e96,_0xd4821d){_0xd4821d=_0xd4821d||0xc8;return function(_0x569964){if(_0x569964){return _0xf55e96[_0xf805('0x19')](_0xd4821d)['json'](_0x569964);}};}function respondWithFilteredResult(_0x35173b,_0x4aec17){return function(_0x3ac025){if(_0x3ac025){var _0x401e3f=typeof _0x4aec17[_0xf805('0x1b')]===_0xf805('0x1c')&&typeof _0x4aec17['limit']===_0xf805('0x1c');var _0x2d907d=_0x3ac025[_0xf805('0x1d')];var _0x58af6f=_0x401e3f?0x0:_0x4aec17[_0xf805('0x1b')];var _0x562631=_0x401e3f?_0x3ac025[_0xf805('0x1d')]:_0x4aec17[_0xf805('0x1b')]+_0x4aec17[_0xf805('0x1e')];var _0x2451c8;if(_0x562631>=_0x2d907d){_0x562631=_0x2d907d;_0x2451c8=0xc8;}else{_0x2451c8=0xce;}_0x35173b[_0xf805('0x19')](_0x2451c8);return _0x35173b[_0xf805('0x1f')](_0xf805('0x20'),_0x58af6f+'-'+_0x562631+'/'+_0x2d907d)[_0xf805('0x21')](_0x3ac025);}return null;};}function patchUpdates(_0x4e942a){return function(_0x38659a){try{jsonpatch['apply'](_0x38659a,_0x4e942a,!![]);}catch(_0x2395c7){return BPromise['reject'](_0x2395c7);}return _0x38659a['save']();};}function saveUpdates(_0x255aab,_0x24a389){return function(_0x3d660c){if(_0x3d660c){return _0x3d660c[_0xf805('0x22')](_0x255aab)[_0xf805('0x23')](function(_0x273f42){return _0x273f42;});}return null;};}function removeEntity(_0x383a13,_0x4a7f16){return function(_0x580298){if(_0x580298){return _0x580298[_0xf805('0x24')]()['then'](function(){_0x383a13['status'](0xcc)[_0xf805('0x1a')]();});}};}function handleEntityNotFound(_0x24bd4e,_0x230b3b){return function(_0x2468cb){if(!_0x2468cb){_0x24bd4e['sendStatus'](0x194);}return _0x2468cb;};}function handleError(_0x5708d0,_0x4e8e06){_0x4e8e06=_0x4e8e06||0x1f4;return function(_0x1d6437){logger[_0xf805('0x25')](_0x1d6437[_0xf805('0x26')]);if(_0x1d6437[_0xf805('0x27')]){delete _0x1d6437['name'];}_0x5708d0[_0xf805('0x19')](_0x4e8e06)['send'](_0x1d6437);};}exports[_0xf805('0x28')]=function(_0x6dd7dd,_0x17f6e3){var _0x1980dd={},_0x414fa1={},_0x4e63b1={'count':0x0,'rows':[]};var _0x2a61a6=_['map'](db['MailSubstatus'][_0xf805('0x29')],function(_0x129a73){return{'name':_0x129a73[_0xf805('0x2a')],'type':_0x129a73['type'][_0xf805('0x2b')]};});_0x414fa1[_0xf805('0x2c')]=_[_0xf805('0x2d')](_0x2a61a6,_0xf805('0x27'));_0x414fa1[_0xf805('0x2e')]=_[_0xf805('0x2f')](_0x6dd7dd[_0xf805('0x2e')]);_0x414fa1[_0xf805('0x30')]=_[_0xf805('0x31')](_0x414fa1[_0xf805('0x2c')],_0x414fa1[_0xf805('0x2e')]);_0x1980dd[_0xf805('0x32')]=_[_0xf805('0x31')](_0x414fa1['model'],qs[_0xf805('0x33')](_0x6dd7dd[_0xf805('0x2e')][_0xf805('0x33')]));_0x1980dd[_0xf805('0x32')]=_0x1980dd[_0xf805('0x32')][_0xf805('0x34')]?_0x1980dd['attributes']:_0x414fa1[_0xf805('0x2c')];if(!_0x6dd7dd[_0xf805('0x2e')]['hasOwnProperty'](_0xf805('0x35'))){_0x1980dd[_0xf805('0x1e')]=qs['limit'](_0x6dd7dd['query'][_0xf805('0x1e')]);_0x1980dd[_0xf805('0x1b')]=qs[_0xf805('0x1b')](_0x6dd7dd[_0xf805('0x2e')]['offset']);}_0x1980dd['order']=qs[_0xf805('0x36')](_0x6dd7dd['query'][_0xf805('0x36')]);_0x1980dd[_0xf805('0x37')]=qs['filters'](_['pick'](_0x6dd7dd[_0xf805('0x2e')],_0x414fa1['filters']),_0x2a61a6);if(_0x6dd7dd[_0xf805('0x2e')]['filter']){_0x1980dd[_0xf805('0x37')]=_[_0xf805('0x38')](_0x1980dd['where'],{'$or':_[_0xf805('0x2d')](_0x2a61a6,function(_0x72ed87){if(_0x72ed87[_0xf805('0x39')]!==_0xf805('0x3a')){var _0x41a256={};_0x41a256[_0x72ed87[_0xf805('0x27')]]={'$like':'%'+_0x6dd7dd['query'][_0xf805('0x3b')]+'%'};return _0x41a256;}})});}_0x1980dd=_[_0xf805('0x38')]({},_0x1980dd,_0x6dd7dd[_0xf805('0x3c')]);var _0x5d0a32={'where':_0x1980dd['where']};return db[_0xf805('0x3d')][_0xf805('0x1d')](_0x5d0a32)[_0xf805('0x23')](function(_0x3da7d2){_0x4e63b1['count']=_0x3da7d2;if(_0x6dd7dd[_0xf805('0x2e')]['includeAll']){_0x1980dd[_0xf805('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0xf805('0x3f')](_0x1980dd);})[_0xf805('0x23')](function(_0xce98e8){_0x4e63b1[_0xf805('0x40')]=_0xce98e8;return _0x4e63b1;})['then'](respondWithFilteredResult(_0x17f6e3,_0x1980dd))[_0xf805('0x41')](handleError(_0x17f6e3,null));};exports[_0xf805('0x42')]=function(_0x536137,_0x4c9bc0){var _0x2938db={'raw':!![],'where':{'id':_0x536137[_0xf805('0x43')]['id']}},_0x9b147e={};_0x9b147e[_0xf805('0x2c')]=_[_0xf805('0x2f')](db[_0xf805('0x3d')][_0xf805('0x29')]);_0x9b147e['query']=_[_0xf805('0x2f')](_0x536137['query']);_0x9b147e[_0xf805('0x30')]=_[_0xf805('0x31')](_0x9b147e[_0xf805('0x2c')],_0x9b147e[_0xf805('0x2e')]);_0x2938db[_0xf805('0x32')]=_[_0xf805('0x31')](_0x9b147e['model'],qs[_0xf805('0x33')](_0x536137[_0xf805('0x2e')][_0xf805('0x33')]));_0x2938db[_0xf805('0x32')]=_0x2938db[_0xf805('0x32')]['length']?_0x2938db[_0xf805('0x32')]:_0x9b147e[_0xf805('0x2c')];if(_0x536137[_0xf805('0x2e')][_0xf805('0x44')]){_0x2938db[_0xf805('0x3e')]=[{'all':!![]}];}_0x2938db=_[_0xf805('0x38')]({},_0x2938db,_0x536137[_0xf805('0x3c')]);return db['MailSubstatus'][_0xf805('0x45')](_0x2938db)[_0xf805('0x23')](handleEntityNotFound(_0x4c9bc0,null))[_0xf805('0x23')](respondWithResult(_0x4c9bc0,null))[_0xf805('0x41')](handleError(_0x4c9bc0,null));};exports[_0xf805('0x46')]=function(_0x1fdcb6,_0x489b08){return db[_0xf805('0x3d')][_0xf805('0x46')](_0x1fdcb6[_0xf805('0x47')],{})[_0xf805('0x23')](respondWithResult(_0x489b08,0xc9))[_0xf805('0x41')](handleError(_0x489b08,null));};exports['update']=function(_0x5141fe,_0x44558e){if(_0x5141fe[_0xf805('0x47')]['id']){delete _0x5141fe['body']['id'];}return db[_0xf805('0x3d')][_0xf805('0x45')]({'where':{'id':_0x5141fe[_0xf805('0x43')]['id']}})['then'](handleEntityNotFound(_0x44558e,null))[_0xf805('0x23')](saveUpdates(_0x5141fe[_0xf805('0x47')],null))['then'](respondWithResult(_0x44558e,null))[_0xf805('0x41')](handleError(_0x44558e,null));};exports[_0xf805('0x24')]=function(_0x2ec104,_0xd149e1){return db[_0xf805('0x3d')][_0xf805('0x45')]({'where':{'id':_0x2ec104['params']['id']}})[_0xf805('0x23')](handleEntityNotFound(_0xd149e1,null))['then'](removeEntity(_0xd149e1,null))[_0xf805('0x41')](handleError(_0xd149e1,null));};exports[_0xf805('0x48')]=function(_0xfcb2c4,_0x19617a){return db[_0xf805('0x3d')][_0xf805('0x48')]()[_0xf805('0x23')](respondWithResult(_0x19617a,null))[_0xf805('0x41')](handleError(_0x19617a,null));}; \ No newline at end of file +var _0x3317=['model','query','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','filters','intersection'];(function(_0x26dc96,_0x10c6f5){var _0x30b7be=function(_0x47de22){while(--_0x47de22){_0x26dc96['push'](_0x26dc96['shift']());}};_0x30b7be(++_0x10c6f5);}(_0x3317,0xeb));var _0x7331=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x3317[_0x474bc0];return _0x4b24cf;};'use strict';var emlformat=require(_0x7331('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7331('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7331('0x2'));var moment=require('moment');var BPromise=require(_0x7331('0x3'));var Mustache=require('mustache');var util=require(_0x7331('0x4'));var path=require('path');var sox=require(_0x7331('0x5'));var csv=require(_0x7331('0x6'));var ejs=require(_0x7331('0x7'));var fs=require('fs');var fs_extra=require(_0x7331('0x8'));var _=require(_0x7331('0x9'));var squel=require(_0x7331('0xa'));var crypto=require(_0x7331('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7331('0x6'));var querystring=require(_0x7331('0xc'));var Papa=require(_0x7331('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7331('0xe'));var hardwareService=require(_0x7331('0xf'));var logger=require(_0x7331('0x10'))(_0x7331('0x11'));var utils=require(_0x7331('0x12'));var config=require(_0x7331('0x13'));var licenseUtil=require(_0x7331('0x14'));var db=require(_0x7331('0x15'))['db'];function respondWithStatusCode(_0xa9f7de,_0x258891){_0x258891=_0x258891||0xcc;return function(_0x5ac831){if(_0x5ac831){return _0xa9f7de['sendStatus'](_0x258891);}return _0xa9f7de[_0x7331('0x16')](_0x258891)['end']();};}function respondWithResult(_0x1888bd,_0x3d9f0b){_0x3d9f0b=_0x3d9f0b||0xc8;return function(_0x527305){if(_0x527305){return _0x1888bd[_0x7331('0x16')](_0x3d9f0b)[_0x7331('0x17')](_0x527305);}};}function respondWithFilteredResult(_0x442929,_0x2b1d5f){return function(_0x28c0df){if(_0x28c0df){var _0x24c113=typeof _0x2b1d5f['offset']===_0x7331('0x18')&&typeof _0x2b1d5f[_0x7331('0x19')]===_0x7331('0x18');var _0x4fd656=_0x28c0df[_0x7331('0x1a')];var _0x10d092=_0x24c113?0x0:_0x2b1d5f[_0x7331('0x1b')];var _0x135979=_0x24c113?_0x28c0df['count']:_0x2b1d5f[_0x7331('0x1b')]+_0x2b1d5f[_0x7331('0x19')];var _0x40a9a3;if(_0x135979>=_0x4fd656){_0x135979=_0x4fd656;_0x40a9a3=0xc8;}else{_0x40a9a3=0xce;}_0x442929['status'](_0x40a9a3);return _0x442929[_0x7331('0x1c')](_0x7331('0x1d'),_0x10d092+'-'+_0x135979+'/'+_0x4fd656)[_0x7331('0x17')](_0x28c0df);}return null;};}function patchUpdates(_0x21dcd9){return function(_0x571a4c){try{jsonpatch['apply'](_0x571a4c,_0x21dcd9,!![]);}catch(_0x4f8439){return BPromise[_0x7331('0x1e')](_0x4f8439);}return _0x571a4c[_0x7331('0x1f')]();};}function saveUpdates(_0x5970ed,_0x141493){return function(_0x4b496e){if(_0x4b496e){return _0x4b496e['update'](_0x5970ed)[_0x7331('0x20')](function(_0x1b61fa){return _0x1b61fa;});}return null;};}function removeEntity(_0x4bf16f,_0x1699e2){return function(_0x4dd86f){if(_0x4dd86f){return _0x4dd86f[_0x7331('0x21')]()[_0x7331('0x20')](function(){_0x4bf16f[_0x7331('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30bc86,_0x4de731){return function(_0x36ef01){if(!_0x36ef01){_0x30bc86[_0x7331('0x22')](0x194);}return _0x36ef01;};}function handleError(_0x402b93,_0x4ed702){_0x4ed702=_0x4ed702||0x1f4;return function(_0x3f497a){logger['error'](_0x3f497a[_0x7331('0x23')]);if(_0x3f497a[_0x7331('0x24')]){delete _0x3f497a[_0x7331('0x24')];}_0x402b93[_0x7331('0x16')](_0x4ed702)[_0x7331('0x25')](_0x3f497a);};}exports['index']=function(_0x2d4144,_0x316ebd){var _0x287687={},_0x4d0051={},_0x3494dd={'count':0x0,'rows':[]};var _0x4e4917=_[_0x7331('0x26')](db[_0x7331('0x27')][_0x7331('0x28')],function(_0x4cfa3b){return{'name':_0x4cfa3b[_0x7331('0x29')],'type':_0x4cfa3b['type'][_0x7331('0x2a')]};});_0x4d0051['model']=_[_0x7331('0x26')](_0x4e4917,'name');_0x4d0051['query']=_['keys'](_0x2d4144['query']);_0x4d0051[_0x7331('0x2b')]=_[_0x7331('0x2c')](_0x4d0051[_0x7331('0x2d')],_0x4d0051[_0x7331('0x2e')]);_0x287687['attributes']=_[_0x7331('0x2c')](_0x4d0051[_0x7331('0x2d')],qs['fields'](_0x2d4144['query'][_0x7331('0x2f')]));_0x287687[_0x7331('0x30')]=_0x287687['attributes']['length']?_0x287687['attributes']:_0x4d0051[_0x7331('0x2d')];if(!_0x2d4144['query'][_0x7331('0x31')]('nolimit')){_0x287687['limit']=qs[_0x7331('0x19')](_0x2d4144['query']['limit']);_0x287687[_0x7331('0x1b')]=qs[_0x7331('0x1b')](_0x2d4144['query']['offset']);}_0x287687['order']=qs[_0x7331('0x32')](_0x2d4144[_0x7331('0x2e')]['sort']);_0x287687[_0x7331('0x33')]=qs['filters'](_[_0x7331('0x34')](_0x2d4144[_0x7331('0x2e')],_0x4d0051[_0x7331('0x2b')]),_0x4e4917);if(_0x2d4144[_0x7331('0x2e')][_0x7331('0x35')]){_0x287687[_0x7331('0x33')]=_[_0x7331('0x36')](_0x287687['where'],{'$or':_['map'](_0x4e4917,function(_0x53e11e){if(_0x53e11e['type']!==_0x7331('0x37')){var _0x2a8276={};_0x2a8276[_0x53e11e['name']]={'$like':'%'+_0x2d4144['query']['filter']+'%'};return _0x2a8276;}})});}_0x287687=_[_0x7331('0x36')]({},_0x287687,_0x2d4144[_0x7331('0x38')]);var _0x5a9a1a={'where':_0x287687['where']};return db[_0x7331('0x27')][_0x7331('0x1a')](_0x5a9a1a)[_0x7331('0x20')](function(_0x223263){_0x3494dd[_0x7331('0x1a')]=_0x223263;if(_0x2d4144[_0x7331('0x2e')][_0x7331('0x39')]){_0x287687[_0x7331('0x3a')]=[{'all':!![]}];}return db['MailSubstatus'][_0x7331('0x3b')](_0x287687);})['then'](function(_0x438f68){_0x3494dd[_0x7331('0x3c')]=_0x438f68;return _0x3494dd;})['then'](respondWithFilteredResult(_0x316ebd,_0x287687))[_0x7331('0x3d')](handleError(_0x316ebd,null));};exports[_0x7331('0x3e')]=function(_0x34763d,_0x597374){var _0x3a167d={'raw':!![],'where':{'id':_0x34763d[_0x7331('0x3f')]['id']}},_0x14bc66={};_0x14bc66[_0x7331('0x2d')]=_['keys'](db[_0x7331('0x27')][_0x7331('0x28')]);_0x14bc66[_0x7331('0x2e')]=_[_0x7331('0x40')](_0x34763d['query']);_0x14bc66[_0x7331('0x2b')]=_[_0x7331('0x2c')](_0x14bc66[_0x7331('0x2d')],_0x14bc66['query']);_0x3a167d['attributes']=_[_0x7331('0x2c')](_0x14bc66[_0x7331('0x2d')],qs[_0x7331('0x2f')](_0x34763d[_0x7331('0x2e')][_0x7331('0x2f')]));_0x3a167d[_0x7331('0x30')]=_0x3a167d['attributes']['length']?_0x3a167d[_0x7331('0x30')]:_0x14bc66[_0x7331('0x2d')];if(_0x34763d['query'][_0x7331('0x39')]){_0x3a167d[_0x7331('0x3a')]=[{'all':!![]}];}_0x3a167d=_[_0x7331('0x36')]({},_0x3a167d,_0x34763d[_0x7331('0x38')]);return db[_0x7331('0x27')][_0x7331('0x41')](_0x3a167d)[_0x7331('0x20')](handleEntityNotFound(_0x597374,null))[_0x7331('0x20')](respondWithResult(_0x597374,null))[_0x7331('0x3d')](handleError(_0x597374,null));};exports['create']=function(_0x2fc72c,_0x314c1b){return db[_0x7331('0x27')][_0x7331('0x42')](_0x2fc72c[_0x7331('0x43')],{})['then'](respondWithResult(_0x314c1b,0xc9))['catch'](handleError(_0x314c1b,null));};exports[_0x7331('0x44')]=function(_0x23dfea,_0x1d8ec1){if(_0x23dfea[_0x7331('0x43')]['id']){delete _0x23dfea[_0x7331('0x43')]['id'];}return db[_0x7331('0x27')][_0x7331('0x41')]({'where':{'id':_0x23dfea[_0x7331('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1d8ec1,null))[_0x7331('0x20')](saveUpdates(_0x23dfea['body'],null))['then'](respondWithResult(_0x1d8ec1,null))['catch'](handleError(_0x1d8ec1,null));};exports[_0x7331('0x21')]=function(_0x2b7434,_0x1a0598){return db[_0x7331('0x27')]['find']({'where':{'id':_0x2b7434['params']['id']}})['then'](handleEntityNotFound(_0x1a0598,null))[_0x7331('0x20')](removeEntity(_0x1a0598,null))[_0x7331('0x3d')](handleError(_0x1a0598,null));};exports['describe']=function(_0x2fcbae,_0x4e935f){return db[_0x7331('0x27')][_0x7331('0x45')]()[_0x7331('0x20')](respondWithResult(_0x4e935f,null))[_0x7331('0x3d')](handleError(_0x4e935f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ac493b7..4c1302c 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 _0x5fa2=['MailSubstatus','mail_substatuses','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailSubstatus.attributes','define'];(function(_0x125703,_0x46989c){var _0x1a954b=function(_0x1fdbb1){while(--_0x1fdbb1){_0x125703['push'](_0x125703['shift']());}};_0x1a954b(++_0x46989c);}(_0x5fa2,0x14c));var _0x25fa=function(_0x297c57,_0x1063c2){_0x297c57=_0x297c57-0x0;var _0x183508=_0x5fa2[_0x297c57];return _0x183508;};'use strict';var _=require('lodash');var util=require(_0x25fa('0x0'));var logger=require(_0x25fa('0x1'))('api');var moment=require(_0x25fa('0x2'));var BPromise=require(_0x25fa('0x3'));var rp=require(_0x25fa('0x4'));var fs=require('fs');var path=require(_0x25fa('0x5'));var rimraf=require('rimraf');var config=require(_0x25fa('0x6'));var attributes=require(_0x25fa('0x7'));module['exports']=function(_0x38f418,_0x203c95){return _0x38f418[_0x25fa('0x8')](_0x25fa('0x9'),attributes,{'tableName':_0x25fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb00c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash'];(function(_0x222c72,_0x305ed9){var _0x33eb4b=function(_0x423136){while(--_0x423136){_0x222c72['push'](_0x222c72['shift']());}};_0x33eb4b(++_0x305ed9);}(_0xb00c,0x15d));var _0xcb00=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0xb00c[_0x590b61];return _0x1a14dc;};'use strict';var _=require(_0xcb00('0x0'));var util=require(_0xcb00('0x1'));var logger=require(_0xcb00('0x2'))(_0xcb00('0x3'));var moment=require(_0xcb00('0x4'));var BPromise=require(_0xcb00('0x5'));var rp=require(_0xcb00('0x6'));var fs=require('fs');var path=require(_0xcb00('0x7'));var rimraf=require(_0xcb00('0x8'));var config=require(_0xcb00('0x9'));var attributes=require(_0xcb00('0xa'));module[_0xcb00('0xb')]=function(_0x1403ca,_0x191ddc){return _0x1403ca['define'](_0xcb00('0xc'),attributes,{'tableName':_0xcb00('0xd'),'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 7bf09df..5d5f55f 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 _0x62df=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x62df,0x108));var _0xf62d=function(_0x285c60,_0x1bdb42){_0x285c60=_0x285c60-0x0;var _0x511001=_0x62df[_0x285c60];return _0x511001;};'use strict';var _=require(_0xf62d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf62d('0x1'));var rs=require(_0xf62d('0x2'));var fs=require('fs');var Redis=require(_0xf62d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf62d('0x4'));var logger=require(_0xf62d('0x5'))(_0xf62d('0x6'));var config=require('../../config/environment');var jayson=require(_0xf62d('0x7'));var client=jayson['client'][_0xf62d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e19f0,_0x474e14,_0x411fef){return new BPromise(function(_0x5616f4,_0x4f94fb){return client[_0xf62d('0x9')](_0x1e19f0,_0x411fef)['then'](function(_0x1d1538){logger[_0xf62d('0xa')](_0xf62d('0xb'),_0x474e14,_0xf62d('0xc'));logger[_0xf62d('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x474e14,_0xf62d('0xc'),JSON[_0xf62d('0xe')](_0x1d1538));if(_0x1d1538[_0xf62d('0xf')]){if(_0x1d1538[_0xf62d('0xf')][_0xf62d('0x10')]===0x1f4){logger['error'](_0xf62d('0xb'),_0x474e14,_0x1d1538['error'][_0xf62d('0x11')]);return _0x4f94fb(_0x1d1538[_0xf62d('0xf')][_0xf62d('0x11')]);}logger[_0xf62d('0xf')](_0xf62d('0xb'),_0x474e14,_0x1d1538[_0xf62d('0xf')][_0xf62d('0x11')]);return _0x5616f4(_0x1d1538['error'][_0xf62d('0x11')]);}else{logger[_0xf62d('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x474e14,'request\x20sent');_0x5616f4(_0x1d1538['result']['message']);}})[_0xf62d('0x12')](function(_0x5d6891){logger[_0xf62d('0xf')](_0xf62d('0xb'),_0x474e14,_0x5d6891);_0x4f94fb(_0x5d6891);});});} \ No newline at end of file +var _0x8697=['debug','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x494729,_0x5e7943){var _0x5223bf=function(_0x3f6fd5){while(--_0x3f6fd5){_0x494729['push'](_0x494729['shift']());}};_0x5223bf(++_0x5e7943);}(_0x8697,0x140));var _0x7869=function(_0x52c2f2,_0x42714f){_0x52c2f2=_0x52c2f2-0x0;var _0x5bf73f=_0x8697[_0x52c2f2];return _0x5bf73f;};'use strict';var _=require(_0x7869('0x0'));var util=require('util');var moment=require(_0x7869('0x1'));var BPromise=require(_0x7869('0x2'));var rs=require(_0x7869('0x3'));var fs=require('fs');var Redis=require(_0x7869('0x4'));var db=require(_0x7869('0x5'))['db'];var utils=require(_0x7869('0x6'));var logger=require(_0x7869('0x7'))(_0x7869('0x8'));var config=require(_0x7869('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7869('0xa')][_0x7869('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xca4b03,_0x5a4692,_0x2535ca){return new BPromise(function(_0x552c6a,_0x47b49e){return client['request'](_0xca4b03,_0x2535ca)[_0x7869('0xc')](function(_0x5b80bc){logger[_0x7869('0xd')](_0x7869('0xe'),_0x5a4692,_0x7869('0xf'));logger[_0x7869('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x5a4692,_0x7869('0xf'),JSON[_0x7869('0x11')](_0x5b80bc));if(_0x5b80bc[_0x7869('0x12')]){if(_0x5b80bc[_0x7869('0x12')]['code']===0x1f4){logger[_0x7869('0x12')](_0x7869('0xe'),_0x5a4692,_0x5b80bc['error'][_0x7869('0x13')]);return _0x47b49e(_0x5b80bc['error'][_0x7869('0x13')]);}logger[_0x7869('0x12')](_0x7869('0xe'),_0x5a4692,_0x5b80bc[_0x7869('0x12')][_0x7869('0x13')]);return _0x552c6a(_0x5b80bc['error'][_0x7869('0x13')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x5a4692,_0x7869('0xf'));_0x552c6a(_0x5b80bc['result'][_0x7869('0x13')]);}})[_0x7869('0x14')](function(_0xaaa44a){logger[_0x7869('0x12')](_0x7869('0xe'),_0x5a4692,_0xaaa44a);_0x47b49e(_0xaaa44a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 74875e7..7d1438c 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 _0xc79c=['express','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4b6132,_0x37463d){var _0x34a4a8=function(_0x3309d1){while(--_0x3309d1){_0x4b6132['push'](_0x4b6132['shift']());}};_0x34a4a8(++_0x37463d);}(_0xc79c,0x162));var _0xcc79=function(_0x2e4a04,_0x2e8ee6){_0x2e4a04=_0x2e4a04-0x0;var _0x139b44=_0xc79c[_0x2e4a04];return _0x139b44;};'use strict';var multer=require(_0xcc79('0x0'));var util=require(_0xcc79('0x1'));var path=require(_0xcc79('0x2'));var timeout=require('connect-timeout');var express=require(_0xcc79('0x3'));var router=express['Router']();var fs_extra=require(_0xcc79('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcc79('0x5'));var config=require(_0xcc79('0x6'));var controller=require(_0xcc79('0x7'));router['get']('/',auth[_0xcc79('0x8')](),controller['index']);router['get'](_0xcc79('0x9'),auth[_0xcc79('0x8')](),controller[_0xcc79('0xa')]);router[_0xcc79('0xb')](_0xcc79('0xc'),auth[_0xcc79('0x8')](),controller[_0xcc79('0xd')]);router[_0xcc79('0xe')]('/',auth[_0xcc79('0x8')](),controller[_0xcc79('0xf')]);router[_0xcc79('0x10')]('/:id',auth[_0xcc79('0x8')](),controller[_0xcc79('0x11')]);router[_0xcc79('0x12')](_0xcc79('0xc'),auth[_0xcc79('0x8')](),controller[_0xcc79('0x13')]);module[_0xcc79('0x14')]=router; \ No newline at end of file +var _0x4c69=['/:id','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update'];(function(_0x4275d5,_0x4a0e7f){var _0x4876ef=function(_0x506625){while(--_0x506625){_0x4275d5['push'](_0x4275d5['shift']());}};_0x4876ef(++_0x4a0e7f);}(_0x4c69,0xca));var _0x94c6=function(_0x5f2a0b,_0x1e6313){_0x5f2a0b=_0x5f2a0b-0x0;var _0x5cfb2c=_0x4c69[_0x5f2a0b];return _0x5cfb2c;};'use strict';var multer=require(_0x94c6('0x0'));var util=require(_0x94c6('0x1'));var path=require('path');var timeout=require(_0x94c6('0x2'));var express=require(_0x94c6('0x3'));var router=express['Router']();var fs_extra=require(_0x94c6('0x4'));var auth=require(_0x94c6('0x5'));var interaction=require(_0x94c6('0x6'));var config=require(_0x94c6('0x7'));var controller=require(_0x94c6('0x8'));router[_0x94c6('0x9')]('/',auth[_0x94c6('0xa')](),controller[_0x94c6('0xb')]);router['get'](_0x94c6('0xc'),auth[_0x94c6('0xa')](),controller[_0x94c6('0xd')]);router['get']('/:id',auth[_0x94c6('0xa')](),controller[_0x94c6('0xe')]);router[_0x94c6('0xf')]('/',auth[_0x94c6('0xa')](),controller['create']);router[_0x94c6('0x10')]('/:id',auth[_0x94c6('0xa')](),controller[_0x94c6('0x11')]);router['delete'](_0x94c6('0x12'),auth[_0x94c6('0xa')](),controller['destroy']);module[_0x94c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3cbf212..b8494e0 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xc474de,_0x5a5acb){var _0x41f8ba=function(_0x3d2de0){while(--_0x3d2de0){_0xc474de['push'](_0xc474de['shift']());}};_0x41f8ba(++_0x5a5acb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x00bb[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5c701b,_0x32de1a){var _0x146fe5=function(_0x2da478){while(--_0x2da478){_0x5c701b['push'](_0x5c701b['shift']());}};_0x146fe5(++_0x32de1a);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b073c,_0x22e23c){_0x3b073c=_0x3b073c-0x0;var _0x3945e0=_0xedd9[_0x3b073c];return _0x3945e0;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f872033..fd77194 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 _0x4c6d=['includeAll','include','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0x4c6d,0xa2));var _0xd4c6=function(_0x3ef6d9,_0x278ae7){_0x3ef6d9=_0x3ef6d9-0x0;var _0xe90126=_0x4c6d[_0x3ef6d9];return _0xe90126;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd4c6('0x4'));var Mustache=require(_0xd4c6('0x5'));var util=require(_0xd4c6('0x6'));var path=require(_0xd4c6('0x7'));var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require(_0xd4c6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4c6('0xb'));var squel=require('squel');var crypto=require(_0xd4c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd4c6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd4c6('0xe'));var Papa=require('papaparse');var Redis=require(_0xd4c6('0xf'));var authService=require(_0xd4c6('0x10'));var qs=require(_0xd4c6('0x11'));var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require('../../config/utils');var config=require(_0xd4c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4c6('0x17'))['db'];function respondWithStatusCode(_0x31c28a,_0x2e5984){_0x2e5984=_0x2e5984||0xcc;return function(_0xbdd490){if(_0xbdd490){return _0x31c28a[_0xd4c6('0x18')](_0x2e5984);}return _0x31c28a[_0xd4c6('0x19')](_0x2e5984)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x5afc16,_0x5dba50){_0x5dba50=_0x5dba50||0xc8;return function(_0x135efe){if(_0x135efe){return _0x5afc16['status'](_0x5dba50)['json'](_0x135efe);}};}function respondWithFilteredResult(_0x166739,_0x2470a1){return function(_0x52fafe){if(_0x52fafe){var _0x186c92=typeof _0x2470a1[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x2470a1['limit']===_0xd4c6('0x1c');var _0x2c8e9f=_0x52fafe[_0xd4c6('0x1d')];var _0x35dcbe=_0x186c92?0x0:_0x2470a1[_0xd4c6('0x1b')];var _0x1d7eff=_0x186c92?_0x52fafe[_0xd4c6('0x1d')]:_0x2470a1['offset']+_0x2470a1[_0xd4c6('0x1e')];var _0x4f2795;if(_0x1d7eff>=_0x2c8e9f){_0x1d7eff=_0x2c8e9f;_0x4f2795=0xc8;}else{_0x4f2795=0xce;}_0x166739[_0xd4c6('0x19')](_0x4f2795);return _0x166739[_0xd4c6('0x1f')]('Content-Range',_0x35dcbe+'-'+_0x1d7eff+'/'+_0x2c8e9f)[_0xd4c6('0x20')](_0x52fafe);}return null;};}function patchUpdates(_0x3f077a){return function(_0x37f6e5){try{jsonpatch[_0xd4c6('0x21')](_0x37f6e5,_0x3f077a,!![]);}catch(_0x3a2a41){return BPromise['reject'](_0x3a2a41);}return _0x37f6e5[_0xd4c6('0x22')]();};}function saveUpdates(_0x3732c2,_0x27ec6e){return function(_0x107df4){if(_0x107df4){return _0x107df4[_0xd4c6('0x23')](_0x3732c2)[_0xd4c6('0x24')](function(_0x32820f){return _0x32820f;});}return null;};}function removeEntity(_0x423ca7,_0x3f8394){return function(_0x19e531){if(_0x19e531){return _0x19e531[_0xd4c6('0x25')]()[_0xd4c6('0x24')](function(){_0x423ca7[_0xd4c6('0x19')](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x59631a,_0x11ade4){return function(_0x277969){if(!_0x277969){_0x59631a[_0xd4c6('0x18')](0x194);}return _0x277969;};}function handleError(_0x553b17,_0x1c6e67){_0x1c6e67=_0x1c6e67||0x1f4;return function(_0x114413){logger[_0xd4c6('0x26')](_0x114413[_0xd4c6('0x27')]);if(_0x114413[_0xd4c6('0x28')]){delete _0x114413['name'];}_0x553b17[_0xd4c6('0x19')](_0x1c6e67)[_0xd4c6('0x29')](_0x114413);};}exports[_0xd4c6('0x2a')]=function(_0x33c91e,_0x1a294e){var _0x4c562b={},_0xb20645={},_0x2045fb={'count':0x0,'rows':[]};var _0x4ec859=_['map'](db[_0xd4c6('0x2b')][_0xd4c6('0x2c')],function(_0x442777){return{'name':_0x442777[_0xd4c6('0x2d')],'type':_0x442777[_0xd4c6('0x2e')][_0xd4c6('0x2f')]};});_0xb20645[_0xd4c6('0x30')]=_[_0xd4c6('0x31')](_0x4ec859,_0xd4c6('0x28'));_0xb20645[_0xd4c6('0x32')]=_['keys'](_0x33c91e[_0xd4c6('0x32')]);_0xb20645['filters']=_['intersection'](_0xb20645['model'],_0xb20645[_0xd4c6('0x32')]);_0x4c562b[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0xb20645['model'],qs[_0xd4c6('0x35')](_0x33c91e[_0xd4c6('0x32')][_0xd4c6('0x35')]));_0x4c562b[_0xd4c6('0x33')]=_0x4c562b[_0xd4c6('0x33')][_0xd4c6('0x36')]?_0x4c562b[_0xd4c6('0x33')]:_0xb20645[_0xd4c6('0x30')];if(!_0x33c91e[_0xd4c6('0x32')][_0xd4c6('0x37')](_0xd4c6('0x38'))){_0x4c562b[_0xd4c6('0x1e')]=qs[_0xd4c6('0x1e')](_0x33c91e[_0xd4c6('0x32')][_0xd4c6('0x1e')]);_0x4c562b[_0xd4c6('0x1b')]=qs['offset'](_0x33c91e[_0xd4c6('0x32')]['offset']);}_0x4c562b[_0xd4c6('0x39')]=qs[_0xd4c6('0x3a')](_0x33c91e[_0xd4c6('0x32')]['sort']);_0x4c562b[_0xd4c6('0x3b')]=qs[_0xd4c6('0x3c')](_[_0xd4c6('0x3d')](_0x33c91e['query'],_0xb20645['filters']),_0x4ec859);if(_0x33c91e[_0xd4c6('0x32')][_0xd4c6('0x3e')]){_0x4c562b[_0xd4c6('0x3b')]=_['merge'](_0x4c562b[_0xd4c6('0x3b')],{'$or':_[_0xd4c6('0x31')](_0x4ec859,function(_0x466a3f){if(_0x466a3f[_0xd4c6('0x2e')]!==_0xd4c6('0x3f')){var _0xec27f9={};_0xec27f9[_0x466a3f[_0xd4c6('0x28')]]={'$like':'%'+_0x33c91e['query'][_0xd4c6('0x3e')]+'%'};return _0xec27f9;}})});}_0x4c562b=_[_0xd4c6('0x40')]({},_0x4c562b,_0x33c91e[_0xd4c6('0x41')]);var _0x33ee9f={'where':_0x4c562b['where']};return db[_0xd4c6('0x2b')]['count'](_0x33ee9f)['then'](function(_0x2e009a){_0x2045fb['count']=_0x2e009a;if(_0x33c91e[_0xd4c6('0x32')][_0xd4c6('0x42')]){_0x4c562b[_0xd4c6('0x43')]=[{'all':!![]}];}return db[_0xd4c6('0x2b')]['findAll'](_0x4c562b);})[_0xd4c6('0x24')](function(_0x410735){_0x2045fb['rows']=_0x410735;return _0x2045fb;})[_0xd4c6('0x24')](respondWithFilteredResult(_0x1a294e,_0x4c562b))[_0xd4c6('0x44')](handleError(_0x1a294e,null));};exports[_0xd4c6('0x45')]=function(_0x39359e,_0x433c72){var _0x1c112b={'raw':!![],'where':{'id':_0x39359e['params']['id']}},_0x30603b={};_0x30603b['model']=_[_0xd4c6('0x46')](db[_0xd4c6('0x2b')][_0xd4c6('0x2c')]);_0x30603b[_0xd4c6('0x32')]=_[_0xd4c6('0x46')](_0x39359e[_0xd4c6('0x32')]);_0x30603b[_0xd4c6('0x3c')]=_[_0xd4c6('0x34')](_0x30603b['model'],_0x30603b['query']);_0x1c112b[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x30603b[_0xd4c6('0x30')],qs[_0xd4c6('0x35')](_0x39359e['query'][_0xd4c6('0x35')]));_0x1c112b[_0xd4c6('0x33')]=_0x1c112b[_0xd4c6('0x33')][_0xd4c6('0x36')]?_0x1c112b[_0xd4c6('0x33')]:_0x30603b[_0xd4c6('0x30')];if(_0x39359e['query']['includeAll']){_0x1c112b['include']=[{'all':!![]}];}_0x1c112b=_[_0xd4c6('0x40')]({},_0x1c112b,_0x39359e[_0xd4c6('0x41')]);return db[_0xd4c6('0x2b')][_0xd4c6('0x47')](_0x1c112b)[_0xd4c6('0x24')](handleEntityNotFound(_0x433c72,null))['then'](respondWithResult(_0x433c72,null))[_0xd4c6('0x44')](handleError(_0x433c72,null));};exports[_0xd4c6('0x48')]=function(_0x469363,_0x586ea0){return db[_0xd4c6('0x2b')][_0xd4c6('0x48')](_0x469363[_0xd4c6('0x49')],{})[_0xd4c6('0x24')](respondWithResult(_0x586ea0,0xc9))[_0xd4c6('0x44')](handleError(_0x586ea0,null));};exports[_0xd4c6('0x23')]=function(_0x31bd87,_0x3ae79f){if(_0x31bd87[_0xd4c6('0x49')]['id']){delete _0x31bd87[_0xd4c6('0x49')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x31bd87[_0xd4c6('0x4a')]['id']}})[_0xd4c6('0x24')](handleEntityNotFound(_0x3ae79f,null))[_0xd4c6('0x24')](saveUpdates(_0x31bd87[_0xd4c6('0x49')],null))[_0xd4c6('0x24')](respondWithResult(_0x3ae79f,null))[_0xd4c6('0x44')](handleError(_0x3ae79f,null));};exports['destroy']=function(_0x518da2,_0x3dac93){return db[_0xd4c6('0x2b')][_0xd4c6('0x47')]({'where':{'id':_0x518da2[_0xd4c6('0x4a')]['id']}})[_0xd4c6('0x24')](handleEntityNotFound(_0x3dac93,null))[_0xd4c6('0x24')](removeEntity(_0x3dac93,null))[_0xd4c6('0x44')](handleError(_0x3dac93,null));};exports[_0xd4c6('0x4b')]=function(_0x251e1d,_0x149d3c){return db[_0xd4c6('0x2b')][_0xd4c6('0x4b')]()['then'](respondWithResult(_0x149d3c,null))[_0xd4c6('0x44')](handleError(_0x149d3c,null));}; \ No newline at end of file +var _0xa712=['status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','map','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','MailTransferReport','include','findAll','rows','show','params','rawAttributes','length','options','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4e7dd7,_0x3e7134){var _0x4f4461=function(_0x17aabb){while(--_0x17aabb){_0x4e7dd7['push'](_0x4e7dd7['shift']());}};_0x4f4461(++_0x3e7134);}(_0xa712,0x10c));var _0x2a71=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xa712[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require(_0x2a71('0x0'));var rimraf=require(_0x2a71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a71('0x2'));var rp=require(_0x2a71('0x3'));var moment=require('moment');var BPromise=require(_0x2a71('0x4'));var Mustache=require(_0x2a71('0x5'));var util=require(_0x2a71('0x6'));var path=require(_0x2a71('0x7'));var sox=require(_0x2a71('0x8'));var csv=require(_0x2a71('0x9'));var ejs=require(_0x2a71('0xa'));var fs=require('fs');var fs_extra=require(_0x2a71('0xb'));var _=require('lodash');var squel=require(_0x2a71('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a71('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2a71('0x9'));var querystring=require(_0x2a71('0xe'));var Papa=require(_0x2a71('0xf'));var Redis=require(_0x2a71('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a71('0x11'));var logger=require(_0x2a71('0x12'))(_0x2a71('0x13'));var utils=require(_0x2a71('0x14'));var config=require(_0x2a71('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a71('0x16'))['db'];function respondWithStatusCode(_0x265105,_0x436415){_0x436415=_0x436415||0xcc;return function(_0x164631){if(_0x164631){return _0x265105[_0x2a71('0x17')](_0x436415);}return _0x265105[_0x2a71('0x18')](_0x436415)[_0x2a71('0x19')]();};}function respondWithResult(_0x105bf5,_0x3fc8a8){_0x3fc8a8=_0x3fc8a8||0xc8;return function(_0x28f318){if(_0x28f318){return _0x105bf5[_0x2a71('0x18')](_0x3fc8a8)[_0x2a71('0x1a')](_0x28f318);}};}function respondWithFilteredResult(_0x4e9b90,_0x2cba1f){return function(_0x27ccb8){if(_0x27ccb8){var _0x1ab64f=typeof _0x2cba1f[_0x2a71('0x1b')]===_0x2a71('0x1c')&&typeof _0x2cba1f[_0x2a71('0x1d')]===_0x2a71('0x1c');var _0x1ecfcc=_0x27ccb8[_0x2a71('0x1e')];var _0x34ff84=_0x1ab64f?0x0:_0x2cba1f[_0x2a71('0x1b')];var _0x587584=_0x1ab64f?_0x27ccb8['count']:_0x2cba1f[_0x2a71('0x1b')]+_0x2cba1f['limit'];var _0x3a6b1f;if(_0x587584>=_0x1ecfcc){_0x587584=_0x1ecfcc;_0x3a6b1f=0xc8;}else{_0x3a6b1f=0xce;}_0x4e9b90['status'](_0x3a6b1f);return _0x4e9b90[_0x2a71('0x1f')](_0x2a71('0x20'),_0x34ff84+'-'+_0x587584+'/'+_0x1ecfcc)[_0x2a71('0x1a')](_0x27ccb8);}return null;};}function patchUpdates(_0x35c417){return function(_0x413091){try{jsonpatch['apply'](_0x413091,_0x35c417,!![]);}catch(_0x2cbaf4){return BPromise['reject'](_0x2cbaf4);}return _0x413091[_0x2a71('0x21')]();};}function saveUpdates(_0x9b9247,_0x5c1b95){return function(_0x1d6b48){if(_0x1d6b48){return _0x1d6b48[_0x2a71('0x22')](_0x9b9247)[_0x2a71('0x23')](function(_0x34072a){return _0x34072a;});}return null;};}function removeEntity(_0x245326,_0x2e3dd9){return function(_0x24ae48){if(_0x24ae48){return _0x24ae48['destroy']()[_0x2a71('0x23')](function(){_0x245326[_0x2a71('0x18')](0xcc)[_0x2a71('0x19')]();});}};}function handleEntityNotFound(_0x179f34,_0x47e165){return function(_0x20e9ee){if(!_0x20e9ee){_0x179f34[_0x2a71('0x17')](0x194);}return _0x20e9ee;};}function handleError(_0x25889a,_0x4d042c){_0x4d042c=_0x4d042c||0x1f4;return function(_0x42f37a){logger[_0x2a71('0x24')](_0x42f37a[_0x2a71('0x25')]);if(_0x42f37a[_0x2a71('0x26')]){delete _0x42f37a[_0x2a71('0x26')];}_0x25889a[_0x2a71('0x18')](_0x4d042c)[_0x2a71('0x27')](_0x42f37a);};}exports[_0x2a71('0x28')]=function(_0x28d5c6,_0x2a3b1f){var _0x8b387={},_0x273689={},_0x495636={'count':0x0,'rows':[]};var _0x2c4ebc=_[_0x2a71('0x29')](db['MailTransferReport']['rawAttributes'],function(_0x4b0fe8){return{'name':_0x4b0fe8['fieldName'],'type':_0x4b0fe8[_0x2a71('0x2a')][_0x2a71('0x2b')]};});_0x273689[_0x2a71('0x2c')]=_[_0x2a71('0x29')](_0x2c4ebc,_0x2a71('0x26'));_0x273689[_0x2a71('0x2d')]=_[_0x2a71('0x2e')](_0x28d5c6['query']);_0x273689['filters']=_['intersection'](_0x273689['model'],_0x273689[_0x2a71('0x2d')]);_0x8b387[_0x2a71('0x2f')]=_[_0x2a71('0x30')](_0x273689['model'],qs['fields'](_0x28d5c6[_0x2a71('0x2d')][_0x2a71('0x31')]));_0x8b387[_0x2a71('0x2f')]=_0x8b387[_0x2a71('0x2f')]['length']?_0x8b387[_0x2a71('0x2f')]:_0x273689[_0x2a71('0x2c')];if(!_0x28d5c6[_0x2a71('0x2d')][_0x2a71('0x32')](_0x2a71('0x33'))){_0x8b387[_0x2a71('0x1d')]=qs[_0x2a71('0x1d')](_0x28d5c6['query']['limit']);_0x8b387[_0x2a71('0x1b')]=qs[_0x2a71('0x1b')](_0x28d5c6[_0x2a71('0x2d')][_0x2a71('0x1b')]);}_0x8b387['order']=qs[_0x2a71('0x34')](_0x28d5c6[_0x2a71('0x2d')][_0x2a71('0x34')]);_0x8b387['where']=qs[_0x2a71('0x35')](_[_0x2a71('0x36')](_0x28d5c6[_0x2a71('0x2d')],_0x273689[_0x2a71('0x35')]),_0x2c4ebc);if(_0x28d5c6[_0x2a71('0x2d')]['filter']){_0x8b387[_0x2a71('0x37')]=_[_0x2a71('0x38')](_0x8b387['where'],{'$or':_[_0x2a71('0x29')](_0x2c4ebc,function(_0x52cc19){if(_0x52cc19['type']!==_0x2a71('0x39')){var _0x3d29c9={};_0x3d29c9[_0x52cc19[_0x2a71('0x26')]]={'$like':'%'+_0x28d5c6[_0x2a71('0x2d')]['filter']+'%'};return _0x3d29c9;}})});}_0x8b387=_[_0x2a71('0x38')]({},_0x8b387,_0x28d5c6['options']);var _0x4a0053={'where':_0x8b387[_0x2a71('0x37')]};return db[_0x2a71('0x3a')][_0x2a71('0x1e')](_0x4a0053)[_0x2a71('0x23')](function(_0x59dabf){_0x495636[_0x2a71('0x1e')]=_0x59dabf;if(_0x28d5c6[_0x2a71('0x2d')]['includeAll']){_0x8b387[_0x2a71('0x3b')]=[{'all':!![]}];}return db['MailTransferReport'][_0x2a71('0x3c')](_0x8b387);})[_0x2a71('0x23')](function(_0x177cb2){_0x495636[_0x2a71('0x3d')]=_0x177cb2;return _0x495636;})['then'](respondWithFilteredResult(_0x2a3b1f,_0x8b387))['catch'](handleError(_0x2a3b1f,null));};exports[_0x2a71('0x3e')]=function(_0x8ff832,_0x4c98f7){var _0x429d4b={'raw':!![],'where':{'id':_0x8ff832[_0x2a71('0x3f')]['id']}},_0x556f26={};_0x556f26[_0x2a71('0x2c')]=_[_0x2a71('0x2e')](db['MailTransferReport'][_0x2a71('0x40')]);_0x556f26[_0x2a71('0x2d')]=_[_0x2a71('0x2e')](_0x8ff832[_0x2a71('0x2d')]);_0x556f26['filters']=_[_0x2a71('0x30')](_0x556f26['model'],_0x556f26[_0x2a71('0x2d')]);_0x429d4b[_0x2a71('0x2f')]=_[_0x2a71('0x30')](_0x556f26[_0x2a71('0x2c')],qs[_0x2a71('0x31')](_0x8ff832['query'][_0x2a71('0x31')]));_0x429d4b[_0x2a71('0x2f')]=_0x429d4b['attributes'][_0x2a71('0x41')]?_0x429d4b[_0x2a71('0x2f')]:_0x556f26[_0x2a71('0x2c')];if(_0x8ff832[_0x2a71('0x2d')]['includeAll']){_0x429d4b[_0x2a71('0x3b')]=[{'all':!![]}];}_0x429d4b=_[_0x2a71('0x38')]({},_0x429d4b,_0x8ff832[_0x2a71('0x42')]);return db[_0x2a71('0x3a')][_0x2a71('0x43')](_0x429d4b)['then'](handleEntityNotFound(_0x4c98f7,null))[_0x2a71('0x23')](respondWithResult(_0x4c98f7,null))[_0x2a71('0x44')](handleError(_0x4c98f7,null));};exports[_0x2a71('0x45')]=function(_0x40766b,_0x24d75e){return db[_0x2a71('0x3a')]['create'](_0x40766b[_0x2a71('0x46')],{})[_0x2a71('0x23')](respondWithResult(_0x24d75e,0xc9))[_0x2a71('0x44')](handleError(_0x24d75e,null));};exports['update']=function(_0x16cf82,_0xd026b2){if(_0x16cf82[_0x2a71('0x46')]['id']){delete _0x16cf82[_0x2a71('0x46')]['id'];}return db['MailTransferReport'][_0x2a71('0x43')]({'where':{'id':_0x16cf82[_0x2a71('0x3f')]['id']}})[_0x2a71('0x23')](handleEntityNotFound(_0xd026b2,null))[_0x2a71('0x23')](saveUpdates(_0x16cf82[_0x2a71('0x46')],null))[_0x2a71('0x23')](respondWithResult(_0xd026b2,null))[_0x2a71('0x44')](handleError(_0xd026b2,null));};exports[_0x2a71('0x47')]=function(_0x4e413d,_0x7b20ad){return db[_0x2a71('0x3a')][_0x2a71('0x43')]({'where':{'id':_0x4e413d[_0x2a71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x7b20ad,null))['then'](removeEntity(_0x7b20ad,null))['catch'](handleError(_0x7b20ad,null));};exports[_0x2a71('0x48')]=function(_0x5ee056,_0x46c7da){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x46c7da,null))[_0x2a71('0x44')](handleError(_0x46c7da,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f4bd624..c4cc1fa 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 _0xe548=['../../config/logger','api','moment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x42a300,_0x386578){var _0x18c45f=function(_0x2fbd10){while(--_0x2fbd10){_0x42a300['push'](_0x42a300['shift']());}};_0x18c45f(++_0x386578);}(_0xe548,0x184));var _0x8e54=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0xe548[_0x48a96f];return _0x3ff3ef;};'use strict';var _=require(_0x8e54('0x0'));var util=require(_0x8e54('0x1'));var logger=require(_0x8e54('0x2'))(_0x8e54('0x3'));var moment=require(_0x8e54('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('../../config/environment');var attributes=require(_0x8e54('0x5'));module['exports']=function(_0x288be8,_0x47a58d){return _0x288be8[_0x8e54('0x6')](_0x8e54('0x7'),attributes,{'tableName':_0x8e54('0x8'),'paranoid':![],'indexes':[{'name':_0x8e54('0x9'),'fields':[_0x8e54('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa633=['api','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xa633,0x15d));var _0x3a63=function(_0x459b0c,_0x412c17){_0x459b0c=_0x459b0c-0x0;var _0x2a50fa=_0xa633[_0x459b0c];return _0x2a50fa;};'use strict';var _=require(_0x3a63('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a63('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a63('0x3'));var config=require(_0x3a63('0x4'));var attributes=require(_0x3a63('0x5'));module[_0x3a63('0x6')]=function(_0x1315cb,_0xc9221d){return _0x1315cb[_0x3a63('0x7')](_0x3a63('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3a63('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 330f512..03bfee9 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 _0x2168=['then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xc3c293,_0x503798){var _0x1543ef=function(_0x50b095){while(--_0x50b095){_0xc3c293['push'](_0xc3c293['shift']());}};_0x1543ef(++_0x503798);}(_0x2168,0x112));var _0x8216=function(_0x542f99,_0x1dd393){_0x542f99=_0x542f99-0x0;var _0x5e69fe=_0x2168[_0x542f99];return _0x5e69fe;};'use strict';var _=require(_0x8216('0x0'));var util=require(_0x8216('0x1'));var moment=require('moment');var BPromise=require(_0x8216('0x2'));var rs=require(_0x8216('0x3'));var fs=require('fs');var Redis=require(_0x8216('0x4'));var db=require(_0x8216('0x5'))['db'];var utils=require(_0x8216('0x6'));var logger=require(_0x8216('0x7'))(_0x8216('0x8'));var config=require(_0x8216('0x9'));var jayson=require(_0x8216('0xa'));var client=jayson[_0x8216('0xb')][_0x8216('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c87f1,_0x12c5ed,_0x429cee){return new BPromise(function(_0x10358,_0x1f2284){return client[_0x8216('0xd')](_0x4c87f1,_0x429cee)[_0x8216('0xe')](function(_0x5267a6){logger[_0x8216('0xf')](_0x8216('0x10'),_0x12c5ed,'request\x20sent');logger[_0x8216('0x11')](_0x8216('0x12'),_0x12c5ed,'request\x20sent',JSON[_0x8216('0x13')](_0x5267a6));if(_0x5267a6[_0x8216('0x14')]){if(_0x5267a6[_0x8216('0x14')][_0x8216('0x15')]===0x1f4){logger[_0x8216('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x12c5ed,_0x5267a6['error'][_0x8216('0x16')]);return _0x1f2284(_0x5267a6[_0x8216('0x14')][_0x8216('0x16')]);}logger['error'](_0x8216('0x10'),_0x12c5ed,_0x5267a6[_0x8216('0x14')][_0x8216('0x16')]);return _0x10358(_0x5267a6[_0x8216('0x14')][_0x8216('0x16')]);}else{logger[_0x8216('0xf')](_0x8216('0x10'),_0x12c5ed,_0x8216('0x17'));_0x10358(_0x5267a6['result']['message']);}})['catch'](function(_0x2c7e32){logger[_0x8216('0x14')](_0x8216('0x10'),_0x12c5ed,_0x2c7e32);_0x1f2284(_0x2c7e32);});});} \ No newline at end of file +var _0xcaf5=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3fd737,_0x263d58){var _0x4b9e85=function(_0x2cde35){while(--_0x2cde35){_0x3fd737['push'](_0x3fd737['shift']());}};_0x4b9e85(++_0x263d58);}(_0xcaf5,0xa8));var _0x5caf=function(_0x56b2c5,_0x3c7653){_0x56b2c5=_0x56b2c5-0x0;var _0x7a5555=_0xcaf5[_0x56b2c5];return _0x7a5555;};'use strict';var _=require(_0x5caf('0x0'));var util=require(_0x5caf('0x1'));var moment=require(_0x5caf('0x2'));var BPromise=require(_0x5caf('0x3'));var rs=require(_0x5caf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5caf('0x5'))['db'];var utils=require(_0x5caf('0x6'));var logger=require(_0x5caf('0x7'))(_0x5caf('0x8'));var config=require('../../config/environment');var jayson=require(_0x5caf('0x9'));var client=jayson[_0x5caf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x509a42,_0x4384c3,_0x19c868){return new BPromise(function(_0x2ebaee,_0x1f8829){return client[_0x5caf('0xb')](_0x509a42,_0x19c868)[_0x5caf('0xc')](function(_0x2da0de){logger[_0x5caf('0xd')](_0x5caf('0xe'),_0x4384c3,_0x5caf('0xf'));logger[_0x5caf('0x10')](_0x5caf('0x11'),_0x4384c3,_0x5caf('0xf'),JSON[_0x5caf('0x12')](_0x2da0de));if(_0x2da0de[_0x5caf('0x13')]){if(_0x2da0de['error'][_0x5caf('0x14')]===0x1f4){logger[_0x5caf('0x13')](_0x5caf('0xe'),_0x4384c3,_0x2da0de[_0x5caf('0x13')][_0x5caf('0x15')]);return _0x1f8829(_0x2da0de[_0x5caf('0x13')][_0x5caf('0x15')]);}logger['error'](_0x5caf('0xe'),_0x4384c3,_0x2da0de[_0x5caf('0x13')][_0x5caf('0x15')]);return _0x2ebaee(_0x2da0de['error'][_0x5caf('0x15')]);}else{logger[_0x5caf('0xd')](_0x5caf('0xe'),_0x4384c3,'request\x20sent');_0x2ebaee(_0x2da0de[_0x5caf('0x16')][_0x5caf('0x15')]);}})[_0x5caf('0x17')](function(_0x92ad91){logger[_0x5caf('0x13')](_0x5caf('0xe'),_0x4384c3,_0x92ad91);_0x1f8829(_0x92ad91);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1118619..e0efb28 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 _0x4c4f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','create','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x327b04,_0x27b5bf){var _0x228bf5=function(_0x5e1d69){while(--_0x5e1d69){_0x327b04['push'](_0x327b04['shift']());}};_0x228bf5(++_0x27b5bf);}(_0x4c4f,0x118));var _0xf4c4=function(_0x5cd76e,_0x5557b7){_0x5cd76e=_0x5cd76e-0x0;var _0x49c09d=_0x4c4f[_0x5cd76e];return _0x49c09d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf4c4('0x0'));var timeout=require('connect-timeout');var express=require(_0xf4c4('0x1'));var router=express[_0xf4c4('0x2')]();var fs_extra=require(_0xf4c4('0x3'));var auth=require(_0xf4c4('0x4'));var interaction=require(_0xf4c4('0x5'));var config=require(_0xf4c4('0x6'));var controller=require('./memberReport.controller');router[_0xf4c4('0x7')]('/',auth[_0xf4c4('0x8')](),controller['index']);router['get'](_0xf4c4('0x9'),auth[_0xf4c4('0x8')](),controller['describe']);router['get'](_0xf4c4('0xa'),auth[_0xf4c4('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf4c4('0xb')]);router['put'](_0xf4c4('0xa'),auth[_0xf4c4('0x8')](),controller[_0xf4c4('0xc')]);router[_0xf4c4('0xd')](_0xf4c4('0xa'),auth[_0xf4c4('0x8')](),controller[_0xf4c4('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0597=['isAuthenticated','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','/describe','describe'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0597,0x1eb));var _0x7059=function(_0x5a571e,_0x3ed8a2){_0x5a571e=_0x5a571e-0x0;var _0x577ecb=_0x0597[_0x5a571e];return _0x577ecb;};'use strict';var multer=require(_0x7059('0x0'));var util=require(_0x7059('0x1'));var path=require(_0x7059('0x2'));var timeout=require(_0x7059('0x3'));var express=require(_0x7059('0x4'));var router=express[_0x7059('0x5')]();var fs_extra=require(_0x7059('0x6'));var auth=require(_0x7059('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7059('0x8'));var controller=require(_0x7059('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7059('0xa')](_0x7059('0xb'),auth['isAuthenticated'](),controller[_0x7059('0xc')]);router[_0x7059('0xa')]('/:id',auth[_0x7059('0xd')](),controller['show']);router[_0x7059('0xe')]('/',auth[_0x7059('0xd')](),controller[_0x7059('0xf')]);router['put'](_0x7059('0x10'),auth[_0x7059('0xd')](),controller[_0x7059('0x11')]);router[_0x7059('0x12')](_0x7059('0x10'),auth[_0x7059('0xd')](),controller[_0x7059('0x13')]);module[_0x7059('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e412c68..7c2c6aa 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 _0xb32d=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize'];(function(_0x2d59cb,_0x5bc9ed){var _0x2e939a=function(_0x1bc9b7){while(--_0x1bc9b7){_0x2d59cb['push'](_0x2d59cb['shift']());}};_0x2e939a(++_0x5bc9ed);}(_0xb32d,0x1da));var _0xdb32=function(_0x3977dc,_0x18499a){_0x3977dc=_0x3977dc-0x0;var _0x40e46e=_0xb32d[_0x3977dc];return _0x40e46e;};'use strict';var Sequelize=require(_0xdb32('0x0'));var moment=require(_0xdb32('0x1'));module[_0xdb32('0x2')]={'channel':{'type':Sequelize[_0xdb32('0x3')]},'membername':{'type':Sequelize[_0xdb32('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xdb32('0x4'),'comment':_0xdb32('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xdb32('0x6')]},'exitAt':{'type':Sequelize[_0xdb32('0x6')],'set':function(_0x8d7bf4){var _0x1f4539=moment(_0x8d7bf4);var _0x6f4af0=moment(this[_0xdb32('0x7')]('enterAt'));var _0x3b0995=_0x1f4539[_0xdb32('0x8')](_0x6f4af0,_0xdb32('0x9'));this[_0xdb32('0xa')](_0xdb32('0xb'),_0x8d7bf4);this[_0xdb32('0xa')](_0xdb32('0xc'),_0x3b0995||null);}},'data1':{'type':Sequelize[_0xdb32('0x3')],'comment':_0xdb32('0xd')},'data2':{'type':Sequelize[_0xdb32('0x3')],'comment':_0xdb32('0xe')},'data3':{'type':Sequelize[_0xdb32('0x3')],'comment':_0xdb32('0xf')},'data4':{'type':Sequelize[_0xdb32('0x3')],'comment':_0xdb32('0x10')},'data5':{'type':Sequelize[_0xdb32('0x3')],'comment':_0xdb32('0x11')},'role':{'type':Sequelize[_0xdb32('0x3')]},'internal':{'type':Sequelize[_0xdb32('0x12')]},'uniqueid':{'type':Sequelize[_0xdb32('0x3')]}}; \ No newline at end of file +var _0xc73e=['enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x49e6a6,_0x157f96){var _0x30464a=function(_0x3747cb){while(--_0x3747cb){_0x49e6a6['push'](_0x49e6a6['shift']());}};_0x30464a(++_0x157f96);}(_0xc73e,0x1e9));var _0xec73=function(_0x36f632,_0x3594bc){_0x36f632=_0x36f632-0x0;var _0x2cf2a3=_0xc73e[_0x36f632];return _0x2cf2a3;};'use strict';var Sequelize=require(_0xec73('0x0'));var moment=require(_0xec73('0x1'));module['exports']={'channel':{'type':Sequelize[_0xec73('0x2')]},'membername':{'type':Sequelize[_0xec73('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xec73('0x3')},'duration':{'type':Sequelize[_0xec73('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xec73('0x5')],'set':function(_0x26598a){var _0x3bd154=moment(_0x26598a);var _0x28d95d=moment(this['getDataValue'](_0xec73('0x6')));var _0x5bab16=_0x3bd154[_0xec73('0x7')](_0x28d95d,_0xec73('0x8'));this[_0xec73('0x9')](_0xec73('0xa'),_0x26598a);this['setDataValue']('duration',_0x5bab16||null);}},'data1':{'type':Sequelize[_0xec73('0x2')],'comment':_0xec73('0xb')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xec73('0x2')],'comment':_0xec73('0xc')},'data4':{'type':Sequelize[_0xec73('0x2')],'comment':_0xec73('0xd')},'data5':{'type':Sequelize[_0xec73('0x2')],'comment':_0xec73('0xe')},'role':{'type':Sequelize[_0xec73('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xec73('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fa77a96..292fb4b 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xedd9,0xfc));var _0x9edd=function(_0x134d75,_0x8be8de){_0x134d75=_0x134d75-0x0;var _0x3c6a03=_0xedd9[_0x134d75];return _0x3c6a03;};'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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x1c3289,_0x587773){var _0x595604=function(_0x269b85){while(--_0x269b85){_0x1c3289['push'](_0x1c3289['shift']());}};_0x595604(++_0x587773);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e3968a7..27bc362 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 _0x4655=['path','rimraf','../../config/environment','exports','define','MemberReport','report_member','interface','lodash','util','api','moment','bluebird'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x4655,0x70));var _0x5465=function(_0xaa1b9,_0x2f598d){_0xaa1b9=_0xaa1b9-0x0;var _0x50b620=_0x4655[_0xaa1b9];return _0x50b620;};'use strict';var _=require(_0x5465('0x0'));var util=require(_0x5465('0x1'));var logger=require('../../config/logger')(_0x5465('0x2'));var moment=require(_0x5465('0x3'));var BPromise=require(_0x5465('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5465('0x5'));var rimraf=require(_0x5465('0x6'));var config=require(_0x5465('0x7'));var attributes=require('./memberReport.attributes');module[_0x5465('0x8')]=function(_0x5dfb6d,_0x2472ab){return _0x5dfb6d[_0x5465('0x9')](_0x5465('0xa'),attributes,{'tableName':_0x5465('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x5465('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x240d=['rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f4d3d,_0x22409d){var _0x377cae=function(_0x3c4923){while(--_0x3c4923){_0x3f4d3d['push'](_0x3f4d3d['shift']());}};_0x377cae(++_0x22409d);}(_0x240d,0xa2));var _0xd240=function(_0x1a35c2,_0x51af7c){_0x1a35c2=_0x1a35c2-0x0;var _0x4c3b3c=_0x240d[_0x1a35c2];return _0x4c3b3c;};'use strict';var _=require(_0xd240('0x0'));var util=require(_0xd240('0x1'));var logger=require(_0xd240('0x2'))(_0xd240('0x3'));var moment=require(_0xd240('0x4'));var BPromise=require(_0xd240('0x5'));var rp=require(_0xd240('0x6'));var fs=require('fs');var path=require(_0xd240('0x7'));var rimraf=require(_0xd240('0x8'));var config=require('../../config/environment');var attributes=require(_0xd240('0x9'));module[_0xd240('0xa')]=function(_0x2e4ae4,_0x16df4f){return _0x2e4ae4[_0xd240('0xb')](_0xd240('0xc'),attributes,{'tableName':_0xd240('0xd'),'paranoid':![],'indexes':[{'name':_0xd240('0xe'),'fields':[_0xd240('0xf'),_0xd240('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index fe5b2b1..50d1054 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 _0x01db=['../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MemberReport','options','raw','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','body','UpdateMemberReport','update','where','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x01db,0x171));var _0xb01d=function(_0x46dd45,_0x26811c){_0x46dd45=_0x46dd45-0x0;var _0x2e0721=_0x01db[_0x46dd45];return _0x2e0721;};'use strict';var _=require(_0xb01d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb01d('0x1'));var rs=require(_0xb01d('0x2'));var fs=require('fs');var Redis=require(_0xb01d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb01d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb01d('0x5'));var jayson=require(_0xb01d('0x6'));var client=jayson[_0xb01d('0x7')][_0xb01d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2622e9,_0x37720d,_0x3c45a3){return new BPromise(function(_0x4429dd,_0x518609){return client['request'](_0x2622e9,_0x3c45a3)[_0xb01d('0x9')](function(_0x28f028){logger[_0xb01d('0xa')](_0xb01d('0xb'),_0x37720d,_0xb01d('0xc'));logger[_0xb01d('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x37720d,'request\x20sent',JSON[_0xb01d('0xe')](_0x28f028));if(_0x28f028[_0xb01d('0xf')]){if(_0x28f028[_0xb01d('0xf')][_0xb01d('0x10')]===0x1f4){logger[_0xb01d('0xf')](_0xb01d('0xb'),_0x37720d,_0x28f028[_0xb01d('0xf')]['message']);return _0x518609(_0x28f028['error'][_0xb01d('0x11')]);}logger['error'](_0xb01d('0xb'),_0x37720d,_0x28f028[_0xb01d('0xf')]['message']);return _0x4429dd(_0x28f028[_0xb01d('0xf')][_0xb01d('0x11')]);}else{logger[_0xb01d('0xa')](_0xb01d('0xb'),_0x37720d,'request\x20sent');_0x4429dd(_0x28f028[_0xb01d('0x12')]['message']);}})[_0xb01d('0x13')](function(_0x9a96e){logger[_0xb01d('0xf')](_0xb01d('0xb'),_0x37720d,_0x9a96e);_0x518609(_0x9a96e);});});}exports['GetMemberReport']=function(_0xe47874){var _0x45454b=this;return new Promise(function(_0x39eaaf,_0x5c891a){return db[_0xb01d('0x14')]['findAll']({'raw':_0xe47874[_0xb01d('0x15')]?_0xe47874[_0xb01d('0x15')][_0xb01d('0x16')]===undefined?!![]:![]:!![],'where':_0xe47874[_0xb01d('0x15')]?_0xe47874[_0xb01d('0x15')]['where']||null:null,'attributes':_0xe47874[_0xb01d('0x15')]?_0xe47874[_0xb01d('0x15')][_0xb01d('0x17')]||null:null,'limit':_0xe47874[_0xb01d('0x15')]?_0xe47874[_0xb01d('0x15')][_0xb01d('0x18')]||null:null,'include':_0xe47874[_0xb01d('0x15')]?_0xe47874[_0xb01d('0x15')][_0xb01d('0x19')]?_[_0xb01d('0x1a')](_0xe47874[_0xb01d('0x15')][_0xb01d('0x19')],function(_0x515d52){return{'model':db[_0x515d52[_0xb01d('0x1b')]],'as':_0x515d52['as'],'attributes':_0x515d52['attributes'],'include':_0x515d52[_0xb01d('0x19')]?_[_0xb01d('0x1a')](_0x515d52[_0xb01d('0x19')],function(_0x3ce3f8){return{'model':db[_0x3ce3f8[_0xb01d('0x1b')]],'as':_0x3ce3f8['as'],'attributes':_0x3ce3f8[_0xb01d('0x17')],'include':_0x3ce3f8[_0xb01d('0x19')]?_[_0xb01d('0x1a')](_0x3ce3f8[_0xb01d('0x19')],function(_0x1236c2){return{'model':db[_0x1236c2[_0xb01d('0x1b')]],'as':_0x1236c2['as'],'attributes':_0x1236c2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb01d('0x9')](function(_0x37e513){logger[_0xb01d('0xa')]('GetMemberReport',_0xe47874);logger[_0xb01d('0xd')](_0xb01d('0x1c'),_0xe47874,JSON[_0xb01d('0xe')](_0x37e513));_0x39eaaf(_0x37e513);})['catch'](function(_0x29b32c){logger['error'](_0xb01d('0x1c'),_0x29b32c[_0xb01d('0x11')],_0xe47874);_0x5c891a(_0x45454b[_0xb01d('0xf')](0x1f4,_0x29b32c['message']));});});};exports[_0xb01d('0x1d')]=function(_0x2f0f7c){var _0x1666a1=this;return new Promise(function(_0x13ea95,_0x1ba23e){return db[_0xb01d('0x14')]['create'](_0x2f0f7c[_0xb01d('0x1e')],{'raw':_0x2f0f7c[_0xb01d('0x15')]?_0x2f0f7c[_0xb01d('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xb01d('0x9')](function(_0x48e238){logger['info'](_0xb01d('0x1d'),_0x2f0f7c);logger[_0xb01d('0xd')]('CreateMemberReport',_0x2f0f7c,JSON['stringify'](_0x48e238));_0x13ea95(_0x48e238);})[_0xb01d('0x13')](function(_0x16046e){logger[_0xb01d('0xf')](_0xb01d('0x1d'),_0x16046e[_0xb01d('0x11')],_0x2f0f7c);_0x1ba23e(_0x1666a1[_0xb01d('0xf')](0x1f4,_0x16046e[_0xb01d('0x11')]));});});};exports[_0xb01d('0x1f')]=function(_0x186c51){var _0x4a31ea=this;return new Promise(function(_0x314fc5,_0x20bb65){return db[_0xb01d('0x14')][_0xb01d('0x20')](_0x186c51['body'],{'raw':_0x186c51[_0xb01d('0x15')]?_0x186c51['options'][_0xb01d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x186c51[_0xb01d('0x15')]?_0x186c51[_0xb01d('0x15')][_0xb01d('0x21')]||null:null,'attributes':_0x186c51['options']?_0x186c51[_0xb01d('0x15')][_0xb01d('0x17')]||null:null,'limit':_0x186c51[_0xb01d('0x15')]?_0x186c51[_0xb01d('0x15')][_0xb01d('0x18')]||null:null})['then'](function(_0x76d421){logger[_0xb01d('0xa')](_0xb01d('0x1f'),_0x186c51);logger[_0xb01d('0xd')](_0xb01d('0x1f'),_0x186c51,JSON[_0xb01d('0xe')](_0x76d421));_0x314fc5(_0x76d421);})[_0xb01d('0x13')](function(_0x5d191c){logger['error'](_0xb01d('0x1f'),_0x5d191c['message'],_0x186c51);_0x20bb65(_0x4a31ea[_0xb01d('0xf')](0x1f4,_0x5d191c[_0xb01d('0x11')]));});});}; \ No newline at end of file +var _0x31af=['info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','include','map','model','attributes','CreateMemberReport','create','body','raw','UpdateMemberReport','update','where','limit','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x322408,_0x34d007){var _0x3d30=function(_0x458c44){while(--_0x458c44){_0x322408['push'](_0x322408['shift']());}};_0x3d30(++_0x34d007);}(_0x31af,0xde));var _0xf31a=function(_0x2ff5b1,_0x2c635b){_0x2ff5b1=_0x2ff5b1-0x0;var _0x39b60b=_0x31af[_0x2ff5b1];return _0x39b60b;};'use strict';var _=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf31a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf31a('0x4'));var logger=require(_0xf31a('0x5'))(_0xf31a('0x6'));var config=require(_0xf31a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf31a('0x8')][_0xf31a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x405926,_0x1dc7cc,_0x47b7a1){return new BPromise(function(_0x31f8e7,_0xe5778a){return client[_0xf31a('0xa')](_0x405926,_0x47b7a1)[_0xf31a('0xb')](function(_0x48cc46){logger[_0xf31a('0xc')](_0xf31a('0xd'),_0x1dc7cc,_0xf31a('0xe'));logger[_0xf31a('0xf')](_0xf31a('0x10'),_0x1dc7cc,'request\x20sent',JSON[_0xf31a('0x11')](_0x48cc46));if(_0x48cc46[_0xf31a('0x12')]){if(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x13')]===0x1f4){logger['error'](_0xf31a('0xd'),_0x1dc7cc,_0x48cc46[_0xf31a('0x12')]['message']);return _0xe5778a(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);}logger[_0xf31a('0x12')](_0xf31a('0xd'),_0x1dc7cc,_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);return _0x31f8e7(_0x48cc46[_0xf31a('0x12')][_0xf31a('0x14')]);}else{logger[_0xf31a('0xc')](_0xf31a('0xd'),_0x1dc7cc,_0xf31a('0xe'));_0x31f8e7(_0x48cc46[_0xf31a('0x15')][_0xf31a('0x14')]);}})[_0xf31a('0x16')](function(_0x1429c8){logger['error'](_0xf31a('0xd'),_0x1dc7cc,_0x1429c8);_0xe5778a(_0x1429c8);});});}exports[_0xf31a('0x17')]=function(_0x251ca7){var _0x3bff26=this;return new Promise(function(_0x4c3589,_0x36b057){return db[_0xf31a('0x18')][_0xf31a('0x19')]({'raw':_0x251ca7[_0xf31a('0x1a')]?_0x251ca7[_0xf31a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x251ca7[_0xf31a('0x1a')]?_0x251ca7[_0xf31a('0x1a')]['where']||null:null,'attributes':_0x251ca7[_0xf31a('0x1a')]?_0x251ca7[_0xf31a('0x1a')]['attributes']||null:null,'limit':_0x251ca7[_0xf31a('0x1a')]?_0x251ca7[_0xf31a('0x1a')]['limit']||null:null,'include':_0x251ca7['options']?_0x251ca7['options'][_0xf31a('0x1b')]?_[_0xf31a('0x1c')](_0x251ca7['options'][_0xf31a('0x1b')],function(_0x2a8a22){return{'model':db[_0x2a8a22[_0xf31a('0x1d')]],'as':_0x2a8a22['as'],'attributes':_0x2a8a22[_0xf31a('0x1e')],'include':_0x2a8a22['include']?_['map'](_0x2a8a22[_0xf31a('0x1b')],function(_0x714292){return{'model':db[_0x714292['model']],'as':_0x714292['as'],'attributes':_0x714292['attributes'],'include':_0x714292['include']?_['map'](_0x714292[_0xf31a('0x1b')],function(_0x45df36){return{'model':db[_0x45df36[_0xf31a('0x1d')]],'as':_0x45df36['as'],'attributes':_0x45df36['attributes']};}):[]};}):[]};}):[]:[]})[_0xf31a('0xb')](function(_0x2ace06){logger[_0xf31a('0xc')](_0xf31a('0x17'),_0x251ca7);logger[_0xf31a('0xf')]('GetMemberReport',_0x251ca7,JSON[_0xf31a('0x11')](_0x2ace06));_0x4c3589(_0x2ace06);})[_0xf31a('0x16')](function(_0x52f8aa){logger['error'](_0xf31a('0x17'),_0x52f8aa[_0xf31a('0x14')],_0x251ca7);_0x36b057(_0x3bff26['error'](0x1f4,_0x52f8aa[_0xf31a('0x14')]));});});};exports[_0xf31a('0x1f')]=function(_0x2f739c){var _0x5385ba=this;return new Promise(function(_0x1d4d9b,_0x145f2b){return db[_0xf31a('0x18')][_0xf31a('0x20')](_0x2f739c[_0xf31a('0x21')],{'raw':_0x2f739c[_0xf31a('0x1a')]?_0x2f739c['options'][_0xf31a('0x22')]===undefined?!![]:![]:!![]})[_0xf31a('0xb')](function(_0x10c1f3){logger[_0xf31a('0xc')](_0xf31a('0x1f'),_0x2f739c);logger[_0xf31a('0xf')](_0xf31a('0x1f'),_0x2f739c,JSON[_0xf31a('0x11')](_0x10c1f3));_0x1d4d9b(_0x10c1f3);})[_0xf31a('0x16')](function(_0x137ea4){logger[_0xf31a('0x12')](_0xf31a('0x1f'),_0x137ea4[_0xf31a('0x14')],_0x2f739c);_0x145f2b(_0x5385ba[_0xf31a('0x12')](0x1f4,_0x137ea4[_0xf31a('0x14')]));});});};exports[_0xf31a('0x23')]=function(_0x11c817){var _0x3cfcb4=this;return new Promise(function(_0x1d4807,_0x53b42c){return db[_0xf31a('0x18')][_0xf31a('0x24')](_0x11c817[_0xf31a('0x21')],{'raw':_0x11c817[_0xf31a('0x1a')]?_0x11c817[_0xf31a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c817[_0xf31a('0x1a')]?_0x11c817[_0xf31a('0x1a')][_0xf31a('0x25')]||null:null,'attributes':_0x11c817['options']?_0x11c817[_0xf31a('0x1a')][_0xf31a('0x1e')]||null:null,'limit':_0x11c817[_0xf31a('0x1a')]?_0x11c817[_0xf31a('0x1a')][_0xf31a('0x26')]||null:null})['then'](function(_0x347f38){logger['info'](_0xf31a('0x23'),_0x11c817);logger[_0xf31a('0xf')]('UpdateMemberReport',_0x11c817,JSON[_0xf31a('0x11')](_0x347f38));_0x1d4807(_0x347f38);})[_0xf31a('0x16')](function(_0x1d2f3c){logger['error'](_0xf31a('0x23'),_0x1d2f3c[_0xf31a('0x14')],_0x11c817);_0x53b42c(_0x3cfcb4[_0xf31a('0x12')](0x1f4,_0x1d2f3c[_0xf31a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 70bb678..bf60fe7 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 _0xff22=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util','connect-timeout','express'];(function(_0x37f44b,_0x4d4dcb){var _0xbc6aa2=function(_0x3a5391){while(--_0x3a5391){_0x37f44b['push'](_0x37f44b['shift']());}};_0xbc6aa2(++_0x4d4dcb);}(_0xff22,0x1a0));var _0x2ff2=function(_0xf48def,_0x1251ee){_0xf48def=_0xf48def-0x0;var _0x46b961=_0xff22[_0xf48def];return _0x46b961;};'use strict';var multer=require(_0x2ff2('0x0'));var util=require(_0x2ff2('0x1'));var path=require('path');var timeout=require(_0x2ff2('0x2'));var express=require(_0x2ff2('0x3'));var router=express[_0x2ff2('0x4')]();var fs_extra=require(_0x2ff2('0x5'));var auth=require(_0x2ff2('0x6'));var interaction=require(_0x2ff2('0x7'));var config=require(_0x2ff2('0x8'));var controller=require(_0x2ff2('0x9'));router[_0x2ff2('0xa')]('/',controller['index']);module[_0x2ff2('0xb')]=router; \ No newline at end of file +var _0x6439=['get','index','exports','util','path','express','Router','fs-extra','./migration.controller'];(function(_0x22d41a,_0x43577b){var _0x5a2a10=function(_0x2c53d2){while(--_0x2c53d2){_0x22d41a['push'](_0x22d41a['shift']());}};_0x5a2a10(++_0x43577b);}(_0x6439,0xc9));var _0x9643=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x6439[_0x3826ad];return _0x17b900;};'use strict';var multer=require('multer');var util=require(_0x9643('0x0'));var path=require(_0x9643('0x1'));var timeout=require('connect-timeout');var express=require(_0x9643('0x2'));var router=express[_0x9643('0x3')]();var fs_extra=require(_0x9643('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9643('0x5'));router[_0x9643('0x6')]('/',controller[_0x9643('0x7')]);module[_0x9643('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2823e9c..2af806a 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 _0xfd01=['exports','version'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfd01,0x19e));var _0x1fd0=function(_0x53ef5a,_0x4c8fd6){_0x53ef5a=_0x53ef5a-0x0;var _0x4015f3=_0xfd01[_0x53ef5a];return _0x4015f3;};'use strict';var Sequelize=require('sequelize');module[_0x1fd0('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x1fd0('0x1')}}; \ No newline at end of file +var _0x225c=['version'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x225c,0x9c));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xc225('0x0')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9a10b05..573ef33 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 _0x2a38=['order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x37e342,_0x160c8f){var _0x1768f9=function(_0x413c98){while(--_0x413c98){_0x37e342['push'](_0x37e342['shift']());}};_0x1768f9(++_0x160c8f);}(_0x2a38,0x1e8));var _0x82a3=function(_0x207fef,_0x31dbe5){_0x207fef=_0x207fef-0x0;var _0x2a2028=_0x2a38[_0x207fef];return _0x2a2028;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82a3('0x0'));var zipdir=require(_0x82a3('0x1'));var jsonpatch=require(_0x82a3('0x2'));var rp=require(_0x82a3('0x3'));var moment=require(_0x82a3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82a3('0x5'));var path=require(_0x82a3('0x6'));var sox=require(_0x82a3('0x7'));var csv=require('to-csv');var ejs=require(_0x82a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x82a3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x82a3('0xa'));var toCsv=require('to-csv');var querystring=require(_0x82a3('0xb'));var Papa=require(_0x82a3('0xc'));var Redis=require(_0x82a3('0xd'));var authService=require(_0x82a3('0xe'));var qs=require(_0x82a3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82a3('0x10'));var logger=require(_0x82a3('0x11'))(_0x82a3('0x12'));var utils=require(_0x82a3('0x13'));var config=require(_0x82a3('0x14'));var licenseUtil=require(_0x82a3('0x15'));var db=require(_0x82a3('0x16'))['db'];function respondWithStatusCode(_0xbf3d36,_0x29efd7){_0x29efd7=_0x29efd7||0xcc;return function(_0x38763c){if(_0x38763c){return _0xbf3d36[_0x82a3('0x17')](_0x29efd7);}return _0xbf3d36[_0x82a3('0x18')](_0x29efd7)[_0x82a3('0x19')]();};}function respondWithResult(_0x4ee3f0,_0x4efa5e){_0x4efa5e=_0x4efa5e||0xc8;return function(_0x44cb1f){if(_0x44cb1f){return _0x4ee3f0[_0x82a3('0x18')](_0x4efa5e)[_0x82a3('0x1a')](_0x44cb1f);}};}function respondWithFilteredResult(_0x4e6792,_0x33092d){return function(_0x53675d){if(_0x53675d){var _0x331b27=typeof _0x33092d[_0x82a3('0x1b')]===_0x82a3('0x1c')&&typeof _0x33092d[_0x82a3('0x1d')]==='undefined';var _0x177bc7=_0x53675d['count'];var _0x270239=_0x331b27?0x0:_0x33092d[_0x82a3('0x1b')];var _0x2c4286=_0x331b27?_0x53675d['count']:_0x33092d[_0x82a3('0x1b')]+_0x33092d['limit'];var _0x2f8ec2;if(_0x2c4286>=_0x177bc7){_0x2c4286=_0x177bc7;_0x2f8ec2=0xc8;}else{_0x2f8ec2=0xce;}_0x4e6792[_0x82a3('0x18')](_0x2f8ec2);return _0x4e6792[_0x82a3('0x1e')](_0x82a3('0x1f'),_0x270239+'-'+_0x2c4286+'/'+_0x177bc7)[_0x82a3('0x1a')](_0x53675d);}return null;};}function patchUpdates(_0x691705){return function(_0x475319){try{jsonpatch[_0x82a3('0x20')](_0x475319,_0x691705,!![]);}catch(_0xb73191){return BPromise[_0x82a3('0x21')](_0xb73191);}return _0x475319[_0x82a3('0x22')]();};}function saveUpdates(_0x431054,_0x4ae6a6){return function(_0x47baca){if(_0x47baca){return _0x47baca[_0x82a3('0x23')](_0x431054)['then'](function(_0x120295){return _0x120295;});}return null;};}function removeEntity(_0x5255b1,_0x18897c){return function(_0x4c91c6){if(_0x4c91c6){return _0x4c91c6[_0x82a3('0x24')]()[_0x82a3('0x25')](function(){_0x5255b1[_0x82a3('0x18')](0xcc)[_0x82a3('0x19')]();});}};}function handleEntityNotFound(_0x342fa1,_0x2225fc){return function(_0x44db38){if(!_0x44db38){_0x342fa1['sendStatus'](0x194);}return _0x44db38;};}function handleError(_0x828cbe,_0x4dc398){_0x4dc398=_0x4dc398||0x1f4;return function(_0x3a5f79){logger[_0x82a3('0x26')](_0x3a5f79[_0x82a3('0x27')]);if(_0x3a5f79[_0x82a3('0x28')]){delete _0x3a5f79[_0x82a3('0x28')];}_0x828cbe['status'](_0x4dc398)[_0x82a3('0x29')](_0x3a5f79);};}exports['index']=function(_0x14be9e,_0x13020d){var _0x4903f8={},_0xebabbe={},_0x135f51={'count':0x0,'rows':[]};var _0x3548a4=_[_0x82a3('0x2a')](db[_0x82a3('0x2b')][_0x82a3('0x2c')],function(_0x2f816d){return{'name':_0x2f816d['fieldName'],'type':_0x2f816d[_0x82a3('0x2d')][_0x82a3('0x2e')]};});_0xebabbe[_0x82a3('0x2f')]=_[_0x82a3('0x2a')](_0x3548a4,'name');_0xebabbe[_0x82a3('0x30')]=_[_0x82a3('0x31')](_0x14be9e[_0x82a3('0x30')]);_0xebabbe[_0x82a3('0x32')]=_['intersection'](_0xebabbe[_0x82a3('0x2f')],_0xebabbe[_0x82a3('0x30')]);_0x4903f8['attributes']=_[_0x82a3('0x33')](_0xebabbe[_0x82a3('0x2f')],qs[_0x82a3('0x34')](_0x14be9e[_0x82a3('0x30')][_0x82a3('0x34')]));_0x4903f8['attributes']=_0x4903f8[_0x82a3('0x35')][_0x82a3('0x36')]?_0x4903f8[_0x82a3('0x35')]:_0xebabbe[_0x82a3('0x2f')];if(!_0x14be9e[_0x82a3('0x30')][_0x82a3('0x37')]('nolimit')){_0x4903f8[_0x82a3('0x1d')]=qs[_0x82a3('0x1d')](_0x14be9e[_0x82a3('0x30')][_0x82a3('0x1d')]);_0x4903f8['offset']=qs[_0x82a3('0x1b')](_0x14be9e['query']['offset']);}_0x4903f8[_0x82a3('0x38')]=qs[_0x82a3('0x39')](_0x14be9e[_0x82a3('0x30')][_0x82a3('0x39')]);_0x4903f8[_0x82a3('0x3a')]=qs[_0x82a3('0x32')](_['pick'](_0x14be9e[_0x82a3('0x30')],_0xebabbe[_0x82a3('0x32')]),_0x3548a4);if(_0x14be9e[_0x82a3('0x30')]['filter']){_0x4903f8['where']=_[_0x82a3('0x3b')](_0x4903f8['where'],{'$or':_[_0x82a3('0x2a')](_0x3548a4,function(_0x5048fc){if(_0x5048fc['type']!==_0x82a3('0x3c')){var _0x1546d2={};_0x1546d2[_0x5048fc[_0x82a3('0x28')]]={'$like':'%'+_0x14be9e[_0x82a3('0x30')][_0x82a3('0x3d')]+'%'};return _0x1546d2;}})});}_0x4903f8=_['merge']({},_0x4903f8,_0x14be9e[_0x82a3('0x3e')]);var _0x17d9cd={'where':_0x4903f8['where']};return db[_0x82a3('0x2b')]['count'](_0x17d9cd)[_0x82a3('0x25')](function(_0x2a2a0a){_0x135f51[_0x82a3('0x3f')]=_0x2a2a0a;if(_0x14be9e[_0x82a3('0x30')][_0x82a3('0x40')]){_0x4903f8['include']=[{'all':!![]}];}return db[_0x82a3('0x2b')][_0x82a3('0x41')](_0x4903f8);})[_0x82a3('0x25')](function(_0x1d91c7){_0x135f51[_0x82a3('0x42')]=_0x1d91c7;return _0x135f51;})[_0x82a3('0x25')](respondWithFilteredResult(_0x13020d,_0x4903f8))[_0x82a3('0x43')](handleError(_0x13020d,null));}; \ No newline at end of file +var _0x2045=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x325b02,_0x93bb55){var _0x2a0ddd=function(_0x2118e3){while(--_0x2118e3){_0x325b02['push'](_0x325b02['shift']());}};_0x2a0ddd(++_0x93bb55);}(_0x2045,0x119));var _0x5204=function(_0x5d860a,_0xe2505b){_0x5d860a=_0x5d860a-0x0;var _0x2bd13a=_0x2045[_0x5d860a];return _0x2bd13a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5204('0x0'));var zipdir=require(_0x5204('0x1'));var jsonpatch=require(_0x5204('0x2'));var rp=require(_0x5204('0x3'));var moment=require('moment');var BPromise=require(_0x5204('0x4'));var Mustache=require(_0x5204('0x5'));var util=require(_0x5204('0x6'));var path=require(_0x5204('0x7'));var sox=require('sox');var csv=require(_0x5204('0x8'));var ejs=require(_0x5204('0x9'));var fs=require('fs');var fs_extra=require(_0x5204('0xa'));var _=require(_0x5204('0xb'));var squel=require(_0x5204('0xc'));var crypto=require(_0x5204('0xd'));var jsforce=require(_0x5204('0xe'));var deskjs=require(_0x5204('0xf'));var toCsv=require(_0x5204('0x8'));var querystring=require(_0x5204('0x10'));var Papa=require('papaparse');var Redis=require(_0x5204('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5204('0x12'));var as=require(_0x5204('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5204('0x14'))('api');var utils=require(_0x5204('0x15'));var config=require(_0x5204('0x16'));var licenseUtil=require(_0x5204('0x17'));var db=require(_0x5204('0x18'))['db'];function respondWithStatusCode(_0x46ddaf,_0x18598c){_0x18598c=_0x18598c||0xcc;return function(_0x28a46e){if(_0x28a46e){return _0x46ddaf[_0x5204('0x19')](_0x18598c);}return _0x46ddaf[_0x5204('0x1a')](_0x18598c)[_0x5204('0x1b')]();};}function respondWithResult(_0x51cda1,_0x3560a6){_0x3560a6=_0x3560a6||0xc8;return function(_0x4b280b){if(_0x4b280b){return _0x51cda1[_0x5204('0x1a')](_0x3560a6)[_0x5204('0x1c')](_0x4b280b);}};}function respondWithFilteredResult(_0x3ea8fd,_0x35c090){return function(_0x441449){if(_0x441449){var _0x44dc20=typeof _0x35c090['offset']===_0x5204('0x1d')&&typeof _0x35c090[_0x5204('0x1e')]==='undefined';var _0x5571da=_0x441449['count'];var _0x38a780=_0x44dc20?0x0:_0x35c090[_0x5204('0x1f')];var _0x4b18ea=_0x44dc20?_0x441449[_0x5204('0x20')]:_0x35c090[_0x5204('0x1f')]+_0x35c090[_0x5204('0x1e')];var _0xc6705;if(_0x4b18ea>=_0x5571da){_0x4b18ea=_0x5571da;_0xc6705=0xc8;}else{_0xc6705=0xce;}_0x3ea8fd['status'](_0xc6705);return _0x3ea8fd[_0x5204('0x21')](_0x5204('0x22'),_0x38a780+'-'+_0x4b18ea+'/'+_0x5571da)[_0x5204('0x1c')](_0x441449);}return null;};}function patchUpdates(_0x292c66){return function(_0x45e527){try{jsonpatch['apply'](_0x45e527,_0x292c66,!![]);}catch(_0x2bd3bf){return BPromise[_0x5204('0x23')](_0x2bd3bf);}return _0x45e527[_0x5204('0x24')]();};}function saveUpdates(_0x361a18,_0x546db3){return function(_0x4c0d3a){if(_0x4c0d3a){return _0x4c0d3a[_0x5204('0x25')](_0x361a18)['then'](function(_0x39fcb4){return _0x39fcb4;});}return null;};}function removeEntity(_0x23c5d8,_0x42fbdf){return function(_0x2318da){if(_0x2318da){return _0x2318da[_0x5204('0x26')]()['then'](function(){_0x23c5d8[_0x5204('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa42970,_0x3687a0){return function(_0x4232c8){if(!_0x4232c8){_0xa42970[_0x5204('0x19')](0x194);}return _0x4232c8;};}function handleError(_0x4a3dba,_0x527296){_0x527296=_0x527296||0x1f4;return function(_0xadf86a){logger[_0x5204('0x27')](_0xadf86a[_0x5204('0x28')]);if(_0xadf86a['name']){delete _0xadf86a[_0x5204('0x29')];}_0x4a3dba[_0x5204('0x1a')](_0x527296)[_0x5204('0x2a')](_0xadf86a);};}exports[_0x5204('0x2b')]=function(_0x28f91b,_0x523319){var _0x4b54a3={},_0x23f005={},_0x9c4514={'count':0x0,'rows':[]};var _0x1bfda8=_[_0x5204('0x2c')](db[_0x5204('0x2d')][_0x5204('0x2e')],function(_0x11c322){return{'name':_0x11c322[_0x5204('0x2f')],'type':_0x11c322[_0x5204('0x30')][_0x5204('0x31')]};});_0x23f005['model']=_[_0x5204('0x2c')](_0x1bfda8,_0x5204('0x29'));_0x23f005[_0x5204('0x32')]=_[_0x5204('0x33')](_0x28f91b['query']);_0x23f005['filters']=_[_0x5204('0x34')](_0x23f005[_0x5204('0x35')],_0x23f005[_0x5204('0x32')]);_0x4b54a3[_0x5204('0x36')]=_['intersection'](_0x23f005[_0x5204('0x35')],qs[_0x5204('0x37')](_0x28f91b[_0x5204('0x32')][_0x5204('0x37')]));_0x4b54a3[_0x5204('0x36')]=_0x4b54a3[_0x5204('0x36')][_0x5204('0x38')]?_0x4b54a3[_0x5204('0x36')]:_0x23f005['model'];if(!_0x28f91b[_0x5204('0x32')]['hasOwnProperty'](_0x5204('0x39'))){_0x4b54a3[_0x5204('0x1e')]=qs[_0x5204('0x1e')](_0x28f91b[_0x5204('0x32')][_0x5204('0x1e')]);_0x4b54a3[_0x5204('0x1f')]=qs[_0x5204('0x1f')](_0x28f91b[_0x5204('0x32')][_0x5204('0x1f')]);}_0x4b54a3[_0x5204('0x3a')]=qs[_0x5204('0x3b')](_0x28f91b[_0x5204('0x32')][_0x5204('0x3b')]);_0x4b54a3[_0x5204('0x3c')]=qs['filters'](_[_0x5204('0x3d')](_0x28f91b[_0x5204('0x32')],_0x23f005[_0x5204('0x3e')]),_0x1bfda8);if(_0x28f91b['query'][_0x5204('0x3f')]){_0x4b54a3[_0x5204('0x3c')]=_[_0x5204('0x40')](_0x4b54a3[_0x5204('0x3c')],{'$or':_['map'](_0x1bfda8,function(_0x21da3e){if(_0x21da3e[_0x5204('0x30')]!==_0x5204('0x41')){var _0x1c9413={};_0x1c9413[_0x21da3e['name']]={'$like':'%'+_0x28f91b[_0x5204('0x32')][_0x5204('0x3f')]+'%'};return _0x1c9413;}})});}_0x4b54a3=_[_0x5204('0x40')]({},_0x4b54a3,_0x28f91b[_0x5204('0x42')]);var _0x2f702={'where':_0x4b54a3[_0x5204('0x3c')]};return db[_0x5204('0x2d')][_0x5204('0x20')](_0x2f702)[_0x5204('0x43')](function(_0x4d700d){_0x9c4514[_0x5204('0x20')]=_0x4d700d;if(_0x28f91b['query'][_0x5204('0x44')]){_0x4b54a3['include']=[{'all':!![]}];}return db[_0x5204('0x2d')][_0x5204('0x45')](_0x4b54a3);})[_0x5204('0x43')](function(_0x350f46){_0x9c4514[_0x5204('0x46')]=_0x350f46;return _0x9c4514;})['then'](respondWithFilteredResult(_0x523319,_0x4b54a3))[_0x5204('0x47')](handleError(_0x523319,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 1ad6c14..12ea753 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 _0x0da0=['./migration.attributes','exports','define','Migration','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0da0,0x1d8));var _0x00da=function(_0x315094,_0x22442c){_0x315094=_0x315094-0x0;var _0x44973b=_0x0da0[_0x315094];return _0x44973b;};'use strict';var _=require(_0x00da('0x0'));var util=require(_0x00da('0x1'));var logger=require('../../config/logger')(_0x00da('0x2'));var moment=require(_0x00da('0x3'));var BPromise=require(_0x00da('0x4'));var rp=require(_0x00da('0x5'));var fs=require('fs');var path=require(_0x00da('0x6'));var rimraf=require(_0x00da('0x7'));var config=require('../../config/environment');var attributes=require(_0x00da('0x8'));module[_0x00da('0x9')]=function(_0x5e6b1b,_0x5454d0){return _0x5e6b1b[_0x00da('0xa')](_0x00da('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4287=['./migration.attributes','exports','Migration','migrations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xd60ef3,_0x5aa880){var _0x37724e=function(_0x6f775a){while(--_0x6f775a){_0xd60ef3['push'](_0xd60ef3['shift']());}};_0x37724e(++_0x5aa880);}(_0x4287,0xb4));var _0x7428=function(_0x1dda03,_0x1a09e5){_0x1dda03=_0x1dda03-0x0;var _0x4fa71f=_0x4287[_0x1dda03];return _0x4fa71f;};'use strict';var _=require(_0x7428('0x0'));var util=require('util');var logger=require(_0x7428('0x1'))(_0x7428('0x2'));var moment=require('moment');var BPromise=require(_0x7428('0x3'));var rp=require(_0x7428('0x4'));var fs=require('fs');var path=require(_0x7428('0x5'));var rimraf=require(_0x7428('0x6'));var config=require('../../config/environment');var attributes=require(_0x7428('0x7'));module[_0x7428('0x8')]=function(_0x3e1764,_0x48196c){return _0x3e1764['define'](_0x7428('0x9'),attributes,{'tableName':_0x7428('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 30c3c3f..3f4a799 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 _0x9993=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x162f69,_0x1c0cbf){var _0x146342=function(_0xa778db){while(--_0xa778db){_0x162f69['push'](_0x162f69['shift']());}};_0x146342(++_0x1c0cbf);}(_0x9993,0x109));var _0x3999=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9993[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3999('0x0'));var util=require('util');var moment=require(_0x3999('0x1'));var BPromise=require(_0x3999('0x2'));var rs=require(_0x3999('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3999('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3999('0x5'))(_0x3999('0x6'));var config=require(_0x3999('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3999('0x8')][_0x3999('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x536de7,_0xc27316,_0x85b5af){return new BPromise(function(_0x4c1a49,_0x77282){return client[_0x3999('0xa')](_0x536de7,_0x85b5af)['then'](function(_0x3dd61){logger['info'](_0x3999('0xb'),_0xc27316,_0x3999('0xc'));logger['debug'](_0x3999('0xd'),_0xc27316,_0x3999('0xc'),JSON[_0x3999('0xe')](_0x3dd61));if(_0x3dd61[_0x3999('0xf')]){if(_0x3dd61[_0x3999('0xf')][_0x3999('0x10')]===0x1f4){logger[_0x3999('0xf')]('Migration,\x20%s,\x20%s',_0xc27316,_0x3dd61[_0x3999('0xf')][_0x3999('0x11')]);return _0x77282(_0x3dd61['error'][_0x3999('0x11')]);}logger[_0x3999('0xf')](_0x3999('0xb'),_0xc27316,_0x3dd61[_0x3999('0xf')]['message']);return _0x4c1a49(_0x3dd61[_0x3999('0xf')]['message']);}else{logger[_0x3999('0x12')]('Migration,\x20%s,\x20%s',_0xc27316,_0x3999('0xc'));_0x4c1a49(_0x3dd61['result'][_0x3999('0x11')]);}})[_0x3999('0x13')](function(_0x27a62b){logger[_0x3999('0xf')]('Migration,\x20%s,\x20%s',_0xc27316,_0x27a62b);_0x77282(_0x27a62b);});});} \ No newline at end of file +var _0x6c9f=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x56d8e1,_0x1d2390){var _0x393fdd=function(_0x4dad8d){while(--_0x4dad8d){_0x56d8e1['push'](_0x56d8e1['shift']());}};_0x393fdd(++_0x1d2390);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x4865d6,_0x15588c){_0x4865d6=_0x4865d6-0x0;var _0x549dc4=_0x6c9f[_0x4865d6];return _0x549dc4;};'use strict';var _=require(_0xf6c9('0x0'));var util=require('util');var moment=require(_0xf6c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xf6c9('0x2'));var fs=require('fs');var Redis=require(_0xf6c9('0x3'));var db=require(_0xf6c9('0x4'))['db'];var utils=require(_0xf6c9('0x5'));var logger=require(_0xf6c9('0x6'))(_0xf6c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6c9('0x8'));var client=jayson[_0xf6c9('0x9')][_0xf6c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2abc04,_0x151322,_0x3d8579){return new BPromise(function(_0x24901b,_0x105f16){return client[_0xf6c9('0xb')](_0x2abc04,_0x3d8579)['then'](function(_0x3d93f7){logger[_0xf6c9('0xc')](_0xf6c9('0xd'),_0x151322,_0xf6c9('0xe'));logger[_0xf6c9('0xf')](_0xf6c9('0x10'),_0x151322,_0xf6c9('0xe'),JSON[_0xf6c9('0x11')](_0x3d93f7));if(_0x3d93f7[_0xf6c9('0x12')]){if(_0x3d93f7['error'][_0xf6c9('0x13')]===0x1f4){logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x3d93f7[_0xf6c9('0x12')]['message']);return _0x105f16(_0x3d93f7['error'][_0xf6c9('0x14')]);}logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x3d93f7[_0xf6c9('0x12')][_0xf6c9('0x14')]);return _0x24901b(_0x3d93f7[_0xf6c9('0x12')]['message']);}else{logger['info'](_0xf6c9('0xd'),_0x151322,_0xf6c9('0xe'));_0x24901b(_0x3d93f7['result'][_0xf6c9('0x14')]);}})[_0xf6c9('0x15')](function(_0x276b26){logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x276b26);_0x105f16(_0x276b26);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fbeddc1..87592f7 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 _0xe797=['./network.controller','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3d5f7a,_0x189a90){var _0xce3308=function(_0x22c66b){while(--_0x22c66b){_0x3d5f7a['push'](_0x3d5f7a['shift']());}};_0xce3308(++_0x189a90);}(_0xe797,0x12a));var _0x7e79=function(_0x2f1ece,_0x34e77c){_0x2f1ece=_0x2f1ece-0x0;var _0x250d5b=_0xe797[_0x2f1ece];return _0x250d5b;};'use strict';var multer=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var path=require(_0x7e79('0x2'));var timeout=require(_0x7e79('0x3'));var express=require(_0x7e79('0x4'));var router=express[_0x7e79('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7e79('0x6'));var interaction=require(_0x7e79('0x7'));var config=require('../../config/environment');var controller=require(_0x7e79('0x8'));router[_0x7e79('0x9')]('/',auth[_0x7e79('0xa')](),controller['index']);router['get'](_0x7e79('0xb'),auth[_0x7e79('0xa')](),controller['show']);router['post']('/',auth[_0x7e79('0xa')](),controller[_0x7e79('0xc')]);router[_0x7e79('0xd')]('/:id',auth[_0x7e79('0xa')](),controller[_0x7e79('0xe')]);router[_0x7e79('0xf')](_0x7e79('0xb'),auth[_0x7e79('0xa')](),controller[_0x7e79('0x10')]);module[_0x7e79('0x11')]=router; \ No newline at end of file +var _0x6b02=['put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x245327,_0x2bbe5f){var _0x4d441c=function(_0x281a13){while(--_0x281a13){_0x245327['push'](_0x245327['shift']());}};_0x4d441c(++_0x2bbe5f);}(_0x6b02,0x1d0));var _0x26b0=function(_0x1974a1,_0x347db8){_0x1974a1=_0x1974a1-0x0;var _0x415789=_0x6b02[_0x1974a1];return _0x415789;};'use strict';var multer=require('multer');var util=require(_0x26b0('0x0'));var path=require(_0x26b0('0x1'));var timeout=require(_0x26b0('0x2'));var express=require(_0x26b0('0x3'));var router=express['Router']();var fs_extra=require(_0x26b0('0x4'));var auth=require(_0x26b0('0x5'));var interaction=require(_0x26b0('0x6'));var config=require(_0x26b0('0x7'));var controller=require('./network.controller');router[_0x26b0('0x8')]('/',auth[_0x26b0('0x9')](),controller[_0x26b0('0xa')]);router[_0x26b0('0x8')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller['show']);router['post']('/',auth[_0x26b0('0x9')](),controller['create']);router[_0x26b0('0xc')](_0x26b0('0xb'),auth[_0x26b0('0x9')](),controller[_0x26b0('0xd')]);router[_0x26b0('0xe')](_0x26b0('0xb'),auth['isAuthenticated'](),controller[_0x26b0('0xf')]);module[_0x26b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index e95f629..a0c64bd 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 _0x8888=['sequelize','exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x485ebb,_0x280d95){var _0x286c48=function(_0x44f581){while(--_0x44f581){_0x485ebb['push'](_0x485ebb['shift']());}};_0x286c48(++_0x280d95);}(_0x8888,0x1b0));var _0x8888=function(_0x24ed46,_0x48c329){_0x24ed46=_0x24ed46-0x0;var _0x167b37=_0x8888[_0x24ed46];return _0x167b37;};'use strict';var Sequelize=require(_0x8888('0x0'));module[_0x8888('0x1')]={'type':{'type':Sequelize[_0x8888('0x2')](_0x8888('0x3'),_0x8888('0x4'),_0x8888('0x5'),_0x8888('0x6'))},'value':{'type':Sequelize[_0x8888('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8888('0x7')]}}; \ No newline at end of file +var _0x596d=['externip','stun','turn','STRING','ENUM','localnet'];(function(_0x2b927d,_0x299e4f){var _0x5db763=function(_0x3028a7){while(--_0x3028a7){_0x2b927d['push'](_0x2b927d['shift']());}};_0x5db763(++_0x299e4f);}(_0x596d,0x124));var _0xd596=function(_0x118215,_0x248299){_0x118215=_0x118215-0x0;var _0x40616a=_0x596d[_0x118215];return _0x40616a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd596('0x0')](_0xd596('0x1'),_0xd596('0x2'),_0xd596('0x3'),_0xd596('0x4'))},'value':{'type':Sequelize[_0xd596('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd596('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index ff85cef..9745362 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 _0xb028=['Network','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','create','sequelize','transaction','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','readFileSync','res_stun_monitor.so','format','toLowerCase','find','params','STUN','TURN','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','end','name','index'];(function(_0x1102f6,_0xf579e6){var _0x5db145=function(_0x334148){while(--_0x334148){_0x1102f6['push'](_0x1102f6['shift']());}};_0x5db145(++_0xf579e6);}(_0xb028,0xfd));var _0x8b02=function(_0x3f4d55,_0x21aca6){_0x3f4d55=_0x3f4d55-0x0;var _0x3e9d17=_0xb028[_0x3f4d55];return _0x3e9d17;};'use strict';var emlformat=require(_0x8b02('0x0'));var rimraf=require(_0x8b02('0x1'));var zipdir=require(_0x8b02('0x2'));var jsonpatch=require(_0x8b02('0x3'));var rp=require(_0x8b02('0x4'));var moment=require(_0x8b02('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8b02('0x6'));var csv=require(_0x8b02('0x7'));var ejs=require(_0x8b02('0x8'));var fs=require('fs');var fs_extra=require(_0x8b02('0x9'));var _=require(_0x8b02('0xa'));var squel=require(_0x8b02('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8b02('0x7'));var querystring=require(_0x8b02('0xc'));var Papa=require(_0x8b02('0xd'));var Redis=require('ioredis');var authService=require(_0x8b02('0xe'));var qs=require(_0x8b02('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b02('0x10'));var logger=require(_0x8b02('0x11'))('api');var utils=require(_0x8b02('0x12'));var config=require(_0x8b02('0x13'));var licenseUtil=require(_0x8b02('0x14'));var db=require(_0x8b02('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8b02('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19c1fa,_0x249144,_0x10063b,_0x4cf7db){return new BPromise(function(_0x2680e7,_0x35aaeb){var _0x23fd0c=_0x4cf7db||client;return _0x23fd0c[_0x8b02('0x17')](_0x19c1fa,_0x10063b)[_0x8b02('0x18')](function(_0x3cbd7a){logger[_0x8b02('0x19')](_0x8b02('0x1a'),_0x249144,_0x8b02('0x1b'));logger[_0x8b02('0x1c')](_0x8b02('0x1d'),_0x249144,_0x8b02('0x1b'),JSON[_0x8b02('0x1e')](_0x3cbd7a));if(_0x3cbd7a['error']){if(_0x3cbd7a['error'][_0x8b02('0x1f')]===0x1f4){logger[_0x8b02('0x20')](_0x8b02('0x1a'),_0x249144,_0x3cbd7a[_0x8b02('0x20')][_0x8b02('0x21')]);return _0x35aaeb(_0x3cbd7a[_0x8b02('0x20')][_0x8b02('0x21')]);}logger[_0x8b02('0x20')]('Network,\x20%s,\x20%s',_0x249144,_0x3cbd7a['error'][_0x8b02('0x21')]);return _0x2680e7(_0x3cbd7a[_0x8b02('0x20')][_0x8b02('0x21')]);}else{logger['info'](_0x8b02('0x1a'),_0x249144,_0x8b02('0x1b'));_0x2680e7(_0x3cbd7a[_0x8b02('0x22')]['message']);}})['catch'](function(_0x5361a4){logger[_0x8b02('0x20')](_0x8b02('0x1a'),_0x249144,_0x5361a4);_0x35aaeb(_0x5361a4);});});}function respondWithStatusCode(_0x37f3a1,_0x215209){_0x215209=_0x215209||0xcc;return function(_0x36acc6){if(_0x36acc6){return _0x37f3a1[_0x8b02('0x23')](_0x215209);}return _0x37f3a1[_0x8b02('0x24')](_0x215209)['end']();};}function respondWithResult(_0x375c85,_0xa7b43c){_0xa7b43c=_0xa7b43c||0xc8;return function(_0x4c7c43){if(_0x4c7c43){return _0x375c85[_0x8b02('0x24')](_0xa7b43c)[_0x8b02('0x25')](_0x4c7c43);}};}function respondWithFilteredResult(_0x30febd,_0x38fe60){return function(_0x566920){if(_0x566920){var _0x3ab81f=typeof _0x38fe60[_0x8b02('0x26')]===_0x8b02('0x27')&&typeof _0x38fe60[_0x8b02('0x28')]==='undefined';var _0xf465d9=_0x566920[_0x8b02('0x29')];var _0x7d6f72=_0x3ab81f?0x0:_0x38fe60[_0x8b02('0x26')];var _0x1a1a20=_0x3ab81f?_0x566920[_0x8b02('0x29')]:_0x38fe60[_0x8b02('0x26')]+_0x38fe60['limit'];var _0x3b7b03;if(_0x1a1a20>=_0xf465d9){_0x1a1a20=_0xf465d9;_0x3b7b03=0xc8;}else{_0x3b7b03=0xce;}_0x30febd[_0x8b02('0x24')](_0x3b7b03);return _0x30febd[_0x8b02('0x2a')](_0x8b02('0x2b'),_0x7d6f72+'-'+_0x1a1a20+'/'+_0xf465d9)[_0x8b02('0x25')](_0x566920);}return null;};}function patchUpdates(_0x36f5c0){return function(_0x529149){try{jsonpatch[_0x8b02('0x2c')](_0x529149,_0x36f5c0,!![]);}catch(_0x2e8325){return BPromise['reject'](_0x2e8325);}return _0x529149['save']();};}function saveUpdates(_0x17d1ed,_0x522c42){return function(_0x10ea33){if(_0x10ea33){return _0x10ea33[_0x8b02('0x2d')](_0x17d1ed)['then'](function(_0xe986b8){return _0xe986b8;});}return null;};}function removeEntity(_0x8a043d,_0x7f7b49){return function(_0x4702d6){if(_0x4702d6){return _0x4702d6[_0x8b02('0x2e')]()[_0x8b02('0x18')](function(){_0x8a043d[_0x8b02('0x24')](0xcc)[_0x8b02('0x2f')]();});}};}function handleEntityNotFound(_0x4c2a08,_0x4d144e){return function(_0x33e5e5){if(!_0x33e5e5){_0x4c2a08['sendStatus'](0x194);}return _0x33e5e5;};}function handleError(_0x820630,_0x347df5){_0x347df5=_0x347df5||0x1f4;return function(_0x3085a4){logger[_0x8b02('0x20')](_0x3085a4['stack']);if(_0x3085a4[_0x8b02('0x30')]){delete _0x3085a4[_0x8b02('0x30')];}_0x820630[_0x8b02('0x24')](_0x347df5)['send'](_0x3085a4);};}exports[_0x8b02('0x31')]=function(_0x2950e6,_0x221d11){var _0x489129={},_0x44d368={},_0x5a148c={'count':0x0,'rows':[]};var _0x35a889=_['map'](db[_0x8b02('0x32')][_0x8b02('0x33')],function(_0x3a9c6f){return{'name':_0x3a9c6f[_0x8b02('0x34')],'type':_0x3a9c6f[_0x8b02('0x35')][_0x8b02('0x36')]};});_0x44d368[_0x8b02('0x37')]=_[_0x8b02('0x38')](_0x35a889,'name');_0x44d368[_0x8b02('0x39')]=_[_0x8b02('0x3a')](_0x2950e6[_0x8b02('0x39')]);_0x44d368[_0x8b02('0x3b')]=_[_0x8b02('0x3c')](_0x44d368[_0x8b02('0x37')],_0x44d368[_0x8b02('0x39')]);_0x489129[_0x8b02('0x3d')]=_['intersection'](_0x44d368[_0x8b02('0x37')],qs[_0x8b02('0x3e')](_0x2950e6[_0x8b02('0x39')][_0x8b02('0x3e')]));_0x489129['attributes']=_0x489129['attributes']['length']?_0x489129['attributes']:_0x44d368[_0x8b02('0x37')];if(!_0x2950e6[_0x8b02('0x39')][_0x8b02('0x3f')]('nolimit')){_0x489129['limit']=qs[_0x8b02('0x28')](_0x2950e6['query'][_0x8b02('0x28')]);_0x489129[_0x8b02('0x26')]=qs[_0x8b02('0x26')](_0x2950e6[_0x8b02('0x39')][_0x8b02('0x26')]);}_0x489129[_0x8b02('0x40')]=qs['sort'](_0x2950e6[_0x8b02('0x39')]['sort']);_0x489129[_0x8b02('0x41')]=qs[_0x8b02('0x3b')](_['pick'](_0x2950e6[_0x8b02('0x39')],_0x44d368[_0x8b02('0x3b')]),_0x35a889);if(_0x2950e6[_0x8b02('0x39')][_0x8b02('0x42')]){_0x489129[_0x8b02('0x41')]=_[_0x8b02('0x43')](_0x489129['where'],{'$or':_[_0x8b02('0x38')](_0x35a889,function(_0x3f551b){if(_0x3f551b['type']!==_0x8b02('0x44')){var _0x4eee9d={};_0x4eee9d[_0x3f551b[_0x8b02('0x30')]]={'$like':'%'+_0x2950e6['query'][_0x8b02('0x42')]+'%'};return _0x4eee9d;}})});}_0x489129=_[_0x8b02('0x43')]({},_0x489129,_0x2950e6[_0x8b02('0x45')]);var _0x1a5aa1={'where':_0x489129['where']};return db[_0x8b02('0x32')][_0x8b02('0x29')](_0x1a5aa1)[_0x8b02('0x18')](function(_0x44c8aa){_0x5a148c[_0x8b02('0x29')]=_0x44c8aa;if(_0x2950e6[_0x8b02('0x39')][_0x8b02('0x46')]){_0x489129['include']=[{'all':!![]}];}return db[_0x8b02('0x32')][_0x8b02('0x47')](_0x489129);})[_0x8b02('0x18')](function(_0x4c5a09){_0x5a148c[_0x8b02('0x48')]=_0x4c5a09;return _0x5a148c;})['then'](respondWithFilteredResult(_0x221d11,_0x489129))[_0x8b02('0x49')](handleError(_0x221d11,null));};exports[_0x8b02('0x4a')]=function(_0x1640e9,_0x2a1c05){var _0x5449fc={'raw':!![],'where':{'id':_0x1640e9['params']['id']}},_0x1c7743={};_0x1c7743[_0x8b02('0x37')]=_['keys'](db[_0x8b02('0x32')][_0x8b02('0x33')]);_0x1c7743[_0x8b02('0x39')]=_[_0x8b02('0x3a')](_0x1640e9['query']);_0x1c7743[_0x8b02('0x3b')]=_['intersection'](_0x1c7743['model'],_0x1c7743[_0x8b02('0x39')]);_0x5449fc[_0x8b02('0x3d')]=_[_0x8b02('0x3c')](_0x1c7743[_0x8b02('0x37')],qs[_0x8b02('0x3e')](_0x1640e9['query'][_0x8b02('0x3e')]));_0x5449fc[_0x8b02('0x3d')]=_0x5449fc['attributes'][_0x8b02('0x4b')]?_0x5449fc[_0x8b02('0x3d')]:_0x1c7743[_0x8b02('0x37')];if(_0x1640e9[_0x8b02('0x39')][_0x8b02('0x46')]){_0x5449fc[_0x8b02('0x4c')]=[{'all':!![]}];}_0x5449fc=_[_0x8b02('0x43')]({},_0x5449fc,_0x1640e9[_0x8b02('0x45')]);return db['Network']['find'](_0x5449fc)[_0x8b02('0x18')](handleEntityNotFound(_0x2a1c05,null))[_0x8b02('0x18')](respondWithResult(_0x2a1c05,null))[_0x8b02('0x49')](handleError(_0x2a1c05,null));};exports[_0x8b02('0x4d')]=function(_0xc7f5b0,_0x16f055,_0x44ece4){var _0x2281b5;return db[_0x8b02('0x4e')][_0x8b02('0x4f')](function(_0x14466e){return db[_0x8b02('0x32')][_0x8b02('0x4d')](_0xc7f5b0[_0x8b02('0x50')],{'raw':!![]})[_0x8b02('0x18')](function(_0x4b98e7){_0x2281b5=_0x4b98e7;return db[_0x8b02('0x32')][_0x8b02('0x47')]({'where':{'type':_0xc7f5b0[_0x8b02('0x50')]['type']},'raw':!![]});})[_0x8b02('0x18')](function(_0x3360c4){if(_0x2281b5[_0x8b02('0x35')][_0x8b02('0x51')]()=='STUN'){var _0x410ab0=fs['readFileSync'](path[_0x8b02('0x52')](config[_0x8b02('0x53')],_0x8b02('0x54')),_0x8b02('0x55'));var _0x1b6329=ejs[_0x8b02('0x56')](_0x410ab0,{'networks':_0x3360c4||[]});fs[_0x8b02('0x57')](_0x8b02('0x58'),_0x1b6329);return respondWithRpcPromise(_0x8b02('0x59'),_0x8b02('0x4d'),{'module':'res_stun_monitor.so'});}else if(_0x2281b5['type'][_0x8b02('0x51')]()=='TURN'){var _0x1dde32=fs[_0x8b02('0x5a')](path['join'](config[_0x8b02('0x53')],'server/files/templates/turn_multiple.ejs'),_0x8b02('0x55'));var _0x46ed35=ejs[_0x8b02('0x56')](_0x1dde32,{'networks':_0x3360c4||[]});fs[_0x8b02('0x57')]('/etc/asterisk/turn_xcally.conf',_0x46ed35);return respondWithRpcPromise(_0x8b02('0x59'),_0x8b02('0x4d'),{'module':_0x8b02('0x5b')});}else{var _0x1a14f3=fs[_0x8b02('0x5a')](path['join'](config[_0x8b02('0x53')],'server/files/templates/network.ejs'),_0x8b02('0x55'));var _0x413853=ejs[_0x8b02('0x56')](_0x1a14f3,{'networks':_0x3360c4||[]});fs[_0x8b02('0x57')](util[_0x8b02('0x5c')]('/etc/asterisk/sip_xcally_%s.conf',_0xc7f5b0[_0x8b02('0x50')][_0x8b02('0x35')][_0x8b02('0x5d')]()),_0x413853);return respondWithRpcPromise(_0x8b02('0x59'),'create',{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x2281b5;});})['then'](respondWithResult(_0x16f055,0xc9))[_0x8b02('0x49')](handleError(_0x16f055,null));};exports['update']=function(_0x249cea,_0x4dfa44,_0x5a1c19){var _0x2f45af;return db[_0x8b02('0x4e')][_0x8b02('0x4f')](function(_0x55de39){return db[_0x8b02('0x32')][_0x8b02('0x5e')]({'where':{'id':_0x249cea[_0x8b02('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4dfa44,null))[_0x8b02('0x18')](saveUpdates(_0x249cea[_0x8b02('0x50')],null))['then'](function(_0x1e121){if(_0x1e121){_0x2f45af=_0x1e121;return db['Network'][_0x8b02('0x47')]({'where':{'type':_0x2f45af[_0x8b02('0x35')]},'raw':!![]});}return null;})['then'](function(_0x16ff24){if(_0x2f45af[_0x8b02('0x35')][_0x8b02('0x51')]()==_0x8b02('0x60')){var _0x3d7cfd=fs[_0x8b02('0x5a')](path[_0x8b02('0x52')](config[_0x8b02('0x53')],_0x8b02('0x54')),_0x8b02('0x55'));var _0x536a9c=ejs[_0x8b02('0x56')](_0x3d7cfd,{'networks':_0x16ff24||[]});fs[_0x8b02('0x57')](_0x8b02('0x58'),_0x536a9c);return respondWithRpcPromise(_0x8b02('0x59'),_0x8b02('0x2d'),{'module':'res_stun_monitor.so'});}else if(_0x2f45af[_0x8b02('0x35')][_0x8b02('0x51')]()==_0x8b02('0x61')){var _0x2f1885=fs[_0x8b02('0x5a')](path['join'](config[_0x8b02('0x53')],'server/files/templates/turn_multiple.ejs'),_0x8b02('0x55'));var _0x3b29b5=ejs[_0x8b02('0x56')](_0x2f1885,{'networks':_0x16ff24||[]});fs[_0x8b02('0x57')]('/etc/asterisk/turn_xcally.conf',_0x3b29b5);return respondWithRpcPromise(_0x8b02('0x59'),_0x8b02('0x2d'),{'module':_0x8b02('0x5b')});}else{var _0x54c583=fs['readFileSync'](path[_0x8b02('0x52')](config[_0x8b02('0x53')],_0x8b02('0x62')),_0x8b02('0x55'));var _0x2a2541=ejs['render'](_0x54c583,{'networks':_0x16ff24||[]});fs[_0x8b02('0x57')](util['format'](_0x8b02('0x63'),_0x249cea['body']['type'][_0x8b02('0x5d')]()),_0x2a2541);return respondWithRpcPromise(_0x8b02('0x59'),_0x8b02('0x2d'),{'module':_0x8b02('0x64')});}return null;})[_0x8b02('0x18')](function(_0x2e236d){if(_0x2e236d){return _0x2f45af;}return null;});})['then'](respondWithResult(_0x4dfa44,null))[_0x8b02('0x49')](handleError(_0x4dfa44,null));};exports['destroy']=function(_0x4745e5,_0x38b4d4,_0x5ebd8c){var _0xa2cffe;return db[_0x8b02('0x32')]['find']({'where':{'id':_0x4745e5[_0x8b02('0x5f')]['id']}})['then'](function(_0x134e8d){_0xa2cffe=_0x134e8d;return _0x134e8d;})[_0x8b02('0x18')](handleEntityNotFound(_0x38b4d4,null))[_0x8b02('0x18')](removeEntity(_0x38b4d4,null))['then'](function(){if(_0xa2cffe){return db['Network'][_0x8b02('0x47')]({'where':{'type':_0xa2cffe[_0x8b02('0x35')]},'raw':!![]});}})[_0x8b02('0x18')](function(_0x1331a6){if(_0xa2cffe['type'][_0x8b02('0x51')]()==_0x8b02('0x60')){var _0x175ded=fs['readFileSync'](path[_0x8b02('0x52')](config[_0x8b02('0x53')],_0x8b02('0x54')),_0x8b02('0x55'));var _0x2b47a2=ejs[_0x8b02('0x56')](_0x175ded,{'networks':_0x1331a6||[]});fs[_0x8b02('0x57')]('/etc/asterisk/stun_xcally.conf',_0x2b47a2);return respondWithRpcPromise('Reload',_0x8b02('0x2e'),{'module':_0x8b02('0x5b')});}else if(_0xa2cffe['type'][_0x8b02('0x51')]()==_0x8b02('0x61')){var _0x2e1f14=fs[_0x8b02('0x5a')](path[_0x8b02('0x52')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x8b02('0x55'));var _0x2391f0=ejs['render'](_0x2e1f14,{'networks':_0x1331a6||[]});fs[_0x8b02('0x57')]('/etc/asterisk/turn_xcally.conf',_0x2391f0);return respondWithRpcPromise(_0x8b02('0x59'),'destroy',{'module':_0x8b02('0x5b')});}else{var _0x3b9492=fs[_0x8b02('0x5a')](path[_0x8b02('0x52')](config[_0x8b02('0x53')],_0x8b02('0x62')),'utf8');var _0x9b9d5e=ejs[_0x8b02('0x56')](_0x3b9492,{'networks':_0x1331a6||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4745e5[_0x8b02('0x50')][_0x8b02('0x35')][_0x8b02('0x5d')]()),_0x9b9d5e);return respondWithRpcPromise(_0x8b02('0x59'),_0x8b02('0x2e'),{'module':_0x8b02('0x64')});}return null;})[_0x8b02('0x49')](handleError(_0x38b4d4,null));}; \ No newline at end of file +var _0x929a=['include','findAll','rows','show','params','keys','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','sequelize','transaction','find','/etc/asterisk/stun_xcally.conf','TURN','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','sendStatus','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','includeAll'];(function(_0x35f07b,_0x50dd7a){var _0x345e66=function(_0x528ad1){while(--_0x528ad1){_0x35f07b['push'](_0x35f07b['shift']());}};_0x345e66(++_0x50dd7a);}(_0x929a,0xf2));var _0xa929=function(_0x34e3ce,_0x3b1a5b){_0x34e3ce=_0x34e3ce-0x0;var _0x1ac204=_0x929a[_0x34e3ce];return _0x1ac204;};'use strict';var emlformat=require(_0xa929('0x0'));var rimraf=require(_0xa929('0x1'));var zipdir=require(_0xa929('0x2'));var jsonpatch=require(_0xa929('0x3'));var rp=require('request-promise');var moment=require(_0xa929('0x4'));var BPromise=require(_0xa929('0x5'));var Mustache=require(_0xa929('0x6'));var util=require('util');var path=require(_0xa929('0x7'));var sox=require(_0xa929('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa929('0x9'));var _=require(_0xa929('0xa'));var squel=require(_0xa929('0xb'));var crypto=require(_0xa929('0xc'));var jsforce=require(_0xa929('0xd'));var deskjs=require(_0xa929('0xe'));var toCsv=require(_0xa929('0xf'));var querystring=require(_0xa929('0x10'));var Papa=require(_0xa929('0x11'));var Redis=require('ioredis');var authService=require(_0xa929('0x12'));var qs=require(_0xa929('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa929('0x14'))(_0xa929('0x15'));var utils=require('../../config/utils');var config=require(_0xa929('0x16'));var licenseUtil=require(_0xa929('0x17'));var db=require(_0xa929('0x18'))['db'];var jayson=require(_0xa929('0x19'));var client=jayson[_0xa929('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a24fd,_0x2672d5,_0x4f733a,_0x3c736e){return new BPromise(function(_0x1b1322,_0x340a56){var _0x4d7f19=_0x3c736e||client;return _0x4d7f19[_0xa929('0x1b')](_0x2a24fd,_0x4f733a)[_0xa929('0x1c')](function(_0x3d15e6){logger[_0xa929('0x1d')](_0xa929('0x1e'),_0x2672d5,_0xa929('0x1f'));logger[_0xa929('0x20')](_0xa929('0x21'),_0x2672d5,_0xa929('0x1f'),JSON[_0xa929('0x22')](_0x3d15e6));if(_0x3d15e6['error']){if(_0x3d15e6[_0xa929('0x23')]['code']===0x1f4){logger['error'](_0xa929('0x1e'),_0x2672d5,_0x3d15e6[_0xa929('0x23')][_0xa929('0x24')]);return _0x340a56(_0x3d15e6['error'][_0xa929('0x24')]);}logger['error']('Network,\x20%s,\x20%s',_0x2672d5,_0x3d15e6[_0xa929('0x23')]['message']);return _0x1b1322(_0x3d15e6[_0xa929('0x23')][_0xa929('0x24')]);}else{logger[_0xa929('0x1d')](_0xa929('0x1e'),_0x2672d5,'request\x20sent');_0x1b1322(_0x3d15e6['result'][_0xa929('0x24')]);}})[_0xa929('0x25')](function(_0x1a1efa){logger[_0xa929('0x23')](_0xa929('0x1e'),_0x2672d5,_0x1a1efa);_0x340a56(_0x1a1efa);});});}function respondWithStatusCode(_0x4607eb,_0x4b8677){_0x4b8677=_0x4b8677||0xcc;return function(_0x1b25be){if(_0x1b25be){return _0x4607eb['sendStatus'](_0x4b8677);}return _0x4607eb[_0xa929('0x26')](_0x4b8677)[_0xa929('0x27')]();};}function respondWithResult(_0x2e3425,_0x3382c6){_0x3382c6=_0x3382c6||0xc8;return function(_0x619385){if(_0x619385){return _0x2e3425[_0xa929('0x26')](_0x3382c6)[_0xa929('0x28')](_0x619385);}};}function respondWithFilteredResult(_0x5172c0,_0x349ce0){return function(_0xb462f8){if(_0xb462f8){var _0x3d0df4=typeof _0x349ce0[_0xa929('0x29')]==='undefined'&&typeof _0x349ce0[_0xa929('0x2a')]==='undefined';var _0x42e293=_0xb462f8[_0xa929('0x2b')];var _0x1cee39=_0x3d0df4?0x0:_0x349ce0[_0xa929('0x29')];var _0x533bcb=_0x3d0df4?_0xb462f8[_0xa929('0x2b')]:_0x349ce0[_0xa929('0x29')]+_0x349ce0[_0xa929('0x2a')];var _0x115432;if(_0x533bcb>=_0x42e293){_0x533bcb=_0x42e293;_0x115432=0xc8;}else{_0x115432=0xce;}_0x5172c0[_0xa929('0x26')](_0x115432);return _0x5172c0[_0xa929('0x2c')](_0xa929('0x2d'),_0x1cee39+'-'+_0x533bcb+'/'+_0x42e293)[_0xa929('0x28')](_0xb462f8);}return null;};}function patchUpdates(_0x15796b){return function(_0xaffe21){try{jsonpatch[_0xa929('0x2e')](_0xaffe21,_0x15796b,!![]);}catch(_0x2580a6){return BPromise['reject'](_0x2580a6);}return _0xaffe21[_0xa929('0x2f')]();};}function saveUpdates(_0x1526c4,_0x170c43){return function(_0xd1abe8){if(_0xd1abe8){return _0xd1abe8[_0xa929('0x30')](_0x1526c4)[_0xa929('0x1c')](function(_0x58575d){return _0x58575d;});}return null;};}function removeEntity(_0x548d0d,_0x33adb1){return function(_0x1f1dc1){if(_0x1f1dc1){return _0x1f1dc1['destroy']()[_0xa929('0x1c')](function(){_0x548d0d['status'](0xcc)[_0xa929('0x27')]();});}};}function handleEntityNotFound(_0xa4143d,_0x2a4740){return function(_0x277ef3){if(!_0x277ef3){_0xa4143d[_0xa929('0x31')](0x194);}return _0x277ef3;};}function handleError(_0x33f970,_0x1b3191){_0x1b3191=_0x1b3191||0x1f4;return function(_0x3ab7ff){logger[_0xa929('0x23')](_0x3ab7ff[_0xa929('0x32')]);if(_0x3ab7ff['name']){delete _0x3ab7ff[_0xa929('0x33')];}_0x33f970[_0xa929('0x26')](_0x1b3191)[_0xa929('0x34')](_0x3ab7ff);};}exports['index']=function(_0x27cffa,_0x4deee7){var _0x13d765={},_0x33c1d6={},_0x19174d={'count':0x0,'rows':[]};var _0x2a6ff8=_[_0xa929('0x35')](db[_0xa929('0x36')][_0xa929('0x37')],function(_0xc97830){return{'name':_0xc97830[_0xa929('0x38')],'type':_0xc97830[_0xa929('0x39')][_0xa929('0x3a')]};});_0x33c1d6[_0xa929('0x3b')]=_[_0xa929('0x35')](_0x2a6ff8,'name');_0x33c1d6[_0xa929('0x3c')]=_['keys'](_0x27cffa[_0xa929('0x3c')]);_0x33c1d6[_0xa929('0x3d')]=_[_0xa929('0x3e')](_0x33c1d6[_0xa929('0x3b')],_0x33c1d6[_0xa929('0x3c')]);_0x13d765['attributes']=_['intersection'](_0x33c1d6['model'],qs[_0xa929('0x3f')](_0x27cffa[_0xa929('0x3c')][_0xa929('0x3f')]));_0x13d765[_0xa929('0x40')]=_0x13d765[_0xa929('0x40')][_0xa929('0x41')]?_0x13d765[_0xa929('0x40')]:_0x33c1d6[_0xa929('0x3b')];if(!_0x27cffa[_0xa929('0x3c')]['hasOwnProperty'](_0xa929('0x42'))){_0x13d765[_0xa929('0x2a')]=qs[_0xa929('0x2a')](_0x27cffa[_0xa929('0x3c')][_0xa929('0x2a')]);_0x13d765[_0xa929('0x29')]=qs[_0xa929('0x29')](_0x27cffa[_0xa929('0x3c')][_0xa929('0x29')]);}_0x13d765[_0xa929('0x43')]=qs[_0xa929('0x44')](_0x27cffa[_0xa929('0x3c')][_0xa929('0x44')]);_0x13d765[_0xa929('0x45')]=qs['filters'](_[_0xa929('0x46')](_0x27cffa[_0xa929('0x3c')],_0x33c1d6[_0xa929('0x3d')]),_0x2a6ff8);if(_0x27cffa[_0xa929('0x3c')]['filter']){_0x13d765[_0xa929('0x45')]=_['merge'](_0x13d765[_0xa929('0x45')],{'$or':_[_0xa929('0x35')](_0x2a6ff8,function(_0x34448b){if(_0x34448b[_0xa929('0x39')]!=='VIRTUAL'){var _0x4787b4={};_0x4787b4[_0x34448b[_0xa929('0x33')]]={'$like':'%'+_0x27cffa[_0xa929('0x3c')][_0xa929('0x47')]+'%'};return _0x4787b4;}})});}_0x13d765=_['merge']({},_0x13d765,_0x27cffa['options']);var _0x9e7e27={'where':_0x13d765[_0xa929('0x45')]};return db[_0xa929('0x36')][_0xa929('0x2b')](_0x9e7e27)[_0xa929('0x1c')](function(_0x111fbc){_0x19174d[_0xa929('0x2b')]=_0x111fbc;if(_0x27cffa[_0xa929('0x3c')][_0xa929('0x48')]){_0x13d765[_0xa929('0x49')]=[{'all':!![]}];}return db[_0xa929('0x36')][_0xa929('0x4a')](_0x13d765);})[_0xa929('0x1c')](function(_0xddcced){_0x19174d[_0xa929('0x4b')]=_0xddcced;return _0x19174d;})[_0xa929('0x1c')](respondWithFilteredResult(_0x4deee7,_0x13d765))[_0xa929('0x25')](handleError(_0x4deee7,null));};exports[_0xa929('0x4c')]=function(_0x30cb4e,_0x18ed9c){var _0x5c4253={'raw':!![],'where':{'id':_0x30cb4e[_0xa929('0x4d')]['id']}},_0xd0ff7e={};_0xd0ff7e[_0xa929('0x3b')]=_['keys'](db['Network'][_0xa929('0x37')]);_0xd0ff7e[_0xa929('0x3c')]=_[_0xa929('0x4e')](_0x30cb4e['query']);_0xd0ff7e[_0xa929('0x3d')]=_[_0xa929('0x3e')](_0xd0ff7e[_0xa929('0x3b')],_0xd0ff7e[_0xa929('0x3c')]);_0x5c4253[_0xa929('0x40')]=_[_0xa929('0x3e')](_0xd0ff7e[_0xa929('0x3b')],qs[_0xa929('0x3f')](_0x30cb4e[_0xa929('0x3c')][_0xa929('0x3f')]));_0x5c4253[_0xa929('0x40')]=_0x5c4253[_0xa929('0x40')][_0xa929('0x41')]?_0x5c4253[_0xa929('0x40')]:_0xd0ff7e[_0xa929('0x3b')];if(_0x30cb4e[_0xa929('0x3c')][_0xa929('0x48')]){_0x5c4253['include']=[{'all':!![]}];}_0x5c4253=_['merge']({},_0x5c4253,_0x30cb4e['options']);return db[_0xa929('0x36')]['find'](_0x5c4253)[_0xa929('0x1c')](handleEntityNotFound(_0x18ed9c,null))['then'](respondWithResult(_0x18ed9c,null))[_0xa929('0x25')](handleError(_0x18ed9c,null));};exports[_0xa929('0x4f')]=function(_0x342090,_0x58f203,_0x119273){var _0x457d36;return db['sequelize']['transaction'](function(_0x497c06){return db[_0xa929('0x36')][_0xa929('0x4f')](_0x342090[_0xa929('0x50')],{'raw':!![]})['then'](function(_0x34406e){_0x457d36=_0x34406e;return db[_0xa929('0x36')][_0xa929('0x4a')]({'where':{'type':_0x342090[_0xa929('0x50')][_0xa929('0x39')]},'raw':!![]});})[_0xa929('0x1c')](function(_0x854415){if(_0x457d36['type'][_0xa929('0x51')]()==_0xa929('0x52')){var _0x4484a3=fs[_0xa929('0x53')](path[_0xa929('0x54')](config[_0xa929('0x55')],_0xa929('0x56')),_0xa929('0x57'));var _0x244ee5=ejs[_0xa929('0x58')](_0x4484a3,{'networks':_0x854415||[]});fs[_0xa929('0x59')]('/etc/asterisk/stun_xcally.conf',_0x244ee5);return respondWithRpcPromise('Reload','create',{'module':_0xa929('0x5a')});}else if(_0x457d36['type'][_0xa929('0x51')]()=='TURN'){var _0x3a2bca=fs[_0xa929('0x53')](path[_0xa929('0x54')](config[_0xa929('0x55')],_0xa929('0x5b')),_0xa929('0x57'));var _0x2d28fd=ejs[_0xa929('0x58')](_0x3a2bca,{'networks':_0x854415||[]});fs[_0xa929('0x59')](_0xa929('0x5c'),_0x2d28fd);return respondWithRpcPromise('Reload',_0xa929('0x4f'),{'module':'res_stun_monitor.so'});}else{var _0x1db8bc=fs[_0xa929('0x53')](path['join'](config[_0xa929('0x55')],_0xa929('0x5d')),_0xa929('0x57'));var _0x294174=ejs[_0xa929('0x58')](_0x1db8bc,{'networks':_0x854415||[]});fs[_0xa929('0x59')](util[_0xa929('0x5e')](_0xa929('0x5f'),_0x342090['body'][_0xa929('0x39')][_0xa929('0x60')]()),_0x294174);return respondWithRpcPromise(_0xa929('0x61'),_0xa929('0x4f'),{'module':_0xa929('0x62')});}return null;})[_0xa929('0x1c')](function(){return _0x457d36;});})[_0xa929('0x1c')](respondWithResult(_0x58f203,0xc9))[_0xa929('0x25')](handleError(_0x58f203,null));};exports[_0xa929('0x30')]=function(_0x3028e3,_0x19f40f,_0x2e2acd){var _0x12d5e1;return db[_0xa929('0x63')][_0xa929('0x64')](function(_0x510be6){return db[_0xa929('0x36')][_0xa929('0x65')]({'where':{'id':_0x3028e3['params']['id']}})[_0xa929('0x1c')](handleEntityNotFound(_0x19f40f,null))[_0xa929('0x1c')](saveUpdates(_0x3028e3[_0xa929('0x50')],null))[_0xa929('0x1c')](function(_0x12d097){if(_0x12d097){_0x12d5e1=_0x12d097;return db[_0xa929('0x36')]['findAll']({'where':{'type':_0x12d5e1['type']},'raw':!![]});}return null;})[_0xa929('0x1c')](function(_0x1b7ebb){if(_0x12d5e1[_0xa929('0x39')]['toUpperCase']()=='STUN'){var _0x38ab8b=fs[_0xa929('0x53')](path['join'](config[_0xa929('0x55')],_0xa929('0x56')),'utf8');var _0x4ba8f5=ejs['render'](_0x38ab8b,{'networks':_0x1b7ebb||[]});fs[_0xa929('0x59')](_0xa929('0x66'),_0x4ba8f5);return respondWithRpcPromise('Reload',_0xa929('0x30'),{'module':_0xa929('0x5a')});}else if(_0x12d5e1[_0xa929('0x39')][_0xa929('0x51')]()==_0xa929('0x67')){var _0x414545=fs[_0xa929('0x53')](path[_0xa929('0x54')](config[_0xa929('0x55')],_0xa929('0x5b')),_0xa929('0x57'));var _0x91446f=ejs[_0xa929('0x58')](_0x414545,{'networks':_0x1b7ebb||[]});fs[_0xa929('0x59')](_0xa929('0x5c'),_0x91446f);return respondWithRpcPromise(_0xa929('0x61'),_0xa929('0x30'),{'module':_0xa929('0x5a')});}else{var _0x12826f=fs[_0xa929('0x53')](path[_0xa929('0x54')](config[_0xa929('0x55')],_0xa929('0x5d')),'utf8');var _0x30a480=ejs['render'](_0x12826f,{'networks':_0x1b7ebb||[]});fs[_0xa929('0x59')](util[_0xa929('0x5e')](_0xa929('0x5f'),_0x3028e3['body'][_0xa929('0x39')][_0xa929('0x60')]()),_0x30a480);return respondWithRpcPromise(_0xa929('0x61'),_0xa929('0x30'),{'module':_0xa929('0x62')});}return null;})['then'](function(_0x35ebe6){if(_0x35ebe6){return _0x12d5e1;}return null;});})[_0xa929('0x1c')](respondWithResult(_0x19f40f,null))[_0xa929('0x25')](handleError(_0x19f40f,null));};exports[_0xa929('0x68')]=function(_0x57d61a,_0x5e9bf9,_0x521c04){var _0x57e963;return db[_0xa929('0x36')][_0xa929('0x65')]({'where':{'id':_0x57d61a[_0xa929('0x4d')]['id']}})['then'](function(_0x370a3d){_0x57e963=_0x370a3d;return _0x370a3d;})[_0xa929('0x1c')](handleEntityNotFound(_0x5e9bf9,null))[_0xa929('0x1c')](removeEntity(_0x5e9bf9,null))[_0xa929('0x1c')](function(){if(_0x57e963){return db['Network'][_0xa929('0x4a')]({'where':{'type':_0x57e963['type']},'raw':!![]});}})[_0xa929('0x1c')](function(_0x6d896a){if(_0x57e963['type'][_0xa929('0x51')]()==_0xa929('0x52')){var _0x8562a9=fs[_0xa929('0x53')](path[_0xa929('0x54')](config[_0xa929('0x55')],'server/files/templates/stun_multiple.ejs'),_0xa929('0x57'));var _0xeb2a07=ejs[_0xa929('0x58')](_0x8562a9,{'networks':_0x6d896a||[]});fs[_0xa929('0x59')](_0xa929('0x66'),_0xeb2a07);return respondWithRpcPromise(_0xa929('0x61'),_0xa929('0x68'),{'module':_0xa929('0x5a')});}else if(_0x57e963[_0xa929('0x39')][_0xa929('0x51')]()=='TURN'){var _0x16102d=fs[_0xa929('0x53')](path[_0xa929('0x54')](config['root'],_0xa929('0x5b')),_0xa929('0x57'));var _0x3edc1d=ejs['render'](_0x16102d,{'networks':_0x6d896a||[]});fs['writeFileSync'](_0xa929('0x5c'),_0x3edc1d);return respondWithRpcPromise(_0xa929('0x61'),_0xa929('0x68'),{'module':_0xa929('0x5a')});}else{var _0x2ad7b0=fs[_0xa929('0x53')](path[_0xa929('0x54')](config[_0xa929('0x55')],_0xa929('0x5d')),'utf8');var _0x456e29=ejs['render'](_0x2ad7b0,{'networks':_0x6d896a||[]});fs[_0xa929('0x59')](util['format'](_0xa929('0x5f'),_0x57d61a[_0xa929('0x50')]['type'][_0xa929('0x60')]()),_0x456e29);return respondWithRpcPromise(_0xa929('0x61'),_0xa929('0x68'),{'module':_0xa929('0x62')});}return null;})[_0xa929('0x25')](handleError(_0x5e9bf9,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 59a25e6..ee54e93 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 _0xd52a=['define','network','util','api','moment','bluebird','path','rimraf','../../config/environment','./network.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52a,0xca));var _0xad52=function(_0x33309c,_0xc4c9e9){_0x33309c=_0x33309c-0x0;var _0x51cf4e=_0xd52a[_0x33309c];return _0x51cf4e;};'use strict';var _=require('lodash');var util=require(_0xad52('0x0'));var logger=require('../../config/logger')(_0xad52('0x1'));var moment=require(_0xad52('0x2'));var BPromise=require(_0xad52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad52('0x4'));var rimraf=require(_0xad52('0x5'));var config=require(_0xad52('0x6'));var attributes=require(_0xad52('0x7'));module['exports']=function(_0x525806,_0x51bdaa){return _0x525806[_0xad52('0x8')]('Network',attributes,{'tableName':_0xad52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce3=['./network.attributes','Network','network','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d6763,_0x3b541c){var _0x195ad7=function(_0x4c4187){while(--_0x4c4187){_0x5d6763['push'](_0x5d6763['shift']());}};_0x195ad7(++_0x3b541c);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0x8ce3[_0x3bee55];return _0x5649d2;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 6fd2dd9..686c14a 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x3136e3,_0x1bc7cb){_0x3136e3=_0x3136e3-0x0;var _0x1817e3=_0x7a54[_0x3136e3];return _0x1817e3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x39e7c0,_0x3a2e6e){var _0x53bb9f=function(_0x4bcd2f){while(--_0x4bcd2f){_0x39e7c0['push'](_0x39e7c0['shift']());}};_0x53bb9f(++_0x3a2e6e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7792a6b..0d46459 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 _0x941c=['get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','/:id/users','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller'];(function(_0xea7439,_0x4e8d51){var _0x373dae=function(_0x2f15b1){while(--_0x2f15b1){_0xea7439['push'](_0xea7439['shift']());}};_0x373dae(++_0x4e8d51);}(_0x941c,0x14e));var _0xc941=function(_0x15892d,_0x4ca74b){_0x15892d=_0x15892d-0x0;var _0x486efc=_0x941c[_0x15892d];return _0x486efc;};'use strict';var multer=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var path=require(_0xc941('0x2'));var timeout=require('connect-timeout');var express=require(_0xc941('0x3'));var router=express['Router']();var fs_extra=require(_0xc941('0x4'));var auth=require(_0xc941('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc941('0x6'));var controller=require(_0xc941('0x7'));router[_0xc941('0x8')]('/',auth[_0xc941('0x9')](),controller[_0xc941('0xa')]);router[_0xc941('0x8')](_0xc941('0xb'),auth[_0xc941('0x9')](),controller['describe']);router[_0xc941('0x8')](_0xc941('0xc'),auth['isAuthenticated'](),controller[_0xc941('0xd')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc941('0xe')]);router[_0xc941('0x8')](_0xc941('0xf'),auth[_0xc941('0x9')](),controller[_0xc941('0x10')]);router[_0xc941('0x8')](_0xc941('0x11'),auth['isAuthenticated'](),controller[_0xc941('0x12')]);router[_0xc941('0x8')](_0xc941('0x13'),auth[_0xc941('0x9')](),controller[_0xc941('0x14')]);router[_0xc941('0x8')]('/:id/users',auth[_0xc941('0x9')](),controller[_0xc941('0x15')]);router[_0xc941('0x16')]('/',auth[_0xc941('0x9')](),controller[_0xc941('0x17')]);router[_0xc941('0x16')](_0xc941('0x18'),auth[_0xc941('0x9')](),controller[_0xc941('0x19')]);router['post'](_0xc941('0xf'),auth[_0xc941('0x9')](),controller['addAnswer']);router[_0xc941('0x16')](_0xc941('0x1a'),controller[_0xc941('0x1b')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xc941('0x1c')]);router[_0xc941('0x16')](_0xc941('0x1d'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0xc941('0x1e'),auth['isAuthenticated'](),controller[_0xc941('0x1f')]);router[_0xc941('0x20')](_0xc941('0xc'),auth[_0xc941('0x9')](),controller[_0xc941('0x21')]);router[_0xc941('0x22')](_0xc941('0xc'),auth[_0xc941('0x9')](),controller[_0xc941('0x23')]);router[_0xc941('0x22')](_0xc941('0x18'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xc941('0x22')](_0xc941('0xf'),auth['isAuthenticated'](),controller[_0xc941('0x24')]);router['delete'](_0xc941('0x1d'),auth[_0xc941('0x9')](),controller[_0xc941('0x25')]);module['exports']=router; \ No newline at end of file +var _0xe33b=['update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put'];(function(_0x2976c9,_0x268c69){var _0x3360a9=function(_0x27de7e){while(--_0x27de7e){_0x2976c9['push'](_0x2976c9['shift']());}};_0x3360a9(++_0x268c69);}(_0xe33b,0x9e));var _0xbe33=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xe33b[_0x5a79e2];return _0x266c45;};'use strict';var multer=require(_0xbe33('0x0'));var util=require(_0xbe33('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe33('0x2'));var router=express[_0xbe33('0x3')]();var fs_extra=require(_0xbe33('0x4'));var auth=require(_0xbe33('0x5'));var interaction=require(_0xbe33('0x6'));var config=require(_0xbe33('0x7'));var controller=require('./openchannelAccount.controller');router[_0xbe33('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbe33('0x8')](_0xbe33('0x9'),auth['isAuthenticated'](),controller[_0xbe33('0xa')]);router[_0xbe33('0x8')](_0xbe33('0xb'),auth['isAuthenticated'](),controller[_0xbe33('0xc')]);router[_0xbe33('0x8')](_0xbe33('0xd'),auth[_0xbe33('0xe')](),controller[_0xbe33('0xf')]);router['get'](_0xbe33('0x10'),auth[_0xbe33('0xe')](),controller['getAnswers']);router[_0xbe33('0x8')]('/:id/applications',auth[_0xbe33('0xe')](),controller['getApplications']);router[_0xbe33('0x8')](_0xbe33('0x11'),auth[_0xbe33('0xe')](),controller[_0xbe33('0x12')]);router[_0xbe33('0x8')](_0xbe33('0x13'),auth['isAuthenticated'](),controller[_0xbe33('0x14')]);router[_0xbe33('0x15')]('/',auth['isAuthenticated'](),controller[_0xbe33('0x16')]);router[_0xbe33('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xbe33('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbe33('0x17')]);router[_0xbe33('0x15')](_0xbe33('0x18'),controller[_0xbe33('0x19')]);router[_0xbe33('0x15')](_0xbe33('0x1a'),auth[_0xbe33('0xe')](),controller[_0xbe33('0x1b')]);router[_0xbe33('0x15')]('/:id/users',auth[_0xbe33('0xe')](),controller[_0xbe33('0x1c')]);router[_0xbe33('0x15')](_0xbe33('0x1d'),auth[_0xbe33('0xe')](),controller[_0xbe33('0x1e')]);router[_0xbe33('0x1f')]('/:id',auth[_0xbe33('0xe')](),controller[_0xbe33('0x20')]);router[_0xbe33('0x21')](_0xbe33('0xb'),auth[_0xbe33('0xe')](),controller['destroy']);router['delete'](_0xbe33('0xd'),auth[_0xbe33('0xe')](),controller[_0xbe33('0x22')]);router['delete'](_0xbe33('0x10'),auth[_0xbe33('0xe')](),controller[_0xbe33('0x23')]);router[_0xbe33('0x21')](_0xbe33('0x13'),auth[_0xbe33('0xe')](),controller[_0xbe33('0x24')]);module[_0xbe33('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 2ef5b91..0bdb436 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 _0x5adf=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','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'];(function(_0x4ed598,_0x5ec3d7){var _0x32d520=function(_0x299cf8){while(--_0x299cf8){_0x4ed598['push'](_0x4ed598['shift']());}};_0x32d520(++_0x5ec3d7);}(_0x5adf,0x11b));var _0xf5ad=function(_0x20fa8f,_0x14e073){_0x20fa8f=_0x20fa8f-0x0;var _0x4fcc3b=_0x5adf[_0x20fa8f];return _0x4fcc3b;};'use strict';var Sequelize=require(_0xf5ad('0x0'));var rs=require(_0xf5ad('0x1'));module[_0xf5ad('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xf5ad('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf5ad('0x4')]},'token':{'type':Sequelize[_0xf5ad('0x4')],'defaultValue':function(){return rs[_0xf5ad('0x5')]();}},'replyUri':{'type':Sequelize[_0xf5ad('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf5ad('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf5ad('0x6')],'defaultValue':function(){return _0xf5ad('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf5ad('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf5ad('0x4')]},'queueTransfer':{'type':Sequelize[_0xf5ad('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf5ad('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf5ad('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5ad('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xf5ad('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xf5ad('0x8')],'defaultValue':![],'comment':_0xf5ad('0xb'),'set':function(_0x4f7e6c){if(!_0x4f7e6c)this[_0xf5ad('0xc')](_0xf5ad('0xd'),null);this[_0xf5ad('0xc')]('mandatoryDisposition',_0x4f7e6c);}}}; \ No newline at end of file +var _0xa45b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','STRING','generate','TEXT','BOOLEAN','INTEGER'];(function(_0x556655,_0x2a66ff){var _0xa364eb=function(_0x52f7bd){while(--_0x52f7bd){_0x556655['push'](_0x556655['shift']());}};_0xa364eb(++_0x2a66ff);}(_0xa45b,0x7b));var _0xba45=function(_0x215859,_0x1dac08){_0x215859=_0x215859-0x0;var _0x177d06=_0xa45b[_0x215859];return _0x177d06;};'use strict';var Sequelize=require(_0xba45('0x0'));var rs=require(_0xba45('0x1'));module['exports']={'name':{'type':Sequelize[_0xba45('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xba45('0x2')]},'token':{'type':Sequelize[_0xba45('0x2')],'defaultValue':function(){return rs[_0xba45('0x3')]();}},'replyUri':{'type':Sequelize[_0xba45('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xba45('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xba45('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba45('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba45('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xba45('0x2')]},'queueTransfer':{'type':Sequelize[_0xba45('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba45('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba45('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba45('0x6')],'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[_0xba45('0x5')],'defaultValue':![],'comment':_0xba45('0x7'),'set':function(_0x5db5fe){if(!_0x5db5fe)this['setDataValue'](_0xba45('0x8'),null);this[_0xba45('0x9')]('mandatoryDisposition',_0x5db5fe);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 697635f..4db64ca 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 _0xb46e=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','http','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','name','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','Pause','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','Applications','account','applications','List','orderBy','priority','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','getApplications','order','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','DESC','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring'];(function(_0x5a4a1f,_0x3f90b6){var _0x43db26=function(_0x2824f5){while(--_0x2824f5){_0x5a4a1f['push'](_0x5a4a1f['shift']());}};_0x43db26(++_0x3f90b6);}(_0xb46e,0x164));var _0xeb46=function(_0x411d5a,_0x21411b){_0x411d5a=_0x411d5a-0x0;var _0x4c97b1=_0xb46e[_0x411d5a];return _0x4c97b1;};'use strict';var emlformat=require(_0xeb46('0x0'));var rimraf=require(_0xeb46('0x1'));var zipdir=require(_0xeb46('0x2'));var jsonpatch=require(_0xeb46('0x3'));var rp=require(_0xeb46('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb46('0x5'));var path=require(_0xeb46('0x6'));var sox=require(_0xeb46('0x7'));var csv=require(_0xeb46('0x8'));var ejs=require(_0xeb46('0x9'));var fs=require('fs');var fs_extra=require(_0xeb46('0xa'));var _=require('lodash');var squel=require(_0xeb46('0xb'));var crypto=require('crypto');var jsforce=require(_0xeb46('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb46('0xd'));var Papa=require(_0xeb46('0xe'));var Redis=require(_0xeb46('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeb46('0x10'));var as=require(_0xeb46('0x11'));var hardwareService=require(_0xeb46('0x12'));var logger=require(_0xeb46('0x13'))('api');var utils=require(_0xeb46('0x14'));var config=require(_0xeb46('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb46('0x16'))['db'];config['redis']=_[_0xeb46('0x17')](config['redis'],{'host':_0xeb46('0x18'),'port':0x18eb});var socket=require(_0xeb46('0x19'))(new Redis(config[_0xeb46('0x1a')]));require('./openchannelAccount.socket')[_0xeb46('0x1b')](socket);var jayson=require(_0xeb46('0x1c'));var client=jayson['client'][_0xeb46('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xeb46('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xce2b11,_0x35870a,_0x4c8879,_0xe0e6b8){return new BPromise(function(_0x4f2c4a,_0x2cdf30){var _0x2465fb=_0xe0e6b8||client;return _0x2465fb['request'](_0xce2b11,_0x4c8879)[_0xeb46('0x1e')](function(_0x406754){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x35870a,_0xeb46('0x1f'));logger[_0xeb46('0x20')](_0xeb46('0x21'),_0x35870a,_0xeb46('0x1f'),JSON[_0xeb46('0x22')](_0x406754));if(_0x406754['error']){if(_0x406754[_0xeb46('0x23')][_0xeb46('0x24')]===0x1f4){logger[_0xeb46('0x23')](_0xeb46('0x25'),_0x35870a,_0x406754[_0xeb46('0x23')][_0xeb46('0x26')]);return _0x2cdf30(_0x406754[_0xeb46('0x23')][_0xeb46('0x26')]);}logger[_0xeb46('0x23')](_0xeb46('0x25'),_0x35870a,_0x406754[_0xeb46('0x23')][_0xeb46('0x26')]);return _0x4f2c4a(_0x406754[_0xeb46('0x23')][_0xeb46('0x26')]);}else{logger[_0xeb46('0x27')](_0xeb46('0x25'),_0x35870a,'request\x20sent');_0x4f2c4a(_0x406754[_0xeb46('0x28')][_0xeb46('0x26')]);}})['catch'](function(_0x228b88){logger[_0xeb46('0x23')](_0xeb46('0x25'),_0x35870a,_0x228b88);_0x2cdf30(_0x228b88);});});}function respondWithStatusCode(_0x1423b4,_0x9f3cbe){_0x9f3cbe=_0x9f3cbe||0xcc;return function(_0x4f9deb){if(_0x4f9deb){return _0x1423b4['sendStatus'](_0x9f3cbe);}return _0x1423b4[_0xeb46('0x29')](_0x9f3cbe)[_0xeb46('0x2a')]();};}function respondWithResult(_0x5080dc,_0x310a21){_0x310a21=_0x310a21||0xc8;return function(_0x59d8ab){if(_0x59d8ab){return _0x5080dc[_0xeb46('0x29')](_0x310a21)[_0xeb46('0x2b')](_0x59d8ab);}};}function respondWithFilteredResult(_0x9f9587,_0xa164ef){return function(_0x36f630){if(_0x36f630){var _0x4cbdfd=typeof _0xa164ef[_0xeb46('0x2c')]===_0xeb46('0x2d')&&typeof _0xa164ef[_0xeb46('0x2e')]===_0xeb46('0x2d');var _0x351d32=_0x36f630['count'];var _0x15919c=_0x4cbdfd?0x0:_0xa164ef[_0xeb46('0x2c')];var _0x1f88fc=_0x4cbdfd?_0x36f630[_0xeb46('0x2f')]:_0xa164ef[_0xeb46('0x2c')]+_0xa164ef[_0xeb46('0x2e')];var _0x196ab9;if(_0x1f88fc>=_0x351d32){_0x1f88fc=_0x351d32;_0x196ab9=0xc8;}else{_0x196ab9=0xce;}_0x9f9587[_0xeb46('0x29')](_0x196ab9);return _0x9f9587['set'](_0xeb46('0x30'),_0x15919c+'-'+_0x1f88fc+'/'+_0x351d32)[_0xeb46('0x2b')](_0x36f630);}return null;};}function patchUpdates(_0x47c56c){return function(_0x1df11b){try{jsonpatch[_0xeb46('0x31')](_0x1df11b,_0x47c56c,!![]);}catch(_0x440f5a){return BPromise[_0xeb46('0x32')](_0x440f5a);}return _0x1df11b[_0xeb46('0x33')]();};}function saveUpdates(_0x589275,_0x2a9ce3){return function(_0x33787e){if(_0x33787e){return _0x33787e[_0xeb46('0x34')](_0x589275)['then'](function(_0x187cf0){return _0x187cf0;});}return null;};}function removeEntity(_0x5da190,_0x300fbc){return function(_0x3b130c){if(_0x3b130c){return _0x3b130c[_0xeb46('0x35')]()[_0xeb46('0x1e')](function(){var _0xbcfd03=_0x3b130c[_0xeb46('0x36')]({'plain':!![]});var _0x166fc6='OpenchannelAccounts';return db[_0xeb46('0x37')][_0xeb46('0x35')]({'where':{'type':_0x166fc6,'resourceId':_0xbcfd03['id']}})[_0xeb46('0x1e')](function(){return _0x3b130c;});})[_0xeb46('0x1e')](function(){_0x5da190[_0xeb46('0x29')](0xcc)[_0xeb46('0x2a')]();});}};}function handleEntityNotFound(_0x2b1226,_0x247646){return function(_0x433163){if(!_0x433163){_0x2b1226[_0xeb46('0x38')](0x194);}return _0x433163;};}function handleError(_0x1e218d,_0x4d4190){_0x4d4190=_0x4d4190||0x1f4;return function(_0x30ce41){logger[_0xeb46('0x23')](_0x30ce41[_0xeb46('0x39')]);if(_0x30ce41['name']){delete _0x30ce41['name'];}_0x1e218d['status'](_0x4d4190)[_0xeb46('0x3a')](_0x30ce41);};}exports[_0xeb46('0x3b')]=function(_0x71f44a,_0x5593f9){var _0x3dda3e={'include':[{'model':db['Pause'],'as':_0xeb46('0x3c')}]},_0x3de6a3={},_0x3820c7={'count':0x0,'rows':[]};var _0x4ac0e5=_[_0xeb46('0x3d')](db[_0xeb46('0x3e')][_0xeb46('0x3f')],function(_0x3f4c2b){return{'name':_0x3f4c2b['fieldName'],'type':_0x3f4c2b['type'][_0xeb46('0x40')]};});_0x3de6a3['model']=_[_0xeb46('0x3d')](_0x4ac0e5,_0xeb46('0x41'));_0x3de6a3[_0xeb46('0x42')]=_[_0xeb46('0x43')](_0x71f44a['query']);_0x3de6a3[_0xeb46('0x44')]=_['intersection'](_0x3de6a3['model'],_0x3de6a3[_0xeb46('0x42')]);_0x3dda3e['attributes']=_[_0xeb46('0x45')](_0x3de6a3['model'],qs[_0xeb46('0x46')](_0x71f44a['query'][_0xeb46('0x46')]));_0x3dda3e[_0xeb46('0x47')]=_0x3dda3e[_0xeb46('0x47')][_0xeb46('0x48')]?_0x3dda3e['attributes']:_0x3de6a3[_0xeb46('0x49')];if(!_0x71f44a[_0xeb46('0x42')][_0xeb46('0x4a')](_0xeb46('0x4b'))){_0x3dda3e[_0xeb46('0x2e')]=qs[_0xeb46('0x2e')](_0x71f44a[_0xeb46('0x42')][_0xeb46('0x2e')]);_0x3dda3e[_0xeb46('0x2c')]=qs[_0xeb46('0x2c')](_0x71f44a['query'][_0xeb46('0x2c')]);}_0x3dda3e['order']=qs[_0xeb46('0x4c')](_0x71f44a[_0xeb46('0x42')][_0xeb46('0x4c')]);_0x3dda3e[_0xeb46('0x4d')]=qs[_0xeb46('0x44')](_[_0xeb46('0x4e')](_0x71f44a['query'],_0x3de6a3[_0xeb46('0x44')]),_0x4ac0e5);if(_0x71f44a[_0xeb46('0x42')][_0xeb46('0x4f')]){_0x3dda3e['where']=_['merge'](_0x3dda3e[_0xeb46('0x4d')],{'$or':_['map'](_0x4ac0e5,function(_0x125c1e){if(_0x125c1e[_0xeb46('0x50')]!==_0xeb46('0x51')){var _0x8afd7={};_0x8afd7[_0x125c1e[_0xeb46('0x41')]]={'$like':'%'+_0x71f44a[_0xeb46('0x42')][_0xeb46('0x4f')]+'%'};return _0x8afd7;}})});}_0x3dda3e=_[_0xeb46('0x52')]({},_0x3dda3e,_0x71f44a[_0xeb46('0x53')]);var _0x3a3171={'where':_0x3dda3e[_0xeb46('0x4d')]};return db[_0xeb46('0x3e')]['count'](_0x3a3171)['then'](function(_0x3add94){_0x3820c7[_0xeb46('0x2f')]=_0x3add94;if(_0x71f44a['query'][_0xeb46('0x54')]){_0x3dda3e['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0xeb46('0x55')](_0x3dda3e);})['then'](function(_0x20146d){_0x3820c7[_0xeb46('0x56')]=_0x20146d;return _0x3820c7;})[_0xeb46('0x1e')](respondWithFilteredResult(_0x5593f9,_0x3dda3e))[_0xeb46('0x57')](handleError(_0x5593f9,null));};exports['show']=function(_0x29f6b3,_0x410b7a){var _0x3ffa39={'raw':![],'where':{'id':_0x29f6b3['params']['id']},'include':[{'model':db[_0xeb46('0x58')],'as':_0xeb46('0x3c')}]},_0x28a55d={};_0x28a55d[_0xeb46('0x49')]=_[_0xeb46('0x43')](db['OpenchannelAccount'][_0xeb46('0x3f')]);_0x28a55d[_0xeb46('0x42')]=_[_0xeb46('0x43')](_0x29f6b3[_0xeb46('0x42')]);_0x28a55d[_0xeb46('0x44')]=_['intersection'](_0x28a55d[_0xeb46('0x49')],_0x28a55d[_0xeb46('0x42')]);_0x3ffa39[_0xeb46('0x47')]=_[_0xeb46('0x45')](_0x28a55d['model'],qs[_0xeb46('0x46')](_0x29f6b3[_0xeb46('0x42')][_0xeb46('0x46')]));_0x3ffa39['attributes']=_0x3ffa39['attributes'][_0xeb46('0x48')]?_0x3ffa39[_0xeb46('0x47')]:_0x28a55d[_0xeb46('0x49')];if(_0x29f6b3[_0xeb46('0x42')]['includeAll']){_0x3ffa39[_0xeb46('0x59')]=[{'all':!![]}];}_0x3ffa39=_[_0xeb46('0x52')]({},_0x3ffa39,_0x29f6b3['options']);return db['OpenchannelAccount'][_0xeb46('0x5a')](_0x3ffa39)[_0xeb46('0x1e')](handleEntityNotFound(_0x410b7a,null))[_0xeb46('0x1e')](respondWithResult(_0x410b7a,null))['catch'](handleError(_0x410b7a,null));};exports[_0xeb46('0x5b')]=function(_0x4bcedc,_0xab9261){return db[_0xeb46('0x3e')][_0xeb46('0x5b')](_0x4bcedc[_0xeb46('0x5c')],{})[_0xeb46('0x1e')](function(_0x35d1e5){var _0x5f52d6=_0x4bcedc['user'][_0xeb46('0x36')]({'plain':!![]});if(!_0x5f52d6)throw new Error(_0xeb46('0x5d'));if(_0x5f52d6['role']===_0xeb46('0x5e')){var _0x3ecb99=_0x35d1e5['get']({'plain':!![]});var _0x20a39e='OpenchannelAccounts';return db[_0xeb46('0x5f')][_0xeb46('0x5a')]({'where':{'name':_0x20a39e,'userProfileId':_0x5f52d6[_0xeb46('0x60')]},'raw':!![]})[_0xeb46('0x1e')](function(_0xe158d7){if(_0xe158d7&&_0xe158d7[_0xeb46('0x61')]===0x0){return db[_0xeb46('0x37')][_0xeb46('0x5b')]({'name':_0x3ecb99[_0xeb46('0x41')],'resourceId':_0x3ecb99['id'],'type':_0xe158d7['name'],'sectionId':_0xe158d7['id']},{})['then'](function(){return _0x35d1e5;});}else{return _0x35d1e5;}})[_0xeb46('0x57')](function(_0x1ad7b3){logger['error'](_0xeb46('0x62'),_0x1ad7b3);throw _0x1ad7b3;});}return _0x35d1e5;})[_0xeb46('0x1e')](respondWithResult(_0xab9261,0xc9))['catch'](handleError(_0xab9261,null));};exports[_0xeb46('0x34')]=function(_0x5e9041,_0x5c5189){if(_0x5e9041[_0xeb46('0x5c')]['id']){delete _0x5e9041[_0xeb46('0x5c')]['id'];}return db[_0xeb46('0x3e')][_0xeb46('0x5a')]({'where':{'id':_0x5e9041[_0xeb46('0x63')]['id']},'include':[{'model':db[_0xeb46('0x58')],'as':_0xeb46('0x3c')}]})[_0xeb46('0x1e')](handleEntityNotFound(_0x5c5189,null))[_0xeb46('0x1e')](saveUpdates(_0x5e9041['body'],null))[_0xeb46('0x1e')](respondWithResult(_0x5c5189,null))[_0xeb46('0x57')](handleError(_0x5c5189,null));};exports[_0xeb46('0x35')]=function(_0x12d253,_0x3c16ac){return db[_0xeb46('0x3e')][_0xeb46('0x5a')]({'where':{'id':_0x12d253['params']['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x3c16ac,null))[_0xeb46('0x1e')](removeEntity(_0x3c16ac,null))[_0xeb46('0x57')](handleError(_0x3c16ac,null));};exports[_0xeb46('0x64')]=function(_0x487dbb,_0x3185dc){return db[_0xeb46('0x3e')][_0xeb46('0x64')]()[_0xeb46('0x1e')](respondWithResult(_0x3185dc,null))['catch'](handleError(_0x3185dc,null));};exports[_0xeb46('0x65')]=function(_0xd2ec41,_0x4f8323,_0x24e973){if(_0xd2ec41[_0xeb46('0x5c')]['id']){delete _0xd2ec41['body']['id'];}return db[_0xeb46('0x3e')][_0xeb46('0x5a')]({'where':{'id':_0xd2ec41['params']['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x4f8323,null))[_0xeb46('0x1e')](function(_0x1658f4){if(_0x1658f4){_0xd2ec41[_0xeb46('0x5c')]['OpenchannelAccountId']=_0x1658f4['id'];return db[_0xeb46('0x66')][_0xeb46('0x5b')](_0xd2ec41[_0xeb46('0x5c')]);}})[_0xeb46('0x1e')](respondWithResult(_0x4f8323,null))[_0xeb46('0x57')](handleError(_0x4f8323,null));};exports['getDispositions']=function(_0x46c5f2,_0x1b3b33,_0x1c2fe5){var _0x1770a7={'raw':![],'where':{}};var _0x244c9e={};var _0x5c9273={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xeb46('0x67')]({'where':{'id':_0x46c5f2[_0xeb46('0x63')]['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x1b3b33,null))['then'](function(_0x1788bf){if(_0x1788bf){_0x244c9e[_0xeb46('0x49')]=_['keys'](db[_0xeb46('0x66')]['rawAttributes']);_0x244c9e['query']=_[_0xeb46('0x43')](_0x46c5f2['query']);_0x244c9e['filters']=_[_0xeb46('0x45')](_0x244c9e[_0xeb46('0x49')],_0x244c9e[_0xeb46('0x42')]);_0x1770a7[_0xeb46('0x47')]=_[_0xeb46('0x45')](_0x244c9e[_0xeb46('0x49')],qs['fields'](_0x46c5f2[_0xeb46('0x42')][_0xeb46('0x46')]));_0x1770a7[_0xeb46('0x47')]=_0x1770a7[_0xeb46('0x47')][_0xeb46('0x48')]?_0x1770a7['attributes']:_0x244c9e[_0xeb46('0x49')];if(!_0x46c5f2[_0xeb46('0x42')][_0xeb46('0x4a')](_0xeb46('0x4b'))){_0x1770a7[_0xeb46('0x2e')]=qs[_0xeb46('0x2e')](_0x46c5f2[_0xeb46('0x42')]['limit']);_0x1770a7[_0xeb46('0x2c')]=qs[_0xeb46('0x2c')](_0x46c5f2['query']['offset']);}_0x1770a7['order']=qs[_0xeb46('0x4c')](_0x46c5f2[_0xeb46('0x42')][_0xeb46('0x4c')]);_0x1770a7[_0xeb46('0x4d')]=qs['filters'](_[_0xeb46('0x4e')](_0x46c5f2[_0xeb46('0x42')],_0x244c9e['filters']));_0x1770a7[_0xeb46('0x4d')]['OpenchannelAccountId']=_0x1788bf['id'];if(_0x46c5f2[_0xeb46('0x42')]['filter']){_0x1770a7[_0xeb46('0x4d')]=_[_0xeb46('0x52')](_0x1770a7['where'],{'$or':_[_0xeb46('0x3d')](_0x1770a7[_0xeb46('0x47')],function(_0x109a39){var _0x519a28={};_0x519a28[_0x109a39]={'$like':'%'+_0x46c5f2[_0xeb46('0x42')][_0xeb46('0x4f')]+'%'};return _0x519a28;})});}_0x1770a7=_[_0xeb46('0x52')]({},_0x1770a7,_0x46c5f2[_0xeb46('0x53')]);return db[_0xeb46('0x66')]['count']({'where':_0x1770a7['where']})['then'](function(_0x36dad4){_0x5c9273[_0xeb46('0x2f')]=_0x36dad4;if(_0x46c5f2['query']['includeAll']){_0x1770a7['include']=[{'all':!![]}];}return db[_0xeb46('0x66')]['findAll'](_0x1770a7);})[_0xeb46('0x1e')](function(_0x225a76){_0x5c9273['rows']=_0x225a76;return _0x5c9273;});}})[_0xeb46('0x1e')](respondWithFilteredResult(_0x1b3b33,_0x1770a7))[_0xeb46('0x57')](handleError(_0x1b3b33,null));};exports[_0xeb46('0x68')]=function(_0x1d9842,_0x5c64fa,_0x2ca974){return db['OpenchannelAccount'][_0xeb46('0x5a')]({'where':{'id':_0x1d9842[_0xeb46('0x63')]['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x5c64fa,null))['then'](function(_0x1d0125){if(_0x1d0125){return _0x1d0125[_0xeb46('0x68')](_0x1d9842['query'][_0xeb46('0x69')]);}})[_0xeb46('0x1e')](respondWithStatusCode(_0x5c64fa,null))[_0xeb46('0x57')](handleError(_0x5c64fa,null));};exports[_0xeb46('0x6a')]=function(_0x54d5fb,_0xa16a7e,_0xd05487){if(_0x54d5fb['body']['id']){delete _0x54d5fb[_0xeb46('0x5c')]['id'];}return db[_0xeb46('0x3e')][_0xeb46('0x5a')]({'where':{'id':_0x54d5fb['params']['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0xa16a7e,null))[_0xeb46('0x1e')](function(_0x2ee911){if(_0x2ee911){_0x54d5fb[_0xeb46('0x5c')][_0xeb46('0x6b')]=_0x2ee911['id'];return db[_0xeb46('0x6c')][_0xeb46('0x5b')](_0x54d5fb[_0xeb46('0x5c')]);}})[_0xeb46('0x1e')](respondWithResult(_0xa16a7e,null))[_0xeb46('0x57')](handleError(_0xa16a7e,null));};exports[_0xeb46('0x6d')]=function(_0x232f93,_0x39dafc,_0x418b25){var _0x50a77b={'raw':![],'where':{}};var _0x55ea37={};var _0x3ad451={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xeb46('0x67')]({'where':{'id':_0x232f93[_0xeb46('0x63')]['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x39dafc,null))[_0xeb46('0x1e')](function(_0xee76bf){if(_0xee76bf){_0x55ea37[_0xeb46('0x49')]=_[_0xeb46('0x43')](db[_0xeb46('0x6c')][_0xeb46('0x3f')]);_0x55ea37['query']=_[_0xeb46('0x43')](_0x232f93[_0xeb46('0x42')]);_0x55ea37['filters']=_[_0xeb46('0x45')](_0x55ea37['model'],_0x55ea37[_0xeb46('0x42')]);_0x50a77b[_0xeb46('0x47')]=_['intersection'](_0x55ea37[_0xeb46('0x49')],qs[_0xeb46('0x46')](_0x232f93[_0xeb46('0x42')]['fields']));_0x50a77b[_0xeb46('0x47')]=_0x50a77b['attributes'][_0xeb46('0x48')]?_0x50a77b['attributes']:_0x55ea37[_0xeb46('0x49')];if(!_0x232f93[_0xeb46('0x42')][_0xeb46('0x4a')](_0xeb46('0x4b'))){_0x50a77b[_0xeb46('0x2e')]=qs[_0xeb46('0x2e')](_0x232f93['query'][_0xeb46('0x2e')]);_0x50a77b[_0xeb46('0x2c')]=qs[_0xeb46('0x2c')](_0x232f93['query'][_0xeb46('0x2c')]);}_0x50a77b['order']=qs['sort'](_0x232f93[_0xeb46('0x42')][_0xeb46('0x4c')]);_0x50a77b['where']=qs[_0xeb46('0x44')](_['pick'](_0x232f93[_0xeb46('0x42')],_0x55ea37['filters']));_0x50a77b[_0xeb46('0x4d')][_0xeb46('0x6b')]=_0xee76bf['id'];if(_0x232f93[_0xeb46('0x42')][_0xeb46('0x4f')]){_0x50a77b[_0xeb46('0x4d')]=_[_0xeb46('0x52')](_0x50a77b[_0xeb46('0x4d')],{'$or':_['map'](_0x50a77b[_0xeb46('0x47')],function(_0x5c22c4){var _0x163f0a={};_0x163f0a[_0x5c22c4]={'$like':'%'+_0x232f93[_0xeb46('0x42')][_0xeb46('0x4f')]+'%'};return _0x163f0a;})});}_0x50a77b=_['merge']({},_0x50a77b,_0x232f93[_0xeb46('0x53')]);return db[_0xeb46('0x6c')]['count']({'where':_0x50a77b[_0xeb46('0x4d')]})[_0xeb46('0x1e')](function(_0x42a4b8){_0x3ad451[_0xeb46('0x2f')]=_0x42a4b8;if(_0x232f93['query'][_0xeb46('0x54')]){_0x50a77b[_0xeb46('0x59')]=[{'all':!![]}];}return db[_0xeb46('0x6c')][_0xeb46('0x55')](_0x50a77b);})['then'](function(_0x3919e4){_0x3ad451[_0xeb46('0x56')]=_0x3919e4;return _0x3ad451;});}})[_0xeb46('0x1e')](respondWithFilteredResult(_0x39dafc,_0x50a77b))[_0xeb46('0x57')](handleError(_0x39dafc,null));};exports['removeAnswers']=function(_0x10c32d,_0x1f6434,_0x196efc){return db[_0xeb46('0x3e')][_0xeb46('0x5a')]({'where':{'id':_0x10c32d[_0xeb46('0x63')]['id']}})['then'](handleEntityNotFound(_0x1f6434,null))['then'](function(_0x36b709){if(_0x36b709){return _0x36b709['removeAnswers'](_0x10c32d[_0xeb46('0x42')]['ids']);}})[_0xeb46('0x1e')](respondWithStatusCode(_0x1f6434,null))[_0xeb46('0x57')](handleError(_0x1f6434,null));};exports[_0xeb46('0x6e')]=function(_0x3b7ffe,_0x57492e,_0x58814a){var _0x53d2cc={'body':_0x3b7ffe[_0xeb46('0x5c')],'channel':_0xeb46('0x6f')};var _0x1456df=[];var _0xd61afd=[];var _0x27805b={};var _0x3bbcbe=![];return db[_0xeb46('0x70')][_0xeb46('0x64')]()['then'](function(_0x38ae49){if(!_0x38ae49){throw new db[(_0xeb46('0x71'))][(_0xeb46('0x72'))](_0xeb46('0x73'));}_0x1456df=_[_0xeb46('0x74')](_[_0xeb46('0x43')](_0x38ae49),['createdAt',_0xeb46('0x75')]);_0xd61afd=_['difference'](_['keys'](_0x38ae49),['createdAt',_0xeb46('0x75'),_0xeb46('0x76'),_0xeb46('0x77')]);if(_0x3b7ffe[_0xeb46('0x5c')]['id']){delete _0x3b7ffe[_0xeb46('0x5c')]['id'];}if(_['isNil'](_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x78')])){throw new db[(_0xeb46('0x71'))]['ValidationError'](_0xeb46('0x79'));}if(_[_0xeb46('0x7a')](_0x3b7ffe[_0xeb46('0x5c')]['body'])||_0x3b7ffe[_0xeb46('0x5c')]['body']===''){throw new db[(_0xeb46('0x71'))][(_0xeb46('0x72'))](_0xeb46('0x7b'));}if(_['isNil'](_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x7c')])){throw new db['Sequelize'][(_0xeb46('0x72'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xd61afd);}if(!_[_0xeb46('0x7d')](_0xd61afd,_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x7c')])){throw new db[(_0xeb46('0x71'))][(_0xeb46('0x72'))](_0xeb46('0x7e')+_0xd61afd);}_0x27805b[_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x7c')]]=_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x78')];})['then'](function(){return db['OpenchannelAccount'][_0xeb46('0x5a')]({'where':{'id':_0x3b7ffe[_0xeb46('0x63')]['id']},'include':[{'model':db[_0xeb46('0x7f')],'as':'List','include':[{'model':db[_0xeb46('0x70')],'as':_0xeb46('0x80'),'where':_0x27805b,'limit':0x1,'order':[[_0xeb46('0x75'),'DESC']]}]},{'model':db[_0xeb46('0x81')],'as':_0xeb46('0x82')}]});})[_0xeb46('0x1e')](handleEntityNotFound(_0x57492e,null))['then'](function(_0x44ab56){if(_0x44ab56&&_0x44ab56['List']){_0x53d2cc[_0xeb46('0x83')]=_0x44ab56;_0x53d2cc[_0xeb46('0x84')]=_0x44ab56[_0xeb46('0x82')];_0x53d2cc['list']=_0x44ab56[_0xeb46('0x85')];_0x53d2cc[_0xeb46('0x84')]=_[_0xeb46('0x86')](_0x53d2cc[_0xeb46('0x84')],[_0xeb46('0x87')],['asc']);if(_0x53d2cc[_0xeb46('0x83')][_0xeb46('0x82')]){delete _0x53d2cc['account'][_0xeb46('0x82')];}if(_0x53d2cc[_0xeb46('0x83')][_0xeb46('0x85')]&&_0x53d2cc[_0xeb46('0x83')][_0xeb46('0x85')][_0xeb46('0x80')][_0xeb46('0x48')]){return _0x53d2cc['account'][_0xeb46('0x85')][_0xeb46('0x80')][0x0];}var _0x522771=_['defaults'](_0x3b7ffe[_0xeb46('0x5c')],{'firstName':_0x3b7ffe['body'][_0xeb46('0x78')],'ListId':_0x44ab56['ListId']});_0x522771[_0x3b7ffe['body']['mapKey']]=_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x78')];return db['CmContact'][_0xeb46('0x5b')](_0x522771,{'fields':_0x1456df,'raw':!![]});}})['then'](handleEntityNotFound(_0x57492e,null))['then'](function(_0x528595){_0x53d2cc[_0xeb46('0x88')]=_0x528595;if(_0x528595){var _0xa8323f={'ContactId':_0x528595['id'],'OpenchannelAccountId':_0x3b7ffe[_0xeb46('0x63')]['id'],'from':(_0x528595[_0xeb46('0x89')]||'')+'\x20'+(_0x528595[_0xeb46('0x8a')]||'')};var _0x29a99d={'OpenchannelAccountId':_0x3b7ffe[_0xeb46('0x63')]['id'],'closed':![]};if(_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x8b')]){_0x29a99d['threadId']=_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x8b')];return db['OpenchannelInteraction'][_0xeb46('0x5a')]({'where':_0x29a99d})[_0xeb46('0x1e')](function(_0x832260){if(_0x832260){return[_0x832260,![]];}_0xa8323f[_0xeb46('0x8b')]=_0x3b7ffe[_0xeb46('0x5c')]['threadId'];_0xa8323f['externalUrl']=_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x8c')];return db[_0xeb46('0x8d')]['create'](_0xa8323f)[_0xeb46('0x1e')](function(_0x4d958e){return[_0x4d958e,!![]];});});}else{_0x29a99d[_0xeb46('0x8b')]=null;}_0x29a99d[_0xeb46('0x8e')]=_0x528595['id'];return db[_0xeb46('0x8d')][_0xeb46('0x5a')]({'where':_0x29a99d})[_0xeb46('0x1e')](function(_0x14984a){if(_0x14984a){return[_0x14984a,![]];}return db[_0xeb46('0x8d')][_0xeb46('0x5b')](_0xa8323f)[_0xeb46('0x1e')](function(_0x5e817d){return[_0x5e817d,!![]];});});}})[_0xeb46('0x8f')](function(_0x42ebd1,_0x24dc8c){if(_0x42ebd1){_0x3bbcbe=_0x24dc8c;if(!_0x24dc8c){var _0x2bc451={'from':(_0x53d2cc[_0xeb46('0x88')][_0xeb46('0x89')]||'')+'\x20'+(_0x53d2cc[_0xeb46('0x88')][_0xeb46('0x8a')]||'')};if(_0x3b7ffe[_0xeb46('0x5c')]['threadId']&&_0x3b7ffe['body'][_0xeb46('0x90')]&&_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x8b')]!=_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x90')]){_0x2bc451[_0xeb46('0x8b')]=_0x3b7ffe['body']['messageId'];}return _0x42ebd1[_0xeb46('0x34')](_0x2bc451);}else{return _0x42ebd1;}}})[_0xeb46('0x1e')](function(_0x2bd0dd){_0x53d2cc[_0xeb46('0x91')]=_0x2bd0dd['get']({'plain':!![]});_0x53d2cc['interaction'][_0xeb46('0x92')]=_0x3bbcbe;if(_0x53d2cc[_0xeb46('0x91')]['created']){if(_0x53d2cc[_0xeb46('0x83')][_0xeb46('0x93')]){_0x53d2cc['applications']['push']({'id':0x0,'priority':_0x53d2cc[_0xeb46('0x84')]['length']+0x1,'app':_0xeb46('0x94'),'appdata':'unmanaged','interval':_0xeb46('0x95')});}}return db[_0xeb46('0x96')]['create']({'body':_0x3b7ffe[_0xeb46('0x5c')][_0xeb46('0x5c')],'OpenchannelAccountId':_0x3b7ffe[_0xeb46('0x63')]['id'],'OpenchannelInteractionId':_0x2bd0dd['id'],'direction':'in','ContactId':_0x53d2cc[_0xeb46('0x88')]['id'],'AttachmentId':_0x3b7ffe['body']['AttachmentId']});})[_0xeb46('0x1e')](function(_0x30973c){_0x53d2cc[_0xeb46('0x26')]=_0x30973c;if(_0x53d2cc[_0xeb46('0x91')][_0xeb46('0x97')]){return db['User'][_0xeb46('0x5a')]({'attributes':['id',_0xeb46('0x41')],'where':{'id':_0x53d2cc[_0xeb46('0x91')][_0xeb46('0x97')]}})['then'](function(_0x198022){if(_0x198022){_0x53d2cc[_0xeb46('0x84')][_0xeb46('0x98')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x198022[_0xeb46('0x41')]+','+(_0x53d2cc['account'][_0xeb46('0x99')]||0xa),'interval':_0xeb46('0x95')});_0x53d2cc[_0xeb46('0x9a')]=![];}return respondWithRpcPromise(_0xeb46('0x9b'),'startRouting',_0x53d2cc);});}return respondWithRpcPromise(_0xeb46('0x9b'),_0xeb46('0x9c'),_0x53d2cc);})['then'](function(_0x40a2de){respondWithRpcPromise('EventManager',_0xeb46('0x9d'),{'event':'notify','message':_0x40a2de},client9002);return _0x40a2de;})['then'](respondWithResult(_0x57492e,null))[_0xeb46('0x57')](handleError(_0x57492e,null));};exports[_0xeb46('0x9e')]=function(_0x3e38f5,_0x2dab26,_0x499a7b){return db[_0xeb46('0x3e')]['findOne']({'where':{'id':_0x3e38f5[_0xeb46('0x63')]['id']}})['then'](handleEntityNotFound(_0x2dab26,null))['then'](function(_0x4912a3){if(_0x4912a3){return db['sequelize'][_0xeb46('0x9f')](function(_0x37cdf6){return db[_0xeb46('0x81')][_0xeb46('0x35')]({'where':{'OpenchannelAccountId':_0x3e38f5[_0xeb46('0x63')]['id']},'transaction':_0x37cdf6})['then'](function(_0x525643){var _0x4fdcd3=_[_0xeb46('0x3d')](_0x3e38f5[_0xeb46('0x5c')],function(_0x3dc530){_0x3dc530[_0xeb46('0x6b')]=_0x3e38f5['params']['id'];return _0x3dc530;});return db[_0xeb46('0x81')][_0xeb46('0xa0')](_0x4fdcd3,{'transaction':_0x37cdf6});});})[_0xeb46('0x1e')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x3e38f5[_0xeb46('0x63')]['id']},'order':_0xeb46('0x87')});});}})[_0xeb46('0x1e')](respondWithResult(_0x2dab26,null))[_0xeb46('0x57')](handleError(_0x2dab26,null));};exports[_0xeb46('0xa1')]=function(_0x5cdd5e,_0x557710,_0x2f57ff){var _0x26b659={};var _0x4382aa={};var _0x28f474;var _0x2ab70e;return db['OpenchannelAccount'][_0xeb46('0x67')]({'where':{'id':_0x5cdd5e[_0xeb46('0x63')]['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x557710,null))['then'](function(_0x4a6696){if(_0x4a6696){_0x28f474=_0x4a6696;_0x4382aa[_0xeb46('0x49')]=_[_0xeb46('0x43')](db['OpenchannelApplication'][_0xeb46('0x3f')]);_0x4382aa['query']=_['keys'](_0x5cdd5e['query']);_0x4382aa[_0xeb46('0x44')]=_[_0xeb46('0x45')](_0x4382aa[_0xeb46('0x49')],_0x4382aa[_0xeb46('0x42')]);_0x26b659['attributes']=_[_0xeb46('0x45')](_0x4382aa[_0xeb46('0x49')],qs[_0xeb46('0x46')](_0x5cdd5e[_0xeb46('0x42')][_0xeb46('0x46')]));_0x26b659[_0xeb46('0x47')]=_0x26b659['attributes'][_0xeb46('0x48')]?_0x26b659[_0xeb46('0x47')]:_0x4382aa[_0xeb46('0x49')];_0x26b659[_0xeb46('0xa2')]=qs['sort'](_0x5cdd5e[_0xeb46('0x42')]['sort']);_0x26b659['where']=qs['filters'](_['pick'](_0x5cdd5e[_0xeb46('0x42')],_0x4382aa[_0xeb46('0x44')]));if(_0x5cdd5e[_0xeb46('0x42')][_0xeb46('0x4f')]){_0x26b659['where']=_[_0xeb46('0x52')](_0x26b659[_0xeb46('0x4d')],{'$or':_[_0xeb46('0x3d')](_0x26b659[_0xeb46('0x47')],function(_0x3141b8){var _0x358439={};_0x358439[_0x3141b8]={'$like':'%'+_0x5cdd5e[_0xeb46('0x42')]['filter']+'%'};return _0x358439;})});}_0x26b659=_[_0xeb46('0x52')]({},_0x26b659,_0x5cdd5e[_0xeb46('0x53')]);return _0x28f474[_0xeb46('0xa1')](_0x26b659);}})[_0xeb46('0x1e')](function(_0x1725c5){if(_0x1725c5){_0x2ab70e=_0x1725c5[_0xeb46('0x48')];if(!_0x5cdd5e[_0xeb46('0x42')][_0xeb46('0x4a')](_0xeb46('0x4b'))){_0x26b659['limit']=qs[_0xeb46('0x2e')](_0x5cdd5e[_0xeb46('0x42')][_0xeb46('0x2e')]);_0x26b659[_0xeb46('0x2c')]=qs['offset'](_0x5cdd5e[_0xeb46('0x42')]['offset']);}return _0x28f474['getApplications'](_0x26b659);}})['then'](function(_0x551560){if(_0x551560){return _0x551560?{'count':_0x2ab70e,'rows':_0x551560}:null;}})[_0xeb46('0x1e')](respondWithResult(_0x557710,null))['catch'](handleError(_0x557710,null));};exports[_0xeb46('0xa3')]=function(_0x55420d,_0x3cef07,_0x493b6b){var _0x1bd500={'raw':![],'where':{}};var _0x217b74={};var _0x8a029e={'count':0x0,'rows':[]};return db[_0xeb46('0x3e')][_0xeb46('0x67')]({'where':{'id':_0x55420d[_0xeb46('0x63')]['id']}})['then'](handleEntityNotFound(_0x3cef07,null))['then'](function(_0x8ebbed){if(_0x8ebbed){_0x217b74['model']=_['keys'](db[_0xeb46('0x8d')][_0xeb46('0x3f')]);_0x217b74[_0xeb46('0x42')]=_[_0xeb46('0x43')](_0x55420d[_0xeb46('0x42')]);_0x217b74[_0xeb46('0x44')]=_[_0xeb46('0x45')](_0x217b74[_0xeb46('0x49')],_0x217b74[_0xeb46('0x42')]);_0x1bd500[_0xeb46('0x47')]=_[_0xeb46('0x45')](_0x217b74[_0xeb46('0x49')],qs['fields'](_0x55420d[_0xeb46('0x42')][_0xeb46('0x46')]));_0x1bd500[_0xeb46('0x47')]=_0x1bd500[_0xeb46('0x47')][_0xeb46('0x48')]?_0x1bd500['attributes']:_0x217b74[_0xeb46('0x49')];if(!_0x55420d['query']['hasOwnProperty']('nolimit')){_0x1bd500['limit']=qs['limit'](_0x55420d[_0xeb46('0x42')][_0xeb46('0x2e')]);_0x1bd500[_0xeb46('0x2c')]=qs[_0xeb46('0x2c')](_0x55420d[_0xeb46('0x42')][_0xeb46('0x2c')]);}_0x1bd500[_0xeb46('0xa2')]=qs[_0xeb46('0x4c')](_0x55420d[_0xeb46('0x42')]['sort']);_0x1bd500[_0xeb46('0x4d')]=qs[_0xeb46('0x44')](_['pick'](_0x55420d[_0xeb46('0x42')],_0x217b74[_0xeb46('0x44')]));_0x1bd500[_0xeb46('0x4d')]['OpenchannelAccountId']=_0x8ebbed['id'];if(_0x55420d['query'][_0xeb46('0x4f')]){_0x1bd500[_0xeb46('0x4d')]=_[_0xeb46('0x52')](_0x1bd500[_0xeb46('0x4d')],{'$or':_[_0xeb46('0x3d')](_0x1bd500[_0xeb46('0x47')],function(_0x5dbfe0){var _0x3b8d8a={};_0x3b8d8a[_0x5dbfe0]={'$like':'%'+_0x55420d[_0xeb46('0x42')]['filter']+'%'};return _0x3b8d8a;})});}_0x1bd500=_[_0xeb46('0x52')]({},_0x1bd500,_0x55420d[_0xeb46('0x53')]);return db[_0xeb46('0x8d')][_0xeb46('0x2f')]({'where':_0x1bd500[_0xeb46('0x4d')]})[_0xeb46('0x1e')](function(_0x1e2d39){_0x8a029e['count']=_0x1e2d39;if(_0x55420d[_0xeb46('0x42')]['includeAll']){_0x1bd500[_0xeb46('0x59')]=[{'model':db[_0xeb46('0x70')],'as':_0xeb46('0xa4'),'required':![]},{'model':db['User'],'as':_0xeb46('0xa5'),'attributes':[_0xeb46('0x41'),_0xeb46('0xa6'),_0xeb46('0xa7')],'required':![]},{'model':db[_0xeb46('0xa8')],'as':_0xeb46('0xa9'),'attributes':['id','name',_0xeb46('0xaa')],'where':_0x55420d['query'][_0xeb46('0xab')]?{'id':_0x55420d[_0xeb46('0x42')][_0xeb46('0xab')]}:undefined,'required':_0x55420d[_0xeb46('0x42')][_0xeb46('0xab')]?!![]:![]}];}return db[_0xeb46('0x8d')][_0xeb46('0x55')](_0x1bd500);})['then'](function(_0x1fd7cc){_0x8a029e[_0xeb46('0x56')]=_0x1fd7cc;return _0x8a029e;});}})[_0xeb46('0x1e')](respondWithFilteredResult(_0x3cef07,_0x1bd500))[_0xeb46('0x57')](handleError(_0x3cef07,null));};exports['addAgents']=function(_0x483bf2,_0x5b72f7,_0x9dc95f){return db['OpenchannelAccount'][_0xeb46('0x5a')]({'where':{'id':_0x483bf2[_0xeb46('0x63')]['id']}})['then'](handleEntityNotFound(_0x5b72f7,null))[_0xeb46('0x1e')](function(_0x5cfb6c){if(_0x5cfb6c){return _0x5cfb6c[_0xeb46('0xac')](_0x483bf2['body'][_0xeb46('0x69')],_[_0xeb46('0xad')](_0x483bf2[_0xeb46('0x5c')],[_0xeb46('0x69'),'id'])||{})[_0xeb46('0x8f')](function(_0x2e7c1f){for(var _0x13e4bd=0x0;_0x13e4bd<_0x483bf2[_0xeb46('0x5c')]['ids'][_0xeb46('0x48')];_0x13e4bd+=0x1){socket['emit'](_0xeb46('0xae'),{'UserId':Number(_0x483bf2['body'][_0xeb46('0x69')][_0x13e4bd]),'OpenchannelAccountId':Number(_0x483bf2[_0xeb46('0x63')]['id'])});}return _0x2e7c1f;});}})[_0xeb46('0x1e')](respondWithResult(_0x5b72f7,null))[_0xeb46('0x57')](handleError(_0x5b72f7,null));};exports['removeAgents']=function(_0x548191,_0x1240e4,_0x4092ac){return db[_0xeb46('0x3e')]['find']({'where':{'id':_0x548191[_0xeb46('0x63')]['id']}})['then'](handleEntityNotFound(_0x1240e4,null))['then'](function(_0x47caca){if(_0x47caca){return _0x47caca[_0xeb46('0xaf')](_0x548191[_0xeb46('0x42')][_0xeb46('0x69')])[_0xeb46('0x1e')](function(){if(_[_0xeb46('0xb0')](_0x548191[_0xeb46('0x42')]['ids'])){for(var _0xb361a2=0x0;_0xb361a2<_0x548191['query'][_0xeb46('0x69')][_0xeb46('0x48')];_0xb361a2+=0x1){socket['emit'](_0xeb46('0xb1'),{'UserId':Number(_0x548191['query'][_0xeb46('0x69')][_0xb361a2]),'OpenchannelAccountId':Number(_0x548191['params']['id'])});}}else{socket['emit'](_0xeb46('0xb1'),{'UserId':Number(_0x548191[_0xeb46('0x42')]['ids']),'OpenchannelAccountId':Number(_0x548191['params']['id'])});}});}})[_0xeb46('0x1e')](respondWithStatusCode(_0x1240e4,null))[_0xeb46('0x57')](handleError(_0x1240e4,null));};exports[_0xeb46('0xb2')]=function(_0x22d3d8,_0x2fc93d,_0x1b0d1d){var _0x554765={};var _0x49614d={};var _0x236b99;var _0x11aeb2;return db[_0xeb46('0x3e')]['findOne']({'where':{'id':_0x22d3d8[_0xeb46('0x63')]['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x2fc93d,null))['then'](function(_0xb9b1a2){if(_0xb9b1a2){_0x236b99=_0xb9b1a2;_0x49614d['model']=_[_0xeb46('0x43')](db[_0xeb46('0xb3')][_0xeb46('0x3f')]);_0x49614d[_0xeb46('0x42')]=_[_0xeb46('0x43')](_0x22d3d8[_0xeb46('0x42')]);_0x49614d[_0xeb46('0x44')]=_[_0xeb46('0x45')](_0x49614d[_0xeb46('0x49')],_0x49614d['query']);_0x554765[_0xeb46('0x47')]=_[_0xeb46('0x45')](_0x49614d[_0xeb46('0x49')],qs[_0xeb46('0x46')](_0x22d3d8[_0xeb46('0x42')][_0xeb46('0x46')]));_0x554765['attributes']=_0x554765[_0xeb46('0x47')][_0xeb46('0x48')]?_0x554765[_0xeb46('0x47')]:_0x49614d[_0xeb46('0x49')];_0x554765[_0xeb46('0xa2')]=qs['sort'](_0x22d3d8[_0xeb46('0x42')]['sort']);_0x554765['where']=qs['filters'](_[_0xeb46('0x4e')](_0x22d3d8[_0xeb46('0x42')],_0x49614d['filters']));if(_0x22d3d8[_0xeb46('0x42')][_0xeb46('0x4f')]){_0x554765[_0xeb46('0x4d')]=_[_0xeb46('0x52')](_0x554765['where'],{'$or':_['map'](_0x554765[_0xeb46('0x47')],function(_0xa8afff){var _0x13ceac={};_0x13ceac[_0xa8afff]={'$like':'%'+_0x22d3d8['query'][_0xeb46('0x4f')]+'%'};return _0x13ceac;})});}_0x554765=_['merge']({},_0x554765,_0x22d3d8[_0xeb46('0x53')]);return _0x236b99[_0xeb46('0xb2')](_0x554765);}})['then'](function(_0x3924b3){if(_0x3924b3){_0x11aeb2=_0x3924b3['length'];if(!_0x22d3d8[_0xeb46('0x42')][_0xeb46('0x4a')](_0xeb46('0x4b'))){_0x554765[_0xeb46('0x2e')]=qs[_0xeb46('0x2e')](_0x22d3d8['query'][_0xeb46('0x2e')]);_0x554765[_0xeb46('0x2c')]=qs['offset'](_0x22d3d8[_0xeb46('0x42')]['offset']);}return _0x236b99[_0xeb46('0xb2')](_0x554765);}})[_0xeb46('0x1e')](function(_0x13e7a9){if(_0x13e7a9){return _0x13e7a9?{'count':_0x11aeb2,'rows':_0x13e7a9}:null;}})[_0xeb46('0x1e')](respondWithResult(_0x2fc93d,null))[_0xeb46('0x57')](handleError(_0x2fc93d,null));};exports[_0xeb46('0x3a')]=function(_0x295be4,_0x563060,_0x50c586){var _0x615b70,_0x525b62,_0x3249ad;if(_['isNil'](_0x295be4[_0xeb46('0x5c')]['body'])||_0x295be4[_0xeb46('0x5c')][_0xeb46('0x5c')]===''){throw new db[(_0xeb46('0x71'))][(_0xeb46('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeb46('0x7a')](_0x295be4[_0xeb46('0x5c')]['to'])){}_0x615b70=_0x295be4[_0xeb46('0x5c')]['to'];return db[_0xeb46('0x3e')]['findOne']({'where':{'id':_0x295be4[_0xeb46('0x63')]['id']}})[_0xeb46('0x1e')](handleEntityNotFound(_0x563060,null))['then'](function(_0x29d92a){if(_0x29d92a){return db[_0xeb46('0x3e')][_0xeb46('0x5a')]({'where':{'id':_0x29d92a['id']},'include':[{'model':db[_0xeb46('0x7f')],'as':_0xeb46('0x85'),'include':[{'model':db[_0xeb46('0x70')],'as':'Contacts','where':{[_0x29d92a[_0xeb46('0x7c')]]:_0x615b70},'limit':0x1,'order':[[_0xeb46('0x75'),_0xeb46('0xb4')]]}]}]})[_0xeb46('0x1e')](handleEntityNotFound(_0x563060,null))[_0xeb46('0x1e')](function(_0x440741){if(_0x440741&&_0x440741[_0xeb46('0x85')]){_0x525b62=_0x440741[_0xeb46('0x36')]({'plain':!![]});if(_0x525b62[_0xeb46('0x85')]&&_0x525b62[_0xeb46('0x85')][_0xeb46('0x80')]['length']){return _0x525b62[_0xeb46('0x85')][_0xeb46('0x80')][0x0];}return db[_0xeb46('0x70')][_0xeb46('0x5b')](_[_0xeb46('0x17')](_0x295be4[_0xeb46('0x5c')],{'firstName':_0x615b70,[_0x440741['mapKey']]:_0x615b70,'phone':_0x615b70,'ListId':_0x525b62[_0xeb46('0x77')]}));}})[_0xeb46('0x1e')](handleEntityNotFound(_0x563060,null))[_0xeb46('0x1e')](function(_0x5ca615){if(_0x5ca615){_0x3249ad=_0x5ca615;return db[_0xeb46('0x8d')][_0xeb46('0x5a')]({'where':{'ContactId':_0x3249ad['id'],'closed':![],'OpenchannelAccountId':_0x525b62['id']}})['then'](function(_0x1405ae){if(_0x1405ae){return[_0x1405ae,![]];}return db[_0xeb46('0x8d')][_0xeb46('0x5b')]({'UserId':_0x295be4[_0xeb46('0x5e')]['id'],'ContactId':_0x3249ad['id'],'OpenchannelAccountId':_0x525b62['id'],'lastMsgDirection':_0xeb46('0xb5'),'Messages':[_['merge'](_0x295be4[_0xeb46('0x5c')],{'read':![],'body':_0x295be4[_0xeb46('0x5c')][_0xeb46('0x5c')],'OpenchannelAccountId':_0x525b62['id'],'UserId':_0x295be4[_0xeb46('0x5e')]['id'],'ContactId':_0x3249ad['id']})]},{'include':[{'model':db[_0xeb46('0x96')],'as':_0xeb46('0xb6')}]})[_0xeb46('0x1e')](function(_0x3a2249){return[_0x3a2249,!![]];});});}})[_0xeb46('0x8f')](function(_0x16a4ba,_0x56cafb){if(_0x56cafb){return _0x16a4ba;}return db['OpenchannelMessage'][_0xeb46('0x5b')](_[_0xeb46('0x52')](_0x295be4[_0xeb46('0x5c')],{'read':![],'body':_0x295be4[_0xeb46('0x5c')][_0xeb46('0x5c')],'OpenchannelAccountId':_0x525b62['id'],'OpenchannelInteractionId':_0x16a4ba['id'],'UserId':_0x295be4[_0xeb46('0x5e')]['id'],'ContactId':_0x3249ad['id']}))[_0xeb46('0x1e')](function(_0x5025b6){_0x16a4ba[_0xeb46('0xb7')][_0xeb46('0xb6')]=[];_0x16a4ba[_0xeb46('0xb7')]['Messages'][_0xeb46('0xb8')](_0x5025b6['dataValues']);return _0x16a4ba;});});}})[_0xeb46('0x1e')](respondWithResult(_0x563060,null))[_0xeb46('0x57')](handleError(_0x563060,null));}; \ No newline at end of file +var _0x2208=['close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','Start','startRouting','addApplications','sequelize','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','out','Messages','dataValues','eml-format','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','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','count','Content-Range','apply','reject','save','update','get','UserProfileResource','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','Pause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','OpenchannelAccountId','Disposition','getDispositions','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','from','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','orderBy','priority','asc','account','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','autoclose','push'];(function(_0x503b60,_0x3817a6){var _0x4b91e1=function(_0x35a4ce){while(--_0x35a4ce){_0x503b60['push'](_0x503b60['shift']());}};_0x4b91e1(++_0x3817a6);}(_0x2208,0x195));var _0x8220=function(_0xd19228,_0x352578){_0xd19228=_0xd19228-0x0;var _0x2bc38e=_0x2208[_0xd19228];return _0x2bc38e;};'use strict';var emlformat=require(_0x8220('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8220('0x1'));var BPromise=require(_0x8220('0x2'));var Mustache=require(_0x8220('0x3'));var util=require(_0x8220('0x4'));var path=require(_0x8220('0x5'));var sox=require(_0x8220('0x6'));var csv=require(_0x8220('0x7'));var ejs=require(_0x8220('0x8'));var fs=require('fs');var fs_extra=require(_0x8220('0x9'));var _=require(_0x8220('0xa'));var squel=require(_0x8220('0xb'));var crypto=require(_0x8220('0xc'));var jsforce=require(_0x8220('0xd'));var deskjs=require(_0x8220('0xe'));var toCsv=require(_0x8220('0x7'));var querystring=require(_0x8220('0xf'));var Papa=require(_0x8220('0x10'));var Redis=require(_0x8220('0x11'));var authService=require(_0x8220('0x12'));var qs=require(_0x8220('0x13'));var as=require(_0x8220('0x14'));var hardwareService=require(_0x8220('0x15'));var logger=require('../../config/logger')(_0x8220('0x16'));var utils=require(_0x8220('0x17'));var config=require(_0x8220('0x18'));var licenseUtil=require(_0x8220('0x19'));var db=require(_0x8220('0x1a'))['db'];config['redis']=_[_0x8220('0x1b')](config[_0x8220('0x1c')],{'host':_0x8220('0x1d'),'port':0x18eb});var socket=require(_0x8220('0x1e'))(new Redis(config[_0x8220('0x1c')]));require(_0x8220('0x1f'))[_0x8220('0x20')](socket);var jayson=require(_0x8220('0x21'));var client=jayson[_0x8220('0x22')][_0x8220('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x8220('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2b146f,_0x29865c,_0x1bc7fa,_0x300c14){return new BPromise(function(_0x302564,_0x36945c){var _0x5ad5f9=_0x300c14||client;return _0x5ad5f9[_0x8220('0x24')](_0x2b146f,_0x1bc7fa)[_0x8220('0x25')](function(_0x876dae){logger[_0x8220('0x26')](_0x8220('0x27'),_0x29865c,'request\x20sent');logger[_0x8220('0x28')](_0x8220('0x29'),_0x29865c,'request\x20sent',JSON[_0x8220('0x2a')](_0x876dae));if(_0x876dae[_0x8220('0x2b')]){if(_0x876dae[_0x8220('0x2b')][_0x8220('0x2c')]===0x1f4){logger['error'](_0x8220('0x27'),_0x29865c,_0x876dae[_0x8220('0x2b')][_0x8220('0x2d')]);return _0x36945c(_0x876dae['error'][_0x8220('0x2d')]);}logger[_0x8220('0x2b')](_0x8220('0x27'),_0x29865c,_0x876dae[_0x8220('0x2b')]['message']);return _0x302564(_0x876dae[_0x8220('0x2b')][_0x8220('0x2d')]);}else{logger[_0x8220('0x26')](_0x8220('0x27'),_0x29865c,'request\x20sent');_0x302564(_0x876dae[_0x8220('0x2e')][_0x8220('0x2d')]);}})[_0x8220('0x2f')](function(_0x3f9490){logger['error'](_0x8220('0x27'),_0x29865c,_0x3f9490);_0x36945c(_0x3f9490);});});}function respondWithStatusCode(_0x4a4638,_0x4217e9){_0x4217e9=_0x4217e9||0xcc;return function(_0x327471){if(_0x327471){return _0x4a4638[_0x8220('0x30')](_0x4217e9);}return _0x4a4638[_0x8220('0x31')](_0x4217e9)[_0x8220('0x32')]();};}function respondWithResult(_0x46f3fb,_0x5505dd){_0x5505dd=_0x5505dd||0xc8;return function(_0x86a3f4){if(_0x86a3f4){return _0x46f3fb['status'](_0x5505dd)['json'](_0x86a3f4);}};}function respondWithFilteredResult(_0x11f63e,_0x4cd2e2){return function(_0x515ecd){if(_0x515ecd){var _0x7ae3f3=typeof _0x4cd2e2[_0x8220('0x33')]==='undefined'&&typeof _0x4cd2e2['limit']==='undefined';var _0x440edb=_0x515ecd[_0x8220('0x34')];var _0x3fd14f=_0x7ae3f3?0x0:_0x4cd2e2[_0x8220('0x33')];var _0x2bea91=_0x7ae3f3?_0x515ecd['count']:_0x4cd2e2[_0x8220('0x33')]+_0x4cd2e2['limit'];var _0x307460;if(_0x2bea91>=_0x440edb){_0x2bea91=_0x440edb;_0x307460=0xc8;}else{_0x307460=0xce;}_0x11f63e[_0x8220('0x31')](_0x307460);return _0x11f63e['set'](_0x8220('0x35'),_0x3fd14f+'-'+_0x2bea91+'/'+_0x440edb)['json'](_0x515ecd);}return null;};}function patchUpdates(_0x49c056){return function(_0x5a6f8a){try{jsonpatch[_0x8220('0x36')](_0x5a6f8a,_0x49c056,!![]);}catch(_0x3db798){return BPromise[_0x8220('0x37')](_0x3db798);}return _0x5a6f8a[_0x8220('0x38')]();};}function saveUpdates(_0x2d59c2,_0x5179aa){return function(_0x31b7f4){if(_0x31b7f4){return _0x31b7f4[_0x8220('0x39')](_0x2d59c2)[_0x8220('0x25')](function(_0x549f8a){return _0x549f8a;});}return null;};}function removeEntity(_0x3589fd,_0x1b8c1e){return function(_0x58d689){if(_0x58d689){return _0x58d689['destroy']()[_0x8220('0x25')](function(){var _0x22a394=_0x58d689[_0x8220('0x3a')]({'plain':!![]});var _0x172bb2='OpenchannelAccounts';return db[_0x8220('0x3b')]['destroy']({'where':{'type':_0x172bb2,'resourceId':_0x22a394['id']}})[_0x8220('0x25')](function(){return _0x58d689;});})[_0x8220('0x25')](function(){_0x3589fd[_0x8220('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x343c0e,_0x58e9f9){return function(_0x44fcfd){if(!_0x44fcfd){_0x343c0e[_0x8220('0x30')](0x194);}return _0x44fcfd;};}function handleError(_0xfbf1f2,_0x2c207b){_0x2c207b=_0x2c207b||0x1f4;return function(_0x1cb8a0){logger[_0x8220('0x2b')](_0x1cb8a0['stack']);if(_0x1cb8a0[_0x8220('0x3c')]){delete _0x1cb8a0[_0x8220('0x3c')];}_0xfbf1f2[_0x8220('0x31')](_0x2c207b)[_0x8220('0x3d')](_0x1cb8a0);};}exports[_0x8220('0x3e')]=function(_0x214896,_0x36fa05){var _0x57da9d={'include':[{'model':db['Pause'],'as':_0x8220('0x3f')}]},_0x35aea2={},_0x1860fb={'count':0x0,'rows':[]};var _0x49cec3=_[_0x8220('0x40')](db[_0x8220('0x41')][_0x8220('0x42')],function(_0x327787){return{'name':_0x327787['fieldName'],'type':_0x327787['type']['key']};});_0x35aea2[_0x8220('0x43')]=_[_0x8220('0x40')](_0x49cec3,'name');_0x35aea2[_0x8220('0x44')]=_[_0x8220('0x45')](_0x214896['query']);_0x35aea2['filters']=_[_0x8220('0x46')](_0x35aea2[_0x8220('0x43')],_0x35aea2['query']);_0x57da9d[_0x8220('0x47')]=_['intersection'](_0x35aea2[_0x8220('0x43')],qs['fields'](_0x214896[_0x8220('0x44')][_0x8220('0x48')]));_0x57da9d[_0x8220('0x47')]=_0x57da9d['attributes']['length']?_0x57da9d['attributes']:_0x35aea2[_0x8220('0x43')];if(!_0x214896[_0x8220('0x44')][_0x8220('0x49')](_0x8220('0x4a'))){_0x57da9d[_0x8220('0x4b')]=qs[_0x8220('0x4b')](_0x214896[_0x8220('0x44')]['limit']);_0x57da9d[_0x8220('0x33')]=qs['offset'](_0x214896[_0x8220('0x44')][_0x8220('0x33')]);}_0x57da9d[_0x8220('0x4c')]=qs['sort'](_0x214896[_0x8220('0x44')][_0x8220('0x4d')]);_0x57da9d[_0x8220('0x4e')]=qs['filters'](_[_0x8220('0x4f')](_0x214896[_0x8220('0x44')],_0x35aea2[_0x8220('0x50')]),_0x49cec3);if(_0x214896[_0x8220('0x44')]['filter']){_0x57da9d['where']=_[_0x8220('0x51')](_0x57da9d[_0x8220('0x4e')],{'$or':_[_0x8220('0x40')](_0x49cec3,function(_0x813b87){if(_0x813b87[_0x8220('0x52')]!==_0x8220('0x53')){var _0x56bbc9={};_0x56bbc9[_0x813b87['name']]={'$like':'%'+_0x214896[_0x8220('0x44')][_0x8220('0x54')]+'%'};return _0x56bbc9;}})});}_0x57da9d=_[_0x8220('0x51')]({},_0x57da9d,_0x214896[_0x8220('0x55')]);var _0x24ac55={'where':_0x57da9d[_0x8220('0x4e')]};return db['OpenchannelAccount'][_0x8220('0x34')](_0x24ac55)[_0x8220('0x25')](function(_0x477b47){_0x1860fb['count']=_0x477b47;if(_0x214896[_0x8220('0x44')][_0x8220('0x56')]){_0x57da9d[_0x8220('0x57')]=[{'all':!![]}];}return db[_0x8220('0x41')][_0x8220('0x58')](_0x57da9d);})[_0x8220('0x25')](function(_0x628e74){_0x1860fb[_0x8220('0x59')]=_0x628e74;return _0x1860fb;})['then'](respondWithFilteredResult(_0x36fa05,_0x57da9d))[_0x8220('0x2f')](handleError(_0x36fa05,null));};exports['show']=function(_0x474052,_0x106a58){var _0x3488fd={'raw':![],'where':{'id':_0x474052[_0x8220('0x5a')]['id']},'include':[{'model':db[_0x8220('0x5b')],'as':_0x8220('0x3f')}]},_0x28ce89={};_0x28ce89[_0x8220('0x43')]=_[_0x8220('0x45')](db[_0x8220('0x41')][_0x8220('0x42')]);_0x28ce89[_0x8220('0x44')]=_[_0x8220('0x45')](_0x474052[_0x8220('0x44')]);_0x28ce89[_0x8220('0x50')]=_[_0x8220('0x46')](_0x28ce89[_0x8220('0x43')],_0x28ce89[_0x8220('0x44')]);_0x3488fd['attributes']=_['intersection'](_0x28ce89[_0x8220('0x43')],qs['fields'](_0x474052[_0x8220('0x44')][_0x8220('0x48')]));_0x3488fd[_0x8220('0x47')]=_0x3488fd[_0x8220('0x47')][_0x8220('0x5c')]?_0x3488fd[_0x8220('0x47')]:_0x28ce89[_0x8220('0x43')];if(_0x474052[_0x8220('0x44')][_0x8220('0x56')]){_0x3488fd[_0x8220('0x57')]=[{'all':!![]}];}_0x3488fd=_['merge']({},_0x3488fd,_0x474052[_0x8220('0x55')]);return db[_0x8220('0x41')][_0x8220('0x5d')](_0x3488fd)[_0x8220('0x25')](handleEntityNotFound(_0x106a58,null))[_0x8220('0x25')](respondWithResult(_0x106a58,null))[_0x8220('0x2f')](handleError(_0x106a58,null));};exports[_0x8220('0x5e')]=function(_0xf6f517,_0xcb05b8){return db[_0x8220('0x41')][_0x8220('0x5e')](_0xf6f517[_0x8220('0x5f')],{})[_0x8220('0x25')](function(_0x40df00){var _0x83ddb5=_0xf6f517[_0x8220('0x60')][_0x8220('0x3a')]({'plain':!![]});if(!_0x83ddb5)throw new Error(_0x8220('0x61'));if(_0x83ddb5[_0x8220('0x62')]===_0x8220('0x60')){var _0x447da1=_0x40df00[_0x8220('0x3a')]({'plain':!![]});var _0xe91498=_0x8220('0x63');return db[_0x8220('0x64')]['find']({'where':{'name':_0xe91498,'userProfileId':_0x83ddb5[_0x8220('0x65')]},'raw':!![]})[_0x8220('0x25')](function(_0x3c960f){if(_0x3c960f&&_0x3c960f[_0x8220('0x66')]===0x0){return db['UserProfileResource'][_0x8220('0x5e')]({'name':_0x447da1[_0x8220('0x3c')],'resourceId':_0x447da1['id'],'type':_0x3c960f[_0x8220('0x3c')],'sectionId':_0x3c960f['id']},{})[_0x8220('0x25')](function(){return _0x40df00;});}else{return _0x40df00;}})[_0x8220('0x2f')](function(_0x2ba90e){logger['error'](_0x8220('0x67'),_0x2ba90e);throw _0x2ba90e;});}return _0x40df00;})[_0x8220('0x25')](respondWithResult(_0xcb05b8,0xc9))[_0x8220('0x2f')](handleError(_0xcb05b8,null));};exports[_0x8220('0x39')]=function(_0x5484fa,_0x47d3b8){if(_0x5484fa[_0x8220('0x5f')]['id']){delete _0x5484fa['body']['id'];}return db[_0x8220('0x41')]['find']({'where':{'id':_0x5484fa['params']['id']},'include':[{'model':db[_0x8220('0x5b')],'as':_0x8220('0x3f')}]})[_0x8220('0x25')](handleEntityNotFound(_0x47d3b8,null))[_0x8220('0x25')](saveUpdates(_0x5484fa[_0x8220('0x5f')],null))[_0x8220('0x25')](respondWithResult(_0x47d3b8,null))[_0x8220('0x2f')](handleError(_0x47d3b8,null));};exports[_0x8220('0x68')]=function(_0x47e3a0,_0x47e108){return db['OpenchannelAccount'][_0x8220('0x5d')]({'where':{'id':_0x47e3a0[_0x8220('0x5a')]['id']}})['then'](handleEntityNotFound(_0x47e108,null))['then'](removeEntity(_0x47e108,null))[_0x8220('0x2f')](handleError(_0x47e108,null));};exports[_0x8220('0x69')]=function(_0x3b087b,_0x3f40be){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x3f40be,null))[_0x8220('0x2f')](handleError(_0x3f40be,null));};exports['addDisposition']=function(_0x417ab5,_0x4da50f,_0x1f7905){if(_0x417ab5[_0x8220('0x5f')]['id']){delete _0x417ab5[_0x8220('0x5f')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x417ab5[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x4da50f,null))[_0x8220('0x25')](function(_0x536d18){if(_0x536d18){_0x417ab5[_0x8220('0x5f')][_0x8220('0x6a')]=_0x536d18['id'];return db[_0x8220('0x6b')][_0x8220('0x5e')](_0x417ab5[_0x8220('0x5f')]);}})[_0x8220('0x25')](respondWithResult(_0x4da50f,null))[_0x8220('0x2f')](handleError(_0x4da50f,null));};exports[_0x8220('0x6c')]=function(_0x1d11c8,_0xb7bc67,_0x3f9d07){var _0x3d37ac={'raw':![],'where':{}};var _0x341340={};var _0x415a4a={'count':0x0,'rows':[]};return db[_0x8220('0x41')]['findOne']({'where':{'id':_0x1d11c8[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0xb7bc67,null))[_0x8220('0x25')](function(_0x356073){if(_0x356073){_0x341340[_0x8220('0x43')]=_[_0x8220('0x45')](db['Disposition'][_0x8220('0x42')]);_0x341340[_0x8220('0x44')]=_['keys'](_0x1d11c8[_0x8220('0x44')]);_0x341340[_0x8220('0x50')]=_[_0x8220('0x46')](_0x341340[_0x8220('0x43')],_0x341340[_0x8220('0x44')]);_0x3d37ac['attributes']=_[_0x8220('0x46')](_0x341340[_0x8220('0x43')],qs[_0x8220('0x48')](_0x1d11c8[_0x8220('0x44')][_0x8220('0x48')]));_0x3d37ac[_0x8220('0x47')]=_0x3d37ac[_0x8220('0x47')]['length']?_0x3d37ac['attributes']:_0x341340[_0x8220('0x43')];if(!_0x1d11c8[_0x8220('0x44')][_0x8220('0x49')](_0x8220('0x4a'))){_0x3d37ac[_0x8220('0x4b')]=qs[_0x8220('0x4b')](_0x1d11c8[_0x8220('0x44')][_0x8220('0x4b')]);_0x3d37ac[_0x8220('0x33')]=qs[_0x8220('0x33')](_0x1d11c8['query'][_0x8220('0x33')]);}_0x3d37ac[_0x8220('0x4c')]=qs[_0x8220('0x4d')](_0x1d11c8[_0x8220('0x44')][_0x8220('0x4d')]);_0x3d37ac[_0x8220('0x4e')]=qs[_0x8220('0x50')](_['pick'](_0x1d11c8[_0x8220('0x44')],_0x341340[_0x8220('0x50')]));_0x3d37ac[_0x8220('0x4e')][_0x8220('0x6a')]=_0x356073['id'];if(_0x1d11c8[_0x8220('0x44')][_0x8220('0x54')]){_0x3d37ac[_0x8220('0x4e')]=_['merge'](_0x3d37ac[_0x8220('0x4e')],{'$or':_[_0x8220('0x40')](_0x3d37ac[_0x8220('0x47')],function(_0x185990){var _0x4539ea={};_0x4539ea[_0x185990]={'$like':'%'+_0x1d11c8[_0x8220('0x44')][_0x8220('0x54')]+'%'};return _0x4539ea;})});}_0x3d37ac=_['merge']({},_0x3d37ac,_0x1d11c8[_0x8220('0x55')]);return db[_0x8220('0x6b')]['count']({'where':_0x3d37ac[_0x8220('0x4e')]})[_0x8220('0x25')](function(_0x3fff07){_0x415a4a[_0x8220('0x34')]=_0x3fff07;if(_0x1d11c8['query'][_0x8220('0x56')]){_0x3d37ac[_0x8220('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x8220('0x58')](_0x3d37ac);})['then'](function(_0x4883b8){_0x415a4a['rows']=_0x4883b8;return _0x415a4a;});}})['then'](respondWithFilteredResult(_0xb7bc67,_0x3d37ac))[_0x8220('0x2f')](handleError(_0xb7bc67,null));};exports[_0x8220('0x6d')]=function(_0x325313,_0x51302e,_0x4cdb7d){return db[_0x8220('0x41')]['find']({'where':{'id':_0x325313['params']['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x51302e,null))['then'](function(_0x38553b){if(_0x38553b){return _0x38553b[_0x8220('0x6d')](_0x325313[_0x8220('0x44')][_0x8220('0x6e')]);}})[_0x8220('0x25')](respondWithStatusCode(_0x51302e,null))['catch'](handleError(_0x51302e,null));};exports['addAnswer']=function(_0x38054a,_0x25315c,_0x525a3a){if(_0x38054a[_0x8220('0x5f')]['id']){delete _0x38054a[_0x8220('0x5f')]['id'];}return db[_0x8220('0x41')][_0x8220('0x5d')]({'where':{'id':_0x38054a['params']['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x25315c,null))[_0x8220('0x25')](function(_0x349a3f){if(_0x349a3f){_0x38054a['body'][_0x8220('0x6a')]=_0x349a3f['id'];return db[_0x8220('0x6f')][_0x8220('0x5e')](_0x38054a['body']);}})[_0x8220('0x25')](respondWithResult(_0x25315c,null))[_0x8220('0x2f')](handleError(_0x25315c,null));};exports['getAnswers']=function(_0x5f05a7,_0xd9225d,_0x2aee9b){var _0x3d4c07={'raw':![],'where':{}};var _0x5460af={};var _0x15f918={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x8220('0x70')]({'where':{'id':_0x5f05a7[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0xd9225d,null))[_0x8220('0x25')](function(_0x156969){if(_0x156969){_0x5460af[_0x8220('0x43')]=_['keys'](db[_0x8220('0x6f')][_0x8220('0x42')]);_0x5460af[_0x8220('0x44')]=_[_0x8220('0x45')](_0x5f05a7[_0x8220('0x44')]);_0x5460af[_0x8220('0x50')]=_[_0x8220('0x46')](_0x5460af['model'],_0x5460af[_0x8220('0x44')]);_0x3d4c07['attributes']=_[_0x8220('0x46')](_0x5460af['model'],qs['fields'](_0x5f05a7[_0x8220('0x44')][_0x8220('0x48')]));_0x3d4c07[_0x8220('0x47')]=_0x3d4c07[_0x8220('0x47')][_0x8220('0x5c')]?_0x3d4c07[_0x8220('0x47')]:_0x5460af[_0x8220('0x43')];if(!_0x5f05a7[_0x8220('0x44')][_0x8220('0x49')](_0x8220('0x4a'))){_0x3d4c07[_0x8220('0x4b')]=qs['limit'](_0x5f05a7[_0x8220('0x44')]['limit']);_0x3d4c07[_0x8220('0x33')]=qs[_0x8220('0x33')](_0x5f05a7[_0x8220('0x44')]['offset']);}_0x3d4c07[_0x8220('0x4c')]=qs['sort'](_0x5f05a7[_0x8220('0x44')][_0x8220('0x4d')]);_0x3d4c07[_0x8220('0x4e')]=qs[_0x8220('0x50')](_[_0x8220('0x4f')](_0x5f05a7[_0x8220('0x44')],_0x5460af[_0x8220('0x50')]));_0x3d4c07[_0x8220('0x4e')][_0x8220('0x6a')]=_0x156969['id'];if(_0x5f05a7['query'][_0x8220('0x54')]){_0x3d4c07[_0x8220('0x4e')]=_[_0x8220('0x51')](_0x3d4c07[_0x8220('0x4e')],{'$or':_[_0x8220('0x40')](_0x3d4c07[_0x8220('0x47')],function(_0x56b658){var _0x1bda4b={};_0x1bda4b[_0x56b658]={'$like':'%'+_0x5f05a7['query'][_0x8220('0x54')]+'%'};return _0x1bda4b;})});}_0x3d4c07=_[_0x8220('0x51')]({},_0x3d4c07,_0x5f05a7['options']);return db[_0x8220('0x6f')][_0x8220('0x34')]({'where':_0x3d4c07[_0x8220('0x4e')]})[_0x8220('0x25')](function(_0x3f4e37){_0x15f918[_0x8220('0x34')]=_0x3f4e37;if(_0x5f05a7[_0x8220('0x44')][_0x8220('0x56')]){_0x3d4c07[_0x8220('0x57')]=[{'all':!![]}];}return db[_0x8220('0x6f')][_0x8220('0x58')](_0x3d4c07);})['then'](function(_0x893a26){_0x15f918['rows']=_0x893a26;return _0x15f918;});}})[_0x8220('0x25')](respondWithFilteredResult(_0xd9225d,_0x3d4c07))[_0x8220('0x2f')](handleError(_0xd9225d,null));};exports[_0x8220('0x71')]=function(_0x11de87,_0x1baa9e,_0x4c92d4){return db[_0x8220('0x41')][_0x8220('0x5d')]({'where':{'id':_0x11de87[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x1baa9e,null))[_0x8220('0x25')](function(_0x5bf6ac){if(_0x5bf6ac){return _0x5bf6ac[_0x8220('0x71')](_0x11de87[_0x8220('0x44')][_0x8220('0x6e')]);}})['then'](respondWithStatusCode(_0x1baa9e,null))[_0x8220('0x2f')](handleError(_0x1baa9e,null));};exports[_0x8220('0x72')]=function(_0x3316d9,_0x291660,_0x520200){var _0x5c8b1a={'body':_0x3316d9['body'],'channel':_0x8220('0x73')};var _0x187f97=[];var _0x10546d=[];var _0xbd54aa={};var _0x315d93=![];return db['CmContact']['describe']()[_0x8220('0x25')](function(_0x4a1412){if(!_0x4a1412){throw new db[(_0x8220('0x74'))][(_0x8220('0x75'))](_0x8220('0x76'));}_0x187f97=_[_0x8220('0x77')](_[_0x8220('0x45')](_0x4a1412),[_0x8220('0x78'),'updatedAt']);_0x10546d=_[_0x8220('0x77')](_['keys'](_0x4a1412),[_0x8220('0x78'),'updatedAt',_0x8220('0x79'),_0x8220('0x7a')]);if(_0x3316d9['body']['id']){delete _0x3316d9[_0x8220('0x5f')]['id'];}if(_[_0x8220('0x7b')](_0x3316d9[_0x8220('0x5f')][_0x8220('0x7c')])){throw new db[(_0x8220('0x74'))][(_0x8220('0x75'))]('from\x20is\x20mandatory');}if(_[_0x8220('0x7b')](_0x3316d9[_0x8220('0x5f')][_0x8220('0x5f')])||_0x3316d9['body'][_0x8220('0x5f')]===''){throw new db[(_0x8220('0x74'))][(_0x8220('0x75'))](_0x8220('0x7d'));}if(_[_0x8220('0x7b')](_0x3316d9['body'][_0x8220('0x7e')])){throw new db['Sequelize'][(_0x8220('0x75'))](_0x8220('0x7f')+_0x10546d);}if(!_[_0x8220('0x80')](_0x10546d,_0x3316d9['body'][_0x8220('0x7e')])){throw new db[(_0x8220('0x74'))][(_0x8220('0x75'))](_0x8220('0x81')+_0x10546d);}_0xbd54aa[_0x3316d9[_0x8220('0x5f')][_0x8220('0x7e')]]=_0x3316d9['body'][_0x8220('0x7c')];})['then'](function(){return db[_0x8220('0x41')][_0x8220('0x5d')]({'where':{'id':_0x3316d9[_0x8220('0x5a')]['id']},'include':[{'model':db[_0x8220('0x82')],'as':_0x8220('0x83'),'include':[{'model':db['CmContact'],'as':_0x8220('0x84'),'where':_0xbd54aa,'limit':0x1,'order':[['updatedAt',_0x8220('0x85')]]}]},{'model':db[_0x8220('0x86')],'as':_0x8220('0x87')}]});})[_0x8220('0x25')](handleEntityNotFound(_0x291660,null))[_0x8220('0x25')](function(_0x2f8de0){if(_0x2f8de0&&_0x2f8de0[_0x8220('0x83')]){_0x5c8b1a['account']=_0x2f8de0;_0x5c8b1a[_0x8220('0x88')]=_0x2f8de0[_0x8220('0x87')];_0x5c8b1a['list']=_0x2f8de0[_0x8220('0x83')];_0x5c8b1a['applications']=_[_0x8220('0x89')](_0x5c8b1a[_0x8220('0x88')],[_0x8220('0x8a')],[_0x8220('0x8b')]);if(_0x5c8b1a[_0x8220('0x8c')][_0x8220('0x87')]){delete _0x5c8b1a[_0x8220('0x8c')][_0x8220('0x87')];}if(_0x5c8b1a[_0x8220('0x8c')][_0x8220('0x83')]&&_0x5c8b1a[_0x8220('0x8c')]['List'][_0x8220('0x84')]['length']){return _0x5c8b1a[_0x8220('0x8c')]['List']['Contacts'][0x0];}var _0x3b89f0=_[_0x8220('0x1b')](_0x3316d9[_0x8220('0x5f')],{'firstName':_0x3316d9[_0x8220('0x5f')][_0x8220('0x7c')],'ListId':_0x2f8de0['ListId']});_0x3b89f0[_0x3316d9[_0x8220('0x5f')][_0x8220('0x7e')]]=_0x3316d9[_0x8220('0x5f')][_0x8220('0x7c')];return db[_0x8220('0x8d')]['create'](_0x3b89f0,{'fields':_0x187f97,'raw':!![]});}})[_0x8220('0x25')](handleEntityNotFound(_0x291660,null))[_0x8220('0x25')](function(_0x380393){_0x5c8b1a[_0x8220('0x8e')]=_0x380393;if(_0x380393){var _0x3f294b={'ContactId':_0x380393['id'],'OpenchannelAccountId':_0x3316d9['params']['id'],'from':(_0x380393[_0x8220('0x8f')]||'')+'\x20'+(_0x380393[_0x8220('0x90')]||'')};var _0x3d8f20={'OpenchannelAccountId':_0x3316d9[_0x8220('0x5a')]['id'],'closed':![]};if(_0x3316d9[_0x8220('0x5f')][_0x8220('0x91')]){_0x3d8f20[_0x8220('0x91')]=_0x3316d9[_0x8220('0x5f')]['threadId'];return db[_0x8220('0x92')][_0x8220('0x5d')]({'where':_0x3d8f20})[_0x8220('0x25')](function(_0x42378a){if(_0x42378a){return[_0x42378a,![]];}_0x3f294b[_0x8220('0x91')]=_0x3316d9[_0x8220('0x5f')][_0x8220('0x91')];_0x3f294b[_0x8220('0x93')]=_0x3316d9[_0x8220('0x5f')][_0x8220('0x93')];return db['OpenchannelInteraction']['create'](_0x3f294b)['then'](function(_0x4fab7b){return[_0x4fab7b,!![]];});});}else{_0x3d8f20[_0x8220('0x91')]=null;}_0x3d8f20['ContactId']=_0x380393['id'];return db[_0x8220('0x92')][_0x8220('0x5d')]({'where':_0x3d8f20})[_0x8220('0x25')](function(_0xf5087a){if(_0xf5087a){return[_0xf5087a,![]];}return db[_0x8220('0x92')][_0x8220('0x5e')](_0x3f294b)[_0x8220('0x25')](function(_0x3ea2dc){return[_0x3ea2dc,!![]];});});}})['spread'](function(_0x251daa,_0x4dca1f){if(_0x251daa){_0x315d93=_0x4dca1f;if(!_0x4dca1f){var _0x119eab={'from':(_0x5c8b1a[_0x8220('0x8e')][_0x8220('0x8f')]||'')+'\x20'+(_0x5c8b1a[_0x8220('0x8e')][_0x8220('0x90')]||'')};if(_0x3316d9[_0x8220('0x5f')][_0x8220('0x91')]&&_0x3316d9['body'][_0x8220('0x94')]&&_0x3316d9[_0x8220('0x5f')][_0x8220('0x91')]!=_0x3316d9[_0x8220('0x5f')]['messageId']){_0x119eab[_0x8220('0x91')]=_0x3316d9[_0x8220('0x5f')]['messageId'];}return _0x251daa[_0x8220('0x39')](_0x119eab);}else{return _0x251daa;}}})[_0x8220('0x25')](function(_0x1f7467){_0x5c8b1a[_0x8220('0x95')]=_0x1f7467[_0x8220('0x3a')]({'plain':!![]});_0x5c8b1a[_0x8220('0x95')]['created']=_0x315d93;if(_0x5c8b1a['interaction'][_0x8220('0x96')]){if(_0x5c8b1a[_0x8220('0x8c')][_0x8220('0x97')]){_0x5c8b1a['applications'][_0x8220('0x98')]({'id':0x0,'priority':_0x5c8b1a[_0x8220('0x88')][_0x8220('0x5c')]+0x1,'app':_0x8220('0x99'),'appdata':_0x8220('0x9a'),'interval':_0x8220('0x9b')});}}return db[_0x8220('0x9c')][_0x8220('0x5e')]({'body':_0x3316d9[_0x8220('0x5f')]['body'],'OpenchannelAccountId':_0x3316d9[_0x8220('0x5a')]['id'],'OpenchannelInteractionId':_0x1f7467['id'],'direction':'in','ContactId':_0x5c8b1a[_0x8220('0x8e')]['id'],'AttachmentId':_0x3316d9['body']['AttachmentId']});})[_0x8220('0x25')](function(_0x992657){_0x5c8b1a['message']=_0x992657;if(_0x5c8b1a[_0x8220('0x95')][_0x8220('0x9d')]){return db['User'][_0x8220('0x5d')]({'attributes':['id','name'],'where':{'id':_0x5c8b1a[_0x8220('0x95')][_0x8220('0x9d')]}})['then'](function(_0x1ec793){if(_0x1ec793){_0x5c8b1a[_0x8220('0x88')][_0x8220('0x9e')]({'id':0x0,'priority':0x0,'app':_0x8220('0x9f'),'appdata':_0x1ec793['name']+','+(_0x5c8b1a['account']['waitForTheAssignedAgent']||0xa),'interval':_0x8220('0x9b')});_0x5c8b1a['forcedOwnership']=![];}return respondWithRpcPromise(_0x8220('0xa0'),_0x8220('0xa1'),_0x5c8b1a);});}return respondWithRpcPromise('Start',_0x8220('0xa1'),_0x5c8b1a);})[_0x8220('0x25')](function(_0x3ac103){respondWithRpcPromise('EventManager','EventManager',{'event':_0x8220('0x72'),'message':_0x3ac103},client9002);return _0x3ac103;})[_0x8220('0x25')](respondWithResult(_0x291660,null))['catch'](handleError(_0x291660,null));};exports[_0x8220('0xa2')]=function(_0x20852c,_0x21686c,_0x3e0e92){return db[_0x8220('0x41')]['findOne']({'where':{'id':_0x20852c['params']['id']}})['then'](handleEntityNotFound(_0x21686c,null))[_0x8220('0x25')](function(_0x545975){if(_0x545975){return db[_0x8220('0xa3')][_0x8220('0xa4')](function(_0x5dba1f){return db[_0x8220('0x86')][_0x8220('0x68')]({'where':{'OpenchannelAccountId':_0x20852c[_0x8220('0x5a')]['id']},'transaction':_0x5dba1f})[_0x8220('0x25')](function(_0x29fb16){var _0x2dbb58=_['map'](_0x20852c['body'],function(_0x2b4e72){_0x2b4e72[_0x8220('0x6a')]=_0x20852c[_0x8220('0x5a')]['id'];return _0x2b4e72;});return db[_0x8220('0x86')]['bulkCreate'](_0x2dbb58,{'transaction':_0x5dba1f});});})['then'](function(){return db[_0x8220('0x86')][_0x8220('0xa5')]({'where':{'OpenchannelAccountId':_0x20852c['params']['id']},'order':_0x8220('0x8a')});});}})[_0x8220('0x25')](respondWithResult(_0x21686c,null))[_0x8220('0x2f')](handleError(_0x21686c,null));};exports[_0x8220('0xa6')]=function(_0x59714c,_0x2c407e,_0x48ea4f){var _0x562ed5={};var _0x1cf2e0={};var _0x53aa2e;var _0xc135d0;return db['OpenchannelAccount'][_0x8220('0x70')]({'where':{'id':_0x59714c[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x2c407e,null))[_0x8220('0x25')](function(_0x267f23){if(_0x267f23){_0x53aa2e=_0x267f23;_0x1cf2e0['model']=_[_0x8220('0x45')](db[_0x8220('0x86')][_0x8220('0x42')]);_0x1cf2e0[_0x8220('0x44')]=_[_0x8220('0x45')](_0x59714c['query']);_0x1cf2e0[_0x8220('0x50')]=_[_0x8220('0x46')](_0x1cf2e0[_0x8220('0x43')],_0x1cf2e0[_0x8220('0x44')]);_0x562ed5[_0x8220('0x47')]=_['intersection'](_0x1cf2e0[_0x8220('0x43')],qs[_0x8220('0x48')](_0x59714c['query'][_0x8220('0x48')]));_0x562ed5[_0x8220('0x47')]=_0x562ed5[_0x8220('0x47')][_0x8220('0x5c')]?_0x562ed5[_0x8220('0x47')]:_0x1cf2e0[_0x8220('0x43')];_0x562ed5[_0x8220('0x4c')]=qs[_0x8220('0x4d')](_0x59714c['query']['sort']);_0x562ed5[_0x8220('0x4e')]=qs[_0x8220('0x50')](_[_0x8220('0x4f')](_0x59714c[_0x8220('0x44')],_0x1cf2e0['filters']));if(_0x59714c[_0x8220('0x44')][_0x8220('0x54')]){_0x562ed5[_0x8220('0x4e')]=_[_0x8220('0x51')](_0x562ed5[_0x8220('0x4e')],{'$or':_['map'](_0x562ed5[_0x8220('0x47')],function(_0x254de3){var _0x3eeb49={};_0x3eeb49[_0x254de3]={'$like':'%'+_0x59714c[_0x8220('0x44')]['filter']+'%'};return _0x3eeb49;})});}_0x562ed5=_[_0x8220('0x51')]({},_0x562ed5,_0x59714c['options']);return _0x53aa2e[_0x8220('0xa6')](_0x562ed5);}})[_0x8220('0x25')](function(_0x29797f){if(_0x29797f){_0xc135d0=_0x29797f[_0x8220('0x5c')];if(!_0x59714c[_0x8220('0x44')][_0x8220('0x49')]('nolimit')){_0x562ed5[_0x8220('0x4b')]=qs[_0x8220('0x4b')](_0x59714c['query'][_0x8220('0x4b')]);_0x562ed5['offset']=qs[_0x8220('0x33')](_0x59714c[_0x8220('0x44')][_0x8220('0x33')]);}return _0x53aa2e[_0x8220('0xa6')](_0x562ed5);}})[_0x8220('0x25')](function(_0x117e7d){if(_0x117e7d){return _0x117e7d?{'count':_0xc135d0,'rows':_0x117e7d}:null;}})[_0x8220('0x25')](respondWithResult(_0x2c407e,null))[_0x8220('0x2f')](handleError(_0x2c407e,null));};exports[_0x8220('0xa7')]=function(_0x39c0ad,_0x18d7f1,_0x3ed91b){var _0x24e322={'raw':![],'where':{}};var _0x2ae4a8={};var _0x331c0a={'count':0x0,'rows':[]};return db[_0x8220('0x41')][_0x8220('0x70')]({'where':{'id':_0x39c0ad[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x18d7f1,null))[_0x8220('0x25')](function(_0x30f844){if(_0x30f844){_0x2ae4a8['model']=_['keys'](db[_0x8220('0x92')][_0x8220('0x42')]);_0x2ae4a8[_0x8220('0x44')]=_[_0x8220('0x45')](_0x39c0ad[_0x8220('0x44')]);_0x2ae4a8[_0x8220('0x50')]=_[_0x8220('0x46')](_0x2ae4a8[_0x8220('0x43')],_0x2ae4a8['query']);_0x24e322[_0x8220('0x47')]=_[_0x8220('0x46')](_0x2ae4a8['model'],qs['fields'](_0x39c0ad[_0x8220('0x44')][_0x8220('0x48')]));_0x24e322['attributes']=_0x24e322[_0x8220('0x47')][_0x8220('0x5c')]?_0x24e322['attributes']:_0x2ae4a8['model'];if(!_0x39c0ad['query']['hasOwnProperty'](_0x8220('0x4a'))){_0x24e322[_0x8220('0x4b')]=qs[_0x8220('0x4b')](_0x39c0ad[_0x8220('0x44')]['limit']);_0x24e322[_0x8220('0x33')]=qs['offset'](_0x39c0ad[_0x8220('0x44')][_0x8220('0x33')]);}_0x24e322['order']=qs[_0x8220('0x4d')](_0x39c0ad[_0x8220('0x44')][_0x8220('0x4d')]);_0x24e322[_0x8220('0x4e')]=qs['filters'](_[_0x8220('0x4f')](_0x39c0ad['query'],_0x2ae4a8[_0x8220('0x50')]));_0x24e322[_0x8220('0x4e')][_0x8220('0x6a')]=_0x30f844['id'];if(_0x39c0ad[_0x8220('0x44')][_0x8220('0x54')]){_0x24e322[_0x8220('0x4e')]=_[_0x8220('0x51')](_0x24e322['where'],{'$or':_[_0x8220('0x40')](_0x24e322[_0x8220('0x47')],function(_0x14b0ec){var _0x118265={};_0x118265[_0x14b0ec]={'$like':'%'+_0x39c0ad['query'][_0x8220('0x54')]+'%'};return _0x118265;})});}_0x24e322=_[_0x8220('0x51')]({},_0x24e322,_0x39c0ad[_0x8220('0x55')]);return db[_0x8220('0x92')][_0x8220('0x34')]({'where':_0x24e322['where']})[_0x8220('0x25')](function(_0x534424){_0x331c0a[_0x8220('0x34')]=_0x534424;if(_0x39c0ad['query'][_0x8220('0x56')]){_0x24e322[_0x8220('0x57')]=[{'model':db['CmContact'],'as':_0x8220('0xa8'),'required':![]},{'model':db['User'],'as':_0x8220('0xa9'),'attributes':[_0x8220('0x3c'),_0x8220('0xaa'),'internal'],'required':![]},{'model':db[_0x8220('0xab')],'as':'Tags','attributes':['id',_0x8220('0x3c'),'color'],'where':_0x39c0ad[_0x8220('0x44')]['tag']?{'id':_0x39c0ad[_0x8220('0x44')][_0x8220('0xac')]}:undefined,'required':_0x39c0ad['query'][_0x8220('0xac')]?!![]:![]}];}return db[_0x8220('0x92')][_0x8220('0x58')](_0x24e322);})[_0x8220('0x25')](function(_0x230976){_0x331c0a[_0x8220('0x59')]=_0x230976;return _0x331c0a;});}})[_0x8220('0x25')](respondWithFilteredResult(_0x18d7f1,_0x24e322))[_0x8220('0x2f')](handleError(_0x18d7f1,null));};exports[_0x8220('0xad')]=function(_0x88f9fd,_0x4618e6,_0x1ce4d2){return db[_0x8220('0x41')][_0x8220('0x5d')]({'where':{'id':_0x88f9fd['params']['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x4618e6,null))[_0x8220('0x25')](function(_0xb0802d){if(_0xb0802d){return _0xb0802d[_0x8220('0xad')](_0x88f9fd[_0x8220('0x5f')][_0x8220('0x6e')],_[_0x8220('0xae')](_0x88f9fd[_0x8220('0x5f')],[_0x8220('0x6e'),'id'])||{})[_0x8220('0xaf')](function(_0x2f0f31){for(var _0x21167b=0x0;_0x21167b<_0x88f9fd[_0x8220('0x5f')][_0x8220('0x6e')][_0x8220('0x5c')];_0x21167b+=0x1){socket[_0x8220('0xb0')](_0x8220('0xb1'),{'UserId':Number(_0x88f9fd[_0x8220('0x5f')][_0x8220('0x6e')][_0x21167b]),'OpenchannelAccountId':Number(_0x88f9fd[_0x8220('0x5a')]['id'])});}return _0x2f0f31;});}})[_0x8220('0x25')](respondWithResult(_0x4618e6,null))[_0x8220('0x2f')](handleError(_0x4618e6,null));};exports['removeAgents']=function(_0x5da65f,_0x8b5872,_0x1e7a45){return db[_0x8220('0x41')][_0x8220('0x5d')]({'where':{'id':_0x5da65f[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x8b5872,null))[_0x8220('0x25')](function(_0x24bdce){if(_0x24bdce){return _0x24bdce[_0x8220('0xb2')](_0x5da65f[_0x8220('0x44')]['ids'])[_0x8220('0x25')](function(){if(_[_0x8220('0xb3')](_0x5da65f[_0x8220('0x44')][_0x8220('0x6e')])){for(var _0xeb3a50=0x0;_0xeb3a50<_0x5da65f[_0x8220('0x44')][_0x8220('0x6e')][_0x8220('0x5c')];_0xeb3a50+=0x1){socket[_0x8220('0xb0')](_0x8220('0xb4'),{'UserId':Number(_0x5da65f['query']['ids'][_0xeb3a50]),'OpenchannelAccountId':Number(_0x5da65f[_0x8220('0x5a')]['id'])});}}else{socket[_0x8220('0xb0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5da65f[_0x8220('0x44')][_0x8220('0x6e')]),'OpenchannelAccountId':Number(_0x5da65f['params']['id'])});}});}})[_0x8220('0x25')](respondWithStatusCode(_0x8b5872,null))[_0x8220('0x2f')](handleError(_0x8b5872,null));};exports[_0x8220('0xb5')]=function(_0x513c48,_0x3c43f8,_0x26d700){var _0x3688b0={};var _0x460d2e={};var _0x2991de;var _0x461749;return db['OpenchannelAccount'][_0x8220('0x70')]({'where':{'id':_0x513c48[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x3c43f8,null))[_0x8220('0x25')](function(_0x24bd94){if(_0x24bd94){_0x2991de=_0x24bd94;_0x460d2e[_0x8220('0x43')]=_[_0x8220('0x45')](db[_0x8220('0xb6')][_0x8220('0x42')]);_0x460d2e['query']=_[_0x8220('0x45')](_0x513c48[_0x8220('0x44')]);_0x460d2e[_0x8220('0x50')]=_['intersection'](_0x460d2e[_0x8220('0x43')],_0x460d2e['query']);_0x3688b0[_0x8220('0x47')]=_[_0x8220('0x46')](_0x460d2e['model'],qs['fields'](_0x513c48['query'][_0x8220('0x48')]));_0x3688b0[_0x8220('0x47')]=_0x3688b0[_0x8220('0x47')][_0x8220('0x5c')]?_0x3688b0['attributes']:_0x460d2e[_0x8220('0x43')];_0x3688b0[_0x8220('0x4c')]=qs[_0x8220('0x4d')](_0x513c48[_0x8220('0x44')][_0x8220('0x4d')]);_0x3688b0[_0x8220('0x4e')]=qs['filters'](_[_0x8220('0x4f')](_0x513c48[_0x8220('0x44')],_0x460d2e['filters']));if(_0x513c48[_0x8220('0x44')][_0x8220('0x54')]){_0x3688b0[_0x8220('0x4e')]=_[_0x8220('0x51')](_0x3688b0[_0x8220('0x4e')],{'$or':_[_0x8220('0x40')](_0x3688b0[_0x8220('0x47')],function(_0xbf6acf){var _0x35090f={};_0x35090f[_0xbf6acf]={'$like':'%'+_0x513c48[_0x8220('0x44')][_0x8220('0x54')]+'%'};return _0x35090f;})});}_0x3688b0=_[_0x8220('0x51')]({},_0x3688b0,_0x513c48[_0x8220('0x55')]);return _0x2991de['getAgents'](_0x3688b0);}})[_0x8220('0x25')](function(_0x1b42a5){if(_0x1b42a5){_0x461749=_0x1b42a5['length'];if(!_0x513c48[_0x8220('0x44')]['hasOwnProperty']('nolimit')){_0x3688b0[_0x8220('0x4b')]=qs[_0x8220('0x4b')](_0x513c48[_0x8220('0x44')][_0x8220('0x4b')]);_0x3688b0[_0x8220('0x33')]=qs[_0x8220('0x33')](_0x513c48['query'][_0x8220('0x33')]);}return _0x2991de[_0x8220('0xb5')](_0x3688b0);}})[_0x8220('0x25')](function(_0x4589c0){if(_0x4589c0){return _0x4589c0?{'count':_0x461749,'rows':_0x4589c0}:null;}})['then'](respondWithResult(_0x3c43f8,null))[_0x8220('0x2f')](handleError(_0x3c43f8,null));};exports[_0x8220('0x3d')]=function(_0x710777,_0x4d1591,_0x5caeee){var _0x3ea3a5,_0x383ed2,_0x1f1a67;if(_[_0x8220('0x7b')](_0x710777[_0x8220('0x5f')][_0x8220('0x5f')])||_0x710777['body'][_0x8220('0x5f')]===''){throw new db[(_0x8220('0x74'))][(_0x8220('0x75'))](_0x8220('0x7d'));}if(_[_0x8220('0x7b')](_0x710777[_0x8220('0x5f')]['to'])){}_0x3ea3a5=_0x710777[_0x8220('0x5f')]['to'];return db['OpenchannelAccount'][_0x8220('0x70')]({'where':{'id':_0x710777[_0x8220('0x5a')]['id']}})[_0x8220('0x25')](handleEntityNotFound(_0x4d1591,null))[_0x8220('0x25')](function(_0x1c9f9d){if(_0x1c9f9d){return db['OpenchannelAccount'][_0x8220('0x5d')]({'where':{'id':_0x1c9f9d['id']},'include':[{'model':db[_0x8220('0x82')],'as':_0x8220('0x83'),'include':[{'model':db[_0x8220('0x8d')],'as':_0x8220('0x84'),'where':{[_0x1c9f9d['mapKey']]:_0x3ea3a5},'limit':0x1,'order':[['updatedAt',_0x8220('0x85')]]}]}]})[_0x8220('0x25')](handleEntityNotFound(_0x4d1591,null))[_0x8220('0x25')](function(_0x479a80){if(_0x479a80&&_0x479a80[_0x8220('0x83')]){_0x383ed2=_0x479a80[_0x8220('0x3a')]({'plain':!![]});if(_0x383ed2['List']&&_0x383ed2[_0x8220('0x83')][_0x8220('0x84')][_0x8220('0x5c')]){return _0x383ed2[_0x8220('0x83')][_0x8220('0x84')][0x0];}return db[_0x8220('0x8d')]['create'](_[_0x8220('0x1b')](_0x710777[_0x8220('0x5f')],{'firstName':_0x3ea3a5,[_0x479a80[_0x8220('0x7e')]]:_0x3ea3a5,'phone':_0x3ea3a5,'ListId':_0x383ed2[_0x8220('0x7a')]}));}})['then'](handleEntityNotFound(_0x4d1591,null))[_0x8220('0x25')](function(_0xf9df3f){if(_0xf9df3f){_0x1f1a67=_0xf9df3f;return db[_0x8220('0x92')]['find']({'where':{'ContactId':_0x1f1a67['id'],'closed':![],'OpenchannelAccountId':_0x383ed2['id']}})['then'](function(_0x724e07){if(_0x724e07){return[_0x724e07,![]];}return db[_0x8220('0x92')][_0x8220('0x5e')]({'UserId':_0x710777[_0x8220('0x60')]['id'],'ContactId':_0x1f1a67['id'],'OpenchannelAccountId':_0x383ed2['id'],'lastMsgDirection':_0x8220('0xb7'),'Messages':[_[_0x8220('0x51')](_0x710777['body'],{'read':![],'body':_0x710777[_0x8220('0x5f')]['body'],'OpenchannelAccountId':_0x383ed2['id'],'UserId':_0x710777[_0x8220('0x60')]['id'],'ContactId':_0x1f1a67['id']})]},{'include':[{'model':db[_0x8220('0x9c')],'as':_0x8220('0xb8')}]})[_0x8220('0x25')](function(_0x5e82cf){return[_0x5e82cf,!![]];});});}})['spread'](function(_0x3d36d2,_0x5c5540){if(_0x5c5540){return _0x3d36d2;}return db[_0x8220('0x9c')][_0x8220('0x5e')](_[_0x8220('0x51')](_0x710777[_0x8220('0x5f')],{'read':![],'body':_0x710777['body'][_0x8220('0x5f')],'OpenchannelAccountId':_0x383ed2['id'],'OpenchannelInteractionId':_0x3d36d2['id'],'UserId':_0x710777[_0x8220('0x60')]['id'],'ContactId':_0x1f1a67['id']}))['then'](function(_0x455c28){_0x3d36d2[_0x8220('0xb9')]['Messages']=[];_0x3d36d2[_0x8220('0xb9')][_0x8220('0xb8')]['push'](_0x455c28[_0x8220('0xb9')]);return _0x3d36d2;});});}})['then'](respondWithResult(_0x4d1591,null))[_0x8220('0x2f')](handleError(_0x4d1591,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e1c38ca..9b76b26 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 _0x91a7=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x91a7,0xe7));var _0x791a=function(_0x48724f,_0x3dc230){_0x48724f=_0x48724f-0x0;var _0x2a13ca=_0x91a7[_0x48724f];return _0x2a13ca;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){OpenchannelAccountEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);OpenchannelAccountEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x228e00,_0x562442){var _0x4cd301=function(_0x156197){while(--_0x156197){_0x228e00['push'](_0x228e00['shift']());}};_0x4cd301(++_0x562442);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 997e081..9f613c6 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(_0x45a366,_0x1c7d15){var _0x5957e9=function(_0x3997ab){while(--_0x3997ab){_0x45a366['push'](_0x45a366['shift']());}};_0x5957e9(++_0x1c7d15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x2f45e2,_0x48b048){var _0x3ca0ed=function(_0x32968b){while(--_0x32968b){_0x2f45e2['push'](_0x2f45e2['shift']());}};_0x3ca0ed(++_0x48b048);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 6c51dd0..9e32ca7 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 _0xe3d4=['redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x34d6cb,_0x1ae55c){_0x34d6cb=_0x34d6cb-0x0;var _0x4372cb=_0xe3d4[_0x34d6cb];return _0x4372cb;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var moment=require(_0x4e3d('0x1'));var BPromise=require(_0x4e3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e3d('0x3'));var db=require(_0x4e3d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e3d('0x5'))('rpc');var config=require(_0x4e3d('0x6'));var jayson=require(_0x4e3d('0x7'));var client=jayson['client'][_0x4e3d('0x8')]({'port':0x232a});config[_0x4e3d('0x9')]=_['defaults'](config[_0x4e3d('0x9')],{'host':_0x4e3d('0xa'),'port':0x18eb});var socket=require(_0x4e3d('0xb'))(new Redis(config[_0x4e3d('0x9')]));require(_0x4e3d('0xc'))[_0x4e3d('0xd')](socket);function respondWithRpcPromise(_0x500f5c,_0x5032b7,_0x7f3787){return new BPromise(function(_0x1a79cf,_0x17ea9a){return client[_0x4e3d('0xe')](_0x500f5c,_0x7f3787)[_0x4e3d('0xf')](function(_0x67497f){logger['info'](_0x4e3d('0x10'),_0x5032b7,_0x4e3d('0x11'));logger[_0x4e3d('0x12')](_0x4e3d('0x13'),_0x5032b7,_0x4e3d('0x11'),JSON[_0x4e3d('0x14')](_0x67497f));if(_0x67497f[_0x4e3d('0x15')]){if(_0x67497f[_0x4e3d('0x15')]['code']===0x1f4){logger[_0x4e3d('0x15')](_0x4e3d('0x10'),_0x5032b7,_0x67497f[_0x4e3d('0x15')]['message']);return _0x17ea9a(_0x67497f[_0x4e3d('0x15')][_0x4e3d('0x16')]);}logger[_0x4e3d('0x15')](_0x4e3d('0x10'),_0x5032b7,_0x67497f[_0x4e3d('0x15')][_0x4e3d('0x16')]);return _0x1a79cf(_0x67497f[_0x4e3d('0x15')][_0x4e3d('0x16')]);}else{logger['info'](_0x4e3d('0x10'),_0x5032b7,'request\x20sent');_0x1a79cf(_0x67497f['result'][_0x4e3d('0x16')]);}})['catch'](function(_0x5a2389){logger[_0x4e3d('0x15')](_0x4e3d('0x10'),_0x5032b7,_0x5a2389);_0x17ea9a(_0x5a2389);});});} \ No newline at end of file +var _0x1be1=['./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x3186a4,_0x5384cc){var _0x268d95=function(_0x36213b){while(--_0x36213b){_0x3186a4['push'](_0x3186a4['shift']());}};_0x268d95(++_0x5384cc);}(_0x1be1,0x192));var _0x11be=function(_0x4cff11,_0x1dbe18){_0x4cff11=_0x4cff11-0x0;var _0x3dd07d=_0x1be1[_0x4cff11];return _0x3dd07d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});config[_0x11be('0x9')]=_['defaults'](config[_0x11be('0x9')],{'host':_0x11be('0xa'),'port':0x18eb});var socket=require(_0x11be('0xb'))(new Redis(config[_0x11be('0x9')]));require(_0x11be('0xc'))['register'](socket);function respondWithRpcPromise(_0x2bf6db,_0x2754b8,_0x578588){return new BPromise(function(_0x2e4114,_0x2cd786){return client[_0x11be('0xd')](_0x2bf6db,_0x578588)[_0x11be('0xe')](function(_0x4e013c){logger[_0x11be('0xf')](_0x11be('0x10'),_0x2754b8,_0x11be('0x11'));logger['debug'](_0x11be('0x12'),_0x2754b8,_0x11be('0x11'),JSON['stringify'](_0x4e013c));if(_0x4e013c[_0x11be('0x13')]){if(_0x4e013c['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2754b8,_0x4e013c['error']['message']);return _0x2cd786(_0x4e013c['error'][_0x11be('0x14')]);}logger['error'](_0x11be('0x10'),_0x2754b8,_0x4e013c[_0x11be('0x13')][_0x11be('0x14')]);return _0x2e4114(_0x4e013c[_0x11be('0x13')]['message']);}else{logger[_0x11be('0xf')](_0x11be('0x10'),_0x2754b8,'request\x20sent');_0x2e4114(_0x4e013c[_0x11be('0x15')][_0x11be('0x14')]);}})[_0x11be('0x16')](function(_0x4cad80){logger['error'](_0x11be('0x10'),_0x2754b8,_0x4cad80);_0x2cd786(_0x4cad80);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index fb07081..15ad602 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 _0xeea4=['./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xeea4,0x19e));var _0x4eea=function(_0x81bbc3,_0x353d30){_0x81bbc3=_0x81bbc3-0x0;var _0x2b1104=_0xeea4[_0x81bbc3];return _0x2b1104;};'use strict';var OpenchannelAccountEvents=require(_0x4eea('0x0'));var events=[_0x4eea('0x1'),_0x4eea('0x2'),_0x4eea('0x3')];function createListener(_0x28e57e,_0x38a9e8){return function(_0x2a47d5){_0x38a9e8[_0x4eea('0x4')](_0x28e57e,_0x2a47d5);};}function removeListener(_0x27997a,_0x5c02db){return function(){OpenchannelAccountEvents[_0x4eea('0x5')](_0x27997a,_0x5c02db);};}exports['register']=function(_0x2df4ae){for(var _0x383566=0x0,_0x3d5aa8=events['length'];_0x383566<_0x3d5aa8;_0x383566++){var _0x1a2e5e=events[_0x383566];var _0x44116a=createListener('openchannelAccount:'+_0x1a2e5e,_0x2df4ae);OpenchannelAccountEvents['on'](_0x1a2e5e,_0x44116a);}}; \ No newline at end of file +var _0x9d02=['./openchannelAccount.events','remove','emit','removeListener','register','length','openchannelAccount:'];(function(_0x2d1d37,_0x1048d8){var _0x3e9649=function(_0x3e6fa6){while(--_0x3e6fa6){_0x2d1d37['push'](_0x2d1d37['shift']());}};_0x3e9649(++_0x1048d8);}(_0x9d02,0x118));var _0x29d0=function(_0x15af00,_0x5251f7){_0x15af00=_0x15af00-0x0;var _0x233c08=_0x9d02[_0x15af00];return _0x233c08;};'use strict';var OpenchannelAccountEvents=require(_0x29d0('0x0'));var events=['save',_0x29d0('0x1'),'update'];function createListener(_0x4519be,_0x48ea60){return function(_0x10d9e4){_0x48ea60[_0x29d0('0x2')](_0x4519be,_0x10d9e4);};}function removeListener(_0x58e99e,_0x33c00f){return function(){OpenchannelAccountEvents[_0x29d0('0x3')](_0x58e99e,_0x33c00f);};}exports[_0x29d0('0x4')]=function(_0x5a9824){for(var _0x5ef279=0x0,_0x5e35b3=events[_0x29d0('0x5')];_0x5ef279<_0x5e35b3;_0x5ef279++){var _0x18a02c=events[_0x5ef279];var _0x4a4019=createListener(_0x29d0('0x6')+_0x18a02c,_0x5a9824);OpenchannelAccountEvents['on'](_0x18a02c,_0x4a4019);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 61513ba..27c1f52 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 _0xcc82=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xcc82,0x189));var _0x2cc8=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xcc82[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var path=require(_0x2cc8('0x2'));var timeout=require(_0x2cc8('0x3'));var express=require(_0x2cc8('0x4'));var router=express['Router']();var fs_extra=require(_0x2cc8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2cc8('0x6'));var config=require(_0x2cc8('0x7'));var controller=require(_0x2cc8('0x8'));router[_0x2cc8('0x9')]('/',auth[_0x2cc8('0xa')](),controller['index']);router[_0x2cc8('0x9')](_0x2cc8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2cc8('0xc')]('/',auth[_0x2cc8('0xa')](),controller['create']);router[_0x2cc8('0xd')](_0x2cc8('0xb'),auth[_0x2cc8('0xa')](),controller[_0x2cc8('0xe')]);router[_0x2cc8('0xf')](_0x2cc8('0xb'),auth[_0x2cc8('0xa')](),controller[_0x2cc8('0x10')]);module[_0x2cc8('0x11')]=router; \ No newline at end of file +var _0x5a47=['fs-extra','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x32c8ed,_0x45fef2){var _0x580764=function(_0xeb440e){while(--_0xeb440e){_0x32c8ed['push'](_0x32c8ed['shift']());}};_0x580764(++_0x45fef2);}(_0x5a47,0x164));var _0x75a4=function(_0x19311f,_0x517da1){_0x19311f=_0x19311f-0x0;var _0x2203a6=_0x5a47[_0x19311f];return _0x2203a6;};'use strict';var multer=require(_0x75a4('0x0'));var util=require(_0x75a4('0x1'));var path=require('path');var timeout=require(_0x75a4('0x2'));var express=require(_0x75a4('0x3'));var router=express['Router']();var fs_extra=require(_0x75a4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x75a4('0x5'));var controller=require(_0x75a4('0x6'));router[_0x75a4('0x7')]('/',auth[_0x75a4('0x8')](),controller[_0x75a4('0x9')]);router['get'](_0x75a4('0xa'),auth[_0x75a4('0x8')](),controller['show']);router[_0x75a4('0xb')]('/',auth['isAuthenticated'](),controller[_0x75a4('0xc')]);router[_0x75a4('0xd')](_0x75a4('0xa'),auth['isAuthenticated'](),controller[_0x75a4('0xe')]);router[_0x75a4('0xf')](_0x75a4('0xa'),auth[_0x75a4('0x8')](),controller[_0x75a4('0x10')]);module[_0x75a4('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7ee1aa7..0725064 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 _0x7ad8=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7ad8,0xfc));var _0x87ad=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x7ad8[_0x29ce14];return _0x48f289;};'use strict';var Sequelize=require(_0x87ad('0x0'));module[_0x87ad('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x87ad('0x2')},'appdata':{'type':Sequelize[_0x87ad('0x3')]()},'description':{'type':Sequelize[_0x87ad('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x87ad('0x5')}}; \ No newline at end of file +var _0x8137=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2b6e6f,_0x42a056){var _0x4782a8=function(_0x41828c){while(--_0x41828c){_0x2b6e6f['push'](_0x2b6e6f['shift']());}};_0x4782a8(++_0x42a056);}(_0x8137,0x116));var _0x7813=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8137[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7813('0x0'));module[_0x7813('0x1')]={'priority':{'type':Sequelize[_0x7813('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7813('0x3')],'allowNull':![],'defaultValue':_0x7813('0x4')},'appdata':{'type':Sequelize[_0x7813('0x5')]()},'description':{'type':Sequelize[_0x7813('0x3')]},'interval':{'type':Sequelize[_0x7813('0x3')],'defaultValue':_0x7813('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d0373f4..013047d 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 _0x8f67=['filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','apply','save','update','then','destroy','error','name','send','map','OpenchannelApplication','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x4bac73,_0x140bd6){var _0x15f994=function(_0x18867c){while(--_0x18867c){_0x4bac73['push'](_0x4bac73['shift']());}};_0x15f994(++_0x140bd6);}(_0x8f67,0x122));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78f6('0x0'));var zipdir=require(_0x78f6('0x1'));var jsonpatch=require(_0x78f6('0x2'));var rp=require(_0x78f6('0x3'));var moment=require('moment');var BPromise=require(_0x78f6('0x4'));var Mustache=require(_0x78f6('0x5'));var util=require(_0x78f6('0x6'));var path=require(_0x78f6('0x7'));var sox=require(_0x78f6('0x8'));var csv=require('to-csv');var ejs=require(_0x78f6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x78f6('0xa'));var crypto=require(_0x78f6('0xb'));var jsforce=require(_0x78f6('0xc'));var deskjs=require(_0x78f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x78f6('0xe'));var Papa=require(_0x78f6('0xf'));var Redis=require(_0x78f6('0x10'));var authService=require(_0x78f6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78f6('0x12'));var logger=require(_0x78f6('0x13'))(_0x78f6('0x14'));var utils=require(_0x78f6('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x78f6('0x16'))['db'];function respondWithStatusCode(_0x1f6ec4,_0x14799f){_0x14799f=_0x14799f||0xcc;return function(_0x34ae6b){if(_0x34ae6b){return _0x1f6ec4[_0x78f6('0x17')](_0x14799f);}return _0x1f6ec4['status'](_0x14799f)[_0x78f6('0x18')]();};}function respondWithResult(_0x5aa257,_0x273dac){_0x273dac=_0x273dac||0xc8;return function(_0x104624){if(_0x104624){return _0x5aa257[_0x78f6('0x19')](_0x273dac)['json'](_0x104624);}};}function respondWithFilteredResult(_0x6455ee,_0x1a7686){return function(_0x43735b){if(_0x43735b){var _0x372c17=typeof _0x1a7686[_0x78f6('0x1a')]===_0x78f6('0x1b')&&typeof _0x1a7686[_0x78f6('0x1c')]==='undefined';var _0x6b8e99=_0x43735b[_0x78f6('0x1d')];var _0x1b269a=_0x372c17?0x0:_0x1a7686[_0x78f6('0x1a')];var _0x4adaf7=_0x372c17?_0x43735b['count']:_0x1a7686[_0x78f6('0x1a')]+_0x1a7686['limit'];var _0x430623;if(_0x4adaf7>=_0x6b8e99){_0x4adaf7=_0x6b8e99;_0x430623=0xc8;}else{_0x430623=0xce;}_0x6455ee[_0x78f6('0x19')](_0x430623);return _0x6455ee['set']('Content-Range',_0x1b269a+'-'+_0x4adaf7+'/'+_0x6b8e99)['json'](_0x43735b);}return null;};}function patchUpdates(_0x25b36a){return function(_0x398904){try{jsonpatch[_0x78f6('0x1e')](_0x398904,_0x25b36a,!![]);}catch(_0x530bba){return BPromise['reject'](_0x530bba);}return _0x398904[_0x78f6('0x1f')]();};}function saveUpdates(_0x21f1ec,_0x87e13c){return function(_0x1c1df8){if(_0x1c1df8){return _0x1c1df8[_0x78f6('0x20')](_0x21f1ec)[_0x78f6('0x21')](function(_0x3f91d3){return _0x3f91d3;});}return null;};}function removeEntity(_0x35e9b2,_0x17c3f8){return function(_0x33a9d6){if(_0x33a9d6){return _0x33a9d6[_0x78f6('0x22')]()[_0x78f6('0x21')](function(){_0x35e9b2[_0x78f6('0x19')](0xcc)[_0x78f6('0x18')]();});}};}function handleEntityNotFound(_0x1d7919,_0x499889){return function(_0x4fa2bc){if(!_0x4fa2bc){_0x1d7919['sendStatus'](0x194);}return _0x4fa2bc;};}function handleError(_0x2e7bb1,_0x297304){_0x297304=_0x297304||0x1f4;return function(_0x1db362){logger[_0x78f6('0x23')](_0x1db362['stack']);if(_0x1db362[_0x78f6('0x24')]){delete _0x1db362['name'];}_0x2e7bb1[_0x78f6('0x19')](_0x297304)[_0x78f6('0x25')](_0x1db362);};}exports['index']=function(_0x3ba802,_0x3d595f){var _0x4633ed={},_0x262869={},_0x27837a={'count':0x0,'rows':[]};var _0x23b46b=_[_0x78f6('0x26')](db[_0x78f6('0x27')][_0x78f6('0x28')],function(_0x274fc6){return{'name':_0x274fc6['fieldName'],'type':_0x274fc6[_0x78f6('0x29')][_0x78f6('0x2a')]};});_0x262869['model']=_['map'](_0x23b46b,_0x78f6('0x24'));_0x262869[_0x78f6('0x2b')]=_[_0x78f6('0x2c')](_0x3ba802[_0x78f6('0x2b')]);_0x262869[_0x78f6('0x2d')]=_['intersection'](_0x262869['model'],_0x262869[_0x78f6('0x2b')]);_0x4633ed['attributes']=_[_0x78f6('0x2e')](_0x262869[_0x78f6('0x2f')],qs[_0x78f6('0x30')](_0x3ba802[_0x78f6('0x2b')]['fields']));_0x4633ed[_0x78f6('0x31')]=_0x4633ed[_0x78f6('0x31')][_0x78f6('0x32')]?_0x4633ed[_0x78f6('0x31')]:_0x262869[_0x78f6('0x2f')];if(!_0x3ba802[_0x78f6('0x2b')][_0x78f6('0x33')](_0x78f6('0x34'))){_0x4633ed[_0x78f6('0x1c')]=qs['limit'](_0x3ba802[_0x78f6('0x2b')][_0x78f6('0x1c')]);_0x4633ed[_0x78f6('0x1a')]=qs[_0x78f6('0x1a')](_0x3ba802[_0x78f6('0x2b')][_0x78f6('0x1a')]);}_0x4633ed['order']=qs[_0x78f6('0x35')](_0x3ba802[_0x78f6('0x2b')][_0x78f6('0x35')]);_0x4633ed['where']=qs[_0x78f6('0x2d')](_[_0x78f6('0x36')](_0x3ba802[_0x78f6('0x2b')],_0x262869[_0x78f6('0x2d')]),_0x23b46b);if(_0x3ba802['query'][_0x78f6('0x37')]){_0x4633ed[_0x78f6('0x38')]=_[_0x78f6('0x39')](_0x4633ed[_0x78f6('0x38')],{'$or':_[_0x78f6('0x26')](_0x23b46b,function(_0x2005cc){if(_0x2005cc[_0x78f6('0x29')]!==_0x78f6('0x3a')){var _0x3a25d3={};_0x3a25d3[_0x2005cc['name']]={'$like':'%'+_0x3ba802[_0x78f6('0x2b')][_0x78f6('0x37')]+'%'};return _0x3a25d3;}})});}_0x4633ed=_['merge']({},_0x4633ed,_0x3ba802[_0x78f6('0x3b')]);var _0x30afd6={'where':_0x4633ed['where']};return db['OpenchannelApplication'][_0x78f6('0x1d')](_0x30afd6)[_0x78f6('0x21')](function(_0x3a69aa){_0x27837a[_0x78f6('0x1d')]=_0x3a69aa;if(_0x3ba802['query'][_0x78f6('0x3c')]){_0x4633ed['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x78f6('0x3d')](_0x4633ed);})['then'](function(_0x5b14b8){_0x27837a[_0x78f6('0x3e')]=_0x5b14b8;return _0x27837a;})[_0x78f6('0x21')](respondWithFilteredResult(_0x3d595f,_0x4633ed))[_0x78f6('0x3f')](handleError(_0x3d595f,null));};exports[_0x78f6('0x40')]=function(_0x5abd5a,_0x231185){var _0x5687c9={'raw':!![],'where':{'id':_0x5abd5a[_0x78f6('0x41')]['id']}},_0x39b9db={};_0x39b9db[_0x78f6('0x2f')]=_['keys'](db[_0x78f6('0x27')][_0x78f6('0x28')]);_0x39b9db['query']=_[_0x78f6('0x2c')](_0x5abd5a['query']);_0x39b9db[_0x78f6('0x2d')]=_[_0x78f6('0x2e')](_0x39b9db['model'],_0x39b9db[_0x78f6('0x2b')]);_0x5687c9['attributes']=_[_0x78f6('0x2e')](_0x39b9db['model'],qs[_0x78f6('0x30')](_0x5abd5a[_0x78f6('0x2b')][_0x78f6('0x30')]));_0x5687c9[_0x78f6('0x31')]=_0x5687c9[_0x78f6('0x31')][_0x78f6('0x32')]?_0x5687c9[_0x78f6('0x31')]:_0x39b9db['model'];if(_0x5abd5a['query'][_0x78f6('0x3c')]){_0x5687c9['include']=[{'all':!![]}];}_0x5687c9=_[_0x78f6('0x39')]({},_0x5687c9,_0x5abd5a[_0x78f6('0x3b')]);return db[_0x78f6('0x27')][_0x78f6('0x42')](_0x5687c9)[_0x78f6('0x21')](handleEntityNotFound(_0x231185,null))[_0x78f6('0x21')](respondWithResult(_0x231185,null))[_0x78f6('0x3f')](handleError(_0x231185,null));};exports[_0x78f6('0x43')]=function(_0x470279,_0x109059){return db[_0x78f6('0x27')][_0x78f6('0x43')](_0x470279['body'],{})[_0x78f6('0x21')](respondWithResult(_0x109059,0xc9))[_0x78f6('0x3f')](handleError(_0x109059,null));};exports[_0x78f6('0x20')]=function(_0x4dfd0d,_0x27c258){if(_0x4dfd0d[_0x78f6('0x44')]['id']){delete _0x4dfd0d[_0x78f6('0x44')]['id'];}return db[_0x78f6('0x27')]['find']({'where':{'id':_0x4dfd0d[_0x78f6('0x41')]['id']}})[_0x78f6('0x21')](handleEntityNotFound(_0x27c258,null))[_0x78f6('0x21')](saveUpdates(_0x4dfd0d[_0x78f6('0x44')],null))[_0x78f6('0x21')](respondWithResult(_0x27c258,null))['catch'](handleError(_0x27c258,null));};exports[_0x78f6('0x22')]=function(_0x300045,_0x80061f){return db[_0x78f6('0x27')][_0x78f6('0x42')]({'where':{'id':_0x300045[_0x78f6('0x41')]['id']}})[_0x78f6('0x21')](handleEntityNotFound(_0x80061f,null))[_0x78f6('0x21')](removeEntity(_0x80061f,null))[_0x78f6('0x3f')](handleError(_0x80061f,null));}; \ No newline at end of file +var _0x0b81=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','reject','save','update','destroy','then','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','params','find','create','body','eml-format','zip-dir','moment'];(function(_0x1f18fc,_0xb1286e){var _0x4ea284=function(_0x43c499){while(--_0x43c499){_0x1f18fc['push'](_0x1f18fc['shift']());}};_0x4ea284(++_0xb1286e);}(_0x0b81,0x156));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x10b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x10b8('0x2'));var BPromise=require(_0x10b8('0x3'));var Mustache=require(_0x10b8('0x4'));var util=require(_0x10b8('0x5'));var path=require(_0x10b8('0x6'));var sox=require(_0x10b8('0x7'));var csv=require(_0x10b8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10b8('0x9'));var squel=require(_0x10b8('0xa'));var crypto=require(_0x10b8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x10b8('0x8'));var querystring=require(_0x10b8('0xc'));var Papa=require(_0x10b8('0xd'));var Redis=require(_0x10b8('0xe'));var authService=require(_0x10b8('0xf'));var qs=require(_0x10b8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x10b8('0x11'));var utils=require('../../config/utils');var config=require(_0x10b8('0x12'));var licenseUtil=require(_0x10b8('0x13'));var db=require(_0x10b8('0x14'))['db'];function respondWithStatusCode(_0x45d86c,_0x341841){_0x341841=_0x341841||0xcc;return function(_0x59f682){if(_0x59f682){return _0x45d86c[_0x10b8('0x15')](_0x341841);}return _0x45d86c[_0x10b8('0x16')](_0x341841)[_0x10b8('0x17')]();};}function respondWithResult(_0x3329f7,_0x473bb7){_0x473bb7=_0x473bb7||0xc8;return function(_0x77b52d){if(_0x77b52d){return _0x3329f7['status'](_0x473bb7)['json'](_0x77b52d);}};}function respondWithFilteredResult(_0x20c012,_0x4f9162){return function(_0x471d4c){if(_0x471d4c){var _0x4135e8=typeof _0x4f9162[_0x10b8('0x18')]==='undefined'&&typeof _0x4f9162[_0x10b8('0x19')]===_0x10b8('0x1a');var _0x184ef4=_0x471d4c['count'];var _0x212a38=_0x4135e8?0x0:_0x4f9162[_0x10b8('0x18')];var _0x5b5ac0=_0x4135e8?_0x471d4c['count']:_0x4f9162[_0x10b8('0x18')]+_0x4f9162[_0x10b8('0x19')];var _0x25e5b4;if(_0x5b5ac0>=_0x184ef4){_0x5b5ac0=_0x184ef4;_0x25e5b4=0xc8;}else{_0x25e5b4=0xce;}_0x20c012['status'](_0x25e5b4);return _0x20c012[_0x10b8('0x1b')](_0x10b8('0x1c'),_0x212a38+'-'+_0x5b5ac0+'/'+_0x184ef4)[_0x10b8('0x1d')](_0x471d4c);}return null;};}function patchUpdates(_0x3f5c3e){return function(_0x4d0be0){try{jsonpatch['apply'](_0x4d0be0,_0x3f5c3e,!![]);}catch(_0x2b7b48){return BPromise[_0x10b8('0x1e')](_0x2b7b48);}return _0x4d0be0[_0x10b8('0x1f')]();};}function saveUpdates(_0x5eabc3,_0x3a4c74){return function(_0x111096){if(_0x111096){return _0x111096[_0x10b8('0x20')](_0x5eabc3)['then'](function(_0x102ccf){return _0x102ccf;});}return null;};}function removeEntity(_0x1e4f58,_0x28473a){return function(_0x695bcc){if(_0x695bcc){return _0x695bcc[_0x10b8('0x21')]()[_0x10b8('0x22')](function(){_0x1e4f58[_0x10b8('0x16')](0xcc)[_0x10b8('0x17')]();});}};}function handleEntityNotFound(_0x321f8c,_0x1395d3){return function(_0x537ccb){if(!_0x537ccb){_0x321f8c[_0x10b8('0x15')](0x194);}return _0x537ccb;};}function handleError(_0x20ec40,_0x431153){_0x431153=_0x431153||0x1f4;return function(_0x1c883b){logger['error'](_0x1c883b['stack']);if(_0x1c883b['name']){delete _0x1c883b[_0x10b8('0x23')];}_0x20ec40[_0x10b8('0x16')](_0x431153)['send'](_0x1c883b);};}exports[_0x10b8('0x24')]=function(_0x3dcd1e,_0x16b7bc){var _0x583381={},_0x44f095={},_0x1578e6={'count':0x0,'rows':[]};var _0x3458ba=_[_0x10b8('0x25')](db[_0x10b8('0x26')][_0x10b8('0x27')],function(_0x2c103a){return{'name':_0x2c103a[_0x10b8('0x28')],'type':_0x2c103a[_0x10b8('0x29')][_0x10b8('0x2a')]};});_0x44f095[_0x10b8('0x2b')]=_['map'](_0x3458ba,_0x10b8('0x23'));_0x44f095[_0x10b8('0x2c')]=_[_0x10b8('0x2d')](_0x3dcd1e[_0x10b8('0x2c')]);_0x44f095[_0x10b8('0x2e')]=_[_0x10b8('0x2f')](_0x44f095['model'],_0x44f095['query']);_0x583381[_0x10b8('0x30')]=_[_0x10b8('0x2f')](_0x44f095[_0x10b8('0x2b')],qs[_0x10b8('0x31')](_0x3dcd1e[_0x10b8('0x2c')]['fields']));_0x583381[_0x10b8('0x30')]=_0x583381['attributes'][_0x10b8('0x32')]?_0x583381['attributes']:_0x44f095[_0x10b8('0x2b')];if(!_0x3dcd1e[_0x10b8('0x2c')][_0x10b8('0x33')]('nolimit')){_0x583381['limit']=qs[_0x10b8('0x19')](_0x3dcd1e['query'][_0x10b8('0x19')]);_0x583381[_0x10b8('0x18')]=qs[_0x10b8('0x18')](_0x3dcd1e[_0x10b8('0x2c')]['offset']);}_0x583381[_0x10b8('0x34')]=qs[_0x10b8('0x35')](_0x3dcd1e[_0x10b8('0x2c')][_0x10b8('0x35')]);_0x583381[_0x10b8('0x36')]=qs[_0x10b8('0x2e')](_[_0x10b8('0x37')](_0x3dcd1e['query'],_0x44f095[_0x10b8('0x2e')]),_0x3458ba);if(_0x3dcd1e['query'][_0x10b8('0x38')]){_0x583381['where']=_['merge'](_0x583381['where'],{'$or':_[_0x10b8('0x25')](_0x3458ba,function(_0x275b2e){if(_0x275b2e[_0x10b8('0x29')]!==_0x10b8('0x39')){var _0x4926aa={};_0x4926aa[_0x275b2e[_0x10b8('0x23')]]={'$like':'%'+_0x3dcd1e['query']['filter']+'%'};return _0x4926aa;}})});}_0x583381=_[_0x10b8('0x3a')]({},_0x583381,_0x3dcd1e[_0x10b8('0x3b')]);var _0x193729={'where':_0x583381[_0x10b8('0x36')]};return db[_0x10b8('0x26')][_0x10b8('0x3c')](_0x193729)[_0x10b8('0x22')](function(_0x30426b){_0x1578e6[_0x10b8('0x3c')]=_0x30426b;if(_0x3dcd1e[_0x10b8('0x2c')][_0x10b8('0x3d')]){_0x583381['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x10b8('0x3e')](_0x583381);})[_0x10b8('0x22')](function(_0x51bbc1){_0x1578e6['rows']=_0x51bbc1;return _0x1578e6;})['then'](respondWithFilteredResult(_0x16b7bc,_0x583381))[_0x10b8('0x3f')](handleError(_0x16b7bc,null));};exports[_0x10b8('0x40')]=function(_0x11a377,_0x3540af){var _0xb1c283={'raw':!![],'where':{'id':_0x11a377[_0x10b8('0x41')]['id']}},_0x823134={};_0x823134['model']=_[_0x10b8('0x2d')](db[_0x10b8('0x26')][_0x10b8('0x27')]);_0x823134[_0x10b8('0x2c')]=_[_0x10b8('0x2d')](_0x11a377[_0x10b8('0x2c')]);_0x823134['filters']=_[_0x10b8('0x2f')](_0x823134[_0x10b8('0x2b')],_0x823134['query']);_0xb1c283[_0x10b8('0x30')]=_['intersection'](_0x823134[_0x10b8('0x2b')],qs['fields'](_0x11a377['query'][_0x10b8('0x31')]));_0xb1c283[_0x10b8('0x30')]=_0xb1c283[_0x10b8('0x30')][_0x10b8('0x32')]?_0xb1c283[_0x10b8('0x30')]:_0x823134[_0x10b8('0x2b')];if(_0x11a377[_0x10b8('0x2c')][_0x10b8('0x3d')]){_0xb1c283['include']=[{'all':!![]}];}_0xb1c283=_[_0x10b8('0x3a')]({},_0xb1c283,_0x11a377[_0x10b8('0x3b')]);return db[_0x10b8('0x26')][_0x10b8('0x42')](_0xb1c283)['then'](handleEntityNotFound(_0x3540af,null))[_0x10b8('0x22')](respondWithResult(_0x3540af,null))[_0x10b8('0x3f')](handleError(_0x3540af,null));};exports['create']=function(_0x3bde45,_0xf90f05){return db[_0x10b8('0x26')][_0x10b8('0x43')](_0x3bde45[_0x10b8('0x44')],{})['then'](respondWithResult(_0xf90f05,0xc9))[_0x10b8('0x3f')](handleError(_0xf90f05,null));};exports[_0x10b8('0x20')]=function(_0x576179,_0x4534fd){if(_0x576179[_0x10b8('0x44')]['id']){delete _0x576179[_0x10b8('0x44')]['id'];}return db['OpenchannelApplication'][_0x10b8('0x42')]({'where':{'id':_0x576179[_0x10b8('0x41')]['id']}})[_0x10b8('0x22')](handleEntityNotFound(_0x4534fd,null))[_0x10b8('0x22')](saveUpdates(_0x576179['body'],null))[_0x10b8('0x22')](respondWithResult(_0x4534fd,null))[_0x10b8('0x3f')](handleError(_0x4534fd,null));};exports[_0x10b8('0x21')]=function(_0x58b1cd,_0x5e9281){return db[_0x10b8('0x26')][_0x10b8('0x42')]({'where':{'id':_0x58b1cd[_0x10b8('0x41')]['id']}})[_0x10b8('0x22')](handleEntityNotFound(_0x5e9281,null))[_0x10b8('0x22')](removeEntity(_0x5e9281,null))[_0x10b8('0x3f')](handleError(_0x5e9281,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d86295d..78e8b05 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 _0xce5b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xce5b,0xbc));var _0xbce5=function(_0x4439ab,_0x20358c){_0x4439ab=_0x4439ab-0x0;var _0x257a1d=_0xce5b[_0x4439ab];return _0x257a1d;};'use strict';var _=require(_0xbce5('0x0'));var util=require(_0xbce5('0x1'));var logger=require(_0xbce5('0x2'))(_0xbce5('0x3'));var moment=require(_0xbce5('0x4'));var BPromise=require(_0xbce5('0x5'));var rp=require(_0xbce5('0x6'));var fs=require('fs');var path=require(_0xbce5('0x7'));var rimraf=require(_0xbce5('0x8'));var config=require(_0xbce5('0x9'));var attributes=require('./openchannelApplication.attributes');module[_0xbce5('0xa')]=function(_0x2c8c86,_0x1d3f60){return _0x2c8c86[_0xbce5('0xb')](_0xbce5('0xc'),attributes,{'tableName':_0xbce5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbce5('0xe'),'collate':_0xbce5('0xf')});}; \ No newline at end of file +var _0x5ac2=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x5ac2,0x1e0));var _0x25ac=function(_0x20af17,_0x20371c){_0x20af17=_0x20af17-0x0;var _0x2e6dac=_0x5ac2[_0x20af17];return _0x2e6dac;};'use strict';var _=require(_0x25ac('0x0'));var util=require(_0x25ac('0x1'));var logger=require(_0x25ac('0x2'))(_0x25ac('0x3'));var moment=require(_0x25ac('0x4'));var BPromise=require(_0x25ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25ac('0x6'));var config=require('../../config/environment');var attributes=require(_0x25ac('0x7'));module[_0x25ac('0x8')]=function(_0xf8d504,_0x3e8178){return _0xf8d504['define'](_0x25ac('0x9'),attributes,{'tableName':_0x25ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25ac('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 2b1e9fa..e31dd12 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 _0xddfa=['debug','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xddfa,0x1e0));var _0xaddf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xddfa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaddf('0x0'));var util=require('util');var moment=require(_0xaddf('0x1'));var BPromise=require(_0xaddf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaddf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaddf('0x4'))(_0xaddf('0x5'));var config=require('../../config/environment');var jayson=require(_0xaddf('0x6'));var client=jayson[_0xaddf('0x7')][_0xaddf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3366a8,_0x35a7cb,_0x306ec9){return new BPromise(function(_0x11523b,_0x553a36){return client[_0xaddf('0x9')](_0x3366a8,_0x306ec9)[_0xaddf('0xa')](function(_0xb40a6c){logger[_0xaddf('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x35a7cb,_0xaddf('0xc'));logger[_0xaddf('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x35a7cb,_0xaddf('0xc'),JSON[_0xaddf('0xe')](_0xb40a6c));if(_0xb40a6c[_0xaddf('0xf')]){if(_0xb40a6c['error'][_0xaddf('0x10')]===0x1f4){logger[_0xaddf('0xf')](_0xaddf('0x11'),_0x35a7cb,_0xb40a6c[_0xaddf('0xf')][_0xaddf('0x12')]);return _0x553a36(_0xb40a6c['error']['message']);}logger[_0xaddf('0xf')](_0xaddf('0x11'),_0x35a7cb,_0xb40a6c[_0xaddf('0xf')][_0xaddf('0x12')]);return _0x11523b(_0xb40a6c[_0xaddf('0xf')][_0xaddf('0x12')]);}else{logger[_0xaddf('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x35a7cb,_0xaddf('0xc'));_0x11523b(_0xb40a6c[_0xaddf('0x13')][_0xaddf('0x12')]);}})['catch'](function(_0x1138e8){logger[_0xaddf('0xf')](_0xaddf('0x11'),_0x35a7cb,_0x1138e8);_0x553a36(_0x1138e8);});});}exports[_0xaddf('0x14')]=function(_0x388110){var _0x48b1b1=this;return new Promise(function(_0x2179e9,_0x3ec004){return db['OpenchannelApplication'][_0xaddf('0x15')](_0x388110[_0xaddf('0x16')],{'raw':_0x388110[_0xaddf('0x17')]?_0x388110[_0xaddf('0x17')][_0xaddf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x388110[_0xaddf('0x17')]?_0x388110[_0xaddf('0x17')][_0xaddf('0x19')]||null:null,'attributes':_0x388110[_0xaddf('0x17')]?_0x388110[_0xaddf('0x17')][_0xaddf('0x1a')]||null:null,'limit':_0x388110[_0xaddf('0x17')]?_0x388110['options'][_0xaddf('0x1b')]||null:null})[_0xaddf('0xa')](function(_0x48d27d){logger[_0xaddf('0xb')](_0xaddf('0x14'),_0x388110);logger['debug'](_0xaddf('0x14'),_0x388110,JSON[_0xaddf('0xe')](_0x48d27d));_0x2179e9(_0x48d27d);})[_0xaddf('0x1c')](function(_0x15800f){logger[_0xaddf('0xf')](_0xaddf('0x14'),_0x15800f[_0xaddf('0x12')],_0x388110);_0x3ec004(_0x48b1b1[_0xaddf('0xf')](0x1f4,_0x15800f[_0xaddf('0x12')]));});});}; \ No newline at end of file +var _0xa362=['attributes','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw'];(function(_0x208d56,_0x5070d7){var _0x3af91a=function(_0x217325){while(--_0x217325){_0x208d56['push'](_0x208d56['shift']());}};_0x3af91a(++_0x5070d7);}(_0xa362,0x16b));var _0x2a36=function(_0x311992,_0x5bd73f){_0x311992=_0x311992-0x0;var _0x562bd6=_0xa362[_0x311992];return _0x562bd6;};'use strict';var _=require(_0x2a36('0x0'));var util=require(_0x2a36('0x1'));var moment=require(_0x2a36('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a36('0x3'));var fs=require('fs');var Redis=require(_0x2a36('0x4'));var db=require(_0x2a36('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a36('0x6'))(_0x2a36('0x7'));var config=require('../../config/environment');var jayson=require(_0x2a36('0x8'));var client=jayson['client'][_0x2a36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34f5b3,_0x25a80f,_0x9e60ca){return new BPromise(function(_0x1de70a,_0x5bafee){return client[_0x2a36('0xa')](_0x34f5b3,_0x9e60ca)[_0x2a36('0xb')](function(_0x3e2f08){logger[_0x2a36('0xc')](_0x2a36('0xd'),_0x25a80f,_0x2a36('0xe'));logger['debug'](_0x2a36('0xf'),_0x25a80f,_0x2a36('0xe'),JSON[_0x2a36('0x10')](_0x3e2f08));if(_0x3e2f08[_0x2a36('0x11')]){if(_0x3e2f08[_0x2a36('0x11')]['code']===0x1f4){logger[_0x2a36('0x11')](_0x2a36('0xd'),_0x25a80f,_0x3e2f08[_0x2a36('0x11')][_0x2a36('0x12')]);return _0x5bafee(_0x3e2f08[_0x2a36('0x11')][_0x2a36('0x12')]);}logger[_0x2a36('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x25a80f,_0x3e2f08[_0x2a36('0x11')]['message']);return _0x1de70a(_0x3e2f08[_0x2a36('0x11')][_0x2a36('0x12')]);}else{logger[_0x2a36('0xc')](_0x2a36('0xd'),_0x25a80f,_0x2a36('0xe'));_0x1de70a(_0x3e2f08[_0x2a36('0x13')][_0x2a36('0x12')]);}})[_0x2a36('0x14')](function(_0x12342c){logger[_0x2a36('0x11')](_0x2a36('0xd'),_0x25a80f,_0x12342c);_0x5bafee(_0x12342c);});});}exports[_0x2a36('0x15')]=function(_0x1ffd57){var _0x51e83f=this;return new Promise(function(_0x4a3803,_0x53f778){return db[_0x2a36('0x16')][_0x2a36('0x17')](_0x1ffd57[_0x2a36('0x18')],{'raw':_0x1ffd57[_0x2a36('0x19')]?_0x1ffd57[_0x2a36('0x19')][_0x2a36('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ffd57[_0x2a36('0x19')]?_0x1ffd57['options']['where']||null:null,'attributes':_0x1ffd57[_0x2a36('0x19')]?_0x1ffd57['options'][_0x2a36('0x1b')]||null:null,'limit':_0x1ffd57[_0x2a36('0x19')]?_0x1ffd57[_0x2a36('0x19')][_0x2a36('0x1c')]||null:null})[_0x2a36('0xb')](function(_0x5a89eb){logger[_0x2a36('0xc')](_0x2a36('0x15'),_0x1ffd57);logger[_0x2a36('0x1d')](_0x2a36('0x15'),_0x1ffd57,JSON[_0x2a36('0x10')](_0x5a89eb));_0x4a3803(_0x5a89eb);})[_0x2a36('0x14')](function(_0x44fe41){logger[_0x2a36('0x11')](_0x2a36('0x15'),_0x44fe41['message'],_0x1ffd57);_0x53f778(_0x51e83f['error'](0x1f4,_0x44fe41[_0x2a36('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 59fb063..ec3bdba 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 _0x9d1e=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','describe','/:id','/:id/messages','get','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0x9d1e,0x90));var _0xe9d1=function(_0x29e23a,_0x3c4e12){_0x29e23a=_0x29e23a-0x0;var _0x4caac4=_0x9d1e[_0x29e23a];return _0x4caac4;};'use strict';var multer=require(_0xe9d1('0x0'));var util=require(_0xe9d1('0x1'));var path=require(_0xe9d1('0x2'));var timeout=require(_0xe9d1('0x3'));var express=require(_0xe9d1('0x4'));var router=express[_0xe9d1('0x5')]();var fs_extra=require(_0xe9d1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe9d1('0x7'));var config=require(_0xe9d1('0x8'));var controller=require(_0xe9d1('0x9'));router['get']('/',auth[_0xe9d1('0xa')](),controller[_0xe9d1('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe9d1('0xc')]);router['get'](_0xe9d1('0xd'),auth[_0xe9d1('0xa')](),controller['show']);router['get'](_0xe9d1('0xe'),auth[_0xe9d1('0xa')](),controller['getMessages']);router[_0xe9d1('0xf')]('/:id/download',auth[_0xe9d1('0xa')](),controller[_0xe9d1('0x10')]);router[_0xe9d1('0x11')]('/',auth[_0xe9d1('0xa')](),controller[_0xe9d1('0x12')]);router[_0xe9d1('0x11')]('/:id/messages',auth[_0xe9d1('0xa')](),controller[_0xe9d1('0x13')]);router[_0xe9d1('0x11')](_0xe9d1('0x14'),auth[_0xe9d1('0xa')](),interaction[_0xe9d1('0x15')](_0xe9d1('0x16'),_0xe9d1('0x17')),controller['addTags']);router[_0xe9d1('0x18')]('/:id',auth[_0xe9d1('0xa')](),interaction[_0xe9d1('0x15')](_0xe9d1('0x16'),_0xe9d1('0x19')),controller[_0xe9d1('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xe9d1('0x16'),'openchannelinteraction:destroy'),controller[_0xe9d1('0x1b')]);router[_0xe9d1('0x1c')]('/:id/tags',auth[_0xe9d1('0xa')](),controller[_0xe9d1('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x282f=['/describe','describe','/:id','show','getMessages','/:id/download','create','/:id/messages','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x282f,0x105));var _0xf282=function(_0x4fafe7,_0x20f9bf){_0x4fafe7=_0x4fafe7-0x0;var _0x69b7a9=_0x282f[_0x4fafe7];return _0x69b7a9;};'use strict';var multer=require(_0xf282('0x0'));var util=require(_0xf282('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf282('0x2'));var router=express['Router']();var fs_extra=require(_0xf282('0x3'));var auth=require(_0xf282('0x4'));var interaction=require(_0xf282('0x5'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xf282('0x6')]('/',auth[_0xf282('0x7')](),controller[_0xf282('0x8')]);router[_0xf282('0x6')](_0xf282('0x9'),auth[_0xf282('0x7')](),controller[_0xf282('0xa')]);router[_0xf282('0x6')](_0xf282('0xb'),auth[_0xf282('0x7')](),controller[_0xf282('0xc')]);router[_0xf282('0x6')]('/:id/messages',auth[_0xf282('0x7')](),controller[_0xf282('0xd')]);router[_0xf282('0x6')](_0xf282('0xe'),auth[_0xf282('0x7')](),controller['download']);router['post']('/',auth[_0xf282('0x7')](),controller[_0xf282('0xf')]);router['post'](_0xf282('0x10'),auth[_0xf282('0x7')](),controller[_0xf282('0x11')]);router[_0xf282('0x12')](_0xf282('0x13'),auth[_0xf282('0x7')](),interaction[_0xf282('0x14')](_0xf282('0x15'),_0xf282('0x16')),controller[_0xf282('0x17')]);router['put']('/:id',auth[_0xf282('0x7')](),interaction[_0xf282('0x14')](_0xf282('0x15'),_0xf282('0x18')),controller[_0xf282('0x19')]);router[_0xf282('0x1a')](_0xf282('0xb'),auth[_0xf282('0x7')](),interaction[_0xf282('0x14')](_0xf282('0x15'),_0xf282('0x1b')),controller[_0xf282('0x1c')]);router[_0xf282('0x1a')](_0xf282('0x13'),auth[_0xf282('0x7')](),controller['removeTags']);module[_0xf282('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 490fa94..e648670 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 _0xeb0d=['out','sequelize','STRING','DATE','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x24e0e2,_0x2974c1){_0x24e0e2=_0x24e0e2-0x0;var _0x29b63e=_0xeb0d[_0x24e0e2];return _0x29b63e;};'use strict';var Sequelize=require(_0xdeb0('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xdeb0('0x1')]},'secondDisposition':{'type':Sequelize[_0xdeb0('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdeb0('0x1')]},'read1stAt':{'type':Sequelize[_0xdeb0('0x2')]},'threadId':{'type':Sequelize[_0xdeb0('0x1')]},'externalUrl':{'type':Sequelize[_0xdeb0('0x1')]},'lastMsgAt':{'type':Sequelize[_0xdeb0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xdeb0('0x3')]('in',_0xdeb0('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xdeb0('0x1')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3e74=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x159990,_0x3a8ad8){_0x159990=_0x159990-0x0;var _0x2bf511=_0x3e74[_0x159990];return _0x2bf511;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'closed':{'type':Sequelize[_0x43e7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x43e7('0x2')]},'disposition':{'type':Sequelize[_0x43e7('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x43e7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x43e7('0x3')]},'externalUrl':{'type':Sequelize[_0x43e7('0x3')]},'lastMsgAt':{'type':Sequelize[_0x43e7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x43e7('0x4')]('in',_0x43e7('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x43e7('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3ed3141..7f365dd 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 _0x1517=['threadId','Public','Private','basename','existsSync','pipe','createWriteStream','System','out','secret','renderFile','views','.pdf','err','rimraf','zip-dir','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','OpenchannelInteraction','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','select','field','color','u.id','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$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?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','type','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','count','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','rawAttributes','include','options','create','destroy','OpenchannelMessage','addMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','Contact','firstName','lastName','Attachment','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x1517,0xf4));var _0x7151=function(_0x498c73,_0x371b2b){_0x498c73=_0x498c73-0x0;var _0x51720a=_0x1517[_0x498c73];return _0x51720a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7151('0x0'));var zipdir=require(_0x7151('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7151('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7151('0x3'));var path=require(_0x7151('0x4'));var sox=require('sox');var csv=require(_0x7151('0x5'));var ejs=require(_0x7151('0x6'));var fs=require('fs');var fs_extra=require(_0x7151('0x7'));var _=require(_0x7151('0x8'));var squel=require('squel');var crypto=require(_0x7151('0x9'));var jsforce=require(_0x7151('0xa'));var deskjs=require(_0x7151('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7151('0xc'));var Papa=require(_0x7151('0xd'));var Redis=require(_0x7151('0xe'));var authService=require(_0x7151('0xf'));var qs=require(_0x7151('0x10'));var as=require(_0x7151('0x11'));var pdf=require(_0x7151('0x12'));var hardwareService=require(_0x7151('0x13'));var logger=require('../../config/logger')(_0x7151('0x14'));var utils=require('../../config/utils');var config=require(_0x7151('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7151('0x16')]=_[_0x7151('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7151('0x18'))[_0x7151('0x19')](socket);function respondWithStatusCode(_0x181d66,_0x1ed474){_0x1ed474=_0x1ed474||0xcc;return function(_0x43eb9f){if(_0x43eb9f){return _0x181d66[_0x7151('0x1a')](_0x1ed474);}return _0x181d66[_0x7151('0x1b')](_0x1ed474)['end']();};}function respondWithResult(_0x228136,_0x1c49b3){_0x1c49b3=_0x1c49b3||0xc8;return function(_0x52f048){if(_0x52f048){return _0x228136[_0x7151('0x1b')](_0x1c49b3)['json'](_0x52f048);}};}function respondWithFilteredResult(_0x12ed02,_0x41e913){return function(_0x2d91ed){if(_0x2d91ed){var _0x5b85ad=typeof _0x41e913['offset']===_0x7151('0x1c')&&typeof _0x41e913[_0x7151('0x1d')]===_0x7151('0x1c');var _0x2528d9=_0x2d91ed['count'];var _0x31bd04=_0x5b85ad?0x0:_0x41e913[_0x7151('0x1e')];var _0x5c9825=_0x5b85ad?_0x2d91ed['count']:_0x41e913[_0x7151('0x1e')]+_0x41e913[_0x7151('0x1d')];var _0x413247;if(_0x5c9825>=_0x2528d9){_0x5c9825=_0x2528d9;_0x413247=0xc8;}else{_0x413247=0xce;}_0x12ed02[_0x7151('0x1b')](_0x413247);return _0x12ed02[_0x7151('0x1f')](_0x7151('0x20'),_0x31bd04+'-'+_0x5c9825+'/'+_0x2528d9)[_0x7151('0x21')](_0x2d91ed);}return null;};}function patchUpdates(_0xb33caf){return function(_0x46a935){try{jsonpatch[_0x7151('0x22')](_0x46a935,_0xb33caf,!![]);}catch(_0x2e3238){return BPromise[_0x7151('0x23')](_0x2e3238);}return _0x46a935[_0x7151('0x24')]();};}function saveUpdates(_0x26aea2,_0x4804ae){return function(_0xa509a6){if(_0xa509a6){return _0xa509a6[_0x7151('0x25')](_0x26aea2)[_0x7151('0x26')](function(_0x6b147e){return _0x6b147e;});}return null;};}function removeEntity(_0x3f009f,_0x4b8ebd){return function(_0x3ae8a3){if(_0x3ae8a3){return _0x3ae8a3['destroy']()[_0x7151('0x26')](function(){_0x3f009f[_0x7151('0x1b')](0xcc)[_0x7151('0x27')]();});}};}function handleEntityNotFound(_0x25f4de,_0x2ca94c){return function(_0x234513){if(!_0x234513){_0x25f4de['sendStatus'](0x194);}return _0x234513;};}function handleError(_0x29c0d7,_0x19b75b){_0x19b75b=_0x19b75b||0x1f4;return function(_0x54fa7a){logger[_0x7151('0x28')](_0x54fa7a['stack']);if(_0x54fa7a[_0x7151('0x29')]){delete _0x54fa7a[_0x7151('0x29')];}_0x29c0d7['status'](_0x19b75b)[_0x7151('0x2a')](_0x54fa7a);};}function getInteractionUsers(_0x4bbe6a,_0xc018cc){return new BPromise(function(_0xa0dea1,_0x2cb6fb){try{if(_0xc018cc[_0x4bbe6a['id']]){_0x4bbe6a[_0x7151('0x2b')]=_['map'](_0xc018cc[_0x4bbe6a['id']],function(_0x3d454f){return{'id':_0x3d454f['id'],'fullname':_0x3d454f[_0x7151('0x2c')]};});}}catch(_0x304d8e){_0x2cb6fb(_0x304d8e);}_0xa0dea1(_0x4bbe6a);});}function getInteractionTags(_0xb99413,_0x973eae){return new BPromise(function(_0x49c9e2,_0x139073){try{if(_0xb99413[_0x7151('0x2d')]){_0xb99413[_0x7151('0x2e')]=[];_0xb99413[_0x7151('0x2d')][_0x7151('0x2f')](',')[_0x7151('0x30')](function(_0x3b0984){_0xb99413[_0x7151('0x2e')][_0x7151('0x31')](_0x973eae[_0x3b0984]);});}delete _0xb99413['TagIds'];}catch(_0x2f22aa){_0x139073(_0x2f22aa);}_0x49c9e2(_0xb99413);});}function updateOpenchannelInteraction(_0x450f67,_0x278417,_0x1d3efa){return new BPromise(function(_0x434ef9,_0x36268b){return getInteractionUsers(_0x450f67,_0x1d3efa)[_0x7151('0x26')](function(_0x2511a5){return getInteractionTags(_0x2511a5,_0x278417);})[_0x7151('0x26')](function(_0x146ed5){_0x434ef9(_0x146ed5);})[_0x7151('0x32')](function(_0x33001c){_0x36268b(_0x33001c);});});}exports['index']=function(_0x5b87cd,_0x3ad41a){var _0x50798e={},_0x7a2298={},_0x446c4a={'count':0x0,'rows':[]};var _0x1ba393=_[_0x7151('0x33')](db[_0x7151('0x34')]['rawAttributes'],function(_0x1b0bbc){return{'name':_0x1b0bbc[_0x7151('0x35')],'type':_0x1b0bbc['type'][_0x7151('0x36')]};});_0x7a2298[_0x7151('0x37')]=_[_0x7151('0x33')](_0x1ba393,_0x7151('0x29'));_0x7a2298[_0x7151('0x38')]=_[_0x7151('0x39')](_0x5b87cd[_0x7151('0x38')]);_0x7a2298[_0x7151('0x3a')]=_[_0x7151('0x3b')](_0x7a2298['model'],_0x7a2298[_0x7151('0x38')]);_0x50798e[_0x7151('0x3c')]=_[_0x7151('0x3b')](_0x7a2298[_0x7151('0x37')],qs['fields'](_0x5b87cd[_0x7151('0x38')][_0x7151('0x3d')]));_0x50798e[_0x7151('0x3c')]=_0x50798e[_0x7151('0x3c')][_0x7151('0x3e')]?_0x50798e[_0x7151('0x3c')]:_0x7a2298[_0x7151('0x37')];if(!_0x5b87cd['query'][_0x7151('0x3f')]('nolimit')){_0x50798e[_0x7151('0x1d')]=qs[_0x7151('0x1d')](_0x5b87cd['query']['limit']);_0x50798e['offset']=qs['offset'](_0x5b87cd['query']['offset']);}_0x50798e['order']=qs[_0x7151('0x40')](_0x5b87cd['query'][_0x7151('0x40')]);_0x50798e[_0x7151('0x41')]=qs[_0x7151('0x3a')](_[_0x7151('0x42')](_0x5b87cd[_0x7151('0x38')],_0x7a2298[_0x7151('0x3a')]),_0x1ba393);var _0x462286=[];var _0x56a605=squel[_0x7151('0x43')]()[_0x7151('0x44')]('id')[_0x7151('0x44')]('name')[_0x7151('0x44')](_0x7151('0x45'))['from']('tools_tags');var _0x639aaf=squel['select']()[_0x7151('0x44')](_0x7151('0x46'))[_0x7151('0x44')]('u.fullname')['field'](_0x7151('0x47'))[_0x7151('0x48')](_0x7151('0x49'),'ui')[_0x7151('0x4a')]('users','u',_0x7151('0x4b'));var _0x4289c9=squel[_0x7151('0x43')]()[_0x7151('0x48')]('openchannel_interactions','i')[_0x7151('0x4a')](_0x7151('0x4c'),'c',_0x7151('0x4d'))[_0x7151('0x4a')](_0x7151('0x4e'),'o',_0x7151('0x4f'))[_0x7151('0x4a')]('openchannel_accounts','a',_0x7151('0x50'))[_0x7151('0x4a')]('openchannel_messages','me',_0x7151('0x51'))[_0x7151('0x4a')]('openchannel_interaction_has_tags','it',_0x7151('0x52'))[_0x7151('0x4a')](_0x7151('0x53'),'t',_0x7151('0x54'));var _0x306898=squel['expr']();var _0x38a3d9=[];var _0xd68e16=squel[_0x7151('0x55')]();var _0x20b34c;if(_0x5b87cd[_0x7151('0x38')][_0x7151('0x56')]){_0x20b34c=as['parseSearch'](_0x5b87cd[_0x7151('0x38')][_0x7151('0x56')]);var _0xaa89eb=_0x20b34c[_0x7151('0x57')];for(var _0x32d9dc=0x0;_0x32d9dc<_0x20b34c[_0x7151('0x58')][_0x7151('0x3e')];_0x32d9dc++){var _0x1d3fc0=_0x20b34c[_0x7151('0x58')][_0x32d9dc];var _0x5a290e='i';var _0x177853=_[_0x7151('0x59')](_0x1ba393,[_0x7151('0x29'),_0x1d3fc0[_0x7151('0x44')]]);if(!_0x177853){switch(_0x1d3fc0['field']){case _0x7151('0x5a'):if(_0x1d3fc0[_0x7151('0x5b')]==0x1){_0x4289c9[_0x7151('0x5c')]('`'+_0x1d3fc0['field']+_0x7151('0x5d'));}else{_0x4289c9[_0x7151('0x5c')]('`'+_0x1d3fc0[_0x7151('0x44')]+_0x7151('0x5e'));}break;case'Contact':if(_0x1d3fc0['operator']===_0x7151('0x5f')){if(_0x1d3fc0[_0x7151('0x5b')][_0x7151('0x2f')]('\x20')[_0x7151('0x3e')]>0x1){_0x306898[_0xaa89eb](_0x7151('0x60'),qs[_0x7151('0x61')](_0x1d3fc0['value']),null);}else{var _0x14403d='%'+_0x1d3fc0[_0x7151('0x5b')]+'%';_0x306898[_0xaa89eb](_0x7151('0x62'),_0x14403d,_0x14403d,_0x14403d);}}else{_0x177853=_['find'](_0x1ba393,['name',_0x7151('0x63')]);_0x1d3fc0[_0x7151('0x44')]='ContactId';_0x2ef24d=as[_0x7151('0x64')](_0x5a290e,_0x177853['type'],_0x1d3fc0);_0x306898[_0xaa89eb](_0x2ef24d[_0x7151('0x65')],_0x2ef24d[_0x7151('0x5b')][_0x7151('0x66')],_0x2ef24d[_0x7151('0x5b')][_0x7151('0x27')]);}break;case _0x7151('0x67'):var _0x5eca0c=_0x1d3fc0[_0x7151('0x5b')]['split'](',')['map'](function(_0x1e717d){return Number(_0x1e717d);});_0x5eca0c['forEach'](function(_0x53276b){_0xd68e16['or'](_0x7151('0x68'),'%,'+_0x53276b+',%');});_0x38a3d9=_['union'](_0x38a3d9,_0x5eca0c);break;case _0x7151('0x69'):if(_0x1d3fc0['operator']==='$substring'){_0x306898[_0xaa89eb](_0x7151('0x6a'),'%'+_0x1d3fc0[_0x7151('0x5b')]+'%',null);}else{_0x177853=_[_0x7151('0x59')](_0x1ba393,[_0x7151('0x29'),_0x7151('0x6b')]);_0x1d3fc0[_0x7151('0x44')]=_0x7151('0x6b');_0x2ef24d=as[_0x7151('0x64')](_0x5a290e,_0x177853['type'],_0x1d3fc0);_0x306898[_0xaa89eb](_0x2ef24d[_0x7151('0x65')],_0x2ef24d[_0x7151('0x5b')][_0x7151('0x66')],_0x2ef24d[_0x7151('0x5b')]['end']);}break;case _0x7151('0x6c'):_0x2ef24d=as['buildExpression']('me',null,_0x1d3fc0);_0x306898[_0xaa89eb](_0x2ef24d['text'],_0x2ef24d[_0x7151('0x5b')][_0x7151('0x66')],_0x2ef24d[_0x7151('0x5b')][_0x7151('0x27')]);break;}}else{var _0x2ef24d=as[_0x7151('0x64')](_0x5a290e,_0x177853[_0x7151('0x6d')],_0x1d3fc0);_0x306898[_0xaa89eb](_0x2ef24d[_0x7151('0x65')],_0x2ef24d[_0x7151('0x5b')][_0x7151('0x66')],_0x2ef24d['value'][_0x7151('0x27')]);}}}else{var _0x7a68b5=_(_0x5b87cd[_0x7151('0x38')])[_0x7151('0x39')]()[_0x7151('0x33')](function(_0x460212){return _['some'](_0x1ba393,[_0x7151('0x29'),_0x460212])?_0x460212:undefined;})[_0x7151('0x6e')]()[_0x7151('0x5b')]();if(!_[_0x7151('0x6f')](_0x7a68b5)){_0x7a68b5[_0x7151('0x30')](function(_0x408d49){if(_0x408d49===_0x7151('0x70')){_0x4289c9[_0x7151('0x41')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x7151('0x71')](_0x5b87cd[_0x7151('0x38')][_0x408d49]));}else if(_0x408d49===_0x7151('0x72')){var _0x183d31=JSON[_0x7151('0x73')](_0x5b87cd['query'][_0x408d49])[_0x7151('0x74')];var _0x371ddb=JSON[_0x7151('0x73')](_0x5b87cd[_0x7151('0x38')][_0x408d49])['$lte'];_0x4289c9[_0x7151('0x41')](_0x7151('0x75'),_0x183d31,_0x371ddb);}else{if(_0x5b87cd[_0x7151('0x38')][_0x408d49]===_0x7151('0x76')){_0x4289c9[_0x7151('0x41')]('i.'+_0x408d49+_0x7151('0x77'));}else{_0x4289c9[_0x7151('0x41')]('i.'+_0x408d49+_0x7151('0x78'),_0x5b87cd[_0x7151('0x38')][_0x408d49]);}}});}if(_0x5b87cd[_0x7151('0x38')][_0x7151('0x79')]){if(_0x5b87cd[_0x7151('0x38')][_0x7151('0x79')]==0x1){_0x4289c9[_0x7151('0x5c')](_0x7151('0x7a'));}else{_0x4289c9[_0x7151('0x5c')](_0x7151('0x7b'));}}if(_0x5b87cd['query'][_0x7151('0x7c')]){_0x38a3d9=_[_0x7151('0x7d')](_0x5b87cd[_0x7151('0x38')][_0x7151('0x7c')])?_0x5b87cd['query'][_0x7151('0x7c')]:new Array(_0x5b87cd[_0x7151('0x38')]['tag']);_0x38a3d9['forEach'](function(_0x4273e4){_0xd68e16['or'](_0x7151('0x68'),'%,'+_0x4273e4+',%');});}if(_0x5b87cd[_0x7151('0x38')]['filter']){var _0x3f644f=_0x5b87cd[_0x7151('0x38')][_0x7151('0x7e')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3f644f)){_0x306898['or'](_0x7151('0x7f'),_0x3f644f+'%');}else{_0x306898['or'](_0x7151('0x80'),qs[_0x7151('0x61')](_0x3f644f))['or']('i.from\x20LIKE\x20?',_0x3f644f+'%')['or'](_0x7151('0x81'),_0x3f644f+'%');}}}_0x4289c9[_0x7151('0x41')](_0x306898);_0x4289c9[_0x7151('0x82')]('i.id');var _0x3e988a={'type':db[_0x7151('0x83')][_0x7151('0x84')][_0x7151('0x85')],'raw':!![]};var _0x3949cd=_0x4289c9['clone']();_0x3949cd['field'](_0x7151('0x86'));_0x3949cd['field'](_0x7151('0x87'),_0x7151('0x5a'));if(_0x50798e['order']){_0x50798e[_0x7151('0x88')]['forEach'](function(_0x49d2c0){var _0x2dd96e=_0x49d2c0[0x0]==='contactName'?_0x49d2c0[0x0]:'i.'+_0x49d2c0[0x0];_0x4289c9[_0x7151('0x88')](_0x2dd96e,_0x49d2c0[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7151('0x6f')](_0x38a3d9)){_0x4289c9[_0x7151('0x5c')](_0xd68e16);_0x3949cd[_0x7151('0x41')]('t.id\x20IN\x20?',_0x38a3d9);}BPromise[_0x7151('0x89')]()[_0x7151('0x26')](function(){if(!_0x20b34c){if(_0x5b87cd[_0x7151('0x38')][_0x7151('0x70')])return;_0x3949cd['where'](_0x7151('0x8a'));_0x4289c9['where'](_0x7151('0x8a'));return;}if(_0x5b87cd[_0x7151('0x8b')][_0x7151('0x8c')]!==_0x7151('0x8d'))return;return _0x5b87cd[_0x7151('0x8b')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x7151('0x26')](function(_0x387b79){if(_['isEmpty'](_0x387b79)){_0x3949cd[_0x7151('0x41')](_0x7151('0x8e'));_0x4289c9[_0x7151('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x3949cd[_0x7151('0x41')](_0x7151('0x8f'),_[_0x7151('0x33')](_0x387b79,'id'));_0x4289c9['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x7151('0x33')](_0x387b79,'id'));}});})[_0x7151('0x26')](function(){if(_0x5b87cd[_0x7151('0x8b')][_0x7151('0x8c')]===_0x7151('0x8d')&&!_0x20b34c&&!_0x5b87cd[_0x7151('0x38')]['OpenchannelAccountId'])return[];return db['sequelize']['query'](_0x3949cd[_0x7151('0x90')](),_0x3e988a);})[_0x7151('0x26')](function(_0x53bd67){_0x446c4a[_0x7151('0x91')]=_0x53bd67['length'];if(_0x446c4a['count']===0x0)return[];return db[_0x7151('0x92')][_0x7151('0x38')](_0x56a605[_0x7151('0x90')](),_0x3e988a)['then'](function(_0x46a17a){_0x462286=_[_0x7151('0x93')](_0x46a17a,'id');_0x3e988a=_[_0x7151('0x94')](_0x3e988a,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b87cd[_0x7151('0x38')]['fields']){_0x50798e[_0x7151('0x3c')]['forEach'](function(_0x5d9c1d){_0x4289c9['field']('i.'+_0x5d9c1d);});}else{_0x4289c9[_0x7151('0x44')](_0x7151('0x87'),_0x7151('0x5a'));_0x4289c9[_0x7151('0x44')](_0x7151('0x95'),_0x7151('0x96'));_0x4289c9[_0x7151('0x44')](_0x7151('0x97'),_0x7151('0x98'));_0x4289c9[_0x7151('0x44')]('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',_0x7151('0x99'));_0x4289c9[_0x7151('0x44')](_0x7151('0x9a'));_0x4289c9[_0x7151('0x44')]('c.firstName',_0x7151('0x9b'));_0x4289c9[_0x7151('0x44')](_0x7151('0x9c'),_0x7151('0x9d'));_0x4289c9['field'](_0x7151('0x9e'),_0x7151('0x9f'));_0x4289c9[_0x7151('0x44')](_0x7151('0xa0'),_0x7151('0xa1'));_0x4289c9[_0x7151('0x44')](_0x7151('0xa2'),_0x7151('0xa3'));_0x4289c9[_0x7151('0x44')](_0x7151('0xa4'),'Contact.fax');_0x4289c9['field'](_0x7151('0xa5'),'Owner.fullname');_0x4289c9[_0x7151('0x44')](_0x7151('0xa6'),_0x7151('0xa7'));_0x4289c9[_0x7151('0x44')](_0x7151('0xa8'),'TagIds');}if(_0x50798e[_0x7151('0x1d')])_0x4289c9[_0x7151('0x1d')](_0x50798e[_0x7151('0x1d')]);if(_0x50798e[_0x7151('0x1e')])_0x4289c9[_0x7151('0x1e')](_0x50798e[_0x7151('0x1e')]);return db['sequelize'][_0x7151('0x38')](_0x4289c9[_0x7151('0x90')](),_0x3e988a);})[_0x7151('0x26')](function(_0x57e814){if(_0x57e814[_0x7151('0x3e')]>0x0)_0x639aaf[_0x7151('0x41')](_0x7151('0xa9'),_[_0x7151('0x33')](_0x57e814,'id'));return db[_0x7151('0x92')][_0x7151('0x38')](_0x639aaf[_0x7151('0x90')](),_0x3e988a)[_0x7151('0x26')](function(_0x7af8d5){var _0x143e2c=_[_0x7151('0xaa')](_0x7af8d5,_0x7151('0xab'));var _0x471d8b=[];_0x57e814[_0x7151('0x30')](function(_0x4b10a2){_0x471d8b[_0x7151('0x31')](updateOpenchannelInteraction(_0x4b10a2,_0x462286,_0x143e2c));});return BPromise[_0x7151('0xac')](_0x471d8b);});});})[_0x7151('0x26')](function(_0x219b6a){_0x446c4a['rows']=_0x219b6a;return _0x446c4a;})[_0x7151('0x26')](respondWithFilteredResult(_0x3ad41a,_0x50798e))[_0x7151('0x32')](handleError(_0x3ad41a,null));};exports['show']=function(_0xbdf848,_0x1201a6){var _0x5f3da1={};if(_0xbdf848[_0x7151('0x38')]['type']&&_0xbdf848[_0x7151('0x38')][_0x7151('0x6d')]===_0x7151('0x48')){_0x5f3da1[_0x7151('0x48')]=_0xbdf848['params']['id'];}else{_0x5f3da1['id']=_0xbdf848[_0x7151('0xad')]['id'];}var _0x5de2a8={'raw':![],'where':_0x5f3da1},_0x2ffac6={};_0x2ffac6[_0x7151('0x37')]=_[_0x7151('0x39')](db[_0x7151('0x34')][_0x7151('0xae')]);_0x2ffac6['query']=_[_0x7151('0x39')](_0xbdf848['query']);_0x2ffac6[_0x7151('0x3a')]=_[_0x7151('0x3b')](_0x2ffac6[_0x7151('0x37')],_0x2ffac6[_0x7151('0x38')]);_0x5de2a8['attributes']=_[_0x7151('0x3b')](_0x2ffac6['model'],qs[_0x7151('0x3d')](_0xbdf848[_0x7151('0x38')]['fields']));_0x5de2a8['attributes']=_0x5de2a8[_0x7151('0x3c')][_0x7151('0x3e')]?_0x5de2a8['attributes']:_0x2ffac6[_0x7151('0x37')];if(_0xbdf848[_0x7151('0x38')]['includeAll']){_0x5de2a8[_0x7151('0xaf')]=[{'all':!![]}];}_0x5de2a8=_[_0x7151('0x94')]({},_0x5de2a8,_0xbdf848[_0x7151('0xb0')]);return db[_0x7151('0x34')][_0x7151('0x59')](_0x5de2a8)['then'](handleEntityNotFound(_0x1201a6,null))['then'](respondWithResult(_0x1201a6,null))[_0x7151('0x32')](handleError(_0x1201a6,null));};exports[_0x7151('0xb1')]=function(_0x4a8b98,_0x53161c){return db['OpenchannelInteraction']['create'](_0x4a8b98[_0x7151('0x6c')],{})[_0x7151('0x26')](respondWithResult(_0x53161c,0xc9))[_0x7151('0x32')](handleError(_0x53161c,null));};exports[_0x7151('0x25')]=function(_0x17a9c9,_0x3c0d12){if(_0x17a9c9[_0x7151('0x6c')]['id']){delete _0x17a9c9[_0x7151('0x6c')]['id'];}return db[_0x7151('0x34')][_0x7151('0x59')]({'where':{'id':_0x17a9c9['params']['id']}})[_0x7151('0x26')](handleEntityNotFound(_0x3c0d12,null))[_0x7151('0x26')](saveUpdates(_0x17a9c9['body'],null))[_0x7151('0x26')](respondWithResult(_0x3c0d12,null))[_0x7151('0x32')](handleError(_0x3c0d12,null));};exports[_0x7151('0xb2')]=function(_0x26fc39,_0x3ac4a6){return db[_0x7151('0x34')][_0x7151('0x59')]({'where':{'id':_0x26fc39[_0x7151('0xad')]['id']}})[_0x7151('0x26')](handleEntityNotFound(_0x3ac4a6,null))[_0x7151('0x26')](removeEntity(_0x3ac4a6,null))[_0x7151('0x32')](handleError(_0x3ac4a6,null));};exports['describe']=function(_0x221565,_0x249d39){return db['OpenchannelInteraction']['describe']()[_0x7151('0x26')](respondWithResult(_0x249d39,null))[_0x7151('0x32')](handleError(_0x249d39,null));};exports['addMessage']=function(_0x51d0b6,_0x5c6f55,_0x535fe6){return db[_0x7151('0xb3')][_0x7151('0x59')]({'where':{'id':_0x51d0b6[_0x7151('0xad')]['id']}})[_0x7151('0x26')](handleEntityNotFound(_0x5c6f55,null))[_0x7151('0x26')](function(_0x554988){if(_0x554988){return _0x554988[_0x7151('0xb4')](_0x51d0b6[_0x7151('0x6c')][_0x7151('0xb5')],_['omit'](_0x51d0b6['body'],[_0x7151('0xb5'),'id'])||{});}})[_0x7151('0x26')](respondWithResult(_0x5c6f55,null))['catch'](handleError(_0x5c6f55,null));};exports[_0x7151('0xb6')]=function(_0x31b432,_0x5c2513,_0x5efa9c){var _0x421ee0={'raw':![],'where':{}};var _0x115ee7={};var _0x11c093={'count':0x0,'rows':[]};return db[_0x7151('0x34')][_0x7151('0xb7')]({'where':{'id':_0x31b432[_0x7151('0xad')]['id']}})[_0x7151('0x26')](handleEntityNotFound(_0x5c2513,null))[_0x7151('0x26')](function(_0x441aca){if(_0x441aca){_0x115ee7['model']=_[_0x7151('0x39')](db[_0x7151('0xb3')][_0x7151('0xae')]);_0x115ee7[_0x7151('0x38')]=_[_0x7151('0x39')](_0x31b432[_0x7151('0x38')]);_0x115ee7[_0x7151('0x3a')]=_['intersection'](_0x115ee7[_0x7151('0x37')],_0x115ee7[_0x7151('0x38')]);_0x421ee0[_0x7151('0x3c')]=_[_0x7151('0x3b')](_0x115ee7[_0x7151('0x37')],qs[_0x7151('0x3d')](_0x31b432[_0x7151('0x38')][_0x7151('0x3d')]));_0x421ee0['attributes']=_0x421ee0['attributes'][_0x7151('0x3e')]?_0x421ee0[_0x7151('0x3c')]:_0x115ee7['model'];if(!_0x31b432[_0x7151('0x38')][_0x7151('0x3f')]('nolimit')){_0x421ee0[_0x7151('0x1d')]=qs[_0x7151('0x1d')](_0x31b432[_0x7151('0x38')][_0x7151('0x1d')]);_0x421ee0[_0x7151('0x1e')]=qs[_0x7151('0x1e')](_0x31b432[_0x7151('0x38')][_0x7151('0x1e')]);}_0x421ee0[_0x7151('0x88')]=qs[_0x7151('0x40')](_0x31b432['query'][_0x7151('0x40')]);_0x421ee0[_0x7151('0x41')]=qs['filters'](_[_0x7151('0x42')](_0x31b432[_0x7151('0x38')],_0x115ee7[_0x7151('0x3a')]));_0x421ee0[_0x7151('0x41')][_0x7151('0xab')]=_0x441aca['id'];if(_0x31b432['query'][_0x7151('0x7e')]){_0x421ee0['where']=_[_0x7151('0x94')](_0x421ee0[_0x7151('0x41')],{'$or':_[_0x7151('0x33')](_0x421ee0['attributes'],function(_0x1385d2){var _0x2d8078={};_0x2d8078[_0x1385d2]={'$like':'%'+_0x31b432['query'][_0x7151('0x7e')]+'%'};return _0x2d8078;})});}if(_0x31b432[_0x7151('0x38')][_0x7151('0x74')]){var _0x522b70=_0x31b432[_0x7151('0x38')][_0x7151('0x74')][_0x7151('0x2f')](',');var _0x317451={};_0x317451[_0x522b70[0x0]]={'$gte':moment(_0x522b70[0x1])[_0x7151('0xb8')](_0x7151('0xb9'))};_0x421ee0['where']=_[_0x7151('0x94')](_0x421ee0[_0x7151('0x41')],_0x317451);}_0x421ee0=_[_0x7151('0x94')]({},_0x421ee0,_0x31b432[_0x7151('0xb0')]);return db[_0x7151('0xb3')][_0x7151('0x91')]({'where':_0x421ee0['where']})[_0x7151('0x26')](function(_0x2edaf7){_0x11c093[_0x7151('0x91')]=_0x2edaf7;if(_0x31b432[_0x7151('0x38')][_0x7151('0xba')]){_0x421ee0[_0x7151('0xaf')]=[{'all':!![]}];}return db[_0x7151('0xb3')][_0x7151('0xbb')](_0x421ee0);})[_0x7151('0x26')](function(_0x1ea708){_0x11c093[_0x7151('0xbc')]=_0x1ea708;return _0x11c093;});}})[_0x7151('0x26')](respondWithFilteredResult(_0x5c2513,_0x421ee0))[_0x7151('0x32')](handleError(_0x5c2513,null));};exports[_0x7151('0xbd')]=function(_0x5aa9e8,_0x3f8d95,_0x102b1e){return db[_0x7151('0x34')][_0x7151('0x59')]({'where':{'id':_0x5aa9e8[_0x7151('0xad')]['id']}})['then'](handleEntityNotFound(_0x3f8d95,null))[_0x7151('0x26')](function(_0x1d3f15){if(_0x1d3f15){return _0x1d3f15[_0x7151('0xbe')](_0x5aa9e8[_0x7151('0x6c')]['ids'],_[_0x7151('0xbf')](_0x5aa9e8['body'],[_0x7151('0xb5'),'id'])||{})[_0x7151('0xc0')](function(){return db[_0x7151('0x67')][_0x7151('0xbb')]({'attributes':['id',_0x7151('0x29'),_0x7151('0x45')],'where':{'id':_0x5aa9e8[_0x7151('0x6c')][_0x7151('0xb5')]}});})[_0x7151('0x26')](function(_0x12a65a){socket[_0x7151('0xc1')](_0x7151('0xc2'),{'id':Number(_0x5aa9e8[_0x7151('0xad')]['id']),'tags':_0x12a65a||[]});return{'id':Number(_0x5aa9e8[_0x7151('0xad')]['id']),'tags':_0x12a65a||[]};});}})[_0x7151('0x26')](respondWithResult(_0x3f8d95,null))[_0x7151('0x32')](handleError(_0x3f8d95,null));};exports[_0x7151('0xc3')]=function(_0x46b9d2,_0x46fbc9,_0x47e2ba){return db[_0x7151('0x34')][_0x7151('0x59')]({'where':{'id':_0x46b9d2[_0x7151('0xad')]['id']}})['then'](handleEntityNotFound(_0x46fbc9,null))[_0x7151('0x26')](function(_0x1c6186){if(_0x1c6186){return _0x1c6186[_0x7151('0xc3')](_0x46b9d2[_0x7151('0x38')]['ids']);}})[_0x7151('0x26')](respondWithStatusCode(_0x46fbc9,null))[_0x7151('0x32')](handleError(_0x46fbc9,null));};exports[_0x7151('0xc4')]=function(_0x5bfb54,_0x1d16e0){var _0x32a65c=moment()['unix']()[_0x7151('0x90')]();var _0xfd99f1=path[_0x7151('0xc5')](config[_0x7151('0xc6')],_0x7151('0xc7'),_0x7151('0xc8'),_0x7151('0xc9'));var _0x1aa305=path[_0x7151('0xc5')](config['root'],_0x7151('0xc7'),'files',_0x7151('0xca'));var _0xf6f1f9=path[_0x7151('0xc5')](_0xfd99f1,_0x32a65c);var _0x40c236=util[_0x7151('0xb8')]('transcript-%d-%s.zip',_0x5bfb54[_0x7151('0xad')]['id'],_0x32a65c);var _0x4da10d=path[_0x7151('0xc5')](_0xfd99f1,_0x40c236);var _0x2d8ec4=[];_0x2d8ec4[_0x7151('0x31')]({'model':db[_0x7151('0x69')],'as':_0x7151('0x69'),'attributes':['id',_0x7151('0x2c')],'raw':!![]});_0x2d8ec4[_0x7151('0x31')]({'model':db['CmContact'],'as':_0x7151('0xcb'),'attributes':['id',_0x7151('0xcc'),_0x7151('0xcd')],'raw':!![]});if(_0x5bfb54[_0x7151('0x38')][_0x7151('0xca')]){_0x2d8ec4[_0x7151('0x31')]({'model':db[_0x7151('0xce')],'as':_0x7151('0xce'),'raw':!![]});}var _0x8d5691=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x7151('0x6c'),_0x7151('0x72'),_0x7151('0xcf'),'secret',_0x7151('0x79')],'include':_0x2d8ec4}];_0x8d5691['push']({'model':db[_0x7151('0xd0')],'as':_0x7151('0xd1'),'attributes':['id',_0x7151('0x29')]});_0x8d5691['push']({'model':db['User'],'as':_0x7151('0xd2'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x7151('0x59')]({'where':{'id':_0x5bfb54[_0x7151('0xad')]['id']},'include':_0x8d5691})[_0x7151('0x26')](handleEntityNotFound(_0x1d16e0,null))[_0x7151('0x26')](function(_0x6a47ac){if(_0x6a47ac){var _0x4c8a25=_0x6a47ac[_0x7151('0xd3')]({'plain':!![]});fs[_0x7151('0xd4')](_0xf6f1f9);var _0x1aea2c={'channel':_0x7151('0xd5'),'account':_0x4c8a25[_0x7151('0xd1')]['name'],'agent':_0x4c8a25[_0x7151('0xd2')]?_0x4c8a25[_0x7151('0xd2')]['fullname']:_0x7151('0xd6'),'createdAt':moment(_0x4c8a25[_0x7151('0x72')])['format'](_0x7151('0xb9'))[_0x7151('0x90')](),'closedAt':_0x4c8a25['closed']?moment(_0x4c8a25[_0x7151('0xd7')])[_0x7151('0xb8')](_0x7151('0xb9'))[_0x7151('0x90')]():'','disposition':_0x4c8a25['disposition'],'visibility':_0x4c8a25[_0x7151('0xd8')]?_0x7151('0xd9'):_0x7151('0xda'),'messages':_(_0x4c8a25['Messages'])[_0x7151('0x7e')]({'secret':![]})[_0x7151('0x33')](function(_0x231f10){if(_0x231f10[_0x7151('0xce')]){var _0x1e3aca=path[_0x7151('0xc5')](_0x1aa305,_0x231f10[_0x7151('0xce')][_0x7151('0xdb')]);if(fs[_0x7151('0xdc')](_0x1e3aca)){fs['createReadStream'](_0x1e3aca)[_0x7151('0xdd')](fs[_0x7151('0xde')](path['join'](_0xf6f1f9,_0x231f10[_0x7151('0xce')][_0x7151('0xdb')])));}}return{'date':moment(_0x231f10[_0x7151('0x72')])[_0x7151('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7151('0x90')](),'sender':_0x231f10['direction']==='out'?_0x231f10[_0x7151('0x69')]?_0x231f10[_0x7151('0x69')][_0x7151('0x2c')]:_0x7151('0xdf'):_0x231f10[_0x7151('0xcb')][_0x7151('0xcc')]+(_0x231f10[_0x7151('0xcb')][_0x7151('0xcd')]?'\x20'+_0x231f10[_0x7151('0xcb')][_0x7151('0xcd')]:''),'body':_0x231f10[_0x7151('0xce')]?_0x231f10[_0x7151('0xce')]['basename']:_0x231f10[_0x7151('0x6c')],'direction':_0x231f10[_0x7151('0xcf')]===_0x7151('0xe0')?'A':'C','secret':_0x231f10[_0x7151('0xe1')],'read':_0x231f10['read'],'attachment':_0x231f10[_0x7151('0xce')]};})[_0x7151('0x5b')]()};return ejs[_0x7151('0xe2')](path[_0x7151('0xc5')](config[_0x7151('0xc6')],_0x7151('0xc7'),_0x7151('0xe3'),'downloadInteraction.ejs'),{'interaction':_0x1aea2c})[_0x7151('0x26')](function(_0x386e96){var _0x1fb607=path[_0x7151('0xc5')](_0xf6f1f9,'transcript-'+_0x4c8a25['id']+'-'+_0x32a65c+_0x7151('0xe4'));var _0x49ed17={'path':_0x1fb607,'channel':_0x7151('0xd5'),'interactionId':_0x4c8a25['id']};return pdf['createPdfFromHTML'](_0x386e96,_0x49ed17);})[_0x7151('0x26')](function(){return new BPromise(function(_0x182de0,_0x4e7043){zipdir(_0xf6f1f9,{'saveTo':_0x4da10d},function(_0xd8c4a8,_0x3dbf52){if(_0xd8c4a8)return _0x4e7043(_0xd8c4a8);return _0x182de0(_0x3dbf52);});})[_0x7151('0x26')](function(){return new BPromise(function(_0xfbd613,_0x30a053){rimraf(_0xf6f1f9,function(_0x3cf8ca){if(_0x3cf8ca)_0x30a053(_0x3cf8ca);return _0xfbd613();});});})[_0x7151('0x26')](function(){return _0x1d16e0[_0x7151('0xc4')](_0x4da10d,_0x40c236,function(_0x3c7f83){if(_0x3c7f83){console['log'](_0x7151('0xe5'),_0x3c7f83);}else{fs['unlinkSync'](_0x4da10d);}});});});}else{return _0x1d16e0[_0x7151('0x1a')](0xc8);}})['catch'](handleError(_0x1d16e0,null));}; \ No newline at end of file +var _0x4353=['emit','removeTags','unix','join','root','files','tmp','server','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','secret','OpenchannelAccount','fullname','get','mkdirSync','Openchannel','Owner','closed','closedAt','threadId','Public','Private','basename','existsSync','pipe','out','System','renderFile','views','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','Users','TagIds','forEach','Tags','push','catch','index','rawAttributes','fieldName','type','key','model','map','query','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','split','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','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','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','OpenchannelInteraction','a.key','Account.key','a.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','contactName','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','params','keys','filters','intersection','include','options','describe','addMessage','ids','omit','getMessages','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x4353,0x10f));var _0x3435=function(_0x2fa145,_0xe42bf7){_0x2fa145=_0x2fa145-0x0;var _0x2db5c3=_0x4353[_0x2fa145];return _0x2db5c3;};'use strict';var emlformat=require(_0x3435('0x0'));var rimraf=require(_0x3435('0x1'));var zipdir=require(_0x3435('0x2'));var jsonpatch=require(_0x3435('0x3'));var rp=require(_0x3435('0x4'));var moment=require(_0x3435('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3435('0x6'));var path=require(_0x3435('0x7'));var sox=require(_0x3435('0x8'));var csv=require(_0x3435('0x9'));var ejs=require(_0x3435('0xa'));var fs=require('fs');var fs_extra=require(_0x3435('0xb'));var _=require(_0x3435('0xc'));var squel=require(_0x3435('0xd'));var crypto=require('crypto');var jsforce=require(_0x3435('0xe'));var deskjs=require(_0x3435('0xf'));var toCsv=require(_0x3435('0x9'));var querystring=require(_0x3435('0x10'));var Papa=require(_0x3435('0x11'));var Redis=require('ioredis');var authService=require(_0x3435('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3435('0x13'));var pdf=require(_0x3435('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3435('0x15'))(_0x3435('0x16'));var utils=require(_0x3435('0x17'));var config=require(_0x3435('0x18'));var licenseUtil=require(_0x3435('0x19'));var db=require(_0x3435('0x1a'))['db'];config['redis']=_[_0x3435('0x1b')](config[_0x3435('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x3435('0x1d'))(new Redis(config['redis']));require(_0x3435('0x1e'))['register'](socket);function respondWithStatusCode(_0x2a5562,_0x192bc7){_0x192bc7=_0x192bc7||0xcc;return function(_0x2619e6){if(_0x2619e6){return _0x2a5562[_0x3435('0x1f')](_0x192bc7);}return _0x2a5562[_0x3435('0x20')](_0x192bc7)[_0x3435('0x21')]();};}function respondWithResult(_0x5eb809,_0x1f1b38){_0x1f1b38=_0x1f1b38||0xc8;return function(_0x4098ad){if(_0x4098ad){return _0x5eb809[_0x3435('0x20')](_0x1f1b38)['json'](_0x4098ad);}};}function respondWithFilteredResult(_0x7b33bd,_0x189312){return function(_0x45f93f){if(_0x45f93f){var _0x222bfa=typeof _0x189312[_0x3435('0x22')]===_0x3435('0x23')&&typeof _0x189312[_0x3435('0x24')]==='undefined';var _0x51c162=_0x45f93f[_0x3435('0x25')];var _0x5a9dc0=_0x222bfa?0x0:_0x189312['offset'];var _0x2543ec=_0x222bfa?_0x45f93f['count']:_0x189312[_0x3435('0x22')]+_0x189312[_0x3435('0x24')];var _0x209bb0;if(_0x2543ec>=_0x51c162){_0x2543ec=_0x51c162;_0x209bb0=0xc8;}else{_0x209bb0=0xce;}_0x7b33bd[_0x3435('0x20')](_0x209bb0);return _0x7b33bd[_0x3435('0x26')]('Content-Range',_0x5a9dc0+'-'+_0x2543ec+'/'+_0x51c162)[_0x3435('0x27')](_0x45f93f);}return null;};}function patchUpdates(_0x323302){return function(_0x2448e5){try{jsonpatch[_0x3435('0x28')](_0x2448e5,_0x323302,!![]);}catch(_0x196c26){return BPromise[_0x3435('0x29')](_0x196c26);}return _0x2448e5[_0x3435('0x2a')]();};}function saveUpdates(_0x5dbd38,_0x5af6bc){return function(_0x4361b8){if(_0x4361b8){return _0x4361b8[_0x3435('0x2b')](_0x5dbd38)[_0x3435('0x2c')](function(_0x3cf28c){return _0x3cf28c;});}return null;};}function removeEntity(_0x2399e2,_0x36aeb7){return function(_0x412644){if(_0x412644){return _0x412644[_0x3435('0x2d')]()[_0x3435('0x2c')](function(){_0x2399e2[_0x3435('0x20')](0xcc)[_0x3435('0x21')]();});}};}function handleEntityNotFound(_0x4a25c8,_0x7a2cd){return function(_0x157a6b){if(!_0x157a6b){_0x4a25c8['sendStatus'](0x194);}return _0x157a6b;};}function handleError(_0x188c86,_0x3d0af8){_0x3d0af8=_0x3d0af8||0x1f4;return function(_0x1a100d){logger[_0x3435('0x2e')](_0x1a100d[_0x3435('0x2f')]);if(_0x1a100d[_0x3435('0x30')]){delete _0x1a100d[_0x3435('0x30')];}_0x188c86[_0x3435('0x20')](_0x3d0af8)['send'](_0x1a100d);};}function getInteractionUsers(_0x1e5df4,_0x3d2173){return new BPromise(function(_0x338a40,_0x51e9d6){try{if(_0x3d2173[_0x1e5df4['id']]){_0x1e5df4[_0x3435('0x31')]=_['map'](_0x3d2173[_0x1e5df4['id']],function(_0x5d730c){return{'id':_0x5d730c['id'],'fullname':_0x5d730c['fullname']};});}}catch(_0x3420c8){_0x51e9d6(_0x3420c8);}_0x338a40(_0x1e5df4);});}function getInteractionTags(_0x240314,_0x593184){return new BPromise(function(_0x2ec7c4,_0x472d62){try{if(_0x240314[_0x3435('0x32')]){_0x240314['Tags']=[];_0x240314[_0x3435('0x32')]['split'](',')[_0x3435('0x33')](function(_0x2efa7d){_0x240314[_0x3435('0x34')][_0x3435('0x35')](_0x593184[_0x2efa7d]);});}delete _0x240314['TagIds'];}catch(_0x1b8463){_0x472d62(_0x1b8463);}_0x2ec7c4(_0x240314);});}function updateOpenchannelInteraction(_0x1578c6,_0xd41ebf,_0x5598ba){return new BPromise(function(_0x37a0f2,_0x4e5153){return getInteractionUsers(_0x1578c6,_0x5598ba)[_0x3435('0x2c')](function(_0x5b5242){return getInteractionTags(_0x5b5242,_0xd41ebf);})[_0x3435('0x2c')](function(_0x13be11){_0x37a0f2(_0x13be11);})[_0x3435('0x36')](function(_0x163c19){_0x4e5153(_0x163c19);});});}exports[_0x3435('0x37')]=function(_0x2f9c06,_0x26131f){var _0x23c17e={},_0x34e556={},_0x48db4e={'count':0x0,'rows':[]};var _0x5235da=_['map'](db['OpenchannelInteraction'][_0x3435('0x38')],function(_0x36dbeb){return{'name':_0x36dbeb[_0x3435('0x39')],'type':_0x36dbeb[_0x3435('0x3a')][_0x3435('0x3b')]};});_0x34e556[_0x3435('0x3c')]=_[_0x3435('0x3d')](_0x5235da,_0x3435('0x30'));_0x34e556['query']=_['keys'](_0x2f9c06['query']);_0x34e556['filters']=_['intersection'](_0x34e556['model'],_0x34e556[_0x3435('0x3e')]);_0x23c17e[_0x3435('0x3f')]=_['intersection'](_0x34e556[_0x3435('0x3c')],qs['fields'](_0x2f9c06[_0x3435('0x3e')][_0x3435('0x40')]));_0x23c17e[_0x3435('0x3f')]=_0x23c17e['attributes'][_0x3435('0x41')]?_0x23c17e[_0x3435('0x3f')]:_0x34e556[_0x3435('0x3c')];if(!_0x2f9c06[_0x3435('0x3e')]['hasOwnProperty'](_0x3435('0x42'))){_0x23c17e['limit']=qs[_0x3435('0x24')](_0x2f9c06[_0x3435('0x3e')][_0x3435('0x24')]);_0x23c17e[_0x3435('0x22')]=qs[_0x3435('0x22')](_0x2f9c06[_0x3435('0x3e')]['offset']);}_0x23c17e[_0x3435('0x43')]=qs[_0x3435('0x44')](_0x2f9c06[_0x3435('0x3e')][_0x3435('0x44')]);_0x23c17e[_0x3435('0x45')]=qs['filters'](_[_0x3435('0x46')](_0x2f9c06['query'],_0x34e556['filters']),_0x5235da);var _0x3540f9=[];var _0x434cab=squel[_0x3435('0x47')]()[_0x3435('0x48')]('id')[_0x3435('0x48')](_0x3435('0x30'))[_0x3435('0x48')](_0x3435('0x49'))[_0x3435('0x4a')](_0x3435('0x4b'));var _0x28d11a=squel[_0x3435('0x47')]()[_0x3435('0x48')]('u.id')['field']('u.fullname')[_0x3435('0x48')](_0x3435('0x4c'))[_0x3435('0x4a')](_0x3435('0x4d'),'ui')[_0x3435('0x4e')](_0x3435('0x4f'),'u',_0x3435('0x50'));var _0x271020=squel[_0x3435('0x47')]()[_0x3435('0x4a')](_0x3435('0x51'),'i')['left_join'](_0x3435('0x52'),'c',_0x3435('0x53'))[_0x3435('0x4e')](_0x3435('0x4f'),'o',_0x3435('0x54'))[_0x3435('0x4e')](_0x3435('0x55'),'a',_0x3435('0x56'))[_0x3435('0x4e')](_0x3435('0x57'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x3435('0x4e')](_0x3435('0x58'),'it',_0x3435('0x59'))[_0x3435('0x4e')](_0x3435('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x4ab6cc=squel[_0x3435('0x5a')]();var _0x3ba412=[];var _0x5acb64=squel[_0x3435('0x5a')]();var _0x585a61;if(_0x2f9c06[_0x3435('0x3e')]['search']){_0x585a61=as[_0x3435('0x5b')](_0x2f9c06[_0x3435('0x3e')][_0x3435('0x5c')]);var _0x2f054f=_0x585a61['sqlOperator'];for(var _0xcf4f0=0x0;_0xcf4f0<_0x585a61[_0x3435('0x5d')][_0x3435('0x41')];_0xcf4f0++){var _0x13d655=_0x585a61[_0x3435('0x5d')][_0xcf4f0];var _0x3d0cd9='i';var _0x481c7f=_[_0x3435('0x5e')](_0x5235da,[_0x3435('0x30'),_0x13d655['field']]);if(!_0x481c7f){switch(_0x13d655[_0x3435('0x48')]){case _0x3435('0x5f'):if(_0x13d655[_0x3435('0x60')]==0x1){_0x271020['having']('`'+_0x13d655[_0x3435('0x48')]+_0x3435('0x61'));}else{_0x271020[_0x3435('0x62')]('`'+_0x13d655[_0x3435('0x48')]+_0x3435('0x63'));}break;case'Contact':if(_0x13d655[_0x3435('0x64')]===_0x3435('0x65')){if(_0x13d655[_0x3435('0x60')][_0x3435('0x66')]('\x20')[_0x3435('0x41')]>0x1){_0x4ab6cc[_0x2f054f](_0x3435('0x67'),qs[_0x3435('0x68')](_0x13d655['value']),null);}else{var _0x33ec41='%'+_0x13d655[_0x3435('0x60')]+'%';_0x4ab6cc[_0x2f054f](_0x3435('0x69'),_0x33ec41,_0x33ec41,_0x33ec41);}}else{_0x481c7f=_[_0x3435('0x5e')](_0x5235da,[_0x3435('0x30'),_0x3435('0x6a')]);_0x13d655[_0x3435('0x48')]=_0x3435('0x6a');_0x12804e=as[_0x3435('0x6b')](_0x3d0cd9,_0x481c7f[_0x3435('0x3a')],_0x13d655);_0x4ab6cc[_0x2f054f](_0x12804e[_0x3435('0x6c')],_0x12804e['value'][_0x3435('0x6d')],_0x12804e[_0x3435('0x60')]['end']);}break;case'Tag':var _0x449d2f=_0x13d655['value'][_0x3435('0x66')](',')[_0x3435('0x3d')](function(_0x166ae0){return Number(_0x166ae0);});_0x449d2f[_0x3435('0x33')](function(_0x2bbec1){_0x5acb64['or'](_0x3435('0x6e'),'%,'+_0x2bbec1+',%');});_0x3ba412=_[_0x3435('0x6f')](_0x3ba412,_0x449d2f);break;case _0x3435('0x70'):if(_0x13d655['operator']===_0x3435('0x65')){_0x4ab6cc[_0x2f054f](_0x3435('0x71'),'%'+_0x13d655[_0x3435('0x60')]+'%',null);}else{_0x481c7f=_[_0x3435('0x5e')](_0x5235da,[_0x3435('0x30'),_0x3435('0x72')]);_0x13d655[_0x3435('0x48')]='UserId';_0x12804e=as[_0x3435('0x6b')](_0x3d0cd9,_0x481c7f[_0x3435('0x3a')],_0x13d655);_0x4ab6cc[_0x2f054f](_0x12804e[_0x3435('0x6c')],_0x12804e['value']['start'],_0x12804e[_0x3435('0x60')][_0x3435('0x21')]);}break;case _0x3435('0x73'):_0x12804e=as['buildExpression']('me',null,_0x13d655);_0x4ab6cc[_0x2f054f](_0x12804e[_0x3435('0x6c')],_0x12804e[_0x3435('0x60')][_0x3435('0x6d')],_0x12804e[_0x3435('0x60')][_0x3435('0x21')]);break;}}else{var _0x12804e=as[_0x3435('0x6b')](_0x3d0cd9,_0x481c7f[_0x3435('0x3a')],_0x13d655);_0x4ab6cc[_0x2f054f](_0x12804e['text'],_0x12804e[_0x3435('0x60')][_0x3435('0x6d')],_0x12804e[_0x3435('0x60')][_0x3435('0x21')]);}}}else{var _0x5e8c4b=_(_0x2f9c06['query'])['keys']()[_0x3435('0x3d')](function(_0x22b4c9){return _[_0x3435('0x74')](_0x5235da,['name',_0x22b4c9])?_0x22b4c9:undefined;})[_0x3435('0x75')]()[_0x3435('0x60')]();if(!_[_0x3435('0x76')](_0x5e8c4b)){_0x5e8c4b[_0x3435('0x33')](function(_0x2b5d8e){if(_0x2b5d8e==='OpenchannelAccountId'){_0x271020[_0x3435('0x45')](_0x3435('0x77'),[][_0x3435('0x78')](_0x2f9c06[_0x3435('0x3e')][_0x2b5d8e]));}else if(_0x2b5d8e===_0x3435('0x79')){var _0x1021d5=JSON[_0x3435('0x7a')](_0x2f9c06['query'][_0x2b5d8e])[_0x3435('0x7b')];var _0x2215f0=JSON[_0x3435('0x7a')](_0x2f9c06[_0x3435('0x3e')][_0x2b5d8e])['$lte'];_0x271020['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1021d5,_0x2215f0);}else{if(_0x2f9c06[_0x3435('0x3e')][_0x2b5d8e]==='null'){_0x271020[_0x3435('0x45')]('i.'+_0x2b5d8e+_0x3435('0x7c'));}else{_0x271020['where']('i.'+_0x2b5d8e+'\x20=\x20?',_0x2f9c06[_0x3435('0x3e')][_0x2b5d8e]);}}});}if(_0x2f9c06[_0x3435('0x3e')][_0x3435('0x7d')]){if(_0x2f9c06[_0x3435('0x3e')][_0x3435('0x7d')]==0x1){_0x271020[_0x3435('0x62')](_0x3435('0x7e'));}else{_0x271020[_0x3435('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x2f9c06[_0x3435('0x3e')][_0x3435('0x7f')]){_0x3ba412=_['isArray'](_0x2f9c06[_0x3435('0x3e')][_0x3435('0x7f')])?_0x2f9c06['query'][_0x3435('0x7f')]:new Array(_0x2f9c06['query']['tag']);_0x3ba412['forEach'](function(_0x4ab8fa){_0x5acb64['or'](_0x3435('0x6e'),'%,'+_0x4ab8fa+',%');});}if(_0x2f9c06[_0x3435('0x3e')][_0x3435('0x80')]){var _0x591a16=_0x2f9c06[_0x3435('0x3e')][_0x3435('0x80')]['replace']('\x5c','\x5c\x5c')[_0x3435('0x81')](/'/g,'\x27\x27');if(qs[_0x3435('0x82')](_0x591a16)){_0x4ab6cc['or'](_0x3435('0x83'),_0x591a16+'%');}else{_0x4ab6cc['or'](_0x3435('0x84'),qs[_0x3435('0x68')](_0x591a16))['or'](_0x3435('0x85'),_0x591a16+'%')['or'](_0x3435('0x86'),_0x591a16+'%');}}}_0x271020[_0x3435('0x45')](_0x4ab6cc);_0x271020['group'](_0x3435('0x87'));var _0x339904={'type':db[_0x3435('0x88')][_0x3435('0x89')][_0x3435('0x8a')],'raw':!![]};var _0x15698c=_0x271020[_0x3435('0x8b')]();_0x15698c[_0x3435('0x48')](_0x3435('0x87'));_0x15698c['field'](_0x3435('0x8c'),_0x3435('0x5f'));if(_0x23c17e['order']){_0x23c17e['order'][_0x3435('0x33')](function(_0x32adfc){var _0x5dbf05=_0x32adfc[0x0]==='contactName'?_0x32adfc[0x0]:'i.'+_0x32adfc[0x0];_0x271020[_0x3435('0x43')](_0x5dbf05,_0x32adfc[0x1]===_0x3435('0x8d')?![]:!![]);});}if(!_[_0x3435('0x76')](_0x3ba412)){_0x271020[_0x3435('0x62')](_0x5acb64);_0x15698c[_0x3435('0x45')](_0x3435('0x8e'),_0x3ba412);}BPromise['resolve']()['then'](function(){if(!_0x585a61){if(_0x2f9c06['query'][_0x3435('0x8f')])return;_0x15698c[_0x3435('0x45')](_0x3435('0x90'));_0x271020[_0x3435('0x45')](_0x3435('0x90'));return;}if(_0x2f9c06['user'][_0x3435('0x91')]!==_0x3435('0x92'))return;return _0x2f9c06['user'][_0x3435('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x54957a){if(_[_0x3435('0x76')](_0x54957a)){_0x15698c[_0x3435('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x271020['where'](_0x3435('0x94'));}else{_0x15698c[_0x3435('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x3435('0x3d')](_0x54957a,'id'));_0x271020[_0x3435('0x45')](_0x3435('0x77'),_[_0x3435('0x3d')](_0x54957a,'id'));}});})[_0x3435('0x2c')](function(){if(_0x2f9c06[_0x3435('0x95')][_0x3435('0x91')]===_0x3435('0x92')&&!_0x585a61&&!_0x2f9c06['query'][_0x3435('0x8f')])return[];return db[_0x3435('0x96')]['query'](_0x15698c[_0x3435('0x97')](),_0x339904);})[_0x3435('0x2c')](function(_0x4d6766){_0x48db4e[_0x3435('0x25')]=_0x4d6766['length'];if(_0x48db4e[_0x3435('0x25')]===0x0)return[];return db['sequelize'][_0x3435('0x3e')](_0x434cab[_0x3435('0x97')](),_0x339904)['then'](function(_0x3f4575){_0x3540f9=_[_0x3435('0x98')](_0x3f4575,'id');_0x339904=_[_0x3435('0x99')](_0x339904,{'model':db[_0x3435('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f9c06[_0x3435('0x3e')][_0x3435('0x40')]){_0x23c17e[_0x3435('0x3f')][_0x3435('0x33')](function(_0x162c92){_0x271020[_0x3435('0x48')]('i.'+_0x162c92);});}else{_0x271020['field'](_0x3435('0x8c'),_0x3435('0x5f'));_0x271020[_0x3435('0x48')](_0x3435('0x9b'),_0x3435('0x9c'));_0x271020[_0x3435('0x48')](_0x3435('0x9d'),'Account.mandatoryDisposition');_0x271020[_0x3435('0x48')](_0x3435('0x9e'),_0x3435('0x9f'));_0x271020['field'](_0x3435('0xa0'));_0x271020[_0x3435('0x48')]('c.firstName','Contact.firstName');_0x271020[_0x3435('0x48')](_0x3435('0xa1'),_0x3435('0xa2'));_0x271020[_0x3435('0x48')](_0x3435('0xa3'),_0x3435('0xa4'));_0x271020[_0x3435('0x48')](_0x3435('0xa5'),_0x3435('0xa6'));_0x271020[_0x3435('0x48')](_0x3435('0xa7'),_0x3435('0xa8'));_0x271020['field']('c.fax',_0x3435('0xa9'));_0x271020[_0x3435('0x48')](_0x3435('0xaa'),'Owner.fullname');_0x271020[_0x3435('0x48')]('o.internal',_0x3435('0xab'));_0x271020[_0x3435('0x48')](_0x3435('0xac'),_0x3435('0x32'));}if(_0x23c17e[_0x3435('0x24')])_0x271020[_0x3435('0x24')](_0x23c17e[_0x3435('0x24')]);if(_0x23c17e[_0x3435('0x22')])_0x271020[_0x3435('0x22')](_0x23c17e[_0x3435('0x22')]);return db[_0x3435('0x96')][_0x3435('0x3e')](_0x271020[_0x3435('0x97')](),_0x339904);})['then'](function(_0x54df10){if(_0x54df10[_0x3435('0x41')]>0x0)_0x28d11a[_0x3435('0x45')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x3435('0x3d')](_0x54df10,'id'));return db[_0x3435('0x96')]['query'](_0x28d11a[_0x3435('0x97')](),_0x339904)[_0x3435('0x2c')](function(_0x4e291a){var _0x4f7d0c=_[_0x3435('0xad')](_0x4e291a,_0x3435('0xae'));var _0x15bda4=[];_0x54df10['forEach'](function(_0x6c03a8){_0x15bda4['push'](updateOpenchannelInteraction(_0x6c03a8,_0x3540f9,_0x4f7d0c));});return BPromise[_0x3435('0xaf')](_0x15bda4);});});})[_0x3435('0x2c')](function(_0x3ba42d){_0x48db4e[_0x3435('0xb0')]=_0x3ba42d;return _0x48db4e;})['then'](respondWithFilteredResult(_0x26131f,_0x23c17e))[_0x3435('0x36')](handleError(_0x26131f,null));};exports['show']=function(_0x2fc552,_0x1cbf35){var _0x4dd014={};if(_0x2fc552[_0x3435('0x3e')][_0x3435('0x3a')]&&_0x2fc552[_0x3435('0x3e')][_0x3435('0x3a')]===_0x3435('0x4a')){_0x4dd014[_0x3435('0x4a')]=_0x2fc552[_0x3435('0xb1')]['id'];}else{_0x4dd014['id']=_0x2fc552[_0x3435('0xb1')]['id'];}var _0xad6ebf={'raw':![],'where':_0x4dd014},_0xf9ec21={};_0xf9ec21['model']=_['keys'](db[_0x3435('0x9a')][_0x3435('0x38')]);_0xf9ec21[_0x3435('0x3e')]=_[_0x3435('0xb2')](_0x2fc552[_0x3435('0x3e')]);_0xf9ec21[_0x3435('0xb3')]=_[_0x3435('0xb4')](_0xf9ec21[_0x3435('0x3c')],_0xf9ec21[_0x3435('0x3e')]);_0xad6ebf[_0x3435('0x3f')]=_['intersection'](_0xf9ec21[_0x3435('0x3c')],qs[_0x3435('0x40')](_0x2fc552[_0x3435('0x3e')]['fields']));_0xad6ebf[_0x3435('0x3f')]=_0xad6ebf[_0x3435('0x3f')][_0x3435('0x41')]?_0xad6ebf['attributes']:_0xf9ec21[_0x3435('0x3c')];if(_0x2fc552['query']['includeAll']){_0xad6ebf[_0x3435('0xb5')]=[{'all':!![]}];}_0xad6ebf=_[_0x3435('0x99')]({},_0xad6ebf,_0x2fc552[_0x3435('0xb6')]);return db[_0x3435('0x9a')]['find'](_0xad6ebf)[_0x3435('0x2c')](handleEntityNotFound(_0x1cbf35,null))[_0x3435('0x2c')](respondWithResult(_0x1cbf35,null))[_0x3435('0x36')](handleError(_0x1cbf35,null));};exports['create']=function(_0x301172,_0x41b415){return db[_0x3435('0x9a')]['create'](_0x301172[_0x3435('0x73')],{})['then'](respondWithResult(_0x41b415,0xc9))[_0x3435('0x36')](handleError(_0x41b415,null));};exports[_0x3435('0x2b')]=function(_0xd733e,_0x339e27){if(_0xd733e[_0x3435('0x73')]['id']){delete _0xd733e['body']['id'];}return db[_0x3435('0x9a')][_0x3435('0x5e')]({'where':{'id':_0xd733e[_0x3435('0xb1')]['id']}})[_0x3435('0x2c')](handleEntityNotFound(_0x339e27,null))[_0x3435('0x2c')](saveUpdates(_0xd733e[_0x3435('0x73')],null))[_0x3435('0x2c')](respondWithResult(_0x339e27,null))[_0x3435('0x36')](handleError(_0x339e27,null));};exports['destroy']=function(_0x13e8f2,_0x38410f){return db[_0x3435('0x9a')][_0x3435('0x5e')]({'where':{'id':_0x13e8f2['params']['id']}})[_0x3435('0x2c')](handleEntityNotFound(_0x38410f,null))[_0x3435('0x2c')](removeEntity(_0x38410f,null))['catch'](handleError(_0x38410f,null));};exports[_0x3435('0xb7')]=function(_0x4168ad,_0x50f06a){return db[_0x3435('0x9a')][_0x3435('0xb7')]()[_0x3435('0x2c')](respondWithResult(_0x50f06a,null))['catch'](handleError(_0x50f06a,null));};exports['addMessage']=function(_0x2bb186,_0x3f387e,_0x342e14){return db['OpenchannelMessage'][_0x3435('0x5e')]({'where':{'id':_0x2bb186['params']['id']}})['then'](handleEntityNotFound(_0x3f387e,null))[_0x3435('0x2c')](function(_0x20c51e){if(_0x20c51e){return _0x20c51e[_0x3435('0xb8')](_0x2bb186[_0x3435('0x73')][_0x3435('0xb9')],_[_0x3435('0xba')](_0x2bb186[_0x3435('0x73')],[_0x3435('0xb9'),'id'])||{});}})['then'](respondWithResult(_0x3f387e,null))[_0x3435('0x36')](handleError(_0x3f387e,null));};exports[_0x3435('0xbb')]=function(_0x201391,_0x1f8ce6,_0x4ef744){var _0xdd873e={'raw':![],'where':{}};var _0x420f47={};var _0x5ad6f2={'count':0x0,'rows':[]};return db[_0x3435('0x9a')]['findOne']({'where':{'id':_0x201391[_0x3435('0xb1')]['id']}})[_0x3435('0x2c')](handleEntityNotFound(_0x1f8ce6,null))[_0x3435('0x2c')](function(_0x13d396){if(_0x13d396){_0x420f47[_0x3435('0x3c')]=_['keys'](db[_0x3435('0xbc')][_0x3435('0x38')]);_0x420f47[_0x3435('0x3e')]=_['keys'](_0x201391['query']);_0x420f47[_0x3435('0xb3')]=_[_0x3435('0xb4')](_0x420f47['model'],_0x420f47['query']);_0xdd873e['attributes']=_['intersection'](_0x420f47[_0x3435('0x3c')],qs[_0x3435('0x40')](_0x201391[_0x3435('0x3e')][_0x3435('0x40')]));_0xdd873e[_0x3435('0x3f')]=_0xdd873e[_0x3435('0x3f')][_0x3435('0x41')]?_0xdd873e[_0x3435('0x3f')]:_0x420f47['model'];if(!_0x201391[_0x3435('0x3e')]['hasOwnProperty']('nolimit')){_0xdd873e['limit']=qs['limit'](_0x201391['query'][_0x3435('0x24')]);_0xdd873e['offset']=qs['offset'](_0x201391[_0x3435('0x3e')][_0x3435('0x22')]);}_0xdd873e[_0x3435('0x43')]=qs[_0x3435('0x44')](_0x201391[_0x3435('0x3e')][_0x3435('0x44')]);_0xdd873e[_0x3435('0x45')]=qs['filters'](_[_0x3435('0x46')](_0x201391[_0x3435('0x3e')],_0x420f47['filters']));_0xdd873e[_0x3435('0x45')][_0x3435('0xae')]=_0x13d396['id'];if(_0x201391[_0x3435('0x3e')][_0x3435('0x80')]){_0xdd873e[_0x3435('0x45')]=_['merge'](_0xdd873e['where'],{'$or':_[_0x3435('0x3d')](_0xdd873e[_0x3435('0x3f')],function(_0x55af48){var _0x2882be={};_0x2882be[_0x55af48]={'$like':'%'+_0x201391[_0x3435('0x3e')][_0x3435('0x80')]+'%'};return _0x2882be;})});}if(_0x201391[_0x3435('0x3e')][_0x3435('0x7b')]){var _0x1b459b=_0x201391[_0x3435('0x3e')][_0x3435('0x7b')]['split'](',');var _0x578655={};_0x578655[_0x1b459b[0x0]]={'$gte':moment(_0x1b459b[0x1])[_0x3435('0xbd')](_0x3435('0xbe'))};_0xdd873e[_0x3435('0x45')]=_[_0x3435('0x99')](_0xdd873e[_0x3435('0x45')],_0x578655);}_0xdd873e=_[_0x3435('0x99')]({},_0xdd873e,_0x201391['options']);return db[_0x3435('0xbc')]['count']({'where':_0xdd873e[_0x3435('0x45')]})[_0x3435('0x2c')](function(_0x1d90d4){_0x5ad6f2[_0x3435('0x25')]=_0x1d90d4;if(_0x201391[_0x3435('0x3e')]['includeAll']){_0xdd873e[_0x3435('0xb5')]=[{'all':!![]}];}return db[_0x3435('0xbc')]['findAll'](_0xdd873e);})[_0x3435('0x2c')](function(_0xeb439f){_0x5ad6f2[_0x3435('0xb0')]=_0xeb439f;return _0x5ad6f2;});}})[_0x3435('0x2c')](respondWithFilteredResult(_0x1f8ce6,_0xdd873e))[_0x3435('0x36')](handleError(_0x1f8ce6,null));};exports[_0x3435('0xbf')]=function(_0x181cc2,_0x28a72a,_0x1b792e){return db[_0x3435('0x9a')][_0x3435('0x5e')]({'where':{'id':_0x181cc2['params']['id']}})[_0x3435('0x2c')](handleEntityNotFound(_0x28a72a,null))['then'](function(_0x403e51){if(_0x403e51){return _0x403e51[_0x3435('0xc0')](_0x181cc2[_0x3435('0x73')][_0x3435('0xb9')],_[_0x3435('0xba')](_0x181cc2['body'],['ids','id'])||{})[_0x3435('0xc1')](function(){return db[_0x3435('0xc2')]['findAll']({'attributes':['id',_0x3435('0x30'),_0x3435('0x49')],'where':{'id':_0x181cc2[_0x3435('0x73')][_0x3435('0xb9')]}});})[_0x3435('0x2c')](function(_0x2913a4){socket[_0x3435('0xc3')]('openchannelInteractionTags:save',{'id':Number(_0x181cc2[_0x3435('0xb1')]['id']),'tags':_0x2913a4||[]});return{'id':Number(_0x181cc2[_0x3435('0xb1')]['id']),'tags':_0x2913a4||[]};});}})['then'](respondWithResult(_0x28a72a,null))[_0x3435('0x36')](handleError(_0x28a72a,null));};exports[_0x3435('0xc4')]=function(_0x167480,_0x4f0aba,_0x34a2a3){return db[_0x3435('0x9a')][_0x3435('0x5e')]({'where':{'id':_0x167480[_0x3435('0xb1')]['id']}})[_0x3435('0x2c')](handleEntityNotFound(_0x4f0aba,null))[_0x3435('0x2c')](function(_0x5702a3){if(_0x5702a3){return _0x5702a3[_0x3435('0xc4')](_0x167480[_0x3435('0x3e')][_0x3435('0xb9')]);}})['then'](respondWithStatusCode(_0x4f0aba,null))[_0x3435('0x36')](handleError(_0x4f0aba,null));};exports['download']=function(_0x555e69,_0x54bf08){var _0x3d235f=moment()[_0x3435('0xc5')]()[_0x3435('0x97')]();var _0x2f54df=path[_0x3435('0xc6')](config[_0x3435('0xc7')],'server',_0x3435('0xc8'),_0x3435('0xc9'));var _0x55826b=path['join'](config[_0x3435('0xc7')],_0x3435('0xca'),_0x3435('0xc8'),'attachments');var _0x4ea68b=path[_0x3435('0xc6')](_0x2f54df,_0x3d235f);var _0x3fe9e2=util[_0x3435('0xbd')]('transcript-%d-%s.zip',_0x555e69[_0x3435('0xb1')]['id'],_0x3d235f);var _0x55cdea=path['join'](_0x2f54df,_0x3fe9e2);var _0x8cc301=[];_0x8cc301[_0x3435('0x35')]({'model':db[_0x3435('0x70')],'as':_0x3435('0x70'),'attributes':['id','fullname'],'raw':!![]});_0x8cc301[_0x3435('0x35')]({'model':db[_0x3435('0xcb')],'as':_0x3435('0xcc'),'attributes':['id',_0x3435('0xcd'),_0x3435('0xce')],'raw':!![]});if(_0x555e69[_0x3435('0x3e')][_0x3435('0xcf')]){_0x8cc301[_0x3435('0x35')]({'model':db[_0x3435('0xd0')],'as':_0x3435('0xd0'),'raw':!![]});}var _0x1791c5=[{'model':db[_0x3435('0xbc')],'as':_0x3435('0xd1'),'attributes':['id',_0x3435('0x73'),_0x3435('0x79'),'direction',_0x3435('0xd2'),_0x3435('0x7d')],'include':_0x8cc301}];_0x1791c5[_0x3435('0x35')]({'model':db[_0x3435('0xd3')],'as':'Account','attributes':['id',_0x3435('0x30')]});_0x1791c5['push']({'model':db[_0x3435('0x70')],'as':'Owner','attributes':['id',_0x3435('0xd4')]});return db[_0x3435('0x9a')][_0x3435('0x5e')]({'where':{'id':_0x555e69['params']['id']},'include':_0x1791c5})['then'](handleEntityNotFound(_0x54bf08,null))[_0x3435('0x2c')](function(_0x1d1641){if(_0x1d1641){var _0x46f8e4=_0x1d1641[_0x3435('0xd5')]({'plain':!![]});fs[_0x3435('0xd6')](_0x4ea68b);var _0x3a01dc={'channel':_0x3435('0xd7'),'account':_0x46f8e4['Account'][_0x3435('0x30')],'agent':_0x46f8e4[_0x3435('0xd8')]?_0x46f8e4['Owner'][_0x3435('0xd4')]:'N.A.','createdAt':moment(_0x46f8e4[_0x3435('0x79')])['format'](_0x3435('0xbe'))[_0x3435('0x97')](),'closedAt':_0x46f8e4[_0x3435('0xd9')]?moment(_0x46f8e4[_0x3435('0xda')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x46f8e4['disposition'],'visibility':_0x46f8e4[_0x3435('0xdb')]?_0x3435('0xdc'):_0x3435('0xdd'),'messages':_(_0x46f8e4[_0x3435('0xd1')])[_0x3435('0x80')]({'secret':![]})[_0x3435('0x3d')](function(_0x16ae9f){if(_0x16ae9f[_0x3435('0xd0')]){var _0x283fbf=path[_0x3435('0xc6')](_0x55826b,_0x16ae9f[_0x3435('0xd0')][_0x3435('0xde')]);if(fs[_0x3435('0xdf')](_0x283fbf)){fs['createReadStream'](_0x283fbf)[_0x3435('0xe0')](fs['createWriteStream'](path[_0x3435('0xc6')](_0x4ea68b,_0x16ae9f[_0x3435('0xd0')][_0x3435('0xde')])));}}return{'date':moment(_0x16ae9f['createdAt'])['format'](_0x3435('0xbe'))[_0x3435('0x97')](),'sender':_0x16ae9f['direction']===_0x3435('0xe1')?_0x16ae9f[_0x3435('0x70')]?_0x16ae9f[_0x3435('0x70')][_0x3435('0xd4')]:_0x3435('0xe2'):_0x16ae9f['Contact'][_0x3435('0xcd')]+(_0x16ae9f[_0x3435('0xcc')][_0x3435('0xce')]?'\x20'+_0x16ae9f[_0x3435('0xcc')]['lastName']:''),'body':_0x16ae9f[_0x3435('0xd0')]?_0x16ae9f[_0x3435('0xd0')]['basename']:_0x16ae9f[_0x3435('0x73')],'direction':_0x16ae9f['direction']===_0x3435('0xe1')?'A':'C','secret':_0x16ae9f[_0x3435('0xd2')],'read':_0x16ae9f[_0x3435('0x7d')],'attachment':_0x16ae9f[_0x3435('0xd0')]};})[_0x3435('0x60')]()};return ejs[_0x3435('0xe3')](path[_0x3435('0xc6')](config[_0x3435('0xc7')],'server',_0x3435('0xe4'),'downloadInteraction.ejs'),{'interaction':_0x3a01dc})['then'](function(_0x55d8b7){var _0x211a10=path[_0x3435('0xc6')](_0x4ea68b,'transcript-'+_0x46f8e4['id']+'-'+_0x3d235f+_0x3435('0xe5'));var _0x337504={'path':_0x211a10,'channel':_0x3435('0xd7'),'interactionId':_0x46f8e4['id']};return pdf[_0x3435('0xe6')](_0x55d8b7,_0x337504);})['then'](function(){return new BPromise(function(_0x3cff18,_0x7d6e76){zipdir(_0x4ea68b,{'saveTo':_0x55cdea},function(_0x241dc6,_0x56cd0a){if(_0x241dc6)return _0x7d6e76(_0x241dc6);return _0x3cff18(_0x56cd0a);});})['then'](function(){return new BPromise(function(_0x343d4c,_0x58b33c){rimraf(_0x4ea68b,function(_0x32e2c7){if(_0x32e2c7)_0x58b33c(_0x32e2c7);return _0x343d4c();});});})['then'](function(){return _0x54bf08['download'](_0x55cdea,_0x3fe9e2,function(_0x473ebe){if(_0x473ebe){console[_0x3435('0xe7')](_0x3435('0xe8'),_0x473ebe);}else{fs['unlinkSync'](_0x55cdea);}});});});}else{return _0x54bf08['sendStatus'](0xc8);}})[_0x3435('0x36')](handleError(_0x54bf08,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 11068a4..3c60ec1 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 _0xba38=['getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x37e9a2,_0x29b4c7){var _0x1248fc=function(_0x42484a){while(--_0x42484a){_0x37e9a2['push'](_0x37e9a2['shift']());}};_0x1248fc(++_0x29b4c7);}(_0xba38,0x119));var _0x8ba3=function(_0x2f8035,_0x5956e5){_0x2f8035=_0x2f8035-0x0;var _0x5d4058=_0xba38[_0x2f8035];return _0x5d4058;};'use strict';var EventEmitter=require(_0x8ba3('0x0'));var OpenchannelInteraction=require(_0x8ba3('0x1'))['db'][_0x8ba3('0x2')];var OpenchannelMessage=require(_0x8ba3('0x1'))['db'][_0x8ba3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8ba3('0x4')](0x0);var events={'afterCreate':_0x8ba3('0x5'),'afterUpdate':_0x8ba3('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2f4449){return function(_0x498eca,_0x1639df,_0x186698){_0x498eca[_0x8ba3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1bce89){_0x498eca[_0x8ba3('0x8')](_0x8ba3('0x9'),_0x1bce89[_0x8ba3('0xa')](function(_0x29cf4f){return{'id':_0x29cf4f['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x498eca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8ba3('0xb')](function(_0x380397){_0x498eca[_0x8ba3('0x8')](_0x8ba3('0xc'),_0x380397[_0x8ba3('0xd')]);OpenchannelInteractionEvents[_0x8ba3('0xe')](_0x2f4449+':'+_0x498eca['id'],_0x498eca);OpenchannelInteractionEvents[_0x8ba3('0xe')](_0x2f4449,_0x498eca);_0x186698(null);})['catch'](_0x186698(null));};}for(var e in events){if(events[_0x8ba3('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x8ba3('0x10')](e,emitEvent(event));}}module[_0x8ba3('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe9d9=['unreadMessages','length','emit','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','getUsers','Users','map','findAll','then','setDataValue'];(function(_0x4c827b,_0x1e9eef){var _0x12d981=function(_0x434171){while(--_0x434171){_0x4c827b['push'](_0x4c827b['shift']());}};_0x12d981(++_0x1e9eef);}(_0xe9d9,0x125));var _0x9e9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9d9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9e9d('0x0'));var OpenchannelInteraction=require(_0x9e9d('0x1'))['db'][_0x9e9d('0x2')];var OpenchannelMessage=require(_0x9e9d('0x1'))['db'][_0x9e9d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e9d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fd1c7){return function(_0x482b0c,_0x278f74,_0x859346){_0x482b0c[_0x9e9d('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x28b8a1){_0x482b0c['setDataValue'](_0x9e9d('0x6'),_0x28b8a1[_0x9e9d('0x7')](function(_0x19e68f){return{'id':_0x19e68f['id']};}));return OpenchannelMessage[_0x9e9d('0x8')]({'where':{'OpenchannelInteractionId':_0x482b0c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9e9d('0x9')](function(_0xfb7a11){_0x482b0c[_0x9e9d('0xa')](_0x9e9d('0xb'),_0xfb7a11[_0x9e9d('0xc')]);OpenchannelInteractionEvents[_0x9e9d('0xd')](_0x4fd1c7+':'+_0x482b0c['id'],_0x482b0c);OpenchannelInteractionEvents[_0x9e9d('0xd')](_0x4fd1c7,_0x482b0c);_0x859346(null);})['catch'](_0x859346(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x9e9d('0xe')](e,emitEvent(event));}}module[_0x9e9d('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 c47ff14..179595e 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 _0x4c7b=['path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird'];(function(_0x31fbd2,_0x42df0d){var _0x4d3fb5=function(_0x4eec48){while(--_0x4eec48){_0x31fbd2['push'](_0x31fbd2['shift']());}};_0x4d3fb5(++_0x42df0d);}(_0x4c7b,0x128));var _0xb4c7=function(_0x3b2744,_0x5ed90d){_0x3b2744=_0x3b2744-0x0;var _0x5df7c4=_0x4c7b[_0x3b2744];return _0x5df7c4;};'use strict';var _=require(_0xb4c7('0x0'));var util=require('util');var logger=require(_0xb4c7('0x1'))('api');var moment=require(_0xb4c7('0x2'));var BPromise=require(_0xb4c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4c7('0x4'));var rimraf=require('rimraf');var config=require(_0xb4c7('0x5'));var attributes=require(_0xb4c7('0x6'));module[_0xb4c7('0x7')]=function(_0x898b7,_0x26689a){return _0x898b7[_0xb4c7('0x8')](_0xb4c7('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5963b7,_0x507c96,_0x12d30c){if(_0x5963b7[_0xb4c7('0xa')](_0xb4c7('0xb'))){_0x5963b7[_0xb4c7('0xc')]=moment()[_0xb4c7('0xd')](_0xb4c7('0xe'));}_0x12d30c(null,_0x5963b7);}}});}; \ No newline at end of file +var _0xd668=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x1f1e5f,_0x376859){var _0x13b7ea=function(_0x27aa70){while(--_0x27aa70){_0x1f1e5f['push'](_0x1f1e5f['shift']());}};_0x13b7ea(++_0x376859);}(_0xd668,0x15e));var _0x8d66=function(_0x53f211,_0xbaebf2){_0x53f211=_0x53f211-0x0;var _0x5442ac=_0xd668[_0x53f211];return _0x5442ac;};'use strict';var _=require(_0x8d66('0x0'));var util=require(_0x8d66('0x1'));var logger=require(_0x8d66('0x2'))(_0x8d66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d66('0x4'));var fs=require('fs');var path=require(_0x8d66('0x5'));var rimraf=require(_0x8d66('0x6'));var config=require(_0x8d66('0x7'));var attributes=require(_0x8d66('0x8'));module[_0x8d66('0x9')]=function(_0x1ad994,_0x104821){return _0x1ad994['define']('OpenchannelInteraction',attributes,{'tableName':_0x8d66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d66('0xb'),'collate':_0x8d66('0xc'),'hooks':{'beforeUpdate':function(_0x130b4c,_0x382d0f,_0x1be178){if(_0x130b4c['changed'](_0x8d66('0xd'))){_0x130b4c['closedAt']=moment()['format'](_0x8d66('0xe'));}_0x1be178(null,_0x130b4c);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index fb4b47c..fb4f1df 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 _0x32d5=['UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','find','addTags','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x32d5,0x175));var _0x532d=function(_0x2ee995,_0xdc5e02){_0x2ee995=_0x2ee995-0x0;var _0x3e5542=_0x32d5[_0x2ee995];return _0x3e5542;};'use strict';var _=require(_0x532d('0x0'));var util=require(_0x532d('0x1'));var moment=require('moment');var BPromise=require(_0x532d('0x2'));var rs=require(_0x532d('0x3'));var fs=require('fs');var Redis=require(_0x532d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x532d('0x5'))(_0x532d('0x6'));var config=require('../../config/environment');var jayson=require(_0x532d('0x7'));var client=jayson[_0x532d('0x8')][_0x532d('0x9')]({'port':0x232a});config['redis']=_[_0x532d('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x532d('0xb'))(new Redis(config[_0x532d('0xc')]));require('./openchannelInteraction.socket')[_0x532d('0xd')](socket);function respondWithRpcPromise(_0x18a3f3,_0x56b3e0,_0x2237bc){return new BPromise(function(_0x2adf2a,_0x4af85d){return client[_0x532d('0xe')](_0x18a3f3,_0x2237bc)[_0x532d('0xf')](function(_0x6003c1){logger[_0x532d('0x10')](_0x532d('0x11'),_0x56b3e0,'request\x20sent');logger[_0x532d('0x12')](_0x532d('0x13'),_0x56b3e0,'request\x20sent',JSON[_0x532d('0x14')](_0x6003c1));if(_0x6003c1[_0x532d('0x15')]){if(_0x6003c1['error'][_0x532d('0x16')]===0x1f4){logger['error'](_0x532d('0x11'),_0x56b3e0,_0x6003c1[_0x532d('0x15')][_0x532d('0x17')]);return _0x4af85d(_0x6003c1[_0x532d('0x15')]['message']);}logger[_0x532d('0x15')](_0x532d('0x11'),_0x56b3e0,_0x6003c1['error'][_0x532d('0x17')]);return _0x2adf2a(_0x6003c1['error'][_0x532d('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x56b3e0,_0x532d('0x18'));_0x2adf2a(_0x6003c1[_0x532d('0x19')]['message']);}})[_0x532d('0x1a')](function(_0x367cfb){logger[_0x532d('0x15')](_0x532d('0x11'),_0x56b3e0,_0x367cfb);_0x4af85d(_0x367cfb);});});}exports[_0x532d('0x1b')]=function(_0x1ac726){var _0x3757cf=this;return new Promise(function(_0x15b66c,_0x1c9cfa){return db[_0x532d('0x1c')][_0x532d('0x1d')](_0x1ac726[_0x532d('0x1e')],{'raw':_0x1ac726[_0x532d('0x1f')]?_0x1ac726[_0x532d('0x1f')][_0x532d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac726[_0x532d('0x1f')]?_0x1ac726[_0x532d('0x1f')]['where']||null:null,'attributes':_0x1ac726['options']?_0x1ac726[_0x532d('0x1f')][_0x532d('0x21')]||null:null,'limit':_0x1ac726[_0x532d('0x1f')]?_0x1ac726['options'][_0x532d('0x22')]||null:null})[_0x532d('0xf')](function(_0x221bf4){logger['info'](_0x532d('0x1b'),_0x1ac726);logger[_0x532d('0x12')](_0x532d('0x1b'),_0x1ac726,JSON[_0x532d('0x14')](_0x221bf4));_0x15b66c(_0x221bf4);})[_0x532d('0x1a')](function(_0x7c2258){logger[_0x532d('0x15')](_0x532d('0x1b'),_0x7c2258['message'],_0x1ac726);_0x1c9cfa(_0x3757cf['error'](0x1f4,_0x7c2258[_0x532d('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1451af){return new Promise(function(_0x393b7a,_0x4dabe1){return db['OpenchannelInteraction'][_0x532d('0x23')]({'where':_0x1451af[_0x532d('0x1f')]?_0x1451af[_0x532d('0x1f')]['where']||null:null})[_0x532d('0xf')](function(_0x348c19){if(_0x348c19){return _0x348c19[_0x532d('0x24')](_0x1451af[_0x532d('0x1e')]['ids'],_[_0x532d('0x25')](_0x1451af[_0x532d('0x1e')],['ids','id'])||{});}})[_0x532d('0x26')](function(_0x383201){logger['info'](_0x532d('0x27'),_0x1451af);logger[_0x532d('0x12')]('AddTags',_0x1451af,JSON[_0x532d('0x14')](_0x383201));_0x393b7a(_0x383201);})['catch'](function(_0x3fe34a){logger[_0x532d('0x15')](_0x532d('0x27'),_0x3fe34a['message'],_0x1451af);_0x4dabe1(_this[_0x532d('0x15')](0x1f4,_0x3fe34a['message']));});});}; \ No newline at end of file +var _0x689a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x689a,0xa9));var _0xa689=function(_0x241964,_0x14d5db){_0x241964=_0x241964-0x0;var _0x23c120=_0x689a[_0x241964];return _0x23c120;};'use strict';var _=require(_0xa689('0x0'));var util=require('util');var moment=require(_0xa689('0x1'));var BPromise=require(_0xa689('0x2'));var rs=require(_0xa689('0x3'));var fs=require('fs');var Redis=require(_0xa689('0x4'));var db=require(_0xa689('0x5'))['db'];var utils=require(_0xa689('0x6'));var logger=require(_0xa689('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa689('0x8'));var client=jayson[_0xa689('0x9')][_0xa689('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa689('0xb'),'port':0x18eb});var socket=require(_0xa689('0xc'))(new Redis(config[_0xa689('0xd')]));require(_0xa689('0xe'))[_0xa689('0xf')](socket);function respondWithRpcPromise(_0x11b527,_0x59b99c,_0xe021ef){return new BPromise(function(_0x1c147b,_0x5ca570){return client[_0xa689('0x10')](_0x11b527,_0xe021ef)[_0xa689('0x11')](function(_0x51fbe3){logger[_0xa689('0x12')](_0xa689('0x13'),_0x59b99c,_0xa689('0x14'));logger[_0xa689('0x15')](_0xa689('0x16'),_0x59b99c,_0xa689('0x14'),JSON[_0xa689('0x17')](_0x51fbe3));if(_0x51fbe3['error']){if(_0x51fbe3['error']['code']===0x1f4){logger[_0xa689('0x18')](_0xa689('0x13'),_0x59b99c,_0x51fbe3[_0xa689('0x18')][_0xa689('0x19')]);return _0x5ca570(_0x51fbe3['error'][_0xa689('0x19')]);}logger[_0xa689('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x59b99c,_0x51fbe3[_0xa689('0x18')]['message']);return _0x1c147b(_0x51fbe3[_0xa689('0x18')][_0xa689('0x19')]);}else{logger[_0xa689('0x12')](_0xa689('0x13'),_0x59b99c,'request\x20sent');_0x1c147b(_0x51fbe3[_0xa689('0x1a')][_0xa689('0x19')]);}})[_0xa689('0x1b')](function(_0x5a57e8){logger['error'](_0xa689('0x13'),_0x59b99c,_0x5a57e8);_0x5ca570(_0x5a57e8);});});}exports[_0xa689('0x1c')]=function(_0x15b51c){var _0x46b60d=this;return new Promise(function(_0x43af33,_0x17170b){return db[_0xa689('0x1d')][_0xa689('0x1e')](_0x15b51c[_0xa689('0x1f')],{'raw':_0x15b51c[_0xa689('0x20')]?_0x15b51c[_0xa689('0x20')][_0xa689('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15b51c[_0xa689('0x20')]?_0x15b51c['options'][_0xa689('0x22')]||null:null,'attributes':_0x15b51c[_0xa689('0x20')]?_0x15b51c['options'][_0xa689('0x23')]||null:null,'limit':_0x15b51c[_0xa689('0x20')]?_0x15b51c[_0xa689('0x20')][_0xa689('0x24')]||null:null})[_0xa689('0x11')](function(_0x464909){logger['info'](_0xa689('0x1c'),_0x15b51c);logger[_0xa689('0x15')](_0xa689('0x1c'),_0x15b51c,JSON[_0xa689('0x17')](_0x464909));_0x43af33(_0x464909);})[_0xa689('0x1b')](function(_0x56c0b8){logger[_0xa689('0x18')]('UpdateOpenchannelInteraction',_0x56c0b8[_0xa689('0x19')],_0x15b51c);_0x17170b(_0x46b60d[_0xa689('0x18')](0x1f4,_0x56c0b8['message']));});});};exports[_0xa689('0x25')]=function(_0x309ff9){return new Promise(function(_0x5448c7,_0x2500b2){return db[_0xa689('0x1d')][_0xa689('0x26')]({'where':_0x309ff9[_0xa689('0x20')]?_0x309ff9[_0xa689('0x20')]['where']||null:null})['then'](function(_0x423a0a){if(_0x423a0a){return _0x423a0a[_0xa689('0x27')](_0x309ff9[_0xa689('0x1f')][_0xa689('0x28')],_['omit'](_0x309ff9[_0xa689('0x1f')],[_0xa689('0x28'),'id'])||{});}})[_0xa689('0x29')](function(_0x54898a){logger[_0xa689('0x12')](_0xa689('0x2a'),_0x309ff9);logger['debug'](_0xa689('0x2a'),_0x309ff9,JSON[_0xa689('0x17')](_0x54898a));_0x5448c7(_0x54898a);})[_0xa689('0x1b')](function(_0x15cc8c){logger[_0xa689('0x18')](_0xa689('0x2a'),_0x15cc8c[_0xa689('0x19')],_0x309ff9);_0x2500b2(_this[_0xa689('0x18')](0x1f4,_0x15cc8c[_0xa689('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8550873..4289e2f 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 _0x2bc0=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x2bc0,0x1bc));var _0x02bc=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2bc0[_0x432682];return _0x463d05;};'use strict';var OpenchannelInteractionEvents=require(_0x02bc('0x0'));var events=[_0x02bc('0x1'),_0x02bc('0x2'),'update'];function createListener(_0x532860,_0x4dad03){return function(_0x30c06b){_0x4dad03[_0x02bc('0x3')](_0x532860,_0x30c06b);};}function removeListener(_0x12bdea,_0x115979){return function(){OpenchannelInteractionEvents[_0x02bc('0x4')](_0x12bdea,_0x115979);};}exports[_0x02bc('0x5')]=function(_0x5de6c5){for(var _0x463efa=0x0,_0x51d9eb=events[_0x02bc('0x6')];_0x463efa<_0x51d9eb;_0x463efa++){var _0x43c931=events[_0x463efa];var _0x344171=createListener(_0x02bc('0x7')+_0x43c931,_0x5de6c5);OpenchannelInteractionEvents['on'](_0x43c931,_0x344171);}}; \ No newline at end of file +var _0xec94=['length','openchannelInteraction:','./openchannelInteraction.events','update','emit','removeListener','register'];(function(_0x4917fd,_0xcdf68c){var _0x152e63=function(_0x245525){while(--_0x245525){_0x4917fd['push'](_0x4917fd['shift']());}};_0x152e63(++_0xcdf68c);}(_0xec94,0x105));var _0x4ec9=function(_0x1290ed,_0x2d15ac){_0x1290ed=_0x1290ed-0x0;var _0x28cfa7=_0xec94[_0x1290ed];return _0x28cfa7;};'use strict';var OpenchannelInteractionEvents=require(_0x4ec9('0x0'));var events=['save','remove',_0x4ec9('0x1')];function createListener(_0x167404,_0x35b5be){return function(_0x441909){_0x35b5be[_0x4ec9('0x2')](_0x167404,_0x441909);};}function removeListener(_0x5d6d81,_0x3fee69){return function(){OpenchannelInteractionEvents[_0x4ec9('0x3')](_0x5d6d81,_0x3fee69);};}exports[_0x4ec9('0x4')]=function(_0x51de77){for(var _0x1a3dec=0x0,_0x567068=events[_0x4ec9('0x5')];_0x1a3dec<_0x567068;_0x1a3dec++){var _0x3aa358=events[_0x1a3dec];var _0x33488e=createListener(_0x4ec9('0x6')+_0x3aa358,_0x51de77);OpenchannelInteractionEvents['on'](_0x3aa358,_0x33488e);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f86fec0..ce42633 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x3a1fb7,_0x2d6740){var _0x20652f=function(_0x439c0f){while(--_0x439c0f){_0x3a1fb7['push'](_0x3a1fb7['shift']());}};_0x20652f(++_0x2d6740);}(_0xe706,0xa3));var _0x6e70=function(_0x5ca0cd,_0x6a360a){_0x5ca0cd=_0x5ca0cd-0x0;var _0x1f2ee4=_0xe706[_0x5ca0cd];return _0x1f2ee4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x53dbf7,_0x4953cc){var _0x543510=function(_0x40eecf){while(--_0x40eecf){_0x53dbf7['push'](_0x53dbf7['shift']());}};_0x543510(++_0x4953cc);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c7c8181..a9a7437 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 _0x2547=['TEXT','medium','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x2ad68c,_0x4c89d0){var _0x4efdbf=function(_0x4fbae9){while(--_0x4fbae9){_0x2ad68c['push'](_0x2ad68c['shift']());}};_0x4efdbf(++_0x4c89d0);}(_0x2547,0x1cd));var _0x7254=function(_0x143810,_0x177d23){_0x143810=_0x143810-0x0;var _0x4e1e84=_0x2547[_0x143810];return _0x4e1e84;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'body':{'type':Sequelize[_0x7254('0x1')](_0x7254('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7254('0x4')]('in',_0x7254('0x5')),'defaultValue':_0x7254('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x7254('0x6')]},'providerResponse':{'type':Sequelize[_0x7254('0x1')]}}; \ No newline at end of file +var _0xfd7b=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x10e9ae,_0x576dd3){var _0x11c22f=function(_0x47e347){while(--_0x47e347){_0x10e9ae['push'](_0x10e9ae['shift']());}};_0x11c22f(++_0x576dd3);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xfd7b[_0x4e4f0e];return _0x1a7219;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'body':{'type':Sequelize[_0xbfd7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfd7('0x4')]('in','out'),'defaultValue':_0xbfd7('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfd7('0x6')]},'providerName':{'type':Sequelize[_0xbfd7('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 762fe1f..836a731 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 _0x7d9a=['keys','length','create','body','find','destroy','describe','openchannel-interactions','read','UserId','user','get','OpenchannelInteractionId','update','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','openchannel','OpenchannelInteraction','RejectMessage','rejectMessage','event','rejectmessage','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','end','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x4bd1de,_0x1ba648){var _0x38bd31=function(_0x398e30){while(--_0x398e30){_0x4bd1de['push'](_0x4bd1de['shift']());}};_0x38bd31(++_0x1ba648);}(_0x7d9a,0x1be));var _0xa7d9=function(_0x344a52,_0x442189){_0x344a52=_0x344a52-0x0;var _0x1fa0aa=_0x7d9a[_0x344a52];return _0x1fa0aa;};'use strict';var emlformat=require(_0xa7d9('0x0'));var rimraf=require(_0xa7d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7d9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa7d9('0x3'));var Mustache=require(_0xa7d9('0x4'));var util=require(_0xa7d9('0x5'));var path=require(_0xa7d9('0x6'));var sox=require(_0xa7d9('0x7'));var csv=require(_0xa7d9('0x8'));var ejs=require(_0xa7d9('0x9'));var fs=require('fs');var fs_extra=require(_0xa7d9('0xa'));var _=require(_0xa7d9('0xb'));var squel=require(_0xa7d9('0xc'));var crypto=require(_0xa7d9('0xd'));var jsforce=require(_0xa7d9('0xe'));var deskjs=require(_0xa7d9('0xf'));var toCsv=require(_0xa7d9('0x8'));var querystring=require(_0xa7d9('0x10'));var Papa=require(_0xa7d9('0x11'));var Redis=require('ioredis');var authService=require(_0xa7d9('0x12'));var qs=require(_0xa7d9('0x13'));var as=require(_0xa7d9('0x14'));var hardwareService=require(_0xa7d9('0x15'));var logger=require(_0xa7d9('0x16'))(_0xa7d9('0x17'));var utils=require(_0xa7d9('0x18'));var config=require(_0xa7d9('0x19'));var licenseUtil=require(_0xa7d9('0x1a'));var db=require(_0xa7d9('0x1b'))['db'];config[_0xa7d9('0x1c')]=_[_0xa7d9('0x1d')](config[_0xa7d9('0x1c')],{'host':_0xa7d9('0x1e'),'port':0x18eb});var socket=require(_0xa7d9('0x1f'))(new Redis(config[_0xa7d9('0x1c')]));require(_0xa7d9('0x20'))[_0xa7d9('0x21')](socket);var jayson=require(_0xa7d9('0x22'));var client=jayson[_0xa7d9('0x23')][_0xa7d9('0x24')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25e54f,_0xd8c0e6,_0x1bfb86,_0x2ee62c){return new BPromise(function(_0x579504,_0x2f757a){var _0x3733bd=_0x2ee62c||client;return _0x3733bd[_0xa7d9('0x25')](_0x25e54f,_0x1bfb86)[_0xa7d9('0x26')](function(_0x242224){logger[_0xa7d9('0x27')](_0xa7d9('0x28'),_0xd8c0e6,_0xa7d9('0x29'));logger['debug'](_0xa7d9('0x2a'),_0xd8c0e6,_0xa7d9('0x29'),JSON[_0xa7d9('0x2b')](_0x242224));if(_0x242224[_0xa7d9('0x2c')]){if(_0x242224[_0xa7d9('0x2c')]['code']===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xd8c0e6,_0x242224[_0xa7d9('0x2c')][_0xa7d9('0x2d')]);return _0x2f757a(_0x242224['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xd8c0e6,_0x242224[_0xa7d9('0x2c')][_0xa7d9('0x2d')]);return _0x579504(_0x242224['error'][_0xa7d9('0x2d')]);}else{logger[_0xa7d9('0x27')](_0xa7d9('0x28'),_0xd8c0e6,_0xa7d9('0x29'));_0x579504(_0x242224['result'][_0xa7d9('0x2d')]);}})[_0xa7d9('0x2e')](function(_0x244b6c){logger[_0xa7d9('0x2c')](_0xa7d9('0x28'),_0xd8c0e6,_0x244b6c);_0x2f757a(_0x244b6c);});});}function respondWithStatusCode(_0x4f43fa,_0x149fb4){_0x149fb4=_0x149fb4||0xcc;return function(_0x579e38){if(_0x579e38){return _0x4f43fa[_0xa7d9('0x2f')](_0x149fb4);}return _0x4f43fa['status'](_0x149fb4)['end']();};}function respondWithResult(_0x506380,_0x186474){_0x186474=_0x186474||0xc8;return function(_0xf4004d){if(_0xf4004d){return _0x506380[_0xa7d9('0x30')](_0x186474)[_0xa7d9('0x31')](_0xf4004d);}};}function respondWithFilteredResult(_0x5a4e3a,_0x2d1764){return function(_0x2975dc){if(_0x2975dc){var _0x4fb38f=typeof _0x2d1764[_0xa7d9('0x32')]===_0xa7d9('0x33')&&typeof _0x2d1764[_0xa7d9('0x34')]===_0xa7d9('0x33');var _0x34fd62=_0x2975dc[_0xa7d9('0x35')];var _0xd6ae4a=_0x4fb38f?0x0:_0x2d1764['offset'];var _0x15cbf9=_0x4fb38f?_0x2975dc[_0xa7d9('0x35')]:_0x2d1764['offset']+_0x2d1764[_0xa7d9('0x34')];var _0x521ffc;if(_0x15cbf9>=_0x34fd62){_0x15cbf9=_0x34fd62;_0x521ffc=0xc8;}else{_0x521ffc=0xce;}_0x5a4e3a[_0xa7d9('0x30')](_0x521ffc);return _0x5a4e3a[_0xa7d9('0x36')](_0xa7d9('0x37'),_0xd6ae4a+'-'+_0x15cbf9+'/'+_0x34fd62)[_0xa7d9('0x31')](_0x2975dc);}return null;};}function patchUpdates(_0x2dfc90){return function(_0x1ce31b){try{jsonpatch[_0xa7d9('0x38')](_0x1ce31b,_0x2dfc90,!![]);}catch(_0x509def){return BPromise[_0xa7d9('0x39')](_0x509def);}return _0x1ce31b['save']();};}function saveUpdates(_0x405475,_0x454ba6){return function(_0x407222){if(_0x407222){return _0x407222['update'](_0x405475)[_0xa7d9('0x26')](function(_0x882cd4){return _0x882cd4;});}return null;};}function removeEntity(_0x54d168,_0x1586eb){return function(_0x20edfd){if(_0x20edfd){return _0x20edfd['destroy']()[_0xa7d9('0x26')](function(){_0x54d168[_0xa7d9('0x30')](0xcc)[_0xa7d9('0x3a')]();});}};}function handleEntityNotFound(_0x194243,_0x4b1c93){return function(_0x3650b6){if(!_0x3650b6){_0x194243[_0xa7d9('0x2f')](0x194);}return _0x3650b6;};}function handleError(_0x1433f9,_0x286a54){_0x286a54=_0x286a54||0x1f4;return function(_0x5e0939){logger[_0xa7d9('0x2c')](_0x5e0939[_0xa7d9('0x3b')]);if(_0x5e0939[_0xa7d9('0x3c')]){delete _0x5e0939['name'];}_0x1433f9[_0xa7d9('0x30')](_0x286a54)['send'](_0x5e0939);};}exports['index']=function(_0x2e134b,_0x17c8d7){var _0x80d660={},_0x4afa38={},_0x3e6058={'count':0x0,'rows':[]};var _0x45bb1c=_[_0xa7d9('0x3d')](db[_0xa7d9('0x3e')][_0xa7d9('0x3f')],function(_0x15de90){return{'name':_0x15de90[_0xa7d9('0x40')],'type':_0x15de90['type'][_0xa7d9('0x41')]};});_0x4afa38[_0xa7d9('0x42')]=_['map'](_0x45bb1c,_0xa7d9('0x3c'));_0x4afa38['query']=_['keys'](_0x2e134b[_0xa7d9('0x43')]);_0x4afa38['filters']=_[_0xa7d9('0x44')](_0x4afa38[_0xa7d9('0x42')],_0x4afa38['query']);_0x80d660[_0xa7d9('0x45')]=_[_0xa7d9('0x44')](_0x4afa38[_0xa7d9('0x42')],qs['fields'](_0x2e134b[_0xa7d9('0x43')][_0xa7d9('0x46')]));_0x80d660['attributes']=_0x80d660['attributes']['length']?_0x80d660['attributes']:_0x4afa38[_0xa7d9('0x42')];if(!_0x2e134b['query']['hasOwnProperty'](_0xa7d9('0x47'))){_0x80d660[_0xa7d9('0x34')]=qs['limit'](_0x2e134b[_0xa7d9('0x43')][_0xa7d9('0x34')]);_0x80d660[_0xa7d9('0x32')]=qs[_0xa7d9('0x32')](_0x2e134b['query']['offset']);}_0x80d660[_0xa7d9('0x48')]=qs[_0xa7d9('0x49')](_0x2e134b[_0xa7d9('0x43')]['sort']);_0x80d660[_0xa7d9('0x4a')]=qs[_0xa7d9('0x4b')](_['pick'](_0x2e134b['query'],_0x4afa38[_0xa7d9('0x4b')]),_0x45bb1c);if(_0x2e134b[_0xa7d9('0x43')][_0xa7d9('0x4c')]){_0x80d660[_0xa7d9('0x4a')]=_[_0xa7d9('0x4d')](_0x80d660['where'],{'$or':_[_0xa7d9('0x3d')](_0x45bb1c,function(_0x214608){if(_0x214608[_0xa7d9('0x4e')]!==_0xa7d9('0x4f')){var _0x555d24={};_0x555d24[_0x214608[_0xa7d9('0x3c')]]={'$like':'%'+_0x2e134b[_0xa7d9('0x43')][_0xa7d9('0x4c')]+'%'};return _0x555d24;}})});}_0x80d660=_['merge']({},_0x80d660,_0x2e134b[_0xa7d9('0x50')]);var _0x288605={'where':_0x80d660[_0xa7d9('0x4a')]};return db[_0xa7d9('0x3e')][_0xa7d9('0x35')](_0x288605)[_0xa7d9('0x26')](function(_0x1191e7){_0x3e6058[_0xa7d9('0x35')]=_0x1191e7;if(_0x2e134b[_0xa7d9('0x43')][_0xa7d9('0x51')]){_0x80d660[_0xa7d9('0x52')]=[{'all':!![]}];}return db[_0xa7d9('0x3e')][_0xa7d9('0x53')](_0x80d660);})[_0xa7d9('0x26')](function(_0x43c66a){_0x3e6058[_0xa7d9('0x54')]=_0x43c66a;return _0x3e6058;})[_0xa7d9('0x26')](respondWithFilteredResult(_0x17c8d7,_0x80d660))[_0xa7d9('0x2e')](handleError(_0x17c8d7,null));};exports['show']=function(_0x3df06d,_0x5ce2d2){var _0x572acd={'raw':!![],'where':{'id':_0x3df06d[_0xa7d9('0x55')]['id']}},_0x531072={};_0x531072['model']=_['keys'](db[_0xa7d9('0x3e')][_0xa7d9('0x3f')]);_0x531072[_0xa7d9('0x43')]=_[_0xa7d9('0x56')](_0x3df06d[_0xa7d9('0x43')]);_0x531072[_0xa7d9('0x4b')]=_['intersection'](_0x531072[_0xa7d9('0x42')],_0x531072[_0xa7d9('0x43')]);_0x572acd['attributes']=_['intersection'](_0x531072[_0xa7d9('0x42')],qs[_0xa7d9('0x46')](_0x3df06d[_0xa7d9('0x43')][_0xa7d9('0x46')]));_0x572acd[_0xa7d9('0x45')]=_0x572acd[_0xa7d9('0x45')][_0xa7d9('0x57')]?_0x572acd[_0xa7d9('0x45')]:_0x531072[_0xa7d9('0x42')];if(_0x3df06d[_0xa7d9('0x43')][_0xa7d9('0x51')]){_0x572acd[_0xa7d9('0x52')]=[{'all':!![]}];}_0x572acd=_[_0xa7d9('0x4d')]({},_0x572acd,_0x3df06d[_0xa7d9('0x50')]);return db[_0xa7d9('0x3e')]['find'](_0x572acd)['then'](handleEntityNotFound(_0x5ce2d2,null))['then'](respondWithResult(_0x5ce2d2,null))['catch'](handleError(_0x5ce2d2,null));};exports[_0xa7d9('0x58')]=function(_0x1db1a1,_0x4e31a2){return db['OpenchannelMessage'][_0xa7d9('0x58')](_0x1db1a1[_0xa7d9('0x59')],{})[_0xa7d9('0x26')](respondWithResult(_0x4e31a2,0xc9))['catch'](handleError(_0x4e31a2,null));};exports['update']=function(_0x102432,_0x402c4e){if(_0x102432['body']['id']){delete _0x102432[_0xa7d9('0x59')]['id'];}return db[_0xa7d9('0x3e')][_0xa7d9('0x5a')]({'where':{'id':_0x102432[_0xa7d9('0x55')]['id']}})[_0xa7d9('0x26')](handleEntityNotFound(_0x402c4e,null))[_0xa7d9('0x26')](saveUpdates(_0x102432[_0xa7d9('0x59')],null))[_0xa7d9('0x26')](respondWithResult(_0x402c4e,null))[_0xa7d9('0x2e')](handleError(_0x402c4e,null));};exports[_0xa7d9('0x5b')]=function(_0x499639,_0x3d2ec9){return db[_0xa7d9('0x3e')]['find']({'where':{'id':_0x499639[_0xa7d9('0x55')]['id']}})['then'](handleEntityNotFound(_0x3d2ec9,null))[_0xa7d9('0x26')](removeEntity(_0x3d2ec9,null))['catch'](handleError(_0x3d2ec9,null));};exports[_0xa7d9('0x5c')]=function(_0x325e02,_0x1ba5eb){return db[_0xa7d9('0x3e')][_0xa7d9('0x5c')]()[_0xa7d9('0x26')](respondWithResult(_0x1ba5eb,null))['catch'](handleError(_0x1ba5eb,null));};var interaction_log=require('../../config/logger')(_0xa7d9('0x5d'));exports['accept']=function(_0x4a065f,_0x3b8aaa,_0x3745dc){var _0xd12876={'agent':{},'channel':'openchannel'};if(_0x4a065f[_0xa7d9('0x59')]['id']){delete _0x4a065f[_0xa7d9('0x59')]['id'];}_0x4a065f[_0xa7d9('0x59')][_0xa7d9('0x5e')]=!![];_0x4a065f[_0xa7d9('0x59')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4a065f[_0xa7d9('0x59')][_0xa7d9('0x5f')]=_0x4a065f[_0xa7d9('0x59')][_0xa7d9('0x5f')]||_0x4a065f[_0xa7d9('0x60')]['id'];_0xd12876['agent']['id']=_0x4a065f[_0xa7d9('0x59')][_0xa7d9('0x5f')];return db['OpenchannelMessage'][_0xa7d9('0x5a')]({'where':{'id':_0x4a065f['params']['id'],'UserId':null}})[_0xa7d9('0x26')](handleEntityNotFound(_0x3b8aaa,null))[_0xa7d9('0x26')](saveUpdates(_0x4a065f['body'],null))[_0xa7d9('0x26')](function(_0x6f69aa){if(_0x6f69aa){_0xd12876[_0xa7d9('0x2d')]=_0x6f69aa[_0xa7d9('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa7d9('0x5a')]({'where':{'id':_0x6f69aa[_0xa7d9('0x62')]}});}return null;})[_0xa7d9('0x26')](handleEntityNotFound(_0x3b8aaa,null))[_0xa7d9('0x26')](function(_0x1973ed){if(_0x1973ed){return _0x1973ed[_0xa7d9('0x63')]({'UserId':_0x4a065f[_0xa7d9('0x59')][_0xa7d9('0x5f')],'read1stAt':_[_0xa7d9('0x64')](_0x1973ed[_0xa7d9('0x65')])?moment()[_0xa7d9('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa7d9('0x26')](function(_0x4e2ea1){if(_0x4e2ea1){_0xd12876[_0xa7d9('0x67')]=_0x4e2ea1[_0xa7d9('0x61')]({'plain':!![]});interaction_log[_0xa7d9('0x27')](_0xa7d9('0x68'),_0x4a065f['user']['id'],_0x4a065f['user'][_0xa7d9('0x3c')],_0x4a065f[_0xa7d9('0x60')][_0xa7d9('0x69')],_0xd12876[_0xa7d9('0x67')]['id'],_0x4a065f[_0xa7d9('0x59')]?JSON[_0xa7d9('0x2b')](_0x4a065f[_0xa7d9('0x59')]):_0xa7d9('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xa7d9('0x6b'),_0xd12876);}return null;})[_0xa7d9('0x26')](function(_0x596655){var _0x2c04ba=_0xa7d9('0x6c')+_0x596655['message'][_0xa7d9('0x6d')];return db[_0xa7d9('0x6e')][_0xa7d9('0x43')](_0x2c04ba,{'type':db['Sequelize'][_0xa7d9('0x6f')][_0xa7d9('0x70')],'raw':!![]})[_0xa7d9('0x26')](function(_0x1668e1){return _0x1668e1;});})[_0xa7d9('0x26')](function(_0x277244){if(_0x277244){_0xd12876['message'][_0xa7d9('0x71')]=_0x277244[0x0];if(!_0x4a065f[_0xa7d9('0x59')]['UserId'])return;return db[_0xa7d9('0x72')][_0xa7d9('0x5a')]({'where':{'id':_0x4a065f[_0xa7d9('0x59')]['UserId'],'role':_0xa7d9('0x73')},'attributes':['id',_0xa7d9('0x3c'),_0xa7d9('0x74'),_0xa7d9('0x75'),_0xa7d9('0x76')],'raw':!![]});}return null;})[_0xa7d9('0x26')](function(_0x5bb700){if(!_0x5bb700)return null;_0xd12876['message'][_0xa7d9('0x73')]=_0x5bb700;return _0xd12876;})[_0xa7d9('0x26')](function(_0x445143){if(_0x445143){if(_0x4a065f[_0xa7d9('0x59')][_0xa7d9('0x77')]){_0xd12876[_0xa7d9('0x2d')][_0xa7d9('0x78')]=util[_0xa7d9('0x66')](_0xa7d9('0x79'),_0x4a065f['user'][_0xa7d9('0x3c')]);_0xd12876[_0xa7d9('0x2d')][_0xa7d9('0x7a')]=_0xd12876[_0xa7d9('0x7a')];_0xd12876[_0xa7d9('0x2d')][_0xa7d9('0x7b')]=_0xd12876['channel'];_0xd12876[_0xa7d9('0x2d')]['event']=_0xa7d9('0x7c');return respondWithRpcPromise(_0xa7d9('0x7d'),_0xa7d9('0x7d'),{'event':_0xa7d9('0x7e'),'message':_0xd12876[_0xa7d9('0x2d')]},client9002)[_0xa7d9('0x26')](function(){return _0xd12876;});}return _0xd12876;}return null;})['then'](respondWithResult(_0x3b8aaa,null))[_0xa7d9('0x2e')](handleError(_0x3b8aaa,null));};var interaction_log=require(_0xa7d9('0x16'))(_0xa7d9('0x5d'));exports['reject']=function(_0x8aff28,_0xb6e40b,_0x5d1609){var _0xcad9b={'agent':{},'channel':_0xa7d9('0x7f')};if(_0x8aff28[_0xa7d9('0x59')]['id']){delete _0x8aff28[_0xa7d9('0x59')]['id'];}_0x8aff28['body'][_0xa7d9('0x5f')]=_0x8aff28[_0xa7d9('0x59')][_0xa7d9('0x5f')]||_0x8aff28['user']['id'];_0xcad9b[_0xa7d9('0x73')]['id']=_0x8aff28[_0xa7d9('0x59')][_0xa7d9('0x5f')];return db[_0xa7d9('0x3e')]['find']({'where':{'id':_0x8aff28[_0xa7d9('0x55')]['id'],'UserId':null}})[_0xa7d9('0x26')](handleEntityNotFound(_0xb6e40b,null))[_0xa7d9('0x26')](function(_0x3509ae){if(_0x3509ae){_0xcad9b[_0xa7d9('0x2d')]=_0x3509ae[_0xa7d9('0x61')]({'plain':!![]});return db[_0xa7d9('0x80')][_0xa7d9('0x5a')]({'where':{'id':_0x3509ae[_0xa7d9('0x62')]}});}return null;})[_0xa7d9('0x26')](handleEntityNotFound(_0xb6e40b,null))[_0xa7d9('0x26')](function(_0x12f00b){if(_0x12f00b){_0xcad9b[_0xa7d9('0x67')]=_0x12f00b[_0xa7d9('0x61')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x8aff28[_0xa7d9('0x60')]['id'],_0x8aff28[_0xa7d9('0x60')]['name'],_0x8aff28[_0xa7d9('0x60')][_0xa7d9('0x69')],_0xcad9b[_0xa7d9('0x67')]['id'],_0x8aff28[_0xa7d9('0x59')]?JSON[_0xa7d9('0x2b')](_0x8aff28[_0xa7d9('0x59')]):'null');return respondWithRpcPromise(_0xa7d9('0x81'),_0xa7d9('0x82'),_0xcad9b);}return null;})[_0xa7d9('0x26')](function(_0x14f9c8){var _0x2a03f0=_0xa7d9('0x6c')+_0x14f9c8[_0xa7d9('0x2d')][_0xa7d9('0x6d')];return db['sequelize'][_0xa7d9('0x43')](_0x2a03f0,{'type':db['Sequelize'][_0xa7d9('0x6f')]['SELECT'],'raw':!![]})[_0xa7d9('0x26')](function(_0x2cdd9f){return _0x2cdd9f;});})[_0xa7d9('0x26')](function(_0x4179ea){if(_0x4179ea){_0xcad9b[_0xa7d9('0x2d')][_0xa7d9('0x71')]=_0x4179ea[0x0];if(!_0x8aff28[_0xa7d9('0x59')][_0xa7d9('0x5f')])return;return db[_0xa7d9('0x72')][_0xa7d9('0x5a')]({'where':{'id':_0x8aff28[_0xa7d9('0x59')][_0xa7d9('0x5f')],'role':_0xa7d9('0x73')},'attributes':['id','name',_0xa7d9('0x74'),_0xa7d9('0x75'),_0xa7d9('0x76')],'raw':!![]});}return null;})['then'](function(_0x1fb8a3){if(!_0x1fb8a3)return null;_0xcad9b[_0xa7d9('0x2d')]['agent']=_0x1fb8a3;return _0xcad9b;})['then'](function(_0x3115af){if(_0x3115af){_0x3115af[_0xa7d9('0x2d')][_0xa7d9('0x78')]=util[_0xa7d9('0x66')](_0xa7d9('0x79'),_0x8aff28[_0xa7d9('0x60')][_0xa7d9('0x3c')]);_0x3115af[_0xa7d9('0x2d')][_0xa7d9('0x7a')]=_0xcad9b[_0xa7d9('0x7a')];_0x3115af[_0xa7d9('0x2d')][_0xa7d9('0x7b')]=_0xcad9b[_0xa7d9('0x7a')];_0x3115af[_0xa7d9('0x2d')][_0xa7d9('0x83')]=_0xa7d9('0x39');respondWithRpcPromise('EventManager',_0xa7d9('0x7d'),{'event':_0xa7d9('0x84'),'message':_0x3115af[_0xa7d9('0x2d')]},client9002);return _0xcad9b;}return null;})[_0xa7d9('0x26')](respondWithResult(_0xb6e40b,null))[_0xa7d9('0x2e')](handleError(_0xb6e40b,null));}; \ No newline at end of file +var _0xe2fe=['rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','email','internal','rejectmessage','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','reject','update','then','destroy','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','query','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','keys','fields','options','create','body','find','../../config/logger','openchannel-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];config[_0xee2f('0x11')]=_[_0xee2f('0x12')](config[_0xee2f('0x11')],{'host':_0xee2f('0x13'),'port':0x18eb});var socket=require(_0xee2f('0x14'))(new Redis(config['redis']));require(_0xee2f('0x15'))['register'](socket);var jayson=require(_0xee2f('0x16'));var client=jayson[_0xee2f('0x17')]['http']({'port':0x232c});var client9002=jayson[_0xee2f('0x17')][_0xee2f('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x28b614,_0x1bbf7d,_0x390c2c,_0x58f42a){return new BPromise(function(_0x3f6372,_0x4afcd1){var _0x17d288=_0x58f42a||client;return _0x17d288[_0xee2f('0x19')](_0x28b614,_0x390c2c)['then'](function(_0x550da7){logger[_0xee2f('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x1bbf7d,_0xee2f('0x1b'));logger[_0xee2f('0x1c')](_0xee2f('0x1d'),_0x1bbf7d,'request\x20sent',JSON[_0xee2f('0x1e')](_0x550da7));if(_0x550da7[_0xee2f('0x1f')]){if(_0x550da7[_0xee2f('0x1f')][_0xee2f('0x20')]===0x1f4){logger[_0xee2f('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x1bbf7d,_0x550da7['error'][_0xee2f('0x21')]);return _0x4afcd1(_0x550da7[_0xee2f('0x1f')][_0xee2f('0x21')]);}logger[_0xee2f('0x1f')](_0xee2f('0x22'),_0x1bbf7d,_0x550da7[_0xee2f('0x1f')][_0xee2f('0x21')]);return _0x3f6372(_0x550da7['error'][_0xee2f('0x21')]);}else{logger[_0xee2f('0x1a')](_0xee2f('0x22'),_0x1bbf7d,_0xee2f('0x1b'));_0x3f6372(_0x550da7[_0xee2f('0x23')][_0xee2f('0x21')]);}})[_0xee2f('0x24')](function(_0x13013f){logger[_0xee2f('0x1f')](_0xee2f('0x22'),_0x1bbf7d,_0x13013f);_0x4afcd1(_0x13013f);});});}function respondWithStatusCode(_0x11edc8,_0x168adc){_0x168adc=_0x168adc||0xcc;return function(_0x1c8454){if(_0x1c8454){return _0x11edc8[_0xee2f('0x25')](_0x168adc);}return _0x11edc8['status'](_0x168adc)['end']();};}function respondWithResult(_0x58ba65,_0x18bdbb){_0x18bdbb=_0x18bdbb||0xc8;return function(_0x18ff19){if(_0x18ff19){return _0x58ba65[_0xee2f('0x26')](_0x18bdbb)[_0xee2f('0x27')](_0x18ff19);}};}function respondWithFilteredResult(_0x892a4e,_0x3737fd){return function(_0x4d8398){if(_0x4d8398){var _0x3d3806=typeof _0x3737fd['offset']===_0xee2f('0x28')&&typeof _0x3737fd[_0xee2f('0x29')]===_0xee2f('0x28');var _0x8a0bf7=_0x4d8398[_0xee2f('0x2a')];var _0x47d5a6=_0x3d3806?0x0:_0x3737fd[_0xee2f('0x2b')];var _0xd16e35=_0x3d3806?_0x4d8398['count']:_0x3737fd['offset']+_0x3737fd[_0xee2f('0x29')];var _0x574899;if(_0xd16e35>=_0x8a0bf7){_0xd16e35=_0x8a0bf7;_0x574899=0xc8;}else{_0x574899=0xce;}_0x892a4e[_0xee2f('0x26')](_0x574899);return _0x892a4e[_0xee2f('0x2c')]('Content-Range',_0x47d5a6+'-'+_0xd16e35+'/'+_0x8a0bf7)[_0xee2f('0x27')](_0x4d8398);}return null;};}function patchUpdates(_0x5ca9f6){return function(_0x5ec1b0){try{jsonpatch['apply'](_0x5ec1b0,_0x5ca9f6,!![]);}catch(_0x3f1fe8){return BPromise[_0xee2f('0x2d')](_0x3f1fe8);}return _0x5ec1b0['save']();};}function saveUpdates(_0x39f224,_0x1b70cc){return function(_0xd64b7){if(_0xd64b7){return _0xd64b7[_0xee2f('0x2e')](_0x39f224)[_0xee2f('0x2f')](function(_0x4e682d){return _0x4e682d;});}return null;};}function removeEntity(_0x2c789d,_0x5b427c){return function(_0x6fe685){if(_0x6fe685){return _0x6fe685[_0xee2f('0x30')]()[_0xee2f('0x2f')](function(){_0x2c789d['status'](0xcc)[_0xee2f('0x31')]();});}};}function handleEntityNotFound(_0x5ed71e,_0xd3aaa9){return function(_0x4e3f24){if(!_0x4e3f24){_0x5ed71e[_0xee2f('0x25')](0x194);}return _0x4e3f24;};}function handleError(_0x13a824,_0x13149e){_0x13149e=_0x13149e||0x1f4;return function(_0x1fb2cd){logger[_0xee2f('0x1f')](_0x1fb2cd[_0xee2f('0x32')]);if(_0x1fb2cd[_0xee2f('0x33')]){delete _0x1fb2cd[_0xee2f('0x33')];}_0x13a824[_0xee2f('0x26')](_0x13149e)[_0xee2f('0x34')](_0x1fb2cd);};}exports[_0xee2f('0x35')]=function(_0x5ad0a7,_0x4584b8){var _0x47e54b={},_0x46166f={},_0x3cbc01={'count':0x0,'rows':[]};var _0x33419b=_[_0xee2f('0x36')](db[_0xee2f('0x37')][_0xee2f('0x38')],function(_0x694950){return{'name':_0x694950[_0xee2f('0x39')],'type':_0x694950['type']['key']};});_0x46166f['model']=_[_0xee2f('0x36')](_0x33419b,'name');_0x46166f[_0xee2f('0x3a')]=_['keys'](_0x5ad0a7['query']);_0x46166f['filters']=_['intersection'](_0x46166f[_0xee2f('0x3b')],_0x46166f[_0xee2f('0x3a')]);_0x47e54b[_0xee2f('0x3c')]=_[_0xee2f('0x3d')](_0x46166f['model'],qs['fields'](_0x5ad0a7[_0xee2f('0x3a')]['fields']));_0x47e54b['attributes']=_0x47e54b[_0xee2f('0x3c')][_0xee2f('0x3e')]?_0x47e54b[_0xee2f('0x3c')]:_0x46166f['model'];if(!_0x5ad0a7[_0xee2f('0x3a')][_0xee2f('0x3f')](_0xee2f('0x40'))){_0x47e54b['limit']=qs['limit'](_0x5ad0a7[_0xee2f('0x3a')][_0xee2f('0x29')]);_0x47e54b[_0xee2f('0x2b')]=qs[_0xee2f('0x2b')](_0x5ad0a7['query'][_0xee2f('0x2b')]);}_0x47e54b[_0xee2f('0x41')]=qs[_0xee2f('0x42')](_0x5ad0a7[_0xee2f('0x3a')][_0xee2f('0x42')]);_0x47e54b[_0xee2f('0x43')]=qs[_0xee2f('0x44')](_[_0xee2f('0x45')](_0x5ad0a7[_0xee2f('0x3a')],_0x46166f[_0xee2f('0x44')]),_0x33419b);if(_0x5ad0a7['query']['filter']){_0x47e54b['where']=_['merge'](_0x47e54b[_0xee2f('0x43')],{'$or':_[_0xee2f('0x36')](_0x33419b,function(_0x34ce9c){if(_0x34ce9c[_0xee2f('0x46')]!==_0xee2f('0x47')){var _0x556239={};_0x556239[_0x34ce9c[_0xee2f('0x33')]]={'$like':'%'+_0x5ad0a7[_0xee2f('0x3a')][_0xee2f('0x48')]+'%'};return _0x556239;}})});}_0x47e54b=_[_0xee2f('0x49')]({},_0x47e54b,_0x5ad0a7['options']);var _0x5c887b={'where':_0x47e54b['where']};return db[_0xee2f('0x37')]['count'](_0x5c887b)['then'](function(_0x57ce3c){_0x3cbc01['count']=_0x57ce3c;if(_0x5ad0a7[_0xee2f('0x3a')][_0xee2f('0x4a')]){_0x47e54b[_0xee2f('0x4b')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xee2f('0x4c')](_0x47e54b);})['then'](function(_0x3d95b8){_0x3cbc01[_0xee2f('0x4d')]=_0x3d95b8;return _0x3cbc01;})[_0xee2f('0x2f')](respondWithFilteredResult(_0x4584b8,_0x47e54b))[_0xee2f('0x24')](handleError(_0x4584b8,null));};exports[_0xee2f('0x4e')]=function(_0x4978eb,_0x533ad0){var _0x6a544b={'raw':!![],'where':{'id':_0x4978eb[_0xee2f('0x4f')]['id']}},_0x59bd48={};_0x59bd48[_0xee2f('0x3b')]=_[_0xee2f('0x50')](db[_0xee2f('0x37')]['rawAttributes']);_0x59bd48['query']=_[_0xee2f('0x50')](_0x4978eb[_0xee2f('0x3a')]);_0x59bd48[_0xee2f('0x44')]=_[_0xee2f('0x3d')](_0x59bd48[_0xee2f('0x3b')],_0x59bd48[_0xee2f('0x3a')]);_0x6a544b[_0xee2f('0x3c')]=_[_0xee2f('0x3d')](_0x59bd48[_0xee2f('0x3b')],qs[_0xee2f('0x51')](_0x4978eb[_0xee2f('0x3a')][_0xee2f('0x51')]));_0x6a544b['attributes']=_0x6a544b[_0xee2f('0x3c')][_0xee2f('0x3e')]?_0x6a544b[_0xee2f('0x3c')]:_0x59bd48[_0xee2f('0x3b')];if(_0x4978eb['query'][_0xee2f('0x4a')]){_0x6a544b[_0xee2f('0x4b')]=[{'all':!![]}];}_0x6a544b=_[_0xee2f('0x49')]({},_0x6a544b,_0x4978eb[_0xee2f('0x52')]);return db[_0xee2f('0x37')]['find'](_0x6a544b)[_0xee2f('0x2f')](handleEntityNotFound(_0x533ad0,null))['then'](respondWithResult(_0x533ad0,null))['catch'](handleError(_0x533ad0,null));};exports[_0xee2f('0x53')]=function(_0x3080a9,_0x958e97){return db[_0xee2f('0x37')][_0xee2f('0x53')](_0x3080a9[_0xee2f('0x54')],{})[_0xee2f('0x2f')](respondWithResult(_0x958e97,0xc9))['catch'](handleError(_0x958e97,null));};exports[_0xee2f('0x2e')]=function(_0x5e8fdb,_0x2a9b7a){if(_0x5e8fdb[_0xee2f('0x54')]['id']){delete _0x5e8fdb[_0xee2f('0x54')]['id'];}return db[_0xee2f('0x37')][_0xee2f('0x55')]({'where':{'id':_0x5e8fdb[_0xee2f('0x4f')]['id']}})[_0xee2f('0x2f')](handleEntityNotFound(_0x2a9b7a,null))['then'](saveUpdates(_0x5e8fdb[_0xee2f('0x54')],null))['then'](respondWithResult(_0x2a9b7a,null))[_0xee2f('0x24')](handleError(_0x2a9b7a,null));};exports[_0xee2f('0x30')]=function(_0x1dbbf2,_0x11ba31){return db[_0xee2f('0x37')]['find']({'where':{'id':_0x1dbbf2[_0xee2f('0x4f')]['id']}})[_0xee2f('0x2f')](handleEntityNotFound(_0x11ba31,null))[_0xee2f('0x2f')](removeEntity(_0x11ba31,null))[_0xee2f('0x24')](handleError(_0x11ba31,null));};exports['describe']=function(_0x51dc08,_0x4fb159){return db['OpenchannelMessage']['describe']()[_0xee2f('0x2f')](respondWithResult(_0x4fb159,null))['catch'](handleError(_0x4fb159,null));};var interaction_log=require(_0xee2f('0x56'))(_0xee2f('0x57'));exports[_0xee2f('0x58')]=function(_0x1d1476,_0x3de5e0,_0x318be8){var _0x595b97={'agent':{},'channel':'openchannel'};if(_0x1d1476[_0xee2f('0x54')]['id']){delete _0x1d1476['body']['id'];}_0x1d1476[_0xee2f('0x54')]['read']=!![];_0x1d1476[_0xee2f('0x54')]['readAt']=moment()[_0xee2f('0x59')](_0xee2f('0x5a'));_0x1d1476[_0xee2f('0x54')]['UserId']=_0x1d1476[_0xee2f('0x54')][_0xee2f('0x5b')]||_0x1d1476[_0xee2f('0x5c')]['id'];_0x595b97[_0xee2f('0x5d')]['id']=_0x1d1476[_0xee2f('0x54')][_0xee2f('0x5b')];return db[_0xee2f('0x37')]['find']({'where':{'id':_0x1d1476[_0xee2f('0x4f')]['id'],'UserId':null}})[_0xee2f('0x2f')](handleEntityNotFound(_0x3de5e0,null))[_0xee2f('0x2f')](saveUpdates(_0x1d1476[_0xee2f('0x54')],null))[_0xee2f('0x2f')](function(_0x3c9d47){if(_0x3c9d47){_0x595b97[_0xee2f('0x21')]=_0x3c9d47[_0xee2f('0x5e')]({'plain':!![]});return db[_0xee2f('0x5f')][_0xee2f('0x55')]({'where':{'id':_0x3c9d47[_0xee2f('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x3de5e0,null))[_0xee2f('0x2f')](function(_0xf15bc1){if(_0xf15bc1){return _0xf15bc1['update']({'UserId':_0x1d1476[_0xee2f('0x54')]['UserId'],'read1stAt':_[_0xee2f('0x61')](_0xf15bc1['read1stAt'])?moment()['format'](_0xee2f('0x5a')):undefined});}return null;})[_0xee2f('0x2f')](function(_0x14fe67){if(_0x14fe67){_0x595b97[_0xee2f('0x62')]=_0x14fe67[_0xee2f('0x5e')]({'plain':!![]});interaction_log['info'](_0xee2f('0x63'),_0x1d1476[_0xee2f('0x5c')]['id'],_0x1d1476[_0xee2f('0x5c')]['name'],_0x1d1476[_0xee2f('0x5c')][_0xee2f('0x64')],_0x595b97['interaction']['id'],_0x1d1476[_0xee2f('0x54')]?JSON[_0xee2f('0x1e')](_0x1d1476[_0xee2f('0x54')]):_0xee2f('0x65'));return respondWithRpcPromise(_0xee2f('0x66'),_0xee2f('0x67'),_0x595b97);}return null;})[_0xee2f('0x2f')](function(_0x97edb2){var _0x37935e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x97edb2['message']['ContactId'];return db[_0xee2f('0x68')][_0xee2f('0x3a')](_0x37935e,{'type':db[_0xee2f('0x69')][_0xee2f('0x6a')][_0xee2f('0x6b')],'raw':!![]})['then'](function(_0x2b69f0){return _0x2b69f0;});})[_0xee2f('0x2f')](function(_0x4e39ba){if(_0x4e39ba){_0x595b97[_0xee2f('0x21')][_0xee2f('0x6c')]=_0x4e39ba[0x0];if(!_0x1d1476[_0xee2f('0x54')]['UserId'])return;return db[_0xee2f('0x6d')]['find']({'where':{'id':_0x1d1476[_0xee2f('0x54')][_0xee2f('0x5b')],'role':'agent'},'attributes':['id',_0xee2f('0x33'),_0xee2f('0x6e'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x2cee75){if(!_0x2cee75)return null;_0x595b97['message']['agent']=_0x2cee75;return _0x595b97;})[_0xee2f('0x2f')](function(_0x300c17){if(_0x300c17){if(_0x1d1476['body'][_0xee2f('0x6f')]){_0x595b97['message'][_0xee2f('0x70')]=util[_0xee2f('0x59')](_0xee2f('0x71'),_0x1d1476[_0xee2f('0x5c')][_0xee2f('0x33')]);_0x595b97[_0xee2f('0x21')][_0xee2f('0x72')]=_0x595b97['channel'];_0x595b97[_0xee2f('0x21')][_0xee2f('0x73')]=_0x595b97[_0xee2f('0x72')];_0x595b97[_0xee2f('0x21')][_0xee2f('0x74')]='accept';return respondWithRpcPromise(_0xee2f('0x75'),_0xee2f('0x75'),{'event':_0xee2f('0x76'),'message':_0x595b97[_0xee2f('0x21')]},client9002)[_0xee2f('0x2f')](function(){return _0x595b97;});}return _0x595b97;}return null;})[_0xee2f('0x2f')](respondWithResult(_0x3de5e0,null))['catch'](handleError(_0x3de5e0,null));};var interaction_log=require('../../config/logger')(_0xee2f('0x57'));exports[_0xee2f('0x2d')]=function(_0x3691b3,_0x40d38f,_0x11316b){var _0x266fb7={'agent':{},'channel':_0xee2f('0x77')};if(_0x3691b3['body']['id']){delete _0x3691b3['body']['id'];}_0x3691b3[_0xee2f('0x54')][_0xee2f('0x5b')]=_0x3691b3[_0xee2f('0x54')][_0xee2f('0x5b')]||_0x3691b3[_0xee2f('0x5c')]['id'];_0x266fb7[_0xee2f('0x5d')]['id']=_0x3691b3[_0xee2f('0x54')][_0xee2f('0x5b')];return db[_0xee2f('0x37')][_0xee2f('0x55')]({'where':{'id':_0x3691b3[_0xee2f('0x4f')]['id'],'UserId':null}})[_0xee2f('0x2f')](handleEntityNotFound(_0x40d38f,null))['then'](function(_0x5d74c2){if(_0x5d74c2){_0x266fb7[_0xee2f('0x21')]=_0x5d74c2['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x5d74c2['OpenchannelInteractionId']}});}return null;})[_0xee2f('0x2f')](handleEntityNotFound(_0x40d38f,null))[_0xee2f('0x2f')](function(_0x500459){if(_0x500459){_0x266fb7['interaction']=_0x500459[_0xee2f('0x5e')]({'plain':!![]});interaction_log[_0xee2f('0x1a')](_0xee2f('0x78'),_0x3691b3['user']['id'],_0x3691b3['user'][_0xee2f('0x33')],_0x3691b3[_0xee2f('0x5c')][_0xee2f('0x64')],_0x266fb7['interaction']['id'],_0x3691b3[_0xee2f('0x54')]?JSON['stringify'](_0x3691b3[_0xee2f('0x54')]):'null');return respondWithRpcPromise(_0xee2f('0x79'),_0xee2f('0x7a'),_0x266fb7);}return null;})[_0xee2f('0x2f')](function(_0x47db82){var _0x5a87da=_0xee2f('0x7b')+_0x47db82[_0xee2f('0x21')][_0xee2f('0x7c')];return db['sequelize'][_0xee2f('0x3a')](_0x5a87da,{'type':db[_0xee2f('0x69')][_0xee2f('0x6a')][_0xee2f('0x6b')],'raw':!![]})[_0xee2f('0x2f')](function(_0x2c14f){return _0x2c14f;});})[_0xee2f('0x2f')](function(_0x16326e){if(_0x16326e){_0x266fb7[_0xee2f('0x21')][_0xee2f('0x6c')]=_0x16326e[0x0];if(!_0x3691b3[_0xee2f('0x54')][_0xee2f('0x5b')])return;return db[_0xee2f('0x6d')][_0xee2f('0x55')]({'where':{'id':_0x3691b3['body'][_0xee2f('0x5b')],'role':_0xee2f('0x5d')},'attributes':['id',_0xee2f('0x33'),_0xee2f('0x6e'),_0xee2f('0x7d'),_0xee2f('0x7e')],'raw':!![]});}return null;})[_0xee2f('0x2f')](function(_0x36010e){if(!_0x36010e)return null;_0x266fb7[_0xee2f('0x21')][_0xee2f('0x5d')]=_0x36010e;return _0x266fb7;})[_0xee2f('0x2f')](function(_0x49c92f){if(_0x49c92f){_0x49c92f[_0xee2f('0x21')][_0xee2f('0x70')]=util[_0xee2f('0x59')](_0xee2f('0x71'),_0x3691b3['user'][_0xee2f('0x33')]);_0x49c92f[_0xee2f('0x21')][_0xee2f('0x72')]=_0x266fb7['channel'];_0x49c92f['message'][_0xee2f('0x73')]=_0x266fb7['channel'];_0x49c92f['message']['event']=_0xee2f('0x2d');respondWithRpcPromise(_0xee2f('0x75'),_0xee2f('0x75'),{'event':_0xee2f('0x7f'),'message':_0x49c92f['message']},client9002);return _0x266fb7;}return null;})[_0xee2f('0x2f')](respondWithResult(_0x40d38f,null))[_0xee2f('0x24')](handleError(_0x40d38f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c783443..400bdc9 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 _0x41b4=['emit','hasOwnProperty','exports','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x21ecdd,_0x3d05a6){var _0x433a2e=function(_0x422498){while(--_0x422498){_0x21ecdd['push'](_0x21ecdd['shift']());}};_0x433a2e(++_0x3d05a6);}(_0x41b4,0x199));var _0x441b=function(_0x347ffb,_0x156d2b){_0x347ffb=_0x347ffb-0x0;var _0x330474=_0x41b4[_0x347ffb];return _0x330474;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x441b('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x441b('0x1')](0x0);var events={'afterCreate':_0x441b('0x2'),'afterUpdate':_0x441b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d323e){return function(_0x3cffea,_0x317922,_0x884683){OpenchannelMessageEvents[_0x441b('0x4')](_0x3d323e+':'+_0x3cffea['id'],_0x3cffea);OpenchannelMessageEvents['emit'](_0x3d323e,_0x3cffea);_0x884683(null);};}for(var e in events){if(events[_0x441b('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x441b('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x72cc=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','remove','emit','hook'];(function(_0x2af8b9,_0x5b7f3e){var _0x19d80e=function(_0x2ace0b){while(--_0x2ace0b){_0x2af8b9['push'](_0x2af8b9['shift']());}};_0x19d80e(++_0x5b7f3e);}(_0x72cc,0xc1));var _0xc72c=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x72cc[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require(_0xc72c('0x0'));var OpenchannelMessage=require(_0xc72c('0x1'))['db'][_0xc72c('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc72c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc72c('0x4')};function emitEvent(_0x5c4993){return function(_0xb73ece,_0x301d71,_0x45fff5){OpenchannelMessageEvents['emit'](_0x5c4993+':'+_0xb73ece['id'],_0xb73ece);OpenchannelMessageEvents[_0xc72c('0x5')](_0x5c4993,_0xb73ece);_0x45fff5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xc72c('0x6')](e,emitEvent(event));}}module[_0xc72c('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4bce917..1e48533 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 _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x2fce74,_0x127f8c){var _0x32f5b0=function(_0x5c9e20){while(--_0x5c9e20){_0x2fce74['push'](_0x2fce74['shift']());}};_0x32f5b0(++_0x127f8c);}(_0x1a85,0x178));var _0x51a8=function(_0x3074f1,_0x4901aa){_0x3074f1=_0x3074f1-0x0;var _0x149af8=_0x1a85[_0x3074f1];return _0x149af8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file +var _0x4cf8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','format','body','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','get','replyUri','info'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xe56790,_0x5f304d){_0xe56790=_0xe56790-0x0;var _0x145cf7=_0x4cf8[_0xe56790];return _0x145cf7;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('OpenchannelMessage',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[{'name':_0x84cf('0xe'),'fields':['body'],'type':_0x84cf('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39c6bc,_0x489063,_0xfb5398){var _0x1b223d=_0x50ade2[_0x84cf('0x10')];var _0x369ce6=_0x39c6bc['get']({'plain':!![]});if(_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()==='in'||_0x369ce6['direction']['toLowerCase']()===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]&&!_[_0x84cf('0x15')](_0x369ce6[_0x84cf('0x16')])){_0x1b223d[_0x84cf('0x17')][_0x84cf('0x18')]({'where':{'id':_0x369ce6[_0x84cf('0x19')]}})[_0x84cf('0x1a')](function(_0xced48){if(_0xced48){_0xced48[_0x84cf('0x1b')]({'lastMsgAt':_0x369ce6[_0x84cf('0x1c')],'lastMsgDirection':_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()});}})[_0x84cf('0x1d')](function(_0x27261b){console[_0x84cf('0x1e')](_0x27261b);});}if(_0x369ce6[_0x84cf('0x11')]===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]){var _0x5b8ac8;_0x1b223d[_0x84cf('0x1f')][_0x84cf('0x20')]()[_0x84cf('0x1a')](function(_0x1abe2d){return _0x1b223d[_0x84cf('0x21')][_0x84cf('0x22')]({'where':{'id':_0x369ce6[_0x84cf('0x23')]},'include':[{'model':_0x1b223d['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x369ce6[_0x84cf('0x19')]},'limit':0x1,'include':[{'model':_0x1b223d[_0x84cf('0x1f')],'as':_0x84cf('0x24'),'attributes':_[_0x84cf('0x25')](_0x1abe2d)}]}]});})[_0x84cf('0x1a')](function(_0x5dda3f){_0x5b8ac8=_0x5dda3f[_0x84cf('0x26')]({'plain':!![]});if(_0x5b8ac8&&_0x5b8ac8[_0x84cf('0x27')]){logger[_0x84cf('0x28')](_0x84cf('0x29'),_0x84cf('0x2a'),util['format'](_0x84cf('0x2b'),_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x5b8ac8[_0x84cf('0x2c')]&&_0x5b8ac8[_0x84cf('0x2c')][_0x84cf('0x2d')]){_0x369ce6[_0x84cf('0x2e')]=_[_0x84cf('0x2f')](_0x5b8ac8['Interactions'][0x0],_0x84cf('0x24'));_0x369ce6[_0x84cf('0x24')]=_0x5b8ac8[_0x84cf('0x2c')][0x0][_0x84cf('0x24')];}var _0x489063={'method':_0x84cf('0x30'),'uri':encodeURI(_0x5b8ac8[_0x84cf('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x489063[_0x84cf('0x31')]){case _0x84cf('0x32'):_0x489063['qs']=_0x369ce6;break;case _0x84cf('0x30'):_0x489063['body']=_0x369ce6;break;}return rp(_0x489063)[_0x84cf('0x1a')](function(_0x17bc92){logger[_0x84cf('0x28')](_0x84cf('0x29'),'afterCreate',util[_0x84cf('0x33')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]&&_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]!=_0x369ce6[_0x84cf('0x2e')][_0x84cf('0x35')]){return _0x1b223d[_0x84cf('0x17')][_0x84cf('0x1b')]({'threadId':_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]},{'logging':!![],'where':{'id':_0x369ce6[_0x84cf('0x2e')]['id']}});}else{return;}})[_0x84cf('0x1a')](function(){return _0x39c6bc[_0x84cf('0x1b')]({'read':!![]});})['catch'](function(_0x4852ff){logger[_0x84cf('0x1e')](_0x84cf('0x29'),_0x84cf('0x2a'),util[_0x84cf('0x36')](_0x4852ff,{'showHidden':![],'depth':null}));_0xfb5398();});}else{_0xfb5398();}})[_0x84cf('0x37')](function(){_0xfb5398();});}else{_0xfb5398();}}},'charset':_0x84cf('0x38'),'collate':_0x84cf('0x39')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 225153d..859f37c 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3d77c9,_0x30a00b){var _0x1ad57b=function(_0x52194b){while(--_0x52194b){_0x3d77c9['push'](_0x3d77c9['shift']());}};_0x1ad57b(++_0x30a00b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x12a201,_0x30aaba){_0x12a201=_0x12a201-0x0;var _0x52a4d2=_0x0b0e[_0x12a201];return _0x52a4d2;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x48fb06,_0x5b499a){var _0x3e7dc2=function(_0x5296d3){while(--_0x5296d3){_0x48fb06['push'](_0x48fb06['shift']());}};_0x3e7dc2(++_0x5b499a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7866259..12ad453 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 _0x556c=['register','length','save','remove','removeListener'];(function(_0x65c604,_0x34b4d0){var _0x11391a=function(_0x22bc08){while(--_0x22bc08){_0x65c604['push'](_0x65c604['shift']());}};_0x11391a(++_0x34b4d0);}(_0x556c,0xa7));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xc556('0x0'),_0xc556('0x1'),'update'];function createListener(_0x372e86,_0x157294){return function(_0x1d483b){_0x157294['emit'](_0x372e86,_0x1d483b);};}function removeListener(_0x5c702d,_0x113ce8){return function(){OpenchannelMessageEvents[_0xc556('0x2')](_0x5c702d,_0x113ce8);};}exports[_0xc556('0x3')]=function(_0x1dab9e){for(var _0xff5fc=0x0,_0x478de2=events[_0xc556('0x4')];_0xff5fc<_0x478de2;_0xff5fc++){var _0x3b85b0=events[_0xff5fc];var _0x41c829=createListener('openchannelMessage:'+_0x3b85b0,_0x1dab9e);OpenchannelMessageEvents['on'](_0x3b85b0,_0x41c829);}}; \ No newline at end of file +var _0x89b6=['register','openchannelMessage:','save','emit','removeListener'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x89b6,0xf2));var _0x689b=function(_0x524c03,_0x43b170){_0x524c03=_0x524c03-0x0;var _0x42145e=_0x89b6[_0x524c03];return _0x42145e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x689b('0x0'),'remove','update'];function createListener(_0x528810,_0x3a420e){return function(_0x1c35af){_0x3a420e[_0x689b('0x1')](_0x528810,_0x1c35af);};}function removeListener(_0x5e4db0,_0x22fc03){return function(){OpenchannelMessageEvents[_0x689b('0x2')](_0x5e4db0,_0x22fc03);};}exports[_0x689b('0x3')]=function(_0x6d20e5){for(var _0x81259=0x0,_0x1cdf26=events['length'];_0x81259<_0x1cdf26;_0x81259++){var _0x4c79ea=events[_0x81259];var _0x1fdb33=createListener(_0x689b('0x4')+_0x4c79ea,_0x6d20e5);OpenchannelMessageEvents['on'](_0x4c79ea,_0x1fdb33);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6dbb668..8726b28 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 _0x1835=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x215456,_0x17f9c3){var _0x414884=function(_0x400a2a){while(--_0x400a2a){_0x215456['push'](_0x215456['shift']());}};_0x414884(++_0x17f9c3);}(_0x1835,0xb2));var _0x5183=function(_0x20bf99,_0x598263){_0x20bf99=_0x20bf99-0x0;var _0x57f11a=_0x1835[_0x20bf99];return _0x57f11a;};'use strict';var multer=require(_0x5183('0x0'));var util=require(_0x5183('0x1'));var path=require(_0x5183('0x2'));var timeout=require(_0x5183('0x3'));var express=require(_0x5183('0x4'));var router=express[_0x5183('0x5')]();var fs_extra=require(_0x5183('0x6'));var auth=require(_0x5183('0x7'));var interaction=require(_0x5183('0x8'));var config=require(_0x5183('0x9'));var controller=require(_0x5183('0xa'));router[_0x5183('0xb')]('/',auth[_0x5183('0xc')](),controller[_0x5183('0xd')]);router[_0x5183('0xb')](_0x5183('0xe'),auth[_0x5183('0xc')](),controller[_0x5183('0xf')]);router[_0x5183('0xb')](_0x5183('0x10'),auth[_0x5183('0xc')](),controller['show']);router[_0x5183('0xb')](_0x5183('0x11'),auth[_0x5183('0xc')](),controller[_0x5183('0x12')]);router[_0x5183('0xb')](_0x5183('0x13'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x5183('0x14'),auth[_0x5183('0xc')](),controller[_0x5183('0x15')]);router[_0x5183('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth[_0x5183('0xc')](),controller[_0x5183('0x17')]);router[_0x5183('0x16')](_0x5183('0x14'),auth[_0x5183('0xc')](),controller[_0x5183('0x18')]);router[_0x5183('0x19')](_0x5183('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5183('0x1a')](_0x5183('0x10'),auth['isAuthenticated'](),controller[_0x5183('0x1b')]);router[_0x5183('0x1a')](_0x5183('0x13'),auth[_0x5183('0xc')](),controller[_0x5183('0x1c')]);router[_0x5183('0x1a')](_0x5183('0x14'),auth[_0x5183('0xc')](),controller[_0x5183('0x1d')]);module[_0x5183('0x1e')]=router; \ No newline at end of file +var _0x7f6b=['removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','/:id/users','addAgents','put','update','delete','destroy'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x7f6b,0x1f0));var _0xb7f6=function(_0x3ef9e8,_0x1e386f){_0x3ef9e8=_0x3ef9e8-0x0;var _0x1f40f9=_0x7f6b[_0x3ef9e8];return _0x1f40f9;};'use strict';var multer=require(_0xb7f6('0x0'));var util=require(_0xb7f6('0x1'));var path=require(_0xb7f6('0x2'));var timeout=require(_0xb7f6('0x3'));var express=require(_0xb7f6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7f6('0x5'));var controller=require(_0xb7f6('0x6'));router[_0xb7f6('0x7')]('/',auth['isAuthenticated'](),controller[_0xb7f6('0x8')]);router['get'](_0xb7f6('0x9'),auth[_0xb7f6('0xa')](),controller['describe']);router[_0xb7f6('0x7')](_0xb7f6('0xb'),auth[_0xb7f6('0xa')](),controller['show']);router[_0xb7f6('0x7')](_0xb7f6('0xc'),auth[_0xb7f6('0xa')](),controller[_0xb7f6('0xd')]);router[_0xb7f6('0x7')](_0xb7f6('0xe'),auth[_0xb7f6('0xa')](),controller[_0xb7f6('0xf')]);router[_0xb7f6('0x7')]('/:id/users',auth[_0xb7f6('0xa')](),controller[_0xb7f6('0x10')]);router['post']('/',auth[_0xb7f6('0xa')](),controller['create']);router[_0xb7f6('0x11')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xb7f6('0x11')](_0xb7f6('0x12'),auth[_0xb7f6('0xa')](),controller[_0xb7f6('0x13')]);router[_0xb7f6('0x14')](_0xb7f6('0xb'),auth[_0xb7f6('0xa')](),controller[_0xb7f6('0x15')]);router[_0xb7f6('0x16')](_0xb7f6('0xb'),auth[_0xb7f6('0xa')](),controller[_0xb7f6('0x17')]);router[_0xb7f6('0x16')](_0xb7f6('0xe'),auth[_0xb7f6('0xa')](),controller[_0xb7f6('0x18')]);router['delete'](_0xb7f6('0x12'),auth[_0xb7f6('0xa')](),controller[_0xb7f6('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index b6bd068..9ae39de 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 _0xbc86=['name','INTEGER','beepall','roundrobin','sequelize','exports'];(function(_0x21a92,_0x5c3f82){var _0xf09a5b=function(_0x421dd5){while(--_0x421dd5){_0x21a92['push'](_0x21a92['shift']());}};_0xf09a5b(++_0x5c3f82);}(_0xbc86,0x1f0));var _0x6bc8=function(_0x1c7ea7,_0x17f244){_0x1c7ea7=_0x1c7ea7-0x0;var _0x542383=_0xbc86[_0x1c7ea7];return _0x542383;};'use strict';var Sequelize=require(_0x6bc8('0x0'));module[_0x6bc8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6bc8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6bc8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x6bc8('0x4'),_0x6bc8('0x5'))}}; \ No newline at end of file +var _0xed4b=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x178942,_0x5453b6){var _0x26af2c=function(_0x226e86){while(--_0x226e86){_0x178942['push'](_0x178942['shift']());}};_0x26af2c(++_0x5453b6);}(_0xed4b,0xf5));var _0xbed4=function(_0x1d0ede,_0x1f4305){_0x1d0ede=_0x1d0ede-0x0;var _0x1e11b7=_0xed4b[_0x1d0ede];return _0x1e11b7;};'use strict';var Sequelize=require(_0xbed4('0x0'));module[_0xbed4('0x1')]={'name':{'type':Sequelize[_0xbed4('0x2')],'unique':_0xbed4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbed4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbed4('0x4')](_0xbed4('0x5'),_0xbed4('0x6'),_0xbed4('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 134ec22..7dbd8d7 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 _0x6794=['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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','stack','name','send','OpenchannelQueue','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','fields','length','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','rawAttributes','OpenchannelQueueId','findAll','findAndCountAll','UserId','agent','openchannelPause','format','%s/%s','createdAt','updatedAt','getTeams','addTeams','ids','User','Agents','online','interface','sequelize','UserOpenchannelQueue','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','all','union','transaction','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0xb74427,_0x3ef05c){var _0x5361e3=function(_0x58822e){while(--_0x58822e){_0xb74427['push'](_0xb74427['shift']());}};_0x5361e3(++_0x3ef05c);}(_0x6794,0x1a5));var _0x4679=function(_0x1550b5,_0x632cae){_0x1550b5=_0x1550b5-0x0;var _0x4e2bb3=_0x6794[_0x1550b5];return _0x4e2bb3;};'use strict';var emlformat=require(_0x4679('0x0'));var rimraf=require(_0x4679('0x1'));var zipdir=require(_0x4679('0x2'));var jsonpatch=require(_0x4679('0x3'));var rp=require('request-promise');var moment=require(_0x4679('0x4'));var BPromise=require(_0x4679('0x5'));var Mustache=require(_0x4679('0x6'));var util=require('util');var path=require(_0x4679('0x7'));var sox=require('sox');var csv=require(_0x4679('0x8'));var ejs=require(_0x4679('0x9'));var fs=require('fs');var fs_extra=require(_0x4679('0xa'));var _=require(_0x4679('0xb'));var squel=require(_0x4679('0xc'));var crypto=require(_0x4679('0xd'));var jsforce=require(_0x4679('0xe'));var deskjs=require(_0x4679('0xf'));var toCsv=require(_0x4679('0x8'));var querystring=require('querystring');var Papa=require(_0x4679('0x10'));var Redis=require(_0x4679('0x11'));var authService=require(_0x4679('0x12'));var qs=require(_0x4679('0x13'));var as=require(_0x4679('0x14'));var hardwareService=require(_0x4679('0x15'));var logger=require(_0x4679('0x16'))(_0x4679('0x17'));var utils=require('../../config/utils');var config=require(_0x4679('0x18'));var licenseUtil=require(_0x4679('0x19'));var db=require(_0x4679('0x1a'))['db'];config[_0x4679('0x1b')]=_[_0x4679('0x1c')](config[_0x4679('0x1b')],{'host':_0x4679('0x1d'),'port':0x18eb});var socket=require(_0x4679('0x1e'))(new Redis(config[_0x4679('0x1b')]));require('./openchannelQueue.socket')[_0x4679('0x1f')](socket);function respondWithStatusCode(_0x443d9a,_0x1a6e7a){_0x1a6e7a=_0x1a6e7a||0xcc;return function(_0x2dc789){if(_0x2dc789){return _0x443d9a[_0x4679('0x20')](_0x1a6e7a);}return _0x443d9a['status'](_0x1a6e7a)[_0x4679('0x21')]();};}function respondWithResult(_0x3d5519,_0x8eabbf){_0x8eabbf=_0x8eabbf||0xc8;return function(_0x406795){if(_0x406795){return _0x3d5519[_0x4679('0x22')](_0x8eabbf)['json'](_0x406795);}};}function respondWithFilteredResult(_0x24d97a,_0x2a111a){return function(_0x540e02){if(_0x540e02){var _0xc2846d=typeof _0x2a111a[_0x4679('0x23')]==='undefined'&&typeof _0x2a111a[_0x4679('0x24')]===_0x4679('0x25');var _0x3801d8=_0x540e02[_0x4679('0x26')];var _0x159bb0=_0xc2846d?0x0:_0x2a111a[_0x4679('0x23')];var _0x37f980=_0xc2846d?_0x540e02[_0x4679('0x26')]:_0x2a111a['offset']+_0x2a111a[_0x4679('0x24')];var _0x539333;if(_0x37f980>=_0x3801d8){_0x37f980=_0x3801d8;_0x539333=0xc8;}else{_0x539333=0xce;}_0x24d97a[_0x4679('0x22')](_0x539333);return _0x24d97a[_0x4679('0x27')]('Content-Range',_0x159bb0+'-'+_0x37f980+'/'+_0x3801d8)[_0x4679('0x28')](_0x540e02);}return null;};}function patchUpdates(_0xe8d3d3){return function(_0x2fee4c){try{jsonpatch[_0x4679('0x29')](_0x2fee4c,_0xe8d3d3,!![]);}catch(_0x42ebb4){return BPromise[_0x4679('0x2a')](_0x42ebb4);}return _0x2fee4c[_0x4679('0x2b')]();};}function saveUpdates(_0x43f964,_0x3da4b5){return function(_0x53e2a4){if(_0x53e2a4){return _0x53e2a4[_0x4679('0x2c')](_0x43f964)['then'](function(_0x61f385){return _0x61f385;});}return null;};}function removeEntity(_0x26b0b7,_0xa9042){return function(_0x56968a){if(_0x56968a){return _0x56968a[_0x4679('0x2d')]()[_0x4679('0x2e')](function(){var _0x12b705=_0x56968a[_0x4679('0x2f')]({'plain':!![]});var _0x4dd7cc=_0x4679('0x30');return db['UserProfileResource'][_0x4679('0x2d')]({'where':{'type':_0x4dd7cc,'resourceId':_0x12b705['id']}})['then'](function(){return _0x56968a;});})['then'](function(){_0x26b0b7['status'](0xcc)[_0x4679('0x21')]();});}};}function handleEntityNotFound(_0x3c2b4b,_0x8fa1e3){return function(_0x5eee4b){if(!_0x5eee4b){_0x3c2b4b[_0x4679('0x20')](0x194);}return _0x5eee4b;};}function handleError(_0x6ddd5c,_0x3b202c){_0x3b202c=_0x3b202c||0x1f4;return function(_0x32c9ad){logger[_0x4679('0x31')](_0x32c9ad[_0x4679('0x32')]);if(_0x32c9ad[_0x4679('0x33')]){delete _0x32c9ad['name'];}_0x6ddd5c[_0x4679('0x22')](_0x3b202c)[_0x4679('0x34')](_0x32c9ad);};}exports['index']=function(_0xa338d8,_0x20aa3e){var _0x3de2bc={},_0xe5b06b={},_0x3ea143={'count':0x0,'rows':[]};var _0x52194a=_['map'](db[_0x4679('0x35')]['rawAttributes'],function(_0x5f5cea){return{'name':_0x5f5cea[_0x4679('0x36')],'type':_0x5f5cea[_0x4679('0x37')][_0x4679('0x38')]};});_0xe5b06b[_0x4679('0x39')]=_[_0x4679('0x3a')](_0x52194a,_0x4679('0x33'));_0xe5b06b['query']=_[_0x4679('0x3b')](_0xa338d8[_0x4679('0x3c')]);_0xe5b06b[_0x4679('0x3d')]=_[_0x4679('0x3e')](_0xe5b06b[_0x4679('0x39')],_0xe5b06b['query']);_0x3de2bc[_0x4679('0x3f')]=_[_0x4679('0x3e')](_0xe5b06b[_0x4679('0x39')],qs['fields'](_0xa338d8[_0x4679('0x3c')]['fields']));_0x3de2bc[_0x4679('0x3f')]=_0x3de2bc[_0x4679('0x3f')]['length']?_0x3de2bc[_0x4679('0x3f')]:_0xe5b06b['model'];if(!_0xa338d8[_0x4679('0x3c')][_0x4679('0x40')](_0x4679('0x41'))){_0x3de2bc['limit']=qs[_0x4679('0x24')](_0xa338d8[_0x4679('0x3c')]['limit']);_0x3de2bc[_0x4679('0x23')]=qs['offset'](_0xa338d8[_0x4679('0x3c')][_0x4679('0x23')]);}_0x3de2bc[_0x4679('0x42')]=qs[_0x4679('0x43')](_0xa338d8[_0x4679('0x3c')][_0x4679('0x43')]);_0x3de2bc[_0x4679('0x44')]=qs[_0x4679('0x3d')](_[_0x4679('0x45')](_0xa338d8['query'],_0xe5b06b[_0x4679('0x3d')]),_0x52194a);if(_0xa338d8[_0x4679('0x3c')][_0x4679('0x46')]){_0x3de2bc['where']=_[_0x4679('0x47')](_0x3de2bc[_0x4679('0x44')],{'$or':_[_0x4679('0x3a')](_0x52194a,function(_0x4e7685){if(_0x4e7685['type']!==_0x4679('0x48')){var _0x29083a={};_0x29083a[_0x4e7685[_0x4679('0x33')]]={'$like':'%'+_0xa338d8[_0x4679('0x3c')][_0x4679('0x46')]+'%'};return _0x29083a;}})});}_0x3de2bc=_[_0x4679('0x47')]({},_0x3de2bc,_0xa338d8[_0x4679('0x49')]);var _0x3f7fcf={'where':_0x3de2bc[_0x4679('0x44')]};return db[_0x4679('0x35')][_0x4679('0x26')](_0x3f7fcf)[_0x4679('0x2e')](function(_0x599391){_0x3ea143[_0x4679('0x26')]=_0x599391;if(_0xa338d8['query'][_0x4679('0x4a')]){_0x3de2bc['include']=[{'all':!![]}];}return db[_0x4679('0x35')]['findAll'](_0x3de2bc);})[_0x4679('0x2e')](function(_0xd3cfd4){_0x3ea143[_0x4679('0x4b')]=_0xd3cfd4;return _0x3ea143;})['then'](respondWithFilteredResult(_0x20aa3e,_0x3de2bc))['catch'](handleError(_0x20aa3e,null));};exports[_0x4679('0x4c')]=function(_0x215728,_0xc0619d){var _0xb41a1e={'raw':!![],'where':{'id':_0x215728[_0x4679('0x4d')]['id']}},_0x1e99f3={};_0x1e99f3[_0x4679('0x39')]=_['keys'](db[_0x4679('0x35')]['rawAttributes']);_0x1e99f3[_0x4679('0x3c')]=_['keys'](_0x215728['query']);_0x1e99f3[_0x4679('0x3d')]=_[_0x4679('0x3e')](_0x1e99f3[_0x4679('0x39')],_0x1e99f3[_0x4679('0x3c')]);_0xb41a1e['attributes']=_[_0x4679('0x3e')](_0x1e99f3[_0x4679('0x39')],qs[_0x4679('0x4e')](_0x215728[_0x4679('0x3c')]['fields']));_0xb41a1e[_0x4679('0x3f')]=_0xb41a1e[_0x4679('0x3f')][_0x4679('0x4f')]?_0xb41a1e[_0x4679('0x3f')]:_0x1e99f3['model'];if(_0x215728[_0x4679('0x3c')][_0x4679('0x4a')]){_0xb41a1e[_0x4679('0x50')]=[{'all':!![]}];}_0xb41a1e=_[_0x4679('0x47')]({},_0xb41a1e,_0x215728[_0x4679('0x49')]);return db[_0x4679('0x35')]['find'](_0xb41a1e)[_0x4679('0x2e')](handleEntityNotFound(_0xc0619d,null))[_0x4679('0x2e')](respondWithResult(_0xc0619d,null))[_0x4679('0x51')](handleError(_0xc0619d,null));};exports['create']=function(_0x281c48,_0x4f6895){return db[_0x4679('0x35')][_0x4679('0x52')](_0x281c48[_0x4679('0x53')],{})[_0x4679('0x2e')](function(_0x23a897){var _0x53ad9f=_0x281c48[_0x4679('0x54')]['get']({'plain':!![]});if(!_0x53ad9f)throw new Error(_0x4679('0x55'));if(_0x53ad9f[_0x4679('0x56')]==='user'){var _0x59790f=_0x23a897[_0x4679('0x2f')]({'plain':!![]});var _0x5b797a=_0x4679('0x30');return db[_0x4679('0x57')][_0x4679('0x58')]({'where':{'name':_0x5b797a,'userProfileId':_0x53ad9f[_0x4679('0x59')]},'raw':!![]})[_0x4679('0x2e')](function(_0x8368c3){if(_0x8368c3&&_0x8368c3[_0x4679('0x5a')]===0x0){return db[_0x4679('0x5b')][_0x4679('0x52')]({'name':_0x59790f['name'],'resourceId':_0x59790f['id'],'type':_0x8368c3[_0x4679('0x33')],'sectionId':_0x8368c3['id']},{})[_0x4679('0x2e')](function(){return _0x23a897;});}else{return _0x23a897;}})[_0x4679('0x51')](function(_0x1e57b3){logger[_0x4679('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e57b3);throw _0x1e57b3;});}return _0x23a897;})[_0x4679('0x2e')](respondWithResult(_0x4f6895,0xc9))[_0x4679('0x51')](handleError(_0x4f6895,null));};exports[_0x4679('0x2c')]=function(_0x37929d,_0x22f368){if(_0x37929d[_0x4679('0x53')]['id']){delete _0x37929d['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x37929d['params']['id']}})[_0x4679('0x2e')](handleEntityNotFound(_0x22f368,null))[_0x4679('0x2e')](saveUpdates(_0x37929d[_0x4679('0x53')],null))[_0x4679('0x2e')](respondWithResult(_0x22f368,null))[_0x4679('0x51')](handleError(_0x22f368,null));};exports[_0x4679('0x2d')]=function(_0x38da71,_0x507c9a){return db[_0x4679('0x35')][_0x4679('0x58')]({'where':{'id':_0x38da71['params']['id']}})[_0x4679('0x2e')](handleEntityNotFound(_0x507c9a,null))[_0x4679('0x2e')](removeEntity(_0x507c9a,null))[_0x4679('0x51')](handleError(_0x507c9a,null));};exports[_0x4679('0x5c')]=function(_0x841dc9,_0x5d9545){return db[_0x4679('0x35')][_0x4679('0x5c')]()[_0x4679('0x2e')](respondWithResult(_0x5d9545,null))['catch'](handleError(_0x5d9545,null));};exports[_0x4679('0x5d')]=function(_0x13d883,_0x5a9883,_0x26bd7c){var _0x540755={'raw':!![],'where':{}},_0x46280d={},_0x266d8f;return db['OpenchannelQueue'][_0x4679('0x5e')]({'where':{'id':_0x13d883[_0x4679('0x4d')]['id']}})[_0x4679('0x2e')](handleEntityNotFound(_0x5a9883,null))[_0x4679('0x2e')](function(_0x1cab50){if(_0x1cab50){_0x266d8f=_0x1cab50['get']({'plain':!![]});_0x46280d[_0x4679('0x39')]=_[_0x4679('0x3b')](db['UserOpenchannelQueue'][_0x4679('0x5f')]);_0x46280d[_0x4679('0x3c')]=_[_0x4679('0x3b')](_0x13d883['query']);_0x46280d[_0x4679('0x3d')]=_['intersection'](_0x46280d[_0x4679('0x39')],_0x46280d[_0x4679('0x3c')]);_0x540755[_0x4679('0x3f')]=_['intersection'](_0x46280d[_0x4679('0x39')],qs[_0x4679('0x4e')](_0x13d883[_0x4679('0x3c')][_0x4679('0x4e')]));_0x540755[_0x4679('0x3f')]=_0x540755[_0x4679('0x3f')][_0x4679('0x4f')]?_0x540755[_0x4679('0x3f')]:_0x46280d[_0x4679('0x39')];if(!_0x13d883['query'][_0x4679('0x40')](_0x4679('0x41'))){_0x540755[_0x4679('0x24')]=qs[_0x4679('0x24')](_0x13d883['query'][_0x4679('0x24')]);_0x540755[_0x4679('0x23')]=qs['offset'](_0x13d883[_0x4679('0x3c')][_0x4679('0x23')]);}_0x540755['order']=qs[_0x4679('0x43')](_0x13d883[_0x4679('0x3c')]['sort']);_0x540755[_0x4679('0x44')]=qs[_0x4679('0x3d')](_[_0x4679('0x45')](_0x13d883[_0x4679('0x3c')],_0x46280d[_0x4679('0x3d')]));_0x540755[_0x4679('0x44')][_0x4679('0x60')]=_0x1cab50['id'];if(_0x13d883[_0x4679('0x3c')][_0x4679('0x46')]){_0x540755[_0x4679('0x44')]=_['merge'](_0x540755[_0x4679('0x44')],{'$or':_[_0x4679('0x3a')](_0x540755[_0x4679('0x3f')],function(_0x46e23e){var _0x4e16dd={};_0x4e16dd[_0x46e23e]={'$like':'%'+_0x13d883[_0x4679('0x3c')]['filter']+'%'};return _0x4e16dd;})});}_0x540755=_[_0x4679('0x47')]({},_0x540755,_0x13d883[_0x4679('0x49')]);return db['UserOpenchannelQueue'][_0x4679('0x61')](_0x540755);}})[_0x4679('0x2e')](function(_0x30585e){if(_0x30585e){return db['User'][_0x4679('0x62')]({'where':{'id':_['map'](_0x30585e,_0x4679('0x63')),'role':_0x4679('0x64')},'attributes':['id',_0x4679('0x33'),_0x4679('0x65'),'updatedAt','createdAt']});}})[_0x4679('0x2e')](function(_0x315564){if(_0x315564){return{'count':_0x315564[_0x4679('0x26')],'rows':_[_0x4679('0x3a')](_0x315564[_0x4679('0x4b')],function(_0x5f3042){return{'membername':_0x5f3042['name'],'UserId':_0x5f3042['id'],'queue_name':_0x266d8f[_0x4679('0x33')],'OpenchannelQueueId':_0x266d8f['id'],'interface':util[_0x4679('0x66')](_0x4679('0x67'),'SIP',_0x5f3042[_0x4679('0x33')]),'penalty':0x0,'paused':_0x5f3042[_0x4679('0x65')],'createdAt':_0x5f3042[_0x4679('0x68')],'updatedAt':_0x5f3042[_0x4679('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4679('0x2e')](respondWithFilteredResult(_0x5a9883,_0x540755))['catch'](handleError(_0x5a9883,null));};exports[_0x4679('0x6a')]=function(_0xbc04ee,_0x226f03,_0x574b8a){var _0x40dd20={};var _0x3be2de={};var _0x2abe96;var _0x594b81;return db[_0x4679('0x35')][_0x4679('0x5e')]({'where':{'id':_0xbc04ee[_0x4679('0x4d')]['id']}})[_0x4679('0x2e')](handleEntityNotFound(_0x226f03,null))[_0x4679('0x2e')](function(_0x265c6f){if(_0x265c6f){_0x2abe96=_0x265c6f;_0x3be2de[_0x4679('0x39')]=_[_0x4679('0x3b')](db['Team']['rawAttributes']);_0x3be2de['query']=_[_0x4679('0x3b')](_0xbc04ee[_0x4679('0x3c')]);_0x3be2de[_0x4679('0x3d')]=_['intersection'](_0x3be2de[_0x4679('0x39')],_0x3be2de['query']);_0x40dd20[_0x4679('0x3f')]=_[_0x4679('0x3e')](_0x3be2de['model'],qs[_0x4679('0x4e')](_0xbc04ee['query'][_0x4679('0x4e')]));_0x40dd20[_0x4679('0x3f')]=_0x40dd20[_0x4679('0x3f')][_0x4679('0x4f')]?_0x40dd20[_0x4679('0x3f')]:_0x3be2de[_0x4679('0x39')];_0x40dd20[_0x4679('0x42')]=qs['sort'](_0xbc04ee['query'][_0x4679('0x43')]);_0x40dd20[_0x4679('0x44')]=qs[_0x4679('0x3d')](_['pick'](_0xbc04ee[_0x4679('0x3c')],_0x3be2de[_0x4679('0x3d')]));if(_0xbc04ee[_0x4679('0x3c')][_0x4679('0x46')]){_0x40dd20[_0x4679('0x44')]=_[_0x4679('0x47')](_0x40dd20[_0x4679('0x44')],{'$or':_[_0x4679('0x3a')](_0x40dd20['attributes'],function(_0x3895fd){var _0x27a6fa={};_0x27a6fa[_0x3895fd]={'$like':'%'+_0xbc04ee['query'][_0x4679('0x46')]+'%'};return _0x27a6fa;})});}_0x40dd20=_[_0x4679('0x47')]({},_0x40dd20,_0xbc04ee['options']);return _0x2abe96['getTeams'](_0x40dd20);}})['then'](function(_0xcb1012){if(_0xcb1012){_0x594b81=_0xcb1012[_0x4679('0x4f')];if(!_0xbc04ee['query']['hasOwnProperty'](_0x4679('0x41'))){_0x40dd20[_0x4679('0x24')]=qs['limit'](_0xbc04ee[_0x4679('0x3c')][_0x4679('0x24')]);_0x40dd20['offset']=qs[_0x4679('0x23')](_0xbc04ee['query'][_0x4679('0x23')]);}return _0x2abe96[_0x4679('0x6a')](_0x40dd20);}})[_0x4679('0x2e')](function(_0x2901a7){if(_0x2901a7){return _0x2901a7?{'count':_0x594b81,'rows':_0x2901a7}:null;}})[_0x4679('0x2e')](respondWithResult(_0x226f03,null))[_0x4679('0x51')](handleError(_0x226f03,null));};exports[_0x4679('0x6b')]=function(_0x5ba63f,_0x5ce53f,_0x6f260c){var _0x204dfc=_0x5ba63f[_0x4679('0x53')][_0x4679('0x6c')];return db['Team'][_0x4679('0x61')]({'where':{'id':_0x204dfc},'attributes':['id'],'include':[{'model':db[_0x4679('0x6d')],'as':_0x4679('0x6e'),'attributes':['id',_0x4679('0x33'),_0x4679('0x6f'),'voicePause',_0x4679('0x70')],'raw':!![]}]})['then'](function(_0x2d0bb4){if(_0x2d0bb4){var _0x4f7447=_['flatMap'](_0x2d0bb4,function(_0x583c5a){var _0xc7930e=_0x583c5a[_0x4679('0x2f')]({'plain':!![]});return _0xc7930e[_0x4679('0x6e')];});return db[_0x4679('0x35')][_0x4679('0x58')]({'where':{'id':_0x5ba63f['params']['id']}})[_0x4679('0x2e')](function(_0x16858f){return db[_0x4679('0x71')]['transaction'](function(_0x284be8){return _0x16858f[_0x4679('0x6b')](_0x204dfc,{'transaction':_0x284be8})[_0x4679('0x2e')](function(){return BPromise['each'](_0x4f7447,function(_0x3f85de){return db[_0x4679('0x72')][_0x4679('0x73')]({'where':{'UserId':_0x3f85de['id'],'OpenchannelQueueId':_0x5ba63f[_0x4679('0x4d')]['id']},'transaction':_0x284be8});});})[_0x4679('0x2e')](function(){_0x4f7447['forEach'](function(_0x159cab){socket[_0x4679('0x74')](_0x4679('0x75'),{'UserId':_0x159cab['id'],'OpenchannelQueueId':_0x16858f['id']});});});});});}})[_0x4679('0x2e')](respondWithStatusCode(_0x5ce53f,null))[_0x4679('0x51')](handleError(_0x5ce53f,null));};exports[_0x4679('0x76')]=function(_0x34dbd7,_0x9890aa,_0x35adef){return db[_0x4679('0x77')]['findAll']({'where':{'id':_0x34dbd7[_0x4679('0x3c')][_0x4679('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4679('0x2e')](handleEntityNotFound(_0x9890aa,null))[_0x4679('0x2e')](function(_0x3ade78){var _0x4559dd=_[_0x4679('0x3a')](_0x3ade78,'id');var _0x35c47e=[];var _0x39d391=[];var _0x17bd38=squel['select']();_0x17bd38[_0x4679('0x78')](_0x4679('0x79'))[_0x4679('0x7a')](_0x4679('0x7b'),'tq')[_0x4679('0x7c')](_0x4679('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x4679('0x7e'),_0x34dbd7[_0x4679('0x4d')]['id']);for(var _0x30261e=0x0;_0x30261e<_0x3ade78['length'];_0x30261e+=0x1){let _0x124523=_0x3ade78[_0x30261e];for(var _0x41a34f=0x0;_0x41a34f<_0x124523[_0x4679('0x6e')][_0x4679('0x4f')];_0x41a34f+=0x1){let _0x8fb4ee=_0x124523['Agents'][_0x41a34f];var _0x27150e=_0x17bd38['clone']();_0x27150e[_0x4679('0x44')](_0x4679('0x7f'),_0x8fb4ee['id']);_0x39d391[_0x4679('0x80')](db[_0x4679('0x71')][_0x4679('0x3c')](_0x27150e['toString'](),{'type':db[_0x4679('0x71')][_0x4679('0x81')]['SELECT']})[_0x4679('0x2e')](function(_0x4b9982){if(_0x4b9982[_0x4679('0x4f')]===0x1){return _0x8fb4ee['id'];}else{var _0x4a8897=_[_0x4679('0x82')](_[_0x4679('0x3a')](_0x4b9982,'TeamId'),function(_0x561a1f){return _[_0x4679('0x83')](_0x4559dd,_0x561a1f);});if(_0x4a8897){return _0x8fb4ee['id'];}}}));}}return BPromise[_0x4679('0x84')](_0x39d391)[_0x4679('0x2e')](function(_0x5b5d3e){_0x35c47e=_(_0x35c47e)[_0x4679('0x85')](_0x5b5d3e)['compact']()['value']();return db[_0x4679('0x35')][_0x4679('0x58')]({'where':{'id':_0x34dbd7[_0x4679('0x4d')]['id']}})[_0x4679('0x2e')](function(_0x4d5ec6){return db['sequelize'][_0x4679('0x86')](function(_0x44eeac){return _0x4d5ec6['removeTeams'](_0x34dbd7[_0x4679('0x3c')][_0x4679('0x6c')],{'transaction':_0x44eeac})[_0x4679('0x2e')](function(){if(!_[_0x4679('0x87')](_0x35c47e)){return _0x4d5ec6[_0x4679('0x88')](_0x35c47e,{'transaction':_0x44eeac});}})['then'](function(){_0x35c47e[_0x4679('0x89')](function(_0x4173f5){socket['emit'](_0x4679('0x8a'),{'UserId':_0x4173f5,'OpenchannelQueueId':_0x4d5ec6['id']});});});});});});})[_0x4679('0x2e')](respondWithStatusCode(_0x9890aa,null))['catch'](handleError(_0x9890aa,null));};exports[_0x4679('0x8b')]=function(_0x17b246,_0x50b31b,_0x52fc98){return db[_0x4679('0x35')]['find']({'where':{'id':_0x17b246[_0x4679('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50b31b,null))[_0x4679('0x2e')](function(_0x1d26fe){if(_0x1d26fe){return _0x1d26fe[_0x4679('0x8b')](_0x17b246['body'][_0x4679('0x6c')],_[_0x4679('0x8c')](_0x17b246[_0x4679('0x53')],[_0x4679('0x6c'),'id'])||{})['spread'](function(_0x21feaa){for(var _0x168a95=0x0;_0x168a95<_0x17b246[_0x4679('0x53')]['ids']['length'];_0x168a95+=0x1){socket[_0x4679('0x74')](_0x4679('0x75'),{'UserId':Number(_0x17b246[_0x4679('0x53')]['ids'][_0x168a95]),'OpenchannelQueueId':Number(_0x17b246[_0x4679('0x4d')]['id'])});}return _0x21feaa;});}})['then'](respondWithResult(_0x50b31b,null))[_0x4679('0x51')](handleError(_0x50b31b,null));};exports[_0x4679('0x88')]=function(_0x8de748,_0x2c23e0,_0x1cc116){return db[_0x4679('0x35')][_0x4679('0x58')]({'where':{'id':_0x8de748[_0x4679('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c23e0,null))[_0x4679('0x2e')](function(_0xd32052){if(_0xd32052){return _0xd32052['removeAgents'](_0x8de748[_0x4679('0x3c')]['ids'])['then'](function(){if(_[_0x4679('0x8d')](_0x8de748['query'][_0x4679('0x6c')])){for(var _0x239931=0x0;_0x239931<_0x8de748[_0x4679('0x3c')][_0x4679('0x6c')][_0x4679('0x4f')];_0x239931+=0x1){socket[_0x4679('0x74')](_0x4679('0x8a'),{'UserId':Number(_0x8de748[_0x4679('0x3c')][_0x4679('0x6c')][_0x239931]),'OpenchannelQueueId':Number(_0x8de748[_0x4679('0x4d')]['id'])});}}else{socket['emit'](_0x4679('0x8a'),{'UserId':Number(_0x8de748['query'][_0x4679('0x6c')]),'OpenchannelQueueId':Number(_0x8de748[_0x4679('0x4d')]['id'])});}});}})[_0x4679('0x2e')](respondWithStatusCode(_0x2c23e0,null))['catch'](handleError(_0x2c23e0,null));};exports['getAgents']=function(_0x453477,_0x2a0790,_0x10ff7a){var _0x2b4990={};var _0x4fd551={};var _0x1dd812;var _0x10f386;return db[_0x4679('0x35')][_0x4679('0x5e')]({'where':{'id':_0x453477['params']['id']}})['then'](handleEntityNotFound(_0x2a0790,null))[_0x4679('0x2e')](function(_0x5a974e){if(_0x5a974e){_0x1dd812=_0x5a974e;_0x4fd551[_0x4679('0x39')]=_[_0x4679('0x3b')](db[_0x4679('0x6d')][_0x4679('0x5f')]);_0x4fd551[_0x4679('0x3c')]=_[_0x4679('0x3b')](_0x453477[_0x4679('0x3c')]);_0x4fd551[_0x4679('0x3d')]=_['intersection'](_0x4fd551[_0x4679('0x39')],_0x4fd551[_0x4679('0x3c')]);_0x2b4990[_0x4679('0x3f')]=_[_0x4679('0x3e')](_0x4fd551[_0x4679('0x39')],qs[_0x4679('0x4e')](_0x453477[_0x4679('0x3c')][_0x4679('0x4e')]));_0x2b4990[_0x4679('0x3f')]=_0x2b4990['attributes'][_0x4679('0x4f')]?_0x2b4990[_0x4679('0x3f')]:_0x4fd551[_0x4679('0x39')];_0x2b4990[_0x4679('0x42')]=qs['sort'](_0x453477[_0x4679('0x3c')][_0x4679('0x43')]);_0x2b4990['where']=qs['filters'](_[_0x4679('0x45')](_0x453477['query'],_0x4fd551['filters']));if(_0x453477[_0x4679('0x3c')][_0x4679('0x46')]){_0x2b4990[_0x4679('0x44')]=_[_0x4679('0x47')](_0x2b4990[_0x4679('0x44')],{'$or':_['map'](_0x2b4990['attributes'],function(_0x3b88b3){var _0x530f72={};_0x530f72[_0x3b88b3]={'$like':'%'+_0x453477[_0x4679('0x3c')][_0x4679('0x46')]+'%'};return _0x530f72;})});}_0x2b4990=_['merge']({},_0x2b4990,_0x453477[_0x4679('0x49')]);return _0x1dd812['getAgents'](_0x2b4990);}})[_0x4679('0x2e')](function(_0x29453a){if(_0x29453a){_0x10f386=_0x29453a['length'];if(!_0x453477['query']['hasOwnProperty']('nolimit')){_0x2b4990[_0x4679('0x24')]=qs[_0x4679('0x24')](_0x453477[_0x4679('0x3c')][_0x4679('0x24')]);_0x2b4990['offset']=qs[_0x4679('0x23')](_0x453477[_0x4679('0x3c')][_0x4679('0x23')]);}return _0x1dd812[_0x4679('0x8e')](_0x2b4990);}})['then'](function(_0x228f4f){if(_0x228f4f){return _0x228f4f?{'count':_0x10f386,'rows':_0x228f4f}:null;}})[_0x4679('0x2e')](respondWithResult(_0x2a0790,null))[_0x4679('0x51')](handleError(_0x2a0790,null));}; \ No newline at end of file +var _0xcaca=['union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','merge','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','keys','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','QueryTypes'];(function(_0x530748,_0x465279){var _0x103df1=function(_0x3710ef){while(--_0x3710ef){_0x530748['push'](_0x530748['shift']());}};_0x103df1(++_0x465279);}(_0xcaca,0x125));var _0xacac=function(_0x498998,_0x5ada0d){_0x498998=_0x498998-0x0;var _0x480fae=_0xcaca[_0x498998];return _0x480fae;};'use strict';var emlformat=require(_0xacac('0x0'));var rimraf=require(_0xacac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xacac('0x2'));var moment=require(_0xacac('0x3'));var BPromise=require(_0xacac('0x4'));var Mustache=require(_0xacac('0x5'));var util=require(_0xacac('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xacac('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xacac('0x8'));var _=require(_0xacac('0x9'));var squel=require(_0xacac('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xacac('0xb'));var toCsv=require(_0xacac('0x7'));var querystring=require(_0xacac('0xc'));var Papa=require(_0xacac('0xd'));var Redis=require(_0xacac('0xe'));var authService=require(_0xacac('0xf'));var qs=require(_0xacac('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacac('0x11'));var logger=require(_0xacac('0x12'))('api');var utils=require(_0xacac('0x13'));var config=require(_0xacac('0x14'));var licenseUtil=require(_0xacac('0x15'));var db=require(_0xacac('0x16'))['db'];config[_0xacac('0x17')]=_['defaults'](config[_0xacac('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xacac('0x18'))(new Redis(config[_0xacac('0x17')]));require(_0xacac('0x19'))[_0xacac('0x1a')](socket);function respondWithStatusCode(_0x5dfec4,_0x1ff187){_0x1ff187=_0x1ff187||0xcc;return function(_0x4b78af){if(_0x4b78af){return _0x5dfec4[_0xacac('0x1b')](_0x1ff187);}return _0x5dfec4[_0xacac('0x1c')](_0x1ff187)[_0xacac('0x1d')]();};}function respondWithResult(_0x1a7930,_0x4dd9e5){_0x4dd9e5=_0x4dd9e5||0xc8;return function(_0x921212){if(_0x921212){return _0x1a7930[_0xacac('0x1c')](_0x4dd9e5)[_0xacac('0x1e')](_0x921212);}};}function respondWithFilteredResult(_0x5c6b25,_0x3cdb89){return function(_0x193545){if(_0x193545){var _0x3f911f=typeof _0x3cdb89['offset']===_0xacac('0x1f')&&typeof _0x3cdb89[_0xacac('0x20')]===_0xacac('0x1f');var _0x35299e=_0x193545[_0xacac('0x21')];var _0x38fe1a=_0x3f911f?0x0:_0x3cdb89['offset'];var _0x43ccc6=_0x3f911f?_0x193545['count']:_0x3cdb89[_0xacac('0x22')]+_0x3cdb89[_0xacac('0x20')];var _0x57cbc0;if(_0x43ccc6>=_0x35299e){_0x43ccc6=_0x35299e;_0x57cbc0=0xc8;}else{_0x57cbc0=0xce;}_0x5c6b25[_0xacac('0x1c')](_0x57cbc0);return _0x5c6b25[_0xacac('0x23')](_0xacac('0x24'),_0x38fe1a+'-'+_0x43ccc6+'/'+_0x35299e)[_0xacac('0x1e')](_0x193545);}return null;};}function patchUpdates(_0x435ba4){return function(_0x478c3e){try{jsonpatch['apply'](_0x478c3e,_0x435ba4,!![]);}catch(_0x12dd05){return BPromise[_0xacac('0x25')](_0x12dd05);}return _0x478c3e[_0xacac('0x26')]();};}function saveUpdates(_0x4dd799,_0x19ee64){return function(_0x58e556){if(_0x58e556){return _0x58e556[_0xacac('0x27')](_0x4dd799)[_0xacac('0x28')](function(_0x209813){return _0x209813;});}return null;};}function removeEntity(_0x43ba49,_0x3d0748){return function(_0x6fd778){if(_0x6fd778){return _0x6fd778['destroy']()[_0xacac('0x28')](function(){var _0x27bcb5=_0x6fd778[_0xacac('0x29')]({'plain':!![]});var _0x469f03=_0xacac('0x2a');return db[_0xacac('0x2b')][_0xacac('0x2c')]({'where':{'type':_0x469f03,'resourceId':_0x27bcb5['id']}})[_0xacac('0x28')](function(){return _0x6fd778;});})[_0xacac('0x28')](function(){_0x43ba49[_0xacac('0x1c')](0xcc)[_0xacac('0x1d')]();});}};}function handleEntityNotFound(_0x3b390e,_0x23e2a0){return function(_0x333361){if(!_0x333361){_0x3b390e[_0xacac('0x1b')](0x194);}return _0x333361;};}function handleError(_0x16197c,_0x36f0d9){_0x36f0d9=_0x36f0d9||0x1f4;return function(_0x434124){logger[_0xacac('0x2d')](_0x434124[_0xacac('0x2e')]);if(_0x434124[_0xacac('0x2f')]){delete _0x434124['name'];}_0x16197c[_0xacac('0x1c')](_0x36f0d9)[_0xacac('0x30')](_0x434124);};}exports[_0xacac('0x31')]=function(_0x5d2ff6,_0x2bc018){var _0x398ab4={},_0xcb5a9e={},_0x5846c8={'count':0x0,'rows':[]};var _0x40a272=_[_0xacac('0x32')](db[_0xacac('0x33')][_0xacac('0x34')],function(_0x5c242b){return{'name':_0x5c242b['fieldName'],'type':_0x5c242b[_0xacac('0x35')][_0xacac('0x36')]};});_0xcb5a9e[_0xacac('0x37')]=_['map'](_0x40a272,_0xacac('0x2f'));_0xcb5a9e[_0xacac('0x38')]=_['keys'](_0x5d2ff6[_0xacac('0x38')]);_0xcb5a9e['filters']=_[_0xacac('0x39')](_0xcb5a9e[_0xacac('0x37')],_0xcb5a9e[_0xacac('0x38')]);_0x398ab4['attributes']=_[_0xacac('0x39')](_0xcb5a9e[_0xacac('0x37')],qs[_0xacac('0x3a')](_0x5d2ff6[_0xacac('0x38')][_0xacac('0x3a')]));_0x398ab4[_0xacac('0x3b')]=_0x398ab4[_0xacac('0x3b')][_0xacac('0x3c')]?_0x398ab4[_0xacac('0x3b')]:_0xcb5a9e[_0xacac('0x37')];if(!_0x5d2ff6[_0xacac('0x38')][_0xacac('0x3d')](_0xacac('0x3e'))){_0x398ab4['limit']=qs[_0xacac('0x20')](_0x5d2ff6['query'][_0xacac('0x20')]);_0x398ab4[_0xacac('0x22')]=qs[_0xacac('0x22')](_0x5d2ff6[_0xacac('0x38')][_0xacac('0x22')]);}_0x398ab4[_0xacac('0x3f')]=qs[_0xacac('0x40')](_0x5d2ff6['query'][_0xacac('0x40')]);_0x398ab4[_0xacac('0x41')]=qs['filters'](_[_0xacac('0x42')](_0x5d2ff6['query'],_0xcb5a9e['filters']),_0x40a272);if(_0x5d2ff6[_0xacac('0x38')][_0xacac('0x43')]){_0x398ab4[_0xacac('0x41')]=_['merge'](_0x398ab4['where'],{'$or':_[_0xacac('0x32')](_0x40a272,function(_0x58fd46){if(_0x58fd46[_0xacac('0x35')]!==_0xacac('0x44')){var _0x4ad87e={};_0x4ad87e[_0x58fd46[_0xacac('0x2f')]]={'$like':'%'+_0x5d2ff6['query'][_0xacac('0x43')]+'%'};return _0x4ad87e;}})});}_0x398ab4=_['merge']({},_0x398ab4,_0x5d2ff6[_0xacac('0x45')]);var _0x1cfef0={'where':_0x398ab4[_0xacac('0x41')]};return db[_0xacac('0x33')][_0xacac('0x21')](_0x1cfef0)['then'](function(_0xd801b6){_0x5846c8['count']=_0xd801b6;if(_0x5d2ff6[_0xacac('0x38')][_0xacac('0x46')]){_0x398ab4[_0xacac('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xacac('0x48')](_0x398ab4);})[_0xacac('0x28')](function(_0x443ee5){_0x5846c8[_0xacac('0x49')]=_0x443ee5;return _0x5846c8;})['then'](respondWithFilteredResult(_0x2bc018,_0x398ab4))[_0xacac('0x4a')](handleError(_0x2bc018,null));};exports[_0xacac('0x4b')]=function(_0x459ea9,_0x91d758){var _0x332b5d={'raw':!![],'where':{'id':_0x459ea9[_0xacac('0x4c')]['id']}},_0x18c97b={};_0x18c97b[_0xacac('0x37')]=_['keys'](db[_0xacac('0x33')][_0xacac('0x34')]);_0x18c97b['query']=_['keys'](_0x459ea9[_0xacac('0x38')]);_0x18c97b[_0xacac('0x4d')]=_[_0xacac('0x39')](_0x18c97b[_0xacac('0x37')],_0x18c97b['query']);_0x332b5d[_0xacac('0x3b')]=_[_0xacac('0x39')](_0x18c97b[_0xacac('0x37')],qs[_0xacac('0x3a')](_0x459ea9[_0xacac('0x38')][_0xacac('0x3a')]));_0x332b5d['attributes']=_0x332b5d[_0xacac('0x3b')][_0xacac('0x3c')]?_0x332b5d[_0xacac('0x3b')]:_0x18c97b['model'];if(_0x459ea9['query'][_0xacac('0x46')]){_0x332b5d[_0xacac('0x47')]=[{'all':!![]}];}_0x332b5d=_[_0xacac('0x4e')]({},_0x332b5d,_0x459ea9[_0xacac('0x45')]);return db['OpenchannelQueue'][_0xacac('0x4f')](_0x332b5d)['then'](handleEntityNotFound(_0x91d758,null))[_0xacac('0x28')](respondWithResult(_0x91d758,null))[_0xacac('0x4a')](handleError(_0x91d758,null));};exports[_0xacac('0x50')]=function(_0x3dad1a,_0x500d70){return db['OpenchannelQueue'][_0xacac('0x50')](_0x3dad1a['body'],{})[_0xacac('0x28')](function(_0x1ff5c8){var _0x56850f=_0x3dad1a[_0xacac('0x51')][_0xacac('0x29')]({'plain':!![]});if(!_0x56850f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56850f[_0xacac('0x52')]==='user'){var _0x4a1629=_0x1ff5c8[_0xacac('0x29')]({'plain':!![]});var _0x46d5e8=_0xacac('0x2a');return db[_0xacac('0x53')]['find']({'where':{'name':_0x46d5e8,'userProfileId':_0x56850f['userProfileId']},'raw':!![]})['then'](function(_0x1981ba){if(_0x1981ba&&_0x1981ba[_0xacac('0x54')]===0x0){return db[_0xacac('0x2b')][_0xacac('0x50')]({'name':_0x4a1629[_0xacac('0x2f')],'resourceId':_0x4a1629['id'],'type':_0x1981ba[_0xacac('0x2f')],'sectionId':_0x1981ba['id']},{})[_0xacac('0x28')](function(){return _0x1ff5c8;});}else{return _0x1ff5c8;}})['catch'](function(_0x4f815d){logger[_0xacac('0x2d')](_0xacac('0x55'),_0x4f815d);throw _0x4f815d;});}return _0x1ff5c8;})[_0xacac('0x28')](respondWithResult(_0x500d70,0xc9))[_0xacac('0x4a')](handleError(_0x500d70,null));};exports[_0xacac('0x27')]=function(_0x62c29d,_0x3467c3){if(_0x62c29d[_0xacac('0x56')]['id']){delete _0x62c29d['body']['id'];}return db[_0xacac('0x33')]['find']({'where':{'id':_0x62c29d[_0xacac('0x4c')]['id']}})[_0xacac('0x28')](handleEntityNotFound(_0x3467c3,null))[_0xacac('0x28')](saveUpdates(_0x62c29d[_0xacac('0x56')],null))[_0xacac('0x28')](respondWithResult(_0x3467c3,null))['catch'](handleError(_0x3467c3,null));};exports[_0xacac('0x2c')]=function(_0x30387a,_0x5bb2c1){return db[_0xacac('0x33')][_0xacac('0x4f')]({'where':{'id':_0x30387a[_0xacac('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5bb2c1,null))[_0xacac('0x28')](removeEntity(_0x5bb2c1,null))[_0xacac('0x4a')](handleError(_0x5bb2c1,null));};exports['describe']=function(_0x3429a2,_0x366731){return db[_0xacac('0x33')][_0xacac('0x57')]()['then'](respondWithResult(_0x366731,null))['catch'](handleError(_0x366731,null));};exports[_0xacac('0x58')]=function(_0x4b6b0e,_0x3ffb90,_0x4a8f44){var _0x5345f6={'raw':!![],'where':{}},_0x324a13={},_0x17bb9b;return db[_0xacac('0x33')]['findOne']({'where':{'id':_0x4b6b0e[_0xacac('0x4c')]['id']}})[_0xacac('0x28')](handleEntityNotFound(_0x3ffb90,null))[_0xacac('0x28')](function(_0x3b0a0c){if(_0x3b0a0c){_0x17bb9b=_0x3b0a0c[_0xacac('0x29')]({'plain':!![]});_0x324a13['model']=_[_0xacac('0x59')](db[_0xacac('0x5a')][_0xacac('0x34')]);_0x324a13[_0xacac('0x38')]=_['keys'](_0x4b6b0e['query']);_0x324a13[_0xacac('0x4d')]=_[_0xacac('0x39')](_0x324a13[_0xacac('0x37')],_0x324a13['query']);_0x5345f6[_0xacac('0x3b')]=_['intersection'](_0x324a13[_0xacac('0x37')],qs[_0xacac('0x3a')](_0x4b6b0e[_0xacac('0x38')]['fields']));_0x5345f6['attributes']=_0x5345f6['attributes'][_0xacac('0x3c')]?_0x5345f6['attributes']:_0x324a13['model'];if(!_0x4b6b0e[_0xacac('0x38')]['hasOwnProperty'](_0xacac('0x3e'))){_0x5345f6[_0xacac('0x20')]=qs[_0xacac('0x20')](_0x4b6b0e[_0xacac('0x38')][_0xacac('0x20')]);_0x5345f6[_0xacac('0x22')]=qs['offset'](_0x4b6b0e[_0xacac('0x38')][_0xacac('0x22')]);}_0x5345f6['order']=qs[_0xacac('0x40')](_0x4b6b0e[_0xacac('0x38')]['sort']);_0x5345f6[_0xacac('0x41')]=qs['filters'](_[_0xacac('0x42')](_0x4b6b0e[_0xacac('0x38')],_0x324a13[_0xacac('0x4d')]));_0x5345f6[_0xacac('0x41')][_0xacac('0x5b')]=_0x3b0a0c['id'];if(_0x4b6b0e[_0xacac('0x38')][_0xacac('0x43')]){_0x5345f6[_0xacac('0x41')]=_[_0xacac('0x4e')](_0x5345f6['where'],{'$or':_[_0xacac('0x32')](_0x5345f6[_0xacac('0x3b')],function(_0x2f6617){var _0x4d5ac8={};_0x4d5ac8[_0x2f6617]={'$like':'%'+_0x4b6b0e[_0xacac('0x38')]['filter']+'%'};return _0x4d5ac8;})});}_0x5345f6=_[_0xacac('0x4e')]({},_0x5345f6,_0x4b6b0e[_0xacac('0x45')]);return db[_0xacac('0x5a')][_0xacac('0x48')](_0x5345f6);}})[_0xacac('0x28')](function(_0x4190c1){if(_0x4190c1){return db[_0xacac('0x5c')][_0xacac('0x5d')]({'where':{'id':_[_0xacac('0x32')](_0x4190c1,_0xacac('0x5e')),'role':_0xacac('0x5f')},'attributes':['id','name',_0xacac('0x60'),_0xacac('0x61'),_0xacac('0x62')]});}})['then'](function(_0x13f5e9){if(_0x13f5e9){return{'count':_0x13f5e9[_0xacac('0x21')],'rows':_[_0xacac('0x32')](_0x13f5e9[_0xacac('0x49')],function(_0x444df1){return{'membername':_0x444df1[_0xacac('0x2f')],'UserId':_0x444df1['id'],'queue_name':_0x17bb9b[_0xacac('0x2f')],'OpenchannelQueueId':_0x17bb9b['id'],'interface':util[_0xacac('0x63')](_0xacac('0x64'),_0xacac('0x65'),_0x444df1[_0xacac('0x2f')]),'penalty':0x0,'paused':_0x444df1[_0xacac('0x60')],'createdAt':_0x444df1[_0xacac('0x62')],'updatedAt':_0x444df1[_0xacac('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xacac('0x28')](respondWithFilteredResult(_0x3ffb90,_0x5345f6))[_0xacac('0x4a')](handleError(_0x3ffb90,null));};exports[_0xacac('0x66')]=function(_0x44fe68,_0x356828,_0x14e46a){var _0x3e6c71={};var _0x24c195={};var _0x4338b1;var _0x303420;return db['OpenchannelQueue'][_0xacac('0x67')]({'where':{'id':_0x44fe68['params']['id']}})[_0xacac('0x28')](handleEntityNotFound(_0x356828,null))[_0xacac('0x28')](function(_0x2c96dd){if(_0x2c96dd){_0x4338b1=_0x2c96dd;_0x24c195[_0xacac('0x37')]=_[_0xacac('0x59')](db['Team'][_0xacac('0x34')]);_0x24c195[_0xacac('0x38')]=_[_0xacac('0x59')](_0x44fe68['query']);_0x24c195[_0xacac('0x4d')]=_[_0xacac('0x39')](_0x24c195[_0xacac('0x37')],_0x24c195['query']);_0x3e6c71[_0xacac('0x3b')]=_[_0xacac('0x39')](_0x24c195[_0xacac('0x37')],qs[_0xacac('0x3a')](_0x44fe68['query'][_0xacac('0x3a')]));_0x3e6c71[_0xacac('0x3b')]=_0x3e6c71[_0xacac('0x3b')][_0xacac('0x3c')]?_0x3e6c71[_0xacac('0x3b')]:_0x24c195['model'];_0x3e6c71[_0xacac('0x3f')]=qs[_0xacac('0x40')](_0x44fe68[_0xacac('0x38')]['sort']);_0x3e6c71[_0xacac('0x41')]=qs['filters'](_['pick'](_0x44fe68[_0xacac('0x38')],_0x24c195[_0xacac('0x4d')]));if(_0x44fe68[_0xacac('0x38')]['filter']){_0x3e6c71[_0xacac('0x41')]=_[_0xacac('0x4e')](_0x3e6c71[_0xacac('0x41')],{'$or':_['map'](_0x3e6c71[_0xacac('0x3b')],function(_0x53eca7){var _0xe550b9={};_0xe550b9[_0x53eca7]={'$like':'%'+_0x44fe68[_0xacac('0x38')][_0xacac('0x43')]+'%'};return _0xe550b9;})});}_0x3e6c71=_[_0xacac('0x4e')]({},_0x3e6c71,_0x44fe68[_0xacac('0x45')]);return _0x4338b1[_0xacac('0x66')](_0x3e6c71);}})[_0xacac('0x28')](function(_0x3c94c9){if(_0x3c94c9){_0x303420=_0x3c94c9['length'];if(!_0x44fe68['query'][_0xacac('0x3d')](_0xacac('0x3e'))){_0x3e6c71['limit']=qs[_0xacac('0x20')](_0x44fe68[_0xacac('0x38')][_0xacac('0x20')]);_0x3e6c71[_0xacac('0x22')]=qs[_0xacac('0x22')](_0x44fe68[_0xacac('0x38')]['offset']);}return _0x4338b1[_0xacac('0x66')](_0x3e6c71);}})[_0xacac('0x28')](function(_0x572aef){if(_0x572aef){return _0x572aef?{'count':_0x303420,'rows':_0x572aef}:null;}})[_0xacac('0x28')](respondWithResult(_0x356828,null))['catch'](handleError(_0x356828,null));};exports[_0xacac('0x68')]=function(_0x44f7b8,_0x29c445,_0x7dbddf){var _0x27f123=_0x44f7b8[_0xacac('0x56')][_0xacac('0x69')];return db[_0xacac('0x6a')][_0xacac('0x48')]({'where':{'id':_0x27f123},'attributes':['id'],'include':[{'model':db[_0xacac('0x5c')],'as':_0xacac('0x6b'),'attributes':['id','name',_0xacac('0x6c'),_0xacac('0x6d'),_0xacac('0x6e')],'raw':!![]}]})[_0xacac('0x28')](function(_0x33d4de){if(_0x33d4de){var _0x400886=_[_0xacac('0x6f')](_0x33d4de,function(_0x30a09a){var _0x4b3973=_0x30a09a[_0xacac('0x29')]({'plain':!![]});return _0x4b3973[_0xacac('0x6b')];});return db[_0xacac('0x33')][_0xacac('0x4f')]({'where':{'id':_0x44f7b8[_0xacac('0x4c')]['id']}})[_0xacac('0x28')](function(_0x4e270e){return db[_0xacac('0x70')][_0xacac('0x71')](function(_0x554763){return _0x4e270e[_0xacac('0x68')](_0x27f123,{'transaction':_0x554763})[_0xacac('0x28')](function(){return BPromise[_0xacac('0x72')](_0x400886,function(_0x846949){return db['UserOpenchannelQueue'][_0xacac('0x73')]({'where':{'UserId':_0x846949['id'],'OpenchannelQueueId':_0x44f7b8['params']['id']},'transaction':_0x554763});});})[_0xacac('0x28')](function(){_0x400886[_0xacac('0x74')](function(_0x449d27){socket['emit'](_0xacac('0x75'),{'UserId':_0x449d27['id'],'OpenchannelQueueId':_0x4e270e['id']});});});});});}})['then'](respondWithStatusCode(_0x29c445,null))['catch'](handleError(_0x29c445,null));};exports[_0xacac('0x76')]=function(_0xf01232,_0x4e9160,_0x27c26b){return db[_0xacac('0x6a')][_0xacac('0x48')]({'where':{'id':_0xf01232[_0xacac('0x38')][_0xacac('0x69')]},'attributes':['id'],'include':[{'model':db[_0xacac('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xacac('0x28')](handleEntityNotFound(_0x4e9160,null))[_0xacac('0x28')](function(_0x527bdc){var _0xb04e45=_[_0xacac('0x32')](_0x527bdc,'id');var _0x5125ad=[];var _0x10e89c=[];var _0x383427=squel[_0xacac('0x77')]();_0x383427[_0xacac('0x78')](_0xacac('0x79'))[_0xacac('0x7a')](_0xacac('0x7b'),'tq')[_0xacac('0x7c')](_0xacac('0x7d'),'ut',_0xacac('0x7e'))['where'](_0xacac('0x7f'),_0xf01232[_0xacac('0x4c')]['id']);for(var _0x5404e4=0x0;_0x5404e4<_0x527bdc['length'];_0x5404e4+=0x1){let _0x1d2292=_0x527bdc[_0x5404e4];for(var _0x1a57b9=0x0;_0x1a57b9<_0x1d2292[_0xacac('0x6b')][_0xacac('0x3c')];_0x1a57b9+=0x1){let _0x18d0bd=_0x1d2292[_0xacac('0x6b')][_0x1a57b9];var _0xe3731e=_0x383427[_0xacac('0x80')]();_0xe3731e[_0xacac('0x41')]('ut.UserId\x20=\x20?',_0x18d0bd['id']);_0x10e89c['push'](db[_0xacac('0x70')][_0xacac('0x38')](_0xe3731e['toString'](),{'type':db[_0xacac('0x70')][_0xacac('0x81')]['SELECT']})[_0xacac('0x28')](function(_0x474413){if(_0x474413[_0xacac('0x3c')]===0x1){return _0x18d0bd['id'];}else{var _0x2b6923=_['every'](_[_0xacac('0x32')](_0x474413,'TeamId'),function(_0x20048a){return _['includes'](_0xb04e45,_0x20048a);});if(_0x2b6923){return _0x18d0bd['id'];}}}));}}return BPromise['all'](_0x10e89c)[_0xacac('0x28')](function(_0x50610b){_0x5125ad=_(_0x5125ad)[_0xacac('0x82')](_0x50610b)[_0xacac('0x83')]()[_0xacac('0x84')]();return db[_0xacac('0x33')][_0xacac('0x4f')]({'where':{'id':_0xf01232['params']['id']}})[_0xacac('0x28')](function(_0x201ead){return db['sequelize']['transaction'](function(_0x21009f){return _0x201ead[_0xacac('0x76')](_0xf01232[_0xacac('0x38')][_0xacac('0x69')],{'transaction':_0x21009f})[_0xacac('0x28')](function(){if(!_[_0xacac('0x85')](_0x5125ad)){return _0x201ead[_0xacac('0x86')](_0x5125ad,{'transaction':_0x21009f});}})[_0xacac('0x28')](function(){_0x5125ad[_0xacac('0x74')](function(_0x3c7fbc){socket[_0xacac('0x87')](_0xacac('0x88'),{'UserId':_0x3c7fbc,'OpenchannelQueueId':_0x201ead['id']});});});});});});})[_0xacac('0x28')](respondWithStatusCode(_0x4e9160,null))[_0xacac('0x4a')](handleError(_0x4e9160,null));};exports[_0xacac('0x89')]=function(_0x45e62b,_0xcdfe20,_0xd325dc){return db[_0xacac('0x33')][_0xacac('0x4f')]({'where':{'id':_0x45e62b[_0xacac('0x4c')]['id']}})[_0xacac('0x28')](handleEntityNotFound(_0xcdfe20,null))[_0xacac('0x28')](function(_0x38b473){if(_0x38b473){return _0x38b473['addAgents'](_0x45e62b['body'][_0xacac('0x69')],_[_0xacac('0x8a')](_0x45e62b['body'],[_0xacac('0x69'),'id'])||{})['spread'](function(_0x4e5343){for(var _0x1c8215=0x0;_0x1c8215<_0x45e62b['body'][_0xacac('0x69')]['length'];_0x1c8215+=0x1){socket['emit'](_0xacac('0x75'),{'UserId':Number(_0x45e62b[_0xacac('0x56')][_0xacac('0x69')][_0x1c8215]),'OpenchannelQueueId':Number(_0x45e62b['params']['id'])});}return _0x4e5343;});}})[_0xacac('0x28')](respondWithResult(_0xcdfe20,null))[_0xacac('0x4a')](handleError(_0xcdfe20,null));};exports[_0xacac('0x86')]=function(_0x33e213,_0x20d73f,_0x11aa7d){return db[_0xacac('0x33')][_0xacac('0x4f')]({'where':{'id':_0x33e213[_0xacac('0x4c')]['id']}})[_0xacac('0x28')](handleEntityNotFound(_0x20d73f,null))['then'](function(_0x4b100b){if(_0x4b100b){return _0x4b100b['removeAgents'](_0x33e213[_0xacac('0x38')][_0xacac('0x69')])[_0xacac('0x28')](function(){if(_[_0xacac('0x8b')](_0x33e213[_0xacac('0x38')][_0xacac('0x69')])){for(var _0x4c8c64=0x0;_0x4c8c64<_0x33e213[_0xacac('0x38')][_0xacac('0x69')][_0xacac('0x3c')];_0x4c8c64+=0x1){socket[_0xacac('0x87')]('userOpenchannelQueue:remove',{'UserId':Number(_0x33e213[_0xacac('0x38')]['ids'][_0x4c8c64]),'OpenchannelQueueId':Number(_0x33e213[_0xacac('0x4c')]['id'])});}}else{socket[_0xacac('0x87')](_0xacac('0x88'),{'UserId':Number(_0x33e213[_0xacac('0x38')][_0xacac('0x69')]),'OpenchannelQueueId':Number(_0x33e213['params']['id'])});}});}})[_0xacac('0x28')](respondWithStatusCode(_0x20d73f,null))[_0xacac('0x4a')](handleError(_0x20d73f,null));};exports['getAgents']=function(_0x9ef50c,_0x4818c4,_0x130766){var _0x33afcc={};var _0x2c19d0={};var _0x803a14;var _0x1fda41;return db[_0xacac('0x33')]['findOne']({'where':{'id':_0x9ef50c[_0xacac('0x4c')]['id']}})[_0xacac('0x28')](handleEntityNotFound(_0x4818c4,null))['then'](function(_0x50ef24){if(_0x50ef24){_0x803a14=_0x50ef24;_0x2c19d0[_0xacac('0x37')]=_[_0xacac('0x59')](db['User'][_0xacac('0x34')]);_0x2c19d0['query']=_[_0xacac('0x59')](_0x9ef50c[_0xacac('0x38')]);_0x2c19d0[_0xacac('0x4d')]=_[_0xacac('0x39')](_0x2c19d0[_0xacac('0x37')],_0x2c19d0[_0xacac('0x38')]);_0x33afcc[_0xacac('0x3b')]=_['intersection'](_0x2c19d0[_0xacac('0x37')],qs['fields'](_0x9ef50c['query'][_0xacac('0x3a')]));_0x33afcc['attributes']=_0x33afcc[_0xacac('0x3b')][_0xacac('0x3c')]?_0x33afcc[_0xacac('0x3b')]:_0x2c19d0['model'];_0x33afcc[_0xacac('0x3f')]=qs['sort'](_0x9ef50c[_0xacac('0x38')][_0xacac('0x40')]);_0x33afcc[_0xacac('0x41')]=qs[_0xacac('0x4d')](_[_0xacac('0x42')](_0x9ef50c['query'],_0x2c19d0[_0xacac('0x4d')]));if(_0x9ef50c[_0xacac('0x38')][_0xacac('0x43')]){_0x33afcc[_0xacac('0x41')]=_[_0xacac('0x4e')](_0x33afcc[_0xacac('0x41')],{'$or':_[_0xacac('0x32')](_0x33afcc[_0xacac('0x3b')],function(_0x18d325){var _0x281054={};_0x281054[_0x18d325]={'$like':'%'+_0x9ef50c[_0xacac('0x38')][_0xacac('0x43')]+'%'};return _0x281054;})});}_0x33afcc=_['merge']({},_0x33afcc,_0x9ef50c[_0xacac('0x45')]);return _0x803a14['getAgents'](_0x33afcc);}})[_0xacac('0x28')](function(_0x4db303){if(_0x4db303){_0x1fda41=_0x4db303[_0xacac('0x3c')];if(!_0x9ef50c[_0xacac('0x38')][_0xacac('0x3d')](_0xacac('0x3e'))){_0x33afcc[_0xacac('0x20')]=qs[_0xacac('0x20')](_0x9ef50c[_0xacac('0x38')][_0xacac('0x20')]);_0x33afcc['offset']=qs[_0xacac('0x22')](_0x9ef50c[_0xacac('0x38')][_0xacac('0x22')]);}return _0x803a14[_0xacac('0x8c')](_0x33afcc);}})['then'](function(_0x57c883){if(_0x57c883){return _0x57c883?{'count':_0x1fda41,'rows':_0x57c883}:null;}})['then'](respondWithResult(_0x4818c4,null))[_0xacac('0x4a')](handleError(_0x4818c4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 09ed0e4..fbc357b 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 _0x07c9=['../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x07c9,0xa1));var _0x907c=function(_0x1ddb97,_0x3184e3){_0x1ddb97=_0x1ddb97-0x0;var _0x358004=_0x07c9[_0x1ddb97];return _0x358004;};'use strict';var EventEmitter=require(_0x907c('0x0'));var OpenchannelQueue=require(_0x907c('0x1'))['db'][_0x907c('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x907c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x907c('0x4'),'afterDestroy':_0x907c('0x5')};function emitEvent(_0x4c302e){return function(_0x3c6c1e,_0x2d0f16,_0x205ef1){OpenchannelQueueEvents['emit'](_0x4c302e+':'+_0x3c6c1e['id'],_0x3c6c1e);OpenchannelQueueEvents[_0x907c('0x6')](_0x4c302e,_0x3c6c1e);_0x205ef1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x907c('0x7')](e,emitEvent(event));}}module[_0x907c('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x5afa=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5afa,0x7a));var _0xa5af=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5afa[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xa5af('0x0'));var OpenchannelQueue=require(_0xa5af('0x1'))['db'][_0xa5af('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa5af('0x3')](0x0);var events={'afterCreate':_0xa5af('0x4'),'afterUpdate':_0xa5af('0x5'),'afterDestroy':_0xa5af('0x6')};function emitEvent(_0x35121f){return function(_0x247183,_0x344b1b,_0x3bf541){OpenchannelQueueEvents[_0xa5af('0x7')](_0x35121f+':'+_0x247183['id'],_0x247183);OpenchannelQueueEvents[_0xa5af('0x7')](_0x35121f,_0x247183);_0x3bf541(null);};}for(var e in events){if(events[_0xa5af('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xa5af('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 7e7fc9d..6769bc1 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 _0x6140=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x494795,_0x1d1a64){var _0x582a3e=function(_0x455b0d){while(--_0x455b0d){_0x494795['push'](_0x494795['shift']());}};_0x582a3e(++_0x1d1a64);}(_0x6140,0xc7));var _0x0614=function(_0x3b2526,_0x278079){_0x3b2526=_0x3b2526-0x0;var _0x5e40bf=_0x6140[_0x3b2526];return _0x5e40bf;};'use strict';var _=require('lodash');var util=require(_0x0614('0x0'));var logger=require(_0x0614('0x1'))('api');var moment=require(_0x0614('0x2'));var BPromise=require(_0x0614('0x3'));var rp=require(_0x0614('0x4'));var fs=require('fs');var path=require(_0x0614('0x5'));var rimraf=require(_0x0614('0x6'));var config=require(_0x0614('0x7'));var attributes=require(_0x0614('0x8'));module[_0x0614('0x9')]=function(_0x38037f,_0x121d6a){return _0x38037f[_0x0614('0xa')](_0x0614('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8311=['openchannel_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelQueue'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x8311,0x1f0));var _0x1831=function(_0x21f393,_0x4375ef){_0x21f393=_0x21f393-0x0;var _0x2e28e5=_0x8311[_0x21f393];return _0x2e28e5;};'use strict';var _=require(_0x1831('0x0'));var util=require(_0x1831('0x1'));var logger=require('../../config/logger')(_0x1831('0x2'));var moment=require('moment');var BPromise=require(_0x1831('0x3'));var rp=require(_0x1831('0x4'));var fs=require('fs');var path=require(_0x1831('0x5'));var rimraf=require(_0x1831('0x6'));var config=require(_0x1831('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x1831('0x8')]=function(_0x598637,_0xfd0e2){return _0x598637['define'](_0x1831('0x9'),attributes,{'tableName':_0x1831('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 3bb48af..69f355e 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 _0x93a2=['stringify','error','message','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','include','map','model','debug','catch','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x93a2,0x1bd));var _0x293a=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x93a2[_0x22eb96];return _0x5e1adf;};'use strict';var _=require('lodash');var util=require(_0x293a('0x0'));var moment=require('moment');var BPromise=require(_0x293a('0x1'));var rs=require(_0x293a('0x2'));var fs=require('fs');var Redis=require(_0x293a('0x3'));var db=require(_0x293a('0x4'))['db'];var utils=require(_0x293a('0x5'));var logger=require('../../config/logger')(_0x293a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x293a('0x7')][_0x293a('0x8')]({'port':0x232a});config[_0x293a('0x9')]=_[_0x293a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x293a('0x9')]));require(_0x293a('0xb'))[_0x293a('0xc')](socket);function respondWithRpcPromise(_0x1e8cc1,_0x979e90,_0x181fd6){return new BPromise(function(_0xeb405a,_0x248825){return client[_0x293a('0xd')](_0x1e8cc1,_0x181fd6)[_0x293a('0xe')](function(_0x517e9c){logger[_0x293a('0xf')](_0x293a('0x10'),_0x979e90,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x979e90,'request\x20sent',JSON[_0x293a('0x11')](_0x517e9c));if(_0x517e9c[_0x293a('0x12')]){if(_0x517e9c[_0x293a('0x12')]['code']===0x1f4){logger[_0x293a('0x12')](_0x293a('0x10'),_0x979e90,_0x517e9c[_0x293a('0x12')]['message']);return _0x248825(_0x517e9c[_0x293a('0x12')][_0x293a('0x13')]);}logger[_0x293a('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x979e90,_0x517e9c[_0x293a('0x12')]['message']);return _0xeb405a(_0x517e9c[_0x293a('0x12')][_0x293a('0x13')]);}else{logger[_0x293a('0xf')](_0x293a('0x10'),_0x979e90,'request\x20sent');_0xeb405a(_0x517e9c[_0x293a('0x14')]['message']);}})['catch'](function(_0x11bf3d){logger[_0x293a('0x12')](_0x293a('0x10'),_0x979e90,_0x11bf3d);_0x248825(_0x11bf3d);});});}exports[_0x293a('0x15')]=function(_0x4c11e3){var _0x59e974=this;return new Promise(function(_0x13b1f0,_0x20524f){return db[_0x293a('0x16')]['findAll']({'raw':_0x4c11e3[_0x293a('0x17')]?_0x4c11e3['options'][_0x293a('0x18')]===undefined?!![]:![]:!![],'where':_0x4c11e3[_0x293a('0x17')]?_0x4c11e3['options'][_0x293a('0x19')]||null:null,'attributes':_0x4c11e3[_0x293a('0x17')]?_0x4c11e3['options'][_0x293a('0x1a')]||null:null,'limit':_0x4c11e3[_0x293a('0x17')]?_0x4c11e3[_0x293a('0x17')]['limit']||null:null,'include':_0x4c11e3[_0x293a('0x17')]?_0x4c11e3[_0x293a('0x17')][_0x293a('0x1b')]?_[_0x293a('0x1c')](_0x4c11e3[_0x293a('0x17')][_0x293a('0x1b')],function(_0x421c26){return{'model':db[_0x421c26['model']],'as':_0x421c26['as'],'attributes':_0x421c26[_0x293a('0x1a')],'include':_0x421c26[_0x293a('0x1b')]?_[_0x293a('0x1c')](_0x421c26[_0x293a('0x1b')],function(_0x428226){return{'model':db[_0x428226[_0x293a('0x1d')]],'as':_0x428226['as'],'attributes':_0x428226['attributes'],'include':_0x428226[_0x293a('0x1b')]?_[_0x293a('0x1c')](_0x428226[_0x293a('0x1b')],function(_0x20de08){return{'model':db[_0x20de08[_0x293a('0x1d')]],'as':_0x20de08['as'],'attributes':_0x20de08['attributes']};}):[]};}):[]};}):[]:[]})[_0x293a('0xe')](function(_0x1bdba1){logger[_0x293a('0xf')](_0x293a('0x15'),_0x4c11e3);logger[_0x293a('0x1e')](_0x293a('0x15'),_0x4c11e3,JSON[_0x293a('0x11')](_0x1bdba1));_0x13b1f0(_0x1bdba1);})[_0x293a('0x1f')](function(_0x16556d){logger[_0x293a('0x12')]('GetOpenchannelQueue',_0x16556d[_0x293a('0x13')],_0x4c11e3);_0x20524f(_0x59e974[_0x293a('0x12')](0x1f4,_0x16556d[_0x293a('0x13')]));});});};exports[_0x293a('0x20')]=function(_0x33e754){var _0x250a99=this;return new Promise(function(_0x1c5ede,_0x4459fe){return db[_0x293a('0x16')]['find']({'raw':_0x33e754[_0x293a('0x17')]?_0x33e754[_0x293a('0x17')][_0x293a('0x18')]===undefined?!![]:![]:!![],'where':_0x33e754['options']?_0x33e754[_0x293a('0x17')][_0x293a('0x19')]||null:null,'attributes':_0x33e754[_0x293a('0x17')]?_0x33e754['options'][_0x293a('0x1a')]||null:null,'include':_0x33e754[_0x293a('0x17')]?_0x33e754[_0x293a('0x17')][_0x293a('0x1b')]?_[_0x293a('0x1c')](_0x33e754[_0x293a('0x17')]['include'],function(_0x267c52){return{'model':db[_0x267c52[_0x293a('0x1d')]],'as':_0x267c52['as'],'attributes':_0x267c52[_0x293a('0x1a')],'include':_0x267c52['include']?_[_0x293a('0x1c')](_0x267c52['include'],function(_0x5250a8){return{'model':db[_0x5250a8[_0x293a('0x1d')]],'as':_0x5250a8['as'],'attributes':_0x5250a8[_0x293a('0x1a')],'include':_0x5250a8[_0x293a('0x1b')]?_['map'](_0x5250a8[_0x293a('0x1b')],function(_0x89025c){return{'model':db[_0x89025c['model']],'as':_0x89025c['as'],'attributes':_0x89025c[_0x293a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2253ad){logger[_0x293a('0xf')](_0x293a('0x20'),_0x33e754);logger['debug']('ShowOpenchannelQueue',_0x33e754,JSON[_0x293a('0x11')](_0x2253ad));_0x1c5ede(_0x2253ad);})[_0x293a('0x1f')](function(_0x350957){logger[_0x293a('0x12')]('ShowOpenchannelQueue',_0x350957[_0x293a('0x13')],_0x33e754);_0x4459fe(_0x250a99[_0x293a('0x12')](0x1f4,_0x350957[_0x293a('0x13')]));});});}; \ No newline at end of file +var _0xd9fb=['debug','stringify','error','code','message','result','catch','GetOpenchannelQueue','options','raw','where','attributes','limit','include','map','model','then','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3030a9,_0x3e7be2){var _0x5e6b29=function(_0x4be727){while(--_0x4be727){_0x3030a9['push'](_0x3030a9['shift']());}};_0x5e6b29(++_0x3e7be2);}(_0xd9fb,0x144));var _0xbd9f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd9fb[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var moment=require(_0xbd9f('0x2'));var BPromise=require(_0xbd9f('0x3'));var rs=require(_0xbd9f('0x4'));var fs=require('fs');var Redis=require(_0xbd9f('0x5'));var db=require(_0xbd9f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd9f('0x7'))(_0xbd9f('0x8'));var config=require(_0xbd9f('0x9'));var jayson=require(_0xbd9f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xbd9f('0xb')]=_['defaults'](config[_0xbd9f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbd9f('0xc'))(new Redis(config[_0xbd9f('0xb')]));require(_0xbd9f('0xd'))[_0xbd9f('0xe')](socket);function respondWithRpcPromise(_0x3a9e5b,_0x57b67b,_0x75b60f){return new BPromise(function(_0x2aca23,_0x10e607){return client['request'](_0x3a9e5b,_0x75b60f)['then'](function(_0x3d5edb){logger[_0xbd9f('0xf')](_0xbd9f('0x10'),_0x57b67b,_0xbd9f('0x11'));logger[_0xbd9f('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x57b67b,_0xbd9f('0x11'),JSON[_0xbd9f('0x13')](_0x3d5edb));if(_0x3d5edb[_0xbd9f('0x14')]){if(_0x3d5edb[_0xbd9f('0x14')][_0xbd9f('0x15')]===0x1f4){logger[_0xbd9f('0x14')](_0xbd9f('0x10'),_0x57b67b,_0x3d5edb['error'][_0xbd9f('0x16')]);return _0x10e607(_0x3d5edb['error']['message']);}logger[_0xbd9f('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x57b67b,_0x3d5edb[_0xbd9f('0x14')][_0xbd9f('0x16')]);return _0x2aca23(_0x3d5edb[_0xbd9f('0x14')]['message']);}else{logger['info'](_0xbd9f('0x10'),_0x57b67b,'request\x20sent');_0x2aca23(_0x3d5edb[_0xbd9f('0x17')][_0xbd9f('0x16')]);}})[_0xbd9f('0x18')](function(_0xc4116c){logger[_0xbd9f('0x14')](_0xbd9f('0x10'),_0x57b67b,_0xc4116c);_0x10e607(_0xc4116c);});});}exports[_0xbd9f('0x19')]=function(_0x7643d9){var _0x5f4da6=this;return new Promise(function(_0x2906b,_0x4a71f8){return db['OpenchannelQueue']['findAll']({'raw':_0x7643d9[_0xbd9f('0x1a')]?_0x7643d9[_0xbd9f('0x1a')][_0xbd9f('0x1b')]===undefined?!![]:![]:!![],'where':_0x7643d9[_0xbd9f('0x1a')]?_0x7643d9[_0xbd9f('0x1a')][_0xbd9f('0x1c')]||null:null,'attributes':_0x7643d9['options']?_0x7643d9['options'][_0xbd9f('0x1d')]||null:null,'limit':_0x7643d9['options']?_0x7643d9[_0xbd9f('0x1a')][_0xbd9f('0x1e')]||null:null,'include':_0x7643d9['options']?_0x7643d9[_0xbd9f('0x1a')][_0xbd9f('0x1f')]?_[_0xbd9f('0x20')](_0x7643d9[_0xbd9f('0x1a')]['include'],function(_0x5705ae){return{'model':db[_0x5705ae['model']],'as':_0x5705ae['as'],'attributes':_0x5705ae[_0xbd9f('0x1d')],'include':_0x5705ae[_0xbd9f('0x1f')]?_[_0xbd9f('0x20')](_0x5705ae['include'],function(_0x3ba5c4){return{'model':db[_0x3ba5c4[_0xbd9f('0x21')]],'as':_0x3ba5c4['as'],'attributes':_0x3ba5c4[_0xbd9f('0x1d')],'include':_0x3ba5c4['include']?_['map'](_0x3ba5c4[_0xbd9f('0x1f')],function(_0x5cff3f){return{'model':db[_0x5cff3f[_0xbd9f('0x21')]],'as':_0x5cff3f['as'],'attributes':_0x5cff3f[_0xbd9f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd9f('0x22')](function(_0x149b9d){logger['info'](_0xbd9f('0x19'),_0x7643d9);logger['debug'](_0xbd9f('0x19'),_0x7643d9,JSON[_0xbd9f('0x13')](_0x149b9d));_0x2906b(_0x149b9d);})[_0xbd9f('0x18')](function(_0x35735a){logger[_0xbd9f('0x14')]('GetOpenchannelQueue',_0x35735a[_0xbd9f('0x16')],_0x7643d9);_0x4a71f8(_0x5f4da6[_0xbd9f('0x14')](0x1f4,_0x35735a[_0xbd9f('0x16')]));});});};exports[_0xbd9f('0x23')]=function(_0x612227){var _0x52ee5b=this;return new Promise(function(_0x4813e4,_0x55f2cf){return db[_0xbd9f('0x24')][_0xbd9f('0x25')]({'raw':_0x612227[_0xbd9f('0x1a')]?_0x612227[_0xbd9f('0x1a')][_0xbd9f('0x1b')]===undefined?!![]:![]:!![],'where':_0x612227[_0xbd9f('0x1a')]?_0x612227['options']['where']||null:null,'attributes':_0x612227[_0xbd9f('0x1a')]?_0x612227[_0xbd9f('0x1a')][_0xbd9f('0x1d')]||null:null,'include':_0x612227[_0xbd9f('0x1a')]?_0x612227[_0xbd9f('0x1a')][_0xbd9f('0x1f')]?_[_0xbd9f('0x20')](_0x612227[_0xbd9f('0x1a')][_0xbd9f('0x1f')],function(_0x9752a){return{'model':db[_0x9752a[_0xbd9f('0x21')]],'as':_0x9752a['as'],'attributes':_0x9752a[_0xbd9f('0x1d')],'include':_0x9752a[_0xbd9f('0x1f')]?_[_0xbd9f('0x20')](_0x9752a[_0xbd9f('0x1f')],function(_0x48ad36){return{'model':db[_0x48ad36[_0xbd9f('0x21')]],'as':_0x48ad36['as'],'attributes':_0x48ad36['attributes'],'include':_0x48ad36[_0xbd9f('0x1f')]?_['map'](_0x48ad36[_0xbd9f('0x1f')],function(_0x4348d7){return{'model':db[_0x4348d7[_0xbd9f('0x21')]],'as':_0x4348d7['as'],'attributes':_0x4348d7[_0xbd9f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd9f('0x22')](function(_0x436bf3){logger[_0xbd9f('0xf')](_0xbd9f('0x23'),_0x612227);logger['debug'](_0xbd9f('0x23'),_0x612227,JSON['stringify'](_0x436bf3));_0x4813e4(_0x436bf3);})['catch'](function(_0x2c45d3){logger[_0xbd9f('0x14')](_0xbd9f('0x23'),_0x2c45d3[_0xbd9f('0x16')],_0x612227);_0x55f2cf(_0x52ee5b[_0xbd9f('0x14')](0x1f4,_0x2c45d3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 09a62dd..052ae7b 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 _0x51da=['save','remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x5d8503,_0x286d3e){var _0x5420c7=function(_0x125390){while(--_0x125390){_0x5d8503['push'](_0x5d8503['shift']());}};_0x5420c7(++_0x286d3e);}(_0x51da,0x187));var _0xa51d=function(_0xf00171,_0x54a1b1){_0xf00171=_0xf00171-0x0;var _0xc278e7=_0x51da[_0xf00171];return _0xc278e7;};'use strict';var OpenchannelQueueEvents=require(_0xa51d('0x0'));var events=[_0xa51d('0x1'),_0xa51d('0x2'),_0xa51d('0x3')];function createListener(_0xad17f2,_0x3ba730){return function(_0xe49efd){_0x3ba730[_0xa51d('0x4')](_0xad17f2,_0xe49efd);};}function removeListener(_0x2b7782,_0x56b8d4){return function(){OpenchannelQueueEvents[_0xa51d('0x5')](_0x2b7782,_0x56b8d4);};}exports[_0xa51d('0x6')]=function(_0x19ee94){for(var _0x724c13=0x0,_0x579141=events['length'];_0x724c13<_0x579141;_0x724c13++){var _0x44943c=events[_0x724c13];var _0x5f3d41=createListener(_0xa51d('0x7')+_0x44943c,_0x19ee94);OpenchannelQueueEvents['on'](_0x44943c,_0x5f3d41);}}; \ No newline at end of file +var _0xee17=['removeListener','register','openchannelQueue:','remove'];(function(_0x3f2d95,_0x4b1add){var _0x170919=function(_0x5f52f8){while(--_0x5f52f8){_0x3f2d95['push'](_0x3f2d95['shift']());}};_0x170919(++_0x4b1add);}(_0xee17,0xdf));var _0x7ee1=function(_0x379eac,_0x5c2166){_0x379eac=_0x379eac-0x0;var _0x3d8d1a=_0xee17[_0x379eac];return _0x3d8d1a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x7ee1('0x0'),'update'];function createListener(_0x2334f8,_0x54b78a){return function(_0x40cd9a){_0x54b78a['emit'](_0x2334f8,_0x40cd9a);};}function removeListener(_0x3d5e11,_0x3e3203){return function(){OpenchannelQueueEvents[_0x7ee1('0x1')](_0x3d5e11,_0x3e3203);};}exports[_0x7ee1('0x2')]=function(_0x5660a5){for(var _0xdc1f88=0x0,_0x295793=events['length'];_0xdc1f88<_0x295793;_0xdc1f88++){var _0x156daf=events[_0xdc1f88];var _0x41a0af=createListener(_0x7ee1('0x3')+_0x156daf,_0x5660a5);OpenchannelQueueEvents['on'](_0x156daf,_0x41a0af);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 9271851..04f3cee 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 _0x7626=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x539eb6,_0x3843f8){var _0x2e3478=function(_0x4d6b5d){while(--_0x4d6b5d){_0x539eb6['push'](_0x539eb6['shift']());}};_0x2e3478(++_0x3843f8);}(_0x7626,0x1c1));var _0x6762=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x7626[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0x6762('0x0'));var util=require(_0x6762('0x1'));var path=require(_0x6762('0x2'));var timeout=require('connect-timeout');var express=require(_0x6762('0x3'));var router=express[_0x6762('0x4')]();var fs_extra=require(_0x6762('0x5'));var auth=require(_0x6762('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6762('0x7'));var controller=require(_0x6762('0x8'));router[_0x6762('0x9')]('/',auth['isAuthenticated'](),controller[_0x6762('0xa')]);router['get'](_0x6762('0xb'),auth[_0x6762('0xc')](),controller[_0x6762('0xd')]);router[_0x6762('0x9')](_0x6762('0xe'),auth['isAuthenticated'](),controller[_0x6762('0xf')]);router[_0x6762('0x10')]('/',auth[_0x6762('0xc')](),controller[_0x6762('0x11')]);router['put'](_0x6762('0xe'),auth[_0x6762('0xc')](),controller[_0x6762('0x12')]);router[_0x6762('0x13')](_0x6762('0xe'),auth[_0x6762('0xc')](),controller[_0x6762('0x14')]);module[_0x6762('0x15')]=router; \ No newline at end of file +var _0x4fb5=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4fb5,0x19e));var _0x54fb=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4fb5[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require(_0x54fb('0x0'));var util=require('util');var path=require(_0x54fb('0x1'));var timeout=require(_0x54fb('0x2'));var express=require(_0x54fb('0x3'));var router=express[_0x54fb('0x4')]();var fs_extra=require(_0x54fb('0x5'));var auth=require(_0x54fb('0x6'));var interaction=require(_0x54fb('0x7'));var config=require(_0x54fb('0x8'));var controller=require(_0x54fb('0x9'));router[_0x54fb('0xa')]('/',auth[_0x54fb('0xb')](),controller[_0x54fb('0xc')]);router[_0x54fb('0xa')](_0x54fb('0xd'),auth[_0x54fb('0xb')](),controller[_0x54fb('0xe')]);router[_0x54fb('0xa')](_0x54fb('0xf'),auth[_0x54fb('0xb')](),controller[_0x54fb('0x10')]);router[_0x54fb('0x11')]('/',auth[_0x54fb('0xb')](),controller[_0x54fb('0x12')]);router[_0x54fb('0x13')]('/:id',auth[_0x54fb('0xb')](),controller[_0x54fb('0x14')]);router[_0x54fb('0x15')]('/:id',auth[_0x54fb('0xb')](),controller['destroy']);module[_0x54fb('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cdc5501..d777aff 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 _0xc2b8=['exports','STRING','DATE','moment'];(function(_0xa18c79,_0x50be7a){var _0x19b7cf=function(_0x17c55a){while(--_0x17c55a){_0xa18c79['push'](_0xa18c79['shift']());}};_0x19b7cf(++_0x50be7a);}(_0xc2b8,0x1ab));var _0x8c2b=function(_0x546f24,_0x485e39){_0x546f24=_0x546f24-0x0;var _0x6c3dac=_0xc2b8[_0x546f24];return _0x6c3dac;};'use strict';var moment=require(_0x8c2b('0x0'));var Sequelize=require('sequelize');module[_0x8c2b('0x1')]={'uniqueid':{'type':Sequelize[_0x8c2b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8c2b('0x2')]},'joinAt':{'type':Sequelize[_0x8c2b('0x3')]},'leaveAt':{'type':Sequelize[_0x8c2b('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ca5=['DATE','sequelize','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7ca5,0x11d));var _0x57ca=function(_0x5cd135,_0x28da40){_0x5cd135=_0x5cd135-0x0;var _0x1ba5c9=_0x7ca5[_0x5cd135];return _0x1ba5c9;};'use strict';var moment=require('moment');var Sequelize=require(_0x57ca('0x0'));module[_0x57ca('0x1')]={'uniqueid':{'type':Sequelize[_0x57ca('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x57ca('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x57ca('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x57ca('0x3')]},'reason':{'type':Sequelize[_0x57ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f7162a8..f8dc011 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 _0x25bb=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../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','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','findAll','catch','keys','filters','length','includeAll','include','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1bf0b4,_0x4d7375){var _0x42fd7e=function(_0x31a928){while(--_0x31a928){_0x1bf0b4['push'](_0x1bf0b4['shift']());}};_0x42fd7e(++_0x4d7375);}(_0x25bb,0x1d6));var _0xb25b=function(_0x5f3dbe,_0x3284f5){_0x5f3dbe=_0x5f3dbe-0x0;var _0x17bd6e=_0x25bb[_0x5f3dbe];return _0x17bd6e;};'use strict';var emlformat=require(_0xb25b('0x0'));var rimraf=require(_0xb25b('0x1'));var zipdir=require(_0xb25b('0x2'));var jsonpatch=require(_0xb25b('0x3'));var rp=require(_0xb25b('0x4'));var moment=require(_0xb25b('0x5'));var BPromise=require(_0xb25b('0x6'));var Mustache=require(_0xb25b('0x7'));var util=require(_0xb25b('0x8'));var path=require(_0xb25b('0x9'));var sox=require(_0xb25b('0xa'));var csv=require(_0xb25b('0xb'));var ejs=require(_0xb25b('0xc'));var fs=require('fs');var fs_extra=require(_0xb25b('0xd'));var _=require(_0xb25b('0xe'));var squel=require(_0xb25b('0xf'));var crypto=require(_0xb25b('0x10'));var jsforce=require(_0xb25b('0x11'));var deskjs=require(_0xb25b('0x12'));var toCsv=require(_0xb25b('0xb'));var querystring=require('querystring');var Papa=require(_0xb25b('0x13'));var Redis=require(_0xb25b('0x14'));var authService=require(_0xb25b('0x15'));var qs=require(_0xb25b('0x16'));var as=require(_0xb25b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb25b('0x18'))('api');var utils=require(_0xb25b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb25b('0x1a'));var db=require(_0xb25b('0x1b'))['db'];function respondWithStatusCode(_0x5b0a51,_0x3b0077){_0x3b0077=_0x3b0077||0xcc;return function(_0x9867e8){if(_0x9867e8){return _0x5b0a51[_0xb25b('0x1c')](_0x3b0077);}return _0x5b0a51[_0xb25b('0x1d')](_0x3b0077)[_0xb25b('0x1e')]();};}function respondWithResult(_0x1b0047,_0x5c47dd){_0x5c47dd=_0x5c47dd||0xc8;return function(_0x403089){if(_0x403089){return _0x1b0047[_0xb25b('0x1d')](_0x5c47dd)[_0xb25b('0x1f')](_0x403089);}};}function respondWithFilteredResult(_0x4711ed,_0x141876){return function(_0x243dda){if(_0x243dda){var _0x287133=typeof _0x141876[_0xb25b('0x20')]===_0xb25b('0x21')&&typeof _0x141876[_0xb25b('0x22')]===_0xb25b('0x21');var _0xea6673=_0x243dda[_0xb25b('0x23')];var _0x2b72cc=_0x287133?0x0:_0x141876[_0xb25b('0x20')];var _0x5d097c=_0x287133?_0x243dda['count']:_0x141876[_0xb25b('0x20')]+_0x141876[_0xb25b('0x22')];var _0x1bf3fc;if(_0x5d097c>=_0xea6673){_0x5d097c=_0xea6673;_0x1bf3fc=0xc8;}else{_0x1bf3fc=0xce;}_0x4711ed['status'](_0x1bf3fc);return _0x4711ed[_0xb25b('0x24')]('Content-Range',_0x2b72cc+'-'+_0x5d097c+'/'+_0xea6673)['json'](_0x243dda);}return null;};}function patchUpdates(_0x3740b1){return function(_0x34475b){try{jsonpatch[_0xb25b('0x25')](_0x34475b,_0x3740b1,!![]);}catch(_0x5e3709){return BPromise['reject'](_0x5e3709);}return _0x34475b[_0xb25b('0x26')]();};}function saveUpdates(_0x2a548f,_0x2d2289){return function(_0x241bad){if(_0x241bad){return _0x241bad[_0xb25b('0x27')](_0x2a548f)[_0xb25b('0x28')](function(_0x18642a){return _0x18642a;});}return null;};}function removeEntity(_0x5eef4a,_0x1a77fc){return function(_0x413c2d){if(_0x413c2d){return _0x413c2d['destroy']()[_0xb25b('0x28')](function(){_0x5eef4a['status'](0xcc)[_0xb25b('0x1e')]();});}};}function handleEntityNotFound(_0x2de9a7,_0x4cb74b){return function(_0x241447){if(!_0x241447){_0x2de9a7[_0xb25b('0x1c')](0x194);}return _0x241447;};}function handleError(_0x3a8c23,_0x30af5b){_0x30af5b=_0x30af5b||0x1f4;return function(_0x264ccd){logger[_0xb25b('0x29')](_0x264ccd[_0xb25b('0x2a')]);if(_0x264ccd[_0xb25b('0x2b')]){delete _0x264ccd[_0xb25b('0x2b')];}_0x3a8c23[_0xb25b('0x1d')](_0x30af5b)[_0xb25b('0x2c')](_0x264ccd);};}exports[_0xb25b('0x2d')]=function(_0x30e13d,_0x4a0a37){var _0x94c862={},_0x4ccc71={},_0x2dcad5={'count':0x0,'rows':[]};var _0x16b359=_['map'](db['OpenchannelQueueReport'][_0xb25b('0x2e')],function(_0x56966d){return{'name':_0x56966d[_0xb25b('0x2f')],'type':_0x56966d[_0xb25b('0x30')][_0xb25b('0x31')]};});_0x4ccc71['model']=_[_0xb25b('0x32')](_0x16b359,_0xb25b('0x2b'));_0x4ccc71[_0xb25b('0x33')]=_['keys'](_0x30e13d[_0xb25b('0x33')]);_0x4ccc71['filters']=_[_0xb25b('0x34')](_0x4ccc71[_0xb25b('0x35')],_0x4ccc71[_0xb25b('0x33')]);_0x94c862[_0xb25b('0x36')]=_['intersection'](_0x4ccc71[_0xb25b('0x35')],qs[_0xb25b('0x37')](_0x30e13d['query'][_0xb25b('0x37')]));_0x94c862[_0xb25b('0x36')]=_0x94c862[_0xb25b('0x36')]['length']?_0x94c862[_0xb25b('0x36')]:_0x4ccc71[_0xb25b('0x35')];if(!_0x30e13d['query'][_0xb25b('0x38')](_0xb25b('0x39'))){_0x94c862[_0xb25b('0x22')]=qs[_0xb25b('0x22')](_0x30e13d['query']['limit']);_0x94c862[_0xb25b('0x20')]=qs[_0xb25b('0x20')](_0x30e13d[_0xb25b('0x33')][_0xb25b('0x20')]);}_0x94c862[_0xb25b('0x3a')]=qs[_0xb25b('0x3b')](_0x30e13d[_0xb25b('0x33')][_0xb25b('0x3b')]);_0x94c862[_0xb25b('0x3c')]=qs['filters'](_[_0xb25b('0x3d')](_0x30e13d[_0xb25b('0x33')],_0x4ccc71['filters']),_0x16b359);if(_0x30e13d[_0xb25b('0x33')][_0xb25b('0x3e')]){_0x94c862[_0xb25b('0x3c')]=_[_0xb25b('0x3f')](_0x94c862[_0xb25b('0x3c')],{'$or':_['map'](_0x16b359,function(_0x4f75da){if(_0x4f75da['type']!==_0xb25b('0x40')){var _0x12d11e={};_0x12d11e[_0x4f75da['name']]={'$like':'%'+_0x30e13d[_0xb25b('0x33')][_0xb25b('0x3e')]+'%'};return _0x12d11e;}})});}_0x94c862=_[_0xb25b('0x3f')]({},_0x94c862,_0x30e13d[_0xb25b('0x41')]);var _0x170a19={'where':_0x94c862[_0xb25b('0x3c')]};return db['OpenchannelQueueReport'][_0xb25b('0x23')](_0x170a19)[_0xb25b('0x28')](function(_0x234522){_0x2dcad5[_0xb25b('0x23')]=_0x234522;if(_0x30e13d['query']['includeAll']){_0x94c862['include']=[{'all':!![]}];}return db[_0xb25b('0x42')][_0xb25b('0x43')](_0x94c862);})['then'](function(_0x151672){_0x2dcad5['rows']=_0x151672;return _0x2dcad5;})['then'](respondWithFilteredResult(_0x4a0a37,_0x94c862))[_0xb25b('0x44')](handleError(_0x4a0a37,null));};exports['show']=function(_0x933c83,_0x3ac544){var _0x31fc29={'raw':!![],'where':{'id':_0x933c83['params']['id']}},_0x2b6d9c={};_0x2b6d9c[_0xb25b('0x35')]=_[_0xb25b('0x45')](db[_0xb25b('0x42')]['rawAttributes']);_0x2b6d9c[_0xb25b('0x33')]=_[_0xb25b('0x45')](_0x933c83[_0xb25b('0x33')]);_0x2b6d9c[_0xb25b('0x46')]=_[_0xb25b('0x34')](_0x2b6d9c['model'],_0x2b6d9c['query']);_0x31fc29[_0xb25b('0x36')]=_['intersection'](_0x2b6d9c[_0xb25b('0x35')],qs['fields'](_0x933c83[_0xb25b('0x33')][_0xb25b('0x37')]));_0x31fc29[_0xb25b('0x36')]=_0x31fc29[_0xb25b('0x36')][_0xb25b('0x47')]?_0x31fc29[_0xb25b('0x36')]:_0x2b6d9c[_0xb25b('0x35')];if(_0x933c83['query'][_0xb25b('0x48')]){_0x31fc29[_0xb25b('0x49')]=[{'all':!![]}];}_0x31fc29=_['merge']({},_0x31fc29,_0x933c83[_0xb25b('0x41')]);return db['OpenchannelQueueReport']['find'](_0x31fc29)[_0xb25b('0x28')](handleEntityNotFound(_0x3ac544,null))[_0xb25b('0x28')](respondWithResult(_0x3ac544,null))['catch'](handleError(_0x3ac544,null));};exports['create']=function(_0x2c9ad5,_0x4936e1){return db[_0xb25b('0x42')][_0xb25b('0x4a')](_0x2c9ad5[_0xb25b('0x4b')],{})[_0xb25b('0x28')](respondWithResult(_0x4936e1,0xc9))[_0xb25b('0x44')](handleError(_0x4936e1,null));};exports[_0xb25b('0x27')]=function(_0x683db1,_0x39e44e){if(_0x683db1[_0xb25b('0x4b')]['id']){delete _0x683db1[_0xb25b('0x4b')]['id'];}return db[_0xb25b('0x42')][_0xb25b('0x4c')]({'where':{'id':_0x683db1[_0xb25b('0x4d')]['id']}})[_0xb25b('0x28')](handleEntityNotFound(_0x39e44e,null))[_0xb25b('0x28')](saveUpdates(_0x683db1[_0xb25b('0x4b')],null))['then'](respondWithResult(_0x39e44e,null))[_0xb25b('0x44')](handleError(_0x39e44e,null));};exports[_0xb25b('0x4e')]=function(_0x58797e,_0x216716){return db[_0xb25b('0x42')][_0xb25b('0x4c')]({'where':{'id':_0x58797e[_0xb25b('0x4d')]['id']}})[_0xb25b('0x28')](handleEntityNotFound(_0x216716,null))[_0xb25b('0x28')](removeEntity(_0x216716,null))[_0xb25b('0x44')](handleError(_0x216716,null));};exports[_0xb25b('0x4f')]=function(_0x5e1c6b,_0x30da09){return db['OpenchannelQueueReport'][_0xb25b('0x4f')]()['then'](respondWithResult(_0x30da09,null))['catch'](handleError(_0x30da09,null));}; \ No newline at end of file +var _0x8a0b=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','limit','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','OpenchannelQueueReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x5f0869,_0x2b643c){var _0x5c5ef2=function(_0x856497){while(--_0x856497){_0x5f0869['push'](_0x5f0869['shift']());}};_0x5c5ef2(++_0x2b643c);}(_0x8a0b,0xd9));var _0xb8a0=function(_0x507df0,_0xdd3152){_0x507df0=_0x507df0-0x0;var _0x38ce69=_0x8a0b[_0x507df0];return _0x38ce69;};'use strict';var emlformat=require(_0xb8a0('0x0'));var rimraf=require(_0xb8a0('0x1'));var zipdir=require(_0xb8a0('0x2'));var jsonpatch=require(_0xb8a0('0x3'));var rp=require(_0xb8a0('0x4'));var moment=require(_0xb8a0('0x5'));var BPromise=require(_0xb8a0('0x6'));var Mustache=require(_0xb8a0('0x7'));var util=require(_0xb8a0('0x8'));var path=require(_0xb8a0('0x9'));var sox=require('sox');var csv=require(_0xb8a0('0xa'));var ejs=require(_0xb8a0('0xb'));var fs=require('fs');var fs_extra=require(_0xb8a0('0xc'));var _=require('lodash');var squel=require(_0xb8a0('0xd'));var crypto=require(_0xb8a0('0xe'));var jsforce=require(_0xb8a0('0xf'));var deskjs=require(_0xb8a0('0x10'));var toCsv=require(_0xb8a0('0xa'));var querystring=require(_0xb8a0('0x11'));var Papa=require('papaparse');var Redis=require(_0xb8a0('0x12'));var authService=require(_0xb8a0('0x13'));var qs=require(_0xb8a0('0x14'));var as=require(_0xb8a0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8a0('0x16'))(_0xb8a0('0x17'));var utils=require('../../config/utils');var config=require(_0xb8a0('0x18'));var licenseUtil=require(_0xb8a0('0x19'));var db=require(_0xb8a0('0x1a'))['db'];function respondWithStatusCode(_0x1ecf57,_0x493d1c){_0x493d1c=_0x493d1c||0xcc;return function(_0x27c79e){if(_0x27c79e){return _0x1ecf57['sendStatus'](_0x493d1c);}return _0x1ecf57['status'](_0x493d1c)[_0xb8a0('0x1b')]();};}function respondWithResult(_0x18207c,_0x5f3e68){_0x5f3e68=_0x5f3e68||0xc8;return function(_0xef7f39){if(_0xef7f39){return _0x18207c['status'](_0x5f3e68)['json'](_0xef7f39);}};}function respondWithFilteredResult(_0x24b966,_0x4f85b7){return function(_0xa1718e){if(_0xa1718e){var _0xd40621=typeof _0x4f85b7['offset']==='undefined'&&typeof _0x4f85b7[_0xb8a0('0x1c')]===_0xb8a0('0x1d');var _0x35b6cd=_0xa1718e[_0xb8a0('0x1e')];var _0x270a71=_0xd40621?0x0:_0x4f85b7['offset'];var _0x264251=_0xd40621?_0xa1718e[_0xb8a0('0x1e')]:_0x4f85b7[_0xb8a0('0x1f')]+_0x4f85b7[_0xb8a0('0x1c')];var _0x2846f9;if(_0x264251>=_0x35b6cd){_0x264251=_0x35b6cd;_0x2846f9=0xc8;}else{_0x2846f9=0xce;}_0x24b966[_0xb8a0('0x20')](_0x2846f9);return _0x24b966[_0xb8a0('0x21')](_0xb8a0('0x22'),_0x270a71+'-'+_0x264251+'/'+_0x35b6cd)[_0xb8a0('0x23')](_0xa1718e);}return null;};}function patchUpdates(_0x57b2b7){return function(_0x287823){try{jsonpatch[_0xb8a0('0x24')](_0x287823,_0x57b2b7,!![]);}catch(_0x4e6993){return BPromise[_0xb8a0('0x25')](_0x4e6993);}return _0x287823[_0xb8a0('0x26')]();};}function saveUpdates(_0x446dab,_0x2c2016){return function(_0x7ff054){if(_0x7ff054){return _0x7ff054[_0xb8a0('0x27')](_0x446dab)[_0xb8a0('0x28')](function(_0x58c64f){return _0x58c64f;});}return null;};}function removeEntity(_0x40f56e,_0x528955){return function(_0x357005){if(_0x357005){return _0x357005[_0xb8a0('0x29')]()[_0xb8a0('0x28')](function(){_0x40f56e['status'](0xcc)[_0xb8a0('0x1b')]();});}};}function handleEntityNotFound(_0x2f32f3,_0x33b3ad){return function(_0x52e383){if(!_0x52e383){_0x2f32f3[_0xb8a0('0x2a')](0x194);}return _0x52e383;};}function handleError(_0x43019,_0x3ea075){_0x3ea075=_0x3ea075||0x1f4;return function(_0x4c937b){logger['error'](_0x4c937b[_0xb8a0('0x2b')]);if(_0x4c937b[_0xb8a0('0x2c')]){delete _0x4c937b[_0xb8a0('0x2c')];}_0x43019[_0xb8a0('0x20')](_0x3ea075)['send'](_0x4c937b);};}exports[_0xb8a0('0x2d')]=function(_0x402184,_0x20187a){var _0x11edab={},_0x25e350={},_0xedf5c2={'count':0x0,'rows':[]};var _0x9e9dab=_[_0xb8a0('0x2e')](db[_0xb8a0('0x2f')]['rawAttributes'],function(_0x5a1382){return{'name':_0x5a1382[_0xb8a0('0x30')],'type':_0x5a1382[_0xb8a0('0x31')][_0xb8a0('0x32')]};});_0x25e350['model']=_[_0xb8a0('0x2e')](_0x9e9dab,_0xb8a0('0x2c'));_0x25e350['query']=_[_0xb8a0('0x33')](_0x402184[_0xb8a0('0x34')]);_0x25e350[_0xb8a0('0x35')]=_[_0xb8a0('0x36')](_0x25e350[_0xb8a0('0x37')],_0x25e350['query']);_0x11edab[_0xb8a0('0x38')]=_[_0xb8a0('0x36')](_0x25e350[_0xb8a0('0x37')],qs[_0xb8a0('0x39')](_0x402184[_0xb8a0('0x34')][_0xb8a0('0x39')]));_0x11edab[_0xb8a0('0x38')]=_0x11edab[_0xb8a0('0x38')][_0xb8a0('0x3a')]?_0x11edab[_0xb8a0('0x38')]:_0x25e350['model'];if(!_0x402184[_0xb8a0('0x34')]['hasOwnProperty']('nolimit')){_0x11edab[_0xb8a0('0x1c')]=qs['limit'](_0x402184[_0xb8a0('0x34')]['limit']);_0x11edab[_0xb8a0('0x1f')]=qs['offset'](_0x402184[_0xb8a0('0x34')][_0xb8a0('0x1f')]);}_0x11edab[_0xb8a0('0x3b')]=qs[_0xb8a0('0x3c')](_0x402184[_0xb8a0('0x34')][_0xb8a0('0x3c')]);_0x11edab[_0xb8a0('0x3d')]=qs[_0xb8a0('0x35')](_[_0xb8a0('0x3e')](_0x402184[_0xb8a0('0x34')],_0x25e350[_0xb8a0('0x35')]),_0x9e9dab);if(_0x402184[_0xb8a0('0x34')][_0xb8a0('0x3f')]){_0x11edab['where']=_[_0xb8a0('0x40')](_0x11edab[_0xb8a0('0x3d')],{'$or':_[_0xb8a0('0x2e')](_0x9e9dab,function(_0x544756){if(_0x544756[_0xb8a0('0x31')]!==_0xb8a0('0x41')){var _0x5352c0={};_0x5352c0[_0x544756['name']]={'$like':'%'+_0x402184[_0xb8a0('0x34')][_0xb8a0('0x3f')]+'%'};return _0x5352c0;}})});}_0x11edab=_[_0xb8a0('0x40')]({},_0x11edab,_0x402184[_0xb8a0('0x42')]);var _0x5cee3a={'where':_0x11edab['where']};return db['OpenchannelQueueReport'][_0xb8a0('0x1e')](_0x5cee3a)[_0xb8a0('0x28')](function(_0x15182e){_0xedf5c2[_0xb8a0('0x1e')]=_0x15182e;if(_0x402184[_0xb8a0('0x34')][_0xb8a0('0x43')]){_0x11edab[_0xb8a0('0x44')]=[{'all':!![]}];}return db[_0xb8a0('0x2f')]['findAll'](_0x11edab);})['then'](function(_0x3d70b9){_0xedf5c2[_0xb8a0('0x45')]=_0x3d70b9;return _0xedf5c2;})['then'](respondWithFilteredResult(_0x20187a,_0x11edab))[_0xb8a0('0x46')](handleError(_0x20187a,null));};exports['show']=function(_0x5a907b,_0x5631bc){var _0x9f8d54={'raw':!![],'where':{'id':_0x5a907b[_0xb8a0('0x47')]['id']}},_0x144c61={};_0x144c61[_0xb8a0('0x37')]=_[_0xb8a0('0x33')](db[_0xb8a0('0x2f')][_0xb8a0('0x48')]);_0x144c61[_0xb8a0('0x34')]=_[_0xb8a0('0x33')](_0x5a907b[_0xb8a0('0x34')]);_0x144c61[_0xb8a0('0x35')]=_[_0xb8a0('0x36')](_0x144c61[_0xb8a0('0x37')],_0x144c61[_0xb8a0('0x34')]);_0x9f8d54['attributes']=_[_0xb8a0('0x36')](_0x144c61[_0xb8a0('0x37')],qs[_0xb8a0('0x39')](_0x5a907b[_0xb8a0('0x34')][_0xb8a0('0x39')]));_0x9f8d54[_0xb8a0('0x38')]=_0x9f8d54[_0xb8a0('0x38')]['length']?_0x9f8d54[_0xb8a0('0x38')]:_0x144c61[_0xb8a0('0x37')];if(_0x5a907b[_0xb8a0('0x34')]['includeAll']){_0x9f8d54[_0xb8a0('0x44')]=[{'all':!![]}];}_0x9f8d54=_[_0xb8a0('0x40')]({},_0x9f8d54,_0x5a907b[_0xb8a0('0x42')]);return db[_0xb8a0('0x2f')][_0xb8a0('0x49')](_0x9f8d54)[_0xb8a0('0x28')](handleEntityNotFound(_0x5631bc,null))[_0xb8a0('0x28')](respondWithResult(_0x5631bc,null))[_0xb8a0('0x46')](handleError(_0x5631bc,null));};exports[_0xb8a0('0x4a')]=function(_0x3d2783,_0x270cee){return db['OpenchannelQueueReport'][_0xb8a0('0x4a')](_0x3d2783[_0xb8a0('0x4b')],{})[_0xb8a0('0x28')](respondWithResult(_0x270cee,0xc9))['catch'](handleError(_0x270cee,null));};exports[_0xb8a0('0x27')]=function(_0x451a49,_0x3adb25){if(_0x451a49[_0xb8a0('0x4b')]['id']){delete _0x451a49['body']['id'];}return db[_0xb8a0('0x2f')][_0xb8a0('0x49')]({'where':{'id':_0x451a49[_0xb8a0('0x47')]['id']}})[_0xb8a0('0x28')](handleEntityNotFound(_0x3adb25,null))[_0xb8a0('0x28')](saveUpdates(_0x451a49[_0xb8a0('0x4b')],null))[_0xb8a0('0x28')](respondWithResult(_0x3adb25,null))['catch'](handleError(_0x3adb25,null));};exports[_0xb8a0('0x29')]=function(_0x5e44cb,_0x249bbd){return db[_0xb8a0('0x2f')]['find']({'where':{'id':_0x5e44cb[_0xb8a0('0x47')]['id']}})[_0xb8a0('0x28')](handleEntityNotFound(_0x249bbd,null))[_0xb8a0('0x28')](removeEntity(_0x249bbd,null))['catch'](handleError(_0x249bbd,null));};exports[_0xb8a0('0x4c')]=function(_0x479467,_0x381575){return db[_0xb8a0('0x2f')][_0xb8a0('0x4c')]()[_0xb8a0('0x28')](respondWithResult(_0x381575,null))[_0xb8a0('0x46')](handleError(_0x381575,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d2f708e..f497882 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x3840a9,_0x343e7a){var _0x1965d7=function(_0x1cbb95){while(--_0x1cbb95){_0x3840a9['push'](_0x3840a9['shift']());}};_0x1965d7(++_0x343e7a);}(_0x7a54,0x106));var _0x47a5=function(_0x100d4c,_0x18b42d){_0x100d4c=_0x100d4c-0x0;var _0x369fe9=_0x7a54[_0x100d4c];return _0x369fe9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x362cc8,_0x2847fb){var _0x30417f=function(_0x353672){while(--_0x353672){_0x362cc8['push'](_0x362cc8['shift']());}};_0x30417f(++_0x2847fb);}(_0x326f,0xd1));var _0xf326=function(_0x3a56e7,_0x5b82ba){_0x3a56e7=_0x3a56e7-0x0;var _0x5dfd47=_0x326f[_0x3a56e7];return _0x5dfd47;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ecf98bd..f131fec 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 _0xea28=['request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','debug','UpdateOpenchannelQueueReport','update','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x45f6ed,_0x5236db){var _0x1ecdb7=function(_0x57e931){while(--_0x57e931){_0x45f6ed['push'](_0x45f6ed['shift']());}};_0x1ecdb7(++_0x5236db);}(_0xea28,0x13a));var _0x8ea2=function(_0x51f0cf,_0x1e8726){_0x51f0cf=_0x51f0cf-0x0;var _0x3c5f7f=_0xea28[_0x51f0cf];return _0x3c5f7f;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')](_0x1b64cf[_0x8ea2('0x1a')],{'raw':_0x1b64cf[_0x8ea2('0x1b')]?_0x1b64cf['options']['raw']===undefined?!![]:![]:!![]})[_0x8ea2('0xd')](function(_0x248c18){logger[_0x8ea2('0xe')]('CreateOpenchannelQueueReport',_0x1b64cf);logger[_0x8ea2('0x1c')](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x248c18));_0x467045(_0x248c18);})[_0x8ea2('0x16')](function(_0x283f00){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x283f00[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x283f00[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x1d')]=function(_0x18ec34){var _0x4d5030=this;return new Promise(function(_0x433bc5,_0x4f48bd){return db[_0x8ea2('0x18')][_0x8ea2('0x1e')](_0x18ec34[_0x8ea2('0x1a')],{'raw':_0x18ec34['options']?_0x18ec34['options'][_0x8ea2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ec34['options']?_0x18ec34[_0x8ea2('0x1b')]['where']||null:null,'attributes':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34[_0x8ea2('0x1b')][_0x8ea2('0x20')]||null:null,'limit':_0x18ec34[_0x8ea2('0x1b')]?_0x18ec34['options']['limit']||null:null})[_0x8ea2('0xd')](function(_0x4da5b3){logger[_0x8ea2('0xe')](_0x8ea2('0x1d'),_0x18ec34);logger[_0x8ea2('0x1c')](_0x8ea2('0x1d'),_0x18ec34,JSON[_0x8ea2('0x11')](_0x4da5b3));_0x433bc5(_0x4da5b3);})[_0x8ea2('0x16')](function(_0x32e225){logger[_0x8ea2('0x12')](_0x8ea2('0x1d'),_0x32e225[_0x8ea2('0x14')],_0x18ec34);_0x4f48bd(_0x4d5030['error'](0x1f4,_0x32e225['message']));});});}; \ No newline at end of file +var _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0x13bea0,_0x210a0c){var _0x3f12df=function(_0x11ef1c){while(--_0x11ef1c){_0x13bea0['push'](_0x13bea0['shift']());}};_0x3f12df(++_0x210a0c);}(_0x14a0,0x8e));var _0x014a=function(_0x405d6a,_0x5f5872){_0x405d6a=_0x405d6a-0x0;var _0x226b66=_0x14a0[_0x405d6a];return _0x226b66;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a6b70f5..9f73239 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 _0x7e77=['create','put','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','/:id','post'];(function(_0xa60bb3,_0x3dc08e){var _0x5f4d02=function(_0x404b95){while(--_0x404b95){_0xa60bb3['push'](_0xa60bb3['shift']());}};_0x5f4d02(++_0x3dc08e);}(_0x7e77,0xca));var _0x77e7=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x7e77[_0x1c34e7];return _0x378cb1;};'use strict';var multer=require(_0x77e7('0x0'));var util=require('util');var path=require(_0x77e7('0x1'));var timeout=require('connect-timeout');var express=require(_0x77e7('0x2'));var router=express['Router']();var fs_extra=require(_0x77e7('0x3'));var auth=require(_0x77e7('0x4'));var interaction=require(_0x77e7('0x5'));var config=require(_0x77e7('0x6'));var controller=require(_0x77e7('0x7'));router[_0x77e7('0x8')]('/',auth['isAuthenticated'](),controller[_0x77e7('0x9')]);router[_0x77e7('0x8')](_0x77e7('0xa'),auth[_0x77e7('0xb')](),controller['describe']);router[_0x77e7('0x8')](_0x77e7('0xc'),auth[_0x77e7('0xb')](),controller['show']);router[_0x77e7('0xd')]('/',auth[_0x77e7('0xb')](),controller[_0x77e7('0xe')]);router[_0x77e7('0xf')]('/:id',auth[_0x77e7('0xb')](),controller['update']);router[_0x77e7('0x10')](_0x77e7('0xc'),auth['isAuthenticated'](),controller[_0x77e7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x75ee=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','delete','exports','multer','util','connect-timeout'];(function(_0x319e22,_0x52f5c9){var _0x16d5d5=function(_0x11c5d4){while(--_0x11c5d4){_0x319e22['push'](_0x319e22['shift']());}};_0x16d5d5(++_0x52f5c9);}(_0x75ee,0x1eb));var _0xe75e=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x75ee[_0x2ae8ce];return _0x4bf686;};'use strict';var multer=require(_0xe75e('0x0'));var util=require(_0xe75e('0x1'));var path=require('path');var timeout=require(_0xe75e('0x2'));var express=require(_0xe75e('0x3'));var router=express[_0xe75e('0x4')]();var fs_extra=require(_0xe75e('0x5'));var auth=require(_0xe75e('0x6'));var interaction=require(_0xe75e('0x7'));var config=require('../../config/environment');var controller=require(_0xe75e('0x8'));router[_0xe75e('0x9')]('/',auth[_0xe75e('0xa')](),controller[_0xe75e('0xb')]);router[_0xe75e('0x9')](_0xe75e('0xc'),auth[_0xe75e('0xa')](),controller[_0xe75e('0xd')]);router[_0xe75e('0x9')](_0xe75e('0xe'),auth[_0xe75e('0xa')](),controller['show']);router[_0xe75e('0xf')]('/',auth[_0xe75e('0xa')](),controller['create']);router[_0xe75e('0x10')]('/:id',auth[_0xe75e('0xa')](),controller['update']);router[_0xe75e('0x11')](_0xe75e('0xe'),auth[_0xe75e('0xa')](),controller['destroy']);module[_0xe75e('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 5a6774a..f3f2ef0 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0x34e8,0x12c));var _0x834e=function(_0x32bee5,_0x39ca55){_0x32bee5=_0x32bee5-0x0;var _0x45e1e5=_0x34e8[_0x32bee5];return _0x45e1e5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1e4f4e,_0x4eeee0){var _0x568fe2=function(_0x445694){while(--_0x445694){_0x1e4f4e['push'](_0x1e4f4e['shift']());}};_0x568fe2(++_0x4eeee0);}(_0x008c,0x188));var _0xc008=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x008c[_0x4b2863];return _0x567d67;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index b798622..05e2645 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 _0xebab=['crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','include','findAll','then','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel'];(function(_0x4c1051,_0x198891){var _0x12f3d0=function(_0xbbba5e){while(--_0xbbba5e){_0x4c1051['push'](_0x4c1051['shift']());}};_0x12f3d0(++_0x198891);}(_0xebab,0x8c));var _0xbeba=function(_0x484d69,_0x49555f){_0x484d69=_0x484d69-0x0;var _0xcb8215=_0xebab[_0x484d69];return _0xcb8215;};'use strict';var emlformat=require(_0xbeba('0x0'));var rimraf=require(_0xbeba('0x1'));var zipdir=require(_0xbeba('0x2'));var jsonpatch=require(_0xbeba('0x3'));var rp=require(_0xbeba('0x4'));var moment=require(_0xbeba('0x5'));var BPromise=require(_0xbeba('0x6'));var Mustache=require(_0xbeba('0x7'));var util=require(_0xbeba('0x8'));var path=require(_0xbeba('0x9'));var sox=require(_0xbeba('0xa'));var csv=require('to-csv');var ejs=require(_0xbeba('0xb'));var fs=require('fs');var fs_extra=require(_0xbeba('0xc'));var _=require('lodash');var squel=require(_0xbeba('0xd'));var crypto=require(_0xbeba('0xe'));var jsforce=require(_0xbeba('0xf'));var deskjs=require(_0xbeba('0x10'));var toCsv=require(_0xbeba('0x11'));var querystring=require('querystring');var Papa=require(_0xbeba('0x12'));var Redis=require(_0xbeba('0x13'));var authService=require(_0xbeba('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbeba('0x15'));var hardwareService=require(_0xbeba('0x16'));var logger=require(_0xbeba('0x17'))(_0xbeba('0x18'));var utils=require('../../config/utils');var config=require(_0xbeba('0x19'));var licenseUtil=require(_0xbeba('0x1a'));var db=require(_0xbeba('0x1b'))['db'];function respondWithStatusCode(_0x52092c,_0x2648d1){_0x2648d1=_0x2648d1||0xcc;return function(_0x4c7341){if(_0x4c7341){return _0x52092c[_0xbeba('0x1c')](_0x2648d1);}return _0x52092c['status'](_0x2648d1)[_0xbeba('0x1d')]();};}function respondWithResult(_0x14eceb,_0x3b06b9){_0x3b06b9=_0x3b06b9||0xc8;return function(_0x2abb66){if(_0x2abb66){return _0x14eceb[_0xbeba('0x1e')](_0x3b06b9)[_0xbeba('0x1f')](_0x2abb66);}};}function respondWithFilteredResult(_0x1bff22,_0x3c170b){return function(_0x1f4564){if(_0x1f4564){var _0x1d1f8d=typeof _0x3c170b[_0xbeba('0x20')]===_0xbeba('0x21')&&typeof _0x3c170b[_0xbeba('0x22')]===_0xbeba('0x21');var _0x30fa8b=_0x1f4564[_0xbeba('0x23')];var _0x31a2cf=_0x1d1f8d?0x0:_0x3c170b[_0xbeba('0x20')];var _0x4f414e=_0x1d1f8d?_0x1f4564[_0xbeba('0x23')]:_0x3c170b[_0xbeba('0x20')]+_0x3c170b[_0xbeba('0x22')];var _0x7703ff;if(_0x4f414e>=_0x30fa8b){_0x4f414e=_0x30fa8b;_0x7703ff=0xc8;}else{_0x7703ff=0xce;}_0x1bff22[_0xbeba('0x1e')](_0x7703ff);return _0x1bff22[_0xbeba('0x24')]('Content-Range',_0x31a2cf+'-'+_0x4f414e+'/'+_0x30fa8b)[_0xbeba('0x1f')](_0x1f4564);}return null;};}function patchUpdates(_0x5af800){return function(_0x4f80e5){try{jsonpatch[_0xbeba('0x25')](_0x4f80e5,_0x5af800,!![]);}catch(_0x6aeacc){return BPromise[_0xbeba('0x26')](_0x6aeacc);}return _0x4f80e5[_0xbeba('0x27')]();};}function saveUpdates(_0x3f6ac9,_0x48d6b4){return function(_0x291f9a){if(_0x291f9a){return _0x291f9a[_0xbeba('0x28')](_0x3f6ac9)['then'](function(_0x55327d){return _0x55327d;});}return null;};}function removeEntity(_0x1838fb,_0x46430d){return function(_0x18ffc8){if(_0x18ffc8){return _0x18ffc8[_0xbeba('0x29')]()['then'](function(){_0x1838fb[_0xbeba('0x1e')](0xcc)[_0xbeba('0x1d')]();});}};}function handleEntityNotFound(_0x27f4ef,_0x6c595e){return function(_0x12ef02){if(!_0x12ef02){_0x27f4ef['sendStatus'](0x194);}return _0x12ef02;};}function handleError(_0x3da092,_0x2e4349){_0x2e4349=_0x2e4349||0x1f4;return function(_0x42d929){logger[_0xbeba('0x2a')](_0x42d929[_0xbeba('0x2b')]);if(_0x42d929['name']){delete _0x42d929[_0xbeba('0x2c')];}_0x3da092[_0xbeba('0x1e')](_0x2e4349)[_0xbeba('0x2d')](_0x42d929);};}exports[_0xbeba('0x2e')]=function(_0x388dd7,_0x609164){var _0x27b00e={},_0x530ff0={},_0x521145={'count':0x0,'rows':[]};var _0x301425=_[_0xbeba('0x2f')](db[_0xbeba('0x30')]['rawAttributes'],function(_0x1a948f){return{'name':_0x1a948f[_0xbeba('0x31')],'type':_0x1a948f[_0xbeba('0x32')]['key']};});_0x530ff0[_0xbeba('0x33')]=_['map'](_0x301425,'name');_0x530ff0[_0xbeba('0x34')]=_[_0xbeba('0x35')](_0x388dd7[_0xbeba('0x34')]);_0x530ff0[_0xbeba('0x36')]=_[_0xbeba('0x37')](_0x530ff0[_0xbeba('0x33')],_0x530ff0[_0xbeba('0x34')]);_0x27b00e[_0xbeba('0x38')]=_[_0xbeba('0x37')](_0x530ff0[_0xbeba('0x33')],qs['fields'](_0x388dd7['query']['fields']));_0x27b00e['attributes']=_0x27b00e['attributes'][_0xbeba('0x39')]?_0x27b00e[_0xbeba('0x38')]:_0x530ff0['model'];if(!_0x388dd7['query'][_0xbeba('0x3a')]('nolimit')){_0x27b00e[_0xbeba('0x22')]=qs[_0xbeba('0x22')](_0x388dd7[_0xbeba('0x34')]['limit']);_0x27b00e[_0xbeba('0x20')]=qs['offset'](_0x388dd7['query'][_0xbeba('0x20')]);}_0x27b00e['order']=qs[_0xbeba('0x3b')](_0x388dd7[_0xbeba('0x34')][_0xbeba('0x3b')]);_0x27b00e[_0xbeba('0x3c')]=qs['filters'](_[_0xbeba('0x3d')](_0x388dd7[_0xbeba('0x34')],_0x530ff0[_0xbeba('0x36')]),_0x301425);if(_0x388dd7['query'][_0xbeba('0x3e')]){_0x27b00e[_0xbeba('0x3c')]=_['merge'](_0x27b00e[_0xbeba('0x3c')],{'$or':_['map'](_0x301425,function(_0x47f66c){if(_0x47f66c[_0xbeba('0x32')]!=='VIRTUAL'){var _0x5e0f68={};_0x5e0f68[_0x47f66c[_0xbeba('0x2c')]]={'$like':'%'+_0x388dd7[_0xbeba('0x34')][_0xbeba('0x3e')]+'%'};return _0x5e0f68;}})});}_0x27b00e=_['merge']({},_0x27b00e,_0x388dd7['options']);var _0x4f12e2={'where':_0x27b00e[_0xbeba('0x3c')]};return db[_0xbeba('0x30')][_0xbeba('0x23')](_0x4f12e2)['then'](function(_0x33e1cb){_0x521145[_0xbeba('0x23')]=_0x33e1cb;if(_0x388dd7[_0xbeba('0x34')]['includeAll']){_0x27b00e[_0xbeba('0x3f')]=[{'all':!![]}];}return db[_0xbeba('0x30')][_0xbeba('0x40')](_0x27b00e);})[_0xbeba('0x41')](function(_0x342aa1){_0x521145[_0xbeba('0x42')]=_0x342aa1;return _0x521145;})[_0xbeba('0x41')](respondWithFilteredResult(_0x609164,_0x27b00e))[_0xbeba('0x43')](handleError(_0x609164,null));};exports[_0xbeba('0x44')]=function(_0x2f9cf7,_0x46e8fb){var _0x48c413={'raw':!![],'where':{'id':_0x2f9cf7[_0xbeba('0x45')]['id']}},_0x22c540={};_0x22c540[_0xbeba('0x33')]=_['keys'](db[_0xbeba('0x30')][_0xbeba('0x46')]);_0x22c540[_0xbeba('0x34')]=_[_0xbeba('0x35')](_0x2f9cf7['query']);_0x22c540[_0xbeba('0x36')]=_[_0xbeba('0x37')](_0x22c540['model'],_0x22c540['query']);_0x48c413[_0xbeba('0x38')]=_[_0xbeba('0x37')](_0x22c540[_0xbeba('0x33')],qs[_0xbeba('0x47')](_0x2f9cf7[_0xbeba('0x34')][_0xbeba('0x47')]));_0x48c413[_0xbeba('0x38')]=_0x48c413['attributes'][_0xbeba('0x39')]?_0x48c413[_0xbeba('0x38')]:_0x22c540[_0xbeba('0x33')];if(_0x2f9cf7[_0xbeba('0x34')][_0xbeba('0x48')]){_0x48c413[_0xbeba('0x3f')]=[{'all':!![]}];}_0x48c413=_['merge']({},_0x48c413,_0x2f9cf7['options']);return db[_0xbeba('0x30')][_0xbeba('0x49')](_0x48c413)['then'](handleEntityNotFound(_0x46e8fb,null))['then'](respondWithResult(_0x46e8fb,null))[_0xbeba('0x43')](handleError(_0x46e8fb,null));};exports[_0xbeba('0x4a')]=function(_0x2e76aa,_0x7e75d4){return db[_0xbeba('0x30')][_0xbeba('0x4a')](_0x2e76aa[_0xbeba('0x4b')],{})[_0xbeba('0x41')](respondWithResult(_0x7e75d4,0xc9))[_0xbeba('0x43')](handleError(_0x7e75d4,null));};exports['update']=function(_0xc74ff3,_0x5dd891){if(_0xc74ff3[_0xbeba('0x4b')]['id']){delete _0xc74ff3[_0xbeba('0x4b')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0xc74ff3[_0xbeba('0x45')]['id']}})[_0xbeba('0x41')](handleEntityNotFound(_0x5dd891,null))['then'](saveUpdates(_0xc74ff3[_0xbeba('0x4b')],null))[_0xbeba('0x41')](respondWithResult(_0x5dd891,null))['catch'](handleError(_0x5dd891,null));};exports[_0xbeba('0x29')]=function(_0x18c31f,_0x11b381){return db['OpenchannelTransferReport'][_0xbeba('0x49')]({'where':{'id':_0x18c31f[_0xbeba('0x45')]['id']}})[_0xbeba('0x41')](handleEntityNotFound(_0x11b381,null))[_0xbeba('0x41')](removeEntity(_0x11b381,null))[_0xbeba('0x43')](handleError(_0x11b381,null));};exports['describe']=function(_0x38265c,_0x378b69){return db[_0xbeba('0x30')][_0xbeba('0x4c')]()[_0xbeba('0x41')](respondWithResult(_0x378b69,null))[_0xbeba('0x43')](handleError(_0x378b69,null));}; \ No newline at end of file +var _0xffbd=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','findAll','catch','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x163ce7,_0x56ad60){var _0x4933a1=function(_0x19f5f7){while(--_0x19f5f7){_0x163ce7['push'](_0x163ce7['shift']());}};_0x4933a1(++_0x56ad60);}(_0xffbd,0x84));var _0xdffb=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0xffbd[_0x47f7ec];return _0x415101;};'use strict';var emlformat=require(_0xdffb('0x0'));var rimraf=require(_0xdffb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdffb('0x2'));var moment=require(_0xdffb('0x3'));var BPromise=require(_0xdffb('0x4'));var Mustache=require(_0xdffb('0x5'));var util=require(_0xdffb('0x6'));var path=require('path');var sox=require(_0xdffb('0x7'));var csv=require(_0xdffb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdffb('0x9'));var _=require(_0xdffb('0xa'));var squel=require(_0xdffb('0xb'));var crypto=require(_0xdffb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdffb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdffb('0xe'));var Redis=require(_0xdffb('0xf'));var authService=require(_0xdffb('0x10'));var qs=require(_0xdffb('0x11'));var as=require(_0xdffb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdffb('0x13'))(_0xdffb('0x14'));var utils=require(_0xdffb('0x15'));var config=require(_0xdffb('0x16'));var licenseUtil=require(_0xdffb('0x17'));var db=require(_0xdffb('0x18'))['db'];function respondWithStatusCode(_0x319efc,_0x1ead54){_0x1ead54=_0x1ead54||0xcc;return function(_0x33f35d){if(_0x33f35d){return _0x319efc[_0xdffb('0x19')](_0x1ead54);}return _0x319efc[_0xdffb('0x1a')](_0x1ead54)[_0xdffb('0x1b')]();};}function respondWithResult(_0x2f7c9a,_0x4c0b55){_0x4c0b55=_0x4c0b55||0xc8;return function(_0x21576c){if(_0x21576c){return _0x2f7c9a[_0xdffb('0x1a')](_0x4c0b55)['json'](_0x21576c);}};}function respondWithFilteredResult(_0xb681ed,_0x4bc57b){return function(_0x53a457){if(_0x53a457){var _0x155e79=typeof _0x4bc57b[_0xdffb('0x1c')]===_0xdffb('0x1d')&&typeof _0x4bc57b[_0xdffb('0x1e')]==='undefined';var _0x4602ec=_0x53a457['count'];var _0x1646f9=_0x155e79?0x0:_0x4bc57b['offset'];var _0x237357=_0x155e79?_0x53a457[_0xdffb('0x1f')]:_0x4bc57b[_0xdffb('0x1c')]+_0x4bc57b[_0xdffb('0x1e')];var _0x26b9ff;if(_0x237357>=_0x4602ec){_0x237357=_0x4602ec;_0x26b9ff=0xc8;}else{_0x26b9ff=0xce;}_0xb681ed['status'](_0x26b9ff);return _0xb681ed[_0xdffb('0x20')]('Content-Range',_0x1646f9+'-'+_0x237357+'/'+_0x4602ec)[_0xdffb('0x21')](_0x53a457);}return null;};}function patchUpdates(_0x1e2e50){return function(_0x50d178){try{jsonpatch[_0xdffb('0x22')](_0x50d178,_0x1e2e50,!![]);}catch(_0x4c0132){return BPromise[_0xdffb('0x23')](_0x4c0132);}return _0x50d178[_0xdffb('0x24')]();};}function saveUpdates(_0x2aca33,_0x39cb40){return function(_0x30a0af){if(_0x30a0af){return _0x30a0af[_0xdffb('0x25')](_0x2aca33)[_0xdffb('0x26')](function(_0x2bd31c){return _0x2bd31c;});}return null;};}function removeEntity(_0x260aa4,_0x7f26a6){return function(_0x19cd9e){if(_0x19cd9e){return _0x19cd9e['destroy']()[_0xdffb('0x26')](function(){_0x260aa4['status'](0xcc)[_0xdffb('0x1b')]();});}};}function handleEntityNotFound(_0x47d7a2,_0x931ca6){return function(_0x23e862){if(!_0x23e862){_0x47d7a2[_0xdffb('0x19')](0x194);}return _0x23e862;};}function handleError(_0x2ebf26,_0x2c4d8e){_0x2c4d8e=_0x2c4d8e||0x1f4;return function(_0xba1453){logger[_0xdffb('0x27')](_0xba1453[_0xdffb('0x28')]);if(_0xba1453[_0xdffb('0x29')]){delete _0xba1453[_0xdffb('0x29')];}_0x2ebf26[_0xdffb('0x1a')](_0x2c4d8e)[_0xdffb('0x2a')](_0xba1453);};}exports['index']=function(_0x5b992f,_0x1367f4){var _0x213421={},_0x2a53bf={},_0x3b1b3d={'count':0x0,'rows':[]};var _0x45e725=_[_0xdffb('0x2b')](db[_0xdffb('0x2c')][_0xdffb('0x2d')],function(_0x5d5b03){return{'name':_0x5d5b03[_0xdffb('0x2e')],'type':_0x5d5b03[_0xdffb('0x2f')]['key']};});_0x2a53bf[_0xdffb('0x30')]=_[_0xdffb('0x2b')](_0x45e725,_0xdffb('0x29'));_0x2a53bf['query']=_[_0xdffb('0x31')](_0x5b992f['query']);_0x2a53bf[_0xdffb('0x32')]=_[_0xdffb('0x33')](_0x2a53bf[_0xdffb('0x30')],_0x2a53bf['query']);_0x213421[_0xdffb('0x34')]=_[_0xdffb('0x33')](_0x2a53bf[_0xdffb('0x30')],qs['fields'](_0x5b992f[_0xdffb('0x35')][_0xdffb('0x36')]));_0x213421[_0xdffb('0x34')]=_0x213421[_0xdffb('0x34')][_0xdffb('0x37')]?_0x213421[_0xdffb('0x34')]:_0x2a53bf[_0xdffb('0x30')];if(!_0x5b992f[_0xdffb('0x35')][_0xdffb('0x38')]('nolimit')){_0x213421[_0xdffb('0x1e')]=qs[_0xdffb('0x1e')](_0x5b992f['query'][_0xdffb('0x1e')]);_0x213421[_0xdffb('0x1c')]=qs[_0xdffb('0x1c')](_0x5b992f['query']['offset']);}_0x213421[_0xdffb('0x39')]=qs['sort'](_0x5b992f[_0xdffb('0x35')][_0xdffb('0x3a')]);_0x213421[_0xdffb('0x3b')]=qs['filters'](_[_0xdffb('0x3c')](_0x5b992f[_0xdffb('0x35')],_0x2a53bf['filters']),_0x45e725);if(_0x5b992f[_0xdffb('0x35')]['filter']){_0x213421[_0xdffb('0x3b')]=_['merge'](_0x213421[_0xdffb('0x3b')],{'$or':_['map'](_0x45e725,function(_0x1b0e81){if(_0x1b0e81[_0xdffb('0x2f')]!==_0xdffb('0x3d')){var _0x5b8143={};_0x5b8143[_0x1b0e81[_0xdffb('0x29')]]={'$like':'%'+_0x5b992f['query']['filter']+'%'};return _0x5b8143;}})});}_0x213421=_[_0xdffb('0x3e')]({},_0x213421,_0x5b992f[_0xdffb('0x3f')]);var _0x365b26={'where':_0x213421[_0xdffb('0x3b')]};return db[_0xdffb('0x2c')][_0xdffb('0x1f')](_0x365b26)[_0xdffb('0x26')](function(_0x1e8bba){_0x3b1b3d['count']=_0x1e8bba;if(_0x5b992f['query']['includeAll']){_0x213421['include']=[{'all':!![]}];}return db[_0xdffb('0x2c')][_0xdffb('0x40')](_0x213421);})[_0xdffb('0x26')](function(_0xbfdab2){_0x3b1b3d['rows']=_0xbfdab2;return _0x3b1b3d;})[_0xdffb('0x26')](respondWithFilteredResult(_0x1367f4,_0x213421))[_0xdffb('0x41')](handleError(_0x1367f4,null));};exports['show']=function(_0x423563,_0x22620d){var _0x309746={'raw':!![],'where':{'id':_0x423563[_0xdffb('0x42')]['id']}},_0x5957af={};_0x5957af[_0xdffb('0x30')]=_[_0xdffb('0x31')](db[_0xdffb('0x2c')][_0xdffb('0x2d')]);_0x5957af[_0xdffb('0x35')]=_[_0xdffb('0x31')](_0x423563['query']);_0x5957af[_0xdffb('0x32')]=_[_0xdffb('0x33')](_0x5957af['model'],_0x5957af[_0xdffb('0x35')]);_0x309746['attributes']=_[_0xdffb('0x33')](_0x5957af[_0xdffb('0x30')],qs[_0xdffb('0x36')](_0x423563['query'][_0xdffb('0x36')]));_0x309746[_0xdffb('0x34')]=_0x309746['attributes']['length']?_0x309746[_0xdffb('0x34')]:_0x5957af[_0xdffb('0x30')];if(_0x423563[_0xdffb('0x35')][_0xdffb('0x43')]){_0x309746['include']=[{'all':!![]}];}_0x309746=_[_0xdffb('0x3e')]({},_0x309746,_0x423563['options']);return db[_0xdffb('0x2c')]['find'](_0x309746)[_0xdffb('0x26')](handleEntityNotFound(_0x22620d,null))['then'](respondWithResult(_0x22620d,null))[_0xdffb('0x41')](handleError(_0x22620d,null));};exports[_0xdffb('0x44')]=function(_0x460fbb,_0x56aa4a){return db[_0xdffb('0x2c')][_0xdffb('0x44')](_0x460fbb[_0xdffb('0x45')],{})[_0xdffb('0x26')](respondWithResult(_0x56aa4a,0xc9))[_0xdffb('0x41')](handleError(_0x56aa4a,null));};exports[_0xdffb('0x25')]=function(_0x38e3ec,_0x15076a){if(_0x38e3ec[_0xdffb('0x45')]['id']){delete _0x38e3ec['body']['id'];}return db['OpenchannelTransferReport'][_0xdffb('0x46')]({'where':{'id':_0x38e3ec[_0xdffb('0x42')]['id']}})[_0xdffb('0x26')](handleEntityNotFound(_0x15076a,null))['then'](saveUpdates(_0x38e3ec[_0xdffb('0x45')],null))[_0xdffb('0x26')](respondWithResult(_0x15076a,null))[_0xdffb('0x41')](handleError(_0x15076a,null));};exports[_0xdffb('0x47')]=function(_0x2e9e5e,_0x16a75b){return db[_0xdffb('0x2c')][_0xdffb('0x46')]({'where':{'id':_0x2e9e5e['params']['id']}})[_0xdffb('0x26')](handleEntityNotFound(_0x16a75b,null))[_0xdffb('0x26')](removeEntity(_0x16a75b,null))[_0xdffb('0x41')](handleError(_0x16a75b,null));};exports[_0xdffb('0x48')]=function(_0x347a08,_0x335152){return db['OpenchannelTransferReport'][_0xdffb('0x48')]()[_0xdffb('0x26')](respondWithResult(_0x335152,null))[_0xdffb('0x41')](handleError(_0x335152,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e136456..f5d640f 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 _0xec7a=['util','api','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x22bfdb,_0x47dde1){var _0x14cd82=function(_0x5ebc6a){while(--_0x5ebc6a){_0x22bfdb['push'](_0x22bfdb['shift']());}};_0x14cd82(++_0x47dde1);}(_0xec7a,0x104));var _0xaec7=function(_0x2cc21c,_0x4ceefa){_0x2cc21c=_0x2cc21c-0x0;var _0x59e4ea=_0xec7a[_0x2cc21c];return _0x59e4ea;};'use strict';var _=require('lodash');var util=require(_0xaec7('0x0'));var logger=require('../../config/logger')(_0xaec7('0x1'));var moment=require('moment');var BPromise=require(_0xaec7('0x2'));var rp=require(_0xaec7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaec7('0x4'));var config=require('../../config/environment');var attributes=require(_0xaec7('0x5'));module['exports']=function(_0x14d4b7,_0x51f86c){return _0x14d4b7[_0xaec7('0x6')](_0xaec7('0x7'),attributes,{'tableName':_0xaec7('0x8'),'paranoid':![],'indexes':[{'name':_0xaec7('0x9'),'fields':[_0xaec7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1a1=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash'];(function(_0x35c514,_0x22bb8a){var _0x448f20=function(_0x54f93a){while(--_0x54f93a){_0x35c514['push'](_0x35c514['shift']());}};_0x448f20(++_0x22bb8a);}(_0xf1a1,0x12a));var _0x1f1a=function(_0x98cd6c,_0x4c4d1b){_0x98cd6c=_0x98cd6c-0x0;var _0x4992a8=_0xf1a1[_0x98cd6c];return _0x4992a8;};'use strict';var _=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var logger=require(_0x1f1a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f1a('0x3'));var rp=require(_0x1f1a('0x4'));var fs=require('fs');var path=require(_0x1f1a('0x5'));var rimraf=require(_0x1f1a('0x6'));var config=require(_0x1f1a('0x7'));var attributes=require(_0x1f1a('0x8'));module[_0x1f1a('0x9')]=function(_0x34987e,_0x53eb48){return _0x34987e[_0x1f1a('0xa')](_0x1f1a('0xb'),attributes,{'tableName':_0x1f1a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','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 e25cc17..bd467ec 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 _0xf69d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xc83c25,_0x106681){var _0x5ed069=function(_0x295f04){while(--_0x295f04){_0xc83c25['push'](_0xc83c25['shift']());}};_0x5ed069(++_0x106681);}(_0xf69d,0xd3));var _0xdf69=function(_0x51b2f6,_0x4e452b){_0x51b2f6=_0x51b2f6-0x0;var _0x5c4867=_0xf69d[_0x51b2f6];return _0x5c4867;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});} \ No newline at end of file +var _0x3ca4=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x3ca4,0x17d));var _0x43ca=function(_0x35dd13,_0x22ec10){_0x35dd13=_0x35dd13-0x0;var _0x20b774=_0x3ca4[_0x35dd13];return _0x20b774;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require(_0x43ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ca('0x3'));var db=require(_0x43ca('0x4'))['db'];var utils=require(_0x43ca('0x5'));var logger=require(_0x43ca('0x6'))(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var jayson=require(_0x43ca('0x9'));var client=jayson['client'][_0x43ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ba987,_0x2e6edf,_0x609e75){return new BPromise(function(_0x3147b3,_0x4669f5){return client[_0x43ca('0xb')](_0x1ba987,_0x609e75)[_0x43ca('0xc')](function(_0x4cd9b6){logger['info'](_0x43ca('0xd'),_0x2e6edf,_0x43ca('0xe'));logger[_0x43ca('0xf')](_0x43ca('0x10'),_0x2e6edf,'request\x20sent',JSON[_0x43ca('0x11')](_0x4cd9b6));if(_0x4cd9b6[_0x43ca('0x12')]){if(_0x4cd9b6[_0x43ca('0x12')][_0x43ca('0x13')]===0x1f4){logger[_0x43ca('0x12')](_0x43ca('0xd'),_0x2e6edf,_0x4cd9b6[_0x43ca('0x12')][_0x43ca('0x14')]);return _0x4669f5(_0x4cd9b6[_0x43ca('0x12')]['message']);}logger[_0x43ca('0x12')](_0x43ca('0xd'),_0x2e6edf,_0x4cd9b6['error'][_0x43ca('0x14')]);return _0x3147b3(_0x4cd9b6['error'][_0x43ca('0x14')]);}else{logger['info'](_0x43ca('0xd'),_0x2e6edf,_0x43ca('0xe'));_0x3147b3(_0x4cd9b6['result'][_0x43ca('0x14')]);}})[_0x43ca('0x15')](function(_0x14f9af){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2e6edf,_0x14f9af);_0x4669f5(_0x14f9af);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 18a681f..54b0716 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 _0x188e=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2fcd63,_0x28e560){var _0x1d3ad1=function(_0x1330df){while(--_0x1330df){_0x2fcd63['push'](_0x2fcd63['shift']());}};_0x1d3ad1(++_0x28e560);}(_0x188e,0x1cf));var _0xe188=function(_0x415e32,_0x2abdb4){_0x415e32=_0x415e32-0x0;var _0x5687a1=_0x188e[_0x415e32];return _0x5687a1;};'use strict';var multer=require('multer');var util=require(_0xe188('0x0'));var path=require(_0xe188('0x1'));var timeout=require('connect-timeout');var express=require(_0xe188('0x2'));var router=express[_0xe188('0x3')]();var fs_extra=require(_0xe188('0x4'));var auth=require(_0xe188('0x5'));var interaction=require(_0xe188('0x6'));var config=require(_0xe188('0x7'));var controller=require(_0xe188('0x8'));router['get']('/',auth[_0xe188('0x9')](),controller[_0xe188('0xa')]);router[_0xe188('0xb')](_0xe188('0xc'),auth[_0xe188('0x9')](),controller[_0xe188('0xd')]);router[_0xe188('0xe')]('/',auth['isAuthenticated'](),controller[_0xe188('0xf')]);router[_0xe188('0x10')](_0xe188('0xc'),auth[_0xe188('0x9')](),controller[_0xe188('0x11')]);router[_0xe188('0x12')](_0xe188('0xc'),auth['isAuthenticated'](),controller[_0xe188('0x13')]);module[_0xe188('0x14')]=router; \ No newline at end of file +var _0x0e40=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x556e3b,_0x561ef7){var _0x30ad4a=function(_0x58dbb2){while(--_0x58dbb2){_0x556e3b['push'](_0x556e3b['shift']());}};_0x30ad4a(++_0x561ef7);}(_0x0e40,0x1bc));var _0x00e4=function(_0x45c310,_0x20bdd0){_0x45c310=_0x45c310-0x0;var _0x476a36=_0x0e40[_0x45c310];return _0x476a36;};'use strict';var multer=require('multer');var util=require(_0x00e4('0x0'));var path=require(_0x00e4('0x1'));var timeout=require(_0x00e4('0x2'));var express=require(_0x00e4('0x3'));var router=express[_0x00e4('0x4')]();var fs_extra=require(_0x00e4('0x5'));var auth=require(_0x00e4('0x6'));var interaction=require(_0x00e4('0x7'));var config=require(_0x00e4('0x8'));var controller=require('./pause.controller');router[_0x00e4('0x9')]('/',auth[_0x00e4('0xa')](),controller[_0x00e4('0xb')]);router['get'](_0x00e4('0xc'),auth[_0x00e4('0xa')](),controller[_0x00e4('0xd')]);router[_0x00e4('0xe')]('/',auth[_0x00e4('0xa')](),controller[_0x00e4('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x00e4('0x10')]);router[_0x00e4('0x11')](_0x00e4('0xc'),auth['isAuthenticated'](),controller[_0x00e4('0x12')]);module[_0x00e4('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 320bbb1..6414b05 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 _0xd687=['name','sequelize','STRING'];(function(_0x50781e,_0x1cf063){var _0x90f2f7=function(_0xb360f4){while(--_0xb360f4){_0x50781e['push'](_0x50781e['shift']());}};_0x90f2f7(++_0x1cf063);}(_0xd687,0x115));var _0x7d68=function(_0x2b0b61,_0x170827){_0x2b0b61=_0x2b0b61-0x0;var _0x2ae144=_0xd687[_0x2b0b61];return _0x2ae144;};'use strict';var Sequelize=require(_0x7d68('0x0'));module['exports']={'name':{'type':Sequelize[_0x7d68('0x1')],'unique':_0x7d68('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7d68('0x1')]}}; \ No newline at end of file +var _0xfd57=['name','sequelize','exports','STRING'];(function(_0x37f840,_0x2d45db){var _0x33d6ec=function(_0xafb27b){while(--_0xafb27b){_0x37f840['push'](_0x37f840['shift']());}};_0x33d6ec(++_0x2d45db);}(_0xfd57,0x99));var _0x7fd5=function(_0x4e14e6,_0x3d9227){_0x4e14e6=_0x4e14e6-0x0;var _0x3a40e1=_0xfd57[_0x4e14e6];return _0x3a40e1;};'use strict';var Sequelize=require(_0x7fd5('0x0'));module[_0x7fd5('0x1')]={'name':{'type':Sequelize[_0x7fd5('0x2')],'unique':_0x7fd5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7fd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 8970df0..b78a838 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 _0xc782=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','get','Pauses','UserProfileResource','destroy','error','name','send','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5b3788,_0x189ea5){var _0x206cbc=function(_0x3659ee){while(--_0x3659ee){_0x5b3788['push'](_0x5b3788['shift']());}};_0x206cbc(++_0x189ea5);}(_0xc782,0x97));var _0x2c78=function(_0x4df6ba,_0x477c3e){_0x4df6ba=_0x4df6ba-0x0;var _0x472acf=_0xc782[_0x4df6ba];return _0x472acf;};'use strict';var emlformat=require(_0x2c78('0x0'));var rimraf=require(_0x2c78('0x1'));var zipdir=require(_0x2c78('0x2'));var jsonpatch=require(_0x2c78('0x3'));var rp=require('request-promise');var moment=require(_0x2c78('0x4'));var BPromise=require(_0x2c78('0x5'));var Mustache=require('mustache');var util=require(_0x2c78('0x6'));var path=require(_0x2c78('0x7'));var sox=require(_0x2c78('0x8'));var csv=require(_0x2c78('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c78('0xa'));var _=require(_0x2c78('0xb'));var squel=require(_0x2c78('0xc'));var crypto=require(_0x2c78('0xd'));var jsforce=require(_0x2c78('0xe'));var deskjs=require(_0x2c78('0xf'));var toCsv=require(_0x2c78('0x9'));var querystring=require(_0x2c78('0x10'));var Papa=require('papaparse');var Redis=require(_0x2c78('0x11'));var authService=require(_0x2c78('0x12'));var qs=require(_0x2c78('0x13'));var as=require(_0x2c78('0x14'));var hardwareService=require(_0x2c78('0x15'));var logger=require(_0x2c78('0x16'))('api');var utils=require(_0x2c78('0x17'));var config=require(_0x2c78('0x18'));var licenseUtil=require(_0x2c78('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cb9eb,_0x505ef5){_0x505ef5=_0x505ef5||0xcc;return function(_0x389450){if(_0x389450){return _0x2cb9eb[_0x2c78('0x1a')](_0x505ef5);}return _0x2cb9eb[_0x2c78('0x1b')](_0x505ef5)['end']();};}function respondWithResult(_0x4a9b3e,_0x123c53){_0x123c53=_0x123c53||0xc8;return function(_0x796282){if(_0x796282){return _0x4a9b3e['status'](_0x123c53)[_0x2c78('0x1c')](_0x796282);}};}function respondWithFilteredResult(_0xef4188,_0xfbe018){return function(_0x3c9043){if(_0x3c9043){var _0x525b66=typeof _0xfbe018['offset']===_0x2c78('0x1d')&&typeof _0xfbe018[_0x2c78('0x1e')]===_0x2c78('0x1d');var _0x4653ee=_0x3c9043[_0x2c78('0x1f')];var _0x4cd183=_0x525b66?0x0:_0xfbe018['offset'];var _0x19f219=_0x525b66?_0x3c9043['count']:_0xfbe018[_0x2c78('0x20')]+_0xfbe018[_0x2c78('0x1e')];var _0x1093f9;if(_0x19f219>=_0x4653ee){_0x19f219=_0x4653ee;_0x1093f9=0xc8;}else{_0x1093f9=0xce;}_0xef4188[_0x2c78('0x1b')](_0x1093f9);return _0xef4188[_0x2c78('0x21')]('Content-Range',_0x4cd183+'-'+_0x19f219+'/'+_0x4653ee)[_0x2c78('0x1c')](_0x3c9043);}return null;};}function patchUpdates(_0x92d70a){return function(_0x5d6f5a){try{jsonpatch['apply'](_0x5d6f5a,_0x92d70a,!![]);}catch(_0x17d48a){return BPromise[_0x2c78('0x22')](_0x17d48a);}return _0x5d6f5a[_0x2c78('0x23')]();};}function saveUpdates(_0x21eb4f,_0x2fa4c7){return function(_0x8d86fb){if(_0x8d86fb){return _0x8d86fb[_0x2c78('0x24')](_0x21eb4f)[_0x2c78('0x25')](function(_0x2ed77a){return _0x2ed77a;});}return null;};}function removeEntity(_0x410ba9,_0x218128){return function(_0x1dac15){if(_0x1dac15){return _0x1dac15['destroy']()[_0x2c78('0x25')](function(){var _0x100699=_0x1dac15[_0x2c78('0x26')]({'plain':!![]});var _0x20fb01=_0x2c78('0x27');return db[_0x2c78('0x28')][_0x2c78('0x29')]({'where':{'type':_0x20fb01,'resourceId':_0x100699['id']}})['then'](function(){return _0x1dac15;});})['then'](function(){_0x410ba9[_0x2c78('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x360807,_0x28222c){return function(_0x954de0){if(!_0x954de0){_0x360807[_0x2c78('0x1a')](0x194);}return _0x954de0;};}function handleError(_0x203155,_0x2f27a1){_0x2f27a1=_0x2f27a1||0x1f4;return function(_0x413451){logger[_0x2c78('0x2a')](_0x413451['stack']);if(_0x413451[_0x2c78('0x2b')]){delete _0x413451[_0x2c78('0x2b')];}_0x203155[_0x2c78('0x1b')](_0x2f27a1)[_0x2c78('0x2c')](_0x413451);};}exports['index']=function(_0x3af4dc,_0x4bd182){var _0x451ca7={},_0x395103={},_0x4700f0={'count':0x0,'rows':[]};var _0x3e5c20=_[_0x2c78('0x2d')](db[_0x2c78('0x2e')][_0x2c78('0x2f')],function(_0x1494a9){return{'name':_0x1494a9[_0x2c78('0x30')],'type':_0x1494a9[_0x2c78('0x31')][_0x2c78('0x32')]};});_0x395103['model']=_[_0x2c78('0x2d')](_0x3e5c20,_0x2c78('0x2b'));_0x395103[_0x2c78('0x33')]=_[_0x2c78('0x34')](_0x3af4dc['query']);_0x395103[_0x2c78('0x35')]=_[_0x2c78('0x36')](_0x395103[_0x2c78('0x37')],_0x395103['query']);_0x451ca7[_0x2c78('0x38')]=_['intersection'](_0x395103[_0x2c78('0x37')],qs[_0x2c78('0x39')](_0x3af4dc[_0x2c78('0x33')][_0x2c78('0x39')]));_0x451ca7[_0x2c78('0x38')]=_0x451ca7[_0x2c78('0x38')]['length']?_0x451ca7[_0x2c78('0x38')]:_0x395103[_0x2c78('0x37')];if(!_0x3af4dc['query']['hasOwnProperty'](_0x2c78('0x3a'))){_0x451ca7['limit']=qs[_0x2c78('0x1e')](_0x3af4dc[_0x2c78('0x33')][_0x2c78('0x1e')]);_0x451ca7[_0x2c78('0x20')]=qs[_0x2c78('0x20')](_0x3af4dc[_0x2c78('0x33')][_0x2c78('0x20')]);}_0x451ca7[_0x2c78('0x3b')]=qs[_0x2c78('0x3c')](_0x3af4dc[_0x2c78('0x33')]['sort']);_0x451ca7['where']=qs[_0x2c78('0x35')](_[_0x2c78('0x3d')](_0x3af4dc[_0x2c78('0x33')],_0x395103['filters']),_0x3e5c20);if(_0x3af4dc['query'][_0x2c78('0x3e')]){_0x451ca7[_0x2c78('0x3f')]=_[_0x2c78('0x40')](_0x451ca7[_0x2c78('0x3f')],{'$or':_[_0x2c78('0x2d')](_0x3e5c20,function(_0x3f4c1d){if(_0x3f4c1d[_0x2c78('0x31')]!==_0x2c78('0x41')){var _0x71d44a={};_0x71d44a[_0x3f4c1d[_0x2c78('0x2b')]]={'$like':'%'+_0x3af4dc['query'][_0x2c78('0x3e')]+'%'};return _0x71d44a;}})});}_0x451ca7=_[_0x2c78('0x40')]({},_0x451ca7,_0x3af4dc[_0x2c78('0x42')]);var _0x33e6b3={'where':_0x451ca7['where']};return db['Pause']['count'](_0x33e6b3)[_0x2c78('0x25')](function(_0x68ca1f){_0x4700f0[_0x2c78('0x1f')]=_0x68ca1f;if(_0x3af4dc['query']['includeAll']){_0x451ca7[_0x2c78('0x43')]=[{'all':!![]}];}return db[_0x2c78('0x2e')]['findAll'](_0x451ca7);})[_0x2c78('0x25')](function(_0x56c3e2){_0x4700f0[_0x2c78('0x44')]=_0x56c3e2;return _0x4700f0;})['then'](respondWithFilteredResult(_0x4bd182,_0x451ca7))['catch'](handleError(_0x4bd182,null));};exports[_0x2c78('0x45')]=function(_0x4fc512,_0x2af444){var _0x4f760a={'raw':!![],'where':{'id':_0x4fc512[_0x2c78('0x46')]['id']}},_0x2d308c={};_0x2d308c[_0x2c78('0x37')]=_['keys'](db['Pause'][_0x2c78('0x2f')]);_0x2d308c[_0x2c78('0x33')]=_[_0x2c78('0x34')](_0x4fc512['query']);_0x2d308c['filters']=_[_0x2c78('0x36')](_0x2d308c[_0x2c78('0x37')],_0x2d308c[_0x2c78('0x33')]);_0x4f760a[_0x2c78('0x38')]=_[_0x2c78('0x36')](_0x2d308c['model'],qs[_0x2c78('0x39')](_0x4fc512[_0x2c78('0x33')][_0x2c78('0x39')]));_0x4f760a['attributes']=_0x4f760a[_0x2c78('0x38')][_0x2c78('0x47')]?_0x4f760a[_0x2c78('0x38')]:_0x2d308c[_0x2c78('0x37')];if(_0x4fc512['query'][_0x2c78('0x48')]){_0x4f760a['include']=[{'all':!![]}];}_0x4f760a=_[_0x2c78('0x40')]({},_0x4f760a,_0x4fc512[_0x2c78('0x42')]);return db[_0x2c78('0x2e')]['find'](_0x4f760a)[_0x2c78('0x25')](handleEntityNotFound(_0x2af444,null))[_0x2c78('0x25')](respondWithResult(_0x2af444,null))['catch'](handleError(_0x2af444,null));};exports[_0x2c78('0x49')]=function(_0x1c85b5,_0x16a3f7){return db[_0x2c78('0x2e')][_0x2c78('0x49')](_0x1c85b5[_0x2c78('0x4a')],{})[_0x2c78('0x25')](function(_0x4a2f2d){var _0x4eb878=_0x1c85b5[_0x2c78('0x4b')][_0x2c78('0x26')]({'plain':!![]});if(!_0x4eb878)throw new Error(_0x2c78('0x4c'));if(_0x4eb878[_0x2c78('0x4d')]===_0x2c78('0x4b')){var _0x135545=_0x4a2f2d[_0x2c78('0x26')]({'plain':!![]});var _0x29d43e=_0x2c78('0x27');return db[_0x2c78('0x4e')]['find']({'where':{'name':_0x29d43e,'userProfileId':_0x4eb878[_0x2c78('0x4f')]},'raw':!![]})[_0x2c78('0x25')](function(_0x396883){if(_0x396883&&_0x396883[_0x2c78('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x135545[_0x2c78('0x2b')],'resourceId':_0x135545['id'],'type':_0x396883[_0x2c78('0x2b')],'sectionId':_0x396883['id']},{})[_0x2c78('0x25')](function(){return _0x4a2f2d;});}else{return _0x4a2f2d;}})[_0x2c78('0x51')](function(_0x21205f){logger[_0x2c78('0x2a')](_0x2c78('0x52'),_0x21205f);throw _0x21205f;});}return _0x4a2f2d;})[_0x2c78('0x25')](respondWithResult(_0x16a3f7,0xc9))[_0x2c78('0x51')](handleError(_0x16a3f7,null));};exports[_0x2c78('0x24')]=function(_0x225456,_0x4cbe61){if(_0x225456[_0x2c78('0x4a')]['id']){delete _0x225456[_0x2c78('0x4a')]['id'];}return db[_0x2c78('0x2e')]['find']({'where':{'id':_0x225456['params']['id']}})[_0x2c78('0x25')](handleEntityNotFound(_0x4cbe61,null))[_0x2c78('0x25')](saveUpdates(_0x225456[_0x2c78('0x4a')],null))['then'](respondWithResult(_0x4cbe61,null))[_0x2c78('0x51')](handleError(_0x4cbe61,null));};exports['destroy']=function(_0x5149b2,_0x14aa31){return db['Pause'][_0x2c78('0x53')]({'where':{'id':_0x5149b2[_0x2c78('0x46')]['id']}})[_0x2c78('0x25')](handleEntityNotFound(_0x14aa31,null))[_0x2c78('0x25')](removeEntity(_0x14aa31,null))[_0x2c78('0x51')](handleError(_0x14aa31,null));}; \ No newline at end of file +var _0x16cd=['filter','merge','map','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','find','create','body','user','get','Pauses','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','name','Pause','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick'];(function(_0x16e560,_0x39c713){var _0x16a0ff=function(_0x91d983){while(--_0x91d983){_0x16e560['push'](_0x16e560['shift']());}};_0x16a0ff(++_0x39c713);}(_0x16cd,0xb4));var _0xd16c=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x16cd[_0x16337a];return _0x422365;};'use strict';var emlformat=require(_0xd16c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd16c('0x1'));var jsonpatch=require(_0xd16c('0x2'));var rp=require(_0xd16c('0x3'));var moment=require(_0xd16c('0x4'));var BPromise=require(_0xd16c('0x5'));var Mustache=require(_0xd16c('0x6'));var util=require('util');var path=require(_0xd16c('0x7'));var sox=require(_0xd16c('0x8'));var csv=require('to-csv');var ejs=require(_0xd16c('0x9'));var fs=require('fs');var fs_extra=require(_0xd16c('0xa'));var _=require(_0xd16c('0xb'));var squel=require(_0xd16c('0xc'));var crypto=require(_0xd16c('0xd'));var jsforce=require(_0xd16c('0xe'));var deskjs=require(_0xd16c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd16c('0x10'));var Redis=require(_0xd16c('0x11'));var authService=require(_0xd16c('0x12'));var qs=require(_0xd16c('0x13'));var as=require(_0xd16c('0x14'));var hardwareService=require(_0xd16c('0x15'));var logger=require(_0xd16c('0x16'))(_0xd16c('0x17'));var utils=require('../../config/utils');var config=require(_0xd16c('0x18'));var licenseUtil=require(_0xd16c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c264,_0x10e229){_0x10e229=_0x10e229||0xcc;return function(_0x34f622){if(_0x34f622){return _0x14c264[_0xd16c('0x1a')](_0x10e229);}return _0x14c264[_0xd16c('0x1b')](_0x10e229)[_0xd16c('0x1c')]();};}function respondWithResult(_0x98657a,_0x36b9a8){_0x36b9a8=_0x36b9a8||0xc8;return function(_0x212d9d){if(_0x212d9d){return _0x98657a[_0xd16c('0x1b')](_0x36b9a8)[_0xd16c('0x1d')](_0x212d9d);}};}function respondWithFilteredResult(_0x2c7557,_0x55cd0f){return function(_0xb511a9){if(_0xb511a9){var _0x5b962a=typeof _0x55cd0f['offset']===_0xd16c('0x1e')&&typeof _0x55cd0f['limit']===_0xd16c('0x1e');var _0x28f832=_0xb511a9[_0xd16c('0x1f')];var _0x42bdf1=_0x5b962a?0x0:_0x55cd0f[_0xd16c('0x20')];var _0x2d3dae=_0x5b962a?_0xb511a9[_0xd16c('0x1f')]:_0x55cd0f['offset']+_0x55cd0f[_0xd16c('0x21')];var _0x2b069a;if(_0x2d3dae>=_0x28f832){_0x2d3dae=_0x28f832;_0x2b069a=0xc8;}else{_0x2b069a=0xce;}_0x2c7557[_0xd16c('0x1b')](_0x2b069a);return _0x2c7557[_0xd16c('0x22')]('Content-Range',_0x42bdf1+'-'+_0x2d3dae+'/'+_0x28f832)[_0xd16c('0x1d')](_0xb511a9);}return null;};}function patchUpdates(_0x53e899){return function(_0x125d5b){try{jsonpatch[_0xd16c('0x23')](_0x125d5b,_0x53e899,!![]);}catch(_0x24c591){return BPromise[_0xd16c('0x24')](_0x24c591);}return _0x125d5b[_0xd16c('0x25')]();};}function saveUpdates(_0x35e405,_0x81ad64){return function(_0x3c9ee9){if(_0x3c9ee9){return _0x3c9ee9[_0xd16c('0x26')](_0x35e405)[_0xd16c('0x27')](function(_0x3f0e64){return _0x3f0e64;});}return null;};}function removeEntity(_0x9db984,_0x511ce2){return function(_0x443fbf){if(_0x443fbf){return _0x443fbf[_0xd16c('0x28')]()[_0xd16c('0x27')](function(){var _0x3312f0=_0x443fbf['get']({'plain':!![]});var _0x3882dc='Pauses';return db['UserProfileResource']['destroy']({'where':{'type':_0x3882dc,'resourceId':_0x3312f0['id']}})['then'](function(){return _0x443fbf;});})[_0xd16c('0x27')](function(){_0x9db984[_0xd16c('0x1b')](0xcc)[_0xd16c('0x1c')]();});}};}function handleEntityNotFound(_0x30865a,_0x1075cc){return function(_0x158293){if(!_0x158293){_0x30865a['sendStatus'](0x194);}return _0x158293;};}function handleError(_0x9952df,_0x2cb99f){_0x2cb99f=_0x2cb99f||0x1f4;return function(_0x36bece){logger['error'](_0x36bece['stack']);if(_0x36bece[_0xd16c('0x29')]){delete _0x36bece[_0xd16c('0x29')];}_0x9952df[_0xd16c('0x1b')](_0x2cb99f)['send'](_0x36bece);};}exports['index']=function(_0x2fdfdc,_0x4876b4){var _0x4c52b0={},_0x3b0e77={},_0x550e1f={'count':0x0,'rows':[]};var _0xd6101b=_['map'](db[_0xd16c('0x2a')]['rawAttributes'],function(_0x3aa84b){return{'name':_0x3aa84b[_0xd16c('0x2b')],'type':_0x3aa84b[_0xd16c('0x2c')][_0xd16c('0x2d')]};});_0x3b0e77['model']=_['map'](_0xd6101b,_0xd16c('0x29'));_0x3b0e77['query']=_['keys'](_0x2fdfdc[_0xd16c('0x2e')]);_0x3b0e77[_0xd16c('0x2f')]=_[_0xd16c('0x30')](_0x3b0e77[_0xd16c('0x31')],_0x3b0e77[_0xd16c('0x2e')]);_0x4c52b0['attributes']=_[_0xd16c('0x30')](_0x3b0e77['model'],qs[_0xd16c('0x32')](_0x2fdfdc['query'][_0xd16c('0x32')]));_0x4c52b0[_0xd16c('0x33')]=_0x4c52b0['attributes'][_0xd16c('0x34')]?_0x4c52b0['attributes']:_0x3b0e77[_0xd16c('0x31')];if(!_0x2fdfdc[_0xd16c('0x2e')][_0xd16c('0x35')]('nolimit')){_0x4c52b0[_0xd16c('0x21')]=qs['limit'](_0x2fdfdc[_0xd16c('0x2e')]['limit']);_0x4c52b0['offset']=qs['offset'](_0x2fdfdc['query'][_0xd16c('0x20')]);}_0x4c52b0[_0xd16c('0x36')]=qs['sort'](_0x2fdfdc[_0xd16c('0x2e')]['sort']);_0x4c52b0[_0xd16c('0x37')]=qs['filters'](_[_0xd16c('0x38')](_0x2fdfdc[_0xd16c('0x2e')],_0x3b0e77[_0xd16c('0x2f')]),_0xd6101b);if(_0x2fdfdc[_0xd16c('0x2e')][_0xd16c('0x39')]){_0x4c52b0[_0xd16c('0x37')]=_[_0xd16c('0x3a')](_0x4c52b0[_0xd16c('0x37')],{'$or':_[_0xd16c('0x3b')](_0xd6101b,function(_0x3eb580){if(_0x3eb580[_0xd16c('0x2c')]!==_0xd16c('0x3c')){var _0x19c68b={};_0x19c68b[_0x3eb580[_0xd16c('0x29')]]={'$like':'%'+_0x2fdfdc[_0xd16c('0x2e')][_0xd16c('0x39')]+'%'};return _0x19c68b;}})});}_0x4c52b0=_['merge']({},_0x4c52b0,_0x2fdfdc[_0xd16c('0x3d')]);var _0x1821a7={'where':_0x4c52b0[_0xd16c('0x37')]};return db[_0xd16c('0x2a')][_0xd16c('0x1f')](_0x1821a7)['then'](function(_0x32481b){_0x550e1f[_0xd16c('0x1f')]=_0x32481b;if(_0x2fdfdc[_0xd16c('0x2e')][_0xd16c('0x3e')]){_0x4c52b0['include']=[{'all':!![]}];}return db[_0xd16c('0x2a')]['findAll'](_0x4c52b0);})[_0xd16c('0x27')](function(_0x47a947){_0x550e1f[_0xd16c('0x3f')]=_0x47a947;return _0x550e1f;})[_0xd16c('0x27')](respondWithFilteredResult(_0x4876b4,_0x4c52b0))[_0xd16c('0x40')](handleError(_0x4876b4,null));};exports[_0xd16c('0x41')]=function(_0xc94379,_0x31066a){var _0x3f46e7={'raw':!![],'where':{'id':_0xc94379['params']['id']}},_0x2cb3e3={};_0x2cb3e3[_0xd16c('0x31')]=_['keys'](db[_0xd16c('0x2a')][_0xd16c('0x42')]);_0x2cb3e3[_0xd16c('0x2e')]=_['keys'](_0xc94379['query']);_0x2cb3e3['filters']=_[_0xd16c('0x30')](_0x2cb3e3[_0xd16c('0x31')],_0x2cb3e3[_0xd16c('0x2e')]);_0x3f46e7[_0xd16c('0x33')]=_[_0xd16c('0x30')](_0x2cb3e3[_0xd16c('0x31')],qs['fields'](_0xc94379[_0xd16c('0x2e')][_0xd16c('0x32')]));_0x3f46e7[_0xd16c('0x33')]=_0x3f46e7['attributes']['length']?_0x3f46e7['attributes']:_0x2cb3e3['model'];if(_0xc94379[_0xd16c('0x2e')][_0xd16c('0x3e')]){_0x3f46e7['include']=[{'all':!![]}];}_0x3f46e7=_[_0xd16c('0x3a')]({},_0x3f46e7,_0xc94379[_0xd16c('0x3d')]);return db[_0xd16c('0x2a')][_0xd16c('0x43')](_0x3f46e7)['then'](handleEntityNotFound(_0x31066a,null))[_0xd16c('0x27')](respondWithResult(_0x31066a,null))[_0xd16c('0x40')](handleError(_0x31066a,null));};exports[_0xd16c('0x44')]=function(_0x10afa8,_0x1c6e2a){return db[_0xd16c('0x2a')][_0xd16c('0x44')](_0x10afa8[_0xd16c('0x45')],{})[_0xd16c('0x27')](function(_0x429fa1){var _0xb013cd=_0x10afa8[_0xd16c('0x46')][_0xd16c('0x47')]({'plain':!![]});if(!_0xb013cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb013cd['role']===_0xd16c('0x46')){var _0x2ddf13=_0x429fa1[_0xd16c('0x47')]({'plain':!![]});var _0x5b4d8b=_0xd16c('0x48');return db[_0xd16c('0x49')]['find']({'where':{'name':_0x5b4d8b,'userProfileId':_0xb013cd['userProfileId']},'raw':!![]})[_0xd16c('0x27')](function(_0x2c9f86){if(_0x2c9f86&&_0x2c9f86[_0xd16c('0x4a')]===0x0){return db[_0xd16c('0x4b')]['create']({'name':_0x2ddf13[_0xd16c('0x29')],'resourceId':_0x2ddf13['id'],'type':_0x2c9f86[_0xd16c('0x29')],'sectionId':_0x2c9f86['id']},{})[_0xd16c('0x27')](function(){return _0x429fa1;});}else{return _0x429fa1;}})[_0xd16c('0x40')](function(_0x30344e){logger[_0xd16c('0x4c')](_0xd16c('0x4d'),_0x30344e);throw _0x30344e;});}return _0x429fa1;})[_0xd16c('0x27')](respondWithResult(_0x1c6e2a,0xc9))['catch'](handleError(_0x1c6e2a,null));};exports[_0xd16c('0x26')]=function(_0x315fe2,_0x2dd933){if(_0x315fe2[_0xd16c('0x45')]['id']){delete _0x315fe2[_0xd16c('0x45')]['id'];}return db[_0xd16c('0x2a')][_0xd16c('0x43')]({'where':{'id':_0x315fe2[_0xd16c('0x4e')]['id']}})[_0xd16c('0x27')](handleEntityNotFound(_0x2dd933,null))[_0xd16c('0x27')](saveUpdates(_0x315fe2['body'],null))[_0xd16c('0x27')](respondWithResult(_0x2dd933,null))[_0xd16c('0x40')](handleError(_0x2dd933,null));};exports[_0xd16c('0x28')]=function(_0x468e55,_0x49ec37){return db[_0xd16c('0x2a')][_0xd16c('0x43')]({'where':{'id':_0x468e55[_0xd16c('0x4e')]['id']}})[_0xd16c('0x27')](handleEntityNotFound(_0x49ec37,null))['then'](removeEntity(_0x49ec37,null))[_0xd16c('0x40')](handleError(_0x49ec37,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6002161..026141f 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0x7fbe[_0x2cdcf9];return _0x39412d;};'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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1da6be,_0x5d4e33){_0x1da6be=_0x1da6be-0x0;var _0x1264cf=_0x7fbe[_0x1da6be];return _0x1264cf;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c1dbf4e..bfd3bd9 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 _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(_0x1b975f,_0x5afbf8){var _0x336455=function(_0xeae9e4){while(--_0xeae9e4){_0x1b975f['push'](_0x1b975f['shift']());}};_0x336455(++_0x5afbf8);}(_0x7a54,0x106));var _0x47a5=function(_0x6b536,_0x2dc440){_0x6b536=_0x6b536-0x0;var _0x36b3e4=_0x7a54[_0x6b536];return _0x36b3e4;};'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 +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(_0x110541,_0x31755d){var _0x17de80=function(_0x5e0694){while(--_0x5e0694){_0x110541['push'](_0x110541['shift']());}};_0x17de80(++_0x31755d);}(_0x7a54,0x106));var _0x47a5=function(_0x3c43b8,_0x5e681c){_0x3c43b8=_0x3c43b8-0x0;var _0x56ffc8=_0x7a54[_0x3c43b8];return _0x56ffc8;};'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 315799a..53e69a4 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 _0xc368=['show','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc368,0x7b));var _0x8c36=function(_0x122243,_0x55e807){_0x122243=_0x122243-0x0;var _0xea5050=_0xc368[_0x122243];return _0xea5050;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x8c36('0xe')]);var upload=multer({'storage':multer[_0x8c36('0xf')]({'destination':function(_0x5132f6,_0x36cb13,_0x1c49a0){_0x1c49a0(null,path[_0x8c36('0x10')](config[_0x8c36('0x11')],_0x8c36('0x12')));},'filename':function(_0x451c24,_0xa09884,_0x23eb71){_0xa09884[_0x8c36('0x13')]=_0xa09884[_0x8c36('0x13')][_0x8c36('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23eb71(null,util[_0x8c36('0x15')](_0x8c36('0x16'),path[_0x8c36('0x17')](_0xa09884['originalname'],path[_0x8c36('0x18')](_0xa09884['originalname'])),Date[_0x8c36('0x19')](),path[_0x8c36('0x18')](_0xa09884[_0x8c36('0x13')])));}})});router[_0x8c36('0x1a')]('/',upload[_0x8c36('0x1b')](_0x8c36('0x1c')),controller[_0x8c36('0x1d')]);router[_0x8c36('0x1a')](_0x8c36('0xa'),controller['webhookPost']);router[_0x8c36('0x1e')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x1f')]);router[_0x8c36('0x20')]('/:id',auth[_0x8c36('0x9')](),controller[_0x8c36('0x20')]);module[_0x8c36('0x21')]=router; \ No newline at end of file +var _0x70e0=['delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','webhookGet','get','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','extname','post','single','file','/webhook','webhookPost','put'];(function(_0x403435,_0xcb4543){var _0x212dc8=function(_0x46bc0c){while(--_0x46bc0c){_0x403435['push'](_0x403435['shift']());}};_0x212dc8(++_0xcb4543);}(_0x70e0,0x17b));var _0x070e=function(_0x2069e3,_0x128200){_0x2069e3=_0x2069e3-0x0;var _0x263438=_0x70e0[_0x2069e3];return _0x263438;};'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']('/webhook',controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xa')](_0x070e('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x070e('0xe')]({'destination':function(_0x2e3e5e,_0x12bb37,_0xb8d819){_0xb8d819(null,path[_0x070e('0xf')](config[_0x070e('0x10')],_0x070e('0x11')));},'filename':function(_0x1baa12,_0x39d2b9,_0x5bf079){_0x39d2b9[_0x070e('0x12')]=_0x39d2b9['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5bf079(null,util[_0x070e('0x13')]('%s-%s%s',path['basename'](_0x39d2b9['originalname'],path[_0x070e('0x14')](_0x39d2b9[_0x070e('0x12')])),Date['now'](),path['extname'](_0x39d2b9[_0x070e('0x12')])));}})});router[_0x070e('0x15')]('/',upload[_0x070e('0x16')](_0x070e('0x17')),controller['upload']);router['post'](_0x070e('0x18'),controller[_0x070e('0x19')]);router[_0x070e('0x1a')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller['update']);router[_0x070e('0x1b')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x1b')]);module[_0x070e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 26d39dd..6e585a4 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 _0x27c8=['script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM'];(function(_0x50975f,_0x15dfe7){var _0x3dedca=function(_0x5ba277){while(--_0x5ba277){_0x50975f['push'](_0x50975f['shift']());}};_0x3dedca(++_0x15dfe7);}(_0x27c8,0x190));var _0x827c=function(_0x10fdc3,_0x55ce9e){_0x10fdc3=_0x10fdc3-0x0;var _0x2ede3e=_0x27c8[_0x10fdc3];return _0x2ede3e;};'use strict';var Sequelize=require(_0x827c('0x0'));module[_0x827c('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x827c('0x2')]('html',_0x827c('0x3'))},'description':{'type':Sequelize[_0x827c('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x827c('0x5')},'active':{'type':Sequelize[_0x827c('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x827c('0x2')](_0x827c('0x7'),_0x827c('0x8'),_0x827c('0x9'),_0x827c('0xa')),'defaultValue':_0x827c('0x9'),'comment':_0x827c('0xb')},'icon':{'type':Sequelize[_0x827c('0xc')]},'adminUrl':{'type':Sequelize[_0x827c('0xc')]},'agentUrl':{'type':Sequelize[_0x827c('0xc')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x827c('0xc')]}}; \ No newline at end of file +var _0xf8a2=['STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','sequelize','exports','ENUM','html','script','TEXT'];(function(_0x375120,_0x3562af){var _0x1c426e=function(_0x26e109){while(--_0x26e109){_0x375120['push'](_0x375120['shift']());}};_0x1c426e(++_0x3562af);}(_0xf8a2,0xe8));var _0x2f8a=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0xf8a2[_0x53c4f8];return _0x416458;};'use strict';var Sequelize=require(_0x2f8a('0x0'));module[_0x2f8a('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2f8a('0x2')](_0x2f8a('0x3'),_0x2f8a('0x4'))},'description':{'type':Sequelize[_0x2f8a('0x5')]},'version':{'type':Sequelize[_0x2f8a('0x5')]},'path':{'type':Sequelize[_0x2f8a('0x6')],'comment':_0x2f8a('0x7')},'active':{'type':Sequelize[_0x2f8a('0x8')],'defaultValue':0x0,'comment':_0x2f8a('0x9')},'sidebar':{'type':Sequelize[_0x2f8a('0x2')](_0x2f8a('0xa'),_0x2f8a('0xb'),'always',_0x2f8a('0xc')),'defaultValue':_0x2f8a('0xd'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x2f8a('0x6')]},'adminUrl':{'type':Sequelize[_0x2f8a('0x6')]},'agentUrl':{'type':Sequelize[_0x2f8a('0x6')]},'scriptName':{'type':Sequelize[_0x2f8a('0x6')]},'scriptPath':{'type':Sequelize[_0x2f8a('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 41259d2..c58a577 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 _0xb5a0=['show','params','find','catch','path','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','**/*','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','delete','dirname','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','get','Plugins','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','Plugin','includeAll','include','findAll','rows'];(function(_0x86ba06,_0x2e50d9){var _0xafb44a=function(_0x1dd5cd){while(--_0x1dd5cd){_0x86ba06['push'](_0x86ba06['shift']());}};_0xafb44a(++_0x2e50d9);}(_0xb5a0,0x108));var _0x0b5a=function(_0x57db3a,_0x32dc3f){_0x57db3a=_0x57db3a-0x0;var _0x18dc71=_0xb5a0[_0x57db3a];return _0x18dc71;};'use strict';var emlformat=require(_0x0b5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b5a('0x1'));var jsonpatch=require(_0x0b5a('0x2'));var rp=require(_0x0b5a('0x3'));var moment=require(_0x0b5a('0x4'));var BPromise=require(_0x0b5a('0x5'));var Mustache=require(_0x0b5a('0x6'));var util=require(_0x0b5a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0b5a('0x8'));var ejs=require(_0x0b5a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0b5a('0xa'));var crypto=require('crypto');var jsforce=require(_0x0b5a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0b5a('0x8'));var querystring=require(_0x0b5a('0xc'));var Papa=require(_0x0b5a('0xd'));var extract=require(_0x0b5a('0xe'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x0b5a('0xf'));var authService=require(_0x0b5a('0x10'));var qs=require(_0x0b5a('0x11'));var as=require(_0x0b5a('0x12'));var hardwareService=require(_0x0b5a('0x13'));var logger=require(_0x0b5a('0x14'))(_0x0b5a('0x15'));var utils=require(_0x0b5a('0x16'));var config=require(_0x0b5a('0x17'));var licenseUtil=require(_0x0b5a('0x18'));var db=require('../../mysqldb')['db'];config[_0x0b5a('0x19')]=_['defaults'](config[_0x0b5a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b5a('0x1a'))(new Redis(config[_0x0b5a('0x19')]));require(_0x0b5a('0x1b'))[_0x0b5a('0x1c')](socket);function respondWithStatusCode(_0x1282d7,_0x563208){_0x563208=_0x563208||0xcc;return function(_0x509bd4){if(_0x509bd4){return _0x1282d7[_0x0b5a('0x1d')](_0x563208);}return _0x1282d7[_0x0b5a('0x1e')](_0x563208)['end']();};}function respondWithResult(_0x12b540,_0x143981){_0x143981=_0x143981||0xc8;return function(_0x1ca8ff){if(_0x1ca8ff){return _0x12b540[_0x0b5a('0x1e')](_0x143981)[_0x0b5a('0x1f')](_0x1ca8ff);}};}function respondWithFilteredResult(_0x4c5a9a,_0x13e19c){return function(_0x1e10e2){if(_0x1e10e2){var _0x4cb016=typeof _0x13e19c[_0x0b5a('0x20')]==='undefined'&&typeof _0x13e19c['limit']===_0x0b5a('0x21');var _0x231bb6=_0x1e10e2[_0x0b5a('0x22')];var _0x5dc539=_0x4cb016?0x0:_0x13e19c[_0x0b5a('0x20')];var _0x5860f0=_0x4cb016?_0x1e10e2[_0x0b5a('0x22')]:_0x13e19c['offset']+_0x13e19c[_0x0b5a('0x23')];var _0x4eb154;if(_0x5860f0>=_0x231bb6){_0x5860f0=_0x231bb6;_0x4eb154=0xc8;}else{_0x4eb154=0xce;}_0x4c5a9a[_0x0b5a('0x1e')](_0x4eb154);return _0x4c5a9a[_0x0b5a('0x24')](_0x0b5a('0x25'),_0x5dc539+'-'+_0x5860f0+'/'+_0x231bb6)[_0x0b5a('0x1f')](_0x1e10e2);}return null;};}function patchUpdates(_0x3ee8ae){return function(_0x50a365){try{jsonpatch[_0x0b5a('0x26')](_0x50a365,_0x3ee8ae,!![]);}catch(_0x133a8e){return BPromise[_0x0b5a('0x27')](_0x133a8e);}return _0x50a365[_0x0b5a('0x28')]();};}function saveUpdates(_0x21c5d8,_0x5b37c9){return function(_0x5397a2){if(_0x5397a2){return _0x5397a2['update'](_0x21c5d8)['then'](function(_0x1a61bc){return _0x1a61bc;});}return null;};}function removeEntity(_0x402422,_0x524280){return function(_0x5bdad6){if(_0x5bdad6){return _0x5bdad6[_0x0b5a('0x29')]()[_0x0b5a('0x2a')](function(){var _0x1d408b=_0x5bdad6[_0x0b5a('0x2b')]({'plain':!![]});var _0xffe2a9=_0x0b5a('0x2c');return db[_0x0b5a('0x2d')][_0x0b5a('0x29')]({'where':{'type':_0xffe2a9,'resourceId':_0x1d408b['id']}})['then'](function(){return _0x5bdad6;});})[_0x0b5a('0x2a')](function(){_0x402422[_0x0b5a('0x1e')](0xcc)[_0x0b5a('0x2e')]();});}};}function handleEntityNotFound(_0x23bf3b,_0xc1304b){return function(_0x2497eb){if(!_0x2497eb){_0x23bf3b['sendStatus'](0x194);}return _0x2497eb;};}function handleError(_0x2b938a,_0x4456ac){_0x4456ac=_0x4456ac||0x1f4;return function(_0x162f65){logger[_0x0b5a('0x2f')](_0x162f65[_0x0b5a('0x30')]);if(_0x162f65['name']){delete _0x162f65[_0x0b5a('0x31')];}_0x2b938a[_0x0b5a('0x1e')](_0x4456ac)[_0x0b5a('0x32')](_0x162f65);};}exports[_0x0b5a('0x33')]=function(_0x567d28,_0x14d81f){var _0x445486={},_0x5089c0={},_0xb33a9={'count':0x0,'rows':[]};var _0x5dc53c=_[_0x0b5a('0x34')](db['Plugin'][_0x0b5a('0x35')],function(_0x4f68b6){return{'name':_0x4f68b6[_0x0b5a('0x36')],'type':_0x4f68b6[_0x0b5a('0x37')][_0x0b5a('0x38')]};});_0x5089c0[_0x0b5a('0x39')]=_[_0x0b5a('0x34')](_0x5dc53c,'name');_0x5089c0['query']=_[_0x0b5a('0x3a')](_0x567d28[_0x0b5a('0x3b')]);_0x5089c0[_0x0b5a('0x3c')]=_['intersection'](_0x5089c0[_0x0b5a('0x39')],_0x5089c0[_0x0b5a('0x3b')]);_0x445486[_0x0b5a('0x3d')]=_[_0x0b5a('0x3e')](_0x5089c0[_0x0b5a('0x39')],qs[_0x0b5a('0x3f')](_0x567d28[_0x0b5a('0x3b')][_0x0b5a('0x3f')]));_0x445486[_0x0b5a('0x3d')]=_0x445486[_0x0b5a('0x3d')][_0x0b5a('0x40')]?_0x445486['attributes']:_0x5089c0[_0x0b5a('0x39')];if(!_0x567d28[_0x0b5a('0x3b')][_0x0b5a('0x41')]('nolimit')){_0x445486[_0x0b5a('0x23')]=qs[_0x0b5a('0x23')](_0x567d28[_0x0b5a('0x3b')][_0x0b5a('0x23')]);_0x445486[_0x0b5a('0x20')]=qs['offset'](_0x567d28['query'][_0x0b5a('0x20')]);}_0x445486['order']=qs[_0x0b5a('0x42')](_0x567d28[_0x0b5a('0x3b')][_0x0b5a('0x42')]);_0x445486[_0x0b5a('0x43')]=qs[_0x0b5a('0x3c')](_[_0x0b5a('0x44')](_0x567d28['query'],_0x5089c0[_0x0b5a('0x3c')]),_0x5dc53c);if(_0x567d28['query']['filter']){_0x445486[_0x0b5a('0x43')]=_[_0x0b5a('0x45')](_0x445486['where'],{'$or':_[_0x0b5a('0x34')](_0x5dc53c,function(_0x3d5ac4){if(_0x3d5ac4[_0x0b5a('0x37')]!==_0x0b5a('0x46')){var _0x513cbe={};_0x513cbe[_0x3d5ac4[_0x0b5a('0x31')]]={'$like':'%'+_0x567d28[_0x0b5a('0x3b')][_0x0b5a('0x47')]+'%'};return _0x513cbe;}})});}_0x445486=_[_0x0b5a('0x45')]({},_0x445486,_0x567d28[_0x0b5a('0x48')]);var _0xccb631={'where':_0x445486[_0x0b5a('0x43')]};return db[_0x0b5a('0x49')][_0x0b5a('0x22')](_0xccb631)[_0x0b5a('0x2a')](function(_0xf7692c){_0xb33a9['count']=_0xf7692c;if(_0x567d28['query'][_0x0b5a('0x4a')]){_0x445486[_0x0b5a('0x4b')]=[{'all':!![]}];}return db[_0x0b5a('0x49')][_0x0b5a('0x4c')](_0x445486);})[_0x0b5a('0x2a')](function(_0x42be2f){_0xb33a9[_0x0b5a('0x4d')]=_0x42be2f;return _0xb33a9;})['then'](respondWithFilteredResult(_0x14d81f,_0x445486))['catch'](handleError(_0x14d81f,null));};exports[_0x0b5a('0x4e')]=function(_0xd1e381,_0x509e95){var _0x3a2dfb={'raw':!![],'where':{'id':_0xd1e381[_0x0b5a('0x4f')]['id']}},_0x3d583a={};_0x3d583a[_0x0b5a('0x39')]=_['keys'](db[_0x0b5a('0x49')][_0x0b5a('0x35')]);_0x3d583a[_0x0b5a('0x3b')]=_[_0x0b5a('0x3a')](_0xd1e381[_0x0b5a('0x3b')]);_0x3d583a[_0x0b5a('0x3c')]=_['intersection'](_0x3d583a[_0x0b5a('0x39')],_0x3d583a[_0x0b5a('0x3b')]);_0x3a2dfb[_0x0b5a('0x3d')]=_[_0x0b5a('0x3e')](_0x3d583a['model'],qs[_0x0b5a('0x3f')](_0xd1e381['query'][_0x0b5a('0x3f')]));_0x3a2dfb[_0x0b5a('0x3d')]=_0x3a2dfb[_0x0b5a('0x3d')][_0x0b5a('0x40')]?_0x3a2dfb['attributes']:_0x3d583a[_0x0b5a('0x39')];if(_0xd1e381[_0x0b5a('0x3b')][_0x0b5a('0x4a')]){_0x3a2dfb['include']=[{'all':!![]}];}_0x3a2dfb=_[_0x0b5a('0x45')]({},_0x3a2dfb,_0xd1e381[_0x0b5a('0x48')]);return db[_0x0b5a('0x49')][_0x0b5a('0x50')](_0x3a2dfb)['then'](handleEntityNotFound(_0x509e95,null))[_0x0b5a('0x2a')](respondWithResult(_0x509e95,null))[_0x0b5a('0x51')](handleError(_0x509e95,null));};exports['download']=function(_0x1426eb,_0x405544,_0xbd4bfd){return db[_0x0b5a('0x49')][_0x0b5a('0x50')]({'where':{'id':_0x1426eb[_0x0b5a('0x4f')]['id']},'attributes':['name',_0x0b5a('0x52')],'raw':!![]})[_0x0b5a('0x2a')](handleEntityNotFound(_0x405544,null))[_0x0b5a('0x2a')](function(_0x31491f){if(_0x31491f){var _0x5b95a8=path['join'](config[_0x0b5a('0x53')],_0x0b5a('0x54'),util['format'](_0x0b5a('0x55'),path[_0x0b5a('0x56')](_0x31491f[_0x0b5a('0x52')])));var _0x39f199=fs[_0x0b5a('0x57')](_0x5b95a8);var _0x2b3c31=archiver(_0x0b5a('0x58'),{'zlib':{'level':0x9}});_0x2b3c31['on'](_0x0b5a('0x59'),function(_0x231b84){if(_0x231b84[_0x0b5a('0x5a')]===_0x0b5a('0x5b')){logger[_0x0b5a('0x2f')](_0x231b84);}else{throw new db['Sequelize'][(_0x0b5a('0x5c'))](_0x0b5a('0x5d'));}});_0x2b3c31['on']('error',function(_0x161064){throw new db[(_0x0b5a('0x5e'))]['Error'](_0x0b5a('0x5d'));});_0x2b3c31[_0x0b5a('0x5f')](_0x39f199);_0x2b3c31['glob'](_0x0b5a('0x60'),{'cwd':path[_0x0b5a('0x61')](config[_0x0b5a('0x53')],_0x0b5a('0x54'),path['dirname'](_0x31491f[_0x0b5a('0x52')])),'ignore':[path[_0x0b5a('0x61')](path[_0x0b5a('0x56')](_0x31491f[_0x0b5a('0x52')]),_0x0b5a('0x62')),path['join'](path[_0x0b5a('0x56')](_0x31491f[_0x0b5a('0x52')]),_0x0b5a('0x63'))],'nodir':!![]})[_0x0b5a('0x64')]();_0x39f199['on'](_0x0b5a('0x65'),function(){if(!fs[_0x0b5a('0x66')](_0x5b95a8)){throw new db[(_0x0b5a('0x5e'))][(_0x0b5a('0x5c'))](_0x0b5a('0x67'));}return _0x405544['download'](_0x5b95a8,util['format'](_0x0b5a('0x55'),path['basename'](_0x31491f['path'])),function(_0x566569){if(_0x566569){throw new db[(_0x0b5a('0x5e'))][(_0x0b5a('0x5c'))](_0x0b5a('0x68'));}fs[_0x0b5a('0x69')](_0x5b95a8);logger[_0x0b5a('0x6a')]('Download\x20completed');logger[_0x0b5a('0x6a')](_0x0b5a('0x6b'));});});}return null;})[_0x0b5a('0x51')](handleError(_0x405544,null));};exports['upload']=function(_0x4459aa,_0x53f67e,_0x4d68ed){var _0x3ae84b=path[_0x0b5a('0x56')](_0x4459aa[_0x0b5a('0x6c')][_0x0b5a('0x6d')],path[_0x0b5a('0x6e')](_0x4459aa[_0x0b5a('0x6c')][_0x0b5a('0x6d')]));var _0x62a16e=path[_0x0b5a('0x61')](config[_0x0b5a('0x53')],'server/files/plugins',_0x4459aa[_0x0b5a('0x6c')][_0x0b5a('0x6d')]);var _0x5c42e7=path['join'](config[_0x0b5a('0x53')],_0x0b5a('0x54'),_0x3ae84b);logger[_0x0b5a('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x62a16e);logger['info'](_0x0b5a('0x6f'),_0x5c42e7);try{fs[_0x0b5a('0x70')](_0x62a16e,parseInt(_0x0b5a('0x71'),0x8));extract(_0x62a16e,{'dir':_0x5c42e7},function(_0xe0ff2a){if(_0xe0ff2a){logger[_0x0b5a('0x2f')](_0xe0ff2a);handleError(_0xe0ff2a,!![]);};var _0xfe4936=fs[_0x0b5a('0x72')](_0x5c42e7);if(_0xfe4936['length']>0x1){removeReferences(_0x62a16e,_0x5c42e7);logger['error']('Invalid\x20plugin\x20structure');return _0x4d68ed(new Error(_0x0b5a('0x73')));}var _0x549403=fs[_0x0b5a('0x74')](path[_0x0b5a('0x61')](_0x5c42e7,_0xfe4936[0x0]));if(_0x549403[_0x0b5a('0x75')]()){removeReferences(_0x62a16e,_0x5c42e7);logger[_0x0b5a('0x2f')](_0x0b5a('0x73'));return _0x4d68ed(new Error(_0x0b5a('0x73')));}if(_0x549403[_0x0b5a('0x76')]()){var _0x53ca5e=fs[_0x0b5a('0x72')](path['join'](_0x5c42e7,_0xfe4936[0x0]));if(_0x53ca5e[_0x0b5a('0x40')]===0x0){removeReferences(_0x62a16e,_0x5c42e7);logger[_0x0b5a('0x2f')](_0x0b5a('0x73'));return _0x4d68ed(new Error(_0x0b5a('0x73')));}var _0x5a7006=_0x53ca5e['some'](function(_0x4c6500){return _0x4c6500===_0x0b5a('0x77');});if(!_0x5a7006){return _0x4d68ed(new Error(_0x0b5a('0x78')));}var _0x5079a1=fs[_0x0b5a('0x79')](path[_0x0b5a('0x61')](_0x5c42e7,_0xfe4936[0x0],_0x0b5a('0x77')));var _0x3d454d=JSON[_0x0b5a('0x7a')](_0x5079a1);if(_0x0b5a('0x21')==typeof _0x3d454d[_0x0b5a('0x31')]){return _0x4d68ed(new Error(_0x0b5a('0x7b')));}if(_0x0b5a('0x21')==typeof _0x3d454d[_0x0b5a('0x37')]){return _0x4d68ed(new Error(_0x0b5a('0x7c')));}if(_0x0b5a('0x21')==typeof _0x3d454d['version']){return _0x4d68ed(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x3d454d[_0x0b5a('0x7d')]){return _0x4d68ed(new Error(_0x0b5a('0x7e')));}if(_0x3d454d[_0x0b5a('0x37')]===_0x0b5a('0x7f')){if(_0x0b5a('0x21')==typeof _0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x80')]){return _0x4d68ed(new Error(_0x0b5a('0x81')));}if(_0x0b5a('0x21')==typeof _0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x80')][_0x0b5a('0x82')]&&'undefined'==typeof _0x3d454d['parameters'][_0x0b5a('0x80')][_0x0b5a('0x83')]){return _0x4d68ed(new Error(_0x0b5a('0x84')));}}else if(_0x3d454d[_0x0b5a('0x37')]==='script'){if(_0x0b5a('0x21')==typeof _0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x85')]){return _0x4d68ed(new Error(_0x0b5a('0x86')));}if(_0x0b5a('0x21')==typeof _0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x87')]){return _0x4d68ed(new Error(_0x0b5a('0x88')));}}else{return _0x4d68ed(new Error(_0x0b5a('0x89')));}var _0x137181=_0x3d454d[_0x0b5a('0x31')];var _0x1f03f9=_0x3d454d['description'];var _0x4a9f92=_0x3d454d['type'];var _0x3546ee=_0x3d454d[_0x0b5a('0x8a')]?_0x3d454d[_0x0b5a('0x8a')]:_0x0b5a('0x8b');var _0x289e83=_0x3d454d['icon']?_0x3d454d[_0x0b5a('0x8c')]:_0x0b5a('0x8d');var _0xf5f9ce='';var _0x356d3d='';var _0x540d91='';var _0x3ddab6='';var _0xc58ab7=_0x3d454d['version'];if(_0x4a9f92===_0x0b5a('0x7f')){if(_0x0b5a('0x21')!=typeof _0x3d454d['parameters']['views']['admin']){var _0x5af9c3=_0x3d454d['parameters'][_0x0b5a('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0b5a('0x8e')](_0x5af9c3)){_0xf5f9ce=path[_0x0b5a('0x61')](_0x0b5a('0x8f'),_0x3ae84b,_0xfe4936[0x0],_0x5af9c3);}else{_0xf5f9ce=_0x5af9c3;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x0b5a('0x21')!=typeof _0x3d454d['parameters']['views'][_0x0b5a('0x83')]){var _0x3626c6=_0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0b5a('0x8e')](_0x3626c6)){_0x356d3d=path[_0x0b5a('0x61')](_0x0b5a('0x8f'),_0x3ae84b,_0xfe4936[0x0],_0x3626c6);}else{_0x356d3d=_0x3626c6;}}else{logger[_0x0b5a('0x6a')](_0x0b5a('0x90'));}}else if(_0x4a9f92===_0x0b5a('0x91')){_0x540d91=_0x3d454d[_0x0b5a('0x7d')]['scriptName'];_0x3ddab6=_0x3d454d['parameters']['scriptPath'];if(_0x0b5a('0x21')!=typeof _0x3d454d[_0x0b5a('0x7d')]['views']){if(_0x0b5a('0x21')!=typeof _0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x80')][_0x0b5a('0x82')]){var _0x5af9c3=_0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x80')][_0x0b5a('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x0b5a('0x8e')](_0x5af9c3)){_0xf5f9ce=path[_0x0b5a('0x61')](_0x0b5a('0x8f'),_0x3ae84b,_0xfe4936[0x0],_0x5af9c3);}else{_0xf5f9ce=_0x5af9c3;}}if(_0x0b5a('0x21')!=typeof _0x3d454d[_0x0b5a('0x7d')][_0x0b5a('0x80')]['agent']){var _0x3626c6=_0x3d454d[_0x0b5a('0x7d')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0b5a('0x8e')](_0x3626c6)){_0x356d3d=path[_0x0b5a('0x61')](_0x0b5a('0x8f'),_0x3ae84b,_0xfe4936[0x0],_0x3626c6);}else{_0x356d3d=_0x3626c6;}}}}var _0x536503={'name':_0x137181,'description':_0x1f03f9,'path':path[_0x0b5a('0x61')](_0x3ae84b,_0xfe4936[0x0]),'type':_0x4a9f92,'sidebar':_0x3546ee,'icon':_0x289e83,'adminUrl':_0xf5f9ce,'agentUrl':_0x356d3d,'scriptName':_0x540d91,'scriptPath':_0x3ddab6,'version':_0xc58ab7};removeReferences(_0x62a16e,null);return db['Plugin'][_0x0b5a('0x92')](_0x536503)['then'](function(_0x3629cc){var _0x34e51a={'role':_0x4459aa[_0x0b5a('0x93')][_0x0b5a('0x94')],'userProfileId':_0x4459aa[_0x0b5a('0x93')][_0x0b5a('0x95')]};if(!_0x34e51a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34e51a[_0x0b5a('0x94')]===_0x0b5a('0x96')){var _0x32c8ac=_0x3629cc[_0x0b5a('0x2b')]({'plain':!![]});return db[_0x0b5a('0x97')][_0x0b5a('0x50')]({'where':{'name':'Plugins','userProfileId':_0x34e51a['userProfileId']},'raw':!![]})['then'](function(_0x993971){if(_0x993971&&_0x993971[_0x0b5a('0x98')]===0x0){return db['UserProfileResource']['create']({'name':_0x32c8ac[_0x0b5a('0x31')],'resourceId':_0x32c8ac['id'],'type':_0x993971['name'],'sectionId':_0x993971['id']},{})['then'](function(){return _0x3629cc;});}else{return _0x3629cc;}})[_0x0b5a('0x51')](function(_0x306c34){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x306c34);throw _0x306c34;});}return _0x3629cc;})[_0x0b5a('0x2a')](respondWithResult(_0x53f67e,null))[_0x0b5a('0x51')](handleError(_0x53f67e,null));}});}catch(_0x5d7c81){_0x53f67e['status'](0x1f4)[_0x0b5a('0x32')](_0x5d7c81);}};function removeReferences(_0x8be731,_0x1ea1e0){try{if(_0x8be731){fs[_0x0b5a('0x69')](_0x8be731);logger[_0x0b5a('0x6a')](_0x0b5a('0x99'));}if(_0x1ea1e0){rimraf(_0x1ea1e0,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x38eebf){logger['error'](_0x38eebf);}}exports['update']=function(_0x1dbe79,_0x46136a,_0x156933){return db[_0x0b5a('0x49')][_0x0b5a('0x50')]({'where':{'id':_0x1dbe79['params']['id']}})['then'](handleEntityNotFound(_0x46136a,null))[_0x0b5a('0x2a')](saveUpdates(_0x1dbe79[_0x0b5a('0x93')],null))[_0x0b5a('0x2a')](respondWithResult(_0x46136a,null))['catch'](handleError(_0x46136a,null));};exports[_0x0b5a('0x9a')]=function(_0x5a1f95,_0x516605,_0x47cd33){return db[_0x0b5a('0x49')][_0x0b5a('0x50')]({'where':{'id':_0x5a1f95[_0x0b5a('0x4f')]['id']}})[_0x0b5a('0x2a')](function(_0x3bbf95){if(_0x3bbf95){return _0x3bbf95[_0x0b5a('0x29')]();}})[_0x0b5a('0x2a')](function(_0x14d2c6){rimraf(path[_0x0b5a('0x61')](config[_0x0b5a('0x53')],_0x0b5a('0x54'),path[_0x0b5a('0x9b')](_0x14d2c6[_0x0b5a('0x52')])),function(){});return _0x14d2c6;})[_0x0b5a('0x2a')](handleEntityNotFound(_0x516605,null))['then'](respondWithStatusCode(_0x516605,null))[_0x0b5a('0x51')](handleError(_0x516605,null));};exports['webhookGet']=function(_0x5543e3,_0x1d9941,_0x15bcb6){return BPromise['resolve']()['then'](function(){if(!_0x5543e3[_0x0b5a('0x3b')][_0x0b5a('0x52')]){throw new Error(_0x0b5a('0x9c'));}if(!_0x5543e3[_0x0b5a('0x3b')][_0x0b5a('0x9d')]){throw new Error(_0x0b5a('0x9e'));}var _0x291b32=_0x5543e3[_0x0b5a('0x3b')][_0x0b5a('0x9f')]?_0x5543e3[_0x0b5a('0x3b')][_0x0b5a('0x9f')]+':'+_0x5543e3[_0x0b5a('0x3b')][_0x0b5a('0x9d')]:_0x0b5a('0xa0')+_0x5543e3[_0x0b5a('0x3b')][_0x0b5a('0x9d')];var _0x8a743a=_0x5543e3[_0x0b5a('0x3b')][_0x0b5a('0x1f')]?_0x5543e3['query']['json']:!![];var _0x42202b=_0x5543e3[_0x0b5a('0x3b')]['encoding']?_0x5543e3['query'][_0x0b5a('0xa1')]:null;var _0x4d8f79={'method':_0x5543e3[_0x0b5a('0xa2')],'uri':util[_0x0b5a('0xa3')]('%s%s',_0x291b32,_0x5543e3[_0x0b5a('0x3b')]['path']),'json':_0x8a743a,'resolveWithFullResponse':!![],'encoding':_0x42202b,'qs':_0x5543e3['query']};if(_0x5543e3['headers']){_0x4d8f79[_0x0b5a('0xa4')]=_0x5543e3['headers'];if(_0x4d8f79[_0x0b5a('0xa4')][_0x0b5a('0xa5')]){delete _0x4d8f79[_0x0b5a('0xa4')][_0x0b5a('0xa5')];}}if(_0x4d8f79['headers'][_0x0b5a('0xa6')]){delete _0x4d8f79['headers'][_0x0b5a('0xa6')];}return rp(_0x4d8f79);})[_0x0b5a('0x2a')](function(_0x1d077b){if(_0x1d077b){_0x1d9941[_0x0b5a('0x24')](_0x1d077b['headers']);logger['info'](_0x1d077b[_0x0b5a('0x93')]);if(_[_0x0b5a('0xa7')](_0x5543e3[_0x0b5a('0x3b')]['path'],'download')&&_0x1d077b['statusCode']==0x1f4){return _0x1d9941[_0x0b5a('0x1d')](_0x1d077b[_0x0b5a('0xa8')]);}else{return _0x1d9941[_0x0b5a('0x1e')](_0x1d077b[_0x0b5a('0xa8')])[_0x0b5a('0x32')](_0x1d077b[_0x0b5a('0x93')]);}}else{return _0x1d9941[_0x0b5a('0x1d')](0xc8);}})[_0x0b5a('0x51')](handleError(_0x1d9941,null));};exports[_0x0b5a('0xa9')]=function(_0x5b5b05,_0x50da95,_0x2da3da){return BPromise['resolve']()[_0x0b5a('0x2a')](function(){if(!_0x5b5b05[_0x0b5a('0x3b')][_0x0b5a('0x52')]){throw new Error(_0x0b5a('0x9c'));}if(!_0x5b5b05[_0x0b5a('0x3b')]['port']){throw new Error(_0x0b5a('0x9e'));}var _0x5a2af9=_0x5b5b05['query'][_0x0b5a('0x9f')]?_0x5b5b05[_0x0b5a('0x3b')][_0x0b5a('0x9f')]+':'+_0x5b5b05[_0x0b5a('0x3b')][_0x0b5a('0x9d')]:_0x0b5a('0xa0')+_0x5b5b05[_0x0b5a('0x3b')][_0x0b5a('0x9d')];var _0xad8b56=_0x5b5b05[_0x0b5a('0x3b')][_0x0b5a('0x1f')]?_0x5b5b05[_0x0b5a('0x3b')][_0x0b5a('0x1f')]:!![];var _0x25a45b=_0x5b5b05['query'][_0x0b5a('0xa1')]?_0x5b5b05['query'][_0x0b5a('0xa1')]:null;var _0x13ba0f={'method':_0x5b5b05[_0x0b5a('0xa2')],'uri':util['format'](_0x0b5a('0xaa'),_0x5a2af9,_0x5b5b05[_0x0b5a('0x3b')][_0x0b5a('0x52')]),'json':_0xad8b56,'resolveWithFullResponse':!![],'encoding':_0x25a45b,'body':_0x5b5b05['body']};if(_0x5b5b05[_0x0b5a('0xa4')]){_0x13ba0f['headers']=_0x5b5b05[_0x0b5a('0xa4')];if(_0x13ba0f[_0x0b5a('0xa4')][_0x0b5a('0xa5')]){delete _0x13ba0f[_0x0b5a('0xa4')][_0x0b5a('0xa5')];}}if(_0x13ba0f[_0x0b5a('0xa4')][_0x0b5a('0xa6')]){delete _0x13ba0f[_0x0b5a('0xa4')][_0x0b5a('0xa6')];}return rp(_0x13ba0f);})[_0x0b5a('0x2a')](function(_0x5dc91f){if(_0x5dc91f){_0x50da95[_0x0b5a('0x24')](_0x5dc91f['headers']);logger[_0x0b5a('0x6a')](_0x5dc91f[_0x0b5a('0x93')]);return _0x50da95[_0x0b5a('0x1e')](_0x5dc91f['statusCode'])['send'](_0x5dc91f[_0x0b5a('0x93')]);}else{return _0x50da95[_0x0b5a('0x1d')](0xc8);}})[_0x0b5a('0x51')](handleError(_0x50da95,null));}; \ No newline at end of file +var _0x385b=['offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','Plugins','UserProfileResource','destroy','error','stack','name','send','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','download','join','root','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','params','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','%s%s','headers','content-length','content-type','statusCode','http://localhost:','eml-format','rimraf','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','undefined','count'];(function(_0x2bfc88,_0x41f0a2){var _0x144944=function(_0x40d2d4){while(--_0x40d2d4){_0x2bfc88['push'](_0x2bfc88['shift']());}};_0x144944(++_0x41f0a2);}(_0x385b,0x89));var _0xb385=function(_0x5a0693,_0x5e80b8){_0x5a0693=_0x5a0693-0x0;var _0x5daa64=_0x385b[_0x5a0693];return _0x5daa64;};'use strict';var emlformat=require(_0xb385('0x0'));var rimraf=require(_0xb385('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb385('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb385('0x3'));var util=require('util');var path=require(_0xb385('0x4'));var sox=require(_0xb385('0x5'));var csv=require(_0xb385('0x6'));var ejs=require(_0xb385('0x7'));var fs=require('fs');var fs_extra=require(_0xb385('0x8'));var _=require(_0xb385('0x9'));var squel=require(_0xb385('0xa'));var crypto=require('crypto');var jsforce=require(_0xb385('0xb'));var deskjs=require(_0xb385('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb385('0xd'));var Papa=require(_0xb385('0xe'));var extract=require('extract-zip');var rimraf=require(_0xb385('0x1'));var archiver=require(_0xb385('0xf'));var Redis=require(_0xb385('0x10'));var authService=require(_0xb385('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb385('0x12'));var logger=require(_0xb385('0x13'))(_0xb385('0x14'));var utils=require(_0xb385('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb385('0x16'));var db=require(_0xb385('0x17'))['db'];config[_0xb385('0x18')]=_[_0xb385('0x19')](config[_0xb385('0x18')],{'host':_0xb385('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb385('0x18')]));require('./plugin.socket')[_0xb385('0x1b')](socket);function respondWithStatusCode(_0x4fd86a,_0x12fcc0){_0x12fcc0=_0x12fcc0||0xcc;return function(_0x5507ff){if(_0x5507ff){return _0x4fd86a[_0xb385('0x1c')](_0x12fcc0);}return _0x4fd86a[_0xb385('0x1d')](_0x12fcc0)[_0xb385('0x1e')]();};}function respondWithResult(_0x1e199b,_0x310449){_0x310449=_0x310449||0xc8;return function(_0x1ee877){if(_0x1ee877){return _0x1e199b['status'](_0x310449)['json'](_0x1ee877);}};}function respondWithFilteredResult(_0x324745,_0x5dfd19){return function(_0x3f4e9e){if(_0x3f4e9e){var _0x20c883=typeof _0x5dfd19['offset']===_0xb385('0x1f')&&typeof _0x5dfd19['limit']===_0xb385('0x1f');var _0x58f37a=_0x3f4e9e[_0xb385('0x20')];var _0x8dfc94=_0x20c883?0x0:_0x5dfd19[_0xb385('0x21')];var _0x525697=_0x20c883?_0x3f4e9e[_0xb385('0x20')]:_0x5dfd19[_0xb385('0x21')]+_0x5dfd19[_0xb385('0x22')];var _0x5aea45;if(_0x525697>=_0x58f37a){_0x525697=_0x58f37a;_0x5aea45=0xc8;}else{_0x5aea45=0xce;}_0x324745[_0xb385('0x1d')](_0x5aea45);return _0x324745[_0xb385('0x23')](_0xb385('0x24'),_0x8dfc94+'-'+_0x525697+'/'+_0x58f37a)[_0xb385('0x25')](_0x3f4e9e);}return null;};}function patchUpdates(_0x16a52a){return function(_0x313736){try{jsonpatch[_0xb385('0x26')](_0x313736,_0x16a52a,!![]);}catch(_0x1a6323){return BPromise[_0xb385('0x27')](_0x1a6323);}return _0x313736[_0xb385('0x28')]();};}function saveUpdates(_0x2f4a9d,_0x2c6ec0){return function(_0x3d797d){if(_0x3d797d){return _0x3d797d[_0xb385('0x29')](_0x2f4a9d)[_0xb385('0x2a')](function(_0xe96a33){return _0xe96a33;});}return null;};}function removeEntity(_0x52cd8f,_0x396792){return function(_0x5c6332){if(_0x5c6332){return _0x5c6332['destroy']()[_0xb385('0x2a')](function(){var _0x4f9e0a=_0x5c6332[_0xb385('0x2b')]({'plain':!![]});var _0x571177=_0xb385('0x2c');return db[_0xb385('0x2d')][_0xb385('0x2e')]({'where':{'type':_0x571177,'resourceId':_0x4f9e0a['id']}})['then'](function(){return _0x5c6332;});})[_0xb385('0x2a')](function(){_0x52cd8f[_0xb385('0x1d')](0xcc)[_0xb385('0x1e')]();});}};}function handleEntityNotFound(_0x217ed0,_0x3ab36a){return function(_0x4c9ae9){if(!_0x4c9ae9){_0x217ed0[_0xb385('0x1c')](0x194);}return _0x4c9ae9;};}function handleError(_0x453b92,_0x4ce13d){_0x4ce13d=_0x4ce13d||0x1f4;return function(_0x14e77a){logger[_0xb385('0x2f')](_0x14e77a[_0xb385('0x30')]);if(_0x14e77a[_0xb385('0x31')]){delete _0x14e77a[_0xb385('0x31')];}_0x453b92[_0xb385('0x1d')](_0x4ce13d)[_0xb385('0x32')](_0x14e77a);};}exports['index']=function(_0x18e982,_0x5532c5){var _0x542d1d={},_0xddef38={},_0x740f45={'count':0x0,'rows':[]};var _0xddcf02=_['map'](db[_0xb385('0x33')][_0xb385('0x34')],function(_0x582028){return{'name':_0x582028[_0xb385('0x35')],'type':_0x582028[_0xb385('0x36')][_0xb385('0x37')]};});_0xddef38[_0xb385('0x38')]=_['map'](_0xddcf02,_0xb385('0x31'));_0xddef38[_0xb385('0x39')]=_[_0xb385('0x3a')](_0x18e982[_0xb385('0x39')]);_0xddef38[_0xb385('0x3b')]=_[_0xb385('0x3c')](_0xddef38[_0xb385('0x38')],_0xddef38[_0xb385('0x39')]);_0x542d1d[_0xb385('0x3d')]=_['intersection'](_0xddef38['model'],qs[_0xb385('0x3e')](_0x18e982[_0xb385('0x39')][_0xb385('0x3e')]));_0x542d1d[_0xb385('0x3d')]=_0x542d1d['attributes'][_0xb385('0x3f')]?_0x542d1d[_0xb385('0x3d')]:_0xddef38[_0xb385('0x38')];if(!_0x18e982['query'][_0xb385('0x40')](_0xb385('0x41'))){_0x542d1d[_0xb385('0x22')]=qs['limit'](_0x18e982[_0xb385('0x39')]['limit']);_0x542d1d[_0xb385('0x21')]=qs[_0xb385('0x21')](_0x18e982[_0xb385('0x39')][_0xb385('0x21')]);}_0x542d1d[_0xb385('0x42')]=qs[_0xb385('0x43')](_0x18e982[_0xb385('0x39')][_0xb385('0x43')]);_0x542d1d[_0xb385('0x44')]=qs[_0xb385('0x3b')](_[_0xb385('0x45')](_0x18e982['query'],_0xddef38['filters']),_0xddcf02);if(_0x18e982[_0xb385('0x39')][_0xb385('0x46')]){_0x542d1d[_0xb385('0x44')]=_[_0xb385('0x47')](_0x542d1d[_0xb385('0x44')],{'$or':_[_0xb385('0x48')](_0xddcf02,function(_0x1a958c){if(_0x1a958c[_0xb385('0x36')]!==_0xb385('0x49')){var _0x38b7e6={};_0x38b7e6[_0x1a958c[_0xb385('0x31')]]={'$like':'%'+_0x18e982[_0xb385('0x39')][_0xb385('0x46')]+'%'};return _0x38b7e6;}})});}_0x542d1d=_[_0xb385('0x47')]({},_0x542d1d,_0x18e982[_0xb385('0x4a')]);var _0x2522bd={'where':_0x542d1d['where']};return db[_0xb385('0x33')][_0xb385('0x20')](_0x2522bd)[_0xb385('0x2a')](function(_0x1ed1bd){_0x740f45[_0xb385('0x20')]=_0x1ed1bd;if(_0x18e982[_0xb385('0x39')][_0xb385('0x4b')]){_0x542d1d[_0xb385('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0xb385('0x4d')](_0x542d1d);})[_0xb385('0x2a')](function(_0x2327f2){_0x740f45[_0xb385('0x4e')]=_0x2327f2;return _0x740f45;})[_0xb385('0x2a')](respondWithFilteredResult(_0x5532c5,_0x542d1d))[_0xb385('0x4f')](handleError(_0x5532c5,null));};exports[_0xb385('0x50')]=function(_0x29483f,_0x21e7f9){var _0x54c3f9={'raw':!![],'where':{'id':_0x29483f['params']['id']}},_0x571aa6={};_0x571aa6[_0xb385('0x38')]=_[_0xb385('0x3a')](db[_0xb385('0x33')]['rawAttributes']);_0x571aa6[_0xb385('0x39')]=_[_0xb385('0x3a')](_0x29483f['query']);_0x571aa6['filters']=_['intersection'](_0x571aa6['model'],_0x571aa6[_0xb385('0x39')]);_0x54c3f9[_0xb385('0x3d')]=_['intersection'](_0x571aa6[_0xb385('0x38')],qs[_0xb385('0x3e')](_0x29483f[_0xb385('0x39')]['fields']));_0x54c3f9['attributes']=_0x54c3f9['attributes']['length']?_0x54c3f9['attributes']:_0x571aa6[_0xb385('0x38')];if(_0x29483f[_0xb385('0x39')][_0xb385('0x4b')]){_0x54c3f9[_0xb385('0x4c')]=[{'all':!![]}];}_0x54c3f9=_[_0xb385('0x47')]({},_0x54c3f9,_0x29483f['options']);return db[_0xb385('0x33')][_0xb385('0x51')](_0x54c3f9)[_0xb385('0x2a')](handleEntityNotFound(_0x21e7f9,null))['then'](respondWithResult(_0x21e7f9,null))[_0xb385('0x4f')](handleError(_0x21e7f9,null));};exports[_0xb385('0x52')]=function(_0x1cac48,_0x312d32,_0x2f524c){return db[_0xb385('0x33')][_0xb385('0x51')]({'where':{'id':_0x1cac48['params']['id']},'attributes':['name',_0xb385('0x4')],'raw':!![]})[_0xb385('0x2a')](handleEntityNotFound(_0x312d32,null))[_0xb385('0x2a')](function(_0x29ce59){if(_0x29ce59){var _0x5b07fb=path[_0xb385('0x53')](config[_0xb385('0x54')],'server/files/plugins',util[_0xb385('0x55')](_0xb385('0x56'),path[_0xb385('0x57')](_0x29ce59[_0xb385('0x4')])));var _0x33a18f=fs[_0xb385('0x58')](_0x5b07fb);var _0x5e54ba=archiver('zip',{'zlib':{'level':0x9}});_0x5e54ba['on'](_0xb385('0x59'),function(_0x28ff81){if(_0x28ff81[_0xb385('0x5a')]===_0xb385('0x5b')){logger[_0xb385('0x2f')](_0x28ff81);}else{throw new db[(_0xb385('0x5c'))][(_0xb385('0x5d'))](_0xb385('0x5e'));}});_0x5e54ba['on'](_0xb385('0x2f'),function(_0x35c88f){throw new db[(_0xb385('0x5c'))]['Error'](_0xb385('0x5e'));});_0x5e54ba['pipe'](_0x33a18f);_0x5e54ba['glob'](_0xb385('0x5f'),{'cwd':path[_0xb385('0x53')](config[_0xb385('0x54')],_0xb385('0x60'),path[_0xb385('0x61')](_0x29ce59[_0xb385('0x4')])),'ignore':[path[_0xb385('0x53')](path['basename'](_0x29ce59[_0xb385('0x4')]),_0xb385('0x62')),path['join'](path[_0xb385('0x57')](_0x29ce59[_0xb385('0x4')]),_0xb385('0x63'))],'nodir':!![]})[_0xb385('0x64')]();_0x33a18f['on'](_0xb385('0x65'),function(){if(!fs[_0xb385('0x66')](_0x5b07fb)){throw new db[(_0xb385('0x5c'))]['Error'](_0xb385('0x67'));}return _0x312d32[_0xb385('0x52')](_0x5b07fb,util[_0xb385('0x55')](_0xb385('0x56'),path[_0xb385('0x57')](_0x29ce59[_0xb385('0x4')])),function(_0x15f382){if(_0x15f382){throw new db['Sequelize']['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb385('0x68')](_0x5b07fb);logger[_0xb385('0x69')](_0xb385('0x6a'));logger[_0xb385('0x69')](_0xb385('0x6b'));});});}return null;})[_0xb385('0x4f')](handleError(_0x312d32,null));};exports[_0xb385('0x6c')]=function(_0x54d202,_0x2d23f9,_0x4cada0){var _0x20e248=path['basename'](_0x54d202[_0xb385('0x6d')]['filename'],path['extname'](_0x54d202[_0xb385('0x6d')][_0xb385('0x6e')]));var _0x29ae3e=path[_0xb385('0x53')](config['root'],'server/files/plugins',_0x54d202[_0xb385('0x6d')][_0xb385('0x6e')]);var _0x4cdb8d=path['join'](config[_0xb385('0x54')],'server/files/plugins',_0x20e248);logger['info'](_0xb385('0x6f'),_0x29ae3e);logger[_0xb385('0x69')](_0xb385('0x70'),_0x4cdb8d);try{fs[_0xb385('0x71')](_0x29ae3e,parseInt(_0xb385('0x72'),0x8));extract(_0x29ae3e,{'dir':_0x4cdb8d},function(_0x219f5a){if(_0x219f5a){logger[_0xb385('0x2f')](_0x219f5a);handleError(_0x219f5a,!![]);};var _0x1967a3=fs['readdirSync'](_0x4cdb8d);if(_0x1967a3[_0xb385('0x3f')]>0x1){removeReferences(_0x29ae3e,_0x4cdb8d);logger['error'](_0xb385('0x73'));return _0x4cada0(new Error(_0xb385('0x73')));}var _0x1e9065=fs['lstatSync'](path['join'](_0x4cdb8d,_0x1967a3[0x0]));if(_0x1e9065['isFile']()){removeReferences(_0x29ae3e,_0x4cdb8d);logger[_0xb385('0x2f')](_0xb385('0x73'));return _0x4cada0(new Error(_0xb385('0x73')));}if(_0x1e9065[_0xb385('0x74')]()){var _0x2a2df8=fs[_0xb385('0x75')](path[_0xb385('0x53')](_0x4cdb8d,_0x1967a3[0x0]));if(_0x2a2df8[_0xb385('0x3f')]===0x0){removeReferences(_0x29ae3e,_0x4cdb8d);logger['error'](_0xb385('0x73'));return _0x4cada0(new Error('Invalid\x20plugin\x20structure'));}var _0x247a60=_0x2a2df8[_0xb385('0x76')](function(_0x18e761){return _0x18e761===_0xb385('0x77');});if(!_0x247a60){return _0x4cada0(new Error(_0xb385('0x78')));}var _0x2af13b=fs[_0xb385('0x79')](path[_0xb385('0x53')](_0x4cdb8d,_0x1967a3[0x0],_0xb385('0x77')));var _0x325f95=JSON[_0xb385('0x7a')](_0x2af13b);if(_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x31')]){return _0x4cada0(new Error(_0xb385('0x7b')));}if(_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x36')]){return _0x4cada0(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x7c')]){return _0x4cada0(new Error(_0xb385('0x7d')));}if('undefined'==typeof _0x325f95[_0xb385('0x7e')]){return _0x4cada0(new Error(_0xb385('0x7f')));}if(_0x325f95[_0xb385('0x36')]===_0xb385('0x80')){if(_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x7e')]['views']){return _0x4cada0(new Error(_0xb385('0x81')));}if(_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x7e')]['views'][_0xb385('0x82')]&&_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x7e')][_0xb385('0x83')][_0xb385('0x84')]){return _0x4cada0(new Error(_0xb385('0x85')));}}else if(_0x325f95['type']===_0xb385('0x86')){if(_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x7e')][_0xb385('0x87')]){return _0x4cada0(new Error(_0xb385('0x88')));}if(_0xb385('0x1f')==typeof _0x325f95[_0xb385('0x7e')][_0xb385('0x89')]){return _0x4cada0(new Error(_0xb385('0x8a')));}}else{return _0x4cada0(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x38b42a=_0x325f95['name'];var _0x6f91ac=_0x325f95['description'];var _0x3a207d=_0x325f95[_0xb385('0x36')];var _0x158c3b=_0x325f95['sidebar']?_0x325f95[_0xb385('0x8b')]:_0xb385('0x8c');var _0x1ad2a8=_0x325f95['icon']?_0x325f95[_0xb385('0x8d')]:_0xb385('0x8e');var _0x40b48b='';var _0x12cf61='';var _0x4f3338='';var _0x24fb38='';var _0x39d499=_0x325f95[_0xb385('0x7c')];if(_0x3a207d===_0xb385('0x80')){if(_0xb385('0x1f')!=typeof _0x325f95[_0xb385('0x7e')][_0xb385('0x83')][_0xb385('0x82')]){var _0x47fb96=_0x325f95[_0xb385('0x7e')][_0xb385('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x47fb96)){_0x40b48b=path['join']('plugins',_0x20e248,_0x1967a3[0x0],_0x47fb96);}else{_0x40b48b=_0x47fb96;}}else{logger['info'](_0xb385('0x8f'));}if(_0xb385('0x1f')!=typeof _0x325f95[_0xb385('0x7e')][_0xb385('0x83')][_0xb385('0x84')]){var _0xa3818f=_0x325f95[_0xb385('0x7e')][_0xb385('0x83')][_0xb385('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xb385('0x90')](_0xa3818f)){_0x12cf61=path['join'](_0xb385('0x91'),_0x20e248,_0x1967a3[0x0],_0xa3818f);}else{_0x12cf61=_0xa3818f;}}else{logger[_0xb385('0x69')](_0xb385('0x92'));}}else if(_0x3a207d===_0xb385('0x86')){_0x4f3338=_0x325f95['parameters'][_0xb385('0x87')];_0x24fb38=_0x325f95[_0xb385('0x7e')]['scriptPath'];if(_0xb385('0x1f')!=typeof _0x325f95[_0xb385('0x7e')]['views']){if(_0xb385('0x1f')!=typeof _0x325f95[_0xb385('0x7e')][_0xb385('0x83')][_0xb385('0x82')]){var _0x47fb96=_0x325f95[_0xb385('0x7e')]['views'][_0xb385('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x47fb96)){_0x40b48b=path[_0xb385('0x53')]('plugins',_0x20e248,_0x1967a3[0x0],_0x47fb96);}else{_0x40b48b=_0x47fb96;}}if(_0xb385('0x1f')!=typeof _0x325f95[_0xb385('0x7e')][_0xb385('0x83')][_0xb385('0x84')]){var _0xa3818f=_0x325f95[_0xb385('0x7e')][_0xb385('0x83')][_0xb385('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xb385('0x90')](_0xa3818f)){_0x12cf61=path[_0xb385('0x53')](_0xb385('0x91'),_0x20e248,_0x1967a3[0x0],_0xa3818f);}else{_0x12cf61=_0xa3818f;}}}}var _0x5ef877={'name':_0x38b42a,'description':_0x6f91ac,'path':path[_0xb385('0x53')](_0x20e248,_0x1967a3[0x0]),'type':_0x3a207d,'sidebar':_0x158c3b,'icon':_0x1ad2a8,'adminUrl':_0x40b48b,'agentUrl':_0x12cf61,'scriptName':_0x4f3338,'scriptPath':_0x24fb38,'version':_0x39d499};removeReferences(_0x29ae3e,null);return db[_0xb385('0x33')][_0xb385('0x93')](_0x5ef877)[_0xb385('0x2a')](function(_0x1d6ca0){var _0x29a04b={'role':_0x54d202[_0xb385('0x94')]['role'],'userProfileId':_0x54d202['body'][_0xb385('0x95')]};if(!_0x29a04b)throw new Error(_0xb385('0x96'));if(_0x29a04b['role']==='user'){var _0x47a2c0=_0x1d6ca0[_0xb385('0x2b')]({'plain':!![]});return db[_0xb385('0x97')]['find']({'where':{'name':_0xb385('0x2c'),'userProfileId':_0x29a04b[_0xb385('0x95')]},'raw':!![]})['then'](function(_0x16a35f){if(_0x16a35f&&_0x16a35f[_0xb385('0x98')]===0x0){return db[_0xb385('0x2d')][_0xb385('0x93')]({'name':_0x47a2c0[_0xb385('0x31')],'resourceId':_0x47a2c0['id'],'type':_0x16a35f['name'],'sectionId':_0x16a35f['id']},{})['then'](function(){return _0x1d6ca0;});}else{return _0x1d6ca0;}})[_0xb385('0x4f')](function(_0x5b52da){logger['error'](_0xb385('0x99'),_0x5b52da);throw _0x5b52da;});}return _0x1d6ca0;})[_0xb385('0x2a')](respondWithResult(_0x2d23f9,null))['catch'](handleError(_0x2d23f9,null));}});}catch(_0x3055e4){_0x2d23f9[_0xb385('0x1d')](0x1f4)[_0xb385('0x32')](_0x3055e4);}};function removeReferences(_0x21d4c6,_0x532de6){try{if(_0x21d4c6){fs[_0xb385('0x68')](_0x21d4c6);logger[_0xb385('0x69')]('Zip\x20archive\x20removed');}if(_0x532de6){rimraf(_0x532de6,function(){});logger[_0xb385('0x69')](_0xb385('0x9a'));}}catch(_0x5a2810){logger[_0xb385('0x2f')](_0x5a2810);}}exports['update']=function(_0x395aca,_0x3908c6,_0x4d2b02){return db['Plugin'][_0xb385('0x51')]({'where':{'id':_0x395aca[_0xb385('0x9b')]['id']}})[_0xb385('0x2a')](handleEntityNotFound(_0x3908c6,null))[_0xb385('0x2a')](saveUpdates(_0x395aca[_0xb385('0x94')],null))[_0xb385('0x2a')](respondWithResult(_0x3908c6,null))[_0xb385('0x4f')](handleError(_0x3908c6,null));};exports['delete']=function(_0x2b1d89,_0x54415f,_0x4cd650){return db[_0xb385('0x33')][_0xb385('0x51')]({'where':{'id':_0x2b1d89['params']['id']}})['then'](function(_0x10e10d){if(_0x10e10d){return _0x10e10d[_0xb385('0x2e')]();}})[_0xb385('0x2a')](function(_0x116463){rimraf(path[_0xb385('0x53')](config['root'],_0xb385('0x60'),path[_0xb385('0x61')](_0x116463[_0xb385('0x4')])),function(){});return _0x116463;})['then'](handleEntityNotFound(_0x54415f,null))[_0xb385('0x2a')](respondWithStatusCode(_0x54415f,null))[_0xb385('0x4f')](handleError(_0x54415f,null));};exports[_0xb385('0x9c')]=function(_0x1466e0,_0x3de045,_0x45dd97){return BPromise[_0xb385('0x9d')]()[_0xb385('0x2a')](function(){if(!_0x1466e0[_0xb385('0x39')][_0xb385('0x4')]){throw new Error(_0xb385('0x9e'));}if(!_0x1466e0['query']['port']){throw new Error(_0xb385('0x9f'));}var _0x5265a2=_0x1466e0['query'][_0xb385('0xa0')]?_0x1466e0[_0xb385('0x39')]['hostname']+':'+_0x1466e0[_0xb385('0x39')][_0xb385('0xa1')]:'http://localhost:'+_0x1466e0['query'][_0xb385('0xa1')];var _0x5619c3=_0x1466e0[_0xb385('0x39')][_0xb385('0x25')]?_0x1466e0['query'][_0xb385('0x25')]:!![];var _0x594fea=_0x1466e0[_0xb385('0x39')][_0xb385('0xa2')]?_0x1466e0[_0xb385('0x39')][_0xb385('0xa2')]:null;var _0xe840d8={'method':_0x1466e0[_0xb385('0xa3')],'uri':util[_0xb385('0x55')](_0xb385('0xa4'),_0x5265a2,_0x1466e0['query'][_0xb385('0x4')]),'json':_0x5619c3,'resolveWithFullResponse':!![],'encoding':_0x594fea,'qs':_0x1466e0[_0xb385('0x39')]};if(_0x1466e0['headers']){_0xe840d8[_0xb385('0xa5')]=_0x1466e0[_0xb385('0xa5')];if(_0xe840d8[_0xb385('0xa5')][_0xb385('0xa6')]){delete _0xe840d8['headers'][_0xb385('0xa6')];}}if(_0xe840d8[_0xb385('0xa5')]['content-type']){delete _0xe840d8[_0xb385('0xa5')][_0xb385('0xa7')];}return rp(_0xe840d8);})[_0xb385('0x2a')](function(_0x142ce1){if(_0x142ce1){_0x3de045[_0xb385('0x23')](_0x142ce1[_0xb385('0xa5')]);logger[_0xb385('0x69')](_0x142ce1['body']);if(_['endsWith'](_0x1466e0[_0xb385('0x39')][_0xb385('0x4')],_0xb385('0x52'))&&_0x142ce1[_0xb385('0xa8')]==0x1f4){return _0x3de045[_0xb385('0x1c')](_0x142ce1[_0xb385('0xa8')]);}else{return _0x3de045['status'](_0x142ce1[_0xb385('0xa8')])[_0xb385('0x32')](_0x142ce1[_0xb385('0x94')]);}}else{return _0x3de045[_0xb385('0x1c')](0xc8);}})[_0xb385('0x4f')](handleError(_0x3de045,null));};exports['webhookPost']=function(_0x2b6c10,_0x3a9ead,_0x468370){return BPromise[_0xb385('0x9d')]()[_0xb385('0x2a')](function(){if(!_0x2b6c10[_0xb385('0x39')][_0xb385('0x4')]){throw new Error(_0xb385('0x9e'));}if(!_0x2b6c10[_0xb385('0x39')][_0xb385('0xa1')]){throw new Error(_0xb385('0x9f'));}var _0x4bee83=_0x2b6c10[_0xb385('0x39')][_0xb385('0xa0')]?_0x2b6c10[_0xb385('0x39')][_0xb385('0xa0')]+':'+_0x2b6c10['query'][_0xb385('0xa1')]:_0xb385('0xa9')+_0x2b6c10[_0xb385('0x39')][_0xb385('0xa1')];var _0xfda5c=_0x2b6c10[_0xb385('0x39')][_0xb385('0x25')]?_0x2b6c10['query']['json']:!![];var _0xb32c10=_0x2b6c10[_0xb385('0x39')][_0xb385('0xa2')]?_0x2b6c10[_0xb385('0x39')]['encoding']:null;var _0xa69524={'method':_0x2b6c10['method'],'uri':util[_0xb385('0x55')]('%s%s',_0x4bee83,_0x2b6c10['query'][_0xb385('0x4')]),'json':_0xfda5c,'resolveWithFullResponse':!![],'encoding':_0xb32c10,'body':_0x2b6c10[_0xb385('0x94')]};if(_0x2b6c10[_0xb385('0xa5')]){_0xa69524['headers']=_0x2b6c10[_0xb385('0xa5')];if(_0xa69524[_0xb385('0xa5')][_0xb385('0xa6')]){delete _0xa69524[_0xb385('0xa5')]['content-length'];}}if(_0xa69524[_0xb385('0xa5')][_0xb385('0xa7')]){delete _0xa69524[_0xb385('0xa5')][_0xb385('0xa7')];}return rp(_0xa69524);})[_0xb385('0x2a')](function(_0x5e82ef){if(_0x5e82ef){_0x3a9ead[_0xb385('0x23')](_0x5e82ef['headers']);logger[_0xb385('0x69')](_0x5e82ef[_0xb385('0x94')]);return _0x3a9ead['status'](_0x5e82ef[_0xb385('0xa8')])[_0xb385('0x32')](_0x5e82ef[_0xb385('0x94')]);}else{return _0x3a9ead[_0xb385('0x1c')](0xc8);}})[_0xb385('0x4f')](handleError(_0x3a9ead,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3d2588d..3797ac3 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 _0x79bf=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xea02e8,_0x6b872e){var _0x3df2ad=function(_0x1d884d){while(--_0x1d884d){_0xea02e8['push'](_0xea02e8['shift']());}};_0x3df2ad(++_0x6b872e);}(_0x79bf,0x1df));var _0xf79b=function(_0x2cbfe5,_0x1fb99b){_0x2cbfe5=_0x2cbfe5-0x0;var _0x3f69ad=_0x79bf[_0x2cbfe5];return _0x3f69ad;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xf79b('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xf79b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf79b('0x2'),'afterDestroy':_0xf79b('0x3')};function emitEvent(_0x917960){return function(_0x193fad,_0x44bff1,_0x8b298){PluginEvents[_0xf79b('0x4')](_0x917960+':'+_0x193fad['id'],_0x193fad);PluginEvents['emit'](_0x917960,_0x193fad);_0x8b298(null);};}for(var e in events){if(events[_0xf79b('0x5')](e)){var event=events[e];Plugin[_0xf79b('0x6')](e,emitEvent(event));}}module[_0xf79b('0x7')]=PluginEvents; \ No newline at end of file +var _0x90b1=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','remove'];(function(_0xc0bc15,_0x507723){var _0xe858a=function(_0x34243f){while(--_0x34243f){_0xc0bc15['push'](_0xc0bc15['shift']());}};_0xe858a(++_0x507723);}(_0x90b1,0x1bb));var _0x190b=function(_0x2974c1,_0x1c7b46){_0x2974c1=_0x2974c1-0x0;var _0x2372a0=_0x90b1[_0x2974c1];return _0x2372a0;};'use strict';var EventEmitter=require(_0x190b('0x0'));var Plugin=require(_0x190b('0x1'))['db'][_0x190b('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x190b('0x3'),'afterDestroy':_0x190b('0x4')};function emitEvent(_0xa05468){return function(_0x120ddc,_0x4fbcad,_0x4c355f){PluginEvents['emit'](_0xa05468+':'+_0x120ddc['id'],_0x120ddc);PluginEvents['emit'](_0xa05468,_0x120ddc);_0x4c355f(null);};}for(var e in events){if(events[_0x190b('0x5')](e)){var event=events[e];Plugin[_0x190b('0x6')](e,emitEvent(event));}}module[_0x190b('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 34629ce..7c44b8b 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 _0x2815=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2815,0xce));var _0x5281=function(_0x1c1353,_0x2c9ef1){_0x1c1353=_0x1c1353-0x0;var _0x3a8f07=_0x2815[_0x1c1353];return _0x3a8f07;};'use strict';var _=require(_0x5281('0x0'));var util=require(_0x5281('0x1'));var logger=require('../../config/logger')(_0x5281('0x2'));var moment=require(_0x5281('0x3'));var BPromise=require(_0x5281('0x4'));var rp=require(_0x5281('0x5'));var fs=require('fs');var path=require(_0x5281('0x6'));var rimraf=require(_0x5281('0x7'));var config=require(_0x5281('0x8'));var attributes=require(_0x5281('0x9'));module[_0x5281('0xa')]=function(_0x576d51,_0x3f122f){return _0x576d51['define'](_0x5281('0xb'),attributes,{'tableName':_0x5281('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1b1=['define','plugins','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x35f51,_0xa75f04){var _0x41bac7=function(_0x44b4fd){while(--_0x44b4fd){_0x35f51['push'](_0x35f51['shift']());}};_0x41bac7(++_0xa75f04);}(_0xe1b1,0x138));var _0x1e1b=function(_0x585bec,_0x22f102){_0x585bec=_0x585bec-0x0;var _0x43da50=_0xe1b1[_0x585bec];return _0x43da50;};'use strict';var _=require('lodash');var util=require(_0x1e1b('0x0'));var logger=require(_0x1e1b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1e1b('0x2'));var rp=require(_0x1e1b('0x3'));var fs=require('fs');var path=require(_0x1e1b('0x4'));var rimraf=require(_0x1e1b('0x5'));var config=require(_0x1e1b('0x6'));var attributes=require(_0x1e1b('0x7'));module['exports']=function(_0x1bb7e5,_0x146692){return _0x1bb7e5[_0x1e1b('0x8')]('Plugin',attributes,{'tableName':_0x1e1b('0x9'),'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 7e6a1bb..6c56513 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 _0x2db6=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','Plugin','create','body','CreatePlugin','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x18d5ee,_0x5ce707){var _0x5ed755=function(_0x4b112b){while(--_0x4b112b){_0x18d5ee['push'](_0x18d5ee['shift']());}};_0x5ed755(++_0x5ce707);}(_0x2db6,0xfe));var _0x62db=function(_0xe1f3e,_0x339601){_0xe1f3e=_0xe1f3e-0x0;var _0x162c54=_0x2db6[_0xe1f3e];return _0x162c54;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x62db('0x0'));var BPromise=require(_0x62db('0x1'));var rs=require(_0x62db('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62db('0x3'))['db'];var utils=require(_0x62db('0x4'));var logger=require(_0x62db('0x5'))('rpc');var config=require(_0x62db('0x6'));var jayson=require(_0x62db('0x7'));var client=jayson[_0x62db('0x8')][_0x62db('0x9')]({'port':0x232a});config[_0x62db('0xa')]=_[_0x62db('0xb')](config['redis'],{'host':_0x62db('0xc'),'port':0x18eb});var socket=require(_0x62db('0xd'))(new Redis(config[_0x62db('0xa')]));require(_0x62db('0xe'))[_0x62db('0xf')](socket);function respondWithRpcPromise(_0x32b044,_0x54bc31,_0x36b66c){return new BPromise(function(_0x4db8fe,_0x2e0253){return client['request'](_0x32b044,_0x36b66c)[_0x62db('0x10')](function(_0x2cc1a9){logger[_0x62db('0x11')](_0x62db('0x12'),_0x54bc31,_0x62db('0x13'));logger[_0x62db('0x14')](_0x62db('0x15'),_0x54bc31,'request\x20sent',JSON['stringify'](_0x2cc1a9));if(_0x2cc1a9[_0x62db('0x16')]){if(_0x2cc1a9[_0x62db('0x16')]['code']===0x1f4){logger[_0x62db('0x16')](_0x62db('0x12'),_0x54bc31,_0x2cc1a9[_0x62db('0x16')][_0x62db('0x17')]);return _0x2e0253(_0x2cc1a9[_0x62db('0x16')]['message']);}logger['error'](_0x62db('0x12'),_0x54bc31,_0x2cc1a9['error'][_0x62db('0x17')]);return _0x4db8fe(_0x2cc1a9['error'][_0x62db('0x17')]);}else{logger[_0x62db('0x11')]('Plugin,\x20%s,\x20%s',_0x54bc31,_0x62db('0x13'));_0x4db8fe(_0x2cc1a9['result'][_0x62db('0x17')]);}})['catch'](function(_0x1c2869){logger['error'](_0x62db('0x12'),_0x54bc31,_0x1c2869);_0x2e0253(_0x1c2869);});});}exports['CreatePlugin']=function(_0x2b77bf){var _0x2e89c0=this;return new Promise(function(_0x30f41a,_0x1973f5){return db[_0x62db('0x18')][_0x62db('0x19')](_0x2b77bf[_0x62db('0x1a')],{'raw':_0x2b77bf['options']?_0x2b77bf['options']['raw']===undefined?!![]:![]:!![]})[_0x62db('0x10')](function(_0x5121dd){logger[_0x62db('0x11')](_0x62db('0x1b'),_0x2b77bf);logger[_0x62db('0x14')]('CreatePlugin',_0x2b77bf,JSON[_0x62db('0x1c')](_0x5121dd));_0x30f41a(_0x5121dd);})['catch'](function(_0x23dbdf){logger[_0x62db('0x16')](_0x62db('0x1b'),_0x23dbdf['message'],_0x2b77bf);_0x1973f5(_0x2e89c0[_0x62db('0x16')](0x1f4,_0x23dbdf[_0x62db('0x17')]));});});}; \ No newline at end of file +var _0x2cf5=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreatePlugin','Plugin','body','options','raw'];(function(_0x2b8e01,_0x1dc492){var _0x641a91=function(_0x4f7538){while(--_0x4f7538){_0x2b8e01['push'](_0x2b8e01['shift']());}};_0x641a91(++_0x1dc492);}(_0x2cf5,0xa0));var _0x52cf=function(_0x4b31bf,_0x3d528f){_0x4b31bf=_0x4b31bf-0x0;var _0x1498ed=_0x2cf5[_0x4b31bf];return _0x1498ed;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52cf('0x2'));var db=require(_0x52cf('0x3'))['db'];var utils=require(_0x52cf('0x4'));var logger=require(_0x52cf('0x5'))('rpc');var config=require(_0x52cf('0x6'));var jayson=require(_0x52cf('0x7'));var client=jayson[_0x52cf('0x8')]['http']({'port':0x232a});config[_0x52cf('0x9')]=_[_0x52cf('0xa')](config[_0x52cf('0x9')],{'host':_0x52cf('0xb'),'port':0x18eb});var socket=require(_0x52cf('0xc'))(new Redis(config['redis']));require(_0x52cf('0xd'))[_0x52cf('0xe')](socket);function respondWithRpcPromise(_0x2fc3da,_0x1a2f45,_0x461dfa){return new BPromise(function(_0x458fca,_0x3c6da3){return client[_0x52cf('0xf')](_0x2fc3da,_0x461dfa)[_0x52cf('0x10')](function(_0x47bf7c){logger[_0x52cf('0x11')](_0x52cf('0x12'),_0x1a2f45,_0x52cf('0x13'));logger[_0x52cf('0x14')](_0x52cf('0x15'),_0x1a2f45,_0x52cf('0x13'),JSON[_0x52cf('0x16')](_0x47bf7c));if(_0x47bf7c[_0x52cf('0x17')]){if(_0x47bf7c['error'][_0x52cf('0x18')]===0x1f4){logger[_0x52cf('0x17')](_0x52cf('0x12'),_0x1a2f45,_0x47bf7c[_0x52cf('0x17')]['message']);return _0x3c6da3(_0x47bf7c[_0x52cf('0x17')]['message']);}logger[_0x52cf('0x17')](_0x52cf('0x12'),_0x1a2f45,_0x47bf7c[_0x52cf('0x17')][_0x52cf('0x19')]);return _0x458fca(_0x47bf7c[_0x52cf('0x17')][_0x52cf('0x19')]);}else{logger[_0x52cf('0x11')](_0x52cf('0x12'),_0x1a2f45,_0x52cf('0x13'));_0x458fca(_0x47bf7c['result'][_0x52cf('0x19')]);}})[_0x52cf('0x1a')](function(_0x3d87e1){logger[_0x52cf('0x17')](_0x52cf('0x12'),_0x1a2f45,_0x3d87e1);_0x3c6da3(_0x3d87e1);});});}exports[_0x52cf('0x1b')]=function(_0x5785e1){var _0x551b06=this;return new Promise(function(_0x15973c,_0x58659f){return db[_0x52cf('0x1c')]['create'](_0x5785e1[_0x52cf('0x1d')],{'raw':_0x5785e1[_0x52cf('0x1e')]?_0x5785e1[_0x52cf('0x1e')][_0x52cf('0x1f')]===undefined?!![]:![]:!![]})[_0x52cf('0x10')](function(_0x5e601c){logger[_0x52cf('0x11')](_0x52cf('0x1b'),_0x5785e1);logger['debug'](_0x52cf('0x1b'),_0x5785e1,JSON['stringify'](_0x5e601c));_0x15973c(_0x5e601c);})[_0x52cf('0x1a')](function(_0x31cae2){logger[_0x52cf('0x17')]('CreatePlugin',_0x31cae2[_0x52cf('0x19')],_0x5785e1);_0x58659f(_0x551b06[_0x52cf('0x17')](0x1f4,_0x31cae2[_0x52cf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 7bfc479..d2fe57c 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 _0x4a0d=['register','remove','update','emit'];(function(_0x1f3837,_0x25e348){var _0x28d845=function(_0x4655ab){while(--_0x4655ab){_0x1f3837['push'](_0x1f3837['shift']());}};_0x28d845(++_0x25e348);}(_0x4a0d,0x109));var _0xd4a0=function(_0x39507b,_0x3efdac){_0x39507b=_0x39507b-0x0;var _0x5e7dd4=_0x4a0d[_0x39507b];return _0x5e7dd4;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xd4a0('0x0'),_0xd4a0('0x1')];function createListener(_0xb230d2,_0x1790f6){return function(_0x105fea){_0x1790f6[_0xd4a0('0x2')](_0xb230d2,_0x105fea);};}function removeListener(_0x11df39,_0x175848){return function(){PluginEvents['removeListener'](_0x11df39,_0x175848);};}exports[_0xd4a0('0x3')]=function(_0x394877){for(var _0x39ad25=0x0,_0x22c489=events['length'];_0x39ad25<_0x22c489;_0x39ad25++){var _0xcbdc09=events[_0x39ad25];var _0x489ad4=createListener('plugin:'+_0xcbdc09,_0x394877);PluginEvents['on'](_0xcbdc09,_0x489ad4);}}; \ No newline at end of file +var _0xc8d0=['save','emit','removeListener','length','plugin:','./plugin.events'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc8d0,0xef));var _0x0c8d=function(_0x4a34e0,_0x29ff2f){_0x4a34e0=_0x4a34e0-0x0;var _0xb5ce1d=_0xc8d0[_0x4a34e0];return _0xb5ce1d;};'use strict';var PluginEvents=require(_0x0c8d('0x0'));var events=[_0x0c8d('0x1'),'remove','update'];function createListener(_0x3edd56,_0x303807){return function(_0x42904a){_0x303807[_0x0c8d('0x2')](_0x3edd56,_0x42904a);};}function removeListener(_0x38c604,_0x7f0660){return function(){PluginEvents[_0x0c8d('0x3')](_0x38c604,_0x7f0660);};}exports['register']=function(_0x216b5c){for(var _0x284263=0x0,_0x2b61d9=events[_0x0c8d('0x4')];_0x284263<_0x2b61d9;_0x284263++){var _0x21d7cc=events[_0x284263];var _0x4427b5=createListener(_0x0c8d('0x5')+_0x21d7cc,_0x216b5c);PluginEvents['on'](_0x21d7cc,_0x4427b5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f6da1c2..a2a095e 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(_0x3deefb,_0x4d42df){var _0x4ed3ad=function(_0x397535){while(--_0x397535){_0x3deefb['push'](_0x3deefb['shift']());}};_0x4ed3ad(++_0x4d42df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x22047a,_0x17fb4e){var _0x18858c=function(_0x4b595a){while(--_0x4b595a){_0x22047a['push'](_0x22047a['shift']());}};_0x18858c(++_0x17fb4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 c9bc367..4ef3496 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 _0x5b02=['../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','catch','show','describe','params','create','body','script','join'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x5b02,0xe9));var _0x25b0=function(_0x3ad1fe,_0x49bd6d){_0x3ad1fe=_0x3ad1fe-0x0;var _0xb3bc29=_0x5b02[_0x3ad1fe];return _0xb3bc29;};'use strict';var _=require(_0x25b0('0x0'));var pm2=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var path=require('path');var exec=require('child_process')[_0x25b0('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3e1d20,_0x31c9c2){return function(_0x38dc14){if(!_0x38dc14){_0x3e1d20[_0x25b0('0x5')](0x194);;}return _0x38dc14;};}function respondWithResult(_0x2d84a9,_0x4eea55){_0x4eea55=_0x4eea55||0xc8;return function(_0x1d82c6){if(_0x1d82c6){return _0x2d84a9[_0x25b0('0x6')](_0x4eea55)['json'](_0x1d82c6);}return null;};}function handleError(_0x412954,_0x4d3e71){_0x4d3e71=_0x4d3e71||0x1f4;return function(_0x56feca){logger[_0x25b0('0x7')](_0x56feca[_0x25b0('0x8')]);if(_0x56feca[_0x25b0('0x9')]){delete _0x56feca['name'];}_0x412954[_0x25b0('0x6')](_0x4d3e71)[_0x25b0('0xa')](_0x56feca);};}function execChildProcess(){return new BPromise(function(_0x135afb,_0x250d31){exec(_0x25b0('0xb'),function(_0x2f57af,_0x44afbc,_0x10c3fb){logger[_0x25b0('0xc')](_0x44afbc);logger[_0x25b0('0xc')](_0x10c3fb);if(_0x2f57af){logger[_0x25b0('0x7')](_0x2f57af);return _0x250d31(_0x2f57af);}return _0x135afb(_0x44afbc);});});}exports[_0x25b0('0xd')]=function(_0x2048dc,_0x3655c2){return pm2[_0x25b0('0xe')]()[_0x25b0('0xf')](function(_0x293203){if(_0x293203){var _0x211658=_[_0x25b0('0x10')](_0x293203,function(_0x3b89e7){return _0x3b89e7[_0x25b0('0x9')]==='express'||_0x3b89e7['name']===_0x25b0('0x11');});return{'rows':_0x211658,'count':_0x211658['length']};}return null;})[_0x25b0('0xf')](respondWithResult(_0x3655c2,null))[_0x25b0('0x12')](handleError(_0x3655c2,null));};exports[_0x25b0('0x13')]=function(_0x3267b9,_0x5e3a3a){return pm2[_0x25b0('0x14')](_0x3267b9[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x5e3a3a,null))[_0x25b0('0xf')](handleEntityNotFound(_0x5e3a3a,null))[_0x25b0('0x12')](handleError(_0x5e3a3a,null));};exports[_0x25b0('0x16')]=function(_0x54f458,_0x348d36){if(_0x54f458[_0x25b0('0x17')][_0x25b0('0x9')]&&_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]){var _0xea4162=path[_0x25b0('0x19')](__dirname,_0x25b0('0x1a'),_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]);var _0x2b2eda=process[_0x25b0('0x1b')]();process['chdir'](path[_0x25b0('0x1c')](_0xea4162));return execChildProcess()[_0x25b0('0xf')](function(_0x517ec5){process[_0x25b0('0x1d')](_0x2b2eda);return pm2[_0x25b0('0x1e')]({'name':_0x54f458[_0x25b0('0x17')]['name'],'script':_0xea4162});})['then'](function(_0x50089e){pm2[_0x25b0('0x1f')]();return _0x50089e[0x0];})[_0x25b0('0xf')](respondWithResult(_0x348d36,0xc9))[_0x25b0('0x12')](handleError(_0x348d36,null));}else{return _0x348d36[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x20')});}};exports[_0x25b0('0x21')]=function(_0x75ce7a,_0x22e024){if(_0x75ce7a['body']['id']){delete _0x75ce7a[_0x25b0('0x17')]['id'];}var _0xbfba84={'online':'restart','stopped':'stop'};if(_0xbfba84['hasOwnProperty'](_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')])){return pm2[_0xbfba84[_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')]]](_0x75ce7a[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x22e024,0xc8))[_0x25b0('0x12')](handleError(_0x22e024,null));}else{return _0x22e024[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x22')});}};exports[_0x25b0('0x23')]=function(_0x3161c1,_0x1ea374){if(_0x3161c1['body']['id']){delete _0x3161c1['body']['id'];}if(_0x3161c1[_0x25b0('0x15')]['id']){return pm2['delete'](_0x3161c1['params']['id'])[_0x25b0('0xf')](function(_0x419975){pm2[_0x25b0('0x1f')]();return _0x419975[0x0];})[_0x25b0('0xf')](respondWithResult(_0x1ea374,null))[_0x25b0('0x12')](handleError(_0x1ea374,null));}else{return _0x1ea374['status'](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x24')});}}; \ No newline at end of file +var _0xb43b=['stack','name','send','npm\x20install','info','index','list','express','then','describe','catch','create','body','script','join','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','bluebird','status','json'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2ff44c,_0x30ff42){_0x2ff44c=_0x2ff44c-0x0;var _0x3e0564=_0xb43b[_0x2ff44c];return _0x3e0564;};'use strict';var _=require(_0xbb43('0x0'));var pm2=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var path=require(_0xbb43('0x3'));var exec=require(_0xbb43('0x4'))['exec'];var BPromise=require(_0xbb43('0x5'));function handleEntityNotFound(_0x41aff6,_0x351254){return function(_0x16432a){if(!_0x16432a){_0x41aff6['sendStatus'](0x194);;}return _0x16432a;};}function respondWithResult(_0x491fb9,_0x378df5){_0x378df5=_0x378df5||0xc8;return function(_0x553520){if(_0x553520){return _0x491fb9[_0xbb43('0x6')](_0x378df5)[_0xbb43('0x7')](_0x553520);}return null;};}function handleError(_0x2a2f11,_0x29ae1a){_0x29ae1a=_0x29ae1a||0x1f4;return function(_0x364718){logger['error'](_0x364718[_0xbb43('0x8')]);if(_0x364718[_0xbb43('0x9')]){delete _0x364718['name'];}_0x2a2f11[_0xbb43('0x6')](_0x29ae1a)[_0xbb43('0xa')](_0x364718);};}function execChildProcess(){return new BPromise(function(_0xd37cdf,_0x5e3611){exec(_0xbb43('0xb'),function(_0x2bef86,_0x480cc2,_0x36a473){logger[_0xbb43('0xc')](_0x480cc2);logger['info'](_0x36a473);if(_0x2bef86){logger['error'](_0x2bef86);return _0x5e3611(_0x2bef86);}return _0xd37cdf(_0x480cc2);});});}exports[_0xbb43('0xd')]=function(_0x4a3714,_0x593d0b){return pm2[_0xbb43('0xe')]()['then'](function(_0x68d45d){if(_0x68d45d){var _0x43021d=_['reject'](_0x68d45d,function(_0x4a6e18){return _0x4a6e18['name']===_0xbb43('0xf')||_0x4a6e18[_0xbb43('0x9')]==='motion2';});return{'rows':_0x43021d,'count':_0x43021d['length']};}return null;})[_0xbb43('0x10')](respondWithResult(_0x593d0b,null))['catch'](handleError(_0x593d0b,null));};exports['show']=function(_0x2b0797,_0x8242ab){return pm2[_0xbb43('0x11')](_0x2b0797['params']['id'])[_0xbb43('0x10')](respondWithResult(_0x8242ab,null))['then'](handleEntityNotFound(_0x8242ab,null))[_0xbb43('0x12')](handleError(_0x8242ab,null));};exports[_0xbb43('0x13')]=function(_0x4dfc54,_0x5d765b){if(_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')]&&_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x15')]){var _0x5bcce7=path[_0xbb43('0x16')](__dirname,'../../files/plugins',_0x4dfc54[_0xbb43('0x14')]['script']);var _0x2f5e31=process['cwd']();process[_0xbb43('0x17')](path[_0xbb43('0x18')](_0x5bcce7));return execChildProcess()['then'](function(_0x1d0768){process['chdir'](_0x2f5e31);return pm2[_0xbb43('0x19')]({'name':_0x4dfc54[_0xbb43('0x14')][_0xbb43('0x9')],'script':_0x5bcce7});})['then'](function(_0x53f0d5){pm2['dump']();return _0x53f0d5[0x0];})[_0xbb43('0x10')](respondWithResult(_0x5d765b,0xc9))[_0xbb43('0x12')](handleError(_0x5d765b,null));}else{return _0x5d765b['status'](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x1a')});}};exports[_0xbb43('0x1b')]=function(_0x3874fb,_0x4ed43f){if(_0x3874fb['body']['id']){delete _0x3874fb[_0xbb43('0x14')]['id'];}var _0x42800f={'online':_0xbb43('0x1c'),'stopped':_0xbb43('0x1d')};if(_0x42800f[_0xbb43('0x1e')](_0x3874fb[_0xbb43('0x14')][_0xbb43('0x6')])){return pm2[_0x42800f[_0x3874fb[_0xbb43('0x14')]['status']]](_0x3874fb[_0xbb43('0x1f')]['id'])['then'](respondWithResult(_0x4ed43f,0xc8))[_0xbb43('0x12')](handleError(_0x4ed43f,null));}else{return _0x4ed43f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x20')});}};exports['destroy']=function(_0x157d62,_0x547a6f){if(_0x157d62['body']['id']){delete _0x157d62['body']['id'];}if(_0x157d62[_0xbb43('0x1f')]['id']){return pm2['delete'](_0x157d62[_0xbb43('0x1f')]['id'])[_0xbb43('0x10')](function(_0xc577ac){pm2['dump']();return _0xc577ac[0x0];})[_0xbb43('0x10')](respondWithResult(_0x547a6f,null))[_0xbb43('0x12')](handleError(_0x547a6f,null));}else{return _0x547a6f[_0xbb43('0x6')](0x1f4)[_0xbb43('0xa')]({'message':_0xbb43('0x21')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3af1d8b..16bdea8 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 _0x1a3b=['../../components/auth/service','get','/queues','isAuthenticated','getQueues','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a3b,0x83));var _0xb1a3=function(_0x3330e0,_0x21e2cd){_0x3330e0=_0x3330e0-0x0;var _0x5ee930=_0x1a3b[_0x3330e0];return _0x5ee930;};'use strict';var express=require(_0xb1a3('0x0'));var router=express[_0xb1a3('0x1')]();var auth=require(_0xb1a3('0x2'));var controller=require('./realtime.controller');router[_0xb1a3('0x3')](_0xb1a3('0x4'),auth[_0xb1a3('0x5')](),controller[_0xb1a3('0x6')]);module['exports']=router; \ No newline at end of file +var _0x1a38=['getQueues','exports','express','Router','../../components/auth/service','isAuthenticated'];(function(_0x4ec35c,_0x39fef7){var _0xb08f9e=function(_0x90e408){while(--_0x90e408){_0x4ec35c['push'](_0x4ec35c['shift']());}};_0xb08f9e(++_0x39fef7);}(_0x1a38,0xb0));var _0x81a3=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0x1a38[_0x4fa438];return _0x4e3958;};'use strict';var express=require(_0x81a3('0x0'));var router=express[_0x81a3('0x1')]();var auth=require(_0x81a3('0x2'));var controller=require('./realtime.controller');router['get']('/queues',auth[_0x81a3('0x3')](),controller[_0x81a3('0x4')]);module[_0x81a3('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 204a858..ec9221f 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 _0x6d11=['predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','loggedInDb','pTalking','agents','find','pick','getAgents','online','getMembers','UserId','User','Pause','findAll','QueueId','all','rows','util','lodash','jayson/promise','../../config/logger','../../mysqldb','client','http','offset','undefined','count','limit','status','set','Content-Range','json','error','stack','name','send','getQueues','mail','chat','openchannel','fax','then','channel','includes','query','toLowerCase','startCase','Queue','map','rawAttributes','type','key','getOptions','user','role','userProfileId','voice','outbound','QueueCampaigns','Queues','UserProfile','getResources','findAndCountAll','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable'];(function(_0x36ed6c,_0x302b25){var _0x13a7e4=function(_0x429a79){while(--_0x429a79){_0x36ed6c['push'](_0x36ed6c['shift']());}};_0x13a7e4(++_0x302b25);}(_0x6d11,0xbf));var _0x16d1=function(_0x16f2df,_0x23470a){_0x16f2df=_0x16f2df-0x0;var _0x5975f1=_0x6d11[_0x16f2df];return _0x5975f1;};'use strict';var util=require(_0x16d1('0x0'));var _=require(_0x16d1('0x1'));var jayson=require(_0x16d1('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x16d1('0x3'))('api');var db=require(_0x16d1('0x4'))['db'];var client=jayson[_0x16d1('0x5')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x16d1('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x46f7d7,_0x3eb9e2){return function(_0x38626d){if(_0x38626d){var _0x1009dc=typeof _0x3eb9e2[_0x16d1('0x7')]===_0x16d1('0x8')&&typeof _0x3eb9e2['limit']==='undefined';var _0x4fca47=_0x38626d[_0x16d1('0x9')];var _0xcfbb15=_0x1009dc?0x0:_0x3eb9e2[_0x16d1('0x7')];var _0x5a6abb=_0x1009dc?_0x38626d['count']:_0x3eb9e2[_0x16d1('0x7')]+_0x3eb9e2[_0x16d1('0xa')];var _0x159539;if(_0x5a6abb>=_0x4fca47){_0x5a6abb=_0x4fca47;_0x159539=0xc8;}else{_0x159539=0xce;}_0x46f7d7[_0x16d1('0xb')](_0x159539);return _0x46f7d7[_0x16d1('0xc')](_0x16d1('0xd'),_0xcfbb15+'-'+_0x5a6abb+'/'+_0x4fca47)[_0x16d1('0xe')](_0x38626d);}return null;};}function handleError(_0x256252,_0x4de260){_0x4de260=_0x4de260||0x1f4;return function(_0x32fa68){logger[_0x16d1('0xf')](_0x32fa68[_0x16d1('0x10')]);if(_0x32fa68[_0x16d1('0x11')]){delete _0x32fa68[_0x16d1('0x11')];}_0x256252['status'](_0x4de260)[_0x16d1('0x12')](_0x32fa68);};}exports[_0x16d1('0x13')]=function(_0x29dddb,_0x46fcd0){var _0x29ebba=[_0x16d1('0x14'),_0x16d1('0x15'),'sms',_0x16d1('0x16'),_0x16d1('0x17'),'whatsapp','voice'];var _0x1a9ec8={'count':0x0,'rows':[]},_0x47c245={},_0x46a25e;Promise['resolve']()[_0x16d1('0x18')](function(){if(_0x29dddb['query'][_0x16d1('0x19')]){if(!_[_0x16d1('0x1a')](_0x29ebba,_0x29dddb['query']['channel']['toLowerCase']()))throw new Error('Invalid\x20channel');_0x46a25e=_0x29dddb[_0x16d1('0x1b')]['channel'][_0x16d1('0x1c')]();}var _0x7887d5=_[_0x16d1('0x1d')](_0x46a25e)+_0x16d1('0x1e');var _0x54b3a6=_[_0x16d1('0x1f')](db[_0x7887d5][_0x16d1('0x20')],function(_0x2a897d){return{'name':_0x2a897d['fieldName'],'type':_0x2a897d[_0x16d1('0x21')][_0x16d1('0x22')]};});_0x47c245=qs[_0x16d1('0x23')](_0x54b3a6,_0x29dddb);if(_0x29dddb[_0x16d1('0x24')][_0x16d1('0x25')]===_0x16d1('0x24')){var _0x32f362={'params':{'id':_0x29dddb[_0x16d1('0x24')][_0x16d1('0x26')]},'query':{'section':_0x46a25e===_0x16d1('0x27')&&_0x29dddb[_0x16d1('0x1b')][_0x16d1('0x21')]===_0x16d1('0x28')?_0x16d1('0x29'):_[_0x16d1('0x1d')](_0x46a25e)+_0x16d1('0x2a'),'type':_0x29dddb['query'][_0x16d1('0x21')],'nolimit':!![],'sort':_0x16d1('0x11'),'filter':_0x29dddb[_0x16d1('0x1b')]['filter']}};return db[_0x16d1('0x2b')][_0x16d1('0x2c')](_0x32f362);}return db[_0x7887d5][_0x16d1('0x2d')](_0x47c245);})[_0x16d1('0x18')](function(_0x6396fc){_0x1a9ec8[_0x16d1('0x9')]=_0x6396fc[_0x16d1('0x9')];var _0x562908=_0x46a25e===_0x16d1('0x27')?client:routingClient;return _0x562908[_0x16d1('0x2e')](_[_0x16d1('0x1d')](_0x46a25e)+_0x16d1('0x2a'),_0x29dddb)['then'](function(_0x4b27f6){if(_0x4b27f6[_0x16d1('0xf')])throw new Error(util[_0x16d1('0x2f')](_0x16d1('0x30'),_0x46a25e));var _0x3adbb1=_0x4b27f6[_0x16d1('0x31')];var _0x2b4dbd=[_0x16d1('0x32'),_0x16d1('0x33'),_0x16d1('0x34'),_0x16d1('0x35'),_0x16d1('0x36')];if(_0x46a25e===_0x16d1('0x27')&&_0x29dddb[_0x16d1('0x1b')][_0x16d1('0x21')]==='outbound'){_0x2b4dbd[_0x16d1('0x37')]('pTalking',_0x16d1('0x38'),_0x16d1('0x39'),_0x16d1('0x3a'),_0x16d1('0x3b'),_0x16d1('0x3c'),_0x16d1('0x3d'),'startProgressive','erlangCalls','erlangCallToSecond',_0x16d1('0x3e'),_0x16d1('0x3f'),_0x16d1('0x40'),_0x16d1('0x41'),'dialPredictiveIntervalMinThreshold',_0x16d1('0x42'),_0x16d1('0x43'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x16d1('0x44'),_0x16d1('0x45'));}var _0x186bce=_0x6396fc['rows'][_0x16d1('0x1f')](function(_0x1ab305){var _0x2928ad=_0x1ab305[_0x16d1('0x46')]({'plain':!![]});_0x2928ad[_0x16d1('0x36')]=0x0;_0x2928ad[_0x16d1('0x47')]=0x0;_0x2928ad[_0x16d1('0x32')]=0x0;_0x2928ad['available']=0x0;_0x2928ad['paused']=0x0;_0x2928ad['waiting']=0x0;if(_0x46a25e===_0x16d1('0x27')){_0x2928ad[_0x16d1('0x35')]=0x0;if(_0x29dddb[_0x16d1('0x1b')][_0x16d1('0x21')]===_0x16d1('0x28')){_0x2928ad[_0x16d1('0x48')]=0x0;_0x2928ad[_0x16d1('0x38')]=0x0;}}_0x2928ad[_0x16d1('0x49')]=[];var _0x5a14b7=_[_0x16d1('0x4a')](_0x3adbb1['rows'],['id',_0x2928ad['id']]);if(_0x5a14b7)_['merge'](_0x2928ad,_[_0x16d1('0x4b')](_0x5a14b7,_0x2b4dbd));if(_0x46a25e===_0x16d1('0x27')){return _0x1ab305[_0x16d1('0x4c')]({'attributes':['id',_0x16d1('0x11'),_0x16d1('0x4d')],'joinTableAttributes':[],'raw':!![]})[_0x16d1('0x18')](function(_0x504145){return _0x1ab305[_0x16d1('0x4e')]({'raw':!![]})['then'](function(_0x4833f7){for(var _0x538dbb=0x0;_0x538dbb<_0x504145['length'];_0x538dbb++){var _0x196d2f=_[_0x16d1('0x4a')](_0x4833f7,[_0x16d1('0x4f'),_0x504145[_0x538dbb]['id']]);var _0x1eb761={'id':_0x504145[_0x538dbb]['id'],'name':_0x504145[_0x538dbb]['name'],'online':Boolean(_0x504145[_0x538dbb][_0x16d1('0x4d')]),'paused':_0x196d2f?Boolean(_0x196d2f['paused']):![]};if(_0x1eb761[_0x16d1('0x4d')])_0x2928ad[_0x16d1('0x47')]++;if(_0x1eb761[_0x16d1('0x36')])_0x2928ad[_0x16d1('0x36')]++;_0x2928ad[_0x16d1('0x49')][_0x16d1('0x37')](_0x1eb761);}return _0x2928ad;});});}else{var _0x122307=_0x16d1('0x50')+_[_0x16d1('0x1d')](_0x46a25e)+_0x16d1('0x1e');var _0x294f08=_0x46a25e+_0x16d1('0x51');return db[_0x122307][_0x16d1('0x52')]({'where':{[_[_0x16d1('0x1d')](_0x46a25e)+_0x16d1('0x53')]:_0x1ab305['id']},'raw':!![]})['then'](function(_0x56b2f5){return db[_0x16d1('0x50')][_0x16d1('0x52')]({'attributes':['id',_0x16d1('0x11'),_0x16d1('0x4d'),_0x294f08],'where':{'id':_[_0x16d1('0x1f')](_0x56b2f5,_0x16d1('0x4f')),'role':'agent'},'raw':!![]});})[_0x16d1('0x18')](function(_0x2481a3){for(var _0x2a72c6=0x0;_0x2a72c6<_0x2481a3['length'];_0x2a72c6++){var _0x4c0c15={'id':_0x2481a3[_0x2a72c6]['id'],'name':_0x2481a3[_0x2a72c6][_0x16d1('0x11')],'online':Boolean(_0x2481a3[_0x2a72c6][_0x16d1('0x4d')]),'paused':Boolean(_0x2481a3[_0x2a72c6][_0x294f08])};if(_0x4c0c15['online'])_0x2928ad[_0x16d1('0x47')]++;if(_0x4c0c15['paused'])_0x2928ad[_0x16d1('0x36')]++;_0x2928ad[_0x16d1('0x49')][_0x16d1('0x37')](_0x4c0c15);}return _0x2928ad;});}});return Promise[_0x16d1('0x54')](_0x186bce);});})['then'](function(_0x5710c2){_0x1a9ec8[_0x16d1('0x55')]=_0x5710c2;return _0x1a9ec8;})[_0x16d1('0x18')](respondWithFilteredResult(_0x46fcd0,_0x47c245))['catch'](handleError(_0x46fcd0,null));}; \ No newline at end of file +var _0x1883=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','set','error','stack','name','mail','chat','sms','openchannel','fax','whatsapp','resolve','then','query','channel','includes','toLowerCase','startCase','map','rawAttributes','fieldName','type','getOptions','user','userProfileId','voice','outbound','QueueCampaigns','Queues','filter','UserProfile','getResources','findAndCountAll','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','originated','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedInDb','agents','find','merge','online','getMembers','UserId','User','Queue','Pause','QueueId','findAll','agent','all','util','lodash','jayson/promise'];(function(_0x1bb560,_0xeae53f){var _0x41416f=function(_0x4e3965){while(--_0x4e3965){_0x1bb560['push'](_0x1bb560['shift']());}};_0x41416f(++_0xeae53f);}(_0x1883,0xab));var _0x3188=function(_0x95b13b,_0x3f3a8e){_0x95b13b=_0x95b13b-0x0;var _0x4d78ef=_0x1883[_0x95b13b];return _0x4d78ef;};'use strict';var util=require(_0x3188('0x0'));var _=require(_0x3188('0x1'));var jayson=require(_0x3188('0x2'));var qs=require(_0x3188('0x3'));var logger=require(_0x3188('0x4'))(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var client=jayson[_0x3188('0x7')][_0x3188('0x8')]({'port':0x232a});var routingClient=jayson[_0x3188('0x7')][_0x3188('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x345612,_0x408ae0){return function(_0x33b62d){if(_0x33b62d){var _0x24f2f1=typeof _0x408ae0[_0x3188('0x9')]===_0x3188('0xa')&&typeof _0x408ae0['limit']===_0x3188('0xa');var _0x2a2f07=_0x33b62d['count'];var _0x2213b5=_0x24f2f1?0x0:_0x408ae0['offset'];var _0xc6040=_0x24f2f1?_0x33b62d[_0x3188('0xb')]:_0x408ae0[_0x3188('0x9')]+_0x408ae0[_0x3188('0xc')];var _0x5b968e;if(_0xc6040>=_0x2a2f07){_0xc6040=_0x2a2f07;_0x5b968e=0xc8;}else{_0x5b968e=0xce;}_0x345612[_0x3188('0xd')](_0x5b968e);return _0x345612[_0x3188('0xe')]('Content-Range',_0x2213b5+'-'+_0xc6040+'/'+_0x2a2f07)['json'](_0x33b62d);}return null;};}function handleError(_0x339b4a,_0x45e94e){_0x45e94e=_0x45e94e||0x1f4;return function(_0x20fef6){logger[_0x3188('0xf')](_0x20fef6[_0x3188('0x10')]);if(_0x20fef6[_0x3188('0x11')]){delete _0x20fef6['name'];}_0x339b4a[_0x3188('0xd')](_0x45e94e)['send'](_0x20fef6);};}exports['getQueues']=function(_0x1b8a18,_0x53668b){var _0x54a87f=[_0x3188('0x12'),_0x3188('0x13'),_0x3188('0x14'),_0x3188('0x15'),_0x3188('0x16'),_0x3188('0x17'),'voice'];var _0x19cc72={'count':0x0,'rows':[]},_0x1c3598={},_0x3f5b35;Promise[_0x3188('0x18')]()[_0x3188('0x19')](function(){if(_0x1b8a18[_0x3188('0x1a')][_0x3188('0x1b')]){if(!_[_0x3188('0x1c')](_0x54a87f,_0x1b8a18['query'][_0x3188('0x1b')][_0x3188('0x1d')]()))throw new Error('Invalid\x20channel');_0x3f5b35=_0x1b8a18['query']['channel'][_0x3188('0x1d')]();}var _0x8b207=_[_0x3188('0x1e')](_0x3f5b35)+'Queue';var _0x48673c=_[_0x3188('0x1f')](db[_0x8b207][_0x3188('0x20')],function(_0x375077){return{'name':_0x375077[_0x3188('0x21')],'type':_0x375077[_0x3188('0x22')]['key']};});_0x1c3598=qs[_0x3188('0x23')](_0x48673c,_0x1b8a18);if(_0x1b8a18[_0x3188('0x24')]['role']===_0x3188('0x24')){var _0x4be6c3={'params':{'id':_0x1b8a18['user'][_0x3188('0x25')]},'query':{'section':_0x3f5b35===_0x3188('0x26')&&_0x1b8a18[_0x3188('0x1a')][_0x3188('0x22')]===_0x3188('0x27')?_0x3188('0x28'):_[_0x3188('0x1e')](_0x3f5b35)+_0x3188('0x29'),'type':_0x1b8a18['query'][_0x3188('0x22')],'nolimit':!![],'sort':_0x3188('0x11'),'filter':_0x1b8a18['query'][_0x3188('0x2a')]}};return db[_0x3188('0x2b')][_0x3188('0x2c')](_0x4be6c3);}return db[_0x8b207][_0x3188('0x2d')](_0x1c3598);})[_0x3188('0x19')](function(_0x1f1c6f){_0x19cc72[_0x3188('0xb')]=_0x1f1c6f[_0x3188('0xb')];var _0x57c21c=_0x3f5b35===_0x3188('0x26')?client:routingClient;return _0x57c21c['request'](_[_0x3188('0x1e')](_0x3f5b35)+'Queues',_0x1b8a18)[_0x3188('0x19')](function(_0x80f9a8){if(_0x80f9a8[_0x3188('0xf')])throw new Error(util[_0x3188('0x2e')](_0x3188('0x2f'),_0x3f5b35));var _0x263892=_0x80f9a8[_0x3188('0x30')];var _0x279069=[_0x3188('0x31'),_0x3188('0x32'),_0x3188('0x33'),_0x3188('0x34'),_0x3188('0x35')];if(_0x3f5b35===_0x3188('0x26')&&_0x1b8a18[_0x3188('0x1a')][_0x3188('0x22')]===_0x3188('0x27')){_0x279069[_0x3188('0x36')]('pTalking',_0x3188('0x37'),'message',_0x3188('0x38'),_0x3188('0x39'),'Trunk',_0x3188('0x3a'),_0x3188('0x3b'),_0x3188('0x3c'),_0x3188('0x3d'),_0x3188('0x3e'),_0x3188('0x3f'),_0x3188('0x40'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x3188('0x41'),_0x3188('0x42'),_0x3188('0x43'),_0x3188('0x44'),'predictiveIntervalDroppedCallsCallersExit',_0x3188('0x45'),_0x3188('0x46'));}var _0x25ad4c=_0x1f1c6f[_0x3188('0x47')]['map'](function(_0x201ef2){var _0x4a290f=_0x201ef2[_0x3188('0x48')]({'plain':!![]});_0x4a290f['paused']=0x0;_0x4a290f[_0x3188('0x49')]=0x0;_0x4a290f[_0x3188('0x31')]=0x0;_0x4a290f[_0x3188('0x32')]=0x0;_0x4a290f[_0x3188('0x35')]=0x0;_0x4a290f[_0x3188('0x33')]=0x0;if(_0x3f5b35===_0x3188('0x26')){_0x4a290f[_0x3188('0x34')]=0x0;if(_0x1b8a18[_0x3188('0x1a')][_0x3188('0x22')]===_0x3188('0x27')){_0x4a290f['pTalking']=0x0;_0x4a290f[_0x3188('0x37')]=0x0;}}_0x4a290f[_0x3188('0x4a')]=[];var _0x10f676=_[_0x3188('0x4b')](_0x263892[_0x3188('0x47')],['id',_0x4a290f['id']]);if(_0x10f676)_[_0x3188('0x4c')](_0x4a290f,_['pick'](_0x10f676,_0x279069));if(_0x3f5b35===_0x3188('0x26')){return _0x201ef2['getAgents']({'attributes':['id',_0x3188('0x11'),_0x3188('0x4d')],'joinTableAttributes':[],'raw':!![]})[_0x3188('0x19')](function(_0x8f3756){return _0x201ef2[_0x3188('0x4e')]({'raw':!![]})['then'](function(_0x484eeb){for(var _0x59069f=0x0;_0x59069f<_0x8f3756['length'];_0x59069f++){var _0x4b9ed3=_[_0x3188('0x4b')](_0x484eeb,[_0x3188('0x4f'),_0x8f3756[_0x59069f]['id']]);var _0x3e5f90={'id':_0x8f3756[_0x59069f]['id'],'name':_0x8f3756[_0x59069f][_0x3188('0x11')],'online':Boolean(_0x8f3756[_0x59069f][_0x3188('0x4d')]),'paused':_0x4b9ed3?Boolean(_0x4b9ed3['paused']):![]};if(_0x3e5f90[_0x3188('0x4d')])_0x4a290f['loggedInDb']++;if(_0x3e5f90[_0x3188('0x35')])_0x4a290f[_0x3188('0x35')]++;_0x4a290f[_0x3188('0x4a')][_0x3188('0x36')](_0x3e5f90);}return _0x4a290f;});});}else{var _0x55bd61=_0x3188('0x50')+_[_0x3188('0x1e')](_0x3f5b35)+_0x3188('0x51');var _0x258741=_0x3f5b35+_0x3188('0x52');return db[_0x55bd61]['findAll']({'where':{[_['startCase'](_0x3f5b35)+_0x3188('0x53')]:_0x201ef2['id']},'raw':!![]})[_0x3188('0x19')](function(_0x59371c){return db[_0x3188('0x50')][_0x3188('0x54')]({'attributes':['id','name',_0x3188('0x4d'),_0x258741],'where':{'id':_[_0x3188('0x1f')](_0x59371c,_0x3188('0x4f')),'role':_0x3188('0x55')},'raw':!![]});})[_0x3188('0x19')](function(_0x5a3142){for(var _0x467ead=0x0;_0x467ead<_0x5a3142['length'];_0x467ead++){var _0x44f133={'id':_0x5a3142[_0x467ead]['id'],'name':_0x5a3142[_0x467ead][_0x3188('0x11')],'online':Boolean(_0x5a3142[_0x467ead][_0x3188('0x4d')]),'paused':Boolean(_0x5a3142[_0x467ead][_0x258741])};if(_0x44f133[_0x3188('0x4d')])_0x4a290f[_0x3188('0x49')]++;if(_0x44f133[_0x3188('0x35')])_0x4a290f[_0x3188('0x35')]++;_0x4a290f[_0x3188('0x4a')][_0x3188('0x36')](_0x44f133);}return _0x4a290f;});}});return Promise[_0x3188('0x56')](_0x25ad4c);});})[_0x3188('0x19')](function(_0x50c08d){_0x19cc72['rows']=_0x50c08d;return _0x19cc72;})[_0x3188('0x19')](respondWithFilteredResult(_0x53668b,_0x1c3598))['catch'](handleError(_0x53668b,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e110ba7..14af364 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x112147,_0x4e692e){var _0x3ba744=function(_0x191b87){while(--_0x191b87){_0x112147['push'](_0x112147['shift']());}};_0x3ba744(++_0x4e692e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3d52c8,_0x34c639){var _0x3e8ec5=function(_0x62a2a5){while(--_0x62a2a5){_0x3d52c8['push'](_0x3d52c8['shift']());}};_0x3e8ec5(++_0x34c639);}(_0x70e0,0x17b));var _0x070e=function(_0x4b8224,_0x1af4e9){_0x4b8224=_0x4b8224-0x0;var _0x5e71d3=_0x70e0[_0x4b8224];return _0x5e71d3;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 340d217..bb48ab0 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 _0x304b=['INTEGER','STRING','DATE','exports'];(function(_0x357761,_0x12c9f3){var _0x4d46ff=function(_0x59d673){while(--_0x59d673){_0x357761['push'](_0x357761['shift']());}};_0x4d46ff(++_0x12c9f3);}(_0x304b,0xfb));var _0xb304=function(_0x19324d,_0x38371a){_0x19324d=_0x19324d-0x0;var _0x209a7e=_0x304b[_0x19324d];return _0x209a7e;};'use strict';var Sequelize=require('sequelize');module[_0xb304('0x0')]={'state':{'type':Sequelize[_0xb304('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb304('0x2')]},'scheduledat':{'type':Sequelize[_0xb304('0x3')]},'uniqueid':{'type':Sequelize[_0xb304('0x2')]},'starttime':{'type':Sequelize[_0xb304('0x3')]},'responsetime':{'type':Sequelize[_0xb304('0x3')]},'ringtime':{'type':Sequelize[_0xb304('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb304('0x2')]}}; \ No newline at end of file +var _0xe55d=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x569e2c,_0x6ed3ef){var _0x4532c0=function(_0x20a395){while(--_0x20a395){_0x569e2c['push'](_0x569e2c['shift']());}};_0x4532c0(++_0x6ed3ef);}(_0xe55d,0x126));var _0xde55=function(_0x1f028b,_0xc09db){_0x1f028b=_0x1f028b-0x0;var _0x466807=_0xe55d[_0x1f028b];return _0x466807;};'use strict';var Sequelize=require(_0xde55('0x0'));module[_0xde55('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xde55('0x2')]},'scheduledat':{'type':Sequelize[_0xde55('0x3')]},'uniqueid':{'type':Sequelize[_0xde55('0x2')]},'starttime':{'type':Sequelize[_0xde55('0x3')]},'responsetime':{'type':Sequelize[_0xde55('0x3')]},'ringtime':{'type':Sequelize[_0xde55('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xde55('0x2')]},'membername':{'type':Sequelize[_0xde55('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 6194a97..1f943ae 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 _0xf1d7=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','path'];(function(_0x4e83c7,_0x18e84d){var _0x20c19f=function(_0x236467){while(--_0x236467){_0x4e83c7['push'](_0x4e83c7['shift']());}};_0x20c19f(++_0x18e84d);}(_0xf1d7,0x157));var _0x7f1d=function(_0x1fbc32,_0x12e1f3){_0x1fbc32=_0x1fbc32-0x0;var _0x5edcd6=_0xf1d7[_0x1fbc32];return _0x5edcd6;};'use strict';var _=require(_0x7f1d('0x0'));var util=require('util');var logger=require(_0x7f1d('0x1'))(_0x7f1d('0x2'));var moment=require(_0x7f1d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f1d('0x4'));var rimraf=require(_0x7f1d('0x5'));var config=require(_0x7f1d('0x6'));var attributes=require(_0x7f1d('0x7'));module[_0x7f1d('0x8')]=function(_0x29b5ce,_0x3080a7){return _0x29b5ce[_0x7f1d('0x9')](_0x7f1d('0xa'),attributes,{'tableName':_0x7f1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x188c=['request-promise','path','rimraf','../../config/environment','ReportAgentPreview','report_agent_preview','util','../../config/logger','moment'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0x188c,0x19b));var _0xc188=function(_0x5dca82,_0x136a46){_0x5dca82=_0x5dca82-0x0;var _0x403d5e=_0x188c[_0x5dca82];return _0x403d5e;};'use strict';var _=require('lodash');var util=require(_0xc188('0x0'));var logger=require(_0xc188('0x1'))('api');var moment=require(_0xc188('0x2'));var BPromise=require('bluebird');var rp=require(_0xc188('0x3'));var fs=require('fs');var path=require(_0xc188('0x4'));var rimraf=require(_0xc188('0x5'));var config=require(_0xc188('0x6'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x78f61f,_0x8cc1a1){return _0x78f61f['define'](_0xc188('0x7'),attributes,{'tableName':_0xc188('0x8'),'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 45ce72b..3f5a609 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 _0x60cd=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','bluebird'];(function(_0xd83287,_0x1a8c39){var _0x419937=function(_0x11841d){while(--_0x11841d){_0xd83287['push'](_0xd83287['shift']());}};_0x419937(++_0x1a8c39);}(_0x60cd,0x131));var _0xd60c=function(_0x2bdd09,_0x4627f7){_0x2bdd09=_0x2bdd09-0x0;var _0x2728a6=_0x60cd[_0x2bdd09];return _0x2728a6;};'use strict';var _=require(_0xd60c('0x0'));var util=require('util');var moment=require(_0xd60c('0x1'));var BPromise=require(_0xd60c('0x2'));var rs=require(_0xd60c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd60c('0x4'))['db'];var utils=require(_0xd60c('0x5'));var logger=require(_0xd60c('0x6'))(_0xd60c('0x7'));var config=require(_0xd60c('0x8'));var jayson=require(_0xd60c('0x9'));var client=jayson[_0xd60c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bfe41,_0x17bb05,_0x55b96f){return new BPromise(function(_0x19e368,_0x568d07){return client[_0xd60c('0xb')](_0x3bfe41,_0x55b96f)[_0xd60c('0xc')](function(_0x1501a3){logger['info'](_0xd60c('0xd'),_0x17bb05,_0xd60c('0xe'));logger[_0xd60c('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x17bb05,_0xd60c('0xe'),JSON[_0xd60c('0x10')](_0x1501a3));if(_0x1501a3[_0xd60c('0x11')]){if(_0x1501a3[_0xd60c('0x11')][_0xd60c('0x12')]===0x1f4){logger[_0xd60c('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x17bb05,_0x1501a3[_0xd60c('0x11')][_0xd60c('0x13')]);return _0x568d07(_0x1501a3[_0xd60c('0x11')][_0xd60c('0x13')]);}logger[_0xd60c('0x11')](_0xd60c('0xd'),_0x17bb05,_0x1501a3[_0xd60c('0x11')]['message']);return _0x19e368(_0x1501a3[_0xd60c('0x11')][_0xd60c('0x13')]);}else{logger[_0xd60c('0x14')](_0xd60c('0xd'),_0x17bb05,_0xd60c('0xe'));_0x19e368(_0x1501a3['result'][_0xd60c('0x13')]);}})[_0xd60c('0x15')](function(_0x5bfd5e){logger[_0xd60c('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x17bb05,_0x5bfd5e);_0x568d07(_0x5bfd5e);});});}exports[_0xd60c('0x16')]=function(_0x4c5b2c){var _0x11bdc1=this;return new Promise(function(_0x58f634,_0x3aab54){return db[_0xd60c('0x17')][_0xd60c('0x18')](_0x4c5b2c[_0xd60c('0x19')],{'raw':_0x4c5b2c[_0xd60c('0x1a')]?_0x4c5b2c[_0xd60c('0x1a')][_0xd60c('0x1b')]===undefined?!![]:![]:!![]})[_0xd60c('0xc')](function(_0x193fb3){logger[_0xd60c('0x14')](_0xd60c('0x16'),_0x4c5b2c);logger[_0xd60c('0xf')]('CreateReportAgentPreview',_0x4c5b2c,JSON[_0xd60c('0x10')](_0x193fb3));_0x58f634(_0x193fb3);})[_0xd60c('0x15')](function(_0x516ac3){logger[_0xd60c('0x11')](_0xd60c('0x16'),_0x516ac3[_0xd60c('0x13')],_0x4c5b2c);_0x3aab54(_0x11bdc1[_0xd60c('0x11')](0x1f4,_0x516ac3['message']));});});}; \ No newline at end of file +var _0x1fef=['then','info','request\x20sent','debug','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x1fef,0x142));var _0xf1fe=function(_0x59ad66,_0x1f1869){_0x59ad66=_0x59ad66-0x0;var _0xaaa5b8=_0x1fef[_0x59ad66];return _0xaaa5b8;};'use strict';var _=require(_0xf1fe('0x0'));var util=require('util');var moment=require(_0xf1fe('0x1'));var BPromise=require(_0xf1fe('0x2'));var rs=require(_0xf1fe('0x3'));var fs=require('fs');var Redis=require(_0xf1fe('0x4'));var db=require(_0xf1fe('0x5'))['db'];var utils=require(_0xf1fe('0x6'));var logger=require(_0xf1fe('0x7'))(_0xf1fe('0x8'));var config=require(_0xf1fe('0x9'));var jayson=require(_0xf1fe('0xa'));var client=jayson[_0xf1fe('0xb')][_0xf1fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x267cbe,_0x43ed77,_0x1f2283){return new BPromise(function(_0x10d562,_0x2e8161){return client[_0xf1fe('0xd')](_0x267cbe,_0x1f2283)[_0xf1fe('0xe')](function(_0x37d9aa){logger[_0xf1fe('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x43ed77,_0xf1fe('0x10'));logger[_0xf1fe('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x43ed77,_0xf1fe('0x10'),JSON[_0xf1fe('0x12')](_0x37d9aa));if(_0x37d9aa[_0xf1fe('0x13')]){if(_0x37d9aa[_0xf1fe('0x13')][_0xf1fe('0x14')]===0x1f4){logger[_0xf1fe('0x13')](_0xf1fe('0x15'),_0x43ed77,_0x37d9aa['error'][_0xf1fe('0x16')]);return _0x2e8161(_0x37d9aa[_0xf1fe('0x13')][_0xf1fe('0x16')]);}logger['error'](_0xf1fe('0x15'),_0x43ed77,_0x37d9aa[_0xf1fe('0x13')]['message']);return _0x10d562(_0x37d9aa[_0xf1fe('0x13')][_0xf1fe('0x16')]);}else{logger[_0xf1fe('0xf')](_0xf1fe('0x15'),_0x43ed77,_0xf1fe('0x10'));_0x10d562(_0x37d9aa['result'][_0xf1fe('0x16')]);}})[_0xf1fe('0x17')](function(_0x402e64){logger[_0xf1fe('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x43ed77,_0x402e64);_0x2e8161(_0x402e64);});});}exports[_0xf1fe('0x18')]=function(_0xc00ad3){var _0x54b582=this;return new Promise(function(_0x9d3797,_0x2372a9){return db['ReportAgentPreview'][_0xf1fe('0x19')](_0xc00ad3['body'],{'raw':_0xc00ad3['options']?_0xc00ad3[_0xf1fe('0x1a')][_0xf1fe('0x1b')]===undefined?!![]:![]:!![]})[_0xf1fe('0xe')](function(_0x330e02){logger[_0xf1fe('0xf')](_0xf1fe('0x18'),_0xc00ad3);logger[_0xf1fe('0x11')](_0xf1fe('0x18'),_0xc00ad3,JSON[_0xf1fe('0x12')](_0x330e02));_0x9d3797(_0x330e02);})[_0xf1fe('0x17')](function(_0x210120){logger['error'](_0xf1fe('0x18'),_0x210120['message'],_0xc00ad3);_0x2372a9(_0x54b582['error'](0x1f4,_0x210120[_0xf1fe('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d983d3b..6b3cb31 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 _0x93b3=['/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp'];(function(_0x50278a,_0x2a68e0){var _0xda665c=function(_0x1844c6){while(--_0x1844c6){_0x50278a['push'](_0x50278a['shift']());}};_0xda665c(++_0x2a68e0);}(_0x93b3,0x1ae));var _0x393b=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x93b3[_0x5712f8];return _0x14a364;};'use strict';var multer=require('multer');var util=require(_0x393b('0x0'));var path=require(_0x393b('0x1'));var express=require(_0x393b('0x2'));var router=express[_0x393b('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x393b('0x4'));router[_0x393b('0x5')](_0x393b('0x6'),auth[_0x393b('0x7')](),controller[_0x393b('0x8')]);router[_0x393b('0x5')](_0x393b('0x9'),auth[_0x393b('0x7')](),controller[_0x393b('0xa')]);router['get'](_0x393b('0xb'),auth[_0x393b('0x7')](),controller[_0x393b('0xc')]);router['get'](_0x393b('0xd'),auth['isAuthenticated'](),controller[_0x393b('0xe')]);router[_0x393b('0x5')](_0x393b('0xf'),auth[_0x393b('0x7')](),controller[_0x393b('0x10')]);router[_0x393b('0x5')]('/mail/queues',auth['isAuthenticated'](),controller[_0x393b('0x11')]);router[_0x393b('0x5')](_0x393b('0x12'),auth[_0x393b('0x7')](),controller[_0x393b('0x13')]);router[_0x393b('0x5')](_0x393b('0x14'),auth[_0x393b('0x7')](),controller['openchannelQueues']);router[_0x393b('0x5')](_0x393b('0x15'),auth[_0x393b('0x7')](),controller[_0x393b('0x16')]);router[_0x393b('0x5')](_0x393b('0x17'),auth[_0x393b('0x7')](),controller[_0x393b('0x18')]);router[_0x393b('0x5')](_0x393b('0x19'),auth[_0x393b('0x7')](),controller[_0x393b('0x1a')]);router[_0x393b('0x5')](_0x393b('0x1b'),auth[_0x393b('0x7')](),controller['voiceQueuesPreview']);router['get'](_0x393b('0x1c'),auth[_0x393b('0x7')](),controller[_0x393b('0x1d')]);router['get'](_0x393b('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0x393b('0x1f'),auth['isAuthenticated'](),controller[_0x393b('0x20')]);router[_0x393b('0x5')](_0x393b('0x21'),auth[_0x393b('0x7')](),controller[_0x393b('0x22')]);router[_0x393b('0x5')](_0x393b('0x23'),auth[_0x393b('0x7')](),controller[_0x393b('0x24')]);router[_0x393b('0x25')](_0x393b('0x23'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x393b('0x5')](_0x393b('0x26'),auth[_0x393b('0x7')](),controller[_0x393b('0x27')]);router[_0x393b('0x5')](_0x393b('0x28'),auth[_0x393b('0x7')](),controller[_0x393b('0x29')]);router[_0x393b('0x5')]('/agents',auth['isAuthenticated'](),controller[_0x393b('0x2a')]);router[_0x393b('0x25')](_0x393b('0x2b'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x393b('0x5')](_0x393b('0x2c'),auth[_0x393b('0x7')](),controller[_0x393b('0x2d')]);router['get'](_0x393b('0x2e'),auth[_0x393b('0x7')](),controller[_0x393b('0x2f')]);router[_0x393b('0x5')](_0x393b('0x30'),auth['isAuthenticated'](),controller['campaigns']);router[_0x393b('0x5')](_0x393b('0x31'),auth['isAuthenticated'](),controller[_0x393b('0x32')]);router[_0x393b('0x5')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x393b('0x33')]);router[_0x393b('0x5')](_0x393b('0x34'),auth[_0x393b('0x7')](),controller[_0x393b('0x35')]);router[_0x393b('0x5')](_0x393b('0x36'),auth[_0x393b('0x7')](),controller[_0x393b('0x37')]);router[_0x393b('0x5')](_0x393b('0x38'),auth[_0x393b('0x7')](),controller[_0x393b('0x39')]);router[_0x393b('0x5')](_0x393b('0x3a'),auth[_0x393b('0x7')](),controller[_0x393b('0x3b')]);router[_0x393b('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x393b('0x7')](),controller[_0x393b('0x3c')]);router['get'](_0x393b('0x3d'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x393b('0x3e')](_0x393b('0x3f'),auth['isAuthenticated'](),controller[_0x393b('0x40')](_0x393b('0x41')));router[_0x393b('0x5')](_0x393b('0x42'),auth['isAuthenticated'](),controller[_0x393b('0x43')]);router[_0x393b('0x3e')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('chat'));router[_0x393b('0x5')](_0x393b('0x44'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x393b('0x3e')](_0x393b('0x45'),auth[_0x393b('0x7')](),controller[_0x393b('0x40')](_0x393b('0x46')));router[_0x393b('0x5')](_0x393b('0x47'),auth[_0x393b('0x7')](),controller[_0x393b('0x48')]);router[_0x393b('0x3e')]('/openchannel/queues/:id/notify',auth[_0x393b('0x7')](),controller[_0x393b('0x40')](_0x393b('0x49')));router[_0x393b('0x5')](_0x393b('0x4a'),auth[_0x393b('0x7')](),controller[_0x393b('0x4b')]);router[_0x393b('0x3e')](_0x393b('0x4c'),auth[_0x393b('0x7')](),controller[_0x393b('0x40')](_0x393b('0x4d')));router[_0x393b('0x3e')](_0x393b('0x4e'),auth[_0x393b('0x7')](),controller[_0x393b('0x40')](_0x393b('0x4f')));router[_0x393b('0x5')](_0x393b('0x50'),auth[_0x393b('0x7')](),controller['showSmsQueues']);router['get'](_0x393b('0x51'),auth[_0x393b('0x7')](),controller[_0x393b('0x52')]);router[_0x393b('0x3e')](_0x393b('0x53'),auth[_0x393b('0x7')](),controller[_0x393b('0x54')]);module['exports']=router; \ No newline at end of file +var _0x4782=['get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0x4782,0xa8));var _0x2478=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x4782[_0x5a4400];return _0xf9b532;};'use strict';var multer=require(_0x2478('0x0'));var util=require(_0x2478('0x1'));var path=require(_0x2478('0x2'));var express=require(_0x2478('0x3'));var router=express[_0x2478('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x2478('0x5'));router[_0x2478('0x6')](_0x2478('0x7'),auth[_0x2478('0x8')](),controller[_0x2478('0x9')]);router[_0x2478('0x6')](_0x2478('0xa'),auth[_0x2478('0x8')](),controller['voiceChannelMixMonitor']);router[_0x2478('0x6')](_0x2478('0xb'),auth[_0x2478('0x8')](),controller[_0x2478('0xc')]);router[_0x2478('0x6')](_0x2478('0xd'),auth[_0x2478('0x8')](),controller[_0x2478('0xe')]);router['get'](_0x2478('0xf'),auth[_0x2478('0x8')](),controller[_0x2478('0x10')]);router['get']('/mail/queues',auth[_0x2478('0x8')](),controller['mailQueues']);router[_0x2478('0x6')](_0x2478('0x11'),auth[_0x2478('0x8')](),controller[_0x2478('0x12')]);router[_0x2478('0x6')](_0x2478('0x13'),auth[_0x2478('0x8')](),controller[_0x2478('0x14')]);router[_0x2478('0x6')]('/sms/queues',auth['isAuthenticated'](),controller[_0x2478('0x15')]);router[_0x2478('0x6')](_0x2478('0x16'),auth[_0x2478('0x8')](),controller[_0x2478('0x17')]);router[_0x2478('0x6')]('/fax/queues',auth[_0x2478('0x8')](),controller[_0x2478('0x18')]);router['get'](_0x2478('0x19'),auth[_0x2478('0x8')](),controller['voiceQueuesPreview']);router['get'](_0x2478('0x1a'),auth[_0x2478('0x8')](),controller[_0x2478('0x1b')]);router['get'](_0x2478('0x1c'),auth[_0x2478('0x8')](),controller['voiceQueuesChannel']);router[_0x2478('0x6')](_0x2478('0x1d'),auth[_0x2478('0x8')](),controller[_0x2478('0x1e')]);router[_0x2478('0x6')](_0x2478('0x1f'),auth[_0x2478('0x8')](),controller[_0x2478('0x20')]);router[_0x2478('0x6')](_0x2478('0x21'),auth[_0x2478('0x8')](),controller[_0x2478('0x22')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x2478('0x23')]);router[_0x2478('0x6')](_0x2478('0x24'),auth['isAuthenticated'](),controller[_0x2478('0x25')]);router['get'](_0x2478('0x26'),auth[_0x2478('0x8')](),controller[_0x2478('0x27')]);router[_0x2478('0x6')](_0x2478('0x28'),auth[_0x2478('0x8')](),controller[_0x2478('0x29')]);router[_0x2478('0x2a')]('/agents/:id/capacity',auth[_0x2478('0x8')](),controller[_0x2478('0x2b')]);router['get'](_0x2478('0x2c'),auth[_0x2478('0x8')](),controller[_0x2478('0x2d')]);router[_0x2478('0x6')](_0x2478('0x2e'),auth[_0x2478('0x8')](),controller[_0x2478('0x2f')]);router['get'](_0x2478('0x30'),auth[_0x2478('0x8')](),controller[_0x2478('0x31')]);router[_0x2478('0x6')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x2478('0x32')]);router[_0x2478('0x6')]('/chat/queues/waitinginteractions',auth[_0x2478('0x8')](),controller[_0x2478('0x33')]);router['get']('/mail/queues/waitinginteractions',auth[_0x2478('0x8')](),controller[_0x2478('0x34')]);router[_0x2478('0x6')](_0x2478('0x35'),auth[_0x2478('0x8')](),controller[_0x2478('0x36')]);router[_0x2478('0x6')](_0x2478('0x37'),auth['isAuthenticated'](),controller[_0x2478('0x38')]);router[_0x2478('0x6')](_0x2478('0x39'),auth[_0x2478('0x8')](),controller[_0x2478('0x3a')]);router[_0x2478('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x2478('0x8')](),controller[_0x2478('0x3b')]);router['get'](_0x2478('0x3c'),auth[_0x2478('0x8')](),controller[_0x2478('0x3d')]);router[_0x2478('0x3e')](_0x2478('0x3f'),auth[_0x2478('0x8')](),controller['queueNotify'](_0x2478('0x40')));router[_0x2478('0x6')](_0x2478('0x41'),auth[_0x2478('0x8')](),controller[_0x2478('0x42')]);router[_0x2478('0x3e')](_0x2478('0x43'),auth[_0x2478('0x8')](),controller[_0x2478('0x44')](_0x2478('0x45')));router['get'](_0x2478('0x46'),auth[_0x2478('0x8')](),controller[_0x2478('0x47')]);router[_0x2478('0x3e')](_0x2478('0x48'),auth[_0x2478('0x8')](),controller[_0x2478('0x44')](_0x2478('0x49')));router[_0x2478('0x6')](_0x2478('0x4a'),auth['isAuthenticated'](),controller[_0x2478('0x4b')]);router[_0x2478('0x3e')]('/openchannel/queues/:id/notify',auth[_0x2478('0x8')](),controller[_0x2478('0x44')](_0x2478('0x4c')));router[_0x2478('0x6')](_0x2478('0x4d'),auth[_0x2478('0x8')](),controller[_0x2478('0x4e')]);router[_0x2478('0x3e')](_0x2478('0x4f'),auth[_0x2478('0x8')](),controller['queueNotify'](_0x2478('0x50')));router['post'](_0x2478('0x51'),auth[_0x2478('0x8')](),controller[_0x2478('0x44')](_0x2478('0x52')));router[_0x2478('0x6')]('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x2478('0x6')]('/whatsapp/queues/:id',auth[_0x2478('0x8')](),controller[_0x2478('0x53')]);router['post'](_0x2478('0x54'),auth[_0x2478('0x8')](),controller[_0x2478('0x55')]);module[_0x2478('0x56')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 756f6ba..3ec416a 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 _0xdc97=['agents','Agents','agentCapacity','user','interaction','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Interaction','update','MessageId','From','TransferReport','create','Start','queue','*,*,*,*','channel','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','InteractionId','bluebird','moment','lodash','../../mysqldb','api','jayson/promise','http','client','request','then','error','code','message','json','sendStatus','name','status','send','isNil','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels'];(function(_0x3b8316,_0x2b570d){var _0x4a742d=function(_0x3ac987){while(--_0x3ac987){_0x3b8316['push'](_0x3b8316['shift']());}};_0x4a742d(++_0x2b570d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2dc16f,_0x1ec940){_0x2dc16f=_0x2dc16f-0x0;var _0x35a2a8=_0xdc97[_0x2dc16f];return _0x35a2a8;};'use strict';var BPromise=require(_0x7dc9('0x0'));var moment=require(_0x7dc9('0x1'));var _=require(_0x7dc9('0x2'));var util=require('util');var db=require(_0x7dc9('0x3'))['db'];var logger=require('../../config/logger')(_0x7dc9('0x4'));var jayson=require(_0x7dc9('0x5'));var amiClient=jayson['client'][_0x7dc9('0x6')]({'port':0x232a});var mailClient=jayson[_0x7dc9('0x7')][_0x7dc9('0x6')]({'port':0x232b});var routingClient=jayson[_0x7dc9('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){var _0x3318ea=_0x4b3229?_0x4b3229:amiClient;return _0x3318ea[_0x7dc9('0x8')](_0x2636ef,_0x4f91c7)[_0x7dc9('0x9')](function(_0x5ca05b){if(_0x5ca05b[_0x7dc9('0xa')]){if(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xb')]===0x1f4){return _0x23737d(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}return _0x2ff923(_0x5ca05b[_0x7dc9('0xa')][_0x7dc9('0xc')]);}else{_0x2ff923(_0x5ca05b['result']);}})['catch'](function(_0x4be1c8){_0x23737d(_0x4be1c8);});});}function respondWithResult(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xc8;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['status'](_0x94c75a)[_0x7dc9('0xd')](_0x14e5db);}return _0x599ef1[_0x7dc9('0xe')](0x194);};}function handleError(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0x1f4;return function(_0x31d43d){logger[_0x7dc9('0xa')](_0x31d43d['stack']);if(_0x31d43d[_0x7dc9('0xf')]){delete _0x31d43d[_0x7dc9('0xf')];}_0xaadf2[_0x7dc9('0x10')](_0xf37bc7)[_0x7dc9('0x11')](_0x31d43d);};}function findById(_0x11606f){return function(_0xbe0437){if(!_[_0x7dc9('0x12')](_0x11606f)&&!_[_0x7dc9('0x12')](_0xbe0437)&&!_[_0x7dc9('0x12')](_0xbe0437['rows'])){return _[_0x7dc9('0x13')](_0xbe0437['rows'],function(_0x1f5906){return _0x1f5906['id']==_0x11606f;});}return null;};}exports[_0x7dc9('0x14')]=function(_0x5d61d7,_0x41f66e){return respondWithRpcPromise(_0x7dc9('0x15'),_0x5d61d7[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x41f66e,null))[_0x7dc9('0x17')](handleError(_0x41f66e,null));};exports[_0x7dc9('0x18')]=function(_0x2dad65,_0x2895f5){return respondWithRpcPromise(_0x7dc9('0x19'),_[_0x7dc9('0x1a')](_0x2dad65['query'],_0x2dad65['params']))[_0x7dc9('0x9')](respondWithResult(_0x2895f5,null))[_0x7dc9('0x17')](handleError(_0x2895f5,null));};exports['voiceChannelStopMixMonitor']=function(_0x349001,_0x27f7fa){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x7dc9('0x1a')](_0x349001[_0x7dc9('0x16')],_0x349001[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x27f7fa,null))[_0x7dc9('0x17')](handleError(_0x27f7fa,null));};exports[_0x7dc9('0x1c')]=function(_0xf95336,_0x55a482){return respondWithRpcPromise('VoiceQueues',_0xf95336['query'])[_0x7dc9('0x9')](respondWithResult(_0x55a482,null))[_0x7dc9('0x17')](handleError(_0x55a482,null));};exports['showVoiceQueues']=function(_0x585eef,_0x47771b){return respondWithRpcPromise('VoiceQueues',_0x585eef[_0x7dc9('0x16')])[_0x7dc9('0x9')](findById(_0x585eef[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x47771b,null))[_0x7dc9('0x17')](handleError(_0x47771b,null));};exports[_0x7dc9('0x1d')]=function(_0x236d42,_0x229f8e){return respondWithRpcPromise(_0x7dc9('0x1e'),_[_0x7dc9('0x1a')](_0x236d42[_0x7dc9('0x1f')],_0x236d42[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x229f8e,null))['catch'](handleError(_0x229f8e,null));};exports['voiceQueuesPreview']=function(_0x49a4a5,_0x4a68f0){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x49a4a5['query'],_0x49a4a5[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4a68f0,null))[_0x7dc9('0x17')](handleError(_0x4a68f0,null));};exports[_0x7dc9('0x20')]=function(_0x3300ff,_0x154e22){return respondWithRpcPromise('VoiceQueuesChannels',_0x3300ff['query'])['then'](respondWithResult(_0x154e22,null))[_0x7dc9('0x17')](handleError(_0x154e22,null));};exports['voiceQueuesChannel']=function(_0x2b9ca0,_0x448e46){return respondWithRpcPromise(_0x7dc9('0x21'),_[_0x7dc9('0x1a')](_0x2b9ca0[_0x7dc9('0x16')],_0x2b9ca0[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x448e46,null))[_0x7dc9('0x17')](handleError(_0x448e46,null));};exports['voiceQueuesChannelHangup']=function(_0x2b56d7,_0x4cdec4){return respondWithRpcPromise(_0x7dc9('0x22'),_[_0x7dc9('0x1a')](_0x2b56d7[_0x7dc9('0x16')],_0x2b56d7[_0x7dc9('0x1b')]))['then'](respondWithResult(_0x4cdec4,null))[_0x7dc9('0x17')](handleError(_0x4cdec4,null));};exports['voiceQueuesChannelRedirect']=function(_0x289560,_0x4f47af){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x7dc9('0x1a')](_0x289560[_0x7dc9('0x16')],_0x289560[_0x7dc9('0x1b')]))[_0x7dc9('0x9')](respondWithResult(_0x4f47af,null))['catch'](handleError(_0x4f47af,null));};exports[_0x7dc9('0x23')]=function(_0x183d87,_0x138f33){return respondWithRpcPromise(_0x7dc9('0x24'),_0x183d87[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x138f33,null))[_0x7dc9('0x17')](handleError(_0x138f33,null));};exports[_0x7dc9('0x25')]=function(_0x166906,_0x21bcfc){return respondWithRpcPromise(_0x7dc9('0x26'),_0x166906[_0x7dc9('0x16')])['then'](respondWithResult(_0x21bcfc,null))[_0x7dc9('0x17')](handleError(_0x21bcfc,null));};exports[_0x7dc9('0x27')]=function(_0x466b02,_0xfd2612){var _0x4bcdce;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')])[_0x7dc9('0x9')](function(_0x3876b6){_0x4bcdce=_0x3876b6;return respondWithRpcPromise(_0x7dc9('0x28'),_0x466b02[_0x7dc9('0x16')],routingClient);})['then'](function(_0x553230){return _[_0x7dc9('0x1a')]({},_0x553230,_0x4bcdce);})[_0x7dc9('0x9')](respondWithResult(_0xfd2612,null))['catch'](handleError(_0xfd2612,null));};exports[_0x7dc9('0x29')]=function(_0x4a37ec,_0x315d65){if(_0x4a37ec[_0x7dc9('0x1f')]&&_0x4a37ec[_0x7dc9('0x1f')]['interaction']&&_0x4a37ec[_0x7dc9('0x2a')]&&_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]){for(var _0x95513c in _0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')]){if(_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x7dc9('0x2c')](_0x95513c)){db['MemberReport']['findAll']({'where':{'channel':_0x95513c,'membername':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')],'type':_0x7dc9('0x2d'),'exitAt':null,'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c]&&_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')]?{'$notIn':_0x4a37ec[_0x7dc9('0x1f')]['interaction'][_0x95513c]}:{'$ne':null}}})[_0x7dc9('0x9')](function(_0x1971c7){var _0x3c4d4c=moment()[_0x7dc9('0x2f')](_0x7dc9('0x30'));for(var _0x19957f=0x0,_0x575393=_0x1971c7[_0x7dc9('0x2e')];_0x19957f<_0x575393;_0x19957f+=0x1){_0x1971c7[_0x19957f][_0x7dc9('0x31')]({'exitAt':_0x3c4d4c});}});for(var _0x49bffe=0x0;_0x49bffe<_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x7dc9('0x2e')];_0x49bffe+=0x1){db['MemberReport'][_0x7dc9('0x32')]({'where':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'type':_0x7dc9('0x2d'),'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe],'exitAt':null},'defaults':{'channel':_0x95513c,'membername':_0x4a37ec['user']['name'],'interface':_[_0x7dc9('0x12')](_0x4a37ec['user'][_0x7dc9('0x33')])?util[_0x7dc9('0x2f')]('SIP/%s',_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0xf')]):_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x33')],'type':_0x7dc9('0x2d'),'enterAt':moment()[_0x7dc9('0x2f')](_0x7dc9('0x30')),'role':_0x7dc9('0x34'),'internal':_0x4a37ec[_0x7dc9('0x2a')][_0x7dc9('0x35')],'uniqueid':_0x4a37ec[_0x7dc9('0x1f')][_0x7dc9('0x2b')][_0x95513c][_0x49bffe]}});}}}}return respondWithRpcPromise(_0x7dc9('0x36'),{'id':_0x4a37ec['params']['id'],'capacity':_0x4a37ec[_0x7dc9('0x1f')]['capacity']},routingClient)['then'](respondWithResult(_0x315d65,null))[_0x7dc9('0x17')](handleError(_0x315d65,null));};exports[_0x7dc9('0x37')]=function(_0x40e382,_0x3902aa){return respondWithRpcPromise(_0x7dc9('0x38'),_0x40e382['query'])[_0x7dc9('0x9')](respondWithResult(_0x3902aa,null))[_0x7dc9('0x17')](handleError(_0x3902aa,null));};exports[_0x7dc9('0x39')]=function(_0x4a9b75,_0x341909){return respondWithRpcPromise(_0x7dc9('0x3a'),_0x4a9b75[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x341909,null))[_0x7dc9('0x17')](handleError(_0x341909,null));};exports[_0x7dc9('0x3b')]=function(_0x593132,_0x366b8b){return respondWithRpcPromise(_0x7dc9('0x3c'),_0x593132[_0x7dc9('0x16')])[_0x7dc9('0x9')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x17')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x3d')]=function(_0x31baf1,_0x24abb6){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x31baf1[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x24abb6,null))[_0x7dc9('0x17')](handleError(_0x24abb6,null));};exports['showChatQueues']=function(_0x1767b6,_0x39be46){return respondWithRpcPromise(_0x7dc9('0x3e'),_0x1767b6[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x1767b6['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x39be46,null))[_0x7dc9('0x17')](handleError(_0x39be46,null));};exports[_0x7dc9('0x3f')]=function(_0x17ed6c,_0x2a1db8){return respondWithRpcPromise(_0x7dc9('0x40'),_0x17ed6c['query'],routingClient)['then'](respondWithResult(_0x2a1db8,null))['catch'](handleError(_0x2a1db8,null));};exports[_0x7dc9('0x41')]=function(_0x3daf33,_0x32a64f){return respondWithRpcPromise(_0x7dc9('0x40'),_0x3daf33['query'],routingClient)['then'](findById(_0x3daf33[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x32a64f,null))[_0x7dc9('0x17')](handleError(_0x32a64f,null));};exports[_0x7dc9('0x42')]=function(_0x2caf7f,_0x2272ef){return respondWithRpcPromise(_0x7dc9('0x43'),_0x2caf7f['query'],mailClient)[_0x7dc9('0x9')](respondWithResult(_0x2272ef,null))[_0x7dc9('0x17')](handleError(_0x2272ef,null));};exports[_0x7dc9('0x44')]=function(_0x1dad95,_0x4683b3){return respondWithRpcPromise('OpenchannelQueues',_0x1dad95[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x4683b3,null))[_0x7dc9('0x17')](handleError(_0x4683b3,null));};exports[_0x7dc9('0x45')]=function(_0x2454d7,_0x3a93c4){return respondWithRpcPromise(_0x7dc9('0x46'),_0x2454d7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x2454d7[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0x3a93c4,null))[_0x7dc9('0x17')](handleError(_0x3a93c4,null));};exports[_0x7dc9('0x47')]=function(_0x5eee27,_0x3485b6){return respondWithRpcPromise('SmsQueues',_0x5eee27[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3485b6,null))['catch'](handleError(_0x3485b6,null));};exports[_0x7dc9('0x48')]=function(_0x24d2c7,_0x50e9a9){return respondWithRpcPromise(_0x7dc9('0x49'),_0x24d2c7[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x24d2c7['params']['id']))['then'](respondWithResult(_0x50e9a9,null))[_0x7dc9('0x17')](handleError(_0x50e9a9,null));};exports[_0x7dc9('0x4a')]=function(_0x4ed60e,_0x3aba59){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x4ed60e[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3aba59,null))[_0x7dc9('0x17')](handleError(_0x3aba59,null));};exports[_0x7dc9('0x4c')]=function(_0x51b834,_0x35f31e){return respondWithRpcPromise(_0x7dc9('0x4b'),_0x51b834[_0x7dc9('0x16')],routingClient)['then'](findById(_0x51b834['params']['id']))[_0x7dc9('0x9')](respondWithResult(_0x35f31e,null))[_0x7dc9('0x17')](handleError(_0x35f31e,null));};exports[_0x7dc9('0x4d')]=function(_0x2cf485,_0x59f3bd){return respondWithRpcPromise('FaxQueues',_0x2cf485[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x59f3bd,null))[_0x7dc9('0x17')](handleError(_0x59f3bd,null));};exports[_0x7dc9('0x4e')]=function(_0x5d211b,_0xea1728){return respondWithRpcPromise(_0x7dc9('0x4f'),_0x5d211b[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](findById(_0x5d211b[_0x7dc9('0x1b')]['id']))[_0x7dc9('0x9')](respondWithResult(_0xea1728,null))[_0x7dc9('0x17')](handleError(_0xea1728,null));};exports['faxAccounts']=function(_0x2d7c33,_0x2cde0c){return respondWithRpcPromise('FaxAccounts',_0x2d7c33['query'])[_0x7dc9('0x9')](respondWithResult(_0x2cde0c,null))['catch'](handleError(_0x2cde0c,null));};exports[_0x7dc9('0x50')]=function(_0x466602,_0xd99a2){return respondWithRpcPromise(_0x7dc9('0x51'),_0x466602[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0xd99a2,null))[_0x7dc9('0x17')](handleError(_0xd99a2,null));};exports[_0x7dc9('0x52')]=function(_0x25f970,_0x30ce2f){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x25f970[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x30ce2f,null))[_0x7dc9('0x17')](handleError(_0x30ce2f,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x45c1b3,_0x585e42){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x45c1b3[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x585e42,null))['catch'](handleError(_0x585e42,null));};exports[_0x7dc9('0x53')]=function(_0x533738,_0x5a585a){return respondWithRpcPromise(_0x7dc9('0x54'),_0x533738[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](function(_0xb8be9){if(_0x533738['query'][_0x7dc9('0x55')]!==undefined){var _0xe944a4=_(_0xb8be9[_0x7dc9('0x56')])[_0x7dc9('0x57')]([_0x533738[_0x7dc9('0x16')][_0x7dc9('0x55')],_0x533738[_0x7dc9('0x1b')]['id']])[_0x7dc9('0x58')]('queue_id')['uniq']()[_0x7dc9('0x59')]();return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x1da142){return _0xe944a4[_0x7dc9('0x5a')](_0x1da142[_0x7dc9('0x5b')])>-0x1;});}else{return _0xb8be9['rows'][_0x7dc9('0x57')](function(_0x51a7e5){return _0x51a7e5['queue_id']===parseInt(_0x533738[_0x7dc9('0x1b')]['id']);});}})[_0x7dc9('0x9')](respondWithResult(_0x5a585a,null))[_0x7dc9('0x17')](handleError(_0x5a585a,null));};exports[_0x7dc9('0x5c')]=function(_0x5bc1c3,_0x2c3434){return respondWithRpcPromise(_0x7dc9('0x5d'),_0x5bc1c3['query'],routingClient)['then'](respondWithResult(_0x2c3434,null))[_0x7dc9('0x17')](handleError(_0x2c3434,null));};exports[_0x7dc9('0x5e')]=function(_0x49d7ef,_0x114078){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x49d7ef[_0x7dc9('0x16')],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x114078,null))[_0x7dc9('0x17')](handleError(_0x114078,null));};exports['faxQueuesWaitingInteractions']=function(_0x33d68c,_0x3c7daf){return respondWithRpcPromise(_0x7dc9('0x5f'),_0x33d68c['query'],routingClient)[_0x7dc9('0x9')](respondWithResult(_0x3c7daf,null))['catch'](handleError(_0x3c7daf,null));};exports['queueNotify']=function(_0xa899){return function(_0x26244a,_0x31faa4){var _0x3657b6,_0x26d94e;var _0x56a00d=_[_0x7dc9('0x60')](_0xa899);var _0x1daf80=_0xa899===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x56a00d+'Queue'][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x26244a[_0x7dc9('0x1b')]['id']}})[_0x7dc9('0x9')](function(_0x200df7){if(_['isNil'](_0x200df7)){throw new Error(_0x56a00d+_0x7dc9('0x65'));}_0x3657b6=_0x200df7;return db[_0x56a00d+'Message']['findOne']({'where':{'id':_0x26244a[_0x7dc9('0x1f')]['messageId']},'include':[{'model':db[_0x56a00d+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x56a00d+_0x1daf80],'as':_0x7dc9('0x63')}]});})[_0x7dc9('0x9')](function(_0x38dccc){if(_[_0x7dc9('0x12')](_0x38dccc)){throw new Error(_0x56a00d+'\x20Message\x20not\x20found');}_0x26d94e=_0x38dccc;return _0x38dccc[_0x7dc9('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x1a4bfb={'uniqueid':_0xa899+'.'+_0x26d94e['id']+'.'+_0x26d94e[_0x7dc9('0x66')]['id'],'FromUserId':_0x26244a[_0x7dc9('0x2a')]['id'],'type':'queue'};_0x1a4bfb[_0x56a00d+_0x7dc9('0x68')]=_0x26d94e['id'];_0x1a4bfb[_0x56a00d+'InteractionId']=_0x26d94e[_0x7dc9('0x66')]['id'];_0x1a4bfb[_0x7dc9('0x69')+_0x56a00d+_0x1daf80+'Id']=_0x26d94e[_0x7dc9('0x63')]['id'];_0x1a4bfb['To'+_0x56a00d+'QueueId']=_0x3657b6['id'];return db[_0x56a00d+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x1a4bfb);})['then'](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0xa899,'interaction':_0x26d94e[_0x7dc9('0x66')],'message':_0x26d94e,'account':_0x26d94e[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x6d'),'appdata':_0x3657b6['name']+','+(_0x26d94e[_0x7dc9('0x63')]['queueTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})[_0x7dc9('0x9')](respondWithResult(_0x31faa4,null))[_0x7dc9('0x17')](handleError(_0x31faa4,null));};};exports['agentNotify']=function(_0x160bf0,_0x4588a7){var _0x23da2e,_0x568705;if(_['isNil'](_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x573fa9=_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x6f')];var _0x5f3487=_[_0x7dc9('0x60')](_0x573fa9);var _0x5a44a1=_0x573fa9===_0x7dc9('0x61')?_0x7dc9('0x62'):_0x7dc9('0x63');return db[_0x7dc9('0x70')][_0x7dc9('0x64')]({'raw':!![],'where':{'id':_0x160bf0[_0x7dc9('0x1b')]['id'],'role':'agent'}})[_0x7dc9('0x9')](function(_0x3fb268){if(_[_0x7dc9('0x12')](_0x3fb268)){throw new Error(_0x7dc9('0x71'));}_0x23da2e=_0x3fb268;return db[_0x5f3487+_0x7dc9('0x72')]['findOne']({'where':{'id':_0x160bf0[_0x7dc9('0x1f')][_0x7dc9('0x73')]},'include':[{'model':db[_0x5f3487+_0x7dc9('0x66')],'as':_0x7dc9('0x66')},{'model':db[_0x5f3487+_0x5a44a1],'as':'Account'}]});})[_0x7dc9('0x9')](function(_0x54bd64){if(_['isNil'](_0x54bd64)){throw new Error(_0x5f3487+_0x7dc9('0x74'));}_0x568705=_0x54bd64;return _0x54bd64['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7dc9('0x9')](function(){var _0x19c880={'uniqueid':_0x573fa9+'.'+_0x568705['id']+'.'+_0x568705[_0x7dc9('0x66')]['id'],'FromUserId':_0x160bf0[_0x7dc9('0x2a')]['id'],'type':_0x7dc9('0x6d'),'ToUserId':_0x23da2e['id']};_0x19c880[_0x5f3487+_0x7dc9('0x68')]=_0x568705['id'];_0x19c880[_0x5f3487+_0x7dc9('0x75')]=_0x568705[_0x7dc9('0x66')]['id'];_0x19c880['From'+_0x5f3487+_0x5a44a1+'Id']=_0x568705[_0x7dc9('0x63')]['id'];return db[_0x5f3487+_0x7dc9('0x6a')][_0x7dc9('0x6b')](_0x19c880);})[_0x7dc9('0x9')](function(){return respondWithRpcPromise(_0x7dc9('0x6c'),{'channel':_0x573fa9,'interaction':_0x568705['Interaction'],'message':_0x568705,'account':_0x568705[_0x7dc9('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7dc9('0x34'),'appdata':_0x23da2e[_0x7dc9('0xf')]+','+(_0x568705[_0x7dc9('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x7dc9('0x6e')}]},routingClient);})['then'](respondWithResult(_0x4588a7,null))[_0x7dc9('0x17')](handleError(_0x4588a7,null));}; \ No newline at end of file +var _0x55ca=['ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','agentNotify','channel','Website','User','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','../../config/logger','api','client','http','request','error','code','message','result','catch','stack','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','then','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','params','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions'];(function(_0x1f70e6,_0x3de5b1){var _0xe43b01=function(_0x462771){while(--_0x462771){_0x1f70e6['push'](_0x1f70e6['shift']());}};_0xe43b01(++_0x3de5b1);}(_0x55ca,0x126));var _0xa55c=function(_0x32905d,_0x2ed18c){_0x32905d=_0x32905d-0x0;var _0x2c3f12=_0x55ca[_0x32905d];return _0x2c3f12;};'use strict';var BPromise=require(_0xa55c('0x0'));var moment=require(_0xa55c('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0xa55c('0x2'))(_0xa55c('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232a});var mailClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232b});var routingClient=jayson[_0xa55c('0x4')][_0xa55c('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){var _0x291996=_0x2121fd?_0x2121fd:amiClient;return _0x291996[_0xa55c('0x6')](_0x36b623,_0x4d0624)['then'](function(_0x5849ad){if(_0x5849ad[_0xa55c('0x7')]){if(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x8')]===0x1f4){return _0x57e069(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x9')]);}return _0x2537f0(_0x5849ad[_0xa55c('0x7')][_0xa55c('0x9')]);}else{_0x2537f0(_0x5849ad[_0xa55c('0xa')]);}})[_0xa55c('0xb')](function(_0x15eec8){_0x57e069(_0x15eec8);});});}function respondWithResult(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xc8;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['status'](_0x59d84a)['json'](_0x2a35be);}return _0x5d47ff['sendStatus'](0x194);};}function handleError(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0x1f4;return function(_0x462cd6){logger[_0xa55c('0x7')](_0x462cd6[_0xa55c('0xc')]);if(_0x462cd6[_0xa55c('0xd')]){delete _0x462cd6['name'];}_0x18ee85[_0xa55c('0xe')](_0x3930e4)[_0xa55c('0xf')](_0x462cd6);};}function findById(_0x25934f){return function(_0x31e10d){if(!_[_0xa55c('0x10')](_0x25934f)&&!_[_0xa55c('0x10')](_0x31e10d)&&!_[_0xa55c('0x10')](_0x31e10d[_0xa55c('0x11')])){return _[_0xa55c('0x12')](_0x31e10d['rows'],function(_0x3d4c9e){return _0x3d4c9e['id']==_0x25934f;});}return null;};}exports[_0xa55c('0x13')]=function(_0x461284,_0x358b61){return respondWithRpcPromise(_0xa55c('0x14'),_0x461284[_0xa55c('0x15')])['then'](respondWithResult(_0x358b61,null))['catch'](handleError(_0x358b61,null));};exports[_0xa55c('0x16')]=function(_0x3776ac,_0xade4c4){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xa55c('0x17')](_0x3776ac[_0xa55c('0x15')],_0x3776ac['params']))[_0xa55c('0x18')](respondWithResult(_0xade4c4,null))[_0xa55c('0xb')](handleError(_0xade4c4,null));};exports[_0xa55c('0x19')]=function(_0x1965f1,_0x234372){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa55c('0x17')](_0x1965f1['query'],_0x1965f1['params']))['then'](respondWithResult(_0x234372,null))[_0xa55c('0xb')](handleError(_0x234372,null));};exports['voiceQueues']=function(_0x3ecbe7,_0x190757){return respondWithRpcPromise(_0xa55c('0x1a'),_0x3ecbe7[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x190757,null))[_0xa55c('0xb')](handleError(_0x190757,null));};exports[_0xa55c('0x1b')]=function(_0x11e7f7,_0x192df2){return respondWithRpcPromise(_0xa55c('0x1a'),_0x11e7f7[_0xa55c('0x15')])['then'](findById(_0x11e7f7[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x192df2,null))[_0xa55c('0xb')](handleError(_0x192df2,null));};exports[_0xa55c('0x1d')]=function(_0x5d940d,_0x1377b0){return respondWithRpcPromise(_0xa55c('0x1e'),_[_0xa55c('0x17')](_0x5d940d[_0xa55c('0x1f')],_0x5d940d[_0xa55c('0x1c')]))[_0xa55c('0x18')](respondWithResult(_0x1377b0,null))['catch'](handleError(_0x1377b0,null));};exports[_0xa55c('0x20')]=function(_0x490b7d,_0x35c9c2){return respondWithRpcPromise(_0xa55c('0x21'),_[_0xa55c('0x17')](_0x490b7d[_0xa55c('0x15')],_0x490b7d['params']))[_0xa55c('0x18')](respondWithResult(_0x35c9c2,null))[_0xa55c('0xb')](handleError(_0x35c9c2,null));};exports[_0xa55c('0x22')]=function(_0x20da31,_0x10f4b7){return respondWithRpcPromise(_0xa55c('0x23'),_0x20da31[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x10f4b7,null))[_0xa55c('0xb')](handleError(_0x10f4b7,null));};exports[_0xa55c('0x24')]=function(_0x197099,_0x4eb7c4){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xa55c('0x17')](_0x197099[_0xa55c('0x15')],_0x197099['params']))[_0xa55c('0x18')](respondWithResult(_0x4eb7c4,null))[_0xa55c('0xb')](handleError(_0x4eb7c4,null));};exports[_0xa55c('0x25')]=function(_0x1839ac,_0x30d4f8){return respondWithRpcPromise(_0xa55c('0x26'),_[_0xa55c('0x17')](_0x1839ac[_0xa55c('0x15')],_0x1839ac[_0xa55c('0x1c')]))['then'](respondWithResult(_0x30d4f8,null))['catch'](handleError(_0x30d4f8,null));};exports['voiceQueuesChannelRedirect']=function(_0x3fd75f,_0x18e00e){return respondWithRpcPromise(_0xa55c('0x27'),_['merge'](_0x3fd75f[_0xa55c('0x15')],_0x3fd75f['params']))[_0xa55c('0x18')](respondWithResult(_0x18e00e,null))['catch'](handleError(_0x18e00e,null));};exports[_0xa55c('0x28')]=function(_0x39267c,_0x3c0ec1){return respondWithRpcPromise('Outbound',_0x39267c[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x3c0ec1,null))['catch'](handleError(_0x3c0ec1,null));};exports[_0xa55c('0x29')]=function(_0x194e78,_0x4d9083){return respondWithRpcPromise('OutboundChannels',_0x194e78[_0xa55c('0x15')])['then'](respondWithResult(_0x4d9083,null))[_0xa55c('0xb')](handleError(_0x4d9083,null));};exports[_0xa55c('0x2a')]=function(_0x5427bf,_0x542d76){var _0x5e50b6;return respondWithRpcPromise('Agents',_0x5427bf[_0xa55c('0x15')])[_0xa55c('0x18')](function(_0x429336){_0x5e50b6=_0x429336;return respondWithRpcPromise(_0xa55c('0x2b'),_0x5427bf[_0xa55c('0x15')],routingClient);})['then'](function(_0x3d52d8){return _[_0xa55c('0x17')]({},_0x3d52d8,_0x5e50b6);})[_0xa55c('0x18')](respondWithResult(_0x542d76,null))[_0xa55c('0xb')](handleError(_0x542d76,null));};exports[_0xa55c('0x2c')]=function(_0x23cef5,_0x554620){if(_0x23cef5[_0xa55c('0x1f')]&&_0x23cef5['body']['interaction']&&_0x23cef5[_0xa55c('0x2d')]&&_0x23cef5[_0xa55c('0x2d')]['name']){for(var _0x2bd98b in _0x23cef5['body']['interaction']){if(_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0xa55c('0x2f')](_0x2bd98b)){db['MemberReport'][_0xa55c('0x30')]({'where':{'channel':_0x2bd98b,'membername':_0x23cef5[_0xa55c('0x2d')]['name'],'type':_0xa55c('0x31'),'exitAt':null,'uniqueid':_0x23cef5['body'][_0xa55c('0x2e')][_0x2bd98b]&&_0x23cef5[_0xa55c('0x1f')]['interaction'][_0x2bd98b][_0xa55c('0x32')]?{'$notIn':_0x23cef5[_0xa55c('0x1f')]['interaction'][_0x2bd98b]}:{'$ne':null}}})[_0xa55c('0x18')](function(_0x187e09){var _0x204767=moment()['format'](_0xa55c('0x33'));for(var _0x582901=0x0,_0x2f9717=_0x187e09[_0xa55c('0x32')];_0x582901<_0x2f9717;_0x582901+=0x1){_0x187e09[_0x582901][_0xa55c('0x34')]({'exitAt':_0x204767});}});for(var _0x51d663=0x0;_0x51d663<_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0x2bd98b]['length'];_0x51d663+=0x1){db[_0xa55c('0x35')][_0xa55c('0x36')]({'where':{'channel':_0x2bd98b,'membername':_0x23cef5['user'][_0xa55c('0xd')],'type':_0xa55c('0x31'),'uniqueid':_0x23cef5['body'][_0xa55c('0x2e')][_0x2bd98b][_0x51d663],'exitAt':null},'defaults':{'channel':_0x2bd98b,'membername':_0x23cef5[_0xa55c('0x2d')][_0xa55c('0xd')],'interface':_[_0xa55c('0x10')](_0x23cef5['user'][_0xa55c('0x37')])?util['format'](_0xa55c('0x38'),_0x23cef5[_0xa55c('0x2d')][_0xa55c('0xd')]):_0x23cef5['user'][_0xa55c('0x37')],'type':_0xa55c('0x31'),'enterAt':moment()['format'](_0xa55c('0x33')),'role':_0xa55c('0x39'),'internal':_0x23cef5[_0xa55c('0x2d')][_0xa55c('0x3a')],'uniqueid':_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x2e')][_0x2bd98b][_0x51d663]}});}}}}return respondWithRpcPromise(_0xa55c('0x3b'),{'id':_0x23cef5[_0xa55c('0x1c')]['id'],'capacity':_0x23cef5[_0xa55c('0x1f')][_0xa55c('0x3c')]},routingClient)['then'](respondWithResult(_0x554620,null))[_0xa55c('0xb')](handleError(_0x554620,null));};exports[_0xa55c('0x3d')]=function(_0x216de8,_0x4f73b6){return respondWithRpcPromise(_0xa55c('0x3e'),_0x216de8[_0xa55c('0x15')])['then'](respondWithResult(_0x4f73b6,null))[_0xa55c('0xb')](handleError(_0x4f73b6,null));};exports['trunks']=function(_0x2b6a0e,_0x228df4){return respondWithRpcPromise(_0xa55c('0x3f'),_0x2b6a0e[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x228df4,null))['catch'](handleError(_0x228df4,null));};exports[_0xa55c('0x40')]=function(_0x4607ca,_0x4b85cc){return respondWithRpcPromise(_0xa55c('0x41'),_0x4607ca[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x4b85cc,null))[_0xa55c('0xb')](handleError(_0x4b85cc,null));};exports['chatQueues']=function(_0x4def35,_0x267965){return respondWithRpcPromise(_0xa55c('0x42'),_0x4def35[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x267965,null))['catch'](handleError(_0x267965,null));};exports[_0xa55c('0x43')]=function(_0x5ce463,_0x2742e4){return respondWithRpcPromise(_0xa55c('0x42'),_0x5ce463[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x5ce463[_0xa55c('0x1c')]['id']))['then'](respondWithResult(_0x2742e4,null))[_0xa55c('0xb')](handleError(_0x2742e4,null));};exports['mailQueues']=function(_0x23f67f,_0x157afe){return respondWithRpcPromise(_0xa55c('0x44'),_0x23f67f[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x157afe,null))[_0xa55c('0xb')](handleError(_0x157afe,null));};exports[_0xa55c('0x45')]=function(_0x53e2be,_0x450567){return respondWithRpcPromise(_0xa55c('0x44'),_0x53e2be[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x53e2be[_0xa55c('0x1c')]['id']))['then'](respondWithResult(_0x450567,null))[_0xa55c('0xb')](handleError(_0x450567,null));};exports[_0xa55c('0x46')]=function(_0x28bac4,_0x20e53c){return respondWithRpcPromise(_0xa55c('0x47'),_0x28bac4['query'],mailClient)[_0xa55c('0x18')](respondWithResult(_0x20e53c,null))[_0xa55c('0xb')](handleError(_0x20e53c,null));};exports[_0xa55c('0x48')]=function(_0x16d9b2,_0x3ba56d){return respondWithRpcPromise('OpenchannelQueues',_0x16d9b2[_0xa55c('0x15')],routingClient)['then'](respondWithResult(_0x3ba56d,null))[_0xa55c('0xb')](handleError(_0x3ba56d,null));};exports['showOpenchannelQueues']=function(_0x3495a7,_0x5a8897){return respondWithRpcPromise(_0xa55c('0x49'),_0x3495a7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x3495a7[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x5a8897,null))[_0xa55c('0xb')](handleError(_0x5a8897,null));};exports[_0xa55c('0x4a')]=function(_0x2f2226,_0x14b515){return respondWithRpcPromise(_0xa55c('0x4b'),_0x2f2226['query'],routingClient)[_0xa55c('0x18')](respondWithResult(_0x14b515,null))[_0xa55c('0xb')](handleError(_0x14b515,null));};exports['showSmsQueues']=function(_0x18b928,_0x2b8b88){return respondWithRpcPromise(_0xa55c('0x4b'),_0x18b928[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x18b928[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x2b8b88,null))[_0xa55c('0xb')](handleError(_0x2b8b88,null));};exports['whatsappQueues']=function(_0x1dfaf7,_0x475131){return respondWithRpcPromise(_0xa55c('0x4c'),_0x1dfaf7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x475131,null))[_0xa55c('0xb')](handleError(_0x475131,null));};exports[_0xa55c('0x4d')]=function(_0x4249c1,_0x25d5a1){return respondWithRpcPromise('WhatsappQueues',_0x4249c1[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](findById(_0x4249c1[_0xa55c('0x1c')]['id']))[_0xa55c('0x18')](respondWithResult(_0x25d5a1,null))[_0xa55c('0xb')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x4e')]=function(_0x3ea755,_0x3606b2){return respondWithRpcPromise(_0xa55c('0x4f'),_0x3ea755[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x3606b2,null))['catch'](handleError(_0x3606b2,null));};exports[_0xa55c('0x50')]=function(_0x531eee,_0x1228a4){return respondWithRpcPromise(_0xa55c('0x4f'),_0x531eee[_0xa55c('0x15')],routingClient)['then'](findById(_0x531eee['params']['id']))[_0xa55c('0x18')](respondWithResult(_0x1228a4,null))[_0xa55c('0xb')](handleError(_0x1228a4,null));};exports[_0xa55c('0x51')]=function(_0x42529f,_0x4c7ee1){return respondWithRpcPromise(_0xa55c('0x52'),_0x42529f[_0xa55c('0x15')])[_0xa55c('0x18')](respondWithResult(_0x4c7ee1,null))[_0xa55c('0xb')](handleError(_0x4c7ee1,null));};exports[_0xa55c('0x53')]=function(_0x500968,_0x4b090c){return respondWithRpcPromise(_0xa55c('0x54'),_0x500968[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x4b090c,null))[_0xa55c('0xb')](handleError(_0x4b090c,null));};exports[_0xa55c('0x55')]=function(_0x4b2032,_0x14febc){return respondWithRpcPromise(_0xa55c('0x56'),_0x4b2032['query'],routingClient)[_0xa55c('0x18')](respondWithResult(_0x14febc,null))[_0xa55c('0xb')](handleError(_0x14febc,null));};exports[_0xa55c('0x57')]=function(_0x4dcb93,_0x1521d5){return respondWithRpcPromise(_0xa55c('0x58'),_0x4dcb93[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x1521d5,null))[_0xa55c('0xb')](handleError(_0x1521d5,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x25bd5b,_0x2e2cf6){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x25bd5b['query'],routingClient)[_0xa55c('0x18')](function(_0x4e1cbd){if(_0x25bd5b[_0xa55c('0x15')][_0xa55c('0x59')]!==undefined){var _0x2f13db=_(_0x4e1cbd[_0xa55c('0x11')])[_0xa55c('0x5a')]([_0x25bd5b[_0xa55c('0x15')][_0xa55c('0x59')],_0x25bd5b[_0xa55c('0x1c')]['id']])[_0xa55c('0x5b')]('queue_id')[_0xa55c('0x5c')]()[_0xa55c('0x5d')]();return _0x4e1cbd[_0xa55c('0x11')][_0xa55c('0x5a')](function(_0x4f0a26){return _0x2f13db[_0xa55c('0x5e')](_0x4f0a26[_0xa55c('0x5f')])>-0x1;});}else{return _0x4e1cbd[_0xa55c('0x11')][_0xa55c('0x5a')](function(_0x5d766e){return _0x5d766e['queue_id']===parseInt(_0x25bd5b[_0xa55c('0x1c')]['id']);});}})[_0xa55c('0x18')](respondWithResult(_0x2e2cf6,null))[_0xa55c('0xb')](handleError(_0x2e2cf6,null));};exports[_0xa55c('0x60')]=function(_0x5e87cb,_0x55ee0d){return respondWithRpcPromise(_0xa55c('0x61'),_0x5e87cb[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x55ee0d,null))[_0xa55c('0xb')](handleError(_0x55ee0d,null));};exports[_0xa55c('0x62')]=function(_0x346060,_0x239269){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x346060[_0xa55c('0x15')],routingClient)['then'](respondWithResult(_0x239269,null))[_0xa55c('0xb')](handleError(_0x239269,null));};exports['faxQueuesWaitingInteractions']=function(_0x36ded7,_0x313cdc){return respondWithRpcPromise(_0xa55c('0x63'),_0x36ded7[_0xa55c('0x15')],routingClient)[_0xa55c('0x18')](respondWithResult(_0x313cdc,null))[_0xa55c('0xb')](handleError(_0x313cdc,null));};exports[_0xa55c('0x64')]=function(_0x2c71ca){return function(_0x576a1b,_0x59414d){var _0x14cb74,_0x2948b1;var _0xc2ad5c=_[_0xa55c('0x65')](_0x2c71ca);var _0x1622cb=_0x2c71ca===_0xa55c('0x66')?'Website':_0xa55c('0x67');return db[_0xc2ad5c+_0xa55c('0x68')][_0xa55c('0x69')]({'raw':!![],'where':{'id':_0x576a1b[_0xa55c('0x1c')]['id']}})[_0xa55c('0x18')](function(_0x3b1cd7){if(_[_0xa55c('0x10')](_0x3b1cd7)){throw new Error(_0xc2ad5c+_0xa55c('0x6a'));}_0x14cb74=_0x3b1cd7;return db[_0xc2ad5c+'Message'][_0xa55c('0x69')]({'where':{'id':_0x576a1b[_0xa55c('0x1f')][_0xa55c('0x6b')]},'include':[{'model':db[_0xc2ad5c+_0xa55c('0x6c')],'as':_0xa55c('0x6c')},{'model':db[_0xc2ad5c+_0x1622cb],'as':'Account'}]});})[_0xa55c('0x18')](function(_0x2ab1f2){if(_['isNil'](_0x2ab1f2)){throw new Error(_0xc2ad5c+'\x20Message\x20not\x20found');}_0x2948b1=_0x2ab1f2;return _0x2ab1f2[_0xa55c('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa55c('0x18')](function(){var _0x5c2229={'uniqueid':_0x2c71ca+'.'+_0x2948b1['id']+'.'+_0x2948b1['Interaction']['id'],'FromUserId':_0x576a1b['user']['id'],'type':'queue'};_0x5c2229[_0xc2ad5c+_0xa55c('0x6e')]=_0x2948b1['id'];_0x5c2229[_0xc2ad5c+_0xa55c('0x6f')]=_0x2948b1[_0xa55c('0x6c')]['id'];_0x5c2229[_0xa55c('0x70')+_0xc2ad5c+_0x1622cb+'Id']=_0x2948b1[_0xa55c('0x67')]['id'];_0x5c2229['To'+_0xc2ad5c+_0xa55c('0x71')]=_0x14cb74['id'];return db[_0xc2ad5c+'TransferReport'][_0xa55c('0x72')](_0x5c2229);})[_0xa55c('0x18')](function(){return respondWithRpcPromise(_0xa55c('0x73'),{'channel':_0x2c71ca,'interaction':_0x2948b1[_0xa55c('0x6c')],'message':_0x2948b1,'account':_0x2948b1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xa55c('0x74'),'appdata':_0x14cb74[_0xa55c('0xd')]+','+(_0x2948b1[_0xa55c('0x67')]['queueTransferTimeout']||0x12c),'interval':_0xa55c('0x75')}]},routingClient);})['then'](respondWithResult(_0x59414d,null))['catch'](handleError(_0x59414d,null));};};exports[_0xa55c('0x76')]=function(_0x413b45,_0x1e298d){var _0x249b0c,_0x2544c1;if(_[_0xa55c('0x10')](_0x413b45[_0xa55c('0x1f')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x71bd0d=_0x413b45[_0xa55c('0x1f')][_0xa55c('0x77')];var _0x1f4bc8=_[_0xa55c('0x65')](_0x71bd0d);var _0x2a0805=_0x71bd0d===_0xa55c('0x66')?_0xa55c('0x78'):_0xa55c('0x67');return db[_0xa55c('0x79')]['findOne']({'raw':!![],'where':{'id':_0x413b45[_0xa55c('0x1c')]['id'],'role':_0xa55c('0x39')}})['then'](function(_0xb9708){if(_['isNil'](_0xb9708)){throw new Error(_0xa55c('0x7a'));}_0x249b0c=_0xb9708;return db[_0x1f4bc8+_0xa55c('0x7b')][_0xa55c('0x69')]({'where':{'id':_0x413b45[_0xa55c('0x1f')][_0xa55c('0x6b')]},'include':[{'model':db[_0x1f4bc8+'Interaction'],'as':_0xa55c('0x6c')},{'model':db[_0x1f4bc8+_0x2a0805],'as':_0xa55c('0x67')}]});})[_0xa55c('0x18')](function(_0x376c1f){if(_[_0xa55c('0x10')](_0x376c1f)){throw new Error(_0x1f4bc8+_0xa55c('0x7c'));}_0x2544c1=_0x376c1f;return _0x376c1f[_0xa55c('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x49a307={'uniqueid':_0x71bd0d+'.'+_0x2544c1['id']+'.'+_0x2544c1['Interaction']['id'],'FromUserId':_0x413b45[_0xa55c('0x2d')]['id'],'type':'queue','ToUserId':_0x249b0c['id']};_0x49a307[_0x1f4bc8+_0xa55c('0x6e')]=_0x2544c1['id'];_0x49a307[_0x1f4bc8+_0xa55c('0x6f')]=_0x2544c1[_0xa55c('0x6c')]['id'];_0x49a307[_0xa55c('0x70')+_0x1f4bc8+_0x2a0805+'Id']=_0x2544c1[_0xa55c('0x67')]['id'];return db[_0x1f4bc8+'TransferReport'][_0xa55c('0x72')](_0x49a307);})['then'](function(){return respondWithRpcPromise(_0xa55c('0x73'),{'channel':_0x71bd0d,'interaction':_0x2544c1[_0xa55c('0x6c')],'message':_0x2544c1,'account':_0x2544c1[_0xa55c('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa55c('0x39'),'appdata':_0x249b0c['name']+','+(_0x2544c1[_0xa55c('0x67')][_0xa55c('0x7d')]||0x12c),'interval':_0xa55c('0x75')}]},routingClient);})[_0xa55c('0x18')](respondWithResult(_0x1e298d,null))[_0xa55c('0xb')](handleError(_0x1e298d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c2d68f5..248092d 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 _0xef25=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x4d4c15,_0xbe94a1){var _0x4e0ba2=function(_0x51fc9c){while(--_0x51fc9c){_0x4d4c15['push'](_0x4d4c15['shift']());}};_0x4e0ba2(++_0xbe94a1);}(_0xef25,0xd0));var _0x5ef2=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xef25[_0x725a4c];return _0x37b2cc;};'use strict';var multer=require(_0x5ef2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5ef2('0x1'));var express=require(_0x5ef2('0x2'));var router=express['Router']();var fs_extra=require(_0x5ef2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5ef2('0x4'));var config=require(_0x5ef2('0x5'));var controller=require(_0x5ef2('0x6'));router[_0x5ef2('0x7')]('/',auth[_0x5ef2('0x8')](),controller['index']);router[_0x5ef2('0x7')](_0x5ef2('0x9'),auth['isAuthenticated'](),controller[_0x5ef2('0xa')]);router[_0x5ef2('0x7')]('/:id/run',auth[_0x5ef2('0x8')](),controller['run']);router[_0x5ef2('0xb')]('/',auth['isAuthenticated'](),controller[_0x5ef2('0xc')]);router[_0x5ef2('0xd')](_0x5ef2('0x9'),auth['isAuthenticated'](),controller[_0x5ef2('0xe')]);router[_0x5ef2('0xf')](_0x5ef2('0x9'),auth[_0x5ef2('0x8')](),controller[_0x5ef2('0x10')]);module[_0x5ef2('0x11')]=router; \ No newline at end of file +var _0xca89=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','run','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x2a5fd7,_0x27c403){var _0x32b3c0=function(_0x762659){while(--_0x762659){_0x2a5fd7['push'](_0x2a5fd7['shift']());}};_0x32b3c0(++_0x27c403);}(_0xca89,0x12c));var _0x9ca8=function(_0x522315,_0x359b32){_0x522315=_0x522315-0x0;var _0x262f93=_0xca89[_0x522315];return _0x262f93;};'use strict';var multer=require(_0x9ca8('0x0'));var util=require(_0x9ca8('0x1'));var path=require('path');var timeout=require(_0x9ca8('0x2'));var express=require(_0x9ca8('0x3'));var router=express['Router']();var fs_extra=require(_0x9ca8('0x4'));var auth=require(_0x9ca8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ca8('0x6'));var controller=require('./schedule.controller');router[_0x9ca8('0x7')]('/',auth[_0x9ca8('0x8')](),controller[_0x9ca8('0x9')]);router[_0x9ca8('0x7')](_0x9ca8('0xa'),auth[_0x9ca8('0x8')](),controller[_0x9ca8('0xb')]);router[_0x9ca8('0x7')]('/:id/run',auth[_0x9ca8('0x8')](),controller[_0x9ca8('0xc')]);router[_0x9ca8('0xd')]('/',auth['isAuthenticated'](),controller[_0x9ca8('0xe')]);router[_0x9ca8('0xf')](_0x9ca8('0xa'),auth[_0x9ca8('0x8')](),controller[_0x9ca8('0x10')]);router[_0x9ca8('0x11')](_0x9ca8('0xa'),auth[_0x9ca8('0x8')](),controller[_0x9ca8('0x12')]);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 907297b..74b237e 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 _0xcbd2=['DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','exports','STRING','BOOLEAN'];(function(_0x307a78,_0x44758e){var _0x3094f4=function(_0x15dded){while(--_0x15dded){_0x307a78['push'](_0x307a78['shift']());}};_0x3094f4(++_0x44758e);}(_0xcbd2,0x1ad));var _0x2cbd=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0xcbd2[_0x41382c];return _0x4da35b;};'use strict';var Sequelize=require('sequelize');module[_0x2cbd('0x0')]={'name':{'type':Sequelize[_0x2cbd('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2cbd('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2cbd('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x2cbd('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2cbd('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2cbd('0x5')](_0x2cbd('0x6'),_0x2cbd('0x7'),_0x2cbd('0x8'),_0x2cbd('0x9'),_0x2cbd('0xa'),_0x2cbd('0xb'),_0x2cbd('0xc')),'allowNull':![],'defaultValue':_0x2cbd('0xa')},'output':{'type':Sequelize[_0x2cbd('0x5')](_0x2cbd('0xd'),_0x2cbd('0xe'),_0x2cbd('0xf')),'allowNull':![],'defaultValue':_0x2cbd('0xd')},'type':{'type':Sequelize['ENUM'](_0x2cbd('0x10'),'default'),'allowNull':![],'defaultValue':_0x2cbd('0x10')},'sendMail':{'type':Sequelize[_0x2cbd('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2cbd('0x1')]},'cc':{'type':Sequelize[_0x2cbd('0x11')]},'bcc':{'type':Sequelize[_0x2cbd('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x2cbd('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7858=['ENUM','months','days','hours','minutes','csv','pdf','xlsx','default','custom','TEXT','exports','STRING','BOOLEAN','DATE','INTEGER'];(function(_0x318cab,_0x530a41){var _0x5195e4=function(_0x2fee99){while(--_0x2fee99){_0x318cab['push'](_0x318cab['shift']());}};_0x5195e4(++_0x530a41);}(_0x7858,0x18b));var _0x8785=function(_0x279fac,_0x2319b0){_0x279fac=_0x279fac-0x0;var _0x237d6e=_0x7858[_0x279fac];return _0x237d6e;};'use strict';var Sequelize=require('sequelize');module[_0x8785('0x0')]={'name':{'type':Sequelize[_0x8785('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8785('0x1')]},'active':{'type':Sequelize[_0x8785('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x8785('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8785('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8785('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8785('0x5')]('years','quarters',_0x8785('0x6'),'weeks',_0x8785('0x7'),_0x8785('0x8'),_0x8785('0x9')),'allowNull':![],'defaultValue':_0x8785('0x7')},'output':{'type':Sequelize[_0x8785('0x5')](_0x8785('0xa'),_0x8785('0xb'),_0x8785('0xc')),'allowNull':![],'defaultValue':_0x8785('0xa')},'type':{'type':Sequelize[_0x8785('0x5')]('custom',_0x8785('0xd')),'allowNull':![],'defaultValue':_0x8785('0xe')},'sendMail':{'type':Sequelize[_0x8785('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x8785('0x1')]},'cc':{'type':Sequelize[_0x8785('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x8785('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 26fe8a8..f4183e8 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 _0xfdf2=['then','destroy','get','UserProfileResource','sendStatus','error','name','send','Schedule','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update'];(function(_0x619fcc,_0x3bd756){var _0x4737a6=function(_0x49311c){while(--_0x49311c){_0x619fcc['push'](_0x619fcc['shift']());}};_0x4737a6(++_0x3bd756);}(_0xfdf2,0x7e));var _0x2fdf=function(_0x54c4c4,_0x3f88bc){_0x54c4c4=_0x54c4c4-0x0;var _0x2e41c2=_0xfdf2[_0x54c4c4];return _0x2e41c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2fdf('0x0'));var zipdir=require(_0x2fdf('0x1'));var jsonpatch=require(_0x2fdf('0x2'));var rp=require('request-promise');var moment=require(_0x2fdf('0x3'));var BPromise=require(_0x2fdf('0x4'));var Mustache=require(_0x2fdf('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2fdf('0x6'));var csv=require(_0x2fdf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fdf('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2fdf('0x9'));var jsforce=require(_0x2fdf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2fdf('0xb'));var Papa=require(_0x2fdf('0xc'));var Redis=require('ioredis');var authService=require(_0x2fdf('0xd'));var qs=require(_0x2fdf('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fdf('0xf'));var logger=require('../../config/logger')(_0x2fdf('0x10'));var utils=require(_0x2fdf('0x11'));var config=require(_0x2fdf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fdf('0x13'))['db'];function respondWithStatusCode(_0x2b274c,_0x256ebe){_0x256ebe=_0x256ebe||0xcc;return function(_0x293d2c){if(_0x293d2c){return _0x2b274c['sendStatus'](_0x256ebe);}return _0x2b274c[_0x2fdf('0x14')](_0x256ebe)[_0x2fdf('0x15')]();};}function respondWithResult(_0x5981d6,_0x16f82d){_0x16f82d=_0x16f82d||0xc8;return function(_0x1749f9){if(_0x1749f9){return _0x5981d6['status'](_0x16f82d)[_0x2fdf('0x16')](_0x1749f9);}};}function respondWithFilteredResult(_0x929956,_0x3cfa08){return function(_0x20f0ef){if(_0x20f0ef){var _0x2d9b50=typeof _0x3cfa08[_0x2fdf('0x17')]==='undefined'&&typeof _0x3cfa08[_0x2fdf('0x18')]===_0x2fdf('0x19');var _0x51f752=_0x20f0ef[_0x2fdf('0x1a')];var _0x23f546=_0x2d9b50?0x0:_0x3cfa08[_0x2fdf('0x17')];var _0x3feec4=_0x2d9b50?_0x20f0ef[_0x2fdf('0x1a')]:_0x3cfa08[_0x2fdf('0x17')]+_0x3cfa08[_0x2fdf('0x18')];var _0x5401eb;if(_0x3feec4>=_0x51f752){_0x3feec4=_0x51f752;_0x5401eb=0xc8;}else{_0x5401eb=0xce;}_0x929956[_0x2fdf('0x14')](_0x5401eb);return _0x929956[_0x2fdf('0x1b')](_0x2fdf('0x1c'),_0x23f546+'-'+_0x3feec4+'/'+_0x51f752)[_0x2fdf('0x16')](_0x20f0ef);}return null;};}function patchUpdates(_0xf24314){return function(_0xfd1924){try{jsonpatch['apply'](_0xfd1924,_0xf24314,!![]);}catch(_0x36d06d){return BPromise[_0x2fdf('0x1d')](_0x36d06d);}return _0xfd1924[_0x2fdf('0x1e')]();};}function saveUpdates(_0xddd232,_0x4f6da6){return function(_0x42c25a){if(_0x42c25a){return _0x42c25a[_0x2fdf('0x1f')](_0xddd232)[_0x2fdf('0x20')](function(_0x2627ca){return _0x2627ca;});}return null;};}function removeEntity(_0x5655ae,_0x5dc76){return function(_0x3bca0f){if(_0x3bca0f){return _0x3bca0f[_0x2fdf('0x21')]()[_0x2fdf('0x20')](function(){var _0x566fde=_0x3bca0f[_0x2fdf('0x22')]({'plain':!![]});var _0x9b66b4='Scheduler';return db[_0x2fdf('0x23')]['destroy']({'where':{'type':_0x9b66b4,'resourceId':_0x566fde['id']}})[_0x2fdf('0x20')](function(){return _0x3bca0f;});})[_0x2fdf('0x20')](function(){_0x5655ae[_0x2fdf('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x157f77,_0x1234da){return function(_0x64fca5){if(!_0x64fca5){_0x157f77[_0x2fdf('0x24')](0x194);}return _0x64fca5;};}function handleError(_0x3c5c19,_0x5738e4){_0x5738e4=_0x5738e4||0x1f4;return function(_0x399483){logger[_0x2fdf('0x25')](_0x399483['stack']);if(_0x399483['name']){delete _0x399483[_0x2fdf('0x26')];}_0x3c5c19[_0x2fdf('0x14')](_0x5738e4)[_0x2fdf('0x27')](_0x399483);};}exports['index']=function(_0x5503ff,_0x467360){var _0x517fbe={},_0x525496={},_0x5413ea={'count':0x0,'rows':[]};var _0x546380=_['map'](db[_0x2fdf('0x28')][_0x2fdf('0x29')],function(_0x43e2c8){return{'name':_0x43e2c8[_0x2fdf('0x2a')],'type':_0x43e2c8[_0x2fdf('0x2b')]['key']};});_0x525496[_0x2fdf('0x2c')]=_[_0x2fdf('0x2d')](_0x546380,_0x2fdf('0x26'));_0x525496[_0x2fdf('0x2e')]=_[_0x2fdf('0x2f')](_0x5503ff['query']);_0x525496['filters']=_['intersection'](_0x525496[_0x2fdf('0x2c')],_0x525496[_0x2fdf('0x2e')]);_0x517fbe[_0x2fdf('0x30')]=_[_0x2fdf('0x31')](_0x525496[_0x2fdf('0x2c')],qs[_0x2fdf('0x32')](_0x5503ff['query'][_0x2fdf('0x32')]));_0x517fbe[_0x2fdf('0x30')]=_0x517fbe['attributes']['length']?_0x517fbe['attributes']:_0x525496['model'];if(!_0x5503ff['query'][_0x2fdf('0x33')]('nolimit')){_0x517fbe['limit']=qs[_0x2fdf('0x18')](_0x5503ff[_0x2fdf('0x2e')][_0x2fdf('0x18')]);_0x517fbe[_0x2fdf('0x17')]=qs[_0x2fdf('0x17')](_0x5503ff[_0x2fdf('0x2e')]['offset']);}_0x517fbe[_0x2fdf('0x34')]=qs[_0x2fdf('0x35')](_0x5503ff['query'][_0x2fdf('0x35')]);_0x517fbe[_0x2fdf('0x36')]=qs['filters'](_[_0x2fdf('0x37')](_0x5503ff['query'],_0x525496[_0x2fdf('0x38')]),_0x546380);if(_0x5503ff[_0x2fdf('0x2e')][_0x2fdf('0x39')]){_0x517fbe[_0x2fdf('0x36')]=_[_0x2fdf('0x3a')](_0x517fbe[_0x2fdf('0x36')],{'$or':_['map'](_0x546380,function(_0x30d2c){if(_0x30d2c[_0x2fdf('0x2b')]!==_0x2fdf('0x3b')){var _0x18cd6b={};_0x18cd6b[_0x30d2c[_0x2fdf('0x26')]]={'$like':'%'+_0x5503ff[_0x2fdf('0x2e')]['filter']+'%'};return _0x18cd6b;}})});}_0x517fbe=_[_0x2fdf('0x3a')]({},_0x517fbe,_0x5503ff[_0x2fdf('0x3c')]);var _0x505a7a={'where':_0x517fbe['where']};return db[_0x2fdf('0x28')][_0x2fdf('0x1a')](_0x505a7a)[_0x2fdf('0x20')](function(_0x20e131){_0x5413ea[_0x2fdf('0x1a')]=_0x20e131;if(_0x5503ff[_0x2fdf('0x2e')][_0x2fdf('0x3d')]){_0x517fbe[_0x2fdf('0x3e')]=[{'all':!![]}];}return db[_0x2fdf('0x28')]['findAll'](_0x517fbe);})[_0x2fdf('0x20')](function(_0x4b4cc9){_0x5413ea[_0x2fdf('0x3f')]=_0x4b4cc9;return _0x5413ea;})[_0x2fdf('0x20')](respondWithFilteredResult(_0x467360,_0x517fbe))['catch'](handleError(_0x467360,null));};exports[_0x2fdf('0x40')]=function(_0x19e3b3,_0x55b503){var _0x1f1d80={'raw':![],'where':{'id':_0x19e3b3['params']['id']}},_0x4869a1={};_0x4869a1['model']=_[_0x2fdf('0x2f')](db[_0x2fdf('0x28')]['rawAttributes']);_0x4869a1[_0x2fdf('0x2e')]=_[_0x2fdf('0x2f')](_0x19e3b3[_0x2fdf('0x2e')]);_0x4869a1[_0x2fdf('0x38')]=_[_0x2fdf('0x31')](_0x4869a1[_0x2fdf('0x2c')],_0x4869a1[_0x2fdf('0x2e')]);_0x1f1d80[_0x2fdf('0x30')]=_[_0x2fdf('0x31')](_0x4869a1[_0x2fdf('0x2c')],qs[_0x2fdf('0x32')](_0x19e3b3[_0x2fdf('0x2e')][_0x2fdf('0x32')]));_0x1f1d80[_0x2fdf('0x30')]=_0x1f1d80[_0x2fdf('0x30')]['length']?_0x1f1d80[_0x2fdf('0x30')]:_0x4869a1[_0x2fdf('0x2c')];if(_0x19e3b3[_0x2fdf('0x2e')]['includeAll']){_0x1f1d80[_0x2fdf('0x3e')]=[{'all':!![]}];}_0x1f1d80=_[_0x2fdf('0x3a')]({},_0x1f1d80,_0x19e3b3[_0x2fdf('0x3c')]);return db[_0x2fdf('0x28')][_0x2fdf('0x41')](_0x1f1d80)[_0x2fdf('0x20')](handleEntityNotFound(_0x55b503,null))[_0x2fdf('0x20')](respondWithResult(_0x55b503,null))[_0x2fdf('0x42')](handleError(_0x55b503,null));};exports[_0x2fdf('0x43')]=function(_0x3460e1,_0x42382f){return db[_0x2fdf('0x28')][_0x2fdf('0x43')](_0x3460e1[_0x2fdf('0x44')],{})[_0x2fdf('0x20')](function(_0x2cff68){var _0x446b61=_0x3460e1[_0x2fdf('0x45')][_0x2fdf('0x22')]({'plain':!![]});if(!_0x446b61)throw new Error(_0x2fdf('0x46'));if(_0x446b61[_0x2fdf('0x47')]===_0x2fdf('0x45')){var _0x471623=_0x2cff68['get']({'plain':!![]});var _0x23c559=_0x2fdf('0x48');return db[_0x2fdf('0x49')][_0x2fdf('0x41')]({'where':{'name':_0x23c559,'userProfileId':_0x446b61['userProfileId']},'raw':!![]})[_0x2fdf('0x20')](function(_0x2da0ca){if(_0x2da0ca&&_0x2da0ca[_0x2fdf('0x4a')]===0x0){return db[_0x2fdf('0x23')][_0x2fdf('0x43')]({'name':_0x471623[_0x2fdf('0x26')],'resourceId':_0x471623['id'],'type':_0x2da0ca[_0x2fdf('0x26')],'sectionId':_0x2da0ca['id']},{})[_0x2fdf('0x20')](function(){return _0x2cff68;});}else{return _0x2cff68;}})[_0x2fdf('0x42')](function(_0x17707a){logger[_0x2fdf('0x25')](_0x2fdf('0x4b'),_0x17707a);throw _0x17707a;});}return _0x2cff68;})['then'](respondWithResult(_0x42382f,0xc9))[_0x2fdf('0x42')](handleError(_0x42382f,null));};exports[_0x2fdf('0x1f')]=function(_0x58925c,_0x552f1c){if(_0x58925c['body']['id']){delete _0x58925c[_0x2fdf('0x44')]['id'];}return db['Schedule'][_0x2fdf('0x41')]({'where':{'id':_0x58925c[_0x2fdf('0x4c')]['id']}})[_0x2fdf('0x20')](handleEntityNotFound(_0x552f1c,null))['then'](saveUpdates(_0x58925c['body'],null))[_0x2fdf('0x20')](respondWithResult(_0x552f1c,null))['catch'](handleError(_0x552f1c,null));};exports[_0x2fdf('0x21')]=function(_0x2a9723,_0xf1ec56){return db['Schedule']['find']({'where':{'id':_0x2a9723[_0x2fdf('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf1ec56,null))[_0x2fdf('0x20')](removeEntity(_0xf1ec56,null))['catch'](handleError(_0xf1ec56,null));};exports[_0x2fdf('0x4d')]=function(_0x187952,_0x1f80d5,_0x80fc78){var _0x472e99=require(_0x2fdf('0x4e'));return db[_0x2fdf('0x28')][_0x2fdf('0x41')]({'where':{'id':_0x187952[_0x2fdf('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1f80d5,null))[_0x2fdf('0x20')](function(){_0x472e99[_0x2fdf('0x4d')](_0x187952[_0x2fdf('0x4c')]['id']);})['then'](respondWithStatusCode(_0x1f80d5,null))['catch'](handleError(_0x1f80d5,null));}; \ No newline at end of file +var _0x3935=['UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','Scheduler','destroy','end','stack','name','send','index','Schedule','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x2016ce,_0x52ef83){var _0x1ae67d=function(_0x41cc77){while(--_0x41cc77){_0x2016ce['push'](_0x2016ce['shift']());}};_0x1ae67d(++_0x52ef83);}(_0x3935,0x156));var _0x5393=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x3935[_0x3cb30b];return _0x2ca717;};'use strict';var emlformat=require(_0x5393('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5393('0x1'));var rp=require(_0x5393('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5393('0x3'));var util=require(_0x5393('0x4'));var path=require(_0x5393('0x5'));var sox=require(_0x5393('0x6'));var csv=require(_0x5393('0x7'));var ejs=require(_0x5393('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5393('0x9'));var crypto=require('crypto');var jsforce=require(_0x5393('0xa'));var deskjs=require(_0x5393('0xb'));var toCsv=require(_0x5393('0x7'));var querystring=require(_0x5393('0xc'));var Papa=require(_0x5393('0xd'));var Redis=require(_0x5393('0xe'));var authService=require(_0x5393('0xf'));var qs=require(_0x5393('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5393('0x11'));var logger=require(_0x5393('0x12'))(_0x5393('0x13'));var utils=require(_0x5393('0x14'));var config=require(_0x5393('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5393('0x16'))['db'];function respondWithStatusCode(_0x1d69aa,_0x242b67){_0x242b67=_0x242b67||0xcc;return function(_0x39abff){if(_0x39abff){return _0x1d69aa[_0x5393('0x17')](_0x242b67);}return _0x1d69aa[_0x5393('0x18')](_0x242b67)['end']();};}function respondWithResult(_0xd1697,_0x364294){_0x364294=_0x364294||0xc8;return function(_0x539daa){if(_0x539daa){return _0xd1697[_0x5393('0x18')](_0x364294)[_0x5393('0x19')](_0x539daa);}};}function respondWithFilteredResult(_0x51dfa3,_0x5208d){return function(_0x5d26a1){if(_0x5d26a1){var _0x3520f6=typeof _0x5208d['offset']===_0x5393('0x1a')&&typeof _0x5208d[_0x5393('0x1b')]===_0x5393('0x1a');var _0x57451f=_0x5d26a1[_0x5393('0x1c')];var _0x46b7f6=_0x3520f6?0x0:_0x5208d[_0x5393('0x1d')];var _0x1f6b67=_0x3520f6?_0x5d26a1['count']:_0x5208d[_0x5393('0x1d')]+_0x5208d[_0x5393('0x1b')];var _0x8464f9;if(_0x1f6b67>=_0x57451f){_0x1f6b67=_0x57451f;_0x8464f9=0xc8;}else{_0x8464f9=0xce;}_0x51dfa3[_0x5393('0x18')](_0x8464f9);return _0x51dfa3[_0x5393('0x1e')]('Content-Range',_0x46b7f6+'-'+_0x1f6b67+'/'+_0x57451f)['json'](_0x5d26a1);}return null;};}function patchUpdates(_0x2b9f0b){return function(_0x41675f){try{jsonpatch[_0x5393('0x1f')](_0x41675f,_0x2b9f0b,!![]);}catch(_0x25d464){return BPromise[_0x5393('0x20')](_0x25d464);}return _0x41675f[_0x5393('0x21')]();};}function saveUpdates(_0x4dd709,_0x16e628){return function(_0x269bd4){if(_0x269bd4){return _0x269bd4[_0x5393('0x22')](_0x4dd709)['then'](function(_0x560b66){return _0x560b66;});}return null;};}function removeEntity(_0x5694e2,_0x177d94){return function(_0x140974){if(_0x140974){return _0x140974['destroy']()['then'](function(){var _0x14f630=_0x140974['get']({'plain':!![]});var _0x5e2016=_0x5393('0x23');return db['UserProfileResource'][_0x5393('0x24')]({'where':{'type':_0x5e2016,'resourceId':_0x14f630['id']}})['then'](function(){return _0x140974;});})['then'](function(){_0x5694e2[_0x5393('0x18')](0xcc)[_0x5393('0x25')]();});}};}function handleEntityNotFound(_0xad3331,_0x520aec){return function(_0x48a763){if(!_0x48a763){_0xad3331[_0x5393('0x17')](0x194);}return _0x48a763;};}function handleError(_0x47b021,_0x1a2c52){_0x1a2c52=_0x1a2c52||0x1f4;return function(_0x38281e){logger['error'](_0x38281e[_0x5393('0x26')]);if(_0x38281e[_0x5393('0x27')]){delete _0x38281e['name'];}_0x47b021[_0x5393('0x18')](_0x1a2c52)[_0x5393('0x28')](_0x38281e);};}exports[_0x5393('0x29')]=function(_0x3dac2c,_0x29ee99){var _0x45d77b={},_0x1b29f0={},_0x9e26a1={'count':0x0,'rows':[]};var _0x50e9bb=_['map'](db[_0x5393('0x2a')][_0x5393('0x2b')],function(_0x1ff547){return{'name':_0x1ff547['fieldName'],'type':_0x1ff547[_0x5393('0x2c')][_0x5393('0x2d')]};});_0x1b29f0[_0x5393('0x2e')]=_[_0x5393('0x2f')](_0x50e9bb,_0x5393('0x27'));_0x1b29f0['query']=_[_0x5393('0x30')](_0x3dac2c[_0x5393('0x31')]);_0x1b29f0[_0x5393('0x32')]=_[_0x5393('0x33')](_0x1b29f0[_0x5393('0x2e')],_0x1b29f0[_0x5393('0x31')]);_0x45d77b[_0x5393('0x34')]=_[_0x5393('0x33')](_0x1b29f0['model'],qs[_0x5393('0x35')](_0x3dac2c[_0x5393('0x31')][_0x5393('0x35')]));_0x45d77b[_0x5393('0x34')]=_0x45d77b[_0x5393('0x34')][_0x5393('0x36')]?_0x45d77b['attributes']:_0x1b29f0[_0x5393('0x2e')];if(!_0x3dac2c['query'][_0x5393('0x37')]('nolimit')){_0x45d77b[_0x5393('0x1b')]=qs[_0x5393('0x1b')](_0x3dac2c[_0x5393('0x31')][_0x5393('0x1b')]);_0x45d77b[_0x5393('0x1d')]=qs[_0x5393('0x1d')](_0x3dac2c[_0x5393('0x31')][_0x5393('0x1d')]);}_0x45d77b[_0x5393('0x38')]=qs[_0x5393('0x39')](_0x3dac2c[_0x5393('0x31')][_0x5393('0x39')]);_0x45d77b[_0x5393('0x3a')]=qs[_0x5393('0x32')](_['pick'](_0x3dac2c[_0x5393('0x31')],_0x1b29f0[_0x5393('0x32')]),_0x50e9bb);if(_0x3dac2c[_0x5393('0x31')]['filter']){_0x45d77b['where']=_[_0x5393('0x3b')](_0x45d77b['where'],{'$or':_[_0x5393('0x2f')](_0x50e9bb,function(_0x5ab887){if(_0x5ab887['type']!==_0x5393('0x3c')){var _0x48d3ca={};_0x48d3ca[_0x5ab887[_0x5393('0x27')]]={'$like':'%'+_0x3dac2c[_0x5393('0x31')][_0x5393('0x3d')]+'%'};return _0x48d3ca;}})});}_0x45d77b=_[_0x5393('0x3b')]({},_0x45d77b,_0x3dac2c[_0x5393('0x3e')]);var _0x34007a={'where':_0x45d77b[_0x5393('0x3a')]};return db[_0x5393('0x2a')][_0x5393('0x1c')](_0x34007a)[_0x5393('0x3f')](function(_0x4a1d27){_0x9e26a1[_0x5393('0x1c')]=_0x4a1d27;if(_0x3dac2c[_0x5393('0x31')][_0x5393('0x40')]){_0x45d77b[_0x5393('0x41')]=[{'all':!![]}];}return db[_0x5393('0x2a')][_0x5393('0x42')](_0x45d77b);})[_0x5393('0x3f')](function(_0x32ea76){_0x9e26a1[_0x5393('0x43')]=_0x32ea76;return _0x9e26a1;})[_0x5393('0x3f')](respondWithFilteredResult(_0x29ee99,_0x45d77b))[_0x5393('0x44')](handleError(_0x29ee99,null));};exports[_0x5393('0x45')]=function(_0x45541b,_0x306704){var _0x52573b={'raw':![],'where':{'id':_0x45541b[_0x5393('0x46')]['id']}},_0x583535={};_0x583535[_0x5393('0x2e')]=_[_0x5393('0x30')](db[_0x5393('0x2a')][_0x5393('0x2b')]);_0x583535['query']=_[_0x5393('0x30')](_0x45541b[_0x5393('0x31')]);_0x583535[_0x5393('0x32')]=_['intersection'](_0x583535[_0x5393('0x2e')],_0x583535[_0x5393('0x31')]);_0x52573b['attributes']=_[_0x5393('0x33')](_0x583535[_0x5393('0x2e')],qs[_0x5393('0x35')](_0x45541b[_0x5393('0x31')][_0x5393('0x35')]));_0x52573b['attributes']=_0x52573b[_0x5393('0x34')][_0x5393('0x36')]?_0x52573b[_0x5393('0x34')]:_0x583535['model'];if(_0x45541b[_0x5393('0x31')][_0x5393('0x40')]){_0x52573b[_0x5393('0x41')]=[{'all':!![]}];}_0x52573b=_['merge']({},_0x52573b,_0x45541b[_0x5393('0x3e')]);return db[_0x5393('0x2a')][_0x5393('0x47')](_0x52573b)['then'](handleEntityNotFound(_0x306704,null))['then'](respondWithResult(_0x306704,null))[_0x5393('0x44')](handleError(_0x306704,null));};exports['create']=function(_0x527c56,_0x4b0601){return db['Schedule'][_0x5393('0x48')](_0x527c56[_0x5393('0x49')],{})['then'](function(_0xa5ab08){var _0x4ad6c1=_0x527c56[_0x5393('0x4a')]['get']({'plain':!![]});if(!_0x4ad6c1)throw new Error(_0x5393('0x4b'));if(_0x4ad6c1[_0x5393('0x4c')]===_0x5393('0x4a')){var _0x221ac8=_0xa5ab08[_0x5393('0x4d')]({'plain':!![]});var _0x30d0d1='Scheduler';return db[_0x5393('0x4e')]['find']({'where':{'name':_0x30d0d1,'userProfileId':_0x4ad6c1['userProfileId']},'raw':!![]})['then'](function(_0x52fca7){if(_0x52fca7&&_0x52fca7[_0x5393('0x4f')]===0x0){return db['UserProfileResource'][_0x5393('0x48')]({'name':_0x221ac8['name'],'resourceId':_0x221ac8['id'],'type':_0x52fca7[_0x5393('0x27')],'sectionId':_0x52fca7['id']},{})['then'](function(){return _0xa5ab08;});}else{return _0xa5ab08;}})[_0x5393('0x44')](function(_0x582a47){logger[_0x5393('0x50')](_0x5393('0x51'),_0x582a47);throw _0x582a47;});}return _0xa5ab08;})[_0x5393('0x3f')](respondWithResult(_0x4b0601,0xc9))['catch'](handleError(_0x4b0601,null));};exports[_0x5393('0x22')]=function(_0x2a97b5,_0x36a605){if(_0x2a97b5[_0x5393('0x49')]['id']){delete _0x2a97b5[_0x5393('0x49')]['id'];}return db[_0x5393('0x2a')][_0x5393('0x47')]({'where':{'id':_0x2a97b5[_0x5393('0x46')]['id']}})[_0x5393('0x3f')](handleEntityNotFound(_0x36a605,null))['then'](saveUpdates(_0x2a97b5[_0x5393('0x49')],null))[_0x5393('0x3f')](respondWithResult(_0x36a605,null))[_0x5393('0x44')](handleError(_0x36a605,null));};exports['destroy']=function(_0x317b42,_0x140406){return db[_0x5393('0x2a')][_0x5393('0x47')]({'where':{'id':_0x317b42[_0x5393('0x46')]['id']}})[_0x5393('0x3f')](handleEntityNotFound(_0x140406,null))['then'](removeEntity(_0x140406,null))[_0x5393('0x44')](handleError(_0x140406,null));};exports[_0x5393('0x52')]=function(_0x564ebf,_0x3c9c56,_0x5eed29){var _0x1c5ed8=require(_0x5393('0x53'));return db['Schedule']['find']({'where':{'id':_0x564ebf[_0x5393('0x46')]['id']},'raw':!![]})[_0x5393('0x3f')](handleEntityNotFound(_0x3c9c56,null))[_0x5393('0x3f')](function(){_0x1c5ed8[_0x5393('0x52')](_0x564ebf[_0x5393('0x46')]['id']);})['then'](respondWithStatusCode(_0x3c9c56,null))[_0x5393('0x44')](handleError(_0x3c9c56,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 171ffbe..e1fa91c 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 _0x69d6=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash'];(function(_0x288570,_0x94cce0){var _0x398255=function(_0x1fc0d5){while(--_0x1fc0d5){_0x288570['push'](_0x288570['shift']());}};_0x398255(++_0x94cce0);}(_0x69d6,0x1af));var _0x669d=function(_0x2fbba3,_0x30a7d9){_0x2fbba3=_0x2fbba3-0x0;var _0x26f102=_0x69d6[_0x2fbba3];return _0x26f102;};'use strict';var _=require(_0x669d('0x0'));var util=require('util');var logger=require(_0x669d('0x1'))(_0x669d('0x2'));var moment=require('moment');var BPromise=require(_0x669d('0x3'));var rp=require(_0x669d('0x4'));var fs=require('fs');var path=require(_0x669d('0x5'));var rimraf=require(_0x669d('0x6'));var config=require(_0x669d('0x7'));var attributes=require(_0x669d('0x8'));module[_0x669d('0x9')]=function(_0x1c8ea9,_0x3d811c){return _0x1c8ea9[_0x669d('0xa')]('Schedule',attributes,{'tableName':_0x669d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda41=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xda41,0x7f));var _0x1da4=function(_0x46ad71,_0x198df4){_0x46ad71=_0x46ad71-0x0;var _0x5756e1=_0xda41[_0x46ad71];return _0x5756e1;};'use strict';var _=require('lodash');var util=require(_0x1da4('0x0'));var logger=require(_0x1da4('0x1'))(_0x1da4('0x2'));var moment=require('moment');var BPromise=require(_0x1da4('0x3'));var rp=require(_0x1da4('0x4'));var fs=require('fs');var path=require(_0x1da4('0x5'));var rimraf=require(_0x1da4('0x6'));var config=require(_0x1da4('0x7'));var attributes=require(_0x1da4('0x8'));module[_0x1da4('0x9')]=function(_0x24f7f3,_0x47ef08){return _0x24f7f3[_0x1da4('0xa')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 8e227e6..c12873a 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 _0x2adb=['Schedule,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x540069,_0x1d488f){var _0x46d1bf=function(_0x5961bd){while(--_0x5961bd){_0x540069['push'](_0x540069['shift']());}};_0x46d1bf(++_0x1d488f);}(_0x2adb,0x15a));var _0xb2ad=function(_0x37344e,_0x4de8ff){_0x37344e=_0x37344e-0x0;var _0x25a832=_0x2adb[_0x37344e];return _0x25a832;};'use strict';var _=require(_0xb2ad('0x0'));var util=require(_0xb2ad('0x1'));var moment=require(_0xb2ad('0x2'));var BPromise=require(_0xb2ad('0x3'));var rs=require(_0xb2ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2ad('0x5'))['db'];var utils=require(_0xb2ad('0x6'));var logger=require(_0xb2ad('0x7'))(_0xb2ad('0x8'));var config=require(_0xb2ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb2ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a9f4c,_0x58058b,_0x16c4c7){return new BPromise(function(_0x2e842f,_0x55d64d){return client[_0xb2ad('0xb')](_0x3a9f4c,_0x16c4c7)[_0xb2ad('0xc')](function(_0x20618c){logger[_0xb2ad('0xd')](_0xb2ad('0xe'),_0x58058b,'request\x20sent');logger[_0xb2ad('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x58058b,_0xb2ad('0x10'),JSON['stringify'](_0x20618c));if(_0x20618c['error']){if(_0x20618c['error']['code']===0x1f4){logger[_0xb2ad('0x11')](_0xb2ad('0xe'),_0x58058b,_0x20618c[_0xb2ad('0x11')][_0xb2ad('0x12')]);return _0x55d64d(_0x20618c[_0xb2ad('0x11')][_0xb2ad('0x12')]);}logger['error'](_0xb2ad('0xe'),_0x58058b,_0x20618c[_0xb2ad('0x11')][_0xb2ad('0x12')]);return _0x2e842f(_0x20618c[_0xb2ad('0x11')][_0xb2ad('0x12')]);}else{logger[_0xb2ad('0xd')](_0xb2ad('0xe'),_0x58058b,_0xb2ad('0x10'));_0x2e842f(_0x20618c['result'][_0xb2ad('0x12')]);}})[_0xb2ad('0x13')](function(_0x240ef1){logger['error'](_0xb2ad('0xe'),_0x58058b,_0x240ef1);_0x55d64d(_0x240ef1);});});} \ No newline at end of file +var _0xb487=['util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x42a18b,_0x3d580d){var _0x5edf6b=function(_0x47894f){while(--_0x47894f){_0x42a18b['push'](_0x42a18b['shift']());}};_0x5edf6b(++_0x3d580d);}(_0xb487,0x1a1));var _0x7b48=function(_0x1cc0bf,_0x40ba50){_0x1cc0bf=_0x1cc0bf-0x0;var _0x1561b7=_0xb487[_0x1cc0bf];return _0x1561b7;};'use strict';var _=require(_0x7b48('0x0'));var util=require(_0x7b48('0x1'));var moment=require(_0x7b48('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b48('0x3'));var db=require(_0x7b48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b48('0x5'))(_0x7b48('0x6'));var config=require(_0x7b48('0x7'));var jayson=require(_0x7b48('0x8'));var client=jayson[_0x7b48('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d0f0c,_0x92d62d,_0x238f87){return new BPromise(function(_0x1835d8,_0x2b6512){return client[_0x7b48('0xa')](_0x1d0f0c,_0x238f87)[_0x7b48('0xb')](function(_0x1ede3a){logger[_0x7b48('0xc')](_0x7b48('0xd'),_0x92d62d,_0x7b48('0xe'));logger[_0x7b48('0xf')](_0x7b48('0x10'),_0x92d62d,_0x7b48('0xe'),JSON['stringify'](_0x1ede3a));if(_0x1ede3a[_0x7b48('0x11')]){if(_0x1ede3a['error'][_0x7b48('0x12')]===0x1f4){logger[_0x7b48('0x11')](_0x7b48('0xd'),_0x92d62d,_0x1ede3a[_0x7b48('0x11')][_0x7b48('0x13')]);return _0x2b6512(_0x1ede3a[_0x7b48('0x11')][_0x7b48('0x13')]);}logger['error'](_0x7b48('0xd'),_0x92d62d,_0x1ede3a[_0x7b48('0x11')][_0x7b48('0x13')]);return _0x1835d8(_0x1ede3a[_0x7b48('0x11')][_0x7b48('0x13')]);}else{logger['info'](_0x7b48('0xd'),_0x92d62d,_0x7b48('0xe'));_0x1835d8(_0x1ede3a[_0x7b48('0x14')][_0x7b48('0x13')]);}})[_0x7b48('0x15')](function(_0x120a74){logger[_0x7b48('0x11')](_0x7b48('0xd'),_0x92d62d,_0x120a74);_0x2b6512(_0x120a74);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b77ba54..d6a6d65 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 _0x6799=['/:id','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','show','/:id/download','download','post','create','put','update','delete'];(function(_0x33dda7,_0x59117d){var _0x56de5=function(_0x2e8164){while(--_0x2e8164){_0x33dda7['push'](_0x33dda7['shift']());}};_0x56de5(++_0x59117d);}(_0x6799,0xf4));var _0x9679=function(_0x32a839,_0x147cf3){_0x32a839=_0x32a839-0x0;var _0x394c91=_0x6799[_0x32a839];return _0x394c91;};'use strict';var multer=require(_0x9679('0x0'));var util=require('util');var path=require(_0x9679('0x1'));var timeout=require(_0x9679('0x2'));var express=require(_0x9679('0x3'));var router=express['Router']();var fs_extra=require(_0x9679('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9679('0x5'));var config=require(_0x9679('0x6'));var controller=require(_0x9679('0x7'));router[_0x9679('0x8')]('/',auth['isAuthenticated'](),controller[_0x9679('0x9')]);router[_0x9679('0x8')](_0x9679('0xa'),auth[_0x9679('0xb')](),controller['describe']);router[_0x9679('0x8')]('/:id',auth[_0x9679('0xb')](),controller[_0x9679('0xc')]);router[_0x9679('0x8')](_0x9679('0xd'),auth[_0x9679('0xb')](),controller[_0x9679('0xe')]);router[_0x9679('0xf')]('/',auth['isAuthenticated'](),controller[_0x9679('0x10')]);router[_0x9679('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9679('0x12')]);router[_0x9679('0x13')](_0x9679('0x14'),auth[_0x9679('0xb')](),controller['destroy']);module[_0x9679('0x15')]=router; \ No newline at end of file +var _0x462a=['util','path','connect-timeout','express','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id','show','download','post','update','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x462a,0xe0));var _0xa462=function(_0x307d2b,_0x3796e0){_0x307d2b=_0x307d2b-0x0;var _0xe82587=_0x462a[_0x307d2b];return _0xe82587;};'use strict';var multer=require('multer');var util=require(_0xa462('0x0'));var path=require(_0xa462('0x1'));var timeout=require(_0xa462('0x2'));var express=require(_0xa462('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa462('0x4'));var config=require('../../config/environment');var controller=require(_0xa462('0x5'));router['get']('/',auth[_0xa462('0x6')](),controller[_0xa462('0x7')]);router[_0xa462('0x8')](_0xa462('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa462('0xa'),auth[_0xa462('0x6')](),controller[_0xa462('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xa462('0xc')]);router[_0xa462('0xd')]('/',auth[_0xa462('0x6')](),controller['create']);router['put'](_0xa462('0xa'),auth[_0xa462('0x6')](),controller[_0xa462('0xe')]);router['delete'](_0xa462('0xa'),auth[_0xa462('0x6')](),controller['destroy']);module[_0xa462('0xf')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index db3cde9..20f3d0d 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 _0x6b19=['VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path','../../config/environment'];(function(_0x28b044,_0xed5882){var _0x3a2db5=function(_0x4eb697){while(--_0x4eb697){_0x28b044['push'](_0x28b044['shift']());}};_0x3a2db5(++_0xed5882);}(_0x6b19,0xf4));var _0x96b1=function(_0x460f0a,_0x407163){_0x460f0a=_0x460f0a-0x0;var _0x1a755c=_0x6b19[_0x460f0a];return _0x1a755c;};'use strict';var Sequelize=require(_0x96b1('0x0'));var moment=require('moment');var path=require(_0x96b1('0x1'));var config=require(_0x96b1('0x2'));module['exports']={'format':{'type':Sequelize[_0x96b1('0x3')],'get':function(){return this[_0x96b1('0x4')](_0x96b1('0x5'))?path[_0x96b1('0x6')](this['getDataValue'](_0x96b1('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x96b1('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x288d77){var _0x2347c5=_0x288d77['replace'](/\\/g,'/');this[_0x96b1('0x8')](_0x96b1('0x5'),_0x2347c5);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x96b1('0x9')],'set':function(_0x6323a6){this[_0x96b1('0x8')](_0x96b1('0xa'),moment()[_0x96b1('0xb')](_0x6323a6,'ms'));this['setDataValue'](_0x96b1('0xc'),moment());this['setDataValue']('duration',_0x6323a6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x96b1('0xa')))[_0x96b1('0xd')](_0x96b1('0xe'))[_0x96b1('0xf')]();}},'closedAt':{'type':Sequelize[_0x96b1('0x10')],'get':function(){return moment(this['getDataValue'](_0x96b1('0xc')))[_0x96b1('0xd')](_0x96b1('0xe'))[_0x96b1('0xf')]();}},'createdAt':{'type':Sequelize[_0x96b1('0x10')],'get':function(){return moment(this[_0x96b1('0x4')](_0x96b1('0x11')))[_0x96b1('0xd')](_0x96b1('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x96b1('0x10')],'get':function(){return moment(this[_0x96b1('0x4')](_0x96b1('0x12')))[_0x96b1('0xd')](_0x96b1('0xe'))[_0x96b1('0xf')]();}}}; \ No newline at end of file +var _0xfa25=['moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt'];(function(_0x4891fc,_0x520fc7){var _0x750967=function(_0x2e60ec){while(--_0x2e60ec){_0x4891fc['push'](_0x4891fc['shift']());}};_0x750967(++_0x520fc7);}(_0xfa25,0xd1));var _0x5fa2=function(_0xd49fef,_0x23f01e){_0xd49fef=_0xd49fef-0x0;var _0x304be8=_0xfa25[_0xd49fef];return _0x304be8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5fa2('0x0'));var path=require(_0x5fa2('0x1'));var config=require(_0x5fa2('0x2'));module[_0x5fa2('0x3')]={'format':{'type':Sequelize[_0x5fa2('0x4')],'get':function(){return this[_0x5fa2('0x5')](_0x5fa2('0x6'))?path[_0x5fa2('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x5fa2('0x8')]},'channel':{'type':Sequelize[_0x5fa2('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x53a560){var _0x2a9a69=_0x53a560['replace'](/\\/g,'/');this[_0x5fa2('0x9')](_0x5fa2('0x6'),_0x2a9a69);}},'rating':{'type':Sequelize[_0x5fa2('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x36778e){this[_0x5fa2('0x9')](_0x5fa2('0xb'),moment()['subtract'](_0x36778e,'ms'));this[_0x5fa2('0x9')]('closedAt',moment());this['setDataValue'](_0x5fa2('0xc'),_0x36778e);}},'startedAt':{'type':Sequelize[_0x5fa2('0xd')],'get':function(){return moment(this['getDataValue'](_0x5fa2('0xb')))[_0x5fa2('0xe')](_0x5fa2('0xf'))[_0x5fa2('0x10')]();}},'closedAt':{'type':Sequelize[_0x5fa2('0xd')],'get':function(){return moment(this[_0x5fa2('0x5')](_0x5fa2('0x11')))[_0x5fa2('0xe')](_0x5fa2('0xf'))[_0x5fa2('0x10')]();}},'createdAt':{'type':Sequelize[_0x5fa2('0xd')],'get':function(){return moment(this[_0x5fa2('0x5')](_0x5fa2('0x12')))[_0x5fa2('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x5fa2('0x10')]();}},'updatedAt':{'type':Sequelize[_0x5fa2('0xd')],'get':function(){return moment(this[_0x5fa2('0x5')]('updatedAt'))['format'](_0x5fa2('0xf'))[_0x5fa2('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 13351e2..bd3fe19 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 _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xae24,0x182));var _0x4ae2=function(_0x50190b,_0x32a71c){_0x50190b=_0x50190b-0x0;var _0x30b774=_0xae24[_0x50190b];return _0x30b774;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file +var _0x3e74=['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','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x1f0f85,_0x495e67){var _0x3a2476=function(_0x49d669){while(--_0x49d669){_0x1f0f85['push'](_0x1f0f85['shift']());}};_0x3a2476(++_0x495e67);}(_0x3e74,0x175));var _0x43e7=function(_0x5a6d43,_0x53a3aa){_0x5a6d43=_0x5a6d43-0x0;var _0x217814=_0x3e74[_0x5a6d43];return _0x217814;};'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('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 50ef285..f4ab5d9 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 _0x78b3=['rimraf','../../config/environment','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3c2a87,_0x301e33){var _0x3a4efd=function(_0x2c5e19){while(--_0x2c5e19){_0x3c2a87['push'](_0x3c2a87['shift']());}};_0x3a4efd(++_0x301e33);}(_0x78b3,0x96));var _0x378b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x378b('0x0'));var util=require(_0x378b('0x1'));var logger=require(_0x378b('0x2'))('api');var moment=require(_0x378b('0x3'));var BPromise=require(_0x378b('0x4'));var rp=require(_0x378b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x378b('0x6'));var config=require(_0x378b('0x7'));var attributes=require('./screenRecording.attributes');module[_0x378b('0x8')]=function(_0x5028ef,_0x582b3d){return _0x5028ef[_0x378b('0x9')]('ScreenRecording',attributes,{'tableName':_0x378b('0xa'),'paranoid':![],'indexes':[{'name':_0x378b('0xb'),'fields':[_0x378b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf6b=['util','api','moment','bluebird','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0xdf6b,0x16b));var _0xbdf6=function(_0x4306a4,_0x1eb882){_0x4306a4=_0x4306a4-0x0;var _0x2ec332=_0xdf6b[_0x4306a4];return _0x2ec332;};'use strict';var _=require('lodash');var util=require(_0xbdf6('0x0'));var logger=require('../../config/logger')(_0xbdf6('0x1'));var moment=require(_0xbdf6('0x2'));var BPromise=require(_0xbdf6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbdf6('0x4'));var rimraf=require('rimraf');var config=require(_0xbdf6('0x5'));var attributes=require(_0xbdf6('0x6'));module[_0xbdf6('0x7')]=function(_0x4b03a9,_0x53964c){return _0x4b03a9[_0xbdf6('0x8')](_0xbdf6('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xbdf6('0xa'),'fields':[_0xbdf6('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 89886d1..82080c5 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 _0xc360=['stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0xc360,0x148));var _0x0c36=function(_0x1795f8,_0x27fe71){_0x1795f8=_0x1795f8-0x0;var _0x3bed40=_0xc360[_0x1795f8];return _0x3bed40;};'use strict';var _=require(_0x0c36('0x0'));var util=require(_0x0c36('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c36('0x2'));var fs=require('fs');var Redis=require(_0x0c36('0x3'));var db=require(_0x0c36('0x4'))['db'];var utils=require(_0x0c36('0x5'));var logger=require('../../config/logger')(_0x0c36('0x6'));var config=require(_0x0c36('0x7'));var jayson=require(_0x0c36('0x8'));var client=jayson[_0x0c36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22eec3,_0x16656f,_0x29690c){return new BPromise(function(_0x57e526,_0x3ba6cd){return client[_0x0c36('0xa')](_0x22eec3,_0x29690c)[_0x0c36('0xb')](function(_0x121eb2){logger[_0x0c36('0xc')](_0x0c36('0xd'),_0x16656f,_0x0c36('0xe'));logger[_0x0c36('0xf')](_0x0c36('0x10'),_0x16656f,_0x0c36('0xe'),JSON[_0x0c36('0x11')](_0x121eb2));if(_0x121eb2[_0x0c36('0x12')]){if(_0x121eb2[_0x0c36('0x12')][_0x0c36('0x13')]===0x1f4){logger[_0x0c36('0x12')](_0x0c36('0xd'),_0x16656f,_0x121eb2[_0x0c36('0x12')]['message']);return _0x3ba6cd(_0x121eb2[_0x0c36('0x12')][_0x0c36('0x14')]);}logger[_0x0c36('0x12')](_0x0c36('0xd'),_0x16656f,_0x121eb2[_0x0c36('0x12')][_0x0c36('0x14')]);return _0x57e526(_0x121eb2[_0x0c36('0x12')][_0x0c36('0x14')]);}else{logger[_0x0c36('0xc')](_0x0c36('0xd'),_0x16656f,'request\x20sent');_0x57e526(_0x121eb2[_0x0c36('0x15')]['message']);}})[_0x0c36('0x16')](function(_0xb023c2){logger['error'](_0x0c36('0xd'),_0x16656f,_0xb023c2);_0x3ba6cd(_0xb023c2);});});} \ No newline at end of file +var _0x3e46=['request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ScreenRecording,\x20%s,\x20%s'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x3e46,0x17e));var _0x63e4=function(_0x1f978c,_0x2d8ead){_0x1f978c=_0x1f978c-0x0;var _0x4435cb=_0x3e46[_0x1f978c];return _0x4435cb;};'use strict';var _=require(_0x63e4('0x0'));var util=require(_0x63e4('0x1'));var moment=require(_0x63e4('0x2'));var BPromise=require(_0x63e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63e4('0x5'));var logger=require(_0x63e4('0x6'))(_0x63e4('0x7'));var config=require(_0x63e4('0x8'));var jayson=require(_0x63e4('0x9'));var client=jayson['client'][_0x63e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29b81b,_0x18a15f,_0x13e4e8){return new BPromise(function(_0x1292ad,_0x8a6659){return client[_0x63e4('0xb')](_0x29b81b,_0x13e4e8)['then'](function(_0x295c70){logger[_0x63e4('0xc')](_0x63e4('0xd'),_0x18a15f,_0x63e4('0xe'));logger[_0x63e4('0xf')](_0x63e4('0x10'),_0x18a15f,_0x63e4('0xe'),JSON[_0x63e4('0x11')](_0x295c70));if(_0x295c70[_0x63e4('0x12')]){if(_0x295c70[_0x63e4('0x12')][_0x63e4('0x13')]===0x1f4){logger[_0x63e4('0x12')](_0x63e4('0xd'),_0x18a15f,_0x295c70[_0x63e4('0x12')][_0x63e4('0x14')]);return _0x8a6659(_0x295c70[_0x63e4('0x12')][_0x63e4('0x14')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x18a15f,_0x295c70['error'][_0x63e4('0x14')]);return _0x1292ad(_0x295c70[_0x63e4('0x12')]['message']);}else{logger[_0x63e4('0xc')](_0x63e4('0xd'),_0x18a15f,_0x63e4('0xe'));_0x1292ad(_0x295c70[_0x63e4('0x15')][_0x63e4('0x14')]);}})['catch'](function(_0x11ad46){logger[_0x63e4('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x18a15f,_0x11ad46);_0x8a6659(_0x11ad46);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index dbbbb61..2745611 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 _0x043b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','/now','/:id','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','/:id/logo','single','file','addLogo','logologin','extname','preferred','addPreferred','favicon','addFavicon','put','update','multer','util','express','Router'];(function(_0x4375fa,_0x53eb03){var _0x5c7222=function(_0x29399c){while(--_0x29399c){_0x4375fa['push'](_0x4375fa['shift']());}};_0x5c7222(++_0x53eb03);}(_0x043b,0xa0));var _0xb043=function(_0x30c8af,_0x465307){_0x30c8af=_0x30c8af-0x0;var _0x1b8e52=_0x043b[_0x30c8af];return _0x1b8e52;};'use strict';var multer=require(_0xb043('0x0'));var util=require(_0xb043('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb043('0x2'));var router=express[_0xb043('0x3')]();var fs_extra=require(_0xb043('0x4'));var auth=require(_0xb043('0x5'));var interaction=require(_0xb043('0x6'));var config=require(_0xb043('0x7'));var controller=require(_0xb043('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb043('0x9')](_0xb043('0xa'),controller['getDate']);router[_0xb043('0x9')](_0xb043('0xb'),controller[_0xb043('0xc')]);router[_0xb043('0x9')]('/:id/logo',controller[_0xb043('0xd')]);router['get'](_0xb043('0xe'),controller[_0xb043('0xf')]);router['get']('/:id/gdpr',controller[_0xb043('0x10')]);router[_0xb043('0x9')](_0xb043('0x11'),controller[_0xb043('0x12')]);router[_0xb043('0x9')](_0xb043('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0xb043('0x14')]({'destination':function(_0x2b5630,_0x48a763,_0x2c87f2){_0x2c87f2(null,path[_0xb043('0x15')](config[_0xb043('0x16')],_0xb043('0x17')));},'filename':function(_0x41d9ed,_0x1ab913,_0x484939){_0x484939(null,util[_0xb043('0x18')](_0xb043('0x19'),_0xb043('0x1a'),path['extname'](_0x1ab913[_0xb043('0x1b')])));}})});router[_0xb043('0x1c')](_0xb043('0x1d'),upload[_0xb043('0x1e')](_0xb043('0x1f')),controller[_0xb043('0x20')]);var upload=multer({'storage':multer[_0xb043('0x14')]({'destination':function(_0x304394,_0x59ab81,_0xc24240){_0xc24240(null,path[_0xb043('0x15')](config['root'],_0xb043('0x17')));},'filename':function(_0x2adae5,_0x31d6df,_0x32e1b2){_0x32e1b2(null,util[_0xb043('0x18')](_0xb043('0x19'),_0xb043('0x21'),path[_0xb043('0x22')](_0x31d6df[_0xb043('0x1b')])));}})});router['post']('/:id/logo_login',upload[_0xb043('0x1e')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4063dc,_0xf63fe4,_0x517c8d){_0x517c8d(null,path['join'](config[_0xb043('0x16')],_0xb043('0x17')));},'filename':function(_0x40d2f1,_0xd1a59d,_0x439fe8){_0x439fe8(null,util[_0xb043('0x18')](_0xb043('0x19'),_0xb043('0x23'),path['extname'](_0xd1a59d['originalname'])));}})});router[_0xb043('0x1c')]('/:id/preferred',upload[_0xb043('0x1e')](_0xb043('0x1f')),controller[_0xb043('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x223cba,_0x3452a9,_0xaf560b){_0xaf560b(null,path[_0xb043('0x15')](config[_0xb043('0x16')],'server/files/images/logos/'));},'filename':function(_0xf7e273,_0x3d35d8,_0x6c933b){_0x6c933b(null,util[_0xb043('0x18')](_0xb043('0x19'),_0xb043('0x25'),path['extname'](_0x3d35d8[_0xb043('0x1b')])));}})});router[_0xb043('0x1c')]('/:id/favicon',upload[_0xb043('0x1e')](_0xb043('0x1f')),controller[_0xb043('0x26')]);router[_0xb043('0x27')](_0xb043('0xb'),auth['isAuthenticated'](),controller[_0xb043('0x28')]);module['exports']=router; \ No newline at end of file +var _0x1fac=['root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','addLogo','logologin','format','preferred','file','addPreferred','favicon','/:id','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join'];(function(_0xe06e0e,_0x4290af){var _0x129bd9=function(_0x2b111c){while(--_0x2b111c){_0xe06e0e['push'](_0xe06e0e['shift']());}};_0x129bd9(++_0x4290af);}(_0x1fac,0xdf));var _0xc1fa=function(_0x16e6f,_0x8ff147){_0x16e6f=_0x16e6f-0x0;var _0x500fc6=_0x1fac[_0x16e6f];return _0x500fc6;};'use strict';var multer=require(_0xc1fa('0x0'));var util=require(_0xc1fa('0x1'));var path=require('path');var timeout=require(_0xc1fa('0x2'));var express=require('express');var router=express[_0xc1fa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc1fa('0x4'));var interaction=require(_0xc1fa('0x5'));var config=require(_0xc1fa('0x6'));var controller=require('./setting.controller');router[_0xc1fa('0x7')]('/',auth[_0xc1fa('0x8')](),controller[_0xc1fa('0x9')]);router[_0xc1fa('0x7')](_0xc1fa('0xa'),controller[_0xc1fa('0xb')]);router[_0xc1fa('0x7')]('/:id',controller[_0xc1fa('0xc')]);router[_0xc1fa('0x7')](_0xc1fa('0xd'),controller[_0xc1fa('0xe')]);router[_0xc1fa('0x7')](_0xc1fa('0xf'),controller[_0xc1fa('0x10')]);router[_0xc1fa('0x7')]('/:id/gdpr',controller[_0xc1fa('0x11')]);router[_0xc1fa('0x7')](_0xc1fa('0x12'),controller['getPreferred']);router['get'](_0xc1fa('0x13'),controller[_0xc1fa('0x14')]);var upload=multer({'storage':multer[_0xc1fa('0x15')]({'destination':function(_0x365c30,_0x39d2f6,_0x7652f4){_0x7652f4(null,path[_0xc1fa('0x16')](config[_0xc1fa('0x17')],_0xc1fa('0x18')));},'filename':function(_0x32ac7e,_0x20448b,_0x53089d){_0x53089d(null,util['format'](_0xc1fa('0x19'),_0xc1fa('0x1a'),path[_0xc1fa('0x1b')](_0x20448b[_0xc1fa('0x1c')])));}})});router[_0xc1fa('0x1d')](_0xc1fa('0xd'),upload[_0xc1fa('0x1e')]('file'),controller[_0xc1fa('0x1f')]);var upload=multer({'storage':multer[_0xc1fa('0x15')]({'destination':function(_0x3f9c90,_0x1973e3,_0x4b5488){_0x4b5488(null,path['join'](config[_0xc1fa('0x17')],_0xc1fa('0x18')));},'filename':function(_0x14373b,_0xf2fda5,_0x5d1b1b){_0x5d1b1b(null,util['format']('%s%s',_0xc1fa('0x20'),path[_0xc1fa('0x1b')](_0xf2fda5[_0xc1fa('0x1c')])));}})});router[_0xc1fa('0x1d')]('/:id/logo_login',upload[_0xc1fa('0x1e')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc1fa('0x15')]({'destination':function(_0x7d10a6,_0x46eed5,_0x142e53){_0x142e53(null,path['join'](config[_0xc1fa('0x17')],_0xc1fa('0x18')));},'filename':function(_0x3584f3,_0x3ffec5,_0x18017a){_0x18017a(null,util[_0xc1fa('0x21')](_0xc1fa('0x19'),_0xc1fa('0x22'),path[_0xc1fa('0x1b')](_0x3ffec5[_0xc1fa('0x1c')])));}})});router[_0xc1fa('0x1d')](_0xc1fa('0x12'),upload['single'](_0xc1fa('0x23')),controller[_0xc1fa('0x24')]);var upload=multer({'storage':multer[_0xc1fa('0x15')]({'destination':function(_0x47a8de,_0x37ee57,_0x15eb95){_0x15eb95(null,path['join'](config[_0xc1fa('0x17')],_0xc1fa('0x18')));},'filename':function(_0x57359e,_0xd30b5b,_0x47cba1){_0x47cba1(null,util['format']('%s%s',_0xc1fa('0x25'),path[_0xc1fa('0x1b')](_0xd30b5b['originalname'])));}})});router[_0xc1fa('0x1d')](_0xc1fa('0x13'),upload[_0xc1fa('0x1e')](_0xc1fa('0x23')),controller['addFavicon']);router['put'](_0xc1fa('0x26'),auth['isAuthenticated'](),controller[_0xc1fa('0x27')]);module[_0xc1fa('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c424668..67147ba 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 _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x1faae7,_0x1c1ec8){var _0x3630be=function(_0x89d9e1){while(--_0x89d9e1){_0x1faae7['push'](_0x1faae7['shift']());}};_0x3630be(++_0x1c1ec8);}(_0x1261,0x144));var _0x1126=function(_0x5530a9,_0x48e4c2){_0x5530a9=_0x5530a9-0x0;var _0x1c69f4=_0x1261[_0x5530a9];return _0x1c69f4;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x519b55,_0x1597a7){var _0x5baf3d=function(_0x5d3901){while(--_0x5d3901){_0x519b55['push'](_0x519b55['shift']());}};_0x5baf3d(++_0x1597a7);}(_0x1261,0x144));var _0x1126=function(_0x539fb2,_0x5b6718){_0x539fb2=_0x539fb2-0x0;var _0x4d583d=_0x1261[_0x539fb2];return _0x4d583d;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('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 8aced4b..afb01d0 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 _0xca9e=['fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','preferred','defaultLogo','default_loginLogo.svg','download','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','stack','name','send','Setting','type','key','map','query','intersection','model','attributes'];(function(_0x46306c,_0x1cb39c){var _0x423037=function(_0x5bf938){while(--_0x5bf938){_0x46306c['push'](_0x46306c['shift']());}};_0x423037(++_0x1cb39c);}(_0xca9e,0x136));var _0xeca9=function(_0x37f083,_0x26bb8){_0x37f083=_0x37f083-0x0;var _0x4b2482=_0xca9e[_0x37f083];return _0x4b2482;};'use strict';var emlformat=require(_0xeca9('0x0'));var rimraf=require(_0xeca9('0x1'));var zipdir=require(_0xeca9('0x2'));var jsonpatch=require(_0xeca9('0x3'));var rp=require(_0xeca9('0x4'));var moment=require(_0xeca9('0x5'));var BPromise=require(_0xeca9('0x6'));var Mustache=require(_0xeca9('0x7'));var util=require(_0xeca9('0x8'));var path=require(_0xeca9('0x9'));var sox=require(_0xeca9('0xa'));var csv=require(_0xeca9('0xb'));var ejs=require(_0xeca9('0xc'));var fs=require('fs');var fs_extra=require(_0xeca9('0xd'));var _=require('lodash');var squel=require(_0xeca9('0xe'));var crypto=require(_0xeca9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeca9('0xb'));var querystring=require(_0xeca9('0x10'));var Papa=require(_0xeca9('0x11'));var Redis=require('ioredis');var authService=require(_0xeca9('0x12'));var qs=require(_0xeca9('0x13'));var as=require(_0xeca9('0x14'));var hardwareService=require(_0xeca9('0x15'));var logger=require(_0xeca9('0x16'))(_0xeca9('0x17'));var utils=require('../../config/utils');var config=require(_0xeca9('0x18'));var licenseUtil=require(_0xeca9('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xeca9('0x1a'));var client=jayson['client'][_0xeca9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5e7e73,_0x543958,_0x3e9377,_0x384ae2){return new BPromise(function(_0x1ba9e9,_0x4d65ee){var _0x57150b=_0x384ae2||client;return _0x57150b[_0xeca9('0x1c')](_0x5e7e73,_0x3e9377)[_0xeca9('0x1d')](function(_0x6e9fd4){logger['info']('Setting,\x20%s,\x20%s',_0x543958,_0xeca9('0x1e'));logger[_0xeca9('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x543958,_0xeca9('0x1e'),JSON[_0xeca9('0x20')](_0x6e9fd4));if(_0x6e9fd4['error']){if(_0x6e9fd4['error']['code']===0x1f4){logger[_0xeca9('0x21')](_0xeca9('0x22'),_0x543958,_0x6e9fd4[_0xeca9('0x21')]['message']);return _0x4d65ee(_0x6e9fd4[_0xeca9('0x21')]['message']);}logger['error'](_0xeca9('0x22'),_0x543958,_0x6e9fd4['error'][_0xeca9('0x23')]);return _0x1ba9e9(_0x6e9fd4[_0xeca9('0x21')]['message']);}else{logger[_0xeca9('0x24')](_0xeca9('0x22'),_0x543958,'request\x20sent');_0x1ba9e9(_0x6e9fd4[_0xeca9('0x25')]['message']);}})[_0xeca9('0x26')](function(_0x111f61){logger[_0xeca9('0x21')]('Setting,\x20%s,\x20%s',_0x543958,_0x111f61);_0x4d65ee(_0x111f61);});});}function respondWithStatusCode(_0x3fcfb8,_0x466883){_0x466883=_0x466883||0xcc;return function(_0x515e63){if(_0x515e63){return _0x3fcfb8[_0xeca9('0x27')](_0x466883);}return _0x3fcfb8[_0xeca9('0x28')](_0x466883)[_0xeca9('0x29')]();};}function respondWithResult(_0x26bb0c,_0x498f4a){_0x498f4a=_0x498f4a||0xc8;return function(_0x32699b){if(_0x32699b){return _0x26bb0c['status'](_0x498f4a)[_0xeca9('0x2a')](_0x32699b);}};}function respondWithFilteredResult(_0x251ce4,_0x1702fb){return function(_0x3e41df){if(_0x3e41df){var _0x25eac6=typeof _0x1702fb[_0xeca9('0x2b')]===_0xeca9('0x2c')&&typeof _0x1702fb[_0xeca9('0x2d')]===_0xeca9('0x2c');var _0x271720=_0x3e41df[_0xeca9('0x2e')];var _0x3b0aab=_0x25eac6?0x0:_0x1702fb[_0xeca9('0x2b')];var _0x1436d0=_0x25eac6?_0x3e41df[_0xeca9('0x2e')]:_0x1702fb['offset']+_0x1702fb['limit'];var _0x4c9b32;if(_0x1436d0>=_0x271720){_0x1436d0=_0x271720;_0x4c9b32=0xc8;}else{_0x4c9b32=0xce;}_0x251ce4[_0xeca9('0x28')](_0x4c9b32);return _0x251ce4['set'](_0xeca9('0x2f'),_0x3b0aab+'-'+_0x1436d0+'/'+_0x271720)[_0xeca9('0x2a')](_0x3e41df);}return null;};}function patchUpdates(_0x2898dc){return function(_0x36e75e){try{jsonpatch[_0xeca9('0x30')](_0x36e75e,_0x2898dc,!![]);}catch(_0x2d263a){return BPromise['reject'](_0x2d263a);}return _0x36e75e[_0xeca9('0x31')]();};}function saveUpdates(_0x5d2451,_0x43fbff){return function(_0x23a5fe){if(_0x23a5fe){return _0x23a5fe[_0xeca9('0x32')](_0x5d2451)['then'](function(_0x21357d){return _0x21357d;});}return null;};}function removeEntity(_0x33c4e0,_0x20cd78){return function(_0x3a65a6){if(_0x3a65a6){return _0x3a65a6['destroy']()[_0xeca9('0x1d')](function(){_0x33c4e0['status'](0xcc)[_0xeca9('0x29')]();});}};}function handleEntityNotFound(_0x42983f,_0x20c89d){return function(_0x462655){if(!_0x462655){_0x42983f[_0xeca9('0x27')](0x194);}return _0x462655;};}function handleError(_0x3afdbd,_0x565912){_0x565912=_0x565912||0x1f4;return function(_0x41ef3c){logger[_0xeca9('0x21')](_0x41ef3c[_0xeca9('0x33')]);if(_0x41ef3c[_0xeca9('0x34')]){delete _0x41ef3c[_0xeca9('0x34')];}_0x3afdbd[_0xeca9('0x28')](_0x565912)[_0xeca9('0x35')](_0x41ef3c);};}exports['index']=function(_0x3946e5,_0x1a27f9){var _0x859deb={},_0x178bd4={},_0x3995fd={'count':0x0,'rows':[]};var _0x1eeb0a=_['map'](db[_0xeca9('0x36')]['rawAttributes'],function(_0x2fbd69){return{'name':_0x2fbd69['fieldName'],'type':_0x2fbd69[_0xeca9('0x37')][_0xeca9('0x38')]};});_0x178bd4['model']=_[_0xeca9('0x39')](_0x1eeb0a,'name');_0x178bd4[_0xeca9('0x3a')]=_['keys'](_0x3946e5[_0xeca9('0x3a')]);_0x178bd4['filters']=_[_0xeca9('0x3b')](_0x178bd4[_0xeca9('0x3c')],_0x178bd4['query']);_0x859deb[_0xeca9('0x3d')]=_[_0xeca9('0x3b')](_0x178bd4['model'],qs[_0xeca9('0x3e')](_0x3946e5[_0xeca9('0x3a')][_0xeca9('0x3e')]));_0x859deb[_0xeca9('0x3d')]=_0x859deb[_0xeca9('0x3d')][_0xeca9('0x3f')]?_0x859deb[_0xeca9('0x3d')]:_0x178bd4[_0xeca9('0x3c')];if(!_0x3946e5[_0xeca9('0x3a')]['hasOwnProperty'](_0xeca9('0x40'))){_0x859deb[_0xeca9('0x2d')]=qs[_0xeca9('0x2d')](_0x3946e5[_0xeca9('0x3a')][_0xeca9('0x2d')]);_0x859deb[_0xeca9('0x2b')]=qs[_0xeca9('0x2b')](_0x3946e5['query'][_0xeca9('0x2b')]);}_0x859deb[_0xeca9('0x41')]=qs[_0xeca9('0x42')](_0x3946e5[_0xeca9('0x3a')][_0xeca9('0x42')]);_0x859deb['where']=qs[_0xeca9('0x43')](_[_0xeca9('0x44')](_0x3946e5[_0xeca9('0x3a')],_0x178bd4[_0xeca9('0x43')]),_0x1eeb0a);if(_0x3946e5['query'][_0xeca9('0x45')]){_0x859deb[_0xeca9('0x46')]=_['merge'](_0x859deb[_0xeca9('0x46')],{'$or':_[_0xeca9('0x39')](_0x1eeb0a,function(_0x3b238a){if(_0x3b238a[_0xeca9('0x37')]!==_0xeca9('0x47')){var _0x2da3fc={};_0x2da3fc[_0x3b238a[_0xeca9('0x34')]]={'$like':'%'+_0x3946e5[_0xeca9('0x3a')][_0xeca9('0x45')]+'%'};return _0x2da3fc;}})});}_0x859deb=_[_0xeca9('0x48')]({},_0x859deb,_0x3946e5[_0xeca9('0x49')]);var _0x22599e={'where':_0x859deb[_0xeca9('0x46')]};return db[_0xeca9('0x36')][_0xeca9('0x2e')](_0x22599e)['then'](function(_0x2a4051){_0x3995fd[_0xeca9('0x2e')]=_0x2a4051;if(_0x3946e5[_0xeca9('0x3a')][_0xeca9('0x4a')]){_0x859deb['include']=[{'all':!![]}];}return db[_0xeca9('0x36')][_0xeca9('0x4b')](_0x859deb);})['then'](function(_0x5e6dc2){_0x3995fd[_0xeca9('0x4c')]=_0x5e6dc2;return _0x3995fd;})[_0xeca9('0x1d')](respondWithFilteredResult(_0x1a27f9,_0x859deb))[_0xeca9('0x26')](handleError(_0x1a27f9,null));};exports[_0xeca9('0x4d')]=function(_0x571e48,_0x2da2c2){var _0xa4faf9={'raw':![],'where':{'id':_0x571e48[_0xeca9('0x4e')]['id']}},_0x346c62={};_0x346c62[_0xeca9('0x3c')]=_[_0xeca9('0x4f')](db[_0xeca9('0x36')][_0xeca9('0x50')]);_0x346c62[_0xeca9('0x3a')]=_['keys'](_0x571e48['query']);_0x346c62[_0xeca9('0x43')]=_[_0xeca9('0x3b')](_0x346c62['model'],_0x346c62[_0xeca9('0x3a')]);_0xa4faf9[_0xeca9('0x3d')]=_[_0xeca9('0x3b')](_0x346c62[_0xeca9('0x3c')],qs[_0xeca9('0x3e')](_0x571e48[_0xeca9('0x3a')][_0xeca9('0x3e')]));_0xa4faf9[_0xeca9('0x3d')]=_0xa4faf9[_0xeca9('0x3d')]['length']?_0xa4faf9['attributes']:_0x346c62['model'];if(_0x571e48['query'][_0xeca9('0x4a')]){_0xa4faf9['include']=[{'all':!![]}];}_0xa4faf9=_[_0xeca9('0x48')]({},_0xa4faf9,_0x571e48[_0xeca9('0x49')]);return db['Setting'][_0xeca9('0x51')](_0xa4faf9)[_0xeca9('0x1d')](handleEntityNotFound(_0x2da2c2,null))[_0xeca9('0x1d')](respondWithResult(_0x2da2c2,null))['catch'](handleError(_0x2da2c2,null));};exports['update']=function(_0x258aee,_0xe98d30){if(_0x258aee[_0xeca9('0x52')]['id']){delete _0x258aee[_0xeca9('0x52')]['id'];}return db['Setting'][_0xeca9('0x51')]({'where':{'id':_0x258aee[_0xeca9('0x4e')]['id']}})[_0xeca9('0x1d')](handleEntityNotFound(_0xe98d30,null))[_0xeca9('0x1d')](saveUpdates(_0x258aee[_0xeca9('0x52')],null))[_0xeca9('0x1d')](respondWithResult(_0xe98d30,null))[_0xeca9('0x26')](handleError(_0xe98d30,null));};exports[_0xeca9('0x53')]=function(_0x2000d0,_0x10a5a0,_0x25847d){if(_0x2000d0[_0xeca9('0x54')]&&_0x2000d0[_0xeca9('0x54')][_0xeca9('0x55')]){_0x2000d0[_0xeca9('0x52')][_0xeca9('0x56')]=_0x2000d0['file'][_0xeca9('0x55')];}return db[_0xeca9('0x36')][_0xeca9('0x51')]({'where':{'id':_0x2000d0[_0xeca9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10a5a0,null))[_0xeca9('0x1d')](saveUpdates(_0x2000d0[_0xeca9('0x52')],null))['then'](respondWithResult(_0x10a5a0,null))[_0xeca9('0x26')](handleError(_0x10a5a0,null));};exports[_0xeca9('0x57')]=function(_0xdf4486,_0x2f905f,_0x35be0f){if(_0xdf4486['file']&&_0xdf4486[_0xeca9('0x54')][_0xeca9('0x55')]){_0xdf4486['body'][_0xeca9('0x58')]=_0xdf4486[_0xeca9('0x54')][_0xeca9('0x55')];}return db[_0xeca9('0x36')][_0xeca9('0x51')]({'where':{'id':_0xdf4486[_0xeca9('0x4e')]['id']}})[_0xeca9('0x1d')](handleEntityNotFound(_0x2f905f,null))[_0xeca9('0x1d')](saveUpdates(_0xdf4486['body'],null))['then'](respondWithResult(_0x2f905f,null))['catch'](handleError(_0x2f905f,null));};var utilLicense=require(_0xeca9('0x19'));exports[_0xeca9('0x59')]=function(_0xce6cfd,_0x47a454,_0x970996){var _0x23e263=_0xeca9('0x5a');var _0x302957={'custom':![]};return utilLicense[_0xeca9('0x5b')]()[_0xeca9('0x1d')](function(_0x23500b){if(_0x23500b){_0x302957=_0x23500b;}return db['Setting']['find']({'where':{'id':_0xce6cfd['params']['id']},'attributes':[_0xeca9('0x56'),_0xeca9('0x58'),'preferred',_0xeca9('0x5c'),'defaultLogo',_0xeca9('0x5d'),_0xeca9('0x5e'),_0xeca9('0x5f')],'raw':!![]});})[_0xeca9('0x1d')](handleEntityNotFound(_0x47a454,null))[_0xeca9('0x1d')](function(_0x5381fe){if(_0x5381fe){var _0xff9db0=_0x5381fe[_0xeca9('0x56')]&&fs[_0xeca9('0x60')](path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0x23e263,_[_0xeca9('0x63')](_0x5381fe[_0xeca9('0x56')])))?path[_0xeca9('0x61')](config['root'],_0x23e263,_[_0xeca9('0x63')](_0x5381fe['logo'])):path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0x23e263,_[_0xeca9('0x63')](_0xeca9('0x64')));var _0x4126a2=_0xeca9('0x65')+_['upperFirst'](_0xeca9('0x56'));if(_0x5381fe[_0x4126a2]||!_0x302957[_0xeca9('0x66')]){_0xff9db0=path[_0xeca9('0x61')](config['root'],_0x23e263,_[_0xeca9('0x63')](_0xeca9('0x64')));}if(!fs[_0xeca9('0x60')](_0xff9db0)){throw new db[(_0xeca9('0x67'))][(_0xeca9('0x68'))](_[_0xeca9('0x69')](_0xeca9('0x56'))+_0xeca9('0x6a'));}return _0x47a454['download'](_0xff9db0);}})[_0xeca9('0x26')](handleError(_0x47a454,null));};var utilLicense=require(_0xeca9('0x19'));exports[_0xeca9('0x6b')]=function(_0x2cf5bc,_0x44a85b,_0x5da686){var _0x5226dd=_0xeca9('0x5a');var _0x9f078b={'custom':![]};return utilLicense[_0xeca9('0x5b')]()[_0xeca9('0x1d')](function(_0x5b0b1a){if(_0x5b0b1a){_0x9f078b=_0x5b0b1a;}return db[_0xeca9('0x36')][_0xeca9('0x51')]({'where':{'id':_0x2cf5bc[_0xeca9('0x4e')]['id']},'attributes':[_0xeca9('0x56'),_0xeca9('0x58'),_0xeca9('0x6c'),_0xeca9('0x5c'),_0xeca9('0x6d'),_0xeca9('0x5d'),_0xeca9('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xeca9('0x1d')](handleEntityNotFound(_0x44a85b,null))[_0xeca9('0x1d')](function(_0x9b5506){if(_0x9b5506){var _0x4a2f6f=_0x9b5506['loginLogo']&&fs['existsSync'](path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0x5226dd,_['toLower'](_0x9b5506[_0xeca9('0x58')])))?path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0x5226dd,_[_0xeca9('0x63')](_0x9b5506['loginLogo'])):path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0x5226dd,_['toLower']('default_loginLogo.svg'));var _0x5b9039=_0xeca9('0x65')+_[_0xeca9('0x69')](_0xeca9('0x58'));if(_0x9b5506[_0x5b9039]||!_0x9f078b['custom']){_0x4a2f6f=path[_0xeca9('0x61')](config['root'],_0x5226dd,_[_0xeca9('0x63')](_0xeca9('0x6e')));}if(!fs[_0xeca9('0x60')](_0x4a2f6f)){throw new db[(_0xeca9('0x67'))][(_0xeca9('0x68'))](_['upperFirst'](_0xeca9('0x58'))+'\x20not\x20found');}return _0x44a85b[_0xeca9('0x6f')](_0x4a2f6f);}})['catch'](handleError(_0x44a85b,null));};exports['gdpr']=function(_0x5bb011,_0x4ecec4){return db['Setting'][_0xeca9('0x51')]({'where':{'id':_0x5bb011[_0xeca9('0x4e')]['id']},'attributes':[_0xeca9('0x70')]})[_0xeca9('0x1d')](respondWithResult(_0x4ecec4,null))[_0xeca9('0x26')](handleError(_0x4ecec4,null));};exports[_0xeca9('0x71')]=function(_0x5aac23,_0x1f454f,_0xd0c575){if(_0x5aac23[_0xeca9('0x54')]&&_0x5aac23[_0xeca9('0x54')][_0xeca9('0x55')]){_0x5aac23[_0xeca9('0x52')][_0xeca9('0x6c')]=_0x5aac23[_0xeca9('0x54')]['filename'];}return db[_0xeca9('0x36')][_0xeca9('0x51')]({'where':{'id':_0x5aac23[_0xeca9('0x4e')]['id']}})[_0xeca9('0x1d')](handleEntityNotFound(_0x1f454f,null))[_0xeca9('0x1d')](saveUpdates(_0x5aac23['body'],null))[_0xeca9('0x1d')](respondWithResult(_0x1f454f,null))[_0xeca9('0x26')](handleError(_0x1f454f,null));};var utilLicense=require(_0xeca9('0x19'));exports[_0xeca9('0x72')]=function(_0x2406ec,_0x5573b7,_0x4ad1ef){var _0xed2eb9=_0xeca9('0x5a');var _0x4554ab={'custom':![]};return utilLicense[_0xeca9('0x5b')]()[_0xeca9('0x1d')](function(_0x1f7d11){if(_0x1f7d11){_0x4554ab=_0x1f7d11;}return db['Setting'][_0xeca9('0x51')]({'where':{'id':_0x2406ec[_0xeca9('0x4e')]['id']},'attributes':[_0xeca9('0x56'),_0xeca9('0x58'),_0xeca9('0x6c'),_0xeca9('0x5c'),_0xeca9('0x6d'),_0xeca9('0x5d'),_0xeca9('0x5e'),_0xeca9('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5573b7,null))[_0xeca9('0x1d')](function(_0x3cb07b){if(_0x3cb07b){var _0x460575=_0x3cb07b[_0xeca9('0x6c')]&&fs['existsSync'](path['join'](config['root'],_0xed2eb9,_[_0xeca9('0x63')](_0x3cb07b[_0xeca9('0x6c')])))?path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0xed2eb9,_[_0xeca9('0x63')](_0x3cb07b[_0xeca9('0x6c')])):path[_0xeca9('0x61')](config['root'],_0xed2eb9,_[_0xeca9('0x63')](_0xeca9('0x73')));var _0x5e74cc=_0xeca9('0x65')+_[_0xeca9('0x69')](_0xeca9('0x6c'));if(_0x3cb07b[_0x5e74cc]||!_0x4554ab[_0xeca9('0x66')]||!_0x4554ab['preferred']){_0x460575=path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0xed2eb9,_[_0xeca9('0x63')](_0xeca9('0x73')));}if(!fs['existsSync'](_0x460575)){throw new db[(_0xeca9('0x67'))][(_0xeca9('0x68'))](_[_0xeca9('0x69')](_0xeca9('0x6c'))+_0xeca9('0x6a'));}return _0x5573b7['download'](_0x460575);}})[_0xeca9('0x26')](handleError(_0x5573b7,null));};exports[_0xeca9('0x74')]=function(_0x517a3b,_0x482561,_0x42cbf0){if(_0x517a3b['file']&&_0x517a3b[_0xeca9('0x54')][_0xeca9('0x55')]){_0x517a3b[_0xeca9('0x52')][_0xeca9('0x5c')]=_0x517a3b[_0xeca9('0x54')]['filename'];}return db[_0xeca9('0x36')][_0xeca9('0x51')]({'where':{'id':_0x517a3b[_0xeca9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x482561,null))[_0xeca9('0x1d')](saveUpdates(_0x517a3b[_0xeca9('0x52')],null))[_0xeca9('0x1d')](respondWithResult(_0x482561,null))[_0xeca9('0x26')](handleError(_0x482561,null));};var utilLicense=require('../../config/license/util');exports[_0xeca9('0x75')]=function(_0x376cb6,_0x149a98,_0x597875){var _0xf78afb=_0xeca9('0x5a');var _0x209505={'custom':![]};return utilLicense[_0xeca9('0x5b')]()[_0xeca9('0x1d')](function(_0x460f27){if(_0x460f27){_0x209505=_0x460f27;}return db['Setting'][_0xeca9('0x51')]({'where':{'id':_0x376cb6[_0xeca9('0x4e')]['id']},'attributes':['logo','loginLogo',_0xeca9('0x6c'),'favicon',_0xeca9('0x6d'),_0xeca9('0x5d'),_0xeca9('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xeca9('0x1d')](handleEntityNotFound(_0x149a98,null))[_0xeca9('0x1d')](function(_0x1f6e53){if(_0x1f6e53){var _0x297d7f=_0x1f6e53[_0xeca9('0x5c')]&&fs['existsSync'](path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0xf78afb,_[_0xeca9('0x63')](_0x1f6e53[_0xeca9('0x5c')])))?path[_0xeca9('0x61')](config[_0xeca9('0x62')],_0xf78afb,_[_0xeca9('0x63')](_0x1f6e53['favicon'])):path[_0xeca9('0x61')](config['root'],_0xf78afb,_[_0xeca9('0x63')](_0xeca9('0x76')));var _0x39fd82=_0xeca9('0x65')+_[_0xeca9('0x69')](_0xeca9('0x5c'));if(_0x1f6e53[_0x39fd82]||!_0x209505[_0xeca9('0x66')]){_0x297d7f=path['join'](config['root'],_0xf78afb,_['toLower']('default_favicon.ico'));}if(!fs[_0xeca9('0x60')](_0x297d7f)){throw new db['Sequelize'][(_0xeca9('0x68'))](_[_0xeca9('0x69')]('favicon')+_0xeca9('0x6a'));}return _0x149a98[_0xeca9('0x6f')](_0x297d7f);}})[_0xeca9('0x26')](handleError(_0x149a98,null));};exports[_0xeca9('0x77')]=function(_0x114d4d,_0x3f3002){var _0x2aa409={'offset':moment()['utcOffset']()};_0x2aa409[_0xeca9('0x78')]=moment()[_0xeca9('0x79')](_0x2aa409[_0xeca9('0x2b')])[_0xeca9('0x7a')](_0xeca9('0x7b'));return _0x3f3002['status'](0xc8)[_0xeca9('0x35')](_0x2aa409);}; \ No newline at end of file +var _0xf7d5=['bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Setting','findAll','rows','catch','show','params','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','toLower','join','root','default_logo.svg','default','upperFirst','custom','existsSync','\x20not\x20found','download','server/files/images/logos','defaultLogo','default_loginLogo.svg','Sequelize','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','eml-format','zip-dir','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf7d5,0x16b));var _0x5f7d=function(_0x4b352f,_0x2c3ac1){_0x4b352f=_0x4b352f-0x0;var _0xb78495=_0xf7d5[_0x4b352f];return _0xb78495;};'use strict';var emlformat=require(_0x5f7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f7d('0x2'));var moment=require('moment');var BPromise=require(_0x5f7d('0x3'));var Mustache=require(_0x5f7d('0x4'));var util=require(_0x5f7d('0x5'));var path=require(_0x5f7d('0x6'));var sox=require('sox');var csv=require(_0x5f7d('0x7'));var ejs=require(_0x5f7d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f7d('0x9'));var squel=require(_0x5f7d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f7d('0xb'));var toCsv=require(_0x5f7d('0x7'));var querystring=require(_0x5f7d('0xc'));var Papa=require('papaparse');var Redis=require(_0x5f7d('0xd'));var authService=require(_0x5f7d('0xe'));var qs=require(_0x5f7d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f7d('0x10'));var logger=require('../../config/logger')(_0x5f7d('0x11'));var utils=require('../../config/utils');var config=require(_0x5f7d('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x5f7d('0x13'));var client=jayson[_0x5f7d('0x14')][_0x5f7d('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x32e7e9,_0x2d35db,_0x2418b6,_0x4db5b5){return new BPromise(function(_0xdaaa50,_0x321e67){var _0x3e262c=_0x4db5b5||client;return _0x3e262c[_0x5f7d('0x16')](_0x32e7e9,_0x2418b6)['then'](function(_0x24ff67){logger[_0x5f7d('0x17')]('Setting,\x20%s,\x20%s',_0x2d35db,'request\x20sent');logger['debug'](_0x5f7d('0x18'),_0x2d35db,_0x5f7d('0x19'),JSON[_0x5f7d('0x1a')](_0x24ff67));if(_0x24ff67['error']){if(_0x24ff67['error'][_0x5f7d('0x1b')]===0x1f4){logger[_0x5f7d('0x1c')](_0x5f7d('0x1d'),_0x2d35db,_0x24ff67['error'][_0x5f7d('0x1e')]);return _0x321e67(_0x24ff67[_0x5f7d('0x1c')][_0x5f7d('0x1e')]);}logger[_0x5f7d('0x1c')]('Setting,\x20%s,\x20%s',_0x2d35db,_0x24ff67[_0x5f7d('0x1c')][_0x5f7d('0x1e')]);return _0xdaaa50(_0x24ff67[_0x5f7d('0x1c')][_0x5f7d('0x1e')]);}else{logger[_0x5f7d('0x17')](_0x5f7d('0x1d'),_0x2d35db,_0x5f7d('0x19'));_0xdaaa50(_0x24ff67[_0x5f7d('0x1f')]['message']);}})['catch'](function(_0x28784b){logger[_0x5f7d('0x1c')]('Setting,\x20%s,\x20%s',_0x2d35db,_0x28784b);_0x321e67(_0x28784b);});});}function respondWithStatusCode(_0x4b41be,_0x4d14a3){_0x4d14a3=_0x4d14a3||0xcc;return function(_0x83fb24){if(_0x83fb24){return _0x4b41be[_0x5f7d('0x20')](_0x4d14a3);}return _0x4b41be[_0x5f7d('0x21')](_0x4d14a3)[_0x5f7d('0x22')]();};}function respondWithResult(_0x18ce62,_0x4040ba){_0x4040ba=_0x4040ba||0xc8;return function(_0x3473e7){if(_0x3473e7){return _0x18ce62[_0x5f7d('0x21')](_0x4040ba)['json'](_0x3473e7);}};}function respondWithFilteredResult(_0x423a6c,_0x2f7b32){return function(_0x36b8e5){if(_0x36b8e5){var _0x5c02cc=typeof _0x2f7b32[_0x5f7d('0x23')]==='undefined'&&typeof _0x2f7b32[_0x5f7d('0x24')]==='undefined';var _0x4e7363=_0x36b8e5[_0x5f7d('0x25')];var _0x3c064f=_0x5c02cc?0x0:_0x2f7b32[_0x5f7d('0x23')];var _0x436cb9=_0x5c02cc?_0x36b8e5['count']:_0x2f7b32[_0x5f7d('0x23')]+_0x2f7b32['limit'];var _0x3fcea9;if(_0x436cb9>=_0x4e7363){_0x436cb9=_0x4e7363;_0x3fcea9=0xc8;}else{_0x3fcea9=0xce;}_0x423a6c[_0x5f7d('0x21')](_0x3fcea9);return _0x423a6c[_0x5f7d('0x26')](_0x5f7d('0x27'),_0x3c064f+'-'+_0x436cb9+'/'+_0x4e7363)[_0x5f7d('0x28')](_0x36b8e5);}return null;};}function patchUpdates(_0x53e1b2){return function(_0x3b9b0f){try{jsonpatch[_0x5f7d('0x29')](_0x3b9b0f,_0x53e1b2,!![]);}catch(_0x5d85d2){return BPromise[_0x5f7d('0x2a')](_0x5d85d2);}return _0x3b9b0f['save']();};}function saveUpdates(_0x26d2b6,_0x823a4b){return function(_0xcd82af){if(_0xcd82af){return _0xcd82af['update'](_0x26d2b6)[_0x5f7d('0x2b')](function(_0x4b8d7e){return _0x4b8d7e;});}return null;};}function removeEntity(_0x3c9c2f,_0x58a94c){return function(_0x145b6b){if(_0x145b6b){return _0x145b6b[_0x5f7d('0x2c')]()['then'](function(){_0x3c9c2f['status'](0xcc)[_0x5f7d('0x22')]();});}};}function handleEntityNotFound(_0x105063,_0x33f08c){return function(_0x56b4d6){if(!_0x56b4d6){_0x105063['sendStatus'](0x194);}return _0x56b4d6;};}function handleError(_0x28c335,_0x43f062){_0x43f062=_0x43f062||0x1f4;return function(_0x2093ec){logger[_0x5f7d('0x1c')](_0x2093ec[_0x5f7d('0x2d')]);if(_0x2093ec['name']){delete _0x2093ec[_0x5f7d('0x2e')];}_0x28c335[_0x5f7d('0x21')](_0x43f062)[_0x5f7d('0x2f')](_0x2093ec);};}exports[_0x5f7d('0x30')]=function(_0x202366,_0x3f11fc){var _0xdb57b2={},_0x222ced={},_0x337c8d={'count':0x0,'rows':[]};var _0xdbf23b=_[_0x5f7d('0x31')](db['Setting'][_0x5f7d('0x32')],function(_0x283619){return{'name':_0x283619[_0x5f7d('0x33')],'type':_0x283619[_0x5f7d('0x34')]['key']};});_0x222ced[_0x5f7d('0x35')]=_[_0x5f7d('0x31')](_0xdbf23b,_0x5f7d('0x2e'));_0x222ced[_0x5f7d('0x36')]=_[_0x5f7d('0x37')](_0x202366[_0x5f7d('0x36')]);_0x222ced[_0x5f7d('0x38')]=_[_0x5f7d('0x39')](_0x222ced['model'],_0x222ced['query']);_0xdb57b2[_0x5f7d('0x3a')]=_[_0x5f7d('0x39')](_0x222ced['model'],qs[_0x5f7d('0x3b')](_0x202366[_0x5f7d('0x36')][_0x5f7d('0x3b')]));_0xdb57b2[_0x5f7d('0x3a')]=_0xdb57b2['attributes'][_0x5f7d('0x3c')]?_0xdb57b2[_0x5f7d('0x3a')]:_0x222ced[_0x5f7d('0x35')];if(!_0x202366[_0x5f7d('0x36')][_0x5f7d('0x3d')](_0x5f7d('0x3e'))){_0xdb57b2[_0x5f7d('0x24')]=qs['limit'](_0x202366[_0x5f7d('0x36')][_0x5f7d('0x24')]);_0xdb57b2['offset']=qs[_0x5f7d('0x23')](_0x202366[_0x5f7d('0x36')][_0x5f7d('0x23')]);}_0xdb57b2[_0x5f7d('0x3f')]=qs['sort'](_0x202366[_0x5f7d('0x36')][_0x5f7d('0x40')]);_0xdb57b2[_0x5f7d('0x41')]=qs['filters'](_[_0x5f7d('0x42')](_0x202366['query'],_0x222ced['filters']),_0xdbf23b);if(_0x202366['query'][_0x5f7d('0x43')]){_0xdb57b2[_0x5f7d('0x41')]=_[_0x5f7d('0x44')](_0xdb57b2['where'],{'$or':_[_0x5f7d('0x31')](_0xdbf23b,function(_0x1ff61d){if(_0x1ff61d[_0x5f7d('0x34')]!==_0x5f7d('0x45')){var _0x411423={};_0x411423[_0x1ff61d['name']]={'$like':'%'+_0x202366[_0x5f7d('0x36')]['filter']+'%'};return _0x411423;}})});}_0xdb57b2=_[_0x5f7d('0x44')]({},_0xdb57b2,_0x202366[_0x5f7d('0x46')]);var _0x438492={'where':_0xdb57b2[_0x5f7d('0x41')]};return db['Setting'][_0x5f7d('0x25')](_0x438492)[_0x5f7d('0x2b')](function(_0x32202d){_0x337c8d[_0x5f7d('0x25')]=_0x32202d;if(_0x202366['query'][_0x5f7d('0x47')]){_0xdb57b2[_0x5f7d('0x48')]=[{'all':!![]}];}return db[_0x5f7d('0x49')][_0x5f7d('0x4a')](_0xdb57b2);})[_0x5f7d('0x2b')](function(_0x1ce84c){_0x337c8d[_0x5f7d('0x4b')]=_0x1ce84c;return _0x337c8d;})[_0x5f7d('0x2b')](respondWithFilteredResult(_0x3f11fc,_0xdb57b2))[_0x5f7d('0x4c')](handleError(_0x3f11fc,null));};exports[_0x5f7d('0x4d')]=function(_0x21738b,_0x22db4b){var _0x4855cb={'raw':![],'where':{'id':_0x21738b[_0x5f7d('0x4e')]['id']}},_0xaf5f52={};_0xaf5f52[_0x5f7d('0x35')]=_[_0x5f7d('0x37')](db[_0x5f7d('0x49')][_0x5f7d('0x32')]);_0xaf5f52[_0x5f7d('0x36')]=_['keys'](_0x21738b[_0x5f7d('0x36')]);_0xaf5f52[_0x5f7d('0x38')]=_[_0x5f7d('0x39')](_0xaf5f52[_0x5f7d('0x35')],_0xaf5f52[_0x5f7d('0x36')]);_0x4855cb['attributes']=_[_0x5f7d('0x39')](_0xaf5f52[_0x5f7d('0x35')],qs['fields'](_0x21738b['query']['fields']));_0x4855cb[_0x5f7d('0x3a')]=_0x4855cb[_0x5f7d('0x3a')][_0x5f7d('0x3c')]?_0x4855cb[_0x5f7d('0x3a')]:_0xaf5f52[_0x5f7d('0x35')];if(_0x21738b['query'][_0x5f7d('0x47')]){_0x4855cb['include']=[{'all':!![]}];}_0x4855cb=_[_0x5f7d('0x44')]({},_0x4855cb,_0x21738b[_0x5f7d('0x46')]);return db[_0x5f7d('0x49')][_0x5f7d('0x4f')](_0x4855cb)[_0x5f7d('0x2b')](handleEntityNotFound(_0x22db4b,null))[_0x5f7d('0x2b')](respondWithResult(_0x22db4b,null))[_0x5f7d('0x4c')](handleError(_0x22db4b,null));};exports[_0x5f7d('0x50')]=function(_0x548b68,_0x1fa758){if(_0x548b68[_0x5f7d('0x51')]['id']){delete _0x548b68[_0x5f7d('0x51')]['id'];}return db['Setting']['find']({'where':{'id':_0x548b68[_0x5f7d('0x4e')]['id']}})[_0x5f7d('0x2b')](handleEntityNotFound(_0x1fa758,null))[_0x5f7d('0x2b')](saveUpdates(_0x548b68[_0x5f7d('0x51')],null))[_0x5f7d('0x2b')](respondWithResult(_0x1fa758,null))[_0x5f7d('0x4c')](handleError(_0x1fa758,null));};exports[_0x5f7d('0x52')]=function(_0xf16ad7,_0x545298,_0x5b6a7b){if(_0xf16ad7[_0x5f7d('0x53')]&&_0xf16ad7[_0x5f7d('0x53')][_0x5f7d('0x54')]){_0xf16ad7[_0x5f7d('0x51')][_0x5f7d('0x55')]=_0xf16ad7[_0x5f7d('0x53')]['filename'];}return db[_0x5f7d('0x49')][_0x5f7d('0x4f')]({'where':{'id':_0xf16ad7[_0x5f7d('0x4e')]['id']}})[_0x5f7d('0x2b')](handleEntityNotFound(_0x545298,null))[_0x5f7d('0x2b')](saveUpdates(_0xf16ad7[_0x5f7d('0x51')],null))[_0x5f7d('0x2b')](respondWithResult(_0x545298,null))['catch'](handleError(_0x545298,null));};exports[_0x5f7d('0x56')]=function(_0xf1a941,_0x204249,_0x353c47){if(_0xf1a941[_0x5f7d('0x53')]&&_0xf1a941[_0x5f7d('0x53')][_0x5f7d('0x54')]){_0xf1a941[_0x5f7d('0x51')][_0x5f7d('0x57')]=_0xf1a941[_0x5f7d('0x53')][_0x5f7d('0x54')];}return db[_0x5f7d('0x49')][_0x5f7d('0x4f')]({'where':{'id':_0xf1a941[_0x5f7d('0x4e')]['id']}})[_0x5f7d('0x2b')](handleEntityNotFound(_0x204249,null))[_0x5f7d('0x2b')](saveUpdates(_0xf1a941[_0x5f7d('0x51')],null))[_0x5f7d('0x2b')](respondWithResult(_0x204249,null))['catch'](handleError(_0x204249,null));};var utilLicense=require(_0x5f7d('0x58'));exports[_0x5f7d('0x59')]=function(_0x249078,_0x1d4200,_0xc430c3){var _0x230c33='server/files/images/logos';var _0x2aa5b4={'custom':![]};return utilLicense[_0x5f7d('0x5a')]()[_0x5f7d('0x2b')](function(_0x1f1d89){if(_0x1f1d89){_0x2aa5b4=_0x1f1d89;}return db[_0x5f7d('0x49')]['find']({'where':{'id':_0x249078['params']['id']},'attributes':[_0x5f7d('0x55'),'loginLogo',_0x5f7d('0x5b'),_0x5f7d('0x5c'),'defaultLogo',_0x5f7d('0x5d'),_0x5f7d('0x5e'),_0x5f7d('0x5f')],'raw':!![]});})[_0x5f7d('0x2b')](handleEntityNotFound(_0x1d4200,null))[_0x5f7d('0x2b')](function(_0x3b8a6d){if(_0x3b8a6d){var _0x48bc36=_0x3b8a6d[_0x5f7d('0x55')]&&fs['existsSync'](path['join'](config['root'],_0x230c33,_[_0x5f7d('0x60')](_0x3b8a6d['logo'])))?path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x230c33,_[_0x5f7d('0x60')](_0x3b8a6d[_0x5f7d('0x55')])):path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x230c33,_[_0x5f7d('0x60')](_0x5f7d('0x63')));var _0x5c9487=_0x5f7d('0x64')+_[_0x5f7d('0x65')](_0x5f7d('0x55'));if(_0x3b8a6d[_0x5c9487]||!_0x2aa5b4[_0x5f7d('0x66')]){_0x48bc36=path[_0x5f7d('0x61')](config['root'],_0x230c33,_[_0x5f7d('0x60')]('default_logo.svg'));}if(!fs[_0x5f7d('0x67')](_0x48bc36)){throw new db['Sequelize']['ValidationError'](_[_0x5f7d('0x65')](_0x5f7d('0x55'))+_0x5f7d('0x68'));}return _0x1d4200[_0x5f7d('0x69')](_0x48bc36);}})[_0x5f7d('0x4c')](handleError(_0x1d4200,null));};var utilLicense=require(_0x5f7d('0x58'));exports['getLogoLogin']=function(_0x4aad50,_0x36cae2,_0x6eb936){var _0x2a1604=_0x5f7d('0x6a');var _0x42396e={'custom':![]};return utilLicense['getLicense']()[_0x5f7d('0x2b')](function(_0x427169){if(_0x427169){_0x42396e=_0x427169;}return db[_0x5f7d('0x49')][_0x5f7d('0x4f')]({'where':{'id':_0x4aad50['params']['id']},'attributes':[_0x5f7d('0x55'),_0x5f7d('0x57'),_0x5f7d('0x5b'),'favicon',_0x5f7d('0x6b'),_0x5f7d('0x5d'),_0x5f7d('0x5e'),_0x5f7d('0x5f')],'raw':!![]});})[_0x5f7d('0x2b')](handleEntityNotFound(_0x36cae2,null))[_0x5f7d('0x2b')](function(_0x346d80){if(_0x346d80){var _0x27940d=_0x346d80[_0x5f7d('0x57')]&&fs[_0x5f7d('0x67')](path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x2a1604,_[_0x5f7d('0x60')](_0x346d80['loginLogo'])))?path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x2a1604,_[_0x5f7d('0x60')](_0x346d80[_0x5f7d('0x57')])):path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x2a1604,_[_0x5f7d('0x60')](_0x5f7d('0x6c')));var _0x43a692=_0x5f7d('0x64')+_[_0x5f7d('0x65')](_0x5f7d('0x57'));if(_0x346d80[_0x43a692]||!_0x42396e[_0x5f7d('0x66')]){_0x27940d=path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x2a1604,_[_0x5f7d('0x60')](_0x5f7d('0x6c')));}if(!fs[_0x5f7d('0x67')](_0x27940d)){throw new db[(_0x5f7d('0x6d'))][(_0x5f7d('0x6e'))](_['upperFirst']('loginLogo')+_0x5f7d('0x68'));}return _0x36cae2[_0x5f7d('0x69')](_0x27940d);}})[_0x5f7d('0x4c')](handleError(_0x36cae2,null));};exports[_0x5f7d('0x6f')]=function(_0x1cf7bf,_0x18bcea){return db[_0x5f7d('0x49')][_0x5f7d('0x4f')]({'where':{'id':_0x1cf7bf['params']['id']},'attributes':[_0x5f7d('0x70')]})[_0x5f7d('0x2b')](respondWithResult(_0x18bcea,null))[_0x5f7d('0x4c')](handleError(_0x18bcea,null));};exports[_0x5f7d('0x71')]=function(_0x4e77b6,_0xa0b54e,_0x4c9bdf){if(_0x4e77b6[_0x5f7d('0x53')]&&_0x4e77b6[_0x5f7d('0x53')][_0x5f7d('0x54')]){_0x4e77b6[_0x5f7d('0x51')][_0x5f7d('0x5b')]=_0x4e77b6[_0x5f7d('0x53')]['filename'];}return db['Setting'][_0x5f7d('0x4f')]({'where':{'id':_0x4e77b6[_0x5f7d('0x4e')]['id']}})[_0x5f7d('0x2b')](handleEntityNotFound(_0xa0b54e,null))['then'](saveUpdates(_0x4e77b6['body'],null))[_0x5f7d('0x2b')](respondWithResult(_0xa0b54e,null))[_0x5f7d('0x4c')](handleError(_0xa0b54e,null));};var utilLicense=require('../../config/license/util');exports[_0x5f7d('0x72')]=function(_0x36b87f,_0x370232,_0x44bb49){var _0x23d38c=_0x5f7d('0x6a');var _0x180ee9={'custom':![]};return utilLicense[_0x5f7d('0x5a')]()[_0x5f7d('0x2b')](function(_0x3d3edb){if(_0x3d3edb){_0x180ee9=_0x3d3edb;}return db[_0x5f7d('0x49')]['find']({'where':{'id':_0x36b87f['params']['id']},'attributes':[_0x5f7d('0x55'),_0x5f7d('0x57'),'preferred',_0x5f7d('0x5c'),_0x5f7d('0x6b'),_0x5f7d('0x5d'),_0x5f7d('0x5e'),_0x5f7d('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x370232,null))[_0x5f7d('0x2b')](function(_0xfb8078){if(_0xfb8078){var _0x339919=_0xfb8078[_0x5f7d('0x5b')]&&fs[_0x5f7d('0x67')](path['join'](config[_0x5f7d('0x62')],_0x23d38c,_[_0x5f7d('0x60')](_0xfb8078[_0x5f7d('0x5b')])))?path['join'](config[_0x5f7d('0x62')],_0x23d38c,_['toLower'](_0xfb8078[_0x5f7d('0x5b')])):path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x23d38c,_[_0x5f7d('0x60')](_0x5f7d('0x73')));var _0x348791=_0x5f7d('0x64')+_[_0x5f7d('0x65')]('preferred');if(_0xfb8078[_0x348791]||!_0x180ee9['custom']||!_0x180ee9[_0x5f7d('0x5b')]){_0x339919=path[_0x5f7d('0x61')](config['root'],_0x23d38c,_[_0x5f7d('0x60')](_0x5f7d('0x73')));}if(!fs[_0x5f7d('0x67')](_0x339919)){throw new db[(_0x5f7d('0x6d'))][(_0x5f7d('0x6e'))](_[_0x5f7d('0x65')](_0x5f7d('0x5b'))+_0x5f7d('0x68'));}return _0x370232[_0x5f7d('0x69')](_0x339919);}})['catch'](handleError(_0x370232,null));};exports[_0x5f7d('0x74')]=function(_0xf6e8d6,_0x53e2c1,_0x5bf332){if(_0xf6e8d6[_0x5f7d('0x53')]&&_0xf6e8d6['file']['filename']){_0xf6e8d6[_0x5f7d('0x51')][_0x5f7d('0x5c')]=_0xf6e8d6['file'][_0x5f7d('0x54')];}return db[_0x5f7d('0x49')][_0x5f7d('0x4f')]({'where':{'id':_0xf6e8d6[_0x5f7d('0x4e')]['id']}})[_0x5f7d('0x2b')](handleEntityNotFound(_0x53e2c1,null))[_0x5f7d('0x2b')](saveUpdates(_0xf6e8d6[_0x5f7d('0x51')],null))[_0x5f7d('0x2b')](respondWithResult(_0x53e2c1,null))[_0x5f7d('0x4c')](handleError(_0x53e2c1,null));};var utilLicense=require(_0x5f7d('0x58'));exports[_0x5f7d('0x75')]=function(_0x3bbe88,_0x33e564,_0x21bcf4){var _0x4e18b6=_0x5f7d('0x6a');var _0x4682e1={'custom':![]};return utilLicense[_0x5f7d('0x5a')]()[_0x5f7d('0x2b')](function(_0x37545f){if(_0x37545f){_0x4682e1=_0x37545f;}return db['Setting'][_0x5f7d('0x4f')]({'where':{'id':_0x3bbe88[_0x5f7d('0x4e')]['id']},'attributes':[_0x5f7d('0x55'),_0x5f7d('0x57'),_0x5f7d('0x5b'),_0x5f7d('0x5c'),_0x5f7d('0x6b'),'defaultLoginLogo',_0x5f7d('0x5e'),_0x5f7d('0x5f')],'raw':!![]});})[_0x5f7d('0x2b')](handleEntityNotFound(_0x33e564,null))[_0x5f7d('0x2b')](function(_0x315d9a){if(_0x315d9a){var _0x3060d7=_0x315d9a[_0x5f7d('0x5c')]&&fs[_0x5f7d('0x67')](path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x4e18b6,_['toLower'](_0x315d9a[_0x5f7d('0x5c')])))?path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x4e18b6,_[_0x5f7d('0x60')](_0x315d9a[_0x5f7d('0x5c')])):path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x4e18b6,_[_0x5f7d('0x60')]('default_favicon.ico'));var _0x254483=_0x5f7d('0x64')+_['upperFirst'](_0x5f7d('0x5c'));if(_0x315d9a[_0x254483]||!_0x4682e1[_0x5f7d('0x66')]){_0x3060d7=path[_0x5f7d('0x61')](config[_0x5f7d('0x62')],_0x4e18b6,_[_0x5f7d('0x60')](_0x5f7d('0x76')));}if(!fs[_0x5f7d('0x67')](_0x3060d7)){throw new db[(_0x5f7d('0x6d'))][(_0x5f7d('0x6e'))](_[_0x5f7d('0x65')](_0x5f7d('0x5c'))+'\x20not\x20found');}return _0x33e564[_0x5f7d('0x69')](_0x3060d7);}})['catch'](handleError(_0x33e564,null));};exports[_0x5f7d('0x77')]=function(_0x4a561e,_0x2100fc){var _0x45848c={'offset':moment()[_0x5f7d('0x78')]()};_0x45848c['now']=moment()['utcOffset'](_0x45848c[_0x5f7d('0x23')])[_0x5f7d('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2100fc[_0x5f7d('0x21')](0xc8)[_0x5f7d('0x2f')](_0x45848c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e5509dd..e5fb02b 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x36a50a,_0x90d045){var _0x2b6cdc=function(_0x248b2e){while(--_0x248b2e){_0x36a50a['push'](_0x36a50a['shift']());}};_0x2b6cdc(++_0x90d045);}(_0x34e8,0x12c));var _0x834e=function(_0x1284a7,_0x48f26d){_0x1284a7=_0x1284a7-0x0;var _0x23ac67=_0x34e8[_0x1284a7];return _0x23ac67;};'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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0x3e74,0x175));var _0x43e7=function(_0x5a4fae,_0x52ce2e){_0x5a4fae=_0x5a4fae-0x0;var _0x3e113f=_0x3e74[_0x5a4fae];return _0x3e113f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 06206d2..a53bd32 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 _0x5641=['model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSetting','Setting','options','raw','where','attributes','include'];(function(_0x57cc73,_0x428793){var _0xe8d96b=function(_0x14bc57){while(--_0x14bc57){_0x57cc73['push'](_0x57cc73['shift']());}};_0xe8d96b(++_0x428793);}(_0x5641,0x10a));var _0x1564=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x5641[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x1564('0x0'));var util=require(_0x1564('0x1'));var moment=require(_0x1564('0x2'));var BPromise=require(_0x1564('0x3'));var rs=require(_0x1564('0x4'));var fs=require('fs');var Redis=require(_0x1564('0x5'));var db=require(_0x1564('0x6'))['db'];var utils=require(_0x1564('0x7'));var logger=require(_0x1564('0x8'))(_0x1564('0x9'));var config=require(_0x1564('0xa'));var jayson=require(_0x1564('0xb'));var client=jayson['client'][_0x1564('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x109a55,_0x1f772e,_0x52f119){return new BPromise(function(_0x55d0ab,_0x1ac40e){return client['request'](_0x109a55,_0x52f119)[_0x1564('0xd')](function(_0x204622){logger['info'](_0x1564('0xe'),_0x1f772e,_0x1564('0xf'));logger[_0x1564('0x10')](_0x1564('0x11'),_0x1f772e,_0x1564('0xf'),JSON[_0x1564('0x12')](_0x204622));if(_0x204622[_0x1564('0x13')]){if(_0x204622['error']['code']===0x1f4){logger[_0x1564('0x13')](_0x1564('0xe'),_0x1f772e,_0x204622[_0x1564('0x13')]['message']);return _0x1ac40e(_0x204622['error']['message']);}logger[_0x1564('0x13')](_0x1564('0xe'),_0x1f772e,_0x204622[_0x1564('0x13')][_0x1564('0x14')]);return _0x55d0ab(_0x204622['error']['message']);}else{logger[_0x1564('0x15')](_0x1564('0xe'),_0x1f772e,_0x1564('0xf'));_0x55d0ab(_0x204622[_0x1564('0x16')][_0x1564('0x14')]);}})[_0x1564('0x17')](function(_0x34fa9b){logger['error']('Setting,\x20%s,\x20%s',_0x1f772e,_0x34fa9b);_0x1ac40e(_0x34fa9b);});});}exports[_0x1564('0x18')]=function(_0x2b2880){var _0x44f848=this;return new Promise(function(_0x4b7c8f,_0x274a33){return db[_0x1564('0x19')]['find']({'raw':_0x2b2880[_0x1564('0x1a')]?_0x2b2880[_0x1564('0x1a')][_0x1564('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b2880['options']?_0x2b2880[_0x1564('0x1a')][_0x1564('0x1c')]||null:null,'attributes':_0x2b2880[_0x1564('0x1a')]?_0x2b2880[_0x1564('0x1a')][_0x1564('0x1d')]||null:null,'include':_0x2b2880['options']?_0x2b2880[_0x1564('0x1a')][_0x1564('0x1e')]?_['map'](_0x2b2880[_0x1564('0x1a')][_0x1564('0x1e')],function(_0x6662e0){return{'model':db[_0x6662e0[_0x1564('0x1f')]],'as':_0x6662e0['as'],'attributes':_0x6662e0[_0x1564('0x1d')],'include':_0x6662e0['include']?_['map'](_0x6662e0[_0x1564('0x1e')],function(_0x17fbb1){return{'model':db[_0x17fbb1[_0x1564('0x1f')]],'as':_0x17fbb1['as'],'attributes':_0x17fbb1[_0x1564('0x1d')],'include':_0x17fbb1[_0x1564('0x1e')]?_[_0x1564('0x20')](_0x17fbb1['include'],function(_0x18d13b){return{'model':db[_0x18d13b[_0x1564('0x1f')]],'as':_0x18d13b['as'],'attributes':_0x18d13b[_0x1564('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1564('0xd')](function(_0x31fde3){logger['info'](_0x1564('0x18'),_0x2b2880);logger[_0x1564('0x10')](_0x1564('0x18'),_0x2b2880,JSON[_0x1564('0x12')](_0x31fde3));_0x4b7c8f(_0x31fde3);})[_0x1564('0x17')](function(_0x28b62b){logger[_0x1564('0x13')](_0x1564('0x18'),_0x28b62b[_0x1564('0x14')],_0x2b2880);_0x274a33(_0x44f848['error'](0x1f4,_0x28b62b[_0x1564('0x14')]));});});}; \ No newline at end of file +var _0x1c1c=['code','message','catch','Setting','find','options','where','include','map','model','attributes','then','ShowSetting','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20c9d6,_0x160bea){var _0x3b8794=function(_0x56f346){while(--_0x56f346){_0x20c9d6['push'](_0x20c9d6['shift']());}};_0x3b8794(++_0x160bea);}(_0x1c1c,0xc7));var _0xc1c1=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x1c1c[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var util=require(_0xc1c1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1c1('0x1'));var fs=require('fs');var Redis=require(_0xc1c1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c1('0x3'));var logger=require(_0xc1c1('0x4'))(_0xc1c1('0x5'));var config=require(_0xc1c1('0x6'));var jayson=require(_0xc1c1('0x7'));var client=jayson[_0xc1c1('0x8')][_0xc1c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4c3a,_0x506bf3,_0x29dbd5){return new BPromise(function(_0x101f4e,_0x59e5a9){return client[_0xc1c1('0xa')](_0x2a4c3a,_0x29dbd5)['then'](function(_0x2c68f0){logger[_0xc1c1('0xb')](_0xc1c1('0xc'),_0x506bf3,_0xc1c1('0xd'));logger[_0xc1c1('0xe')](_0xc1c1('0xf'),_0x506bf3,_0xc1c1('0xd'),JSON[_0xc1c1('0x10')](_0x2c68f0));if(_0x2c68f0['error']){if(_0x2c68f0[_0xc1c1('0x11')][_0xc1c1('0x12')]===0x1f4){logger[_0xc1c1('0x11')](_0xc1c1('0xc'),_0x506bf3,_0x2c68f0[_0xc1c1('0x11')][_0xc1c1('0x13')]);return _0x59e5a9(_0x2c68f0[_0xc1c1('0x11')][_0xc1c1('0x13')]);}logger[_0xc1c1('0x11')](_0xc1c1('0xc'),_0x506bf3,_0x2c68f0[_0xc1c1('0x11')][_0xc1c1('0x13')]);return _0x101f4e(_0x2c68f0[_0xc1c1('0x11')][_0xc1c1('0x13')]);}else{logger[_0xc1c1('0xb')](_0xc1c1('0xc'),_0x506bf3,_0xc1c1('0xd'));_0x101f4e(_0x2c68f0['result'][_0xc1c1('0x13')]);}})[_0xc1c1('0x14')](function(_0xb5f89a){logger[_0xc1c1('0x11')](_0xc1c1('0xc'),_0x506bf3,_0xb5f89a);_0x59e5a9(_0xb5f89a);});});}exports['ShowSetting']=function(_0x641c26){var _0x2c7d55=this;return new Promise(function(_0x1398c2,_0x3c8e1a){return db[_0xc1c1('0x15')][_0xc1c1('0x16')]({'raw':_0x641c26[_0xc1c1('0x17')]?_0x641c26['options']['raw']===undefined?!![]:![]:!![],'where':_0x641c26['options']?_0x641c26[_0xc1c1('0x17')][_0xc1c1('0x18')]||null:null,'attributes':_0x641c26['options']?_0x641c26[_0xc1c1('0x17')]['attributes']||null:null,'include':_0x641c26[_0xc1c1('0x17')]?_0x641c26[_0xc1c1('0x17')][_0xc1c1('0x19')]?_[_0xc1c1('0x1a')](_0x641c26[_0xc1c1('0x17')]['include'],function(_0x7f39bf){return{'model':db[_0x7f39bf[_0xc1c1('0x1b')]],'as':_0x7f39bf['as'],'attributes':_0x7f39bf['attributes'],'include':_0x7f39bf[_0xc1c1('0x19')]?_[_0xc1c1('0x1a')](_0x7f39bf[_0xc1c1('0x19')],function(_0x2b5578){return{'model':db[_0x2b5578['model']],'as':_0x2b5578['as'],'attributes':_0x2b5578['attributes'],'include':_0x2b5578['include']?_[_0xc1c1('0x1a')](_0x2b5578['include'],function(_0xc2de34){return{'model':db[_0xc2de34[_0xc1c1('0x1b')]],'as':_0xc2de34['as'],'attributes':_0xc2de34[_0xc1c1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc1c1('0x1d')](function(_0x2e5841){logger[_0xc1c1('0xb')](_0xc1c1('0x1e'),_0x641c26);logger[_0xc1c1('0xe')]('ShowSetting',_0x641c26,JSON[_0xc1c1('0x10')](_0x2e5841));_0x1398c2(_0x2e5841);})['catch'](function(_0x20525f){logger[_0xc1c1('0x11')](_0xc1c1('0x1e'),_0x20525f[_0xc1c1('0x13')],_0x641c26);_0x3c8e1a(_0x2c7d55[_0xc1c1('0x11')](0x1f4,_0x20525f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index ec68993..aa6d327 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x1188a8,_0xc1498d){var _0x50c1c1=function(_0x174536){while(--_0x174536){_0x1188a8['push'](_0x1188a8['shift']());}};_0x50c1c1(++_0xc1498d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x55ca=['describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x55ca,0x126));var _0xa55c=function(_0x114ae4,_0x14bdc9){_0x114ae4=_0x114ae4-0x0;var _0x32f566=_0x55ca[_0x114ae4];return _0x32f566;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getApplications']);router['get'](_0xa55c('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xa55c('0x12'),controller[_0xa55c('0x13')]);router[_0xa55c('0x7')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x17')](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);router[_0xa55c('0x17')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller['addAnswer']);router[_0xa55c('0x17')](_0xa55c('0x19'),controller[_0xa55c('0x1a')]);router[_0xa55c('0x17')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['addApplications']);router['post'](_0xa55c('0x1b'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1c')]);router['post'](_0xa55c('0x12'),controller[_0xa55c('0x1d')]);router['post'](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1e')]);router[_0xa55c('0x1f')](_0xa55c('0xb'),auth['isAuthenticated'](),controller[_0xa55c('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x21')]);router['delete'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x22')]);router[_0xa55c('0x23')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x24')]);router[_0xa55c('0x23')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x25')]);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 f843cdf..ba3deb3 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 _0x6b46=['generate','ENUM','twilio','skebby','plivo','clickatell','bandwidth','infobip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0xfb152d,_0x207cea){var _0x246961=function(_0x2ddf01){while(--_0x2ddf01){_0xfb152d['push'](_0xfb152d['shift']());}};_0x246961(++_0x207cea);}(_0x6b46,0x1b5));var _0x66b4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6b46[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x66b4('0x0'));var rs=require(_0x66b4('0x1'));module[_0x66b4('0x2')]={'name':{'type':Sequelize[_0x66b4('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x66b4('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x66b4('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x66b4('0x3')],'defaultValue':function(){return rs[_0x66b4('0x4')]();}},'phone':{'type':Sequelize[_0x66b4('0x3')]},'type':{'type':Sequelize[_0x66b4('0x5')](_0x66b4('0x6'),_0x66b4('0x7'),'connectel','clicksend',_0x66b4('0x8'),_0x66b4('0x9'),_0x66b4('0xa'),'csc',_0x66b4('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0x66b4('0x3')]},'authId':{'type':Sequelize[_0x66b4('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x66b4('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x66b4('0x3')]},'applicationId':{'type':Sequelize[_0x66b4('0x3')]},'accountId':{'type':Sequelize[_0x66b4('0x3')]},'senderString':{'type':Sequelize[_0x66b4('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x66b4('0x3')]},'notificationTemplate':{'type':Sequelize[_0x66b4('0xc')],'defaultValue':function(){return _0x66b4('0xd');}},'notificationSound':{'type':Sequelize[_0x66b4('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x66b4('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x66b4('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x66b4('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x66b4('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x66b4('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x66b4('0xf')],'comment':_0x66b4('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x66b4('0xe')],'defaultValue':![],'comment':_0x66b4('0x11'),'set':function(_0x20a1c7){if(!_0x20a1c7)this[_0x66b4('0x12')](_0x66b4('0x13'),null);this['setDataValue'](_0x66b4('0x14'),_0x20a1c7);}}}; \ No newline at end of file +var _0xcd38=['sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x355e9a,_0x4ee560){var _0x32f60c=function(_0x3697ff){while(--_0x3697ff){_0x355e9a['push'](_0x355e9a['shift']());}};_0x32f60c(++_0x4ee560);}(_0xcd38,0x150));var _0x8cd3=function(_0x104d9b,_0x59974d){_0x104d9b=_0x104d9b-0x0;var _0x400826=_0xcd38[_0x104d9b];return _0x400826;};'use strict';var Sequelize=require(_0x8cd3('0x0'));var rs=require(_0x8cd3('0x1'));module[_0x8cd3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8cd3('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x8cd3('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x8cd3('0x4')],'defaultValue':function(){return rs[_0x8cd3('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8cd3('0x6')](_0x8cd3('0x7'),_0x8cd3('0x8'),_0x8cd3('0x9'),_0x8cd3('0xa'),_0x8cd3('0xb'),'clickatell',_0x8cd3('0xc'),'csc',_0x8cd3('0xd'),_0x8cd3('0xe'))},'accountSid':{'type':Sequelize[_0x8cd3('0x4')]},'authId':{'type':Sequelize[_0x8cd3('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x8cd3('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x8cd3('0x4')]},'applicationId':{'type':Sequelize[_0x8cd3('0x4')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x8cd3('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x8cd3('0x4')]},'notificationTemplate':{'type':Sequelize[_0x8cd3('0x10')],'defaultValue':function(){return _0x8cd3('0x11');}},'notificationSound':{'type':Sequelize[_0x8cd3('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8cd3('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8cd3('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8cd3('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8cd3('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8cd3('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8cd3('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8cd3('0x12')],'comment':_0x8cd3('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x8cd3('0xf')],'defaultValue':![],'comment':_0x8cd3('0x14'),'set':function(_0x891e80){if(!_0x891e80)this['setDataValue'](_0x8cd3('0x15'),null);this[_0x8cd3('0x16')](_0x8cd3('0x17'),_0x891e80);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 859b75a..fb13abc 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 _0x9dd8=['message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./smsAccount.socket','register','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','json','offset','undefined','count','limit','reject','save','update','then','destroy','get','SmsAccounts','end','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','mandatoryDispositionPause','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','getDispositions','Disposition','hasOwnProperty','nolimit','order','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','results','csc','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','CmContact','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','applications','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','redif','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT'];(function(_0x5d26f2,_0x4c8139){var _0x4fa3cd=function(_0xddbb){while(--_0xddbb){_0x5d26f2['push'](_0x5d26f2['shift']());}};_0x4fa3cd(++_0x4c8139);}(_0x9dd8,0x1cf));var _0x89dd=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x9dd8[_0x12f688];return _0x59c3de;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x89dd('0x0'));var jsonpatch=require(_0x89dd('0x1'));var rp=require(_0x89dd('0x2'));var moment=require(_0x89dd('0x3'));var BPromise=require(_0x89dd('0x4'));var Mustache=require(_0x89dd('0x5'));var util=require(_0x89dd('0x6'));var path=require(_0x89dd('0x7'));var sox=require(_0x89dd('0x8'));var csv=require(_0x89dd('0x9'));var ejs=require(_0x89dd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x89dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x89dd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x89dd('0xd'));var Papa=require(_0x89dd('0xe'));var Redis=require('ioredis');var authService=require(_0x89dd('0xf'));var qs=require(_0x89dd('0x10'));var as=require(_0x89dd('0x11'));var hardwareService=require(_0x89dd('0x12'));var logger=require('../../config/logger')(_0x89dd('0x13'));var utils=require(_0x89dd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x89dd('0x15'));var db=require(_0x89dd('0x16'))['db'];config['redis']=_[_0x89dd('0x17')](config[_0x89dd('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x89dd('0x19'))(new Redis(config[_0x89dd('0x18')]));require(_0x89dd('0x1a'))[_0x89dd('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x89dd('0x1c')][_0x89dd('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x35b2d4,_0x23338e,_0x2f77f6,_0x30dc21){return new BPromise(function(_0x39d8a8,_0x2cf1df){var _0x3dd7aa=_0x30dc21||client;return _0x3dd7aa[_0x89dd('0x1e')](_0x35b2d4,_0x2f77f6)['then'](function(_0xcdf1c2){logger[_0x89dd('0x1f')](_0x89dd('0x20'),_0x23338e,_0x89dd('0x21'));logger[_0x89dd('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x23338e,'request\x20sent',JSON[_0x89dd('0x23')](_0xcdf1c2));if(_0xcdf1c2[_0x89dd('0x24')]){if(_0xcdf1c2[_0x89dd('0x24')]['code']===0x1f4){logger['error'](_0x89dd('0x20'),_0x23338e,_0xcdf1c2[_0x89dd('0x24')][_0x89dd('0x25')]);return _0x2cf1df(_0xcdf1c2[_0x89dd('0x24')][_0x89dd('0x25')]);}logger['error'](_0x89dd('0x20'),_0x23338e,_0xcdf1c2['error'][_0x89dd('0x25')]);return _0x39d8a8(_0xcdf1c2[_0x89dd('0x24')]['message']);}else{logger[_0x89dd('0x1f')](_0x89dd('0x20'),_0x23338e,_0x89dd('0x21'));_0x39d8a8(_0xcdf1c2[_0x89dd('0x26')][_0x89dd('0x25')]);}})[_0x89dd('0x27')](function(_0x9ff5e2){logger[_0x89dd('0x24')](_0x89dd('0x20'),_0x23338e,_0x9ff5e2);_0x2cf1df(_0x9ff5e2);});});}function respondWithStatusCode(_0x5946ac,_0x1ea9af){_0x1ea9af=_0x1ea9af||0xcc;return function(_0x363488){if(_0x363488){return _0x5946ac['sendStatus'](_0x1ea9af);}return _0x5946ac[_0x89dd('0x28')](_0x1ea9af)['end']();};}function respondWithResult(_0x57b8a4,_0x227754){_0x227754=_0x227754||0xc8;return function(_0x6f89f7){if(_0x6f89f7){return _0x57b8a4[_0x89dd('0x28')](_0x227754)[_0x89dd('0x29')](_0x6f89f7);}};}function respondWithFilteredResult(_0x25cd72,_0x5dcbfe){return function(_0x4cbf7c){if(_0x4cbf7c){var _0x460c6b=typeof _0x5dcbfe[_0x89dd('0x2a')]==='undefined'&&typeof _0x5dcbfe['limit']===_0x89dd('0x2b');var _0x729e24=_0x4cbf7c[_0x89dd('0x2c')];var _0x209ab2=_0x460c6b?0x0:_0x5dcbfe[_0x89dd('0x2a')];var _0x44281d=_0x460c6b?_0x4cbf7c[_0x89dd('0x2c')]:_0x5dcbfe[_0x89dd('0x2a')]+_0x5dcbfe[_0x89dd('0x2d')];var _0x104ae6;if(_0x44281d>=_0x729e24){_0x44281d=_0x729e24;_0x104ae6=0xc8;}else{_0x104ae6=0xce;}_0x25cd72['status'](_0x104ae6);return _0x25cd72['set']('Content-Range',_0x209ab2+'-'+_0x44281d+'/'+_0x729e24)[_0x89dd('0x29')](_0x4cbf7c);}return null;};}function patchUpdates(_0x1ec310){return function(_0x4a2dad){try{jsonpatch['apply'](_0x4a2dad,_0x1ec310,!![]);}catch(_0x223891){return BPromise[_0x89dd('0x2e')](_0x223891);}return _0x4a2dad[_0x89dd('0x2f')]();};}function saveUpdates(_0x16dd62,_0x513a28){return function(_0x16aeb8){if(_0x16aeb8){return _0x16aeb8[_0x89dd('0x30')](_0x16dd62)[_0x89dd('0x31')](function(_0x28c5dc){return _0x28c5dc;});}return null;};}function removeEntity(_0x5b3ba1,_0x68dec6){return function(_0x38c157){if(_0x38c157){return _0x38c157[_0x89dd('0x32')]()[_0x89dd('0x31')](function(){var _0x40f9c1=_0x38c157[_0x89dd('0x33')]({'plain':!![]});var _0xdf53dc=_0x89dd('0x34');return db['UserProfileResource'][_0x89dd('0x32')]({'where':{'type':_0xdf53dc,'resourceId':_0x40f9c1['id']}})[_0x89dd('0x31')](function(){return _0x38c157;});})['then'](function(){_0x5b3ba1[_0x89dd('0x28')](0xcc)[_0x89dd('0x35')]();});}};}function handleEntityNotFound(_0x40373c,_0xa41115){return function(_0xb24c14){if(!_0xb24c14){_0x40373c['sendStatus'](0x194);}return _0xb24c14;};}function handleError(_0x544289,_0x2767a4){_0x2767a4=_0x2767a4||0x1f4;return function(_0x178a77){logger[_0x89dd('0x24')](_0x178a77[_0x89dd('0x36')]);if(_0x178a77[_0x89dd('0x37')]){delete _0x178a77[_0x89dd('0x37')];}_0x544289[_0x89dd('0x28')](_0x2767a4)[_0x89dd('0x38')](_0x178a77);};}exports[_0x89dd('0x39')]=function(_0x5d77d4,_0x5c3234){var _0x123a97={'include':[{'model':db[_0x89dd('0x3a')],'as':'mandatoryDispositionPause'}]},_0x1e38d0={},_0xa92069={'count':0x0,'rows':[]};var _0xf472c4=_[_0x89dd('0x3b')](db[_0x89dd('0x3c')][_0x89dd('0x3d')],function(_0x3de8da){return{'name':_0x3de8da[_0x89dd('0x3e')],'type':_0x3de8da[_0x89dd('0x3f')]['key']};});_0x1e38d0[_0x89dd('0x40')]=_[_0x89dd('0x3b')](_0xf472c4,_0x89dd('0x37'));_0x1e38d0[_0x89dd('0x41')]=_[_0x89dd('0x42')](_0x5d77d4['query']);_0x1e38d0[_0x89dd('0x43')]=_[_0x89dd('0x44')](_0x1e38d0[_0x89dd('0x40')],_0x1e38d0[_0x89dd('0x41')]);_0x123a97[_0x89dd('0x45')]=_[_0x89dd('0x44')](_0x1e38d0[_0x89dd('0x40')],qs['fields'](_0x5d77d4['query'][_0x89dd('0x46')]));_0x123a97[_0x89dd('0x45')]=_0x123a97[_0x89dd('0x45')][_0x89dd('0x47')]?_0x123a97['attributes']:_0x1e38d0[_0x89dd('0x40')];if(!_0x5d77d4['query']['hasOwnProperty']('nolimit')){_0x123a97[_0x89dd('0x2d')]=qs[_0x89dd('0x2d')](_0x5d77d4[_0x89dd('0x41')][_0x89dd('0x2d')]);_0x123a97[_0x89dd('0x2a')]=qs[_0x89dd('0x2a')](_0x5d77d4['query'][_0x89dd('0x2a')]);}_0x123a97['order']=qs[_0x89dd('0x48')](_0x5d77d4['query']['sort']);_0x123a97[_0x89dd('0x49')]=qs[_0x89dd('0x43')](_[_0x89dd('0x4a')](_0x5d77d4[_0x89dd('0x41')],_0x1e38d0[_0x89dd('0x43')]),_0xf472c4);if(_0x5d77d4[_0x89dd('0x41')][_0x89dd('0x4b')]){_0x123a97[_0x89dd('0x49')]=_['merge'](_0x123a97['where'],{'$or':_['map'](_0xf472c4,function(_0x372cc6){if(_0x372cc6[_0x89dd('0x3f')]!=='VIRTUAL'){var _0x3682f5={};_0x3682f5[_0x372cc6[_0x89dd('0x37')]]={'$like':'%'+_0x5d77d4[_0x89dd('0x41')][_0x89dd('0x4b')]+'%'};return _0x3682f5;}})});}_0x123a97=_[_0x89dd('0x4c')]({},_0x123a97,_0x5d77d4[_0x89dd('0x4d')]);var _0x5d8cf3={'where':_0x123a97[_0x89dd('0x49')]};return db[_0x89dd('0x3c')][_0x89dd('0x2c')](_0x5d8cf3)['then'](function(_0x53777d){_0xa92069['count']=_0x53777d;if(_0x5d77d4['query'][_0x89dd('0x4e')]){_0x123a97[_0x89dd('0x4f')]=[{'all':!![]}];}return db[_0x89dd('0x3c')][_0x89dd('0x50')](_0x123a97);})[_0x89dd('0x31')](function(_0x5ccb1c){_0xa92069[_0x89dd('0x51')]=_0x5ccb1c;return _0xa92069;})['then'](respondWithFilteredResult(_0x5c3234,_0x123a97))[_0x89dd('0x27')](handleError(_0x5c3234,null));};exports['show']=function(_0x525fae,_0x5cd1ac){var _0x4611dc={'raw':![],'where':{'id':_0x525fae['params']['id']},'include':[{'model':db[_0x89dd('0x3a')],'as':_0x89dd('0x52')}]},_0x40c126={};_0x40c126[_0x89dd('0x40')]=_[_0x89dd('0x42')](db[_0x89dd('0x3c')][_0x89dd('0x3d')]);_0x40c126[_0x89dd('0x41')]=_[_0x89dd('0x42')](_0x525fae[_0x89dd('0x41')]);_0x40c126[_0x89dd('0x43')]=_['intersection'](_0x40c126[_0x89dd('0x40')],_0x40c126[_0x89dd('0x41')]);_0x4611dc[_0x89dd('0x45')]=_[_0x89dd('0x44')](_0x40c126[_0x89dd('0x40')],qs[_0x89dd('0x46')](_0x525fae[_0x89dd('0x41')][_0x89dd('0x46')]));_0x4611dc['attributes']=_0x4611dc[_0x89dd('0x45')][_0x89dd('0x47')]?_0x4611dc[_0x89dd('0x45')]:_0x40c126['model'];if(_0x525fae[_0x89dd('0x41')][_0x89dd('0x4e')]){_0x4611dc[_0x89dd('0x4f')]=[{'all':!![]}];}_0x4611dc=_['merge']({},_0x4611dc,_0x525fae[_0x89dd('0x4d')]);return db['SmsAccount']['find'](_0x4611dc)['then'](handleEntityNotFound(_0x5cd1ac,null))[_0x89dd('0x31')](respondWithResult(_0x5cd1ac,null))[_0x89dd('0x27')](handleError(_0x5cd1ac,null));};exports[_0x89dd('0x53')]=function(_0x543f42,_0x13e34d){return db[_0x89dd('0x3c')][_0x89dd('0x53')](_0x543f42[_0x89dd('0x54')],{})[_0x89dd('0x31')](function(_0x146bdb){var _0x970b98=_0x543f42[_0x89dd('0x55')][_0x89dd('0x33')]({'plain':!![]});if(!_0x970b98)throw new Error(_0x89dd('0x56'));if(_0x970b98[_0x89dd('0x57')]==='user'){var _0x56c112=_0x146bdb[_0x89dd('0x33')]({'plain':!![]});var _0x18b24e=_0x89dd('0x34');return db[_0x89dd('0x58')][_0x89dd('0x59')]({'where':{'name':_0x18b24e,'userProfileId':_0x970b98[_0x89dd('0x5a')]},'raw':!![]})[_0x89dd('0x31')](function(_0x4ca48a){if(_0x4ca48a&&_0x4ca48a['autoAssociation']===0x0){return db[_0x89dd('0x5b')][_0x89dd('0x53')]({'name':_0x56c112[_0x89dd('0x37')],'resourceId':_0x56c112['id'],'type':_0x4ca48a[_0x89dd('0x37')],'sectionId':_0x4ca48a['id']},{})['then'](function(){return _0x146bdb;});}else{return _0x146bdb;}})[_0x89dd('0x27')](function(_0x432716){logger[_0x89dd('0x24')](_0x89dd('0x5c'),_0x432716);throw _0x432716;});}return _0x146bdb;})[_0x89dd('0x31')](respondWithResult(_0x13e34d,0xc9))[_0x89dd('0x27')](handleError(_0x13e34d,null));};exports['update']=function(_0x32ac91,_0x101001){if(_0x32ac91[_0x89dd('0x54')]['id']){delete _0x32ac91['body']['id'];}return db[_0x89dd('0x3c')]['find']({'where':{'id':_0x32ac91[_0x89dd('0x5d')]['id']},'include':[{'model':db[_0x89dd('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x89dd('0x31')](handleEntityNotFound(_0x101001,null))[_0x89dd('0x31')](saveUpdates(_0x32ac91['body'],null))['then'](respondWithResult(_0x101001,null))[_0x89dd('0x27')](handleError(_0x101001,null));};exports[_0x89dd('0x32')]=function(_0x3d242f,_0x151c35){return db['SmsAccount'][_0x89dd('0x59')]({'where':{'id':_0x3d242f['params']['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x151c35,null))[_0x89dd('0x31')](removeEntity(_0x151c35,null))[_0x89dd('0x27')](handleError(_0x151c35,null));};exports[_0x89dd('0x5e')]=function(_0x2f5906,_0x4afd10){return db[_0x89dd('0x3c')][_0x89dd('0x5e')]()['then'](respondWithResult(_0x4afd10,null))[_0x89dd('0x27')](handleError(_0x4afd10,null));};exports[_0x89dd('0x5f')]=function(_0x2f415e,_0x565e10,_0x3becbb){if(_0x2f415e[_0x89dd('0x54')]['id']){delete _0x2f415e[_0x89dd('0x54')]['id'];}return db[_0x89dd('0x3c')][_0x89dd('0x59')]({'where':{'id':_0x2f415e['params']['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x565e10,null))[_0x89dd('0x31')](function(_0x37ef09){if(_0x37ef09){_0x2f415e['body']['SmsAccountId']=_0x37ef09['id'];return db['Disposition'][_0x89dd('0x53')](_0x2f415e[_0x89dd('0x54')]);}})[_0x89dd('0x31')](respondWithResult(_0x565e10,null))[_0x89dd('0x27')](handleError(_0x565e10,null));};exports[_0x89dd('0x60')]=function(_0x373509,_0x44d0d0,_0x126df1){var _0xbb1c5d={'raw':![],'where':{}};var _0x56342d={};var _0x109826={'count':0x0,'rows':[]};return db[_0x89dd('0x3c')]['findOne']({'where':{'id':_0x373509[_0x89dd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x44d0d0,null))['then'](function(_0x2178fd){if(_0x2178fd){_0x56342d['model']=_['keys'](db[_0x89dd('0x61')][_0x89dd('0x3d')]);_0x56342d[_0x89dd('0x41')]=_[_0x89dd('0x42')](_0x373509['query']);_0x56342d[_0x89dd('0x43')]=_[_0x89dd('0x44')](_0x56342d['model'],_0x56342d[_0x89dd('0x41')]);_0xbb1c5d[_0x89dd('0x45')]=_[_0x89dd('0x44')](_0x56342d[_0x89dd('0x40')],qs['fields'](_0x373509[_0x89dd('0x41')]['fields']));_0xbb1c5d[_0x89dd('0x45')]=_0xbb1c5d[_0x89dd('0x45')][_0x89dd('0x47')]?_0xbb1c5d['attributes']:_0x56342d[_0x89dd('0x40')];if(!_0x373509[_0x89dd('0x41')][_0x89dd('0x62')](_0x89dd('0x63'))){_0xbb1c5d[_0x89dd('0x2d')]=qs[_0x89dd('0x2d')](_0x373509['query']['limit']);_0xbb1c5d[_0x89dd('0x2a')]=qs[_0x89dd('0x2a')](_0x373509[_0x89dd('0x41')][_0x89dd('0x2a')]);}_0xbb1c5d[_0x89dd('0x64')]=qs[_0x89dd('0x48')](_0x373509[_0x89dd('0x41')][_0x89dd('0x48')]);_0xbb1c5d[_0x89dd('0x49')]=qs[_0x89dd('0x43')](_[_0x89dd('0x4a')](_0x373509[_0x89dd('0x41')],_0x56342d[_0x89dd('0x43')]));_0xbb1c5d[_0x89dd('0x49')][_0x89dd('0x65')]=_0x2178fd['id'];if(_0x373509[_0x89dd('0x41')][_0x89dd('0x4b')]){_0xbb1c5d[_0x89dd('0x49')]=_['merge'](_0xbb1c5d[_0x89dd('0x49')],{'$or':_[_0x89dd('0x3b')](_0xbb1c5d['attributes'],function(_0x225a1e){var _0x26bef5={};_0x26bef5[_0x225a1e]={'$like':'%'+_0x373509[_0x89dd('0x41')][_0x89dd('0x4b')]+'%'};return _0x26bef5;})});}_0xbb1c5d=_[_0x89dd('0x4c')]({},_0xbb1c5d,_0x373509['options']);return db['Disposition'][_0x89dd('0x2c')]({'where':_0xbb1c5d[_0x89dd('0x49')]})[_0x89dd('0x31')](function(_0x36cc49){_0x109826[_0x89dd('0x2c')]=_0x36cc49;if(_0x373509[_0x89dd('0x41')]['includeAll']){_0xbb1c5d[_0x89dd('0x4f')]=[{'all':!![]}];}return db[_0x89dd('0x61')][_0x89dd('0x50')](_0xbb1c5d);})[_0x89dd('0x31')](function(_0xbd2aed){_0x109826[_0x89dd('0x51')]=_0xbd2aed;return _0x109826;});}})[_0x89dd('0x31')](respondWithFilteredResult(_0x44d0d0,_0xbb1c5d))[_0x89dd('0x27')](handleError(_0x44d0d0,null));};exports[_0x89dd('0x66')]=function(_0x117223,_0x3a68e1,_0x28a396){return db[_0x89dd('0x3c')]['find']({'where':{'id':_0x117223['params']['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x3a68e1,null))[_0x89dd('0x31')](function(_0x51b75a){if(_0x51b75a){return _0x51b75a[_0x89dd('0x66')](_0x117223[_0x89dd('0x41')][_0x89dd('0x67')]);}})['then'](respondWithStatusCode(_0x3a68e1,null))['catch'](handleError(_0x3a68e1,null));};exports[_0x89dd('0x68')]=function(_0x52fc8c,_0x204167,_0x4e5c5f){if(_0x52fc8c['body']['id']){delete _0x52fc8c['body']['id'];}return db[_0x89dd('0x3c')][_0x89dd('0x59')]({'where':{'id':_0x52fc8c[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x204167,null))[_0x89dd('0x31')](function(_0x5db10f){if(_0x5db10f){_0x52fc8c['body']['SmsAccountId']=_0x5db10f['id'];return db[_0x89dd('0x69')][_0x89dd('0x53')](_0x52fc8c[_0x89dd('0x54')]);}})[_0x89dd('0x31')](respondWithResult(_0x204167,null))['catch'](handleError(_0x204167,null));};exports[_0x89dd('0x6a')]=function(_0x330855,_0x30e4c1,_0x3b75ab){var _0x1ed4fc={'raw':![],'where':{}};var _0x387071={};var _0x2f8d04={'count':0x0,'rows':[]};return db[_0x89dd('0x3c')][_0x89dd('0x6b')]({'where':{'id':_0x330855[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x30e4c1,null))['then'](function(_0x39fd5d){if(_0x39fd5d){_0x387071[_0x89dd('0x40')]=_[_0x89dd('0x42')](db[_0x89dd('0x69')][_0x89dd('0x3d')]);_0x387071[_0x89dd('0x41')]=_[_0x89dd('0x42')](_0x330855[_0x89dd('0x41')]);_0x387071['filters']=_[_0x89dd('0x44')](_0x387071[_0x89dd('0x40')],_0x387071[_0x89dd('0x41')]);_0x1ed4fc[_0x89dd('0x45')]=_[_0x89dd('0x44')](_0x387071[_0x89dd('0x40')],qs[_0x89dd('0x46')](_0x330855[_0x89dd('0x41')][_0x89dd('0x46')]));_0x1ed4fc['attributes']=_0x1ed4fc[_0x89dd('0x45')][_0x89dd('0x47')]?_0x1ed4fc[_0x89dd('0x45')]:_0x387071['model'];if(!_0x330855['query'][_0x89dd('0x62')](_0x89dd('0x63'))){_0x1ed4fc[_0x89dd('0x2d')]=qs[_0x89dd('0x2d')](_0x330855[_0x89dd('0x41')][_0x89dd('0x2d')]);_0x1ed4fc['offset']=qs[_0x89dd('0x2a')](_0x330855[_0x89dd('0x41')][_0x89dd('0x2a')]);}_0x1ed4fc[_0x89dd('0x64')]=qs[_0x89dd('0x48')](_0x330855[_0x89dd('0x41')]['sort']);_0x1ed4fc[_0x89dd('0x49')]=qs[_0x89dd('0x43')](_['pick'](_0x330855[_0x89dd('0x41')],_0x387071[_0x89dd('0x43')]));_0x1ed4fc[_0x89dd('0x49')][_0x89dd('0x65')]=_0x39fd5d['id'];if(_0x330855[_0x89dd('0x41')][_0x89dd('0x4b')]){_0x1ed4fc[_0x89dd('0x49')]=_['merge'](_0x1ed4fc[_0x89dd('0x49')],{'$or':_[_0x89dd('0x3b')](_0x1ed4fc[_0x89dd('0x45')],function(_0x2b1bb4){var _0x4df6b4={};_0x4df6b4[_0x2b1bb4]={'$like':'%'+_0x330855['query'][_0x89dd('0x4b')]+'%'};return _0x4df6b4;})});}_0x1ed4fc=_['merge']({},_0x1ed4fc,_0x330855[_0x89dd('0x4d')]);return db[_0x89dd('0x69')][_0x89dd('0x2c')]({'where':_0x1ed4fc[_0x89dd('0x49')]})['then'](function(_0x2e47fd){_0x2f8d04[_0x89dd('0x2c')]=_0x2e47fd;if(_0x330855[_0x89dd('0x41')]['includeAll']){_0x1ed4fc[_0x89dd('0x4f')]=[{'all':!![]}];}return db[_0x89dd('0x69')]['findAll'](_0x1ed4fc);})[_0x89dd('0x31')](function(_0x520de9){_0x2f8d04[_0x89dd('0x51')]=_0x520de9;return _0x2f8d04;});}})[_0x89dd('0x31')](respondWithFilteredResult(_0x30e4c1,_0x1ed4fc))[_0x89dd('0x27')](handleError(_0x30e4c1,null));};exports[_0x89dd('0x6c')]=function(_0xb7d33d,_0x5bdd7c,_0x1cec96){return db['SmsAccount'][_0x89dd('0x59')]({'where':{'id':_0xb7d33d[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x5bdd7c,null))['then'](function(_0x239be3){if(_0x239be3){return _0x239be3['removeAnswers'](_0xb7d33d[_0x89dd('0x41')]['ids']);}})[_0x89dd('0x31')](respondWithStatusCode(_0x5bdd7c,null))[_0x89dd('0x27')](handleError(_0x5bdd7c,null));};exports[_0x89dd('0x6d')]=function(_0x5812d3,_0x4d7784,_0x26449a){var _0x245e61={'channel':_0x89dd('0x6e')};var _0x4e0374=[];var _0x35363c=[];var _0x1d13fa={};return db[_0x89dd('0x3c')][_0x89dd('0x59')]({'where':{'id':_0x5812d3[_0x89dd('0x5d')]['id']},'include':[{'model':db[_0x89dd('0x6f')],'as':_0x89dd('0x70')}]})['then'](handleEntityNotFound(_0x4d7784,null))[_0x89dd('0x31')](function(_0x43d999){_0x245e61[_0x89dd('0x71')]=_0x43d999;_0x245e61['applications']=_[_0x89dd('0x72')](_0x43d999['Applications'],['priority'],[_0x89dd('0x73')]);if(_0x245e61[_0x89dd('0x71')][_0x89dd('0x70')]){delete _0x245e61[_0x89dd('0x71')]['Applications'];}return db['CmContact'][_0x89dd('0x5e')]();})[_0x89dd('0x31')](function(_0x1ca607){if(!_0x1ca607){throw new db[(_0x89dd('0x74'))]['ValidationError'](_0x89dd('0x75'));}_0x4e0374=_[_0x89dd('0x76')](_['keys'](_0x1ca607),[_0x89dd('0x77'),'updatedAt']);_0x35363c=_['difference'](_[_0x89dd('0x42')](_0x1ca607),[_0x89dd('0x77'),_0x89dd('0x78'),_0x89dd('0x79'),_0x89dd('0x7a')]);_0x245e61[_0x89dd('0x54')]={'mapKey':'mobile'};if(_0x245e61[_0x89dd('0x71')][_0x89dd('0x3f')]){switch(_0x245e61[_0x89dd('0x71')][_0x89dd('0x3f')]){case _0x89dd('0x7b'):_0x245e61[_0x89dd('0x54')][_0x89dd('0x7c')]=_0x5812d3['body'][_0x89dd('0x7d')];_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x7e')];_0x245e61[_0x89dd('0x54')][_0x89dd('0x7f')]=_0x5812d3['body'][_0x89dd('0x80')];break;case _0x89dd('0x81'):_0x245e61[_0x89dd('0x54')][_0x89dd('0x7c')]='+'+_0x5812d3['body'][_0x89dd('0x82')];_0x245e61['body'][_0x89dd('0x54')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x83')];break;case _0x89dd('0x84'):_0x245e61[_0x89dd('0x54')][_0x89dd('0x7c')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x7c')];_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')]=_0x5812d3[_0x89dd('0x54')]['message'];break;case _0x89dd('0x85'):_0x245e61['body']['from']=_0x5812d3['body'][_0x89dd('0x7c')];_0x245e61[_0x89dd('0x54')]['body']=_0x5812d3[_0x89dd('0x54')]['body'];_0x245e61[_0x89dd('0x54')][_0x89dd('0x7f')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x86')];break;case _0x89dd('0x87'):_0x245e61['body']['from']=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x7d')];_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')]=_0x5812d3[_0x89dd('0x54')]['Text'];_0x245e61[_0x89dd('0x54')][_0x89dd('0x7f')]=_0x5812d3['body'][_0x89dd('0x88')];break;case'infobip':_0x245e61['body'][_0x89dd('0x7c')]='+'+_0x5812d3[_0x89dd('0x54')]['results'][0x0][_0x89dd('0x7c')];_0x245e61[_0x89dd('0x54')]['body']=_0x5812d3[_0x89dd('0x54')]['results'][0x0]['text'];_0x245e61[_0x89dd('0x54')][_0x89dd('0x7f')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x89')][0x0][_0x89dd('0x7f')];break;case _0x89dd('0x8a'):_0x245e61[_0x89dd('0x54')][_0x89dd('0x7c')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x8b')];_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x8c')][_0x89dd('0x25')];break;case'clickatell':_0x245e61[_0x89dd('0x54')]['from']=_0x5812d3['body']['fromNumber'];_0x245e61[_0x89dd('0x54')]['body']=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x83')];_0x245e61[_0x89dd('0x54')][_0x89dd('0x7f')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x8d')];break;case _0x89dd('0x8e'):_0x245e61[_0x89dd('0x54')][_0x89dd('0x7f')]=_0x5812d3[_0x89dd('0x54')][0x0][_0x89dd('0x25')]['id'];_0x245e61[_0x89dd('0x54')][_0x89dd('0x7c')]=_0x5812d3[_0x89dd('0x54')][0x0][_0x89dd('0x25')]['from'];_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')]=_0x5812d3['body'][0x0][_0x89dd('0x25')][_0x89dd('0x83')];break;case _0x89dd('0x8f'):_0x245e61[_0x89dd('0x54')][_0x89dd('0x7c')]=_0x5812d3['body'][_0x89dd('0x7c')];_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')]=_0x5812d3['body'][_0x89dd('0x25')];_0x245e61['body'][_0x89dd('0x7f')]=_0x5812d3[_0x89dd('0x54')][_0x89dd('0x90')];break;}}if(_0x245e61[_0x89dd('0x54')]['id']){delete _0x245e61[_0x89dd('0x54')]['id'];}if(_['isNil'](_0x245e61[_0x89dd('0x54')]['from'])){throw new db['Sequelize'][(_0x89dd('0x91'))](_0x89dd('0x92'));}if(_[_0x89dd('0x93')](_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')])||_0x245e61[_0x89dd('0x54')][_0x89dd('0x54')]===''){throw new db['Sequelize'][(_0x89dd('0x91'))](_0x89dd('0x94'));}if(_[_0x89dd('0x93')](_0x245e61[_0x89dd('0x54')]['mapKey'])){throw new db[(_0x89dd('0x74'))][(_0x89dd('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x35363c);}if(!_[_0x89dd('0x95')](_0x35363c,_0x245e61[_0x89dd('0x54')][_0x89dd('0x96')])){throw new db[(_0x89dd('0x74'))][(_0x89dd('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x35363c);}_0x1d13fa[_0x245e61[_0x89dd('0x54')][_0x89dd('0x96')]]=_0x245e61[_0x89dd('0x54')][_0x89dd('0x7c')];return db[_0x89dd('0x97')]['find']({'where':{'id':_0x245e61[_0x89dd('0x71')][_0x89dd('0x7a')]},'include':[{'model':db[_0x89dd('0x98')],'as':_0x89dd('0x99'),'where':_0x1d13fa,'limit':0x1,'order':[[_0x89dd('0x78'),'DESC']]}]});})['then'](handleEntityNotFound(_0x4d7784,null))[_0x89dd('0x31')](function(_0x180ca8){if(_0x180ca8){_0x245e61[_0x89dd('0x9a')]=_[_0x89dd('0x9b')](_0x180ca8,[_0x89dd('0x99')]);if(_0x180ca8['Contacts']['length']){return _0x180ca8[_0x89dd('0x99')][0x0];}var _0x17b61d=_[_0x89dd('0x17')](_0x245e61[_0x89dd('0x54')],{'firstName':_0x245e61['body']['from'],'ListId':_0x180ca8['id']});_0x17b61d[_0x245e61[_0x89dd('0x54')]['mapKey']]=_0x245e61[_0x89dd('0x54')]['from'];return db['CmContact'][_0x89dd('0x53')](_0x17b61d,{'fields':_0x4e0374,'raw':!![]});}})['then'](handleEntityNotFound(_0x4d7784,null))[_0x89dd('0x31')](function(_0x3e96d7){if(_0x3e96d7){_0x245e61[_0x89dd('0x9c')]=_0x3e96d7;var _0x3d6e2a={'ContactId':_0x3e96d7['id'],'phone':_0x245e61[_0x89dd('0x54')]['from'],'SmsAccountId':_0x5812d3[_0x89dd('0x5d')]['id']};var _0x13317f={'ContactId':_0x3e96d7['id'],'SmsAccountId':_0x5812d3[_0x89dd('0x5d')]['id'],'closed':![]};return db[_0x89dd('0x9d')][_0x89dd('0x59')]({'where':_0x13317f})[_0x89dd('0x31')](function(_0x10e2ba){if(_0x10e2ba){return[_0x10e2ba,![]];}return db['SmsInteraction'][_0x89dd('0x53')](_0x3d6e2a)[_0x89dd('0x31')](function(_0x55fffa){return[_0x55fffa,!![]];});});}})[_0x89dd('0x9e')](function(_0x3678e2,_0xc7f7f5){_0x245e61[_0x89dd('0x9f')]=_0x3678e2[_0x89dd('0x33')]({'plain':!![]});_0x245e61['interaction'][_0x89dd('0xa0')]=![];if(_0xc7f7f5){if(_0x245e61[_0x89dd('0x71')][_0x89dd('0xa1')]){_0x245e61['applications'][_0x89dd('0xa2')]({'id':0x0,'priority':_0x245e61[_0x89dd('0xa3')]['length']+0x1,'app':_0x89dd('0xa4'),'appdata':_0x89dd('0xa5'),'interval':_0x89dd('0xa6')});}_0x245e61[_0x89dd('0x9f')][_0x89dd('0xa0')]=!![];}return db[_0x89dd('0xa7')][_0x89dd('0x53')]({'phone':_0x245e61[_0x89dd('0x54')]['from'],'messageId':_0x245e61[_0x89dd('0x54')]['messageId'],'body':_0x245e61[_0x89dd('0x54')]['body'],'SmsAccountId':_0x5812d3['params']['id'],'SmsInteractionId':_0x3678e2['id'],'direction':'in','ContactId':_0x3678e2[_0x89dd('0xa8')],'AttachmentId':_0x245e61['body']['AttachmentId']});})['then'](function(_0x52e447){_0x245e61['message']=_0x52e447;if(_0x245e61['interaction'][_0x89dd('0xa9')]){return db[_0x89dd('0xaa')]['find']({'attributes':['id',_0x89dd('0x37')],'where':{'id':_0x245e61['interaction'][_0x89dd('0xa9')]}})['then'](function(_0x37daab){if(_0x37daab){_0x245e61[_0x89dd('0xa3')][_0x89dd('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x37daab[_0x89dd('0x37')]+','+(_0x245e61[_0x89dd('0x71')][_0x89dd('0xac')]||0xa),'interval':_0x89dd('0xa6')});}return respondWithRpcPromise(_0x89dd('0xad'),'startRouting',_0x245e61);});}return respondWithRpcPromise(_0x89dd('0xad'),_0x89dd('0xae'),_0x245e61);})[_0x89dd('0x31')](function(_0x56efc6){if(_0x56efc6){var _0x52a755=0xc8;var _0x1b54cb='receiveMessage';logger[_0x89dd('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b54cb,_0x52a755,_0x89dd('0xaf'));logger[_0x89dd('0x22')](_0x89dd('0xb0'),_0x1b54cb,_0x52a755,_0x89dd('0xaf'),JSON[_0x89dd('0x23')](_0x56efc6));if(_0x245e61[_0x89dd('0x71')][_0x89dd('0x3f')]===_0x89dd('0x7b')){return _0x4d7784[_0x89dd('0x28')](_0x52a755)[_0x89dd('0xb1')]('Content-Type',_0x89dd('0xb2'))[_0x89dd('0x38')](_0x89dd('0xb3'));}else{return _0x4d7784['status'](_0x52a755)[_0x89dd('0x29')](_0x56efc6);}}})[_0x89dd('0x27')](handleError(_0x4d7784,null));};exports[_0x89dd('0xb4')]=function(_0x2d9f3b,_0x58a1c2,_0x5e2473){return db[_0x89dd('0x3c')][_0x89dd('0x6b')]({'where':{'id':_0x2d9f3b[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x58a1c2,null))[_0x89dd('0x31')](function(_0x2b4bcd){if(_0x2b4bcd){return db[_0x89dd('0xb5')][_0x89dd('0xb6')](function(_0x91c15d){return db['SmsApplication'][_0x89dd('0x32')]({'where':{'SmsAccountId':_0x2d9f3b['params']['id']},'transaction':_0x91c15d})[_0x89dd('0x31')](function(_0x5c6a51){var _0xbff073=_['map'](_0x2d9f3b[_0x89dd('0x54')],function(_0xb25d1d){_0xb25d1d[_0x89dd('0x65')]=_0x2d9f3b['params']['id'];return _0xb25d1d;});return db['SmsApplication'][_0x89dd('0xb7')](_0xbff073,{'transaction':_0x91c15d});});})['then'](function(){return db[_0x89dd('0x6f')]['findAndCountAll']({'where':{'SmsAccountId':_0x2d9f3b['params']['id']},'order':'priority'});});}})[_0x89dd('0x31')](respondWithResult(_0x58a1c2,null))['catch'](handleError(_0x58a1c2,null));};exports[_0x89dd('0xb8')]=function(_0x27dd76,_0x2d7496,_0x47c6a0){var _0x2ed639={};var _0x58e076={};var _0x54abb3;var _0x57a620;return db[_0x89dd('0x3c')][_0x89dd('0x6b')]({'where':{'id':_0x27dd76[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x2d7496,null))[_0x89dd('0x31')](function(_0x482b64){if(_0x482b64){_0x54abb3=_0x482b64;_0x58e076[_0x89dd('0x40')]=_[_0x89dd('0x42')](db[_0x89dd('0x6f')][_0x89dd('0x3d')]);_0x58e076[_0x89dd('0x41')]=_[_0x89dd('0x42')](_0x27dd76[_0x89dd('0x41')]);_0x58e076[_0x89dd('0x43')]=_['intersection'](_0x58e076[_0x89dd('0x40')],_0x58e076[_0x89dd('0x41')]);_0x2ed639['attributes']=_[_0x89dd('0x44')](_0x58e076[_0x89dd('0x40')],qs[_0x89dd('0x46')](_0x27dd76['query'][_0x89dd('0x46')]));_0x2ed639['attributes']=_0x2ed639[_0x89dd('0x45')][_0x89dd('0x47')]?_0x2ed639[_0x89dd('0x45')]:_0x58e076[_0x89dd('0x40')];_0x2ed639[_0x89dd('0x64')]=qs[_0x89dd('0x48')](_0x27dd76[_0x89dd('0x41')][_0x89dd('0x48')]);_0x2ed639[_0x89dd('0x49')]=qs[_0x89dd('0x43')](_[_0x89dd('0x4a')](_0x27dd76[_0x89dd('0x41')],_0x58e076[_0x89dd('0x43')]));if(_0x27dd76[_0x89dd('0x41')][_0x89dd('0x4b')]){_0x2ed639['where']=_['merge'](_0x2ed639['where'],{'$or':_[_0x89dd('0x3b')](_0x2ed639[_0x89dd('0x45')],function(_0x55e257){var _0x5a3f5f={};_0x5a3f5f[_0x55e257]={'$like':'%'+_0x27dd76[_0x89dd('0x41')][_0x89dd('0x4b')]+'%'};return _0x5a3f5f;})});}_0x2ed639=_[_0x89dd('0x4c')]({},_0x2ed639,_0x27dd76[_0x89dd('0x4d')]);return _0x54abb3[_0x89dd('0xb8')](_0x2ed639);}})['then'](function(_0x97f58c){if(_0x97f58c){_0x57a620=_0x97f58c['length'];if(!_0x27dd76[_0x89dd('0x41')][_0x89dd('0x62')]('nolimit')){_0x2ed639[_0x89dd('0x2d')]=qs[_0x89dd('0x2d')](_0x27dd76['query']['limit']);_0x2ed639[_0x89dd('0x2a')]=qs[_0x89dd('0x2a')](_0x27dd76[_0x89dd('0x41')][_0x89dd('0x2a')]);}return _0x54abb3[_0x89dd('0xb8')](_0x2ed639);}})[_0x89dd('0x31')](function(_0x816e86){if(_0x816e86){return _0x816e86?{'count':_0x57a620,'rows':_0x816e86}:null;}})['then'](respondWithResult(_0x2d7496,null))[_0x89dd('0x27')](handleError(_0x2d7496,null));};exports['getInteractions']=function(_0x26be9d,_0x18c2d4,_0x55bfc5){var _0x1c4a51={'raw':![],'where':{}};var _0x417cbb={};var _0x50994b={'count':0x0,'rows':[]};return db[_0x89dd('0x3c')][_0x89dd('0x6b')]({'where':{'id':_0x26be9d[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x18c2d4,null))[_0x89dd('0x31')](function(_0x123617){if(_0x123617){_0x417cbb['model']=_[_0x89dd('0x42')](db[_0x89dd('0x9d')][_0x89dd('0x3d')]);_0x417cbb[_0x89dd('0x41')]=_[_0x89dd('0x42')](_0x26be9d[_0x89dd('0x41')]);_0x417cbb[_0x89dd('0x43')]=_[_0x89dd('0x44')](_0x417cbb[_0x89dd('0x40')],_0x417cbb[_0x89dd('0x41')]);_0x1c4a51[_0x89dd('0x45')]=_['intersection'](_0x417cbb[_0x89dd('0x40')],qs['fields'](_0x26be9d[_0x89dd('0x41')][_0x89dd('0x46')]));_0x1c4a51['attributes']=_0x1c4a51[_0x89dd('0x45')][_0x89dd('0x47')]?_0x1c4a51[_0x89dd('0x45')]:_0x417cbb['model'];if(!_0x26be9d[_0x89dd('0x41')][_0x89dd('0x62')](_0x89dd('0x63'))){_0x1c4a51[_0x89dd('0x2d')]=qs[_0x89dd('0x2d')](_0x26be9d[_0x89dd('0x41')][_0x89dd('0x2d')]);_0x1c4a51[_0x89dd('0x2a')]=qs['offset'](_0x26be9d[_0x89dd('0x41')][_0x89dd('0x2a')]);}_0x1c4a51[_0x89dd('0x64')]=qs[_0x89dd('0x48')](_0x26be9d[_0x89dd('0x41')][_0x89dd('0x48')]);_0x1c4a51[_0x89dd('0x49')]=qs[_0x89dd('0x43')](_[_0x89dd('0x4a')](_0x26be9d[_0x89dd('0x41')],_0x417cbb[_0x89dd('0x43')]));_0x1c4a51[_0x89dd('0x49')]['SmsAccountId']=_0x123617['id'];if(_0x26be9d[_0x89dd('0x41')][_0x89dd('0x4b')]){_0x1c4a51[_0x89dd('0x49')]=_[_0x89dd('0x4c')](_0x1c4a51['where'],{'$or':_[_0x89dd('0x3b')](_0x1c4a51['attributes'],function(_0x15e54e){var _0x285cd2={};_0x285cd2[_0x15e54e]={'$like':'%'+_0x26be9d[_0x89dd('0x41')][_0x89dd('0x4b')]+'%'};return _0x285cd2;})});}_0x1c4a51=_[_0x89dd('0x4c')]({},_0x1c4a51,_0x26be9d[_0x89dd('0x4d')]);return db['SmsInteraction']['count']({'where':_0x1c4a51[_0x89dd('0x49')]})[_0x89dd('0x31')](function(_0x4b4c68){_0x50994b['count']=_0x4b4c68;if(_0x26be9d['query']['includeAll']){_0x1c4a51[_0x89dd('0x4f')]=[{'model':db[_0x89dd('0x98')],'as':_0x89dd('0xb9'),'required':![]},{'model':db[_0x89dd('0xaa')],'as':_0x89dd('0xba'),'attributes':['name',_0x89dd('0xbb'),'internal'],'required':![]},{'model':db[_0x89dd('0xbc')],'as':_0x89dd('0xbd'),'attributes':['id',_0x89dd('0x37'),_0x89dd('0xbe')],'where':_0x26be9d[_0x89dd('0x41')][_0x89dd('0xbf')]?{'id':_0x26be9d[_0x89dd('0x41')][_0x89dd('0xbf')]}:undefined,'required':_0x26be9d[_0x89dd('0x41')][_0x89dd('0xbf')]?!![]:![]}];}return db['SmsInteraction'][_0x89dd('0x50')](_0x1c4a51);})[_0x89dd('0x31')](function(_0x393b57){_0x50994b[_0x89dd('0x51')]=_0x393b57;return _0x50994b;});}})['then'](respondWithFilteredResult(_0x18c2d4,_0x1c4a51))[_0x89dd('0x27')](handleError(_0x18c2d4,null));};exports['send']=function(_0x1f765c,_0xfbff31,_0x51d4d5){var _0x11127b,_0x375a0f,_0xaefd17;if(_[_0x89dd('0x93')](_0x1f765c[_0x89dd('0x54')][_0x89dd('0x54')])||_0x1f765c[_0x89dd('0x54')]['body']===''){throw new db['Sequelize'][(_0x89dd('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x89dd('0x93')](_0x1f765c[_0x89dd('0x54')]['to'])){throw new db[(_0x89dd('0x74'))]['ValidationError'](_0x89dd('0xc0'));}_0x11127b=_0x1f765c[_0x89dd('0x54')]['to'];return db[_0x89dd('0x3c')][_0x89dd('0x59')]({'where':{'id':_0x1f765c[_0x89dd('0x5d')]['id']},'include':[{'model':db[_0x89dd('0x97')],'as':_0x89dd('0xc1'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x11127b},'limit':0x1,'order':[[_0x89dd('0x78'),_0x89dd('0xc2')]]}]}]})[_0x89dd('0x31')](handleEntityNotFound(_0xfbff31,null))['then'](function(_0x5ed128){if(_0x5ed128&&_0x5ed128[_0x89dd('0xc1')]){_0x375a0f=_0x5ed128[_0x89dd('0x33')]({'plain':!![]});if(_0x375a0f[_0x89dd('0xc1')]&&_0x375a0f['List'][_0x89dd('0x99')][_0x89dd('0x47')]){return _0x375a0f[_0x89dd('0xc1')][_0x89dd('0x99')][0x0];}return db[_0x89dd('0x98')]['create'](_['defaults'](_0x1f765c[_0x89dd('0x54')],{'firstName':_0x11127b,'mobile':_0x11127b,'phone':_0x11127b,'ListId':_0x375a0f[_0x89dd('0x7a')]}));}})['then'](handleEntityNotFound(_0xfbff31,null))['then'](function(_0x5ed8ae){if(_0x5ed8ae){_0xaefd17=_0x5ed8ae;return db[_0x89dd('0x9d')][_0x89dd('0x59')]({'where':{'ContactId':_0xaefd17['id'],'closed':![],'SmsAccountId':_0x375a0f['id']}})[_0x89dd('0x31')](function(_0x60f8a2){if(_0x60f8a2){return[_0x60f8a2,![]];}return db[_0x89dd('0x9d')][_0x89dd('0x53')]({'UserId':_0x1f765c[_0x89dd('0x55')]['id'],'ContactId':_0xaefd17['id'],'SmsAccountId':_0x375a0f['id'],'phone':_0x11127b,'firstMsgDirection':_0x89dd('0xc3'),'Messages':[_['merge'](_0x1f765c[_0x89dd('0x54')],{'read':![],'body':_0x1f765c['body']['body'],'phone':_0x11127b,'SmsAccountId':_0x375a0f['id'],'UserId':_0x1f765c['user']['id'],'ContactId':_0xaefd17['id']})]},{'include':[{'model':db[_0x89dd('0xa7')],'as':_0x89dd('0xc4')}]})[_0x89dd('0x31')](function(_0x311ed4){return[_0x311ed4,!![]];});});}})[_0x89dd('0x9e')](function(_0x250186,_0x25de2c){if(_0x25de2c){return _0x250186;}return db[_0x89dd('0xa7')][_0x89dd('0x53')](_['merge'](_0x1f765c[_0x89dd('0x54')],{'read':![],'body':_0x1f765c[_0x89dd('0x54')][_0x89dd('0x54')],'phone':_0x11127b,'SmsAccountId':_0x375a0f['id'],'SmsInteractionId':_0x250186['id'],'UserId':_0x1f765c['user']['id'],'ContactId':_0xaefd17['id']}))['then'](function(_0x194058){_0x250186['dataValues'][_0x89dd('0xc4')]=[];_0x250186[_0x89dd('0xc5')][_0x89dd('0xc4')][_0x89dd('0xa2')](_0x194058[_0x89dd('0xc5')]);return _0x250186;});})[_0x89dd('0x31')](respondWithResult(_0xfbff31,null))['catch'](handleError(_0xfbff31,null));};exports[_0x89dd('0x28')]=function(_0x5127c1,_0x59464e,_0x51e188){if(_0x5127c1[_0x89dd('0x54')]['id']){delete _0x5127c1[_0x89dd('0x54')]['id'];}var _0x1467a2,_0x13e160,_0x522cf1;return db[_0x89dd('0x3c')][_0x89dd('0x59')]({'where':{'id':_0x5127c1[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x59464e,null))[_0x89dd('0x31')](function(_0x10e814){if(_0x10e814){_0x522cf1=_0x10e814;logger[_0x89dd('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x10e814[_0x89dd('0x3f')],util[_0x89dd('0xc6')](_0x5127c1['body'],{'showHidden':![],'depth':null}));switch(_0x10e814['type']){case _0x89dd('0x81'):if(_0x5127c1[_0x89dd('0x54')][_0x89dd('0xc7')]&&_0x5127c1[_0x89dd('0x54')][_0x89dd('0x28')]){_0x13e160=_0x5127c1[_0x89dd('0x54')][_0x89dd('0x28')];return db[_0x89dd('0xa7')][_0x89dd('0x59')]({'where':{'messageId':_0x5127c1[_0x89dd('0x54')]['skebby_dispatch_id']}});}break;case _0x89dd('0x84'):if(_0x5127c1[_0x89dd('0x54')][_0x89dd('0xc8')]&&_0x5127c1[_0x89dd('0x54')][_0x89dd('0xc9')]){_0x13e160=_0x5127c1['body'][_0x89dd('0xc9')];return db[_0x89dd('0xa7')][_0x89dd('0x59')]({'where':{'messageId':_0x5127c1[_0x89dd('0x54')][_0x89dd('0xc8')]}});}break;case _0x89dd('0x85'):if(_0x5127c1[_0x89dd('0x54')][_0x89dd('0x86')]&&_0x5127c1[_0x89dd('0x54')]['status_code']){_0x13e160=_0x5127c1['body'][_0x89dd('0xca')];return db[_0x89dd('0xa7')]['find']({'where':{'messageId':_0x5127c1[_0x89dd('0x54')]['message_id']}});}break;case _0x89dd('0xcb'):var _0x13ee31=_0x5127c1[_0x89dd('0x54')][_0x89dd('0x89')][0x0];if(_0x13ee31[_0x89dd('0x7f')]&&_0x13ee31['status'][_0x89dd('0xcc')]===_0x89dd('0xcd')){_0x13e160=_0x13ee31['status'][_0x89dd('0xcc')];return db[_0x89dd('0xa7')]['find']({'where':{'messageId':_0x13ee31['messageId']}});}break;case'clickatell':if(_0x5127c1[_0x89dd('0x54')][_0x89dd('0x7f')]&&_0x5127c1[_0x89dd('0x54')][_0x89dd('0x28')]){_0x13e160=_0x5127c1[_0x89dd('0x54')]['status'];return db[_0x89dd('0xa7')][_0x89dd('0x59')]({'where':{'messageId':_0x5127c1[_0x89dd('0x54')][_0x89dd('0x7f')]}});}break;case _0x89dd('0x8e'):if(_0x5127c1[_0x89dd('0x54')][0x0][_0x89dd('0x25')]['id']){_0x13e160=_0x5127c1[_0x89dd('0x54')][0x0][_0x89dd('0x3f')];return db[_0x89dd('0xa7')]['find']({'where':{'messageId':_0x5127c1[_0x89dd('0x54')][0x0][_0x89dd('0x25')]['id']}});}break;case _0x89dd('0x8f'):if(_0x5127c1['body'][_0x89dd('0xce')]&&_0x5127c1[_0x89dd('0x54')][_0x89dd('0x28')]){_0x13e160=_0x5127c1['body'][_0x89dd('0x28')];return db[_0x89dd('0xa7')][_0x89dd('0x59')]({'where':{'messageId':_0x5127c1['body'][_0x89dd('0xce')]}});}break;}}})['then'](handleEntityNotFound(_0x59464e,null))[_0x89dd('0x31')](function(_0x2dec09){if(_0x2dec09){_0x1467a2=_0x2dec09;switch(_0x522cf1[_0x89dd('0x3f')]){case _0x89dd('0x81'):if(_0x13e160===_0x89dd('0xcd')){return _0x1467a2[_0x89dd('0x30')]({'read':!![]});}else{logger[_0x89dd('0x24')](_0x89dd('0xcf'),'status',_0x89dd('0x81'),util['inspect'](_0x5127c1[_0x89dd('0x54')],{'showHidden':![],'depth':null}));}break;case _0x89dd('0x84'):if(_0x13e160==='1'){return _0x1467a2['update']({'read':!![]});}else{logger[_0x89dd('0x24')](_0x89dd('0xcf'),_0x89dd('0x28'),_0x89dd('0x81'),util[_0x89dd('0xc6')](_0x5127c1[_0x89dd('0x54')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5127c1[_0x89dd('0x54')][_0x89dd('0xd0')]&&_0x13e160>=0xc8&&_0x13e160<=0xce){return _0x1467a2[_0x89dd('0x30')]({'read':!![]});}else{logger['error'](_0x89dd('0xcf'),_0x89dd('0x28'),_0x89dd('0x85'),util['inspect'](_0x5127c1[_0x89dd('0x54')],{'showHidden':![],'depth':null}));}break;case _0x89dd('0xcb'):var _0xcbb13=_0x5127c1[_0x89dd('0x54')]['results'][0x0];if(_0xcbb13[_0x89dd('0x28')][_0x89dd('0xcc')]===_0x89dd('0xcd')){return _0x1467a2[_0x89dd('0x30')]({'read':!![]});}else{logger[_0x89dd('0x24')](_0x89dd('0xcf'),_0x89dd('0x28'),_0x89dd('0xcb'),util[_0x89dd('0xc6')](_0x5127c1[_0x89dd('0x54')],{'showHidden':![],'depth':null}));}break;case _0x89dd('0xd1'):if(_0x13e160==_0x89dd('0xd2')||_0x13e160==_0x89dd('0xd3')){return _0x1467a2['update']({'read':!![]});}else{logger['error'](_0x89dd('0xcf'),_0x89dd('0x28'),_0x89dd('0xd1'),util['inspect'](_0x5127c1[_0x89dd('0x54')],{'showHidden':![],'depth':null}));}break;case _0x89dd('0x8e'):if(_0x13e160==_0x89dd('0xd4')){return _0x1467a2['update']({'read':!![]});}else{logger[_0x89dd('0x24')](_0x89dd('0xcf'),_0x89dd('0x28'),_0x89dd('0x8e'),util[_0x89dd('0xc6')](_0x5127c1[_0x89dd('0x54')],{'showHidden':![],'depth':null}));}break;case _0x89dd('0x8f'):if(_0x13e160===_0x89dd('0xd5')||_0x13e160===_0x89dd('0xd6')){return _0x1467a2[_0x89dd('0x30')]({'read':!![]});}else{logger[_0x89dd('0x24')](_0x89dd('0xcf'),_0x89dd('0x28'),_0x89dd('0x8f'),util[_0x89dd('0xc6')](_0x5127c1[_0x89dd('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x1467a2;}})['then'](respondWithResult(_0x59464e,null))[_0x89dd('0x27')](handleError(_0x59464e,null));};exports[_0x89dd('0xd7')]=function(_0x14f8ef,_0x35265c,_0x4b38af){var _0x45f902,_0x14cd1b,_0x22c51b;return db[_0x89dd('0x3c')][_0x89dd('0x59')]({'where':{'id':_0x14f8ef[_0x89dd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x35265c,null))[_0x89dd('0x31')](function(_0x424083){if(_0x424083){_0x22c51b=_0x424083;logger['debug'](_0x89dd('0xcf'),_0x89dd('0x28'),_0x89dd('0xd8'),_0x424083[_0x89dd('0x3f')],util[_0x89dd('0xc6')](_0x14f8ef[_0x89dd('0x41')],{'showHidden':![],'depth':null}));switch(_0x424083[_0x89dd('0x3f')]){case _0x89dd('0x8a'):if(_0x14f8ef[_0x89dd('0x41')][_0x89dd('0xd9')]&&_0x14f8ef[_0x89dd('0x41')][_0x89dd('0xda')]){_0x14cd1b=_0x14f8ef[_0x89dd('0x41')][_0x89dd('0xda')];return db[_0x89dd('0xa7')]['find']({'where':{'messageId':_0x14f8ef[_0x89dd('0x41')]['message-id']}});}break;}}})[_0x89dd('0x31')](handleEntityNotFound(_0x35265c,null))[_0x89dd('0x31')](function(_0x3c4aa8){if(_0x3c4aa8){_0x45f902=_0x3c4aa8;switch(_0x22c51b[_0x89dd('0x3f')]){case'csc':if(_0x14cd1b==='2'||_0x14cd1b==='6'){return _0x45f902[_0x89dd('0x30')]({'read':!![]});}else{logger[_0x89dd('0x24')](_0x89dd('0xcf'),_0x89dd('0x28'),'csc',util[_0x89dd('0xc6')](_0x14f8ef['query'],{'showHidden':![],'depth':null}));};break;}return _0x45f902;}})[_0x89dd('0x31')](respondWithResult(_0x35265c,null))[_0x89dd('0x27')](handleError(_0x35265c,null));};exports[_0x89dd('0xdb')]=function(_0x5ee71b,_0x3afbf3,_0x475875){return db[_0x89dd('0x3c')][_0x89dd('0x59')]({'where':{'id':_0x5ee71b[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x3afbf3,null))[_0x89dd('0x31')](function(_0x2f1589){if(_0x2f1589){return _0x2f1589[_0x89dd('0xdb')](_0x5ee71b[_0x89dd('0x54')][_0x89dd('0x67')],_[_0x89dd('0x9b')](_0x5ee71b[_0x89dd('0x54')],[_0x89dd('0x67'),'id'])||{})[_0x89dd('0x9e')](function(_0x1b64d9){for(var _0x55e956=0x0;_0x55e956<_0x5ee71b['body'][_0x89dd('0x67')][_0x89dd('0x47')];_0x55e956+=0x1){socket[_0x89dd('0xdc')]('userSmsAccount:save',{'UserId':Number(_0x5ee71b[_0x89dd('0x54')][_0x89dd('0x67')][_0x55e956]),'SmsAccountId':Number(_0x5ee71b[_0x89dd('0x5d')]['id'])});}return _0x1b64d9;});}})[_0x89dd('0x31')](respondWithResult(_0x3afbf3,null))[_0x89dd('0x27')](handleError(_0x3afbf3,null));};exports[_0x89dd('0xdd')]=function(_0x26f02a,_0x472eb9,_0x2b4068){return db['SmsAccount'][_0x89dd('0x59')]({'where':{'id':_0x26f02a[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0x472eb9,null))[_0x89dd('0x31')](function(_0x36781d){if(_0x36781d){return _0x36781d[_0x89dd('0xdd')](_0x26f02a[_0x89dd('0x41')][_0x89dd('0x67')])[_0x89dd('0x31')](function(){if(_[_0x89dd('0xde')](_0x26f02a[_0x89dd('0x41')]['ids'])){for(var _0x2529f3=0x0;_0x2529f3<_0x26f02a[_0x89dd('0x41')][_0x89dd('0x67')]['length'];_0x2529f3+=0x1){socket[_0x89dd('0xdc')](_0x89dd('0xdf'),{'UserId':Number(_0x26f02a[_0x89dd('0x41')][_0x89dd('0x67')][_0x2529f3]),'SmsAccountId':Number(_0x26f02a[_0x89dd('0x5d')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x26f02a[_0x89dd('0x41')][_0x89dd('0x67')]),'SmsAccountId':Number(_0x26f02a[_0x89dd('0x5d')]['id'])});}});}})[_0x89dd('0x31')](respondWithStatusCode(_0x472eb9,null))[_0x89dd('0x27')](handleError(_0x472eb9,null));};exports['getAgents']=function(_0x199fe2,_0xc2efbc,_0x122464){var _0x42ec66={};var _0x6bc9f9={};var _0x4f23e9;var _0x29c2c4;return db[_0x89dd('0x3c')]['findOne']({'where':{'id':_0x199fe2[_0x89dd('0x5d')]['id']}})[_0x89dd('0x31')](handleEntityNotFound(_0xc2efbc,null))[_0x89dd('0x31')](function(_0x57a1fd){if(_0x57a1fd){_0x4f23e9=_0x57a1fd;_0x6bc9f9[_0x89dd('0x40')]=_[_0x89dd('0x42')](db[_0x89dd('0xaa')][_0x89dd('0x3d')]);_0x6bc9f9[_0x89dd('0x41')]=_[_0x89dd('0x42')](_0x199fe2[_0x89dd('0x41')]);_0x6bc9f9[_0x89dd('0x43')]=_['intersection'](_0x6bc9f9[_0x89dd('0x40')],_0x6bc9f9[_0x89dd('0x41')]);_0x42ec66['attributes']=_[_0x89dd('0x44')](_0x6bc9f9[_0x89dd('0x40')],qs[_0x89dd('0x46')](_0x199fe2[_0x89dd('0x41')]['fields']));_0x42ec66['attributes']=_0x42ec66[_0x89dd('0x45')][_0x89dd('0x47')]?_0x42ec66[_0x89dd('0x45')]:_0x6bc9f9[_0x89dd('0x40')];_0x42ec66[_0x89dd('0x64')]=qs['sort'](_0x199fe2[_0x89dd('0x41')][_0x89dd('0x48')]);_0x42ec66[_0x89dd('0x49')]=qs[_0x89dd('0x43')](_[_0x89dd('0x4a')](_0x199fe2[_0x89dd('0x41')],_0x6bc9f9[_0x89dd('0x43')]));if(_0x199fe2['query'][_0x89dd('0x4b')]){_0x42ec66['where']=_[_0x89dd('0x4c')](_0x42ec66[_0x89dd('0x49')],{'$or':_['map'](_0x42ec66['attributes'],function(_0x53f081){var _0x13ae88={};_0x13ae88[_0x53f081]={'$like':'%'+_0x199fe2[_0x89dd('0x41')]['filter']+'%'};return _0x13ae88;})});}_0x42ec66=_['merge']({},_0x42ec66,_0x199fe2[_0x89dd('0x4d')]);return _0x4f23e9[_0x89dd('0xe0')](_0x42ec66);}})[_0x89dd('0x31')](function(_0x24fa81){if(_0x24fa81){_0x29c2c4=_0x24fa81[_0x89dd('0x47')];if(!_0x199fe2[_0x89dd('0x41')][_0x89dd('0x62')](_0x89dd('0x63'))){_0x42ec66[_0x89dd('0x2d')]=qs[_0x89dd('0x2d')](_0x199fe2[_0x89dd('0x41')][_0x89dd('0x2d')]);_0x42ec66[_0x89dd('0x2a')]=qs[_0x89dd('0x2a')](_0x199fe2[_0x89dd('0x41')][_0x89dd('0x2a')]);}return _0x4f23e9['getAgents'](_0x42ec66);}})[_0x89dd('0x31')](function(_0x2f1e25){if(_0x2f1e25){return _0x2f1e25?{'count':_0x29c2c4,'rows':_0x2f1e25}:null;}})[_0x89dd('0x31')](respondWithResult(_0xc2efbc,null))[_0x89dd('0x27')](handleError(_0xc2efbc,null));}; \ No newline at end of file +var _0x8c74=['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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','SmsAccounts','UserProfileResource','sendStatus','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','SmsAccountId','getDispositions','findOne','Disposition','nolimit','pick','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','mobile','twilio','from','From','messageId','MessageSid','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','originatingAddress','segmentedMessage','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','contact','SmsInteraction','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','unshift','waitForTheAssignedAgent','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','send','\x0a','transaction','SmsApplication','getApplications','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','to\x20is\x20mandatory','List','DESC','ListId','out','Messages','spread','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','infobip','results','groupName','DELIVERED','clickatell','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','csc','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x8c74,0x1be));var _0x48c7=function(_0x356307,_0xe0a012){_0x356307=_0x356307-0x0;var _0x59e722=_0x8c74[_0x356307];return _0x59e722;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48c7('0x0'));var zipdir=require(_0x48c7('0x1'));var jsonpatch=require(_0x48c7('0x2'));var rp=require(_0x48c7('0x3'));var moment=require(_0x48c7('0x4'));var BPromise=require(_0x48c7('0x5'));var Mustache=require(_0x48c7('0x6'));var util=require(_0x48c7('0x7'));var path=require('path');var sox=require(_0x48c7('0x8'));var csv=require(_0x48c7('0x9'));var ejs=require(_0x48c7('0xa'));var fs=require('fs');var fs_extra=require(_0x48c7('0xb'));var _=require(_0x48c7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x48c7('0xd'));var deskjs=require(_0x48c7('0xe'));var toCsv=require(_0x48c7('0x9'));var querystring=require(_0x48c7('0xf'));var Papa=require(_0x48c7('0x10'));var Redis=require(_0x48c7('0x11'));var authService=require(_0x48c7('0x12'));var qs=require(_0x48c7('0x13'));var as=require(_0x48c7('0x14'));var hardwareService=require(_0x48c7('0x15'));var logger=require('../../config/logger')(_0x48c7('0x16'));var utils=require(_0x48c7('0x17'));var config=require(_0x48c7('0x18'));var licenseUtil=require(_0x48c7('0x19'));var db=require(_0x48c7('0x1a'))['db'];config[_0x48c7('0x1b')]=_[_0x48c7('0x1c')](config[_0x48c7('0x1b')],{'host':_0x48c7('0x1d'),'port':0x18eb});var socket=require(_0x48c7('0x1e'))(new Redis(config[_0x48c7('0x1b')]));require(_0x48c7('0x1f'))[_0x48c7('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x48c7('0x21')][_0x48c7('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x14d0e4,_0x3476c6,_0x105c62,_0x577427){return new BPromise(function(_0x1947dd,_0x57005c){var _0x180c14=_0x577427||client;return _0x180c14[_0x48c7('0x23')](_0x14d0e4,_0x105c62)[_0x48c7('0x24')](function(_0x4a66da){logger[_0x48c7('0x25')](_0x48c7('0x26'),_0x3476c6,_0x48c7('0x27'));logger[_0x48c7('0x28')](_0x48c7('0x29'),_0x3476c6,_0x48c7('0x27'),JSON[_0x48c7('0x2a')](_0x4a66da));if(_0x4a66da['error']){if(_0x4a66da[_0x48c7('0x2b')][_0x48c7('0x2c')]===0x1f4){logger['error'](_0x48c7('0x26'),_0x3476c6,_0x4a66da['error']['message']);return _0x57005c(_0x4a66da[_0x48c7('0x2b')][_0x48c7('0x2d')]);}logger['error'](_0x48c7('0x26'),_0x3476c6,_0x4a66da['error'][_0x48c7('0x2d')]);return _0x1947dd(_0x4a66da[_0x48c7('0x2b')]['message']);}else{logger[_0x48c7('0x25')]('SmsAccount,\x20%s,\x20%s',_0x3476c6,_0x48c7('0x27'));_0x1947dd(_0x4a66da[_0x48c7('0x2e')][_0x48c7('0x2d')]);}})['catch'](function(_0x3c61c3){logger[_0x48c7('0x2b')]('SmsAccount,\x20%s,\x20%s',_0x3476c6,_0x3c61c3);_0x57005c(_0x3c61c3);});});}function respondWithStatusCode(_0x32c5d7,_0x477000){_0x477000=_0x477000||0xcc;return function(_0x59364f){if(_0x59364f){return _0x32c5d7['sendStatus'](_0x477000);}return _0x32c5d7[_0x48c7('0x2f')](_0x477000)[_0x48c7('0x30')]();};}function respondWithResult(_0x1bd711,_0x1d7a7e){_0x1d7a7e=_0x1d7a7e||0xc8;return function(_0x27d09d){if(_0x27d09d){return _0x1bd711[_0x48c7('0x2f')](_0x1d7a7e)[_0x48c7('0x31')](_0x27d09d);}};}function respondWithFilteredResult(_0x247fbd,_0x457e7f){return function(_0x59f4de){if(_0x59f4de){var _0x4c67df=typeof _0x457e7f[_0x48c7('0x32')]===_0x48c7('0x33')&&typeof _0x457e7f[_0x48c7('0x34')]===_0x48c7('0x33');var _0x2f6d3b=_0x59f4de['count'];var _0x73a7a9=_0x4c67df?0x0:_0x457e7f[_0x48c7('0x32')];var _0x222772=_0x4c67df?_0x59f4de[_0x48c7('0x35')]:_0x457e7f[_0x48c7('0x32')]+_0x457e7f[_0x48c7('0x34')];var _0x2b3ceb;if(_0x222772>=_0x2f6d3b){_0x222772=_0x2f6d3b;_0x2b3ceb=0xc8;}else{_0x2b3ceb=0xce;}_0x247fbd[_0x48c7('0x2f')](_0x2b3ceb);return _0x247fbd['set'](_0x48c7('0x36'),_0x73a7a9+'-'+_0x222772+'/'+_0x2f6d3b)[_0x48c7('0x31')](_0x59f4de);}return null;};}function patchUpdates(_0x30cb3d){return function(_0x6eea70){try{jsonpatch[_0x48c7('0x37')](_0x6eea70,_0x30cb3d,!![]);}catch(_0x2fac36){return BPromise[_0x48c7('0x38')](_0x2fac36);}return _0x6eea70[_0x48c7('0x39')]();};}function saveUpdates(_0x475de1,_0x52fe60){return function(_0x154a7c){if(_0x154a7c){return _0x154a7c[_0x48c7('0x3a')](_0x475de1)['then'](function(_0x37871a){return _0x37871a;});}return null;};}function removeEntity(_0x59337a,_0x5e4928){return function(_0x548ae0){if(_0x548ae0){return _0x548ae0['destroy']()[_0x48c7('0x24')](function(){var _0x5ce3f9=_0x548ae0['get']({'plain':!![]});var _0x26462f=_0x48c7('0x3b');return db[_0x48c7('0x3c')]['destroy']({'where':{'type':_0x26462f,'resourceId':_0x5ce3f9['id']}})[_0x48c7('0x24')](function(){return _0x548ae0;});})[_0x48c7('0x24')](function(){_0x59337a['status'](0xcc)[_0x48c7('0x30')]();});}};}function handleEntityNotFound(_0xe45160,_0x12564c){return function(_0x4f9517){if(!_0x4f9517){_0xe45160[_0x48c7('0x3d')](0x194);}return _0x4f9517;};}function handleError(_0x315466,_0x434239){_0x434239=_0x434239||0x1f4;return function(_0x33a5d9){logger[_0x48c7('0x2b')](_0x33a5d9[_0x48c7('0x3e')]);if(_0x33a5d9['name']){delete _0x33a5d9[_0x48c7('0x3f')];}_0x315466[_0x48c7('0x2f')](_0x434239)['send'](_0x33a5d9);};}exports['index']=function(_0x52e3c0,_0xed5b0d){var _0x1a0ee2={'include':[{'model':db[_0x48c7('0x40')],'as':_0x48c7('0x41')}]},_0x4423d8={},_0x1a3c16={'count':0x0,'rows':[]};var _0x33e438=_[_0x48c7('0x42')](db[_0x48c7('0x43')]['rawAttributes'],function(_0x33f207){return{'name':_0x33f207[_0x48c7('0x44')],'type':_0x33f207[_0x48c7('0x45')]['key']};});_0x4423d8[_0x48c7('0x46')]=_['map'](_0x33e438,'name');_0x4423d8['query']=_['keys'](_0x52e3c0[_0x48c7('0x47')]);_0x4423d8['filters']=_[_0x48c7('0x48')](_0x4423d8[_0x48c7('0x46')],_0x4423d8[_0x48c7('0x47')]);_0x1a0ee2[_0x48c7('0x49')]=_[_0x48c7('0x48')](_0x4423d8[_0x48c7('0x46')],qs[_0x48c7('0x4a')](_0x52e3c0[_0x48c7('0x47')][_0x48c7('0x4a')]));_0x1a0ee2[_0x48c7('0x49')]=_0x1a0ee2[_0x48c7('0x49')][_0x48c7('0x4b')]?_0x1a0ee2[_0x48c7('0x49')]:_0x4423d8[_0x48c7('0x46')];if(!_0x52e3c0[_0x48c7('0x47')][_0x48c7('0x4c')]('nolimit')){_0x1a0ee2[_0x48c7('0x34')]=qs[_0x48c7('0x34')](_0x52e3c0[_0x48c7('0x47')][_0x48c7('0x34')]);_0x1a0ee2[_0x48c7('0x32')]=qs[_0x48c7('0x32')](_0x52e3c0[_0x48c7('0x47')]['offset']);}_0x1a0ee2[_0x48c7('0x4d')]=qs['sort'](_0x52e3c0['query'][_0x48c7('0x4e')]);_0x1a0ee2[_0x48c7('0x4f')]=qs[_0x48c7('0x50')](_['pick'](_0x52e3c0['query'],_0x4423d8['filters']),_0x33e438);if(_0x52e3c0[_0x48c7('0x47')]['filter']){_0x1a0ee2[_0x48c7('0x4f')]=_['merge'](_0x1a0ee2[_0x48c7('0x4f')],{'$or':_[_0x48c7('0x42')](_0x33e438,function(_0x5d66e2){if(_0x5d66e2['type']!==_0x48c7('0x51')){var _0x16f447={};_0x16f447[_0x5d66e2[_0x48c7('0x3f')]]={'$like':'%'+_0x52e3c0[_0x48c7('0x47')][_0x48c7('0x52')]+'%'};return _0x16f447;}})});}_0x1a0ee2=_[_0x48c7('0x53')]({},_0x1a0ee2,_0x52e3c0[_0x48c7('0x54')]);var _0x3670a5={'where':_0x1a0ee2[_0x48c7('0x4f')]};return db[_0x48c7('0x43')][_0x48c7('0x35')](_0x3670a5)[_0x48c7('0x24')](function(_0x470e85){_0x1a3c16['count']=_0x470e85;if(_0x52e3c0[_0x48c7('0x47')][_0x48c7('0x55')]){_0x1a0ee2[_0x48c7('0x56')]=[{'all':!![]}];}return db[_0x48c7('0x43')]['findAll'](_0x1a0ee2);})[_0x48c7('0x24')](function(_0x103a3a){_0x1a3c16[_0x48c7('0x57')]=_0x103a3a;return _0x1a3c16;})[_0x48c7('0x24')](respondWithFilteredResult(_0xed5b0d,_0x1a0ee2))[_0x48c7('0x58')](handleError(_0xed5b0d,null));};exports[_0x48c7('0x59')]=function(_0x57bab1,_0x51010b){var _0x3b00fc={'raw':![],'where':{'id':_0x57bab1[_0x48c7('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x48c7('0x41')}]},_0x12f8db={};_0x12f8db[_0x48c7('0x46')]=_[_0x48c7('0x5b')](db['SmsAccount'][_0x48c7('0x5c')]);_0x12f8db['query']=_[_0x48c7('0x5b')](_0x57bab1['query']);_0x12f8db['filters']=_[_0x48c7('0x48')](_0x12f8db[_0x48c7('0x46')],_0x12f8db[_0x48c7('0x47')]);_0x3b00fc[_0x48c7('0x49')]=_[_0x48c7('0x48')](_0x12f8db[_0x48c7('0x46')],qs[_0x48c7('0x4a')](_0x57bab1[_0x48c7('0x47')][_0x48c7('0x4a')]));_0x3b00fc['attributes']=_0x3b00fc[_0x48c7('0x49')][_0x48c7('0x4b')]?_0x3b00fc['attributes']:_0x12f8db['model'];if(_0x57bab1[_0x48c7('0x47')][_0x48c7('0x55')]){_0x3b00fc[_0x48c7('0x56')]=[{'all':!![]}];}_0x3b00fc=_['merge']({},_0x3b00fc,_0x57bab1[_0x48c7('0x54')]);return db[_0x48c7('0x43')][_0x48c7('0x5d')](_0x3b00fc)[_0x48c7('0x24')](handleEntityNotFound(_0x51010b,null))[_0x48c7('0x24')](respondWithResult(_0x51010b,null))[_0x48c7('0x58')](handleError(_0x51010b,null));};exports[_0x48c7('0x5e')]=function(_0x5c4699,_0x233ee2){return db[_0x48c7('0x43')][_0x48c7('0x5e')](_0x5c4699['body'],{})[_0x48c7('0x24')](function(_0x415364){var _0xa9e7b=_0x5c4699['user'][_0x48c7('0x5f')]({'plain':!![]});if(!_0xa9e7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa9e7b[_0x48c7('0x60')]===_0x48c7('0x61')){var _0x33aba5=_0x415364[_0x48c7('0x5f')]({'plain':!![]});var _0x5c990a='SmsAccounts';return db[_0x48c7('0x62')][_0x48c7('0x5d')]({'where':{'name':_0x5c990a,'userProfileId':_0xa9e7b[_0x48c7('0x63')]},'raw':!![]})['then'](function(_0x223cf0){if(_0x223cf0&&_0x223cf0[_0x48c7('0x64')]===0x0){return db['UserProfileResource'][_0x48c7('0x5e')]({'name':_0x33aba5[_0x48c7('0x3f')],'resourceId':_0x33aba5['id'],'type':_0x223cf0[_0x48c7('0x3f')],'sectionId':_0x223cf0['id']},{})['then'](function(){return _0x415364;});}else{return _0x415364;}})[_0x48c7('0x58')](function(_0x331277){logger[_0x48c7('0x2b')](_0x48c7('0x65'),_0x331277);throw _0x331277;});}return _0x415364;})['then'](respondWithResult(_0x233ee2,0xc9))['catch'](handleError(_0x233ee2,null));};exports[_0x48c7('0x3a')]=function(_0x507281,_0x2a9c24){if(_0x507281['body']['id']){delete _0x507281[_0x48c7('0x66')]['id'];}return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x507281[_0x48c7('0x5a')]['id']},'include':[{'model':db[_0x48c7('0x40')],'as':_0x48c7('0x41')}]})[_0x48c7('0x24')](handleEntityNotFound(_0x2a9c24,null))['then'](saveUpdates(_0x507281[_0x48c7('0x66')],null))[_0x48c7('0x24')](respondWithResult(_0x2a9c24,null))[_0x48c7('0x58')](handleError(_0x2a9c24,null));};exports[_0x48c7('0x67')]=function(_0x3af9d8,_0x59cb19){return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x3af9d8[_0x48c7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x59cb19,null))[_0x48c7('0x24')](removeEntity(_0x59cb19,null))['catch'](handleError(_0x59cb19,null));};exports[_0x48c7('0x68')]=function(_0x191afa,_0x200d27){return db['SmsAccount']['describe']()[_0x48c7('0x24')](respondWithResult(_0x200d27,null))[_0x48c7('0x58')](handleError(_0x200d27,null));};exports['addDisposition']=function(_0xb7aa60,_0x337526,_0x2c4eb0){if(_0xb7aa60['body']['id']){delete _0xb7aa60[_0x48c7('0x66')]['id'];}return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0xb7aa60[_0x48c7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x337526,null))[_0x48c7('0x24')](function(_0x313930){if(_0x313930){_0xb7aa60[_0x48c7('0x66')][_0x48c7('0x69')]=_0x313930['id'];return db['Disposition'][_0x48c7('0x5e')](_0xb7aa60[_0x48c7('0x66')]);}})[_0x48c7('0x24')](respondWithResult(_0x337526,null))['catch'](handleError(_0x337526,null));};exports[_0x48c7('0x6a')]=function(_0x37546b,_0x32cfc1,_0x297419){var _0x343825={'raw':![],'where':{}};var _0x212c92={};var _0x1a97f7={'count':0x0,'rows':[]};return db[_0x48c7('0x43')][_0x48c7('0x6b')]({'where':{'id':_0x37546b[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x32cfc1,null))[_0x48c7('0x24')](function(_0x6eb8ed){if(_0x6eb8ed){_0x212c92[_0x48c7('0x46')]=_[_0x48c7('0x5b')](db[_0x48c7('0x6c')][_0x48c7('0x5c')]);_0x212c92[_0x48c7('0x47')]=_[_0x48c7('0x5b')](_0x37546b[_0x48c7('0x47')]);_0x212c92['filters']=_['intersection'](_0x212c92['model'],_0x212c92[_0x48c7('0x47')]);_0x343825[_0x48c7('0x49')]=_['intersection'](_0x212c92[_0x48c7('0x46')],qs['fields'](_0x37546b[_0x48c7('0x47')][_0x48c7('0x4a')]));_0x343825[_0x48c7('0x49')]=_0x343825[_0x48c7('0x49')][_0x48c7('0x4b')]?_0x343825[_0x48c7('0x49')]:_0x212c92['model'];if(!_0x37546b[_0x48c7('0x47')]['hasOwnProperty'](_0x48c7('0x6d'))){_0x343825[_0x48c7('0x34')]=qs[_0x48c7('0x34')](_0x37546b[_0x48c7('0x47')][_0x48c7('0x34')]);_0x343825[_0x48c7('0x32')]=qs['offset'](_0x37546b[_0x48c7('0x47')][_0x48c7('0x32')]);}_0x343825[_0x48c7('0x4d')]=qs['sort'](_0x37546b['query'][_0x48c7('0x4e')]);_0x343825[_0x48c7('0x4f')]=qs[_0x48c7('0x50')](_[_0x48c7('0x6e')](_0x37546b[_0x48c7('0x47')],_0x212c92[_0x48c7('0x50')]));_0x343825[_0x48c7('0x4f')][_0x48c7('0x69')]=_0x6eb8ed['id'];if(_0x37546b[_0x48c7('0x47')][_0x48c7('0x52')]){_0x343825[_0x48c7('0x4f')]=_[_0x48c7('0x53')](_0x343825[_0x48c7('0x4f')],{'$or':_['map'](_0x343825[_0x48c7('0x49')],function(_0x4d97dd){var _0x599376={};_0x599376[_0x4d97dd]={'$like':'%'+_0x37546b['query']['filter']+'%'};return _0x599376;})});}_0x343825=_[_0x48c7('0x53')]({},_0x343825,_0x37546b[_0x48c7('0x54')]);return db[_0x48c7('0x6c')]['count']({'where':_0x343825[_0x48c7('0x4f')]})[_0x48c7('0x24')](function(_0x4a34d9){_0x1a97f7[_0x48c7('0x35')]=_0x4a34d9;if(_0x37546b[_0x48c7('0x47')][_0x48c7('0x55')]){_0x343825[_0x48c7('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x48c7('0x6f')](_0x343825);})[_0x48c7('0x24')](function(_0x90484c){_0x1a97f7[_0x48c7('0x57')]=_0x90484c;return _0x1a97f7;});}})[_0x48c7('0x24')](respondWithFilteredResult(_0x32cfc1,_0x343825))[_0x48c7('0x58')](handleError(_0x32cfc1,null));};exports[_0x48c7('0x70')]=function(_0x569f12,_0x3c405a,_0x1b24e0){return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x569f12['params']['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x3c405a,null))[_0x48c7('0x24')](function(_0x1f778a){if(_0x1f778a){return _0x1f778a[_0x48c7('0x70')](_0x569f12[_0x48c7('0x47')]['ids']);}})[_0x48c7('0x24')](respondWithStatusCode(_0x3c405a,null))['catch'](handleError(_0x3c405a,null));};exports[_0x48c7('0x71')]=function(_0x26a2cb,_0x2241fa,_0x27cf8a){if(_0x26a2cb[_0x48c7('0x66')]['id']){delete _0x26a2cb[_0x48c7('0x66')]['id'];}return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x26a2cb[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x2241fa,null))['then'](function(_0x4e13a7){if(_0x4e13a7){_0x26a2cb['body'][_0x48c7('0x69')]=_0x4e13a7['id'];return db[_0x48c7('0x72')][_0x48c7('0x5e')](_0x26a2cb[_0x48c7('0x66')]);}})['then'](respondWithResult(_0x2241fa,null))[_0x48c7('0x58')](handleError(_0x2241fa,null));};exports[_0x48c7('0x73')]=function(_0x4dad6d,_0x40dc51,_0x420275){var _0x4c846c={'raw':![],'where':{}};var _0x4fdc3d={};var _0x5b38bc={'count':0x0,'rows':[]};return db[_0x48c7('0x43')][_0x48c7('0x6b')]({'where':{'id':_0x4dad6d[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x40dc51,null))[_0x48c7('0x24')](function(_0x32c28d){if(_0x32c28d){_0x4fdc3d['model']=_['keys'](db[_0x48c7('0x72')][_0x48c7('0x5c')]);_0x4fdc3d[_0x48c7('0x47')]=_[_0x48c7('0x5b')](_0x4dad6d[_0x48c7('0x47')]);_0x4fdc3d[_0x48c7('0x50')]=_['intersection'](_0x4fdc3d[_0x48c7('0x46')],_0x4fdc3d['query']);_0x4c846c[_0x48c7('0x49')]=_['intersection'](_0x4fdc3d['model'],qs[_0x48c7('0x4a')](_0x4dad6d[_0x48c7('0x47')][_0x48c7('0x4a')]));_0x4c846c[_0x48c7('0x49')]=_0x4c846c[_0x48c7('0x49')][_0x48c7('0x4b')]?_0x4c846c['attributes']:_0x4fdc3d[_0x48c7('0x46')];if(!_0x4dad6d['query'][_0x48c7('0x4c')]('nolimit')){_0x4c846c['limit']=qs[_0x48c7('0x34')](_0x4dad6d['query'][_0x48c7('0x34')]);_0x4c846c[_0x48c7('0x32')]=qs[_0x48c7('0x32')](_0x4dad6d[_0x48c7('0x47')][_0x48c7('0x32')]);}_0x4c846c[_0x48c7('0x4d')]=qs[_0x48c7('0x4e')](_0x4dad6d[_0x48c7('0x47')]['sort']);_0x4c846c['where']=qs['filters'](_[_0x48c7('0x6e')](_0x4dad6d[_0x48c7('0x47')],_0x4fdc3d[_0x48c7('0x50')]));_0x4c846c[_0x48c7('0x4f')][_0x48c7('0x69')]=_0x32c28d['id'];if(_0x4dad6d[_0x48c7('0x47')][_0x48c7('0x52')]){_0x4c846c[_0x48c7('0x4f')]=_[_0x48c7('0x53')](_0x4c846c['where'],{'$or':_[_0x48c7('0x42')](_0x4c846c['attributes'],function(_0xdd7907){var _0x377ea9={};_0x377ea9[_0xdd7907]={'$like':'%'+_0x4dad6d[_0x48c7('0x47')][_0x48c7('0x52')]+'%'};return _0x377ea9;})});}_0x4c846c=_['merge']({},_0x4c846c,_0x4dad6d[_0x48c7('0x54')]);return db[_0x48c7('0x72')][_0x48c7('0x35')]({'where':_0x4c846c[_0x48c7('0x4f')]})['then'](function(_0x5843dd){_0x5b38bc[_0x48c7('0x35')]=_0x5843dd;if(_0x4dad6d['query'][_0x48c7('0x55')]){_0x4c846c[_0x48c7('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x48c7('0x6f')](_0x4c846c);})[_0x48c7('0x24')](function(_0x31d573){_0x5b38bc[_0x48c7('0x57')]=_0x31d573;return _0x5b38bc;});}})['then'](respondWithFilteredResult(_0x40dc51,_0x4c846c))['catch'](handleError(_0x40dc51,null));};exports['removeAnswers']=function(_0x2431b1,_0x4db0bd,_0x3d4e33){return db[_0x48c7('0x43')]['find']({'where':{'id':_0x2431b1['params']['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x4db0bd,null))[_0x48c7('0x24')](function(_0x27eede){if(_0x27eede){return _0x27eede[_0x48c7('0x74')](_0x2431b1[_0x48c7('0x47')]['ids']);}})[_0x48c7('0x24')](respondWithStatusCode(_0x4db0bd,null))[_0x48c7('0x58')](handleError(_0x4db0bd,null));};exports[_0x48c7('0x75')]=function(_0x24b2a3,_0x2da8ee,_0x29d9d4){var _0x37f8a8={'channel':_0x48c7('0x76')};var _0x104a32=[];var _0x4ca1c7=[];var _0x71d721={};return db[_0x48c7('0x43')]['find']({'where':{'id':_0x24b2a3['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x48c7('0x77')}]})[_0x48c7('0x24')](handleEntityNotFound(_0x2da8ee,null))[_0x48c7('0x24')](function(_0x460e70){_0x37f8a8[_0x48c7('0x78')]=_0x460e70;_0x37f8a8[_0x48c7('0x79')]=_[_0x48c7('0x7a')](_0x460e70[_0x48c7('0x77')],[_0x48c7('0x7b')],[_0x48c7('0x7c')]);if(_0x37f8a8[_0x48c7('0x78')][_0x48c7('0x77')]){delete _0x37f8a8[_0x48c7('0x78')][_0x48c7('0x77')];}return db[_0x48c7('0x7d')][_0x48c7('0x68')]();})[_0x48c7('0x24')](function(_0x213fed){if(!_0x213fed){throw new db[(_0x48c7('0x7e'))][(_0x48c7('0x7f'))](_0x48c7('0x80'));}_0x104a32=_['difference'](_[_0x48c7('0x5b')](_0x213fed),[_0x48c7('0x81'),_0x48c7('0x82')]);_0x4ca1c7=_[_0x48c7('0x83')](_[_0x48c7('0x5b')](_0x213fed),[_0x48c7('0x81'),_0x48c7('0x82'),'CompanyId','ListId']);_0x37f8a8[_0x48c7('0x66')]={'mapKey':_0x48c7('0x84')};if(_0x37f8a8[_0x48c7('0x78')][_0x48c7('0x45')]){switch(_0x37f8a8['account'][_0x48c7('0x45')]){case _0x48c7('0x85'):_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')]=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x87')];_0x37f8a8['body'][_0x48c7('0x66')]=_0x24b2a3[_0x48c7('0x66')]['Body'];_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x88')]=_0x24b2a3['body'][_0x48c7('0x89')];break;case'skebby':_0x37f8a8[_0x48c7('0x66')]['from']='+'+_0x24b2a3['body'][_0x48c7('0x8a')];_0x37f8a8[_0x48c7('0x66')]['body']=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x8b')];break;case _0x48c7('0x8c'):_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')]=_0x24b2a3[_0x48c7('0x66')]['from'];_0x37f8a8[_0x48c7('0x66')]['body']=_0x24b2a3[_0x48c7('0x66')]['message'];break;case _0x48c7('0x8d'):_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')]=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x86')];_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x66')]=_0x24b2a3[_0x48c7('0x66')]['body'];_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x88')]=_0x24b2a3['body'][_0x48c7('0x8e')];break;case _0x48c7('0x8f'):_0x37f8a8[_0x48c7('0x66')]['from']=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x87')];_0x37f8a8['body'][_0x48c7('0x66')]=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x90')];_0x37f8a8['body'][_0x48c7('0x88')]=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x91')];break;case'infobip':_0x37f8a8[_0x48c7('0x66')]['from']='+'+_0x24b2a3[_0x48c7('0x66')]['results'][0x0][_0x48c7('0x86')];_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x66')]=_0x24b2a3[_0x48c7('0x66')]['results'][0x0][_0x48c7('0x8b')];_0x37f8a8['body']['messageId']=_0x24b2a3[_0x48c7('0x66')]['results'][0x0]['messageId'];break;case'csc':_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')]=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x92')];_0x37f8a8[_0x48c7('0x66')]['body']=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x93')][_0x48c7('0x2d')];break;case'clickatell':_0x37f8a8[_0x48c7('0x66')]['from']=_0x24b2a3[_0x48c7('0x66')]['fromNumber'];_0x37f8a8['body'][_0x48c7('0x66')]=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x8b')];_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x88')]=_0x24b2a3[_0x48c7('0x66')]['replyMessageId'];break;case _0x48c7('0x94'):_0x37f8a8[_0x48c7('0x66')]['messageId']=_0x24b2a3[_0x48c7('0x66')][0x0][_0x48c7('0x2d')]['id'];_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')]=_0x24b2a3[_0x48c7('0x66')][0x0][_0x48c7('0x2d')][_0x48c7('0x86')];_0x37f8a8[_0x48c7('0x66')]['body']=_0x24b2a3['body'][0x0][_0x48c7('0x2d')][_0x48c7('0x8b')];break;case _0x48c7('0x95'):_0x37f8a8['body']['from']=_0x24b2a3['body'][_0x48c7('0x86')];_0x37f8a8['body']['body']=_0x24b2a3[_0x48c7('0x66')][_0x48c7('0x2d')];_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x88')]=_0x24b2a3['body'][_0x48c7('0x96')];break;}}if(_0x37f8a8['body']['id']){delete _0x37f8a8[_0x48c7('0x66')]['id'];}if(_[_0x48c7('0x97')](_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')])){throw new db[(_0x48c7('0x7e'))][(_0x48c7('0x7f'))](_0x48c7('0x98'));}if(_[_0x48c7('0x97')](_0x37f8a8[_0x48c7('0x66')]['body'])||_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x66')]===''){throw new db[(_0x48c7('0x7e'))][(_0x48c7('0x7f'))](_0x48c7('0x99'));}if(_['isNil'](_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x9a')])){throw new db[(_0x48c7('0x7e'))][(_0x48c7('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ca1c7);}if(!_['includes'](_0x4ca1c7,_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x9a')])){throw new db[(_0x48c7('0x7e'))][(_0x48c7('0x7f'))](_0x48c7('0x9b')+_0x4ca1c7);}_0x71d721[_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x9a')]]=_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')];return db[_0x48c7('0x9c')][_0x48c7('0x5d')]({'where':{'id':_0x37f8a8[_0x48c7('0x78')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x48c7('0x9d'),'where':_0x71d721,'limit':0x1,'order':[[_0x48c7('0x82'),'DESC']]}]});})[_0x48c7('0x24')](handleEntityNotFound(_0x2da8ee,null))['then'](function(_0x867b4d){if(_0x867b4d){_0x37f8a8['list']=_[_0x48c7('0x9e')](_0x867b4d,[_0x48c7('0x9d')]);if(_0x867b4d['Contacts']['length']){return _0x867b4d['Contacts'][0x0];}var _0x2c2135=_['defaults'](_0x37f8a8[_0x48c7('0x66')],{'firstName':_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')],'ListId':_0x867b4d['id']});_0x2c2135[_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x9a')]]=_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')];return db[_0x48c7('0x7d')]['create'](_0x2c2135,{'fields':_0x104a32,'raw':!![]});}})[_0x48c7('0x24')](handleEntityNotFound(_0x2da8ee,null))['then'](function(_0x2e8960){if(_0x2e8960){_0x37f8a8[_0x48c7('0x9f')]=_0x2e8960;var _0x2bfa7a={'ContactId':_0x2e8960['id'],'phone':_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')],'SmsAccountId':_0x24b2a3[_0x48c7('0x5a')]['id']};var _0x429ef5={'ContactId':_0x2e8960['id'],'SmsAccountId':_0x24b2a3[_0x48c7('0x5a')]['id'],'closed':![]};return db[_0x48c7('0xa0')]['find']({'where':_0x429ef5})[_0x48c7('0x24')](function(_0x56db93){if(_0x56db93){return[_0x56db93,![]];}return db[_0x48c7('0xa0')][_0x48c7('0x5e')](_0x2bfa7a)[_0x48c7('0x24')](function(_0x1fe0d4){return[_0x1fe0d4,!![]];});});}})['spread'](function(_0x4391ea,_0x5d2db1){_0x37f8a8[_0x48c7('0xa1')]=_0x4391ea[_0x48c7('0x5f')]({'plain':!![]});_0x37f8a8['interaction'][_0x48c7('0xa2')]=![];if(_0x5d2db1){if(_0x37f8a8['account'][_0x48c7('0xa3')]){_0x37f8a8[_0x48c7('0x79')][_0x48c7('0xa4')]({'id':0x0,'priority':_0x37f8a8[_0x48c7('0x79')][_0x48c7('0x4b')]+0x1,'app':_0x48c7('0xa5'),'appdata':'unmanaged','interval':_0x48c7('0xa6')});}_0x37f8a8[_0x48c7('0xa1')][_0x48c7('0xa2')]=!![];}return db[_0x48c7('0xa7')][_0x48c7('0x5e')]({'phone':_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x86')],'messageId':_0x37f8a8[_0x48c7('0x66')][_0x48c7('0x88')],'body':_0x37f8a8[_0x48c7('0x66')]['body'],'SmsAccountId':_0x24b2a3['params']['id'],'SmsInteractionId':_0x4391ea['id'],'direction':'in','ContactId':_0x4391ea[_0x48c7('0xa8')],'AttachmentId':_0x37f8a8[_0x48c7('0x66')]['AttachmentId']});})[_0x48c7('0x24')](function(_0x3269dc){_0x37f8a8[_0x48c7('0x2d')]=_0x3269dc;if(_0x37f8a8[_0x48c7('0xa1')]['UserId']){return db['User'][_0x48c7('0x5d')]({'attributes':['id',_0x48c7('0x3f')],'where':{'id':_0x37f8a8['interaction']['UserId']}})[_0x48c7('0x24')](function(_0x474352){if(_0x474352){_0x37f8a8[_0x48c7('0x79')][_0x48c7('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x474352[_0x48c7('0x3f')]+','+(_0x37f8a8['account'][_0x48c7('0xaa')]||0xa),'interval':_0x48c7('0xa6')});}return respondWithRpcPromise('Start',_0x48c7('0xab'),_0x37f8a8);});}return respondWithRpcPromise('Start',_0x48c7('0xab'),_0x37f8a8);})[_0x48c7('0x24')](function(_0x55fc32){if(_0x55fc32){var _0x2c1623=0xc8;var _0x5177ce=_0x48c7('0xac');logger[_0x48c7('0x25')](_0x48c7('0x29'),_0x5177ce,_0x2c1623,'entity\x20found');logger[_0x48c7('0x28')](_0x48c7('0xad'),_0x5177ce,_0x2c1623,_0x48c7('0xae'),JSON[_0x48c7('0x2a')](_0x55fc32));if(_0x37f8a8['account'][_0x48c7('0x45')]===_0x48c7('0x85')){return _0x2da8ee['status'](_0x2c1623)[_0x48c7('0xaf')]('Content-Type','text/xml')[_0x48c7('0xb0')](_0x48c7('0xb1'));}else{return _0x2da8ee[_0x48c7('0x2f')](_0x2c1623)[_0x48c7('0x31')](_0x55fc32);}}})[_0x48c7('0x58')](handleError(_0x2da8ee,null));};exports['addApplications']=function(_0x2b9c90,_0x3e91a2,_0x906c87){return db[_0x48c7('0x43')]['findOne']({'where':{'id':_0x2b9c90[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x3e91a2,null))[_0x48c7('0x24')](function(_0x828c78){if(_0x828c78){return db['sequelize'][_0x48c7('0xb2')](function(_0x635abf){return db[_0x48c7('0xb3')][_0x48c7('0x67')]({'where':{'SmsAccountId':_0x2b9c90[_0x48c7('0x5a')]['id']},'transaction':_0x635abf})[_0x48c7('0x24')](function(_0x4106ee){var _0x27241c=_['map'](_0x2b9c90[_0x48c7('0x66')],function(_0x1d111e){_0x1d111e['SmsAccountId']=_0x2b9c90['params']['id'];return _0x1d111e;});return db[_0x48c7('0xb3')]['bulkCreate'](_0x27241c,{'transaction':_0x635abf});});})['then'](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x2b9c90[_0x48c7('0x5a')]['id']},'order':_0x48c7('0x7b')});});}})[_0x48c7('0x24')](respondWithResult(_0x3e91a2,null))[_0x48c7('0x58')](handleError(_0x3e91a2,null));};exports[_0x48c7('0xb4')]=function(_0x5d41cd,_0x41a9d6,_0x188ecc){var _0x2e3896={};var _0x357685={};var _0x18194c;var _0x101032;return db[_0x48c7('0x43')][_0x48c7('0x6b')]({'where':{'id':_0x5d41cd['params']['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x41a9d6,null))[_0x48c7('0x24')](function(_0x191ea2){if(_0x191ea2){_0x18194c=_0x191ea2;_0x357685['model']=_[_0x48c7('0x5b')](db[_0x48c7('0xb3')][_0x48c7('0x5c')]);_0x357685[_0x48c7('0x47')]=_[_0x48c7('0x5b')](_0x5d41cd[_0x48c7('0x47')]);_0x357685[_0x48c7('0x50')]=_[_0x48c7('0x48')](_0x357685[_0x48c7('0x46')],_0x357685['query']);_0x2e3896[_0x48c7('0x49')]=_[_0x48c7('0x48')](_0x357685[_0x48c7('0x46')],qs[_0x48c7('0x4a')](_0x5d41cd[_0x48c7('0x47')]['fields']));_0x2e3896['attributes']=_0x2e3896[_0x48c7('0x49')][_0x48c7('0x4b')]?_0x2e3896['attributes']:_0x357685[_0x48c7('0x46')];_0x2e3896[_0x48c7('0x4d')]=qs[_0x48c7('0x4e')](_0x5d41cd[_0x48c7('0x47')]['sort']);_0x2e3896[_0x48c7('0x4f')]=qs[_0x48c7('0x50')](_['pick'](_0x5d41cd[_0x48c7('0x47')],_0x357685['filters']));if(_0x5d41cd[_0x48c7('0x47')]['filter']){_0x2e3896['where']=_[_0x48c7('0x53')](_0x2e3896[_0x48c7('0x4f')],{'$or':_[_0x48c7('0x42')](_0x2e3896[_0x48c7('0x49')],function(_0x10a298){var _0x1e835c={};_0x1e835c[_0x10a298]={'$like':'%'+_0x5d41cd[_0x48c7('0x47')][_0x48c7('0x52')]+'%'};return _0x1e835c;})});}_0x2e3896=_['merge']({},_0x2e3896,_0x5d41cd[_0x48c7('0x54')]);return _0x18194c[_0x48c7('0xb4')](_0x2e3896);}})[_0x48c7('0x24')](function(_0x4dd525){if(_0x4dd525){_0x101032=_0x4dd525[_0x48c7('0x4b')];if(!_0x5d41cd[_0x48c7('0x47')]['hasOwnProperty'](_0x48c7('0x6d'))){_0x2e3896[_0x48c7('0x34')]=qs[_0x48c7('0x34')](_0x5d41cd[_0x48c7('0x47')][_0x48c7('0x34')]);_0x2e3896['offset']=qs['offset'](_0x5d41cd['query'][_0x48c7('0x32')]);}return _0x18194c[_0x48c7('0xb4')](_0x2e3896);}})[_0x48c7('0x24')](function(_0x16a498){if(_0x16a498){return _0x16a498?{'count':_0x101032,'rows':_0x16a498}:null;}})[_0x48c7('0x24')](respondWithResult(_0x41a9d6,null))[_0x48c7('0x58')](handleError(_0x41a9d6,null));};exports[_0x48c7('0xb5')]=function(_0x546d33,_0x41ad8d,_0x11fbb7){var _0x56cc80={'raw':![],'where':{}};var _0x958b0={};var _0x926244={'count':0x0,'rows':[]};return db['SmsAccount'][_0x48c7('0x6b')]({'where':{'id':_0x546d33[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x41ad8d,null))[_0x48c7('0x24')](function(_0x54b507){if(_0x54b507){_0x958b0[_0x48c7('0x46')]=_[_0x48c7('0x5b')](db[_0x48c7('0xa0')][_0x48c7('0x5c')]);_0x958b0[_0x48c7('0x47')]=_[_0x48c7('0x5b')](_0x546d33[_0x48c7('0x47')]);_0x958b0[_0x48c7('0x50')]=_[_0x48c7('0x48')](_0x958b0['model'],_0x958b0['query']);_0x56cc80[_0x48c7('0x49')]=_[_0x48c7('0x48')](_0x958b0[_0x48c7('0x46')],qs[_0x48c7('0x4a')](_0x546d33[_0x48c7('0x47')][_0x48c7('0x4a')]));_0x56cc80['attributes']=_0x56cc80[_0x48c7('0x49')][_0x48c7('0x4b')]?_0x56cc80[_0x48c7('0x49')]:_0x958b0[_0x48c7('0x46')];if(!_0x546d33['query'][_0x48c7('0x4c')]('nolimit')){_0x56cc80[_0x48c7('0x34')]=qs[_0x48c7('0x34')](_0x546d33[_0x48c7('0x47')][_0x48c7('0x34')]);_0x56cc80[_0x48c7('0x32')]=qs[_0x48c7('0x32')](_0x546d33['query'][_0x48c7('0x32')]);}_0x56cc80['order']=qs['sort'](_0x546d33[_0x48c7('0x47')][_0x48c7('0x4e')]);_0x56cc80['where']=qs[_0x48c7('0x50')](_[_0x48c7('0x6e')](_0x546d33[_0x48c7('0x47')],_0x958b0[_0x48c7('0x50')]));_0x56cc80['where'][_0x48c7('0x69')]=_0x54b507['id'];if(_0x546d33[_0x48c7('0x47')][_0x48c7('0x52')]){_0x56cc80[_0x48c7('0x4f')]=_[_0x48c7('0x53')](_0x56cc80[_0x48c7('0x4f')],{'$or':_[_0x48c7('0x42')](_0x56cc80[_0x48c7('0x49')],function(_0x2a4318){var _0x4a2dc5={};_0x4a2dc5[_0x2a4318]={'$like':'%'+_0x546d33[_0x48c7('0x47')][_0x48c7('0x52')]+'%'};return _0x4a2dc5;})});}_0x56cc80=_[_0x48c7('0x53')]({},_0x56cc80,_0x546d33[_0x48c7('0x54')]);return db['SmsInteraction'][_0x48c7('0x35')]({'where':_0x56cc80[_0x48c7('0x4f')]})['then'](function(_0x26952c){_0x926244[_0x48c7('0x35')]=_0x26952c;if(_0x546d33[_0x48c7('0x47')][_0x48c7('0x55')]){_0x56cc80['include']=[{'model':db[_0x48c7('0x7d')],'as':_0x48c7('0xb6'),'required':![]},{'model':db[_0x48c7('0xb7')],'as':_0x48c7('0xb8'),'attributes':[_0x48c7('0x3f'),_0x48c7('0xb9'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x48c7('0xba'),'attributes':['id','name',_0x48c7('0xbb')],'where':_0x546d33[_0x48c7('0x47')][_0x48c7('0xbc')]?{'id':_0x546d33[_0x48c7('0x47')][_0x48c7('0xbc')]}:undefined,'required':_0x546d33[_0x48c7('0x47')][_0x48c7('0xbc')]?!![]:![]}];}return db['SmsInteraction'][_0x48c7('0x6f')](_0x56cc80);})[_0x48c7('0x24')](function(_0x500454){_0x926244[_0x48c7('0x57')]=_0x500454;return _0x926244;});}})[_0x48c7('0x24')](respondWithFilteredResult(_0x41ad8d,_0x56cc80))['catch'](handleError(_0x41ad8d,null));};exports[_0x48c7('0xb0')]=function(_0xcfdc50,_0x4f0451,_0x24580e){var _0x5a11ac,_0x5ca28b,_0xb6bd09;if(_[_0x48c7('0x97')](_0xcfdc50[_0x48c7('0x66')][_0x48c7('0x66')])||_0xcfdc50[_0x48c7('0x66')][_0x48c7('0x66')]===''){throw new db[(_0x48c7('0x7e'))][(_0x48c7('0x7f'))](_0x48c7('0x99'));}if(_[_0x48c7('0x97')](_0xcfdc50[_0x48c7('0x66')]['to'])){throw new db[(_0x48c7('0x7e'))][(_0x48c7('0x7f'))](_0x48c7('0xbd'));}_0x5a11ac=_0xcfdc50[_0x48c7('0x66')]['to'];return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0xcfdc50[_0x48c7('0x5a')]['id']},'include':[{'model':db[_0x48c7('0x9c')],'as':_0x48c7('0xbe'),'include':[{'model':db[_0x48c7('0x7d')],'as':_0x48c7('0x9d'),'where':{'mobile':_0x5a11ac},'limit':0x1,'order':[[_0x48c7('0x82'),_0x48c7('0xbf')]]}]}]})[_0x48c7('0x24')](handleEntityNotFound(_0x4f0451,null))['then'](function(_0x70a380){if(_0x70a380&&_0x70a380[_0x48c7('0xbe')]){_0x5ca28b=_0x70a380[_0x48c7('0x5f')]({'plain':!![]});if(_0x5ca28b[_0x48c7('0xbe')]&&_0x5ca28b[_0x48c7('0xbe')]['Contacts'][_0x48c7('0x4b')]){return _0x5ca28b['List'][_0x48c7('0x9d')][0x0];}return db['CmContact'][_0x48c7('0x5e')](_[_0x48c7('0x1c')](_0xcfdc50[_0x48c7('0x66')],{'firstName':_0x5a11ac,'mobile':_0x5a11ac,'phone':_0x5a11ac,'ListId':_0x5ca28b[_0x48c7('0xc0')]}));}})[_0x48c7('0x24')](handleEntityNotFound(_0x4f0451,null))['then'](function(_0x40061a){if(_0x40061a){_0xb6bd09=_0x40061a;return db[_0x48c7('0xa0')][_0x48c7('0x5d')]({'where':{'ContactId':_0xb6bd09['id'],'closed':![],'SmsAccountId':_0x5ca28b['id']}})[_0x48c7('0x24')](function(_0x24b75f){if(_0x24b75f){return[_0x24b75f,![]];}return db[_0x48c7('0xa0')][_0x48c7('0x5e')]({'UserId':_0xcfdc50[_0x48c7('0x61')]['id'],'ContactId':_0xb6bd09['id'],'SmsAccountId':_0x5ca28b['id'],'phone':_0x5a11ac,'firstMsgDirection':_0x48c7('0xc1'),'Messages':[_[_0x48c7('0x53')](_0xcfdc50[_0x48c7('0x66')],{'read':![],'body':_0xcfdc50['body'][_0x48c7('0x66')],'phone':_0x5a11ac,'SmsAccountId':_0x5ca28b['id'],'UserId':_0xcfdc50['user']['id'],'ContactId':_0xb6bd09['id']})]},{'include':[{'model':db[_0x48c7('0xa7')],'as':_0x48c7('0xc2')}]})[_0x48c7('0x24')](function(_0x55ff77){return[_0x55ff77,!![]];});});}})[_0x48c7('0xc3')](function(_0x1ab50b,_0x46138b){if(_0x46138b){return _0x1ab50b;}return db['SmsMessage'][_0x48c7('0x5e')](_[_0x48c7('0x53')](_0xcfdc50[_0x48c7('0x66')],{'read':![],'body':_0xcfdc50[_0x48c7('0x66')]['body'],'phone':_0x5a11ac,'SmsAccountId':_0x5ca28b['id'],'SmsInteractionId':_0x1ab50b['id'],'UserId':_0xcfdc50['user']['id'],'ContactId':_0xb6bd09['id']}))[_0x48c7('0x24')](function(_0x5eaf35){_0x1ab50b[_0x48c7('0xc4')][_0x48c7('0xc2')]=[];_0x1ab50b[_0x48c7('0xc4')]['Messages'][_0x48c7('0xa4')](_0x5eaf35[_0x48c7('0xc4')]);return _0x1ab50b;});})['then'](respondWithResult(_0x4f0451,null))[_0x48c7('0x58')](handleError(_0x4f0451,null));};exports[_0x48c7('0x2f')]=function(_0x482770,_0x1e1b10,_0x185029){if(_0x482770[_0x48c7('0x66')]['id']){delete _0x482770[_0x48c7('0x66')]['id'];}var _0x3e77f7,_0x3516f0,_0x58d1ca;return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x482770[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x1e1b10,null))['then'](function(_0x4f8907){if(_0x4f8907){_0x58d1ca=_0x4f8907;logger[_0x48c7('0x28')](_0x48c7('0x29'),_0x48c7('0x2f'),'received\x20delivery\x20report\x20from',_0x4f8907[_0x48c7('0x45')],util[_0x48c7('0xc5')](_0x482770[_0x48c7('0x66')],{'showHidden':![],'depth':null}));switch(_0x4f8907[_0x48c7('0x45')]){case _0x48c7('0xc6'):if(_0x482770[_0x48c7('0x66')][_0x48c7('0xc7')]&&_0x482770['body'][_0x48c7('0x2f')]){_0x3516f0=_0x482770['body'][_0x48c7('0x2f')];return db['SmsMessage'][_0x48c7('0x5d')]({'where':{'messageId':_0x482770[_0x48c7('0x66')][_0x48c7('0xc7')]}});}break;case _0x48c7('0x8c'):if(_0x482770[_0x48c7('0x66')][_0x48c7('0xc8')]&&_0x482770[_0x48c7('0x66')][_0x48c7('0xc9')]){_0x3516f0=_0x482770[_0x48c7('0x66')][_0x48c7('0xc9')];return db[_0x48c7('0xa7')][_0x48c7('0x5d')]({'where':{'messageId':_0x482770[_0x48c7('0x66')][_0x48c7('0xc8')]}});}break;case _0x48c7('0x8d'):if(_0x482770['body'][_0x48c7('0x8e')]&&_0x482770['body'][_0x48c7('0xca')]){_0x3516f0=_0x482770[_0x48c7('0x66')][_0x48c7('0xca')];return db[_0x48c7('0xa7')]['find']({'where':{'messageId':_0x482770[_0x48c7('0x66')][_0x48c7('0x8e')]}});}break;case _0x48c7('0xcb'):var _0x1557c9=_0x482770[_0x48c7('0x66')][_0x48c7('0xcc')][0x0];if(_0x1557c9[_0x48c7('0x88')]&&_0x1557c9[_0x48c7('0x2f')][_0x48c7('0xcd')]===_0x48c7('0xce')){_0x3516f0=_0x1557c9[_0x48c7('0x2f')][_0x48c7('0xcd')];return db[_0x48c7('0xa7')][_0x48c7('0x5d')]({'where':{'messageId':_0x1557c9[_0x48c7('0x88')]}});}break;case _0x48c7('0xcf'):if(_0x482770[_0x48c7('0x66')]['messageId']&&_0x482770[_0x48c7('0x66')][_0x48c7('0x2f')]){_0x3516f0=_0x482770[_0x48c7('0x66')][_0x48c7('0x2f')];return db[_0x48c7('0xa7')][_0x48c7('0x5d')]({'where':{'messageId':_0x482770[_0x48c7('0x66')][_0x48c7('0x88')]}});}break;case _0x48c7('0x94'):if(_0x482770[_0x48c7('0x66')][0x0][_0x48c7('0x2d')]['id']){_0x3516f0=_0x482770[_0x48c7('0x66')][0x0][_0x48c7('0x45')];return db[_0x48c7('0xa7')][_0x48c7('0x5d')]({'where':{'messageId':_0x482770[_0x48c7('0x66')][0x0][_0x48c7('0x2d')]['id']}});}break;case _0x48c7('0x95'):if(_0x482770[_0x48c7('0x66')][_0x48c7('0xd0')]&&_0x482770[_0x48c7('0x66')]['status']){_0x3516f0=_0x482770[_0x48c7('0x66')][_0x48c7('0x2f')];return db['SmsMessage'][_0x48c7('0x5d')]({'where':{'messageId':_0x482770[_0x48c7('0x66')][_0x48c7('0xd0')]}});}break;}}})[_0x48c7('0x24')](handleEntityNotFound(_0x1e1b10,null))['then'](function(_0x5380fd){if(_0x5380fd){_0x3e77f7=_0x5380fd;switch(_0x58d1ca[_0x48c7('0x45')]){case'skebby':if(_0x3516f0===_0x48c7('0xce')){return _0x3e77f7[_0x48c7('0x3a')]({'read':!![]});}else{logger['error'](_0x48c7('0x29'),_0x48c7('0x2f'),_0x48c7('0xc6'),util[_0x48c7('0xc5')](_0x482770[_0x48c7('0x66')],{'showHidden':![],'depth':null}));}break;case _0x48c7('0x8c'):if(_0x3516f0==='1'){return _0x3e77f7[_0x48c7('0x3a')]({'read':!![]});}else{logger[_0x48c7('0x2b')](_0x48c7('0x29'),_0x48c7('0x2f'),_0x48c7('0xc6'),util[_0x48c7('0xc5')](_0x482770['body'],{'showHidden':![],'depth':null}));}break;case _0x48c7('0x8d'):if(!_0x482770[_0x48c7('0x66')][_0x48c7('0xd1')]&&_0x3516f0>=0xc8&&_0x3516f0<=0xce){return _0x3e77f7[_0x48c7('0x3a')]({'read':!![]});}else{logger[_0x48c7('0x2b')](_0x48c7('0x29'),_0x48c7('0x2f'),_0x48c7('0x8d'),util['inspect'](_0x482770['body'],{'showHidden':![],'depth':null}));}break;case _0x48c7('0xcb'):var _0x2e4ab4=_0x482770['body']['results'][0x0];if(_0x2e4ab4['status'][_0x48c7('0xcd')]===_0x48c7('0xce')){return _0x3e77f7[_0x48c7('0x3a')]({'read':!![]});}else{logger[_0x48c7('0x2b')](_0x48c7('0x29'),_0x48c7('0x2f'),_0x48c7('0xcb'),util['inspect'](_0x482770[_0x48c7('0x66')],{'showHidden':![],'depth':null}));}break;case _0x48c7('0xcf'):if(_0x3516f0==_0x48c7('0xd2')||_0x3516f0==_0x48c7('0xd3')){return _0x3e77f7[_0x48c7('0x3a')]({'read':!![]});}else{logger[_0x48c7('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x48c7('0x2f'),_0x48c7('0xcf'),util[_0x48c7('0xc5')](_0x482770[_0x48c7('0x66')],{'showHidden':![],'depth':null}));}break;case _0x48c7('0x94'):if(_0x3516f0=='message-delivered'){return _0x3e77f7[_0x48c7('0x3a')]({'read':!![]});}else{logger[_0x48c7('0x2b')](_0x48c7('0x29'),_0x48c7('0x2f'),_0x48c7('0x94'),util[_0x48c7('0xc5')](_0x482770[_0x48c7('0x66')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3516f0===_0x48c7('0xd4')||_0x3516f0===_0x48c7('0xd5')){return _0x3e77f7[_0x48c7('0x3a')]({'read':!![]});}else{logger[_0x48c7('0x2b')](_0x48c7('0x29'),'status',_0x48c7('0x95'),util[_0x48c7('0xc5')](_0x482770['body'],{'showHidden':![],'depth':null}));}break;}return _0x3e77f7;}})[_0x48c7('0x24')](respondWithResult(_0x1e1b10,null))[_0x48c7('0x58')](handleError(_0x1e1b10,null));};exports[_0x48c7('0xd6')]=function(_0x7e1c,_0x4dbb83,_0x3ae811){var _0x5f2d13,_0x29df80,_0x5d84e6;return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x7e1c[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x4dbb83,null))[_0x48c7('0x24')](function(_0x56f5d4){if(_0x56f5d4){_0x5d84e6=_0x56f5d4;logger[_0x48c7('0x28')](_0x48c7('0x29'),_0x48c7('0x2f'),_0x48c7('0xd7'),_0x56f5d4[_0x48c7('0x45')],util['inspect'](_0x7e1c[_0x48c7('0x47')],{'showHidden':![],'depth':null}));switch(_0x56f5d4[_0x48c7('0x45')]){case'csc':if(_0x7e1c[_0x48c7('0x47')]['message-id']&&_0x7e1c[_0x48c7('0x47')][_0x48c7('0xd8')]){_0x29df80=_0x7e1c[_0x48c7('0x47')][_0x48c7('0xd8')];return db[_0x48c7('0xa7')][_0x48c7('0x5d')]({'where':{'messageId':_0x7e1c[_0x48c7('0x47')][_0x48c7('0xd9')]}});}break;}}})[_0x48c7('0x24')](handleEntityNotFound(_0x4dbb83,null))[_0x48c7('0x24')](function(_0x1b545d){if(_0x1b545d){_0x5f2d13=_0x1b545d;switch(_0x5d84e6[_0x48c7('0x45')]){case _0x48c7('0xda'):if(_0x29df80==='2'||_0x29df80==='6'){return _0x5f2d13[_0x48c7('0x3a')]({'read':!![]});}else{logger[_0x48c7('0x2b')](_0x48c7('0x29'),_0x48c7('0x2f'),_0x48c7('0xda'),util[_0x48c7('0xc5')](_0x7e1c[_0x48c7('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x5f2d13;}})[_0x48c7('0x24')](respondWithResult(_0x4dbb83,null))[_0x48c7('0x58')](handleError(_0x4dbb83,null));};exports[_0x48c7('0xdb')]=function(_0x5db369,_0xa0093d,_0x745186){return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x5db369[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0xa0093d,null))[_0x48c7('0x24')](function(_0x12a035){if(_0x12a035){return _0x12a035[_0x48c7('0xdb')](_0x5db369[_0x48c7('0x66')][_0x48c7('0xdc')],_[_0x48c7('0x9e')](_0x5db369[_0x48c7('0x66')],['ids','id'])||{})[_0x48c7('0xc3')](function(_0x220318){for(var _0x396263=0x0;_0x396263<_0x5db369[_0x48c7('0x66')][_0x48c7('0xdc')][_0x48c7('0x4b')];_0x396263+=0x1){socket[_0x48c7('0xdd')](_0x48c7('0xde'),{'UserId':Number(_0x5db369[_0x48c7('0x66')]['ids'][_0x396263]),'SmsAccountId':Number(_0x5db369[_0x48c7('0x5a')]['id'])});}return _0x220318;});}})['then'](respondWithResult(_0xa0093d,null))[_0x48c7('0x58')](handleError(_0xa0093d,null));};exports[_0x48c7('0xdf')]=function(_0x8d5cc4,_0x3f4488,_0x33daa7){return db[_0x48c7('0x43')][_0x48c7('0x5d')]({'where':{'id':_0x8d5cc4[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x3f4488,null))[_0x48c7('0x24')](function(_0x4051d2){if(_0x4051d2){return _0x4051d2[_0x48c7('0xdf')](_0x8d5cc4['query'][_0x48c7('0xdc')])[_0x48c7('0x24')](function(){if(_[_0x48c7('0xe0')](_0x8d5cc4[_0x48c7('0x47')]['ids'])){for(var _0x1c195f=0x0;_0x1c195f<_0x8d5cc4[_0x48c7('0x47')][_0x48c7('0xdc')][_0x48c7('0x4b')];_0x1c195f+=0x1){socket['emit'](_0x48c7('0xe1'),{'UserId':Number(_0x8d5cc4[_0x48c7('0x47')][_0x48c7('0xdc')][_0x1c195f]),'SmsAccountId':Number(_0x8d5cc4[_0x48c7('0x5a')]['id'])});}}else{socket['emit'](_0x48c7('0xe1'),{'UserId':Number(_0x8d5cc4['query'][_0x48c7('0xdc')]),'SmsAccountId':Number(_0x8d5cc4[_0x48c7('0x5a')]['id'])});}});}})[_0x48c7('0x24')](respondWithStatusCode(_0x3f4488,null))['catch'](handleError(_0x3f4488,null));};exports[_0x48c7('0xe2')]=function(_0x167f4c,_0x1099bd,_0x31bf20){var _0xf8ff69={};var _0x1f8d7d={};var _0x28c073;var _0x10dad1;return db[_0x48c7('0x43')][_0x48c7('0x6b')]({'where':{'id':_0x167f4c[_0x48c7('0x5a')]['id']}})[_0x48c7('0x24')](handleEntityNotFound(_0x1099bd,null))[_0x48c7('0x24')](function(_0x1d4a34){if(_0x1d4a34){_0x28c073=_0x1d4a34;_0x1f8d7d[_0x48c7('0x46')]=_[_0x48c7('0x5b')](db[_0x48c7('0xb7')][_0x48c7('0x5c')]);_0x1f8d7d[_0x48c7('0x47')]=_['keys'](_0x167f4c['query']);_0x1f8d7d[_0x48c7('0x50')]=_[_0x48c7('0x48')](_0x1f8d7d[_0x48c7('0x46')],_0x1f8d7d[_0x48c7('0x47')]);_0xf8ff69[_0x48c7('0x49')]=_['intersection'](_0x1f8d7d[_0x48c7('0x46')],qs['fields'](_0x167f4c[_0x48c7('0x47')][_0x48c7('0x4a')]));_0xf8ff69[_0x48c7('0x49')]=_0xf8ff69[_0x48c7('0x49')][_0x48c7('0x4b')]?_0xf8ff69['attributes']:_0x1f8d7d[_0x48c7('0x46')];_0xf8ff69['order']=qs[_0x48c7('0x4e')](_0x167f4c['query'][_0x48c7('0x4e')]);_0xf8ff69[_0x48c7('0x4f')]=qs[_0x48c7('0x50')](_[_0x48c7('0x6e')](_0x167f4c[_0x48c7('0x47')],_0x1f8d7d[_0x48c7('0x50')]));if(_0x167f4c[_0x48c7('0x47')][_0x48c7('0x52')]){_0xf8ff69['where']=_[_0x48c7('0x53')](_0xf8ff69[_0x48c7('0x4f')],{'$or':_[_0x48c7('0x42')](_0xf8ff69['attributes'],function(_0x586b75){var _0x249b96={};_0x249b96[_0x586b75]={'$like':'%'+_0x167f4c[_0x48c7('0x47')][_0x48c7('0x52')]+'%'};return _0x249b96;})});}_0xf8ff69=_[_0x48c7('0x53')]({},_0xf8ff69,_0x167f4c[_0x48c7('0x54')]);return _0x28c073['getAgents'](_0xf8ff69);}})['then'](function(_0x126671){if(_0x126671){_0x10dad1=_0x126671[_0x48c7('0x4b')];if(!_0x167f4c['query'][_0x48c7('0x4c')](_0x48c7('0x6d'))){_0xf8ff69[_0x48c7('0x34')]=qs[_0x48c7('0x34')](_0x167f4c[_0x48c7('0x47')][_0x48c7('0x34')]);_0xf8ff69[_0x48c7('0x32')]=qs[_0x48c7('0x32')](_0x167f4c[_0x48c7('0x47')][_0x48c7('0x32')]);}return _0x28c073['getAgents'](_0xf8ff69);}})[_0x48c7('0x24')](function(_0x5ebb9f){if(_0x5ebb9f){return _0x5ebb9f?{'count':_0x10dad1,'rows':_0x5ebb9f}:null;}})['then'](respondWithResult(_0x1099bd,null))[_0x48c7('0x58')](handleError(_0x1099bd,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 2e02fb4..51e99bb 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 _0xf574=['remove','emit','hook','exports','events','../../mysqldb','SmsAccount','update'];(function(_0x6f4627,_0x39f8ee){var _0x210983=function(_0x2ee42c){while(--_0x2ee42c){_0x6f4627['push'](_0x6f4627['shift']());}};_0x210983(++_0x39f8ee);}(_0xf574,0x64));var _0x4f57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf574[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x4f57('0x0'));var SmsAccount=require(_0x4f57('0x1'))['db'][_0x4f57('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4f57('0x3'),'afterDestroy':_0x4f57('0x4')};function emitEvent(_0x1f060b){return function(_0x5a8003,_0x2354eb,_0x27e699){SmsAccountEvents[_0x4f57('0x5')](_0x1f060b+':'+_0x5a8003['id'],_0x5a8003);SmsAccountEvents['emit'](_0x1f060b,_0x5a8003);_0x27e699(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4f57('0x6')](e,emitEvent(event));}}module[_0x4f57('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xc1ec=['events','save','update','emit','hasOwnProperty','hook'];(function(_0x11ed2a,_0x3bf4bb){var _0x4ce7d7=function(_0x422e73){while(--_0x422e73){_0x11ed2a['push'](_0x11ed2a['shift']());}};_0x4ce7d7(++_0x3bf4bb);}(_0xc1ec,0x180));var _0xcc1e=function(_0x5b9102,_0x2e037a){_0x5b9102=_0x5b9102-0x0;var _0xae826f=_0xc1ec[_0x5b9102];return _0xae826f;};'use strict';var EventEmitter=require(_0xcc1e('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc1e('0x1'),'afterUpdate':_0xcc1e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x49a418){return function(_0x3cad72,_0x2646e6,_0x768c8f){SmsAccountEvents['emit'](_0x49a418+':'+_0x3cad72['id'],_0x3cad72);SmsAccountEvents[_0xcc1e('0x3')](_0x49a418,_0x3cad72);_0x768c8f(null);};}for(var e in events){if(events[_0xcc1e('0x4')](e)){var event=events[e];SmsAccount[_0xcc1e('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 1c09a34..e0badb5 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 _0x39c9=['./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x39c9,0x1be));var _0x939c=function(_0x180ca5,_0x5a2e9b){_0x180ca5=_0x180ca5-0x0;var _0x332e17=_0x39c9[_0x180ca5];return _0x332e17;};'use strict';var _=require(_0x939c('0x0'));var util=require(_0x939c('0x1'));var logger=require(_0x939c('0x2'))(_0x939c('0x3'));var moment=require(_0x939c('0x4'));var BPromise=require(_0x939c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x939c('0x6'));var rimraf=require(_0x939c('0x7'));var config=require(_0x939c('0x8'));var attributes=require(_0x939c('0x9'));module['exports']=function(_0xb7f265,_0x58a3e3){return _0xb7f265[_0x939c('0xa')](_0x939c('0xb'),attributes,{'tableName':_0x939c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee1=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsAccount.attributes','sms_accounts','lodash','util'];(function(_0x2a22b9,_0x1641f2){var _0x19a2e9=function(_0x5bd818){while(--_0x5bd818){_0x2a22b9['push'](_0x2a22b9['shift']());}};_0x19a2e9(++_0x1641f2);}(_0x3ee1,0x120));var _0x13ee=function(_0xfa076b,_0x3c0b01){_0xfa076b=_0xfa076b-0x0;var _0x5f3518=_0x3ee1[_0xfa076b];return _0x5f3518;};'use strict';var _=require(_0x13ee('0x0'));var util=require(_0x13ee('0x1'));var logger=require(_0x13ee('0x2'))(_0x13ee('0x3'));var moment=require(_0x13ee('0x4'));var BPromise=require(_0x13ee('0x5'));var rp=require(_0x13ee('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13ee('0x7'));var attributes=require(_0x13ee('0x8'));module['exports']=function(_0x32bceb,_0x4a2719){return _0x32bceb['define']('SmsAccount',attributes,{'tableName':_0x13ee('0x9'),'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 94d184b..de39e18 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 _0x9d2f=['http','redis','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x9d2f,0x1a6));var _0xf9d2=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x9d2f[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xf9d2('0x0'));var util=require(_0xf9d2('0x1'));var moment=require(_0xf9d2('0x2'));var BPromise=require(_0xf9d2('0x3'));var rs=require(_0xf9d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf9d2('0x5'));var logger=require(_0xf9d2('0x6'))(_0xf9d2('0x7'));var config=require('../../config/environment');var jayson=require(_0xf9d2('0x8'));var client=jayson[_0xf9d2('0x9')][_0xf9d2('0xa')]({'port':0x232a});config[_0xf9d2('0xb')]=_['defaults'](config[_0xf9d2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9d2('0xc'))(new Redis(config[_0xf9d2('0xb')]));require(_0xf9d2('0xd'))[_0xf9d2('0xe')](socket);function respondWithRpcPromise(_0x2e594a,_0x2d97b0,_0x366725){return new BPromise(function(_0x1b94f2,_0x343145){return client['request'](_0x2e594a,_0x366725)[_0xf9d2('0xf')](function(_0x45d512){logger['info'](_0xf9d2('0x10'),_0x2d97b0,_0xf9d2('0x11'));logger[_0xf9d2('0x12')](_0xf9d2('0x13'),_0x2d97b0,_0xf9d2('0x11'),JSON['stringify'](_0x45d512));if(_0x45d512['error']){if(_0x45d512['error'][_0xf9d2('0x14')]===0x1f4){logger[_0xf9d2('0x15')](_0xf9d2('0x10'),_0x2d97b0,_0x45d512[_0xf9d2('0x15')][_0xf9d2('0x16')]);return _0x343145(_0x45d512[_0xf9d2('0x15')][_0xf9d2('0x16')]);}logger[_0xf9d2('0x15')](_0xf9d2('0x10'),_0x2d97b0,_0x45d512[_0xf9d2('0x15')][_0xf9d2('0x16')]);return _0x1b94f2(_0x45d512[_0xf9d2('0x15')][_0xf9d2('0x16')]);}else{logger[_0xf9d2('0x17')](_0xf9d2('0x10'),_0x2d97b0,_0xf9d2('0x11'));_0x1b94f2(_0x45d512[_0xf9d2('0x18')][_0xf9d2('0x16')]);}})[_0xf9d2('0x19')](function(_0x42825c){logger[_0xf9d2('0x15')](_0xf9d2('0x10'),_0x2d97b0,_0x42825c);_0x343145(_0x42825c);});});}exports[_0xf9d2('0x1a')]=function(_0x21090b){var _0x1705cd=this;return new Promise(function(_0x502fd2,_0x56d4a3){return db['SmsAccount'][_0xf9d2('0x1b')]({'raw':_0x21090b[_0xf9d2('0x1c')]?_0x21090b['options'][_0xf9d2('0x1d')]===undefined?!![]:![]:!![],'where':_0x21090b[_0xf9d2('0x1c')]?_0x21090b['options'][_0xf9d2('0x1e')]||null:null,'attributes':_0x21090b['options']?_0x21090b[_0xf9d2('0x1c')][_0xf9d2('0x1f')]||null:null,'include':_0x21090b[_0xf9d2('0x1c')]?_0x21090b['options'][_0xf9d2('0x20')]?_[_0xf9d2('0x21')](_0x21090b[_0xf9d2('0x1c')][_0xf9d2('0x20')],function(_0x2506eb){return{'model':db[_0x2506eb[_0xf9d2('0x22')]],'as':_0x2506eb['as'],'attributes':_0x2506eb[_0xf9d2('0x1f')],'include':_0x2506eb['include']?_[_0xf9d2('0x21')](_0x2506eb[_0xf9d2('0x20')],function(_0x5d3713){return{'model':db[_0x5d3713[_0xf9d2('0x22')]],'as':_0x5d3713['as'],'attributes':_0x5d3713['attributes'],'include':_0x5d3713[_0xf9d2('0x20')]?_[_0xf9d2('0x21')](_0x5d3713[_0xf9d2('0x20')],function(_0x5bb16f){return{'model':db[_0x5bb16f[_0xf9d2('0x22')]],'as':_0x5bb16f['as'],'attributes':_0x5bb16f[_0xf9d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf9d2('0xf')](function(_0x3239cd){logger['info'](_0xf9d2('0x1a'),_0x21090b);logger[_0xf9d2('0x12')](_0xf9d2('0x1a'),_0x21090b,JSON[_0xf9d2('0x23')](_0x3239cd));_0x502fd2(_0x3239cd);})[_0xf9d2('0x19')](function(_0x50c157){logger[_0xf9d2('0x15')](_0xf9d2('0x1a'),_0x50c157[_0xf9d2('0x16')],_0x21090b);_0x56d4a3(_0x1705cd['error'](0x1f4,_0x50c157['message']));});});}; \ No newline at end of file +var _0xa3c1=['message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1b9c11,_0x2d3e06){var _0x425019=function(_0x455b8b){while(--_0x455b8b){_0x1b9c11['push'](_0x1b9c11['shift']());}};_0x425019(++_0x2d3e06);}(_0xa3c1,0xdb));var _0x1a3c=function(_0x35ccfe,_0x43256a){_0x35ccfe=_0x35ccfe-0x0;var _0x8303f9=_0xa3c1[_0x35ccfe];return _0x8303f9;};'use strict';var _=require(_0x1a3c('0x0'));var util=require(_0x1a3c('0x1'));var moment=require(_0x1a3c('0x2'));var BPromise=require(_0x1a3c('0x3'));var rs=require(_0x1a3c('0x4'));var fs=require('fs');var Redis=require(_0x1a3c('0x5'));var db=require(_0x1a3c('0x6'))['db'];var utils=require(_0x1a3c('0x7'));var logger=require('../../config/logger')(_0x1a3c('0x8'));var config=require(_0x1a3c('0x9'));var jayson=require(_0x1a3c('0xa'));var client=jayson[_0x1a3c('0xb')][_0x1a3c('0xc')]({'port':0x232a});config['redis']=_[_0x1a3c('0xd')](config[_0x1a3c('0xe')],{'host':_0x1a3c('0xf'),'port':0x18eb});var socket=require(_0x1a3c('0x10'))(new Redis(config[_0x1a3c('0xe')]));require(_0x1a3c('0x11'))[_0x1a3c('0x12')](socket);function respondWithRpcPromise(_0x2765f,_0x28f248,_0x3c0476){return new BPromise(function(_0x10f0e2,_0x18baa6){return client[_0x1a3c('0x13')](_0x2765f,_0x3c0476)[_0x1a3c('0x14')](function(_0x46834f){logger[_0x1a3c('0x15')](_0x1a3c('0x16'),_0x28f248,_0x1a3c('0x17'));logger['debug'](_0x1a3c('0x18'),_0x28f248,_0x1a3c('0x17'),JSON[_0x1a3c('0x19')](_0x46834f));if(_0x46834f[_0x1a3c('0x1a')]){if(_0x46834f['error']['code']===0x1f4){logger['error'](_0x1a3c('0x16'),_0x28f248,_0x46834f[_0x1a3c('0x1a')]['message']);return _0x18baa6(_0x46834f[_0x1a3c('0x1a')]['message']);}logger[_0x1a3c('0x1a')]('SmsAccount,\x20%s,\x20%s',_0x28f248,_0x46834f[_0x1a3c('0x1a')]['message']);return _0x10f0e2(_0x46834f[_0x1a3c('0x1a')][_0x1a3c('0x1b')]);}else{logger[_0x1a3c('0x15')]('SmsAccount,\x20%s,\x20%s',_0x28f248,_0x1a3c('0x17'));_0x10f0e2(_0x46834f[_0x1a3c('0x1c')][_0x1a3c('0x1b')]);}})['catch'](function(_0x5cfec0){logger[_0x1a3c('0x1a')](_0x1a3c('0x16'),_0x28f248,_0x5cfec0);_0x18baa6(_0x5cfec0);});});}exports[_0x1a3c('0x1d')]=function(_0x1d4f19){var _0x2f1b32=this;return new Promise(function(_0x1bc2b7,_0x4fbb71){return db[_0x1a3c('0x1e')][_0x1a3c('0x1f')]({'raw':_0x1d4f19['options']?_0x1d4f19[_0x1a3c('0x20')][_0x1a3c('0x21')]===undefined?!![]:![]:!![],'where':_0x1d4f19['options']?_0x1d4f19['options'][_0x1a3c('0x22')]||null:null,'attributes':_0x1d4f19[_0x1a3c('0x20')]?_0x1d4f19['options']['attributes']||null:null,'include':_0x1d4f19[_0x1a3c('0x20')]?_0x1d4f19[_0x1a3c('0x20')][_0x1a3c('0x23')]?_[_0x1a3c('0x24')](_0x1d4f19[_0x1a3c('0x20')][_0x1a3c('0x23')],function(_0x111452){return{'model':db[_0x111452[_0x1a3c('0x25')]],'as':_0x111452['as'],'attributes':_0x111452[_0x1a3c('0x26')],'include':_0x111452[_0x1a3c('0x23')]?_['map'](_0x111452['include'],function(_0x873252){return{'model':db[_0x873252[_0x1a3c('0x25')]],'as':_0x873252['as'],'attributes':_0x873252[_0x1a3c('0x26')],'include':_0x873252[_0x1a3c('0x23')]?_[_0x1a3c('0x24')](_0x873252[_0x1a3c('0x23')],function(_0x41bcf8){return{'model':db[_0x41bcf8[_0x1a3c('0x25')]],'as':_0x41bcf8['as'],'attributes':_0x41bcf8[_0x1a3c('0x26')]};}):[]};}):[]};}):[]:[]})[_0x1a3c('0x14')](function(_0x162dd5){logger[_0x1a3c('0x15')](_0x1a3c('0x1d'),_0x1d4f19);logger[_0x1a3c('0x27')](_0x1a3c('0x1d'),_0x1d4f19,JSON[_0x1a3c('0x19')](_0x162dd5));_0x1bc2b7(_0x162dd5);})[_0x1a3c('0x28')](function(_0x3acaad){logger[_0x1a3c('0x1a')](_0x1a3c('0x1d'),_0x3acaad[_0x1a3c('0x1b')],_0x1d4f19);_0x4fbb71(_0x2f1b32[_0x1a3c('0x1a')](0x1f4,_0x3acaad[_0x1a3c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 27680e2..82457e6 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(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 1c5b395..1530333 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x541155,_0x54f085){var _0x519cf5=function(_0x24faf0){while(--_0x24faf0){_0x541155['push'](_0x541155['shift']());}};_0x519cf5(++_0x54f085);}(_0x34e8,0x12c));var _0x834e=function(_0x1e3ef4,_0x5ca553){_0x1e3ef4=_0x1e3ef4-0x0;var _0x34827f=_0x34e8[_0x1e3ef4];return _0x34827f;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1af794,_0x570050){var _0x402845=function(_0x319b24){while(--_0x319b24){_0x1af794['push'](_0x1af794['shift']());}};_0x402845(++_0x570050);}(_0x34e8,0x12c));var _0x834e=function(_0x2fd60c,_0x5eba66){_0x2fd60c=_0x2fd60c-0x0;var _0x5ec4ba=_0x34e8[_0x2fd60c];return _0x5ec4ba;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index af32e50..753a168 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 _0xc03f=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1bd826,_0x19bc32){var _0x5b5215=function(_0x3e8bf6){while(--_0x3e8bf6){_0x1bd826['push'](_0x1bd826['shift']());}};_0x5b5215(++_0x19bc32);}(_0xc03f,0x119));var _0xfc03=function(_0xa253f6,_0x4fac87){_0xa253f6=_0xa253f6-0x0;var _0x4bab67=_0xc03f[_0xa253f6];return _0x4bab67;};'use strict';var Sequelize=require(_0xfc03('0x0'));module[_0xfc03('0x1')]={'priority':{'type':Sequelize[_0xfc03('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfc03('0x3')],'allowNull':![],'defaultValue':_0xfc03('0x4')},'appdata':{'type':Sequelize[_0xfc03('0x5')]()},'description':{'type':Sequelize[_0xfc03('0x3')]},'interval':{'type':Sequelize[_0xfc03('0x3')],'defaultValue':_0xfc03('0x6')}}; \ No newline at end of file +var _0xaab3=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x57ec17,_0x5cd112){var _0x7933b9=function(_0x2a2849){while(--_0x2a2849){_0x57ec17['push'](_0x57ec17['shift']());}};_0x7933b9(++_0x5cd112);}(_0xaab3,0x12d));var _0x3aab=function(_0x12d239,_0x280f35){_0x12d239=_0x12d239-0x0;var _0x38e461=_0xaab3[_0x12d239];return _0x38e461;};'use strict';var Sequelize=require(_0x3aab('0x0'));module[_0x3aab('0x1')]={'priority':{'type':Sequelize[_0x3aab('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3aab('0x3')],'allowNull':![],'defaultValue':_0x3aab('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3aab('0x3')]},'interval':{'type':Sequelize[_0x3aab('0x3')],'defaultValue':_0x3aab('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0d053d5..8abefd8 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 _0xeb98=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','name','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','SmsApplication','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1cfc6b,_0x18733a){var _0xc66a2c=function(_0xc6a0e2){while(--_0xc6a0e2){_0x1cfc6b['push'](_0x1cfc6b['shift']());}};_0xc66a2c(++_0x18733a);}(_0xeb98,0x199));var _0x8eb9=function(_0x1afae8,_0x5de981){_0x1afae8=_0x1afae8-0x0;var _0x30b0d8=_0xeb98[_0x1afae8];return _0x30b0d8;};'use strict';var emlformat=require(_0x8eb9('0x0'));var rimraf=require(_0x8eb9('0x1'));var zipdir=require(_0x8eb9('0x2'));var jsonpatch=require(_0x8eb9('0x3'));var rp=require(_0x8eb9('0x4'));var moment=require(_0x8eb9('0x5'));var BPromise=require(_0x8eb9('0x6'));var Mustache=require(_0x8eb9('0x7'));var util=require('util');var path=require(_0x8eb9('0x8'));var sox=require('sox');var csv=require(_0x8eb9('0x9'));var ejs=require(_0x8eb9('0xa'));var fs=require('fs');var fs_extra=require(_0x8eb9('0xb'));var _=require(_0x8eb9('0xc'));var squel=require(_0x8eb9('0xd'));var crypto=require(_0x8eb9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8eb9('0x9'));var querystring=require(_0x8eb9('0xf'));var Papa=require(_0x8eb9('0x10'));var Redis=require(_0x8eb9('0x11'));var authService=require(_0x8eb9('0x12'));var qs=require(_0x8eb9('0x13'));var as=require(_0x8eb9('0x14'));var hardwareService=require(_0x8eb9('0x15'));var logger=require(_0x8eb9('0x16'))('api');var utils=require(_0x8eb9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8eb9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b0375,_0x5c79dc){_0x5c79dc=_0x5c79dc||0xcc;return function(_0x249494){if(_0x249494){return _0x2b0375[_0x8eb9('0x19')](_0x5c79dc);}return _0x2b0375[_0x8eb9('0x1a')](_0x5c79dc)[_0x8eb9('0x1b')]();};}function respondWithResult(_0x40f9b8,_0x16dea7){_0x16dea7=_0x16dea7||0xc8;return function(_0x4e4fe6){if(_0x4e4fe6){return _0x40f9b8[_0x8eb9('0x1a')](_0x16dea7)[_0x8eb9('0x1c')](_0x4e4fe6);}};}function respondWithFilteredResult(_0x372d6b,_0x393055){return function(_0x239c99){if(_0x239c99){var _0x5072a2=typeof _0x393055[_0x8eb9('0x1d')]==='undefined'&&typeof _0x393055[_0x8eb9('0x1e')]===_0x8eb9('0x1f');var _0x5c698d=_0x239c99[_0x8eb9('0x20')];var _0x118f75=_0x5072a2?0x0:_0x393055['offset'];var _0x536c5e=_0x5072a2?_0x239c99[_0x8eb9('0x20')]:_0x393055['offset']+_0x393055[_0x8eb9('0x1e')];var _0x58aa90;if(_0x536c5e>=_0x5c698d){_0x536c5e=_0x5c698d;_0x58aa90=0xc8;}else{_0x58aa90=0xce;}_0x372d6b['status'](_0x58aa90);return _0x372d6b['set'](_0x8eb9('0x21'),_0x118f75+'-'+_0x536c5e+'/'+_0x5c698d)[_0x8eb9('0x1c')](_0x239c99);}return null;};}function patchUpdates(_0x45d4fd){return function(_0x1d4b85){try{jsonpatch[_0x8eb9('0x22')](_0x1d4b85,_0x45d4fd,!![]);}catch(_0x347b3c){return BPromise[_0x8eb9('0x23')](_0x347b3c);}return _0x1d4b85[_0x8eb9('0x24')]();};}function saveUpdates(_0x2ea48b,_0x525f35){return function(_0x1b19a0){if(_0x1b19a0){return _0x1b19a0[_0x8eb9('0x25')](_0x2ea48b)[_0x8eb9('0x26')](function(_0x1512f9){return _0x1512f9;});}return null;};}function removeEntity(_0x37fdff,_0x4d9605){return function(_0x3be854){if(_0x3be854){return _0x3be854['destroy']()[_0x8eb9('0x26')](function(){_0x37fdff[_0x8eb9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55bce9,_0x49a957){return function(_0x1a4c7a){if(!_0x1a4c7a){_0x55bce9[_0x8eb9('0x19')](0x194);}return _0x1a4c7a;};}function handleError(_0x2e4aa2,_0x279568){_0x279568=_0x279568||0x1f4;return function(_0x4bf3f1){logger[_0x8eb9('0x27')](_0x4bf3f1['stack']);if(_0x4bf3f1[_0x8eb9('0x28')]){delete _0x4bf3f1[_0x8eb9('0x28')];}_0x2e4aa2[_0x8eb9('0x1a')](_0x279568)['send'](_0x4bf3f1);};}exports['index']=function(_0x3626ee,_0x285d23){var _0x57bb9e={},_0x11a18f={},_0x354be1={'count':0x0,'rows':[]};var _0x73ff33=_[_0x8eb9('0x29')](db['SmsApplication'][_0x8eb9('0x2a')],function(_0x2d23ed){return{'name':_0x2d23ed['fieldName'],'type':_0x2d23ed[_0x8eb9('0x2b')][_0x8eb9('0x2c')]};});_0x11a18f[_0x8eb9('0x2d')]=_[_0x8eb9('0x29')](_0x73ff33,_0x8eb9('0x28'));_0x11a18f['query']=_[_0x8eb9('0x2e')](_0x3626ee[_0x8eb9('0x2f')]);_0x11a18f[_0x8eb9('0x30')]=_[_0x8eb9('0x31')](_0x11a18f[_0x8eb9('0x2d')],_0x11a18f[_0x8eb9('0x2f')]);_0x57bb9e[_0x8eb9('0x32')]=_[_0x8eb9('0x31')](_0x11a18f[_0x8eb9('0x2d')],qs[_0x8eb9('0x33')](_0x3626ee[_0x8eb9('0x2f')][_0x8eb9('0x33')]));_0x57bb9e['attributes']=_0x57bb9e[_0x8eb9('0x32')][_0x8eb9('0x34')]?_0x57bb9e[_0x8eb9('0x32')]:_0x11a18f[_0x8eb9('0x2d')];if(!_0x3626ee[_0x8eb9('0x2f')][_0x8eb9('0x35')](_0x8eb9('0x36'))){_0x57bb9e[_0x8eb9('0x1e')]=qs[_0x8eb9('0x1e')](_0x3626ee['query'][_0x8eb9('0x1e')]);_0x57bb9e['offset']=qs[_0x8eb9('0x1d')](_0x3626ee[_0x8eb9('0x2f')][_0x8eb9('0x1d')]);}_0x57bb9e['order']=qs[_0x8eb9('0x37')](_0x3626ee['query'][_0x8eb9('0x37')]);_0x57bb9e[_0x8eb9('0x38')]=qs[_0x8eb9('0x30')](_['pick'](_0x3626ee[_0x8eb9('0x2f')],_0x11a18f[_0x8eb9('0x30')]),_0x73ff33);if(_0x3626ee[_0x8eb9('0x2f')][_0x8eb9('0x39')]){_0x57bb9e[_0x8eb9('0x38')]=_[_0x8eb9('0x3a')](_0x57bb9e[_0x8eb9('0x38')],{'$or':_['map'](_0x73ff33,function(_0x2ffd06){if(_0x2ffd06[_0x8eb9('0x2b')]!=='VIRTUAL'){var _0x58de0b={};_0x58de0b[_0x2ffd06[_0x8eb9('0x28')]]={'$like':'%'+_0x3626ee[_0x8eb9('0x2f')][_0x8eb9('0x39')]+'%'};return _0x58de0b;}})});}_0x57bb9e=_['merge']({},_0x57bb9e,_0x3626ee['options']);var _0x25e21f={'where':_0x57bb9e['where']};return db[_0x8eb9('0x3b')][_0x8eb9('0x20')](_0x25e21f)[_0x8eb9('0x26')](function(_0x1e7724){_0x354be1[_0x8eb9('0x20')]=_0x1e7724;if(_0x3626ee[_0x8eb9('0x2f')][_0x8eb9('0x3c')]){_0x57bb9e[_0x8eb9('0x3d')]=[{'all':!![]}];}return db['SmsApplication'][_0x8eb9('0x3e')](_0x57bb9e);})[_0x8eb9('0x26')](function(_0x220b10){_0x354be1[_0x8eb9('0x3f')]=_0x220b10;return _0x354be1;})[_0x8eb9('0x26')](respondWithFilteredResult(_0x285d23,_0x57bb9e))[_0x8eb9('0x40')](handleError(_0x285d23,null));};exports[_0x8eb9('0x41')]=function(_0x52cc24,_0x2d0495){var _0x42d502={'raw':!![],'where':{'id':_0x52cc24[_0x8eb9('0x42')]['id']}},_0x518e7e={};_0x518e7e[_0x8eb9('0x2d')]=_['keys'](db['SmsApplication'][_0x8eb9('0x2a')]);_0x518e7e[_0x8eb9('0x2f')]=_[_0x8eb9('0x2e')](_0x52cc24[_0x8eb9('0x2f')]);_0x518e7e['filters']=_['intersection'](_0x518e7e[_0x8eb9('0x2d')],_0x518e7e['query']);_0x42d502['attributes']=_[_0x8eb9('0x31')](_0x518e7e[_0x8eb9('0x2d')],qs[_0x8eb9('0x33')](_0x52cc24[_0x8eb9('0x2f')][_0x8eb9('0x33')]));_0x42d502['attributes']=_0x42d502['attributes'][_0x8eb9('0x34')]?_0x42d502[_0x8eb9('0x32')]:_0x518e7e[_0x8eb9('0x2d')];if(_0x52cc24['query'][_0x8eb9('0x3c')]){_0x42d502['include']=[{'all':!![]}];}_0x42d502=_[_0x8eb9('0x3a')]({},_0x42d502,_0x52cc24[_0x8eb9('0x43')]);return db[_0x8eb9('0x3b')]['find'](_0x42d502)[_0x8eb9('0x26')](handleEntityNotFound(_0x2d0495,null))[_0x8eb9('0x26')](respondWithResult(_0x2d0495,null))['catch'](handleError(_0x2d0495,null));};exports[_0x8eb9('0x44')]=function(_0x5c673b,_0x1de2ef){return db[_0x8eb9('0x3b')][_0x8eb9('0x44')](_0x5c673b['body'],{})[_0x8eb9('0x26')](respondWithResult(_0x1de2ef,0xc9))[_0x8eb9('0x40')](handleError(_0x1de2ef,null));};exports[_0x8eb9('0x25')]=function(_0x1460eb,_0x722354){if(_0x1460eb['body']['id']){delete _0x1460eb[_0x8eb9('0x45')]['id'];}return db['SmsApplication'][_0x8eb9('0x46')]({'where':{'id':_0x1460eb[_0x8eb9('0x42')]['id']}})[_0x8eb9('0x26')](handleEntityNotFound(_0x722354,null))[_0x8eb9('0x26')](saveUpdates(_0x1460eb['body'],null))[_0x8eb9('0x26')](respondWithResult(_0x722354,null))['catch'](handleError(_0x722354,null));};exports[_0x8eb9('0x47')]=function(_0x54e22d,_0x494d30){return db[_0x8eb9('0x3b')][_0x8eb9('0x46')]({'where':{'id':_0x54e22d[_0x8eb9('0x42')]['id']}})[_0x8eb9('0x26')](handleEntityNotFound(_0x494d30,null))['then'](removeEntity(_0x494d30,null))[_0x8eb9('0x40')](handleError(_0x494d30,null));}; \ No newline at end of file +var _0x23b9=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','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','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','save','update','then','destroy','stack','name','send','index','map','SmsApplication','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x192a70,_0x43ac92){var _0x10ec9f=function(_0x288269){while(--_0x288269){_0x192a70['push'](_0x192a70['shift']());}};_0x10ec9f(++_0x43ac92);}(_0x23b9,0xf8));var _0x923b=function(_0x4da837,_0x4db3d4){_0x4da837=_0x4da837-0x0;var _0x4b6324=_0x23b9[_0x4da837];return _0x4b6324;};'use strict';var emlformat=require(_0x923b('0x0'));var rimraf=require(_0x923b('0x1'));var zipdir=require(_0x923b('0x2'));var jsonpatch=require(_0x923b('0x3'));var rp=require(_0x923b('0x4'));var moment=require(_0x923b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x923b('0x6'));var util=require('util');var path=require(_0x923b('0x7'));var sox=require(_0x923b('0x8'));var csv=require(_0x923b('0x9'));var ejs=require(_0x923b('0xa'));var fs=require('fs');var fs_extra=require(_0x923b('0xb'));var _=require(_0x923b('0xc'));var squel=require(_0x923b('0xd'));var crypto=require(_0x923b('0xe'));var jsforce=require(_0x923b('0xf'));var deskjs=require(_0x923b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x923b('0x11'));var Papa=require(_0x923b('0x12'));var Redis=require(_0x923b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x923b('0x14'));var hardwareService=require(_0x923b('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x923b('0x16'));var config=require(_0x923b('0x17'));var licenseUtil=require(_0x923b('0x18'));var db=require(_0x923b('0x19'))['db'];function respondWithStatusCode(_0xad0ab4,_0x4e75e0){_0x4e75e0=_0x4e75e0||0xcc;return function(_0x267c9a){if(_0x267c9a){return _0xad0ab4[_0x923b('0x1a')](_0x4e75e0);}return _0xad0ab4[_0x923b('0x1b')](_0x4e75e0)['end']();};}function respondWithResult(_0x2b9c38,_0x5f38b2){_0x5f38b2=_0x5f38b2||0xc8;return function(_0x23e47a){if(_0x23e47a){return _0x2b9c38[_0x923b('0x1b')](_0x5f38b2)[_0x923b('0x1c')](_0x23e47a);}};}function respondWithFilteredResult(_0x1c32db,_0x355174){return function(_0x167599){if(_0x167599){var _0x38964c=typeof _0x355174['offset']===_0x923b('0x1d')&&typeof _0x355174['limit']===_0x923b('0x1d');var _0x2335ed=_0x167599[_0x923b('0x1e')];var _0x470c3f=_0x38964c?0x0:_0x355174[_0x923b('0x1f')];var _0x2c023d=_0x38964c?_0x167599[_0x923b('0x1e')]:_0x355174[_0x923b('0x1f')]+_0x355174[_0x923b('0x20')];var _0x12c369;if(_0x2c023d>=_0x2335ed){_0x2c023d=_0x2335ed;_0x12c369=0xc8;}else{_0x12c369=0xce;}_0x1c32db[_0x923b('0x1b')](_0x12c369);return _0x1c32db[_0x923b('0x21')]('Content-Range',_0x470c3f+'-'+_0x2c023d+'/'+_0x2335ed)[_0x923b('0x1c')](_0x167599);}return null;};}function patchUpdates(_0x24c663){return function(_0x19c0c6){try{jsonpatch['apply'](_0x19c0c6,_0x24c663,!![]);}catch(_0x544d20){return BPromise['reject'](_0x544d20);}return _0x19c0c6[_0x923b('0x22')]();};}function saveUpdates(_0x2192e2,_0x1627ea){return function(_0x236e5f){if(_0x236e5f){return _0x236e5f[_0x923b('0x23')](_0x2192e2)[_0x923b('0x24')](function(_0x44d647){return _0x44d647;});}return null;};}function removeEntity(_0x21e04a,_0x2916b8){return function(_0x141201){if(_0x141201){return _0x141201[_0x923b('0x25')]()[_0x923b('0x24')](function(){_0x21e04a[_0x923b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48436d,_0x3e8331){return function(_0xdda7b){if(!_0xdda7b){_0x48436d[_0x923b('0x1a')](0x194);}return _0xdda7b;};}function handleError(_0x10507b,_0x55a137){_0x55a137=_0x55a137||0x1f4;return function(_0x2b98b6){logger['error'](_0x2b98b6[_0x923b('0x26')]);if(_0x2b98b6[_0x923b('0x27')]){delete _0x2b98b6[_0x923b('0x27')];}_0x10507b['status'](_0x55a137)[_0x923b('0x28')](_0x2b98b6);};}exports[_0x923b('0x29')]=function(_0x46e524,_0x2c07c2){var _0x2f5127={},_0x22d2de={},_0x20896e={'count':0x0,'rows':[]};var _0x828239=_[_0x923b('0x2a')](db[_0x923b('0x2b')]['rawAttributes'],function(_0x1be071){return{'name':_0x1be071[_0x923b('0x2c')],'type':_0x1be071[_0x923b('0x2d')][_0x923b('0x2e')]};});_0x22d2de['model']=_['map'](_0x828239,_0x923b('0x27'));_0x22d2de[_0x923b('0x2f')]=_[_0x923b('0x30')](_0x46e524[_0x923b('0x2f')]);_0x22d2de[_0x923b('0x31')]=_[_0x923b('0x32')](_0x22d2de[_0x923b('0x33')],_0x22d2de['query']);_0x2f5127[_0x923b('0x34')]=_[_0x923b('0x32')](_0x22d2de[_0x923b('0x33')],qs[_0x923b('0x35')](_0x46e524[_0x923b('0x2f')][_0x923b('0x35')]));_0x2f5127[_0x923b('0x34')]=_0x2f5127[_0x923b('0x34')][_0x923b('0x36')]?_0x2f5127[_0x923b('0x34')]:_0x22d2de[_0x923b('0x33')];if(!_0x46e524[_0x923b('0x2f')][_0x923b('0x37')](_0x923b('0x38'))){_0x2f5127['limit']=qs[_0x923b('0x20')](_0x46e524[_0x923b('0x2f')][_0x923b('0x20')]);_0x2f5127['offset']=qs[_0x923b('0x1f')](_0x46e524['query']['offset']);}_0x2f5127[_0x923b('0x39')]=qs[_0x923b('0x3a')](_0x46e524[_0x923b('0x2f')]['sort']);_0x2f5127[_0x923b('0x3b')]=qs[_0x923b('0x31')](_[_0x923b('0x3c')](_0x46e524[_0x923b('0x2f')],_0x22d2de[_0x923b('0x31')]),_0x828239);if(_0x46e524[_0x923b('0x2f')][_0x923b('0x3d')]){_0x2f5127[_0x923b('0x3b')]=_[_0x923b('0x3e')](_0x2f5127['where'],{'$or':_['map'](_0x828239,function(_0x2f3ae3){if(_0x2f3ae3[_0x923b('0x2d')]!==_0x923b('0x3f')){var _0xf5680f={};_0xf5680f[_0x2f3ae3[_0x923b('0x27')]]={'$like':'%'+_0x46e524[_0x923b('0x2f')][_0x923b('0x3d')]+'%'};return _0xf5680f;}})});}_0x2f5127=_[_0x923b('0x3e')]({},_0x2f5127,_0x46e524[_0x923b('0x40')]);var _0x30caa2={'where':_0x2f5127[_0x923b('0x3b')]};return db['SmsApplication']['count'](_0x30caa2)[_0x923b('0x24')](function(_0x18c38c){_0x20896e[_0x923b('0x1e')]=_0x18c38c;if(_0x46e524[_0x923b('0x2f')][_0x923b('0x41')]){_0x2f5127['include']=[{'all':!![]}];}return db[_0x923b('0x2b')][_0x923b('0x42')](_0x2f5127);})[_0x923b('0x24')](function(_0x68d690){_0x20896e[_0x923b('0x43')]=_0x68d690;return _0x20896e;})[_0x923b('0x24')](respondWithFilteredResult(_0x2c07c2,_0x2f5127))[_0x923b('0x44')](handleError(_0x2c07c2,null));};exports[_0x923b('0x45')]=function(_0x45f10a,_0x15441b){var _0x5af9be={'raw':!![],'where':{'id':_0x45f10a['params']['id']}},_0x4c064b={};_0x4c064b[_0x923b('0x33')]=_[_0x923b('0x30')](db[_0x923b('0x2b')][_0x923b('0x46')]);_0x4c064b['query']=_[_0x923b('0x30')](_0x45f10a[_0x923b('0x2f')]);_0x4c064b['filters']=_[_0x923b('0x32')](_0x4c064b[_0x923b('0x33')],_0x4c064b[_0x923b('0x2f')]);_0x5af9be[_0x923b('0x34')]=_[_0x923b('0x32')](_0x4c064b['model'],qs[_0x923b('0x35')](_0x45f10a[_0x923b('0x2f')][_0x923b('0x35')]));_0x5af9be['attributes']=_0x5af9be[_0x923b('0x34')][_0x923b('0x36')]?_0x5af9be['attributes']:_0x4c064b[_0x923b('0x33')];if(_0x45f10a['query'][_0x923b('0x41')]){_0x5af9be[_0x923b('0x47')]=[{'all':!![]}];}_0x5af9be=_[_0x923b('0x3e')]({},_0x5af9be,_0x45f10a[_0x923b('0x40')]);return db[_0x923b('0x2b')][_0x923b('0x48')](_0x5af9be)[_0x923b('0x24')](handleEntityNotFound(_0x15441b,null))['then'](respondWithResult(_0x15441b,null))['catch'](handleError(_0x15441b,null));};exports[_0x923b('0x49')]=function(_0x33c3a6,_0x4fa8ed){return db[_0x923b('0x2b')]['create'](_0x33c3a6[_0x923b('0x4a')],{})[_0x923b('0x24')](respondWithResult(_0x4fa8ed,0xc9))[_0x923b('0x44')](handleError(_0x4fa8ed,null));};exports[_0x923b('0x23')]=function(_0xb1307a,_0x23b975){if(_0xb1307a['body']['id']){delete _0xb1307a[_0x923b('0x4a')]['id'];}return db[_0x923b('0x2b')][_0x923b('0x48')]({'where':{'id':_0xb1307a[_0x923b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x23b975,null))[_0x923b('0x24')](saveUpdates(_0xb1307a[_0x923b('0x4a')],null))[_0x923b('0x24')](respondWithResult(_0x23b975,null))[_0x923b('0x44')](handleError(_0x23b975,null));};exports[_0x923b('0x25')]=function(_0x3fc2ab,_0x4c1aa4){return db[_0x923b('0x2b')][_0x923b('0x48')]({'where':{'id':_0x3fc2ab[_0x923b('0x4b')]['id']}})[_0x923b('0x24')](handleEntityNotFound(_0x4c1aa4,null))[_0x923b('0x24')](removeEntity(_0x4c1aa4,null))[_0x923b('0x44')](handleError(_0x4c1aa4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 932bdf4..62266a0 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 _0x0efc=['../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c4a9b,_0x25deeb){var _0x5235b2=function(_0x4a877c){while(--_0x4a877c){_0x3c4a9b['push'](_0x3c4a9b['shift']());}};_0x5235b2(++_0x25deeb);}(_0x0efc,0x1b2));var _0xc0ef=function(_0x409de6,_0x5479fb){_0x409de6=_0x409de6-0x0;var _0x5d5215=_0x0efc[_0x409de6];return _0x5d5215;};'use strict';var _=require(_0xc0ef('0x0'));var util=require(_0xc0ef('0x1'));var logger=require('../../config/logger')(_0xc0ef('0x2'));var moment=require(_0xc0ef('0x3'));var BPromise=require(_0xc0ef('0x4'));var rp=require(_0xc0ef('0x5'));var fs=require('fs');var path=require(_0xc0ef('0x6'));var rimraf=require(_0xc0ef('0x7'));var config=require(_0xc0ef('0x8'));var attributes=require(_0xc0ef('0x9'));module['exports']=function(_0x1b7dfd,_0x207b7d){return _0x1b7dfd['define'](_0xc0ef('0xa'),attributes,{'tableName':_0xc0ef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0ef('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcda9=['moment','bluebird','request-promise','./smsApplication.attributes','exports','SmsApplication','utf8mb4_unicode_ci','util','api'];(function(_0x2eff99,_0x18185f){var _0x36b35a=function(_0x566cd5){while(--_0x566cd5){_0x2eff99['push'](_0x2eff99['shift']());}};_0x36b35a(++_0x18185f);}(_0xcda9,0xb2));var _0x9cda=function(_0x252280,_0x914300){_0x252280=_0x252280-0x0;var _0x260419=_0xcda9[_0x252280];return _0x260419;};'use strict';var _=require('lodash');var util=require(_0x9cda('0x0'));var logger=require('../../config/logger')(_0x9cda('0x1'));var moment=require(_0x9cda('0x2'));var BPromise=require(_0x9cda('0x3'));var rp=require(_0x9cda('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9cda('0x5'));module[_0x9cda('0x6')]=function(_0x54f897,_0x4f8332){return _0x54f897['define'](_0x9cda('0x7'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9cda('0x8')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index aa1c124..3a7c5b3 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 _0x186d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x186d,0x1ca));var _0xd186=function(_0x24b773,_0x392c26){_0x24b773=_0x24b773-0x0;var _0x35f6c9=_0x186d[_0x24b773];return _0x35f6c9;};'use strict';var _=require('lodash');var util=require(_0xd186('0x0'));var moment=require(_0xd186('0x1'));var BPromise=require(_0xd186('0x2'));var rs=require(_0xd186('0x3'));var fs=require('fs');var Redis=require(_0xd186('0x4'));var db=require(_0xd186('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd186('0x6'))(_0xd186('0x7'));var config=require(_0xd186('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd186('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x60fc96,_0x2ecccd,_0x4970a3){return new BPromise(function(_0x36fdc3,_0xd76bc8){return client[_0xd186('0xa')](_0x60fc96,_0x4970a3)['then'](function(_0x1ef64a){logger[_0xd186('0xb')](_0xd186('0xc'),_0x2ecccd,_0xd186('0xd'));logger[_0xd186('0xe')](_0xd186('0xf'),_0x2ecccd,'request\x20sent',JSON['stringify'](_0x1ef64a));if(_0x1ef64a[_0xd186('0x10')]){if(_0x1ef64a['error'][_0xd186('0x11')]===0x1f4){logger[_0xd186('0x10')](_0xd186('0xc'),_0x2ecccd,_0x1ef64a['error'][_0xd186('0x12')]);return _0xd76bc8(_0x1ef64a['error'][_0xd186('0x12')]);}logger[_0xd186('0x10')](_0xd186('0xc'),_0x2ecccd,_0x1ef64a[_0xd186('0x10')][_0xd186('0x12')]);return _0x36fdc3(_0x1ef64a[_0xd186('0x10')][_0xd186('0x12')]);}else{logger[_0xd186('0xb')](_0xd186('0xc'),_0x2ecccd,_0xd186('0xd'));_0x36fdc3(_0x1ef64a[_0xd186('0x13')]['message']);}})[_0xd186('0x14')](function(_0x94b224){logger[_0xd186('0x10')](_0xd186('0xc'),_0x2ecccd,_0x94b224);_0xd76bc8(_0x94b224);});});} \ No newline at end of file +var _0xf7d9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x379c9b,_0x2972bc){var _0x3879df=function(_0x4e9703){while(--_0x4e9703){_0x379c9b['push'](_0x379c9b['shift']());}};_0x3879df(++_0x2972bc);}(_0xf7d9,0x122));var _0x9f7d=function(_0x723d58,_0x34bdce){_0x723d58=_0x723d58-0x0;var _0x12b23d=_0xf7d9[_0x723d58];return _0x12b23d;};'use strict';var _=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var moment=require(_0x9f7d('0x2'));var BPromise=require(_0x9f7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))(_0x9f7d('0x6'));var config=require(_0x9f7d('0x7'));var jayson=require(_0x9f7d('0x8'));var client=jayson[_0x9f7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc6b9,_0xf09259,_0x2333e8){return new BPromise(function(_0x218628,_0x2893a5){return client[_0x9f7d('0xa')](_0x4dc6b9,_0x2333e8)[_0x9f7d('0xb')](function(_0x5290e2){logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,'request\x20sent');logger[_0x9f7d('0xe')](_0x9f7d('0xf'),_0xf09259,_0x9f7d('0x10'),JSON['stringify'](_0x5290e2));if(_0x5290e2[_0x9f7d('0x11')]){if(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x12')]===0x1f4){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2[_0x9f7d('0x11')]['message']);return _0x2893a5(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2['error'][_0x9f7d('0x13')]);return _0x218628(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}else{logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,_0x9f7d('0x10'));_0x218628(_0x5290e2[_0x9f7d('0x14')]['message']);}})['catch'](function(_0x402609){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x402609);_0x2893a5(_0x402609);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 0b1d08a..63a0983 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 _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x217594,_0x312457){var _0xdf7167=function(_0x223b88){while(--_0x223b88){_0x217594['push'](_0x217594['shift']());}};_0xdf7167(++_0x312457);}(_0xea28,0x13a));var _0x8ea2=function(_0x514cb0,_0x5b666f){_0x514cb0=_0x514cb0-0x0;var _0x8dd265=_0xea28[_0x514cb0];return _0x8dd265;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xda3f,0xec));var _0xfda3=function(_0x73d744,_0x374f23){_0x73d744=_0x73d744-0x0;var _0x4e3572=_0xda3f[_0x73d744];return _0x4e3572;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9bd4100..8ea0a13 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 _0x2070=['DATE','STRING','out','exports','BOOLEAN'];(function(_0x43bf13,_0x2267d6){var _0x251a26=function(_0x5f3e61){while(--_0x5f3e61){_0x43bf13['push'](_0x43bf13['shift']());}};_0x251a26(++_0x2267d6);}(_0x2070,0x1a2));var _0x0207=function(_0x23fdc7,_0x2c4df2){_0x23fdc7=_0x23fdc7-0x0;var _0x3e1719=_0x2070[_0x23fdc7];return _0x3e1719;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0207('0x0')]={'closed':{'type':Sequelize[_0x0207('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0207('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0207('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0207('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0207('0x3')]},'read1stAt':{'type':Sequelize[_0x0207('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x0207('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0207('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0207('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x4672=['out','ENUM','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x16f9a3,_0x545400){var _0x1cd183=function(_0x293481){while(--_0x293481){_0x16f9a3['push'](_0x16f9a3['shift']());}};_0x1cd183(++_0x545400);}(_0x4672,0x18a));var _0x2467=function(_0x3a968c,_0x2cb691){_0x3a968c=_0x3a968c-0x0;var _0x1acf4a=_0x4672[_0x3a968c];return _0x1acf4a;};'use strict';var Sequelize=require(_0x2467('0x0'));var moment=require('moment');module[_0x2467('0x1')]={'closed':{'type':Sequelize[_0x2467('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2467('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2467('0x3')]},'note':{'type':Sequelize[_0x2467('0x3')]},'phone':{'type':Sequelize[_0x2467('0x3')]},'read1stAt':{'type':Sequelize[_0x2467('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2467('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2467('0x6')]('in',_0x2467('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2467('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 17a2e8a..77dbc3f 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 _0x19bd=['fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','field','color','from','select','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','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?','find','ContactId','buildExpression','type','text','start','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','SmsInteraction','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','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.internal','groupBy','SmsInteractionId','all','rows','params','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','filter','$gte','findAll','addTags','setTags','Tag','emit','smsInteractionTags:save','removeTags','unix','join','root','files','server','attachments','transcript-%d-%s.zip','fullname','firstName','direction','SmsAccount','Owner','get','mkdirSync','Sms','Account','format','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','lastName','secret','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir'];(function(_0x38ad4e,_0x3a75e1){var _0x315384=function(_0x3c1163){while(--_0x3c1163){_0x38ad4e['push'](_0x38ad4e['shift']());}};_0x315384(++_0x3a75e1);}(_0x19bd,0xe4));var _0xd19b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x19bd[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd19b('0x0'));var zipdir=require(_0xd19b('0x1'));var jsonpatch=require(_0xd19b('0x2'));var rp=require(_0xd19b('0x3'));var moment=require('moment');var BPromise=require(_0xd19b('0x4'));var Mustache=require(_0xd19b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd19b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd19b('0x7'));var _=require('lodash');var squel=require(_0xd19b('0x8'));var crypto=require(_0xd19b('0x9'));var jsforce=require(_0xd19b('0xa'));var deskjs=require(_0xd19b('0xb'));var toCsv=require(_0xd19b('0xc'));var querystring=require(_0xd19b('0xd'));var Papa=require('papaparse');var Redis=require(_0xd19b('0xe'));var authService=require(_0xd19b('0xf'));var qs=require(_0xd19b('0x10'));var as=require(_0xd19b('0x11'));var pdf=require(_0xd19b('0x12'));var hardwareService=require(_0xd19b('0x13'));var logger=require('../../config/logger')(_0xd19b('0x14'));var utils=require('../../config/utils');var config=require(_0xd19b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd19b('0x16'))['db'];config[_0xd19b('0x17')]=_[_0xd19b('0x18')](config[_0xd19b('0x17')],{'host':_0xd19b('0x19'),'port':0x18eb});var socket=require(_0xd19b('0x1a'))(new Redis(config[_0xd19b('0x17')]));require(_0xd19b('0x1b'))['register'](socket);function respondWithStatusCode(_0x5ae850,_0x327359){_0x327359=_0x327359||0xcc;return function(_0x87b903){if(_0x87b903){return _0x5ae850['sendStatus'](_0x327359);}return _0x5ae850['status'](_0x327359)[_0xd19b('0x1c')]();};}function respondWithResult(_0xd79d4a,_0x2c1dd6){_0x2c1dd6=_0x2c1dd6||0xc8;return function(_0x466016){if(_0x466016){return _0xd79d4a[_0xd19b('0x1d')](_0x2c1dd6)[_0xd19b('0x1e')](_0x466016);}};}function respondWithFilteredResult(_0x594260,_0x425c13){return function(_0x31d0f3){if(_0x31d0f3){var _0x3c74f0=typeof _0x425c13['offset']===_0xd19b('0x1f')&&typeof _0x425c13[_0xd19b('0x20')]==='undefined';var _0x24f7be=_0x31d0f3[_0xd19b('0x21')];var _0x15adea=_0x3c74f0?0x0:_0x425c13[_0xd19b('0x22')];var _0x85d882=_0x3c74f0?_0x31d0f3[_0xd19b('0x21')]:_0x425c13[_0xd19b('0x22')]+_0x425c13[_0xd19b('0x20')];var _0x1d95fe;if(_0x85d882>=_0x24f7be){_0x85d882=_0x24f7be;_0x1d95fe=0xc8;}else{_0x1d95fe=0xce;}_0x594260[_0xd19b('0x1d')](_0x1d95fe);return _0x594260[_0xd19b('0x23')](_0xd19b('0x24'),_0x15adea+'-'+_0x85d882+'/'+_0x24f7be)[_0xd19b('0x1e')](_0x31d0f3);}return null;};}function patchUpdates(_0x1f9fd8){return function(_0xb25f86){try{jsonpatch[_0xd19b('0x25')](_0xb25f86,_0x1f9fd8,!![]);}catch(_0x19a698){return BPromise[_0xd19b('0x26')](_0x19a698);}return _0xb25f86[_0xd19b('0x27')]();};}function saveUpdates(_0x5a2f18,_0x16ccff){return function(_0x3388fe){if(_0x3388fe){return _0x3388fe[_0xd19b('0x28')](_0x5a2f18)['then'](function(_0x3ef439){return _0x3ef439;});}return null;};}function removeEntity(_0x52a109,_0x5d79b7){return function(_0x2ac9bb){if(_0x2ac9bb){return _0x2ac9bb[_0xd19b('0x29')]()[_0xd19b('0x2a')](function(){_0x52a109[_0xd19b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0f870,_0x4173ae){return function(_0x3173f0){if(!_0x3173f0){_0xa0f870[_0xd19b('0x2b')](0x194);}return _0x3173f0;};}function handleError(_0x4e9946,_0x301e99){_0x301e99=_0x301e99||0x1f4;return function(_0xd478b5){logger['error'](_0xd478b5[_0xd19b('0x2c')]);if(_0xd478b5[_0xd19b('0x2d')]){delete _0xd478b5['name'];}_0x4e9946['status'](_0x301e99)[_0xd19b('0x2e')](_0xd478b5);};}function getInteractionUsers(_0x516e14,_0x434acc){return new BPromise(function(_0x2d6ceb,_0xe7a7ad){try{if(_0x434acc[_0x516e14['id']]){_0x516e14[_0xd19b('0x2f')]=_[_0xd19b('0x30')](_0x434acc[_0x516e14['id']],function(_0x5933cb){return{'id':_0x5933cb['id'],'fullname':_0x5933cb['fullname']};});}}catch(_0x47dbb7){_0xe7a7ad(_0x47dbb7);}_0x2d6ceb(_0x516e14);});}function getInteractionTags(_0x588b4d,_0x3440b4){return new BPromise(function(_0x27df23,_0x4e8daf){try{if(_0x588b4d[_0xd19b('0x31')]){_0x588b4d[_0xd19b('0x32')]=[];_0x588b4d['TagIds'][_0xd19b('0x33')](',')[_0xd19b('0x34')](function(_0x30f5d1){_0x588b4d[_0xd19b('0x32')][_0xd19b('0x35')](_0x3440b4[_0x30f5d1]);});}delete _0x588b4d[_0xd19b('0x31')];}catch(_0xa9f18b){_0x4e8daf(_0xa9f18b);}_0x27df23(_0x588b4d);});}function updateSmsInteraction(_0x19295b,_0x28798c,_0x553ccf){return new BPromise(function(_0x588b79,_0x200eff){return getInteractionUsers(_0x19295b,_0x553ccf)['then'](function(_0x2a52c4){return getInteractionTags(_0x2a52c4,_0x28798c);})[_0xd19b('0x2a')](function(_0x1772c8){_0x588b79(_0x1772c8);})[_0xd19b('0x36')](function(_0x482fea){_0x200eff(_0x482fea);});});}exports[_0xd19b('0x37')]=function(_0x26e693,_0x4d131b){var _0x5d92d4={},_0x16996d={},_0x526e93={'count':0x0,'rows':[]};var _0x58268d=_['map'](db['SmsInteraction'][_0xd19b('0x38')],function(_0x59a57a){return{'name':_0x59a57a[_0xd19b('0x39')],'type':_0x59a57a['type'][_0xd19b('0x3a')]};});_0x16996d['model']=_[_0xd19b('0x30')](_0x58268d,_0xd19b('0x2d'));_0x16996d[_0xd19b('0x3b')]=_[_0xd19b('0x3c')](_0x26e693[_0xd19b('0x3b')]);_0x16996d['filters']=_['intersection'](_0x16996d[_0xd19b('0x3d')],_0x16996d[_0xd19b('0x3b')]);_0x5d92d4[_0xd19b('0x3e')]=_[_0xd19b('0x3f')](_0x16996d[_0xd19b('0x3d')],qs[_0xd19b('0x40')](_0x26e693[_0xd19b('0x3b')][_0xd19b('0x40')]));_0x5d92d4[_0xd19b('0x3e')]=_0x5d92d4[_0xd19b('0x3e')][_0xd19b('0x41')]?_0x5d92d4['attributes']:_0x16996d['model'];if(!_0x26e693[_0xd19b('0x3b')][_0xd19b('0x42')](_0xd19b('0x43'))){_0x5d92d4[_0xd19b('0x20')]=qs[_0xd19b('0x20')](_0x26e693[_0xd19b('0x3b')][_0xd19b('0x20')]);_0x5d92d4[_0xd19b('0x22')]=qs[_0xd19b('0x22')](_0x26e693['query'][_0xd19b('0x22')]);}_0x5d92d4[_0xd19b('0x44')]=qs[_0xd19b('0x45')](_0x26e693['query'][_0xd19b('0x45')]);_0x5d92d4[_0xd19b('0x46')]=qs[_0xd19b('0x47')](_['pick'](_0x26e693[_0xd19b('0x3b')],_0x16996d[_0xd19b('0x47')]),_0x58268d);var _0x25c75d=[];var _0x4ca011=squel['select']()[_0xd19b('0x48')]('id')[_0xd19b('0x48')](_0xd19b('0x2d'))[_0xd19b('0x48')](_0xd19b('0x49'))[_0xd19b('0x4a')]('tools_tags');var _0x459255=squel[_0xd19b('0x4b')]()[_0xd19b('0x48')]('u.id')[_0xd19b('0x48')]('u.fullname')[_0xd19b('0x48')](_0xd19b('0x4c'))[_0xd19b('0x4a')](_0xd19b('0x4d'),'ui')[_0xd19b('0x4e')](_0xd19b('0x4f'),'u',_0xd19b('0x50'));var _0xfdc8ef=squel[_0xd19b('0x4b')]()[_0xd19b('0x4a')](_0xd19b('0x51'),'i')[_0xd19b('0x4e')](_0xd19b('0x52'),'c',_0xd19b('0x53'))[_0xd19b('0x4e')](_0xd19b('0x4f'),'o',_0xd19b('0x54'))[_0xd19b('0x4e')](_0xd19b('0x55'),'a',_0xd19b('0x56'))[_0xd19b('0x4e')](_0xd19b('0x57'),'me',_0xd19b('0x58'))[_0xd19b('0x4e')](_0xd19b('0x59'),'it',_0xd19b('0x5a'))[_0xd19b('0x4e')](_0xd19b('0x5b'),'t',_0xd19b('0x5c'));var _0x493988=squel[_0xd19b('0x5d')]();var _0x2c6da5=[];var _0x15aa73=squel[_0xd19b('0x5d')]();var _0xf10b72;if(_0x26e693[_0xd19b('0x3b')]['search']){_0xf10b72=as['parseSearch'](_0x26e693[_0xd19b('0x3b')][_0xd19b('0x5e')]);var _0x40ace6=_0xf10b72[_0xd19b('0x5f')];for(var _0x1fcbc1=0x0;_0x1fcbc1<_0xf10b72[_0xd19b('0x60')][_0xd19b('0x41')];_0x1fcbc1++){var _0x182a90=_0xf10b72[_0xd19b('0x60')][_0x1fcbc1];var _0x20165e='i';var _0x14e646=_['find'](_0x58268d,['name',_0x182a90[_0xd19b('0x48')]]);if(!_0x14e646){switch(_0x182a90[_0xd19b('0x48')]){case _0xd19b('0x61'):if(_0x182a90[_0xd19b('0x62')]==0x1){_0xfdc8ef[_0xd19b('0x63')]('`'+_0x182a90[_0xd19b('0x48')]+_0xd19b('0x64'));}else{_0xfdc8ef[_0xd19b('0x63')]('`'+_0x182a90[_0xd19b('0x48')]+_0xd19b('0x65'));}break;case _0xd19b('0x66'):if(_0x182a90[_0xd19b('0x67')]==='$substring'){if(_0x182a90[_0xd19b('0x62')]['split']('\x20')[_0xd19b('0x41')]>0x1){_0x493988[_0x40ace6](_0xd19b('0x68'),qs[_0xd19b('0x69')](_0x182a90[_0xd19b('0x62')]),null);}else{var _0x50d1af='%'+_0x182a90[_0xd19b('0x62')]+'%';_0x493988[_0x40ace6](_0xd19b('0x6a'),_0x50d1af,_0x50d1af,_0x50d1af);}}else{_0x14e646=_[_0xd19b('0x6b')](_0x58268d,[_0xd19b('0x2d'),_0xd19b('0x6c')]);_0x182a90[_0xd19b('0x48')]='ContactId';_0x3a0c67=as[_0xd19b('0x6d')](_0x20165e,_0x14e646[_0xd19b('0x6e')],_0x182a90);_0x493988[_0x40ace6](_0x3a0c67[_0xd19b('0x6f')],_0x3a0c67['value'][_0xd19b('0x70')],_0x3a0c67[_0xd19b('0x62')][_0xd19b('0x1c')]);}break;case'Tag':var _0x4e9d23=_0x182a90['value'][_0xd19b('0x33')](',')[_0xd19b('0x30')](function(_0x180e08){return Number(_0x180e08);});_0x4e9d23[_0xd19b('0x34')](function(_0x325a52){_0x15aa73['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x325a52+',%');});_0x2c6da5=_[_0xd19b('0x71')](_0x2c6da5,_0x4e9d23);break;case _0xd19b('0x72'):if(_0x182a90[_0xd19b('0x67')]===_0xd19b('0x73')){_0x493988[_0x40ace6](_0xd19b('0x74'),'%'+_0x182a90['value']+'%',null);}else{_0x14e646=_[_0xd19b('0x6b')](_0x58268d,['name',_0xd19b('0x75')]);_0x182a90[_0xd19b('0x48')]=_0xd19b('0x75');_0x3a0c67=as[_0xd19b('0x6d')](_0x20165e,_0x14e646['type'],_0x182a90);_0x493988[_0x40ace6](_0x3a0c67[_0xd19b('0x6f')],_0x3a0c67['value']['start'],_0x3a0c67[_0xd19b('0x62')][_0xd19b('0x1c')]);}break;case'body':_0x3a0c67=as[_0xd19b('0x6d')]('me',null,_0x182a90);_0x493988[_0x40ace6](_0x3a0c67[_0xd19b('0x6f')],_0x3a0c67[_0xd19b('0x62')][_0xd19b('0x70')],_0x3a0c67[_0xd19b('0x62')][_0xd19b('0x1c')]);break;}}else{var _0x3a0c67=as['buildExpression'](_0x20165e,_0x14e646[_0xd19b('0x6e')],_0x182a90);_0x493988[_0x40ace6](_0x3a0c67[_0xd19b('0x6f')],_0x3a0c67[_0xd19b('0x62')][_0xd19b('0x70')],_0x3a0c67[_0xd19b('0x62')][_0xd19b('0x1c')]);}}}else{var _0x58df7e=_(_0x26e693['query'])[_0xd19b('0x3c')]()['map'](function(_0x43fcec){return _[_0xd19b('0x76')](_0x58268d,[_0xd19b('0x2d'),_0x43fcec])?_0x43fcec:undefined;})[_0xd19b('0x77')]()[_0xd19b('0x62')]();if(!_[_0xd19b('0x78')](_0x58df7e)){_0x58df7e[_0xd19b('0x34')](function(_0x39bda7){if(_0x39bda7===_0xd19b('0x79')){_0xfdc8ef[_0xd19b('0x46')](_0xd19b('0x7a'),[][_0xd19b('0x7b')](_0x26e693['query'][_0x39bda7]));}else if(_0x39bda7===_0xd19b('0x7c')){var _0x356778=JSON['parse'](_0x26e693[_0xd19b('0x3b')][_0x39bda7])['$gte'];var _0x17cea0=JSON[_0xd19b('0x7d')](_0x26e693[_0xd19b('0x3b')][_0x39bda7])[_0xd19b('0x7e')];_0xfdc8ef[_0xd19b('0x46')](_0xd19b('0x7f'),_0x356778,_0x17cea0);}else{if(_0x26e693[_0xd19b('0x3b')][_0x39bda7]==='null'){_0xfdc8ef['where']('i.'+_0x39bda7+_0xd19b('0x80'));}else{_0xfdc8ef[_0xd19b('0x46')]('i.'+_0x39bda7+_0xd19b('0x81'),_0x26e693[_0xd19b('0x3b')][_0x39bda7]);}}});}if(_0x26e693['query'][_0xd19b('0x82')]){if(_0x26e693[_0xd19b('0x3b')][_0xd19b('0x82')]==0x1){_0xfdc8ef[_0xd19b('0x63')]('`unreadMessages`\x20=\x200');}else{_0xfdc8ef[_0xd19b('0x63')]('`unreadMessages`\x20>\x200');}}if(_0x26e693[_0xd19b('0x3b')][_0xd19b('0x83')]){_0x2c6da5=_['isArray'](_0x26e693['query'][_0xd19b('0x83')])?_0x26e693[_0xd19b('0x3b')]['tag']:new Array(_0x26e693[_0xd19b('0x3b')][_0xd19b('0x83')]);_0x2c6da5[_0xd19b('0x34')](function(_0x5734e3){_0x15aa73['or'](_0xd19b('0x84'),'%,'+_0x5734e3+',%');});}if(_0x26e693['query']['filter']){var _0x5ed12f=_0x26e693['query']['filter'][_0xd19b('0x85')]('\x5c','\x5c\x5c')[_0xd19b('0x85')](/'/g,'\x27\x27');if(qs[_0xd19b('0x86')](_0x5ed12f)){_0x493988['or'](_0xd19b('0x87'),_0x5ed12f+'%')['or'](_0xd19b('0x88'),_0x5ed12f+'%');}else{_0x493988['or'](_0xd19b('0x89'),qs[_0xd19b('0x69')](_0x5ed12f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5ed12f+'%');}}}_0xfdc8ef[_0xd19b('0x46')](_0x493988);_0xfdc8ef[_0xd19b('0x8a')](_0xd19b('0x8b'));var _0x252cd7={'type':db['Sequelize'][_0xd19b('0x8c')][_0xd19b('0x8d')],'raw':!![]};var _0x250d96=_0xfdc8ef[_0xd19b('0x8e')]();_0x250d96[_0xd19b('0x48')](_0xd19b('0x8b'));_0x250d96['field'](_0xd19b('0x8f'),_0xd19b('0x61'));if(_0x5d92d4[_0xd19b('0x44')]){_0x5d92d4['order']['forEach'](function(_0x140326){var _0x8ea824=_0x140326[0x0]===_0xd19b('0x90')?_0x140326[0x0]:'i.'+_0x140326[0x0];_0xfdc8ef[_0xd19b('0x44')](_0x8ea824,_0x140326[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd19b('0x78')](_0x2c6da5)){_0xfdc8ef[_0xd19b('0x63')](_0x15aa73);_0x250d96[_0xd19b('0x46')]('t.id\x20IN\x20?',_0x2c6da5);}BPromise[_0xd19b('0x91')]()[_0xd19b('0x2a')](function(){if(!_0xf10b72){if(_0x26e693[_0xd19b('0x3b')][_0xd19b('0x79')])return;_0x250d96[_0xd19b('0x46')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0xfdc8ef[_0xd19b('0x46')](_0xd19b('0x92'));return;}if(_0x26e693[_0xd19b('0x93')][_0xd19b('0x94')]!==_0xd19b('0x95'))return;return _0x26e693['user'][_0xd19b('0x96')]({'attributes':['id'],'raw':!![]})[_0xd19b('0x2a')](function(_0x40f14c){if(_['isEmpty'](_0x40f14c)){_0x250d96[_0xd19b('0x46')](_0xd19b('0x97'));_0xfdc8ef[_0xd19b('0x46')](_0xd19b('0x97'));}else{_0x250d96[_0xd19b('0x46')]('i.SmsAccountId\x20IN\x20?',_[_0xd19b('0x30')](_0x40f14c,'id'));_0xfdc8ef[_0xd19b('0x46')](_0xd19b('0x7a'),_['map'](_0x40f14c,'id'));}});})[_0xd19b('0x2a')](function(){if(_0x26e693[_0xd19b('0x93')][_0xd19b('0x94')]===_0xd19b('0x95')&&!_0xf10b72&&!_0x26e693[_0xd19b('0x3b')][_0xd19b('0x79')])return[];return db[_0xd19b('0x98')][_0xd19b('0x3b')](_0x250d96[_0xd19b('0x99')](),_0x252cd7);})[_0xd19b('0x2a')](function(_0x566eef){_0x526e93[_0xd19b('0x21')]=_0x566eef[_0xd19b('0x41')];if(_0x526e93['count']===0x0)return[];return db[_0xd19b('0x98')][_0xd19b('0x3b')](_0x4ca011[_0xd19b('0x99')](),_0x252cd7)['then'](function(_0x248dd5){_0x25c75d=_['keyBy'](_0x248dd5,'id');_0x252cd7=_[_0xd19b('0x9a')](_0x252cd7,{'model':db[_0xd19b('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x26e693[_0xd19b('0x3b')][_0xd19b('0x40')]){_0x5d92d4[_0xd19b('0x3e')][_0xd19b('0x34')](function(_0x1fb0c5){_0xfdc8ef[_0xd19b('0x48')]('i.'+_0x1fb0c5);});}else{_0xfdc8ef['field'](_0xd19b('0x8f'),_0xd19b('0x61'));_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0x9c'),_0xd19b('0x9d'));_0xfdc8ef[_0xd19b('0x48')]('a.mandatoryDisposition',_0xd19b('0x9e'));_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0x9f'),'contactName');_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0xa0'));_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0xa1'),'Contact.firstName');_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0xa2'),_0xd19b('0xa3'));_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0xa4'),_0xd19b('0xa5'));_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0xa6'),_0xd19b('0xa7'));_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0xa8'),_0xd19b('0xa9'));_0xfdc8ef[_0xd19b('0x48')](_0xd19b('0xaa'),_0xd19b('0xab'));_0xfdc8ef[_0xd19b('0x48')]('o.fullname','Owner.fullname');_0xfdc8ef[_0xd19b('0x48')]('o.internal',_0xd19b('0xac'));_0xfdc8ef[_0xd19b('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd19b('0x31'));}if(_0x5d92d4['limit'])_0xfdc8ef[_0xd19b('0x20')](_0x5d92d4['limit']);if(_0x5d92d4[_0xd19b('0x22')])_0xfdc8ef[_0xd19b('0x22')](_0x5d92d4[_0xd19b('0x22')]);return db[_0xd19b('0x98')][_0xd19b('0x3b')](_0xfdc8ef['toString'](),_0x252cd7);})[_0xd19b('0x2a')](function(_0x4cbc5b){if(_0x4cbc5b['length']>0x0)_0x459255['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xd19b('0x30')](_0x4cbc5b,'id'));return db[_0xd19b('0x98')][_0xd19b('0x3b')](_0x459255[_0xd19b('0x99')](),_0x252cd7)['then'](function(_0x4c69af){var _0x311958=_[_0xd19b('0xad')](_0x4c69af,_0xd19b('0xae'));var _0x289590=[];_0x4cbc5b[_0xd19b('0x34')](function(_0x20d4dd){_0x289590['push'](updateSmsInteraction(_0x20d4dd,_0x25c75d,_0x311958));});return BPromise[_0xd19b('0xaf')](_0x289590);});});})[_0xd19b('0x2a')](function(_0x4aa2ca){_0x526e93[_0xd19b('0xb0')]=_0x4aa2ca;return _0x526e93;})[_0xd19b('0x2a')](respondWithFilteredResult(_0x4d131b,_0x5d92d4))[_0xd19b('0x36')](handleError(_0x4d131b,null));};exports['show']=function(_0x1807cf,_0x3839c3){var _0x3d1c7b={'raw':![],'where':{'id':_0x1807cf[_0xd19b('0xb1')]['id']}},_0x5cd0b5={};_0x5cd0b5[_0xd19b('0x3d')]=_[_0xd19b('0x3c')](db[_0xd19b('0x9b')][_0xd19b('0x38')]);_0x5cd0b5[_0xd19b('0x3b')]=_[_0xd19b('0x3c')](_0x1807cf[_0xd19b('0x3b')]);_0x5cd0b5[_0xd19b('0x47')]=_[_0xd19b('0x3f')](_0x5cd0b5[_0xd19b('0x3d')],_0x5cd0b5[_0xd19b('0x3b')]);_0x3d1c7b[_0xd19b('0x3e')]=_[_0xd19b('0x3f')](_0x5cd0b5['model'],qs['fields'](_0x1807cf[_0xd19b('0x3b')][_0xd19b('0x40')]));_0x3d1c7b['attributes']=_0x3d1c7b[_0xd19b('0x3e')][_0xd19b('0x41')]?_0x3d1c7b['attributes']:_0x5cd0b5[_0xd19b('0x3d')];if(_0x1807cf[_0xd19b('0x3b')][_0xd19b('0xb2')]){_0x3d1c7b[_0xd19b('0xb3')]=[{'all':!![]}];}_0x3d1c7b=_[_0xd19b('0x9a')]({},_0x3d1c7b,_0x1807cf[_0xd19b('0xb4')]);return db[_0xd19b('0x9b')][_0xd19b('0x6b')](_0x3d1c7b)['then'](handleEntityNotFound(_0x3839c3,null))[_0xd19b('0x2a')](respondWithResult(_0x3839c3,null))[_0xd19b('0x36')](handleError(_0x3839c3,null));};exports[_0xd19b('0xb5')]=function(_0x3b62ae,_0x3850c2){return db['SmsInteraction'][_0xd19b('0xb5')](_0x3b62ae[_0xd19b('0xb6')],{})[_0xd19b('0x2a')](respondWithResult(_0x3850c2,0xc9))[_0xd19b('0x36')](handleError(_0x3850c2,null));};exports[_0xd19b('0x28')]=function(_0x49825b,_0x52e878){if(_0x49825b[_0xd19b('0xb6')]['id']){delete _0x49825b[_0xd19b('0xb6')]['id'];}return db[_0xd19b('0x9b')][_0xd19b('0x6b')]({'where':{'id':_0x49825b[_0xd19b('0xb1')]['id']}})[_0xd19b('0x2a')](handleEntityNotFound(_0x52e878,null))[_0xd19b('0x2a')](saveUpdates(_0x49825b['body'],null))['then'](respondWithResult(_0x52e878,null))['catch'](handleError(_0x52e878,null));};exports[_0xd19b('0x29')]=function(_0x570c40,_0x21faf3){return db['SmsInteraction']['find']({'where':{'id':_0x570c40[_0xd19b('0xb1')]['id']}})['then'](handleEntityNotFound(_0x21faf3,null))['then'](removeEntity(_0x21faf3,null))[_0xd19b('0x36')](handleError(_0x21faf3,null));};exports[_0xd19b('0xb7')]=function(_0x1beac2,_0x444fef){return db[_0xd19b('0x9b')][_0xd19b('0xb7')]()[_0xd19b('0x2a')](respondWithResult(_0x444fef,null))['catch'](handleError(_0x444fef,null));};exports[_0xd19b('0xb8')]=function(_0x1f3963,_0x6cc749,_0x3cac78){return db['SmsMessage'][_0xd19b('0x6b')]({'where':{'id':_0x1f3963[_0xd19b('0xb1')]['id']}})[_0xd19b('0x2a')](handleEntityNotFound(_0x6cc749,null))[_0xd19b('0x2a')](function(_0x3c24f1){if(_0x3c24f1){return _0x3c24f1[_0xd19b('0xb8')](_0x1f3963['body'][_0xd19b('0xb9')],_[_0xd19b('0xba')](_0x1f3963[_0xd19b('0xb6')],[_0xd19b('0xb9'),'id'])||{});}})[_0xd19b('0x2a')](respondWithResult(_0x6cc749,null))[_0xd19b('0x36')](handleError(_0x6cc749,null));};exports[_0xd19b('0xbb')]=function(_0x50db84,_0x4a2e8e,_0x4f975c){var _0x2192e7={'raw':![],'where':{}};var _0x302865={};var _0x5a1228={'count':0x0,'rows':[]};return db[_0xd19b('0x9b')][_0xd19b('0xbc')]({'where':{'id':_0x50db84[_0xd19b('0xb1')]['id']}})[_0xd19b('0x2a')](handleEntityNotFound(_0x4a2e8e,null))[_0xd19b('0x2a')](function(_0x27c317){if(_0x27c317){_0x302865[_0xd19b('0x3d')]=_['keys'](db[_0xd19b('0xbd')][_0xd19b('0x38')]);_0x302865[_0xd19b('0x3b')]=_[_0xd19b('0x3c')](_0x50db84[_0xd19b('0x3b')]);_0x302865[_0xd19b('0x47')]=_[_0xd19b('0x3f')](_0x302865[_0xd19b('0x3d')],_0x302865['query']);_0x2192e7[_0xd19b('0x3e')]=_[_0xd19b('0x3f')](_0x302865[_0xd19b('0x3d')],qs['fields'](_0x50db84['query'][_0xd19b('0x40')]));_0x2192e7[_0xd19b('0x3e')]=_0x2192e7[_0xd19b('0x3e')][_0xd19b('0x41')]?_0x2192e7['attributes']:_0x302865[_0xd19b('0x3d')];if(!_0x50db84[_0xd19b('0x3b')][_0xd19b('0x42')](_0xd19b('0x43'))){_0x2192e7[_0xd19b('0x20')]=qs[_0xd19b('0x20')](_0x50db84[_0xd19b('0x3b')]['limit']);_0x2192e7['offset']=qs[_0xd19b('0x22')](_0x50db84['query'][_0xd19b('0x22')]);}_0x2192e7[_0xd19b('0x44')]=qs[_0xd19b('0x45')](_0x50db84[_0xd19b('0x3b')]['sort']);_0x2192e7['where']=qs[_0xd19b('0x47')](_['pick'](_0x50db84[_0xd19b('0x3b')],_0x302865[_0xd19b('0x47')]));_0x2192e7[_0xd19b('0x46')][_0xd19b('0xae')]=_0x27c317['id'];if(_0x50db84['query'][_0xd19b('0xbe')]){_0x2192e7[_0xd19b('0x46')]=_[_0xd19b('0x9a')](_0x2192e7[_0xd19b('0x46')],{'$or':_[_0xd19b('0x30')](_0x2192e7[_0xd19b('0x3e')],function(_0x2aa9b1){var _0x16c747={};_0x16c747[_0x2aa9b1]={'$like':'%'+_0x50db84[_0xd19b('0x3b')][_0xd19b('0xbe')]+'%'};return _0x16c747;})});}if(_0x50db84[_0xd19b('0x3b')][_0xd19b('0xbf')]){var _0x4c4759=_0x50db84[_0xd19b('0x3b')][_0xd19b('0xbf')]['split'](',');var _0x272c84={};_0x272c84[_0x4c4759[0x0]]={'$gte':moment(_0x4c4759[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2192e7['where']=_[_0xd19b('0x9a')](_0x2192e7[_0xd19b('0x46')],_0x272c84);}_0x2192e7=_[_0xd19b('0x9a')]({},_0x2192e7,_0x50db84[_0xd19b('0xb4')]);return db[_0xd19b('0xbd')][_0xd19b('0x21')]({'where':_0x2192e7[_0xd19b('0x46')]})[_0xd19b('0x2a')](function(_0x4bdbfd){_0x5a1228[_0xd19b('0x21')]=_0x4bdbfd;if(_0x50db84['query'][_0xd19b('0xb2')]){_0x2192e7[_0xd19b('0xb3')]=[{'all':!![]}];}return db[_0xd19b('0xbd')][_0xd19b('0xc0')](_0x2192e7);})[_0xd19b('0x2a')](function(_0x32331b){_0x5a1228[_0xd19b('0xb0')]=_0x32331b;return _0x5a1228;});}})[_0xd19b('0x2a')](respondWithFilteredResult(_0x4a2e8e,_0x2192e7))[_0xd19b('0x36')](handleError(_0x4a2e8e,null));};exports[_0xd19b('0xc1')]=function(_0x14b351,_0x5bc792,_0x3f152b){return db[_0xd19b('0x9b')]['find']({'where':{'id':_0x14b351[_0xd19b('0xb1')]['id']}})[_0xd19b('0x2a')](handleEntityNotFound(_0x5bc792,null))['then'](function(_0x26d36d){if(_0x26d36d){return _0x26d36d[_0xd19b('0xc2')](_0x14b351[_0xd19b('0xb6')]['ids'],_['omit'](_0x14b351['body'],[_0xd19b('0xb9'),'id'])||{})['spread'](function(){return db[_0xd19b('0xc3')][_0xd19b('0xc0')]({'attributes':['id','name','color'],'where':{'id':_0x14b351[_0xd19b('0xb6')][_0xd19b('0xb9')]}});})[_0xd19b('0x2a')](function(_0x39a08f){socket[_0xd19b('0xc4')](_0xd19b('0xc5'),{'id':Number(_0x14b351[_0xd19b('0xb1')]['id']),'tags':_0x39a08f||[]});return{'id':Number(_0x14b351[_0xd19b('0xb1')]['id']),'tags':_0x39a08f||[]};});}})[_0xd19b('0x2a')](respondWithResult(_0x5bc792,null))[_0xd19b('0x36')](handleError(_0x5bc792,null));};exports[_0xd19b('0xc6')]=function(_0x4e85f6,_0x409463,_0x35bdbb){return db[_0xd19b('0x9b')]['find']({'where':{'id':_0x4e85f6[_0xd19b('0xb1')]['id']}})[_0xd19b('0x2a')](handleEntityNotFound(_0x409463,null))['then'](function(_0x58872a){if(_0x58872a){return _0x58872a[_0xd19b('0xc6')](_0x4e85f6[_0xd19b('0x3b')][_0xd19b('0xb9')]);}})[_0xd19b('0x2a')](respondWithStatusCode(_0x409463,null))[_0xd19b('0x36')](handleError(_0x409463,null));};exports['download']=function(_0x4cb02b,_0x3c9dde){var _0x44cab6=moment()[_0xd19b('0xc7')]()['toString']();var _0x10f437=path[_0xd19b('0xc8')](config[_0xd19b('0xc9')],'server',_0xd19b('0xca'),'tmp');var _0xae949b=path[_0xd19b('0xc8')](config[_0xd19b('0xc9')],_0xd19b('0xcb'),_0xd19b('0xca'),_0xd19b('0xcc'));var _0x18267b=path[_0xd19b('0xc8')](_0x10f437,_0x44cab6);var _0x473b37=util['format'](_0xd19b('0xcd'),_0x4cb02b[_0xd19b('0xb1')]['id'],_0x44cab6);var _0x3795c7=path['join'](_0x10f437,_0x473b37);var _0x13d9fd=[];_0x13d9fd[_0xd19b('0x35')]({'model':db[_0xd19b('0x72')],'as':'User','attributes':['id',_0xd19b('0xce')],'raw':!![]});_0x13d9fd[_0xd19b('0x35')]({'model':db['CmContact'],'as':_0xd19b('0x66'),'attributes':['id',_0xd19b('0xcf'),'lastName'],'raw':!![]});var _0x59e70e=[{'model':db[_0xd19b('0xbd')],'as':'Messages','attributes':['id',_0xd19b('0xb6'),_0xd19b('0x7c'),_0xd19b('0xd0'),'secret',_0xd19b('0x82')],'include':_0x13d9fd}];_0x59e70e['push']({'model':db[_0xd19b('0xd1')],'as':'Account','attributes':['id',_0xd19b('0x2d')]});_0x59e70e[_0xd19b('0x35')]({'model':db[_0xd19b('0x72')],'as':_0xd19b('0xd2'),'attributes':['id',_0xd19b('0xce')]});return db[_0xd19b('0x9b')][_0xd19b('0x6b')]({'where':{'id':_0x4cb02b['params']['id']},'include':_0x59e70e})['then'](handleEntityNotFound(_0x3c9dde,null))[_0xd19b('0x2a')](function(_0x4e96c6){if(_0x4e96c6){var _0x1e76f8=_0x4e96c6[_0xd19b('0xd3')]({'plain':!![]});fs[_0xd19b('0xd4')](_0x18267b);var _0x384eef={'channel':_0xd19b('0xd5'),'account':_0x1e76f8[_0xd19b('0xd6')][_0xd19b('0x2d')],'agent':_0x1e76f8[_0xd19b('0xd2')]?_0x1e76f8['Owner'][_0xd19b('0xce')]:'N.A.','createdAt':moment(_0x1e76f8[_0xd19b('0x7c')])[_0xd19b('0xd7')](_0xd19b('0xd8'))[_0xd19b('0x99')](),'closedAt':_0x1e76f8[_0xd19b('0xd9')]?moment(_0x1e76f8['closedAt'])[_0xd19b('0xd7')](_0xd19b('0xd8'))[_0xd19b('0x99')]():'','disposition':_0x1e76f8[_0xd19b('0xda')],'messages':_(_0x1e76f8[_0xd19b('0xdb')])[_0xd19b('0xbe')]({'secret':![]})['map'](function(_0xb169c){return{'date':moment(_0xb169c[_0xd19b('0x7c')])[_0xd19b('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd19b('0x99')](),'sender':_0xb169c[_0xd19b('0xd0')]===_0xd19b('0xdc')?_0xb169c[_0xd19b('0x72')]?_0xb169c['User'][_0xd19b('0xce')]:_0xd19b('0xdd'):_0xb169c['Contact'][_0xd19b('0xcf')]+(_0xb169c['Contact']['lastName']?'\x20'+_0xb169c[_0xd19b('0x66')][_0xd19b('0xde')]:''),'body':_0xb169c[_0xd19b('0xb6')],'direction':_0xb169c[_0xd19b('0xd0')]===_0xd19b('0xdc')?'A':'C','secret':_0xb169c[_0xd19b('0xdf')],'read':_0xb169c[_0xd19b('0x82')]};})[_0xd19b('0x62')]()};return ejs['renderFile'](path[_0xd19b('0xc8')](config[_0xd19b('0xc9')],_0xd19b('0xcb'),_0xd19b('0xe0'),_0xd19b('0xe1')),{'interaction':_0x384eef})[_0xd19b('0x2a')](function(_0x210927){var _0x3e4595=path[_0xd19b('0xc8')](_0x18267b,_0xd19b('0xe2')+_0x1e76f8['id']+'-'+_0x44cab6+_0xd19b('0xe3'));var _0x5b9813={'path':_0x3e4595,'channel':_0xd19b('0xd5'),'interactionId':_0x1e76f8['id']};return pdf[_0xd19b('0xe4')](_0x210927,_0x5b9813);})['then'](function(){return new BPromise(function(_0x3f489b,_0x12a3fe){zipdir(_0x18267b,{'saveTo':_0x3795c7},function(_0x4a4693,_0x5656cc){if(_0x4a4693)return _0x12a3fe(_0x4a4693);return _0x3f489b(_0x5656cc);});})[_0xd19b('0x2a')](function(){return new BPromise(function(_0x1375ff,_0x147573){rimraf(_0x18267b,function(_0x384e0c){if(_0x384e0c)_0x147573(_0x384e0c);return _0x1375ff();});});})['then'](function(){return _0x3c9dde['download'](_0x3795c7,_0x473b37,function(_0x174a6c){if(_0x174a6c){console['log'](_0xd19b('0xe5'),_0x174a6c);}else{fs['unlinkSync'](_0x3795c7);}});});});}else{return _0x3c9dde[_0xd19b('0x2b')](0xc8);}})[_0xd19b('0x36')](handleError(_0x3c9dde,null));}; \ No newline at end of file +var _0x18dd=['text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','$gte','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','includeAll','include','merge','options','create','update','params','describe','addMessage','SmsMessage','ids','getMessages','hasOwnProperty','format','findAll','omit','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','fullname','get','mkdirSync','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','out','System','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','name','ContactId','type'];(function(_0x2a87fe,_0x52c61c){var _0x539085=function(_0x966460){while(--_0x966460){_0x2a87fe['push'](_0x2a87fe['shift']());}};_0x539085(++_0x52c61c);}(_0x18dd,0x7a));var _0xd18d=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x18dd[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xd18d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd18d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd18d('0x2'));var moment=require(_0xd18d('0x3'));var BPromise=require(_0xd18d('0x4'));var Mustache=require(_0xd18d('0x5'));var util=require(_0xd18d('0x6'));var path=require(_0xd18d('0x7'));var sox=require(_0xd18d('0x8'));var csv=require(_0xd18d('0x9'));var ejs=require(_0xd18d('0xa'));var fs=require('fs');var fs_extra=require(_0xd18d('0xb'));var _=require(_0xd18d('0xc'));var squel=require('squel');var crypto=require(_0xd18d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd18d('0xe'));var toCsv=require(_0xd18d('0x9'));var querystring=require('querystring');var Papa=require(_0xd18d('0xf'));var Redis=require('ioredis');var authService=require(_0xd18d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd18d('0x11'));var pdf=require(_0xd18d('0x12'));var hardwareService=require(_0xd18d('0x13'));var logger=require(_0xd18d('0x14'))(_0xd18d('0x15'));var utils=require(_0xd18d('0x16'));var config=require(_0xd18d('0x17'));var licenseUtil=require(_0xd18d('0x18'));var db=require(_0xd18d('0x19'))['db'];config[_0xd18d('0x1a')]=_[_0xd18d('0x1b')](config['redis'],{'host':_0xd18d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd18d('0x1a')]));require(_0xd18d('0x1d'))['register'](socket);function respondWithStatusCode(_0x1c2cdf,_0x5631e2){_0x5631e2=_0x5631e2||0xcc;return function(_0x2ca642){if(_0x2ca642){return _0x1c2cdf[_0xd18d('0x1e')](_0x5631e2);}return _0x1c2cdf[_0xd18d('0x1f')](_0x5631e2)[_0xd18d('0x20')]();};}function respondWithResult(_0x30cf9f,_0x3a8c25){_0x3a8c25=_0x3a8c25||0xc8;return function(_0x2dd878){if(_0x2dd878){return _0x30cf9f[_0xd18d('0x1f')](_0x3a8c25)[_0xd18d('0x21')](_0x2dd878);}};}function respondWithFilteredResult(_0x346984,_0x3f882b){return function(_0x2e8cdd){if(_0x2e8cdd){var _0x5b82e2=typeof _0x3f882b[_0xd18d('0x22')]===_0xd18d('0x23')&&typeof _0x3f882b['limit']==='undefined';var _0x36cdf5=_0x2e8cdd['count'];var _0x14a868=_0x5b82e2?0x0:_0x3f882b['offset'];var _0x4ca885=_0x5b82e2?_0x2e8cdd[_0xd18d('0x24')]:_0x3f882b[_0xd18d('0x22')]+_0x3f882b[_0xd18d('0x25')];var _0x217973;if(_0x4ca885>=_0x36cdf5){_0x4ca885=_0x36cdf5;_0x217973=0xc8;}else{_0x217973=0xce;}_0x346984[_0xd18d('0x1f')](_0x217973);return _0x346984[_0xd18d('0x26')](_0xd18d('0x27'),_0x14a868+'-'+_0x4ca885+'/'+_0x36cdf5)[_0xd18d('0x21')](_0x2e8cdd);}return null;};}function patchUpdates(_0x20cf03){return function(_0x23aad4){try{jsonpatch[_0xd18d('0x28')](_0x23aad4,_0x20cf03,!![]);}catch(_0x3dfda2){return BPromise[_0xd18d('0x29')](_0x3dfda2);}return _0x23aad4['save']();};}function saveUpdates(_0x484038,_0x43c41e){return function(_0x4f7378){if(_0x4f7378){return _0x4f7378['update'](_0x484038)[_0xd18d('0x2a')](function(_0x5727f1){return _0x5727f1;});}return null;};}function removeEntity(_0x877701,_0x53a2f2){return function(_0x1961df){if(_0x1961df){return _0x1961df[_0xd18d('0x2b')]()[_0xd18d('0x2a')](function(){_0x877701['status'](0xcc)[_0xd18d('0x20')]();});}};}function handleEntityNotFound(_0x4eb625,_0x3fe2cd){return function(_0x4e8bd3){if(!_0x4e8bd3){_0x4eb625[_0xd18d('0x1e')](0x194);}return _0x4e8bd3;};}function handleError(_0x4e9800,_0x590ff5){_0x590ff5=_0x590ff5||0x1f4;return function(_0x4262be){logger[_0xd18d('0x2c')](_0x4262be[_0xd18d('0x2d')]);if(_0x4262be['name']){delete _0x4262be['name'];}_0x4e9800['status'](_0x590ff5)[_0xd18d('0x2e')](_0x4262be);};}function getInteractionUsers(_0x2cf12e,_0x4627ee){return new BPromise(function(_0x3e677b,_0x45c602){try{if(_0x4627ee[_0x2cf12e['id']]){_0x2cf12e[_0xd18d('0x2f')]=_[_0xd18d('0x30')](_0x4627ee[_0x2cf12e['id']],function(_0x1740b0){return{'id':_0x1740b0['id'],'fullname':_0x1740b0['fullname']};});}}catch(_0xf6d26){_0x45c602(_0xf6d26);}_0x3e677b(_0x2cf12e);});}function getInteractionTags(_0x1f918b,_0x463e2d){return new BPromise(function(_0x3a325d,_0x497d49){try{if(_0x1f918b[_0xd18d('0x31')]){_0x1f918b[_0xd18d('0x32')]=[];_0x1f918b[_0xd18d('0x31')][_0xd18d('0x33')](',')[_0xd18d('0x34')](function(_0x481143){_0x1f918b['Tags'][_0xd18d('0x35')](_0x463e2d[_0x481143]);});}delete _0x1f918b[_0xd18d('0x31')];}catch(_0x1077e6){_0x497d49(_0x1077e6);}_0x3a325d(_0x1f918b);});}function updateSmsInteraction(_0x19385d,_0x16381e,_0x7238f9){return new BPromise(function(_0x2c95b1,_0x46b863){return getInteractionUsers(_0x19385d,_0x7238f9)[_0xd18d('0x2a')](function(_0x15521f){return getInteractionTags(_0x15521f,_0x16381e);})[_0xd18d('0x2a')](function(_0x82097e){_0x2c95b1(_0x82097e);})[_0xd18d('0x36')](function(_0x24405e){_0x46b863(_0x24405e);});});}exports[_0xd18d('0x37')]=function(_0x59abae,_0x45efeb){var _0x59b463={},_0x2f2d6d={},_0x36ef85={'count':0x0,'rows':[]};var _0x2e456b=_['map'](db[_0xd18d('0x38')][_0xd18d('0x39')],function(_0x3f80e7){return{'name':_0x3f80e7[_0xd18d('0x3a')],'type':_0x3f80e7['type'][_0xd18d('0x3b')]};});_0x2f2d6d[_0xd18d('0x3c')]=_[_0xd18d('0x30')](_0x2e456b,'name');_0x2f2d6d[_0xd18d('0x3d')]=_[_0xd18d('0x3e')](_0x59abae['query']);_0x2f2d6d[_0xd18d('0x3f')]=_[_0xd18d('0x40')](_0x2f2d6d['model'],_0x2f2d6d[_0xd18d('0x3d')]);_0x59b463[_0xd18d('0x41')]=_[_0xd18d('0x40')](_0x2f2d6d[_0xd18d('0x3c')],qs['fields'](_0x59abae['query'][_0xd18d('0x42')]));_0x59b463['attributes']=_0x59b463[_0xd18d('0x41')][_0xd18d('0x43')]?_0x59b463['attributes']:_0x2f2d6d[_0xd18d('0x3c')];if(!_0x59abae['query']['hasOwnProperty'](_0xd18d('0x44'))){_0x59b463['limit']=qs[_0xd18d('0x25')](_0x59abae['query']['limit']);_0x59b463[_0xd18d('0x22')]=qs['offset'](_0x59abae[_0xd18d('0x3d')][_0xd18d('0x22')]);}_0x59b463[_0xd18d('0x45')]=qs[_0xd18d('0x46')](_0x59abae['query'][_0xd18d('0x46')]);_0x59b463['where']=qs[_0xd18d('0x3f')](_[_0xd18d('0x47')](_0x59abae[_0xd18d('0x3d')],_0x2f2d6d[_0xd18d('0x3f')]),_0x2e456b);var _0x4251bd=[];var _0x3422b5=squel[_0xd18d('0x48')]()[_0xd18d('0x49')]('id')[_0xd18d('0x49')]('name')[_0xd18d('0x49')]('color')[_0xd18d('0x4a')](_0xd18d('0x4b'));var _0x43853c=squel[_0xd18d('0x48')]()['field'](_0xd18d('0x4c'))[_0xd18d('0x49')]('u.fullname')['field'](_0xd18d('0x4d'))[_0xd18d('0x4a')](_0xd18d('0x4e'),'ui')[_0xd18d('0x4f')]('users','u',_0xd18d('0x50'));var _0x235b03=squel['select']()[_0xd18d('0x4a')](_0xd18d('0x51'),'i')[_0xd18d('0x4f')](_0xd18d('0x52'),'c',_0xd18d('0x53'))[_0xd18d('0x4f')](_0xd18d('0x54'),'o',_0xd18d('0x55'))['left_join'](_0xd18d('0x56'),'a',_0xd18d('0x57'))[_0xd18d('0x4f')](_0xd18d('0x58'),'me',_0xd18d('0x59'))[_0xd18d('0x4f')](_0xd18d('0x5a'),'it',_0xd18d('0x5b'))[_0xd18d('0x4f')](_0xd18d('0x4b'),'t','t.id\x20=\x20it.TagId');var _0xfc97de=squel[_0xd18d('0x5c')]();var _0x341906=[];var _0x3e6ce0=squel[_0xd18d('0x5c')]();var _0x18211d;if(_0x59abae['query']['search']){_0x18211d=as['parseSearch'](_0x59abae['query'][_0xd18d('0x5d')]);var _0x49b534=_0x18211d[_0xd18d('0x5e')];for(var _0x2d2e12=0x0;_0x2d2e12<_0x18211d[_0xd18d('0x5f')][_0xd18d('0x43')];_0x2d2e12++){var _0x3bb850=_0x18211d[_0xd18d('0x5f')][_0x2d2e12];var _0x196482='i';var _0x2744ee=_[_0xd18d('0x60')](_0x2e456b,['name',_0x3bb850[_0xd18d('0x49')]]);if(!_0x2744ee){switch(_0x3bb850[_0xd18d('0x49')]){case _0xd18d('0x61'):if(_0x3bb850['value']==0x1){_0x235b03[_0xd18d('0x62')]('`'+_0x3bb850[_0xd18d('0x49')]+_0xd18d('0x63'));}else{_0x235b03['having']('`'+_0x3bb850[_0xd18d('0x49')]+_0xd18d('0x64'));}break;case _0xd18d('0x65'):if(_0x3bb850['operator']===_0xd18d('0x66')){if(_0x3bb850[_0xd18d('0x67')]['split']('\x20')[_0xd18d('0x43')]>0x1){_0xfc97de[_0x49b534]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3bb850[_0xd18d('0x67')]),null);}else{var _0x3d90b3='%'+_0x3bb850[_0xd18d('0x67')]+'%';_0xfc97de[_0x49b534](_0xd18d('0x68'),_0x3d90b3,_0x3d90b3,_0x3d90b3);}}else{_0x2744ee=_[_0xd18d('0x60')](_0x2e456b,[_0xd18d('0x69'),'ContactId']);_0x3bb850['field']=_0xd18d('0x6a');_0xde3de6=as['buildExpression'](_0x196482,_0x2744ee[_0xd18d('0x6b')],_0x3bb850);_0xfc97de[_0x49b534](_0xde3de6[_0xd18d('0x6c')],_0xde3de6[_0xd18d('0x67')][_0xd18d('0x6d')],_0xde3de6[_0xd18d('0x67')]['end']);}break;case _0xd18d('0x6e'):var _0x27aa05=_0x3bb850[_0xd18d('0x67')]['split'](',')['map'](function(_0x9261f8){return Number(_0x9261f8);});_0x27aa05['forEach'](function(_0x524fd6){_0x3e6ce0['or'](_0xd18d('0x6f'),'%,'+_0x524fd6+',%');});_0x341906=_[_0xd18d('0x70')](_0x341906,_0x27aa05);break;case _0xd18d('0x71'):if(_0x3bb850[_0xd18d('0x72')]===_0xd18d('0x66')){_0xfc97de[_0x49b534](_0xd18d('0x73'),'%'+_0x3bb850[_0xd18d('0x67')]+'%',null);}else{_0x2744ee=_['find'](_0x2e456b,[_0xd18d('0x69'),'UserId']);_0x3bb850[_0xd18d('0x49')]='UserId';_0xde3de6=as[_0xd18d('0x74')](_0x196482,_0x2744ee[_0xd18d('0x6b')],_0x3bb850);_0xfc97de[_0x49b534](_0xde3de6[_0xd18d('0x6c')],_0xde3de6[_0xd18d('0x67')][_0xd18d('0x6d')],_0xde3de6[_0xd18d('0x67')]['end']);}break;case _0xd18d('0x75'):_0xde3de6=as['buildExpression']('me',null,_0x3bb850);_0xfc97de[_0x49b534](_0xde3de6[_0xd18d('0x6c')],_0xde3de6[_0xd18d('0x67')]['start'],_0xde3de6[_0xd18d('0x67')][_0xd18d('0x20')]);break;}}else{var _0xde3de6=as[_0xd18d('0x74')](_0x196482,_0x2744ee['type'],_0x3bb850);_0xfc97de[_0x49b534](_0xde3de6[_0xd18d('0x6c')],_0xde3de6[_0xd18d('0x67')]['start'],_0xde3de6[_0xd18d('0x67')]['end']);}}}else{var _0x4e751e=_(_0x59abae['query'])[_0xd18d('0x3e')]()['map'](function(_0x5cf754){return _['some'](_0x2e456b,['name',_0x5cf754])?_0x5cf754:undefined;})[_0xd18d('0x76')]()[_0xd18d('0x67')]();if(!_['isEmpty'](_0x4e751e)){_0x4e751e[_0xd18d('0x34')](function(_0x2622c9){if(_0x2622c9===_0xd18d('0x77')){_0x235b03[_0xd18d('0x78')](_0xd18d('0x79'),[][_0xd18d('0x7a')](_0x59abae[_0xd18d('0x3d')][_0x2622c9]));}else if(_0x2622c9==='createdAt'){var _0x384608=JSON['parse'](_0x59abae['query'][_0x2622c9])[_0xd18d('0x7b')];var _0x2769b1=JSON[_0xd18d('0x7c')](_0x59abae['query'][_0x2622c9])[_0xd18d('0x7d')];_0x235b03[_0xd18d('0x78')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x384608,_0x2769b1);}else{if(_0x59abae[_0xd18d('0x3d')][_0x2622c9]==='null'){_0x235b03[_0xd18d('0x78')]('i.'+_0x2622c9+_0xd18d('0x7e'));}else{_0x235b03[_0xd18d('0x78')]('i.'+_0x2622c9+_0xd18d('0x7f'),_0x59abae[_0xd18d('0x3d')][_0x2622c9]);}}});}if(_0x59abae[_0xd18d('0x3d')][_0xd18d('0x80')]){if(_0x59abae[_0xd18d('0x3d')][_0xd18d('0x80')]==0x1){_0x235b03['having'](_0xd18d('0x81'));}else{_0x235b03[_0xd18d('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x59abae[_0xd18d('0x3d')][_0xd18d('0x82')]){_0x341906=_['isArray'](_0x59abae[_0xd18d('0x3d')][_0xd18d('0x82')])?_0x59abae[_0xd18d('0x3d')][_0xd18d('0x82')]:new Array(_0x59abae[_0xd18d('0x3d')]['tag']);_0x341906[_0xd18d('0x34')](function(_0x2378ba){_0x3e6ce0['or'](_0xd18d('0x6f'),'%,'+_0x2378ba+',%');});}if(_0x59abae['query'][_0xd18d('0x83')]){var _0x39881f=_0x59abae[_0xd18d('0x3d')]['filter'][_0xd18d('0x84')]('\x5c','\x5c\x5c')[_0xd18d('0x84')](/'/g,'\x27\x27');if(qs[_0xd18d('0x85')](_0x39881f)){_0xfc97de['or']('i.id\x20LIKE\x20?',_0x39881f+'%')['or'](_0xd18d('0x86'),_0x39881f+'%');}else{_0xfc97de['or'](_0xd18d('0x87'),qs[_0xd18d('0x88')](_0x39881f))['or'](_0xd18d('0x89'),_0x39881f+'%');}}}_0x235b03[_0xd18d('0x78')](_0xfc97de);_0x235b03[_0xd18d('0x8a')](_0xd18d('0x8b'));var _0x263a08={'type':db[_0xd18d('0x8c')][_0xd18d('0x8d')]['SELECT'],'raw':!![]};var _0xa67633=_0x235b03['clone']();_0xa67633[_0xd18d('0x49')](_0xd18d('0x8b'));_0xa67633['field'](_0xd18d('0x8e'),_0xd18d('0x61'));if(_0x59b463[_0xd18d('0x45')]){_0x59b463[_0xd18d('0x45')][_0xd18d('0x34')](function(_0x31001c){var _0x17490d=_0x31001c[0x0]===_0xd18d('0x8f')?_0x31001c[0x0]:'i.'+_0x31001c[0x0];_0x235b03[_0xd18d('0x45')](_0x17490d,_0x31001c[0x1]===_0xd18d('0x90')?![]:!![]);});}if(!_[_0xd18d('0x91')](_0x341906)){_0x235b03['having'](_0x3e6ce0);_0xa67633[_0xd18d('0x78')](_0xd18d('0x92'),_0x341906);}BPromise[_0xd18d('0x93')]()[_0xd18d('0x2a')](function(){if(!_0x18211d){if(_0x59abae[_0xd18d('0x3d')][_0xd18d('0x77')])return;_0xa67633[_0xd18d('0x78')](_0xd18d('0x94'));_0x235b03[_0xd18d('0x78')](_0xd18d('0x94'));return;}if(_0x59abae[_0xd18d('0x95')][_0xd18d('0x96')]!==_0xd18d('0x97'))return;return _0x59abae[_0xd18d('0x95')][_0xd18d('0x98')]({'attributes':['id'],'raw':!![]})[_0xd18d('0x2a')](function(_0x124474){if(_[_0xd18d('0x91')](_0x124474)){_0xa67633['where'](_0xd18d('0x99'));_0x235b03[_0xd18d('0x78')]('i.SmsAccountId\x20IS\x20NULL');}else{_0xa67633['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x124474,'id'));_0x235b03[_0xd18d('0x78')]('i.SmsAccountId\x20IN\x20?',_[_0xd18d('0x30')](_0x124474,'id'));}});})[_0xd18d('0x2a')](function(){if(_0x59abae[_0xd18d('0x95')]['role']===_0xd18d('0x97')&&!_0x18211d&&!_0x59abae[_0xd18d('0x3d')][_0xd18d('0x77')])return[];return db['sequelize'][_0xd18d('0x3d')](_0xa67633[_0xd18d('0x9a')](),_0x263a08);})[_0xd18d('0x2a')](function(_0x2537f0){_0x36ef85['count']=_0x2537f0['length'];if(_0x36ef85[_0xd18d('0x24')]===0x0)return[];return db[_0xd18d('0x9b')][_0xd18d('0x3d')](_0x3422b5['toString'](),_0x263a08)['then'](function(_0x5de9d3){_0x4251bd=_['keyBy'](_0x5de9d3,'id');_0x263a08=_['merge'](_0x263a08,{'model':db[_0xd18d('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59abae[_0xd18d('0x3d')][_0xd18d('0x42')]){_0x59b463[_0xd18d('0x41')][_0xd18d('0x34')](function(_0x59cf0e){_0x235b03[_0xd18d('0x49')]('i.'+_0x59cf0e);});}else{_0x235b03[_0xd18d('0x49')](_0xd18d('0x8e'),_0xd18d('0x61'));_0x235b03[_0xd18d('0x49')](_0xd18d('0x9c'),'Account.key');_0x235b03['field'](_0xd18d('0x9d'),_0xd18d('0x9e'));_0x235b03[_0xd18d('0x49')]('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',_0xd18d('0x8f'));_0x235b03['field'](_0xd18d('0x9f'));_0x235b03[_0xd18d('0x49')](_0xd18d('0xa0'),_0xd18d('0xa1'));_0x235b03['field'](_0xd18d('0xa2'),_0xd18d('0xa3'));_0x235b03['field']('c.email','Contact.email');_0x235b03['field']('c.phone',_0xd18d('0xa4'));_0x235b03[_0xd18d('0x49')](_0xd18d('0xa5'),'Contact.mobile');_0x235b03[_0xd18d('0x49')](_0xd18d('0xa6'),_0xd18d('0xa7'));_0x235b03['field'](_0xd18d('0xa8'),'Owner.fullname');_0x235b03['field'](_0xd18d('0xa9'),_0xd18d('0xaa'));_0x235b03[_0xd18d('0x49')](_0xd18d('0xab'),'TagIds');}if(_0x59b463[_0xd18d('0x25')])_0x235b03['limit'](_0x59b463['limit']);if(_0x59b463[_0xd18d('0x22')])_0x235b03[_0xd18d('0x22')](_0x59b463['offset']);return db[_0xd18d('0x9b')][_0xd18d('0x3d')](_0x235b03[_0xd18d('0x9a')](),_0x263a08);})[_0xd18d('0x2a')](function(_0x1b130e){if(_0x1b130e[_0xd18d('0x43')]>0x0)_0x43853c[_0xd18d('0x78')](_0xd18d('0xac'),_[_0xd18d('0x30')](_0x1b130e,'id'));return db[_0xd18d('0x9b')][_0xd18d('0x3d')](_0x43853c[_0xd18d('0x9a')](),_0x263a08)[_0xd18d('0x2a')](function(_0x421f77){var _0x4a8c36=_[_0xd18d('0xad')](_0x421f77,_0xd18d('0xae'));var _0x4fe28a=[];_0x1b130e['forEach'](function(_0x20cdcb){_0x4fe28a['push'](updateSmsInteraction(_0x20cdcb,_0x4251bd,_0x4a8c36));});return BPromise['all'](_0x4fe28a);});});})['then'](function(_0x542a54){_0x36ef85[_0xd18d('0xaf')]=_0x542a54;return _0x36ef85;})[_0xd18d('0x2a')](respondWithFilteredResult(_0x45efeb,_0x59b463))[_0xd18d('0x36')](handleError(_0x45efeb,null));};exports[_0xd18d('0xb0')]=function(_0x3d4954,_0x1f3d79){var _0x1a6f89={'raw':![],'where':{'id':_0x3d4954['params']['id']}},_0x181a2c={};_0x181a2c[_0xd18d('0x3c')]=_['keys'](db[_0xd18d('0x38')][_0xd18d('0x39')]);_0x181a2c[_0xd18d('0x3d')]=_['keys'](_0x3d4954[_0xd18d('0x3d')]);_0x181a2c[_0xd18d('0x3f')]=_[_0xd18d('0x40')](_0x181a2c[_0xd18d('0x3c')],_0x181a2c['query']);_0x1a6f89['attributes']=_[_0xd18d('0x40')](_0x181a2c[_0xd18d('0x3c')],qs[_0xd18d('0x42')](_0x3d4954[_0xd18d('0x3d')][_0xd18d('0x42')]));_0x1a6f89[_0xd18d('0x41')]=_0x1a6f89[_0xd18d('0x41')]['length']?_0x1a6f89[_0xd18d('0x41')]:_0x181a2c[_0xd18d('0x3c')];if(_0x3d4954[_0xd18d('0x3d')][_0xd18d('0xb1')]){_0x1a6f89[_0xd18d('0xb2')]=[{'all':!![]}];}_0x1a6f89=_[_0xd18d('0xb3')]({},_0x1a6f89,_0x3d4954[_0xd18d('0xb4')]);return db[_0xd18d('0x38')]['find'](_0x1a6f89)['then'](handleEntityNotFound(_0x1f3d79,null))[_0xd18d('0x2a')](respondWithResult(_0x1f3d79,null))['catch'](handleError(_0x1f3d79,null));};exports[_0xd18d('0xb5')]=function(_0x3de0f6,_0x25d2c8){return db['SmsInteraction'][_0xd18d('0xb5')](_0x3de0f6[_0xd18d('0x75')],{})['then'](respondWithResult(_0x25d2c8,0xc9))[_0xd18d('0x36')](handleError(_0x25d2c8,null));};exports[_0xd18d('0xb6')]=function(_0x555885,_0x1a5488){if(_0x555885[_0xd18d('0x75')]['id']){delete _0x555885[_0xd18d('0x75')]['id'];}return db[_0xd18d('0x38')][_0xd18d('0x60')]({'where':{'id':_0x555885['params']['id']}})[_0xd18d('0x2a')](handleEntityNotFound(_0x1a5488,null))[_0xd18d('0x2a')](saveUpdates(_0x555885[_0xd18d('0x75')],null))[_0xd18d('0x2a')](respondWithResult(_0x1a5488,null))['catch'](handleError(_0x1a5488,null));};exports[_0xd18d('0x2b')]=function(_0xf5bed,_0x4052fe){return db['SmsInteraction'][_0xd18d('0x60')]({'where':{'id':_0xf5bed[_0xd18d('0xb7')]['id']}})[_0xd18d('0x2a')](handleEntityNotFound(_0x4052fe,null))[_0xd18d('0x2a')](removeEntity(_0x4052fe,null))[_0xd18d('0x36')](handleError(_0x4052fe,null));};exports[_0xd18d('0xb8')]=function(_0x50a160,_0x274ce3){return db[_0xd18d('0x38')]['describe']()['then'](respondWithResult(_0x274ce3,null))[_0xd18d('0x36')](handleError(_0x274ce3,null));};exports[_0xd18d('0xb9')]=function(_0x1b3535,_0x45caaf,_0x1f7b68){return db[_0xd18d('0xba')]['find']({'where':{'id':_0x1b3535[_0xd18d('0xb7')]['id']}})[_0xd18d('0x2a')](handleEntityNotFound(_0x45caaf,null))[_0xd18d('0x2a')](function(_0x58fbdd){if(_0x58fbdd){return _0x58fbdd[_0xd18d('0xb9')](_0x1b3535['body']['ids'],_['omit'](_0x1b3535[_0xd18d('0x75')],[_0xd18d('0xbb'),'id'])||{});}})[_0xd18d('0x2a')](respondWithResult(_0x45caaf,null))[_0xd18d('0x36')](handleError(_0x45caaf,null));};exports[_0xd18d('0xbc')]=function(_0x41ef5f,_0x572455,_0x188e16){var _0x419363={'raw':![],'where':{}};var _0x352bf7={};var _0x233eb4={'count':0x0,'rows':[]};return db[_0xd18d('0x38')]['findOne']({'where':{'id':_0x41ef5f[_0xd18d('0xb7')]['id']}})[_0xd18d('0x2a')](handleEntityNotFound(_0x572455,null))[_0xd18d('0x2a')](function(_0x1359fb){if(_0x1359fb){_0x352bf7[_0xd18d('0x3c')]=_[_0xd18d('0x3e')](db[_0xd18d('0xba')]['rawAttributes']);_0x352bf7[_0xd18d('0x3d')]=_[_0xd18d('0x3e')](_0x41ef5f[_0xd18d('0x3d')]);_0x352bf7[_0xd18d('0x3f')]=_['intersection'](_0x352bf7[_0xd18d('0x3c')],_0x352bf7[_0xd18d('0x3d')]);_0x419363[_0xd18d('0x41')]=_[_0xd18d('0x40')](_0x352bf7[_0xd18d('0x3c')],qs[_0xd18d('0x42')](_0x41ef5f[_0xd18d('0x3d')][_0xd18d('0x42')]));_0x419363[_0xd18d('0x41')]=_0x419363[_0xd18d('0x41')][_0xd18d('0x43')]?_0x419363[_0xd18d('0x41')]:_0x352bf7[_0xd18d('0x3c')];if(!_0x41ef5f[_0xd18d('0x3d')][_0xd18d('0xbd')]('nolimit')){_0x419363[_0xd18d('0x25')]=qs['limit'](_0x41ef5f['query'][_0xd18d('0x25')]);_0x419363[_0xd18d('0x22')]=qs[_0xd18d('0x22')](_0x41ef5f[_0xd18d('0x3d')][_0xd18d('0x22')]);}_0x419363[_0xd18d('0x45')]=qs[_0xd18d('0x46')](_0x41ef5f[_0xd18d('0x3d')]['sort']);_0x419363[_0xd18d('0x78')]=qs[_0xd18d('0x3f')](_[_0xd18d('0x47')](_0x41ef5f[_0xd18d('0x3d')],_0x352bf7[_0xd18d('0x3f')]));_0x419363[_0xd18d('0x78')][_0xd18d('0xae')]=_0x1359fb['id'];if(_0x41ef5f['query'][_0xd18d('0x83')]){_0x419363[_0xd18d('0x78')]=_[_0xd18d('0xb3')](_0x419363[_0xd18d('0x78')],{'$or':_[_0xd18d('0x30')](_0x419363[_0xd18d('0x41')],function(_0x56adc6){var _0x5e4636={};_0x5e4636[_0x56adc6]={'$like':'%'+_0x41ef5f[_0xd18d('0x3d')]['filter']+'%'};return _0x5e4636;})});}if(_0x41ef5f[_0xd18d('0x3d')]['$gte']){var _0x2fd624=_0x41ef5f[_0xd18d('0x3d')][_0xd18d('0x7b')][_0xd18d('0x33')](',');var _0xa86e68={};_0xa86e68[_0x2fd624[0x0]]={'$gte':moment(_0x2fd624[0x1])[_0xd18d('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x419363[_0xd18d('0x78')]=_[_0xd18d('0xb3')](_0x419363[_0xd18d('0x78')],_0xa86e68);}_0x419363=_[_0xd18d('0xb3')]({},_0x419363,_0x41ef5f[_0xd18d('0xb4')]);return db[_0xd18d('0xba')]['count']({'where':_0x419363[_0xd18d('0x78')]})[_0xd18d('0x2a')](function(_0xd1f94d){_0x233eb4[_0xd18d('0x24')]=_0xd1f94d;if(_0x41ef5f[_0xd18d('0x3d')][_0xd18d('0xb1')]){_0x419363[_0xd18d('0xb2')]=[{'all':!![]}];}return db[_0xd18d('0xba')][_0xd18d('0xbf')](_0x419363);})[_0xd18d('0x2a')](function(_0x5b76cc){_0x233eb4[_0xd18d('0xaf')]=_0x5b76cc;return _0x233eb4;});}})['then'](respondWithFilteredResult(_0x572455,_0x419363))[_0xd18d('0x36')](handleError(_0x572455,null));};exports['addTags']=function(_0x35200a,_0x24ebd4,_0x29ae76){return db[_0xd18d('0x38')]['find']({'where':{'id':_0x35200a[_0xd18d('0xb7')]['id']}})['then'](handleEntityNotFound(_0x24ebd4,null))[_0xd18d('0x2a')](function(_0x188e49){if(_0x188e49){return _0x188e49['setTags'](_0x35200a[_0xd18d('0x75')][_0xd18d('0xbb')],_[_0xd18d('0xc0')](_0x35200a[_0xd18d('0x75')],[_0xd18d('0xbb'),'id'])||{})[_0xd18d('0xc1')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x35200a[_0xd18d('0x75')][_0xd18d('0xbb')]}});})[_0xd18d('0x2a')](function(_0x451541){socket[_0xd18d('0xc2')]('smsInteractionTags:save',{'id':Number(_0x35200a[_0xd18d('0xb7')]['id']),'tags':_0x451541||[]});return{'id':Number(_0x35200a['params']['id']),'tags':_0x451541||[]};});}})[_0xd18d('0x2a')](respondWithResult(_0x24ebd4,null))['catch'](handleError(_0x24ebd4,null));};exports[_0xd18d('0xc3')]=function(_0x205c92,_0x34c2c9,_0x3e7c39){return db['SmsInteraction']['find']({'where':{'id':_0x205c92[_0xd18d('0xb7')]['id']}})[_0xd18d('0x2a')](handleEntityNotFound(_0x34c2c9,null))['then'](function(_0x15435d){if(_0x15435d){return _0x15435d[_0xd18d('0xc3')](_0x205c92[_0xd18d('0x3d')][_0xd18d('0xbb')]);}})[_0xd18d('0x2a')](respondWithStatusCode(_0x34c2c9,null))[_0xd18d('0x36')](handleError(_0x34c2c9,null));};exports[_0xd18d('0xc4')]=function(_0x30cf74,_0x1a18a7){var _0x23fd1f=moment()[_0xd18d('0xc5')]()[_0xd18d('0x9a')]();var _0x246629=path[_0xd18d('0xc6')](config[_0xd18d('0xc7')],_0xd18d('0xc8'),_0xd18d('0xc9'),_0xd18d('0xca'));var _0x28be87=path[_0xd18d('0xc6')](config[_0xd18d('0xc7')],_0xd18d('0xc8'),_0xd18d('0xc9'),_0xd18d('0xcb'));var _0x3d71f9=path[_0xd18d('0xc6')](_0x246629,_0x23fd1f);var _0x5a4018=util['format']('transcript-%d-%s.zip',_0x30cf74['params']['id'],_0x23fd1f);var _0x1e2fad=path[_0xd18d('0xc6')](_0x246629,_0x5a4018);var _0xb83a02=[];_0xb83a02[_0xd18d('0x35')]({'model':db[_0xd18d('0x71')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0xb83a02[_0xd18d('0x35')]({'model':db[_0xd18d('0xcc')],'as':_0xd18d('0x65'),'attributes':['id',_0xd18d('0xcd'),_0xd18d('0xce')],'raw':!![]});var _0x4aa80e=[{'model':db[_0xd18d('0xba')],'as':_0xd18d('0xcf'),'attributes':['id',_0xd18d('0x75'),_0xd18d('0xd0'),_0xd18d('0xd1'),_0xd18d('0xd2'),_0xd18d('0x80')],'include':_0xb83a02}];_0x4aa80e[_0xd18d('0x35')]({'model':db[_0xd18d('0xd3')],'as':_0xd18d('0xd4'),'attributes':['id',_0xd18d('0x69')]});_0x4aa80e[_0xd18d('0x35')]({'model':db[_0xd18d('0x71')],'as':_0xd18d('0xd5'),'attributes':['id',_0xd18d('0xd6')]});return db[_0xd18d('0x38')][_0xd18d('0x60')]({'where':{'id':_0x30cf74[_0xd18d('0xb7')]['id']},'include':_0x4aa80e})['then'](handleEntityNotFound(_0x1a18a7,null))[_0xd18d('0x2a')](function(_0x2a8aa2){if(_0x2a8aa2){var _0x2fe425=_0x2a8aa2[_0xd18d('0xd7')]({'plain':!![]});fs[_0xd18d('0xd8')](_0x3d71f9);var _0x2d04d7={'channel':'Sms','account':_0x2fe425[_0xd18d('0xd4')][_0xd18d('0x69')],'agent':_0x2fe425[_0xd18d('0xd5')]?_0x2fe425[_0xd18d('0xd5')][_0xd18d('0xd6')]:'N.A.','createdAt':moment(_0x2fe425[_0xd18d('0xd0')])[_0xd18d('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2fe425[_0xd18d('0xd9')]?moment(_0x2fe425[_0xd18d('0xda')])['format'](_0xd18d('0xdb'))[_0xd18d('0x9a')]():'','disposition':_0x2fe425['disposition'],'messages':_(_0x2fe425[_0xd18d('0xcf')])[_0xd18d('0x83')]({'secret':![]})[_0xd18d('0x30')](function(_0x5de1e1){return{'date':moment(_0x5de1e1['createdAt'])[_0xd18d('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd18d('0x9a')](),'sender':_0x5de1e1[_0xd18d('0xd1')]===_0xd18d('0xdc')?_0x5de1e1[_0xd18d('0x71')]?_0x5de1e1[_0xd18d('0x71')][_0xd18d('0xd6')]:_0xd18d('0xdd'):_0x5de1e1[_0xd18d('0x65')][_0xd18d('0xcd')]+(_0x5de1e1[_0xd18d('0x65')][_0xd18d('0xce')]?'\x20'+_0x5de1e1[_0xd18d('0x65')][_0xd18d('0xce')]:''),'body':_0x5de1e1[_0xd18d('0x75')],'direction':_0x5de1e1[_0xd18d('0xd1')]===_0xd18d('0xdc')?'A':'C','secret':_0x5de1e1['secret'],'read':_0x5de1e1[_0xd18d('0x80')]};})[_0xd18d('0x67')]()};return ejs[_0xd18d('0xde')](path[_0xd18d('0xc6')](config[_0xd18d('0xc7')],'server',_0xd18d('0xdf'),_0xd18d('0xe0')),{'interaction':_0x2d04d7})[_0xd18d('0x2a')](function(_0x369f99){var _0xe921d7=path[_0xd18d('0xc6')](_0x3d71f9,_0xd18d('0xe1')+_0x2fe425['id']+'-'+_0x23fd1f+'.pdf');var _0x5ba8eb={'path':_0xe921d7,'channel':'Sms','interactionId':_0x2fe425['id']};return pdf[_0xd18d('0xe2')](_0x369f99,_0x5ba8eb);})[_0xd18d('0x2a')](function(){return new BPromise(function(_0x2263f3,_0x79617c){zipdir(_0x3d71f9,{'saveTo':_0x1e2fad},function(_0x28e0e6,_0x51a8fb){if(_0x28e0e6)return _0x79617c(_0x28e0e6);return _0x2263f3(_0x51a8fb);});})['then'](function(){return new BPromise(function(_0x8f0de,_0x587a96){rimraf(_0x3d71f9,function(_0x3ca048){if(_0x3ca048)_0x587a96(_0x3ca048);return _0x8f0de();});});})[_0xd18d('0x2a')](function(){return _0x1a18a7[_0xd18d('0xc4')](_0x1e2fad,_0x5a4018,function(_0x22fd9f){if(_0x22fd9f){console[_0xd18d('0xe3')](_0xd18d('0xe4'),_0x22fd9f);}else{fs[_0xd18d('0xe5')](_0x1e2fad);}});});});}else{return _0x1a18a7[_0xd18d('0x1e')](0xc8);}})[_0xd18d('0x36')](handleError(_0x1a18a7,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 3a93110..9dd7031 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(_0x457fab,_0x40fb0f){var _0x3231bc=function(_0x1979e9){while(--_0x1979e9){_0x457fab['push'](_0x457fab['shift']());}};_0x3231bc(++_0x40fb0f);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2c4625,_0x17287c){_0x2c4625=_0x2c4625-0x0;var _0x2e421f=_0xe5af[_0x2c4625];return _0x2e421f;};'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 _0xd4a2=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x2de9c0,_0x2ae1f2){var _0x1c4daa=function(_0x56c941){while(--_0x56c941){_0x2de9c0['push'](_0x2de9c0['shift']());}};_0x1c4daa(++_0x2ae1f2);}(_0xd4a2,0x173));var _0x2d4a=function(_0x4b18e2,_0x35aad3){_0x4b18e2=_0x4b18e2-0x0;var _0x47fb19=_0xd4a2[_0x4b18e2];return _0x47fb19;};'use strict';var EventEmitter=require(_0x2d4a('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0x2d4a('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2d4a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d4a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x32af9e){return function(_0x40d744,_0x2624b5,_0x3a88e2){_0x40d744[_0x2d4a('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x45fefb){_0x40d744[_0x2d4a('0x5')](_0x2d4a('0x6'),_0x45fefb[_0x2d4a('0x7')](function(_0x3b8d7b){return{'id':_0x3b8d7b['id']};}));return SmsMessage[_0x2d4a('0x8')]({'where':{'SmsInteractionId':_0x40d744['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d4a('0x9')](function(_0x113839){_0x40d744[_0x2d4a('0x5')](_0x2d4a('0xa'),_0x113839[_0x2d4a('0xb')]);SmsInteractionEvents[_0x2d4a('0xc')](_0x32af9e+':'+_0x40d744['id'],_0x40d744);SmsInteractionEvents['emit'](_0x32af9e,_0x40d744);_0x3a88e2(null);})['catch'](_0x3a88e2(null));};}for(var e in events){if(events[_0x2d4a('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x2d4a('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c818b28..2b7ac79 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 _0x64d2=['rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2bfa88,_0xc64230){var _0x2e7039=function(_0x4b87cc){while(--_0x4b87cc){_0x2bfa88['push'](_0x2bfa88['shift']());}};_0x2e7039(++_0xc64230);}(_0x64d2,0x1a1));var _0x264d=function(_0x2cb870,_0x178ba3){_0x2cb870=_0x2cb870-0x0;var _0x559f67=_0x64d2[_0x2cb870];return _0x559f67;};'use strict';var _=require(_0x264d('0x0'));var util=require(_0x264d('0x1'));var logger=require(_0x264d('0x2'))(_0x264d('0x3'));var moment=require(_0x264d('0x4'));var BPromise=require(_0x264d('0x5'));var rp=require(_0x264d('0x6'));var fs=require('fs');var path=require(_0x264d('0x7'));var rimraf=require(_0x264d('0x8'));var config=require('../../config/environment');var attributes=require(_0x264d('0x9'));module[_0x264d('0xa')]=function(_0x423e34,_0x65f53f){return _0x423e34[_0x264d('0xb')](_0x264d('0xc'),attributes,{'tableName':_0x264d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50b612,_0x51ce62,_0x266cc2){if(_0x50b612[_0x264d('0xe')](_0x264d('0xf'))){_0x50b612[_0x264d('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x266cc2(null,_0x50b612);}}});}; \ No newline at end of file +var _0x7804=['request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','closed','closedAt','format','lodash','../../config/logger','api','moment','bluebird'];(function(_0x14d45f,_0x2d0dbb){var _0x176c80=function(_0x3c2046){while(--_0x3c2046){_0x14d45f['push'](_0x14d45f['shift']());}};_0x176c80(++_0x2d0dbb);}(_0x7804,0x1db));var _0x4780=function(_0x38e3f0,_0x1a3e04){_0x38e3f0=_0x38e3f0-0x0;var _0x31fa13=_0x7804[_0x38e3f0];return _0x31fa13;};'use strict';var _=require(_0x4780('0x0'));var util=require('util');var logger=require(_0x4780('0x1'))(_0x4780('0x2'));var moment=require(_0x4780('0x3'));var BPromise=require(_0x4780('0x4'));var rp=require(_0x4780('0x5'));var fs=require('fs');var path=require(_0x4780('0x6'));var rimraf=require(_0x4780('0x7'));var config=require(_0x4780('0x8'));var attributes=require(_0x4780('0x9'));module[_0x4780('0xa')]=function(_0x581f10,_0xb5b4b4){return _0x581f10[_0x4780('0xb')]('SmsInteraction',attributes,{'tableName':_0x4780('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x298f35,_0x526f5f,_0x36f3a1){if(_0x298f35['changed'](_0x4780('0xd'))){_0x298f35[_0x4780('0xe')]=moment()[_0x4780('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x36f3a1(null,_0x298f35);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ebb3d79..bc58c98 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 _0xd645=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsInteraction,\x20%s,\x20%s','message','request\x20sent','result','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','catch','AddTagsToSmsInteraction','ids','AddTags','lodash','util','moment'];(function(_0x2b4f95,_0x2f613e){var _0x2a52fc=function(_0x5cdef4){while(--_0x5cdef4){_0x2b4f95['push'](_0x2b4f95['shift']());}};_0x2a52fc(++_0x2f613e);}(_0xd645,0x1dd));var _0x5d64=function(_0xec4444,_0x3eac1d){_0xec4444=_0xec4444-0x0;var _0x3fd0fd=_0xd645[_0xec4444];return _0x3fd0fd;};'use strict';var _=require(_0x5d64('0x0'));var util=require(_0x5d64('0x1'));var moment=require(_0x5d64('0x2'));var BPromise=require(_0x5d64('0x3'));var rs=require(_0x5d64('0x4'));var fs=require('fs');var Redis=require(_0x5d64('0x5'));var db=require(_0x5d64('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d64('0x7'))(_0x5d64('0x8'));var config=require(_0x5d64('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5d64('0xa')][_0x5d64('0xb')]({'port':0x232a});config[_0x5d64('0xc')]=_[_0x5d64('0xd')](config[_0x5d64('0xc')],{'host':_0x5d64('0xe'),'port':0x18eb});var socket=require(_0x5d64('0xf'))(new Redis(config[_0x5d64('0xc')]));require('./smsInteraction.socket')[_0x5d64('0x10')](socket);function respondWithRpcPromise(_0x146dfc,_0x25fbcc,_0x6b069a){return new BPromise(function(_0x154011,_0x1f4992){return client['request'](_0x146dfc,_0x6b069a)[_0x5d64('0x11')](function(_0x4353de){logger[_0x5d64('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x25fbcc,'request\x20sent');logger[_0x5d64('0x13')](_0x5d64('0x14'),_0x25fbcc,'request\x20sent',JSON[_0x5d64('0x15')](_0x4353de));if(_0x4353de['error']){if(_0x4353de['error'][_0x5d64('0x16')]===0x1f4){logger[_0x5d64('0x17')](_0x5d64('0x18'),_0x25fbcc,_0x4353de[_0x5d64('0x17')][_0x5d64('0x19')]);return _0x1f4992(_0x4353de[_0x5d64('0x17')][_0x5d64('0x19')]);}logger[_0x5d64('0x17')](_0x5d64('0x18'),_0x25fbcc,_0x4353de[_0x5d64('0x17')]['message']);return _0x154011(_0x4353de[_0x5d64('0x17')][_0x5d64('0x19')]);}else{logger['info'](_0x5d64('0x18'),_0x25fbcc,_0x5d64('0x1a'));_0x154011(_0x4353de[_0x5d64('0x1b')]['message']);}})['catch'](function(_0x1eddb8){logger[_0x5d64('0x17')](_0x5d64('0x18'),_0x25fbcc,_0x1eddb8);_0x1f4992(_0x1eddb8);});});}exports[_0x5d64('0x1c')]=function(_0x417f6b){var _0x4554ba=this;return new Promise(function(_0x3f3dd0,_0x467b2a){return db[_0x5d64('0x1d')]['update'](_0x417f6b[_0x5d64('0x1e')],{'raw':_0x417f6b[_0x5d64('0x1f')]?_0x417f6b[_0x5d64('0x1f')][_0x5d64('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417f6b[_0x5d64('0x1f')]?_0x417f6b['options'][_0x5d64('0x21')]||null:null,'attributes':_0x417f6b[_0x5d64('0x1f')]?_0x417f6b['options'][_0x5d64('0x22')]||null:null,'limit':_0x417f6b['options']?_0x417f6b[_0x5d64('0x1f')][_0x5d64('0x23')]||null:null})[_0x5d64('0x11')](function(_0x255a71){logger[_0x5d64('0x12')](_0x5d64('0x1c'),_0x417f6b);logger[_0x5d64('0x13')](_0x5d64('0x1c'),_0x417f6b,JSON[_0x5d64('0x15')](_0x255a71));_0x3f3dd0(_0x255a71);})[_0x5d64('0x24')](function(_0x45ea97){logger['error'](_0x5d64('0x1c'),_0x45ea97['message'],_0x417f6b);_0x467b2a(_0x4554ba['error'](0x1f4,_0x45ea97['message']));});});};exports[_0x5d64('0x25')]=function(_0x2ffc48){return new Promise(function(_0x57520c,_0x2ad058){return db[_0x5d64('0x1d')]['find']({'where':_0x2ffc48['options']?_0x2ffc48[_0x5d64('0x1f')][_0x5d64('0x21')]||null:null})[_0x5d64('0x11')](function(_0x4b1b37){if(_0x4b1b37){return _0x4b1b37['addTags'](_0x2ffc48['body'][_0x5d64('0x26')],_['omit'](_0x2ffc48[_0x5d64('0x1e')],[_0x5d64('0x26'),'id'])||{});}})['spread'](function(_0x2e7672){logger['info'](_0x5d64('0x27'),_0x2ffc48);logger[_0x5d64('0x13')](_0x5d64('0x27'),_0x2ffc48,JSON[_0x5d64('0x15')](_0x2e7672));_0x57520c(_0x2e7672);})[_0x5d64('0x24')](function(_0x49bf03){logger[_0x5d64('0x17')]('AddTags',_0x49bf03['message'],_0x2ffc48);_0x2ad058(_this['error'](0x1f4,_0x49bf03[_0x5d64('0x19')]));});});}; \ No newline at end of file +var _0xe305=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsInteraction','update','body','options','raw','attributes','limit','UpdateSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x27a1a0,_0x410857){var _0x1321a0=function(_0x4d0991){while(--_0x4d0991){_0x27a1a0['push'](_0x27a1a0['shift']());}};_0x1321a0(++_0x410857);}(_0xe305,0x17d));var _0x5e30=function(_0x60241f,_0x520d53){_0x60241f=_0x60241f-0x0;var _0x4f9abd=_0xe305[_0x60241f];return _0x4f9abd;};'use strict';var _=require(_0x5e30('0x0'));var util=require(_0x5e30('0x1'));var moment=require(_0x5e30('0x2'));var BPromise=require(_0x5e30('0x3'));var rs=require(_0x5e30('0x4'));var fs=require('fs');var Redis=require(_0x5e30('0x5'));var db=require(_0x5e30('0x6'))['db'];var utils=require(_0x5e30('0x7'));var logger=require(_0x5e30('0x8'))('rpc');var config=require(_0x5e30('0x9'));var jayson=require(_0x5e30('0xa'));var client=jayson[_0x5e30('0xb')][_0x5e30('0xc')]({'port':0x232a});config[_0x5e30('0xd')]=_['defaults'](config[_0x5e30('0xd')],{'host':_0x5e30('0xe'),'port':0x18eb});var socket=require(_0x5e30('0xf'))(new Redis(config['redis']));require(_0x5e30('0x10'))[_0x5e30('0x11')](socket);function respondWithRpcPromise(_0xea48db,_0x1ecec5,_0x436f59){return new BPromise(function(_0x4bb41b,_0x27a46f){return client[_0x5e30('0x12')](_0xea48db,_0x436f59)[_0x5e30('0x13')](function(_0x2cc473){logger[_0x5e30('0x14')](_0x5e30('0x15'),_0x1ecec5,_0x5e30('0x16'));logger[_0x5e30('0x17')](_0x5e30('0x18'),_0x1ecec5,'request\x20sent',JSON[_0x5e30('0x19')](_0x2cc473));if(_0x2cc473[_0x5e30('0x1a')]){if(_0x2cc473[_0x5e30('0x1a')]['code']===0x1f4){logger['error'](_0x5e30('0x15'),_0x1ecec5,_0x2cc473[_0x5e30('0x1a')][_0x5e30('0x1b')]);return _0x27a46f(_0x2cc473[_0x5e30('0x1a')]['message']);}logger[_0x5e30('0x1a')](_0x5e30('0x15'),_0x1ecec5,_0x2cc473[_0x5e30('0x1a')]['message']);return _0x4bb41b(_0x2cc473[_0x5e30('0x1a')]['message']);}else{logger['info'](_0x5e30('0x15'),_0x1ecec5,_0x5e30('0x16'));_0x4bb41b(_0x2cc473[_0x5e30('0x1c')][_0x5e30('0x1b')]);}})[_0x5e30('0x1d')](function(_0x390164){logger[_0x5e30('0x1a')](_0x5e30('0x15'),_0x1ecec5,_0x390164);_0x27a46f(_0x390164);});});}exports['UpdateSmsInteraction']=function(_0x3348c5){var _0x5a08fc=this;return new Promise(function(_0x5be1fa,_0x167d10){return db[_0x5e30('0x1e')][_0x5e30('0x1f')](_0x3348c5[_0x5e30('0x20')],{'raw':_0x3348c5[_0x5e30('0x21')]?_0x3348c5[_0x5e30('0x21')][_0x5e30('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3348c5[_0x5e30('0x21')]?_0x3348c5['options']['where']||null:null,'attributes':_0x3348c5[_0x5e30('0x21')]?_0x3348c5['options'][_0x5e30('0x23')]||null:null,'limit':_0x3348c5['options']?_0x3348c5['options'][_0x5e30('0x24')]||null:null})[_0x5e30('0x13')](function(_0x4b4b11){logger[_0x5e30('0x14')](_0x5e30('0x25'),_0x3348c5);logger[_0x5e30('0x17')](_0x5e30('0x25'),_0x3348c5,JSON['stringify'](_0x4b4b11));_0x5be1fa(_0x4b4b11);})[_0x5e30('0x1d')](function(_0x2c2ba6){logger['error']('UpdateSmsInteraction',_0x2c2ba6[_0x5e30('0x1b')],_0x3348c5);_0x167d10(_0x5a08fc[_0x5e30('0x1a')](0x1f4,_0x2c2ba6[_0x5e30('0x1b')]));});});};exports['AddTagsToSmsInteraction']=function(_0x48f5a5){return new Promise(function(_0x2e4b8d,_0x8d3ed1){return db[_0x5e30('0x1e')][_0x5e30('0x26')]({'where':_0x48f5a5[_0x5e30('0x21')]?_0x48f5a5['options'][_0x5e30('0x27')]||null:null})['then'](function(_0x1b60dc){if(_0x1b60dc){return _0x1b60dc[_0x5e30('0x28')](_0x48f5a5[_0x5e30('0x20')][_0x5e30('0x29')],_[_0x5e30('0x2a')](_0x48f5a5[_0x5e30('0x20')],['ids','id'])||{});}})[_0x5e30('0x2b')](function(_0x2de0d3){logger[_0x5e30('0x14')](_0x5e30('0x2c'),_0x48f5a5);logger[_0x5e30('0x17')]('AddTags',_0x48f5a5,JSON[_0x5e30('0x19')](_0x2de0d3));_0x2e4b8d(_0x2de0d3);})[_0x5e30('0x1d')](function(_0x133e18){logger[_0x5e30('0x1a')]('AddTags',_0x133e18[_0x5e30('0x1b')],_0x48f5a5);_0x8d3ed1(_this['error'](0x1f4,_0x133e18[_0x5e30('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 48222c5..0ceab17 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 _0xb8ac=['remove','update','removeListener','register','length','./smsInteraction.events','save'];(function(_0x2c5bff,_0x35a34e){var _0x31c900=function(_0x544d3e){while(--_0x544d3e){_0x2c5bff['push'](_0x2c5bff['shift']());}};_0x31c900(++_0x35a34e);}(_0xb8ac,0x16a));var _0xcb8a=function(_0x45b609,_0x3ebc33){_0x45b609=_0x45b609-0x0;var _0x3331c4=_0xb8ac[_0x45b609];return _0x3331c4;};'use strict';var SmsInteractionEvents=require(_0xcb8a('0x0'));var events=[_0xcb8a('0x1'),_0xcb8a('0x2'),_0xcb8a('0x3')];function createListener(_0x9eaadb,_0x380863){return function(_0x27f114){_0x380863['emit'](_0x9eaadb,_0x27f114);};}function removeListener(_0x53bed4,_0x3be249){return function(){SmsInteractionEvents[_0xcb8a('0x4')](_0x53bed4,_0x3be249);};}exports[_0xcb8a('0x5')]=function(_0x546a49){for(var _0x12d3be=0x0,_0x3cba1d=events[_0xcb8a('0x6')];_0x12d3be<_0x3cba1d;_0x12d3be++){var _0x55ccad=events[_0x12d3be];var _0x24dfa1=createListener('smsInteraction:'+_0x55ccad,_0x546a49);SmsInteractionEvents['on'](_0x55ccad,_0x24dfa1);}}; \ No newline at end of file +var _0xb57e=['smsInteraction:','remove','update','emit','register'];(function(_0x1f5e5e,_0x3d553a){var _0x63e39c=function(_0x1fa447){while(--_0x1fa447){_0x1f5e5e['push'](_0x1f5e5e['shift']());}};_0x63e39c(++_0x3d553a);}(_0xb57e,0x1d2));var _0xeb57=function(_0x165277,_0x1f5fca){_0x165277=_0x165277-0x0;var _0x5eed91=_0xb57e[_0x165277];return _0x5eed91;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xeb57('0x0'),_0xeb57('0x1')];function createListener(_0x13b567,_0x7de9f1){return function(_0x24ac96){_0x7de9f1[_0xeb57('0x2')](_0x13b567,_0x24ac96);};}function removeListener(_0x582e90,_0x4a579e){return function(){SmsInteractionEvents['removeListener'](_0x582e90,_0x4a579e);};}exports[_0xeb57('0x3')]=function(_0x2364f5){for(var _0x46448a=0x0,_0x49fa35=events['length'];_0x46448a<_0x49fa35;_0x46448a++){var _0x13fc15=events[_0x46448a];var _0x2009e5=createListener(_0xeb57('0x4')+_0x13fc15,_0x2364f5);SmsInteractionEvents['on'](_0x13fc15,_0x2009e5);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c2c3e67..8ba0ebb 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 _0x693d=['fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1bfe15,_0x3c0217){var _0x14d767=function(_0x19853a){while(--_0x19853a){_0x1bfe15['push'](_0x1bfe15['shift']());}};_0x14d767(++_0x3c0217);}(_0x693d,0x68));var _0xd693=function(_0x4ca164,_0x453db6){_0x4ca164=_0x4ca164-0x0;var _0x18b051=_0x693d[_0x4ca164];return _0x18b051;};'use strict';var multer=require(_0xd693('0x0'));var util=require('util');var path=require(_0xd693('0x1'));var timeout=require(_0xd693('0x2'));var express=require(_0xd693('0x3'));var router=express['Router']();var fs_extra=require(_0xd693('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd693('0x5'));var config=require(_0xd693('0x6'));var controller=require(_0xd693('0x7'));router[_0xd693('0x8')]('/',auth[_0xd693('0x9')](),controller['index']);router['get'](_0xd693('0xa'),auth[_0xd693('0x9')](),controller[_0xd693('0xb')]);router[_0xd693('0x8')](_0xd693('0xc'),auth['isAuthenticated'](),controller[_0xd693('0xd')]);router['post']('/',auth[_0xd693('0x9')](),interaction['tracked'](_0xd693('0xe'),_0xd693('0xf')),controller[_0xd693('0x10')]);router['post'](_0xd693('0x11'),controller['status']);router[_0xd693('0x12')](_0xd693('0xc'),auth['isAuthenticated'](),controller[_0xd693('0x13')]);router['put'](_0xd693('0x14'),auth[_0xd693('0x9')](),controller[_0xd693('0x15')]);router[_0xd693('0x12')](_0xd693('0x16'),auth[_0xd693('0x9')](),controller[_0xd693('0x17')]);router[_0xd693('0x18')]('/:id',auth[_0xd693('0x9')](),controller[_0xd693('0x19')]);module[_0xd693('0x1a')]=router; \ No newline at end of file +var _0x4b0f=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','put'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x2b7c18,_0x1e914c){_0x2b7c18=_0x2b7c18-0x0;var _0x3ef88e=_0x4b0f[_0x2b7c18];return _0x3ef88e;};'use strict';var multer=require('multer');var util=require(_0xf4b0('0x0'));var path=require(_0xf4b0('0x1'));var timeout=require(_0xf4b0('0x2'));var express=require('express');var router=express[_0xf4b0('0x3')]();var fs_extra=require(_0xf4b0('0x4'));var auth=require(_0xf4b0('0x5'));var interaction=require(_0xf4b0('0x6'));var config=require(_0xf4b0('0x7'));var controller=require(_0xf4b0('0x8'));router[_0xf4b0('0x9')]('/',auth[_0xf4b0('0xa')](),controller[_0xf4b0('0xb')]);router[_0xf4b0('0x9')](_0xf4b0('0xc'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0xd')]);router[_0xf4b0('0x9')](_0xf4b0('0xe'),auth[_0xf4b0('0xa')](),controller['show']);router[_0xf4b0('0xf')]('/',auth[_0xf4b0('0xa')](),interaction[_0xf4b0('0x10')](_0xf4b0('0x11'),_0xf4b0('0x12')),controller[_0xf4b0('0x13')]);router[_0xf4b0('0xf')](_0xf4b0('0x14'),controller[_0xf4b0('0x15')]);router[_0xf4b0('0x16')](_0xf4b0('0xe'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x17')]);router[_0xf4b0('0x16')](_0xf4b0('0x18'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x19')]);router[_0xf4b0('0x16')](_0xf4b0('0x1a'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x1b')]);router[_0xf4b0('0x1c')]('/:id',auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x1d')]);module[_0xf4b0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 25da180..02a6947 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 _0x1b12=['sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x1b12,0x1b6));var _0x21b1=function(_0x1c9472,_0xb7a6e7){_0x1c9472=_0x1c9472-0x0;var _0x3c4637=_0x1b12[_0x1c9472];return _0x3c4637;};'use strict';var Sequelize=require(_0x21b1('0x0'));module['exports']={'body':{'type':Sequelize[_0x21b1('0x1')](_0x21b1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x21b1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x21b1('0x4')),'defaultValue':_0x21b1('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x21b1('0x5')](0xbe)},'phone':{'type':Sequelize[_0x21b1('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x21b1('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x21b1('0x5')]},'providerResponse':{'type':Sequelize[_0x21b1('0x1')]}}; \ No newline at end of file +var _0xc155=['TEXT','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x206fff,_0x39b961){var _0x3b0a5e=function(_0x1ec734){while(--_0x1ec734){_0x206fff['push'](_0x206fff['shift']());}};_0x3b0a5e(++_0x39b961);}(_0xc155,0x16a));var _0x5c15=function(_0x5b9f69,_0x51f0f1){_0x5b9f69=_0x5b9f69-0x0;var _0x4605bc=_0xc155[_0x5b9f69];return _0x4605bc;};'use strict';var Sequelize=require(_0x5c15('0x0'));module[_0x5c15('0x1')]={'body':{'type':Sequelize[_0x5c15('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5c15('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5c15('0x4')]('in',_0x5c15('0x5')),'defaultValue':_0x5c15('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c15('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5c15('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5c15('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5c15('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e9f098f..efab0e5 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 _0xa848=['infobip','results','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','rows','catch','show','params','include','options','find','create','body','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','internal','interface','channel','motionChannel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','Sequelize','SELECT','SIP/%s','event','rejectmessage','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status'];(function(_0x4ae3da,_0x5324c5){var _0x37e3b8=function(_0x2de352){while(--_0x2de352){_0x4ae3da['push'](_0x4ae3da['shift']());}};_0x37e3b8(++_0x5324c5);}(_0xa848,0x99));var _0x8a84=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa848[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x8a84('0x0'));var rimraf=require(_0x8a84('0x1'));var zipdir=require(_0x8a84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a84('0x3'));var moment=require(_0x8a84('0x4'));var BPromise=require(_0x8a84('0x5'));var Mustache=require(_0x8a84('0x6'));var util=require(_0x8a84('0x7'));var path=require(_0x8a84('0x8'));var sox=require(_0x8a84('0x9'));var csv=require(_0x8a84('0xa'));var ejs=require(_0x8a84('0xb'));var fs=require('fs');var fs_extra=require(_0x8a84('0xc'));var _=require(_0x8a84('0xd'));var squel=require(_0x8a84('0xe'));var crypto=require(_0x8a84('0xf'));var jsforce=require(_0x8a84('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8a84('0xa'));var querystring=require(_0x8a84('0x11'));var Papa=require(_0x8a84('0x12'));var Redis=require('ioredis');var authService=require(_0x8a84('0x13'));var qs=require(_0x8a84('0x14'));var as=require(_0x8a84('0x15'));var hardwareService=require(_0x8a84('0x16'));var logger=require(_0x8a84('0x17'))(_0x8a84('0x18'));var utils=require(_0x8a84('0x19'));var config=require(_0x8a84('0x1a'));var licenseUtil=require(_0x8a84('0x1b'));var db=require(_0x8a84('0x1c'))['db'];config[_0x8a84('0x1d')]=_[_0x8a84('0x1e')](config['redis'],{'host':_0x8a84('0x1f'),'port':0x18eb});var socket=require(_0x8a84('0x20'))(new Redis(config[_0x8a84('0x1d')]));require('./smsMessage.socket')[_0x8a84('0x21')](socket);var jayson=require(_0x8a84('0x22'));var client=jayson[_0x8a84('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x8a84('0x23')][_0x8a84('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x50a338,_0x44144a,_0x335f65,_0x9e386a){return new BPromise(function(_0x209516,_0x586e71){var _0x70847=_0x9e386a||client;return _0x70847[_0x8a84('0x25')](_0x50a338,_0x335f65)[_0x8a84('0x26')](function(_0x3dbca9){logger[_0x8a84('0x27')](_0x8a84('0x28'),_0x44144a,'request\x20sent');logger[_0x8a84('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44144a,_0x8a84('0x2a'),JSON['stringify'](_0x3dbca9));if(_0x3dbca9[_0x8a84('0x2b')]){if(_0x3dbca9[_0x8a84('0x2b')][_0x8a84('0x2c')]===0x1f4){logger['error'](_0x8a84('0x28'),_0x44144a,_0x3dbca9[_0x8a84('0x2b')][_0x8a84('0x2d')]);return _0x586e71(_0x3dbca9[_0x8a84('0x2b')][_0x8a84('0x2d')]);}logger['error'](_0x8a84('0x28'),_0x44144a,_0x3dbca9[_0x8a84('0x2b')][_0x8a84('0x2d')]);return _0x209516(_0x3dbca9[_0x8a84('0x2b')][_0x8a84('0x2d')]);}else{logger['info'](_0x8a84('0x28'),_0x44144a,_0x8a84('0x2a'));_0x209516(_0x3dbca9[_0x8a84('0x2e')][_0x8a84('0x2d')]);}})['catch'](function(_0x34b0dd){logger[_0x8a84('0x2b')](_0x8a84('0x28'),_0x44144a,_0x34b0dd);_0x586e71(_0x34b0dd);});});}function respondWithStatusCode(_0x34e448,_0x4a9f05){_0x4a9f05=_0x4a9f05||0xcc;return function(_0x5060f4){if(_0x5060f4){return _0x34e448['sendStatus'](_0x4a9f05);}return _0x34e448[_0x8a84('0x2f')](_0x4a9f05)[_0x8a84('0x30')]();};}function respondWithResult(_0x5520bf,_0x3f6337){_0x3f6337=_0x3f6337||0xc8;return function(_0x50c80b){if(_0x50c80b){return _0x5520bf['status'](_0x3f6337)['json'](_0x50c80b);}};}function respondWithFilteredResult(_0x4940af,_0x482067){return function(_0x141921){if(_0x141921){var _0x3083c0=typeof _0x482067[_0x8a84('0x31')]===_0x8a84('0x32')&&typeof _0x482067[_0x8a84('0x33')]==='undefined';var _0x2df556=_0x141921[_0x8a84('0x34')];var _0x50db30=_0x3083c0?0x0:_0x482067[_0x8a84('0x31')];var _0x5338eb=_0x3083c0?_0x141921['count']:_0x482067[_0x8a84('0x31')]+_0x482067[_0x8a84('0x33')];var _0x150d4a;if(_0x5338eb>=_0x2df556){_0x5338eb=_0x2df556;_0x150d4a=0xc8;}else{_0x150d4a=0xce;}_0x4940af[_0x8a84('0x2f')](_0x150d4a);return _0x4940af[_0x8a84('0x35')](_0x8a84('0x36'),_0x50db30+'-'+_0x5338eb+'/'+_0x2df556)[_0x8a84('0x37')](_0x141921);}return null;};}function patchUpdates(_0x572789){return function(_0x4cd479){try{jsonpatch[_0x8a84('0x38')](_0x4cd479,_0x572789,!![]);}catch(_0x4b2ab3){return BPromise[_0x8a84('0x39')](_0x4b2ab3);}return _0x4cd479[_0x8a84('0x3a')]();};}function saveUpdates(_0x25908d,_0x30f585){return function(_0x4e1889){if(_0x4e1889){return _0x4e1889[_0x8a84('0x3b')](_0x25908d)[_0x8a84('0x26')](function(_0x140d90){return _0x140d90;});}return null;};}function removeEntity(_0x4aa3bb,_0x227eb6){return function(_0xdc899){if(_0xdc899){return _0xdc899[_0x8a84('0x3c')]()['then'](function(){_0x4aa3bb[_0x8a84('0x2f')](0xcc)[_0x8a84('0x30')]();});}};}function handleEntityNotFound(_0x2a2e80,_0x22dcbb){return function(_0x28142d){if(!_0x28142d){_0x2a2e80[_0x8a84('0x3d')](0x194);}return _0x28142d;};}function handleError(_0x18c0d8,_0xe8d9c5){_0xe8d9c5=_0xe8d9c5||0x1f4;return function(_0x5b81d6){logger[_0x8a84('0x2b')](_0x5b81d6[_0x8a84('0x3e')]);if(_0x5b81d6[_0x8a84('0x3f')]){delete _0x5b81d6[_0x8a84('0x3f')];}_0x18c0d8[_0x8a84('0x2f')](_0xe8d9c5)['send'](_0x5b81d6);};}exports['index']=function(_0x166855,_0x2c54eb){var _0x437411={},_0x1f8454={},_0x37f51={'count':0x0,'rows':[]};var _0x5f5902=_[_0x8a84('0x40')](db[_0x8a84('0x41')][_0x8a84('0x42')],function(_0x4f1691){return{'name':_0x4f1691[_0x8a84('0x43')],'type':_0x4f1691[_0x8a84('0x44')][_0x8a84('0x45')]};});_0x1f8454[_0x8a84('0x46')]=_['map'](_0x5f5902,'name');_0x1f8454['query']=_[_0x8a84('0x47')](_0x166855[_0x8a84('0x48')]);_0x1f8454['filters']=_[_0x8a84('0x49')](_0x1f8454[_0x8a84('0x46')],_0x1f8454['query']);_0x437411[_0x8a84('0x4a')]=_[_0x8a84('0x49')](_0x1f8454[_0x8a84('0x46')],qs[_0x8a84('0x4b')](_0x166855[_0x8a84('0x48')][_0x8a84('0x4b')]));_0x437411[_0x8a84('0x4a')]=_0x437411['attributes'][_0x8a84('0x4c')]?_0x437411['attributes']:_0x1f8454[_0x8a84('0x46')];if(!_0x166855['query']['hasOwnProperty'](_0x8a84('0x4d'))){_0x437411[_0x8a84('0x33')]=qs[_0x8a84('0x33')](_0x166855['query'][_0x8a84('0x33')]);_0x437411[_0x8a84('0x31')]=qs[_0x8a84('0x31')](_0x166855[_0x8a84('0x48')]['offset']);}_0x437411[_0x8a84('0x4e')]=qs[_0x8a84('0x4f')](_0x166855[_0x8a84('0x48')][_0x8a84('0x4f')]);_0x437411[_0x8a84('0x50')]=qs[_0x8a84('0x51')](_[_0x8a84('0x52')](_0x166855[_0x8a84('0x48')],_0x1f8454[_0x8a84('0x51')]),_0x5f5902);if(_0x166855['query']['filter']){_0x437411['where']=_[_0x8a84('0x53')](_0x437411[_0x8a84('0x50')],{'$or':_[_0x8a84('0x40')](_0x5f5902,function(_0x5dd8dd){if(_0x5dd8dd[_0x8a84('0x44')]!=='VIRTUAL'){var _0x5e7113={};_0x5e7113[_0x5dd8dd[_0x8a84('0x3f')]]={'$like':'%'+_0x166855['query'][_0x8a84('0x54')]+'%'};return _0x5e7113;}})});}_0x437411=_[_0x8a84('0x53')]({},_0x437411,_0x166855['options']);var _0x31ba3e={'where':_0x437411[_0x8a84('0x50')]};return db[_0x8a84('0x41')][_0x8a84('0x34')](_0x31ba3e)['then'](function(_0x2274b0){_0x37f51[_0x8a84('0x34')]=_0x2274b0;if(_0x166855[_0x8a84('0x48')][_0x8a84('0x55')]){_0x437411['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x437411);})['then'](function(_0x5e87c9){_0x37f51[_0x8a84('0x56')]=_0x5e87c9;return _0x37f51;})[_0x8a84('0x26')](respondWithFilteredResult(_0x2c54eb,_0x437411))[_0x8a84('0x57')](handleError(_0x2c54eb,null));};exports[_0x8a84('0x58')]=function(_0x3a56ac,_0x5e4c48){var _0x3c3519={'raw':!![],'where':{'id':_0x3a56ac[_0x8a84('0x59')]['id']}},_0x59e840={};_0x59e840[_0x8a84('0x46')]=_[_0x8a84('0x47')](db['SmsMessage'][_0x8a84('0x42')]);_0x59e840[_0x8a84('0x48')]=_[_0x8a84('0x47')](_0x3a56ac[_0x8a84('0x48')]);_0x59e840['filters']=_[_0x8a84('0x49')](_0x59e840['model'],_0x59e840['query']);_0x3c3519[_0x8a84('0x4a')]=_['intersection'](_0x59e840[_0x8a84('0x46')],qs[_0x8a84('0x4b')](_0x3a56ac['query']['fields']));_0x3c3519['attributes']=_0x3c3519['attributes'][_0x8a84('0x4c')]?_0x3c3519['attributes']:_0x59e840[_0x8a84('0x46')];if(_0x3a56ac[_0x8a84('0x48')][_0x8a84('0x55')]){_0x3c3519[_0x8a84('0x5a')]=[{'all':!![]}];}_0x3c3519=_[_0x8a84('0x53')]({},_0x3c3519,_0x3a56ac[_0x8a84('0x5b')]);return db[_0x8a84('0x41')][_0x8a84('0x5c')](_0x3c3519)['then'](handleEntityNotFound(_0x5e4c48,null))[_0x8a84('0x26')](respondWithResult(_0x5e4c48,null))['catch'](handleError(_0x5e4c48,null));};exports[_0x8a84('0x5d')]=function(_0x1776cc,_0x5f3088){return db[_0x8a84('0x41')][_0x8a84('0x5d')](_0x1776cc['body'],{})['then'](respondWithResult(_0x5f3088,0xc9))[_0x8a84('0x57')](handleError(_0x5f3088,null));};exports[_0x8a84('0x3b')]=function(_0xdaf79c,_0x5af98d){if(_0xdaf79c[_0x8a84('0x5e')]['id']){delete _0xdaf79c[_0x8a84('0x5e')]['id'];}return db[_0x8a84('0x41')][_0x8a84('0x5c')]({'where':{'id':_0xdaf79c[_0x8a84('0x59')]['id']}})[_0x8a84('0x26')](handleEntityNotFound(_0x5af98d,null))[_0x8a84('0x26')](saveUpdates(_0xdaf79c[_0x8a84('0x5e')],null))[_0x8a84('0x26')](respondWithResult(_0x5af98d,null))[_0x8a84('0x57')](handleError(_0x5af98d,null));};exports[_0x8a84('0x3c')]=function(_0x504352,_0x173085){return db[_0x8a84('0x41')][_0x8a84('0x5c')]({'where':{'id':_0x504352[_0x8a84('0x59')]['id']}})[_0x8a84('0x26')](handleEntityNotFound(_0x173085,null))[_0x8a84('0x26')](removeEntity(_0x173085,null))['catch'](handleError(_0x173085,null));};exports[_0x8a84('0x5f')]=function(_0x26269a,_0x1e1a24){return db[_0x8a84('0x41')][_0x8a84('0x5f')]()[_0x8a84('0x26')](respondWithResult(_0x1e1a24,null))[_0x8a84('0x57')](handleError(_0x1e1a24,null));};var interaction_log=require(_0x8a84('0x17'))(_0x8a84('0x60'));exports[_0x8a84('0x61')]=function(_0x9dd223,_0x3a9cdd,_0xf3d190){var _0x54080d={'agent':{},'channel':_0x8a84('0x62')};if(_0x9dd223['body']['id']){delete _0x9dd223[_0x8a84('0x5e')]['id'];}_0x9dd223[_0x8a84('0x5e')]['read']=!![];_0x9dd223[_0x8a84('0x5e')][_0x8a84('0x63')]=moment()['format'](_0x8a84('0x64'));_0x9dd223['body'][_0x8a84('0x65')]=_0x9dd223['body'][_0x8a84('0x65')]||_0x9dd223[_0x8a84('0x66')]['id'];_0x54080d[_0x8a84('0x67')]['id']=_0x9dd223[_0x8a84('0x5e')]['UserId'];return db[_0x8a84('0x41')]['find']({'where':{'id':_0x9dd223[_0x8a84('0x59')]['id'],'UserId':null}})[_0x8a84('0x26')](handleEntityNotFound(_0x3a9cdd,null))[_0x8a84('0x26')](saveUpdates(_0x9dd223[_0x8a84('0x5e')],null))['then'](function(_0x2c7428){if(_0x2c7428){_0x54080d[_0x8a84('0x2d')]=_0x2c7428[_0x8a84('0x68')]({'plain':!![]});return db[_0x8a84('0x69')]['find']({'where':{'id':_0x2c7428['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3a9cdd,null))['then'](function(_0xf737ae){if(_0xf737ae){return _0xf737ae[_0x8a84('0x3b')]({'UserId':_0x9dd223[_0x8a84('0x5e')]['UserId'],'read1stAt':_[_0x8a84('0x6a')](_0xf737ae['read1stAt'])?moment()[_0x8a84('0x6b')](_0x8a84('0x64')):undefined});}return null;})[_0x8a84('0x26')](function(_0x4f5b67){if(_0x4f5b67){_0x54080d['interaction']=_0x4f5b67['get']({'plain':!![]});interaction_log[_0x8a84('0x27')](_0x8a84('0x6c'),_0x9dd223['user']['id'],_0x9dd223[_0x8a84('0x66')]['name'],_0x9dd223['user'][_0x8a84('0x6d')],_0x54080d[_0x8a84('0x6e')]['id'],_0x9dd223[_0x8a84('0x5e')]?JSON[_0x8a84('0x6f')](_0x9dd223[_0x8a84('0x5e')]):'null');return respondWithRpcPromise(_0x8a84('0x70'),_0x8a84('0x71'),_0x54080d);}return null;})[_0x8a84('0x26')](function(_0x5255f3){var _0x2797c6=_0x8a84('0x72')+_0x5255f3[_0x8a84('0x2d')]['ContactId'];return db[_0x8a84('0x73')][_0x8a84('0x48')](_0x2797c6,{'type':db['Sequelize'][_0x8a84('0x74')]['SELECT'],'raw':!![]})[_0x8a84('0x26')](function(_0x2c4403){return _0x2c4403;});})['then'](function(_0x352aaf){if(_0x352aaf){_0x54080d[_0x8a84('0x2d')][_0x8a84('0x75')]=_0x352aaf[0x0];if(!_0x9dd223[_0x8a84('0x5e')][_0x8a84('0x65')])return;return db[_0x8a84('0x76')]['find']({'where':{'id':_0x9dd223[_0x8a84('0x5e')][_0x8a84('0x65')],'role':_0x8a84('0x67')},'attributes':['id',_0x8a84('0x3f'),_0x8a84('0x77'),'email',_0x8a84('0x78')],'raw':!![]});}return null;})[_0x8a84('0x26')](function(_0x41337c){if(!_0x41337c)return null;_0x54080d[_0x8a84('0x2d')]['agent']=_0x41337c;return _0x54080d;})['then'](function(_0x1a85d0){if(_0x1a85d0){if(_0x9dd223[_0x8a84('0x5e')]['manual']){_0x54080d[_0x8a84('0x2d')][_0x8a84('0x79')]=util['format']('SIP/%s',_0x9dd223[_0x8a84('0x66')][_0x8a84('0x3f')]);_0x54080d[_0x8a84('0x2d')][_0x8a84('0x7a')]=_0x54080d[_0x8a84('0x7a')];_0x54080d['message'][_0x8a84('0x7b')]=_0x54080d[_0x8a84('0x7a')];_0x54080d['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x8a84('0x7c'),{'event':_0x8a84('0x7d'),'message':_0x54080d[_0x8a84('0x2d')]},client9002)[_0x8a84('0x26')](function(){return _0x54080d;});}return _0x54080d;}return null;})['then'](respondWithResult(_0x3a9cdd,null))[_0x8a84('0x57')](handleError(_0x3a9cdd,null));};var interaction_log=require('../../config/logger')(_0x8a84('0x60'));exports[_0x8a84('0x39')]=function(_0x14e48c,_0x5d9492,_0x5b3dcb){var _0x2792c8={'agent':{},'channel':_0x8a84('0x62')};if(_0x14e48c[_0x8a84('0x5e')]['id']){delete _0x14e48c[_0x8a84('0x5e')]['id'];}_0x14e48c[_0x8a84('0x5e')][_0x8a84('0x65')]=_0x14e48c[_0x8a84('0x5e')]['UserId']||_0x14e48c[_0x8a84('0x66')]['id'];_0x2792c8['agent']['id']=_0x14e48c[_0x8a84('0x5e')][_0x8a84('0x65')];return db[_0x8a84('0x41')][_0x8a84('0x5c')]({'where':{'id':_0x14e48c[_0x8a84('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d9492,null))[_0x8a84('0x26')](function(_0x49712d){if(_0x49712d){_0x2792c8[_0x8a84('0x2d')]=_0x49712d[_0x8a84('0x68')]({'plain':!![]});return db[_0x8a84('0x69')][_0x8a84('0x5c')]({'where':{'id':_0x49712d['SmsInteractionId']}});}return null;})[_0x8a84('0x26')](handleEntityNotFound(_0x5d9492,null))[_0x8a84('0x26')](function(_0x24f154){if(_0x24f154){_0x2792c8[_0x8a84('0x6e')]=_0x24f154[_0x8a84('0x68')]({'plain':!![]});interaction_log['info'](_0x8a84('0x7e'),_0x14e48c['user']['id'],_0x14e48c[_0x8a84('0x66')][_0x8a84('0x3f')],_0x14e48c[_0x8a84('0x66')][_0x8a84('0x6d')],_0x2792c8[_0x8a84('0x6e')]['id'],_0x14e48c[_0x8a84('0x5e')]?JSON[_0x8a84('0x6f')](_0x14e48c[_0x8a84('0x5e')]):_0x8a84('0x7f'));return respondWithRpcPromise(_0x8a84('0x80'),_0x8a84('0x81'),_0x2792c8);}return null;})[_0x8a84('0x26')](function(_0x422b42){var _0x16dd9b=_0x8a84('0x72')+_0x422b42[_0x8a84('0x2d')][_0x8a84('0x82')];return db[_0x8a84('0x73')][_0x8a84('0x48')](_0x16dd9b,{'type':db[_0x8a84('0x83')][_0x8a84('0x74')][_0x8a84('0x84')],'raw':!![]})['then'](function(_0x1b880a){return _0x1b880a;});})[_0x8a84('0x26')](function(_0xc9f6bf){if(_0xc9f6bf){_0x2792c8[_0x8a84('0x2d')][_0x8a84('0x75')]=_0xc9f6bf[0x0];if(!_0x14e48c[_0x8a84('0x5e')][_0x8a84('0x65')])return;return db[_0x8a84('0x76')][_0x8a84('0x5c')]({'where':{'id':_0x14e48c[_0x8a84('0x5e')][_0x8a84('0x65')],'role':_0x8a84('0x67')},'attributes':['id',_0x8a84('0x3f'),_0x8a84('0x77'),'email',_0x8a84('0x78')],'raw':!![]});}return null;})['then'](function(_0x25487b){if(!_0x25487b)return null;_0x2792c8[_0x8a84('0x2d')][_0x8a84('0x67')]=_0x25487b;return _0x2792c8;})[_0x8a84('0x26')](function(_0x1ba114){if(_0x1ba114){_0x1ba114[_0x8a84('0x2d')]['interface']=util[_0x8a84('0x6b')](_0x8a84('0x85'),_0x14e48c['user'][_0x8a84('0x3f')]);_0x1ba114['message'][_0x8a84('0x7a')]=_0x2792c8[_0x8a84('0x7a')];_0x1ba114['message']['motionChannel']=_0x2792c8[_0x8a84('0x7a')];_0x1ba114['message'][_0x8a84('0x86')]=_0x8a84('0x39');respondWithRpcPromise(_0x8a84('0x7c'),'EventManager',{'event':_0x8a84('0x87'),'message':_0x1ba114['message']},client9002);return _0x2792c8;}return null;})['then'](respondWithResult(_0x5d9492,null))['catch'](handleError(_0x5d9492,null));};exports[_0x8a84('0x2f')]=function(_0x4426d8,_0x244216,_0x105533){if(_0x4426d8['body']['id']){delete _0x4426d8['body']['id'];}var _0x1bfced;return db['SmsMessage'][_0x8a84('0x5c')]({'where':{'id':_0x4426d8[_0x8a84('0x59')]['id']}})[_0x8a84('0x26')](handleEntityNotFound(_0x244216,null))[_0x8a84('0x26')](function(_0x4404f9){if(_0x4404f9){_0x1bfced=_0x4404f9;return db['SmsAccount'][_0x8a84('0x5c')]({'where':{'id':_0x4404f9['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x244216,null))[_0x8a84('0x26')](function(_0x4979f9){if(_0x4979f9){logger[_0x8a84('0x29')](_0x8a84('0x88'),_0x8a84('0x2f'),'received\x20delivery\x20report\x20from',_0x4979f9['type'],util[_0x8a84('0x89')](_0x4426d8[_0x8a84('0x5e')],{'showHidden':![],'depth':null}));switch(_0x4979f9[_0x8a84('0x44')]){case _0x8a84('0x8a'):if(_0x4426d8[_0x8a84('0x5e')][_0x8a84('0x8b')]&&_0x4426d8[_0x8a84('0x5e')][_0x8a84('0x8b')]===_0x1bfced[_0x8a84('0x8c')]){return _0x1bfced[_0x8a84('0x3b')]({'read':!![]});}else{logger['error'](_0x8a84('0x8d'),_0x8a84('0x2f'),_0x8a84('0x8a'),util['inspect'](_0x4426d8[_0x8a84('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x8a84('0x8e'):if(_0x4426d8[_0x8a84('0x5e')][_0x8a84('0x8f')]&&_0x4426d8['body'][_0x8a84('0x8f')]===_0x1bfced['messageId']&&_['indexOf']([_0x8a84('0x90'),_0x8a84('0x91')],_0x4426d8[_0x8a84('0x5e')][_0x8a84('0x92')])>=0x0){return _0x1bfced[_0x8a84('0x3b')]({'read':!![]});}else{logger[_0x8a84('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8a84('0x2f'),'plivio',util[_0x8a84('0x89')](_0x4426d8['body'],{'showHidden':![],'depth':null}));}break;case _0x8a84('0x93'):var _0x3636da=_0x4426d8[_0x8a84('0x5e')][_0x8a84('0x94')][0x0];if(_0x3636da[_0x8a84('0x2f')]['groupName']===_0x8a84('0x95')){return _0x1bfced[_0x8a84('0x3b')]({'read':!![]});}else{logger[_0x8a84('0x2b')](_0x8a84('0x8d'),_0x8a84('0x2f'),'infobip',util[_0x8a84('0x89')](_0x4426d8['body'],{'showHidden':![],'depth':null}));}break;}return _0x1bfced;}})[_0x8a84('0x26')](respondWithResult(_0x244216,null))[_0x8a84('0x57')](handleError(_0x244216,null));}; \ No newline at end of file +var _0xb7f0=['AcceptMessage','acceptMessage','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','User','interface','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','SmsMessage','rows','catch','show','params','include','find','create','body','destroy','describe','sms-interactions','sms','read','readAt','format','UserId','user','agent','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null'];(function(_0x413f0d,_0xa334ab){var _0x5a16f5=function(_0x3a1266){while(--_0x3a1266){_0x413f0d['push'](_0x413f0d['shift']());}};_0x5a16f5(++_0xa334ab);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x24243b,_0x55c567){_0x24243b=_0x24243b-0x0;var _0x1a85ce=_0xb7f0[_0x24243b];return _0x1a85ce;};'use strict';var emlformat=require(_0x0b7f('0x0'));var rimraf=require(_0x0b7f('0x1'));var zipdir=require(_0x0b7f('0x2'));var jsonpatch=require(_0x0b7f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0b7f('0x4'));var Mustache=require(_0x0b7f('0x5'));var util=require(_0x0b7f('0x6'));var path=require(_0x0b7f('0x7'));var sox=require(_0x0b7f('0x8'));var csv=require(_0x0b7f('0x9'));var ejs=require(_0x0b7f('0xa'));var fs=require('fs');var fs_extra=require(_0x0b7f('0xb'));var _=require(_0x0b7f('0xc'));var squel=require(_0x0b7f('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b7f('0xe'));var deskjs=require(_0x0b7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0b7f('0x10'));var Papa=require(_0x0b7f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b7f('0x12'));var hardwareService=require(_0x0b7f('0x13'));var logger=require(_0x0b7f('0x14'))(_0x0b7f('0x15'));var utils=require(_0x0b7f('0x16'));var config=require(_0x0b7f('0x17'));var licenseUtil=require(_0x0b7f('0x18'));var db=require(_0x0b7f('0x19'))['db'];config[_0x0b7f('0x1a')]=_[_0x0b7f('0x1b')](config[_0x0b7f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b7f('0x1c'))(new Redis(config[_0x0b7f('0x1a')]));require(_0x0b7f('0x1d'))[_0x0b7f('0x1e')](socket);var jayson=require(_0x0b7f('0x1f'));var client=jayson[_0x0b7f('0x20')][_0x0b7f('0x21')]({'port':0x232c});var client9002=jayson[_0x0b7f('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20e15d,_0x1d223f,_0x4667b2,_0x25e93f){return new BPromise(function(_0x58c901,_0x355fdd){var _0x3f6463=_0x25e93f||client;return _0x3f6463[_0x0b7f('0x22')](_0x20e15d,_0x4667b2)[_0x0b7f('0x23')](function(_0x166520){logger['info'](_0x0b7f('0x24'),_0x1d223f,'request\x20sent');logger['debug'](_0x0b7f('0x25'),_0x1d223f,_0x0b7f('0x26'),JSON[_0x0b7f('0x27')](_0x166520));if(_0x166520[_0x0b7f('0x28')]){if(_0x166520[_0x0b7f('0x28')]['code']===0x1f4){logger['error'](_0x0b7f('0x24'),_0x1d223f,_0x166520[_0x0b7f('0x28')][_0x0b7f('0x29')]);return _0x355fdd(_0x166520['error'][_0x0b7f('0x29')]);}logger[_0x0b7f('0x28')](_0x0b7f('0x24'),_0x1d223f,_0x166520[_0x0b7f('0x28')][_0x0b7f('0x29')]);return _0x58c901(_0x166520[_0x0b7f('0x28')][_0x0b7f('0x29')]);}else{logger[_0x0b7f('0x2a')](_0x0b7f('0x24'),_0x1d223f,'request\x20sent');_0x58c901(_0x166520[_0x0b7f('0x2b')][_0x0b7f('0x29')]);}})['catch'](function(_0x50776a){logger['error'](_0x0b7f('0x24'),_0x1d223f,_0x50776a);_0x355fdd(_0x50776a);});});}function respondWithStatusCode(_0x4e9a0a,_0x4e61be){_0x4e61be=_0x4e61be||0xcc;return function(_0xd3cb99){if(_0xd3cb99){return _0x4e9a0a[_0x0b7f('0x2c')](_0x4e61be);}return _0x4e9a0a[_0x0b7f('0x2d')](_0x4e61be)[_0x0b7f('0x2e')]();};}function respondWithResult(_0x3fc2f0,_0x6d31ba){_0x6d31ba=_0x6d31ba||0xc8;return function(_0x1b8e19){if(_0x1b8e19){return _0x3fc2f0[_0x0b7f('0x2d')](_0x6d31ba)[_0x0b7f('0x2f')](_0x1b8e19);}};}function respondWithFilteredResult(_0x4ae467,_0x599bae){return function(_0x4ada58){if(_0x4ada58){var _0x3ea675=typeof _0x599bae['offset']===_0x0b7f('0x30')&&typeof _0x599bae[_0x0b7f('0x31')]===_0x0b7f('0x30');var _0xe06fa9=_0x4ada58[_0x0b7f('0x32')];var _0x2df0c6=_0x3ea675?0x0:_0x599bae[_0x0b7f('0x33')];var _0x5ca44b=_0x3ea675?_0x4ada58['count']:_0x599bae[_0x0b7f('0x33')]+_0x599bae['limit'];var _0x1201a8;if(_0x5ca44b>=_0xe06fa9){_0x5ca44b=_0xe06fa9;_0x1201a8=0xc8;}else{_0x1201a8=0xce;}_0x4ae467[_0x0b7f('0x2d')](_0x1201a8);return _0x4ae467[_0x0b7f('0x34')](_0x0b7f('0x35'),_0x2df0c6+'-'+_0x5ca44b+'/'+_0xe06fa9)[_0x0b7f('0x2f')](_0x4ada58);}return null;};}function patchUpdates(_0x1f99b9){return function(_0x2fbdce){try{jsonpatch[_0x0b7f('0x36')](_0x2fbdce,_0x1f99b9,!![]);}catch(_0xd90801){return BPromise['reject'](_0xd90801);}return _0x2fbdce['save']();};}function saveUpdates(_0xdc4e14,_0x22c4ba){return function(_0x2fde42){if(_0x2fde42){return _0x2fde42[_0x0b7f('0x37')](_0xdc4e14)[_0x0b7f('0x23')](function(_0x1947b3){return _0x1947b3;});}return null;};}function removeEntity(_0xf6de1b,_0x1225fd){return function(_0x316aaa){if(_0x316aaa){return _0x316aaa['destroy']()['then'](function(){_0xf6de1b[_0x0b7f('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c410,_0x5cded6){return function(_0x346c31){if(!_0x346c31){_0x10c410[_0x0b7f('0x2c')](0x194);}return _0x346c31;};}function handleError(_0x1301e4,_0x14a83a){_0x14a83a=_0x14a83a||0x1f4;return function(_0x22c3da){logger[_0x0b7f('0x28')](_0x22c3da[_0x0b7f('0x38')]);if(_0x22c3da[_0x0b7f('0x39')]){delete _0x22c3da[_0x0b7f('0x39')];}_0x1301e4['status'](_0x14a83a)['send'](_0x22c3da);};}exports['index']=function(_0x17e7f7,_0x51caed){var _0x29fa8b={},_0x31f317={},_0x321cdf={'count':0x0,'rows':[]};var _0x30d35e=_[_0x0b7f('0x3a')](db['SmsMessage'][_0x0b7f('0x3b')],function(_0x2eafb6){return{'name':_0x2eafb6[_0x0b7f('0x3c')],'type':_0x2eafb6[_0x0b7f('0x3d')][_0x0b7f('0x3e')]};});_0x31f317['model']=_[_0x0b7f('0x3a')](_0x30d35e,_0x0b7f('0x39'));_0x31f317[_0x0b7f('0x3f')]=_[_0x0b7f('0x40')](_0x17e7f7[_0x0b7f('0x3f')]);_0x31f317[_0x0b7f('0x41')]=_[_0x0b7f('0x42')](_0x31f317[_0x0b7f('0x43')],_0x31f317[_0x0b7f('0x3f')]);_0x29fa8b[_0x0b7f('0x44')]=_[_0x0b7f('0x42')](_0x31f317[_0x0b7f('0x43')],qs[_0x0b7f('0x45')](_0x17e7f7['query']['fields']));_0x29fa8b[_0x0b7f('0x44')]=_0x29fa8b[_0x0b7f('0x44')][_0x0b7f('0x46')]?_0x29fa8b[_0x0b7f('0x44')]:_0x31f317[_0x0b7f('0x43')];if(!_0x17e7f7[_0x0b7f('0x3f')]['hasOwnProperty'](_0x0b7f('0x47'))){_0x29fa8b[_0x0b7f('0x31')]=qs[_0x0b7f('0x31')](_0x17e7f7[_0x0b7f('0x3f')]['limit']);_0x29fa8b[_0x0b7f('0x33')]=qs['offset'](_0x17e7f7[_0x0b7f('0x3f')][_0x0b7f('0x33')]);}_0x29fa8b[_0x0b7f('0x48')]=qs[_0x0b7f('0x49')](_0x17e7f7[_0x0b7f('0x3f')]['sort']);_0x29fa8b[_0x0b7f('0x4a')]=qs[_0x0b7f('0x41')](_[_0x0b7f('0x4b')](_0x17e7f7[_0x0b7f('0x3f')],_0x31f317[_0x0b7f('0x41')]),_0x30d35e);if(_0x17e7f7[_0x0b7f('0x3f')][_0x0b7f('0x4c')]){_0x29fa8b[_0x0b7f('0x4a')]=_[_0x0b7f('0x4d')](_0x29fa8b[_0x0b7f('0x4a')],{'$or':_[_0x0b7f('0x3a')](_0x30d35e,function(_0x2f647c){if(_0x2f647c[_0x0b7f('0x3d')]!=='VIRTUAL'){var _0x2d3921={};_0x2d3921[_0x2f647c[_0x0b7f('0x39')]]={'$like':'%'+_0x17e7f7[_0x0b7f('0x3f')][_0x0b7f('0x4c')]+'%'};return _0x2d3921;}})});}_0x29fa8b=_[_0x0b7f('0x4d')]({},_0x29fa8b,_0x17e7f7[_0x0b7f('0x4e')]);var _0x187d71={'where':_0x29fa8b['where']};return db['SmsMessage']['count'](_0x187d71)[_0x0b7f('0x23')](function(_0x46442c){_0x321cdf['count']=_0x46442c;if(_0x17e7f7[_0x0b7f('0x3f')][_0x0b7f('0x4f')]){_0x29fa8b['include']=[{'all':!![]}];}return db[_0x0b7f('0x50')]['findAll'](_0x29fa8b);})[_0x0b7f('0x23')](function(_0x49064a){_0x321cdf[_0x0b7f('0x51')]=_0x49064a;return _0x321cdf;})[_0x0b7f('0x23')](respondWithFilteredResult(_0x51caed,_0x29fa8b))[_0x0b7f('0x52')](handleError(_0x51caed,null));};exports[_0x0b7f('0x53')]=function(_0x1984ae,_0x14c99f){var _0xace736={'raw':!![],'where':{'id':_0x1984ae[_0x0b7f('0x54')]['id']}},_0xb599a9={};_0xb599a9[_0x0b7f('0x43')]=_[_0x0b7f('0x40')](db[_0x0b7f('0x50')][_0x0b7f('0x3b')]);_0xb599a9[_0x0b7f('0x3f')]=_['keys'](_0x1984ae[_0x0b7f('0x3f')]);_0xb599a9[_0x0b7f('0x41')]=_[_0x0b7f('0x42')](_0xb599a9[_0x0b7f('0x43')],_0xb599a9[_0x0b7f('0x3f')]);_0xace736[_0x0b7f('0x44')]=_['intersection'](_0xb599a9[_0x0b7f('0x43')],qs['fields'](_0x1984ae['query'][_0x0b7f('0x45')]));_0xace736['attributes']=_0xace736['attributes']['length']?_0xace736[_0x0b7f('0x44')]:_0xb599a9[_0x0b7f('0x43')];if(_0x1984ae['query']['includeAll']){_0xace736[_0x0b7f('0x55')]=[{'all':!![]}];}_0xace736=_[_0x0b7f('0x4d')]({},_0xace736,_0x1984ae[_0x0b7f('0x4e')]);return db[_0x0b7f('0x50')][_0x0b7f('0x56')](_0xace736)[_0x0b7f('0x23')](handleEntityNotFound(_0x14c99f,null))[_0x0b7f('0x23')](respondWithResult(_0x14c99f,null))['catch'](handleError(_0x14c99f,null));};exports['create']=function(_0x4d06db,_0x343a12){return db[_0x0b7f('0x50')][_0x0b7f('0x57')](_0x4d06db[_0x0b7f('0x58')],{})[_0x0b7f('0x23')](respondWithResult(_0x343a12,0xc9))[_0x0b7f('0x52')](handleError(_0x343a12,null));};exports[_0x0b7f('0x37')]=function(_0x32ee33,_0x3a3a96){if(_0x32ee33['body']['id']){delete _0x32ee33[_0x0b7f('0x58')]['id'];}return db['SmsMessage'][_0x0b7f('0x56')]({'where':{'id':_0x32ee33[_0x0b7f('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a3a96,null))[_0x0b7f('0x23')](saveUpdates(_0x32ee33['body'],null))['then'](respondWithResult(_0x3a3a96,null))[_0x0b7f('0x52')](handleError(_0x3a3a96,null));};exports[_0x0b7f('0x59')]=function(_0x15d70c,_0x2f54a3){return db[_0x0b7f('0x50')][_0x0b7f('0x56')]({'where':{'id':_0x15d70c[_0x0b7f('0x54')]['id']}})[_0x0b7f('0x23')](handleEntityNotFound(_0x2f54a3,null))[_0x0b7f('0x23')](removeEntity(_0x2f54a3,null))[_0x0b7f('0x52')](handleError(_0x2f54a3,null));};exports[_0x0b7f('0x5a')]=function(_0x21369c,_0x1e9f07){return db[_0x0b7f('0x50')][_0x0b7f('0x5a')]()[_0x0b7f('0x23')](respondWithResult(_0x1e9f07,null))[_0x0b7f('0x52')](handleError(_0x1e9f07,null));};var interaction_log=require(_0x0b7f('0x14'))(_0x0b7f('0x5b'));exports['accept']=function(_0x1476cf,_0x43b607,_0x5f456a){var _0x2cc10e={'agent':{},'channel':_0x0b7f('0x5c')};if(_0x1476cf['body']['id']){delete _0x1476cf[_0x0b7f('0x58')]['id'];}_0x1476cf['body'][_0x0b7f('0x5d')]=!![];_0x1476cf[_0x0b7f('0x58')][_0x0b7f('0x5e')]=moment()[_0x0b7f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1476cf[_0x0b7f('0x58')][_0x0b7f('0x60')]=_0x1476cf['body']['UserId']||_0x1476cf[_0x0b7f('0x61')]['id'];_0x2cc10e[_0x0b7f('0x62')]['id']=_0x1476cf[_0x0b7f('0x58')][_0x0b7f('0x60')];return db[_0x0b7f('0x50')][_0x0b7f('0x56')]({'where':{'id':_0x1476cf[_0x0b7f('0x54')]['id'],'UserId':null}})[_0x0b7f('0x23')](handleEntityNotFound(_0x43b607,null))[_0x0b7f('0x23')](saveUpdates(_0x1476cf[_0x0b7f('0x58')],null))[_0x0b7f('0x23')](function(_0x5077f5){if(_0x5077f5){_0x2cc10e[_0x0b7f('0x29')]=_0x5077f5[_0x0b7f('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x0b7f('0x56')]({'where':{'id':_0x5077f5['SmsInteractionId']}});}return null;})[_0x0b7f('0x23')](handleEntityNotFound(_0x43b607,null))['then'](function(_0x4d0d8f){if(_0x4d0d8f){return _0x4d0d8f['update']({'UserId':_0x1476cf[_0x0b7f('0x58')]['UserId'],'read1stAt':_['isNil'](_0x4d0d8f[_0x0b7f('0x64')])?moment()[_0x0b7f('0x5f')](_0x0b7f('0x65')):undefined});}return null;})[_0x0b7f('0x23')](function(_0x3aac8f){if(_0x3aac8f){_0x2cc10e[_0x0b7f('0x66')]=_0x3aac8f[_0x0b7f('0x63')]({'plain':!![]});interaction_log[_0x0b7f('0x2a')](_0x0b7f('0x67'),_0x1476cf[_0x0b7f('0x61')]['id'],_0x1476cf[_0x0b7f('0x61')][_0x0b7f('0x39')],_0x1476cf[_0x0b7f('0x61')]['role'],_0x2cc10e[_0x0b7f('0x66')]['id'],_0x1476cf[_0x0b7f('0x58')]?JSON[_0x0b7f('0x27')](_0x1476cf[_0x0b7f('0x58')]):_0x0b7f('0x68'));return respondWithRpcPromise(_0x0b7f('0x69'),_0x0b7f('0x6a'),_0x2cc10e);}return null;})['then'](function(_0x396859){var _0x7fc899='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x396859['message']['ContactId'];return db['sequelize'][_0x0b7f('0x3f')](_0x7fc899,{'type':db[_0x0b7f('0x6b')][_0x0b7f('0x6c')][_0x0b7f('0x6d')],'raw':!![]})[_0x0b7f('0x23')](function(_0x328f5a){return _0x328f5a;});})['then'](function(_0x5296d9){if(_0x5296d9){_0x2cc10e[_0x0b7f('0x29')][_0x0b7f('0x6e')]=_0x5296d9[0x0];if(!_0x1476cf[_0x0b7f('0x58')][_0x0b7f('0x60')])return;return db['User']['find']({'where':{'id':_0x1476cf[_0x0b7f('0x58')][_0x0b7f('0x60')],'role':_0x0b7f('0x62')},'attributes':['id',_0x0b7f('0x39'),_0x0b7f('0x6f'),_0x0b7f('0x70'),_0x0b7f('0x71')],'raw':!![]});}return null;})[_0x0b7f('0x23')](function(_0x41423f){if(!_0x41423f)return null;_0x2cc10e[_0x0b7f('0x29')][_0x0b7f('0x62')]=_0x41423f;return _0x2cc10e;})[_0x0b7f('0x23')](function(_0x5bd3ad){if(_0x5bd3ad){if(_0x1476cf['body'][_0x0b7f('0x72')]){_0x2cc10e['message']['interface']=util['format'](_0x0b7f('0x73'),_0x1476cf[_0x0b7f('0x61')]['name']);_0x2cc10e[_0x0b7f('0x29')][_0x0b7f('0x74')]=_0x2cc10e[_0x0b7f('0x74')];_0x2cc10e[_0x0b7f('0x29')][_0x0b7f('0x75')]=_0x2cc10e[_0x0b7f('0x74')];_0x2cc10e[_0x0b7f('0x29')][_0x0b7f('0x76')]=_0x0b7f('0x77');return respondWithRpcPromise(_0x0b7f('0x78'),_0x0b7f('0x78'),{'event':_0x0b7f('0x79'),'message':_0x2cc10e[_0x0b7f('0x29')]},client9002)[_0x0b7f('0x23')](function(){return _0x2cc10e;});}return _0x2cc10e;}return null;})[_0x0b7f('0x23')](respondWithResult(_0x43b607,null))[_0x0b7f('0x52')](handleError(_0x43b607,null));};var interaction_log=require(_0x0b7f('0x14'))(_0x0b7f('0x5b'));exports[_0x0b7f('0x7a')]=function(_0x53973f,_0x53b6f4,_0x1935b2){var _0x460acb={'agent':{},'channel':_0x0b7f('0x5c')};if(_0x53973f[_0x0b7f('0x58')]['id']){delete _0x53973f['body']['id'];}_0x53973f[_0x0b7f('0x58')]['UserId']=_0x53973f[_0x0b7f('0x58')][_0x0b7f('0x60')]||_0x53973f[_0x0b7f('0x61')]['id'];_0x460acb[_0x0b7f('0x62')]['id']=_0x53973f['body'][_0x0b7f('0x60')];return db[_0x0b7f('0x50')]['find']({'where':{'id':_0x53973f[_0x0b7f('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x53b6f4,null))[_0x0b7f('0x23')](function(_0x507a57){if(_0x507a57){_0x460acb[_0x0b7f('0x29')]=_0x507a57[_0x0b7f('0x63')]({'plain':!![]});return db[_0x0b7f('0x7b')][_0x0b7f('0x56')]({'where':{'id':_0x507a57[_0x0b7f('0x7c')]}});}return null;})[_0x0b7f('0x23')](handleEntityNotFound(_0x53b6f4,null))[_0x0b7f('0x23')](function(_0x5877ad){if(_0x5877ad){_0x460acb[_0x0b7f('0x66')]=_0x5877ad[_0x0b7f('0x63')]({'plain':!![]});interaction_log['info'](_0x0b7f('0x7d'),_0x53973f[_0x0b7f('0x61')]['id'],_0x53973f['user'][_0x0b7f('0x39')],_0x53973f[_0x0b7f('0x61')]['role'],_0x460acb['interaction']['id'],_0x53973f[_0x0b7f('0x58')]?JSON['stringify'](_0x53973f[_0x0b7f('0x58')]):_0x0b7f('0x68'));return respondWithRpcPromise(_0x0b7f('0x7e'),_0x0b7f('0x7f'),_0x460acb);}return null;})['then'](function(_0x34ee5a){var _0x42cb65=_0x0b7f('0x80')+_0x34ee5a[_0x0b7f('0x29')]['ContactId'];return db[_0x0b7f('0x81')][_0x0b7f('0x3f')](_0x42cb65,{'type':db['Sequelize'][_0x0b7f('0x6c')][_0x0b7f('0x6d')],'raw':!![]})['then'](function(_0x7f4001){return _0x7f4001;});})[_0x0b7f('0x23')](function(_0x341236){if(_0x341236){_0x460acb[_0x0b7f('0x29')][_0x0b7f('0x6e')]=_0x341236[0x0];if(!_0x53973f['body'][_0x0b7f('0x60')])return;return db[_0x0b7f('0x82')][_0x0b7f('0x56')]({'where':{'id':_0x53973f['body']['UserId'],'role':_0x0b7f('0x62')},'attributes':['id','name',_0x0b7f('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x0b7f('0x23')](function(_0x566042){if(!_0x566042)return null;_0x460acb[_0x0b7f('0x29')]['agent']=_0x566042;return _0x460acb;})[_0x0b7f('0x23')](function(_0x421776){if(_0x421776){_0x421776[_0x0b7f('0x29')][_0x0b7f('0x83')]=util[_0x0b7f('0x5f')](_0x0b7f('0x73'),_0x53973f['user'][_0x0b7f('0x39')]);_0x421776[_0x0b7f('0x29')][_0x0b7f('0x74')]=_0x460acb[_0x0b7f('0x74')];_0x421776[_0x0b7f('0x29')][_0x0b7f('0x75')]=_0x460acb[_0x0b7f('0x74')];_0x421776[_0x0b7f('0x29')]['event']='reject';respondWithRpcPromise(_0x0b7f('0x78'),_0x0b7f('0x78'),{'event':_0x0b7f('0x84'),'message':_0x421776['message']},client9002);return _0x460acb;}return null;})[_0x0b7f('0x23')](respondWithResult(_0x53b6f4,null))[_0x0b7f('0x52')](handleError(_0x53b6f4,null));};exports['status']=function(_0x38d64c,_0xecbd1a,_0x9f26cf){if(_0x38d64c[_0x0b7f('0x58')]['id']){delete _0x38d64c[_0x0b7f('0x58')]['id'];}var _0x24e58a;return db[_0x0b7f('0x50')][_0x0b7f('0x56')]({'where':{'id':_0x38d64c[_0x0b7f('0x54')]['id']}})[_0x0b7f('0x23')](handleEntityNotFound(_0xecbd1a,null))[_0x0b7f('0x23')](function(_0x16d663){if(_0x16d663){_0x24e58a=_0x16d663;return db['SmsAccount'][_0x0b7f('0x56')]({'where':{'id':_0x16d663[_0x0b7f('0x85')]}});}})[_0x0b7f('0x23')](handleEntityNotFound(_0xecbd1a,null))[_0x0b7f('0x23')](function(_0x2e9e0f){if(_0x2e9e0f){logger['debug'](_0x0b7f('0x25'),_0x0b7f('0x2d'),_0x0b7f('0x86'),_0x2e9e0f[_0x0b7f('0x3d')],util[_0x0b7f('0x87')](_0x38d64c[_0x0b7f('0x58')],{'showHidden':![],'depth':null}));switch(_0x2e9e0f['type']){case _0x0b7f('0x88'):if(_0x38d64c[_0x0b7f('0x58')][_0x0b7f('0x89')]&&_0x38d64c[_0x0b7f('0x58')]['MessageSid']===_0x24e58a['messageId']){return _0x24e58a[_0x0b7f('0x37')]({'read':!![]});}else{logger['error'](_0x0b7f('0x8a'),_0x0b7f('0x2d'),_0x0b7f('0x88'),util[_0x0b7f('0x87')](_0x38d64c[_0x0b7f('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x38d64c[_0x0b7f('0x58')]['MessageUUID']&&_0x38d64c[_0x0b7f('0x58')][_0x0b7f('0x8b')]===_0x24e58a[_0x0b7f('0x8c')]&&_[_0x0b7f('0x8d')]([_0x0b7f('0x8e'),_0x0b7f('0x8f')],_0x38d64c['body'][_0x0b7f('0x90')])>=0x0){return _0x24e58a[_0x0b7f('0x37')]({'read':!![]});}else{logger[_0x0b7f('0x28')](_0x0b7f('0x8a'),'status',_0x0b7f('0x91'),util[_0x0b7f('0x87')](_0x38d64c[_0x0b7f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x0b7f('0x92'):var _0x260253=_0x38d64c['body'][_0x0b7f('0x93')][0x0];if(_0x260253[_0x0b7f('0x2d')][_0x0b7f('0x94')]==='DELIVERED'){return _0x24e58a['update']({'read':!![]});}else{logger[_0x0b7f('0x28')](_0x0b7f('0x8a'),_0x0b7f('0x2d'),_0x0b7f('0x92'),util[_0x0b7f('0x87')](_0x38d64c['body'],{'showHidden':![],'depth':null}));}break;}return _0x24e58a;}})[_0x0b7f('0x23')](respondWithResult(_0xecbd1a,null))[_0x0b7f('0x52')](handleError(_0xecbd1a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 4e6c55d..f945b36 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 _0x37f0=['update','remove','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x37f0,0xa7));var _0x037f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x37f0[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require(_0x037f('0x0'));var SmsMessage=require(_0x037f('0x1'))['db'][_0x037f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x037f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x037f('0x4'),'afterDestroy':_0x037f('0x5')};function emitEvent(_0x720efc){return function(_0x1accf1,_0x14573a,_0x3358f6){SmsMessageEvents[_0x037f('0x6')](_0x720efc+':'+_0x1accf1['id'],_0x1accf1);SmsMessageEvents[_0x037f('0x6')](_0x720efc,_0x1accf1);_0x3358f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x037f('0x7')](e,emitEvent(event));}}module[_0x037f('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xdf4d=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1a2383,_0xfffd98){var _0x55498d=function(_0x41f83a){while(--_0x41f83a){_0x1a2383['push'](_0x1a2383['shift']());}};_0x55498d(++_0xfffd98);}(_0xdf4d,0x1c0));var _0xddf4=function(_0x23e999,_0x11297a){_0x23e999=_0x23e999-0x0;var _0xedb644=_0xdf4d[_0x23e999];return _0xedb644;};'use strict';var EventEmitter=require(_0xddf4('0x0'));var SmsMessage=require(_0xddf4('0x1'))['db'][_0xddf4('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xddf4('0x3')](0x0);var events={'afterCreate':_0xddf4('0x4'),'afterUpdate':_0xddf4('0x5'),'afterDestroy':_0xddf4('0x6')};function emitEvent(_0x459fa3){return function(_0x23f6c0,_0xc5ea95,_0x4b7f65){SmsMessageEvents[_0xddf4('0x7')](_0x459fa3+':'+_0x23f6c0['id'],_0x23f6c0);SmsMessageEvents['emit'](_0x459fa3,_0x23f6c0);_0x4b7f65(null);};}for(var e in events){if(events[_0xddf4('0x8')](e)){var event=events[e];SmsMessage[_0xddf4('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index f594de8..9aaad19 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 _0xd816=['catch','error','direction','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','&password=','GET','split','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','messages','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','timestamp','keys','sort','createHash','md5','digest','signature=','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','api','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','out','secret','isNil','UserId','findOne','SmsInteractionId','then','createdAt'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd816,0xd5));var _0x6d81=function(_0x147165,_0x227b2c){_0x147165=_0x147165-0x0;var _0x451740=_0xd816[_0x147165];return _0x451740;};'use strict';var _=require(_0x6d81('0x0'));var util=require(_0x6d81('0x1'));var logger=require('../../config/logger')(_0x6d81('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d81('0x3'));var rimraf=require(_0x6d81('0x4'));var config=require(_0x6d81('0x5'));var attributes=require(_0x6d81('0x6'));module['exports']=function(_0x6c01ef,_0x4ba95f){return _0x6c01ef[_0x6d81('0x7')]('SmsMessage',attributes,{'tableName':_0x6d81('0x8'),'paranoid':![],'indexes':[{'name':_0x6d81('0x9'),'fields':['messageId']},{'name':_0x6d81('0xa'),'fields':[_0x6d81('0xb')],'type':_0x6d81('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x278974,_0x58dc08,_0x173243){var _0x493b15=_0x6c01ef[_0x6d81('0xd')];var _0x200555=_0x278974[_0x6d81('0xe')]({'plain':!![]});if(_0x200555['direction']['toLowerCase']()==='in'||_0x200555['direction']['toLowerCase']()===_0x6d81('0xf')&&!_0x200555[_0x6d81('0x10')]&&!_[_0x6d81('0x11')](_0x200555[_0x6d81('0x12')])){_0x493b15['SmsInteraction'][_0x6d81('0x13')]({'where':{'id':_0x200555[_0x6d81('0x14')]}})[_0x6d81('0x15')](function(_0x55fcb7){if(_0x55fcb7){_0x55fcb7['update']({'lastMsgAt':_0x200555[_0x6d81('0x16')],'lastMsgDirection':_0x200555['direction']['toLowerCase']()});}})[_0x6d81('0x17')](function(_0x25dd7a){console[_0x6d81('0x18')](_0x25dd7a);});}if(_0x200555[_0x6d81('0x19')]===_0x6d81('0xf')&&!_0x200555[_0x6d81('0x10')]){var _0x13d66a;_0x493b15['SmsAccount'][_0x6d81('0x1a')]({'where':{'id':_0x200555[_0x6d81('0x1b')]},'raw':!![]})[_0x6d81('0x15')](function(_0x333460){_0x13d66a=_0x333460;if(_0x13d66a&&_0x13d66a['type']){switch(_0x13d66a[_0x6d81('0x1c')]){case'twilio':var _0x357795=require(_0x6d81('0x1d'));if(_0x13d66a[_0x6d81('0x1e')]&&_0x13d66a[_0x6d81('0x1f')]&&_0x13d66a[_0x6d81('0x20')]){var _0x28944e=new _0x357795(_0x13d66a[_0x6d81('0x1e')],_0x13d66a['authToken']);_0x28944e['messages'][_0x6d81('0x21')]({'body':_0x200555[_0x6d81('0xb')],'to':_0x200555[_0x6d81('0x20')],'from':_0x13d66a[_0x6d81('0x20')],'statusCallback':_0x13d66a[_0x6d81('0x22')]+'/api/sms/messages/'+_0x200555['id']+_0x6d81('0x23')+_0x13d66a[_0x6d81('0x24')]})[_0x6d81('0x15')](function(_0x25f587){if(_0x25f587[_0x6d81('0x25')]){return _0x278974[_0x6d81('0x26')]({'messageId':_0x25f587[_0x6d81('0x25')]});}})[_0x6d81('0x17')](function(_0x388b68){logger[_0x6d81('0x18')](_0x6d81('0x27'),'afterCreate',_0x6d81('0x1d'),util[_0x6d81('0x28')](_0x388b68,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x1d'),_0x6d81('0x2a'));}break;case _0x6d81('0x2b'):var _0x3a5592=_0x6d81('0x2c');if(_0x13d66a[_0x6d81('0x2d')]&&_0x13d66a[_0x6d81('0x2e')]){var _0x35a878={'recipient':[_0x200555[_0x6d81('0x20')]],'message':_0x200555[_0x6d81('0xb')],'message_type':_0x13d66a[_0x6d81('0x2f')]};if(_0x13d66a[_0x6d81('0x2f')]&&_0x13d66a[_0x6d81('0x2f')]!=='SI'){_0x35a878['sender']=_0x13d66a[_0x6d81('0x20')];}var _0x19e30b={'url':_0x3a5592+'login?username='+_0x13d66a['username']+_0x6d81('0x30')+_0x13d66a[_0x6d81('0x2e')],'method':_0x6d81('0x31')};rp(_0x19e30b)[_0x6d81('0x15')](function(_0x381f6a){var _0x4c135e=_0x381f6a[_0x6d81('0x32')](';');var _0x4f3155={'user_key':_0x4c135e[0x0],'session_key':_0x4c135e[0x1]};_0x19e30b={'url':_0x3a5592+'sms','method':'POST','headers':{'user_key':_0x4f3155[_0x6d81('0x33')],'Session_key':_0x4f3155[_0x6d81('0x34')]},'json':!![],'body':_0x35a878};return rp(_0x19e30b);})[_0x6d81('0x15')](function(_0x26ce72){if(_0x26ce72[_0x6d81('0x35')]>=0x1){var _0x41c67e={'messageId':_0x26ce72[_0x6d81('0x36')]};if(_0x13d66a['smsMethod']!=='GP'||!_0x13d66a[_0x6d81('0x37')]){_0x41c67e[_0x6d81('0x38')]=!![];}return _0x278974['update'](_0x41c67e);}else{return logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x2b'),util[_0x6d81('0x28')](_0x26ce72,{'showHidden':![],'depth':null}));}})['catch'](function(_0x135de5){return logger['error'](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x2b'),util[_0x6d81('0x28')](_0x135de5,{'showHidden':![],'depth':null}));});}else{logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x2b'),_0x6d81('0x39'));}break;case _0x6d81('0x3a'):if(_0x13d66a[_0x6d81('0x1f')]){var _0x3d2768={'recipient':_0x200555[_0x6d81('0x20')],'message':_0x200555[_0x6d81('0xb')],'sender':_0x13d66a[_0x6d81('0x3b')]||_0x13d66a['phone'],'authorization':_0x13d66a[_0x6d81('0x1f')]};var _0x58dc08={'method':_0x6d81('0x3c'),'uri':_0x6d81('0x3d'),'body':_0x3d2768,'json':!![]};rp(_0x58dc08)[_0x6d81('0x15')](function(_0x494956){var _0x42b98f={'messageId':_0x494956[_0x6d81('0x3e')]};if(!_0x13d66a[_0x6d81('0x37')]){_0x42b98f[_0x6d81('0x38')]=!![];}return _0x278974[_0x6d81('0x26')](_0x42b98f);})[_0x6d81('0x17')](function(_0x2ccd96){logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),'connectel',util[_0x6d81('0x28')](_0x2ccd96,{'showHidden':![],'depth':null}));});}else{logger[_0x6d81('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d81('0x29'),'connectel',_0x6d81('0x3f'));}break;case _0x6d81('0x40'):if(_0x13d66a[_0x6d81('0x2d')]&&_0x13d66a['password']){var _0x3d2768={'messages':[{'source':'xCALLY\x20Motion','to':_0x200555[_0x6d81('0x20')],'body':_0x200555['body'],'from':_0x13d66a[_0x6d81('0x3b')]||_0x13d66a[_0x6d81('0x20')]}]};var _0x21fab2=util[_0x6d81('0x41')](_0x6d81('0x42'),_0x13d66a[_0x6d81('0x2d')],_0x13d66a[_0x6d81('0x2e')]);var _0x58dc08={'method':_0x6d81('0x3c'),'uri':_0x6d81('0x43'),'body':_0x3d2768,'headers':{'Authorization':util[_0x6d81('0x41')](_0x6d81('0x44'),new Buffer(_0x21fab2)[_0x6d81('0x45')](_0x6d81('0x46')))},'json':!![]};rp(_0x58dc08)['then'](function(_0x505c92){if(_0x505c92[_0x6d81('0x47')]>=0xc8&&_0x505c92[_0x6d81('0x47')]<=0xce){if(_0x505c92[_0x6d81('0x48')]&&_0x505c92[_0x6d81('0x48')][_0x6d81('0x49')]>0x0){var _0x436f10=_[_0x6d81('0x4a')](_0x505c92['data']['messages']);var _0x3618f5={'messageId':_0x436f10[_0x6d81('0x4b')]};if(!_0x13d66a[_0x6d81('0x37')]){_0x3618f5[_0x6d81('0x38')]=!![];}return _0x278974[_0x6d81('0x26')](_0x3618f5);}else{logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x4c'),util[_0x6d81('0x28')](_0x505c92,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x6d81('0x27'),_0x6d81('0x29'),'clickSend',util[_0x6d81('0x28')](_0x505c92,{'showHidden':![],'depth':null}));}})['catch'](function(_0xcf6168){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d81('0x29'),'clickSend',util[_0x6d81('0x28')](_0xcf6168,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x4c'),_0x6d81('0x39'));}break;case _0x6d81('0x4d'):if(_0x13d66a[_0x6d81('0x4e')]&&_0x13d66a['authToken']){var _0x3d2768={'dst':_0x200555[_0x6d81('0x20')],'text':_0x200555[_0x6d81('0xb')],'src':_0x13d66a[_0x6d81('0x3b')]||_0x13d66a[_0x6d81('0x20')],'url':_0x13d66a['remote']+_0x6d81('0x4f')+_0x200555['id']+_0x6d81('0x23')+_0x13d66a[_0x6d81('0x24')]};var _0x21fab2=util[_0x6d81('0x41')](_0x6d81('0x42'),_0x13d66a[_0x6d81('0x4e')],_0x13d66a[_0x6d81('0x1f')]);var _0x58dc08={'method':_0x6d81('0x3c'),'uri':util[_0x6d81('0x41')](_0x6d81('0x50'),_0x13d66a[_0x6d81('0x4e')]),'body':_0x3d2768,'headers':{'Authorization':util[_0x6d81('0x41')]('Basic\x20%s',new Buffer(_0x21fab2)[_0x6d81('0x45')](_0x6d81('0x46')))},'json':!![]};rp(_0x58dc08)['then'](function(_0x2a6da0){var _0x263745={'messageId':_0x2a6da0[_0x6d81('0x51')][0x0]};return _0x278974[_0x6d81('0x26')](_0x263745);})[_0x6d81('0x17')](function(_0x5ef6a8){logger[_0x6d81('0x18')](_0x6d81('0x27'),'afterCreate','plivo',util[_0x6d81('0x28')](_0x5ef6a8,{'showHidden':![],'depth':null}));});}else{logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x13d66a[_0x6d81('0x2d')]&&_0x13d66a['password']){if(_0x13d66a[_0x6d81('0x52')]){var _0x3ecb66={'method':_0x6d81('0x3c'),'uri':_0x13d66a[_0x6d81('0x52')]+_0x6d81('0x53'),'body':{'username':_0x13d66a['username'],'password':_0x13d66a['password']},'json':!![]};return rp(_0x3ecb66)[_0x6d81('0x15')](function(_0x27b55a){var _0x134b01={'method':_0x6d81('0x3c'),'uri':_0x13d66a['baseUrl']+_0x6d81('0x54'),'body':{'messages':[{'from':_0x13d66a[_0x6d81('0x20')],'destinations':[{'to':_0x200555[_0x6d81('0x20')]}],'text':_0x200555[_0x6d81('0xb')],'notifyUrl':_0x13d66a['remote']+_0x6d81('0x4f')+_0x200555['id']+_0x6d81('0x23')+_0x13d66a[_0x6d81('0x24')],'notifyContentType':_0x6d81('0x55'),'callbackData':_0x13d66a[_0x6d81('0x20')]+';'+_0x200555['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x27b55a['token']},'json':!![]};return rp(_0x134b01)['then'](function(_0x4d2b76){if(_0x4d2b76[_0x6d81('0x56')]){var _0x26f7dc={'messageId':_0x4d2b76[_0x6d81('0x56')][0x0][_0x6d81('0x9')]};if(!_0x13d66a['deliveryReport']){_0x26f7dc[_0x6d81('0x38')]=!![];}return _0x278974['update'](_0x26f7dc);}else{return logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x57'),util[_0x6d81('0x28')](_0x4d2b76,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1340e6){return logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),'infobip',util[_0x6d81('0x28')](_0x1340e6,{'showHidden':![],'depth':null}));});}else{logger[_0x6d81('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d81('0x29'),_0x6d81('0x57'),_0x6d81('0x58'));}}else{logger[_0x6d81('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d81('0x29'),_0x6d81('0x57'),_0x6d81('0x39'));}break;case _0x6d81('0x59'):var _0x43e322=require(_0x6d81('0x5a'));if(_0x13d66a[_0x6d81('0x5b')]){var _0xb5855c={};_0xb5855c[_0x6d81('0x5c')]=_0x13d66a[_0x6d81('0x2d')];_0xb5855c['phone']=_0x200555[_0x6d81('0x20')];_0xb5855c[_0x6d81('0x5d')]=_0x13d66a[_0x6d81('0x20')];_0xb5855c['text']=_0x200555[_0x6d81('0xb')];_0xb5855c[_0x6d81('0x5e')]=+new Date();var _0x10ba0f='';var _0x407d70='';var _0x370f9a=Object[_0x6d81('0x5f')](_0xb5855c);_0x370f9a[_0x6d81('0x60')]();for(var _0xf1b3a2=0x0;_0xf1b3a2<_0x370f9a['length'];_0xf1b3a2++){if(_0x10ba0f!=''){_0x10ba0f+='&';}_0x10ba0f+=_0x370f9a[_0xf1b3a2]+'='+encodeURIComponent(_0xb5855c[_0x370f9a[_0xf1b3a2]]);_0x407d70+=_0xb5855c[_0x370f9a[_0xf1b3a2]];}_0x407d70+=_0x13d66a[_0x6d81('0x5b')];_0x407d70=_0x43e322[_0x6d81('0x61')](_0x6d81('0x62'))[_0x6d81('0x26')](_0x407d70)[_0x6d81('0x63')]('hex');if(_0x10ba0f!==''){_0x10ba0f+='&';}_0x10ba0f+=_0x6d81('0x64')+_0x407d70;var _0x19e30b={'method':_0x6d81('0x31'),'uri':_0x13d66a['baseUrl']+'/external/get/send.php?'+_0x10ba0f,'json':!![]};return rp(_0x19e30b)[_0x6d81('0x15')](function(_0xb37103){var _0x3cc3ab=Object[_0x6d81('0x5f')](_0xb37103);if(_0xb37103[_0x3cc3ab[0x0]][_0x6d81('0x18')]&&parseInt(_0xb37103[_0x3cc3ab[0x0]][_0x6d81('0x18')])===0x0){var _0x97674c={'messageId':_0xb37103[_0x3cc3ab[0x0]][_0x6d81('0x65')]};if(!_0x13d66a[_0x6d81('0x37')]){_0x97674c[_0x6d81('0x38')]=!![];}return _0x278974['update'](_0x97674c);}else{return logger['error'](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x59'),util['inspect'](_0xb37103[_0x6d81('0x18')],{'showHidden':![],'depth':null}));}})[_0x6d81('0x17')](function(_0x1a7122){return logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x59'),util[_0x6d81('0x28')](_0x1a7122,{'showHidden':![],'depth':null}));});}else{logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0x6d81('0x66'):if(_0x13d66a[_0x6d81('0x5b')]){var _0x2abd8e={'method':_0x6d81('0x3c'),'uri':_0x6d81('0x67'),'headers':{'Authorization':_0x13d66a[_0x6d81('0x5b')]},'body':{'content':_0x200555[_0x6d81('0xb')],'to':[_0x200555['phone']],'from':_0x13d66a[_0x6d81('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x6d81('0x68')},'json':!![]};rp(_0x2abd8e)[_0x6d81('0x15')](function(_0x3ebcaa){if(!_0x3ebcaa['error']){var _0x4684c2={'messageId':_0x3ebcaa['messages'][0x0][_0x6d81('0x69')]};if(!_0x13d66a[_0x6d81('0x37')]){_0x4684c2[_0x6d81('0x38')]=!![];}return _0x278974[_0x6d81('0x26')](_0x4684c2);}else{return logger[_0x6d81('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d81('0x29'),_0x6d81('0x66'),util[_0x6d81('0x28')](_0x3ebcaa[_0x6d81('0x18')],{'showHidden':![],'depth':null}));}})[_0x6d81('0x17')](function(_0x2942a7){return logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),'clickatell',util['inspect'](_0x2942a7,{'showHidden':![],'depth':null}));});}else{logger[_0x6d81('0x18')](_0x6d81('0x27'),'afterCreate',_0x6d81('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0x6d81('0x6a'):if(_0x13d66a[_0x6d81('0x2d')]&&_0x13d66a[_0x6d81('0x2e')]){var _0x21fab2=util[_0x6d81('0x41')]('%s:%s',_0x13d66a[_0x6d81('0x2d')],_0x13d66a[_0x6d81('0x2e')]);var _0x58dc08={'method':_0x6d81('0x3c'),'uri':_0x6d81('0x6b')+_0x13d66a['accountId']+'/messages','body':{'to':[_0x200555[_0x6d81('0x20')]],'text':_0x200555['body'],'from':_0x13d66a['phone'],'applicationId':_0x13d66a[_0x6d81('0x6c')]},'headers':{'Authorization':util[_0x6d81('0x41')](_0x6d81('0x44'),new Buffer(_0x21fab2)[_0x6d81('0x45')]('base64'))},'json':!![]};rp(_0x58dc08)[_0x6d81('0x15')](function(_0x574096){if(_0x574096['id']){var _0x5122df={'messageId':_0x574096['id']};return _0x278974['update'](_0x5122df);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6d81('0x6a'),util[_0x6d81('0x28')](_0x574096,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4a1665){logger[_0x6d81('0x18')](_0x6d81('0x27'),'afterCreate',_0x6d81('0x6a'),util['inspect'](_0x4a1665,{'showHidden':![],'depth':null}));});}else{logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x6a'),_0x6d81('0x39'));}break;case _0x6d81('0x6d'):if(_0x13d66a[_0x6d81('0x5b')]){var _0x278465={};var _0x19e30b={'method':_0x6d81('0x3c'),'uri':_0x6d81('0x6e'),'headers':{'Authorization':_0x6d81('0x6f')+_0x13d66a[_0x6d81('0x5b')],'Content-Type':_0x6d81('0x55')},'body':{'from':_0x13d66a[_0x6d81('0x20')],'to':_0x200555[_0x6d81('0x20')],'text':_0x200555[_0x6d81('0xb')]},'json':!![]};return rp(_0x19e30b)[_0x6d81('0x15')](function(_0x2a0a27){if(_0x2a0a27[_0x6d81('0x70')]==0xca){_0x278465[_0x6d81('0x71')]=_0x2a0a27;var _0x36e1ff={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x6d81('0x6f')+_0x13d66a['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x278465[_0x6d81('0x71')][_0x6d81('0x72')]},'json':!![]};return rp(_0x36e1ff)[_0x6d81('0x15')](function(_0x4f88c3){_0x278465['status']=_0x4f88c3;var _0x5efca5={'messageId':_0x278465[_0x6d81('0x71')]['refid'],'read':!![]};return _0x278974['update'](_0x5efca5);});}else{return logger[_0x6d81('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d81('0x29'),_0x6d81('0x6d'),util[_0x6d81('0x28')](_0x2a0a27,{'showHidden':![],'depth':null}));}})[_0x6d81('0x17')](function(_0x44ca2a){return logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x6d'),util[_0x6d81('0x28')](_0x44ca2a,{'showHidden':![],'depth':null}));});}else{return logger[_0x6d81('0x18')](_0x6d81('0x27'),_0x6d81('0x29'),_0x6d81('0x6d'),_0x6d81('0x73'));}break;}}})[_0x6d81('0x74')](function(){_0x173243();});}else{_0x173243();}}},'charset':_0x6d81('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7d5a=['Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','catch','find','SmsAccountId','type','authToken','phone','accountSid','messages','remote','/api/sms/messages/','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','sms','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','senderString','%s:%s','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','plivo','format','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','apiKey','login','text','timestamp','sort','length','createHash','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','csc','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId'];(function(_0x4b6aa2,_0x1a13dc){var _0x10e731=function(_0x233455){while(--_0x233455){_0x4b6aa2['push'](_0x4b6aa2['shift']());}};_0x10e731(++_0x1a13dc);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x3e163c,_0x25e79d){_0x3e163c=_0x3e163c-0x0;var _0x131f48=_0x7d5a[_0x3e163c];return _0x131f48;};'use strict';var _=require(_0xa7d5('0x0'));var util=require(_0xa7d5('0x1'));var logger=require(_0xa7d5('0x2'))(_0xa7d5('0x3'));var moment=require(_0xa7d5('0x4'));var BPromise=require(_0xa7d5('0x5'));var rp=require(_0xa7d5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa7d5('0x7'));var attributes=require(_0xa7d5('0x8'));module[_0xa7d5('0x9')]=function(_0x284432,_0x1e6722){return _0x284432[_0xa7d5('0xa')]('SmsMessage',attributes,{'tableName':_0xa7d5('0xb'),'paranoid':![],'indexes':[{'name':_0xa7d5('0xc'),'fields':[_0xa7d5('0xc')]},{'name':_0xa7d5('0xd'),'fields':[_0xa7d5('0xe')],'type':_0xa7d5('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x350515,_0x5b27a3,_0x120bc3){var _0x1a153c=_0x284432[_0xa7d5('0x10')];var _0x55a249=_0x350515[_0xa7d5('0x11')]({'plain':!![]});if(_0x55a249[_0xa7d5('0x12')][_0xa7d5('0x13')]()==='in'||_0x55a249['direction'][_0xa7d5('0x13')]()===_0xa7d5('0x14')&&!_0x55a249[_0xa7d5('0x15')]&&!_[_0xa7d5('0x16')](_0x55a249[_0xa7d5('0x17')])){_0x1a153c['SmsInteraction'][_0xa7d5('0x18')]({'where':{'id':_0x55a249[_0xa7d5('0x19')]}})[_0xa7d5('0x1a')](function(_0x3fc942){if(_0x3fc942){_0x3fc942[_0xa7d5('0x1b')]({'lastMsgAt':_0x55a249['createdAt'],'lastMsgDirection':_0x55a249[_0xa7d5('0x12')][_0xa7d5('0x13')]()});}})[_0xa7d5('0x1c')](function(_0x4cfb1a){console['error'](_0x4cfb1a);});}if(_0x55a249[_0xa7d5('0x12')]==='out'&&!_0x55a249[_0xa7d5('0x15')]){var _0x1f9b68;_0x1a153c['SmsAccount'][_0xa7d5('0x1d')]({'where':{'id':_0x55a249[_0xa7d5('0x1e')]},'raw':!![]})[_0xa7d5('0x1a')](function(_0x4aad8c){_0x1f9b68=_0x4aad8c;if(_0x1f9b68&&_0x1f9b68['type']){switch(_0x1f9b68[_0xa7d5('0x1f')]){case'twilio':var _0x3f10a9=require('twilio');if(_0x1f9b68['accountSid']&&_0x1f9b68[_0xa7d5('0x20')]&&_0x1f9b68[_0xa7d5('0x21')]){var _0x106a72=new _0x3f10a9(_0x1f9b68[_0xa7d5('0x22')],_0x1f9b68[_0xa7d5('0x20')]);_0x106a72[_0xa7d5('0x23')]['create']({'body':_0x55a249[_0xa7d5('0xe')],'to':_0x55a249[_0xa7d5('0x21')],'from':_0x1f9b68[_0xa7d5('0x21')],'statusCallback':_0x1f9b68[_0xa7d5('0x24')]+_0xa7d5('0x25')+_0x55a249['id']+'/status?token='+_0x1f9b68[_0xa7d5('0x26')]})[_0xa7d5('0x1a')](function(_0x30e1f5){if(_0x30e1f5[_0xa7d5('0x27')]){return _0x350515[_0xa7d5('0x1b')]({'messageId':_0x30e1f5[_0xa7d5('0x27')]});}})['catch'](function(_0x280522){logger[_0xa7d5('0x28')](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x2b'),util[_0xa7d5('0x2c')](_0x280522,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x2b'),_0xa7d5('0x2d'));}break;case _0xa7d5('0x2e'):var _0x2be715=_0xa7d5('0x2f');if(_0x1f9b68[_0xa7d5('0x30')]&&_0x1f9b68[_0xa7d5('0x31')]){var _0x44cda4={'recipient':[_0x55a249[_0xa7d5('0x21')]],'message':_0x55a249[_0xa7d5('0xe')],'message_type':_0x1f9b68[_0xa7d5('0x32')]};if(_0x1f9b68['smsMethod']&&_0x1f9b68['smsMethod']!=='SI'){_0x44cda4[_0xa7d5('0x33')]=_0x1f9b68[_0xa7d5('0x21')];}var _0x4c6af5={'url':_0x2be715+_0xa7d5('0x34')+_0x1f9b68[_0xa7d5('0x30')]+_0xa7d5('0x35')+_0x1f9b68[_0xa7d5('0x31')],'method':'GET'};rp(_0x4c6af5)[_0xa7d5('0x1a')](function(_0x1991c3){var _0x4f9ca4=_0x1991c3['split'](';');var _0x2906aa={'user_key':_0x4f9ca4[0x0],'session_key':_0x4f9ca4[0x1]};_0x4c6af5={'url':_0x2be715+_0xa7d5('0x36'),'method':'POST','headers':{'user_key':_0x2906aa['user_key'],'Session_key':_0x2906aa[_0xa7d5('0x37')]},'json':!![],'body':_0x44cda4};return rp(_0x4c6af5);})['then'](function(_0x41b5e1){if(_0x41b5e1[_0xa7d5('0x38')]>=0x1){var _0x388c49={'messageId':_0x41b5e1[_0xa7d5('0x39')]};if(_0x1f9b68[_0xa7d5('0x32')]!=='GP'||!_0x1f9b68[_0xa7d5('0x3a')]){_0x388c49[_0xa7d5('0x3b')]=!![];}return _0x350515['update'](_0x388c49);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x2e'),util['inspect'](_0x41b5e1,{'showHidden':![],'depth':null}));}})[_0xa7d5('0x1c')](function(_0x39359f){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x2e'),util['inspect'](_0x39359f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',_0xa7d5('0x3c'));}break;case _0xa7d5('0x3d'):if(_0x1f9b68[_0xa7d5('0x20')]){var _0x2ce787={'recipient':_0x55a249[_0xa7d5('0x21')],'message':_0x55a249[_0xa7d5('0xe')],'sender':_0x1f9b68['senderString']||_0x1f9b68['phone'],'authorization':_0x1f9b68['authToken']};var _0x5b27a3={'method':_0xa7d5('0x3e'),'uri':_0xa7d5('0x3f'),'body':_0x2ce787,'json':!![]};rp(_0x5b27a3)[_0xa7d5('0x1a')](function(_0xfea5e5){var _0x10f467={'messageId':_0xfea5e5[_0xa7d5('0x40')]};if(!_0x1f9b68['deliveryReport']){_0x10f467[_0xa7d5('0x3b')]=!![];}return _0x350515[_0xa7d5('0x1b')](_0x10f467);})['catch'](function(_0xaa56b5){logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x3d'),util[_0xa7d5('0x2c')](_0xaa56b5,{'showHidden':![],'depth':null}));});}else{logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x3d'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x1f9b68[_0xa7d5('0x30')]&&_0x1f9b68[_0xa7d5('0x31')]){var _0x2ce787={'messages':[{'source':_0xa7d5('0x41'),'to':_0x55a249[_0xa7d5('0x21')],'body':_0x55a249[_0xa7d5('0xe')],'from':_0x1f9b68[_0xa7d5('0x42')]||_0x1f9b68['phone']}]};var _0xc48bf6=util['format'](_0xa7d5('0x43'),_0x1f9b68[_0xa7d5('0x30')],_0x1f9b68['password']);var _0x5b27a3={'method':_0xa7d5('0x3e'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2ce787,'headers':{'Authorization':util['format'](_0xa7d5('0x44'),new Buffer(_0xc48bf6)[_0xa7d5('0x45')]('base64'))},'json':!![]};rp(_0x5b27a3)[_0xa7d5('0x1a')](function(_0x28e548){if(_0x28e548[_0xa7d5('0x46')]>=0xc8&&_0x28e548[_0xa7d5('0x46')]<=0xce){if(_0x28e548[_0xa7d5('0x47')]&&_0x28e548['data'][_0xa7d5('0x48')]>0x0){var _0x17a857=_['head'](_0x28e548[_0xa7d5('0x47')][_0xa7d5('0x23')]);var _0x4450e9={'messageId':_0x17a857[_0xa7d5('0x49')]};if(!_0x1f9b68[_0xa7d5('0x3a')]){_0x4450e9[_0xa7d5('0x3b')]=!![];}return _0x350515[_0xa7d5('0x1b')](_0x4450e9);}else{logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x4a'),util[_0xa7d5('0x2c')](_0x28e548,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x4a'),util[_0xa7d5('0x2c')](_0x28e548,{'showHidden':![],'depth':null}));}})[_0xa7d5('0x1c')](function(_0x47f999){logger[_0xa7d5('0x28')](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x4a'),util[_0xa7d5('0x2c')](_0x47f999,{'showHidden':![],'depth':null}));});}else{logger[_0xa7d5('0x28')](_0xa7d5('0x29'),'afterCreate',_0xa7d5('0x4a'),_0xa7d5('0x3c'));}break;case _0xa7d5('0x4b'):if(_0x1f9b68['authId']&&_0x1f9b68[_0xa7d5('0x20')]){var _0x2ce787={'dst':_0x55a249[_0xa7d5('0x21')],'text':_0x55a249['body'],'src':_0x1f9b68['senderString']||_0x1f9b68[_0xa7d5('0x21')],'url':_0x1f9b68[_0xa7d5('0x24')]+'/api/sms/messages/'+_0x55a249['id']+'/status?token='+_0x1f9b68[_0xa7d5('0x26')]};var _0xc48bf6=util[_0xa7d5('0x4c')](_0xa7d5('0x43'),_0x1f9b68[_0xa7d5('0x4d')],_0x1f9b68[_0xa7d5('0x20')]);var _0x5b27a3={'method':_0xa7d5('0x3e'),'uri':util[_0xa7d5('0x4c')](_0xa7d5('0x4e'),_0x1f9b68[_0xa7d5('0x4d')]),'body':_0x2ce787,'headers':{'Authorization':util[_0xa7d5('0x4c')](_0xa7d5('0x44'),new Buffer(_0xc48bf6)[_0xa7d5('0x45')]('base64'))},'json':!![]};rp(_0x5b27a3)[_0xa7d5('0x1a')](function(_0x226660){var _0x99134e={'messageId':_0x226660[_0xa7d5('0x4f')][0x0]};return _0x350515[_0xa7d5('0x1b')](_0x99134e);})[_0xa7d5('0x1c')](function(_0x446134){logger[_0xa7d5('0x28')](_0xa7d5('0x29'),'afterCreate',_0xa7d5('0x4b'),util[_0xa7d5('0x2c')](_0x446134,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x4b'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xa7d5('0x50'):if(_0x1f9b68[_0xa7d5('0x30')]&&_0x1f9b68[_0xa7d5('0x31')]){if(_0x1f9b68['baseUrl']){var _0x397c96={'method':_0xa7d5('0x3e'),'uri':_0x1f9b68[_0xa7d5('0x51')]+_0xa7d5('0x52'),'body':{'username':_0x1f9b68[_0xa7d5('0x30')],'password':_0x1f9b68['password']},'json':!![]};return rp(_0x397c96)['then'](function(_0x127227){var _0x4767d4={'method':_0xa7d5('0x3e'),'uri':_0x1f9b68[_0xa7d5('0x51')]+_0xa7d5('0x53'),'body':{'messages':[{'from':_0x1f9b68[_0xa7d5('0x21')],'destinations':[{'to':_0x55a249[_0xa7d5('0x21')]}],'text':_0x55a249[_0xa7d5('0xe')],'notifyUrl':_0x1f9b68['remote']+_0xa7d5('0x25')+_0x55a249['id']+_0xa7d5('0x54')+_0x1f9b68['token'],'notifyContentType':_0xa7d5('0x55'),'callbackData':_0x1f9b68[_0xa7d5('0x21')]+';'+_0x55a249[_0xa7d5('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x127227[_0xa7d5('0x26')]},'json':!![]};return rp(_0x4767d4)['then'](function(_0x448ed7){if(_0x448ed7['messages']){var _0x4b4c25={'messageId':_0x448ed7[_0xa7d5('0x23')][0x0][_0xa7d5('0xc')]};if(!_0x1f9b68[_0xa7d5('0x3a')]){_0x4b4c25[_0xa7d5('0x3b')]=!![];}return _0x350515['update'](_0x4b4c25);}else{return logger[_0xa7d5('0x28')](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x50'),util[_0xa7d5('0x2c')](_0x448ed7,{'showHidden':![],'depth':null}));}});})[_0xa7d5('0x1c')](function(_0x3774ad){return logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x50'),util[_0xa7d5('0x2c')](_0x3774ad,{'showHidden':![],'depth':null}));});}else{logger[_0xa7d5('0x28')](_0xa7d5('0x29'),'afterCreate',_0xa7d5('0x50'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xa7d5('0x28')](_0xa7d5('0x29'),_0xa7d5('0x2a'),'infobip',_0xa7d5('0x3c'));}break;case'csc':var _0x3e6589=require('crypto');if(_0x1f9b68[_0xa7d5('0x56')]){var _0xde69d5={};_0xde69d5[_0xa7d5('0x57')]=_0x1f9b68[_0xa7d5('0x30')];_0xde69d5[_0xa7d5('0x21')]=_0x55a249[_0xa7d5('0x21')];_0xde69d5[_0xa7d5('0x33')]=_0x1f9b68[_0xa7d5('0x21')];_0xde69d5[_0xa7d5('0x58')]=_0x55a249[_0xa7d5('0xe')];_0xde69d5[_0xa7d5('0x59')]=+new Date();var _0x2e17e5='';var _0x10697b='';var _0x5e6dba=Object['keys'](_0xde69d5);_0x5e6dba[_0xa7d5('0x5a')]();for(var _0x314d49=0x0;_0x314d49<_0x5e6dba[_0xa7d5('0x5b')];_0x314d49++){if(_0x2e17e5!=''){_0x2e17e5+='&';}_0x2e17e5+=_0x5e6dba[_0x314d49]+'='+encodeURIComponent(_0xde69d5[_0x5e6dba[_0x314d49]]);_0x10697b+=_0xde69d5[_0x5e6dba[_0x314d49]];}_0x10697b+=_0x1f9b68[_0xa7d5('0x56')];_0x10697b=_0x3e6589[_0xa7d5('0x5c')]('md5')['update'](_0x10697b)[_0xa7d5('0x5d')](_0xa7d5('0x5e'));if(_0x2e17e5!==''){_0x2e17e5+='&';}_0x2e17e5+=_0xa7d5('0x5f')+_0x10697b;var _0x4c6af5={'method':_0xa7d5('0x60'),'uri':_0x1f9b68[_0xa7d5('0x51')]+_0xa7d5('0x61')+_0x2e17e5,'json':!![]};return rp(_0x4c6af5)[_0xa7d5('0x1a')](function(_0x5d5e0b){var _0x47b0c8=Object[_0xa7d5('0x62')](_0x5d5e0b);if(_0x5d5e0b[_0x47b0c8[0x0]][_0xa7d5('0x28')]&&parseInt(_0x5d5e0b[_0x47b0c8[0x0]][_0xa7d5('0x28')])===0x0){var _0x3d09d3={'messageId':_0x5d5e0b[_0x47b0c8[0x0]][_0xa7d5('0x63')]};if(!_0x1f9b68[_0xa7d5('0x3a')]){_0x3d09d3[_0xa7d5('0x3b')]=!![];}return _0x350515['update'](_0x3d09d3);}else{return logger[_0xa7d5('0x28')](_0xa7d5('0x29'),_0xa7d5('0x2a'),'csc',util[_0xa7d5('0x2c')](_0x5d5e0b[_0xa7d5('0x28')],{'showHidden':![],'depth':null}));}})[_0xa7d5('0x1c')](function(_0x37cc42){return logger[_0xa7d5('0x28')](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x64'),util['inspect'](_0x37cc42,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa7d5('0x29'),_0xa7d5('0x2a'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0xa7d5('0x65'):if(_0x1f9b68['apiKey']){var _0x38e596={'method':'POST','uri':_0xa7d5('0x66'),'headers':{'Authorization':_0x1f9b68[_0xa7d5('0x56')]},'body':{'content':_0x55a249[_0xa7d5('0xe')],'to':[_0x55a249[_0xa7d5('0x21')]],'from':_0x1f9b68[_0xa7d5('0x21')],'binary':![],'clientMessageId':_0xa7d5('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x38e596)[_0xa7d5('0x1a')](function(_0x16925d){if(!_0x16925d[_0xa7d5('0x28')]){var _0x453ad5={'messageId':_0x16925d[_0xa7d5('0x23')][0x0][_0xa7d5('0x68')]};if(!_0x1f9b68[_0xa7d5('0x3a')]){_0x453ad5[_0xa7d5('0x3b')]=!![];}return _0x350515[_0xa7d5('0x1b')](_0x453ad5);}else{return logger[_0xa7d5('0x28')](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x65'),util[_0xa7d5('0x2c')](_0x16925d[_0xa7d5('0x28')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x31edc0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),'clickatell',util['inspect'](_0x31edc0,{'showHidden':![],'depth':null}));});}else{logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x65'),_0xa7d5('0x69'));}break;case _0xa7d5('0x6a'):if(_0x1f9b68['username']&&_0x1f9b68['password']){var _0xc48bf6=util[_0xa7d5('0x4c')]('%s:%s',_0x1f9b68['username'],_0x1f9b68['password']);var _0x5b27a3={'method':_0xa7d5('0x3e'),'uri':_0xa7d5('0x6b')+_0x1f9b68['accountId']+_0xa7d5('0x6c'),'body':{'to':[_0x55a249[_0xa7d5('0x21')]],'text':_0x55a249[_0xa7d5('0xe')],'from':_0x1f9b68['phone'],'applicationId':_0x1f9b68[_0xa7d5('0x6d')]},'headers':{'Authorization':util[_0xa7d5('0x4c')]('Basic\x20%s',new Buffer(_0xc48bf6)[_0xa7d5('0x45')]('base64'))},'json':!![]};rp(_0x5b27a3)[_0xa7d5('0x1a')](function(_0x34f97b){if(_0x34f97b['id']){var _0x68071={'messageId':_0x34f97b['id']};return _0x350515[_0xa7d5('0x1b')](_0x68071);}else{logger['error'](_0xa7d5('0x29'),_0xa7d5('0x2a'),_0xa7d5('0x6a'),util[_0xa7d5('0x2c')](_0x34f97b,{'showHidden':![],'depth':null}));}})[_0xa7d5('0x1c')](function(_0x2af095){logger[_0xa7d5('0x28')](_0xa7d5('0x29'),'afterCreate',_0xa7d5('0x6a'),util['inspect'](_0x2af095,{'showHidden':![],'depth':null}));});}else{logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x6a'),_0xa7d5('0x3c'));}break;case'intelepeer':if(_0x1f9b68[_0xa7d5('0x56')]){var _0x237c24={};var _0x4c6af5={'method':'POST','uri':_0xa7d5('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x1f9b68['apiKey'],'Content-Type':_0xa7d5('0x55')},'body':{'from':_0x1f9b68['phone'],'to':_0x55a249[_0xa7d5('0x21')],'text':_0x55a249[_0xa7d5('0xe')]},'json':!![]};return rp(_0x4c6af5)[_0xa7d5('0x1a')](function(_0x139d38){if(_0x139d38['code']==0xca){_0x237c24[_0xa7d5('0x6f')]=_0x139d38;var _0x475c9d={'method':_0xa7d5('0x3e'),'uri':_0xa7d5('0x70'),'headers':{'Authorization':_0xa7d5('0x71')+_0x1f9b68[_0xa7d5('0x56')],'Content-Type':_0xa7d5('0x55')},'body':{'refid':_0x237c24[_0xa7d5('0x6f')][_0xa7d5('0x72')]},'json':!![]};return rp(_0x475c9d)[_0xa7d5('0x1a')](function(_0xd60091){_0x237c24[_0xa7d5('0x73')]=_0xd60091;var _0x30a9cd={'messageId':_0x237c24[_0xa7d5('0x6f')]['refid'],'read':!![]};return _0x350515[_0xa7d5('0x1b')](_0x30a9cd);});}else{return logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x74'),util[_0xa7d5('0x2c')](_0x139d38,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3604b3){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),_0xa7d5('0x74'),util[_0xa7d5('0x2c')](_0x3604b3,{'showHidden':![],'depth':null}));});}else{return logger[_0xa7d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa7d5('0x2a'),'intelepeer',_0xa7d5('0x75'));}break;}}})[_0xa7d5('0x76')](function(){_0x120bc3();});}else{_0x120bc3();}}},'charset':_0xa7d5('0x77'),'collate':_0xa7d5('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 092212f..8c484f2 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 _0x6bfd=['./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x520917,_0x3bebd5){var _0x3a3279=function(_0x133038){while(--_0x133038){_0x520917['push'](_0x520917['shift']());}};_0x3a3279(++_0x3bebd5);}(_0x6bfd,0xff));var _0xd6bf=function(_0x236f0a,_0xdda8f1){_0x236f0a=_0x236f0a-0x0;var _0x1b7512=_0x6bfd[_0x236f0a];return _0x1b7512;};'use strict';var _=require(_0xd6bf('0x0'));var util=require('util');var moment=require(_0xd6bf('0x1'));var BPromise=require(_0xd6bf('0x2'));var rs=require(_0xd6bf('0x3'));var fs=require('fs');var Redis=require(_0xd6bf('0x4'));var db=require(_0xd6bf('0x5'))['db'];var utils=require(_0xd6bf('0x6'));var logger=require(_0xd6bf('0x7'))(_0xd6bf('0x8'));var config=require(_0xd6bf('0x9'));var jayson=require(_0xd6bf('0xa'));var client=jayson[_0xd6bf('0xb')][_0xd6bf('0xc')]({'port':0x232a});config[_0xd6bf('0xd')]=_[_0xd6bf('0xe')](config[_0xd6bf('0xd')],{'host':_0xd6bf('0xf'),'port':0x18eb});var socket=require(_0xd6bf('0x10'))(new Redis(config[_0xd6bf('0xd')]));require(_0xd6bf('0x11'))['register'](socket);function respondWithRpcPromise(_0x5d8236,_0x19b9d4,_0x75d2ca){return new BPromise(function(_0x36e4ab,_0x12b03c){return client[_0xd6bf('0x12')](_0x5d8236,_0x75d2ca)['then'](function(_0x588088){logger[_0xd6bf('0x13')](_0xd6bf('0x14'),_0x19b9d4,_0xd6bf('0x15'));logger[_0xd6bf('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19b9d4,_0xd6bf('0x15'),JSON[_0xd6bf('0x17')](_0x588088));if(_0x588088[_0xd6bf('0x18')]){if(_0x588088['error']['code']===0x1f4){logger[_0xd6bf('0x18')](_0xd6bf('0x14'),_0x19b9d4,_0x588088[_0xd6bf('0x18')][_0xd6bf('0x19')]);return _0x12b03c(_0x588088['error'][_0xd6bf('0x19')]);}logger[_0xd6bf('0x18')](_0xd6bf('0x14'),_0x19b9d4,_0x588088[_0xd6bf('0x18')]['message']);return _0x36e4ab(_0x588088['error']['message']);}else{logger['info'](_0xd6bf('0x14'),_0x19b9d4,'request\x20sent');_0x36e4ab(_0x588088['result']['message']);}})[_0xd6bf('0x1a')](function(_0x5328d9){logger['error']('SmsMessage,\x20%s,\x20%s',_0x19b9d4,_0x5328d9);_0x12b03c(_0x5328d9);});});}exports[_0xd6bf('0x1b')]=function(_0x42572a){var _0x3426f6=this;return new Promise(function(_0xa44b8f,_0x42385c){return db[_0xd6bf('0x1c')][_0xd6bf('0x1d')](_0x42572a[_0xd6bf('0x1e')],{'raw':_0x42572a[_0xd6bf('0x1f')]?_0x42572a[_0xd6bf('0x1f')][_0xd6bf('0x20')]===undefined?!![]:![]:!![]})[_0xd6bf('0x21')](function(_0x95b70c){logger[_0xd6bf('0x13')](_0xd6bf('0x1b'),_0x42572a);logger[_0xd6bf('0x16')](_0xd6bf('0x1b'),_0x42572a,JSON[_0xd6bf('0x17')](_0x95b70c));_0xa44b8f(_0x95b70c);})[_0xd6bf('0x1a')](function(_0x104e37){logger['error']('CreateSmsMessage',_0x104e37[_0xd6bf('0x19')],_0x42572a);_0x42385c(_0x3426f6[_0xd6bf('0x18')](0x1f4,_0x104e37[_0xd6bf('0x19')]));});});}; \ No newline at end of file +var _0xa9d6=['redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4a30cf,_0x312dd4){var _0x4d975b=function(_0x170368){while(--_0x170368){_0x4a30cf['push'](_0x4a30cf['shift']());}};_0x4d975b(++_0x312dd4);}(_0xa9d6,0x1d2));var _0x6a9d=function(_0x2a8b09,_0x4fba23){_0x2a8b09=_0x2a8b09-0x0;var _0x25e6d5=_0xa9d6[_0x2a8b09];return _0x25e6d5;};'use strict';var _=require(_0x6a9d('0x0'));var util=require(_0x6a9d('0x1'));var moment=require(_0x6a9d('0x2'));var BPromise=require(_0x6a9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a9d('0x4'))['db'];var utils=require(_0x6a9d('0x5'));var logger=require(_0x6a9d('0x6'))(_0x6a9d('0x7'));var config=require(_0x6a9d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a9d('0x9')]['http']({'port':0x232a});config[_0x6a9d('0xa')]=_[_0x6a9d('0xb')](config[_0x6a9d('0xa')],{'host':_0x6a9d('0xc'),'port':0x18eb});var socket=require(_0x6a9d('0xd'))(new Redis(config[_0x6a9d('0xa')]));require(_0x6a9d('0xe'))[_0x6a9d('0xf')](socket);function respondWithRpcPromise(_0x5459eb,_0x1ae95e,_0x5bccbf){return new BPromise(function(_0x2c1464,_0x167c9b){return client[_0x6a9d('0x10')](_0x5459eb,_0x5bccbf)[_0x6a9d('0x11')](function(_0x53163c){logger[_0x6a9d('0x12')](_0x6a9d('0x13'),_0x1ae95e,'request\x20sent');logger[_0x6a9d('0x14')](_0x6a9d('0x15'),_0x1ae95e,_0x6a9d('0x16'),JSON[_0x6a9d('0x17')](_0x53163c));if(_0x53163c[_0x6a9d('0x18')]){if(_0x53163c[_0x6a9d('0x18')][_0x6a9d('0x19')]===0x1f4){logger[_0x6a9d('0x18')](_0x6a9d('0x13'),_0x1ae95e,_0x53163c[_0x6a9d('0x18')][_0x6a9d('0x1a')]);return _0x167c9b(_0x53163c[_0x6a9d('0x18')][_0x6a9d('0x1a')]);}logger['error'](_0x6a9d('0x13'),_0x1ae95e,_0x53163c[_0x6a9d('0x18')][_0x6a9d('0x1a')]);return _0x2c1464(_0x53163c[_0x6a9d('0x18')][_0x6a9d('0x1a')]);}else{logger[_0x6a9d('0x12')]('SmsMessage,\x20%s,\x20%s',_0x1ae95e,_0x6a9d('0x16'));_0x2c1464(_0x53163c[_0x6a9d('0x1b')][_0x6a9d('0x1a')]);}})[_0x6a9d('0x1c')](function(_0x356ff7){logger[_0x6a9d('0x18')](_0x6a9d('0x13'),_0x1ae95e,_0x356ff7);_0x167c9b(_0x356ff7);});});}exports[_0x6a9d('0x1d')]=function(_0x20f3b9){var _0x42b00c=this;return new Promise(function(_0x4c763a,_0x400f58){return db[_0x6a9d('0x1e')][_0x6a9d('0x1f')](_0x20f3b9['body'],{'raw':_0x20f3b9[_0x6a9d('0x20')]?_0x20f3b9[_0x6a9d('0x20')][_0x6a9d('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4a8c5a){logger[_0x6a9d('0x12')](_0x6a9d('0x1d'),_0x20f3b9);logger['debug'](_0x6a9d('0x1d'),_0x20f3b9,JSON[_0x6a9d('0x17')](_0x4a8c5a));_0x4c763a(_0x4a8c5a);})[_0x6a9d('0x1c')](function(_0x3eed7c){logger[_0x6a9d('0x18')](_0x6a9d('0x1d'),_0x3eed7c[_0x6a9d('0x1a')],_0x20f3b9);_0x400f58(_0x42b00c['error'](0x1f4,_0x3eed7c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f5f9528..51a226d 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 _0x0d8b=['removeListener','register','length','smsMessage:','remove','emit'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x0d8b,0x76));var _0xb0d8=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0x0d8b[_0x2fbd0e];return _0x481c9f;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xb0d8('0x0'),'update'];function createListener(_0x353088,_0x5ecc4d){return function(_0x11c02){_0x5ecc4d[_0xb0d8('0x1')](_0x353088,_0x11c02);};}function removeListener(_0x3d42f8,_0x52b430){return function(){SmsMessageEvents[_0xb0d8('0x2')](_0x3d42f8,_0x52b430);};}exports[_0xb0d8('0x3')]=function(_0x4cac3f){for(var _0x53286e=0x0,_0xb33750=events[_0xb0d8('0x4')];_0x53286e<_0xb33750;_0x53286e++){var _0x50a605=events[_0x53286e];var _0xbceff9=createListener(_0xb0d8('0x5')+_0x50a605,_0x4cac3f);SmsMessageEvents['on'](_0x50a605,_0xbceff9);}}; \ No newline at end of file +var _0xae2d=['smsMessage:','./smsMessage.events','save','remove','emit','removeListener','length'];(function(_0x454ec2,_0x4a7cb2){var _0xf79bdf=function(_0x1abf9d){while(--_0x1abf9d){_0x454ec2['push'](_0x454ec2['shift']());}};_0xf79bdf(++_0x4a7cb2);}(_0xae2d,0x1b3));var _0xdae2=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xae2d[_0x5cb1af];return _0x8d7940;};'use strict';var SmsMessageEvents=require(_0xdae2('0x0'));var events=[_0xdae2('0x1'),_0xdae2('0x2'),'update'];function createListener(_0x184d3d,_0x2ac079){return function(_0x36536b){_0x2ac079[_0xdae2('0x3')](_0x184d3d,_0x36536b);};}function removeListener(_0x198fae,_0x4a1d60){return function(){SmsMessageEvents[_0xdae2('0x4')](_0x198fae,_0x4a1d60);};}exports['register']=function(_0x16fa44){for(var _0x3a8c1e=0x0,_0x4ee016=events[_0xdae2('0x5')];_0x3a8c1e<_0x4ee016;_0x3a8c1e++){var _0xc29fc8=events[_0x3a8c1e];var _0x768dbb=createListener(_0xdae2('0x6')+_0xc29fc8,_0x16fa44);SmsMessageEvents['on'](_0xc29fc8,_0x768dbb);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 08c0f37..cbddaaa 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 _0xa2c1=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','create','addTeams','put'];(function(_0x963b04,_0x2e0013){var _0x8d8d83=function(_0x360b77){while(--_0x360b77){_0x963b04['push'](_0x963b04['shift']());}};_0x8d8d83(++_0x2e0013);}(_0xa2c1,0xd8));var _0x1a2c=function(_0x509720,_0xdc7b1b){_0x509720=_0x509720-0x0;var _0x393c45=_0xa2c1[_0x509720];return _0x393c45;};'use strict';var multer=require(_0x1a2c('0x0'));var util=require(_0x1a2c('0x1'));var path=require(_0x1a2c('0x2'));var timeout=require(_0x1a2c('0x3'));var express=require(_0x1a2c('0x4'));var router=express[_0x1a2c('0x5')]();var fs_extra=require(_0x1a2c('0x6'));var auth=require(_0x1a2c('0x7'));var interaction=require(_0x1a2c('0x8'));var config=require(_0x1a2c('0x9'));var controller=require(_0x1a2c('0xa'));router[_0x1a2c('0xb')]('/',auth[_0x1a2c('0xc')](),controller[_0x1a2c('0xd')]);router[_0x1a2c('0xb')](_0x1a2c('0xe'),auth['isAuthenticated'](),controller[_0x1a2c('0xf')]);router['get'](_0x1a2c('0x10'),auth[_0x1a2c('0xc')](),controller[_0x1a2c('0x11')]);router[_0x1a2c('0xb')]('/:id/members',auth[_0x1a2c('0xc')](),controller['getMembers']);router[_0x1a2c('0xb')](_0x1a2c('0x12'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x1a2c('0x13'),auth[_0x1a2c('0xc')](),controller[_0x1a2c('0x14')]);router['post']('/',auth[_0x1a2c('0xc')](),controller[_0x1a2c('0x15')]);router['post'](_0x1a2c('0x12'),auth[_0x1a2c('0xc')](),controller[_0x1a2c('0x16')]);router['post'](_0x1a2c('0x13'),auth[_0x1a2c('0xc')](),controller['addAgents']);router[_0x1a2c('0x17')](_0x1a2c('0x10'),auth['isAuthenticated'](),controller[_0x1a2c('0x18')]);router[_0x1a2c('0x19')]('/:id',auth[_0x1a2c('0xc')](),controller[_0x1a2c('0x1a')]);router[_0x1a2c('0x19')]('/:id/teams',auth[_0x1a2c('0xc')](),controller[_0x1a2c('0x1b')]);router['delete'](_0x1a2c('0x13'),auth[_0x1a2c('0xc')](),controller[_0x1a2c('0x1c')]);module[_0x1a2c('0x1d')]=router; \ No newline at end of file +var _0xbcd8=['/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','describe','/:id','show'];(function(_0x27348d,_0x100aa3){var _0x5e05e3=function(_0x36234c){while(--_0x36234c){_0x27348d['push'](_0x27348d['shift']());}};_0x5e05e3(++_0x100aa3);}(_0xbcd8,0xb8));var _0x8bcd=function(_0x5a3fa6,_0x13eeef){_0x5a3fa6=_0x5a3fa6-0x0;var _0x5d5d93=_0xbcd8[_0x5a3fa6];return _0x5d5d93;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8bcd('0x0'));var express=require('express');var router=express[_0x8bcd('0x1')]();var fs_extra=require(_0x8bcd('0x2'));var auth=require(_0x8bcd('0x3'));var interaction=require(_0x8bcd('0x4'));var config=require(_0x8bcd('0x5'));var controller=require(_0x8bcd('0x6'));router[_0x8bcd('0x7')]('/',auth['isAuthenticated'](),controller[_0x8bcd('0x8')]);router[_0x8bcd('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8bcd('0x9')]);router['get'](_0x8bcd('0xa'),auth['isAuthenticated'](),controller[_0x8bcd('0xb')]);router[_0x8bcd('0x7')](_0x8bcd('0xc'),auth[_0x8bcd('0xd')](),controller[_0x8bcd('0xe')]);router[_0x8bcd('0x7')](_0x8bcd('0xf'),auth[_0x8bcd('0xd')](),controller[_0x8bcd('0x10')]);router['get'](_0x8bcd('0x11'),auth[_0x8bcd('0xd')](),controller[_0x8bcd('0x12')]);router[_0x8bcd('0x13')]('/',auth[_0x8bcd('0xd')](),controller[_0x8bcd('0x14')]);router['post'](_0x8bcd('0xf'),auth[_0x8bcd('0xd')](),controller[_0x8bcd('0x15')]);router['post'](_0x8bcd('0x11'),auth[_0x8bcd('0xd')](),controller['addAgents']);router[_0x8bcd('0x16')](_0x8bcd('0xa'),auth[_0x8bcd('0xd')](),controller['update']);router[_0x8bcd('0x17')]('/:id',auth[_0x8bcd('0xd')](),controller[_0x8bcd('0x18')]);router['delete'](_0x8bcd('0xf'),auth[_0x8bcd('0xd')](),controller[_0x8bcd('0x19')]);router['delete']('/:id/users',auth[_0x8bcd('0xd')](),controller[_0x8bcd('0x1a')]);module[_0x8bcd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d9bc024..1ba6659 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 _0xd988=['STRING','name','INTEGER','roundrobin','sequelize'];(function(_0x432b18,_0x336a33){var _0x469221=function(_0x403b11){while(--_0x403b11){_0x432b18['push'](_0x432b18['shift']());}};_0x469221(++_0x336a33);}(_0xd988,0x112));var _0x8d98=function(_0x4dcf7f,_0x320004){_0x4dcf7f=_0x4dcf7f-0x0;var _0x8a0825=_0xd988[_0x4dcf7f];return _0x8a0825;};'use strict';var Sequelize=require(_0x8d98('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d98('0x1')],'unique':_0x8d98('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8d98('0x1')]},'timeout':{'type':Sequelize[_0x8d98('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x8d98('0x4'))}}; \ No newline at end of file +var _0xd836=['sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x2bc57e,_0xd450d7){var _0x5561fb=function(_0x3b84d7){while(--_0x3b84d7){_0x2bc57e['push'](_0x2bc57e['shift']());}};_0x5561fb(++_0xd450d7);}(_0xd836,0x1c2));var _0x6d83=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd836[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x6d83('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d83('0x1')],'unique':_0x6d83('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6d83('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6d83('0x3')](_0x6d83('0x4'),_0x6d83('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 11623c7..6637766 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 _0xbc87=['forEach','emit','userSmsQueue:save','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','get','SmsQueues','UserProfileResource','then','error','stack','name','send','index','SmsQueue','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserSmsQueue','rawAttributes','SmsQueueId','User','findAndCountAll','updatedAt','format','%s/%s','smsPause','createdAt','getTeams','Team','addTeams','ids','voicePause','flatMap','sequelize','transaction','each','findOrCreate'];(function(_0x395e0d,_0x1a7f72){var _0x368540=function(_0xb37665){while(--_0xb37665){_0x395e0d['push'](_0x395e0d['shift']());}};_0x368540(++_0x1a7f72);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x4bb4d2,_0x43cd6f){_0x4bb4d2=_0x4bb4d2-0x0;var _0x3f3e46=_0xbc87[_0x4bb4d2];return _0x3f3e46;};'use strict';var emlformat=require(_0x7bc8('0x0'));var rimraf=require(_0x7bc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bc8('0x2'));var rp=require(_0x7bc8('0x3'));var moment=require(_0x7bc8('0x4'));var BPromise=require(_0x7bc8('0x5'));var Mustache=require('mustache');var util=require(_0x7bc8('0x6'));var path=require(_0x7bc8('0x7'));var sox=require(_0x7bc8('0x8'));var csv=require(_0x7bc8('0x9'));var ejs=require(_0x7bc8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7bc8('0xb'));var crypto=require(_0x7bc8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7bc8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7bc8('0xe'));var Papa=require(_0x7bc8('0xf'));var Redis=require('ioredis');var authService=require(_0x7bc8('0x10'));var qs=require(_0x7bc8('0x11'));var as=require(_0x7bc8('0x12'));var hardwareService=require(_0x7bc8('0x13'));var logger=require(_0x7bc8('0x14'))('api');var utils=require(_0x7bc8('0x15'));var config=require(_0x7bc8('0x16'));var licenseUtil=require(_0x7bc8('0x17'));var db=require(_0x7bc8('0x18'))['db'];config[_0x7bc8('0x19')]=_[_0x7bc8('0x1a')](config[_0x7bc8('0x19')],{'host':_0x7bc8('0x1b'),'port':0x18eb});var socket=require(_0x7bc8('0x1c'))(new Redis(config[_0x7bc8('0x19')]));require(_0x7bc8('0x1d'))['register'](socket);function respondWithStatusCode(_0xaffc57,_0x1621bc){_0x1621bc=_0x1621bc||0xcc;return function(_0x22696c){if(_0x22696c){return _0xaffc57[_0x7bc8('0x1e')](_0x1621bc);}return _0xaffc57['status'](_0x1621bc)[_0x7bc8('0x1f')]();};}function respondWithResult(_0x53be05,_0x249bd2){_0x249bd2=_0x249bd2||0xc8;return function(_0x56a3f3){if(_0x56a3f3){return _0x53be05[_0x7bc8('0x20')](_0x249bd2)[_0x7bc8('0x21')](_0x56a3f3);}};}function respondWithFilteredResult(_0x2afec4,_0x4fdcb0){return function(_0xcfb543){if(_0xcfb543){var _0x1f2fb9=typeof _0x4fdcb0[_0x7bc8('0x22')]===_0x7bc8('0x23')&&typeof _0x4fdcb0[_0x7bc8('0x24')]===_0x7bc8('0x23');var _0x7c2bdb=_0xcfb543[_0x7bc8('0x25')];var _0x5cc4af=_0x1f2fb9?0x0:_0x4fdcb0[_0x7bc8('0x22')];var _0x5d0791=_0x1f2fb9?_0xcfb543[_0x7bc8('0x25')]:_0x4fdcb0[_0x7bc8('0x22')]+_0x4fdcb0[_0x7bc8('0x24')];var _0x42a251;if(_0x5d0791>=_0x7c2bdb){_0x5d0791=_0x7c2bdb;_0x42a251=0xc8;}else{_0x42a251=0xce;}_0x2afec4[_0x7bc8('0x20')](_0x42a251);return _0x2afec4[_0x7bc8('0x26')]('Content-Range',_0x5cc4af+'-'+_0x5d0791+'/'+_0x7c2bdb)[_0x7bc8('0x21')](_0xcfb543);}return null;};}function patchUpdates(_0x60cbb9){return function(_0x117c79){try{jsonpatch[_0x7bc8('0x27')](_0x117c79,_0x60cbb9,!![]);}catch(_0x2fd38b){return BPromise[_0x7bc8('0x28')](_0x2fd38b);}return _0x117c79[_0x7bc8('0x29')]();};}function saveUpdates(_0x305e52,_0x1e42e6){return function(_0x2672d4){if(_0x2672d4){return _0x2672d4[_0x7bc8('0x2a')](_0x305e52)['then'](function(_0x3ef138){return _0x3ef138;});}return null;};}function removeEntity(_0x9dc530,_0x2133eb){return function(_0x369550){if(_0x369550){return _0x369550['destroy']()['then'](function(){var _0x4c8a74=_0x369550[_0x7bc8('0x2b')]({'plain':!![]});var _0x402f17=_0x7bc8('0x2c');return db[_0x7bc8('0x2d')]['destroy']({'where':{'type':_0x402f17,'resourceId':_0x4c8a74['id']}})[_0x7bc8('0x2e')](function(){return _0x369550;});})[_0x7bc8('0x2e')](function(){_0x9dc530[_0x7bc8('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17baec,_0x5a4c5c){return function(_0x104a2f){if(!_0x104a2f){_0x17baec[_0x7bc8('0x1e')](0x194);}return _0x104a2f;};}function handleError(_0x3b54b8,_0x3071c4){_0x3071c4=_0x3071c4||0x1f4;return function(_0xe8418c){logger[_0x7bc8('0x2f')](_0xe8418c[_0x7bc8('0x30')]);if(_0xe8418c[_0x7bc8('0x31')]){delete _0xe8418c[_0x7bc8('0x31')];}_0x3b54b8[_0x7bc8('0x20')](_0x3071c4)[_0x7bc8('0x32')](_0xe8418c);};}exports[_0x7bc8('0x33')]=function(_0x9a0af1,_0x43d13d){var _0x56496d={},_0x27cd9f={},_0xca3acd={'count':0x0,'rows':[]};var _0x29c709=_['map'](db[_0x7bc8('0x34')]['rawAttributes'],function(_0x332d91){return{'name':_0x332d91['fieldName'],'type':_0x332d91[_0x7bc8('0x35')][_0x7bc8('0x36')]};});_0x27cd9f[_0x7bc8('0x37')]=_[_0x7bc8('0x38')](_0x29c709,_0x7bc8('0x31'));_0x27cd9f['query']=_[_0x7bc8('0x39')](_0x9a0af1[_0x7bc8('0x3a')]);_0x27cd9f[_0x7bc8('0x3b')]=_[_0x7bc8('0x3c')](_0x27cd9f[_0x7bc8('0x37')],_0x27cd9f[_0x7bc8('0x3a')]);_0x56496d[_0x7bc8('0x3d')]=_[_0x7bc8('0x3c')](_0x27cd9f[_0x7bc8('0x37')],qs[_0x7bc8('0x3e')](_0x9a0af1[_0x7bc8('0x3a')][_0x7bc8('0x3e')]));_0x56496d[_0x7bc8('0x3d')]=_0x56496d[_0x7bc8('0x3d')]['length']?_0x56496d[_0x7bc8('0x3d')]:_0x27cd9f[_0x7bc8('0x37')];if(!_0x9a0af1[_0x7bc8('0x3a')][_0x7bc8('0x3f')](_0x7bc8('0x40'))){_0x56496d[_0x7bc8('0x24')]=qs[_0x7bc8('0x24')](_0x9a0af1[_0x7bc8('0x3a')][_0x7bc8('0x24')]);_0x56496d[_0x7bc8('0x22')]=qs[_0x7bc8('0x22')](_0x9a0af1[_0x7bc8('0x3a')][_0x7bc8('0x22')]);}_0x56496d[_0x7bc8('0x41')]=qs[_0x7bc8('0x42')](_0x9a0af1[_0x7bc8('0x3a')]['sort']);_0x56496d['where']=qs[_0x7bc8('0x3b')](_[_0x7bc8('0x43')](_0x9a0af1[_0x7bc8('0x3a')],_0x27cd9f[_0x7bc8('0x3b')]),_0x29c709);if(_0x9a0af1[_0x7bc8('0x3a')]['filter']){_0x56496d[_0x7bc8('0x44')]=_[_0x7bc8('0x45')](_0x56496d[_0x7bc8('0x44')],{'$or':_[_0x7bc8('0x38')](_0x29c709,function(_0x45ed82){if(_0x45ed82[_0x7bc8('0x35')]!==_0x7bc8('0x46')){var _0x552740={};_0x552740[_0x45ed82['name']]={'$like':'%'+_0x9a0af1[_0x7bc8('0x3a')][_0x7bc8('0x47')]+'%'};return _0x552740;}})});}_0x56496d=_[_0x7bc8('0x45')]({},_0x56496d,_0x9a0af1['options']);var _0xd71088={'where':_0x56496d[_0x7bc8('0x44')]};return db['SmsQueue'][_0x7bc8('0x25')](_0xd71088)[_0x7bc8('0x2e')](function(_0x22f361){_0xca3acd[_0x7bc8('0x25')]=_0x22f361;if(_0x9a0af1[_0x7bc8('0x3a')][_0x7bc8('0x48')]){_0x56496d[_0x7bc8('0x49')]=[{'all':!![]}];}return db['SmsQueue'][_0x7bc8('0x4a')](_0x56496d);})[_0x7bc8('0x2e')](function(_0x282fd1){_0xca3acd[_0x7bc8('0x4b')]=_0x282fd1;return _0xca3acd;})[_0x7bc8('0x2e')](respondWithFilteredResult(_0x43d13d,_0x56496d))[_0x7bc8('0x4c')](handleError(_0x43d13d,null));};exports[_0x7bc8('0x4d')]=function(_0x20e534,_0x320911){var _0x46544c={'raw':!![],'where':{'id':_0x20e534[_0x7bc8('0x4e')]['id']}},_0x37d852={};_0x37d852['model']=_[_0x7bc8('0x39')](db[_0x7bc8('0x34')]['rawAttributes']);_0x37d852['query']=_[_0x7bc8('0x39')](_0x20e534[_0x7bc8('0x3a')]);_0x37d852[_0x7bc8('0x3b')]=_[_0x7bc8('0x3c')](_0x37d852[_0x7bc8('0x37')],_0x37d852[_0x7bc8('0x3a')]);_0x46544c[_0x7bc8('0x3d')]=_[_0x7bc8('0x3c')](_0x37d852[_0x7bc8('0x37')],qs[_0x7bc8('0x3e')](_0x20e534['query'][_0x7bc8('0x3e')]));_0x46544c[_0x7bc8('0x3d')]=_0x46544c['attributes'][_0x7bc8('0x4f')]?_0x46544c[_0x7bc8('0x3d')]:_0x37d852[_0x7bc8('0x37')];if(_0x20e534['query'][_0x7bc8('0x48')]){_0x46544c[_0x7bc8('0x49')]=[{'all':!![]}];}_0x46544c=_[_0x7bc8('0x45')]({},_0x46544c,_0x20e534[_0x7bc8('0x50')]);return db[_0x7bc8('0x34')]['find'](_0x46544c)[_0x7bc8('0x2e')](handleEntityNotFound(_0x320911,null))[_0x7bc8('0x2e')](respondWithResult(_0x320911,null))[_0x7bc8('0x4c')](handleError(_0x320911,null));};exports['create']=function(_0x52d093,_0x8fbe67){return db[_0x7bc8('0x34')][_0x7bc8('0x51')](_0x52d093[_0x7bc8('0x52')],{})[_0x7bc8('0x2e')](function(_0x4a7729){var _0x1794bc=_0x52d093[_0x7bc8('0x53')][_0x7bc8('0x2b')]({'plain':!![]});if(!_0x1794bc)throw new Error(_0x7bc8('0x54'));if(_0x1794bc[_0x7bc8('0x55')]===_0x7bc8('0x53')){var _0x4b4577=_0x4a7729['get']({'plain':!![]});var _0x4aae42=_0x7bc8('0x2c');return db[_0x7bc8('0x56')][_0x7bc8('0x57')]({'where':{'name':_0x4aae42,'userProfileId':_0x1794bc[_0x7bc8('0x58')]},'raw':!![]})['then'](function(_0x161fc5){if(_0x161fc5&&_0x161fc5[_0x7bc8('0x59')]===0x0){return db[_0x7bc8('0x2d')][_0x7bc8('0x51')]({'name':_0x4b4577[_0x7bc8('0x31')],'resourceId':_0x4b4577['id'],'type':_0x161fc5[_0x7bc8('0x31')],'sectionId':_0x161fc5['id']},{})[_0x7bc8('0x2e')](function(){return _0x4a7729;});}else{return _0x4a7729;}})[_0x7bc8('0x4c')](function(_0x964898){logger[_0x7bc8('0x2f')](_0x7bc8('0x5a'),_0x964898);throw _0x964898;});}return _0x4a7729;})[_0x7bc8('0x2e')](respondWithResult(_0x8fbe67,0xc9))['catch'](handleError(_0x8fbe67,null));};exports[_0x7bc8('0x2a')]=function(_0x7eac7b,_0x47cbd1){if(_0x7eac7b['body']['id']){delete _0x7eac7b['body']['id'];}return db[_0x7bc8('0x34')][_0x7bc8('0x57')]({'where':{'id':_0x7eac7b[_0x7bc8('0x4e')]['id']}})[_0x7bc8('0x2e')](handleEntityNotFound(_0x47cbd1,null))[_0x7bc8('0x2e')](saveUpdates(_0x7eac7b[_0x7bc8('0x52')],null))[_0x7bc8('0x2e')](respondWithResult(_0x47cbd1,null))[_0x7bc8('0x4c')](handleError(_0x47cbd1,null));};exports[_0x7bc8('0x5b')]=function(_0x3bdf41,_0x107686){return db['SmsQueue'][_0x7bc8('0x57')]({'where':{'id':_0x3bdf41[_0x7bc8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x107686,null))[_0x7bc8('0x2e')](removeEntity(_0x107686,null))['catch'](handleError(_0x107686,null));};exports[_0x7bc8('0x5c')]=function(_0x42ae87,_0x27cde0){return db['SmsQueue'][_0x7bc8('0x5c')]()[_0x7bc8('0x2e')](respondWithResult(_0x27cde0,null))[_0x7bc8('0x4c')](handleError(_0x27cde0,null));};exports[_0x7bc8('0x5d')]=function(_0xc4d573,_0x5ca59b,_0x321f67){var _0xa938b5={'raw':!![],'where':{}},_0x50cc22={},_0x1fb856;return db[_0x7bc8('0x34')][_0x7bc8('0x5e')]({'where':{'id':_0xc4d573['params']['id']}})['then'](handleEntityNotFound(_0x5ca59b,null))[_0x7bc8('0x2e')](function(_0xf43fb2){if(_0xf43fb2){_0x1fb856=_0xf43fb2[_0x7bc8('0x2b')]({'plain':!![]});_0x50cc22[_0x7bc8('0x37')]=_['keys'](db[_0x7bc8('0x5f')][_0x7bc8('0x60')]);_0x50cc22[_0x7bc8('0x3a')]=_[_0x7bc8('0x39')](_0xc4d573[_0x7bc8('0x3a')]);_0x50cc22['filters']=_[_0x7bc8('0x3c')](_0x50cc22[_0x7bc8('0x37')],_0x50cc22[_0x7bc8('0x3a')]);_0xa938b5['attributes']=_[_0x7bc8('0x3c')](_0x50cc22[_0x7bc8('0x37')],qs['fields'](_0xc4d573[_0x7bc8('0x3a')][_0x7bc8('0x3e')]));_0xa938b5['attributes']=_0xa938b5['attributes'][_0x7bc8('0x4f')]?_0xa938b5['attributes']:_0x50cc22['model'];if(!_0xc4d573[_0x7bc8('0x3a')][_0x7bc8('0x3f')](_0x7bc8('0x40'))){_0xa938b5[_0x7bc8('0x24')]=qs['limit'](_0xc4d573[_0x7bc8('0x3a')][_0x7bc8('0x24')]);_0xa938b5['offset']=qs[_0x7bc8('0x22')](_0xc4d573[_0x7bc8('0x3a')]['offset']);}_0xa938b5['order']=qs[_0x7bc8('0x42')](_0xc4d573[_0x7bc8('0x3a')]['sort']);_0xa938b5[_0x7bc8('0x44')]=qs[_0x7bc8('0x3b')](_['pick'](_0xc4d573['query'],_0x50cc22[_0x7bc8('0x3b')]));_0xa938b5[_0x7bc8('0x44')][_0x7bc8('0x61')]=_0xf43fb2['id'];if(_0xc4d573[_0x7bc8('0x3a')][_0x7bc8('0x47')]){_0xa938b5[_0x7bc8('0x44')]=_['merge'](_0xa938b5[_0x7bc8('0x44')],{'$or':_[_0x7bc8('0x38')](_0xa938b5['attributes'],function(_0x5b0acb){var _0x41d6d0={};_0x41d6d0[_0x5b0acb]={'$like':'%'+_0xc4d573[_0x7bc8('0x3a')][_0x7bc8('0x47')]+'%'};return _0x41d6d0;})});}_0xa938b5=_[_0x7bc8('0x45')]({},_0xa938b5,_0xc4d573['options']);return db[_0x7bc8('0x5f')][_0x7bc8('0x4a')](_0xa938b5);}})[_0x7bc8('0x2e')](function(_0x51b816){if(_0x51b816){return db[_0x7bc8('0x62')][_0x7bc8('0x63')]({'where':{'id':_['map'](_0x51b816,'UserId'),'role':'agent'},'attributes':['id',_0x7bc8('0x31'),'smsPause',_0x7bc8('0x64'),'createdAt']});}})[_0x7bc8('0x2e')](function(_0x186698){if(_0x186698){return{'count':_0x186698[_0x7bc8('0x25')],'rows':_[_0x7bc8('0x38')](_0x186698[_0x7bc8('0x4b')],function(_0x97a037){return{'membername':_0x97a037['name'],'UserId':_0x97a037['id'],'queue_name':_0x1fb856[_0x7bc8('0x31')],'SmsQueueId':_0x1fb856['id'],'interface':util[_0x7bc8('0x65')](_0x7bc8('0x66'),'SIP',_0x97a037[_0x7bc8('0x31')]),'penalty':0x0,'paused':_0x97a037[_0x7bc8('0x67')],'createdAt':_0x97a037[_0x7bc8('0x68')],'updatedAt':_0x97a037[_0x7bc8('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7bc8('0x2e')](respondWithFilteredResult(_0x5ca59b,_0xa938b5))[_0x7bc8('0x4c')](handleError(_0x5ca59b,null));};exports[_0x7bc8('0x69')]=function(_0xcd4bb8,_0x1b9f0c,_0x5c436f){var _0x55a36e={};var _0x20a536={};var _0x528f7c;var _0x3f0b46;return db[_0x7bc8('0x34')][_0x7bc8('0x5e')]({'where':{'id':_0xcd4bb8[_0x7bc8('0x4e')]['id']}})[_0x7bc8('0x2e')](handleEntityNotFound(_0x1b9f0c,null))[_0x7bc8('0x2e')](function(_0x4098e7){if(_0x4098e7){_0x528f7c=_0x4098e7;_0x20a536['model']=_[_0x7bc8('0x39')](db[_0x7bc8('0x6a')][_0x7bc8('0x60')]);_0x20a536[_0x7bc8('0x3a')]=_[_0x7bc8('0x39')](_0xcd4bb8[_0x7bc8('0x3a')]);_0x20a536['filters']=_[_0x7bc8('0x3c')](_0x20a536[_0x7bc8('0x37')],_0x20a536[_0x7bc8('0x3a')]);_0x55a36e['attributes']=_[_0x7bc8('0x3c')](_0x20a536[_0x7bc8('0x37')],qs[_0x7bc8('0x3e')](_0xcd4bb8[_0x7bc8('0x3a')][_0x7bc8('0x3e')]));_0x55a36e[_0x7bc8('0x3d')]=_0x55a36e['attributes'][_0x7bc8('0x4f')]?_0x55a36e[_0x7bc8('0x3d')]:_0x20a536[_0x7bc8('0x37')];_0x55a36e[_0x7bc8('0x41')]=qs[_0x7bc8('0x42')](_0xcd4bb8['query'][_0x7bc8('0x42')]);_0x55a36e[_0x7bc8('0x44')]=qs[_0x7bc8('0x3b')](_[_0x7bc8('0x43')](_0xcd4bb8[_0x7bc8('0x3a')],_0x20a536[_0x7bc8('0x3b')]));if(_0xcd4bb8[_0x7bc8('0x3a')][_0x7bc8('0x47')]){_0x55a36e['where']=_['merge'](_0x55a36e[_0x7bc8('0x44')],{'$or':_[_0x7bc8('0x38')](_0x55a36e[_0x7bc8('0x3d')],function(_0x22e3ec){var _0x505aaa={};_0x505aaa[_0x22e3ec]={'$like':'%'+_0xcd4bb8[_0x7bc8('0x3a')][_0x7bc8('0x47')]+'%'};return _0x505aaa;})});}_0x55a36e=_['merge']({},_0x55a36e,_0xcd4bb8[_0x7bc8('0x50')]);return _0x528f7c[_0x7bc8('0x69')](_0x55a36e);}})[_0x7bc8('0x2e')](function(_0x3b2756){if(_0x3b2756){_0x3f0b46=_0x3b2756[_0x7bc8('0x4f')];if(!_0xcd4bb8['query'][_0x7bc8('0x3f')](_0x7bc8('0x40'))){_0x55a36e[_0x7bc8('0x24')]=qs[_0x7bc8('0x24')](_0xcd4bb8[_0x7bc8('0x3a')]['limit']);_0x55a36e[_0x7bc8('0x22')]=qs[_0x7bc8('0x22')](_0xcd4bb8[_0x7bc8('0x3a')][_0x7bc8('0x22')]);}return _0x528f7c[_0x7bc8('0x69')](_0x55a36e);}})[_0x7bc8('0x2e')](function(_0x3b96cb){if(_0x3b96cb){return _0x3b96cb?{'count':_0x3f0b46,'rows':_0x3b96cb}:null;}})['then'](respondWithResult(_0x1b9f0c,null))[_0x7bc8('0x4c')](handleError(_0x1b9f0c,null));};exports[_0x7bc8('0x6b')]=function(_0x5277d6,_0x47362c,_0x2c24c8){var _0x132f4f=_0x5277d6[_0x7bc8('0x52')][_0x7bc8('0x6c')];return db[_0x7bc8('0x6a')]['findAll']({'where':{'id':_0x132f4f},'attributes':['id'],'include':[{'model':db[_0x7bc8('0x62')],'as':'Agents','attributes':['id','name','online',_0x7bc8('0x6d'),'interface'],'raw':!![]}]})[_0x7bc8('0x2e')](function(_0x531a49){if(_0x531a49){var _0xcfbd34=_[_0x7bc8('0x6e')](_0x531a49,function(_0x445ee6){var _0x438dd6=_0x445ee6[_0x7bc8('0x2b')]({'plain':!![]});return _0x438dd6['Agents'];});return db[_0x7bc8('0x34')]['find']({'where':{'id':_0x5277d6[_0x7bc8('0x4e')]['id']}})[_0x7bc8('0x2e')](function(_0x39086a){return db[_0x7bc8('0x6f')][_0x7bc8('0x70')](function(_0xeab4df){return _0x39086a[_0x7bc8('0x6b')](_0x132f4f,{'transaction':_0xeab4df})[_0x7bc8('0x2e')](function(){return BPromise[_0x7bc8('0x71')](_0xcfbd34,function(_0x2c1048){return db[_0x7bc8('0x5f')][_0x7bc8('0x72')]({'where':{'UserId':_0x2c1048['id'],'SmsQueueId':_0x5277d6[_0x7bc8('0x4e')]['id']},'transaction':_0xeab4df});});})[_0x7bc8('0x2e')](function(){_0xcfbd34[_0x7bc8('0x73')](function(_0x3018f9){socket[_0x7bc8('0x74')](_0x7bc8('0x75'),{'UserId':_0x3018f9['id'],'SmsQueueId':_0x39086a['id']});});});});});}})[_0x7bc8('0x2e')](respondWithStatusCode(_0x47362c,null))[_0x7bc8('0x4c')](handleError(_0x47362c,null));};exports['removeTeams']=function(_0x17a9c7,_0x39a2cb,_0x23b87a){return db[_0x7bc8('0x6a')][_0x7bc8('0x4a')]({'where':{'id':_0x17a9c7[_0x7bc8('0x3a')][_0x7bc8('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x7bc8('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7bc8('0x2e')](handleEntityNotFound(_0x39a2cb,null))[_0x7bc8('0x2e')](function(_0x42eaa7){var _0x4a9b8e=_[_0x7bc8('0x38')](_0x42eaa7,'id');var _0x57866d=[];var _0x3ec2a5=[];var _0x3e57b8=squel['select']();_0x3e57b8[_0x7bc8('0x76')](_0x7bc8('0x77'))[_0x7bc8('0x78')](_0x7bc8('0x79'),'tq')[_0x7bc8('0x7a')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7bc8('0x7b'),_0x17a9c7[_0x7bc8('0x4e')]['id']);for(var _0x242394=0x0;_0x242394<_0x42eaa7[_0x7bc8('0x4f')];_0x242394+=0x1){let _0x25d49e=_0x42eaa7[_0x242394];for(var _0x335afe=0x0;_0x335afe<_0x25d49e['Agents'][_0x7bc8('0x4f')];_0x335afe+=0x1){let _0x26a784=_0x25d49e[_0x7bc8('0x7c')][_0x335afe];var _0x1bdb7a=_0x3e57b8[_0x7bc8('0x7d')]();_0x1bdb7a[_0x7bc8('0x44')](_0x7bc8('0x7e'),_0x26a784['id']);_0x3ec2a5[_0x7bc8('0x7f')](db[_0x7bc8('0x6f')][_0x7bc8('0x3a')](_0x1bdb7a[_0x7bc8('0x80')](),{'type':db['sequelize'][_0x7bc8('0x81')][_0x7bc8('0x82')]})[_0x7bc8('0x2e')](function(_0x1ce893){if(_0x1ce893[_0x7bc8('0x4f')]===0x1){return _0x26a784['id'];}else{var _0xfeee7a=_[_0x7bc8('0x83')](_['map'](_0x1ce893,_0x7bc8('0x84')),function(_0x569433){return _['includes'](_0x4a9b8e,_0x569433);});if(_0xfeee7a){return _0x26a784['id'];}}}));}}return BPromise[_0x7bc8('0x85')](_0x3ec2a5)['then'](function(_0x19d027){_0x57866d=_(_0x57866d)[_0x7bc8('0x86')](_0x19d027)[_0x7bc8('0x87')]()[_0x7bc8('0x88')]();return db[_0x7bc8('0x34')][_0x7bc8('0x57')]({'where':{'id':_0x17a9c7[_0x7bc8('0x4e')]['id']}})[_0x7bc8('0x2e')](function(_0x7d685b){return db[_0x7bc8('0x6f')][_0x7bc8('0x70')](function(_0x3b4775){return _0x7d685b[_0x7bc8('0x89')](_0x17a9c7[_0x7bc8('0x3a')][_0x7bc8('0x6c')],{'transaction':_0x3b4775})['then'](function(){if(!_[_0x7bc8('0x8a')](_0x57866d)){return _0x7d685b[_0x7bc8('0x8b')](_0x57866d,{'transaction':_0x3b4775});}})[_0x7bc8('0x2e')](function(){_0x57866d[_0x7bc8('0x73')](function(_0x20bcdc){socket[_0x7bc8('0x74')](_0x7bc8('0x8c'),{'UserId':_0x20bcdc,'SmsQueueId':_0x7d685b['id']});});});});});});})[_0x7bc8('0x2e')](respondWithStatusCode(_0x39a2cb,null))[_0x7bc8('0x4c')](handleError(_0x39a2cb,null));};exports[_0x7bc8('0x8d')]=function(_0x4f6e05,_0x1399a1,_0x3d0561){return db['SmsQueue'][_0x7bc8('0x57')]({'where':{'id':_0x4f6e05[_0x7bc8('0x4e')]['id']}})[_0x7bc8('0x2e')](handleEntityNotFound(_0x1399a1,null))['then'](function(_0x2ca7df){if(_0x2ca7df){return _0x2ca7df[_0x7bc8('0x8d')](_0x4f6e05[_0x7bc8('0x52')][_0x7bc8('0x6c')],_[_0x7bc8('0x8e')](_0x4f6e05[_0x7bc8('0x52')],['ids','id'])||{})['spread'](function(_0x54a74d){for(var _0x541d48=0x0;_0x541d48<_0x4f6e05[_0x7bc8('0x52')]['ids'][_0x7bc8('0x4f')];_0x541d48+=0x1){socket[_0x7bc8('0x74')](_0x7bc8('0x75'),{'UserId':Number(_0x4f6e05['body'][_0x7bc8('0x6c')][_0x541d48]),'SmsQueueId':Number(_0x4f6e05[_0x7bc8('0x4e')]['id'])});}return _0x54a74d;});}})[_0x7bc8('0x2e')](respondWithResult(_0x1399a1,null))[_0x7bc8('0x4c')](handleError(_0x1399a1,null));};exports[_0x7bc8('0x8b')]=function(_0x54b4ef,_0x3cbb44,_0x431b48){return db['SmsQueue'][_0x7bc8('0x57')]({'where':{'id':_0x54b4ef[_0x7bc8('0x4e')]['id']}})[_0x7bc8('0x2e')](handleEntityNotFound(_0x3cbb44,null))[_0x7bc8('0x2e')](function(_0x508bc5){if(_0x508bc5){return _0x508bc5[_0x7bc8('0x8b')](_0x54b4ef['query'][_0x7bc8('0x6c')])[_0x7bc8('0x2e')](function(){if(_['isArray'](_0x54b4ef[_0x7bc8('0x3a')]['ids'])){for(var _0x3703a4=0x0;_0x3703a4<_0x54b4ef[_0x7bc8('0x3a')][_0x7bc8('0x6c')][_0x7bc8('0x4f')];_0x3703a4+=0x1){socket[_0x7bc8('0x74')](_0x7bc8('0x8c'),{'UserId':Number(_0x54b4ef[_0x7bc8('0x3a')][_0x7bc8('0x6c')][_0x3703a4]),'SmsQueueId':Number(_0x54b4ef['params']['id'])});}}else{socket['emit'](_0x7bc8('0x8c'),{'UserId':Number(_0x54b4ef[_0x7bc8('0x3a')][_0x7bc8('0x6c')]),'SmsQueueId':Number(_0x54b4ef[_0x7bc8('0x4e')]['id'])});}});}})[_0x7bc8('0x2e')](respondWithStatusCode(_0x3cbb44,null))[_0x7bc8('0x4c')](handleError(_0x3cbb44,null));};exports['getAgents']=function(_0x5ba977,_0x10cb4e,_0x58077b){var _0x33d84b={};var _0x5e7513={};var _0x52ebac;var _0x21ce43;return db[_0x7bc8('0x34')][_0x7bc8('0x5e')]({'where':{'id':_0x5ba977['params']['id']}})[_0x7bc8('0x2e')](handleEntityNotFound(_0x10cb4e,null))[_0x7bc8('0x2e')](function(_0x56aa09){if(_0x56aa09){_0x52ebac=_0x56aa09;_0x5e7513[_0x7bc8('0x37')]=_[_0x7bc8('0x39')](db[_0x7bc8('0x62')][_0x7bc8('0x60')]);_0x5e7513[_0x7bc8('0x3a')]=_['keys'](_0x5ba977['query']);_0x5e7513[_0x7bc8('0x3b')]=_[_0x7bc8('0x3c')](_0x5e7513[_0x7bc8('0x37')],_0x5e7513[_0x7bc8('0x3a')]);_0x33d84b[_0x7bc8('0x3d')]=_[_0x7bc8('0x3c')](_0x5e7513[_0x7bc8('0x37')],qs[_0x7bc8('0x3e')](_0x5ba977[_0x7bc8('0x3a')][_0x7bc8('0x3e')]));_0x33d84b[_0x7bc8('0x3d')]=_0x33d84b[_0x7bc8('0x3d')][_0x7bc8('0x4f')]?_0x33d84b['attributes']:_0x5e7513[_0x7bc8('0x37')];_0x33d84b[_0x7bc8('0x41')]=qs[_0x7bc8('0x42')](_0x5ba977[_0x7bc8('0x3a')][_0x7bc8('0x42')]);_0x33d84b[_0x7bc8('0x44')]=qs['filters'](_[_0x7bc8('0x43')](_0x5ba977['query'],_0x5e7513[_0x7bc8('0x3b')]));if(_0x5ba977['query']['filter']){_0x33d84b[_0x7bc8('0x44')]=_[_0x7bc8('0x45')](_0x33d84b[_0x7bc8('0x44')],{'$or':_[_0x7bc8('0x38')](_0x33d84b[_0x7bc8('0x3d')],function(_0x562f2f){var _0x3a7408={};_0x3a7408[_0x562f2f]={'$like':'%'+_0x5ba977[_0x7bc8('0x3a')][_0x7bc8('0x47')]+'%'};return _0x3a7408;})});}_0x33d84b=_[_0x7bc8('0x45')]({},_0x33d84b,_0x5ba977[_0x7bc8('0x50')]);return _0x52ebac[_0x7bc8('0x8f')](_0x33d84b);}})['then'](function(_0x537962){if(_0x537962){_0x21ce43=_0x537962[_0x7bc8('0x4f')];if(!_0x5ba977[_0x7bc8('0x3a')][_0x7bc8('0x3f')]('nolimit')){_0x33d84b[_0x7bc8('0x24')]=qs[_0x7bc8('0x24')](_0x5ba977[_0x7bc8('0x3a')]['limit']);_0x33d84b[_0x7bc8('0x22')]=qs[_0x7bc8('0x22')](_0x5ba977[_0x7bc8('0x3a')][_0x7bc8('0x22')]);}return _0x52ebac[_0x7bc8('0x8f')](_0x33d84b);}})['then'](function(_0x5f1481){if(_0x5f1481){return _0x5f1481?{'count':_0x21ce43,'rows':_0x5f1481}:null;}})[_0x7bc8('0x2e')](respondWithResult(_0x10cb4e,null))[_0x7bc8('0x4c')](handleError(_0x10cb4e,null));}; \ No newline at end of file +var _0x32f4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','describe','getMembers','UserSmsQueue','SmsQueueId','options','findAndCountAll','UserId','agent','smsPause','updatedAt','%s/%s','SIP','getTeams','findOne','pick','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','sequelize','toString','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','limit','count','status','set','Content-Range','save','update','then','destroy','get','SmsQueues','UserProfileResource','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body'];(function(_0x163357,_0x23cfeb){var _0x24310c=function(_0x299d8c){while(--_0x299d8c){_0x163357['push'](_0x163357['shift']());}};_0x24310c(++_0x23cfeb);}(_0x32f4,0x154));var _0x432f=function(_0x18a0e6,_0x4adcd4){_0x18a0e6=_0x18a0e6-0x0;var _0x2f9623=_0x32f4[_0x18a0e6];return _0x2f9623;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require('request-promise');var moment=require(_0x432f('0x4'));var BPromise=require(_0x432f('0x5'));var Mustache=require('mustache');var util=require(_0x432f('0x6'));var path=require(_0x432f('0x7'));var sox=require(_0x432f('0x8'));var csv=require(_0x432f('0x9'));var ejs=require(_0x432f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var Redis=require(_0x432f('0x10'));var authService=require(_0x432f('0x11'));var qs=require(_0x432f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x432f('0x13'));var logger=require('../../config/logger')(_0x432f('0x14'));var utils=require('../../config/utils');var config=require(_0x432f('0x15'));var licenseUtil=require(_0x432f('0x16'));var db=require('../../mysqldb')['db'];config[_0x432f('0x17')]=_[_0x432f('0x18')](config['redis'],{'host':_0x432f('0x19'),'port':0x18eb});var socket=require(_0x432f('0x1a'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x432f('0x1b')](socket);function respondWithStatusCode(_0x44756d,_0x34add6){_0x34add6=_0x34add6||0xcc;return function(_0x453725){if(_0x453725){return _0x44756d[_0x432f('0x1c')](_0x34add6);}return _0x44756d['status'](_0x34add6)[_0x432f('0x1d')]();};}function respondWithResult(_0x2f0708,_0x1e2c30){_0x1e2c30=_0x1e2c30||0xc8;return function(_0x1504db){if(_0x1504db){return _0x2f0708['status'](_0x1e2c30)[_0x432f('0x1e')](_0x1504db);}};}function respondWithFilteredResult(_0x30f231,_0x42c2d2){return function(_0x243cf){if(_0x243cf){var _0x3cd5da=typeof _0x42c2d2[_0x432f('0x1f')]==='undefined'&&typeof _0x42c2d2[_0x432f('0x20')]==='undefined';var _0x3d545d=_0x243cf[_0x432f('0x21')];var _0x1799c4=_0x3cd5da?0x0:_0x42c2d2[_0x432f('0x1f')];var _0x1debda=_0x3cd5da?_0x243cf[_0x432f('0x21')]:_0x42c2d2[_0x432f('0x1f')]+_0x42c2d2[_0x432f('0x20')];var _0x693eb3;if(_0x1debda>=_0x3d545d){_0x1debda=_0x3d545d;_0x693eb3=0xc8;}else{_0x693eb3=0xce;}_0x30f231[_0x432f('0x22')](_0x693eb3);return _0x30f231[_0x432f('0x23')](_0x432f('0x24'),_0x1799c4+'-'+_0x1debda+'/'+_0x3d545d)['json'](_0x243cf);}return null;};}function patchUpdates(_0x5940bd){return function(_0x343d13){try{jsonpatch['apply'](_0x343d13,_0x5940bd,!![]);}catch(_0x28968e){return BPromise['reject'](_0x28968e);}return _0x343d13[_0x432f('0x25')]();};}function saveUpdates(_0x175d1b,_0x241cb4){return function(_0x89ea50){if(_0x89ea50){return _0x89ea50[_0x432f('0x26')](_0x175d1b)[_0x432f('0x27')](function(_0x59f352){return _0x59f352;});}return null;};}function removeEntity(_0x252b3b,_0x33edec){return function(_0x50bef4){if(_0x50bef4){return _0x50bef4[_0x432f('0x28')]()[_0x432f('0x27')](function(){var _0x2bcbb4=_0x50bef4[_0x432f('0x29')]({'plain':!![]});var _0x44839=_0x432f('0x2a');return db[_0x432f('0x2b')]['destroy']({'where':{'type':_0x44839,'resourceId':_0x2bcbb4['id']}})[_0x432f('0x27')](function(){return _0x50bef4;});})['then'](function(){_0x252b3b[_0x432f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20404d,_0x5a2c14){return function(_0x3f768b){if(!_0x3f768b){_0x20404d['sendStatus'](0x194);}return _0x3f768b;};}function handleError(_0x325a9c,_0x12efe2){_0x12efe2=_0x12efe2||0x1f4;return function(_0x263cd8){logger['error'](_0x263cd8[_0x432f('0x2c')]);if(_0x263cd8[_0x432f('0x2d')]){delete _0x263cd8['name'];}_0x325a9c['status'](_0x12efe2)[_0x432f('0x2e')](_0x263cd8);};}exports[_0x432f('0x2f')]=function(_0x7b849f,_0x3581c2){var _0x194f5e={},_0x1807ba={},_0x5320a0={'count':0x0,'rows':[]};var _0x4b5bb4=_[_0x432f('0x30')](db[_0x432f('0x31')][_0x432f('0x32')],function(_0x4950cc){return{'name':_0x4950cc[_0x432f('0x33')],'type':_0x4950cc[_0x432f('0x34')][_0x432f('0x35')]};});_0x1807ba[_0x432f('0x36')]=_[_0x432f('0x30')](_0x4b5bb4,_0x432f('0x2d'));_0x1807ba[_0x432f('0x37')]=_[_0x432f('0x38')](_0x7b849f['query']);_0x1807ba['filters']=_[_0x432f('0x39')](_0x1807ba[_0x432f('0x36')],_0x1807ba['query']);_0x194f5e['attributes']=_['intersection'](_0x1807ba[_0x432f('0x36')],qs[_0x432f('0x3a')](_0x7b849f['query'][_0x432f('0x3a')]));_0x194f5e[_0x432f('0x3b')]=_0x194f5e[_0x432f('0x3b')]['length']?_0x194f5e[_0x432f('0x3b')]:_0x1807ba[_0x432f('0x36')];if(!_0x7b849f['query'][_0x432f('0x3c')](_0x432f('0x3d'))){_0x194f5e['limit']=qs[_0x432f('0x20')](_0x7b849f[_0x432f('0x37')][_0x432f('0x20')]);_0x194f5e[_0x432f('0x1f')]=qs[_0x432f('0x1f')](_0x7b849f[_0x432f('0x37')][_0x432f('0x1f')]);}_0x194f5e[_0x432f('0x3e')]=qs[_0x432f('0x3f')](_0x7b849f[_0x432f('0x37')][_0x432f('0x3f')]);_0x194f5e['where']=qs[_0x432f('0x40')](_['pick'](_0x7b849f[_0x432f('0x37')],_0x1807ba[_0x432f('0x40')]),_0x4b5bb4);if(_0x7b849f['query'][_0x432f('0x41')]){_0x194f5e['where']=_[_0x432f('0x42')](_0x194f5e[_0x432f('0x43')],{'$or':_['map'](_0x4b5bb4,function(_0x490db5){if(_0x490db5[_0x432f('0x34')]!==_0x432f('0x44')){var _0x1e2487={};_0x1e2487[_0x490db5[_0x432f('0x2d')]]={'$like':'%'+_0x7b849f[_0x432f('0x37')]['filter']+'%'};return _0x1e2487;}})});}_0x194f5e=_['merge']({},_0x194f5e,_0x7b849f['options']);var _0x1ceec7={'where':_0x194f5e[_0x432f('0x43')]};return db['SmsQueue'][_0x432f('0x21')](_0x1ceec7)[_0x432f('0x27')](function(_0x41c90c){_0x5320a0[_0x432f('0x21')]=_0x41c90c;if(_0x7b849f[_0x432f('0x37')][_0x432f('0x45')]){_0x194f5e[_0x432f('0x46')]=[{'all':!![]}];}return db[_0x432f('0x31')][_0x432f('0x47')](_0x194f5e);})['then'](function(_0x247b63){_0x5320a0[_0x432f('0x48')]=_0x247b63;return _0x5320a0;})['then'](respondWithFilteredResult(_0x3581c2,_0x194f5e))[_0x432f('0x49')](handleError(_0x3581c2,null));};exports[_0x432f('0x4a')]=function(_0x12b7a8,_0x2d623e){var _0x7e903={'raw':!![],'where':{'id':_0x12b7a8[_0x432f('0x4b')]['id']}},_0xe77bd2={};_0xe77bd2[_0x432f('0x36')]=_[_0x432f('0x38')](db[_0x432f('0x31')][_0x432f('0x32')]);_0xe77bd2[_0x432f('0x37')]=_[_0x432f('0x38')](_0x12b7a8[_0x432f('0x37')]);_0xe77bd2['filters']=_['intersection'](_0xe77bd2[_0x432f('0x36')],_0xe77bd2[_0x432f('0x37')]);_0x7e903[_0x432f('0x3b')]=_[_0x432f('0x39')](_0xe77bd2[_0x432f('0x36')],qs['fields'](_0x12b7a8[_0x432f('0x37')][_0x432f('0x3a')]));_0x7e903[_0x432f('0x3b')]=_0x7e903[_0x432f('0x3b')][_0x432f('0x4c')]?_0x7e903[_0x432f('0x3b')]:_0xe77bd2[_0x432f('0x36')];if(_0x12b7a8['query'][_0x432f('0x45')]){_0x7e903[_0x432f('0x46')]=[{'all':!![]}];}_0x7e903=_[_0x432f('0x42')]({},_0x7e903,_0x12b7a8['options']);return db[_0x432f('0x31')][_0x432f('0x4d')](_0x7e903)['then'](handleEntityNotFound(_0x2d623e,null))['then'](respondWithResult(_0x2d623e,null))[_0x432f('0x49')](handleError(_0x2d623e,null));};exports[_0x432f('0x4e')]=function(_0x4a6d37,_0x57ad3a){return db[_0x432f('0x31')]['create'](_0x4a6d37[_0x432f('0x4f')],{})[_0x432f('0x27')](function(_0x5df9b3){var _0x12f2f7=_0x4a6d37['user'][_0x432f('0x29')]({'plain':!![]});if(!_0x12f2f7)throw new Error(_0x432f('0x50'));if(_0x12f2f7[_0x432f('0x51')]===_0x432f('0x52')){var _0x3051ea=_0x5df9b3[_0x432f('0x29')]({'plain':!![]});var _0x56f526=_0x432f('0x2a');return db['UserProfileSection'][_0x432f('0x4d')]({'where':{'name':_0x56f526,'userProfileId':_0x12f2f7[_0x432f('0x53')]},'raw':!![]})[_0x432f('0x27')](function(_0x21ae8c){if(_0x21ae8c&&_0x21ae8c['autoAssociation']===0x0){return db[_0x432f('0x2b')][_0x432f('0x4e')]({'name':_0x3051ea[_0x432f('0x2d')],'resourceId':_0x3051ea['id'],'type':_0x21ae8c[_0x432f('0x2d')],'sectionId':_0x21ae8c['id']},{})[_0x432f('0x27')](function(){return _0x5df9b3;});}else{return _0x5df9b3;}})[_0x432f('0x49')](function(_0x404368){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x404368);throw _0x404368;});}return _0x5df9b3;})[_0x432f('0x27')](respondWithResult(_0x57ad3a,0xc9))[_0x432f('0x49')](handleError(_0x57ad3a,null));};exports[_0x432f('0x26')]=function(_0x1b3f02,_0x284f81){if(_0x1b3f02[_0x432f('0x4f')]['id']){delete _0x1b3f02['body']['id'];}return db[_0x432f('0x31')]['find']({'where':{'id':_0x1b3f02['params']['id']}})[_0x432f('0x27')](handleEntityNotFound(_0x284f81,null))[_0x432f('0x27')](saveUpdates(_0x1b3f02[_0x432f('0x4f')],null))[_0x432f('0x27')](respondWithResult(_0x284f81,null))[_0x432f('0x49')](handleError(_0x284f81,null));};exports[_0x432f('0x28')]=function(_0x4e62d2,_0x46c36d){return db[_0x432f('0x31')]['find']({'where':{'id':_0x4e62d2[_0x432f('0x4b')]['id']}})[_0x432f('0x27')](handleEntityNotFound(_0x46c36d,null))['then'](removeEntity(_0x46c36d,null))[_0x432f('0x49')](handleError(_0x46c36d,null));};exports[_0x432f('0x54')]=function(_0x348331,_0x387999){return db[_0x432f('0x31')][_0x432f('0x54')]()[_0x432f('0x27')](respondWithResult(_0x387999,null))[_0x432f('0x49')](handleError(_0x387999,null));};exports[_0x432f('0x55')]=function(_0x361619,_0x419c68,_0x5904c6){var _0x1caa4b={'raw':!![],'where':{}},_0x43577d={},_0xb259c9;return db[_0x432f('0x31')]['findOne']({'where':{'id':_0x361619['params']['id']}})[_0x432f('0x27')](handleEntityNotFound(_0x419c68,null))[_0x432f('0x27')](function(_0x22dee6){if(_0x22dee6){_0xb259c9=_0x22dee6['get']({'plain':!![]});_0x43577d[_0x432f('0x36')]=_[_0x432f('0x38')](db[_0x432f('0x56')]['rawAttributes']);_0x43577d['query']=_[_0x432f('0x38')](_0x361619[_0x432f('0x37')]);_0x43577d['filters']=_[_0x432f('0x39')](_0x43577d['model'],_0x43577d[_0x432f('0x37')]);_0x1caa4b[_0x432f('0x3b')]=_[_0x432f('0x39')](_0x43577d['model'],qs[_0x432f('0x3a')](_0x361619[_0x432f('0x37')][_0x432f('0x3a')]));_0x1caa4b[_0x432f('0x3b')]=_0x1caa4b['attributes'][_0x432f('0x4c')]?_0x1caa4b[_0x432f('0x3b')]:_0x43577d['model'];if(!_0x361619[_0x432f('0x37')]['hasOwnProperty']('nolimit')){_0x1caa4b['limit']=qs[_0x432f('0x20')](_0x361619['query'][_0x432f('0x20')]);_0x1caa4b[_0x432f('0x1f')]=qs['offset'](_0x361619['query'][_0x432f('0x1f')]);}_0x1caa4b[_0x432f('0x3e')]=qs[_0x432f('0x3f')](_0x361619[_0x432f('0x37')]['sort']);_0x1caa4b[_0x432f('0x43')]=qs[_0x432f('0x40')](_['pick'](_0x361619[_0x432f('0x37')],_0x43577d['filters']));_0x1caa4b[_0x432f('0x43')][_0x432f('0x57')]=_0x22dee6['id'];if(_0x361619[_0x432f('0x37')]['filter']){_0x1caa4b[_0x432f('0x43')]=_[_0x432f('0x42')](_0x1caa4b[_0x432f('0x43')],{'$or':_[_0x432f('0x30')](_0x1caa4b['attributes'],function(_0x22bcb0){var _0x5dd618={};_0x5dd618[_0x22bcb0]={'$like':'%'+_0x361619[_0x432f('0x37')][_0x432f('0x41')]+'%'};return _0x5dd618;})});}_0x1caa4b=_[_0x432f('0x42')]({},_0x1caa4b,_0x361619[_0x432f('0x58')]);return db[_0x432f('0x56')][_0x432f('0x47')](_0x1caa4b);}})[_0x432f('0x27')](function(_0x8e9429){if(_0x8e9429){return db['User'][_0x432f('0x59')]({'where':{'id':_[_0x432f('0x30')](_0x8e9429,_0x432f('0x5a')),'role':_0x432f('0x5b')},'attributes':['id','name',_0x432f('0x5c'),_0x432f('0x5d'),'createdAt']});}})[_0x432f('0x27')](function(_0x211ff9){if(_0x211ff9){return{'count':_0x211ff9[_0x432f('0x21')],'rows':_['map'](_0x211ff9[_0x432f('0x48')],function(_0x197e77){return{'membername':_0x197e77[_0x432f('0x2d')],'UserId':_0x197e77['id'],'queue_name':_0xb259c9['name'],'SmsQueueId':_0xb259c9['id'],'interface':util['format'](_0x432f('0x5e'),_0x432f('0x5f'),_0x197e77[_0x432f('0x2d')]),'penalty':0x0,'paused':_0x197e77[_0x432f('0x5c')],'createdAt':_0x197e77['createdAt'],'updatedAt':_0x197e77['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x432f('0x27')](respondWithFilteredResult(_0x419c68,_0x1caa4b))['catch'](handleError(_0x419c68,null));};exports[_0x432f('0x60')]=function(_0x235119,_0x35b048,_0x46c56d){var _0x1db685={};var _0x28e378={};var _0x40abb2;var _0x46be72;return db['SmsQueue'][_0x432f('0x61')]({'where':{'id':_0x235119[_0x432f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x35b048,null))[_0x432f('0x27')](function(_0x8a4d01){if(_0x8a4d01){_0x40abb2=_0x8a4d01;_0x28e378['model']=_['keys'](db['Team'][_0x432f('0x32')]);_0x28e378[_0x432f('0x37')]=_[_0x432f('0x38')](_0x235119[_0x432f('0x37')]);_0x28e378[_0x432f('0x40')]=_[_0x432f('0x39')](_0x28e378['model'],_0x28e378[_0x432f('0x37')]);_0x1db685[_0x432f('0x3b')]=_[_0x432f('0x39')](_0x28e378[_0x432f('0x36')],qs[_0x432f('0x3a')](_0x235119[_0x432f('0x37')][_0x432f('0x3a')]));_0x1db685[_0x432f('0x3b')]=_0x1db685[_0x432f('0x3b')]['length']?_0x1db685[_0x432f('0x3b')]:_0x28e378[_0x432f('0x36')];_0x1db685[_0x432f('0x3e')]=qs[_0x432f('0x3f')](_0x235119[_0x432f('0x37')][_0x432f('0x3f')]);_0x1db685[_0x432f('0x43')]=qs[_0x432f('0x40')](_[_0x432f('0x62')](_0x235119[_0x432f('0x37')],_0x28e378[_0x432f('0x40')]));if(_0x235119['query'][_0x432f('0x41')]){_0x1db685['where']=_['merge'](_0x1db685[_0x432f('0x43')],{'$or':_[_0x432f('0x30')](_0x1db685[_0x432f('0x3b')],function(_0x590495){var _0x48171b={};_0x48171b[_0x590495]={'$like':'%'+_0x235119[_0x432f('0x37')][_0x432f('0x41')]+'%'};return _0x48171b;})});}_0x1db685=_[_0x432f('0x42')]({},_0x1db685,_0x235119[_0x432f('0x58')]);return _0x40abb2[_0x432f('0x60')](_0x1db685);}})[_0x432f('0x27')](function(_0x16c031){if(_0x16c031){_0x46be72=_0x16c031['length'];if(!_0x235119[_0x432f('0x37')][_0x432f('0x3c')](_0x432f('0x3d'))){_0x1db685['limit']=qs[_0x432f('0x20')](_0x235119[_0x432f('0x37')]['limit']);_0x1db685[_0x432f('0x1f')]=qs['offset'](_0x235119[_0x432f('0x37')][_0x432f('0x1f')]);}return _0x40abb2[_0x432f('0x60')](_0x1db685);}})[_0x432f('0x27')](function(_0x2aa06d){if(_0x2aa06d){return _0x2aa06d?{'count':_0x46be72,'rows':_0x2aa06d}:null;}})[_0x432f('0x27')](respondWithResult(_0x35b048,null))[_0x432f('0x49')](handleError(_0x35b048,null));};exports[_0x432f('0x63')]=function(_0x5c4074,_0x5d87f9,_0x525560){var _0x31d0f0=_0x5c4074[_0x432f('0x4f')]['ids'];return db[_0x432f('0x64')][_0x432f('0x47')]({'where':{'id':_0x31d0f0},'attributes':['id'],'include':[{'model':db[_0x432f('0x65')],'as':_0x432f('0x66'),'attributes':['id','name',_0x432f('0x67'),_0x432f('0x68'),_0x432f('0x69')],'raw':!![]}]})['then'](function(_0x13c605){if(_0x13c605){var _0x3a0b57=_[_0x432f('0x6a')](_0x13c605,function(_0xb88fae){var _0x43b3d3=_0xb88fae[_0x432f('0x29')]({'plain':!![]});return _0x43b3d3[_0x432f('0x66')];});return db[_0x432f('0x31')][_0x432f('0x4d')]({'where':{'id':_0x5c4074[_0x432f('0x4b')]['id']}})[_0x432f('0x27')](function(_0x300eb9){return db['sequelize'][_0x432f('0x6b')](function(_0x4aa79b){return _0x300eb9[_0x432f('0x63')](_0x31d0f0,{'transaction':_0x4aa79b})[_0x432f('0x27')](function(){return BPromise[_0x432f('0x6c')](_0x3a0b57,function(_0x557214){return db[_0x432f('0x56')][_0x432f('0x6d')]({'where':{'UserId':_0x557214['id'],'SmsQueueId':_0x5c4074[_0x432f('0x4b')]['id']},'transaction':_0x4aa79b});});})[_0x432f('0x27')](function(){_0x3a0b57[_0x432f('0x6e')](function(_0x390ac4){socket[_0x432f('0x6f')](_0x432f('0x70'),{'UserId':_0x390ac4['id'],'SmsQueueId':_0x300eb9['id']});});});});});}})[_0x432f('0x27')](respondWithStatusCode(_0x5d87f9,null))['catch'](handleError(_0x5d87f9,null));};exports[_0x432f('0x71')]=function(_0x5048d4,_0x352d52,_0x3bc812){return db[_0x432f('0x64')][_0x432f('0x47')]({'where':{'id':_0x5048d4[_0x432f('0x37')][_0x432f('0x72')]},'attributes':['id'],'include':[{'model':db[_0x432f('0x65')],'as':_0x432f('0x66'),'attributes':['id'],'raw':!![]}]})[_0x432f('0x27')](handleEntityNotFound(_0x352d52,null))[_0x432f('0x27')](function(_0x56730d){var _0x3b12b9=_['map'](_0x56730d,'id');var _0x5fecde=[];var _0x58c14d=[];var _0x3ee276=squel[_0x432f('0x73')]();_0x3ee276[_0x432f('0x74')](_0x432f('0x75'))[_0x432f('0x76')](_0x432f('0x77'),'tq')[_0x432f('0x78')](_0x432f('0x79'),'ut',_0x432f('0x7a'))[_0x432f('0x43')](_0x432f('0x7b'),_0x5048d4[_0x432f('0x4b')]['id']);for(var _0x4bb00d=0x0;_0x4bb00d<_0x56730d[_0x432f('0x4c')];_0x4bb00d+=0x1){let _0x23b042=_0x56730d[_0x4bb00d];for(var _0x5be889=0x0;_0x5be889<_0x23b042[_0x432f('0x66')][_0x432f('0x4c')];_0x5be889+=0x1){let _0x485ae8=_0x23b042[_0x432f('0x66')][_0x5be889];var _0x742766=_0x3ee276['clone']();_0x742766[_0x432f('0x43')]('ut.UserId\x20=\x20?',_0x485ae8['id']);_0x58c14d['push'](db[_0x432f('0x7c')]['query'](_0x742766[_0x432f('0x7d')](),{'type':db[_0x432f('0x7c')]['QueryTypes']['SELECT']})['then'](function(_0x21fa22){if(_0x21fa22[_0x432f('0x4c')]===0x1){return _0x485ae8['id'];}else{var _0x28187a=_[_0x432f('0x7e')](_[_0x432f('0x30')](_0x21fa22,_0x432f('0x7f')),function(_0x532b0d){return _[_0x432f('0x80')](_0x3b12b9,_0x532b0d);});if(_0x28187a){return _0x485ae8['id'];}}}));}}return BPromise[_0x432f('0x81')](_0x58c14d)[_0x432f('0x27')](function(_0x33ac1f){_0x5fecde=_(_0x5fecde)[_0x432f('0x82')](_0x33ac1f)[_0x432f('0x83')]()[_0x432f('0x84')]();return db[_0x432f('0x31')][_0x432f('0x4d')]({'where':{'id':_0x5048d4['params']['id']}})['then'](function(_0x370a71){return db[_0x432f('0x7c')][_0x432f('0x6b')](function(_0x230037){return _0x370a71['removeTeams'](_0x5048d4[_0x432f('0x37')]['ids'],{'transaction':_0x230037})[_0x432f('0x27')](function(){if(!_[_0x432f('0x85')](_0x5fecde)){return _0x370a71[_0x432f('0x86')](_0x5fecde,{'transaction':_0x230037});}})['then'](function(){_0x5fecde[_0x432f('0x6e')](function(_0x38bc2a){socket['emit'](_0x432f('0x87'),{'UserId':_0x38bc2a,'SmsQueueId':_0x370a71['id']});});});});});});})['then'](respondWithStatusCode(_0x352d52,null))['catch'](handleError(_0x352d52,null));};exports[_0x432f('0x88')]=function(_0x2b575d,_0x4674c2,_0x28d811){return db[_0x432f('0x31')][_0x432f('0x4d')]({'where':{'id':_0x2b575d[_0x432f('0x4b')]['id']}})[_0x432f('0x27')](handleEntityNotFound(_0x4674c2,null))[_0x432f('0x27')](function(_0x3d5578){if(_0x3d5578){return _0x3d5578[_0x432f('0x88')](_0x2b575d[_0x432f('0x4f')]['ids'],_[_0x432f('0x89')](_0x2b575d['body'],[_0x432f('0x72'),'id'])||{})['spread'](function(_0x25f7ea){for(var _0x29d8c0=0x0;_0x29d8c0<_0x2b575d[_0x432f('0x4f')][_0x432f('0x72')]['length'];_0x29d8c0+=0x1){socket[_0x432f('0x6f')](_0x432f('0x70'),{'UserId':Number(_0x2b575d[_0x432f('0x4f')][_0x432f('0x72')][_0x29d8c0]),'SmsQueueId':Number(_0x2b575d['params']['id'])});}return _0x25f7ea;});}})[_0x432f('0x27')](respondWithResult(_0x4674c2,null))[_0x432f('0x49')](handleError(_0x4674c2,null));};exports[_0x432f('0x86')]=function(_0x24c14a,_0x97c843,_0xf6f8f7){return db['SmsQueue'][_0x432f('0x4d')]({'where':{'id':_0x24c14a[_0x432f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x97c843,null))[_0x432f('0x27')](function(_0x535697){if(_0x535697){return _0x535697['removeAgents'](_0x24c14a['query']['ids'])[_0x432f('0x27')](function(){if(_[_0x432f('0x8a')](_0x24c14a[_0x432f('0x37')]['ids'])){for(var _0x5b8928=0x0;_0x5b8928<_0x24c14a['query'][_0x432f('0x72')][_0x432f('0x4c')];_0x5b8928+=0x1){socket['emit'](_0x432f('0x87'),{'UserId':Number(_0x24c14a[_0x432f('0x37')][_0x432f('0x72')][_0x5b8928]),'SmsQueueId':Number(_0x24c14a[_0x432f('0x4b')]['id'])});}}else{socket[_0x432f('0x6f')](_0x432f('0x87'),{'UserId':Number(_0x24c14a[_0x432f('0x37')]['ids']),'SmsQueueId':Number(_0x24c14a[_0x432f('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x97c843,null))[_0x432f('0x49')](handleError(_0x97c843,null));};exports['getAgents']=function(_0xb45493,_0x29ec5b,_0x749a67){var _0x285bd7={};var _0x5dd7fe={};var _0x34679d;var _0x14f938;return db[_0x432f('0x31')]['findOne']({'where':{'id':_0xb45493[_0x432f('0x4b')]['id']}})[_0x432f('0x27')](handleEntityNotFound(_0x29ec5b,null))[_0x432f('0x27')](function(_0x22ac23){if(_0x22ac23){_0x34679d=_0x22ac23;_0x5dd7fe[_0x432f('0x36')]=_[_0x432f('0x38')](db[_0x432f('0x65')][_0x432f('0x32')]);_0x5dd7fe[_0x432f('0x37')]=_[_0x432f('0x38')](_0xb45493[_0x432f('0x37')]);_0x5dd7fe[_0x432f('0x40')]=_[_0x432f('0x39')](_0x5dd7fe[_0x432f('0x36')],_0x5dd7fe[_0x432f('0x37')]);_0x285bd7[_0x432f('0x3b')]=_['intersection'](_0x5dd7fe[_0x432f('0x36')],qs[_0x432f('0x3a')](_0xb45493[_0x432f('0x37')]['fields']));_0x285bd7[_0x432f('0x3b')]=_0x285bd7[_0x432f('0x3b')]['length']?_0x285bd7[_0x432f('0x3b')]:_0x5dd7fe[_0x432f('0x36')];_0x285bd7[_0x432f('0x3e')]=qs[_0x432f('0x3f')](_0xb45493[_0x432f('0x37')]['sort']);_0x285bd7[_0x432f('0x43')]=qs[_0x432f('0x40')](_[_0x432f('0x62')](_0xb45493[_0x432f('0x37')],_0x5dd7fe[_0x432f('0x40')]));if(_0xb45493[_0x432f('0x37')][_0x432f('0x41')]){_0x285bd7[_0x432f('0x43')]=_[_0x432f('0x42')](_0x285bd7[_0x432f('0x43')],{'$or':_[_0x432f('0x30')](_0x285bd7[_0x432f('0x3b')],function(_0x533322){var _0x1f994a={};_0x1f994a[_0x533322]={'$like':'%'+_0xb45493[_0x432f('0x37')][_0x432f('0x41')]+'%'};return _0x1f994a;})});}_0x285bd7=_[_0x432f('0x42')]({},_0x285bd7,_0xb45493[_0x432f('0x58')]);return _0x34679d[_0x432f('0x8b')](_0x285bd7);}})[_0x432f('0x27')](function(_0x453d4d){if(_0x453d4d){_0x14f938=_0x453d4d[_0x432f('0x4c')];if(!_0xb45493[_0x432f('0x37')][_0x432f('0x3c')](_0x432f('0x3d'))){_0x285bd7[_0x432f('0x20')]=qs[_0x432f('0x20')](_0xb45493['query'][_0x432f('0x20')]);_0x285bd7[_0x432f('0x1f')]=qs['offset'](_0xb45493['query'][_0x432f('0x1f')]);}return _0x34679d[_0x432f('0x8b')](_0x285bd7);}})[_0x432f('0x27')](function(_0x4d3591){if(_0x4d3591){return _0x4d3591?{'count':_0x14f938,'rows':_0x4d3591}:null;}})['then'](respondWithResult(_0x29ec5b,null))[_0x432f('0x49')](handleError(_0x29ec5b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 88b89d8..16de298 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 _0xbb19=['SmsQueue','setMaxListeners','update','hasOwnProperty','hook','events'];(function(_0x5e9c61,_0x4d2e66){var _0x47aa98=function(_0x4444d1){while(--_0x4444d1){_0x5e9c61['push'](_0x5e9c61['shift']());}};_0x47aa98(++_0x4d2e66);}(_0xbb19,0xd1));var _0x9bb1=function(_0x18a9da,_0xdceec){_0x18a9da=_0x18a9da-0x0;var _0x33eb69=_0xbb19[_0x18a9da];return _0x33eb69;};'use strict';var EventEmitter=require(_0x9bb1('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x9bb1('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9bb1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9bb1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x9c677e){return function(_0x49cfc7,_0x528907,_0x114b6d){SmsQueueEvents['emit'](_0x9c677e+':'+_0x49cfc7['id'],_0x49cfc7);SmsQueueEvents['emit'](_0x9c677e,_0x49cfc7);_0x114b6d(null);};}for(var e in events){if(events[_0x9bb1('0x4')](e)){var event=events[e];SmsQueue[_0x9bb1('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x5ab5=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4f5bfb,_0x347e26){var _0x452c99=function(_0x2d8919){while(--_0x2d8919){_0x4f5bfb['push'](_0x4f5bfb['shift']());}};_0x452c99(++_0x347e26);}(_0x5ab5,0x196));var _0x55ab=function(_0x4656a1,_0x1feb9c){_0x4656a1=_0x4656a1-0x0;var _0x52481c=_0x5ab5[_0x4656a1];return _0x52481c;};'use strict';var EventEmitter=require(_0x55ab('0x0'));var SmsQueue=require(_0x55ab('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x55ab('0x2')](0x0);var events={'afterCreate':_0x55ab('0x3'),'afterUpdate':_0x55ab('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c8809){return function(_0x4f285e,_0x2b87d4,_0x1df7bb){SmsQueueEvents[_0x55ab('0x5')](_0x5c8809+':'+_0x4f285e['id'],_0x4f285e);SmsQueueEvents[_0x55ab('0x5')](_0x5c8809,_0x4f285e);_0x1df7bb(null);};}for(var e in events){if(events[_0x55ab('0x6')](e)){var event=events[e];SmsQueue[_0x55ab('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 734379f..396772e 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 _0x59ea=['api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','lodash'];(function(_0x11731f,_0x2271b5){var _0x14587c=function(_0x31e014){while(--_0x31e014){_0x11731f['push'](_0x11731f['shift']());}};_0x14587c(++_0x2271b5);}(_0x59ea,0xc7));var _0xa59e=function(_0x10e952,_0x366976){_0x10e952=_0x10e952-0x0;var _0x2c7665=_0x59ea[_0x10e952];return _0x2c7665;};'use strict';var _=require(_0xa59e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa59e('0x1'));var moment=require(_0xa59e('0x2'));var BPromise=require('bluebird');var rp=require(_0xa59e('0x3'));var fs=require('fs');var path=require(_0xa59e('0x4'));var rimraf=require(_0xa59e('0x5'));var config=require(_0xa59e('0x6'));var attributes=require(_0xa59e('0x7'));module[_0xa59e('0x8')]=function(_0x32f2ec,_0x50aebd){return _0x32f2ec['define'](_0xa59e('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbd7=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','define','SmsQueue'];(function(_0x73191b,_0x29599e){var _0x14d34a=function(_0x2142b8){while(--_0x2142b8){_0x73191b['push'](_0x73191b['shift']());}};_0x14d34a(++_0x29599e);}(_0xcbd7,0x106));var _0x7cbd=function(_0x2d5ee4,_0x571597){_0x2d5ee4=_0x2d5ee4-0x0;var _0x294344=_0xcbd7[_0x2d5ee4];return _0x294344;};'use strict';var _=require(_0x7cbd('0x0'));var util=require(_0x7cbd('0x1'));var logger=require(_0x7cbd('0x2'))(_0x7cbd('0x3'));var moment=require(_0x7cbd('0x4'));var BPromise=require(_0x7cbd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0x420ede,_0x3e34f2){return _0x420ede[_0x7cbd('0x6')](_0x7cbd('0x7'),attributes,{'tableName':_0x7cbd('0x8'),'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 e2db183..deee15c 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 _0x145a=['then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','model','map','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request'];(function(_0x7a3904,_0x4c2a1f){var _0x1491ed=function(_0x52fdfb){while(--_0x52fdfb){_0x7a3904['push'](_0x7a3904['shift']());}};_0x1491ed(++_0x4c2a1f);}(_0x145a,0x1f2));var _0xa145=function(_0x4c39e6,_0x389e88){_0x4c39e6=_0x4c39e6-0x0;var _0x491566=_0x145a[_0x4c39e6];return _0x491566;};'use strict';var _=require(_0xa145('0x0'));var util=require(_0xa145('0x1'));var moment=require(_0xa145('0x2'));var BPromise=require(_0xa145('0x3'));var rs=require(_0xa145('0x4'));var fs=require('fs');var Redis=require(_0xa145('0x5'));var db=require(_0xa145('0x6'))['db'];var utils=require(_0xa145('0x7'));var logger=require(_0xa145('0x8'))(_0xa145('0x9'));var config=require(_0xa145('0xa'));var jayson=require(_0xa145('0xb'));var client=jayson['client'][_0xa145('0xc')]({'port':0x232a});config[_0xa145('0xd')]=_[_0xa145('0xe')](config[_0xa145('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa145('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xa145('0x10')](socket);function respondWithRpcPromise(_0xdbcfeb,_0xf1c5b5,_0x1e0965){return new BPromise(function(_0x336a99,_0xd511e5){return client[_0xa145('0x11')](_0xdbcfeb,_0x1e0965)[_0xa145('0x12')](function(_0x2d4dce){logger[_0xa145('0x13')](_0xa145('0x14'),_0xf1c5b5,_0xa145('0x15'));logger[_0xa145('0x16')](_0xa145('0x17'),_0xf1c5b5,_0xa145('0x15'),JSON[_0xa145('0x18')](_0x2d4dce));if(_0x2d4dce['error']){if(_0x2d4dce['error'][_0xa145('0x19')]===0x1f4){logger[_0xa145('0x1a')](_0xa145('0x14'),_0xf1c5b5,_0x2d4dce['error'][_0xa145('0x1b')]);return _0xd511e5(_0x2d4dce[_0xa145('0x1a')][_0xa145('0x1b')]);}logger['error'](_0xa145('0x14'),_0xf1c5b5,_0x2d4dce['error'][_0xa145('0x1b')]);return _0x336a99(_0x2d4dce[_0xa145('0x1a')][_0xa145('0x1b')]);}else{logger[_0xa145('0x13')](_0xa145('0x14'),_0xf1c5b5,_0xa145('0x15'));_0x336a99(_0x2d4dce[_0xa145('0x1c')][_0xa145('0x1b')]);}})[_0xa145('0x1d')](function(_0x30f92b){logger[_0xa145('0x1a')](_0xa145('0x14'),_0xf1c5b5,_0x30f92b);_0xd511e5(_0x30f92b);});});}exports[_0xa145('0x1e')]=function(_0x385b18){var _0xd4b24=this;return new Promise(function(_0x4456a2,_0x355416){return db[_0xa145('0x1f')][_0xa145('0x20')]({'raw':_0x385b18[_0xa145('0x21')]?_0x385b18[_0xa145('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x385b18['options']?_0x385b18[_0xa145('0x21')][_0xa145('0x22')]||null:null,'attributes':_0x385b18['options']?_0x385b18[_0xa145('0x21')][_0xa145('0x23')]||null:null,'limit':_0x385b18[_0xa145('0x21')]?_0x385b18[_0xa145('0x21')][_0xa145('0x24')]||null:null,'include':_0x385b18['options']?_0x385b18[_0xa145('0x21')]['include']?_['map'](_0x385b18[_0xa145('0x21')][_0xa145('0x25')],function(_0x4c2320){return{'model':db[_0x4c2320[_0xa145('0x26')]],'as':_0x4c2320['as'],'attributes':_0x4c2320[_0xa145('0x23')],'include':_0x4c2320[_0xa145('0x25')]?_[_0xa145('0x27')](_0x4c2320[_0xa145('0x25')],function(_0x520266){return{'model':db[_0x520266[_0xa145('0x26')]],'as':_0x520266['as'],'attributes':_0x520266[_0xa145('0x23')],'include':_0x520266[_0xa145('0x25')]?_[_0xa145('0x27')](_0x520266['include'],function(_0x256c68){return{'model':db[_0x256c68['model']],'as':_0x256c68['as'],'attributes':_0x256c68[_0xa145('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x244026){logger[_0xa145('0x13')]('GetSmsQueue',_0x385b18);logger['debug'](_0xa145('0x1e'),_0x385b18,JSON[_0xa145('0x18')](_0x244026));_0x4456a2(_0x244026);})[_0xa145('0x1d')](function(_0x142c1f){logger['error'](_0xa145('0x1e'),_0x142c1f[_0xa145('0x1b')],_0x385b18);_0x355416(_0xd4b24['error'](0x1f4,_0x142c1f[_0xa145('0x1b')]));});});};exports[_0xa145('0x28')]=function(_0x1bb93d){var _0x298ad2=this;return new Promise(function(_0x292b94,_0x4872da){return db[_0xa145('0x1f')][_0xa145('0x29')]({'raw':_0x1bb93d[_0xa145('0x21')]?_0x1bb93d[_0xa145('0x21')][_0xa145('0x2a')]===undefined?!![]:![]:!![],'where':_0x1bb93d['options']?_0x1bb93d[_0xa145('0x21')][_0xa145('0x22')]||null:null,'attributes':_0x1bb93d[_0xa145('0x21')]?_0x1bb93d[_0xa145('0x21')][_0xa145('0x23')]||null:null,'include':_0x1bb93d[_0xa145('0x21')]?_0x1bb93d['options'][_0xa145('0x25')]?_['map'](_0x1bb93d['options'][_0xa145('0x25')],function(_0x26bb30){return{'model':db[_0x26bb30[_0xa145('0x26')]],'as':_0x26bb30['as'],'attributes':_0x26bb30[_0xa145('0x23')],'include':_0x26bb30[_0xa145('0x25')]?_[_0xa145('0x27')](_0x26bb30['include'],function(_0x6a9c63){return{'model':db[_0x6a9c63['model']],'as':_0x6a9c63['as'],'attributes':_0x6a9c63[_0xa145('0x23')],'include':_0x6a9c63[_0xa145('0x25')]?_['map'](_0x6a9c63['include'],function(_0x41a47e){return{'model':db[_0x41a47e[_0xa145('0x26')]],'as':_0x41a47e['as'],'attributes':_0x41a47e[_0xa145('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa145('0x12')](function(_0x440735){logger[_0xa145('0x13')](_0xa145('0x28'),_0x1bb93d);logger[_0xa145('0x16')]('ShowSmsQueue',_0x1bb93d,JSON[_0xa145('0x18')](_0x440735));_0x292b94(_0x440735);})[_0xa145('0x1d')](function(_0x16ab9c){logger[_0xa145('0x1a')]('ShowSmsQueue',_0x16ab9c[_0xa145('0x1b')],_0x1bb93d);_0x4872da(_0x298ad2['error'](0x1f4,_0x16ab9c[_0xa145('0x1b')]));});});}; \ No newline at end of file +var _0x637e=['register','request','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSmsQueue','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','SmsQueue','find','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x3b7cc9,_0x18cd9b){var _0x5751ea=function(_0x141c47){while(--_0x141c47){_0x3b7cc9['push'](_0x3b7cc9['shift']());}};_0x5751ea(++_0x18cd9b);}(_0x637e,0x158));var _0xe637=function(_0x2a7b47,_0x35e24d){_0x2a7b47=_0x2a7b47-0x0;var _0x30deb6=_0x637e[_0x2a7b47];return _0x30deb6;};'use strict';var _=require('lodash');var util=require(_0xe637('0x0'));var moment=require(_0xe637('0x1'));var BPromise=require(_0xe637('0x2'));var rs=require(_0xe637('0x3'));var fs=require('fs');var Redis=require(_0xe637('0x4'));var db=require(_0xe637('0x5'))['db'];var utils=require(_0xe637('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe637('0x7'));var jayson=require(_0xe637('0x8'));var client=jayson[_0xe637('0x9')][_0xe637('0xa')]({'port':0x232a});config[_0xe637('0xb')]=_[_0xe637('0xc')](config[_0xe637('0xb')],{'host':_0xe637('0xd'),'port':0x18eb});var socket=require(_0xe637('0xe'))(new Redis(config[_0xe637('0xb')]));require(_0xe637('0xf'))[_0xe637('0x10')](socket);function respondWithRpcPromise(_0x354731,_0x407f26,_0x1509ec){return new BPromise(function(_0x41840c,_0x5cb380){return client[_0xe637('0x11')](_0x354731,_0x1509ec)['then'](function(_0x16672b){logger['info'](_0xe637('0x12'),_0x407f26,'request\x20sent');logger[_0xe637('0x13')](_0xe637('0x14'),_0x407f26,_0xe637('0x15'),JSON[_0xe637('0x16')](_0x16672b));if(_0x16672b[_0xe637('0x17')]){if(_0x16672b[_0xe637('0x17')]['code']===0x1f4){logger[_0xe637('0x17')](_0xe637('0x12'),_0x407f26,_0x16672b[_0xe637('0x17')][_0xe637('0x18')]);return _0x5cb380(_0x16672b['error'][_0xe637('0x18')]);}logger['error'](_0xe637('0x12'),_0x407f26,_0x16672b[_0xe637('0x17')]['message']);return _0x41840c(_0x16672b[_0xe637('0x17')][_0xe637('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x407f26,_0xe637('0x15'));_0x41840c(_0x16672b[_0xe637('0x19')][_0xe637('0x18')]);}})[_0xe637('0x1a')](function(_0x5c03e4){logger[_0xe637('0x17')](_0xe637('0x12'),_0x407f26,_0x5c03e4);_0x5cb380(_0x5c03e4);});});}exports[_0xe637('0x1b')]=function(_0x4261cf){var _0x5792d2=this;return new Promise(function(_0x2922ce,_0x3dfce9){return db['SmsQueue']['findAll']({'raw':_0x4261cf[_0xe637('0x1c')]?_0x4261cf[_0xe637('0x1c')][_0xe637('0x1d')]===undefined?!![]:![]:!![],'where':_0x4261cf[_0xe637('0x1c')]?_0x4261cf[_0xe637('0x1c')][_0xe637('0x1e')]||null:null,'attributes':_0x4261cf[_0xe637('0x1c')]?_0x4261cf[_0xe637('0x1c')][_0xe637('0x1f')]||null:null,'limit':_0x4261cf[_0xe637('0x1c')]?_0x4261cf[_0xe637('0x1c')][_0xe637('0x20')]||null:null,'include':_0x4261cf['options']?_0x4261cf[_0xe637('0x1c')][_0xe637('0x21')]?_[_0xe637('0x22')](_0x4261cf[_0xe637('0x1c')][_0xe637('0x21')],function(_0x44f34a){return{'model':db[_0x44f34a[_0xe637('0x23')]],'as':_0x44f34a['as'],'attributes':_0x44f34a[_0xe637('0x1f')],'include':_0x44f34a['include']?_[_0xe637('0x22')](_0x44f34a[_0xe637('0x21')],function(_0x4a2cd9){return{'model':db[_0x4a2cd9[_0xe637('0x23')]],'as':_0x4a2cd9['as'],'attributes':_0x4a2cd9[_0xe637('0x1f')],'include':_0x4a2cd9[_0xe637('0x21')]?_['map'](_0x4a2cd9[_0xe637('0x21')],function(_0x20a630){return{'model':db[_0x20a630['model']],'as':_0x20a630['as'],'attributes':_0x20a630[_0xe637('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f3c10){logger['info']('GetSmsQueue',_0x4261cf);logger[_0xe637('0x13')]('GetSmsQueue',_0x4261cf,JSON[_0xe637('0x16')](_0x5f3c10));_0x2922ce(_0x5f3c10);})[_0xe637('0x1a')](function(_0x4da62d){logger[_0xe637('0x17')](_0xe637('0x1b'),_0x4da62d['message'],_0x4261cf);_0x3dfce9(_0x5792d2['error'](0x1f4,_0x4da62d[_0xe637('0x18')]));});});};exports[_0xe637('0x24')]=function(_0x2808f6){var _0x599414=this;return new Promise(function(_0x544436,_0x47182b){return db[_0xe637('0x25')][_0xe637('0x26')]({'raw':_0x2808f6[_0xe637('0x1c')]?_0x2808f6['options'][_0xe637('0x1d')]===undefined?!![]:![]:!![],'where':_0x2808f6[_0xe637('0x1c')]?_0x2808f6[_0xe637('0x1c')][_0xe637('0x1e')]||null:null,'attributes':_0x2808f6[_0xe637('0x1c')]?_0x2808f6[_0xe637('0x1c')][_0xe637('0x1f')]||null:null,'include':_0x2808f6[_0xe637('0x1c')]?_0x2808f6[_0xe637('0x1c')][_0xe637('0x21')]?_[_0xe637('0x22')](_0x2808f6[_0xe637('0x1c')][_0xe637('0x21')],function(_0x1f04c9){return{'model':db[_0x1f04c9[_0xe637('0x23')]],'as':_0x1f04c9['as'],'attributes':_0x1f04c9[_0xe637('0x1f')],'include':_0x1f04c9[_0xe637('0x21')]?_['map'](_0x1f04c9[_0xe637('0x21')],function(_0x14778f){return{'model':db[_0x14778f[_0xe637('0x23')]],'as':_0x14778f['as'],'attributes':_0x14778f[_0xe637('0x1f')],'include':_0x14778f[_0xe637('0x21')]?_[_0xe637('0x22')](_0x14778f['include'],function(_0x446027){return{'model':db[_0x446027[_0xe637('0x23')]],'as':_0x446027['as'],'attributes':_0x446027[_0xe637('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe637('0x27')](function(_0x3cd1a7){logger['info']('ShowSmsQueue',_0x2808f6);logger['debug'](_0xe637('0x24'),_0x2808f6,JSON['stringify'](_0x3cd1a7));_0x544436(_0x3cd1a7);})['catch'](function(_0x45f0b4){logger['error'](_0xe637('0x24'),_0x45f0b4[_0xe637('0x18')],_0x2808f6);_0x47182b(_0x599414['error'](0x1f4,_0x45f0b4[_0xe637('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f863eb2..529d416 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 _0x61a5=['length','smsQueue:','./smsQueue.events','update','emit','register'];(function(_0x4b05a1,_0x44883a){var _0x428fca=function(_0x35ee22){while(--_0x35ee22){_0x4b05a1['push'](_0x4b05a1['shift']());}};_0x428fca(++_0x44883a);}(_0x61a5,0x11c));var _0x561a=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x61a5[_0x533528];return _0x3189f1;};'use strict';var SmsQueueEvents=require(_0x561a('0x0'));var events=['save','remove',_0x561a('0x1')];function createListener(_0x3e441a,_0x2c23d8){return function(_0x50aefe){_0x2c23d8[_0x561a('0x2')](_0x3e441a,_0x50aefe);};}function removeListener(_0x242f0a,_0x395b16){return function(){SmsQueueEvents['removeListener'](_0x242f0a,_0x395b16);};}exports[_0x561a('0x3')]=function(_0x1fc985){for(var _0x52d26d=0x0,_0x1905ac=events[_0x561a('0x4')];_0x52d26d<_0x1905ac;_0x52d26d++){var _0x581943=events[_0x52d26d];var _0x2dc934=createListener(_0x561a('0x5')+_0x581943,_0x1fc985);SmsQueueEvents['on'](_0x581943,_0x2dc934);}}; \ No newline at end of file +var _0x2fc6=['remove','update','register','length','./smsQueue.events'];(function(_0x54d399,_0x591257){var _0x1f457a=function(_0x5d8552){while(--_0x5d8552){_0x54d399['push'](_0x54d399['shift']());}};_0x1f457a(++_0x591257);}(_0x2fc6,0x1e9));var _0x62fc=function(_0x12ae71,_0xe1ff0c){_0x12ae71=_0x12ae71-0x0;var _0x390af7=_0x2fc6[_0x12ae71];return _0x390af7;};'use strict';var SmsQueueEvents=require(_0x62fc('0x0'));var events=['save',_0x62fc('0x1'),_0x62fc('0x2')];function createListener(_0x1efdc1,_0x5e6734){return function(_0x5da72f){_0x5e6734['emit'](_0x1efdc1,_0x5da72f);};}function removeListener(_0x296287,_0x22d6ef){return function(){SmsQueueEvents['removeListener'](_0x296287,_0x22d6ef);};}exports[_0x62fc('0x3')]=function(_0xc7cabc){for(var _0x1f40d7=0x0,_0x2f4d21=events[_0x62fc('0x4')];_0x1f40d7<_0x2f4d21;_0x1f40d7++){var _0x3c4bea=events[_0x1f40d7];var _0x1325a1=createListener('smsQueue:'+_0x3c4bea,_0xc7cabc);SmsQueueEvents['on'](_0x3c4bea,_0x1325a1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c26cca1..fa59747 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 _0x6bac=['describe','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x5e128f,_0x181a08){var _0x1f30db=function(_0x36edc9){while(--_0x36edc9){_0x5e128f['push'](_0x5e128f['shift']());}};_0x1f30db(++_0x181a08);}(_0x6bac,0xa5));var _0xc6ba=function(_0x49eabe,_0x33a106){_0x49eabe=_0x49eabe-0x0;var _0x21af91=_0x6bac[_0x49eabe];return _0x21af91;};'use strict';var multer=require(_0xc6ba('0x0'));var util=require('util');var path=require(_0xc6ba('0x1'));var timeout=require(_0xc6ba('0x2'));var express=require(_0xc6ba('0x3'));var router=express[_0xc6ba('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc6ba('0x5'));var controller=require(_0xc6ba('0x6'));router['get']('/',auth[_0xc6ba('0x7')](),controller[_0xc6ba('0x8')]);router[_0xc6ba('0x9')](_0xc6ba('0xa'),auth[_0xc6ba('0x7')](),controller[_0xc6ba('0xb')]);router['get']('/:id',auth[_0xc6ba('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc6ba('0xc'),auth[_0xc6ba('0x7')](),controller[_0xc6ba('0xd')]);router[_0xc6ba('0xe')](_0xc6ba('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc6ba('0xf')]=router; \ No newline at end of file +var _0xb55e=['get','/describe','isAuthenticated','describe','/:id','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','index'];(function(_0x3c3662,_0x39d5c7){var _0x32ef30=function(_0x478486){while(--_0x478486){_0x3c3662['push'](_0x3c3662['shift']());}};_0x32ef30(++_0x39d5c7);}(_0xb55e,0x106));var _0xeb55=function(_0x2ea7a0,_0x115292){_0x2ea7a0=_0x2ea7a0-0x0;var _0x2ee0b7=_0xb55e[_0x2ea7a0];return _0x2ee0b7;};'use strict';var multer=require(_0xeb55('0x0'));var util=require(_0xeb55('0x1'));var path=require(_0xeb55('0x2'));var timeout=require(_0xeb55('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xeb55('0x4'));var auth=require(_0xeb55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeb55('0x6'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xeb55('0x7')]);router[_0xeb55('0x8')](_0xeb55('0x9'),auth[_0xeb55('0xa')](),controller[_0xeb55('0xb')]);router[_0xeb55('0x8')](_0xeb55('0xc'),auth[_0xeb55('0xa')](),controller['show']);router['post']('/',auth[_0xeb55('0xa')](),controller[_0xeb55('0xd')]);router['put'](_0xeb55('0xc'),auth['isAuthenticated'](),controller[_0xeb55('0xe')]);router[_0xeb55('0xf')]('/:id',auth[_0xeb55('0xa')](),controller[_0xeb55('0x10')]);module[_0xeb55('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1a63a19..1ce3465 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 _0xbb0e=['sequelize','exports','STRING','DATE','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbb0e,0x153));var _0xebb0=function(_0xcb266e,_0x4db71c){_0xcb266e=_0xcb266e-0x0;var _0x18b404=_0xbb0e[_0xcb266e];return _0x18b404;};'use strict';var moment=require(_0xebb0('0x0'));var Sequelize=require(_0xebb0('0x1'));module[_0xebb0('0x2')]={'uniqueid':{'type':Sequelize[_0xebb0('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xebb0('0x4')]},'acceptAt':{'type':Sequelize[_0xebb0('0x4')]},'exitAt':{'type':Sequelize[_0xebb0('0x4')]},'reason':{'type':Sequelize[_0xebb0('0x3')]}}; \ No newline at end of file +var _0x6a0c=['DATE','moment','exports','STRING'];(function(_0x57c8d8,_0x1fcd97){var _0x2c183e=function(_0x295f90){while(--_0x295f90){_0x57c8d8['push'](_0x57c8d8['shift']());}};_0x2c183e(++_0x1fcd97);}(_0x6a0c,0xb5));var _0xc6a0=function(_0x36a413,_0xbf6620){_0x36a413=_0x36a413-0x0;var _0x1374dc=_0x6a0c[_0x36a413];return _0x1374dc;};'use strict';var moment=require(_0xc6a0('0x0'));var Sequelize=require('sequelize');module[_0xc6a0('0x1')]={'uniqueid':{'type':Sequelize[_0xc6a0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc6a0('0x2')]},'joinAt':{'type':Sequelize[_0xc6a0('0x3')]},'leaveAt':{'type':Sequelize[_0xc6a0('0x3')]},'acceptAt':{'type':Sequelize[_0xc6a0('0x3')]},'exitAt':{'type':Sequelize[_0xc6a0('0x3')]},'reason':{'type':Sequelize[_0xc6a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4ba8066..deb0588 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 _0x07af=['map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x103b4e,_0x3fed42){var _0x55ae04=function(_0x2895f9){while(--_0x2895f9){_0x103b4e['push'](_0x103b4e['shift']());}};_0x55ae04(++_0x3fed42);}(_0x07af,0xff));var _0xf07a=function(_0x36a32a,_0x17caf9){_0x36a32a=_0x36a32a-0x0;var _0x20dea9=_0x07af[_0x36a32a];return _0x20dea9;};'use strict';var emlformat=require(_0xf07a('0x0'));var rimraf=require(_0xf07a('0x1'));var zipdir=require(_0xf07a('0x2'));var jsonpatch=require(_0xf07a('0x3'));var rp=require(_0xf07a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf07a('0x5'));var path=require('path');var sox=require(_0xf07a('0x6'));var csv=require('to-csv');var ejs=require(_0xf07a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf07a('0x8'));var squel=require(_0xf07a('0x9'));var crypto=require(_0xf07a('0xa'));var jsforce=require(_0xf07a('0xb'));var deskjs=require(_0xf07a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf07a('0xd'));var Redis=require(_0xf07a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf07a('0xf'));var as=require(_0xf07a('0x10'));var hardwareService=require(_0xf07a('0x11'));var logger=require(_0xf07a('0x12'))(_0xf07a('0x13'));var utils=require(_0xf07a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf07a('0x15'));var db=require(_0xf07a('0x16'))['db'];function respondWithStatusCode(_0x14bcd4,_0x690a67){_0x690a67=_0x690a67||0xcc;return function(_0x417701){if(_0x417701){return _0x14bcd4['sendStatus'](_0x690a67);}return _0x14bcd4['status'](_0x690a67)[_0xf07a('0x17')]();};}function respondWithResult(_0x49d1d2,_0x29118b){_0x29118b=_0x29118b||0xc8;return function(_0xb632d6){if(_0xb632d6){return _0x49d1d2[_0xf07a('0x18')](_0x29118b)['json'](_0xb632d6);}};}function respondWithFilteredResult(_0x4bc1a7,_0x124ee2){return function(_0x1962fe){if(_0x1962fe){var _0x18c7a5=typeof _0x124ee2[_0xf07a('0x19')]===_0xf07a('0x1a')&&typeof _0x124ee2[_0xf07a('0x1b')]===_0xf07a('0x1a');var _0x1edfd3=_0x1962fe['count'];var _0x14db18=_0x18c7a5?0x0:_0x124ee2[_0xf07a('0x19')];var _0x53cbe6=_0x18c7a5?_0x1962fe[_0xf07a('0x1c')]:_0x124ee2[_0xf07a('0x19')]+_0x124ee2['limit'];var _0x1a6b5a;if(_0x53cbe6>=_0x1edfd3){_0x53cbe6=_0x1edfd3;_0x1a6b5a=0xc8;}else{_0x1a6b5a=0xce;}_0x4bc1a7[_0xf07a('0x18')](_0x1a6b5a);return _0x4bc1a7[_0xf07a('0x1d')](_0xf07a('0x1e'),_0x14db18+'-'+_0x53cbe6+'/'+_0x1edfd3)[_0xf07a('0x1f')](_0x1962fe);}return null;};}function patchUpdates(_0x717b0d){return function(_0xbb069e){try{jsonpatch[_0xf07a('0x20')](_0xbb069e,_0x717b0d,!![]);}catch(_0xe56a8f){return BPromise[_0xf07a('0x21')](_0xe56a8f);}return _0xbb069e[_0xf07a('0x22')]();};}function saveUpdates(_0x2d051f,_0xa8e0d){return function(_0x4ba634){if(_0x4ba634){return _0x4ba634[_0xf07a('0x23')](_0x2d051f)[_0xf07a('0x24')](function(_0x397348){return _0x397348;});}return null;};}function removeEntity(_0x5074ff,_0x4e9b2d){return function(_0x1bc314){if(_0x1bc314){return _0x1bc314['destroy']()[_0xf07a('0x24')](function(){_0x5074ff['status'](0xcc)[_0xf07a('0x17')]();});}};}function handleEntityNotFound(_0x1ab237,_0x42ada5){return function(_0x49adb5){if(!_0x49adb5){_0x1ab237[_0xf07a('0x25')](0x194);}return _0x49adb5;};}function handleError(_0x5c419d,_0x2e650b){_0x2e650b=_0x2e650b||0x1f4;return function(_0x5e79be){logger[_0xf07a('0x26')](_0x5e79be[_0xf07a('0x27')]);if(_0x5e79be[_0xf07a('0x28')]){delete _0x5e79be[_0xf07a('0x28')];}_0x5c419d['status'](_0x2e650b)[_0xf07a('0x29')](_0x5e79be);};}exports[_0xf07a('0x2a')]=function(_0x464acb,_0x3ae84d){var _0x1e7c7c={},_0x11d1ee={},_0x44e976={'count':0x0,'rows':[]};var _0x68410d=_['map'](db[_0xf07a('0x2b')][_0xf07a('0x2c')],function(_0x132b97){return{'name':_0x132b97[_0xf07a('0x2d')],'type':_0x132b97[_0xf07a('0x2e')][_0xf07a('0x2f')]};});_0x11d1ee[_0xf07a('0x30')]=_[_0xf07a('0x31')](_0x68410d,_0xf07a('0x28'));_0x11d1ee[_0xf07a('0x32')]=_[_0xf07a('0x33')](_0x464acb['query']);_0x11d1ee[_0xf07a('0x34')]=_['intersection'](_0x11d1ee[_0xf07a('0x30')],_0x11d1ee['query']);_0x1e7c7c[_0xf07a('0x35')]=_['intersection'](_0x11d1ee[_0xf07a('0x30')],qs[_0xf07a('0x36')](_0x464acb[_0xf07a('0x32')][_0xf07a('0x36')]));_0x1e7c7c['attributes']=_0x1e7c7c[_0xf07a('0x35')][_0xf07a('0x37')]?_0x1e7c7c[_0xf07a('0x35')]:_0x11d1ee['model'];if(!_0x464acb['query'][_0xf07a('0x38')](_0xf07a('0x39'))){_0x1e7c7c[_0xf07a('0x1b')]=qs['limit'](_0x464acb['query'][_0xf07a('0x1b')]);_0x1e7c7c['offset']=qs[_0xf07a('0x19')](_0x464acb['query'][_0xf07a('0x19')]);}_0x1e7c7c[_0xf07a('0x3a')]=qs['sort'](_0x464acb['query'][_0xf07a('0x3b')]);_0x1e7c7c[_0xf07a('0x3c')]=qs[_0xf07a('0x34')](_['pick'](_0x464acb[_0xf07a('0x32')],_0x11d1ee['filters']),_0x68410d);if(_0x464acb[_0xf07a('0x32')]['filter']){_0x1e7c7c['where']=_[_0xf07a('0x3d')](_0x1e7c7c[_0xf07a('0x3c')],{'$or':_[_0xf07a('0x31')](_0x68410d,function(_0x5933db){if(_0x5933db[_0xf07a('0x2e')]!==_0xf07a('0x3e')){var _0x5c7605={};_0x5c7605[_0x5933db[_0xf07a('0x28')]]={'$like':'%'+_0x464acb[_0xf07a('0x32')][_0xf07a('0x3f')]+'%'};return _0x5c7605;}})});}_0x1e7c7c=_[_0xf07a('0x3d')]({},_0x1e7c7c,_0x464acb[_0xf07a('0x40')]);var _0x1c33dc={'where':_0x1e7c7c[_0xf07a('0x3c')]};return db['SmsQueueReport'][_0xf07a('0x1c')](_0x1c33dc)['then'](function(_0x48c958){_0x44e976['count']=_0x48c958;if(_0x464acb['query']['includeAll']){_0x1e7c7c['include']=[{'all':!![]}];}return db[_0xf07a('0x2b')][_0xf07a('0x41')](_0x1e7c7c);})['then'](function(_0x5e4421){_0x44e976[_0xf07a('0x42')]=_0x5e4421;return _0x44e976;})[_0xf07a('0x24')](respondWithFilteredResult(_0x3ae84d,_0x1e7c7c))[_0xf07a('0x43')](handleError(_0x3ae84d,null));};exports[_0xf07a('0x44')]=function(_0x58a762,_0x149d25){var _0x4f8c1f={'raw':!![],'where':{'id':_0x58a762[_0xf07a('0x45')]['id']}},_0x2269c5={};_0x2269c5['model']=_[_0xf07a('0x33')](db['SmsQueueReport'][_0xf07a('0x2c')]);_0x2269c5[_0xf07a('0x32')]=_['keys'](_0x58a762[_0xf07a('0x32')]);_0x2269c5[_0xf07a('0x34')]=_['intersection'](_0x2269c5[_0xf07a('0x30')],_0x2269c5['query']);_0x4f8c1f[_0xf07a('0x35')]=_['intersection'](_0x2269c5['model'],qs[_0xf07a('0x36')](_0x58a762[_0xf07a('0x32')]['fields']));_0x4f8c1f[_0xf07a('0x35')]=_0x4f8c1f[_0xf07a('0x35')][_0xf07a('0x37')]?_0x4f8c1f[_0xf07a('0x35')]:_0x2269c5[_0xf07a('0x30')];if(_0x58a762['query'][_0xf07a('0x46')]){_0x4f8c1f['include']=[{'all':!![]}];}_0x4f8c1f=_[_0xf07a('0x3d')]({},_0x4f8c1f,_0x58a762[_0xf07a('0x40')]);return db[_0xf07a('0x2b')][_0xf07a('0x47')](_0x4f8c1f)[_0xf07a('0x24')](handleEntityNotFound(_0x149d25,null))[_0xf07a('0x24')](respondWithResult(_0x149d25,null))['catch'](handleError(_0x149d25,null));};exports[_0xf07a('0x48')]=function(_0x3e0cf8,_0x4ee814){return db[_0xf07a('0x2b')][_0xf07a('0x48')](_0x3e0cf8[_0xf07a('0x49')],{})[_0xf07a('0x24')](respondWithResult(_0x4ee814,0xc9))[_0xf07a('0x43')](handleError(_0x4ee814,null));};exports['update']=function(_0x968d35,_0x14ed84){if(_0x968d35[_0xf07a('0x49')]['id']){delete _0x968d35['body']['id'];}return db[_0xf07a('0x2b')][_0xf07a('0x47')]({'where':{'id':_0x968d35[_0xf07a('0x45')]['id']}})[_0xf07a('0x24')](handleEntityNotFound(_0x14ed84,null))[_0xf07a('0x24')](saveUpdates(_0x968d35[_0xf07a('0x49')],null))['then'](respondWithResult(_0x14ed84,null))['catch'](handleError(_0x14ed84,null));};exports[_0xf07a('0x4a')]=function(_0x1a1fad,_0x465a3d){return db[_0xf07a('0x2b')]['find']({'where':{'id':_0x1a1fad[_0xf07a('0x45')]['id']}})[_0xf07a('0x24')](handleEntityNotFound(_0x465a3d,null))[_0xf07a('0x24')](removeEntity(_0x465a3d,null))['catch'](handleError(_0x465a3d,null));};exports[_0xf07a('0x4b')]=function(_0x4f9eaf,_0x274f6c){return db[_0xf07a('0x2b')][_0xf07a('0x4b')]()[_0xf07a('0x24')](respondWithResult(_0x274f6c,null))[_0xf07a('0x43')](handleError(_0x274f6c,null));}; \ No newline at end of file +var _0x2110=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','index','map','SmsQueueReport','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','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'];(function(_0x6a734c,_0x1b2d9f){var _0x494d0d=function(_0x36fd39){while(--_0x36fd39){_0x6a734c['push'](_0x6a734c['shift']());}};_0x494d0d(++_0x1b2d9f);}(_0x2110,0x7c));var _0x0211=function(_0x3c0d7f,_0x1d2627){_0x3c0d7f=_0x3c0d7f-0x0;var _0x3c14aa=_0x2110[_0x3c0d7f];return _0x3c14aa;};'use strict';var emlformat=require(_0x0211('0x0'));var rimraf=require(_0x0211('0x1'));var zipdir=require(_0x0211('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0211('0x3'));var moment=require('moment');var BPromise=require(_0x0211('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0211('0x5'));var sox=require(_0x0211('0x6'));var csv=require(_0x0211('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0211('0x8'));var _=require(_0x0211('0x9'));var squel=require('squel');var crypto=require(_0x0211('0xa'));var jsforce=require(_0x0211('0xb'));var deskjs=require(_0x0211('0xc'));var toCsv=require(_0x0211('0x7'));var querystring=require('querystring');var Papa=require(_0x0211('0xd'));var Redis=require(_0x0211('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0211('0xf'));var as=require(_0x0211('0x10'));var hardwareService=require(_0x0211('0x11'));var logger=require('../../config/logger')(_0x0211('0x12'));var utils=require(_0x0211('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0211('0x14'));var db=require(_0x0211('0x15'))['db'];function respondWithStatusCode(_0x255292,_0x46345d){_0x46345d=_0x46345d||0xcc;return function(_0x3bf162){if(_0x3bf162){return _0x255292[_0x0211('0x16')](_0x46345d);}return _0x255292[_0x0211('0x17')](_0x46345d)[_0x0211('0x18')]();};}function respondWithResult(_0xb8a1d0,_0x83c750){_0x83c750=_0x83c750||0xc8;return function(_0x43a4ae){if(_0x43a4ae){return _0xb8a1d0[_0x0211('0x17')](_0x83c750)[_0x0211('0x19')](_0x43a4ae);}};}function respondWithFilteredResult(_0x4d25bd,_0x4d898c){return function(_0x4f6012){if(_0x4f6012){var _0xffe3a1=typeof _0x4d898c[_0x0211('0x1a')]===_0x0211('0x1b')&&typeof _0x4d898c[_0x0211('0x1c')]===_0x0211('0x1b');var _0x35520f=_0x4f6012[_0x0211('0x1d')];var _0x252072=_0xffe3a1?0x0:_0x4d898c[_0x0211('0x1a')];var _0x16250b=_0xffe3a1?_0x4f6012[_0x0211('0x1d')]:_0x4d898c[_0x0211('0x1a')]+_0x4d898c['limit'];var _0x352a67;if(_0x16250b>=_0x35520f){_0x16250b=_0x35520f;_0x352a67=0xc8;}else{_0x352a67=0xce;}_0x4d25bd[_0x0211('0x17')](_0x352a67);return _0x4d25bd[_0x0211('0x1e')](_0x0211('0x1f'),_0x252072+'-'+_0x16250b+'/'+_0x35520f)[_0x0211('0x19')](_0x4f6012);}return null;};}function patchUpdates(_0x1f8887){return function(_0x3c6407){try{jsonpatch[_0x0211('0x20')](_0x3c6407,_0x1f8887,!![]);}catch(_0x2bb51a){return BPromise[_0x0211('0x21')](_0x2bb51a);}return _0x3c6407[_0x0211('0x22')]();};}function saveUpdates(_0x312ea6,_0xecfa0b){return function(_0x2c0992){if(_0x2c0992){return _0x2c0992['update'](_0x312ea6)[_0x0211('0x23')](function(_0x1669cd){return _0x1669cd;});}return null;};}function removeEntity(_0x2fab8b,_0x29776f){return function(_0x452235){if(_0x452235){return _0x452235[_0x0211('0x24')]()[_0x0211('0x23')](function(){_0x2fab8b[_0x0211('0x17')](0xcc)[_0x0211('0x18')]();});}};}function handleEntityNotFound(_0x355c36,_0xdf399e){return function(_0x2e4573){if(!_0x2e4573){_0x355c36['sendStatus'](0x194);}return _0x2e4573;};}function handleError(_0xadd6c4,_0x3ef010){_0x3ef010=_0x3ef010||0x1f4;return function(_0x21b085){logger[_0x0211('0x25')](_0x21b085['stack']);if(_0x21b085['name']){delete _0x21b085['name'];}_0xadd6c4[_0x0211('0x17')](_0x3ef010)['send'](_0x21b085);};}exports[_0x0211('0x26')]=function(_0x3eb5fb,_0x599b44){var _0x35ed6f={},_0x113391={},_0x3cb724={'count':0x0,'rows':[]};var _0x56a709=_[_0x0211('0x27')](db[_0x0211('0x28')]['rawAttributes'],function(_0x5dc3de){return{'name':_0x5dc3de[_0x0211('0x29')],'type':_0x5dc3de[_0x0211('0x2a')]['key']};});_0x113391['model']=_[_0x0211('0x27')](_0x56a709,'name');_0x113391[_0x0211('0x2b')]=_['keys'](_0x3eb5fb[_0x0211('0x2b')]);_0x113391[_0x0211('0x2c')]=_[_0x0211('0x2d')](_0x113391[_0x0211('0x2e')],_0x113391[_0x0211('0x2b')]);_0x35ed6f['attributes']=_[_0x0211('0x2d')](_0x113391['model'],qs[_0x0211('0x2f')](_0x3eb5fb[_0x0211('0x2b')][_0x0211('0x2f')]));_0x35ed6f[_0x0211('0x30')]=_0x35ed6f[_0x0211('0x30')][_0x0211('0x31')]?_0x35ed6f[_0x0211('0x30')]:_0x113391[_0x0211('0x2e')];if(!_0x3eb5fb['query'][_0x0211('0x32')](_0x0211('0x33'))){_0x35ed6f[_0x0211('0x1c')]=qs[_0x0211('0x1c')](_0x3eb5fb[_0x0211('0x2b')][_0x0211('0x1c')]);_0x35ed6f[_0x0211('0x1a')]=qs[_0x0211('0x1a')](_0x3eb5fb['query']['offset']);}_0x35ed6f[_0x0211('0x34')]=qs[_0x0211('0x35')](_0x3eb5fb[_0x0211('0x2b')][_0x0211('0x35')]);_0x35ed6f[_0x0211('0x36')]=qs[_0x0211('0x2c')](_['pick'](_0x3eb5fb[_0x0211('0x2b')],_0x113391[_0x0211('0x2c')]),_0x56a709);if(_0x3eb5fb[_0x0211('0x2b')][_0x0211('0x37')]){_0x35ed6f['where']=_[_0x0211('0x38')](_0x35ed6f[_0x0211('0x36')],{'$or':_[_0x0211('0x27')](_0x56a709,function(_0x162558){if(_0x162558[_0x0211('0x2a')]!==_0x0211('0x39')){var _0x46fd09={};_0x46fd09[_0x162558[_0x0211('0x3a')]]={'$like':'%'+_0x3eb5fb['query'][_0x0211('0x37')]+'%'};return _0x46fd09;}})});}_0x35ed6f=_[_0x0211('0x38')]({},_0x35ed6f,_0x3eb5fb[_0x0211('0x3b')]);var _0x47d3e7={'where':_0x35ed6f[_0x0211('0x36')]};return db[_0x0211('0x28')]['count'](_0x47d3e7)[_0x0211('0x23')](function(_0x5db46c){_0x3cb724[_0x0211('0x1d')]=_0x5db46c;if(_0x3eb5fb[_0x0211('0x2b')][_0x0211('0x3c')]){_0x35ed6f[_0x0211('0x3d')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x0211('0x3e')](_0x35ed6f);})[_0x0211('0x23')](function(_0x23bf2d){_0x3cb724[_0x0211('0x3f')]=_0x23bf2d;return _0x3cb724;})[_0x0211('0x23')](respondWithFilteredResult(_0x599b44,_0x35ed6f))[_0x0211('0x40')](handleError(_0x599b44,null));};exports[_0x0211('0x41')]=function(_0x3c2aee,_0x310d35){var _0x59d8e4={'raw':!![],'where':{'id':_0x3c2aee['params']['id']}},_0xd0334f={};_0xd0334f[_0x0211('0x2e')]=_['keys'](db[_0x0211('0x28')][_0x0211('0x42')]);_0xd0334f[_0x0211('0x2b')]=_[_0x0211('0x43')](_0x3c2aee[_0x0211('0x2b')]);_0xd0334f[_0x0211('0x2c')]=_['intersection'](_0xd0334f[_0x0211('0x2e')],_0xd0334f['query']);_0x59d8e4['attributes']=_['intersection'](_0xd0334f['model'],qs['fields'](_0x3c2aee[_0x0211('0x2b')][_0x0211('0x2f')]));_0x59d8e4[_0x0211('0x30')]=_0x59d8e4[_0x0211('0x30')][_0x0211('0x31')]?_0x59d8e4['attributes']:_0xd0334f[_0x0211('0x2e')];if(_0x3c2aee[_0x0211('0x2b')][_0x0211('0x3c')]){_0x59d8e4[_0x0211('0x3d')]=[{'all':!![]}];}_0x59d8e4=_[_0x0211('0x38')]({},_0x59d8e4,_0x3c2aee[_0x0211('0x3b')]);return db[_0x0211('0x28')][_0x0211('0x44')](_0x59d8e4)[_0x0211('0x23')](handleEntityNotFound(_0x310d35,null))['then'](respondWithResult(_0x310d35,null))[_0x0211('0x40')](handleError(_0x310d35,null));};exports[_0x0211('0x45')]=function(_0x26fa83,_0x13d01b){return db[_0x0211('0x28')][_0x0211('0x45')](_0x26fa83[_0x0211('0x46')],{})[_0x0211('0x23')](respondWithResult(_0x13d01b,0xc9))[_0x0211('0x40')](handleError(_0x13d01b,null));};exports['update']=function(_0x4e9231,_0x4f25eb){if(_0x4e9231[_0x0211('0x46')]['id']){delete _0x4e9231[_0x0211('0x46')]['id'];}return db[_0x0211('0x28')]['find']({'where':{'id':_0x4e9231[_0x0211('0x47')]['id']}})[_0x0211('0x23')](handleEntityNotFound(_0x4f25eb,null))[_0x0211('0x23')](saveUpdates(_0x4e9231[_0x0211('0x46')],null))['then'](respondWithResult(_0x4f25eb,null))[_0x0211('0x40')](handleError(_0x4f25eb,null));};exports[_0x0211('0x24')]=function(_0x1d7689,_0x2ed4e9){return db['SmsQueueReport']['find']({'where':{'id':_0x1d7689['params']['id']}})['then'](handleEntityNotFound(_0x2ed4e9,null))[_0x0211('0x23')](removeEntity(_0x2ed4e9,null))['catch'](handleError(_0x2ed4e9,null));};exports['describe']=function(_0x566c20,_0x5c859c){return db[_0x0211('0x28')][_0x0211('0x48')]()[_0x0211('0x23')](respondWithResult(_0x5c859c,null))['catch'](handleError(_0x5c859c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 79a6ae5..eb6b820 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x5a050b,_0x123e77){var _0x3abf18=function(_0xbd2872){while(--_0xbd2872){_0x5a050b['push'](_0x5a050b['shift']());}};_0x3abf18(++_0x123e77);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 18caeae..07da271 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 _0xd2a2=['../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','body','options','CreateSmsQueueReport','SmsQueueReport','where','attributes','UpdateSmsQueueReport','lodash','util','moment','bluebird'];(function(_0x4e5e31,_0x22558e){var _0x3f0cfc=function(_0x46c091){while(--_0x46c091){_0x4e5e31['push'](_0x4e5e31['shift']());}};_0x3f0cfc(++_0x22558e);}(_0xd2a2,0x15b));var _0x2d2a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd2a2[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2d2a('0x0'));var util=require(_0x2d2a('0x1'));var moment=require(_0x2d2a('0x2'));var BPromise=require(_0x2d2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d2a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2d2a('0x5'));var jayson=require(_0x2d2a('0x6'));var client=jayson[_0x2d2a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd0234f,_0x3b49f4,_0x921cfb){return new BPromise(function(_0x377310,_0x4dffc3){return client[_0x2d2a('0x8')](_0xd0234f,_0x921cfb)[_0x2d2a('0x9')](function(_0x27d89e){logger[_0x2d2a('0xa')](_0x2d2a('0xb'),_0x3b49f4,_0x2d2a('0xc'));logger[_0x2d2a('0xd')](_0x2d2a('0xe'),_0x3b49f4,_0x2d2a('0xc'),JSON[_0x2d2a('0xf')](_0x27d89e));if(_0x27d89e[_0x2d2a('0x10')]){if(_0x27d89e[_0x2d2a('0x10')][_0x2d2a('0x11')]===0x1f4){logger[_0x2d2a('0x10')](_0x2d2a('0xb'),_0x3b49f4,_0x27d89e['error'][_0x2d2a('0x12')]);return _0x4dffc3(_0x27d89e['error'][_0x2d2a('0x12')]);}logger[_0x2d2a('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x3b49f4,_0x27d89e[_0x2d2a('0x10')][_0x2d2a('0x12')]);return _0x377310(_0x27d89e[_0x2d2a('0x10')][_0x2d2a('0x12')]);}else{logger[_0x2d2a('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x3b49f4,_0x2d2a('0xc'));_0x377310(_0x27d89e['result'][_0x2d2a('0x12')]);}})[_0x2d2a('0x13')](function(_0x103ea2){logger[_0x2d2a('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x3b49f4,_0x103ea2);_0x4dffc3(_0x103ea2);});});}exports['CreateSmsQueueReport']=function(_0x5207f9){var _0x312d3c=this;return new Promise(function(_0x35e62e,_0x34c974){return db['SmsQueueReport']['create'](_0x5207f9[_0x2d2a('0x14')],{'raw':_0x5207f9[_0x2d2a('0x15')]?_0x5207f9[_0x2d2a('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x2d2a('0x9')](function(_0x260de8){logger['info'](_0x2d2a('0x16'),_0x5207f9);logger[_0x2d2a('0xd')](_0x2d2a('0x16'),_0x5207f9,JSON['stringify'](_0x260de8));_0x35e62e(_0x260de8);})[_0x2d2a('0x13')](function(_0x39432e){logger['error'](_0x2d2a('0x16'),_0x39432e[_0x2d2a('0x12')],_0x5207f9);_0x34c974(_0x312d3c[_0x2d2a('0x10')](0x1f4,_0x39432e['message']));});});};exports['UpdateSmsQueueReport']=function(_0x2908c2){var _0x1cc577=this;return new Promise(function(_0x5a33e2,_0x1f3030){return db[_0x2d2a('0x17')]['update'](_0x2908c2[_0x2d2a('0x14')],{'raw':_0x2908c2['options']?_0x2908c2[_0x2d2a('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2908c2[_0x2d2a('0x15')]?_0x2908c2[_0x2d2a('0x15')][_0x2d2a('0x18')]||null:null,'attributes':_0x2908c2[_0x2d2a('0x15')]?_0x2908c2[_0x2d2a('0x15')][_0x2d2a('0x19')]||null:null,'limit':_0x2908c2[_0x2d2a('0x15')]?_0x2908c2[_0x2d2a('0x15')]['limit']||null:null})[_0x2d2a('0x9')](function(_0x1127ec){logger[_0x2d2a('0xa')](_0x2d2a('0x1a'),_0x2908c2);logger[_0x2d2a('0xd')]('UpdateSmsQueueReport',_0x2908c2,JSON[_0x2d2a('0xf')](_0x1127ec));_0x5a33e2(_0x1127ec);})[_0x2d2a('0x13')](function(_0x1f16bd){logger[_0x2d2a('0x10')](_0x2d2a('0x1a'),_0x1f16bd[_0x2d2a('0x12')],_0x2908c2);_0x1f3030(_0x1cc577[_0x2d2a('0x10')](0x1f4,_0x1f16bd[_0x2d2a('0x12')]));});});}; \ No newline at end of file +var _0xfbf0=['SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','update','where','attributes','limit','UpdateSmsQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x5102db,_0x2a4f9f){var _0x3dd902=function(_0x43b207){while(--_0x43b207){_0x5102db['push'](_0x5102db['shift']());}};_0x3dd902(++_0x2a4f9f);}(_0xfbf0,0x7f));var _0x0fbf=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xfbf0[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x0fbf('0x0'));var util=require('util');var moment=require(_0x0fbf('0x1'));var BPromise=require('bluebird');var rs=require(_0x0fbf('0x2'));var fs=require('fs');var Redis=require(_0x0fbf('0x3'));var db=require(_0x0fbf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0fbf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0fbf('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283ca5,_0x434aad,_0x27921f){return new BPromise(function(_0x5067b3,_0x2bcaf9){return client[_0x0fbf('0x7')](_0x283ca5,_0x27921f)[_0x0fbf('0x8')](function(_0x58bab8){logger[_0x0fbf('0x9')](_0x0fbf('0xa'),_0x434aad,_0x0fbf('0xb'));logger[_0x0fbf('0xc')](_0x0fbf('0xd'),_0x434aad,'request\x20sent',JSON[_0x0fbf('0xe')](_0x58bab8));if(_0x58bab8[_0x0fbf('0xf')]){if(_0x58bab8[_0x0fbf('0xf')]['code']===0x1f4){logger[_0x0fbf('0xf')](_0x0fbf('0xa'),_0x434aad,_0x58bab8[_0x0fbf('0xf')][_0x0fbf('0x10')]);return _0x2bcaf9(_0x58bab8[_0x0fbf('0xf')][_0x0fbf('0x10')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x434aad,_0x58bab8['error'][_0x0fbf('0x10')]);return _0x5067b3(_0x58bab8[_0x0fbf('0xf')][_0x0fbf('0x10')]);}else{logger[_0x0fbf('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x434aad,_0x0fbf('0xb'));_0x5067b3(_0x58bab8['result'][_0x0fbf('0x10')]);}})[_0x0fbf('0x11')](function(_0x1928a2){logger[_0x0fbf('0xf')](_0x0fbf('0xa'),_0x434aad,_0x1928a2);_0x2bcaf9(_0x1928a2);});});}exports['CreateSmsQueueReport']=function(_0x235155){var _0x574c8d=this;return new Promise(function(_0x4b037a,_0x4f5710){return db[_0x0fbf('0x12')][_0x0fbf('0x13')](_0x235155[_0x0fbf('0x14')],{'raw':_0x235155[_0x0fbf('0x15')]?_0x235155['options'][_0x0fbf('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x556e34){logger[_0x0fbf('0x9')](_0x0fbf('0x17'),_0x235155);logger[_0x0fbf('0xc')](_0x0fbf('0x17'),_0x235155,JSON[_0x0fbf('0xe')](_0x556e34));_0x4b037a(_0x556e34);})[_0x0fbf('0x11')](function(_0x2f7077){logger['error'](_0x0fbf('0x17'),_0x2f7077[_0x0fbf('0x10')],_0x235155);_0x4f5710(_0x574c8d[_0x0fbf('0xf')](0x1f4,_0x2f7077[_0x0fbf('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x3b8103){var _0x5db399=this;return new Promise(function(_0x3189b8,_0x5b916c){return db['SmsQueueReport'][_0x0fbf('0x18')](_0x3b8103[_0x0fbf('0x14')],{'raw':_0x3b8103[_0x0fbf('0x15')]?_0x3b8103['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b8103[_0x0fbf('0x15')]?_0x3b8103['options'][_0x0fbf('0x19')]||null:null,'attributes':_0x3b8103[_0x0fbf('0x15')]?_0x3b8103[_0x0fbf('0x15')][_0x0fbf('0x1a')]||null:null,'limit':_0x3b8103[_0x0fbf('0x15')]?_0x3b8103[_0x0fbf('0x15')][_0x0fbf('0x1b')]||null:null})['then'](function(_0x38e9dd){logger[_0x0fbf('0x9')]('UpdateSmsQueueReport',_0x3b8103);logger[_0x0fbf('0xc')]('UpdateSmsQueueReport',_0x3b8103,JSON['stringify'](_0x38e9dd));_0x3189b8(_0x38e9dd);})[_0x0fbf('0x11')](function(_0x8f8125){logger['error'](_0x0fbf('0x1c'),_0x8f8125[_0x0fbf('0x10')],_0x3b8103);_0x5b916c(_0x5db399[_0x0fbf('0xf')](0x1f4,_0x8f8125[_0x0fbf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a08175a..8eb38ea 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 _0x1dcc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x212b60,_0x45b2e9){_0x212b60=_0x212b60-0x0;var _0xe085be=_0x1dcc[_0x212b60];return _0xe085be;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1dc('0x5'));var interaction=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x9')]);router[_0xc1dc('0xa')]('/describe',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xb')]);router['get'](_0xc1dc('0xc'),auth['isAuthenticated'](),controller[_0xc1dc('0xd')]);router['post']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xe')]);router[_0xc1dc('0xf')](_0xc1dc('0xc'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x10')]);router[_0xc1dc('0x11')](_0xc1dc('0xc'),auth[_0xc1dc('0x8')](),controller['destroy']);module[_0xc1dc('0x12')]=router; \ No newline at end of file +var _0x106f=['./smsTransferReport.controller','get','isAuthenticated','index','describe','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x106f,0x162));var _0xf106=function(_0x2afbb8,_0x3765ce){_0x2afbb8=_0x2afbb8-0x0;var _0x354b07=_0x106f[_0x2afbb8];return _0x354b07;};'use strict';var multer=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var path=require('path');var timeout=require(_0xf106('0x2'));var express=require(_0xf106('0x3'));var router=express['Router']();var fs_extra=require(_0xf106('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var controller=require(_0xf106('0x7'));router[_0xf106('0x8')]('/',auth[_0xf106('0x9')](),controller[_0xf106('0xa')]);router[_0xf106('0x8')]('/describe',auth[_0xf106('0x9')](),controller[_0xf106('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf106('0x9')](),controller[_0xf106('0xc')]);router[_0xf106('0xd')](_0xf106('0xe'),auth[_0xf106('0x9')](),controller[_0xf106('0xf')]);router[_0xf106('0x10')](_0xf106('0xe'),auth[_0xf106('0x9')](),controller[_0xf106('0x11')]);module[_0xf106('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index fe777ef..8251bb5 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x32f9cd,_0x4ffb36){var _0xe80ced=function(_0x1196c4){while(--_0x1196c4){_0x32f9cd['push'](_0x32f9cd['shift']());}};_0xe80ced(++_0x4ffb36);}(_0x54ef,0x112));var _0xf54e=function(_0x3e3db1,_0x1285ef){_0x3e3db1=_0x3e3db1-0x0;var _0x619340=_0x54ef[_0x3e3db1];return _0x619340;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x56dda5,_0x40d426){var _0x12574f=function(_0x27934c){while(--_0x27934c){_0x56dda5['push'](_0x56dda5['shift']());}};_0x12574f(++_0x40d426);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 409f2d6..25156f6 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 _0x6d95=['eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','update','body','find','describe'];(function(_0x1813d5,_0x404270){var _0x1040cc=function(_0x7fb71d){while(--_0x7fb71d){_0x1813d5['push'](_0x1813d5['shift']());}};_0x1040cc(++_0x404270);}(_0x6d95,0x124));var _0x56d9=function(_0x386c9c,_0x1050d7){_0x386c9c=_0x386c9c-0x0;var _0x579fe4=_0x6d95[_0x386c9c];return _0x579fe4;};'use strict';var emlformat=require(_0x56d9('0x0'));var rimraf=require(_0x56d9('0x1'));var zipdir=require(_0x56d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x56d9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x56d9('0x4'));var util=require(_0x56d9('0x5'));var path=require(_0x56d9('0x6'));var sox=require('sox');var csv=require(_0x56d9('0x7'));var ejs=require(_0x56d9('0x8'));var fs=require('fs');var fs_extra=require(_0x56d9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x56d9('0xa'));var jsforce=require(_0x56d9('0xb'));var deskjs=require(_0x56d9('0xc'));var toCsv=require(_0x56d9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x56d9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x56d9('0xe'));var as=require(_0x56d9('0xf'));var hardwareService=require(_0x56d9('0x10'));var logger=require(_0x56d9('0x11'))(_0x56d9('0x12'));var utils=require(_0x56d9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x56d9('0x14'));var db=require(_0x56d9('0x15'))['db'];function respondWithStatusCode(_0x3a8b88,_0x12a500){_0x12a500=_0x12a500||0xcc;return function(_0x1e81ab){if(_0x1e81ab){return _0x3a8b88[_0x56d9('0x16')](_0x12a500);}return _0x3a8b88['status'](_0x12a500)[_0x56d9('0x17')]();};}function respondWithResult(_0x58f84b,_0x43b20c){_0x43b20c=_0x43b20c||0xc8;return function(_0x2596db){if(_0x2596db){return _0x58f84b['status'](_0x43b20c)[_0x56d9('0x18')](_0x2596db);}};}function respondWithFilteredResult(_0x37bc1d,_0x5eda44){return function(_0x487dc9){if(_0x487dc9){var _0x26e955=typeof _0x5eda44[_0x56d9('0x19')]===_0x56d9('0x1a')&&typeof _0x5eda44['limit']===_0x56d9('0x1a');var _0x42524e=_0x487dc9['count'];var _0x5df370=_0x26e955?0x0:_0x5eda44[_0x56d9('0x19')];var _0x157e9f=_0x26e955?_0x487dc9[_0x56d9('0x1b')]:_0x5eda44['offset']+_0x5eda44[_0x56d9('0x1c')];var _0x12401a;if(_0x157e9f>=_0x42524e){_0x157e9f=_0x42524e;_0x12401a=0xc8;}else{_0x12401a=0xce;}_0x37bc1d[_0x56d9('0x1d')](_0x12401a);return _0x37bc1d[_0x56d9('0x1e')](_0x56d9('0x1f'),_0x5df370+'-'+_0x157e9f+'/'+_0x42524e)[_0x56d9('0x18')](_0x487dc9);}return null;};}function patchUpdates(_0x326b27){return function(_0x23e945){try{jsonpatch[_0x56d9('0x20')](_0x23e945,_0x326b27,!![]);}catch(_0x451424){return BPromise[_0x56d9('0x21')](_0x451424);}return _0x23e945[_0x56d9('0x22')]();};}function saveUpdates(_0x1b5a3a,_0x10e41d){return function(_0x278fc4){if(_0x278fc4){return _0x278fc4['update'](_0x1b5a3a)[_0x56d9('0x23')](function(_0x3cbfc1){return _0x3cbfc1;});}return null;};}function removeEntity(_0x2d1eeb,_0x1849c4){return function(_0x533264){if(_0x533264){return _0x533264[_0x56d9('0x24')]()[_0x56d9('0x23')](function(){_0x2d1eeb[_0x56d9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43fcd6,_0x5cdecc){return function(_0xd98e6d){if(!_0xd98e6d){_0x43fcd6['sendStatus'](0x194);}return _0xd98e6d;};}function handleError(_0x4261d5,_0x4d4718){_0x4d4718=_0x4d4718||0x1f4;return function(_0x18e51b){logger['error'](_0x18e51b[_0x56d9('0x25')]);if(_0x18e51b[_0x56d9('0x26')]){delete _0x18e51b[_0x56d9('0x26')];}_0x4261d5[_0x56d9('0x1d')](_0x4d4718)[_0x56d9('0x27')](_0x18e51b);};}exports['index']=function(_0x98f08,_0x579f7b){var _0x43d1b9={},_0x22579e={},_0x3702f6={'count':0x0,'rows':[]};var _0x56677e=_[_0x56d9('0x28')](db[_0x56d9('0x29')][_0x56d9('0x2a')],function(_0x5f023e){return{'name':_0x5f023e[_0x56d9('0x2b')],'type':_0x5f023e['type'][_0x56d9('0x2c')]};});_0x22579e['model']=_[_0x56d9('0x28')](_0x56677e,'name');_0x22579e['query']=_[_0x56d9('0x2d')](_0x98f08[_0x56d9('0x2e')]);_0x22579e[_0x56d9('0x2f')]=_['intersection'](_0x22579e[_0x56d9('0x30')],_0x22579e[_0x56d9('0x2e')]);_0x43d1b9[_0x56d9('0x31')]=_['intersection'](_0x22579e[_0x56d9('0x30')],qs[_0x56d9('0x32')](_0x98f08[_0x56d9('0x2e')][_0x56d9('0x32')]));_0x43d1b9[_0x56d9('0x31')]=_0x43d1b9[_0x56d9('0x31')][_0x56d9('0x33')]?_0x43d1b9['attributes']:_0x22579e[_0x56d9('0x30')];if(!_0x98f08['query'][_0x56d9('0x34')](_0x56d9('0x35'))){_0x43d1b9[_0x56d9('0x1c')]=qs[_0x56d9('0x1c')](_0x98f08['query'][_0x56d9('0x1c')]);_0x43d1b9[_0x56d9('0x19')]=qs[_0x56d9('0x19')](_0x98f08[_0x56d9('0x2e')][_0x56d9('0x19')]);}_0x43d1b9['order']=qs[_0x56d9('0x36')](_0x98f08['query']['sort']);_0x43d1b9[_0x56d9('0x37')]=qs[_0x56d9('0x2f')](_['pick'](_0x98f08['query'],_0x22579e[_0x56d9('0x2f')]),_0x56677e);if(_0x98f08['query']['filter']){_0x43d1b9[_0x56d9('0x37')]=_[_0x56d9('0x38')](_0x43d1b9[_0x56d9('0x37')],{'$or':_[_0x56d9('0x28')](_0x56677e,function(_0x3cc053){if(_0x3cc053['type']!==_0x56d9('0x39')){var _0x44932b={};_0x44932b[_0x3cc053[_0x56d9('0x26')]]={'$like':'%'+_0x98f08[_0x56d9('0x2e')][_0x56d9('0x3a')]+'%'};return _0x44932b;}})});}_0x43d1b9=_[_0x56d9('0x38')]({},_0x43d1b9,_0x98f08[_0x56d9('0x3b')]);var _0x5d6640={'where':_0x43d1b9['where']};return db['SmsTransferReport']['count'](_0x5d6640)[_0x56d9('0x23')](function(_0xfa16bc){_0x3702f6[_0x56d9('0x1b')]=_0xfa16bc;if(_0x98f08['query'][_0x56d9('0x3c')]){_0x43d1b9[_0x56d9('0x3d')]=[{'all':!![]}];}return db[_0x56d9('0x29')][_0x56d9('0x3e')](_0x43d1b9);})[_0x56d9('0x23')](function(_0x1e69bb){_0x3702f6[_0x56d9('0x3f')]=_0x1e69bb;return _0x3702f6;})['then'](respondWithFilteredResult(_0x579f7b,_0x43d1b9))[_0x56d9('0x40')](handleError(_0x579f7b,null));};exports[_0x56d9('0x41')]=function(_0x57bdda,_0x264d06){var _0x4da74b={'raw':!![],'where':{'id':_0x57bdda[_0x56d9('0x42')]['id']}},_0x216c8e={};_0x216c8e['model']=_[_0x56d9('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x216c8e['query']=_['keys'](_0x57bdda[_0x56d9('0x2e')]);_0x216c8e['filters']=_[_0x56d9('0x43')](_0x216c8e[_0x56d9('0x30')],_0x216c8e[_0x56d9('0x2e')]);_0x4da74b[_0x56d9('0x31')]=_[_0x56d9('0x43')](_0x216c8e[_0x56d9('0x30')],qs[_0x56d9('0x32')](_0x57bdda[_0x56d9('0x2e')][_0x56d9('0x32')]));_0x4da74b[_0x56d9('0x31')]=_0x4da74b[_0x56d9('0x31')][_0x56d9('0x33')]?_0x4da74b[_0x56d9('0x31')]:_0x216c8e[_0x56d9('0x30')];if(_0x57bdda[_0x56d9('0x2e')][_0x56d9('0x3c')]){_0x4da74b['include']=[{'all':!![]}];}_0x4da74b=_[_0x56d9('0x38')]({},_0x4da74b,_0x57bdda[_0x56d9('0x3b')]);return db[_0x56d9('0x29')]['find'](_0x4da74b)[_0x56d9('0x23')](handleEntityNotFound(_0x264d06,null))['then'](respondWithResult(_0x264d06,null))[_0x56d9('0x40')](handleError(_0x264d06,null));};exports['create']=function(_0x400d3b,_0x415123){return db[_0x56d9('0x29')][_0x56d9('0x44')](_0x400d3b['body'],{})['then'](respondWithResult(_0x415123,0xc9))['catch'](handleError(_0x415123,null));};exports[_0x56d9('0x45')]=function(_0xd75a3,_0x5bd845){if(_0xd75a3[_0x56d9('0x46')]['id']){delete _0xd75a3['body']['id'];}return db[_0x56d9('0x29')][_0x56d9('0x47')]({'where':{'id':_0xd75a3[_0x56d9('0x42')]['id']}})[_0x56d9('0x23')](handleEntityNotFound(_0x5bd845,null))[_0x56d9('0x23')](saveUpdates(_0xd75a3[_0x56d9('0x46')],null))['then'](respondWithResult(_0x5bd845,null))['catch'](handleError(_0x5bd845,null));};exports[_0x56d9('0x24')]=function(_0x55e4b2,_0x360bd3){return db['SmsTransferReport'][_0x56d9('0x47')]({'where':{'id':_0x55e4b2[_0x56d9('0x42')]['id']}})['then'](handleEntityNotFound(_0x360bd3,null))['then'](removeEntity(_0x360bd3,null))[_0x56d9('0x40')](handleError(_0x360bd3,null));};exports[_0x56d9('0x48')]=function(_0x5e7f9c,_0x79dcee){return db[_0x56d9('0x29')][_0x56d9('0x48')]()['then'](respondWithResult(_0x79dcee,null))[_0x56d9('0x40')](handleError(_0x79dcee,null));}; \ No newline at end of file +var _0xfd80=['where','pick','merge','options','include','SmsTransferReport','findAll','show','includeAll','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5c01ef,_0x22bd5d){var _0xa32b85=function(_0x386bb3){while(--_0x386bb3){_0x5c01ef['push'](_0x5c01ef['shift']());}};_0xa32b85(++_0x22bd5d);}(_0xfd80,0xa6));var _0x0fd8=function(_0x12bdd4,_0xf1930e){_0x12bdd4=_0x12bdd4-0x0;var _0x37271c=_0xfd80[_0x12bdd4];return _0x37271c;};'use strict';var emlformat=require(_0x0fd8('0x0'));var rimraf=require(_0x0fd8('0x1'));var zipdir=require(_0x0fd8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fd8('0x3'));var moment=require(_0x0fd8('0x4'));var BPromise=require(_0x0fd8('0x5'));var Mustache=require(_0x0fd8('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0fd8('0x7'));var _=require(_0x0fd8('0x8'));var squel=require(_0x0fd8('0x9'));var crypto=require('crypto');var jsforce=require(_0x0fd8('0xa'));var deskjs=require(_0x0fd8('0xb'));var toCsv=require(_0x0fd8('0xc'));var querystring=require(_0x0fd8('0xd'));var Papa=require(_0x0fd8('0xe'));var Redis=require('ioredis');var authService=require(_0x0fd8('0xf'));var qs=require(_0x0fd8('0x10'));var as=require(_0x0fd8('0x11'));var hardwareService=require(_0x0fd8('0x12'));var logger=require(_0x0fd8('0x13'))(_0x0fd8('0x14'));var utils=require(_0x0fd8('0x15'));var config=require(_0x0fd8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10e732,_0x564338){_0x564338=_0x564338||0xcc;return function(_0x227b75){if(_0x227b75){return _0x10e732[_0x0fd8('0x17')](_0x564338);}return _0x10e732[_0x0fd8('0x18')](_0x564338)[_0x0fd8('0x19')]();};}function respondWithResult(_0x17a004,_0x1bc482){_0x1bc482=_0x1bc482||0xc8;return function(_0x2757fa){if(_0x2757fa){return _0x17a004[_0x0fd8('0x18')](_0x1bc482)[_0x0fd8('0x1a')](_0x2757fa);}};}function respondWithFilteredResult(_0x9fe9da,_0x57e69f){return function(_0x51ec15){if(_0x51ec15){var _0x12ca73=typeof _0x57e69f[_0x0fd8('0x1b')]===_0x0fd8('0x1c')&&typeof _0x57e69f['limit']===_0x0fd8('0x1c');var _0x380555=_0x51ec15[_0x0fd8('0x1d')];var _0x16121c=_0x12ca73?0x0:_0x57e69f['offset'];var _0x126729=_0x12ca73?_0x51ec15[_0x0fd8('0x1d')]:_0x57e69f['offset']+_0x57e69f[_0x0fd8('0x1e')];var _0x145ca3;if(_0x126729>=_0x380555){_0x126729=_0x380555;_0x145ca3=0xc8;}else{_0x145ca3=0xce;}_0x9fe9da[_0x0fd8('0x18')](_0x145ca3);return _0x9fe9da[_0x0fd8('0x1f')](_0x0fd8('0x20'),_0x16121c+'-'+_0x126729+'/'+_0x380555)['json'](_0x51ec15);}return null;};}function patchUpdates(_0xff3425){return function(_0x2315af){try{jsonpatch[_0x0fd8('0x21')](_0x2315af,_0xff3425,!![]);}catch(_0x41bb6b){return BPromise['reject'](_0x41bb6b);}return _0x2315af[_0x0fd8('0x22')]();};}function saveUpdates(_0x326588,_0x398df7){return function(_0x5c9738){if(_0x5c9738){return _0x5c9738['update'](_0x326588)[_0x0fd8('0x23')](function(_0x258074){return _0x258074;});}return null;};}function removeEntity(_0x3582ca,_0x2651aa){return function(_0x10e5e0){if(_0x10e5e0){return _0x10e5e0[_0x0fd8('0x24')]()[_0x0fd8('0x23')](function(){_0x3582ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x470569,_0x2b3723){return function(_0x1b73fa){if(!_0x1b73fa){_0x470569[_0x0fd8('0x17')](0x194);}return _0x1b73fa;};}function handleError(_0x1ba4d0,_0x56f600){_0x56f600=_0x56f600||0x1f4;return function(_0x4a06e8){logger[_0x0fd8('0x25')](_0x4a06e8[_0x0fd8('0x26')]);if(_0x4a06e8[_0x0fd8('0x27')]){delete _0x4a06e8[_0x0fd8('0x27')];}_0x1ba4d0[_0x0fd8('0x18')](_0x56f600)[_0x0fd8('0x28')](_0x4a06e8);};}exports[_0x0fd8('0x29')]=function(_0x131bb5,_0x10714a){var _0x4559c2={},_0x5b43f9={},_0x2a28c8={'count':0x0,'rows':[]};var _0xb55986=_[_0x0fd8('0x2a')](db['SmsTransferReport'][_0x0fd8('0x2b')],function(_0x4095f1){return{'name':_0x4095f1[_0x0fd8('0x2c')],'type':_0x4095f1[_0x0fd8('0x2d')][_0x0fd8('0x2e')]};});_0x5b43f9[_0x0fd8('0x2f')]=_[_0x0fd8('0x2a')](_0xb55986,_0x0fd8('0x27'));_0x5b43f9['query']=_[_0x0fd8('0x30')](_0x131bb5[_0x0fd8('0x31')]);_0x5b43f9[_0x0fd8('0x32')]=_[_0x0fd8('0x33')](_0x5b43f9[_0x0fd8('0x2f')],_0x5b43f9['query']);_0x4559c2['attributes']=_[_0x0fd8('0x33')](_0x5b43f9['model'],qs[_0x0fd8('0x34')](_0x131bb5[_0x0fd8('0x31')][_0x0fd8('0x34')]));_0x4559c2[_0x0fd8('0x35')]=_0x4559c2['attributes'][_0x0fd8('0x36')]?_0x4559c2[_0x0fd8('0x35')]:_0x5b43f9[_0x0fd8('0x2f')];if(!_0x131bb5[_0x0fd8('0x31')][_0x0fd8('0x37')](_0x0fd8('0x38'))){_0x4559c2['limit']=qs[_0x0fd8('0x1e')](_0x131bb5[_0x0fd8('0x31')][_0x0fd8('0x1e')]);_0x4559c2['offset']=qs[_0x0fd8('0x1b')](_0x131bb5[_0x0fd8('0x31')]['offset']);}_0x4559c2[_0x0fd8('0x39')]=qs[_0x0fd8('0x3a')](_0x131bb5['query']['sort']);_0x4559c2[_0x0fd8('0x3b')]=qs[_0x0fd8('0x32')](_[_0x0fd8('0x3c')](_0x131bb5['query'],_0x5b43f9[_0x0fd8('0x32')]),_0xb55986);if(_0x131bb5[_0x0fd8('0x31')]['filter']){_0x4559c2[_0x0fd8('0x3b')]=_[_0x0fd8('0x3d')](_0x4559c2['where'],{'$or':_[_0x0fd8('0x2a')](_0xb55986,function(_0x5e52f2){if(_0x5e52f2[_0x0fd8('0x2d')]!=='VIRTUAL'){var _0x2eb9e5={};_0x2eb9e5[_0x5e52f2[_0x0fd8('0x27')]]={'$like':'%'+_0x131bb5['query']['filter']+'%'};return _0x2eb9e5;}})});}_0x4559c2=_['merge']({},_0x4559c2,_0x131bb5[_0x0fd8('0x3e')]);var _0x3d56e9={'where':_0x4559c2[_0x0fd8('0x3b')]};return db['SmsTransferReport'][_0x0fd8('0x1d')](_0x3d56e9)[_0x0fd8('0x23')](function(_0x23ad04){_0x2a28c8['count']=_0x23ad04;if(_0x131bb5[_0x0fd8('0x31')]['includeAll']){_0x4559c2[_0x0fd8('0x3f')]=[{'all':!![]}];}return db[_0x0fd8('0x40')][_0x0fd8('0x41')](_0x4559c2);})[_0x0fd8('0x23')](function(_0x6e6c0b){_0x2a28c8['rows']=_0x6e6c0b;return _0x2a28c8;})[_0x0fd8('0x23')](respondWithFilteredResult(_0x10714a,_0x4559c2))['catch'](handleError(_0x10714a,null));};exports[_0x0fd8('0x42')]=function(_0x488957,_0x44334d){var _0x7e9795={'raw':!![],'where':{'id':_0x488957['params']['id']}},_0x43541c={};_0x43541c[_0x0fd8('0x2f')]=_[_0x0fd8('0x30')](db[_0x0fd8('0x40')][_0x0fd8('0x2b')]);_0x43541c['query']=_[_0x0fd8('0x30')](_0x488957[_0x0fd8('0x31')]);_0x43541c[_0x0fd8('0x32')]=_[_0x0fd8('0x33')](_0x43541c[_0x0fd8('0x2f')],_0x43541c[_0x0fd8('0x31')]);_0x7e9795[_0x0fd8('0x35')]=_[_0x0fd8('0x33')](_0x43541c[_0x0fd8('0x2f')],qs['fields'](_0x488957['query']['fields']));_0x7e9795[_0x0fd8('0x35')]=_0x7e9795[_0x0fd8('0x35')][_0x0fd8('0x36')]?_0x7e9795['attributes']:_0x43541c[_0x0fd8('0x2f')];if(_0x488957['query'][_0x0fd8('0x43')]){_0x7e9795[_0x0fd8('0x3f')]=[{'all':!![]}];}_0x7e9795=_[_0x0fd8('0x3d')]({},_0x7e9795,_0x488957['options']);return db[_0x0fd8('0x40')][_0x0fd8('0x44')](_0x7e9795)[_0x0fd8('0x23')](handleEntityNotFound(_0x44334d,null))[_0x0fd8('0x23')](respondWithResult(_0x44334d,null))[_0x0fd8('0x45')](handleError(_0x44334d,null));};exports[_0x0fd8('0x46')]=function(_0x123517,_0x17db6d){return db[_0x0fd8('0x40')][_0x0fd8('0x46')](_0x123517[_0x0fd8('0x47')],{})[_0x0fd8('0x23')](respondWithResult(_0x17db6d,0xc9))[_0x0fd8('0x45')](handleError(_0x17db6d,null));};exports[_0x0fd8('0x48')]=function(_0x57ad9e,_0x393e4d){if(_0x57ad9e['body']['id']){delete _0x57ad9e['body']['id'];}return db[_0x0fd8('0x40')][_0x0fd8('0x44')]({'where':{'id':_0x57ad9e['params']['id']}})['then'](handleEntityNotFound(_0x393e4d,null))[_0x0fd8('0x23')](saveUpdates(_0x57ad9e[_0x0fd8('0x47')],null))['then'](respondWithResult(_0x393e4d,null))[_0x0fd8('0x45')](handleError(_0x393e4d,null));};exports[_0x0fd8('0x24')]=function(_0x483ebd,_0x43d671){return db[_0x0fd8('0x40')]['find']({'where':{'id':_0x483ebd[_0x0fd8('0x49')]['id']}})[_0x0fd8('0x23')](handleEntityNotFound(_0x43d671,null))['then'](removeEntity(_0x43d671,null))[_0x0fd8('0x45')](handleError(_0x43d671,null));};exports['describe']=function(_0x19db46,_0x3f7dae){return db['SmsTransferReport'][_0x0fd8('0x4a')]()[_0x0fd8('0x23')](respondWithResult(_0x3f7dae,null))[_0x0fd8('0x45')](handleError(_0x3f7dae,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 47f999c..5e1a0fb 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 _0xd6d7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0xd6d7,0x70));var _0x7d6d=function(_0x5cd6b1,_0x1f2982){_0x5cd6b1=_0x5cd6b1-0x0;var _0x3398e7=_0xd6d7[_0x5cd6b1];return _0x3398e7;};'use strict';var _=require(_0x7d6d('0x0'));var util=require(_0x7d6d('0x1'));var logger=require(_0x7d6d('0x2'))(_0x7d6d('0x3'));var moment=require(_0x7d6d('0x4'));var BPromise=require(_0x7d6d('0x5'));var rp=require(_0x7d6d('0x6'));var fs=require('fs');var path=require(_0x7d6d('0x7'));var rimraf=require(_0x7d6d('0x8'));var config=require(_0x7d6d('0x9'));var attributes=require(_0x7d6d('0xa'));module[_0x7d6d('0xb')]=function(_0x11b276,_0x3c4a85){return _0x11b276[_0x7d6d('0xc')](_0x7d6d('0xd'),attributes,{'tableName':_0x7d6d('0xe'),'paranoid':![],'indexes':[{'name':_0x7d6d('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x37cb=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13cb83,_0x34dbe3){var _0x49e1bb=function(_0x2a3e99){while(--_0x2a3e99){_0x13cb83['push'](_0x13cb83['shift']());}};_0x49e1bb(++_0x34dbe3);}(_0x37cb,0x12d));var _0xb37c=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x37cb[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0xb37c('0x0'));var util=require(_0xb37c('0x1'));var logger=require(_0xb37c('0x2'))(_0xb37c('0x3'));var moment=require(_0xb37c('0x4'));var BPromise=require(_0xb37c('0x5'));var rp=require(_0xb37c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb37c('0x7'));var attributes=require(_0xb37c('0x8'));module[_0xb37c('0x9')]=function(_0x26b8e7,_0xdcf896){return _0x26b8e7[_0xb37c('0xa')](_0xb37c('0xb'),attributes,{'tableName':_0xb37c('0xc'),'paranoid':![],'indexes':[{'name':_0xb37c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 785e938..2597ac9 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 _0x269f=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x2d9a23,_0x481dc4){var _0x5198ee=function(_0x27d373){while(--_0x27d373){_0x2d9a23['push'](_0x2d9a23['shift']());}};_0x5198ee(++_0x481dc4);}(_0x269f,0xee));var _0xf269=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x269f[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xf269('0x0'));var util=require(_0xf269('0x1'));var moment=require(_0xf269('0x2'));var BPromise=require('bluebird');var rs=require(_0xf269('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf269('0x4'))['db'];var utils=require(_0xf269('0x5'));var logger=require(_0xf269('0x6'))(_0xf269('0x7'));var config=require(_0xf269('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf269('0x9')][_0xf269('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36d30c,_0x48058a,_0x3ffba3){return new BPromise(function(_0x43c60c,_0x3ef428){return client['request'](_0x36d30c,_0x3ffba3)[_0xf269('0xb')](function(_0x31be8e){logger[_0xf269('0xc')](_0xf269('0xd'),_0x48058a,_0xf269('0xe'));logger[_0xf269('0xf')](_0xf269('0x10'),_0x48058a,_0xf269('0xe'),JSON['stringify'](_0x31be8e));if(_0x31be8e['error']){if(_0x31be8e['error']['code']===0x1f4){logger['error'](_0xf269('0xd'),_0x48058a,_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);return _0x3ef428(_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);}logger[_0xf269('0x11')](_0xf269('0xd'),_0x48058a,_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);return _0x43c60c(_0x31be8e[_0xf269('0x11')][_0xf269('0x12')]);}else{logger[_0xf269('0xc')](_0xf269('0xd'),_0x48058a,_0xf269('0xe'));_0x43c60c(_0x31be8e[_0xf269('0x13')][_0xf269('0x12')]);}})[_0xf269('0x14')](function(_0x2ab68c){logger[_0xf269('0x11')](_0xf269('0xd'),_0x48058a,_0x2ab68c);_0x3ef428(_0x2ab68c);});});} \ No newline at end of file +var _0x34f2=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3fc726,_0x3bb2d3){var _0x4ca942=function(_0x23c5a6){while(--_0x23c5a6){_0x3fc726['push'](_0x3fc726['shift']());}};_0x4ca942(++_0x3bb2d3);}(_0x34f2,0x15a));var _0x234f=function(_0x4ab6be,_0x15e33d){_0x4ab6be=_0x4ab6be-0x0;var _0x31216a=_0x34f2[_0x4ab6be];return _0x31216a;};'use strict';var _=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var moment=require('moment');var BPromise=require(_0x234f('0x2'));var rs=require(_0x234f('0x3'));var fs=require('fs');var Redis=require(_0x234f('0x4'));var db=require(_0x234f('0x5'))['db'];var utils=require(_0x234f('0x6'));var logger=require(_0x234f('0x7'))(_0x234f('0x8'));var config=require(_0x234f('0x9'));var jayson=require(_0x234f('0xa'));var client=jayson[_0x234f('0xb')][_0x234f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x254f37,_0x3aaf6c,_0x477918){return new BPromise(function(_0x691793,_0x514588){return client[_0x234f('0xd')](_0x254f37,_0x477918)[_0x234f('0xe')](function(_0x5d9661){logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));logger[_0x234f('0x11')](_0x234f('0x12'),_0x3aaf6c,_0x234f('0x10'),JSON['stringify'](_0x5d9661));if(_0x5d9661[_0x234f('0x13')]){if(_0x5d9661[_0x234f('0x13')][_0x234f('0x14')]===0x1f4){logger[_0x234f('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x3aaf6c,_0x5d9661[_0x234f('0x13')]['message']);return _0x514588(_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);}logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);return _0x691793(_0x5d9661[_0x234f('0x13')]['message']);}else{logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));_0x691793(_0x5d9661['result'][_0x234f('0x15')]);}})[_0x234f('0x16')](function(_0x228dcc){logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x228dcc);_0x514588(_0x228dcc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 29eb62a..4c45616 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 _0x590e=['create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','post','single','file'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x590e,0xf4));var _0xe590=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x590e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe590('0x0'));var util=require(_0xe590('0x1'));var path=require(_0xe590('0x2'));var timeout=require(_0xe590('0x3'));var express=require('express');var router=express[_0xe590('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe590('0x5'));var interaction=require(_0xe590('0x6'));var config=require('../../config/environment');var controller=require(_0xe590('0x7'));router[_0xe590('0x8')]('/',auth[_0xe590('0x9')](),controller[_0xe590('0xa')]);router[_0xe590('0x8')](_0xe590('0xb'),auth[_0xe590('0x9')](),controller[_0xe590('0xc')]);router[_0xe590('0x8')](_0xe590('0xd'),auth[_0xe590('0x9')](),controller[_0xe590('0xe')]);var upload=multer({'storage':multer[_0xe590('0xf')]({'destination':function(_0x16caa3,_0x3e3285,_0x191c1b){_0x191c1b(null,path['join'](config[_0xe590('0x10')],_0xe590('0x11')));},'filename':function(_0x21ac1a,_0x448d73,_0x3d4d39){_0x448d73[_0xe590('0x12')]=_0x448d73[_0xe590('0x12')][_0xe590('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d4d39(null,util[_0xe590('0x14')](_0xe590('0x15'),path['basename'](_0x448d73[_0xe590('0x12')],path[_0xe590('0x16')](_0x448d73[_0xe590('0x12')])),Date['now'](),path[_0xe590('0x16')](_0x448d73['originalname'])));}})});router[_0xe590('0x17')]('/',upload[_0xe590('0x18')](_0xe590('0x19')),controller[_0xe590('0x1a')]);router[_0xe590('0x1b')](_0xe590('0xb'),auth[_0xe590('0x9')](),controller['update']);router[_0xe590('0x1c')](_0xe590('0xb'),auth[_0xe590('0x9')](),controller[_0xe590('0x1c')]);module[_0xe590('0x1d')]=router; \ No newline at end of file +var _0x8cb5=['../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','extname','now','post','create','update','delete','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5279d7,_0x336dc0){var _0x6f68c2=function(_0x400ba5){while(--_0x400ba5){_0x5279d7['push'](_0x5279d7['shift']());}};_0x6f68c2(++_0x336dc0);}(_0x8cb5,0x1cf));var _0x58cb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8cb5[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x58cb('0x0'));var util=require('util');var path=require(_0x58cb('0x1'));var timeout=require(_0x58cb('0x2'));var express=require('express');var router=express[_0x58cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x58cb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x58cb('0x5'));var controller=require(_0x58cb('0x6'));router[_0x58cb('0x7')]('/',auth[_0x58cb('0x8')](),controller[_0x58cb('0x9')]);router[_0x58cb('0x7')](_0x58cb('0xa'),auth[_0x58cb('0x8')](),controller['show']);router[_0x58cb('0x7')](_0x58cb('0xb'),auth[_0x58cb('0x8')](),controller[_0x58cb('0xc')]);var upload=multer({'storage':multer[_0x58cb('0xd')]({'destination':function(_0x40c260,_0x2713f3,_0x509722){_0x509722(null,path[_0x58cb('0xe')](config[_0x58cb('0xf')],'server/files/sounds/original/'));},'filename':function(_0x431c75,_0x4a5644,_0x265f07){_0x4a5644[_0x58cb('0x10')]=_0x4a5644[_0x58cb('0x10')][_0x58cb('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x265f07(null,util[_0x58cb('0x12')]('%s-%s%s',path[_0x58cb('0x13')](_0x4a5644[_0x58cb('0x10')],path[_0x58cb('0x14')](_0x4a5644['originalname'])),Date[_0x58cb('0x15')](),path[_0x58cb('0x14')](_0x4a5644[_0x58cb('0x10')])));}})});router[_0x58cb('0x16')]('/',upload['single']('file'),controller[_0x58cb('0x17')]);router['put']('/:id',auth[_0x58cb('0x8')](),controller[_0x58cb('0x18')]);router[_0x58cb('0x19')](_0x58cb('0xa'),auth[_0x58cb('0x8')](),controller[_0x58cb('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9243634..7d25f32 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 _0xc263=['INTEGER','BIGINT','sequelize','exports','STRING','name','FLOAT'];(function(_0x2c5d1c,_0x48f885){var _0x10cdd5=function(_0x27f2df){while(--_0x27f2df){_0x2c5d1c['push'](_0x2c5d1c['shift']());}};_0x10cdd5(++_0x48f885);}(_0xc263,0x11a));var _0x3c26=function(_0x2e824e,_0x3ce1f3){_0x2e824e=_0x2e824e-0x0;var _0x10fb6e=_0xc263[_0x2e824e];return _0x10fb6e;};'use strict';var Sequelize=require(_0x3c26('0x0'));module[_0x3c26('0x1')]={'name':{'type':Sequelize[_0x3c26('0x2')],'unique':_0x3c26('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3c26('0x2')]},'display_name':{'type':Sequelize[_0x3c26('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x3c26('0x2')]},'original_format':{'type':Sequelize[_0x3c26('0x2')]},'original_duration':{'type':Sequelize[_0x3c26('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x3c26('0x5')]},'original_bitRate':{'type':Sequelize[_0x3c26('0x6')]},'original_sampleRate':{'type':Sequelize[_0x3c26('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x3c26('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x3c26('0x6')]},'converted_channelCount':{'type':Sequelize[_0x3c26('0x5')]},'converted_bitRate':{'type':Sequelize[_0x3c26('0x6')]},'converted_sampleRate':{'type':Sequelize[_0x3c26('0x5')]}}; \ No newline at end of file +var _0xc368=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x4307f4,_0x478ca1){var _0x35745e=function(_0x3b0ae7){while(--_0x3b0ae7){_0x4307f4['push'](_0x4307f4['shift']());}};_0x35745e(++_0x478ca1);}(_0xc368,0x120));var _0x8c36=function(_0x22044d,_0x5d9ca2){_0x22044d=_0x22044d-0x0;var _0x5daa79=_0xc368[_0x22044d];return _0x5daa79;};'use strict';var Sequelize=require(_0x8c36('0x0'));module[_0x8c36('0x1')]={'name':{'type':Sequelize[_0x8c36('0x2')],'unique':_0x8c36('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8c36('0x2')]},'display_name':{'type':Sequelize[_0x8c36('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x8c36('0x4')]},'original_sampleCount':{'type':Sequelize[_0x8c36('0x5')]},'original_channelCount':{'type':Sequelize[_0x8c36('0x6')]},'original_bitRate':{'type':Sequelize[_0x8c36('0x5')]},'original_sampleRate':{'type':Sequelize[_0x8c36('0x6')]},'converted_format':{'type':Sequelize[_0x8c36('0x2')]},'converted_duration':{'type':Sequelize[_0x8c36('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x8c36('0x5')]},'converted_channelCount':{'type':Sequelize[_0x8c36('0x6')]},'converted_bitRate':{'type':Sequelize[_0x8c36('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x8c36('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 822d89d..3cf199e 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 _0xf54e=['ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','type','key','keys','intersection','query','model','fields','attributes','length','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','catch','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','save_name','create','basename','extname','file','filename','originalname','substring','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','start','pick','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xf54e,0x75));var _0xef54=function(_0x2498b5,_0x514ddb){_0x2498b5=_0x2498b5-0x0;var _0x5c48d8=_0xf54e[_0x2498b5];return _0x5c48d8;};'use strict';var emlformat=require(_0xef54('0x0'));var rimraf=require(_0xef54('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef54('0x2'));var rp=require(_0xef54('0x3'));var moment=require(_0xef54('0x4'));var BPromise=require(_0xef54('0x5'));var Mustache=require(_0xef54('0x6'));var util=require(_0xef54('0x7'));var path=require(_0xef54('0x8'));var sox=require(_0xef54('0x9'));var csv=require(_0xef54('0xa'));var ejs=require(_0xef54('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef54('0xc'));var squel=require(_0xef54('0xd'));var crypto=require('crypto');var jsforce=require(_0xef54('0xe'));var deskjs=require(_0xef54('0xf'));var toCsv=require(_0xef54('0xa'));var querystring=require(_0xef54('0x10'));var Papa=require('papaparse');var Redis=require(_0xef54('0x11'));var authService=require(_0xef54('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xef54('0x13'));var hardwareService=require(_0xef54('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xef54('0x15'));var config=require(_0xef54('0x16'));var licenseUtil=require(_0xef54('0x17'));var db=require(_0xef54('0x18'))['db'];function respondWithStatusCode(_0x268305,_0x3f0906){_0x3f0906=_0x3f0906||0xcc;return function(_0x17156e){if(_0x17156e){return _0x268305[_0xef54('0x19')](_0x3f0906);}return _0x268305[_0xef54('0x1a')](_0x3f0906)[_0xef54('0x1b')]();};}function respondWithResult(_0x25de75,_0x26320b){_0x26320b=_0x26320b||0xc8;return function(_0x189a27){if(_0x189a27){return _0x25de75[_0xef54('0x1a')](_0x26320b)[_0xef54('0x1c')](_0x189a27);}};}function respondWithFilteredResult(_0xc08ce8,_0x43a34c){return function(_0x1de9aa){if(_0x1de9aa){var _0x4717a5=typeof _0x43a34c['offset']===_0xef54('0x1d')&&typeof _0x43a34c['limit']===_0xef54('0x1d');var _0xf60d5a=_0x1de9aa[_0xef54('0x1e')];var _0x102674=_0x4717a5?0x0:_0x43a34c[_0xef54('0x1f')];var _0x20e9ca=_0x4717a5?_0x1de9aa[_0xef54('0x1e')]:_0x43a34c[_0xef54('0x1f')]+_0x43a34c[_0xef54('0x20')];var _0xc14dc;if(_0x20e9ca>=_0xf60d5a){_0x20e9ca=_0xf60d5a;_0xc14dc=0xc8;}else{_0xc14dc=0xce;}_0xc08ce8[_0xef54('0x1a')](_0xc14dc);return _0xc08ce8[_0xef54('0x21')]('Content-Range',_0x102674+'-'+_0x20e9ca+'/'+_0xf60d5a)['json'](_0x1de9aa);}return null;};}function patchUpdates(_0xc367ea){return function(_0xa4b73c){try{jsonpatch['apply'](_0xa4b73c,_0xc367ea,!![]);}catch(_0x168d1e){return BPromise[_0xef54('0x22')](_0x168d1e);}return _0xa4b73c['save']();};}function saveUpdates(_0x3fe1e8,_0x1eb6a5){return function(_0x230373){if(_0x230373){return _0x230373[_0xef54('0x23')](_0x3fe1e8)[_0xef54('0x24')](function(_0x4c46bf){return _0x4c46bf;});}return null;};}function removeEntity(_0xf3ff26,_0x14a273){return function(_0x244dde){if(_0x244dde){return _0x244dde[_0xef54('0x25')]()[_0xef54('0x24')](function(){var _0x59eb23=_0x244dde[_0xef54('0x26')]({'plain':!![]});var _0x2cfc3c=_0xef54('0x27');return db[_0xef54('0x28')][_0xef54('0x25')]({'where':{'type':_0x2cfc3c,'resourceId':_0x59eb23['id']}})[_0xef54('0x24')](function(){return _0x244dde;});})[_0xef54('0x24')](function(){_0xf3ff26[_0xef54('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x595c27,_0x318a4a){return function(_0x33e54f){if(!_0x33e54f){_0x595c27['sendStatus'](0x194);}return _0x33e54f;};}function handleError(_0xd3b004,_0x27c1c0){_0x27c1c0=_0x27c1c0||0x1f4;return function(_0x410a6e){logger[_0xef54('0x29')](_0x410a6e[_0xef54('0x2a')]);if(_0x410a6e[_0xef54('0x2b')]){delete _0x410a6e['name'];}_0xd3b004[_0xef54('0x1a')](_0x27c1c0)[_0xef54('0x2c')](_0x410a6e);};}exports[_0xef54('0x2d')]=function(_0x552c6a,_0x243cdb){var _0x1b0262={},_0x5063c9={},_0x3d0dc0={'count':0x0,'rows':[]};var _0x22200e=_[_0xef54('0x2e')](db[_0xef54('0x2f')][_0xef54('0x30')],function(_0x17ab94){return{'name':_0x17ab94['fieldName'],'type':_0x17ab94[_0xef54('0x31')][_0xef54('0x32')]};});_0x5063c9['model']=_['map'](_0x22200e,'name');_0x5063c9['query']=_[_0xef54('0x33')](_0x552c6a['query']);_0x5063c9['filters']=_[_0xef54('0x34')](_0x5063c9['model'],_0x5063c9[_0xef54('0x35')]);_0x1b0262['attributes']=_[_0xef54('0x34')](_0x5063c9[_0xef54('0x36')],qs[_0xef54('0x37')](_0x552c6a['query'][_0xef54('0x37')]));_0x1b0262['attributes']=_0x1b0262[_0xef54('0x38')][_0xef54('0x39')]?_0x1b0262['attributes']:_0x5063c9[_0xef54('0x36')];if(!_0x552c6a[_0xef54('0x35')]['hasOwnProperty'](_0xef54('0x3a'))){_0x1b0262[_0xef54('0x20')]=qs['limit'](_0x552c6a[_0xef54('0x35')]['limit']);_0x1b0262[_0xef54('0x1f')]=qs[_0xef54('0x1f')](_0x552c6a['query']['offset']);}_0x1b0262['order']=qs[_0xef54('0x3b')](_0x552c6a[_0xef54('0x35')][_0xef54('0x3b')]);_0x1b0262[_0xef54('0x3c')]=qs[_0xef54('0x3d')](_['pick'](_0x552c6a[_0xef54('0x35')],_0x5063c9[_0xef54('0x3d')]),_0x22200e);if(_0x552c6a[_0xef54('0x35')]['filter']){_0x1b0262['where']=_[_0xef54('0x3e')](_0x1b0262[_0xef54('0x3c')],{'$or':_[_0xef54('0x2e')](_0x22200e,function(_0x37d87e){if(_0x37d87e[_0xef54('0x31')]!==_0xef54('0x3f')){var _0x2f0f26={};_0x2f0f26[_0x37d87e[_0xef54('0x2b')]]={'$like':'%'+_0x552c6a[_0xef54('0x35')][_0xef54('0x40')]+'%'};return _0x2f0f26;}})});}_0x1b0262=_[_0xef54('0x3e')]({},_0x1b0262,_0x552c6a[_0xef54('0x41')]);var _0x360bbf={'where':_0x1b0262[_0xef54('0x3c')]};return db[_0xef54('0x2f')]['count'](_0x360bbf)[_0xef54('0x24')](function(_0x5aea3a){_0x3d0dc0[_0xef54('0x1e')]=_0x5aea3a;if(_0x552c6a[_0xef54('0x35')][_0xef54('0x42')]){_0x1b0262[_0xef54('0x43')]=[{'all':!![]}];}return db[_0xef54('0x2f')][_0xef54('0x44')](_0x1b0262);})['then'](function(_0x286f69){_0x3d0dc0[_0xef54('0x45')]=_0x286f69;return _0x3d0dc0;})['then'](respondWithFilteredResult(_0x243cdb,_0x1b0262))['catch'](handleError(_0x243cdb,null));};exports[_0xef54('0x46')]=function(_0x5f27d8,_0x3c3520){var _0x436cef={'raw':!![],'where':{'id':_0x5f27d8[_0xef54('0x47')]['id']}},_0x24e93b={};_0x24e93b[_0xef54('0x36')]=_['keys'](db[_0xef54('0x2f')][_0xef54('0x30')]);_0x24e93b[_0xef54('0x35')]=_[_0xef54('0x33')](_0x5f27d8['query']);_0x24e93b[_0xef54('0x3d')]=_[_0xef54('0x34')](_0x24e93b[_0xef54('0x36')],_0x24e93b[_0xef54('0x35')]);_0x436cef[_0xef54('0x38')]=_[_0xef54('0x34')](_0x24e93b[_0xef54('0x36')],qs[_0xef54('0x37')](_0x5f27d8['query'][_0xef54('0x37')]));_0x436cef[_0xef54('0x38')]=_0x436cef[_0xef54('0x38')][_0xef54('0x39')]?_0x436cef[_0xef54('0x38')]:_0x24e93b[_0xef54('0x36')];if(_0x5f27d8['query'][_0xef54('0x42')]){_0x436cef[_0xef54('0x43')]=[{'all':!![]}];}_0x436cef=_[_0xef54('0x3e')]({},_0x436cef,_0x5f27d8[_0xef54('0x41')]);return db[_0xef54('0x2f')]['find'](_0x436cef)[_0xef54('0x24')](handleEntityNotFound(_0x3c3520,null))['then'](respondWithResult(_0x3c3520,null))[_0xef54('0x48')](handleError(_0x3c3520,null));};exports['download']=function(_0x5c5117,_0x4935b0,_0xa2533b){return db['Sound']['find']({'where':{'id':_0x5c5117[_0xef54('0x47')]['id']},'attributes':[_0xef54('0x2b'),'save_name',_0xef54('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x4935b0,null))[_0xef54('0x24')](function(_0x52877f){if(_0x52877f){if(!fs[_0xef54('0x4a')](path[_0xef54('0x4b')](config[_0xef54('0x4c')],'server/files/sounds/converted',_0x52877f['save_name']+'.'+_0x52877f[_0xef54('0x49')]))){throw new db[(_0xef54('0x4d'))][(_0xef54('0x4e'))](_0xef54('0x4f'));}return _0x4935b0[_0xef54('0x50')](path[_0xef54('0x4b')](config[_0xef54('0x4c')],'server/files/sounds/converted',util[_0xef54('0x51')](_0xef54('0x52'),_0x52877f[_0xef54('0x53')],_0x52877f[_0xef54('0x49')])),util[_0xef54('0x51')](_0xef54('0x52'),_0x52877f[_0xef54('0x2b')],_0x52877f['converted_format']));}return null;})['catch'](handleError(_0x4935b0,null));};exports[_0xef54('0x54')]=function(_0x1210ee,_0x521d2c,_0x5ba519){var _0x30ea84={'name':path[_0xef54('0x55')](_0x1210ee['file']['originalname'],path[_0xef54('0x56')](_0x1210ee['file']['originalname'])),'save_name':path[_0xef54('0x55')](_0x1210ee[_0xef54('0x57')][_0xef54('0x58')],path[_0xef54('0x56')](_0x1210ee[_0xef54('0x57')][_0xef54('0x58')])),'original_format':path[_0xef54('0x56')](_0x1210ee[_0xef54('0x57')][_0xef54('0x59')])[_0xef54('0x5a')](0x1),'converted_format':'wav'};var _0x5cf7b2=path[_0xef54('0x4b')](config[_0xef54('0x4c')],_0xef54('0x5b'),_0x1210ee[_0xef54('0x57')][_0xef54('0x58')]);var _0x50c1e4=path[_0xef54('0x4b')](config[_0xef54('0x4c')],_0xef54('0x5c'),util[_0xef54('0x51')]('%s.%s',path['basename'](_0x1210ee[_0xef54('0x57')][_0xef54('0x58')],path[_0xef54('0x56')](_0x1210ee[_0xef54('0x57')][_0xef54('0x58')])),_0x30ea84[_0xef54('0x49')]));logger[_0xef54('0x5d')](_0xef54('0x5e'),_0x5cf7b2);logger[_0xef54('0x5d')](_0xef54('0x5f'),_0x50c1e4);try{fs[_0xef54('0x60')](_0x5cf7b2,parseInt(_0xef54('0x61'),0x8));var _0x263cc6=sox[_0xef54('0x62')](_0x5cf7b2,_0x50c1e4,{'sampleRate':0x1f40,'format':_0xef54('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x263cc6['on'](_0xef54('0x29'),function(_0x159633){fs[_0xef54('0x64')](_0x5cf7b2);_0x521d2c[_0xef54('0x1a')](0x1f4)[_0xef54('0x2c')](_0x159633);});_0x263cc6['on'](_0xef54('0x65'),function(_0x545f28){_0x30ea84['original_duration']=isNaN(_0x545f28[_0xef54('0x66')])?null:_0x545f28[_0xef54('0x66')]*0x3e8;_0x30ea84[_0xef54('0x67')]=isNaN(_0x545f28[_0xef54('0x68')])?null:_0x545f28[_0xef54('0x68')];_0x30ea84[_0xef54('0x69')]=isNaN(_0x545f28[_0xef54('0x6a')])?null:_0x545f28[_0xef54('0x6a')];_0x30ea84[_0xef54('0x6b')]=isNaN(_0x545f28[_0xef54('0x6c')])?null:_0x545f28[_0xef54('0x6c')];_0x30ea84[_0xef54('0x6d')]=isNaN(_0x545f28[_0xef54('0x6e')])?null:_0x545f28['sampleRate'];});_0x263cc6['on']('dest',function(_0x197c41){_0x30ea84[_0xef54('0x6f')]=isNaN(_0x197c41[_0xef54('0x66')])?null:_0x197c41[_0xef54('0x66')]*0x3e8;_0x30ea84[_0xef54('0x70')]=isNaN(_0x197c41['sampleCount'])?null:_0x197c41[_0xef54('0x68')];_0x30ea84[_0xef54('0x71')]=isNaN(_0x197c41['channelCount'])?null:_0x197c41['channelCount'];_0x30ea84['converted_bitRate']=isNaN(_0x197c41[_0xef54('0x6c')])?null:_0x197c41[_0xef54('0x6c')];_0x30ea84[_0xef54('0x72')]=isNaN(_0x197c41[_0xef54('0x6e')])?null:_0x197c41[_0xef54('0x6e')];});_0x263cc6['on'](_0xef54('0x1b'),function(){fs[_0xef54('0x60')](_0x50c1e4,parseInt(_0xef54('0x61'),0x8));return db[_0xef54('0x2f')][_0xef54('0x54')](_0x30ea84)['then'](function(_0x258a06){var _0x4d8b93={'role':_0x1210ee[_0xef54('0x73')][_0xef54('0x74')],'userProfileId':_0x1210ee[_0xef54('0x73')][_0xef54('0x75')]};if(!_0x4d8b93)throw new Error(_0xef54('0x76'));if(_0x4d8b93['role']===_0xef54('0x77')){var _0x780f37=_0x258a06[_0xef54('0x26')]({'plain':!![]});return db[_0xef54('0x78')][_0xef54('0x79')]({'where':{'name':'Sounds','userProfileId':_0x4d8b93['userProfileId']},'raw':!![]})[_0xef54('0x24')](function(_0x3a5b6f){if(_0x3a5b6f&&_0x3a5b6f[_0xef54('0x7a')]===0x0){return db[_0xef54('0x28')][_0xef54('0x54')]({'name':_0x780f37[_0xef54('0x2b')],'resourceId':_0x780f37['id'],'type':_0x3a5b6f[_0xef54('0x2b')],'sectionId':_0x3a5b6f['id']},{})[_0xef54('0x24')](function(){return _0x258a06;});}else{return _0x258a06;}})[_0xef54('0x48')](function(_0x5543fe){logger[_0xef54('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5543fe);throw _0x5543fe;});}return _0x258a06;})[_0xef54('0x24')](respondWithResult(_0x521d2c,null))['catch'](handleError(_0x521d2c,null));});_0x263cc6[_0xef54('0x7b')]();}catch(_0x3c8532){_0x521d2c['status'](0x1f4)['send'](_0x3c8532);}};exports[_0xef54('0x23')]=function(_0x3c1c94,_0x114d73,_0x1b4aa6){return db[_0xef54('0x2f')][_0xef54('0x79')]({'where':{'id':_0x3c1c94[_0xef54('0x47')]['id']}})[_0xef54('0x24')](handleEntityNotFound(_0x114d73,null))[_0xef54('0x24')](saveUpdates(_[_0xef54('0x7c')](_0x3c1c94[_0xef54('0x73')],[_0xef54('0x2b'),_0xef54('0x7d')]),null))[_0xef54('0x24')](respondWithResult(_0x114d73,null))[_0xef54('0x48')](handleError(_0x114d73,null));};exports[_0xef54('0x7e')]=function(_0xce272c,_0xdd23b0,_0x4918f4){return db['Sound'][_0xef54('0x79')]({'where':{'id':_0xce272c['params']['id']}})[_0xef54('0x24')](function(_0x1d7f66){if(_0x1d7f66){return _0x1d7f66['destroy']();}})[_0xef54('0x24')](function(_0x202d60){var _0x4ec0b9=path[_0xef54('0x4b')](config[_0xef54('0x4c')],'server/files/sounds/original',util[_0xef54('0x51')](_0xef54('0x52'),_0x202d60['save_name'],_0x202d60[_0xef54('0x7f')]));var _0x3583c2=path[_0xef54('0x4b')](config[_0xef54('0x4c')],'server/files/sounds/converted',util[_0xef54('0x51')](_0xef54('0x52'),_0x202d60['save_name'],_0x202d60['converted_format']));fs[_0xef54('0x64')](_0x4ec0b9);fs['unlinkSync'](_0x3583c2);return _0x202d60;})[_0xef54('0x24')](function(_0x5b43e6){if(_0x5b43e6){return _0xdd23b0[_0xef54('0x1a')](0xcc)[_0xef54('0x1b')]();}})['then'](handleEntityNotFound(_0xdd23b0,null))[_0xef54('0x48')](handleError(_0xdd23b0,null));}; \ No newline at end of file +var _0x4fc8=['index','map','Sound','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','download','params','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','create','file','extname','originalname','basename','filename','substring','wav','server/files/sounds/original','root','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_channelCount','converted_bitRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','start','description','delete','original_format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','end','error','stack','name','send'];(function(_0x38d884,_0xb0c868){var _0x54a884=function(_0x1fd187){while(--_0x1fd187){_0x38d884['push'](_0x38d884['shift']());}};_0x54a884(++_0xb0c868);}(_0x4fc8,0x1c4));var _0x84fc=function(_0x343d0b,_0x13bcb4){_0x343d0b=_0x343d0b-0x0;var _0x45ff39=_0x4fc8[_0x343d0b];return _0x45ff39;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84fc('0x0'));var zipdir=require(_0x84fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84fc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x84fc('0x3'));var util=require(_0x84fc('0x4'));var path=require(_0x84fc('0x5'));var sox=require(_0x84fc('0x6'));var csv=require('to-csv');var ejs=require(_0x84fc('0x7'));var fs=require('fs');var fs_extra=require(_0x84fc('0x8'));var _=require('lodash');var squel=require(_0x84fc('0x9'));var crypto=require(_0x84fc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x84fc('0xb'));var toCsv=require(_0x84fc('0xc'));var querystring=require('querystring');var Papa=require(_0x84fc('0xd'));var Redis=require('ioredis');var authService=require(_0x84fc('0xe'));var qs=require(_0x84fc('0xf'));var as=require(_0x84fc('0x10'));var hardwareService=require(_0x84fc('0x11'));var logger=require(_0x84fc('0x12'))(_0x84fc('0x13'));var utils=require(_0x84fc('0x14'));var config=require(_0x84fc('0x15'));var licenseUtil=require(_0x84fc('0x16'));var db=require(_0x84fc('0x17'))['db'];function respondWithStatusCode(_0x33d6f0,_0x55e1da){_0x55e1da=_0x55e1da||0xcc;return function(_0x2a0325){if(_0x2a0325){return _0x33d6f0['sendStatus'](_0x55e1da);}return _0x33d6f0[_0x84fc('0x18')](_0x55e1da)['end']();};}function respondWithResult(_0x59c20f,_0x2ad5c3){_0x2ad5c3=_0x2ad5c3||0xc8;return function(_0x2031d3){if(_0x2031d3){return _0x59c20f[_0x84fc('0x18')](_0x2ad5c3)['json'](_0x2031d3);}};}function respondWithFilteredResult(_0x55c6ec,_0x84d9e3){return function(_0x2a2620){if(_0x2a2620){var _0x34e37a=typeof _0x84d9e3[_0x84fc('0x19')]===_0x84fc('0x1a')&&typeof _0x84d9e3['limit']===_0x84fc('0x1a');var _0x152291=_0x2a2620[_0x84fc('0x1b')];var _0x34e6b9=_0x34e37a?0x0:_0x84d9e3[_0x84fc('0x19')];var _0x2f17ef=_0x34e37a?_0x2a2620['count']:_0x84d9e3['offset']+_0x84d9e3[_0x84fc('0x1c')];var _0x55deb1;if(_0x2f17ef>=_0x152291){_0x2f17ef=_0x152291;_0x55deb1=0xc8;}else{_0x55deb1=0xce;}_0x55c6ec[_0x84fc('0x18')](_0x55deb1);return _0x55c6ec['set'](_0x84fc('0x1d'),_0x34e6b9+'-'+_0x2f17ef+'/'+_0x152291)[_0x84fc('0x1e')](_0x2a2620);}return null;};}function patchUpdates(_0x2cfc99){return function(_0x4b37e3){try{jsonpatch[_0x84fc('0x1f')](_0x4b37e3,_0x2cfc99,!![]);}catch(_0x383a54){return BPromise[_0x84fc('0x20')](_0x383a54);}return _0x4b37e3[_0x84fc('0x21')]();};}function saveUpdates(_0x4429a4,_0x221240){return function(_0x46536f){if(_0x46536f){return _0x46536f[_0x84fc('0x22')](_0x4429a4)[_0x84fc('0x23')](function(_0x54b7ce){return _0x54b7ce;});}return null;};}function removeEntity(_0x218088,_0x57c676){return function(_0x3fe277){if(_0x3fe277){return _0x3fe277[_0x84fc('0x24')]()[_0x84fc('0x23')](function(){var _0x2aae79=_0x3fe277['get']({'plain':!![]});var _0x2a37bb=_0x84fc('0x25');return db[_0x84fc('0x26')][_0x84fc('0x24')]({'where':{'type':_0x2a37bb,'resourceId':_0x2aae79['id']}})[_0x84fc('0x23')](function(){return _0x3fe277;});})[_0x84fc('0x23')](function(){_0x218088[_0x84fc('0x18')](0xcc)[_0x84fc('0x27')]();});}};}function handleEntityNotFound(_0x1859ce,_0x4c3b90){return function(_0x55f91c){if(!_0x55f91c){_0x1859ce['sendStatus'](0x194);}return _0x55f91c;};}function handleError(_0xa4e518,_0x310c1c){_0x310c1c=_0x310c1c||0x1f4;return function(_0x389f66){logger[_0x84fc('0x28')](_0x389f66[_0x84fc('0x29')]);if(_0x389f66[_0x84fc('0x2a')]){delete _0x389f66[_0x84fc('0x2a')];}_0xa4e518[_0x84fc('0x18')](_0x310c1c)[_0x84fc('0x2b')](_0x389f66);};}exports[_0x84fc('0x2c')]=function(_0x1a23c6,_0xf93a2c){var _0x21b4b0={},_0x5ba219={},_0x1a314d={'count':0x0,'rows':[]};var _0x3987f8=_[_0x84fc('0x2d')](db[_0x84fc('0x2e')][_0x84fc('0x2f')],function(_0x1b26e2){return{'name':_0x1b26e2[_0x84fc('0x30')],'type':_0x1b26e2[_0x84fc('0x31')]['key']};});_0x5ba219[_0x84fc('0x32')]=_[_0x84fc('0x2d')](_0x3987f8,_0x84fc('0x2a'));_0x5ba219[_0x84fc('0x33')]=_[_0x84fc('0x34')](_0x1a23c6[_0x84fc('0x33')]);_0x5ba219['filters']=_['intersection'](_0x5ba219[_0x84fc('0x32')],_0x5ba219['query']);_0x21b4b0[_0x84fc('0x35')]=_[_0x84fc('0x36')](_0x5ba219[_0x84fc('0x32')],qs[_0x84fc('0x37')](_0x1a23c6['query']['fields']));_0x21b4b0[_0x84fc('0x35')]=_0x21b4b0[_0x84fc('0x35')][_0x84fc('0x38')]?_0x21b4b0['attributes']:_0x5ba219[_0x84fc('0x32')];if(!_0x1a23c6[_0x84fc('0x33')][_0x84fc('0x39')]('nolimit')){_0x21b4b0[_0x84fc('0x1c')]=qs['limit'](_0x1a23c6[_0x84fc('0x33')][_0x84fc('0x1c')]);_0x21b4b0[_0x84fc('0x19')]=qs[_0x84fc('0x19')](_0x1a23c6[_0x84fc('0x33')]['offset']);}_0x21b4b0[_0x84fc('0x3a')]=qs[_0x84fc('0x3b')](_0x1a23c6[_0x84fc('0x33')]['sort']);_0x21b4b0[_0x84fc('0x3c')]=qs[_0x84fc('0x3d')](_[_0x84fc('0x3e')](_0x1a23c6['query'],_0x5ba219['filters']),_0x3987f8);if(_0x1a23c6[_0x84fc('0x33')][_0x84fc('0x3f')]){_0x21b4b0['where']=_[_0x84fc('0x40')](_0x21b4b0[_0x84fc('0x3c')],{'$or':_[_0x84fc('0x2d')](_0x3987f8,function(_0x29af75){if(_0x29af75[_0x84fc('0x31')]!==_0x84fc('0x41')){var _0x3b5cba={};_0x3b5cba[_0x29af75[_0x84fc('0x2a')]]={'$like':'%'+_0x1a23c6[_0x84fc('0x33')]['filter']+'%'};return _0x3b5cba;}})});}_0x21b4b0=_[_0x84fc('0x40')]({},_0x21b4b0,_0x1a23c6[_0x84fc('0x42')]);var _0x246338={'where':_0x21b4b0[_0x84fc('0x3c')]};return db['Sound'][_0x84fc('0x1b')](_0x246338)[_0x84fc('0x23')](function(_0x24a704){_0x1a314d[_0x84fc('0x1b')]=_0x24a704;if(_0x1a23c6[_0x84fc('0x33')][_0x84fc('0x43')]){_0x21b4b0[_0x84fc('0x44')]=[{'all':!![]}];}return db[_0x84fc('0x2e')][_0x84fc('0x45')](_0x21b4b0);})['then'](function(_0x2624b6){_0x1a314d[_0x84fc('0x46')]=_0x2624b6;return _0x1a314d;})[_0x84fc('0x23')](respondWithFilteredResult(_0xf93a2c,_0x21b4b0))[_0x84fc('0x47')](handleError(_0xf93a2c,null));};exports['show']=function(_0x17480b,_0x3a1f96){var _0x3e37df={'raw':!![],'where':{'id':_0x17480b['params']['id']}},_0x23a528={};_0x23a528[_0x84fc('0x32')]=_['keys'](db[_0x84fc('0x2e')]['rawAttributes']);_0x23a528[_0x84fc('0x33')]=_[_0x84fc('0x34')](_0x17480b[_0x84fc('0x33')]);_0x23a528[_0x84fc('0x3d')]=_[_0x84fc('0x36')](_0x23a528[_0x84fc('0x32')],_0x23a528[_0x84fc('0x33')]);_0x3e37df[_0x84fc('0x35')]=_[_0x84fc('0x36')](_0x23a528[_0x84fc('0x32')],qs[_0x84fc('0x37')](_0x17480b[_0x84fc('0x33')][_0x84fc('0x37')]));_0x3e37df['attributes']=_0x3e37df[_0x84fc('0x35')][_0x84fc('0x38')]?_0x3e37df[_0x84fc('0x35')]:_0x23a528[_0x84fc('0x32')];if(_0x17480b[_0x84fc('0x33')][_0x84fc('0x43')]){_0x3e37df[_0x84fc('0x44')]=[{'all':!![]}];}_0x3e37df=_['merge']({},_0x3e37df,_0x17480b[_0x84fc('0x42')]);return db[_0x84fc('0x2e')][_0x84fc('0x48')](_0x3e37df)[_0x84fc('0x23')](handleEntityNotFound(_0x3a1f96,null))[_0x84fc('0x23')](respondWithResult(_0x3a1f96,null))[_0x84fc('0x47')](handleError(_0x3a1f96,null));};exports[_0x84fc('0x49')]=function(_0x261c79,_0x5458fb,_0x27dded){return db[_0x84fc('0x2e')]['find']({'where':{'id':_0x261c79[_0x84fc('0x4a')]['id']},'attributes':[_0x84fc('0x2a'),_0x84fc('0x4b'),_0x84fc('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x5458fb,null))[_0x84fc('0x23')](function(_0x38733f){if(_0x38733f){if(!fs[_0x84fc('0x4d')](path[_0x84fc('0x4e')](config['root'],_0x84fc('0x4f'),_0x38733f[_0x84fc('0x4b')]+'.'+_0x38733f[_0x84fc('0x4c')]))){throw new db[(_0x84fc('0x50'))]['ValidationError'](_0x84fc('0x51'));}return _0x5458fb['download'](path[_0x84fc('0x4e')](config['root'],_0x84fc('0x4f'),util[_0x84fc('0x52')]('%s.%s',_0x38733f['save_name'],_0x38733f[_0x84fc('0x4c')])),util[_0x84fc('0x52')]('%s.%s',_0x38733f[_0x84fc('0x2a')],_0x38733f[_0x84fc('0x4c')]));}return null;})[_0x84fc('0x47')](handleError(_0x5458fb,null));};exports[_0x84fc('0x53')]=function(_0xfeedbd,_0x2a3e32,_0x38d3a1){var _0x27ecfe={'name':path['basename'](_0xfeedbd[_0x84fc('0x54')]['originalname'],path[_0x84fc('0x55')](_0xfeedbd[_0x84fc('0x54')][_0x84fc('0x56')])),'save_name':path[_0x84fc('0x57')](_0xfeedbd[_0x84fc('0x54')][_0x84fc('0x58')],path['extname'](_0xfeedbd[_0x84fc('0x54')][_0x84fc('0x58')])),'original_format':path['extname'](_0xfeedbd['file'][_0x84fc('0x56')])[_0x84fc('0x59')](0x1),'converted_format':_0x84fc('0x5a')};var _0x459a64=path[_0x84fc('0x4e')](config['root'],_0x84fc('0x5b'),_0xfeedbd[_0x84fc('0x54')][_0x84fc('0x58')]);var _0x39322c=path[_0x84fc('0x4e')](config[_0x84fc('0x5c')],'server/files/sounds/converted',util[_0x84fc('0x52')](_0x84fc('0x5d'),path[_0x84fc('0x57')](_0xfeedbd[_0x84fc('0x54')][_0x84fc('0x58')],path[_0x84fc('0x55')](_0xfeedbd[_0x84fc('0x54')]['filename'])),_0x27ecfe[_0x84fc('0x4c')]));logger[_0x84fc('0x5e')](_0x84fc('0x5f'),_0x459a64);logger[_0x84fc('0x5e')](_0x84fc('0x60'),_0x39322c);try{fs[_0x84fc('0x61')](_0x459a64,parseInt('0777',0x8));var _0x14d50e=sox[_0x84fc('0x62')](_0x459a64,_0x39322c,{'sampleRate':0x1f40,'format':_0x84fc('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x14d50e['on'](_0x84fc('0x28'),function(_0x34f49e){fs[_0x84fc('0x63')](_0x459a64);_0x2a3e32['status'](0x1f4)[_0x84fc('0x2b')](_0x34f49e);});_0x14d50e['on'](_0x84fc('0x64'),function(_0x584ee5){_0x27ecfe[_0x84fc('0x65')]=isNaN(_0x584ee5[_0x84fc('0x66')])?null:_0x584ee5[_0x84fc('0x66')]*0x3e8;_0x27ecfe['original_sampleCount']=isNaN(_0x584ee5[_0x84fc('0x67')])?null:_0x584ee5[_0x84fc('0x67')];_0x27ecfe[_0x84fc('0x68')]=isNaN(_0x584ee5['channelCount'])?null:_0x584ee5[_0x84fc('0x69')];_0x27ecfe[_0x84fc('0x6a')]=isNaN(_0x584ee5[_0x84fc('0x6b')])?null:_0x584ee5['bitRate'];_0x27ecfe['original_sampleRate']=isNaN(_0x584ee5[_0x84fc('0x6c')])?null:_0x584ee5[_0x84fc('0x6c')];});_0x14d50e['on'](_0x84fc('0x6d'),function(_0x65a2d){_0x27ecfe['converted_duration']=isNaN(_0x65a2d[_0x84fc('0x66')])?null:_0x65a2d[_0x84fc('0x66')]*0x3e8;_0x27ecfe['converted_sampleCount']=isNaN(_0x65a2d[_0x84fc('0x67')])?null:_0x65a2d[_0x84fc('0x67')];_0x27ecfe[_0x84fc('0x6e')]=isNaN(_0x65a2d[_0x84fc('0x69')])?null:_0x65a2d[_0x84fc('0x69')];_0x27ecfe[_0x84fc('0x6f')]=isNaN(_0x65a2d[_0x84fc('0x6b')])?null:_0x65a2d['bitRate'];_0x27ecfe['converted_sampleRate']=isNaN(_0x65a2d[_0x84fc('0x6c')])?null:_0x65a2d[_0x84fc('0x6c')];});_0x14d50e['on'](_0x84fc('0x27'),function(){fs['chmodSync'](_0x39322c,parseInt('0777',0x8));return db[_0x84fc('0x2e')][_0x84fc('0x53')](_0x27ecfe)[_0x84fc('0x23')](function(_0x34fc02){var _0x183737={'role':_0xfeedbd[_0x84fc('0x70')]['role'],'userProfileId':_0xfeedbd[_0x84fc('0x70')][_0x84fc('0x71')]};if(!_0x183737)throw new Error(_0x84fc('0x72'));if(_0x183737[_0x84fc('0x73')]===_0x84fc('0x74')){var _0x4a56e9=_0x34fc02[_0x84fc('0x75')]({'plain':!![]});return db[_0x84fc('0x76')][_0x84fc('0x48')]({'where':{'name':_0x84fc('0x25'),'userProfileId':_0x183737[_0x84fc('0x71')]},'raw':!![]})['then'](function(_0x2fb06e){if(_0x2fb06e&&_0x2fb06e[_0x84fc('0x77')]===0x0){return db[_0x84fc('0x26')][_0x84fc('0x53')]({'name':_0x4a56e9[_0x84fc('0x2a')],'resourceId':_0x4a56e9['id'],'type':_0x2fb06e['name'],'sectionId':_0x2fb06e['id']},{})[_0x84fc('0x23')](function(){return _0x34fc02;});}else{return _0x34fc02;}})['catch'](function(_0x338514){logger[_0x84fc('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x338514);throw _0x338514;});}return _0x34fc02;})[_0x84fc('0x23')](respondWithResult(_0x2a3e32,null))[_0x84fc('0x47')](handleError(_0x2a3e32,null));});_0x14d50e[_0x84fc('0x78')]();}catch(_0x5697a8){_0x2a3e32[_0x84fc('0x18')](0x1f4)[_0x84fc('0x2b')](_0x5697a8);}};exports[_0x84fc('0x22')]=function(_0x33e8ec,_0x5abb7d,_0x486eca){return db[_0x84fc('0x2e')][_0x84fc('0x48')]({'where':{'id':_0x33e8ec[_0x84fc('0x4a')]['id']}})[_0x84fc('0x23')](handleEntityNotFound(_0x5abb7d,null))['then'](saveUpdates(_['pick'](_0x33e8ec[_0x84fc('0x70')],[_0x84fc('0x2a'),_0x84fc('0x79')]),null))['then'](respondWithResult(_0x5abb7d,null))[_0x84fc('0x47')](handleError(_0x5abb7d,null));};exports[_0x84fc('0x7a')]=function(_0xe22f6d,_0xc3c262,_0x116b5a){return db['Sound'][_0x84fc('0x48')]({'where':{'id':_0xe22f6d[_0x84fc('0x4a')]['id']}})[_0x84fc('0x23')](function(_0x34985a){if(_0x34985a){return _0x34985a[_0x84fc('0x24')]();}})[_0x84fc('0x23')](function(_0x4778e3){var _0x1f8365=path[_0x84fc('0x4e')](config[_0x84fc('0x5c')],_0x84fc('0x5b'),util[_0x84fc('0x52')](_0x84fc('0x5d'),_0x4778e3[_0x84fc('0x4b')],_0x4778e3[_0x84fc('0x7b')]));var _0x3fb8b8=path[_0x84fc('0x4e')](config['root'],'server/files/sounds/converted',util['format'](_0x84fc('0x5d'),_0x4778e3[_0x84fc('0x4b')],_0x4778e3[_0x84fc('0x4c')]));fs[_0x84fc('0x63')](_0x1f8365);fs[_0x84fc('0x63')](_0x3fb8b8);return _0x4778e3;})[_0x84fc('0x23')](function(_0x547cbb){if(_0x547cbb){return _0xc3c262[_0x84fc('0x18')](0xcc)[_0x84fc('0x27')]();}})[_0x84fc('0x23')](handleEntityNotFound(_0xc3c262,null))[_0x84fc('0x47')](handleError(_0xc3c262,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ef8ad69..e05276d 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 _0x0d23=['lodash','api','request-promise','path','../../config/environment','./sound.attributes','exports','Sound','tools_sounds'];(function(_0x5d1d99,_0x10ca23){var _0x2957ec=function(_0x4f4ba){while(--_0x4f4ba){_0x5d1d99['push'](_0x5d1d99['shift']());}};_0x2957ec(++_0x10ca23);}(_0x0d23,0x17a));var _0x30d2=function(_0x20810e,_0x2066b7){_0x20810e=_0x20810e-0x0;var _0x2a9956=_0x0d23[_0x20810e];return _0x2a9956;};'use strict';var _=require(_0x30d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x30d2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x30d2('0x2'));var fs=require('fs');var path=require(_0x30d2('0x3'));var rimraf=require('rimraf');var config=require(_0x30d2('0x4'));var attributes=require(_0x30d2('0x5'));module[_0x30d2('0x6')]=function(_0x4a4a0b,_0x41ffb6){return _0x4a4a0b['define'](_0x30d2('0x7'),attributes,{'tableName':_0x30d2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c52=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','define'];(function(_0x5bade8,_0x30f2d0){var _0x9037df=function(_0x3a60be){while(--_0x3a60be){_0x5bade8['push'](_0x5bade8['shift']());}};_0x9037df(++_0x30f2d0);}(_0x4c52,0x1c2));var _0x24c5=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4c52[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x24c5('0x0'));var util=require(_0x24c5('0x1'));var logger=require(_0x24c5('0x2'))(_0x24c5('0x3'));var moment=require(_0x24c5('0x4'));var BPromise=require(_0x24c5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x24c5('0x6'));var attributes=require('./sound.attributes');module[_0x24c5('0x7')]=function(_0x5b5885,_0x31e04c){return _0x5b5885[_0x24c5('0x8')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 6dc3245..ed573b5 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 _0x7950=['where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw'];(function(_0x45ea79,_0x3b4a7a){var _0x3bc5e5=function(_0x5132f6){while(--_0x5132f6){_0x45ea79['push'](_0x45ea79['shift']());}};_0x3bc5e5(++_0x3b4a7a);}(_0x7950,0xa5));var _0x0795=function(_0x2e7539,_0x44bc4f){_0x2e7539=_0x2e7539-0x0;var _0x2ad4c7=_0x7950[_0x2e7539];return _0x2ad4c7;};'use strict';var _=require(_0x0795('0x0'));var util=require(_0x0795('0x1'));var moment=require('moment');var BPromise=require(_0x0795('0x2'));var rs=require(_0x0795('0x3'));var fs=require('fs');var Redis=require(_0x0795('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0795('0x5'));var logger=require(_0x0795('0x6'))(_0x0795('0x7'));var config=require(_0x0795('0x8'));var jayson=require(_0x0795('0x9'));var client=jayson['client'][_0x0795('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26f81f,_0x397148,_0x1e4967){return new BPromise(function(_0x4e2113,_0x3c454f){return client[_0x0795('0xb')](_0x26f81f,_0x1e4967)[_0x0795('0xc')](function(_0x15dd7d){logger[_0x0795('0xd')](_0x0795('0xe'),_0x397148,'request\x20sent');logger[_0x0795('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x397148,_0x0795('0x10'),JSON[_0x0795('0x11')](_0x15dd7d));if(_0x15dd7d[_0x0795('0x12')]){if(_0x15dd7d[_0x0795('0x12')][_0x0795('0x13')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x397148,_0x15dd7d[_0x0795('0x12')][_0x0795('0x14')]);return _0x3c454f(_0x15dd7d[_0x0795('0x12')][_0x0795('0x14')]);}logger['error'](_0x0795('0xe'),_0x397148,_0x15dd7d[_0x0795('0x12')][_0x0795('0x14')]);return _0x4e2113(_0x15dd7d[_0x0795('0x12')][_0x0795('0x14')]);}else{logger['info'](_0x0795('0xe'),_0x397148,_0x0795('0x10'));_0x4e2113(_0x15dd7d[_0x0795('0x15')][_0x0795('0x14')]);}})[_0x0795('0x16')](function(_0x2adcbd){logger['error'](_0x0795('0xe'),_0x397148,_0x2adcbd);_0x3c454f(_0x2adcbd);});});}exports[_0x0795('0x17')]=function(_0x4c19c3){var _0x13763e=this;return new Promise(function(_0x2784d1,_0x497f5d){return db[_0x0795('0x18')]['find']({'raw':_0x4c19c3[_0x0795('0x19')]?_0x4c19c3[_0x0795('0x19')][_0x0795('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c19c3[_0x0795('0x19')]?_0x4c19c3[_0x0795('0x19')][_0x0795('0x1b')]||null:null,'attributes':_0x4c19c3[_0x0795('0x19')]?_0x4c19c3[_0x0795('0x19')][_0x0795('0x1c')]||null:null,'include':_0x4c19c3[_0x0795('0x19')]?_0x4c19c3[_0x0795('0x19')][_0x0795('0x1d')]?_[_0x0795('0x1e')](_0x4c19c3[_0x0795('0x19')][_0x0795('0x1d')],function(_0x4257d0){return{'model':db[_0x4257d0[_0x0795('0x1f')]],'as':_0x4257d0['as'],'attributes':_0x4257d0['attributes'],'include':_0x4257d0[_0x0795('0x1d')]?_[_0x0795('0x1e')](_0x4257d0[_0x0795('0x1d')],function(_0x3eac3a){return{'model':db[_0x3eac3a['model']],'as':_0x3eac3a['as'],'attributes':_0x3eac3a[_0x0795('0x1c')],'include':_0x3eac3a[_0x0795('0x1d')]?_['map'](_0x3eac3a[_0x0795('0x1d')],function(_0x44f306){return{'model':db[_0x44f306[_0x0795('0x1f')]],'as':_0x44f306['as'],'attributes':_0x44f306[_0x0795('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0795('0xc')](function(_0x37c3df){logger['info'](_0x0795('0x17'),_0x4c19c3);logger['debug']('ShowSound',_0x4c19c3,JSON[_0x0795('0x11')](_0x37c3df));_0x2784d1(_0x37c3df);})[_0x0795('0x16')](function(_0x143d6c){logger['error']('ShowSound',_0x143d6c[_0x0795('0x14')],_0x4c19c3);_0x497f5d(_0x13763e[_0x0795('0x12')](0x1f4,_0x143d6c[_0x0795('0x14')]));});});}; \ No newline at end of file +var _0xecdf=['error','code','Sound,\x20%s,\x20%s','message','request\x20sent','result','catch','ShowSound','Sound','options','raw','attributes','map','include','model','lodash','moment','bluebird','randomstring','../../mysqldb','client','http','request','then','info','debug','stringify'];(function(_0x1326b2,_0x574ba0){var _0x17b0df=function(_0x26551a){while(--_0x26551a){_0x1326b2['push'](_0x1326b2['shift']());}};_0x17b0df(++_0x574ba0);}(_0xecdf,0x153));var _0xfecd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xecdf[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfecd('0x0'));var util=require('util');var moment=require(_0xfecd('0x1'));var BPromise=require(_0xfecd('0x2'));var rs=require(_0xfecd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfecd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfecd('0x5')][_0xfecd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x156d4f,_0x437dc6,_0x213c87){return new BPromise(function(_0x10218a,_0x42e37d){return client[_0xfecd('0x7')](_0x156d4f,_0x213c87)[_0xfecd('0x8')](function(_0x318b3f){logger[_0xfecd('0x9')]('Sound,\x20%s,\x20%s',_0x437dc6,'request\x20sent');logger[_0xfecd('0xa')]('Sound,\x20%s,\x20%s,\x20%s',_0x437dc6,'request\x20sent',JSON[_0xfecd('0xb')](_0x318b3f));if(_0x318b3f[_0xfecd('0xc')]){if(_0x318b3f[_0xfecd('0xc')][_0xfecd('0xd')]===0x1f4){logger[_0xfecd('0xc')](_0xfecd('0xe'),_0x437dc6,_0x318b3f[_0xfecd('0xc')][_0xfecd('0xf')]);return _0x42e37d(_0x318b3f[_0xfecd('0xc')]['message']);}logger['error'](_0xfecd('0xe'),_0x437dc6,_0x318b3f[_0xfecd('0xc')][_0xfecd('0xf')]);return _0x10218a(_0x318b3f[_0xfecd('0xc')]['message']);}else{logger[_0xfecd('0x9')]('Sound,\x20%s,\x20%s',_0x437dc6,_0xfecd('0x10'));_0x10218a(_0x318b3f[_0xfecd('0x11')][_0xfecd('0xf')]);}})[_0xfecd('0x12')](function(_0x392a1e){logger[_0xfecd('0xc')]('Sound,\x20%s,\x20%s',_0x437dc6,_0x392a1e);_0x42e37d(_0x392a1e);});});}exports[_0xfecd('0x13')]=function(_0x10c7dc){var _0x29bd7c=this;return new Promise(function(_0x5497dc,_0x43259c){return db[_0xfecd('0x14')]['find']({'raw':_0x10c7dc[_0xfecd('0x15')]?_0x10c7dc['options'][_0xfecd('0x16')]===undefined?!![]:![]:!![],'where':_0x10c7dc[_0xfecd('0x15')]?_0x10c7dc['options']['where']||null:null,'attributes':_0x10c7dc['options']?_0x10c7dc['options'][_0xfecd('0x17')]||null:null,'include':_0x10c7dc[_0xfecd('0x15')]?_0x10c7dc[_0xfecd('0x15')]['include']?_[_0xfecd('0x18')](_0x10c7dc['options'][_0xfecd('0x19')],function(_0x5cc3d4){return{'model':db[_0x5cc3d4['model']],'as':_0x5cc3d4['as'],'attributes':_0x5cc3d4['attributes'],'include':_0x5cc3d4[_0xfecd('0x19')]?_[_0xfecd('0x18')](_0x5cc3d4[_0xfecd('0x19')],function(_0x216401){return{'model':db[_0x216401[_0xfecd('0x1a')]],'as':_0x216401['as'],'attributes':_0x216401['attributes'],'include':_0x216401[_0xfecd('0x19')]?_[_0xfecd('0x18')](_0x216401[_0xfecd('0x19')],function(_0x59bdcc){return{'model':db[_0x59bdcc[_0xfecd('0x1a')]],'as':_0x59bdcc['as'],'attributes':_0x59bdcc[_0xfecd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfecd('0x8')](function(_0x2a32f9){logger[_0xfecd('0x9')](_0xfecd('0x13'),_0x10c7dc);logger[_0xfecd('0xa')](_0xfecd('0x13'),_0x10c7dc,JSON[_0xfecd('0xb')](_0x2a32f9));_0x5497dc(_0x2a32f9);})['catch'](function(_0x231404){logger[_0xfecd('0xc')](_0xfecd('0x13'),_0x231404[_0xfecd('0xf')],_0x10c7dc);_0x43259c(_0x29bd7c['error'](0x1f4,_0x231404[_0xfecd('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b016a47..eb93e61 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x4f8b8a,_0x1ceb03){var _0x2b3129=function(_0x54a2f3){while(--_0x54a2f3){_0x4f8b8a['push'](_0x4f8b8a['shift']());}};_0x2b3129(++_0x1ceb03);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xb7e7[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x1c6664,_0x45566e){var _0x33124b=function(_0x2c04bb){while(--_0x2c04bb){_0x1c6664['push'](_0x1c6664['shift']());}};_0x33124b(++_0x45566e);}(_0x2032,0xd9));var _0x2203=function(_0x1d8e05,_0x1a662b){_0x1d8e05=_0x1d8e05-0x0;var _0x37e05b=_0x2032[_0x1d8e05];return _0x37e05b;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 186c68e..16404c3 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 _0xc634=['sequelize','exports','STRING','medium','ENUM','out','TEXT'];(function(_0x1223f9,_0x4c972f){var _0x2c1617=function(_0x6e1d86){while(--_0x6e1d86){_0x1223f9['push'](_0x1223f9['shift']());}};_0x2c1617(++_0x4c972f);}(_0xc634,0x173));var _0x4c63=function(_0x27f569,_0x11892a){_0x27f569=_0x27f569-0x0;var _0x3774c4=_0xc634[_0x27f569];return _0x3774c4;};'use strict';var Sequelize=require(_0x4c63('0x0'));module[_0x4c63('0x1')]={'uniqueid':{'type':Sequelize[_0x4c63('0x2')]},'body':{'type':Sequelize['TEXT'](_0x4c63('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x4c63('0x4')]('in',_0x4c63('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x4c63('0x2')]},'providerResponse':{'type':Sequelize[_0x4c63('0x6')]}}; \ No newline at end of file +var _0xa1fe=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x1bda29,_0x4d300f){var _0x706cc1=function(_0x12964c){while(--_0x12964c){_0x1bda29['push'](_0x1bda29['shift']());}};_0x706cc1(++_0x4d300f);}(_0xa1fe,0x1e7));var _0xea1f=function(_0x526dc2,_0x37ebb8){_0x526dc2=_0x526dc2-0x0;var _0x54e521=_0xa1fe[_0x526dc2];return _0x54e521;};'use strict';var Sequelize=require(_0xea1f('0x0'));module[_0xea1f('0x1')]={'uniqueid':{'type':Sequelize[_0xea1f('0x2')]},'body':{'type':Sequelize[_0xea1f('0x3')](_0xea1f('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xea1f('0x5')]('in',_0xea1f('0x6')),'defaultValue':_0xea1f('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xea1f('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6ecb685..cb78573 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 _0x58b6=['count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','SquareMessage','rawAttributes','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','params','intersection','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','limit'];(function(_0x3bb866,_0xba7019){var _0x2e7e75=function(_0x12425e){while(--_0x12425e){_0x3bb866['push'](_0x3bb866['shift']());}};_0x2e7e75(++_0xba7019);}(_0x58b6,0x103));var _0x658b=function(_0x17a6f5,_0x7a37f4){_0x17a6f5=_0x17a6f5-0x0;var _0x3aaf2e=_0x58b6[_0x17a6f5];return _0x3aaf2e;};'use strict';var emlformat=require(_0x658b('0x0'));var rimraf=require(_0x658b('0x1'));var zipdir=require(_0x658b('0x2'));var jsonpatch=require(_0x658b('0x3'));var rp=require(_0x658b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x658b('0x5'));var util=require(_0x658b('0x6'));var path=require(_0x658b('0x7'));var sox=require('sox');var csv=require(_0x658b('0x8'));var ejs=require(_0x658b('0x9'));var fs=require('fs');var fs_extra=require(_0x658b('0xa'));var _=require(_0x658b('0xb'));var squel=require(_0x658b('0xc'));var crypto=require(_0x658b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x658b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x658b('0xf'));var Papa=require(_0x658b('0x10'));var Redis=require('ioredis');var authService=require(_0x658b('0x11'));var qs=require(_0x658b('0x12'));var as=require(_0x658b('0x13'));var hardwareService=require(_0x658b('0x14'));var logger=require(_0x658b('0x15'))('api');var utils=require(_0x658b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x658b('0x17'))['db'];function respondWithStatusCode(_0xc4e081,_0x2301b0){_0x2301b0=_0x2301b0||0xcc;return function(_0x42372f){if(_0x42372f){return _0xc4e081['sendStatus'](_0x2301b0);}return _0xc4e081[_0x658b('0x18')](_0x2301b0)[_0x658b('0x19')]();};}function respondWithResult(_0x21a161,_0x24823e){_0x24823e=_0x24823e||0xc8;return function(_0x1c6a97){if(_0x1c6a97){return _0x21a161[_0x658b('0x18')](_0x24823e)[_0x658b('0x1a')](_0x1c6a97);}};}function respondWithFilteredResult(_0x52924a,_0x533e54){return function(_0x4a7f52){if(_0x4a7f52){var _0x2cb592=typeof _0x533e54['offset']===_0x658b('0x1b')&&typeof _0x533e54[_0x658b('0x1c')]===_0x658b('0x1b');var _0x40cf14=_0x4a7f52[_0x658b('0x1d')];var _0x264379=_0x2cb592?0x0:_0x533e54[_0x658b('0x1e')];var _0x5e54cd=_0x2cb592?_0x4a7f52[_0x658b('0x1d')]:_0x533e54[_0x658b('0x1e')]+_0x533e54['limit'];var _0x14ed73;if(_0x5e54cd>=_0x40cf14){_0x5e54cd=_0x40cf14;_0x14ed73=0xc8;}else{_0x14ed73=0xce;}_0x52924a[_0x658b('0x18')](_0x14ed73);return _0x52924a[_0x658b('0x1f')](_0x658b('0x20'),_0x264379+'-'+_0x5e54cd+'/'+_0x40cf14)[_0x658b('0x1a')](_0x4a7f52);}return null;};}function patchUpdates(_0x5a032e){return function(_0x192915){try{jsonpatch[_0x658b('0x21')](_0x192915,_0x5a032e,!![]);}catch(_0xfbd9b2){return BPromise[_0x658b('0x22')](_0xfbd9b2);}return _0x192915[_0x658b('0x23')]();};}function saveUpdates(_0x5dd711,_0x2b226e){return function(_0x3467ab){if(_0x3467ab){return _0x3467ab[_0x658b('0x24')](_0x5dd711)[_0x658b('0x25')](function(_0xde977f){return _0xde977f;});}return null;};}function removeEntity(_0x135586,_0x369624){return function(_0x1a66be){if(_0x1a66be){return _0x1a66be['destroy']()[_0x658b('0x25')](function(){_0x135586[_0x658b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3688,_0x3bcf89){return function(_0x107382){if(!_0x107382){_0x2b3688['sendStatus'](0x194);}return _0x107382;};}function handleError(_0x4e6184,_0x6d7a24){_0x6d7a24=_0x6d7a24||0x1f4;return function(_0x3e8192){logger[_0x658b('0x26')](_0x3e8192[_0x658b('0x27')]);if(_0x3e8192[_0x658b('0x28')]){delete _0x3e8192[_0x658b('0x28')];}_0x4e6184[_0x658b('0x18')](_0x6d7a24)['send'](_0x3e8192);};}exports[_0x658b('0x29')]=function(_0x27ed60,_0x2d6caa){var _0x2d2fd1={},_0x40ec6f={},_0x1380e6={'count':0x0,'rows':[]};var _0xb49bf6=_['map'](db[_0x658b('0x2a')][_0x658b('0x2b')],function(_0x1dd61e){return{'name':_0x1dd61e['fieldName'],'type':_0x1dd61e[_0x658b('0x2c')]['key']};});_0x40ec6f['model']=_['map'](_0xb49bf6,_0x658b('0x28'));_0x40ec6f[_0x658b('0x2d')]=_[_0x658b('0x2e')](_0x27ed60[_0x658b('0x2d')]);_0x40ec6f[_0x658b('0x2f')]=_['intersection'](_0x40ec6f[_0x658b('0x30')],_0x40ec6f[_0x658b('0x2d')]);_0x2d2fd1[_0x658b('0x31')]=_['intersection'](_0x40ec6f['model'],qs[_0x658b('0x32')](_0x27ed60[_0x658b('0x2d')]['fields']));_0x2d2fd1[_0x658b('0x31')]=_0x2d2fd1[_0x658b('0x31')][_0x658b('0x33')]?_0x2d2fd1[_0x658b('0x31')]:_0x40ec6f['model'];if(!_0x27ed60['query'][_0x658b('0x34')]('nolimit')){_0x2d2fd1[_0x658b('0x1c')]=qs[_0x658b('0x1c')](_0x27ed60[_0x658b('0x2d')]['limit']);_0x2d2fd1[_0x658b('0x1e')]=qs['offset'](_0x27ed60[_0x658b('0x2d')][_0x658b('0x1e')]);}_0x2d2fd1['order']=qs[_0x658b('0x35')](_0x27ed60['query'][_0x658b('0x35')]);_0x2d2fd1[_0x658b('0x36')]=qs[_0x658b('0x2f')](_[_0x658b('0x37')](_0x27ed60['query'],_0x40ec6f[_0x658b('0x2f')]),_0xb49bf6);if(_0x27ed60['query'][_0x658b('0x38')]){_0x2d2fd1[_0x658b('0x36')]=_[_0x658b('0x39')](_0x2d2fd1[_0x658b('0x36')],{'$or':_[_0x658b('0x3a')](_0xb49bf6,function(_0x41345a){if(_0x41345a[_0x658b('0x2c')]!==_0x658b('0x3b')){var _0x19563b={};_0x19563b[_0x41345a[_0x658b('0x28')]]={'$like':'%'+_0x27ed60[_0x658b('0x2d')]['filter']+'%'};return _0x19563b;}})});}_0x2d2fd1=_[_0x658b('0x39')]({},_0x2d2fd1,_0x27ed60[_0x658b('0x3c')]);var _0x2f1fef={'where':_0x2d2fd1[_0x658b('0x36')]};return db[_0x658b('0x2a')][_0x658b('0x1d')](_0x2f1fef)[_0x658b('0x25')](function(_0x40f193){_0x1380e6['count']=_0x40f193;if(_0x27ed60[_0x658b('0x2d')][_0x658b('0x3d')]){_0x2d2fd1['include']=[{'all':!![]}];}return db[_0x658b('0x2a')][_0x658b('0x3e')](_0x2d2fd1);})[_0x658b('0x25')](function(_0x1c14e3){_0x1380e6['rows']=_0x1c14e3;return _0x1380e6;})[_0x658b('0x25')](respondWithFilteredResult(_0x2d6caa,_0x2d2fd1))[_0x658b('0x3f')](handleError(_0x2d6caa,null));};exports[_0x658b('0x40')]=function(_0x4d4a0f,_0x10d8c7){var _0x2059fe={'raw':!![],'where':{'id':_0x4d4a0f[_0x658b('0x41')]['id']}},_0x2b3e86={};_0x2b3e86[_0x658b('0x30')]=_[_0x658b('0x2e')](db['SquareMessage'][_0x658b('0x2b')]);_0x2b3e86[_0x658b('0x2d')]=_['keys'](_0x4d4a0f['query']);_0x2b3e86['filters']=_[_0x658b('0x42')](_0x2b3e86[_0x658b('0x30')],_0x2b3e86[_0x658b('0x2d')]);_0x2059fe[_0x658b('0x31')]=_[_0x658b('0x42')](_0x2b3e86[_0x658b('0x30')],qs[_0x658b('0x32')](_0x4d4a0f['query'][_0x658b('0x32')]));_0x2059fe[_0x658b('0x31')]=_0x2059fe[_0x658b('0x31')][_0x658b('0x33')]?_0x2059fe[_0x658b('0x31')]:_0x2b3e86[_0x658b('0x30')];if(_0x4d4a0f[_0x658b('0x2d')]['includeAll']){_0x2059fe[_0x658b('0x43')]=[{'all':!![]}];}_0x2059fe=_[_0x658b('0x39')]({},_0x2059fe,_0x4d4a0f['options']);return db[_0x658b('0x2a')][_0x658b('0x44')](_0x2059fe)[_0x658b('0x25')](handleEntityNotFound(_0x10d8c7,null))[_0x658b('0x25')](respondWithResult(_0x10d8c7,null))[_0x658b('0x3f')](handleError(_0x10d8c7,null));};exports[_0x658b('0x45')]=function(_0x3ebf5f,_0x272e07){return db[_0x658b('0x2a')][_0x658b('0x45')](_0x3ebf5f[_0x658b('0x46')],{})['then'](respondWithResult(_0x272e07,0xc9))[_0x658b('0x3f')](handleError(_0x272e07,null));};exports[_0x658b('0x24')]=function(_0x1eec69,_0x5f5dc4){if(_0x1eec69['body']['id']){delete _0x1eec69[_0x658b('0x46')]['id'];}return db['SquareMessage'][_0x658b('0x44')]({'where':{'id':_0x1eec69['params']['id']}})[_0x658b('0x25')](handleEntityNotFound(_0x5f5dc4,null))[_0x658b('0x25')](saveUpdates(_0x1eec69['body'],null))['then'](respondWithResult(_0x5f5dc4,null))[_0x658b('0x3f')](handleError(_0x5f5dc4,null));};exports[_0x658b('0x47')]=function(_0x398a6c,_0x169698){return db[_0x658b('0x2a')]['find']({'where':{'id':_0x398a6c[_0x658b('0x41')]['id']}})[_0x658b('0x25')](handleEntityNotFound(_0x169698,null))[_0x658b('0x25')](removeEntity(_0x169698,null))[_0x658b('0x3f')](handleError(_0x169698,null));}; \ No newline at end of file +var _0xd719=['limit','count','offset','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareMessage','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','end','undefined'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0xd719,0xb8));var _0x9d71=function(_0x334809,_0x746716){_0x334809=_0x334809-0x0;var _0x5793e0=_0xd719[_0x334809];return _0x5793e0;};'use strict';var emlformat=require(_0x9d71('0x0'));var rimraf=require(_0x9d71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d71('0x2'));var rp=require('request-promise');var moment=require(_0x9d71('0x3'));var BPromise=require(_0x9d71('0x4'));var Mustache=require(_0x9d71('0x5'));var util=require('util');var path=require(_0x9d71('0x6'));var sox=require(_0x9d71('0x7'));var csv=require(_0x9d71('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d71('0x9'));var _=require(_0x9d71('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9d71('0xb'));var toCsv=require(_0x9d71('0x8'));var querystring=require(_0x9d71('0xc'));var Papa=require(_0x9d71('0xd'));var Redis=require('ioredis');var authService=require(_0x9d71('0xe'));var qs=require(_0x9d71('0xf'));var as=require(_0x9d71('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d71('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9d71('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce923,_0x321781){_0x321781=_0x321781||0xcc;return function(_0x5eb384){if(_0x5eb384){return _0x5ce923[_0x9d71('0x13')](_0x321781);}return _0x5ce923[_0x9d71('0x14')](_0x321781)[_0x9d71('0x15')]();};}function respondWithResult(_0x524418,_0x4b815f){_0x4b815f=_0x4b815f||0xc8;return function(_0x559494){if(_0x559494){return _0x524418['status'](_0x4b815f)['json'](_0x559494);}};}function respondWithFilteredResult(_0x335939,_0x26db99){return function(_0x138683){if(_0x138683){var _0x287825=typeof _0x26db99['offset']===_0x9d71('0x16')&&typeof _0x26db99[_0x9d71('0x17')]==='undefined';var _0x14a8cc=_0x138683[_0x9d71('0x18')];var _0x3d66b6=_0x287825?0x0:_0x26db99[_0x9d71('0x19')];var _0x132f15=_0x287825?_0x138683[_0x9d71('0x18')]:_0x26db99[_0x9d71('0x19')]+_0x26db99[_0x9d71('0x17')];var _0x427c11;if(_0x132f15>=_0x14a8cc){_0x132f15=_0x14a8cc;_0x427c11=0xc8;}else{_0x427c11=0xce;}_0x335939[_0x9d71('0x14')](_0x427c11);return _0x335939['set'](_0x9d71('0x1a'),_0x3d66b6+'-'+_0x132f15+'/'+_0x14a8cc)[_0x9d71('0x1b')](_0x138683);}return null;};}function patchUpdates(_0x265a9c){return function(_0x3e353b){try{jsonpatch['apply'](_0x3e353b,_0x265a9c,!![]);}catch(_0x5548b8){return BPromise[_0x9d71('0x1c')](_0x5548b8);}return _0x3e353b['save']();};}function saveUpdates(_0x362beb,_0x19fca4){return function(_0x4d46ac){if(_0x4d46ac){return _0x4d46ac[_0x9d71('0x1d')](_0x362beb)[_0x9d71('0x1e')](function(_0x2e7c8f){return _0x2e7c8f;});}return null;};}function removeEntity(_0x5c981b,_0x437688){return function(_0x51a6be){if(_0x51a6be){return _0x51a6be[_0x9d71('0x1f')]()[_0x9d71('0x1e')](function(){_0x5c981b[_0x9d71('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb7a4ff,_0x46f3a1){return function(_0x45ae79){if(!_0x45ae79){_0xb7a4ff[_0x9d71('0x13')](0x194);}return _0x45ae79;};}function handleError(_0x28c6a5,_0x165db0){_0x165db0=_0x165db0||0x1f4;return function(_0x143333){logger[_0x9d71('0x20')](_0x143333[_0x9d71('0x21')]);if(_0x143333['name']){delete _0x143333[_0x9d71('0x22')];}_0x28c6a5[_0x9d71('0x14')](_0x165db0)[_0x9d71('0x23')](_0x143333);};}exports[_0x9d71('0x24')]=function(_0x1ebe4a,_0x2870e4){var _0x1b29a1={},_0x487383={},_0x5d17dd={'count':0x0,'rows':[]};var _0x118a0e=_[_0x9d71('0x25')](db['SquareMessage'][_0x9d71('0x26')],function(_0x5bde61){return{'name':_0x5bde61[_0x9d71('0x27')],'type':_0x5bde61[_0x9d71('0x28')][_0x9d71('0x29')]};});_0x487383[_0x9d71('0x2a')]=_['map'](_0x118a0e,_0x9d71('0x22'));_0x487383[_0x9d71('0x2b')]=_['keys'](_0x1ebe4a[_0x9d71('0x2b')]);_0x487383[_0x9d71('0x2c')]=_['intersection'](_0x487383['model'],_0x487383['query']);_0x1b29a1[_0x9d71('0x2d')]=_[_0x9d71('0x2e')](_0x487383['model'],qs[_0x9d71('0x2f')](_0x1ebe4a['query'][_0x9d71('0x2f')]));_0x1b29a1[_0x9d71('0x2d')]=_0x1b29a1[_0x9d71('0x2d')][_0x9d71('0x30')]?_0x1b29a1[_0x9d71('0x2d')]:_0x487383[_0x9d71('0x2a')];if(!_0x1ebe4a[_0x9d71('0x2b')]['hasOwnProperty']('nolimit')){_0x1b29a1[_0x9d71('0x17')]=qs['limit'](_0x1ebe4a[_0x9d71('0x2b')][_0x9d71('0x17')]);_0x1b29a1[_0x9d71('0x19')]=qs['offset'](_0x1ebe4a[_0x9d71('0x2b')][_0x9d71('0x19')]);}_0x1b29a1[_0x9d71('0x31')]=qs[_0x9d71('0x32')](_0x1ebe4a['query'][_0x9d71('0x32')]);_0x1b29a1[_0x9d71('0x33')]=qs['filters'](_[_0x9d71('0x34')](_0x1ebe4a[_0x9d71('0x2b')],_0x487383[_0x9d71('0x2c')]),_0x118a0e);if(_0x1ebe4a['query']['filter']){_0x1b29a1['where']=_[_0x9d71('0x35')](_0x1b29a1[_0x9d71('0x33')],{'$or':_[_0x9d71('0x25')](_0x118a0e,function(_0x6031ab){if(_0x6031ab[_0x9d71('0x28')]!==_0x9d71('0x36')){var _0x10d809={};_0x10d809[_0x6031ab[_0x9d71('0x22')]]={'$like':'%'+_0x1ebe4a['query'][_0x9d71('0x37')]+'%'};return _0x10d809;}})});}_0x1b29a1=_['merge']({},_0x1b29a1,_0x1ebe4a[_0x9d71('0x38')]);var _0x2cdecd={'where':_0x1b29a1[_0x9d71('0x33')]};return db[_0x9d71('0x39')]['count'](_0x2cdecd)['then'](function(_0x1b6e69){_0x5d17dd[_0x9d71('0x18')]=_0x1b6e69;if(_0x1ebe4a['query'][_0x9d71('0x3a')]){_0x1b29a1[_0x9d71('0x3b')]=[{'all':!![]}];}return db[_0x9d71('0x39')][_0x9d71('0x3c')](_0x1b29a1);})[_0x9d71('0x1e')](function(_0x1d2c46){_0x5d17dd[_0x9d71('0x3d')]=_0x1d2c46;return _0x5d17dd;})[_0x9d71('0x1e')](respondWithFilteredResult(_0x2870e4,_0x1b29a1))['catch'](handleError(_0x2870e4,null));};exports[_0x9d71('0x3e')]=function(_0x2764e5,_0x23ebda){var _0x1f7548={'raw':!![],'where':{'id':_0x2764e5['params']['id']}},_0x211e27={};_0x211e27[_0x9d71('0x2a')]=_[_0x9d71('0x3f')](db[_0x9d71('0x39')][_0x9d71('0x26')]);_0x211e27[_0x9d71('0x2b')]=_[_0x9d71('0x3f')](_0x2764e5[_0x9d71('0x2b')]);_0x211e27['filters']=_['intersection'](_0x211e27[_0x9d71('0x2a')],_0x211e27['query']);_0x1f7548[_0x9d71('0x2d')]=_[_0x9d71('0x2e')](_0x211e27[_0x9d71('0x2a')],qs[_0x9d71('0x2f')](_0x2764e5[_0x9d71('0x2b')][_0x9d71('0x2f')]));_0x1f7548[_0x9d71('0x2d')]=_0x1f7548['attributes']['length']?_0x1f7548[_0x9d71('0x2d')]:_0x211e27['model'];if(_0x2764e5[_0x9d71('0x2b')]['includeAll']){_0x1f7548[_0x9d71('0x3b')]=[{'all':!![]}];}_0x1f7548=_[_0x9d71('0x35')]({},_0x1f7548,_0x2764e5[_0x9d71('0x38')]);return db['SquareMessage'][_0x9d71('0x40')](_0x1f7548)[_0x9d71('0x1e')](handleEntityNotFound(_0x23ebda,null))[_0x9d71('0x1e')](respondWithResult(_0x23ebda,null))[_0x9d71('0x41')](handleError(_0x23ebda,null));};exports[_0x9d71('0x42')]=function(_0x13e722,_0x4cbc0a){return db[_0x9d71('0x39')][_0x9d71('0x42')](_0x13e722['body'],{})[_0x9d71('0x1e')](respondWithResult(_0x4cbc0a,0xc9))[_0x9d71('0x41')](handleError(_0x4cbc0a,null));};exports['update']=function(_0x491ed0,_0x2ac38e){if(_0x491ed0[_0x9d71('0x43')]['id']){delete _0x491ed0[_0x9d71('0x43')]['id'];}return db[_0x9d71('0x39')][_0x9d71('0x40')]({'where':{'id':_0x491ed0[_0x9d71('0x44')]['id']}})[_0x9d71('0x1e')](handleEntityNotFound(_0x2ac38e,null))['then'](saveUpdates(_0x491ed0[_0x9d71('0x43')],null))[_0x9d71('0x1e')](respondWithResult(_0x2ac38e,null))[_0x9d71('0x41')](handleError(_0x2ac38e,null));};exports[_0x9d71('0x1f')]=function(_0x222c31,_0x19e95e){return db[_0x9d71('0x39')][_0x9d71('0x40')]({'where':{'id':_0x222c31[_0x9d71('0x44')]['id']}})['then'](handleEntityNotFound(_0x19e95e,null))[_0x9d71('0x1e')](removeEntity(_0x19e95e,null))[_0x9d71('0x41')](handleError(_0x19e95e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 525bb91..e46b3e0 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 _0x5045=['lodash','util','api','moment','path','../../config/environment','exports','define','SquareMessage','square_messages'];(function(_0x214b79,_0x2b7146){var _0x38bfdc=function(_0x3b1698){while(--_0x3b1698){_0x214b79['push'](_0x214b79['shift']());}};_0x38bfdc(++_0x2b7146);}(_0x5045,0xe6));var _0x5504=function(_0x4613d1,_0xf08a95){_0x4613d1=_0x4613d1-0x0;var _0x514bb0=_0x5045[_0x4613d1];return _0x514bb0;};'use strict';var _=require(_0x5504('0x0'));var util=require(_0x5504('0x1'));var logger=require('../../config/logger')(_0x5504('0x2'));var moment=require(_0x5504('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5504('0x4'));var rimraf=require('rimraf');var config=require(_0x5504('0x5'));var attributes=require('./squareMessage.attributes');module[_0x5504('0x6')]=function(_0x968ab7,_0x4f09e7){return _0x968ab7[_0x5504('0x7')](_0x5504('0x8'),attributes,{'tableName':_0x5504('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72b5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','square_messages'];(function(_0x5300fc,_0x49269b){var _0x3b74d2=function(_0x32b244){while(--_0x32b244){_0x5300fc['push'](_0x5300fc['shift']());}};_0x3b74d2(++_0x49269b);}(_0x72b5,0x16b));var _0x572b=function(_0x53ab4d,_0x1be52d){_0x53ab4d=_0x53ab4d-0x0;var _0x4efa3b=_0x72b5[_0x53ab4d];return _0x4efa3b;};'use strict';var _=require(_0x572b('0x0'));var util=require(_0x572b('0x1'));var logger=require(_0x572b('0x2'))(_0x572b('0x3'));var moment=require(_0x572b('0x4'));var BPromise=require(_0x572b('0x5'));var rp=require(_0x572b('0x6'));var fs=require('fs');var path=require(_0x572b('0x7'));var rimraf=require('rimraf');var config=require(_0x572b('0x8'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x3ceca9,_0x1ca227){return _0x3ceca9[_0x572b('0x9')]('SquareMessage',attributes,{'tableName':_0x572b('0xa'),'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 bbff225..6036e60 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 _0x8d1a=['error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','SquareMessage','create','body','options','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46c55f,_0x57d146){var _0x5c7d2d=function(_0x5ae9f6){while(--_0x5ae9f6){_0x46c55f['push'](_0x46c55f['shift']());}};_0x5c7d2d(++_0x57d146);}(_0x8d1a,0x1b0));var _0xa8d1=function(_0x2ebbdf,_0x5021ea){_0x2ebbdf=_0x2ebbdf-0x0;var _0x100e73=_0x8d1a[_0x2ebbdf];return _0x100e73;};'use strict';var _=require(_0xa8d1('0x0'));var util=require('util');var moment=require(_0xa8d1('0x1'));var BPromise=require('bluebird');var rs=require(_0xa8d1('0x2'));var fs=require('fs');var Redis=require(_0xa8d1('0x3'));var db=require(_0xa8d1('0x4'))['db'];var utils=require(_0xa8d1('0x5'));var logger=require(_0xa8d1('0x6'))(_0xa8d1('0x7'));var config=require(_0xa8d1('0x8'));var jayson=require(_0xa8d1('0x9'));var client=jayson[_0xa8d1('0xa')][_0xa8d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29fb09,_0x1785c5,_0x1ea2e6){return new BPromise(function(_0x2956d4,_0xccfc00){return client[_0xa8d1('0xc')](_0x29fb09,_0x1ea2e6)['then'](function(_0x42cb6b){logger[_0xa8d1('0xd')]('SquareMessage,\x20%s,\x20%s',_0x1785c5,_0xa8d1('0xe'));logger[_0xa8d1('0xf')](_0xa8d1('0x10'),_0x1785c5,_0xa8d1('0xe'),JSON[_0xa8d1('0x11')](_0x42cb6b));if(_0x42cb6b['error']){if(_0x42cb6b[_0xa8d1('0x12')][_0xa8d1('0x13')]===0x1f4){logger[_0xa8d1('0x12')](_0xa8d1('0x14'),_0x1785c5,_0x42cb6b[_0xa8d1('0x12')][_0xa8d1('0x15')]);return _0xccfc00(_0x42cb6b[_0xa8d1('0x12')][_0xa8d1('0x15')]);}logger['error'](_0xa8d1('0x14'),_0x1785c5,_0x42cb6b[_0xa8d1('0x12')][_0xa8d1('0x15')]);return _0x2956d4(_0x42cb6b['error'][_0xa8d1('0x15')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x1785c5,'request\x20sent');_0x2956d4(_0x42cb6b[_0xa8d1('0x16')][_0xa8d1('0x15')]);}})[_0xa8d1('0x17')](function(_0x2ec19f){logger[_0xa8d1('0x12')]('SquareMessage,\x20%s,\x20%s',_0x1785c5,_0x2ec19f);_0xccfc00(_0x2ec19f);});});}exports['CreateSquareMessage']=function(_0x3333df){var _0xb92bc=this;return new Promise(function(_0x34fd32,_0x26849e){return db[_0xa8d1('0x18')][_0xa8d1('0x19')](_0x3333df[_0xa8d1('0x1a')],{'raw':_0x3333df[_0xa8d1('0x1b')]?_0x3333df['options'][_0xa8d1('0x1c')]===undefined?!![]:![]:!![]})[_0xa8d1('0x1d')](function(_0x43d3af){logger['info']('CreateSquareMessage',_0x3333df);logger[_0xa8d1('0xf')]('CreateSquareMessage',_0x3333df,JSON[_0xa8d1('0x11')](_0x43d3af));_0x34fd32(_0x43d3af);})[_0xa8d1('0x17')](function(_0x4fad3c){logger[_0xa8d1('0x12')]('CreateSquareMessage',_0x4fad3c['message'],_0x3333df);_0x26849e(_0xb92bc['error'](0x1f4,_0x4fad3c['message']));});});}; \ No newline at end of file +var _0xeec9=['result','catch','create','body','options','raw','CreateSquareMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2d2d43,_0x22f10f){var _0x5d7aa0=function(_0x302404){while(--_0x302404){_0x2d2d43['push'](_0x2d2d43['shift']());}};_0x5d7aa0(++_0x22f10f);}(_0xeec9,0xfa));var _0x9eec=function(_0x105c12,_0x148fae){_0x105c12=_0x105c12-0x0;var _0x5da438=_0xeec9[_0x105c12];return _0x5da438;};'use strict';var _=require(_0x9eec('0x0'));var util=require('util');var moment=require(_0x9eec('0x1'));var BPromise=require(_0x9eec('0x2'));var rs=require(_0x9eec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eec('0x4'))['db'];var utils=require(_0x9eec('0x5'));var logger=require(_0x9eec('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9eec('0x7'));var client=jayson[_0x9eec('0x8')][_0x9eec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x285dc9,_0x24a81b,_0x48e295){return new BPromise(function(_0x3114b4,_0x108db6){return client[_0x9eec('0xa')](_0x285dc9,_0x48e295)[_0x9eec('0xb')](function(_0xe106df){logger[_0x9eec('0xc')](_0x9eec('0xd'),_0x24a81b,_0x9eec('0xe'));logger['debug'](_0x9eec('0xf'),_0x24a81b,'request\x20sent',JSON[_0x9eec('0x10')](_0xe106df));if(_0xe106df[_0x9eec('0x11')]){if(_0xe106df[_0x9eec('0x11')][_0x9eec('0x12')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x24a81b,_0xe106df[_0x9eec('0x11')][_0x9eec('0x13')]);return _0x108db6(_0xe106df['error'][_0x9eec('0x13')]);}logger[_0x9eec('0x11')]('SquareMessage,\x20%s,\x20%s',_0x24a81b,_0xe106df[_0x9eec('0x11')][_0x9eec('0x13')]);return _0x3114b4(_0xe106df['error'][_0x9eec('0x13')]);}else{logger[_0x9eec('0xc')](_0x9eec('0xd'),_0x24a81b,'request\x20sent');_0x3114b4(_0xe106df[_0x9eec('0x14')][_0x9eec('0x13')]);}})[_0x9eec('0x15')](function(_0x4421df){logger[_0x9eec('0x11')](_0x9eec('0xd'),_0x24a81b,_0x4421df);_0x108db6(_0x4421df);});});}exports['CreateSquareMessage']=function(_0x338b8f){var _0xa5fe72=this;return new Promise(function(_0x3b0230,_0xa32fe8){return db['SquareMessage'][_0x9eec('0x16')](_0x338b8f[_0x9eec('0x17')],{'raw':_0x338b8f[_0x9eec('0x18')]?_0x338b8f[_0x9eec('0x18')][_0x9eec('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3a73f7){logger['info'](_0x9eec('0x1a'),_0x338b8f);logger['debug'](_0x9eec('0x1a'),_0x338b8f,JSON[_0x9eec('0x10')](_0x3a73f7));_0x3b0230(_0x3a73f7);})[_0x9eec('0x15')](function(_0x449afc){logger[_0x9eec('0x11')](_0x9eec('0x1a'),_0x449afc['message'],_0x338b8f);_0xa32fe8(_0xa5fe72[_0x9eec('0x11')](0x1f4,_0x449afc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 8ab8637..4296fdc 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 _0xd565=['/:id/test','15s','test','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x446701,_0x49e372){var _0x339cc7=function(_0x100550){while(--_0x100550){_0x446701['push'](_0x446701['shift']());}};_0x339cc7(++_0x49e372);}(_0xd565,0x86));var _0x5d56=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd565[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x5d56('0x0'));var path=require(_0x5d56('0x1'));var timeout=require(_0x5d56('0x2'));var express=require(_0x5d56('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5d56('0x4'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x5d56('0x5')]('/',auth[_0x5d56('0x6')](),controller[_0x5d56('0x7')]);router['get'](_0x5d56('0x8'),auth['isAuthenticated'](),controller[_0x5d56('0x9')]);router[_0x5d56('0x5')](_0x5d56('0xa'),auth[_0x5d56('0x6')](),timeout(_0x5d56('0xb')),controller[_0x5d56('0xc')]);router['post']('/',auth[_0x5d56('0x6')](),controller[_0x5d56('0xd')]);router[_0x5d56('0xe')](_0x5d56('0x8'),auth[_0x5d56('0x6')](),controller[_0x5d56('0xf')]);router[_0x5d56('0x10')](_0x5d56('0x8'),auth[_0x5d56('0x6')](),controller[_0x5d56('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6f57=['isAuthenticated','index','show','get','/:id/test','15s','test','post','put','update','/:id','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x23153a,_0xa2e784){var _0x25b6ef=function(_0x4a3e98){while(--_0x4a3e98){_0x23153a['push'](_0x23153a['shift']());}};_0x25b6ef(++_0xa2e784);}(_0x6f57,0x15d));var _0x76f5=function(_0x152827,_0xed6bfc){_0x152827=_0x152827-0x0;var _0x4bd8ad=_0x6f57[_0x152827];return _0x4bd8ad;};'use strict';var multer=require(_0x76f5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x76f5('0x1'));var router=express[_0x76f5('0x2')]();var fs_extra=require(_0x76f5('0x3'));var auth=require(_0x76f5('0x4'));var interaction=require(_0x76f5('0x5'));var config=require(_0x76f5('0x6'));var controller=require(_0x76f5('0x7'));router['get']('/',auth[_0x76f5('0x8')](),controller[_0x76f5('0x9')]);router['get']('/:id',auth[_0x76f5('0x8')](),controller[_0x76f5('0xa')]);router[_0x76f5('0xb')](_0x76f5('0xc'),auth[_0x76f5('0x8')](),timeout(_0x76f5('0xd')),controller[_0x76f5('0xe')]);router[_0x76f5('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x76f5('0x10')]('/:id',auth[_0x76f5('0x8')](),controller[_0x76f5('0x11')]);router['delete'](_0x76f5('0x12'),auth['isAuthenticated'](),controller[_0x76f5('0x13')]);module[_0x76f5('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e65c309..9140f9a 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 _0xbbf2=['sequelize','exports','STRING','name'];(function(_0x2a99c9,_0x26328d){var _0x3bb20d=function(_0x382a57){while(--_0x382a57){_0x2a99c9['push'](_0x2a99c9['shift']());}};_0x3bb20d(++_0x26328d);}(_0xbbf2,0x174));var _0x2bbf=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0xbbf2[_0x367336];return _0x3423a7;};'use strict';var Sequelize=require(_0x2bbf('0x0'));module[_0x2bbf('0x1')]={'name':{'type':Sequelize[_0x2bbf('0x2')],'unique':_0x2bbf('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2bbf('0x2')]}}; \ No newline at end of file +var _0xb488=['STRING','name'];(function(_0xace8c,_0x58e6dc){var _0x3fe603=function(_0x1f9581){while(--_0x1f9581){_0xace8c['push'](_0xace8c['shift']());}};_0x3fe603(++_0x58e6dc);}(_0xb488,0x69));var _0x8b48=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb488[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8b48('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8b48('0x1')]},'description':{'type':Sequelize[_0x8b48('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 422a2dd..b6ca2db 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 _0x4038=['find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','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','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','SquareOdbc','includeAll','findAll','rows','show','rawAttributes','include'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0x4038,0x1b3));var _0x8403=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x4038[_0x424501];return _0xb719af;};'use strict';var emlformat=require(_0x8403('0x0'));var rimraf=require(_0x8403('0x1'));var zipdir=require(_0x8403('0x2'));var jsonpatch=require(_0x8403('0x3'));var rp=require(_0x8403('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8403('0x5'));var util=require(_0x8403('0x6'));var path=require('path');var sox=require(_0x8403('0x7'));var csv=require(_0x8403('0x8'));var ejs=require(_0x8403('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8403('0xa'));var squel=require('squel');var crypto=require(_0x8403('0xb'));var jsforce=require(_0x8403('0xc'));var deskjs=require(_0x8403('0xd'));var toCsv=require(_0x8403('0x8'));var querystring=require(_0x8403('0xe'));var Papa=require(_0x8403('0xf'));var Redis=require(_0x8403('0x10'));var authService=require(_0x8403('0x11'));var qs=require(_0x8403('0x12'));var as=require(_0x8403('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8403('0x14'))(_0x8403('0x15'));var utils=require(_0x8403('0x16'));var config=require(_0x8403('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7c1712,_0x40011a){_0x40011a=_0x40011a||0xcc;return function(_0x781b83){if(_0x781b83){return _0x7c1712[_0x8403('0x18')](_0x40011a);}return _0x7c1712[_0x8403('0x19')](_0x40011a)[_0x8403('0x1a')]();};}function respondWithResult(_0x6f7c15,_0x32d85c){_0x32d85c=_0x32d85c||0xc8;return function(_0x264612){if(_0x264612){return _0x6f7c15['status'](_0x32d85c)[_0x8403('0x1b')](_0x264612);}};}function respondWithFilteredResult(_0xac0d4a,_0x27a45c){return function(_0x3894ee){if(_0x3894ee){var _0x54c18b=typeof _0x27a45c[_0x8403('0x1c')]==='undefined'&&typeof _0x27a45c['limit']==='undefined';var _0x2920cd=_0x3894ee[_0x8403('0x1d')];var _0x575a3f=_0x54c18b?0x0:_0x27a45c[_0x8403('0x1c')];var _0x164877=_0x54c18b?_0x3894ee['count']:_0x27a45c[_0x8403('0x1c')]+_0x27a45c[_0x8403('0x1e')];var _0x2e65e6;if(_0x164877>=_0x2920cd){_0x164877=_0x2920cd;_0x2e65e6=0xc8;}else{_0x2e65e6=0xce;}_0xac0d4a[_0x8403('0x19')](_0x2e65e6);return _0xac0d4a['set'](_0x8403('0x1f'),_0x575a3f+'-'+_0x164877+'/'+_0x2920cd)[_0x8403('0x1b')](_0x3894ee);}return null;};}function patchUpdates(_0xe1bf49){return function(_0x4173a0){try{jsonpatch[_0x8403('0x20')](_0x4173a0,_0xe1bf49,!![]);}catch(_0x3a9bf1){return BPromise[_0x8403('0x21')](_0x3a9bf1);}return _0x4173a0[_0x8403('0x22')]();};}function saveUpdates(_0x18a4c9,_0x27223e){return function(_0x2c8452){if(_0x2c8452){return _0x2c8452[_0x8403('0x23')](_0x18a4c9)[_0x8403('0x24')](function(_0x4f5fcd){return _0x4f5fcd;});}return null;};}function removeEntity(_0x1aab67,_0xfc09fe){return function(_0x3ae970){if(_0x3ae970){return _0x3ae970[_0x8403('0x25')]()[_0x8403('0x24')](function(){var _0x4ab39e=_0x3ae970[_0x8403('0x26')]({'plain':!![]});var _0x210a35=_0x8403('0x27');return db[_0x8403('0x28')]['destroy']({'where':{'type':_0x210a35,'resourceId':_0x4ab39e['id']}})['then'](function(){return _0x3ae970;});})[_0x8403('0x24')](function(){_0x1aab67[_0x8403('0x19')](0xcc)[_0x8403('0x1a')]();});}};}function handleEntityNotFound(_0x441842,_0x4d0d66){return function(_0xb3871a){if(!_0xb3871a){_0x441842['sendStatus'](0x194);}return _0xb3871a;};}function handleError(_0x58ca58,_0x5b5cf3){_0x5b5cf3=_0x5b5cf3||0x1f4;return function(_0x60bfb1){logger[_0x8403('0x29')](_0x60bfb1['stack']);if(_0x60bfb1[_0x8403('0x2a')]){delete _0x60bfb1[_0x8403('0x2a')];}_0x58ca58[_0x8403('0x19')](_0x5b5cf3)['send'](_0x60bfb1);};}exports[_0x8403('0x2b')]=function(_0x3e7154,_0x515d7d){var _0x177f1c={},_0x4769de={},_0x3c7446={'count':0x0,'rows':[]};var _0xd62de5=_[_0x8403('0x2c')](db['SquareOdbc']['rawAttributes'],function(_0x4c9419){return{'name':_0x4c9419[_0x8403('0x2d')],'type':_0x4c9419[_0x8403('0x2e')][_0x8403('0x2f')]};});_0x4769de[_0x8403('0x30')]=_['map'](_0xd62de5,'name');_0x4769de['query']=_[_0x8403('0x31')](_0x3e7154['query']);_0x4769de[_0x8403('0x32')]=_[_0x8403('0x33')](_0x4769de[_0x8403('0x30')],_0x4769de[_0x8403('0x34')]);_0x177f1c[_0x8403('0x35')]=_['intersection'](_0x4769de[_0x8403('0x30')],qs[_0x8403('0x36')](_0x3e7154[_0x8403('0x34')]['fields']));_0x177f1c[_0x8403('0x35')]=_0x177f1c[_0x8403('0x35')]['length']?_0x177f1c[_0x8403('0x35')]:_0x4769de[_0x8403('0x30')];if(!_0x3e7154[_0x8403('0x34')][_0x8403('0x37')]('nolimit')){_0x177f1c[_0x8403('0x1e')]=qs[_0x8403('0x1e')](_0x3e7154[_0x8403('0x34')][_0x8403('0x1e')]);_0x177f1c[_0x8403('0x1c')]=qs[_0x8403('0x1c')](_0x3e7154['query'][_0x8403('0x1c')]);}_0x177f1c[_0x8403('0x38')]=qs[_0x8403('0x39')](_0x3e7154[_0x8403('0x34')][_0x8403('0x39')]);_0x177f1c[_0x8403('0x3a')]=qs[_0x8403('0x32')](_['pick'](_0x3e7154[_0x8403('0x34')],_0x4769de['filters']),_0xd62de5);if(_0x3e7154[_0x8403('0x34')]['filter']){_0x177f1c['where']=_[_0x8403('0x3b')](_0x177f1c[_0x8403('0x3a')],{'$or':_[_0x8403('0x2c')](_0xd62de5,function(_0x4290d9){if(_0x4290d9[_0x8403('0x2e')]!==_0x8403('0x3c')){var _0x3a3ac0={};_0x3a3ac0[_0x4290d9[_0x8403('0x2a')]]={'$like':'%'+_0x3e7154[_0x8403('0x34')]['filter']+'%'};return _0x3a3ac0;}})});}_0x177f1c=_[_0x8403('0x3b')]({},_0x177f1c,_0x3e7154[_0x8403('0x3d')]);var _0x344366={'where':_0x177f1c[_0x8403('0x3a')]};return db[_0x8403('0x3e')][_0x8403('0x1d')](_0x344366)[_0x8403('0x24')](function(_0xd08e4f){_0x3c7446[_0x8403('0x1d')]=_0xd08e4f;if(_0x3e7154[_0x8403('0x34')][_0x8403('0x3f')]){_0x177f1c['include']=[{'all':!![]}];}return db[_0x8403('0x3e')][_0x8403('0x40')](_0x177f1c);})[_0x8403('0x24')](function(_0x2b108f){_0x3c7446[_0x8403('0x41')]=_0x2b108f;return _0x3c7446;})[_0x8403('0x24')](respondWithFilteredResult(_0x515d7d,_0x177f1c))['catch'](handleError(_0x515d7d,null));};exports[_0x8403('0x42')]=function(_0x26577c,_0x455a54){var _0x1762ef={'raw':!![],'where':{'id':_0x26577c['params']['id']}},_0x1646f8={};_0x1646f8[_0x8403('0x30')]=_[_0x8403('0x31')](db[_0x8403('0x3e')][_0x8403('0x43')]);_0x1646f8[_0x8403('0x34')]=_[_0x8403('0x31')](_0x26577c[_0x8403('0x34')]);_0x1646f8[_0x8403('0x32')]=_[_0x8403('0x33')](_0x1646f8['model'],_0x1646f8[_0x8403('0x34')]);_0x1762ef['attributes']=_[_0x8403('0x33')](_0x1646f8[_0x8403('0x30')],qs['fields'](_0x26577c[_0x8403('0x34')][_0x8403('0x36')]));_0x1762ef[_0x8403('0x35')]=_0x1762ef['attributes']['length']?_0x1762ef[_0x8403('0x35')]:_0x1646f8[_0x8403('0x30')];if(_0x26577c[_0x8403('0x34')]['includeAll']){_0x1762ef[_0x8403('0x44')]=[{'all':!![]}];}_0x1762ef=_[_0x8403('0x3b')]({},_0x1762ef,_0x26577c['options']);return db[_0x8403('0x3e')][_0x8403('0x45')](_0x1762ef)[_0x8403('0x24')](handleEntityNotFound(_0x455a54,null))[_0x8403('0x24')](respondWithResult(_0x455a54,null))[_0x8403('0x46')](handleError(_0x455a54,null));};exports[_0x8403('0x47')]=function(_0x4058b6,_0x22f956){return db[_0x8403('0x3e')][_0x8403('0x47')](_0x4058b6['body'],{})[_0x8403('0x24')](function(_0xafa73b){var _0x5e9a0a=_0x4058b6[_0x8403('0x48')][_0x8403('0x26')]({'plain':!![]});if(!_0x5e9a0a)throw new Error(_0x8403('0x49'));if(_0x5e9a0a[_0x8403('0x4a')]===_0x8403('0x48')){var _0x352463=_0xafa73b[_0x8403('0x26')]({'plain':!![]});var _0x442bf4=_0x8403('0x27');return db[_0x8403('0x4b')][_0x8403('0x45')]({'where':{'name':_0x442bf4,'userProfileId':_0x5e9a0a[_0x8403('0x4c')]},'raw':!![]})[_0x8403('0x24')](function(_0x655954){if(_0x655954&&_0x655954['autoAssociation']===0x0){return db[_0x8403('0x28')][_0x8403('0x47')]({'name':_0x352463[_0x8403('0x2a')],'resourceId':_0x352463['id'],'type':_0x655954[_0x8403('0x2a')],'sectionId':_0x655954['id']},{})[_0x8403('0x24')](function(){return _0xafa73b;});}else{return _0xafa73b;}})['catch'](function(_0x572c5c){logger[_0x8403('0x29')](_0x8403('0x4d'),_0x572c5c);throw _0x572c5c;});}return _0xafa73b;})[_0x8403('0x24')](respondWithResult(_0x22f956,0xc9))['catch'](handleError(_0x22f956,null));};exports[_0x8403('0x23')]=function(_0x2a5787,_0x31a2be){if(_0x2a5787[_0x8403('0x4e')]['id']){delete _0x2a5787[_0x8403('0x4e')]['id'];}return db[_0x8403('0x3e')]['find']({'where':{'id':_0x2a5787[_0x8403('0x4f')]['id']}})[_0x8403('0x24')](handleEntityNotFound(_0x31a2be,null))[_0x8403('0x24')](saveUpdates(_0x2a5787[_0x8403('0x4e')],null))[_0x8403('0x24')](respondWithResult(_0x31a2be,null))[_0x8403('0x46')](handleError(_0x31a2be,null));};exports[_0x8403('0x25')]=function(_0x5a4ffa,_0x35db11){return db['SquareOdbc'][_0x8403('0x45')]({'where':{'id':_0x5a4ffa[_0x8403('0x4f')]['id']}})['then'](handleEntityNotFound(_0x35db11,null))[_0x8403('0x24')](removeEntity(_0x35db11,null))[_0x8403('0x46')](handleError(_0x35db11,null));};exports['test']=function(_0xd4e59b,_0x2acbcb,_0x4f2bb1){var _0x4f5e0c;return db[_0x8403('0x3e')][_0x8403('0x45')]({'where':{'id':_0xd4e59b['params']['id']},'attributes':['id','dsn']})[_0x8403('0x24')](handleEntityNotFound(_0x2acbcb,null))['then'](function(_0x228c89){if(_0x228c89){var _0x20a8ee=require(_0x8403('0x50'))();_0x20a8ee[_0x8403('0x51')](_0x228c89[_0x8403('0x52')]);_0x20a8ee[_0x8403('0x53')]();return _0x228c89;}})[_0x8403('0x24')](respondWithResult(_0x2acbcb,null))['catch'](handleError(_0x2acbcb,null));}; \ No newline at end of file +var _0xcf55=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ODBC','UserProfileResource','then','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId'];(function(_0x351dff,_0x28ece9){var _0x25a8c9=function(_0x45127b){while(--_0x45127b){_0x351dff['push'](_0x351dff['shift']());}};_0x25a8c9(++_0x28ece9);}(_0xcf55,0x1c1));var _0x5cf5=function(_0x34d3fd,_0x318265){_0x34d3fd=_0x34d3fd-0x0;var _0x4730c8=_0xcf55[_0x34d3fd];return _0x4730c8;};'use strict';var emlformat=require(_0x5cf5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5cf5('0x1'));var rp=require(_0x5cf5('0x2'));var moment=require(_0x5cf5('0x3'));var BPromise=require(_0x5cf5('0x4'));var Mustache=require(_0x5cf5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5cf5('0x6'));var csv=require(_0x5cf5('0x7'));var ejs=require(_0x5cf5('0x8'));var fs=require('fs');var fs_extra=require(_0x5cf5('0x9'));var _=require(_0x5cf5('0xa'));var squel=require('squel');var crypto=require(_0x5cf5('0xb'));var jsforce=require(_0x5cf5('0xc'));var deskjs=require(_0x5cf5('0xd'));var toCsv=require(_0x5cf5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5cf5('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5cf5('0xf'));var hardwareService=require(_0x5cf5('0x10'));var logger=require('../../config/logger')(_0x5cf5('0x11'));var utils=require(_0x5cf5('0x12'));var config=require(_0x5cf5('0x13'));var licenseUtil=require(_0x5cf5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a97b4,_0xa8d81e){_0xa8d81e=_0xa8d81e||0xcc;return function(_0x15a58e){if(_0x15a58e){return _0x4a97b4[_0x5cf5('0x15')](_0xa8d81e);}return _0x4a97b4[_0x5cf5('0x16')](_0xa8d81e)['end']();};}function respondWithResult(_0x4c3cbc,_0x51250a){_0x51250a=_0x51250a||0xc8;return function(_0x586adf){if(_0x586adf){return _0x4c3cbc[_0x5cf5('0x16')](_0x51250a)[_0x5cf5('0x17')](_0x586adf);}};}function respondWithFilteredResult(_0x3b4efc,_0x200bf3){return function(_0x2c341a){if(_0x2c341a){var _0x1658b8=typeof _0x200bf3['offset']===_0x5cf5('0x18')&&typeof _0x200bf3[_0x5cf5('0x19')]===_0x5cf5('0x18');var _0x12c658=_0x2c341a[_0x5cf5('0x1a')];var _0x35ad1e=_0x1658b8?0x0:_0x200bf3[_0x5cf5('0x1b')];var _0x3320d6=_0x1658b8?_0x2c341a['count']:_0x200bf3['offset']+_0x200bf3[_0x5cf5('0x19')];var _0x218035;if(_0x3320d6>=_0x12c658){_0x3320d6=_0x12c658;_0x218035=0xc8;}else{_0x218035=0xce;}_0x3b4efc[_0x5cf5('0x16')](_0x218035);return _0x3b4efc[_0x5cf5('0x1c')](_0x5cf5('0x1d'),_0x35ad1e+'-'+_0x3320d6+'/'+_0x12c658)[_0x5cf5('0x17')](_0x2c341a);}return null;};}function patchUpdates(_0x22fec3){return function(_0x5d36ca){try{jsonpatch[_0x5cf5('0x1e')](_0x5d36ca,_0x22fec3,!![]);}catch(_0x4f570b){return BPromise[_0x5cf5('0x1f')](_0x4f570b);}return _0x5d36ca[_0x5cf5('0x20')]();};}function saveUpdates(_0x38b0bf,_0x5445c4){return function(_0x1fb777){if(_0x1fb777){return _0x1fb777[_0x5cf5('0x21')](_0x38b0bf)['then'](function(_0x56afd4){return _0x56afd4;});}return null;};}function removeEntity(_0x48273e,_0x330ee9){return function(_0x3f3999){if(_0x3f3999){return _0x3f3999[_0x5cf5('0x22')]()['then'](function(){var _0x1f68cd=_0x3f3999[_0x5cf5('0x23')]({'plain':!![]});var _0x18ee16=_0x5cf5('0x24');return db[_0x5cf5('0x25')][_0x5cf5('0x22')]({'where':{'type':_0x18ee16,'resourceId':_0x1f68cd['id']}})[_0x5cf5('0x26')](function(){return _0x3f3999;});})['then'](function(){_0x48273e[_0x5cf5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24eb07,_0x4eab88){return function(_0x4944c2){if(!_0x4944c2){_0x24eb07[_0x5cf5('0x15')](0x194);}return _0x4944c2;};}function handleError(_0x3bf5ae,_0x3a3884){_0x3a3884=_0x3a3884||0x1f4;return function(_0x296e44){logger['error'](_0x296e44['stack']);if(_0x296e44[_0x5cf5('0x27')]){delete _0x296e44['name'];}_0x3bf5ae[_0x5cf5('0x16')](_0x3a3884)[_0x5cf5('0x28')](_0x296e44);};}exports[_0x5cf5('0x29')]=function(_0x4a5fe0,_0x3cbdab){var _0x2db8ff={},_0x4ccdf0={},_0x5b755b={'count':0x0,'rows':[]};var _0x3f4c85=_[_0x5cf5('0x2a')](db[_0x5cf5('0x2b')]['rawAttributes'],function(_0x391006){return{'name':_0x391006[_0x5cf5('0x2c')],'type':_0x391006[_0x5cf5('0x2d')][_0x5cf5('0x2e')]};});_0x4ccdf0[_0x5cf5('0x2f')]=_[_0x5cf5('0x2a')](_0x3f4c85,_0x5cf5('0x27'));_0x4ccdf0[_0x5cf5('0x30')]=_[_0x5cf5('0x31')](_0x4a5fe0[_0x5cf5('0x30')]);_0x4ccdf0[_0x5cf5('0x32')]=_[_0x5cf5('0x33')](_0x4ccdf0[_0x5cf5('0x2f')],_0x4ccdf0['query']);_0x2db8ff['attributes']=_[_0x5cf5('0x33')](_0x4ccdf0['model'],qs['fields'](_0x4a5fe0['query'][_0x5cf5('0x34')]));_0x2db8ff[_0x5cf5('0x35')]=_0x2db8ff[_0x5cf5('0x35')][_0x5cf5('0x36')]?_0x2db8ff[_0x5cf5('0x35')]:_0x4ccdf0['model'];if(!_0x4a5fe0[_0x5cf5('0x30')][_0x5cf5('0x37')](_0x5cf5('0x38'))){_0x2db8ff[_0x5cf5('0x19')]=qs[_0x5cf5('0x19')](_0x4a5fe0['query'][_0x5cf5('0x19')]);_0x2db8ff[_0x5cf5('0x1b')]=qs[_0x5cf5('0x1b')](_0x4a5fe0[_0x5cf5('0x30')][_0x5cf5('0x1b')]);}_0x2db8ff[_0x5cf5('0x39')]=qs[_0x5cf5('0x3a')](_0x4a5fe0['query'][_0x5cf5('0x3a')]);_0x2db8ff['where']=qs['filters'](_[_0x5cf5('0x3b')](_0x4a5fe0[_0x5cf5('0x30')],_0x4ccdf0[_0x5cf5('0x32')]),_0x3f4c85);if(_0x4a5fe0[_0x5cf5('0x30')][_0x5cf5('0x3c')]){_0x2db8ff['where']=_[_0x5cf5('0x3d')](_0x2db8ff[_0x5cf5('0x3e')],{'$or':_[_0x5cf5('0x2a')](_0x3f4c85,function(_0x44191f){if(_0x44191f[_0x5cf5('0x2d')]!==_0x5cf5('0x3f')){var _0x2e9ac5={};_0x2e9ac5[_0x44191f[_0x5cf5('0x27')]]={'$like':'%'+_0x4a5fe0[_0x5cf5('0x30')][_0x5cf5('0x3c')]+'%'};return _0x2e9ac5;}})});}_0x2db8ff=_[_0x5cf5('0x3d')]({},_0x2db8ff,_0x4a5fe0['options']);var _0x51c78a={'where':_0x2db8ff['where']};return db[_0x5cf5('0x2b')][_0x5cf5('0x1a')](_0x51c78a)[_0x5cf5('0x26')](function(_0x35d097){_0x5b755b[_0x5cf5('0x1a')]=_0x35d097;if(_0x4a5fe0[_0x5cf5('0x30')][_0x5cf5('0x40')]){_0x2db8ff['include']=[{'all':!![]}];}return db[_0x5cf5('0x2b')][_0x5cf5('0x41')](_0x2db8ff);})[_0x5cf5('0x26')](function(_0x5e1cdd){_0x5b755b[_0x5cf5('0x42')]=_0x5e1cdd;return _0x5b755b;})[_0x5cf5('0x26')](respondWithFilteredResult(_0x3cbdab,_0x2db8ff))['catch'](handleError(_0x3cbdab,null));};exports[_0x5cf5('0x43')]=function(_0x1f4a32,_0xe4e21c){var _0x4d3ab8={'raw':!![],'where':{'id':_0x1f4a32['params']['id']}},_0x38a4da={};_0x38a4da['model']=_[_0x5cf5('0x31')](db[_0x5cf5('0x2b')][_0x5cf5('0x44')]);_0x38a4da[_0x5cf5('0x30')]=_[_0x5cf5('0x31')](_0x1f4a32[_0x5cf5('0x30')]);_0x38a4da[_0x5cf5('0x32')]=_['intersection'](_0x38a4da[_0x5cf5('0x2f')],_0x38a4da[_0x5cf5('0x30')]);_0x4d3ab8[_0x5cf5('0x35')]=_[_0x5cf5('0x33')](_0x38a4da[_0x5cf5('0x2f')],qs[_0x5cf5('0x34')](_0x1f4a32[_0x5cf5('0x30')][_0x5cf5('0x34')]));_0x4d3ab8['attributes']=_0x4d3ab8[_0x5cf5('0x35')][_0x5cf5('0x36')]?_0x4d3ab8[_0x5cf5('0x35')]:_0x38a4da[_0x5cf5('0x2f')];if(_0x1f4a32[_0x5cf5('0x30')][_0x5cf5('0x40')]){_0x4d3ab8[_0x5cf5('0x45')]=[{'all':!![]}];}_0x4d3ab8=_[_0x5cf5('0x3d')]({},_0x4d3ab8,_0x1f4a32[_0x5cf5('0x46')]);return db[_0x5cf5('0x2b')]['find'](_0x4d3ab8)['then'](handleEntityNotFound(_0xe4e21c,null))[_0x5cf5('0x26')](respondWithResult(_0xe4e21c,null))[_0x5cf5('0x47')](handleError(_0xe4e21c,null));};exports[_0x5cf5('0x48')]=function(_0x51346d,_0x26293f){return db[_0x5cf5('0x2b')][_0x5cf5('0x48')](_0x51346d[_0x5cf5('0x49')],{})['then'](function(_0x104342){var _0x22766e=_0x51346d[_0x5cf5('0x4a')]['get']({'plain':!![]});if(!_0x22766e)throw new Error(_0x5cf5('0x4b'));if(_0x22766e[_0x5cf5('0x4c')]===_0x5cf5('0x4a')){var _0x226c7e=_0x104342[_0x5cf5('0x23')]({'plain':!![]});var _0x53aa5c='ODBC';return db['UserProfileSection'][_0x5cf5('0x4d')]({'where':{'name':_0x53aa5c,'userProfileId':_0x22766e[_0x5cf5('0x4e')]},'raw':!![]})[_0x5cf5('0x26')](function(_0x52e4cf){if(_0x52e4cf&&_0x52e4cf[_0x5cf5('0x4f')]===0x0){return db[_0x5cf5('0x25')][_0x5cf5('0x48')]({'name':_0x226c7e[_0x5cf5('0x27')],'resourceId':_0x226c7e['id'],'type':_0x52e4cf[_0x5cf5('0x27')],'sectionId':_0x52e4cf['id']},{})[_0x5cf5('0x26')](function(){return _0x104342;});}else{return _0x104342;}})[_0x5cf5('0x47')](function(_0x1999b4){logger[_0x5cf5('0x50')](_0x5cf5('0x51'),_0x1999b4);throw _0x1999b4;});}return _0x104342;})[_0x5cf5('0x26')](respondWithResult(_0x26293f,0xc9))[_0x5cf5('0x47')](handleError(_0x26293f,null));};exports['update']=function(_0x4d3fd9,_0xa05c0b){if(_0x4d3fd9[_0x5cf5('0x49')]['id']){delete _0x4d3fd9[_0x5cf5('0x49')]['id'];}return db[_0x5cf5('0x2b')]['find']({'where':{'id':_0x4d3fd9['params']['id']}})[_0x5cf5('0x26')](handleEntityNotFound(_0xa05c0b,null))['then'](saveUpdates(_0x4d3fd9[_0x5cf5('0x49')],null))[_0x5cf5('0x26')](respondWithResult(_0xa05c0b,null))[_0x5cf5('0x47')](handleError(_0xa05c0b,null));};exports[_0x5cf5('0x22')]=function(_0xdcf8b9,_0x559653){return db[_0x5cf5('0x2b')][_0x5cf5('0x4d')]({'where':{'id':_0xdcf8b9[_0x5cf5('0x52')]['id']}})[_0x5cf5('0x26')](handleEntityNotFound(_0x559653,null))[_0x5cf5('0x26')](removeEntity(_0x559653,null))[_0x5cf5('0x47')](handleError(_0x559653,null));};exports[_0x5cf5('0x53')]=function(_0x3fbc21,_0x5a0329,_0x14da1d){var _0x58d8a4;return db[_0x5cf5('0x2b')][_0x5cf5('0x4d')]({'where':{'id':_0x3fbc21[_0x5cf5('0x52')]['id']},'attributes':['id',_0x5cf5('0x54')]})[_0x5cf5('0x26')](handleEntityNotFound(_0x5a0329,null))[_0x5cf5('0x26')](function(_0x181320){if(_0x181320){var _0x364856=require(_0x5cf5('0x55'))();_0x364856[_0x5cf5('0x56')](_0x181320['dsn']);_0x364856[_0x5cf5('0x57')]();return _0x181320;}})['then'](respondWithResult(_0x5a0329,null))[_0x5cf5('0x47')](handleError(_0x5a0329,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c8012d1..e2f80a0 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 _0xf423=['rimraf','../../config/environment','exports','define','SquareOdbc','lodash','util','api','request-promise','path'];(function(_0x315aa8,_0x262f9c){var _0x20f758=function(_0x1765e7){while(--_0x1765e7){_0x315aa8['push'](_0x315aa8['shift']());}};_0x20f758(++_0x262f9c);}(_0xf423,0xf5));var _0x3f42=function(_0x147bef,_0x5aa474){_0x147bef=_0x147bef-0x0;var _0x29d10c=_0xf423[_0x147bef];return _0x29d10c;};'use strict';var _=require(_0x3f42('0x0'));var util=require(_0x3f42('0x1'));var logger=require('../../config/logger')(_0x3f42('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3f42('0x3'));var fs=require('fs');var path=require(_0x3f42('0x4'));var rimraf=require(_0x3f42('0x5'));var config=require(_0x3f42('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x3f42('0x7')]=function(_0x13ad85,_0x422295){return _0x13ad85[_0x3f42('0x8')](_0x3f42('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fb9=['define','SquareOdbc','square_odbc','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x4f5642,_0x3ec08d){var _0x5902cf=function(_0x1d06d7){while(--_0x1d06d7){_0x4f5642['push'](_0x4f5642['shift']());}};_0x5902cf(++_0x3ec08d);}(_0x2fb9,0x19a));var _0x92fb=function(_0x2013a8,_0x5054ef){_0x2013a8=_0x2013a8-0x0;var _0x29cad6=_0x2fb9[_0x2013a8];return _0x29cad6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x92fb('0x0'))(_0x92fb('0x1'));var moment=require(_0x92fb('0x2'));var BPromise=require(_0x92fb('0x3'));var rp=require(_0x92fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x92fb('0x5'));var attributes=require(_0x92fb('0x6'));module[_0x92fb('0x7')]=function(_0x1e2209,_0x32494d){return _0x1e2209[_0x92fb('0x8')](_0x92fb('0x9'),attributes,{'tableName':_0x92fb('0xa'),'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 72a9e35..79656fb 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 _0xe6a6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','ShowSquareOdbc','SquareOdbc','find','options','where','map','attributes','include','model','then','debug','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xe6a6,0x19f));var _0x6e6a=function(_0x20b418,_0x559dbf){_0x20b418=_0x20b418-0x0;var _0x1b8906=_0xe6a6[_0x20b418];return _0x1b8906;};'use strict';var _=require(_0x6e6a('0x0'));var util=require('util');var moment=require(_0x6e6a('0x1'));var BPromise=require(_0x6e6a('0x2'));var rs=require(_0x6e6a('0x3'));var fs=require('fs');var Redis=require(_0x6e6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e6a('0x5'));var logger=require(_0x6e6a('0x6'))('rpc');var config=require(_0x6e6a('0x7'));var jayson=require(_0x6e6a('0x8'));var client=jayson[_0x6e6a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1409cb,_0x186160,_0x487417){return new BPromise(function(_0x5224b1,_0x52355b){return client[_0x6e6a('0xa')](_0x1409cb,_0x487417)['then'](function(_0x20a2b9){logger['info'](_0x6e6a('0xb'),_0x186160,_0x6e6a('0xc'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x186160,'request\x20sent',JSON[_0x6e6a('0xd')](_0x20a2b9));if(_0x20a2b9[_0x6e6a('0xe')]){if(_0x20a2b9['error'][_0x6e6a('0xf')]===0x1f4){logger[_0x6e6a('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x186160,_0x20a2b9[_0x6e6a('0xe')]['message']);return _0x52355b(_0x20a2b9[_0x6e6a('0xe')]['message']);}logger[_0x6e6a('0xe')](_0x6e6a('0xb'),_0x186160,_0x20a2b9[_0x6e6a('0xe')][_0x6e6a('0x10')]);return _0x5224b1(_0x20a2b9[_0x6e6a('0xe')][_0x6e6a('0x10')]);}else{logger[_0x6e6a('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x186160,_0x6e6a('0xc'));_0x5224b1(_0x20a2b9[_0x6e6a('0x12')][_0x6e6a('0x10')]);}})['catch'](function(_0x335f89){logger['error'](_0x6e6a('0xb'),_0x186160,_0x335f89);_0x52355b(_0x335f89);});});}exports[_0x6e6a('0x13')]=function(_0x457d08){var _0x480900=this;return new Promise(function(_0x14b9c5,_0xa8ebcc){return db[_0x6e6a('0x14')][_0x6e6a('0x15')]({'raw':_0x457d08[_0x6e6a('0x16')]?_0x457d08['options']['raw']===undefined?!![]:![]:!![],'where':_0x457d08['options']?_0x457d08[_0x6e6a('0x16')][_0x6e6a('0x17')]||null:null,'attributes':_0x457d08[_0x6e6a('0x16')]?_0x457d08[_0x6e6a('0x16')]['attributes']||null:null,'include':_0x457d08[_0x6e6a('0x16')]?_0x457d08['options']['include']?_[_0x6e6a('0x18')](_0x457d08[_0x6e6a('0x16')]['include'],function(_0x16dbcf){return{'model':db[_0x16dbcf['model']],'as':_0x16dbcf['as'],'attributes':_0x16dbcf[_0x6e6a('0x19')],'include':_0x16dbcf[_0x6e6a('0x1a')]?_[_0x6e6a('0x18')](_0x16dbcf[_0x6e6a('0x1a')],function(_0x2c8aaf){return{'model':db[_0x2c8aaf['model']],'as':_0x2c8aaf['as'],'attributes':_0x2c8aaf[_0x6e6a('0x19')],'include':_0x2c8aaf[_0x6e6a('0x1a')]?_['map'](_0x2c8aaf['include'],function(_0x22c95a){return{'model':db[_0x22c95a[_0x6e6a('0x1b')]],'as':_0x22c95a['as'],'attributes':_0x22c95a[_0x6e6a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6e6a('0x1c')](function(_0x4ff663){logger[_0x6e6a('0x11')](_0x6e6a('0x13'),_0x457d08);logger[_0x6e6a('0x1d')](_0x6e6a('0x13'),_0x457d08,JSON[_0x6e6a('0xd')](_0x4ff663));_0x14b9c5(_0x4ff663);})['catch'](function(_0x129963){logger[_0x6e6a('0xe')](_0x6e6a('0x13'),_0x129963['message'],_0x457d08);_0xa8ebcc(_0x480900['error'](0x1f4,_0x129963[_0x6e6a('0x10')]));});});}; \ No newline at end of file +var _0xb6a9=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','lodash','util'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb6a9[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x9b6a('0x0'));var util=require(_0x9b6a('0x1'));var moment=require('moment');var BPromise=require(_0x9b6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b6a('0x3'));var db=require(_0x9b6a('0x4'))['db'];var utils=require(_0x9b6a('0x5'));var logger=require(_0x9b6a('0x6'))(_0x9b6a('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b6a('0x8'));var client=jayson[_0x9b6a('0x9')][_0x9b6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bc114,_0xb570bc,_0x19d421){return new BPromise(function(_0x5a52e7,_0x173195){return client['request'](_0x1bc114,_0x19d421)[_0x9b6a('0xb')](function(_0x3f663a){logger['info'](_0x9b6a('0xc'),_0xb570bc,'request\x20sent');logger[_0x9b6a('0xd')](_0x9b6a('0xe'),_0xb570bc,_0x9b6a('0xf'),JSON[_0x9b6a('0x10')](_0x3f663a));if(_0x3f663a[_0x9b6a('0x11')]){if(_0x3f663a[_0x9b6a('0x11')][_0x9b6a('0x12')]===0x1f4){logger[_0x9b6a('0x11')](_0x9b6a('0xc'),_0xb570bc,_0x3f663a[_0x9b6a('0x11')][_0x9b6a('0x13')]);return _0x173195(_0x3f663a[_0x9b6a('0x11')][_0x9b6a('0x13')]);}logger[_0x9b6a('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xb570bc,_0x3f663a['error'][_0x9b6a('0x13')]);return _0x5a52e7(_0x3f663a[_0x9b6a('0x11')][_0x9b6a('0x13')]);}else{logger[_0x9b6a('0x14')](_0x9b6a('0xc'),_0xb570bc,_0x9b6a('0xf'));_0x5a52e7(_0x3f663a[_0x9b6a('0x15')][_0x9b6a('0x13')]);}})[_0x9b6a('0x16')](function(_0x3e2b9a){logger[_0x9b6a('0x11')](_0x9b6a('0xc'),_0xb570bc,_0x3e2b9a);_0x173195(_0x3e2b9a);});});}exports[_0x9b6a('0x17')]=function(_0x365b31){var _0x1d7f04=this;return new Promise(function(_0x106a7d,_0x14f705){return db[_0x9b6a('0x18')][_0x9b6a('0x19')]({'raw':_0x365b31[_0x9b6a('0x1a')]?_0x365b31['options'][_0x9b6a('0x1b')]===undefined?!![]:![]:!![],'where':_0x365b31['options']?_0x365b31[_0x9b6a('0x1a')][_0x9b6a('0x1c')]||null:null,'attributes':_0x365b31['options']?_0x365b31['options']['attributes']||null:null,'include':_0x365b31[_0x9b6a('0x1a')]?_0x365b31[_0x9b6a('0x1a')][_0x9b6a('0x1d')]?_[_0x9b6a('0x1e')](_0x365b31[_0x9b6a('0x1a')][_0x9b6a('0x1d')],function(_0x3908fd){return{'model':db[_0x3908fd[_0x9b6a('0x1f')]],'as':_0x3908fd['as'],'attributes':_0x3908fd['attributes'],'include':_0x3908fd[_0x9b6a('0x1d')]?_[_0x9b6a('0x1e')](_0x3908fd['include'],function(_0xd9f9cd){return{'model':db[_0xd9f9cd[_0x9b6a('0x1f')]],'as':_0xd9f9cd['as'],'attributes':_0xd9f9cd[_0x9b6a('0x20')],'include':_0xd9f9cd[_0x9b6a('0x1d')]?_[_0x9b6a('0x1e')](_0xd9f9cd[_0x9b6a('0x1d')],function(_0x3d12b0){return{'model':db[_0x3d12b0['model']],'as':_0x3d12b0['as'],'attributes':_0x3d12b0[_0x9b6a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9b6a('0xb')](function(_0x1b103f){logger[_0x9b6a('0x14')](_0x9b6a('0x17'),_0x365b31);logger['debug']('ShowSquareOdbc',_0x365b31,JSON['stringify'](_0x1b103f));_0x106a7d(_0x1b103f);})[_0x9b6a('0x16')](function(_0x260571){logger[_0x9b6a('0x11')](_0x9b6a('0x17'),_0x260571[_0x9b6a('0x13')],_0x365b31);_0x14f705(_0x1d7f04[_0x9b6a('0x11')](0x1f4,_0x260571[_0x9b6a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c451f05..8bad0a6 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 _0x7f48=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','/:id','show','/:id/users','isAuthenticated','getUsers','post','create','addUsers','put','delete'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x7f48,0xac));var _0x87f4=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7f48[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x87f4('0x0'));var util=require(_0x87f4('0x1'));var path=require('path');var timeout=require(_0x87f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87f4('0x3'));var auth=require(_0x87f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x87f4('0x5'));var controller=require(_0x87f4('0x6'));router[_0x87f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x87f4('0x7')](_0x87f4('0x8'),auth['isAuthenticated'](),controller[_0x87f4('0x9')]);router[_0x87f4('0x7')](_0x87f4('0xa'),auth[_0x87f4('0xb')](),controller[_0x87f4('0xc')]);router[_0x87f4('0xd')]('/',auth[_0x87f4('0xb')](),controller[_0x87f4('0xe')]);router[_0x87f4('0xd')](_0x87f4('0xa'),auth['isAuthenticated'](),controller[_0x87f4('0xf')]);router[_0x87f4('0x10')]('/:id',auth[_0x87f4('0xb')](),controller['update']);router[_0x87f4('0x11')](_0x87f4('0x8'),auth[_0x87f4('0xb')](),controller['destroy']);router[_0x87f4('0x11')](_0x87f4('0xa'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x87f4('0x12')]=router; \ No newline at end of file +var _0xb886=['Router','fs-extra','../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','post','create','addUsers','put','update','delete','destroy','/:id/users','removeUsers','exports','multer','util','path','connect-timeout','express'];(function(_0x743a6b,_0x44cbee){var _0x1f989b=function(_0x28f205){while(--_0x28f205){_0x743a6b['push'](_0x743a6b['shift']());}};_0x1f989b(++_0x44cbee);}(_0xb886,0xf5));var _0x6b88=function(_0x1456ec,_0x5ddd39){_0x1456ec=_0x1456ec-0x0;var _0x42bacd=_0xb886[_0x1456ec];return _0x42bacd;};'use strict';var multer=require(_0x6b88('0x0'));var util=require(_0x6b88('0x1'));var path=require(_0x6b88('0x2'));var timeout=require(_0x6b88('0x3'));var express=require(_0x6b88('0x4'));var router=express[_0x6b88('0x5')]();var fs_extra=require(_0x6b88('0x6'));var auth=require(_0x6b88('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b88('0x8'));router[_0x6b88('0x9')]('/',auth[_0x6b88('0xa')](),controller[_0x6b88('0xb')]);router[_0x6b88('0x9')](_0x6b88('0xc'),auth['isAuthenticated'](),controller[_0x6b88('0xd')]);router['get']('/:id/users',auth[_0x6b88('0xa')](),controller[_0x6b88('0xe')]);router[_0x6b88('0xf')]('/',auth[_0x6b88('0xa')](),controller[_0x6b88('0x10')]);router['post']('/:id/users',auth[_0x6b88('0xa')](),controller[_0x6b88('0x11')]);router[_0x6b88('0x12')]('/:id',auth[_0x6b88('0xa')](),controller[_0x6b88('0x13')]);router[_0x6b88('0x14')](_0x6b88('0xc'),auth[_0x6b88('0xa')](),controller[_0x6b88('0x15')]);router[_0x6b88('0x14')](_0x6b88('0x16'),auth[_0x6b88('0xa')](),controller[_0x6b88('0x17')]);module[_0x6b88('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 813485c..437b520 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 _0x0b68=['BLOB','long','preproduction','getDataValue','utf8','production','toString','DATE','sequelize','exports','STRING'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0x0b68,0xa2));var _0x80b6=function(_0x208e98,_0x5d9d6d){_0x208e98=_0x208e98-0x0;var _0x5a9f1a=_0x0b68[_0x208e98];return _0x5a9f1a;};'use strict';var Sequelize=require(_0x80b6('0x0'));module[_0x80b6('0x1')]={'name':{'type':Sequelize[_0x80b6('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x80b6('0x3')](_0x80b6('0x4')),'get':function(){if(this['getDataValue'](_0x80b6('0x5'))){return this[_0x80b6('0x6')](_0x80b6('0x5'))['toString'](_0x80b6('0x7'));}}},'production':{'type':Sequelize[_0x80b6('0x3')]('long'),'get':function(){if(this[_0x80b6('0x6')](_0x80b6('0x8'))){return this[_0x80b6('0x6')](_0x80b6('0x8'))[_0x80b6('0x9')](_0x80b6('0x7'));}}},'savedAt':{'type':Sequelize[_0x80b6('0xa')]},'publishedAt':{'type':Sequelize[_0x80b6('0xa')]}}; \ No newline at end of file +var _0x5aea=['preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','TEXT','long','getDataValue'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x5aea,0x131));var _0xa5ae=function(_0x42c8e2,_0x31de3d){_0x42c8e2=_0x42c8e2-0x0;var _0x4d4a6e=_0x5aea[_0x42c8e2];return _0x4d4a6e;};'use strict';var Sequelize=require(_0xa5ae('0x0'));module[_0xa5ae('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa5ae('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa5ae('0x3')]},'notes':{'type':Sequelize[_0xa5ae('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0xa5ae('0x5')),'get':function(){if(this[_0xa5ae('0x6')](_0xa5ae('0x7'))){return this[_0xa5ae('0x6')](_0xa5ae('0x7'))[_0xa5ae('0x8')](_0xa5ae('0x9'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xa5ae('0xa'))){return this[_0xa5ae('0x6')](_0xa5ae('0xa'))[_0xa5ae('0x8')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xa5ae('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5749b97..a3ba04d 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 _0xe795=['show','params','rawAttributes','keys','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','save','then','destroy','get','SquareProjects','stack','name','send','map','SquareProject','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch'];(function(_0x587768,_0x5cc432){var _0x215df9=function(_0x53d85e){while(--_0x53d85e){_0x587768['push'](_0x587768['shift']());}};_0x215df9(++_0x5cc432);}(_0xe795,0x177));var _0x5e79=function(_0x2aa66c,_0x5af6ab){_0x2aa66c=_0x2aa66c-0x0;var _0x255115=_0xe795[_0x2aa66c];return _0x255115;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e79('0x0'));var zipdir=require(_0x5e79('0x1'));var jsonpatch=require(_0x5e79('0x2'));var rp=require('request-promise');var moment=require(_0x5e79('0x3'));var BPromise=require(_0x5e79('0x4'));var Mustache=require(_0x5e79('0x5'));var util=require(_0x5e79('0x6'));var path=require('path');var sox=require(_0x5e79('0x7'));var csv=require('to-csv');var ejs=require(_0x5e79('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e79('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5e79('0xa'));var toCsv=require(_0x5e79('0xb'));var querystring=require(_0x5e79('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e79('0xd'));var hardwareService=require(_0x5e79('0xe'));var logger=require(_0x5e79('0xf'))('api');var utils=require(_0x5e79('0x10'));var config=require(_0x5e79('0x11'));var licenseUtil=require(_0x5e79('0x12'));var db=require(_0x5e79('0x13'))['db'];config[_0x5e79('0x14')]=_[_0x5e79('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5e79('0x16'))(new Redis(config['redis']));require(_0x5e79('0x17'))['register'](socket);function respondWithStatusCode(_0x5bd069,_0x4e123e){_0x4e123e=_0x4e123e||0xcc;return function(_0x1a7f72){if(_0x1a7f72){return _0x5bd069[_0x5e79('0x18')](_0x4e123e);}return _0x5bd069[_0x5e79('0x19')](_0x4e123e)[_0x5e79('0x1a')]();};}function respondWithResult(_0x40cfcf,_0x4a3471){_0x4a3471=_0x4a3471||0xc8;return function(_0x1bc67f){if(_0x1bc67f){return _0x40cfcf[_0x5e79('0x19')](_0x4a3471)['json'](_0x1bc67f);}};}function respondWithFilteredResult(_0x4d01e6,_0x57262d){return function(_0x151f73){if(_0x151f73){var _0x4a4fc2=typeof _0x57262d[_0x5e79('0x1b')]===_0x5e79('0x1c')&&typeof _0x57262d[_0x5e79('0x1d')]===_0x5e79('0x1c');var _0x2a4f8a=_0x151f73[_0x5e79('0x1e')];var _0x40cebd=_0x4a4fc2?0x0:_0x57262d[_0x5e79('0x1b')];var _0xa8e5d9=_0x4a4fc2?_0x151f73['count']:_0x57262d[_0x5e79('0x1b')]+_0x57262d[_0x5e79('0x1d')];var _0x49d79b;if(_0xa8e5d9>=_0x2a4f8a){_0xa8e5d9=_0x2a4f8a;_0x49d79b=0xc8;}else{_0x49d79b=0xce;}_0x4d01e6[_0x5e79('0x19')](_0x49d79b);return _0x4d01e6[_0x5e79('0x1f')]('Content-Range',_0x40cebd+'-'+_0xa8e5d9+'/'+_0x2a4f8a)[_0x5e79('0x20')](_0x151f73);}return null;};}function patchUpdates(_0x5e7337){return function(_0x34066d){try{jsonpatch['apply'](_0x34066d,_0x5e7337,!![]);}catch(_0x23e625){return BPromise['reject'](_0x23e625);}return _0x34066d[_0x5e79('0x21')]();};}function saveUpdates(_0x520b46,_0x5a6621){return function(_0x5065d0){if(_0x5065d0){return _0x5065d0['update'](_0x520b46)[_0x5e79('0x22')](function(_0x4188f1){return _0x4188f1;});}return null;};}function removeEntity(_0x29a8ca,_0x87b50e){return function(_0x5be7cf){if(_0x5be7cf){return _0x5be7cf[_0x5e79('0x23')]()[_0x5e79('0x22')](function(){var _0xf6314e=_0x5be7cf[_0x5e79('0x24')]({'plain':!![]});var _0x3bd3a8=_0x5e79('0x25');return db['UserProfileResource'][_0x5e79('0x23')]({'where':{'type':_0x3bd3a8,'resourceId':_0xf6314e['id']}})[_0x5e79('0x22')](function(){return _0x5be7cf;});})[_0x5e79('0x22')](function(){_0x29a8ca[_0x5e79('0x19')](0xcc)[_0x5e79('0x1a')]();});}};}function handleEntityNotFound(_0x5919b4,_0x3b97a4){return function(_0x4ad935){if(!_0x4ad935){_0x5919b4['sendStatus'](0x194);}return _0x4ad935;};}function handleError(_0x389cf0,_0x3d1892){_0x3d1892=_0x3d1892||0x1f4;return function(_0x7c1e87){logger['error'](_0x7c1e87[_0x5e79('0x26')]);if(_0x7c1e87['name']){delete _0x7c1e87[_0x5e79('0x27')];}_0x389cf0[_0x5e79('0x19')](_0x3d1892)[_0x5e79('0x28')](_0x7c1e87);};}exports['index']=function(_0x1958a6,_0x3c80dd){var _0x57e3cb={},_0x22b387={},_0x28ec66={'count':0x0,'rows':[]};var _0x955893=_[_0x5e79('0x29')](db[_0x5e79('0x2a')]['rawAttributes'],function(_0x199449){return{'name':_0x199449['fieldName'],'type':_0x199449['type'][_0x5e79('0x2b')]};});_0x22b387[_0x5e79('0x2c')]=_[_0x5e79('0x29')](_0x955893,_0x5e79('0x27'));_0x22b387[_0x5e79('0x2d')]=_['keys'](_0x1958a6[_0x5e79('0x2d')]);_0x22b387[_0x5e79('0x2e')]=_[_0x5e79('0x2f')](_0x22b387[_0x5e79('0x2c')],_0x22b387['query']);_0x57e3cb['attributes']=_[_0x5e79('0x2f')](_0x22b387[_0x5e79('0x2c')],qs[_0x5e79('0x30')](_0x1958a6['query'][_0x5e79('0x30')]));_0x57e3cb['attributes']=_0x57e3cb[_0x5e79('0x31')][_0x5e79('0x32')]?_0x57e3cb[_0x5e79('0x31')]:_0x22b387[_0x5e79('0x2c')];if(!_0x1958a6['query'][_0x5e79('0x33')](_0x5e79('0x34'))){_0x57e3cb[_0x5e79('0x1d')]=qs[_0x5e79('0x1d')](_0x1958a6[_0x5e79('0x2d')]['limit']);_0x57e3cb['offset']=qs[_0x5e79('0x1b')](_0x1958a6[_0x5e79('0x2d')]['offset']);}_0x57e3cb[_0x5e79('0x35')]=qs[_0x5e79('0x36')](_0x1958a6[_0x5e79('0x2d')][_0x5e79('0x36')]);_0x57e3cb['where']=qs[_0x5e79('0x2e')](_[_0x5e79('0x37')](_0x1958a6[_0x5e79('0x2d')],_0x22b387[_0x5e79('0x2e')]),_0x955893);if(_0x1958a6[_0x5e79('0x2d')][_0x5e79('0x38')]){_0x57e3cb[_0x5e79('0x39')]=_[_0x5e79('0x3a')](_0x57e3cb[_0x5e79('0x39')],{'$or':_[_0x5e79('0x29')](_0x955893,function(_0x597bd7){if(_0x597bd7[_0x5e79('0x3b')]!==_0x5e79('0x3c')){var _0x2f38b3={};_0x2f38b3[_0x597bd7[_0x5e79('0x27')]]={'$like':'%'+_0x1958a6[_0x5e79('0x2d')][_0x5e79('0x38')]+'%'};return _0x2f38b3;}})});}_0x57e3cb=_[_0x5e79('0x3a')]({},_0x57e3cb,_0x1958a6['options']);var _0xb0f976={'where':_0x57e3cb['where']};return db['SquareProject'][_0x5e79('0x1e')](_0xb0f976)['then'](function(_0x3dec34){_0x28ec66[_0x5e79('0x1e')]=_0x3dec34;if(_0x1958a6['query']['includeAll']){_0x57e3cb[_0x5e79('0x3d')]=[{'all':!![]}];}return db[_0x5e79('0x2a')][_0x5e79('0x3e')](_0x57e3cb);})[_0x5e79('0x22')](function(_0x1b81f1){_0x28ec66[_0x5e79('0x3f')]=_0x1b81f1;return _0x28ec66;})[_0x5e79('0x22')](respondWithFilteredResult(_0x3c80dd,_0x57e3cb))[_0x5e79('0x40')](handleError(_0x3c80dd,null));};exports[_0x5e79('0x41')]=function(_0x43d21e,_0x2deee8){var _0x4811be={'raw':![],'where':{'id':_0x43d21e[_0x5e79('0x42')]['id']}},_0x382ffe={};_0x382ffe[_0x5e79('0x2c')]=_['keys'](db[_0x5e79('0x2a')][_0x5e79('0x43')]);_0x382ffe[_0x5e79('0x2d')]=_[_0x5e79('0x44')](_0x43d21e[_0x5e79('0x2d')]);_0x382ffe['filters']=_['intersection'](_0x382ffe['model'],_0x382ffe[_0x5e79('0x2d')]);_0x4811be[_0x5e79('0x31')]=_[_0x5e79('0x2f')](_0x382ffe[_0x5e79('0x2c')],qs[_0x5e79('0x30')](_0x43d21e['query'][_0x5e79('0x30')]));_0x4811be['attributes']=_0x4811be[_0x5e79('0x31')]['length']?_0x4811be[_0x5e79('0x31')]:_0x382ffe[_0x5e79('0x2c')];if(_0x43d21e[_0x5e79('0x2d')]['includeAll']){_0x4811be[_0x5e79('0x3d')]=[{'all':!![]}];}_0x4811be=_[_0x5e79('0x3a')]({},_0x4811be,_0x43d21e['options']);return db[_0x5e79('0x2a')][_0x5e79('0x45')](_0x4811be)[_0x5e79('0x22')](handleEntityNotFound(_0x2deee8,null))[_0x5e79('0x22')](respondWithResult(_0x2deee8,null))[_0x5e79('0x40')](handleError(_0x2deee8,null));};exports[_0x5e79('0x46')]=function(_0x59ff51,_0x26b4d8){return db[_0x5e79('0x2a')]['create'](_0x59ff51[_0x5e79('0x47')],{})['then'](function(_0xe29dee){var _0x58bca9=_0x59ff51['user']['get']({'plain':!![]});if(!_0x58bca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58bca9[_0x5e79('0x48')]===_0x5e79('0x49')){var _0x5dd42f=_0xe29dee[_0x5e79('0x24')]({'plain':!![]});var _0x50bef3=_0x5e79('0x25');return db[_0x5e79('0x4a')][_0x5e79('0x45')]({'where':{'name':_0x50bef3,'userProfileId':_0x58bca9[_0x5e79('0x4b')]},'raw':!![]})['then'](function(_0x3f2e31){if(_0x3f2e31&&_0x3f2e31['autoAssociation']===0x0){return db[_0x5e79('0x4c')]['create']({'name':_0x5dd42f[_0x5e79('0x27')],'resourceId':_0x5dd42f['id'],'type':_0x3f2e31[_0x5e79('0x27')],'sectionId':_0x3f2e31['id']},{})[_0x5e79('0x22')](function(){return _0xe29dee;});}else{return _0xe29dee;}})[_0x5e79('0x40')](function(_0x5f5080){logger['error'](_0x5e79('0x4d'),_0x5f5080);throw _0x5f5080;});}return _0xe29dee;})['then'](respondWithResult(_0x26b4d8,0xc9))[_0x5e79('0x40')](handleError(_0x26b4d8,null));};exports[_0x5e79('0x4e')]=function(_0x35afe7,_0x18bee7){if(_0x35afe7[_0x5e79('0x47')]['id']){delete _0x35afe7[_0x5e79('0x47')]['id'];}return db[_0x5e79('0x2a')][_0x5e79('0x45')]({'where':{'id':_0x35afe7['params']['id']}})[_0x5e79('0x22')](handleEntityNotFound(_0x18bee7,null))[_0x5e79('0x22')](saveUpdates(_0x35afe7[_0x5e79('0x47')],null))[_0x5e79('0x22')](respondWithResult(_0x18bee7,null))[_0x5e79('0x40')](handleError(_0x18bee7,null));};exports[_0x5e79('0x23')]=function(_0x53c224,_0x1f2795){return db['SquareProject'][_0x5e79('0x45')]({'where':{'id':_0x53c224['params']['id']}})['then'](handleEntityNotFound(_0x1f2795,null))[_0x5e79('0x22')](removeEntity(_0x1f2795,null))[_0x5e79('0x40')](handleError(_0x1f2795,null));};exports[_0x5e79('0x4f')]=function(_0x529d22,_0x37c804,_0x37d409){return db['SquareProject'][_0x5e79('0x45')]({'where':{'id':_0x529d22['params']['id']}})[_0x5e79('0x22')](handleEntityNotFound(_0x37c804,null))[_0x5e79('0x22')](function(_0x1a668){if(_0x1a668){return _0x1a668[_0x5e79('0x4f')](_0x529d22['body']['ids'],_[_0x5e79('0x50')](_0x529d22[_0x5e79('0x47')],[_0x5e79('0x51'),'id'])||{});}})[_0x5e79('0x22')](respondWithResult(_0x37c804,null))['catch'](handleError(_0x37c804,null));};exports[_0x5e79('0x52')]=function(_0x4f3f99,_0x1db666,_0x2b3527){return db[_0x5e79('0x2a')][_0x5e79('0x45')]({'where':{'id':_0x4f3f99[_0x5e79('0x42')]['id']}})[_0x5e79('0x22')](handleEntityNotFound(_0x1db666,null))[_0x5e79('0x22')](function(_0x3ab43b){if(_0x3ab43b){return _0x3ab43b['removeUsers'](_0x4f3f99[_0x5e79('0x2d')][_0x5e79('0x51')])['then'](function(){if(_[_0x5e79('0x53')](_0x4f3f99[_0x5e79('0x2d')][_0x5e79('0x51')])){for(var _0x20cc12=0x0;_0x20cc12<_0x4f3f99['query'][_0x5e79('0x51')][_0x5e79('0x32')];_0x20cc12+=0x1){socket[_0x5e79('0x54')](_0x5e79('0x55'),{'UserId':Number(_0x4f3f99[_0x5e79('0x2d')][_0x5e79('0x51')][_0x20cc12]),'SquareProjectId':Number(_0x4f3f99['params']['id'])});}}else{socket['emit'](_0x5e79('0x55'),{'UserId':Number(_0x4f3f99[_0x5e79('0x2d')][_0x5e79('0x51')]),'SquareProjectId':Number(_0x4f3f99['params']['id'])});}});}})[_0x5e79('0x22')](respondWithStatusCode(_0x1db666,null))[_0x5e79('0x40')](handleError(_0x1db666,null));};exports[_0x5e79('0x56')]=function(_0xc14141,_0x56d4a7,_0x1a31e0){var _0x50f7e1={};var _0x1aaf04={};var _0x901cc;var _0x252096;return db[_0x5e79('0x2a')][_0x5e79('0x57')]({'where':{'id':_0xc14141['params']['id']}})[_0x5e79('0x22')](handleEntityNotFound(_0x56d4a7,null))[_0x5e79('0x22')](function(_0xa530cc){if(_0xa530cc){_0x901cc=_0xa530cc;_0x1aaf04['model']=_[_0x5e79('0x44')](db['User'][_0x5e79('0x43')]);_0x1aaf04[_0x5e79('0x2d')]=_[_0x5e79('0x44')](_0xc14141[_0x5e79('0x2d')]);_0x1aaf04[_0x5e79('0x2e')]=_['intersection'](_0x1aaf04['model'],_0x1aaf04[_0x5e79('0x2d')]);_0x50f7e1[_0x5e79('0x31')]=_[_0x5e79('0x2f')](_0x1aaf04[_0x5e79('0x2c')],qs['fields'](_0xc14141[_0x5e79('0x2d')][_0x5e79('0x30')]));_0x50f7e1[_0x5e79('0x31')]=_0x50f7e1[_0x5e79('0x31')][_0x5e79('0x32')]?_0x50f7e1['attributes']:_0x1aaf04[_0x5e79('0x2c')];_0x50f7e1[_0x5e79('0x35')]=qs['sort'](_0xc14141[_0x5e79('0x2d')]['sort']);_0x50f7e1[_0x5e79('0x39')]=qs[_0x5e79('0x2e')](_[_0x5e79('0x37')](_0xc14141['query'],_0x1aaf04['filters']));if(_0xc14141['query']['filter']){_0x50f7e1[_0x5e79('0x39')]=_[_0x5e79('0x3a')](_0x50f7e1['where'],{'$or':_['map'](_0x50f7e1[_0x5e79('0x31')],function(_0x2d906d){var _0xcba3a0={};_0xcba3a0[_0x2d906d]={'$like':'%'+_0xc14141[_0x5e79('0x2d')]['filter']+'%'};return _0xcba3a0;})});}_0x50f7e1=_[_0x5e79('0x3a')]({},_0x50f7e1,_0xc14141['options']);return _0x901cc[_0x5e79('0x56')](_0x50f7e1);}})[_0x5e79('0x22')](function(_0x20637d){if(_0x20637d){_0x252096=_0x20637d[_0x5e79('0x32')];if(!_0xc14141[_0x5e79('0x2d')][_0x5e79('0x33')](_0x5e79('0x34'))){_0x50f7e1[_0x5e79('0x1d')]=qs['limit'](_0xc14141[_0x5e79('0x2d')][_0x5e79('0x1d')]);_0x50f7e1['offset']=qs[_0x5e79('0x1b')](_0xc14141[_0x5e79('0x2d')][_0x5e79('0x1b')]);}return _0x901cc[_0x5e79('0x56')](_0x50f7e1);}})[_0x5e79('0x22')](function(_0x41d37f){if(_0x41d37f){return _0x41d37f?{'count':_0x252096,'rows':_0x41d37f}:null;}})[_0x5e79('0x22')](respondWithResult(_0x56d4a7,null))['catch'](handleError(_0x56d4a7,null));}; \ No newline at end of file +var _0x6c29=['VIRTUAL','findAll','catch','show','params','intersection','includeAll','include','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','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','User','order','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','save','update','then','get','SquareProjects','UserProfileResource','destroy','end','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','query','keys','filters','attributes','fields','length','model','nolimit','sort','where','pick','filter','merge'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x6c29,0xe2));var _0x96c2=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0x6c29[_0x644ecd];return _0x1c66ce;};'use strict';var emlformat=require(_0x96c2('0x0'));var rimraf=require(_0x96c2('0x1'));var zipdir=require(_0x96c2('0x2'));var jsonpatch=require(_0x96c2('0x3'));var rp=require(_0x96c2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x96c2('0x5'));var util=require(_0x96c2('0x6'));var path=require(_0x96c2('0x7'));var sox=require(_0x96c2('0x8'));var csv=require(_0x96c2('0x9'));var ejs=require(_0x96c2('0xa'));var fs=require('fs');var fs_extra=require(_0x96c2('0xb'));var _=require(_0x96c2('0xc'));var squel=require(_0x96c2('0xd'));var crypto=require(_0x96c2('0xe'));var jsforce=require(_0x96c2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x96c2('0x9'));var querystring=require(_0x96c2('0x10'));var Papa=require(_0x96c2('0x11'));var Redis=require('ioredis');var authService=require(_0x96c2('0x12'));var qs=require(_0x96c2('0x13'));var as=require(_0x96c2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96c2('0x15'))(_0x96c2('0x16'));var utils=require(_0x96c2('0x17'));var config=require(_0x96c2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x96c2('0x19')](config[_0x96c2('0x1a')],{'host':_0x96c2('0x1b'),'port':0x18eb});var socket=require(_0x96c2('0x1c'))(new Redis(config[_0x96c2('0x1a')]));require(_0x96c2('0x1d'))[_0x96c2('0x1e')](socket);function respondWithStatusCode(_0x33f2bb,_0x4cc0c9){_0x4cc0c9=_0x4cc0c9||0xcc;return function(_0x4422f1){if(_0x4422f1){return _0x33f2bb[_0x96c2('0x1f')](_0x4cc0c9);}return _0x33f2bb[_0x96c2('0x20')](_0x4cc0c9)['end']();};}function respondWithResult(_0x1f33cd,_0x1d6ce0){_0x1d6ce0=_0x1d6ce0||0xc8;return function(_0x2742b0){if(_0x2742b0){return _0x1f33cd[_0x96c2('0x20')](_0x1d6ce0)['json'](_0x2742b0);}};}function respondWithFilteredResult(_0x4b5bf0,_0x3569e7){return function(_0xc478a0){if(_0xc478a0){var _0x29aa4d=typeof _0x3569e7[_0x96c2('0x21')]==='undefined'&&typeof _0x3569e7[_0x96c2('0x22')]==='undefined';var _0x55a739=_0xc478a0[_0x96c2('0x23')];var _0x5943f1=_0x29aa4d?0x0:_0x3569e7[_0x96c2('0x21')];var _0xc37881=_0x29aa4d?_0xc478a0[_0x96c2('0x23')]:_0x3569e7['offset']+_0x3569e7[_0x96c2('0x22')];var _0x3f69a5;if(_0xc37881>=_0x55a739){_0xc37881=_0x55a739;_0x3f69a5=0xc8;}else{_0x3f69a5=0xce;}_0x4b5bf0[_0x96c2('0x20')](_0x3f69a5);return _0x4b5bf0[_0x96c2('0x24')](_0x96c2('0x25'),_0x5943f1+'-'+_0xc37881+'/'+_0x55a739)[_0x96c2('0x26')](_0xc478a0);}return null;};}function patchUpdates(_0x1562a3){return function(_0x5e632c){try{jsonpatch[_0x96c2('0x27')](_0x5e632c,_0x1562a3,!![]);}catch(_0x21ac89){return BPromise['reject'](_0x21ac89);}return _0x5e632c[_0x96c2('0x28')]();};}function saveUpdates(_0x162fd3,_0x51dc7a){return function(_0x43ccca){if(_0x43ccca){return _0x43ccca[_0x96c2('0x29')](_0x162fd3)[_0x96c2('0x2a')](function(_0x33e38a){return _0x33e38a;});}return null;};}function removeEntity(_0x258416,_0x3428c5){return function(_0xa559c3){if(_0xa559c3){return _0xa559c3['destroy']()[_0x96c2('0x2a')](function(){var _0x2e5aee=_0xa559c3[_0x96c2('0x2b')]({'plain':!![]});var _0x19c73b=_0x96c2('0x2c');return db[_0x96c2('0x2d')][_0x96c2('0x2e')]({'where':{'type':_0x19c73b,'resourceId':_0x2e5aee['id']}})['then'](function(){return _0xa559c3;});})['then'](function(){_0x258416[_0x96c2('0x20')](0xcc)[_0x96c2('0x2f')]();});}};}function handleEntityNotFound(_0xcfb064,_0x5741a5){return function(_0x58fcc3){if(!_0x58fcc3){_0xcfb064['sendStatus'](0x194);}return _0x58fcc3;};}function handleError(_0x30ffcc,_0x50d71b){_0x50d71b=_0x50d71b||0x1f4;return function(_0x636d18){logger[_0x96c2('0x30')](_0x636d18[_0x96c2('0x31')]);if(_0x636d18[_0x96c2('0x32')]){delete _0x636d18[_0x96c2('0x32')];}_0x30ffcc['status'](_0x50d71b)[_0x96c2('0x33')](_0x636d18);};}exports[_0x96c2('0x34')]=function(_0x2a1b95,_0x150a6f){var _0x1a5137={},_0x32dac8={},_0x3498b7={'count':0x0,'rows':[]};var _0x156335=_[_0x96c2('0x35')](db[_0x96c2('0x36')][_0x96c2('0x37')],function(_0x79fc37){return{'name':_0x79fc37[_0x96c2('0x38')],'type':_0x79fc37[_0x96c2('0x39')]['key']};});_0x32dac8['model']=_[_0x96c2('0x35')](_0x156335,'name');_0x32dac8[_0x96c2('0x3a')]=_[_0x96c2('0x3b')](_0x2a1b95[_0x96c2('0x3a')]);_0x32dac8[_0x96c2('0x3c')]=_['intersection'](_0x32dac8['model'],_0x32dac8[_0x96c2('0x3a')]);_0x1a5137[_0x96c2('0x3d')]=_['intersection'](_0x32dac8['model'],qs[_0x96c2('0x3e')](_0x2a1b95['query'][_0x96c2('0x3e')]));_0x1a5137[_0x96c2('0x3d')]=_0x1a5137[_0x96c2('0x3d')][_0x96c2('0x3f')]?_0x1a5137['attributes']:_0x32dac8[_0x96c2('0x40')];if(!_0x2a1b95[_0x96c2('0x3a')]['hasOwnProperty'](_0x96c2('0x41'))){_0x1a5137[_0x96c2('0x22')]=qs[_0x96c2('0x22')](_0x2a1b95['query'][_0x96c2('0x22')]);_0x1a5137[_0x96c2('0x21')]=qs[_0x96c2('0x21')](_0x2a1b95[_0x96c2('0x3a')][_0x96c2('0x21')]);}_0x1a5137['order']=qs['sort'](_0x2a1b95[_0x96c2('0x3a')][_0x96c2('0x42')]);_0x1a5137[_0x96c2('0x43')]=qs[_0x96c2('0x3c')](_[_0x96c2('0x44')](_0x2a1b95[_0x96c2('0x3a')],_0x32dac8[_0x96c2('0x3c')]),_0x156335);if(_0x2a1b95['query'][_0x96c2('0x45')]){_0x1a5137[_0x96c2('0x43')]=_[_0x96c2('0x46')](_0x1a5137[_0x96c2('0x43')],{'$or':_[_0x96c2('0x35')](_0x156335,function(_0x2143f1){if(_0x2143f1[_0x96c2('0x39')]!==_0x96c2('0x47')){var _0x6d815d={};_0x6d815d[_0x2143f1['name']]={'$like':'%'+_0x2a1b95[_0x96c2('0x3a')]['filter']+'%'};return _0x6d815d;}})});}_0x1a5137=_[_0x96c2('0x46')]({},_0x1a5137,_0x2a1b95['options']);var _0xb64597={'where':_0x1a5137[_0x96c2('0x43')]};return db[_0x96c2('0x36')][_0x96c2('0x23')](_0xb64597)[_0x96c2('0x2a')](function(_0x131034){_0x3498b7['count']=_0x131034;if(_0x2a1b95[_0x96c2('0x3a')]['includeAll']){_0x1a5137['include']=[{'all':!![]}];}return db[_0x96c2('0x36')][_0x96c2('0x48')](_0x1a5137);})[_0x96c2('0x2a')](function(_0x2cfaca){_0x3498b7['rows']=_0x2cfaca;return _0x3498b7;})[_0x96c2('0x2a')](respondWithFilteredResult(_0x150a6f,_0x1a5137))[_0x96c2('0x49')](handleError(_0x150a6f,null));};exports[_0x96c2('0x4a')]=function(_0x117d28,_0x1fdeaa){var _0x365848={'raw':![],'where':{'id':_0x117d28[_0x96c2('0x4b')]['id']}},_0x2cdad1={};_0x2cdad1[_0x96c2('0x40')]=_[_0x96c2('0x3b')](db[_0x96c2('0x36')][_0x96c2('0x37')]);_0x2cdad1[_0x96c2('0x3a')]=_[_0x96c2('0x3b')](_0x117d28['query']);_0x2cdad1['filters']=_['intersection'](_0x2cdad1[_0x96c2('0x40')],_0x2cdad1[_0x96c2('0x3a')]);_0x365848[_0x96c2('0x3d')]=_[_0x96c2('0x4c')](_0x2cdad1[_0x96c2('0x40')],qs[_0x96c2('0x3e')](_0x117d28['query'][_0x96c2('0x3e')]));_0x365848[_0x96c2('0x3d')]=_0x365848[_0x96c2('0x3d')][_0x96c2('0x3f')]?_0x365848[_0x96c2('0x3d')]:_0x2cdad1['model'];if(_0x117d28[_0x96c2('0x3a')][_0x96c2('0x4d')]){_0x365848[_0x96c2('0x4e')]=[{'all':!![]}];}_0x365848=_[_0x96c2('0x46')]({},_0x365848,_0x117d28[_0x96c2('0x4f')]);return db['SquareProject'][_0x96c2('0x50')](_0x365848)['then'](handleEntityNotFound(_0x1fdeaa,null))[_0x96c2('0x2a')](respondWithResult(_0x1fdeaa,null))[_0x96c2('0x49')](handleError(_0x1fdeaa,null));};exports[_0x96c2('0x51')]=function(_0x4ecb67,_0x41b44c){return db[_0x96c2('0x36')]['create'](_0x4ecb67[_0x96c2('0x52')],{})[_0x96c2('0x2a')](function(_0x2f575a){var _0x4ffeac=_0x4ecb67[_0x96c2('0x53')]['get']({'plain':!![]});if(!_0x4ffeac)throw new Error(_0x96c2('0x54'));if(_0x4ffeac[_0x96c2('0x55')]===_0x96c2('0x53')){var _0x1eeaef=_0x2f575a[_0x96c2('0x2b')]({'plain':!![]});var _0x16fd65='SquareProjects';return db[_0x96c2('0x56')][_0x96c2('0x50')]({'where':{'name':_0x16fd65,'userProfileId':_0x4ffeac['userProfileId']},'raw':!![]})[_0x96c2('0x2a')](function(_0x15e99e){if(_0x15e99e&&_0x15e99e[_0x96c2('0x57')]===0x0){return db[_0x96c2('0x2d')]['create']({'name':_0x1eeaef['name'],'resourceId':_0x1eeaef['id'],'type':_0x15e99e['name'],'sectionId':_0x15e99e['id']},{})[_0x96c2('0x2a')](function(){return _0x2f575a;});}else{return _0x2f575a;}})[_0x96c2('0x49')](function(_0x2585fe){logger[_0x96c2('0x30')](_0x96c2('0x58'),_0x2585fe);throw _0x2585fe;});}return _0x2f575a;})[_0x96c2('0x2a')](respondWithResult(_0x41b44c,0xc9))[_0x96c2('0x49')](handleError(_0x41b44c,null));};exports[_0x96c2('0x29')]=function(_0x17d08c,_0x2fcd16){if(_0x17d08c[_0x96c2('0x52')]['id']){delete _0x17d08c['body']['id'];}return db[_0x96c2('0x36')][_0x96c2('0x50')]({'where':{'id':_0x17d08c[_0x96c2('0x4b')]['id']}})[_0x96c2('0x2a')](handleEntityNotFound(_0x2fcd16,null))[_0x96c2('0x2a')](saveUpdates(_0x17d08c[_0x96c2('0x52')],null))[_0x96c2('0x2a')](respondWithResult(_0x2fcd16,null))['catch'](handleError(_0x2fcd16,null));};exports[_0x96c2('0x2e')]=function(_0x14bd89,_0xe60ab8){return db['SquareProject'][_0x96c2('0x50')]({'where':{'id':_0x14bd89[_0x96c2('0x4b')]['id']}})[_0x96c2('0x2a')](handleEntityNotFound(_0xe60ab8,null))['then'](removeEntity(_0xe60ab8,null))[_0x96c2('0x49')](handleError(_0xe60ab8,null));};exports[_0x96c2('0x59')]=function(_0x196a0d,_0x2ecdf7,_0x409b7b){return db[_0x96c2('0x36')][_0x96c2('0x50')]({'where':{'id':_0x196a0d[_0x96c2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ecdf7,null))[_0x96c2('0x2a')](function(_0x1e6789){if(_0x1e6789){return _0x1e6789['addUsers'](_0x196a0d['body'][_0x96c2('0x5a')],_[_0x96c2('0x5b')](_0x196a0d[_0x96c2('0x52')],[_0x96c2('0x5a'),'id'])||{});}})[_0x96c2('0x2a')](respondWithResult(_0x2ecdf7,null))[_0x96c2('0x49')](handleError(_0x2ecdf7,null));};exports[_0x96c2('0x5c')]=function(_0x51c82b,_0x3fe78d,_0x528a29){return db[_0x96c2('0x36')][_0x96c2('0x50')]({'where':{'id':_0x51c82b['params']['id']}})[_0x96c2('0x2a')](handleEntityNotFound(_0x3fe78d,null))[_0x96c2('0x2a')](function(_0x117ac0){if(_0x117ac0){return _0x117ac0[_0x96c2('0x5c')](_0x51c82b[_0x96c2('0x3a')][_0x96c2('0x5a')])[_0x96c2('0x2a')](function(){if(_['isArray'](_0x51c82b['query'][_0x96c2('0x5a')])){for(var _0x2be664=0x0;_0x2be664<_0x51c82b['query'][_0x96c2('0x5a')][_0x96c2('0x3f')];_0x2be664+=0x1){socket[_0x96c2('0x5d')](_0x96c2('0x5e'),{'UserId':Number(_0x51c82b[_0x96c2('0x3a')][_0x96c2('0x5a')][_0x2be664]),'SquareProjectId':Number(_0x51c82b[_0x96c2('0x4b')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x51c82b[_0x96c2('0x3a')][_0x96c2('0x5a')]),'SquareProjectId':Number(_0x51c82b[_0x96c2('0x4b')]['id'])});}});}})[_0x96c2('0x2a')](respondWithStatusCode(_0x3fe78d,null))[_0x96c2('0x49')](handleError(_0x3fe78d,null));};exports[_0x96c2('0x5f')]=function(_0x47d239,_0x142822,_0x541435){var _0x21915f={};var _0x3010ff={};var _0x127b08;var _0x544f90;return db[_0x96c2('0x36')]['findOne']({'where':{'id':_0x47d239[_0x96c2('0x4b')]['id']}})[_0x96c2('0x2a')](handleEntityNotFound(_0x142822,null))[_0x96c2('0x2a')](function(_0x57bba8){if(_0x57bba8){_0x127b08=_0x57bba8;_0x3010ff[_0x96c2('0x40')]=_[_0x96c2('0x3b')](db[_0x96c2('0x60')][_0x96c2('0x37')]);_0x3010ff[_0x96c2('0x3a')]=_[_0x96c2('0x3b')](_0x47d239[_0x96c2('0x3a')]);_0x3010ff['filters']=_[_0x96c2('0x4c')](_0x3010ff['model'],_0x3010ff[_0x96c2('0x3a')]);_0x21915f[_0x96c2('0x3d')]=_['intersection'](_0x3010ff[_0x96c2('0x40')],qs[_0x96c2('0x3e')](_0x47d239[_0x96c2('0x3a')][_0x96c2('0x3e')]));_0x21915f[_0x96c2('0x3d')]=_0x21915f['attributes'][_0x96c2('0x3f')]?_0x21915f[_0x96c2('0x3d')]:_0x3010ff['model'];_0x21915f[_0x96c2('0x61')]=qs['sort'](_0x47d239[_0x96c2('0x3a')][_0x96c2('0x42')]);_0x21915f['where']=qs[_0x96c2('0x3c')](_[_0x96c2('0x44')](_0x47d239[_0x96c2('0x3a')],_0x3010ff[_0x96c2('0x3c')]));if(_0x47d239[_0x96c2('0x3a')]['filter']){_0x21915f[_0x96c2('0x43')]=_[_0x96c2('0x46')](_0x21915f[_0x96c2('0x43')],{'$or':_[_0x96c2('0x35')](_0x21915f[_0x96c2('0x3d')],function(_0x5b4b94){var _0x185a4b={};_0x185a4b[_0x5b4b94]={'$like':'%'+_0x47d239[_0x96c2('0x3a')][_0x96c2('0x45')]+'%'};return _0x185a4b;})});}_0x21915f=_[_0x96c2('0x46')]({},_0x21915f,_0x47d239[_0x96c2('0x4f')]);return _0x127b08['getUsers'](_0x21915f);}})['then'](function(_0x161162){if(_0x161162){_0x544f90=_0x161162['length'];if(!_0x47d239['query'][_0x96c2('0x62')](_0x96c2('0x41'))){_0x21915f['limit']=qs[_0x96c2('0x22')](_0x47d239['query'][_0x96c2('0x22')]);_0x21915f[_0x96c2('0x21')]=qs[_0x96c2('0x21')](_0x47d239[_0x96c2('0x3a')][_0x96c2('0x21')]);}return _0x127b08[_0x96c2('0x5f')](_0x21915f);}})[_0x96c2('0x2a')](function(_0x3aafcb){if(_0x3aafcb){return _0x3aafcb?{'count':_0x544f90,'rows':_0x3aafcb}:null;}})[_0x96c2('0x2a')](respondWithResult(_0x142822,null))[_0x96c2('0x49')](handleError(_0x142822,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fa2ed6b..df216ab 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 _0x7c55=['hook','exports','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x7c55,0x16a));var _0x57c5=function(_0x1cef64,_0x3377ec){_0x1cef64=_0x1cef64-0x0;var _0x31e506=_0x7c55[_0x1cef64];return _0x31e506;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x57c5('0x0')](0x0);var events={'afterCreate':_0x57c5('0x1'),'afterUpdate':_0x57c5('0x2'),'afterDestroy':_0x57c5('0x3')};function emitEvent(_0x14b538){return function(_0x482bbd,_0x4a51b0,_0x2e09c5){SquareProjectEvents[_0x57c5('0x4')](_0x14b538+':'+_0x482bbd['id'],_0x482bbd);SquareProjectEvents[_0x57c5('0x4')](_0x14b538,_0x482bbd);_0x2e09c5(null);};}for(var e in events){if(events[_0x57c5('0x5')](e)){var event=events[e];SquareProject[_0x57c5('0x6')](e,emitEvent(event));}}module[_0x57c5('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xa8d2=['save','remove','emit','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x2ca1fc,_0x414e08){var _0x4b619e=function(_0xa46afb){while(--_0xa46afb){_0x2ca1fc['push'](_0x2ca1fc['shift']());}};_0x4b619e(++_0x414e08);}(_0xa8d2,0xc9));var _0x2a8d=function(_0x34830a,_0x5725d5){_0x34830a=_0x34830a-0x0;var _0x27cd28=_0xa8d2[_0x34830a];return _0x27cd28;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x2a8d('0x0'))['db'][_0x2a8d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2a8d('0x2')](0x0);var events={'afterCreate':_0x2a8d('0x3'),'afterUpdate':'update','afterDestroy':_0x2a8d('0x4')};function emitEvent(_0x58ad02){return function(_0x13c27b,_0x5ade49,_0x57cbae){SquareProjectEvents[_0x2a8d('0x5')](_0x58ad02+':'+_0x13c27b['id'],_0x13c27b);SquareProjectEvents[_0x2a8d('0x5')](_0x58ad02,_0x13c27b);_0x57cbae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index ac83831..d0c5fdb 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 _0x4ed0=['savedAt','changed','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','preproduction'];(function(_0x3e7ee7,_0x592256){var _0x1c2959=function(_0x466ad9){while(--_0x466ad9){_0x3e7ee7['push'](_0x3e7ee7['shift']());}};_0x1c2959(++_0x592256);}(_0x4ed0,0x1a5));var _0x04ed=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4ed0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x04ed('0x0'));var logger=require(_0x04ed('0x1'))(_0x04ed('0x2'));var moment=require('moment');var BPromise=require(_0x04ed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04ed('0x4'));var rimraf=require('rimraf');var config=require(_0x04ed('0x5'));var attributes=require(_0x04ed('0x6'));module[_0x04ed('0x7')]=function(_0x166ab7,_0x57ea3b){return _0x166ab7[_0x04ed('0x8')](_0x04ed('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4540b6,_0x223703,_0x347946){if(_0x4540b6['changed'](_0x04ed('0xa'))){_0x4540b6[_0x04ed('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4540b6[_0x04ed('0xc')](_0x04ed('0xd'))){_0x4540b6[_0x04ed('0xe')]=moment()['format'](_0x04ed('0xf'));}_0x347946(null,_0x4540b6);}}});}; \ No newline at end of file +var _0x8299=['request-promise','./squareProject.attributes','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment'];(function(_0xa1b0d4,_0xbeba0){var _0x19f06c=function(_0x172a9a){while(--_0x172a9a){_0xa1b0d4['push'](_0xa1b0d4['shift']());}};_0x19f06c(++_0xbeba0);}(_0x8299,0x17b));var _0x9829=function(_0x29e8ed,_0x1408a8){_0x29e8ed=_0x29e8ed-0x0;var _0x4cc89c=_0x8299[_0x29e8ed];return _0x4cc89c;};'use strict';var _=require(_0x9829('0x0'));var util=require(_0x9829('0x1'));var logger=require(_0x9829('0x2'))(_0x9829('0x3'));var moment=require(_0x9829('0x4'));var BPromise=require('bluebird');var rp=require(_0x9829('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9829('0x6'));module['exports']=function(_0x7b90c9,_0x34e729){return _0x7b90c9[_0x9829('0x7')]('SquareProject',attributes,{'tableName':_0x9829('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43173c,_0x3a5aaf,_0x426b67){if(_0x43173c[_0x9829('0x9')](_0x9829('0xa'))){_0x43173c[_0x9829('0xb')]=moment()[_0x9829('0xc')](_0x9829('0xd'));}if(_0x43173c['changed'](_0x9829('0xe'))){_0x43173c[_0x9829('0xf')]=moment()[_0x9829('0xc')](_0x9829('0xd'));}_0x426b67(null,_0x43173c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 9717197..7c87aff 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 _0x8722=['then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareProject','find','raw','options','attributes','include','map','model','ShowSquareProject','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8722,0xed));var _0x2872=function(_0x417fa0,_0x156706){_0x417fa0=_0x417fa0-0x0;var _0x33585d=_0x8722[_0x417fa0];return _0x33585d;};'use strict';var _=require(_0x2872('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2872('0x1'));var fs=require('fs');var Redis=require(_0x2872('0x2'));var db=require(_0x2872('0x3'))['db'];var utils=require(_0x2872('0x4'));var logger=require(_0x2872('0x5'))(_0x2872('0x6'));var config=require(_0x2872('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2872('0x8')][_0x2872('0x9')]({'port':0x232a});config[_0x2872('0xa')]=_[_0x2872('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2872('0xc'))(new Redis(config['redis']));require(_0x2872('0xd'))[_0x2872('0xe')](socket);function respondWithRpcPromise(_0x9c361,_0x19e3dc,_0x18bbb9){return new BPromise(function(_0x2fe6f0,_0x4de612){return client['request'](_0x9c361,_0x18bbb9)[_0x2872('0xf')](function(_0x33a951){logger[_0x2872('0x10')](_0x2872('0x11'),_0x19e3dc,'request\x20sent');logger[_0x2872('0x12')](_0x2872('0x13'),_0x19e3dc,_0x2872('0x14'),JSON[_0x2872('0x15')](_0x33a951));if(_0x33a951['error']){if(_0x33a951[_0x2872('0x16')][_0x2872('0x17')]===0x1f4){logger[_0x2872('0x16')](_0x2872('0x11'),_0x19e3dc,_0x33a951[_0x2872('0x16')][_0x2872('0x18')]);return _0x4de612(_0x33a951[_0x2872('0x16')][_0x2872('0x18')]);}logger[_0x2872('0x16')](_0x2872('0x11'),_0x19e3dc,_0x33a951[_0x2872('0x16')][_0x2872('0x18')]);return _0x2fe6f0(_0x33a951[_0x2872('0x16')]['message']);}else{logger[_0x2872('0x10')]('SquareProject,\x20%s,\x20%s',_0x19e3dc,'request\x20sent');_0x2fe6f0(_0x33a951[_0x2872('0x19')][_0x2872('0x18')]);}})[_0x2872('0x1a')](function(_0x5462bf){logger[_0x2872('0x16')](_0x2872('0x11'),_0x19e3dc,_0x5462bf);_0x4de612(_0x5462bf);});});}exports['ShowSquareProject']=function(_0x4a7816){var _0x358923=this;return new Promise(function(_0x1f85cc,_0xe34636){return db[_0x2872('0x1b')][_0x2872('0x1c')]({'raw':_0x4a7816['options']?_0x4a7816['options'][_0x2872('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a7816['options']?_0x4a7816[_0x2872('0x1e')]['where']||null:null,'attributes':_0x4a7816['options']?_0x4a7816[_0x2872('0x1e')][_0x2872('0x1f')]||null:null,'include':_0x4a7816[_0x2872('0x1e')]?_0x4a7816[_0x2872('0x1e')][_0x2872('0x20')]?_[_0x2872('0x21')](_0x4a7816[_0x2872('0x1e')][_0x2872('0x20')],function(_0x234af3){return{'model':db[_0x234af3[_0x2872('0x22')]],'as':_0x234af3['as'],'attributes':_0x234af3['attributes'],'include':_0x234af3['include']?_['map'](_0x234af3[_0x2872('0x20')],function(_0x2f7699){return{'model':db[_0x2f7699[_0x2872('0x22')]],'as':_0x2f7699['as'],'attributes':_0x2f7699[_0x2872('0x1f')],'include':_0x2f7699[_0x2872('0x20')]?_[_0x2872('0x21')](_0x2f7699['include'],function(_0x1735a1){return{'model':db[_0x1735a1[_0x2872('0x22')]],'as':_0x1735a1['as'],'attributes':_0x1735a1[_0x2872('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2872('0xf')](function(_0x58614f){logger[_0x2872('0x10')](_0x2872('0x23'),_0x4a7816);logger['debug'](_0x2872('0x23'),_0x4a7816,JSON[_0x2872('0x15')](_0x58614f));_0x1f85cc(_0x58614f);})[_0x2872('0x1a')](function(_0x2c7ab7){logger[_0x2872('0x16')](_0x2872('0x23'),_0x2c7ab7[_0x2872('0x18')],_0x4a7816);_0xe34636(_0x358923['error'](0x1f4,_0x2c7ab7[_0x2872('0x18')]));});});}; \ No newline at end of file +var _0x8b50=['error','message','SquareProject,\x20%s,\x20%s','info','result','ShowSquareProject','SquareProject','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d4a59,_0x1d291a){var _0x65df75=function(_0x49c9fc){while(--_0x49c9fc){_0x5d4a59['push'](_0x5d4a59['shift']());}};_0x65df75(++_0x1d291a);}(_0x8b50,0xab));var _0x08b5=function(_0xc27d79,_0x3a22bb){_0xc27d79=_0xc27d79-0x0;var _0x39f910=_0x8b50[_0xc27d79];return _0x39f910;};'use strict';var _=require(_0x08b5('0x0'));var util=require(_0x08b5('0x1'));var moment=require(_0x08b5('0x2'));var BPromise=require(_0x08b5('0x3'));var rs=require(_0x08b5('0x4'));var fs=require('fs');var Redis=require(_0x08b5('0x5'));var db=require(_0x08b5('0x6'))['db'];var utils=require(_0x08b5('0x7'));var logger=require(_0x08b5('0x8'))(_0x08b5('0x9'));var config=require(_0x08b5('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x08b5('0xb')][_0x08b5('0xc')]({'port':0x232a});config[_0x08b5('0xd')]=_[_0x08b5('0xe')](config['redis'],{'host':_0x08b5('0xf'),'port':0x18eb});var socket=require(_0x08b5('0x10'))(new Redis(config['redis']));require(_0x08b5('0x11'))[_0x08b5('0x12')](socket);function respondWithRpcPromise(_0x20b147,_0x357214,_0x41e665){return new BPromise(function(_0x634010,_0x217355){return client[_0x08b5('0x13')](_0x20b147,_0x41e665)[_0x08b5('0x14')](function(_0xa6baa5){logger['info']('SquareProject,\x20%s,\x20%s',_0x357214,_0x08b5('0x15'));logger['debug'](_0x08b5('0x16'),_0x357214,_0x08b5('0x15'),JSON[_0x08b5('0x17')](_0xa6baa5));if(_0xa6baa5[_0x08b5('0x18')]){if(_0xa6baa5['error']['code']===0x1f4){logger[_0x08b5('0x18')]('SquareProject,\x20%s,\x20%s',_0x357214,_0xa6baa5[_0x08b5('0x18')]['message']);return _0x217355(_0xa6baa5[_0x08b5('0x18')][_0x08b5('0x19')]);}logger['error'](_0x08b5('0x1a'),_0x357214,_0xa6baa5[_0x08b5('0x18')][_0x08b5('0x19')]);return _0x634010(_0xa6baa5[_0x08b5('0x18')]['message']);}else{logger[_0x08b5('0x1b')](_0x08b5('0x1a'),_0x357214,'request\x20sent');_0x634010(_0xa6baa5[_0x08b5('0x1c')]['message']);}})['catch'](function(_0x3f45c5){logger['error'](_0x08b5('0x1a'),_0x357214,_0x3f45c5);_0x217355(_0x3f45c5);});});}exports[_0x08b5('0x1d')]=function(_0x3a1ce8){var _0x3034d7=this;return new Promise(function(_0x5f42db,_0x1cddad){return db[_0x08b5('0x1e')]['find']({'raw':_0x3a1ce8[_0x08b5('0x1f')]?_0x3a1ce8[_0x08b5('0x1f')][_0x08b5('0x20')]===undefined?!![]:![]:!![],'where':_0x3a1ce8[_0x08b5('0x1f')]?_0x3a1ce8[_0x08b5('0x1f')][_0x08b5('0x21')]||null:null,'attributes':_0x3a1ce8[_0x08b5('0x1f')]?_0x3a1ce8['options'][_0x08b5('0x22')]||null:null,'include':_0x3a1ce8[_0x08b5('0x1f')]?_0x3a1ce8['options'][_0x08b5('0x23')]?_[_0x08b5('0x24')](_0x3a1ce8[_0x08b5('0x1f')][_0x08b5('0x23')],function(_0x3a369d){return{'model':db[_0x3a369d['model']],'as':_0x3a369d['as'],'attributes':_0x3a369d['attributes'],'include':_0x3a369d[_0x08b5('0x23')]?_[_0x08b5('0x24')](_0x3a369d[_0x08b5('0x23')],function(_0x49d262){return{'model':db[_0x49d262[_0x08b5('0x25')]],'as':_0x49d262['as'],'attributes':_0x49d262[_0x08b5('0x22')],'include':_0x49d262['include']?_['map'](_0x49d262[_0x08b5('0x23')],function(_0x36df48){return{'model':db[_0x36df48['model']],'as':_0x36df48['as'],'attributes':_0x36df48[_0x08b5('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40519f){logger[_0x08b5('0x1b')]('ShowSquareProject',_0x3a1ce8);logger[_0x08b5('0x26')](_0x08b5('0x1d'),_0x3a1ce8,JSON[_0x08b5('0x17')](_0x40519f));_0x5f42db(_0x40519f);})['catch'](function(_0x1c2d05){logger[_0x08b5('0x18')](_0x08b5('0x1d'),_0x1c2d05[_0x08b5('0x19')],_0x3a1ce8);_0x1cddad(_0x3034d7['error'](0x1f4,_0x1c2d05[_0x08b5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b458e68..cfb3dc4 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 _0x634b=['register','squareProject:','./squareProject.events','save','remove','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x634b,0x19a));var _0xb634=function(_0x330977,_0x5a1162){_0x330977=_0x330977-0x0;var _0xd5d65e=_0x634b[_0x330977];return _0xd5d65e;};'use strict';var SquareProjectEvents=require(_0xb634('0x0'));var events=[_0xb634('0x1'),_0xb634('0x2'),'update'];function createListener(_0x21df8d,_0x23ddec){return function(_0x526460){_0x23ddec['emit'](_0x21df8d,_0x526460);};}function removeListener(_0x3bd56f,_0x26f6af){return function(){SquareProjectEvents[_0xb634('0x3')](_0x3bd56f,_0x26f6af);};}exports[_0xb634('0x4')]=function(_0x20bd33){for(var _0xaa9331=0x0,_0x68c3ab=events['length'];_0xaa9331<_0x68c3ab;_0xaa9331++){var _0x3537ef=events[_0xaa9331];var _0x1bb1fa=createListener(_0xb634('0x5')+_0x3537ef,_0x20bd33);SquareProjectEvents['on'](_0x3537ef,_0x1bb1fa);}}; \ No newline at end of file +var _0x70fe=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0x70fe,0xa2));var _0xe70f=function(_0x42ad60,_0x4522ce){_0x42ad60=_0x42ad60-0x0;var _0x272e58=_0x70fe[_0x42ad60];return _0x272e58;};'use strict';var SquareProjectEvents=require(_0xe70f('0x0'));var events=[_0xe70f('0x1'),_0xe70f('0x2'),_0xe70f('0x3')];function createListener(_0x37ac69,_0x41711){return function(_0x236ab7){_0x41711[_0xe70f('0x4')](_0x37ac69,_0x236ab7);};}function removeListener(_0x24802e,_0x4976a9){return function(){SquareProjectEvents[_0xe70f('0x5')](_0x24802e,_0x4976a9);};}exports[_0xe70f('0x6')]=function(_0x7f958e){for(var _0x5f1c9f=0x0,_0x46c52b=events[_0xe70f('0x7')];_0x5f1c9f<_0x46c52b;_0x5f1c9f++){var _0x2c9c9d=events[_0x5f1c9f];var _0x1626c9=createListener(_0xe70f('0x8')+_0x2c9c9d,_0x7f958e);SquareProjectEvents['on'](_0x2c9c9d,_0x1626c9);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2441576..8f7771b 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x43decd,_0xa801d6){var _0x2d79e9=function(_0x1ba85d){while(--_0x1ba85d){_0x43decd['push'](_0x43decd['shift']());}};_0x2d79e9(++_0xa801d6);}(_0x1261,0x144));var _0x1126=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x1261[_0x337a10];return _0x575f98;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x5797a8,_0x195baf){var _0x23affe=function(_0x20b3af){while(--_0x20b3af){_0x5797a8['push'](_0x5797a8['shift']());}};_0x23affe(++_0x195baf);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x5fc3[_0x2b4448];return _0xb4b465;};'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')]('/:id',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('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1cfc7a8..7600b80 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 _0xdc97=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5cf2b1,_0xdc232f){_0x5cf2b1=_0x5cf2b1-0x0;var _0x4103a7=_0xdc97[_0x5cf2b1];return _0x4103a7;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'uniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7dc9('0x2')]},'priority':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7dc9('0x2')]},'projectName':{'type':Sequelize[_0x7dc9('0x2')]},'saveName':{'type':Sequelize[_0x7dc9('0x2')]},'filename':{'type':Sequelize[_0x7dc9('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7dc9('0x3')],'get':function(){var _0x4f91c7='';var _0x4b3229=this[_0x7dc9('0x4')](_0x7dc9('0x5'));if(_0x4b3229){_0x4f91c7=_0x4b3229[_0x7dc9('0x6')](_0x4b3229[_0x7dc9('0x7')]('.'));}return _0x4f91c7;}}}; \ No newline at end of file +var _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x56ebda,_0x43d071){var _0x1c0b97=function(_0x3d0dcd){while(--_0x3d0dcd){_0x56ebda['push'](_0x56ebda['shift']());}};_0x1c0b97(++_0x43d071);}(_0xb138,0x1dd));var _0x8b13=function(_0x1c41c4,_0x43db50){_0x1c41c4=_0x1c41c4-0x0;var _0x30fc4d=_0xb138[_0x1c41c4];return _0x30fc4d;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'callerid':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'extension':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'dnid':{'type':Sequelize[_0x8b13('0x2')]},'projectName':{'type':Sequelize[_0x8b13('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8b13('0x2')]},'savePath':{'type':Sequelize[_0x8b13('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3fdf4d='';var _0x33d1a7=this[_0x8b13('0x3')]('savePath');if(_0x33d1a7){_0x3fdf4d=_0x33d1a7[_0x8b13('0x4')](_0x33d1a7[_0x8b13('0x5')]('.'));}return _0x3fdf4d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1c59fb5..e3a968c 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 _0x3df9=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','json','apply','save','update','then','destroy','status','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','SquareRecording','include','create','body','download','../../components/encryptor','uniqueid','find','savePath','filename','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x10207f,_0x66a2d8){var _0x185a2b=function(_0x5b7fa2){while(--_0x5b7fa2){_0x10207f['push'](_0x10207f['shift']());}};_0x185a2b(++_0x66a2d8);}(_0x3df9,0xa6));var _0x93df=function(_0x4d9097,_0x115525){_0x4d9097=_0x4d9097-0x0;var _0x567610=_0x3df9[_0x4d9097];return _0x567610;};'use strict';var emlformat=require(_0x93df('0x0'));var rimraf=require(_0x93df('0x1'));var zipdir=require(_0x93df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93df('0x3'));var moment=require('moment');var BPromise=require(_0x93df('0x4'));var Mustache=require(_0x93df('0x5'));var util=require('util');var path=require(_0x93df('0x6'));var sox=require(_0x93df('0x7'));var csv=require(_0x93df('0x8'));var ejs=require(_0x93df('0x9'));var fs=require('fs');var fs_extra=require(_0x93df('0xa'));var _=require(_0x93df('0xb'));var squel=require('squel');var crypto=require(_0x93df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x93df('0xd'));var toCsv=require(_0x93df('0x8'));var querystring=require(_0x93df('0xe'));var Papa=require(_0x93df('0xf'));var Redis=require(_0x93df('0x10'));var authService=require(_0x93df('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x93df('0x12'));var hardwareService=require(_0x93df('0x13'));var logger=require(_0x93df('0x14'))(_0x93df('0x15'));var utils=require(_0x93df('0x16'));var config=require(_0x93df('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x93df('0x18'))['db'];function respondWithStatusCode(_0x430a96,_0x54c970){_0x54c970=_0x54c970||0xcc;return function(_0x472e38){if(_0x472e38){return _0x430a96[_0x93df('0x19')](_0x54c970);}return _0x430a96['status'](_0x54c970)[_0x93df('0x1a')]();};}function respondWithResult(_0x282db6,_0xcb7d25){_0xcb7d25=_0xcb7d25||0xc8;return function(_0x1c81fa){if(_0x1c81fa){return _0x282db6['status'](_0xcb7d25)['json'](_0x1c81fa);}};}function respondWithFilteredResult(_0x5c63d6,_0x2fe5f2){return function(_0x3b5317){if(_0x3b5317){var _0x420eb3=typeof _0x2fe5f2[_0x93df('0x1b')]===_0x93df('0x1c')&&typeof _0x2fe5f2[_0x93df('0x1d')]===_0x93df('0x1c');var _0x81093=_0x3b5317[_0x93df('0x1e')];var _0x3ddf50=_0x420eb3?0x0:_0x2fe5f2[_0x93df('0x1b')];var _0xc3e34d=_0x420eb3?_0x3b5317['count']:_0x2fe5f2[_0x93df('0x1b')]+_0x2fe5f2[_0x93df('0x1d')];var _0x4235b0;if(_0xc3e34d>=_0x81093){_0xc3e34d=_0x81093;_0x4235b0=0xc8;}else{_0x4235b0=0xce;}_0x5c63d6['status'](_0x4235b0);return _0x5c63d6['set']('Content-Range',_0x3ddf50+'-'+_0xc3e34d+'/'+_0x81093)[_0x93df('0x1f')](_0x3b5317);}return null;};}function patchUpdates(_0x2c3e3c){return function(_0x592b1a){try{jsonpatch[_0x93df('0x20')](_0x592b1a,_0x2c3e3c,!![]);}catch(_0x3a2fd6){return BPromise['reject'](_0x3a2fd6);}return _0x592b1a[_0x93df('0x21')]();};}function saveUpdates(_0x5d7f31,_0x4aef59){return function(_0x400975){if(_0x400975){return _0x400975[_0x93df('0x22')](_0x5d7f31)[_0x93df('0x23')](function(_0x546394){return _0x546394;});}return null;};}function removeEntity(_0x5d181a,_0x374fa1){return function(_0x2b26b9){if(_0x2b26b9){return _0x2b26b9[_0x93df('0x24')]()[_0x93df('0x23')](function(){_0x5d181a[_0x93df('0x25')](0xcc)[_0x93df('0x1a')]();});}};}function handleEntityNotFound(_0x2167e1,_0x8d1393){return function(_0x2c3b9b){if(!_0x2c3b9b){_0x2167e1[_0x93df('0x19')](0x194);}return _0x2c3b9b;};}function handleError(_0x17305a,_0x42631e){_0x42631e=_0x42631e||0x1f4;return function(_0x1f0791){logger[_0x93df('0x26')](_0x1f0791['stack']);if(_0x1f0791[_0x93df('0x27')]){delete _0x1f0791[_0x93df('0x27')];}_0x17305a[_0x93df('0x25')](_0x42631e)[_0x93df('0x28')](_0x1f0791);};}exports[_0x93df('0x29')]=function(_0x26dcd2,_0x47d3f2){var _0x533cfb={},_0x420ec0={},_0x37d51b={'count':0x0,'rows':[]};var _0x13f51c=_[_0x93df('0x2a')](db['SquareRecording']['rawAttributes'],function(_0xfda5db){return{'name':_0xfda5db[_0x93df('0x2b')],'type':_0xfda5db[_0x93df('0x2c')][_0x93df('0x2d')]};});_0x420ec0[_0x93df('0x2e')]=_[_0x93df('0x2a')](_0x13f51c,_0x93df('0x27'));_0x420ec0[_0x93df('0x2f')]=_[_0x93df('0x30')](_0x26dcd2[_0x93df('0x2f')]);_0x420ec0[_0x93df('0x31')]=_[_0x93df('0x32')](_0x420ec0[_0x93df('0x2e')],_0x420ec0[_0x93df('0x2f')]);_0x533cfb[_0x93df('0x33')]=_[_0x93df('0x32')](_0x420ec0[_0x93df('0x2e')],qs[_0x93df('0x34')](_0x26dcd2['query'][_0x93df('0x34')]));_0x533cfb['attributes']=_0x533cfb[_0x93df('0x33')][_0x93df('0x35')]?_0x533cfb[_0x93df('0x33')]:_0x420ec0['model'];if(!_0x26dcd2['query']['hasOwnProperty']('nolimit')){_0x533cfb['limit']=qs[_0x93df('0x1d')](_0x26dcd2['query']['limit']);_0x533cfb[_0x93df('0x1b')]=qs['offset'](_0x26dcd2['query'][_0x93df('0x1b')]);}_0x533cfb['order']=qs[_0x93df('0x36')](_0x26dcd2[_0x93df('0x2f')][_0x93df('0x36')]);_0x533cfb[_0x93df('0x37')]=qs['filters'](_[_0x93df('0x38')](_0x26dcd2[_0x93df('0x2f')],_0x420ec0[_0x93df('0x31')]),_0x13f51c);if(_0x26dcd2[_0x93df('0x2f')]['filter']){_0x533cfb[_0x93df('0x37')]=_[_0x93df('0x39')](_0x533cfb[_0x93df('0x37')],{'$or':_[_0x93df('0x2a')](_0x13f51c,function(_0x3e0bf7){if(_0x3e0bf7[_0x93df('0x2c')]!=='VIRTUAL'){var _0x591266={};_0x591266[_0x3e0bf7['name']]={'$like':'%'+_0x26dcd2[_0x93df('0x2f')][_0x93df('0x3a')]+'%'};return _0x591266;}})});}_0x533cfb=_[_0x93df('0x39')]({},_0x533cfb,_0x26dcd2[_0x93df('0x3b')]);var _0x752610={'where':_0x533cfb[_0x93df('0x37')]};return db['SquareRecording'][_0x93df('0x1e')](_0x752610)[_0x93df('0x23')](function(_0x5f406e){_0x37d51b['count']=_0x5f406e;if(_0x26dcd2[_0x93df('0x2f')][_0x93df('0x3c')]){_0x533cfb['include']=[{'all':!![]}];}return db['SquareRecording'][_0x93df('0x3d')](_0x533cfb);})[_0x93df('0x23')](function(_0x530498){_0x37d51b[_0x93df('0x3e')]=_0x530498;return _0x37d51b;})[_0x93df('0x23')](respondWithFilteredResult(_0x47d3f2,_0x533cfb))[_0x93df('0x3f')](handleError(_0x47d3f2,null));};exports[_0x93df('0x40')]=function(_0x379c2b,_0x310815){var _0xd17c17={'raw':!![],'where':{'id':_0x379c2b[_0x93df('0x41')]['id']}},_0x3be4d9={};_0x3be4d9['model']=_['keys'](db[_0x93df('0x42')]['rawAttributes']);_0x3be4d9[_0x93df('0x2f')]=_['keys'](_0x379c2b[_0x93df('0x2f')]);_0x3be4d9[_0x93df('0x31')]=_[_0x93df('0x32')](_0x3be4d9[_0x93df('0x2e')],_0x3be4d9[_0x93df('0x2f')]);_0xd17c17['attributes']=_['intersection'](_0x3be4d9[_0x93df('0x2e')],qs[_0x93df('0x34')](_0x379c2b['query'][_0x93df('0x34')]));_0xd17c17[_0x93df('0x33')]=_0xd17c17['attributes'][_0x93df('0x35')]?_0xd17c17['attributes']:_0x3be4d9[_0x93df('0x2e')];if(_0x379c2b[_0x93df('0x2f')][_0x93df('0x3c')]){_0xd17c17[_0x93df('0x43')]=[{'all':!![]}];}_0xd17c17=_[_0x93df('0x39')]({},_0xd17c17,_0x379c2b[_0x93df('0x3b')]);return db[_0x93df('0x42')]['find'](_0xd17c17)[_0x93df('0x23')](handleEntityNotFound(_0x310815,null))[_0x93df('0x23')](respondWithResult(_0x310815,null))[_0x93df('0x3f')](handleError(_0x310815,null));};exports[_0x93df('0x44')]=function(_0x13d259,_0x4f99bf){return db[_0x93df('0x42')][_0x93df('0x44')](_0x13d259['body'],{})[_0x93df('0x23')](respondWithResult(_0x4f99bf,0xc9))[_0x93df('0x3f')](handleError(_0x4f99bf,null));};exports[_0x93df('0x22')]=function(_0x24b161,_0x47bddc){if(_0x24b161[_0x93df('0x45')]['id']){delete _0x24b161[_0x93df('0x45')]['id'];}return db[_0x93df('0x42')]['find']({'where':{'id':_0x24b161['params']['id']}})['then'](handleEntityNotFound(_0x47bddc,null))[_0x93df('0x23')](saveUpdates(_0x24b161[_0x93df('0x45')],null))[_0x93df('0x23')](respondWithResult(_0x47bddc,null))[_0x93df('0x3f')](handleError(_0x47bddc,null));};exports[_0x93df('0x46')]=function(_0x4a7ae4,_0x53cd0d,_0x580252){var _0x1aab26=require(_0x93df('0x47'));var _0x137b25=![];var _0x14ffac={};if(_0x4a7ae4[_0x93df('0x2f')]['type']&&_0x4a7ae4['query'][_0x93df('0x2c')]===_0x93df('0x48')){_0x14ffac[_0x93df('0x48')]=_0x4a7ae4[_0x93df('0x41')]['id'];}else{_0x14ffac['id']=_0x4a7ae4[_0x93df('0x41')]['id'];}return db[_0x93df('0x42')][_0x93df('0x49')]({'where':_0x14ffac,'attributes':['id',_0x93df('0x4a'),_0x93df('0x4b')],'raw':!![]})[_0x93df('0x23')](handleEntityNotFound(_0x53cd0d,null))['then'](function(_0x3754ab){if(_0x3754ab){var _0x86e8e=_0x3754ab[_0x93df('0x4a')];var _0xf4ff34=util['format']('%s.cypher',_0x86e8e);if(fs['existsSync'](_0xf4ff34)){_0x137b25=!![];return _0x1aab26[_0x93df('0x4c')](_0xf4ff34,_0x86e8e,config[_0x93df('0x4d')][_0x93df('0x4e')])[_0x93df('0x23')](function(){return _0x3754ab;});}return _0x3754ab;}})[_0x93df('0x23')](function(_0x5f2f1a){if(_0x5f2f1a){var _0x25920a=_0x5f2f1a[_0x93df('0x4a')];if(!fs[_0x93df('0x4f')](_0x25920a)){throw new db[(_0x93df('0x50'))][(_0x93df('0x51'))](_0x93df('0x52'));}if(_0x5f2f1a[_0x93df('0x4b')]){return _0x53cd0d['download'](_0x25920a,_0x5f2f1a['filename']+path[_0x93df('0x53')](_0x25920a),function(){if(_0x137b25){fs[_0x93df('0x54')](_0x25920a);}});}else{return _0x53cd0d[_0x93df('0x46')](_0x25920a,function(_0x24b4b7){if(_0x137b25){fs[_0x93df('0x54')](_0x25920a);}});}}})[_0x93df('0x3f')](function(_0x4b7b92){if(_0x4b7b92['message']===_0x93df('0x52')){_0x53cd0d[_0x93df('0x25')](0x194)[_0x93df('0x28')](_0x93df('0x55'));}else{return handleError(_0x53cd0d,null);}});};exports['destroy']=function(_0x4d3aa1,_0x54eb4d){return db[_0x93df('0x42')][_0x93df('0x49')]({'where':{'id':_0x4d3aa1[_0x93df('0x41')]['id']}})[_0x93df('0x23')](function(_0x308e34){if(_[_0x93df('0x56')](_0x308e34)){throw new ReferenceError(_0x93df('0x57'));}return _0x308e34;})[_0x93df('0x23')](function(_0x550569){var _0x13c449=_0x550569[_0x93df('0x4a')];logger[_0x93df('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x13c449);if(!_[_0x93df('0x56')](_0x550569['savePath'])&&fs[_0x93df('0x4f')](_0x13c449)){logger[_0x93df('0x58')](_0x93df('0x59')+_0x13c449+_0x93df('0x5a'));fs[_0x93df('0x5b')](_0x13c449);}_0x13c449=_0x13c449+_0x93df('0x5c');if(!_[_0x93df('0x56')](_0x550569[_0x93df('0x4a')])&&fs[_0x93df('0x4f')](_0x13c449)){logger[_0x93df('0x58')](_0x93df('0x59')+_0x13c449+_0x93df('0x5a'));fs['unlinkSync'](_0x13c449);}return _0x550569;})[_0x93df('0x23')](function(_0x446575){if(!_0x446575)throw new InternalError();return _0x446575[_0x93df('0x24')]();})[_0x93df('0x23')](function(){_0x54eb4d[_0x93df('0x25')](0xcc)[_0x93df('0x1a')]();})[_0x93df('0x3f')](handleError(_0x54eb4d,null));}; \ No newline at end of file +var _0xf7e8=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','SquareRecording','rawAttributes','type','key','model','keys','filters','intersection','fields','query','length','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x48f72a,_0x3e1a05){var _0x46cdb1=function(_0x3ca160){while(--_0x3ca160){_0x48f72a['push'](_0x48f72a['shift']());}};_0x46cdb1(++_0x3e1a05);}(_0xf7e8,0xa9));var _0x8f7e=function(_0x35f3a5,_0x4632ec){_0x35f3a5=_0x35f3a5-0x0;var _0x2af4b0=_0xf7e8[_0x35f3a5];return _0x2af4b0;};'use strict';var emlformat=require(_0x8f7e('0x0'));var rimraf=require(_0x8f7e('0x1'));var zipdir=require(_0x8f7e('0x2'));var jsonpatch=require(_0x8f7e('0x3'));var rp=require(_0x8f7e('0x4'));var moment=require(_0x8f7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8f7e('0x6'));var util=require(_0x8f7e('0x7'));var path=require('path');var sox=require(_0x8f7e('0x8'));var csv=require(_0x8f7e('0x9'));var ejs=require(_0x8f7e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f7e('0xb'));var squel=require('squel');var crypto=require(_0x8f7e('0xc'));var jsforce=require(_0x8f7e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8f7e('0x9'));var querystring=require(_0x8f7e('0xe'));var Papa=require(_0x8f7e('0xf'));var Redis=require(_0x8f7e('0x10'));var authService=require(_0x8f7e('0x11'));var qs=require(_0x8f7e('0x12'));var as=require(_0x8f7e('0x13'));var hardwareService=require(_0x8f7e('0x14'));var logger=require(_0x8f7e('0x15'))('api');var utils=require(_0x8f7e('0x16'));var config=require(_0x8f7e('0x17'));var licenseUtil=require(_0x8f7e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f4af9,_0x31ac76){_0x31ac76=_0x31ac76||0xcc;return function(_0x3c3f1e){if(_0x3c3f1e){return _0x5f4af9[_0x8f7e('0x19')](_0x31ac76);}return _0x5f4af9[_0x8f7e('0x1a')](_0x31ac76)[_0x8f7e('0x1b')]();};}function respondWithResult(_0x1ed318,_0x418530){_0x418530=_0x418530||0xc8;return function(_0x1b8c1c){if(_0x1b8c1c){return _0x1ed318[_0x8f7e('0x1a')](_0x418530)[_0x8f7e('0x1c')](_0x1b8c1c);}};}function respondWithFilteredResult(_0x552616,_0x289b66){return function(_0xd62649){if(_0xd62649){var _0x41492f=typeof _0x289b66[_0x8f7e('0x1d')]===_0x8f7e('0x1e')&&typeof _0x289b66[_0x8f7e('0x1f')]===_0x8f7e('0x1e');var _0x3e9050=_0xd62649[_0x8f7e('0x20')];var _0x545efe=_0x41492f?0x0:_0x289b66[_0x8f7e('0x1d')];var _0x373e6d=_0x41492f?_0xd62649['count']:_0x289b66['offset']+_0x289b66[_0x8f7e('0x1f')];var _0x2d9bff;if(_0x373e6d>=_0x3e9050){_0x373e6d=_0x3e9050;_0x2d9bff=0xc8;}else{_0x2d9bff=0xce;}_0x552616[_0x8f7e('0x1a')](_0x2d9bff);return _0x552616[_0x8f7e('0x21')](_0x8f7e('0x22'),_0x545efe+'-'+_0x373e6d+'/'+_0x3e9050)['json'](_0xd62649);}return null;};}function patchUpdates(_0x463d28){return function(_0x3fe438){try{jsonpatch[_0x8f7e('0x23')](_0x3fe438,_0x463d28,!![]);}catch(_0x268e2f){return BPromise[_0x8f7e('0x24')](_0x268e2f);}return _0x3fe438[_0x8f7e('0x25')]();};}function saveUpdates(_0x3eef81,_0x2d2095){return function(_0x322cb9){if(_0x322cb9){return _0x322cb9[_0x8f7e('0x26')](_0x3eef81)[_0x8f7e('0x27')](function(_0x21d0b7){return _0x21d0b7;});}return null;};}function removeEntity(_0x814b2e,_0x12b5b5){return function(_0x438b2c){if(_0x438b2c){return _0x438b2c['destroy']()[_0x8f7e('0x27')](function(){_0x814b2e[_0x8f7e('0x1a')](0xcc)[_0x8f7e('0x1b')]();});}};}function handleEntityNotFound(_0x3b92f7,_0x126ccc){return function(_0x5b362a){if(!_0x5b362a){_0x3b92f7['sendStatus'](0x194);}return _0x5b362a;};}function handleError(_0x31e01e,_0x3040c6){_0x3040c6=_0x3040c6||0x1f4;return function(_0x19e08c){logger['error'](_0x19e08c[_0x8f7e('0x28')]);if(_0x19e08c['name']){delete _0x19e08c[_0x8f7e('0x29')];}_0x31e01e[_0x8f7e('0x1a')](_0x3040c6)['send'](_0x19e08c);};}exports[_0x8f7e('0x2a')]=function(_0x1000a6,_0xba8ecb){var _0x129788={},_0x15b19f={},_0x3afe2b={'count':0x0,'rows':[]};var _0x2af859=_[_0x8f7e('0x2b')](db[_0x8f7e('0x2c')][_0x8f7e('0x2d')],function(_0x574d9f){return{'name':_0x574d9f['fieldName'],'type':_0x574d9f[_0x8f7e('0x2e')][_0x8f7e('0x2f')]};});_0x15b19f[_0x8f7e('0x30')]=_[_0x8f7e('0x2b')](_0x2af859,_0x8f7e('0x29'));_0x15b19f['query']=_[_0x8f7e('0x31')](_0x1000a6['query']);_0x15b19f[_0x8f7e('0x32')]=_['intersection'](_0x15b19f[_0x8f7e('0x30')],_0x15b19f['query']);_0x129788['attributes']=_[_0x8f7e('0x33')](_0x15b19f[_0x8f7e('0x30')],qs[_0x8f7e('0x34')](_0x1000a6[_0x8f7e('0x35')]['fields']));_0x129788['attributes']=_0x129788['attributes'][_0x8f7e('0x36')]?_0x129788[_0x8f7e('0x37')]:_0x15b19f[_0x8f7e('0x30')];if(!_0x1000a6[_0x8f7e('0x35')][_0x8f7e('0x38')]('nolimit')){_0x129788[_0x8f7e('0x1f')]=qs['limit'](_0x1000a6[_0x8f7e('0x35')][_0x8f7e('0x1f')]);_0x129788[_0x8f7e('0x1d')]=qs['offset'](_0x1000a6['query'][_0x8f7e('0x1d')]);}_0x129788[_0x8f7e('0x39')]=qs[_0x8f7e('0x3a')](_0x1000a6[_0x8f7e('0x35')][_0x8f7e('0x3a')]);_0x129788['where']=qs['filters'](_[_0x8f7e('0x3b')](_0x1000a6[_0x8f7e('0x35')],_0x15b19f['filters']),_0x2af859);if(_0x1000a6['query'][_0x8f7e('0x3c')]){_0x129788[_0x8f7e('0x3d')]=_[_0x8f7e('0x3e')](_0x129788[_0x8f7e('0x3d')],{'$or':_[_0x8f7e('0x2b')](_0x2af859,function(_0xf02e85){if(_0xf02e85[_0x8f7e('0x2e')]!=='VIRTUAL'){var _0xbaeb48={};_0xbaeb48[_0xf02e85[_0x8f7e('0x29')]]={'$like':'%'+_0x1000a6[_0x8f7e('0x35')][_0x8f7e('0x3c')]+'%'};return _0xbaeb48;}})});}_0x129788=_[_0x8f7e('0x3e')]({},_0x129788,_0x1000a6[_0x8f7e('0x3f')]);var _0x45eb27={'where':_0x129788[_0x8f7e('0x3d')]};return db[_0x8f7e('0x2c')][_0x8f7e('0x20')](_0x45eb27)[_0x8f7e('0x27')](function(_0x29ad77){_0x3afe2b[_0x8f7e('0x20')]=_0x29ad77;if(_0x1000a6[_0x8f7e('0x35')][_0x8f7e('0x40')]){_0x129788[_0x8f7e('0x41')]=[{'all':!![]}];}return db[_0x8f7e('0x2c')][_0x8f7e('0x42')](_0x129788);})['then'](function(_0x234ed1){_0x3afe2b[_0x8f7e('0x43')]=_0x234ed1;return _0x3afe2b;})[_0x8f7e('0x27')](respondWithFilteredResult(_0xba8ecb,_0x129788))[_0x8f7e('0x44')](handleError(_0xba8ecb,null));};exports[_0x8f7e('0x45')]=function(_0x21e340,_0x2406bf){var _0x467ce9={'raw':!![],'where':{'id':_0x21e340[_0x8f7e('0x46')]['id']}},_0x2e6201={};_0x2e6201[_0x8f7e('0x30')]=_[_0x8f7e('0x31')](db[_0x8f7e('0x2c')]['rawAttributes']);_0x2e6201[_0x8f7e('0x35')]=_[_0x8f7e('0x31')](_0x21e340[_0x8f7e('0x35')]);_0x2e6201[_0x8f7e('0x32')]=_[_0x8f7e('0x33')](_0x2e6201[_0x8f7e('0x30')],_0x2e6201[_0x8f7e('0x35')]);_0x467ce9[_0x8f7e('0x37')]=_['intersection'](_0x2e6201['model'],qs[_0x8f7e('0x34')](_0x21e340[_0x8f7e('0x35')]['fields']));_0x467ce9['attributes']=_0x467ce9[_0x8f7e('0x37')]['length']?_0x467ce9[_0x8f7e('0x37')]:_0x2e6201[_0x8f7e('0x30')];if(_0x21e340['query'][_0x8f7e('0x40')]){_0x467ce9[_0x8f7e('0x41')]=[{'all':!![]}];}_0x467ce9=_['merge']({},_0x467ce9,_0x21e340[_0x8f7e('0x3f')]);return db['SquareRecording'][_0x8f7e('0x47')](_0x467ce9)[_0x8f7e('0x27')](handleEntityNotFound(_0x2406bf,null))[_0x8f7e('0x27')](respondWithResult(_0x2406bf,null))[_0x8f7e('0x44')](handleError(_0x2406bf,null));};exports[_0x8f7e('0x48')]=function(_0x47cf2c,_0x22d9f9){return db['SquareRecording'][_0x8f7e('0x48')](_0x47cf2c[_0x8f7e('0x49')],{})[_0x8f7e('0x27')](respondWithResult(_0x22d9f9,0xc9))['catch'](handleError(_0x22d9f9,null));};exports[_0x8f7e('0x26')]=function(_0x15719d,_0x18526d){if(_0x15719d[_0x8f7e('0x49')]['id']){delete _0x15719d[_0x8f7e('0x49')]['id'];}return db[_0x8f7e('0x2c')][_0x8f7e('0x47')]({'where':{'id':_0x15719d['params']['id']}})[_0x8f7e('0x27')](handleEntityNotFound(_0x18526d,null))[_0x8f7e('0x27')](saveUpdates(_0x15719d['body'],null))[_0x8f7e('0x27')](respondWithResult(_0x18526d,null))[_0x8f7e('0x44')](handleError(_0x18526d,null));};exports[_0x8f7e('0x4a')]=function(_0x5bd50e,_0x41b3d2,_0x50476f){var _0xa54db0=require('../../components/encryptor');var _0x55d48d=![];var _0xbba9d8={};if(_0x5bd50e[_0x8f7e('0x35')]['type']&&_0x5bd50e[_0x8f7e('0x35')][_0x8f7e('0x2e')]==='uniqueid'){_0xbba9d8[_0x8f7e('0x4b')]=_0x5bd50e[_0x8f7e('0x46')]['id'];}else{_0xbba9d8['id']=_0x5bd50e[_0x8f7e('0x46')]['id'];}return db[_0x8f7e('0x2c')]['find']({'where':_0xbba9d8,'attributes':['id',_0x8f7e('0x4c'),_0x8f7e('0x4d')],'raw':!![]})[_0x8f7e('0x27')](handleEntityNotFound(_0x41b3d2,null))[_0x8f7e('0x27')](function(_0x323b39){if(_0x323b39){var _0x2a99fe=_0x323b39['savePath'];var _0x4ea7d7=util[_0x8f7e('0x4e')](_0x8f7e('0x4f'),_0x2a99fe);if(fs[_0x8f7e('0x50')](_0x4ea7d7)){_0x55d48d=!![];return _0xa54db0['decryptFile'](_0x4ea7d7,_0x2a99fe,config['secrets'][_0x8f7e('0x51')])[_0x8f7e('0x27')](function(){return _0x323b39;});}return _0x323b39;}})[_0x8f7e('0x27')](function(_0x32d1dd){if(_0x32d1dd){var _0x258a74=_0x32d1dd[_0x8f7e('0x4c')];if(!fs[_0x8f7e('0x50')](_0x258a74)){throw new db[(_0x8f7e('0x52'))][(_0x8f7e('0x53'))](_0x8f7e('0x54'));}if(_0x32d1dd[_0x8f7e('0x4d')]){return _0x41b3d2[_0x8f7e('0x4a')](_0x258a74,_0x32d1dd[_0x8f7e('0x4d')]+path[_0x8f7e('0x55')](_0x258a74),function(){if(_0x55d48d){fs[_0x8f7e('0x56')](_0x258a74);}});}else{return _0x41b3d2[_0x8f7e('0x4a')](_0x258a74,function(_0x42c653){if(_0x55d48d){fs[_0x8f7e('0x56')](_0x258a74);}});}}})[_0x8f7e('0x44')](function(_0x3269b0){if(_0x3269b0[_0x8f7e('0x57')]==='SquareRecording\x20not\x20found'){_0x41b3d2[_0x8f7e('0x1a')](0x194)[_0x8f7e('0x58')]('Not\x20found');}else{return handleError(_0x41b3d2,null);}});};exports[_0x8f7e('0x59')]=function(_0x58d788,_0x1030c4){return db[_0x8f7e('0x2c')][_0x8f7e('0x47')]({'where':{'id':_0x58d788['params']['id']}})['then'](function(_0x455e5c){if(_[_0x8f7e('0x5a')](_0x455e5c)){throw new ReferenceError(_0x8f7e('0x5b'));}return _0x455e5c;})[_0x8f7e('0x27')](function(_0x42eecf){var _0x562e36=_0x42eecf['savePath'];logger[_0x8f7e('0x5c')](_0x8f7e('0x5d'),_0x562e36);if(!_[_0x8f7e('0x5a')](_0x42eecf[_0x8f7e('0x4c')])&&fs[_0x8f7e('0x50')](_0x562e36)){logger[_0x8f7e('0x5c')]('File:\x20\x22'+_0x562e36+_0x8f7e('0x5e'));fs['unlinkSync'](_0x562e36);}_0x562e36=_0x562e36+'.cypher';if(!_[_0x8f7e('0x5a')](_0x42eecf[_0x8f7e('0x4c')])&&fs['existsSync'](_0x562e36)){logger[_0x8f7e('0x5c')](_0x8f7e('0x5f')+_0x562e36+_0x8f7e('0x5e'));fs['unlinkSync'](_0x562e36);}return _0x42eecf;})[_0x8f7e('0x27')](function(_0x25e325){if(!_0x25e325)throw new InternalError();return _0x25e325[_0x8f7e('0x59')]();})[_0x8f7e('0x27')](function(){_0x1030c4['status'](0xcc)['end']();})[_0x8f7e('0x44')](handleError(_0x1030c4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1691d34..320958e 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 _0xf55c=['request-promise','path','rimraf','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xf55c,0x1e7));var _0xcf55=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xf55c[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var logger=require(_0xcf55('0x1'))(_0xcf55('0x2'));var moment=require(_0xcf55('0x3'));var BPromise=require(_0xcf55('0x4'));var rp=require(_0xcf55('0x5'));var fs=require('fs');var path=require(_0xcf55('0x6'));var rimraf=require(_0xcf55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf55('0x8'));module[_0xcf55('0x9')]=function(_0x14574c,_0x3a6de7){return _0x14574c['define'](_0xcf55('0xa'),attributes,{'tableName':_0xcf55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','square_recordings','lodash'];(function(_0x1bfde5,_0x1a29a3){var _0x28596a=function(_0x3c4242){while(--_0x3c4242){_0x1bfde5['push'](_0x1bfde5['shift']());}};_0x28596a(++_0x1a29a3);}(_0xd943,0x15d));var _0x3d94=function(_0x1d6cb1,_0x4ec830){_0x1d6cb1=_0x1d6cb1-0x0;var _0x31f0d6=_0xd943[_0x1d6cb1];return _0x31f0d6;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('SquareRecording',attributes,{'tableName':_0x3d94('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 e6f2f80..01ac299 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 _0x1358=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','debug','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x538375,_0x365e8d){var _0x1c3531=function(_0x7dc57f){while(--_0x7dc57f){_0x538375['push'](_0x538375['shift']());}};_0x1c3531(++_0x365e8d);}(_0x1358,0x18e));var _0x8135=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x1358[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require(_0x8135('0x0'));var moment=require(_0x8135('0x1'));var BPromise=require('bluebird');var rs=require(_0x8135('0x2'));var fs=require('fs');var Redis=require(_0x8135('0x3'));var db=require(_0x8135('0x4'))['db'];var utils=require(_0x8135('0x5'));var logger=require(_0x8135('0x6'))(_0x8135('0x7'));var config=require(_0x8135('0x8'));var jayson=require(_0x8135('0x9'));var client=jayson[_0x8135('0xa')][_0x8135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cf640,_0x334b30,_0x14a927){return new BPromise(function(_0x1a7b5a,_0x4d6352){return client[_0x8135('0xc')](_0x3cf640,_0x14a927)[_0x8135('0xd')](function(_0x1ece48){logger[_0x8135('0xe')]('SquareRecording,\x20%s,\x20%s',_0x334b30,'request\x20sent');logger['debug'](_0x8135('0xf'),_0x334b30,_0x8135('0x10'),JSON[_0x8135('0x11')](_0x1ece48));if(_0x1ece48[_0x8135('0x12')]){if(_0x1ece48['error'][_0x8135('0x13')]===0x1f4){logger[_0x8135('0x12')](_0x8135('0x14'),_0x334b30,_0x1ece48[_0x8135('0x12')][_0x8135('0x15')]);return _0x4d6352(_0x1ece48[_0x8135('0x12')]['message']);}logger[_0x8135('0x12')](_0x8135('0x14'),_0x334b30,_0x1ece48[_0x8135('0x12')][_0x8135('0x15')]);return _0x1a7b5a(_0x1ece48['error'][_0x8135('0x15')]);}else{logger['info'](_0x8135('0x14'),_0x334b30,_0x8135('0x10'));_0x1a7b5a(_0x1ece48[_0x8135('0x16')][_0x8135('0x15')]);}})[_0x8135('0x17')](function(_0x647bf5){logger[_0x8135('0x12')](_0x8135('0x14'),_0x334b30,_0x647bf5);_0x4d6352(_0x647bf5);});});}exports['CreateSquareRecording']=function(_0x425a19){var _0x2b813a=this;return new Promise(function(_0x1aab39,_0x44d7c8){return db[_0x8135('0x18')][_0x8135('0x19')](_0x425a19[_0x8135('0x1a')],{'raw':_0x425a19[_0x8135('0x1b')]?_0x425a19[_0x8135('0x1b')][_0x8135('0x1c')]===undefined?!![]:![]:!![]})[_0x8135('0xd')](function(_0x3dd8df){logger[_0x8135('0xe')](_0x8135('0x1d'),_0x425a19);logger[_0x8135('0x1e')](_0x8135('0x1d'),_0x425a19,JSON[_0x8135('0x11')](_0x3dd8df));_0x1aab39(_0x3dd8df);})[_0x8135('0x17')](function(_0x2cd184){logger['error'](_0x8135('0x1d'),_0x2cd184[_0x8135('0x15')],_0x425a19);_0x44d7c8(_0x2b813a[_0x8135('0x12')](0x1f4,_0x2cd184[_0x8135('0x15')]));});});}; \ No newline at end of file +var _0xd79b=['raw','debug','util','moment','bluebird','ioredis','../../config/logger','rpc','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x4c3932,_0xbd80e5){var _0x226628=function(_0x3ada7e){while(--_0x3ada7e){_0x4c3932['push'](_0x4c3932['shift']());}};_0x226628(++_0xbd80e5);}(_0xd79b,0x1c4));var _0xbd79=function(_0x2e6cf2,_0xf52299){_0x2e6cf2=_0x2e6cf2-0x0;var _0x179f6e=_0xd79b[_0x2e6cf2];return _0x179f6e;};'use strict';var _=require('lodash');var util=require(_0xbd79('0x0'));var moment=require(_0xbd79('0x1'));var BPromise=require(_0xbd79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd79('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbd79('0x4'))(_0xbd79('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4aad1d,_0x2f7eaf,_0x206655){return new BPromise(function(_0x21adc9,_0x4dfa1f){return client[_0xbd79('0x7')](_0x4aad1d,_0x206655)[_0xbd79('0x8')](function(_0x227268){logger['info'](_0xbd79('0x9'),_0x2f7eaf,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2f7eaf,_0xbd79('0xa'),JSON[_0xbd79('0xb')](_0x227268));if(_0x227268[_0xbd79('0xc')]){if(_0x227268[_0xbd79('0xc')][_0xbd79('0xd')]===0x1f4){logger[_0xbd79('0xc')](_0xbd79('0x9'),_0x2f7eaf,_0x227268[_0xbd79('0xc')][_0xbd79('0xe')]);return _0x4dfa1f(_0x227268[_0xbd79('0xc')]['message']);}logger[_0xbd79('0xc')](_0xbd79('0x9'),_0x2f7eaf,_0x227268[_0xbd79('0xc')][_0xbd79('0xe')]);return _0x21adc9(_0x227268[_0xbd79('0xc')][_0xbd79('0xe')]);}else{logger[_0xbd79('0xf')](_0xbd79('0x9'),_0x2f7eaf,_0xbd79('0xa'));_0x21adc9(_0x227268[_0xbd79('0x10')][_0xbd79('0xe')]);}})[_0xbd79('0x11')](function(_0x5b3549){logger['error']('SquareRecording,\x20%s,\x20%s',_0x2f7eaf,_0x5b3549);_0x4dfa1f(_0x5b3549);});});}exports[_0xbd79('0x12')]=function(_0x5a511f){var _0x29b17c=this;return new Promise(function(_0x813df2,_0x3381cc){return db[_0xbd79('0x13')][_0xbd79('0x14')](_0x5a511f[_0xbd79('0x15')],{'raw':_0x5a511f[_0xbd79('0x16')]?_0x5a511f[_0xbd79('0x16')][_0xbd79('0x17')]===undefined?!![]:![]:!![]})[_0xbd79('0x8')](function(_0x14331b){logger[_0xbd79('0xf')](_0xbd79('0x12'),_0x5a511f);logger[_0xbd79('0x18')](_0xbd79('0x12'),_0x5a511f,JSON[_0xbd79('0xb')](_0x14331b));_0x813df2(_0x14331b);})[_0xbd79('0x11')](function(_0x26dfba){logger[_0xbd79('0xc')](_0xbd79('0x12'),_0x26dfba['message'],_0x5a511f);_0x3381cc(_0x29b17c[_0xbd79('0xc')](0x1f4,_0x26dfba[_0xbd79('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index ee3e51c..8ee00f5 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x4d09b6,_0x4cbdf6){var _0x10c546=function(_0x40c58e){while(--_0x40c58e){_0x4d09b6['push'](_0x4d09b6['shift']());}};_0x10c546(++_0x4cbdf6);}(_0xe706,0xa3));var _0x6e70=function(_0x2cc842,_0xd6800d){_0x2cc842=_0x2cc842-0x0;var _0x24adab=_0xe706[_0x2cc842];return _0x24adab;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x3c6023,_0x50c5e7){var _0x11ccc5=function(_0x47615d){while(--_0x47615d){_0x3c6023['push'](_0x3c6023['shift']());}};_0x11ccc5(++_0x50c5e7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index fc6b5fc..aa5d659 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 _0x4559=['exports','STRING','DATE'];(function(_0x50fb34,_0x56b847){var _0x478797=function(_0x2a45df){while(--_0x2a45df){_0x50fb34['push'](_0x50fb34['shift']());}};_0x478797(++_0x56b847);}(_0x4559,0x18f));var _0x9455=function(_0x2e33d3,_0x4375d2){_0x2e33d3=_0x2e33d3-0x0;var _0x5cd87d=_0x4559[_0x2e33d3];return _0x5cd87d;};'use strict';var Sequelize=require('sequelize');module[_0x9455('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x9455('0x1')]},'request':{'type':Sequelize[_0x9455('0x1')]},'channel':{'type':Sequelize[_0x9455('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9455('0x1')]},'uniqueid':{'type':Sequelize[_0x9455('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9455('0x1')]},'callingpres':{'type':Sequelize[_0x9455('0x1')]},'callingani2':{'type':Sequelize[_0x9455('0x1')]},'callington':{'type':Sequelize[_0x9455('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x9455('0x1')]},'context':{'type':Sequelize[_0x9455('0x1')]},'extension':{'type':Sequelize[_0x9455('0x1')]},'priority':{'type':Sequelize[_0x9455('0x1')]},'enhanced':{'type':Sequelize[_0x9455('0x1')]},'accountcode':{'type':Sequelize[_0x9455('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x9455('0x1')]},'joinAt':{'type':Sequelize[_0x9455('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0088=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x4e7eec,_0x13cd74){var _0x79b028=function(_0xd14b18){while(--_0xd14b18){_0x4e7eec['push'](_0x4e7eec['shift']());}};_0x79b028(++_0x13cd74);}(_0x0088,0x17f));var _0x8008=function(_0x2c9c41,_0x444a4a){_0x2c9c41=_0x2c9c41-0x0;var _0x181003=_0x0088[_0x2c9c41];return _0x181003;};'use strict';var Sequelize=require(_0x8008('0x0'));module[_0x8008('0x1')]={'network':{'type':Sequelize[_0x8008('0x2')]},'network_script':{'type':Sequelize[_0x8008('0x2')]},'request':{'type':Sequelize[_0x8008('0x2')]},'channel':{'type':Sequelize[_0x8008('0x2')]},'language':{'type':Sequelize[_0x8008('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x8008('0x2')]},'callingani2':{'type':Sequelize[_0x8008('0x2')]},'callington':{'type':Sequelize[_0x8008('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x8008('0x2')]},'rdnis':{'type':Sequelize[_0x8008('0x2')]},'context':{'type':Sequelize[_0x8008('0x2')]},'extension':{'type':Sequelize[_0x8008('0x2')]},'priority':{'type':Sequelize[_0x8008('0x2')]},'enhanced':{'type':Sequelize[_0x8008('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8008('0x3')]},'leaveAt':{'type':Sequelize[_0x8008('0x3')]},'bot':{'type':Sequelize[_0x8008('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 7d8c4db..f6f061e 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 _0xa34f=['undefined','limit','count','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','SquareReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','then','catch','show','params','rawAttributes','options','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x476c6f,_0x5dc8b9){var _0x53e534=function(_0x344f0d){while(--_0x344f0d){_0x476c6f['push'](_0x476c6f['shift']());}};_0x53e534(++_0x5dc8b9);}(_0xa34f,0x111));var _0xfa34=function(_0x1f2cd3,_0x275010){_0x1f2cd3=_0x1f2cd3-0x0;var _0x165869=_0xa34f[_0x1f2cd3];return _0x165869;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa34('0x0'));var zipdir=require(_0xfa34('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa34('0x2'));var moment=require(_0xfa34('0x3'));var BPromise=require(_0xfa34('0x4'));var Mustache=require('mustache');var util=require(_0xfa34('0x5'));var path=require(_0xfa34('0x6'));var sox=require(_0xfa34('0x7'));var csv=require('to-csv');var ejs=require(_0xfa34('0x8'));var fs=require('fs');var fs_extra=require(_0xfa34('0x9'));var _=require(_0xfa34('0xa'));var squel=require(_0xfa34('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfa34('0xc'));var toCsv=require(_0xfa34('0xd'));var querystring=require(_0xfa34('0xe'));var Papa=require(_0xfa34('0xf'));var Redis=require(_0xfa34('0x10'));var authService=require(_0xfa34('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfa34('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa34('0x13'));var utils=require(_0xfa34('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfa34('0x15'));var db=require(_0xfa34('0x16'))['db'];function respondWithStatusCode(_0x56dd0f,_0x508a1a){_0x508a1a=_0x508a1a||0xcc;return function(_0x1df804){if(_0x1df804){return _0x56dd0f['sendStatus'](_0x508a1a);}return _0x56dd0f[_0xfa34('0x17')](_0x508a1a)[_0xfa34('0x18')]();};}function respondWithResult(_0x43ff13,_0x3251a8){_0x3251a8=_0x3251a8||0xc8;return function(_0xc3fc1e){if(_0xc3fc1e){return _0x43ff13[_0xfa34('0x17')](_0x3251a8)[_0xfa34('0x19')](_0xc3fc1e);}};}function respondWithFilteredResult(_0x1d1530,_0x2a1aa2){return function(_0x1e1821){if(_0x1e1821){var _0x543282=typeof _0x2a1aa2[_0xfa34('0x1a')]===_0xfa34('0x1b')&&typeof _0x2a1aa2[_0xfa34('0x1c')]==='undefined';var _0x25b4f2=_0x1e1821[_0xfa34('0x1d')];var _0x3036ca=_0x543282?0x0:_0x2a1aa2['offset'];var _0x4d23fe=_0x543282?_0x1e1821[_0xfa34('0x1d')]:_0x2a1aa2[_0xfa34('0x1a')]+_0x2a1aa2[_0xfa34('0x1c')];var _0x3a5146;if(_0x4d23fe>=_0x25b4f2){_0x4d23fe=_0x25b4f2;_0x3a5146=0xc8;}else{_0x3a5146=0xce;}_0x1d1530[_0xfa34('0x17')](_0x3a5146);return _0x1d1530[_0xfa34('0x1e')](_0xfa34('0x1f'),_0x3036ca+'-'+_0x4d23fe+'/'+_0x25b4f2)[_0xfa34('0x19')](_0x1e1821);}return null;};}function patchUpdates(_0x5d08c9){return function(_0x50afef){try{jsonpatch['apply'](_0x50afef,_0x5d08c9,!![]);}catch(_0x3dfef1){return BPromise[_0xfa34('0x20')](_0x3dfef1);}return _0x50afef[_0xfa34('0x21')]();};}function saveUpdates(_0xfaeb15,_0x268abf){return function(_0x24d3e1){if(_0x24d3e1){return _0x24d3e1[_0xfa34('0x22')](_0xfaeb15)['then'](function(_0xc8d7b8){return _0xc8d7b8;});}return null;};}function removeEntity(_0x4073a9,_0x291037){return function(_0x945b4e){if(_0x945b4e){return _0x945b4e[_0xfa34('0x23')]()['then'](function(){_0x4073a9[_0xfa34('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ea3d,_0x44e984){return function(_0x2c8e5b){if(!_0x2c8e5b){_0x46ea3d[_0xfa34('0x24')](0x194);}return _0x2c8e5b;};}function handleError(_0x32f95a,_0x4596fd){_0x4596fd=_0x4596fd||0x1f4;return function(_0x5c99d9){logger['error'](_0x5c99d9['stack']);if(_0x5c99d9['name']){delete _0x5c99d9[_0xfa34('0x25')];}_0x32f95a[_0xfa34('0x17')](_0x4596fd)[_0xfa34('0x26')](_0x5c99d9);};}exports[_0xfa34('0x27')]=function(_0x4bcaa8,_0x77ee28){var _0x5b9eda={},_0x458d32={},_0x2565c0={'count':0x0,'rows':[]};var _0xc0654b=_['map'](db[_0xfa34('0x28')]['rawAttributes'],function(_0x3de00e){return{'name':_0x3de00e[_0xfa34('0x29')],'type':_0x3de00e[_0xfa34('0x2a')][_0xfa34('0x2b')]};});_0x458d32[_0xfa34('0x2c')]=_['map'](_0xc0654b,_0xfa34('0x25'));_0x458d32['query']=_[_0xfa34('0x2d')](_0x4bcaa8[_0xfa34('0x2e')]);_0x458d32[_0xfa34('0x2f')]=_[_0xfa34('0x30')](_0x458d32[_0xfa34('0x2c')],_0x458d32[_0xfa34('0x2e')]);_0x5b9eda[_0xfa34('0x31')]=_[_0xfa34('0x30')](_0x458d32['model'],qs[_0xfa34('0x32')](_0x4bcaa8[_0xfa34('0x2e')][_0xfa34('0x32')]));_0x5b9eda['attributes']=_0x5b9eda[_0xfa34('0x31')][_0xfa34('0x33')]?_0x5b9eda['attributes']:_0x458d32[_0xfa34('0x2c')];if(!_0x4bcaa8[_0xfa34('0x2e')][_0xfa34('0x34')](_0xfa34('0x35'))){_0x5b9eda[_0xfa34('0x1c')]=qs[_0xfa34('0x1c')](_0x4bcaa8['query'][_0xfa34('0x1c')]);_0x5b9eda[_0xfa34('0x1a')]=qs[_0xfa34('0x1a')](_0x4bcaa8[_0xfa34('0x2e')]['offset']);}_0x5b9eda[_0xfa34('0x36')]=qs['sort'](_0x4bcaa8[_0xfa34('0x2e')][_0xfa34('0x37')]);_0x5b9eda[_0xfa34('0x38')]=qs['filters'](_[_0xfa34('0x39')](_0x4bcaa8['query'],_0x458d32[_0xfa34('0x2f')]),_0xc0654b);if(_0x4bcaa8[_0xfa34('0x2e')][_0xfa34('0x3a')]){_0x5b9eda[_0xfa34('0x38')]=_['merge'](_0x5b9eda[_0xfa34('0x38')],{'$or':_[_0xfa34('0x3b')](_0xc0654b,function(_0x3d9530){if(_0x3d9530[_0xfa34('0x2a')]!==_0xfa34('0x3c')){var _0x10e511={};_0x10e511[_0x3d9530[_0xfa34('0x25')]]={'$like':'%'+_0x4bcaa8[_0xfa34('0x2e')]['filter']+'%'};return _0x10e511;}})});}_0x5b9eda=_[_0xfa34('0x3d')]({},_0x5b9eda,_0x4bcaa8['options']);var _0x1e101c={'where':_0x5b9eda['where']};return db['SquareReport']['count'](_0x1e101c)['then'](function(_0x1169d5){_0x2565c0['count']=_0x1169d5;if(_0x4bcaa8[_0xfa34('0x2e')][_0xfa34('0x3e')]){_0x5b9eda[_0xfa34('0x3f')]=[{'all':!![]}];}return db[_0xfa34('0x28')][_0xfa34('0x40')](_0x5b9eda);})[_0xfa34('0x41')](function(_0x4989e1){_0x2565c0['rows']=_0x4989e1;return _0x2565c0;})['then'](respondWithFilteredResult(_0x77ee28,_0x5b9eda))[_0xfa34('0x42')](handleError(_0x77ee28,null));};exports[_0xfa34('0x43')]=function(_0x411981,_0x3e80a9){var _0x2b20fd={'raw':!![],'where':{'id':_0x411981[_0xfa34('0x44')]['id']}},_0x29325b={};_0x29325b[_0xfa34('0x2c')]=_[_0xfa34('0x2d')](db['SquareReport'][_0xfa34('0x45')]);_0x29325b[_0xfa34('0x2e')]=_[_0xfa34('0x2d')](_0x411981['query']);_0x29325b[_0xfa34('0x2f')]=_[_0xfa34('0x30')](_0x29325b['model'],_0x29325b[_0xfa34('0x2e')]);_0x2b20fd['attributes']=_['intersection'](_0x29325b['model'],qs[_0xfa34('0x32')](_0x411981[_0xfa34('0x2e')][_0xfa34('0x32')]));_0x2b20fd[_0xfa34('0x31')]=_0x2b20fd['attributes']['length']?_0x2b20fd[_0xfa34('0x31')]:_0x29325b[_0xfa34('0x2c')];if(_0x411981['query'][_0xfa34('0x3e')]){_0x2b20fd[_0xfa34('0x3f')]=[{'all':!![]}];}_0x2b20fd=_[_0xfa34('0x3d')]({},_0x2b20fd,_0x411981[_0xfa34('0x46')]);return db[_0xfa34('0x28')][_0xfa34('0x47')](_0x2b20fd)[_0xfa34('0x41')](handleEntityNotFound(_0x3e80a9,null))[_0xfa34('0x41')](respondWithResult(_0x3e80a9,null))[_0xfa34('0x42')](handleError(_0x3e80a9,null));};exports[_0xfa34('0x48')]=function(_0x10bec4,_0x2fcc09){return db[_0xfa34('0x28')]['create'](_0x10bec4[_0xfa34('0x49')],{})['then'](respondWithResult(_0x2fcc09,0xc9))[_0xfa34('0x42')](handleError(_0x2fcc09,null));};exports['update']=function(_0x4f3e9c,_0x539a6d){if(_0x4f3e9c[_0xfa34('0x49')]['id']){delete _0x4f3e9c[_0xfa34('0x49')]['id'];}return db[_0xfa34('0x28')][_0xfa34('0x47')]({'where':{'id':_0x4f3e9c[_0xfa34('0x44')]['id']}})[_0xfa34('0x41')](handleEntityNotFound(_0x539a6d,null))[_0xfa34('0x41')](saveUpdates(_0x4f3e9c[_0xfa34('0x49')],null))[_0xfa34('0x41')](respondWithResult(_0x539a6d,null))[_0xfa34('0x42')](handleError(_0x539a6d,null));};exports['destroy']=function(_0x248833,_0x17fb7b){return db[_0xfa34('0x28')][_0xfa34('0x47')]({'where':{'id':_0x248833[_0xfa34('0x44')]['id']}})[_0xfa34('0x41')](handleEntityNotFound(_0x17fb7b,null))[_0xfa34('0x41')](removeEntity(_0x17fb7b,null))['catch'](handleError(_0x17fb7b,null));};exports[_0xfa34('0x4a')]=function(_0x77664a,_0x2ada25){return db[_0xfa34('0x28')][_0xfa34('0x4a')]()[_0xfa34('0x41')](respondWithResult(_0x2ada25,null))['catch'](handleError(_0x2ada25,null));}; \ No newline at end of file +var _0x4996=['../../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','reject','save','update','then','destroy','stack','name','send','index','map','SquareReport','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0x4996,0x1bc));var _0x6499=function(_0x32a2fc,_0x1be7d5){_0x32a2fc=_0x32a2fc-0x0;var _0x3574c5=_0x4996[_0x32a2fc];return _0x3574c5;};'use strict';var emlformat=require(_0x6499('0x0'));var rimraf=require(_0x6499('0x1'));var zipdir=require(_0x6499('0x2'));var jsonpatch=require(_0x6499('0x3'));var rp=require(_0x6499('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6499('0x5'));var path=require(_0x6499('0x6'));var sox=require(_0x6499('0x7'));var csv=require(_0x6499('0x8'));var ejs=require(_0x6499('0x9'));var fs=require('fs');var fs_extra=require(_0x6499('0xa'));var _=require(_0x6499('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6499('0xc'));var deskjs=require(_0x6499('0xd'));var toCsv=require(_0x6499('0x8'));var querystring=require(_0x6499('0xe'));var Papa=require(_0x6499('0xf'));var Redis=require(_0x6499('0x10'));var authService=require(_0x6499('0x11'));var qs=require(_0x6499('0x12'));var as=require(_0x6499('0x13'));var hardwareService=require(_0x6499('0x14'));var logger=require(_0x6499('0x15'))(_0x6499('0x16'));var utils=require(_0x6499('0x17'));var config=require(_0x6499('0x18'));var licenseUtil=require(_0x6499('0x19'));var db=require(_0x6499('0x1a'))['db'];function respondWithStatusCode(_0x51bbea,_0x531c4b){_0x531c4b=_0x531c4b||0xcc;return function(_0xec9b17){if(_0xec9b17){return _0x51bbea[_0x6499('0x1b')](_0x531c4b);}return _0x51bbea[_0x6499('0x1c')](_0x531c4b)[_0x6499('0x1d')]();};}function respondWithResult(_0xded079,_0x284761){_0x284761=_0x284761||0xc8;return function(_0x35570a){if(_0x35570a){return _0xded079['status'](_0x284761)[_0x6499('0x1e')](_0x35570a);}};}function respondWithFilteredResult(_0x5ef74a,_0x5a6949){return function(_0x5238de){if(_0x5238de){var _0x21580c=typeof _0x5a6949[_0x6499('0x1f')]===_0x6499('0x20')&&typeof _0x5a6949[_0x6499('0x21')]===_0x6499('0x20');var _0x47b720=_0x5238de[_0x6499('0x22')];var _0x226281=_0x21580c?0x0:_0x5a6949[_0x6499('0x1f')];var _0x4a3bba=_0x21580c?_0x5238de[_0x6499('0x22')]:_0x5a6949[_0x6499('0x1f')]+_0x5a6949['limit'];var _0x507a1c;if(_0x4a3bba>=_0x47b720){_0x4a3bba=_0x47b720;_0x507a1c=0xc8;}else{_0x507a1c=0xce;}_0x5ef74a[_0x6499('0x1c')](_0x507a1c);return _0x5ef74a[_0x6499('0x23')](_0x6499('0x24'),_0x226281+'-'+_0x4a3bba+'/'+_0x47b720)[_0x6499('0x1e')](_0x5238de);}return null;};}function patchUpdates(_0x445579){return function(_0x4c0ad4){try{jsonpatch['apply'](_0x4c0ad4,_0x445579,!![]);}catch(_0x439bf0){return BPromise[_0x6499('0x25')](_0x439bf0);}return _0x4c0ad4[_0x6499('0x26')]();};}function saveUpdates(_0x10e21a,_0x52907c){return function(_0x55e91f){if(_0x55e91f){return _0x55e91f[_0x6499('0x27')](_0x10e21a)[_0x6499('0x28')](function(_0x3bfb5c){return _0x3bfb5c;});}return null;};}function removeEntity(_0x3b1277,_0x5270e){return function(_0x3e9ab4){if(_0x3e9ab4){return _0x3e9ab4[_0x6499('0x29')]()[_0x6499('0x28')](function(){_0x3b1277[_0x6499('0x1c')](0xcc)[_0x6499('0x1d')]();});}};}function handleEntityNotFound(_0x40c208,_0x23d2cf){return function(_0x4ceba4){if(!_0x4ceba4){_0x40c208['sendStatus'](0x194);}return _0x4ceba4;};}function handleError(_0x3c3dc9,_0x1d757b){_0x1d757b=_0x1d757b||0x1f4;return function(_0x3151a4){logger['error'](_0x3151a4[_0x6499('0x2a')]);if(_0x3151a4[_0x6499('0x2b')]){delete _0x3151a4['name'];}_0x3c3dc9[_0x6499('0x1c')](_0x1d757b)[_0x6499('0x2c')](_0x3151a4);};}exports[_0x6499('0x2d')]=function(_0xd4e4ba,_0x4e545e){var _0x134189={},_0x25761b={},_0xba895a={'count':0x0,'rows':[]};var _0x40491b=_[_0x6499('0x2e')](db[_0x6499('0x2f')]['rawAttributes'],function(_0x52342c){return{'name':_0x52342c[_0x6499('0x30')],'type':_0x52342c[_0x6499('0x31')]['key']};});_0x25761b[_0x6499('0x32')]=_[_0x6499('0x2e')](_0x40491b,_0x6499('0x2b'));_0x25761b['query']=_['keys'](_0xd4e4ba[_0x6499('0x33')]);_0x25761b[_0x6499('0x34')]=_['intersection'](_0x25761b[_0x6499('0x32')],_0x25761b[_0x6499('0x33')]);_0x134189[_0x6499('0x35')]=_[_0x6499('0x36')](_0x25761b[_0x6499('0x32')],qs['fields'](_0xd4e4ba[_0x6499('0x33')][_0x6499('0x37')]));_0x134189[_0x6499('0x35')]=_0x134189[_0x6499('0x35')][_0x6499('0x38')]?_0x134189['attributes']:_0x25761b[_0x6499('0x32')];if(!_0xd4e4ba[_0x6499('0x33')][_0x6499('0x39')]('nolimit')){_0x134189[_0x6499('0x21')]=qs[_0x6499('0x21')](_0xd4e4ba[_0x6499('0x33')]['limit']);_0x134189[_0x6499('0x1f')]=qs['offset'](_0xd4e4ba[_0x6499('0x33')][_0x6499('0x1f')]);}_0x134189[_0x6499('0x3a')]=qs[_0x6499('0x3b')](_0xd4e4ba[_0x6499('0x33')][_0x6499('0x3b')]);_0x134189[_0x6499('0x3c')]=qs[_0x6499('0x34')](_[_0x6499('0x3d')](_0xd4e4ba[_0x6499('0x33')],_0x25761b[_0x6499('0x34')]),_0x40491b);if(_0xd4e4ba[_0x6499('0x33')]['filter']){_0x134189['where']=_[_0x6499('0x3e')](_0x134189[_0x6499('0x3c')],{'$or':_[_0x6499('0x2e')](_0x40491b,function(_0x3c4c60){if(_0x3c4c60[_0x6499('0x31')]!==_0x6499('0x3f')){var _0x46329f={};_0x46329f[_0x3c4c60[_0x6499('0x2b')]]={'$like':'%'+_0xd4e4ba[_0x6499('0x33')]['filter']+'%'};return _0x46329f;}})});}_0x134189=_[_0x6499('0x3e')]({},_0x134189,_0xd4e4ba[_0x6499('0x40')]);var _0x2581c5={'where':_0x134189[_0x6499('0x3c')]};return db[_0x6499('0x2f')][_0x6499('0x22')](_0x2581c5)[_0x6499('0x28')](function(_0x6cb12d){_0xba895a[_0x6499('0x22')]=_0x6cb12d;if(_0xd4e4ba[_0x6499('0x33')][_0x6499('0x41')]){_0x134189[_0x6499('0x42')]=[{'all':!![]}];}return db[_0x6499('0x2f')][_0x6499('0x43')](_0x134189);})[_0x6499('0x28')](function(_0x5c0ada){_0xba895a[_0x6499('0x44')]=_0x5c0ada;return _0xba895a;})[_0x6499('0x28')](respondWithFilteredResult(_0x4e545e,_0x134189))[_0x6499('0x45')](handleError(_0x4e545e,null));};exports['show']=function(_0x166af2,_0x30809c){var _0xafef01={'raw':!![],'where':{'id':_0x166af2[_0x6499('0x46')]['id']}},_0x47016b={};_0x47016b['model']=_[_0x6499('0x47')](db[_0x6499('0x2f')][_0x6499('0x48')]);_0x47016b[_0x6499('0x33')]=_[_0x6499('0x47')](_0x166af2['query']);_0x47016b[_0x6499('0x34')]=_['intersection'](_0x47016b[_0x6499('0x32')],_0x47016b['query']);_0xafef01[_0x6499('0x35')]=_[_0x6499('0x36')](_0x47016b[_0x6499('0x32')],qs[_0x6499('0x37')](_0x166af2[_0x6499('0x33')][_0x6499('0x37')]));_0xafef01[_0x6499('0x35')]=_0xafef01['attributes'][_0x6499('0x38')]?_0xafef01['attributes']:_0x47016b['model'];if(_0x166af2[_0x6499('0x33')][_0x6499('0x41')]){_0xafef01['include']=[{'all':!![]}];}_0xafef01=_[_0x6499('0x3e')]({},_0xafef01,_0x166af2[_0x6499('0x40')]);return db[_0x6499('0x2f')]['find'](_0xafef01)['then'](handleEntityNotFound(_0x30809c,null))[_0x6499('0x28')](respondWithResult(_0x30809c,null))[_0x6499('0x45')](handleError(_0x30809c,null));};exports['create']=function(_0x26b054,_0x3a5a73){return db['SquareReport'][_0x6499('0x49')](_0x26b054[_0x6499('0x4a')],{})[_0x6499('0x28')](respondWithResult(_0x3a5a73,0xc9))[_0x6499('0x45')](handleError(_0x3a5a73,null));};exports[_0x6499('0x27')]=function(_0x459071,_0x17a30f){if(_0x459071['body']['id']){delete _0x459071['body']['id'];}return db[_0x6499('0x2f')]['find']({'where':{'id':_0x459071[_0x6499('0x46')]['id']}})[_0x6499('0x28')](handleEntityNotFound(_0x17a30f,null))[_0x6499('0x28')](saveUpdates(_0x459071[_0x6499('0x4a')],null))[_0x6499('0x28')](respondWithResult(_0x17a30f,null))[_0x6499('0x45')](handleError(_0x17a30f,null));};exports['destroy']=function(_0x12c33e,_0xdfc1e1){return db[_0x6499('0x2f')][_0x6499('0x4b')]({'where':{'id':_0x12c33e[_0x6499('0x46')]['id']}})[_0x6499('0x28')](handleEntityNotFound(_0xdfc1e1,null))[_0x6499('0x28')](removeEntity(_0xdfc1e1,null))[_0x6499('0x45')](handleError(_0xdfc1e1,null));};exports[_0x6499('0x4c')]=function(_0x5c22b4,_0x4eb1fc){return db[_0x6499('0x2f')][_0x6499('0x4c')]()['then'](respondWithResult(_0x4eb1fc,null))[_0x6499('0x45')](handleError(_0x4eb1fc,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0ee9033..38570a9 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 _0x03b2=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x2adde2,_0x1e5765){var _0xea0f0d=function(_0xe57c2e){while(--_0xe57c2e){_0x2adde2['push'](_0x2adde2['shift']());}};_0xea0f0d(++_0x1e5765);}(_0x03b2,0xe5));var _0x203b=function(_0x55d91d,_0x4dbce7){_0x55d91d=_0x55d91d-0x0;var _0x12dd40=_0x03b2[_0x55d91d];return _0x12dd40;};'use strict';var _=require(_0x203b('0x0'));var util=require(_0x203b('0x1'));var logger=require(_0x203b('0x2'))(_0x203b('0x3'));var moment=require(_0x203b('0x4'));var BPromise=require(_0x203b('0x5'));var rp=require(_0x203b('0x6'));var fs=require('fs');var path=require(_0x203b('0x7'));var rimraf=require(_0x203b('0x8'));var config=require(_0x203b('0x9'));var attributes=require(_0x203b('0xa'));module[_0x203b('0xb')]=function(_0x118634,_0x2f71d2){return _0x118634[_0x203b('0xc')]('SquareReport',attributes,{'tableName':_0x203b('0xd'),'paranoid':![],'indexes':[{'name':_0x203b('0xe'),'fields':[_0x203b('0xf'),_0x203b('0x10')]},{'name':'leaveAt','fields':[_0x203b('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4669=['SquareReport','report_square','uid_pname','lodash','util','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x418f54,_0x32452b){var _0x54e0e8=function(_0x315a7f){while(--_0x315a7f){_0x418f54['push'](_0x418f54['shift']());}};_0x54e0e8(++_0x32452b);}(_0x4669,0xdb));var _0x9466=function(_0x5363a3,_0x3c6310){_0x5363a3=_0x5363a3-0x0;var _0x4cd0c6=_0x4669[_0x5363a3];return _0x4cd0c6;};'use strict';var _=require(_0x9466('0x0'));var util=require(_0x9466('0x1'));var logger=require('../../config/logger')(_0x9466('0x2'));var moment=require(_0x9466('0x3'));var BPromise=require(_0x9466('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9466('0x5'));var rimraf=require(_0x9466('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x9466('0x7')]=function(_0x471561,_0x3c1fff){return _0x471561[_0x9466('0x8')](_0x9466('0x9'),attributes,{'tableName':_0x9466('0xa'),'paranoid':![],'indexes':[{'name':_0x9466('0xb'),'fields':['uniqueid','project_name']},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 3a0f63b..39e5309 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 _0xdb7a=['result','catch','SquareReport','body','raw','debug','UpdateSquareReport','update','options','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareReport,\x20%s,\x20%s'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0xdb7a,0xb1));var _0xadb7=function(_0x40b5b2,_0x18c87d){_0x40b5b2=_0x40b5b2-0x0;var _0x3fe268=_0xdb7a[_0x40b5b2];return _0x3fe268;};'use strict';var _=require(_0xadb7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xadb7('0x1'));var rs=require(_0xadb7('0x2'));var fs=require('fs');var Redis=require(_0xadb7('0x3'));var db=require(_0xadb7('0x4'))['db'];var utils=require(_0xadb7('0x5'));var logger=require(_0xadb7('0x6'))('rpc');var config=require(_0xadb7('0x7'));var jayson=require(_0xadb7('0x8'));var client=jayson[_0xadb7('0x9')][_0xadb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9669e7,_0x2c7fc7,_0x330ed6){return new BPromise(function(_0xc81fa,_0x15e06c){return client[_0xadb7('0xb')](_0x9669e7,_0x330ed6)[_0xadb7('0xc')](function(_0x334252){logger[_0xadb7('0xd')]('SquareReport,\x20%s,\x20%s',_0x2c7fc7,'request\x20sent');logger['debug'](_0xadb7('0xe'),_0x2c7fc7,_0xadb7('0xf'),JSON[_0xadb7('0x10')](_0x334252));if(_0x334252['error']){if(_0x334252[_0xadb7('0x11')][_0xadb7('0x12')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x2c7fc7,_0x334252[_0xadb7('0x11')][_0xadb7('0x13')]);return _0x15e06c(_0x334252['error']['message']);}logger['error'](_0xadb7('0x14'),_0x2c7fc7,_0x334252['error']['message']);return _0xc81fa(_0x334252[_0xadb7('0x11')][_0xadb7('0x13')]);}else{logger['info'](_0xadb7('0x14'),_0x2c7fc7,'request\x20sent');_0xc81fa(_0x334252[_0xadb7('0x15')][_0xadb7('0x13')]);}})[_0xadb7('0x16')](function(_0x3f763a){logger[_0xadb7('0x11')](_0xadb7('0x14'),_0x2c7fc7,_0x3f763a);_0x15e06c(_0x3f763a);});});}exports['CreateSquareReport']=function(_0x469d2b){var _0x4dcca0=this;return new Promise(function(_0x1f454c,_0x3a16fa){return db[_0xadb7('0x17')]['create'](_0x469d2b[_0xadb7('0x18')],{'raw':_0x469d2b['options']?_0x469d2b['options'][_0xadb7('0x19')]===undefined?!![]:![]:!![]})[_0xadb7('0xc')](function(_0x4f6efc){logger['info']('CreateSquareReport',_0x469d2b);logger[_0xadb7('0x1a')]('CreateSquareReport',_0x469d2b,JSON[_0xadb7('0x10')](_0x4f6efc));_0x1f454c(_0x4f6efc);})[_0xadb7('0x16')](function(_0x58ff0a){logger['error']('CreateSquareReport',_0x58ff0a[_0xadb7('0x13')],_0x469d2b);_0x3a16fa(_0x4dcca0[_0xadb7('0x11')](0x1f4,_0x58ff0a[_0xadb7('0x13')]));});});};exports[_0xadb7('0x1b')]=function(_0x326cb3){var _0x4a452b=this;return new Promise(function(_0x51751b,_0x392672){return db[_0xadb7('0x17')][_0xadb7('0x1c')](_0x326cb3[_0xadb7('0x18')],{'raw':_0x326cb3[_0xadb7('0x1d')]?_0x326cb3[_0xadb7('0x1d')][_0xadb7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x326cb3[_0xadb7('0x1d')]?_0x326cb3[_0xadb7('0x1d')][_0xadb7('0x1e')]||null:null,'attributes':_0x326cb3[_0xadb7('0x1d')]?_0x326cb3['options'][_0xadb7('0x1f')]||null:null,'limit':_0x326cb3['options']?_0x326cb3[_0xadb7('0x1d')][_0xadb7('0x20')]||null:null})[_0xadb7('0xc')](function(_0xd1774){logger[_0xadb7('0xd')](_0xadb7('0x1b'),_0x326cb3);logger[_0xadb7('0x1a')](_0xadb7('0x1b'),_0x326cb3,JSON['stringify'](_0xd1774));_0x51751b(_0xd1774);})['catch'](function(_0x50f7f4){logger['error'](_0xadb7('0x1b'),_0x50f7f4[_0xadb7('0x13')],_0x326cb3);_0x392672(_0x4a452b['error'](0x1f4,_0x50f7f4[_0xadb7('0x13')]));});});}; \ No newline at end of file +var _0x22eb=['UpdateSquareReport','SquareReport','update','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','error','code','SquareReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareReport','create','body','options','raw'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x22eb,0xed));var _0xb22e=function(_0x4bed86,_0x18dbb3){_0x4bed86=_0x4bed86-0x0;var _0x183304=_0x22eb[_0x4bed86];return _0x183304;};'use strict';var _=require('lodash');var util=require(_0xb22e('0x0'));var moment=require('moment');var BPromise=require(_0xb22e('0x1'));var rs=require(_0xb22e('0x2'));var fs=require('fs');var Redis=require(_0xb22e('0x3'));var db=require(_0xb22e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb22e('0x5'));var config=require(_0xb22e('0x6'));var jayson=require(_0xb22e('0x7'));var client=jayson[_0xb22e('0x8')][_0xb22e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c3702,_0x353a43,_0x1df40a){return new BPromise(function(_0x161af2,_0x16bc60){return client[_0xb22e('0xa')](_0x1c3702,_0x1df40a)[_0xb22e('0xb')](function(_0x58b6ca){logger[_0xb22e('0xc')]('SquareReport,\x20%s,\x20%s',_0x353a43,'request\x20sent');logger[_0xb22e('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x353a43,'request\x20sent',JSON[_0xb22e('0xe')](_0x58b6ca));if(_0x58b6ca[_0xb22e('0xf')]){if(_0x58b6ca[_0xb22e('0xf')][_0xb22e('0x10')]===0x1f4){logger[_0xb22e('0xf')]('SquareReport,\x20%s,\x20%s',_0x353a43,_0x58b6ca[_0xb22e('0xf')]['message']);return _0x16bc60(_0x58b6ca[_0xb22e('0xf')]['message']);}logger['error'](_0xb22e('0x11'),_0x353a43,_0x58b6ca[_0xb22e('0xf')][_0xb22e('0x12')]);return _0x161af2(_0x58b6ca[_0xb22e('0xf')][_0xb22e('0x12')]);}else{logger[_0xb22e('0xc')](_0xb22e('0x11'),_0x353a43,_0xb22e('0x13'));_0x161af2(_0x58b6ca[_0xb22e('0x14')]['message']);}})[_0xb22e('0x15')](function(_0xc6ad4d){logger['error'](_0xb22e('0x11'),_0x353a43,_0xc6ad4d);_0x16bc60(_0xc6ad4d);});});}exports[_0xb22e('0x16')]=function(_0xc71741){var _0x4d5f9a=this;return new Promise(function(_0x41ca7c,_0x351f6c){return db['SquareReport'][_0xb22e('0x17')](_0xc71741[_0xb22e('0x18')],{'raw':_0xc71741[_0xb22e('0x19')]?_0xc71741['options'][_0xb22e('0x1a')]===undefined?!![]:![]:!![]})[_0xb22e('0xb')](function(_0x450126){logger[_0xb22e('0xc')](_0xb22e('0x16'),_0xc71741);logger[_0xb22e('0xd')](_0xb22e('0x16'),_0xc71741,JSON['stringify'](_0x450126));_0x41ca7c(_0x450126);})['catch'](function(_0x6e6a30){logger[_0xb22e('0xf')](_0xb22e('0x16'),_0x6e6a30['message'],_0xc71741);_0x351f6c(_0x4d5f9a[_0xb22e('0xf')](0x1f4,_0x6e6a30['message']));});});};exports[_0xb22e('0x1b')]=function(_0x27bac7){var _0x42c719=this;return new Promise(function(_0xc349c6,_0x290bbb){return db[_0xb22e('0x1c')][_0xb22e('0x1d')](_0x27bac7[_0xb22e('0x18')],{'raw':_0x27bac7[_0xb22e('0x19')]?_0x27bac7[_0xb22e('0x19')][_0xb22e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27bac7['options']?_0x27bac7[_0xb22e('0x19')][_0xb22e('0x1e')]||null:null,'attributes':_0x27bac7[_0xb22e('0x19')]?_0x27bac7['options'][_0xb22e('0x1f')]||null:null,'limit':_0x27bac7[_0xb22e('0x19')]?_0x27bac7[_0xb22e('0x19')][_0xb22e('0x20')]||null:null})['then'](function(_0x56d2f3){logger[_0xb22e('0xc')]('UpdateSquareReport',_0x27bac7);logger[_0xb22e('0xd')](_0xb22e('0x1b'),_0x27bac7,JSON[_0xb22e('0xe')](_0x56d2f3));_0xc349c6(_0x56d2f3);})[_0xb22e('0x15')](function(_0x2e6726){logger[_0xb22e('0xf')](_0xb22e('0x1b'),_0x2e6726[_0xb22e('0x12')],_0x27bac7);_0x290bbb(_0x42c719[_0xb22e('0xf')](0x1f4,_0x2e6726['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1f977e6..9672aec 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 _0x8b55=['index','get','isAuthenticated','describe','/:id','show','post','create','delete','destroy','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0x8b55,0x19a));var _0x58b5=function(_0x23ab46,_0x42a293){_0x23ab46=_0x23ab46-0x0;var _0x29cab0=_0x8b55[_0x23ab46];return _0x29cab0;};'use strict';var multer=require('multer');var util=require(_0x58b5('0x0'));var path=require(_0x58b5('0x1'));var timeout=require(_0x58b5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x58b5('0x3'));var config=require(_0x58b5('0x4'));var controller=require(_0x58b5('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x58b5('0x6')]);router[_0x58b5('0x7')]('/describe',auth[_0x58b5('0x8')](),controller[_0x58b5('0x9')]);router[_0x58b5('0x7')](_0x58b5('0xa'),auth[_0x58b5('0x8')](),controller[_0x58b5('0xb')]);router[_0x58b5('0xc')]('/',auth['isAuthenticated'](),controller[_0x58b5('0xd')]);router['put'](_0x58b5('0xa'),auth[_0x58b5('0x8')](),controller['update']);router[_0x58b5('0xe')](_0x58b5('0xa'),auth[_0x58b5('0x8')](),controller[_0x58b5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9268=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','post','create','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra'];(function(_0x186520,_0x4a5b9a){var _0x498b7f=function(_0x54a34d){while(--_0x54a34d){_0x186520['push'](_0x186520['shift']());}};_0x498b7f(++_0x4a5b9a);}(_0x9268,0x152));var _0x8926=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x9268[_0x3b5250];return _0xc844a1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8926('0x0'));var express=require(_0x8926('0x1'));var router=express[_0x8926('0x2')]();var fs_extra=require(_0x8926('0x3'));var auth=require(_0x8926('0x4'));var interaction=require(_0x8926('0x5'));var config=require(_0x8926('0x6'));var controller=require(_0x8926('0x7'));router[_0x8926('0x8')]('/',auth[_0x8926('0x9')](),controller[_0x8926('0xa')]);router[_0x8926('0x8')](_0x8926('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8926('0xc')]('/',auth[_0x8926('0x9')](),controller[_0x8926('0xd')]);router['put']('/:id',auth[_0x8926('0x9')](),controller[_0x8926('0xe')]);router[_0x8926('0xf')]('/:id',auth[_0x8926('0x9')](),controller[_0x8926('0x10')]);module[_0x8926('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4a0f8da..4d96449 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 _0x3715=['exports','STRING','TEXT','sequelize'];(function(_0x51472d,_0x592b0b){var _0x5f00f1=function(_0x4a9b97){while(--_0x4a9b97){_0x51472d['push'](_0x51472d['shift']());}};_0x5f00f1(++_0x592b0b);}(_0x3715,0xc3));var _0x5371=function(_0x5df8b9,_0x5a5867){_0x5df8b9=_0x5df8b9-0x0;var _0x4b0d0d=_0x3715[_0x5df8b9];return _0x4b0d0d;};'use strict';var Sequelize=require(_0x5371('0x0'));module[_0x5371('0x1')]={'uniqueid':{'type':Sequelize[_0x5371('0x2')]},'node':{'type':Sequelize[_0x5371('0x2')]},'application':{'type':Sequelize[_0x5371('0x2')]},'data':{'type':Sequelize[_0x5371('0x3')]},'project_name':{'type':Sequelize[_0x5371('0x2')]},'callerid':{'type':Sequelize[_0x5371('0x2')]}}; \ No newline at end of file +var _0x8078=['STRING','TEXT','sequelize'];(function(_0x45c499,_0x3dc24e){var _0x3109b8=function(_0x2c1bcc){while(--_0x2c1bcc){_0x45c499['push'](_0x45c499['shift']());}};_0x3109b8(++_0x3dc24e);}(_0x8078,0x164));var _0x8807=function(_0x56233c,_0x2c292c){_0x56233c=_0x56233c-0x0;var _0x7d571d=_0x8078[_0x56233c];return _0x7d571d;};'use strict';var Sequelize=require(_0x8807('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8807('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x8807('0x1')]},'data':{'type':Sequelize[_0x8807('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8807('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1139173..eeb223d 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 _0x4147=['status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','SquareDetailsReport','include','rows','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x4147,0x1b8));var _0x7414=function(_0x4a47c0,_0x3eca63){_0x4a47c0=_0x4a47c0-0x0;var _0x525661=_0x4147[_0x4a47c0];return _0x525661;};'use strict';var emlformat=require(_0x7414('0x0'));var rimraf=require(_0x7414('0x1'));var zipdir=require(_0x7414('0x2'));var jsonpatch=require(_0x7414('0x3'));var rp=require(_0x7414('0x4'));var moment=require('moment');var BPromise=require(_0x7414('0x5'));var Mustache=require(_0x7414('0x6'));var util=require('util');var path=require(_0x7414('0x7'));var sox=require(_0x7414('0x8'));var csv=require(_0x7414('0x9'));var ejs=require(_0x7414('0xa'));var fs=require('fs');var fs_extra=require(_0x7414('0xb'));var _=require(_0x7414('0xc'));var squel=require(_0x7414('0xd'));var crypto=require(_0x7414('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7414('0xf'));var toCsv=require(_0x7414('0x9'));var querystring=require(_0x7414('0x10'));var Papa=require(_0x7414('0x11'));var Redis=require(_0x7414('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7414('0x13'));var as=require(_0x7414('0x14'));var hardwareService=require(_0x7414('0x15'));var logger=require(_0x7414('0x16'))(_0x7414('0x17'));var utils=require(_0x7414('0x18'));var config=require(_0x7414('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7414('0x1a'))['db'];function respondWithStatusCode(_0x4f8a69,_0x1023e8){_0x1023e8=_0x1023e8||0xcc;return function(_0x2b03ae){if(_0x2b03ae){return _0x4f8a69['sendStatus'](_0x1023e8);}return _0x4f8a69['status'](_0x1023e8)[_0x7414('0x1b')]();};}function respondWithResult(_0xba2781,_0x39b714){_0x39b714=_0x39b714||0xc8;return function(_0x37ed12){if(_0x37ed12){return _0xba2781[_0x7414('0x1c')](_0x39b714)['json'](_0x37ed12);}};}function respondWithFilteredResult(_0x406ffc,_0x4ac4d0){return function(_0xd0ba67){if(_0xd0ba67){var _0x561cbd=typeof _0x4ac4d0[_0x7414('0x1d')]===_0x7414('0x1e')&&typeof _0x4ac4d0[_0x7414('0x1f')]===_0x7414('0x1e');var _0x4b9d8d=_0xd0ba67[_0x7414('0x20')];var _0x1972c3=_0x561cbd?0x0:_0x4ac4d0['offset'];var _0x5ec413=_0x561cbd?_0xd0ba67[_0x7414('0x20')]:_0x4ac4d0['offset']+_0x4ac4d0[_0x7414('0x1f')];var _0x418ae9;if(_0x5ec413>=_0x4b9d8d){_0x5ec413=_0x4b9d8d;_0x418ae9=0xc8;}else{_0x418ae9=0xce;}_0x406ffc['status'](_0x418ae9);return _0x406ffc[_0x7414('0x21')](_0x7414('0x22'),_0x1972c3+'-'+_0x5ec413+'/'+_0x4b9d8d)[_0x7414('0x23')](_0xd0ba67);}return null;};}function patchUpdates(_0x5523f8){return function(_0x371bc6){try{jsonpatch[_0x7414('0x24')](_0x371bc6,_0x5523f8,!![]);}catch(_0x3b3867){return BPromise['reject'](_0x3b3867);}return _0x371bc6[_0x7414('0x25')]();};}function saveUpdates(_0x1b2b1e,_0x1d2c71){return function(_0x1ca407){if(_0x1ca407){return _0x1ca407[_0x7414('0x26')](_0x1b2b1e)[_0x7414('0x27')](function(_0x138e33){return _0x138e33;});}return null;};}function removeEntity(_0x536af2,_0x3bf001){return function(_0x58052d){if(_0x58052d){return _0x58052d[_0x7414('0x28')]()[_0x7414('0x27')](function(){_0x536af2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x34abec,_0x1f498d){return function(_0x367a4a){if(!_0x367a4a){_0x34abec[_0x7414('0x29')](0x194);}return _0x367a4a;};}function handleError(_0x5546be,_0x5e0d1d){_0x5e0d1d=_0x5e0d1d||0x1f4;return function(_0x183e5c){logger[_0x7414('0x2a')](_0x183e5c[_0x7414('0x2b')]);if(_0x183e5c[_0x7414('0x2c')]){delete _0x183e5c[_0x7414('0x2c')];}_0x5546be[_0x7414('0x1c')](_0x5e0d1d)[_0x7414('0x2d')](_0x183e5c);};}exports[_0x7414('0x2e')]=function(_0x11d40c,_0x5955dd){var _0x3b74eb={},_0x12c620={},_0x4b55bb={'count':0x0,'rows':[]};var _0xc75af4=_['map'](db['SquareDetailsReport'][_0x7414('0x2f')],function(_0x29b2be){return{'name':_0x29b2be[_0x7414('0x30')],'type':_0x29b2be[_0x7414('0x31')][_0x7414('0x32')]};});_0x12c620['model']=_['map'](_0xc75af4,_0x7414('0x2c'));_0x12c620['query']=_[_0x7414('0x33')](_0x11d40c[_0x7414('0x34')]);_0x12c620[_0x7414('0x35')]=_['intersection'](_0x12c620[_0x7414('0x36')],_0x12c620[_0x7414('0x34')]);_0x3b74eb[_0x7414('0x37')]=_['intersection'](_0x12c620['model'],qs[_0x7414('0x38')](_0x11d40c[_0x7414('0x34')][_0x7414('0x38')]));_0x3b74eb[_0x7414('0x37')]=_0x3b74eb[_0x7414('0x37')]['length']?_0x3b74eb[_0x7414('0x37')]:_0x12c620[_0x7414('0x36')];if(!_0x11d40c[_0x7414('0x34')][_0x7414('0x39')](_0x7414('0x3a'))){_0x3b74eb['limit']=qs[_0x7414('0x1f')](_0x11d40c[_0x7414('0x34')]['limit']);_0x3b74eb[_0x7414('0x1d')]=qs['offset'](_0x11d40c[_0x7414('0x34')][_0x7414('0x1d')]);}_0x3b74eb['order']=qs[_0x7414('0x3b')](_0x11d40c[_0x7414('0x34')][_0x7414('0x3b')]);_0x3b74eb[_0x7414('0x3c')]=qs['filters'](_[_0x7414('0x3d')](_0x11d40c['query'],_0x12c620[_0x7414('0x35')]),_0xc75af4);if(_0x11d40c[_0x7414('0x34')][_0x7414('0x3e')]){_0x3b74eb[_0x7414('0x3c')]=_[_0x7414('0x3f')](_0x3b74eb[_0x7414('0x3c')],{'$or':_[_0x7414('0x40')](_0xc75af4,function(_0x385b52){if(_0x385b52['type']!==_0x7414('0x41')){var _0x10bd05={};_0x10bd05[_0x385b52[_0x7414('0x2c')]]={'$like':'%'+_0x11d40c[_0x7414('0x34')][_0x7414('0x3e')]+'%'};return _0x10bd05;}})});}_0x3b74eb=_[_0x7414('0x3f')]({},_0x3b74eb,_0x11d40c[_0x7414('0x42')]);var _0x234518={'where':_0x3b74eb[_0x7414('0x3c')]};return db[_0x7414('0x43')][_0x7414('0x20')](_0x234518)[_0x7414('0x27')](function(_0x44682e){_0x4b55bb['count']=_0x44682e;if(_0x11d40c['query']['includeAll']){_0x3b74eb[_0x7414('0x44')]=[{'all':!![]}];}return db[_0x7414('0x43')]['findAll'](_0x3b74eb);})[_0x7414('0x27')](function(_0xb3718){_0x4b55bb[_0x7414('0x45')]=_0xb3718;return _0x4b55bb;})['then'](respondWithFilteredResult(_0x5955dd,_0x3b74eb))[_0x7414('0x46')](handleError(_0x5955dd,null));};exports[_0x7414('0x47')]=function(_0x5aab1a,_0x1537e2){var _0x30b6fd={'raw':!![],'where':{'id':_0x5aab1a[_0x7414('0x48')]['id']}},_0x3738ca={};_0x3738ca[_0x7414('0x36')]=_[_0x7414('0x33')](db[_0x7414('0x43')]['rawAttributes']);_0x3738ca[_0x7414('0x34')]=_[_0x7414('0x33')](_0x5aab1a[_0x7414('0x34')]);_0x3738ca[_0x7414('0x35')]=_[_0x7414('0x49')](_0x3738ca['model'],_0x3738ca[_0x7414('0x34')]);_0x30b6fd[_0x7414('0x37')]=_[_0x7414('0x49')](_0x3738ca[_0x7414('0x36')],qs['fields'](_0x5aab1a[_0x7414('0x34')][_0x7414('0x38')]));_0x30b6fd['attributes']=_0x30b6fd[_0x7414('0x37')]['length']?_0x30b6fd['attributes']:_0x3738ca[_0x7414('0x36')];if(_0x5aab1a['query'][_0x7414('0x4a')]){_0x30b6fd['include']=[{'all':!![]}];}_0x30b6fd=_[_0x7414('0x3f')]({},_0x30b6fd,_0x5aab1a[_0x7414('0x42')]);return db[_0x7414('0x43')][_0x7414('0x4b')](_0x30b6fd)[_0x7414('0x27')](handleEntityNotFound(_0x1537e2,null))[_0x7414('0x27')](respondWithResult(_0x1537e2,null))[_0x7414('0x46')](handleError(_0x1537e2,null));};exports[_0x7414('0x4c')]=function(_0xa88040,_0x577554){return db[_0x7414('0x43')][_0x7414('0x4c')](_0xa88040[_0x7414('0x4d')],{})[_0x7414('0x27')](respondWithResult(_0x577554,0xc9))[_0x7414('0x46')](handleError(_0x577554,null));};exports[_0x7414('0x26')]=function(_0x3e8e93,_0x38ed6a){if(_0x3e8e93[_0x7414('0x4d')]['id']){delete _0x3e8e93[_0x7414('0x4d')]['id'];}return db[_0x7414('0x43')]['find']({'where':{'id':_0x3e8e93['params']['id']}})['then'](handleEntityNotFound(_0x38ed6a,null))['then'](saveUpdates(_0x3e8e93[_0x7414('0x4d')],null))[_0x7414('0x27')](respondWithResult(_0x38ed6a,null))['catch'](handleError(_0x38ed6a,null));};exports[_0x7414('0x28')]=function(_0x1d5646,_0xe15a54){return db['SquareDetailsReport'][_0x7414('0x4b')]({'where':{'id':_0x1d5646[_0x7414('0x48')]['id']}})[_0x7414('0x27')](handleEntityNotFound(_0xe15a54,null))['then'](removeEntity(_0xe15a54,null))[_0x7414('0x46')](handleError(_0xe15a54,null));};exports['describe']=function(_0x14f826,_0x58b51d){return db[_0x7414('0x43')]['describe']()[_0x7414('0x27')](respondWithResult(_0x58b51d,null))['catch'](handleError(_0x58b51d,null));}; \ No newline at end of file +var _0xc164=['apply','reject','save','destroy','then','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0xc164,0xca));var _0x4c16=function(_0x44ce13,_0x328765){_0x44ce13=_0x44ce13-0x0;var _0x30e786=_0xc164[_0x44ce13];return _0x30e786;};'use strict';var emlformat=require(_0x4c16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c16('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c16('0x2'));var moment=require(_0x4c16('0x3'));var BPromise=require(_0x4c16('0x4'));var Mustache=require(_0x4c16('0x5'));var util=require(_0x4c16('0x6'));var path=require('path');var sox=require(_0x4c16('0x7'));var csv=require('to-csv');var ejs=require(_0x4c16('0x8'));var fs=require('fs');var fs_extra=require(_0x4c16('0x9'));var _=require(_0x4c16('0xa'));var squel=require(_0x4c16('0xb'));var crypto=require(_0x4c16('0xc'));var jsforce=require(_0x4c16('0xd'));var deskjs=require(_0x4c16('0xe'));var toCsv=require(_0x4c16('0xf'));var querystring=require('querystring');var Papa=require(_0x4c16('0x10'));var Redis=require('ioredis');var authService=require(_0x4c16('0x11'));var qs=require(_0x4c16('0x12'));var as=require(_0x4c16('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c16('0x14'))(_0x4c16('0x15'));var utils=require('../../config/utils');var config=require(_0x4c16('0x16'));var licenseUtil=require(_0x4c16('0x17'));var db=require(_0x4c16('0x18'))['db'];function respondWithStatusCode(_0x2f297d,_0x1cf4be){_0x1cf4be=_0x1cf4be||0xcc;return function(_0x577295){if(_0x577295){return _0x2f297d[_0x4c16('0x19')](_0x1cf4be);}return _0x2f297d[_0x4c16('0x1a')](_0x1cf4be)[_0x4c16('0x1b')]();};}function respondWithResult(_0x5f1f86,_0x1894ce){_0x1894ce=_0x1894ce||0xc8;return function(_0x3c0aa8){if(_0x3c0aa8){return _0x5f1f86[_0x4c16('0x1a')](_0x1894ce)[_0x4c16('0x1c')](_0x3c0aa8);}};}function respondWithFilteredResult(_0x28854a,_0x337808){return function(_0x3eb403){if(_0x3eb403){var _0x10796b=typeof _0x337808[_0x4c16('0x1d')]===_0x4c16('0x1e')&&typeof _0x337808[_0x4c16('0x1f')]===_0x4c16('0x1e');var _0x136503=_0x3eb403['count'];var _0x265a7e=_0x10796b?0x0:_0x337808[_0x4c16('0x1d')];var _0x1b859f=_0x10796b?_0x3eb403[_0x4c16('0x20')]:_0x337808['offset']+_0x337808['limit'];var _0x3d055f;if(_0x1b859f>=_0x136503){_0x1b859f=_0x136503;_0x3d055f=0xc8;}else{_0x3d055f=0xce;}_0x28854a['status'](_0x3d055f);return _0x28854a[_0x4c16('0x21')](_0x4c16('0x22'),_0x265a7e+'-'+_0x1b859f+'/'+_0x136503)[_0x4c16('0x1c')](_0x3eb403);}return null;};}function patchUpdates(_0x4581f3){return function(_0x46d78f){try{jsonpatch[_0x4c16('0x23')](_0x46d78f,_0x4581f3,!![]);}catch(_0x5c48a0){return BPromise[_0x4c16('0x24')](_0x5c48a0);}return _0x46d78f[_0x4c16('0x25')]();};}function saveUpdates(_0x55e11a,_0x4357ca){return function(_0x212135){if(_0x212135){return _0x212135['update'](_0x55e11a)['then'](function(_0x29ae5f){return _0x29ae5f;});}return null;};}function removeEntity(_0x125f38,_0x1d4a11){return function(_0x1d0d0a){if(_0x1d0d0a){return _0x1d0d0a[_0x4c16('0x26')]()[_0x4c16('0x27')](function(){_0x125f38[_0x4c16('0x1a')](0xcc)[_0x4c16('0x1b')]();});}};}function handleEntityNotFound(_0x545f90,_0x14a3dd){return function(_0x4601f9){if(!_0x4601f9){_0x545f90[_0x4c16('0x19')](0x194);}return _0x4601f9;};}function handleError(_0x3e56c9,_0x589ef4){_0x589ef4=_0x589ef4||0x1f4;return function(_0x351a2a){logger['error'](_0x351a2a[_0x4c16('0x28')]);if(_0x351a2a[_0x4c16('0x29')]){delete _0x351a2a[_0x4c16('0x29')];}_0x3e56c9[_0x4c16('0x1a')](_0x589ef4)[_0x4c16('0x2a')](_0x351a2a);};}exports[_0x4c16('0x2b')]=function(_0x46b39a,_0x4959c1){var _0x903c77={},_0x32a1ab={},_0x1fda41={'count':0x0,'rows':[]};var _0x3b6b40=_['map'](db[_0x4c16('0x2c')][_0x4c16('0x2d')],function(_0x50a76e){return{'name':_0x50a76e[_0x4c16('0x2e')],'type':_0x50a76e[_0x4c16('0x2f')][_0x4c16('0x30')]};});_0x32a1ab[_0x4c16('0x31')]=_[_0x4c16('0x32')](_0x3b6b40,'name');_0x32a1ab[_0x4c16('0x33')]=_[_0x4c16('0x34')](_0x46b39a[_0x4c16('0x33')]);_0x32a1ab[_0x4c16('0x35')]=_[_0x4c16('0x36')](_0x32a1ab[_0x4c16('0x31')],_0x32a1ab[_0x4c16('0x33')]);_0x903c77[_0x4c16('0x37')]=_[_0x4c16('0x36')](_0x32a1ab[_0x4c16('0x31')],qs[_0x4c16('0x38')](_0x46b39a[_0x4c16('0x33')][_0x4c16('0x38')]));_0x903c77[_0x4c16('0x37')]=_0x903c77[_0x4c16('0x37')][_0x4c16('0x39')]?_0x903c77[_0x4c16('0x37')]:_0x32a1ab['model'];if(!_0x46b39a['query'][_0x4c16('0x3a')](_0x4c16('0x3b'))){_0x903c77[_0x4c16('0x1f')]=qs['limit'](_0x46b39a[_0x4c16('0x33')][_0x4c16('0x1f')]);_0x903c77[_0x4c16('0x1d')]=qs[_0x4c16('0x1d')](_0x46b39a['query'][_0x4c16('0x1d')]);}_0x903c77[_0x4c16('0x3c')]=qs['sort'](_0x46b39a['query'][_0x4c16('0x3d')]);_0x903c77[_0x4c16('0x3e')]=qs[_0x4c16('0x35')](_[_0x4c16('0x3f')](_0x46b39a[_0x4c16('0x33')],_0x32a1ab[_0x4c16('0x35')]),_0x3b6b40);if(_0x46b39a['query']['filter']){_0x903c77[_0x4c16('0x3e')]=_[_0x4c16('0x40')](_0x903c77['where'],{'$or':_[_0x4c16('0x32')](_0x3b6b40,function(_0x279d34){if(_0x279d34[_0x4c16('0x2f')]!==_0x4c16('0x41')){var _0xcd0f18={};_0xcd0f18[_0x279d34[_0x4c16('0x29')]]={'$like':'%'+_0x46b39a[_0x4c16('0x33')]['filter']+'%'};return _0xcd0f18;}})});}_0x903c77=_[_0x4c16('0x40')]({},_0x903c77,_0x46b39a['options']);var _0xa8f56a={'where':_0x903c77[_0x4c16('0x3e')]};return db[_0x4c16('0x2c')]['count'](_0xa8f56a)[_0x4c16('0x27')](function(_0x5b61e2){_0x1fda41['count']=_0x5b61e2;if(_0x46b39a[_0x4c16('0x33')][_0x4c16('0x42')]){_0x903c77[_0x4c16('0x43')]=[{'all':!![]}];}return db[_0x4c16('0x2c')][_0x4c16('0x44')](_0x903c77);})[_0x4c16('0x27')](function(_0x5ebac4){_0x1fda41[_0x4c16('0x45')]=_0x5ebac4;return _0x1fda41;})[_0x4c16('0x27')](respondWithFilteredResult(_0x4959c1,_0x903c77))[_0x4c16('0x46')](handleError(_0x4959c1,null));};exports[_0x4c16('0x47')]=function(_0x4f7ac0,_0x5c2f08){var _0xe76a43={'raw':!![],'where':{'id':_0x4f7ac0[_0x4c16('0x48')]['id']}},_0x12c593={};_0x12c593[_0x4c16('0x31')]=_['keys'](db['SquareDetailsReport'][_0x4c16('0x2d')]);_0x12c593[_0x4c16('0x33')]=_[_0x4c16('0x34')](_0x4f7ac0[_0x4c16('0x33')]);_0x12c593['filters']=_[_0x4c16('0x36')](_0x12c593[_0x4c16('0x31')],_0x12c593['query']);_0xe76a43[_0x4c16('0x37')]=_[_0x4c16('0x36')](_0x12c593[_0x4c16('0x31')],qs[_0x4c16('0x38')](_0x4f7ac0[_0x4c16('0x33')][_0x4c16('0x38')]));_0xe76a43[_0x4c16('0x37')]=_0xe76a43[_0x4c16('0x37')]['length']?_0xe76a43[_0x4c16('0x37')]:_0x12c593[_0x4c16('0x31')];if(_0x4f7ac0[_0x4c16('0x33')][_0x4c16('0x42')]){_0xe76a43['include']=[{'all':!![]}];}_0xe76a43=_[_0x4c16('0x40')]({},_0xe76a43,_0x4f7ac0[_0x4c16('0x49')]);return db['SquareDetailsReport']['find'](_0xe76a43)[_0x4c16('0x27')](handleEntityNotFound(_0x5c2f08,null))[_0x4c16('0x27')](respondWithResult(_0x5c2f08,null))['catch'](handleError(_0x5c2f08,null));};exports[_0x4c16('0x4a')]=function(_0x31de3a,_0x5e003b){return db[_0x4c16('0x2c')]['create'](_0x31de3a[_0x4c16('0x4b')],{})['then'](respondWithResult(_0x5e003b,0xc9))[_0x4c16('0x46')](handleError(_0x5e003b,null));};exports[_0x4c16('0x4c')]=function(_0x5d814e,_0x44c707){if(_0x5d814e[_0x4c16('0x4b')]['id']){delete _0x5d814e['body']['id'];}return db[_0x4c16('0x2c')][_0x4c16('0x4d')]({'where':{'id':_0x5d814e[_0x4c16('0x48')]['id']}})[_0x4c16('0x27')](handleEntityNotFound(_0x44c707,null))[_0x4c16('0x27')](saveUpdates(_0x5d814e['body'],null))[_0x4c16('0x27')](respondWithResult(_0x44c707,null))[_0x4c16('0x46')](handleError(_0x44c707,null));};exports[_0x4c16('0x26')]=function(_0x5a77b2,_0x16eead){return db[_0x4c16('0x2c')]['find']({'where':{'id':_0x5a77b2[_0x4c16('0x48')]['id']}})[_0x4c16('0x27')](handleEntityNotFound(_0x16eead,null))[_0x4c16('0x27')](removeEntity(_0x16eead,null))['catch'](handleError(_0x16eead,null));};exports[_0x4c16('0x4e')]=function(_0x3c5a94,_0x9e4263){return db[_0x4c16('0x2c')][_0x4c16('0x4e')]()['then'](respondWithResult(_0x9e4263,null))[_0x4c16('0x46')](handleError(_0x9e4263,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 2fe512a..032fa9d 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 _0x4f9a=['define','SquareDetailsReport','report_square_details','lodash','util','api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4f9a,0x6f));var _0xa4f9=function(_0x672af5,_0x3453b6){_0x672af5=_0x672af5-0x0;var _0x1c4161=_0x4f9a[_0x672af5];return _0x1c4161;};'use strict';var _=require(_0xa4f9('0x0'));var util=require(_0xa4f9('0x1'));var logger=require('../../config/logger')(_0xa4f9('0x2'));var moment=require('moment');var BPromise=require(_0xa4f9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa4f9('0x4'));var rimraf=require(_0xa4f9('0x5'));var config=require(_0xa4f9('0x6'));var attributes=require(_0xa4f9('0x7'));module[_0xa4f9('0x8')]=function(_0x3684c5,_0x5db3bd){return _0x3684c5[_0xa4f9('0x9')](_0xa4f9('0xa'),attributes,{'tableName':_0xa4f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe62d=['rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','lodash','../../config/logger','api','bluebird','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe62d,0xf5));var _0xde62=function(_0x1c5ef4,_0x2f8a43){_0x1c5ef4=_0x1c5ef4-0x0;var _0x1480ce=_0xe62d[_0x1c5ef4];return _0x1480ce;};'use strict';var _=require(_0xde62('0x0'));var util=require('util');var logger=require(_0xde62('0x1'))(_0xde62('0x2'));var moment=require('moment');var BPromise=require(_0xde62('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde62('0x4'));var rimraf=require(_0xde62('0x5'));var config=require(_0xde62('0x6'));var attributes=require(_0xde62('0x7'));module['exports']=function(_0x8c8a9f,_0x413908){return _0x8c8a9f[_0xde62('0x8')](_0xde62('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index bc98d73..f45d212 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 _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(_0x2c588c,_0x1f0d55){var _0x25f6a6=function(_0x1c5361){while(--_0x1c5361){_0x2c588c['push'](_0x2c588c['shift']());}};_0x25f6a6(++_0x1f0d55);}(_0x3266,0x6a));var _0x6326=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x3266[_0x403c20];return _0x2b271a;};'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 +var _0x28f2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareDetailsReport','options','raw','CreateSquareDetailsReport','catch','lodash','util'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0x28f2,0x193));var _0x228f=function(_0xb5c09d,_0x27cd6e){_0xb5c09d=_0xb5c09d-0x0;var _0x276392=_0x28f2[_0xb5c09d];return _0x276392;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10da58,_0x4a4a44,_0x3ca074){return new BPromise(function(_0x455eb6,_0xf4b011){return client['request'](_0x10da58,_0x3ca074)[_0x228f('0xc')](function(_0x4d0038){logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,'request\x20sent');logger[_0x228f('0xf')](_0x228f('0x10'),_0x4a4a44,_0x228f('0x11'),JSON[_0x228f('0x12')](_0x4d0038));if(_0x4d0038[_0x228f('0x13')]){if(_0x4d0038['error'][_0x228f('0x14')]===0x1f4){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0xf4b011(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}logger[_0x228f('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0x455eb6(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}else{logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,_0x228f('0x11'));_0x455eb6(_0x4d0038['result'][_0x228f('0x15')]);}})['catch'](function(_0x20e687){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x20e687);_0xf4b011(_0x20e687);});});}exports['CreateSquareDetailsReport']=function(_0x2d4819){var _0x4e1968=this;return new Promise(function(_0x33e32e,_0x5b33a6){return db[_0x228f('0x16')]['create'](_0x2d4819['body'],{'raw':_0x2d4819[_0x228f('0x17')]?_0x2d4819['options'][_0x228f('0x18')]===undefined?!![]:![]:!![]})[_0x228f('0xc')](function(_0x1294a8){logger[_0x228f('0xd')](_0x228f('0x19'),_0x2d4819);logger[_0x228f('0xf')](_0x228f('0x19'),_0x2d4819,JSON[_0x228f('0x12')](_0x1294a8));_0x33e32e(_0x1294a8);})[_0x228f('0x1a')](function(_0x4ee0c9){logger[_0x228f('0x13')](_0x228f('0x19'),_0x4ee0c9[_0x228f('0x15')],_0x2d4819);_0x5b33a6(_0x4e1968[_0x228f('0x13')](0x1f4,_0x4ee0c9[_0x228f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 70c33ef..c87ee8a 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 _0xab5a=['killProcess','express','Router','../../components/auth/service','./system.controller','index','get','/process/:pid/kill','isAuthenticated'];(function(_0x2754fc,_0x545a6e){var _0x3f0ab6=function(_0x352b2f){while(--_0x352b2f){_0x2754fc['push'](_0x2754fc['shift']());}};_0x3f0ab6(++_0x545a6e);}(_0xab5a,0x1f0));var _0xaab5=function(_0x575734,_0x3f1db2){_0x575734=_0x575734-0x0;var _0xc3e688=_0xab5a[_0x575734];return _0xc3e688;};'use strict';var express=require(_0xaab5('0x0'));var router=express[_0xaab5('0x1')]();var auth=require(_0xaab5('0x2'));var controller=require(_0xaab5('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xaab5('0x4')]);router[_0xaab5('0x5')](_0xaab5('0x6'),auth[_0xaab5('0x7')](),controller[_0xaab5('0x8')]);module['exports']=router; \ No newline at end of file +var _0x5290=['./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','express','Router','../../components/auth/service'];(function(_0x56f17e,_0x2dd0aa){var _0x401579=function(_0xeb0524){while(--_0xeb0524){_0x56f17e['push'](_0x56f17e['shift']());}};_0x401579(++_0x2dd0aa);}(_0x5290,0x10d));var _0x0529=function(_0x37dd7a,_0x3b6efa){_0x37dd7a=_0x37dd7a-0x0;var _0x5d9578=_0x5290[_0x37dd7a];return _0x5d9578;};'use strict';var express=require(_0x0529('0x0'));var router=express[_0x0529('0x1')]();var auth=require(_0x0529('0x2'));var controller=require(_0x0529('0x3'));router[_0x0529('0x4')]('/',auth[_0x0529('0x5')](),controller['index']);router[_0x0529('0x4')](_0x0529('0x6'),auth[_0x0529('0x5')](),controller[_0x0529('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0943614..5321bc1 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 _0x8dec=['send','index','getAllData','then','json','catch','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','name'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x8dec,0x187));var _0xc8de=function(_0x49327d,_0x4a484b){_0x49327d=_0x49327d-0x0;var _0x4f2c09=_0x8dec[_0x49327d];return _0x4f2c09;};'use strict';var info=require(_0xc8de('0x0'));var exec=require(_0xc8de('0x1'))[_0xc8de('0x2')];var logger=require(_0xc8de('0x3'))(_0xc8de('0x4'));var util=require(_0xc8de('0x5'));var BPromise=require(_0xc8de('0x6'));var _=require(_0xc8de('0x7'));function handleError(_0x348612,_0xb269c3,_0x5160b8){_0xb269c3=_0xb269c3||0x1f4;return function(_0x4c5df6){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5160b8,_0xb269c3,util['inspect'](_0x4c5df6,{'showHidden':![],'depth':null}));delete _0x4c5df6[_0xc8de('0x8')];_0x348612['status'](_0xb269c3)[_0xc8de('0x9')](_0x4c5df6);};}exports[_0xc8de('0xa')]=function(_0x461a66,_0x148950){return info[_0xc8de('0xb')]()[_0xc8de('0xc')](function(_0x5014a0){return _0x148950['status'](0xc8)[_0xc8de('0xd')](_0x5014a0);})[_0xc8de('0xe')](function(_0x3103a3){return _0x148950['status'](0x1f4)[_0xc8de('0xd')](_0x3103a3);});};exports['killProcess']=function(_0x274941,_0x207d6f){var _0xff3d51=['components/import/cm'];return new BPromise(function(_0x5f6c49,_0x4f94d2){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x274941['params']['pid']),function(_0x521acb,_0x1990bd,_0x51db6c){if(_0x521acb){return _0x4f94d2(_0x521acb);}return _0x5f6c49(_0x1990bd);});})[_0xc8de('0xc')](function(_0x59c72f){var _0x21efa0=![];var _0x56875a=_0x59c72f[_0xc8de('0xf')](/\n/);for(var _0x1e0ec2=0x0,_0x113678=_0xff3d51[_0xc8de('0x10')];_0x1e0ec2<_0x113678,_0x21efa0===![];_0x1e0ec2+=0x1){if(_0x59c72f[_0xc8de('0x11')](_0xff3d51[_0x1e0ec2])>=0x0){_0x21efa0=!![];}}if(!_0x21efa0){throw new Error(util[_0xc8de('0x12')](_0xc8de('0x13'),_0x274941[_0xc8de('0x14')]['pid']));}process[_0xc8de('0x15')](_0x274941[_0xc8de('0x14')][_0xc8de('0x16')],_0xc8de('0x17'));return _0x207d6f['status'](0xc8)[_0xc8de('0xd')]({'message':util[_0xc8de('0x12')](_0xc8de('0x18'),_0x274941['params'][_0xc8de('0x16')])});})[_0xc8de('0xe')](handleError(_0x207d6f,null,'killProcess'));}; \ No newline at end of file +var _0x63d3=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','lodash','error','inspect','name','status','send','getAllData','then','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x4c19cc,_0x114f89){var _0x2b415c=function(_0x57ac33){while(--_0x57ac33){_0x4c19cc['push'](_0x4c19cc['shift']());}};_0x2b415c(++_0x114f89);}(_0x63d3,0x155));var _0x363d=function(_0x16989c,_0x358e47){_0x16989c=_0x16989c-0x0;var _0x3ae85b=_0x63d3[_0x16989c];return _0x3ae85b;};'use strict';var info=require(_0x363d('0x0'));var exec=require(_0x363d('0x1'))['exec'];var logger=require(_0x363d('0x2'))(_0x363d('0x3'));var util=require(_0x363d('0x4'));var BPromise=require('bluebird');var _=require(_0x363d('0x5'));function handleError(_0xac640d,_0x5bf4c4,_0x24fdc3){_0x5bf4c4=_0x5bf4c4||0x1f4;return function(_0x10ac3a){logger[_0x363d('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x24fdc3,_0x5bf4c4,util[_0x363d('0x7')](_0x10ac3a,{'showHidden':![],'depth':null}));delete _0x10ac3a[_0x363d('0x8')];_0xac640d[_0x363d('0x9')](_0x5bf4c4)[_0x363d('0xa')](_0x10ac3a);};}exports['index']=function(_0x583f0d,_0x2a62fc){return info[_0x363d('0xb')]()[_0x363d('0xc')](function(_0x55de23){return _0x2a62fc[_0x363d('0x9')](0xc8)[_0x363d('0xd')](_0x55de23);})[_0x363d('0xe')](function(_0x2c54bf){return _0x2a62fc[_0x363d('0x9')](0x1f4)[_0x363d('0xd')](_0x2c54bf);});};exports[_0x363d('0xf')]=function(_0x10b4b6,_0xb4ee4a){var _0x5d4263=['components/import/cm'];return new BPromise(function(_0x20e20b,_0x5908cf){return exec(util['format'](_0x363d('0x10'),_0x10b4b6[_0x363d('0x11')][_0x363d('0x12')]),function(_0x15b71c,_0x1b21b1,_0x30c2c6){if(_0x15b71c){return _0x5908cf(_0x15b71c);}return _0x20e20b(_0x1b21b1);});})['then'](function(_0x5e9e44){var _0x99b92=![];var _0x4ffb75=_0x5e9e44[_0x363d('0x13')](/\n/);for(var _0x43d021=0x0,_0xda84d3=_0x5d4263['length'];_0x43d021<_0xda84d3,_0x99b92===![];_0x43d021+=0x1){if(_0x5e9e44[_0x363d('0x14')](_0x5d4263[_0x43d021])>=0x0){_0x99b92=!![];}}if(!_0x99b92){throw new Error(util[_0x363d('0x15')](_0x363d('0x16'),_0x10b4b6[_0x363d('0x11')][_0x363d('0x12')]));}process[_0x363d('0x17')](_0x10b4b6[_0x363d('0x11')]['pid'],_0x363d('0x18'));return _0xb4ee4a['status'](0xc8)['json']({'message':util[_0x363d('0x15')](_0x363d('0x19'),_0x10b4b6['params'][_0x363d('0x12')])});})[_0x363d('0xe')](handleError(_0xb4ee4a,null,_0x363d('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 26c7571..9be407f 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 _0xe1de=['/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3e5d70,_0x99480d){var _0xa82dda=function(_0x52fab0){while(--_0x52fab0){_0x3e5d70['push'](_0x3e5d70['shift']());}};_0xa82dda(++_0x99480d);}(_0xe1de,0x14a));var _0xee1d=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xe1de[_0x23a79e];return _0x3dab57;};'use strict';var multer=require(_0xee1d('0x0'));var util=require(_0xee1d('0x1'));var path=require(_0xee1d('0x2'));var timeout=require(_0xee1d('0x3'));var express=require(_0xee1d('0x4'));var router=express[_0xee1d('0x5')]();var fs_extra=require(_0xee1d('0x6'));var auth=require(_0xee1d('0x7'));var interaction=require(_0xee1d('0x8'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0xee1d('0x9')]('/',auth[_0xee1d('0xa')](),controller[_0xee1d('0xb')]);router['get'](_0xee1d('0xc'),auth[_0xee1d('0xa')](),controller[_0xee1d('0xd')]);router[_0xee1d('0xe')]('/',auth[_0xee1d('0xa')](),controller[_0xee1d('0xf')]);router['put'](_0xee1d('0xc'),auth[_0xee1d('0xa')](),controller['update']);router[_0xee1d('0x10')](_0xee1d('0xc'),auth[_0xee1d('0xa')](),controller[_0xee1d('0x11')]);module[_0xee1d('0x12')]=router; \ No newline at end of file +var _0x340e=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','exports'];(function(_0x31121c,_0xf5ffaa){var _0x54649d=function(_0x144044){while(--_0x144044){_0x31121c['push'](_0x31121c['shift']());}};_0x54649d(++_0xf5ffaa);}(_0x340e,0x1dc));var _0xe340=function(_0x188cab,_0x3ded8e){_0x188cab=_0x188cab-0x0;var _0x1bfc3b=_0x340e[_0x188cab];return _0x1bfc3b;};'use strict';var multer=require(_0xe340('0x0'));var util=require('util');var path=require(_0xe340('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe340('0x2')]();var fs_extra=require(_0xe340('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe340('0x4'));var config=require(_0xe340('0x5'));var controller=require(_0xe340('0x6'));router['get']('/',auth[_0xe340('0x7')](),controller['index']);router[_0xe340('0x8')](_0xe340('0x9'),auth[_0xe340('0x7')](),controller[_0xe340('0xa')]);router[_0xe340('0xb')]('/',auth['isAuthenticated'](),controller[_0xe340('0xc')]);router[_0xe340('0xd')](_0xe340('0x9'),auth['isAuthenticated'](),controller[_0xe340('0xe')]);router[_0xe340('0xf')](_0xe340('0x9'),auth[_0xe340('0x7')](),controller['destroy']);module[_0xe340('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 8426d3c..2169e31 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 _0x0102=['exports','STRING','name'];(function(_0x2386a2,_0x368e30){var _0x17be3f=function(_0x481425){while(--_0x481425){_0x2386a2['push'](_0x2386a2['shift']());}};_0x17be3f(++_0x368e30);}(_0x0102,0x186));var _0x2010=function(_0x57929b,_0x4ac3e0){_0x57929b=_0x57929b-0x0;var _0x1c4b81=_0x0102[_0x57929b];return _0x1c4b81;};'use strict';var Sequelize=require('sequelize');module[_0x2010('0x0')]={'name':{'type':Sequelize[_0x2010('0x1')],'unique':_0x2010('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2010('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xffaa=['sequelize','exports','STRING','#0091EA'];(function(_0x1f8c9f,_0x200587){var _0xd89fa3=function(_0x10f97b){while(--_0x10f97b){_0x1f8c9f['push'](_0x1f8c9f['shift']());}};_0xd89fa3(++_0x200587);}(_0xffaa,0x130));var _0xaffa=function(_0x27d4ea,_0x7a1494){_0x27d4ea=_0x27d4ea-0x0;var _0x443145=_0xffaa[_0x27d4ea];return _0x443145;};'use strict';var Sequelize=require(_0xaffa('0x0'));module[_0xaffa('0x1')]={'name':{'type':Sequelize[_0xaffa('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xaffa('0x3')},'description':{'type':Sequelize[_0xaffa('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 989475f..ee628ee 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 _0xbec5=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','name','send','index','map','Tag','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','filter','where','options','includeAll','include','catch','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x3f57d1,_0x3903a4){var _0x1041f5=function(_0x4bca13){while(--_0x4bca13){_0x3f57d1['push'](_0x3f57d1['shift']());}};_0x1041f5(++_0x3903a4);}(_0xbec5,0xe5));var _0x5bec=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0xbec5[_0x2bda14];return _0xb5dd49;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];function respondWithStatusCode(_0x1c888f,_0x589d14){_0x589d14=_0x589d14||0xcc;return function(_0x2d2ba2){if(_0x2d2ba2){return _0x1c888f[_0x5bec('0x19')](_0x589d14);}return _0x1c888f[_0x5bec('0x1a')](_0x589d14)[_0x5bec('0x1b')]();};}function respondWithResult(_0x3198e0,_0xcd6d90){_0xcd6d90=_0xcd6d90||0xc8;return function(_0x24dcd6){if(_0x24dcd6){return _0x3198e0[_0x5bec('0x1a')](_0xcd6d90)[_0x5bec('0x1c')](_0x24dcd6);}};}function respondWithFilteredResult(_0x3ebc41,_0x31b9e4){return function(_0x325daf){if(_0x325daf){var _0x11fb8e=typeof _0x31b9e4['offset']==='undefined'&&typeof _0x31b9e4[_0x5bec('0x1d')]===_0x5bec('0x1e');var _0x31ad9c=_0x325daf[_0x5bec('0x1f')];var _0x5cd7ae=_0x11fb8e?0x0:_0x31b9e4['offset'];var _0x3cd354=_0x11fb8e?_0x325daf[_0x5bec('0x1f')]:_0x31b9e4['offset']+_0x31b9e4[_0x5bec('0x1d')];var _0xa7e223;if(_0x3cd354>=_0x31ad9c){_0x3cd354=_0x31ad9c;_0xa7e223=0xc8;}else{_0xa7e223=0xce;}_0x3ebc41[_0x5bec('0x1a')](_0xa7e223);return _0x3ebc41[_0x5bec('0x20')]('Content-Range',_0x5cd7ae+'-'+_0x3cd354+'/'+_0x31ad9c)[_0x5bec('0x1c')](_0x325daf);}return null;};}function patchUpdates(_0x5be91c){return function(_0x191c0f){try{jsonpatch[_0x5bec('0x21')](_0x191c0f,_0x5be91c,!![]);}catch(_0x3e1896){return BPromise[_0x5bec('0x22')](_0x3e1896);}return _0x191c0f[_0x5bec('0x23')]();};}function saveUpdates(_0x5e154e,_0x232584){return function(_0x4cfcb8){if(_0x4cfcb8){return _0x4cfcb8[_0x5bec('0x24')](_0x5e154e)[_0x5bec('0x25')](function(_0x5b2636){return _0x5b2636;});}return null;};}function removeEntity(_0xa414f8,_0xbef70b){return function(_0x4e0ca2){if(_0x4e0ca2){return _0x4e0ca2[_0x5bec('0x26')]()[_0x5bec('0x25')](function(){var _0x43d460=_0x4e0ca2[_0x5bec('0x27')]({'plain':!![]});var _0x226d55=_0x5bec('0x28');return db[_0x5bec('0x29')]['destroy']({'where':{'type':_0x226d55,'resourceId':_0x43d460['id']}})['then'](function(){return _0x4e0ca2;});})['then'](function(){_0xa414f8[_0x5bec('0x1a')](0xcc)[_0x5bec('0x1b')]();});}};}function handleEntityNotFound(_0x338c25,_0x4939a5){return function(_0x2b3b2c){if(!_0x2b3b2c){_0x338c25[_0x5bec('0x19')](0x194);}return _0x2b3b2c;};}function handleError(_0x57331b,_0x29e358){_0x29e358=_0x29e358||0x1f4;return function(_0x63ac8){logger['error'](_0x63ac8['stack']);if(_0x63ac8[_0x5bec('0x2a')]){delete _0x63ac8[_0x5bec('0x2a')];}_0x57331b[_0x5bec('0x1a')](_0x29e358)[_0x5bec('0x2b')](_0x63ac8);};}exports[_0x5bec('0x2c')]=function(_0x3f224c,_0x5d6621){var _0x2987ca={},_0x59b5b6={},_0x45863b={'count':0x0,'rows':[]};var _0xafbd94=_[_0x5bec('0x2d')](db[_0x5bec('0x2e')]['rawAttributes'],function(_0x2b42c8){return{'name':_0x2b42c8[_0x5bec('0x2f')],'type':_0x2b42c8[_0x5bec('0x30')]['key']};});_0x59b5b6[_0x5bec('0x31')]=_['map'](_0xafbd94,_0x5bec('0x2a'));_0x59b5b6[_0x5bec('0x32')]=_[_0x5bec('0x33')](_0x3f224c['query']);_0x59b5b6[_0x5bec('0x34')]=_[_0x5bec('0x35')](_0x59b5b6['model'],_0x59b5b6[_0x5bec('0x32')]);_0x2987ca[_0x5bec('0x36')]=_[_0x5bec('0x35')](_0x59b5b6[_0x5bec('0x31')],qs[_0x5bec('0x37')](_0x3f224c['query'][_0x5bec('0x37')]));_0x2987ca['attributes']=_0x2987ca[_0x5bec('0x36')][_0x5bec('0x38')]?_0x2987ca[_0x5bec('0x36')]:_0x59b5b6[_0x5bec('0x31')];if(!_0x3f224c[_0x5bec('0x32')][_0x5bec('0x39')]('nolimit')){_0x2987ca[_0x5bec('0x1d')]=qs[_0x5bec('0x1d')](_0x3f224c[_0x5bec('0x32')]['limit']);_0x2987ca[_0x5bec('0x3a')]=qs[_0x5bec('0x3a')](_0x3f224c['query'][_0x5bec('0x3a')]);}_0x2987ca['order']=qs[_0x5bec('0x3b')](_0x3f224c[_0x5bec('0x32')][_0x5bec('0x3b')]);_0x2987ca['where']=qs[_0x5bec('0x34')](_[_0x5bec('0x3c')](_0x3f224c[_0x5bec('0x32')],_0x59b5b6[_0x5bec('0x34')]),_0xafbd94);if(_0x3f224c[_0x5bec('0x32')][_0x5bec('0x3d')]){_0x2987ca[_0x5bec('0x3e')]=_['merge'](_0x2987ca[_0x5bec('0x3e')],{'$or':_[_0x5bec('0x2d')](_0xafbd94,function(_0x323812){if(_0x323812[_0x5bec('0x30')]!=='VIRTUAL'){var _0x27863b={};_0x27863b[_0x323812[_0x5bec('0x2a')]]={'$like':'%'+_0x3f224c[_0x5bec('0x32')]['filter']+'%'};return _0x27863b;}})});}_0x2987ca=_['merge']({},_0x2987ca,_0x3f224c[_0x5bec('0x3f')]);var _0x153d02={'where':_0x2987ca[_0x5bec('0x3e')]};return db[_0x5bec('0x2e')][_0x5bec('0x1f')](_0x153d02)['then'](function(_0x4fee8a){_0x45863b[_0x5bec('0x1f')]=_0x4fee8a;if(_0x3f224c['query'][_0x5bec('0x40')]){_0x2987ca[_0x5bec('0x41')]=[{'all':!![]}];}return db[_0x5bec('0x2e')]['findAll'](_0x2987ca);})[_0x5bec('0x25')](function(_0x26a4a5){_0x45863b['rows']=_0x26a4a5;return _0x45863b;})[_0x5bec('0x25')](respondWithFilteredResult(_0x5d6621,_0x2987ca))[_0x5bec('0x42')](handleError(_0x5d6621,null));};exports[_0x5bec('0x43')]=function(_0x2b51f7,_0x3b5631){var _0x2724cf={'raw':!![],'where':{'id':_0x2b51f7['params']['id']}},_0x3a795c={};_0x3a795c['model']=_[_0x5bec('0x33')](db['Tag']['rawAttributes']);_0x3a795c[_0x5bec('0x32')]=_['keys'](_0x2b51f7['query']);_0x3a795c['filters']=_[_0x5bec('0x35')](_0x3a795c[_0x5bec('0x31')],_0x3a795c[_0x5bec('0x32')]);_0x2724cf[_0x5bec('0x36')]=_['intersection'](_0x3a795c[_0x5bec('0x31')],qs[_0x5bec('0x37')](_0x2b51f7[_0x5bec('0x32')][_0x5bec('0x37')]));_0x2724cf['attributes']=_0x2724cf[_0x5bec('0x36')][_0x5bec('0x38')]?_0x2724cf[_0x5bec('0x36')]:_0x3a795c['model'];if(_0x2b51f7[_0x5bec('0x32')]['includeAll']){_0x2724cf[_0x5bec('0x41')]=[{'all':!![]}];}_0x2724cf=_[_0x5bec('0x44')]({},_0x2724cf,_0x2b51f7[_0x5bec('0x3f')]);return db[_0x5bec('0x2e')]['find'](_0x2724cf)[_0x5bec('0x25')](handleEntityNotFound(_0x3b5631,null))[_0x5bec('0x25')](respondWithResult(_0x3b5631,null))[_0x5bec('0x42')](handleError(_0x3b5631,null));};exports[_0x5bec('0x45')]=function(_0x35b250,_0x123758){return db[_0x5bec('0x2e')]['create'](_0x35b250[_0x5bec('0x46')],{})[_0x5bec('0x25')](function(_0x5775ca){var _0x273e09=_0x35b250[_0x5bec('0x47')][_0x5bec('0x27')]({'plain':!![]});if(!_0x273e09)throw new Error(_0x5bec('0x48'));if(_0x273e09[_0x5bec('0x49')]===_0x5bec('0x47')){var _0x3545a5=_0x5775ca['get']({'plain':!![]});var _0x101dcb='Tags';return db[_0x5bec('0x4a')][_0x5bec('0x4b')]({'where':{'name':_0x101dcb,'userProfileId':_0x273e09[_0x5bec('0x4c')]},'raw':!![]})[_0x5bec('0x25')](function(_0x158e8e){if(_0x158e8e&&_0x158e8e[_0x5bec('0x4d')]===0x0){return db[_0x5bec('0x29')][_0x5bec('0x45')]({'name':_0x3545a5[_0x5bec('0x2a')],'resourceId':_0x3545a5['id'],'type':_0x158e8e[_0x5bec('0x2a')],'sectionId':_0x158e8e['id']},{})['then'](function(){return _0x5775ca;});}else{return _0x5775ca;}})[_0x5bec('0x42')](function(_0x51af88){logger['error'](_0x5bec('0x4e'),_0x51af88);throw _0x51af88;});}return _0x5775ca;})['then'](respondWithResult(_0x123758,0xc9))['catch'](handleError(_0x123758,null));};exports[_0x5bec('0x24')]=function(_0x2114e5,_0x416058){if(_0x2114e5['body']['id']){delete _0x2114e5[_0x5bec('0x46')]['id'];}return db[_0x5bec('0x2e')][_0x5bec('0x4b')]({'where':{'id':_0x2114e5[_0x5bec('0x4f')]['id']}})['then'](handleEntityNotFound(_0x416058,null))[_0x5bec('0x25')](saveUpdates(_0x2114e5[_0x5bec('0x46')],null))[_0x5bec('0x25')](respondWithResult(_0x416058,null))[_0x5bec('0x42')](handleError(_0x416058,null));};exports[_0x5bec('0x26')]=function(_0x3ddf28,_0x33b924){return db['Tag']['find']({'where':{'id':_0x3ddf28[_0x5bec('0x4f')]['id']}})['then'](handleEntityNotFound(_0x33b924,null))[_0x5bec('0x25')](removeEntity(_0x33b924,null))[_0x5bec('0x42')](handleError(_0x33b924,null));}; \ No newline at end of file +var _0xa37e=['path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','name','send','Tag','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa37e,0x97));var _0xea37=function(_0x19c835,_0x10cd0f){_0x19c835=_0x19c835-0x0;var _0x54fd2e=_0xa37e[_0x19c835];return _0x54fd2e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea37('0x0'));var jsonpatch=require(_0xea37('0x1'));var rp=require(_0xea37('0x2'));var moment=require(_0xea37('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xea37('0x4'));var util=require('util');var path=require(_0xea37('0x5'));var sox=require(_0xea37('0x6'));var csv=require(_0xea37('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea37('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea37('0x9'));var deskjs=require(_0xea37('0xa'));var toCsv=require(_0xea37('0x7'));var querystring=require(_0xea37('0xb'));var Papa=require('papaparse');var Redis=require(_0xea37('0xc'));var authService=require(_0xea37('0xd'));var qs=require(_0xea37('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea37('0xf'))(_0xea37('0x10'));var utils=require(_0xea37('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xea37('0x12'));var db=require(_0xea37('0x13'))['db'];function respondWithStatusCode(_0x2a2bcd,_0x589a61){_0x589a61=_0x589a61||0xcc;return function(_0x3aef9e){if(_0x3aef9e){return _0x2a2bcd[_0xea37('0x14')](_0x589a61);}return _0x2a2bcd['status'](_0x589a61)[_0xea37('0x15')]();};}function respondWithResult(_0x556a64,_0xd7d4e7){_0xd7d4e7=_0xd7d4e7||0xc8;return function(_0x4dd6d0){if(_0x4dd6d0){return _0x556a64[_0xea37('0x16')](_0xd7d4e7)[_0xea37('0x17')](_0x4dd6d0);}};}function respondWithFilteredResult(_0x168e80,_0x46aaf0){return function(_0x5b38aa){if(_0x5b38aa){var _0x18e4b8=typeof _0x46aaf0['offset']==='undefined'&&typeof _0x46aaf0[_0xea37('0x18')]==='undefined';var _0x257310=_0x5b38aa[_0xea37('0x19')];var _0x4ef3c9=_0x18e4b8?0x0:_0x46aaf0[_0xea37('0x1a')];var _0x465d3b=_0x18e4b8?_0x5b38aa['count']:_0x46aaf0[_0xea37('0x1a')]+_0x46aaf0[_0xea37('0x18')];var _0x3ee6bb;if(_0x465d3b>=_0x257310){_0x465d3b=_0x257310;_0x3ee6bb=0xc8;}else{_0x3ee6bb=0xce;}_0x168e80[_0xea37('0x16')](_0x3ee6bb);return _0x168e80[_0xea37('0x1b')](_0xea37('0x1c'),_0x4ef3c9+'-'+_0x465d3b+'/'+_0x257310)[_0xea37('0x17')](_0x5b38aa);}return null;};}function patchUpdates(_0x238567){return function(_0x28ed44){try{jsonpatch[_0xea37('0x1d')](_0x28ed44,_0x238567,!![]);}catch(_0x498df6){return BPromise[_0xea37('0x1e')](_0x498df6);}return _0x28ed44[_0xea37('0x1f')]();};}function saveUpdates(_0x356f04,_0x536eff){return function(_0x4aa2ae){if(_0x4aa2ae){return _0x4aa2ae[_0xea37('0x20')](_0x356f04)[_0xea37('0x21')](function(_0x98c6de){return _0x98c6de;});}return null;};}function removeEntity(_0x4302ca,_0x4996e9){return function(_0x25042e){if(_0x25042e){return _0x25042e['destroy']()['then'](function(){var _0x5503f1=_0x25042e[_0xea37('0x22')]({'plain':!![]});var _0x4ff973=_0xea37('0x23');return db[_0xea37('0x24')][_0xea37('0x25')]({'where':{'type':_0x4ff973,'resourceId':_0x5503f1['id']}})[_0xea37('0x21')](function(){return _0x25042e;});})[_0xea37('0x21')](function(){_0x4302ca[_0xea37('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57a7cc,_0x55880c){return function(_0x477e25){if(!_0x477e25){_0x57a7cc[_0xea37('0x14')](0x194);}return _0x477e25;};}function handleError(_0x4ffcf1,_0x1ff12d){_0x1ff12d=_0x1ff12d||0x1f4;return function(_0x10d556){logger[_0xea37('0x26')](_0x10d556['stack']);if(_0x10d556[_0xea37('0x27')]){delete _0x10d556[_0xea37('0x27')];}_0x4ffcf1[_0xea37('0x16')](_0x1ff12d)[_0xea37('0x28')](_0x10d556);};}exports['index']=function(_0x44e0af,_0x55388b){var _0x568f98={},_0x1faf31={},_0x589244={'count':0x0,'rows':[]};var _0x52e23e=_['map'](db[_0xea37('0x29')][_0xea37('0x2a')],function(_0x3ec6af){return{'name':_0x3ec6af[_0xea37('0x2b')],'type':_0x3ec6af[_0xea37('0x2c')][_0xea37('0x2d')]};});_0x1faf31['model']=_[_0xea37('0x2e')](_0x52e23e,_0xea37('0x27'));_0x1faf31[_0xea37('0x2f')]=_[_0xea37('0x30')](_0x44e0af[_0xea37('0x2f')]);_0x1faf31[_0xea37('0x31')]=_['intersection'](_0x1faf31[_0xea37('0x32')],_0x1faf31['query']);_0x568f98[_0xea37('0x33')]=_[_0xea37('0x34')](_0x1faf31[_0xea37('0x32')],qs[_0xea37('0x35')](_0x44e0af[_0xea37('0x2f')][_0xea37('0x35')]));_0x568f98[_0xea37('0x33')]=_0x568f98[_0xea37('0x33')]['length']?_0x568f98[_0xea37('0x33')]:_0x1faf31[_0xea37('0x32')];if(!_0x44e0af[_0xea37('0x2f')][_0xea37('0x36')](_0xea37('0x37'))){_0x568f98[_0xea37('0x18')]=qs['limit'](_0x44e0af['query']['limit']);_0x568f98[_0xea37('0x1a')]=qs['offset'](_0x44e0af[_0xea37('0x2f')]['offset']);}_0x568f98['order']=qs['sort'](_0x44e0af['query'][_0xea37('0x38')]);_0x568f98[_0xea37('0x39')]=qs[_0xea37('0x31')](_[_0xea37('0x3a')](_0x44e0af[_0xea37('0x2f')],_0x1faf31[_0xea37('0x31')]),_0x52e23e);if(_0x44e0af[_0xea37('0x2f')][_0xea37('0x3b')]){_0x568f98[_0xea37('0x39')]=_['merge'](_0x568f98[_0xea37('0x39')],{'$or':_['map'](_0x52e23e,function(_0x278c9e){if(_0x278c9e[_0xea37('0x2c')]!==_0xea37('0x3c')){var _0x537f75={};_0x537f75[_0x278c9e[_0xea37('0x27')]]={'$like':'%'+_0x44e0af[_0xea37('0x2f')][_0xea37('0x3b')]+'%'};return _0x537f75;}})});}_0x568f98=_[_0xea37('0x3d')]({},_0x568f98,_0x44e0af['options']);var _0xc5f582={'where':_0x568f98['where']};return db[_0xea37('0x29')][_0xea37('0x19')](_0xc5f582)[_0xea37('0x21')](function(_0x847051){_0x589244[_0xea37('0x19')]=_0x847051;if(_0x44e0af[_0xea37('0x2f')]['includeAll']){_0x568f98[_0xea37('0x3e')]=[{'all':!![]}];}return db[_0xea37('0x29')]['findAll'](_0x568f98);})[_0xea37('0x21')](function(_0x4e9a82){_0x589244[_0xea37('0x3f')]=_0x4e9a82;return _0x589244;})[_0xea37('0x21')](respondWithFilteredResult(_0x55388b,_0x568f98))[_0xea37('0x40')](handleError(_0x55388b,null));};exports[_0xea37('0x41')]=function(_0x2281d9,_0x10c108){var _0xcd648c={'raw':!![],'where':{'id':_0x2281d9[_0xea37('0x42')]['id']}},_0x71760a={};_0x71760a[_0xea37('0x32')]=_[_0xea37('0x30')](db[_0xea37('0x29')][_0xea37('0x2a')]);_0x71760a[_0xea37('0x2f')]=_[_0xea37('0x30')](_0x2281d9['query']);_0x71760a[_0xea37('0x31')]=_[_0xea37('0x34')](_0x71760a[_0xea37('0x32')],_0x71760a[_0xea37('0x2f')]);_0xcd648c[_0xea37('0x33')]=_['intersection'](_0x71760a[_0xea37('0x32')],qs[_0xea37('0x35')](_0x2281d9[_0xea37('0x2f')][_0xea37('0x35')]));_0xcd648c[_0xea37('0x33')]=_0xcd648c[_0xea37('0x33')]['length']?_0xcd648c[_0xea37('0x33')]:_0x71760a[_0xea37('0x32')];if(_0x2281d9[_0xea37('0x2f')][_0xea37('0x43')]){_0xcd648c[_0xea37('0x3e')]=[{'all':!![]}];}_0xcd648c=_[_0xea37('0x3d')]({},_0xcd648c,_0x2281d9[_0xea37('0x44')]);return db[_0xea37('0x29')]['find'](_0xcd648c)[_0xea37('0x21')](handleEntityNotFound(_0x10c108,null))[_0xea37('0x21')](respondWithResult(_0x10c108,null))['catch'](handleError(_0x10c108,null));};exports[_0xea37('0x45')]=function(_0x2ff803,_0x172f22){return db[_0xea37('0x29')][_0xea37('0x45')](_0x2ff803[_0xea37('0x46')],{})[_0xea37('0x21')](function(_0x174a77){var _0x483d1a=_0x2ff803[_0xea37('0x47')]['get']({'plain':!![]});if(!_0x483d1a)throw new Error(_0xea37('0x48'));if(_0x483d1a['role']===_0xea37('0x47')){var _0x14c119=_0x174a77[_0xea37('0x22')]({'plain':!![]});var _0xb08dc5=_0xea37('0x23');return db[_0xea37('0x49')][_0xea37('0x4a')]({'where':{'name':_0xb08dc5,'userProfileId':_0x483d1a[_0xea37('0x4b')]},'raw':!![]})['then'](function(_0x4c55b9){if(_0x4c55b9&&_0x4c55b9[_0xea37('0x4c')]===0x0){return db[_0xea37('0x24')][_0xea37('0x45')]({'name':_0x14c119['name'],'resourceId':_0x14c119['id'],'type':_0x4c55b9[_0xea37('0x27')],'sectionId':_0x4c55b9['id']},{})[_0xea37('0x21')](function(){return _0x174a77;});}else{return _0x174a77;}})['catch'](function(_0xcb7bf3){logger[_0xea37('0x26')](_0xea37('0x4d'),_0xcb7bf3);throw _0xcb7bf3;});}return _0x174a77;})[_0xea37('0x21')](respondWithResult(_0x172f22,0xc9))[_0xea37('0x40')](handleError(_0x172f22,null));};exports[_0xea37('0x20')]=function(_0x2936ee,_0x224f2c){if(_0x2936ee[_0xea37('0x46')]['id']){delete _0x2936ee[_0xea37('0x46')]['id'];}return db[_0xea37('0x29')][_0xea37('0x4a')]({'where':{'id':_0x2936ee[_0xea37('0x42')]['id']}})[_0xea37('0x21')](handleEntityNotFound(_0x224f2c,null))[_0xea37('0x21')](saveUpdates(_0x2936ee['body'],null))[_0xea37('0x21')](respondWithResult(_0x224f2c,null))[_0xea37('0x40')](handleError(_0x224f2c,null));};exports[_0xea37('0x25')]=function(_0x2acb0f,_0x40d747){return db[_0xea37('0x29')]['find']({'where':{'id':_0x2acb0f[_0xea37('0x42')]['id']}})[_0xea37('0x21')](handleEntityNotFound(_0x40d747,null))[_0xea37('0x21')](removeEntity(_0x40d747,null))[_0xea37('0x40')](handleError(_0x40d747,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7eb73bf..f23a737 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 _0x399a=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','../../config/logger','api','moment','bluebird'];(function(_0x40b5f5,_0x46820b){var _0x105db1=function(_0x1a41ac){while(--_0x1a41ac){_0x40b5f5['push'](_0x40b5f5['shift']());}};_0x105db1(++_0x46820b);}(_0x399a,0xf3));var _0xa399=function(_0x4442ff,_0x5e93e5){_0x4442ff=_0x4442ff-0x0;var _0x3bb5e2=_0x399a[_0x4442ff];return _0x3bb5e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa399('0x0'))(_0xa399('0x1'));var moment=require(_0xa399('0x2'));var BPromise=require(_0xa399('0x3'));var rp=require(_0xa399('0x4'));var fs=require('fs');var path=require(_0xa399('0x5'));var rimraf=require(_0xa399('0x6'));var config=require(_0xa399('0x7'));var attributes=require(_0xa399('0x8'));module[_0xa399('0x9')]=function(_0x520d43,_0x12bbc4){return _0x520d43[_0xa399('0xa')](_0xa399('0xb'),attributes,{'tableName':_0xa399('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd0=['api','moment','bluebird','request-promise','rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x1448a9,_0xf56a41){var _0x34c5bd=function(_0x4279a5){while(--_0x4279a5){_0x1448a9['push'](_0x1448a9['shift']());}};_0x34c5bd(++_0xf56a41);}(_0xcdd0,0x169));var _0x0cdd=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xcdd0[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var logger=require(_0x0cdd('0x2'))(_0x0cdd('0x3'));var moment=require(_0x0cdd('0x4'));var BPromise=require(_0x0cdd('0x5'));var rp=require(_0x0cdd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cdd('0x7'));var config=require('../../config/environment');var attributes=require(_0x0cdd('0x8'));module[_0x0cdd('0x9')]=function(_0x154e80,_0x43f99d){return _0x154e80[_0x0cdd('0xa')](_0x0cdd('0xb'),attributes,{'tableName':_0x0cdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 1d448dc..ce4d821 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 _0xe107=['then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4be6b4,_0xd48e4d){var _0xcdcd40=function(_0x28e642){while(--_0x28e642){_0x4be6b4['push'](_0x4be6b4['shift']());}};_0xcdcd40(++_0xd48e4d);}(_0xe107,0xb3));var _0x7e10=function(_0x5ac05a,_0x38181b){_0x5ac05a=_0x5ac05a-0x0;var _0x49e7dd=_0xe107[_0x5ac05a];return _0x49e7dd;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var moment=require(_0x7e10('0x1'));var BPromise=require(_0x7e10('0x2'));var rs=require(_0x7e10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e10('0x5'));var config=require(_0x7e10('0x6'));var jayson=require(_0x7e10('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd3de,_0x7378b3,_0x156c56){return new BPromise(function(_0x3413f7,_0x493958){return client['request'](_0x1dd3de,_0x156c56)[_0x7e10('0x8')](function(_0x490a7a){logger['info'](_0x7e10('0x9'),_0x7378b3,_0x7e10('0xa'));logger[_0x7e10('0xb')](_0x7e10('0xc'),_0x7378b3,_0x7e10('0xa'),JSON['stringify'](_0x490a7a));if(_0x490a7a[_0x7e10('0xd')]){if(_0x490a7a['error'][_0x7e10('0xe')]===0x1f4){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a['error'][_0x7e10('0xf')]);return _0x493958(_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);}logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);return _0x3413f7(_0x490a7a[_0x7e10('0xd')]['message']);}else{logger[_0x7e10('0x10')](_0x7e10('0x9'),_0x7378b3,'request\x20sent');_0x3413f7(_0x490a7a['result'][_0x7e10('0xf')]);}})['catch'](function(_0xe1abd2){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0xe1abd2);_0x493958(_0xe1abd2);});});} \ No newline at end of file +var _0xe5b3=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0xe5b3,0x133));var _0x3e5b=function(_0x6668a5,_0x53b00e){_0x6668a5=_0x6668a5-0x0;var _0x1568d1=_0xe5b3[_0x6668a5];return _0x1568d1;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 61e4d1a..51ee4e4 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 c471a41..eae27c0 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 _0xd8b0=['exports','sequelize'];(function(_0x417545,_0x12f30e){var _0x235e2d=function(_0x44ba77){while(--_0x44ba77){_0x417545['push'](_0x417545['shift']());}};_0x235e2d(++_0x12f30e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb7e7[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a44e699..a76ff98 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 _0x604e=['destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','rows','catch','params','intersection','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','Queue','pick','toLowerCase','addQueues','capitalize','Queues','ids','addAgents','Sms','Whatsapp','sequelize','transaction','Voice','through','penalty','TeamVoiceQueue','User','emit','Queue:save','QueueId','findAll','voicePause','interface','UserVoiceQueueRt','upsert','format','all','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeAgents','Chat','Fax','Openchannel','parse','getAgents','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x604e,0x1e1));var _0xe604=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x604e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe604('0x0'));var jsonpatch=require(_0xe604('0x1'));var rp=require(_0xe604('0x2'));var moment=require(_0xe604('0x3'));var BPromise=require(_0xe604('0x4'));var Mustache=require(_0xe604('0x5'));var util=require(_0xe604('0x6'));var path=require(_0xe604('0x7'));var sox=require(_0xe604('0x8'));var csv=require('to-csv');var ejs=require(_0xe604('0x9'));var fs=require('fs');var fs_extra=require(_0xe604('0xa'));var _=require(_0xe604('0xb'));var squel=require(_0xe604('0xc'));var crypto=require(_0xe604('0xd'));var jsforce=require(_0xe604('0xe'));var deskjs=require(_0xe604('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe604('0x10'));var Redis=require(_0xe604('0x11'));var authService=require(_0xe604('0x12'));var qs=require(_0xe604('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe604('0x14'));var logger=require(_0xe604('0x15'))(_0xe604('0x16'));var utils=require(_0xe604('0x17'));var config=require(_0xe604('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe604('0x19'))['db'];config['redis']=_[_0xe604('0x1a')](config[_0xe604('0x1b')],{'host':_0xe604('0x1c'),'port':0x18eb});var socket=require(_0xe604('0x1d'))(new Redis(config[_0xe604('0x1b')]));require(_0xe604('0x1e'))['register'](socket);function respondWithStatusCode(_0x23027d,_0x1d2a61){_0x1d2a61=_0x1d2a61||0xcc;return function(_0x575255){if(_0x575255){return _0x23027d['sendStatus'](_0x1d2a61);}return _0x23027d[_0xe604('0x1f')](_0x1d2a61)[_0xe604('0x20')]();};}function respondWithResult(_0x39e12b,_0x2f19a9){_0x2f19a9=_0x2f19a9||0xc8;return function(_0x36c4bd){if(_0x36c4bd){return _0x39e12b[_0xe604('0x1f')](_0x2f19a9)['json'](_0x36c4bd);}};}function respondWithFilteredResult(_0x2587a1,_0x2fb608){return function(_0x109a68){if(_0x109a68){var _0x15a0c5=typeof _0x2fb608[_0xe604('0x21')]===_0xe604('0x22')&&typeof _0x2fb608[_0xe604('0x23')]===_0xe604('0x22');var _0x2aa493=_0x109a68['count'];var _0x4a197f=_0x15a0c5?0x0:_0x2fb608['offset'];var _0x548bf8=_0x15a0c5?_0x109a68[_0xe604('0x24')]:_0x2fb608['offset']+_0x2fb608['limit'];var _0x26c798;if(_0x548bf8>=_0x2aa493){_0x548bf8=_0x2aa493;_0x26c798=0xc8;}else{_0x26c798=0xce;}_0x2587a1[_0xe604('0x1f')](_0x26c798);return _0x2587a1['set'](_0xe604('0x25'),_0x4a197f+'-'+_0x548bf8+'/'+_0x2aa493)[_0xe604('0x26')](_0x109a68);}return null;};}function patchUpdates(_0x216531){return function(_0x446309){try{jsonpatch[_0xe604('0x27')](_0x446309,_0x216531,!![]);}catch(_0x2c8b30){return BPromise[_0xe604('0x28')](_0x2c8b30);}return _0x446309[_0xe604('0x29')]();};}function saveUpdates(_0x4e396f,_0x2a9c7d){return function(_0x4dfbbc){if(_0x4dfbbc){return _0x4dfbbc['update'](_0x4e396f)[_0xe604('0x2a')](function(_0x70881c){return _0x70881c;});}return null;};}function removeEntity(_0x15d8fb,_0x3e3815){return function(_0x15794e){if(_0x15794e){return _0x15794e[_0xe604('0x2b')]()[_0xe604('0x2a')](function(){var _0x376209=_0x15794e[_0xe604('0x2c')]({'plain':!![]});var _0x55f33c='Teams';return db[_0xe604('0x2d')][_0xe604('0x2b')]({'where':{'type':_0x55f33c,'resourceId':_0x376209['id']}})[_0xe604('0x2a')](function(){return _0x15794e;});})[_0xe604('0x2a')](function(){_0x15d8fb[_0xe604('0x1f')](0xcc)[_0xe604('0x20')]();});}};}function handleEntityNotFound(_0x15986c,_0x5b8389){return function(_0x48cd11){if(!_0x48cd11){_0x15986c[_0xe604('0x2e')](0x194);}return _0x48cd11;};}function handleError(_0x4a1ebb,_0x28a46f){_0x28a46f=_0x28a46f||0x1f4;return function(_0x429b6d){logger['error'](_0x429b6d[_0xe604('0x2f')]);if(_0x429b6d[_0xe604('0x30')]){delete _0x429b6d[_0xe604('0x30')];}_0x4a1ebb[_0xe604('0x1f')](_0x28a46f)[_0xe604('0x31')](_0x429b6d);};}exports[_0xe604('0x32')]=function(_0x5ea257,_0x538800){var _0x22ae5f={},_0x5dc7a6={},_0xa86127={'count':0x0,'rows':[]};var _0x588eb6=_['map'](db[_0xe604('0x33')][_0xe604('0x34')],function(_0x195a72){return{'name':_0x195a72[_0xe604('0x35')],'type':_0x195a72[_0xe604('0x36')][_0xe604('0x37')]};});_0x5dc7a6[_0xe604('0x38')]=_[_0xe604('0x39')](_0x588eb6,_0xe604('0x30'));_0x5dc7a6[_0xe604('0x3a')]=_[_0xe604('0x3b')](_0x5ea257[_0xe604('0x3a')]);_0x5dc7a6[_0xe604('0x3c')]=_['intersection'](_0x5dc7a6[_0xe604('0x38')],_0x5dc7a6[_0xe604('0x3a')]);_0x22ae5f[_0xe604('0x3d')]=_['intersection'](_0x5dc7a6[_0xe604('0x38')],qs[_0xe604('0x3e')](_0x5ea257['query']['fields']));_0x22ae5f[_0xe604('0x3d')]=_0x22ae5f[_0xe604('0x3d')][_0xe604('0x3f')]?_0x22ae5f[_0xe604('0x3d')]:_0x5dc7a6[_0xe604('0x38')];if(!_0x5ea257[_0xe604('0x3a')][_0xe604('0x40')]('nolimit')){_0x22ae5f[_0xe604('0x23')]=qs[_0xe604('0x23')](_0x5ea257[_0xe604('0x3a')]['limit']);_0x22ae5f[_0xe604('0x21')]=qs['offset'](_0x5ea257['query'][_0xe604('0x21')]);}_0x22ae5f[_0xe604('0x41')]=qs[_0xe604('0x42')](_0x5ea257[_0xe604('0x3a')][_0xe604('0x42')]);_0x22ae5f[_0xe604('0x43')]=qs[_0xe604('0x3c')](_['pick'](_0x5ea257[_0xe604('0x3a')],_0x5dc7a6[_0xe604('0x3c')]),_0x588eb6);if(_0x5ea257[_0xe604('0x3a')]['filter']){_0x22ae5f['where']=_[_0xe604('0x44')](_0x22ae5f[_0xe604('0x43')],{'$or':_[_0xe604('0x39')](_0x588eb6,function(_0x1e014c){if(_0x1e014c[_0xe604('0x36')]!==_0xe604('0x45')){var _0x21a1f4={};_0x21a1f4[_0x1e014c['name']]={'$like':'%'+_0x5ea257['query'][_0xe604('0x46')]+'%'};return _0x21a1f4;}})});}_0x22ae5f=_['merge']({},_0x22ae5f,_0x5ea257[_0xe604('0x47')]);var _0x461511={'where':_0x22ae5f[_0xe604('0x43')]};return db[_0xe604('0x33')][_0xe604('0x24')](_0x461511)[_0xe604('0x2a')](function(_0x1aea20){_0xa86127[_0xe604('0x24')]=_0x1aea20;if(_0x5ea257['query']['includeAll']){_0x22ae5f[_0xe604('0x48')]=[{'all':!![]}];}return db['Team']['findAll'](_0x22ae5f);})[_0xe604('0x2a')](function(_0x7ef240){_0xa86127[_0xe604('0x49')]=_0x7ef240;return _0xa86127;})['then'](respondWithFilteredResult(_0x538800,_0x22ae5f))[_0xe604('0x4a')](handleError(_0x538800,null));};exports['show']=function(_0x39a961,_0x492969){var _0x4d6e2f={'raw':![],'where':{'id':_0x39a961[_0xe604('0x4b')]['id']}},_0x34e5fb={};_0x34e5fb[_0xe604('0x38')]=_['keys'](db['Team'][_0xe604('0x34')]);_0x34e5fb[_0xe604('0x3a')]=_[_0xe604('0x3b')](_0x39a961[_0xe604('0x3a')]);_0x34e5fb[_0xe604('0x3c')]=_[_0xe604('0x4c')](_0x34e5fb[_0xe604('0x38')],_0x34e5fb[_0xe604('0x3a')]);_0x4d6e2f[_0xe604('0x3d')]=_[_0xe604('0x4c')](_0x34e5fb[_0xe604('0x38')],qs[_0xe604('0x3e')](_0x39a961['query'][_0xe604('0x3e')]));_0x4d6e2f['attributes']=_0x4d6e2f[_0xe604('0x3d')][_0xe604('0x3f')]?_0x4d6e2f[_0xe604('0x3d')]:_0x34e5fb[_0xe604('0x38')];if(_0x39a961['query'][_0xe604('0x4d')]){_0x4d6e2f[_0xe604('0x48')]=[{'all':!![]}];}_0x4d6e2f=_['merge']({},_0x4d6e2f,_0x39a961['options']);return db[_0xe604('0x33')]['find'](_0x4d6e2f)['then'](handleEntityNotFound(_0x492969,null))[_0xe604('0x2a')](respondWithResult(_0x492969,null))[_0xe604('0x4a')](handleError(_0x492969,null));};exports[_0xe604('0x4e')]=function(_0x5a3977,_0x1f82f5){return db[_0xe604('0x33')][_0xe604('0x4e')](_0x5a3977['body'],{})[_0xe604('0x2a')](function(_0xe4051){var _0x78b643=_0x5a3977[_0xe604('0x4f')][_0xe604('0x2c')]({'plain':!![]});if(!_0x78b643)throw new Error(_0xe604('0x50'));if(_0x78b643['role']==='user'){var _0x2b0602=_0xe4051[_0xe604('0x2c')]({'plain':!![]});var _0x3c4804='Teams';return db[_0xe604('0x51')]['find']({'where':{'name':_0x3c4804,'userProfileId':_0x78b643[_0xe604('0x52')]},'raw':!![]})[_0xe604('0x2a')](function(_0x475533){if(_0x475533&&_0x475533[_0xe604('0x53')]===0x0){return db[_0xe604('0x2d')][_0xe604('0x4e')]({'name':_0x2b0602[_0xe604('0x30')],'resourceId':_0x2b0602['id'],'type':_0x475533[_0xe604('0x30')],'sectionId':_0x475533['id']},{})[_0xe604('0x2a')](function(){return _0xe4051;});}else{return _0xe4051;}})[_0xe604('0x4a')](function(_0x53be7d){logger['error'](_0xe604('0x54'),_0x53be7d);throw _0x53be7d;});}return _0xe4051;})[_0xe604('0x2a')](respondWithResult(_0x1f82f5,0xc9))[_0xe604('0x4a')](handleError(_0x1f82f5,null));};exports['update']=function(_0x254f59,_0x1403fd){if(_0x254f59[_0xe604('0x55')]['id']){delete _0x254f59[_0xe604('0x55')]['id'];}return db[_0xe604('0x33')][_0xe604('0x56')]({'where':{'id':_0x254f59['params']['id']}})['then'](handleEntityNotFound(_0x1403fd,null))[_0xe604('0x2a')](saveUpdates(_0x254f59['body'],null))[_0xe604('0x2a')](respondWithResult(_0x1403fd,null))[_0xe604('0x4a')](handleError(_0x1403fd,null));};exports['destroy']=function(_0xbb843,_0x1ec3dc){return db[_0xe604('0x33')][_0xe604('0x56')]({'where':{'id':_0xbb843['params']['id']}})['then'](handleEntityNotFound(_0x1ec3dc,null))[_0xe604('0x2a')](removeEntity(_0x1ec3dc,null))[_0xe604('0x4a')](handleError(_0x1ec3dc,null));};exports[_0xe604('0x57')]=function(_0x10c6cf,_0x19de30,_0x3a8d22){return db[_0xe604('0x33')][_0xe604('0x58')]({'where':{'id':_0x10c6cf['params']['id']}})['then'](handleEntityNotFound(_0x19de30,null))['then'](function(_0x18de1e){if(!_0x10c6cf[_0xe604('0x3a')][_0xe604('0x59')]||!utils[_0xe604('0x5a')](_0x10c6cf[_0xe604('0x3a')][_0xe604('0x59')])){throw new db[(_0xe604('0x5b'))][(_0xe604('0x5c'))](_0xe604('0x5d'));}var _0x177416={};var _0x12880e={};_0x12880e[_0xe604('0x38')]=_['keys'](db[_['capitalize'](_0x10c6cf[_0xe604('0x3a')]['channel']['toLowerCase']())+_0xe604('0x5e')]['rawAttributes']);_0x12880e[_0xe604('0x3a')]=_[_0xe604('0x3b')](_0x10c6cf[_0xe604('0x3a')]);_0x12880e[_0xe604('0x3c')]=_[_0xe604('0x4c')](_0x12880e[_0xe604('0x38')],_0x12880e[_0xe604('0x3a')]);_0x177416[_0xe604('0x3d')]=_[_0xe604('0x4c')](_0x12880e['model'],qs[_0xe604('0x3e')](_0x10c6cf[_0xe604('0x3a')][_0xe604('0x3e')]));_0x177416[_0xe604('0x3d')]=_0x177416['attributes'][_0xe604('0x3f')]?_0x177416[_0xe604('0x3d')]:_0x12880e[_0xe604('0x38')];_0x177416[_0xe604('0x23')]=qs[_0xe604('0x23')](_0x10c6cf[_0xe604('0x3a')][_0xe604('0x23')]);_0x177416['offset']=qs['offset'](_0x10c6cf[_0xe604('0x3a')]['offset']);_0x177416[_0xe604('0x41')]=qs['sort'](_0x10c6cf['query']['sort']);_0x177416[_0xe604('0x43')]=qs[_0xe604('0x3c')](_[_0xe604('0x5f')](_0x10c6cf[_0xe604('0x3a')],_0x12880e[_0xe604('0x3c')]));_0x177416=_[_0xe604('0x44')]({},_0x177416,_0x10c6cf['options']);return _0x18de1e[_0xe604('0x2c')+_['capitalize'](_0x10c6cf[_0xe604('0x3a')][_0xe604('0x59')][_0xe604('0x60')]())+'Queues'](_0x177416);})[_0xe604('0x2a')](respondWithResult(_0x19de30,null))['catch'](handleError(_0x19de30,null));};exports[_0xe604('0x61')]=function(_0x5931bb,_0x2948f4,_0x950d56){return db[_0xe604('0x33')][_0xe604('0x58')]({'where':{'id':_0x5931bb['params']['id']}})[_0xe604('0x2a')](function(_0x2f2471){if(_0x2f2471){if(!_0x5931bb['body'][_0xe604('0x59')]||!utils['isValidChannel'](_0x5931bb['body'][_0xe604('0x59')])){throw new db[(_0xe604('0x5b'))][(_0xe604('0x5c'))]('Unknown\x20channel');}return _0x2f2471['add'+_[_0xe604('0x62')](_0x5931bb[_0xe604('0x55')][_0xe604('0x59')][_0xe604('0x60')]())+_0xe604('0x63')](_0x5931bb[_0xe604('0x55')]['ids']);}return null;})[_0xe604('0x2a')](handleEntityNotFound(_0x2948f4,null))[_0xe604('0x2a')](respondWithStatusCode(_0x2948f4,null))[_0xe604('0x4a')](handleError(_0x2948f4,null));};exports['removeQueues']=function(_0x511914,_0x1aedea,_0x9b4e8b){return db['Team'][_0xe604('0x58')]({'where':{'id':_0x511914[_0xe604('0x4b')]['id']}})[_0xe604('0x2a')](function(_0x52ab74){if(_0x52ab74){if(!_0x511914['query'][_0xe604('0x59')]||!utils[_0xe604('0x5a')](_0x511914['query'][_0xe604('0x59')])){throw new db[(_0xe604('0x5b'))]['ValidationError']('Unknown\x20channel');}return _0x52ab74['remove'+_['capitalize'](_0x511914[_0xe604('0x3a')][_0xe604('0x59')][_0xe604('0x60')]())+_0xe604('0x63')](_0x511914['query'][_0xe604('0x64')]);}return null;})[_0xe604('0x2a')](handleEntityNotFound(_0x1aedea,null))[_0xe604('0x2a')](respondWithStatusCode(_0x1aedea,null))[_0xe604('0x4a')](handleError(_0x1aedea,null));};exports[_0xe604('0x65')]=function(_0x2c5a0c,_0x102813){return db[_0xe604('0x33')]['find']({'where':{'id':_0x2c5a0c['params']['id']}})[_0xe604('0x2a')](handleEntityNotFound(_0x102813,null))[_0xe604('0x2a')](function(_0x385ab0){if(_0x385ab0){var _0x4d164e=['Voice','Chat','Mail',_0xe604('0x66'),'Fax','Openchannel',_0xe604('0x67')];return db[_0xe604('0x68')][_0xe604('0x69')](function(_0x245761){var _0x4673b8=_[_0xe604('0x39')](_0x4d164e,function(_0x400949){var _0x11256e={'attributes':['id','name']};if(_0x400949===_0xe604('0x6a')){_0x11256e[_0xe604('0x6b')]={'attributes':[_0xe604('0x6c')]};}return _0x385ab0[_0xe604('0x2c')+_0x400949+'Queues'](_0x11256e)['then'](function(_0x5db278){var _0x2e586c=_['map'](_0x5db278,function(_0x2ee158){var _0x2099e=_[_0xe604('0x39')](_0x2c5a0c['body']['ids'],function(_0x95e0e1){var _0x10191b={'where':{'UserId':_0x95e0e1,[_0x400949+'QueueId']:_0x2ee158['id']},'transaction':_0x245761};if(_0x400949===_0xe604('0x6a')){_0x10191b['defaults']={'penalty':_0x2ee158[_0xe604('0x6d')]['penalty']};}return db[_0xe604('0x6e')+_0x400949+'Queue']['findOrCreate'](_0x10191b)[_0xe604('0x2a')](function(){socket[_0xe604('0x6f')](_0xe604('0x4f')+_0x400949+_0xe604('0x70'),{'UserId':_0x95e0e1,[_0x400949+_0xe604('0x71')]:_0x2ee158['id']});if(_0x400949!==_0xe604('0x6a'))return;return db[_0xe604('0x6e')][_0xe604('0x72')]({'where':{'id':_0x2c5a0c[_0xe604('0x55')][_0xe604('0x64')],'online':0x1},'attributes':['id',_0xe604('0x30'),'online',_0xe604('0x73'),_0xe604('0x74')],'raw':!![]})[_0xe604('0x2a')](function(_0x4021bc){var _0x191d06=_[_0xe604('0x39')](_0x4021bc,function(_0xa65445){return db[_0xe604('0x75')][_0xe604('0x76')]({'membername':_0xa65445[_0xe604('0x30')],'UserId':_0xa65445['id'],'queue_name':_0x2ee158['name'],'VoiceQueueId':_0x2ee158['id'],'interface':_['isNil'](_0xa65445[_0xe604('0x74')])?util[_0xe604('0x77')]('SIP/%s',_0xa65445[_0xe604('0x30')]):_0xa65445[_0xe604('0x74')],'paused':_0xa65445[_0xe604('0x73')]||![],'penalty':_0x2ee158['TeamVoiceQueue'][_0xe604('0x6c')]},{'transaction':_0x245761});});return Promise[_0xe604('0x78')](_0x191d06);});});});return Promise[_0xe604('0x78')](_0x2099e);});return Promise['all'](_0x2e586c);})[_0xe604('0x2a')](function(){var _0xa99522=JSON['parse']('['+_0x2c5a0c[_0xe604('0x55')][_0xe604('0x64')]+']');db[_0xe604('0x79')]['findOne']({'where':{'teamId':_0x2c5a0c[_0xe604('0x4b')]['id']}})[_0xe604('0x2a')](function(_0x909535){if(_0x909535){for(var _0x262ca8=0x0;_0x262ca8<_0xa99522[_0xe604('0x3f')];_0x262ca8++){var _0x290173=_0xa99522[_0x262ca8];db[_0xe604('0x7a')][_0xe604('0x76')]({'UserId':_0x290173,'VoicePrefixId':_0x909535[_0xe604('0x7b')]});}}});});});return Promise[_0xe604('0x78')](_0x4673b8)[_0xe604('0x2a')](function(){return _0x385ab0['addAgents'](_0x2c5a0c['body'][_0xe604('0x64')],{'transaction':_0x245761})['spread'](function(_0x4d2e8a){return _0x4d2e8a;});});});}})[_0xe604('0x2a')](respondWithResult(_0x102813,null))[_0xe604('0x4a')](handleError(_0x102813,null));};exports[_0xe604('0x7c')]=function(_0xa85ca2,_0x4c3453){return db['Team'][_0xe604('0x56')]({'where':{'id':_0xa85ca2['params']['id']}})[_0xe604('0x2a')](handleEntityNotFound(_0x4c3453,null))[_0xe604('0x2a')](function(_0x38ed51){if(_0x38ed51){var _0x58917e=[_0xe604('0x6a'),_0xe604('0x7d'),'Mail',_0xe604('0x66'),_0xe604('0x7e'),_0xe604('0x7f'),_0xe604('0x67')];return db['sequelize'][_0xe604('0x69')](function(_0x548b0a){var _0x286ba9=_['map'](_0x58917e,function(_0x5309c3){var _0x2f0348={'attributes':['id',_0xe604('0x30')]};return _0x38ed51[_0xe604('0x2c')+_0x5309c3+_0xe604('0x63')](_0x2f0348)['then'](function(_0x12090c){var _0x2b5f11=_[_0xe604('0x39')](_0x12090c,function(_0x24843c){return _0x24843c[_0xe604('0x7c')](_0xa85ca2[_0xe604('0x3a')][_0xe604('0x64')],{'transaction':_0x548b0a})[_0xe604('0x2a')](function(){var _0x38aa7b=JSON[_0xe604('0x80')]('['+_0xa85ca2[_0xe604('0x3a')][_0xe604('0x64')]+']');var _0xee6706=_[_0xe604('0x39')](_0x38aa7b,function(_0x47dca5){socket['emit'](_0xe604('0x4f')+_0x5309c3+'Queue:remove',{'UserId':Number(_0x47dca5),[_0x5309c3+_0xe604('0x71')]:_0x24843c['id']});if(_0x5309c3!==_0xe604('0x6a'))return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x24843c['id'],'UserId':_0x47dca5},'transaction':_0x548b0a});});return Promise[_0xe604('0x78')](_0xee6706);});});return Promise[_0xe604('0x78')](_0x2b5f11);});});return Promise[_0xe604('0x78')](_0x286ba9)[_0xe604('0x2a')](function(){return _0x38ed51[_0xe604('0x7c')](_0xa85ca2[_0xe604('0x3a')][_0xe604('0x64')],{'transaction':_0x548b0a});})[_0xe604('0x2a')](function(){var _0x260246=JSON[_0xe604('0x80')]('['+_0xa85ca2['query'][_0xe604('0x64')]+']');db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0xa85ca2[_0xe604('0x4b')]['id']}})['then'](function(_0x7dd5b){if(_0x7dd5b){for(var _0x478258=0x0;_0x478258<_0x260246[_0xe604('0x3f')];_0x478258++){var _0x3087dc=_0x260246[_0x478258];db[_0xe604('0x7a')][_0xe604('0x2b')]({'where':{'UserId':_0x3087dc,'VoicePrefixId':_0x7dd5b[_0xe604('0x7b')]}});}}});});});}})[_0xe604('0x2a')](respondWithStatusCode(_0x4c3453,null))[_0xe604('0x4a')](handleError(_0x4c3453,null));};exports['getAgents']=function(_0x2b8903,_0x53d4af,_0x29a4fb){var _0x5089b9={};var _0x45baaa={};var _0x1f5f25;var _0x8c4fc9;return db['Team'][_0xe604('0x58')]({'where':{'id':_0x2b8903['params']['id']}})[_0xe604('0x2a')](handleEntityNotFound(_0x53d4af,null))[_0xe604('0x2a')](function(_0xfeb287){if(_0xfeb287){_0x1f5f25=_0xfeb287;_0x45baaa[_0xe604('0x38')]=_[_0xe604('0x3b')](db[_0xe604('0x6e')][_0xe604('0x34')]);_0x45baaa['query']=_[_0xe604('0x3b')](_0x2b8903[_0xe604('0x3a')]);_0x45baaa[_0xe604('0x3c')]=_[_0xe604('0x4c')](_0x45baaa['model'],_0x45baaa['query']);_0x5089b9['attributes']=_[_0xe604('0x4c')](_0x45baaa['model'],qs[_0xe604('0x3e')](_0x2b8903['query'][_0xe604('0x3e')]));_0x5089b9[_0xe604('0x3d')]=_0x5089b9['attributes']['length']?_0x5089b9[_0xe604('0x3d')]:_0x45baaa[_0xe604('0x38')];_0x5089b9['order']=qs[_0xe604('0x42')](_0x2b8903[_0xe604('0x3a')][_0xe604('0x42')]);_0x5089b9[_0xe604('0x43')]=qs[_0xe604('0x3c')](_['pick'](_0x2b8903[_0xe604('0x3a')],_0x45baaa[_0xe604('0x3c')]));if(_0x2b8903[_0xe604('0x3a')][_0xe604('0x46')]){_0x5089b9[_0xe604('0x43')]=_[_0xe604('0x44')](_0x5089b9[_0xe604('0x43')],{'$or':_[_0xe604('0x39')](_0x5089b9[_0xe604('0x3d')],function(_0x1c5af9){var _0x51fc15={};_0x51fc15[_0x1c5af9]={'$like':'%'+_0x2b8903[_0xe604('0x3a')]['filter']+'%'};return _0x51fc15;})});}_0x5089b9=_[_0xe604('0x44')]({},_0x5089b9,_0x2b8903['options']);return _0x1f5f25[_0xe604('0x81')](_0x5089b9);}})[_0xe604('0x2a')](function(_0x15edc9){if(_0x15edc9){_0x8c4fc9=_0x15edc9[_0xe604('0x3f')];if(!_0x2b8903[_0xe604('0x3a')][_0xe604('0x40')](_0xe604('0x82'))){_0x5089b9['limit']=qs[_0xe604('0x23')](_0x2b8903[_0xe604('0x3a')][_0xe604('0x23')]);_0x5089b9['offset']=qs[_0xe604('0x21')](_0x2b8903[_0xe604('0x3a')][_0xe604('0x21')]);}return _0x1f5f25[_0xe604('0x81')](_0x5089b9);}})['then'](function(_0x205408){if(_0x205408){return _0x205408?{'count':_0x8c4fc9,'rows':_0x205408}:null;}})['then'](respondWithResult(_0x53d4af,null))['catch'](handleError(_0x53d4af,null));}; \ No newline at end of file +var _0x03a4=['Queue:save','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','TeamVoicePrefix','UserVoicePrefix','upsert','VoicePrefixId','spread','removeAgents','Openchannel','transaction','parse','Queue:remove','getAgents','nolimit','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','Teams','UserProfileResource','sendStatus','error','name','index','map','Team','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getQueues','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','findOne','add','ids','removeQueues','addAgents','Chat','Mail','Sms','Fax','Whatsapp','sequelize','Voice','QueueId','TeamVoiceQueue','penalty','User','Queue','emit'];(function(_0x36199a,_0x4f756c){var _0x5b36f1=function(_0x29480d){while(--_0x29480d){_0x36199a['push'](_0x36199a['shift']());}};_0x5b36f1(++_0x4f756c);}(_0x03a4,0x19e));var _0x403a=function(_0x3285f6,_0x4f66aa){_0x3285f6=_0x3285f6-0x0;var _0x4b0abf=_0x03a4[_0x3285f6];return _0x4b0abf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x403a('0x0'));var rp=require(_0x403a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x403a('0x2'));var util=require('util');var path=require(_0x403a('0x3'));var sox=require(_0x403a('0x4'));var csv=require(_0x403a('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x403a('0x6'));var _=require('lodash');var squel=require(_0x403a('0x7'));var crypto=require('crypto');var jsforce=require(_0x403a('0x8'));var deskjs=require(_0x403a('0x9'));var toCsv=require(_0x403a('0x5'));var querystring=require('querystring');var Papa=require(_0x403a('0xa'));var Redis=require(_0x403a('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x403a('0xc'));var hardwareService=require(_0x403a('0xd'));var logger=require(_0x403a('0xe'))(_0x403a('0xf'));var utils=require(_0x403a('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x403a('0x11'))['db'];config[_0x403a('0x12')]=_['defaults'](config[_0x403a('0x12')],{'host':_0x403a('0x13'),'port':0x18eb});var socket=require(_0x403a('0x14'))(new Redis(config['redis']));require(_0x403a('0x15'))[_0x403a('0x16')](socket);function respondWithStatusCode(_0x2d506e,_0x11b0d3){_0x11b0d3=_0x11b0d3||0xcc;return function(_0x3d0225){if(_0x3d0225){return _0x2d506e['sendStatus'](_0x11b0d3);}return _0x2d506e[_0x403a('0x17')](_0x11b0d3)[_0x403a('0x18')]();};}function respondWithResult(_0x4dbe5d,_0x2b2846){_0x2b2846=_0x2b2846||0xc8;return function(_0x2eaa09){if(_0x2eaa09){return _0x4dbe5d[_0x403a('0x17')](_0x2b2846)[_0x403a('0x19')](_0x2eaa09);}};}function respondWithFilteredResult(_0x257121,_0x25efb1){return function(_0xea6eba){if(_0xea6eba){var _0x5d0bee=typeof _0x25efb1[_0x403a('0x1a')]===_0x403a('0x1b')&&typeof _0x25efb1[_0x403a('0x1c')]===_0x403a('0x1b');var _0x217db1=_0xea6eba[_0x403a('0x1d')];var _0x53fe8f=_0x5d0bee?0x0:_0x25efb1[_0x403a('0x1a')];var _0x295b26=_0x5d0bee?_0xea6eba['count']:_0x25efb1['offset']+_0x25efb1[_0x403a('0x1c')];var _0x36922f;if(_0x295b26>=_0x217db1){_0x295b26=_0x217db1;_0x36922f=0xc8;}else{_0x36922f=0xce;}_0x257121[_0x403a('0x17')](_0x36922f);return _0x257121[_0x403a('0x1e')](_0x403a('0x1f'),_0x53fe8f+'-'+_0x295b26+'/'+_0x217db1)[_0x403a('0x19')](_0xea6eba);}return null;};}function patchUpdates(_0x58d25e){return function(_0x5dc701){try{jsonpatch[_0x403a('0x20')](_0x5dc701,_0x58d25e,!![]);}catch(_0x4db6dd){return BPromise['reject'](_0x4db6dd);}return _0x5dc701['save']();};}function saveUpdates(_0x3c333b,_0x31e662){return function(_0x2836ef){if(_0x2836ef){return _0x2836ef[_0x403a('0x21')](_0x3c333b)[_0x403a('0x22')](function(_0x279006){return _0x279006;});}return null;};}function removeEntity(_0x5ccee6,_0x405c33){return function(_0x18d247){if(_0x18d247){return _0x18d247['destroy']()[_0x403a('0x22')](function(){var _0x43028c=_0x18d247[_0x403a('0x23')]({'plain':!![]});var _0x42a78c=_0x403a('0x24');return db[_0x403a('0x25')]['destroy']({'where':{'type':_0x42a78c,'resourceId':_0x43028c['id']}})['then'](function(){return _0x18d247;});})[_0x403a('0x22')](function(){_0x5ccee6[_0x403a('0x17')](0xcc)[_0x403a('0x18')]();});}};}function handleEntityNotFound(_0x31109b,_0x5e426e){return function(_0x3219a4){if(!_0x3219a4){_0x31109b[_0x403a('0x26')](0x194);}return _0x3219a4;};}function handleError(_0x425358,_0x158dc8){_0x158dc8=_0x158dc8||0x1f4;return function(_0x120a82){logger[_0x403a('0x27')](_0x120a82['stack']);if(_0x120a82[_0x403a('0x28')]){delete _0x120a82['name'];}_0x425358[_0x403a('0x17')](_0x158dc8)['send'](_0x120a82);};}exports[_0x403a('0x29')]=function(_0x1fa40f,_0x19a5b1){var _0x1550ea={},_0x4cc707={},_0x4b1d33={'count':0x0,'rows':[]};var _0x4b0786=_[_0x403a('0x2a')](db[_0x403a('0x2b')][_0x403a('0x2c')],function(_0xa6087b){return{'name':_0xa6087b[_0x403a('0x2d')],'type':_0xa6087b[_0x403a('0x2e')][_0x403a('0x2f')]};});_0x4cc707['model']=_[_0x403a('0x2a')](_0x4b0786,_0x403a('0x28'));_0x4cc707[_0x403a('0x30')]=_[_0x403a('0x31')](_0x1fa40f[_0x403a('0x30')]);_0x4cc707[_0x403a('0x32')]=_[_0x403a('0x33')](_0x4cc707[_0x403a('0x34')],_0x4cc707[_0x403a('0x30')]);_0x1550ea['attributes']=_['intersection'](_0x4cc707[_0x403a('0x34')],qs[_0x403a('0x35')](_0x1fa40f[_0x403a('0x30')]['fields']));_0x1550ea[_0x403a('0x36')]=_0x1550ea[_0x403a('0x36')][_0x403a('0x37')]?_0x1550ea[_0x403a('0x36')]:_0x4cc707[_0x403a('0x34')];if(!_0x1fa40f[_0x403a('0x30')][_0x403a('0x38')]('nolimit')){_0x1550ea[_0x403a('0x1c')]=qs[_0x403a('0x1c')](_0x1fa40f['query'][_0x403a('0x1c')]);_0x1550ea['offset']=qs['offset'](_0x1fa40f[_0x403a('0x30')][_0x403a('0x1a')]);}_0x1550ea[_0x403a('0x39')]=qs[_0x403a('0x3a')](_0x1fa40f[_0x403a('0x30')][_0x403a('0x3a')]);_0x1550ea[_0x403a('0x3b')]=qs[_0x403a('0x32')](_[_0x403a('0x3c')](_0x1fa40f[_0x403a('0x30')],_0x4cc707[_0x403a('0x32')]),_0x4b0786);if(_0x1fa40f[_0x403a('0x30')]['filter']){_0x1550ea[_0x403a('0x3b')]=_[_0x403a('0x3d')](_0x1550ea[_0x403a('0x3b')],{'$or':_[_0x403a('0x2a')](_0x4b0786,function(_0x46026b){if(_0x46026b[_0x403a('0x2e')]!==_0x403a('0x3e')){var _0x1dd5ff={};_0x1dd5ff[_0x46026b[_0x403a('0x28')]]={'$like':'%'+_0x1fa40f['query'][_0x403a('0x3f')]+'%'};return _0x1dd5ff;}})});}_0x1550ea=_[_0x403a('0x3d')]({},_0x1550ea,_0x1fa40f['options']);var _0x55be81={'where':_0x1550ea[_0x403a('0x3b')]};return db[_0x403a('0x2b')][_0x403a('0x1d')](_0x55be81)[_0x403a('0x22')](function(_0x2bdac7){_0x4b1d33[_0x403a('0x1d')]=_0x2bdac7;if(_0x1fa40f[_0x403a('0x30')][_0x403a('0x40')]){_0x1550ea[_0x403a('0x41')]=[{'all':!![]}];}return db[_0x403a('0x2b')][_0x403a('0x42')](_0x1550ea);})[_0x403a('0x22')](function(_0x4ffa93){_0x4b1d33[_0x403a('0x43')]=_0x4ffa93;return _0x4b1d33;})[_0x403a('0x22')](respondWithFilteredResult(_0x19a5b1,_0x1550ea))[_0x403a('0x44')](handleError(_0x19a5b1,null));};exports[_0x403a('0x45')]=function(_0x615e57,_0x64d416){var _0x545c6c={'raw':![],'where':{'id':_0x615e57[_0x403a('0x46')]['id']}},_0xdf8e51={};_0xdf8e51[_0x403a('0x34')]=_[_0x403a('0x31')](db[_0x403a('0x2b')]['rawAttributes']);_0xdf8e51[_0x403a('0x30')]=_[_0x403a('0x31')](_0x615e57[_0x403a('0x30')]);_0xdf8e51['filters']=_[_0x403a('0x33')](_0xdf8e51[_0x403a('0x34')],_0xdf8e51[_0x403a('0x30')]);_0x545c6c['attributes']=_['intersection'](_0xdf8e51[_0x403a('0x34')],qs['fields'](_0x615e57[_0x403a('0x30')][_0x403a('0x35')]));_0x545c6c[_0x403a('0x36')]=_0x545c6c['attributes'][_0x403a('0x37')]?_0x545c6c[_0x403a('0x36')]:_0xdf8e51[_0x403a('0x34')];if(_0x615e57[_0x403a('0x30')]['includeAll']){_0x545c6c[_0x403a('0x41')]=[{'all':!![]}];}_0x545c6c=_[_0x403a('0x3d')]({},_0x545c6c,_0x615e57[_0x403a('0x47')]);return db[_0x403a('0x2b')]['find'](_0x545c6c)[_0x403a('0x22')](handleEntityNotFound(_0x64d416,null))[_0x403a('0x22')](respondWithResult(_0x64d416,null))['catch'](handleError(_0x64d416,null));};exports['create']=function(_0x5f5630,_0x2e640e){return db['Team'][_0x403a('0x48')](_0x5f5630[_0x403a('0x49')],{})[_0x403a('0x22')](function(_0x315f26){var _0x28252d=_0x5f5630[_0x403a('0x4a')][_0x403a('0x23')]({'plain':!![]});if(!_0x28252d)throw new Error(_0x403a('0x4b'));if(_0x28252d['role']==='user'){var _0x3ae54a=_0x315f26[_0x403a('0x23')]({'plain':!![]});var _0x3bcfca='Teams';return db[_0x403a('0x4c')][_0x403a('0x4d')]({'where':{'name':_0x3bcfca,'userProfileId':_0x28252d[_0x403a('0x4e')]},'raw':!![]})[_0x403a('0x22')](function(_0x3cbb84){if(_0x3cbb84&&_0x3cbb84[_0x403a('0x4f')]===0x0){return db[_0x403a('0x25')]['create']({'name':_0x3ae54a['name'],'resourceId':_0x3ae54a['id'],'type':_0x3cbb84[_0x403a('0x28')],'sectionId':_0x3cbb84['id']},{})[_0x403a('0x22')](function(){return _0x315f26;});}else{return _0x315f26;}})[_0x403a('0x44')](function(_0x4b28b4){logger[_0x403a('0x27')](_0x403a('0x50'),_0x4b28b4);throw _0x4b28b4;});}return _0x315f26;})[_0x403a('0x22')](respondWithResult(_0x2e640e,0xc9))[_0x403a('0x44')](handleError(_0x2e640e,null));};exports['update']=function(_0x254d98,_0x44a708){if(_0x254d98['body']['id']){delete _0x254d98[_0x403a('0x49')]['id'];}return db[_0x403a('0x2b')][_0x403a('0x4d')]({'where':{'id':_0x254d98['params']['id']}})[_0x403a('0x22')](handleEntityNotFound(_0x44a708,null))['then'](saveUpdates(_0x254d98['body'],null))['then'](respondWithResult(_0x44a708,null))[_0x403a('0x44')](handleError(_0x44a708,null));};exports[_0x403a('0x51')]=function(_0x52a66d,_0x56a1f5){return db[_0x403a('0x2b')][_0x403a('0x4d')]({'where':{'id':_0x52a66d[_0x403a('0x46')]['id']}})[_0x403a('0x22')](handleEntityNotFound(_0x56a1f5,null))[_0x403a('0x22')](removeEntity(_0x56a1f5,null))[_0x403a('0x44')](handleError(_0x56a1f5,null));};exports[_0x403a('0x52')]=function(_0x13262f,_0x4bac7e,_0x42d9c5){return db[_0x403a('0x2b')]['findOne']({'where':{'id':_0x13262f[_0x403a('0x46')]['id']}})[_0x403a('0x22')](handleEntityNotFound(_0x4bac7e,null))[_0x403a('0x22')](function(_0x1e6218){if(!_0x13262f['query']['channel']||!utils[_0x403a('0x53')](_0x13262f[_0x403a('0x30')][_0x403a('0x54')])){throw new db[(_0x403a('0x55'))][(_0x403a('0x56'))](_0x403a('0x57'));}var _0x32d261={};var _0x44fdfa={};_0x44fdfa[_0x403a('0x34')]=_['keys'](db[_[_0x403a('0x58')](_0x13262f[_0x403a('0x30')][_0x403a('0x54')]['toLowerCase']())+'Queue']['rawAttributes']);_0x44fdfa['query']=_[_0x403a('0x31')](_0x13262f[_0x403a('0x30')]);_0x44fdfa[_0x403a('0x32')]=_['intersection'](_0x44fdfa[_0x403a('0x34')],_0x44fdfa[_0x403a('0x30')]);_0x32d261[_0x403a('0x36')]=_['intersection'](_0x44fdfa[_0x403a('0x34')],qs[_0x403a('0x35')](_0x13262f['query'][_0x403a('0x35')]));_0x32d261['attributes']=_0x32d261['attributes'][_0x403a('0x37')]?_0x32d261[_0x403a('0x36')]:_0x44fdfa[_0x403a('0x34')];_0x32d261['limit']=qs[_0x403a('0x1c')](_0x13262f[_0x403a('0x30')][_0x403a('0x1c')]);_0x32d261[_0x403a('0x1a')]=qs[_0x403a('0x1a')](_0x13262f['query'][_0x403a('0x1a')]);_0x32d261['order']=qs[_0x403a('0x3a')](_0x13262f['query'][_0x403a('0x3a')]);_0x32d261[_0x403a('0x3b')]=qs[_0x403a('0x32')](_[_0x403a('0x3c')](_0x13262f[_0x403a('0x30')],_0x44fdfa[_0x403a('0x32')]));_0x32d261=_['merge']({},_0x32d261,_0x13262f['options']);return _0x1e6218[_0x403a('0x23')+_[_0x403a('0x58')](_0x13262f[_0x403a('0x30')]['channel'][_0x403a('0x59')]())+_0x403a('0x5a')](_0x32d261);})[_0x403a('0x22')](respondWithResult(_0x4bac7e,null))[_0x403a('0x44')](handleError(_0x4bac7e,null));};exports[_0x403a('0x5b')]=function(_0x94f1df,_0x163158,_0x244b4a){return db['Team'][_0x403a('0x5c')]({'where':{'id':_0x94f1df['params']['id']}})['then'](function(_0x37cfe8){if(_0x37cfe8){if(!_0x94f1df[_0x403a('0x49')]['channel']||!utils['isValidChannel'](_0x94f1df[_0x403a('0x49')][_0x403a('0x54')])){throw new db[(_0x403a('0x55'))][(_0x403a('0x56'))]('Unknown\x20channel');}return _0x37cfe8[_0x403a('0x5d')+_[_0x403a('0x58')](_0x94f1df[_0x403a('0x49')]['channel']['toLowerCase']())+_0x403a('0x5a')](_0x94f1df[_0x403a('0x49')][_0x403a('0x5e')]);}return null;})[_0x403a('0x22')](handleEntityNotFound(_0x163158,null))[_0x403a('0x22')](respondWithStatusCode(_0x163158,null))['catch'](handleError(_0x163158,null));};exports[_0x403a('0x5f')]=function(_0x4bf1fe,_0x342bc0,_0x5dc0cb){return db[_0x403a('0x2b')][_0x403a('0x5c')]({'where':{'id':_0x4bf1fe[_0x403a('0x46')]['id']}})['then'](function(_0x584071){if(_0x584071){if(!_0x4bf1fe[_0x403a('0x30')][_0x403a('0x54')]||!utils[_0x403a('0x53')](_0x4bf1fe[_0x403a('0x30')]['channel'])){throw new db[(_0x403a('0x55'))][(_0x403a('0x56'))](_0x403a('0x57'));}return _0x584071['remove'+_[_0x403a('0x58')](_0x4bf1fe[_0x403a('0x30')][_0x403a('0x54')][_0x403a('0x59')]())+_0x403a('0x5a')](_0x4bf1fe[_0x403a('0x30')][_0x403a('0x5e')]);}return null;})[_0x403a('0x22')](handleEntityNotFound(_0x342bc0,null))[_0x403a('0x22')](respondWithStatusCode(_0x342bc0,null))[_0x403a('0x44')](handleError(_0x342bc0,null));};exports[_0x403a('0x60')]=function(_0x4ed352,_0x25764b){return db[_0x403a('0x2b')][_0x403a('0x4d')]({'where':{'id':_0x4ed352[_0x403a('0x46')]['id']}})[_0x403a('0x22')](handleEntityNotFound(_0x25764b,null))[_0x403a('0x22')](function(_0x2aff74){if(_0x2aff74){var _0x2268e3=['Voice',_0x403a('0x61'),_0x403a('0x62'),_0x403a('0x63'),_0x403a('0x64'),'Openchannel',_0x403a('0x65')];return db[_0x403a('0x66')]['transaction'](function(_0x54657c){var _0x32b383=_['map'](_0x2268e3,function(_0x5e5a9b){var _0xe8d6ca={'attributes':['id',_0x403a('0x28')]};if(_0x5e5a9b===_0x403a('0x67')){_0xe8d6ca['through']={'attributes':['penalty']};}return _0x2aff74[_0x403a('0x23')+_0x5e5a9b+_0x403a('0x5a')](_0xe8d6ca)[_0x403a('0x22')](function(_0x43bf9e){var _0x4d0075=_[_0x403a('0x2a')](_0x43bf9e,function(_0x47233e){var _0x53116f=_[_0x403a('0x2a')](_0x4ed352[_0x403a('0x49')][_0x403a('0x5e')],function(_0x3c10ce){var _0x424da6={'where':{'UserId':_0x3c10ce,[_0x5e5a9b+_0x403a('0x68')]:_0x47233e['id']},'transaction':_0x54657c};if(_0x5e5a9b===_0x403a('0x67')){_0x424da6['defaults']={'penalty':_0x47233e[_0x403a('0x69')][_0x403a('0x6a')]};}return db[_0x403a('0x6b')+_0x5e5a9b+_0x403a('0x6c')]['findOrCreate'](_0x424da6)[_0x403a('0x22')](function(){socket[_0x403a('0x6d')](_0x403a('0x4a')+_0x5e5a9b+_0x403a('0x6e'),{'UserId':_0x3c10ce,[_0x5e5a9b+_0x403a('0x68')]:_0x47233e['id']});if(_0x5e5a9b!=='Voice')return;return db[_0x403a('0x6b')]['findAll']({'where':{'id':_0x4ed352[_0x403a('0x49')][_0x403a('0x5e')],'online':0x1},'attributes':['id',_0x403a('0x28'),_0x403a('0x6f'),_0x403a('0x70'),_0x403a('0x71')],'raw':!![]})[_0x403a('0x22')](function(_0x470550){var _0x4e47b1=_[_0x403a('0x2a')](_0x470550,function(_0x3c4279){return db[_0x403a('0x72')]['upsert']({'membername':_0x3c4279['name'],'UserId':_0x3c4279['id'],'queue_name':_0x47233e[_0x403a('0x28')],'VoiceQueueId':_0x47233e['id'],'interface':_[_0x403a('0x73')](_0x3c4279[_0x403a('0x71')])?util[_0x403a('0x74')](_0x403a('0x75'),_0x3c4279['name']):_0x3c4279[_0x403a('0x71')],'paused':_0x3c4279['voicePause']||![],'penalty':_0x47233e[_0x403a('0x69')]['penalty']},{'transaction':_0x54657c});});return Promise[_0x403a('0x76')](_0x4e47b1);});});});return Promise['all'](_0x53116f);});return Promise[_0x403a('0x76')](_0x4d0075);})[_0x403a('0x22')](function(){var _0x255fcb=JSON['parse']('['+_0x4ed352[_0x403a('0x49')][_0x403a('0x5e')]+']');db[_0x403a('0x77')][_0x403a('0x5c')]({'where':{'teamId':_0x4ed352['params']['id']}})[_0x403a('0x22')](function(_0x54c1b5){if(_0x54c1b5){for(var _0x437bfe=0x0;_0x437bfe<_0x255fcb[_0x403a('0x37')];_0x437bfe++){var _0x5dc65c=_0x255fcb[_0x437bfe];db[_0x403a('0x78')][_0x403a('0x79')]({'UserId':_0x5dc65c,'VoicePrefixId':_0x54c1b5[_0x403a('0x7a')]});}}});});});return Promise[_0x403a('0x76')](_0x32b383)[_0x403a('0x22')](function(){return _0x2aff74[_0x403a('0x60')](_0x4ed352[_0x403a('0x49')][_0x403a('0x5e')],{'transaction':_0x54657c})[_0x403a('0x7b')](function(_0x23bd57){return _0x23bd57;});});});}})[_0x403a('0x22')](respondWithResult(_0x25764b,null))[_0x403a('0x44')](handleError(_0x25764b,null));};exports[_0x403a('0x7c')]=function(_0x2a4907,_0x420247){return db['Team']['find']({'where':{'id':_0x2a4907[_0x403a('0x46')]['id']}})[_0x403a('0x22')](handleEntityNotFound(_0x420247,null))[_0x403a('0x22')](function(_0x31f0d5){if(_0x31f0d5){var _0x45626d=['Voice','Chat',_0x403a('0x62'),'Sms','Fax',_0x403a('0x7d'),_0x403a('0x65')];return db[_0x403a('0x66')][_0x403a('0x7e')](function(_0x4d4fcf){var _0xed3f4f=_[_0x403a('0x2a')](_0x45626d,function(_0x13c7c7){var _0x2a65c8={'attributes':['id',_0x403a('0x28')]};return _0x31f0d5['get'+_0x13c7c7+_0x403a('0x5a')](_0x2a65c8)[_0x403a('0x22')](function(_0x4bef97){var _0x41b5a6=_['map'](_0x4bef97,function(_0x6eb579){return _0x6eb579[_0x403a('0x7c')](_0x2a4907[_0x403a('0x30')][_0x403a('0x5e')],{'transaction':_0x4d4fcf})[_0x403a('0x22')](function(){var _0x3025b2=JSON[_0x403a('0x7f')]('['+_0x2a4907[_0x403a('0x30')][_0x403a('0x5e')]+']');var _0xc19002=_[_0x403a('0x2a')](_0x3025b2,function(_0x526aac){socket['emit'](_0x403a('0x4a')+_0x13c7c7+_0x403a('0x80'),{'UserId':Number(_0x526aac),[_0x13c7c7+_0x403a('0x68')]:_0x6eb579['id']});if(_0x13c7c7!==_0x403a('0x67'))return;return db[_0x403a('0x72')][_0x403a('0x51')]({'where':{'VoiceQueueId':_0x6eb579['id'],'UserId':_0x526aac},'transaction':_0x4d4fcf});});return Promise[_0x403a('0x76')](_0xc19002);});});return Promise[_0x403a('0x76')](_0x41b5a6);});});return Promise['all'](_0xed3f4f)[_0x403a('0x22')](function(){return _0x31f0d5['removeAgents'](_0x2a4907[_0x403a('0x30')][_0x403a('0x5e')],{'transaction':_0x4d4fcf});})[_0x403a('0x22')](function(){var _0x3ed69e=JSON['parse']('['+_0x2a4907['query'][_0x403a('0x5e')]+']');db[_0x403a('0x77')][_0x403a('0x5c')]({'where':{'teamId':_0x2a4907['params']['id']}})[_0x403a('0x22')](function(_0x5a0add){if(_0x5a0add){for(var _0x1ad0df=0x0;_0x1ad0df<_0x3ed69e[_0x403a('0x37')];_0x1ad0df++){var _0xdc82b1=_0x3ed69e[_0x1ad0df];db[_0x403a('0x78')][_0x403a('0x51')]({'where':{'UserId':_0xdc82b1,'VoicePrefixId':_0x5a0add['VoicePrefixId']}});}}});});});}})[_0x403a('0x22')](respondWithStatusCode(_0x420247,null))['catch'](handleError(_0x420247,null));};exports['getAgents']=function(_0x442e0a,_0x3c2433,_0x1ce09f){var _0x4fa4a4={};var _0x26fc91={};var _0x57a7fd;var _0x1e18af;return db[_0x403a('0x2b')][_0x403a('0x5c')]({'where':{'id':_0x442e0a['params']['id']}})[_0x403a('0x22')](handleEntityNotFound(_0x3c2433,null))[_0x403a('0x22')](function(_0x270e70){if(_0x270e70){_0x57a7fd=_0x270e70;_0x26fc91[_0x403a('0x34')]=_[_0x403a('0x31')](db[_0x403a('0x6b')][_0x403a('0x2c')]);_0x26fc91[_0x403a('0x30')]=_[_0x403a('0x31')](_0x442e0a[_0x403a('0x30')]);_0x26fc91[_0x403a('0x32')]=_['intersection'](_0x26fc91[_0x403a('0x34')],_0x26fc91[_0x403a('0x30')]);_0x4fa4a4[_0x403a('0x36')]=_[_0x403a('0x33')](_0x26fc91[_0x403a('0x34')],qs[_0x403a('0x35')](_0x442e0a[_0x403a('0x30')][_0x403a('0x35')]));_0x4fa4a4[_0x403a('0x36')]=_0x4fa4a4[_0x403a('0x36')][_0x403a('0x37')]?_0x4fa4a4[_0x403a('0x36')]:_0x26fc91[_0x403a('0x34')];_0x4fa4a4['order']=qs[_0x403a('0x3a')](_0x442e0a[_0x403a('0x30')][_0x403a('0x3a')]);_0x4fa4a4[_0x403a('0x3b')]=qs[_0x403a('0x32')](_[_0x403a('0x3c')](_0x442e0a[_0x403a('0x30')],_0x26fc91[_0x403a('0x32')]));if(_0x442e0a[_0x403a('0x30')][_0x403a('0x3f')]){_0x4fa4a4[_0x403a('0x3b')]=_[_0x403a('0x3d')](_0x4fa4a4[_0x403a('0x3b')],{'$or':_[_0x403a('0x2a')](_0x4fa4a4[_0x403a('0x36')],function(_0x2fbdce){var _0x4113a1={};_0x4113a1[_0x2fbdce]={'$like':'%'+_0x442e0a[_0x403a('0x30')][_0x403a('0x3f')]+'%'};return _0x4113a1;})});}_0x4fa4a4=_[_0x403a('0x3d')]({},_0x4fa4a4,_0x442e0a['options']);return _0x57a7fd[_0x403a('0x81')](_0x4fa4a4);}})[_0x403a('0x22')](function(_0x530b1f){if(_0x530b1f){_0x1e18af=_0x530b1f[_0x403a('0x37')];if(!_0x442e0a[_0x403a('0x30')]['hasOwnProperty'](_0x403a('0x82'))){_0x4fa4a4['limit']=qs[_0x403a('0x1c')](_0x442e0a[_0x403a('0x30')]['limit']);_0x4fa4a4[_0x403a('0x1a')]=qs['offset'](_0x442e0a[_0x403a('0x30')][_0x403a('0x1a')]);}return _0x57a7fd[_0x403a('0x81')](_0x4fa4a4);}})['then'](function(_0x2a1729){if(_0x2a1729){return _0x2a1729?{'count':_0x1e18af,'rows':_0x2a1729}:null;}})[_0x403a('0x22')](respondWithResult(_0x3c2433,null))[_0x403a('0x44')](handleError(_0x3c2433,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 139923c..6dbd792 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 _0xa485=['../../mysqldb','Team','save','update','remove','emit','hook'];(function(_0x2d2b8b,_0x3e684d){var _0xdd3434=function(_0x89464){while(--_0x89464){_0x2d2b8b['push'](_0x2d2b8b['shift']());}};_0xdd3434(++_0x3e684d);}(_0xa485,0x16c));var _0x5a48=function(_0x3af526,_0x13ba99){_0x3af526=_0x3af526-0x0;var _0xc6aac4=_0xa485[_0x3af526];return _0xc6aac4;};'use strict';var EventEmitter=require('events');var Team=require(_0x5a48('0x0'))['db'][_0x5a48('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5a48('0x2'),'afterUpdate':_0x5a48('0x3'),'afterDestroy':_0x5a48('0x4')};function emitEvent(_0x59159e){return function(_0x4c6ea7,_0xbca47c,_0x14022d){TeamEvents[_0x5a48('0x5')](_0x59159e+':'+_0x4c6ea7['id'],_0x4c6ea7);TeamEvents[_0x5a48('0x5')](_0x59159e,_0x4c6ea7);_0x14022d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x5a48('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xfdf4=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5f3edb,_0x5199d5){var _0x3a4bda=function(_0x311eda){while(--_0x311eda){_0x5f3edb['push'](_0x5f3edb['shift']());}};_0x3a4bda(++_0x5199d5);}(_0xfdf4,0xef));var _0x4fdf=function(_0x14c9e3,_0x4c7bd5){_0x14c9e3=_0x14c9e3-0x0;var _0x514c33=_0xfdf4[_0x14c9e3];return _0x514c33;};'use strict';var EventEmitter=require(_0x4fdf('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x4fdf('0x1')](0x0);var events={'afterCreate':_0x4fdf('0x2'),'afterUpdate':_0x4fdf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3553ca){return function(_0xfa49d7,_0x397fca,_0x5038d0){TeamEvents[_0x4fdf('0x4')](_0x3553ca+':'+_0xfa49d7['id'],_0xfa49d7);TeamEvents['emit'](_0x3553ca,_0xfa49d7);_0x5038d0(null);};}for(var e in events){if(events[_0x4fdf('0x5')](e)){var event=events[e];Team[_0x4fdf('0x6')](e,emitEvent(event));}}module[_0x4fdf('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7b10d39..3776b02 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 _0x7ec4=['Team','teams','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./team.attributes','exports','define'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x7ec4,0x195));var _0x47ec=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7ec4[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x47ec('0x0'));var logger=require(_0x47ec('0x1'))(_0x47ec('0x2'));var moment=require(_0x47ec('0x3'));var BPromise=require(_0x47ec('0x4'));var rp=require(_0x47ec('0x5'));var fs=require('fs');var path=require(_0x47ec('0x6'));var rimraf=require('rimraf');var config=require(_0x47ec('0x7'));var attributes=require(_0x47ec('0x8'));module[_0x47ec('0x9')]=function(_0x34cf36,_0x1cbe52){return _0x34cf36[_0x47ec('0xa')](_0x47ec('0xb'),attributes,{'tableName':_0x47ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85fb=['define','Team','teams','lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x18ba26,_0x4c142c){var _0x58ad0c=function(_0x872d4b){while(--_0x872d4b){_0x18ba26['push'](_0x18ba26['shift']());}};_0x58ad0c(++_0x4c142c);}(_0x85fb,0x137));var _0xb85f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x85fb[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xb85f('0x0'));var util=require(_0xb85f('0x1'));var logger=require('../../config/logger')(_0xb85f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb85f('0x3'));var fs=require('fs');var path=require(_0xb85f('0x4'));var rimraf=require(_0xb85f('0x5'));var config=require(_0xb85f('0x6'));var attributes=require('./team.attributes');module[_0xb85f('0x7')]=function(_0x684463,_0x593062){return _0x684463[_0xb85f('0x8')](_0xb85f('0x9'),attributes,{'tableName':_0xb85f('0xa'),'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 2843413..b8bba57 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 _0xd2f0=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','util','moment','bluebird'];(function(_0x277fcf,_0x1952c6){var _0x3dcfc6=function(_0x5d2188){while(--_0x5d2188){_0x277fcf['push'](_0x277fcf['shift']());}};_0x3dcfc6(++_0x1952c6);}(_0xd2f0,0x183));var _0x0d2f=function(_0x4043be,_0x4ed1bc){_0x4043be=_0x4043be-0x0;var _0x23ad02=_0xd2f0[_0x4043be];return _0x23ad02;};'use strict';var _=require('lodash');var util=require(_0x0d2f('0x0'));var moment=require(_0x0d2f('0x1'));var BPromise=require(_0x0d2f('0x2'));var rs=require(_0x0d2f('0x3'));var fs=require('fs');var Redis=require(_0x0d2f('0x4'));var db=require(_0x0d2f('0x5'))['db'];var utils=require(_0x0d2f('0x6'));var logger=require(_0x0d2f('0x7'))(_0x0d2f('0x8'));var config=require(_0x0d2f('0x9'));var jayson=require(_0x0d2f('0xa'));var client=jayson[_0x0d2f('0xb')]['http']({'port':0x232a});config[_0x0d2f('0xc')]=_[_0x0d2f('0xd')](config[_0x0d2f('0xc')],{'host':_0x0d2f('0xe'),'port':0x18eb});var socket=require(_0x0d2f('0xf'))(new Redis(config['redis']));require('./team.socket')[_0x0d2f('0x10')](socket);function respondWithRpcPromise(_0x446daa,_0x34bab1,_0x156e79){return new BPromise(function(_0x1e3f24,_0x1f7e48){return client['request'](_0x446daa,_0x156e79)[_0x0d2f('0x11')](function(_0x53011d){logger['info'](_0x0d2f('0x12'),_0x34bab1,_0x0d2f('0x13'));logger[_0x0d2f('0x14')](_0x0d2f('0x15'),_0x34bab1,_0x0d2f('0x13'),JSON[_0x0d2f('0x16')](_0x53011d));if(_0x53011d[_0x0d2f('0x17')]){if(_0x53011d[_0x0d2f('0x17')]['code']===0x1f4){logger[_0x0d2f('0x17')]('Team,\x20%s,\x20%s',_0x34bab1,_0x53011d['error']['message']);return _0x1f7e48(_0x53011d['error'][_0x0d2f('0x18')]);}logger['error'](_0x0d2f('0x12'),_0x34bab1,_0x53011d[_0x0d2f('0x17')]['message']);return _0x1e3f24(_0x53011d[_0x0d2f('0x17')][_0x0d2f('0x18')]);}else{logger[_0x0d2f('0x19')](_0x0d2f('0x12'),_0x34bab1,_0x0d2f('0x13'));_0x1e3f24(_0x53011d['result'][_0x0d2f('0x18')]);}})['catch'](function(_0x57e8ff){logger[_0x0d2f('0x17')](_0x0d2f('0x12'),_0x34bab1,_0x57e8ff);_0x1f7e48(_0x57e8ff);});});} \ No newline at end of file +var _0x7129=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result'];(function(_0x2cefa7,_0x3b2163){var _0x1b3c67=function(_0x1c4662){while(--_0x1c4662){_0x2cefa7['push'](_0x2cefa7['shift']());}};_0x1b3c67(++_0x3b2163);}(_0x7129,0x1e1));var _0x9712=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7129[_0x432682];return _0x463d05;};'use strict';var _=require(_0x9712('0x0'));var util=require(_0x9712('0x1'));var moment=require(_0x9712('0x2'));var BPromise=require('bluebird');var rs=require(_0x9712('0x3'));var fs=require('fs');var Redis=require(_0x9712('0x4'));var db=require(_0x9712('0x5'))['db'];var utils=require(_0x9712('0x6'));var logger=require(_0x9712('0x7'))('rpc');var config=require(_0x9712('0x8'));var jayson=require(_0x9712('0x9'));var client=jayson[_0x9712('0xa')][_0x9712('0xb')]({'port':0x232a});config[_0x9712('0xc')]=_[_0x9712('0xd')](config['redis'],{'host':_0x9712('0xe'),'port':0x18eb});var socket=require(_0x9712('0xf'))(new Redis(config[_0x9712('0xc')]));require(_0x9712('0x10'))['register'](socket);function respondWithRpcPromise(_0x324462,_0x54bd14,_0x4e46c2){return new BPromise(function(_0x5aa5b0,_0x41cb42){return client[_0x9712('0x11')](_0x324462,_0x4e46c2)[_0x9712('0x12')](function(_0x2d42cb){logger[_0x9712('0x13')]('Team,\x20%s,\x20%s',_0x54bd14,_0x9712('0x14'));logger[_0x9712('0x15')](_0x9712('0x16'),_0x54bd14,_0x9712('0x14'),JSON[_0x9712('0x17')](_0x2d42cb));if(_0x2d42cb[_0x9712('0x18')]){if(_0x2d42cb[_0x9712('0x18')][_0x9712('0x19')]===0x1f4){logger[_0x9712('0x18')]('Team,\x20%s,\x20%s',_0x54bd14,_0x2d42cb['error']['message']);return _0x41cb42(_0x2d42cb[_0x9712('0x18')]['message']);}logger[_0x9712('0x18')](_0x9712('0x1a'),_0x54bd14,_0x2d42cb[_0x9712('0x18')][_0x9712('0x1b')]);return _0x5aa5b0(_0x2d42cb[_0x9712('0x18')][_0x9712('0x1b')]);}else{logger[_0x9712('0x13')](_0x9712('0x1a'),_0x54bd14,_0x9712('0x14'));_0x5aa5b0(_0x2d42cb[_0x9712('0x1c')][_0x9712('0x1b')]);}})[_0x9712('0x1d')](function(_0x25f7bc){logger[_0x9712('0x18')](_0x9712('0x1a'),_0x54bd14,_0x25f7bc);_0x41cb42(_0x25f7bc);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 90de5e7..132a474 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 _0xd9cc=['removeListener','register','length','team:','./team.events','save','remove','update','emit'];(function(_0x95c3ae,_0x56cb1c){var _0x4666df=function(_0x3d2d99){while(--_0x3d2d99){_0x95c3ae['push'](_0x95c3ae['shift']());}};_0x4666df(++_0x56cb1c);}(_0xd9cc,0x1e1));var _0xcd9c=function(_0x57e55e,_0xd865e3){_0x57e55e=_0x57e55e-0x0;var _0xb6d605=_0xd9cc[_0x57e55e];return _0xb6d605;};'use strict';var TeamEvents=require(_0xcd9c('0x0'));var events=[_0xcd9c('0x1'),_0xcd9c('0x2'),_0xcd9c('0x3')];function createListener(_0x458156,_0x54cd2e){return function(_0x16969e){_0x54cd2e[_0xcd9c('0x4')](_0x458156,_0x16969e);};}function removeListener(_0x1e3b15,_0x4e41cc){return function(){TeamEvents[_0xcd9c('0x5')](_0x1e3b15,_0x4e41cc);};}exports[_0xcd9c('0x6')]=function(_0x522a45){for(var _0x11ea60=0x0,_0x2a9c7a=events[_0xcd9c('0x7')];_0x11ea60<_0x2a9c7a;_0x11ea60++){var _0x245c95=events[_0x11ea60];var _0x598a78=createListener(_0xcd9c('0x8')+_0x245c95,_0x522a45);TeamEvents['on'](_0x245c95,_0x598a78);}}; \ No newline at end of file +var _0x6c05=['length','team:','./team.events','save','remove','emit','removeListener'];(function(_0x2e9a95,_0x268041){var _0x5c801b=function(_0x10a414){while(--_0x10a414){_0x2e9a95['push'](_0x2e9a95['shift']());}};_0x5c801b(++_0x268041);}(_0x6c05,0x64));var _0x56c0=function(_0x84b4a2,_0x4d5873){_0x84b4a2=_0x84b4a2-0x0;var _0x2827d0=_0x6c05[_0x84b4a2];return _0x2827d0;};'use strict';var TeamEvents=require(_0x56c0('0x0'));var events=[_0x56c0('0x1'),_0x56c0('0x2'),'update'];function createListener(_0x533ecb,_0x2eabeb){return function(_0x7b6730){_0x2eabeb[_0x56c0('0x3')](_0x533ecb,_0x7b6730);};}function removeListener(_0x31f4ca,_0x136e49){return function(){TeamEvents[_0x56c0('0x4')](_0x31f4ca,_0x136e49);};}exports['register']=function(_0x56f7b0){for(var _0x48711b=0x0,_0x230af0=events[_0x56c0('0x5')];_0x48711b<_0x230af0;_0x48711b++){var _0x30bef4=events[_0x48711b];var _0x63c369=createListener(_0x56c0('0x6')+_0x30bef4,_0x56f7b0);TeamEvents['on'](_0x30bef4,_0x63c369);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/index.js b/server/api/teamVoicePrefix/index.js index 81f4016..912087d 100644 --- a/server/api/teamVoicePrefix/index.js +++ b/server/api/teamVoicePrefix/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(_0x5b4915,_0x336b69){var _0x4eaaca=function(_0x5e9047){while(--_0x5e9047){_0x5b4915['push'](_0x5b4915['shift']());}};_0x4eaaca(++_0x336b69);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1bf83e,_0x5f5630){var _0x1d0e7f=function(_0x5d042d){while(--_0x5d042d){_0x1bf83e['push'](_0x1bf83e['shift']());}};_0x1d0e7f(++_0x5f5630);}(_0x70e0,0x17b));var _0x070e=function(_0x2d7282,_0x639660){_0x2d7282=_0x2d7282-0x0;var _0xdea8b2=_0x70e0[_0x2d7282];return _0xdea8b2;};'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/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 03d783c..b5c9395 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73b3=['sequelize','exports','INTEGER'];(function(_0x41c067,_0x12a21d){var _0x4779cc=function(_0x1b7a29){while(--_0x1b7a29){_0x41c067['push'](_0x41c067['shift']());}};_0x4779cc(++_0x12a21d);}(_0x73b3,0x183));var _0x373b=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x73b3[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x373b('0x0'));module[_0x373b('0x1')]={'TeamId':{'type':Sequelize[_0x373b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x373b('0x2')]}}; \ No newline at end of file +var _0xd8ea=['INTEGER','sequelize','exports'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0xd8ea,0x1bd));var _0xad8e=function(_0x32b7f4,_0x337767){_0x32b7f4=_0x32b7f4-0x0;var _0x4cba1b=_0xd8ea[_0x32b7f4];return _0x4cba1b;};'use strict';var Sequelize=require(_0xad8e('0x0'));module[_0xad8e('0x1')]={'TeamId':{'type':Sequelize[_0xad8e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xad8e('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 744a730..ecd00e8 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa5e=['moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api'];(function(_0x5ebb4f,_0x713eda){var _0x46b957=function(_0x39b993){while(--_0x39b993){_0x5ebb4f['push'](_0x5ebb4f['shift']());}};_0x46b957(++_0x713eda);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x2100a6,_0x317d0c){_0x2100a6=_0x2100a6-0x0;var _0x6f1ff2=_0xaa5e[_0x2100a6];return _0x6f1ff2;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var logger=require('../../config/logger')(_0xeaa5('0x2'));var moment=require(_0xeaa5('0x3'));var BPromise=require(_0xeaa5('0x4'));var rp=require(_0xeaa5('0x5'));var fs=require('fs');var path=require(_0xeaa5('0x6'));var rimraf=require('rimraf');var config=require(_0xeaa5('0x7'));var attributes=require(_0xeaa5('0x8'));module[_0xeaa5('0x9')]=function(_0x382868,_0x553f20){return _0x382868['define'](_0xeaa5('0xa'),attributes,{'tableName':_0xeaa5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b65=['api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger'];(function(_0x50ced9,_0x547b6d){var _0x3d051f=function(_0x2cde6e){while(--_0x2cde6e){_0x50ced9['push'](_0x50ced9['shift']());}};_0x3d051f(++_0x547b6d);}(_0x2b65,0x131));var _0x52b6=function(_0x2f0b82,_0xa07e26){_0x2f0b82=_0x2f0b82-0x0;var _0x5d6fb1=_0x2b65[_0x2f0b82];return _0x5d6fb1;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var logger=require(_0x52b6('0x2'))(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var BPromise=require(_0x52b6('0x5'));var rp=require(_0x52b6('0x6'));var fs=require('fs');var path=require(_0x52b6('0x7'));var rimraf=require('rimraf');var config=require(_0x52b6('0x8'));var attributes=require(_0x52b6('0x9'));module[_0x52b6('0xa')]=function(_0x2c643d,_0x25593f){return _0x2c643d[_0x52b6('0xb')](_0x52b6('0xc'),attributes,{'tableName':_0x52b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js index a9344e4..fec726e 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c7b=['info','request\x20sent','stringify','error','code','message','TeamVoicePrefix,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x4c73a7,_0x503ee4){var _0x15826d=function(_0x1db5f6){while(--_0x1db5f6){_0x4c73a7['push'](_0x4c73a7['shift']());}};_0x15826d(++_0x503ee4);}(_0x2c7b,0x12e));var _0xb2c7=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2c7b[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xb2c7('0x0'));var util=require('util');var moment=require(_0xb2c7('0x1'));var BPromise=require(_0xb2c7('0x2'));var rs=require(_0xb2c7('0x3'));var fs=require('fs');var Redis=require(_0xb2c7('0x4'));var db=require(_0xb2c7('0x5'))['db'];var utils=require(_0xb2c7('0x6'));var logger=require(_0xb2c7('0x7'))(_0xb2c7('0x8'));var config=require(_0xb2c7('0x9'));var jayson=require(_0xb2c7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x198e43,_0x1321e1,_0x2de35e){return new BPromise(function(_0x1f00ef,_0x449175){return client[_0xb2c7('0xb')](_0x198e43,_0x2de35e)[_0xb2c7('0xc')](function(_0x536d1f){logger[_0xb2c7('0xd')]('TeamVoicePrefix,\x20%s,\x20%s',_0x1321e1,'request\x20sent');logger['debug']('TeamVoicePrefix,\x20%s,\x20%s,\x20%s',_0x1321e1,_0xb2c7('0xe'),JSON[_0xb2c7('0xf')](_0x536d1f));if(_0x536d1f[_0xb2c7('0x10')]){if(_0x536d1f[_0xb2c7('0x10')][_0xb2c7('0x11')]===0x1f4){logger[_0xb2c7('0x10')]('TeamVoicePrefix,\x20%s,\x20%s',_0x1321e1,_0x536d1f[_0xb2c7('0x10')]['message']);return _0x449175(_0x536d1f[_0xb2c7('0x10')][_0xb2c7('0x12')]);}logger[_0xb2c7('0x10')](_0xb2c7('0x13'),_0x1321e1,_0x536d1f['error']['message']);return _0x1f00ef(_0x536d1f[_0xb2c7('0x10')][_0xb2c7('0x12')]);}else{logger['info'](_0xb2c7('0x13'),_0x1321e1,'request\x20sent');_0x1f00ef(_0x536d1f[_0xb2c7('0x14')][_0xb2c7('0x12')]);}})['catch'](function(_0x273a87){logger['error'](_0xb2c7('0x13'),_0x1321e1,_0x273a87);_0x449175(_0x273a87);});});} \ No newline at end of file +var _0x29ef=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoicePrefix,\x20%s,\x20%s','message'];(function(_0x5cbd93,_0x41ae35){var _0x57a908=function(_0x2c2b4c){while(--_0x2c2b4c){_0x5cbd93['push'](_0x5cbd93['shift']());}};_0x57a908(++_0x41ae35);}(_0x29ef,0x98));var _0xf29e=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x29ef[_0x16db8b];return _0x5ba017;};'use strict';var _=require(_0xf29e('0x0'));var util=require(_0xf29e('0x1'));var moment=require(_0xf29e('0x2'));var BPromise=require(_0xf29e('0x3'));var rs=require(_0xf29e('0x4'));var fs=require('fs');var Redis=require(_0xf29e('0x5'));var db=require(_0xf29e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf29e('0x7'))(_0xf29e('0x8'));var config=require(_0xf29e('0x9'));var jayson=require(_0xf29e('0xa'));var client=jayson[_0xf29e('0xb')][_0xf29e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a5337,_0x69c179,_0x44996f){return new BPromise(function(_0x3a6a1b,_0x289a66){return client[_0xf29e('0xd')](_0x2a5337,_0x44996f)[_0xf29e('0xe')](function(_0x4071fa){logger['info']('TeamVoicePrefix,\x20%s,\x20%s',_0x69c179,_0xf29e('0xf'));logger[_0xf29e('0x10')](_0xf29e('0x11'),_0x69c179,_0xf29e('0xf'),JSON[_0xf29e('0x12')](_0x4071fa));if(_0x4071fa['error']){if(_0x4071fa[_0xf29e('0x13')][_0xf29e('0x14')]===0x1f4){logger[_0xf29e('0x13')](_0xf29e('0x15'),_0x69c179,_0x4071fa[_0xf29e('0x13')]['message']);return _0x289a66(_0x4071fa['error'][_0xf29e('0x16')]);}logger[_0xf29e('0x13')]('TeamVoicePrefix,\x20%s,\x20%s',_0x69c179,_0x4071fa[_0xf29e('0x13')][_0xf29e('0x16')]);return _0x3a6a1b(_0x4071fa[_0xf29e('0x13')][_0xf29e('0x16')]);}else{logger['info'](_0xf29e('0x15'),_0x69c179,_0xf29e('0xf'));_0x3a6a1b(_0x4071fa[_0xf29e('0x17')][_0xf29e('0x16')]);}})[_0xf29e('0x18')](function(_0x56ad28){logger[_0xf29e('0x13')](_0xf29e('0x15'),_0x69c179,_0x56ad28);_0x289a66(_0x56ad28);});});} \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index f2921ec..5abb313 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x956822,_0x6f2498){var _0x340e96=function(_0x5f5aee){while(--_0x5f5aee){_0x956822['push'](_0x956822['shift']());}};_0x340e96(++_0x6f2498);}(_0xe706,0xa3));var _0x6e70=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0xe706[_0x441eab];return _0xe6ff41;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3c5503,_0x2b568d){var _0x5571a6=function(_0x4ee147){while(--_0x4ee147){_0x3c5503['push'](_0x3c5503['shift']());}};_0x5571a6(++_0x2b568d);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1f1e568..2d1bb88 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 _0xe2bb=['INTEGER','sequelize'];(function(_0x51b5a6,_0x1a6077){var _0x4e6728=function(_0x33003c){while(--_0x33003c){_0x51b5a6['push'](_0x51b5a6['shift']());}};_0x4e6728(++_0x1a6077);}(_0xe2bb,0x13d));var _0xbe2b=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe2bb[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xbe2b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbe2b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1473=['sequelize','exports','INTEGER'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x1473,0x1ef));var _0x3147=function(_0x5dfadb,_0x28d7cc){_0x5dfadb=_0x5dfadb-0x0;var _0x41fc45=_0x1473[_0x5dfadb];return _0x41fc45;};'use strict';var Sequelize=require(_0x3147('0x0'));module[_0x3147('0x1')]={'penalty':{'type':Sequelize[_0x3147('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 1f19306..d4cae91 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 _0xfd2f=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue'];(function(_0x1cca2e,_0x9ee7af){var _0x4d3a73=function(_0x572b63){while(--_0x572b63){_0x1cca2e['push'](_0x1cca2e['shift']());}};_0x4d3a73(++_0x9ee7af);}(_0xfd2f,0x14a));var _0xffd2=function(_0xaf06da,_0xa953b){_0xaf06da=_0xaf06da-0x0;var _0x5548ef=_0xfd2f[_0xaf06da];return _0x5548ef;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fs=require('fs');var path=require(_0xffd2('0x5'));var rimraf=require('rimraf');var config=require(_0xffd2('0x6'));var attributes=require(_0xffd2('0x7'));module['exports']=function(_0x5955d2,_0x490a28){return _0x5955d2[_0xffd2('0x8')](_0xffd2('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd2f=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue'];(function(_0x344856,_0x35543d){var _0xd5ccb1=function(_0x4e4d37){while(--_0x4e4d37){_0x344856['push'](_0x344856['shift']());}};_0xd5ccb1(++_0x35543d);}(_0xfd2f,0x14a));var _0xffd2=function(_0x23f702,_0x15e733){_0x23f702=_0x23f702-0x0;var _0x3e20f1=_0xfd2f[_0x23f702];return _0x3e20f1;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fs=require('fs');var path=require(_0xffd2('0x5'));var rimraf=require('rimraf');var config=require(_0xffd2('0x6'));var attributes=require(_0xffd2('0x7'));module['exports']=function(_0x5955d2,_0x490a28){return _0x5955d2[_0xffd2('0x8')](_0xffd2('0x9'),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 550cebe..3217096 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 _0x2259=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2259,0x17c));var _0x9225=function(_0x2a0eae,_0x38428f){_0x2a0eae=_0x2a0eae-0x0;var _0x40227b=_0x2259[_0x2a0eae];return _0x40227b;};'use strict';var _=require(_0x9225('0x0'));var util=require(_0x9225('0x1'));var moment=require(_0x9225('0x2'));var BPromise=require(_0x9225('0x3'));var rs=require(_0x9225('0x4'));var fs=require('fs');var Redis=require(_0x9225('0x5'));var db=require(_0x9225('0x6'))['db'];var utils=require(_0x9225('0x7'));var logger=require('../../config/logger')(_0x9225('0x8'));var config=require(_0x9225('0x9'));var jayson=require(_0x9225('0xa'));var client=jayson[_0x9225('0xb')][_0x9225('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36bd31,_0x14d943,_0x46b110){return new BPromise(function(_0x238484,_0x17f6ea){return client[_0x9225('0xd')](_0x36bd31,_0x46b110)[_0x9225('0xe')](function(_0x49bdef){logger[_0x9225('0xf')](_0x9225('0x10'),_0x14d943,_0x9225('0x11'));logger[_0x9225('0x12')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x14d943,'request\x20sent',JSON['stringify'](_0x49bdef));if(_0x49bdef[_0x9225('0x13')]){if(_0x49bdef['error'][_0x9225('0x14')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x14d943,_0x49bdef[_0x9225('0x13')]['message']);return _0x17f6ea(_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);}logger['error'](_0x9225('0x10'),_0x14d943,_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);return _0x238484(_0x49bdef[_0x9225('0x13')][_0x9225('0x15')]);}else{logger['info'](_0x9225('0x10'),_0x14d943,_0x9225('0x11'));_0x238484(_0x49bdef[_0x9225('0x16')][_0x9225('0x15')]);}})[_0x9225('0x17')](function(_0x4c385d){logger[_0x9225('0x13')](_0x9225('0x10'),_0x14d943,_0x4c385d);_0x17f6ea(_0x4c385d);});});} \ No newline at end of file +var _0x4b8a=['info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x360b3b,_0x5fc470){var _0x44b6db=function(_0x7d4e6a){while(--_0x7d4e6a){_0x360b3b['push'](_0x360b3b['shift']());}};_0x44b6db(++_0x5fc470);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4b8a[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xa4b8('0x0'));var moment=require('moment');var BPromise=require(_0xa4b8('0x1'));var rs=require(_0xa4b8('0x2'));var fs=require('fs');var Redis=require(_0xa4b8('0x3'));var db=require(_0xa4b8('0x4'))['db'];var utils=require(_0xa4b8('0x5'));var logger=require(_0xa4b8('0x6'))(_0xa4b8('0x7'));var config=require(_0xa4b8('0x8'));var jayson=require(_0xa4b8('0x9'));var client=jayson[_0xa4b8('0xa')][_0xa4b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2de84d,_0x455722,_0x1fea78){return new BPromise(function(_0x517970,_0x4632f3){return client[_0xa4b8('0xc')](_0x2de84d,_0x1fea78)[_0xa4b8('0xd')](function(_0x3fe4ed){logger[_0xa4b8('0xe')](_0xa4b8('0xf'),_0x455722,_0xa4b8('0x10'));logger[_0xa4b8('0x11')](_0xa4b8('0x12'),_0x455722,_0xa4b8('0x10'),JSON[_0xa4b8('0x13')](_0x3fe4ed));if(_0x3fe4ed[_0xa4b8('0x14')]){if(_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x15')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x455722,_0x3fe4ed[_0xa4b8('0x14')]['message']);return _0x4632f3(_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x16')]);}logger['error'](_0xa4b8('0xf'),_0x455722,_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x16')]);return _0x517970(_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x16')]);}else{logger[_0xa4b8('0xe')](_0xa4b8('0xf'),_0x455722,_0xa4b8('0x10'));_0x517970(_0x3fe4ed[_0xa4b8('0x17')]['message']);}})[_0xa4b8('0x18')](function(_0x3c8ebb){logger['error'](_0xa4b8('0xf'),_0x455722,_0x3c8ebb);_0x4632f3(_0x3c8ebb);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 23d153d..d1c41f3 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 _0x341c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x25173f,_0x4f4574){var _0x4682a=function(_0x28b845){while(--_0x28b845){_0x25173f['push'](_0x25173f['shift']());}};_0x4682a(++_0x4f4574);}(_0x341c,0xcc));var _0xc341=function(_0x5754c1,_0x564a97){_0x5754c1=_0x5754c1-0x0;var _0x242cef=_0x341c[_0x5754c1];return _0x242cef;};'use strict';var multer=require(_0xc341('0x0'));var util=require('util');var path=require(_0xc341('0x1'));var timeout=require('connect-timeout');var express=require(_0xc341('0x2'));var router=express[_0xc341('0x3')]();var fs_extra=require(_0xc341('0x4'));var auth=require(_0xc341('0x5'));var interaction=require(_0xc341('0x6'));var config=require(_0xc341('0x7'));var controller=require(_0xc341('0x8'));router[_0xc341('0x9')]('/',auth['isAuthenticated'](),controller[_0xc341('0xa')]);router[_0xc341('0x9')](_0xc341('0xb'),auth[_0xc341('0xc')](),controller[_0xc341('0xd')]);router['post']('/',auth[_0xc341('0xc')](),controller[_0xc341('0xe')]);router[_0xc341('0xf')](_0xc341('0xb'),auth[_0xc341('0xc')](),controller[_0xc341('0x10')]);router['delete'](_0xc341('0xb'),auth[_0xc341('0xc')](),controller[_0xc341('0x11')]);module[_0xc341('0x12')]=router; \ No newline at end of file +var _0x1ab1=['multer','connect-timeout','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x1ab1,0x12c));var _0x11ab=function(_0x4d8f24,_0x3cbc35){_0x4d8f24=_0x4d8f24-0x0;var _0x5c9a94=_0x1ab1[_0x4d8f24];return _0x5c9a94;};'use strict';var multer=require(_0x11ab('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x11ab('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x11ab('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x11ab('0x3'));var controller=require(_0x11ab('0x4'));router[_0x11ab('0x5')]('/',auth[_0x11ab('0x6')](),controller['index']);router[_0x11ab('0x5')](_0x11ab('0x7'),auth[_0x11ab('0x6')](),controller[_0x11ab('0x8')]);router[_0x11ab('0x9')]('/',auth[_0x11ab('0x6')](),controller['create']);router[_0x11ab('0xa')]('/:id',auth[_0x11ab('0x6')](),controller[_0x11ab('0xb')]);router[_0x11ab('0xc')](_0x11ab('0x7'),auth['isAuthenticated'](),controller[_0x11ab('0xd')]);module[_0x11ab('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0bbc3e7..d13f976 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 _0x5f38=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f38,0x117));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x85f3('0x0'));module[_0x85f3('0x1')]={'name':{'type':Sequelize[_0x85f3('0x2')]},'description':{'type':Sequelize[_0x85f3('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xaf1b=['sequelize','exports','STRING','TEXT'];(function(_0x4d19cb,_0x562f2d){var _0x1863aa=function(_0x2728be){while(--_0x2728be){_0x4d19cb['push'](_0x4d19cb['shift']());}};_0x1863aa(++_0x562f2d);}(_0xaf1b,0x7c));var _0xbaf1=function(_0x532398,_0x468dc2){_0x532398=_0x532398-0x0;var _0x2fbda9=_0xaf1b[_0x532398];return _0x2fbda9;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xbaf1('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a8849c8..03327c7 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 _0x58ee=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','Template','includeAll','include','findAll','rows','show','params','find','catch','create'];(function(_0x37419f,_0x147568){var _0xcb2509=function(_0x578757){while(--_0x578757){_0x37419f['push'](_0x37419f['shift']());}};_0xcb2509(++_0x147568);}(_0x58ee,0x161));var _0xe58e=function(_0x545173,_0x2335d3){_0x545173=_0x545173-0x0;var _0x1a3479=_0x58ee[_0x545173];return _0x1a3479;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe58e('0x0'));var zipdir=require(_0xe58e('0x1'));var jsonpatch=require(_0xe58e('0x2'));var rp=require(_0xe58e('0x3'));var moment=require('moment');var BPromise=require(_0xe58e('0x4'));var Mustache=require(_0xe58e('0x5'));var util=require(_0xe58e('0x6'));var path=require(_0xe58e('0x7'));var sox=require(_0xe58e('0x8'));var csv=require(_0xe58e('0x9'));var ejs=require(_0xe58e('0xa'));var fs=require('fs');var fs_extra=require(_0xe58e('0xb'));var _=require(_0xe58e('0xc'));var squel=require(_0xe58e('0xd'));var crypto=require(_0xe58e('0xe'));var jsforce=require(_0xe58e('0xf'));var deskjs=require(_0xe58e('0x10'));var toCsv=require(_0xe58e('0x9'));var querystring=require(_0xe58e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe58e('0x12'));var as=require(_0xe58e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe58e('0x14'))(_0xe58e('0x15'));var utils=require('../../config/utils');var config=require(_0xe58e('0x16'));var licenseUtil=require(_0xe58e('0x17'));var db=require(_0xe58e('0x18'))['db'];function respondWithStatusCode(_0x3c015f,_0x2ed546){_0x2ed546=_0x2ed546||0xcc;return function(_0x56d5cb){if(_0x56d5cb){return _0x3c015f[_0xe58e('0x19')](_0x2ed546);}return _0x3c015f[_0xe58e('0x1a')](_0x2ed546)['end']();};}function respondWithResult(_0xb34255,_0x24fafc){_0x24fafc=_0x24fafc||0xc8;return function(_0x260766){if(_0x260766){return _0xb34255[_0xe58e('0x1a')](_0x24fafc)['json'](_0x260766);}};}function respondWithFilteredResult(_0x1287b8,_0x53a635){return function(_0x39c66b){if(_0x39c66b){var _0x5b1f48=typeof _0x53a635[_0xe58e('0x1b')]===_0xe58e('0x1c')&&typeof _0x53a635['limit']===_0xe58e('0x1c');var _0x18701f=_0x39c66b['count'];var _0x4e3558=_0x5b1f48?0x0:_0x53a635[_0xe58e('0x1b')];var _0x330f99=_0x5b1f48?_0x39c66b[_0xe58e('0x1d')]:_0x53a635['offset']+_0x53a635[_0xe58e('0x1e')];var _0x13abd2;if(_0x330f99>=_0x18701f){_0x330f99=_0x18701f;_0x13abd2=0xc8;}else{_0x13abd2=0xce;}_0x1287b8[_0xe58e('0x1a')](_0x13abd2);return _0x1287b8[_0xe58e('0x1f')](_0xe58e('0x20'),_0x4e3558+'-'+_0x330f99+'/'+_0x18701f)[_0xe58e('0x21')](_0x39c66b);}return null;};}function patchUpdates(_0x44e95d){return function(_0x44899c){try{jsonpatch[_0xe58e('0x22')](_0x44899c,_0x44e95d,!![]);}catch(_0x1d6de0){return BPromise[_0xe58e('0x23')](_0x1d6de0);}return _0x44899c['save']();};}function saveUpdates(_0x1e4708,_0x519b87){return function(_0x3bb0fa){if(_0x3bb0fa){return _0x3bb0fa[_0xe58e('0x24')](_0x1e4708)[_0xe58e('0x25')](function(_0x41c15e){return _0x41c15e;});}return null;};}function removeEntity(_0x3e1ec7,_0x401797){return function(_0x12e50a){if(_0x12e50a){return _0x12e50a['destroy']()[_0xe58e('0x25')](function(){var _0x262b0d=_0x12e50a[_0xe58e('0x26')]({'plain':!![]});var _0x2cff49='Templates';return db[_0xe58e('0x27')][_0xe58e('0x28')]({'where':{'type':_0x2cff49,'resourceId':_0x262b0d['id']}})[_0xe58e('0x25')](function(){return _0x12e50a;});})[_0xe58e('0x25')](function(){_0x3e1ec7[_0xe58e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35776d,_0x44bffc){return function(_0x224c4b){if(!_0x224c4b){_0x35776d['sendStatus'](0x194);}return _0x224c4b;};}function handleError(_0x3837f1,_0x443523){_0x443523=_0x443523||0x1f4;return function(_0x2fea09){logger['error'](_0x2fea09[_0xe58e('0x29')]);if(_0x2fea09[_0xe58e('0x2a')]){delete _0x2fea09[_0xe58e('0x2a')];}_0x3837f1['status'](_0x443523)[_0xe58e('0x2b')](_0x2fea09);};}exports[_0xe58e('0x2c')]=function(_0x464bdc,_0x25a8b7){var _0x3ca07e={},_0x2b11aa={},_0x3e86a9={'count':0x0,'rows':[]};var _0x5e1fc4=_[_0xe58e('0x2d')](db['Template'][_0xe58e('0x2e')],function(_0x44b68f){return{'name':_0x44b68f[_0xe58e('0x2f')],'type':_0x44b68f[_0xe58e('0x30')][_0xe58e('0x31')]};});_0x2b11aa['model']=_['map'](_0x5e1fc4,_0xe58e('0x2a'));_0x2b11aa[_0xe58e('0x32')]=_[_0xe58e('0x33')](_0x464bdc['query']);_0x2b11aa[_0xe58e('0x34')]=_[_0xe58e('0x35')](_0x2b11aa[_0xe58e('0x36')],_0x2b11aa['query']);_0x3ca07e[_0xe58e('0x37')]=_['intersection'](_0x2b11aa['model'],qs[_0xe58e('0x38')](_0x464bdc['query'][_0xe58e('0x38')]));_0x3ca07e[_0xe58e('0x37')]=_0x3ca07e[_0xe58e('0x37')][_0xe58e('0x39')]?_0x3ca07e[_0xe58e('0x37')]:_0x2b11aa['model'];if(!_0x464bdc[_0xe58e('0x32')][_0xe58e('0x3a')](_0xe58e('0x3b'))){_0x3ca07e[_0xe58e('0x1e')]=qs['limit'](_0x464bdc[_0xe58e('0x32')][_0xe58e('0x1e')]);_0x3ca07e[_0xe58e('0x1b')]=qs[_0xe58e('0x1b')](_0x464bdc[_0xe58e('0x32')][_0xe58e('0x1b')]);}_0x3ca07e[_0xe58e('0x3c')]=qs[_0xe58e('0x3d')](_0x464bdc[_0xe58e('0x32')]['sort']);_0x3ca07e['where']=qs[_0xe58e('0x34')](_[_0xe58e('0x3e')](_0x464bdc[_0xe58e('0x32')],_0x2b11aa['filters']),_0x5e1fc4);if(_0x464bdc[_0xe58e('0x32')]['filter']){_0x3ca07e[_0xe58e('0x3f')]=_[_0xe58e('0x40')](_0x3ca07e[_0xe58e('0x3f')],{'$or':_[_0xe58e('0x2d')](_0x5e1fc4,function(_0x1d8c5f){if(_0x1d8c5f[_0xe58e('0x30')]!==_0xe58e('0x41')){var _0x1f1e32={};_0x1f1e32[_0x1d8c5f[_0xe58e('0x2a')]]={'$like':'%'+_0x464bdc['query']['filter']+'%'};return _0x1f1e32;}})});}_0x3ca07e=_[_0xe58e('0x40')]({},_0x3ca07e,_0x464bdc[_0xe58e('0x42')]);var _0x139922={'where':_0x3ca07e[_0xe58e('0x3f')]};return db[_0xe58e('0x43')][_0xe58e('0x1d')](_0x139922)['then'](function(_0x213426){_0x3e86a9[_0xe58e('0x1d')]=_0x213426;if(_0x464bdc[_0xe58e('0x32')][_0xe58e('0x44')]){_0x3ca07e[_0xe58e('0x45')]=[{'all':!![]}];}return db['Template'][_0xe58e('0x46')](_0x3ca07e);})[_0xe58e('0x25')](function(_0xef3b){_0x3e86a9[_0xe58e('0x47')]=_0xef3b;return _0x3e86a9;})['then'](respondWithFilteredResult(_0x25a8b7,_0x3ca07e))['catch'](handleError(_0x25a8b7,null));};exports[_0xe58e('0x48')]=function(_0x541062,_0x2916b4){var _0x1e2315={'raw':!![],'where':{'id':_0x541062[_0xe58e('0x49')]['id']}},_0x2dee6b={};_0x2dee6b[_0xe58e('0x36')]=_[_0xe58e('0x33')](db['Template']['rawAttributes']);_0x2dee6b[_0xe58e('0x32')]=_[_0xe58e('0x33')](_0x541062[_0xe58e('0x32')]);_0x2dee6b[_0xe58e('0x34')]=_['intersection'](_0x2dee6b['model'],_0x2dee6b[_0xe58e('0x32')]);_0x1e2315[_0xe58e('0x37')]=_[_0xe58e('0x35')](_0x2dee6b[_0xe58e('0x36')],qs[_0xe58e('0x38')](_0x541062[_0xe58e('0x32')][_0xe58e('0x38')]));_0x1e2315[_0xe58e('0x37')]=_0x1e2315[_0xe58e('0x37')][_0xe58e('0x39')]?_0x1e2315[_0xe58e('0x37')]:_0x2dee6b[_0xe58e('0x36')];if(_0x541062[_0xe58e('0x32')]['includeAll']){_0x1e2315[_0xe58e('0x45')]=[{'all':!![]}];}_0x1e2315=_['merge']({},_0x1e2315,_0x541062[_0xe58e('0x42')]);return db[_0xe58e('0x43')][_0xe58e('0x4a')](_0x1e2315)[_0xe58e('0x25')](handleEntityNotFound(_0x2916b4,null))[_0xe58e('0x25')](respondWithResult(_0x2916b4,null))[_0xe58e('0x4b')](handleError(_0x2916b4,null));};exports['create']=function(_0x31f2c1,_0x4bf6b0){return db[_0xe58e('0x43')][_0xe58e('0x4c')](_0x31f2c1['body'],{})[_0xe58e('0x25')](function(_0x16ec75){var _0x56c7e3=_0x31f2c1[_0xe58e('0x4d')]['get']({'plain':!![]});if(!_0x56c7e3)throw new Error(_0xe58e('0x4e'));if(_0x56c7e3[_0xe58e('0x4f')]===_0xe58e('0x4d')){var _0xcf989e=_0x16ec75[_0xe58e('0x26')]({'plain':!![]});var _0x5cd959=_0xe58e('0x50');return db[_0xe58e('0x51')][_0xe58e('0x4a')]({'where':{'name':_0x5cd959,'userProfileId':_0x56c7e3[_0xe58e('0x52')]},'raw':!![]})[_0xe58e('0x25')](function(_0x21eac7){if(_0x21eac7&&_0x21eac7[_0xe58e('0x53')]===0x0){return db[_0xe58e('0x27')][_0xe58e('0x4c')]({'name':_0xcf989e['name'],'resourceId':_0xcf989e['id'],'type':_0x21eac7[_0xe58e('0x2a')],'sectionId':_0x21eac7['id']},{})['then'](function(){return _0x16ec75;});}else{return _0x16ec75;}})['catch'](function(_0x2afda6){logger['error'](_0xe58e('0x54'),_0x2afda6);throw _0x2afda6;});}return _0x16ec75;})[_0xe58e('0x25')](respondWithResult(_0x4bf6b0,0xc9))['catch'](handleError(_0x4bf6b0,null));};exports[_0xe58e('0x24')]=function(_0x67c601,_0x11c9a2){if(_0x67c601[_0xe58e('0x55')]['id']){delete _0x67c601[_0xe58e('0x55')]['id'];}return db[_0xe58e('0x43')][_0xe58e('0x4a')]({'where':{'id':_0x67c601[_0xe58e('0x49')]['id']}})[_0xe58e('0x25')](handleEntityNotFound(_0x11c9a2,null))[_0xe58e('0x25')](saveUpdates(_0x67c601['body'],null))[_0xe58e('0x25')](respondWithResult(_0x11c9a2,null))[_0xe58e('0x4b')](handleError(_0x11c9a2,null));};exports[_0xe58e('0x28')]=function(_0xe06b0d,_0x92ceb8){return db[_0xe58e('0x43')][_0xe58e('0x4a')]({'where':{'id':_0xe06b0d['params']['id']}})['then'](handleEntityNotFound(_0x92ceb8,null))['then'](removeEntity(_0x92ceb8,null))['catch'](handleError(_0x92ceb8,null));}; \ No newline at end of file +var _0x0fb4=['merge','filter','options','Template','include','findAll','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','count','set','Content-Range','save','update','destroy','then','get','Templates','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','pick'];(function(_0x3814fc,_0x49655b){var _0x34a0e3=function(_0x5bc672){while(--_0x5bc672){_0x3814fc['push'](_0x3814fc['shift']());}};_0x34a0e3(++_0x49655b);}(_0x0fb4,0x68));var _0x40fb=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x0fb4[_0x421e36];return _0x20b3e3;};'use strict';var emlformat=require(_0x40fb('0x0'));var rimraf=require(_0x40fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40fb('0x2'));var rp=require(_0x40fb('0x3'));var moment=require(_0x40fb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x40fb('0x5'));var util=require(_0x40fb('0x6'));var path=require(_0x40fb('0x7'));var sox=require(_0x40fb('0x8'));var csv=require(_0x40fb('0x9'));var ejs=require(_0x40fb('0xa'));var fs=require('fs');var fs_extra=require(_0x40fb('0xb'));var _=require(_0x40fb('0xc'));var squel=require(_0x40fb('0xd'));var crypto=require(_0x40fb('0xe'));var jsforce=require(_0x40fb('0xf'));var deskjs=require(_0x40fb('0x10'));var toCsv=require(_0x40fb('0x9'));var querystring=require(_0x40fb('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x40fb('0x12'));var as=require(_0x40fb('0x13'));var hardwareService=require(_0x40fb('0x14'));var logger=require(_0x40fb('0x15'))('api');var utils=require(_0x40fb('0x16'));var config=require(_0x40fb('0x17'));var licenseUtil=require(_0x40fb('0x18'));var db=require(_0x40fb('0x19'))['db'];function respondWithStatusCode(_0x3e3be0,_0x268405){_0x268405=_0x268405||0xcc;return function(_0x164de1){if(_0x164de1){return _0x3e3be0[_0x40fb('0x1a')](_0x268405);}return _0x3e3be0[_0x40fb('0x1b')](_0x268405)[_0x40fb('0x1c')]();};}function respondWithResult(_0x443ec3,_0x3b0677){_0x3b0677=_0x3b0677||0xc8;return function(_0x35d86e){if(_0x35d86e){return _0x443ec3['status'](_0x3b0677)[_0x40fb('0x1d')](_0x35d86e);}};}function respondWithFilteredResult(_0x51f9d4,_0x5cab3a){return function(_0x1ea95d){if(_0x1ea95d){var _0x3847cb=typeof _0x5cab3a[_0x40fb('0x1e')]==='undefined'&&typeof _0x5cab3a['limit']===_0x40fb('0x1f');var _0x4ef815=_0x1ea95d[_0x40fb('0x20')];var _0x2e8eed=_0x3847cb?0x0:_0x5cab3a[_0x40fb('0x1e')];var _0x268166=_0x3847cb?_0x1ea95d[_0x40fb('0x20')]:_0x5cab3a['offset']+_0x5cab3a['limit'];var _0x23c470;if(_0x268166>=_0x4ef815){_0x268166=_0x4ef815;_0x23c470=0xc8;}else{_0x23c470=0xce;}_0x51f9d4[_0x40fb('0x1b')](_0x23c470);return _0x51f9d4[_0x40fb('0x21')](_0x40fb('0x22'),_0x2e8eed+'-'+_0x268166+'/'+_0x4ef815)[_0x40fb('0x1d')](_0x1ea95d);}return null;};}function patchUpdates(_0x26c9d8){return function(_0x15044c){try{jsonpatch['apply'](_0x15044c,_0x26c9d8,!![]);}catch(_0x522920){return BPromise['reject'](_0x522920);}return _0x15044c[_0x40fb('0x23')]();};}function saveUpdates(_0x4f4684,_0x2a16cb){return function(_0x53ba44){if(_0x53ba44){return _0x53ba44[_0x40fb('0x24')](_0x4f4684)['then'](function(_0x39ce9d){return _0x39ce9d;});}return null;};}function removeEntity(_0xec263d,_0x3ddb80){return function(_0x2b2a50){if(_0x2b2a50){return _0x2b2a50[_0x40fb('0x25')]()[_0x40fb('0x26')](function(){var _0x1e3c72=_0x2b2a50[_0x40fb('0x27')]({'plain':!![]});var _0x590aea=_0x40fb('0x28');return db[_0x40fb('0x29')][_0x40fb('0x25')]({'where':{'type':_0x590aea,'resourceId':_0x1e3c72['id']}})['then'](function(){return _0x2b2a50;});})[_0x40fb('0x26')](function(){_0xec263d[_0x40fb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x586a30,_0x3679d8){return function(_0x1bcdfa){if(!_0x1bcdfa){_0x586a30[_0x40fb('0x1a')](0x194);}return _0x1bcdfa;};}function handleError(_0x13219f,_0x54a93f){_0x54a93f=_0x54a93f||0x1f4;return function(_0xa3e51c){logger['error'](_0xa3e51c['stack']);if(_0xa3e51c[_0x40fb('0x2a')]){delete _0xa3e51c[_0x40fb('0x2a')];}_0x13219f[_0x40fb('0x1b')](_0x54a93f)[_0x40fb('0x2b')](_0xa3e51c);};}exports[_0x40fb('0x2c')]=function(_0x2a67ac,_0x5661ae){var _0x52d7a8={},_0xdf421a={},_0x4c25ec={'count':0x0,'rows':[]};var _0x1e712a=_[_0x40fb('0x2d')](db['Template'][_0x40fb('0x2e')],function(_0x31b04a){return{'name':_0x31b04a[_0x40fb('0x2f')],'type':_0x31b04a[_0x40fb('0x30')][_0x40fb('0x31')]};});_0xdf421a[_0x40fb('0x32')]=_['map'](_0x1e712a,_0x40fb('0x2a'));_0xdf421a[_0x40fb('0x33')]=_[_0x40fb('0x34')](_0x2a67ac[_0x40fb('0x33')]);_0xdf421a[_0x40fb('0x35')]=_['intersection'](_0xdf421a[_0x40fb('0x32')],_0xdf421a[_0x40fb('0x33')]);_0x52d7a8[_0x40fb('0x36')]=_[_0x40fb('0x37')](_0xdf421a[_0x40fb('0x32')],qs[_0x40fb('0x38')](_0x2a67ac['query']['fields']));_0x52d7a8[_0x40fb('0x36')]=_0x52d7a8[_0x40fb('0x36')][_0x40fb('0x39')]?_0x52d7a8[_0x40fb('0x36')]:_0xdf421a['model'];if(!_0x2a67ac[_0x40fb('0x33')][_0x40fb('0x3a')](_0x40fb('0x3b'))){_0x52d7a8[_0x40fb('0x3c')]=qs[_0x40fb('0x3c')](_0x2a67ac[_0x40fb('0x33')]['limit']);_0x52d7a8[_0x40fb('0x1e')]=qs[_0x40fb('0x1e')](_0x2a67ac[_0x40fb('0x33')][_0x40fb('0x1e')]);}_0x52d7a8[_0x40fb('0x3d')]=qs['sort'](_0x2a67ac[_0x40fb('0x33')]['sort']);_0x52d7a8[_0x40fb('0x3e')]=qs[_0x40fb('0x35')](_[_0x40fb('0x3f')](_0x2a67ac[_0x40fb('0x33')],_0xdf421a[_0x40fb('0x35')]),_0x1e712a);if(_0x2a67ac['query']['filter']){_0x52d7a8[_0x40fb('0x3e')]=_[_0x40fb('0x40')](_0x52d7a8['where'],{'$or':_[_0x40fb('0x2d')](_0x1e712a,function(_0x28a53b){if(_0x28a53b[_0x40fb('0x30')]!=='VIRTUAL'){var _0x54f36f={};_0x54f36f[_0x28a53b[_0x40fb('0x2a')]]={'$like':'%'+_0x2a67ac[_0x40fb('0x33')][_0x40fb('0x41')]+'%'};return _0x54f36f;}})});}_0x52d7a8=_[_0x40fb('0x40')]({},_0x52d7a8,_0x2a67ac[_0x40fb('0x42')]);var _0x55468b={'where':_0x52d7a8[_0x40fb('0x3e')]};return db[_0x40fb('0x43')][_0x40fb('0x20')](_0x55468b)[_0x40fb('0x26')](function(_0x3d3805){_0x4c25ec[_0x40fb('0x20')]=_0x3d3805;if(_0x2a67ac['query']['includeAll']){_0x52d7a8[_0x40fb('0x44')]=[{'all':!![]}];}return db[_0x40fb('0x43')][_0x40fb('0x45')](_0x52d7a8);})[_0x40fb('0x26')](function(_0x312933){_0x4c25ec[_0x40fb('0x46')]=_0x312933;return _0x4c25ec;})[_0x40fb('0x26')](respondWithFilteredResult(_0x5661ae,_0x52d7a8))[_0x40fb('0x47')](handleError(_0x5661ae,null));};exports[_0x40fb('0x48')]=function(_0x23e309,_0x466c6f){var _0x120e91={'raw':!![],'where':{'id':_0x23e309[_0x40fb('0x49')]['id']}},_0x44ea3b={};_0x44ea3b['model']=_['keys'](db[_0x40fb('0x43')]['rawAttributes']);_0x44ea3b[_0x40fb('0x33')]=_[_0x40fb('0x34')](_0x23e309[_0x40fb('0x33')]);_0x44ea3b[_0x40fb('0x35')]=_[_0x40fb('0x37')](_0x44ea3b[_0x40fb('0x32')],_0x44ea3b['query']);_0x120e91[_0x40fb('0x36')]=_[_0x40fb('0x37')](_0x44ea3b[_0x40fb('0x32')],qs[_0x40fb('0x38')](_0x23e309[_0x40fb('0x33')][_0x40fb('0x38')]));_0x120e91['attributes']=_0x120e91[_0x40fb('0x36')][_0x40fb('0x39')]?_0x120e91[_0x40fb('0x36')]:_0x44ea3b[_0x40fb('0x32')];if(_0x23e309[_0x40fb('0x33')][_0x40fb('0x4a')]){_0x120e91[_0x40fb('0x44')]=[{'all':!![]}];}_0x120e91=_[_0x40fb('0x40')]({},_0x120e91,_0x23e309['options']);return db[_0x40fb('0x43')][_0x40fb('0x4b')](_0x120e91)[_0x40fb('0x26')](handleEntityNotFound(_0x466c6f,null))[_0x40fb('0x26')](respondWithResult(_0x466c6f,null))[_0x40fb('0x47')](handleError(_0x466c6f,null));};exports[_0x40fb('0x4c')]=function(_0x3b1350,_0x3fe3fc){return db[_0x40fb('0x43')][_0x40fb('0x4c')](_0x3b1350['body'],{})[_0x40fb('0x26')](function(_0x2d1e75){var _0x34a1a7=_0x3b1350['user'][_0x40fb('0x27')]({'plain':!![]});if(!_0x34a1a7)throw new Error(_0x40fb('0x4d'));if(_0x34a1a7['role']===_0x40fb('0x4e')){var _0x40c8b1=_0x2d1e75[_0x40fb('0x27')]({'plain':!![]});var _0xe4b9a8='Templates';return db[_0x40fb('0x4f')]['find']({'where':{'name':_0xe4b9a8,'userProfileId':_0x34a1a7[_0x40fb('0x50')]},'raw':!![]})[_0x40fb('0x26')](function(_0x33b579){if(_0x33b579&&_0x33b579['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x40c8b1['name'],'resourceId':_0x40c8b1['id'],'type':_0x33b579['name'],'sectionId':_0x33b579['id']},{})[_0x40fb('0x26')](function(){return _0x2d1e75;});}else{return _0x2d1e75;}})[_0x40fb('0x47')](function(_0x44955d){logger[_0x40fb('0x51')](_0x40fb('0x52'),_0x44955d);throw _0x44955d;});}return _0x2d1e75;})['then'](respondWithResult(_0x3fe3fc,0xc9))[_0x40fb('0x47')](handleError(_0x3fe3fc,null));};exports[_0x40fb('0x24')]=function(_0x17b6b7,_0x3334da){if(_0x17b6b7[_0x40fb('0x53')]['id']){delete _0x17b6b7[_0x40fb('0x53')]['id'];}return db[_0x40fb('0x43')][_0x40fb('0x4b')]({'where':{'id':_0x17b6b7[_0x40fb('0x49')]['id']}})['then'](handleEntityNotFound(_0x3334da,null))['then'](saveUpdates(_0x17b6b7[_0x40fb('0x53')],null))['then'](respondWithResult(_0x3334da,null))['catch'](handleError(_0x3334da,null));};exports[_0x40fb('0x25')]=function(_0x5310c1,_0x20ea4e){return db[_0x40fb('0x43')][_0x40fb('0x4b')]({'where':{'id':_0x5310c1[_0x40fb('0x49')]['id']}})['then'](handleEntityNotFound(_0x20ea4e,null))[_0x40fb('0x26')](removeEntity(_0x20ea4e,null))[_0x40fb('0x47')](handleError(_0x20ea4e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index aa3e93a..d7483c6 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 _0x0b9a=['./template.attributes','exports','define','Template','tools_templates','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x29652c,_0x45bb5f){var _0xb8eddf=function(_0x35c5be){while(--_0x35c5be){_0x29652c['push'](_0x29652c['shift']());}};_0xb8eddf(++_0x45bb5f);}(_0x0b9a,0x95));var _0xa0b9=function(_0x2943af,_0x72f03b){_0x2943af=_0x2943af-0x0;var _0x3861d2=_0x0b9a[_0x2943af];return _0x3861d2;};'use strict';var _=require(_0xa0b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa0b9('0x1'));var moment=require(_0xa0b9('0x2'));var BPromise=require(_0xa0b9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0b9('0x4'));var rimraf=require(_0xa0b9('0x5'));var config=require(_0xa0b9('0x6'));var attributes=require(_0xa0b9('0x7'));module[_0xa0b9('0x8')]=function(_0x2af64a,_0x1593e2){return _0x2af64a[_0xa0b9('0x9')](_0xa0b9('0xa'),attributes,{'tableName':_0xa0b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd38=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','Template','tools_templates'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbd38,0xd8));var _0x8bd3=function(_0x193034,_0x16baec){_0x193034=_0x193034-0x0;var _0xdf69ff=_0xbd38[_0x193034];return _0xdf69ff;};'use strict';var _=require('lodash');var util=require(_0x8bd3('0x0'));var logger=require(_0x8bd3('0x1'))('api');var moment=require(_0x8bd3('0x2'));var BPromise=require(_0x8bd3('0x3'));var rp=require(_0x8bd3('0x4'));var fs=require('fs');var path=require(_0x8bd3('0x5'));var rimraf=require(_0x8bd3('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x927cb5,_0x4a3121){return _0x927cb5['define'](_0x8bd3('0x7'),attributes,{'tableName':_0x8bd3('0x8'),'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 29fe65f..6997ceb 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 _0x9575=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','where','attributes','limit','map','include','model','GetTemplate','lodash'];(function(_0x533ef3,_0x42fc7c){var _0x25ceac=function(_0x462932){while(--_0x462932){_0x533ef3['push'](_0x533ef3['shift']());}};_0x25ceac(++_0x42fc7c);}(_0x9575,0x13f));var _0x5957=function(_0x22c2dd,_0x33d1e7){_0x22c2dd=_0x22c2dd-0x0;var _0x23cc7d=_0x9575[_0x22c2dd];return _0x23cc7d;};'use strict';var _=require(_0x5957('0x0'));var util=require(_0x5957('0x1'));var moment=require(_0x5957('0x2'));var BPromise=require(_0x5957('0x3'));var rs=require(_0x5957('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5957('0x5'));var logger=require(_0x5957('0x6'))(_0x5957('0x7'));var config=require(_0x5957('0x8'));var jayson=require(_0x5957('0x9'));var client=jayson[_0x5957('0xa')][_0x5957('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b0d3e,_0x2c47d8,_0x29c7c0){return new BPromise(function(_0x489360,_0x276770){return client['request'](_0x3b0d3e,_0x29c7c0)[_0x5957('0xc')](function(_0x4609be){logger[_0x5957('0xd')](_0x5957('0xe'),_0x2c47d8,_0x5957('0xf'));logger[_0x5957('0x10')](_0x5957('0x11'),_0x2c47d8,'request\x20sent',JSON[_0x5957('0x12')](_0x4609be));if(_0x4609be[_0x5957('0x13')]){if(_0x4609be[_0x5957('0x13')]['code']===0x1f4){logger[_0x5957('0x13')](_0x5957('0xe'),_0x2c47d8,_0x4609be[_0x5957('0x13')]['message']);return _0x276770(_0x4609be['error'][_0x5957('0x14')]);}logger[_0x5957('0x13')]('Template,\x20%s,\x20%s',_0x2c47d8,_0x4609be[_0x5957('0x13')]['message']);return _0x489360(_0x4609be['error']['message']);}else{logger['info'](_0x5957('0xe'),_0x2c47d8,_0x5957('0xf'));_0x489360(_0x4609be[_0x5957('0x15')]['message']);}})[_0x5957('0x16')](function(_0x4714d6){logger[_0x5957('0x13')]('Template,\x20%s,\x20%s',_0x2c47d8,_0x4714d6);_0x276770(_0x4714d6);});});}exports['GetTemplate']=function(_0x13f51f){var _0x45d1c1=this;return new Promise(function(_0x5c0365,_0x12e54a){return db['Template'][_0x5957('0x17')]({'raw':_0x13f51f['options']?_0x13f51f[_0x5957('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x13f51f['options']?_0x13f51f[_0x5957('0x18')][_0x5957('0x19')]||null:null,'attributes':_0x13f51f[_0x5957('0x18')]?_0x13f51f['options'][_0x5957('0x1a')]||null:null,'limit':_0x13f51f[_0x5957('0x18')]?_0x13f51f['options'][_0x5957('0x1b')]||null:null,'include':_0x13f51f[_0x5957('0x18')]?_0x13f51f['options']['include']?_[_0x5957('0x1c')](_0x13f51f[_0x5957('0x18')][_0x5957('0x1d')],function(_0x3fb39d){return{'model':db[_0x3fb39d[_0x5957('0x1e')]],'as':_0x3fb39d['as'],'attributes':_0x3fb39d[_0x5957('0x1a')],'include':_0x3fb39d[_0x5957('0x1d')]?_[_0x5957('0x1c')](_0x3fb39d[_0x5957('0x1d')],function(_0xfc6f89){return{'model':db[_0xfc6f89[_0x5957('0x1e')]],'as':_0xfc6f89['as'],'attributes':_0xfc6f89[_0x5957('0x1a')],'include':_0xfc6f89['include']?_['map'](_0xfc6f89[_0x5957('0x1d')],function(_0x43a49){return{'model':db[_0x43a49[_0x5957('0x1e')]],'as':_0x43a49['as'],'attributes':_0x43a49[_0x5957('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5957('0xc')](function(_0x4b332d){logger[_0x5957('0xd')](_0x5957('0x1f'),_0x13f51f);logger['debug'](_0x5957('0x1f'),_0x13f51f,JSON[_0x5957('0x12')](_0x4b332d));_0x5c0365(_0x4b332d);})[_0x5957('0x16')](function(_0x3c6b64){logger[_0x5957('0x13')](_0x5957('0x1f'),_0x3c6b64['message'],_0x13f51f);_0x12e54a(_0x45d1c1[_0x5957('0x13')](0x1f4,_0x3c6b64['message']));});});}; \ No newline at end of file +var _0x5c27=['GetTemplate','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','options','raw','where','limit','include','model','map','attributes'];(function(_0x80ea27,_0xa1b872){var _0x2636ec=function(_0x5e836d){while(--_0x5e836d){_0x80ea27['push'](_0x80ea27['shift']());}};_0x2636ec(++_0xa1b872);}(_0x5c27,0xe8));var _0x75c2=function(_0x5dc3f6,_0x1fc463){_0x5dc3f6=_0x5dc3f6-0x0;var _0x257802=_0x5c27[_0x5dc3f6];return _0x257802;};'use strict';var _=require(_0x75c2('0x0'));var util=require(_0x75c2('0x1'));var moment=require(_0x75c2('0x2'));var BPromise=require(_0x75c2('0x3'));var rs=require(_0x75c2('0x4'));var fs=require('fs');var Redis=require(_0x75c2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x75c2('0x6'));var logger=require(_0x75c2('0x7'))('rpc');var config=require(_0x75c2('0x8'));var jayson=require(_0x75c2('0x9'));var client=jayson[_0x75c2('0xa')][_0x75c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5212d0,_0x19c89b,_0x42d53f){return new BPromise(function(_0x238a5a,_0x5697d8){return client[_0x75c2('0xc')](_0x5212d0,_0x42d53f)[_0x75c2('0xd')](function(_0x1147e3){logger['info'](_0x75c2('0xe'),_0x19c89b,_0x75c2('0xf'));logger[_0x75c2('0x10')](_0x75c2('0x11'),_0x19c89b,'request\x20sent',JSON[_0x75c2('0x12')](_0x1147e3));if(_0x1147e3[_0x75c2('0x13')]){if(_0x1147e3[_0x75c2('0x13')]['code']===0x1f4){logger[_0x75c2('0x13')](_0x75c2('0xe'),_0x19c89b,_0x1147e3['error'][_0x75c2('0x14')]);return _0x5697d8(_0x1147e3[_0x75c2('0x13')][_0x75c2('0x14')]);}logger[_0x75c2('0x13')](_0x75c2('0xe'),_0x19c89b,_0x1147e3[_0x75c2('0x13')][_0x75c2('0x14')]);return _0x238a5a(_0x1147e3[_0x75c2('0x13')][_0x75c2('0x14')]);}else{logger[_0x75c2('0x15')](_0x75c2('0xe'),_0x19c89b,_0x75c2('0xf'));_0x238a5a(_0x1147e3[_0x75c2('0x16')]['message']);}})[_0x75c2('0x17')](function(_0x513b7b){logger[_0x75c2('0x13')](_0x75c2('0xe'),_0x19c89b,_0x513b7b);_0x5697d8(_0x513b7b);});});}exports['GetTemplate']=function(_0x242b5d){var _0x2224b7=this;return new Promise(function(_0x1f97ec,_0x18fa94){return db['Template']['findAll']({'raw':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x19')]===undefined?!![]:![]:!![],'where':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1a')]||null:null,'attributes':_0x242b5d['options']?_0x242b5d[_0x75c2('0x18')]['attributes']||null:null,'limit':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1b')]||null:null,'include':_0x242b5d[_0x75c2('0x18')]?_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1c')]?_['map'](_0x242b5d[_0x75c2('0x18')][_0x75c2('0x1c')],function(_0x6d0ace){return{'model':db[_0x6d0ace[_0x75c2('0x1d')]],'as':_0x6d0ace['as'],'attributes':_0x6d0ace['attributes'],'include':_0x6d0ace[_0x75c2('0x1c')]?_[_0x75c2('0x1e')](_0x6d0ace[_0x75c2('0x1c')],function(_0x8d43a5){return{'model':db[_0x8d43a5[_0x75c2('0x1d')]],'as':_0x8d43a5['as'],'attributes':_0x8d43a5[_0x75c2('0x1f')],'include':_0x8d43a5['include']?_[_0x75c2('0x1e')](_0x8d43a5[_0x75c2('0x1c')],function(_0x323730){return{'model':db[_0x323730[_0x75c2('0x1d')]],'as':_0x323730['as'],'attributes':_0x323730['attributes']};}):[]};}):[]};}):[]:[]})[_0x75c2('0xd')](function(_0x321260){logger[_0x75c2('0x15')](_0x75c2('0x20'),_0x242b5d);logger[_0x75c2('0x10')](_0x75c2('0x20'),_0x242b5d,JSON[_0x75c2('0x12')](_0x321260));_0x1f97ec(_0x321260);})['catch'](function(_0x11f431){logger[_0x75c2('0x13')]('GetTemplate',_0x11f431[_0x75c2('0x14')],_0x242b5d);_0x18fa94(_0x2224b7[_0x75c2('0x13')](0x1f4,_0x11f431['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index f3c65e8..6ac70cb 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 _0x08f4=['create','addAllCondition','/:id/any_conditions','addAnyCondition','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post'];(function(_0x1e0d9a,_0x214450){var _0x36cbe0=function(_0x4003b4){while(--_0x4003b4){_0x1e0d9a['push'](_0x1e0d9a['shift']());}};_0x36cbe0(++_0x214450);}(_0x08f4,0xb7));var _0x408f=function(_0x5f51f9,_0x356b43){_0x5f51f9=_0x5f51f9-0x0;var _0x5a10d4=_0x08f4[_0x5f51f9];return _0x5a10d4;};'use strict';var multer=require('multer');var util=require(_0x408f('0x0'));var path=require('path');var timeout=require(_0x408f('0x1'));var express=require('express');var router=express[_0x408f('0x2')]();var fs_extra=require(_0x408f('0x3'));var auth=require(_0x408f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x408f('0x5'));var controller=require(_0x408f('0x6'));router[_0x408f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x408f('0x8'),auth[_0x408f('0x9')](),controller[_0x408f('0xa')]);router[_0x408f('0x7')](_0x408f('0xb'),auth[_0x408f('0x9')](),controller[_0x408f('0xc')]);router[_0x408f('0x7')]('/:id/any_conditions',auth[_0x408f('0x9')](),controller[_0x408f('0xd')]);router[_0x408f('0x7')](_0x408f('0xe'),auth['isAuthenticated'](),controller[_0x408f('0xf')]);router[_0x408f('0x10')]('/',auth[_0x408f('0x9')](),controller[_0x408f('0x11')]);router['post']('/:id/all_conditions',auth[_0x408f('0x9')](),controller[_0x408f('0x12')]);router[_0x408f('0x10')](_0x408f('0x13'),auth[_0x408f('0x9')](),controller[_0x408f('0x14')]);router[_0x408f('0x10')](_0x408f('0xe'),auth[_0x408f('0x9')](),controller['addAction']);router['put'](_0x408f('0x8'),auth[_0x408f('0x9')](),controller[_0x408f('0x15')]);router[_0x408f('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x408f('0x17')]);module[_0x408f('0x18')]=router; \ No newline at end of file +var _0x404d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','index','show','getAllConditions','/:id/any_conditions','isAuthenticated','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3a8d5a,_0xe54840){var _0x308361=function(_0x2e7f86){while(--_0x2e7f86){_0x3a8d5a['push'](_0x3a8d5a['shift']());}};_0x308361(++_0xe54840);}(_0x404d,0x1e9));var _0xd404=function(_0x51847a,_0x2b2f67){_0x51847a=_0x51847a-0x0;var _0x41016d=_0x404d[_0x51847a];return _0x41016d;};'use strict';var multer=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var path=require(_0xd404('0x2'));var timeout=require(_0xd404('0x3'));var express=require(_0xd404('0x4'));var router=express[_0xd404('0x5')]();var fs_extra=require(_0xd404('0x6'));var auth=require(_0xd404('0x7'));var interaction=require(_0xd404('0x8'));var config=require('../../config/environment');var controller=require(_0xd404('0x9'));router[_0xd404('0xa')]('/',auth['isAuthenticated'](),controller[_0xd404('0xb')]);router[_0xd404('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd404('0xc')]);router[_0xd404('0xa')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xd404('0xd')]);router[_0xd404('0xa')](_0xd404('0xe'),auth[_0xd404('0xf')](),controller['getAnyConditions']);router['get'](_0xd404('0x10'),auth[_0xd404('0xf')](),controller['getActions']);router[_0xd404('0x11')]('/',auth[_0xd404('0xf')](),controller[_0xd404('0x12')]);router[_0xd404('0x11')](_0xd404('0x13'),auth[_0xd404('0xf')](),controller[_0xd404('0x14')]);router[_0xd404('0x11')](_0xd404('0xe'),auth[_0xd404('0xf')](),controller[_0xd404('0x15')]);router[_0xd404('0x11')](_0xd404('0x10'),auth[_0xd404('0xf')](),controller[_0xd404('0x16')]);router[_0xd404('0x17')](_0xd404('0x18'),auth[_0xd404('0xf')](),controller[_0xd404('0x19')]);router[_0xd404('0x1a')](_0xd404('0x18'),auth['isAuthenticated'](),controller[_0xd404('0x1b')]);module[_0xd404('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 586aca6..d00adf8 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 _0xda21=['sequelize','exports','STRING','BOOLEAN'];(function(_0x407217,_0x36d62a){var _0x2dc211=function(_0x3cbe9a){while(--_0x3cbe9a){_0x407217['push'](_0x407217['shift']());}};_0x2dc211(++_0x36d62a);}(_0xda21,0x11c));var _0x1da2=function(_0x3dea0a,_0x2398f3){_0x3dea0a=_0x3dea0a-0x0;var _0x24f6b9=_0xda21[_0x3dea0a];return _0x24f6b9;};'use strict';var Sequelize=require(_0x1da2('0x0'));module[_0x1da2('0x1')]={'name':{'type':Sequelize[_0x1da2('0x2')]},'channel':{'type':Sequelize[_0x1da2('0x2')]},'description':{'type':Sequelize[_0x1da2('0x2')]},'status':{'type':Sequelize[_0x1da2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2d0e=['sequelize','STRING'];(function(_0x3a0041,_0x236f43){var _0x4309af=function(_0x29ec55){while(--_0x29ec55){_0x3a0041['push'](_0x3a0041['shift']());}};_0x4309af(++_0x236f43);}(_0x2d0e,0x1cc));var _0xe2d0=function(_0x34d576,_0xd69cce){_0x34d576=_0x34d576-0x0;var _0x4c9b82=_0x2d0e[_0x34d576];return _0x4c9b82;};'use strict';var Sequelize=require(_0xe2d0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe2d0('0x1')]},'description':{'type':Sequelize[_0xe2d0('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d4f750d..857eced 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 _0xd24f=['show','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','params','destroy','addAllCondition','TriggerAllId','addAnyCondition','Condition','findOne','getAllConditions','getAnyConditions','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','get','Triggers','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xd24f,0x76));var _0xfd24=function(_0xc14a52,_0x5b84b9){_0xc14a52=_0xc14a52-0x0;var _0x2e5227=_0xd24f[_0xc14a52];return _0x2e5227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd24('0x0'));var zipdir=require(_0xfd24('0x1'));var jsonpatch=require(_0xfd24('0x2'));var rp=require(_0xfd24('0x3'));var moment=require('moment');var BPromise=require(_0xfd24('0x4'));var Mustache=require('mustache');var util=require(_0xfd24('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfd24('0x6'));var fs=require('fs');var fs_extra=require(_0xfd24('0x7'));var _=require(_0xfd24('0x8'));var squel=require(_0xfd24('0x9'));var crypto=require(_0xfd24('0xa'));var jsforce=require(_0xfd24('0xb'));var deskjs=require(_0xfd24('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfd24('0xd'));var Redis=require(_0xfd24('0xe'));var authService=require(_0xfd24('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfd24('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd24('0x11'))(_0xfd24('0x12'));var utils=require(_0xfd24('0x13'));var config=require(_0xfd24('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd24('0x15'))['db'];function respondWithStatusCode(_0x203093,_0x176fb8){_0x176fb8=_0x176fb8||0xcc;return function(_0x593de7){if(_0x593de7){return _0x203093[_0xfd24('0x16')](_0x176fb8);}return _0x203093[_0xfd24('0x17')](_0x176fb8)[_0xfd24('0x18')]();};}function respondWithResult(_0x55c469,_0x538fb0){_0x538fb0=_0x538fb0||0xc8;return function(_0x402e50){if(_0x402e50){return _0x55c469[_0xfd24('0x17')](_0x538fb0)[_0xfd24('0x19')](_0x402e50);}};}function respondWithFilteredResult(_0xcf8676,_0x573461){return function(_0x2051b3){if(_0x2051b3){var _0x51b52f=typeof _0x573461[_0xfd24('0x1a')]==='undefined'&&typeof _0x573461[_0xfd24('0x1b')]===_0xfd24('0x1c');var _0x33a2d7=_0x2051b3['count'];var _0x40a976=_0x51b52f?0x0:_0x573461[_0xfd24('0x1a')];var _0x471ead=_0x51b52f?_0x2051b3[_0xfd24('0x1d')]:_0x573461[_0xfd24('0x1a')]+_0x573461[_0xfd24('0x1b')];var _0x30b59b;if(_0x471ead>=_0x33a2d7){_0x471ead=_0x33a2d7;_0x30b59b=0xc8;}else{_0x30b59b=0xce;}_0xcf8676[_0xfd24('0x17')](_0x30b59b);return _0xcf8676['set']('Content-Range',_0x40a976+'-'+_0x471ead+'/'+_0x33a2d7)['json'](_0x2051b3);}return null;};}function patchUpdates(_0x32debf){return function(_0x2290c4){try{jsonpatch[_0xfd24('0x1e')](_0x2290c4,_0x32debf,!![]);}catch(_0x477cf4){return BPromise[_0xfd24('0x1f')](_0x477cf4);}return _0x2290c4[_0xfd24('0x20')]();};}function saveUpdates(_0x2232b8,_0xb1aceb){return function(_0x998c35){if(_0x998c35){return _0x998c35[_0xfd24('0x21')](_0x2232b8)['then'](function(_0x5752ba){return _0x5752ba;});}return null;};}function removeEntity(_0x11c628,_0x44bdfe){return function(_0x22b60c){if(_0x22b60c){return _0x22b60c['destroy']()[_0xfd24('0x22')](function(){var _0xb448a=_0x22b60c[_0xfd24('0x23')]({'plain':!![]});var _0x55de92=_0xfd24('0x24');return db[_0xfd24('0x25')]['destroy']({'where':{'type':_0x55de92,'resourceId':_0xb448a['id']}})[_0xfd24('0x22')](function(){return _0x22b60c;});})[_0xfd24('0x22')](function(){_0x11c628[_0xfd24('0x17')](0xcc)[_0xfd24('0x18')]();});}};}function handleEntityNotFound(_0x21d942,_0x1524f6){return function(_0x28d150){if(!_0x28d150){_0x21d942[_0xfd24('0x16')](0x194);}return _0x28d150;};}function handleError(_0x9714d0,_0x11500a){_0x11500a=_0x11500a||0x1f4;return function(_0x2fb023){logger['error'](_0x2fb023[_0xfd24('0x26')]);if(_0x2fb023[_0xfd24('0x27')]){delete _0x2fb023['name'];}_0x9714d0['status'](_0x11500a)[_0xfd24('0x28')](_0x2fb023);};}exports[_0xfd24('0x29')]=function(_0x8ecff8,_0x593eec){var _0x5054b3={},_0x4a979b={},_0x3e4cd9={'count':0x0,'rows':[]};var _0x360489=_[_0xfd24('0x2a')](db[_0xfd24('0x2b')][_0xfd24('0x2c')],function(_0x2273c7){return{'name':_0x2273c7[_0xfd24('0x2d')],'type':_0x2273c7[_0xfd24('0x2e')][_0xfd24('0x2f')]};});_0x4a979b[_0xfd24('0x30')]=_[_0xfd24('0x2a')](_0x360489,_0xfd24('0x27'));_0x4a979b[_0xfd24('0x31')]=_[_0xfd24('0x32')](_0x8ecff8[_0xfd24('0x31')]);_0x4a979b['filters']=_[_0xfd24('0x33')](_0x4a979b['model'],_0x4a979b['query']);_0x5054b3[_0xfd24('0x34')]=_[_0xfd24('0x33')](_0x4a979b[_0xfd24('0x30')],qs[_0xfd24('0x35')](_0x8ecff8[_0xfd24('0x31')][_0xfd24('0x35')]));_0x5054b3[_0xfd24('0x34')]=_0x5054b3['attributes'][_0xfd24('0x36')]?_0x5054b3[_0xfd24('0x34')]:_0x4a979b[_0xfd24('0x30')];if(!_0x8ecff8[_0xfd24('0x31')][_0xfd24('0x37')](_0xfd24('0x38'))){_0x5054b3[_0xfd24('0x1b')]=qs['limit'](_0x8ecff8[_0xfd24('0x31')][_0xfd24('0x1b')]);_0x5054b3[_0xfd24('0x1a')]=qs[_0xfd24('0x1a')](_0x8ecff8[_0xfd24('0x31')][_0xfd24('0x1a')]);}_0x5054b3[_0xfd24('0x39')]=qs[_0xfd24('0x3a')](_0x8ecff8['query'][_0xfd24('0x3a')]);_0x5054b3[_0xfd24('0x3b')]=qs[_0xfd24('0x3c')](_[_0xfd24('0x3d')](_0x8ecff8[_0xfd24('0x31')],_0x4a979b[_0xfd24('0x3c')]),_0x360489);if(_0x8ecff8['query'][_0xfd24('0x3e')]){_0x5054b3['where']=_[_0xfd24('0x3f')](_0x5054b3[_0xfd24('0x3b')],{'$or':_[_0xfd24('0x2a')](_0x360489,function(_0x38eaea){if(_0x38eaea['type']!==_0xfd24('0x40')){var _0x34a425={};_0x34a425[_0x38eaea['name']]={'$like':'%'+_0x8ecff8[_0xfd24('0x31')][_0xfd24('0x3e')]+'%'};return _0x34a425;}})});}_0x5054b3=_[_0xfd24('0x3f')]({},_0x5054b3,_0x8ecff8[_0xfd24('0x41')]);var _0x1c67cf={'where':_0x5054b3[_0xfd24('0x3b')]};return db[_0xfd24('0x2b')][_0xfd24('0x1d')](_0x1c67cf)[_0xfd24('0x22')](function(_0xc4f992){_0x3e4cd9['count']=_0xc4f992;if(_0x8ecff8[_0xfd24('0x31')]['includeAll']){_0x5054b3[_0xfd24('0x42')]=[{'all':!![]}];}return db[_0xfd24('0x2b')][_0xfd24('0x43')](_0x5054b3);})[_0xfd24('0x22')](function(_0x3c1237){_0x3e4cd9[_0xfd24('0x44')]=_0x3c1237;return _0x3e4cd9;})[_0xfd24('0x22')](respondWithFilteredResult(_0x593eec,_0x5054b3))[_0xfd24('0x45')](handleError(_0x593eec,null));};exports[_0xfd24('0x46')]=function(_0xc4f281,_0xed4ae2){var _0x5334c7={'raw':![],'where':{'id':_0xc4f281['params']['id']}},_0x3bd852={};_0x3bd852[_0xfd24('0x30')]=_['keys'](db[_0xfd24('0x2b')][_0xfd24('0x2c')]);_0x3bd852[_0xfd24('0x31')]=_['keys'](_0xc4f281[_0xfd24('0x31')]);_0x3bd852[_0xfd24('0x3c')]=_[_0xfd24('0x33')](_0x3bd852['model'],_0x3bd852['query']);_0x5334c7[_0xfd24('0x34')]=_['intersection'](_0x3bd852[_0xfd24('0x30')],qs[_0xfd24('0x35')](_0xc4f281[_0xfd24('0x31')]['fields']));_0x5334c7[_0xfd24('0x34')]=_0x5334c7[_0xfd24('0x34')][_0xfd24('0x36')]?_0x5334c7[_0xfd24('0x34')]:_0x3bd852['model'];if(_0xc4f281['query'][_0xfd24('0x47')]){_0x5334c7[_0xfd24('0x42')]=[{'all':!![]}];}_0x5334c7=_[_0xfd24('0x3f')]({},_0x5334c7,_0xc4f281[_0xfd24('0x41')]);return db[_0xfd24('0x2b')][_0xfd24('0x48')](_0x5334c7)[_0xfd24('0x22')](handleEntityNotFound(_0xed4ae2,null))[_0xfd24('0x22')](respondWithResult(_0xed4ae2,null))[_0xfd24('0x45')](handleError(_0xed4ae2,null));};exports['create']=function(_0x59528c,_0xbe0c31){return db['Trigger'][_0xfd24('0x49')](_0x59528c[_0xfd24('0x4a')],{})[_0xfd24('0x22')](function(_0x5a62c2){var _0x1b81d6=_0x59528c[_0xfd24('0x4b')]['get']({'plain':!![]});if(!_0x1b81d6)throw new Error(_0xfd24('0x4c'));if(_0x1b81d6['role']===_0xfd24('0x4b')){var _0x507db0=_0x5a62c2['get']({'plain':!![]});var _0x3b8ef8=_0xfd24('0x24');return db[_0xfd24('0x4d')]['find']({'where':{'name':_0x3b8ef8,'userProfileId':_0x1b81d6[_0xfd24('0x4e')]},'raw':!![]})[_0xfd24('0x22')](function(_0x50aeaa){if(_0x50aeaa&&_0x50aeaa[_0xfd24('0x4f')]===0x0){return db[_0xfd24('0x25')]['create']({'name':_0x507db0[_0xfd24('0x27')],'resourceId':_0x507db0['id'],'type':_0x50aeaa[_0xfd24('0x27')],'sectionId':_0x50aeaa['id']},{})[_0xfd24('0x22')](function(){return _0x5a62c2;});}else{return _0x5a62c2;}})['catch'](function(_0xd0283b){logger[_0xfd24('0x50')](_0xfd24('0x51'),_0xd0283b);throw _0xd0283b;});}return _0x5a62c2;})[_0xfd24('0x22')](respondWithResult(_0xbe0c31,0xc9))['catch'](handleError(_0xbe0c31,null));};exports['update']=function(_0x3641d5,_0x53b37e){if(_0x3641d5[_0xfd24('0x4a')]['id']){delete _0x3641d5[_0xfd24('0x4a')]['id'];}return db[_0xfd24('0x2b')][_0xfd24('0x48')]({'where':{'id':_0x3641d5[_0xfd24('0x52')]['id']}})[_0xfd24('0x22')](handleEntityNotFound(_0x53b37e,null))[_0xfd24('0x22')](saveUpdates(_0x3641d5[_0xfd24('0x4a')],null))[_0xfd24('0x22')](respondWithResult(_0x53b37e,null))[_0xfd24('0x45')](handleError(_0x53b37e,null));};exports[_0xfd24('0x53')]=function(_0x7be025,_0x2e4522){return db[_0xfd24('0x2b')][_0xfd24('0x48')]({'where':{'id':_0x7be025[_0xfd24('0x52')]['id']}})[_0xfd24('0x22')](handleEntityNotFound(_0x2e4522,null))[_0xfd24('0x22')](removeEntity(_0x2e4522,null))[_0xfd24('0x45')](handleError(_0x2e4522,null));};exports[_0xfd24('0x54')]=function(_0x291685,_0x17ff7f,_0xada43){if(_0x291685['body']['id']){delete _0x291685[_0xfd24('0x4a')]['id'];}return db[_0xfd24('0x2b')][_0xfd24('0x48')]({'where':{'id':_0x291685['params']['id']}})[_0xfd24('0x22')](handleEntityNotFound(_0x17ff7f,null))['then'](function(_0x3dc4ab){if(_0x3dc4ab){_0x291685[_0xfd24('0x4a')][_0xfd24('0x55')]=_0x3dc4ab['id'];return db['Condition'][_0xfd24('0x49')](_0x291685['body']);}})[_0xfd24('0x22')](respondWithResult(_0x17ff7f,null))[_0xfd24('0x45')](handleError(_0x17ff7f,null));};exports[_0xfd24('0x56')]=function(_0x57e932,_0x293fa0,_0x4164a5){if(_0x57e932[_0xfd24('0x4a')]['id']){delete _0x57e932['body']['id'];}return db[_0xfd24('0x2b')]['find']({'where':{'id':_0x57e932[_0xfd24('0x52')]['id']}})[_0xfd24('0x22')](handleEntityNotFound(_0x293fa0,null))['then'](function(_0x923532){if(_0x923532){_0x57e932[_0xfd24('0x4a')]['TriggerAnyId']=_0x923532['id'];return db[_0xfd24('0x57')][_0xfd24('0x49')](_0x57e932['body']);}})[_0xfd24('0x22')](respondWithResult(_0x293fa0,null))[_0xfd24('0x45')](handleError(_0x293fa0,null));};exports['getAllConditions']=function(_0x244f78,_0x567e8e,_0x458b87){var _0x4e992b={};var _0x24a41c={};var _0x391551;var _0x3a4d79;return db[_0xfd24('0x2b')][_0xfd24('0x58')]({'where':{'id':_0x244f78[_0xfd24('0x52')]['id']}})['then'](handleEntityNotFound(_0x567e8e,null))[_0xfd24('0x22')](function(_0x446a41){if(_0x446a41){_0x391551=_0x446a41;_0x24a41c['model']=_[_0xfd24('0x32')](db[_0xfd24('0x57')][_0xfd24('0x2c')]);_0x24a41c[_0xfd24('0x31')]=_[_0xfd24('0x32')](_0x244f78[_0xfd24('0x31')]);_0x24a41c['filters']=_[_0xfd24('0x33')](_0x24a41c[_0xfd24('0x30')],_0x24a41c[_0xfd24('0x31')]);_0x4e992b[_0xfd24('0x34')]=_['intersection'](_0x24a41c[_0xfd24('0x30')],qs[_0xfd24('0x35')](_0x244f78[_0xfd24('0x31')]['fields']));_0x4e992b[_0xfd24('0x34')]=_0x4e992b[_0xfd24('0x34')][_0xfd24('0x36')]?_0x4e992b[_0xfd24('0x34')]:_0x24a41c['model'];_0x4e992b[_0xfd24('0x39')]=qs[_0xfd24('0x3a')](_0x244f78[_0xfd24('0x31')][_0xfd24('0x3a')]);_0x4e992b[_0xfd24('0x3b')]=qs['filters'](_['pick'](_0x244f78[_0xfd24('0x31')],_0x24a41c[_0xfd24('0x3c')]));if(_0x244f78['query'][_0xfd24('0x3e')]){_0x4e992b[_0xfd24('0x3b')]=_[_0xfd24('0x3f')](_0x4e992b[_0xfd24('0x3b')],{'$or':_[_0xfd24('0x2a')](_0x4e992b['attributes'],function(_0x516a63){var _0x345e2c={};_0x345e2c[_0x516a63]={'$like':'%'+_0x244f78[_0xfd24('0x31')][_0xfd24('0x3e')]+'%'};return _0x345e2c;})});}_0x4e992b=_[_0xfd24('0x3f')]({},_0x4e992b,_0x244f78[_0xfd24('0x41')]);return _0x391551[_0xfd24('0x59')](_0x4e992b);}})[_0xfd24('0x22')](function(_0x15ce06){if(_0x15ce06){_0x3a4d79=_0x15ce06['length'];if(!_0x244f78['query']['hasOwnProperty']('nolimit')){_0x4e992b['limit']=qs[_0xfd24('0x1b')](_0x244f78['query'][_0xfd24('0x1b')]);_0x4e992b[_0xfd24('0x1a')]=qs[_0xfd24('0x1a')](_0x244f78['query'][_0xfd24('0x1a')]);}return _0x391551['getAllConditions'](_0x4e992b);}})[_0xfd24('0x22')](function(_0x17e3a5){if(_0x17e3a5){return _0x17e3a5?{'count':_0x3a4d79,'rows':_0x17e3a5}:null;}})[_0xfd24('0x22')](respondWithResult(_0x567e8e,null))['catch'](handleError(_0x567e8e,null));};exports[_0xfd24('0x5a')]=function(_0x202caf,_0x9d4dae,_0x2afbb1){var _0x4ad335={};var _0x32226a={};var _0x2973c3;var _0x431e0b;return db[_0xfd24('0x2b')]['findOne']({'where':{'id':_0x202caf[_0xfd24('0x52')]['id']}})[_0xfd24('0x22')](handleEntityNotFound(_0x9d4dae,null))[_0xfd24('0x22')](function(_0x5b08f8){if(_0x5b08f8){_0x2973c3=_0x5b08f8;_0x32226a[_0xfd24('0x30')]=_['keys'](db['Condition'][_0xfd24('0x2c')]);_0x32226a[_0xfd24('0x31')]=_[_0xfd24('0x32')](_0x202caf[_0xfd24('0x31')]);_0x32226a[_0xfd24('0x3c')]=_[_0xfd24('0x33')](_0x32226a[_0xfd24('0x30')],_0x32226a[_0xfd24('0x31')]);_0x4ad335[_0xfd24('0x34')]=_[_0xfd24('0x33')](_0x32226a[_0xfd24('0x30')],qs[_0xfd24('0x35')](_0x202caf[_0xfd24('0x31')][_0xfd24('0x35')]));_0x4ad335[_0xfd24('0x34')]=_0x4ad335[_0xfd24('0x34')]['length']?_0x4ad335[_0xfd24('0x34')]:_0x32226a[_0xfd24('0x30')];_0x4ad335[_0xfd24('0x39')]=qs[_0xfd24('0x3a')](_0x202caf[_0xfd24('0x31')][_0xfd24('0x3a')]);_0x4ad335[_0xfd24('0x3b')]=qs[_0xfd24('0x3c')](_[_0xfd24('0x3d')](_0x202caf[_0xfd24('0x31')],_0x32226a[_0xfd24('0x3c')]));if(_0x202caf[_0xfd24('0x31')][_0xfd24('0x3e')]){_0x4ad335['where']=_[_0xfd24('0x3f')](_0x4ad335[_0xfd24('0x3b')],{'$or':_[_0xfd24('0x2a')](_0x4ad335[_0xfd24('0x34')],function(_0x405af2){var _0x4791c6={};_0x4791c6[_0x405af2]={'$like':'%'+_0x202caf['query'][_0xfd24('0x3e')]+'%'};return _0x4791c6;})});}_0x4ad335=_['merge']({},_0x4ad335,_0x202caf[_0xfd24('0x41')]);return _0x2973c3[_0xfd24('0x5a')](_0x4ad335);}})[_0xfd24('0x22')](function(_0x384b6f){if(_0x384b6f){_0x431e0b=_0x384b6f[_0xfd24('0x36')];if(!_0x202caf[_0xfd24('0x31')][_0xfd24('0x37')](_0xfd24('0x38'))){_0x4ad335[_0xfd24('0x1b')]=qs[_0xfd24('0x1b')](_0x202caf[_0xfd24('0x31')][_0xfd24('0x1b')]);_0x4ad335[_0xfd24('0x1a')]=qs[_0xfd24('0x1a')](_0x202caf[_0xfd24('0x31')]['offset']);}return _0x2973c3[_0xfd24('0x5a')](_0x4ad335);}})['then'](function(_0x2b2160){if(_0x2b2160){return _0x2b2160?{'count':_0x431e0b,'rows':_0x2b2160}:null;}})[_0xfd24('0x22')](respondWithResult(_0x9d4dae,null))[_0xfd24('0x45')](handleError(_0x9d4dae,null));};exports[_0xfd24('0x5b')]=function(_0x3e38f2,_0x565be1,_0x2a9a88){if(_0x3e38f2[_0xfd24('0x4a')]['id']){delete _0x3e38f2[_0xfd24('0x4a')]['id'];}return db[_0xfd24('0x2b')][_0xfd24('0x48')]({'where':{'id':_0x3e38f2[_0xfd24('0x52')]['id']}})[_0xfd24('0x22')](handleEntityNotFound(_0x565be1,null))['then'](function(_0x1a1670){if(_0x1a1670){_0x3e38f2[_0xfd24('0x4a')]['TriggerId']=_0x1a1670['id'];return db[_0xfd24('0x5c')]['create'](_0x3e38f2[_0xfd24('0x4a')]);}})[_0xfd24('0x22')](respondWithResult(_0x565be1,null))[_0xfd24('0x45')](handleError(_0x565be1,null));};exports[_0xfd24('0x5d')]=function(_0x5d6d9d,_0x25893e,_0x41b359){var _0x5b3682={};var _0x5955ed={};var _0xeb9107;var _0x274ded;return db[_0xfd24('0x2b')]['findOne']({'where':{'id':_0x5d6d9d[_0xfd24('0x52')]['id']}})[_0xfd24('0x22')](handleEntityNotFound(_0x25893e,null))[_0xfd24('0x22')](function(_0x46e887){if(_0x46e887){_0xeb9107=_0x46e887;_0x5955ed[_0xfd24('0x30')]=_[_0xfd24('0x32')](db['Action']['rawAttributes']);_0x5955ed[_0xfd24('0x31')]=_[_0xfd24('0x32')](_0x5d6d9d[_0xfd24('0x31')]);_0x5955ed[_0xfd24('0x3c')]=_['intersection'](_0x5955ed[_0xfd24('0x30')],_0x5955ed[_0xfd24('0x31')]);_0x5b3682[_0xfd24('0x34')]=_[_0xfd24('0x33')](_0x5955ed[_0xfd24('0x30')],qs[_0xfd24('0x35')](_0x5d6d9d[_0xfd24('0x31')][_0xfd24('0x35')]));_0x5b3682[_0xfd24('0x34')]=_0x5b3682[_0xfd24('0x34')][_0xfd24('0x36')]?_0x5b3682[_0xfd24('0x34')]:_0x5955ed['model'];_0x5b3682[_0xfd24('0x39')]=qs['sort'](_0x5d6d9d[_0xfd24('0x31')][_0xfd24('0x3a')]);_0x5b3682[_0xfd24('0x3b')]=qs[_0xfd24('0x3c')](_[_0xfd24('0x3d')](_0x5d6d9d[_0xfd24('0x31')],_0x5955ed['filters']));if(_0x5d6d9d[_0xfd24('0x31')][_0xfd24('0x3e')]){_0x5b3682['where']=_['merge'](_0x5b3682['where'],{'$or':_['map'](_0x5b3682[_0xfd24('0x34')],function(_0x12fff6){var _0x472b9a={};_0x472b9a[_0x12fff6]={'$like':'%'+_0x5d6d9d['query']['filter']+'%'};return _0x472b9a;})});}_0x5b3682=_['merge']({},_0x5b3682,_0x5d6d9d['options']);return _0xeb9107['getActions'](_0x5b3682);}})[_0xfd24('0x22')](function(_0x400728){if(_0x400728){_0x274ded=_0x400728['length'];if(!_0x5d6d9d[_0xfd24('0x31')][_0xfd24('0x37')](_0xfd24('0x38'))){_0x5b3682[_0xfd24('0x1b')]=qs['limit'](_0x5d6d9d[_0xfd24('0x31')][_0xfd24('0x1b')]);_0x5b3682[_0xfd24('0x1a')]=qs[_0xfd24('0x1a')](_0x5d6d9d[_0xfd24('0x31')][_0xfd24('0x1a')]);}return _0xeb9107[_0xfd24('0x5d')](_0x5b3682);}})[_0xfd24('0x22')](function(_0x4874cd){if(_0x4874cd){return _0x4874cd?{'count':_0x274ded,'rows':_0x4874cd}:null;}})[_0xfd24('0x22')](respondWithResult(_0x25893e,null))['catch'](handleError(_0x25893e,null));}; \ No newline at end of file +var _0xcd47=['set','Content-Range','json','apply','reject','update','then','destroy','get','Triggers','sendStatus','stack','name','send','index','Trigger','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','pick','getAnyConditions','findOne','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count'];(function(_0x115ef0,_0x5a83b2){var _0x420f5a=function(_0x102b2d){while(--_0x102b2d){_0x115ef0['push'](_0x115ef0['shift']());}};_0x420f5a(++_0x5a83b2);}(_0xcd47,0x9b));var _0x7cd4=function(_0x29f9af,_0x4f3d10){_0x29f9af=_0x29f9af-0x0;var _0x56e4a8=_0xcd47[_0x29f9af];return _0x56e4a8;};'use strict';var emlformat=require(_0x7cd4('0x0'));var rimraf=require(_0x7cd4('0x1'));var zipdir=require(_0x7cd4('0x2'));var jsonpatch=require(_0x7cd4('0x3'));var rp=require(_0x7cd4('0x4'));var moment=require(_0x7cd4('0x5'));var BPromise=require(_0x7cd4('0x6'));var Mustache=require('mustache');var util=require(_0x7cd4('0x7'));var path=require(_0x7cd4('0x8'));var sox=require('sox');var csv=require(_0x7cd4('0x9'));var ejs=require(_0x7cd4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7cd4('0xb'));var squel=require(_0x7cd4('0xc'));var crypto=require(_0x7cd4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7cd4('0x9'));var querystring=require(_0x7cd4('0xe'));var Papa=require(_0x7cd4('0xf'));var Redis=require(_0x7cd4('0x10'));var authService=require(_0x7cd4('0x11'));var qs=require(_0x7cd4('0x12'));var as=require(_0x7cd4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cd4('0x14'))('api');var utils=require(_0x7cd4('0x15'));var config=require(_0x7cd4('0x16'));var licenseUtil=require(_0x7cd4('0x17'));var db=require(_0x7cd4('0x18'))['db'];function respondWithStatusCode(_0x38d597,_0x18e11e){_0x18e11e=_0x18e11e||0xcc;return function(_0x113733){if(_0x113733){return _0x38d597['sendStatus'](_0x18e11e);}return _0x38d597[_0x7cd4('0x19')](_0x18e11e)[_0x7cd4('0x1a')]();};}function respondWithResult(_0x56c696,_0x56bf73){_0x56bf73=_0x56bf73||0xc8;return function(_0x2ac6e8){if(_0x2ac6e8){return _0x56c696[_0x7cd4('0x19')](_0x56bf73)['json'](_0x2ac6e8);}};}function respondWithFilteredResult(_0x545481,_0x3a5195){return function(_0x54a948){if(_0x54a948){var _0x22ebaf=typeof _0x3a5195[_0x7cd4('0x1b')]===_0x7cd4('0x1c')&&typeof _0x3a5195[_0x7cd4('0x1d')]==='undefined';var _0x402370=_0x54a948[_0x7cd4('0x1e')];var _0x972f88=_0x22ebaf?0x0:_0x3a5195[_0x7cd4('0x1b')];var _0x3dd086=_0x22ebaf?_0x54a948[_0x7cd4('0x1e')]:_0x3a5195[_0x7cd4('0x1b')]+_0x3a5195[_0x7cd4('0x1d')];var _0x3b5a5d;if(_0x3dd086>=_0x402370){_0x3dd086=_0x402370;_0x3b5a5d=0xc8;}else{_0x3b5a5d=0xce;}_0x545481[_0x7cd4('0x19')](_0x3b5a5d);return _0x545481[_0x7cd4('0x1f')](_0x7cd4('0x20'),_0x972f88+'-'+_0x3dd086+'/'+_0x402370)[_0x7cd4('0x21')](_0x54a948);}return null;};}function patchUpdates(_0x2d72be){return function(_0xf70eb5){try{jsonpatch[_0x7cd4('0x22')](_0xf70eb5,_0x2d72be,!![]);}catch(_0x3895ee){return BPromise[_0x7cd4('0x23')](_0x3895ee);}return _0xf70eb5['save']();};}function saveUpdates(_0x52cea9,_0x247868){return function(_0x3c3dc5){if(_0x3c3dc5){return _0x3c3dc5[_0x7cd4('0x24')](_0x52cea9)[_0x7cd4('0x25')](function(_0x453642){return _0x453642;});}return null;};}function removeEntity(_0x52a911,_0x263e9e){return function(_0x1657ec){if(_0x1657ec){return _0x1657ec[_0x7cd4('0x26')]()['then'](function(){var _0x4d49ca=_0x1657ec[_0x7cd4('0x27')]({'plain':!![]});var _0x17fb75=_0x7cd4('0x28');return db['UserProfileResource'][_0x7cd4('0x26')]({'where':{'type':_0x17fb75,'resourceId':_0x4d49ca['id']}})[_0x7cd4('0x25')](function(){return _0x1657ec;});})[_0x7cd4('0x25')](function(){_0x52a911['status'](0xcc)[_0x7cd4('0x1a')]();});}};}function handleEntityNotFound(_0x3d66dc,_0xbd1d74){return function(_0x40ae68){if(!_0x40ae68){_0x3d66dc[_0x7cd4('0x29')](0x194);}return _0x40ae68;};}function handleError(_0x205f71,_0x310b78){_0x310b78=_0x310b78||0x1f4;return function(_0x230184){logger['error'](_0x230184[_0x7cd4('0x2a')]);if(_0x230184[_0x7cd4('0x2b')]){delete _0x230184[_0x7cd4('0x2b')];}_0x205f71[_0x7cd4('0x19')](_0x310b78)[_0x7cd4('0x2c')](_0x230184);};}exports[_0x7cd4('0x2d')]=function(_0x5cc728,_0x4ff651){var _0x2ab4a3={},_0x370701={},_0x37fbb3={'count':0x0,'rows':[]};var _0x167bc8=_['map'](db[_0x7cd4('0x2e')][_0x7cd4('0x2f')],function(_0x309b8f){return{'name':_0x309b8f[_0x7cd4('0x30')],'type':_0x309b8f['type']['key']};});_0x370701[_0x7cd4('0x31')]=_[_0x7cd4('0x32')](_0x167bc8,_0x7cd4('0x2b'));_0x370701['query']=_[_0x7cd4('0x33')](_0x5cc728[_0x7cd4('0x34')]);_0x370701[_0x7cd4('0x35')]=_[_0x7cd4('0x36')](_0x370701[_0x7cd4('0x31')],_0x370701['query']);_0x2ab4a3[_0x7cd4('0x37')]=_[_0x7cd4('0x36')](_0x370701[_0x7cd4('0x31')],qs[_0x7cd4('0x38')](_0x5cc728['query'][_0x7cd4('0x38')]));_0x2ab4a3[_0x7cd4('0x37')]=_0x2ab4a3[_0x7cd4('0x37')][_0x7cd4('0x39')]?_0x2ab4a3[_0x7cd4('0x37')]:_0x370701['model'];if(!_0x5cc728[_0x7cd4('0x34')][_0x7cd4('0x3a')](_0x7cd4('0x3b'))){_0x2ab4a3[_0x7cd4('0x1d')]=qs[_0x7cd4('0x1d')](_0x5cc728['query'][_0x7cd4('0x1d')]);_0x2ab4a3[_0x7cd4('0x1b')]=qs[_0x7cd4('0x1b')](_0x5cc728[_0x7cd4('0x34')]['offset']);}_0x2ab4a3[_0x7cd4('0x3c')]=qs[_0x7cd4('0x3d')](_0x5cc728[_0x7cd4('0x34')][_0x7cd4('0x3d')]);_0x2ab4a3[_0x7cd4('0x3e')]=qs[_0x7cd4('0x35')](_['pick'](_0x5cc728[_0x7cd4('0x34')],_0x370701[_0x7cd4('0x35')]),_0x167bc8);if(_0x5cc728[_0x7cd4('0x34')][_0x7cd4('0x3f')]){_0x2ab4a3[_0x7cd4('0x3e')]=_[_0x7cd4('0x40')](_0x2ab4a3['where'],{'$or':_['map'](_0x167bc8,function(_0x3cd9cf){if(_0x3cd9cf['type']!==_0x7cd4('0x41')){var _0x5b5538={};_0x5b5538[_0x3cd9cf['name']]={'$like':'%'+_0x5cc728[_0x7cd4('0x34')][_0x7cd4('0x3f')]+'%'};return _0x5b5538;}})});}_0x2ab4a3=_[_0x7cd4('0x40')]({},_0x2ab4a3,_0x5cc728[_0x7cd4('0x42')]);var _0x262700={'where':_0x2ab4a3[_0x7cd4('0x3e')]};return db[_0x7cd4('0x2e')][_0x7cd4('0x1e')](_0x262700)[_0x7cd4('0x25')](function(_0x4de0a1){_0x37fbb3[_0x7cd4('0x1e')]=_0x4de0a1;if(_0x5cc728['query']['includeAll']){_0x2ab4a3[_0x7cd4('0x43')]=[{'all':!![]}];}return db['Trigger'][_0x7cd4('0x44')](_0x2ab4a3);})['then'](function(_0x4926f7){_0x37fbb3['rows']=_0x4926f7;return _0x37fbb3;})[_0x7cd4('0x25')](respondWithFilteredResult(_0x4ff651,_0x2ab4a3))[_0x7cd4('0x45')](handleError(_0x4ff651,null));};exports[_0x7cd4('0x46')]=function(_0x494169,_0x4a0b2a){var _0x409c0c={'raw':![],'where':{'id':_0x494169['params']['id']}},_0x43a224={};_0x43a224[_0x7cd4('0x31')]=_[_0x7cd4('0x33')](db[_0x7cd4('0x2e')][_0x7cd4('0x2f')]);_0x43a224[_0x7cd4('0x34')]=_[_0x7cd4('0x33')](_0x494169[_0x7cd4('0x34')]);_0x43a224[_0x7cd4('0x35')]=_[_0x7cd4('0x36')](_0x43a224[_0x7cd4('0x31')],_0x43a224[_0x7cd4('0x34')]);_0x409c0c[_0x7cd4('0x37')]=_['intersection'](_0x43a224[_0x7cd4('0x31')],qs[_0x7cd4('0x38')](_0x494169[_0x7cd4('0x34')]['fields']));_0x409c0c[_0x7cd4('0x37')]=_0x409c0c[_0x7cd4('0x37')][_0x7cd4('0x39')]?_0x409c0c[_0x7cd4('0x37')]:_0x43a224[_0x7cd4('0x31')];if(_0x494169[_0x7cd4('0x34')][_0x7cd4('0x47')]){_0x409c0c[_0x7cd4('0x43')]=[{'all':!![]}];}_0x409c0c=_[_0x7cd4('0x40')]({},_0x409c0c,_0x494169['options']);return db[_0x7cd4('0x2e')][_0x7cd4('0x48')](_0x409c0c)[_0x7cd4('0x25')](handleEntityNotFound(_0x4a0b2a,null))[_0x7cd4('0x25')](respondWithResult(_0x4a0b2a,null))[_0x7cd4('0x45')](handleError(_0x4a0b2a,null));};exports[_0x7cd4('0x49')]=function(_0x3d3b64,_0x504883){return db['Trigger'][_0x7cd4('0x49')](_0x3d3b64[_0x7cd4('0x4a')],{})[_0x7cd4('0x25')](function(_0x1eae6f){var _0x226e78=_0x3d3b64[_0x7cd4('0x4b')][_0x7cd4('0x27')]({'plain':!![]});if(!_0x226e78)throw new Error(_0x7cd4('0x4c'));if(_0x226e78['role']===_0x7cd4('0x4b')){var _0x3b7652=_0x1eae6f[_0x7cd4('0x27')]({'plain':!![]});var _0x1eacff=_0x7cd4('0x28');return db[_0x7cd4('0x4d')]['find']({'where':{'name':_0x1eacff,'userProfileId':_0x226e78[_0x7cd4('0x4e')]},'raw':!![]})[_0x7cd4('0x25')](function(_0x13f4f8){if(_0x13f4f8&&_0x13f4f8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3b7652[_0x7cd4('0x2b')],'resourceId':_0x3b7652['id'],'type':_0x13f4f8['name'],'sectionId':_0x13f4f8['id']},{})['then'](function(){return _0x1eae6f;});}else{return _0x1eae6f;}})[_0x7cd4('0x45')](function(_0x40215a){logger[_0x7cd4('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40215a);throw _0x40215a;});}return _0x1eae6f;})[_0x7cd4('0x25')](respondWithResult(_0x504883,0xc9))[_0x7cd4('0x45')](handleError(_0x504883,null));};exports[_0x7cd4('0x24')]=function(_0x1ceef5,_0x4c1910){if(_0x1ceef5[_0x7cd4('0x4a')]['id']){delete _0x1ceef5[_0x7cd4('0x4a')]['id'];}return db[_0x7cd4('0x2e')][_0x7cd4('0x48')]({'where':{'id':_0x1ceef5[_0x7cd4('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c1910,null))['then'](saveUpdates(_0x1ceef5[_0x7cd4('0x4a')],null))[_0x7cd4('0x25')](respondWithResult(_0x4c1910,null))[_0x7cd4('0x45')](handleError(_0x4c1910,null));};exports[_0x7cd4('0x26')]=function(_0x196ebd,_0x32cf7e){return db['Trigger'][_0x7cd4('0x48')]({'where':{'id':_0x196ebd[_0x7cd4('0x50')]['id']}})[_0x7cd4('0x25')](handleEntityNotFound(_0x32cf7e,null))['then'](removeEntity(_0x32cf7e,null))[_0x7cd4('0x45')](handleError(_0x32cf7e,null));};exports[_0x7cd4('0x51')]=function(_0x5c8745,_0x5a2738,_0x9426a4){if(_0x5c8745[_0x7cd4('0x4a')]['id']){delete _0x5c8745['body']['id'];}return db[_0x7cd4('0x2e')]['find']({'where':{'id':_0x5c8745['params']['id']}})['then'](handleEntityNotFound(_0x5a2738,null))['then'](function(_0x141e6a){if(_0x141e6a){_0x5c8745['body'][_0x7cd4('0x52')]=_0x141e6a['id'];return db[_0x7cd4('0x53')][_0x7cd4('0x49')](_0x5c8745[_0x7cd4('0x4a')]);}})['then'](respondWithResult(_0x5a2738,null))[_0x7cd4('0x45')](handleError(_0x5a2738,null));};exports[_0x7cd4('0x54')]=function(_0xb9d9a3,_0x3950cc,_0x4080e2){if(_0xb9d9a3[_0x7cd4('0x4a')]['id']){delete _0xb9d9a3[_0x7cd4('0x4a')]['id'];}return db[_0x7cd4('0x2e')][_0x7cd4('0x48')]({'where':{'id':_0xb9d9a3['params']['id']}})[_0x7cd4('0x25')](handleEntityNotFound(_0x3950cc,null))[_0x7cd4('0x25')](function(_0x105426){if(_0x105426){_0xb9d9a3['body'][_0x7cd4('0x55')]=_0x105426['id'];return db[_0x7cd4('0x53')][_0x7cd4('0x49')](_0xb9d9a3[_0x7cd4('0x4a')]);}})['then'](respondWithResult(_0x3950cc,null))[_0x7cd4('0x45')](handleError(_0x3950cc,null));};exports[_0x7cd4('0x56')]=function(_0x16cb29,_0x14845c,_0x4a4db4){var _0x55c588={};var _0x6332cb={};var _0x40092e;var _0x1dd563;return db[_0x7cd4('0x2e')]['findOne']({'where':{'id':_0x16cb29[_0x7cd4('0x50')]['id']}})[_0x7cd4('0x25')](handleEntityNotFound(_0x14845c,null))[_0x7cd4('0x25')](function(_0x30bc32){if(_0x30bc32){_0x40092e=_0x30bc32;_0x6332cb[_0x7cd4('0x31')]=_[_0x7cd4('0x33')](db[_0x7cd4('0x53')]['rawAttributes']);_0x6332cb['query']=_[_0x7cd4('0x33')](_0x16cb29[_0x7cd4('0x34')]);_0x6332cb[_0x7cd4('0x35')]=_[_0x7cd4('0x36')](_0x6332cb[_0x7cd4('0x31')],_0x6332cb[_0x7cd4('0x34')]);_0x55c588[_0x7cd4('0x37')]=_[_0x7cd4('0x36')](_0x6332cb[_0x7cd4('0x31')],qs[_0x7cd4('0x38')](_0x16cb29[_0x7cd4('0x34')]['fields']));_0x55c588[_0x7cd4('0x37')]=_0x55c588['attributes']['length']?_0x55c588[_0x7cd4('0x37')]:_0x6332cb[_0x7cd4('0x31')];_0x55c588[_0x7cd4('0x3c')]=qs[_0x7cd4('0x3d')](_0x16cb29[_0x7cd4('0x34')][_0x7cd4('0x3d')]);_0x55c588[_0x7cd4('0x3e')]=qs[_0x7cd4('0x35')](_[_0x7cd4('0x57')](_0x16cb29[_0x7cd4('0x34')],_0x6332cb[_0x7cd4('0x35')]));if(_0x16cb29['query'][_0x7cd4('0x3f')]){_0x55c588['where']=_[_0x7cd4('0x40')](_0x55c588[_0x7cd4('0x3e')],{'$or':_[_0x7cd4('0x32')](_0x55c588['attributes'],function(_0x5577a2){var _0x22436a={};_0x22436a[_0x5577a2]={'$like':'%'+_0x16cb29[_0x7cd4('0x34')]['filter']+'%'};return _0x22436a;})});}_0x55c588=_[_0x7cd4('0x40')]({},_0x55c588,_0x16cb29[_0x7cd4('0x42')]);return _0x40092e['getAllConditions'](_0x55c588);}})[_0x7cd4('0x25')](function(_0x2c7dae){if(_0x2c7dae){_0x1dd563=_0x2c7dae['length'];if(!_0x16cb29[_0x7cd4('0x34')][_0x7cd4('0x3a')](_0x7cd4('0x3b'))){_0x55c588['limit']=qs[_0x7cd4('0x1d')](_0x16cb29[_0x7cd4('0x34')][_0x7cd4('0x1d')]);_0x55c588[_0x7cd4('0x1b')]=qs['offset'](_0x16cb29[_0x7cd4('0x34')]['offset']);}return _0x40092e[_0x7cd4('0x56')](_0x55c588);}})['then'](function(_0x4dbe87){if(_0x4dbe87){return _0x4dbe87?{'count':_0x1dd563,'rows':_0x4dbe87}:null;}})['then'](respondWithResult(_0x14845c,null))[_0x7cd4('0x45')](handleError(_0x14845c,null));};exports[_0x7cd4('0x58')]=function(_0x1e67ed,_0x4958c4,_0x50fa30){var _0x139c6d={};var _0x50efe6={};var _0x5d0f98;var _0x300de0;return db[_0x7cd4('0x2e')][_0x7cd4('0x59')]({'where':{'id':_0x1e67ed[_0x7cd4('0x50')]['id']}})['then'](handleEntityNotFound(_0x4958c4,null))['then'](function(_0x819d2c){if(_0x819d2c){_0x5d0f98=_0x819d2c;_0x50efe6['model']=_[_0x7cd4('0x33')](db[_0x7cd4('0x53')][_0x7cd4('0x2f')]);_0x50efe6[_0x7cd4('0x34')]=_['keys'](_0x1e67ed[_0x7cd4('0x34')]);_0x50efe6[_0x7cd4('0x35')]=_[_0x7cd4('0x36')](_0x50efe6[_0x7cd4('0x31')],_0x50efe6[_0x7cd4('0x34')]);_0x139c6d[_0x7cd4('0x37')]=_['intersection'](_0x50efe6[_0x7cd4('0x31')],qs['fields'](_0x1e67ed[_0x7cd4('0x34')][_0x7cd4('0x38')]));_0x139c6d['attributes']=_0x139c6d[_0x7cd4('0x37')][_0x7cd4('0x39')]?_0x139c6d[_0x7cd4('0x37')]:_0x50efe6[_0x7cd4('0x31')];_0x139c6d[_0x7cd4('0x3c')]=qs[_0x7cd4('0x3d')](_0x1e67ed[_0x7cd4('0x34')][_0x7cd4('0x3d')]);_0x139c6d['where']=qs['filters'](_[_0x7cd4('0x57')](_0x1e67ed[_0x7cd4('0x34')],_0x50efe6[_0x7cd4('0x35')]));if(_0x1e67ed['query'][_0x7cd4('0x3f')]){_0x139c6d[_0x7cd4('0x3e')]=_['merge'](_0x139c6d[_0x7cd4('0x3e')],{'$or':_['map'](_0x139c6d[_0x7cd4('0x37')],function(_0x14936b){var _0x43fb16={};_0x43fb16[_0x14936b]={'$like':'%'+_0x1e67ed[_0x7cd4('0x34')][_0x7cd4('0x3f')]+'%'};return _0x43fb16;})});}_0x139c6d=_[_0x7cd4('0x40')]({},_0x139c6d,_0x1e67ed[_0x7cd4('0x42')]);return _0x5d0f98['getAnyConditions'](_0x139c6d);}})[_0x7cd4('0x25')](function(_0x4c9ff6){if(_0x4c9ff6){_0x300de0=_0x4c9ff6[_0x7cd4('0x39')];if(!_0x1e67ed[_0x7cd4('0x34')][_0x7cd4('0x3a')](_0x7cd4('0x3b'))){_0x139c6d['limit']=qs[_0x7cd4('0x1d')](_0x1e67ed['query'][_0x7cd4('0x1d')]);_0x139c6d[_0x7cd4('0x1b')]=qs[_0x7cd4('0x1b')](_0x1e67ed[_0x7cd4('0x34')]['offset']);}return _0x5d0f98[_0x7cd4('0x58')](_0x139c6d);}})['then'](function(_0x2ab089){if(_0x2ab089){return _0x2ab089?{'count':_0x300de0,'rows':_0x2ab089}:null;}})[_0x7cd4('0x25')](respondWithResult(_0x4958c4,null))[_0x7cd4('0x45')](handleError(_0x4958c4,null));};exports[_0x7cd4('0x5a')]=function(_0x3a2701,_0x13fb9c,_0x299542){if(_0x3a2701[_0x7cd4('0x4a')]['id']){delete _0x3a2701['body']['id'];}return db[_0x7cd4('0x2e')]['find']({'where':{'id':_0x3a2701['params']['id']}})[_0x7cd4('0x25')](handleEntityNotFound(_0x13fb9c,null))[_0x7cd4('0x25')](function(_0x40a2aa){if(_0x40a2aa){_0x3a2701['body']['TriggerId']=_0x40a2aa['id'];return db[_0x7cd4('0x5b')][_0x7cd4('0x49')](_0x3a2701[_0x7cd4('0x4a')]);}})['then'](respondWithResult(_0x13fb9c,null))[_0x7cd4('0x45')](handleError(_0x13fb9c,null));};exports[_0x7cd4('0x5c')]=function(_0x35da7a,_0x177efb,_0x98ee36){var _0x26d2b6={};var _0x34b33f={};var _0x17ee58;var _0x3c0238;return db[_0x7cd4('0x2e')][_0x7cd4('0x59')]({'where':{'id':_0x35da7a[_0x7cd4('0x50')]['id']}})[_0x7cd4('0x25')](handleEntityNotFound(_0x177efb,null))[_0x7cd4('0x25')](function(_0x19ae24){if(_0x19ae24){_0x17ee58=_0x19ae24;_0x34b33f[_0x7cd4('0x31')]=_['keys'](db['Action'][_0x7cd4('0x2f')]);_0x34b33f[_0x7cd4('0x34')]=_[_0x7cd4('0x33')](_0x35da7a[_0x7cd4('0x34')]);_0x34b33f[_0x7cd4('0x35')]=_[_0x7cd4('0x36')](_0x34b33f[_0x7cd4('0x31')],_0x34b33f[_0x7cd4('0x34')]);_0x26d2b6[_0x7cd4('0x37')]=_[_0x7cd4('0x36')](_0x34b33f[_0x7cd4('0x31')],qs['fields'](_0x35da7a[_0x7cd4('0x34')][_0x7cd4('0x38')]));_0x26d2b6['attributes']=_0x26d2b6[_0x7cd4('0x37')][_0x7cd4('0x39')]?_0x26d2b6[_0x7cd4('0x37')]:_0x34b33f[_0x7cd4('0x31')];_0x26d2b6[_0x7cd4('0x3c')]=qs[_0x7cd4('0x3d')](_0x35da7a[_0x7cd4('0x34')][_0x7cd4('0x3d')]);_0x26d2b6[_0x7cd4('0x3e')]=qs[_0x7cd4('0x35')](_[_0x7cd4('0x57')](_0x35da7a[_0x7cd4('0x34')],_0x34b33f[_0x7cd4('0x35')]));if(_0x35da7a[_0x7cd4('0x34')][_0x7cd4('0x3f')]){_0x26d2b6[_0x7cd4('0x3e')]=_[_0x7cd4('0x40')](_0x26d2b6['where'],{'$or':_[_0x7cd4('0x32')](_0x26d2b6[_0x7cd4('0x37')],function(_0x3cc604){var _0x515fd5={};_0x515fd5[_0x3cc604]={'$like':'%'+_0x35da7a[_0x7cd4('0x34')][_0x7cd4('0x3f')]+'%'};return _0x515fd5;})});}_0x26d2b6=_[_0x7cd4('0x40')]({},_0x26d2b6,_0x35da7a[_0x7cd4('0x42')]);return _0x17ee58[_0x7cd4('0x5c')](_0x26d2b6);}})['then'](function(_0x1d5bc1){if(_0x1d5bc1){_0x3c0238=_0x1d5bc1[_0x7cd4('0x39')];if(!_0x35da7a[_0x7cd4('0x34')][_0x7cd4('0x3a')]('nolimit')){_0x26d2b6[_0x7cd4('0x1d')]=qs[_0x7cd4('0x1d')](_0x35da7a['query']['limit']);_0x26d2b6[_0x7cd4('0x1b')]=qs[_0x7cd4('0x1b')](_0x35da7a['query'][_0x7cd4('0x1b')]);}return _0x17ee58[_0x7cd4('0x5c')](_0x26d2b6);}})[_0x7cd4('0x25')](function(_0x574bbc){if(_0x574bbc){return _0x574bbc?{'count':_0x3c0238,'rows':_0x574bbc}:null;}})[_0x7cd4('0x25')](respondWithResult(_0x177efb,null))['catch'](handleError(_0x177efb,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e4c0542..72ecb6f 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 _0xf185=['define','Trigger','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports'];(function(_0x3473bf,_0x23479e){var _0x34c129=function(_0x4d4e41){while(--_0x4d4e41){_0x3473bf['push'](_0x3473bf['shift']());}};_0x34c129(++_0x23479e);}(_0xf185,0x1be));var _0x5f18=function(_0x504cde,_0x8c1b3d){_0x504cde=_0x504cde-0x0;var _0x18d482=_0xf185[_0x504cde];return _0x18d482;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var logger=require(_0x5f18('0x1'))(_0x5f18('0x2'));var moment=require(_0x5f18('0x3'));var BPromise=require(_0x5f18('0x4'));var rp=require(_0x5f18('0x5'));var fs=require('fs');var path=require(_0x5f18('0x6'));var rimraf=require('rimraf');var config=require(_0x5f18('0x7'));var attributes=require(_0x5f18('0x8'));module[_0x5f18('0x9')]=function(_0x1cac08,_0x5b7cc5){return _0x1cac08[_0x5f18('0xa')](_0x5f18('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323b=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','tools_triggers'];(function(_0x32040a,_0x442fed){var _0x5a0a8b=function(_0x50e682){while(--_0x50e682){_0x32040a['push'](_0x32040a['shift']());}};_0x5a0a8b(++_0x442fed);}(_0x323b,0x1ad));var _0xb323=function(_0x11e4ee,_0x699629){_0x11e4ee=_0x11e4ee-0x0;var _0x36ccd3=_0x323b[_0x11e4ee];return _0x36ccd3;};'use strict';var _=require(_0xb323('0x0'));var util=require('util');var logger=require(_0xb323('0x1'))(_0xb323('0x2'));var moment=require(_0xb323('0x3'));var BPromise=require('bluebird');var rp=require(_0xb323('0x4'));var fs=require('fs');var path=require(_0xb323('0x5'));var rimraf=require(_0xb323('0x6'));var config=require(_0xb323('0x7'));var attributes=require(_0xb323('0x8'));module[_0xb323('0x9')]=function(_0x142b9b,_0x4620a0){return _0x142b9b['define']('Trigger',attributes,{'tableName':_0xb323('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index d61d7c2..52c464f 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 _0x9ed7=['GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','debug','catch','ShowTrigger','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','request\x20sent','result'];(function(_0x4f42a6,_0x5b4339){var _0x1258b1=function(_0x4fd959){while(--_0x4fd959){_0x4f42a6['push'](_0x4f42a6['shift']());}};_0x1258b1(++_0x5b4339);}(_0x9ed7,0x16d));var _0x79ed=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x9ed7[_0x5a7e78];return _0xa8d4a1;};'use strict';var _=require(_0x79ed('0x0'));var util=require('util');var moment=require(_0x79ed('0x1'));var BPromise=require(_0x79ed('0x2'));var rs=require(_0x79ed('0x3'));var fs=require('fs');var Redis=require(_0x79ed('0x4'));var db=require(_0x79ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x79ed('0x6'))(_0x79ed('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x79ed('0x8')][_0x79ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26fc5c,_0x362865,_0x1da9b3){return new BPromise(function(_0x59b4c5,_0xafacc6){return client[_0x79ed('0xa')](_0x26fc5c,_0x1da9b3)['then'](function(_0x394eb3){logger['info']('Trigger,\x20%s,\x20%s',_0x362865,'request\x20sent');logger['debug'](_0x79ed('0xb'),_0x362865,'request\x20sent',JSON[_0x79ed('0xc')](_0x394eb3));if(_0x394eb3[_0x79ed('0xd')]){if(_0x394eb3[_0x79ed('0xd')][_0x79ed('0xe')]===0x1f4){logger[_0x79ed('0xd')](_0x79ed('0xf'),_0x362865,_0x394eb3[_0x79ed('0xd')]['message']);return _0xafacc6(_0x394eb3[_0x79ed('0xd')][_0x79ed('0x10')]);}logger[_0x79ed('0xd')](_0x79ed('0xf'),_0x362865,_0x394eb3['error'][_0x79ed('0x10')]);return _0x59b4c5(_0x394eb3[_0x79ed('0xd')][_0x79ed('0x10')]);}else{logger[_0x79ed('0x11')](_0x79ed('0xf'),_0x362865,_0x79ed('0x12'));_0x59b4c5(_0x394eb3[_0x79ed('0x13')]['message']);}})['catch'](function(_0x335e27){logger[_0x79ed('0xd')]('Trigger,\x20%s,\x20%s',_0x362865,_0x335e27);_0xafacc6(_0x335e27);});});}exports[_0x79ed('0x14')]=function(_0x4db41d){var _0x166a4d=this;return new Promise(function(_0x1b279d,_0x4a658a){return db[_0x79ed('0x15')][_0x79ed('0x16')]({'raw':_0x4db41d[_0x79ed('0x17')]?_0x4db41d[_0x79ed('0x17')][_0x79ed('0x18')]===undefined?!![]:![]:!![],'where':_0x4db41d[_0x79ed('0x17')]?_0x4db41d['options']['where']||null:null,'attributes':_0x4db41d['options']?_0x4db41d[_0x79ed('0x17')][_0x79ed('0x19')]||null:null,'limit':_0x4db41d[_0x79ed('0x17')]?_0x4db41d[_0x79ed('0x17')][_0x79ed('0x1a')]||null:null,'include':_0x4db41d['options']?_0x4db41d[_0x79ed('0x17')][_0x79ed('0x1b')]?_[_0x79ed('0x1c')](_0x4db41d['options'][_0x79ed('0x1b')],function(_0x5bb4fc){return{'model':db[_0x5bb4fc[_0x79ed('0x1d')]],'as':_0x5bb4fc['as'],'attributes':_0x5bb4fc['attributes'],'include':_0x5bb4fc[_0x79ed('0x1b')]?_[_0x79ed('0x1c')](_0x5bb4fc[_0x79ed('0x1b')],function(_0x15b872){return{'model':db[_0x15b872['model']],'as':_0x15b872['as'],'attributes':_0x15b872['attributes'],'include':_0x15b872[_0x79ed('0x1b')]?_[_0x79ed('0x1c')](_0x15b872['include'],function(_0x4af85c){return{'model':db[_0x4af85c[_0x79ed('0x1d')]],'as':_0x4af85c['as'],'attributes':_0x4af85c[_0x79ed('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x389163){logger[_0x79ed('0x11')]('GetTrigger',_0x4db41d);logger[_0x79ed('0x1e')]('GetTrigger',_0x4db41d,JSON[_0x79ed('0xc')](_0x389163));_0x1b279d(_0x389163);})[_0x79ed('0x1f')](function(_0x5f13a1){logger[_0x79ed('0xd')](_0x79ed('0x14'),_0x5f13a1[_0x79ed('0x10')],_0x4db41d);_0x4a658a(_0x166a4d[_0x79ed('0xd')](0x1f4,_0x5f13a1[_0x79ed('0x10')]));});});};exports[_0x79ed('0x20')]=function(_0x439508){var _0x44d269=this;return new Promise(function(_0x2f7eab,_0x52e1f2){return db['Trigger'][_0x79ed('0x21')]({'raw':_0x439508[_0x79ed('0x17')]?_0x439508['options'][_0x79ed('0x18')]===undefined?!![]:![]:!![],'where':_0x439508['options']?_0x439508[_0x79ed('0x17')]['where']||null:null,'attributes':_0x439508['options']?_0x439508[_0x79ed('0x17')][_0x79ed('0x19')]||null:null,'include':_0x439508[_0x79ed('0x17')]?_0x439508['options']['include']?_[_0x79ed('0x1c')](_0x439508['options']['include'],function(_0x47d072){return{'model':db[_0x47d072['model']],'as':_0x47d072['as'],'attributes':_0x47d072[_0x79ed('0x19')],'include':_0x47d072[_0x79ed('0x1b')]?_[_0x79ed('0x1c')](_0x47d072[_0x79ed('0x1b')],function(_0xcc94eb){return{'model':db[_0xcc94eb[_0x79ed('0x1d')]],'as':_0xcc94eb['as'],'attributes':_0xcc94eb[_0x79ed('0x19')],'include':_0xcc94eb['include']?_[_0x79ed('0x1c')](_0xcc94eb[_0x79ed('0x1b')],function(_0xba9e51){return{'model':db[_0xba9e51[_0x79ed('0x1d')]],'as':_0xba9e51['as'],'attributes':_0xba9e51[_0x79ed('0x19')]};}):[]};}):[]};}):[]:[]})[_0x79ed('0x22')](function(_0x455b13){logger[_0x79ed('0x11')]('ShowTrigger',_0x439508);logger['debug'](_0x79ed('0x20'),_0x439508,JSON[_0x79ed('0xc')](_0x455b13));_0x2f7eab(_0x455b13);})[_0x79ed('0x1f')](function(_0x7781fa){logger[_0x79ed('0xd')](_0x79ed('0x20'),_0x7781fa[_0x79ed('0x10')],_0x439508);_0x52e1f2(_0x44d269[_0x79ed('0xd')](0x1f4,_0x7781fa[_0x79ed('0x10')]));});});}; \ No newline at end of file +var _0xecd2=['Trigger,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetTrigger','options','raw','attributes','limit','include','model','map','stringify','ShowTrigger','Trigger','find','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5ecff9,_0x473070){var _0x5e1415=function(_0x3c34a1){while(--_0x3c34a1){_0x5ecff9['push'](_0x5ecff9['shift']());}};_0x5e1415(++_0x473070);}(_0xecd2,0x1ab));var _0x2ecd=function(_0x1e40c2,_0x4c8ae6){_0x1e40c2=_0x1e40c2-0x0;var _0x53ce9f=_0xecd2[_0x1e40c2];return _0x53ce9f;};'use strict';var _=require(_0x2ecd('0x0'));var util=require(_0x2ecd('0x1'));var moment=require(_0x2ecd('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ecd('0x3'));var fs=require('fs');var Redis=require(_0x2ecd('0x4'));var db=require(_0x2ecd('0x5'))['db'];var utils=require(_0x2ecd('0x6'));var logger=require('../../config/logger')(_0x2ecd('0x7'));var config=require(_0x2ecd('0x8'));var jayson=require(_0x2ecd('0x9'));var client=jayson[_0x2ecd('0xa')][_0x2ecd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1de1ca,_0x2c5ae0,_0x4a71b3){return new BPromise(function(_0x3d7246,_0x2a3fed){return client[_0x2ecd('0xc')](_0x1de1ca,_0x4a71b3)[_0x2ecd('0xd')](function(_0x292325){logger[_0x2ecd('0xe')](_0x2ecd('0xf'),_0x2c5ae0,_0x2ecd('0x10'));logger[_0x2ecd('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x2c5ae0,'request\x20sent',JSON['stringify'](_0x292325));if(_0x292325['error']){if(_0x292325[_0x2ecd('0x12')]['code']===0x1f4){logger[_0x2ecd('0x12')](_0x2ecd('0xf'),_0x2c5ae0,_0x292325[_0x2ecd('0x12')][_0x2ecd('0x13')]);return _0x2a3fed(_0x292325[_0x2ecd('0x12')][_0x2ecd('0x13')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x2c5ae0,_0x292325[_0x2ecd('0x12')]['message']);return _0x3d7246(_0x292325[_0x2ecd('0x12')][_0x2ecd('0x13')]);}else{logger[_0x2ecd('0xe')]('Trigger,\x20%s,\x20%s',_0x2c5ae0,_0x2ecd('0x10'));_0x3d7246(_0x292325[_0x2ecd('0x14')][_0x2ecd('0x13')]);}})['catch'](function(_0x4ac738){logger[_0x2ecd('0x12')](_0x2ecd('0xf'),_0x2c5ae0,_0x4ac738);_0x2a3fed(_0x4ac738);});});}exports[_0x2ecd('0x15')]=function(_0x1e7f79){var _0x47492e=this;return new Promise(function(_0x31d033,_0x522aa8){return db['Trigger']['findAll']({'raw':_0x1e7f79[_0x2ecd('0x16')]?_0x1e7f79[_0x2ecd('0x16')][_0x2ecd('0x17')]===undefined?!![]:![]:!![],'where':_0x1e7f79['options']?_0x1e7f79[_0x2ecd('0x16')]['where']||null:null,'attributes':_0x1e7f79['options']?_0x1e7f79[_0x2ecd('0x16')][_0x2ecd('0x18')]||null:null,'limit':_0x1e7f79[_0x2ecd('0x16')]?_0x1e7f79[_0x2ecd('0x16')][_0x2ecd('0x19')]||null:null,'include':_0x1e7f79[_0x2ecd('0x16')]?_0x1e7f79[_0x2ecd('0x16')][_0x2ecd('0x1a')]?_['map'](_0x1e7f79[_0x2ecd('0x16')][_0x2ecd('0x1a')],function(_0x4882fa){return{'model':db[_0x4882fa[_0x2ecd('0x1b')]],'as':_0x4882fa['as'],'attributes':_0x4882fa[_0x2ecd('0x18')],'include':_0x4882fa[_0x2ecd('0x1a')]?_[_0x2ecd('0x1c')](_0x4882fa[_0x2ecd('0x1a')],function(_0x260135){return{'model':db[_0x260135[_0x2ecd('0x1b')]],'as':_0x260135['as'],'attributes':_0x260135['attributes'],'include':_0x260135[_0x2ecd('0x1a')]?_[_0x2ecd('0x1c')](_0x260135['include'],function(_0x5d36fb){return{'model':db[_0x5d36fb[_0x2ecd('0x1b')]],'as':_0x5d36fb['as'],'attributes':_0x5d36fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ecd('0xd')](function(_0x584beb){logger[_0x2ecd('0xe')](_0x2ecd('0x15'),_0x1e7f79);logger[_0x2ecd('0x11')](_0x2ecd('0x15'),_0x1e7f79,JSON[_0x2ecd('0x1d')](_0x584beb));_0x31d033(_0x584beb);})['catch'](function(_0x4d709b){logger[_0x2ecd('0x12')](_0x2ecd('0x15'),_0x4d709b['message'],_0x1e7f79);_0x522aa8(_0x47492e['error'](0x1f4,_0x4d709b['message']));});});};exports[_0x2ecd('0x1e')]=function(_0x1c8df0){var _0xd3e5ac=this;return new Promise(function(_0x22f145,_0x3a3bb0){return db[_0x2ecd('0x1f')][_0x2ecd('0x20')]({'raw':_0x1c8df0[_0x2ecd('0x16')]?_0x1c8df0[_0x2ecd('0x16')][_0x2ecd('0x17')]===undefined?!![]:![]:!![],'where':_0x1c8df0['options']?_0x1c8df0['options']['where']||null:null,'attributes':_0x1c8df0[_0x2ecd('0x16')]?_0x1c8df0['options'][_0x2ecd('0x18')]||null:null,'include':_0x1c8df0[_0x2ecd('0x16')]?_0x1c8df0[_0x2ecd('0x16')][_0x2ecd('0x1a')]?_[_0x2ecd('0x1c')](_0x1c8df0[_0x2ecd('0x16')][_0x2ecd('0x1a')],function(_0x36ef49){return{'model':db[_0x36ef49[_0x2ecd('0x1b')]],'as':_0x36ef49['as'],'attributes':_0x36ef49[_0x2ecd('0x18')],'include':_0x36ef49['include']?_['map'](_0x36ef49[_0x2ecd('0x1a')],function(_0x1a491a){return{'model':db[_0x1a491a[_0x2ecd('0x1b')]],'as':_0x1a491a['as'],'attributes':_0x1a491a[_0x2ecd('0x18')],'include':_0x1a491a[_0x2ecd('0x1a')]?_[_0x2ecd('0x1c')](_0x1a491a[_0x2ecd('0x1a')],function(_0x3a86fb){return{'model':db[_0x3a86fb['model']],'as':_0x3a86fb['as'],'attributes':_0x3a86fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ecd('0xd')](function(_0x5784d2){logger[_0x2ecd('0xe')](_0x2ecd('0x1e'),_0x1c8df0);logger[_0x2ecd('0x11')]('ShowTrigger',_0x1c8df0,JSON['stringify'](_0x5784d2));_0x22f145(_0x5784d2);})[_0x2ecd('0x21')](function(_0x1327e9){logger[_0x2ecd('0x12')](_0x2ecd('0x1e'),_0x1327e9[_0x2ecd('0x13')],_0x1c8df0);_0x3a3bb0(_0xd3e5ac[_0x2ecd('0x12')](0x1f4,_0x1327e9[_0x2ecd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 890d800..18aae38 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 _0x4324=['clone','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x53df3e,_0x59a21f){var _0x843503=function(_0x10674c){while(--_0x10674c){_0x53df3e['push'](_0x53df3e['shift']());}};_0x843503(++_0x59a21f);}(_0x4324,0x1d6));var _0x4432=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0x4324[_0x481af3];return _0x3354ea;};'use strict';var multer=require('multer');var util=require(_0x4432('0x0'));var path=require(_0x4432('0x1'));var timeout=require(_0x4432('0x2'));var express=require(_0x4432('0x3'));var router=express['Router']();var fs_extra=require(_0x4432('0x4'));var auth=require(_0x4432('0x5'));var interaction=require(_0x4432('0x6'));var config=require(_0x4432('0x7'));var controller=require('./trunk.controller');router[_0x4432('0x8')]('/',auth[_0x4432('0x9')](),controller[_0x4432('0xa')]);router[_0x4432('0x8')](_0x4432('0xb'),auth[_0x4432('0x9')](),controller[_0x4432('0xc')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x4432('0xd')]);router[_0x4432('0xe')]('/',auth[_0x4432('0x9')](),controller[_0x4432('0xf')]);router[_0x4432('0x10')]('/:id',auth[_0x4432('0x9')](),controller[_0x4432('0x11')]);router[_0x4432('0x12')](_0x4432('0xb'),auth['isAuthenticated'](),controller[_0x4432('0x13')]);module[_0x4432('0x14')]=router; \ No newline at end of file +var _0xa7d9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','delete','destroy'];(function(_0x351c8a,_0x5dc292){var _0x4767fa=function(_0x118183){while(--_0x118183){_0x351c8a['push'](_0x351c8a['shift']());}};_0x4767fa(++_0x5dc292);}(_0xa7d9,0xe7));var _0x9a7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9a7d('0x0'));var util=require(_0x9a7d('0x1'));var path=require(_0x9a7d('0x2'));var timeout=require(_0x9a7d('0x3'));var express=require(_0x9a7d('0x4'));var router=express[_0x9a7d('0x5')]();var fs_extra=require(_0x9a7d('0x6'));var auth=require(_0x9a7d('0x7'));var interaction=require(_0x9a7d('0x8'));var config=require(_0x9a7d('0x9'));var controller=require(_0x9a7d('0xa'));router[_0x9a7d('0xb')]('/',auth[_0x9a7d('0xc')](),controller[_0x9a7d('0xd')]);router[_0x9a7d('0xb')](_0x9a7d('0xe'),auth[_0x9a7d('0xc')](),controller['show']);router[_0x9a7d('0xf')](_0x9a7d('0x10'),auth[_0x9a7d('0xc')](),controller[_0x9a7d('0x11')]);router[_0x9a7d('0xf')]('/',auth['isAuthenticated'](),controller[_0x9a7d('0x12')]);router[_0x9a7d('0x13')](_0x9a7d('0xe'),auth[_0x9a7d('0xc')](),controller['update']);router[_0x9a7d('0x14')](_0x9a7d('0xe'),auth[_0x9a7d('0xc')](),controller[_0x9a7d('0x15')]);module[_0x9a7d('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 017863b..5568160 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 _0x1d66=['passive','actpass','BOOLEAN','STRING','user','friend','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active'];(function(_0x35b26e,_0xb141f1){var _0x3efe3d=function(_0x49e5c6){while(--_0x49e5c6){_0x35b26e['push'](_0x35b26e['shift']());}};_0x3efe3d(++_0xb141f1);}(_0x1d66,0xfd));var _0x61d6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1d66[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x61d6('0x0')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x61d6('0x1'),'peer'),'allowNull':![],'defaultValue':_0x61d6('0x2')},'context':{'type':Sequelize[_0x61d6('0x0')],'allowNull':![],'defaultValue':_0x61d6('0x3')},'callingpres':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x5'),_0x61d6('0x6'),_0x61d6('0x7'),_0x61d6('0x8'),_0x61d6('0x9'),_0x61d6('0xa'),_0x61d6('0xb'),_0x61d6('0xc'))},'deny':{'type':Sequelize[_0x61d6('0x0')]},'permit':{'type':Sequelize[_0x61d6('0x0')]},'secret':{'type':Sequelize[_0x61d6('0x0')]},'md5secret':{'type':Sequelize[_0x61d6('0x0')]},'remotesecret':{'type':Sequelize[_0x61d6('0x0')]},'transport':{'type':Sequelize[_0x61d6('0x0')],'defaultValue':_0x61d6('0xd'),'set':function(_0x37a0f1){this[_0x61d6('0xe')](_0x61d6('0xf'),_0x37a0f1?_0x37a0f1[_0x61d6('0x10')](','):null);},'get':function(){return this[_0x61d6('0x11')](_0x61d6('0xf'))?this[_0x61d6('0x11')](_0x61d6('0xf'))[_0x61d6('0x12')](','):null;},'comment':_0x61d6('0x13')},'dtmfmode':{'type':Sequelize[_0x61d6('0x4')]('rfc2833','info',_0x61d6('0x14'),'inband',_0x61d6('0x15')),'defaultValue':_0x61d6('0x16')},'directmedia':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no',_0x61d6('0x18'),_0x61d6('0x19'),_0x61d6('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x61d6('0x0')]},'directmediadeny':{'type':Sequelize[_0x61d6('0x0')]},'nat':{'type':Sequelize[_0x61d6('0x0')],'defaultValue':'force_rport,comedia','set':function(_0x21a78b){this[_0x61d6('0xe')](_0x61d6('0x1b'),_0x21a78b?_0x21a78b[_0x61d6('0x10')](','):null);},'get':function(){return this[_0x61d6('0x11')](_0x61d6('0x1b'))?this[_0x61d6('0x11')](_0x61d6('0x1b'))[_0x61d6('0x12')](','):null;},'comment':_0x61d6('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x61d6('0x0')]},'pickupgroup':{'type':Sequelize[_0x61d6('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x61d6('0x0')]},'language':{'type':Sequelize[_0x61d6('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x61d6('0x1d')},'allow':{'type':Sequelize[_0x61d6('0x0')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2ba96a){this[_0x61d6('0xe')](_0x61d6('0x1e'),_0x2ba96a?_0x2ba96a[_0x61d6('0x10')](';'):_0x61d6('0x1f'));},'get':function(){return this[_0x61d6('0x11')](_0x61d6('0x1e'))?this[_0x61d6('0x11')](_0x61d6('0x1e'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no')},'insecure':{'type':Sequelize[_0x61d6('0x0')],'defaultValue':'port,invite','set':function(_0x598ea0){this[_0x61d6('0xe')](_0x61d6('0x20'),_0x598ea0?_0x598ea0[_0x61d6('0x10')](','):null);},'get':function(){return this[_0x61d6('0x11')](_0x61d6('0x20'))?this[_0x61d6('0x11')]('insecure')['split'](','):null;},'comment':_0x61d6('0x21')},'trustrpid':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no',_0x61d6('0x22'))},'promiscredir':{'type':Sequelize[_0x61d6('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x61d6('0x0')],'defaultValue':_0x61d6('0x23')},'amaflags':{'type':Sequelize[_0x61d6('0x0')]},'callcounter':{'type':Sequelize[_0x61d6('0x4')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x61d6('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x61d6('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x61d6('0x0')]},'template':{'type':Sequelize[_0x61d6('0x0')]},'videosupport':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no',_0x61d6('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x61d6('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x61d6('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x61d6('0x0')]},'session_timers':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x26'),_0x61d6('0x27'),_0x61d6('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x61d6('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x61d6('0x29'),'uas'),'defaultValue':_0x61d6('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x61d6('0x0')]},'regexten':{'type':Sequelize[_0x61d6('0x0')]},'fromdomain':{'type':Sequelize[_0x61d6('0x0')]},'fromuser':{'type':Sequelize[_0x61d6('0x0')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no'),'defaultValue':_0x61d6('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x61d6('0x0')]},'rtptimeout':{'type':Sequelize[_0x61d6('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x61d6('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no',_0x61d6('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x61d6('0x0')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x61d6('0x25')](0xb)},'timerb':{'type':Sequelize[_0x61d6('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x61d6('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x61d6('0x0')]},'contactacl':{'type':Sequelize[_0x61d6('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x61d6('0x0')]},'use_q850_reason':{'type':Sequelize[_0x61d6('0x0')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no')},'force_avp':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no')},'icesupport':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x61d6('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no',_0x61d6('0x2c'),_0x61d6('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x61d6('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x61d6('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x61d6('0x0')]},'dtlscipher':{'type':Sequelize[_0x61d6('0x0')]},'dtlscafile':{'type':Sequelize[_0x61d6('0x0')]},'dtlscapath':{'type':Sequelize[_0x61d6('0x0')]},'dtlssetup':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x2e'),_0x61d6('0x2f'),_0x61d6('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x61d6('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x61d6('0x0')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x61d6('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x61d6('0x17'),'no')},'vmexten':{'type':Sequelize[_0x61d6('0x0')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x61d6('0x0')]},'parkinglot':{'type':Sequelize[_0x61d6('0x0')]},'description':{'type':Sequelize[_0x61d6('0x0')]},'host':{'type':Sequelize[_0x61d6('0x0')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x61d6('0x4')](_0x61d6('0x17'),'no',_0x61d6('0x18'),_0x61d6('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x61d6('0x0')]},'otherFields':{'type':Sequelize[_0x61d6('0x0')]},'active':{'type':Sequelize[_0x61d6('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x61d6('0x0')],'defaultValue':'no'}}; \ No newline at end of file +var _0x333d=['uac','uas','pai','fingerprint','passive','actpass','dynamic','nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x333d,0x10d));var _0xd333=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x333d[_0x3cb30b];return _0x2ca717;};'use strict';var Sequelize=require('sequelize');module[_0xd333('0x0')]={'name':{'type':Sequelize[_0xd333('0x1')],'allowNull':![],'unique':_0xd333('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x4'),_0xd333('0x5'),_0xd333('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xd333('0x1')],'allowNull':![],'defaultValue':_0xd333('0x7')},'callingpres':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x8'),_0xd333('0x9'),_0xd333('0xa'),_0xd333('0xb'),_0xd333('0xc'),'PROHIB_PASSED_SCREEN',_0xd333('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xd333('0x1')]},'md5secret':{'type':Sequelize[_0xd333('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xd333('0xe'),'set':function(_0x319d9a){this[_0xd333('0xf')]('transport',_0x319d9a?_0x319d9a[_0xd333('0x10')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xd333('0x11')]('transport')[_0xd333('0x12')](','):null;},'comment':_0xd333('0x13')},'dtmfmode':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x14'),_0xd333('0x15'),_0xd333('0x16'),_0xd333('0x17'),_0xd333('0x18')),'defaultValue':_0xd333('0x14')},'directmedia':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no','nonat',_0xd333('0x1a'),_0xd333('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd333('0x1')]},'directmediadeny':{'type':Sequelize[_0xd333('0x1')]},'nat':{'type':Sequelize[_0xd333('0x1')],'defaultValue':_0xd333('0x1c'),'set':function(_0x516aef){this[_0xd333('0xf')](_0xd333('0x1d'),_0x516aef?_0x516aef['join'](','):null);},'get':function(){return this[_0xd333('0x11')]('nat')?this[_0xd333('0x11')](_0xd333('0x1d'))[_0xd333('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd333('0x1')]},'namedcallgroup':{'type':Sequelize[_0xd333('0x1')]},'pickupgroup':{'type':Sequelize[_0xd333('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xd333('0x1')]},'language':{'type':Sequelize[_0xd333('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd333('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd333('0x1')],'defaultValue':_0xd333('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd333('0x1f'),'set':function(_0x4f0249){this['setDataValue'](_0xd333('0x20'),_0x4f0249?_0x4f0249[_0xd333('0x10')](';'):_0xd333('0x1f'));},'get':function(){return this[_0xd333('0x11')](_0xd333('0x20'))?this['getDataValue'](_0xd333('0x20'))[_0xd333('0x12')](';'):null;},'comment':_0xd333('0x21')},'autoframing':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no')},'insecure':{'type':Sequelize[_0xd333('0x1')],'defaultValue':_0xd333('0x22'),'set':function(_0x367044){this['setDataValue'](_0xd333('0x23'),_0x367044?_0x367044[_0xd333('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xd333('0x23'))?this[_0xd333('0x11')](_0xd333('0x23'))['split'](','):null;},'comment':_0xd333('0x24')},'trustrpid':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd333('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xd333('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xd333('0x1')]},'callerid':{'type':Sequelize[_0xd333('0x1')],'defaultValue':_0xd333('0x25')},'amaflags':{'type':Sequelize[_0xd333('0x1')]},'callcounter':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no'),'defaultValue':_0xd333('0x19')},'busylevel':{'type':Sequelize[_0xd333('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xd333('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd333('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xd333('0x1')]},'template':{'type':Sequelize[_0xd333('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xd333('0x19'),'no',_0xd333('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd333('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no')},'mailbox':{'type':Sequelize[_0xd333('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0xd333('0x28'),_0xd333('0x29'),_0xd333('0x2a'))},'session_expires':{'type':Sequelize[_0xd333('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xd333('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd333('0x2b'),_0xd333('0x2c')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xd333('0x1')]},'regexten':{'type':Sequelize[_0xd333('0x1')]},'fromdomain':{'type':Sequelize[_0xd333('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd333('0x26')](0x5)},'qualify':{'type':Sequelize[_0xd333('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xd333('0x1')]},'defaultuser':{'type':Sequelize[_0xd333('0x1')]},'rtptimeout':{'type':Sequelize[_0xd333('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd333('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd333('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no',_0xd333('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd333('0x1')]},'callbackextension':{'type':Sequelize[_0xd333('0x1')]},'timert1':{'type':Sequelize[_0xd333('0x26')](0xb)},'timerb':{'type':Sequelize[_0xd333('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd333('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xd333('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xd333('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xd333('0x26')](0xb)},'encryption':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xd333('0x19'),'no')},'icesupport':{'type':Sequelize[_0xd333('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xd333('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no',_0xd333('0x2e'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xd333('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xd333('0x1')]},'dtlssetup':{'type':Sequelize[_0xd333('0x3')]('active',_0xd333('0x2f'),_0xd333('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd333('0x1')]},'usereqphone':{'type':Sequelize[_0xd333('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd333('0x1')]},'recordofffeature':{'type':Sequelize[_0xd333('0x1')]},'call_limit':{'type':Sequelize[_0xd333('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd333('0x3')](_0xd333('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xd333('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd333('0x1')]},'mohsuggest':{'type':Sequelize[_0xd333('0x1')]},'parkinglot':{'type':Sequelize[_0xd333('0x1')]},'description':{'type':Sequelize[_0xd333('0x1')]},'host':{'type':Sequelize[_0xd333('0x1')],'defaultValue':_0xd333('0x31')},'canreinvite':{'type':Sequelize[_0xd333('0x3')]('yes','no',_0xd333('0x32'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd333('0x1')]},'otherFields':{'type':Sequelize[_0xd333('0x1')]},'active':{'type':Sequelize[_0xd333('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd333('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 818863e..ed9b408 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 _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','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','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x34a415,_0x5fb327){var _0x2821e0=function(_0x3a0d2e){while(--_0x3a0d2e){_0x34a415['push'](_0x34a415['shift']());}};_0x2821e0(++_0x5fb327);}(_0x425d,0x1e0));var _0xd425=function(_0x11aee3,_0x51469d){_0x11aee3=_0x11aee3-0x0;var _0x4f563f=_0x425d[_0x11aee3];return _0x4f563f;};'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'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x43bc94,_0x408ce5){var _0x506b43=function(_0x6d6154){while(--_0x6d6154){_0x43bc94['push'](_0x43bc94['shift']());}};_0x506b43(++_0x408ce5);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x24ca[_0x5db657];return _0x2d6e70;};'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'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 46af225..30f76e3 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 _0x3697=['api','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','util','../../config/logger'];(function(_0x2d736e,_0x18ff47){var _0x3fe9e4=function(_0x1bfa45){while(--_0x1bfa45){_0x2d736e['push'](_0x2d736e['shift']());}};_0x3fe9e4(++_0x18ff47);}(_0x3697,0x18a));var _0x7369=function(_0x51fa65,_0x105107){_0x51fa65=_0x51fa65-0x0;var _0x43b594=_0x3697[_0x51fa65];return _0x43b594;};'use strict';var _=require('lodash');var util=require(_0x7369('0x0'));var logger=require(_0x7369('0x1'))(_0x7369('0x2'));var moment=require('moment');var BPromise=require(_0x7369('0x3'));var rp=require(_0x7369('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7369('0x5'));var config=require(_0x7369('0x6'));var attributes=require(_0x7369('0x7'));module[_0x7369('0x8')]=function(_0x1d0ff0,_0x57b008){return _0x1d0ff0[_0x7369('0x9')](_0x7369('0xa'),attributes,{'tableName':_0x7369('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbed=['rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2c4d22,_0x4ca120){var _0x1f0537=function(_0x2374a9){while(--_0x2374a9){_0x2c4d22['push'](_0x2c4d22['shift']());}};_0x1f0537(++_0x4ca120);}(_0xbbed,0x158));var _0xdbbe=function(_0x581769,_0x2c937d){_0x581769=_0x581769-0x0;var _0x15c778=_0xbbed[_0x581769];return _0x15c778;};'use strict';var _=require(_0xdbbe('0x0'));var util=require(_0xdbbe('0x1'));var logger=require(_0xdbbe('0x2'))(_0xdbbe('0x3'));var moment=require(_0xdbbe('0x4'));var BPromise=require(_0xdbbe('0x5'));var rp=require(_0xdbbe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbbe('0x7'));var config=require('../../config/environment');var attributes=require(_0xdbbe('0x8'));module[_0xdbbe('0x9')]=function(_0x36ab42,_0x4963dc){return _0x36ab42[_0xdbbe('0xa')](_0xdbbe('0xb'),attributes,{'tableName':_0xdbbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 9beb317..3a9e78f 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 _0x1868=['http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','map','model','attributes','then','debug','find','ShowTrunk','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x21b687,_0x270e5e){var _0x2f2485=function(_0x25c6b0){while(--_0x25c6b0){_0x21b687['push'](_0x21b687['shift']());}};_0x2f2485(++_0x270e5e);}(_0x1868,0x1a6));var _0x8186=function(_0x15ecf1,_0x356b13){_0x15ecf1=_0x15ecf1-0x0;var _0x2f5b5b=_0x1868[_0x15ecf1];return _0x2f5b5b;};'use strict';var _=require(_0x8186('0x0'));var util=require(_0x8186('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8186('0x2'));var fs=require('fs');var Redis=require(_0x8186('0x3'));var db=require(_0x8186('0x4'))['db'];var utils=require(_0x8186('0x5'));var logger=require(_0x8186('0x6'))('rpc');var config=require(_0x8186('0x7'));var jayson=require(_0x8186('0x8'));var client=jayson[_0x8186('0x9')][_0x8186('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f2390,_0x58d7a8,_0x342bd8){return new BPromise(function(_0x11eb2a,_0x3d0722){return client[_0x8186('0xb')](_0x5f2390,_0x342bd8)['then'](function(_0x5dd5b6){logger[_0x8186('0xc')](_0x8186('0xd'),_0x58d7a8,_0x8186('0xe'));logger['debug'](_0x8186('0xf'),_0x58d7a8,_0x8186('0xe'),JSON[_0x8186('0x10')](_0x5dd5b6));if(_0x5dd5b6[_0x8186('0x11')]){if(_0x5dd5b6[_0x8186('0x11')][_0x8186('0x12')]===0x1f4){logger[_0x8186('0x11')](_0x8186('0xd'),_0x58d7a8,_0x5dd5b6[_0x8186('0x11')][_0x8186('0x13')]);return _0x3d0722(_0x5dd5b6[_0x8186('0x11')][_0x8186('0x13')]);}logger[_0x8186('0x11')](_0x8186('0xd'),_0x58d7a8,_0x5dd5b6['error'][_0x8186('0x13')]);return _0x11eb2a(_0x5dd5b6['error'][_0x8186('0x13')]);}else{logger['info'](_0x8186('0xd'),_0x58d7a8,_0x8186('0xe'));_0x11eb2a(_0x5dd5b6['result']['message']);}})[_0x8186('0x14')](function(_0x339f1c){logger[_0x8186('0x11')]('Trunk,\x20%s,\x20%s',_0x58d7a8,_0x339f1c);_0x3d0722(_0x339f1c);});});}exports[_0x8186('0x15')]=function(_0x5ad5b5){var _0x760a3b=this;return new Promise(function(_0x4ad91f,_0x101e82){return db[_0x8186('0x16')][_0x8186('0x17')]({'raw':_0x5ad5b5[_0x8186('0x18')]?_0x5ad5b5[_0x8186('0x18')][_0x8186('0x19')]===undefined?!![]:![]:!![],'where':_0x5ad5b5[_0x8186('0x18')]?_0x5ad5b5[_0x8186('0x18')][_0x8186('0x1a')]||null:null,'attributes':_0x5ad5b5[_0x8186('0x18')]?_0x5ad5b5[_0x8186('0x18')]['attributes']||null:null,'limit':_0x5ad5b5[_0x8186('0x18')]?_0x5ad5b5[_0x8186('0x18')][_0x8186('0x1b')]||null:null,'include':_0x5ad5b5[_0x8186('0x18')]?_0x5ad5b5['options'][_0x8186('0x1c')]?_[_0x8186('0x1d')](_0x5ad5b5['options'][_0x8186('0x1c')],function(_0x6ee4d8){return{'model':db[_0x6ee4d8[_0x8186('0x1e')]],'as':_0x6ee4d8['as'],'attributes':_0x6ee4d8['attributes'],'include':_0x6ee4d8[_0x8186('0x1c')]?_['map'](_0x6ee4d8[_0x8186('0x1c')],function(_0xbdd55e){return{'model':db[_0xbdd55e['model']],'as':_0xbdd55e['as'],'attributes':_0xbdd55e[_0x8186('0x1f')],'include':_0xbdd55e['include']?_[_0x8186('0x1d')](_0xbdd55e[_0x8186('0x1c')],function(_0x381a68){return{'model':db[_0x381a68[_0x8186('0x1e')]],'as':_0x381a68['as'],'attributes':_0x381a68['attributes']};}):[]};}):[]};}):[]:[]})[_0x8186('0x20')](function(_0x334309){logger[_0x8186('0xc')]('GetTrunk',_0x5ad5b5);logger[_0x8186('0x21')]('GetTrunk',_0x5ad5b5,JSON[_0x8186('0x10')](_0x334309));_0x4ad91f(_0x334309);})[_0x8186('0x14')](function(_0x19b10b){logger[_0x8186('0x11')]('GetTrunk',_0x19b10b['message'],_0x5ad5b5);_0x101e82(_0x760a3b[_0x8186('0x11')](0x1f4,_0x19b10b[_0x8186('0x13')]));});});};exports['ShowTrunk']=function(_0x3de525){var _0x2ba312=this;return new Promise(function(_0x5d55bc,_0x2fd162){return db['Trunk'][_0x8186('0x22')]({'raw':_0x3de525[_0x8186('0x18')]?_0x3de525['options'][_0x8186('0x19')]===undefined?!![]:![]:!![],'where':_0x3de525[_0x8186('0x18')]?_0x3de525[_0x8186('0x18')]['where']||null:null,'attributes':_0x3de525[_0x8186('0x18')]?_0x3de525[_0x8186('0x18')][_0x8186('0x1f')]||null:null,'include':_0x3de525[_0x8186('0x18')]?_0x3de525[_0x8186('0x18')][_0x8186('0x1c')]?_[_0x8186('0x1d')](_0x3de525[_0x8186('0x18')][_0x8186('0x1c')],function(_0x45c55a){return{'model':db[_0x45c55a['model']],'as':_0x45c55a['as'],'attributes':_0x45c55a[_0x8186('0x1f')],'include':_0x45c55a[_0x8186('0x1c')]?_['map'](_0x45c55a[_0x8186('0x1c')],function(_0x45e3b0){return{'model':db[_0x45e3b0[_0x8186('0x1e')]],'as':_0x45e3b0['as'],'attributes':_0x45e3b0[_0x8186('0x1f')],'include':_0x45e3b0['include']?_[_0x8186('0x1d')](_0x45e3b0[_0x8186('0x1c')],function(_0x504d4e){return{'model':db[_0x504d4e[_0x8186('0x1e')]],'as':_0x504d4e['as'],'attributes':_0x504d4e[_0x8186('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8186('0x20')](function(_0x44050f){logger[_0x8186('0xc')](_0x8186('0x23'),_0x3de525);logger['debug'](_0x8186('0x23'),_0x3de525,JSON['stringify'](_0x44050f));_0x5d55bc(_0x44050f);})['catch'](function(_0x1dbc0d){logger[_0x8186('0x11')](_0x8186('0x23'),_0x1dbc0d[_0x8186('0x13')],_0x3de525);_0x2fd162(_0x2ba312[_0x8186('0x11')](0x1f4,_0x1dbc0d[_0x8186('0x13')]));});});}; \ No newline at end of file +var _0xba3b=['GetTrunk','Trunk','findAll','options','where','include','map','model','attributes','catch','find','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x99af76,_0x452b3e){var _0x2d3469=function(_0x3b8e4a){while(--_0x3b8e4a){_0x99af76['push'](_0x99af76['shift']());}};_0x2d3469(++_0x452b3e);}(_0xba3b,0xbc));var _0xbba3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xba3b[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xbba3('0x0'));var util=require(_0xbba3('0x1'));var moment=require(_0xbba3('0x2'));var BPromise=require(_0xbba3('0x3'));var rs=require(_0xbba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbba3('0x5'));var logger=require(_0xbba3('0x6'))(_0xbba3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbba3('0x8')][_0xbba3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c3044,_0x4b35df,_0x5435e9){return new BPromise(function(_0x1044ec,_0x1e2541){return client[_0xbba3('0xa')](_0x1c3044,_0x5435e9)[_0xbba3('0xb')](function(_0x17e648){logger[_0xbba3('0xc')](_0xbba3('0xd'),_0x4b35df,_0xbba3('0xe'));logger[_0xbba3('0xf')](_0xbba3('0x10'),_0x4b35df,_0xbba3('0xe'),JSON[_0xbba3('0x11')](_0x17e648));if(_0x17e648['error']){if(_0x17e648[_0xbba3('0x12')][_0xbba3('0x13')]===0x1f4){logger[_0xbba3('0x12')]('Trunk,\x20%s,\x20%s',_0x4b35df,_0x17e648[_0xbba3('0x12')][_0xbba3('0x14')]);return _0x1e2541(_0x17e648[_0xbba3('0x12')][_0xbba3('0x14')]);}logger['error'](_0xbba3('0xd'),_0x4b35df,_0x17e648[_0xbba3('0x12')]['message']);return _0x1044ec(_0x17e648['error'][_0xbba3('0x14')]);}else{logger['info'](_0xbba3('0xd'),_0x4b35df,_0xbba3('0xe'));_0x1044ec(_0x17e648[_0xbba3('0x15')][_0xbba3('0x14')]);}})['catch'](function(_0x15e381){logger['error'](_0xbba3('0xd'),_0x4b35df,_0x15e381);_0x1e2541(_0x15e381);});});}exports[_0xbba3('0x16')]=function(_0x5172c4){var _0x4fa028=this;return new Promise(function(_0x48afcf,_0x35beab){return db[_0xbba3('0x17')][_0xbba3('0x18')]({'raw':_0x5172c4[_0xbba3('0x19')]?_0x5172c4['options']['raw']===undefined?!![]:![]:!![],'where':_0x5172c4[_0xbba3('0x19')]?_0x5172c4['options'][_0xbba3('0x1a')]||null:null,'attributes':_0x5172c4[_0xbba3('0x19')]?_0x5172c4[_0xbba3('0x19')]['attributes']||null:null,'limit':_0x5172c4[_0xbba3('0x19')]?_0x5172c4['options']['limit']||null:null,'include':_0x5172c4[_0xbba3('0x19')]?_0x5172c4[_0xbba3('0x19')][_0xbba3('0x1b')]?_[_0xbba3('0x1c')](_0x5172c4[_0xbba3('0x19')][_0xbba3('0x1b')],function(_0x3f0f9e){return{'model':db[_0x3f0f9e['model']],'as':_0x3f0f9e['as'],'attributes':_0x3f0f9e['attributes'],'include':_0x3f0f9e[_0xbba3('0x1b')]?_[_0xbba3('0x1c')](_0x3f0f9e[_0xbba3('0x1b')],function(_0x4f93fb){return{'model':db[_0x4f93fb[_0xbba3('0x1d')]],'as':_0x4f93fb['as'],'attributes':_0x4f93fb['attributes'],'include':_0x4f93fb[_0xbba3('0x1b')]?_['map'](_0x4f93fb[_0xbba3('0x1b')],function(_0x569fe8){return{'model':db[_0x569fe8[_0xbba3('0x1d')]],'as':_0x569fe8['as'],'attributes':_0x569fe8[_0xbba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbba3('0xb')](function(_0x18dd8c){logger[_0xbba3('0xc')]('GetTrunk',_0x5172c4);logger[_0xbba3('0xf')](_0xbba3('0x16'),_0x5172c4,JSON['stringify'](_0x18dd8c));_0x48afcf(_0x18dd8c);})[_0xbba3('0x1f')](function(_0x2f4629){logger[_0xbba3('0x12')]('GetTrunk',_0x2f4629[_0xbba3('0x14')],_0x5172c4);_0x35beab(_0x4fa028[_0xbba3('0x12')](0x1f4,_0x2f4629['message']));});});};exports['ShowTrunk']=function(_0x587334){var _0x8f03e2=this;return new Promise(function(_0x550d4b,_0x23a307){return db['Trunk'][_0xbba3('0x20')]({'raw':_0x587334[_0xbba3('0x19')]?_0x587334[_0xbba3('0x19')][_0xbba3('0x21')]===undefined?!![]:![]:!![],'where':_0x587334[_0xbba3('0x19')]?_0x587334[_0xbba3('0x19')][_0xbba3('0x1a')]||null:null,'attributes':_0x587334['options']?_0x587334[_0xbba3('0x19')][_0xbba3('0x1e')]||null:null,'include':_0x587334[_0xbba3('0x19')]?_0x587334['options'][_0xbba3('0x1b')]?_[_0xbba3('0x1c')](_0x587334[_0xbba3('0x19')][_0xbba3('0x1b')],function(_0x168695){return{'model':db[_0x168695[_0xbba3('0x1d')]],'as':_0x168695['as'],'attributes':_0x168695[_0xbba3('0x1e')],'include':_0x168695[_0xbba3('0x1b')]?_['map'](_0x168695[_0xbba3('0x1b')],function(_0x142e24){return{'model':db[_0x142e24['model']],'as':_0x142e24['as'],'attributes':_0x142e24[_0xbba3('0x1e')],'include':_0x142e24[_0xbba3('0x1b')]?_[_0xbba3('0x1c')](_0x142e24['include'],function(_0x195184){return{'model':db[_0x195184['model']],'as':_0x195184['as'],'attributes':_0x195184[_0xbba3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48c44f){logger[_0xbba3('0xc')](_0xbba3('0x22'),_0x587334);logger['debug']('ShowTrunk',_0x587334,JSON[_0xbba3('0x11')](_0x48c44f));_0x550d4b(_0x48c44f);})[_0xbba3('0x1f')](function(_0x18ac35){logger['error'](_0xbba3('0x22'),_0x18ac35[_0xbba3('0x14')],_0x587334);_0x23a307(_0x8f03e2[_0xbba3('0x12')](0x1f4,_0x18ac35[_0xbba3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index f62ed35..b0e697e 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 _0x8c6e=['fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','/:id/contacts','addContacts','create','post','/create_many','bulkCreate','/:id/queues','join','root','server/files/images/','format','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','connect-timeout','express','Router'];(function(_0x1ff4b,_0x5b7f1a){var _0x5b2c44=function(_0x390c2d){while(--_0x390c2d){_0x1ff4b['push'](_0x1ff4b['shift']());}};_0x5b2c44(++_0x5b7f1a);}(_0x8c6e,0xe4));var _0xe8c6=function(_0x553769,_0x16b522){_0x553769=_0x553769-0x0;var _0x5b1c25=_0x8c6e[_0x553769];return _0x5b1c25;};'use strict';var multer=require(_0xe8c6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe8c6('0x1'));var express=require(_0xe8c6('0x2'));var router=express[_0xe8c6('0x3')]();var fs_extra=require(_0xe8c6('0x4'));var auth=require(_0xe8c6('0x5'));var interaction=require(_0xe8c6('0x6'));var config=require('../../config/environment');var controller=require(_0xe8c6('0x7'));router[_0xe8c6('0x8')]('/',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0xa')]);router['get'](_0xe8c6('0xb'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0xc')]);router[_0xe8c6('0x8')](_0xe8c6('0xd'),auth['isAuthenticated'](),controller[_0xe8c6('0xe')]);router['get']('/presence',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0xf')]);router[_0xe8c6('0x8')](_0xe8c6('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xe8c6('0x8')]('/:id/avatar',controller[_0xe8c6('0x11')]);router['get'](_0xe8c6('0x12'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x13')]);router[_0xe8c6('0x8')]('/:id/contacts',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x14')]);router[_0xe8c6('0x8')]('/:id/queues',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x15')]);router[_0xe8c6('0x8')](_0xe8c6('0x16'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x17')]);router['get'](_0xe8c6('0x18'),auth[_0xe8c6('0x9')](),controller['getGroups']);router[_0xe8c6('0x8')](_0xe8c6('0x19'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x1a')]);router[_0xe8c6('0x8')]('/:id/screen_recordings',auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0xe8c6('0x8')](_0xe8c6('0x1b'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x1c')]);router['get'](_0xe8c6('0x1d'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x1e')]);router[_0xe8c6('0x8')]('/:id/mail/interactions',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x1f')]);router['get'](_0xe8c6('0x20'),auth[_0xe8c6('0x9')](),controller['getSmsInteractions']);router[_0xe8c6('0x8')](_0xe8c6('0x21'),auth[_0xe8c6('0x9')](),controller['getFaxInteractions']);router[_0xe8c6('0x8')](_0xe8c6('0x22'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x23')]);router[_0xe8c6('0x8')](_0xe8c6('0x24'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x25')]);router['get'](_0xe8c6('0x26'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x27')]);router[_0xe8c6('0x8')]('/:id/agents',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x28')]);router['get'](_0xe8c6('0x29'),auth[_0xe8c6('0x9')](),controller['getVoicePrefixes']);router[_0xe8c6('0x8')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['getFaxAccounts']);router['get'](_0xe8c6('0x2a'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x2b')]);router[_0xe8c6('0x8')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xe8c6('0x2c')]);router[_0xe8c6('0x8')](_0xe8c6('0x2d'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xe8c6('0x8')](_0xe8c6('0x2e'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x2f')]);router[_0xe8c6('0x8')](_0xe8c6('0x30'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x31')]);router['get'](_0xe8c6('0x32'),auth['isAuthenticated'](),controller[_0xe8c6('0x33')]);router['get'](_0xe8c6('0x34'),auth['isAuthenticated'](),controller[_0xe8c6('0x35')]);router['get'](_0xe8c6('0x36'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x37')]);router['post'](_0xe8c6('0x38'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x39')]);router['post']('/',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x3a')]);router[_0xe8c6('0x3b')](_0xe8c6('0x3c'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x3d')]);router[_0xe8c6('0x3b')](_0xe8c6('0x3e'),auth[_0xe8c6('0x9')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x30f186,_0x12f99b,_0x15d50d){_0x15d50d(null,path[_0xe8c6('0x3f')](config[_0xe8c6('0x40')],_0xe8c6('0x41')));},'filename':function(_0xdf147e,_0x5ed4c5,_0x139ba1){_0x139ba1(null,util[_0xe8c6('0x42')]('%s-%s',Date['now'](),_0x5ed4c5['originalname']));}})});router[_0xe8c6('0x3b')]('/:id/avatar',upload[_0xe8c6('0x43')](_0xe8c6('0x44')),controller[_0xe8c6('0x45')]);router[_0xe8c6('0x3b')](_0xe8c6('0x46'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x47')]);router[_0xe8c6('0x3b')](_0xe8c6('0x48'),auth['isAuthenticated'](),controller['logout']);router['post'](_0xe8c6('0x49'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x4a')]);router[_0xe8c6('0x3b')](_0xe8c6('0x4b'),auth['isAuthenticated'](),controller[_0xe8c6('0x4c')]);router[_0xe8c6('0x3b')](_0xe8c6('0x24'),auth[_0xe8c6('0x9')](),controller['addTeams']);router[_0xe8c6('0x3b')](_0xe8c6('0x4d'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x4e')]);router[_0xe8c6('0x3b')](_0xe8c6('0x4f'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x50')]);router['post'](_0xe8c6('0x51'),auth['isAuthenticated'](),controller[_0xe8c6('0x52')]);router[_0xe8c6('0x3b')](_0xe8c6('0x53'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x54')]);router[_0xe8c6('0x3b')](_0xe8c6('0x55'),auth['isAuthenticated'](),controller[_0xe8c6('0x56')]);router['post'](_0xe8c6('0x57'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x58')]);router['post'](_0xe8c6('0x59'),auth['isAuthenticated'](),controller[_0xe8c6('0x5a')]);router['post']('/:id/mail_accounts',auth[_0xe8c6('0x9')](),controller['addMailAccounts']);router['post'](_0xe8c6('0x5b'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x5c')]);router[_0xe8c6('0x3b')](_0xe8c6('0x2d'),auth[_0xe8c6('0x9')](),controller['addSmsAccounts']);router[_0xe8c6('0x3b')]('/:id/chat_websites',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x5d')]);router['post'](_0xe8c6('0x30'),auth['isAuthenticated'](),controller[_0xe8c6('0x5e')]);router['post']('/:id/square_projects',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x5f')]);router[_0xe8c6('0x3b')](_0xe8c6('0x36'),auth[_0xe8c6('0x9')](),controller['createApiKey']);router[_0xe8c6('0x60')](_0xe8c6('0x10'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x61')]);router['put'](_0xe8c6('0x62'),auth[_0xe8c6('0x9')](),controller['changePassword']);router[_0xe8c6('0x63')]('/:id/queues',auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x64')]);router[_0xe8c6('0x63')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe8c6('0x65')]);router[_0xe8c6('0x63')](_0xe8c6('0x10'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x66')]);router[_0xe8c6('0x63')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xe8c6('0x67')]);router[_0xe8c6('0x63')](_0xe8c6('0x4f'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x68')]);router[_0xe8c6('0x63')](_0xe8c6('0x51'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x69')]);router['delete'](_0xe8c6('0x53'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x6a')]);router[_0xe8c6('0x63')](_0xe8c6('0x55'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xe8c6('0x63')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xe8c6('0x6b')]);router['delete'](_0xe8c6('0x59'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x6c')]);router[_0xe8c6('0x63')](_0xe8c6('0x2a'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x6d')]);router[_0xe8c6('0x63')](_0xe8c6('0x5b'),auth[_0xe8c6('0x9')](),controller['removeOpenchannelAccounts']);router[_0xe8c6('0x63')](_0xe8c6('0x2d'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x6e')]);router[_0xe8c6('0x63')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe8c6('0x6f')]);router[_0xe8c6('0x63')](_0xe8c6('0x30'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x70')]);router['delete'](_0xe8c6('0x32'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x71')]);router[_0xe8c6('0x63')](_0xe8c6('0x36'),auth[_0xe8c6('0x9')](),controller[_0xe8c6('0x72')]);module[_0xe8c6('0x73')]=router; \ No newline at end of file +var _0xcfd5=['%s-%s','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./user.controller','isAuthenticated','index','get','/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','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','root','server/files/images/','format'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcfd5,0x114));var _0x5cfd=function(_0x2af74d,_0x4edaed){_0x2af74d=_0x2af74d-0x0;var _0x5e0eb8=_0xcfd5[_0x2af74d];return _0x5e0eb8;};'use strict';var multer=require(_0x5cfd('0x0'));var util=require(_0x5cfd('0x1'));var path=require('path');var timeout=require(_0x5cfd('0x2'));var express=require(_0x5cfd('0x3'));var router=express[_0x5cfd('0x4')]();var fs_extra=require(_0x5cfd('0x5'));var auth=require(_0x5cfd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5cfd('0x7'));router['get']('/',auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x9')]);router[_0x5cfd('0xa')](_0x5cfd('0xb'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0xc')]);router[_0x5cfd('0xa')](_0x5cfd('0xd'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0xe')]);router['get'](_0x5cfd('0xf'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x10')]);router[_0x5cfd('0xa')](_0x5cfd('0x11'),auth['isAuthenticated'](),controller['show']);router[_0x5cfd('0xa')](_0x5cfd('0x12'),controller[_0x5cfd('0x13')]);router['get'](_0x5cfd('0x14'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x15')]);router[_0x5cfd('0xa')](_0x5cfd('0x16'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x17')]);router[_0x5cfd('0xa')](_0x5cfd('0x18'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x19')]);router[_0x5cfd('0xa')](_0x5cfd('0x1a'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x1b')]);router[_0x5cfd('0xa')](_0x5cfd('0x1c'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x1d')]);router[_0x5cfd('0xa')](_0x5cfd('0x1e'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x1f')]);router[_0x5cfd('0xa')](_0x5cfd('0x20'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x21')]);router[_0x5cfd('0xa')]('/:id/chat/interactions',auth[_0x5cfd('0x8')](),controller['getChatInteractions']);router[_0x5cfd('0xa')](_0x5cfd('0x22'),auth[_0x5cfd('0x8')](),controller['getOpenchannelInteractions']);router[_0x5cfd('0xa')](_0x5cfd('0x23'),auth['isAuthenticated'](),controller[_0x5cfd('0x24')]);router[_0x5cfd('0xa')](_0x5cfd('0x25'),auth[_0x5cfd('0x8')](),controller['getSmsInteractions']);router['get'](_0x5cfd('0x26'),auth[_0x5cfd('0x8')](),controller['getFaxInteractions']);router['get'](_0x5cfd('0x27'),auth[_0x5cfd('0x8')](),controller['getWhatsappInteractions']);router[_0x5cfd('0xa')](_0x5cfd('0x28'),auth['isAuthenticated'](),controller[_0x5cfd('0x29')]);router[_0x5cfd('0xa')](_0x5cfd('0x2a'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x2b')]);router[_0x5cfd('0xa')]('/:id/agents',auth['isAuthenticated'](),controller[_0x5cfd('0x2c')]);router[_0x5cfd('0xa')](_0x5cfd('0x2d'),auth[_0x5cfd('0x8')](),controller['getVoicePrefixes']);router[_0x5cfd('0xa')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x5cfd('0x2e')]);router[_0x5cfd('0xa')]('/:id/mail_accounts',auth[_0x5cfd('0x8')](),controller['getMailAccounts']);router[_0x5cfd('0xa')](_0x5cfd('0x2f'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x30')]);router[_0x5cfd('0xa')](_0x5cfd('0x31'),auth[_0x5cfd('0x8')](),controller['getSmsAccounts']);router[_0x5cfd('0xa')](_0x5cfd('0x32'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x33')]);router[_0x5cfd('0xa')](_0x5cfd('0x34'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x35')]);router[_0x5cfd('0xa')](_0x5cfd('0x36'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x37')]);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router['get'](_0x5cfd('0x38'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x39')]);router[_0x5cfd('0x3a')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x5cfd('0x3b')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5cfd('0x3c')]);router[_0x5cfd('0x3a')]('/create_many',auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x3d')]);router[_0x5cfd('0x3a')](_0x5cfd('0x18'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x3e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x517b0d,_0x320854,_0x204505){_0x204505(null,path['join'](config[_0x5cfd('0x3f')],_0x5cfd('0x40')));},'filename':function(_0x54e193,_0x4024e0,_0x48cec7){_0x48cec7(null,util[_0x5cfd('0x41')](_0x5cfd('0x42'),Date['now'](),_0x4024e0[_0x5cfd('0x43')]));}})});router['post']('/:id/avatar',upload[_0x5cfd('0x44')](_0x5cfd('0x45')),controller[_0x5cfd('0x46')]);router[_0x5cfd('0x3a')](_0x5cfd('0x47'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x48')]);router[_0x5cfd('0x3a')]('/:id/logout',auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x49')]);router[_0x5cfd('0x3a')](_0x5cfd('0x4a'),auth[_0x5cfd('0x8')](),controller['pause']);router[_0x5cfd('0x3a')](_0x5cfd('0x4b'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x4c')]);router[_0x5cfd('0x3a')](_0x5cfd('0x28'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x5cfd('0x4d'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x4e')]);router[_0x5cfd('0x3a')](_0x5cfd('0x4f'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x50')]);router[_0x5cfd('0x3a')](_0x5cfd('0x51'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x52')]);router[_0x5cfd('0x3a')](_0x5cfd('0x53'),auth[_0x5cfd('0x8')](),controller['addSmsInteractions']);router[_0x5cfd('0x3a')](_0x5cfd('0x54'),auth['isAuthenticated'](),controller[_0x5cfd('0x55')]);router['post']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x5cfd('0x56')]);router[_0x5cfd('0x3a')](_0x5cfd('0x57'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x58')]);router[_0x5cfd('0x3a')](_0x5cfd('0x59'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x5a')]);router[_0x5cfd('0x3a')](_0x5cfd('0x2f'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x5b')]);router[_0x5cfd('0x3a')](_0x5cfd('0x31'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x5c')]);router[_0x5cfd('0x3a')](_0x5cfd('0x32'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x5d')]);router[_0x5cfd('0x3a')](_0x5cfd('0x34'),auth['isAuthenticated'](),controller[_0x5cfd('0x5e')]);router[_0x5cfd('0x3a')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x5cfd('0x5f')]);router[_0x5cfd('0x3a')]('/:id/api_key',auth[_0x5cfd('0x8')](),controller['createApiKey']);router[_0x5cfd('0x60')](_0x5cfd('0x11'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x61')]);router['put'](_0x5cfd('0x62'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x63')]);router['delete']('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router[_0x5cfd('0x64')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5cfd('0x65')]);router['delete'](_0x5cfd('0x11'),auth['isAuthenticated'](),controller[_0x5cfd('0x66')]);router[_0x5cfd('0x64')](_0x5cfd('0x4d'),auth[_0x5cfd('0x8')](),controller['removeChatInteractions']);router[_0x5cfd('0x64')](_0x5cfd('0x4f'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x67')]);router[_0x5cfd('0x64')]('/:id/fax_interactions',auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x68')]);router[_0x5cfd('0x64')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x5cfd('0x69')]);router[_0x5cfd('0x64')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete'](_0x5cfd('0x6a'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x6b')]);router[_0x5cfd('0x64')](_0x5cfd('0x57'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x6c')]);router[_0x5cfd('0x64')](_0x5cfd('0x59'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x6d')]);router[_0x5cfd('0x64')](_0x5cfd('0x2f'),auth[_0x5cfd('0x8')](),controller['removeOpenchannelAccounts']);router[_0x5cfd('0x64')](_0x5cfd('0x31'),auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x6e')]);router[_0x5cfd('0x64')](_0x5cfd('0x32'),auth['isAuthenticated'](),controller[_0x5cfd('0x6f')]);router[_0x5cfd('0x64')]('/:id/whatsapp_accounts',auth[_0x5cfd('0x8')](),controller[_0x5cfd('0x70')]);router['delete'](_0x5cfd('0x36'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x5cfd('0x64')](_0x5cfd('0x38'),auth[_0x5cfd('0x8')](),controller['removeApiKey']);module[_0x5cfd('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9c237ce..167fb88 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 _0x6050=['get','isArray','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','name','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','always','accept','refuse','uac','uas','certificate','actpass','update','update,nonat','TEXT','showWebBar'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0x6050,0x196));var _0x0605=function(_0x24887c,_0x52747f){_0x24887c=_0x24887c-0x0;var _0x100b54=_0x6050[_0x24887c];return _0x100b54;};'use strict';var Sequelize=require(_0x0605('0x0'));var moment=require(_0x0605('0x1'));var util=require(_0x0605('0x2'));var _=require(_0x0605('0x3'));module[_0x0605('0x4')]={'name':{'type':Sequelize[_0x0605('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x22d595){this[_0x0605('0x6')](_0x0605('0x7'),_0x22d595);this['setDataValue']('defaultuser',_0x22d595);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0605('0x5')],'allowNull':![],'set':function(_0x578623){this['setDataValue']('fullname',_0x578623);this[_0x0605('0x6')](_0x0605('0x8'),util[_0x0605('0x9')](_0x0605('0xa'),_0x578623,this[_0x0605('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x0605('0x5')]},'email':{'type':Sequelize[_0x0605('0x5')],'allowNull':![],'unique':_0x0605('0xc'),'validate':{'isEmail':!![]},'set':function(_0x2c5e23){if(_0x2c5e23){this[_0x0605('0x6')](_0x0605('0xc'),_0x2c5e23[_0x0605('0xd')]());}}},'role':{'type':Sequelize[_0x0605('0xe')](_0x0605('0xf'),_0x0605('0x10'),_0x0605('0x11'),_0x0605('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x0605('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0605('0x5')],'defaultValue':_0x0605('0x13')},'internal':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':![],'unique':_0x0605('0x15'),'set':function(_0x65a20b){this[_0x0605('0x6')]('internal',_0x65a20b);this[_0x0605('0x6')](_0x0605('0x16'),_0x65a20b);this[_0x0605('0x6')]('callerid',util['format'](_0x0605('0xa'),this[_0x0605('0xb')](_0x0605('0x17')),_0x65a20b));}},'salt':{'type':Sequelize[_0x0605('0x5')]},'phone':{'type':Sequelize[_0x0605('0x5')]},'mobile':{'type':Sequelize[_0x0605('0x5')]},'address':{'type':Sequelize[_0x0605('0x5')]},'zipcode':{'type':Sequelize[_0x0605('0x5')]},'userpic':{'type':Sequelize[_0x0605('0x5')]},'city':{'type':Sequelize[_0x0605('0x5')]},'country':{'type':Sequelize[_0x0605('0x5')]},'online':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0605('0x19')]},'voicePause':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0605('0x5')],'defaultValue':_0x0605('0x1a')},'lastPauseAt':{'type':Sequelize[_0x0605('0x19')]},'chatCapacity':{'type':Sequelize[_0x0605('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0605('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0605('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0605('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0605('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0605('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0605('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0605('0x1b')},'ipaddr':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x1c'),_0x0605('0x10'),'peer'),'allowNull':!![],'defaultValue':_0x0605('0x1c')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0605('0x1d')},'callingpres':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x1e'),_0x0605('0x1f'),_0x0605('0x20'),_0x0605('0x21'),'PROHIB_NOT_SCREENED',_0x0605('0x22'),_0x0605('0x23'),_0x0605('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![],'defaultValue':_0x0605('0x25'),'set':function(_0x66d140){this[_0x0605('0x6')](_0x0605('0x26'),_0x66d140?_0x66d140[_0x0605('0x27')](','):null);},'get':function(){return this[_0x0605('0xb')](_0x0605('0x26'))?this[_0x0605('0xb')](_0x0605('0x26'))[_0x0605('0x28')](','):null;},'comment':_0x0605('0x29')},'dtmfmode':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2a'),_0x0605('0x2b'),_0x0605('0x2c'),_0x0605('0x2d'),_0x0605('0x2e')),'allowNull':!![],'defaultValue':_0x0605('0x2a')},'directmedia':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no',_0x0605('0x30'),'update',_0x0605('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0605('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![],'defaultValue':_0x0605('0x32'),'set':function(_0x31cb08){this[_0x0605('0x6')]('nat',_0x31cb08?_0x31cb08['join'](','):null);},'get':function(){return this[_0x0605('0xb')](_0x0605('0x33'))?this[_0x0605('0xb')]('nat')[_0x0605('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0605('0x5')]},'namedcallgroup':{'type':Sequelize[_0x0605('0x5')]},'pickupgroup':{'type':Sequelize[_0x0605('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x0605('0x5')]},'language':{'type':Sequelize[_0x0605('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0605('0x5')]},'disallow':{'type':Sequelize[_0x0605('0x5')],'allowNull':![],'defaultValue':_0x0605('0x34')},'allow':{'type':Sequelize[_0x0605('0x5')],'allowNull':![],'defaultValue':_0x0605('0x35'),'set':function(_0x57aa15){this[_0x0605('0x6')]('allow',_0x57aa15?_0x57aa15[_0x0605('0x27')](';'):_0x0605('0x35'));},'get':function(){return this[_0x0605('0xb')]('allow')?this['getDataValue'](_0x0605('0x36'))['split'](';'):null;},'comment':_0x0605('0x37')},'autoframing':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![],'set':function(_0x354f4e){this[_0x0605('0x6')](_0x0605('0x38'),_0x354f4e?_0x354f4e[_0x0605('0x27')](','):null);},'get':function(){return this[_0x0605('0xb')](_0x0605('0x38'))?this[_0x0605('0xb')](_0x0605('0x38'))[_0x0605('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0605('0xe')]('yes','no',_0x0605('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0605('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x0605('0x2f')},'busylevel':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no',_0x0605('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x3b'),_0x0605('0x3c'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x3d'),_0x0605('0x3e')),'allowNull':!![],'defaultValue':_0x0605('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0605('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0605('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no','fingerprint',_0x0605('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0605('0xe')]('active','passive',_0x0605('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x0605('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0605('0xe')](_0x0605('0x2f'),'no',_0x0605('0x30'),_0x0605('0x41'),_0x0605('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0605('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0605('0x43')]},'showWebBar':{'type':Sequelize[_0x0605('0x14')],'defaultValue':0x0,'set':function(_0x5d8fdc){this['setDataValue'](_0x0605('0x44'),_0x5d8fdc);var _0x2227c9=this[_0x0605('0x45')]({'plain':!![]});switch(_0x5d8fdc){case 0x0:case 0x1:var _0x3cfbb7=_0x2227c9[_0x0605('0x26')]?_[_0x0605('0x46')](_0x2227c9[_0x0605('0x26')])?_0x2227c9[_0x0605('0x26')][_0x0605('0x27')]():_0x2227c9[_0x0605('0x26')]:_0x0605('0x25');if(_0x3cfbb7===_0x0605('0x47')){_0x3cfbb7='udp';}this[_0x0605('0x6')](_0x0605('0x26'),_0x3cfbb7);this[_0x0605('0x6')](_0x0605('0x48'),'no');this[_0x0605('0x6')](_0x0605('0x49'),null);this['setDataValue'](_0x0605('0x4a'),null);this['setDataValue']('icesupport',null);this[_0x0605('0x6')](_0x0605('0x4b'),null);this[_0x0605('0x6')](_0x0605('0x4c'),null);this[_0x0605('0x6')](_0x0605('0x4d'),null);this[_0x0605('0x6')](_0x0605('0x4e'),null);this[_0x0605('0x6')](_0x0605('0x4f'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue']('transport','wss');this[_0x0605('0x6')](_0x0605('0x48'),_0x0605('0x2f'));this['setDataValue'](_0x0605('0x49'),_0x0605('0x2f'));this[_0x0605('0x6')](_0x0605('0x4a'),_0x0605('0x2f'));this[_0x0605('0x6')]('icesupport',_0x0605('0x2f'));this[_0x0605('0x6')](_0x0605('0x4b'),'yes');this['setDataValue']('dtlsverify','no');this[_0x0605('0x6')](_0x0605('0x4d'),_0x0605('0x40'));this[_0x0605('0x6')]('dtlscertfile',_0x2227c9['dtlscertfile']||_0x0605('0x50'));this[_0x0605('0x6')]('dtlsprivatekey',_0x2227c9[_0x0605('0x4f')]||_0x0605('0x51'));this[_0x0605('0x6')](_0x0605('0x52'),_0x0605('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x0605('0x43')],'set':function(_0xb6fb53){this[_0x0605('0x6')](_0x0605('0x53'),_0xb6fb53?_0xb6fb53[_0x0605('0x27')](','):[]);},'get':function(){return this[_0x0605('0xb')](_0x0605('0x53'))?_[_0x0605('0x54')](this['getDataValue']('permissions')[_0x0605('0x28')](','),function(_0x2e6e8e){return parseInt(_0x2e6e8e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0605('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0605('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0605('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0605('0x55')],'get':function(){return this[_0x0605('0xb')](_0x0605('0x56'))?this[_0x0605('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0605('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![],'set':function(_0x49a0d9){if(typeof _0x49a0d9===_0x0605('0x57')){var _0x5ad670=_0x49a0d9==='1'?!![]:_0x49a0d9==='0'?![]:_0x49a0d9===_0x0605('0x58')?!![]:_0x49a0d9===_0x0605('0x59')?![]:![];this[_0x0605('0x6')](_0x0605('0x5a'),_0x5ad670);}else{this['setDataValue'](_0x0605('0x5a'),_0x49a0d9);}}},'blocked':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![],'set':function(_0x54b8e2){this[_0x0605('0x6')](_0x0605('0x5b'),_0x54b8e2);if(_0x54b8e2===!![]){this[_0x0605('0x6')](_0x0605('0x5c'),moment());this[_0x0605('0x6')](_0x0605('0x5d'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x0605('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0605('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0605('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x0605('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0605('0x18')],'defaultValue':!![]}}; \ No newline at end of file +var _0x965d=['wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','dtlscertfile','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','lodash','exports','STRING','setDataValue','name','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','telephone','local','INTEGER','callerid','fullname','DATE','BOOLEAN','dynamic','friend','peer','from-sip','ENUM','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','isArray'];(function(_0x45de51,_0x48c2f8){var _0x3eeb02=function(_0x3e864b){while(--_0x3e864b){_0x45de51['push'](_0x45de51['shift']());}};_0x3eeb02(++_0x48c2f8);}(_0x965d,0x1be));var _0xd965=function(_0x1c86ad,_0x21e72a){_0x1c86ad=_0x1c86ad-0x0;var _0x2cc7a5=_0x965d[_0x1c86ad];return _0x2cc7a5;};'use strict';var Sequelize=require(_0xd965('0x0'));var moment=require(_0xd965('0x1'));var util=require('util');var _=require(_0xd965('0x2'));module[_0xd965('0x3')]={'name':{'type':Sequelize[_0xd965('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2924a3){this[_0xd965('0x5')](_0xd965('0x6'),_0x2924a3);this['setDataValue']('defaultuser',_0x2924a3);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2f9b86){this[_0xd965('0x5')]('fullname',_0x2f9b86);this[_0xd965('0x5')]('callerid',util[_0xd965('0x7')](_0xd965('0x8'),_0x2f9b86,this[_0xd965('0x9')](_0xd965('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd965('0x4')],'allowNull':![],'unique':_0xd965('0xb'),'validate':{'isEmail':!![]},'set':function(_0x21c632){if(_0x21c632){this['setDataValue']('email',_0x21c632['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0xd965('0xc'),_0xd965('0xd'),'agent',_0xd965('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0xd965('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd965('0x4')],'defaultValue':_0xd965('0xf')},'internal':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':![],'unique':'internal','set':function(_0xd3f08a){this[_0xd965('0x5')]('internal',_0xd3f08a);this['setDataValue']('accountcode',_0xd3f08a);this[_0xd965('0x5')](_0xd965('0x11'),util[_0xd965('0x7')](_0xd965('0x8'),this['getDataValue'](_0xd965('0x12')),_0xd3f08a));}},'salt':{'type':Sequelize[_0xd965('0x4')]},'phone':{'type':Sequelize[_0xd965('0x4')]},'mobile':{'type':Sequelize[_0xd965('0x4')]},'address':{'type':Sequelize[_0xd965('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xd965('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd965('0x13')]},'voicePause':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xd965('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd965('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd965('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xd965('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd965('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd965('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd965('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![],'defaultValue':_0xd965('0x15')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xd965('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xd965('0x16'),_0xd965('0xd'),_0xd965('0x17')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![],'defaultValue':_0xd965('0x18')},'callingpres':{'type':Sequelize[_0xd965('0x19')]('ALLOWED_NOT_SCREENED',_0xd965('0x1a'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xd965('0x1b'),_0xd965('0x1c'),'PROHIB_FAILED_SCREEN',_0xd965('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd965('0x1e'),'set':function(_0x1eb100){this['setDataValue'](_0xd965('0x1f'),_0x1eb100?_0x1eb100[_0xd965('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xd965('0x1f'))?this['getDataValue'](_0xd965('0x1f'))[_0xd965('0x21')](','):null;},'comment':_0xd965('0x22')},'dtmfmode':{'type':Sequelize[_0xd965('0x19')]('rfc2833',_0xd965('0x23'),_0xd965('0x24'),'inband',_0xd965('0x25')),'allowNull':!![],'defaultValue':_0xd965('0x26')},'directmedia':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no',_0xd965('0x28'),_0xd965('0x29'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd965('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd965('0x2a'),'set':function(_0x7e9d74){this[_0xd965('0x5')](_0xd965('0x2b'),_0x7e9d74?_0x7e9d74[_0xd965('0x20')](','):null);},'get':function(){return this[_0xd965('0x9')](_0xd965('0x2b'))?this[_0xd965('0x9')](_0xd965('0x2b'))[_0xd965('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd965('0x4')]},'namedcallgroup':{'type':Sequelize[_0xd965('0x4')]},'pickupgroup':{'type':Sequelize[_0xd965('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xd965('0x4')],'allowNull':![],'defaultValue':_0xd965('0x2c')},'allow':{'type':Sequelize[_0xd965('0x4')],'allowNull':![],'defaultValue':_0xd965('0x2d'),'set':function(_0xd06e2d){this[_0xd965('0x5')](_0xd965('0x2e'),_0xd06e2d?_0xd06e2d[_0xd965('0x20')](';'):_0xd965('0x2d'));},'get':function(){return this['getDataValue']('allow')?this['getDataValue'](_0xd965('0x2e'))[_0xd965('0x21')](';'):null;},'comment':_0xd965('0x2f')},'autoframing':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![],'set':function(_0x27aaf3){this[_0xd965('0x5')]('insecure',_0x27aaf3?_0x27aaf3[_0xd965('0x20')](','):null);},'get':function(){return this[_0xd965('0x9')](_0xd965('0x30'))?this[_0xd965('0x9')]('insecure')['split'](','):null;},'comment':_0xd965('0x31')},'trustrpid':{'type':Sequelize[_0xd965('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd965('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd965('0x32')},'amaflags':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![],'defaultValue':_0xd965('0x27')},'busylevel':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd965('0x19')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd965('0x19')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xd965('0x19')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd965('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd965('0x33'),_0xd965('0x34'),_0xd965('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x36'),'uas'),'allowNull':!![],'defaultValue':_0xd965('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd965('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xd965('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd965('0x19')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no','fingerprint',_0xd965('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x39'),_0xd965('0x3a'),_0xd965('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd965('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd965('0x19')]('yes','no',_0xd965('0x28'),'update',_0xd965('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xd965('0x13')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd965('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x394f0f){this[_0xd965('0x5')](_0xd965('0x3e'),_0x394f0f);var _0x94b3f6=this['get']({'plain':!![]});switch(_0x394f0f){case 0x0:case 0x1:var _0x2bbb5d=_0x94b3f6[_0xd965('0x1f')]?_[_0xd965('0x3f')](_0x94b3f6[_0xd965('0x1f')])?_0x94b3f6[_0xd965('0x1f')][_0xd965('0x20')]():_0x94b3f6['transport']:_0xd965('0x1e');if(_0x2bbb5d===_0xd965('0x40')){_0x2bbb5d=_0xd965('0x1e');}this[_0xd965('0x5')](_0xd965('0x1f'),_0x2bbb5d);this[_0xd965('0x5')](_0xd965('0x41'),'no');this['setDataValue'](_0xd965('0x42'),null);this[_0xd965('0x5')](_0xd965('0x43'),null);this[_0xd965('0x5')](_0xd965('0x44'),null);this['setDataValue'](_0xd965('0x45'),null);this[_0xd965('0x5')](_0xd965('0x46'),null);this[_0xd965('0x5')](_0xd965('0x47'),null);this[_0xd965('0x5')]('dtlscertfile',null);this[_0xd965('0x5')](_0xd965('0x48'),null);this[_0xd965('0x5')]('rtcp_mux','no');break;case 0x2:this[_0xd965('0x5')](_0xd965('0x1f'),_0xd965('0x40'));this[_0xd965('0x5')]('encryption','yes');this[_0xd965('0x5')](_0xd965('0x42'),_0xd965('0x27'));this['setDataValue'](_0xd965('0x43'),'yes');this[_0xd965('0x5')](_0xd965('0x44'),'yes');this[_0xd965('0x5')](_0xd965('0x45'),_0xd965('0x27'));this[_0xd965('0x5')](_0xd965('0x46'),'no');this[_0xd965('0x5')](_0xd965('0x47'),_0xd965('0x3b'));this[_0xd965('0x5')](_0xd965('0x49'),_0x94b3f6[_0xd965('0x49')]||_0xd965('0x4a'));this[_0xd965('0x5')](_0xd965('0x48'),_0x94b3f6['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xd965('0x5')](_0xd965('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xd965('0x3d')],'set':function(_0x1f4f39){this['setDataValue']('permissions',_0x1f4f39?_0x1f4f39['join'](','):[]);},'get':function(){return this[_0xd965('0x9')](_0xd965('0x4c'))?_[_0xd965('0x4d')](this['getDataValue'](_0xd965('0x4c'))['split'](','),function(_0xd8f7d9){return parseInt(_0xd8f7d9,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd965('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd965('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd965('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd965('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd965('0x10')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd965('0x19')](_0xd965('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xd965('0x9')](_0xd965('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xd965('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xd965('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![],'set':function(_0x14b820){if(typeof _0x14b820==='string'){var _0x34c4e2=_0x14b820==='1'?!![]:_0x14b820==='0'?![]:_0x14b820===_0xd965('0x4f')?!![]:_0x14b820===_0xd965('0x50')?![]:![];this[_0xd965('0x5')](_0xd965('0x51'),_0x34c4e2);}else{this['setDataValue']('screenrecording',_0x14b820);}}},'blocked':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![],'set':function(_0x4d720e){this[_0xd965('0x5')](_0xd965('0x52'),_0x4d720e);if(_0x4d720e===!![]){this[_0xd965('0x5')]('blockedAt',moment());this[_0xd965('0x5')](_0xd965('0x53'),0x0);}else{this[_0xd965('0x5')](_0xd965('0x54'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd965('0x10')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd965('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xd965('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xd965('0x10')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xd965('0x14')],'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 5749bc8..bdd296f 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 _0xe68c=['interface','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','emit','voice','VoiceQueue','SIP/%s','upsert','removeQueues','channel','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','join','root','download','existsSync','server/files/images/','chat','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','createdAt','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','sort','pick','hasOwnProperty','CmList','List','Tag','Tags','color','tag','Queue','order','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','loginInPause','format','LOCAL/%s@from-sip/n','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','update','pause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','QueuePause','manual','%s%s','Pause','getTeams','addTeams','Team','Voice','getChatQueues','Chat','getMailQueues','setDataValue','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','VoicePrefixId','removeTeams','getFaxQueues','UserVoicePrefix','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','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','getFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','CmHopper','concat','$or','$gt','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$any','firstName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','getPresence','teams','queues','inbound','lower','col','toString','asc','desc','uniqBy','orderBy','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','QueryTypes','select','field','ui.','InteractionId','user_has_','_interactions','OpenTabs','moment','bluebird','path','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','destroy','get','role','admin','user','Agents','agent','filter','map','value','includes','find','name','stack','index','rawAttributes','fieldName','type','key','password','where','User','query','includeAll','include','attributes','push','rows','openTabs','true','sms','dataValues','mail','openchannel','whatsapp','all','show','params','model','differenceBy','keys','salt','filters','intersection','fields','length','merge','options','fax','body','describe','ids','omit','findById','securePassword','max','internal','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','mailbox','email','permissions','113','110','106','107','108','109','100','111','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','some','findAll','isEmpty','telephone','compact','UserProfileResource','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','online','voicePause'];(function(_0x483a4c,_0xb6cf47){var _0x5c93e1=function(_0x13be1c){while(--_0x13be1c){_0x483a4c['push'](_0x483a4c['shift']());}};_0x5c93e1(++_0xb6cf47);}(_0xe68c,0xfd));var _0xce68=function(_0x2ba80f,_0x1c3e9e){_0x2ba80f=_0x2ba80f-0x0;var _0x36ebea=_0xe68c[_0x2ba80f];return _0x36ebea;};'use strict';var moment=require(_0xce68('0x0'));var BPromise=require(_0xce68('0x1'));var util=require('util');var path=require(_0xce68('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xce68('0x3'));var jayson=require(_0xce68('0x4'));var Redis=require(_0xce68('0x5'));var authService=require(_0xce68('0x6'));var qs=require(_0xce68('0x7'));var logger=require(_0xce68('0x8'))('api');var utils=require(_0xce68('0x9'));var config=require(_0xce68('0xa'));var licenseUtil=require(_0xce68('0xb'));var db=require(_0xce68('0xc'))['db'];var socket=require(_0xce68('0xd'))(new Redis(config[_0xce68('0xe')]));require(_0xce68('0xf'))['register'](socket);config['redis']=_[_0xce68('0x10')](config['redis'],{'host':_0xce68('0x11'),'port':0x18eb});var client=jayson[_0xce68('0x12')][_0xce68('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x3de99b,_0x3d447a,_0x393d4b,_0x16f8a5){return new BPromise(function(_0x5c8fbb,_0x3c806b){var _0x48d785=_0x16f8a5||client;return _0x48d785[_0xce68('0x14')](_0x3de99b,_0x393d4b)[_0xce68('0x15')](function(_0x560798){logger[_0xce68('0x16')](_0xce68('0x17'),_0x3d447a,_0xce68('0x18'));logger[_0xce68('0x19')]('User,\x20%s,\x20%s,\x20%s',_0x3d447a,_0xce68('0x18'),JSON[_0xce68('0x1a')](_0x560798));if(_0x560798[_0xce68('0x1b')]){if(_0x560798[_0xce68('0x1b')]['code']===0x1f4){logger[_0xce68('0x1b')](_0xce68('0x17'),_0x3d447a,_0x560798['error'][_0xce68('0x1c')]);return _0x3c806b(_0x560798[_0xce68('0x1b')][_0xce68('0x1c')]);}logger['error'](_0xce68('0x17'),_0x3d447a,_0x560798[_0xce68('0x1b')][_0xce68('0x1c')]);return _0x5c8fbb(_0x560798[_0xce68('0x1b')][_0xce68('0x1c')]);}else{logger[_0xce68('0x16')](_0xce68('0x17'),_0x3d447a,_0xce68('0x18'));_0x5c8fbb(_0x560798['result'][_0xce68('0x1c')]);}})[_0xce68('0x1d')](function(_0x78a013){logger[_0xce68('0x1b')]('User,\x20%s,\x20%s',_0x3d447a,_0x78a013);_0x3c806b(_0x78a013);});});}function respondWithStatusCode(_0x3d09fa,_0x49566e){_0x49566e=_0x49566e||0xcc;return function(_0x2b3ee8){if(_0x2b3ee8){return _0x3d09fa[_0xce68('0x1e')](_0x49566e);}return _0x3d09fa[_0xce68('0x1f')](_0x49566e)[_0xce68('0x20')]();};}function respondWithResult(_0x353475,_0x4d4159){_0x4d4159=_0x4d4159||0xc8;return function(_0x531b85){if(_0x531b85){return _0x353475[_0xce68('0x1f')](_0x4d4159)[_0xce68('0x21')](_0x531b85);}};}function respondWithFilteredResult(_0x62d87e,_0x1ae4ef){return function(_0x175b51){if(_0x175b51){var _0x112e9e=typeof _0x1ae4ef[_0xce68('0x22')]==='undefined'&&typeof _0x1ae4ef[_0xce68('0x23')]===_0xce68('0x24');var _0x70ad42=_0x175b51[_0xce68('0x25')];var _0x51d6be=_0x112e9e?0x0:_0x1ae4ef[_0xce68('0x22')];var _0x6659a7=_0x112e9e?_0x175b51['count']:_0x1ae4ef['offset']+_0x1ae4ef[_0xce68('0x23')];var _0x55e975;if(_0x6659a7>=_0x70ad42){_0x6659a7=_0x70ad42;_0x55e975=0xc8;}else{_0x55e975=0xce;}_0x62d87e[_0xce68('0x1f')](_0x55e975);return _0x62d87e[_0xce68('0x26')]('Content-Range',_0x51d6be+'-'+_0x6659a7+'/'+_0x70ad42)['json'](_0x175b51);}return null;};}function saveUpdates(_0x25b528){return function(_0x435cd0){if(_0x435cd0){return _0x435cd0['update'](_0x25b528)[_0xce68('0x15')](function(_0x15e8f7){return _0x15e8f7;});}return null;};}function removeEntity(_0x3b9a18){return function(_0x1e5d8f){if(_0x1e5d8f){return _0x1e5d8f[_0xce68('0x27')]()['then'](function(){var _0x85ffcb=_0x1e5d8f[_0xce68('0x28')]({'plain':!![]});if(_0x85ffcb[_0xce68('0x29')]===_0xce68('0x2a'))return;var _0x2bc14e=[{'name':'Users','value':_0xce68('0x2b'),'ignore':!![]},{'name':_0xce68('0x2c'),'value':_0xce68('0x2d'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x3079a4=_(_0x2bc14e)[_0xce68('0x2e')]('ignore')[_0xce68('0x2f')](_0xce68('0x30'))['value']();if(_[_0xce68('0x31')](_0x3079a4,_0x85ffcb['role'])){return;}var _0x45904b=_[_0xce68('0x32')](_0x2bc14e,[_0xce68('0x30'),_0x85ffcb[_0xce68('0x29')]])[_0xce68('0x33')];return db['UserProfileResource'][_0xce68('0x27')]({'where':{'type':_0x45904b,'resourceId':_0x85ffcb['id']}})[_0xce68('0x15')](function(){return _0x1e5d8f;});})[_0xce68('0x15')](function(){_0x3b9a18[_0xce68('0x1f')](0xcc)[_0xce68('0x20')]();});}};}function handleEntityNotFound(_0x28be7a){return function(_0x3f88cf){if(!_0x3f88cf){_0x28be7a[_0xce68('0x1e')](0x194);}return _0x3f88cf;};}function handleError(_0x5a6721,_0x1a9036){_0x1a9036=_0x1a9036||0x1f4;return function(_0x28def9){logger[_0xce68('0x1b')](_0x28def9[_0xce68('0x34')]);if(_0x28def9[_0xce68('0x33')]){delete _0x28def9[_0xce68('0x33')];}_0x5a6721[_0xce68('0x1f')](_0x1a9036)['send'](_0x28def9);};}exports[_0xce68('0x35')]=function(_0x57e21c,_0x50a063){var _0x3b46b8={},_0x361956={'count':0x0,'rows':[]};var _0x479e8e=_(db['User'][_0xce68('0x36')])[_0xce68('0x2f')](function(_0x1aaaee){return{'name':_0x1aaaee[_0xce68('0x37')],'type':_0x1aaaee[_0xce68('0x38')][_0xce68('0x39')]};})[_0xce68('0x2e')](function(_0x25339f){return!_[_0xce68('0x31')]([_0xce68('0x3a'),'salt'],_0x25339f[_0xce68('0x33')]);})[_0xce68('0x30')]();_0x3b46b8=qs['getOptions'](_0x479e8e,_0x57e21c);var _0x59dea0={'where':_0x3b46b8[_0xce68('0x3b')]};return db[_0xce68('0x3c')][_0xce68('0x25')](_0x59dea0)['then'](function(_0x18da21){_0x361956[_0xce68('0x25')]=_0x18da21;if(_0x57e21c[_0xce68('0x3d')][_0xce68('0x3e')]){_0x3b46b8[_0xce68('0x3f')]=[{'all':!![]}];}if(!_['includes'](_0x3b46b8[_0xce68('0x40')],'id')){_0x3b46b8[_0xce68('0x40')][_0xce68('0x41')]('id');}return db[_0xce68('0x3c')]['findAll'](_0x3b46b8);})[_0xce68('0x15')](function(_0x45c040){_0x361956[_0xce68('0x42')]=_0x45c040;if(_0x57e21c[_0xce68('0x3d')][_0xce68('0x43')]===_0xce68('0x44')){var _0x53710c=[];for(var _0x54d394=0x0;_0x54d394<_0x361956[_0xce68('0x42')]['length'];_0x54d394++){_0x53710c[_0xce68('0x41')](get_open_tabs('chat',_0x361956[_0xce68('0x42')][_0x54d394]['dataValues']));_0x53710c['push'](get_open_tabs(_0xce68('0x45'),_0x361956[_0xce68('0x42')][_0x54d394][_0xce68('0x46')]));_0x53710c[_0xce68('0x41')](get_open_tabs('fax',_0x361956[_0xce68('0x42')][_0x54d394][_0xce68('0x46')]));_0x53710c[_0xce68('0x41')](get_open_tabs(_0xce68('0x47'),_0x361956[_0xce68('0x42')][_0x54d394][_0xce68('0x46')]));_0x53710c[_0xce68('0x41')](get_open_tabs(_0xce68('0x48'),_0x361956[_0xce68('0x42')][_0x54d394]['dataValues']));_0x53710c[_0xce68('0x41')](get_open_tabs(_0xce68('0x49'),_0x361956[_0xce68('0x42')][_0x54d394][_0xce68('0x46')]));}return BPromise[_0xce68('0x4a')](_0x53710c)[_0xce68('0x15')](function(_0x2d0e18){return _0x361956;});}else{return _0x361956;}})['then'](respondWithFilteredResult(_0x50a063,_0x3b46b8))[_0xce68('0x1d')](handleError(_0x50a063,null));};exports[_0xce68('0x4b')]=function(_0x27425e,_0x2f5c59){var _0xb3b720={'raw':![],'where':{'id':_0x27425e[_0xce68('0x4c')]['id']}},_0x58a76b={};_0x58a76b[_0xce68('0x4d')]=_[_0xce68('0x4e')](_[_0xce68('0x4f')](db[_0xce68('0x3c')][_0xce68('0x36')]),[_0xce68('0x3a'),_0xce68('0x50')]);_0x58a76b[_0xce68('0x3d')]=_['keys'](_0x27425e[_0xce68('0x3d')]);_0x58a76b[_0xce68('0x51')]=_['intersection'](_0x58a76b[_0xce68('0x4d')],_0x58a76b[_0xce68('0x3d')]);_0xb3b720[_0xce68('0x40')]=_[_0xce68('0x52')](_0x58a76b[_0xce68('0x4d')],qs[_0xce68('0x53')](_0x27425e[_0xce68('0x3d')][_0xce68('0x53')]));_0xb3b720[_0xce68('0x40')]=_0xb3b720[_0xce68('0x40')][_0xce68('0x54')]?_0xb3b720[_0xce68('0x40')]:_0x58a76b[_0xce68('0x4d')];if(_0x27425e[_0xce68('0x3d')]['includeAll']){_0xb3b720['include']=[{'all':!![]}];}_0xb3b720=_[_0xce68('0x55')]({},_0xb3b720,_0x27425e[_0xce68('0x56')]);if(!_[_0xce68('0x31')](_0xb3b720[_0xce68('0x40')],'id')){_0xb3b720[_0xce68('0x40')][_0xce68('0x41')]('id');}return db[_0xce68('0x3c')][_0xce68('0x32')](_0xb3b720)[_0xce68('0x15')](handleEntityNotFound(_0x2f5c59,null))['then'](function(_0x347b42){var _0x3afa9c=[];values=_0x347b42;if(_0x27425e[_0xce68('0x3d')][_0xce68('0x43')]==='true'){_0x3afa9c[_0xce68('0x41')](get_open_tabs('chat',_0x347b42['dataValues']));_0x3afa9c['push'](get_open_tabs('sms',_0x347b42['dataValues']));_0x3afa9c['push'](get_open_tabs('openchannel',_0x347b42[_0xce68('0x46')]));_0x3afa9c['push'](get_open_tabs(_0xce68('0x49'),_0x347b42[_0xce68('0x46')]));_0x3afa9c[_0xce68('0x41')](get_open_tabs(_0xce68('0x57'),_0x347b42[_0xce68('0x46')]));_0x3afa9c[_0xce68('0x41')](get_open_tabs(_0xce68('0x47'),_0x347b42[_0xce68('0x46')]));return BPromise['all'](_0x3afa9c);}else{return values;}})[_0xce68('0x15')](function(_0x1eca2a){return values;})['then'](respondWithResult(_0x2f5c59,null))[_0xce68('0x1d')](handleError(_0x2f5c59,null));};exports['update']=function(_0x997be2,_0x8698bf){if(_0x997be2[_0xce68('0x58')]['id']){delete _0x997be2[_0xce68('0x58')]['id'];}delete _0x997be2[_0xce68('0x58')]['role'];return db[_0xce68('0x3c')][_0xce68('0x32')]({'where':{'id':_0x997be2[_0xce68('0x4c')]['id']}})[_0xce68('0x15')](handleEntityNotFound(_0x8698bf,null))[_0xce68('0x15')](saveUpdates(_0x997be2['body'],null))[_0xce68('0x15')](respondWithResult(_0x8698bf,null))[_0xce68('0x1d')](handleError(_0x8698bf,null));};exports[_0xce68('0x59')]=function(_0x425682,_0x1ed282){return db[_0xce68('0x3c')][_0xce68('0x59')]()[_0xce68('0x15')](respondWithResult(_0x1ed282,null))[_0xce68('0x1d')](handleError(_0x1ed282,null));};exports['addContacts']=function(_0x3bfceb,_0x43b4b9){return db[_0xce68('0x3c')][_0xce68('0x32')]({'where':{'id':_0x3bfceb['params']['id']}})[_0xce68('0x15')](handleEntityNotFound(_0x43b4b9,null))[_0xce68('0x15')](function(_0x3aac79){if(_0x3aac79){return _0x3aac79['addContacts'](_0x3bfceb[_0xce68('0x58')][_0xce68('0x5a')],_[_0xce68('0x5b')](_0x3bfceb['body'],[_0xce68('0x5a'),'id'])||{});}})[_0xce68('0x15')](respondWithResult(_0x43b4b9,null))[_0xce68('0x1d')](handleError(_0x43b4b9,null));};function validateUser(_0x4371d6){return new BPromise(function(_0x197f05,_0x1ef24b){if(_0x4371d6['internal'])return _0x197f05(_0x4371d6);return db['Setting'][_0xce68('0x5c')](0x1)['then'](function(_0x45c642){if(_0x45c642[_0xce68('0x5d')])authService['validatePasswordPattern'](_0x4371d6['password']);db['User'][_0xce68('0x5e')]('internal')['then'](function(_0x4c06a5){if(_['isNil'](_0x4c06a5)){_0x4371d6[_0xce68('0x5f')]=_0x45c642[_0xce68('0x60')]||0x1;return;}if(_[_0xce68('0x61')](_0x45c642['min_internal'])||_0x45c642[_0xce68('0x60')]===_0x4c06a5){_0x4371d6[_0xce68('0x5f')]=_0x4c06a5+0x1;return;}if(_0x45c642['min_internal']>_0x4c06a5){_0x4371d6[_0xce68('0x5f')]=_0x45c642[_0xce68('0x60')];return;}return db[_0xce68('0x62')][_0xce68('0x3d')](_0xce68('0x63'),{'type':db['sequelize']['QueryTypes'][_0xce68('0x64')]})[_0xce68('0x15')](function(_0x240296){if(_0x240296&&_0x240296['length']){for(var _0x3a41d9=0x0,_0x175397=_0x240296[_0xce68('0x54')];_0x3a41d9<_0x175397&&_['isNil'](_0x4371d6[_0xce68('0x5f')]);_0x3a41d9++){if(_0x45c642[_0xce68('0x60')]<=_0x240296[_0x3a41d9]['from']){_0x4371d6[_0xce68('0x5f')]=_0x240296[_0x3a41d9]['from'];}else if(_0x45c642[_0xce68('0x60')]>_0x240296[_0x3a41d9]['from']&&_0x45c642[_0xce68('0x60')]<=_0x240296[_0x3a41d9]['to']){_0x4371d6[_0xce68('0x5f')]=_0x45c642[_0xce68('0x60')];}}}if(_['isNil'](_0x4371d6[_0xce68('0x5f')])){_0x4371d6[_0xce68('0x5f')]=_0x4c06a5+0x1;}return _0x197f05(_0x4371d6);});});})[_0xce68('0x1d')](function(_0x8ca225){_0x1ef24b(_0x8ca225);});});}function updateUser(_0x4dcaec){return new BPromise(function(_0x19502f,_0x34fb4f){try{if(_0x4dcaec['voicemail']){_0x4dcaec[_0xce68('0x65')]=_0x4dcaec['internal'];_0x4dcaec['VoiceMail']={'mailbox':_0x4dcaec[_0xce68('0x5f')],'password':_0x4dcaec['password'],'fullname':_0x4dcaec['fullname'],'email':_0x4dcaec[_0xce68('0x66')]};}if(_0x4dcaec[_0xce68('0x29')]===_0xce68('0x2d')){if(!_0x4dcaec[_0xce68('0x67')])_0x4dcaec[_0xce68('0x67')]=['101','102','103',_0xce68('0x68'),_0xce68('0x69'),'104','105',_0xce68('0x6a'),_0xce68('0x6b'),_0xce68('0x6c'),_0xce68('0x6d'),_0xce68('0x6e'),_0xce68('0x6f'),'114',_0xce68('0x70')];}_0x19502f(_0x4dcaec);}catch(_0x5cf057){_0x34fb4f(_0x5cf057);}});}exports[_0xce68('0x71')]=function(_0x4e0710,_0x7fc5a3){if(_0x4e0710[_0xce68('0x2b')]['role']==='agent')throw new Error(_0xce68('0x72'));if(_0x4e0710[_0xce68('0x58')]['role']===_0xce68('0x2b')&&_0x4e0710[_0xce68('0x2b')][_0xce68('0x29')]!==_0xce68('0x2a')){throw new Error(_0xce68('0x73'));}if(_0x4e0710[_0xce68('0x58')][_0xce68('0x29')]===_0xce68('0x2a')&&_0x4e0710[_0xce68('0x2b')]['role']!==_0xce68('0x2a')){throw new Error(_0xce68('0x74'));}return licenseUtil[_0xce68('0x75')]([_0x4e0710[_0xce68('0x58')]])[_0xce68('0x15')](function(){return validateUser(_0x4e0710[_0xce68('0x58')]);})[_0xce68('0x15')](function(_0x5b3dc7){return updateUser(_0x5b3dc7)[_0xce68('0x15')](function(_0x5346ff){if(_0x5346ff['role']===_0xce68('0x2a')){_0x5346ff[_0xce68('0x76')]=_0x4e0710[_0xce68('0x2b')]['settingsEnabled'];delete _0x5346ff[_0xce68('0x77')];}return _0x5346ff;});})[_0xce68('0x15')](function(_0x1b39f8){return db[_0xce68('0x3c')][_0xce68('0x71')](_0x1b39f8,{'include':[{'model':db[_0xce68('0x78')],'as':'VoiceMail'}]});})[_0xce68('0x15')](function(_0x58412f){if(_0x4e0710[_0xce68('0x58')][_0xce68('0x29')]===_0xce68('0x2b'))return _0x58412f;if(_0x4e0710['user'][_0xce68('0x29')]!==_0xce68('0x2b'))return _0x58412f;return db[_0xce68('0x79')][_0xce68('0x32')]({'where':{'name':_0x58412f[_0xce68('0x29')]===_0xce68('0x2d')?'Agents':_0xce68('0x7a'),'userProfileId':_0x4e0710['user'][_0xce68('0x77')]},'raw':!![]})[_0xce68('0x15')](function(_0x486d82){if(!_0x486d82||_0x486d82[_0xce68('0x7b')]!=0x0)return _0x58412f;return db['UserProfileResource'][_0xce68('0x71')]({'name':_0x58412f['name'],'resourceId':_0x58412f['id'],'type':_0x486d82[_0xce68('0x33')],'sectionId':_0x486d82['id']},{})[_0xce68('0x15')](function(){return _0x58412f;});})[_0xce68('0x1d')](function(_0x1bf095){logger[_0xce68('0x1b')](_0xce68('0x7c'),_0x1bf095);throw _0x1bf095;});})['then'](respondWithResult(_0x7fc5a3,0xc9))[_0xce68('0x1d')](handleError(_0x7fc5a3,null));};exports[_0xce68('0x7d')]=function(_0x298083,_0x136840){var _0x2391e1=_0x298083[_0xce68('0x58')];var _0x27b419=[];if(_0x298083['user'][_0xce68('0x29')]===_0xce68('0x2d'))throw new Error(_0xce68('0x72'));if(_['some'](_0x2391e1,[_0xce68('0x29'),_0xce68('0x2b')])&&_0x298083['user'][_0xce68('0x29')]!=='admin'){throw new Error(_0xce68('0x73'));}if(_['some'](_0x2391e1,[_0xce68('0x29'),_0xce68('0x2a')])&&_0x298083['user'][_0xce68('0x29')]!==_0xce68('0x2a')){throw new Error(_0xce68('0x7e'));}return licenseUtil[_0xce68('0x75')](_0x2391e1)[_0xce68('0x15')](function(){return validateUser(_0x2391e1[0x0]);})[_0xce68('0x15')](function(){for(var _0x452670=0x1;_0x452670<_0x2391e1['length'];_0x452670++){var _0x18812d=_0x2391e1[_0x452670-0x1][_0xce68('0x5f')];if(!_0x2391e1[_0x452670]['internal'])_0x2391e1[_0x452670]['internal']=_0x18812d+0x1;_0x27b419[_0xce68('0x41')](validateUser(_0x2391e1[_0x452670]));}return BPromise[_0xce68('0x4a')](_0x27b419);})[_0xce68('0x15')](function(){_0x27b419=[];for(var _0x499213=0x0;_0x499213<_0x2391e1['length'];_0x499213++){_0x27b419[_0xce68('0x41')](updateUser(_0x2391e1[_0x499213]));}return BPromise[_0xce68('0x4a')](_0x27b419);})[_0xce68('0x15')](function(){return BPromise[_0xce68('0x7f')](_0x2391e1,function(_0x30183c){return db[_0xce68('0x3c')][_0xce68('0x71')](_0x30183c,{'include':[{'model':db[_0xce68('0x78')],'as':_0xce68('0x78')}]})['then'](function(_0x4aa74a){_0x30183c['id']=_0x4aa74a['id'];return _0x30183c;});});})[_0xce68('0x15')](function(_0x2ac097){if(_0x298083[_0xce68('0x58')]['role']===_0xce68('0x2b'))return _0x2ac097;if(_0x298083[_0xce68('0x2b')][_0xce68('0x29')]!=='user')return _0x2ac097;var _0x1a5a0e=_[_0xce68('0x80')](_0x2ac097,function(_0xd4dd69){return _0xd4dd69[_0xce68('0x29')]===_0xce68('0x2d')||_0xd4dd69[_0xce68('0x29')]==='telephone';});if(!_0x1a5a0e)return _0x2ac097;return db[_0xce68('0x79')][_0xce68('0x81')]({'where':{'name':{'$or':[_0xce68('0x2c'),_0xce68('0x7a')]},'userProfileId':_0x298083[_0xce68('0x2b')][_0xce68('0x77')]},'raw':!![]})[_0xce68('0x15')](function(_0x1abffc){if(_[_0xce68('0x82')](_0x1abffc)||!_[_0xce68('0x80')](_0x1abffc,[_0xce68('0x7b'),0x0]))return _0x2ac097;_0x27b419=[];var _0x3d4877=_(_0x1abffc)[_0xce68('0x2f')](function(_0x55f866){if(_0x55f866[_0xce68('0x7b')]===0x1)return;return _0x55f866[_0xce68('0x33')]===_0xce68('0x2c')?_0xce68('0x2d'):_0xce68('0x83');})[_0xce68('0x84')]()[_0xce68('0x30')]();for(var _0x4e1b77=0x0;_0x4e1b77<_0x2ac097[_0xce68('0x54')];_0x4e1b77++){if(!_[_0xce68('0x31')](_0x3d4877,_0x2ac097[_0x4e1b77][_0xce68('0x29')]))return;var _0x207b4c=_0x2ac097[_0x4e1b77][_0xce68('0x29')]===_0xce68('0x2d')?_0xce68('0x2c'):_0xce68('0x7a');_0x27b419['push'](db[_0xce68('0x85')][_0xce68('0x71')]({'name':_0x2ac097[_0x4e1b77][_0xce68('0x33')],'resourceId':_0x2ac097[_0x4e1b77]['id'],'type':_0x207b4c,'sectionId':_['find'](_0x1abffc,[_0xce68('0x33'),_0x207b4c])['id']},{}));}return BPromise[_0xce68('0x4a')](_0x27b419);});})[_0xce68('0x15')](respondWithResult(_0x136840,0xc9))[_0xce68('0x1d')](handleError(_0x136840,null));};exports['changePassword']=function(_0x27f9a0,_0x24fbf4){if(_0x27f9a0[_0xce68('0x58')]['id']){delete _0x27f9a0[_0xce68('0x58')]['id'];}return db['User'][_0xce68('0x32')]({'where':{'id':_0x27f9a0['params']['id']}})['then'](function(_0x9cdae9){if(!_0x9cdae9)return null;if(_0x9cdae9['id']===_0x27f9a0[_0xce68('0x2b')]['id']){if(!_0x27f9a0[_0xce68('0x58')]['oldPassword']||!_0x27f9a0[_0xce68('0x58')][_0xce68('0x86')]){throw new db[(_0xce68('0x87'))][(_0xce68('0x88'))](_0xce68('0x89'));}if(!_0x9cdae9['authenticate'](_0x27f9a0[_0xce68('0x58')][_0xce68('0x8a')])){throw new db[(_0xce68('0x87'))][(_0xce68('0x88'))](_0xce68('0x8b'));}if(_0x27f9a0[_0xce68('0x58')]['oldPassword']===_0x27f9a0['body'][_0xce68('0x86')]){throw new db[(_0xce68('0x87'))][(_0xce68('0x88'))](_0xce68('0x8c'));}}else if(_0x27f9a0[_0xce68('0x2b')][_0xce68('0x29')]==='admin'){if(!_0x27f9a0['body'][_0xce68('0x86')]){throw new db['Sequelize']['ValidationError'](_0xce68('0x8d'));}}else if(_0x27f9a0[_0xce68('0x2b')][_0xce68('0x29')]===_0xce68('0x2b')){if(!_0x27f9a0[_0xce68('0x58')][_0xce68('0x86')]){throw new db[(_0xce68('0x87'))][(_0xce68('0x88'))](_0xce68('0x8d'));}if(_0x9cdae9[_0xce68('0x29')]!=='agent'){throw new db[(_0xce68('0x87'))][(_0xce68('0x88'))](_0xce68('0x72'));}}else{throw new db[(_0xce68('0x87'))]['ValidationError']('Unauthorized');}return _0x9cdae9;})[_0xce68('0x15')](handleEntityNotFound(_0x24fbf4,null))[_0xce68('0x15')](function(_0x1e632c){return db[_0xce68('0x8e')][_0xce68('0x8f')]({'attributes':['id',_0xce68('0x5d'),_0xce68('0x90'),_0xce68('0x91')]})['then'](function(_0xa91c7d){if(_0xa91c7d[_0xce68('0x5d')])authService[_0xce68('0x92')](_0x27f9a0['body'][_0xce68('0x86')]);if(!_0xa91c7d[_0xce68('0x90')]||!_0x1e632c[_0xce68('0x93')])return _0x1e632c;authService[_0xce68('0x94')](_0x27f9a0[_0xce68('0x58')]['newPassword'],_0x1e632c['previousPasswords'],_0xa91c7d[_0xce68('0x91')]);return _0x1e632c;})[_0xce68('0x15')](saveUpdates({'password':_0x27f9a0[_0xce68('0x58')][_0xce68('0x86')],'passwordResetAt':_0x27f9a0[_0xce68('0x2b')]['id']==_0x27f9a0[_0xce68('0x4c')]['id']?moment():null,'previousPasswords':authService[_0xce68('0x95')](_0x27f9a0[_0xce68('0x58')]['newPassword'],_0x1e632c[_0xce68('0x93')])},null));})[_0xce68('0x15')](respondWithResult(_0x24fbf4,null))[_0xce68('0x1d')](handleError(_0x24fbf4,null));};exports[_0xce68('0x96')]=function(_0x1ec1e9,_0x686921){var _0x5852d3=_0x1ec1e9[_0xce68('0x58')]['channel'];return db[_0xce68('0x3c')][_0xce68('0x32')]({'where':{'id':_0x1ec1e9[_0xce68('0x4c')]['id']},'attributes':['id',_0xce68('0x33'),_0xce68('0x29'),_0xce68('0x97'),'loginInPause',_0xce68('0x98'),_0xce68('0x99')]})[_0xce68('0x15')](handleEntityNotFound(_0x686921,null))[_0xce68('0x15')](function(_0x395977){if(_0x395977){if(!utils[_0xce68('0x9a')](_0x5852d3)){throw new db[(_0xce68('0x87'))]['ValidationError'](_0xce68('0x9b'));}return _0x395977[_0xce68('0x9c')+_['capitalize'](_0x5852d3[_0xce68('0x9d')]())+_0xce68('0x9e')](_0x1ec1e9['body']['ids'],{'penalty':_0x1ec1e9[_0xce68('0x58')][_0xce68('0x9f')]||0x0})[_0xce68('0xa0')](function(_0x4d32e8){for(var _0x5d145d=0x0;_0x5d145d<_0x1ec1e9['body'][_0xce68('0x5a')][_0xce68('0x54')];_0x5d145d+=0x1){var _0x1173b4={'UserId':Number(_0x1ec1e9[_0xce68('0x4c')]['id'])};_0x1173b4[_[_0xce68('0xa1')](_0x5852d3[_0xce68('0x9d')]())+_0xce68('0xa2')]=Number(_0x1ec1e9[_0xce68('0x58')][_0xce68('0x5a')][_0x5d145d]);socket[_0xce68('0xa3')]('user'+_[_0xce68('0xa1')](_0x5852d3[_0xce68('0x9d')]())+'Queue:save',_0x1173b4);}return _0x4d32e8;})['then'](function(){if(_0x5852d3===_0xce68('0xa4')){return db[_0xce68('0xa5')]['findAll']({'where':{'id':_0x1ec1e9[_0xce68('0x58')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0xce68('0x15')](function(_0x5d6392){var _0x54d0c2=_0x395977[_0xce68('0x28')]({'plain':!![]});var _0xb6edc7=[];if(_0x5852d3===_0xce68('0xa4')&&_0x54d0c2[_0xce68('0x29')]==='agent'&&_0x54d0c2[_0xce68('0x97')]){for(var _0x2e9172=0x0;_0x2e9172<_0x5d6392[_0xce68('0x54')];_0x2e9172+=0x1){_0xb6edc7[_0xce68('0x41')]({'membername':_0x54d0c2[_0xce68('0x33')],'UserId':_0x54d0c2['id'],'queue_name':_0x5d6392[_0x2e9172][_0xce68('0x33')],'VoiceQueueId':_0x5d6392[_0x2e9172]['id'],'interface':_[_0xce68('0x61')](_0x54d0c2[_0xce68('0x99')])?util['format'](_0xce68('0xa6'),_0x54d0c2[_0xce68('0x33')]):_0x54d0c2[_0xce68('0x99')],'paused':_0x54d0c2[_0xce68('0x98')]||![],'penalty':_0x1ec1e9['body']['penalty']||0x0});}return BPromise[_0xce68('0x7f')](_0xb6edc7,function(_0x3f0c35){return db['UserVoiceQueueRt'][_0xce68('0xa7')](_0x3f0c35);});}return _0x395977;});}})[_0xce68('0x15')](respondWithStatusCode(_0x686921,null))['catch'](handleError(_0x686921,null));};exports[_0xce68('0xa8')]=function(_0x4e8f0c,_0x31d211){var _0x5b7841;return db[_0xce68('0x3c')][_0xce68('0x32')]({'where':{'id':_0x4e8f0c[_0xce68('0x4c')]['id']},'attributes':['id',_0xce68('0x33'),_0xce68('0x29')]})[_0xce68('0x15')](handleEntityNotFound(_0x31d211,null))['then'](function(_0x5e45c7){if(_0x5e45c7){_0x5b7841=_0x5e45c7;if(!_0x4e8f0c[_0xce68('0x3d')]['channel']||!utils[_0xce68('0x9a')](_0x4e8f0c[_0xce68('0x3d')][_0xce68('0xa9')])){throw new db[(_0xce68('0x87'))]['ValidationError'](_0xce68('0x9b'));}return _0x5e45c7[_0xce68('0xaa')+_['capitalize'](_0x4e8f0c[_0xce68('0x3d')][_0xce68('0xa9')]['toLowerCase']())+'Queues'](_0x4e8f0c['query'][_0xce68('0x5a')]);}})[_0xce68('0x15')](function(_0x2f84b1){if(_[_0xce68('0xab')](_0x4e8f0c[_0xce68('0x3d')][_0xce68('0x5a')])){for(var _0x53fdf8=0x0;_0x53fdf8<_0x4e8f0c['query'][_0xce68('0x5a')]['length'];_0x53fdf8+=0x1){var _0x2d317f={'UserId':Number(_0x4e8f0c[_0xce68('0x4c')]['id'])};_0x2d317f[_[_0xce68('0xa1')](_0x4e8f0c[_0xce68('0x3d')]['channel'][_0xce68('0x9d')]())+_0xce68('0xa2')]=Number(_0x4e8f0c['query'][_0xce68('0x5a')][_0x53fdf8]);socket[_0xce68('0xa3')]('user'+_[_0xce68('0xa1')](_0x4e8f0c[_0xce68('0x3d')][_0xce68('0xa9')][_0xce68('0x9d')]())+'Queue:remove',_0x2d317f);}}else{var _0x2d317f={'UserId':Number(_0x4e8f0c[_0xce68('0x4c')]['id'])};_0x2d317f[_[_0xce68('0xa1')](_0x4e8f0c['query'][_0xce68('0xa9')][_0xce68('0x9d')]())+'QueueId']=Number(_0x4e8f0c['query'][_0xce68('0x5a')]);socket[_0xce68('0xa3')](_0xce68('0x2b')+_[_0xce68('0xa1')](_0x4e8f0c[_0xce68('0x3d')]['channel']['toLowerCase']())+_0xce68('0xac'),_0x2d317f);}return _0x2f84b1;})[_0xce68('0x15')](function(){if(_0x4e8f0c[_0xce68('0x3d')]['channel']===_0xce68('0xa4')){return db[_0xce68('0xad')][_0xce68('0x27')]({'where':{'UserId':_0x4e8f0c[_0xce68('0x4c')]['id'],'VoiceQueueId':_0x4e8f0c[_0xce68('0x3d')]['ids']},'individualHooks':!![]})[_0xce68('0x15')](function(){return _0x5b7841;});}return _0x5b7841;})[_0xce68('0x15')](respondWithStatusCode(_0x31d211,null))['catch'](handleError(_0x31d211,null));};exports[_0xce68('0xae')]=function(_0x4a2da0,_0x819d57){_0x4a2da0[_0xce68('0x58')][_0xce68('0xaf')]=_0x4a2da0['file']['filename'];return db['User'][_0xce68('0x32')]({'where':{'id':_0x4a2da0[_0xce68('0x4c')]['id']}})[_0xce68('0x15')](handleEntityNotFound(_0x819d57,null))[_0xce68('0x15')](saveUpdates(_0x4a2da0[_0xce68('0x58')],null))[_0xce68('0x15')](respondWithResult(_0x819d57,null))[_0xce68('0x1d')](handleError(_0x819d57,null));};exports['getAvatar']=function(_0x395a03,_0x465c3e){var _0xcc966f=path[_0xce68('0xb0')](config[_0xce68('0xb1')],'server/files/images/logos/default_profile.png');return db[_0xce68('0x3c')][_0xce68('0x32')]({'where':{'id':_0x395a03[_0xce68('0x4c')]['id']},'attributes':['id',_0xce68('0xaf')],'raw':!![]})[_0xce68('0x15')](handleEntityNotFound(_0x465c3e,null))[_0xce68('0x15')](function(_0x12cda1){if(_0x12cda1){if(_[_0xce68('0x61')](_0x12cda1['userpic'])){return _0x465c3e[_0xce68('0xb2')](_0xcc966f);}else{if(!fs[_0xce68('0xb3')](path[_0xce68('0xb0')](config[_0xce68('0xb1')],'server/files/images/',_0x12cda1['userpic']))){return _0x465c3e['download'](_0xcc966f);}return _0x465c3e['download'](path[_0xce68('0xb0')](config[_0xce68('0xb1')],_0xce68('0xb4'),_0x12cda1[_0xce68('0xaf')]));}}})[_0xce68('0x1d')](handleError(_0x465c3e,null));};exports['getOpenTabs']=function(_0x2dbc72,_0x2c868b){return db[_0xce68('0x3c')][_0xce68('0x32')]({'where':{'id':_0x2dbc72['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2c868b,null))[_0xce68('0x15')](function(_0x210e1a){var _0x5afd45=[];values=_0x210e1a[_0xce68('0x46')];_0x5afd45[_0xce68('0x41')](get_open_tabs(_0xce68('0xb5'),_0x210e1a['dataValues']));_0x5afd45[_0xce68('0x41')](get_open_tabs(_0xce68('0x45'),_0x210e1a[_0xce68('0x46')]));_0x5afd45[_0xce68('0x41')](get_open_tabs(_0xce68('0x48'),_0x210e1a[_0xce68('0x46')]));_0x5afd45[_0xce68('0x41')](get_open_tabs('whatsapp',_0x210e1a[_0xce68('0x46')]));_0x5afd45[_0xce68('0x41')](get_open_tabs(_0xce68('0x57'),_0x210e1a['dataValues']));_0x5afd45[_0xce68('0x41')](get_open_tabs(_0xce68('0x47'),_0x210e1a[_0xce68('0x46')]));return BPromise[_0xce68('0x4a')](_0x5afd45);})[_0xce68('0x15')](function(_0x45f45e){var _0x5948a3=[];if(_0x45f45e){for(var _0x3750a4=0x0;_0x3750a4=_0x55d6c0){_0xd25fd3=_0x55d6c0;_0x25e8a7=0xc8;}else{_0x25e8a7=0xce;}_0x5a5520['status'](_0x25e8a7);return _0x5a5520[_0xfc17('0x26')](_0xfc17('0x27'),_0x59209e+'-'+_0xd25fd3+'/'+_0x55d6c0)[_0xfc17('0x21')](_0x488282);}return null;};}function saveUpdates(_0x3c9dda){return function(_0x22766d){if(_0x22766d){return _0x22766d[_0xfc17('0x28')](_0x3c9dda)[_0xfc17('0x13')](function(_0x27fee4){return _0x27fee4;});}return null;};}function removeEntity(_0x4ad84f){return function(_0x71a310){if(_0x71a310){return _0x71a310[_0xfc17('0x29')]()[_0xfc17('0x13')](function(){var _0x202a08=_0x71a310['get']({'plain':!![]});if(_0x202a08[_0xfc17('0x2a')]==='admin')return;var _0xb9f64c=[{'name':_0xfc17('0x2b'),'value':_0xfc17('0x2c'),'ignore':!![]},{'name':_0xfc17('0x2d'),'value':_0xfc17('0x2e'),'ignore':![]},{'name':_0xfc17('0x2f'),'value':_0xfc17('0x30'),'ignore':![]}];var _0x59dda6=_(_0xb9f64c)[_0xfc17('0x31')]('ignore')[_0xfc17('0x32')](_0xfc17('0x33'))[_0xfc17('0x33')]();if(_[_0xfc17('0x34')](_0x59dda6,_0x202a08[_0xfc17('0x2a')])){return;}var _0x4ea734=_[_0xfc17('0x35')](_0xb9f64c,['value',_0x202a08['role']])[_0xfc17('0x36')];return db[_0xfc17('0x37')][_0xfc17('0x29')]({'where':{'type':_0x4ea734,'resourceId':_0x202a08['id']}})[_0xfc17('0x13')](function(){return _0x71a310;});})[_0xfc17('0x13')](function(){_0x4ad84f[_0xfc17('0x20')](0xcc)[_0xfc17('0x1f')]();});}};}function handleEntityNotFound(_0x1cdf35){return function(_0xc0a881){if(!_0xc0a881){_0x1cdf35[_0xfc17('0x1e')](0x194);}return _0xc0a881;};}function handleError(_0x4ee6d8,_0x31efb7){_0x31efb7=_0x31efb7||0x1f4;return function(_0x339a8c){logger[_0xfc17('0x18')](_0x339a8c[_0xfc17('0x38')]);if(_0x339a8c[_0xfc17('0x36')]){delete _0x339a8c[_0xfc17('0x36')];}_0x4ee6d8[_0xfc17('0x20')](_0x31efb7)[_0xfc17('0x39')](_0x339a8c);};}exports['index']=function(_0x5f14b1,_0x240975){var _0x36abfe={},_0x204d0c={'count':0x0,'rows':[]};var _0x130cef=_(db['User'][_0xfc17('0x3a')])[_0xfc17('0x32')](function(_0x48696f){return{'name':_0x48696f[_0xfc17('0x3b')],'type':_0x48696f[_0xfc17('0x3c')]['key']};})[_0xfc17('0x31')](function(_0x3f6886){return!_[_0xfc17('0x34')]([_0xfc17('0x3d'),_0xfc17('0x3e')],_0x3f6886[_0xfc17('0x36')]);})[_0xfc17('0x33')]();_0x36abfe=qs[_0xfc17('0x3f')](_0x130cef,_0x5f14b1);var _0x59af18={'where':_0x36abfe[_0xfc17('0x40')]};return db[_0xfc17('0x41')]['count'](_0x59af18)['then'](function(_0x3e9789){_0x204d0c[_0xfc17('0x25')]=_0x3e9789;if(_0x5f14b1[_0xfc17('0x42')][_0xfc17('0x43')]){_0x36abfe[_0xfc17('0x44')]=[{'all':!![]}];}if(!_[_0xfc17('0x34')](_0x36abfe[_0xfc17('0x45')],'id')){_0x36abfe[_0xfc17('0x45')]['push']('id');}return db[_0xfc17('0x41')][_0xfc17('0x46')](_0x36abfe);})['then'](function(_0x89ead8){_0x204d0c[_0xfc17('0x47')]=_0x89ead8;if(_0x5f14b1[_0xfc17('0x42')][_0xfc17('0x48')]===_0xfc17('0x49')){var _0x2b7730=[];for(var _0x4ca51d=0x0;_0x4ca51d<_0x204d0c[_0xfc17('0x47')][_0xfc17('0x4a')];_0x4ca51d++){_0x2b7730[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x4c'),_0x204d0c['rows'][_0x4ca51d]['dataValues']));_0x2b7730[_0xfc17('0x4b')](get_open_tabs('sms',_0x204d0c['rows'][_0x4ca51d]['dataValues']));_0x2b7730[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x4d'),_0x204d0c[_0xfc17('0x47')][_0x4ca51d][_0xfc17('0x4e')]));_0x2b7730['push'](get_open_tabs(_0xfc17('0x4f'),_0x204d0c[_0xfc17('0x47')][_0x4ca51d][_0xfc17('0x4e')]));_0x2b7730['push'](get_open_tabs('openchannel',_0x204d0c[_0xfc17('0x47')][_0x4ca51d][_0xfc17('0x4e')]));_0x2b7730[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x50'),_0x204d0c[_0xfc17('0x47')][_0x4ca51d][_0xfc17('0x4e')]));}return BPromise['all'](_0x2b7730)[_0xfc17('0x13')](function(_0x2ef857){return _0x204d0c;});}else{return _0x204d0c;}})[_0xfc17('0x13')](respondWithFilteredResult(_0x240975,_0x36abfe))['catch'](handleError(_0x240975,null));};exports[_0xfc17('0x51')]=function(_0x4af10e,_0x5ed7f9){var _0x5a25da={'raw':![],'where':{'id':_0x4af10e[_0xfc17('0x52')]['id']}},_0x16251b={};_0x16251b['model']=_[_0xfc17('0x53')](_['keys'](db['User'][_0xfc17('0x3a')]),[_0xfc17('0x3d'),_0xfc17('0x3e')]);_0x16251b[_0xfc17('0x42')]=_['keys'](_0x4af10e[_0xfc17('0x42')]);_0x16251b['filters']=_[_0xfc17('0x54')](_0x16251b[_0xfc17('0x55')],_0x16251b[_0xfc17('0x42')]);_0x5a25da[_0xfc17('0x45')]=_[_0xfc17('0x54')](_0x16251b[_0xfc17('0x55')],qs[_0xfc17('0x56')](_0x4af10e[_0xfc17('0x42')][_0xfc17('0x56')]));_0x5a25da[_0xfc17('0x45')]=_0x5a25da['attributes']['length']?_0x5a25da[_0xfc17('0x45')]:_0x16251b[_0xfc17('0x55')];if(_0x4af10e['query']['includeAll']){_0x5a25da[_0xfc17('0x44')]=[{'all':!![]}];}_0x5a25da=_[_0xfc17('0x57')]({},_0x5a25da,_0x4af10e['options']);if(!_[_0xfc17('0x34')](_0x5a25da['attributes'],'id')){_0x5a25da['attributes'][_0xfc17('0x4b')]('id');}return db[_0xfc17('0x41')][_0xfc17('0x35')](_0x5a25da)[_0xfc17('0x13')](handleEntityNotFound(_0x5ed7f9,null))[_0xfc17('0x13')](function(_0x22380b){var _0x139e15=[];values=_0x22380b;if(_0x4af10e['query'][_0xfc17('0x48')]===_0xfc17('0x49')){_0x139e15[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x4c'),_0x22380b['dataValues']));_0x139e15['push'](get_open_tabs(_0xfc17('0x58'),_0x22380b[_0xfc17('0x4e')]));_0x139e15[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x59'),_0x22380b[_0xfc17('0x4e')]));_0x139e15[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x50'),_0x22380b['dataValues']));_0x139e15[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x4d'),_0x22380b[_0xfc17('0x4e')]));_0x139e15[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x4f'),_0x22380b[_0xfc17('0x4e')]));return BPromise['all'](_0x139e15);}else{return values;}})[_0xfc17('0x13')](function(_0x3837de){return values;})['then'](respondWithResult(_0x5ed7f9,null))[_0xfc17('0x1d')](handleError(_0x5ed7f9,null));};exports['update']=function(_0x3f0733,_0x142bb0){if(_0x3f0733[_0xfc17('0x5a')]['id']){delete _0x3f0733[_0xfc17('0x5a')]['id'];}delete _0x3f0733[_0xfc17('0x5a')][_0xfc17('0x2a')];return db[_0xfc17('0x41')][_0xfc17('0x35')]({'where':{'id':_0x3f0733[_0xfc17('0x52')]['id']}})[_0xfc17('0x13')](handleEntityNotFound(_0x142bb0,null))[_0xfc17('0x13')](saveUpdates(_0x3f0733[_0xfc17('0x5a')],null))[_0xfc17('0x13')](respondWithResult(_0x142bb0,null))['catch'](handleError(_0x142bb0,null));};exports[_0xfc17('0x5b')]=function(_0x1885fb,_0x3c1569){return db[_0xfc17('0x41')][_0xfc17('0x5b')]()['then'](respondWithResult(_0x3c1569,null))[_0xfc17('0x1d')](handleError(_0x3c1569,null));};exports[_0xfc17('0x5c')]=function(_0x1f2b60,_0xeca6fb){return db['User']['find']({'where':{'id':_0x1f2b60[_0xfc17('0x52')]['id']}})['then'](handleEntityNotFound(_0xeca6fb,null))[_0xfc17('0x13')](function(_0x54cb12){if(_0x54cb12){return _0x54cb12[_0xfc17('0x5c')](_0x1f2b60[_0xfc17('0x5a')]['ids'],_['omit'](_0x1f2b60[_0xfc17('0x5a')],[_0xfc17('0x5d'),'id'])||{});}})[_0xfc17('0x13')](respondWithResult(_0xeca6fb,null))[_0xfc17('0x1d')](handleError(_0xeca6fb,null));};function validateUser(_0x542d7c){return new BPromise(function(_0x5cf15f,_0x4ce666){if(_0x542d7c['internal'])return _0x5cf15f(_0x542d7c);return db['Setting'][_0xfc17('0x5e')](0x1)[_0xfc17('0x13')](function(_0x1ac343){if(_0x1ac343[_0xfc17('0x5f')])authService[_0xfc17('0x60')](_0x542d7c[_0xfc17('0x3d')]);db['User'][_0xfc17('0x61')](_0xfc17('0x62'))[_0xfc17('0x13')](function(_0x2fd781){if(_[_0xfc17('0x63')](_0x2fd781)){_0x542d7c[_0xfc17('0x62')]=_0x1ac343[_0xfc17('0x64')]||0x1;return;}if(_[_0xfc17('0x63')](_0x1ac343[_0xfc17('0x64')])||_0x1ac343[_0xfc17('0x64')]===_0x2fd781){_0x542d7c[_0xfc17('0x62')]=_0x2fd781+0x1;return;}if(_0x1ac343[_0xfc17('0x64')]>_0x2fd781){_0x542d7c[_0xfc17('0x62')]=_0x1ac343[_0xfc17('0x64')];return;}return db[_0xfc17('0x65')]['query'](_0xfc17('0x66'),{'type':db['sequelize'][_0xfc17('0x67')]['SELECT']})[_0xfc17('0x13')](function(_0x48a967){if(_0x48a967&&_0x48a967[_0xfc17('0x4a')]){for(var _0x1198a2=0x0,_0x4d5804=_0x48a967['length'];_0x1198a2<_0x4d5804&&_[_0xfc17('0x63')](_0x542d7c[_0xfc17('0x62')]);_0x1198a2++){if(_0x1ac343[_0xfc17('0x64')]<=_0x48a967[_0x1198a2][_0xfc17('0x68')]){_0x542d7c['internal']=_0x48a967[_0x1198a2][_0xfc17('0x68')];}else if(_0x1ac343[_0xfc17('0x64')]>_0x48a967[_0x1198a2][_0xfc17('0x68')]&&_0x1ac343[_0xfc17('0x64')]<=_0x48a967[_0x1198a2]['to']){_0x542d7c['internal']=_0x1ac343[_0xfc17('0x64')];}}}if(_['isNil'](_0x542d7c[_0xfc17('0x62')])){_0x542d7c['internal']=_0x2fd781+0x1;}return _0x5cf15f(_0x542d7c);});});})['catch'](function(_0x5b39b0){_0x4ce666(_0x5b39b0);});});}function updateUser(_0xc7b23){return new BPromise(function(_0x1cd2f0,_0x15e05a){try{if(_0xc7b23['voicemail']){_0xc7b23[_0xfc17('0x69')]=_0xc7b23[_0xfc17('0x62')];_0xc7b23[_0xfc17('0x6a')]={'mailbox':_0xc7b23[_0xfc17('0x62')],'password':_0xc7b23[_0xfc17('0x3d')],'fullname':_0xc7b23[_0xfc17('0x6b')],'email':_0xc7b23[_0xfc17('0x6c')]};}if(_0xc7b23['role']===_0xfc17('0x2e')){if(!_0xc7b23[_0xfc17('0x6d')])_0xc7b23['permissions']=['101',_0xfc17('0x6e'),_0xfc17('0x6f'),_0xfc17('0x70'),'110',_0xfc17('0x71'),_0xfc17('0x72'),'106',_0xfc17('0x73'),_0xfc17('0x74'),_0xfc17('0x75'),_0xfc17('0x76'),'111',_0xfc17('0x77'),_0xfc17('0x78')];}_0x1cd2f0(_0xc7b23);}catch(_0x5dd4cf){_0x15e05a(_0x5dd4cf);}});}exports[_0xfc17('0x79')]=function(_0x28458e,_0x35d8d1){if(_0x28458e[_0xfc17('0x2c')][_0xfc17('0x2a')]==='agent')throw new Error(_0xfc17('0x7a'));if(_0x28458e[_0xfc17('0x5a')]['role']===_0xfc17('0x2c')&&_0x28458e['user'][_0xfc17('0x2a')]!==_0xfc17('0x7b')){throw new Error(_0xfc17('0x7c'));}if(_0x28458e[_0xfc17('0x5a')][_0xfc17('0x2a')]==='admin'&&_0x28458e[_0xfc17('0x2c')][_0xfc17('0x2a')]!==_0xfc17('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x28458e[_0xfc17('0x5a')]])[_0xfc17('0x13')](function(){return validateUser(_0x28458e[_0xfc17('0x5a')]);})[_0xfc17('0x13')](function(_0xbfdc43){return updateUser(_0xbfdc43)[_0xfc17('0x13')](function(_0x2a1dcb){if(_0x2a1dcb[_0xfc17('0x2a')]===_0xfc17('0x7b')){_0x2a1dcb[_0xfc17('0x7d')]=_0x28458e[_0xfc17('0x2c')][_0xfc17('0x7d')];delete _0x2a1dcb[_0xfc17('0x7e')];}return _0x2a1dcb;});})['then'](function(_0x3a133a){return db[_0xfc17('0x41')][_0xfc17('0x79')](_0x3a133a,{'include':[{'model':db['VoiceMail'],'as':_0xfc17('0x6a')}]});})[_0xfc17('0x13')](function(_0x3ce0cc){if(_0x28458e[_0xfc17('0x5a')][_0xfc17('0x2a')]===_0xfc17('0x2c'))return _0x3ce0cc;if(_0x28458e[_0xfc17('0x2c')][_0xfc17('0x2a')]!==_0xfc17('0x2c'))return _0x3ce0cc;return db[_0xfc17('0x7f')][_0xfc17('0x35')]({'where':{'name':_0x3ce0cc[_0xfc17('0x2a')]==='agent'?'Agents':_0xfc17('0x2f'),'userProfileId':_0x28458e[_0xfc17('0x2c')][_0xfc17('0x7e')]},'raw':!![]})['then'](function(_0x2e5ac2){if(!_0x2e5ac2||_0x2e5ac2['autoAssociation']!=0x0)return _0x3ce0cc;return db[_0xfc17('0x37')][_0xfc17('0x79')]({'name':_0x3ce0cc['name'],'resourceId':_0x3ce0cc['id'],'type':_0x2e5ac2[_0xfc17('0x36')],'sectionId':_0x2e5ac2['id']},{})[_0xfc17('0x13')](function(){return _0x3ce0cc;});})[_0xfc17('0x1d')](function(_0x19eb07){logger[_0xfc17('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19eb07);throw _0x19eb07;});})['then'](respondWithResult(_0x35d8d1,0xc9))[_0xfc17('0x1d')](handleError(_0x35d8d1,null));};exports[_0xfc17('0x80')]=function(_0x2c8be3,_0x474430){var _0x48ea90=_0x2c8be3[_0xfc17('0x5a')];var _0x58dfa8=[];if(_0x2c8be3[_0xfc17('0x2c')][_0xfc17('0x2a')]===_0xfc17('0x2e'))throw new Error(_0xfc17('0x7a'));if(_[_0xfc17('0x81')](_0x48ea90,[_0xfc17('0x2a'),_0xfc17('0x2c')])&&_0x2c8be3[_0xfc17('0x2c')][_0xfc17('0x2a')]!==_0xfc17('0x7b')){throw new Error(_0xfc17('0x7c'));}if(_[_0xfc17('0x81')](_0x48ea90,['role','admin'])&&_0x2c8be3['user'][_0xfc17('0x2a')]!=='admin'){throw new Error(_0xfc17('0x82'));}return licenseUtil[_0xfc17('0x83')](_0x48ea90)[_0xfc17('0x13')](function(){return validateUser(_0x48ea90[0x0]);})['then'](function(){for(var _0x5b1db1=0x1;_0x5b1db1<_0x48ea90[_0xfc17('0x4a')];_0x5b1db1++){var _0x1d3420=_0x48ea90[_0x5b1db1-0x1][_0xfc17('0x62')];if(!_0x48ea90[_0x5b1db1]['internal'])_0x48ea90[_0x5b1db1][_0xfc17('0x62')]=_0x1d3420+0x1;_0x58dfa8[_0xfc17('0x4b')](validateUser(_0x48ea90[_0x5b1db1]));}return BPromise[_0xfc17('0x84')](_0x58dfa8);})[_0xfc17('0x13')](function(){_0x58dfa8=[];for(var _0x30b6fa=0x0;_0x30b6fa<_0x48ea90[_0xfc17('0x4a')];_0x30b6fa++){_0x58dfa8[_0xfc17('0x4b')](updateUser(_0x48ea90[_0x30b6fa]));}return BPromise[_0xfc17('0x84')](_0x58dfa8);})[_0xfc17('0x13')](function(){return BPromise[_0xfc17('0x85')](_0x48ea90,function(_0x513e21){return db['User'][_0xfc17('0x79')](_0x513e21,{'include':[{'model':db[_0xfc17('0x6a')],'as':_0xfc17('0x6a')}]})[_0xfc17('0x13')](function(_0x1aa690){_0x513e21['id']=_0x1aa690['id'];return _0x513e21;});});})['then'](function(_0x10b0c4){if(_0x2c8be3[_0xfc17('0x5a')][_0xfc17('0x2a')]===_0xfc17('0x2c'))return _0x10b0c4;if(_0x2c8be3[_0xfc17('0x2c')][_0xfc17('0x2a')]!==_0xfc17('0x2c'))return _0x10b0c4;var _0x5b6443=_[_0xfc17('0x81')](_0x10b0c4,function(_0x1ff3d8){return _0x1ff3d8[_0xfc17('0x2a')]===_0xfc17('0x2e')||_0x1ff3d8['role']==='telephone';});if(!_0x5b6443)return _0x10b0c4;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0xfc17('0x2d'),_0xfc17('0x2f')]},'userProfileId':_0x2c8be3[_0xfc17('0x2c')]['userProfileId']},'raw':!![]})['then'](function(_0x33f471){if(_[_0xfc17('0x86')](_0x33f471)||!_[_0xfc17('0x81')](_0x33f471,['autoAssociation',0x0]))return _0x10b0c4;_0x58dfa8=[];var _0x22e520=_(_0x33f471)['map'](function(_0x1587c2){if(_0x1587c2[_0xfc17('0x87')]===0x1)return;return _0x1587c2['name']==='Agents'?_0xfc17('0x2e'):_0xfc17('0x30');})[_0xfc17('0x88')]()['value']();for(var _0x405f2f=0x0;_0x405f2f<_0x10b0c4[_0xfc17('0x4a')];_0x405f2f++){if(!_[_0xfc17('0x34')](_0x22e520,_0x10b0c4[_0x405f2f][_0xfc17('0x2a')]))return;var _0xaf53b8=_0x10b0c4[_0x405f2f][_0xfc17('0x2a')]==='agent'?_0xfc17('0x2d'):_0xfc17('0x2f');_0x58dfa8[_0xfc17('0x4b')](db[_0xfc17('0x37')][_0xfc17('0x79')]({'name':_0x10b0c4[_0x405f2f][_0xfc17('0x36')],'resourceId':_0x10b0c4[_0x405f2f]['id'],'type':_0xaf53b8,'sectionId':_[_0xfc17('0x35')](_0x33f471,[_0xfc17('0x36'),_0xaf53b8])['id']},{}));}return BPromise[_0xfc17('0x84')](_0x58dfa8);});})[_0xfc17('0x13')](respondWithResult(_0x474430,0xc9))[_0xfc17('0x1d')](handleError(_0x474430,null));};exports[_0xfc17('0x89')]=function(_0x3c17e1,_0x569742){if(_0x3c17e1['body']['id']){delete _0x3c17e1[_0xfc17('0x5a')]['id'];}return db[_0xfc17('0x41')][_0xfc17('0x35')]({'where':{'id':_0x3c17e1[_0xfc17('0x52')]['id']}})[_0xfc17('0x13')](function(_0x3fc654){if(!_0x3fc654)return null;if(_0x3fc654['id']===_0x3c17e1[_0xfc17('0x2c')]['id']){if(!_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8a')]||!_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8b')]){throw new db[(_0xfc17('0x8c'))][(_0xfc17('0x8d'))](_0xfc17('0x8e'));}if(!_0x3fc654[_0xfc17('0x8f')](_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8a')])){throw new db[(_0xfc17('0x8c'))][(_0xfc17('0x8d'))](_0xfc17('0x90'));}if(_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8a')]===_0x3c17e1['body'][_0xfc17('0x8b')]){throw new db[(_0xfc17('0x8c'))][(_0xfc17('0x8d'))](_0xfc17('0x91'));}}else if(_0x3c17e1['user']['role']===_0xfc17('0x7b')){if(!_0x3c17e1[_0xfc17('0x5a')]['newPassword']){throw new db[(_0xfc17('0x8c'))]['ValidationError'](_0xfc17('0x92'));}}else if(_0x3c17e1[_0xfc17('0x2c')]['role']===_0xfc17('0x2c')){if(!_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8b')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3fc654[_0xfc17('0x2a')]!=='agent'){throw new db[(_0xfc17('0x8c'))][(_0xfc17('0x8d'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0xfc17('0x8d'))](_0xfc17('0x7a'));}return _0x3fc654;})['then'](handleEntityNotFound(_0x569742,null))[_0xfc17('0x13')](function(_0x25cbec){return db[_0xfc17('0x93')][_0xfc17('0x94')]({'attributes':['id',_0xfc17('0x5f'),'enforcePasswordHistory',_0xfc17('0x95')]})['then'](function(_0x4da07d){if(_0x4da07d['securePassword'])authService[_0xfc17('0x60')](_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8b')]);if(!_0x4da07d['enforcePasswordHistory']||!_0x25cbec['previousPasswords'])return _0x25cbec;authService[_0xfc17('0x96')](_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8b')],_0x25cbec[_0xfc17('0x97')],_0x4da07d[_0xfc17('0x95')]);return _0x25cbec;})[_0xfc17('0x13')](saveUpdates({'password':_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8b')],'passwordResetAt':_0x3c17e1[_0xfc17('0x2c')]['id']==_0x3c17e1[_0xfc17('0x52')]['id']?moment():null,'previousPasswords':authService[_0xfc17('0x98')](_0x3c17e1[_0xfc17('0x5a')][_0xfc17('0x8b')],_0x25cbec[_0xfc17('0x97')])},null));})[_0xfc17('0x13')](respondWithResult(_0x569742,null))[_0xfc17('0x1d')](handleError(_0x569742,null));};exports['addQueues']=function(_0x18d8d9,_0x23dbd6){var _0xcc75b2=_0x18d8d9[_0xfc17('0x5a')][_0xfc17('0x99')];return db['User'][_0xfc17('0x35')]({'where':{'id':_0x18d8d9[_0xfc17('0x52')]['id']},'attributes':['id','name',_0xfc17('0x2a'),_0xfc17('0x9a'),_0xfc17('0x9b'),_0xfc17('0x9c'),_0xfc17('0x9d')]})[_0xfc17('0x13')](handleEntityNotFound(_0x23dbd6,null))[_0xfc17('0x13')](function(_0xf5d57b){if(_0xf5d57b){if(!utils[_0xfc17('0x9e')](_0xcc75b2)){throw new db[(_0xfc17('0x8c'))][(_0xfc17('0x8d'))](_0xfc17('0x9f'));}return _0xf5d57b[_0xfc17('0xa0')+_[_0xfc17('0xa1')](_0xcc75b2[_0xfc17('0xa2')]())+'Queues'](_0x18d8d9['body'][_0xfc17('0x5d')],{'penalty':_0x18d8d9[_0xfc17('0x5a')]['penalty']||0x0})[_0xfc17('0xa3')](function(_0x56f426){for(var _0x4ad6fc=0x0;_0x4ad6fc<_0x18d8d9[_0xfc17('0x5a')][_0xfc17('0x5d')][_0xfc17('0x4a')];_0x4ad6fc+=0x1){var _0x2ed320={'UserId':Number(_0x18d8d9[_0xfc17('0x52')]['id'])};_0x2ed320[_['capitalize'](_0xcc75b2[_0xfc17('0xa2')]())+_0xfc17('0xa4')]=Number(_0x18d8d9['body']['ids'][_0x4ad6fc]);socket[_0xfc17('0xa5')](_0xfc17('0x2c')+_[_0xfc17('0xa1')](_0xcc75b2[_0xfc17('0xa2')]())+_0xfc17('0xa6'),_0x2ed320);}return _0x56f426;})['then'](function(){if(_0xcc75b2===_0xfc17('0xa7')){return db[_0xfc17('0xa8')][_0xfc17('0x46')]({'where':{'id':_0x18d8d9[_0xfc17('0x5a')][_0xfc17('0x5d')]||[]},'raw':!![],'attributes':['id',_0xfc17('0x36')]});}})[_0xfc17('0x13')](function(_0x1b4fab){var _0x31b7d6=_0xf5d57b['get']({'plain':!![]});var _0x3217b1=[];if(_0xcc75b2===_0xfc17('0xa7')&&_0x31b7d6['role']===_0xfc17('0x2e')&&_0x31b7d6['online']){for(var _0xc4fdc6=0x0;_0xc4fdc6<_0x1b4fab[_0xfc17('0x4a')];_0xc4fdc6+=0x1){_0x3217b1[_0xfc17('0x4b')]({'membername':_0x31b7d6[_0xfc17('0x36')],'UserId':_0x31b7d6['id'],'queue_name':_0x1b4fab[_0xc4fdc6][_0xfc17('0x36')],'VoiceQueueId':_0x1b4fab[_0xc4fdc6]['id'],'interface':_[_0xfc17('0x63')](_0x31b7d6[_0xfc17('0x9d')])?util[_0xfc17('0xa9')](_0xfc17('0xaa'),_0x31b7d6['name']):_0x31b7d6[_0xfc17('0x9d')],'paused':_0x31b7d6[_0xfc17('0x9c')]||![],'penalty':_0x18d8d9[_0xfc17('0x5a')][_0xfc17('0xab')]||0x0});}return BPromise['each'](_0x3217b1,function(_0x4d26c4){return db[_0xfc17('0xac')][_0xfc17('0xad')](_0x4d26c4);});}return _0xf5d57b;});}})[_0xfc17('0x13')](respondWithStatusCode(_0x23dbd6,null))[_0xfc17('0x1d')](handleError(_0x23dbd6,null));};exports[_0xfc17('0xae')]=function(_0x57b9dd,_0x3fcd16){var _0x202a07;return db[_0xfc17('0x41')][_0xfc17('0x35')]({'where':{'id':_0x57b9dd['params']['id']},'attributes':['id',_0xfc17('0x36'),_0xfc17('0x2a')]})['then'](handleEntityNotFound(_0x3fcd16,null))[_0xfc17('0x13')](function(_0x3d53ab){if(_0x3d53ab){_0x202a07=_0x3d53ab;if(!_0x57b9dd['query'][_0xfc17('0x99')]||!utils['isValidChannel'](_0x57b9dd['query'][_0xfc17('0x99')])){throw new db[(_0xfc17('0x8c'))][(_0xfc17('0x8d'))]('Unknown\x20channel');}return _0x3d53ab[_0xfc17('0xaf')+_[_0xfc17('0xa1')](_0x57b9dd[_0xfc17('0x42')][_0xfc17('0x99')][_0xfc17('0xa2')]())+_0xfc17('0xb0')](_0x57b9dd[_0xfc17('0x42')][_0xfc17('0x5d')]);}})[_0xfc17('0x13')](function(_0x239eb6){if(_['isArray'](_0x57b9dd['query'][_0xfc17('0x5d')])){for(var _0x1347c9=0x0;_0x1347c9<_0x57b9dd['query']['ids'][_0xfc17('0x4a')];_0x1347c9+=0x1){var _0x5db7e1={'UserId':Number(_0x57b9dd[_0xfc17('0x52')]['id'])};_0x5db7e1[_[_0xfc17('0xa1')](_0x57b9dd[_0xfc17('0x42')][_0xfc17('0x99')][_0xfc17('0xa2')]())+_0xfc17('0xa4')]=Number(_0x57b9dd[_0xfc17('0x42')]['ids'][_0x1347c9]);socket['emit'](_0xfc17('0x2c')+_[_0xfc17('0xa1')](_0x57b9dd[_0xfc17('0x42')][_0xfc17('0x99')][_0xfc17('0xa2')]())+_0xfc17('0xb1'),_0x5db7e1);}}else{var _0x5db7e1={'UserId':Number(_0x57b9dd[_0xfc17('0x52')]['id'])};_0x5db7e1[_['capitalize'](_0x57b9dd[_0xfc17('0x42')][_0xfc17('0x99')][_0xfc17('0xa2')]())+_0xfc17('0xa4')]=Number(_0x57b9dd[_0xfc17('0x42')]['ids']);socket[_0xfc17('0xa5')]('user'+_[_0xfc17('0xa1')](_0x57b9dd[_0xfc17('0x42')][_0xfc17('0x99')][_0xfc17('0xa2')]())+'Queue:remove',_0x5db7e1);}return _0x239eb6;})[_0xfc17('0x13')](function(){if(_0x57b9dd[_0xfc17('0x42')]['channel']==='voice'){return db[_0xfc17('0xac')][_0xfc17('0x29')]({'where':{'UserId':_0x57b9dd[_0xfc17('0x52')]['id'],'VoiceQueueId':_0x57b9dd['query'][_0xfc17('0x5d')]},'individualHooks':!![]})['then'](function(){return _0x202a07;});}return _0x202a07;})[_0xfc17('0x13')](respondWithStatusCode(_0x3fcd16,null))[_0xfc17('0x1d')](handleError(_0x3fcd16,null));};exports[_0xfc17('0xb2')]=function(_0x13baff,_0x1f7e02){_0x13baff[_0xfc17('0x5a')][_0xfc17('0xb3')]=_0x13baff[_0xfc17('0xb4')][_0xfc17('0xb5')];return db[_0xfc17('0x41')][_0xfc17('0x35')]({'where':{'id':_0x13baff[_0xfc17('0x52')]['id']}})[_0xfc17('0x13')](handleEntityNotFound(_0x1f7e02,null))['then'](saveUpdates(_0x13baff[_0xfc17('0x5a')],null))[_0xfc17('0x13')](respondWithResult(_0x1f7e02,null))[_0xfc17('0x1d')](handleError(_0x1f7e02,null));};exports['getAvatar']=function(_0x2ad23e,_0x1893d8){var _0x481251=path[_0xfc17('0xb6')](config[_0xfc17('0xb7')],_0xfc17('0xb8'));return db[_0xfc17('0x41')]['find']({'where':{'id':_0x2ad23e[_0xfc17('0x52')]['id']},'attributes':['id',_0xfc17('0xb3')],'raw':!![]})[_0xfc17('0x13')](handleEntityNotFound(_0x1893d8,null))[_0xfc17('0x13')](function(_0x333cbf){if(_0x333cbf){if(_[_0xfc17('0x63')](_0x333cbf[_0xfc17('0xb3')])){return _0x1893d8[_0xfc17('0xb9')](_0x481251);}else{if(!fs[_0xfc17('0xba')](path[_0xfc17('0xb6')](config[_0xfc17('0xb7')],'server/files/images/',_0x333cbf[_0xfc17('0xb3')]))){return _0x1893d8[_0xfc17('0xb9')](_0x481251);}return _0x1893d8['download'](path[_0xfc17('0xb6')](config['root'],_0xfc17('0xbb'),_0x333cbf[_0xfc17('0xb3')]));}}})[_0xfc17('0x1d')](handleError(_0x1893d8,null));};exports['getOpenTabs']=function(_0x5c6bfc,_0x3a5a04){return db[_0xfc17('0x41')][_0xfc17('0x35')]({'where':{'id':_0x5c6bfc[_0xfc17('0x52')]['id']},'attributes':['id']})[_0xfc17('0x13')](handleEntityNotFound(_0x3a5a04,null))['then'](function(_0x294e55){var _0x1756cb=[];values=_0x294e55[_0xfc17('0x4e')];_0x1756cb[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x4c'),_0x294e55['dataValues']));_0x1756cb[_0xfc17('0x4b')](get_open_tabs('sms',_0x294e55[_0xfc17('0x4e')]));_0x1756cb['push'](get_open_tabs(_0xfc17('0x59'),_0x294e55[_0xfc17('0x4e')]));_0x1756cb[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x50'),_0x294e55['dataValues']));_0x1756cb['push'](get_open_tabs(_0xfc17('0x4d'),_0x294e55[_0xfc17('0x4e')]));_0x1756cb[_0xfc17('0x4b')](get_open_tabs(_0xfc17('0x4f'),_0x294e55[_0xfc17('0x4e')]));return BPromise[_0xfc17('0x84')](_0x1756cb);})[_0xfc17('0x13')](function(_0x110519){var _0x1e8a59=[];if(_0x110519){for(var _0xa8eaa9=0x0;_0xa8eaa9=_0xcc510['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x3623('0x10')](function(){if(_0x7ba2fa){return db[_0x3623('0x3c')][_0x3623('0x4f')]({'where':{'membername':_0x7ba2fa[_0x3623('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x7ba2fa){return _0x7ba2fa[_0x3623('0x50')]({'raw':!![]});}})['then'](function(_0x1428c8){if(_0x7ba2fa){if(_0x1428c8){var _0x48dde3=[];_0x3c084f=_0x1428c8;if(_0x3c084f['length']){for(var _0xc857aa=0x0;_0xc857aa<_0x3c084f[_0x3623('0x30')];_0xc857aa++){_0x48dde3[_0x3623('0x44')](db[_0x3623('0x3c')]['upsert']({'membername':_0x7ba2fa[_0x3623('0x27')],'UserId':_0x7ba2fa['id'],'queue_name':_0x3c084f[_0xc857aa][_0x3623('0x27')],'VoiceQueueId':_0x3c084f[_0xc857aa]['id'],'interface':_0x56d3f5,'paused':_0x7ba2fa['loginInPause']||![],'penalty':_0x3c084f[_0xc857aa]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x3623('0x51')](_0x48dde3);}}}})[_0x3623('0x10')](function(){if(_0x7ba2fa){return db[_0x3623('0x2c')][_0x3623('0x1a')]({'where':{'membername':_0x7ba2fa[_0x3623('0x27')],'exitAt':null}});}})[_0x3623('0x10')](function(_0x19983f){if(_0x7ba2fa){if(_0x19983f&&_0x19983f['length']){var _0x2dfde0=[];_0x19983f['forEach'](function(_0xff56f4){_0x2dfde0[_0x3623('0x44')](_0xff56f4[_0x3623('0x2b')]({'exitAt':moment()[_0x3623('0x2e')](_0x3623('0x2f'))}));});return BPromise['all'](_0x2dfde0);}}})[_0x3623('0x10')](function(_0x56c41a){if(_0x7ba2fa){var _0x3de9f2=[];var _0x34de95=[];var _0x4b985a=utils[_0x3623('0x52')]();var _0x1b0ff5={'membername':_0x7ba2fa[_0x3623('0x27')],'interface':_0x56d3f5,'enterAt':moment()[_0x3623('0x2e')](_0x3623('0x2f')),'role':_0x7ba2fa[_0x3623('0x28')],'internal':_0x7ba2fa[_0x3623('0x29')]};_0x4b985a['forEach'](function(_0x24239c){_0x3de9f2[_0x3623('0x44')](_[_0x3623('0x53')]({'channel':_0x24239c,'type':'LOGIN','data1':_0x3623('0x54'),'data2':_0x56d3f5},_0x1b0ff5));if(_0x7ba2fa[_0x3623('0x48')]){_0x34de95[_0x3623('0x44')](_['merge']({'channel':_0x24239c,'type':_0x3623('0x2d'),'data1':'LOGININPAUSE'},_0x1b0ff5));}});return db[_0x3623('0x2c')][_0x3623('0x35')](_0x3de9f2[_0x3623('0x55')](_0x34de95),{'individualHooks':!![]});}})['then'](function(){if(_0x7ba2fa){return _0x7ba2fa[_0x3623('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x3623('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x7ba2fa[_0x3623('0x48')]||![],'mailPause':_0x7ba2fa['loginInPause']||![],'chatPause':_0x7ba2fa['loginInPause']||![],'faxPause':_0x7ba2fa[_0x3623('0x48')]||![],'smsPause':_0x7ba2fa[_0x3623('0x48')]||![],'openchannelPause':_0x7ba2fa[_0x3623('0x48')]||![],'pauseType':_0x7ba2fa[_0x3623('0x48')]?_0x3623('0x56'):null,'lastPauseAt':moment()[_0x3623('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x56d3f5});}})[_0x3623('0x10')](function(_0x34590d){_0x3a1d82(_0x34590d);})[_0x3623('0x17')](function(_0x28f427){_0x57886d(_0x205161['error'](0x1f4,_0x28f427[_0x3623('0x16')]));});});}; \ No newline at end of file +var _0xd166=['chat','sms','openchannel','whatsapp','set','%s%s','destroy','length','forEach','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','all','internal','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetUser','User','findAll','options','raw','attributes','limit','map','model','include','catch','ShowUser','find','PauseUser','where','role','interface','UserVoiceQueueRt','update','MemberReport','name','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail'];(function(_0x4390e5,_0x10eb7c){var _0x4e7d65=function(_0x3c9012){while(--_0x3c9012){_0x4390e5['push'](_0x4390e5['shift']());}};_0x4e7d65(++_0x10eb7c);}(_0xd166,0xda));var _0x6d16=function(_0x441380,_0x73cd00){_0x441380=_0x441380-0x0;var _0x3cc38b=_0xd166[_0x441380];return _0x3cc38b;};'use strict';var _=require(_0x6d16('0x0'));var util=require(_0x6d16('0x1'));var moment=require(_0x6d16('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d16('0x3'));var fs=require('fs');var Redis=require(_0x6d16('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d16('0x5'));var logger=require('../../config/logger')(_0x6d16('0x6'));var config=require(_0x6d16('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6d16('0x8')][_0x6d16('0x9')]({'port':0x232a});config[_0x6d16('0xa')]=_[_0x6d16('0xb')](config[_0x6d16('0xa')],{'host':_0x6d16('0xc'),'port':0x18eb});var socket=require(_0x6d16('0xd'))(new Redis(config[_0x6d16('0xa')]));require(_0x6d16('0xe'))[_0x6d16('0xf')](socket);function respondWithRpcPromise(_0xd56b7d,_0x594479,_0xa06e98){return new BPromise(function(_0x2fc92d,_0x20eb6a){return client['request'](_0xd56b7d,_0xa06e98)[_0x6d16('0x10')](function(_0x350d30){logger[_0x6d16('0x11')](_0x6d16('0x12'),_0x594479,_0x6d16('0x13'));logger[_0x6d16('0x14')](_0x6d16('0x15'),_0x594479,'request\x20sent',JSON[_0x6d16('0x16')](_0x350d30));if(_0x350d30[_0x6d16('0x17')]){if(_0x350d30['error'][_0x6d16('0x18')]===0x1f4){logger[_0x6d16('0x17')](_0x6d16('0x12'),_0x594479,_0x350d30[_0x6d16('0x17')][_0x6d16('0x19')]);return _0x20eb6a(_0x350d30[_0x6d16('0x17')][_0x6d16('0x19')]);}logger[_0x6d16('0x17')](_0x6d16('0x12'),_0x594479,_0x350d30[_0x6d16('0x17')][_0x6d16('0x19')]);return _0x2fc92d(_0x350d30['error'][_0x6d16('0x19')]);}else{logger[_0x6d16('0x11')]('User,\x20%s,\x20%s',_0x594479,'request\x20sent');_0x2fc92d(_0x350d30['result'][_0x6d16('0x19')]);}})['catch'](function(_0xa8ec28){logger[_0x6d16('0x17')](_0x6d16('0x12'),_0x594479,_0xa8ec28);_0x20eb6a(_0xa8ec28);});});}exports[_0x6d16('0x1a')]=function(_0x50e70c){var _0x3d3ab8=this;return new Promise(function(_0x38627f,_0x16eafc){return db[_0x6d16('0x1b')][_0x6d16('0x1c')]({'raw':_0x50e70c['options']?_0x50e70c[_0x6d16('0x1d')][_0x6d16('0x1e')]===undefined?!![]:![]:!![],'where':_0x50e70c[_0x6d16('0x1d')]?_0x50e70c[_0x6d16('0x1d')]['where']||null:null,'attributes':_0x50e70c[_0x6d16('0x1d')]?_0x50e70c['options'][_0x6d16('0x1f')]||null:null,'limit':_0x50e70c[_0x6d16('0x1d')]?_0x50e70c[_0x6d16('0x1d')][_0x6d16('0x20')]||null:null,'include':_0x50e70c[_0x6d16('0x1d')]?_0x50e70c[_0x6d16('0x1d')]['include']?_[_0x6d16('0x21')](_0x50e70c[_0x6d16('0x1d')]['include'],function(_0x1b080d){return{'model':db[_0x1b080d[_0x6d16('0x22')]],'as':_0x1b080d['as'],'attributes':_0x1b080d[_0x6d16('0x1f')],'include':_0x1b080d[_0x6d16('0x23')]?_[_0x6d16('0x21')](_0x1b080d[_0x6d16('0x23')],function(_0x527779){return{'model':db[_0x527779[_0x6d16('0x22')]],'as':_0x527779['as'],'attributes':_0x527779['attributes'],'include':_0x527779['include']?_[_0x6d16('0x21')](_0x527779[_0x6d16('0x23')],function(_0x1c756e){return{'model':db[_0x1c756e[_0x6d16('0x22')]],'as':_0x1c756e['as'],'attributes':_0x1c756e[_0x6d16('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1784fb){logger[_0x6d16('0x11')](_0x6d16('0x1a'),_0x50e70c);logger[_0x6d16('0x14')](_0x6d16('0x1a'),_0x50e70c,JSON[_0x6d16('0x16')](_0x1784fb));_0x38627f(_0x1784fb);})[_0x6d16('0x24')](function(_0x51e2ce){logger[_0x6d16('0x17')](_0x6d16('0x1a'),_0x51e2ce['message'],_0x50e70c);_0x16eafc(_0x3d3ab8['error'](0x1f4,_0x51e2ce[_0x6d16('0x19')]));});});};exports[_0x6d16('0x25')]=function(_0xa865f1){var _0x4a25dc=this;return new Promise(function(_0xcb67de,_0x4af448){return db['User'][_0x6d16('0x26')]({'raw':_0xa865f1['options']?_0xa865f1[_0x6d16('0x1d')][_0x6d16('0x1e')]===undefined?!![]:![]:!![],'where':_0xa865f1[_0x6d16('0x1d')]?_0xa865f1[_0x6d16('0x1d')]['where']||null:null,'attributes':_0xa865f1[_0x6d16('0x1d')]?_0xa865f1[_0x6d16('0x1d')][_0x6d16('0x1f')]||null:null,'include':_0xa865f1[_0x6d16('0x1d')]?_0xa865f1['options']['include']?_['map'](_0xa865f1[_0x6d16('0x1d')][_0x6d16('0x23')],function(_0x522406){return{'model':db[_0x522406[_0x6d16('0x22')]],'as':_0x522406['as'],'attributes':_0x522406[_0x6d16('0x1f')],'include':_0x522406[_0x6d16('0x23')]?_[_0x6d16('0x21')](_0x522406[_0x6d16('0x23')],function(_0x5f4216){return{'model':db[_0x5f4216[_0x6d16('0x22')]],'as':_0x5f4216['as'],'attributes':_0x5f4216[_0x6d16('0x1f')],'include':_0x5f4216[_0x6d16('0x23')]?_[_0x6d16('0x21')](_0x5f4216['include'],function(_0x265674){return{'model':db[_0x265674[_0x6d16('0x22')]],'as':_0x265674['as'],'attributes':_0x265674[_0x6d16('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d4849){logger[_0x6d16('0x11')](_0x6d16('0x25'),_0xa865f1);logger[_0x6d16('0x14')](_0x6d16('0x25'),_0xa865f1,JSON[_0x6d16('0x16')](_0x2d4849));_0xcb67de(_0x2d4849);})[_0x6d16('0x24')](function(_0x372d68){logger['error']('ShowUser',_0x372d68['message'],_0xa865f1);_0x4af448(_0x4a25dc[_0x6d16('0x17')](0x1f4,_0x372d68['message']));});});};exports[_0x6d16('0x27')]=function(_0x420930){var _0x2dde5d=this;return new Promise(function(_0x24f8ee,_0x42731d){var _0x2773bb;return db[_0x6d16('0x1b')][_0x6d16('0x26')]({'where':_0x420930[_0x6d16('0x1d')][_0x6d16('0x28')]||{},'attributes':['id','name',_0x6d16('0x29'),'internal',_0x6d16('0x2a')]})[_0x6d16('0x10')](function(_0x1bef5c){if(_0x1bef5c){_0x2773bb=_0x1bef5c;return db[_0x6d16('0x2b')][_0x6d16('0x2c')]({'paused':0x1},{'where':{'UserId':_0x2773bb['id']},'individualHooks':!![]});}})['then'](function(){if(_0x2773bb){return db[_0x6d16('0x2d')][_0x6d16('0x1c')]({'where':{'membername':_0x2773bb[_0x6d16('0x2e')],'type':_0x6d16('0x2f'),'exitAt':null}});}})[_0x6d16('0x10')](function(_0x3bf80a){if(_0x2773bb){if(_0x3bf80a&&_0x3bf80a['length']){var _0x155d87=moment()[_0x6d16('0x30')](_0x6d16('0x31'));for(var _0x2180f9=0x0,_0x2592b3=_0x3bf80a['length'];_0x2180f9<_0x2592b3;_0x2180f9++){_0x3bf80a[_0x2180f9][_0x6d16('0x32')]({'exitAt':_0x155d87});}}}})[_0x6d16('0x10')](function(){if(_0x2773bb){var _0x823e05=[];var _0xb3dec1=utils[_0x6d16('0x33')]();_0xb3dec1['forEach'](function(_0x49e17f){_0x823e05[_0x6d16('0x34')]({'channel':_0x49e17f,'membername':_0x2773bb[_0x6d16('0x2e')],'interface':_[_0x6d16('0x35')](_0x2773bb['interface'])?util['format'](_0x6d16('0x36'),_0x2773bb[_0x6d16('0x2e')]):_0x2773bb[_0x6d16('0x2a')],'type':_0x6d16('0x2f'),'enterAt':moment()[_0x6d16('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x420930[_0x6d16('0x37')][_0x6d16('0x38')]||_0x6d16('0x39'),'role':_0x2773bb[_0x6d16('0x29')],'internal':_0x2773bb['internal'],'uniqueid':_0x420930[_0x6d16('0x37')][_0x6d16('0x3a')]||null});});return db[_0x6d16('0x2d')][_0x6d16('0x3b')](_0x823e05,{'individualHooks':!![]});}})[_0x6d16('0x10')](function(){if(_0x2773bb){return _0x2773bb[_0x6d16('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x420930[_0x6d16('0x37')][_0x6d16('0x38')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6d16('0x30')](_0x6d16('0x31'))});}})[_0x6d16('0x10')](function(_0x132dd0){_0x24f8ee(_0x132dd0);})['catch'](function(_0x3d0223){_0x42731d(_0x2dde5d[_0x6d16('0x17')](0x1f4,_0x3d0223['message']));});});};exports[_0x6d16('0x3c')]=function(_0x45c533){var _0x136c1c=this;return new Promise(function(_0x399082,_0x293ee5){var _0x4532d7;return db[_0x6d16('0x1b')][_0x6d16('0x3d')]({'where':_0x45c533['options'][_0x6d16('0x28')]||{},'attributes':['id','name']})['then'](function(_0x5ca55e){if(_0x5ca55e){_0x4532d7=_0x5ca55e;if(_0x45c533[_0x6d16('0x37')][_0x6d16('0x3e')]&&!utils['isValidChannel'](_0x45c533[_0x6d16('0x37')][_0x6d16('0x3e')])){throw new Error(_0x6d16('0x3f'));}switch(_0x45c533[_0x6d16('0x37')][_0x6d16('0x3e')]){case _0x6d16('0x40'):return db[_0x6d16('0x2b')]['update']({'paused':0x0},{'where':{'UserId':_0x4532d7['id']}})[_0x6d16('0x10')](function(){return db[_0x6d16('0x2d')][_0x6d16('0x26')]({'where':{'channel':_0x45c533[_0x6d16('0x37')]['channel'],'membername':_0x4532d7[_0x6d16('0x2e')],'type':_0x6d16('0x2f'),'exitAt':null}});})[_0x6d16('0x10')](function(_0x38ba75){if(_0x38ba75){return _0x38ba75['update']({'exitAt':moment()[_0x6d16('0x30')](_0x6d16('0x31')),'data2':_0x6d16('0x41')},{'individualHooks':!![]});}return null;})[_0x6d16('0x10')](function(){return _0x4532d7[_0x6d16('0x2c')]({'voicePause':![]});});case _0x6d16('0x42'):case _0x6d16('0x43'):case'fax':case _0x6d16('0x44'):case _0x6d16('0x45'):case _0x6d16('0x46'):return db['MemberReport'][_0x6d16('0x26')]({'where':{'channel':_0x45c533[_0x6d16('0x37')][_0x6d16('0x3e')],'membername':_0x4532d7[_0x6d16('0x2e')],'type':_0x6d16('0x2f'),'exitAt':null}})[_0x6d16('0x10')](function(_0x468a5f){return _0x468a5f[_0x6d16('0x2c')]({'exitAt':moment()['format'](_0x6d16('0x31')),'data2':_0x6d16('0x41')},{'individualHooks':!![]});})['then'](function(){var _0x326c0d={};_[_0x6d16('0x47')](_0x326c0d,util[_0x6d16('0x30')](_0x6d16('0x48'),_0x45c533[_0x6d16('0x37')][_0x6d16('0x3e')],'Pause'),![]);return _0x4532d7[_0x6d16('0x2c')](_0x326c0d);});default:return db[_0x6d16('0x2b')][_0x6d16('0x2c')]({'paused':0x0},{'where':{'UserId':_0x4532d7['id']}})[_0x6d16('0x10')](function(){return db[_0x6d16('0x2d')][_0x6d16('0x1c')]({'where':{'membername':_0x4532d7['name'],'type':_0x6d16('0x2f'),'exitAt':null}});})[_0x6d16('0x10')](function(_0x5b194a){var _0x4d0c1f=[];_0x5b194a['forEach'](function(_0x37ee91){_0x4d0c1f[_0x6d16('0x34')](_0x37ee91[_0x6d16('0x2c')]({'exitAt':moment()[_0x6d16('0x30')](_0x6d16('0x31')),'data2':_0x6d16('0x41')}));});return BPromise['all'](_0x4d0c1f);})[_0x6d16('0x10')](function(){return _0x4532d7[_0x6d16('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x6d16('0x10')](function(_0x5ae2b1){_0x399082(_0x5ae2b1);})['catch'](function(_0x561f30){_0x293ee5(_0x136c1c[_0x6d16('0x17')](0x1f4,_0x561f30[_0x6d16('0x19')]));});});};exports['LogoutUser']=function(_0x263c80){var _0x51ba35=this;return new Promise(function(_0x2fe068,_0xeaa239){var _0x1dbb2a;return db['User'][_0x6d16('0x3d')]({'where':_0x263c80[_0x6d16('0x1d')][_0x6d16('0x28')]||{},'attributes':['id',_0x6d16('0x2e')]})[_0x6d16('0x10')](function(_0x2d36d8){if(_0x2d36d8){_0x1dbb2a=_0x2d36d8;return db['UserVoiceQueueRt'][_0x6d16('0x49')]({'where':{'membername':_0x1dbb2a[_0x6d16('0x2e')]},'individualHooks':!![]});}})[_0x6d16('0x10')](function(){if(_0x1dbb2a){return db[_0x6d16('0x2d')][_0x6d16('0x1c')]({'where':{'membername':_0x1dbb2a['name'],'exitAt':null}});}})[_0x6d16('0x10')](function(_0x1f2b4d){if(_0x1dbb2a){if(_0x1f2b4d&&_0x1f2b4d[_0x6d16('0x4a')]){var _0x1208e2=[];_0x1f2b4d[_0x6d16('0x4b')](function(_0x24cd87){_0x1208e2[_0x6d16('0x34')](_0x24cd87[_0x6d16('0x2c')]({'exitAt':moment()[_0x6d16('0x30')](_0x6d16('0x31'))}));});return BPromise['all'](_0x1208e2);}}})[_0x6d16('0x10')](function(){if(_0x1dbb2a){return _0x1dbb2a[_0x6d16('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xe51a9){_0x2fe068(_0xe51a9);})[_0x6d16('0x24')](function(_0x3bebb5){_0xeaa239(_0x51ba35[_0x6d16('0x17')](0x1f4,_0x3bebb5[_0x6d16('0x19')]));});});};exports[_0x6d16('0x4c')]=function(_0xa1a742){var _0x38c56d=this;return new Promise(function(_0x531e86,_0x52e992){var _0x131288;var _0x4440e2;var _0x1c70ef;var _0x2f74ac;return db['User'][_0x6d16('0x3d')]({'where':_0xa1a742[_0x6d16('0x1d')][_0x6d16('0x28')]||{},'attributes':['id','name',_0x6d16('0x29'),_0x6d16('0x4d'),_0x6d16('0x4e'),'internal',_0x6d16('0x4f'),_0x6d16('0x2a')]})[_0x6d16('0x10')](function(_0x2023c2){if(_0x2023c2){_0x131288=_0x2023c2;_0x2f74ac=_0xa1a742['body']['interface']?_0xa1a742[_0x6d16('0x37')][_0x6d16('0x2a')]:util[_0x6d16('0x30')](_0x6d16('0x36'),_0x131288[_0x6d16('0x2e')]);return db[_0x6d16('0x1b')][_0x6d16('0x50')]({'where':{'role':_0x6d16('0x51'),'online':!![],'id':{'$ne':_0x131288['id']}}});}})[_0x6d16('0x10')](function(_0x5d2026){if(_0x5d2026){_0x1c70ef=_0x5d2026;return require(_0x6d16('0x52'))[_0x6d16('0x53')]();}})[_0x6d16('0x10')](function(_0x51da36){if(_0x51da36&&_0x51da36['agents']&&_0x1c70ef>=_0x51da36[_0x6d16('0x54')]){throw new Error(_0x6d16('0x55'));}})[_0x6d16('0x10')](function(){if(_0x131288){return db[_0x6d16('0x2b')][_0x6d16('0x49')]({'where':{'membername':_0x131288[_0x6d16('0x2e')]},'individualHooks':!![]});}})[_0x6d16('0x10')](function(){if(_0x131288){return _0x131288[_0x6d16('0x56')]({'raw':!![]});}})['then'](function(_0x4e1d34){if(_0x131288){if(_0x4e1d34){var _0xbc3b73=[];_0x4440e2=_0x4e1d34;if(_0x4440e2['length']){for(var _0x33d539=0x0;_0x33d539<_0x4440e2[_0x6d16('0x4a')];_0x33d539++){_0xbc3b73[_0x6d16('0x34')](db[_0x6d16('0x2b')][_0x6d16('0x57')]({'membername':_0x131288[_0x6d16('0x2e')],'UserId':_0x131288['id'],'queue_name':_0x4440e2[_0x33d539]['name'],'VoiceQueueId':_0x4440e2[_0x33d539]['id'],'interface':_0x2f74ac,'paused':_0x131288[_0x6d16('0x4f')]||![],'penalty':_0x4440e2[_0x33d539]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x6d16('0x58')](_0xbc3b73);}}}})[_0x6d16('0x10')](function(){if(_0x131288){return db[_0x6d16('0x2d')][_0x6d16('0x1c')]({'where':{'membername':_0x131288[_0x6d16('0x2e')],'exitAt':null}});}})[_0x6d16('0x10')](function(_0x172d10){if(_0x131288){if(_0x172d10&&_0x172d10[_0x6d16('0x4a')]){var _0x9a70b8=[];_0x172d10[_0x6d16('0x4b')](function(_0x104f01){_0x9a70b8['push'](_0x104f01['update']({'exitAt':moment()[_0x6d16('0x30')](_0x6d16('0x31'))}));});return BPromise[_0x6d16('0x58')](_0x9a70b8);}}})[_0x6d16('0x10')](function(_0xa9454d){if(_0x131288){var _0xadaeeb=[];var _0x3ad8b1=[];var _0x24be0a=utils['getChannels']();var _0x11885a={'membername':_0x131288['name'],'interface':_0x2f74ac,'enterAt':moment()[_0x6d16('0x30')](_0x6d16('0x31')),'role':_0x131288[_0x6d16('0x29')],'internal':_0x131288[_0x6d16('0x59')]};_0x24be0a[_0x6d16('0x4b')](function(_0x993a10){_0xadaeeb[_0x6d16('0x34')](_[_0x6d16('0x5a')]({'channel':_0x993a10,'type':_0x6d16('0x5b'),'data1':_0x6d16('0x5c'),'data2':_0x2f74ac},_0x11885a));if(_0x131288[_0x6d16('0x4f')]){_0x3ad8b1[_0x6d16('0x34')](_[_0x6d16('0x5a')]({'channel':_0x993a10,'type':_0x6d16('0x2f'),'data1':'LOGININPAUSE'},_0x11885a));}});return db[_0x6d16('0x2d')][_0x6d16('0x3b')](_0xadaeeb[_0x6d16('0x5d')](_0x3ad8b1),{'individualHooks':!![]});}})['then'](function(){if(_0x131288){return _0x131288[_0x6d16('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x6d16('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x131288[_0x6d16('0x4f')]||![],'mailPause':_0x131288[_0x6d16('0x4f')]||![],'chatPause':_0x131288[_0x6d16('0x4f')]||![],'faxPause':_0x131288[_0x6d16('0x4f')]||![],'smsPause':_0x131288[_0x6d16('0x4f')]||![],'openchannelPause':_0x131288['loginInPause']||![],'pauseType':_0x131288[_0x6d16('0x4f')]?_0x6d16('0x5e'):null,'lastPauseAt':moment()[_0x6d16('0x30')](_0x6d16('0x31')),'interface':_0x2f74ac});}})[_0x6d16('0x10')](function(_0xaa03aa){_0x531e86(_0xaa03aa);})['catch'](function(_0x1a41d3){_0x52e992(_0x38c56d[_0x6d16('0x17')](0x1f4,_0x1a41d3[_0x6d16('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 3544d69..4c6bb29 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 _0x62f3=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0xf8132a,_0x448c35){var _0x904685=function(_0x579caf){while(--_0x579caf){_0xf8132a['push'](_0xf8132a['shift']());}};_0x904685(++_0x448c35);}(_0x62f3,0x17e));var _0x362f=function(_0x4ed3d6,_0x2f3393){_0x4ed3d6=_0x4ed3d6-0x0;var _0x202ade=_0x62f3[_0x4ed3d6];return _0x202ade;};'use strict';var UserEvents=require(_0x362f('0x0'));var events=[_0x362f('0x1'),_0x362f('0x2'),_0x362f('0x3')];function createListener(_0x365c96,_0x4a018d){return function(_0x372a59){_0x4a018d[_0x362f('0x4')](_0x365c96,_0x372a59);};}function removeListener(_0x3d85c1,_0x29d5e7){return function(){UserEvents[_0x362f('0x5')](_0x3d85c1,_0x29d5e7);};}exports[_0x362f('0x6')]=function(_0x3a68dd){for(var _0x12384b=0x0,_0x1891bf=events[_0x362f('0x7')];_0x12384b<_0x1891bf;_0x12384b++){var _0x452d10=events[_0x12384b];var _0x2aeefe=createListener(_0x362f('0x8')+_0x452d10,_0x3a68dd);UserEvents['on'](_0x452d10,_0x2aeefe);}}; \ No newline at end of file +var _0xa83c=['length','save','remove','update','emit'];(function(_0xad8ab0,_0x4fa748){var _0x139a47=function(_0x296739){while(--_0x296739){_0xad8ab0['push'](_0xad8ab0['shift']());}};_0x139a47(++_0x4fa748);}(_0xa83c,0xfb));var _0xca83=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xa83c[_0x242a4f];return _0x122117;};'use strict';var UserEvents=require('./user.events');var events=[_0xca83('0x0'),_0xca83('0x1'),_0xca83('0x2')];function createListener(_0x420c00,_0x3910f6){return function(_0x4399f1){_0x3910f6[_0xca83('0x3')](_0x420c00,_0x4399f1);};}function removeListener(_0x592157,_0x4a6f4f){return function(){UserEvents['removeListener'](_0x592157,_0x4a6f4f);};}exports['register']=function(_0x3488be){for(var _0x3f3e72=0x0,_0x3db554=events[_0xca83('0x4')];_0x3f3e72<_0x3db554;_0x3f3e72++){var _0x114654=events[_0x3f3e72];var _0x2d2878=createListener('user:'+_0x114654,_0x3488be);UserEvents['on'](_0x114654,_0x2d2878);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b0af565..ed6e386 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1f4674,_0x146085){var _0x3e7f42=function(_0x4bd366){while(--_0x4bd366){_0x1f4674['push'](_0x1f4674['shift']());}};_0x3e7f42(++_0x146085);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b4c5e27..d0c67b9 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 _0xd4e5=['exports'];(function(_0xf410b0,_0x2df61c){var _0x2d3782=function(_0x1a760a){while(--_0x1a760a){_0xf410b0['push'](_0xf410b0['shift']());}};_0x2d3782(++_0x2df61c);}(_0xd4e5,0x1ae));var _0x5d4e=function(_0x2a6ab4,_0x361cb5){_0x2a6ab4=_0x2a6ab4-0x0;var _0x41ebd9=_0xd4e5[_0x2a6ab4];return _0x41ebd9;};'use strict';var Sequelize=require('sequelize');module[_0x5d4e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb0bc=['sequelize','exports','INTEGER'];(function(_0x51656f,_0x5f28e4){var _0x27e1be=function(_0x2c5f88){while(--_0x2c5f88){_0x51656f['push'](_0x51656f['shift']());}};_0x27e1be(++_0x5f28e4);}(_0xb0bc,0x156));var _0xcb0b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb0bc[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xcb0b('0x0'));module[_0xcb0b('0x1')]={'penalty':{'type':Sequelize[_0xcb0b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 9f04a25..3a8cb3c 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 _0x6459=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x34217a,_0x1f545a){var _0x23c2be=function(_0x122660){while(--_0x122660){_0x34217a['push'](_0x34217a['shift']());}};_0x23c2be(++_0x1f545a);}(_0x6459,0x126));var _0x9645=function(_0x1c8fa2,_0x271329){_0x1c8fa2=_0x1c8fa2-0x0;var _0x440893=_0x6459[_0x1c8fa2];return _0x440893;};'use strict';var _=require(_0x9645('0x0'));var util=require('util');var logger=require(_0x9645('0x1'))('api');var moment=require(_0x9645('0x2'));var BPromise=require(_0x9645('0x3'));var rp=require(_0x9645('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9645('0x5'));var config=require(_0x9645('0x6'));var attributes=require(_0x9645('0x7'));module[_0x9645('0x8')]=function(_0x5b79a4,_0x3db465){return _0x5b79a4[_0x9645('0x9')](_0x9645('0xa'),attributes,{'tableName':_0x9645('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab2c=['rimraf','../../config/environment','./userChatQueue.attributes','define','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3af04a,_0x24e668){var _0x380d7c=function(_0x5bba8f){while(--_0x5bba8f){_0x3af04a['push'](_0x3af04a['shift']());}};_0x380d7c(++_0x24e668);}(_0xab2c,0x194));var _0xcab2=function(_0x2d2b63,_0x277d0a){_0x2d2b63=_0x2d2b63-0x0;var _0x5d18f8=_0xab2c[_0x2d2b63];return _0x5d18f8;};'use strict';var _=require(_0xcab2('0x0'));var util=require(_0xcab2('0x1'));var logger=require(_0xcab2('0x2'))(_0xcab2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcab2('0x4'));var fs=require('fs');var path=require(_0xcab2('0x5'));var rimraf=require(_0xcab2('0x6'));var config=require(_0xcab2('0x7'));var attributes=require(_0xcab2('0x8'));module['exports']=function(_0x496f40,_0x4bf0e0){return _0x496f40[_0xcab2('0x9')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index c0e7253..5f62fe3 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 _0x24e2=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x24e2,0x117));var _0x224e=function(_0x19ece2,_0x455909){_0x19ece2=_0x19ece2-0x0;var _0x21e59f=_0x24e2[_0x19ece2];return _0x21e59f;};'use strict';var _=require(_0x224e('0x0'));var util=require(_0x224e('0x1'));var moment=require('moment');var BPromise=require(_0x224e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x224e('0x3'))['db'];var utils=require(_0x224e('0x4'));var logger=require(_0x224e('0x5'))(_0x224e('0x6'));var config=require(_0x224e('0x7'));var jayson=require(_0x224e('0x8'));var client=jayson[_0x224e('0x9')][_0x224e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14c2c2,_0x4cb527,_0x3e538f){return new BPromise(function(_0x5f10e8,_0x5ef26f){return client[_0x224e('0xb')](_0x14c2c2,_0x3e538f)['then'](function(_0x5188a9){logger[_0x224e('0xc')](_0x224e('0xd'),_0x4cb527,_0x224e('0xe'));logger[_0x224e('0xf')](_0x224e('0x10'),_0x4cb527,_0x224e('0xe'),JSON[_0x224e('0x11')](_0x5188a9));if(_0x5188a9[_0x224e('0x12')]){if(_0x5188a9['error'][_0x224e('0x13')]===0x1f4){logger[_0x224e('0x12')](_0x224e('0xd'),_0x4cb527,_0x5188a9[_0x224e('0x12')][_0x224e('0x14')]);return _0x5ef26f(_0x5188a9['error'][_0x224e('0x14')]);}logger[_0x224e('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x4cb527,_0x5188a9[_0x224e('0x12')][_0x224e('0x14')]);return _0x5f10e8(_0x5188a9[_0x224e('0x12')][_0x224e('0x14')]);}else{logger[_0x224e('0xc')](_0x224e('0xd'),_0x4cb527,_0x224e('0xe'));_0x5f10e8(_0x5188a9[_0x224e('0x15')][_0x224e('0x14')]);}})[_0x224e('0x16')](function(_0x5cff16){logger[_0x224e('0x12')](_0x224e('0xd'),_0x4cb527,_0x5cff16);_0x5ef26f(_0x5cff16);});});} \ No newline at end of file +var _0xb8be=['UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb8be,0x11b));var _0xeb8b=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0xb8be[_0x2eac4f];return _0x58f73b;};'use strict';var _=require(_0xeb8b('0x0'));var util=require(_0xeb8b('0x1'));var moment=require(_0xeb8b('0x2'));var BPromise=require(_0xeb8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb8b('0x4'));var db=require(_0xeb8b('0x5'))['db'];var utils=require(_0xeb8b('0x6'));var logger=require(_0xeb8b('0x7'))(_0xeb8b('0x8'));var config=require(_0xeb8b('0x9'));var jayson=require(_0xeb8b('0xa'));var client=jayson[_0xeb8b('0xb')][_0xeb8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x583e05,_0xf4cf22,_0x3b9eae){return new BPromise(function(_0x322ffa,_0x1ae6f3){return client[_0xeb8b('0xd')](_0x583e05,_0x3b9eae)['then'](function(_0x561465){logger['info'](_0xeb8b('0xe'),_0xf4cf22,'request\x20sent');logger[_0xeb8b('0xf')](_0xeb8b('0x10'),_0xf4cf22,_0xeb8b('0x11'),JSON[_0xeb8b('0x12')](_0x561465));if(_0x561465[_0xeb8b('0x13')]){if(_0x561465['error'][_0xeb8b('0x14')]===0x1f4){logger['error'](_0xeb8b('0xe'),_0xf4cf22,_0x561465[_0xeb8b('0x13')][_0xeb8b('0x15')]);return _0x1ae6f3(_0x561465[_0xeb8b('0x13')]['message']);}logger[_0xeb8b('0x13')](_0xeb8b('0xe'),_0xf4cf22,_0x561465['error'][_0xeb8b('0x15')]);return _0x322ffa(_0x561465[_0xeb8b('0x13')][_0xeb8b('0x15')]);}else{logger[_0xeb8b('0x16')](_0xeb8b('0xe'),_0xf4cf22,_0xeb8b('0x11'));_0x322ffa(_0x561465['result']['message']);}})['catch'](function(_0x5bc5cf){logger['error'](_0xeb8b('0xe'),_0xf4cf22,_0x5bc5cf);_0x1ae6f3(_0x5bc5cf);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8b3391e..d90a5b9 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1fc716,_0x263857){var _0x637fd3=function(_0x1fbfeb){while(--_0x1fbfeb){_0x1fc716['push'](_0x1fc716['shift']());}};_0x637fd3(++_0x263857);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4cfe3b,_0x4979ba){var _0x45ba6d=function(_0x35b186){while(--_0x35b186){_0x4cfe3b['push'](_0x4cfe3b['shift']());}};_0x45ba6d(++_0x4979ba);}(_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 32555bc..08e6a70 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 _0xd10d=['sequelize','exports','INTEGER','STRING'];(function(_0x4b4168,_0x13dada){var _0x28e74e=function(_0x560c8c){while(--_0x560c8c){_0x4b4168['push'](_0x4b4168['shift']());}};_0x28e74e(++_0x13dada);}(_0xd10d,0x1b8));var _0xdd10=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0xd10d[_0x2605dc];return _0x4568c9;};'use strict';var Sequelize=require(_0xdd10('0x0'));module[_0xdd10('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdd10('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xdd10('0x3')]}}; \ No newline at end of file +var _0x55bf=['STRING','sequelize','exports'];(function(_0x314041,_0x862626){var _0x299dcb=function(_0x4f63b1){while(--_0x4f63b1){_0x314041['push'](_0x314041['shift']());}};_0x299dcb(++_0x862626);}(_0x55bf,0x172));var _0xf55b=function(_0xbb9ea7,_0x3190db){_0xbb9ea7=_0xbb9ea7-0x0;var _0x1850e3=_0x55bf[_0xbb9ea7];return _0x1850e3;};'use strict';var Sequelize=require(_0xf55b('0x0'));module[_0xf55b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf55b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f7d5bfd..f663ca0 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 _0x82b6=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x82b6,0x138));var _0x682b=function(_0x4fa892,_0x4e66a0){_0x4fa892=_0x4fa892-0x0;var _0x260ef6=_0x82b6[_0x4fa892];return _0x260ef6;};'use strict';var _=require(_0x682b('0x0'));var util=require(_0x682b('0x1'));var logger=require(_0x682b('0x2'))(_0x682b('0x3'));var moment=require('moment');var BPromise=require(_0x682b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x682b('0x5'));var rimraf=require('rimraf');var config=require(_0x682b('0x6'));var attributes=require(_0x682b('0x7'));module[_0x682b('0x8')]=function(_0x44a709,_0x2b77bd){return _0x44a709[_0x682b('0x9')](_0x682b('0xa'),attributes,{'tableName':_0x682b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea43=['moment','bluebird','rimraf','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xea43,0x1e0));var _0x3ea4=function(_0x1f257b,_0x573499){_0x1f257b=_0x1f257b-0x0;var _0x165681=_0xea43[_0x1f257b];return _0x165681;};'use strict';var _=require(_0x3ea4('0x0'));var util=require(_0x3ea4('0x1'));var logger=require(_0x3ea4('0x2'))(_0x3ea4('0x3'));var moment=require(_0x3ea4('0x4'));var BPromise=require(_0x3ea4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ea4('0x6'));var config=require(_0x3ea4('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x3ea4('0x8')]=function(_0x4a22d6,_0x1397ce){return _0x4a22d6['define'](_0x3ea4('0x9'),attributes,{'tableName':_0x3ea4('0xa'),'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 54876ba..2e6a7d4 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 _0xd8f0=['jayson/promise','client','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x4e6c52,_0x46aced){var _0x56800b=function(_0x5d5628){while(--_0x5d5628){_0x4e6c52['push'](_0x4e6c52['shift']());}};_0x56800b(++_0x46aced);}(_0xd8f0,0x174));var _0x0d8f=function(_0x531c55,_0x3f5d48){_0x531c55=_0x531c55-0x0;var _0x2968f9=_0xd8f0[_0x531c55];return _0x2968f9;};'use strict';var _=require(_0x0d8f('0x0'));var util=require(_0x0d8f('0x1'));var moment=require(_0x0d8f('0x2'));var BPromise=require(_0x0d8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d8f('0x5'));var logger=require('../../config/logger')(_0x0d8f('0x6'));var config=require(_0x0d8f('0x7'));var jayson=require(_0x0d8f('0x8'));var client=jayson[_0x0d8f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2749cb,_0x55decc,_0x39ecc2){return new BPromise(function(_0x3e8c51,_0x12841d){return client[_0x0d8f('0xa')](_0x2749cb,_0x39ecc2)[_0x0d8f('0xb')](function(_0x53f391){logger['info'](_0x0d8f('0xc'),_0x55decc,_0x0d8f('0xd'));logger[_0x0d8f('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x55decc,'request\x20sent',JSON['stringify'](_0x53f391));if(_0x53f391[_0x0d8f('0xf')]){if(_0x53f391[_0x0d8f('0xf')][_0x0d8f('0x10')]===0x1f4){logger[_0x0d8f('0xf')](_0x0d8f('0xc'),_0x55decc,_0x53f391[_0x0d8f('0xf')][_0x0d8f('0x11')]);return _0x12841d(_0x53f391['error'][_0x0d8f('0x11')]);}logger['error'](_0x0d8f('0xc'),_0x55decc,_0x53f391[_0x0d8f('0xf')][_0x0d8f('0x11')]);return _0x3e8c51(_0x53f391[_0x0d8f('0xf')][_0x0d8f('0x11')]);}else{logger['info'](_0x0d8f('0xc'),_0x55decc,_0x0d8f('0xd'));_0x3e8c51(_0x53f391['result'][_0x0d8f('0x11')]);}})[_0x0d8f('0x12')](function(_0x25d075){logger[_0x0d8f('0xf')](_0x0d8f('0xc'),_0x55decc,_0x25d075);_0x12841d(_0x25d075);});});} \ No newline at end of file +var _0x72bb=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x23ad5d,_0x3047c5){var _0x51eda1=function(_0x4d827b){while(--_0x4d827b){_0x23ad5d['push'](_0x23ad5d['shift']());}};_0x51eda1(++_0x3047c5);}(_0x72bb,0x123));var _0xb72b=function(_0x4f32de,_0x5bd4a){_0x4f32de=_0x4f32de-0x0;var _0x149821=_0x72bb[_0x4f32de];return _0x149821;};'use strict';var _=require(_0xb72b('0x0'));var util=require(_0xb72b('0x1'));var moment=require(_0xb72b('0x2'));var BPromise=require(_0xb72b('0x3'));var rs=require(_0xb72b('0x4'));var fs=require('fs');var Redis=require(_0xb72b('0x5'));var db=require(_0xb72b('0x6'))['db'];var utils=require(_0xb72b('0x7'));var logger=require(_0xb72b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb72b('0x9'));var client=jayson[_0xb72b('0xa')][_0xb72b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f9e8b,_0x3774ac,_0x4c5473){return new BPromise(function(_0x1a241f,_0x2d2f4d){return client[_0xb72b('0xc')](_0x4f9e8b,_0x4c5473)[_0xb72b('0xd')](function(_0x1258a2){logger[_0xb72b('0xe')](_0xb72b('0xf'),_0x3774ac,_0xb72b('0x10'));logger[_0xb72b('0x11')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3774ac,'request\x20sent',JSON[_0xb72b('0x12')](_0x1258a2));if(_0x1258a2[_0xb72b('0x13')]){if(_0x1258a2[_0xb72b('0x13')][_0xb72b('0x14')]===0x1f4){logger[_0xb72b('0x13')](_0xb72b('0xf'),_0x3774ac,_0x1258a2[_0xb72b('0x13')][_0xb72b('0x15')]);return _0x2d2f4d(_0x1258a2[_0xb72b('0x13')][_0xb72b('0x15')]);}logger[_0xb72b('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x3774ac,_0x1258a2[_0xb72b('0x13')]['message']);return _0x1a241f(_0x1258a2[_0xb72b('0x13')][_0xb72b('0x15')]);}else{logger[_0xb72b('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x3774ac,'request\x20sent');_0x1a241f(_0x1258a2[_0xb72b('0x16')][_0xb72b('0x15')]);}})[_0xb72b('0x17')](function(_0x3f62ef){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3774ac,_0x3f62ef);_0x2d2f4d(_0x3f62ef);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 69647b8..3118558 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4919e0,_0x1dec3d){var _0x5f0757=function(_0x28440f){while(--_0x28440f){_0x4919e0['push'](_0x4919e0['shift']());}};_0x5f0757(++_0x1dec3d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0xcb91[_0x506172];return _0x2723c0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2f8000,_0x37c02b){var _0x25cfee=function(_0x56aca2){while(--_0x56aca2){_0x2f8000['push'](_0x2f8000['shift']());}};_0x25cfee(++_0x37c02b);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c56d197..2d91fed 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 _0x5024=['INTEGER','sequelize','exports'];(function(_0x2a1c1c,_0x2c664e){var _0xbf4766=function(_0x1b951e){while(--_0x1b951e){_0x2a1c1c['push'](_0x2a1c1c['shift']());}};_0xbf4766(++_0x2c664e);}(_0x5024,0xf7));var _0x4502=function(_0x514efe,_0x56077b){_0x514efe=_0x514efe-0x0;var _0x5d7cde=_0x5024[_0x514efe];return _0x5d7cde;};'use strict';var Sequelize=require(_0x4502('0x0'));module[_0x4502('0x1')]={'penalty':{'type':Sequelize[_0x4502('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x07dd=['INTEGER','sequelize','exports'];(function(_0x36f9ca,_0x4e7e3e){var _0x6625b3=function(_0xc32760){while(--_0xc32760){_0x36f9ca['push'](_0x36f9ca['shift']());}};_0x6625b3(++_0x4e7e3e);}(_0x07dd,0x64));var _0xd07d=function(_0x19efb0,_0x3b193e){_0x19efb0=_0x19efb0-0x0;var _0x4cbda2=_0x07dd[_0x19efb0];return _0x4cbda2;};'use strict';var Sequelize=require(_0xd07d('0x0'));module[_0xd07d('0x1')]={'penalty':{'type':Sequelize[_0xd07d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c741076..43954dd 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 _0x2127=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x2127,0x78));var _0x7212=function(_0x400e7b,_0x3dd094){_0x400e7b=_0x400e7b-0x0;var _0x6497a2=_0x2127[_0x400e7b];return _0x6497a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7212('0x0'))(_0x7212('0x1'));var moment=require(_0x7212('0x2'));var BPromise=require(_0x7212('0x3'));var rp=require(_0x7212('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7212('0x5'));var attributes=require(_0x7212('0x6'));module[_0x7212('0x7')]=function(_0x570cf4,_0x21000b){return _0x570cf4[_0x7212('0x8')](_0x7212('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11bd=['define','UserMailQueue','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x3696ae,_0x4c462a){var _0x3d55c7=function(_0x82a194){while(--_0x82a194){_0x3696ae['push'](_0x3696ae['shift']());}};_0x3d55c7(++_0x4c462a);}(_0x11bd,0x1ee));var _0xd11b=function(_0x49e534,_0x31f5ba){_0x49e534=_0x49e534-0x0;var _0x18d27d=_0x11bd[_0x49e534];return _0x18d27d;};'use strict';var _=require(_0xd11b('0x0'));var util=require(_0xd11b('0x1'));var logger=require('../../config/logger')(_0xd11b('0x2'));var moment=require(_0xd11b('0x3'));var BPromise=require(_0xd11b('0x4'));var rp=require(_0xd11b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd11b('0x6'));var config=require(_0xd11b('0x7'));var attributes=require(_0xd11b('0x8'));module[_0xd11b('0x9')]=function(_0x18cdde,_0x25de5f){return _0x18cdde[_0xd11b('0xa')](_0xd11b('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 89f8483..51da99d 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x3d289f,_0x1be4bf){var _0x5f4782=function(_0x43049b){while(--_0x43049b){_0x3d289f['push'](_0x3d289f['shift']());}};_0x5f4782(++_0x1be4bf);}(_0xe14b,0x93));var _0xbe14=function(_0x189043,_0x21d8bb){_0x189043=_0x189043-0x0;var _0x55fd63=_0xe14b[_0x189043];return _0x55fd63;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x008c,0x188));var _0xc008=function(_0x5537e6,_0xddf3dc){_0x5537e6=_0x5537e6-0x0;var _0x44115a=_0x008c[_0x5537e6];return _0x44115a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3ae634e..3382255 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 _0xa3a3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','sendUserNotification','exports','multer','util','path','express'];(function(_0x5f0201,_0x2b4d35){var _0x117564=function(_0x47fe26){while(--_0x47fe26){_0x5f0201['push'](_0x5f0201['shift']());}};_0x117564(++_0x2b4d35);}(_0xa3a3,0x8b));var _0x3a3a=function(_0x44de8c,_0x529952){_0x44de8c=_0x44de8c-0x0;var _0x2bdfe4=_0xa3a3[_0x44de8c];return _0x2bdfe4;};'use strict';var multer=require(_0x3a3a('0x0'));var util=require(_0x3a3a('0x1'));var path=require(_0x3a3a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a3a('0x3'));var router=express[_0x3a3a('0x4')]();var fs_extra=require(_0x3a3a('0x5'));var auth=require(_0x3a3a('0x6'));var interaction=require(_0x3a3a('0x7'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router['post']('/',auth[_0x3a3a('0x8')](),controller[_0x3a3a('0x9')]);module[_0x3a3a('0xa')]=router; \ No newline at end of file +var _0x7c31=['express','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c31,0x1e1));var _0x17c3=function(_0xc14465,_0x49db88){_0xc14465=_0xc14465-0x0;var _0xa8c856=_0x7c31[_0xc14465];return _0xa8c856;};'use strict';var multer=require(_0x17c3('0x0'));var util=require(_0x17c3('0x1'));var path=require(_0x17c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x17c3('0x3'));var router=express['Router']();var fs_extra=require(_0x17c3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x17c3('0x5'));var config=require(_0x17c3('0x6'));var controller=require(_0x17c3('0x7'));router[_0x17c3('0x8')]('/',auth['isAuthenticated'](),controller[_0x17c3('0x9')]);module[_0x17c3('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e37a7b9..9451da5 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 _0x32ff=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4cfdba,_0x71bfbb){var _0x1c5f48=function(_0x512376){while(--_0x512376){_0x4cfdba['push'](_0x4cfdba['shift']());}};_0x1c5f48(++_0x71bfbb);}(_0x32ff,0xe8));var _0xf32f=function(_0x382cbb,_0x4c8fd2){_0x382cbb=_0x382cbb-0x0;var _0x1fd630=_0x32ff[_0x382cbb];return _0x1fd630;};'use strict';var Sequelize=require('sequelize');module[_0xf32f('0x0')]={'body':{'type':Sequelize[_0xf32f('0x1')]},'senderName':{'type':Sequelize[_0xf32f('0x2')]},'recipientsId':{'type':Sequelize[_0xf32f('0x1')]},'recipientsDescription':{'type':Sequelize[_0xf32f('0x2')]},'beep':{'type':Sequelize[_0xf32f('0x3')]}}; \ No newline at end of file +var _0x75d7=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x8bf1aa,_0x2a43d7){var _0x3adda8=function(_0x34e0b4){while(--_0x34e0b4){_0x8bf1aa['push'](_0x8bf1aa['shift']());}};_0x3adda8(++_0x2a43d7);}(_0x75d7,0xb5));var _0x775d=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x75d7[_0x81e39d];return _0x548fbb;};'use strict';var Sequelize=require(_0x775d('0x0'));module[_0x775d('0x1')]={'body':{'type':Sequelize[_0x775d('0x2')]},'senderName':{'type':Sequelize[_0x775d('0x3')]},'recipientsId':{'type':Sequelize[_0x775d('0x2')]},'recipientsDescription':{'type':Sequelize[_0x775d('0x3')]},'beep':{'type':Sequelize[_0x775d('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8d723cd..cf0c3ef 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 _0x1583=['recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','model','User','union','ids','queue','replace','all','findOne','getAgents','map','rimraf','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter'];(function(_0x21184d,_0x3d17b4){var _0x3593ad=function(_0x2b8d53){while(--_0x2b8d53){_0x21184d['push'](_0x21184d['shift']());}};_0x3593ad(++_0x3d17b4);}(_0x1583,0x8d));var _0x3158=function(_0x594163,_0xb231bc){_0x594163=_0x594163-0x0;var _0x4bdc19=_0x1583[_0x594163];return _0x4bdc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3158('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3158('0x1'));var BPromise=require(_0x3158('0x2'));var Mustache=require(_0x3158('0x3'));var util=require(_0x3158('0x4'));var path=require(_0x3158('0x5'));var sox=require(_0x3158('0x6'));var csv=require('to-csv');var ejs=require(_0x3158('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3158('0x8'));var jsforce=require(_0x3158('0x9'));var deskjs=require(_0x3158('0xa'));var toCsv=require(_0x3158('0xb'));var querystring=require(_0x3158('0xc'));var Papa=require(_0x3158('0xd'));var Redis=require(_0x3158('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3158('0xf'));var as=require(_0x3158('0x10'));var hardwareService=require(_0x3158('0x11'));var logger=require(_0x3158('0x12'))(_0x3158('0x13'));var utils=require(_0x3158('0x14'));var config=require(_0x3158('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3158('0x16'))['db'];config[_0x3158('0x17')]=_['defaults'](config[_0x3158('0x17')],{'host':_0x3158('0x18'),'port':0x18eb});var socket=require(_0x3158('0x19'))(new Redis(config[_0x3158('0x17')]));require(_0x3158('0x1a'))[_0x3158('0x1b')](socket);function respondWithStatusCode(_0x4c272e,_0x3a9817){_0x3a9817=_0x3a9817||0xcc;return function(_0x4bbcff){if(_0x4bbcff){return _0x4c272e['sendStatus'](_0x3a9817);}return _0x4c272e[_0x3158('0x1c')](_0x3a9817)['end']();};}function respondWithResult(_0x47dfdf,_0x47a0f3){_0x47a0f3=_0x47a0f3||0xc8;return function(_0x268023){if(_0x268023){return _0x47dfdf[_0x3158('0x1c')](_0x47a0f3)[_0x3158('0x1d')](_0x268023);}};}function respondWithFilteredResult(_0x3ae399,_0xa883e6){return function(_0x56ae28){if(_0x56ae28){var _0x55cfb3=typeof _0xa883e6[_0x3158('0x1e')]===_0x3158('0x1f')&&typeof _0xa883e6[_0x3158('0x20')]===_0x3158('0x1f');var _0x28f72c=_0x56ae28[_0x3158('0x21')];var _0x4d3224=_0x55cfb3?0x0:_0xa883e6['offset'];var _0x231015=_0x55cfb3?_0x56ae28['count']:_0xa883e6[_0x3158('0x1e')]+_0xa883e6['limit'];var _0x3481cf;if(_0x231015>=_0x28f72c){_0x231015=_0x28f72c;_0x3481cf=0xc8;}else{_0x3481cf=0xce;}_0x3ae399[_0x3158('0x1c')](_0x3481cf);return _0x3ae399[_0x3158('0x22')](_0x3158('0x23'),_0x4d3224+'-'+_0x231015+'/'+_0x28f72c)[_0x3158('0x1d')](_0x56ae28);}return null;};}function patchUpdates(_0x119458){return function(_0x363abd){try{jsonpatch[_0x3158('0x24')](_0x363abd,_0x119458,!![]);}catch(_0x36095b){return BPromise['reject'](_0x36095b);}return _0x363abd[_0x3158('0x25')]();};}function saveUpdates(_0x53bd0b,_0x4cb1ff){return function(_0x446a5a){if(_0x446a5a){return _0x446a5a[_0x3158('0x26')](_0x53bd0b)[_0x3158('0x27')](function(_0x361c22){return _0x361c22;});}return null;};}function removeEntity(_0xbc2689,_0x47557c){return function(_0x18c97d){if(_0x18c97d){return _0x18c97d[_0x3158('0x28')]()[_0x3158('0x27')](function(){_0xbc2689[_0x3158('0x1c')](0xcc)[_0x3158('0x29')]();});}};}function handleEntityNotFound(_0xda5888,_0x42cfc4){return function(_0x46b182){if(!_0x46b182){_0xda5888[_0x3158('0x2a')](0x194);}return _0x46b182;};}function handleError(_0x14dcb1,_0x1f9410){_0x1f9410=_0x1f9410||0x1f4;return function(_0x2b23b8){logger[_0x3158('0x2b')](_0x2b23b8[_0x3158('0x2c')]);if(_0x2b23b8[_0x3158('0x2d')]){delete _0x2b23b8[_0x3158('0x2d')];}_0x14dcb1[_0x3158('0x1c')](_0x1f9410)[_0x3158('0x2e')](_0x2b23b8);};}exports[_0x3158('0x2f')]=function(_0x3bb9ee,_0x185c68,_0x18f370){if(!_0x3bb9ee[_0x3158('0x30')][_0x3158('0x31')](_0x3158('0x32'))&&!_0x3bb9ee[_0x3158('0x30')][_0x3158('0x31')](_0x3158('0x33'))){throw new db[(_0x3158('0x34'))][(_0x3158('0x35'))](_0x3158('0x36'));}else{if(_0x3bb9ee[_0x3158('0x30')][_0x3158('0x31')](_0x3158('0x33'))&&!_0x3bb9ee['body'][_0x3158('0x31')](_0x3158('0x37'))){throw new db['Sequelize'][(_0x3158('0x35'))](_0x3158('0x38'));}if(!_0x3bb9ee[_0x3158('0x30')][_0x3158('0x31')](_0x3158('0x39'))){throw new db['Sequelize'][(_0x3158('0x35'))](_0x3158('0x3a'));}else{try{var _0x5e528f=JSON[_0x3158('0x3b')](_0x3bb9ee[_0x3158('0x30')]['recipients']);}catch(_0x4c307){logger[_0x3158('0x2b')](_0x4c307);throw new db[(_0x3158('0x34'))][(_0x3158('0x35'))](_0x3158('0x3c'));}var _0xa36f0=['chatqueue',_0x3158('0x3d'),_0x3158('0x3e'),_0x3158('0x3f'),'smsqueue',_0x3158('0x40'),_0x3158('0x41'),_0x3158('0x42'),'user'];if(_[_0x3158('0x43')](_0x5e528f,function(_0x44a122){return!_[_0x3158('0x44')](_0xa36f0,_0x44a122['model']['toLowerCase']());})){throw new db[(_0x3158('0x34'))][(_0x3158('0x35'))](_0x3158('0x45'));}}}var _0x3a54b3={};_0x3a54b3[_0x3158('0x46')]=_0x3bb9ee['body'][_0x3158('0x31')](_0x3158('0x46'))?_0x3bb9ee[_0x3158('0x30')][_0x3158('0x46')]:_0x3bb9ee['user'][_0x3158('0x47')];_0x3a54b3['recipientsDescription']=_[_0x3158('0x48')](_0x3bb9ee[_0x3158('0x30')][_0x3158('0x49')])?null:_0x3bb9ee[_0x3158('0x30')][_0x3158('0x49')];_0x3a54b3[_0x3158('0x4a')]=_0x3bb9ee[_0x3158('0x30')][_0x3158('0x4a')]||![];_0x3a54b3[_0x3158('0x4b')]=_0x3bb9ee['user']['id'];return getContent(_0x3bb9ee[_0x3158('0x30')])['then'](function(_0x12b9e8){_0x3a54b3[_0x3158('0x30')]=_0x12b9e8;return getRecipients(_0x5e528f);})['then'](function(_0x335226){_0x3a54b3[_0x3158('0x4c')]=_[_0x3158('0x4d')](_0x335226)['join'](',');return db['sequelize'][_0x3158('0x4e')](function(_0x47d16c){return db[_0x3158('0x4f')][_0x3158('0x50')](_0x3a54b3,{'raw':!![],'transaction':_0x47d16c})[_0x3158('0x27')](function(_0x35c8dc){var _0x56f504={'sender':_0x3a54b3[_0x3158('0x46')],'description':_0x3a54b3['recipientsDescription'],'content':_0x3a54b3[_0x3158('0x30')],'beep':_0x3a54b3[_0x3158('0x4a')]};_0x335226[_0x3158('0x51')](function(_0x39a517){_0x56f504['recipient']=_0x39a517;socket[_0x3158('0x52')](_0x3158('0x53'),_0x56f504);});return _0x35c8dc;});});})[_0x3158('0x27')](respondWithResult(_0x185c68,0xc9))[_0x3158('0x54')](handleError(_0x185c68,null));};function getContent(_0x55201f){return new BPromise(function(_0x224276,_0x2b46d9){if(_0x55201f['text']){_0x224276(_0x55201f[_0x3158('0x32')]);return;}return db[_0x3158('0x55')]['findOne']({'attributes':['html'],'where':{'id':_0x55201f[_0x3158('0x33')]},'raw':!![]})['then'](function(_0x9f066d){if(!_0x9f066d)throw new db['Sequelize'][(_0x3158('0x35'))](_0x3158('0x56'));var _0x1b78fb=Mustache['render'](_0x9f066d[_0x3158('0x57')],_0x55201f['view']);_0x224276(_0x1b78fb);})[_0x3158('0x54')](function(_0x20e98f){_0x2b46d9(_0x20e98f);});});}function getRecipients(_0x407bd8){return new BPromise(function(_0x3892a5,_0x2419ec){var _0x37b4d2=[];var _0x458ddf=[];_0x407bd8[_0x3158('0x51')](function(_0x3fad94){var _0x1d69fe=_[_0x3158('0x58')](_0x3fad94[_0x3158('0x59')]['toLowerCase']());if(_0x1d69fe===_0x3158('0x5a')){_0x37b4d2=_[_0x3158('0x5b')](_0x37b4d2,_0x3fad94[_0x3158('0x5c')]);}else{if(_[_0x3158('0x44')](_0x1d69fe,_0x3158('0x5d')))_0x1d69fe=_0x1d69fe[_0x3158('0x5e')](_0x3158('0x5d'),'Queue');_0x3fad94[_0x3158('0x5c')]['forEach'](function(_0x39f5f0){_0x458ddf['push'](getAgents(_0x1d69fe,_0x39f5f0));});}});return BPromise[_0x3158('0x5f')](_0x458ddf)[_0x3158('0x27')](function(_0x1db0a1){_0x37b4d2=_['union'](_0x37b4d2,_['flatten'](_0x1db0a1));_0x3892a5(_0x37b4d2);})['catch'](function(_0x3a7ed2){_0x2419ec(_0x3a7ed2);});});}function getAgents(_0x16680c,_0x51adf9){return new BPromise(function(_0x160abd,_0x244c70){return db[_0x16680c][_0x3158('0x60')]({'where':{'id':_0x51adf9}})[_0x3158('0x27')](function(_0x3856a3){return _0x3856a3[_0x3158('0x61')]({'attributes':['id'],'raw':!![]})[_0x3158('0x27')](function(_0x536198){var _0x35449f=_[_0x3158('0x62')](_0x536198,'id');_0x160abd(_0x35449f);});})[_0x3158('0x54')](function(_0x2ce519){_0x244c70(_0x2ce519);});});} \ No newline at end of file +var _0x4f31=['recipientsDescription','isEmpty','beep','SenderId','join','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','ids','queue','push','all','union','flatten','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','name','status','send','body','text','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','TemplateId','view','Missing\x20\x27view\x27\x20parameter','ValidationError','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x4f31,0x196));var _0x14f3=function(_0x194de6,_0x54c301){_0x194de6=_0x194de6-0x0;var _0x2a3520=_0x4f31[_0x194de6];return _0x2a3520;};'use strict';var emlformat=require(_0x14f3('0x0'));var rimraf=require(_0x14f3('0x1'));var zipdir=require(_0x14f3('0x2'));var jsonpatch=require(_0x14f3('0x3'));var rp=require(_0x14f3('0x4'));var moment=require(_0x14f3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x14f3('0x6'));var sox=require(_0x14f3('0x7'));var csv=require(_0x14f3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14f3('0x9'));var _=require(_0x14f3('0xa'));var squel=require(_0x14f3('0xb'));var crypto=require(_0x14f3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x14f3('0xd'));var toCsv=require(_0x14f3('0x8'));var querystring=require(_0x14f3('0xe'));var Papa=require('papaparse');var Redis=require(_0x14f3('0xf'));var authService=require(_0x14f3('0x10'));var qs=require(_0x14f3('0x11'));var as=require(_0x14f3('0x12'));var hardwareService=require(_0x14f3('0x13'));var logger=require(_0x14f3('0x14'))(_0x14f3('0x15'));var utils=require(_0x14f3('0x16'));var config=require(_0x14f3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x14f3('0x18')]=_[_0x14f3('0x19')](config[_0x14f3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x14f3('0x1a'))(new Redis(config[_0x14f3('0x18')]));require(_0x14f3('0x1b'))[_0x14f3('0x1c')](socket);function respondWithStatusCode(_0x455b85,_0x58cb4b){_0x58cb4b=_0x58cb4b||0xcc;return function(_0x34f3e5){if(_0x34f3e5){return _0x455b85[_0x14f3('0x1d')](_0x58cb4b);}return _0x455b85['status'](_0x58cb4b)[_0x14f3('0x1e')]();};}function respondWithResult(_0x177854,_0x24be63){_0x24be63=_0x24be63||0xc8;return function(_0x482526){if(_0x482526){return _0x177854['status'](_0x24be63)[_0x14f3('0x1f')](_0x482526);}};}function respondWithFilteredResult(_0x52e86e,_0x18abc0){return function(_0x8dab2d){if(_0x8dab2d){var _0x50116c=typeof _0x18abc0[_0x14f3('0x20')]===_0x14f3('0x21')&&typeof _0x18abc0[_0x14f3('0x22')]===_0x14f3('0x21');var _0x377237=_0x8dab2d[_0x14f3('0x23')];var _0x43c90b=_0x50116c?0x0:_0x18abc0[_0x14f3('0x20')];var _0x347b49=_0x50116c?_0x8dab2d[_0x14f3('0x23')]:_0x18abc0[_0x14f3('0x20')]+_0x18abc0[_0x14f3('0x22')];var _0x2c2ea0;if(_0x347b49>=_0x377237){_0x347b49=_0x377237;_0x2c2ea0=0xc8;}else{_0x2c2ea0=0xce;}_0x52e86e['status'](_0x2c2ea0);return _0x52e86e['set'](_0x14f3('0x24'),_0x43c90b+'-'+_0x347b49+'/'+_0x377237)['json'](_0x8dab2d);}return null;};}function patchUpdates(_0x49a524){return function(_0x14252a){try{jsonpatch[_0x14f3('0x25')](_0x14252a,_0x49a524,!![]);}catch(_0x2b854d){return BPromise['reject'](_0x2b854d);}return _0x14252a['save']();};}function saveUpdates(_0x2d181d,_0x217768){return function(_0x203dc6){if(_0x203dc6){return _0x203dc6[_0x14f3('0x26')](_0x2d181d)[_0x14f3('0x27')](function(_0x1437d0){return _0x1437d0;});}return null;};}function removeEntity(_0xf56f17,_0x336ce7){return function(_0x2e0e5d){if(_0x2e0e5d){return _0x2e0e5d[_0x14f3('0x28')]()['then'](function(){_0xf56f17['status'](0xcc)[_0x14f3('0x1e')]();});}};}function handleEntityNotFound(_0x59d094,_0x2d673e){return function(_0x35dcf9){if(!_0x35dcf9){_0x59d094[_0x14f3('0x1d')](0x194);}return _0x35dcf9;};}function handleError(_0x25c9e0,_0x25c11c){_0x25c11c=_0x25c11c||0x1f4;return function(_0x4d187e){logger[_0x14f3('0x29')](_0x4d187e['stack']);if(_0x4d187e[_0x14f3('0x2a')]){delete _0x4d187e['name'];}_0x25c9e0[_0x14f3('0x2b')](_0x25c11c)[_0x14f3('0x2c')](_0x4d187e);};}exports['sendUserNotification']=function(_0x5be77b,_0x33506e,_0x3ab35b){if(!_0x5be77b[_0x14f3('0x2d')]['hasOwnProperty'](_0x14f3('0x2e'))&&!_0x5be77b[_0x14f3('0x2d')]['hasOwnProperty']('TemplateId')){throw new db[(_0x14f3('0x2f'))]['ValidationError'](_0x14f3('0x30'));}else{if(_0x5be77b['body'][_0x14f3('0x31')](_0x14f3('0x32'))&&!_0x5be77b['body'][_0x14f3('0x31')](_0x14f3('0x33'))){throw new db[(_0x14f3('0x2f'))]['ValidationError'](_0x14f3('0x34'));}if(!_0x5be77b['body']['hasOwnProperty']('recipients')){throw new db[(_0x14f3('0x2f'))][(_0x14f3('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x56d8ac=JSON[_0x14f3('0x36')](_0x5be77b['body'][_0x14f3('0x37')]);}catch(_0x596179){logger[_0x14f3('0x29')](_0x596179);throw new db[(_0x14f3('0x2f'))][(_0x14f3('0x35'))](_0x14f3('0x38'));}var _0x452dba=[_0x14f3('0x39'),_0x14f3('0x3a'),_0x14f3('0x3b'),'openchannelqueue',_0x14f3('0x3c'),'voicequeue',_0x14f3('0x3d'),'team',_0x14f3('0x3e')];if(_[_0x14f3('0x3f')](_0x56d8ac,function(_0x5eaf5c){return!_[_0x14f3('0x40')](_0x452dba,_0x5eaf5c[_0x14f3('0x41')][_0x14f3('0x42')]());})){throw new db[(_0x14f3('0x2f'))][(_0x14f3('0x35'))](_0x14f3('0x43'));}}}var _0x511e95={};_0x511e95['senderName']=_0x5be77b[_0x14f3('0x2d')][_0x14f3('0x31')](_0x14f3('0x44'))?_0x5be77b[_0x14f3('0x2d')]['senderName']:_0x5be77b[_0x14f3('0x3e')]['fullname'];_0x511e95[_0x14f3('0x45')]=_[_0x14f3('0x46')](_0x5be77b[_0x14f3('0x2d')][_0x14f3('0x45')])?null:_0x5be77b[_0x14f3('0x2d')][_0x14f3('0x45')];_0x511e95[_0x14f3('0x47')]=_0x5be77b[_0x14f3('0x2d')][_0x14f3('0x47')]||![];_0x511e95[_0x14f3('0x48')]=_0x5be77b[_0x14f3('0x3e')]['id'];return getContent(_0x5be77b[_0x14f3('0x2d')])[_0x14f3('0x27')](function(_0x3ba04d){_0x511e95['body']=_0x3ba04d;return getRecipients(_0x56d8ac);})['then'](function(_0x1293ba){_0x511e95['recipientsId']=_['sortBy'](_0x1293ba)[_0x14f3('0x49')](',');return db[_0x14f3('0x4a')][_0x14f3('0x4b')](function(_0x3c8476){return db[_0x14f3('0x4c')][_0x14f3('0x4d')](_0x511e95,{'raw':!![],'transaction':_0x3c8476})[_0x14f3('0x27')](function(_0xd222d3){var _0x47ce30={'sender':_0x511e95[_0x14f3('0x44')],'description':_0x511e95[_0x14f3('0x45')],'content':_0x511e95['body'],'beep':_0x511e95[_0x14f3('0x47')]};_0x1293ba[_0x14f3('0x4e')](function(_0x5793a3){_0x47ce30['recipient']=_0x5793a3;socket[_0x14f3('0x4f')](_0x14f3('0x50'),_0x47ce30);});return _0xd222d3;});});})[_0x14f3('0x27')](respondWithResult(_0x33506e,0xc9))[_0x14f3('0x51')](handleError(_0x33506e,null));};function getContent(_0x70ab48){return new BPromise(function(_0x3a90f0,_0xd476ec){if(_0x70ab48['text']){_0x3a90f0(_0x70ab48[_0x14f3('0x2e')]);return;}return db['Template']['findOne']({'attributes':['html'],'where':{'id':_0x70ab48['TemplateId']},'raw':!![]})[_0x14f3('0x27')](function(_0x2ec49c){if(!_0x2ec49c)throw new db['Sequelize'][(_0x14f3('0x35'))](_0x14f3('0x52'));var _0xaeb2fe=Mustache[_0x14f3('0x53')](_0x2ec49c[_0x14f3('0x54')],_0x70ab48[_0x14f3('0x33')]);_0x3a90f0(_0xaeb2fe);})['catch'](function(_0x36759c){_0xd476ec(_0x36759c);});});}function getRecipients(_0x3f9a55){return new BPromise(function(_0x4297ac,_0xde71d0){var _0x50fb72=[];var _0x19f9b0=[];_0x3f9a55[_0x14f3('0x4e')](function(_0x5c7701){var _0x316e7e=_[_0x14f3('0x55')](_0x5c7701[_0x14f3('0x41')][_0x14f3('0x42')]());if(_0x316e7e===_0x14f3('0x56')){_0x50fb72=_['union'](_0x50fb72,_0x5c7701[_0x14f3('0x57')]);}else{if(_[_0x14f3('0x40')](_0x316e7e,_0x14f3('0x58')))_0x316e7e=_0x316e7e['replace']('queue','Queue');_0x5c7701['ids'][_0x14f3('0x4e')](function(_0x3dc02f){_0x19f9b0[_0x14f3('0x59')](getAgents(_0x316e7e,_0x3dc02f));});}});return BPromise[_0x14f3('0x5a')](_0x19f9b0)[_0x14f3('0x27')](function(_0x2e2438){_0x50fb72=_[_0x14f3('0x5b')](_0x50fb72,_[_0x14f3('0x5c')](_0x2e2438));_0x4297ac(_0x50fb72);})['catch'](function(_0x5b1297){_0xde71d0(_0x5b1297);});});}function getAgents(_0x1f3c80,_0x1b10b7){return new BPromise(function(_0x59c42a,_0x3a6fa3){return db[_0x1f3c80][_0x14f3('0x5d')]({'where':{'id':_0x1b10b7}})[_0x14f3('0x27')](function(_0x2e4cff){return _0x2e4cff['getAgents']({'attributes':['id'],'raw':!![]})[_0x14f3('0x27')](function(_0x5c6874){var _0x4d156c=_[_0x14f3('0x5e')](_0x5c6874,'id');_0x59c42a(_0x4d156c);});})[_0x14f3('0x51')](function(_0x45684c){_0x3a6fa3(_0x45684c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 51b9759..6c3757a 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 _0x4a3e=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x27fd21,_0x424f65){var _0x558820=function(_0x3470ea){while(--_0x3470ea){_0x27fd21['push'](_0x27fd21['shift']());}};_0x558820(++_0x424f65);}(_0x4a3e,0xc8));var _0xe4a3=function(_0x21317,_0x4502d7){_0x21317=_0x21317-0x0;var _0x3de38a=_0x4a3e[_0x21317];return _0x3de38a;};'use strict';var EventEmitter=require(_0xe4a3('0x0'));var UserNotification=require(_0xe4a3('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xe4a3('0x2')](0x0);var events={'afterCreate':_0xe4a3('0x3'),'afterUpdate':'update','afterDestroy':_0xe4a3('0x4')};function emitEvent(_0x80f9d4){return function(_0xf631ee,_0x5e94ae,_0x6e17a7){UserNotificationEvents['emit'](_0x80f9d4+':'+_0xf631ee['id'],_0xf631ee);UserNotificationEvents[_0xe4a3('0x5')](_0x80f9d4,_0xf631ee);_0x6e17a7(null);};}for(var e in events){if(events[_0xe4a3('0x6')](e)){var event=events[e];UserNotification[_0xe4a3('0x7')](e,emitEvent(event));}}module[_0xe4a3('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xe29f=['remove','emit','hasOwnProperty','hook','exports','UserNotification','setMaxListeners','save','update'];(function(_0x3b64ef,_0x1671b5){var _0x1966c9=function(_0x46d6ac){while(--_0x46d6ac){_0x3b64ef['push'](_0x3b64ef['shift']());}};_0x1966c9(++_0x1671b5);}(_0xe29f,0x17f));var _0xfe29=function(_0x4b358d,_0x4dea28){_0x4b358d=_0x4b358d-0x0;var _0x38f4ec=_0xe29f[_0x4b358d];return _0x38f4ec;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0xfe29('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfe29('0x1')](0x0);var events={'afterCreate':_0xfe29('0x2'),'afterUpdate':_0xfe29('0x3'),'afterDestroy':_0xfe29('0x4')};function emitEvent(_0xddf314){return function(_0x198872,_0x1ba1c4,_0xf0376f){UserNotificationEvents['emit'](_0xddf314+':'+_0x198872['id'],_0x198872);UserNotificationEvents[_0xfe29('0x5')](_0xddf314,_0x198872);_0xf0376f(null);};}for(var e in events){if(events[_0xfe29('0x6')](e)){var event=events[e];UserNotification[_0xfe29('0x7')](e,emitEvent(event));}}module[_0xfe29('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index ddcff13..956ede6 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 _0x5909=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x5909,0xbb));var _0x9590=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x5909[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0x9590('0x0'));var util=require('util');var logger=require(_0x9590('0x1'))(_0x9590('0x2'));var moment=require(_0x9590('0x3'));var BPromise=require(_0x9590('0x4'));var rp=require(_0x9590('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9590('0x6'));var config=require(_0x9590('0x7'));var attributes=require(_0x9590('0x8'));module[_0x9590('0x9')]=function(_0x1721cc,_0x9b0f23){return _0x1721cc[_0x9590('0xa')](_0x9590('0xb'),attributes,{'tableName':_0x9590('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9590('0xd'),'collate':_0x9590('0xe')});}; \ No newline at end of file +var _0xbbb6=['rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','request-promise','path'];(function(_0x5b1c6e,_0x214919){var _0x382581=function(_0x109a3d){while(--_0x109a3d){_0x5b1c6e['push'](_0x5b1c6e['shift']());}};_0x382581(++_0x214919);}(_0xbbb6,0x127));var _0x6bbb=function(_0x1f6e9a,_0x2e49a8){_0x1f6e9a=_0x1f6e9a-0x0;var _0x117cbc=_0xbbb6[_0x1f6e9a];return _0x117cbc;};'use strict';var _=require(_0x6bbb('0x0'));var util=require(_0x6bbb('0x1'));var logger=require(_0x6bbb('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6bbb('0x3'));var fs=require('fs');var path=require(_0x6bbb('0x4'));var rimraf=require(_0x6bbb('0x5'));var config=require('../../config/environment');var attributes=require(_0x6bbb('0x6'));module[_0x6bbb('0x7')]=function(_0x5cdede,_0x55f6fa){return _0x5cdede[_0x6bbb('0x8')](_0x6bbb('0x9'),attributes,{'tableName':_0x6bbb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6bbb('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 476f6d0..e4ef3dd 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 _0x1548=['redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x24b2b9,_0x396448){var _0x227db6=function(_0x1690d1){while(--_0x1690d1){_0x24b2b9['push'](_0x24b2b9['shift']());}};_0x227db6(++_0x396448);}(_0x1548,0x1c1));var _0x8154=function(_0x2a06f7,_0x37b49c){_0x2a06f7=_0x2a06f7-0x0;var _0x5764cf=_0x1548[_0x2a06f7];return _0x5764cf;};'use strict';var _=require(_0x8154('0x0'));var util=require('util');var moment=require(_0x8154('0x1'));var BPromise=require(_0x8154('0x2'));var rs=require(_0x8154('0x3'));var fs=require('fs');var Redis=require(_0x8154('0x4'));var db=require(_0x8154('0x5'))['db'];var utils=require(_0x8154('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8154('0x7'));var jayson=require(_0x8154('0x8'));var client=jayson[_0x8154('0x9')]['http']({'port':0x232a});config[_0x8154('0xa')]=_['defaults'](config[_0x8154('0xa')],{'host':_0x8154('0xb'),'port':0x18eb});var socket=require(_0x8154('0xc'))(new Redis(config[_0x8154('0xa')]));require(_0x8154('0xd'))[_0x8154('0xe')](socket);function respondWithRpcPromise(_0x2e00a3,_0x3a2dfd,_0x10694e){return new BPromise(function(_0x1b59c6,_0x53b6aa){return client['request'](_0x2e00a3,_0x10694e)[_0x8154('0xf')](function(_0x1de004){logger[_0x8154('0x10')](_0x8154('0x11'),_0x3a2dfd,_0x8154('0x12'));logger[_0x8154('0x13')](_0x8154('0x14'),_0x3a2dfd,'request\x20sent',JSON[_0x8154('0x15')](_0x1de004));if(_0x1de004['error']){if(_0x1de004[_0x8154('0x16')][_0x8154('0x17')]===0x1f4){logger['error'](_0x8154('0x11'),_0x3a2dfd,_0x1de004[_0x8154('0x16')]['message']);return _0x53b6aa(_0x1de004[_0x8154('0x16')][_0x8154('0x18')]);}logger[_0x8154('0x16')]('UserNotification,\x20%s,\x20%s',_0x3a2dfd,_0x1de004['error'][_0x8154('0x18')]);return _0x1b59c6(_0x1de004[_0x8154('0x16')][_0x8154('0x18')]);}else{logger['info'](_0x8154('0x11'),_0x3a2dfd,_0x8154('0x12'));_0x1b59c6(_0x1de004[_0x8154('0x19')][_0x8154('0x18')]);}})[_0x8154('0x1a')](function(_0x45ca10){logger[_0x8154('0x16')](_0x8154('0x11'),_0x3a2dfd,_0x45ca10);_0x53b6aa(_0x45ca10);});});} \ No newline at end of file +var _0x2190=['defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','redis'];(function(_0x51aebb,_0x337d75){var _0x4d162e=function(_0x3b4879){while(--_0x3b4879){_0x51aebb['push'](_0x51aebb['shift']());}};_0x4d162e(++_0x337d75);}(_0x2190,0x122));var _0x0219=function(_0x101dce,_0x3b887c){_0x101dce=_0x101dce-0x0;var _0x5a92bb=_0x2190[_0x101dce];return _0x5a92bb;};'use strict';var _=require(_0x0219('0x0'));var util=require(_0x0219('0x1'));var moment=require(_0x0219('0x2'));var BPromise=require(_0x0219('0x3'));var rs=require(_0x0219('0x4'));var fs=require('fs');var Redis=require(_0x0219('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0219('0x6'))(_0x0219('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0219('0x8')]({'port':0x232a});config[_0x0219('0x9')]=_[_0x0219('0xa')](config[_0x0219('0x9')],{'host':_0x0219('0xb'),'port':0x18eb});var socket=require(_0x0219('0xc'))(new Redis(config[_0x0219('0x9')]));require(_0x0219('0xd'))[_0x0219('0xe')](socket);function respondWithRpcPromise(_0x4839d4,_0x3d70c6,_0x19a90d){return new BPromise(function(_0x3871d2,_0x5a0544){return client[_0x0219('0xf')](_0x4839d4,_0x19a90d)[_0x0219('0x10')](function(_0x51ac16){logger['info'](_0x0219('0x11'),_0x3d70c6,_0x0219('0x12'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x3d70c6,_0x0219('0x12'),JSON[_0x0219('0x13')](_0x51ac16));if(_0x51ac16[_0x0219('0x14')]){if(_0x51ac16['error'][_0x0219('0x15')]===0x1f4){logger[_0x0219('0x14')](_0x0219('0x11'),_0x3d70c6,_0x51ac16[_0x0219('0x14')][_0x0219('0x16')]);return _0x5a0544(_0x51ac16['error'][_0x0219('0x16')]);}logger[_0x0219('0x14')](_0x0219('0x11'),_0x3d70c6,_0x51ac16[_0x0219('0x14')][_0x0219('0x16')]);return _0x3871d2(_0x51ac16[_0x0219('0x14')]['message']);}else{logger['info'](_0x0219('0x11'),_0x3d70c6,_0x0219('0x12'));_0x3871d2(_0x51ac16[_0x0219('0x17')][_0x0219('0x16')]);}})[_0x0219('0x18')](function(_0x3bd81a){logger[_0x0219('0x14')](_0x0219('0x11'),_0x3d70c6,_0x3bd81a);_0x5a0544(_0x3bd81a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index b6ea5b7..3c75368 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 _0x5ade=['remove','update','emit','register','length','./userNotification.events'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x5ade,0xc5));var _0xe5ad=function(_0x1db8c7,_0x59b5de){_0x1db8c7=_0x1db8c7-0x0;var _0x1bd1ce=_0x5ade[_0x1db8c7];return _0x1bd1ce;};'use strict';var UserNotificationEvents=require(_0xe5ad('0x0'));var events=['save',_0xe5ad('0x1'),_0xe5ad('0x2')];function createListener(_0x46252c,_0x48d6f8){return function(_0x498997){_0x48d6f8[_0xe5ad('0x3')](_0x46252c,_0x498997);};}function removeListener(_0x301805,_0x4a083c){return function(){UserNotificationEvents['removeListener'](_0x301805,_0x4a083c);};}exports[_0xe5ad('0x4')]=function(_0x48b974){for(var _0x3012da=0x0,_0x19676a=events[_0xe5ad('0x5')];_0x3012da<_0x19676a;_0x3012da++){var _0x3b5a66=events[_0x3012da];var _0x5ac5e3=createListener('userNotification:'+_0x3b5a66,_0x48b974);UserNotificationEvents['on'](_0x3b5a66,_0x5ac5e3);}}; \ No newline at end of file +var _0x6be6=['length','userNotification:','./userNotification.events','save','update','emit','register'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6be6,0x175));var _0x66be=function(_0x173c3f,_0x31f2dd){_0x173c3f=_0x173c3f-0x0;var _0x2fb092=_0x6be6[_0x173c3f];return _0x2fb092;};'use strict';var UserNotificationEvents=require(_0x66be('0x0'));var events=[_0x66be('0x1'),'remove',_0x66be('0x2')];function createListener(_0x4e81e4,_0x1ede51){return function(_0x2c2f59){_0x1ede51[_0x66be('0x3')](_0x4e81e4,_0x2c2f59);};}function removeListener(_0x1ddd9f,_0x8b7c6e){return function(){UserNotificationEvents['removeListener'](_0x1ddd9f,_0x8b7c6e);};}exports[_0x66be('0x4')]=function(_0x47a839){for(var _0x53e3a4=0x0,_0x22a57c=events[_0x66be('0x5')];_0x53e3a4<_0x22a57c;_0x53e3a4++){var _0x5300b0=events[_0x53e3a4];var _0x2e5710=createListener(_0x66be('0x6')+_0x5300b0,_0x47a839);UserNotificationEvents['on'](_0x5300b0,_0x2e5710);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 3fb4f70..1984434 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x33a5f7,_0x568a1a){var _0x5cd800=function(_0x312d88){while(--_0x312d88){_0x33a5f7['push'](_0x33a5f7['shift']());}};_0x5cd800(++_0x568a1a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xcb91[_0x5e6ea3];return _0x4048b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2a4dda,_0x394a1b){var _0xe725e=function(_0x5c005c){while(--_0x5c005c){_0x2a4dda['push'](_0x2a4dda['shift']());}};_0xe725e(++_0x394a1b);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9409373..7ea6cb8 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 _0xd3e7=['sequelize','exports','INTEGER'];(function(_0x39fb23,_0x2ad8c5){var _0x5e862c=function(_0x1d3ce3){while(--_0x1d3ce3){_0x39fb23['push'](_0x39fb23['shift']());}};_0x5e862c(++_0x2ad8c5);}(_0xd3e7,0xbd));var _0x7d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e7[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7d3e('0x0'));module[_0x7d3e('0x1')]={'penalty':{'type':Sequelize[_0x7d3e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x008e=['exports','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x008e,0x103));var _0xe008=function(_0x4323ce,_0x12ca4f){_0x4323ce=_0x4323ce-0x0;var _0x5ddcef=_0x008e[_0x4323ce];return _0x5ddcef;};'use strict';var Sequelize=require(_0xe008('0x0'));module[_0xe008('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 e22c03f..6f8bee0 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 _0x6b0a=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e7dab,_0x71e182){var _0xb8e942=function(_0x1c6750){while(--_0x1c6750){_0x3e7dab['push'](_0x3e7dab['shift']());}};_0xb8e942(++_0x71e182);}(_0x6b0a,0x1d3));var _0xa6b0=function(_0x21cadf,_0x50b2cb){_0x21cadf=_0x21cadf-0x0;var _0x286683=_0x6b0a[_0x21cadf];return _0x286683;};'use strict';var _=require('lodash');var util=require(_0xa6b0('0x0'));var logger=require(_0xa6b0('0x1'))(_0xa6b0('0x2'));var moment=require(_0xa6b0('0x3'));var BPromise=require(_0xa6b0('0x4'));var rp=require(_0xa6b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa6b0('0x6'));module[_0xa6b0('0x7')]=function(_0x2de917,_0x5737cc){return _0x2de917[_0xa6b0('0x8')](_0xa6b0('0x9'),attributes,{'tableName':_0xa6b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07cc=['user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x399cce,_0x387c33){var _0x27abfa=function(_0x28287a){while(--_0x28287a){_0x399cce['push'](_0x399cce['shift']());}};_0x27abfa(++_0x387c33);}(_0x07cc,0x153));var _0xc07c=function(_0x3f7647,_0x11f536){_0x3f7647=_0x3f7647-0x0;var _0x126e17=_0x07cc[_0x3f7647];return _0x126e17;};'use strict';var _=require(_0xc07c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc07c('0x1'));var moment=require(_0xc07c('0x2'));var BPromise=require(_0xc07c('0x3'));var rp=require(_0xc07c('0x4'));var fs=require('fs');var path=require(_0xc07c('0x5'));var rimraf=require(_0xc07c('0x6'));var config=require(_0xc07c('0x7'));var attributes=require(_0xc07c('0x8'));module[_0xc07c('0x9')]=function(_0x347438,_0x1ec36c){return _0x347438[_0xc07c('0xa')](_0xc07c('0xb'),attributes,{'tableName':_0xc07c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 2aa9cc9..343f0f8 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 _0xd869=['http','request','then','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd869,0x19a));var _0x9d86=function(_0xc72ddf,_0x20c2ac){_0xc72ddf=_0xc72ddf-0x0;var _0x1c3cef=_0xd869[_0xc72ddf];return _0x1c3cef;};'use strict';var _=require(_0x9d86('0x0'));var util=require(_0x9d86('0x1'));var moment=require(_0x9d86('0x2'));var BPromise=require(_0x9d86('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d86('0x4'));var db=require(_0x9d86('0x5'))['db'];var utils=require(_0x9d86('0x6'));var logger=require('../../config/logger')(_0x9d86('0x7'));var config=require('../../config/environment');var jayson=require(_0x9d86('0x8'));var client=jayson[_0x9d86('0x9')][_0x9d86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x392f29,_0x4f3f83,_0x302c59){return new BPromise(function(_0x1373f0,_0x214b57){return client[_0x9d86('0xb')](_0x392f29,_0x302c59)[_0x9d86('0xc')](function(_0xc26257){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4f3f83,_0x9d86('0xd'));logger['debug'](_0x9d86('0xe'),_0x4f3f83,'request\x20sent',JSON['stringify'](_0xc26257));if(_0xc26257[_0x9d86('0xf')]){if(_0xc26257[_0x9d86('0xf')]['code']===0x1f4){logger[_0x9d86('0xf')](_0x9d86('0x10'),_0x4f3f83,_0xc26257[_0x9d86('0xf')]['message']);return _0x214b57(_0xc26257['error'][_0x9d86('0x11')]);}logger[_0x9d86('0xf')](_0x9d86('0x10'),_0x4f3f83,_0xc26257[_0x9d86('0xf')][_0x9d86('0x11')]);return _0x1373f0(_0xc26257[_0x9d86('0xf')]['message']);}else{logger[_0x9d86('0x12')](_0x9d86('0x10'),_0x4f3f83,_0x9d86('0xd'));_0x1373f0(_0xc26257[_0x9d86('0x13')][_0x9d86('0x11')]);}})['catch'](function(_0x1c705d){logger[_0x9d86('0xf')](_0x9d86('0x10'),_0x4f3f83,_0x1c705d);_0x214b57(_0x1c705d);});});} \ No newline at end of file +var _0x5efa=['request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x15449d,_0x537b1d){var _0x55cf8c=function(_0x4fc014){while(--_0x4fc014){_0x15449d['push'](_0x15449d['shift']());}};_0x55cf8c(++_0x537b1d);}(_0x5efa,0x13e));var _0xa5ef=function(_0x3ae88b,_0x5450c4){_0x3ae88b=_0x3ae88b-0x0;var _0x28b432=_0x5efa[_0x3ae88b];return _0x28b432;};'use strict';var _=require(_0xa5ef('0x0'));var util=require(_0xa5ef('0x1'));var moment=require('moment');var BPromise=require(_0xa5ef('0x2'));var rs=require(_0xa5ef('0x3'));var fs=require('fs');var Redis=require(_0xa5ef('0x4'));var db=require(_0xa5ef('0x5'))['db'];var utils=require(_0xa5ef('0x6'));var logger=require('../../config/logger')(_0xa5ef('0x7'));var config=require(_0xa5ef('0x8'));var jayson=require(_0xa5ef('0x9'));var client=jayson[_0xa5ef('0xa')][_0xa5ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bd865,_0x5d4293,_0x375fcd){return new BPromise(function(_0x186f81,_0x45efc4){return client[_0xa5ef('0xc')](_0x3bd865,_0x375fcd)[_0xa5ef('0xd')](function(_0x443a62){logger[_0xa5ef('0xe')](_0xa5ef('0xf'),_0x5d4293,_0xa5ef('0x10'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5d4293,_0xa5ef('0x10'),JSON[_0xa5ef('0x11')](_0x443a62));if(_0x443a62[_0xa5ef('0x12')]){if(_0x443a62['error'][_0xa5ef('0x13')]===0x1f4){logger[_0xa5ef('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5d4293,_0x443a62['error'][_0xa5ef('0x14')]);return _0x45efc4(_0x443a62[_0xa5ef('0x12')]['message']);}logger['error'](_0xa5ef('0xf'),_0x5d4293,_0x443a62[_0xa5ef('0x12')][_0xa5ef('0x14')]);return _0x186f81(_0x443a62[_0xa5ef('0x12')]['message']);}else{logger[_0xa5ef('0xe')](_0xa5ef('0xf'),_0x5d4293,_0xa5ef('0x10'));_0x186f81(_0x443a62[_0xa5ef('0x15')][_0xa5ef('0x14')]);}})['catch'](function(_0x2984e3){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5d4293,_0x2984e3);_0x45efc4(_0x2984e3);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 616c273..ce2173b 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 _0x958f=['post','clone','put','destroy','delete','removeResources','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','get','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources'];(function(_0x3ba0af,_0xccb8a1){var _0x650db7=function(_0x1f1f0a){while(--_0x1f1f0a){_0x3ba0af['push'](_0x3ba0af['shift']());}};_0x650db7(++_0xccb8a1);}(_0x958f,0x16e));var _0xf958=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x958f[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require(_0xf958('0x0'));var path=require(_0xf958('0x1'));var timeout=require(_0xf958('0x2'));var express=require(_0xf958('0x3'));var router=express[_0xf958('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf958('0x5'));var interaction=require(_0xf958('0x6'));var config=require('../../config/environment');var controller=require(_0xf958('0x7'));router['get']('/',auth[_0xf958('0x8')](),controller[_0xf958('0x9')]);router[_0xf958('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xf958('0xb')]);router[_0xf958('0xa')](_0xf958('0xc'),auth[_0xf958('0x8')](),controller[_0xf958('0xd')]);router[_0xf958('0xa')](_0xf958('0xe'),auth[_0xf958('0x8')](),controller[_0xf958('0xf')]);router[_0xf958('0xa')](_0xf958('0x10'),auth[_0xf958('0x8')](),controller[_0xf958('0x11')]);router[_0xf958('0x12')]('/',auth[_0xf958('0x8')](),controller['create']);router['post']('/:id/clone',auth[_0xf958('0x8')](),controller[_0xf958('0x13')]);router['post']('/:id/sections',auth['isAuthenticated'](),controller['addSections']);router[_0xf958('0x12')](_0xf958('0x10'),auth[_0xf958('0x8')](),controller['addResources']);router[_0xf958('0x14')](_0xf958('0xc'),auth[_0xf958('0x8')](),controller['update']);router['delete'](_0xf958('0xc'),auth[_0xf958('0x8')](),controller[_0xf958('0x15')]);router[_0xf958('0x16')](_0xf958('0xe'),auth[_0xf958('0x8')](),controller['removeSections']);router[_0xf958('0x16')](_0xf958('0x10'),auth[_0xf958('0x8')](),controller[_0xf958('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa149=['index','get','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated'];(function(_0x2ec717,_0x3f2733){var _0x11fb9e=function(_0xc6ecf5){while(--_0xc6ecf5){_0x2ec717['push'](_0x2ec717['shift']());}};_0x11fb9e(++_0x3f2733);}(_0xa149,0xb5));var _0x9a14=function(_0x1a83de,_0x13de12){_0x1a83de=_0x1a83de-0x0;var _0x4e4d1e=_0xa149[_0x1a83de];return _0x4e4d1e;};'use strict';var multer=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var path=require(_0x9a14('0x2'));var timeout=require(_0x9a14('0x3'));var express=require(_0x9a14('0x4'));var router=express[_0x9a14('0x5')]();var fs_extra=require(_0x9a14('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9a14('0x7'));var config=require(_0x9a14('0x8'));var controller=require(_0x9a14('0x9'));router['get']('/',auth[_0x9a14('0xa')](),controller[_0x9a14('0xb')]);router[_0x9a14('0xc')](_0x9a14('0xd'),auth[_0x9a14('0xa')](),controller['describe']);router['get'](_0x9a14('0xe'),auth['isAuthenticated'](),controller[_0x9a14('0xf')]);router[_0x9a14('0xc')](_0x9a14('0x10'),auth['isAuthenticated'](),controller[_0x9a14('0x11')]);router[_0x9a14('0xc')](_0x9a14('0x12'),auth[_0x9a14('0xa')](),controller[_0x9a14('0x13')]);router[_0x9a14('0x14')]('/',auth['isAuthenticated'](),controller[_0x9a14('0x15')]);router['post'](_0x9a14('0x16'),auth[_0x9a14('0xa')](),controller[_0x9a14('0x17')]);router[_0x9a14('0x14')]('/:id/sections',auth['isAuthenticated'](),controller[_0x9a14('0x18')]);router['post'](_0x9a14('0x12'),auth[_0x9a14('0xa')](),controller[_0x9a14('0x19')]);router[_0x9a14('0x1a')](_0x9a14('0xe'),auth[_0x9a14('0xa')](),controller[_0x9a14('0x1b')]);router[_0x9a14('0x1c')](_0x9a14('0xe'),auth[_0x9a14('0xa')](),controller[_0x9a14('0x1d')]);router['delete']('/:id/sections',auth[_0x9a14('0xa')](),controller[_0x9a14('0x1e')]);router['delete'](_0x9a14('0x12'),auth['isAuthenticated'](),controller['removeResources']);module[_0x9a14('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index d1a52ad..7b05d79 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 _0x151a=['STRING','name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x2ba37a,_0x492b88){var _0x17f0db=function(_0x80b584){while(--_0x80b584){_0x2ba37a['push'](_0x2ba37a['shift']());}};_0x17f0db(++_0x492b88);}(_0x151a,0x1af));var _0xa151=function(_0x20049b,_0x369c8b){_0x20049b=_0x20049b-0x0;var _0x35cc83=_0x151a[_0x20049b];return _0x35cc83;};'use strict';var Sequelize=require(_0xa151('0x0'));module['exports']={'name':{'type':Sequelize[_0xa151('0x1')],'allowNull':![],'unique':_0xa151('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x36d071){this[_0xa151('0x3')](_0xa151('0x4'),_0x36d071?_0x36d071[_0xa151('0x5')](''):[]);},'get':function(){return this[_0xa151('0x6')](_0xa151('0x4'))?this[_0xa151('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa151('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa151('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa151('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa151('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa151('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa151('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa151('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8c6b=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8c6b,0xd7));var _0xb8c6=function(_0x4f9f3e,_0x30e088){_0x4f9f3e=_0x4f9f3e-0x0;var _0x4b6441=_0x8c6b[_0x4f9f3e];return _0x4b6441;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb8c6('0x0')],'allowNull':![],'unique':_0xb8c6('0x1')},'crudPermissions':{'type':Sequelize[_0xb8c6('0x0')],'set':function(_0xeb46e1){this[_0xb8c6('0x2')](_0xb8c6('0x3'),_0xeb46e1?_0xeb46e1[_0xb8c6('0x4')](''):[]);},'get':function(){return this[_0xb8c6('0x5')](_0xb8c6('0x3'))?this[_0xb8c6('0x5')](_0xb8c6('0x3'))[_0xb8c6('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb8c6('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb8c6('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb8c6('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb8c6('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb8c6('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb8c6('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb8c6('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb8c6('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb8c6('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 1c01785..fd616fa 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 _0x1f75=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','clone','omit','updatedAt','crudPermissions','createdAt','sequelize','get','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sectionId','push','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0x1f75,0x13c));var _0x51f7=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x1f75[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51f7('0x0'));var zipdir=require(_0x51f7('0x1'));var jsonpatch=require(_0x51f7('0x2'));var rp=require(_0x51f7('0x3'));var moment=require(_0x51f7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51f7('0x5'));var util=require(_0x51f7('0x6'));var path=require(_0x51f7('0x7'));var sox=require(_0x51f7('0x8'));var csv=require(_0x51f7('0x9'));var ejs=require(_0x51f7('0xa'));var fs=require('fs');var fs_extra=require(_0x51f7('0xb'));var _=require(_0x51f7('0xc'));var squel=require(_0x51f7('0xd'));var crypto=require(_0x51f7('0xe'));var jsforce=require(_0x51f7('0xf'));var deskjs=require(_0x51f7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x51f7('0x11'));var Papa=require(_0x51f7('0x12'));var Redis=require('ioredis');var authService=require(_0x51f7('0x13'));var qs=require(_0x51f7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51f7('0x15'))(_0x51f7('0x16'));var utils=require('../../config/utils');var config=require(_0x51f7('0x17'));var licenseUtil=require(_0x51f7('0x18'));var db=require('../../mysqldb')['db'];config[_0x51f7('0x19')]=_[_0x51f7('0x1a')](config[_0x51f7('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51f7('0x19')]));require(_0x51f7('0x1b'))[_0x51f7('0x1c')](socket);function respondWithStatusCode(_0x3fc869,_0x2fed6f){_0x2fed6f=_0x2fed6f||0xcc;return function(_0x139d8b){if(_0x139d8b){return _0x3fc869['sendStatus'](_0x2fed6f);}return _0x3fc869[_0x51f7('0x1d')](_0x2fed6f)[_0x51f7('0x1e')]();};}function respondWithResult(_0x12e09d,_0x23998b){_0x23998b=_0x23998b||0xc8;return function(_0x350b32){if(_0x350b32){return _0x12e09d[_0x51f7('0x1d')](_0x23998b)[_0x51f7('0x1f')](_0x350b32);}};}function respondWithFilteredResult(_0x4f9fd0,_0x1c0e2a){return function(_0x33d2a7){if(_0x33d2a7){var _0x505597=typeof _0x1c0e2a[_0x51f7('0x20')]===_0x51f7('0x21')&&typeof _0x1c0e2a['limit']==='undefined';var _0x564686=_0x33d2a7[_0x51f7('0x22')];var _0x5a4e63=_0x505597?0x0:_0x1c0e2a['offset'];var _0x293eee=_0x505597?_0x33d2a7[_0x51f7('0x22')]:_0x1c0e2a[_0x51f7('0x20')]+_0x1c0e2a[_0x51f7('0x23')];var _0x669234;if(_0x293eee>=_0x564686){_0x293eee=_0x564686;_0x669234=0xc8;}else{_0x669234=0xce;}_0x4f9fd0[_0x51f7('0x1d')](_0x669234);return _0x4f9fd0[_0x51f7('0x24')](_0x51f7('0x25'),_0x5a4e63+'-'+_0x293eee+'/'+_0x564686)['json'](_0x33d2a7);}return null;};}function patchUpdates(_0x28566c){return function(_0x4c37b8){try{jsonpatch[_0x51f7('0x26')](_0x4c37b8,_0x28566c,!![]);}catch(_0x38801b){return BPromise[_0x51f7('0x27')](_0x38801b);}return _0x4c37b8[_0x51f7('0x28')]();};}function saveUpdates(_0x19e020,_0x239cb7){return function(_0x46299c){if(_0x46299c){return _0x46299c[_0x51f7('0x29')](_0x19e020)[_0x51f7('0x2a')](function(_0x10f90b){return _0x10f90b;});}return null;};}function removeEntity(_0x45421f,_0x47ed7c){return function(_0xb6aec9){if(_0xb6aec9){return _0xb6aec9[_0x51f7('0x2b')]()[_0x51f7('0x2a')](function(){_0x45421f['status'](0xcc)[_0x51f7('0x1e')]();});}};}function handleEntityNotFound(_0x11e723,_0x438edb){return function(_0x12461c){if(!_0x12461c){_0x11e723['sendStatus'](0x194);}return _0x12461c;};}function handleError(_0x2d61e8,_0x41f696){_0x41f696=_0x41f696||0x1f4;return function(_0x1d8bf6){logger[_0x51f7('0x2c')](_0x1d8bf6[_0x51f7('0x2d')]);if(_0x1d8bf6['name']){delete _0x1d8bf6[_0x51f7('0x2e')];}_0x2d61e8[_0x51f7('0x1d')](_0x41f696)[_0x51f7('0x2f')](_0x1d8bf6);};}exports['index']=function(_0x1238ce,_0x50a2f4){var _0x4edee1={},_0x12a9ce={},_0x39c9bc={'count':0x0,'rows':[]};var _0x75946f=_[_0x51f7('0x30')](db[_0x51f7('0x31')][_0x51f7('0x32')],function(_0x46bb0c){return{'name':_0x46bb0c['fieldName'],'type':_0x46bb0c['type'][_0x51f7('0x33')]};});_0x12a9ce[_0x51f7('0x34')]=_[_0x51f7('0x30')](_0x75946f,_0x51f7('0x2e'));_0x12a9ce[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x1238ce[_0x51f7('0x35')]);_0x12a9ce[_0x51f7('0x37')]=_[_0x51f7('0x38')](_0x12a9ce['model'],_0x12a9ce[_0x51f7('0x35')]);_0x4edee1['attributes']=_[_0x51f7('0x38')](_0x12a9ce['model'],qs[_0x51f7('0x39')](_0x1238ce['query'][_0x51f7('0x39')]));_0x4edee1['attributes']=_0x4edee1[_0x51f7('0x3a')][_0x51f7('0x3b')]?_0x4edee1[_0x51f7('0x3a')]:_0x12a9ce['model'];if(!_0x1238ce[_0x51f7('0x35')][_0x51f7('0x3c')]('nolimit')){_0x4edee1['limit']=qs['limit'](_0x1238ce[_0x51f7('0x35')][_0x51f7('0x23')]);_0x4edee1[_0x51f7('0x20')]=qs['offset'](_0x1238ce[_0x51f7('0x35')][_0x51f7('0x20')]);}_0x4edee1[_0x51f7('0x3d')]=qs['sort'](_0x1238ce[_0x51f7('0x35')][_0x51f7('0x3e')]);_0x4edee1[_0x51f7('0x3f')]=qs['filters'](_[_0x51f7('0x40')](_0x1238ce[_0x51f7('0x35')],_0x12a9ce[_0x51f7('0x37')]),_0x75946f);if(_0x1238ce['query'][_0x51f7('0x41')]){_0x4edee1[_0x51f7('0x3f')]=_[_0x51f7('0x42')](_0x4edee1[_0x51f7('0x3f')],{'$or':_[_0x51f7('0x30')](_0x75946f,function(_0x58d701){if(_0x58d701[_0x51f7('0x43')]!==_0x51f7('0x44')){var _0xd30b96={};_0xd30b96[_0x58d701[_0x51f7('0x2e')]]={'$like':'%'+_0x1238ce['query'][_0x51f7('0x41')]+'%'};return _0xd30b96;}})});}_0x4edee1=_['merge']({},_0x4edee1,_0x1238ce[_0x51f7('0x45')]);var _0x3400c9={'where':_0x4edee1[_0x51f7('0x3f')]};return db[_0x51f7('0x31')][_0x51f7('0x22')](_0x3400c9)[_0x51f7('0x2a')](function(_0x1339a3){_0x39c9bc[_0x51f7('0x22')]=_0x1339a3;if(_0x1238ce[_0x51f7('0x35')][_0x51f7('0x46')]){_0x4edee1[_0x51f7('0x47')]=[{'all':!![]}];}return db[_0x51f7('0x31')][_0x51f7('0x48')](_0x4edee1);})['then'](function(_0x53ba21){_0x39c9bc[_0x51f7('0x49')]=_0x53ba21;return _0x39c9bc;})[_0x51f7('0x2a')](respondWithFilteredResult(_0x50a2f4,_0x4edee1))['catch'](handleError(_0x50a2f4,null));};exports['show']=function(_0x114a89,_0x1ae1cc){var _0x361ec5={'raw':![],'where':{'id':_0x114a89[_0x51f7('0x4a')]['id']}},_0x499102={};_0x499102[_0x51f7('0x34')]=_[_0x51f7('0x36')](db[_0x51f7('0x31')]['rawAttributes']);_0x499102[_0x51f7('0x35')]=_[_0x51f7('0x36')](_0x114a89[_0x51f7('0x35')]);_0x499102[_0x51f7('0x37')]=_[_0x51f7('0x38')](_0x499102[_0x51f7('0x34')],_0x499102[_0x51f7('0x35')]);_0x361ec5[_0x51f7('0x3a')]=_['intersection'](_0x499102[_0x51f7('0x34')],qs['fields'](_0x114a89[_0x51f7('0x35')][_0x51f7('0x39')]));_0x361ec5[_0x51f7('0x3a')]=_0x361ec5[_0x51f7('0x3a')][_0x51f7('0x3b')]?_0x361ec5[_0x51f7('0x3a')]:_0x499102[_0x51f7('0x34')];if(_0x114a89[_0x51f7('0x35')]['includeAll']){_0x361ec5[_0x51f7('0x47')]=[{'all':!![]}];}_0x361ec5=_['merge']({},_0x361ec5,_0x114a89[_0x51f7('0x45')]);return db['UserProfile'][_0x51f7('0x4b')](_0x361ec5)['then'](handleEntityNotFound(_0x1ae1cc,null))[_0x51f7('0x2a')](respondWithResult(_0x1ae1cc,null))[_0x51f7('0x4c')](handleError(_0x1ae1cc,null));};exports[_0x51f7('0x4d')]=function(_0x501cb8,_0x5c0207){return db[_0x51f7('0x31')][_0x51f7('0x4d')](_0x501cb8[_0x51f7('0x4e')],{})[_0x51f7('0x2a')](respondWithResult(_0x5c0207,0xc9))[_0x51f7('0x4c')](handleError(_0x5c0207,null));};exports[_0x51f7('0x4f')]=function(_0xcedac2,_0x416ac){var _0x1187b5={'where':{'id':_0xcedac2[_0x51f7('0x4a')]['id']}},_0x136e02={};_0x136e02[_0x51f7('0x34')]=_['keys'](db[_0x51f7('0x31')][_0x51f7('0x32')]);_0x1187b5['attributes']=_['intersection'](_0x136e02[_0x51f7('0x34')],qs['fields'](_0xcedac2[_0x51f7('0x35')][_0x51f7('0x39')]));_0x1187b5[_0x51f7('0x3a')]=_0x1187b5['attributes'][_0x51f7('0x3b')]?_0x1187b5['attributes']:_0x136e02[_0x51f7('0x34')];if(_0xcedac2[_0x51f7('0x35')][_0x51f7('0x46')]){_0x1187b5[_0x51f7('0x47')]=[{'all':!![]}];}_0x1187b5=_[_0x51f7('0x42')]({},_0x1187b5,_0xcedac2['options']);return db[_0x51f7('0x31')][_0x51f7('0x4b')](_0x1187b5)[_0x51f7('0x2a')](handleEntityNotFound(_0x416ac,null))[_0x51f7('0x2a')](function(_0x3dc739){if(_0x3dc739){var _0x1310c2=_0x3dc739['get']({'plain':!![]});_0x1310c2=qs[_0x51f7('0x50')](_0x1310c2,['id','createdAt',_0x51f7('0x51'),_0x51f7('0x52')]);_0xcedac2['body']=_[_0x51f7('0x50')](_0xcedac2[_0x51f7('0x4e')],['id',_0x51f7('0x53'),'updatedAt']);return db[_0x51f7('0x54')]['transaction'](function(_0x127364){return db[_0x51f7('0x31')][_0x51f7('0x4d')](_[_0x51f7('0x42')](_0x1310c2,_0xcedac2[_0x51f7('0x4e')]),{'include':_0xcedac2[_0x51f7('0x35')][_0x51f7('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x127364})[_0x51f7('0x2a')](function(_0x5113d3){var _0x124415=_0x5113d3[_0x51f7('0x55')]({'plain':!![]});return db[_0x51f7('0x56')][_0x51f7('0x48')]({'where':{'userProfileId':_0xcedac2[_0x51f7('0x4a')]['id']},'raw':!![]})[_0x51f7('0x2a')](function(_0x3ff0da){if(_0x3ff0da){return BPromise['each'](_0x3ff0da,function(_0x17a27){return new BPromise(function(_0x15b5df,_0x36b1c1){if(_0x17a27[_0x51f7('0x57')]===null||_0x17a27[_0x51f7('0x57')]===0x1)_0x15b5df(null);return db[_0x51f7('0x58')][_0x51f7('0x48')]({'where':{'sectionId':_0x17a27['id']},'raw':!![]})[_0x51f7('0x2a')](function(_0x311fa7){var _0x2e3dfb=_[_0x51f7('0x30')](_0x311fa7,function(_0x312606){return qs[_0x51f7('0x50')](_0x312606,['id',_0x51f7('0x53'),'updatedAt','sectionId']);});_0x15b5df(_0x2e3dfb);})[_0x51f7('0x4c')](function(_0x5f03f7){_0x36b1c1(_0x5f03f7);});})[_0x51f7('0x2a')](function(_0xbaec31){var _0x1038a7=qs['omit'](_0x17a27,['id',_0x51f7('0x53'),'updatedAt']);_0x1038a7[_0x51f7('0x59')]=_0x124415['id'];if(_0xbaec31)_0x1038a7[_0x51f7('0x5a')]=_0xbaec31;return _0x1038a7;})[_0x51f7('0x2a')](function(_0x21f123){return db[_0x51f7('0x56')][_0x51f7('0x4d')](_0x21f123,{'include':[{'model':db[_0x51f7('0x58')],'as':_0x51f7('0x5a')}],'raw':!![],'transaction':_0x127364});});})['then'](function(){return _0x124415;});}});});});}})[_0x51f7('0x2a')](respondWithResult(_0x416ac,0xc9))[_0x51f7('0x4c')](handleError(_0x416ac,null));};exports[_0x51f7('0x29')]=function(_0x46bbc2,_0x217e5c){if(_0x46bbc2['body']['id']){delete _0x46bbc2['body']['id'];}return db['UserProfile'][_0x51f7('0x4b')]({'where':{'id':_0x46bbc2[_0x51f7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x217e5c,null))[_0x51f7('0x2a')](saveUpdates(_0x46bbc2[_0x51f7('0x4e')],null))[_0x51f7('0x2a')](respondWithResult(_0x217e5c,null))[_0x51f7('0x4c')](handleError(_0x217e5c,null));};exports[_0x51f7('0x2b')]=function(_0x43ba9e,_0x130e80){return db['UserProfile'][_0x51f7('0x4b')]({'where':{'id':_0x43ba9e[_0x51f7('0x4a')]['id']}})[_0x51f7('0x2a')](handleEntityNotFound(_0x130e80,null))[_0x51f7('0x2a')](removeEntity(_0x130e80,null))['catch'](handleError(_0x130e80,null));};exports[_0x51f7('0x5b')]=function(_0xdc97c1,_0x241b29){return db['UserProfile'][_0x51f7('0x5b')]()[_0x51f7('0x2a')](respondWithResult(_0x241b29,null))[_0x51f7('0x4c')](handleError(_0x241b29,null));};exports[_0x51f7('0x5c')]=function(_0x1f4115,_0x3d9cc4){var _0x166f84=_0x1f4115['body'];return db[_0x51f7('0x31')][_0x51f7('0x4b')]({'where':{'id':_0x1f4115[_0x51f7('0x4a')]['id']}})[_0x51f7('0x2a')](handleEntityNotFound(_0x3d9cc4,null))[_0x51f7('0x2a')](function(_0x2e35b2){if(_0x2e35b2){return db[_0x51f7('0x54')]['transaction'](function(_0xc37043){return db[_0x51f7('0x56')][_0x51f7('0x2b')]({'where':{'userProfileId':_0x1f4115['params']['id'],'sectionId':_[_0x51f7('0x30')](_0x166f84,function(_0x1c181b){return _0x1c181b[_0x51f7('0x5d')];})},'transaction':_0xc37043})[_0x51f7('0x2a')](function(){var _0x593aed=_[_0x51f7('0x30')](_0x166f84,function(_0x3c44ed){_0x3c44ed['userProfileId']=_0x1f4115[_0x51f7('0x4a')]['id'];return _0x3c44ed;});var _0x3bfff9=[];return BPromise['each'](_0x593aed,function(_0x10faa0){return db[_0x51f7('0x56')]['create'](_0x10faa0,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0xc37043})[_0x51f7('0x2a')](function(_0x5a7b91){_0x3bfff9[_0x51f7('0x5e')](_0x5a7b91[_0x51f7('0x55')]({'plain':!![]}));});})[_0x51f7('0x2a')](function(){return _0x3bfff9;});});});}})[_0x51f7('0x2a')](function(_0x1f345b){return _0x1f345b;})[_0x51f7('0x2a')](respondWithResult(_0x3d9cc4,null))[_0x51f7('0x4c')](handleError(_0x3d9cc4,null));};exports[_0x51f7('0x5f')]=function(_0x5703f7,_0x3735b7){var _0x1bcfe9;return db[_0x51f7('0x31')][_0x51f7('0x4b')]({'where':{'id':_0x5703f7[_0x51f7('0x4a')]['id']},'attributes':['id','name']})[_0x51f7('0x2a')](handleEntityNotFound(_0x3735b7,null))[_0x51f7('0x2a')](function(_0x446bcb){if(_0x446bcb){_0x1bcfe9=_0x446bcb;return db[_0x51f7('0x56')][_0x51f7('0x2b')]({'where':{'userProfileId':_0x5703f7[_0x51f7('0x4a')]['id'],'sectionId':_0x5703f7['query']['ids']}});}})[_0x51f7('0x2a')](function(){return _0x1bcfe9;})[_0x51f7('0x2a')](respondWithStatusCode(_0x3735b7,null))['catch'](handleError(_0x3735b7,null));};exports[_0x51f7('0x60')]=function(_0x14dd35,_0x24e00f){var _0x250ffe=[];var _0x43e109=[];return db[_0x51f7('0x56')][_0x51f7('0x48')]({'where':{'userProfileId':_0x14dd35[_0x51f7('0x4a')]['id']},'raw':!![]})[_0x51f7('0x2a')](function(_0x23494a){_0x250ffe=_[_0x51f7('0x41')](_0x23494a,function(_0x3a908c){return _0x3a908c['enabled']===0x1||_[_0x51f7('0x61')]([0x3eb,0x709],_0x3a908c[_0x51f7('0x5d')]);});if(!_[_0x51f7('0x62')](_0x250ffe)){return _['map'](_0x250ffe,function(_0x4a467c){return _0x4a467c['sectionId'];});}else{return;}})['then'](function(_0x4d5c68){if(_0x4d5c68)_0x43e109=_0x4d5c68;if(_[_0x51f7('0x61')](_0x43e109,0x64)){var _0x4dcedd=_[_0x51f7('0x4b')](_0x250ffe,{'sectionId':0x64});return hasDefaultDashboard(_0x4dcedd)['then'](function(_0x7da4f7){return _[_0x51f7('0x30')](_0x250ffe,function(_0x47e5ea){if(_0x47e5ea[_0x51f7('0x5d')]===0x64){_0x47e5ea[_0x51f7('0x63')]=_0x7da4f7;}return _0x47e5ea;});});}else{return;}})['then'](function(_0x370b9c){if(_0x370b9c)_0x250ffe=_0x370b9c;if(_['includes'](_0x43e109,0x3eb)){var _0x440bb7=_[_0x51f7('0x4b')](_0x250ffe,{'sectionId':0x3eb});return getCustomDashboards(_0x440bb7)[_0x51f7('0x2a')](function(_0x70fafc){return _[_0x51f7('0x30')](_0x250ffe,function(_0x25a2e2){if(_0x440bb7[_0x51f7('0x64')]){if(_0x25a2e2[_0x51f7('0x5d')]===0x3eb){_0x25a2e2[_0x51f7('0x63')]=_0x70fafc;}}else{if(_0x25a2e2['sectionId']===0x64){_0x25a2e2[_0x51f7('0x63')]=_0x70fafc;}}return _0x25a2e2;});});}else{return;}})[_0x51f7('0x2a')](function(_0x3d3e4b){if(_0x3d3e4b)_0x250ffe=_0x3d3e4b;if(_[_0x51f7('0x61')](_0x43e109,0x709)){var _0x1a7bf0=_['find'](_0x250ffe,{'sectionId':0x709});return getPlugins(_0x1a7bf0)[_0x51f7('0x2a')](function(_0x358fdd){if(_0x1a7bf0[_0x51f7('0x64')]){return _[_0x51f7('0x30')](_0x250ffe,function(_0x30cc1e){if(_0x30cc1e[_0x51f7('0x5d')]===0x709){_0x30cc1e[_0x51f7('0x63')]=_0x358fdd;}return _0x30cc1e;});}else{var _0x1f1815={'sectionId':0x76c,'enabled':0x1,'subsections':_0x358fdd};var _0x524bb8=_[_0x51f7('0x30')](_0x250ffe);_0x524bb8[_0x51f7('0x5e')](_0x1f1815);return _0x524bb8;}});}else{return;}})[_0x51f7('0x2a')](function(_0x1ac24a){if(_0x1ac24a)_0x250ffe=_0x1ac24a;return _['filter'](_0x250ffe,[_0x51f7('0x64'),0x1]);})[_0x51f7('0x2a')](respondWithResult(_0x24e00f,null))[_0x51f7('0x4c')](handleError(_0x24e00f,null));};function hasDefaultDashboard(_0x46c706){var _0x242325=[0x65];return new BPromise(function(_0xfa4b30,_0x2ce70d){try{if(_0x46c706[_0x51f7('0x57')]){_0xfa4b30(_0x242325);}else{return db[_0x51f7('0x58')][_0x51f7('0x65')]({'where':{'sectionId':_0x46c706['id']},'raw':!![]})[_0x51f7('0x2a')](function(_0x2d3d04){_0x2d3d04?_0xfa4b30(_0x242325):_0xfa4b30();});}}catch(_0x342347){_0x2ce70d(_0x342347);}});}function getCustomDashboards(_0x5d9df1){var _0x25441a=[];return new BPromise(function(_0x5c0b76,_0x53263c){try{if(_0x5d9df1['autoAssociation']){return db['Dashboard'][_0x51f7('0x48')]({'raw':!![]})[_0x51f7('0x2a')](function(_0x5bf1ba){_0x5bf1ba[_0x51f7('0x66')](function(_0x52800b){_0x25441a[_0x51f7('0x5e')](_0x52800b['id']+0x1869f);});_0x5c0b76(_0x25441a);});}else{return db[_0x51f7('0x58')][_0x51f7('0x48')]({'where':{'sectionId':_0x5d9df1['id']},'raw':!![]})[_0x51f7('0x2a')](function(_0x2ccd8e){_0x2ccd8e[_0x51f7('0x66')](function(_0x30c6ee){_0x25441a[_0x51f7('0x5e')](_0x30c6ee[_0x51f7('0x67')]+0x1869f);});_0x5c0b76(_0x25441a);});}}catch(_0x2acd01){_0x53263c(_0x2acd01);}});}function getPlugins(_0x2fea0e){var _0xaff41=[];return new BPromise(function(_0x2de3ef,_0x224064){try{if(_0x2fea0e[_0x51f7('0x57')]){return db[_0x51f7('0x68')][_0x51f7('0x48')]({'raw':!![]})['then'](function(_0x41f3f0){_0x41f3f0[_0x51f7('0x66')](function(_0x29cb48){_0xaff41[_0x51f7('0x5e')](_0x29cb48['id']+0x15b38);});_0x2de3ef(_0xaff41);});}else{return db['UserProfileResource'][_0x51f7('0x48')]({'where':{'sectionId':_0x2fea0e['id']},'raw':!![]})[_0x51f7('0x2a')](function(_0x266b06){_0x266b06[_0x51f7('0x66')](function(_0x3e699f){_0xaff41[_0x51f7('0x5e')](_0x3e699f['resourceId']+0x15b38);});_0x2de3ef(_0xaff41);});}}catch(_0x444a26){_0x224064(_0x444a26);}});}exports['addResources']=function(_0x204663,_0x4c335b){return db['UserProfile']['find']({'where':{'id':_0x204663[_0x51f7('0x4a')]['id']}})[_0x51f7('0x2a')](handleEntityNotFound(_0x4c335b,null))[_0x51f7('0x2a')](function(_0x728e42){if(_0x728e42){return db[_0x51f7('0x54')]['transaction'](function(_0x4a8867){return db['UserProfileSection'][_0x51f7('0x48')]({'where':{'userProfileId':_0x204663['params']['id']},'attributes':['id'],'raw':!![]})[_0x51f7('0x2a')](function(_0x271e7f){if(_0x271e7f){return db[_0x51f7('0x56')][_0x51f7('0x2b')]({'where':{'userProfileId':_0x204663[_0x51f7('0x4a')]['id'],'id':_[_0x51f7('0x30')](_0x271e7f,function(_0x5c1320){return _0x5c1320['id'];})},'transaction':_0x4a8867});}})['then'](function(_0x39ebf2){var _0x2de3e6=_['map'](_0x204663[_0x51f7('0x4e')],function(_0x15330b){_0x15330b[_0x51f7('0x59')]=_0x204663[_0x51f7('0x4a')]['id'];return _0x15330b;});return db['UserProfileSection'][_0x51f7('0x69')](_0x2de3e6,{'raw':!![],'transaction':_0x4a8867});})[_0x51f7('0x2a')](function(_0x1bc172){var _0x5387a4=_[_0x51f7('0x41')](_[_0x51f7('0x30')](_0x1bc172,function(_0x1ba43d){return _0x1ba43d[_0x51f7('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x5387a4){return db[_0x51f7('0x56')][_0x51f7('0x48')]({'where':{'userProfileId':_0x204663[_0x51f7('0x4a')]['id'],'sectionId':_['map'](_0x5387a4,function(_0x174e66){return _0x174e66[_0x51f7('0x5d')];})},'attributes':['id',_0x51f7('0x5d')],'raw':!![]})[_0x51f7('0x2a')](function(_0x208239){var _0x57d636=_['map'](_0x204663[_0x51f7('0x4e')],function(_0x6e3999){_0x6e3999[_0x51f7('0x59')]=_0x204663[_0x51f7('0x4a')]['id'];return _0x6e3999;});return db[_0x51f7('0x58')][_0x51f7('0x69')](_0x57d636,{'raw':!![],'transaction':_0x4a8867});});}})[_0x51f7('0x4c')](handleError(_0x4c335b,null));});}})[_0x51f7('0x2a')](function(_0x2ae75d){var _0x564633=_['map'](_0x2ae75d,function(_0xdf0225){return _0xdf0225[_0x51f7('0x55')]({'plain':!![]});});})[_0x51f7('0x2a')](respondWithResult(_0x4c335b,null))[_0x51f7('0x4c')](handleError(_0x4c335b,null));};exports[_0x51f7('0x6a')]=function(_0x6bc1c9,_0x56da1e,_0xf751d5){return db[_0x51f7('0x31')][_0x51f7('0x4b')]({'where':{'id':_0x6bc1c9[_0x51f7('0x4a')]['id']}})[_0x51f7('0x2a')](handleEntityNotFound(_0x56da1e,null))[_0x51f7('0x2a')](function(_0x29545d){if(_0x29545d){return _0x29545d[_0x51f7('0x6a')](_0x6bc1c9[_0x51f7('0x35')][_0x51f7('0x6b')]);}})[_0x51f7('0x2a')](respondWithStatusCode(_0x56da1e,null))[_0x51f7('0x4c')](handleError(_0x56da1e,null));};exports[_0x51f7('0x6c')]=function(_0x2b0634,_0x16b3ac){var _0x31bf46={};if(!_0x2b0634[_0x51f7('0x35')][_0x51f7('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x2b0634['query'][_0x51f7('0x3c')](_0x51f7('0x6e'))){_0x31bf46[_0x51f7('0x23')]=qs[_0x51f7('0x23')](_0x2b0634[_0x51f7('0x35')][_0x51f7('0x23')]);_0x31bf46['offset']=qs[_0x51f7('0x20')](_0x2b0634[_0x51f7('0x35')][_0x51f7('0x20')]);}return db[_0x51f7('0x31')][_0x51f7('0x4b')]({'where':{'id':_0x2b0634[_0x51f7('0x4a')]['id']}})[_0x51f7('0x2a')](function(_0x162730){if(!_0x162730)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x2b0634[_0x51f7('0x4a')]['id']);return db[_0x51f7('0x31')]['getResources'](_0x2b0634);})['then'](respondWithFilteredResult(_0x16b3ac,_0x31bf46))[_0x51f7('0x4c')](handleError(_0x16b3ac,null));}; \ No newline at end of file +var _0x556a=['subsections','Dashboard','push','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','includeAll','rows','catch','show','include','options','find','create','body','clone','params','get','updatedAt','crudPermissions','omit','createdAt','sequelize','transaction','findAll','autoAssociation','sectionId','userProfileId','destroy','describe','addSections','UserProfileSection','each','UserProfileResource','removeSections','ids','getSections','enabled','includes','isEmpty'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x556a,0x1dd));var _0xa556=function(_0x411e97,_0x4848d5){_0x411e97=_0x411e97-0x0;var _0x1498ad=_0x556a[_0x411e97];return _0x1498ad;};'use strict';var emlformat=require(_0xa556('0x0'));var rimraf=require(_0xa556('0x1'));var zipdir=require(_0xa556('0x2'));var jsonpatch=require(_0xa556('0x3'));var rp=require(_0xa556('0x4'));var moment=require(_0xa556('0x5'));var BPromise=require(_0xa556('0x6'));var Mustache=require(_0xa556('0x7'));var util=require(_0xa556('0x8'));var path=require('path');var sox=require(_0xa556('0x9'));var csv=require(_0xa556('0xa'));var ejs=require(_0xa556('0xb'));var fs=require('fs');var fs_extra=require(_0xa556('0xc'));var _=require(_0xa556('0xd'));var squel=require('squel');var crypto=require(_0xa556('0xe'));var jsforce=require(_0xa556('0xf'));var deskjs=require(_0xa556('0x10'));var toCsv=require(_0xa556('0xa'));var querystring=require('querystring');var Papa=require(_0xa556('0x11'));var Redis=require(_0xa556('0x12'));var authService=require(_0xa556('0x13'));var qs=require(_0xa556('0x14'));var as=require(_0xa556('0x15'));var hardwareService=require(_0xa556('0x16'));var logger=require(_0xa556('0x17'))(_0xa556('0x18'));var utils=require('../../config/utils');var config=require(_0xa556('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa556('0x1a'))['db'];config['redis']=_['defaults'](config[_0xa556('0x1b')],{'host':_0xa556('0x1c'),'port':0x18eb});var socket=require(_0xa556('0x1d'))(new Redis(config[_0xa556('0x1b')]));require('./userProfile.socket')[_0xa556('0x1e')](socket);function respondWithStatusCode(_0x10f9bc,_0x30e70a){_0x30e70a=_0x30e70a||0xcc;return function(_0x3413ef){if(_0x3413ef){return _0x10f9bc[_0xa556('0x1f')](_0x30e70a);}return _0x10f9bc['status'](_0x30e70a)['end']();};}function respondWithResult(_0xbdb988,_0x25b94f){_0x25b94f=_0x25b94f||0xc8;return function(_0x48e045){if(_0x48e045){return _0xbdb988[_0xa556('0x20')](_0x25b94f)['json'](_0x48e045);}};}function respondWithFilteredResult(_0x47b96a,_0x3738fd){return function(_0x529879){if(_0x529879){var _0x429a55=typeof _0x3738fd[_0xa556('0x21')]===_0xa556('0x22')&&typeof _0x3738fd[_0xa556('0x23')]==='undefined';var _0x452e6f=_0x529879[_0xa556('0x24')];var _0x1f3e9c=_0x429a55?0x0:_0x3738fd['offset'];var _0x1a64ef=_0x429a55?_0x529879[_0xa556('0x24')]:_0x3738fd['offset']+_0x3738fd['limit'];var _0x31c8c6;if(_0x1a64ef>=_0x452e6f){_0x1a64ef=_0x452e6f;_0x31c8c6=0xc8;}else{_0x31c8c6=0xce;}_0x47b96a[_0xa556('0x20')](_0x31c8c6);return _0x47b96a['set'](_0xa556('0x25'),_0x1f3e9c+'-'+_0x1a64ef+'/'+_0x452e6f)['json'](_0x529879);}return null;};}function patchUpdates(_0x22718a){return function(_0xf73dc4){try{jsonpatch[_0xa556('0x26')](_0xf73dc4,_0x22718a,!![]);}catch(_0x39cae2){return BPromise[_0xa556('0x27')](_0x39cae2);}return _0xf73dc4[_0xa556('0x28')]();};}function saveUpdates(_0x1bcecb,_0x26a28a){return function(_0xa43621){if(_0xa43621){return _0xa43621[_0xa556('0x29')](_0x1bcecb)[_0xa556('0x2a')](function(_0xec6fbb){return _0xec6fbb;});}return null;};}function removeEntity(_0x4bf442,_0x2ca8b6){return function(_0x1193a3){if(_0x1193a3){return _0x1193a3['destroy']()[_0xa556('0x2a')](function(){_0x4bf442[_0xa556('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3855af,_0x1906c5){return function(_0x157ac5){if(!_0x157ac5){_0x3855af['sendStatus'](0x194);}return _0x157ac5;};}function handleError(_0x1d5be1,_0x3503db){_0x3503db=_0x3503db||0x1f4;return function(_0x19f1b8){logger['error'](_0x19f1b8[_0xa556('0x2b')]);if(_0x19f1b8[_0xa556('0x2c')]){delete _0x19f1b8[_0xa556('0x2c')];}_0x1d5be1[_0xa556('0x20')](_0x3503db)[_0xa556('0x2d')](_0x19f1b8);};}exports[_0xa556('0x2e')]=function(_0x236e3b,_0x4d0a30){var _0x3446f0={},_0x51cb84={},_0x34f2cf={'count':0x0,'rows':[]};var _0x356a0c=_[_0xa556('0x2f')](db[_0xa556('0x30')][_0xa556('0x31')],function(_0x1387bc){return{'name':_0x1387bc[_0xa556('0x32')],'type':_0x1387bc['type'][_0xa556('0x33')]};});_0x51cb84[_0xa556('0x34')]=_[_0xa556('0x2f')](_0x356a0c,_0xa556('0x2c'));_0x51cb84[_0xa556('0x35')]=_[_0xa556('0x36')](_0x236e3b[_0xa556('0x35')]);_0x51cb84[_0xa556('0x37')]=_[_0xa556('0x38')](_0x51cb84['model'],_0x51cb84[_0xa556('0x35')]);_0x3446f0[_0xa556('0x39')]=_[_0xa556('0x38')](_0x51cb84['model'],qs[_0xa556('0x3a')](_0x236e3b[_0xa556('0x35')][_0xa556('0x3a')]));_0x3446f0[_0xa556('0x39')]=_0x3446f0['attributes'][_0xa556('0x3b')]?_0x3446f0['attributes']:_0x51cb84[_0xa556('0x34')];if(!_0x236e3b['query'][_0xa556('0x3c')](_0xa556('0x3d'))){_0x3446f0[_0xa556('0x23')]=qs[_0xa556('0x23')](_0x236e3b[_0xa556('0x35')]['limit']);_0x3446f0['offset']=qs[_0xa556('0x21')](_0x236e3b[_0xa556('0x35')][_0xa556('0x21')]);}_0x3446f0[_0xa556('0x3e')]=qs[_0xa556('0x3f')](_0x236e3b[_0xa556('0x35')][_0xa556('0x3f')]);_0x3446f0[_0xa556('0x40')]=qs[_0xa556('0x37')](_[_0xa556('0x41')](_0x236e3b[_0xa556('0x35')],_0x51cb84[_0xa556('0x37')]),_0x356a0c);if(_0x236e3b[_0xa556('0x35')][_0xa556('0x42')]){_0x3446f0[_0xa556('0x40')]=_['merge'](_0x3446f0[_0xa556('0x40')],{'$or':_[_0xa556('0x2f')](_0x356a0c,function(_0x3325ae){if(_0x3325ae[_0xa556('0x43')]!=='VIRTUAL'){var _0x3db529={};_0x3db529[_0x3325ae[_0xa556('0x2c')]]={'$like':'%'+_0x236e3b[_0xa556('0x35')][_0xa556('0x42')]+'%'};return _0x3db529;}})});}_0x3446f0=_[_0xa556('0x44')]({},_0x3446f0,_0x236e3b['options']);var _0x4455ba={'where':_0x3446f0[_0xa556('0x40')]};return db['UserProfile']['count'](_0x4455ba)[_0xa556('0x2a')](function(_0x544579){_0x34f2cf[_0xa556('0x24')]=_0x544579;if(_0x236e3b['query'][_0xa556('0x45')]){_0x3446f0['include']=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x3446f0);})['then'](function(_0x3c700e){_0x34f2cf[_0xa556('0x46')]=_0x3c700e;return _0x34f2cf;})['then'](respondWithFilteredResult(_0x4d0a30,_0x3446f0))[_0xa556('0x47')](handleError(_0x4d0a30,null));};exports[_0xa556('0x48')]=function(_0x5dd813,_0x4f3d9a){var _0x362900={'raw':![],'where':{'id':_0x5dd813['params']['id']}},_0x593bf6={};_0x593bf6['model']=_[_0xa556('0x36')](db[_0xa556('0x30')]['rawAttributes']);_0x593bf6[_0xa556('0x35')]=_[_0xa556('0x36')](_0x5dd813[_0xa556('0x35')]);_0x593bf6['filters']=_['intersection'](_0x593bf6[_0xa556('0x34')],_0x593bf6[_0xa556('0x35')]);_0x362900[_0xa556('0x39')]=_[_0xa556('0x38')](_0x593bf6[_0xa556('0x34')],qs[_0xa556('0x3a')](_0x5dd813['query']['fields']));_0x362900['attributes']=_0x362900[_0xa556('0x39')][_0xa556('0x3b')]?_0x362900['attributes']:_0x593bf6[_0xa556('0x34')];if(_0x5dd813['query'][_0xa556('0x45')]){_0x362900[_0xa556('0x49')]=[{'all':!![]}];}_0x362900=_[_0xa556('0x44')]({},_0x362900,_0x5dd813[_0xa556('0x4a')]);return db['UserProfile'][_0xa556('0x4b')](_0x362900)[_0xa556('0x2a')](handleEntityNotFound(_0x4f3d9a,null))[_0xa556('0x2a')](respondWithResult(_0x4f3d9a,null))[_0xa556('0x47')](handleError(_0x4f3d9a,null));};exports[_0xa556('0x4c')]=function(_0x64781a,_0x41171c){return db['UserProfile'][_0xa556('0x4c')](_0x64781a[_0xa556('0x4d')],{})['then'](respondWithResult(_0x41171c,0xc9))[_0xa556('0x47')](handleError(_0x41171c,null));};exports[_0xa556('0x4e')]=function(_0x1b0edd,_0x5c1a1d){var _0x1aceba={'where':{'id':_0x1b0edd[_0xa556('0x4f')]['id']}},_0x3203cc={};_0x3203cc[_0xa556('0x34')]=_[_0xa556('0x36')](db[_0xa556('0x30')][_0xa556('0x31')]);_0x1aceba[_0xa556('0x39')]=_[_0xa556('0x38')](_0x3203cc[_0xa556('0x34')],qs['fields'](_0x1b0edd[_0xa556('0x35')][_0xa556('0x3a')]));_0x1aceba[_0xa556('0x39')]=_0x1aceba[_0xa556('0x39')]['length']?_0x1aceba[_0xa556('0x39')]:_0x3203cc['model'];if(_0x1b0edd[_0xa556('0x35')][_0xa556('0x45')]){_0x1aceba[_0xa556('0x49')]=[{'all':!![]}];}_0x1aceba=_['merge']({},_0x1aceba,_0x1b0edd[_0xa556('0x4a')]);return db[_0xa556('0x30')][_0xa556('0x4b')](_0x1aceba)[_0xa556('0x2a')](handleEntityNotFound(_0x5c1a1d,null))['then'](function(_0x153522){if(_0x153522){var _0x5e81c6=_0x153522[_0xa556('0x50')]({'plain':!![]});_0x5e81c6=qs['omit'](_0x5e81c6,['id','createdAt',_0xa556('0x51'),_0xa556('0x52')]);_0x1b0edd[_0xa556('0x4d')]=_[_0xa556('0x53')](_0x1b0edd['body'],['id',_0xa556('0x54'),_0xa556('0x51')]);return db[_0xa556('0x55')][_0xa556('0x56')](function(_0xe0ea08){return db['UserProfile'][_0xa556('0x4c')](_[_0xa556('0x44')](_0x5e81c6,_0x1b0edd[_0xa556('0x4d')]),{'include':_0x1b0edd[_0xa556('0x35')][_0xa556('0x45')]?[{'all':!![]}]:undefined,'transaction':_0xe0ea08})[_0xa556('0x2a')](function(_0x45ce94){var _0xf3b966=_0x45ce94[_0xa556('0x50')]({'plain':!![]});return db['UserProfileSection'][_0xa556('0x57')]({'where':{'userProfileId':_0x1b0edd[_0xa556('0x4f')]['id']},'raw':!![]})[_0xa556('0x2a')](function(_0x1a4c71){if(_0x1a4c71){return BPromise['each'](_0x1a4c71,function(_0x3adc32){return new BPromise(function(_0x11608c,_0x2e0a8f){if(_0x3adc32['autoAssociation']===null||_0x3adc32[_0xa556('0x58')]===0x1)_0x11608c(null);return db['UserProfileResource'][_0xa556('0x57')]({'where':{'sectionId':_0x3adc32['id']},'raw':!![]})['then'](function(_0x309ba9){var _0x3c7f83=_[_0xa556('0x2f')](_0x309ba9,function(_0x240118){return qs[_0xa556('0x53')](_0x240118,['id',_0xa556('0x54'),_0xa556('0x51'),_0xa556('0x59')]);});_0x11608c(_0x3c7f83);})[_0xa556('0x47')](function(_0x59f8dd){_0x2e0a8f(_0x59f8dd);});})[_0xa556('0x2a')](function(_0x2ba233){var _0x575dc1=qs[_0xa556('0x53')](_0x3adc32,['id',_0xa556('0x54'),_0xa556('0x51')]);_0x575dc1[_0xa556('0x5a')]=_0xf3b966['id'];if(_0x2ba233)_0x575dc1['Resources']=_0x2ba233;return _0x575dc1;})[_0xa556('0x2a')](function(_0x133bd8){return db['UserProfileSection']['create'](_0x133bd8,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0xe0ea08});});})[_0xa556('0x2a')](function(){return _0xf3b966;});}});});});}})[_0xa556('0x2a')](respondWithResult(_0x5c1a1d,0xc9))['catch'](handleError(_0x5c1a1d,null));};exports[_0xa556('0x29')]=function(_0x216cf3,_0x557013){if(_0x216cf3[_0xa556('0x4d')]['id']){delete _0x216cf3[_0xa556('0x4d')]['id'];}return db[_0xa556('0x30')][_0xa556('0x4b')]({'where':{'id':_0x216cf3[_0xa556('0x4f')]['id']}})[_0xa556('0x2a')](handleEntityNotFound(_0x557013,null))[_0xa556('0x2a')](saveUpdates(_0x216cf3[_0xa556('0x4d')],null))[_0xa556('0x2a')](respondWithResult(_0x557013,null))['catch'](handleError(_0x557013,null));};exports[_0xa556('0x5b')]=function(_0x375526,_0x6a4c26){return db['UserProfile'][_0xa556('0x4b')]({'where':{'id':_0x375526[_0xa556('0x4f')]['id']}})[_0xa556('0x2a')](handleEntityNotFound(_0x6a4c26,null))[_0xa556('0x2a')](removeEntity(_0x6a4c26,null))['catch'](handleError(_0x6a4c26,null));};exports[_0xa556('0x5c')]=function(_0x125dfa,_0x2200ff){return db['UserProfile'][_0xa556('0x5c')]()[_0xa556('0x2a')](respondWithResult(_0x2200ff,null))[_0xa556('0x47')](handleError(_0x2200ff,null));};exports[_0xa556('0x5d')]=function(_0x38ee7a,_0x3caca8){var _0x44b387=_0x38ee7a['body'];return db[_0xa556('0x30')]['find']({'where':{'id':_0x38ee7a['params']['id']}})['then'](handleEntityNotFound(_0x3caca8,null))[_0xa556('0x2a')](function(_0x3c876d){if(_0x3c876d){return db[_0xa556('0x55')]['transaction'](function(_0x2cf8b9){return db[_0xa556('0x5e')][_0xa556('0x5b')]({'where':{'userProfileId':_0x38ee7a[_0xa556('0x4f')]['id'],'sectionId':_[_0xa556('0x2f')](_0x44b387,function(_0x3dc68d){return _0x3dc68d[_0xa556('0x59')];})},'transaction':_0x2cf8b9})['then'](function(){var _0x565f45=_[_0xa556('0x2f')](_0x44b387,function(_0x1cb96d){_0x1cb96d[_0xa556('0x5a')]=_0x38ee7a[_0xa556('0x4f')]['id'];return _0x1cb96d;});var _0x4e1209=[];return BPromise[_0xa556('0x5f')](_0x565f45,function(_0x44ae37){return db[_0xa556('0x5e')][_0xa556('0x4c')](_0x44ae37,{'include':[{'model':db[_0xa556('0x60')],'as':'Resources'}],'raw':!![],'transaction':_0x2cf8b9})['then'](function(_0x5935c9){_0x4e1209['push'](_0x5935c9['get']({'plain':!![]}));});})[_0xa556('0x2a')](function(){return _0x4e1209;});});});}})[_0xa556('0x2a')](function(_0x20eb03){return _0x20eb03;})[_0xa556('0x2a')](respondWithResult(_0x3caca8,null))['catch'](handleError(_0x3caca8,null));};exports[_0xa556('0x61')]=function(_0x58e88c,_0x8881a0){var _0x2e76dc;return db[_0xa556('0x30')]['find']({'where':{'id':_0x58e88c['params']['id']},'attributes':['id',_0xa556('0x2c')]})[_0xa556('0x2a')](handleEntityNotFound(_0x8881a0,null))[_0xa556('0x2a')](function(_0x57100f){if(_0x57100f){_0x2e76dc=_0x57100f;return db[_0xa556('0x5e')]['destroy']({'where':{'userProfileId':_0x58e88c['params']['id'],'sectionId':_0x58e88c[_0xa556('0x35')][_0xa556('0x62')]}});}})[_0xa556('0x2a')](function(){return _0x2e76dc;})['then'](respondWithStatusCode(_0x8881a0,null))[_0xa556('0x47')](handleError(_0x8881a0,null));};exports[_0xa556('0x63')]=function(_0x1070b7,_0x137285){var _0x57ca8f=[];var _0xad2235=[];return db['UserProfileSection'][_0xa556('0x57')]({'where':{'userProfileId':_0x1070b7['params']['id']},'raw':!![]})[_0xa556('0x2a')](function(_0x3b9996){_0x57ca8f=_['filter'](_0x3b9996,function(_0x1a7f42){return _0x1a7f42[_0xa556('0x64')]===0x1||_[_0xa556('0x65')]([0x3eb,0x709],_0x1a7f42['sectionId']);});if(!_[_0xa556('0x66')](_0x57ca8f)){return _[_0xa556('0x2f')](_0x57ca8f,function(_0x5ac46e){return _0x5ac46e[_0xa556('0x59')];});}else{return;}})[_0xa556('0x2a')](function(_0x14937d){if(_0x14937d)_0xad2235=_0x14937d;if(_[_0xa556('0x65')](_0xad2235,0x64)){var _0x1d3811=_[_0xa556('0x4b')](_0x57ca8f,{'sectionId':0x64});return hasDefaultDashboard(_0x1d3811)[_0xa556('0x2a')](function(_0x1d04ea){return _[_0xa556('0x2f')](_0x57ca8f,function(_0x3692e7){if(_0x3692e7[_0xa556('0x59')]===0x64){_0x3692e7[_0xa556('0x67')]=_0x1d04ea;}return _0x3692e7;});});}else{return;}})[_0xa556('0x2a')](function(_0x3539a8){if(_0x3539a8)_0x57ca8f=_0x3539a8;if(_[_0xa556('0x65')](_0xad2235,0x3eb)){var _0x50d5ac=_[_0xa556('0x4b')](_0x57ca8f,{'sectionId':0x3eb});return getCustomDashboards(_0x50d5ac)['then'](function(_0x34f7a4){return _[_0xa556('0x2f')](_0x57ca8f,function(_0x476523){if(_0x50d5ac['enabled']){if(_0x476523[_0xa556('0x59')]===0x3eb){_0x476523[_0xa556('0x67')]=_0x34f7a4;}}else{if(_0x476523[_0xa556('0x59')]===0x64){_0x476523[_0xa556('0x67')]=_0x34f7a4;}}return _0x476523;});});}else{return;}})[_0xa556('0x2a')](function(_0x293de1){if(_0x293de1)_0x57ca8f=_0x293de1;if(_[_0xa556('0x65')](_0xad2235,0x709)){var _0x1b4d3b=_[_0xa556('0x4b')](_0x57ca8f,{'sectionId':0x709});return getPlugins(_0x1b4d3b)[_0xa556('0x2a')](function(_0x2b2cad){if(_0x1b4d3b[_0xa556('0x64')]){return _[_0xa556('0x2f')](_0x57ca8f,function(_0x2a95c9){if(_0x2a95c9['sectionId']===0x709){_0x2a95c9[_0xa556('0x67')]=_0x2b2cad;}return _0x2a95c9;});}else{var _0x53c1b4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2b2cad};var _0x59566f=_[_0xa556('0x2f')](_0x57ca8f);_0x59566f['push'](_0x53c1b4);return _0x59566f;}});}else{return;}})['then'](function(_0x3a915f){if(_0x3a915f)_0x57ca8f=_0x3a915f;return _[_0xa556('0x42')](_0x57ca8f,['enabled',0x1]);})['then'](respondWithResult(_0x137285,null))[_0xa556('0x47')](handleError(_0x137285,null));};function hasDefaultDashboard(_0x214c60){var _0x1c12d3=[0x65];return new BPromise(function(_0x31a4e0,_0x39ae7a){try{if(_0x214c60['autoAssociation']){_0x31a4e0(_0x1c12d3);}else{return db[_0xa556('0x60')]['findOne']({'where':{'sectionId':_0x214c60['id']},'raw':!![]})[_0xa556('0x2a')](function(_0x3f6a8a){_0x3f6a8a?_0x31a4e0(_0x1c12d3):_0x31a4e0();});}}catch(_0x178706){_0x39ae7a(_0x178706);}});}function getCustomDashboards(_0x1a9f1a){var _0x1ff948=[];return new BPromise(function(_0x3e88a5,_0x3108d9){try{if(_0x1a9f1a[_0xa556('0x58')]){return db[_0xa556('0x68')]['findAll']({'raw':!![]})['then'](function(_0x2fc963){_0x2fc963['forEach'](function(_0x2e759e){_0x1ff948['push'](_0x2e759e['id']+0x1869f);});_0x3e88a5(_0x1ff948);});}else{return db[_0xa556('0x60')][_0xa556('0x57')]({'where':{'sectionId':_0x1a9f1a['id']},'raw':!![]})['then'](function(_0x5ac342){_0x5ac342['forEach'](function(_0x26cfb4){_0x1ff948[_0xa556('0x69')](_0x26cfb4[_0xa556('0x6a')]+0x1869f);});_0x3e88a5(_0x1ff948);});}}catch(_0x421159){_0x3108d9(_0x421159);}});}function getPlugins(_0x10643e){var _0x407fc3=[];return new BPromise(function(_0x1dfc38,_0x211cd1){try{if(_0x10643e[_0xa556('0x58')]){return db[_0xa556('0x6b')][_0xa556('0x57')]({'raw':!![]})[_0xa556('0x2a')](function(_0x4f5365){_0x4f5365[_0xa556('0x6c')](function(_0x16ae7f){_0x407fc3[_0xa556('0x69')](_0x16ae7f['id']+0x15b38);});_0x1dfc38(_0x407fc3);});}else{return db[_0xa556('0x60')][_0xa556('0x57')]({'where':{'sectionId':_0x10643e['id']},'raw':!![]})['then'](function(_0x592c36){_0x592c36[_0xa556('0x6c')](function(_0x3e023b){_0x407fc3[_0xa556('0x69')](_0x3e023b[_0xa556('0x6a')]+0x15b38);});_0x1dfc38(_0x407fc3);});}}catch(_0x553c26){_0x211cd1(_0x553c26);}});}exports[_0xa556('0x6d')]=function(_0x54374b,_0x5a8a4b){return db['UserProfile'][_0xa556('0x4b')]({'where':{'id':_0x54374b['params']['id']}})[_0xa556('0x2a')](handleEntityNotFound(_0x5a8a4b,null))['then'](function(_0x201e1c){if(_0x201e1c){return db[_0xa556('0x55')][_0xa556('0x56')](function(_0x31d9cf){return db[_0xa556('0x5e')][_0xa556('0x57')]({'where':{'userProfileId':_0x54374b[_0xa556('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0xa556('0x2a')](function(_0x46a781){if(_0x46a781){return db[_0xa556('0x5e')][_0xa556('0x5b')]({'where':{'userProfileId':_0x54374b[_0xa556('0x4f')]['id'],'id':_[_0xa556('0x2f')](_0x46a781,function(_0x2dfb12){return _0x2dfb12['id'];})},'transaction':_0x31d9cf});}})['then'](function(_0x508fe9){var _0x465b39=_[_0xa556('0x2f')](_0x54374b[_0xa556('0x4d')],function(_0x55ceef){_0x55ceef[_0xa556('0x5a')]=_0x54374b['params']['id'];return _0x55ceef;});return db[_0xa556('0x5e')]['bulkCreate'](_0x465b39,{'raw':!![],'transaction':_0x31d9cf});})[_0xa556('0x2a')](function(_0x2c25e6){var _0x5f42b2=_[_0xa556('0x42')](_[_0xa556('0x2f')](_0x2c25e6,function(_0x6aa90){return _0x6aa90[_0xa556('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x5f42b2){return db[_0xa556('0x5e')][_0xa556('0x57')]({'where':{'userProfileId':_0x54374b[_0xa556('0x4f')]['id'],'sectionId':_['map'](_0x5f42b2,function(_0x4e1050){return _0x4e1050[_0xa556('0x59')];})},'attributes':['id',_0xa556('0x59')],'raw':!![]})[_0xa556('0x2a')](function(_0x772336){var _0x10c801=_['map'](_0x54374b['body'],function(_0x1d7c68){_0x1d7c68['userProfileId']=_0x54374b[_0xa556('0x4f')]['id'];return _0x1d7c68;});return db['UserProfileResource'][_0xa556('0x6e')](_0x10c801,{'raw':!![],'transaction':_0x31d9cf});});}})[_0xa556('0x47')](handleError(_0x5a8a4b,null));});}})[_0xa556('0x2a')](function(_0x309db9){var _0x15192e=_['map'](_0x309db9,function(_0xa3a995){return _0xa3a995[_0xa556('0x50')]({'plain':!![]});});})[_0xa556('0x2a')](respondWithResult(_0x5a8a4b,null))[_0xa556('0x47')](handleError(_0x5a8a4b,null));};exports[_0xa556('0x6f')]=function(_0x3e099e,_0x3f8a44,_0x47e1be){return db['UserProfile'][_0xa556('0x4b')]({'where':{'id':_0x3e099e[_0xa556('0x4f')]['id']}})[_0xa556('0x2a')](handleEntityNotFound(_0x3f8a44,null))[_0xa556('0x2a')](function(_0x3547ac){if(_0x3547ac){return _0x3547ac[_0xa556('0x6f')](_0x3e099e['query'][_0xa556('0x62')]);}})[_0xa556('0x2a')](respondWithStatusCode(_0x3f8a44,null))['catch'](handleError(_0x3f8a44,null));};exports[_0xa556('0x70')]=function(_0x255e16,_0x1a4959){var _0x1a5eb8={};if(!_0x255e16[_0xa556('0x35')][_0xa556('0x71')])throw new Error(_0xa556('0x72'));if(!_0x255e16[_0xa556('0x35')]['hasOwnProperty']('nolimit')){_0x1a5eb8[_0xa556('0x23')]=qs[_0xa556('0x23')](_0x255e16[_0xa556('0x35')][_0xa556('0x23')]);_0x1a5eb8[_0xa556('0x21')]=qs[_0xa556('0x21')](_0x255e16['query'][_0xa556('0x21')]);}return db[_0xa556('0x30')][_0xa556('0x4b')]({'where':{'id':_0x255e16[_0xa556('0x4f')]['id']}})[_0xa556('0x2a')](function(_0xc6f3cc){if(!_0xc6f3cc)throw new Error(_0xa556('0x73')+_0x255e16[_0xa556('0x4f')]['id']);return db['UserProfile'][_0xa556('0x70')](_0x255e16);})[_0xa556('0x2a')](respondWithFilteredResult(_0x1a4959,_0x1a5eb8))['catch'](handleError(_0x1a4959,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3f0cf48..77c11ec 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 _0x5d0a=['emit','hasOwnProperty','hook','exports','events','UserProfile','save','update','remove'];(function(_0x439a4d,_0x1c0018){var _0x2025b6=function(_0x1df44b){while(--_0x1df44b){_0x439a4d['push'](_0x439a4d['shift']());}};_0x2025b6(++_0x1c0018);}(_0x5d0a,0x175));var _0xa5d0=function(_0x1956d7,_0x25639c){_0x1956d7=_0x1956d7-0x0;var _0x4d9ca2=_0x5d0a[_0x1956d7];return _0x4d9ca2;};'use strict';var EventEmitter=require(_0xa5d0('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xa5d0('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa5d0('0x2'),'afterUpdate':_0xa5d0('0x3'),'afterDestroy':_0xa5d0('0x4')};function emitEvent(_0x12f4cf){return function(_0x5b4b98,_0x24b2b5,_0x81c8f7){UserProfileEvents[_0xa5d0('0x5')](_0x12f4cf+':'+_0x5b4b98['id'],_0x5b4b98);UserProfileEvents[_0xa5d0('0x5')](_0x12f4cf,_0x5b4b98);_0x81c8f7(null);};}for(var e in events){if(events[_0xa5d0('0x6')](e)){var event=events[e];UserProfile[_0xa5d0('0x7')](e,emitEvent(event));}}module[_0xa5d0('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x33af=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x241bf7,_0x57466e){var _0x1b8ae9=function(_0xebca7b){while(--_0xebca7b){_0x241bf7['push'](_0x241bf7['shift']());}};_0x1b8ae9(++_0x57466e);}(_0x33af,0xec));var _0xf33a=function(_0x550aed,_0x1ba6cb){_0x550aed=_0x550aed-0x0;var _0x1c43a5=_0x33af[_0x550aed];return _0x1c43a5;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf33a('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf33a('0x1')](0x0);var events={'afterCreate':_0xf33a('0x2'),'afterUpdate':_0xf33a('0x3'),'afterDestroy':_0xf33a('0x4')};function emitEvent(_0x169f02){return function(_0x25f156,_0x4c734e,_0x433e25){UserProfileEvents[_0xf33a('0x5')](_0x169f02+':'+_0x25f156['id'],_0x25f156);UserProfileEvents['emit'](_0x169f02,_0x25f156);_0x433e25(null);};}for(var e in events){if(events[_0xf33a('0x6')](e)){var event=events[e];UserProfile[_0xf33a('0x7')](e,emitEvent(event));}}module[_0xf33a('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f1b9c75..556e479 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 _0x7bd0=['sounds','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','query','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','then','map','catch','field','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Schedule'];(function(_0x273ba1,_0x2ba68c){var _0x288157=function(_0x53aee0){while(--_0x53aee0){_0x273ba1['push'](_0x273ba1['shift']());}};_0x288157(++_0x2ba68c);}(_0x7bd0,0x111));var _0x07bd=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x7bd0[_0x27a3cb];return _0x54ff38;};'use strict';var _=require(_0x07bd('0x0'));var attributes=require(_0x07bd('0x1'));var qs=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));module[_0x07bd('0x4')]=function(_0x1b76fd){var _0x38f4d1=_0x1b76fd[_0x07bd('0x5')];function _0x5beba7(_0x2d7245,_0x3b4f4f){return new Promise(function(_0x38f3f1,_0x313548){if(!_0x3b4f4f)return _0x38f3f1(null);var _0x3e8349=_0x3b4f4f[_0x07bd('0x6')]?{[_0x3b4f4f[_0x07bd('0x6')]['field']]:_0x3b4f4f[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x2d7245][_0x07bd('0x7')]({'where':_0x3e8349,'raw':!![]})[_0x07bd('0x8')](function(_0x323724){_0x3b4f4f['associatedResources']=_[_0x07bd('0x9')](_0x323724,'id');_0x38f3f1(_0x3b4f4f);})[_0x07bd('0xa')](function(_0x324a46){_0x313548(_0x324a46);});});}function _0x169b07(_0x489311,_0x3a45f3){return new Promise(function(_0x313ca5,_0x1b067a){var _0x222efa=_0x489311[_0x07bd('0x6')]?{[_0x489311[_0x07bd('0x6')][_0x07bd('0xb')]]:_0x489311[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x489311['model']][_0x07bd('0x7')]({'where':_0x222efa,'raw':!![]})[_0x07bd('0x8')](function(_0x1c59c2){_0x3a45f3[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x1c59c2,function(_0x2406b0){return _0x2406b0[_0x07bd('0xd')];});_0x313ca5(_0x3a45f3);})['catch'](function(_0x418444){_0x1b067a(_0x418444);});});}function _0x505839(_0x229bf1,_0x2dd97b,_0x31655a){if(!_0x2dd97b)return Promise[_0x07bd('0xe')](null);return new Promise(function(_0x8aa645,_0x4929d6){return _0x38f4d1[_0x07bd('0xf')][_0x07bd('0x7')]({'where':{'sectionId':_0x2dd97b['id']},'raw':!![]})['then'](function(_0x3e8ec4){if(_0x229bf1[_0x07bd('0xb')]&&_0x229bf1[_0x07bd('0xb')]!=='id'){_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x109dbc){return _0x109dbc[_0x229bf1[_0x07bd('0xb')]];});}else{if(_0x31655a===_0x07bd('0x10')){_0x2dd97b[_0x07bd('0xc')]=_['map'](_0x3e8ec4,function(_0x15c0b8){return{'id':_0x15c0b8[_0x07bd('0x11')],'type':_0x15c0b8[_0x07bd('0x12')]};});}else{_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x47bd50){return _0x47bd50['resourceId'];});}}_0x8aa645(_0x2dd97b);})[_0x07bd('0xa')](function(_0x51ca22){_0x4929d6(_0x51ca22);});});}function _0x2b0dee(_0x480c9c,_0x50bd12){var _0x4165bc={'parentSections':[]};switch(_0x480c9c[_0x07bd('0x13')]()){case _0x07bd('0x14'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x16');break;case _0x07bd('0x17'):_0x4165bc['childModel']=_0x07bd('0x18');break;case _0x07bd('0x19'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1a');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x1c'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1d');break;case _0x07bd('0x1e'):_0x4165bc['childModel']=_0x07bd('0x1f');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x20'),'field':'id','foreignKey':_0x07bd('0x21')}];break;case _0x07bd('0x22'):_0x4165bc[_0x07bd('0x15')]='CmList';break;case _0x07bd('0x23'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x24');break;case _0x07bd('0x25'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x26');break;case _0x07bd('0x27'):_0x4165bc[_0x07bd('0x15')]='ChatQueue';break;case'chatwebsites':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x28');break;case _0x07bd('0x29'):_0x4165bc['childModel']=_0x07bd('0x2a');break;case _0x07bd('0x2b'):_0x4165bc[_0x07bd('0x15')]='FaxAccount';break;case'inboundroutes':case _0x07bd('0x2c'):case _0x07bd('0x2d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2e');break;case'contexts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2f');break;case _0x07bd('0x30'):_0x4165bc['childModel']=_0x07bd('0x31');break;case _0x07bd('0x32'):_0x4165bc['childModel']=_0x07bd('0x33');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x34'),'field':_0x07bd('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0x07bd('0x35'),'value':['agent']}},{'name':_0x07bd('0x36'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x37'),'model':_0x07bd('0x38'),'filter':{'field':_0x07bd('0x35'),'value':[_0x07bd('0x39')]}},{'name':_0x07bd('0x3a'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3d')]}},{'name':_0x07bd('0x3e'),'field':'name','foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3f')]}}];break;case'musiconholds':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x40');break;case _0x07bd('0x41'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x42');break;case'voiceprefixes':_0x4165bc['childModel']=_0x07bd('0x43');break;case _0x07bd('0x44'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x45');break;case'mailqueues':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x46');break;case _0x07bd('0x47'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x48');break;case _0x07bd('0x49'):_0x4165bc[_0x07bd('0x15')]='MailSubstatus';break;case _0x07bd('0x4a'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4b');break;case _0x07bd('0x4c'):_0x4165bc[_0x07bd('0x15')]='OpenchannelAccount';break;case _0x07bd('0x4d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4e');break;case _0x07bd('0x4f'):_0x4165bc[_0x07bd('0x15')]='SmsAccount';break;case _0x07bd('0x50'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x51');break;case _0x07bd('0x52'):_0x4165bc['childModel']='WhatsappAccount';break;case _0x07bd('0x53'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x54');break;case _0x07bd('0x55'):case _0x07bd('0x56'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x3c');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x3a')},{'name':'QueueCampaigns'}];}break;case'users':case _0x07bd('0x57'):case _0x07bd('0x58'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x38');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x59'),'filter':{'field':'role','value':[_0x07bd('0x5a'),_0x07bd('0x5b')]},'ignore':!![]},{'name':_0x07bd('0x34')},{'name':_0x07bd('0x36')}];}break;case _0x07bd('0x5c'):_0x4165bc[_0x07bd('0x15')]='ZendeskAccount';break;case _0x07bd('0x5d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x5e');break;case _0x07bd('0x5f'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x60');break;case _0x07bd('0x61'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x62');break;case _0x07bd('0x63'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x64');break;case'zohoaccounts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x65');break;case _0x07bd('0x66'):_0x4165bc['childModel']='User';break;case _0x07bd('0x67'):_0x4165bc['childModel']=_0x07bd('0x68');break;case _0x07bd('0x69'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6a');break;case _0x07bd('0x6b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6c');break;case _0x07bd('0x6d'):_0x4165bc['childModel']=_0x07bd('0x6e');break;case _0x07bd('0x6f'):_0x4165bc[_0x07bd('0x15')]='Pause';break;case'scheduler':_0x4165bc['childModel']=_0x07bd('0x70');break;case _0x07bd('0x71'):_0x4165bc[_0x07bd('0x15')]='Sound';break;case _0x07bd('0x72'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x73');break;case _0x07bd('0x74'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x75');break;case'triggers':_0x4165bc['childModel']=_0x07bd('0x76');break;case'trunks':_0x4165bc['childModel']=_0x07bd('0x77');break;case _0x07bd('0x78'):_0x4165bc[_0x07bd('0x15')]='Variable';break;case _0x07bd('0x79'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x7a');break;case _0x07bd('0x7b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x10');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x7c'),'field':'id','foreignKey':_0x07bd('0x7d')}];break;case'metrics':_0x4165bc[_0x07bd('0x15')]='AnalyticMetric';break;}return _0x4165bc;}function _0x304796(_0x41fa36,_0x2b7907){var _0x4944e3=_0x41fa36[_0x07bd('0x7e')](0x0)['toUpperCase']()+_0x41fa36[_0x07bd('0x7f')](0x1);var _0x2ff31c={'type':_0x38f4d1[_0x07bd('0x80')][_0x07bd('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x5dc6f6,_0x135e4e){var _0x5e4670=squel[_0x07bd('0x82')]()[_0x07bd('0xb')](_0x07bd('0x83')+_0x4944e3+_0x07bd('0x84'),'id')[_0x07bd('0xb')](_0x07bd('0x85'))['from'](_0x07bd('0x86')+_0x41fa36+_0x07bd('0x87'),'ui')[_0x07bd('0x88')](_0x07bd('0x89'),_0x2b7907['id']);return _0x38f4d1[_0x07bd('0x8a')]['query'](_0x5e4670[_0x07bd('0x8b')](),_0x2ff31c)[_0x07bd('0x8')](function(_0x278df2){_0x2b7907[_0x4944e3+'OpenTabs']=_0x278df2;_0x5dc6f6(_0x278df2);})[_0x07bd('0xa')](function(_0x585f90){_0x135e4e(_0x585f90);});});}return _0x1b76fd[_0x07bd('0x8c')](_0x07bd('0x8d'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x598367){var _0x34005e={'raw':![],'where':{}};var _0x1b5b4b={};var _0x2986c2={'count':0x0,'rows':[]};var _0x7c7408=_0x598367[_0x07bd('0x8e')]['section'];var _0x145482=_0x598367['query'][_0x07bd('0x8f')]||![];var _0x53b975=_0x2b0dee(_0x7c7408,_0x145482);if(!_0x53b975[_0x07bd('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x7c7408+'\x27');var _0x5419d1=[{'name':_0x7c7408}];if(!_[_0x07bd('0x90')](_0x53b975[_0x07bd('0x1b')]))_0x5419d1=_0x53b975[_0x07bd('0x1b')];var _0x14bcaf=[];for(var _0x475039=0x0;_0x475039<_0x5419d1[_0x07bd('0x91')];_0x475039++){_0x14bcaf[_0x07bd('0x92')](_0x38f4d1[_0x07bd('0x93')][_0x07bd('0x94')]({'where':{'userProfileId':_0x598367[_0x07bd('0x95')]['id'],'name':_0x5419d1[_0x475039]['name']},'raw':!![]}));}return Promise[_0x07bd('0x96')](_0x14bcaf)['then'](function(_0x43bcec){var _0x39360b=_[_0x07bd('0x6')](_0x43bcec,function(_0x5855e7){return _0x5855e7?_0x5855e7:undefined;});var _0x523cb0=_[_0x07bd('0x6')](_0x5419d1,[_0x07bd('0x97'),!![]]);var _0x3f7194=_[_0x07bd('0x90')](_0x39360b)&&_[_0x07bd('0x90')](_0x523cb0)?null:_[_0x07bd('0x98')](_0x523cb0,_0x39360b);if(!_0x3f7194)return null;var _0x4e630c=[];for(var _0xf256e1=0x0;_0xf256e1<_0x3f7194[_0x07bd('0x91')];_0xf256e1++){var _0x6bf34b=_['find'](_0x5419d1,function(_0x29a452){return _0x3f7194[_0xf256e1]?_0x29a452[_0x07bd('0xd')]===_0x3f7194[_0xf256e1][_0x07bd('0xd')]:null;});if(_0x6bf34b){if(_0x3f7194[_0xf256e1][_0x07bd('0x97')]){_0x4e630c['push'](_0x5beba7(_0x53b975[_0x07bd('0x15')],_0x3f7194[_0xf256e1]));}else{if(!_0x3f7194[_0xf256e1][_0x07bd('0x99')]){_0x4e630c[_0x07bd('0x92')](_0x505839(_0x6bf34b,_0x3f7194[_0xf256e1],_0x53b975[_0x07bd('0x15')]));}else{if(_0x6bf34b['model']){_0x4e630c[_0x07bd('0x92')](_0x169b07(_0x6bf34b,_0x3f7194[_0xf256e1]));}}}}}return Promise['all'](_0x4e630c);})[_0x07bd('0x8')](function(_0x15be68){var _0x128c30=_0x15be68;var _0x1968cd=null;if(_0x128c30){_0x1968cd=_0x128c30['length']===0x1?_0x128c30[0x0]:null;}if(!_0x1968cd&&!_0x128c30)return _0x2986c2;var _0x3e512e=_0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x9a')];_0x1b5b4b[_0x07bd('0x9b')]=_[_0x07bd('0x9c')](_0x3e512e);_0x1b5b4b[_0x07bd('0x8e')]=_[_0x07bd('0x9c')](_0x598367['query']);_0x1b5b4b[_0x07bd('0x9d')]=_[_0x07bd('0x9e')](_0x1b5b4b[_0x07bd('0x9b')],_0x1b5b4b[_0x07bd('0x8e')]);_0x34005e[_0x07bd('0x9f')]=_['intersection'](_0x1b5b4b[_0x07bd('0x9b')],qs[_0x07bd('0xa0')](_0x598367[_0x07bd('0x8e')]['fields']));_0x34005e[_0x07bd('0x9f')]=_0x34005e[_0x07bd('0x9f')][_0x07bd('0x91')]?_0x34005e[_0x07bd('0x9f')]:_0x1b5b4b[_0x07bd('0x9b')];if(!_0x598367['query']['hasOwnProperty'](_0x07bd('0xa1'))){_0x34005e[_0x07bd('0xa2')]=qs[_0x07bd('0xa2')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa2')]);_0x34005e[_0x07bd('0xa3')]=qs[_0x07bd('0xa3')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa3')]);}_0x34005e['order']=qs[_0x07bd('0xa4')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa4')]);_0x34005e[_0x07bd('0x88')]=qs[_0x07bd('0x9d')](_['pick'](_0x598367[_0x07bd('0x8e')],_0x1b5b4b['filters']));if(_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]){_0x34005e['where']=_[_0x07bd('0xa5')](_0x34005e['where'],{'$or':_['map'](_0x3e512e,function(_0x18a2b0){if(_0x18a2b0[_0x07bd('0x12')][_0x07bd('0xa6')]!==_0x07bd('0xa7')){var _0x1d64b0={};_0x1d64b0[_0x18a2b0['field']]={'$like':'%'+_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]+'%'};return _0x1d64b0;}})});}var _0x193c87=[];var _0x591fc3=null;var _0x9b9402={};if(_0x1968cd){_0x591fc3=_[_0x07bd('0x94')](_0x5419d1,['name',_0x1968cd[_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};if(_0x53b975['childModel']===_0x07bd('0x10')){_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_[_0x07bd('0x9')](_0x1968cd[_0x07bd('0xc')],'id');}else{_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x1968cd[_0x07bd('0xc')];}_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{_0x34005e[_0x07bd('0x88')]['id']=_0x1968cd['associatedResources'];}}else{for(var _0x780517=0x0;_0x780517<_0x128c30[_0x07bd('0x91')];_0x780517++){_0x591fc3=_['find'](_0x5419d1,[_0x07bd('0xd'),_0x128c30[_0x780517][_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x128c30[_0x780517]['associatedResources'];_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{if(!_0x34005e[_0x07bd('0x88')]['id'])_0x34005e[_0x07bd('0x88')]['id']=[];_0x128c30[_0x780517][_0x07bd('0xc')]['forEach'](function(_0x15a175){_0x34005e[_0x07bd('0x88')]['id'][_0x07bd('0x92')](_0x15a175);});}}}if(!_[_0x07bd('0x90')](_0x193c87)){_0x34005e[_0x07bd('0x88')]=_[_0x07bd('0xa5')](_0x34005e[_0x07bd('0x88')],{'$and':{'$or':_0x193c87}});}_0x34005e=_[_0x07bd('0xa5')]({},_0x34005e,_0x598367[_0x07bd('0xa9')]);if(_0x1968cd&&!_0x1968cd[_0x07bd('0x99')]&&_0x53b975[_0x07bd('0x15')]===_0x07bd('0x10')){if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e)[_0x07bd('0x8')](function(_0x5811ef){var _0x578808=[];_0x5811ef[_0x07bd('0xac')](function(_0x2aeceb){var _0x2704c7;switch(_0x2aeceb[_0x07bd('0xad')]){case _0x07bd('0xae'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x3727d7){return _0x3727d7['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x3727d7['type']===_0x07bd('0xaf');});break;case _0x07bd('0xb0'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x25658e){return _0x25658e['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x25658e[_0x07bd('0x12')]===_0x07bd('0xb1');});break;}if(_0x2704c7)_0x578808[_0x07bd('0x92')](_0x2aeceb);});_0x2986c2[_0x07bd('0xb2')]=_0x578808[_0x07bd('0x91')];_0x2986c2[_0x07bd('0xb3')]=_0x578808;return _0x2986c2;});}else{return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0xb2')]({'where':_0x34005e[_0x07bd('0x88')]})[_0x07bd('0x8')](function(_0x28b036){_0x2986c2[_0x07bd('0xb2')]=_0x28b036;if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){if(_0x53b975[_0x07bd('0x15')]===_0x07bd('0x1f')){_0x34005e['include']=[{'model':_0x38f4d1[_0x07bd('0x73')],'as':_0x07bd('0xb4'),'attributes':['id','name',_0x07bd('0xb5')],'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]},{'model':_0x38f4d1['Tag'],'as':_0x07bd('0xb7'),'attributes':['id',_0x07bd('0xd'),'color'],'through':_0x598367[_0x07bd('0x8e')][_0x07bd('0xb6')]?{'attributes':[],'where':{'TagId':_0x598367['query'][_0x07bd('0xb6')]||undefined}}:{},'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]}];}else{_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e);})[_0x07bd('0x8')](function(_0x3f8539){_0x2986c2[_0x07bd('0xb3')]=_0x3f8539;if(_0x7c7408==='Agents'&&_0x598367['query'][_0x07bd('0xb8')]===_0x07bd('0xb9')){var _0x3bf215=[];for(var _0x1c2766=0x0;_0x1c2766<_0x2986c2[_0x07bd('0xb3')][_0x07bd('0x91')];_0x1c2766++){_0x3bf215['push'](_0x304796(_0x07bd('0xba'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xbc'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbd'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbe'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbf'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xc0'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));}return Promise['all'](_0x3bf215)[_0x07bd('0x8')](function(){return _0x2986c2;});}return _0x2986c2;});}});}}});}; \ No newline at end of file +var _0xbff5=['metrics','AnalyticMetric','toUpperCase','QueryTypes','select','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','params','all','ignore','union','find','model','length','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','DefaultReports','custom','CustomReports','count','rows','includeAll','include','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','map','catch','then','name','resolve','UserProfileResource','AnalyticExtractedReport','associatedResources','resourceId','type','toLowerCase','SquareProject','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','Lists','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','inbound','VoiceQueue','outbound','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','voicequeues','QueueCampaigns','users','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','templates','Template','triggers','Trigger','trunks','Trunk','variables','extractedreports','Reports','reportId'];(function(_0x1a681b,_0x20b25e){var _0x24645e=function(_0x54ad39){while(--_0x54ad39){_0x1a681b['push'](_0x1a681b['shift']());}};_0x24645e(++_0x20b25e);}(_0xbff5,0x1bc));var _0x5bff=function(_0x4ba64d,_0x1c571e){_0x4ba64d=_0x4ba64d-0x0;var _0x942b98=_0xbff5[_0x4ba64d];return _0x942b98;};'use strict';var _=require(_0x5bff('0x0'));var attributes=require(_0x5bff('0x1'));var qs=require(_0x5bff('0x2'));var squel=require(_0x5bff('0x3'));module[_0x5bff('0x4')]=function(_0x43a41b){var _0x3bd90c=_0x43a41b['models'];function _0x3868ae(_0x486083,_0x4c567d){return new Promise(function(_0x16ed7b,_0x1d8650){if(!_0x4c567d)return _0x16ed7b(null);var _0x151add=_0x4c567d[_0x5bff('0x5')]?{[_0x4c567d[_0x5bff('0x5')][_0x5bff('0x6')]]:_0x4c567d[_0x5bff('0x5')][_0x5bff('0x7')]}:undefined;return _0x3bd90c[_0x486083][_0x5bff('0x8')]({'where':_0x151add,'raw':!![]})['then'](function(_0x20e26f){_0x4c567d['associatedResources']=_[_0x5bff('0x9')](_0x20e26f,'id');_0x16ed7b(_0x4c567d);})[_0x5bff('0xa')](function(_0x4fc146){_0x1d8650(_0x4fc146);});});}function _0x3e72e9(_0x5aff6f,_0x784785){return new Promise(function(_0x4ff164,_0x207835){var _0x135003=_0x5aff6f['filter']?{[_0x5aff6f[_0x5bff('0x5')]['field']]:_0x5aff6f[_0x5bff('0x5')][_0x5bff('0x7')]}:undefined;return _0x3bd90c[_0x5aff6f['model']][_0x5bff('0x8')]({'where':_0x135003,'raw':!![]})[_0x5bff('0xb')](function(_0x5b0d2d){_0x784785['associatedResources']=_[_0x5bff('0x9')](_0x5b0d2d,function(_0x1d300e){return _0x1d300e[_0x5bff('0xc')];});_0x4ff164(_0x784785);})['catch'](function(_0x2d22ab){_0x207835(_0x2d22ab);});});}function _0x4612ec(_0xcb8995,_0x56c7b2,_0x3ffbbc){if(!_0x56c7b2)return Promise[_0x5bff('0xd')](null);return new Promise(function(_0x38daa0,_0x546351){return _0x3bd90c[_0x5bff('0xe')][_0x5bff('0x8')]({'where':{'sectionId':_0x56c7b2['id']},'raw':!![]})[_0x5bff('0xb')](function(_0x32cf60){if(_0xcb8995['field']&&_0xcb8995[_0x5bff('0x6')]!=='id'){_0x56c7b2['associatedResources']=_[_0x5bff('0x9')](_0x32cf60,function(_0x4d0111){return _0x4d0111[_0xcb8995[_0x5bff('0x6')]];});}else{if(_0x3ffbbc===_0x5bff('0xf')){_0x56c7b2[_0x5bff('0x10')]=_[_0x5bff('0x9')](_0x32cf60,function(_0x12d018){return{'id':_0x12d018[_0x5bff('0x11')],'type':_0x12d018[_0x5bff('0x12')]};});}else{_0x56c7b2[_0x5bff('0x10')]=_[_0x5bff('0x9')](_0x32cf60,function(_0x490bc1){return _0x490bc1[_0x5bff('0x11')];});}}_0x38daa0(_0x56c7b2);})[_0x5bff('0xa')](function(_0x4369b0){_0x546351(_0x4369b0);});});}function _0x1e7f8a(_0x352b1f,_0x31d26b){var _0x3913fd={'parentSections':[]};switch(_0x352b1f[_0x5bff('0x13')]()){case'squareprojects':_0x3913fd['childModel']=_0x5bff('0x14');break;case'odbc':_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x16');break;case _0x5bff('0x17'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x18');_0x3913fd[_0x5bff('0x19')]=[{'name':_0x5bff('0x1a'),'field':_0x5bff('0xc'),'foreignKey':'projectName'}];break;case'projects':_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x1b');break;case'contacts':_0x3913fd[_0x5bff('0x15')]='CmContact';_0x3913fd['parentSections']=[{'name':_0x5bff('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0x5bff('0x1d'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x1e');break;case _0x5bff('0x1f'):_0x3913fd['childModel']=_0x5bff('0x20');break;case'globalcustomfields':_0x3913fd[_0x5bff('0x15')]='CmCustomField';break;case _0x5bff('0x21'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x22');break;case _0x5bff('0x23'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x24');break;case'faxqueues':_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x25');break;case _0x5bff('0x26'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x27');break;case _0x5bff('0x28'):case _0x5bff('0x29'):case _0x5bff('0x2a'):_0x3913fd['childModel']=_0x5bff('0x2b');break;case _0x5bff('0x2c'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x2d');break;case'voicemails':_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x2e');break;case'voicerecordings':_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x2f');_0x3913fd[_0x5bff('0x19')]=[{'name':_0x5bff('0x30'),'field':'name','foreignKey':_0x5bff('0x31'),'model':_0x5bff('0x32'),'filter':{'field':_0x5bff('0x33'),'value':['agent']}},{'name':_0x5bff('0x34'),'field':'name','foreignKey':_0x5bff('0x31'),'model':_0x5bff('0x32'),'filter':{'field':_0x5bff('0x33'),'value':['telephone']}},{'name':_0x5bff('0x35'),'field':_0x5bff('0xc'),'foreignKey':_0x5bff('0x36'),'model':'VoiceQueue','filter':{'field':_0x5bff('0x12'),'value':[_0x5bff('0x37')]}},{'name':'QueueCampaigns','field':_0x5bff('0xc'),'foreignKey':_0x5bff('0x36'),'model':_0x5bff('0x38'),'filter':{'field':_0x5bff('0x12'),'value':[_0x5bff('0x39')]}}];break;case'musiconholds':_0x3913fd[_0x5bff('0x15')]='VoiceMusicOnHold';break;case _0x5bff('0x3a'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x3b');break;case _0x5bff('0x3c'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x3d');break;case _0x5bff('0x3e'):_0x3913fd['childModel']='Campaign';break;case _0x5bff('0x3f'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x40');break;case _0x5bff('0x41'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x42');break;case _0x5bff('0x43'):_0x3913fd[_0x5bff('0x15')]='MailSubstatus';break;case _0x5bff('0x44'):_0x3913fd['childModel']=_0x5bff('0x45');break;case _0x5bff('0x46'):_0x3913fd['childModel']=_0x5bff('0x47');break;case _0x5bff('0x48'):_0x3913fd['childModel']=_0x5bff('0x49');break;case _0x5bff('0x4a'):_0x3913fd[_0x5bff('0x15')]='SmsAccount';break;case _0x5bff('0x4b'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x4c');break;case'whatsappaccounts':_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x4d');break;case _0x5bff('0x4e'):_0x3913fd[_0x5bff('0x15')]='Team';break;case _0x5bff('0x4f'):case'queuecampaigns':_0x3913fd['childModel']=_0x5bff('0x38');if(_0x31d26b){_0x3913fd[_0x5bff('0x19')]=[{'name':'VoiceQueues'},{'name':_0x5bff('0x50')}];}break;case _0x5bff('0x51'):case'agents':case _0x5bff('0x52'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x32');if(_0x31d26b){_0x3913fd[_0x5bff('0x19')]=[{'name':'Users','filter':{'field':_0x5bff('0x33'),'value':[_0x5bff('0x53'),_0x5bff('0x54')]},'ignore':!![]},{'name':_0x5bff('0x30')},{'name':_0x5bff('0x34')}];}break;case _0x5bff('0x55'):_0x3913fd['childModel']=_0x5bff('0x56');break;case _0x5bff('0x57'):_0x3913fd['childModel']=_0x5bff('0x58');break;case'freshdeskaccounts':_0x3913fd['childModel']='FreshdeskAccount';break;case _0x5bff('0x59'):_0x3913fd[_0x5bff('0x15')]='SugarcrmAccount';break;case _0x5bff('0x5a'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x5b');break;case _0x5bff('0x5c'):_0x3913fd[_0x5bff('0x15')]='ZohoAccount';break;case _0x5bff('0x5d'):_0x3913fd[_0x5bff('0x15')]='User';break;case _0x5bff('0x5e'):_0x3913fd['childModel']=_0x5bff('0x5f');break;case _0x5bff('0x60'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x61');break;case _0x5bff('0x62'):_0x3913fd['childModel']=_0x5bff('0x63');break;case _0x5bff('0x64'):_0x3913fd['childModel']=_0x5bff('0x65');break;case _0x5bff('0x66'):_0x3913fd['childModel']=_0x5bff('0x67');break;case _0x5bff('0x68'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x69');break;case _0x5bff('0x6a'):_0x3913fd[_0x5bff('0x15')]='Sound';break;case'tags':_0x3913fd[_0x5bff('0x15')]='Tag';break;case _0x5bff('0x6b'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x6c');break;case _0x5bff('0x6d'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x6e');break;case _0x5bff('0x6f'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x70');break;case _0x5bff('0x71'):_0x3913fd[_0x5bff('0x15')]='Variable';break;case'plugins':_0x3913fd[_0x5bff('0x15')]='Plugin';break;case _0x5bff('0x72'):_0x3913fd['childModel']=_0x5bff('0xf');_0x3913fd[_0x5bff('0x19')]=[{'name':_0x5bff('0x73'),'field':'id','foreignKey':_0x5bff('0x74')}];break;case _0x5bff('0x75'):_0x3913fd[_0x5bff('0x15')]=_0x5bff('0x76');break;}return _0x3913fd;}function _0x29c369(_0x3ce188,_0x34cc30){var _0x1470bc=_0x3ce188['charAt'](0x0)[_0x5bff('0x77')]()+_0x3ce188['slice'](0x1);var _0x54faf2={'type':_0x3bd90c['Sequelize'][_0x5bff('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0xb800d9,_0x17d6f2){var _0x3b1498=squel[_0x5bff('0x79')]()['field']('ui.'+_0x1470bc+'InteractionId','id')[_0x5bff('0x6')](_0x5bff('0x7a'))['from'](_0x5bff('0x7b')+_0x3ce188+_0x5bff('0x7c'),'ui')[_0x5bff('0x7d')](_0x5bff('0x7e'),_0x34cc30['id']);return _0x3bd90c[_0x5bff('0x7f')][_0x5bff('0x80')](_0x3b1498[_0x5bff('0x81')](),_0x54faf2)[_0x5bff('0xb')](function(_0x39a0a8){_0x34cc30[_0x1470bc+_0x5bff('0x82')]=_0x39a0a8;_0xb800d9(_0x39a0a8);})[_0x5bff('0xa')](function(_0x3d978a){_0x17d6f2(_0x3d978a);});});}return _0x43a41b[_0x5bff('0x83')](_0x5bff('0x84'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3134de){var _0x295ae9={'raw':![],'where':{}};var _0x3cc50c={};var _0x13980a={'count':0x0,'rows':[]};var _0x3ae675=_0x3134de[_0x5bff('0x80')][_0x5bff('0x85')];var _0x2cb909=_0x3134de[_0x5bff('0x80')][_0x5bff('0x86')]||![];var _0xc9557e=_0x1e7f8a(_0x3ae675,_0x2cb909);if(!_0xc9557e[_0x5bff('0x15')])throw new Error(_0x5bff('0x87')+_0x3ae675+'\x27');var _0x4d3e37=[{'name':_0x3ae675}];if(!_[_0x5bff('0x88')](_0xc9557e[_0x5bff('0x19')]))_0x4d3e37=_0xc9557e[_0x5bff('0x19')];var _0x449245=[];for(var _0x8a6f48=0x0;_0x8a6f48<_0x4d3e37['length'];_0x8a6f48++){_0x449245[_0x5bff('0x89')](_0x3bd90c[_0x5bff('0x8a')]['find']({'where':{'userProfileId':_0x3134de[_0x5bff('0x8b')]['id'],'name':_0x4d3e37[_0x8a6f48][_0x5bff('0xc')]},'raw':!![]}));}return Promise[_0x5bff('0x8c')](_0x449245)['then'](function(_0x35198d){var _0x160c16=_[_0x5bff('0x5')](_0x35198d,function(_0x3bf744){return _0x3bf744?_0x3bf744:undefined;});var _0xccd432=_[_0x5bff('0x5')](_0x4d3e37,[_0x5bff('0x8d'),!![]]);var _0x1cb7a9=_[_0x5bff('0x88')](_0x160c16)&&_[_0x5bff('0x88')](_0xccd432)?null:_[_0x5bff('0x8e')](_0xccd432,_0x160c16);if(!_0x1cb7a9)return null;var _0x481ab=[];for(var _0x539224=0x0;_0x539224<_0x1cb7a9['length'];_0x539224++){var _0x41a9fa=_[_0x5bff('0x8f')](_0x4d3e37,function(_0x1bed0d){return _0x1cb7a9[_0x539224]?_0x1bed0d['name']===_0x1cb7a9[_0x539224][_0x5bff('0xc')]:null;});if(_0x41a9fa){if(_0x1cb7a9[_0x539224]['ignore']){_0x481ab['push'](_0x3868ae(_0xc9557e[_0x5bff('0x15')],_0x1cb7a9[_0x539224]));}else{if(!_0x1cb7a9[_0x539224]['autoAssociation']){_0x481ab['push'](_0x4612ec(_0x41a9fa,_0x1cb7a9[_0x539224],_0xc9557e[_0x5bff('0x15')]));}else{if(_0x41a9fa[_0x5bff('0x90')]){_0x481ab['push'](_0x3e72e9(_0x41a9fa,_0x1cb7a9[_0x539224]));}}}}}return Promise[_0x5bff('0x8c')](_0x481ab);})[_0x5bff('0xb')](function(_0x1cd478){var _0x1f0bb=_0x1cd478;var _0x1de719=null;if(_0x1f0bb){_0x1de719=_0x1f0bb[_0x5bff('0x91')]===0x1?_0x1f0bb[0x0]:null;}if(!_0x1de719&&!_0x1f0bb)return _0x13980a;var _0x177816=_0x3bd90c[_0xc9557e[_0x5bff('0x15')]][_0x5bff('0x92')];_0x3cc50c[_0x5bff('0x90')]=_[_0x5bff('0x93')](_0x177816);_0x3cc50c[_0x5bff('0x80')]=_[_0x5bff('0x93')](_0x3134de[_0x5bff('0x80')]);_0x3cc50c[_0x5bff('0x94')]=_[_0x5bff('0x95')](_0x3cc50c[_0x5bff('0x90')],_0x3cc50c[_0x5bff('0x80')]);_0x295ae9[_0x5bff('0x96')]=_[_0x5bff('0x95')](_0x3cc50c[_0x5bff('0x90')],qs['fields'](_0x3134de[_0x5bff('0x80')][_0x5bff('0x97')]));_0x295ae9['attributes']=_0x295ae9[_0x5bff('0x96')]['length']?_0x295ae9[_0x5bff('0x96')]:_0x3cc50c[_0x5bff('0x90')];if(!_0x3134de['query'][_0x5bff('0x98')](_0x5bff('0x99'))){_0x295ae9[_0x5bff('0x9a')]=qs[_0x5bff('0x9a')](_0x3134de[_0x5bff('0x80')][_0x5bff('0x9a')]);_0x295ae9[_0x5bff('0x9b')]=qs[_0x5bff('0x9b')](_0x3134de[_0x5bff('0x80')][_0x5bff('0x9b')]);}_0x295ae9[_0x5bff('0x9c')]=qs['sort'](_0x3134de[_0x5bff('0x80')][_0x5bff('0x9d')]);_0x295ae9['where']=qs[_0x5bff('0x94')](_[_0x5bff('0x9e')](_0x3134de[_0x5bff('0x80')],_0x3cc50c[_0x5bff('0x94')]));if(_0x3134de[_0x5bff('0x80')][_0x5bff('0x5')]){_0x295ae9[_0x5bff('0x7d')]=_[_0x5bff('0x9f')](_0x295ae9['where'],{'$or':_['map'](_0x177816,function(_0x114d4b){if(_0x114d4b['type'][_0x5bff('0xa0')]!==_0x5bff('0xa1')){var _0x3834c8={};_0x3834c8[_0x114d4b['field']]={'$like':'%'+_0x3134de[_0x5bff('0x80')][_0x5bff('0x5')]+'%'};return _0x3834c8;}})});}var _0x434837=[];var _0x44456c=null;var _0x294f05={};if(_0x1de719){_0x44456c=_[_0x5bff('0x8f')](_0x4d3e37,['name',_0x1de719[_0x5bff('0xc')]]);if(_0x44456c[_0x5bff('0x6')]){_0x294f05={};if(_0xc9557e[_0x5bff('0x15')]===_0x5bff('0xf')){_0x294f05[_0x44456c['foreignKey']]=_[_0x5bff('0x9')](_0x1de719['associatedResources'],'id');}else{_0x294f05[_0x44456c[_0x5bff('0xa2')]]=_0x1de719[_0x5bff('0x10')];}_0x434837[_0x5bff('0x89')](_0x294f05);}else{_0x295ae9[_0x5bff('0x7d')]['id']=_0x1de719[_0x5bff('0x10')];}}else{for(var _0x135200=0x0;_0x135200<_0x1f0bb[_0x5bff('0x91')];_0x135200++){_0x44456c=_['find'](_0x4d3e37,[_0x5bff('0xc'),_0x1f0bb[_0x135200]['name']]);if(_0x44456c['field']){_0x294f05={};_0x294f05[_0x44456c[_0x5bff('0xa2')]]=_0x1f0bb[_0x135200][_0x5bff('0x10')];_0x434837['push'](_0x294f05);}else{if(!_0x295ae9['where']['id'])_0x295ae9[_0x5bff('0x7d')]['id']=[];_0x1f0bb[_0x135200][_0x5bff('0x10')][_0x5bff('0xa3')](function(_0xe95398){_0x295ae9['where']['id'][_0x5bff('0x89')](_0xe95398);});}}}if(!_['isEmpty'](_0x434837)){_0x295ae9[_0x5bff('0x7d')]=_[_0x5bff('0x9f')](_0x295ae9[_0x5bff('0x7d')],{'$and':{'$or':_0x434837}});}_0x295ae9=_['merge']({},_0x295ae9,_0x3134de[_0x5bff('0xa4')]);if(_0x1de719&&!_0x1de719['autoAssociation']&&_0xc9557e[_0x5bff('0x15')]===_0x5bff('0xf')){if(_0x3134de[_0x5bff('0x80')]['includeAll']){_0x295ae9['include']=[{'all':!![]}];}return _0x3bd90c[_0xc9557e[_0x5bff('0x15')]][_0x5bff('0x8')](_0x295ae9)[_0x5bff('0xb')](function(_0x2bfdbc){var _0x440c52=[];_0x2bfdbc[_0x5bff('0xa3')](function(_0x4641a8){var _0x315aba;switch(_0x4641a8[_0x5bff('0xa5')]){case'default':_0x315aba=_[_0x5bff('0x8f')](_0x1de719[_0x5bff('0x10')],function(_0x3f232b){return _0x3f232b['id']===_0x4641a8['reportId']&&_0x3f232b['type']===_0x5bff('0xa6');});break;case _0x5bff('0xa7'):_0x315aba=_['find'](_0x1de719['associatedResources'],function(_0x1860b1){return _0x1860b1['id']===_0x4641a8['reportId']&&_0x1860b1[_0x5bff('0x12')]===_0x5bff('0xa8');});break;}if(_0x315aba)_0x440c52[_0x5bff('0x89')](_0x4641a8);});_0x13980a[_0x5bff('0xa9')]=_0x440c52['length'];_0x13980a[_0x5bff('0xaa')]=_0x440c52;return _0x13980a;});}else{return _0x3bd90c[_0xc9557e['childModel']][_0x5bff('0xa9')]({'where':_0x295ae9[_0x5bff('0x7d')]})[_0x5bff('0xb')](function(_0x272926){_0x13980a[_0x5bff('0xa9')]=_0x272926;if(_0x3134de['query'][_0x5bff('0xab')]){if(_0xc9557e[_0x5bff('0x15')]==='CmContact'){_0x295ae9[_0x5bff('0xac')]=[{'model':_0x3bd90c[_0x5bff('0xad')],'as':_0x5bff('0xae'),'attributes':['id',_0x5bff('0xc'),_0x5bff('0xaf')],'required':_0x3134de['query'][_0x5bff('0xb0')]?!![]:![]},{'model':_0x3bd90c[_0x5bff('0xad')],'as':_0x5bff('0xb1'),'attributes':['id',_0x5bff('0xc'),_0x5bff('0xaf')],'through':_0x3134de[_0x5bff('0x80')]['tag']?{'attributes':[],'where':{'TagId':_0x3134de[_0x5bff('0x80')]['tag']||undefined}}:{},'required':_0x3134de[_0x5bff('0x80')][_0x5bff('0xb0')]?!![]:![]}];}else{_0x295ae9[_0x5bff('0xac')]=[{'all':!![]}];}}return _0x3bd90c[_0xc9557e[_0x5bff('0x15')]][_0x5bff('0x8')](_0x295ae9);})[_0x5bff('0xb')](function(_0x331810){_0x13980a[_0x5bff('0xaa')]=_0x331810;if(_0x3ae675===_0x5bff('0x30')&&_0x3134de[_0x5bff('0x80')][_0x5bff('0xb2')]===_0x5bff('0xb3')){var _0x40de11=[];for(var _0x4cfb5b=0x0;_0x4cfb5b<_0x13980a['rows'][_0x5bff('0x91')];_0x4cfb5b++){_0x40de11[_0x5bff('0x89')](_0x29c369(_0x5bff('0xb4'),_0x13980a[_0x5bff('0xaa')][_0x4cfb5b][_0x5bff('0xb5')]));_0x40de11['push'](_0x29c369(_0x5bff('0xb6'),_0x13980a[_0x5bff('0xaa')][_0x4cfb5b][_0x5bff('0xb5')]));_0x40de11['push'](_0x29c369(_0x5bff('0xb7'),_0x13980a['rows'][_0x4cfb5b][_0x5bff('0xb5')]));_0x40de11['push'](_0x29c369(_0x5bff('0xb8'),_0x13980a['rows'][_0x4cfb5b][_0x5bff('0xb5')]));_0x40de11[_0x5bff('0x89')](_0x29c369(_0x5bff('0xb9'),_0x13980a['rows'][_0x4cfb5b][_0x5bff('0xb5')]));_0x40de11[_0x5bff('0x89')](_0x29c369(_0x5bff('0xba'),_0x13980a[_0x5bff('0xaa')][_0x4cfb5b][_0x5bff('0xb5')]));}return Promise[_0x5bff('0x8c')](_0x40de11)[_0x5bff('0xb')](function(){return _0x13980a;});}return _0x13980a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 35b6c50..b10d0b3 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 _0x34f0=['redis','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5524a1,_0x37c171){var _0x4ea5e3=function(_0x493ee1){while(--_0x493ee1){_0x5524a1['push'](_0x5524a1['shift']());}};_0x4ea5e3(++_0x37c171);}(_0x34f0,0x13b));var _0x034f=function(_0x8a75d1,_0x51522b){_0x8a75d1=_0x8a75d1-0x0;var _0x5e03ce=_0x34f0[_0x8a75d1];return _0x5e03ce;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var moment=require('moment');var BPromise=require(_0x034f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x034f('0x3'));var db=require(_0x034f('0x4'))['db'];var utils=require(_0x034f('0x5'));var logger=require(_0x034f('0x6'))(_0x034f('0x7'));var config=require('../../config/environment');var jayson=require(_0x034f('0x8'));var client=jayson[_0x034f('0x9')]['http']({'port':0x232a});config[_0x034f('0xa')]=_['defaults'](config[_0x034f('0xa')],{'host':_0x034f('0xb'),'port':0x18eb});var socket=require(_0x034f('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0x034f('0xd')](socket);function respondWithRpcPromise(_0x50909e,_0x48ed9b,_0x453bc2){return new BPromise(function(_0x3ec935,_0x8a0835){return client[_0x034f('0xe')](_0x50909e,_0x453bc2)[_0x034f('0xf')](function(_0x4e0888){logger[_0x034f('0x10')](_0x034f('0x11'),_0x48ed9b,_0x034f('0x12'));logger['debug'](_0x034f('0x13'),_0x48ed9b,'request\x20sent',JSON[_0x034f('0x14')](_0x4e0888));if(_0x4e0888[_0x034f('0x15')]){if(_0x4e0888[_0x034f('0x15')][_0x034f('0x16')]===0x1f4){logger[_0x034f('0x15')](_0x034f('0x11'),_0x48ed9b,_0x4e0888[_0x034f('0x15')][_0x034f('0x17')]);return _0x8a0835(_0x4e0888['error']['message']);}logger[_0x034f('0x15')](_0x034f('0x11'),_0x48ed9b,_0x4e0888[_0x034f('0x15')]['message']);return _0x3ec935(_0x4e0888['error'][_0x034f('0x17')]);}else{logger[_0x034f('0x10')]('UserProfile,\x20%s,\x20%s',_0x48ed9b,_0x034f('0x12'));_0x3ec935(_0x4e0888['result'][_0x034f('0x17')]);}})[_0x034f('0x18')](function(_0x1ebb01){logger['error'](_0x034f('0x11'),_0x48ed9b,_0x1ebb01);_0x8a0835(_0x1ebb01);});});} \ No newline at end of file +var _0x8ff3=['../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x8ff3,0x72));var _0x38ff=function(_0x4f90af,_0x14b70c){_0x4f90af=_0x4f90af-0x0;var _0x5e62c0=_0x8ff3[_0x4f90af];return _0x5e62c0;};'use strict';var _=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var moment=require('moment');var BPromise=require(_0x38ff('0x2'));var rs=require(_0x38ff('0x3'));var fs=require('fs');var Redis=require(_0x38ff('0x4'));var db=require(_0x38ff('0x5'))['db'];var utils=require(_0x38ff('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x38ff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x38ff('0x8')]['http']({'port':0x232a});config[_0x38ff('0x9')]=_[_0x38ff('0xa')](config[_0x38ff('0x9')],{'host':_0x38ff('0xb'),'port':0x18eb});var socket=require(_0x38ff('0xc'))(new Redis(config[_0x38ff('0x9')]));require(_0x38ff('0xd'))[_0x38ff('0xe')](socket);function respondWithRpcPromise(_0x17820a,_0x3a701b,_0x261325){return new BPromise(function(_0x217abf,_0x11058d){return client['request'](_0x17820a,_0x261325)[_0x38ff('0xf')](function(_0x9d5d77){logger[_0x38ff('0x10')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x38ff('0x11'));logger[_0x38ff('0x12')](_0x38ff('0x13'),_0x3a701b,_0x38ff('0x11'),JSON['stringify'](_0x9d5d77));if(_0x9d5d77[_0x38ff('0x14')]){if(_0x9d5d77[_0x38ff('0x14')]['code']===0x1f4){logger[_0x38ff('0x14')](_0x38ff('0x15'),_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x11058d(_0x9d5d77[_0x38ff('0x14')]['message']);}logger[_0x38ff('0x14')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x217abf(_0x9d5d77['error'][_0x38ff('0x16')]);}else{logger[_0x38ff('0x10')](_0x38ff('0x15'),_0x3a701b,_0x38ff('0x11'));_0x217abf(_0x9d5d77[_0x38ff('0x17')][_0x38ff('0x16')]);}})['catch'](function(_0x2f9a29){logger[_0x38ff('0x14')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x2f9a29);_0x11058d(_0x2f9a29);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e7ca9ea..eba3303 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 _0x6b0f=['./userProfile.events','save','remove','update','emit','register','length','userProfile:'];(function(_0xbea2f0,_0x3fbf98){var _0x5b4840=function(_0x27fe8c){while(--_0x27fe8c){_0xbea2f0['push'](_0xbea2f0['shift']());}};_0x5b4840(++_0x3fbf98);}(_0x6b0f,0xe8));var _0xf6b0=function(_0x36d20a,_0x785d5a){_0x36d20a=_0x36d20a-0x0;var _0xc060f2=_0x6b0f[_0x36d20a];return _0xc060f2;};'use strict';var UserProfileEvents=require(_0xf6b0('0x0'));var events=[_0xf6b0('0x1'),_0xf6b0('0x2'),_0xf6b0('0x3')];function createListener(_0x275847,_0x1da1a3){return function(_0x5bb1d1){_0x1da1a3[_0xf6b0('0x4')](_0x275847,_0x5bb1d1);};}function removeListener(_0x44d09b,_0x8a4d69){return function(){UserProfileEvents['removeListener'](_0x44d09b,_0x8a4d69);};}exports[_0xf6b0('0x5')]=function(_0x467ab3){for(var _0x3250b5=0x0,_0x5c81ed=events[_0xf6b0('0x6')];_0x3250b5<_0x5c81ed;_0x3250b5++){var _0x14a093=events[_0x3250b5];var _0x2deab8=createListener(_0xf6b0('0x7')+_0x14a093,_0x467ab3);UserProfileEvents['on'](_0x14a093,_0x2deab8);}}; \ No newline at end of file +var _0x9758=['register','length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener'];(function(_0x5bcc60,_0xaac54d){var _0x3993fa=function(_0x576e16){while(--_0x576e16){_0x5bcc60['push'](_0x5bcc60['shift']());}};_0x3993fa(++_0xaac54d);}(_0x9758,0x81));var _0x8975=function(_0x187b00,_0x432fc8){_0x187b00=_0x187b00-0x0;var _0x19d882=_0x9758[_0x187b00];return _0x19d882;};'use strict';var UserProfileEvents=require(_0x8975('0x0'));var events=[_0x8975('0x1'),_0x8975('0x2'),_0x8975('0x3')];function createListener(_0x4039d5,_0x9fabd){return function(_0x200278){_0x9fabd[_0x8975('0x4')](_0x4039d5,_0x200278);};}function removeListener(_0xc82bc6,_0x5ec4df){return function(){UserProfileEvents[_0x8975('0x5')](_0xc82bc6,_0x5ec4df);};}exports[_0x8975('0x6')]=function(_0x569ce5){for(var _0x4f6209=0x0,_0x122535=events[_0x8975('0x7')];_0x4f6209<_0x122535;_0x4f6209++){var _0x7f8ac7=events[_0x4f6209];var _0x56270f=createListener(_0x8975('0x8')+_0x7f8ac7,_0x569ce5);UserProfileEvents['on'](_0x7f8ac7,_0x56270f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ab6518b..fb48e15 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 _0xa2f3=['describe','/:id','show','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe','isAuthenticated'];(function(_0x36f284,_0x24cbd1){var _0x4ea099=function(_0xea729e){while(--_0xea729e){_0x36f284['push'](_0x36f284['shift']());}};_0x4ea099(++_0x24cbd1);}(_0xa2f3,0x7e));var _0x3a2f=function(_0xa6a4f2,_0x302e58){_0xa6a4f2=_0xa6a4f2-0x0;var _0x514b16=_0xa2f3[_0xa6a4f2];return _0x514b16;};'use strict';var multer=require(_0x3a2f('0x0'));var util=require(_0x3a2f('0x1'));var path=require(_0x3a2f('0x2'));var timeout=require(_0x3a2f('0x3'));var express=require(_0x3a2f('0x4'));var router=express['Router']();var fs_extra=require(_0x3a2f('0x5'));var auth=require(_0x3a2f('0x6'));var interaction=require(_0x3a2f('0x7'));var config=require(_0x3a2f('0x8'));var controller=require(_0x3a2f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3a2f('0xa')]);router[_0x3a2f('0xb')](_0x3a2f('0xc'),auth[_0x3a2f('0xd')](),controller[_0x3a2f('0xe')]);router[_0x3a2f('0xb')](_0x3a2f('0xf'),auth[_0x3a2f('0xd')](),controller[_0x3a2f('0x10')]);router['post']('/',auth[_0x3a2f('0xd')](),controller['create']);router['put'](_0x3a2f('0xf'),auth[_0x3a2f('0xd')](),controller[_0x3a2f('0x11')]);router['delete'](_0x3a2f('0xf'),auth[_0x3a2f('0xd')](),controller[_0x3a2f('0x12')]);module[_0x3a2f('0x13')]=router; \ No newline at end of file +var _0x4e7c=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','show','/:id','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x22a370,_0x1aae5){var _0x1c05cd=function(_0x3acfb8){while(--_0x3acfb8){_0x22a370['push'](_0x22a370['shift']());}};_0x1c05cd(++_0x1aae5);}(_0x4e7c,0x82));var _0xc4e7=function(_0x4af340,_0x2162b1){_0x4af340=_0x4af340-0x0;var _0x1b3959=_0x4e7c[_0x4af340];return _0x1b3959;};'use strict';var multer=require(_0xc4e7('0x0'));var util=require('util');var path=require(_0xc4e7('0x1'));var timeout=require(_0xc4e7('0x2'));var express=require(_0xc4e7('0x3'));var router=express['Router']();var fs_extra=require(_0xc4e7('0x4'));var auth=require(_0xc4e7('0x5'));var interaction=require(_0xc4e7('0x6'));var config=require(_0xc4e7('0x7'));var controller=require(_0xc4e7('0x8'));router[_0xc4e7('0x9')]('/',auth[_0xc4e7('0xa')](),controller[_0xc4e7('0xb')]);router['get']('/describe',auth[_0xc4e7('0xa')](),controller[_0xc4e7('0xc')]);router['get']('/:id',auth[_0xc4e7('0xa')](),controller[_0xc4e7('0xd')]);router['post']('/',auth[_0xc4e7('0xa')](),controller['create']);router['put'](_0xc4e7('0xe'),auth[_0xc4e7('0xa')](),controller['update']);router[_0xc4e7('0xf')](_0xc4e7('0xe'),auth[_0xc4e7('0xa')](),controller['destroy']);module[_0xc4e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d3d473b..52ccc45 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 _0x64e3=['STRING','exports'];(function(_0x24d585,_0x586ddf){var _0x53c8e6=function(_0xa508e7){while(--_0xa508e7){_0x24d585['push'](_0x24d585['shift']());}};_0x53c8e6(++_0x586ddf);}(_0x64e3,0x155));var _0x364e=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x64e3[_0x2b0bc2];return _0x56e5b9;};'use strict';var Sequelize=require('sequelize');module[_0x364e('0x0')]={'name':{'type':Sequelize[_0x364e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb7ce=['sequelize','exports','STRING','INTEGER'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0xb7ce,0x170));var _0xeb7c=function(_0x5c9590,_0x5a06dc){_0x5c9590=_0x5c9590-0x0;var _0x3d31f5=_0xb7ce[_0x5c9590];return _0x3d31f5;};'use strict';var Sequelize=require(_0xeb7c('0x0'));module[_0xeb7c('0x1')]={'name':{'type':Sequelize[_0xeb7c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xeb7c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9823ffb..e57f697 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 _0x187d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create','body','describe','eml-format'];(function(_0x57573a,_0x227db1){var _0x537509=function(_0x1a503a){while(--_0x1a503a){_0x57573a['push'](_0x57573a['shift']());}};_0x537509(++_0x227db1);}(_0x187d,0x93));var _0xd187=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x187d[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));};exports[_0xd187('0x49')]=function(_0x3aaeaa,_0x1b12c4){return db[_0xd187('0x2d')]['describe']()[_0xd187('0x3f')](respondWithResult(_0x1b12c4,null))['catch'](handleError(_0x1b12c4,null));}; \ No newline at end of file +var _0x5f66=['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','UserProfileResource','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','update','catch','describe','rimraf','fast-json-patch','request-promise','moment'];(function(_0xb4947e,_0x39de27){var _0x2af6df=function(_0x308271){while(--_0x308271){_0xb4947e['push'](_0xb4947e['shift']());}};_0x2af6df(++_0x39de27);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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['UserProfileResource'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));};exports[_0x65f6('0x45')]=function(_0x3b241f,_0x1ca67e){return db['UserProfileResource'][_0x65f6('0x45')]()[_0x65f6('0x21')](respondWithResult(_0x1ca67e,null))['catch'](handleError(_0x1ca67e,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 15aba82..9d453f8 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 _0xde07=['resourceId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource'];(function(_0x24a8db,_0x48b10e){var _0x4a2609=function(_0x50e4ed){while(--_0x50e4ed){_0x24a8db['push'](_0x24a8db['shift']());}};_0x4a2609(++_0x48b10e);}(_0xde07,0x1a5));var _0x7de0=function(_0x38ad5b,_0x1162e8){_0x38ad5b=_0x38ad5b-0x0;var _0x358e68=_0xde07[_0x38ad5b];return _0x358e68;};'use strict';var _=require(_0x7de0('0x0'));var util=require(_0x7de0('0x1'));var logger=require(_0x7de0('0x2'))(_0x7de0('0x3'));var moment=require(_0x7de0('0x4'));var BPromise=require(_0x7de0('0x5'));var rp=require(_0x7de0('0x6'));var fs=require('fs');var path=require(_0x7de0('0x7'));var rimraf=require(_0x7de0('0x8'));var config=require(_0x7de0('0x9'));var attributes=require(_0x7de0('0xa'));module[_0x7de0('0xb')]=function(_0x2f8eef,_0xb8f810){return _0x2f8eef[_0x7de0('0xc')](_0x7de0('0xd'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7de0('0xe'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d8f=['bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','resourceId','util','../../config/logger'];(function(_0x1109bd,_0xef49f9){var _0x113ea7=function(_0x174d11){while(--_0x174d11){_0x1109bd['push'](_0x1109bd['shift']());}};_0x113ea7(++_0xef49f9);}(_0x2d8f,0x18a));var _0xf2d8=function(_0xc02211,_0x39040b){_0xc02211=_0xc02211-0x0;var _0x2f4910=_0x2d8f[_0xc02211];return _0x2f4910;};'use strict';var _=require('lodash');var util=require(_0xf2d8('0x0'));var logger=require(_0xf2d8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf2d8('0x2'));var rp=require(_0xf2d8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2d8('0x4'));var config=require(_0xf2d8('0x5'));var attributes=require(_0xf2d8('0x6'));module[_0xf2d8('0x7')]=function(_0x38c3cc,_0x72ed29){return _0x38c3cc['define'](_0xf2d8('0x8'),attributes,{'tableName':_0xf2d8('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf2d8('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3576b2c..91db3fd 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 _0x9cbe=['message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0xadcc96,_0x2f0c6a){var _0x1273de=function(_0x7c19b9){while(--_0x7c19b9){_0xadcc96['push'](_0xadcc96['shift']());}};_0x1273de(++_0x2f0c6a);}(_0x9cbe,0x114));var _0xe9cb=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x9cbe[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe9cb('0x0'));var rs=require(_0xe9cb('0x1'));var fs=require('fs');var Redis=require(_0xe9cb('0x2'));var db=require(_0xe9cb('0x3'))['db'];var utils=require(_0xe9cb('0x4'));var logger=require(_0xe9cb('0x5'))('rpc');var config=require(_0xe9cb('0x6'));var jayson=require(_0xe9cb('0x7'));var client=jayson[_0xe9cb('0x8')][_0xe9cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x404615,_0x7894ea,_0x32d7a9){return new BPromise(function(_0x2493b5,_0x3fcde0){return client['request'](_0x404615,_0x32d7a9)[_0xe9cb('0xa')](function(_0x34c371){logger[_0xe9cb('0xb')](_0xe9cb('0xc'),_0x7894ea,_0xe9cb('0xd'));logger[_0xe9cb('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x7894ea,_0xe9cb('0xd'),JSON[_0xe9cb('0xf')](_0x34c371));if(_0x34c371[_0xe9cb('0x10')]){if(_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x11')]===0x1f4){logger['error'](_0xe9cb('0xc'),_0x7894ea,_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x12')]);return _0x3fcde0(_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x12')]);}logger[_0xe9cb('0x10')](_0xe9cb('0xc'),_0x7894ea,_0x34c371[_0xe9cb('0x10')][_0xe9cb('0x12')]);return _0x2493b5(_0x34c371['error'][_0xe9cb('0x12')]);}else{logger[_0xe9cb('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x7894ea,_0xe9cb('0xd'));_0x2493b5(_0x34c371[_0xe9cb('0x13')][_0xe9cb('0x12')]);}})[_0xe9cb('0x14')](function(_0x488175){logger[_0xe9cb('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x7894ea,_0x488175);_0x3fcde0(_0x488175);});});} \ No newline at end of file +var _0x7f9d=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3aae33,_0x30b4c8){var _0x1f5de6=function(_0x521888){while(--_0x521888){_0x3aae33['push'](_0x3aae33['shift']());}};_0x1f5de6(++_0x30b4c8);}(_0x7f9d,0x174));var _0xd7f9=function(_0x127449,_0x56cc02){_0x127449=_0x127449-0x0;var _0x4543fb=_0x7f9d[_0x127449];return _0x4543fb;};'use strict';var _=require('lodash');var util=require(_0xd7f9('0x0'));var moment=require(_0xd7f9('0x1'));var BPromise=require(_0xd7f9('0x2'));var rs=require(_0xd7f9('0x3'));var fs=require('fs');var Redis=require(_0xd7f9('0x4'));var db=require(_0xd7f9('0x5'))['db'];var utils=require(_0xd7f9('0x6'));var logger=require(_0xd7f9('0x7'))(_0xd7f9('0x8'));var config=require(_0xd7f9('0x9'));var jayson=require(_0xd7f9('0xa'));var client=jayson[_0xd7f9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f564b,_0x42d536,_0x55da6d){return new BPromise(function(_0x357261,_0x4d6e34){return client['request'](_0x2f564b,_0x55da6d)[_0xd7f9('0xc')](function(_0x1dd4dd){logger[_0xd7f9('0xd')](_0xd7f9('0xe'),_0x42d536,'request\x20sent');logger[_0xd7f9('0xf')](_0xd7f9('0x10'),_0x42d536,_0xd7f9('0x11'),JSON[_0xd7f9('0x12')](_0x1dd4dd));if(_0x1dd4dd['error']){if(_0x1dd4dd[_0xd7f9('0x13')]['code']===0x1f4){logger[_0xd7f9('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x42d536,_0x1dd4dd[_0xd7f9('0x13')]['message']);return _0x4d6e34(_0x1dd4dd[_0xd7f9('0x13')][_0xd7f9('0x14')]);}logger[_0xd7f9('0x13')](_0xd7f9('0xe'),_0x42d536,_0x1dd4dd['error'][_0xd7f9('0x14')]);return _0x357261(_0x1dd4dd[_0xd7f9('0x13')][_0xd7f9('0x14')]);}else{logger[_0xd7f9('0xd')](_0xd7f9('0xe'),_0x42d536,_0xd7f9('0x11'));_0x357261(_0x1dd4dd[_0xd7f9('0x15')][_0xd7f9('0x14')]);}})[_0xd7f9('0x16')](function(_0x147880){logger[_0xd7f9('0x13')](_0xd7f9('0xe'),_0x42d536,_0x147880);_0x4d6e34(_0x147880);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 921e820..8aed760 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 _0x5754=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','multer','util','path'];(function(_0x2a08b8,_0xba6d80){var _0x2c3628=function(_0x227942){while(--_0x227942){_0x2a08b8['push'](_0x2a08b8['shift']());}};_0x2c3628(++_0xba6d80);}(_0x5754,0x89));var _0x4575=function(_0x2dc635,_0x310b62){_0x2dc635=_0x2dc635-0x0;var _0x20b504=_0x5754[_0x2dc635];return _0x20b504;};'use strict';var multer=require(_0x4575('0x0'));var util=require(_0x4575('0x1'));var path=require(_0x4575('0x2'));var timeout=require('connect-timeout');var express=require(_0x4575('0x3'));var router=express[_0x4575('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4575('0x5'));var interaction=require(_0x4575('0x6'));var config=require(_0x4575('0x7'));var controller=require(_0x4575('0x8'));router[_0x4575('0x9')]('/',auth[_0x4575('0xa')](),controller[_0x4575('0xb')]);router[_0x4575('0x9')](_0x4575('0xc'),auth[_0x4575('0xa')](),controller[_0x4575('0xd')]);router['get'](_0x4575('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x4575('0xf')]('/',auth[_0x4575('0xa')](),controller[_0x4575('0x10')]);router[_0x4575('0x11')](_0x4575('0xe'),auth[_0x4575('0xa')](),controller[_0x4575('0x12')]);router['delete'](_0x4575('0xe'),auth[_0x4575('0xa')](),controller[_0x4575('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe224=['./userProfileSection.controller','get','isAuthenticated','/describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x34f4fa,_0xbd1b3){var _0x53ff8d=function(_0x54345b){while(--_0x54345b){_0x34f4fa['push'](_0x34f4fa['shift']());}};_0x53ff8d(++_0xbd1b3);}(_0xe224,0x138));var _0x4e22=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe224[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4e22('0x0'));var util=require(_0x4e22('0x1'));var path=require(_0x4e22('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e22('0x3'));var router=express[_0x4e22('0x4')]();var fs_extra=require(_0x4e22('0x5'));var auth=require(_0x4e22('0x6'));var interaction=require(_0x4e22('0x7'));var config=require('../../config/environment');var controller=require(_0x4e22('0x8'));router[_0x4e22('0x9')]('/',auth[_0x4e22('0xa')](),controller['index']);router[_0x4e22('0x9')](_0x4e22('0xb'),auth[_0x4e22('0xa')](),controller['describe']);router[_0x4e22('0x9')]('/:id',auth[_0x4e22('0xa')](),controller[_0x4e22('0xc')]);router[_0x4e22('0xd')]('/',auth[_0x4e22('0xa')](),controller['create']);router[_0x4e22('0xe')](_0x4e22('0xf'),auth[_0x4e22('0xa')](),controller[_0x4e22('0x10')]);router[_0x4e22('0x11')](_0x4e22('0xf'),auth[_0x4e22('0xa')](),controller[_0x4e22('0x12')]);module[_0x4e22('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 4628851..7d54bd8 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 _0x2547=['BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0x2547,0x1cd));var _0x7254=function(_0x4b5489,_0x62292d){_0x4b5489=_0x4b5489-0x0;var _0x5e4b91=_0x2547[_0x4b5489];return _0x5e4b91;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'name':{'type':Sequelize[_0x7254('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x7254('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7254('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x7254('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7254('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7254('0x1')],'set':function(_0x265ebf){this['setDataValue'](_0x7254('0x4'),_0x265ebf?_0x265ebf[_0x7254('0x5')](''):[]);},'get':function(){return this[_0x7254('0x6')](_0x7254('0x4'))?this['getDataValue'](_0x7254('0x4'))[_0x7254('0x7')](''):[];}}}; \ No newline at end of file +var _0xe820=['sequelize','STRING','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x53bbfc,_0x21aed9){var _0x3f887a=function(_0x309e5d){while(--_0x309e5d){_0x53bbfc['push'](_0x53bbfc['shift']());}};_0x3f887a(++_0x21aed9);}(_0xe820,0xd2));var _0x0e82=function(_0x30b802,_0x75cd6b){_0x30b802=_0x30b802-0x0;var _0x4868b3=_0xe820[_0x30b802];return _0x4868b3;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e82('0x1')],'set':function(_0x59b28d){this[_0x0e82('0x3')]('crudPermissions',_0x59b28d?_0x59b28d[_0x0e82('0x4')](''):[]);},'get':function(){return this[_0x0e82('0x5')](_0x0e82('0x6'))?this[_0x0e82('0x5')](_0x0e82('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e82707a..db6c81f 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 _0x222c=['include','findAll','catch','show','params','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','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','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x222c,0x9e));var _0xc222=function(_0x2efed0,_0x2301f6){_0x2efed0=_0x2efed0-0x0;var _0x4eee8d=_0x222c[_0x2efed0];return _0x4eee8d;};'use strict';var emlformat=require(_0xc222('0x0'));var rimraf=require(_0xc222('0x1'));var zipdir=require(_0xc222('0x2'));var jsonpatch=require(_0xc222('0x3'));var rp=require(_0xc222('0x4'));var moment=require(_0xc222('0x5'));var BPromise=require(_0xc222('0x6'));var Mustache=require(_0xc222('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc222('0x8'));var csv=require('to-csv');var ejs=require(_0xc222('0x9'));var fs=require('fs');var fs_extra=require(_0xc222('0xa'));var _=require('lodash');var squel=require(_0xc222('0xb'));var crypto=require(_0xc222('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc222('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc222('0xe'));var Papa=require(_0xc222('0xf'));var Redis=require(_0xc222('0x10'));var authService=require(_0xc222('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc222('0x12'));var hardwareService=require(_0xc222('0x13'));var logger=require(_0xc222('0x14'))('api');var utils=require(_0xc222('0x15'));var config=require(_0xc222('0x16'));var licenseUtil=require(_0xc222('0x17'));var db=require(_0xc222('0x18'))['db'];function respondWithStatusCode(_0x579e62,_0x221140){_0x221140=_0x221140||0xcc;return function(_0x18266e){if(_0x18266e){return _0x579e62[_0xc222('0x19')](_0x221140);}return _0x579e62[_0xc222('0x1a')](_0x221140)[_0xc222('0x1b')]();};}function respondWithResult(_0x32694c,_0xb01384){_0xb01384=_0xb01384||0xc8;return function(_0x1ff6fc){if(_0x1ff6fc){return _0x32694c[_0xc222('0x1a')](_0xb01384)[_0xc222('0x1c')](_0x1ff6fc);}};}function respondWithFilteredResult(_0xba37a2,_0x498afd){return function(_0x85633){if(_0x85633){var _0x42d166=typeof _0x498afd[_0xc222('0x1d')]==='undefined'&&typeof _0x498afd[_0xc222('0x1e')]==='undefined';var _0x476626=_0x85633[_0xc222('0x1f')];var _0x22e6eb=_0x42d166?0x0:_0x498afd[_0xc222('0x1d')];var _0xfa1dd7=_0x42d166?_0x85633[_0xc222('0x1f')]:_0x498afd[_0xc222('0x1d')]+_0x498afd['limit'];var _0x56e301;if(_0xfa1dd7>=_0x476626){_0xfa1dd7=_0x476626;_0x56e301=0xc8;}else{_0x56e301=0xce;}_0xba37a2[_0xc222('0x1a')](_0x56e301);return _0xba37a2[_0xc222('0x20')](_0xc222('0x21'),_0x22e6eb+'-'+_0xfa1dd7+'/'+_0x476626)['json'](_0x85633);}return null;};}function patchUpdates(_0x34fc04){return function(_0x453ab5){try{jsonpatch[_0xc222('0x22')](_0x453ab5,_0x34fc04,!![]);}catch(_0x224ae8){return BPromise['reject'](_0x224ae8);}return _0x453ab5[_0xc222('0x23')]();};}function saveUpdates(_0x231ac8,_0x2a411a){return function(_0x3d84e1){if(_0x3d84e1){return _0x3d84e1[_0xc222('0x24')](_0x231ac8)[_0xc222('0x25')](function(_0x5440ea){return _0x5440ea;});}return null;};}function removeEntity(_0x40f278,_0x42a290){return function(_0x4c3e49){if(_0x4c3e49){return _0x4c3e49[_0xc222('0x26')]()[_0xc222('0x25')](function(){_0x40f278[_0xc222('0x1a')](0xcc)[_0xc222('0x1b')]();});}};}function handleEntityNotFound(_0x38f12d,_0x428f9a){return function(_0x124541){if(!_0x124541){_0x38f12d[_0xc222('0x19')](0x194);}return _0x124541;};}function handleError(_0x42b19f,_0x332394){_0x332394=_0x332394||0x1f4;return function(_0x2a55e9){logger['error'](_0x2a55e9[_0xc222('0x27')]);if(_0x2a55e9['name']){delete _0x2a55e9[_0xc222('0x28')];}_0x42b19f[_0xc222('0x1a')](_0x332394)['send'](_0x2a55e9);};}exports['index']=function(_0x1269ec,_0x1ebeba){var _0x24bf6a={},_0x1c0f30={},_0x7233cd={'count':0x0,'rows':[]};var _0x4863d9=_['map'](db[_0xc222('0x29')][_0xc222('0x2a')],function(_0x325eb0){return{'name':_0x325eb0[_0xc222('0x2b')],'type':_0x325eb0[_0xc222('0x2c')][_0xc222('0x2d')]};});_0x1c0f30['model']=_[_0xc222('0x2e')](_0x4863d9,'name');_0x1c0f30[_0xc222('0x2f')]=_[_0xc222('0x30')](_0x1269ec[_0xc222('0x2f')]);_0x1c0f30[_0xc222('0x31')]=_[_0xc222('0x32')](_0x1c0f30['model'],_0x1c0f30['query']);_0x24bf6a['attributes']=_[_0xc222('0x32')](_0x1c0f30[_0xc222('0x33')],qs['fields'](_0x1269ec[_0xc222('0x2f')][_0xc222('0x34')]));_0x24bf6a[_0xc222('0x35')]=_0x24bf6a[_0xc222('0x35')]['length']?_0x24bf6a[_0xc222('0x35')]:_0x1c0f30['model'];if(!_0x1269ec[_0xc222('0x2f')][_0xc222('0x36')](_0xc222('0x37'))){_0x24bf6a[_0xc222('0x1e')]=qs['limit'](_0x1269ec[_0xc222('0x2f')]['limit']);_0x24bf6a[_0xc222('0x1d')]=qs[_0xc222('0x1d')](_0x1269ec[_0xc222('0x2f')][_0xc222('0x1d')]);}_0x24bf6a['order']=qs[_0xc222('0x38')](_0x1269ec[_0xc222('0x2f')][_0xc222('0x38')]);_0x24bf6a['where']=qs[_0xc222('0x31')](_[_0xc222('0x39')](_0x1269ec['query'],_0x1c0f30[_0xc222('0x31')]),_0x4863d9);if(_0x1269ec[_0xc222('0x2f')]['filter']){_0x24bf6a[_0xc222('0x3a')]=_['merge'](_0x24bf6a[_0xc222('0x3a')],{'$or':_[_0xc222('0x2e')](_0x4863d9,function(_0x531af9){if(_0x531af9['type']!==_0xc222('0x3b')){var _0x1dedc0={};_0x1dedc0[_0x531af9[_0xc222('0x28')]]={'$like':'%'+_0x1269ec[_0xc222('0x2f')][_0xc222('0x3c')]+'%'};return _0x1dedc0;}})});}_0x24bf6a=_[_0xc222('0x3d')]({},_0x24bf6a,_0x1269ec[_0xc222('0x3e')]);var _0x513e49={'where':_0x24bf6a[_0xc222('0x3a')]};return db[_0xc222('0x29')][_0xc222('0x1f')](_0x513e49)['then'](function(_0x532bfd){_0x7233cd[_0xc222('0x1f')]=_0x532bfd;if(_0x1269ec['query'][_0xc222('0x3f')]){_0x24bf6a[_0xc222('0x40')]=[{'all':!![]}];}return db[_0xc222('0x29')][_0xc222('0x41')](_0x24bf6a);})[_0xc222('0x25')](function(_0x71e43){_0x7233cd['rows']=_0x71e43;return _0x7233cd;})[_0xc222('0x25')](respondWithFilteredResult(_0x1ebeba,_0x24bf6a))[_0xc222('0x42')](handleError(_0x1ebeba,null));};exports[_0xc222('0x43')]=function(_0x411a5e,_0x7d505d){var _0x5e1b28={'raw':![],'where':{'id':_0x411a5e[_0xc222('0x44')]['id']}},_0x1aa48b={};_0x1aa48b['model']=_[_0xc222('0x30')](db['UserProfileSection'][_0xc222('0x2a')]);_0x1aa48b[_0xc222('0x2f')]=_[_0xc222('0x30')](_0x411a5e['query']);_0x1aa48b['filters']=_[_0xc222('0x32')](_0x1aa48b[_0xc222('0x33')],_0x1aa48b['query']);_0x5e1b28[_0xc222('0x35')]=_[_0xc222('0x32')](_0x1aa48b[_0xc222('0x33')],qs[_0xc222('0x34')](_0x411a5e[_0xc222('0x2f')][_0xc222('0x34')]));_0x5e1b28[_0xc222('0x35')]=_0x5e1b28[_0xc222('0x35')][_0xc222('0x45')]?_0x5e1b28['attributes']:_0x1aa48b['model'];if(_0x411a5e[_0xc222('0x2f')][_0xc222('0x3f')]){_0x5e1b28['include']=[{'all':!![]}];}_0x5e1b28=_['merge']({},_0x5e1b28,_0x411a5e[_0xc222('0x3e')]);return db[_0xc222('0x29')]['find'](_0x5e1b28)[_0xc222('0x25')](handleEntityNotFound(_0x7d505d,null))['then'](respondWithResult(_0x7d505d,null))[_0xc222('0x42')](handleError(_0x7d505d,null));};exports[_0xc222('0x46')]=function(_0x4f5339,_0x442f45){return db[_0xc222('0x29')][_0xc222('0x46')](_0x4f5339[_0xc222('0x47')],{})['then'](respondWithResult(_0x442f45,0xc9))[_0xc222('0x42')](handleError(_0x442f45,null));};exports[_0xc222('0x24')]=function(_0x268bc2,_0x4e789e){if(_0x268bc2[_0xc222('0x47')]['id']){delete _0x268bc2[_0xc222('0x47')]['id'];}return db['UserProfileSection'][_0xc222('0x48')]({'where':{'id':_0x268bc2[_0xc222('0x44')]['id']}})[_0xc222('0x25')](handleEntityNotFound(_0x4e789e,null))['then'](saveUpdates(_0x268bc2[_0xc222('0x47')],null))[_0xc222('0x25')](respondWithResult(_0x4e789e,null))[_0xc222('0x42')](handleError(_0x4e789e,null));};exports[_0xc222('0x26')]=function(_0x18c5e9,_0x6dc100){return db[_0xc222('0x29')]['find']({'where':{'id':_0x18c5e9[_0xc222('0x44')]['id']}})['then'](handleEntityNotFound(_0x6dc100,null))[_0xc222('0x25')](removeEntity(_0x6dc100,null))[_0xc222('0x42')](handleError(_0x6dc100,null));};exports[_0xc222('0x49')]=function(_0x512ae7,_0x138f3c){return db[_0xc222('0x29')][_0xc222('0x49')]()[_0xc222('0x25')](respondWithResult(_0x138f3c,null))[_0xc222('0x42')](handleError(_0x138f3c,null));}; \ No newline at end of file +var _0x1a97=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','UserProfileSection','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','findAll','rows','catch','show','length','includeAll','include','create','body','find','destroy','params','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x1a97,0x12a));var _0x71a9=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x1a97[_0xd578cb];return _0x775533;};'use strict';var emlformat=require(_0x71a9('0x0'));var rimraf=require(_0x71a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x71a9('0x2'));var BPromise=require(_0x71a9('0x3'));var Mustache=require(_0x71a9('0x4'));var util=require(_0x71a9('0x5'));var path=require(_0x71a9('0x6'));var sox=require(_0x71a9('0x7'));var csv=require(_0x71a9('0x8'));var ejs=require(_0x71a9('0x9'));var fs=require('fs');var fs_extra=require(_0x71a9('0xa'));var _=require(_0x71a9('0xb'));var squel=require(_0x71a9('0xc'));var crypto=require(_0x71a9('0xd'));var jsforce=require(_0x71a9('0xe'));var deskjs=require(_0x71a9('0xf'));var toCsv=require(_0x71a9('0x8'));var querystring=require(_0x71a9('0x10'));var Papa=require(_0x71a9('0x11'));var Redis=require(_0x71a9('0x12'));var authService=require(_0x71a9('0x13'));var qs=require(_0x71a9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71a9('0x15'));var logger=require(_0x71a9('0x16'))(_0x71a9('0x17'));var utils=require(_0x71a9('0x18'));var config=require(_0x71a9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x71a9('0x1a'))['db'];function respondWithStatusCode(_0x5176c9,_0x9c5683){_0x9c5683=_0x9c5683||0xcc;return function(_0x33f5ba){if(_0x33f5ba){return _0x5176c9[_0x71a9('0x1b')](_0x9c5683);}return _0x5176c9['status'](_0x9c5683)[_0x71a9('0x1c')]();};}function respondWithResult(_0xbca651,_0x232718){_0x232718=_0x232718||0xc8;return function(_0x3ce1bf){if(_0x3ce1bf){return _0xbca651[_0x71a9('0x1d')](_0x232718)[_0x71a9('0x1e')](_0x3ce1bf);}};}function respondWithFilteredResult(_0x2ed360,_0x59d4c5){return function(_0x568ae6){if(_0x568ae6){var _0x12c0e9=typeof _0x59d4c5[_0x71a9('0x1f')]==='undefined'&&typeof _0x59d4c5[_0x71a9('0x20')]===_0x71a9('0x21');var _0x544c94=_0x568ae6[_0x71a9('0x22')];var _0x35f5f6=_0x12c0e9?0x0:_0x59d4c5['offset'];var _0x281596=_0x12c0e9?_0x568ae6[_0x71a9('0x22')]:_0x59d4c5[_0x71a9('0x1f')]+_0x59d4c5[_0x71a9('0x20')];var _0x487acc;if(_0x281596>=_0x544c94){_0x281596=_0x544c94;_0x487acc=0xc8;}else{_0x487acc=0xce;}_0x2ed360[_0x71a9('0x1d')](_0x487acc);return _0x2ed360[_0x71a9('0x23')]('Content-Range',_0x35f5f6+'-'+_0x281596+'/'+_0x544c94)['json'](_0x568ae6);}return null;};}function patchUpdates(_0x4a7315){return function(_0x567271){try{jsonpatch[_0x71a9('0x24')](_0x567271,_0x4a7315,!![]);}catch(_0x3c5305){return BPromise['reject'](_0x3c5305);}return _0x567271[_0x71a9('0x25')]();};}function saveUpdates(_0x1d6961,_0x132a80){return function(_0x1ccc37){if(_0x1ccc37){return _0x1ccc37[_0x71a9('0x26')](_0x1d6961)[_0x71a9('0x27')](function(_0x266cac){return _0x266cac;});}return null;};}function removeEntity(_0x1d278c,_0x5deb9c){return function(_0x51788e){if(_0x51788e){return _0x51788e['destroy']()[_0x71a9('0x27')](function(){_0x1d278c['status'](0xcc)[_0x71a9('0x1c')]();});}};}function handleEntityNotFound(_0x38cd95,_0x424488){return function(_0x48c498){if(!_0x48c498){_0x38cd95['sendStatus'](0x194);}return _0x48c498;};}function handleError(_0xe21f7d,_0x109d06){_0x109d06=_0x109d06||0x1f4;return function(_0x5ae108){logger['error'](_0x5ae108[_0x71a9('0x28')]);if(_0x5ae108['name']){delete _0x5ae108[_0x71a9('0x29')];}_0xe21f7d[_0x71a9('0x1d')](_0x109d06)[_0x71a9('0x2a')](_0x5ae108);};}exports[_0x71a9('0x2b')]=function(_0x18e804,_0x376325){var _0x2475c7={},_0x277054={},_0x592455={'count':0x0,'rows':[]};var _0x2b40c3=_['map'](db[_0x71a9('0x2c')]['rawAttributes'],function(_0x370023){return{'name':_0x370023[_0x71a9('0x2d')],'type':_0x370023['type'][_0x71a9('0x2e')]};});_0x277054[_0x71a9('0x2f')]=_[_0x71a9('0x30')](_0x2b40c3,_0x71a9('0x29'));_0x277054[_0x71a9('0x31')]=_[_0x71a9('0x32')](_0x18e804['query']);_0x277054[_0x71a9('0x33')]=_[_0x71a9('0x34')](_0x277054[_0x71a9('0x2f')],_0x277054['query']);_0x2475c7[_0x71a9('0x35')]=_['intersection'](_0x277054[_0x71a9('0x2f')],qs[_0x71a9('0x36')](_0x18e804[_0x71a9('0x31')][_0x71a9('0x36')]));_0x2475c7[_0x71a9('0x35')]=_0x2475c7[_0x71a9('0x35')]['length']?_0x2475c7[_0x71a9('0x35')]:_0x277054[_0x71a9('0x2f')];if(!_0x18e804[_0x71a9('0x31')]['hasOwnProperty'](_0x71a9('0x37'))){_0x2475c7[_0x71a9('0x20')]=qs[_0x71a9('0x20')](_0x18e804[_0x71a9('0x31')][_0x71a9('0x20')]);_0x2475c7[_0x71a9('0x1f')]=qs['offset'](_0x18e804[_0x71a9('0x31')][_0x71a9('0x1f')]);}_0x2475c7[_0x71a9('0x38')]=qs[_0x71a9('0x39')](_0x18e804[_0x71a9('0x31')][_0x71a9('0x39')]);_0x2475c7['where']=qs[_0x71a9('0x33')](_[_0x71a9('0x3a')](_0x18e804['query'],_0x277054[_0x71a9('0x33')]),_0x2b40c3);if(_0x18e804['query'][_0x71a9('0x3b')]){_0x2475c7[_0x71a9('0x3c')]=_['merge'](_0x2475c7[_0x71a9('0x3c')],{'$or':_['map'](_0x2b40c3,function(_0x4d6931){if(_0x4d6931[_0x71a9('0x3d')]!==_0x71a9('0x3e')){var _0x58553a={};_0x58553a[_0x4d6931[_0x71a9('0x29')]]={'$like':'%'+_0x18e804[_0x71a9('0x31')][_0x71a9('0x3b')]+'%'};return _0x58553a;}})});}_0x2475c7=_[_0x71a9('0x3f')]({},_0x2475c7,_0x18e804[_0x71a9('0x40')]);var _0x416886={'where':_0x2475c7[_0x71a9('0x3c')]};return db['UserProfileSection'][_0x71a9('0x22')](_0x416886)['then'](function(_0x3ba918){_0x592455[_0x71a9('0x22')]=_0x3ba918;if(_0x18e804[_0x71a9('0x31')]['includeAll']){_0x2475c7['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x71a9('0x41')](_0x2475c7);})['then'](function(_0x2a8d22){_0x592455[_0x71a9('0x42')]=_0x2a8d22;return _0x592455;})[_0x71a9('0x27')](respondWithFilteredResult(_0x376325,_0x2475c7))[_0x71a9('0x43')](handleError(_0x376325,null));};exports[_0x71a9('0x44')]=function(_0x3a7e4a,_0xa790c6){var _0x515096={'raw':![],'where':{'id':_0x3a7e4a['params']['id']}},_0x152c83={};_0x152c83[_0x71a9('0x2f')]=_[_0x71a9('0x32')](db[_0x71a9('0x2c')]['rawAttributes']);_0x152c83[_0x71a9('0x31')]=_[_0x71a9('0x32')](_0x3a7e4a[_0x71a9('0x31')]);_0x152c83['filters']=_['intersection'](_0x152c83[_0x71a9('0x2f')],_0x152c83[_0x71a9('0x31')]);_0x515096['attributes']=_[_0x71a9('0x34')](_0x152c83['model'],qs[_0x71a9('0x36')](_0x3a7e4a[_0x71a9('0x31')][_0x71a9('0x36')]));_0x515096[_0x71a9('0x35')]=_0x515096[_0x71a9('0x35')][_0x71a9('0x45')]?_0x515096[_0x71a9('0x35')]:_0x152c83['model'];if(_0x3a7e4a[_0x71a9('0x31')][_0x71a9('0x46')]){_0x515096[_0x71a9('0x47')]=[{'all':!![]}];}_0x515096=_[_0x71a9('0x3f')]({},_0x515096,_0x3a7e4a[_0x71a9('0x40')]);return db['UserProfileSection']['find'](_0x515096)[_0x71a9('0x27')](handleEntityNotFound(_0xa790c6,null))[_0x71a9('0x27')](respondWithResult(_0xa790c6,null))[_0x71a9('0x43')](handleError(_0xa790c6,null));};exports[_0x71a9('0x48')]=function(_0xb859f2,_0x59cddc){return db['UserProfileSection'][_0x71a9('0x48')](_0xb859f2['body'],{})[_0x71a9('0x27')](respondWithResult(_0x59cddc,0xc9))[_0x71a9('0x43')](handleError(_0x59cddc,null));};exports[_0x71a9('0x26')]=function(_0x4ee1ca,_0x54b3a0){if(_0x4ee1ca['body']['id']){delete _0x4ee1ca[_0x71a9('0x49')]['id'];}return db[_0x71a9('0x2c')][_0x71a9('0x4a')]({'where':{'id':_0x4ee1ca['params']['id']}})['then'](handleEntityNotFound(_0x54b3a0,null))[_0x71a9('0x27')](saveUpdates(_0x4ee1ca[_0x71a9('0x49')],null))[_0x71a9('0x27')](respondWithResult(_0x54b3a0,null))[_0x71a9('0x43')](handleError(_0x54b3a0,null));};exports[_0x71a9('0x4b')]=function(_0x46b1ff,_0x5bd3aa){return db[_0x71a9('0x2c')][_0x71a9('0x4a')]({'where':{'id':_0x46b1ff[_0x71a9('0x4c')]['id']}})[_0x71a9('0x27')](handleEntityNotFound(_0x5bd3aa,null))[_0x71a9('0x27')](removeEntity(_0x5bd3aa,null))[_0x71a9('0x43')](handleError(_0x5bd3aa,null));};exports[_0x71a9('0x4d')]=function(_0x5e261d,_0x1b61a4){return db['UserProfileSection'][_0x71a9('0x4d')]()['then'](respondWithResult(_0x1b61a4,null))['catch'](handleError(_0x1b61a4,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d9b506e..0bef4ef 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 _0x4655=['path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','api','moment','bluebird'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x4655,0x70));var _0x5465=function(_0x537481,_0x5de758){_0x537481=_0x537481-0x0;var _0x4491c7=_0x4655[_0x537481];return _0x4491c7;};'use strict';var _=require(_0x5465('0x0'));var util=require(_0x5465('0x1'));var logger=require('../../config/logger')(_0x5465('0x2'));var moment=require(_0x5465('0x3'));var BPromise=require(_0x5465('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5465('0x5'));var rimraf=require(_0x5465('0x6'));var config=require(_0x5465('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x5465('0x8')]=function(_0x5dfb6d,_0x2472ab){return _0x5dfb6d[_0x5465('0x9')](_0x5465('0xa'),attributes,{'tableName':_0x5465('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x5465('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd2=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x1aeeea,_0x14222f){var _0x1d0880=function(_0x1a323b){while(--_0x1a323b){_0x1aeeea['push'](_0x1aeeea['shift']());}};_0x1d0880(++_0x14222f);}(_0xcdd2,0x87));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rp=require(_0x2cdd('0x4'));var fs=require('fs');var path=require(_0x2cdd('0x5'));var rimraf=require(_0x2cdd('0x6'));var config=require(_0x2cdd('0x7'));var attributes=require(_0x2cdd('0x8'));module['exports']=function(_0x1d1e27,_0x46949f){return _0x1d1e27[_0x2cdd('0x9')](_0x2cdd('0xa'),attributes,{'tableName':_0x2cdd('0xb'),'paranoid':![],'indexes':[{'name':_0x2cdd('0xc'),'fields':[_0x2cdd('0xd'),_0x2cdd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 03b21b7..2ff1a8a 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 _0x21dd=['util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','UserProfileSection,\x20%s,\x20%s','message','result','lodash'];(function(_0x577ee3,_0x4572b5){var _0x326b0d=function(_0x379e13){while(--_0x379e13){_0x577ee3['push'](_0x577ee3['shift']());}};_0x326b0d(++_0x4572b5);}(_0x21dd,0xdb));var _0xd21d=function(_0x25a791,_0x16dfba){_0x25a791=_0x25a791-0x0;var _0x2fe304=_0x21dd[_0x25a791];return _0x2fe304;};'use strict';var _=require(_0xd21d('0x0'));var util=require(_0xd21d('0x1'));var moment=require(_0xd21d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd21d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd21d('0x4'))(_0xd21d('0x5'));var config=require(_0xd21d('0x6'));var jayson=require(_0xd21d('0x7'));var client=jayson['client'][_0xd21d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f058a,_0x3be383,_0x33ead9){return new BPromise(function(_0x5d3d7b,_0x341d84){return client[_0xd21d('0x9')](_0x3f058a,_0x33ead9)[_0xd21d('0xa')](function(_0x2b31cf){logger[_0xd21d('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x3be383,_0xd21d('0xc'));logger[_0xd21d('0xd')](_0xd21d('0xe'),_0x3be383,_0xd21d('0xc'),JSON['stringify'](_0x2b31cf));if(_0x2b31cf['error']){if(_0x2b31cf[_0xd21d('0xf')][_0xd21d('0x10')]===0x1f4){logger[_0xd21d('0xf')](_0xd21d('0x11'),_0x3be383,_0x2b31cf[_0xd21d('0xf')]['message']);return _0x341d84(_0x2b31cf[_0xd21d('0xf')][_0xd21d('0x12')]);}logger[_0xd21d('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x3be383,_0x2b31cf[_0xd21d('0xf')]['message']);return _0x5d3d7b(_0x2b31cf['error'][_0xd21d('0x12')]);}else{logger[_0xd21d('0xb')](_0xd21d('0x11'),_0x3be383,_0xd21d('0xc'));_0x5d3d7b(_0x2b31cf[_0xd21d('0x13')]['message']);}})['catch'](function(_0x4417d3){logger[_0xd21d('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x3be383,_0x4417d3);_0x341d84(_0x4417d3);});});} \ No newline at end of file +var _0x1902=['request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1902,0x148));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2190('0x0'));var util=require('util');var moment=require(_0x2190('0x1'));var BPromise=require(_0x2190('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2190('0x3'));var logger=require('../../config/logger')(_0x2190('0x4'));var config=require(_0x2190('0x5'));var jayson=require(_0x2190('0x6'));var client=jayson[_0x2190('0x7')][_0x2190('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36323d,_0x42aaea,_0x45961d){return new BPromise(function(_0x2d1709,_0x46f617){return client[_0x2190('0x9')](_0x36323d,_0x45961d)[_0x2190('0xa')](function(_0x5c964f){logger[_0x2190('0xb')](_0x2190('0xc'),_0x42aaea,'request\x20sent');logger['debug'](_0x2190('0xd'),_0x42aaea,_0x2190('0xe'),JSON[_0x2190('0xf')](_0x5c964f));if(_0x5c964f['error']){if(_0x5c964f[_0x2190('0x10')]['code']===0x1f4){logger[_0x2190('0x10')](_0x2190('0xc'),_0x42aaea,_0x5c964f[_0x2190('0x10')][_0x2190('0x11')]);return _0x46f617(_0x5c964f[_0x2190('0x10')][_0x2190('0x11')]);}logger[_0x2190('0x10')](_0x2190('0xc'),_0x42aaea,_0x5c964f[_0x2190('0x10')][_0x2190('0x11')]);return _0x2d1709(_0x5c964f[_0x2190('0x10')][_0x2190('0x11')]);}else{logger['info'](_0x2190('0xc'),_0x42aaea,_0x2190('0xe'));_0x2d1709(_0x5c964f['result']['message']);}})[_0x2190('0x12')](function(_0x253469){logger[_0x2190('0x10')](_0x2190('0xc'),_0x42aaea,_0x253469);_0x46f617(_0x253469);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6839617..b835c94 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xdcd358,_0x1549e2){var _0xe6fe22=function(_0x10b6a1){while(--_0x10b6a1){_0xdcd358['push'](_0xdcd358['shift']());}};_0xe6fe22(++_0x1549e2);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xcb13c7,_0x31daee){var _0x3306ff=function(_0x3e8bc1){while(--_0x3e8bc1){_0xcb13c7['push'](_0xcb13c7['shift']());}};_0x3306ff(++_0x31daee);}(_0x70e0,0x17b));var _0x070e=function(_0x7114ca,_0x4185f7){_0x7114ca=_0x7114ca-0x0;var _0x55dd7f=_0x70e0[_0x7114ca];return _0x55dd7f;};'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 a435216..f64ee93 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 _0xbe5a=['exports','INTEGER'];(function(_0x3a5c39,_0x2b2310){var _0x21f97a=function(_0x1e901d){while(--_0x1e901d){_0x3a5c39['push'](_0x3a5c39['shift']());}};_0x21f97a(++_0x2b2310);}(_0xbe5a,0xa8));var _0xabe5=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xbe5a[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require('sequelize');module[_0xabe5('0x0')]={'penalty':{'type':Sequelize[_0xabe5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b78=['exports','INTEGER','sequelize'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x3b78,0xaa));var _0x83b7=function(_0xb17dc3,_0x356492){_0xb17dc3=_0xb17dc3-0x0;var _0x3054fa=_0x3b78[_0xb17dc3];return _0x3054fa;};'use strict';var Sequelize=require(_0x83b7('0x0'));module[_0x83b7('0x1')]={'penalty':{'type':Sequelize[_0x83b7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 520d37a..05019b1 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 _0x2ef3=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userSmsQueue.attributes'];(function(_0x3ab4b6,_0x4e3f0d){var _0x3402cd=function(_0x4e2c5d){while(--_0x4e2c5d){_0x3ab4b6['push'](_0x3ab4b6['shift']());}};_0x3402cd(++_0x4e3f0d);}(_0x2ef3,0xba));var _0x32ef=function(_0x233c60,_0x479380){_0x233c60=_0x233c60-0x0;var _0x4707fa=_0x2ef3[_0x233c60];return _0x4707fa;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userSmsQueue.attributes','define'];(function(_0x2e6985,_0xe8bdfb){var _0x576088=function(_0x53d514){while(--_0x53d514){_0x2e6985['push'](_0x2e6985['shift']());}};_0x576088(++_0xe8bdfb);}(_0x82c4,0x1ca));var _0x482c=function(_0x5dc6e8,_0x1ed7cc){_0x5dc6e8=_0x5dc6e8-0x0;var _0x2cb306=_0x82c4[_0x5dc6e8];return _0x2cb306;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'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 4b6d1bc..59d6d58 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 _0x6345=['jayson/promise','client','http','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x453583,_0x5ca1e8){var _0x3e9101=function(_0x421947){while(--_0x421947){_0x453583['push'](_0x453583['shift']());}};_0x3e9101(++_0x5ca1e8);}(_0x6345,0xdd));var _0x5634=function(_0x3acf88,_0x17df0b){_0x3acf88=_0x3acf88-0x0;var _0x4ee341=_0x6345[_0x3acf88];return _0x4ee341;};'use strict';var _=require(_0x5634('0x0'));var util=require(_0x5634('0x1'));var moment=require(_0x5634('0x2'));var BPromise=require('bluebird');var rs=require(_0x5634('0x3'));var fs=require('fs');var Redis=require(_0x5634('0x4'));var db=require(_0x5634('0x5'))['db'];var utils=require(_0x5634('0x6'));var logger=require(_0x5634('0x7'))(_0x5634('0x8'));var config=require('../../config/environment');var jayson=require(_0x5634('0x9'));var client=jayson[_0x5634('0xa')][_0x5634('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29a8d7,_0x25f736,_0x5a593d){return new BPromise(function(_0x15bc36,_0x57dd21){return client['request'](_0x29a8d7,_0x5a593d)['then'](function(_0x2fb5fb){logger['info'](_0x5634('0xc'),_0x25f736,_0x5634('0xd'));logger[_0x5634('0xe')](_0x5634('0xf'),_0x25f736,_0x5634('0xd'),JSON[_0x5634('0x10')](_0x2fb5fb));if(_0x2fb5fb['error']){if(_0x2fb5fb[_0x5634('0x11')][_0x5634('0x12')]===0x1f4){logger[_0x5634('0x11')](_0x5634('0xc'),_0x25f736,_0x2fb5fb[_0x5634('0x11')][_0x5634('0x13')]);return _0x57dd21(_0x2fb5fb['error'][_0x5634('0x13')]);}logger['error'](_0x5634('0xc'),_0x25f736,_0x2fb5fb['error'][_0x5634('0x13')]);return _0x15bc36(_0x2fb5fb['error']['message']);}else{logger[_0x5634('0x14')](_0x5634('0xc'),_0x25f736,_0x5634('0xd'));_0x15bc36(_0x2fb5fb[_0x5634('0x15')]['message']);}})[_0x5634('0x16')](function(_0x543e86){logger[_0x5634('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x25f736,_0x543e86);_0x57dd21(_0x543e86);});});} \ No newline at end of file +var _0x61d2=['request\x20sent','debug','stringify','error','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x5b0c6b,_0x47fb73){var _0x1d55a6=function(_0x4ac017){while(--_0x4ac017){_0x5b0c6b['push'](_0x5b0c6b['shift']());}};_0x1d55a6(++_0x47fb73);}(_0x61d2,0xd7));var _0x261d=function(_0x54bab3,_0x454974){_0x54bab3=_0x54bab3-0x0;var _0x26b768=_0x61d2[_0x54bab3];return _0x26b768;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x261d('0x0'));var BPromise=require(_0x261d('0x1'));var rs=require(_0x261d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x261d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x261d('0x4'))(_0x261d('0x5'));var config=require(_0x261d('0x6'));var jayson=require(_0x261d('0x7'));var client=jayson['client'][_0x261d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x219a37,_0x2c6527,_0x15056c){return new BPromise(function(_0x4ccc06,_0x19468c){return client[_0x261d('0x9')](_0x219a37,_0x15056c)[_0x261d('0xa')](function(_0x1ddf5c){logger[_0x261d('0xb')](_0x261d('0xc'),_0x2c6527,_0x261d('0xd'));logger[_0x261d('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2c6527,_0x261d('0xd'),JSON[_0x261d('0xf')](_0x1ddf5c));if(_0x1ddf5c[_0x261d('0x10')]){if(_0x1ddf5c[_0x261d('0x10')]['code']===0x1f4){logger[_0x261d('0x10')](_0x261d('0xc'),_0x2c6527,_0x1ddf5c[_0x261d('0x10')][_0x261d('0x11')]);return _0x19468c(_0x1ddf5c['error'][_0x261d('0x11')]);}logger[_0x261d('0x10')](_0x261d('0xc'),_0x2c6527,_0x1ddf5c[_0x261d('0x10')][_0x261d('0x11')]);return _0x4ccc06(_0x1ddf5c[_0x261d('0x10')][_0x261d('0x11')]);}else{logger[_0x261d('0xb')](_0x261d('0xc'),_0x2c6527,_0x261d('0xd'));_0x4ccc06(_0x1ddf5c[_0x261d('0x12')][_0x261d('0x11')]);}})['catch'](function(_0x11e923){logger['error'](_0x261d('0xc'),_0x2c6527,_0x11e923);_0x19468c(_0x11e923);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/index.js b/server/api/userVoicePrefix/index.js index 514d5a3..ad0bf7a 100644 --- a/server/api/userVoicePrefix/index.js +++ b/server/api/userVoicePrefix/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(_0x26e3db,_0x5e3959){var _0x491b3d=function(_0x1d07d0){while(--_0x1d07d0){_0x26e3db['push'](_0x26e3db['shift']());}};_0x491b3d(++_0x5e3959);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5da267,_0x4ef97e){var _0x26eb70=function(_0x29e7ea){while(--_0x29e7ea){_0x5da267['push'](_0x5da267['shift']());}};_0x26eb70(++_0x4ef97e);}(_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/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e57f8e2..accad59 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4d4=['INTEGER','sequelize','exports'];(function(_0x545aa2,_0x23d741){var _0x339f0a=function(_0x18cdc6){while(--_0x18cdc6){_0x545aa2['push'](_0x545aa2['shift']());}};_0x339f0a(++_0x23d741);}(_0xc4d4,0x70));var _0x4c4d=function(_0x281d23,_0x20d215){_0x281d23=_0x281d23-0x0;var _0x6b91db=_0xc4d4[_0x281d23];return _0x6b91db;};'use strict';var Sequelize=require(_0x4c4d('0x0'));module[_0x4c4d('0x1')]={'UserId':{'type':Sequelize[_0x4c4d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4c4d('0x2')]}}; \ No newline at end of file +var _0x69dd=['sequelize','exports','INTEGER'];(function(_0x3c707d,_0xfb5ed0){var _0x2f3a31=function(_0x4a1801){while(--_0x4a1801){_0x3c707d['push'](_0x3c707d['shift']());}};_0x2f3a31(++_0xfb5ed0);}(_0x69dd,0x1a4));var _0xd69d=function(_0x32443e,_0x2d7d32){_0x32443e=_0x32443e-0x0;var _0x2aa089=_0x69dd[_0x32443e];return _0x2aa089;};'use strict';var Sequelize=require(_0xd69d('0x0'));module[_0xd69d('0x1')]={'UserId':{'type':Sequelize[_0xd69d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd69d('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 154bf28..fa1e042 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1cb8ae,_0x46b6b8){var _0x80b20=function(_0x42be94){while(--_0x42be94){_0x1cb8ae['push'](_0x1cb8ae['shift']());}};_0x80b20(++_0x46b6b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2a4eea,_0x52f941){var _0x44343e=function(_0x550bf9){while(--_0x550bf9){_0x2a4eea['push'](_0x2a4eea['shift']());}};_0x44343e(++_0x52f941);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.rpc.js b/server/api/userVoicePrefix/userVoicePrefix.rpc.js index 19ff91f..aa04859 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.rpc.js +++ b/server/api/userVoicePrefix/userVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3b1=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserVoicePrefix,\x20%s,\x20%s,\x20%s','error','code','UserVoicePrefix,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1bfbd8,_0x1e96d4){var _0x16b128=function(_0x59af4f){while(--_0x59af4f){_0x1bfbd8['push'](_0x1bfbd8['shift']());}};_0x16b128(++_0x1e96d4);}(_0xe3b1,0x1b0));var _0x1e3b=function(_0x1aa1fd,_0x2d4984){_0x1aa1fd=_0x1aa1fd-0x0;var _0x68be6=_0xe3b1[_0x1aa1fd];return _0x68be6;};'use strict';var _=require('lodash');var util=require(_0x1e3b('0x0'));var moment=require(_0x1e3b('0x1'));var BPromise=require(_0x1e3b('0x2'));var rs=require(_0x1e3b('0x3'));var fs=require('fs');var Redis=require(_0x1e3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e3b('0x5'));var logger=require(_0x1e3b('0x6'))(_0x1e3b('0x7'));var config=require(_0x1e3b('0x8'));var jayson=require(_0x1e3b('0x9'));var client=jayson[_0x1e3b('0xa')][_0x1e3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x190190,_0x3641a8,_0x2202c2){return new BPromise(function(_0x1b261a,_0xae5704){return client['request'](_0x190190,_0x2202c2)[_0x1e3b('0xc')](function(_0x231c65){logger[_0x1e3b('0xd')]('UserVoicePrefix,\x20%s,\x20%s',_0x3641a8,_0x1e3b('0xe'));logger[_0x1e3b('0xf')](_0x1e3b('0x10'),_0x3641a8,_0x1e3b('0xe'),JSON['stringify'](_0x231c65));if(_0x231c65['error']){if(_0x231c65[_0x1e3b('0x11')][_0x1e3b('0x12')]===0x1f4){logger[_0x1e3b('0x11')](_0x1e3b('0x13'),_0x3641a8,_0x231c65[_0x1e3b('0x11')][_0x1e3b('0x14')]);return _0xae5704(_0x231c65[_0x1e3b('0x11')]['message']);}logger[_0x1e3b('0x11')](_0x1e3b('0x13'),_0x3641a8,_0x231c65['error']['message']);return _0x1b261a(_0x231c65[_0x1e3b('0x11')]['message']);}else{logger[_0x1e3b('0xd')]('UserVoicePrefix,\x20%s,\x20%s',_0x3641a8,_0x1e3b('0xe'));_0x1b261a(_0x231c65['result'][_0x1e3b('0x14')]);}})[_0x1e3b('0x15')](function(_0x1fe429){logger['error']('UserVoicePrefix,\x20%s,\x20%s',_0x3641a8,_0x1fe429);_0xae5704(_0x1fe429);});});} \ No newline at end of file +var _0x07b9=['debug','code','error','message','info','request\x20sent','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserVoicePrefix,\x20%s,\x20%s'];(function(_0x1c74f6,_0x34f202){var _0x3784c7=function(_0x2cdbe9){while(--_0x2cdbe9){_0x1c74f6['push'](_0x1c74f6['shift']());}};_0x3784c7(++_0x34f202);}(_0x07b9,0x12d));var _0x907b=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x07b9[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var moment=require(_0x907b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x907b('0x3'));var db=require(_0x907b('0x4'))['db'];var utils=require(_0x907b('0x5'));var logger=require(_0x907b('0x6'))(_0x907b('0x7'));var config=require(_0x907b('0x8'));var jayson=require(_0x907b('0x9'));var client=jayson[_0x907b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fc6aa,_0x37700a,_0x54d86f){return new BPromise(function(_0x1ee77c,_0x26ee35){return client[_0x907b('0xb')](_0x1fc6aa,_0x54d86f)[_0x907b('0xc')](function(_0x1e33bd){logger['info'](_0x907b('0xd'),_0x37700a,'request\x20sent');logger[_0x907b('0xe')]('UserVoicePrefix,\x20%s,\x20%s,\x20%s',_0x37700a,'request\x20sent',JSON['stringify'](_0x1e33bd));if(_0x1e33bd['error']){if(_0x1e33bd['error'][_0x907b('0xf')]===0x1f4){logger[_0x907b('0x10')](_0x907b('0xd'),_0x37700a,_0x1e33bd['error'][_0x907b('0x11')]);return _0x26ee35(_0x1e33bd[_0x907b('0x10')][_0x907b('0x11')]);}logger['error'](_0x907b('0xd'),_0x37700a,_0x1e33bd[_0x907b('0x10')]['message']);return _0x1ee77c(_0x1e33bd[_0x907b('0x10')][_0x907b('0x11')]);}else{logger[_0x907b('0x12')](_0x907b('0xd'),_0x37700a,_0x907b('0x13'));_0x1ee77c(_0x1e33bd['result'][_0x907b('0x11')]);}})[_0x907b('0x14')](function(_0x12d6fd){logger['error'](_0x907b('0xd'),_0x37700a,_0x12d6fd);_0x26ee35(_0x12d6fd);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 19b9f62..61af4f2 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x506b6c,_0x196ce3){var _0x1b8b9e=function(_0x46256d){while(--_0x46256d){_0x506b6c['push'](_0x506b6c['shift']());}};_0x1b8b9e(++_0x196ce3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x23c3f4,_0x24f0b3){var _0x82f0f1=function(_0x1071d6){while(--_0x1071d6){_0x23c3f4['push'](_0x23c3f4['shift']());}};_0x82f0f1(++_0x24f0b3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index c470610..f2c3d61 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd0c=['INTEGER','exports'];(function(_0x1e8ca4,_0x36d87e){var _0xec7ee0=function(_0x3f6342){while(--_0x3f6342){_0x1e8ca4['push'](_0x1e8ca4['shift']());}};_0xec7ee0(++_0x36d87e);}(_0xdd0c,0x165));var _0xcdd0=function(_0x1ed2bb,_0x485d4b){_0x1ed2bb=_0x1ed2bb-0x0;var _0x2fab0f=_0xdd0c[_0x1ed2bb];return _0x2fab0f;};'use strict';var Sequelize=require('sequelize');module[_0xcdd0('0x0')]={'penalty':{'type':Sequelize[_0xcdd0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa91=['INTEGER','sequelize','exports'];(function(_0x1957e2,_0x300e9b){var _0x48df31=function(_0x19ec69){while(--_0x19ec69){_0x1957e2['push'](_0x1957e2['shift']());}};_0x48df31(++_0x300e9b);}(_0xaa91,0xd0));var _0x1aa9=function(_0x10b197,_0x123fba){_0x10b197=_0x10b197-0x0;var _0x26c4e1=_0xaa91[_0x10b197];return _0x26c4e1;};'use strict';var Sequelize=require(_0x1aa9('0x0'));module[_0x1aa9('0x1')]={'penalty':{'type':Sequelize[_0x1aa9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 6608afe..a79277c 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 _0x4a04=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x1070e1,_0x3a2b83){var _0x6c3f10=function(_0x53e075){while(--_0x53e075){_0x1070e1['push'](_0x1070e1['shift']());}};_0x6c3f10(++_0x3a2b83);}(_0x4a04,0x102));var _0x44a0=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x4a04[_0x30f030];return _0xf7614f;};'use strict';var _=require(_0x44a0('0x0'));var util=require(_0x44a0('0x1'));var logger=require(_0x44a0('0x2'))('api');var moment=require(_0x44a0('0x3'));var BPromise=require(_0x44a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44a0('0x5'));var rimraf=require(_0x44a0('0x6'));var config=require(_0x44a0('0x7'));var attributes=require(_0x44a0('0x8'));module[_0x44a0('0x9')]=function(_0x3cffca,_0x54e4a0){return _0x3cffca['define'](_0x44a0('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cec=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','bluebird','request-promise'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x8cec,0x104));var _0xc8ce=function(_0x5c1940,_0x2fabf8){_0x5c1940=_0x5c1940-0x0;var _0x32ded5=_0x8cec[_0x5c1940];return _0x32ded5;};'use strict';var _=require(_0xc8ce('0x0'));var util=require('util');var logger=require(_0xc8ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc8ce('0x2'));var rp=require(_0xc8ce('0x3'));var fs=require('fs');var path=require(_0xc8ce('0x4'));var rimraf=require(_0xc8ce('0x5'));var config=require(_0xc8ce('0x6'));var attributes=require(_0xc8ce('0x7'));module[_0xc8ce('0x8')]=function(_0x8f677c,_0x4662bb){return _0x8f677c[_0xc8ce('0x9')](_0xc8ce('0xa'),attributes,{'tableName':_0xc8ce('0xb'),'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 cd5e98a..402ee50 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 _0x8a09=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x382b80,_0x2753bd){var _0x564c6f=function(_0x3b1d9b){while(--_0x3b1d9b){_0x382b80['push'](_0x382b80['shift']());}};_0x564c6f(++_0x2753bd);}(_0x8a09,0x115));var _0x98a0=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8a09[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x98a0('0x0'));var util=require(_0x98a0('0x1'));var moment=require(_0x98a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x98a0('0x3'));var fs=require('fs');var Redis=require(_0x98a0('0x4'));var db=require(_0x98a0('0x5'))['db'];var utils=require(_0x98a0('0x6'));var logger=require(_0x98a0('0x7'))('rpc');var config=require(_0x98a0('0x8'));var jayson=require(_0x98a0('0x9'));var client=jayson[_0x98a0('0xa')][_0x98a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e1d0,_0x3481c6,_0xacd020){return new BPromise(function(_0xd45fc,_0x602c51){return client[_0x98a0('0xc')](_0x4e1d0,_0xacd020)[_0x98a0('0xd')](function(_0x394c9f){logger[_0x98a0('0xe')](_0x98a0('0xf'),_0x3481c6,_0x98a0('0x10'));logger[_0x98a0('0x11')](_0x98a0('0x12'),_0x3481c6,_0x98a0('0x10'),JSON[_0x98a0('0x13')](_0x394c9f));if(_0x394c9f[_0x98a0('0x14')]){if(_0x394c9f[_0x98a0('0x14')][_0x98a0('0x15')]===0x1f4){logger[_0x98a0('0x14')](_0x98a0('0xf'),_0x3481c6,_0x394c9f['error']['message']);return _0x602c51(_0x394c9f[_0x98a0('0x14')]['message']);}logger[_0x98a0('0x14')](_0x98a0('0xf'),_0x3481c6,_0x394c9f['error'][_0x98a0('0x16')]);return _0xd45fc(_0x394c9f[_0x98a0('0x14')][_0x98a0('0x16')]);}else{logger['info'](_0x98a0('0xf'),_0x3481c6,_0x98a0('0x10'));_0xd45fc(_0x394c9f[_0x98a0('0x17')][_0x98a0('0x16')]);}})[_0x98a0('0x18')](function(_0x1ccb48){logger[_0x98a0('0x14')](_0x98a0('0xf'),_0x3481c6,_0x1ccb48);_0x602c51(_0x1ccb48);});});} \ No newline at end of file +var _0xb230=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','bluebird','randomstring','../../config/utils','../../config/environment','client','http'];(function(_0x2f32c4,_0x2597ba){var _0x95b5dc=function(_0x4ee89e){while(--_0x4ee89e){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x95b5dc(++_0x2597ba);}(_0xb230,0x1e8));var _0x0b23=function(_0x3ff5df,_0x40d60b){_0x3ff5df=_0x3ff5df-0x0;var _0x28acc3=_0xb230[_0x3ff5df];return _0x28acc3;};'use strict';var _=require('lodash');var util=require(_0x0b23('0x0'));var moment=require('moment');var BPromise=require(_0x0b23('0x1'));var rs=require(_0x0b23('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b23('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0b23('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0b23('0x5')][_0x0b23('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2f1cda,_0x29dd80,_0x5a0f3e){return new BPromise(function(_0x553adb,_0x2066b3){return client['request'](_0x2f1cda,_0x5a0f3e)[_0x0b23('0x7')](function(_0x1379a0){logger[_0x0b23('0x8')](_0x0b23('0x9'),_0x29dd80,_0x0b23('0xa'));logger[_0x0b23('0xb')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x29dd80,_0x0b23('0xa'),JSON['stringify'](_0x1379a0));if(_0x1379a0[_0x0b23('0xc')]){if(_0x1379a0[_0x0b23('0xc')]['code']===0x1f4){logger[_0x0b23('0xc')](_0x0b23('0x9'),_0x29dd80,_0x1379a0[_0x0b23('0xc')]['message']);return _0x2066b3(_0x1379a0[_0x0b23('0xc')]['message']);}logger['error'](_0x0b23('0x9'),_0x29dd80,_0x1379a0[_0x0b23('0xc')][_0x0b23('0xd')]);return _0x553adb(_0x1379a0[_0x0b23('0xc')]['message']);}else{logger[_0x0b23('0x8')](_0x0b23('0x9'),_0x29dd80,'request\x20sent');_0x553adb(_0x1379a0['result']['message']);}})[_0x0b23('0xe')](function(_0x19c18c){logger[_0x0b23('0xc')](_0x0b23('0x9'),_0x29dd80,_0x19c18c);_0x2066b3(_0x19c18c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d65e024..7976ffc 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2f2810,_0x441a82){var _0x15c99c=function(_0x4938be){while(--_0x4938be){_0x2f2810['push'](_0x2f2810['shift']());}};_0x15c99c(++_0x441a82);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xcb91[_0x1afabf];return _0x497ff1;};'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(_0xea1b53,_0x1dbbc6){var _0x3ff20f=function(_0xc1fb8f){while(--_0xc1fb8f){_0xea1b53['push'](_0xea1b53['shift']());}};_0x3ff20f(++_0x1dbbc6);}(_0x70e0,0x17b));var _0x070e=function(_0x590aff,_0x5b4da3){_0x590aff=_0x590aff-0x0;var _0x58aafc=_0x70e0[_0x590aff];return _0x58aafc;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 667d285..9ea0206 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 _0xfcb2=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcb2,0x1ae));var _0x2fcb=function(_0x2e27d,_0x17a945){_0x2e27d=_0x2e27d-0x0;var _0x316628=_0xfcb2[_0x2e27d];return _0x316628;};'use strict';var Sequelize=require('sequelize');module[_0x2fcb('0x0')]={'uniqueid':{'type':Sequelize[_0x2fcb('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2fcb('0x2')},'membername':{'type':Sequelize[_0x2fcb('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x2fcb('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2fcb('0x4'),'comment':_0x2fcb('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2fcb('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x2fcb('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x2fcb('0x2')},'penalty':{'type':Sequelize[_0x2fcb('0x1')](0xb),'defaultValue':0x0,'comment':_0x2fcb('0x2')},'paused':{'type':Sequelize[_0x2fcb('0x1')](0xb),'defaultValue':0x0,'comment':_0x2fcb('0x2')}}; \ No newline at end of file +var _0xbbe2=['Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER','STRING'];(function(_0x598ec6,_0x17113e){var _0x54de2d=function(_0x11889e){while(--_0x11889e){_0x598ec6['push'](_0x598ec6['shift']());}};_0x54de2d(++_0x17113e);}(_0xbbe2,0x116));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2bbe('0x0'));module[_0x2bbe('0x1')]={'uniqueid':{'type':Sequelize[_0x2bbe('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2bbe('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x2bbe('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2bbe('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x2bbe('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2bbe('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x2bbe('0x3')],'allowNull':![],'unique':_0x2bbe('0x5'),'comment':_0x2bbe('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2bbe('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 957036b..6d9bde7 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 _0x9511=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x9511,0x1c5));var _0x1951=function(_0x2247ab,_0x3f4162){_0x2247ab=_0x2247ab-0x0;var _0x430062=_0x9511[_0x2247ab];return _0x430062;};'use strict';var EventEmitter=require(_0x1951('0x0'));var UserVoiceQueueRt=require(_0x1951('0x1'))['db'][_0x1951('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1951('0x3')](0x0);var events={'afterCreate':_0x1951('0x4'),'afterUpdate':_0x1951('0x5'),'afterDestroy':_0x1951('0x6')};function emitEvent(_0x291aca){return function(_0x41fd99,_0x9f74d1,_0x54f41c){UserVoiceQueueRtEvents[_0x1951('0x7')](_0x291aca+':'+_0x41fd99['id'],_0x41fd99);UserVoiceQueueRtEvents[_0x1951('0x7')](_0x291aca,_0x41fd99);_0x54f41c(null);};}for(var e in events){if(events[_0x1951('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x1951('0x9')](e,emitEvent(event));}}module[_0x1951('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2a6b=['remove','emit','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x26df51,_0x534482){var _0x99842c=function(_0xb92298){while(--_0xb92298){_0x26df51['push'](_0x26df51['shift']());}};_0x99842c(++_0x534482);}(_0x2a6b,0xa3));var _0xb2a6=function(_0x4ff50f,_0x4b1b21){_0x4ff50f=_0x4ff50f-0x0;var _0x79f17=_0x2a6b[_0x4ff50f];return _0x79f17;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xb2a6('0x0'))['db'][_0xb2a6('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb2a6('0x2')](0x0);var events={'afterCreate':_0xb2a6('0x3'),'afterUpdate':_0xb2a6('0x4'),'afterDestroy':_0xb2a6('0x5')};function emitEvent(_0x204e13){return function(_0x4a63e9,_0x113aee,_0x3fdfd7){UserVoiceQueueRtEvents[_0xb2a6('0x6')](_0x204e13+':'+_0x4a63e9['id'],_0x4a63e9);UserVoiceQueueRtEvents[_0xb2a6('0x6')](_0x204e13,_0x4a63e9);_0x3fdfd7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb2a6('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 619df89..f6ef5c1 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 _0x368b=['../../config/logger','api','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x368b,0x1de));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb368('0x0'));var util=require(_0xb368('0x1'));var logger=require(_0xb368('0x2'))(_0xb368('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb368('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb368('0x5'));var config=require(_0xb368('0x6'));var attributes=require(_0xb368('0x7'));module[_0xb368('0x8')]=function(_0x4a7f2b,_0x433e3e){return _0x4a7f2b['define'](_0xb368('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6903=['user_has_voice_queues_rt','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0x43709c,_0x67d59f){var _0x3f58e4=function(_0x116ea8){while(--_0x116ea8){_0x43709c['push'](_0x43709c['shift']());}};_0x3f58e4(++_0x67d59f);}(_0x6903,0xf3));var _0x3690=function(_0xf7fd68,_0x1a50ab){_0xf7fd68=_0xf7fd68-0x0;var _0x56cbff=_0x6903[_0xf7fd68];return _0x56cbff;};'use strict';var _=require('lodash');var util=require(_0x3690('0x0'));var logger=require(_0x3690('0x1'))(_0x3690('0x2'));var moment=require(_0x3690('0x3'));var BPromise=require(_0x3690('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3690('0x5'));var rimraf=require('rimraf');var config=require(_0x3690('0x6'));var attributes=require(_0x3690('0x7'));module[_0x3690('0x8')]=function(_0x4b043e,_0x5b92e1){return _0x4b043e['define'](_0x3690('0x9'),attributes,{'tableName':_0x3690('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index f043b34..9e3dc5c 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 _0xd0c9=['outboundQueuePauses','GetVoiceQueueRtPauses','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','UserVoiceQueueRt','options','sequelize','`paused`\x20=\x201,\x201,\x20null'];(function(_0x569059,_0x490d98){var _0x4c2cfb=function(_0xa90da0){while(--_0xa90da0){_0x569059['push'](_0x569059['shift']());}};_0x4c2cfb(++_0x490d98);}(_0xd0c9,0x11b));var _0x9d0c=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xd0c9[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x9d0c('0x0'));var util=require(_0x9d0c('0x1'));var moment=require(_0x9d0c('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d0c('0x3'));var fs=require('fs');var Redis=require(_0x9d0c('0x4'));var db=require(_0x9d0c('0x5'))['db'];var utils=require(_0x9d0c('0x6'));var logger=require(_0x9d0c('0x7'))('rpc');var config=require(_0x9d0c('0x8'));var jayson=require(_0x9d0c('0x9'));var client=jayson[_0x9d0c('0xa')][_0x9d0c('0xb')]({'port':0x232a});config[_0x9d0c('0xc')]=_[_0x9d0c('0xd')](config[_0x9d0c('0xc')],{'host':_0x9d0c('0xe'),'port':0x18eb});var socket=require(_0x9d0c('0xf'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x9d0c('0x10')](socket);function respondWithRpcPromise(_0x31e87d,_0x471165,_0x2cb135){return new BPromise(function(_0x3acf36,_0x45f099){return client['request'](_0x31e87d,_0x2cb135)[_0x9d0c('0x11')](function(_0x4dc0a7){logger[_0x9d0c('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x471165,_0x9d0c('0x13'));logger['debug'](_0x9d0c('0x14'),_0x471165,_0x9d0c('0x13'),JSON[_0x9d0c('0x15')](_0x4dc0a7));if(_0x4dc0a7[_0x9d0c('0x16')]){if(_0x4dc0a7[_0x9d0c('0x16')][_0x9d0c('0x17')]===0x1f4){logger[_0x9d0c('0x16')](_0x9d0c('0x18'),_0x471165,_0x4dc0a7[_0x9d0c('0x16')][_0x9d0c('0x19')]);return _0x45f099(_0x4dc0a7[_0x9d0c('0x16')][_0x9d0c('0x19')]);}logger['error'](_0x9d0c('0x18'),_0x471165,_0x4dc0a7[_0x9d0c('0x16')][_0x9d0c('0x19')]);return _0x3acf36(_0x4dc0a7[_0x9d0c('0x16')]['message']);}else{logger[_0x9d0c('0x12')](_0x9d0c('0x18'),_0x471165,_0x9d0c('0x13'));_0x3acf36(_0x4dc0a7[_0x9d0c('0x1a')]['message']);}})[_0x9d0c('0x1b')](function(_0x26c42e){logger[_0x9d0c('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x471165,_0x26c42e);_0x45f099(_0x26c42e);});});}exports['GetVoiceQueueRtPauses']=function(_0x158330){var _0x4db2ea=this;return new Promise(function(_0x3ba758,_0x4e9ec4){return db[_0x9d0c('0x1c')]['findAll']({'raw':_0x158330[_0x9d0c('0x1d')]?_0x158330['options']['raw']===undefined?!![]:![]:!![],'where':_0x158330['options']?_0x158330[_0x9d0c('0x1d')]['where']||null:null,'attributes':[[db[_0x9d0c('0x1e')]['fn']('COUNT',db[_0x9d0c('0x1e')]['fn']('IF',db[_0x9d0c('0x1e')]['literal'](_0x9d0c('0x1f')))),_0x9d0c('0x20')]]})['then'](function(_0x51d179){logger[_0x9d0c('0x12')](_0x9d0c('0x21'),_0x158330);logger[_0x9d0c('0x22')](_0x9d0c('0x21'),_0x158330,JSON[_0x9d0c('0x15')](_0x51d179));_0x3ba758(_0x51d179);})[_0x9d0c('0x1b')](function(_0x57bc01){logger[_0x9d0c('0x16')](_0x9d0c('0x21'),_0x57bc01['message'],_0x158330);_0x4e9ec4(_0x4db2ea[_0x9d0c('0x16')](0x1f4,_0x57bc01[_0x9d0c('0x19')]));});});}; \ No newline at end of file +var _0x4d73=['client','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x4d73,0x86));var _0x34d7=function(_0x5cd577,_0x52484f){_0x5cd577=_0x5cd577-0x0;var _0x4803cb=_0x4d73[_0x5cd577];return _0x4803cb;};'use strict';var _=require(_0x34d7('0x0'));var util=require('util');var moment=require(_0x34d7('0x1'));var BPromise=require(_0x34d7('0x2'));var rs=require(_0x34d7('0x3'));var fs=require('fs');var Redis=require(_0x34d7('0x4'));var db=require(_0x34d7('0x5'))['db'];var utils=require(_0x34d7('0x6'));var logger=require(_0x34d7('0x7'))(_0x34d7('0x8'));var config=require(_0x34d7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x34d7('0xa')]['http']({'port':0x232a});config[_0x34d7('0xb')]=_[_0x34d7('0xc')](config[_0x34d7('0xb')],{'host':_0x34d7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x34d7('0xe'))[_0x34d7('0xf')](socket);function respondWithRpcPromise(_0x270865,_0x34eced,_0xe23c1d){return new BPromise(function(_0x35c8f5,_0x27453b){return client[_0x34d7('0x10')](_0x270865,_0xe23c1d)[_0x34d7('0x11')](function(_0x1e1ef8){logger['info'](_0x34d7('0x12'),_0x34eced,'request\x20sent');logger[_0x34d7('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x34eced,'request\x20sent',JSON[_0x34d7('0x14')](_0x1e1ef8));if(_0x1e1ef8[_0x34d7('0x15')]){if(_0x1e1ef8[_0x34d7('0x15')][_0x34d7('0x16')]===0x1f4){logger[_0x34d7('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x34eced,_0x1e1ef8[_0x34d7('0x15')][_0x34d7('0x17')]);return _0x27453b(_0x1e1ef8[_0x34d7('0x15')][_0x34d7('0x17')]);}logger[_0x34d7('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x34eced,_0x1e1ef8[_0x34d7('0x15')][_0x34d7('0x17')]);return _0x35c8f5(_0x1e1ef8[_0x34d7('0x15')][_0x34d7('0x17')]);}else{logger[_0x34d7('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x34eced,'request\x20sent');_0x35c8f5(_0x1e1ef8[_0x34d7('0x19')][_0x34d7('0x17')]);}})[_0x34d7('0x1a')](function(_0x370468){logger[_0x34d7('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x34eced,_0x370468);_0x27453b(_0x370468);});});}exports['GetVoiceQueueRtPauses']=function(_0x27ff16){var _0x37b168=this;return new Promise(function(_0x5e3789,_0x407f02){return db[_0x34d7('0x1b')][_0x34d7('0x1c')]({'raw':_0x27ff16['options']?_0x27ff16['options']['raw']===undefined?!![]:![]:!![],'where':_0x27ff16[_0x34d7('0x1d')]?_0x27ff16['options'][_0x34d7('0x1e')]||null:null,'attributes':[[db[_0x34d7('0x1f')]['fn'](_0x34d7('0x20'),db[_0x34d7('0x1f')]['fn']('IF',db[_0x34d7('0x1f')]['literal'](_0x34d7('0x21')))),_0x34d7('0x22')]]})[_0x34d7('0x11')](function(_0x7aba48){logger[_0x34d7('0x18')]('GetVoiceQueueRtPauses',_0x27ff16);logger[_0x34d7('0x13')](_0x34d7('0x23'),_0x27ff16,JSON['stringify'](_0x7aba48));_0x5e3789(_0x7aba48);})[_0x34d7('0x1a')](function(_0x436822){logger['error'](_0x34d7('0x23'),_0x436822['message'],_0x27ff16);_0x407f02(_0x37b168[_0x34d7('0x15')](0x1f4,_0x436822[_0x34d7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 67ee456..cf704c6 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 _0x3248=['remove','update','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0x3248,0x1b0));var _0x8324=function(_0x3c3b50,_0x5eb516){_0x3c3b50=_0x3c3b50-0x0;var _0x32598d=_0x3248[_0x3c3b50];return _0x32598d;};'use strict';var UserVoiceQueueRtEvents=require(_0x8324('0x0'));var events=[_0x8324('0x1'),_0x8324('0x2'),_0x8324('0x3')];function createListener(_0x9b580,_0x23b671){return function(_0x3ab598){_0x23b671['emit'](_0x9b580,_0x3ab598);};}function removeListener(_0x4c565b,_0x2e46f3){return function(){UserVoiceQueueRtEvents[_0x8324('0x4')](_0x4c565b,_0x2e46f3);};}exports['register']=function(_0x18edd2){for(var _0x283f5f=0x0,_0x446423=events[_0x8324('0x5')];_0x283f5f<_0x446423;_0x283f5f++){var _0x215c15=events[_0x283f5f];var _0x5d5f01=createListener(_0x8324('0x6')+_0x215c15,_0x18edd2);UserVoiceQueueRtEvents['on'](_0x215c15,_0x5d5f01);}}; \ No newline at end of file +var _0x3837=['save','update','emit','length','userVoiceQueueRt:'];(function(_0x5351b1,_0x229eaa){var _0x2b19d6=function(_0x52301b){while(--_0x52301b){_0x5351b1['push'](_0x5351b1['shift']());}};_0x2b19d6(++_0x229eaa);}(_0x3837,0x1d1));var _0x7383=function(_0x2f02ee,_0x4a824f){_0x2f02ee=_0x2f02ee-0x0;var _0x1fc8ae=_0x3837[_0x2f02ee];return _0x1fc8ae;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x7383('0x0'),'remove',_0x7383('0x1')];function createListener(_0x59d6d8,_0x17297e){return function(_0x35439d){_0x17297e[_0x7383('0x2')](_0x59d6d8,_0x35439d);};}function removeListener(_0x227ab2,_0xf57468){return function(){UserVoiceQueueRtEvents['removeListener'](_0x227ab2,_0xf57468);};}exports['register']=function(_0x10de5f){for(var _0x408b8d=0x0,_0x24f21f=events[_0x7383('0x3')];_0x408b8d<_0x24f21f;_0x408b8d++){var _0x193cbf=events[_0x408b8d];var _0x2ad510=createListener(_0x7383('0x4')+_0x193cbf,_0x10de5f);UserVoiceQueueRtEvents['on'](_0x193cbf,_0x2ad510);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 366cdcf..916c734 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x31b1ab,_0x48d0e2){var _0x36f73a=function(_0x3e09d8){while(--_0x3e09d8){_0x31b1ab['push'](_0x31b1ab['shift']());}};_0x36f73a(++_0x48d0e2);}(_0x70e0,0x17b));var _0x070e=function(_0x550776,_0x39e99a){_0x550776=_0x550776-0x0;var _0x15284a=_0x70e0[_0x550776];return _0x15284a;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xafc23b,_0x236dbe){var _0x4c0383=function(_0x5f3e23){while(--_0x5f3e23){_0xafc23b['push'](_0xafc23b['shift']());}};_0x4c0383(++_0x236dbe);}(_0x70e0,0x17b));var _0x070e=function(_0x420085,_0x5b66f5){_0x420085=_0x420085-0x0;var _0x1143d3=_0x70e0[_0x420085];return _0x1143d3;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 806e184..6667afe 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 _0x1b32=['exports','INTEGER','sequelize'];(function(_0x764072,_0x4dbb95){var _0x2f3ba4=function(_0x46d8e3){while(--_0x46d8e3){_0x764072['push'](_0x764072['shift']());}};_0x2f3ba4(++_0x4dbb95);}(_0x1b32,0x149));var _0x21b3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1b32[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x21b3('0x0'));module[_0x21b3('0x1')]={'penalty':{'type':Sequelize[_0x21b3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeff8=['sequelize','exports'];(function(_0x53f384,_0x21bc47){var _0x4ef7bc=function(_0x3ea255){while(--_0x3ea255){_0x53f384['push'](_0x53f384['shift']());}};_0x4ef7bc(++_0x21bc47);}(_0xeff8,0x186));var _0x8eff=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xeff8[_0x1646fa];return _0x5a47a5;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('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 d7889cf..3882746 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 _0x8ae6=['rimraf','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x262ee9,_0x355b6e){var _0x117287=function(_0x1236fb){while(--_0x1236fb){_0x262ee9['push'](_0x262ee9['shift']());}};_0x117287(++_0x355b6e);}(_0x8ae6,0xbf));var _0x68ae=function(_0x23b870,_0x3f8ee6){_0x23b870=_0x23b870-0x0;var _0x3e1b8d=_0x8ae6[_0x23b870];return _0x3e1b8d;};'use strict';var _=require(_0x68ae('0x0'));var util=require(_0x68ae('0x1'));var logger=require(_0x68ae('0x2'))(_0x68ae('0x3'));var moment=require(_0x68ae('0x4'));var BPromise=require(_0x68ae('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x68ae('0x6'));var rimraf=require(_0x68ae('0x7'));var config=require('../../config/environment');var attributes=require(_0x68ae('0x8'));module['exports']=function(_0x768323,_0x7e5d43){return _0x768323['define'](_0x68ae('0x9'),attributes,{'tableName':_0x68ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ff6=['request-promise','path','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2e7d47,_0x309060){var _0x58921d=function(_0x5b598a){while(--_0x5b598a){_0x2e7d47['push'](_0x2e7d47['shift']());}};_0x58921d(++_0x309060);}(_0x0ff6,0x73));var _0x60ff=function(_0x17ae58,_0x53a35a){_0x17ae58=_0x17ae58-0x0;var _0x54355e=_0x0ff6[_0x17ae58];return _0x54355e;};'use strict';var _=require(_0x60ff('0x0'));var util=require('util');var logger=require(_0x60ff('0x1'))(_0x60ff('0x2'));var moment=require(_0x60ff('0x3'));var BPromise=require(_0x60ff('0x4'));var rp=require(_0x60ff('0x5'));var fs=require('fs');var path=require(_0x60ff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60ff('0x7'));module[_0x60ff('0x8')]=function(_0x220d80,_0x3437ee){return _0x220d80[_0x60ff('0x9')](_0x60ff('0xa'),attributes,{'tableName':_0x60ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index f0142ee..20966dd 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 _0xea1c=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x46b979,_0x3f0e9a){var _0x355217=function(_0x3c297d){while(--_0x3c297d){_0x46b979['push'](_0x46b979['shift']());}};_0x355217(++_0x3f0e9a);}(_0xea1c,0x14e));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcea1('0x0'));var util=require('util');var moment=require(_0xcea1('0x1'));var BPromise=require('bluebird');var rs=require(_0xcea1('0x2'));var fs=require('fs');var Redis=require(_0xcea1('0x3'));var db=require(_0xcea1('0x4'))['db'];var utils=require(_0xcea1('0x5'));var logger=require(_0xcea1('0x6'))(_0xcea1('0x7'));var config=require(_0xcea1('0x8'));var jayson=require(_0xcea1('0x9'));var client=jayson[_0xcea1('0xa')][_0xcea1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x160c12,_0x55cd53,_0x5c3bf1){return new BPromise(function(_0x4c7908,_0x1121c4){return client['request'](_0x160c12,_0x5c3bf1)['then'](function(_0x3e7689){logger[_0xcea1('0xc')](_0xcea1('0xd'),_0x55cd53,_0xcea1('0xe'));logger[_0xcea1('0xf')](_0xcea1('0x10'),_0x55cd53,_0xcea1('0xe'),JSON['stringify'](_0x3e7689));if(_0x3e7689[_0xcea1('0x11')]){if(_0x3e7689['error'][_0xcea1('0x12')]===0x1f4){logger[_0xcea1('0x11')](_0xcea1('0xd'),_0x55cd53,_0x3e7689[_0xcea1('0x11')][_0xcea1('0x13')]);return _0x1121c4(_0x3e7689[_0xcea1('0x11')][_0xcea1('0x13')]);}logger[_0xcea1('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x55cd53,_0x3e7689[_0xcea1('0x11')][_0xcea1('0x13')]);return _0x4c7908(_0x3e7689[_0xcea1('0x11')][_0xcea1('0x13')]);}else{logger[_0xcea1('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x55cd53,_0xcea1('0xe'));_0x4c7908(_0x3e7689[_0xcea1('0x14')][_0xcea1('0x13')]);}})[_0xcea1('0x15')](function(_0x3c6bd8){logger[_0xcea1('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x55cd53,_0x3c6bd8);_0x1121c4(_0x3c6bd8);});});} \ No newline at end of file +var _0x20ec=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3d3d29,_0x46f08e){var _0x49b139=function(_0x4bf3e2){while(--_0x4bf3e2){_0x3d3d29['push'](_0x3d3d29['shift']());}};_0x49b139(++_0x46f08e);}(_0x20ec,0x169));var _0xc20e=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0x20ec[_0x322bef];return _0x229e60;};'use strict';var _=require(_0xc20e('0x0'));var util=require(_0xc20e('0x1'));var moment=require(_0xc20e('0x2'));var BPromise=require(_0xc20e('0x3'));var rs=require(_0xc20e('0x4'));var fs=require('fs');var Redis=require(_0xc20e('0x5'));var db=require(_0xc20e('0x6'))['db'];var utils=require(_0xc20e('0x7'));var logger=require(_0xc20e('0x8'))(_0xc20e('0x9'));var config=require(_0xc20e('0xa'));var jayson=require(_0xc20e('0xb'));var client=jayson[_0xc20e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0baa,_0x51d0e3,_0x391bc1){return new BPromise(function(_0x201af8,_0x560e05){return client[_0xc20e('0xd')](_0x2f0baa,_0x391bc1)[_0xc20e('0xe')](function(_0xef3011){logger[_0xc20e('0xf')](_0xc20e('0x10'),_0x51d0e3,_0xc20e('0x11'));logger['debug'](_0xc20e('0x12'),_0x51d0e3,_0xc20e('0x11'),JSON['stringify'](_0xef3011));if(_0xef3011[_0xc20e('0x13')]){if(_0xef3011[_0xc20e('0x13')][_0xc20e('0x14')]===0x1f4){logger[_0xc20e('0x13')](_0xc20e('0x10'),_0x51d0e3,_0xef3011[_0xc20e('0x13')]['message']);return _0x560e05(_0xef3011[_0xc20e('0x13')][_0xc20e('0x15')]);}logger[_0xc20e('0x13')](_0xc20e('0x10'),_0x51d0e3,_0xef3011[_0xc20e('0x13')]['message']);return _0x201af8(_0xef3011[_0xc20e('0x13')][_0xc20e('0x15')]);}else{logger[_0xc20e('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x51d0e3,_0xc20e('0x11'));_0x201af8(_0xef3011[_0xc20e('0x16')][_0xc20e('0x15')]);}})[_0xc20e('0x17')](function(_0x8c17a4){logger[_0xc20e('0x13')](_0xc20e('0x10'),_0x51d0e3,_0x8c17a4);_0x560e05(_0x8c17a4);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 62e0ca9..a93814a 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 _0x9bde=['index','/:id','isAuthenticated','show','post','create','put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9bde,0xe1));var _0xe9bd=function(_0x32fe3c,_0x47d9cb){_0x32fe3c=_0x32fe3c-0x0;var _0x3573ce=_0x9bde[_0x32fe3c];return _0x3573ce;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0xd')]('/',auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')](_0xe9bd('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe9bd('0x10')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller['destroy']);module[_0xe9bd('0x11')]=router; \ No newline at end of file +var _0x2029=['isAuthenticated','index','show','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0x14aa3a,_0x1b60df){var _0x497376=function(_0x255da4){while(--_0x255da4){_0x14aa3a['push'](_0x14aa3a['shift']());}};_0x497376(++_0x1b60df);}(_0x2029,0x171));var _0x9202=function(_0x33290f,_0x17bf9d){_0x33290f=_0x33290f-0x0;var _0x551a32=_0x2029[_0x33290f];return _0x551a32;};'use strict';var multer=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var path=require('path');var timeout=require(_0x9202('0x2'));var express=require(_0x9202('0x3'));var router=express[_0x9202('0x4')]();var fs_extra=require(_0x9202('0x5'));var auth=require(_0x9202('0x6'));var interaction=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var controller=require(_0x9202('0x9'));router[_0x9202('0xa')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0xc')]);router[_0x9202('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9202('0xd')]);router['post']('/',auth[_0x9202('0xb')](),controller[_0x9202('0xe')]);router['put'](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x10')]);router[_0x9202('0x11')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x12')]);module[_0x9202('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 2c60478..e0c6e63 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 _0xf6ca=['STRING','sequelize','exports'];(function(_0x2c090c,_0x1fab01){var _0x609f1b=function(_0x35d80b){while(--_0x35d80b){_0x2c090c['push'](_0x2c090c['shift']());}};_0x609f1b(++_0x1fab01);}(_0xf6ca,0x11e));var _0xaf6c=function(_0x3b9f2c,_0x29be9d){_0x3b9f2c=_0x3b9f2c-0x0;var _0x179db8=_0xf6ca[_0x3b9f2c];return _0x179db8;};'use strict';var Sequelize=require(_0xaf6c('0x0'));module[_0xaf6c('0x1')]={'name':{'type':Sequelize[_0xaf6c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaf6c('0x2')]}}; \ No newline at end of file +var _0x3967=['name','sequelize','exports','STRING'];(function(_0x4eb2e9,_0x6c5012){var _0xe191a1=function(_0xfd36a8){while(--_0xfd36a8){_0x4eb2e9['push'](_0x4eb2e9['shift']());}};_0xe191a1(++_0x6c5012);}(_0x3967,0x159));var _0x7396=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0x3967[_0x453e2b];return _0x50f306;};'use strict';var Sequelize=require(_0x7396('0x0'));module[_0x7396('0x1')]={'name':{'type':Sequelize[_0x7396('0x2')],'unique':_0x7396('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7396('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f34c145..7ef69a3 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 _0x0364=['json','apply','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','Content-Range'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x0364,0x1c9));var _0x4036=function(_0x2b118b,_0x52d998){_0x2b118b=_0x2b118b-0x0;var _0x53f931=_0x0364[_0x2b118b];return _0x53f931;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4036('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4036('0x1'));var BPromise=require(_0x4036('0x2'));var Mustache=require(_0x4036('0x3'));var util=require(_0x4036('0x4'));var path=require(_0x4036('0x5'));var sox=require(_0x4036('0x6'));var csv=require(_0x4036('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4036('0x8'));var _=require(_0x4036('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4036('0xa'));var deskjs=require(_0x4036('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4036('0xc'));var Papa=require(_0x4036('0xd'));var Redis=require(_0x4036('0xe'));var authService=require(_0x4036('0xf'));var qs=require(_0x4036('0x10'));var as=require(_0x4036('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4036('0x12'))(_0x4036('0x13'));var utils=require(_0x4036('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4036('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b64a1,_0x26b63c){_0x26b63c=_0x26b63c||0xcc;return function(_0x424b5c){if(_0x424b5c){return _0x3b64a1[_0x4036('0x16')](_0x26b63c);}return _0x3b64a1[_0x4036('0x17')](_0x26b63c)[_0x4036('0x18')]();};}function respondWithResult(_0x5d1529,_0x2a1002){_0x2a1002=_0x2a1002||0xc8;return function(_0x4d2b09){if(_0x4d2b09){return _0x5d1529[_0x4036('0x17')](_0x2a1002)['json'](_0x4d2b09);}};}function respondWithFilteredResult(_0x172440,_0x42f004){return function(_0x4fe3bf){if(_0x4fe3bf){var _0x208d3c=typeof _0x42f004['offset']==='undefined'&&typeof _0x42f004['limit']===_0x4036('0x19');var _0xf8930a=_0x4fe3bf[_0x4036('0x1a')];var _0x2fa8ac=_0x208d3c?0x0:_0x42f004[_0x4036('0x1b')];var _0x34d01f=_0x208d3c?_0x4fe3bf['count']:_0x42f004[_0x4036('0x1b')]+_0x42f004['limit'];var _0x3daa9d;if(_0x34d01f>=_0xf8930a){_0x34d01f=_0xf8930a;_0x3daa9d=0xc8;}else{_0x3daa9d=0xce;}_0x172440[_0x4036('0x17')](_0x3daa9d);return _0x172440['set'](_0x4036('0x1c'),_0x2fa8ac+'-'+_0x34d01f+'/'+_0xf8930a)[_0x4036('0x1d')](_0x4fe3bf);}return null;};}function patchUpdates(_0x4a27e9){return function(_0x25f128){try{jsonpatch[_0x4036('0x1e')](_0x25f128,_0x4a27e9,!![]);}catch(_0x1909b1){return BPromise['reject'](_0x1909b1);}return _0x25f128[_0x4036('0x1f')]();};}function saveUpdates(_0x129cea,_0x513647){return function(_0xd21acc){if(_0xd21acc){return _0xd21acc[_0x4036('0x20')](_0x129cea)[_0x4036('0x21')](function(_0x5a9853){return _0x5a9853;});}return null;};}function removeEntity(_0x3809da,_0x2b4db5){return function(_0x5a8d70){if(_0x5a8d70){return _0x5a8d70['destroy']()['then'](function(){var _0x281f24=_0x5a8d70[_0x4036('0x22')]({'plain':!![]});var _0x5bbbde=_0x4036('0x23');return db[_0x4036('0x24')][_0x4036('0x25')]({'where':{'type':_0x5bbbde,'resourceId':_0x281f24['id']}})[_0x4036('0x21')](function(){return _0x5a8d70;});})[_0x4036('0x21')](function(){_0x3809da[_0x4036('0x17')](0xcc)[_0x4036('0x18')]();});}};}function handleEntityNotFound(_0x27f309,_0x91b793){return function(_0x5e716d){if(!_0x5e716d){_0x27f309[_0x4036('0x16')](0x194);}return _0x5e716d;};}function handleError(_0x59a703,_0x1196a3){_0x1196a3=_0x1196a3||0x1f4;return function(_0x2db56d){logger[_0x4036('0x26')](_0x2db56d[_0x4036('0x27')]);if(_0x2db56d['name']){delete _0x2db56d[_0x4036('0x28')];}_0x59a703[_0x4036('0x17')](_0x1196a3)[_0x4036('0x29')](_0x2db56d);};}exports[_0x4036('0x2a')]=function(_0x1dd875,_0x5c901a){var _0x5dd6a5={},_0x4a6805={},_0xcc6e00={'count':0x0,'rows':[]};var _0x1ace75=_[_0x4036('0x2b')](db[_0x4036('0x2c')][_0x4036('0x2d')],function(_0x1a8446){return{'name':_0x1a8446['fieldName'],'type':_0x1a8446['type'][_0x4036('0x2e')]};});_0x4a6805[_0x4036('0x2f')]=_['map'](_0x1ace75,_0x4036('0x28'));_0x4a6805[_0x4036('0x30')]=_[_0x4036('0x31')](_0x1dd875[_0x4036('0x30')]);_0x4a6805['filters']=_['intersection'](_0x4a6805[_0x4036('0x2f')],_0x4a6805[_0x4036('0x30')]);_0x5dd6a5['attributes']=_[_0x4036('0x32')](_0x4a6805[_0x4036('0x2f')],qs[_0x4036('0x33')](_0x1dd875[_0x4036('0x30')][_0x4036('0x33')]));_0x5dd6a5['attributes']=_0x5dd6a5[_0x4036('0x34')]['length']?_0x5dd6a5[_0x4036('0x34')]:_0x4a6805[_0x4036('0x2f')];if(!_0x1dd875[_0x4036('0x30')][_0x4036('0x35')](_0x4036('0x36'))){_0x5dd6a5['limit']=qs[_0x4036('0x37')](_0x1dd875[_0x4036('0x30')][_0x4036('0x37')]);_0x5dd6a5[_0x4036('0x1b')]=qs['offset'](_0x1dd875['query'][_0x4036('0x1b')]);}_0x5dd6a5[_0x4036('0x38')]=qs[_0x4036('0x39')](_0x1dd875[_0x4036('0x30')][_0x4036('0x39')]);_0x5dd6a5[_0x4036('0x3a')]=qs[_0x4036('0x3b')](_[_0x4036('0x3c')](_0x1dd875[_0x4036('0x30')],_0x4a6805[_0x4036('0x3b')]),_0x1ace75);if(_0x1dd875['query'][_0x4036('0x3d')]){_0x5dd6a5[_0x4036('0x3a')]=_[_0x4036('0x3e')](_0x5dd6a5[_0x4036('0x3a')],{'$or':_[_0x4036('0x2b')](_0x1ace75,function(_0xd2768d){if(_0xd2768d['type']!==_0x4036('0x3f')){var _0x413b54={};_0x413b54[_0xd2768d[_0x4036('0x28')]]={'$like':'%'+_0x1dd875['query'][_0x4036('0x3d')]+'%'};return _0x413b54;}})});}_0x5dd6a5=_[_0x4036('0x3e')]({},_0x5dd6a5,_0x1dd875[_0x4036('0x40')]);var _0x21fae9={'where':_0x5dd6a5[_0x4036('0x3a')]};return db[_0x4036('0x2c')]['count'](_0x21fae9)[_0x4036('0x21')](function(_0x3f47db){_0xcc6e00['count']=_0x3f47db;if(_0x1dd875[_0x4036('0x30')][_0x4036('0x41')]){_0x5dd6a5[_0x4036('0x42')]=[{'all':!![]}];}return db[_0x4036('0x2c')][_0x4036('0x43')](_0x5dd6a5);})[_0x4036('0x21')](function(_0x3bd2cc){_0xcc6e00['rows']=_0x3bd2cc;return _0xcc6e00;})[_0x4036('0x21')](respondWithFilteredResult(_0x5c901a,_0x5dd6a5))['catch'](handleError(_0x5c901a,null));};exports['show']=function(_0x3f4a28,_0x1e03b4){var _0x2eb035={'raw':!![],'where':{'id':_0x3f4a28['params']['id']}},_0x74a8e1={};_0x74a8e1[_0x4036('0x2f')]=_[_0x4036('0x31')](db[_0x4036('0x2c')]['rawAttributes']);_0x74a8e1[_0x4036('0x30')]=_[_0x4036('0x31')](_0x3f4a28[_0x4036('0x30')]);_0x74a8e1[_0x4036('0x3b')]=_[_0x4036('0x32')](_0x74a8e1[_0x4036('0x2f')],_0x74a8e1['query']);_0x2eb035[_0x4036('0x34')]=_['intersection'](_0x74a8e1['model'],qs[_0x4036('0x33')](_0x3f4a28['query']['fields']));_0x2eb035[_0x4036('0x34')]=_0x2eb035[_0x4036('0x34')][_0x4036('0x44')]?_0x2eb035[_0x4036('0x34')]:_0x74a8e1['model'];if(_0x3f4a28[_0x4036('0x30')][_0x4036('0x41')]){_0x2eb035[_0x4036('0x42')]=[{'all':!![]}];}_0x2eb035=_[_0x4036('0x3e')]({},_0x2eb035,_0x3f4a28[_0x4036('0x40')]);return db['Variable'][_0x4036('0x45')](_0x2eb035)[_0x4036('0x21')](handleEntityNotFound(_0x1e03b4,null))[_0x4036('0x21')](respondWithResult(_0x1e03b4,null))[_0x4036('0x46')](handleError(_0x1e03b4,null));};exports[_0x4036('0x47')]=function(_0x41ef0a,_0x320a6e){return db[_0x4036('0x2c')][_0x4036('0x47')](_0x41ef0a[_0x4036('0x48')],{})[_0x4036('0x21')](function(_0x5dd52c){var _0x539099=_0x41ef0a[_0x4036('0x49')][_0x4036('0x22')]({'plain':!![]});if(!_0x539099)throw new Error(_0x4036('0x4a'));if(_0x539099[_0x4036('0x4b')]===_0x4036('0x49')){var _0x19ee35=_0x5dd52c[_0x4036('0x22')]({'plain':!![]});var _0x2e51d0=_0x4036('0x23');return db[_0x4036('0x4c')]['find']({'where':{'name':_0x2e51d0,'userProfileId':_0x539099[_0x4036('0x4d')]},'raw':!![]})[_0x4036('0x21')](function(_0x1b1ce6){if(_0x1b1ce6&&_0x1b1ce6[_0x4036('0x4e')]===0x0){return db[_0x4036('0x24')]['create']({'name':_0x19ee35['name'],'resourceId':_0x19ee35['id'],'type':_0x1b1ce6[_0x4036('0x28')],'sectionId':_0x1b1ce6['id']},{})[_0x4036('0x21')](function(){return _0x5dd52c;});}else{return _0x5dd52c;}})[_0x4036('0x46')](function(_0x3e23c6){logger[_0x4036('0x26')](_0x4036('0x4f'),_0x3e23c6);throw _0x3e23c6;});}return _0x5dd52c;})['then'](respondWithResult(_0x320a6e,0xc9))['catch'](handleError(_0x320a6e,null));};exports[_0x4036('0x20')]=function(_0x41791d,_0x1e86c3){if(_0x41791d['body']['id']){delete _0x41791d['body']['id'];}return db[_0x4036('0x2c')][_0x4036('0x45')]({'where':{'id':_0x41791d[_0x4036('0x50')]['id']}})[_0x4036('0x21')](handleEntityNotFound(_0x1e86c3,null))[_0x4036('0x21')](saveUpdates(_0x41791d[_0x4036('0x48')],null))[_0x4036('0x21')](respondWithResult(_0x1e86c3,null))[_0x4036('0x46')](handleError(_0x1e86c3,null));};exports[_0x4036('0x25')]=function(_0x16764e,_0xcbe25e){return db[_0x4036('0x2c')][_0x4036('0x45')]({'where':{'id':_0x16764e[_0x4036('0x50')]['id']}})['then'](handleEntityNotFound(_0xcbe25e,null))[_0x4036('0x21')](removeEntity(_0xcbe25e,null))[_0x4036('0x46')](handleError(_0xcbe25e,null));}; \ No newline at end of file +var _0x8e38=['create','body','role','Variables','UserProfileSection','autoAssociation','UserProfileResource','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','get','error','stack','name','send','Variable','rawAttributes','fieldName','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','include','catch','show','params','includeAll','options','find'];(function(_0x294a71,_0x2a4994){var _0xb9141=function(_0x32b079){while(--_0x32b079){_0x294a71['push'](_0x294a71['shift']());}};_0xb9141(++_0x2a4994);}(_0x8e38,0x1db));var _0x88e3=function(_0x4d69ee,_0x26b7e1){_0x4d69ee=_0x4d69ee-0x0;var _0x36c56e=_0x8e38[_0x4d69ee];return _0x36c56e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88e3('0x0'));var zipdir=require(_0x88e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88e3('0x2'));var moment=require(_0x88e3('0x3'));var BPromise=require(_0x88e3('0x4'));var Mustache=require(_0x88e3('0x5'));var util=require(_0x88e3('0x6'));var path=require(_0x88e3('0x7'));var sox=require(_0x88e3('0x8'));var csv=require(_0x88e3('0x9'));var ejs=require(_0x88e3('0xa'));var fs=require('fs');var fs_extra=require(_0x88e3('0xb'));var _=require(_0x88e3('0xc'));var squel=require('squel');var crypto=require(_0x88e3('0xd'));var jsforce=require(_0x88e3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x88e3('0xf'));var Papa=require(_0x88e3('0x10'));var Redis=require(_0x88e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x88e3('0x12'));var as=require(_0x88e3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88e3('0x14'))(_0x88e3('0x15'));var utils=require(_0x88e3('0x16'));var config=require(_0x88e3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x88e3('0x18'))['db'];function respondWithStatusCode(_0x25f5ff,_0x4e3d82){_0x4e3d82=_0x4e3d82||0xcc;return function(_0x575a1c){if(_0x575a1c){return _0x25f5ff[_0x88e3('0x19')](_0x4e3d82);}return _0x25f5ff[_0x88e3('0x1a')](_0x4e3d82)[_0x88e3('0x1b')]();};}function respondWithResult(_0x3d8ced,_0x82401e){_0x82401e=_0x82401e||0xc8;return function(_0x316bb7){if(_0x316bb7){return _0x3d8ced[_0x88e3('0x1a')](_0x82401e)['json'](_0x316bb7);}};}function respondWithFilteredResult(_0x3c7ea0,_0x32e712){return function(_0x59b1ef){if(_0x59b1ef){var _0x5b451b=typeof _0x32e712[_0x88e3('0x1c')]==='undefined'&&typeof _0x32e712[_0x88e3('0x1d')]===_0x88e3('0x1e');var _0x2f3742=_0x59b1ef[_0x88e3('0x1f')];var _0x2735ce=_0x5b451b?0x0:_0x32e712[_0x88e3('0x1c')];var _0x264309=_0x5b451b?_0x59b1ef[_0x88e3('0x1f')]:_0x32e712[_0x88e3('0x1c')]+_0x32e712[_0x88e3('0x1d')];var _0x1238ee;if(_0x264309>=_0x2f3742){_0x264309=_0x2f3742;_0x1238ee=0xc8;}else{_0x1238ee=0xce;}_0x3c7ea0[_0x88e3('0x1a')](_0x1238ee);return _0x3c7ea0[_0x88e3('0x20')](_0x88e3('0x21'),_0x2735ce+'-'+_0x264309+'/'+_0x2f3742)[_0x88e3('0x22')](_0x59b1ef);}return null;};}function patchUpdates(_0x183ab7){return function(_0x2521c0){try{jsonpatch[_0x88e3('0x23')](_0x2521c0,_0x183ab7,!![]);}catch(_0x5b5520){return BPromise['reject'](_0x5b5520);}return _0x2521c0[_0x88e3('0x24')]();};}function saveUpdates(_0x4afe5f,_0xba0714){return function(_0x58adbf){if(_0x58adbf){return _0x58adbf[_0x88e3('0x25')](_0x4afe5f)['then'](function(_0x1ce8c9){return _0x1ce8c9;});}return null;};}function removeEntity(_0x9d2fda,_0x57b051){return function(_0x403330){if(_0x403330){return _0x403330[_0x88e3('0x26')]()[_0x88e3('0x27')](function(){var _0x4e784f=_0x403330[_0x88e3('0x28')]({'plain':!![]});var _0x5ae1c5='Variables';return db['UserProfileResource'][_0x88e3('0x26')]({'where':{'type':_0x5ae1c5,'resourceId':_0x4e784f['id']}})[_0x88e3('0x27')](function(){return _0x403330;});})[_0x88e3('0x27')](function(){_0x9d2fda['status'](0xcc)[_0x88e3('0x1b')]();});}};}function handleEntityNotFound(_0x51659f,_0x505199){return function(_0x2de81b){if(!_0x2de81b){_0x51659f[_0x88e3('0x19')](0x194);}return _0x2de81b;};}function handleError(_0x23df4d,_0x3cf987){_0x3cf987=_0x3cf987||0x1f4;return function(_0x100e11){logger[_0x88e3('0x29')](_0x100e11[_0x88e3('0x2a')]);if(_0x100e11[_0x88e3('0x2b')]){delete _0x100e11['name'];}_0x23df4d['status'](_0x3cf987)[_0x88e3('0x2c')](_0x100e11);};}exports['index']=function(_0x200809,_0xb188a8){var _0x1c932d={},_0x232d7c={},_0x40497f={'count':0x0,'rows':[]};var _0x1e2bc4=_['map'](db[_0x88e3('0x2d')][_0x88e3('0x2e')],function(_0x473e14){return{'name':_0x473e14[_0x88e3('0x2f')],'type':_0x473e14['type']['key']};});_0x232d7c[_0x88e3('0x30')]=_[_0x88e3('0x31')](_0x1e2bc4,_0x88e3('0x2b'));_0x232d7c['query']=_[_0x88e3('0x32')](_0x200809[_0x88e3('0x33')]);_0x232d7c[_0x88e3('0x34')]=_['intersection'](_0x232d7c[_0x88e3('0x30')],_0x232d7c[_0x88e3('0x33')]);_0x1c932d['attributes']=_['intersection'](_0x232d7c[_0x88e3('0x30')],qs[_0x88e3('0x35')](_0x200809[_0x88e3('0x33')][_0x88e3('0x35')]));_0x1c932d[_0x88e3('0x36')]=_0x1c932d[_0x88e3('0x36')][_0x88e3('0x37')]?_0x1c932d[_0x88e3('0x36')]:_0x232d7c['model'];if(!_0x200809[_0x88e3('0x33')][_0x88e3('0x38')](_0x88e3('0x39'))){_0x1c932d[_0x88e3('0x1d')]=qs['limit'](_0x200809['query'][_0x88e3('0x1d')]);_0x1c932d[_0x88e3('0x1c')]=qs[_0x88e3('0x1c')](_0x200809[_0x88e3('0x33')][_0x88e3('0x1c')]);}_0x1c932d['order']=qs[_0x88e3('0x3a')](_0x200809[_0x88e3('0x33')][_0x88e3('0x3a')]);_0x1c932d[_0x88e3('0x3b')]=qs[_0x88e3('0x34')](_[_0x88e3('0x3c')](_0x200809[_0x88e3('0x33')],_0x232d7c[_0x88e3('0x34')]),_0x1e2bc4);if(_0x200809[_0x88e3('0x33')][_0x88e3('0x3d')]){_0x1c932d[_0x88e3('0x3b')]=_[_0x88e3('0x3e')](_0x1c932d['where'],{'$or':_['map'](_0x1e2bc4,function(_0x56fc05){if(_0x56fc05[_0x88e3('0x3f')]!=='VIRTUAL'){var _0x1611b7={};_0x1611b7[_0x56fc05['name']]={'$like':'%'+_0x200809['query'][_0x88e3('0x3d')]+'%'};return _0x1611b7;}})});}_0x1c932d=_['merge']({},_0x1c932d,_0x200809['options']);var _0x3728b0={'where':_0x1c932d[_0x88e3('0x3b')]};return db[_0x88e3('0x2d')][_0x88e3('0x1f')](_0x3728b0)[_0x88e3('0x27')](function(_0x522667){_0x40497f[_0x88e3('0x1f')]=_0x522667;if(_0x200809[_0x88e3('0x33')]['includeAll']){_0x1c932d[_0x88e3('0x40')]=[{'all':!![]}];}return db[_0x88e3('0x2d')]['findAll'](_0x1c932d);})[_0x88e3('0x27')](function(_0x3f61b9){_0x40497f['rows']=_0x3f61b9;return _0x40497f;})[_0x88e3('0x27')](respondWithFilteredResult(_0xb188a8,_0x1c932d))[_0x88e3('0x41')](handleError(_0xb188a8,null));};exports[_0x88e3('0x42')]=function(_0x2c442b,_0x48d155){var _0xafd03d={'raw':!![],'where':{'id':_0x2c442b[_0x88e3('0x43')]['id']}},_0x5c70ce={};_0x5c70ce[_0x88e3('0x30')]=_['keys'](db[_0x88e3('0x2d')][_0x88e3('0x2e')]);_0x5c70ce[_0x88e3('0x33')]=_['keys'](_0x2c442b[_0x88e3('0x33')]);_0x5c70ce[_0x88e3('0x34')]=_['intersection'](_0x5c70ce[_0x88e3('0x30')],_0x5c70ce[_0x88e3('0x33')]);_0xafd03d['attributes']=_['intersection'](_0x5c70ce['model'],qs[_0x88e3('0x35')](_0x2c442b[_0x88e3('0x33')][_0x88e3('0x35')]));_0xafd03d[_0x88e3('0x36')]=_0xafd03d[_0x88e3('0x36')][_0x88e3('0x37')]?_0xafd03d[_0x88e3('0x36')]:_0x5c70ce[_0x88e3('0x30')];if(_0x2c442b[_0x88e3('0x33')][_0x88e3('0x44')]){_0xafd03d[_0x88e3('0x40')]=[{'all':!![]}];}_0xafd03d=_[_0x88e3('0x3e')]({},_0xafd03d,_0x2c442b[_0x88e3('0x45')]);return db[_0x88e3('0x2d')][_0x88e3('0x46')](_0xafd03d)['then'](handleEntityNotFound(_0x48d155,null))[_0x88e3('0x27')](respondWithResult(_0x48d155,null))[_0x88e3('0x41')](handleError(_0x48d155,null));};exports[_0x88e3('0x47')]=function(_0x474438,_0x2e4fb4){return db[_0x88e3('0x2d')]['create'](_0x474438[_0x88e3('0x48')],{})[_0x88e3('0x27')](function(_0x2e3685){var _0x4ceb81=_0x474438['user'][_0x88e3('0x28')]({'plain':!![]});if(!_0x4ceb81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ceb81[_0x88e3('0x49')]==='user'){var _0x303100=_0x2e3685[_0x88e3('0x28')]({'plain':!![]});var _0x1e0e19=_0x88e3('0x4a');return db[_0x88e3('0x4b')]['find']({'where':{'name':_0x1e0e19,'userProfileId':_0x4ceb81['userProfileId']},'raw':!![]})['then'](function(_0x9797d3){if(_0x9797d3&&_0x9797d3[_0x88e3('0x4c')]===0x0){return db[_0x88e3('0x4d')][_0x88e3('0x47')]({'name':_0x303100[_0x88e3('0x2b')],'resourceId':_0x303100['id'],'type':_0x9797d3[_0x88e3('0x2b')],'sectionId':_0x9797d3['id']},{})[_0x88e3('0x27')](function(){return _0x2e3685;});}else{return _0x2e3685;}})[_0x88e3('0x41')](function(_0xda789a){logger[_0x88e3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xda789a);throw _0xda789a;});}return _0x2e3685;})['then'](respondWithResult(_0x2e4fb4,0xc9))[_0x88e3('0x41')](handleError(_0x2e4fb4,null));};exports[_0x88e3('0x25')]=function(_0x16d2aa,_0x46f7a5){if(_0x16d2aa[_0x88e3('0x48')]['id']){delete _0x16d2aa[_0x88e3('0x48')]['id'];}return db[_0x88e3('0x2d')][_0x88e3('0x46')]({'where':{'id':_0x16d2aa['params']['id']}})[_0x88e3('0x27')](handleEntityNotFound(_0x46f7a5,null))[_0x88e3('0x27')](saveUpdates(_0x16d2aa[_0x88e3('0x48')],null))['then'](respondWithResult(_0x46f7a5,null))[_0x88e3('0x41')](handleError(_0x46f7a5,null));};exports[_0x88e3('0x26')]=function(_0x25b2b1,_0x410856){return db[_0x88e3('0x2d')][_0x88e3('0x46')]({'where':{'id':_0x25b2b1[_0x88e3('0x43')]['id']}})['then'](handleEntityNotFound(_0x410856,null))[_0x88e3('0x27')](removeEntity(_0x410856,null))[_0x88e3('0x41')](handleError(_0x410856,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2af888b..426ccdb 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 _0xa933=['api','moment','bluebird','request-promise','path','rimraf','exports','define','tools_variables','lodash','util','../../config/logger'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xa933,0xa5));var _0x3a93=function(_0x392e5a,_0x103a58){_0x392e5a=_0x392e5a-0x0;var _0x478851=_0xa933[_0x392e5a];return _0x478851;};'use strict';var _=require(_0x3a93('0x0'));var util=require(_0x3a93('0x1'));var logger=require(_0x3a93('0x2'))(_0x3a93('0x3'));var moment=require(_0x3a93('0x4'));var BPromise=require(_0x3a93('0x5'));var rp=require(_0x3a93('0x6'));var fs=require('fs');var path=require(_0x3a93('0x7'));var rimraf=require(_0x3a93('0x8'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x3a93('0x9')]=function(_0x472b2a,_0x400141){return _0x472b2a[_0x3a93('0xa')]('Variable',attributes,{'tableName':_0x3a93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x219d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','lodash','../../config/logger'];(function(_0x331bca,_0x213352){var _0x3faedf=function(_0xb69eb5){while(--_0xb69eb5){_0x331bca['push'](_0x331bca['shift']());}};_0x3faedf(++_0x213352);}(_0x219d,0x1d2));var _0xd219=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x219d[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xd219('0x0'));var util=require('util');var logger=require(_0xd219('0x1'))(_0xd219('0x2'));var moment=require(_0xd219('0x3'));var BPromise=require(_0xd219('0x4'));var rp=require(_0xd219('0x5'));var fs=require('fs');var path=require(_0xd219('0x6'));var rimraf=require(_0xd219('0x7'));var config=require(_0xd219('0x8'));var attributes=require(_0xd219('0x9'));module[_0xd219('0xa')]=function(_0x5c3d35,_0x58df14){return _0x5c3d35['define'](_0xd219('0xb'),attributes,{'tableName':'tools_variables','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 c8f7529..0131a69 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x416a38,_0x5004e0){var _0xec6c28=function(_0xf771cd){while(--_0xf771cd){_0x416a38['push'](_0x416a38['shift']());}};_0xec6c28(++_0x5004e0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0x5fc3[_0x4914ad];return _0x3cd61f;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x8720df,_0x3f41ea){var _0x44b435=function(_0x4a5625){while(--_0x4a5625){_0x8720df['push'](_0x8720df['shift']());}};_0x44b435(++_0x3f41ea);}(_0x1cb9,0x14e));var _0x91cb=function(_0x55751a,_0x5a4045){_0x55751a=_0x55751a-0x0;var _0x4eb6ba=_0x1cb9[_0x55751a];return _0x4eb6ba;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4e04753..b9c2085 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 _0x334d=['canUpdate','fetch','/reset','reset','/pull','/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','index','get','/fetch','isAuthenticated'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x334d,0x11a));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xd334('0x0'));var router=express[_0xd334('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd334('0x2'));router['get']('/',controller[_0xd334('0x3')]);router[_0xd334('0x4')](_0xd334('0x5'),auth[_0xd334('0x6')](),auth[_0xd334('0x7')](),controller[_0xd334('0x8')]);router[_0xd334('0x4')](_0xd334('0x9'),auth[_0xd334('0x6')](),auth[_0xd334('0x7')](),controller[_0xd334('0xa')]);router[_0xd334('0x4')](_0xd334('0xb'),auth[_0xd334('0x6')](),auth[_0xd334('0x7')](),controller['pull']);router[_0xd334('0x4')](_0xd334('0xc'),auth[_0xd334('0x6')](),controller[_0xd334('0xd')]);router[_0xd334('0x4')](_0xd334('0xe'),controller[_0xd334('0xf')]);module[_0xd334('0x10')]=router; \ No newline at end of file +var _0xa5aa=['/pull','isAuthenticated','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','canUpdate','fetch','reset'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0xa5aa,0x176));var _0xaa5a=function(_0x3ed9a7,_0x36d957){_0x3ed9a7=_0x3ed9a7-0x0;var _0x348761=_0xa5aa[_0x3ed9a7];return _0x348761;};'use strict';var express=require(_0xaa5a('0x0'));var router=express[_0xaa5a('0x1')]();var auth=require(_0xaa5a('0x2'));var controller=require(_0xaa5a('0x3'));router['get']('/',controller[_0xaa5a('0x4')]);router[_0xaa5a('0x5')](_0xaa5a('0x6'),auth['isAuthenticated'](),auth[_0xaa5a('0x7')](),controller[_0xaa5a('0x8')]);router['get']('/reset',auth['isAuthenticated'](),auth[_0xaa5a('0x7')](),controller[_0xaa5a('0x9')]);router[_0xaa5a('0x5')](_0xaa5a('0xa'),auth[_0xaa5a('0xb')](),auth[_0xaa5a('0x7')](),controller['pull']);router[_0xaa5a('0x5')]('/restart',auth[_0xaa5a('0xb')](),controller[_0xaa5a('0xc')]);router['get'](_0xaa5a('0xd'),controller[_0xaa5a('0xe')]);module[_0xaa5a('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 50601a5..9c0720b 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 _0x6b52=['git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','replace','.js','push','length','Migration','sequelize','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','2.0.0','fetch','origin','master','error','status','json','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x57897b,_0x4cbe29){var _0x4c40c1=function(_0x3572ac){while(--_0x3572ac){_0x57897b['push'](_0x57897b['shift']());}};_0x4c40c1(++_0x4cbe29);}(_0x6b52,0xe8));var _0x26b5=function(_0x72777c,_0xde3754){_0x72777c=_0x72777c-0x0;var _0x59fc2f=_0x6b52[_0x72777c];return _0x59fc2f;};'use strict';var Umzug=require(_0x26b5('0x0'));var path=require(_0x26b5('0x1'));var fs=require('fs');var _=require(_0x26b5('0x2'));var pkginfo=require(_0x26b5('0x3'))(module,_0x26b5('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x26b5('0x5'))['exec'];var db=require(_0x26b5('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x26b5('0x7'));var logger=require(_0x26b5('0x8'))(_0x26b5('0x9'));var git=require(_0x26b5('0xa'))(config[_0x26b5('0xb')]);exports[_0x26b5('0xc')]=function(_0x59d6bd,_0x5a8a07){var _0x522fb4={'current':module[_0x26b5('0xd')]['version'],'phonebar':0x2};if(_0x59d6bd[_0x26b5('0xe')]&&_0x59d6bd[_0x26b5('0xe')][_0x26b5('0xf')]){return git['fetch']()[_0x26b5('0x10')](function(_0x50e6f7,_0x17be83){_0x522fb4[_0x26b5('0xf')]=(_0x50e6f7?module[_0x26b5('0xd')][_0x26b5('0x4')]:_0x17be83[_0x26b5('0xf')])||_0x26b5('0x11');return _0x5a8a07['status'](0xc8)['json'](_0x522fb4);});}else{return _0x5a8a07['status'](0xc8)['json'](_0x522fb4);}};exports[_0x26b5('0x12')]=function(_0x5bbdc9,_0x550f8b){return git[_0x26b5('0x12')]([_0x26b5('0x13'),_0x26b5('0x14')],function(_0x21dcb5){if(_0x21dcb5){logger[_0x26b5('0x15')](_0x21dcb5);return _0x550f8b[_0x26b5('0x16')](0x1f4)[_0x26b5('0x17')](_0x21dcb5);}logger['info']('git\x20fetch');return _0x550f8b[_0x26b5('0x16')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x26b5('0x18')]=function(_0x2ba56a,_0x26b194){return git[_0x26b5('0x18')]([_0x26b5('0x19'),'FETCH_HEAD'],function(_0x5db990){if(_0x5db990){logger[_0x26b5('0x15')](_0x5db990);return _0x26b194['status'](0x1f4)[_0x26b5('0x17')](_0x5db990);}logger[_0x26b5('0x1a')](_0x26b5('0x1b'));return _0x26b194[_0x26b5('0x16')](0xc8)[_0x26b5('0x17')]({'output':_0x26b5('0x1c')});});};exports['pull']=function(_0x27d4ad,_0x4ad3b6){exec(_0x26b5('0x1d'),function(_0x5d010e,_0x570772,_0x57e5d6){logger['info'](_0x570772);logger[_0x26b5('0x1a')](_0x57e5d6);if(_0x5d010e){logger[_0x26b5('0x15')](_0x5d010e);return _0x4ad3b6[_0x26b5('0x16')](0x1f4)[_0x26b5('0x17')](_0x5d010e);}return _0x4ad3b6[_0x26b5('0x16')](0xc8)[_0x26b5('0x17')]({'output':_0x570772});});};exports[_0x26b5('0x1e')]=function(_0x43ce2f,_0x20f9eb){return pm2[_0x26b5('0x1e')](_0x26b5('0x1f'))[_0x26b5('0x20')](function(_0x4514e8){logger[_0x26b5('0x1a')](_0x26b5('0x21'),_0x4514e8);return _0x20f9eb['status'](0xc8)[_0x26b5('0x17')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x26b5('0x22')](function(_0x3ab39c){logger[_0x26b5('0x15')](_0x3ab39c);return _0x20f9eb[_0x26b5('0x16')](0x1f4)['json'](_0x3ab39c);});};exports[_0x26b5('0x23')]=function(_0x465966,_0x5ae5d0){var _0x35a44f=fs[_0x26b5('0x24')](path[_0x26b5('0x25')](config['root'],_0x26b5('0x26'),_0x26b5('0x23')));var _0x2750d9=[];for(var _0x4eda64=0x0;_0x4eda64<_0x35a44f['length'];_0x4eda64++){var _0x915867=_0x35a44f[_0x4eda64][_0x26b5('0x27')](_0x26b5('0x28'),'');if(compareVersions(module[_0x26b5('0xd')][_0x26b5('0x4')],_0x915867)===-0x1){_0x2750d9[_0x26b5('0x29')](_0x915867);}}if(_0x2750d9[_0x26b5('0x2a')]){var _0x3e0d56=_0x2750d9['sort'](compareVersions);var _0x24cf1e=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x26b5('0x2b')],'modelName':_0x26b5('0x2b'),'columnName':_0x26b5('0x4')},'migrations':{'params':[db[_0x26b5('0x2c')][_0x26b5('0x2d')](),db['sequelize'][_0x26b5('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x26b5('0xb')],'server',_0x26b5('0x23')),'pattern':/\.js$/}});_0x24cf1e['up']({'migrations':_[_0x26b5('0x2f')](_0x3e0d56,function(_0x105dce){return _0x105dce+_0x26b5('0x28');})})[_0x26b5('0x20')](function(){return _0x5ae5d0[_0x26b5('0x16')](0xc8)['json']({'output':_0x26b5('0x30')+module[_0x26b5('0xd')][_0x26b5('0x4')]+_0x26b5('0x31')+_['last'](_0x3e0d56),'migrations':_[_0x26b5('0x25')](_0x3e0d56)});})[_0x26b5('0x22')](function(_0x45b9fe){if(_0x45b9fe instanceof db['sequelize'][_0x26b5('0x32')]){return _0x5ae5d0['status'](0xc8)[_0x26b5('0x17')]({'output':_0x26b5('0x33')});}else{return _0x5ae5d0[_0x26b5('0x16')](0x1f4)[_0x26b5('0x17')](_0x45b9fe);}});}else{return _0x5ae5d0[_0x26b5('0x16')](0xc8)[_0x26b5('0x17')]({'output':_0x26b5('0x33')});}}; \ No newline at end of file +var _0x298e=['Migration','getQueryInterface','constructor','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','query','fetch','tags','latest','exports','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','replace','.js','length','sort','sequelize'];(function(_0xdeee31,_0x39ae52){var _0xea0882=function(_0x52f37b){while(--_0x52f37b){_0xdeee31['push'](_0xdeee31['shift']());}};_0xea0882(++_0x39ae52);}(_0x298e,0x147));var _0xe298=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x298e[_0x27af45];return _0x18df21;};'use strict';var Umzug=require(_0xe298('0x0'));var path=require(_0xe298('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xe298('0x2'))(module,_0xe298('0x3'));var compareVersions=require(_0xe298('0x4'));var exec=require(_0xe298('0x5'))['exec'];var db=require(_0xe298('0x6'))['db'];var config=require(_0xe298('0x7'));var pm2=require(_0xe298('0x8'));var logger=require(_0xe298('0x9'))('update');var git=require(_0xe298('0xa'))(config[_0xe298('0xb')]);exports[_0xe298('0xc')]=function(_0x101c2e,_0x7429c2){var _0x154200={'current':module['exports'][_0xe298('0x3')],'phonebar':0x2};if(_0x101c2e[_0xe298('0xd')]&&_0x101c2e['query']['latest']){return git[_0xe298('0xe')]()[_0xe298('0xf')](function(_0x207d7c,_0xe09c03){_0x154200[_0xe298('0x10')]=(_0x207d7c?module[_0xe298('0x11')][_0xe298('0x3')]:_0xe09c03[_0xe298('0x10')])||_0xe298('0x12');return _0x7429c2[_0xe298('0x13')](0xc8)[_0xe298('0x14')](_0x154200);});}else{return _0x7429c2[_0xe298('0x13')](0xc8)['json'](_0x154200);}};exports[_0xe298('0xe')]=function(_0x4abfef,_0x509179){return git['fetch']([_0xe298('0x15'),_0xe298('0x16')],function(_0x53b978){if(_0x53b978){logger[_0xe298('0x17')](_0x53b978);return _0x509179[_0xe298('0x13')](0x1f4)[_0xe298('0x14')](_0x53b978);}logger['info'](_0xe298('0x18'));return _0x509179[_0xe298('0x13')](0xc8)[_0xe298('0x14')]({'output':_0xe298('0x19')});});};exports[_0xe298('0x1a')]=function(_0x2d7479,_0x148539){return git[_0xe298('0x1a')](['--hard',_0xe298('0x1b')],function(_0x1af203){if(_0x1af203){logger['error'](_0x1af203);return _0x148539['status'](0x1f4)[_0xe298('0x14')](_0x1af203);}logger[_0xe298('0x1c')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x148539[_0xe298('0x13')](0xc8)[_0xe298('0x14')]({'output':_0xe298('0x1d')});});};exports[_0xe298('0x1e')]=function(_0x1246b4,_0xe3830c){exec(_0xe298('0x1f'),function(_0x52ae92,_0x50275d,_0x50d32e){logger['info'](_0x50275d);logger['info'](_0x50d32e);if(_0x52ae92){logger['error'](_0x52ae92);return _0xe3830c[_0xe298('0x13')](0x1f4)[_0xe298('0x14')](_0x52ae92);}return _0xe3830c[_0xe298('0x13')](0xc8)[_0xe298('0x14')]({'output':_0x50275d});});};exports[_0xe298('0x20')]=function(_0x3e8593,_0x126bb5){return pm2[_0xe298('0x20')](_0xe298('0x21'))['then'](function(_0x2aa877){logger[_0xe298('0x1c')](_0xe298('0x22'),_0x2aa877);return _0x126bb5[_0xe298('0x13')](0xc8)[_0xe298('0x14')]({'output':_0xe298('0x23')});})[_0xe298('0x24')](function(_0x848ea1){logger[_0xe298('0x17')](_0x848ea1);return _0x126bb5[_0xe298('0x13')](0x1f4)['json'](_0x848ea1);});};exports[_0xe298('0x25')]=function(_0x1f8bc9,_0x4802ce){var _0x448ac5=fs[_0xe298('0x26')](path['join'](config['root'],'server',_0xe298('0x25')));var _0x36b3ca=[];for(var _0x57bb20=0x0;_0x57bb20<_0x448ac5['length'];_0x57bb20++){var _0x4a2e4d=_0x448ac5[_0x57bb20][_0xe298('0x27')](_0xe298('0x28'),'');if(compareVersions(module[_0xe298('0x11')][_0xe298('0x3')],_0x4a2e4d)===-0x1){_0x36b3ca['push'](_0x4a2e4d);}}if(_0x36b3ca[_0xe298('0x29')]){var _0x486000=_0x36b3ca[_0xe298('0x2a')](compareVersions);var _0x508428=new Umzug({'storage':_0xe298('0x2b'),'storageOptions':{'model':db[_0xe298('0x2c')],'modelName':_0xe298('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0xe298('0x2b')][_0xe298('0x2d')](),db[_0xe298('0x2b')][_0xe298('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0xe298('0xb')],_0xe298('0x2f'),_0xe298('0x25')),'pattern':/\.js$/}});_0x508428['up']({'migrations':_['map'](_0x486000,function(_0x55d812){return _0x55d812+_0xe298('0x28');})})[_0xe298('0x30')](function(){return _0x4802ce[_0xe298('0x13')](0xc8)[_0xe298('0x14')]({'output':_0xe298('0x31')+module['exports']['version']+_0xe298('0x32')+_[_0xe298('0x33')](_0x486000),'migrations':_['join'](_0x486000)});})[_0xe298('0x24')](function(_0x34f8ce){if(_0x34f8ce instanceof db[_0xe298('0x2b')]['UniqueConstraintError']){return _0x4802ce[_0xe298('0x13')](0xc8)[_0xe298('0x14')]({'output':_0xe298('0x34')});}else{return _0x4802ce[_0xe298('0x13')](0x1f4)[_0xe298('0x14')](_0x34f8ce);}});}else{return _0x4802ce[_0xe298('0x13')](0xc8)[_0xe298('0x14')]({'output':_0xe298('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 98f2c03..0846869 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 _0xc545=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','put','update','delete','destroy','multer','util','path'];(function(_0x29e54f,_0x33535a){var _0x4c619f=function(_0xc98342){while(--_0xc98342){_0x29e54f['push'](_0x29e54f['shift']());}};_0x4c619f(++_0x33535a);}(_0xc545,0x153));var _0x5c54=function(_0x37fa96,_0x128a10){_0x37fa96=_0x37fa96-0x0;var _0x4db59e=_0xc545[_0x37fa96];return _0x4db59e;};'use strict';var multer=require(_0x5c54('0x0'));var util=require(_0x5c54('0x1'));var path=require(_0x5c54('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c54('0x3')]();var fs_extra=require(_0x5c54('0x4'));var auth=require(_0x5c54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5c54('0x6'));var controller=require(_0x5c54('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5c54('0x8')]);router['get'](_0x5c54('0x9'),auth[_0x5c54('0xa')](),controller[_0x5c54('0xb')]);router[_0x5c54('0xc')](_0x5c54('0xd'),auth[_0x5c54('0xa')](),controller[_0x5c54('0xe')]);router['post']('/',auth[_0x5c54('0xa')](),controller['create']);router[_0x5c54('0xf')](_0x5c54('0xd'),auth[_0x5c54('0xa')](),controller[_0x5c54('0x10')]);router[_0x5c54('0x11')](_0x5c54('0xd'),auth[_0x5c54('0xa')](),controller[_0x5c54('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6ae3=['delete','destroy','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update'];(function(_0x24c9e0,_0x13251b){var _0x5996b7=function(_0x576e53){while(--_0x576e53){_0x24c9e0['push'](_0x24c9e0['shift']());}};_0x5996b7(++_0x13251b);}(_0x6ae3,0x1a0));var _0x36ae=function(_0x361bbc,_0x430194){_0x361bbc=_0x361bbc-0x0;var _0x33b453=_0x6ae3[_0x361bbc];return _0x33b453;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x36ae('0x0'));var express=require(_0x36ae('0x1'));var router=express[_0x36ae('0x2')]();var fs_extra=require(_0x36ae('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x36ae('0x4'));var config=require(_0x36ae('0x5'));var controller=require('./voiceAgentReport.controller');router[_0x36ae('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x36ae('0x6')](_0x36ae('0x7'),auth[_0x36ae('0x8')](),controller[_0x36ae('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x36ae('0xa')]);router[_0x36ae('0xb')]('/',auth[_0x36ae('0x8')](),controller[_0x36ae('0xc')]);router[_0x36ae('0xd')](_0x36ae('0xe'),auth[_0x36ae('0x8')](),controller[_0x36ae('0xf')]);router[_0x36ae('0x10')]('/:id',auth[_0x36ae('0x8')](),controller[_0x36ae('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 07591b6..ac1aad3 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 _0xb9e7=['STRING','DATE','INTEGER','BOOLEAN','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0xb9e7[_0x55ef8b];return _0x359c84;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'type':{'type':Sequelize[_0x7b9e('0x1')]},'uniqueid':{'type':Sequelize[_0x7b9e('0x1')]},'calleridnum':{'type':Sequelize[_0x7b9e('0x1')]},'calleridname':{'type':Sequelize[_0x7b9e('0x1')]},'queue':{'type':Sequelize[_0x7b9e('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7b9e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7b9e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x7b9e('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x7b9e('0x2')]},'holdtime':{'type':Sequelize[_0x7b9e('0x3')]},'agentcomplete':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7b9e('0x3')]},'reason':{'type':Sequelize[_0x7b9e('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7b9e('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7b9e('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7b9e('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b9e('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7b9e('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7b9e('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7b9e('0x1')]},'destcalleridname':{'type':Sequelize[_0x7b9e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7b9e('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x7b9e('0x1')]},'destaccountcode':{'type':Sequelize[_0x7b9e('0x1')]},'destcontext':{'type':Sequelize[_0x7b9e('0x1')]},'destexten':{'type':Sequelize[_0x7b9e('0x1')]},'destpriority':{'type':Sequelize[_0x7b9e('0x1')]},'destuniqueid':{'type':Sequelize[_0x7b9e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7b9e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x7b9e('0x1')]},'transfer':{'type':Sequelize[_0x7b9e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7b9e('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7b9e('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8e3f=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x3708a9,_0xf8c678){var _0x1f59f5=function(_0x413b37){while(--_0x413b37){_0x3708a9['push'](_0x3708a9['shift']());}};_0x1f59f5(++_0xf8c678);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'type':{'type':Sequelize[_0xf8e3('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf8e3('0x2')]},'calleridname':{'type':Sequelize[_0xf8e3('0x2')]},'queue':{'type':Sequelize[_0xf8e3('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf8e3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf8e3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xf8e3('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf8e3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf8e3('0x3')]},'holdtime':{'type':Sequelize[_0xf8e3('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf8e3('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf8e3('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf8e3('0x4')]},'agentacw':{'type':Sequelize[_0xf8e3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf8e3('0x4')]},'reason':{'type':Sequelize[_0xf8e3('0x2')]},'lastevent':{'type':Sequelize[_0xf8e3('0x2')]},'channel':{'type':Sequelize[_0xf8e3('0x2')]},'channelstate':{'type':Sequelize[_0xf8e3('0x4')]},'channelstatedesc':{'type':Sequelize[_0xf8e3('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf8e3('0x2')]},'connectedlinename':{'type':Sequelize[_0xf8e3('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf8e3('0x2')]},'context':{'type':Sequelize[_0xf8e3('0x2')]},'exten':{'type':Sequelize[_0xf8e3('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf8e3('0x2')]},'destchannelstate':{'type':Sequelize[_0xf8e3('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xf8e3('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf8e3('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf8e3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf8e3('0x2')]},'destlanguage':{'type':Sequelize[_0xf8e3('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf8e3('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf8e3('0x2')]},'destuniqueid':{'type':Sequelize[_0xf8e3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf8e3('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf8e3('0x2')],'comment':_0xf8e3('0x6')},'transferexten':{'type':Sequelize[_0xf8e3('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf8e3('0x2')]},'agententerreason':{'type':Sequelize[_0xf8e3('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index f16d976..b384a32 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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_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['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 f25920e..3f022ed 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 _0xde64=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','VoiceAgentReport'];(function(_0x44239a,_0x4dd181){var _0x2c7b09=function(_0x1bb0f1){while(--_0x1bb0f1){_0x44239a['push'](_0x44239a['shift']());}};_0x2c7b09(++_0x4dd181);}(_0xde64,0x17c));var _0x4de6=function(_0x2b4edc,_0x224c78){_0x2b4edc=_0x2b4edc-0x0;var _0xd9c05e=_0xde64[_0x2b4edc];return _0xd9c05e;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var moment=require(_0x4de6('0x4'));var BPromise=require(_0x4de6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4de6('0x6'));var rimraf=require(_0x4de6('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x4de6('0x8')]=function(_0x45867b,_0x4da17f){return _0x45867b['define'](_0x4de6('0x9'),attributes,{'tableName':_0x4de6('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4de6('0xb'),_0x4de6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0bde=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe0bd('0x0'));var util=require('util');var logger=require(_0xe0bd('0x1'))(_0xe0bd('0x2'));var moment=require('moment');var BPromise=require(_0xe0bd('0x3'));var rp=require(_0xe0bd('0x4'));var fs=require('fs');var path=require(_0xe0bd('0x5'));var rimraf=require('rimraf');var config=require(_0xe0bd('0x6'));var attributes=require(_0xe0bd('0x7'));module[_0xe0bd('0x8')]=function(_0x3a3cd2,_0x37289f){return _0x3a3cd2[_0xe0bd('0x9')](_0xe0bd('0xa'),attributes,{'tableName':_0xe0bd('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe0bd('0xc'),_0xe0bd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f76aaae..e40c5c0 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 _0xbe8e=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x26e3a,_0x46ef0e){var _0x5b7f52=function(_0x265495){while(--_0x265495){_0x26e3a['push'](_0x26e3a['shift']());}};_0x5b7f52(++_0x46ef0e);}(_0xbe8e,0x141));var _0xebe8=function(_0x584354,_0x39bedb){_0x584354=_0x584354-0x0;var _0x71b8dc=_0xbe8e[_0x584354];return _0x71b8dc;};'use strict';var _=require(_0xebe8('0x0'));var util=require(_0xebe8('0x1'));var moment=require(_0xebe8('0x2'));var BPromise=require(_0xebe8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebe8('0x4'));var db=require(_0xebe8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xebe8('0x6'))(_0xebe8('0x7'));var config=require(_0xebe8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xebe8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8000,_0x5abce4,_0x1bcabd){return new BPromise(function(_0x52ef1b,_0x4ad6a8){return client[_0xebe8('0xa')](_0x4e8000,_0x1bcabd)[_0xebe8('0xb')](function(_0x5f025d){logger[_0xebe8('0xc')](_0xebe8('0xd'),_0x5abce4,_0xebe8('0xe'));logger[_0xebe8('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x5abce4,_0xebe8('0xe'),JSON[_0xebe8('0x10')](_0x5f025d));if(_0x5f025d['error']){if(_0x5f025d[_0xebe8('0x11')][_0xebe8('0x12')]===0x1f4){logger[_0xebe8('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5abce4,_0x5f025d['error'][_0xebe8('0x13')]);return _0x4ad6a8(_0x5f025d[_0xebe8('0x11')][_0xebe8('0x13')]);}logger[_0xebe8('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5abce4,_0x5f025d[_0xebe8('0x11')][_0xebe8('0x13')]);return _0x52ef1b(_0x5f025d[_0xebe8('0x11')]['message']);}else{logger['info'](_0xebe8('0xd'),_0x5abce4,_0xebe8('0xe'));_0x52ef1b(_0x5f025d[_0xebe8('0x14')][_0xebe8('0x13')]);}})[_0xebe8('0x15')](function(_0x4e9602){logger[_0xebe8('0x11')](_0xebe8('0xd'),_0x5abce4,_0x4e9602);_0x4ad6a8(_0x4e9602);});});}exports[_0xebe8('0x16')]=function(_0x3c03f4){var _0x472ee3=this;return new Promise(function(_0x2064cc,_0x8722b1){return db[_0xebe8('0x17')][_0xebe8('0x18')](_0x3c03f4[_0xebe8('0x19')],{'raw':_0x3c03f4[_0xebe8('0x1a')]?_0x3c03f4[_0xebe8('0x1a')][_0xebe8('0x1b')]===undefined?!![]:![]:!![]})[_0xebe8('0xb')](function(_0x1dc1e2){logger[_0xebe8('0xc')](_0xebe8('0x16'),_0x3c03f4);logger[_0xebe8('0xf')](_0xebe8('0x16'),_0x3c03f4,JSON[_0xebe8('0x10')](_0x1dc1e2));_0x2064cc(_0x1dc1e2);})[_0xebe8('0x15')](function(_0x18d5a5){logger[_0xebe8('0x11')](_0xebe8('0x16'),_0x18d5a5[_0xebe8('0x13')],_0x3c03f4);_0x8722b1(_0x472ee3[_0xebe8('0x11')](0x1f4,_0x18d5a5[_0xebe8('0x13')]));});});};exports[_0xebe8('0x1c')]=function(_0x1cd67f){var _0x3b5eb4=this;return new Promise(function(_0x4f3b38,_0x1f8359){return db[_0xebe8('0x17')]['update'](_0x1cd67f['body'],{'raw':_0x1cd67f[_0xebe8('0x1a')]?_0x1cd67f[_0xebe8('0x1a')][_0xebe8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cd67f[_0xebe8('0x1a')]?_0x1cd67f[_0xebe8('0x1a')][_0xebe8('0x1d')]||null:null,'attributes':_0x1cd67f['options']?_0x1cd67f[_0xebe8('0x1a')][_0xebe8('0x1e')]||null:null,'limit':_0x1cd67f['options']?_0x1cd67f[_0xebe8('0x1a')]['limit']||null:null})[_0xebe8('0xb')](function(_0x3dd804){logger[_0xebe8('0xc')]('UpdateVoiceAgentReport',_0x1cd67f);logger[_0xebe8('0xf')](_0xebe8('0x1c'),_0x1cd67f,JSON[_0xebe8('0x10')](_0x3dd804));_0x4f3b38(_0x3dd804);})[_0xebe8('0x15')](function(_0xcca211){logger[_0xebe8('0x11')]('UpdateVoiceAgentReport',_0xcca211[_0xebe8('0x13')],_0x1cd67f);_0x1f8359(_0x3b5eb4['error'](0x1f4,_0xcca211['message']));});});}; \ No newline at end of file +var _0x048d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','stringify','UpdateVoiceAgentReport','update','body','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x048d,0x7c));var _0xd048=function(_0x44a328,_0x59fb79){_0x44a328=_0x44a328-0x0;var _0x214cdc=_0x048d[_0x44a328];return _0x214cdc;};'use strict';var _=require(_0xd048('0x0'));var util=require(_0xd048('0x1'));var moment=require(_0xd048('0x2'));var BPromise=require(_0xd048('0x3'));var rs=require(_0xd048('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd048('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd048('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd048('0x7'));var client=jayson['client'][_0xd048('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fa05d,_0x2c9463,_0x405b02){return new BPromise(function(_0x468941,_0x1f29d2){return client[_0xd048('0x9')](_0x4fa05d,_0x405b02)[_0xd048('0xa')](function(_0x10d8cd){logger[_0xd048('0xb')](_0xd048('0xc'),_0x2c9463,_0xd048('0xd'));logger[_0xd048('0xe')](_0xd048('0xf'),_0x2c9463,_0xd048('0xd'),JSON['stringify'](_0x10d8cd));if(_0x10d8cd[_0xd048('0x10')]){if(_0x10d8cd[_0xd048('0x10')][_0xd048('0x11')]===0x1f4){logger['error'](_0xd048('0xc'),_0x2c9463,_0x10d8cd[_0xd048('0x10')][_0xd048('0x12')]);return _0x1f29d2(_0x10d8cd[_0xd048('0x10')]['message']);}logger[_0xd048('0x10')](_0xd048('0xc'),_0x2c9463,_0x10d8cd[_0xd048('0x10')][_0xd048('0x12')]);return _0x468941(_0x10d8cd[_0xd048('0x10')][_0xd048('0x12')]);}else{logger[_0xd048('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x2c9463,'request\x20sent');_0x468941(_0x10d8cd[_0xd048('0x13')]['message']);}})[_0xd048('0x14')](function(_0x2cd4ab){logger[_0xd048('0x10')](_0xd048('0xc'),_0x2c9463,_0x2cd4ab);_0x1f29d2(_0x2cd4ab);});});}exports[_0xd048('0x15')]=function(_0x2e56f2){var _0x262f25=this;return new Promise(function(_0x2baa0a,_0x3dc213){return db[_0xd048('0x16')][_0xd048('0x17')](_0x2e56f2['body'],{'raw':_0x2e56f2[_0xd048('0x18')]?_0x2e56f2[_0xd048('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x573a0d){logger[_0xd048('0xb')](_0xd048('0x15'),_0x2e56f2);logger[_0xd048('0xe')](_0xd048('0x15'),_0x2e56f2,JSON[_0xd048('0x19')](_0x573a0d));_0x2baa0a(_0x573a0d);})[_0xd048('0x14')](function(_0xda5ae1){logger['error'](_0xd048('0x15'),_0xda5ae1[_0xd048('0x12')],_0x2e56f2);_0x3dc213(_0x262f25['error'](0x1f4,_0xda5ae1[_0xd048('0x12')]));});});};exports[_0xd048('0x1a')]=function(_0x3513fe){var _0x2a23b1=this;return new Promise(function(_0xb53c56,_0x2b3dad){return db['VoiceAgentReport'][_0xd048('0x1b')](_0x3513fe[_0xd048('0x1c')],{'raw':_0x3513fe[_0xd048('0x18')]?_0x3513fe[_0xd048('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3513fe[_0xd048('0x18')]?_0x3513fe[_0xd048('0x18')]['where']||null:null,'attributes':_0x3513fe['options']?_0x3513fe['options'][_0xd048('0x1d')]||null:null,'limit':_0x3513fe[_0xd048('0x18')]?_0x3513fe['options'][_0xd048('0x1e')]||null:null})[_0xd048('0xa')](function(_0x425c98){logger[_0xd048('0xb')]('UpdateVoiceAgentReport',_0x3513fe);logger[_0xd048('0xe')](_0xd048('0x1a'),_0x3513fe,JSON[_0xd048('0x19')](_0x425c98));_0xb53c56(_0x425c98);})[_0xd048('0x14')](function(_0x28902a){logger[_0xd048('0x10')]('UpdateVoiceAgentReport',_0x28902a[_0xd048('0x12')],_0x3513fe);_0x2b3dad(_0x2a23b1['error'](0x1f4,_0x28902a[_0xd048('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4ea76e9..0037446 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 _0xca9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xca9e,0x136));var _0xeca9=function(_0x350a22,_0x2bc9af){_0x350a22=_0x350a22-0x0;var _0x4b0b6a=_0xca9e[_0x350a22];return _0x4b0b6a;};'use strict';var multer=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var path=require(_0xeca9('0x2'));var timeout=require(_0xeca9('0x3'));var express=require(_0xeca9('0x4'));var router=express[_0xeca9('0x5')]();var fs_extra=require(_0xeca9('0x6'));var auth=require(_0xeca9('0x7'));var interaction=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var controller=require(_0xeca9('0xa'));router[_0xeca9('0xb')]('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0xd')]);router['get'](_0xeca9('0xe'),auth[_0xeca9('0xc')](),controller['describe']);router['get'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x10')]);router['post']('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0x11')]);router[_0xeca9('0x12')](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x13')]);router['delete'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller['destroy']);module[_0xeca9('0x14')]=router; \ No newline at end of file +var _0x9957=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1969e8,_0x1e9133){var _0x12f6df=function(_0xb0bff5){while(--_0xb0bff5){_0x1969e8['push'](_0x1969e8['shift']());}};_0x12f6df(++_0x1e9133);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0x12'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);module[_0x7995('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f2361f9..ef9557a 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 _0x686f=['outbound-fax','dialer','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','inbound-fax'];(function(_0x187e49,_0x19d3d5){var _0x3cd5d8=function(_0x36ed28){while(--_0x36ed28){_0x187e49['push'](_0x187e49['shift']());}};_0x3cd5d8(++_0x19d3d5);}(_0x686f,0x108));var _0xf686=function(_0xed84c3,_0x4d95d8){_0xed84c3=_0xed84c3-0x0;var _0x20a835=_0x686f[_0xed84c3];return _0x20a835;};'use strict';var Sequelize=require('sequelize');module[_0xf686('0x0')]={'uniqueid':{'type':Sequelize[_0xf686('0x1')]},'type':{'type':Sequelize[_0xf686('0x2')](_0xf686('0x3'),_0xf686('0x4'),'outbound',_0xf686('0x5'),_0xf686('0x6'),_0xf686('0x7'))},'tag':{'type':Sequelize[_0xf686('0x1')]},'accountcode':{'type':Sequelize[_0xf686('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xf686('0x1')]},'destinationcontext':{'type':Sequelize[_0xf686('0x1')]},'callerid':{'type':Sequelize[_0xf686('0x1')]},'channel':{'type':Sequelize[_0xf686('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xf686('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xf686('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf686('0x8')]},'duration':{'type':Sequelize[_0xf686('0x9')]},'billableseconds':{'type':Sequelize[_0xf686('0x9')]},'mohtime':{'type':Sequelize[_0xf686('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf686('0x1')]},'userfield':{'type':Sequelize[_0xf686('0x1')]},'userDisposition':{'type':Sequelize[_0xf686('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xf686('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xf686('0x1')]},'note':{'type':Sequelize[_0xf686('0x1')]},'prefix':{'type':Sequelize[_0xf686('0x1')]},'routeid':{'type':Sequelize[_0xf686('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6d3f=['exports','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x6d3f,0xe6));var _0xf6d3=function(_0x2a2f3a,_0x77c281){_0x2a2f3a=_0x2a2f3a-0x0;var _0x1ec91f=_0x6d3f[_0x2a2f3a];return _0x1ec91f;};'use strict';var Sequelize=require(_0xf6d3('0x0'));module[_0xf6d3('0x1')]={'uniqueid':{'type':Sequelize[_0xf6d3('0x2')]},'type':{'type':Sequelize[_0xf6d3('0x3')](_0xf6d3('0x4'),_0xf6d3('0x5'),'outbound',_0xf6d3('0x6'),_0xf6d3('0x7'),_0xf6d3('0x8'))},'tag':{'type':Sequelize[_0xf6d3('0x2')]},'accountcode':{'type':Sequelize[_0xf6d3('0x2')]},'source':{'type':Sequelize[_0xf6d3('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xf6d3('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf6d3('0x2')]},'destinationchannel':{'type':Sequelize[_0xf6d3('0x2')]},'lastapplication':{'type':Sequelize[_0xf6d3('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xf6d3('0x9')]},'systemanswertime':{'type':Sequelize[_0xf6d3('0x9')]},'answertime':{'type':Sequelize[_0xf6d3('0x9')]},'endtime':{'type':Sequelize[_0xf6d3('0x9')]},'duration':{'type':Sequelize[_0xf6d3('0xa')]},'billableseconds':{'type':Sequelize[_0xf6d3('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf6d3('0x2')]},'amaflags':{'type':Sequelize[_0xf6d3('0x2')]},'userfield':{'type':Sequelize[_0xf6d3('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xf6d3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xf6d3('0x2')]},'note':{'type':Sequelize[_0xf6d3('0x2')]},'prefix':{'type':Sequelize[_0xf6d3('0x2')]},'routeid':{'type':Sequelize[_0xf6d3('0xa')]},'sipcallid':{'type':Sequelize[_0xf6d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index aa1de95..f13a273 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0xadb5,0xad));var _0x5adb=function(_0x3d633f,_0x5702ca){_0x3d633f=_0x3d633f-0x0;var _0x244b62=_0xadb5[_0x3d633f];return _0x244b62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x2a5e32,_0x1ef1c7){var _0x4e7614=function(_0x4032e8){while(--_0x4032e8){_0x2a5e32['push'](_0x2a5e32['shift']());}};_0x4e7614(++_0x1ef1c7);}(_0xdb28,0x106));var _0x8db2=function(_0x434559,_0x7c2db1){_0x434559=_0x434559-0x0;var _0x190ccd=_0xdb28[_0x434559];return _0x190ccd;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index ff27754..e03d546 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 _0x584a=['api','moment','bluebird','request-promise','../../config/environment','VoiceCallReport','report_call','lodash','util'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x584a,0x1c0));var _0xa584=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x584a[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xa584('0x0'));var util=require(_0xa584('0x1'));var logger=require('../../config/logger')(_0xa584('0x2'));var moment=require(_0xa584('0x3'));var BPromise=require(_0xa584('0x4'));var rp=require(_0xa584('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa584('0x6'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x4a36d6,_0x263112){return _0x4a36d6['define'](_0xa584('0x7'),attributes,{'tableName':_0xa584('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfab3=['uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call'];(function(_0x39450c,_0x2e5ebc){var _0x50a9dc=function(_0x261241){while(--_0x261241){_0x39450c['push'](_0x39450c['shift']());}};_0x50a9dc(++_0x2e5ebc);}(_0xfab3,0x16d));var _0x3fab=function(_0x12d491,_0x2b8ae9){_0x12d491=_0x12d491-0x0;var _0xce4be6=_0xfab3[_0x12d491];return _0xce4be6;};'use strict';var _=require(_0x3fab('0x0'));var util=require(_0x3fab('0x1'));var logger=require(_0x3fab('0x2'))('api');var moment=require(_0x3fab('0x3'));var BPromise=require('bluebird');var rp=require(_0x3fab('0x4'));var fs=require('fs');var path=require(_0x3fab('0x5'));var rimraf=require(_0x3fab('0x6'));var config=require(_0x3fab('0x7'));var attributes=require(_0x3fab('0x8'));module[_0x3fab('0x9')]=function(_0x550da8,_0x41ace8){return _0x550da8['define'](_0x3fab('0xa'),attributes,{'tableName':_0x3fab('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3fab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 87ccb7b..6bebb32 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 _0x1cbb=['stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','then','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0x4d78fb,_0x280202){var _0x2898bf=function(_0x11ba3c){while(--_0x11ba3c){_0x4d78fb['push'](_0x4d78fb['shift']());}};_0x2898bf(++_0x280202);}(_0x1cbb,0x1c4));var _0xb1cb=function(_0x191f3e,_0x4392ea){_0x191f3e=_0x191f3e-0x0;var _0x2bf7b5=_0x1cbb[_0x191f3e];return _0x2bf7b5;};'use strict';var _=require('lodash');var util=require(_0xb1cb('0x0'));var moment=require(_0xb1cb('0x1'));var BPromise=require('bluebird');var rs=require(_0xb1cb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1cb('0x3'))['db'];var utils=require(_0xb1cb('0x4'));var logger=require(_0xb1cb('0x5'))(_0xb1cb('0x6'));var config=require(_0xb1cb('0x7'));var jayson=require(_0xb1cb('0x8'));var client=jayson[_0xb1cb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c91c2,_0x2dad4e,_0x25ea96){return new BPromise(function(_0x4d9fef,_0x215d51){return client[_0xb1cb('0xa')](_0x1c91c2,_0x25ea96)['then'](function(_0x4aa6d1){logger[_0xb1cb('0xb')](_0xb1cb('0xc'),_0x2dad4e,_0xb1cb('0xd'));logger[_0xb1cb('0xe')](_0xb1cb('0xf'),_0x2dad4e,_0xb1cb('0xd'),JSON[_0xb1cb('0x10')](_0x4aa6d1));if(_0x4aa6d1[_0xb1cb('0x11')]){if(_0x4aa6d1['error']['code']===0x1f4){logger['error'](_0xb1cb('0xc'),_0x2dad4e,_0x4aa6d1[_0xb1cb('0x11')]['message']);return _0x215d51(_0x4aa6d1[_0xb1cb('0x11')]['message']);}logger[_0xb1cb('0x11')](_0xb1cb('0xc'),_0x2dad4e,_0x4aa6d1[_0xb1cb('0x11')][_0xb1cb('0x12')]);return _0x4d9fef(_0x4aa6d1['error'][_0xb1cb('0x12')]);}else{logger[_0xb1cb('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x2dad4e,'request\x20sent');_0x4d9fef(_0x4aa6d1[_0xb1cb('0x13')][_0xb1cb('0x12')]);}})[_0xb1cb('0x14')](function(_0x1114fa){logger[_0xb1cb('0x11')](_0xb1cb('0xc'),_0x2dad4e,_0x1114fa);_0x215d51(_0x1114fa);});});}exports[_0xb1cb('0x15')]=function(_0x3c94fb){var _0x1a0ae5=this;return new Promise(function(_0x215891,_0x404ab2){return db[_0xb1cb('0x16')]['findAll']({'raw':_0x3c94fb[_0xb1cb('0x17')]?_0x3c94fb[_0xb1cb('0x17')][_0xb1cb('0x18')]===undefined?!![]:![]:!![],'where':_0x3c94fb[_0xb1cb('0x17')]?_0x3c94fb[_0xb1cb('0x17')][_0xb1cb('0x19')]||null:null,'attributes':_0x3c94fb[_0xb1cb('0x17')]?_0x3c94fb[_0xb1cb('0x17')][_0xb1cb('0x1a')]||null:null,'limit':_0x3c94fb[_0xb1cb('0x17')]?_0x3c94fb[_0xb1cb('0x17')][_0xb1cb('0x1b')]||null:null,'include':_0x3c94fb[_0xb1cb('0x17')]?_0x3c94fb[_0xb1cb('0x17')]['include']?_[_0xb1cb('0x1c')](_0x3c94fb['options'][_0xb1cb('0x1d')],function(_0x1045e0){return{'model':db[_0x1045e0[_0xb1cb('0x1e')]],'as':_0x1045e0['as'],'attributes':_0x1045e0[_0xb1cb('0x1a')],'include':_0x1045e0[_0xb1cb('0x1d')]?_[_0xb1cb('0x1c')](_0x1045e0[_0xb1cb('0x1d')],function(_0x3358a9){return{'model':db[_0x3358a9[_0xb1cb('0x1e')]],'as':_0x3358a9['as'],'attributes':_0x3358a9[_0xb1cb('0x1a')],'include':_0x3358a9[_0xb1cb('0x1d')]?_[_0xb1cb('0x1c')](_0x3358a9[_0xb1cb('0x1d')],function(_0x51cc30){return{'model':db[_0x51cc30[_0xb1cb('0x1e')]],'as':_0x51cc30['as'],'attributes':_0x51cc30['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x557ff5){logger['info']('GetVoiceCallReport',_0x3c94fb);logger[_0xb1cb('0xe')]('GetVoiceCallReport',_0x3c94fb,JSON[_0xb1cb('0x10')](_0x557ff5));_0x215891(_0x557ff5);})[_0xb1cb('0x14')](function(_0x4464b4){logger[_0xb1cb('0x11')](_0xb1cb('0x15'),_0x4464b4[_0xb1cb('0x12')],_0x3c94fb);_0x404ab2(_0x1a0ae5['error'](0x1f4,_0x4464b4[_0xb1cb('0x12')]));});});};exports[_0xb1cb('0x1f')]=function(_0x2019f2){var _0x10fcad=this;return new Promise(function(_0x271c27,_0x2582c9){return db[_0xb1cb('0x16')][_0xb1cb('0x20')](_0x2019f2['body'],{'raw':_0x2019f2['options']?_0x2019f2[_0xb1cb('0x17')][_0xb1cb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x7f2970){logger[_0xb1cb('0xb')]('CreateVoiceCallReport',_0x2019f2);logger[_0xb1cb('0xe')](_0xb1cb('0x1f'),_0x2019f2,JSON['stringify'](_0x7f2970));_0x271c27(_0x7f2970);})['catch'](function(_0x3ae3d8){logger[_0xb1cb('0x11')](_0xb1cb('0x1f'),_0x3ae3d8[_0xb1cb('0x12')],_0x2019f2);_0x2582c9(_0x10fcad[_0xb1cb('0x11')](0x1f4,_0x3ae3d8['message']));});});};exports[_0xb1cb('0x21')]=function(_0x4a6a85){var _0x57cad8=this;return new Promise(function(_0x483443,_0x3c264f){return db['VoiceCallReport'][_0xb1cb('0x22')](_0x4a6a85['body'],{'raw':_0x4a6a85[_0xb1cb('0x17')]?_0x4a6a85[_0xb1cb('0x17')][_0xb1cb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a6a85[_0xb1cb('0x17')]?_0x4a6a85['options'][_0xb1cb('0x19')]||null:null,'attributes':_0x4a6a85[_0xb1cb('0x17')]?_0x4a6a85['options']['attributes']||null:null,'limit':_0x4a6a85[_0xb1cb('0x17')]?_0x4a6a85[_0xb1cb('0x17')][_0xb1cb('0x1b')]||null:null})[_0xb1cb('0x23')](function(_0x3dcb2c){logger['info'](_0xb1cb('0x21'),_0x4a6a85);logger[_0xb1cb('0xe')](_0xb1cb('0x21'),_0x4a6a85,JSON[_0xb1cb('0x10')](_0x3dcb2c));_0x483443(_0x3dcb2c);})[_0xb1cb('0x14')](function(_0x51e2ce){logger[_0xb1cb('0x11')](_0xb1cb('0x21'),_0x51e2ce['message'],_0x4a6a85);_0x3c264f(_0x57cad8[_0xb1cb('0x11')](0x1f4,_0x51e2ce[_0xb1cb('0x12')]));});});}; \ No newline at end of file +var _0xbe2b=['attributes','include','map','model','stringify','CreateVoiceCallReport','create','debug','UpdateVoiceCallReport','body','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbe2b,0x74));var _0xbbe2=function(_0x47f61e,_0x50ea5b){_0x47f61e=_0x47f61e-0x0;var _0x5072b7=_0xbe2b[_0x47f61e];return _0x5072b7;};'use strict';var _=require(_0xbbe2('0x0'));var util=require('util');var moment=require(_0xbbe2('0x1'));var BPromise=require(_0xbbe2('0x2'));var rs=require(_0xbbe2('0x3'));var fs=require('fs');var Redis=require(_0xbbe2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbe2('0x5'))(_0xbbe2('0x6'));var config=require(_0xbbe2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbbe2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22a059,_0x4a5f30,_0x5b7b30){return new BPromise(function(_0x4aaf83,_0x254ca1){return client[_0xbbe2('0x9')](_0x22a059,_0x5b7b30)[_0xbbe2('0xa')](function(_0x5561b9){logger[_0xbbe2('0xb')](_0xbbe2('0xc'),_0x4a5f30,_0xbbe2('0xd'));logger['debug'](_0xbbe2('0xe'),_0x4a5f30,_0xbbe2('0xd'),JSON['stringify'](_0x5561b9));if(_0x5561b9['error']){if(_0x5561b9[_0xbbe2('0xf')][_0xbbe2('0x10')]===0x1f4){logger[_0xbbe2('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x4a5f30,_0x5561b9[_0xbbe2('0xf')][_0xbbe2('0x11')]);return _0x254ca1(_0x5561b9[_0xbbe2('0xf')][_0xbbe2('0x11')]);}logger['error'](_0xbbe2('0xc'),_0x4a5f30,_0x5561b9[_0xbbe2('0xf')]['message']);return _0x4aaf83(_0x5561b9[_0xbbe2('0xf')][_0xbbe2('0x11')]);}else{logger[_0xbbe2('0xb')](_0xbbe2('0xc'),_0x4a5f30,_0xbbe2('0xd'));_0x4aaf83(_0x5561b9[_0xbbe2('0x12')][_0xbbe2('0x11')]);}})[_0xbbe2('0x13')](function(_0x2efa00){logger[_0xbbe2('0xf')](_0xbbe2('0xc'),_0x4a5f30,_0x2efa00);_0x254ca1(_0x2efa00);});});}exports[_0xbbe2('0x14')]=function(_0x8872d3){var _0x5c81f0=this;return new Promise(function(_0x436c7c,_0x3f948e){return db[_0xbbe2('0x15')]['findAll']({'raw':_0x8872d3[_0xbbe2('0x16')]?_0x8872d3[_0xbbe2('0x16')][_0xbbe2('0x17')]===undefined?!![]:![]:!![],'where':_0x8872d3[_0xbbe2('0x16')]?_0x8872d3[_0xbbe2('0x16')]['where']||null:null,'attributes':_0x8872d3['options']?_0x8872d3[_0xbbe2('0x16')][_0xbbe2('0x18')]||null:null,'limit':_0x8872d3['options']?_0x8872d3['options']['limit']||null:null,'include':_0x8872d3[_0xbbe2('0x16')]?_0x8872d3[_0xbbe2('0x16')][_0xbbe2('0x19')]?_[_0xbbe2('0x1a')](_0x8872d3[_0xbbe2('0x16')][_0xbbe2('0x19')],function(_0x3c36be){return{'model':db[_0x3c36be['model']],'as':_0x3c36be['as'],'attributes':_0x3c36be['attributes'],'include':_0x3c36be['include']?_[_0xbbe2('0x1a')](_0x3c36be['include'],function(_0x1e2aee){return{'model':db[_0x1e2aee[_0xbbe2('0x1b')]],'as':_0x1e2aee['as'],'attributes':_0x1e2aee['attributes'],'include':_0x1e2aee[_0xbbe2('0x19')]?_['map'](_0x1e2aee[_0xbbe2('0x19')],function(_0x516e3f){return{'model':db[_0x516e3f[_0xbbe2('0x1b')]],'as':_0x516e3f['as'],'attributes':_0x516e3f[_0xbbe2('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbbe2('0xa')](function(_0x29001e){logger[_0xbbe2('0xb')]('GetVoiceCallReport',_0x8872d3);logger['debug'](_0xbbe2('0x14'),_0x8872d3,JSON[_0xbbe2('0x1c')](_0x29001e));_0x436c7c(_0x29001e);})[_0xbbe2('0x13')](function(_0x588979){logger[_0xbbe2('0xf')](_0xbbe2('0x14'),_0x588979[_0xbbe2('0x11')],_0x8872d3);_0x3f948e(_0x5c81f0[_0xbbe2('0xf')](0x1f4,_0x588979['message']));});});};exports[_0xbbe2('0x1d')]=function(_0x1fc3d8){var _0x3cfa3d=this;return new Promise(function(_0x4c0015,_0x4aa588){return db[_0xbbe2('0x15')][_0xbbe2('0x1e')](_0x1fc3d8['body'],{'raw':_0x1fc3d8[_0xbbe2('0x16')]?_0x1fc3d8[_0xbbe2('0x16')][_0xbbe2('0x17')]===undefined?!![]:![]:!![]})[_0xbbe2('0xa')](function(_0x4f5aee){logger[_0xbbe2('0xb')](_0xbbe2('0x1d'),_0x1fc3d8);logger[_0xbbe2('0x1f')](_0xbbe2('0x1d'),_0x1fc3d8,JSON[_0xbbe2('0x1c')](_0x4f5aee));_0x4c0015(_0x4f5aee);})[_0xbbe2('0x13')](function(_0x33c7e3){logger['error'](_0xbbe2('0x1d'),_0x33c7e3[_0xbbe2('0x11')],_0x1fc3d8);_0x4aa588(_0x3cfa3d[_0xbbe2('0xf')](0x1f4,_0x33c7e3[_0xbbe2('0x11')]));});});};exports[_0xbbe2('0x20')]=function(_0x1732eb){var _0x528f99=this;return new Promise(function(_0x392aa4,_0x494e23){return db['VoiceCallReport']['update'](_0x1732eb[_0xbbe2('0x21')],{'raw':_0x1732eb[_0xbbe2('0x16')]?_0x1732eb[_0xbbe2('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1732eb['options']?_0x1732eb[_0xbbe2('0x16')]['where']||null:null,'attributes':_0x1732eb[_0xbbe2('0x16')]?_0x1732eb['options']['attributes']||null:null,'limit':_0x1732eb['options']?_0x1732eb['options'][_0xbbe2('0x22')]||null:null})[_0xbbe2('0xa')](function(_0x95b870){logger[_0xbbe2('0xb')](_0xbbe2('0x20'),_0x1732eb);logger[_0xbbe2('0x1f')](_0xbbe2('0x20'),_0x1732eb,JSON['stringify'](_0x95b870));_0x392aa4(_0x95b870);})[_0xbbe2('0x13')](function(_0x485506){logger[_0xbbe2('0xf')](_0xbbe2('0x20'),_0x485506[_0xbbe2('0x11')],_0x1732eb);_0x494e23(_0x528f99['error'](0x1f4,_0x485506[_0xbbe2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e283b18..f9db7a4 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 _0xbc04=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','index','get','show','create','/:id'];(function(_0x15b0ec,_0x13e9d8){var _0x1dae09=function(_0x30a443){while(--_0x30a443){_0x15b0ec['push'](_0x15b0ec['shift']());}};_0x1dae09(++_0x13e9d8);}(_0xbc04,0x1bc));var _0x4bc0=function(_0x33b92b,_0xcedf71){_0x33b92b=_0x33b92b-0x0;var _0x536c86=_0xbc04[_0x33b92b];return _0x536c86;};'use strict';var multer=require(_0x4bc0('0x0'));var util=require('util');var path=require(_0x4bc0('0x1'));var timeout=require(_0x4bc0('0x2'));var express=require(_0x4bc0('0x3'));var router=express[_0x4bc0('0x4')]();var fs_extra=require(_0x4bc0('0x5'));var auth=require(_0x4bc0('0x6'));var interaction=require(_0x4bc0('0x7'));var config=require('../../config/environment');var controller=require(_0x4bc0('0x8'));router['get']('/',auth[_0x4bc0('0x9')](),controller[_0x4bc0('0xa')]);router[_0x4bc0('0xb')]('/:id',auth[_0x4bc0('0x9')](),controller[_0x4bc0('0xc')]);router['post']('/',auth[_0x4bc0('0x9')](),controller[_0x4bc0('0xd')]);router['put'](_0x4bc0('0xe'),auth[_0x4bc0('0x9')](),controller['update']);router[_0x4bc0('0xf')](_0x4bc0('0xe'),auth[_0x4bc0('0x9')](),controller['destroy']);module[_0x4bc0('0x10')]=router; \ No newline at end of file +var _0x6157=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','/:id','isAuthenticated','show','post','put','update','exports'];(function(_0x3c3c48,_0x1482ee){var _0x3cdf31=function(_0x217d58){while(--_0x217d58){_0x3c3c48['push'](_0x3c3c48['shift']());}};_0x3cdf31(++_0x1482ee);}(_0x6157,0x1a0));var _0x7615=function(_0x40bd43,_0x8c7063){_0x40bd43=_0x40bd43-0x0;var _0x1122f4=_0x6157[_0x40bd43];return _0x1122f4;};'use strict';var multer=require(_0x7615('0x0'));var util=require(_0x7615('0x1'));var path=require('path');var timeout=require(_0x7615('0x2'));var express=require(_0x7615('0x3'));var router=express['Router']();var fs_extra=require(_0x7615('0x4'));var auth=require(_0x7615('0x5'));var interaction=require(_0x7615('0x6'));var config=require(_0x7615('0x7'));var controller=require(_0x7615('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7615('0x9'),auth[_0x7615('0xa')](),controller[_0x7615('0xb')]);router[_0x7615('0xc')]('/',auth[_0x7615('0xa')](),controller['create']);router[_0x7615('0xd')](_0x7615('0x9'),auth['isAuthenticated'](),controller[_0x7615('0xe')]);router['delete'](_0x7615('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7615('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 240098c..2b23c19 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 _0x223c=['exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x5a905e,_0x31aa4a){var _0x4124d6=function(_0x37c28a){while(--_0x37c28a){_0x5a905e['push'](_0x5a905e['shift']());}};_0x4124d6(++_0x31aa4a);}(_0x223c,0xd7));var _0xc223=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x223c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc223('0x0'));module[_0xc223('0x1')]={'name':{'type':Sequelize[_0xc223('0x2')]},'prefix':{'type':Sequelize[_0xc223('0x2')],'unique':_0xc223('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc223('0x2')],'set':function(_0x269ce5){this[_0xc223('0x4')](_0xc223('0x5'),_0x269ce5?_0x269ce5[_0xc223('0x6')](''):[]);},'get':function(){return this[_0xc223('0x7')](_0xc223('0x5'))?this['getDataValue'](_0xc223('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xc223('0x2')]},'record':{'type':Sequelize[_0xc223('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc223('0x2')]},'description':{'type':Sequelize[_0xc223('0x2')]}}; \ No newline at end of file +var _0xab63=['options','join','getDataValue','BOOLEAN','exports','STRING','setDataValue'];(function(_0x3a3f4c,_0x45afeb){var _0x4b8b3a=function(_0x1c3c14){while(--_0x1c3c14){_0x3a3f4c['push'](_0x3a3f4c['shift']());}};_0x4b8b3a(++_0x45afeb);}(_0xab63,0xa5));var _0x3ab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab63[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3ab6('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x3ab6('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x3ab6('0x1')],'set':function(_0x1534ae){this[_0x3ab6('0x2')](_0x3ab6('0x3'),_0x1534ae?_0x1534ae[_0x3ab6('0x4')](''):[]);},'get':function(){return this[_0x3ab6('0x5')](_0x3ab6('0x3'))?this[_0x3ab6('0x5')](_0x3ab6('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0x3ab6('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x3ab6('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3ab6('0x1')]},'description':{'type':Sequelize[_0x3ab6('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e56c3b6..98144b0 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 _0x0884=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','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','util','path','sox','to-csv','ejs','squel','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','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','VoiceChanSpy','rows','show','params','keys','length','options','find','catch','create'];(function(_0x45dd98,_0x3f6063){var _0x38ac97=function(_0x2b5dd3){while(--_0x2b5dd3){_0x45dd98['push'](_0x45dd98['shift']());}};_0x38ac97(++_0x3f6063);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4088('0x0'));var rimraf=require(_0x4088('0x1'));var zipdir=require(_0x4088('0x2'));var jsonpatch=require(_0x4088('0x3'));var rp=require(_0x4088('0x4'));var moment=require(_0x4088('0x5'));var BPromise=require(_0x4088('0x6'));var Mustache=require('mustache');var util=require(_0x4088('0x7'));var path=require(_0x4088('0x8'));var sox=require(_0x4088('0x9'));var csv=require(_0x4088('0xa'));var ejs=require(_0x4088('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4088('0xc'));var crypto=require('crypto');var jsforce=require(_0x4088('0xd'));var deskjs=require(_0x4088('0xe'));var toCsv=require(_0x4088('0xa'));var querystring=require(_0x4088('0xf'));var Papa=require(_0x4088('0x10'));var Redis=require(_0x4088('0x11'));var authService=require(_0x4088('0x12'));var qs=require(_0x4088('0x13'));var as=require(_0x4088('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4088('0x15'))(_0x4088('0x16'));var utils=require(_0x4088('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4088('0x18'));var db=require(_0x4088('0x19'))['db'];function respondWithStatusCode(_0x4da1fa,_0x1c0e0e){_0x1c0e0e=_0x1c0e0e||0xcc;return function(_0x3ad4d4){if(_0x3ad4d4){return _0x4da1fa[_0x4088('0x1a')](_0x1c0e0e);}return _0x4da1fa[_0x4088('0x1b')](_0x1c0e0e)[_0x4088('0x1c')]();};}function respondWithResult(_0x1c5567,_0x10fde4){_0x10fde4=_0x10fde4||0xc8;return function(_0x30c843){if(_0x30c843){return _0x1c5567[_0x4088('0x1b')](_0x10fde4)[_0x4088('0x1d')](_0x30c843);}};}function respondWithFilteredResult(_0xd77d9f,_0x1c05ca){return function(_0x2d6aca){if(_0x2d6aca){var _0x51ff21=typeof _0x1c05ca[_0x4088('0x1e')]===_0x4088('0x1f')&&typeof _0x1c05ca[_0x4088('0x20')]===_0x4088('0x1f');var _0x55712b=_0x2d6aca[_0x4088('0x21')];var _0x24fe84=_0x51ff21?0x0:_0x1c05ca[_0x4088('0x1e')];var _0xf21ee7=_0x51ff21?_0x2d6aca[_0x4088('0x21')]:_0x1c05ca[_0x4088('0x1e')]+_0x1c05ca[_0x4088('0x20')];var _0x3d7570;if(_0xf21ee7>=_0x55712b){_0xf21ee7=_0x55712b;_0x3d7570=0xc8;}else{_0x3d7570=0xce;}_0xd77d9f[_0x4088('0x1b')](_0x3d7570);return _0xd77d9f[_0x4088('0x22')]('Content-Range',_0x24fe84+'-'+_0xf21ee7+'/'+_0x55712b)[_0x4088('0x1d')](_0x2d6aca);}return null;};}function patchUpdates(_0x4b887e){return function(_0x5248ca){try{jsonpatch['apply'](_0x5248ca,_0x4b887e,!![]);}catch(_0x5c49c8){return BPromise[_0x4088('0x23')](_0x5c49c8);}return _0x5248ca[_0x4088('0x24')]();};}function saveUpdates(_0x45b76b,_0x31f333){return function(_0x5e8031){if(_0x5e8031){return _0x5e8031[_0x4088('0x25')](_0x45b76b)[_0x4088('0x26')](function(_0x3b61b3){return _0x3b61b3;});}return null;};}function removeEntity(_0x556e80,_0x4c98ef){return function(_0x27ee8e){if(_0x27ee8e){return _0x27ee8e[_0x4088('0x27')]()[_0x4088('0x26')](function(){var _0x159158=_0x27ee8e[_0x4088('0x28')]({'plain':!![]});var _0x1274c5='ChanSpies';return db['UserProfileResource'][_0x4088('0x27')]({'where':{'type':_0x1274c5,'resourceId':_0x159158['id']}})[_0x4088('0x26')](function(){return _0x27ee8e;});})[_0x4088('0x26')](function(){_0x556e80[_0x4088('0x1b')](0xcc)[_0x4088('0x1c')]();});}};}function handleEntityNotFound(_0x29f58b,_0x13db21){return function(_0x5d94aa){if(!_0x5d94aa){_0x29f58b[_0x4088('0x1a')](0x194);}return _0x5d94aa;};}function handleError(_0x5966a5,_0x51ae50){_0x51ae50=_0x51ae50||0x1f4;return function(_0x4411d8){logger[_0x4088('0x29')](_0x4411d8[_0x4088('0x2a')]);if(_0x4411d8['name']){delete _0x4411d8[_0x4088('0x2b')];}_0x5966a5[_0x4088('0x1b')](_0x51ae50)[_0x4088('0x2c')](_0x4411d8);};}exports['index']=function(_0x3338fa,_0x5d720a){var _0x539e30={},_0x375a9f={},_0x192dfa={'count':0x0,'rows':[]};var _0x4c7a58=_[_0x4088('0x2d')](db['VoiceChanSpy'][_0x4088('0x2e')],function(_0x170399){return{'name':_0x170399[_0x4088('0x2f')],'type':_0x170399[_0x4088('0x30')][_0x4088('0x31')]};});_0x375a9f['model']=_[_0x4088('0x2d')](_0x4c7a58,_0x4088('0x2b'));_0x375a9f[_0x4088('0x32')]=_['keys'](_0x3338fa[_0x4088('0x32')]);_0x375a9f['filters']=_[_0x4088('0x33')](_0x375a9f[_0x4088('0x34')],_0x375a9f['query']);_0x539e30[_0x4088('0x35')]=_['intersection'](_0x375a9f[_0x4088('0x34')],qs[_0x4088('0x36')](_0x3338fa[_0x4088('0x32')][_0x4088('0x36')]));_0x539e30[_0x4088('0x35')]=_0x539e30[_0x4088('0x35')]['length']?_0x539e30[_0x4088('0x35')]:_0x375a9f[_0x4088('0x34')];if(!_0x3338fa['query'][_0x4088('0x37')](_0x4088('0x38'))){_0x539e30['limit']=qs['limit'](_0x3338fa[_0x4088('0x32')][_0x4088('0x20')]);_0x539e30[_0x4088('0x1e')]=qs[_0x4088('0x1e')](_0x3338fa[_0x4088('0x32')][_0x4088('0x1e')]);}_0x539e30['order']=qs[_0x4088('0x39')](_0x3338fa[_0x4088('0x32')][_0x4088('0x39')]);_0x539e30['where']=qs[_0x4088('0x3a')](_[_0x4088('0x3b')](_0x3338fa['query'],_0x375a9f[_0x4088('0x3a')]),_0x4c7a58);if(_0x3338fa[_0x4088('0x32')][_0x4088('0x3c')]){_0x539e30[_0x4088('0x3d')]=_[_0x4088('0x3e')](_0x539e30[_0x4088('0x3d')],{'$or':_[_0x4088('0x2d')](_0x4c7a58,function(_0x1febed){if(_0x1febed[_0x4088('0x30')]!==_0x4088('0x3f')){var _0x2089bc={};_0x2089bc[_0x1febed['name']]={'$like':'%'+_0x3338fa[_0x4088('0x32')][_0x4088('0x3c')]+'%'};return _0x2089bc;}})});}_0x539e30=_['merge']({},_0x539e30,_0x3338fa['options']);var _0x200545={'where':_0x539e30['where']};return db['VoiceChanSpy']['count'](_0x200545)[_0x4088('0x26')](function(_0x5d4960){_0x192dfa[_0x4088('0x21')]=_0x5d4960;if(_0x3338fa[_0x4088('0x32')][_0x4088('0x40')]){_0x539e30[_0x4088('0x41')]=[{'all':!![]}];}return db[_0x4088('0x42')]['findAll'](_0x539e30);})['then'](function(_0xcb50d6){_0x192dfa[_0x4088('0x43')]=_0xcb50d6;return _0x192dfa;})[_0x4088('0x26')](respondWithFilteredResult(_0x5d720a,_0x539e30))['catch'](handleError(_0x5d720a,null));};exports[_0x4088('0x44')]=function(_0x1084c5,_0x4d6e4b){var _0x43e8e5={'raw':![],'where':{'id':_0x1084c5[_0x4088('0x45')]['id']}},_0x9cbf69={};_0x9cbf69[_0x4088('0x34')]=_[_0x4088('0x46')](db[_0x4088('0x42')][_0x4088('0x2e')]);_0x9cbf69[_0x4088('0x32')]=_[_0x4088('0x46')](_0x1084c5[_0x4088('0x32')]);_0x9cbf69[_0x4088('0x3a')]=_[_0x4088('0x33')](_0x9cbf69[_0x4088('0x34')],_0x9cbf69[_0x4088('0x32')]);_0x43e8e5[_0x4088('0x35')]=_[_0x4088('0x33')](_0x9cbf69[_0x4088('0x34')],qs[_0x4088('0x36')](_0x1084c5[_0x4088('0x32')]['fields']));_0x43e8e5[_0x4088('0x35')]=_0x43e8e5[_0x4088('0x35')][_0x4088('0x47')]?_0x43e8e5[_0x4088('0x35')]:_0x9cbf69[_0x4088('0x34')];if(_0x1084c5['query']['includeAll']){_0x43e8e5[_0x4088('0x41')]=[{'all':!![]}];}_0x43e8e5=_[_0x4088('0x3e')]({},_0x43e8e5,_0x1084c5[_0x4088('0x48')]);return db['VoiceChanSpy'][_0x4088('0x49')](_0x43e8e5)['then'](handleEntityNotFound(_0x4d6e4b,null))[_0x4088('0x26')](respondWithResult(_0x4d6e4b,null))[_0x4088('0x4a')](handleError(_0x4d6e4b,null));};exports[_0x4088('0x4b')]=function(_0x557576,_0x447f81){return db[_0x4088('0x42')][_0x4088('0x4b')](_0x557576[_0x4088('0x4c')],{})[_0x4088('0x26')](function(_0x47e9fa){var _0xd591e7=_0x557576[_0x4088('0x4d')][_0x4088('0x28')]({'plain':!![]});if(!_0xd591e7)throw new Error(_0x4088('0x4e'));if(_0xd591e7[_0x4088('0x4f')]===_0x4088('0x4d')){var _0x3d4ec8=_0x47e9fa[_0x4088('0x28')]({'plain':!![]});var _0xdcb500=_0x4088('0x50');return db['UserProfileSection']['find']({'where':{'name':_0xdcb500,'userProfileId':_0xd591e7[_0x4088('0x51')]},'raw':!![]})[_0x4088('0x26')](function(_0x19e292){if(_0x19e292&&_0x19e292[_0x4088('0x52')]===0x0){return db[_0x4088('0x53')][_0x4088('0x4b')]({'name':_0x3d4ec8[_0x4088('0x2b')],'resourceId':_0x3d4ec8['id'],'type':_0x19e292[_0x4088('0x2b')],'sectionId':_0x19e292['id']},{})[_0x4088('0x26')](function(){return _0x47e9fa;});}else{return _0x47e9fa;}})['catch'](function(_0x1bdbd6){logger['error'](_0x4088('0x54'),_0x1bdbd6);throw _0x1bdbd6;});}return _0x47e9fa;})[_0x4088('0x26')](respondWithResult(_0x447f81,0xc9))['catch'](handleError(_0x447f81,null));};exports[_0x4088('0x25')]=function(_0x18c118,_0x128ccc){if(_0x18c118[_0x4088('0x4c')]['id']){delete _0x18c118[_0x4088('0x4c')]['id'];}return db[_0x4088('0x42')][_0x4088('0x49')]({'where':{'id':_0x18c118[_0x4088('0x45')]['id']}})['then'](handleEntityNotFound(_0x128ccc,null))[_0x4088('0x26')](saveUpdates(_0x18c118[_0x4088('0x4c')],null))[_0x4088('0x26')](respondWithResult(_0x128ccc,null))[_0x4088('0x4a')](handleError(_0x128ccc,null));};exports[_0x4088('0x27')]=function(_0x50db3d,_0x26ed52){return db[_0x4088('0x42')]['find']({'where':{'id':_0x50db3d[_0x4088('0x45')]['id']}})[_0x4088('0x26')](handleEntityNotFound(_0x26ed52,null))[_0x4088('0x26')](removeEntity(_0x26ed52,null))[_0x4088('0x4a')](handleError(_0x26ed52,null));}; \ No newline at end of file +var _0x38c3=['then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VoiceChanSpy','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x38c3,0x13d));var _0x338c=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x38c3[_0x4cce65];return _0x4d1b45;};'use strict';var emlformat=require(_0x338c('0x0'));var rimraf=require(_0x338c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x338c('0x2'));var rp=require(_0x338c('0x3'));var moment=require(_0x338c('0x4'));var BPromise=require(_0x338c('0x5'));var Mustache=require(_0x338c('0x6'));var util=require(_0x338c('0x7'));var path=require('path');var sox=require(_0x338c('0x8'));var csv=require('to-csv');var ejs=require(_0x338c('0x9'));var fs=require('fs');var fs_extra=require(_0x338c('0xa'));var _=require('lodash');var squel=require(_0x338c('0xb'));var crypto=require(_0x338c('0xc'));var jsforce=require(_0x338c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x338c('0xe'));var querystring=require(_0x338c('0xf'));var Papa=require(_0x338c('0x10'));var Redis=require(_0x338c('0x11'));var authService=require(_0x338c('0x12'));var qs=require(_0x338c('0x13'));var as=require(_0x338c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x338c('0x15'))(_0x338c('0x16'));var utils=require('../../config/utils');var config=require(_0x338c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x338c('0x18'))['db'];function respondWithStatusCode(_0x120107,_0x4931be){_0x4931be=_0x4931be||0xcc;return function(_0x1734d4){if(_0x1734d4){return _0x120107[_0x338c('0x19')](_0x4931be);}return _0x120107[_0x338c('0x1a')](_0x4931be)[_0x338c('0x1b')]();};}function respondWithResult(_0x1c4bb4,_0x3e778a){_0x3e778a=_0x3e778a||0xc8;return function(_0x11928e){if(_0x11928e){return _0x1c4bb4[_0x338c('0x1a')](_0x3e778a)[_0x338c('0x1c')](_0x11928e);}};}function respondWithFilteredResult(_0x127cd1,_0x512b38){return function(_0x5afbd4){if(_0x5afbd4){var _0x26a6dd=typeof _0x512b38[_0x338c('0x1d')]===_0x338c('0x1e')&&typeof _0x512b38[_0x338c('0x1f')]==='undefined';var _0x22a70b=_0x5afbd4[_0x338c('0x20')];var _0x3a0784=_0x26a6dd?0x0:_0x512b38[_0x338c('0x1d')];var _0x190919=_0x26a6dd?_0x5afbd4[_0x338c('0x20')]:_0x512b38[_0x338c('0x1d')]+_0x512b38[_0x338c('0x1f')];var _0x339b30;if(_0x190919>=_0x22a70b){_0x190919=_0x22a70b;_0x339b30=0xc8;}else{_0x339b30=0xce;}_0x127cd1[_0x338c('0x1a')](_0x339b30);return _0x127cd1[_0x338c('0x21')](_0x338c('0x22'),_0x3a0784+'-'+_0x190919+'/'+_0x22a70b)[_0x338c('0x1c')](_0x5afbd4);}return null;};}function patchUpdates(_0x5eccab){return function(_0x4efa92){try{jsonpatch[_0x338c('0x23')](_0x4efa92,_0x5eccab,!![]);}catch(_0x457d0f){return BPromise[_0x338c('0x24')](_0x457d0f);}return _0x4efa92[_0x338c('0x25')]();};}function saveUpdates(_0x55ceae,_0x79a67f){return function(_0x565fe1){if(_0x565fe1){return _0x565fe1[_0x338c('0x26')](_0x55ceae)[_0x338c('0x27')](function(_0x5d9fd1){return _0x5d9fd1;});}return null;};}function removeEntity(_0x34e098,_0x144db9){return function(_0x5bb7bf){if(_0x5bb7bf){return _0x5bb7bf[_0x338c('0x28')]()[_0x338c('0x27')](function(){var _0x4e56cf=_0x5bb7bf[_0x338c('0x29')]({'plain':!![]});var _0x26013d=_0x338c('0x2a');return db[_0x338c('0x2b')][_0x338c('0x28')]({'where':{'type':_0x26013d,'resourceId':_0x4e56cf['id']}})[_0x338c('0x27')](function(){return _0x5bb7bf;});})['then'](function(){_0x34e098[_0x338c('0x1a')](0xcc)[_0x338c('0x1b')]();});}};}function handleEntityNotFound(_0xa7db44,_0x4d78a5){return function(_0x3ae957){if(!_0x3ae957){_0xa7db44[_0x338c('0x19')](0x194);}return _0x3ae957;};}function handleError(_0x4f1d0a,_0x3ca50c){_0x3ca50c=_0x3ca50c||0x1f4;return function(_0x164260){logger[_0x338c('0x2c')](_0x164260[_0x338c('0x2d')]);if(_0x164260[_0x338c('0x2e')]){delete _0x164260[_0x338c('0x2e')];}_0x4f1d0a['status'](_0x3ca50c)['send'](_0x164260);};}exports[_0x338c('0x2f')]=function(_0x35e84a,_0x59820d){var _0x469c25={},_0x1147e0={},_0x4d924c={'count':0x0,'rows':[]};var _0x4d59bf=_[_0x338c('0x30')](db['VoiceChanSpy'][_0x338c('0x31')],function(_0xe32c1c){return{'name':_0xe32c1c[_0x338c('0x32')],'type':_0xe32c1c[_0x338c('0x33')][_0x338c('0x34')]};});_0x1147e0[_0x338c('0x35')]=_['map'](_0x4d59bf,'name');_0x1147e0['query']=_[_0x338c('0x36')](_0x35e84a[_0x338c('0x37')]);_0x1147e0['filters']=_[_0x338c('0x38')](_0x1147e0[_0x338c('0x35')],_0x1147e0[_0x338c('0x37')]);_0x469c25[_0x338c('0x39')]=_[_0x338c('0x38')](_0x1147e0[_0x338c('0x35')],qs['fields'](_0x35e84a[_0x338c('0x37')][_0x338c('0x3a')]));_0x469c25[_0x338c('0x39')]=_0x469c25['attributes'][_0x338c('0x3b')]?_0x469c25[_0x338c('0x39')]:_0x1147e0[_0x338c('0x35')];if(!_0x35e84a[_0x338c('0x37')][_0x338c('0x3c')](_0x338c('0x3d'))){_0x469c25[_0x338c('0x1f')]=qs[_0x338c('0x1f')](_0x35e84a['query'][_0x338c('0x1f')]);_0x469c25[_0x338c('0x1d')]=qs[_0x338c('0x1d')](_0x35e84a[_0x338c('0x37')]['offset']);}_0x469c25[_0x338c('0x3e')]=qs[_0x338c('0x3f')](_0x35e84a[_0x338c('0x37')][_0x338c('0x3f')]);_0x469c25['where']=qs[_0x338c('0x40')](_[_0x338c('0x41')](_0x35e84a[_0x338c('0x37')],_0x1147e0[_0x338c('0x40')]),_0x4d59bf);if(_0x35e84a[_0x338c('0x37')][_0x338c('0x42')]){_0x469c25[_0x338c('0x43')]=_[_0x338c('0x44')](_0x469c25[_0x338c('0x43')],{'$or':_[_0x338c('0x30')](_0x4d59bf,function(_0x20d0eb){if(_0x20d0eb[_0x338c('0x33')]!==_0x338c('0x45')){var _0x45171b={};_0x45171b[_0x20d0eb[_0x338c('0x2e')]]={'$like':'%'+_0x35e84a[_0x338c('0x37')][_0x338c('0x42')]+'%'};return _0x45171b;}})});}_0x469c25=_[_0x338c('0x44')]({},_0x469c25,_0x35e84a[_0x338c('0x46')]);var _0x17f520={'where':_0x469c25[_0x338c('0x43')]};return db[_0x338c('0x47')][_0x338c('0x20')](_0x17f520)[_0x338c('0x27')](function(_0x1e9bbf){_0x4d924c[_0x338c('0x20')]=_0x1e9bbf;if(_0x35e84a['query'][_0x338c('0x48')]){_0x469c25['include']=[{'all':!![]}];}return db[_0x338c('0x47')][_0x338c('0x49')](_0x469c25);})[_0x338c('0x27')](function(_0x580f6a){_0x4d924c[_0x338c('0x4a')]=_0x580f6a;return _0x4d924c;})[_0x338c('0x27')](respondWithFilteredResult(_0x59820d,_0x469c25))[_0x338c('0x4b')](handleError(_0x59820d,null));};exports[_0x338c('0x4c')]=function(_0xf781b5,_0x34ace1){var _0x2c5c95={'raw':![],'where':{'id':_0xf781b5[_0x338c('0x4d')]['id']}},_0x1f7861={};_0x1f7861[_0x338c('0x35')]=_['keys'](db[_0x338c('0x47')][_0x338c('0x31')]);_0x1f7861[_0x338c('0x37')]=_['keys'](_0xf781b5[_0x338c('0x37')]);_0x1f7861[_0x338c('0x40')]=_['intersection'](_0x1f7861[_0x338c('0x35')],_0x1f7861[_0x338c('0x37')]);_0x2c5c95[_0x338c('0x39')]=_[_0x338c('0x38')](_0x1f7861['model'],qs[_0x338c('0x3a')](_0xf781b5[_0x338c('0x37')]['fields']));_0x2c5c95[_0x338c('0x39')]=_0x2c5c95[_0x338c('0x39')][_0x338c('0x3b')]?_0x2c5c95[_0x338c('0x39')]:_0x1f7861[_0x338c('0x35')];if(_0xf781b5[_0x338c('0x37')][_0x338c('0x48')]){_0x2c5c95[_0x338c('0x4e')]=[{'all':!![]}];}_0x2c5c95=_['merge']({},_0x2c5c95,_0xf781b5[_0x338c('0x46')]);return db[_0x338c('0x47')][_0x338c('0x4f')](_0x2c5c95)[_0x338c('0x27')](handleEntityNotFound(_0x34ace1,null))['then'](respondWithResult(_0x34ace1,null))[_0x338c('0x4b')](handleError(_0x34ace1,null));};exports[_0x338c('0x50')]=function(_0x5ea49f,_0x5cfd91){return db['VoiceChanSpy'][_0x338c('0x50')](_0x5ea49f[_0x338c('0x51')],{})[_0x338c('0x27')](function(_0x4cd985){var _0x122baf=_0x5ea49f[_0x338c('0x52')]['get']({'plain':!![]});if(!_0x122baf)throw new Error(_0x338c('0x53'));if(_0x122baf[_0x338c('0x54')]===_0x338c('0x52')){var _0x51f67f=_0x4cd985[_0x338c('0x29')]({'plain':!![]});var _0xc7cf0='ChanSpies';return db[_0x338c('0x55')]['find']({'where':{'name':_0xc7cf0,'userProfileId':_0x122baf[_0x338c('0x56')]},'raw':!![]})[_0x338c('0x27')](function(_0x451c23){if(_0x451c23&&_0x451c23[_0x338c('0x57')]===0x0){return db[_0x338c('0x2b')][_0x338c('0x50')]({'name':_0x51f67f[_0x338c('0x2e')],'resourceId':_0x51f67f['id'],'type':_0x451c23[_0x338c('0x2e')],'sectionId':_0x451c23['id']},{})[_0x338c('0x27')](function(){return _0x4cd985;});}else{return _0x4cd985;}})[_0x338c('0x4b')](function(_0x483096){logger['error'](_0x338c('0x58'),_0x483096);throw _0x483096;});}return _0x4cd985;})[_0x338c('0x27')](respondWithResult(_0x5cfd91,0xc9))[_0x338c('0x4b')](handleError(_0x5cfd91,null));};exports[_0x338c('0x26')]=function(_0x40459b,_0x1b417e){if(_0x40459b[_0x338c('0x51')]['id']){delete _0x40459b[_0x338c('0x51')]['id'];}return db[_0x338c('0x47')][_0x338c('0x4f')]({'where':{'id':_0x40459b[_0x338c('0x4d')]['id']}})[_0x338c('0x27')](handleEntityNotFound(_0x1b417e,null))['then'](saveUpdates(_0x40459b[_0x338c('0x51')],null))['then'](respondWithResult(_0x1b417e,null))['catch'](handleError(_0x1b417e,null));};exports[_0x338c('0x28')]=function(_0x20eea4,_0x530103){return db['VoiceChanSpy']['find']({'where':{'id':_0x20eea4[_0x338c('0x4d')]['id']}})[_0x338c('0x27')](handleEntityNotFound(_0x530103,null))[_0x338c('0x27')](removeEntity(_0x530103,null))[_0x338c('0x4b')](handleError(_0x530103,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ebf5944..cb5510c 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 _0x14d6=['chanspy','record','push','merge','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','models','VoiceChanSpy','VoiceExtension','destroy','bulkCreate','bluebird','from-sip','format','%s%s','prefix','system','CDR(type)=%s'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x14d6,0x16f));var _0x614d=function(_0x2653a7,_0x4a61bf){_0x2653a7=_0x2653a7-0x0;var _0x1fd413=_0x14d6[_0x2653a7];return _0x1fd413;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x614d('0x0'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2a4ecd,_0xba78c8,_0x1df1be){var _0x1b4a7a=0x1;var _0x227dcb=[];var _0x4a7b5a={'context':_0xba78c8['context']||_0x614d('0x1'),'exten':util[_0x614d('0x2')](_0x614d('0x3'),_0x2a4ecd[_0x614d('0x4')],_0x1df1be),'type':_0x614d('0x5'),'isApp':![],'ChanSpyId':_0x2a4ecd['id'],'UserId':_0xba78c8['id']};_0x227dcb['push'](_['merge']({'app':'Set','appdata':util[_0x614d('0x2')](_0x614d('0x6'),_0x614d('0x7')),'priority':_0x1b4a7a++},_0x4a7b5a));if(_0x2a4ecd[_0x614d('0x8')]){_0x227dcb[_0x614d('0x9')](_[_0x614d('0xa')]({'app':_0x614d('0xb'),'appdata':util[_0x614d('0x2')](_0x614d('0xc'),_0x2a4ecd['recordingFormat']),'priority':_0x1b4a7a++},_0x4a7b5a));}if(_0x2a4ecd[_0x614d('0xd')]){_0x227dcb[_0x614d('0x9')](_[_0x614d('0xa')]({'app':_0x614d('0xe'),'appdata':_0x2a4ecd['password'],'priority':_0x1b4a7a++},_0x4a7b5a));}_0x227dcb[_0x614d('0x9')](_['merge']({'app':_0x614d('0xf'),'appdata':util['format'](_0x614d('0x10'),_0xba78c8[_0x614d('0x11')],_0x2a4ecd[_0x614d('0x12')]?_0x2a4ecd[_0x614d('0x12')][_0x614d('0x13')](''):''),'priority':_0x1b4a7a++},_0x4a7b5a));if(_0x2a4ecd[_0x614d('0x8')]){_0x227dcb[_0x614d('0x9')](_['merge']({'app':_0x614d('0x14'),'priority':_0x1b4a7a++},_0x4a7b5a));}return _0x227dcb;};var getChanSpyApplications=function(_0x45d8b9,_0x26d060){var _0x7ce4eb=[];for(var _0xe2e29b=0x0,_0x14437d=0x1;_0xe2e29b<_0x26d060[_0x614d('0x15')];_0xe2e29b++,_0x14437d=0x1){_0x7ce4eb=_0x7ce4eb['concat'](getUserApplications(_0x45d8b9,_0x26d060[_0xe2e29b],_0x26d060[_0xe2e29b][_0x614d('0x16')]));if(_0x26d060[_0xe2e29b][_0x614d('0x16')]!=_0x26d060[_0xe2e29b]['name']){_0x7ce4eb=_0x7ce4eb[_0x614d('0x17')](getUserApplications(_0x45d8b9,_0x26d060[_0xe2e29b],_0x26d060[_0xe2e29b][_0x614d('0x11')]));}}return _0x7ce4eb;};var getChanSpyPromise=function(_0x1ac3b0,_0x425673){return new BPromise(function(_0x3b9b8b,_0x24009c){return _0x1ac3b0[_0x614d('0x18')][_0x614d('0x19')]({'attributes':['id','name',_0x614d('0x16')],'where':{'role':_0x614d('0x1a'),'chanspy':!![]},'raw':!![]})[_0x614d('0x1b')](function(_0x4efc3c){if(_0x4efc3c){return _0x3b9b8b(getChanSpyApplications(_0x425673,_0x4efc3c));}return _0x3b9b8b([]);})[_0x614d('0x1c')](function(_0x41822e){_0x24009c(_0x41822e);});});};module['exports']=function(_0x437f8d,_0x29ee13){var _0x5e4512=_0x437f8d[_0x614d('0x1d')];return _0x437f8d['define'](_0x614d('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xca9472,_0x1eb728,_0x36f858){return getChanSpyPromise(_0x5e4512,_0xca9472)[_0x614d('0x1b')](function(_0xb1bd65){if(_0xb1bd65&&_0xb1bd65[_0x614d('0x15')]){return _0x5e4512[_0x614d('0x1f')]['bulkCreate'](_0xb1bd65);}})[_0x614d('0x1b')](function(){_0x36f858();})[_0x614d('0x1c')](function(_0xe0a2a4){_0x36f858(_0xe0a2a4);});},'afterUpdate':function(_0x5b7f26,_0x51bb25,_0x188daf){return _0x5e4512[_0x614d('0x1f')][_0x614d('0x20')]({'where':{'ChanSpyId':_0x5b7f26['id']}})[_0x614d('0x1b')](function(){return getChanSpyPromise(_0x5e4512,_0x5b7f26);})[_0x614d('0x1b')](function(_0x9501a8){if(_0x9501a8&&_0x9501a8[_0x614d('0x15')]){return _0x5e4512[_0x614d('0x1f')][_0x614d('0x21')](_0x9501a8);}})[_0x614d('0x1b')](function(){_0x188daf();})[_0x614d('0x1c')](function(_0x539b11){_0x188daf(_0x539b11);});},'afterDestroy':function(_0x3765cc,_0x30c163,_0x11bb36){return _0x5e4512[_0x614d('0x1f')][_0x614d('0x20')]({'where':{'ChanSpyId':_0x3765cc['id']}})[_0x614d('0x1b')](function(){_0x11bb36();})[_0x614d('0x1c')](function(_0x1f8ef4){_0x11bb36(_0x1f8ef4);});}}});}; \ No newline at end of file +var _0xea73=['options','join','StopMixMonitor','concat','internal','User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','system','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','push','ChanSpy','SIP/%s,%s','name'];(function(_0x33611b,_0x5d242f){var _0x236e8a=function(_0x55d842){while(--_0x55d842){_0x33611b['push'](_0x33611b['shift']());}};_0x236e8a(++_0x5d242f);}(_0xea73,0x1e5));var _0x3ea7=function(_0x5cd68b,_0x80ec2c){_0x5cd68b=_0x5cd68b-0x0;var _0xac8b52=_0xea73[_0x5cd68b];return _0xac8b52;};'use strict';var _=require(_0x3ea7('0x0'));var util=require('util');var BPromise=require(_0x3ea7('0x1'));var attributes=require(_0x3ea7('0x2'));var getUserApplications=function(_0x462124,_0x417635,_0x36eef3){var _0x245b4c=0x1;var _0x39eebf=[];var _0x16030d={'context':_0x417635['context']||_0x3ea7('0x3'),'exten':util[_0x3ea7('0x4')](_0x3ea7('0x5'),_0x462124['prefix'],_0x36eef3),'type':_0x3ea7('0x6'),'isApp':![],'ChanSpyId':_0x462124['id'],'UserId':_0x417635['id']};_0x39eebf['push'](_[_0x3ea7('0x7')]({'app':_0x3ea7('0x8'),'appdata':util[_0x3ea7('0x4')](_0x3ea7('0x9'),_0x3ea7('0xa')),'priority':_0x245b4c++},_0x16030d));if(_0x462124[_0x3ea7('0xb')]){_0x39eebf['push'](_['merge']({'app':_0x3ea7('0xc'),'appdata':util[_0x3ea7('0x4')](_0x3ea7('0xd'),_0x462124[_0x3ea7('0xe')]),'priority':_0x245b4c++},_0x16030d));}if(_0x462124[_0x3ea7('0xf')]){_0x39eebf['push'](_[_0x3ea7('0x7')]({'app':_0x3ea7('0x10'),'appdata':_0x462124[_0x3ea7('0x11')],'priority':_0x245b4c++},_0x16030d));}_0x39eebf[_0x3ea7('0x12')](_[_0x3ea7('0x7')]({'app':_0x3ea7('0x13'),'appdata':util['format'](_0x3ea7('0x14'),_0x417635[_0x3ea7('0x15')],_0x462124['options']?_0x462124[_0x3ea7('0x16')][_0x3ea7('0x17')](''):''),'priority':_0x245b4c++},_0x16030d));if(_0x462124[_0x3ea7('0xb')]){_0x39eebf[_0x3ea7('0x12')](_[_0x3ea7('0x7')]({'app':_0x3ea7('0x18'),'priority':_0x245b4c++},_0x16030d));}return _0x39eebf;};var getChanSpyApplications=function(_0x9975f0,_0x13483e){var _0x3defd2=[];for(var _0x31f859=0x0,_0x219b01=0x1;_0x31f859<_0x13483e['length'];_0x31f859++,_0x219b01=0x1){_0x3defd2=_0x3defd2[_0x3ea7('0x19')](getUserApplications(_0x9975f0,_0x13483e[_0x31f859],_0x13483e[_0x31f859][_0x3ea7('0x1a')]));if(_0x13483e[_0x31f859][_0x3ea7('0x1a')]!=_0x13483e[_0x31f859]['name']){_0x3defd2=_0x3defd2[_0x3ea7('0x19')](getUserApplications(_0x9975f0,_0x13483e[_0x31f859],_0x13483e[_0x31f859]['name']));}}return _0x3defd2;};var getChanSpyPromise=function(_0x2abadb,_0x257b0c){return new BPromise(function(_0x2c3ba8,_0x2b436c){return _0x2abadb[_0x3ea7('0x1b')][_0x3ea7('0x1c')]({'attributes':['id','name',_0x3ea7('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x3ea7('0x1d')](function(_0x53cdac){if(_0x53cdac){return _0x2c3ba8(getChanSpyApplications(_0x257b0c,_0x53cdac));}return _0x2c3ba8([]);})[_0x3ea7('0x1e')](function(_0x3bf4e5){_0x2b436c(_0x3bf4e5);});});};module[_0x3ea7('0x1f')]=function(_0x4df7be,_0x331641){var _0x57080c=_0x4df7be[_0x3ea7('0x20')];return _0x4df7be[_0x3ea7('0x21')](_0x3ea7('0x22'),attributes,{'tableName':_0x3ea7('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x380473,_0x2aba2b,_0x16e3e9){return getChanSpyPromise(_0x57080c,_0x380473)[_0x3ea7('0x1d')](function(_0x10a3ab){if(_0x10a3ab&&_0x10a3ab[_0x3ea7('0x24')]){return _0x57080c[_0x3ea7('0x25')]['bulkCreate'](_0x10a3ab);}})[_0x3ea7('0x1d')](function(){_0x16e3e9();})[_0x3ea7('0x1e')](function(_0x10b506){_0x16e3e9(_0x10b506);});},'afterUpdate':function(_0x3aa015,_0x39e387,_0x371f51){return _0x57080c['VoiceExtension'][_0x3ea7('0x26')]({'where':{'ChanSpyId':_0x3aa015['id']}})[_0x3ea7('0x1d')](function(){return getChanSpyPromise(_0x57080c,_0x3aa015);})['then'](function(_0x4a8157){if(_0x4a8157&&_0x4a8157['length']){return _0x57080c['VoiceExtension']['bulkCreate'](_0x4a8157);}})[_0x3ea7('0x1d')](function(){_0x371f51();})['catch'](function(_0x534af5){_0x371f51(_0x534af5);});},'afterDestroy':function(_0x4e64e5,_0x12d263,_0x2d37a2){return _0x57080c['VoiceExtension'][_0x3ea7('0x26')]({'where':{'ChanSpyId':_0x4e64e5['id']}})[_0x3ea7('0x1d')](function(){_0x2d37a2();})[_0x3ea7('0x1e')](function(_0x3ee8ea){_0x2d37a2(_0x3ee8ea);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6d366cc..73ba131 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 _0xf72b=['../../config/environment','jayson/promise','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xad9b66,_0x4a6b2c){var _0x3e4c3f=function(_0x24725c){while(--_0x24725c){_0xad9b66['push'](_0xad9b66['shift']());}};_0x3e4c3f(++_0x4a6b2c);}(_0xf72b,0x1d9));var _0xbf72=function(_0xf3b50a,_0x1d5de2){_0xf3b50a=_0xf3b50a-0x0;var _0x3a2166=_0xf72b[_0xf3b50a];return _0x3a2166;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});} \ No newline at end of file +var _0x39cb=['code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x39cb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 83765d8..46f1f91 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 _0x94c8=['../../config/environment','./voiceContext.controller','index','post','create','/:id','isAuthenticated','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x49588b,_0x193a37){var _0x36a714=function(_0x80c3c6){while(--_0x80c3c6){_0x49588b['push'](_0x49588b['shift']());}};_0x36a714(++_0x193a37);}(_0x94c8,0x79));var _0x894c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94c8[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x894c('0x0'));var util=require('util');var path=require(_0x894c('0x1'));var timeout=require(_0x894c('0x2'));var express=require('express');var router=express[_0x894c('0x3')]();var fs_extra=require(_0x894c('0x4'));var auth=require(_0x894c('0x5'));var interaction=require(_0x894c('0x6'));var config=require(_0x894c('0x7'));var controller=require(_0x894c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x894c('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x894c('0xa')]('/',auth['isAuthenticated'](),controller[_0x894c('0xb')]);router['put'](_0x894c('0xc'),auth[_0x894c('0xd')](),controller['update']);router[_0x894c('0xe')]('/:id',auth[_0x894c('0xd')](),controller[_0x894c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8903=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout'];(function(_0x23b811,_0x5d6298){var _0x5b3770=function(_0x536f26){while(--_0x536f26){_0x23b811['push'](_0x23b811['shift']());}};_0x5b3770(++_0x5d6298);}(_0x8903,0x6f));var _0x3890=function(_0x1389e3,_0x2ed4bd){_0x1389e3=_0x1389e3-0x0;var _0x3f6873=_0x8903[_0x1389e3];return _0x3f6873;};'use strict';var multer=require(_0x3890('0x0'));var util=require('util');var path=require(_0x3890('0x1'));var timeout=require(_0x3890('0x2'));var express=require(_0x3890('0x3'));var router=express[_0x3890('0x4')]();var fs_extra=require(_0x3890('0x5'));var auth=require(_0x3890('0x6'));var interaction=require(_0x3890('0x7'));var config=require(_0x3890('0x8'));var controller=require(_0x3890('0x9'));router['get']('/',auth[_0x3890('0xa')](),controller['index']);router[_0x3890('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3890('0xc')]('/',auth['isAuthenticated'](),controller[_0x3890('0xd')]);router[_0x3890('0xe')](_0x3890('0xf'),auth[_0x3890('0xa')](),controller[_0x3890('0x10')]);router['delete'](_0x3890('0xf'),auth[_0x3890('0xa')](),controller[_0x3890('0x11')]);module[_0x3890('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index b0ee569..3a635ec 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 _0xac55=['name','BOOLEAN','sequelize'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0xac55,0xcb));var _0x5ac5=function(_0x3c84eb,_0x5eb874){_0x3c84eb=_0x3c84eb-0x0;var _0x5b11fb=_0xac55[_0x3c84eb];return _0x5b11fb;};'use strict';var Sequelize=require(_0x5ac5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5ac5('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5ac5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb281=['STRING','BOOLEAN','sequelize'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xb281,0x176));var _0x1b28=function(_0x3f264b,_0x1950f7){_0x3f264b=_0x3f264b-0x0;var _0x3ff7ca=_0xb281[_0x3f264b];return _0x3ff7ca;};'use strict';var Sequelize=require(_0x1b28('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b28('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x1b28('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1b28('0x2')],'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 b5c8523..acd8710 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 _0xc7b4=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','Contexts','UserProfileResource','stack','name','rawAttributes','fieldName','type','model','map','keys','intersection','query','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','VoiceContext','findAll','includeAll','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','get','role','UserProfileSection','userProfileId','autoAssociation','find','readFileSync','chan_sip.so','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b2d0e,_0x21a7ff){var _0x3d0c47=function(_0x272685){while(--_0x272685){_0x1b2d0e['push'](_0x1b2d0e['shift']());}};_0x3d0c47(++_0x21a7ff);}(_0xc7b4,0x16c));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c7b('0x0'));var jsonpatch=require(_0x4c7b('0x1'));var rp=require(_0x4c7b('0x2'));var moment=require(_0x4c7b('0x3'));var BPromise=require(_0x4c7b('0x4'));var Mustache=require('mustache');var util=require(_0x4c7b('0x5'));var path=require(_0x4c7b('0x6'));var sox=require(_0x4c7b('0x7'));var csv=require(_0x4c7b('0x8'));var ejs=require(_0x4c7b('0x9'));var fs=require('fs');var fs_extra=require(_0x4c7b('0xa'));var _=require(_0x4c7b('0xb'));var squel=require(_0x4c7b('0xc'));var crypto=require(_0x4c7b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4c7b('0xe'));var toCsv=require(_0x4c7b('0x8'));var querystring=require(_0x4c7b('0xf'));var Papa=require(_0x4c7b('0x10'));var Redis=require(_0x4c7b('0x11'));var authService=require(_0x4c7b('0x12'));var qs=require(_0x4c7b('0x13'));var as=require(_0x4c7b('0x14'));var hardwareService=require(_0x4c7b('0x15'));var logger=require(_0x4c7b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x4c7b('0x17'));var licenseUtil=require(_0x4c7b('0x18'));var db=require(_0x4c7b('0x19'))['db'];var jayson=require(_0x4c7b('0x1a'));var client=jayson[_0x4c7b('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3da84f,_0x581d85,_0x17784d,_0x2c8e75){return new BPromise(function(_0xba6525,_0xe019a3){var _0x8ee59b=_0x2c8e75||client;return _0x8ee59b['request'](_0x3da84f,_0x17784d)[_0x4c7b('0x1c')](function(_0xa2e37c){logger['info'](_0x4c7b('0x1d'),_0x581d85,_0x4c7b('0x1e'));logger[_0x4c7b('0x1f')](_0x4c7b('0x20'),_0x581d85,_0x4c7b('0x1e'),JSON[_0x4c7b('0x21')](_0xa2e37c));if(_0xa2e37c[_0x4c7b('0x22')]){if(_0xa2e37c[_0x4c7b('0x22')]['code']===0x1f4){logger[_0x4c7b('0x22')](_0x4c7b('0x1d'),_0x581d85,_0xa2e37c['error'][_0x4c7b('0x23')]);return _0xe019a3(_0xa2e37c[_0x4c7b('0x22')]['message']);}logger['error'](_0x4c7b('0x1d'),_0x581d85,_0xa2e37c['error'][_0x4c7b('0x23')]);return _0xba6525(_0xa2e37c[_0x4c7b('0x22')][_0x4c7b('0x23')]);}else{logger[_0x4c7b('0x24')](_0x4c7b('0x1d'),_0x581d85,_0x4c7b('0x1e'));_0xba6525(_0xa2e37c[_0x4c7b('0x25')][_0x4c7b('0x23')]);}})[_0x4c7b('0x26')](function(_0x241642){logger['error']('VoiceContext,\x20%s,\x20%s',_0x581d85,_0x241642);_0xe019a3(_0x241642);});});}function respondWithStatusCode(_0x2ac7f8,_0x5d3fcf){_0x5d3fcf=_0x5d3fcf||0xcc;return function(_0xa73c1c){if(_0xa73c1c){return _0x2ac7f8[_0x4c7b('0x27')](_0x5d3fcf);}return _0x2ac7f8[_0x4c7b('0x28')](_0x5d3fcf)[_0x4c7b('0x29')]();};}function respondWithResult(_0xf5ed26,_0x15815d){_0x15815d=_0x15815d||0xc8;return function(_0x4d7ede){if(_0x4d7ede){return _0xf5ed26[_0x4c7b('0x28')](_0x15815d)[_0x4c7b('0x2a')](_0x4d7ede);}};}function respondWithFilteredResult(_0xb04beb,_0x50151a){return function(_0x16280f){if(_0x16280f){var _0x52deb5=typeof _0x50151a['offset']===_0x4c7b('0x2b')&&typeof _0x50151a[_0x4c7b('0x2c')]===_0x4c7b('0x2b');var _0x126c58=_0x16280f[_0x4c7b('0x2d')];var _0x428a3a=_0x52deb5?0x0:_0x50151a['offset'];var _0x48e907=_0x52deb5?_0x16280f[_0x4c7b('0x2d')]:_0x50151a[_0x4c7b('0x2e')]+_0x50151a[_0x4c7b('0x2c')];var _0x173349;if(_0x48e907>=_0x126c58){_0x48e907=_0x126c58;_0x173349=0xc8;}else{_0x173349=0xce;}_0xb04beb[_0x4c7b('0x28')](_0x173349);return _0xb04beb['set'](_0x4c7b('0x2f'),_0x428a3a+'-'+_0x48e907+'/'+_0x126c58)['json'](_0x16280f);}return null;};}function patchUpdates(_0x503479){return function(_0x2e7a45){try{jsonpatch[_0x4c7b('0x30')](_0x2e7a45,_0x503479,!![]);}catch(_0x15b3f2){return BPromise['reject'](_0x15b3f2);}return _0x2e7a45[_0x4c7b('0x31')]();};}function saveUpdates(_0x3dbc4a,_0x11221d){return function(_0x567f1b){if(_0x567f1b){return _0x567f1b[_0x4c7b('0x32')](_0x3dbc4a)[_0x4c7b('0x1c')](function(_0x313675){return _0x313675;});}return null;};}function removeEntity(_0x2ac1aa,_0x19edb9){return function(_0x4d846f){if(_0x4d846f){return _0x4d846f[_0x4c7b('0x33')]()[_0x4c7b('0x1c')](function(){var _0x363095=_0x4d846f['get']({'plain':!![]});var _0x2545e6=_0x4c7b('0x34');return db[_0x4c7b('0x35')][_0x4c7b('0x33')]({'where':{'type':_0x2545e6,'resourceId':_0x363095['id']}})[_0x4c7b('0x1c')](function(){return _0x4d846f;});})[_0x4c7b('0x1c')](function(){_0x2ac1aa[_0x4c7b('0x28')](0xcc)[_0x4c7b('0x29')]();});}};}function handleEntityNotFound(_0x2ece12,_0x3e3f5f){return function(_0x5a98fd){if(!_0x5a98fd){_0x2ece12[_0x4c7b('0x27')](0x194);}return _0x5a98fd;};}function handleError(_0x2ccb1d,_0x2acfc7){_0x2acfc7=_0x2acfc7||0x1f4;return function(_0x598da7){logger[_0x4c7b('0x22')](_0x598da7[_0x4c7b('0x36')]);if(_0x598da7[_0x4c7b('0x37')]){delete _0x598da7[_0x4c7b('0x37')];}_0x2ccb1d[_0x4c7b('0x28')](_0x2acfc7)['send'](_0x598da7);};}exports['index']=function(_0x46afd7,_0x5ed0b4){var _0x5f43db={},_0x1953b5={},_0x361869={'count':0x0,'rows':[]};var _0x4db2a0=_['map'](db['VoiceContext'][_0x4c7b('0x38')],function(_0x292138){return{'name':_0x292138[_0x4c7b('0x39')],'type':_0x292138[_0x4c7b('0x3a')]['key']};});_0x1953b5[_0x4c7b('0x3b')]=_[_0x4c7b('0x3c')](_0x4db2a0,_0x4c7b('0x37'));_0x1953b5['query']=_[_0x4c7b('0x3d')](_0x46afd7['query']);_0x1953b5['filters']=_[_0x4c7b('0x3e')](_0x1953b5[_0x4c7b('0x3b')],_0x1953b5[_0x4c7b('0x3f')]);_0x5f43db['attributes']=_['intersection'](_0x1953b5[_0x4c7b('0x3b')],qs['fields'](_0x46afd7[_0x4c7b('0x3f')][_0x4c7b('0x40')]));_0x5f43db[_0x4c7b('0x41')]=_0x5f43db[_0x4c7b('0x41')][_0x4c7b('0x42')]?_0x5f43db[_0x4c7b('0x41')]:_0x1953b5[_0x4c7b('0x3b')];if(!_0x46afd7[_0x4c7b('0x3f')]['hasOwnProperty']('nolimit')){_0x5f43db[_0x4c7b('0x2c')]=qs[_0x4c7b('0x2c')](_0x46afd7[_0x4c7b('0x3f')][_0x4c7b('0x2c')]);_0x5f43db[_0x4c7b('0x2e')]=qs[_0x4c7b('0x2e')](_0x46afd7[_0x4c7b('0x3f')][_0x4c7b('0x2e')]);}_0x5f43db[_0x4c7b('0x43')]=qs[_0x4c7b('0x44')](_0x46afd7[_0x4c7b('0x3f')][_0x4c7b('0x44')]);_0x5f43db[_0x4c7b('0x45')]=qs[_0x4c7b('0x46')](_[_0x4c7b('0x47')](_0x46afd7['query'],_0x1953b5[_0x4c7b('0x46')]),_0x4db2a0);if(_0x46afd7[_0x4c7b('0x3f')][_0x4c7b('0x48')]){_0x5f43db[_0x4c7b('0x45')]=_[_0x4c7b('0x49')](_0x5f43db[_0x4c7b('0x45')],{'$or':_[_0x4c7b('0x3c')](_0x4db2a0,function(_0x55004c){if(_0x55004c[_0x4c7b('0x3a')]!==_0x4c7b('0x4a')){var _0x334802={};_0x334802[_0x55004c[_0x4c7b('0x37')]]={'$like':'%'+_0x46afd7[_0x4c7b('0x3f')][_0x4c7b('0x48')]+'%'};return _0x334802;}})});}_0x5f43db=_[_0x4c7b('0x49')]({},_0x5f43db,_0x46afd7[_0x4c7b('0x4b')]);var _0x2b541f={'where':_0x5f43db[_0x4c7b('0x45')]};return db['VoiceContext'][_0x4c7b('0x2d')](_0x2b541f)[_0x4c7b('0x1c')](function(_0x5d0fff){_0x361869['count']=_0x5d0fff;if(_0x46afd7['query']['includeAll']){_0x5f43db[_0x4c7b('0x4c')]=[{'all':!![]}];}return db[_0x4c7b('0x4d')][_0x4c7b('0x4e')](_0x5f43db);})[_0x4c7b('0x1c')](function(_0x377182){_0x361869['rows']=_0x377182;return _0x361869;})['then'](respondWithFilteredResult(_0x5ed0b4,_0x5f43db))[_0x4c7b('0x26')](handleError(_0x5ed0b4,null));};exports['show']=function(_0x41e9e7,_0x1587b0){var _0x5df87f={'raw':![],'where':{'id':_0x41e9e7['params']['id']}},_0x587db8={};_0x587db8[_0x4c7b('0x3b')]=_[_0x4c7b('0x3d')](db[_0x4c7b('0x4d')][_0x4c7b('0x38')]);_0x587db8[_0x4c7b('0x3f')]=_[_0x4c7b('0x3d')](_0x41e9e7[_0x4c7b('0x3f')]);_0x587db8[_0x4c7b('0x46')]=_['intersection'](_0x587db8[_0x4c7b('0x3b')],_0x587db8[_0x4c7b('0x3f')]);_0x5df87f['attributes']=_['intersection'](_0x587db8[_0x4c7b('0x3b')],qs[_0x4c7b('0x40')](_0x41e9e7[_0x4c7b('0x3f')][_0x4c7b('0x40')]));_0x5df87f[_0x4c7b('0x41')]=_0x5df87f[_0x4c7b('0x41')][_0x4c7b('0x42')]?_0x5df87f[_0x4c7b('0x41')]:_0x587db8[_0x4c7b('0x3b')];if(_0x41e9e7['query'][_0x4c7b('0x4f')]){_0x5df87f[_0x4c7b('0x4c')]=[{'all':!![]}];}_0x5df87f=_['merge']({},_0x5df87f,_0x41e9e7[_0x4c7b('0x4b')]);return db[_0x4c7b('0x4d')]['find'](_0x5df87f)['then'](handleEntityNotFound(_0x1587b0,null))[_0x4c7b('0x1c')](respondWithResult(_0x1587b0,null))[_0x4c7b('0x26')](handleError(_0x1587b0,null));};exports[_0x4c7b('0x50')]=function(_0x8992c3,_0x2bdbef,_0x3de84d){var _0x316bbb;return db[_0x4c7b('0x4d')][_0x4c7b('0x50')](_0x8992c3[_0x4c7b('0x51')],{'raw':!![]})[_0x4c7b('0x1c')](function(_0x51a7b4){_0x316bbb=_0x51a7b4;return db[_0x4c7b('0x4d')]['findAll']({'raw':!![]});})[_0x4c7b('0x1c')](function(_0x5ddf3c){var _0x513907=fs['readFileSync'](path[_0x4c7b('0x52')](config[_0x4c7b('0x53')],_0x4c7b('0x54')),_0x4c7b('0x55'));var _0x23f53b=ejs[_0x4c7b('0x56')](_0x513907,{'contexts':_0x5ddf3c||[]});fs[_0x4c7b('0x57')](_0x4c7b('0x58'),_0x23f53b);})[_0x4c7b('0x1c')](function(){return respondWithRpcPromise(_0x4c7b('0x59'),'create',{'module':'chan_sip.so'});})[_0x4c7b('0x1c')](function(){var _0x3e88fe=_0x8992c3['user'][_0x4c7b('0x5a')]({'plain':!![]});if(!_0x3e88fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e88fe[_0x4c7b('0x5b')]==='user'){var _0x5e2235=_0x316bbb[_0x4c7b('0x5a')]({'plain':!![]});return db[_0x4c7b('0x5c')]['find']({'where':{'name':'Contexts','userProfileId':_0x3e88fe[_0x4c7b('0x5d')]},'raw':!![]})[_0x4c7b('0x1c')](function(_0xe47de3){if(_0xe47de3&&_0xe47de3[_0x4c7b('0x5e')]===0x0){return db['UserProfileResource'][_0x4c7b('0x50')]({'name':_0x5e2235[_0x4c7b('0x37')],'resourceId':_0x5e2235['id'],'type':_0xe47de3['name'],'sectionId':_0xe47de3['id']},{})[_0x4c7b('0x1c')](function(){return _0x316bbb;});}else{return _0x316bbb;}})[_0x4c7b('0x26')](function(_0x58e90d){logger[_0x4c7b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58e90d);throw _0x58e90d;});}return _0x316bbb;})['then'](respondWithResult(_0x2bdbef,0xc9))[_0x4c7b('0x26')](handleError(_0x2bdbef,null));};exports[_0x4c7b('0x32')]=function(_0x16b9fb,_0x4ff493,_0x379313){var _0x440105;return db[_0x4c7b('0x4d')][_0x4c7b('0x5f')]({'where':{'id':_0x16b9fb['params']['id']}})['then'](handleEntityNotFound(_0x4ff493,null))[_0x4c7b('0x1c')](saveUpdates(_0x16b9fb[_0x4c7b('0x51')],null))[_0x4c7b('0x1c')](function(_0x38eb70){if(_0x38eb70){_0x440105=_0x38eb70;return db[_0x4c7b('0x4d')]['findAll']({'raw':!![]});}})['then'](function(_0x58d761){var _0x11a0ff=fs[_0x4c7b('0x60')](path[_0x4c7b('0x52')](config[_0x4c7b('0x53')],_0x4c7b('0x54')),_0x4c7b('0x55'));var _0x51a3b2=ejs[_0x4c7b('0x56')](_0x11a0ff,{'contexts':_0x58d761||[]});fs[_0x4c7b('0x57')](_0x4c7b('0x58'),_0x51a3b2);})['then'](function(){return respondWithRpcPromise(_0x4c7b('0x59'),_0x4c7b('0x32'),{'module':_0x4c7b('0x61')});})['then'](function(){return _0x440105;})[_0x4c7b('0x1c')](respondWithResult(_0x4ff493,null))[_0x4c7b('0x26')](handleError(_0x4ff493,null));};exports[_0x4c7b('0x33')]=function(_0x2394cd,_0xdca7c3,_0x4e350c){var _0x219358;return db[_0x4c7b('0x4d')][_0x4c7b('0x5f')]({'where':{'id':_0x2394cd[_0x4c7b('0x62')]['id']}})[_0x4c7b('0x1c')](handleEntityNotFound(_0xdca7c3,null))['then'](removeEntity(_0xdca7c3,null))[_0x4c7b('0x1c')](function(){return db['VoiceContext'][_0x4c7b('0x4e')]({'raw':!![]});})[_0x4c7b('0x1c')](function(_0x58a623){var _0x123749=fs['readFileSync'](path['join'](config['root'],'server/files/templates/context.ejs'),_0x4c7b('0x55'));var _0x6d7d4f=ejs['render'](_0x123749,{'contexts':_0x58a623});fs['writeFileSync'](_0x4c7b('0x58'),_0x6d7d4f);return respondWithRpcPromise(_0x4c7b('0x59'),_0x4c7b('0x33'),{'module':_0x4c7b('0x61')});})['catch'](handleError(_0xdca7c3,null));}; \ No newline at end of file +var _0xd529=['find','userProfileId','autoAssociation','UserProfileResource','readFileSync','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','http','request','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Contexts','destroy','stack','name','map','VoiceContext','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','create','body','join','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5f3309,_0x37871b){var _0xea65ec=function(_0x4fbe43){while(--_0x4fbe43){_0x5f3309['push'](_0x5f3309['shift']());}};_0xea65ec(++_0x37871b);}(_0xd529,0x1a4));var _0x9d52=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd529[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x9d52('0x0'));var rimraf=require(_0x9d52('0x1'));var zipdir=require(_0x9d52('0x2'));var jsonpatch=require(_0x9d52('0x3'));var rp=require(_0x9d52('0x4'));var moment=require(_0x9d52('0x5'));var BPromise=require(_0x9d52('0x6'));var Mustache=require(_0x9d52('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9d52('0x8'));var csv=require(_0x9d52('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d52('0xa'));var _=require(_0x9d52('0xb'));var squel=require(_0x9d52('0xc'));var crypto=require(_0x9d52('0xd'));var jsforce=require(_0x9d52('0xe'));var deskjs=require(_0x9d52('0xf'));var toCsv=require(_0x9d52('0x9'));var querystring=require(_0x9d52('0x10'));var Papa=require(_0x9d52('0x11'));var Redis=require('ioredis');var authService=require(_0x9d52('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9d52('0x13'));var hardwareService=require(_0x9d52('0x14'));var logger=require(_0x9d52('0x15'))(_0x9d52('0x16'));var utils=require('../../config/utils');var config=require(_0x9d52('0x17'));var licenseUtil=require(_0x9d52('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x9d52('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x593d0b,_0x3f43cd,_0x24ebbc,_0xb55adb){return new BPromise(function(_0x12790c,_0x51a4a9){var _0x15f5a2=_0xb55adb||client;return _0x15f5a2[_0x9d52('0x1a')](_0x593d0b,_0x24ebbc)[_0x9d52('0x1b')](function(_0x471843){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3f43cd,_0x9d52('0x1c'));logger[_0x9d52('0x1d')](_0x9d52('0x1e'),_0x3f43cd,_0x9d52('0x1c'),JSON[_0x9d52('0x1f')](_0x471843));if(_0x471843[_0x9d52('0x20')]){if(_0x471843['error'][_0x9d52('0x21')]===0x1f4){logger[_0x9d52('0x20')](_0x9d52('0x22'),_0x3f43cd,_0x471843[_0x9d52('0x20')][_0x9d52('0x23')]);return _0x51a4a9(_0x471843[_0x9d52('0x20')]['message']);}logger[_0x9d52('0x20')](_0x9d52('0x22'),_0x3f43cd,_0x471843[_0x9d52('0x20')][_0x9d52('0x23')]);return _0x12790c(_0x471843[_0x9d52('0x20')][_0x9d52('0x23')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x3f43cd,_0x9d52('0x1c'));_0x12790c(_0x471843[_0x9d52('0x24')]['message']);}})[_0x9d52('0x25')](function(_0x547197){logger[_0x9d52('0x20')](_0x9d52('0x22'),_0x3f43cd,_0x547197);_0x51a4a9(_0x547197);});});}function respondWithStatusCode(_0x208315,_0x1e0e25){_0x1e0e25=_0x1e0e25||0xcc;return function(_0x22c412){if(_0x22c412){return _0x208315[_0x9d52('0x26')](_0x1e0e25);}return _0x208315[_0x9d52('0x27')](_0x1e0e25)[_0x9d52('0x28')]();};}function respondWithResult(_0x42a790,_0x4bbcc7){_0x4bbcc7=_0x4bbcc7||0xc8;return function(_0x3f88e1){if(_0x3f88e1){return _0x42a790[_0x9d52('0x27')](_0x4bbcc7)[_0x9d52('0x29')](_0x3f88e1);}};}function respondWithFilteredResult(_0x2cd1f5,_0x2a1b34){return function(_0x5cab53){if(_0x5cab53){var _0x216a61=typeof _0x2a1b34[_0x9d52('0x2a')]===_0x9d52('0x2b')&&typeof _0x2a1b34[_0x9d52('0x2c')]===_0x9d52('0x2b');var _0x25ceb2=_0x5cab53[_0x9d52('0x2d')];var _0x4dfea2=_0x216a61?0x0:_0x2a1b34['offset'];var _0x193a93=_0x216a61?_0x5cab53[_0x9d52('0x2d')]:_0x2a1b34['offset']+_0x2a1b34['limit'];var _0x4bf16a;if(_0x193a93>=_0x25ceb2){_0x193a93=_0x25ceb2;_0x4bf16a=0xc8;}else{_0x4bf16a=0xce;}_0x2cd1f5[_0x9d52('0x27')](_0x4bf16a);return _0x2cd1f5[_0x9d52('0x2e')](_0x9d52('0x2f'),_0x4dfea2+'-'+_0x193a93+'/'+_0x25ceb2)['json'](_0x5cab53);}return null;};}function patchUpdates(_0xc02285){return function(_0x1cc45f){try{jsonpatch['apply'](_0x1cc45f,_0xc02285,!![]);}catch(_0x33df07){return BPromise[_0x9d52('0x30')](_0x33df07);}return _0x1cc45f[_0x9d52('0x31')]();};}function saveUpdates(_0x2918a5,_0xec4bc6){return function(_0x4610b1){if(_0x4610b1){return _0x4610b1[_0x9d52('0x32')](_0x2918a5)[_0x9d52('0x1b')](function(_0x465c63){return _0x465c63;});}return null;};}function removeEntity(_0x29ffdd,_0x168020){return function(_0x21294d){if(_0x21294d){return _0x21294d['destroy']()[_0x9d52('0x1b')](function(){var _0x360a6f=_0x21294d[_0x9d52('0x33')]({'plain':!![]});var _0x1f8ef7=_0x9d52('0x34');return db['UserProfileResource'][_0x9d52('0x35')]({'where':{'type':_0x1f8ef7,'resourceId':_0x360a6f['id']}})[_0x9d52('0x1b')](function(){return _0x21294d;});})[_0x9d52('0x1b')](function(){_0x29ffdd[_0x9d52('0x27')](0xcc)[_0x9d52('0x28')]();});}};}function handleEntityNotFound(_0xa0f0a3,_0x33d95a){return function(_0x42d1ec){if(!_0x42d1ec){_0xa0f0a3[_0x9d52('0x26')](0x194);}return _0x42d1ec;};}function handleError(_0x1a85d0,_0x14ed23){_0x14ed23=_0x14ed23||0x1f4;return function(_0xadaf1){logger['error'](_0xadaf1[_0x9d52('0x36')]);if(_0xadaf1[_0x9d52('0x37')]){delete _0xadaf1[_0x9d52('0x37')];}_0x1a85d0[_0x9d52('0x27')](_0x14ed23)['send'](_0xadaf1);};}exports['index']=function(_0x34e186,_0xbdc158){var _0x4fbf81={},_0x50db11={},_0x33f7a0={'count':0x0,'rows':[]};var _0x554b34=_[_0x9d52('0x38')](db[_0x9d52('0x39')]['rawAttributes'],function(_0x5687f3){return{'name':_0x5687f3['fieldName'],'type':_0x5687f3[_0x9d52('0x3a')][_0x9d52('0x3b')]};});_0x50db11[_0x9d52('0x3c')]=_[_0x9d52('0x38')](_0x554b34,_0x9d52('0x37'));_0x50db11[_0x9d52('0x3d')]=_['keys'](_0x34e186[_0x9d52('0x3d')]);_0x50db11[_0x9d52('0x3e')]=_[_0x9d52('0x3f')](_0x50db11[_0x9d52('0x3c')],_0x50db11[_0x9d52('0x3d')]);_0x4fbf81[_0x9d52('0x40')]=_[_0x9d52('0x3f')](_0x50db11[_0x9d52('0x3c')],qs[_0x9d52('0x41')](_0x34e186[_0x9d52('0x3d')][_0x9d52('0x41')]));_0x4fbf81[_0x9d52('0x40')]=_0x4fbf81[_0x9d52('0x40')][_0x9d52('0x42')]?_0x4fbf81[_0x9d52('0x40')]:_0x50db11['model'];if(!_0x34e186['query'][_0x9d52('0x43')](_0x9d52('0x44'))){_0x4fbf81['limit']=qs['limit'](_0x34e186[_0x9d52('0x3d')][_0x9d52('0x2c')]);_0x4fbf81[_0x9d52('0x2a')]=qs['offset'](_0x34e186[_0x9d52('0x3d')][_0x9d52('0x2a')]);}_0x4fbf81[_0x9d52('0x45')]=qs[_0x9d52('0x46')](_0x34e186[_0x9d52('0x3d')]['sort']);_0x4fbf81[_0x9d52('0x47')]=qs[_0x9d52('0x3e')](_['pick'](_0x34e186[_0x9d52('0x3d')],_0x50db11[_0x9d52('0x3e')]),_0x554b34);if(_0x34e186[_0x9d52('0x3d')][_0x9d52('0x48')]){_0x4fbf81[_0x9d52('0x47')]=_[_0x9d52('0x49')](_0x4fbf81[_0x9d52('0x47')],{'$or':_[_0x9d52('0x38')](_0x554b34,function(_0x16b601){if(_0x16b601['type']!==_0x9d52('0x4a')){var _0x85f570={};_0x85f570[_0x16b601[_0x9d52('0x37')]]={'$like':'%'+_0x34e186['query'][_0x9d52('0x48')]+'%'};return _0x85f570;}})});}_0x4fbf81=_[_0x9d52('0x49')]({},_0x4fbf81,_0x34e186['options']);var _0x370402={'where':_0x4fbf81[_0x9d52('0x47')]};return db['VoiceContext']['count'](_0x370402)[_0x9d52('0x1b')](function(_0x11fa27){_0x33f7a0[_0x9d52('0x2d')]=_0x11fa27;if(_0x34e186[_0x9d52('0x3d')][_0x9d52('0x4b')]){_0x4fbf81[_0x9d52('0x4c')]=[{'all':!![]}];}return db['VoiceContext'][_0x9d52('0x4d')](_0x4fbf81);})[_0x9d52('0x1b')](function(_0x1c346f){_0x33f7a0[_0x9d52('0x4e')]=_0x1c346f;return _0x33f7a0;})[_0x9d52('0x1b')](respondWithFilteredResult(_0xbdc158,_0x4fbf81))[_0x9d52('0x25')](handleError(_0xbdc158,null));};exports['show']=function(_0x2cbac0,_0x2a7708){var _0x1d0ba5={'raw':![],'where':{'id':_0x2cbac0[_0x9d52('0x4f')]['id']}},_0x247cbd={};_0x247cbd[_0x9d52('0x3c')]=_[_0x9d52('0x50')](db[_0x9d52('0x39')][_0x9d52('0x51')]);_0x247cbd[_0x9d52('0x3d')]=_[_0x9d52('0x50')](_0x2cbac0[_0x9d52('0x3d')]);_0x247cbd[_0x9d52('0x3e')]=_['intersection'](_0x247cbd[_0x9d52('0x3c')],_0x247cbd[_0x9d52('0x3d')]);_0x1d0ba5[_0x9d52('0x40')]=_['intersection'](_0x247cbd[_0x9d52('0x3c')],qs[_0x9d52('0x41')](_0x2cbac0[_0x9d52('0x3d')][_0x9d52('0x41')]));_0x1d0ba5[_0x9d52('0x40')]=_0x1d0ba5['attributes'][_0x9d52('0x42')]?_0x1d0ba5[_0x9d52('0x40')]:_0x247cbd[_0x9d52('0x3c')];if(_0x2cbac0['query'][_0x9d52('0x4b')]){_0x1d0ba5[_0x9d52('0x4c')]=[{'all':!![]}];}_0x1d0ba5=_[_0x9d52('0x49')]({},_0x1d0ba5,_0x2cbac0[_0x9d52('0x52')]);return db[_0x9d52('0x39')]['find'](_0x1d0ba5)['then'](handleEntityNotFound(_0x2a7708,null))['then'](respondWithResult(_0x2a7708,null))[_0x9d52('0x25')](handleError(_0x2a7708,null));};exports[_0x9d52('0x53')]=function(_0x153a2f,_0x3760df,_0x17710e){var _0x1654b8;return db['VoiceContext'][_0x9d52('0x53')](_0x153a2f[_0x9d52('0x54')],{'raw':!![]})['then'](function(_0x2825bf){_0x1654b8=_0x2825bf;return db['VoiceContext'][_0x9d52('0x4d')]({'raw':!![]});})[_0x9d52('0x1b')](function(_0x29d28f){var _0x279aa9=fs['readFileSync'](path[_0x9d52('0x55')](config[_0x9d52('0x56')],_0x9d52('0x57')),_0x9d52('0x58'));var _0x447fba=ejs['render'](_0x279aa9,{'contexts':_0x29d28f||[]});fs[_0x9d52('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x447fba);})[_0x9d52('0x1b')](function(){return respondWithRpcPromise(_0x9d52('0x5a'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x3134b2=_0x153a2f[_0x9d52('0x5b')]['get']({'plain':!![]});if(!_0x3134b2)throw new Error(_0x9d52('0x5c'));if(_0x3134b2[_0x9d52('0x5d')]==='user'){var _0x5a55ee=_0x1654b8['get']({'plain':!![]});return db[_0x9d52('0x5e')][_0x9d52('0x5f')]({'where':{'name':_0x9d52('0x34'),'userProfileId':_0x3134b2[_0x9d52('0x60')]},'raw':!![]})[_0x9d52('0x1b')](function(_0x535a23){if(_0x535a23&&_0x535a23[_0x9d52('0x61')]===0x0){return db[_0x9d52('0x62')][_0x9d52('0x53')]({'name':_0x5a55ee['name'],'resourceId':_0x5a55ee['id'],'type':_0x535a23[_0x9d52('0x37')],'sectionId':_0x535a23['id']},{})[_0x9d52('0x1b')](function(){return _0x1654b8;});}else{return _0x1654b8;}})[_0x9d52('0x25')](function(_0x5d4fc3){logger[_0x9d52('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d4fc3);throw _0x5d4fc3;});}return _0x1654b8;})[_0x9d52('0x1b')](respondWithResult(_0x3760df,0xc9))[_0x9d52('0x25')](handleError(_0x3760df,null));};exports[_0x9d52('0x32')]=function(_0x5475d8,_0x184aff,_0x46684c){var _0x4da7e2;return db[_0x9d52('0x39')]['find']({'where':{'id':_0x5475d8[_0x9d52('0x4f')]['id']}})['then'](handleEntityNotFound(_0x184aff,null))[_0x9d52('0x1b')](saveUpdates(_0x5475d8[_0x9d52('0x54')],null))[_0x9d52('0x1b')](function(_0x196dd0){if(_0x196dd0){_0x4da7e2=_0x196dd0;return db['VoiceContext'][_0x9d52('0x4d')]({'raw':!![]});}})['then'](function(_0x41f0a2){var _0xe35cbc=fs[_0x9d52('0x63')](path[_0x9d52('0x55')](config[_0x9d52('0x56')],_0x9d52('0x57')),_0x9d52('0x58'));var _0x1f1dce=ejs[_0x9d52('0x64')](_0xe35cbc,{'contexts':_0x41f0a2||[]});fs[_0x9d52('0x59')](_0x9d52('0x65'),_0x1f1dce);})[_0x9d52('0x1b')](function(){return respondWithRpcPromise(_0x9d52('0x5a'),_0x9d52('0x32'),{'module':_0x9d52('0x66')});})[_0x9d52('0x1b')](function(){return _0x4da7e2;})[_0x9d52('0x1b')](respondWithResult(_0x184aff,null))['catch'](handleError(_0x184aff,null));};exports[_0x9d52('0x35')]=function(_0x38cfd6,_0x114e37,_0x1bb699){var _0x7941ed;return db['VoiceContext'][_0x9d52('0x5f')]({'where':{'id':_0x38cfd6['params']['id']}})[_0x9d52('0x1b')](handleEntityNotFound(_0x114e37,null))[_0x9d52('0x1b')](removeEntity(_0x114e37,null))[_0x9d52('0x1b')](function(){return db[_0x9d52('0x39')][_0x9d52('0x4d')]({'raw':!![]});})[_0x9d52('0x1b')](function(_0x18779d){var _0x52026d=fs['readFileSync'](path[_0x9d52('0x55')](config[_0x9d52('0x56')],'server/files/templates/context.ejs'),_0x9d52('0x58'));var _0x4df72f=ejs['render'](_0x52026d,{'contexts':_0x18779d});fs[_0x9d52('0x59')](_0x9d52('0x65'),_0x4df72f);return respondWithRpcPromise(_0x9d52('0x5a'),_0x9d52('0x35'),{'module':_0x9d52('0x66')});})[_0x9d52('0x25')](handleError(_0x114e37,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f561ad0..893c909 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 _0xb6c6=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext'];(function(_0x159746,_0x1d4654){var _0x1c38ec=function(_0x1cc0e6){while(--_0x1cc0e6){_0x159746['push'](_0x159746['shift']());}};_0x1c38ec(++_0x1d4654);}(_0xb6c6,0xeb));var _0x6b6c=function(_0x49d0ee,_0x5cc2cb){_0x49d0ee=_0x49d0ee-0x0;var _0x5825db=_0xb6c6[_0x49d0ee];return _0x5825db;};'use strict';var _=require(_0x6b6c('0x0'));var util=require(_0x6b6c('0x1'));var logger=require(_0x6b6c('0x2'))(_0x6b6c('0x3'));var moment=require(_0x6b6c('0x4'));var BPromise=require(_0x6b6c('0x5'));var rp=require(_0x6b6c('0x6'));var fs=require('fs');var path=require(_0x6b6c('0x7'));var rimraf=require(_0x6b6c('0x8'));var config=require('../../config/environment');var attributes=require(_0x6b6c('0x9'));module['exports']=function(_0x93908d,_0x372cc1){return _0x93908d[_0x6b6c('0xa')](_0x6b6c('0xb'),attributes,{'tableName':_0x6b6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a71=['exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','request-promise','./voiceContext.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a71,0x122));var _0x10a7=function(_0x4346b3,_0x5a4546){_0x4346b3=_0x4346b3-0x0;var _0x21e6a5=_0x0a71[_0x4346b3];return _0x21e6a5;};'use strict';var _=require(_0x10a7('0x0'));var util=require(_0x10a7('0x1'));var logger=require(_0x10a7('0x2'))(_0x10a7('0x3'));var moment=require(_0x10a7('0x4'));var BPromise=require('bluebird');var rp=require(_0x10a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10a7('0x6'));module[_0x10a7('0x7')]=function(_0x54bc5e,_0x34dd27){return _0x54bc5e[_0x10a7('0x8')](_0x10a7('0x9'),attributes,{'tableName':_0x10a7('0xa'),'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 35adeec..9df1899 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 _0xefda=['then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x47051e,_0x1bdcfb){var _0x7996e3=function(_0x16e2c9){while(--_0x16e2c9){_0x47051e['push'](_0x47051e['shift']());}};_0x7996e3(++_0x1bdcfb);}(_0xefda,0x96));var _0xaefd=function(_0x566256,_0x6476c2){_0x566256=_0x566256-0x0;var _0x205c91=_0xefda[_0x566256];return _0x205c91;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('VoiceContext,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});} \ No newline at end of file +var _0x7896=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5c0862,_0x17dadc){var _0x2a0a23=function(_0x3d9c6a){while(--_0x3d9c6a){_0x5c0862['push'](_0x5c0862['shift']());}};_0x2a0a23(++_0x17dadc);}(_0x7896,0x127));var _0x6789=function(_0x193ab8,_0x38bd82){_0x193ab8=_0x193ab8-0x0;var _0xdfe5a3=_0x7896[_0x193ab8];return _0xdfe5a3;};'use strict';var _=require(_0x6789('0x0'));var util=require(_0x6789('0x1'));var moment=require(_0x6789('0x2'));var BPromise=require(_0x6789('0x3'));var rs=require(_0x6789('0x4'));var fs=require('fs');var Redis=require(_0x6789('0x5'));var db=require(_0x6789('0x6'))['db'];var utils=require(_0x6789('0x7'));var logger=require(_0x6789('0x8'))(_0x6789('0x9'));var config=require(_0x6789('0xa'));var jayson=require(_0x6789('0xb'));var client=jayson['client'][_0x6789('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38f91b,_0x1cba15,_0x4e3d8c){return new BPromise(function(_0x19723d,_0x59ef90){return client[_0x6789('0xd')](_0x38f91b,_0x4e3d8c)[_0x6789('0xe')](function(_0x4d648e){logger[_0x6789('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1cba15,_0x6789('0x10'));logger['debug'](_0x6789('0x11'),_0x1cba15,'request\x20sent',JSON[_0x6789('0x12')](_0x4d648e));if(_0x4d648e[_0x6789('0x13')]){if(_0x4d648e[_0x6789('0x13')][_0x6789('0x14')]===0x1f4){logger[_0x6789('0x13')](_0x6789('0x15'),_0x1cba15,_0x4d648e[_0x6789('0x13')][_0x6789('0x16')]);return _0x59ef90(_0x4d648e[_0x6789('0x13')][_0x6789('0x16')]);}logger['error'](_0x6789('0x15'),_0x1cba15,_0x4d648e[_0x6789('0x13')][_0x6789('0x16')]);return _0x19723d(_0x4d648e[_0x6789('0x13')][_0x6789('0x16')]);}else{logger[_0x6789('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1cba15,'request\x20sent');_0x19723d(_0x4d648e[_0x6789('0x17')][_0x6789('0x16')]);}})[_0x6789('0x18')](function(_0x2e49bd){logger[_0x6789('0x13')](_0x6789('0x15'),_0x1cba15,_0x2e49bd);_0x59ef90(_0x2e49bd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4860a9f..0c6f45c 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 _0x923d=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','index','/describe','/:id','isAuthenticated','show','create','put','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x17cda0,_0x5622bc){var _0x456a24=function(_0x1b8f9b){while(--_0x1b8f9b){_0x17cda0['push'](_0x17cda0['shift']());}};_0x456a24(++_0x5622bc);}(_0x923d,0xdf));var _0xd923=function(_0x5bb574,_0x4a4cd8){_0x5bb574=_0x5bb574-0x0;var _0x475ede=_0x923d[_0x5bb574];return _0x475ede;};'use strict';var multer=require('multer');var util=require(_0xd923('0x0'));var path=require(_0xd923('0x1'));var timeout=require(_0xd923('0x2'));var express=require(_0xd923('0x3'));var router=express[_0xd923('0x4')]();var fs_extra=require(_0xd923('0x5'));var auth=require(_0xd923('0x6'));var interaction=require(_0xd923('0x7'));var config=require('../../config/environment');var controller=require(_0xd923('0x8'));router[_0xd923('0x9')]('/',auth['isAuthenticated'](),controller[_0xd923('0xa')]);router[_0xd923('0x9')](_0xd923('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd923('0x9')](_0xd923('0xc'),auth[_0xd923('0xd')](),controller[_0xd923('0xe')]);router['post']('/',auth[_0xd923('0xd')](),controller[_0xd923('0xf')]);router[_0xd923('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd923('0x11')](_0xd923('0xc'),auth[_0xd923('0xd')](),controller['destroy']);module[_0xd923('0x12')]=router; \ No newline at end of file +var _0xd2c2=['/:id','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0xd2c2,0x18c));var _0x2d2c=function(_0x51212d,_0x4af58c){_0x51212d=_0x51212d-0x0;var _0x28a6b5=_0xd2c2[_0x51212d];return _0x28a6b5;};'use strict';var multer=require(_0x2d2c('0x0'));var util=require('util');var path=require(_0x2d2c('0x1'));var timeout=require(_0x2d2c('0x2'));var express=require(_0x2d2c('0x3'));var router=express[_0x2d2c('0x4')]();var fs_extra=require(_0x2d2c('0x5'));var auth=require(_0x2d2c('0x6'));var interaction=require(_0x2d2c('0x7'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x2d2c('0x8')]('/',auth[_0x2d2c('0x9')](),controller['index']);router[_0x2d2c('0x8')](_0x2d2c('0xa'),auth[_0x2d2c('0x9')](),controller[_0x2d2c('0xb')]);router[_0x2d2c('0x8')](_0x2d2c('0xc'),auth[_0x2d2c('0x9')](),controller['show']);router[_0x2d2c('0xd')]('/',auth[_0x2d2c('0x9')](),controller[_0x2d2c('0xe')]);router['put'](_0x2d2c('0xc'),auth[_0x2d2c('0x9')](),controller['update']);router[_0x2d2c('0xf')](_0x2d2c('0xc'),auth[_0x2d2c('0x9')](),controller[_0x2d2c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 2d4528a..7116aa0 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 _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x58b023,_0x23a65f){var _0x585d82=function(_0x393703){while(--_0x393703){_0x58b023['push'](_0x58b023['shift']());}};_0x585d82(++_0x23a65f);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x51e26a,_0x120ba1){_0x51e26a=_0x51e26a-0x0;var _0x4edfe4=_0x6f0d[_0x51e26a];return _0x4edfe4;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0xd749b,_0x12b062){var _0x45abd7=function(_0x2308e7){while(--_0x2308e7){_0xd749b['push'](_0xd749b['shift']());}};_0x45abd7(++_0x12b062);}(_0x425d,0x1e0));var _0xd425=function(_0x1bcc92,_0x4929b8){_0x1bcc92=_0x1bcc92-0x0;var _0x88406a=_0x425d[_0x1bcc92];return _0x88406a;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('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 846a3c0..0982123 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 _0x67ef=['count','Content-Range','apply','update','destroy','then','name','send','index','map','VoiceDialReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67ef,0x1cd));var _0xf67e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x67ef[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0xf67e('0x0'));var rimraf=require(_0xf67e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf67e('0x2'));var rp=require(_0xf67e('0x3'));var moment=require(_0xf67e('0x4'));var BPromise=require(_0xf67e('0x5'));var Mustache=require(_0xf67e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf67e('0x7'));var csv=require(_0xf67e('0x8'));var ejs=require(_0xf67e('0x9'));var fs=require('fs');var fs_extra=require(_0xf67e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf67e('0xb'));var deskjs=require(_0xf67e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf67e('0xd'));var Papa=require(_0xf67e('0xe'));var Redis=require(_0xf67e('0xf'));var authService=require(_0xf67e('0x10'));var qs=require(_0xf67e('0x11'));var as=require(_0xf67e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf67e('0x13'))('api');var utils=require(_0xf67e('0x14'));var config=require(_0xf67e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55c41a,_0x33d655){_0x33d655=_0x33d655||0xcc;return function(_0x328685){if(_0x328685){return _0x55c41a[_0xf67e('0x16')](_0x33d655);}return _0x55c41a[_0xf67e('0x17')](_0x33d655)[_0xf67e('0x18')]();};}function respondWithResult(_0x2fa816,_0x57fb23){_0x57fb23=_0x57fb23||0xc8;return function(_0x47fff4){if(_0x47fff4){return _0x2fa816[_0xf67e('0x17')](_0x57fb23)[_0xf67e('0x19')](_0x47fff4);}};}function respondWithFilteredResult(_0x3fd9fb,_0x71739){return function(_0x2a4617){if(_0x2a4617){var _0x481958=typeof _0x71739[_0xf67e('0x1a')]==='undefined'&&typeof _0x71739[_0xf67e('0x1b')]===_0xf67e('0x1c');var _0xaf74d0=_0x2a4617['count'];var _0x52c903=_0x481958?0x0:_0x71739['offset'];var _0x1b50a1=_0x481958?_0x2a4617[_0xf67e('0x1d')]:_0x71739[_0xf67e('0x1a')]+_0x71739[_0xf67e('0x1b')];var _0x51279f;if(_0x1b50a1>=_0xaf74d0){_0x1b50a1=_0xaf74d0;_0x51279f=0xc8;}else{_0x51279f=0xce;}_0x3fd9fb[_0xf67e('0x17')](_0x51279f);return _0x3fd9fb['set'](_0xf67e('0x1e'),_0x52c903+'-'+_0x1b50a1+'/'+_0xaf74d0)[_0xf67e('0x19')](_0x2a4617);}return null;};}function patchUpdates(_0x325ae0){return function(_0x2f7573){try{jsonpatch[_0xf67e('0x1f')](_0x2f7573,_0x325ae0,!![]);}catch(_0x37a7f9){return BPromise['reject'](_0x37a7f9);}return _0x2f7573['save']();};}function saveUpdates(_0x9f4fde,_0x2ebfb6){return function(_0x5b38a3){if(_0x5b38a3){return _0x5b38a3[_0xf67e('0x20')](_0x9f4fde)['then'](function(_0x21e3b5){return _0x21e3b5;});}return null;};}function removeEntity(_0x2f76b0,_0x2d7cc7){return function(_0x1ac4a5){if(_0x1ac4a5){return _0x1ac4a5[_0xf67e('0x21')]()[_0xf67e('0x22')](function(){_0x2f76b0['status'](0xcc)[_0xf67e('0x18')]();});}};}function handleEntityNotFound(_0x4e1cdf,_0x29c264){return function(_0x178007){if(!_0x178007){_0x4e1cdf[_0xf67e('0x16')](0x194);}return _0x178007;};}function handleError(_0x31a145,_0x32e411){_0x32e411=_0x32e411||0x1f4;return function(_0x182480){logger['error'](_0x182480['stack']);if(_0x182480[_0xf67e('0x23')]){delete _0x182480[_0xf67e('0x23')];}_0x31a145[_0xf67e('0x17')](_0x32e411)[_0xf67e('0x24')](_0x182480);};}exports[_0xf67e('0x25')]=function(_0x3c5edb,_0xd2c382){var _0x27d026={},_0x28ee51={},_0x31b92e={'count':0x0,'rows':[]};var _0x5dcc58=_[_0xf67e('0x26')](db[_0xf67e('0x27')]['rawAttributes'],function(_0x28084b){return{'name':_0x28084b[_0xf67e('0x28')],'type':_0x28084b[_0xf67e('0x29')][_0xf67e('0x2a')]};});_0x28ee51[_0xf67e('0x2b')]=_['map'](_0x5dcc58,_0xf67e('0x23'));_0x28ee51['query']=_[_0xf67e('0x2c')](_0x3c5edb[_0xf67e('0x2d')]);_0x28ee51[_0xf67e('0x2e')]=_['intersection'](_0x28ee51[_0xf67e('0x2b')],_0x28ee51['query']);_0x27d026['attributes']=_[_0xf67e('0x2f')](_0x28ee51[_0xf67e('0x2b')],qs['fields'](_0x3c5edb[_0xf67e('0x2d')]['fields']));_0x27d026[_0xf67e('0x30')]=_0x27d026[_0xf67e('0x30')][_0xf67e('0x31')]?_0x27d026[_0xf67e('0x30')]:_0x28ee51[_0xf67e('0x2b')];if(!_0x3c5edb[_0xf67e('0x2d')][_0xf67e('0x32')](_0xf67e('0x33'))){_0x27d026[_0xf67e('0x1b')]=qs['limit'](_0x3c5edb[_0xf67e('0x2d')][_0xf67e('0x1b')]);_0x27d026[_0xf67e('0x1a')]=qs[_0xf67e('0x1a')](_0x3c5edb[_0xf67e('0x2d')][_0xf67e('0x1a')]);}_0x27d026['order']=qs[_0xf67e('0x34')](_0x3c5edb['query'][_0xf67e('0x34')]);_0x27d026[_0xf67e('0x35')]=qs[_0xf67e('0x2e')](_[_0xf67e('0x36')](_0x3c5edb[_0xf67e('0x2d')],_0x28ee51[_0xf67e('0x2e')]),_0x5dcc58);if(_0x3c5edb['query'][_0xf67e('0x37')]){_0x27d026[_0xf67e('0x35')]=_[_0xf67e('0x38')](_0x27d026[_0xf67e('0x35')],{'$or':_[_0xf67e('0x26')](_0x5dcc58,function(_0x198424){if(_0x198424[_0xf67e('0x29')]!==_0xf67e('0x39')){var _0xf94295={};_0xf94295[_0x198424[_0xf67e('0x23')]]={'$like':'%'+_0x3c5edb['query'][_0xf67e('0x37')]+'%'};return _0xf94295;}})});}_0x27d026=_[_0xf67e('0x38')]({},_0x27d026,_0x3c5edb[_0xf67e('0x3a')]);var _0x35639d={'where':_0x27d026['where']};return db[_0xf67e('0x27')][_0xf67e('0x1d')](_0x35639d)[_0xf67e('0x22')](function(_0x3e10c6){_0x31b92e[_0xf67e('0x1d')]=_0x3e10c6;if(_0x3c5edb['query'][_0xf67e('0x3b')]){_0x27d026[_0xf67e('0x3c')]=[{'all':!![]}];}return db[_0xf67e('0x27')][_0xf67e('0x3d')](_0x27d026);})[_0xf67e('0x22')](function(_0x2bbf24){_0x31b92e[_0xf67e('0x3e')]=_0x2bbf24;return _0x31b92e;})[_0xf67e('0x22')](respondWithFilteredResult(_0xd2c382,_0x27d026))[_0xf67e('0x3f')](handleError(_0xd2c382,null));};exports['show']=function(_0x3113b4,_0xda23e4){var _0x432cf7={'raw':!![],'where':{'id':_0x3113b4[_0xf67e('0x40')]['id']}},_0x425a26={};_0x425a26['model']=_[_0xf67e('0x2c')](db[_0xf67e('0x27')][_0xf67e('0x41')]);_0x425a26[_0xf67e('0x2d')]=_[_0xf67e('0x2c')](_0x3113b4[_0xf67e('0x2d')]);_0x425a26[_0xf67e('0x2e')]=_['intersection'](_0x425a26['model'],_0x425a26[_0xf67e('0x2d')]);_0x432cf7[_0xf67e('0x30')]=_['intersection'](_0x425a26['model'],qs[_0xf67e('0x42')](_0x3113b4[_0xf67e('0x2d')][_0xf67e('0x42')]));_0x432cf7[_0xf67e('0x30')]=_0x432cf7[_0xf67e('0x30')][_0xf67e('0x31')]?_0x432cf7['attributes']:_0x425a26[_0xf67e('0x2b')];if(_0x3113b4['query'][_0xf67e('0x3b')]){_0x432cf7[_0xf67e('0x3c')]=[{'all':!![]}];}_0x432cf7=_[_0xf67e('0x38')]({},_0x432cf7,_0x3113b4[_0xf67e('0x3a')]);return db[_0xf67e('0x27')]['find'](_0x432cf7)['then'](handleEntityNotFound(_0xda23e4,null))[_0xf67e('0x22')](respondWithResult(_0xda23e4,null))[_0xf67e('0x3f')](handleError(_0xda23e4,null));};exports[_0xf67e('0x43')]=function(_0x3c7a68,_0xac3cea){return db[_0xf67e('0x27')][_0xf67e('0x43')](_0x3c7a68[_0xf67e('0x44')],{})[_0xf67e('0x22')](respondWithResult(_0xac3cea,0xc9))[_0xf67e('0x3f')](handleError(_0xac3cea,null));};exports[_0xf67e('0x20')]=function(_0x3f81d8,_0x5a2fb6){if(_0x3f81d8[_0xf67e('0x44')]['id']){delete _0x3f81d8[_0xf67e('0x44')]['id'];}return db[_0xf67e('0x27')]['find']({'where':{'id':_0x3f81d8[_0xf67e('0x40')]['id']}})[_0xf67e('0x22')](handleEntityNotFound(_0x5a2fb6,null))[_0xf67e('0x22')](saveUpdates(_0x3f81d8[_0xf67e('0x44')],null))[_0xf67e('0x22')](respondWithResult(_0x5a2fb6,null))[_0xf67e('0x3f')](handleError(_0x5a2fb6,null));};exports[_0xf67e('0x21')]=function(_0x14dc6b,_0x4c0445){return db['VoiceDialReport']['find']({'where':{'id':_0x14dc6b[_0xf67e('0x40')]['id']}})[_0xf67e('0x22')](handleEntityNotFound(_0x4c0445,null))['then'](removeEntity(_0x4c0445,null))[_0xf67e('0x3f')](handleError(_0x4c0445,null));};exports['describe']=function(_0x3b023f,_0x14170c){return db[_0xf67e('0x27')][_0xf67e('0x45')]()[_0xf67e('0x22')](respondWithResult(_0x14170c,null))[_0xf67e('0x3f')](handleError(_0x14170c,null));}; \ No newline at end of file +var _0x31e5=['VoiceDialReport','then','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','describe','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','options'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x31e5,0x13e));var _0x531e=function(_0x4a9c48,_0x3be3ff){_0x4a9c48=_0x4a9c48-0x0;var _0x2ceac9=_0x31e5[_0x4a9c48];return _0x2ceac9;};'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(_0x531e('0x0'));var moment=require(_0x531e('0x1'));var BPromise=require(_0x531e('0x2'));var Mustache=require(_0x531e('0x3'));var util=require(_0x531e('0x4'));var path=require('path');var sox=require(_0x531e('0x5'));var csv=require(_0x531e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x531e('0x7'));var _=require(_0x531e('0x8'));var squel=require(_0x531e('0x9'));var crypto=require('crypto');var jsforce=require(_0x531e('0xa'));var deskjs=require(_0x531e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x531e('0xc'));var Papa=require(_0x531e('0xd'));var Redis=require(_0x531e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x531e('0xf'));var as=require(_0x531e('0x10'));var hardwareService=require(_0x531e('0x11'));var logger=require(_0x531e('0x12'))('api');var utils=require(_0x531e('0x13'));var config=require(_0x531e('0x14'));var licenseUtil=require(_0x531e('0x15'));var db=require(_0x531e('0x16'))['db'];function respondWithStatusCode(_0x596b51,_0x37d63e){_0x37d63e=_0x37d63e||0xcc;return function(_0xec0b07){if(_0xec0b07){return _0x596b51[_0x531e('0x17')](_0x37d63e);}return _0x596b51[_0x531e('0x18')](_0x37d63e)['end']();};}function respondWithResult(_0x5145c4,_0x11b2a7){_0x11b2a7=_0x11b2a7||0xc8;return function(_0x3bae78){if(_0x3bae78){return _0x5145c4[_0x531e('0x18')](_0x11b2a7)[_0x531e('0x19')](_0x3bae78);}};}function respondWithFilteredResult(_0x286310,_0x17b5c9){return function(_0x2adcbd){if(_0x2adcbd){var _0xc93e71=typeof _0x17b5c9['offset']===_0x531e('0x1a')&&typeof _0x17b5c9[_0x531e('0x1b')]===_0x531e('0x1a');var _0x37fbc4=_0x2adcbd['count'];var _0x1ac5ea=_0xc93e71?0x0:_0x17b5c9[_0x531e('0x1c')];var _0x16f213=_0xc93e71?_0x2adcbd[_0x531e('0x1d')]:_0x17b5c9[_0x531e('0x1c')]+_0x17b5c9[_0x531e('0x1b')];var _0x183951;if(_0x16f213>=_0x37fbc4){_0x16f213=_0x37fbc4;_0x183951=0xc8;}else{_0x183951=0xce;}_0x286310[_0x531e('0x18')](_0x183951);return _0x286310[_0x531e('0x1e')](_0x531e('0x1f'),_0x1ac5ea+'-'+_0x16f213+'/'+_0x37fbc4)['json'](_0x2adcbd);}return null;};}function patchUpdates(_0x3addd2){return function(_0x423a4c){try{jsonpatch[_0x531e('0x20')](_0x423a4c,_0x3addd2,!![]);}catch(_0x258995){return BPromise[_0x531e('0x21')](_0x258995);}return _0x423a4c[_0x531e('0x22')]();};}function saveUpdates(_0x57f4d0,_0x2c6b7e){return function(_0x58f84b){if(_0x58f84b){return _0x58f84b[_0x531e('0x23')](_0x57f4d0)['then'](function(_0x56530f){return _0x56530f;});}return null;};}function removeEntity(_0x5a57dc,_0x245c8c){return function(_0x4ecb83){if(_0x4ecb83){return _0x4ecb83[_0x531e('0x24')]()['then'](function(){_0x5a57dc[_0x531e('0x18')](0xcc)[_0x531e('0x25')]();});}};}function handleEntityNotFound(_0x65506f,_0x2a5acb){return function(_0x5bc364){if(!_0x5bc364){_0x65506f['sendStatus'](0x194);}return _0x5bc364;};}function handleError(_0x22ad2d,_0x48d5e8){_0x48d5e8=_0x48d5e8||0x1f4;return function(_0x85ffe5){logger['error'](_0x85ffe5[_0x531e('0x26')]);if(_0x85ffe5[_0x531e('0x27')]){delete _0x85ffe5[_0x531e('0x27')];}_0x22ad2d[_0x531e('0x18')](_0x48d5e8)[_0x531e('0x28')](_0x85ffe5);};}exports[_0x531e('0x29')]=function(_0x48a525,_0x356ce4){var _0x4a989a={},_0xdcfcd9={},_0x28c276={'count':0x0,'rows':[]};var _0x533db5=_[_0x531e('0x2a')](db['VoiceDialReport'][_0x531e('0x2b')],function(_0x4b0328){return{'name':_0x4b0328[_0x531e('0x2c')],'type':_0x4b0328['type'][_0x531e('0x2d')]};});_0xdcfcd9[_0x531e('0x2e')]=_[_0x531e('0x2a')](_0x533db5,_0x531e('0x27'));_0xdcfcd9[_0x531e('0x2f')]=_[_0x531e('0x30')](_0x48a525['query']);_0xdcfcd9[_0x531e('0x31')]=_[_0x531e('0x32')](_0xdcfcd9['model'],_0xdcfcd9['query']);_0x4a989a[_0x531e('0x33')]=_[_0x531e('0x32')](_0xdcfcd9[_0x531e('0x2e')],qs['fields'](_0x48a525[_0x531e('0x2f')][_0x531e('0x34')]));_0x4a989a[_0x531e('0x33')]=_0x4a989a['attributes']['length']?_0x4a989a[_0x531e('0x33')]:_0xdcfcd9['model'];if(!_0x48a525['query']['hasOwnProperty'](_0x531e('0x35'))){_0x4a989a[_0x531e('0x1b')]=qs[_0x531e('0x1b')](_0x48a525[_0x531e('0x2f')][_0x531e('0x1b')]);_0x4a989a['offset']=qs[_0x531e('0x1c')](_0x48a525[_0x531e('0x2f')]['offset']);}_0x4a989a[_0x531e('0x36')]=qs[_0x531e('0x37')](_0x48a525['query'][_0x531e('0x37')]);_0x4a989a[_0x531e('0x38')]=qs['filters'](_[_0x531e('0x39')](_0x48a525['query'],_0xdcfcd9[_0x531e('0x31')]),_0x533db5);if(_0x48a525['query'][_0x531e('0x3a')]){_0x4a989a[_0x531e('0x38')]=_[_0x531e('0x3b')](_0x4a989a[_0x531e('0x38')],{'$or':_['map'](_0x533db5,function(_0x3d2957){if(_0x3d2957[_0x531e('0x3c')]!=='VIRTUAL'){var _0x7832cd={};_0x7832cd[_0x3d2957[_0x531e('0x27')]]={'$like':'%'+_0x48a525[_0x531e('0x2f')][_0x531e('0x3a')]+'%'};return _0x7832cd;}})});}_0x4a989a=_[_0x531e('0x3b')]({},_0x4a989a,_0x48a525[_0x531e('0x3d')]);var _0x32bac9={'where':_0x4a989a[_0x531e('0x38')]};return db[_0x531e('0x3e')][_0x531e('0x1d')](_0x32bac9)[_0x531e('0x3f')](function(_0xae8c15){_0x28c276[_0x531e('0x1d')]=_0xae8c15;if(_0x48a525[_0x531e('0x2f')]['includeAll']){_0x4a989a[_0x531e('0x40')]=[{'all':!![]}];}return db[_0x531e('0x3e')][_0x531e('0x41')](_0x4a989a);})[_0x531e('0x3f')](function(_0x41e224){_0x28c276[_0x531e('0x42')]=_0x41e224;return _0x28c276;})['then'](respondWithFilteredResult(_0x356ce4,_0x4a989a))['catch'](handleError(_0x356ce4,null));};exports[_0x531e('0x43')]=function(_0x1780e7,_0x46a5c9){var _0x39f2fe={'raw':!![],'where':{'id':_0x1780e7[_0x531e('0x44')]['id']}},_0xc68be5={};_0xc68be5[_0x531e('0x2e')]=_[_0x531e('0x30')](db['VoiceDialReport'][_0x531e('0x2b')]);_0xc68be5['query']=_['keys'](_0x1780e7[_0x531e('0x2f')]);_0xc68be5[_0x531e('0x31')]=_['intersection'](_0xc68be5[_0x531e('0x2e')],_0xc68be5[_0x531e('0x2f')]);_0x39f2fe[_0x531e('0x33')]=_['intersection'](_0xc68be5[_0x531e('0x2e')],qs[_0x531e('0x34')](_0x1780e7[_0x531e('0x2f')][_0x531e('0x34')]));_0x39f2fe[_0x531e('0x33')]=_0x39f2fe[_0x531e('0x33')][_0x531e('0x45')]?_0x39f2fe[_0x531e('0x33')]:_0xc68be5[_0x531e('0x2e')];if(_0x1780e7[_0x531e('0x2f')][_0x531e('0x46')]){_0x39f2fe['include']=[{'all':!![]}];}_0x39f2fe=_[_0x531e('0x3b')]({},_0x39f2fe,_0x1780e7[_0x531e('0x3d')]);return db['VoiceDialReport'][_0x531e('0x47')](_0x39f2fe)[_0x531e('0x3f')](handleEntityNotFound(_0x46a5c9,null))[_0x531e('0x3f')](respondWithResult(_0x46a5c9,null))[_0x531e('0x48')](handleError(_0x46a5c9,null));};exports[_0x531e('0x49')]=function(_0x10988b,_0x435f97){return db[_0x531e('0x3e')]['create'](_0x10988b[_0x531e('0x4a')],{})[_0x531e('0x3f')](respondWithResult(_0x435f97,0xc9))['catch'](handleError(_0x435f97,null));};exports[_0x531e('0x23')]=function(_0x4fcc1e,_0x1fe0f2){if(_0x4fcc1e[_0x531e('0x4a')]['id']){delete _0x4fcc1e[_0x531e('0x4a')]['id'];}return db[_0x531e('0x3e')][_0x531e('0x47')]({'where':{'id':_0x4fcc1e[_0x531e('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fe0f2,null))[_0x531e('0x3f')](saveUpdates(_0x4fcc1e[_0x531e('0x4a')],null))[_0x531e('0x3f')](respondWithResult(_0x1fe0f2,null))[_0x531e('0x48')](handleError(_0x1fe0f2,null));};exports[_0x531e('0x24')]=function(_0x5e915b,_0x5376e7){return db[_0x531e('0x3e')][_0x531e('0x47')]({'where':{'id':_0x5e915b[_0x531e('0x44')]['id']}})[_0x531e('0x3f')](handleEntityNotFound(_0x5376e7,null))[_0x531e('0x3f')](removeEntity(_0x5376e7,null))[_0x531e('0x48')](handleError(_0x5376e7,null));};exports[_0x531e('0x4b')]=function(_0x4f6b83,_0x2cd43e){return db[_0x531e('0x3e')][_0x531e('0x4b')]()[_0x531e('0x3f')](respondWithResult(_0x2cd43e,null))[_0x531e('0x48')](handleError(_0x2cd43e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 30198b5..27ea7e5 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 _0xa50d=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define'];(function(_0x3f6980,_0x545cd9){var _0x309376=function(_0x53ca63){while(--_0x53ca63){_0x3f6980['push'](_0x3f6980['shift']());}};_0x309376(++_0x545cd9);}(_0xa50d,0x7b));var _0xda50=function(_0x28fd96,_0x230c33){_0x28fd96=_0x28fd96-0x0;var _0x31b940=_0xa50d[_0x28fd96];return _0x31b940;};'use strict';var _=require(_0xda50('0x0'));var util=require(_0xda50('0x1'));var logger=require(_0xda50('0x2'))(_0xda50('0x3'));var moment=require(_0xda50('0x4'));var BPromise=require(_0xda50('0x5'));var rp=require(_0xda50('0x6'));var fs=require('fs');var path=require(_0xda50('0x7'));var rimraf=require(_0xda50('0x8'));var config=require('../../config/environment');var attributes=require(_0xda50('0x9'));module[_0xda50('0xa')]=function(_0x17c60d,_0x477de8){return _0x17c60d[_0xda50('0xb')](_0xda50('0xc'),attributes,{'tableName':_0xda50('0xd'),'paranoid':![],'indexes':[{'fields':[_0xda50('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f13=['define','VoiceDialReport','report_dial','uniqueid','lodash','api','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x8f13,0xac));var _0x38f1=function(_0x4a0f16,_0x21ba18){_0x4a0f16=_0x4a0f16-0x0;var _0x45d653=_0x8f13[_0x4a0f16];return _0x45d653;};'use strict';var _=require(_0x38f1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x38f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x38f1('0x2'));var fs=require('fs');var path=require(_0x38f1('0x3'));var rimraf=require(_0x38f1('0x4'));var config=require(_0x38f1('0x5'));var attributes=require(_0x38f1('0x6'));module[_0x38f1('0x7')]=function(_0x4d8527,_0x529e83){return _0x4d8527[_0x38f1('0x8')](_0x38f1('0x9'),attributes,{'tableName':_0x38f1('0xa'),'paranoid':![],'indexes':[{'fields':[_0x38f1('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 fee6d8a..1d39e01 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 _0x8e6a=['message','result','catch','VoiceDialReport','create','options','debug','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','update','raw','where','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s'];(function(_0x79ebc5,_0x2df5d1){var _0x3813b6=function(_0x4e2769){while(--_0x4e2769){_0x79ebc5['push'](_0x79ebc5['shift']());}};_0x3813b6(++_0x2df5d1);}(_0x8e6a,0x106));var _0xa8e6=function(_0xb3a43f,_0x45cc6e){_0xb3a43f=_0xb3a43f-0x0;var _0x19d79c=_0x8e6a[_0xb3a43f];return _0x19d79c;};'use strict';var _=require('lodash');var util=require(_0xa8e6('0x0'));var moment=require(_0xa8e6('0x1'));var BPromise=require(_0xa8e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8e6('0x3'));var db=require(_0xa8e6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8e6('0x5'))('rpc');var config=require(_0xa8e6('0x6'));var jayson=require(_0xa8e6('0x7'));var client=jayson['client'][_0xa8e6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49c9ab,_0x43d4d8,_0x1a9e1a){return new BPromise(function(_0xb1c23e,_0x3eab0e){return client[_0xa8e6('0x9')](_0x49c9ab,_0x1a9e1a)[_0xa8e6('0xa')](function(_0x235e63){logger[_0xa8e6('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x43d4d8,_0xa8e6('0xc'));logger['debug'](_0xa8e6('0xd'),_0x43d4d8,'request\x20sent',JSON['stringify'](_0x235e63));if(_0x235e63[_0xa8e6('0xe')]){if(_0x235e63['error'][_0xa8e6('0xf')]===0x1f4){logger['error'](_0xa8e6('0x10'),_0x43d4d8,_0x235e63[_0xa8e6('0xe')]['message']);return _0x3eab0e(_0x235e63[_0xa8e6('0xe')][_0xa8e6('0x11')]);}logger['error'](_0xa8e6('0x10'),_0x43d4d8,_0x235e63[_0xa8e6('0xe')][_0xa8e6('0x11')]);return _0xb1c23e(_0x235e63[_0xa8e6('0xe')][_0xa8e6('0x11')]);}else{logger[_0xa8e6('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x43d4d8,'request\x20sent');_0xb1c23e(_0x235e63[_0xa8e6('0x12')][_0xa8e6('0x11')]);}})[_0xa8e6('0x13')](function(_0x1279e5){logger['error'](_0xa8e6('0x10'),_0x43d4d8,_0x1279e5);_0x3eab0e(_0x1279e5);});});}exports['CreateVoiceDialReport']=function(_0xee22fe){var _0x22349a=this;return new Promise(function(_0x629f65,_0x2b7fde){return db[_0xa8e6('0x14')][_0xa8e6('0x15')](_0xee22fe['body'],{'raw':_0xee22fe[_0xa8e6('0x16')]?_0xee22fe[_0xa8e6('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xa8e6('0xa')](function(_0x153950){logger[_0xa8e6('0xb')]('CreateVoiceDialReport',_0xee22fe);logger[_0xa8e6('0x17')](_0xa8e6('0x18'),_0xee22fe,JSON[_0xa8e6('0x19')](_0x153950));_0x629f65(_0x153950);})['catch'](function(_0x4cf3fc){logger[_0xa8e6('0xe')]('CreateVoiceDialReport',_0x4cf3fc[_0xa8e6('0x11')],_0xee22fe);_0x2b7fde(_0x22349a[_0xa8e6('0xe')](0x1f4,_0x4cf3fc[_0xa8e6('0x11')]));});});};exports[_0xa8e6('0x1a')]=function(_0x37e4fd){var _0x577a37=this;return new Promise(function(_0x1a8b9d,_0x4e2413){return db['VoiceDialReport'][_0xa8e6('0x1b')](_0x37e4fd['body'],{'raw':_0x37e4fd['options']?_0x37e4fd[_0xa8e6('0x16')][_0xa8e6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37e4fd['options']?_0x37e4fd[_0xa8e6('0x16')][_0xa8e6('0x1d')]||null:null,'attributes':_0x37e4fd['options']?_0x37e4fd[_0xa8e6('0x16')][_0xa8e6('0x1e')]||null:null,'limit':_0x37e4fd[_0xa8e6('0x16')]?_0x37e4fd[_0xa8e6('0x16')]['limit']||null:null})[_0xa8e6('0xa')](function(_0x3090db){logger[_0xa8e6('0xb')](_0xa8e6('0x1a'),_0x37e4fd);logger[_0xa8e6('0x17')](_0xa8e6('0x1a'),_0x37e4fd,JSON[_0xa8e6('0x19')](_0x3090db));_0x1a8b9d(_0x3090db);})[_0xa8e6('0x13')](function(_0x3c973d){logger[_0xa8e6('0xe')](_0xa8e6('0x1a'),_0x3c973d[_0xa8e6('0x11')],_0x37e4fd);_0x4e2413(_0x577a37['error'](0x1f4,_0x3c973d[_0xa8e6('0x11')]));});});}; \ No newline at end of file +var _0xd39a=['rpc','../../config/environment','jayson/promise','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','then','UpdateVoiceDialReport','update','raw','attributes','limit','stringify','util','randomstring','ioredis','../../mysqldb'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0xd39a,0x125));var _0xad39=function(_0x2ceba7,_0x451ce4){_0x2ceba7=_0x2ceba7-0x0;var _0x5348eb=_0xd39a[_0x2ceba7];return _0x5348eb;};'use strict';var _=require('lodash');var util=require(_0xad39('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad39('0x1'));var fs=require('fs');var Redis=require(_0xad39('0x2'));var db=require(_0xad39('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad39('0x4'));var config=require(_0xad39('0x5'));var jayson=require(_0xad39('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56b91a,_0x5aa55f,_0x4da025){return new BPromise(function(_0xfb2418,_0x7f3735){return client['request'](_0x56b91a,_0x4da025)['then'](function(_0x44e80a){logger[_0xad39('0x7')](_0xad39('0x8'),_0x5aa55f,_0xad39('0x9'));logger[_0xad39('0xa')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x5aa55f,_0xad39('0x9'),JSON['stringify'](_0x44e80a));if(_0x44e80a[_0xad39('0xb')]){if(_0x44e80a[_0xad39('0xb')]['code']===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5aa55f,_0x44e80a[_0xad39('0xb')][_0xad39('0xc')]);return _0x7f3735(_0x44e80a[_0xad39('0xb')][_0xad39('0xc')]);}logger[_0xad39('0xb')](_0xad39('0x8'),_0x5aa55f,_0x44e80a[_0xad39('0xb')][_0xad39('0xc')]);return _0xfb2418(_0x44e80a['error'][_0xad39('0xc')]);}else{logger['info'](_0xad39('0x8'),_0x5aa55f,_0xad39('0x9'));_0xfb2418(_0x44e80a[_0xad39('0xd')][_0xad39('0xc')]);}})[_0xad39('0xe')](function(_0x19b673){logger['error'](_0xad39('0x8'),_0x5aa55f,_0x19b673);_0x7f3735(_0x19b673);});});}exports[_0xad39('0xf')]=function(_0x24574d){var _0x388f9f=this;return new Promise(function(_0x32a755,_0x15986c){return db[_0xad39('0x10')][_0xad39('0x11')](_0x24574d[_0xad39('0x12')],{'raw':_0x24574d[_0xad39('0x13')]?_0x24574d['options']['raw']===undefined?!![]:![]:!![]})[_0xad39('0x14')](function(_0x2c3ef9){logger[_0xad39('0x7')](_0xad39('0xf'),_0x24574d);logger[_0xad39('0xa')](_0xad39('0xf'),_0x24574d,JSON['stringify'](_0x2c3ef9));_0x32a755(_0x2c3ef9);})[_0xad39('0xe')](function(_0x32a094){logger[_0xad39('0xb')](_0xad39('0xf'),_0x32a094[_0xad39('0xc')],_0x24574d);_0x15986c(_0x388f9f[_0xad39('0xb')](0x1f4,_0x32a094[_0xad39('0xc')]));});});};exports[_0xad39('0x15')]=function(_0x2f27f9){var _0x11711e=this;return new Promise(function(_0x2815c0,_0xbdfa88){return db['VoiceDialReport'][_0xad39('0x16')](_0x2f27f9[_0xad39('0x12')],{'raw':_0x2f27f9['options']?_0x2f27f9['options'][_0xad39('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f27f9[_0xad39('0x13')]?_0x2f27f9[_0xad39('0x13')]['where']||null:null,'attributes':_0x2f27f9[_0xad39('0x13')]?_0x2f27f9['options'][_0xad39('0x18')]||null:null,'limit':_0x2f27f9[_0xad39('0x13')]?_0x2f27f9['options'][_0xad39('0x19')]||null:null})[_0xad39('0x14')](function(_0x202795){logger[_0xad39('0x7')]('UpdateVoiceDialReport',_0x2f27f9);logger[_0xad39('0xa')](_0xad39('0x15'),_0x2f27f9,JSON[_0xad39('0x1a')](_0x202795));_0x2815c0(_0x202795);})[_0xad39('0xe')](function(_0x530265){logger[_0xad39('0xb')](_0xad39('0x15'),_0x530265[_0xad39('0xc')],_0x2f27f9);_0xbdfa88(_0x11711e[_0xad39('0xb')](0x1f4,_0x530265[_0xad39('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 72c69ab..dc55888 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 _0xb0b5=['/:id','post','/:id/applications','addApplications','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xb0b5,0x1eb));var _0x5b0b=function(_0x14bf8b,_0x186798){_0x14bf8b=_0x14bf8b-0x0;var _0x571eee=_0xb0b5[_0x14bf8b];return _0x571eee;};'use strict';var multer=require(_0x5b0b('0x0'));var util=require(_0x5b0b('0x1'));var path=require(_0x5b0b('0x2'));var timeout=require(_0x5b0b('0x3'));var express=require(_0x5b0b('0x4'));var router=express[_0x5b0b('0x5')]();var fs_extra=require(_0x5b0b('0x6'));var auth=require(_0x5b0b('0x7'));var interaction=require(_0x5b0b('0x8'));var config=require(_0x5b0b('0x9'));var controller=require('./voiceExtension.controller');router[_0x5b0b('0xa')]('/',auth[_0x5b0b('0xb')](),controller[_0x5b0b('0xc')]);router[_0x5b0b('0xa')](_0x5b0b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5b0b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5b0b('0xf'),auth['isAuthenticated'](),controller[_0x5b0b('0x10')]);router[_0x5b0b('0x11')](_0x5b0b('0xd'),auth[_0x5b0b('0xb')](),controller[_0x5b0b('0x12')]);router[_0x5b0b('0x13')](_0x5b0b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b0b('0x14')]=router; \ No newline at end of file +var _0x4a26=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','create','post','/:id/applications','addApplications','put','/:id','destroy','exports','multer'];(function(_0x4cc9b5,_0x8e5f6e){var _0x5a2d1d=function(_0x44009c){while(--_0x44009c){_0x4cc9b5['push'](_0x4cc9b5['shift']());}};_0x5a2d1d(++_0x8e5f6e);}(_0x4a26,0x1cd));var _0x64a2=function(_0x2da32a,_0x28a2ce){_0x2da32a=_0x2da32a-0x0;var _0x1fd70d=_0x4a26[_0x2da32a];return _0x1fd70d;};'use strict';var multer=require(_0x64a2('0x0'));var util=require(_0x64a2('0x1'));var path=require(_0x64a2('0x2'));var timeout=require(_0x64a2('0x3'));var express=require(_0x64a2('0x4'));var router=express[_0x64a2('0x5')]();var fs_extra=require(_0x64a2('0x6'));var auth=require(_0x64a2('0x7'));var interaction=require(_0x64a2('0x8'));var config=require(_0x64a2('0x9'));var controller=require(_0x64a2('0xa'));router[_0x64a2('0xb')]('/',auth[_0x64a2('0xc')](),controller['index']);router[_0x64a2('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x64a2('0xd')]);router[_0x64a2('0xe')](_0x64a2('0xf'),auth[_0x64a2('0xc')](),controller[_0x64a2('0x10')]);router[_0x64a2('0x11')](_0x64a2('0x12'),auth[_0x64a2('0xc')](),controller['update']);router['delete'](_0x64a2('0x12'),auth[_0x64a2('0xc')](),controller[_0x64a2('0x13')]);module[_0x64a2('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 05d776c..78faa03 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 _0xb56a=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','STRING','compositeIndex','ENUM','inbound','internal','outbound-fax','system','any'];(function(_0x1c86ea,_0x4c0802){var _0x426666=function(_0x54cc54){while(--_0x54cc54){_0x1c86ea['push'](_0x1c86ea['shift']());}};_0x426666(++_0x4c0802);}(_0xb56a,0x1d4));var _0xab56=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xb56a[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xab56('0x0')],'allowNull':![],'unique':_0xab56('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xab56('0x0')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xab56('0x0')],'allowNull':![],'defaultValue':'1','unique':_0xab56('0x1')},'tag':{'type':Sequelize[_0xab56('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xab56('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xab56('0x2')](_0xab56('0x3'),'outbound',_0xab56('0x4'),'inbound-fax',_0xab56('0x5'),_0xab56('0x6'),_0xab56('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xab56('0x8')},'IntervalId':{'type':Sequelize[_0xab56('0x9')]},'isApp':{'type':Sequelize[_0xab56('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xab56('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xab56('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xab56('0xb')],'get':function(_0x56c0a8){return this[_0xab56('0xc')](_0xab56('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4570=['compositeIndex','ENUM','inbound','internal','outbound-fax','system','INTEGER','BOOLEAN','wav','VIRTUAL','exten','exports','STRING'];(function(_0xaa569f,_0x33ce2b){var _0x39504c=function(_0x2c1466){while(--_0x2c1466){_0xaa569f['push'](_0xaa569f['shift']());}};_0x39504c(++_0x33ce2b);}(_0x4570,0x1b8));var _0x0457=function(_0x43635e,_0x12619b){_0x43635e=_0x43635e-0x0;var _0x1b972f=_0x4570[_0x43635e];return _0x1b972f;};'use strict';var Sequelize=require('sequelize');module[_0x0457('0x0')]={'context':{'type':Sequelize[_0x0457('0x1')],'allowNull':![],'unique':_0x0457('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0457('0x2')},'tag':{'type':Sequelize[_0x0457('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0457('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0457('0x3')](_0x0457('0x4'),'outbound',_0x0457('0x5'),'inbound-fax',_0x0457('0x6'),_0x0457('0x7'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x0457('0x8')]},'isApp':{'type':Sequelize[_0x0457('0x9')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0457('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x0457('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0457('0x8')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0457('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x0457('0xb')],'get':function(_0x1a7106){return this['getDataValue'](_0x0457('0xc'));}},'alias':{'type':Sequelize[_0x0457('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f496e05..b463b24 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 _0xa26d=['type','name','UserProfileResource','stack','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','params','include','catch','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','internal','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','alias','context','addApplications','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','eml-format','rimraf','fast-json-patch','moment','bluebird','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','../../mysqldb','redis','localhost','./voiceExtension.socket','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','includes','find'];(function(_0x5d1575,_0x5a5d8c){var _0x4899d4=function(_0x23e182){while(--_0x23e182){_0x5d1575['push'](_0x5d1575['shift']());}};_0x4899d4(++_0x5a5d8c);}(_0xa26d,0x11b));var _0xda26=function(_0xa4e515,_0x53dc5c){_0xa4e515=_0xa4e515-0x0;var _0x2f1e6a=_0xa26d[_0xa4e515];return _0x2f1e6a;};'use strict';var emlformat=require(_0xda26('0x0'));var rimraf=require(_0xda26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda26('0x2'));var rp=require('request-promise');var moment=require(_0xda26('0x3'));var BPromise=require(_0xda26('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xda26('0x5'));var sox=require(_0xda26('0x6'));var csv=require(_0xda26('0x7'));var ejs=require(_0xda26('0x8'));var fs=require('fs');var fs_extra=require(_0xda26('0x9'));var _=require(_0xda26('0xa'));var squel=require(_0xda26('0xb'));var crypto=require(_0xda26('0xc'));var jsforce=require(_0xda26('0xd'));var deskjs=require(_0xda26('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda26('0xf'));var Redis=require(_0xda26('0x10'));var authService=require(_0xda26('0x11'));var qs=require(_0xda26('0x12'));var as=require(_0xda26('0x13'));var hardwareService=require(_0xda26('0x14'));var logger=require(_0xda26('0x15'))(_0xda26('0x16'));var utils=require(_0xda26('0x17'));var config=require(_0xda26('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xda26('0x19'))['db'];config[_0xda26('0x1a')]=_['defaults'](config[_0xda26('0x1a')],{'host':_0xda26('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda26('0x1a')]));require(_0xda26('0x1c'))['register'](socket);function respondWithStatusCode(_0x2f4dcb,_0x2c8274){_0x2c8274=_0x2c8274||0xcc;return function(_0x1a9a69){if(_0x1a9a69){return _0x2f4dcb[_0xda26('0x1d')](_0x2c8274);}return _0x2f4dcb[_0xda26('0x1e')](_0x2c8274)[_0xda26('0x1f')]();};}function respondWithResult(_0x5db4a5,_0x41462c){_0x41462c=_0x41462c||0xc8;return function(_0x3edb3e){if(_0x3edb3e){return _0x5db4a5[_0xda26('0x1e')](_0x41462c)[_0xda26('0x20')](_0x3edb3e);}};}function respondWithFilteredResult(_0x37df9e,_0x1136c6){return function(_0x1e32f7){if(_0x1e32f7){var _0x4278c4=typeof _0x1136c6['offset']===_0xda26('0x21')&&typeof _0x1136c6['limit']===_0xda26('0x21');var _0x8ea620=_0x1e32f7[_0xda26('0x22')];var _0x33623c=_0x4278c4?0x0:_0x1136c6['offset'];var _0x55335b=_0x4278c4?_0x1e32f7['count']:_0x1136c6[_0xda26('0x23')]+_0x1136c6[_0xda26('0x24')];var _0x780cf9;if(_0x55335b>=_0x8ea620){_0x55335b=_0x8ea620;_0x780cf9=0xc8;}else{_0x780cf9=0xce;}_0x37df9e[_0xda26('0x1e')](_0x780cf9);return _0x37df9e[_0xda26('0x25')](_0xda26('0x26'),_0x33623c+'-'+_0x55335b+'/'+_0x8ea620)[_0xda26('0x20')](_0x1e32f7);}return null;};}function patchUpdates(_0x21ca17){return function(_0x1b0262){try{jsonpatch['apply'](_0x1b0262,_0x21ca17,!![]);}catch(_0x16a0b2){return BPromise[_0xda26('0x27')](_0x16a0b2);}return _0x1b0262[_0xda26('0x28')]();};}function saveUpdates(_0x32fb2b,_0x28ec47){return function(_0x15b02d){if(_0x15b02d){return _0x15b02d[_0xda26('0x29')](_0x32fb2b)[_0xda26('0x2a')](function(_0x1f9d08){return _0x1f9d08;});}return null;};}function removeEntity(_0x218d25,_0x5d41e8){return function(_0x4c9082){if(_0x4c9082){return _0x4c9082[_0xda26('0x2b')]()[_0xda26('0x2a')](function(){var _0x5ad681=_0x4c9082[_0xda26('0x2c')]({'plain':!![]});var _0x36a674=[{'name':'InboundRoutes','value':_0xda26('0x2d'),'ignore':![]},{'name':_0xda26('0x2e'),'value':_0xda26('0x2f'),'ignore':![]},{'name':_0xda26('0x30'),'value':'internal','ignore':![]}];var _0x332038=_(_0x36a674)[_0xda26('0x31')](_0xda26('0x32'))['map']('value')['value']();if(_[_0xda26('0x33')](_0x332038,_0x5ad681['type'])){return;}var _0x312c4e=_[_0xda26('0x34')](_0x36a674,['value',_0x5ad681[_0xda26('0x35')]])[_0xda26('0x36')];return db[_0xda26('0x37')][_0xda26('0x2b')]({'where':{'type':_0x312c4e,'resourceId':_0x5ad681['id']}})[_0xda26('0x2a')](function(){return _0x4c9082;});})['then'](function(){_0x218d25['status'](0xcc)[_0xda26('0x1f')]();});}};}function handleEntityNotFound(_0x4958b0,_0x4b7da2){return function(_0xef459b){if(!_0xef459b){_0x4958b0[_0xda26('0x1d')](0x194);}return _0xef459b;};}function handleError(_0x23359d,_0x4c110e){_0x4c110e=_0x4c110e||0x1f4;return function(_0x33ba58){logger['error'](_0x33ba58[_0xda26('0x38')]);if(_0x33ba58[_0xda26('0x36')]){delete _0x33ba58[_0xda26('0x36')];}_0x23359d[_0xda26('0x1e')](_0x4c110e)[_0xda26('0x39')](_0x33ba58);};}exports[_0xda26('0x3a')]=function(_0x1dc2b2,_0x2fe49b){var _0x249003={},_0x1a5c4a={},_0x5ae551={'count':0x0,'rows':[]};var _0x3474d7=_[_0xda26('0x3b')](db['VoiceExtension'][_0xda26('0x3c')],function(_0x36e8fc){return{'name':_0x36e8fc[_0xda26('0x3d')],'type':_0x36e8fc[_0xda26('0x35')]['key']};});_0x1a5c4a['model']=_['map'](_0x3474d7,'name');_0x1a5c4a[_0xda26('0x3e')]=_[_0xda26('0x3f')](_0x1dc2b2[_0xda26('0x3e')]);_0x1a5c4a[_0xda26('0x40')]=_[_0xda26('0x41')](_0x1a5c4a[_0xda26('0x42')],_0x1a5c4a[_0xda26('0x3e')]);_0x249003[_0xda26('0x43')]=_['intersection'](_0x1a5c4a[_0xda26('0x42')],qs[_0xda26('0x44')](_0x1dc2b2[_0xda26('0x3e')][_0xda26('0x44')]));_0x249003['attributes']=_0x249003[_0xda26('0x43')][_0xda26('0x45')]?_0x249003[_0xda26('0x43')]:_0x1a5c4a[_0xda26('0x42')];if(!_0x1dc2b2[_0xda26('0x3e')][_0xda26('0x46')](_0xda26('0x47'))){_0x249003[_0xda26('0x24')]=qs[_0xda26('0x24')](_0x1dc2b2['query']['limit']);_0x249003['offset']=qs[_0xda26('0x23')](_0x1dc2b2['query'][_0xda26('0x23')]);}_0x249003[_0xda26('0x48')]=qs['sort'](_0x1dc2b2[_0xda26('0x3e')]['sort']);_0x249003[_0xda26('0x49')]=qs[_0xda26('0x40')](_[_0xda26('0x4a')](_0x1dc2b2[_0xda26('0x3e')],_0x1a5c4a[_0xda26('0x40')]),_0x3474d7);if(_0x1dc2b2[_0xda26('0x3e')][_0xda26('0x31')]){_0x249003['where']=_[_0xda26('0x4b')](_0x249003[_0xda26('0x49')],{'$or':_[_0xda26('0x3b')](_0x3474d7,function(_0x4d1037){if(_0x4d1037[_0xda26('0x35')]!==_0xda26('0x4c')){var _0x593b9d={};_0x593b9d[_0x4d1037[_0xda26('0x36')]]={'$like':'%'+_0x1dc2b2[_0xda26('0x3e')][_0xda26('0x31')]+'%'};return _0x593b9d;}})});}_0x249003=_[_0xda26('0x4b')]({},_0x249003,_0x1dc2b2[_0xda26('0x4d')]);var _0x24659c={'where':_0x249003['where']};return db[_0xda26('0x4e')][_0xda26('0x22')](_0x24659c)[_0xda26('0x2a')](function(_0x39076f){_0x5ae551[_0xda26('0x22')]=_0x39076f;if(_0x1dc2b2[_0xda26('0x3e')][_0xda26('0x4f')]){_0x249003['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xda26('0x50')](_0x249003);})[_0xda26('0x2a')](function(_0x39c677){_0x5ae551[_0xda26('0x51')]=_0x39c677;return _0x5ae551;})[_0xda26('0x2a')](respondWithFilteredResult(_0x2fe49b,_0x249003))['catch'](handleError(_0x2fe49b,null));};exports['show']=function(_0x4ab5ed,_0x10aa85){var _0xb03896={'raw':![],'where':{'id':_0x4ab5ed[_0xda26('0x52')]['id']}},_0x3a656c={};_0x3a656c[_0xda26('0x42')]=_[_0xda26('0x3f')](db['VoiceExtension'][_0xda26('0x3c')]);_0x3a656c[_0xda26('0x3e')]=_[_0xda26('0x3f')](_0x4ab5ed[_0xda26('0x3e')]);_0x3a656c[_0xda26('0x40')]=_['intersection'](_0x3a656c[_0xda26('0x42')],_0x3a656c[_0xda26('0x3e')]);_0xb03896[_0xda26('0x43')]=_['intersection'](_0x3a656c[_0xda26('0x42')],qs[_0xda26('0x44')](_0x4ab5ed[_0xda26('0x3e')]['fields']));_0xb03896[_0xda26('0x43')]=_0xb03896[_0xda26('0x43')][_0xda26('0x45')]?_0xb03896[_0xda26('0x43')]:_0x3a656c[_0xda26('0x42')];if(_0x4ab5ed[_0xda26('0x3e')][_0xda26('0x4f')]){_0xb03896[_0xda26('0x53')]=[{'all':!![]}];}_0xb03896=_['merge']({},_0xb03896,_0x4ab5ed[_0xda26('0x4d')]);return db[_0xda26('0x4e')]['find'](_0xb03896)[_0xda26('0x2a')](handleEntityNotFound(_0x10aa85,null))['then'](respondWithResult(_0x10aa85,null))[_0xda26('0x54')](handleError(_0x10aa85,null));};exports['destroy']=function(_0x36d632,_0x54854c){return db['VoiceExtension'][_0xda26('0x34')]({'where':{'id':_0x36d632['params']['id']}})[_0xda26('0x2a')](handleEntityNotFound(_0x54854c,null))[_0xda26('0x2a')](removeEntity(_0x54854c,null))[_0xda26('0x54')](handleError(_0x54854c,null));};exports['create']=function(_0x3897b2,_0x1d0306){if(_0x3897b2['body'][_0xda26('0x35')]===_0xda26('0x2f')&&!_[_0xda26('0x55')](_0x3897b2[_0xda26('0x56')][_0xda26('0x57')],'_')){_0x3897b2[_0xda26('0x56')]['exten']='_'[_0xda26('0x58')](_0x3897b2[_0xda26('0x56')]['exten']);}return db[_0xda26('0x4e')]['create'](_0x3897b2[_0xda26('0x56')],{'raw':![]})[_0xda26('0x2a')](function(_0x585108){var _0x427dfe=_0x3897b2[_0xda26('0x59')][_0xda26('0x2c')]({'plain':!![]});if(!_0x427dfe)throw new Error(_0xda26('0x5a'));if(_0x427dfe[_0xda26('0x5b')]===_0xda26('0x59')){var _0x4484d6=_0x585108[_0xda26('0x2c')]({'plain':!![]});var _0x1ebde6=[{'name':_0xda26('0x5c'),'value':_0xda26('0x2d')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0xda26('0x5d')}];var _0x41e33d=_['find'](_0x1ebde6,['value',_0x4484d6[_0xda26('0x35')]])[_0xda26('0x36')];return db[_0xda26('0x5e')][_0xda26('0x34')]({'where':{'name':_0x41e33d,'userProfileId':_0x427dfe[_0xda26('0x5f')]},'raw':!![]})['then'](function(_0x185008){if(_0x185008&&_0x185008['autoAssociation']===0x0){return db[_0xda26('0x37')]['create']({'name':_0x4484d6[_0xda26('0x36')],'resourceId':_0x4484d6['id'],'type':_0x185008[_0xda26('0x36')],'sectionId':_0x185008['id']},{})[_0xda26('0x2a')](function(){return _0x585108;});}else{return _0x585108;}})[_0xda26('0x54')](function(_0x29a13f){logger[_0xda26('0x60')](_0xda26('0x61'),_0x29a13f);throw _0x29a13f;});}return _0x585108;})['then'](respondWithResult(_0x1d0306,0xc9))[_0xda26('0x54')](handleError(_0x1d0306,null));};exports[_0xda26('0x29')]=function(_0x5657b6,_0x4414e3){if(_0x5657b6[_0xda26('0x56')]['id']){delete _0x5657b6[_0xda26('0x56')]['id'];}return db[_0xda26('0x4e')]['find']({'where':{'id':_0x5657b6['params']['id']}})[_0xda26('0x2a')](handleEntityNotFound(_0x4414e3,null))[_0xda26('0x2a')](function(_0x418717){if(_0x418717){return db[_0xda26('0x4e')][_0xda26('0x29')](_[_0xda26('0x4a')](_0x5657b6[_0xda26('0x56')],[_0xda26('0x57'),'context',_0xda26('0x62'),'recordingFormat','cutdigits','mandatoryDisposition',_0xda26('0x63')]),{'where':{'context':_0x418717[_0xda26('0x64')],'exten':_0x418717[_0xda26('0x57')]},'individualHooks':!![]})[_0xda26('0x2a')](function(_0x5b1450){return _0x5b1450;});}return null;})[_0xda26('0x2a')](respondWithStatusCode(_0x4414e3,null))[_0xda26('0x54')](handleError(_0x4414e3,null));};exports[_0xda26('0x65')]=function(_0x2b0955,_0x542f66){return db[_0xda26('0x4e')]['findOne']({'where':{'id':_0x2b0955[_0xda26('0x52')]['id']}})[_0xda26('0x2a')](function(_0x19fbef){if(_0x19fbef){return db[_0xda26('0x66')][_0xda26('0x67')](function(_0xf12e95){return db[_0xda26('0x4e')][_0xda26('0x2b')]({'where':{'VoiceExtensionId':_0x2b0955[_0xda26('0x52')]['id']},'transaction':_0xf12e95})[_0xda26('0x2a')](function(){var _0x107f4a=_[_0xda26('0x3b')](_0x2b0955['body'],function(_0x52509b){_0x52509b[_0xda26('0x68')]=_0x2b0955[_0xda26('0x52')]['id'];_0x52509b[_0xda26('0x69')]=!![];return _0x52509b;});var _0x5d2ac8=_0x2b0955[_0xda26('0x3e')]['rewriteDial']&&_0x2b0955[_0xda26('0x3e')][_0xda26('0x6a')][_0xda26('0x6b')]()===_0xda26('0x6c')?!![]:![];return _0x19fbef[_0xda26('0x6d')](_0x107f4a,_0x5d2ac8);})[_0xda26('0x2a')](function(_0x13c538){return db[_0xda26('0x4e')][_0xda26('0x6e')](_0x13c538,{'transaction':_0xf12e95});});})['then'](function(){return db[_0xda26('0x4e')][_0xda26('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2b0955[_0xda26('0x52')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xda26('0x2a')](respondWithResult(_0x542f66,null))[_0xda26('0x54')](handleError(_0x542f66,null));}; \ No newline at end of file +var _0xad51=['destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','filter','ignore','map','value','includes','find','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','params','create','startsWith','exten','body','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','InternalRoutes','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','findOne','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','true','bulkCreate','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','update'];(function(_0x9c2a18,_0x34ca96){var _0xbcb4ac=function(_0x13c632){while(--_0x13c632){_0x9c2a18['push'](_0x9c2a18['shift']());}};_0xbcb4ac(++_0x34ca96);}(_0xad51,0x132));var _0x1ad5=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xad51[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x1ad5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ad5('0x1'));var jsonpatch=require(_0x1ad5('0x2'));var rp=require(_0x1ad5('0x3'));var moment=require(_0x1ad5('0x4'));var BPromise=require(_0x1ad5('0x5'));var Mustache=require(_0x1ad5('0x6'));var util=require(_0x1ad5('0x7'));var path=require(_0x1ad5('0x8'));var sox=require(_0x1ad5('0x9'));var csv=require(_0x1ad5('0xa'));var ejs=require(_0x1ad5('0xb'));var fs=require('fs');var fs_extra=require(_0x1ad5('0xc'));var _=require(_0x1ad5('0xd'));var squel=require(_0x1ad5('0xe'));var crypto=require(_0x1ad5('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ad5('0xa'));var querystring=require(_0x1ad5('0x10'));var Papa=require(_0x1ad5('0x11'));var Redis=require(_0x1ad5('0x12'));var authService=require(_0x1ad5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1ad5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ad5('0x15'))(_0x1ad5('0x16'));var utils=require(_0x1ad5('0x17'));var config=require(_0x1ad5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ad5('0x19'))['db'];config[_0x1ad5('0x1a')]=_['defaults'](config['redis'],{'host':_0x1ad5('0x1b'),'port':0x18eb});var socket=require(_0x1ad5('0x1c'))(new Redis(config['redis']));require(_0x1ad5('0x1d'))['register'](socket);function respondWithStatusCode(_0x54eca4,_0x3ab2cf){_0x3ab2cf=_0x3ab2cf||0xcc;return function(_0x5b061b){if(_0x5b061b){return _0x54eca4[_0x1ad5('0x1e')](_0x3ab2cf);}return _0x54eca4['status'](_0x3ab2cf)[_0x1ad5('0x1f')]();};}function respondWithResult(_0x2b9611,_0x4a1695){_0x4a1695=_0x4a1695||0xc8;return function(_0x40b4b5){if(_0x40b4b5){return _0x2b9611['status'](_0x4a1695)['json'](_0x40b4b5);}};}function respondWithFilteredResult(_0x4bc35d,_0xff85c5){return function(_0x2f9159){if(_0x2f9159){var _0x1d6467=typeof _0xff85c5[_0x1ad5('0x20')]===_0x1ad5('0x21')&&typeof _0xff85c5[_0x1ad5('0x22')]===_0x1ad5('0x21');var _0x3a32c5=_0x2f9159[_0x1ad5('0x23')];var _0x1241ee=_0x1d6467?0x0:_0xff85c5[_0x1ad5('0x20')];var _0x3320e1=_0x1d6467?_0x2f9159['count']:_0xff85c5[_0x1ad5('0x20')]+_0xff85c5[_0x1ad5('0x22')];var _0x1981d0;if(_0x3320e1>=_0x3a32c5){_0x3320e1=_0x3a32c5;_0x1981d0=0xc8;}else{_0x1981d0=0xce;}_0x4bc35d[_0x1ad5('0x24')](_0x1981d0);return _0x4bc35d[_0x1ad5('0x25')](_0x1ad5('0x26'),_0x1241ee+'-'+_0x3320e1+'/'+_0x3a32c5)[_0x1ad5('0x27')](_0x2f9159);}return null;};}function patchUpdates(_0x3e25fa){return function(_0x2ff39b){try{jsonpatch[_0x1ad5('0x28')](_0x2ff39b,_0x3e25fa,!![]);}catch(_0x23d5a8){return BPromise['reject'](_0x23d5a8);}return _0x2ff39b['save']();};}function saveUpdates(_0x57c9e6,_0x51bdb9){return function(_0x3b295d){if(_0x3b295d){return _0x3b295d[_0x1ad5('0x29')](_0x57c9e6)['then'](function(_0x346c8a){return _0x346c8a;});}return null;};}function removeEntity(_0x5c8447,_0x4fefda){return function(_0x32d7e7){if(_0x32d7e7){return _0x32d7e7[_0x1ad5('0x2a')]()['then'](function(){var _0xa47fd0=_0x32d7e7[_0x1ad5('0x2b')]({'plain':!![]});var _0xa9bb63=[{'name':_0x1ad5('0x2c'),'value':_0x1ad5('0x2d'),'ignore':![]},{'name':_0x1ad5('0x2e'),'value':_0x1ad5('0x2f'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x105268=_(_0xa9bb63)[_0x1ad5('0x30')](_0x1ad5('0x31'))[_0x1ad5('0x32')](_0x1ad5('0x33'))[_0x1ad5('0x33')]();if(_[_0x1ad5('0x34')](_0x105268,_0xa47fd0['type'])){return;}var _0x25435b=_[_0x1ad5('0x35')](_0xa9bb63,[_0x1ad5('0x33'),_0xa47fd0['type']])[_0x1ad5('0x36')];return db[_0x1ad5('0x37')][_0x1ad5('0x2a')]({'where':{'type':_0x25435b,'resourceId':_0xa47fd0['id']}})[_0x1ad5('0x38')](function(){return _0x32d7e7;});})[_0x1ad5('0x38')](function(){_0x5c8447['status'](0xcc)[_0x1ad5('0x1f')]();});}};}function handleEntityNotFound(_0x106994,_0x30c144){return function(_0x50e351){if(!_0x50e351){_0x106994[_0x1ad5('0x1e')](0x194);}return _0x50e351;};}function handleError(_0x1ad085,_0x5694a9){_0x5694a9=_0x5694a9||0x1f4;return function(_0x1c19ae){logger[_0x1ad5('0x39')](_0x1c19ae[_0x1ad5('0x3a')]);if(_0x1c19ae[_0x1ad5('0x36')]){delete _0x1c19ae['name'];}_0x1ad085[_0x1ad5('0x24')](_0x5694a9)[_0x1ad5('0x3b')](_0x1c19ae);};}exports[_0x1ad5('0x3c')]=function(_0x4dbf75,_0x3b1d39){var _0x296f5b={},_0x1813eb={},_0x6c31e0={'count':0x0,'rows':[]};var _0x2283b9=_[_0x1ad5('0x32')](db[_0x1ad5('0x3d')][_0x1ad5('0x3e')],function(_0x490d04){return{'name':_0x490d04[_0x1ad5('0x3f')],'type':_0x490d04[_0x1ad5('0x40')][_0x1ad5('0x41')]};});_0x1813eb[_0x1ad5('0x42')]=_[_0x1ad5('0x32')](_0x2283b9,_0x1ad5('0x36'));_0x1813eb[_0x1ad5('0x43')]=_[_0x1ad5('0x44')](_0x4dbf75[_0x1ad5('0x43')]);_0x1813eb[_0x1ad5('0x45')]=_[_0x1ad5('0x46')](_0x1813eb[_0x1ad5('0x42')],_0x1813eb[_0x1ad5('0x43')]);_0x296f5b[_0x1ad5('0x47')]=_[_0x1ad5('0x46')](_0x1813eb['model'],qs[_0x1ad5('0x48')](_0x4dbf75[_0x1ad5('0x43')][_0x1ad5('0x48')]));_0x296f5b[_0x1ad5('0x47')]=_0x296f5b[_0x1ad5('0x47')][_0x1ad5('0x49')]?_0x296f5b[_0x1ad5('0x47')]:_0x1813eb[_0x1ad5('0x42')];if(!_0x4dbf75[_0x1ad5('0x43')][_0x1ad5('0x4a')]('nolimit')){_0x296f5b['limit']=qs[_0x1ad5('0x22')](_0x4dbf75[_0x1ad5('0x43')][_0x1ad5('0x22')]);_0x296f5b[_0x1ad5('0x20')]=qs[_0x1ad5('0x20')](_0x4dbf75[_0x1ad5('0x43')][_0x1ad5('0x20')]);}_0x296f5b[_0x1ad5('0x4b')]=qs[_0x1ad5('0x4c')](_0x4dbf75[_0x1ad5('0x43')][_0x1ad5('0x4c')]);_0x296f5b[_0x1ad5('0x4d')]=qs[_0x1ad5('0x45')](_['pick'](_0x4dbf75['query'],_0x1813eb[_0x1ad5('0x45')]),_0x2283b9);if(_0x4dbf75[_0x1ad5('0x43')][_0x1ad5('0x30')]){_0x296f5b['where']=_['merge'](_0x296f5b[_0x1ad5('0x4d')],{'$or':_[_0x1ad5('0x32')](_0x2283b9,function(_0xf3e0f){if(_0xf3e0f['type']!==_0x1ad5('0x4e')){var _0x3e574c={};_0x3e574c[_0xf3e0f[_0x1ad5('0x36')]]={'$like':'%'+_0x4dbf75[_0x1ad5('0x43')]['filter']+'%'};return _0x3e574c;}})});}_0x296f5b=_[_0x1ad5('0x4f')]({},_0x296f5b,_0x4dbf75['options']);var _0x1839eb={'where':_0x296f5b[_0x1ad5('0x4d')]};return db['VoiceExtension']['count'](_0x1839eb)[_0x1ad5('0x38')](function(_0x25ca9c){_0x6c31e0['count']=_0x25ca9c;if(_0x4dbf75['query'][_0x1ad5('0x50')]){_0x296f5b[_0x1ad5('0x51')]=[{'all':!![]}];}return db[_0x1ad5('0x3d')][_0x1ad5('0x52')](_0x296f5b);})['then'](function(_0x15b0de){_0x6c31e0[_0x1ad5('0x53')]=_0x15b0de;return _0x6c31e0;})[_0x1ad5('0x38')](respondWithFilteredResult(_0x3b1d39,_0x296f5b))[_0x1ad5('0x54')](handleError(_0x3b1d39,null));};exports[_0x1ad5('0x55')]=function(_0x28ee60,_0x3337e6){var _0x50949b={'raw':![],'where':{'id':_0x28ee60['params']['id']}},_0x495148={};_0x495148[_0x1ad5('0x42')]=_[_0x1ad5('0x44')](db[_0x1ad5('0x3d')][_0x1ad5('0x3e')]);_0x495148[_0x1ad5('0x43')]=_['keys'](_0x28ee60[_0x1ad5('0x43')]);_0x495148[_0x1ad5('0x45')]=_[_0x1ad5('0x46')](_0x495148[_0x1ad5('0x42')],_0x495148[_0x1ad5('0x43')]);_0x50949b[_0x1ad5('0x47')]=_[_0x1ad5('0x46')](_0x495148['model'],qs['fields'](_0x28ee60[_0x1ad5('0x43')][_0x1ad5('0x48')]));_0x50949b[_0x1ad5('0x47')]=_0x50949b[_0x1ad5('0x47')][_0x1ad5('0x49')]?_0x50949b[_0x1ad5('0x47')]:_0x495148[_0x1ad5('0x42')];if(_0x28ee60['query'][_0x1ad5('0x50')]){_0x50949b[_0x1ad5('0x51')]=[{'all':!![]}];}_0x50949b=_[_0x1ad5('0x4f')]({},_0x50949b,_0x28ee60[_0x1ad5('0x56')]);return db[_0x1ad5('0x3d')][_0x1ad5('0x35')](_0x50949b)[_0x1ad5('0x38')](handleEntityNotFound(_0x3337e6,null))['then'](respondWithResult(_0x3337e6,null))['catch'](handleError(_0x3337e6,null));};exports['destroy']=function(_0x2a905f,_0x1a66af){return db[_0x1ad5('0x3d')]['find']({'where':{'id':_0x2a905f[_0x1ad5('0x57')]['id']}})[_0x1ad5('0x38')](handleEntityNotFound(_0x1a66af,null))[_0x1ad5('0x38')](removeEntity(_0x1a66af,null))['catch'](handleError(_0x1a66af,null));};exports[_0x1ad5('0x58')]=function(_0x5acd5b,_0x373d8b){if(_0x5acd5b['body'][_0x1ad5('0x40')]===_0x1ad5('0x2f')&&!_[_0x1ad5('0x59')](_0x5acd5b['body'][_0x1ad5('0x5a')],'_')){_0x5acd5b[_0x1ad5('0x5b')][_0x1ad5('0x5a')]='_'[_0x1ad5('0x5c')](_0x5acd5b[_0x1ad5('0x5b')][_0x1ad5('0x5a')]);}return db['VoiceExtension'][_0x1ad5('0x58')](_0x5acd5b[_0x1ad5('0x5b')],{'raw':![]})[_0x1ad5('0x38')](function(_0x25c759){var _0x4c66ed=_0x5acd5b['user'][_0x1ad5('0x2b')]({'plain':!![]});if(!_0x4c66ed)throw new Error(_0x1ad5('0x5d'));if(_0x4c66ed['role']===_0x1ad5('0x5e')){var _0x3d587b=_0x25c759['get']({'plain':!![]});var _0x3973ed=[{'name':_0x1ad5('0x2c'),'value':_0x1ad5('0x2d')},{'name':_0x1ad5('0x2e'),'value':_0x1ad5('0x2f')},{'name':_0x1ad5('0x5f'),'value':_0x1ad5('0x60')}];var _0x337cbc=_[_0x1ad5('0x35')](_0x3973ed,[_0x1ad5('0x33'),_0x3d587b[_0x1ad5('0x40')]])['name'];return db[_0x1ad5('0x61')]['find']({'where':{'name':_0x337cbc,'userProfileId':_0x4c66ed[_0x1ad5('0x62')]},'raw':!![]})['then'](function(_0x163b80){if(_0x163b80&&_0x163b80[_0x1ad5('0x63')]===0x0){return db[_0x1ad5('0x37')][_0x1ad5('0x58')]({'name':_0x3d587b['name'],'resourceId':_0x3d587b['id'],'type':_0x163b80[_0x1ad5('0x36')],'sectionId':_0x163b80['id']},{})['then'](function(){return _0x25c759;});}else{return _0x25c759;}})[_0x1ad5('0x54')](function(_0x30d51d){logger[_0x1ad5('0x39')](_0x1ad5('0x64'),_0x30d51d);throw _0x30d51d;});}return _0x25c759;})[_0x1ad5('0x38')](respondWithResult(_0x373d8b,0xc9))[_0x1ad5('0x54')](handleError(_0x373d8b,null));};exports[_0x1ad5('0x29')]=function(_0x549786,_0x6a734a){if(_0x549786['body']['id']){delete _0x549786[_0x1ad5('0x5b')]['id'];}return db[_0x1ad5('0x3d')][_0x1ad5('0x35')]({'where':{'id':_0x549786[_0x1ad5('0x57')]['id']}})[_0x1ad5('0x38')](handleEntityNotFound(_0x6a734a,null))['then'](function(_0x55b147){if(_0x55b147){return db[_0x1ad5('0x3d')][_0x1ad5('0x29')](_['pick'](_0x549786[_0x1ad5('0x5b')],[_0x1ad5('0x5a'),_0x1ad5('0x65'),_0x1ad5('0x66'),_0x1ad5('0x67'),_0x1ad5('0x68'),_0x1ad5('0x69'),_0x1ad5('0x6a')]),{'where':{'context':_0x55b147[_0x1ad5('0x65')],'exten':_0x55b147[_0x1ad5('0x5a')]},'individualHooks':!![]})[_0x1ad5('0x38')](function(_0x53fd7c){return _0x53fd7c;});}return null;})['then'](respondWithStatusCode(_0x6a734a,null))[_0x1ad5('0x54')](handleError(_0x6a734a,null));};exports['addApplications']=function(_0x88cec8,_0x25f198){return db[_0x1ad5('0x3d')][_0x1ad5('0x6b')]({'where':{'id':_0x88cec8[_0x1ad5('0x57')]['id']}})['then'](function(_0x12287b){if(_0x12287b){return db[_0x1ad5('0x6c')][_0x1ad5('0x6d')](function(_0x4e530a){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x88cec8[_0x1ad5('0x57')]['id']},'transaction':_0x4e530a})[_0x1ad5('0x38')](function(){var _0x1bf06b=_[_0x1ad5('0x32')](_0x88cec8['body'],function(_0x3cb501){_0x3cb501[_0x1ad5('0x6e')]=_0x88cec8[_0x1ad5('0x57')]['id'];_0x3cb501[_0x1ad5('0x6f')]=!![];return _0x3cb501;});var _0x5b3ab9=_0x88cec8[_0x1ad5('0x43')][_0x1ad5('0x70')]&&_0x88cec8[_0x1ad5('0x43')][_0x1ad5('0x70')]['toLowerCase']()===_0x1ad5('0x71')?!![]:![];return _0x12287b['createRouting'](_0x1bf06b,_0x5b3ab9);})[_0x1ad5('0x38')](function(_0x1d22e6){return db[_0x1ad5('0x3d')][_0x1ad5('0x72')](_0x1d22e6,{'transaction':_0x4e530a});});})[_0x1ad5('0x38')](function(){return db['VoiceExtension'][_0x1ad5('0x73')]({'where':{'isApp':!![],'VoiceExtensionId':_0x88cec8[_0x1ad5('0x57')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x1ad5('0x38')](respondWithResult(_0x25f198,null))[_0x1ad5('0x54')](handleError(_0x25f198,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ff405cc..74113eb 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 _0xd656=['update','emit','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners'];(function(_0x47fc3d,_0xa3bda1){var _0x265da7=function(_0x181d23){while(--_0x181d23){_0x47fc3d['push'](_0x47fc3d['shift']());}};_0x265da7(++_0xa3bda1);}(_0xd656,0x19d));var _0x6d65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd656[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6d65('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x6d65('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6d65('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d65('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4315ad){return function(_0x1653f8,_0xc56b14,_0x56c128){VoiceExtensionEvents[_0x6d65('0x4')](_0x4315ad+':'+_0x1653f8['id'],_0x1653f8);VoiceExtensionEvents[_0x6d65('0x4')](_0x4315ad,_0x1653f8);_0x56c128(null);};}for(var e in events){if(events[_0x6d65('0x5')](e)){var event=events[e];VoiceExtension[_0x6d65('0x6')](e,emitEvent(event));}}module[_0x6d65('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xa953=['hook','exports','events','VoiceExtension','save','update','remove','emit','hasOwnProperty'];(function(_0x2f1171,_0x128d87){var _0x561e07=function(_0x1957d8){while(--_0x1957d8){_0x2f1171['push'](_0x2f1171['shift']());}};_0x561e07(++_0x128d87);}(_0xa953,0x185));var _0x3a95=function(_0x356312,_0x4e93b7){_0x356312=_0x356312-0x0;var _0x1b1055=_0xa953[_0x356312];return _0x1b1055;};'use strict';var EventEmitter=require(_0x3a95('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x3a95('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a95('0x2'),'afterUpdate':_0x3a95('0x3'),'afterDestroy':_0x3a95('0x4')};function emitEvent(_0xad3234){return function(_0x1d8d0c,_0x49c80b,_0x4bae5c){VoiceExtensionEvents[_0x3a95('0x5')](_0xad3234+':'+_0x1d8d0c['id'],_0x1d8d0c);VoiceExtensionEvents[_0x3a95('0x5')](_0xad3234,_0x1d8d0c);_0x4bae5c(null);};}for(var e in events){if(events[_0x3a95('0x6')](e)){var event=events[e];VoiceExtension[_0x3a95('0x7')](e,emitEvent(event));}}module[_0x3a95('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 4f0c279..35aa46a 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 _0xf95b=['url','split','length','param','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','findAll','interval','then','*,*,*,*','intervals','IntervalId','map','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','answer','queue','includes','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','define','VoiceExtension','voice_extensions','concat','Hangup','util','lodash','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout'];(function(_0x1fb66c,_0x5b49a9){var _0x4ddeeb=function(_0x3f29b0){while(--_0x3f29b0){_0x1fb66c['push'](_0x1fb66c['shift']());}};_0x4ddeeb(++_0x5b49a9);}(_0xf95b,0x7f));var _0xbf95=function(_0x2f3168,_0x1ee88a){_0x2f3168=_0x2f3168-0x0;var _0x1fa716=_0xf95b[_0x2f3168];return _0x1fa716;};'use strict';var util=require(_0xbf95('0x0'));var _=require(_0xbf95('0x1'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x449771){var _0x540b19=_0x449771['models'];function _0x218f53(_0x33135b){var _0x370e97=0x2;var _0x33d5ce=[{'type':_0x33135b[_0xbf95('0x2')],'app':_0xbf95('0x3'),'appdata':_0xbf95('0x4')+_0x33135b['type'],'context':_0x33135b[_0xbf95('0x5')],'exten':_0x33135b[_0xbf95('0x6')],'priority':_0x370e97++,'VoiceExtensionId':_0x33135b['id']},{'type':_0x33135b['type'],'app':_0x33135b[_0xbf95('0x7')]?_0xbf95('0x3'):'NoOp','appdata':_0x33135b[_0xbf95('0x7')]?_0xbf95('0x8')+_0x33135b[_0xbf95('0x7')]:_0xbf95('0x9'),'context':_0x33135b[_0xbf95('0x5')],'exten':_0x33135b[_0xbf95('0x6')],'priority':_0x370e97++,'VoiceExtensionId':_0x33135b['id']}];if(_0x33135b[_0xbf95('0x2')]===_0xbf95('0xa')){_0x33d5ce['push']({'type':_0xbf95('0xa'),'app':_0xbf95('0x3'),'appdata':_0xbf95('0xb')+_0x33135b['id'],'context':_0x33135b[_0xbf95('0x5')],'exten':_0x33135b[_0xbf95('0x6')],'priority':_0x370e97++,'VoiceExtensionId':_0x33135b['id']});}_0x33d5ce[_0xbf95('0xc')]({'type':_0x33135b['type'],'app':'Set','appdata':_0xbf95('0xd'),'context':_0x33135b['context'],'exten':_0x33135b[_0xbf95('0x6')],'priority':_0x370e97++,'VoiceExtensionId':_0x33135b['id']},{'type':_0x33135b[_0xbf95('0x2')],'app':_0xbf95('0x3'),'appdata':_0xbf95('0xe'),'context':_0x33135b[_0xbf95('0x5')],'exten':_0x33135b['exten'],'priority':_0x370e97++,'VoiceExtensionId':_0x33135b['id']},{'type':_0x33135b[_0xbf95('0x2')],'app':_0xbf95('0x3'),'appdata':_0xbf95('0xf'),'context':_0x33135b['context'],'exten':_0x33135b[_0xbf95('0x6')],'priority':_0x370e97++,'VoiceExtensionId':_0x33135b['id']});return _0x33d5ce;}function _0x3f83b7(_0x32e1c5){var _0x6a82a2=0x2;var _0x1ea68e=[{'type':_0xbf95('0x10'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':_0xbf95('0x10'),'app':_0x32e1c5['alias']?_0xbf95('0x3'):_0xbf95('0x11'),'appdata':_0x32e1c5[_0xbf95('0x7')]?_0xbf95('0x8')+_0x32e1c5['alias']:'No\x20alias\x20set','context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':_0xbf95('0x10'),'app':_0xbf95('0x3'),'appdata':_0xbf95('0x12')+(_0x32e1c5[_0xbf95('0x13')]?_0xbf95('0x14')+_0x32e1c5['cutdigits']+'}':_0xbf95('0x15')),'context':_0x32e1c5['context'],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':'outbound','app':_0xbf95('0x3'),'appdata':_0xbf95('0xb')+_0x32e1c5['id'],'context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':_0xbf95('0x10'),'app':'ExecIf','appdata':_0xbf95('0x16')+(_0x6a82a2+0x2)+_0xbf95('0x17')+(_0x6a82a2+0x1)+')','context':_0x32e1c5['context'],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':_0xbf95('0x10'),'app':_0xbf95('0x3'),'appdata':_0x32e1c5[_0xbf95('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x32e1c5[_0xbf95('0x13')]+'}':_0xbf95('0x18'),'context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':_0xbf95('0x10'),'app':_0xbf95('0x3'),'appdata':_0xbf95('0xd'),'context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':'outbound','app':_0xbf95('0x3'),'appdata':_0xbf95('0xe'),'context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5['exten'],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':'outbound','app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':_0xbf95('0x10'),'app':_0xbf95('0x3'),'appdata':_0xbf95('0x19')+_0x32e1c5['id'],'context':_0x32e1c5['context'],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']}];if(_0x32e1c5['hasOwnProperty'](_0xbf95('0x1a'))&&_0x32e1c5['recordingFormat']!==_0xbf95('0x1b')){_0x1ea68e[_0xbf95('0xc')]({'type':'outbound','app':_0xbf95('0x3'),'appdata':_0xbf95('0x1c'),'context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5['exten'],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']},{'type':_0xbf95('0x10'),'app':_0xbf95('0x3'),'appdata':_0xbf95('0x1d')+_0x32e1c5[_0xbf95('0x1a')]||_0xbf95('0x1e'),'context':_0x32e1c5[_0xbf95('0x5')],'exten':_0x32e1c5[_0xbf95('0x6')],'priority':_0x6a82a2++,'VoiceExtensionId':_0x32e1c5['id']});}return _0x1ea68e;}function _0x40ae62(_0x3044ff){var _0x430ea9=[{'name':_0xbf95('0x1f'),'param':0x0},{'name':_0xbf95('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0xbf95('0x21'),'param':0x3}];var _0x3ebdc4={};var _0x139b0f=_0x3044ff[_0xbf95('0x22')](',');var _0x1f0c68=[];for(var _0x3067b5=0x0;_0x3067b5<_0x430ea9[_0xbf95('0x23')];_0x3067b5++){switch(_0x430ea9[_0x3067b5]['name']){case'trunk':_0x3ebdc4[_0xbf95('0x1f')]=_0x139b0f[_0x430ea9[_0x3067b5][_0xbf95('0x24')]][_0xbf95('0x22')]('/')[0x1];_0x3ebdc4[_0xbf95('0x25')]=_0x139b0f[_0x430ea9[_0x3067b5][_0xbf95('0x24')]][_0xbf95('0x22')]('/')[0x2];_0x3ebdc4[_0xbf95('0x26')]=_0x3ebdc4['phone']?_0x3ebdc4[_0xbf95('0x25')][_0xbf95('0x22')]('$')[0x0]:undefined;_0x3ebdc4[_0xbf95('0x25')]=route['cutdigits']?(_0x3ebdc4[_0xbf95('0x26')]||'')+'${EXTEN:'+route[_0xbf95('0x13')]+'}':(_0x3ebdc4[_0xbf95('0x26')]||'')+_0xbf95('0x15');_0x1f0c68[_0x430ea9[_0x3067b5][_0xbf95('0x24')]]=[_0xbf95('0x27'),_0x3ebdc4[_0xbf95('0x1f')],_0x3ebdc4[_0xbf95('0x25')]][_0xbf95('0x28')]('/');break;case'options':_0x3ebdc4[_0xbf95('0x29')]=_0x139b0f[_0x430ea9[_0x3067b5][_0xbf95('0x24')]];if(route[_0xbf95('0x1a')]!==_0xbf95('0x1b')){if(_0x3ebdc4[_0xbf95('0x29')][_0xbf95('0x2a')](_0xbf95('0x2b'))<0x0){_0x3ebdc4[_0xbf95('0x29')]+=_0xbf95('0x2b');}}else{_0x3ebdc4[_0xbf95('0x29')]=_0x3ebdc4['options'][_0xbf95('0x2c')](_0xbf95('0x2b'),'');}_0x1f0c68[_0x430ea9[_0x3067b5][_0xbf95('0x24')]]=_0x3ebdc4[_0xbf95('0x29')];break;default:_0x1f0c68[_0x430ea9[_0x3067b5]['param']]=_0x139b0f[_0x430ea9[_0x3067b5][_0xbf95('0x24')]];}}return _0x1f0c68['join'](',');}function _0xb227a6(_0x5ef80,_0x1524c1,_0x524e51,_0xeae81e){return new Promise(function(_0x1212f4,_0x4ad588){var _0x39d3e0=[];if(_['isEmpty'](_0x1524c1))return _0x1212f4(_0x39d3e0);_0x540b19['Interval'][_0xbf95('0x2d')]({'attributes':['id',_0xbf95('0x2e'),'IntervalId'],'raw':!![]})[_0xbf95('0x2f')](function(_0x574bb3){for(var _0x1eb466=0x0,_0x16f200=0x0;_0x1eb466<_0x1524c1[_0xbf95('0x23')];_0x1eb466++,_0x16f200=0x0){var _0x356ec9=_0x1524c1[_0x1eb466];var _0x407bd5=[];var _0x2c6654=[];if(_0x356ec9['interval']!==_0xbf95('0x30')){_0x356ec9[_0xbf95('0x31')]=[_0x356ec9['interval']];}else{_0x356ec9[_0xbf95('0x31')]=_0x356ec9[_0xbf95('0x32')]?_[_0xbf95('0x33')](_[_0xbf95('0x34')](_0x574bb3,{'IntervalId':_0x356ec9['IntervalId']}),_0xbf95('0x2e')):[];}_0x356ec9[_0xbf95('0x5')]=_0x5ef80[_0xbf95('0x5')];_0x356ec9[_0xbf95('0x6')]=_0x5ef80[_0xbf95('0x6')];if(_0x356ec9[_0xbf95('0x2')])_0x356ec9[_0xbf95('0x2')]=_0x356ec9[_0xbf95('0x2')]['toLowerCase']();if(_0x5ef80[_0xbf95('0x2')]==='outbound'){if(_0x356ec9[_0xbf95('0x35')](_0xbf95('0x36'))&&_0x356ec9[_0xbf95('0x36')]&&_0x356ec9[_0xbf95('0x36')]!=='--'){_0x407bd5[_0xbf95('0xc')]({'type':_0x356ec9[_0xbf95('0x2')][_0xbf95('0x37')](),'app':'Set','appdata':_0xbf95('0x38')+_0x356ec9['tag'],'context':_0x5ef80[_0xbf95('0x5')],'exten':_0x5ef80['exten'],'priority':_0x356ec9['intervals'][_0xbf95('0x23')]+_0x524e51+_0x16f200++,'VoiceExtensionId':_0x5ef80['id']});}_0x407bd5[_0xbf95('0xc')]({'type':_0x356ec9[_0xbf95('0x2')][_0xbf95('0x37')](),'app':_0xbf95('0x39'),'appdata':_0xbf95('0x3a')+(_0x356ec9['callerID']?_0xbf95('0x3b')+_0x356ec9['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x5ef80[_0xbf95('0x5')],'exten':_0x5ef80[_0xbf95('0x6')],'priority':_0x356ec9['intervals']['length']+_0x524e51+_0x16f200++,'VoiceExtensionId':_0x5ef80['id']});}else{if(_0x356ec9[_0xbf95('0x35')](_0xbf95('0x3c'))){if([_0xbf95('0x3d'),'playback'][_0xbf95('0x3e')](_0x356ec9['app'][_0xbf95('0x37')]())&&_0x356ec9['appType']!==_0xbf95('0x3f')){if(_0x356ec9[_0xbf95('0x3c')]){_0x407bd5[_0xbf95('0xc')]({'type':_0x356ec9[_0xbf95('0x2')][_0xbf95('0x37')](),'app':'ExecIf','appdata':_0xbf95('0x40'),'context':_0x5ef80[_0xbf95('0x5')],'exten':_0x5ef80['exten'],'priority':_0x356ec9['intervals'][_0xbf95('0x23')]+_0x524e51+_0x16f200++,'VoiceExtensionId':_0x5ef80['id']});_0x407bd5[_0xbf95('0xc')]({'type':_0x356ec9[_0xbf95('0x2')][_0xbf95('0x37')](),'app':_0xbf95('0x3'),'appdata':_0xbf95('0x41'),'context':_0x5ef80[_0xbf95('0x5')],'exten':_0x5ef80[_0xbf95('0x6')],'priority':_0x356ec9['intervals'][_0xbf95('0x23')]+_0x524e51+_0x16f200++,'VoiceExtensionId':_0x5ef80['id']});}else{_0x407bd5['push']({'type':_0x356ec9[_0xbf95('0x2')][_0xbf95('0x37')](),'app':_0xbf95('0x39'),'appdata':_0xbf95('0x42'),'context':_0x5ef80['context'],'exten':_0x5ef80['exten'],'priority':_0x356ec9[_0xbf95('0x31')][_0xbf95('0x23')]+_0x524e51+_0x16f200++,'VoiceExtensionId':_0x5ef80['id']});_0x407bd5[_0xbf95('0xc')]({'type':_0x356ec9[_0xbf95('0x2')]['toLowerCase'](),'app':_0xbf95('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5ef80['context'],'exten':_0x5ef80[_0xbf95('0x6')],'priority':_0x356ec9[_0xbf95('0x31')]['length']+_0x524e51+_0x16f200++,'VoiceExtensionId':_0x5ef80['id']});}}}}for(var _0x5b480f=0x0;_0x5b480f<_0x356ec9[_0xbf95('0x31')][_0xbf95('0x23')];_0x5b480f++){var _0x13a03e=_0x524e51+_0x356ec9[_0xbf95('0x31')][_0xbf95('0x23')];var _0x40bb92=_0x5b480f===_0x356ec9[_0xbf95('0x31')][_0xbf95('0x23')]-0x1?_0x524e51+_0x407bd5[_0xbf95('0x23')]+_0x2c6654[_0xbf95('0x23')]+0x2:_0x524e51+_0x5b480f+0x1;_0x407bd5[_0xbf95('0x43')](_0x5b480f,0x0,{'type':_0x5ef80[_0xbf95('0x2')],'app':_0xbf95('0x44'),'appdata':_0x356ec9[_0xbf95('0x31')][_0x5b480f]+'?'+_0x5ef80[_0xbf95('0x5')]+_0xbf95('0x45')+_0x13a03e+':'+_0x5ef80[_0xbf95('0x5')]+_0xbf95('0x45')+_0x40bb92,'exten':_0x5ef80[_0xbf95('0x6')],'context':_0x5ef80[_0xbf95('0x5')],'priority':_0x524e51+_0x5b480f,'VoiceExtensionId':_0x5ef80['id']});}if(_0xeae81e&&_0x356ec9[_0xbf95('0x46')]===_0xbf95('0x47'))_0x356ec9[_0xbf95('0x48')]=_0x40ae62(_0x356ec9['appdata']);_0x356ec9[_0xbf95('0x49')]=_0x407bd5['length']?_[_0xbf95('0x4a')](_0x407bd5)[_0xbf95('0x49')]+0x1:_0x524e51;_0x39d3e0=_['concat'](_0x39d3e0,_0x407bd5,[_0x356ec9],_0x2c6654);_0x524e51=_[_0xbf95('0x4a')](_0x39d3e0)[_0xbf95('0x49')]+0x1;}return _0x1212f4(_0x39d3e0);})['catch'](function(_0x4dd395){_0x4ad588(_0x4dd395);});});}return _0x449771[_0xbf95('0x4b')](_0xbf95('0x4c'),attributes,{'tableName':_0xbf95('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b9dbc,_0x36fd86){var _0x38a3a3=this;var _0x21da8f=_0x38a3a3[_0xbf95('0x2')]===_0xbf95('0x10')?_0x3f83b7(_0x38a3a3):_0x218f53(_0x38a3a3);return _0xb227a6(_0x38a3a3,_0x5b9dbc,_['last'](_0x21da8f)[_0xbf95('0x49')]+0x1,_0x36fd86)[_0xbf95('0x2f')](function(_0x37c5bb){var _0x1f3521=_[_0xbf95('0x4e')](_0x21da8f,_0x37c5bb);_0x1f3521['push']({'type':_0x38a3a3[_0xbf95('0x2')],'app':_0xbf95('0x4f'),'exten':_0x38a3a3[_0xbf95('0x6')],'context':_0x38a3a3[_0xbf95('0x5')],'priority':_['last'](_0x1f3521)[_0xbf95('0x49')]+0x1,'VoiceExtensionId':_0x38a3a3['id']});return _0x1f3521;});}}});}; \ No newline at end of file +var _0x0856=['findAll','IntervalId','interval','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','then','Hangup','util','lodash','./voiceExtension.attributes','exports','Set','CDR(type)=','type','exten','alias','NoOp','CDR(routeAlias)=','context','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','options','url','split','length','name','phone','param','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval'];(function(_0x34dbee,_0xd05127){var _0x15f119=function(_0x30f380){while(--_0x30f380){_0x34dbee['push'](_0x34dbee['shift']());}};_0x15f119(++_0xd05127);}(_0x0856,0x76));var _0x6085=function(_0x3568c1,_0x531895){_0x3568c1=_0x3568c1-0x0;var _0x3ced8b=_0x0856[_0x3568c1];return _0x3ced8b;};'use strict';var util=require(_0x6085('0x0'));var _=require(_0x6085('0x1'));var attributes=require(_0x6085('0x2'));module[_0x6085('0x3')]=function(_0x3ce723){var _0x5b41c0=_0x3ce723['models'];function _0x2db8df(_0x4da8d3){var _0x5e4a27=0x2;var _0x58a9f5=[{'type':_0x4da8d3['type'],'app':_0x6085('0x4'),'appdata':_0x6085('0x5')+_0x4da8d3[_0x6085('0x6')],'context':_0x4da8d3['context'],'exten':_0x4da8d3[_0x6085('0x7')],'priority':_0x5e4a27++,'VoiceExtensionId':_0x4da8d3['id']},{'type':_0x4da8d3['type'],'app':_0x4da8d3[_0x6085('0x8')]?_0x6085('0x4'):_0x6085('0x9'),'appdata':_0x4da8d3[_0x6085('0x8')]?_0x6085('0xa')+_0x4da8d3[_0x6085('0x8')]:'No\x20alias\x20set','context':_0x4da8d3[_0x6085('0xb')],'exten':_0x4da8d3[_0x6085('0x7')],'priority':_0x5e4a27++,'VoiceExtensionId':_0x4da8d3['id']}];if(_0x4da8d3['type']===_0x6085('0xc')){_0x58a9f5['push']({'type':_0x6085('0xc'),'app':_0x6085('0x4'),'appdata':_0x6085('0xd')+_0x4da8d3['id'],'context':_0x4da8d3['context'],'exten':_0x4da8d3[_0x6085('0x7')],'priority':_0x5e4a27++,'VoiceExtensionId':_0x4da8d3['id']});}_0x58a9f5[_0x6085('0xe')]({'type':_0x4da8d3[_0x6085('0x6')],'app':_0x6085('0x4'),'appdata':_0x6085('0xf'),'context':_0x4da8d3[_0x6085('0xb')],'exten':_0x4da8d3['exten'],'priority':_0x5e4a27++,'VoiceExtensionId':_0x4da8d3['id']},{'type':_0x4da8d3[_0x6085('0x6')],'app':_0x6085('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4da8d3[_0x6085('0xb')],'exten':_0x4da8d3[_0x6085('0x7')],'priority':_0x5e4a27++,'VoiceExtensionId':_0x4da8d3['id']},{'type':_0x4da8d3[_0x6085('0x6')],'app':_0x6085('0x4'),'appdata':_0x6085('0x10'),'context':_0x4da8d3[_0x6085('0xb')],'exten':_0x4da8d3[_0x6085('0x7')],'priority':_0x5e4a27++,'VoiceExtensionId':_0x4da8d3['id']});return _0x58a9f5;}function _0x5226b0(_0x4da75a){var _0x149b4b=0x2;var _0xe2c485=[{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':'CDR(type)=outbound','context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x4da75a['alias']?_0x6085('0x4'):_0x6085('0x9'),'appdata':_0x4da75a[_0x6085('0x8')]?_0x6085('0xa')+_0x4da75a[_0x6085('0x8')]:_0x6085('0x12'),'context':_0x4da75a['context'],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':_0x6085('0x13')+(_0x4da75a['cutdigits']?_0x6085('0x14')+_0x4da75a[_0x6085('0x15')]+'}':_0x6085('0x16')),'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':_0x6085('0xd')+_0x4da75a['id'],'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x17'),'appdata':_0x6085('0x18')+(_0x149b4b+0x2)+_0x6085('0x19')+(_0x149b4b+0x1)+')','context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a['exten'],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':'outbound','app':_0x6085('0x4'),'appdata':_0x4da75a[_0x6085('0x15')]?_0x6085('0x1a')+_0x4da75a['cutdigits']+'}':_0x6085('0x1b'),'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a['exten'],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':_0x6085('0xf'),'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4da75a['context'],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':_0x6085('0x10'),'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':_0x6085('0x1c')+_0x4da75a['id'],'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']}];if(_0x4da75a['hasOwnProperty']('recordingFormat')&&_0x4da75a['recordingFormat']!=='none'){_0xe2c485[_0x6085('0xe')]({'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':_0x6085('0x1d'),'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a[_0x6085('0x7')],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']},{'type':_0x6085('0x11'),'app':_0x6085('0x4'),'appdata':_0x6085('0x1e')+_0x4da75a[_0x6085('0x1f')]||_0x6085('0x20'),'context':_0x4da75a[_0x6085('0xb')],'exten':_0x4da75a['exten'],'priority':_0x149b4b++,'VoiceExtensionId':_0x4da75a['id']});}return _0xe2c485;}function _0x22089d(_0x579f18){var _0x4cbcc=[{'name':_0x6085('0x21'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x6085('0x22'),'param':0x2},{'name':_0x6085('0x23'),'param':0x3}];var _0x188a21={};var _0x34825a=_0x579f18[_0x6085('0x24')](',');var _0x138201=[];for(var _0x13b12d=0x0;_0x13b12d<_0x4cbcc[_0x6085('0x25')];_0x13b12d++){switch(_0x4cbcc[_0x13b12d][_0x6085('0x26')]){case _0x6085('0x21'):_0x188a21[_0x6085('0x21')]=_0x34825a[_0x4cbcc[_0x13b12d]['param']][_0x6085('0x24')]('/')[0x1];_0x188a21[_0x6085('0x27')]=_0x34825a[_0x4cbcc[_0x13b12d][_0x6085('0x28')]][_0x6085('0x24')]('/')[0x2];_0x188a21[_0x6085('0x29')]=_0x188a21['phone']?_0x188a21['phone'][_0x6085('0x24')]('$')[0x0]:undefined;_0x188a21['phone']=route['cutdigits']?(_0x188a21[_0x6085('0x29')]||'')+_0x6085('0x14')+route[_0x6085('0x15')]+'}':(_0x188a21['prefix']||'')+_0x6085('0x16');_0x138201[_0x4cbcc[_0x13b12d][_0x6085('0x28')]]=[_0x6085('0x2a'),_0x188a21[_0x6085('0x21')],_0x188a21[_0x6085('0x27')]][_0x6085('0x2b')]('/');break;case _0x6085('0x22'):_0x188a21[_0x6085('0x22')]=_0x34825a[_0x4cbcc[_0x13b12d]['param']];if(route[_0x6085('0x1f')]!==_0x6085('0x2c')){if(_0x188a21[_0x6085('0x22')][_0x6085('0x2d')](_0x6085('0x2e'))<0x0){_0x188a21[_0x6085('0x22')]+=_0x6085('0x2e');}}else{_0x188a21[_0x6085('0x22')]=_0x188a21['options'][_0x6085('0x2f')](_0x6085('0x2e'),'');}_0x138201[_0x4cbcc[_0x13b12d]['param']]=_0x188a21[_0x6085('0x22')];break;default:_0x138201[_0x4cbcc[_0x13b12d][_0x6085('0x28')]]=_0x34825a[_0x4cbcc[_0x13b12d]['param']];}}return _0x138201[_0x6085('0x2b')](',');}function _0x4a50d0(_0x115856,_0x464c6f,_0x3e5f3a,_0x4cdcf6){return new Promise(function(_0x110bc8,_0x316126){var _0x10dda1=[];if(_[_0x6085('0x30')](_0x464c6f))return _0x110bc8(_0x10dda1);_0x5b41c0[_0x6085('0x31')][_0x6085('0x32')]({'attributes':['id','interval',_0x6085('0x33')],'raw':!![]})['then'](function(_0xb8f9e5){for(var _0x52e15a=0x0,_0x3a2b83=0x0;_0x52e15a<_0x464c6f[_0x6085('0x25')];_0x52e15a++,_0x3a2b83=0x0){var _0x45ff60=_0x464c6f[_0x52e15a];var _0x559f59=[];var _0x5616bb=[];if(_0x45ff60[_0x6085('0x34')]!==_0x6085('0x35')){_0x45ff60[_0x6085('0x36')]=[_0x45ff60[_0x6085('0x34')]];}else{_0x45ff60[_0x6085('0x36')]=_0x45ff60['IntervalId']?_[_0x6085('0x37')](_[_0x6085('0x38')](_0xb8f9e5,{'IntervalId':_0x45ff60[_0x6085('0x33')]}),_0x6085('0x34')):[];}_0x45ff60[_0x6085('0xb')]=_0x115856[_0x6085('0xb')];_0x45ff60[_0x6085('0x7')]=_0x115856['exten'];if(_0x45ff60[_0x6085('0x6')])_0x45ff60['type']=_0x45ff60[_0x6085('0x6')][_0x6085('0x39')]();if(_0x115856[_0x6085('0x6')]==='outbound'){if(_0x45ff60[_0x6085('0x3a')](_0x6085('0x3b'))&&_0x45ff60[_0x6085('0x3b')]&&_0x45ff60['tag']!=='--'){_0x559f59[_0x6085('0xe')]({'type':_0x45ff60[_0x6085('0x6')]['toLowerCase'](),'app':_0x6085('0x4'),'appdata':'CDR(tag)='+_0x45ff60[_0x6085('0x3b')],'context':_0x115856[_0x6085('0xb')],'exten':_0x115856[_0x6085('0x7')],'priority':_0x45ff60[_0x6085('0x36')][_0x6085('0x25')]+_0x3e5f3a+_0x3a2b83++,'VoiceExtensionId':_0x115856['id']});}_0x559f59[_0x6085('0xe')]({'type':_0x45ff60['type'][_0x6085('0x39')](),'app':'ExecIf','appdata':_0x6085('0x3c')+(_0x45ff60[_0x6085('0x3d')]?'Set(CALLERID(all)='+_0x45ff60['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x115856['context'],'exten':_0x115856[_0x6085('0x7')],'priority':_0x45ff60[_0x6085('0x36')]['length']+_0x3e5f3a+_0x3a2b83++,'VoiceExtensionId':_0x115856['id']});}else{if(_0x45ff60[_0x6085('0x3a')](_0x6085('0x3e'))){if([_0x6085('0x3f'),_0x6085('0x40')][_0x6085('0x41')](_0x45ff60['app'][_0x6085('0x39')]())&&_0x45ff60[_0x6085('0x42')]!==_0x6085('0x43')){if(_0x45ff60[_0x6085('0x3e')]){_0x559f59[_0x6085('0xe')]({'type':_0x45ff60[_0x6085('0x6')][_0x6085('0x39')](),'app':_0x6085('0x17'),'appdata':_0x6085('0x44'),'context':_0x115856[_0x6085('0xb')],'exten':_0x115856['exten'],'priority':_0x45ff60[_0x6085('0x36')][_0x6085('0x25')]+_0x3e5f3a+_0x3a2b83++,'VoiceExtensionId':_0x115856['id']});_0x559f59[_0x6085('0xe')]({'type':_0x45ff60['type'][_0x6085('0x39')](),'app':_0x6085('0x4'),'appdata':_0x6085('0x45'),'context':_0x115856[_0x6085('0xb')],'exten':_0x115856[_0x6085('0x7')],'priority':_0x45ff60['intervals'][_0x6085('0x25')]+_0x3e5f3a+_0x3a2b83++,'VoiceExtensionId':_0x115856['id']});}else{_0x559f59[_0x6085('0xe')]({'type':_0x45ff60['type']['toLowerCase'](),'app':_0x6085('0x17'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x115856[_0x6085('0xb')],'exten':_0x115856['exten'],'priority':_0x45ff60['intervals'][_0x6085('0x25')]+_0x3e5f3a+_0x3a2b83++,'VoiceExtensionId':_0x115856['id']});_0x559f59[_0x6085('0xe')]({'type':_0x45ff60[_0x6085('0x6')][_0x6085('0x39')](),'app':_0x6085('0x4'),'appdata':_0x6085('0x46'),'context':_0x115856['context'],'exten':_0x115856[_0x6085('0x7')],'priority':_0x45ff60[_0x6085('0x36')][_0x6085('0x25')]+_0x3e5f3a+_0x3a2b83++,'VoiceExtensionId':_0x115856['id']});}}}}for(var _0x39ec8d=0x0;_0x39ec8d<_0x45ff60[_0x6085('0x36')]['length'];_0x39ec8d++){var _0x3ff0d1=_0x3e5f3a+_0x45ff60[_0x6085('0x36')]['length'];var _0x509603=_0x39ec8d===_0x45ff60[_0x6085('0x36')][_0x6085('0x25')]-0x1?_0x3e5f3a+_0x559f59[_0x6085('0x25')]+_0x5616bb[_0x6085('0x25')]+0x2:_0x3e5f3a+_0x39ec8d+0x1;_0x559f59['splice'](_0x39ec8d,0x0,{'type':_0x115856[_0x6085('0x6')],'app':_0x6085('0x47'),'appdata':_0x45ff60[_0x6085('0x36')][_0x39ec8d]+'?'+_0x115856['context']+_0x6085('0x48')+_0x3ff0d1+':'+_0x115856[_0x6085('0xb')]+_0x6085('0x48')+_0x509603,'exten':_0x115856[_0x6085('0x7')],'context':_0x115856[_0x6085('0xb')],'priority':_0x3e5f3a+_0x39ec8d,'VoiceExtensionId':_0x115856['id']});}if(_0x4cdcf6&&_0x45ff60['appType']===_0x6085('0x49'))_0x45ff60['appdata']=_0x22089d(_0x45ff60[_0x6085('0x4a')]);_0x45ff60[_0x6085('0x4b')]=_0x559f59['length']?_[_0x6085('0x4c')](_0x559f59)[_0x6085('0x4b')]+0x1:_0x3e5f3a;_0x10dda1=_[_0x6085('0x4d')](_0x10dda1,_0x559f59,[_0x45ff60],_0x5616bb);_0x3e5f3a=_['last'](_0x10dda1)[_0x6085('0x4b')]+0x1;}return _0x110bc8(_0x10dda1);})[_0x6085('0x4e')](function(_0x36c92c){_0x316126(_0x36c92c);});});}return _0x3ce723[_0x6085('0x4f')](_0x6085('0x50'),attributes,{'tableName':_0x6085('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x8ddec5,_0x420dd8){var _0x1a19e8=this;var _0x5bccd6=_0x1a19e8[_0x6085('0x6')]===_0x6085('0x11')?_0x5226b0(_0x1a19e8):_0x2db8df(_0x1a19e8);return _0x4a50d0(_0x1a19e8,_0x8ddec5,_[_0x6085('0x4c')](_0x5bccd6)[_0x6085('0x4b')]+0x1,_0x420dd8)[_0x6085('0x52')](function(_0x51034e){var _0x491c30=_['concat'](_0x5bccd6,_0x51034e);_0x491c30[_0x6085('0xe')]({'type':_0x1a19e8[_0x6085('0x6')],'app':_0x6085('0x53'),'exten':_0x1a19e8['exten'],'context':_0x1a19e8['context'],'priority':_[_0x6085('0x4c')](_0x491c30)[_0x6085('0x4b')]+0x1,'VoiceExtensionId':_0x1a19e8['id']});return _0x491c30;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e5a3b9a..34e5e9b 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 _0x7722=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','then','lodash','util'];(function(_0xe021a6,_0x14de42){var _0x30128d=function(_0x80c802){while(--_0x80c802){_0xe021a6['push'](_0xe021a6['shift']());}};_0x30128d(++_0x14de42);}(_0x7722,0x14e));var _0x2772=function(_0x30fad2,_0x2e8a02){_0x30fad2=_0x30fad2-0x0;var _0x5ee612=_0x7722[_0x30fad2];return _0x5ee612;};'use strict';var _=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var moment=require(_0x2772('0x2'));var BPromise=require(_0x2772('0x3'));var rs=require(_0x2772('0x4'));var fs=require('fs');var Redis=require(_0x2772('0x5'));var db=require(_0x2772('0x6'))['db'];var utils=require(_0x2772('0x7'));var logger=require(_0x2772('0x8'))('rpc');var config=require(_0x2772('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2772('0xa')][_0x2772('0xb')]({'port':0x232a});config[_0x2772('0xc')]=_[_0x2772('0xd')](config[_0x2772('0xc')],{'host':_0x2772('0xe'),'port':0x18eb});var socket=require(_0x2772('0xf'))(new Redis(config[_0x2772('0xc')]));require(_0x2772('0x10'))[_0x2772('0x11')](socket);function respondWithRpcPromise(_0x403c9f,_0x1903cc,_0x767c03){return new BPromise(function(_0x3789e2,_0xbba75f){return client[_0x2772('0x12')](_0x403c9f,_0x767c03)['then'](function(_0xdd6347){logger[_0x2772('0x13')](_0x2772('0x14'),_0x1903cc,'request\x20sent');logger[_0x2772('0x15')](_0x2772('0x16'),_0x1903cc,_0x2772('0x17'),JSON[_0x2772('0x18')](_0xdd6347));if(_0xdd6347[_0x2772('0x19')]){if(_0xdd6347['error'][_0x2772('0x1a')]===0x1f4){logger[_0x2772('0x19')](_0x2772('0x14'),_0x1903cc,_0xdd6347[_0x2772('0x19')]['message']);return _0xbba75f(_0xdd6347[_0x2772('0x19')]['message']);}logger[_0x2772('0x19')](_0x2772('0x14'),_0x1903cc,_0xdd6347[_0x2772('0x19')][_0x2772('0x1b')]);return _0x3789e2(_0xdd6347[_0x2772('0x19')][_0x2772('0x1b')]);}else{logger[_0x2772('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x1903cc,_0x2772('0x17'));_0x3789e2(_0xdd6347[_0x2772('0x1c')][_0x2772('0x1b')]);}})[_0x2772('0x1d')](function(_0x93f04a){logger[_0x2772('0x19')](_0x2772('0x14'),_0x1903cc,_0x93f04a);_0xbba75f(_0x93f04a);});});}exports[_0x2772('0x1e')]=function(_0x704416){var _0x3ac3b5=this;return new Promise(function(_0x50b87c,_0x51beac){return db[_0x2772('0x1f')][_0x2772('0x20')]({'raw':_0x704416[_0x2772('0x21')]?_0x704416[_0x2772('0x21')][_0x2772('0x22')]===undefined?!![]:![]:!![],'where':_0x704416['options']?_0x704416[_0x2772('0x21')][_0x2772('0x23')]||null:null,'attributes':_0x704416['options']?_0x704416['options']['attributes']||null:null,'limit':_0x704416['options']?_0x704416[_0x2772('0x21')][_0x2772('0x24')]||null:null,'include':_0x704416['options']?_0x704416[_0x2772('0x21')][_0x2772('0x25')]?_[_0x2772('0x26')](_0x704416[_0x2772('0x21')][_0x2772('0x25')],function(_0x111fdd){return{'model':db[_0x111fdd[_0x2772('0x27')]],'as':_0x111fdd['as'],'attributes':_0x111fdd[_0x2772('0x28')],'include':_0x111fdd[_0x2772('0x25')]?_[_0x2772('0x26')](_0x111fdd[_0x2772('0x25')],function(_0x32ed80){return{'model':db[_0x32ed80['model']],'as':_0x32ed80['as'],'attributes':_0x32ed80[_0x2772('0x28')],'include':_0x32ed80[_0x2772('0x25')]?_[_0x2772('0x26')](_0x32ed80[_0x2772('0x25')],function(_0x3c7dda){return{'model':db[_0x3c7dda[_0x2772('0x27')]],'as':_0x3c7dda['as'],'attributes':_0x3c7dda[_0x2772('0x28')]};}):[]};}):[]};}):[]:[]})[_0x2772('0x29')](function(_0x41b89e){logger['info']('GetVoiceExtension',_0x704416);logger[_0x2772('0x15')](_0x2772('0x1e'),_0x704416,JSON[_0x2772('0x18')](_0x41b89e));_0x50b87c(_0x41b89e);})[_0x2772('0x1d')](function(_0x47eacb){logger[_0x2772('0x19')](_0x2772('0x1e'),_0x47eacb[_0x2772('0x1b')],_0x704416);_0x51beac(_0x3ac3b5['error'](0x1f4,_0x47eacb[_0x2772('0x1b')]));});});}; \ No newline at end of file +var _0xe015=['http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','map','include','model','debug','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x27b0da,_0x8ffb2b){var _0x8eb88e=function(_0x6a0b40){while(--_0x6a0b40){_0x27b0da['push'](_0x27b0da['shift']());}};_0x8eb88e(++_0x8ffb2b);}(_0xe015,0x13b));var _0x5e01=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe015[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var moment=require(_0x5e01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e01('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e01('0x4'));var logger=require(_0x5e01('0x5'))(_0x5e01('0x6'));var config=require(_0x5e01('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5e01('0x8')][_0x5e01('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5e01('0xa')],{'host':_0x5e01('0xb'),'port':0x18eb});var socket=require(_0x5e01('0xc'))(new Redis(config[_0x5e01('0xa')]));require(_0x5e01('0xd'))[_0x5e01('0xe')](socket);function respondWithRpcPromise(_0x5b3938,_0x1c4a44,_0x502518){return new BPromise(function(_0x3859e8,_0x5be859){return client[_0x5e01('0xf')](_0x5b3938,_0x502518)[_0x5e01('0x10')](function(_0x553a53){logger[_0x5e01('0x11')](_0x5e01('0x12'),_0x1c4a44,'request\x20sent');logger['debug'](_0x5e01('0x13'),_0x1c4a44,_0x5e01('0x14'),JSON[_0x5e01('0x15')](_0x553a53));if(_0x553a53[_0x5e01('0x16')]){if(_0x553a53[_0x5e01('0x16')][_0x5e01('0x17')]===0x1f4){logger['error'](_0x5e01('0x12'),_0x1c4a44,_0x553a53['error']['message']);return _0x5be859(_0x553a53[_0x5e01('0x16')][_0x5e01('0x18')]);}logger['error'](_0x5e01('0x12'),_0x1c4a44,_0x553a53['error'][_0x5e01('0x18')]);return _0x3859e8(_0x553a53['error'][_0x5e01('0x18')]);}else{logger['info'](_0x5e01('0x12'),_0x1c4a44,'request\x20sent');_0x3859e8(_0x553a53['result'][_0x5e01('0x18')]);}})[_0x5e01('0x19')](function(_0x4fa1c7){logger[_0x5e01('0x16')](_0x5e01('0x12'),_0x1c4a44,_0x4fa1c7);_0x5be859(_0x4fa1c7);});});}exports[_0x5e01('0x1a')]=function(_0x45e543){var _0x396cf3=this;return new Promise(function(_0x35eb4e,_0x173410){return db[_0x5e01('0x1b')]['findAll']({'raw':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')][_0x5e01('0x1d')]||null:null,'attributes':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')][_0x5e01('0x1e')]||null:null,'limit':_0x45e543['options']?_0x45e543[_0x5e01('0x1c')][_0x5e01('0x1f')]||null:null,'include':_0x45e543[_0x5e01('0x1c')]?_0x45e543[_0x5e01('0x1c')]['include']?_[_0x5e01('0x20')](_0x45e543[_0x5e01('0x1c')][_0x5e01('0x21')],function(_0x4f94d0){return{'model':db[_0x4f94d0[_0x5e01('0x22')]],'as':_0x4f94d0['as'],'attributes':_0x4f94d0[_0x5e01('0x1e')],'include':_0x4f94d0[_0x5e01('0x21')]?_[_0x5e01('0x20')](_0x4f94d0['include'],function(_0x4d0ebe){return{'model':db[_0x4d0ebe[_0x5e01('0x22')]],'as':_0x4d0ebe['as'],'attributes':_0x4d0ebe['attributes'],'include':_0x4d0ebe[_0x5e01('0x21')]?_[_0x5e01('0x20')](_0x4d0ebe[_0x5e01('0x21')],function(_0xc26cf8){return{'model':db[_0xc26cf8['model']],'as':_0xc26cf8['as'],'attributes':_0xc26cf8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51a98d){logger[_0x5e01('0x11')]('GetVoiceExtension',_0x45e543);logger[_0x5e01('0x23')](_0x5e01('0x1a'),_0x45e543,JSON[_0x5e01('0x15')](_0x51a98d));_0x35eb4e(_0x51a98d);})['catch'](function(_0x393bf0){logger[_0x5e01('0x16')](_0x5e01('0x1a'),_0x393bf0[_0x5e01('0x18')],_0x45e543);_0x173410(_0x396cf3['error'](0x1f4,_0x393bf0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 92caaee..5340492 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x1c931e,_0x4c85fd){var _0x36139f=function(_0x41db51){while(--_0x41db51){_0x1c931e['push'](_0x1c931e['shift']());}};_0x36139f(++_0x4c85fd);}(_0x0295,0x1f0));var _0x5029=function(_0x4d9d1e,_0x3c2d20){_0x4d9d1e=_0x4d9d1e-0x0;var _0x1b9d54=_0x0295[_0x4d9d1e];return _0x1b9d54;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3a20d1,_0x84a0e6){_0x3a20d1=_0x3a20d1-0x0;var _0x22d5dd=_0x1cb9[_0x3a20d1];return _0x22d5dd;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 61f11ff..292de09 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x285f99,_0x2aff74){var _0x4b73fa=function(_0x4fe6b1){while(--_0x4fe6b1){_0x285f99['push'](_0x285f99['shift']());}};_0x4b73fa(++_0x2aff74);}(_0x32f4,0x154));var _0x432f=function(_0x22c393,_0x1f2389){_0x22c393=_0x22c393-0x0;var _0x161580=_0x32f4[_0x22c393];return _0x161580;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0x4c60=['exports','multer','util','path','connect-timeout','Router','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','put','update','destroy'];(function(_0x3e1475,_0x2d1904){var _0x910e81=function(_0x3e088e){while(--_0x3e088e){_0x3e1475['push'](_0x3e1475['shift']());}};_0x910e81(++_0x2d1904);}(_0x4c60,0xc1));var _0x04c6=function(_0x32c255,_0x58b34e){_0x32c255=_0x32c255-0x0;var _0x435367=_0x4c60[_0x32c255];return _0x435367;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['show']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x04c6('0xc')]('/:id',auth[_0x04c6('0x7')](),controller[_0x04c6('0xd')]);router['delete'](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xe')]);module[_0x04c6('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 09c2e35..26521ac 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 _0xbcd3=['exports','contest_mailbox','STRING','setDataValue','email','string','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','mailbox','sequelize'];(function(_0x273c51,_0x1b6292){var _0x1098f4=function(_0x222989){while(--_0x222989){_0x273c51['push'](_0x273c51['shift']());}};_0x1098f4(++_0x1b6292);}(_0xbcd3,0x13f));var _0x3bcd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbcd3[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x3bcd('0x0'));module[_0x3bcd('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0x3bcd('0x2')},'mailbox':{'type':Sequelize[_0x3bcd('0x3')],'defaultValue':'','allowNull':![],'unique':_0x3bcd('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3bcd('0x3')],'validate':{'isEmail':!![]},'set':function(_0x3d4a3f){this[_0x3bcd('0x4')](_0x3bcd('0x5'),typeof _0x3d4a3f===_0x3bcd('0x6')&&_0x3d4a3f[_0x3bcd('0x7')]()?_0x3d4a3f[_0x3bcd('0x7')]():null);}},'pager':{'type':Sequelize[_0x3bcd('0x3')]},'tz':{'type':Sequelize[_0x3bcd('0x3')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x3bcd('0x8'),'no'),'defaultValue':_0x3bcd('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3bcd('0x9')](_0x3bcd('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3bcd('0x3')]},'callback':{'type':Sequelize[_0x3bcd('0x3')]},'review':{'type':Sequelize[_0x3bcd('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3bcd('0x9')](_0x3bcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3bcd('0x9')](_0x3bcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3bcd('0x9')](_0x3bcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3bcd('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3bcd('0x9')](_0x3bcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3bcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3bcd('0x9')](_0x3bcd('0x8'),'no'),'defaultValue':_0x3bcd('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3bcd('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x3bcd('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x3bcd('0x8'),'no'),'defaultValue':_0x3bcd('0x8'),'allowNull':![]},'stamp':{'type':_0x3bcd('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3bcd('0x3')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3bcd('0xc')],'get':function(){return this[_0x3bcd('0xd')](_0x3bcd('0xe'))+'\x20-\x20'+this[_0x3bcd('0xd')](_0x3bcd('0xf'));}}}; \ No newline at end of file +var _0xa567=['mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20'];(function(_0x5d8c38,_0xed4812){var _0x400ca7=function(_0x2a74e7){while(--_0x2a74e7){_0x5d8c38['push'](_0x5d8c38['shift']());}};_0x400ca7(++_0xed4812);}(_0xa567,0x17b));var _0x7a56=function(_0x5ca746,_0x1a8e5b){_0x5ca746=_0x5ca746-0x0;var _0x4d889a=_0xa567[_0x5ca746];return _0x4d889a;};'use strict';var Sequelize=require('sequelize');module[_0x7a56('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7a56('0x1')],'defaultValue':_0x7a56('0x2'),'unique':_0x7a56('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x7a56('0x3')},'password':{'type':Sequelize[_0x7a56('0x1')]},'fullname':{'type':Sequelize[_0x7a56('0x1')]},'email':{'type':Sequelize[_0x7a56('0x1')],'validate':{'isEmail':!![]},'set':function(_0x6b4a51){this[_0x7a56('0x4')](_0x7a56('0x5'),typeof _0x6b4a51===_0x7a56('0x6')&&_0x6b4a51['trim']()?_0x6b4a51[_0x7a56('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x7a56('0x1')],'defaultValue':_0x7a56('0x8')},'attach':{'type':Sequelize[_0x7a56('0x9')]('yes','no'),'defaultValue':_0x7a56('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x7a56('0x1')]},'callback':{'type':Sequelize[_0x7a56('0x1')]},'review':{'type':Sequelize[_0x7a56('0x9')](_0x7a56('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7a56('0x9')](_0x7a56('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x7a56('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7a56('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7a56('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7a56('0x9')](_0x7a56('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7a56('0x9')](_0x7a56('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x7a56('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x7a56('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7a56('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7a56('0x9')]('yes','no'),'defaultValue':_0x7a56('0xa'),'allowNull':![]},'stamp':{'type':_0x7a56('0xc')},'emailsubject':{'type':Sequelize[_0x7a56('0x1')]},'emailbody':{'type':Sequelize[_0x7a56('0x1')]},'maxsecs':{'type':Sequelize[_0x7a56('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7a56('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7a56('0xe')],'get':function(){return this[_0x7a56('0xf')]('fullname')+_0x7a56('0x10')+this['getDataValue'](_0x7a56('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 8c8a9fd..799442a 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 _0x36ee=['set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','stack','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x144b16,_0x528837){var _0x50369d=function(_0x589ed9){while(--_0x589ed9){_0x144b16['push'](_0x144b16['shift']());}};_0x50369d(++_0x528837);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['VoiceMail'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='Voicemails';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));};exports[_0xe36e('0x54')]=function(_0x169369,_0x443154,_0x700b63){return db[_0xe36e('0x2d')][_0xe36e('0x55')]({'where':{'id':_0x169369[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x443154,null))[_0xe36e('0x26')](function(_0x56718a){var _0x2cf7fc;var _0x389e91={},_0x6f979f={};_0x6f979f[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x56')][_0xe36e('0x2e')]);_0x6f979f[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x169369[_0xe36e('0x33')]);_0x6f979f[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],_0x6f979f[_0xe36e('0x33')]);_0x389e91['attributes']=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],qs['fields'](_0x169369[_0xe36e('0x33')][_0xe36e('0x38')]));_0x389e91[_0xe36e('0x37')]=_0x389e91[_0xe36e('0x37')][_0xe36e('0x39')]?_0x389e91[_0xe36e('0x37')]:_0x6f979f['model'];if(!_0x169369[_0xe36e('0x33')]['hasOwnProperty'](_0xe36e('0x3a'))){_0x389e91[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x169369[_0xe36e('0x33')][_0xe36e('0x1e')]);_0x389e91[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x169369[_0xe36e('0x33')]['offset']);}_0x389e91[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x169369['query'][_0xe36e('0x3c')]);_0x389e91[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x169369[_0xe36e('0x33')],_0x6f979f[_0xe36e('0x35')]));if(_0x169369[_0xe36e('0x33')]['filter']){_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x389e91[_0xe36e('0x37')],function(_0x43d8c2){var _0xc1daf8={};_0xc1daf8[_0x43d8c2]={'$like':'%'+_0x169369[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0xc1daf8;})});}_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91['where'],{'mailboxuser':_0x56718a[_0xe36e('0x57')]});_0x389e91=_[_0xe36e('0x40')]({},_0x389e91,_0x169369[_0xe36e('0x48')]);return db[_0xe36e('0x56')]['findAndCountAll'](_0x389e91)['then'](respondWithFilteredResult(_0x443154,_0x389e91));})[_0xe36e('0x44')](handleError(_0x443154,null));}; \ No newline at end of file +var _0xeb74=['VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','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','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','error','stack','name','send','map'];(function(_0x31225a,_0x24d8e2){var _0x8c6bda=function(_0x4a425f){while(--_0x4a425f){_0x31225a['push'](_0x31225a['shift']());}};_0x8c6bda(++_0x24d8e2);}(_0xeb74,0xe3));var _0x4eb7=function(_0x28f8fa,_0x408f1f){_0x28f8fa=_0x28f8fa-0x0;var _0x274e18=_0xeb74[_0x28f8fa];return _0x274e18;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){var _0x2e8de8=_0x4de2d9[_0x4eb7('0x27')]({'plain':!![]});var _0x3e0da2=_0x4eb7('0x28');return db[_0x4eb7('0x29')][_0x4eb7('0x26')]({'where':{'type':_0x3e0da2,'resourceId':_0x2e8de8['id']}})[_0x4eb7('0x25')](function(){return _0x4de2d9;});})[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x2a')]();});}};}function handleEntityNotFound(_0x2d1773,_0x1b56a8){return function(_0x433794){if(!_0x433794){_0x2d1773[_0x4eb7('0x2b')](0x194);}return _0x433794;};}function handleError(_0x2be00c,_0x41e515){_0x41e515=_0x41e515||0x1f4;return function(_0x33a2c1){logger[_0x4eb7('0x2c')](_0x33a2c1[_0x4eb7('0x2d')]);if(_0x33a2c1[_0x4eb7('0x2e')]){delete _0x33a2c1[_0x4eb7('0x2e')];}_0x2be00c['status'](_0x41e515)[_0x4eb7('0x2f')](_0x33a2c1);};}exports['index']=function(_0x446872,_0x13f71a){var _0xc5aa21={},_0x1fe298={},_0x468195={'count':0x0,'rows':[]};var _0x1cec8e=_[_0x4eb7('0x30')](db[_0x4eb7('0x31')][_0x4eb7('0x32')],function(_0x4f8879){return{'name':_0x4f8879[_0x4eb7('0x33')],'type':_0x4f8879['type'][_0x4eb7('0x34')]};});_0x1fe298[_0x4eb7('0x35')]=_['map'](_0x1cec8e,'name');_0x1fe298[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x446872[_0x4eb7('0x36')]);_0x1fe298[_0x4eb7('0x38')]=_['intersection'](_0x1fe298[_0x4eb7('0x35')],_0x1fe298[_0x4eb7('0x36')]);_0xc5aa21[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x1fe298[_0x4eb7('0x35')],qs['fields'](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0xc5aa21[_0x4eb7('0x39')]=_0xc5aa21['attributes'][_0x4eb7('0x3c')]?_0xc5aa21[_0x4eb7('0x39')]:_0x1fe298[_0x4eb7('0x35')];if(!_0x446872['query'][_0x4eb7('0x3d')]('nolimit')){_0xc5aa21[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0xc5aa21['offset']=qs[_0x4eb7('0x1b')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0xc5aa21[_0x4eb7('0x3e')]=qs['sort'](_0x446872['query']['sort']);_0xc5aa21[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x446872[_0x4eb7('0x36')],_0x1fe298[_0x4eb7('0x38')]),_0x1cec8e);if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0xc5aa21[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0xc5aa21[_0x4eb7('0x3f')],{'$or':_['map'](_0x1cec8e,function(_0x5d0e51){if(_0x5d0e51[_0x4eb7('0x43')]!==_0x4eb7('0x44')){var _0x4597c8={};_0x4597c8[_0x5d0e51[_0x4eb7('0x2e')]]={'$like':'%'+_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x4597c8;}})});}_0xc5aa21=_[_0x4eb7('0x42')]({},_0xc5aa21,_0x446872[_0x4eb7('0x45')]);var _0x3a31ce={'where':_0xc5aa21[_0x4eb7('0x3f')]};return db[_0x4eb7('0x31')][_0x4eb7('0x1e')](_0x3a31ce)[_0x4eb7('0x25')](function(_0x38af1f){_0x468195[_0x4eb7('0x1e')]=_0x38af1f;if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0xc5aa21[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x31')]['findAll'](_0xc5aa21);})[_0x4eb7('0x25')](function(_0x2df542){_0x468195[_0x4eb7('0x48')]=_0x2df542;return _0x468195;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x13f71a,_0xc5aa21))[_0x4eb7('0x49')](handleError(_0x13f71a,null));};exports[_0x4eb7('0x4a')]=function(_0x3cd9e5,_0x10fac2){var _0x3d6b0b={'raw':!![],'where':{'id':_0x3cd9e5[_0x4eb7('0x4b')]['id']}},_0x4969eb={};_0x4969eb['model']=_[_0x4eb7('0x37')](db[_0x4eb7('0x31')][_0x4eb7('0x32')]);_0x4969eb['query']=_[_0x4eb7('0x37')](_0x3cd9e5[_0x4eb7('0x36')]);_0x4969eb[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x4969eb['model'],_0x4969eb[_0x4eb7('0x36')]);_0x3d6b0b['attributes']=_[_0x4eb7('0x3a')](_0x4969eb[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x3d6b0b['attributes']=_0x3d6b0b['attributes'][_0x4eb7('0x3c')]?_0x3d6b0b[_0x4eb7('0x39')]:_0x4969eb[_0x4eb7('0x35')];if(_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0x3d6b0b['include']=[{'all':!![]}];}_0x3d6b0b=_[_0x4eb7('0x42')]({},_0x3d6b0b,_0x3cd9e5[_0x4eb7('0x45')]);return db['VoiceMail'][_0x4eb7('0x4c')](_0x3d6b0b)[_0x4eb7('0x25')](handleEntityNotFound(_0x10fac2,null))['then'](respondWithResult(_0x10fac2,null))[_0x4eb7('0x49')](handleError(_0x10fac2,null));};exports[_0x4eb7('0x4d')]=function(_0x3c8049,_0x5774d5){return db[_0x4eb7('0x31')]['create'](_0x3c8049['body'],{})[_0x4eb7('0x25')](function(_0x312e9b){var _0x32d7d6=_0x3c8049[_0x4eb7('0x4e')][_0x4eb7('0x27')]({'plain':!![]});if(!_0x32d7d6)throw new Error(_0x4eb7('0x4f'));if(_0x32d7d6[_0x4eb7('0x50')]===_0x4eb7('0x4e')){var _0x2913c5=_0x312e9b[_0x4eb7('0x27')]({'plain':!![]});var _0x42a1d9=_0x4eb7('0x28');return db[_0x4eb7('0x51')][_0x4eb7('0x4c')]({'where':{'name':_0x42a1d9,'userProfileId':_0x32d7d6[_0x4eb7('0x52')]},'raw':!![]})[_0x4eb7('0x25')](function(_0x327f1e){if(_0x327f1e&&_0x327f1e[_0x4eb7('0x53')]===0x0){return db[_0x4eb7('0x29')][_0x4eb7('0x4d')]({'name':_0x2913c5['name'],'resourceId':_0x2913c5['id'],'type':_0x327f1e[_0x4eb7('0x2e')],'sectionId':_0x327f1e['id']},{})['then'](function(){return _0x312e9b;});}else{return _0x312e9b;}})['catch'](function(_0x3f3a5f){logger[_0x4eb7('0x2c')](_0x4eb7('0x54'),_0x3f3a5f);throw _0x3f3a5f;});}return _0x312e9b;})[_0x4eb7('0x25')](respondWithResult(_0x5774d5,0xc9))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports['update']=function(_0x4e3163,_0x2e5d28){if(_0x4e3163['body']['id']){delete _0x4e3163[_0x4eb7('0x55')]['id'];}return db[_0x4eb7('0x31')][_0x4eb7('0x4c')]({'where':{'id':_0x4e3163[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e5d28,null))[_0x4eb7('0x25')](saveUpdates(_0x4e3163[_0x4eb7('0x55')],null))[_0x4eb7('0x25')](respondWithResult(_0x2e5d28,null))[_0x4eb7('0x49')](handleError(_0x2e5d28,null));};exports['destroy']=function(_0x961de5,_0x340ffb){return db['VoiceMail'][_0x4eb7('0x4c')]({'where':{'id':_0x961de5[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x340ffb,null))[_0x4eb7('0x25')](removeEntity(_0x340ffb,null))['catch'](handleError(_0x340ffb,null));};exports[_0x4eb7('0x56')]=function(_0x5be4ad,_0x13847e,_0x456fe7){return db[_0x4eb7('0x31')][_0x4eb7('0x57')]({'where':{'id':_0x5be4ad[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x13847e,null))['then'](function(_0x4a4fc5){var _0x1b8514;var _0x1b4afe={},_0x24d33d={};_0x24d33d[_0x4eb7('0x35')]=_['keys'](db[_0x4eb7('0x58')][_0x4eb7('0x32')]);_0x24d33d['query']=_[_0x4eb7('0x37')](_0x5be4ad[_0x4eb7('0x36')]);_0x24d33d[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x24d33d[_0x4eb7('0x35')],_0x24d33d[_0x4eb7('0x36')]);_0x1b4afe[_0x4eb7('0x39')]=_['intersection'](_0x24d33d['model'],qs[_0x4eb7('0x3b')](_0x5be4ad['query'][_0x4eb7('0x3b')]));_0x1b4afe['attributes']=_0x1b4afe[_0x4eb7('0x39')]['length']?_0x1b4afe['attributes']:_0x24d33d[_0x4eb7('0x35')];if(!_0x5be4ad[_0x4eb7('0x36')]['hasOwnProperty'](_0x4eb7('0x59'))){_0x1b4afe['limit']=qs[_0x4eb7('0x1d')](_0x5be4ad[_0x4eb7('0x36')]['limit']);_0x1b4afe[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x5be4ad['query']['offset']);}_0x1b4afe['order']=qs['sort'](_0x5be4ad[_0x4eb7('0x36')]['sort']);_0x1b4afe[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_['pick'](_0x5be4ad[_0x4eb7('0x36')],_0x24d33d[_0x4eb7('0x38')]));if(_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x1b4afe[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x1b4afe['where'],{'$or':_['map'](_0x1b4afe['attributes'],function(_0x58d2c1){var _0x1775c4={};_0x1775c4[_0x58d2c1]={'$like':'%'+_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x1775c4;})});}_0x1b4afe[_0x4eb7('0x3f')]=_['merge'](_0x1b4afe['where'],{'mailboxuser':_0x4a4fc5[_0x4eb7('0x5a')]});_0x1b4afe=_[_0x4eb7('0x42')]({},_0x1b4afe,_0x5be4ad[_0x4eb7('0x45')]);return db[_0x4eb7('0x58')][_0x4eb7('0x5b')](_0x1b4afe)['then'](respondWithFilteredResult(_0x13847e,_0x1b4afe));})[_0x4eb7('0x49')](handleError(_0x13847e,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3a5e49f..d474c98 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 _0xc904=['exports','define','voice_voicemail','mailbox_context','lodash','../../config/logger','api','bluebird','request-promise','path','./voiceMail.attributes'];(function(_0x5e982a,_0x546cb6){var _0x56a31d=function(_0x515f4d){while(--_0x515f4d){_0x5e982a['push'](_0x5e982a['shift']());}};_0x56a31d(++_0x546cb6);}(_0xc904,0x93));var _0x4c90=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xc904[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x4c90('0x0'));var util=require('util');var logger=require(_0x4c90('0x1'))(_0x4c90('0x2'));var moment=require('moment');var BPromise=require(_0x4c90('0x3'));var rp=require(_0x4c90('0x4'));var fs=require('fs');var path=require(_0x4c90('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c90('0x6'));module[_0x4c90('0x7')]=function(_0x2ffc00,_0x2a8cb2){return _0x2ffc00[_0x4c90('0x8')]('VoiceMail',attributes,{'tableName':_0x4c90('0x9'),'paranoid':![],'indexes':[{'name':_0x4c90('0xa'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcac7=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x164d70,_0x520b64){var _0x1b2c9f=function(_0x556fea){while(--_0x556fea){_0x164d70['push'](_0x164d70['shift']());}};_0x1b2c9f(++_0x520b64);}(_0xcac7,0x1cd));var _0x7cac=function(_0x429104,_0x380ba9){_0x429104=_0x429104-0x0;var _0x3d6542=_0xcac7[_0x429104];return _0x3d6542;};'use strict';var _=require(_0x7cac('0x0'));var util=require('util');var logger=require(_0x7cac('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7cac('0x2'));var rp=require(_0x7cac('0x3'));var fs=require('fs');var path=require(_0x7cac('0x4'));var rimraf=require(_0x7cac('0x5'));var config=require(_0x7cac('0x6'));var attributes=require(_0x7cac('0x7'));module[_0x7cac('0x8')]=function(_0x43b310,_0x3223cc){return _0x43b310[_0x7cac('0x9')](_0x7cac('0xa'),attributes,{'tableName':_0x7cac('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x7cac('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a0f55f1..8a56185 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 _0xee73=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x3f2302,_0x3c3363){var _0x55fed4=function(_0x14d32e){while(--_0x14d32e){_0x3f2302['push'](_0x3f2302['shift']());}};_0x55fed4(++_0x3c3363);}(_0xee73,0x196));var _0x3ee7=function(_0x17791f,_0x1d16d8){_0x17791f=_0x17791f-0x0;var _0x332dc4=_0xee73[_0x17791f];return _0x332dc4;};'use strict';var _=require(_0x3ee7('0x0'));var util=require(_0x3ee7('0x1'));var moment=require(_0x3ee7('0x2'));var BPromise=require(_0x3ee7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ee7('0x4'))['db'];var utils=require(_0x3ee7('0x5'));var logger=require(_0x3ee7('0x6'))('rpc');var config=require(_0x3ee7('0x7'));var jayson=require(_0x3ee7('0x8'));var client=jayson['client'][_0x3ee7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x95ecb2,_0x2cd5d6,_0x14b917){return new BPromise(function(_0x2ed337,_0x3bacf3){return client['request'](_0x95ecb2,_0x14b917)[_0x3ee7('0xa')](function(_0x202456){logger[_0x3ee7('0xb')](_0x3ee7('0xc'),_0x2cd5d6,_0x3ee7('0xd'));logger[_0x3ee7('0xe')](_0x3ee7('0xf'),_0x2cd5d6,_0x3ee7('0xd'),JSON[_0x3ee7('0x10')](_0x202456));if(_0x202456[_0x3ee7('0x11')]){if(_0x202456[_0x3ee7('0x11')][_0x3ee7('0x12')]===0x1f4){logger[_0x3ee7('0x11')](_0x3ee7('0xc'),_0x2cd5d6,_0x202456['error'][_0x3ee7('0x13')]);return _0x3bacf3(_0x202456[_0x3ee7('0x11')][_0x3ee7('0x13')]);}logger[_0x3ee7('0x11')](_0x3ee7('0xc'),_0x2cd5d6,_0x202456[_0x3ee7('0x11')][_0x3ee7('0x13')]);return _0x2ed337(_0x202456[_0x3ee7('0x11')][_0x3ee7('0x13')]);}else{logger[_0x3ee7('0xb')](_0x3ee7('0xc'),_0x2cd5d6,'request\x20sent');_0x2ed337(_0x202456[_0x3ee7('0x14')][_0x3ee7('0x13')]);}})[_0x3ee7('0x15')](function(_0x339065){logger[_0x3ee7('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2cd5d6,_0x339065);_0x3bacf3(_0x339065);});});} \ No newline at end of file +var _0x2067=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1f10bd,_0x3a9fc1){var _0x520995=function(_0x5960af){while(--_0x5960af){_0x1f10bd['push'](_0x1f10bd['shift']());}};_0x520995(++_0x3a9fc1);}(_0x2067,0x16c));var _0x7206=function(_0xa482b6,_0x446cef){_0xa482b6=_0xa482b6-0x0;var _0x254829=_0x2067[_0xa482b6];return _0x254829;};'use strict';var _=require(_0x7206('0x0'));var util=require(_0x7206('0x1'));var moment=require('moment');var BPromise=require(_0x7206('0x2'));var rs=require(_0x7206('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7206('0x4'))['db'];var utils=require(_0x7206('0x5'));var logger=require('../../config/logger')(_0x7206('0x6'));var config=require(_0x7206('0x7'));var jayson=require(_0x7206('0x8'));var client=jayson[_0x7206('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f6193,_0x25167c,_0xec1739){return new BPromise(function(_0x2f3447,_0x34b190){return client[_0x7206('0xa')](_0x1f6193,_0xec1739)[_0x7206('0xb')](function(_0x408f2f){logger['info'](_0x7206('0xc'),_0x25167c,_0x7206('0xd'));logger[_0x7206('0xe')](_0x7206('0xf'),_0x25167c,_0x7206('0xd'),JSON[_0x7206('0x10')](_0x408f2f));if(_0x408f2f[_0x7206('0x11')]){if(_0x408f2f[_0x7206('0x11')][_0x7206('0x12')]===0x1f4){logger[_0x7206('0x11')](_0x7206('0xc'),_0x25167c,_0x408f2f['error'][_0x7206('0x13')]);return _0x34b190(_0x408f2f[_0x7206('0x11')][_0x7206('0x13')]);}logger[_0x7206('0x11')](_0x7206('0xc'),_0x25167c,_0x408f2f['error'][_0x7206('0x13')]);return _0x2f3447(_0x408f2f[_0x7206('0x11')][_0x7206('0x13')]);}else{logger[_0x7206('0x14')](_0x7206('0xc'),_0x25167c,'request\x20sent');_0x2f3447(_0x408f2f[_0x7206('0x15')][_0x7206('0x13')]);}})[_0x7206('0x16')](function(_0x2e2c4c){logger['error'](_0x7206('0xc'),_0x25167c,_0x2e2c4c);_0x34b190(_0x2e2c4c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index af86a09..c0829f5 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 _0xd25f=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','util','path','fs-extra'];(function(_0x308fbd,_0x1ada28){var _0x37f067=function(_0x182d18){while(--_0x182d18){_0x308fbd['push'](_0x308fbd['shift']());}};_0x37f067(++_0x1ada28);}(_0xd25f,0xed));var _0xfd25=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xd25f[_0x2db12b];return _0x20990b;};'use strict';var multer=require('multer');var util=require(_0xfd25('0x0'));var path=require(_0xfd25('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfd25('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd25('0x3'));var controller=require(_0xfd25('0x4'));router[_0xfd25('0x5')]('/',auth[_0xfd25('0x6')](),controller[_0xfd25('0x7')]);router[_0xfd25('0x5')](_0xfd25('0x8'),auth[_0xfd25('0x6')](),controller['show']);router[_0xfd25('0x5')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xfd25('0x9')]('/',auth[_0xfd25('0x6')](),controller[_0xfd25('0xa')]);router[_0xfd25('0xb')](_0xfd25('0x8'),auth[_0xfd25('0x6')](),controller[_0xfd25('0xc')]);router['delete'](_0xfd25('0x8'),auth['isAuthenticated'](),controller[_0xfd25('0xd')]);module[_0xfd25('0xe')]=router; \ No newline at end of file +var _0xbbe8=['download','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show'];(function(_0x562aa5,_0x48dfb8){var _0x24fbb=function(_0x4f9d8d){while(--_0x4f9d8d){_0x562aa5['push'](_0x562aa5['shift']());}};_0x24fbb(++_0x48dfb8);}(_0xbbe8,0x124));var _0x8bbe=function(_0x2ceba7,_0x451ce4){_0x2ceba7=_0x2ceba7-0x0;var _0x5348eb=_0xbbe8[_0x2ceba7];return _0x5348eb;};'use strict';var multer=require(_0x8bbe('0x0'));var util=require(_0x8bbe('0x1'));var path=require('path');var timeout=require(_0x8bbe('0x2'));var express=require('express');var router=express[_0x8bbe('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bbe('0x4'));var config=require(_0x8bbe('0x5'));var controller=require(_0x8bbe('0x6'));router['get']('/',auth[_0x8bbe('0x7')](),controller[_0x8bbe('0x8')]);router[_0x8bbe('0x9')](_0x8bbe('0xa'),auth[_0x8bbe('0x7')](),controller[_0x8bbe('0xb')]);router['get']('/:id/download',auth[_0x8bbe('0x7')](),controller[_0x8bbe('0xc')]);router['post']('/',auth[_0x8bbe('0x7')](),controller[_0x8bbe('0xd')]);router[_0x8bbe('0xe')](_0x8bbe('0xa'),auth[_0x8bbe('0x7')](),controller[_0x8bbe('0xf')]);router[_0x8bbe('0x10')](_0x8bbe('0xa'),auth[_0x8bbe('0x7')](),controller[_0x8bbe('0x11')]);module[_0x8bbe('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 1f2cc1d..5fe2814 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 _0x61f9=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x61f9,0x107));var _0x961f=function(_0x40d973,_0x32e276){_0x40d973=_0x40d973-0x0;var _0x2b54e2=_0x61f9[_0x40d973];return _0x2b54e2;};'use strict';var Sequelize=require(_0x961f('0x0'));module[_0x961f('0x1')]={'name':{'type':Sequelize[_0x961f('0x2')],'get':function(_0x4fcae7){return this[_0x961f('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x961f('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x961f('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x961f('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x961f('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x961f('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x961f('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x961f('0x6')](_0x961f('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x961f('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x961f('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x961f('0x8')](_0x961f('0x9'))}}; \ No newline at end of file +var _0x22ff=['sequelize','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x23b339,_0x423b24){var _0x283e7a=function(_0x25d691){while(--_0x25d691){_0x23b339['push'](_0x23b339['shift']());}};_0x283e7a(++_0x423b24);}(_0x22ff,0x195));var _0xf22f=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x22ff[_0xf51c06];return _0x1d5420;};'use strict';var Sequelize=require(_0xf22f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf22f('0x1')],'get':function(_0x1dccfb){return this[_0xf22f('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xf22f('0x4')](_0xf22f('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf22f('0x3')],'defaultValue':''},'stamp':{'type':_0xf22f('0x6'),'defaultValue':Sequelize[_0xf22f('0x7')](_0xf22f('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8786576..24f1852 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 _0x1db2=['filter','merge','type','VIRTUAL','VoiceMailMessage','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','download','recording','msg_id','ValidationError','audio/wav','attachment;\x20filename=\x22','.wav\x22','send','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x27842e,_0x265265){var _0x2af94a=function(_0x495368){while(--_0x495368){_0x27842e['push'](_0x27842e['shift']());}};_0x2af94a(++_0x265265);}(_0x1db2,0x176));var _0x21db=function(_0x555d87,_0x239989){_0x555d87=_0x555d87-0x0;var _0x39df40=_0x1db2[_0x555d87];return _0x39df40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21db('0x0'));var zipdir=require(_0x21db('0x1'));var jsonpatch=require(_0x21db('0x2'));var rp=require('request-promise');var moment=require(_0x21db('0x3'));var BPromise=require(_0x21db('0x4'));var Mustache=require(_0x21db('0x5'));var util=require(_0x21db('0x6'));var path=require(_0x21db('0x7'));var sox=require(_0x21db('0x8'));var csv=require('to-csv');var ejs=require(_0x21db('0x9'));var fs=require('fs');var fs_extra=require(_0x21db('0xa'));var _=require(_0x21db('0xb'));var squel=require(_0x21db('0xc'));var crypto=require(_0x21db('0xd'));var jsforce=require(_0x21db('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21db('0xf'));var querystring=require(_0x21db('0x10'));var Papa=require(_0x21db('0x11'));var Redis=require(_0x21db('0x12'));var authService=require(_0x21db('0x13'));var qs=require(_0x21db('0x14'));var as=require(_0x21db('0x15'));var hardwareService=require(_0x21db('0x16'));var logger=require('../../config/logger')(_0x21db('0x17'));var utils=require(_0x21db('0x18'));var config=require(_0x21db('0x19'));var licenseUtil=require(_0x21db('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x785a26,_0x1f6149){_0x1f6149=_0x1f6149||0xcc;return function(_0x22d47a){if(_0x22d47a){return _0x785a26[_0x21db('0x1b')](_0x1f6149);}return _0x785a26[_0x21db('0x1c')](_0x1f6149)[_0x21db('0x1d')]();};}function respondWithResult(_0x10b87a,_0x30727b){_0x30727b=_0x30727b||0xc8;return function(_0x50c749){if(_0x50c749){return _0x10b87a['status'](_0x30727b)[_0x21db('0x1e')](_0x50c749);}};}function respondWithFilteredResult(_0x3fca1b,_0x84fe75){return function(_0x4cece9){if(_0x4cece9){var _0x2b267a=typeof _0x84fe75[_0x21db('0x1f')]===_0x21db('0x20')&&typeof _0x84fe75[_0x21db('0x21')]===_0x21db('0x20');var _0x1e6005=_0x4cece9['count'];var _0x22b712=_0x2b267a?0x0:_0x84fe75[_0x21db('0x1f')];var _0x2b2e1f=_0x2b267a?_0x4cece9['count']:_0x84fe75[_0x21db('0x1f')]+_0x84fe75[_0x21db('0x21')];var _0x53391b;if(_0x2b2e1f>=_0x1e6005){_0x2b2e1f=_0x1e6005;_0x53391b=0xc8;}else{_0x53391b=0xce;}_0x3fca1b[_0x21db('0x1c')](_0x53391b);return _0x3fca1b[_0x21db('0x22')](_0x21db('0x23'),_0x22b712+'-'+_0x2b2e1f+'/'+_0x1e6005)[_0x21db('0x1e')](_0x4cece9);}return null;};}function patchUpdates(_0x4c619b){return function(_0x223afd){try{jsonpatch[_0x21db('0x24')](_0x223afd,_0x4c619b,!![]);}catch(_0x2536ff){return BPromise[_0x21db('0x25')](_0x2536ff);}return _0x223afd[_0x21db('0x26')]();};}function saveUpdates(_0x4bc186,_0x9580cc){return function(_0x4c6caf){if(_0x4c6caf){return _0x4c6caf['update'](_0x4bc186)[_0x21db('0x27')](function(_0xaa0345){return _0xaa0345;});}return null;};}function removeEntity(_0x3b823b,_0x1da537){return function(_0x3df3e3){if(_0x3df3e3){return _0x3df3e3['destroy']()['then'](function(){_0x3b823b['status'](0xcc)[_0x21db('0x1d')]();});}};}function handleEntityNotFound(_0x4020f9,_0x3ed1b1){return function(_0x1f6725){if(!_0x1f6725){_0x4020f9[_0x21db('0x1b')](0x194);}return _0x1f6725;};}function handleError(_0xf523ee,_0x156115){_0x156115=_0x156115||0x1f4;return function(_0x491239){logger[_0x21db('0x28')](_0x491239[_0x21db('0x29')]);if(_0x491239['name']){delete _0x491239[_0x21db('0x2a')];}_0xf523ee[_0x21db('0x1c')](_0x156115)['send'](_0x491239);};}exports[_0x21db('0x2b')]=function(_0x53ddff,_0x502886){var _0x5d8e8c={},_0xb3284c={},_0x1895f1={'count':0x0,'rows':[]};var _0x37731d=_[_0x21db('0x2c')](db['VoiceMailMessage'][_0x21db('0x2d')],function(_0x1f8081){return{'name':_0x1f8081[_0x21db('0x2e')],'type':_0x1f8081['type']['key']};});_0xb3284c['model']=_[_0x21db('0x2f')](_[_0x21db('0x2c')](_0x37731d,_0x21db('0x2a')),[_0x21db('0x2a')]);_0xb3284c[_0x21db('0x30')]=_[_0x21db('0x31')](_0x53ddff[_0x21db('0x30')]);_0xb3284c[_0x21db('0x32')]=_[_0x21db('0x33')](_0xb3284c[_0x21db('0x34')],_0xb3284c['query']);_0x5d8e8c[_0x21db('0x35')]=_[_0x21db('0x33')](_0xb3284c[_0x21db('0x34')],qs[_0x21db('0x36')](_0x53ddff[_0x21db('0x30')][_0x21db('0x36')]));_0x5d8e8c[_0x21db('0x35')]=_0x5d8e8c[_0x21db('0x35')][_0x21db('0x37')]?_0x5d8e8c[_0x21db('0x35')]:_0xb3284c[_0x21db('0x34')];if(!_0x53ddff[_0x21db('0x30')]['hasOwnProperty'](_0x21db('0x38'))){_0x5d8e8c['limit']=qs[_0x21db('0x21')](_0x53ddff['query'][_0x21db('0x21')]);_0x5d8e8c[_0x21db('0x1f')]=qs[_0x21db('0x1f')](_0x53ddff[_0x21db('0x30')][_0x21db('0x1f')]);}_0x5d8e8c[_0x21db('0x39')]=qs['sort'](_0x53ddff[_0x21db('0x30')][_0x21db('0x3a')]);_0x5d8e8c[_0x21db('0x3b')]=qs['filters'](_[_0x21db('0x3c')](_0x53ddff['query'],_0xb3284c[_0x21db('0x32')]),_0x37731d);if(_0x53ddff['query'][_0x21db('0x3d')]){_0x5d8e8c[_0x21db('0x3b')]=_[_0x21db('0x3e')](_0x5d8e8c['where'],{'$or':_['map'](_0x37731d,function(_0x46b1ae){if(_0x46b1ae[_0x21db('0x3f')]!==_0x21db('0x40')){var _0x81bda0={};_0x81bda0[_0x46b1ae[_0x21db('0x2a')]]={'$like':'%'+_0x53ddff[_0x21db('0x30')][_0x21db('0x3d')]+'%'};return _0x81bda0;}})});}_0x5d8e8c=_[_0x21db('0x3e')]({},_0x5d8e8c,_0x53ddff['options']);var _0x3decda={'where':_0x5d8e8c[_0x21db('0x3b')]};return db[_0x21db('0x41')]['count'](_0x3decda)[_0x21db('0x27')](function(_0x5ddb61){_0x1895f1[_0x21db('0x42')]=_0x5ddb61;if(_0x53ddff[_0x21db('0x30')][_0x21db('0x43')]){_0x5d8e8c[_0x21db('0x44')]=[{'all':!![]}];}return db[_0x21db('0x41')][_0x21db('0x45')](_0x5d8e8c);})['then'](function(_0xb45e75){_0x1895f1[_0x21db('0x46')]=_0xb45e75;return _0x1895f1;})[_0x21db('0x27')](respondWithFilteredResult(_0x502886,_0x5d8e8c))[_0x21db('0x47')](handleError(_0x502886,null));};exports[_0x21db('0x48')]=function(_0xc89769,_0x2bef0b){var _0x44abf7={'raw':!![],'where':{'id':_0xc89769[_0x21db('0x49')]['id']}},_0xdff966={};_0xdff966[_0x21db('0x34')]=_['keys'](db[_0x21db('0x41')][_0x21db('0x2d')]);_0xdff966[_0x21db('0x30')]=_[_0x21db('0x31')](_0xc89769['query']);_0xdff966[_0x21db('0x32')]=_[_0x21db('0x33')](_0xdff966['model'],_0xdff966[_0x21db('0x30')]);_0x44abf7['attributes']=_[_0x21db('0x33')](_0xdff966[_0x21db('0x34')],qs[_0x21db('0x36')](_0xc89769[_0x21db('0x30')]['fields']));_0x44abf7[_0x21db('0x35')]=_0x44abf7[_0x21db('0x35')]['length']?_0x44abf7[_0x21db('0x35')]:_0xdff966['model'];if(_0xc89769[_0x21db('0x30')]['includeAll']){_0x44abf7['include']=[{'all':!![]}];}_0x44abf7=_[_0x21db('0x3e')]({},_0x44abf7,_0xc89769[_0x21db('0x4a')]);return db[_0x21db('0x41')][_0x21db('0x4b')](_0x44abf7)[_0x21db('0x27')](handleEntityNotFound(_0x2bef0b,null))['then'](respondWithResult(_0x2bef0b,null))[_0x21db('0x47')](handleError(_0x2bef0b,null));};exports['create']=function(_0x3a46af,_0x41ae7e){return db[_0x21db('0x41')][_0x21db('0x4c')](_0x3a46af[_0x21db('0x4d')],{})['then'](respondWithResult(_0x41ae7e,0xc9))[_0x21db('0x47')](handleError(_0x41ae7e,null));};exports['update']=function(_0x509037,_0x3cdd04){if(_0x509037[_0x21db('0x4d')]['id']){delete _0x509037['body']['id'];}return db[_0x21db('0x41')][_0x21db('0x4b')]({'where':{'id':_0x509037[_0x21db('0x49')]['id']}})[_0x21db('0x27')](handleEntityNotFound(_0x3cdd04,null))[_0x21db('0x27')](saveUpdates(_0x509037['body'],null))[_0x21db('0x27')](respondWithResult(_0x3cdd04,null))['catch'](handleError(_0x3cdd04,null));};exports[_0x21db('0x4e')]=function(_0xf97247,_0x10c286){return db[_0x21db('0x41')][_0x21db('0x4b')]({'where':{'id':_0xf97247[_0x21db('0x49')]['id']}})[_0x21db('0x27')](handleEntityNotFound(_0x10c286,null))['then'](removeEntity(_0x10c286,null))[_0x21db('0x47')](handleError(_0x10c286,null));};exports[_0x21db('0x4f')]=function(_0x3c624b,_0x555dbf,_0x23337d){return db['VoiceMailMessage']['find']({'where':{'id':_0x3c624b[_0x21db('0x49')]['id']},'attributes':['id',_0x21db('0x50'),_0x21db('0x51')]})['then'](handleEntityNotFound(_0x555dbf,null))[_0x21db('0x27')](function(_0x4d8258){if(_0x4d8258){if(!_0x4d8258['recording']){throw new db['Sequelize'][(_0x21db('0x52'))]('VoiceMailMessage\x20not\x20found');}var _0x15a791={'Content-Type':_0x21db('0x53'),'Content-Disposition':'attachment'};if(_0x4d8258[_0x21db('0x51')]){_0x15a791['Content-Disposition']=_0x21db('0x54')+_0x4d8258[_0x21db('0x51')]+_0x21db('0x55');}_0x555dbf[_0x21db('0x22')](_0x15a791);return _0x555dbf[_0x21db('0x56')](new Buffer(_0x4d8258['recording']));}})['catch'](handleError(_0x555dbf,null));}; \ No newline at end of file +var _0x4cb2=['end','offset','limit','undefined','count','set','Content-Range','json','reject','update','destroy','then','status','stack','name','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','download','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0xc7e283,_0x511dd7){var _0x4a6f37=function(_0x52eaa7){while(--_0x52eaa7){_0xc7e283['push'](_0xc7e283['shift']());}};_0x4a6f37(++_0x511dd7);}(_0x4cb2,0x1da));var _0x24cb=function(_0x14c152,_0x47f217){_0x14c152=_0x14c152-0x0;var _0x428dd0=_0x4cb2[_0x14c152];return _0x428dd0;};'use strict';var emlformat=require(_0x24cb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x24cb('0x1'));var rp=require(_0x24cb('0x2'));var moment=require(_0x24cb('0x3'));var BPromise=require(_0x24cb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x24cb('0x5'));var sox=require(_0x24cb('0x6'));var csv=require(_0x24cb('0x7'));var ejs=require(_0x24cb('0x8'));var fs=require('fs');var fs_extra=require(_0x24cb('0x9'));var _=require(_0x24cb('0xa'));var squel=require(_0x24cb('0xb'));var crypto=require(_0x24cb('0xc'));var jsforce=require(_0x24cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x24cb('0x7'));var querystring=require(_0x24cb('0xe'));var Papa=require('papaparse');var Redis=require(_0x24cb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x24cb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24cb('0x11'));var logger=require(_0x24cb('0x12'))(_0x24cb('0x13'));var utils=require(_0x24cb('0x14'));var config=require(_0x24cb('0x15'));var licenseUtil=require(_0x24cb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x180ae0,_0x95479d){_0x95479d=_0x95479d||0xcc;return function(_0x447685){if(_0x447685){return _0x180ae0[_0x24cb('0x17')](_0x95479d);}return _0x180ae0['status'](_0x95479d)[_0x24cb('0x18')]();};}function respondWithResult(_0x1ec8d5,_0x447f8e){_0x447f8e=_0x447f8e||0xc8;return function(_0x2dfb08){if(_0x2dfb08){return _0x1ec8d5['status'](_0x447f8e)['json'](_0x2dfb08);}};}function respondWithFilteredResult(_0x582e99,_0x2a2105){return function(_0x364dd4){if(_0x364dd4){var _0x360b01=typeof _0x2a2105[_0x24cb('0x19')]==='undefined'&&typeof _0x2a2105[_0x24cb('0x1a')]===_0x24cb('0x1b');var _0x1264b7=_0x364dd4[_0x24cb('0x1c')];var _0x208939=_0x360b01?0x0:_0x2a2105[_0x24cb('0x19')];var _0x49a533=_0x360b01?_0x364dd4['count']:_0x2a2105[_0x24cb('0x19')]+_0x2a2105[_0x24cb('0x1a')];var _0x11ab1c;if(_0x49a533>=_0x1264b7){_0x49a533=_0x1264b7;_0x11ab1c=0xc8;}else{_0x11ab1c=0xce;}_0x582e99['status'](_0x11ab1c);return _0x582e99[_0x24cb('0x1d')](_0x24cb('0x1e'),_0x208939+'-'+_0x49a533+'/'+_0x1264b7)[_0x24cb('0x1f')](_0x364dd4);}return null;};}function patchUpdates(_0x249041){return function(_0x589b4a){try{jsonpatch['apply'](_0x589b4a,_0x249041,!![]);}catch(_0xd4984){return BPromise[_0x24cb('0x20')](_0xd4984);}return _0x589b4a['save']();};}function saveUpdates(_0x5ada3c,_0x5d8f69){return function(_0x30dafa){if(_0x30dafa){return _0x30dafa[_0x24cb('0x21')](_0x5ada3c)['then'](function(_0x2125e6){return _0x2125e6;});}return null;};}function removeEntity(_0x8a0a2b,_0xdbe9e7){return function(_0x2a582a){if(_0x2a582a){return _0x2a582a[_0x24cb('0x22')]()[_0x24cb('0x23')](function(){_0x8a0a2b[_0x24cb('0x24')](0xcc)[_0x24cb('0x18')]();});}};}function handleEntityNotFound(_0x49d492,_0x44af18){return function(_0x1e1f85){if(!_0x1e1f85){_0x49d492[_0x24cb('0x17')](0x194);}return _0x1e1f85;};}function handleError(_0x391e08,_0x1cfe01){_0x1cfe01=_0x1cfe01||0x1f4;return function(_0x12d429){logger['error'](_0x12d429[_0x24cb('0x25')]);if(_0x12d429[_0x24cb('0x26')]){delete _0x12d429['name'];}_0x391e08[_0x24cb('0x24')](_0x1cfe01)['send'](_0x12d429);};}exports['index']=function(_0x447a82,_0x1851be){var _0x980c09={},_0x237a03={},_0x315eeb={'count':0x0,'rows':[]};var _0x5777d0=_['map'](db['VoiceMailMessage'][_0x24cb('0x27')],function(_0x4d3a2d){return{'name':_0x4d3a2d[_0x24cb('0x28')],'type':_0x4d3a2d[_0x24cb('0x29')][_0x24cb('0x2a')]};});_0x237a03[_0x24cb('0x2b')]=_[_0x24cb('0x2c')](_['map'](_0x5777d0,_0x24cb('0x26')),[_0x24cb('0x26')]);_0x237a03[_0x24cb('0x2d')]=_[_0x24cb('0x2e')](_0x447a82['query']);_0x237a03[_0x24cb('0x2f')]=_[_0x24cb('0x30')](_0x237a03['model'],_0x237a03[_0x24cb('0x2d')]);_0x980c09['attributes']=_[_0x24cb('0x30')](_0x237a03[_0x24cb('0x2b')],qs['fields'](_0x447a82[_0x24cb('0x2d')][_0x24cb('0x31')]));_0x980c09[_0x24cb('0x32')]=_0x980c09[_0x24cb('0x32')][_0x24cb('0x33')]?_0x980c09[_0x24cb('0x32')]:_0x237a03[_0x24cb('0x2b')];if(!_0x447a82['query']['hasOwnProperty'](_0x24cb('0x34'))){_0x980c09[_0x24cb('0x1a')]=qs[_0x24cb('0x1a')](_0x447a82[_0x24cb('0x2d')][_0x24cb('0x1a')]);_0x980c09[_0x24cb('0x19')]=qs[_0x24cb('0x19')](_0x447a82[_0x24cb('0x2d')][_0x24cb('0x19')]);}_0x980c09[_0x24cb('0x35')]=qs[_0x24cb('0x36')](_0x447a82['query']['sort']);_0x980c09[_0x24cb('0x37')]=qs[_0x24cb('0x2f')](_[_0x24cb('0x38')](_0x447a82[_0x24cb('0x2d')],_0x237a03['filters']),_0x5777d0);if(_0x447a82['query'][_0x24cb('0x39')]){_0x980c09['where']=_[_0x24cb('0x3a')](_0x980c09[_0x24cb('0x37')],{'$or':_['map'](_0x5777d0,function(_0x382220){if(_0x382220[_0x24cb('0x29')]!==_0x24cb('0x3b')){var _0x55f61a={};_0x55f61a[_0x382220[_0x24cb('0x26')]]={'$like':'%'+_0x447a82[_0x24cb('0x2d')][_0x24cb('0x39')]+'%'};return _0x55f61a;}})});}_0x980c09=_[_0x24cb('0x3a')]({},_0x980c09,_0x447a82['options']);var _0x400f86={'where':_0x980c09[_0x24cb('0x37')]};return db[_0x24cb('0x3c')][_0x24cb('0x1c')](_0x400f86)[_0x24cb('0x23')](function(_0x2aa47f){_0x315eeb['count']=_0x2aa47f;if(_0x447a82[_0x24cb('0x2d')][_0x24cb('0x3d')]){_0x980c09[_0x24cb('0x3e')]=[{'all':!![]}];}return db[_0x24cb('0x3c')][_0x24cb('0x3f')](_0x980c09);})[_0x24cb('0x23')](function(_0x54c67c){_0x315eeb[_0x24cb('0x40')]=_0x54c67c;return _0x315eeb;})[_0x24cb('0x23')](respondWithFilteredResult(_0x1851be,_0x980c09))[_0x24cb('0x41')](handleError(_0x1851be,null));};exports[_0x24cb('0x42')]=function(_0x3a6452,_0x23f310){var _0x36ac49={'raw':!![],'where':{'id':_0x3a6452[_0x24cb('0x43')]['id']}},_0x214f14={};_0x214f14[_0x24cb('0x2b')]=_[_0x24cb('0x2e')](db[_0x24cb('0x3c')][_0x24cb('0x27')]);_0x214f14[_0x24cb('0x2d')]=_[_0x24cb('0x2e')](_0x3a6452['query']);_0x214f14[_0x24cb('0x2f')]=_['intersection'](_0x214f14[_0x24cb('0x2b')],_0x214f14[_0x24cb('0x2d')]);_0x36ac49[_0x24cb('0x32')]=_[_0x24cb('0x30')](_0x214f14[_0x24cb('0x2b')],qs[_0x24cb('0x31')](_0x3a6452['query'][_0x24cb('0x31')]));_0x36ac49[_0x24cb('0x32')]=_0x36ac49[_0x24cb('0x32')][_0x24cb('0x33')]?_0x36ac49[_0x24cb('0x32')]:_0x214f14[_0x24cb('0x2b')];if(_0x3a6452[_0x24cb('0x2d')][_0x24cb('0x3d')]){_0x36ac49[_0x24cb('0x3e')]=[{'all':!![]}];}_0x36ac49=_[_0x24cb('0x3a')]({},_0x36ac49,_0x3a6452[_0x24cb('0x44')]);return db['VoiceMailMessage'][_0x24cb('0x45')](_0x36ac49)[_0x24cb('0x23')](handleEntityNotFound(_0x23f310,null))[_0x24cb('0x23')](respondWithResult(_0x23f310,null))[_0x24cb('0x41')](handleError(_0x23f310,null));};exports[_0x24cb('0x46')]=function(_0x58a49b,_0x2ed61f){return db[_0x24cb('0x3c')][_0x24cb('0x46')](_0x58a49b[_0x24cb('0x47')],{})['then'](respondWithResult(_0x2ed61f,0xc9))[_0x24cb('0x41')](handleError(_0x2ed61f,null));};exports['update']=function(_0x2bd872,_0x3eacb1){if(_0x2bd872[_0x24cb('0x47')]['id']){delete _0x2bd872[_0x24cb('0x47')]['id'];}return db[_0x24cb('0x3c')][_0x24cb('0x45')]({'where':{'id':_0x2bd872[_0x24cb('0x43')]['id']}})[_0x24cb('0x23')](handleEntityNotFound(_0x3eacb1,null))['then'](saveUpdates(_0x2bd872['body'],null))[_0x24cb('0x23')](respondWithResult(_0x3eacb1,null))[_0x24cb('0x41')](handleError(_0x3eacb1,null));};exports[_0x24cb('0x22')]=function(_0x424ec3,_0x311866){return db[_0x24cb('0x3c')][_0x24cb('0x45')]({'where':{'id':_0x424ec3[_0x24cb('0x43')]['id']}})[_0x24cb('0x23')](handleEntityNotFound(_0x311866,null))[_0x24cb('0x23')](removeEntity(_0x311866,null))['catch'](handleError(_0x311866,null));};exports[_0x24cb('0x48')]=function(_0x4f4d2c,_0x1a8d97,_0x1ce255){return db[_0x24cb('0x3c')][_0x24cb('0x45')]({'where':{'id':_0x4f4d2c[_0x24cb('0x43')]['id']},'attributes':['id','recording',_0x24cb('0x49')]})[_0x24cb('0x23')](handleEntityNotFound(_0x1a8d97,null))['then'](function(_0x34e499){if(_0x34e499){if(!_0x34e499[_0x24cb('0x4a')]){throw new db[(_0x24cb('0x4b'))]['ValidationError'](_0x24cb('0x4c'));}var _0x4522e2={'Content-Type':_0x24cb('0x4d'),'Content-Disposition':_0x24cb('0x4e')};if(_0x34e499[_0x24cb('0x49')]){_0x4522e2[_0x24cb('0x4f')]=_0x24cb('0x50')+_0x34e499['msg_id']+_0x24cb('0x51');}_0x1a8d97[_0x24cb('0x1d')](_0x4522e2);return _0x1a8d97[_0x24cb('0x52')](new Buffer(_0x34e499[_0x24cb('0x4a')]));}})['catch'](handleError(_0x1a8d97,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 222a111..83543dc 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 _0xfff2=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','define'];(function(_0x2fe6cf,_0x4b914d){var _0xf7865f=function(_0x371b34){while(--_0x371b34){_0x2fe6cf['push'](_0x2fe6cf['shift']());}};_0xf7865f(++_0x4b914d);}(_0xfff2,0x17d));var _0x2fff=function(_0x3dda9c,_0x3b2a94){_0x3dda9c=_0x3dda9c-0x0;var _0x5fd293=_0xfff2[_0x3dda9c];return _0x5fd293;};'use strict';var _=require(_0x2fff('0x0'));var util=require(_0x2fff('0x1'));var logger=require(_0x2fff('0x2'))(_0x2fff('0x3'));var moment=require(_0x2fff('0x4'));var BPromise=require(_0x2fff('0x5'));var rp=require(_0x2fff('0x6'));var fs=require('fs');var path=require(_0x2fff('0x7'));var rimraf=require('rimraf');var config=require(_0x2fff('0x8'));var attributes=require(_0x2fff('0x9'));module['exports']=function(_0xcacf0b,_0x4533f1){return _0xcacf0b[_0x2fff('0xa')](_0x2fff('0xb'),attributes,{'tableName':_0x2fff('0xc'),'paranoid':![],'indexes':[{'name':_0x2fff('0xd'),'fields':[_0x2fff('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc220=['path','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','util','../../config/logger','moment','request-promise'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0xc220,0x15b));var _0x0c22=function(_0x2c453e,_0x1a2d67){_0x2c453e=_0x2c453e-0x0;var _0x1b078a=_0xc220[_0x2c453e];return _0x1b078a;};'use strict';var _=require('lodash');var util=require(_0x0c22('0x0'));var logger=require(_0x0c22('0x1'))('api');var moment=require(_0x0c22('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c22('0x3'));var fs=require('fs');var path=require(_0x0c22('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c22('0x5'));module['exports']=function(_0x246c93,_0x395f4d){return _0x246c93[_0x0c22('0x6')]('VoiceMailMessage',attributes,{'tableName':_0x0c22('0x7'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x0c22('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 3c35d11..6521e3d 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 _0xd1fb=['ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x2e26d2,_0x56df63){var _0x26778e=function(_0x3a1a09){while(--_0x3a1a09){_0x2e26d2['push'](_0x2e26d2['shift']());}};_0x26778e(++_0x56df63);}(_0xd1fb,0xe4));var _0xbd1f=function(_0x2a183e,_0x3e2518){_0x2a183e=_0x2a183e-0x0;var _0x260962=_0xd1fb[_0x2a183e];return _0x260962;};'use strict';var _=require('lodash');var util=require(_0xbd1f('0x0'));var moment=require(_0xbd1f('0x1'));var BPromise=require(_0xbd1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd1f('0x3'));var db=require(_0xbd1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbd1f('0x5'));var jayson=require(_0xbd1f('0x6'));var client=jayson[_0xbd1f('0x7')][_0xbd1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32911c,_0x554948,_0x6ad1ea){return new BPromise(function(_0x27f01e,_0x5dc8b0){return client[_0xbd1f('0x9')](_0x32911c,_0x6ad1ea)[_0xbd1f('0xa')](function(_0x4345b0){logger[_0xbd1f('0xb')](_0xbd1f('0xc'),_0x554948,'request\x20sent');logger[_0xbd1f('0xd')](_0xbd1f('0xe'),_0x554948,_0xbd1f('0xf'),JSON[_0xbd1f('0x10')](_0x4345b0));if(_0x4345b0[_0xbd1f('0x11')]){if(_0x4345b0[_0xbd1f('0x11')]['code']===0x1f4){logger[_0xbd1f('0x11')](_0xbd1f('0xc'),_0x554948,_0x4345b0[_0xbd1f('0x11')]['message']);return _0x5dc8b0(_0x4345b0[_0xbd1f('0x11')][_0xbd1f('0x12')]);}logger[_0xbd1f('0x11')](_0xbd1f('0xc'),_0x554948,_0x4345b0['error']['message']);return _0x27f01e(_0x4345b0[_0xbd1f('0x11')]['message']);}else{logger[_0xbd1f('0xb')](_0xbd1f('0xc'),_0x554948,_0xbd1f('0xf'));_0x27f01e(_0x4345b0[_0xbd1f('0x13')][_0xbd1f('0x12')]);}})[_0xbd1f('0x14')](function(_0x4b8ca8){logger[_0xbd1f('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x554948,_0x4b8ca8);_0x5dc8b0(_0x4b8ca8);});});} \ No newline at end of file +var _0xa4c7=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xa4c7,0x1e9));var _0x7a4c=function(_0x38f8c8,_0x839f76){_0x38f8c8=_0x38f8c8-0x0;var _0x4679b3=_0xa4c7[_0x38f8c8];return _0x4679b3;};'use strict';var _=require(_0x7a4c('0x0'));var util=require('util');var moment=require(_0x7a4c('0x1'));var BPromise=require(_0x7a4c('0x2'));var rs=require(_0x7a4c('0x3'));var fs=require('fs');var Redis=require(_0x7a4c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a4c('0x5'));var logger=require('../../config/logger')(_0x7a4c('0x6'));var config=require('../../config/environment');var jayson=require(_0x7a4c('0x7'));var client=jayson[_0x7a4c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10328c,_0x1428ea,_0x50689c){return new BPromise(function(_0x3b7277,_0xc48e55){return client[_0x7a4c('0x9')](_0x10328c,_0x50689c)[_0x7a4c('0xa')](function(_0x12b347){logger[_0x7a4c('0xb')](_0x7a4c('0xc'),_0x1428ea,_0x7a4c('0xd'));logger[_0x7a4c('0xe')](_0x7a4c('0xf'),_0x1428ea,_0x7a4c('0xd'),JSON[_0x7a4c('0x10')](_0x12b347));if(_0x12b347[_0x7a4c('0x11')]){if(_0x12b347[_0x7a4c('0x11')]['code']===0x1f4){logger[_0x7a4c('0x11')](_0x7a4c('0xc'),_0x1428ea,_0x12b347[_0x7a4c('0x11')][_0x7a4c('0x12')]);return _0xc48e55(_0x12b347['error']['message']);}logger[_0x7a4c('0x11')](_0x7a4c('0xc'),_0x1428ea,_0x12b347[_0x7a4c('0x11')][_0x7a4c('0x12')]);return _0x3b7277(_0x12b347[_0x7a4c('0x11')][_0x7a4c('0x12')]);}else{logger['info'](_0x7a4c('0xc'),_0x1428ea,'request\x20sent');_0x3b7277(_0x12b347[_0x7a4c('0x13')][_0x7a4c('0x12')]);}})[_0x7a4c('0x14')](function(_0x19a731){logger[_0x7a4c('0x11')](_0x7a4c('0xc'),_0x1428ea,_0x19a731);_0xc48e55(_0x19a731);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 36034ec..4010b18 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 _0x438c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout'];(function(_0x4d9331,_0x49155d){var _0x1494c6=function(_0x171756){while(--_0x171756){_0x4d9331['push'](_0x4d9331['shift']());}};_0x1494c6(++_0x49155d);}(_0x438c,0x70));var _0xc438=function(_0x1e3d3c,_0x2f50f3){_0x1e3d3c=_0x1e3d3c-0x0;var _0x5733ac=_0x438c[_0x1e3d3c];return _0x5733ac;};'use strict';var multer=require(_0xc438('0x0'));var util=require('util');var path=require(_0xc438('0x1'));var timeout=require(_0xc438('0x2'));var express=require('express');var router=express[_0xc438('0x3')]();var fs_extra=require(_0xc438('0x4'));var auth=require(_0xc438('0x5'));var interaction=require(_0xc438('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xc438('0x7')]('/',auth[_0xc438('0x8')](),controller[_0xc438('0x9')]);router[_0xc438('0x7')](_0xc438('0xa'),auth[_0xc438('0x8')](),controller[_0xc438('0xb')]);router[_0xc438('0x7')]('/:id/sounds',auth[_0xc438('0x8')](),controller[_0xc438('0xc')]);router[_0xc438('0xd')]('/',auth['isAuthenticated'](),controller[_0xc438('0xe')]);router[_0xc438('0xd')](_0xc438('0xf'),auth[_0xc438('0x8')](),controller[_0xc438('0x10')]);router[_0xc438('0x11')](_0xc438('0xa'),auth[_0xc438('0x8')](),controller[_0xc438('0x12')]);router[_0xc438('0x13')](_0xc438('0xa'),auth[_0xc438('0x8')](),controller['destroy']);router[_0xc438('0x13')](_0xc438('0x14'),auth['isAuthenticated'](),controller[_0xc438('0x15')]);module[_0xc438('0x16')]=router; \ No newline at end of file +var _0x6c30=['./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds','create','post','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7a4216,_0x493a71){var _0xd5cbd8=function(_0x3a28a5){while(--_0x3a28a5){_0x7a4216['push'](_0x7a4216['shift']());}};_0xd5cbd8(++_0x493a71);}(_0x6c30,0x1ef));var _0x06c3=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0x6c30[_0x311aad];return _0x1779bd;};'use strict';var multer=require(_0x06c3('0x0'));var util=require(_0x06c3('0x1'));var path=require(_0x06c3('0x2'));var timeout=require(_0x06c3('0x3'));var express=require('express');var router=express[_0x06c3('0x4')]();var fs_extra=require(_0x06c3('0x5'));var auth=require(_0x06c3('0x6'));var interaction=require(_0x06c3('0x7'));var config=require(_0x06c3('0x8'));var controller=require(_0x06c3('0x9'));router[_0x06c3('0xa')]('/',auth['isAuthenticated'](),controller[_0x06c3('0xb')]);router[_0x06c3('0xa')](_0x06c3('0xc'),auth[_0x06c3('0xd')](),controller[_0x06c3('0xe')]);router[_0x06c3('0xa')](_0x06c3('0xf'),auth[_0x06c3('0xd')](),controller['getSounds']);router['post']('/',auth[_0x06c3('0xd')](),controller[_0x06c3('0x10')]);router[_0x06c3('0x11')]('/:id/sounds',auth['isAuthenticated'](),controller['addSound']);router['put']('/:id',auth[_0x06c3('0xd')](),controller[_0x06c3('0x12')]);router[_0x06c3('0x13')](_0x06c3('0xc'),auth[_0x06c3('0xd')](),controller[_0x06c3('0x14')]);router[_0x06c3('0x13')](_0x06c3('0x15'),auth[_0x06c3('0xd')](),controller[_0x06c3('0x16')]);module[_0x06c3('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 5f360ce..9a31b6a 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 _0x75a9=['mp3','files','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3'];(function(_0x23b153,_0x5827e5){var _0x264ec3=function(_0x493299){while(--_0x493299){_0x23b153['push'](_0x23b153['shift']());}};_0x264ec3(++_0x5827e5);}(_0x75a9,0xa1));var _0x975a=function(_0x59be7a,_0x3c68d7){_0x59be7a=_0x59be7a-0x0;var _0x23e09a=_0x75a9[_0x59be7a];return _0x23e09a;};'use strict';var Sequelize=require(_0x975a('0x0'));module[_0x975a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x975a('0x2')},'mode':{'type':Sequelize[_0x975a('0x3')](_0x975a('0x4'),'files',_0x975a('0x5'),_0x975a('0x6'),_0x975a('0x7'),_0x975a('0x8')),'allowNull':!![],'defaultValue':_0x975a('0x9')},'directory':{'type':Sequelize[_0x975a('0xa')],'allowNull':!![]},'application':{'type':Sequelize[_0x975a('0xa')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x975a('0xa')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x975a('0xa')],'allowNull':!![]},'stamp':{'type':_0x975a('0xb')},'defaultEntry':{'type':Sequelize[_0x975a('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5adc=['sequelize','STRING','name','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x2142bb,_0x14b31b){var _0x45fb70=function(_0x165842){while(--_0x165842){_0x2142bb['push'](_0x2142bb['shift']());}};_0x45fb70(++_0x14b31b);}(_0x5adc,0x90));var _0xc5ad=function(_0x4291c0,_0x532862){_0x4291c0=_0x4291c0-0x0;var _0x5a31e0=_0x5adc[_0x4291c0];return _0x5a31e0;};'use strict';var Sequelize=require(_0xc5ad('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5ad('0x1')],'allowNull':![],'unique':_0xc5ad('0x2')},'mode':{'type':Sequelize['ENUM'](_0xc5ad('0x3'),_0xc5ad('0x4'),_0xc5ad('0x5'),_0xc5ad('0x6'),_0xc5ad('0x7'),_0xc5ad('0x8')),'allowNull':!![],'defaultValue':_0xc5ad('0x4')},'directory':{'type':Sequelize[_0xc5ad('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xc5ad('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xc5ad('0x1')],'allowNull':!![],'defaultValue':_0xc5ad('0x9')},'format':{'type':Sequelize[_0xc5ad('0x1')],'allowNull':!![]},'stamp':{'type':_0xc5ad('0xa')},'defaultEntry':{'type':Sequelize[_0xc5ad('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 d1364be..af478fc 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 _0x40ea=['findOne','Sequelize','pick','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','MusicOnHolds','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','body','create','mode','files','join','root','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','directory','readdirSync','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','save_name','converted_format','createdAt','format','basename','extname','%s.%s','symlinkSync','removeSound'];(function(_0x3890f1,_0x3e1945){var _0x2473ba=function(_0x497a63){while(--_0x497a63){_0x3890f1['push'](_0x3890f1['shift']());}};_0x2473ba(++_0x3e1945);}(_0x40ea,0xe9));var _0xa40e=function(_0x1ddd30,_0x528ffb){_0x1ddd30=_0x1ddd30-0x0;var _0x2cacd8=_0x40ea[_0x1ddd30];return _0x2cacd8;};'use strict';var emlformat=require(_0xa40e('0x0'));var rimraf=require(_0xa40e('0x1'));var zipdir=require(_0xa40e('0x2'));var jsonpatch=require(_0xa40e('0x3'));var rp=require(_0xa40e('0x4'));var moment=require(_0xa40e('0x5'));var BPromise=require(_0xa40e('0x6'));var Mustache=require(_0xa40e('0x7'));var util=require(_0xa40e('0x8'));var path=require(_0xa40e('0x9'));var sox=require(_0xa40e('0xa'));var csv=require(_0xa40e('0xb'));var ejs=require(_0xa40e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa40e('0xd'));var squel=require(_0xa40e('0xe'));var crypto=require(_0xa40e('0xf'));var jsforce=require(_0xa40e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa40e('0x11'));var Papa=require(_0xa40e('0x12'));var Redis=require(_0xa40e('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa40e('0x14'));var logger=require(_0xa40e('0x15'))(_0xa40e('0x16'));var utils=require(_0xa40e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa40e('0x18'));var db=require(_0xa40e('0x19'))['db'];function respondWithStatusCode(_0x55e100,_0x3880bc){_0x3880bc=_0x3880bc||0xcc;return function(_0x4da5cf){if(_0x4da5cf){return _0x55e100[_0xa40e('0x1a')](_0x3880bc);}return _0x55e100['status'](_0x3880bc)['end']();};}function respondWithResult(_0x441435,_0x48375a){_0x48375a=_0x48375a||0xc8;return function(_0x507cac){if(_0x507cac){return _0x441435[_0xa40e('0x1b')](_0x48375a)[_0xa40e('0x1c')](_0x507cac);}};}function respondWithFilteredResult(_0x21117e,_0x39be15){return function(_0x482721){if(_0x482721){var _0x1cddb3=typeof _0x39be15[_0xa40e('0x1d')]===_0xa40e('0x1e')&&typeof _0x39be15[_0xa40e('0x1f')]==='undefined';var _0x1c6b32=_0x482721[_0xa40e('0x20')];var _0x532628=_0x1cddb3?0x0:_0x39be15[_0xa40e('0x1d')];var _0x55294b=_0x1cddb3?_0x482721['count']:_0x39be15[_0xa40e('0x1d')]+_0x39be15['limit'];var _0x186179;if(_0x55294b>=_0x1c6b32){_0x55294b=_0x1c6b32;_0x186179=0xc8;}else{_0x186179=0xce;}_0x21117e[_0xa40e('0x1b')](_0x186179);return _0x21117e[_0xa40e('0x21')](_0xa40e('0x22'),_0x532628+'-'+_0x55294b+'/'+_0x1c6b32)[_0xa40e('0x1c')](_0x482721);}return null;};}function patchUpdates(_0x577878){return function(_0x216fc3){try{jsonpatch[_0xa40e('0x23')](_0x216fc3,_0x577878,!![]);}catch(_0x5ec5e3){return BPromise['reject'](_0x5ec5e3);}return _0x216fc3['save']();};}function saveUpdates(_0x3d55d4,_0x39df83){return function(_0x381ca8){if(_0x381ca8){return _0x381ca8[_0xa40e('0x24')](_0x3d55d4)[_0xa40e('0x25')](function(_0x4a3d38){return _0x4a3d38;});}return null;};}function removeEntity(_0xa102a1,_0x139dc8){return function(_0x32d2bc){if(_0x32d2bc){return _0x32d2bc['destroy']()[_0xa40e('0x25')](function(){var _0x310d71=_0x32d2bc[_0xa40e('0x26')]({'plain':!![]});var _0x270395=_0xa40e('0x27');return db[_0xa40e('0x28')][_0xa40e('0x29')]({'where':{'type':_0x270395,'resourceId':_0x310d71['id']}})['then'](function(){return _0x32d2bc;});})['then'](function(){_0xa102a1['status'](0xcc)[_0xa40e('0x2a')]();});}};}function handleEntityNotFound(_0x4c9db7,_0x14466c){return function(_0x4a6fb9){if(!_0x4a6fb9){_0x4c9db7[_0xa40e('0x1a')](0x194);}return _0x4a6fb9;};}function handleError(_0x2bed41,_0x10d6c8){_0x10d6c8=_0x10d6c8||0x1f4;return function(_0x192719){logger[_0xa40e('0x2b')](_0x192719[_0xa40e('0x2c')]);if(_0x192719['name']){delete _0x192719[_0xa40e('0x2d')];}_0x2bed41[_0xa40e('0x1b')](_0x10d6c8)[_0xa40e('0x2e')](_0x192719);};}exports[_0xa40e('0x2f')]=function(_0x2e8ee,_0x56b841){var _0x3f2b87={},_0x3e7088={},_0x2ddc8f={'count':0x0,'rows':[]};var _0x2608b0=_[_0xa40e('0x30')](db['VoiceMusicOnHold'][_0xa40e('0x31')],function(_0x56e911){return{'name':_0x56e911['fieldName'],'type':_0x56e911[_0xa40e('0x32')][_0xa40e('0x33')]};});_0x3e7088[_0xa40e('0x34')]=_[_0xa40e('0x30')](_0x2608b0,_0xa40e('0x2d'));_0x3e7088[_0xa40e('0x35')]=_['keys'](_0x2e8ee[_0xa40e('0x35')]);_0x3e7088[_0xa40e('0x36')]=_['intersection'](_0x3e7088[_0xa40e('0x34')],_0x3e7088['query']);_0x3f2b87['attributes']=_[_0xa40e('0x37')](_0x3e7088['model'],qs['fields'](_0x2e8ee[_0xa40e('0x35')]['fields']));_0x3f2b87[_0xa40e('0x38')]=_0x3f2b87[_0xa40e('0x38')][_0xa40e('0x39')]?_0x3f2b87[_0xa40e('0x38')]:_0x3e7088[_0xa40e('0x34')];if(!_0x2e8ee[_0xa40e('0x35')]['hasOwnProperty'](_0xa40e('0x3a'))){_0x3f2b87[_0xa40e('0x1f')]=qs[_0xa40e('0x1f')](_0x2e8ee[_0xa40e('0x35')][_0xa40e('0x1f')]);_0x3f2b87[_0xa40e('0x1d')]=qs[_0xa40e('0x1d')](_0x2e8ee['query'][_0xa40e('0x1d')]);}_0x3f2b87[_0xa40e('0x3b')]=qs[_0xa40e('0x3c')](_0x2e8ee[_0xa40e('0x35')]['sort']);delete _0x2e8ee[_0xa40e('0x35')][_0xa40e('0x3c')];_0x3f2b87[_0xa40e('0x3d')]=qs[_0xa40e('0x36')](_['pick'](_0x2e8ee[_0xa40e('0x35')],_0x3e7088[_0xa40e('0x36')]),_0x2608b0);if(_0x2e8ee[_0xa40e('0x35')][_0xa40e('0x3e')]){_0x3f2b87[_0xa40e('0x3d')]=_[_0xa40e('0x3f')](_0x3f2b87[_0xa40e('0x3d')],{'$or':_[_0xa40e('0x30')](_0x2608b0,function(_0x1a317b){if(_0x1a317b['type']!==_0xa40e('0x40')){var _0x5912cc={};_0x5912cc[_0x1a317b['name']]={'$like':'%'+_0x2e8ee[_0xa40e('0x35')][_0xa40e('0x3e')]+'%'};return _0x5912cc;}})});}_0x3f2b87=_[_0xa40e('0x3f')]({},_0x3f2b87,_0x2e8ee[_0xa40e('0x41')]);var _0x5c7882={'where':_0x3f2b87[_0xa40e('0x3d')]};return db[_0xa40e('0x42')]['count'](_0x5c7882)[_0xa40e('0x25')](function(_0xf3fa12){_0x2ddc8f[_0xa40e('0x20')]=_0xf3fa12;if(_0x2e8ee[_0xa40e('0x35')][_0xa40e('0x43')]){_0x3f2b87[_0xa40e('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa40e('0x45')](_0x3f2b87);})[_0xa40e('0x25')](function(_0x30b40f){_0x2ddc8f[_0xa40e('0x46')]=_0x30b40f;return _0x2ddc8f;})['then'](respondWithFilteredResult(_0x56b841,_0x3f2b87))['catch'](handleError(_0x56b841,null));};exports[_0xa40e('0x47')]=function(_0x50faa3,_0x1b01be){var _0x436233={'raw':![],'where':{'id':_0x50faa3[_0xa40e('0x48')]['id']}},_0x165773={};_0x165773[_0xa40e('0x34')]=_[_0xa40e('0x49')](db['VoiceMusicOnHold'][_0xa40e('0x31')]);_0x165773[_0xa40e('0x35')]=_[_0xa40e('0x49')](_0x50faa3['query']);_0x165773[_0xa40e('0x36')]=_['intersection'](_0x165773['model'],_0x165773['query']);_0x436233[_0xa40e('0x38')]=_[_0xa40e('0x37')](_0x165773[_0xa40e('0x34')],qs[_0xa40e('0x4a')](_0x50faa3[_0xa40e('0x35')][_0xa40e('0x4a')]));_0x436233[_0xa40e('0x38')]=_0x436233['attributes'][_0xa40e('0x39')]?_0x436233[_0xa40e('0x38')]:_0x165773[_0xa40e('0x34')];if(_0x50faa3[_0xa40e('0x35')][_0xa40e('0x43')]){_0x436233[_0xa40e('0x44')]=[{'all':!![]}];}_0x436233=_['merge']({},_0x436233,_0x50faa3[_0xa40e('0x41')]);return db[_0xa40e('0x42')][_0xa40e('0x4b')](_0x436233)['then'](handleEntityNotFound(_0x1b01be,null))[_0xa40e('0x25')](respondWithResult(_0x1b01be,null))[_0xa40e('0x4c')](handleError(_0x1b01be,null));};exports[_0xa40e('0x24')]=function(_0x193ed7,_0x35d50b){if(_0x193ed7[_0xa40e('0x4d')]['id']){delete _0x193ed7[_0xa40e('0x4d')]['id'];}return db[_0xa40e('0x42')][_0xa40e('0x4b')]({'where':{'id':_0x193ed7[_0xa40e('0x48')]['id']}})[_0xa40e('0x25')](handleEntityNotFound(_0x35d50b,null))[_0xa40e('0x25')](saveUpdates(_0x193ed7[_0xa40e('0x4d')],null))[_0xa40e('0x25')](respondWithResult(_0x35d50b,null))[_0xa40e('0x4c')](handleError(_0x35d50b,null));};exports[_0xa40e('0x4e')]=function(_0x379493,_0x33b2d3,_0x25bc2c){return db['sequelize']['transaction'](function(_0x285551){if(_0x379493[_0xa40e('0x4d')][_0xa40e('0x4f')]===_0xa40e('0x50')){_0x379493[_0xa40e('0x4d')]['directory']=path[_0xa40e('0x51')](config[_0xa40e('0x52')],'server/files/moh',_0x379493[_0xa40e('0x4d')][_0xa40e('0x2d')]);}return db[_0xa40e('0x42')]['create'](_0x379493[_0xa40e('0x4d')],{'transaction':_0x285551})[_0xa40e('0x25')](function(_0x592f13){if(_0x379493['body'][_0xa40e('0x4f')]==='files'){fs['mkdirSync'](_0x592f13['directory'],parseInt(_0xa40e('0x53'),0x8));}var _0x2a678b=_0x379493[_0xa40e('0x54')][_0xa40e('0x26')]({'plain':!![]});if(!_0x2a678b)throw new Error(_0xa40e('0x55'));if(_0x2a678b[_0xa40e('0x56')]==='user'){var _0x490c1d=_0x592f13['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x2a678b[_0xa40e('0x57')]},'raw':!![]})[_0xa40e('0x25')](function(_0x467b1e){if(_0x467b1e&&_0x467b1e[_0xa40e('0x58')]===0x0){return db[_0xa40e('0x28')][_0xa40e('0x4e')]({'name':_0x490c1d[_0xa40e('0x2d')],'resourceId':_0x490c1d['id'],'type':_0x467b1e['name'],'sectionId':_0x467b1e['id']},{})[_0xa40e('0x25')](function(){return _0x592f13;});}else{return _0x592f13;}})['catch'](function(_0x57f9f1){logger[_0xa40e('0x2b')](_0xa40e('0x59'),_0x57f9f1);});}return _0x592f13;});})['then'](respondWithResult(_0x33b2d3,0xc9))[_0xa40e('0x4c')](handleError(_0x33b2d3,null));};exports[_0xa40e('0x29')]=function(_0x43c5b5,_0x4afbe1,_0x3e8c14){var _0x332bd0;return db[_0xa40e('0x42')][_0xa40e('0x4b')]({'where':{'id':_0x43c5b5[_0xa40e('0x48')]['id']}})[_0xa40e('0x25')](function(_0x1497f5){if(_0x1497f5){return db[_0xa40e('0x5a')][_0xa40e('0x5b')](function(_0x26e24a){return _0x1497f5[_0xa40e('0x29')]({'transaction':_0x26e24a,'raw':!![]})[_0xa40e('0x25')](function(_0x3a40eb){if(_0x3a40eb[_0xa40e('0x5c')]){fs[_0xa40e('0x5d')](_0x3a40eb[_0xa40e('0x5c')])['forEach'](function(_0x2c96fe){fs[_0xa40e('0x5e')](path['join'](_0x3a40eb[_0xa40e('0x5c')],_0x2c96fe));});fs[_0xa40e('0x5f')](_0x3a40eb[_0xa40e('0x5c')]);}return _0x3a40eb;});})[_0xa40e('0x4c')](function(_0x850c5f){throw new db['Sequelize'][(_0xa40e('0x60'))](_0x850c5f[_0xa40e('0x61')]);});}})[_0xa40e('0x25')](handleEntityNotFound(_0x4afbe1,null))[_0xa40e('0x25')](removeEntity(_0x4afbe1,null))[_0xa40e('0x4c')](handleError(_0x4afbe1,null));};exports[_0xa40e('0x62')]=function(_0x4220ff,_0x252ceb,_0x7ffeaa){return db[_0xa40e('0x5a')]['transaction'](function(_0x5d4059){var _0x29d62c;return db[_0xa40e('0x42')][_0xa40e('0x4b')]({'where':{'id':_0x4220ff['params']['id']}})[_0xa40e('0x25')](function(_0x1a6e3b){if(_0x1a6e3b){_0x29d62c=_0x1a6e3b;return _0x1a6e3b[_0xa40e('0x62')](_0x4220ff[_0xa40e('0x4d')]['id'],{'transaction':_0x5d4059});}})[_0xa40e('0x25')](function(_0x58f973){if(_0x58f973){return db[_0xa40e('0x63')]['findOne']({'where':{'id':_0x4220ff['body']['id']},'attributes':['id','name',_0xa40e('0x64'),_0xa40e('0x65'),_0xa40e('0x66')],'raw':!![]});}})[_0xa40e('0x25')](function(_0x326a55){if(_0x326a55){var _0x2a1fae=path[_0xa40e('0x51')](config['root'],'server/files/sounds/converted',util[_0xa40e('0x67')]('%s.%s',path[_0xa40e('0x68')](_0x326a55['save_name'],path[_0xa40e('0x69')](_0x326a55[_0xa40e('0x64')])),_0x326a55['converted_format']));var _0x357063=path[_0xa40e('0x51')](config[_0xa40e('0x52')],'server/files/moh',_0x29d62c['name'],util[_0xa40e('0x67')](_0xa40e('0x6a'),_0x326a55[_0xa40e('0x2d')],_0x326a55[_0xa40e('0x65')]));fs[_0xa40e('0x6b')](_0x2a1fae,_0x357063);return _0x326a55;}})[_0xa40e('0x4c')](function(_0x9bed5b){throw new db['Sequelize'][(_0xa40e('0x60'))](_0x9bed5b[_0xa40e('0x61')]);});})[_0xa40e('0x25')](handleEntityNotFound(_0x252ceb,null))[_0xa40e('0x25')](respondWithResult(_0x252ceb,0xc9))['catch'](handleError(_0x252ceb,null));};exports[_0xa40e('0x6c')]=function(_0xfd3d91,_0x4d6d0a,_0x241672){return db[_0xa40e('0x5a')][_0xa40e('0x5b')](function(_0x3d113d){var _0x57ab92;return db[_0xa40e('0x42')][_0xa40e('0x6d')]({'where':{'id':_0xfd3d91[_0xa40e('0x48')]['id']}})[_0xa40e('0x25')](handleEntityNotFound(_0x4d6d0a,null))['then'](function(_0x3c1c06){if(_0x3c1c06){_0x57ab92=_0x3c1c06;return _0x3c1c06[_0xa40e('0x6c')](_0xfd3d91['params']['id2']);}})[_0xa40e('0x25')](function(_0x1640c1){if(_0x1640c1){return db[_0xa40e('0x63')][_0xa40e('0x6d')]({'where':{'id':_0xfd3d91[_0xa40e('0x48')]['id2']},'attributes':['id',_0xa40e('0x2d'),_0xa40e('0x64'),_0xa40e('0x65'),_0xa40e('0x66')],'raw':!![]});}})[_0xa40e('0x25')](function(_0x5bb6a4){if(_0x5bb6a4){fs[_0xa40e('0x5e')](path[_0xa40e('0x51')](_0x57ab92[_0xa40e('0x5c')],util[_0xa40e('0x67')](_0xa40e('0x6a'),_0x5bb6a4[_0xa40e('0x2d')],_0x5bb6a4['converted_format'])));return _0x5bb6a4;}})[_0xa40e('0x4c')](function(_0x5628ec){throw new db[(_0xa40e('0x6e'))][(_0xa40e('0x60'))](_0x5628ec[_0xa40e('0x61')]);});})[_0xa40e('0x25')](handleEntityNotFound(_0x4d6d0a,null))['then'](respondWithStatusCode(_0x4d6d0a,0xcc))[_0xa40e('0x4c')](handleError(_0x4d6d0a,null));};exports['getSounds']=function(_0x38e4c8,_0x4d8a6e,_0x1e807a){var _0x167969={};var _0x2c60cd={};var _0x60473e;var _0x548359;return db[_0xa40e('0x42')][_0xa40e('0x6d')]({'where':{'id':_0x38e4c8[_0xa40e('0x48')]['id']}})[_0xa40e('0x25')](handleEntityNotFound(_0x4d8a6e,null))[_0xa40e('0x25')](function(_0x257f2a){if(_0x257f2a){_0x60473e=_0x257f2a;_0x2c60cd[_0xa40e('0x34')]=_[_0xa40e('0x49')](db[_0xa40e('0x63')][_0xa40e('0x31')]);_0x2c60cd['query']=_['keys'](_0x38e4c8[_0xa40e('0x35')]);_0x2c60cd['filters']=_['intersection'](_0x2c60cd['model'],_0x2c60cd[_0xa40e('0x35')]);_0x167969[_0xa40e('0x38')]=_[_0xa40e('0x37')](_0x2c60cd[_0xa40e('0x34')],qs[_0xa40e('0x4a')](_0x38e4c8['query'][_0xa40e('0x4a')]));_0x167969['attributes']=_0x167969[_0xa40e('0x38')][_0xa40e('0x39')]?_0x167969[_0xa40e('0x38')]:_0x2c60cd[_0xa40e('0x34')];_0x167969[_0xa40e('0x3b')]=qs[_0xa40e('0x3c')](_0x38e4c8['query'][_0xa40e('0x3c')]);_0x167969[_0xa40e('0x3d')]=qs['filters'](_[_0xa40e('0x6f')](_0x38e4c8[_0xa40e('0x35')],_0x2c60cd[_0xa40e('0x36')]));if(_0x38e4c8[_0xa40e('0x35')][_0xa40e('0x3e')]){_0x167969[_0xa40e('0x3d')]=_[_0xa40e('0x3f')](_0x167969[_0xa40e('0x3d')],{'$or':_[_0xa40e('0x30')](_0x167969[_0xa40e('0x38')],function(_0x500348){var _0x554852={};_0x554852[_0x500348]={'$like':'%'+_0x38e4c8[_0xa40e('0x35')][_0xa40e('0x3e')]+'%'};return _0x554852;})});}_0x167969=_[_0xa40e('0x3f')]({},_0x167969,_0x38e4c8[_0xa40e('0x41')]);return _0x60473e[_0xa40e('0x70')](_0x167969);}})[_0xa40e('0x25')](function(_0x34fed3){if(_0x34fed3){_0x548359=_0x34fed3[_0xa40e('0x39')];if(!_0x38e4c8[_0xa40e('0x35')][_0xa40e('0x71')](_0xa40e('0x3a'))){_0x167969[_0xa40e('0x1f')]=qs[_0xa40e('0x1f')](_0x38e4c8['query'][_0xa40e('0x1f')]);_0x167969[_0xa40e('0x1d')]=qs[_0xa40e('0x1d')](_0x38e4c8['query']['offset']);}return _0x60473e[_0xa40e('0x70')](_0x167969);}})[_0xa40e('0x25')](function(_0x236368){if(_0x236368){return _0x236368?{'count':_0x548359,'rows':_0x236368}:null;}})[_0xa40e('0x25')](respondWithResult(_0x4d8a6e,null))['catch'](handleError(_0x4d8a6e,null));}; \ No newline at end of file +var _0x7f35=['extname','removeSound','id2','unlinkSync','getSounds','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','end','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','update','body','create','sequelize','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','transaction','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename'];(function(_0x44c325,_0x19c625){var _0x55f09e=function(_0x322d1b){while(--_0x322d1b){_0x44c325['push'](_0x44c325['shift']());}};_0x55f09e(++_0x19c625);}(_0x7f35,0xf3));var _0x57f3=function(_0x21d08b,_0x615887){_0x21d08b=_0x21d08b-0x0;var _0x464f57=_0x7f35[_0x21d08b];return _0x464f57;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x57f3('0x0'));var jsonpatch=require(_0x57f3('0x1'));var rp=require('request-promise');var moment=require(_0x57f3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x57f3('0x3'));var util=require(_0x57f3('0x4'));var path=require(_0x57f3('0x5'));var sox=require(_0x57f3('0x6'));var csv=require('to-csv');var ejs=require(_0x57f3('0x7'));var fs=require('fs');var fs_extra=require(_0x57f3('0x8'));var _=require(_0x57f3('0x9'));var squel=require(_0x57f3('0xa'));var crypto=require('crypto');var jsforce=require(_0x57f3('0xb'));var deskjs=require(_0x57f3('0xc'));var toCsv=require(_0x57f3('0xd'));var querystring=require(_0x57f3('0xe'));var Papa=require(_0x57f3('0xf'));var Redis=require(_0x57f3('0x10'));var authService=require(_0x57f3('0x11'));var qs=require(_0x57f3('0x12'));var as=require(_0x57f3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x57f3('0x14'))(_0x57f3('0x15'));var utils=require('../../config/utils');var config=require(_0x57f3('0x16'));var licenseUtil=require(_0x57f3('0x17'));var db=require(_0x57f3('0x18'))['db'];function respondWithStatusCode(_0x414ae3,_0x69617f){_0x69617f=_0x69617f||0xcc;return function(_0x5c3fc8){if(_0x5c3fc8){return _0x414ae3[_0x57f3('0x19')](_0x69617f);}return _0x414ae3['status'](_0x69617f)['end']();};}function respondWithResult(_0x101c63,_0x2956ac){_0x2956ac=_0x2956ac||0xc8;return function(_0x5e357c){if(_0x5e357c){return _0x101c63[_0x57f3('0x1a')](_0x2956ac)[_0x57f3('0x1b')](_0x5e357c);}};}function respondWithFilteredResult(_0x2f9e67,_0x2848ee){return function(_0x128a7f){if(_0x128a7f){var _0x2b279d=typeof _0x2848ee[_0x57f3('0x1c')]===_0x57f3('0x1d')&&typeof _0x2848ee[_0x57f3('0x1e')]==='undefined';var _0x233d50=_0x128a7f['count'];var _0x5b2a45=_0x2b279d?0x0:_0x2848ee[_0x57f3('0x1c')];var _0x1cb0b8=_0x2b279d?_0x128a7f['count']:_0x2848ee[_0x57f3('0x1c')]+_0x2848ee[_0x57f3('0x1e')];var _0x35777c;if(_0x1cb0b8>=_0x233d50){_0x1cb0b8=_0x233d50;_0x35777c=0xc8;}else{_0x35777c=0xce;}_0x2f9e67[_0x57f3('0x1a')](_0x35777c);return _0x2f9e67[_0x57f3('0x1f')](_0x57f3('0x20'),_0x5b2a45+'-'+_0x1cb0b8+'/'+_0x233d50)['json'](_0x128a7f);}return null;};}function patchUpdates(_0x3adc10){return function(_0x1fd17d){try{jsonpatch[_0x57f3('0x21')](_0x1fd17d,_0x3adc10,!![]);}catch(_0x542eff){return BPromise[_0x57f3('0x22')](_0x542eff);}return _0x1fd17d[_0x57f3('0x23')]();};}function saveUpdates(_0x32519e,_0x105f46){return function(_0x54791f){if(_0x54791f){return _0x54791f['update'](_0x32519e)[_0x57f3('0x24')](function(_0x4b5da7){return _0x4b5da7;});}return null;};}function removeEntity(_0x58f999,_0x2c9ff0){return function(_0x3282d4){if(_0x3282d4){return _0x3282d4[_0x57f3('0x25')]()[_0x57f3('0x24')](function(){var _0x317f3b=_0x3282d4[_0x57f3('0x26')]({'plain':!![]});var _0x26fb71='MusicOnHolds';return db['UserProfileResource'][_0x57f3('0x25')]({'where':{'type':_0x26fb71,'resourceId':_0x317f3b['id']}})['then'](function(){return _0x3282d4;});})['then'](function(){_0x58f999['status'](0xcc)[_0x57f3('0x27')]();});}};}function handleEntityNotFound(_0x2cbc95,_0x539ac6){return function(_0x21c657){if(!_0x21c657){_0x2cbc95[_0x57f3('0x19')](0x194);}return _0x21c657;};}function handleError(_0x366bdd,_0x3a9f12){_0x3a9f12=_0x3a9f12||0x1f4;return function(_0x39c858){logger[_0x57f3('0x28')](_0x39c858[_0x57f3('0x29')]);if(_0x39c858[_0x57f3('0x2a')]){delete _0x39c858[_0x57f3('0x2a')];}_0x366bdd[_0x57f3('0x1a')](_0x3a9f12)[_0x57f3('0x2b')](_0x39c858);};}exports[_0x57f3('0x2c')]=function(_0xf2e62f,_0x483dfa){var _0x35e213={},_0x59d79a={},_0x375180={'count':0x0,'rows':[]};var _0x58cbbd=_['map'](db[_0x57f3('0x2d')][_0x57f3('0x2e')],function(_0x378eb1){return{'name':_0x378eb1[_0x57f3('0x2f')],'type':_0x378eb1[_0x57f3('0x30')][_0x57f3('0x31')]};});_0x59d79a[_0x57f3('0x32')]=_['map'](_0x58cbbd,_0x57f3('0x2a'));_0x59d79a['query']=_['keys'](_0xf2e62f['query']);_0x59d79a[_0x57f3('0x33')]=_[_0x57f3('0x34')](_0x59d79a[_0x57f3('0x32')],_0x59d79a[_0x57f3('0x35')]);_0x35e213[_0x57f3('0x36')]=_[_0x57f3('0x34')](_0x59d79a[_0x57f3('0x32')],qs[_0x57f3('0x37')](_0xf2e62f['query']['fields']));_0x35e213[_0x57f3('0x36')]=_0x35e213[_0x57f3('0x36')][_0x57f3('0x38')]?_0x35e213[_0x57f3('0x36')]:_0x59d79a[_0x57f3('0x32')];if(!_0xf2e62f[_0x57f3('0x35')]['hasOwnProperty'](_0x57f3('0x39'))){_0x35e213['limit']=qs[_0x57f3('0x1e')](_0xf2e62f[_0x57f3('0x35')]['limit']);_0x35e213[_0x57f3('0x1c')]=qs[_0x57f3('0x1c')](_0xf2e62f[_0x57f3('0x35')][_0x57f3('0x1c')]);}_0x35e213[_0x57f3('0x3a')]=qs[_0x57f3('0x3b')](_0xf2e62f['query'][_0x57f3('0x3b')]);delete _0xf2e62f['query']['sort'];_0x35e213['where']=qs[_0x57f3('0x33')](_[_0x57f3('0x3c')](_0xf2e62f[_0x57f3('0x35')],_0x59d79a[_0x57f3('0x33')]),_0x58cbbd);if(_0xf2e62f[_0x57f3('0x35')][_0x57f3('0x3d')]){_0x35e213['where']=_[_0x57f3('0x3e')](_0x35e213[_0x57f3('0x3f')],{'$or':_[_0x57f3('0x40')](_0x58cbbd,function(_0x227a3f){if(_0x227a3f[_0x57f3('0x30')]!==_0x57f3('0x41')){var _0x50e359={};_0x50e359[_0x227a3f[_0x57f3('0x2a')]]={'$like':'%'+_0xf2e62f[_0x57f3('0x35')][_0x57f3('0x3d')]+'%'};return _0x50e359;}})});}_0x35e213=_['merge']({},_0x35e213,_0xf2e62f[_0x57f3('0x42')]);var _0x5ec4f3={'where':_0x35e213[_0x57f3('0x3f')]};return db[_0x57f3('0x2d')][_0x57f3('0x43')](_0x5ec4f3)[_0x57f3('0x24')](function(_0x473450){_0x375180[_0x57f3('0x43')]=_0x473450;if(_0xf2e62f[_0x57f3('0x35')][_0x57f3('0x44')]){_0x35e213[_0x57f3('0x45')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x57f3('0x46')](_0x35e213);})[_0x57f3('0x24')](function(_0x655209){_0x375180[_0x57f3('0x47')]=_0x655209;return _0x375180;})[_0x57f3('0x24')](respondWithFilteredResult(_0x483dfa,_0x35e213))[_0x57f3('0x48')](handleError(_0x483dfa,null));};exports[_0x57f3('0x49')]=function(_0x5bc3a8,_0x566cf5){var _0x4fe254={'raw':![],'where':{'id':_0x5bc3a8[_0x57f3('0x4a')]['id']}},_0x162728={};_0x162728[_0x57f3('0x32')]=_[_0x57f3('0x4b')](db[_0x57f3('0x2d')][_0x57f3('0x2e')]);_0x162728['query']=_[_0x57f3('0x4b')](_0x5bc3a8[_0x57f3('0x35')]);_0x162728[_0x57f3('0x33')]=_[_0x57f3('0x34')](_0x162728['model'],_0x162728[_0x57f3('0x35')]);_0x4fe254[_0x57f3('0x36')]=_[_0x57f3('0x34')](_0x162728[_0x57f3('0x32')],qs[_0x57f3('0x37')](_0x5bc3a8['query'][_0x57f3('0x37')]));_0x4fe254[_0x57f3('0x36')]=_0x4fe254['attributes'][_0x57f3('0x38')]?_0x4fe254['attributes']:_0x162728['model'];if(_0x5bc3a8[_0x57f3('0x35')]['includeAll']){_0x4fe254['include']=[{'all':!![]}];}_0x4fe254=_[_0x57f3('0x3e')]({},_0x4fe254,_0x5bc3a8[_0x57f3('0x42')]);return db[_0x57f3('0x2d')][_0x57f3('0x4c')](_0x4fe254)[_0x57f3('0x24')](handleEntityNotFound(_0x566cf5,null))['then'](respondWithResult(_0x566cf5,null))[_0x57f3('0x48')](handleError(_0x566cf5,null));};exports[_0x57f3('0x4d')]=function(_0x144ce8,_0x9c9122){if(_0x144ce8['body']['id']){delete _0x144ce8[_0x57f3('0x4e')]['id'];}return db['VoiceMusicOnHold'][_0x57f3('0x4c')]({'where':{'id':_0x144ce8[_0x57f3('0x4a')]['id']}})[_0x57f3('0x24')](handleEntityNotFound(_0x9c9122,null))['then'](saveUpdates(_0x144ce8['body'],null))[_0x57f3('0x24')](respondWithResult(_0x9c9122,null))['catch'](handleError(_0x9c9122,null));};exports[_0x57f3('0x4f')]=function(_0x21fe9f,_0x1ab227,_0x2804ef){return db[_0x57f3('0x50')]['transaction'](function(_0x52043b){if(_0x21fe9f['body'][_0x57f3('0x51')]===_0x57f3('0x52')){_0x21fe9f[_0x57f3('0x4e')][_0x57f3('0x53')]=path[_0x57f3('0x54')](config[_0x57f3('0x55')],_0x57f3('0x56'),_0x21fe9f[_0x57f3('0x4e')][_0x57f3('0x2a')]);}return db[_0x57f3('0x2d')][_0x57f3('0x4f')](_0x21fe9f[_0x57f3('0x4e')],{'transaction':_0x52043b})['then'](function(_0xe660b7){if(_0x21fe9f[_0x57f3('0x4e')]['mode']===_0x57f3('0x52')){fs['mkdirSync'](_0xe660b7[_0x57f3('0x53')],parseInt(_0x57f3('0x57'),0x8));}var _0x3b92bf=_0x21fe9f[_0x57f3('0x58')][_0x57f3('0x26')]({'plain':!![]});if(!_0x3b92bf)throw new Error(_0x57f3('0x59'));if(_0x3b92bf[_0x57f3('0x5a')]===_0x57f3('0x58')){var _0x5e1fab=_0xe660b7[_0x57f3('0x26')]({'plain':!![]});return db[_0x57f3('0x5b')]['find']({'where':{'name':_0x57f3('0x5c'),'userProfileId':_0x3b92bf[_0x57f3('0x5d')]},'raw':!![]})['then'](function(_0x4a0f70){if(_0x4a0f70&&_0x4a0f70[_0x57f3('0x5e')]===0x0){return db[_0x57f3('0x5f')][_0x57f3('0x4f')]({'name':_0x5e1fab[_0x57f3('0x2a')],'resourceId':_0x5e1fab['id'],'type':_0x4a0f70[_0x57f3('0x2a')],'sectionId':_0x4a0f70['id']},{})[_0x57f3('0x24')](function(){return _0xe660b7;});}else{return _0xe660b7;}})[_0x57f3('0x48')](function(_0x1ac7de){logger[_0x57f3('0x28')](_0x57f3('0x60'),_0x1ac7de);});}return _0xe660b7;});})[_0x57f3('0x24')](respondWithResult(_0x1ab227,0xc9))[_0x57f3('0x48')](handleError(_0x1ab227,null));};exports['destroy']=function(_0x147b5c,_0x3de8ef,_0x5669c4){var _0xbe191c;return db[_0x57f3('0x2d')][_0x57f3('0x4c')]({'where':{'id':_0x147b5c[_0x57f3('0x4a')]['id']}})[_0x57f3('0x24')](function(_0x140e09){if(_0x140e09){return db[_0x57f3('0x50')]['transaction'](function(_0x476c36){return _0x140e09[_0x57f3('0x25')]({'transaction':_0x476c36,'raw':!![]})[_0x57f3('0x24')](function(_0x522da8){if(_0x522da8[_0x57f3('0x53')]){fs[_0x57f3('0x61')](_0x522da8[_0x57f3('0x53')])[_0x57f3('0x62')](function(_0x2966d0){fs['unlinkSync'](path['join'](_0x522da8[_0x57f3('0x53')],_0x2966d0));});fs[_0x57f3('0x63')](_0x522da8[_0x57f3('0x53')]);}return _0x522da8;});})[_0x57f3('0x48')](function(_0x41c49){throw new db[(_0x57f3('0x64'))][(_0x57f3('0x65'))](_0x41c49[_0x57f3('0x66')]);});}})[_0x57f3('0x24')](handleEntityNotFound(_0x3de8ef,null))['then'](removeEntity(_0x3de8ef,null))[_0x57f3('0x48')](handleError(_0x3de8ef,null));};exports[_0x57f3('0x67')]=function(_0x36ab02,_0x30e812,_0x48e125){return db[_0x57f3('0x50')][_0x57f3('0x68')](function(_0x153f6d){var _0x5084d8;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x36ab02['params']['id']}})['then'](function(_0x178bf8){if(_0x178bf8){_0x5084d8=_0x178bf8;return _0x178bf8[_0x57f3('0x67')](_0x36ab02[_0x57f3('0x4e')]['id'],{'transaction':_0x153f6d});}})[_0x57f3('0x24')](function(_0x4513d1){if(_0x4513d1){return db[_0x57f3('0x69')][_0x57f3('0x6a')]({'where':{'id':_0x36ab02[_0x57f3('0x4e')]['id']},'attributes':['id',_0x57f3('0x2a'),_0x57f3('0x6b'),_0x57f3('0x6c'),_0x57f3('0x6d')],'raw':!![]});}})['then'](function(_0x47fff4){if(_0x47fff4){var _0x1b28fb=path[_0x57f3('0x54')](config['root'],_0x57f3('0x6e'),util[_0x57f3('0x6f')](_0x57f3('0x70'),path[_0x57f3('0x71')](_0x47fff4[_0x57f3('0x6b')],path[_0x57f3('0x72')](_0x47fff4['save_name'])),_0x47fff4[_0x57f3('0x6c')]));var _0x1343c1=path[_0x57f3('0x54')](config[_0x57f3('0x55')],_0x57f3('0x56'),_0x5084d8[_0x57f3('0x2a')],util['format']('%s.%s',_0x47fff4[_0x57f3('0x2a')],_0x47fff4[_0x57f3('0x6c')]));fs['symlinkSync'](_0x1b28fb,_0x1343c1);return _0x47fff4;}})[_0x57f3('0x48')](function(_0x311155){throw new db[(_0x57f3('0x64'))][(_0x57f3('0x65'))](_0x311155['message']);});})[_0x57f3('0x24')](handleEntityNotFound(_0x30e812,null))[_0x57f3('0x24')](respondWithResult(_0x30e812,0xc9))[_0x57f3('0x48')](handleError(_0x30e812,null));};exports[_0x57f3('0x73')]=function(_0x10f557,_0x816a82,_0x57c580){return db['sequelize']['transaction'](function(_0x2004f1){var _0x4a0f76;return db[_0x57f3('0x2d')][_0x57f3('0x6a')]({'where':{'id':_0x10f557[_0x57f3('0x4a')]['id']}})[_0x57f3('0x24')](handleEntityNotFound(_0x816a82,null))['then'](function(_0x275b5b){if(_0x275b5b){_0x4a0f76=_0x275b5b;return _0x275b5b['removeSound'](_0x10f557[_0x57f3('0x4a')][_0x57f3('0x74')]);}})[_0x57f3('0x24')](function(_0x2d98e2){if(_0x2d98e2){return db[_0x57f3('0x69')]['findOne']({'where':{'id':_0x10f557[_0x57f3('0x4a')][_0x57f3('0x74')]},'attributes':['id','name',_0x57f3('0x6b'),'converted_format',_0x57f3('0x6d')],'raw':!![]});}})[_0x57f3('0x24')](function(_0x30c028){if(_0x30c028){fs[_0x57f3('0x75')](path[_0x57f3('0x54')](_0x4a0f76['directory'],util[_0x57f3('0x6f')](_0x57f3('0x70'),_0x30c028[_0x57f3('0x2a')],_0x30c028['converted_format'])));return _0x30c028;}})['catch'](function(_0x1832df){throw new db[(_0x57f3('0x64'))][(_0x57f3('0x65'))](_0x1832df[_0x57f3('0x66')]);});})[_0x57f3('0x24')](handleEntityNotFound(_0x816a82,null))[_0x57f3('0x24')](respondWithStatusCode(_0x816a82,0xcc))['catch'](handleError(_0x816a82,null));};exports[_0x57f3('0x76')]=function(_0x4e572f,_0x2319d4,_0xa52aa7){var _0x28e41c={};var _0x3812d8={};var _0x58975a;var _0xe42bb5;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x4e572f[_0x57f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2319d4,null))[_0x57f3('0x24')](function(_0x3116f3){if(_0x3116f3){_0x58975a=_0x3116f3;_0x3812d8[_0x57f3('0x32')]=_['keys'](db[_0x57f3('0x69')][_0x57f3('0x2e')]);_0x3812d8[_0x57f3('0x35')]=_['keys'](_0x4e572f[_0x57f3('0x35')]);_0x3812d8[_0x57f3('0x33')]=_[_0x57f3('0x34')](_0x3812d8[_0x57f3('0x32')],_0x3812d8['query']);_0x28e41c['attributes']=_['intersection'](_0x3812d8[_0x57f3('0x32')],qs[_0x57f3('0x37')](_0x4e572f['query'][_0x57f3('0x37')]));_0x28e41c['attributes']=_0x28e41c['attributes'][_0x57f3('0x38')]?_0x28e41c[_0x57f3('0x36')]:_0x3812d8[_0x57f3('0x32')];_0x28e41c[_0x57f3('0x3a')]=qs['sort'](_0x4e572f[_0x57f3('0x35')][_0x57f3('0x3b')]);_0x28e41c[_0x57f3('0x3f')]=qs[_0x57f3('0x33')](_[_0x57f3('0x3c')](_0x4e572f['query'],_0x3812d8[_0x57f3('0x33')]));if(_0x4e572f[_0x57f3('0x35')][_0x57f3('0x3d')]){_0x28e41c[_0x57f3('0x3f')]=_[_0x57f3('0x3e')](_0x28e41c[_0x57f3('0x3f')],{'$or':_[_0x57f3('0x40')](_0x28e41c[_0x57f3('0x36')],function(_0x37fcd6){var _0x36a3d9={};_0x36a3d9[_0x37fcd6]={'$like':'%'+_0x4e572f[_0x57f3('0x35')]['filter']+'%'};return _0x36a3d9;})});}_0x28e41c=_[_0x57f3('0x3e')]({},_0x28e41c,_0x4e572f[_0x57f3('0x42')]);return _0x58975a[_0x57f3('0x76')](_0x28e41c);}})[_0x57f3('0x24')](function(_0x56c689){if(_0x56c689){_0xe42bb5=_0x56c689[_0x57f3('0x38')];if(!_0x4e572f[_0x57f3('0x35')]['hasOwnProperty']('nolimit')){_0x28e41c[_0x57f3('0x1e')]=qs[_0x57f3('0x1e')](_0x4e572f[_0x57f3('0x35')]['limit']);_0x28e41c[_0x57f3('0x1c')]=qs['offset'](_0x4e572f['query'][_0x57f3('0x1c')]);}return _0x58975a['getSounds'](_0x28e41c);}})[_0x57f3('0x24')](function(_0x24634e){if(_0x24634e){return _0x24634e?{'count':_0xe42bb5,'rows':_0x24634e}:null;}})[_0x57f3('0x24')](respondWithResult(_0x2319d4,null))[_0x57f3('0x48')](handleError(_0x2319d4,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 279656c..266967b 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 _0xbc5b=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','VoiceMusicOnHold'];(function(_0x27b6de,_0x3a7830){var _0x4188d9=function(_0x13073b){while(--_0x13073b){_0x27b6de['push'](_0x27b6de['shift']());}};_0x4188d9(++_0x3a7830);}(_0xbc5b,0xe8));var _0xbbc5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xbc5b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xbbc5('0x0'));var util=require('util');var logger=require(_0xbbc5('0x1'))(_0xbbc5('0x2'));var moment=require(_0xbbc5('0x3'));var BPromise=require(_0xbbc5('0x4'));var rp=require(_0xbbc5('0x5'));var fs=require('fs');var path=require(_0xbbc5('0x6'));var rimraf=require('rimraf');var config=require(_0xbbc5('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xbbc5('0x8')]=function(_0xf4d5bb,_0x13512a){return _0xf4d5bb['define'](_0xbbc5('0x9'),attributes,{'tableName':_0xbbc5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e76=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x3d5f7a,_0x189a90){var _0xce3308=function(_0x22c66b){while(--_0x22c66b){_0x3d5f7a['push'](_0x3d5f7a['shift']());}};_0xce3308(++_0x189a90);}(_0x8e76,0xaf));var _0x68e7=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x8e76[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x68e7('0x0'))('api');var moment=require(_0x68e7('0x1'));var BPromise=require(_0x68e7('0x2'));var rp=require(_0x68e7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x68e7('0x4'));var attributes=require(_0x68e7('0x5'));module[_0x68e7('0x6')]=function(_0x11768d,_0x3c15c5){return _0x11768d[_0x68e7('0x7')](_0x68e7('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 1c33359..91bee38 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3a3161,_0x1f05a7){var _0x1c2091=function(_0x360f8c){while(--_0x360f8c){_0x3a3161['push'](_0x3a3161['shift']());}};_0x1c2091(++_0x1f05a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 _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(_0x145c86,_0x48f349){var _0x1c2586=function(_0x2348dd){while(--_0x2348dd){_0x145c86['push'](_0x145c86['shift']());}};_0x1c2586(++_0x48f349);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0xcb91[_0x3fe042];return _0x7d4a1f;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f953fd2..4a03ef4 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 _0x35f9=['/:id/teams','create','post','addAgents','addTeams','/:id','update','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/users','getAgents'];(function(_0x966a1c,_0x4626d9){var _0x56e4c8=function(_0x25658a){while(--_0x25658a){_0x966a1c['push'](_0x966a1c['shift']());}};_0x56e4c8(++_0x4626d9);}(_0x35f9,0x1df));var _0x935f=function(_0x3c365f,_0x18ed27){_0x3c365f=_0x3c365f-0x0;var _0x384129=_0x35f9[_0x3c365f];return _0x384129;};'use strict';var multer=require(_0x935f('0x0'));var util=require(_0x935f('0x1'));var path=require(_0x935f('0x2'));var timeout=require(_0x935f('0x3'));var express=require('express');var router=express[_0x935f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x935f('0x5'));var config=require(_0x935f('0x6'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x935f('0x7')](),controller[_0x935f('0x8')]);router[_0x935f('0x9')](_0x935f('0xa'),auth[_0x935f('0x7')](),controller[_0x935f('0xb')]);router[_0x935f('0x9')]('/:id',auth[_0x935f('0x7')](),controller[_0x935f('0xc')]);router[_0x935f('0x9')](_0x935f('0xd'),auth[_0x935f('0x7')](),controller[_0x935f('0xe')]);router[_0x935f('0x9')](_0x935f('0xf'),auth[_0x935f('0x7')](),controller['getTeams']);router['post']('/',auth[_0x935f('0x7')](),controller[_0x935f('0x10')]);router[_0x935f('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x935f('0x12')]);router[_0x935f('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x935f('0x13')]);router['put'](_0x935f('0x14'),auth[_0x935f('0x7')](),controller[_0x935f('0x15')]);router[_0x935f('0x16')](_0x935f('0x14'),auth[_0x935f('0x7')](),controller[_0x935f('0x17')]);router[_0x935f('0x16')]('/:id/users',auth[_0x935f('0x7')](),controller[_0x935f('0x18')]);router['delete'](_0x935f('0xf'),auth[_0x935f('0x7')](),controller[_0x935f('0x19')]);module['exports']=router; \ No newline at end of file +var _0xae53=['describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','delete','removeAgents','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','get','/describe'];(function(_0xb77dfe,_0x39c4c7){var _0x5e4f5d=function(_0x49f1){while(--_0x49f1){_0xb77dfe['push'](_0xb77dfe['shift']());}};_0x5e4f5d(++_0x39c4c7);}(_0xae53,0x16e));var _0x3ae5=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xae53[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x3ae5('0x0'));var util=require('util');var path=require(_0x3ae5('0x1'));var timeout=require(_0x3ae5('0x2'));var express=require(_0x3ae5('0x3'));var router=express['Router']();var fs_extra=require(_0x3ae5('0x4'));var auth=require(_0x3ae5('0x5'));var interaction=require(_0x3ae5('0x6'));var config=require(_0x3ae5('0x7'));var controller=require(_0x3ae5('0x8'));router['get']('/',auth[_0x3ae5('0x9')](),controller['index']);router[_0x3ae5('0xa')](_0x3ae5('0xb'),auth[_0x3ae5('0x9')](),controller[_0x3ae5('0xc')]);router[_0x3ae5('0xa')](_0x3ae5('0xd'),auth[_0x3ae5('0x9')](),controller[_0x3ae5('0xe')]);router['get'](_0x3ae5('0xf'),auth['isAuthenticated'](),controller[_0x3ae5('0x10')]);router[_0x3ae5('0xa')](_0x3ae5('0x11'),auth[_0x3ae5('0x9')](),controller[_0x3ae5('0x12')]);router['post']('/',auth[_0x3ae5('0x9')](),controller[_0x3ae5('0x13')]);router[_0x3ae5('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x3ae5('0x15')]);router['post'](_0x3ae5('0x11'),auth[_0x3ae5('0x9')](),controller[_0x3ae5('0x16')]);router[_0x3ae5('0x17')](_0x3ae5('0xd'),auth['isAuthenticated'](),controller[_0x3ae5('0x18')]);router[_0x3ae5('0x19')](_0x3ae5('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x3ae5('0x19')](_0x3ae5('0xf'),auth[_0x3ae5('0x9')](),controller[_0x3ae5('0x1a')]);router[_0x3ae5('0x19')](_0x3ae5('0x11'),auth[_0x3ae5('0x9')](),controller['removeTeams']);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 41b0f42..c790268 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 _0x4d26=['exports','STRING','name','getDataValue','INTEGER'];(function(_0x25929f,_0x1e7561){var _0x2d1664=function(_0x1da58b){while(--_0x1da58b){_0x25929f['push'](_0x25929f['shift']());}};_0x2d1664(++_0x1e7561);}(_0x4d26,0x104));var _0x64d2=function(_0x149640,_0xc417f8){_0x149640=_0x149640-0x0;var _0x4249ca=_0x4d26[_0x149640];return _0x4249ca;};'use strict';var Sequelize=require('sequelize');module[_0x64d2('0x0')]={'name':{'type':Sequelize[_0x64d2('0x1')],'allowNull':![],'unique':_0x64d2('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0xef90d9){return'system-'+this[_0x64d2('0x3')](_0x64d2('0x2'))+'-';}},'description':{'type':Sequelize[_0x64d2('0x1')]},'callerIdAll':{'type':Sequelize[_0x64d2('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x64d2('0x4')]}}; \ No newline at end of file +var _0xc75d=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xc75d,0x176));var _0xdc75=function(_0x107035,_0x5a9d3e){_0x107035=_0x107035-0x0;var _0x3735b0=_0xc75d[_0x107035];return _0x3735b0;};'use strict';var Sequelize=require(_0xdc75('0x0'));module[_0xdc75('0x1')]={'name':{'type':Sequelize[_0xdc75('0x2')],'allowNull':![],'unique':_0xdc75('0x3')},'prefix':{'type':Sequelize[_0xdc75('0x4')],'get':function(_0x4fed36){return _0xdc75('0x5')+this[_0xdc75('0x6')](_0xdc75('0x3'))+'-';}},'description':{'type':Sequelize[_0xdc75('0x2')]},'callerIdAll':{'type':Sequelize[_0xdc75('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xdc75('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5163d4d..b1d1aec 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 _0x8f4c=['save','update','destroy','then','VoicePrefixes','error','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','VoiceExtensionId','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x16d127,_0xcdf0fe){var _0x2a103b=function(_0x388419){while(--_0x388419){_0x16d127['push'](_0x16d127['shift']());}};_0x2a103b(++_0xcdf0fe);}(_0x8f4c,0x113));var _0xc8f4=function(_0xa5d896,_0x263a1d){_0xa5d896=_0xa5d896-0x0;var _0x1c31f8=_0x8f4c[_0xa5d896];return _0x1c31f8;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];config[_0xc8f4('0x17')]=_[_0xc8f4('0x18')](config['redis'],{'host':_0xc8f4('0x19'),'port':0x18eb});var socket=require(_0xc8f4('0x1a'))(new Redis(config[_0xc8f4('0x17')]));require(_0xc8f4('0x1b'))[_0xc8f4('0x1c')](socket);function respondWithStatusCode(_0x411c5c,_0x4e3c36){_0x4e3c36=_0x4e3c36||0xcc;return function(_0x2bce00){if(_0x2bce00){return _0x411c5c[_0xc8f4('0x1d')](_0x4e3c36);}return _0x411c5c[_0xc8f4('0x1e')](_0x4e3c36)[_0xc8f4('0x1f')]();};}function respondWithResult(_0x22c08a,_0x56a25d){_0x56a25d=_0x56a25d||0xc8;return function(_0xac45d5){if(_0xac45d5){return _0x22c08a['status'](_0x56a25d)['json'](_0xac45d5);}};}function respondWithFilteredResult(_0x14bc02,_0x225b76){return function(_0x108076){if(_0x108076){var _0x7bb973=typeof _0x225b76[_0xc8f4('0x20')]===_0xc8f4('0x21')&&typeof _0x225b76[_0xc8f4('0x22')]===_0xc8f4('0x21');var _0x1982bb=_0x108076[_0xc8f4('0x23')];var _0x3cd90c=_0x7bb973?0x0:_0x225b76[_0xc8f4('0x20')];var _0x22236c=_0x7bb973?_0x108076['count']:_0x225b76[_0xc8f4('0x20')]+_0x225b76[_0xc8f4('0x22')];var _0x29e52d;if(_0x22236c>=_0x1982bb){_0x22236c=_0x1982bb;_0x29e52d=0xc8;}else{_0x29e52d=0xce;}_0x14bc02[_0xc8f4('0x1e')](_0x29e52d);return _0x14bc02[_0xc8f4('0x24')](_0xc8f4('0x25'),_0x3cd90c+'-'+_0x22236c+'/'+_0x1982bb)[_0xc8f4('0x26')](_0x108076);}return null;};}function patchUpdates(_0x43eb57){return function(_0x5e62aa){try{jsonpatch[_0xc8f4('0x27')](_0x5e62aa,_0x43eb57,!![]);}catch(_0x205c41){return BPromise[_0xc8f4('0x28')](_0x205c41);}return _0x5e62aa[_0xc8f4('0x29')]();};}function saveUpdates(_0x5d54a9,_0x39174f){return function(_0x4a44e0){if(_0x4a44e0){return _0x4a44e0[_0xc8f4('0x2a')](_0x5d54a9)['then'](function(_0x177a44){return _0x177a44;});}return null;};}function removeEntity(_0x3dd717,_0x5c94c6){return function(_0x41f4de){if(_0x41f4de){return _0x41f4de[_0xc8f4('0x2b')]()[_0xc8f4('0x2c')](function(){var _0x2fa052=_0x41f4de['get']({'plain':!![]});var _0x3db490=_0xc8f4('0x2d');return db['UserProfileResource'][_0xc8f4('0x2b')]({'where':{'type':_0x3db490,'resourceId':_0x2fa052['id']}})[_0xc8f4('0x2c')](function(){return _0x41f4de;});})[_0xc8f4('0x2c')](function(){_0x3dd717[_0xc8f4('0x1e')](0xcc)[_0xc8f4('0x1f')]();});}};}function handleEntityNotFound(_0x385e41,_0x4a25da){return function(_0x45f972){if(!_0x45f972){_0x385e41[_0xc8f4('0x1d')](0x194);}return _0x45f972;};}function handleError(_0x1ea3d9,_0x4dcd8f){_0x4dcd8f=_0x4dcd8f||0x1f4;return function(_0xf4a556){logger[_0xc8f4('0x2e')](_0xf4a556['stack']);if(_0xf4a556['name']){delete _0xf4a556['name'];}_0x1ea3d9[_0xc8f4('0x1e')](_0x4dcd8f)[_0xc8f4('0x2f')](_0xf4a556);};}exports[_0xc8f4('0x30')]=function(_0x28baa0,_0x273e73){var _0x2f9a80={},_0x3181af={},_0xffc7aa={'count':0x0,'rows':[]};var _0x4b4203=_[_0xc8f4('0x31')](db[_0xc8f4('0x32')][_0xc8f4('0x33')],function(_0x5cb6ce){return{'name':_0x5cb6ce[_0xc8f4('0x34')],'type':_0x5cb6ce[_0xc8f4('0x35')]['key']};});_0x3181af[_0xc8f4('0x36')]=_[_0xc8f4('0x31')](_0x4b4203,_0xc8f4('0x37'));_0x3181af['query']=_[_0xc8f4('0x38')](_0x28baa0[_0xc8f4('0x39')]);_0x3181af[_0xc8f4('0x3a')]=_['intersection'](_0x3181af[_0xc8f4('0x36')],_0x3181af[_0xc8f4('0x39')]);_0x2f9a80[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x3181af[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x2f9a80[_0xc8f4('0x3b')]=_0x2f9a80[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x2f9a80[_0xc8f4('0x3b')]:_0x3181af[_0xc8f4('0x36')];if(!_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x2f9a80['limit']=qs[_0xc8f4('0x22')](_0x28baa0['query'][_0xc8f4('0x22')]);_0x2f9a80['offset']=qs[_0xc8f4('0x20')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x20')]);}_0x2f9a80[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x2f9a80['where']=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28baa0[_0xc8f4('0x39')],_0x3181af[_0xc8f4('0x3a')]),_0x4b4203);if(_0x28baa0['query'][_0xc8f4('0x44')]){_0x2f9a80[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x2f9a80[_0xc8f4('0x45')],{'$or':_[_0xc8f4('0x31')](_0x4b4203,function(_0x1d7831){if(_0x1d7831[_0xc8f4('0x35')]!==_0xc8f4('0x47')){var _0x1eebbd={};_0x1eebbd[_0x1d7831[_0xc8f4('0x37')]]={'$like':'%'+_0x28baa0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x1eebbd;}})});}_0x2f9a80=_['merge']({},_0x2f9a80,_0x28baa0[_0xc8f4('0x48')]);var _0x32e067={'where':_0x2f9a80[_0xc8f4('0x45')]};return db[_0xc8f4('0x32')]['count'](_0x32e067)['then'](function(_0x413a55){_0xffc7aa[_0xc8f4('0x23')]=_0x413a55;if(_0x28baa0['query'][_0xc8f4('0x49')]){_0x2f9a80[_0xc8f4('0x4a')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x2f9a80);})[_0xc8f4('0x2c')](function(_0x342c28){_0xffc7aa[_0xc8f4('0x4b')]=_0x342c28;return _0xffc7aa;})[_0xc8f4('0x2c')](respondWithFilteredResult(_0x273e73,_0x2f9a80))[_0xc8f4('0x4c')](handleError(_0x273e73,null));};exports[_0xc8f4('0x4d')]=function(_0x4de3d1,_0x522f52){var _0x705792={'raw':![],'where':{'id':_0x4de3d1[_0xc8f4('0x4e')]['id']}},_0x8c82a5={};_0x8c82a5['model']=_['keys'](db['VoicePrefix']['rawAttributes']);_0x8c82a5['query']=_[_0xc8f4('0x38')](_0x4de3d1[_0xc8f4('0x39')]);_0x8c82a5[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],_0x8c82a5[_0xc8f4('0x39')]);_0x705792['attributes']=_[_0xc8f4('0x3c')](_0x8c82a5[_0xc8f4('0x36')],qs['fields'](_0x4de3d1['query'][_0xc8f4('0x3d')]));_0x705792[_0xc8f4('0x3b')]=_0x705792[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x705792['attributes']:_0x8c82a5['model'];if(_0x4de3d1[_0xc8f4('0x39')][_0xc8f4('0x49')]){_0x705792[_0xc8f4('0x4a')]=[{'all':!![]}];}_0x705792=_[_0xc8f4('0x46')]({},_0x705792,_0x4de3d1[_0xc8f4('0x48')]);return db[_0xc8f4('0x32')]['find'](_0x705792)['then'](handleEntityNotFound(_0x522f52,null))[_0xc8f4('0x2c')](respondWithResult(_0x522f52,null))[_0xc8f4('0x4c')](handleError(_0x522f52,null));};exports[_0xc8f4('0x2b')]=function(_0x1b3744,_0x39b4a4){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x1b3744[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x39b4a4,null))['then'](removeEntity(_0x39b4a4,null))['catch'](handleError(_0x39b4a4,null));};exports[_0xc8f4('0x50')]=function(_0xc11ff5,_0x1e5932){return db[_0xc8f4('0x32')][_0xc8f4('0x50')]()[_0xc8f4('0x2c')](respondWithResult(_0x1e5932,null))[_0xc8f4('0x4c')](handleError(_0x1e5932,null));};exports[_0xc8f4('0x51')]=function(_0x197f3c,_0x189fae){var _0x15064a;return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x4ec67d){return db[_0xc8f4('0x32')][_0xc8f4('0x51')](_0x197f3c[_0xc8f4('0x54')],{'transaction':_0x4ec67d})[_0xc8f4('0x2c')](function(_0x481dd2){_0x15064a=_0x481dd2[_0xc8f4('0x55')]({'plain':!![]});return db[_0xc8f4('0x56')]['find']({'where':{'id':_0x15064a['VoiceExtensionId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x5cc52d){return createVoicePrefixExtensions(_0x15064a,_0x5cc52d,_0x4ec67d);});});})[_0xc8f4('0x2c')](function(){var _0x29f8f4=_0x197f3c[_0xc8f4('0x57')][_0xc8f4('0x55')]({'plain':!![]});if(!_0x29f8f4)throw new Error(_0xc8f4('0x58'));if(_0x29f8f4[_0xc8f4('0x59')]===_0xc8f4('0x57')){var _0x1f7602=_0x15064a;return db[_0xc8f4('0x5a')][_0xc8f4('0x4f')]({'where':{'name':_0xc8f4('0x2d'),'userProfileId':_0x29f8f4['userProfileId']},'raw':!![]})[_0xc8f4('0x2c')](function(_0x1f983e){if(_0x1f983e&&_0x1f983e[_0xc8f4('0x5b')]===0x0){return db[_0xc8f4('0x5c')]['create']({'name':_0x1f7602[_0xc8f4('0x37')],'resourceId':_0x1f7602['id'],'type':_0x1f983e['name'],'sectionId':_0x1f983e['id']},{})['then'](function(){return _0x15064a;});}else{return _0x15064a;}})[_0xc8f4('0x4c')](function(_0x451a3e){logger[_0xc8f4('0x2e')](_0xc8f4('0x5d'),_0x451a3e);throw _0x451a3e;});}return _0x15064a;})[_0xc8f4('0x2c')](respondWithResult(_0x189fae,null))[_0xc8f4('0x4c')](handleError(_0x189fae,null));};function Extension(_0x5aba71,_0x562e89,_0x45fb1a,_0x2b558e){this[_0xc8f4('0x5e')]=_0xc8f4('0x5f');this[_0xc8f4('0x60')]=_0x5aba71;this[_0xc8f4('0x61')]=_0x45fb1a;this[_0xc8f4('0x35')]='system';this[_0xc8f4('0x62')]=_0xc8f4('0x63');this['priority']=_0x562e89;this[_0xc8f4('0x64')]=_0x2b558e;}function createVoicePrefixExtensions(_0x2da305,_0x9dbf80,_0x5b8bf4){return new BPromise(function(_0x368798,_0x3aa12d){var _0x33801b=new Extension(formatPrefixName(_0x2da305['prefix']),0x1,_0xc8f4('0x65'),_0xc8f4('0x66'));_0x33801b['VoicePrefixId']=_0x2da305['id'];return db['VoiceExtension'][_0xc8f4('0x51')](_0x33801b,{'transaction':_0x5b8bf4})['then'](function(_0x281b3a){var _0x44f603=_0x281b3a['get']({'plain':!![]});var _0x5f2781=_['map'](addVoicePrefixExtensions(_0x2da305,_0x9dbf80),function(_0x490b8b){_0x490b8b['VoiceExtensionId']=_0x44f603['id'];_0x490b8b['VoicePrefixId']=_0x2da305['id'];return _0x490b8b;});return db[_0xc8f4('0x56')]['bulkCreate'](_0x5f2781,{'transaction':_0x5b8bf4})[_0xc8f4('0x2c')](function(_0x357e45){if(!_0x357e45){return _0x3aa12d(_0xc8f4('0x67'));}else{return _0x368798(_0x357e45);}})[_0xc8f4('0x4c')](function(_0x5ea840){return _0x3aa12d(_0x5ea840);});});;});};function addVoicePrefixExtensions(_0x3f2596,_0x329c26){var _0x3ca2ca=[];var _0xb50e61=formatPrefixName(_0x3f2596['prefix']);_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x2,_0xc8f4('0x69'),_0xc8f4('0x6a')+_0x3f2596[_0xc8f4('0x37')]));if(_0x3f2596['callerIdAll']){_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x69'),'PREFIX-CALLERIDALL='+_0x3f2596[_0xc8f4('0x6b')]));}else{_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x3,_0xc8f4('0x65'),_0xc8f4('0x6c')));}_0x3ca2ca[_0xc8f4('0x68')](new Extension(_0xb50e61,0x4,_0xc8f4('0x6d'),_0x329c26['context']+','+_0xc8f4('0x6e')+(0x8+_0x3f2596[_0xc8f4('0x37')][_0xc8f4('0x3e')])+'}'+','+0x1));return _0x3ca2ca;}function formatPrefixName(_0x5e5117){var _0x28db1f='_';for(var _0x2b6510=0x0;_0x2b6510<_0x5e5117[_0xc8f4('0x3e')];_0x2b6510++){if(_0x5e5117['charAt'](_0x2b6510)=='-'){_0x28db1f+=_0x5e5117[_0xc8f4('0x6f')](_0x2b6510);}else{_0x28db1f+='['+_0x5e5117[_0xc8f4('0x6f')](_0x2b6510)+']';}}_0x28db1f+='.';return _0x28db1f;}exports[_0xc8f4('0x2a')]=function(_0x1278f1,_0x5bf089,_0x8c8e43){var _0x9996da=_0x1278f1['body'];_0x9996da[_0xc8f4('0x70')]=_0xc8f4('0x71')+_0x9996da['name']+'-';return db[_0xc8f4('0x52')][_0xc8f4('0x53')](function(_0x437718){return db[_0xc8f4('0x32')][_0xc8f4('0x2a')](_0x9996da,{'where':{'id':_0x9996da['id']},'transaction':_0x437718})[_0xc8f4('0x2c')](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x2b')]({'where':{'VoicePrefixId':_0x9996da['id']},'transaction':_0x437718})['then'](function(){return db[_0xc8f4('0x56')][_0xc8f4('0x4f')]({'where':{'id':_0x9996da[_0xc8f4('0x72')]},'raw':!![]})[_0xc8f4('0x2c')](function(_0xdc64f3){return createVoicePrefixExtensions(_0x9996da,_0xdc64f3,_0x437718);});});});})['then'](function(){return db[_0xc8f4('0x32')]['findById'](_0x9996da['id']);})[_0xc8f4('0x2c')](respondWithResult(_0x5bf089,null))[_0xc8f4('0x4c')](handleError(_0x5bf089,null));};exports[_0xc8f4('0x73')]=function(_0x30e155,_0xc6df8e,_0x9a7714){return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0x30e155[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0xc6df8e,null))[_0xc8f4('0x2c')](function(_0x4d7d74){if(_0x4d7d74){return _0x4d7d74[_0xc8f4('0x73')](_0x30e155[_0xc8f4('0x54')][_0xc8f4('0x74')],_[_0xc8f4('0x75')](_0x30e155['body'],['ids','id'])||{})[_0xc8f4('0x76')](function(_0x4cde06){for(var _0x205ed9=0x0;_0x205ed9<_0x30e155['body'][_0xc8f4('0x74')]['length'];_0x205ed9+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x30e155['body']['ids'][_0x205ed9]),'VoicePrefixId':Number(_0x30e155['params']['id'])});}return _0x4cde06;});}})[_0xc8f4('0x2c')](respondWithResult(_0xc6df8e,null))['catch'](handleError(_0xc6df8e,null));};exports[_0xc8f4('0x77')]=function(_0x3ad7dd,_0x3e22c2,_0x367d5e){return db[_0xc8f4('0x32')]['find']({'where':{'id':_0x3ad7dd[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x3e22c2,null))[_0xc8f4('0x2c')](function(_0x5b354d){if(_0x5b354d){return _0x5b354d[_0xc8f4('0x77')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])[_0xc8f4('0x2c')](function(){if(_[_0xc8f4('0x78')](_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')])){for(var _0x1401f1=0x0;_0x1401f1<_0x3ad7dd['query'][_0xc8f4('0x74')][_0xc8f4('0x3e')];_0x1401f1+=0x1){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')][_0x1401f1]),'VoicePrefixId':Number(_0x3ad7dd[_0xc8f4('0x4e')]['id'])});}}else{socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':Number(_0x3ad7dd[_0xc8f4('0x39')][_0xc8f4('0x74')]),'VoicePrefixId':Number(_0x3ad7dd['params']['id'])});}});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x3e22c2,null))[_0xc8f4('0x4c')](handleError(_0x3e22c2,null));};exports['getAgents']=function(_0x412695,_0x1921bc,_0x50f012){var _0x16ea62={};var _0x2bbf57={};var _0x57b97a;var _0x5bb6cc;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x412695[_0xc8f4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1921bc,null))[_0xc8f4('0x2c')](function(_0xf1c31d){if(_0xf1c31d){_0x57b97a=_0xf1c31d;_0x2bbf57['model']=_['keys'](db[_0xc8f4('0x7c')][_0xc8f4('0x33')]);_0x2bbf57[_0xc8f4('0x39')]=_['keys'](_0x412695[_0xc8f4('0x39')]);_0x2bbf57[_0xc8f4('0x3a')]=_[_0xc8f4('0x3c')](_0x2bbf57['model'],_0x2bbf57[_0xc8f4('0x39')]);_0x16ea62[_0xc8f4('0x3b')]=_[_0xc8f4('0x3c')](_0x2bbf57[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x16ea62[_0xc8f4('0x3b')]=_0x16ea62[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x16ea62[_0xc8f4('0x3b')]:_0x2bbf57['model'];_0x16ea62[_0xc8f4('0x41')]=qs['sort'](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x16ea62[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x412695[_0xc8f4('0x39')],_0x2bbf57[_0xc8f4('0x3a')]));if(_0x412695[_0xc8f4('0x39')]['filter']){_0x16ea62[_0xc8f4('0x45')]=_['merge'](_0x16ea62['where'],{'$or':_[_0xc8f4('0x31')](_0x16ea62[_0xc8f4('0x3b')],function(_0x35a3db){var _0x4fedd9={};_0x4fedd9[_0x35a3db]={'$like':'%'+_0x412695['query'][_0xc8f4('0x44')]+'%'};return _0x4fedd9;})});}_0x16ea62=_[_0xc8f4('0x46')]({},_0x16ea62,_0x412695[_0xc8f4('0x48')]);return _0x57b97a['getAgents'](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x5ce8eb){if(_0x5ce8eb){_0x5bb6cc=_0x5ce8eb[_0xc8f4('0x3e')];if(!_0x412695[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x16ea62[_0xc8f4('0x22')]=qs['limit'](_0x412695[_0xc8f4('0x39')]['limit']);_0x16ea62[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x412695[_0xc8f4('0x39')][_0xc8f4('0x20')]);}return _0x57b97a[_0xc8f4('0x7d')](_0x16ea62);}})[_0xc8f4('0x2c')](function(_0x3f1852){if(_0x3f1852){return _0x3f1852?{'count':_0x5bb6cc,'rows':_0x3f1852}:null;}})[_0xc8f4('0x2c')](respondWithResult(_0x1921bc,null))[_0xc8f4('0x4c')](handleError(_0x1921bc,null));};exports[_0xc8f4('0x7e')]=function(_0x28bcf0,_0x53bd16,_0x526010){var _0x23890b={};var _0x20c759={};var _0x13a274;var _0xb813ba;return db[_0xc8f4('0x32')][_0xc8f4('0x7b')]({'where':{'id':_0x28bcf0[_0xc8f4('0x4e')]['id']}})[_0xc8f4('0x2c')](handleEntityNotFound(_0x53bd16,null))[_0xc8f4('0x2c')](function(_0x7758c2){if(_0x7758c2){_0x13a274=_0x7758c2;_0x20c759[_0xc8f4('0x36')]=_[_0xc8f4('0x38')](db['Team']['rawAttributes']);_0x20c759[_0xc8f4('0x39')]=_['keys'](_0x28bcf0['query']);_0x20c759[_0xc8f4('0x3a')]=_['intersection'](_0x20c759['model'],_0x20c759['query']);_0x23890b['attributes']=_['intersection'](_0x20c759[_0xc8f4('0x36')],qs[_0xc8f4('0x3d')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3d')]));_0x23890b[_0xc8f4('0x3b')]=_0x23890b[_0xc8f4('0x3b')][_0xc8f4('0x3e')]?_0x23890b[_0xc8f4('0x3b')]:_0x20c759[_0xc8f4('0x36')];_0x23890b[_0xc8f4('0x41')]=qs[_0xc8f4('0x42')](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x42')]);_0x23890b[_0xc8f4('0x45')]=qs[_0xc8f4('0x3a')](_[_0xc8f4('0x43')](_0x28bcf0[_0xc8f4('0x39')],_0x20c759[_0xc8f4('0x3a')]));if(_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]){_0x23890b[_0xc8f4('0x45')]=_[_0xc8f4('0x46')](_0x23890b[_0xc8f4('0x45')],{'$or':_['map'](_0x23890b['attributes'],function(_0xe8ff50){var _0x416ade={};_0x416ade[_0xe8ff50]={'$like':'%'+_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x44')]+'%'};return _0x416ade;})});}_0x23890b=_[_0xc8f4('0x46')]({},_0x23890b,_0x28bcf0[_0xc8f4('0x48')]);return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0xe9d619){if(_0xe9d619){_0xb813ba=_0xe9d619[_0xc8f4('0x3e')];if(!_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x3f')](_0xc8f4('0x40'))){_0x23890b[_0xc8f4('0x22')]=qs['limit'](_0x28bcf0[_0xc8f4('0x39')][_0xc8f4('0x22')]);_0x23890b[_0xc8f4('0x20')]=qs[_0xc8f4('0x20')](_0x28bcf0[_0xc8f4('0x39')]['offset']);}return _0x13a274[_0xc8f4('0x7e')](_0x23890b);}})[_0xc8f4('0x2c')](function(_0x5a5f87){if(_0x5a5f87){return _0x5a5f87?{'count':_0xb813ba,'rows':_0x5a5f87}:null;}})['then'](respondWithResult(_0x53bd16,null))[_0xc8f4('0x4c')](handleError(_0x53bd16,null));};exports[_0xc8f4('0x7f')]=function(_0xe771f7,_0x32c7c3,_0x3ecd2e){var _0x4b2876=_0xe771f7['body'][_0xc8f4('0x74')];var _0xe437e;return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x4b2876},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':_0xc8f4('0x81'),'attributes':['id',_0xc8f4('0x37'),_0xc8f4('0x82'),_0xc8f4('0x83'),_0xc8f4('0x84')],'raw':!![]}]})[_0xc8f4('0x2c')](function(_0x4a4ea5){if(_0x4a4ea5){_0xe437e=_0x4a4ea5;var _0x23177d=_[_0xc8f4('0x85')](_0x4a4ea5,function(_0x129d2a){var _0x4d63e1=_0x129d2a[_0xc8f4('0x55')]({'plain':!![]});return _0x4d63e1['Agents'];});return db[_0xc8f4('0x32')][_0xc8f4('0x4f')]({'where':{'id':_0xe771f7[_0xc8f4('0x4e')]['id']}})['then'](function(_0x3a2f12){return db['sequelize'][_0xc8f4('0x53')](function(_0xfbf268){return _0x3a2f12[_0xc8f4('0x7f')](_0x4b2876,{'transaction':_0xfbf268})['then'](function(){return BPromise[_0xc8f4('0x86')](_0xe437e,function(_0x3a1a5a){return db[_0xc8f4('0x87')][_0xc8f4('0x88')]({'TeamId':_0x3a1a5a['id'],'VoicePrefixId':_0xe771f7['params']['id']},{'transaction':_0xfbf268});});})[_0xc8f4('0x2c')](function(){return BPromise['each'](_0x23177d,function(_0x2180a4){return db['UserVoicePrefix'][_0xc8f4('0x89')]({'where':{'UserId':_0x2180a4['id'],'VoicePrefixId':_0xe771f7[_0xc8f4('0x4e')]['id']},'transaction':_0xfbf268});});})['then'](function(){_0x23177d[_0xc8f4('0x8a')](function(_0x1b0146){socket[_0xc8f4('0x79')](_0xc8f4('0x8b'),{'UserId':_0x1b0146['id'],'VoicePrefixId':_0x3a2f12['id']});});});});});}})[_0xc8f4('0x2c')](respondWithStatusCode(_0x32c7c3,null))['catch'](handleError(_0x32c7c3,null));};exports[_0xc8f4('0x8c')]=function(_0x2a69de,_0xfe16,_0xac0f76){return db['Team'][_0xc8f4('0x80')]({'where':{'id':_0x2a69de[_0xc8f4('0x39')][_0xc8f4('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc8f4('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc8f4('0x2c')](handleEntityNotFound(_0xfe16,null))[_0xc8f4('0x2c')](function(_0x32258c){var _0x3e67d5=_[_0xc8f4('0x31')](_0x32258c,'id');var _0xbc97d=[];var _0x5b723a=[];var _0x9c5a78=squel[_0xc8f4('0x8d')]();_0x9c5a78['field'](_0xc8f4('0x8e'))[_0xc8f4('0x8f')](_0xc8f4('0x90'),'tq')[_0xc8f4('0x91')]('user_has_teams','ut',_0xc8f4('0x92'))['where'](_0xc8f4('0x93'),_0x2a69de[_0xc8f4('0x4e')]['id']);for(var _0x11c10f=0x0;_0x11c10f<_0x32258c['length'];_0x11c10f+=0x1){let _0x2e3221=_0x32258c[_0x11c10f];for(var _0x103c24=0x0;_0x103c24<_0x2e3221[_0xc8f4('0x81')][_0xc8f4('0x3e')];_0x103c24+=0x1){let _0x2e1a3b=_0x2e3221[_0xc8f4('0x81')][_0x103c24];var _0x3c0e05=_0x9c5a78['clone']();_0x3c0e05[_0xc8f4('0x45')](_0xc8f4('0x94'),_0x2e1a3b['id']);_0x5b723a[_0xc8f4('0x68')](db[_0xc8f4('0x52')][_0xc8f4('0x39')](_0x3c0e05[_0xc8f4('0x95')](),{'type':db[_0xc8f4('0x52')][_0xc8f4('0x96')][_0xc8f4('0x97')]})[_0xc8f4('0x2c')](function(_0x29d70c){if(_0x29d70c[_0xc8f4('0x3e')]===0x1){return _0x2e1a3b['id'];}else{var _0x10cc75=_[_0xc8f4('0x98')](_[_0xc8f4('0x31')](_0x29d70c,_0xc8f4('0x99')),function(_0x84dc88){return _[_0xc8f4('0x9a')](_0x3e67d5,_0x84dc88);});if(_0x10cc75){return _0x2e1a3b['id'];}}}));}}return BPromise[_0xc8f4('0x9b')](_0x5b723a)[_0xc8f4('0x2c')](function(_0x506950){_0xbc97d=_(_0xbc97d)['union'](_0x506950)[_0xc8f4('0x9c')]()['value']();return db['VoicePrefix'][_0xc8f4('0x4f')]({'where':{'id':_0x2a69de[_0xc8f4('0x4e')]['id']}})['then'](function(_0x4bba01){return db['sequelize']['transaction'](function(_0x27334b){return _0x4bba01['removeTeams'](_0x2a69de['query'][_0xc8f4('0x74')],{'transaction':_0x27334b})[_0xc8f4('0x2c')](function(){if(!_[_0xc8f4('0x9d')](_0xbc97d)){return _0x4bba01[_0xc8f4('0x77')](_0xbc97d,{'transaction':_0x27334b});}})[_0xc8f4('0x2c')](function(){_0xbc97d[_0xc8f4('0x8a')](function(_0x34a545){socket[_0xc8f4('0x79')](_0xc8f4('0x7a'),{'UserId':_0x34a545,'VoicePrefixId':_0x4bba01['id']});});});});});});})[_0xc8f4('0x2c')](respondWithStatusCode(_0xfe16,null))['catch'](handleError(_0xfe16,null));}; \ No newline at end of file +var _0x58a4=['addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','getTeams','Team','User','Agents','online','voicePause','interface','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','describe','create','sequelize','transaction','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','findById'];(function(_0x1cbb93,_0xef6ff5){var _0x4b71ad=function(_0x16050a){while(--_0x16050a){_0x1cbb93['push'](_0x1cbb93['shift']());}};_0x4b71ad(++_0xef6ff5);}(_0x58a4,0xbf));var _0x458a=function(_0x1274dd,_0x21624b){_0x1274dd=_0x1274dd-0x0;var _0xc6919=_0x58a4[_0x1274dd];return _0xc6919;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];config[_0x458a('0x1a')]=_[_0x458a('0x1b')](config[_0x458a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458a('0x1a')]));require('./voicePrefix.socket')[_0x458a('0x1c')](socket);function respondWithStatusCode(_0x44f683,_0x10133b){_0x10133b=_0x10133b||0xcc;return function(_0x3b74f9){if(_0x3b74f9){return _0x44f683[_0x458a('0x1d')](_0x10133b);}return _0x44f683[_0x458a('0x1e')](_0x10133b)['end']();};}function respondWithResult(_0x4b26be,_0x5c7993){_0x5c7993=_0x5c7993||0xc8;return function(_0x2faf6a){if(_0x2faf6a){return _0x4b26be[_0x458a('0x1e')](_0x5c7993)[_0x458a('0x1f')](_0x2faf6a);}};}function respondWithFilteredResult(_0x5c5b41,_0x310569){return function(_0x260c87){if(_0x260c87){var _0x18504d=typeof _0x310569[_0x458a('0x20')]===_0x458a('0x21')&&typeof _0x310569['limit']==='undefined';var _0x178db9=_0x260c87['count'];var _0x3302b7=_0x18504d?0x0:_0x310569[_0x458a('0x20')];var _0x47a202=_0x18504d?_0x260c87[_0x458a('0x22')]:_0x310569['offset']+_0x310569[_0x458a('0x23')];var _0x1c79cb;if(_0x47a202>=_0x178db9){_0x47a202=_0x178db9;_0x1c79cb=0xc8;}else{_0x1c79cb=0xce;}_0x5c5b41['status'](_0x1c79cb);return _0x5c5b41[_0x458a('0x24')](_0x458a('0x25'),_0x3302b7+'-'+_0x47a202+'/'+_0x178db9)['json'](_0x260c87);}return null;};}function patchUpdates(_0xa6b8ff){return function(_0x5ad95a){try{jsonpatch[_0x458a('0x26')](_0x5ad95a,_0xa6b8ff,!![]);}catch(_0x5bca42){return BPromise[_0x458a('0x27')](_0x5bca42);}return _0x5ad95a['save']();};}function saveUpdates(_0x36b08e,_0x911eaf){return function(_0xcb0756){if(_0xcb0756){return _0xcb0756[_0x458a('0x28')](_0x36b08e)[_0x458a('0x29')](function(_0x19bd5){return _0x19bd5;});}return null;};}function removeEntity(_0x340375,_0x3012c7){return function(_0x1f2d0){if(_0x1f2d0){return _0x1f2d0[_0x458a('0x2a')]()[_0x458a('0x29')](function(){var _0x327fcb=_0x1f2d0[_0x458a('0x2b')]({'plain':!![]});var _0x5a55b7=_0x458a('0x2c');return db[_0x458a('0x2d')]['destroy']({'where':{'type':_0x5a55b7,'resourceId':_0x327fcb['id']}})['then'](function(){return _0x1f2d0;});})[_0x458a('0x29')](function(){_0x340375['status'](0xcc)[_0x458a('0x2e')]();});}};}function handleEntityNotFound(_0x29f9b5,_0x223f73){return function(_0x4a49e4){if(!_0x4a49e4){_0x29f9b5[_0x458a('0x1d')](0x194);}return _0x4a49e4;};}function handleError(_0x2531f7,_0x1426a8){_0x1426a8=_0x1426a8||0x1f4;return function(_0x562c36){logger['error'](_0x562c36[_0x458a('0x2f')]);if(_0x562c36['name']){delete _0x562c36[_0x458a('0x30')];}_0x2531f7['status'](_0x1426a8)[_0x458a('0x31')](_0x562c36);};}exports[_0x458a('0x32')]=function(_0x492843,_0x309a6a){var _0x269f53={},_0x625ae3={},_0x525caf={'count':0x0,'rows':[]};var _0x3371c3=_[_0x458a('0x33')](db[_0x458a('0x34')][_0x458a('0x35')],function(_0x5267fe){return{'name':_0x5267fe['fieldName'],'type':_0x5267fe[_0x458a('0x36')][_0x458a('0x37')]};});_0x625ae3[_0x458a('0x38')]=_[_0x458a('0x33')](_0x3371c3,_0x458a('0x30'));_0x625ae3[_0x458a('0x39')]=_['keys'](_0x492843[_0x458a('0x39')]);_0x625ae3[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],_0x625ae3[_0x458a('0x39')]);_0x269f53[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x492843['query'][_0x458a('0x3d')]));_0x269f53[_0x458a('0x3c')]=_0x269f53[_0x458a('0x3c')][_0x458a('0x3e')]?_0x269f53[_0x458a('0x3c')]:_0x625ae3[_0x458a('0x38')];if(!_0x492843[_0x458a('0x39')][_0x458a('0x3f')](_0x458a('0x40'))){_0x269f53[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x492843[_0x458a('0x39')][_0x458a('0x23')]);_0x269f53[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x492843['query'][_0x458a('0x20')]);}_0x269f53[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x492843[_0x458a('0x39')][_0x458a('0x42')]);_0x269f53[_0x458a('0x43')]=qs[_0x458a('0x3a')](_[_0x458a('0x44')](_0x492843[_0x458a('0x39')],_0x625ae3[_0x458a('0x3a')]),_0x3371c3);if(_0x492843[_0x458a('0x39')]['filter']){_0x269f53[_0x458a('0x43')]=_[_0x458a('0x45')](_0x269f53['where'],{'$or':_[_0x458a('0x33')](_0x3371c3,function(_0x422b45){if(_0x422b45[_0x458a('0x36')]!=='VIRTUAL'){var _0x406312={};_0x406312[_0x422b45[_0x458a('0x30')]]={'$like':'%'+_0x492843[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0x406312;}})});}_0x269f53=_[_0x458a('0x45')]({},_0x269f53,_0x492843[_0x458a('0x47')]);var _0x21d2d4={'where':_0x269f53[_0x458a('0x43')]};return db['VoicePrefix'][_0x458a('0x22')](_0x21d2d4)[_0x458a('0x29')](function(_0x2b9030){_0x525caf['count']=_0x2b9030;if(_0x492843[_0x458a('0x39')][_0x458a('0x48')]){_0x269f53['include']=[{'all':!![]}];}return db[_0x458a('0x34')][_0x458a('0x49')](_0x269f53);})[_0x458a('0x29')](function(_0x36c391){_0x525caf[_0x458a('0x4a')]=_0x36c391;return _0x525caf;})['then'](respondWithFilteredResult(_0x309a6a,_0x269f53))['catch'](handleError(_0x309a6a,null));};exports[_0x458a('0x4b')]=function(_0x301e61,_0x33a31d){var _0x18e4e2={'raw':![],'where':{'id':_0x301e61[_0x458a('0x4c')]['id']}},_0x5afd24={};_0x5afd24[_0x458a('0x38')]=_['keys'](db[_0x458a('0x34')]['rawAttributes']);_0x5afd24[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x301e61[_0x458a('0x39')]);_0x5afd24['filters']=_[_0x458a('0x3b')](_0x5afd24[_0x458a('0x38')],_0x5afd24[_0x458a('0x39')]);_0x18e4e2['attributes']=_['intersection'](_0x5afd24[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x301e61[_0x458a('0x39')]['fields']));_0x18e4e2['attributes']=_0x18e4e2[_0x458a('0x3c')][_0x458a('0x3e')]?_0x18e4e2[_0x458a('0x3c')]:_0x5afd24[_0x458a('0x38')];if(_0x301e61[_0x458a('0x39')][_0x458a('0x48')]){_0x18e4e2[_0x458a('0x4e')]=[{'all':!![]}];}_0x18e4e2=_[_0x458a('0x45')]({},_0x18e4e2,_0x301e61[_0x458a('0x47')]);return db[_0x458a('0x34')][_0x458a('0x4f')](_0x18e4e2)[_0x458a('0x29')](handleEntityNotFound(_0x33a31d,null))[_0x458a('0x29')](respondWithResult(_0x33a31d,null))[_0x458a('0x50')](handleError(_0x33a31d,null));};exports[_0x458a('0x2a')]=function(_0x25b44c,_0x51669b){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x25b44c[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x51669b,null))[_0x458a('0x29')](removeEntity(_0x51669b,null))['catch'](handleError(_0x51669b,null));};exports['describe']=function(_0x514d82,_0x2abf75){return db['VoicePrefix'][_0x458a('0x51')]()[_0x458a('0x29')](respondWithResult(_0x2abf75,null))[_0x458a('0x50')](handleError(_0x2abf75,null));};exports[_0x458a('0x52')]=function(_0xfa6e65,_0x5f0151){var _0x48f68e;return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x2587a1){return db[_0x458a('0x34')][_0x458a('0x52')](_0xfa6e65['body'],{'transaction':_0x2587a1})[_0x458a('0x29')](function(_0x4eed01){_0x48f68e=_0x4eed01[_0x458a('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x458a('0x4f')]({'where':{'id':_0x48f68e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b9928){return createVoicePrefixExtensions(_0x48f68e,_0x4b9928,_0x2587a1);});});})[_0x458a('0x29')](function(){var _0x3eb267=_0xfa6e65['user'][_0x458a('0x2b')]({'plain':!![]});if(!_0x3eb267)throw new Error(_0x458a('0x55'));if(_0x3eb267[_0x458a('0x56')]==='user'){var _0x2c1230=_0x48f68e;return db[_0x458a('0x57')][_0x458a('0x4f')]({'where':{'name':_0x458a('0x2c'),'userProfileId':_0x3eb267[_0x458a('0x58')]},'raw':!![]})[_0x458a('0x29')](function(_0x597e74){if(_0x597e74&&_0x597e74[_0x458a('0x59')]===0x0){return db[_0x458a('0x2d')][_0x458a('0x52')]({'name':_0x2c1230[_0x458a('0x30')],'resourceId':_0x2c1230['id'],'type':_0x597e74[_0x458a('0x30')],'sectionId':_0x597e74['id']},{})[_0x458a('0x29')](function(){return _0x48f68e;});}else{return _0x48f68e;}})[_0x458a('0x50')](function(_0x3b6cf9){logger['error'](_0x458a('0x5a'),_0x3b6cf9);throw _0x3b6cf9;});}return _0x48f68e;})['then'](respondWithResult(_0x5f0151,null))[_0x458a('0x50')](handleError(_0x5f0151,null));};function Extension(_0x2921ba,_0x222aa4,_0x42b748,_0x4da240){this['context']=_0x458a('0x5b');this[_0x458a('0x5c')]=_0x2921ba;this[_0x458a('0x5d')]=_0x42b748;this[_0x458a('0x36')]=_0x458a('0x5e');this[_0x458a('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x458a('0x60')]=_0x222aa4;this[_0x458a('0x61')]=_0x4da240;}function createVoicePrefixExtensions(_0x4f6913,_0x18d83a,_0x47b334){return new BPromise(function(_0x425a0f,_0x338127){var _0xa37d44=new Extension(formatPrefixName(_0x4f6913[_0x458a('0x62')]),0x1,_0x458a('0x63'),_0x458a('0x64'));_0xa37d44[_0x458a('0x65')]=_0x4f6913['id'];return db[_0x458a('0x66')]['create'](_0xa37d44,{'transaction':_0x47b334})[_0x458a('0x29')](function(_0x3ed05d){var _0x5d41a2=_0x3ed05d[_0x458a('0x2b')]({'plain':!![]});var _0x3da617=_['map'](addVoicePrefixExtensions(_0x4f6913,_0x18d83a),function(_0xaf7b50){_0xaf7b50[_0x458a('0x67')]=_0x5d41a2['id'];_0xaf7b50['VoicePrefixId']=_0x4f6913['id'];return _0xaf7b50;});return db[_0x458a('0x66')][_0x458a('0x68')](_0x3da617,{'transaction':_0x47b334})['then'](function(_0x16f82f){if(!_0x16f82f){return _0x338127(_0x458a('0x69'));}else{return _0x425a0f(_0x16f82f);}})[_0x458a('0x50')](function(_0x404d93){return _0x338127(_0x404d93);});});;});};function addVoicePrefixExtensions(_0x541375,_0x27d1f2){var _0x4199a7=[];var _0x397595=formatPrefixName(_0x541375['prefix']);_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x2,_0x458a('0x6b'),_0x458a('0x6c')+_0x541375[_0x458a('0x30')]));if(_0x541375[_0x458a('0x6d')]){_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,_0x458a('0x6b'),_0x458a('0x6e')+_0x541375[_0x458a('0x6d')]));}else{_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,'NoOp',_0x458a('0x6f')));}_0x4199a7['push'](new Extension(_0x397595,0x4,_0x458a('0x70'),_0x27d1f2[_0x458a('0x71')]+','+_0x458a('0x72')+(0x8+_0x541375[_0x458a('0x30')][_0x458a('0x3e')])+'}'+','+0x1));return _0x4199a7;}function formatPrefixName(_0x3d1d37){var _0x2c6a00='_';for(var _0x3745d5=0x0;_0x3745d5<_0x3d1d37[_0x458a('0x3e')];_0x3745d5++){if(_0x3d1d37[_0x458a('0x73')](_0x3745d5)=='-'){_0x2c6a00+=_0x3d1d37[_0x458a('0x73')](_0x3745d5);}else{_0x2c6a00+='['+_0x3d1d37[_0x458a('0x73')](_0x3745d5)+']';}}_0x2c6a00+='.';return _0x2c6a00;}exports[_0x458a('0x28')]=function(_0x435884,_0x3948aa,_0x2c131b){var _0x4c426a=_0x435884[_0x458a('0x74')];_0x4c426a['prefix']=_0x458a('0x75')+_0x4c426a[_0x458a('0x30')]+'-';return db['sequelize'][_0x458a('0x54')](function(_0xb028b3){return db[_0x458a('0x34')]['update'](_0x4c426a,{'where':{'id':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x2a')]({'where':{'VoicePrefixId':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x4f')]({'where':{'id':_0x4c426a['VoiceExtensionId']},'raw':!![]})[_0x458a('0x29')](function(_0x54abb1){return createVoicePrefixExtensions(_0x4c426a,_0x54abb1,_0xb028b3);});});});})['then'](function(){return db[_0x458a('0x34')][_0x458a('0x76')](_0x4c426a['id']);})[_0x458a('0x29')](respondWithResult(_0x3948aa,null))[_0x458a('0x50')](handleError(_0x3948aa,null));};exports[_0x458a('0x77')]=function(_0x434d04,_0x42eae7,_0x5aee0d){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x434d04[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x42eae7,null))[_0x458a('0x29')](function(_0x17398f){if(_0x17398f){return _0x17398f['addAgents'](_0x434d04['body']['ids'],_[_0x458a('0x78')](_0x434d04['body'],[_0x458a('0x79'),'id'])||{})[_0x458a('0x7a')](function(_0x46ef02){for(var _0x3d73d1=0x0;_0x3d73d1<_0x434d04[_0x458a('0x74')][_0x458a('0x79')][_0x458a('0x3e')];_0x3d73d1+=0x1){socket['emit'](_0x458a('0x7b'),{'UserId':Number(_0x434d04[_0x458a('0x74')]['ids'][_0x3d73d1]),'VoicePrefixId':Number(_0x434d04[_0x458a('0x4c')]['id'])});}return _0x46ef02;});}})['then'](respondWithResult(_0x42eae7,null))[_0x458a('0x50')](handleError(_0x42eae7,null));};exports['removeAgents']=function(_0x26b3f7,_0x177457,_0xce45b5){return db[_0x458a('0x34')]['find']({'where':{'id':_0x26b3f7[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x177457,null))[_0x458a('0x29')](function(_0x239e2f){if(_0x239e2f){return _0x239e2f[_0x458a('0x7c')](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])[_0x458a('0x29')](function(){if(_['isArray'](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])){for(var _0x12e367=0x0;_0x12e367<_0x26b3f7[_0x458a('0x39')]['ids'][_0x458a('0x3e')];_0x12e367+=0x1){socket[_0x458a('0x7d')]('userVoicePrefix:remove',{'UserId':Number(_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')][_0x12e367]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}}else{socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':Number(_0x26b3f7['query'][_0x458a('0x79')]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}});}})[_0x458a('0x29')](respondWithStatusCode(_0x177457,null))[_0x458a('0x50')](handleError(_0x177457,null));};exports[_0x458a('0x7f')]=function(_0x46ac5c,_0x2eecf0,_0x573f46){var _0x1f9925={};var _0x4d3790={};var _0x396af9;var _0x36e650;return db[_0x458a('0x34')]['findOne']({'where':{'id':_0x46ac5c[_0x458a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2eecf0,null))['then'](function(_0x2574a3){if(_0x2574a3){_0x396af9=_0x2574a3;_0x4d3790[_0x458a('0x38')]=_['keys'](db['User'][_0x458a('0x35')]);_0x4d3790[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x46ac5c[_0x458a('0x39')]);_0x4d3790[_0x458a('0x3a')]=_['intersection'](_0x4d3790[_0x458a('0x38')],_0x4d3790['query']);_0x1f9925[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x4d3790[_0x458a('0x38')],qs['fields'](_0x46ac5c[_0x458a('0x39')][_0x458a('0x3d')]));_0x1f9925['attributes']=_0x1f9925[_0x458a('0x3c')]['length']?_0x1f9925[_0x458a('0x3c')]:_0x4d3790[_0x458a('0x38')];_0x1f9925[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x46ac5c['query'][_0x458a('0x42')]);_0x1f9925['where']=qs['filters'](_[_0x458a('0x44')](_0x46ac5c[_0x458a('0x39')],_0x4d3790[_0x458a('0x3a')]));if(_0x46ac5c[_0x458a('0x39')][_0x458a('0x46')]){_0x1f9925[_0x458a('0x43')]=_['merge'](_0x1f9925[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x1f9925[_0x458a('0x3c')],function(_0x222dcb){var _0x17099e={};_0x17099e[_0x222dcb]={'$like':'%'+_0x46ac5c[_0x458a('0x39')]['filter']+'%'};return _0x17099e;})});}_0x1f9925=_[_0x458a('0x45')]({},_0x1f9925,_0x46ac5c[_0x458a('0x47')]);return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})['then'](function(_0x2903c2){if(_0x2903c2){_0x36e650=_0x2903c2[_0x458a('0x3e')];if(!_0x46ac5c[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x1f9925[_0x458a('0x23')]=qs['limit'](_0x46ac5c['query']['limit']);_0x1f9925['offset']=qs['offset'](_0x46ac5c[_0x458a('0x39')]['offset']);}return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})[_0x458a('0x29')](function(_0x2adefe){if(_0x2adefe){return _0x2adefe?{'count':_0x36e650,'rows':_0x2adefe}:null;}})[_0x458a('0x29')](respondWithResult(_0x2eecf0,null))[_0x458a('0x50')](handleError(_0x2eecf0,null));};exports[_0x458a('0x80')]=function(_0x555190,_0x11ebe7,_0x59ad9c){var _0x24b1ee={};var _0x4e1d44={};var _0x23428c;var _0x333d74;return db['VoicePrefix']['findOne']({'where':{'id':_0x555190['params']['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x11ebe7,null))[_0x458a('0x29')](function(_0x21d8a9){if(_0x21d8a9){_0x23428c=_0x21d8a9;_0x4e1d44[_0x458a('0x38')]=_[_0x458a('0x4d')](db['Team'][_0x458a('0x35')]);_0x4e1d44[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x555190[_0x458a('0x39')]);_0x4e1d44[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],_0x4e1d44[_0x458a('0x39')]);_0x24b1ee['attributes']=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x555190[_0x458a('0x39')][_0x458a('0x3d')]));_0x24b1ee[_0x458a('0x3c')]=_0x24b1ee[_0x458a('0x3c')]['length']?_0x24b1ee['attributes']:_0x4e1d44['model'];_0x24b1ee['order']=qs[_0x458a('0x42')](_0x555190[_0x458a('0x39')][_0x458a('0x42')]);_0x24b1ee[_0x458a('0x43')]=qs['filters'](_[_0x458a('0x44')](_0x555190[_0x458a('0x39')],_0x4e1d44[_0x458a('0x3a')]));if(_0x555190[_0x458a('0x39')]['filter']){_0x24b1ee['where']=_[_0x458a('0x45')](_0x24b1ee[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x24b1ee[_0x458a('0x3c')],function(_0x4ff826){var _0xbb80ab={};_0xbb80ab[_0x4ff826]={'$like':'%'+_0x555190[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0xbb80ab;})});}_0x24b1ee=_[_0x458a('0x45')]({},_0x24b1ee,_0x555190[_0x458a('0x47')]);return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})[_0x458a('0x29')](function(_0xd05241){if(_0xd05241){_0x333d74=_0xd05241[_0x458a('0x3e')];if(!_0x555190[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x24b1ee[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x555190[_0x458a('0x39')][_0x458a('0x23')]);_0x24b1ee[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x555190[_0x458a('0x39')]['offset']);}return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})['then'](function(_0x165b0d){if(_0x165b0d){return _0x165b0d?{'count':_0x333d74,'rows':_0x165b0d}:null;}})[_0x458a('0x29')](respondWithResult(_0x11ebe7,null))[_0x458a('0x50')](handleError(_0x11ebe7,null));};exports['addTeams']=function(_0x589496,_0x4ee34,_0x1c9f4c){var _0x241c72=_0x589496[_0x458a('0x74')][_0x458a('0x79')];var _0x53d065;return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x241c72},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id',_0x458a('0x30'),_0x458a('0x84'),_0x458a('0x85'),_0x458a('0x86')],'raw':!![]}]})[_0x458a('0x29')](function(_0x52b844){if(_0x52b844){_0x53d065=_0x52b844;var _0x3051d2=_['flatMap'](_0x52b844,function(_0x2e496b){var _0x442b4a=_0x2e496b[_0x458a('0x2b')]({'plain':!![]});return _0x442b4a['Agents'];});return db['VoicePrefix'][_0x458a('0x4f')]({'where':{'id':_0x589496['params']['id']}})[_0x458a('0x29')](function(_0x5d97cc){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x1b8558){return _0x5d97cc['addTeams'](_0x241c72,{'transaction':_0x1b8558})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x53d065,function(_0x5dbeed){return db[_0x458a('0x88')]['upsert']({'TeamId':_0x5dbeed['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},{'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x3051d2,function(_0x49bdfc){return db[_0x458a('0x89')][_0x458a('0x8a')]({'where':{'UserId':_0x49bdfc['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){_0x3051d2[_0x458a('0x8b')](function(_0x477402){socket['emit'](_0x458a('0x7b'),{'UserId':_0x477402['id'],'VoicePrefixId':_0x5d97cc['id']});});});});});}})[_0x458a('0x29')](respondWithStatusCode(_0x4ee34,null))['catch'](handleError(_0x4ee34,null));};exports[_0x458a('0x8c')]=function(_0x187bc8,_0x197858,_0x48622f){return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x187bc8[_0x458a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id'],'raw':!![]}]})[_0x458a('0x29')](handleEntityNotFound(_0x197858,null))[_0x458a('0x29')](function(_0x2334f3){var _0x46bfc7=_[_0x458a('0x33')](_0x2334f3,'id');var _0x43cb92=[];var _0x5c42a4=[];var _0x3c3c7b=squel['select']();_0x3c3c7b['field'](_0x458a('0x8d'))[_0x458a('0x8e')]('team_has_voice_prefixes','tq')[_0x458a('0x8f')]('user_has_teams','ut',_0x458a('0x90'))['where'](_0x458a('0x91'),_0x187bc8[_0x458a('0x4c')]['id']);for(var _0x20ad0b=0x0;_0x20ad0b<_0x2334f3[_0x458a('0x3e')];_0x20ad0b+=0x1){let _0x55eab3=_0x2334f3[_0x20ad0b];for(var _0x4677a6=0x0;_0x4677a6<_0x55eab3[_0x458a('0x83')][_0x458a('0x3e')];_0x4677a6+=0x1){let _0x4df0b4=_0x55eab3[_0x458a('0x83')][_0x4677a6];var _0xfd1b68=_0x3c3c7b[_0x458a('0x92')]();_0xfd1b68[_0x458a('0x43')]('ut.UserId\x20=\x20?',_0x4df0b4['id']);_0x5c42a4[_0x458a('0x6a')](db['sequelize']['query'](_0xfd1b68['toString'](),{'type':db[_0x458a('0x53')][_0x458a('0x93')]['SELECT']})[_0x458a('0x29')](function(_0x49297c){if(_0x49297c[_0x458a('0x3e')]===0x1){return _0x4df0b4['id'];}else{var _0x4bfd6b=_[_0x458a('0x94')](_['map'](_0x49297c,_0x458a('0x95')),function(_0x3c9685){return _[_0x458a('0x96')](_0x46bfc7,_0x3c9685);});if(_0x4bfd6b){return _0x4df0b4['id'];}}}));}}return BPromise[_0x458a('0x97')](_0x5c42a4)[_0x458a('0x29')](function(_0x2e24aa){_0x43cb92=_(_0x43cb92)[_0x458a('0x98')](_0x2e24aa)['compact']()[_0x458a('0x99')]();return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x187bc8['params']['id']}})['then'](function(_0x334129){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x330330){return _0x334129[_0x458a('0x8c')](_0x187bc8['query'][_0x458a('0x79')],{'transaction':_0x330330})[_0x458a('0x29')](function(){if(!_[_0x458a('0x9a')](_0x43cb92)){return _0x334129[_0x458a('0x7c')](_0x43cb92,{'transaction':_0x330330});}})[_0x458a('0x29')](function(){_0x43cb92['forEach'](function(_0x16a747){socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':_0x16a747,'VoicePrefixId':_0x334129['id']});});});});});});})[_0x458a('0x29')](respondWithStatusCode(_0x197858,null))[_0x458a('0x50')](handleError(_0x197858,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ac8b245..941ba3b 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 _0x3ace=['exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x449a38,_0x17fb45){var _0x3b208b=function(_0x4af535){while(--_0x4af535){_0x449a38['push'](_0x449a38['shift']());}};_0x3b208b(++_0x17fb45);}(_0x3ace,0x145));var _0xe3ac=function(_0x55f96d,_0x3e131c){_0x55f96d=_0x55f96d-0x0;var _0x57e449=_0x3ace[_0x55f96d];return _0x57e449;};'use strict';var EventEmitter=require(_0xe3ac('0x0'));var VoicePrefix=require(_0xe3ac('0x1'))['db'][_0xe3ac('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe3ac('0x3')](0x0);var events={'afterCreate':_0xe3ac('0x4'),'afterUpdate':'update','afterDestroy':_0xe3ac('0x5')};function emitEvent(_0xf8a940){return function(_0x443eb5,_0xdd7993,_0x3d6204){VoicePrefixEvents[_0xe3ac('0x6')](_0xf8a940+':'+_0x443eb5['id'],_0x443eb5);VoicePrefixEvents[_0xe3ac('0x6')](_0xf8a940,_0x443eb5);_0x3d6204(null);};}for(var e in events){if(events[_0xe3ac('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xe3ac('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x6e76=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x542654,_0x5eb886){var _0x1b67f7=function(_0x57feaf){while(--_0x57feaf){_0x542654['push'](_0x542654['shift']());}};_0x1b67f7(++_0x5eb886);}(_0x6e76,0xfc));var _0x66e7=function(_0x4b6535,_0x3e3389){_0x4b6535=_0x4b6535-0x0;var _0x1e0e7f=_0x6e76[_0x4b6535];return _0x1e0e7f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x66e7('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x66e7('0x1')](0x0);var events={'afterCreate':_0x66e7('0x2'),'afterUpdate':_0x66e7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f53fd){return function(_0x108b3b,_0x3f72d8,_0x157fb1){VoicePrefixEvents[_0x66e7('0x4')](_0x4f53fd+':'+_0x108b3b['id'],_0x108b3b);VoicePrefixEvents[_0x66e7('0x4')](_0x4f53fd,_0x108b3b);_0x157fb1(null);};}for(var e in events){if(events[_0x66e7('0x5')](e)){var event=events[e];VoicePrefix[_0x66e7('0x6')](e,emitEvent(event));}}module[_0x66e7('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index c1ccf7d..21b66e3 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 _0x2fe9=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5de6ad,_0x51aa5d){var _0x3511bc=function(_0x357def){while(--_0x357def){_0x5de6ad['push'](_0x5de6ad['shift']());}};_0x3511bc(++_0x51aa5d);}(_0x2fe9,0x181));var _0x92fe=function(_0x227428,_0x39cea8){_0x227428=_0x227428-0x0;var _0x215918=_0x2fe9[_0x227428];return _0x215918;};'use strict';var _=require(_0x92fe('0x0'));var util=require(_0x92fe('0x1'));var logger=require(_0x92fe('0x2'))(_0x92fe('0x3'));var moment=require(_0x92fe('0x4'));var BPromise=require(_0x92fe('0x5'));var rp=require(_0x92fe('0x6'));var fs=require('fs');var path=require(_0x92fe('0x7'));var rimraf=require(_0x92fe('0x8'));var config=require(_0x92fe('0x9'));var attributes=require(_0x92fe('0xa'));module[_0x92fe('0xb')]=function(_0x2791d6,_0x416dc6){return _0x2791d6[_0x92fe('0xc')](_0x92fe('0xd'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fa2=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8fa2,0x131));var _0x28fa=function(_0xea88c1,_0x461ebd){_0xea88c1=_0xea88c1-0x0;var _0x1082e8=_0x8fa2[_0xea88c1];return _0x1082e8;};'use strict';var _=require(_0x28fa('0x0'));var util=require('util');var logger=require(_0x28fa('0x1'))(_0x28fa('0x2'));var moment=require(_0x28fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x28fa('0x4'));var fs=require('fs');var path=require(_0x28fa('0x5'));var rimraf=require(_0x28fa('0x6'));var config=require(_0x28fa('0x7'));var attributes=require(_0x28fa('0x8'));module[_0x28fa('0x9')]=function(_0x4a710,_0x2f0ccc){return _0x4a710[_0x28fa('0xa')](_0x28fa('0xb'),attributes,{'tableName':'voice_prefixes','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 cde35d0..670b656 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 _0xba6f=['request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0xd3c9a5,_0x509934){var _0x36d360=function(_0x1c30cd){while(--_0x1c30cd){_0xd3c9a5['push'](_0xd3c9a5['shift']());}};_0x36d360(++_0x509934);}(_0xba6f,0x1d0));var _0xfba6=function(_0x243fd3,_0x25e8d3){_0x243fd3=_0x243fd3-0x0;var _0x1575b7=_0xba6f[_0x243fd3];return _0x1575b7;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var moment=require(_0xfba6('0x1'));var BPromise=require(_0xfba6('0x2'));var rs=require(_0xfba6('0x3'));var fs=require('fs');var Redis=require(_0xfba6('0x4'));var db=require(_0xfba6('0x5'))['db'];var utils=require(_0xfba6('0x6'));var logger=require(_0xfba6('0x7'))(_0xfba6('0x8'));var config=require(_0xfba6('0x9'));var jayson=require(_0xfba6('0xa'));var client=jayson[_0xfba6('0xb')][_0xfba6('0xc')]({'port':0x232a});config[_0xfba6('0xd')]=_['defaults'](config[_0xfba6('0xd')],{'host':_0xfba6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0xfba6('0xf')](socket);function respondWithRpcPromise(_0x122858,_0x135378,_0x12ac8a){return new BPromise(function(_0x1ef8fd,_0x366c0e){return client[_0xfba6('0x10')](_0x122858,_0x12ac8a)[_0xfba6('0x11')](function(_0x3d4005){logger[_0xfba6('0x12')](_0xfba6('0x13'),_0x135378,'request\x20sent');logger[_0xfba6('0x14')](_0xfba6('0x15'),_0x135378,_0xfba6('0x16'),JSON[_0xfba6('0x17')](_0x3d4005));if(_0x3d4005['error']){if(_0x3d4005[_0xfba6('0x18')]['code']===0x1f4){logger['error'](_0xfba6('0x13'),_0x135378,_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);return _0x366c0e(_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);}logger[_0xfba6('0x18')](_0xfba6('0x13'),_0x135378,_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);return _0x1ef8fd(_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);}else{logger[_0xfba6('0x12')](_0xfba6('0x13'),_0x135378,'request\x20sent');_0x1ef8fd(_0x3d4005[_0xfba6('0x1a')][_0xfba6('0x19')]);}})['catch'](function(_0x581d0d){logger[_0xfba6('0x18')](_0xfba6('0x13'),_0x135378,_0x581d0d);_0x366c0e(_0x581d0d);});});} \ No newline at end of file +var _0xd046=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent'];(function(_0x34bfc8,_0x4ed7de){var _0x4c03f0=function(_0x2aba3d){while(--_0x2aba3d){_0x34bfc8['push'](_0x34bfc8['shift']());}};_0x4c03f0(++_0x4ed7de);}(_0xd046,0x129));var _0x6d04=function(_0x2780d4,_0x4f4d77){_0x2780d4=_0x2780d4-0x0;var _0xb16768=_0xd046[_0x2780d4];return _0xb16768;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});config[_0x6d04('0x7')]=_['defaults'](config['redis'],{'host':_0x6d04('0x8'),'port':0x18eb});var socket=require(_0x6d04('0x9'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6d04('0xa')](socket);function respondWithRpcPromise(_0x4b5aae,_0x38bce9,_0x5876b8){return new BPromise(function(_0x5a2dbb,_0x4d3a31){return client[_0x6d04('0xb')](_0x4b5aae,_0x5876b8)[_0x6d04('0xc')](function(_0x3397ea){logger[_0x6d04('0xd')]('VoicePrefix,\x20%s,\x20%s',_0x38bce9,_0x6d04('0xe'));logger[_0x6d04('0xf')](_0x6d04('0x10'),_0x38bce9,_0x6d04('0xe'),JSON[_0x6d04('0x11')](_0x3397ea));if(_0x3397ea[_0x6d04('0x12')]){if(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x13')]===0x1f4){logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);return _0x4d3a31(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);}logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);return _0x5a2dbb(_0x3397ea[_0x6d04('0x12')][_0x6d04('0x15')]);}else{logger[_0x6d04('0xd')](_0x6d04('0x14'),_0x38bce9,_0x6d04('0xe'));_0x5a2dbb(_0x3397ea[_0x6d04('0x16')]['message']);}})[_0x6d04('0x17')](function(_0x1dcd3d){logger[_0x6d04('0x12')](_0x6d04('0x14'),_0x38bce9,_0x1dcd3d);_0x4d3a31(_0x1dcd3d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 5ae0700..c2febb8 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 _0x4746=['length','voicePrefix:','./voicePrefix.events','save','update','emit','register'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0x4746,0xc6));var _0x6474=function(_0xfed0f9,_0x27e1a2){_0xfed0f9=_0xfed0f9-0x0;var _0xa13899=_0x4746[_0xfed0f9];return _0xa13899;};'use strict';var VoicePrefixEvents=require(_0x6474('0x0'));var events=[_0x6474('0x1'),'remove',_0x6474('0x2')];function createListener(_0x59b95a,_0xd115f7){return function(_0x244bc5){_0xd115f7[_0x6474('0x3')](_0x59b95a,_0x244bc5);};}function removeListener(_0x156374,_0x1314f4){return function(){VoicePrefixEvents['removeListener'](_0x156374,_0x1314f4);};}exports[_0x6474('0x4')]=function(_0x2bcf7c){for(var _0x4cadd7=0x0,_0x433af9=events[_0x6474('0x5')];_0x4cadd7<_0x433af9;_0x4cadd7++){var _0xcd065e=events[_0x4cadd7];var _0xec3cda=createListener(_0x6474('0x6')+_0xcd065e,_0x2bcf7c);VoicePrefixEvents['on'](_0xcd065e,_0xec3cda);}}; \ No newline at end of file +var _0x324f=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x2715ed,_0x3f0d2d){var _0x2477b4=function(_0x2b020d){while(--_0x2b020d){_0x2715ed['push'](_0x2715ed['shift']());}};_0x2477b4(++_0x3f0d2d);}(_0x324f,0x94));var _0xf324=function(_0x3c0fbc,_0xa02f8f){_0x3c0fbc=_0x3c0fbc-0x0;var _0x27f823=_0x324f[_0x3c0fbc];return _0x27f823;};'use strict';var VoicePrefixEvents=require(_0xf324('0x0'));var events=[_0xf324('0x1'),_0xf324('0x2'),'update'];function createListener(_0x54657f,_0x1f9dd7){return function(_0x48f6ef){_0x1f9dd7[_0xf324('0x3')](_0x54657f,_0x48f6ef);};}function removeListener(_0x30c658,_0x5e0457){return function(){VoicePrefixEvents[_0xf324('0x4')](_0x30c658,_0x5e0457);};}exports[_0xf324('0x5')]=function(_0x5657a5){for(var _0x19ef3b=0x0,_0x390f7d=events[_0xf324('0x6')];_0x19ef3b<_0x390f7d;_0x19ef3b++){var _0x2290b7=events[_0x19ef3b];var _0x408b34=createListener(_0xf324('0x7')+_0x2290b7,_0x5657a5);VoicePrefixEvents['on'](_0x2290b7,_0x408b34);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 690e9cd..6bf9b6a 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 _0x4bc2=['/:id/users','getAgents','/:id/members','/:id/lists','getLists','getBlackLists','post','/:id/clone','addTeams','addAgents','addLists','/:id/blacklists','addBlackLists','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','isAuthenticated','show','/:id/hopper_histories','getHopperHistories','/:id/teams','getTeams'];(function(_0x1f2a53,_0x2499cb){var _0x2ccde2=function(_0x3e0fa5){while(--_0x3e0fa5){_0x1f2a53['push'](_0x1f2a53['shift']());}};_0x2ccde2(++_0x2499cb);}(_0x4bc2,0x1f4));var _0x24bc=function(_0x2431f7,_0x2cdc91){_0x2431f7=_0x2431f7-0x0;var _0x23c247=_0x4bc2[_0x2431f7];return _0x23c247;};'use strict';var multer=require(_0x24bc('0x0'));var util=require(_0x24bc('0x1'));var path=require(_0x24bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x24bc('0x3'));var router=express[_0x24bc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x24bc('0x5'));var interaction=require(_0x24bc('0x6'));var config=require(_0x24bc('0x7'));var controller=require(_0x24bc('0x8'));router[_0x24bc('0x9')]('/',auth['isAuthenticated'](),controller[_0x24bc('0xa')]);router[_0x24bc('0x9')]('/methods',auth['isAuthenticated'](),controller['getMethods']);router[_0x24bc('0x9')](_0x24bc('0xb'),auth[_0x24bc('0xc')](),controller[_0x24bc('0xd')]);router[_0x24bc('0x9')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0x24bc('0x9')](_0x24bc('0xe'),auth[_0x24bc('0xc')](),controller[_0x24bc('0xf')]);router[_0x24bc('0x9')]('/:id/hopper_finals',auth[_0x24bc('0xc')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0x24bc('0xc')](),controller['getHopperBlacks']);router['get'](_0x24bc('0x10'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x11')]);router[_0x24bc('0x9')](_0x24bc('0x12'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x13')]);router['get'](_0x24bc('0x14'),auth[_0x24bc('0xc')](),controller['getMembers']);router['get'](_0x24bc('0x15'),auth['isAuthenticated'](),controller[_0x24bc('0x16')]);router[_0x24bc('0x9')]('/:id/blacklists',auth[_0x24bc('0xc')](),controller[_0x24bc('0x17')]);router[_0x24bc('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0x24bc('0x18')](_0x24bc('0x19'),auth[_0x24bc('0xc')](),controller['clone']);router['post'](_0x24bc('0x10'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x1a')]);router[_0x24bc('0x18')](_0x24bc('0x12'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x1b')]);router[_0x24bc('0x18')]('/:id/lists',auth[_0x24bc('0xc')](),controller[_0x24bc('0x1c')]);router[_0x24bc('0x18')](_0x24bc('0x1d'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x1e')]);router['put'](_0x24bc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x24bc('0x1f')](_0x24bc('0xb'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x20')]);router[_0x24bc('0x1f')](_0x24bc('0x10'),auth['isAuthenticated'](),controller[_0x24bc('0x21')]);router['delete'](_0x24bc('0x12'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x22')]);router['delete'](_0x24bc('0x15'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x23')]);router[_0x24bc('0x1f')](_0x24bc('0x1d'),auth[_0x24bc('0xc')](),controller[_0x24bc('0x24')]);module['exports']=router; \ No newline at end of file +var _0x63db=['get','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','create','post','clone','addTeams','addBlackLists','/:id','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/methods','getMethods'];(function(_0x1f0f74,_0x53b3cd){var _0x2f0484=function(_0x4cde55){while(--_0x4cde55){_0x1f0f74['push'](_0x1f0f74['shift']());}};_0x2f0484(++_0x53b3cd);}(_0x63db,0x132));var _0xb63d=function(_0xf93453,_0x2d0aac){_0xf93453=_0xf93453-0x0;var _0x5a6cc4=_0x63db[_0xf93453];return _0x5a6cc4;};'use strict';var multer=require(_0xb63d('0x0'));var util=require(_0xb63d('0x1'));var path=require(_0xb63d('0x2'));var timeout=require(_0xb63d('0x3'));var express=require(_0xb63d('0x4'));var router=express[_0xb63d('0x5')]();var fs_extra=require(_0xb63d('0x6'));var auth=require(_0xb63d('0x7'));var interaction=require(_0xb63d('0x8'));var config=require(_0xb63d('0x9'));var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xb63d('0xa')](),controller[_0xb63d('0xb')]);router['get'](_0xb63d('0xc'),auth[_0xb63d('0xa')](),controller[_0xb63d('0xd')]);router[_0xb63d('0xe')]('/:id',auth[_0xb63d('0xa')](),controller[_0xb63d('0xf')]);router[_0xb63d('0xe')](_0xb63d('0x10'),auth[_0xb63d('0xa')](),controller[_0xb63d('0x11')]);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xb63d('0x12')]);router['get'](_0xb63d('0x13'),auth[_0xb63d('0xa')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xb63d('0xa')](),controller[_0xb63d('0x14')]);router[_0xb63d('0xe')](_0xb63d('0x15'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb63d('0xe')](_0xb63d('0x16'),auth[_0xb63d('0xa')](),controller[_0xb63d('0x17')]);router[_0xb63d('0xe')](_0xb63d('0x18'),auth['isAuthenticated'](),controller[_0xb63d('0x19')]);router[_0xb63d('0xe')](_0xb63d('0x1a'),auth[_0xb63d('0xa')](),controller[_0xb63d('0x1b')]);router[_0xb63d('0xe')]('/:id/blacklists',auth[_0xb63d('0xa')](),controller[_0xb63d('0x1c')]);router['post']('/',auth[_0xb63d('0xa')](),controller[_0xb63d('0x1d')]);router[_0xb63d('0x1e')]('/:id/clone',auth['isAuthenticated'](),controller[_0xb63d('0x1f')]);router[_0xb63d('0x1e')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb63d('0x20')]);router[_0xb63d('0x1e')](_0xb63d('0x16'),auth[_0xb63d('0xa')](),controller['addAgents']);router[_0xb63d('0x1e')](_0xb63d('0x1a'),auth[_0xb63d('0xa')](),controller['addLists']);router[_0xb63d('0x1e')]('/:id/blacklists',auth[_0xb63d('0xa')](),controller[_0xb63d('0x21')]);router['put'](_0xb63d('0x22'),auth[_0xb63d('0xa')](),controller[_0xb63d('0x23')]);router[_0xb63d('0x24')](_0xb63d('0x22'),auth['isAuthenticated'](),controller[_0xb63d('0x25')]);router[_0xb63d('0x24')]('/:id/teams',auth[_0xb63d('0xa')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0xb63d('0xa')](),controller['removeAgents']);router[_0xb63d('0x24')](_0xb63d('0x1a'),auth[_0xb63d('0xa')](),controller[_0xb63d('0x26')]);router[_0xb63d('0x24')]('/:id/blacklists',auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xb63d('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 41ade9b..49f79ed 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 _0xe93a=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','outbound','STRING','default','ENUM','leastrecent','random','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','inbound','booked','rrmemory','progressive','predictive','power','INTEGER','yes','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0xe93a,0x1a7));var _0xae93=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xe93a[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0xae93('0x0'));module[_0xae93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xae93('0x2')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xae93('0x3')],'defaultValue':_0xae93('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xae93('0x5')]('rr','ringall',_0xae93('0x6'),'fewestcalls',_0xae93('0x7'),'rrmemory','linear',_0xae93('0x8'),_0xae93('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x4ef2f6){this[_0xae93('0xa')](_0xae93('0xb'),_0x4ef2f6?_0x4ef2f6:'rrmemory');},'get':function(){var _0x175c8d=this[_0xae93('0xc')]('type');var _0x1503af=this[_0xae93('0xc')](_0xae93('0xd'));var _0x5c4ba0=this[_0xae93('0xc')]('strategy');if(_0x175c8d===_0xae93('0xe')){return _0x5c4ba0;}if(_0x1503af===_0xae93('0xf')&&_0x5c4ba0===_0xae93('0x10')||_0x1503af==='booked'&&_0x5c4ba0==='roundrobin'){return _0x5c4ba0;}if(_0x1503af===_0xae93('0x11')||_0x1503af===_0xae93('0x12')||_0x1503af===_0xae93('0x13')){return _0x5c4ba0;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xae93('0x3')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xae93('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xae93('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xae93('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xae93('0x5')]('yes','no'),'defaultValue':_0xae93('0x15')},'autopause':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xae93('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xae93('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xae93('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xae93('0x5')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xae93('0x5')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xae93('0x3')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xae93('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no'),'defaultValue':_0xae93('0x15')},'announce_holdtime':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xae93('0x3')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xae93('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xae93('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xae93('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xae93('0x3')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xae93('0x3')]},'queue_youarenext':{'type':Sequelize[_0xae93('0x3')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xae93('0x3')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xae93('0x3')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xae93('0x3')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xae93('0x3')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xae93('0x3')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xae93('0x3')]},'queue_quantity1':{'type':Sequelize[_0xae93('0x3')]},'queue_quantity2':{'type':Sequelize[_0xae93('0x3')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xae93('0x3')]},'periodic_announce':{'type':Sequelize[_0xae93('0x16')],'set':function(_0x3d6ea4){this[_0xae93('0xa')]('periodic_announce',_0x3d6ea4?_0x3d6ea4['join'](','):[]);},'get':function(){return this[_0xae93('0xc')](_0xae93('0x17'))?this[_0xae93('0xc')]('periodic_announce')[_0xae93('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0xae93('0x3')],'defaultValue':_0xae93('0x15'),'set':function(_0x452f46){this[_0xae93('0xa')](_0xae93('0x19'),_0x452f46?_0x452f46[_0xae93('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xae93('0x19'))?this[_0xae93('0xc')](_0xae93('0x19'))[_0xae93('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xae93('0x3')],'defaultValue':'no','set':function(_0x3a8ffd){this[_0xae93('0xa')](_0xae93('0x1b'),_0x3a8ffd?_0x3a8ffd['join'](','):undefined);},'get':function(){return this[_0xae93('0xc')](_0xae93('0x1b'))?this[_0xae93('0xc')]('leavewhenempty')[_0xae93('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xae93('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xae93('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xae93('0x3')]},'description':{'type':Sequelize[_0xae93('0x3')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5c0c42){this[_0xae93('0xa')](_0xae93('0x1c'),_0x5c0c42);if(_0x5c0c42){if(this[_0xae93('0xc')](_0xae93('0x1d'))<0x2){this[_0xae93('0xa')](_0xae93('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xae93('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xae93('0x1e')],'defaultValue':0x0,'comment':_0xae93('0x1f')},'dialMethod':{'type':Sequelize[_0xae93('0x5')]('preview',_0xae93('0x11'),_0xae93('0x13'),_0xae93('0x12'),_0xae93('0xf')),'defaultValue':'progressive','comment':_0xae93('0x20')},'dialLimitChannel':{'type':Sequelize[_0xae93('0x14')](0x4)[_0xae93('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae93('0x22')},'dialLimitQueue':{'type':Sequelize[_0xae93('0x14')](0x4)[_0xae93('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xae93('0x23')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xae93('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xae93('0x24')},'dialPredictiveOptimization':{'type':Sequelize[_0xae93('0x5')](_0xae93('0x25'),_0xae93('0x26')),'defaultValue':_0xae93('0x26'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xae93('0x27')](0x2)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xae93('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xae93('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xae93('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xae93('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xae93('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xae93('0x3')],'defaultValue':_0xae93('0x2a'),'comment':_0xae93('0x2b')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae93('0x2c')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xae93('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae93('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae93('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xae93('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae93('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xae93('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xae93('0x33')},'dialPrefix':{'type':Sequelize[_0xae93('0x3')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xae93('0x5')]('always',_0xae93('0x34'),'onlyIfOpen'),'defaultValue':_0xae93('0x35')},'dialAMDActive':{'type':Sequelize[_0xae93('0x1e')],'defaultValue':0x0,'comment':_0xae93('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0xae93('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xae93('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xae93('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xae93('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xae93('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xae93('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xae93('0x14')](0x9)[_0xae93('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xae93('0x14')](0x9)[_0xae93('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xae93('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xae93('0x14')](0x9)[_0xae93('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xae93('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xae93('0x14')](0x9)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xae93('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xae93('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xae93('0x14')](0x9)[_0xae93('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xae93('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xae93('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xae93('0x1e')],'defaultValue':0x0,'comment':_0xae93('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xae93('0x5')]('DESC','ASC'),'defaultValue':_0xae93('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xae93('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xae93('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xae93('0x42')},'dialCutDigit':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xae93('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae93('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae93('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae93('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae93('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae93('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae93('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xae93('0x14')](0x3)[_0xae93('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xae93('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xae93('0x14')](0x5)[_0xae93('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xae93('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae93('0x14')],'allowNull':!![],'comment':_0xae93('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xae93('0x4d'),'set':function(_0x13d628){if(!_0x13d628)this['setDataValue'](_0xae93('0x4e'),null);this['setDataValue'](_0xae93('0x4f'),_0x13d628);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xae93('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xae93('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xd9c8=['#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue','strategy','rrmemory','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','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\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,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd9c8[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x8d9c('0x0'));module[_0x8d9c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8d9c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x4'),_0x8d9c('0x5')),'allowNull':![],'defaultValue':_0x8d9c('0x4')},'musiconhold':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':_0x8d9c('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x8d9c('0x8'),_0x8d9c('0x9'),_0x8d9c('0xa'),'rrmemory',_0x8d9c('0xb'),_0x8d9c('0xc'),_0x8d9c('0xd')),'allowNull':![],'defaultValue':_0x8d9c('0xe'),'set':function(_0x2db4b3){this[_0x8d9c('0xf')](_0x8d9c('0x10'),_0x2db4b3?_0x2db4b3:_0x8d9c('0x11'));},'get':function(){var _0x52de51=this[_0x8d9c('0x12')]('type');var _0xa2c2c=this['getDataValue'](_0x8d9c('0x13'));var _0x5c93f3=this['getDataValue'](_0x8d9c('0x10'));if(_0x52de51==='inbound'){return _0x5c93f3;}if(_0xa2c2c===_0x8d9c('0x14')&&_0x5c93f3===_0x8d9c('0x11')||_0xa2c2c===_0x8d9c('0x14')&&_0x5c93f3===_0x8d9c('0x15')){return _0x5c93f3;}if(_0xa2c2c===_0x8d9c('0x16')||_0xa2c2c===_0x8d9c('0x17')||_0xa2c2c===_0x8d9c('0x18')){return _0x5c93f3;}return null;}},'servicelevel':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8d9c('0x19')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8d9c('0x6')]},'weight':{'type':Sequelize[_0x8d9c('0x19')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no'),'defaultValue':_0x8d9c('0x1a')},'autopause':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no',_0x8d9c('0x1b')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x8d9c('0x1a'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x8d9c('0x1a'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8d9c('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x8d9c('0x3')]('yes','no',_0x8d9c('0x1c')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x1a'),'no')},'announce_position_limit':{'type':Sequelize[_0x8d9c('0x19')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8d9c('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8d9c('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x8d9c('0x6')]},'queue_quantity2':{'type':Sequelize[_0x8d9c('0x6')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x8d9c('0x1d')],'set':function(_0x5b438c){this[_0x8d9c('0xf')](_0x8d9c('0x1e'),_0x5b438c?_0x5b438c[_0x8d9c('0x1f')](','):[]);},'get':function(){return this['getDataValue'](_0x8d9c('0x1e'))?this[_0x8d9c('0x12')](_0x8d9c('0x1e'))[_0x8d9c('0x20')](','):[];}},'joinempty':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':_0x8d9c('0x1a'),'set':function(_0x5b1cf8){this['setDataValue'](_0x8d9c('0x21'),_0x5b1cf8?_0x5b1cf8['join'](','):undefined);},'get':function(){return this[_0x8d9c('0x12')](_0x8d9c('0x21'))?this['getDataValue'](_0x8d9c('0x21'))[_0x8d9c('0x20')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':'no','set':function(_0x298407){this[_0x8d9c('0xf')](_0x8d9c('0x22'),_0x298407?_0x298407[_0x8d9c('0x1f')](','):undefined);},'get':function(){return this[_0x8d9c('0x12')](_0x8d9c('0x22'))?this[_0x8d9c('0x12')](_0x8d9c('0x22'))[_0x8d9c('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8d9c('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x8d9c('0x1a'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8d9c('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8d9c('0x6')]},'description':{'type':Sequelize[_0x8d9c('0x6')]},'acw':{'type':Sequelize[_0x8d9c('0x23')],'defaultValue':0x0,'set':function(_0x2b8464){this[_0x8d9c('0xf')](_0x8d9c('0x24'),_0x2b8464);if(_0x2b8464){if(this[_0x8d9c('0x12')]('wrapuptime')<0x2){this[_0x8d9c('0xf')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8d9c('0x19')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x25'),_0x8d9c('0x16'),_0x8d9c('0x18'),_0x8d9c('0x17'),'booked'),'defaultValue':'progressive','comment':_0x8d9c('0x26')},'dialLimitChannel':{'type':Sequelize[_0x8d9c('0x19')](0x4)[_0x8d9c('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8d9c('0x28')},'dialLimitQueue':{'type':Sequelize[_0x8d9c('0x19')](0x4)[_0x8d9c('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8d9c('0x29')},'dialPowerLevel':{'type':Sequelize[_0x8d9c('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8d9c('0x2b')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x8d9c('0x2c')),'defaultValue':_0x8d9c('0x2c'),'comment':_0x8d9c('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x8d9c('0x19')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8d9c('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8d9c('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0x8d9c('0x19')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d9c('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':_0x8d9c('0x2f'),'comment':_0x8d9c('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d9c('0x31')},'dialQueueProject':{'type':Sequelize[_0x8d9c('0x6')],'comment':_0x8d9c('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8d9c('0x19')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d9c('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8d9c('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d9c('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8d9c('0x19')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d9c('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'defaultValue':0x3,'comment':_0x8d9c('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8d9c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8d9c('0x37')},'dialTimezone':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':_0x8d9c('0x38')},'dialPrefix':{'type':Sequelize[_0x8d9c('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8d9c('0x39'),_0x8d9c('0x3a'),_0x8d9c('0x3b')),'defaultValue':_0x8d9c('0x39')},'dialAMDActive':{'type':Sequelize[_0x8d9c('0x23')],'defaultValue':0x0,'comment':_0x8d9c('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x8d9c('0x19')](0x9)[_0x8d9c('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x8d9c('0x19')](0x9)[_0x8d9c('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8d9c('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8d9c('0x19')](0x9)[_0x8d9c('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8d9c('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8d9c('0x19')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8d9c('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x8d9c('0x19')](0x9)[_0x8d9c('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8d9c('0x19')](0x9)[_0x8d9c('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8d9c('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8d9c('0x19')](0x9)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8d9c('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8d9c('0x19')](0x5)[_0x8d9c('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8d9c('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8d9c('0x19')](0x9)[_0x8d9c('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8d9c('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x8d9c('0x19')](0x5)[_0x8d9c('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8d9c('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x8d9c('0x23')],'defaultValue':0x0,'comment':_0x8d9c('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8d9c('0x3')](_0x8d9c('0x46'),'ASC'),'defaultValue':_0x8d9c('0x46')},'dialQueueProject2':{'type':Sequelize[_0x8d9c('0x6')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8d9c('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8d9c('0x47')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8d9c('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8d9c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d9c('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8d9c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d9c('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8d9c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d9c('0x4b')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d9c('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8d9c('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d9c('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d9c('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d9c('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8d9c('0x19')],'allowNull':!![],'comment':_0x8d9c('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x8d9c('0x23')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x49cebd){if(!_0x49cebd)this[_0x8d9c('0xf')](_0x8d9c('0x51'),null);this[_0x8d9c('0xf')](_0x8d9c('0x52'),_0x49cebd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8d9c('0x19')](0x3)[_0x8d9c('0x27')],'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 3daa216..c8ae837 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 _0x03bd=['SELECT','TeamId','union','isEmpty','removeAgents','addAgents','spread','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','fromQuery','scheduledAt','ContactId','ListId','phone','NOW()','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','deletedAt\x20IS\x20NULL','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','getMethods','Progressive','progressive','PowerDialing','power','Predictive','predictive','preview','booked','dialerMethods','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','value','includes','type','find','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','order','CmHopperBlack','getTeams','Team','User','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes'];(function(_0x513e46,_0x798ec6){var _0x5dc950=function(_0x4abfd6){while(--_0x4abfd6){_0x513e46['push'](_0x513e46['shift']());}};_0x5dc950(++_0x798ec6);}(_0x03bd,0xf7));var _0xd03b=function(_0x263af6,_0x5ba9bd){_0x263af6=_0x263af6-0x0;var _0x53fb9b=_0x03bd[_0x263af6];return _0x53fb9b;};'use strict';var emlformat=require(_0xd03b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd03b('0x1'));var jsonpatch=require(_0xd03b('0x2'));var rp=require(_0xd03b('0x3'));var moment=require(_0xd03b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd03b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd03b('0x6'));var csv=require('to-csv');var ejs=require(_0xd03b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd03b('0x8'));var squel=require(_0xd03b('0x9'));var crypto=require(_0xd03b('0xa'));var jsforce=require(_0xd03b('0xb'));var deskjs=require(_0xd03b('0xc'));var toCsv=require(_0xd03b('0xd'));var querystring=require(_0xd03b('0xe'));var Papa=require(_0xd03b('0xf'));var Redis=require('ioredis');var authService=require(_0xd03b('0x10'));var qs=require(_0xd03b('0x11'));var as=require(_0xd03b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd03b('0x13'));var utils=require(_0xd03b('0x14'));var config=require(_0xd03b('0x15'));var licenseUtil=require(_0xd03b('0x16'));var db=require(_0xd03b('0x17'))['db'];config[_0xd03b('0x18')]=_[_0xd03b('0x19')](config[_0xd03b('0x18')],{'host':_0xd03b('0x1a'),'port':0x18eb});var socket=require(_0xd03b('0x1b'))(new Redis(config[_0xd03b('0x18')]));require(_0xd03b('0x1c'))[_0xd03b('0x1d')](socket);function respondWithStatusCode(_0x16f54a,_0x4d9e0b){_0x4d9e0b=_0x4d9e0b||0xcc;return function(_0x44dd1e){if(_0x44dd1e){return _0x16f54a['sendStatus'](_0x4d9e0b);}return _0x16f54a['status'](_0x4d9e0b)['end']();};}function respondWithResult(_0x76415,_0x1433ec){_0x1433ec=_0x1433ec||0xc8;return function(_0x1a5480){if(_0x1a5480){return _0x76415[_0xd03b('0x1e')](_0x1433ec)[_0xd03b('0x1f')](_0x1a5480);}};}function respondWithFilteredResult(_0xa76745,_0x354026){return function(_0x1aba32){if(_0x1aba32){var _0x3ffc62=typeof _0x354026[_0xd03b('0x20')]===_0xd03b('0x21')&&typeof _0x354026['limit']===_0xd03b('0x21');var _0x49c857=_0x1aba32[_0xd03b('0x22')];var _0x2fe7ab=_0x3ffc62?0x0:_0x354026[_0xd03b('0x20')];var _0x3e78bb=_0x3ffc62?_0x1aba32[_0xd03b('0x22')]:_0x354026[_0xd03b('0x20')]+_0x354026[_0xd03b('0x23')];var _0x3f678e;if(_0x3e78bb>=_0x49c857){_0x3e78bb=_0x49c857;_0x3f678e=0xc8;}else{_0x3f678e=0xce;}_0xa76745[_0xd03b('0x1e')](_0x3f678e);return _0xa76745['set'](_0xd03b('0x24'),_0x2fe7ab+'-'+_0x3e78bb+'/'+_0x49c857)[_0xd03b('0x1f')](_0x1aba32);}return null;};}function patchUpdates(_0x3e9464){return function(_0x480f8a){try{jsonpatch[_0xd03b('0x25')](_0x480f8a,_0x3e9464,!![]);}catch(_0x89dc7e){return BPromise[_0xd03b('0x26')](_0x89dc7e);}return _0x480f8a[_0xd03b('0x27')]();};}function saveUpdates(_0x2d37ba,_0x287e8a){return function(_0x5b8ead){if(_0x5b8ead){return _0x5b8ead[_0xd03b('0x28')](_0x2d37ba)[_0xd03b('0x29')](function(_0x565f13){return _0x565f13;});}return null;};}function removeEntity(_0x3794c9,_0x44914d){return function(_0x5a0c94){if(_0x5a0c94){return _0x5a0c94[_0xd03b('0x2a')]()[_0xd03b('0x29')](function(){var _0x1923de=_0x5a0c94[_0xd03b('0x2b')]({'plain':!![]});var _0x2f1b63=[{'name':_0xd03b('0x2c'),'value':_0xd03b('0x2d'),'ignore':![]},{'name':_0xd03b('0x2e'),'value':_0xd03b('0x2f'),'ignore':![]}];var _0x1ab674=_(_0x2f1b63)['filter'](_0xd03b('0x30'))['map'](_0xd03b('0x31'))[_0xd03b('0x31')]();if(_[_0xd03b('0x32')](_0x1ab674,_0x1923de[_0xd03b('0x33')])){return;}var _0x46fa23=_[_0xd03b('0x34')](_0x2f1b63,[_0xd03b('0x31'),_0x1923de[_0xd03b('0x33')]])['name'];return db[_0xd03b('0x35')][_0xd03b('0x2a')]({'where':{'type':_0x46fa23,'resourceId':_0x1923de['id']}})[_0xd03b('0x29')](function(){return _0x5a0c94;});})[_0xd03b('0x29')](function(){_0x3794c9['status'](0xcc)[_0xd03b('0x36')]();});}};}function handleEntityNotFound(_0xfbe83d,_0x404902){return function(_0xc6a04e){if(!_0xc6a04e){_0xfbe83d[_0xd03b('0x37')](0x194);}return _0xc6a04e;};}function handleError(_0x51dcaa,_0x59f5bd){_0x59f5bd=_0x59f5bd||0x1f4;return function(_0x39f35c){logger[_0xd03b('0x38')](_0x39f35c[_0xd03b('0x39')]);if(_0x39f35c['name']){delete _0x39f35c[_0xd03b('0x3a')];}_0x51dcaa[_0xd03b('0x1e')](_0x59f5bd)[_0xd03b('0x3b')](_0x39f35c);};}exports[_0xd03b('0x3c')]=function(_0x28a3a6,_0x35b865){var _0x17de95={},_0x5f1505={},_0xe9ce67={'count':0x0,'rows':[]};var _0x2a4362=_[_0xd03b('0x3d')](db[_0xd03b('0x3e')][_0xd03b('0x3f')],function(_0x3ddec4){return{'name':_0x3ddec4[_0xd03b('0x40')],'type':_0x3ddec4[_0xd03b('0x33')]['key']};});_0x5f1505[_0xd03b('0x41')]=_[_0xd03b('0x3d')](_0x2a4362,_0xd03b('0x3a'));_0x5f1505[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0x28a3a6[_0xd03b('0x42')]);_0x5f1505[_0xd03b('0x44')]=_[_0xd03b('0x45')](_0x5f1505['model'],_0x5f1505[_0xd03b('0x42')]);_0x17de95[_0xd03b('0x46')]=_[_0xd03b('0x45')](_0x5f1505['model'],qs['fields'](_0x28a3a6['query'][_0xd03b('0x47')]));_0x17de95[_0xd03b('0x46')]=_0x17de95[_0xd03b('0x46')][_0xd03b('0x48')]?_0x17de95[_0xd03b('0x46')]:_0x5f1505[_0xd03b('0x41')];if(!_0x28a3a6['query'][_0xd03b('0x49')]('nolimit')){_0x17de95[_0xd03b('0x23')]=qs['limit'](_0x28a3a6[_0xd03b('0x42')][_0xd03b('0x23')]);_0x17de95[_0xd03b('0x20')]=qs['offset'](_0x28a3a6['query'][_0xd03b('0x20')]);}_0x17de95['order']=qs[_0xd03b('0x4a')](_0x28a3a6[_0xd03b('0x42')][_0xd03b('0x4a')]);_0x17de95[_0xd03b('0x4b')]=qs[_0xd03b('0x44')](_[_0xd03b('0x4c')](_0x28a3a6['query'],_0x5f1505[_0xd03b('0x44')]),_0x2a4362);if(_0x28a3a6[_0xd03b('0x42')][_0xd03b('0x4d')]){_0x17de95['where']=_[_0xd03b('0x4e')](_0x17de95[_0xd03b('0x4b')],{'$or':_[_0xd03b('0x3d')](_0x2a4362,function(_0x24c3cc){if(_0x24c3cc[_0xd03b('0x33')]!=='VIRTUAL'){var _0x20d4fd={};_0x20d4fd[_0x24c3cc[_0xd03b('0x3a')]]={'$like':'%'+_0x28a3a6['query']['filter']+'%'};return _0x20d4fd;}})});}_0x17de95=_[_0xd03b('0x4e')]({},_0x17de95,_0x28a3a6[_0xd03b('0x4f')]);var _0x4b4009={'where':_0x17de95[_0xd03b('0x4b')]};return db[_0xd03b('0x3e')][_0xd03b('0x22')](_0x4b4009)['then'](function(_0xed9d3e){_0xe9ce67[_0xd03b('0x22')]=_0xed9d3e;if(_0x28a3a6[_0xd03b('0x42')][_0xd03b('0x50')]){_0x17de95[_0xd03b('0x51')]=[{'all':!![]}];}return db[_0xd03b('0x3e')][_0xd03b('0x52')](_0x17de95);})[_0xd03b('0x29')](function(_0x30f828){_0xe9ce67[_0xd03b('0x53')]=_0x30f828;return _0xe9ce67;})[_0xd03b('0x29')](respondWithFilteredResult(_0x35b865,_0x17de95))[_0xd03b('0x54')](handleError(_0x35b865,null));};exports[_0xd03b('0x55')]=function(_0x390618,_0x2485ab){var _0x25b2bf={'raw':![],'where':{'id':_0x390618[_0xd03b('0x56')]['id']}},_0x253541={};_0x253541[_0xd03b('0x41')]=_[_0xd03b('0x43')](db[_0xd03b('0x3e')][_0xd03b('0x3f')]);_0x253541[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0x390618[_0xd03b('0x42')]);_0x253541['filters']=_[_0xd03b('0x45')](_0x253541[_0xd03b('0x41')],_0x253541[_0xd03b('0x42')]);_0x25b2bf[_0xd03b('0x46')]=_[_0xd03b('0x45')](_0x253541[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0x390618[_0xd03b('0x42')][_0xd03b('0x47')]));_0x25b2bf['attributes']=_0x25b2bf[_0xd03b('0x46')][_0xd03b('0x48')]?_0x25b2bf['attributes']:_0x253541[_0xd03b('0x41')];if(_0x390618['query'][_0xd03b('0x50')]){_0x25b2bf[_0xd03b('0x51')]=[{'all':!![]}];}_0x25b2bf=_[_0xd03b('0x4e')]({},_0x25b2bf,_0x390618['options']);return db[_0xd03b('0x3e')][_0xd03b('0x34')](_0x25b2bf)[_0xd03b('0x29')](handleEntityNotFound(_0x2485ab,null))['then'](respondWithResult(_0x2485ab,null))[_0xd03b('0x54')](handleError(_0x2485ab,null));};exports[_0xd03b('0x57')]=function(_0x3b4606,_0x58d1c0){return db['VoiceQueue']['create'](_0x3b4606[_0xd03b('0x58')],{})['then'](function(_0x35b343){var _0x501bed=_0x3b4606['user']['get']({'plain':!![]});if(!_0x501bed)throw new Error(_0xd03b('0x59'));if(_0x501bed['role']===_0xd03b('0x5a')){var _0x1c9524=_0x35b343[_0xd03b('0x2b')]({'plain':!![]});var _0x2f2794=[{'name':_0xd03b('0x2c'),'value':_0xd03b('0x2d')},{'name':_0xd03b('0x2e'),'value':_0xd03b('0x2f')}];var _0x38bfd5=_[_0xd03b('0x34')](_0x2f2794,[_0xd03b('0x31'),_0x1c9524[_0xd03b('0x33')]])[_0xd03b('0x3a')];return db[_0xd03b('0x5b')][_0xd03b('0x34')]({'where':{'name':_0x38bfd5,'userProfileId':_0x501bed[_0xd03b('0x5c')]},'raw':!![]})[_0xd03b('0x29')](function(_0x1cbcd0){if(_0x1cbcd0&&_0x1cbcd0[_0xd03b('0x5d')]===0x0){return db[_0xd03b('0x35')][_0xd03b('0x57')]({'name':_0x1c9524[_0xd03b('0x3a')],'resourceId':_0x1c9524['id'],'type':_0x1cbcd0[_0xd03b('0x3a')],'sectionId':_0x1cbcd0['id']},{})[_0xd03b('0x29')](function(){return _0x35b343;});}else{return _0x35b343;}})['catch'](function(_0x14d43a){logger[_0xd03b('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14d43a);throw _0x14d43a;});}return _0x35b343;})[_0xd03b('0x29')](respondWithResult(_0x58d1c0,0xc9))[_0xd03b('0x54')](handleError(_0x58d1c0,null));};exports[_0xd03b('0x5e')]=function(_0x1a968a,_0x56e819){var _0x71db7a={'where':{'id':_0x1a968a[_0xd03b('0x56')]['id']}},_0x5c6415={};_0x5c6415[_0xd03b('0x41')]=_[_0xd03b('0x43')](db[_0xd03b('0x3e')][_0xd03b('0x3f')]);_0x71db7a['attributes']=_['intersection'](_0x5c6415[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0x1a968a['query']['fields']));_0x71db7a[_0xd03b('0x46')]=_0x71db7a[_0xd03b('0x46')]['length']?_0x71db7a[_0xd03b('0x46')]:_0x5c6415['model'];if(_0x1a968a['query'][_0xd03b('0x50')]){_0x71db7a[_0xd03b('0x51')]=[{'all':!![]}];}_0x71db7a=_[_0xd03b('0x4e')]({},_0x71db7a,_0x1a968a[_0xd03b('0x4f')]);return db['VoiceQueue'][_0xd03b('0x34')](_0x71db7a)[_0xd03b('0x29')](handleEntityNotFound(_0x56e819,null))[_0xd03b('0x29')](function(_0x1670c2){if(_0x1670c2){var _0xa1e772=_0x1670c2['get']({'plain':!![]});_0xa1e772=qs[_0xd03b('0x5f')](_0xa1e772,['id',_0xd03b('0x60'),_0xd03b('0x61')]);_0x1a968a[_0xd03b('0x58')]=_[_0xd03b('0x5f')](_0x1a968a[_0xd03b('0x58')],['id','createdAt',_0xd03b('0x61')]);return db[_0xd03b('0x3e')][_0xd03b('0x57')](_[_0xd03b('0x4e')](_0xa1e772,_0x1a968a[_0xd03b('0x58')]),{'include':_0x1a968a[_0xd03b('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0xd03b('0x29')](function(_0x188fc2){var _0x243890=_0x1a968a['user'][_0xd03b('0x2b')]({'plain':!![]});if(!_0x243890)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x243890[_0xd03b('0x62')]===_0xd03b('0x5a')){var _0x2aba74=_0x188fc2[_0xd03b('0x2b')]({'plain':!![]});var _0x4307d7=[{'name':_0xd03b('0x2c'),'value':'inbound'},{'name':_0xd03b('0x2e'),'value':_0xd03b('0x2f')}];var _0x494b11=_[_0xd03b('0x34')](_0x4307d7,['value',_0x2aba74[_0xd03b('0x33')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x494b11,'userProfileId':_0x243890[_0xd03b('0x5c')]},'raw':!![]})[_0xd03b('0x29')](function(_0x30bd52){if(_0x30bd52&&_0x30bd52[_0xd03b('0x5d')]===0x0){return db[_0xd03b('0x35')]['create']({'name':_0x2aba74[_0xd03b('0x3a')],'resourceId':_0x2aba74['id'],'type':_0x30bd52['name'],'sectionId':_0x30bd52['id']},{})['then'](function(){return _0x188fc2;});}else{return _0x188fc2;}})[_0xd03b('0x54')](function(_0x8ffd90){logger[_0xd03b('0x38')](_0xd03b('0x63'),_0x8ffd90);throw _0x8ffd90;});}return _0x188fc2;});}})[_0xd03b('0x29')](respondWithResult(_0x56e819,0xc9))[_0xd03b('0x54')](handleError(_0x56e819,null));};exports[_0xd03b('0x28')]=function(_0x5516ff,_0x5bb195){if(_0x5516ff[_0xd03b('0x58')]['id']){delete _0x5516ff['body']['id'];}return db[_0xd03b('0x3e')]['find']({'where':{'id':_0x5516ff['params']['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x5bb195,null))[_0xd03b('0x29')](saveUpdates(_0x5516ff[_0xd03b('0x58')],null))['then'](respondWithResult(_0x5bb195,null))[_0xd03b('0x54')](handleError(_0x5bb195,null));};exports[_0xd03b('0x2a')]=function(_0x14d54c,_0x36be6f){return db[_0xd03b('0x3e')][_0xd03b('0x34')]({'where':{'id':_0x14d54c[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x36be6f,null))['then'](removeEntity(_0x36be6f,null))['catch'](handleError(_0x36be6f,null));};exports['getHoppers']=function(_0x4e56cf,_0x5e7123,_0x21e5eb){var _0x1c484f={'raw':![],'where':{}};var _0x26d9a5={};var _0x30074f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd03b('0x64')]({'where':{'id':_0x4e56cf['params']['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x5e7123,null))[_0xd03b('0x29')](function(_0x5e1faa){if(_0x5e1faa){_0x26d9a5[_0xd03b('0x41')]=_[_0xd03b('0x43')](db[_0xd03b('0x65')]['rawAttributes']);_0x26d9a5[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0x4e56cf[_0xd03b('0x42')]);_0x26d9a5[_0xd03b('0x44')]=_['intersection'](_0x26d9a5[_0xd03b('0x41')],_0x26d9a5[_0xd03b('0x42')]);_0x1c484f['attributes']=_[_0xd03b('0x45')](_0x26d9a5[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0x4e56cf[_0xd03b('0x42')][_0xd03b('0x47')]));_0x1c484f[_0xd03b('0x46')]=_0x1c484f['attributes'][_0xd03b('0x48')]?_0x1c484f['attributes']:_0x26d9a5['model'];if(!_0x4e56cf[_0xd03b('0x42')][_0xd03b('0x49')](_0xd03b('0x66'))){_0x1c484f[_0xd03b('0x23')]=qs[_0xd03b('0x23')](_0x4e56cf[_0xd03b('0x42')]['limit']);_0x1c484f[_0xd03b('0x20')]=qs[_0xd03b('0x20')](_0x4e56cf['query']['offset']);}_0x1c484f['order']=qs[_0xd03b('0x4a')](_0x4e56cf['query']['sort']);_0x1c484f[_0xd03b('0x4b')]=qs[_0xd03b('0x44')](_['pick'](_0x4e56cf['query'],_0x26d9a5[_0xd03b('0x44')]));_0x1c484f[_0xd03b('0x4b')][_0xd03b('0x67')]=_0x5e1faa['id'];if(_0x4e56cf['query']['filter']){_0x1c484f[_0xd03b('0x4b')]=_['merge'](_0x1c484f[_0xd03b('0x4b')],{'$or':_[_0xd03b('0x3d')](_0x1c484f[_0xd03b('0x46')],function(_0x16e130){var _0x4af56b={};_0x4af56b[_0x16e130]={'$like':'%'+_0x4e56cf[_0xd03b('0x42')][_0xd03b('0x4d')]+'%'};return _0x4af56b;})});}_0x1c484f=_[_0xd03b('0x4e')]({},_0x1c484f,_0x4e56cf[_0xd03b('0x4f')]);return db[_0xd03b('0x65')][_0xd03b('0x22')]({'where':_0x1c484f['where']})[_0xd03b('0x29')](function(_0x2d03e9){_0x30074f[_0xd03b('0x22')]=_0x2d03e9;if(_0x4e56cf['query'][_0xd03b('0x50')]){_0x1c484f['include']=[{'all':!![]}];}return db[_0xd03b('0x65')][_0xd03b('0x52')](_0x1c484f);})['then'](function(_0x726184){_0x30074f[_0xd03b('0x53')]=_0x726184;return _0x30074f;});}})[_0xd03b('0x29')](respondWithFilteredResult(_0x5e7123,_0x1c484f))[_0xd03b('0x54')](handleError(_0x5e7123,null));};exports[_0xd03b('0x68')]=function(_0x1824f1,_0x292b05,_0xd0efd7){var _0x4b75f4={'raw':!![],'where':{}};var _0x6a7bc6={};var _0x4dd7bb={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd03b('0x64')]({'where':{'id':_0x1824f1[_0xd03b('0x56')]['id']}})['then'](handleEntityNotFound(_0x292b05,null))['then'](function(_0x605169){if(_0x605169){_0x6a7bc6[_0xd03b('0x41')]=_[_0xd03b('0x43')](db['CmHopperHistory'][_0xd03b('0x3f')]);_0x6a7bc6[_0xd03b('0x42')]=_['keys'](_0x1824f1[_0xd03b('0x42')]);_0x6a7bc6['filters']=_[_0xd03b('0x45')](_0x6a7bc6[_0xd03b('0x41')],_0x6a7bc6[_0xd03b('0x42')]);_0x4b75f4['attributes']=_[_0xd03b('0x45')](_0x6a7bc6[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0x1824f1[_0xd03b('0x42')][_0xd03b('0x47')]));_0x4b75f4[_0xd03b('0x46')]=_0x4b75f4[_0xd03b('0x46')][_0xd03b('0x48')]?_0x4b75f4[_0xd03b('0x46')]:_0x6a7bc6[_0xd03b('0x41')];if(!_0x1824f1[_0xd03b('0x42')][_0xd03b('0x49')](_0xd03b('0x66'))){_0x4b75f4['limit']=qs[_0xd03b('0x23')](_0x1824f1[_0xd03b('0x42')][_0xd03b('0x23')]);_0x4b75f4[_0xd03b('0x20')]=qs[_0xd03b('0x20')](_0x1824f1[_0xd03b('0x42')][_0xd03b('0x20')]);}_0x4b75f4['order']=qs[_0xd03b('0x4a')](_0x1824f1['query'][_0xd03b('0x4a')]);_0x4b75f4[_0xd03b('0x4b')]=qs[_0xd03b('0x44')](_['pick'](_0x1824f1['query'],_0x6a7bc6[_0xd03b('0x44')]));_0x4b75f4['where']['VoiceQueueId']=_0x605169['id'];if(_0x1824f1[_0xd03b('0x42')][_0xd03b('0x4d')]){_0x4b75f4[_0xd03b('0x4b')]=_[_0xd03b('0x4e')](_0x4b75f4['where'],{'$or':_[_0xd03b('0x3d')](_0x4b75f4[_0xd03b('0x46')],function(_0x5db4ba){var _0x1ee693={};_0x1ee693[_0x5db4ba]={'$like':'%'+_0x1824f1[_0xd03b('0x42')][_0xd03b('0x4d')]+'%'};return _0x1ee693;})});}_0x4b75f4=_[_0xd03b('0x4e')]({},_0x4b75f4,_0x1824f1[_0xd03b('0x4f')]);return db[_0xd03b('0x69')]['count']({'where':_0x4b75f4[_0xd03b('0x4b')]})[_0xd03b('0x29')](function(_0x888d0e){_0x4dd7bb[_0xd03b('0x22')]=_0x888d0e;if(_0x1824f1[_0xd03b('0x42')][_0xd03b('0x50')]){_0x4b75f4['include']=[{'all':!![]}];}return db[_0xd03b('0x69')][_0xd03b('0x52')](_0x4b75f4);})[_0xd03b('0x29')](function(_0xfb0ecb){_0x4dd7bb[_0xd03b('0x53')]=_0xfb0ecb;return _0x4dd7bb;});}})[_0xd03b('0x29')](respondWithFilteredResult(_0x292b05,_0x4b75f4))[_0xd03b('0x54')](handleError(_0x292b05,null));};exports[_0xd03b('0x6a')]=function(_0x256f70,_0x407241,_0x2fa39b){var _0x4134ca={'raw':!![],'where':{}};var _0x332cdd={};var _0x4a9504={'count':0x0,'rows':[]};return db[_0xd03b('0x3e')][_0xd03b('0x64')]({'where':{'id':_0x256f70[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x407241,null))[_0xd03b('0x29')](function(_0xd05f05){if(_0xd05f05){_0x332cdd['model']=_[_0xd03b('0x43')](db['CmHopperFinal']['rawAttributes']);_0x332cdd[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0x256f70[_0xd03b('0x42')]);_0x332cdd[_0xd03b('0x44')]=_[_0xd03b('0x45')](_0x332cdd[_0xd03b('0x41')],_0x332cdd['query']);_0x4134ca[_0xd03b('0x46')]=_[_0xd03b('0x45')](_0x332cdd[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0x256f70['query']['fields']));_0x4134ca[_0xd03b('0x46')]=_0x4134ca[_0xd03b('0x46')]['length']?_0x4134ca[_0xd03b('0x46')]:_0x332cdd['model'];if(!_0x256f70[_0xd03b('0x42')][_0xd03b('0x49')](_0xd03b('0x66'))){_0x4134ca[_0xd03b('0x23')]=qs[_0xd03b('0x23')](_0x256f70[_0xd03b('0x42')][_0xd03b('0x23')]);_0x4134ca[_0xd03b('0x20')]=qs[_0xd03b('0x20')](_0x256f70[_0xd03b('0x42')]['offset']);}_0x4134ca['order']=qs['sort'](_0x256f70['query'][_0xd03b('0x4a')]);_0x4134ca[_0xd03b('0x4b')]=qs[_0xd03b('0x44')](_['pick'](_0x256f70['query'],_0x332cdd[_0xd03b('0x44')]));_0x4134ca[_0xd03b('0x4b')]['VoiceQueueId']=_0xd05f05['id'];if(_0x256f70[_0xd03b('0x42')][_0xd03b('0x4d')]){_0x4134ca[_0xd03b('0x4b')]=_[_0xd03b('0x4e')](_0x4134ca[_0xd03b('0x4b')],{'$or':_[_0xd03b('0x3d')](_0x4134ca[_0xd03b('0x46')],function(_0x8fee7e){var _0x393e88={};_0x393e88[_0x8fee7e]={'$like':'%'+_0x256f70[_0xd03b('0x42')][_0xd03b('0x4d')]+'%'};return _0x393e88;})});}_0x4134ca=_[_0xd03b('0x4e')]({},_0x4134ca,_0x256f70[_0xd03b('0x4f')]);return db[_0xd03b('0x6b')][_0xd03b('0x22')]({'where':_0x4134ca[_0xd03b('0x4b')]})[_0xd03b('0x29')](function(_0x258a3d){_0x4a9504[_0xd03b('0x22')]=_0x258a3d;if(_0x256f70[_0xd03b('0x42')][_0xd03b('0x50')]){_0x4134ca[_0xd03b('0x51')]=[{'all':!![]}];}return db[_0xd03b('0x6b')][_0xd03b('0x52')](_0x4134ca);})[_0xd03b('0x29')](function(_0x4e97ae){_0x4a9504[_0xd03b('0x53')]=_0x4e97ae;return _0x4a9504;});}})[_0xd03b('0x29')](respondWithFilteredResult(_0x407241,_0x4134ca))[_0xd03b('0x54')](handleError(_0x407241,null));};exports['getHopperBlacks']=function(_0x2f1f0b,_0x12e2f8,_0x342b19){var _0xe82764={'raw':!![],'where':{}};var _0x42a13e={};var _0x35391e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2f1f0b[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x12e2f8,null))[_0xd03b('0x29')](function(_0x595e54){if(_0x595e54){_0x42a13e['model']=_['keys'](db['CmHopperBlack'][_0xd03b('0x3f')]);_0x42a13e[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0x2f1f0b[_0xd03b('0x42')]);_0x42a13e[_0xd03b('0x44')]=_['intersection'](_0x42a13e[_0xd03b('0x41')],_0x42a13e[_0xd03b('0x42')]);_0xe82764['attributes']=_['intersection'](_0x42a13e[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0x2f1f0b[_0xd03b('0x42')][_0xd03b('0x47')]));_0xe82764[_0xd03b('0x46')]=_0xe82764[_0xd03b('0x46')][_0xd03b('0x48')]?_0xe82764[_0xd03b('0x46')]:_0x42a13e['model'];if(!_0x2f1f0b[_0xd03b('0x42')]['hasOwnProperty'](_0xd03b('0x66'))){_0xe82764['limit']=qs[_0xd03b('0x23')](_0x2f1f0b['query'][_0xd03b('0x23')]);_0xe82764[_0xd03b('0x20')]=qs[_0xd03b('0x20')](_0x2f1f0b['query']['offset']);}_0xe82764[_0xd03b('0x6c')]=qs[_0xd03b('0x4a')](_0x2f1f0b[_0xd03b('0x42')][_0xd03b('0x4a')]);_0xe82764[_0xd03b('0x4b')]=qs['filters'](_[_0xd03b('0x4c')](_0x2f1f0b[_0xd03b('0x42')],_0x42a13e[_0xd03b('0x44')]));_0xe82764[_0xd03b('0x4b')]['VoiceQueueId']=_0x595e54['id'];if(_0x2f1f0b[_0xd03b('0x42')][_0xd03b('0x4d')]){_0xe82764[_0xd03b('0x4b')]=_[_0xd03b('0x4e')](_0xe82764['where'],{'$or':_[_0xd03b('0x3d')](_0xe82764[_0xd03b('0x46')],function(_0x37704d){var _0x485054={};_0x485054[_0x37704d]={'$like':'%'+_0x2f1f0b['query'][_0xd03b('0x4d')]+'%'};return _0x485054;})});}_0xe82764=_[_0xd03b('0x4e')]({},_0xe82764,_0x2f1f0b[_0xd03b('0x4f')]);return db[_0xd03b('0x6d')]['count']({'where':_0xe82764[_0xd03b('0x4b')]})[_0xd03b('0x29')](function(_0x28c9ec){_0x35391e[_0xd03b('0x22')]=_0x28c9ec;if(_0x2f1f0b[_0xd03b('0x42')][_0xd03b('0x50')]){_0xe82764[_0xd03b('0x51')]=[{'all':!![]}];}return db[_0xd03b('0x6d')]['findAll'](_0xe82764);})[_0xd03b('0x29')](function(_0x12dc59){_0x35391e[_0xd03b('0x53')]=_0x12dc59;return _0x35391e;});}})[_0xd03b('0x29')](respondWithFilteredResult(_0x12e2f8,_0xe82764))[_0xd03b('0x54')](handleError(_0x12e2f8,null));};exports[_0xd03b('0x6e')]=function(_0x1ec492,_0x298085,_0x536c92){var _0x31d8cd={};var _0x194488={};var _0x2b1a3c;var _0x4fe5bf;return db['VoiceQueue']['findOne']({'where':{'id':_0x1ec492['params']['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x298085,null))['then'](function(_0x496b90){if(_0x496b90){_0x2b1a3c=_0x496b90;_0x194488[_0xd03b('0x41')]=_[_0xd03b('0x43')](db[_0xd03b('0x6f')][_0xd03b('0x3f')]);_0x194488[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0x1ec492[_0xd03b('0x42')]);_0x194488[_0xd03b('0x44')]=_[_0xd03b('0x45')](_0x194488['model'],_0x194488['query']);_0x31d8cd[_0xd03b('0x46')]=_[_0xd03b('0x45')](_0x194488[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0x1ec492[_0xd03b('0x42')][_0xd03b('0x47')]));_0x31d8cd[_0xd03b('0x46')]=_0x31d8cd['attributes'][_0xd03b('0x48')]?_0x31d8cd[_0xd03b('0x46')]:_0x194488[_0xd03b('0x41')];_0x31d8cd[_0xd03b('0x6c')]=qs[_0xd03b('0x4a')](_0x1ec492[_0xd03b('0x42')]['sort']);_0x31d8cd[_0xd03b('0x4b')]=qs[_0xd03b('0x44')](_[_0xd03b('0x4c')](_0x1ec492[_0xd03b('0x42')],_0x194488['filters']));if(_0x1ec492[_0xd03b('0x42')][_0xd03b('0x4d')]){_0x31d8cd['where']=_[_0xd03b('0x4e')](_0x31d8cd[_0xd03b('0x4b')],{'$or':_[_0xd03b('0x3d')](_0x31d8cd[_0xd03b('0x46')],function(_0x50bb49){var _0x73b52a={};_0x73b52a[_0x50bb49]={'$like':'%'+_0x1ec492['query'][_0xd03b('0x4d')]+'%'};return _0x73b52a;})});}_0x31d8cd=_[_0xd03b('0x4e')]({},_0x31d8cd,_0x1ec492[_0xd03b('0x4f')]);return _0x2b1a3c['getTeams'](_0x31d8cd);}})[_0xd03b('0x29')](function(_0x26c6cf){if(_0x26c6cf){_0x4fe5bf=_0x26c6cf['length'];if(!_0x1ec492[_0xd03b('0x42')][_0xd03b('0x49')](_0xd03b('0x66'))){_0x31d8cd['limit']=qs[_0xd03b('0x23')](_0x1ec492['query'][_0xd03b('0x23')]);_0x31d8cd['offset']=qs['offset'](_0x1ec492[_0xd03b('0x42')][_0xd03b('0x20')]);}return _0x2b1a3c[_0xd03b('0x6e')](_0x31d8cd);}})['then'](function(_0x460965){if(_0x460965){return _0x460965?{'count':_0x4fe5bf,'rows':_0x460965}:null;}})[_0xd03b('0x29')](respondWithResult(_0x298085,null))[_0xd03b('0x54')](handleError(_0x298085,null));};exports['addTeams']=function(_0x2645d4,_0x52eda0,_0x6a146){var _0x2082b3=_0x2645d4['body']['teams'];var _0x4fc6f2=_[_0xd03b('0x3d')](_0x2082b3,'id');return db[_0xd03b('0x6f')][_0xd03b('0x52')]({'where':{'id':_0x4fc6f2},'attributes':['id'],'include':[{'model':db[_0xd03b('0x70')],'as':_0xd03b('0x71'),'attributes':['id',_0xd03b('0x3a'),'online','voicePause',_0xd03b('0x72')],'raw':!![]}]})[_0xd03b('0x29')](function(_0x3b656e){if(_0x3b656e){var _0x116042=_[_0xd03b('0x73')](_0x3b656e,function(_0x69df68){var _0x46d8ea=_0x69df68['get']({'plain':!![]});_0x46d8ea[_0xd03b('0x71')][_0xd03b('0x74')](function(_0x2df0f7){_0x2df0f7[_0xd03b('0x75')]=_[_0xd03b('0x34')](_0x2082b3,{'id':_0x46d8ea['id']})['penalty'];});return _0x46d8ea[_0xd03b('0x71')];});return db[_0xd03b('0x3e')]['find']({'where':{'id':_0x2645d4[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](function(_0x363a5a){return db[_0xd03b('0x76')][_0xd03b('0x77')](function(_0x421d1c){return _0x363a5a[_0xd03b('0x78')](_0x4fc6f2,{'transaction':_0x421d1c})[_0xd03b('0x29')](function(){return BPromise[_0xd03b('0x79')](_0x2082b3,function(_0x165514){return db[_0xd03b('0x7a')][_0xd03b('0x7b')]({'TeamId':_0x165514['id'],'VoiceQueueId':_0x2645d4['params']['id'],'penalty':_0x165514[_0xd03b('0x75')]},{'transaction':_0x421d1c});});})[_0xd03b('0x29')](function(){return BPromise[_0xd03b('0x79')](_0x116042,function(_0x2e7a4d){return db[_0xd03b('0x7c')][_0xd03b('0x7d')]({'where':{'UserId':_0x2e7a4d['id'],'VoiceQueueId':_0x2645d4[_0xd03b('0x56')]['id']},'defaults':{'penalty':_0x2e7a4d[_0xd03b('0x75')]},'transaction':_0x421d1c});});})[_0xd03b('0x29')](function(){return BPromise[_0xd03b('0x79')](_[_0xd03b('0x4d')](_0x116042,{'online':!![]}),function(_0x5c76c6){return db[_0xd03b('0x7e')][_0xd03b('0x7b')]({'membername':_0x5c76c6[_0xd03b('0x3a')],'UserId':_0x5c76c6['id'],'queue_name':_0x363a5a['name'],'VoiceQueueId':_0x363a5a['id'],'interface':_[_0xd03b('0x7f')](_0x5c76c6[_0xd03b('0x72')])?util[_0xd03b('0x80')](_0xd03b('0x81'),_0x5c76c6[_0xd03b('0x3a')]):_0x5c76c6[_0xd03b('0x72')],'paused':_0x5c76c6[_0xd03b('0x82')]||![],'penalty':_0x5c76c6['penalty']},{'transaction':_0x421d1c});});})[_0xd03b('0x29')](function(){_0x116042[_0xd03b('0x74')](function(_0x15a73c){socket[_0xd03b('0x83')](_0xd03b('0x84'),{'UserId':_0x15a73c['id'],'VoiceQueueId':_0x363a5a['id']});});});});});}})[_0xd03b('0x29')](respondWithStatusCode(_0x52eda0,null))[_0xd03b('0x54')](handleError(_0x52eda0,null));};exports[_0xd03b('0x85')]=function(_0x39c22e,_0x590194,_0x2be144){return db[_0xd03b('0x6f')]['findAll']({'where':{'id':_0x39c22e[_0xd03b('0x42')][_0xd03b('0x86')]},'attributes':['id'],'include':[{'model':db[_0xd03b('0x70')],'as':_0xd03b('0x71'),'attributes':['id'],'raw':!![]}]})[_0xd03b('0x29')](handleEntityNotFound(_0x590194,null))[_0xd03b('0x29')](function(_0x5311a0){var _0x2cbfe7=_[_0xd03b('0x3d')](_0x5311a0,'id');var _0x390b1e=[];var _0x1fd989=[];var _0x579f99=squel[_0xd03b('0x87')]();_0x579f99[_0xd03b('0x88')]('tq.TeamId')[_0xd03b('0x89')]('team_has_voice_queues','tq')[_0xd03b('0x8a')](_0xd03b('0x8b'),'ut',_0xd03b('0x8c'))[_0xd03b('0x4b')](_0xd03b('0x8d'),_0x39c22e[_0xd03b('0x56')]['id']);for(var _0x4ccdbe=0x0;_0x4ccdbe<_0x5311a0[_0xd03b('0x48')];_0x4ccdbe+=0x1){let _0x3c3a3f=_0x5311a0[_0x4ccdbe];for(var _0x18df76=0x0;_0x18df76<_0x3c3a3f[_0xd03b('0x71')][_0xd03b('0x48')];_0x18df76+=0x1){let _0x4262a9=_0x3c3a3f[_0xd03b('0x71')][_0x18df76];var _0xaa1ab7=_0x579f99[_0xd03b('0x5e')]();_0xaa1ab7[_0xd03b('0x4b')](_0xd03b('0x8e'),_0x4262a9['id']);_0x1fd989['push'](db[_0xd03b('0x76')][_0xd03b('0x42')](_0xaa1ab7[_0xd03b('0x8f')](),{'type':db[_0xd03b('0x76')][_0xd03b('0x90')][_0xd03b('0x91')]})[_0xd03b('0x29')](function(_0x168710){if(_0x168710[_0xd03b('0x48')]===0x1){return _0x4262a9['id'];}else{var _0x9b0abf=_['every'](_[_0xd03b('0x3d')](_0x168710,_0xd03b('0x92')),function(_0x4b32af){return _[_0xd03b('0x32')](_0x2cbfe7,_0x4b32af);});if(_0x9b0abf){return _0x4262a9['id'];}}}));}}return BPromise['all'](_0x1fd989)[_0xd03b('0x29')](function(_0x31a62b){_0x390b1e=_(_0x390b1e)[_0xd03b('0x93')](_0x31a62b)['compact']()[_0xd03b('0x31')]();return db[_0xd03b('0x3e')][_0xd03b('0x34')]({'where':{'id':_0x39c22e['params']['id']}})[_0xd03b('0x29')](function(_0x30690e){return db[_0xd03b('0x76')][_0xd03b('0x77')](function(_0x359c78){return _0x30690e[_0xd03b('0x85')](_0x39c22e[_0xd03b('0x42')][_0xd03b('0x86')],{'transaction':_0x359c78})[_0xd03b('0x29')](function(){if(!_[_0xd03b('0x94')](_0x390b1e)){return _0x30690e[_0xd03b('0x95')](_0x390b1e,{'transaction':_0x359c78})['then'](function(){return db[_0xd03b('0x7e')][_0xd03b('0x2a')]({'where':{'VoiceQueueId':_0x39c22e[_0xd03b('0x56')]['id'],'UserId':_0x390b1e},'transaction':_0x359c78});});}})[_0xd03b('0x29')](function(){_0x390b1e['forEach'](function(_0xb3a781){socket['emit']('userVoiceQueue:remove',{'UserId':_0xb3a781,'VoiceQueueId':_0x30690e['id']});});});});});});})[_0xd03b('0x29')](respondWithStatusCode(_0x590194,null))[_0xd03b('0x54')](handleError(_0x590194,null));};exports[_0xd03b('0x96')]=function(_0x522aaf,_0x4b5c2e,_0x211ea1){var _0x4b4e9c,_0x39bc49;return db['VoiceQueue'][_0xd03b('0x34')]({'where':{'id':_0x522aaf['params']['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x4b5c2e,null))[_0xd03b('0x29')](function(_0x1998f1){if(_0x1998f1){_0x39bc49=_0x1998f1;return _0x1998f1['addAgents'](_0x522aaf[_0xd03b('0x58')][_0xd03b('0x86')],_[_0xd03b('0x5f')](_0x522aaf[_0xd03b('0x58')],[_0xd03b('0x86'),'id'])||{})[_0xd03b('0x97')](function(_0x411d39){for(var _0x3c758c=0x0;_0x3c758c<_0x522aaf[_0xd03b('0x58')][_0xd03b('0x86')][_0xd03b('0x48')];_0x3c758c+=0x1){socket[_0xd03b('0x83')](_0xd03b('0x84'),{'UserId':Number(_0x522aaf[_0xd03b('0x58')][_0xd03b('0x86')][_0x3c758c]),'VoiceQueueId':Number(_0x522aaf['params']['id'])});}return _0x411d39;});}})[_0xd03b('0x29')](function(_0x7392a5){_0x4b4e9c=_0x7392a5||[];if(_0x39bc49){return db[_0xd03b('0x70')][_0xd03b('0x52')]({'where':{'id':_0x522aaf['body'][_0xd03b('0x86')]},'attributes':['id','name','online',_0xd03b('0x82'),_0xd03b('0x72')],'raw':!![]});}})['then'](function(_0x3528af){if(!_[_0xd03b('0x94')](_0x3528af)){var _0x280ced=[];for(var _0x55cfe1=0x0;_0x55cfe1<_0x3528af['length'];_0x55cfe1++){if(_0x3528af[_0x55cfe1]['online']){_0x280ced[_0xd03b('0x98')](db[_0xd03b('0x7e')][_0xd03b('0x7b')]({'membername':_0x3528af[_0x55cfe1]['name'],'UserId':_0x3528af[_0x55cfe1]['id'],'queue_name':_0x39bc49[_0xd03b('0x3a')],'VoiceQueueId':_0x39bc49['id'],'interface':_[_0xd03b('0x7f')](_0x3528af[_0x55cfe1][_0xd03b('0x72')])?util[_0xd03b('0x80')](_0xd03b('0x81'),_0x3528af[_0x55cfe1][_0xd03b('0x3a')]):_0x3528af[_0x55cfe1][_0xd03b('0x72')],'paused':_0x3528af[_0x55cfe1][_0xd03b('0x82')]||![],'penalty':_0x522aaf['body']['penalty']||0x0}));}}return BPromise['all'](_0x280ced);}})[_0xd03b('0x29')](function(){return _0x4b4e9c;})[_0xd03b('0x29')](respondWithResult(_0x4b5c2e,null))[_0xd03b('0x54')](handleError(_0x4b5c2e,null));};exports[_0xd03b('0x95')]=function(_0x279730,_0x4a13dd,_0x2c8677){return db['VoiceQueue'][_0xd03b('0x34')]({'where':{'id':_0x279730[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x4a13dd,null))[_0xd03b('0x29')](function(_0x3a3744){if(_0x3a3744){return _0x3a3744[_0xd03b('0x95')](_0x279730['query'][_0xd03b('0x86')])[_0xd03b('0x29')](function(){if(_[_0xd03b('0x99')](_0x279730[_0xd03b('0x42')][_0xd03b('0x86')])){for(var _0x5e180d=0x0;_0x5e180d<_0x279730['query'][_0xd03b('0x86')][_0xd03b('0x48')];_0x5e180d+=0x1){socket[_0xd03b('0x83')]('userVoiceQueue:remove',{'UserId':Number(_0x279730['query']['ids'][_0x5e180d]),'VoiceQueueId':Number(_0x279730[_0xd03b('0x56')]['id'])});}}else{socket[_0xd03b('0x83')](_0xd03b('0x9a'),{'UserId':Number(_0x279730[_0xd03b('0x42')][_0xd03b('0x86')]),'VoiceQueueId':Number(_0x279730[_0xd03b('0x56')]['id'])});}});}})[_0xd03b('0x29')](function(_0x4daa6f){return db[_0xd03b('0x7e')][_0xd03b('0x2a')]({'where':{'VoiceQueueId':_0x279730[_0xd03b('0x56')]['id'],'UserId':_0x279730['query'][_0xd03b('0x86')]}})['then'](function(){return _0x4daa6f;});})[_0xd03b('0x29')](respondWithStatusCode(_0x4a13dd,null))[_0xd03b('0x54')](handleError(_0x4a13dd,null));};exports[_0xd03b('0x9b')]=function(_0xaae92f,_0x157328,_0x703498){var _0x44e4b5={};var _0x57ecf3={};var _0x24a5e0;var _0x45ee8a;return db[_0xd03b('0x3e')][_0xd03b('0x64')]({'where':{'id':_0xaae92f[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x157328,null))['then'](function(_0x429226){if(_0x429226){_0x24a5e0=_0x429226;_0x57ecf3['model']=_[_0xd03b('0x43')](db[_0xd03b('0x70')][_0xd03b('0x3f')]);_0x57ecf3[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0xaae92f[_0xd03b('0x42')]);_0x57ecf3['filters']=_[_0xd03b('0x45')](_0x57ecf3[_0xd03b('0x41')],_0x57ecf3[_0xd03b('0x42')]);_0x44e4b5['attributes']=_[_0xd03b('0x45')](_0x57ecf3[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0xaae92f[_0xd03b('0x42')]['fields']));_0x44e4b5[_0xd03b('0x46')]=_0x44e4b5[_0xd03b('0x46')][_0xd03b('0x48')]?_0x44e4b5[_0xd03b('0x46')]:_0x57ecf3[_0xd03b('0x41')];_0x44e4b5['order']=qs[_0xd03b('0x4a')](_0xaae92f['query'][_0xd03b('0x4a')]);_0x44e4b5['where']=qs[_0xd03b('0x44')](_[_0xd03b('0x4c')](_0xaae92f[_0xd03b('0x42')],_0x57ecf3[_0xd03b('0x44')]));if(_0xaae92f[_0xd03b('0x42')][_0xd03b('0x4d')]){_0x44e4b5[_0xd03b('0x4b')]=_[_0xd03b('0x4e')](_0x44e4b5['where'],{'$or':_[_0xd03b('0x3d')](_0x44e4b5['attributes'],function(_0x186e76){var _0x567675={};_0x567675[_0x186e76]={'$like':'%'+_0xaae92f['query'][_0xd03b('0x4d')]+'%'};return _0x567675;})});}_0x44e4b5=_[_0xd03b('0x4e')]({},_0x44e4b5,_0xaae92f['options']);return _0x24a5e0[_0xd03b('0x9b')](_0x44e4b5);}})['then'](function(_0x32d9e6){if(_0x32d9e6){_0x45ee8a=_0x32d9e6[_0xd03b('0x48')];if(!_0xaae92f[_0xd03b('0x42')][_0xd03b('0x49')]('nolimit')){_0x44e4b5[_0xd03b('0x23')]=qs['limit'](_0xaae92f[_0xd03b('0x42')]['limit']);_0x44e4b5[_0xd03b('0x20')]=qs[_0xd03b('0x20')](_0xaae92f['query'][_0xd03b('0x20')]);}return _0x24a5e0[_0xd03b('0x9b')](_0x44e4b5);}})['then'](function(_0x31844d){if(_0x31844d){return _0x31844d?{'count':_0x45ee8a,'rows':_0x31844d}:null;}})['then'](respondWithResult(_0x157328,null))[_0xd03b('0x54')](handleError(_0x157328,null));};exports[_0xd03b('0x9c')]=function(_0x5f080a,_0x504469,_0x515e4b){var _0x5ed8b1={};var _0x4d6a17={};var _0x299f57;var _0xa57e8f;return db[_0xd03b('0x3e')][_0xd03b('0x64')]({'where':{'id':_0x5f080a['params']['id']}})['then'](handleEntityNotFound(_0x504469,null))['then'](function(_0x420e92){if(_0x420e92){_0x299f57=_0x420e92;_0x4d6a17['model']=_[_0xd03b('0x43')](db[_0xd03b('0x7e')][_0xd03b('0x3f')]);_0x4d6a17[_0xd03b('0x42')]=_['keys'](_0x5f080a[_0xd03b('0x42')]);_0x4d6a17[_0xd03b('0x44')]=_[_0xd03b('0x45')](_0x4d6a17[_0xd03b('0x41')],_0x4d6a17['query']);_0x5ed8b1[_0xd03b('0x46')]=_[_0xd03b('0x45')](_0x4d6a17['model'],qs[_0xd03b('0x47')](_0x5f080a[_0xd03b('0x42')][_0xd03b('0x47')]));_0x5ed8b1[_0xd03b('0x46')]=_0x5ed8b1[_0xd03b('0x46')][_0xd03b('0x48')]?_0x5ed8b1[_0xd03b('0x46')]:_0x4d6a17[_0xd03b('0x41')];_0x5ed8b1[_0xd03b('0x6c')]=qs[_0xd03b('0x4a')](_0x5f080a[_0xd03b('0x42')]['sort']);_0x5ed8b1[_0xd03b('0x4b')]=qs[_0xd03b('0x44')](_[_0xd03b('0x4c')](_0x5f080a['query'],_0x4d6a17[_0xd03b('0x44')]));if(_0x5f080a['query'][_0xd03b('0x4d')]){_0x5ed8b1[_0xd03b('0x4b')]=_[_0xd03b('0x4e')](_0x5ed8b1[_0xd03b('0x4b')],{'$or':_['map'](_0x5ed8b1[_0xd03b('0x46')],function(_0xe9a701){var _0x563a70={};_0x563a70[_0xe9a701]={'$like':'%'+_0x5f080a['query'][_0xd03b('0x4d')]+'%'};return _0x563a70;})});}_0x5ed8b1=_[_0xd03b('0x4e')]({},_0x5ed8b1,_0x5f080a['options']);return _0x299f57['getMembers'](_0x5ed8b1);}})[_0xd03b('0x29')](function(_0x3d6e5b){if(_0x3d6e5b){_0xa57e8f=_0x3d6e5b['length'];if(!_0x5f080a[_0xd03b('0x42')][_0xd03b('0x49')]('nolimit')){_0x5ed8b1[_0xd03b('0x23')]=qs[_0xd03b('0x23')](_0x5f080a['query'][_0xd03b('0x23')]);_0x5ed8b1[_0xd03b('0x20')]=qs[_0xd03b('0x20')](_0x5f080a[_0xd03b('0x42')]['offset']);}return _0x299f57[_0xd03b('0x9c')](_0x5ed8b1);}})[_0xd03b('0x29')](function(_0xa1ed33){return _0xa1ed33?{'count':_0xa57e8f,'rows':_0xa1ed33}:null;})['then'](respondWithResult(_0x504469,null))[_0xd03b('0x54')](handleError(_0x504469,null));};exports[_0xd03b('0x9d')]=function(_0x323286,_0xda712f,_0x22ae0a){var _0x56ab12={};var _0x168bd6={};var _0x394c8f;var _0xa97416;return db[_0xd03b('0x3e')][_0xd03b('0x64')]({'where':{'id':_0x323286[_0xd03b('0x56')]['id']}})['then'](handleEntityNotFound(_0xda712f,null))[_0xd03b('0x29')](function(_0x4e5753){if(_0x4e5753){_0x394c8f=_0x4e5753;_0x168bd6[_0xd03b('0x41')]=_[_0xd03b('0x43')](db['CmList'][_0xd03b('0x3f')]);_0x168bd6[_0xd03b('0x42')]=_['keys'](_0x323286['query']);_0x168bd6[_0xd03b('0x44')]=_[_0xd03b('0x45')](_0x168bd6[_0xd03b('0x41')],_0x168bd6['query']);_0x56ab12[_0xd03b('0x46')]=_[_0xd03b('0x45')](_0x168bd6['model'],qs['fields'](_0x323286[_0xd03b('0x42')][_0xd03b('0x47')]));_0x56ab12['attributes']=_0x56ab12[_0xd03b('0x46')][_0xd03b('0x48')]?_0x56ab12[_0xd03b('0x46')]:_0x168bd6[_0xd03b('0x41')];_0x56ab12[_0xd03b('0x6c')]=qs['sort'](_0x323286['query'][_0xd03b('0x4a')]);_0x56ab12[_0xd03b('0x4b')]=qs['filters'](_[_0xd03b('0x4c')](_0x323286[_0xd03b('0x42')],_0x168bd6[_0xd03b('0x44')]));if(_0x323286[_0xd03b('0x42')][_0xd03b('0x4d')]){_0x56ab12[_0xd03b('0x4b')]=_[_0xd03b('0x4e')](_0x56ab12[_0xd03b('0x4b')],{'$or':_['map'](_0x56ab12[_0xd03b('0x46')],function(_0x941da4){var _0x279131={};_0x279131[_0x941da4]={'$like':'%'+_0x323286['query'][_0xd03b('0x4d')]+'%'};return _0x279131;})});}_0x56ab12=_[_0xd03b('0x4e')]({},_0x56ab12,_0x323286[_0xd03b('0x4f')]);return _0x394c8f['getLists'](_0x56ab12);}})[_0xd03b('0x29')](function(_0x3e7418){if(_0x3e7418){_0xa97416=_0x3e7418[_0xd03b('0x48')];if(!_0x323286['query'][_0xd03b('0x49')]('nolimit')){_0x56ab12[_0xd03b('0x23')]=qs[_0xd03b('0x23')](_0x323286['query'][_0xd03b('0x23')]);_0x56ab12[_0xd03b('0x20')]=qs[_0xd03b('0x20')](_0x323286[_0xd03b('0x42')][_0xd03b('0x20')]);}return _0x394c8f[_0xd03b('0x9d')](_0x56ab12);}})[_0xd03b('0x29')](function(_0x3c592c){if(_0x3c592c){return _0x3c592c?{'count':_0xa97416,'rows':_0x3c592c}:null;}})['then'](respondWithResult(_0xda712f,null))[_0xd03b('0x54')](handleError(_0xda712f,null));};exports['addLists']=function(_0x3afb98,_0x22b212,_0x5592e7){var _0x33d9b6,_0x47b5ad;return db[_0xd03b('0x3e')][_0xd03b('0x34')]({'where':{'id':_0x3afb98[_0xd03b('0x56')]['id']}})['then'](handleEntityNotFound(_0x22b212,null))['then'](function(_0x3d17db){if(_0x3d17db){_0x47b5ad=_0x3d17db;return _0x3d17db[_0xd03b('0x9e')](_0x3afb98[_0xd03b('0x58')][_0xd03b('0x86')],_[_0xd03b('0x5f')](_0x3afb98['body'],[_0xd03b('0x86'),'id'])||{});}return null;})[_0xd03b('0x97')](function(_0x488c3d){var _0x161477;_0x33d9b6=_0x488c3d||[];var _0x1ab7d1=[];if(_0x488c3d){for(var _0x2a5278=0x0;_0x2a5278<_0x488c3d[_0xd03b('0x48')];_0x2a5278+=0x1){var _0x386052=_0x488c3d[_0x2a5278]['get']({'plain':!![]});_0x47b5ad[_0xd03b('0x9f')]=_0x3afb98[_0xd03b('0x58')][_0xd03b('0x9f')]?_0x3afb98['body'][_0xd03b('0x9f')]:_0x47b5ad[_0xd03b('0x9f')];switch(_0x47b5ad[_0xd03b('0x9f')]){case _0xd03b('0xa0'):_0x161477=squel[_0xd03b('0xa1')]()['into']('cm_hopper')[_0xd03b('0xa2')](['phone',_0xd03b('0xa3'),_0xd03b('0xa4'),_0xd03b('0xa5'),_0xd03b('0x67'),'createdAt','updatedAt'],squel[_0xd03b('0x87')]()[_0xd03b('0x88')](_0xd03b('0xa6'),_0xd03b('0xa6'))[_0xd03b('0x88')](_0xd03b('0xa7'),'scheduledAt')[_0xd03b('0x88')]('id',_0xd03b('0xa4'))['field'](_0x386052['CmListId'][_0xd03b('0x8f')](),_0xd03b('0xa5'))[_0xd03b('0x88')](_0x3afb98[_0xd03b('0x56')]['id'][_0xd03b('0x8f')](),_0xd03b('0x67'))[_0xd03b('0x88')](_0xd03b('0xa7'),'createdAt')[_0xd03b('0x88')](_0xd03b('0xa7'),_0xd03b('0x61'))[_0xd03b('0x89')](_0xd03b('0xa8'))[_0xd03b('0x4b')]('deletedAt\x20IS\x20NULL')[_0xd03b('0x4b')](_0xd03b('0xa9'),_0x386052[_0xd03b('0xaa')][_0xd03b('0x8f')]())[_0xd03b('0x4b')](_0xd03b('0xab'))[_0xd03b('0x4b')](_0xd03b('0xac'),squel[_0xd03b('0x87')]()['field'](_0xd03b('0xad'))['from'](_0xd03b('0xae'))['where']('VoiceQueueId\x20=\x20?',_0x3afb98[_0xd03b('0x56')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd03b('0x87')]()['field'](_0xd03b('0xaf'))[_0xd03b('0x89')](_0xd03b('0xb0'))[_0xd03b('0x4b')]('VoiceQueueId\x20=\x20?',_0x3afb98[_0xd03b('0x56')]['id'][_0xd03b('0x8f')]())))['toString']();break;case _0xd03b('0xb1'):_0x161477=squel['insert']()[_0xd03b('0xb2')](_0xd03b('0xb0'))['fromQuery']([_0xd03b('0xa6'),'scheduledAt',_0xd03b('0xa4'),_0xd03b('0xa5'),'VoiceQueueId',_0xd03b('0x60'),_0xd03b('0x61')],squel[_0xd03b('0x87')]()['field'](_0xd03b('0xa6'),_0xd03b('0xa6'))[_0xd03b('0x88')](_0xd03b('0xa7'),'scheduledAt')[_0xd03b('0x88')]('id',_0xd03b('0xa4'))[_0xd03b('0x88')](_0x386052['CmListId'][_0xd03b('0x8f')](),'ListId')['field'](_0x3afb98[_0xd03b('0x56')]['id'][_0xd03b('0x8f')](),'VoiceQueueId')[_0xd03b('0x88')]('NOW()','createdAt')[_0xd03b('0x88')](_0xd03b('0xa7'),_0xd03b('0x61'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xd03b('0x4b')](_0xd03b('0xa9'),_0x386052['CmListId'][_0xd03b('0x8f')]())[_0xd03b('0x4b')](_0xd03b('0xab'))[_0xd03b('0x4b')](_0xd03b('0xac'),squel[_0xd03b('0x87')]()[_0xd03b('0x88')](_0xd03b('0xaf'))['from']('cm_hopper')[_0xd03b('0x4b')](_0xd03b('0x8d'),_0x3afb98[_0xd03b('0x56')]['id'][_0xd03b('0x8f')]())))[_0xd03b('0x8f')]();break;default:_0x161477=squel[_0xd03b('0xa1')]()[_0xd03b('0xb2')]('cm_hopper')['fromQuery']([_0xd03b('0xa6'),'scheduledAt',_0xd03b('0xa4'),_0xd03b('0xa5'),_0xd03b('0x67'),_0xd03b('0x60'),_0xd03b('0x61')],squel['select']()[_0xd03b('0x88')](_0xd03b('0xa6'),_0xd03b('0xa6'))[_0xd03b('0x88')]('NOW()',_0xd03b('0xa3'))['field']('id',_0xd03b('0xa4'))['field'](_0x386052[_0xd03b('0xaa')][_0xd03b('0x8f')](),_0xd03b('0xa5'))[_0xd03b('0x88')](_0x3afb98[_0xd03b('0x56')]['id'][_0xd03b('0x8f')](),_0xd03b('0x67'))[_0xd03b('0x88')](_0xd03b('0xa7'),_0xd03b('0x60'))[_0xd03b('0x88')](_0xd03b('0xa7'),_0xd03b('0x61'))[_0xd03b('0x89')](_0xd03b('0xa8'))[_0xd03b('0x4b')](_0xd03b('0xb3'))[_0xd03b('0x4b')](_0xd03b('0xa9'),_0x386052['CmListId']['toString']())['where'](_0xd03b('0xab')))[_0xd03b('0x8f')]();}_0x1ab7d1[_0xd03b('0x98')](db[_0xd03b('0x76')]['query'](_0x161477));}return BPromise[_0xd03b('0xb4')](_0x1ab7d1);}})[_0xd03b('0x29')](function(){return _0x33d9b6;})[_0xd03b('0x29')](respondWithResult(_0x22b212,null))['catch'](handleError(_0x22b212,null));};exports['removeLists']=function(_0x4d5a78,_0x576442,_0x171192){return db[_0xd03b('0x3e')]['find']({'where':{'id':_0x4d5a78['params']['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x576442,null))[_0xd03b('0x29')](function(_0x5336dc){if(_0x5336dc){return _0x5336dc[_0xd03b('0xb5')](_0x4d5a78[_0xd03b('0x42')]['ids']);}})[_0xd03b('0x29')](function(_0x1ea980){if(_0x1ea980){return db[_0xd03b('0x65')]['destroy']({'where':{'ListId':_0x4d5a78['query'][_0xd03b('0x86')],'VoiceQueueId':_0x4d5a78[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](function(){return _0x1ea980;});}})[_0xd03b('0x29')](respondWithStatusCode(_0x576442,null))['catch'](handleError(_0x576442,null));};exports[_0xd03b('0xb6')]=function(_0xf8fec4,_0x4486e1,_0x15c253){var _0x31e8c5={};var _0x198d71={};var _0x57b031;var _0x3e07bf;return db[_0xd03b('0x3e')][_0xd03b('0x64')]({'where':{'id':_0xf8fec4[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x4486e1,null))['then'](function(_0x5839ba){if(_0x5839ba){_0x57b031=_0x5839ba;_0x198d71[_0xd03b('0x41')]=_[_0xd03b('0x43')](db[_0xd03b('0xb7')][_0xd03b('0x3f')]);_0x198d71[_0xd03b('0x42')]=_[_0xd03b('0x43')](_0xf8fec4['query']);_0x198d71['filters']=_[_0xd03b('0x45')](_0x198d71[_0xd03b('0x41')],_0x198d71[_0xd03b('0x42')]);_0x31e8c5[_0xd03b('0x46')]=_['intersection'](_0x198d71[_0xd03b('0x41')],qs[_0xd03b('0x47')](_0xf8fec4[_0xd03b('0x42')]['fields']));_0x31e8c5[_0xd03b('0x46')]=_0x31e8c5[_0xd03b('0x46')][_0xd03b('0x48')]?_0x31e8c5['attributes']:_0x198d71[_0xd03b('0x41')];_0x31e8c5[_0xd03b('0x6c')]=qs[_0xd03b('0x4a')](_0xf8fec4[_0xd03b('0x42')][_0xd03b('0x4a')]);_0x31e8c5[_0xd03b('0x4b')]=qs[_0xd03b('0x44')](_[_0xd03b('0x4c')](_0xf8fec4['query'],_0x198d71[_0xd03b('0x44')]));if(_0xf8fec4[_0xd03b('0x42')][_0xd03b('0x4d')]){_0x31e8c5[_0xd03b('0x4b')]=_[_0xd03b('0x4e')](_0x31e8c5[_0xd03b('0x4b')],{'$or':_[_0xd03b('0x3d')](_0x31e8c5[_0xd03b('0x46')],function(_0x531284){var _0x4b895b={};_0x4b895b[_0x531284]={'$like':'%'+_0xf8fec4[_0xd03b('0x42')][_0xd03b('0x4d')]+'%'};return _0x4b895b;})});}_0x31e8c5=_['merge']({},_0x31e8c5,_0xf8fec4['options']);return _0x57b031[_0xd03b('0xb6')](_0x31e8c5);}})[_0xd03b('0x29')](function(_0x1db1bf){if(_0x1db1bf){_0x3e07bf=_0x1db1bf[_0xd03b('0x48')];if(!_0xf8fec4['query'][_0xd03b('0x49')]('nolimit')){_0x31e8c5[_0xd03b('0x23')]=qs['limit'](_0xf8fec4[_0xd03b('0x42')][_0xd03b('0x23')]);_0x31e8c5['offset']=qs[_0xd03b('0x20')](_0xf8fec4[_0xd03b('0x42')][_0xd03b('0x20')]);}return _0x57b031[_0xd03b('0xb6')](_0x31e8c5);}})[_0xd03b('0x29')](function(_0xfea2a0){if(_0xfea2a0){return _0xfea2a0?{'count':_0x3e07bf,'rows':_0xfea2a0}:null;}})[_0xd03b('0x29')](respondWithResult(_0x4486e1,null))[_0xd03b('0x54')](handleError(_0x4486e1,null));};exports[_0xd03b('0xb8')]=function(_0x45e16e,_0xa1a0fa,_0x397e5d){var _0x4af798,_0x3599fe;return db[_0xd03b('0x3e')][_0xd03b('0x34')]({'where':{'id':_0x45e16e[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0xa1a0fa,null))[_0xd03b('0x29')](function(_0x563edc){if(_0x563edc){_0x3599fe=_0x563edc;return _0x563edc[_0xd03b('0xb8')](_0x45e16e['body'][_0xd03b('0x86')],_[_0xd03b('0x5f')](_0x45e16e[_0xd03b('0x58')],['ids','id'])||{});}return null;})[_0xd03b('0x97')](function(_0x269c43){var _0x3b493c;_0x4af798=_0x269c43||[];var _0x4b948b=[];if(_0x269c43){for(var _0x3ca8c2=0x0;_0x3ca8c2<_0x269c43[_0xd03b('0x48')];_0x3ca8c2+=0x1){var _0x478e00=_0x269c43[_0x3ca8c2]['get']({'plain':!![]});_0x3b493c=squel[_0xd03b('0xa1')]()['into']('cm_hopper_black')[_0xd03b('0xa2')]([_0xd03b('0xa6'),_0xd03b('0xa4'),_0xd03b('0xa5'),'VoiceQueueId','createdAt',_0xd03b('0x61')],squel['select']()[_0xd03b('0x88')](_0xd03b('0xa6'),'phone')['field']('id',_0xd03b('0xa4'))[_0xd03b('0x88')](_0x478e00['CmListId'][_0xd03b('0x8f')](),_0xd03b('0xa5'))[_0xd03b('0x88')](_0x45e16e[_0xd03b('0x56')]['id'][_0xd03b('0x8f')](),_0xd03b('0x67'))[_0xd03b('0x88')](_0xd03b('0xa7'),_0xd03b('0x60'))[_0xd03b('0x88')](_0xd03b('0xa7'),_0xd03b('0x61'))['from']('cm_contacts')['where'](_0xd03b('0xb3'))[_0xd03b('0x4b')](_0xd03b('0xa9'),_0x478e00[_0xd03b('0xaa')]['toString']())[_0xd03b('0x4b')](_0xd03b('0xab')))[_0xd03b('0x8f')]();_0x4b948b['push'](db[_0xd03b('0x76')][_0xd03b('0x42')](_0x3b493c));}return BPromise[_0xd03b('0xb4')](_0x4b948b);}})['then'](function(){return _0x4af798;})[_0xd03b('0x29')](respondWithResult(_0xa1a0fa,null))['catch'](handleError(_0xa1a0fa,null));};exports['removeBlackLists']=function(_0x17fee4,_0x318b77,_0xafb8ac){return db[_0xd03b('0x3e')][_0xd03b('0x34')]({'where':{'id':_0x17fee4[_0xd03b('0x56')]['id']}})[_0xd03b('0x29')](handleEntityNotFound(_0x318b77,null))[_0xd03b('0x29')](function(_0x253950){if(_0x253950){return _0x253950[_0xd03b('0xb9')](_0x17fee4[_0xd03b('0x42')]['ids']);}})[_0xd03b('0x29')](function(_0x349ab0){if(_0x349ab0){return db[_0xd03b('0x6d')][_0xd03b('0x2a')]({'where':{'ListId':_0x17fee4[_0xd03b('0x42')][_0xd03b('0x86')],'VoiceQueueId':_0x17fee4['params']['id']}})[_0xd03b('0x29')](function(){return _0x349ab0;});}})['then'](respondWithStatusCode(_0x318b77,null))['catch'](handleError(_0x318b77,null));};exports[_0xd03b('0xba')]=function(_0x48902f,_0x3110da){var _0x18a4fb=[{'name':_0xd03b('0xbb'),'method':_0xd03b('0xbc'),'enabled':0x1},{'name':_0xd03b('0xbd'),'method':_0xd03b('0xbe'),'enabled':0x1},{'name':_0xd03b('0xbf'),'method':_0xd03b('0xc0'),'enabled':0x1},{'name':'Preview','method':_0xd03b('0xc1'),'enabled':0x1},{'name':'BookedProgressive','method':_0xd03b('0xc2'),'enabled':0x1}];return new BPromise(function(_0x2c2898,_0x41378e){try{if(!_[_0xd03b('0x7f')](config[_0xd03b('0xc3')])){_0x18a4fb=config[_0xd03b('0xc3')];}_0x2c2898(_0x18a4fb);}catch(_0x433cbe){_0x41378e(_0x433cbe);}})[_0xd03b('0x29')](respondWithResult(_0x3110da))['catch'](handleError(_0x3110da,null));}; \ No newline at end of file +var _0xe618=['phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper','onlyIfOpen','fromQuery','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','getMethods','PowerDialing','power','Predictive','predictive','Preview','preview','booked','dialerMethods','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueue.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','send','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','get','omit','createdAt','updatedAt','userProfileId','update','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','User','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','ids','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','phone','scheduledAt','ContactId','field','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?'];(function(_0x3a7f8b,_0x7fe06c){var _0x34f066=function(_0x38f2a7){while(--_0x38f2a7){_0x3a7f8b['push'](_0x3a7f8b['shift']());}};_0x34f066(++_0x7fe06c);}(_0xe618,0xdb));var _0x8e61=function(_0x510cd9,_0x551300){_0x510cd9=_0x510cd9-0x0;var _0x2b1f61=_0xe618[_0x510cd9];return _0x2b1f61;};'use strict';var emlformat=require(_0x8e61('0x0'));var rimraf=require(_0x8e61('0x1'));var zipdir=require(_0x8e61('0x2'));var jsonpatch=require(_0x8e61('0x3'));var rp=require(_0x8e61('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e61('0x5'));var util=require(_0x8e61('0x6'));var path=require(_0x8e61('0x7'));var sox=require(_0x8e61('0x8'));var csv=require(_0x8e61('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e61('0xa'));var _=require(_0x8e61('0xb'));var squel=require(_0x8e61('0xc'));var crypto=require(_0x8e61('0xd'));var jsforce=require(_0x8e61('0xe'));var deskjs=require(_0x8e61('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8e61('0x10'));var Papa=require(_0x8e61('0x11'));var Redis=require(_0x8e61('0x12'));var authService=require(_0x8e61('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8e61('0x14'));var hardwareService=require(_0x8e61('0x15'));var logger=require('../../config/logger')(_0x8e61('0x16'));var utils=require('../../config/utils');var config=require(_0x8e61('0x17'));var licenseUtil=require(_0x8e61('0x18'));var db=require(_0x8e61('0x19'))['db'];config[_0x8e61('0x1a')]=_['defaults'](config[_0x8e61('0x1a')],{'host':_0x8e61('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e61('0x1a')]));require(_0x8e61('0x1c'))[_0x8e61('0x1d')](socket);function respondWithStatusCode(_0x391810,_0x3e8933){_0x3e8933=_0x3e8933||0xcc;return function(_0x5e4934){if(_0x5e4934){return _0x391810[_0x8e61('0x1e')](_0x3e8933);}return _0x391810[_0x8e61('0x1f')](_0x3e8933)['end']();};}function respondWithResult(_0x381989,_0x254126){_0x254126=_0x254126||0xc8;return function(_0x4ed40c){if(_0x4ed40c){return _0x381989['status'](_0x254126)['json'](_0x4ed40c);}};}function respondWithFilteredResult(_0x524f59,_0x1d9895){return function(_0x473e49){if(_0x473e49){var _0x5cf541=typeof _0x1d9895[_0x8e61('0x20')]===_0x8e61('0x21')&&typeof _0x1d9895[_0x8e61('0x22')]===_0x8e61('0x21');var _0x36f527=_0x473e49[_0x8e61('0x23')];var _0x4894f5=_0x5cf541?0x0:_0x1d9895[_0x8e61('0x20')];var _0x3e1530=_0x5cf541?_0x473e49['count']:_0x1d9895[_0x8e61('0x20')]+_0x1d9895['limit'];var _0x40e4f2;if(_0x3e1530>=_0x36f527){_0x3e1530=_0x36f527;_0x40e4f2=0xc8;}else{_0x40e4f2=0xce;}_0x524f59[_0x8e61('0x1f')](_0x40e4f2);return _0x524f59['set'](_0x8e61('0x24'),_0x4894f5+'-'+_0x3e1530+'/'+_0x36f527)['json'](_0x473e49);}return null;};}function patchUpdates(_0x134099){return function(_0x4db3cb){try{jsonpatch[_0x8e61('0x25')](_0x4db3cb,_0x134099,!![]);}catch(_0x130956){return BPromise[_0x8e61('0x26')](_0x130956);}return _0x4db3cb[_0x8e61('0x27')]();};}function saveUpdates(_0x22703a,_0x14df35){return function(_0x2127e2){if(_0x2127e2){return _0x2127e2['update'](_0x22703a)[_0x8e61('0x28')](function(_0x549b9b){return _0x549b9b;});}return null;};}function removeEntity(_0x446a26,_0xf8f58a){return function(_0x789d28){if(_0x789d28){return _0x789d28[_0x8e61('0x29')]()['then'](function(){var _0x1f50f1=_0x789d28['get']({'plain':!![]});var _0x5b4377=[{'name':_0x8e61('0x2a'),'value':_0x8e61('0x2b'),'ignore':![]},{'name':_0x8e61('0x2c'),'value':'outbound','ignore':![]}];var _0x3a45e2=_(_0x5b4377)[_0x8e61('0x2d')](_0x8e61('0x2e'))[_0x8e61('0x2f')](_0x8e61('0x30'))[_0x8e61('0x30')]();if(_[_0x8e61('0x31')](_0x3a45e2,_0x1f50f1[_0x8e61('0x32')])){return;}var _0x331570=_[_0x8e61('0x33')](_0x5b4377,[_0x8e61('0x30'),_0x1f50f1['type']])[_0x8e61('0x34')];return db[_0x8e61('0x35')]['destroy']({'where':{'type':_0x331570,'resourceId':_0x1f50f1['id']}})[_0x8e61('0x28')](function(){return _0x789d28;});})[_0x8e61('0x28')](function(){_0x446a26[_0x8e61('0x1f')](0xcc)[_0x8e61('0x36')]();});}};}function handleEntityNotFound(_0x11f90b,_0x26bb51){return function(_0x5e8ec0){if(!_0x5e8ec0){_0x11f90b[_0x8e61('0x1e')](0x194);}return _0x5e8ec0;};}function handleError(_0x519712,_0x6ee488){_0x6ee488=_0x6ee488||0x1f4;return function(_0x5c71af){logger[_0x8e61('0x37')](_0x5c71af['stack']);if(_0x5c71af[_0x8e61('0x34')]){delete _0x5c71af[_0x8e61('0x34')];}_0x519712[_0x8e61('0x1f')](_0x6ee488)[_0x8e61('0x38')](_0x5c71af);};}exports['index']=function(_0x3cdd59,_0x76a9e3){var _0x343cdf={},_0x9e536e={},_0x264357={'count':0x0,'rows':[]};var _0x57b654=_[_0x8e61('0x2f')](db[_0x8e61('0x39')][_0x8e61('0x3a')],function(_0x32ab8c){return{'name':_0x32ab8c[_0x8e61('0x3b')],'type':_0x32ab8c[_0x8e61('0x32')][_0x8e61('0x3c')]};});_0x9e536e['model']=_[_0x8e61('0x2f')](_0x57b654,_0x8e61('0x34'));_0x9e536e[_0x8e61('0x3d')]=_[_0x8e61('0x3e')](_0x3cdd59['query']);_0x9e536e[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x9e536e[_0x8e61('0x41')],_0x9e536e[_0x8e61('0x3d')]);_0x343cdf[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x9e536e['model'],qs[_0x8e61('0x43')](_0x3cdd59['query'][_0x8e61('0x43')]));_0x343cdf[_0x8e61('0x42')]=_0x343cdf[_0x8e61('0x42')][_0x8e61('0x44')]?_0x343cdf['attributes']:_0x9e536e['model'];if(!_0x3cdd59[_0x8e61('0x3d')][_0x8e61('0x45')](_0x8e61('0x46'))){_0x343cdf[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x3cdd59[_0x8e61('0x3d')][_0x8e61('0x22')]);_0x343cdf[_0x8e61('0x20')]=qs[_0x8e61('0x20')](_0x3cdd59[_0x8e61('0x3d')]['offset']);}_0x343cdf[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x3cdd59[_0x8e61('0x3d')][_0x8e61('0x48')]);_0x343cdf[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_[_0x8e61('0x4a')](_0x3cdd59['query'],_0x9e536e[_0x8e61('0x3f')]),_0x57b654);if(_0x3cdd59[_0x8e61('0x3d')][_0x8e61('0x2d')]){_0x343cdf['where']=_[_0x8e61('0x4b')](_0x343cdf[_0x8e61('0x49')],{'$or':_['map'](_0x57b654,function(_0x391e9a){if(_0x391e9a[_0x8e61('0x32')]!==_0x8e61('0x4c')){var _0x89a341={};_0x89a341[_0x391e9a[_0x8e61('0x34')]]={'$like':'%'+_0x3cdd59['query'][_0x8e61('0x2d')]+'%'};return _0x89a341;}})});}_0x343cdf=_[_0x8e61('0x4b')]({},_0x343cdf,_0x3cdd59[_0x8e61('0x4d')]);var _0xeac2b4={'where':_0x343cdf[_0x8e61('0x49')]};return db[_0x8e61('0x39')][_0x8e61('0x23')](_0xeac2b4)[_0x8e61('0x28')](function(_0x31b2fb){_0x264357[_0x8e61('0x23')]=_0x31b2fb;if(_0x3cdd59['query'][_0x8e61('0x4e')]){_0x343cdf[_0x8e61('0x4f')]=[{'all':!![]}];}return db[_0x8e61('0x39')][_0x8e61('0x50')](_0x343cdf);})[_0x8e61('0x28')](function(_0xcb967e){_0x264357[_0x8e61('0x51')]=_0xcb967e;return _0x264357;})[_0x8e61('0x28')](respondWithFilteredResult(_0x76a9e3,_0x343cdf))[_0x8e61('0x52')](handleError(_0x76a9e3,null));};exports[_0x8e61('0x53')]=function(_0x186662,_0x3af7c9){var _0x5159ec={'raw':![],'where':{'id':_0x186662['params']['id']}},_0x5e81e1={};_0x5e81e1['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0x5e81e1['query']=_[_0x8e61('0x3e')](_0x186662[_0x8e61('0x3d')]);_0x5e81e1[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x5e81e1[_0x8e61('0x41')],_0x5e81e1[_0x8e61('0x3d')]);_0x5159ec[_0x8e61('0x42')]=_['intersection'](_0x5e81e1['model'],qs[_0x8e61('0x43')](_0x186662[_0x8e61('0x3d')]['fields']));_0x5159ec[_0x8e61('0x42')]=_0x5159ec[_0x8e61('0x42')][_0x8e61('0x44')]?_0x5159ec[_0x8e61('0x42')]:_0x5e81e1[_0x8e61('0x41')];if(_0x186662[_0x8e61('0x3d')][_0x8e61('0x4e')]){_0x5159ec['include']=[{'all':!![]}];}_0x5159ec=_[_0x8e61('0x4b')]({},_0x5159ec,_0x186662[_0x8e61('0x4d')]);return db[_0x8e61('0x39')]['find'](_0x5159ec)['then'](handleEntityNotFound(_0x3af7c9,null))[_0x8e61('0x28')](respondWithResult(_0x3af7c9,null))[_0x8e61('0x52')](handleError(_0x3af7c9,null));};exports[_0x8e61('0x54')]=function(_0x1cdfca,_0x36f452){return db[_0x8e61('0x39')]['create'](_0x1cdfca[_0x8e61('0x55')],{})[_0x8e61('0x28')](function(_0x39c357){var _0x40f5d1=_0x1cdfca[_0x8e61('0x56')]['get']({'plain':!![]});if(!_0x40f5d1)throw new Error(_0x8e61('0x57'));if(_0x40f5d1[_0x8e61('0x58')]===_0x8e61('0x56')){var _0x6aaf1c=_0x39c357['get']({'plain':!![]});var _0x3e68fe=[{'name':_0x8e61('0x2a'),'value':_0x8e61('0x2b')},{'name':_0x8e61('0x2c'),'value':_0x8e61('0x59')}];var _0x21f670=_[_0x8e61('0x33')](_0x3e68fe,[_0x8e61('0x30'),_0x6aaf1c[_0x8e61('0x32')]])[_0x8e61('0x34')];return db[_0x8e61('0x5a')][_0x8e61('0x33')]({'where':{'name':_0x21f670,'userProfileId':_0x40f5d1['userProfileId']},'raw':!![]})[_0x8e61('0x28')](function(_0x5b61d9){if(_0x5b61d9&&_0x5b61d9[_0x8e61('0x5b')]===0x0){return db[_0x8e61('0x35')]['create']({'name':_0x6aaf1c[_0x8e61('0x34')],'resourceId':_0x6aaf1c['id'],'type':_0x5b61d9[_0x8e61('0x34')],'sectionId':_0x5b61d9['id']},{})[_0x8e61('0x28')](function(){return _0x39c357;});}else{return _0x39c357;}})[_0x8e61('0x52')](function(_0x20e719){logger['error'](_0x8e61('0x5c'),_0x20e719);throw _0x20e719;});}return _0x39c357;})[_0x8e61('0x28')](respondWithResult(_0x36f452,0xc9))[_0x8e61('0x52')](handleError(_0x36f452,null));};exports[_0x8e61('0x5d')]=function(_0x2474b5,_0x13db5f){var _0x2dd53e={'where':{'id':_0x2474b5[_0x8e61('0x5e')]['id']}},_0x465da0={};_0x465da0[_0x8e61('0x41')]=_['keys'](db[_0x8e61('0x39')][_0x8e61('0x3a')]);_0x2dd53e[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x465da0[_0x8e61('0x41')],qs[_0x8e61('0x43')](_0x2474b5['query'][_0x8e61('0x43')]));_0x2dd53e[_0x8e61('0x42')]=_0x2dd53e['attributes']['length']?_0x2dd53e['attributes']:_0x465da0[_0x8e61('0x41')];if(_0x2474b5[_0x8e61('0x3d')][_0x8e61('0x4e')]){_0x2dd53e[_0x8e61('0x4f')]=[{'all':!![]}];}_0x2dd53e=_[_0x8e61('0x4b')]({},_0x2dd53e,_0x2474b5[_0x8e61('0x4d')]);return db[_0x8e61('0x39')][_0x8e61('0x33')](_0x2dd53e)[_0x8e61('0x28')](handleEntityNotFound(_0x13db5f,null))[_0x8e61('0x28')](function(_0x1b5f17){if(_0x1b5f17){var _0x3ef0e1=_0x1b5f17[_0x8e61('0x5f')]({'plain':!![]});_0x3ef0e1=qs[_0x8e61('0x60')](_0x3ef0e1,['id',_0x8e61('0x61'),_0x8e61('0x62')]);_0x2474b5[_0x8e61('0x55')]=_[_0x8e61('0x60')](_0x2474b5[_0x8e61('0x55')],['id',_0x8e61('0x61'),_0x8e61('0x62')]);return db[_0x8e61('0x39')]['create'](_[_0x8e61('0x4b')](_0x3ef0e1,_0x2474b5[_0x8e61('0x55')]),{'include':_0x2474b5[_0x8e61('0x3d')][_0x8e61('0x4e')]?[{'all':!![]}]:undefined})[_0x8e61('0x28')](function(_0x5a1fdc){var _0x586f80=_0x2474b5[_0x8e61('0x56')][_0x8e61('0x5f')]({'plain':!![]});if(!_0x586f80)throw new Error(_0x8e61('0x57'));if(_0x586f80[_0x8e61('0x58')]===_0x8e61('0x56')){var _0x4069bb=_0x5a1fdc[_0x8e61('0x5f')]({'plain':!![]});var _0x3047b8=[{'name':_0x8e61('0x2a'),'value':_0x8e61('0x2b')},{'name':_0x8e61('0x2c'),'value':_0x8e61('0x59')}];var _0x10d4d7=_[_0x8e61('0x33')](_0x3047b8,[_0x8e61('0x30'),_0x4069bb[_0x8e61('0x32')]])[_0x8e61('0x34')];return db[_0x8e61('0x5a')][_0x8e61('0x33')]({'where':{'name':_0x10d4d7,'userProfileId':_0x586f80[_0x8e61('0x63')]},'raw':!![]})[_0x8e61('0x28')](function(_0x3ef490){if(_0x3ef490&&_0x3ef490[_0x8e61('0x5b')]===0x0){return db['UserProfileResource'][_0x8e61('0x54')]({'name':_0x4069bb[_0x8e61('0x34')],'resourceId':_0x4069bb['id'],'type':_0x3ef490[_0x8e61('0x34')],'sectionId':_0x3ef490['id']},{})[_0x8e61('0x28')](function(){return _0x5a1fdc;});}else{return _0x5a1fdc;}})[_0x8e61('0x52')](function(_0x21f90f){logger[_0x8e61('0x37')](_0x8e61('0x5c'),_0x21f90f);throw _0x21f90f;});}return _0x5a1fdc;});}})[_0x8e61('0x28')](respondWithResult(_0x13db5f,0xc9))[_0x8e61('0x52')](handleError(_0x13db5f,null));};exports[_0x8e61('0x64')]=function(_0x26c50a,_0x3b2a6c){if(_0x26c50a[_0x8e61('0x55')]['id']){delete _0x26c50a[_0x8e61('0x55')]['id'];}return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x26c50a[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x3b2a6c,null))[_0x8e61('0x28')](saveUpdates(_0x26c50a[_0x8e61('0x55')],null))[_0x8e61('0x28')](respondWithResult(_0x3b2a6c,null))['catch'](handleError(_0x3b2a6c,null));};exports[_0x8e61('0x29')]=function(_0x15195c,_0x3a698c){return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x15195c[_0x8e61('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3a698c,null))[_0x8e61('0x28')](removeEntity(_0x3a698c,null))[_0x8e61('0x52')](handleError(_0x3a698c,null));};exports[_0x8e61('0x65')]=function(_0x5d92f7,_0x1ed320,_0x130daa){var _0x5b981a={'raw':![],'where':{}};var _0x1bd575={};var _0x10dfd2={'count':0x0,'rows':[]};return db[_0x8e61('0x39')][_0x8e61('0x66')]({'where':{'id':_0x5d92f7[_0x8e61('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1ed320,null))[_0x8e61('0x28')](function(_0x36197a){if(_0x36197a){_0x1bd575[_0x8e61('0x41')]=_[_0x8e61('0x3e')](db[_0x8e61('0x67')][_0x8e61('0x3a')]);_0x1bd575[_0x8e61('0x3d')]=_[_0x8e61('0x3e')](_0x5d92f7[_0x8e61('0x3d')]);_0x1bd575[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x1bd575[_0x8e61('0x41')],_0x1bd575[_0x8e61('0x3d')]);_0x5b981a[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x1bd575['model'],qs[_0x8e61('0x43')](_0x5d92f7[_0x8e61('0x3d')]['fields']));_0x5b981a['attributes']=_0x5b981a[_0x8e61('0x42')]['length']?_0x5b981a[_0x8e61('0x42')]:_0x1bd575[_0x8e61('0x41')];if(!_0x5d92f7['query']['hasOwnProperty'](_0x8e61('0x46'))){_0x5b981a[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x5d92f7[_0x8e61('0x3d')]['limit']);_0x5b981a[_0x8e61('0x20')]=qs[_0x8e61('0x20')](_0x5d92f7[_0x8e61('0x3d')]['offset']);}_0x5b981a[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x5d92f7[_0x8e61('0x3d')][_0x8e61('0x48')]);_0x5b981a[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_['pick'](_0x5d92f7[_0x8e61('0x3d')],_0x1bd575[_0x8e61('0x3f')]));_0x5b981a['where'][_0x8e61('0x68')]=_0x36197a['id'];if(_0x5d92f7[_0x8e61('0x3d')][_0x8e61('0x2d')]){_0x5b981a[_0x8e61('0x49')]=_[_0x8e61('0x4b')](_0x5b981a[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0x5b981a[_0x8e61('0x42')],function(_0x801093){var _0x57fdea={};_0x57fdea[_0x801093]={'$like':'%'+_0x5d92f7[_0x8e61('0x3d')][_0x8e61('0x2d')]+'%'};return _0x57fdea;})});}_0x5b981a=_['merge']({},_0x5b981a,_0x5d92f7[_0x8e61('0x4d')]);return db[_0x8e61('0x67')]['count']({'where':_0x5b981a[_0x8e61('0x49')]})[_0x8e61('0x28')](function(_0x378116){_0x10dfd2['count']=_0x378116;if(_0x5d92f7['query'][_0x8e61('0x4e')]){_0x5b981a['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x5b981a);})['then'](function(_0x5a10e5){_0x10dfd2[_0x8e61('0x51')]=_0x5a10e5;return _0x10dfd2;});}})[_0x8e61('0x28')](respondWithFilteredResult(_0x1ed320,_0x5b981a))[_0x8e61('0x52')](handleError(_0x1ed320,null));};exports[_0x8e61('0x69')]=function(_0x5101ff,_0x26de25,_0x5c741b){var _0x316620={'raw':!![],'where':{}};var _0x1c8272={};var _0x1bfd0b={'count':0x0,'rows':[]};return db[_0x8e61('0x39')][_0x8e61('0x66')]({'where':{'id':_0x5101ff[_0x8e61('0x5e')]['id']}})['then'](handleEntityNotFound(_0x26de25,null))[_0x8e61('0x28')](function(_0x4c7c7a){if(_0x4c7c7a){_0x1c8272[_0x8e61('0x41')]=_[_0x8e61('0x3e')](db[_0x8e61('0x6a')][_0x8e61('0x3a')]);_0x1c8272['query']=_[_0x8e61('0x3e')](_0x5101ff[_0x8e61('0x3d')]);_0x1c8272[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x1c8272['model'],_0x1c8272[_0x8e61('0x3d')]);_0x316620[_0x8e61('0x42')]=_['intersection'](_0x1c8272[_0x8e61('0x41')],qs[_0x8e61('0x43')](_0x5101ff['query'][_0x8e61('0x43')]));_0x316620[_0x8e61('0x42')]=_0x316620[_0x8e61('0x42')][_0x8e61('0x44')]?_0x316620[_0x8e61('0x42')]:_0x1c8272[_0x8e61('0x41')];if(!_0x5101ff['query'][_0x8e61('0x45')](_0x8e61('0x46'))){_0x316620[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x5101ff[_0x8e61('0x3d')][_0x8e61('0x22')]);_0x316620[_0x8e61('0x20')]=qs[_0x8e61('0x20')](_0x5101ff['query'][_0x8e61('0x20')]);}_0x316620[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x5101ff[_0x8e61('0x3d')]['sort']);_0x316620[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_[_0x8e61('0x4a')](_0x5101ff[_0x8e61('0x3d')],_0x1c8272['filters']));_0x316620[_0x8e61('0x49')][_0x8e61('0x68')]=_0x4c7c7a['id'];if(_0x5101ff[_0x8e61('0x3d')]['filter']){_0x316620[_0x8e61('0x49')]=_[_0x8e61('0x4b')](_0x316620[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0x316620[_0x8e61('0x42')],function(_0x5a1a1e){var _0x3bb1dd={};_0x3bb1dd[_0x5a1a1e]={'$like':'%'+_0x5101ff[_0x8e61('0x3d')][_0x8e61('0x2d')]+'%'};return _0x3bb1dd;})});}_0x316620=_[_0x8e61('0x4b')]({},_0x316620,_0x5101ff[_0x8e61('0x4d')]);return db[_0x8e61('0x6a')][_0x8e61('0x23')]({'where':_0x316620[_0x8e61('0x49')]})['then'](function(_0xb185ba){_0x1bfd0b['count']=_0xb185ba;if(_0x5101ff[_0x8e61('0x3d')][_0x8e61('0x4e')]){_0x316620[_0x8e61('0x4f')]=[{'all':!![]}];}return db[_0x8e61('0x6a')][_0x8e61('0x50')](_0x316620);})[_0x8e61('0x28')](function(_0x5385bd){_0x1bfd0b[_0x8e61('0x51')]=_0x5385bd;return _0x1bfd0b;});}})['then'](respondWithFilteredResult(_0x26de25,_0x316620))[_0x8e61('0x52')](handleError(_0x26de25,null));};exports[_0x8e61('0x6b')]=function(_0x251300,_0x39a522,_0x1093dc){var _0x1a6cd1={'raw':!![],'where':{}};var _0x2210e6={};var _0xfd69ba={'count':0x0,'rows':[]};return db[_0x8e61('0x39')][_0x8e61('0x66')]({'where':{'id':_0x251300[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x39a522,null))[_0x8e61('0x28')](function(_0x1a1487){if(_0x1a1487){_0x2210e6[_0x8e61('0x41')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x2210e6['query']=_[_0x8e61('0x3e')](_0x251300[_0x8e61('0x3d')]);_0x2210e6[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x2210e6[_0x8e61('0x41')],_0x2210e6[_0x8e61('0x3d')]);_0x1a6cd1[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x2210e6[_0x8e61('0x41')],qs['fields'](_0x251300[_0x8e61('0x3d')][_0x8e61('0x43')]));_0x1a6cd1[_0x8e61('0x42')]=_0x1a6cd1[_0x8e61('0x42')][_0x8e61('0x44')]?_0x1a6cd1[_0x8e61('0x42')]:_0x2210e6['model'];if(!_0x251300[_0x8e61('0x3d')][_0x8e61('0x45')](_0x8e61('0x46'))){_0x1a6cd1[_0x8e61('0x22')]=qs['limit'](_0x251300[_0x8e61('0x3d')]['limit']);_0x1a6cd1[_0x8e61('0x20')]=qs['offset'](_0x251300[_0x8e61('0x3d')]['offset']);}_0x1a6cd1[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x251300[_0x8e61('0x3d')][_0x8e61('0x48')]);_0x1a6cd1[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_[_0x8e61('0x4a')](_0x251300['query'],_0x2210e6['filters']));_0x1a6cd1[_0x8e61('0x49')][_0x8e61('0x68')]=_0x1a1487['id'];if(_0x251300[_0x8e61('0x3d')][_0x8e61('0x2d')]){_0x1a6cd1[_0x8e61('0x49')]=_[_0x8e61('0x4b')](_0x1a6cd1[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0x1a6cd1[_0x8e61('0x42')],function(_0x47b8ed){var _0x2426b={};_0x2426b[_0x47b8ed]={'$like':'%'+_0x251300[_0x8e61('0x3d')][_0x8e61('0x2d')]+'%'};return _0x2426b;})});}_0x1a6cd1=_[_0x8e61('0x4b')]({},_0x1a6cd1,_0x251300['options']);return db[_0x8e61('0x6c')][_0x8e61('0x23')]({'where':_0x1a6cd1[_0x8e61('0x49')]})['then'](function(_0x4aa563){_0xfd69ba[_0x8e61('0x23')]=_0x4aa563;if(_0x251300[_0x8e61('0x3d')]['includeAll']){_0x1a6cd1[_0x8e61('0x4f')]=[{'all':!![]}];}return db[_0x8e61('0x6c')][_0x8e61('0x50')](_0x1a6cd1);})[_0x8e61('0x28')](function(_0x563658){_0xfd69ba[_0x8e61('0x51')]=_0x563658;return _0xfd69ba;});}})[_0x8e61('0x28')](respondWithFilteredResult(_0x39a522,_0x1a6cd1))[_0x8e61('0x52')](handleError(_0x39a522,null));};exports[_0x8e61('0x6d')]=function(_0x4fb2a8,_0x42ac8c,_0x2d769a){var _0x65d7ab={'raw':!![],'where':{}};var _0x28edda={};var _0x43837a={'count':0x0,'rows':[]};return db[_0x8e61('0x39')][_0x8e61('0x66')]({'where':{'id':_0x4fb2a8[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x42ac8c,null))[_0x8e61('0x28')](function(_0x36431a){if(_0x36431a){_0x28edda[_0x8e61('0x41')]=_[_0x8e61('0x3e')](db[_0x8e61('0x6e')]['rawAttributes']);_0x28edda['query']=_[_0x8e61('0x3e')](_0x4fb2a8[_0x8e61('0x3d')]);_0x28edda['filters']=_['intersection'](_0x28edda[_0x8e61('0x41')],_0x28edda[_0x8e61('0x3d')]);_0x65d7ab[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x28edda['model'],qs[_0x8e61('0x43')](_0x4fb2a8[_0x8e61('0x3d')][_0x8e61('0x43')]));_0x65d7ab[_0x8e61('0x42')]=_0x65d7ab['attributes'][_0x8e61('0x44')]?_0x65d7ab['attributes']:_0x28edda[_0x8e61('0x41')];if(!_0x4fb2a8[_0x8e61('0x3d')][_0x8e61('0x45')](_0x8e61('0x46'))){_0x65d7ab[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x4fb2a8[_0x8e61('0x3d')][_0x8e61('0x22')]);_0x65d7ab[_0x8e61('0x20')]=qs[_0x8e61('0x20')](_0x4fb2a8['query']['offset']);}_0x65d7ab['order']=qs[_0x8e61('0x48')](_0x4fb2a8['query'][_0x8e61('0x48')]);_0x65d7ab['where']=qs[_0x8e61('0x3f')](_[_0x8e61('0x4a')](_0x4fb2a8[_0x8e61('0x3d')],_0x28edda[_0x8e61('0x3f')]));_0x65d7ab[_0x8e61('0x49')][_0x8e61('0x68')]=_0x36431a['id'];if(_0x4fb2a8[_0x8e61('0x3d')]['filter']){_0x65d7ab[_0x8e61('0x49')]=_['merge'](_0x65d7ab[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0x65d7ab['attributes'],function(_0x599378){var _0x7b8dbc={};_0x7b8dbc[_0x599378]={'$like':'%'+_0x4fb2a8[_0x8e61('0x3d')][_0x8e61('0x2d')]+'%'};return _0x7b8dbc;})});}_0x65d7ab=_['merge']({},_0x65d7ab,_0x4fb2a8[_0x8e61('0x4d')]);return db['CmHopperBlack'][_0x8e61('0x23')]({'where':_0x65d7ab[_0x8e61('0x49')]})[_0x8e61('0x28')](function(_0x2f2f1a){_0x43837a[_0x8e61('0x23')]=_0x2f2f1a;if(_0x4fb2a8[_0x8e61('0x3d')][_0x8e61('0x4e')]){_0x65d7ab[_0x8e61('0x4f')]=[{'all':!![]}];}return db[_0x8e61('0x6e')][_0x8e61('0x50')](_0x65d7ab);})[_0x8e61('0x28')](function(_0x2104bf){_0x43837a[_0x8e61('0x51')]=_0x2104bf;return _0x43837a;});}})['then'](respondWithFilteredResult(_0x42ac8c,_0x65d7ab))[_0x8e61('0x52')](handleError(_0x42ac8c,null));};exports['getTeams']=function(_0x1165db,_0x29f73a,_0x21ba0c){var _0x129e80={};var _0x463b5c={};var _0x16fa91;var _0x490993;return db['VoiceQueue'][_0x8e61('0x66')]({'where':{'id':_0x1165db['params']['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x29f73a,null))[_0x8e61('0x28')](function(_0x181062){if(_0x181062){_0x16fa91=_0x181062;_0x463b5c[_0x8e61('0x41')]=_['keys'](db['Team']['rawAttributes']);_0x463b5c[_0x8e61('0x3d')]=_['keys'](_0x1165db[_0x8e61('0x3d')]);_0x463b5c[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x463b5c[_0x8e61('0x41')],_0x463b5c[_0x8e61('0x3d')]);_0x129e80[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x463b5c['model'],qs[_0x8e61('0x43')](_0x1165db['query'][_0x8e61('0x43')]));_0x129e80[_0x8e61('0x42')]=_0x129e80['attributes']['length']?_0x129e80['attributes']:_0x463b5c[_0x8e61('0x41')];_0x129e80[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x1165db[_0x8e61('0x3d')][_0x8e61('0x48')]);_0x129e80[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_['pick'](_0x1165db['query'],_0x463b5c[_0x8e61('0x3f')]));if(_0x1165db[_0x8e61('0x3d')]['filter']){_0x129e80[_0x8e61('0x49')]=_[_0x8e61('0x4b')](_0x129e80[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0x129e80[_0x8e61('0x42')],function(_0x5eb195){var _0x5759b3={};_0x5759b3[_0x5eb195]={'$like':'%'+_0x1165db[_0x8e61('0x3d')][_0x8e61('0x2d')]+'%'};return _0x5759b3;})});}_0x129e80=_[_0x8e61('0x4b')]({},_0x129e80,_0x1165db[_0x8e61('0x4d')]);return _0x16fa91[_0x8e61('0x6f')](_0x129e80);}})['then'](function(_0x1d80ab){if(_0x1d80ab){_0x490993=_0x1d80ab['length'];if(!_0x1165db['query']['hasOwnProperty'](_0x8e61('0x46'))){_0x129e80[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x1165db[_0x8e61('0x3d')][_0x8e61('0x22')]);_0x129e80[_0x8e61('0x20')]=qs['offset'](_0x1165db[_0x8e61('0x3d')][_0x8e61('0x20')]);}return _0x16fa91[_0x8e61('0x6f')](_0x129e80);}})['then'](function(_0x332d22){if(_0x332d22){return _0x332d22?{'count':_0x490993,'rows':_0x332d22}:null;}})[_0x8e61('0x28')](respondWithResult(_0x29f73a,null))[_0x8e61('0x52')](handleError(_0x29f73a,null));};exports[_0x8e61('0x70')]=function(_0x37f097,_0x317794,_0x4a79dd){var _0x53af47=_0x37f097[_0x8e61('0x55')]['teams'];var _0x18a270=_[_0x8e61('0x2f')](_0x53af47,'id');return db[_0x8e61('0x71')][_0x8e61('0x50')]({'where':{'id':_0x18a270},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8e61('0x72'),'attributes':['id','name',_0x8e61('0x73'),_0x8e61('0x74'),_0x8e61('0x75')],'raw':!![]}]})['then'](function(_0x1a63a9){if(_0x1a63a9){var _0x52dffa=_[_0x8e61('0x76')](_0x1a63a9,function(_0x13e1bf){var _0x55f67a=_0x13e1bf[_0x8e61('0x5f')]({'plain':!![]});_0x55f67a[_0x8e61('0x72')][_0x8e61('0x77')](function(_0x5075cd){_0x5075cd[_0x8e61('0x78')]=_[_0x8e61('0x33')](_0x53af47,{'id':_0x55f67a['id']})[_0x8e61('0x78')];});return _0x55f67a[_0x8e61('0x72')];});return db[_0x8e61('0x39')]['find']({'where':{'id':_0x37f097['params']['id']}})[_0x8e61('0x28')](function(_0x257302){return db[_0x8e61('0x79')][_0x8e61('0x7a')](function(_0x4b6b70){return _0x257302['addTeams'](_0x18a270,{'transaction':_0x4b6b70})[_0x8e61('0x28')](function(){return BPromise[_0x8e61('0x7b')](_0x53af47,function(_0x4dbba3){return db[_0x8e61('0x7c')][_0x8e61('0x7d')]({'TeamId':_0x4dbba3['id'],'VoiceQueueId':_0x37f097[_0x8e61('0x5e')]['id'],'penalty':_0x4dbba3[_0x8e61('0x78')]},{'transaction':_0x4b6b70});});})[_0x8e61('0x28')](function(){return BPromise['each'](_0x52dffa,function(_0x3c039f){return db['UserVoiceQueue'][_0x8e61('0x7e')]({'where':{'UserId':_0x3c039f['id'],'VoiceQueueId':_0x37f097[_0x8e61('0x5e')]['id']},'defaults':{'penalty':_0x3c039f[_0x8e61('0x78')]},'transaction':_0x4b6b70});});})[_0x8e61('0x28')](function(){return BPromise['each'](_[_0x8e61('0x2d')](_0x52dffa,{'online':!![]}),function(_0x15d8d0){return db[_0x8e61('0x7f')][_0x8e61('0x7d')]({'membername':_0x15d8d0[_0x8e61('0x34')],'UserId':_0x15d8d0['id'],'queue_name':_0x257302[_0x8e61('0x34')],'VoiceQueueId':_0x257302['id'],'interface':_[_0x8e61('0x80')](_0x15d8d0[_0x8e61('0x75')])?util[_0x8e61('0x81')](_0x8e61('0x82'),_0x15d8d0[_0x8e61('0x34')]):_0x15d8d0[_0x8e61('0x75')],'paused':_0x15d8d0[_0x8e61('0x74')]||![],'penalty':_0x15d8d0['penalty']},{'transaction':_0x4b6b70});});})[_0x8e61('0x28')](function(){_0x52dffa[_0x8e61('0x77')](function(_0x509fd5){socket[_0x8e61('0x83')](_0x8e61('0x84'),{'UserId':_0x509fd5['id'],'VoiceQueueId':_0x257302['id']});});});});});}})[_0x8e61('0x28')](respondWithStatusCode(_0x317794,null))[_0x8e61('0x52')](handleError(_0x317794,null));};exports[_0x8e61('0x85')]=function(_0xe4f74d,_0x5a6e61,_0x40e114){return db[_0x8e61('0x71')][_0x8e61('0x50')]({'where':{'id':_0xe4f74d[_0x8e61('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8e61('0x86')],'as':_0x8e61('0x72'),'attributes':['id'],'raw':!![]}]})[_0x8e61('0x28')](handleEntityNotFound(_0x5a6e61,null))[_0x8e61('0x28')](function(_0x9adc1a){var _0xf6a803=_['map'](_0x9adc1a,'id');var _0x2da223=[];var _0x6c949b=[];var _0x1bec90=squel[_0x8e61('0x87')]();_0x1bec90['field'](_0x8e61('0x88'))[_0x8e61('0x89')](_0x8e61('0x8a'),'tq')[_0x8e61('0x8b')](_0x8e61('0x8c'),'ut',_0x8e61('0x8d'))[_0x8e61('0x49')](_0x8e61('0x8e'),_0xe4f74d[_0x8e61('0x5e')]['id']);for(var _0x3e07a4=0x0;_0x3e07a4<_0x9adc1a['length'];_0x3e07a4+=0x1){let _0x208a6c=_0x9adc1a[_0x3e07a4];for(var _0x2ef90f=0x0;_0x2ef90f<_0x208a6c[_0x8e61('0x72')][_0x8e61('0x44')];_0x2ef90f+=0x1){let _0xfa4854=_0x208a6c['Agents'][_0x2ef90f];var _0x48c85d=_0x1bec90[_0x8e61('0x5d')]();_0x48c85d[_0x8e61('0x49')](_0x8e61('0x8f'),_0xfa4854['id']);_0x6c949b[_0x8e61('0x90')](db[_0x8e61('0x79')]['query'](_0x48c85d[_0x8e61('0x91')](),{'type':db[_0x8e61('0x79')][_0x8e61('0x92')][_0x8e61('0x93')]})[_0x8e61('0x28')](function(_0x258dba){if(_0x258dba[_0x8e61('0x44')]===0x1){return _0xfa4854['id'];}else{var _0x27c8ba=_['every'](_[_0x8e61('0x2f')](_0x258dba,_0x8e61('0x94')),function(_0x371467){return _[_0x8e61('0x31')](_0xf6a803,_0x371467);});if(_0x27c8ba){return _0xfa4854['id'];}}}));}}return BPromise[_0x8e61('0x95')](_0x6c949b)[_0x8e61('0x28')](function(_0x5bd91a){_0x2da223=_(_0x2da223)[_0x8e61('0x96')](_0x5bd91a)[_0x8e61('0x97')]()[_0x8e61('0x30')]();return db['VoiceQueue']['find']({'where':{'id':_0xe4f74d[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](function(_0x41b9fa){return db[_0x8e61('0x79')][_0x8e61('0x7a')](function(_0x4c910a){return _0x41b9fa[_0x8e61('0x85')](_0xe4f74d['query']['ids'],{'transaction':_0x4c910a})[_0x8e61('0x28')](function(){if(!_[_0x8e61('0x98')](_0x2da223)){return _0x41b9fa[_0x8e61('0x99')](_0x2da223,{'transaction':_0x4c910a})[_0x8e61('0x28')](function(){return db[_0x8e61('0x7f')][_0x8e61('0x29')]({'where':{'VoiceQueueId':_0xe4f74d[_0x8e61('0x5e')]['id'],'UserId':_0x2da223},'transaction':_0x4c910a});});}})[_0x8e61('0x28')](function(){_0x2da223[_0x8e61('0x77')](function(_0xecd3af){socket['emit'](_0x8e61('0x9a'),{'UserId':_0xecd3af,'VoiceQueueId':_0x41b9fa['id']});});});});});});})[_0x8e61('0x28')](respondWithStatusCode(_0x5a6e61,null))['catch'](handleError(_0x5a6e61,null));};exports[_0x8e61('0x9b')]=function(_0x34af14,_0x934883,_0x2d8890){var _0x498cd7,_0x539d9c;return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x34af14[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x934883,null))[_0x8e61('0x28')](function(_0x3e6a28){if(_0x3e6a28){_0x539d9c=_0x3e6a28;return _0x3e6a28[_0x8e61('0x9b')](_0x34af14[_0x8e61('0x55')][_0x8e61('0x9c')],_[_0x8e61('0x60')](_0x34af14['body'],[_0x8e61('0x9c'),'id'])||{})[_0x8e61('0x9d')](function(_0x5adf2e){for(var _0x555ae6=0x0;_0x555ae6<_0x34af14['body'][_0x8e61('0x9c')][_0x8e61('0x44')];_0x555ae6+=0x1){socket[_0x8e61('0x83')](_0x8e61('0x84'),{'UserId':Number(_0x34af14[_0x8e61('0x55')][_0x8e61('0x9c')][_0x555ae6]),'VoiceQueueId':Number(_0x34af14[_0x8e61('0x5e')]['id'])});}return _0x5adf2e;});}})['then'](function(_0x2f3835){_0x498cd7=_0x2f3835||[];if(_0x539d9c){return db[_0x8e61('0x86')][_0x8e61('0x50')]({'where':{'id':_0x34af14['body'][_0x8e61('0x9c')]},'attributes':['id',_0x8e61('0x34'),_0x8e61('0x73'),'voicePause',_0x8e61('0x75')],'raw':!![]});}})[_0x8e61('0x28')](function(_0x39f360){if(!_['isEmpty'](_0x39f360)){var _0x28179d=[];for(var _0x4d3764=0x0;_0x4d3764<_0x39f360[_0x8e61('0x44')];_0x4d3764++){if(_0x39f360[_0x4d3764][_0x8e61('0x73')]){_0x28179d[_0x8e61('0x90')](db[_0x8e61('0x7f')][_0x8e61('0x7d')]({'membername':_0x39f360[_0x4d3764]['name'],'UserId':_0x39f360[_0x4d3764]['id'],'queue_name':_0x539d9c[_0x8e61('0x34')],'VoiceQueueId':_0x539d9c['id'],'interface':_[_0x8e61('0x80')](_0x39f360[_0x4d3764][_0x8e61('0x75')])?util['format'](_0x8e61('0x82'),_0x39f360[_0x4d3764][_0x8e61('0x34')]):_0x39f360[_0x4d3764][_0x8e61('0x75')],'paused':_0x39f360[_0x4d3764]['voicePause']||![],'penalty':_0x34af14[_0x8e61('0x55')][_0x8e61('0x78')]||0x0}));}}return BPromise['all'](_0x28179d);}})[_0x8e61('0x28')](function(){return _0x498cd7;})[_0x8e61('0x28')](respondWithResult(_0x934883,null))[_0x8e61('0x52')](handleError(_0x934883,null));};exports[_0x8e61('0x99')]=function(_0x40720e,_0x3440df,_0xa6d305){return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x40720e[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x3440df,null))[_0x8e61('0x28')](function(_0x5dec26){if(_0x5dec26){return _0x5dec26[_0x8e61('0x99')](_0x40720e[_0x8e61('0x3d')][_0x8e61('0x9c')])['then'](function(){if(_[_0x8e61('0x9e')](_0x40720e[_0x8e61('0x3d')][_0x8e61('0x9c')])){for(var _0x42b683=0x0;_0x42b683<_0x40720e[_0x8e61('0x3d')][_0x8e61('0x9c')][_0x8e61('0x44')];_0x42b683+=0x1){socket[_0x8e61('0x83')](_0x8e61('0x9a'),{'UserId':Number(_0x40720e[_0x8e61('0x3d')]['ids'][_0x42b683]),'VoiceQueueId':Number(_0x40720e[_0x8e61('0x5e')]['id'])});}}else{socket[_0x8e61('0x83')](_0x8e61('0x9a'),{'UserId':Number(_0x40720e[_0x8e61('0x3d')][_0x8e61('0x9c')]),'VoiceQueueId':Number(_0x40720e[_0x8e61('0x5e')]['id'])});}});}})[_0x8e61('0x28')](function(_0x256de0){return db[_0x8e61('0x7f')][_0x8e61('0x29')]({'where':{'VoiceQueueId':_0x40720e[_0x8e61('0x5e')]['id'],'UserId':_0x40720e[_0x8e61('0x3d')][_0x8e61('0x9c')]}})[_0x8e61('0x28')](function(){return _0x256de0;});})[_0x8e61('0x28')](respondWithStatusCode(_0x3440df,null))[_0x8e61('0x52')](handleError(_0x3440df,null));};exports[_0x8e61('0x9f')]=function(_0x27852d,_0x2b1b57,_0xc3fed3){var _0x1921a5={};var _0x371951={};var _0x30ac01;var _0x6d9367;return db[_0x8e61('0x39')][_0x8e61('0x66')]({'where':{'id':_0x27852d[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x2b1b57,null))[_0x8e61('0x28')](function(_0x123d27){if(_0x123d27){_0x30ac01=_0x123d27;_0x371951[_0x8e61('0x41')]=_[_0x8e61('0x3e')](db[_0x8e61('0x86')]['rawAttributes']);_0x371951[_0x8e61('0x3d')]=_['keys'](_0x27852d[_0x8e61('0x3d')]);_0x371951[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x371951[_0x8e61('0x41')],_0x371951[_0x8e61('0x3d')]);_0x1921a5[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x371951['model'],qs[_0x8e61('0x43')](_0x27852d[_0x8e61('0x3d')][_0x8e61('0x43')]));_0x1921a5[_0x8e61('0x42')]=_0x1921a5[_0x8e61('0x42')][_0x8e61('0x44')]?_0x1921a5['attributes']:_0x371951[_0x8e61('0x41')];_0x1921a5[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x27852d[_0x8e61('0x3d')][_0x8e61('0x48')]);_0x1921a5[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_[_0x8e61('0x4a')](_0x27852d['query'],_0x371951['filters']));if(_0x27852d[_0x8e61('0x3d')][_0x8e61('0x2d')]){_0x1921a5['where']=_[_0x8e61('0x4b')](_0x1921a5[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0x1921a5[_0x8e61('0x42')],function(_0x1c33b0){var _0x2f65b1={};_0x2f65b1[_0x1c33b0]={'$like':'%'+_0x27852d[_0x8e61('0x3d')][_0x8e61('0x2d')]+'%'};return _0x2f65b1;})});}_0x1921a5=_[_0x8e61('0x4b')]({},_0x1921a5,_0x27852d[_0x8e61('0x4d')]);return _0x30ac01['getAgents'](_0x1921a5);}})['then'](function(_0x557798){if(_0x557798){_0x6d9367=_0x557798['length'];if(!_0x27852d[_0x8e61('0x3d')][_0x8e61('0x45')](_0x8e61('0x46'))){_0x1921a5[_0x8e61('0x22')]=qs['limit'](_0x27852d[_0x8e61('0x3d')][_0x8e61('0x22')]);_0x1921a5[_0x8e61('0x20')]=qs[_0x8e61('0x20')](_0x27852d['query']['offset']);}return _0x30ac01[_0x8e61('0x9f')](_0x1921a5);}})[_0x8e61('0x28')](function(_0x4a7335){if(_0x4a7335){return _0x4a7335?{'count':_0x6d9367,'rows':_0x4a7335}:null;}})[_0x8e61('0x28')](respondWithResult(_0x2b1b57,null))['catch'](handleError(_0x2b1b57,null));};exports[_0x8e61('0xa0')]=function(_0x35857b,_0x472ae3,_0x346c2c){var _0xbeb653={};var _0x49d018={};var _0x3f0e2c;var _0x334c7c;return db['VoiceQueue'][_0x8e61('0x66')]({'where':{'id':_0x35857b['params']['id']}})['then'](handleEntityNotFound(_0x472ae3,null))[_0x8e61('0x28')](function(_0x2d3a0e){if(_0x2d3a0e){_0x3f0e2c=_0x2d3a0e;_0x49d018['model']=_[_0x8e61('0x3e')](db['UserVoiceQueueRt'][_0x8e61('0x3a')]);_0x49d018[_0x8e61('0x3d')]=_[_0x8e61('0x3e')](_0x35857b['query']);_0x49d018[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x49d018[_0x8e61('0x41')],_0x49d018[_0x8e61('0x3d')]);_0xbeb653['attributes']=_[_0x8e61('0x40')](_0x49d018[_0x8e61('0x41')],qs[_0x8e61('0x43')](_0x35857b['query']['fields']));_0xbeb653['attributes']=_0xbeb653[_0x8e61('0x42')][_0x8e61('0x44')]?_0xbeb653[_0x8e61('0x42')]:_0x49d018['model'];_0xbeb653[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x35857b[_0x8e61('0x3d')][_0x8e61('0x48')]);_0xbeb653[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_['pick'](_0x35857b[_0x8e61('0x3d')],_0x49d018[_0x8e61('0x3f')]));if(_0x35857b[_0x8e61('0x3d')][_0x8e61('0x2d')]){_0xbeb653['where']=_[_0x8e61('0x4b')](_0xbeb653[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0xbeb653['attributes'],function(_0x29629d){var _0x635d9f={};_0x635d9f[_0x29629d]={'$like':'%'+_0x35857b['query'][_0x8e61('0x2d')]+'%'};return _0x635d9f;})});}_0xbeb653=_['merge']({},_0xbeb653,_0x35857b['options']);return _0x3f0e2c[_0x8e61('0xa0')](_0xbeb653);}})['then'](function(_0x1dc16b){if(_0x1dc16b){_0x334c7c=_0x1dc16b[_0x8e61('0x44')];if(!_0x35857b['query']['hasOwnProperty'](_0x8e61('0x46'))){_0xbeb653[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x35857b[_0x8e61('0x3d')][_0x8e61('0x22')]);_0xbeb653[_0x8e61('0x20')]=qs[_0x8e61('0x20')](_0x35857b[_0x8e61('0x3d')]['offset']);}return _0x3f0e2c[_0x8e61('0xa0')](_0xbeb653);}})['then'](function(_0x8a004e){return _0x8a004e?{'count':_0x334c7c,'rows':_0x8a004e}:null;})[_0x8e61('0x28')](respondWithResult(_0x472ae3,null))[_0x8e61('0x52')](handleError(_0x472ae3,null));};exports[_0x8e61('0xa1')]=function(_0x57d87b,_0x2dcb60,_0x2aa55d){var _0x47ca4c={};var _0x1f6979={};var _0x27c02e;var _0x45b87b;return db[_0x8e61('0x39')][_0x8e61('0x66')]({'where':{'id':_0x57d87b[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x2dcb60,null))[_0x8e61('0x28')](function(_0x59ba41){if(_0x59ba41){_0x27c02e=_0x59ba41;_0x1f6979[_0x8e61('0x41')]=_[_0x8e61('0x3e')](db[_0x8e61('0xa2')][_0x8e61('0x3a')]);_0x1f6979[_0x8e61('0x3d')]=_['keys'](_0x57d87b[_0x8e61('0x3d')]);_0x1f6979[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x1f6979['model'],_0x1f6979[_0x8e61('0x3d')]);_0x47ca4c[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x1f6979[_0x8e61('0x41')],qs[_0x8e61('0x43')](_0x57d87b['query'][_0x8e61('0x43')]));_0x47ca4c['attributes']=_0x47ca4c[_0x8e61('0x42')]['length']?_0x47ca4c['attributes']:_0x1f6979[_0x8e61('0x41')];_0x47ca4c['order']=qs[_0x8e61('0x48')](_0x57d87b[_0x8e61('0x3d')][_0x8e61('0x48')]);_0x47ca4c[_0x8e61('0x49')]=qs[_0x8e61('0x3f')](_[_0x8e61('0x4a')](_0x57d87b['query'],_0x1f6979[_0x8e61('0x3f')]));if(_0x57d87b[_0x8e61('0x3d')][_0x8e61('0x2d')]){_0x47ca4c[_0x8e61('0x49')]=_[_0x8e61('0x4b')](_0x47ca4c[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0x47ca4c['attributes'],function(_0x34e7aa){var _0x1f5b0c={};_0x1f5b0c[_0x34e7aa]={'$like':'%'+_0x57d87b['query'][_0x8e61('0x2d')]+'%'};return _0x1f5b0c;})});}_0x47ca4c=_[_0x8e61('0x4b')]({},_0x47ca4c,_0x57d87b[_0x8e61('0x4d')]);return _0x27c02e['getLists'](_0x47ca4c);}})[_0x8e61('0x28')](function(_0x1e804f){if(_0x1e804f){_0x45b87b=_0x1e804f['length'];if(!_0x57d87b['query'][_0x8e61('0x45')]('nolimit')){_0x47ca4c[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x57d87b[_0x8e61('0x3d')][_0x8e61('0x22')]);_0x47ca4c[_0x8e61('0x20')]=qs[_0x8e61('0x20')](_0x57d87b[_0x8e61('0x3d')][_0x8e61('0x20')]);}return _0x27c02e[_0x8e61('0xa1')](_0x47ca4c);}})['then'](function(_0x4a8efe){if(_0x4a8efe){return _0x4a8efe?{'count':_0x45b87b,'rows':_0x4a8efe}:null;}})[_0x8e61('0x28')](respondWithResult(_0x2dcb60,null))[_0x8e61('0x52')](handleError(_0x2dcb60,null));};exports['addLists']=function(_0x5acf80,_0x47fad0,_0x3d4522){var _0x504de1,_0x5b7fb7;return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x5acf80[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x47fad0,null))['then'](function(_0x4e8522){if(_0x4e8522){_0x5b7fb7=_0x4e8522;return _0x4e8522[_0x8e61('0xa3')](_0x5acf80[_0x8e61('0x55')][_0x8e61('0x9c')],_[_0x8e61('0x60')](_0x5acf80[_0x8e61('0x55')],[_0x8e61('0x9c'),'id'])||{});}return null;})['spread'](function(_0x571f7b){var _0x153b34;_0x504de1=_0x571f7b||[];var _0x3f545f=[];if(_0x571f7b){for(var _0x5d8d98=0x0;_0x5d8d98<_0x571f7b[_0x8e61('0x44')];_0x5d8d98+=0x1){var _0x2ce9c3=_0x571f7b[_0x5d8d98][_0x8e61('0x5f')]({'plain':!![]});_0x5b7fb7[_0x8e61('0xa4')]=_0x5acf80['body'][_0x8e61('0xa4')]?_0x5acf80[_0x8e61('0x55')]['dialCheckDuplicateType']:_0x5b7fb7['dialCheckDuplicateType'];switch(_0x5b7fb7['dialCheckDuplicateType']){case'always':_0x153b34=squel[_0x8e61('0xa5')]()[_0x8e61('0xa6')]('cm_hopper')['fromQuery']([_0x8e61('0xa7'),_0x8e61('0xa8'),_0x8e61('0xa9'),'ListId',_0x8e61('0x68'),'createdAt',_0x8e61('0x62')],squel[_0x8e61('0x87')]()[_0x8e61('0xaa')](_0x8e61('0xa7'),_0x8e61('0xa7'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0xa8'))[_0x8e61('0xaa')]('id',_0x8e61('0xa9'))[_0x8e61('0xaa')](_0x2ce9c3[_0x8e61('0xac')][_0x8e61('0x91')](),_0x8e61('0xad'))[_0x8e61('0xaa')](_0x5acf80['params']['id'][_0x8e61('0x91')](),_0x8e61('0x68'))['field'](_0x8e61('0xab'),_0x8e61('0x61'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0x62'))['from'](_0x8e61('0xae'))['where'](_0x8e61('0xaf'))['where'](_0x8e61('0xb0'),_0x2ce9c3[_0x8e61('0xac')]['toString']())[_0x8e61('0x49')](_0x8e61('0xb1'))[_0x8e61('0x49')](_0x8e61('0xb2'),squel[_0x8e61('0x87')]()[_0x8e61('0xaa')]('COALESCE(calleridnum,\x27\x27)')[_0x8e61('0x89')](_0x8e61('0xb3'))[_0x8e61('0x49')](_0x8e61('0x8e'),_0x5acf80[_0x8e61('0x5e')]['id'][_0x8e61('0x91')]()))['where'](_0x8e61('0xb2'),squel[_0x8e61('0x87')]()[_0x8e61('0xaa')]('COALESCE(phone,\x27\x27)')['from'](_0x8e61('0xb4'))['where']('VoiceQueueId\x20=\x20?',_0x5acf80['params']['id'][_0x8e61('0x91')]())))[_0x8e61('0x91')]();break;case _0x8e61('0xb5'):_0x153b34=squel[_0x8e61('0xa5')]()[_0x8e61('0xa6')](_0x8e61('0xb4'))[_0x8e61('0xb6')]([_0x8e61('0xa7'),'scheduledAt',_0x8e61('0xa9'),_0x8e61('0xad'),'VoiceQueueId',_0x8e61('0x61'),_0x8e61('0x62')],squel[_0x8e61('0x87')]()[_0x8e61('0xaa')]('phone',_0x8e61('0xa7'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0xa8'))[_0x8e61('0xaa')]('id',_0x8e61('0xa9'))[_0x8e61('0xaa')](_0x2ce9c3[_0x8e61('0xac')][_0x8e61('0x91')](),_0x8e61('0xad'))[_0x8e61('0xaa')](_0x5acf80[_0x8e61('0x5e')]['id'][_0x8e61('0x91')](),_0x8e61('0x68'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0x61'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0x62'))[_0x8e61('0x89')](_0x8e61('0xae'))[_0x8e61('0x49')]('deletedAt\x20IS\x20NULL')[_0x8e61('0x49')](_0x8e61('0xb0'),_0x2ce9c3[_0x8e61('0xac')][_0x8e61('0x91')]())['where'](_0x8e61('0xb1'))[_0x8e61('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8e61('0x87')]()[_0x8e61('0xaa')](_0x8e61('0xb7'))[_0x8e61('0x89')](_0x8e61('0xb4'))[_0x8e61('0x49')]('VoiceQueueId\x20=\x20?',_0x5acf80[_0x8e61('0x5e')]['id'][_0x8e61('0x91')]())))[_0x8e61('0x91')]();break;default:_0x153b34=squel['insert']()[_0x8e61('0xa6')](_0x8e61('0xb4'))[_0x8e61('0xb6')]([_0x8e61('0xa7'),_0x8e61('0xa8'),_0x8e61('0xa9'),'ListId',_0x8e61('0x68'),_0x8e61('0x61'),'updatedAt'],squel['select']()['field'](_0x8e61('0xa7'),_0x8e61('0xa7'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0xa8'))[_0x8e61('0xaa')]('id','ContactId')[_0x8e61('0xaa')](_0x2ce9c3['CmListId']['toString'](),_0x8e61('0xad'))[_0x8e61('0xaa')](_0x5acf80['params']['id'][_0x8e61('0x91')](),_0x8e61('0x68'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0x61'))[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0x62'))['from']('cm_contacts')[_0x8e61('0x49')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x2ce9c3['CmListId']['toString']())[_0x8e61('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0x8e61('0x91')]();}_0x3f545f[_0x8e61('0x90')](db[_0x8e61('0x79')]['query'](_0x153b34));}return BPromise[_0x8e61('0x95')](_0x3f545f);}})[_0x8e61('0x28')](function(){return _0x504de1;})['then'](respondWithResult(_0x47fad0,null))[_0x8e61('0x52')](handleError(_0x47fad0,null));};exports[_0x8e61('0xb8')]=function(_0x18f4f5,_0x32373e,_0x1db823){return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x18f4f5['params']['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x32373e,null))[_0x8e61('0x28')](function(_0x3f8a53){if(_0x3f8a53){return _0x3f8a53[_0x8e61('0xb8')](_0x18f4f5[_0x8e61('0x3d')][_0x8e61('0x9c')]);}})['then'](function(_0x5bacf7){if(_0x5bacf7){return db[_0x8e61('0x67')]['destroy']({'where':{'ListId':_0x18f4f5[_0x8e61('0x3d')][_0x8e61('0x9c')],'VoiceQueueId':_0x18f4f5[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](function(){return _0x5bacf7;});}})['then'](respondWithStatusCode(_0x32373e,null))['catch'](handleError(_0x32373e,null));};exports[_0x8e61('0xb9')]=function(_0x16c1dc,_0x4cc562,_0x349625){var _0xe50907={};var _0x57c2df={};var _0x420467;var _0x58dc88;return db[_0x8e61('0x39')][_0x8e61('0x66')]({'where':{'id':_0x16c1dc[_0x8e61('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4cc562,null))[_0x8e61('0x28')](function(_0x7bed47){if(_0x7bed47){_0x420467=_0x7bed47;_0x57c2df[_0x8e61('0x41')]=_['keys'](db[_0x8e61('0xa2')]['rawAttributes']);_0x57c2df[_0x8e61('0x3d')]=_[_0x8e61('0x3e')](_0x16c1dc[_0x8e61('0x3d')]);_0x57c2df[_0x8e61('0x3f')]=_[_0x8e61('0x40')](_0x57c2df[_0x8e61('0x41')],_0x57c2df[_0x8e61('0x3d')]);_0xe50907[_0x8e61('0x42')]=_[_0x8e61('0x40')](_0x57c2df[_0x8e61('0x41')],qs['fields'](_0x16c1dc[_0x8e61('0x3d')][_0x8e61('0x43')]));_0xe50907[_0x8e61('0x42')]=_0xe50907['attributes'][_0x8e61('0x44')]?_0xe50907[_0x8e61('0x42')]:_0x57c2df['model'];_0xe50907[_0x8e61('0x47')]=qs[_0x8e61('0x48')](_0x16c1dc[_0x8e61('0x3d')]['sort']);_0xe50907['where']=qs['filters'](_['pick'](_0x16c1dc[_0x8e61('0x3d')],_0x57c2df[_0x8e61('0x3f')]));if(_0x16c1dc[_0x8e61('0x3d')][_0x8e61('0x2d')]){_0xe50907[_0x8e61('0x49')]=_[_0x8e61('0x4b')](_0xe50907[_0x8e61('0x49')],{'$or':_[_0x8e61('0x2f')](_0xe50907['attributes'],function(_0xbfeb22){var _0x178e03={};_0x178e03[_0xbfeb22]={'$like':'%'+_0x16c1dc['query'][_0x8e61('0x2d')]+'%'};return _0x178e03;})});}_0xe50907=_[_0x8e61('0x4b')]({},_0xe50907,_0x16c1dc['options']);return _0x420467['getBlackLists'](_0xe50907);}})[_0x8e61('0x28')](function(_0x11ca7e){if(_0x11ca7e){_0x58dc88=_0x11ca7e[_0x8e61('0x44')];if(!_0x16c1dc[_0x8e61('0x3d')]['hasOwnProperty'](_0x8e61('0x46'))){_0xe50907[_0x8e61('0x22')]=qs[_0x8e61('0x22')](_0x16c1dc[_0x8e61('0x3d')][_0x8e61('0x22')]);_0xe50907['offset']=qs[_0x8e61('0x20')](_0x16c1dc[_0x8e61('0x3d')][_0x8e61('0x20')]);}return _0x420467['getBlackLists'](_0xe50907);}})[_0x8e61('0x28')](function(_0x1d38a){if(_0x1d38a){return _0x1d38a?{'count':_0x58dc88,'rows':_0x1d38a}:null;}})['then'](respondWithResult(_0x4cc562,null))[_0x8e61('0x52')](handleError(_0x4cc562,null));};exports['addBlackLists']=function(_0x963a28,_0x18a052,_0x783100){var _0x5eaf32,_0x330812;return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x963a28[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x18a052,null))[_0x8e61('0x28')](function(_0x3f58fa){if(_0x3f58fa){_0x330812=_0x3f58fa;return _0x3f58fa[_0x8e61('0xba')](_0x963a28[_0x8e61('0x55')][_0x8e61('0x9c')],_[_0x8e61('0x60')](_0x963a28[_0x8e61('0x55')],[_0x8e61('0x9c'),'id'])||{});}return null;})[_0x8e61('0x9d')](function(_0x4c1c09){var _0x3ac813;_0x5eaf32=_0x4c1c09||[];var _0x5c95ab=[];if(_0x4c1c09){for(var _0x2cf64d=0x0;_0x2cf64d<_0x4c1c09[_0x8e61('0x44')];_0x2cf64d+=0x1){var _0x471fd3=_0x4c1c09[_0x2cf64d][_0x8e61('0x5f')]({'plain':!![]});_0x3ac813=squel['insert']()[_0x8e61('0xa6')](_0x8e61('0xbb'))[_0x8e61('0xb6')]([_0x8e61('0xa7'),_0x8e61('0xa9'),_0x8e61('0xad'),_0x8e61('0x68'),'createdAt',_0x8e61('0x62')],squel[_0x8e61('0x87')]()[_0x8e61('0xaa')](_0x8e61('0xa7'),_0x8e61('0xa7'))[_0x8e61('0xaa')]('id','ContactId')[_0x8e61('0xaa')](_0x471fd3[_0x8e61('0xac')][_0x8e61('0x91')](),_0x8e61('0xad'))['field'](_0x963a28['params']['id']['toString'](),_0x8e61('0x68'))[_0x8e61('0xaa')](_0x8e61('0xab'),'createdAt')[_0x8e61('0xaa')](_0x8e61('0xab'),_0x8e61('0x62'))[_0x8e61('0x89')](_0x8e61('0xae'))['where'](_0x8e61('0xaf'))[_0x8e61('0x49')]('ListId\x20=\x20?',_0x471fd3['CmListId'][_0x8e61('0x91')]())[_0x8e61('0x49')](_0x8e61('0xb1')))['toString']();_0x5c95ab[_0x8e61('0x90')](db[_0x8e61('0x79')]['query'](_0x3ac813));}return BPromise['all'](_0x5c95ab);}})[_0x8e61('0x28')](function(){return _0x5eaf32;})[_0x8e61('0x28')](respondWithResult(_0x18a052,null))[_0x8e61('0x52')](handleError(_0x18a052,null));};exports[_0x8e61('0xbc')]=function(_0x46e378,_0x53e66e,_0x43cb67){return db[_0x8e61('0x39')][_0x8e61('0x33')]({'where':{'id':_0x46e378[_0x8e61('0x5e')]['id']}})[_0x8e61('0x28')](handleEntityNotFound(_0x53e66e,null))[_0x8e61('0x28')](function(_0x64bf69){if(_0x64bf69){return _0x64bf69['removeBlackLists'](_0x46e378[_0x8e61('0x3d')][_0x8e61('0x9c')]);}})[_0x8e61('0x28')](function(_0x359846){if(_0x359846){return db[_0x8e61('0x6e')][_0x8e61('0x29')]({'where':{'ListId':_0x46e378[_0x8e61('0x3d')][_0x8e61('0x9c')],'VoiceQueueId':_0x46e378[_0x8e61('0x5e')]['id']}})['then'](function(){return _0x359846;});}})['then'](respondWithStatusCode(_0x53e66e,null))[_0x8e61('0x52')](handleError(_0x53e66e,null));};exports[_0x8e61('0xbd')]=function(_0x9a1b81,_0x423a29){var _0xaa0d37=[{'name':'Progressive','method':'progressive','enabled':0x1},{'name':_0x8e61('0xbe'),'method':_0x8e61('0xbf'),'enabled':0x1},{'name':_0x8e61('0xc0'),'method':_0x8e61('0xc1'),'enabled':0x1},{'name':_0x8e61('0xc2'),'method':_0x8e61('0xc3'),'enabled':0x1},{'name':'BookedProgressive','method':_0x8e61('0xc4'),'enabled':0x1}];return new BPromise(function(_0x2b9e7a,_0x494471){try{if(!_['isNil'](config[_0x8e61('0xc5')])){_0xaa0d37=config['dialerMethods'];}_0x2b9e7a(_0xaa0d37);}catch(_0x1bbd3e){_0x494471(_0x1bbd3e);}})[_0x8e61('0x28')](respondWithResult(_0x423a29))['catch'](handleError(_0x423a29,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6f5f5fb..ed969dd 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 _0xfc4b=['hook','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit'];(function(_0x250e97,_0x55ab11){var _0x356198=function(_0x75f430){while(--_0x75f430){_0x250e97['push'](_0x250e97['shift']());}};_0x356198(++_0x55ab11);}(_0xfc4b,0x1e1));var _0xbfc4=function(_0x2184f0,_0x16fc78){_0x2184f0=_0x2184f0-0x0;var _0x724667=_0xfc4b[_0x2184f0];return _0x724667;};'use strict';var EventEmitter=require(_0xbfc4('0x0'));var VoiceQueue=require(_0xbfc4('0x1'))['db'][_0xbfc4('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbfc4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbfc4('0x4'),'afterDestroy':_0xbfc4('0x5')};function emitEvent(_0x1266ad){return function(_0x55a700,_0x11fdf8,_0x1631f0){VoiceQueueEvents[_0xbfc4('0x6')](_0x1266ad+':'+_0x55a700['id'],_0x55a700);VoiceQueueEvents[_0xbfc4('0x6')](_0x1266ad,_0x55a700);_0x1631f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xbfc4('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xa61c=['save','update','remove','emit','hook','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0xa61c,0x11c));var _0xca61=function(_0x54af73,_0x4fa7f7){_0x54af73=_0x54af73-0x0;var _0x35913b=_0xa61c[_0x54af73];return _0x35913b;};'use strict';var EventEmitter=require(_0xca61('0x0'));var VoiceQueue=require(_0xca61('0x1'))['db'][_0xca61('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xca61('0x3')](0x0);var events={'afterCreate':_0xca61('0x4'),'afterUpdate':_0xca61('0x5'),'afterDestroy':_0xca61('0x6')};function emitEvent(_0x1b3854){return function(_0x8edd96,_0x31fa4,_0x2bb869){VoiceQueueEvents[_0xca61('0x7')](_0x1b3854+':'+_0x8edd96['id'],_0x8edd96);VoiceQueueEvents[_0xca61('0x7')](_0x1b3854,_0x8edd96);_0x2bb869(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xca61('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0317bb3..3fffe9c 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x24b33c,_0x33cb97){var _0x33becf=function(_0x4d8a9c){while(--_0x4d8a9c){_0x24b33c['push'](_0x24b33c['shift']());}};_0x33becf(++_0x33cb97);}(_0x3e74,0x175));var _0x43e7=function(_0x5489ac,_0x218e05){_0x5489ac=_0x5489ac-0x0;var _0x2e4c89=_0x3e74[_0x5489ac];return _0x2e4c89;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0x70e0,0x17b));var _0x070e=function(_0xf5887d,_0x513ea1){_0xf5887d=_0xf5887d-0x0;var _0x228d31=_0x70e0[_0xf5887d];return _0x228d31;};'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 b8c2176..53c7629 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 _0x5823=['error','code','message','info','result','catch','GetVoiceQueue','findAll','options','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','VoiceQueue','find','raw','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x5823,0x1d7));var _0x3582=function(_0x452fb9,_0x305546){_0x452fb9=_0x452fb9-0x0;var _0x228d1b=_0x5823[_0x452fb9];return _0x228d1b;};'use strict';var _=require(_0x3582('0x0'));var util=require(_0x3582('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3582('0x2'));var db=require(_0x3582('0x3'))['db'];var utils=require(_0x3582('0x4'));var logger=require(_0x3582('0x5'))(_0x3582('0x6'));var config=require(_0x3582('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3582('0x8')][_0x3582('0x9')]({'port':0x232a});config[_0x3582('0xa')]=_[_0x3582('0xb')](config[_0x3582('0xa')],{'host':_0x3582('0xc'),'port':0x18eb});var socket=require(_0x3582('0xd'))(new Redis(config[_0x3582('0xa')]));require(_0x3582('0xe'))['register'](socket);function respondWithRpcPromise(_0x86ca88,_0x43cd3d,_0x2ccb40){return new BPromise(function(_0x8bc2fb,_0x3ab0b5){return client[_0x3582('0xf')](_0x86ca88,_0x2ccb40)[_0x3582('0x10')](function(_0xc4920c){logger['info'](_0x3582('0x11'),_0x43cd3d,_0x3582('0x12'));logger['debug'](_0x3582('0x13'),_0x43cd3d,'request\x20sent',JSON[_0x3582('0x14')](_0xc4920c));if(_0xc4920c[_0x3582('0x15')]){if(_0xc4920c['error'][_0x3582('0x16')]===0x1f4){logger[_0x3582('0x15')](_0x3582('0x11'),_0x43cd3d,_0xc4920c[_0x3582('0x15')][_0x3582('0x17')]);return _0x3ab0b5(_0xc4920c[_0x3582('0x15')][_0x3582('0x17')]);}logger[_0x3582('0x15')](_0x3582('0x11'),_0x43cd3d,_0xc4920c[_0x3582('0x15')]['message']);return _0x8bc2fb(_0xc4920c['error'][_0x3582('0x17')]);}else{logger[_0x3582('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x43cd3d,_0x3582('0x12'));_0x8bc2fb(_0xc4920c[_0x3582('0x19')][_0x3582('0x17')]);}})[_0x3582('0x1a')](function(_0x31f224){logger['error'](_0x3582('0x11'),_0x43cd3d,_0x31f224);_0x3ab0b5(_0x31f224);});});}exports[_0x3582('0x1b')]=function(_0x13e78a){var _0x34ec9a=this;return new Promise(function(_0x47f684,_0x1046c7){return db['VoiceQueue'][_0x3582('0x1c')]({'raw':_0x13e78a['options']?_0x13e78a[_0x3582('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x13e78a[_0x3582('0x1d')]?_0x13e78a[_0x3582('0x1d')][_0x3582('0x1e')]||null:null,'attributes':_0x13e78a[_0x3582('0x1d')]?_0x13e78a[_0x3582('0x1d')][_0x3582('0x1f')]||null:null,'limit':_0x13e78a[_0x3582('0x1d')]?_0x13e78a[_0x3582('0x1d')][_0x3582('0x20')]||null:null,'include':_0x13e78a[_0x3582('0x1d')]?_0x13e78a[_0x3582('0x1d')][_0x3582('0x21')]?_[_0x3582('0x22')](_0x13e78a[_0x3582('0x1d')][_0x3582('0x21')],function(_0x6fb7a9){return{'model':db[_0x6fb7a9[_0x3582('0x23')]],'as':_0x6fb7a9['as'],'attributes':_0x6fb7a9['attributes'],'include':_0x6fb7a9[_0x3582('0x21')]?_[_0x3582('0x22')](_0x6fb7a9[_0x3582('0x21')],function(_0x56246f){return{'model':db[_0x56246f[_0x3582('0x23')]],'as':_0x56246f['as'],'attributes':_0x56246f[_0x3582('0x1f')],'include':_0x56246f[_0x3582('0x21')]?_['map'](_0x56246f['include'],function(_0x27b899){return{'model':db[_0x27b899[_0x3582('0x23')]],'as':_0x27b899['as'],'attributes':_0x27b899[_0x3582('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc8170){logger[_0x3582('0x18')](_0x3582('0x1b'),_0x13e78a);logger[_0x3582('0x24')]('GetVoiceQueue',_0x13e78a,JSON[_0x3582('0x14')](_0xbc8170));_0x47f684(_0xbc8170);})[_0x3582('0x1a')](function(_0x1061f7){logger[_0x3582('0x15')](_0x3582('0x1b'),_0x1061f7[_0x3582('0x17')],_0x13e78a);_0x1046c7(_0x34ec9a[_0x3582('0x15')](0x1f4,_0x1061f7[_0x3582('0x17')]));});});};exports[_0x3582('0x25')]=function(_0x37907f){var _0x2c46c6=this;return new Promise(function(_0x2996c1,_0x188349){return db[_0x3582('0x26')][_0x3582('0x27')]({'raw':_0x37907f[_0x3582('0x1d')]?_0x37907f[_0x3582('0x1d')][_0x3582('0x28')]===undefined?!![]:![]:!![],'where':_0x37907f[_0x3582('0x1d')]?_0x37907f[_0x3582('0x1d')][_0x3582('0x1e')]||null:null,'attributes':_0x37907f[_0x3582('0x1d')]?_0x37907f[_0x3582('0x1d')][_0x3582('0x1f')]||null:null,'include':_0x37907f['options']?_0x37907f['options'][_0x3582('0x21')]?_[_0x3582('0x22')](_0x37907f[_0x3582('0x1d')]['include'],function(_0x37e742){return{'model':db[_0x37e742['model']],'as':_0x37e742['as'],'attributes':_0x37e742[_0x3582('0x1f')],'include':_0x37e742['include']?_[_0x3582('0x22')](_0x37e742['include'],function(_0x15c08f){return{'model':db[_0x15c08f[_0x3582('0x23')]],'as':_0x15c08f['as'],'attributes':_0x15c08f['attributes'],'include':_0x15c08f[_0x3582('0x21')]?_['map'](_0x15c08f[_0x3582('0x21')],function(_0x12f994){return{'model':db[_0x12f994[_0x3582('0x23')]],'as':_0x12f994['as'],'attributes':_0x12f994[_0x3582('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3582('0x10')](function(_0x302191){logger[_0x3582('0x18')](_0x3582('0x25'),_0x37907f);logger[_0x3582('0x24')](_0x3582('0x25'),_0x37907f,JSON[_0x3582('0x14')](_0x302191));_0x2996c1(_0x302191);})[_0x3582('0x1a')](function(_0x5be13f){logger[_0x3582('0x15')](_0x3582('0x25'),_0x5be13f[_0x3582('0x17')],_0x37907f);_0x188349(_0x2c46c6[_0x3582('0x15')](0x1f4,_0x5be13f[_0x3582('0x17')]));});});}; \ No newline at end of file +var _0x6420=['map','stringify','ShowVoiceQueue','find','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','message','error','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x1d04b5,_0x30792c){var _0x161342=function(_0x94ff92){while(--_0x94ff92){_0x1d04b5['push'](_0x1d04b5['shift']());}};_0x161342(++_0x30792c);}(_0x6420,0x176));var _0x0642=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6420[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x0642('0x0'));var util=require(_0x0642('0x1'));var moment=require(_0x0642('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0642('0x3'));var db=require(_0x0642('0x4'))['db'];var utils=require(_0x0642('0x5'));var logger=require('../../config/logger')(_0x0642('0x6'));var config=require(_0x0642('0x7'));var jayson=require(_0x0642('0x8'));var client=jayson[_0x0642('0x9')][_0x0642('0xa')]({'port':0x232a});config['redis']=_[_0x0642('0xb')](config[_0x0642('0xc')],{'host':_0x0642('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0642('0xc')]));require(_0x0642('0xe'))[_0x0642('0xf')](socket);function respondWithRpcPromise(_0x924fdc,_0x4fdfe0,_0x409a3d){return new BPromise(function(_0x5a2e6b,_0x20fd43){return client[_0x0642('0x10')](_0x924fdc,_0x409a3d)[_0x0642('0x11')](function(_0x10895f){logger['info'](_0x0642('0x12'),_0x4fdfe0,_0x0642('0x13'));logger[_0x0642('0x14')](_0x0642('0x15'),_0x4fdfe0,_0x0642('0x13'),JSON['stringify'](_0x10895f));if(_0x10895f['error']){if(_0x10895f['error']['code']===0x1f4){logger['error'](_0x0642('0x12'),_0x4fdfe0,_0x10895f['error'][_0x0642('0x16')]);return _0x20fd43(_0x10895f[_0x0642('0x17')][_0x0642('0x16')]);}logger[_0x0642('0x17')](_0x0642('0x12'),_0x4fdfe0,_0x10895f['error'][_0x0642('0x16')]);return _0x5a2e6b(_0x10895f[_0x0642('0x17')][_0x0642('0x16')]);}else{logger[_0x0642('0x18')](_0x0642('0x12'),_0x4fdfe0,'request\x20sent');_0x5a2e6b(_0x10895f[_0x0642('0x19')][_0x0642('0x16')]);}})[_0x0642('0x1a')](function(_0x486b3c){logger[_0x0642('0x17')](_0x0642('0x12'),_0x4fdfe0,_0x486b3c);_0x20fd43(_0x486b3c);});});}exports[_0x0642('0x1b')]=function(_0x1fc4b6){var _0x33ca9c=this;return new Promise(function(_0x356ead,_0x3f6de4){return db[_0x0642('0x1c')][_0x0642('0x1d')]({'raw':_0x1fc4b6[_0x0642('0x1e')]?_0x1fc4b6['options'][_0x0642('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fc4b6[_0x0642('0x1e')]?_0x1fc4b6['options'][_0x0642('0x20')]||null:null,'attributes':_0x1fc4b6[_0x0642('0x1e')]?_0x1fc4b6['options'][_0x0642('0x21')]||null:null,'limit':_0x1fc4b6[_0x0642('0x1e')]?_0x1fc4b6[_0x0642('0x1e')][_0x0642('0x22')]||null:null,'include':_0x1fc4b6['options']?_0x1fc4b6['options'][_0x0642('0x23')]?_[_0x0642('0x24')](_0x1fc4b6[_0x0642('0x1e')][_0x0642('0x23')],function(_0x5dddde){return{'model':db[_0x5dddde['model']],'as':_0x5dddde['as'],'attributes':_0x5dddde[_0x0642('0x21')],'include':_0x5dddde[_0x0642('0x23')]?_[_0x0642('0x24')](_0x5dddde[_0x0642('0x23')],function(_0x54f223){return{'model':db[_0x54f223['model']],'as':_0x54f223['as'],'attributes':_0x54f223[_0x0642('0x21')],'include':_0x54f223['include']?_['map'](_0x54f223[_0x0642('0x23')],function(_0x429d30){return{'model':db[_0x429d30['model']],'as':_0x429d30['as'],'attributes':_0x429d30[_0x0642('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0642('0x11')](function(_0x350c92){logger[_0x0642('0x18')](_0x0642('0x1b'),_0x1fc4b6);logger[_0x0642('0x14')](_0x0642('0x1b'),_0x1fc4b6,JSON[_0x0642('0x25')](_0x350c92));_0x356ead(_0x350c92);})[_0x0642('0x1a')](function(_0xbad916){logger[_0x0642('0x17')](_0x0642('0x1b'),_0xbad916[_0x0642('0x16')],_0x1fc4b6);_0x3f6de4(_0x33ca9c['error'](0x1f4,_0xbad916[_0x0642('0x16')]));});});};exports[_0x0642('0x26')]=function(_0x176cbd){var _0x3f6f63=this;return new Promise(function(_0x12b4c3,_0x215017){return db[_0x0642('0x1c')][_0x0642('0x27')]({'raw':_0x176cbd['options']?_0x176cbd[_0x0642('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x176cbd[_0x0642('0x1e')]?_0x176cbd[_0x0642('0x1e')][_0x0642('0x20')]||null:null,'attributes':_0x176cbd[_0x0642('0x1e')]?_0x176cbd[_0x0642('0x1e')]['attributes']||null:null,'include':_0x176cbd[_0x0642('0x1e')]?_0x176cbd[_0x0642('0x1e')][_0x0642('0x23')]?_[_0x0642('0x24')](_0x176cbd[_0x0642('0x1e')][_0x0642('0x23')],function(_0x52918f){return{'model':db[_0x52918f['model']],'as':_0x52918f['as'],'attributes':_0x52918f['attributes'],'include':_0x52918f[_0x0642('0x23')]?_[_0x0642('0x24')](_0x52918f[_0x0642('0x23')],function(_0x59e7a7){return{'model':db[_0x59e7a7[_0x0642('0x28')]],'as':_0x59e7a7['as'],'attributes':_0x59e7a7[_0x0642('0x21')],'include':_0x59e7a7[_0x0642('0x23')]?_[_0x0642('0x24')](_0x59e7a7['include'],function(_0x287148){return{'model':db[_0x287148['model']],'as':_0x287148['as'],'attributes':_0x287148[_0x0642('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0642('0x11')](function(_0x5dcec8){logger[_0x0642('0x18')](_0x0642('0x26'),_0x176cbd);logger[_0x0642('0x14')](_0x0642('0x26'),_0x176cbd,JSON['stringify'](_0x5dcec8));_0x12b4c3(_0x5dcec8);})[_0x0642('0x1a')](function(_0x241b3b){logger[_0x0642('0x17')]('ShowVoiceQueue',_0x241b3b[_0x0642('0x16')],_0x176cbd);_0x215017(_0x3f6f63['error'](0x1f4,_0x241b3b[_0x0642('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4452f79..83e2c72 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 _0x116d=['voiceQueue:','./voiceQueue.events','save','remove','length'];(function(_0x52a8ef,_0x47ec0d){var _0x5be63d=function(_0xa9493){while(--_0xa9493){_0x52a8ef['push'](_0x52a8ef['shift']());}};_0x5be63d(++_0x47ec0d);}(_0x116d,0x15f));var _0xd116=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x116d[_0x160c73];return _0xd9302;};'use strict';var VoiceQueueEvents=require(_0xd116('0x0'));var events=[_0xd116('0x1'),_0xd116('0x2'),'update'];function createListener(_0x2fc93a,_0x565afe){return function(_0x3ddfe0){_0x565afe['emit'](_0x2fc93a,_0x3ddfe0);};}function removeListener(_0xc7657a,_0x21795d){return function(){VoiceQueueEvents['removeListener'](_0xc7657a,_0x21795d);};}exports['register']=function(_0x1edffa){for(var _0x5708d2=0x0,_0x148753=events[_0xd116('0x3')];_0x5708d2<_0x148753;_0x5708d2++){var _0xff8283=events[_0x5708d2];var _0x233d46=createListener(_0xd116('0x4')+_0xff8283,_0x1edffa);VoiceQueueEvents['on'](_0xff8283,_0x233d46);}}; \ No newline at end of file +var _0xc8d9=['./voiceQueue.events','remove','update','removeListener','register','voiceQueue:'];(function(_0x2755d9,_0x25facc){var _0x109d5b=function(_0x51f8ac){while(--_0x51f8ac){_0x2755d9['push'](_0x2755d9['shift']());}};_0x109d5b(++_0x25facc);}(_0xc8d9,0x180));var _0x9c8d=function(_0x31bd8b,_0x56fa02){_0x31bd8b=_0x31bd8b-0x0;var _0x1506e4=_0xc8d9[_0x31bd8b];return _0x1506e4;};'use strict';var VoiceQueueEvents=require(_0x9c8d('0x0'));var events=['save',_0x9c8d('0x1'),_0x9c8d('0x2')];function createListener(_0x8746ce,_0x2ef4e5){return function(_0x26db74){_0x2ef4e5['emit'](_0x8746ce,_0x26db74);};}function removeListener(_0x5b4faa,_0x1fcc0b){return function(){VoiceQueueEvents[_0x9c8d('0x3')](_0x5b4faa,_0x1fcc0b);};}exports[_0x9c8d('0x4')]=function(_0x475093){for(var _0x302895=0x0,_0x32275b=events['length'];_0x302895<_0x32275b;_0x302895++){var _0x213608=events[_0x302895];var _0x54e06d=createListener(_0x9c8d('0x5')+_0x213608,_0x475093);VoiceQueueEvents['on'](_0x213608,_0x54e06d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7da883f..f7890be 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 _0x7a51=['/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x2c23fe,_0x2c21b0){var _0x3cdf74=function(_0x1e0302){while(--_0x1e0302){_0x2c23fe['push'](_0x2c23fe['shift']());}};_0x3cdf74(++_0x2c21b0);}(_0x7a51,0xc3));var _0x17a5=function(_0x2ea8b2,_0x49ff24){_0x2ea8b2=_0x2ea8b2-0x0;var _0x315db5=_0x7a51[_0x2ea8b2];return _0x315db5;};'use strict';var multer=require(_0x17a5('0x0'));var util=require(_0x17a5('0x1'));var path=require('path');var timeout=require(_0x17a5('0x2'));var express=require(_0x17a5('0x3'));var router=express[_0x17a5('0x4')]();var fs_extra=require(_0x17a5('0x5'));var auth=require(_0x17a5('0x6'));var interaction=require(_0x17a5('0x7'));var config=require('../../config/environment');var controller=require(_0x17a5('0x8'));router[_0x17a5('0x9')]('/',auth[_0x17a5('0xa')](),controller[_0x17a5('0xb')]);router['get'](_0x17a5('0xc'),auth[_0x17a5('0xa')](),controller[_0x17a5('0xd')]);router['get'](_0x17a5('0xe'),auth['isAuthenticated'](),controller[_0x17a5('0xf')]);router[_0x17a5('0x9')](_0x17a5('0x10'),auth[_0x17a5('0xa')](),controller[_0x17a5('0x11')]);router[_0x17a5('0x12')]('/',auth['isAuthenticated'](),controller[_0x17a5('0x13')]);router[_0x17a5('0x14')]('/:id',auth[_0x17a5('0xa')](),controller['update']);router['delete'](_0x17a5('0x10'),auth[_0x17a5('0xa')](),controller[_0x17a5('0x15')]);module[_0x17a5('0x16')]=router; \ No newline at end of file +var _0x60d6=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','getVoiceQueuesReport','/:id','show','post','create'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x60d6,0x123));var _0x660d=function(_0x162d72,_0x3d4947){_0x162d72=_0x162d72-0x0;var _0xb997c4=_0x60d6[_0x162d72];return _0xb997c4;};'use strict';var multer=require(_0x660d('0x0'));var util=require(_0x660d('0x1'));var path=require('path');var timeout=require(_0x660d('0x2'));var express=require(_0x660d('0x3'));var router=express['Router']();var fs_extra=require(_0x660d('0x4'));var auth=require(_0x660d('0x5'));var interaction=require(_0x660d('0x6'));var config=require('../../config/environment');var controller=require(_0x660d('0x7'));router[_0x660d('0x8')]('/',auth[_0x660d('0x9')](),controller[_0x660d('0xa')]);router[_0x660d('0x8')](_0x660d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x660d('0x8')]('/index',auth[_0x660d('0x9')](),controller[_0x660d('0xc')]);router[_0x660d('0x8')](_0x660d('0xd'),auth['isAuthenticated'](),controller[_0x660d('0xe')]);router[_0x660d('0xf')]('/',auth[_0x660d('0x9')](),controller[_0x660d('0x10')]);router[_0x660d('0x11')](_0x660d('0xd'),auth['isAuthenticated'](),controller[_0x660d('0x12')]);router[_0x660d('0x13')]('/:id',auth[_0x660d('0x9')](),controller[_0x660d('0x14')]);module[_0x660d('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 16bacb8..5a00b1d 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 _0x5f8a=['DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5f8a,0xde));var _0xa5f8=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0x5f8a[_0x4eb6ec];return _0x58881b;};'use strict';var Sequelize=require(_0xa5f8('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa5f8('0x1')]},'calleridnum':{'type':Sequelize[_0xa5f8('0x1')]},'calleridname':{'type':Sequelize[_0xa5f8('0x1')]},'queue':{'type':Sequelize[_0xa5f8('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xa5f8('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3db2d0){var _0x9663a9=moment(_0x3db2d0);var _0x78724e=moment(this[_0xa5f8('0x3')](_0xa5f8('0x4')))[_0xa5f8('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5a1bec=_0x9663a9[_0xa5f8('0x6')](_0x78724e,_0xa5f8('0x7'));this[_0xa5f8('0x8')]('queuecallerleaveAt',_0x3db2d0);this['setDataValue'](_0xa5f8('0x9'),_0x5a1bec||null);}},'position':{'type':Sequelize[_0xa5f8('0xa')]},'count':{'type':Sequelize[_0xa5f8('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xa5f8('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa5f8('0x2')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa5f8('0x2')]},'queuecallerexit':{'type':Sequelize[_0xa5f8('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa5f8('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xa5f8('0xc')},'originalposition':{'type':Sequelize[_0xa5f8('0xa')]},'channel':{'type':Sequelize[_0xa5f8('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa5f8('0x1')]},'connectedlinename':{'type':Sequelize[_0xa5f8('0x1')]},'accountcode':{'type':Sequelize[_0xa5f8('0x1')]},'context':{'type':Sequelize[_0xa5f8('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa5f8('0x1')]},'holdtime':{'type':Sequelize[_0xa5f8('0xa')]},'mohtime':{'type':Sequelize[_0xa5f8('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa5f8('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa5f8('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xa5f8('0xd')},'transferexten':{'type':Sequelize[_0xa5f8('0x1')]},'transferuniqueid':{'type':Sequelize[_0xa5f8('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa5f8('0x1')]},'thirdDisposition':{'type':Sequelize[_0xa5f8('0x1')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xde5c=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','queuecallerjoinAt','format','seconds'];(function(_0xac81eb,_0x594174){var _0x324494=function(_0x306c07){while(--_0x306c07){_0xac81eb['push'](_0xac81eb['shift']());}};_0x324494(++_0x594174);}(_0xde5c,0x155));var _0xcde5=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0xde5c[_0x3dfeb9];return _0x412314;};'use strict';var Sequelize=require(_0xcde5('0x0'));var moment=require(_0xcde5('0x1'));module['exports']={'type':{'type':Sequelize[_0xcde5('0x2')]},'uniqueid':{'type':Sequelize[_0xcde5('0x2')]},'calleridnum':{'type':Sequelize[_0xcde5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xcde5('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xcde5('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xcde5('0x3')],'set':function(_0x320090){var _0xe0e2f6=moment(_0x320090);var _0x5f0a76=moment(this['getDataValue'](_0xcde5('0x4')))[_0xcde5('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2ef886=_0xe0e2f6['diff'](_0x5f0a76,_0xcde5('0x6'));this['setDataValue'](_0xcde5('0x7'),_0x320090);this['setDataValue'](_0xcde5('0x8'),_0x2ef886||null);}},'position':{'type':Sequelize[_0xcde5('0x9')]},'count':{'type':Sequelize[_0xcde5('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xcde5('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xcde5('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xcde5('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xcde5('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xcde5('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xcde5('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xcde5('0x2')]},'connectedlinename':{'type':Sequelize[_0xcde5('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcde5('0x2')]},'exten':{'type':Sequelize[_0xcde5('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xcde5('0x9')]},'mohtime':{'type':Sequelize[_0xcde5('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcde5('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcde5('0x2')]},'transfer':{'type':Sequelize[_0xcde5('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcde5('0x2')],'comment':_0xcde5('0xb')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xcde5('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcde5('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xcde5('0x9')],'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 e23f9c7..0c3520f 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 _0x0d9a=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','getVoiceQueuesReport','nolimit','findAll','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0d9a,0xdf));var _0xa0d9=function(_0xc1124c,_0x13deb8){_0xc1124c=_0xc1124c-0x0;var _0x598783=_0x0d9a[_0xc1124c];return _0x598783;};'use strict';var emlformat=require(_0xa0d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa0d9('0x1'));var rp=require(_0xa0d9('0x2'));var moment=require(_0xa0d9('0x3'));var BPromise=require(_0xa0d9('0x4'));var Mustache=require(_0xa0d9('0x5'));var util=require(_0xa0d9('0x6'));var path=require(_0xa0d9('0x7'));var sox=require('sox');var csv=require(_0xa0d9('0x8'));var ejs=require(_0xa0d9('0x9'));var fs=require('fs');var fs_extra=require(_0xa0d9('0xa'));var _=require(_0xa0d9('0xb'));var squel=require('squel');var crypto=require(_0xa0d9('0xc'));var jsforce=require(_0xa0d9('0xd'));var deskjs=require(_0xa0d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa0d9('0xf'));var Papa=require(_0xa0d9('0x10'));var Redis=require(_0xa0d9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa0d9('0x12'));var as=require(_0xa0d9('0x13'));var hardwareService=require(_0xa0d9('0x14'));var logger=require(_0xa0d9('0x15'))(_0xa0d9('0x16'));var utils=require('../../config/utils');var config=require(_0xa0d9('0x17'));var licenseUtil=require(_0xa0d9('0x18'));var db=require(_0xa0d9('0x19'))['db'];config['redis']=_[_0xa0d9('0x1a')](config[_0xa0d9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0d9('0x1c'))(new Redis(config[_0xa0d9('0x1b')]));require(_0xa0d9('0x1d'))[_0xa0d9('0x1e')](socket);function respondWithStatusCode(_0x34c6c6,_0x2a95be){_0x2a95be=_0x2a95be||0xcc;return function(_0x269785){if(_0x269785){return _0x34c6c6[_0xa0d9('0x1f')](_0x2a95be);}return _0x34c6c6[_0xa0d9('0x20')](_0x2a95be)[_0xa0d9('0x21')]();};}function respondWithResult(_0x4a22a9,_0x5e8756){_0x5e8756=_0x5e8756||0xc8;return function(_0x22b580){if(_0x22b580){return _0x4a22a9[_0xa0d9('0x20')](_0x5e8756)[_0xa0d9('0x22')](_0x22b580);}};}function respondWithFilteredResult(_0x1588e3,_0x272809){return function(_0x3a0d63){if(_0x3a0d63){var _0x531682=typeof _0x272809['offset']===_0xa0d9('0x23')&&typeof _0x272809[_0xa0d9('0x24')]===_0xa0d9('0x23');var _0x13c579=_0x3a0d63[_0xa0d9('0x25')];var _0x588556=_0x531682?0x0:_0x272809['offset'];var _0x51b467=_0x531682?_0x3a0d63[_0xa0d9('0x25')]:_0x272809[_0xa0d9('0x26')]+_0x272809[_0xa0d9('0x24')];var _0x684860;if(_0x51b467>=_0x13c579){_0x51b467=_0x13c579;_0x684860=0xc8;}else{_0x684860=0xce;}_0x1588e3[_0xa0d9('0x20')](_0x684860);return _0x1588e3[_0xa0d9('0x27')](_0xa0d9('0x28'),_0x588556+'-'+_0x51b467+'/'+_0x13c579)[_0xa0d9('0x22')](_0x3a0d63);}return null;};}function patchUpdates(_0x570acf){return function(_0x379143){try{jsonpatch[_0xa0d9('0x29')](_0x379143,_0x570acf,!![]);}catch(_0x3d12b6){return BPromise[_0xa0d9('0x2a')](_0x3d12b6);}return _0x379143[_0xa0d9('0x2b')]();};}function saveUpdates(_0x591909,_0x1fe6ee){return function(_0x55ac49){if(_0x55ac49){return _0x55ac49[_0xa0d9('0x2c')](_0x591909)[_0xa0d9('0x2d')](function(_0x3ae3ff){return _0x3ae3ff;});}return null;};}function removeEntity(_0x593665,_0x566690){return function(_0x3a2f38){if(_0x3a2f38){return _0x3a2f38['destroy']()[_0xa0d9('0x2d')](function(){_0x593665[_0xa0d9('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420fe8,_0x149456){return function(_0x2a2f13){if(!_0x2a2f13){_0x420fe8[_0xa0d9('0x1f')](0x194);}return _0x2a2f13;};}function handleError(_0x334ae7,_0x17078c){_0x17078c=_0x17078c||0x1f4;return function(_0x4671cd){logger[_0xa0d9('0x2e')](_0x4671cd[_0xa0d9('0x2f')]);if(_0x4671cd['name']){delete _0x4671cd[_0xa0d9('0x30')];}_0x334ae7[_0xa0d9('0x20')](_0x17078c)[_0xa0d9('0x31')](_0x4671cd);};}exports[_0xa0d9('0x32')]=function(_0x521878,_0x5adb5c){var _0x4ef7a7={},_0xa8d028={},_0x4d0dff={'count':0x0,'rows':[]};var _0x3ffff0=_[_0xa0d9('0x33')](db[_0xa0d9('0x34')][_0xa0d9('0x35')],function(_0x18a5b4){return{'name':_0x18a5b4[_0xa0d9('0x36')],'type':_0x18a5b4[_0xa0d9('0x37')][_0xa0d9('0x38')]};});_0xa8d028[_0xa0d9('0x39')]=_[_0xa0d9('0x33')](_0x3ffff0,'name');_0xa8d028[_0xa0d9('0x3a')]=_[_0xa0d9('0x3b')](_0x521878['query']);_0xa8d028[_0xa0d9('0x3c')]=_[_0xa0d9('0x3d')](_0xa8d028[_0xa0d9('0x39')],_0xa8d028['query']);_0x4ef7a7[_0xa0d9('0x3e')]=_[_0xa0d9('0x3d')](_0xa8d028[_0xa0d9('0x39')],qs[_0xa0d9('0x3f')](_0x521878['query'][_0xa0d9('0x3f')]));_0x4ef7a7['attributes']=_0x4ef7a7[_0xa0d9('0x3e')][_0xa0d9('0x40')]?_0x4ef7a7['attributes']:_0xa8d028[_0xa0d9('0x39')];if(!_0x521878['query'][_0xa0d9('0x41')]('nolimit')){_0x4ef7a7['limit']=qs[_0xa0d9('0x24')](_0x521878[_0xa0d9('0x3a')][_0xa0d9('0x24')]);_0x4ef7a7[_0xa0d9('0x26')]=qs[_0xa0d9('0x26')](_0x521878['query'][_0xa0d9('0x26')]);}_0x4ef7a7[_0xa0d9('0x42')]=qs[_0xa0d9('0x43')](_0x521878['query'][_0xa0d9('0x43')]);_0x4ef7a7[_0xa0d9('0x44')]=qs[_0xa0d9('0x3c')](_[_0xa0d9('0x45')](_0x521878[_0xa0d9('0x3a')],_0xa8d028[_0xa0d9('0x3c')]),_0x3ffff0);if(_0x521878[_0xa0d9('0x3a')][_0xa0d9('0x46')]){_0x4ef7a7['where']=_[_0xa0d9('0x47')](_0x4ef7a7[_0xa0d9('0x44')],{'$or':_[_0xa0d9('0x33')](_0x3ffff0,function(_0x4c50c0){if(_0x4c50c0[_0xa0d9('0x37')]!==_0xa0d9('0x48')){var _0x3958a4={};_0x3958a4[_0x4c50c0[_0xa0d9('0x30')]]={'$like':'%'+_0x521878[_0xa0d9('0x3a')][_0xa0d9('0x46')]+'%'};return _0x3958a4;}})});}_0x4ef7a7=_[_0xa0d9('0x47')]({},_0x4ef7a7,_0x521878[_0xa0d9('0x49')]);var _0x178e25={'where':_0x4ef7a7['where']};return db['VoiceQueueReport'][_0xa0d9('0x25')](_0x178e25)[_0xa0d9('0x2d')](function(_0x4bad41){_0x4d0dff['count']=_0x4bad41;if(_0x521878[_0xa0d9('0x3a')][_0xa0d9('0x4a')]){_0x4ef7a7[_0xa0d9('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4ef7a7);})[_0xa0d9('0x2d')](function(_0x2a25c6){_0x4d0dff['rows']=_0x2a25c6;return _0x4d0dff;})[_0xa0d9('0x2d')](respondWithFilteredResult(_0x5adb5c,_0x4ef7a7))[_0xa0d9('0x4c')](handleError(_0x5adb5c,null));};exports[_0xa0d9('0x4d')]=function(_0x125369,_0x2579a5){var _0xd5978d={'raw':![],'where':{'id':_0x125369[_0xa0d9('0x4e')]['id']}},_0x38c95f={};_0x38c95f[_0xa0d9('0x39')]=_[_0xa0d9('0x3b')](db['VoiceQueueReport'][_0xa0d9('0x35')]);_0x38c95f['query']=_['keys'](_0x125369['query']);_0x38c95f['filters']=_[_0xa0d9('0x3d')](_0x38c95f[_0xa0d9('0x39')],_0x38c95f[_0xa0d9('0x3a')]);_0xd5978d[_0xa0d9('0x3e')]=_[_0xa0d9('0x3d')](_0x38c95f[_0xa0d9('0x39')],qs[_0xa0d9('0x3f')](_0x125369[_0xa0d9('0x3a')][_0xa0d9('0x3f')]));_0xd5978d[_0xa0d9('0x3e')]=_0xd5978d[_0xa0d9('0x3e')]['length']?_0xd5978d['attributes']:_0x38c95f[_0xa0d9('0x39')];if(_0x125369[_0xa0d9('0x3a')]['includeAll']){_0xd5978d['include']=[{'all':!![]}];}_0xd5978d=_[_0xa0d9('0x47')]({},_0xd5978d,_0x125369['options']);return db[_0xa0d9('0x34')][_0xa0d9('0x4f')](_0xd5978d)[_0xa0d9('0x2d')](handleEntityNotFound(_0x2579a5,null))[_0xa0d9('0x2d')](respondWithResult(_0x2579a5,null))[_0xa0d9('0x4c')](handleError(_0x2579a5,null));};exports[_0xa0d9('0x50')]=function(_0x264c77,_0x3efc3c){return db[_0xa0d9('0x34')][_0xa0d9('0x50')](_0x264c77[_0xa0d9('0x51')],{})['then'](respondWithResult(_0x3efc3c,0xc9))[_0xa0d9('0x4c')](handleError(_0x3efc3c,null));};exports['update']=function(_0x5317c9,_0x124bf2){if(_0x5317c9['body']['id']){delete _0x5317c9['body']['id'];}return db['VoiceQueueReport'][_0xa0d9('0x4f')]({'where':{'id':_0x5317c9[_0xa0d9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x124bf2,null))[_0xa0d9('0x2d')](saveUpdates(_0x5317c9['body'],null))[_0xa0d9('0x2d')](respondWithResult(_0x124bf2,null))['catch'](handleError(_0x124bf2,null));};exports['destroy']=function(_0x309b8e,_0x487a65){return db[_0xa0d9('0x34')][_0xa0d9('0x4f')]({'where':{'id':_0x309b8e[_0xa0d9('0x4e')]['id']}})[_0xa0d9('0x2d')](handleEntityNotFound(_0x487a65,null))[_0xa0d9('0x2d')](removeEntity(_0x487a65,null))[_0xa0d9('0x4c')](handleError(_0x487a65,null));};exports[_0xa0d9('0x52')]=function(_0x354005,_0x2d1b5e){return db[_0xa0d9('0x34')][_0xa0d9('0x52')]()['then'](respondWithResult(_0x2d1b5e,null))[_0xa0d9('0x4c')](handleError(_0x2d1b5e,null));};exports[_0xa0d9('0x53')]=function(_0x1dbbed,_0x3e4973){var _0x258dfe={},_0x28f8a2={},_0x182115={'count':0x0,'rows':[]};_0x28f8a2[_0xa0d9('0x39')]=_[_0xa0d9('0x3b')](db[_0xa0d9('0x34')][_0xa0d9('0x35')]);_0x28f8a2[_0xa0d9('0x3a')]=_[_0xa0d9('0x3b')](_0x1dbbed['query']);_0x28f8a2[_0xa0d9('0x3c')]=_[_0xa0d9('0x3d')](_0x28f8a2[_0xa0d9('0x39')],_0x28f8a2['query']);_0x258dfe[_0xa0d9('0x3e')]=_['intersection'](_0x28f8a2[_0xa0d9('0x39')],qs[_0xa0d9('0x3f')](_0x1dbbed[_0xa0d9('0x3a')]['fields']));_0x258dfe['attributes']=_0x258dfe[_0xa0d9('0x3e')][_0xa0d9('0x40')]?_0x258dfe['attributes']:_0x28f8a2['model'];if(!_0x1dbbed[_0xa0d9('0x3a')][_0xa0d9('0x41')](_0xa0d9('0x54'))){_0x258dfe[_0xa0d9('0x24')]=qs[_0xa0d9('0x24')](_0x1dbbed[_0xa0d9('0x3a')][_0xa0d9('0x24')]);_0x258dfe[_0xa0d9('0x26')]=qs['offset'](_0x1dbbed[_0xa0d9('0x3a')]['offset']);}_0x258dfe[_0xa0d9('0x42')]=qs[_0xa0d9('0x43')](_0x1dbbed['query'][_0xa0d9('0x43')]);_0x258dfe[_0xa0d9('0x44')]=qs[_0xa0d9('0x3c')](_[_0xa0d9('0x45')](_0x1dbbed[_0xa0d9('0x3a')],_0x28f8a2['filters']));if(_0x1dbbed['query'][_0xa0d9('0x46')]){_0x258dfe[_0xa0d9('0x44')]=_[_0xa0d9('0x47')](_0x258dfe[_0xa0d9('0x44')],{'$or':_[_0xa0d9('0x33')](_0x258dfe[_0xa0d9('0x3e')],function(_0x4aa4c4){var _0x139f4c={};_0x139f4c[_0x4aa4c4]={'$like':'%'+_0x1dbbed[_0xa0d9('0x3a')]['filter']+'%'};return _0x139f4c;})});}_0x258dfe=_[_0xa0d9('0x47')]({},_0x258dfe,_0x1dbbed['options']);var _0x4cce1a={'where':_0x258dfe['where']};return db[_0xa0d9('0x34')][_0xa0d9('0x25')](_0x4cce1a)[_0xa0d9('0x2d')](function(_0x41463a){_0x182115[_0xa0d9('0x25')]=_0x41463a;if(_0x1dbbed[_0xa0d9('0x3a')][_0xa0d9('0x4a')]){_0x258dfe[_0xa0d9('0x4b')]=[{'all':!![]}];}return db[_0xa0d9('0x34')][_0xa0d9('0x55')](_0x258dfe);})['then'](function(_0x485fe5){_0x182115['rows']=_0x485fe5;return _0x182115;})[_0xa0d9('0x2d')](respondWithFilteredResult(_0x3e4973,_0x258dfe,_0xa0d9('0x53')))[_0xa0d9('0x4c')](handleError(_0x3e4973,null,_0xa0d9('0x53')));}; \ No newline at end of file +var _0x53c2=['includeAll','getVoiceQueuesReport','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','create','body','params','find','describe','keys','nolimit'];(function(_0x152ab3,_0x293991){var _0x3e148b=function(_0x51cbb6){while(--_0x51cbb6){_0x152ab3['push'](_0x152ab3['shift']());}};_0x3e148b(++_0x293991);}(_0x53c2,0x101));var _0x253c=function(_0x426b58,_0x198bfe){_0x426b58=_0x426b58-0x0;var _0x476220=_0x53c2[_0x426b58];return _0x476220;};'use strict';var emlformat=require(_0x253c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x253c('0x1'));var rp=require(_0x253c('0x2'));var moment=require(_0x253c('0x3'));var BPromise=require(_0x253c('0x4'));var Mustache=require(_0x253c('0x5'));var util=require(_0x253c('0x6'));var path=require(_0x253c('0x7'));var sox=require(_0x253c('0x8'));var csv=require(_0x253c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x253c('0xa'));var _=require(_0x253c('0xb'));var squel=require(_0x253c('0xc'));var crypto=require(_0x253c('0xd'));var jsforce=require(_0x253c('0xe'));var deskjs=require(_0x253c('0xf'));var toCsv=require(_0x253c('0x9'));var querystring=require(_0x253c('0x10'));var Papa=require(_0x253c('0x11'));var Redis=require(_0x253c('0x12'));var authService=require(_0x253c('0x13'));var qs=require(_0x253c('0x14'));var as=require(_0x253c('0x15'));var hardwareService=require(_0x253c('0x16'));var logger=require(_0x253c('0x17'))(_0x253c('0x18'));var utils=require(_0x253c('0x19'));var config=require(_0x253c('0x1a'));var licenseUtil=require(_0x253c('0x1b'));var db=require(_0x253c('0x1c'))['db'];config[_0x253c('0x1d')]=_['defaults'](config[_0x253c('0x1d')],{'host':_0x253c('0x1e'),'port':0x18eb});var socket=require(_0x253c('0x1f'))(new Redis(config[_0x253c('0x1d')]));require('./voiceQueueReport.socket')[_0x253c('0x20')](socket);function respondWithStatusCode(_0x8d5041,_0x5312d4){_0x5312d4=_0x5312d4||0xcc;return function(_0x598871){if(_0x598871){return _0x8d5041[_0x253c('0x21')](_0x5312d4);}return _0x8d5041[_0x253c('0x22')](_0x5312d4)[_0x253c('0x23')]();};}function respondWithResult(_0x4c8271,_0x5bd973){_0x5bd973=_0x5bd973||0xc8;return function(_0xf1f865){if(_0xf1f865){return _0x4c8271['status'](_0x5bd973)[_0x253c('0x24')](_0xf1f865);}};}function respondWithFilteredResult(_0xac8019,_0x17569c){return function(_0x3cfdab){if(_0x3cfdab){var _0x10c224=typeof _0x17569c[_0x253c('0x25')]===_0x253c('0x26')&&typeof _0x17569c[_0x253c('0x27')]===_0x253c('0x26');var _0x150cd0=_0x3cfdab[_0x253c('0x28')];var _0xd6ce84=_0x10c224?0x0:_0x17569c[_0x253c('0x25')];var _0x394aae=_0x10c224?_0x3cfdab['count']:_0x17569c[_0x253c('0x25')]+_0x17569c['limit'];var _0x10f4ee;if(_0x394aae>=_0x150cd0){_0x394aae=_0x150cd0;_0x10f4ee=0xc8;}else{_0x10f4ee=0xce;}_0xac8019['status'](_0x10f4ee);return _0xac8019['set'](_0x253c('0x29'),_0xd6ce84+'-'+_0x394aae+'/'+_0x150cd0)[_0x253c('0x24')](_0x3cfdab);}return null;};}function patchUpdates(_0x20900a){return function(_0x4d4c52){try{jsonpatch[_0x253c('0x2a')](_0x4d4c52,_0x20900a,!![]);}catch(_0x335e91){return BPromise[_0x253c('0x2b')](_0x335e91);}return _0x4d4c52['save']();};}function saveUpdates(_0x18255a,_0x29f955){return function(_0x4a9a23){if(_0x4a9a23){return _0x4a9a23[_0x253c('0x2c')](_0x18255a)[_0x253c('0x2d')](function(_0x389b2b){return _0x389b2b;});}return null;};}function removeEntity(_0x25d430,_0x42d930){return function(_0x495221){if(_0x495221){return _0x495221[_0x253c('0x2e')]()[_0x253c('0x2d')](function(){_0x25d430[_0x253c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559fae,_0x3742f1){return function(_0x4f5854){if(!_0x4f5854){_0x559fae[_0x253c('0x21')](0x194);}return _0x4f5854;};}function handleError(_0x366c0a,_0x16558d){_0x16558d=_0x16558d||0x1f4;return function(_0x2361a0){logger[_0x253c('0x2f')](_0x2361a0['stack']);if(_0x2361a0[_0x253c('0x30')]){delete _0x2361a0['name'];}_0x366c0a[_0x253c('0x22')](_0x16558d)['send'](_0x2361a0);};}exports[_0x253c('0x31')]=function(_0x20db9a,_0x52906f){var _0xd57616={},_0x4981d2={},_0x391ea9={'count':0x0,'rows':[]};var _0xe6990c=_[_0x253c('0x32')](db[_0x253c('0x33')][_0x253c('0x34')],function(_0x325209){return{'name':_0x325209[_0x253c('0x35')],'type':_0x325209[_0x253c('0x36')][_0x253c('0x37')]};});_0x4981d2['model']=_[_0x253c('0x32')](_0xe6990c,_0x253c('0x30'));_0x4981d2[_0x253c('0x38')]=_['keys'](_0x20db9a[_0x253c('0x38')]);_0x4981d2[_0x253c('0x39')]=_[_0x253c('0x3a')](_0x4981d2[_0x253c('0x3b')],_0x4981d2[_0x253c('0x38')]);_0xd57616['attributes']=_[_0x253c('0x3a')](_0x4981d2['model'],qs[_0x253c('0x3c')](_0x20db9a[_0x253c('0x38')]['fields']));_0xd57616[_0x253c('0x3d')]=_0xd57616[_0x253c('0x3d')][_0x253c('0x3e')]?_0xd57616[_0x253c('0x3d')]:_0x4981d2[_0x253c('0x3b')];if(!_0x20db9a[_0x253c('0x38')][_0x253c('0x3f')]('nolimit')){_0xd57616[_0x253c('0x27')]=qs[_0x253c('0x27')](_0x20db9a[_0x253c('0x38')]['limit']);_0xd57616['offset']=qs[_0x253c('0x25')](_0x20db9a[_0x253c('0x38')][_0x253c('0x25')]);}_0xd57616[_0x253c('0x40')]=qs[_0x253c('0x41')](_0x20db9a[_0x253c('0x38')]['sort']);_0xd57616[_0x253c('0x42')]=qs[_0x253c('0x39')](_[_0x253c('0x43')](_0x20db9a[_0x253c('0x38')],_0x4981d2[_0x253c('0x39')]),_0xe6990c);if(_0x20db9a[_0x253c('0x38')][_0x253c('0x44')]){_0xd57616[_0x253c('0x42')]=_[_0x253c('0x45')](_0xd57616[_0x253c('0x42')],{'$or':_[_0x253c('0x32')](_0xe6990c,function(_0x7d925){if(_0x7d925[_0x253c('0x36')]!==_0x253c('0x46')){var _0xfa99d3={};_0xfa99d3[_0x7d925[_0x253c('0x30')]]={'$like':'%'+_0x20db9a[_0x253c('0x38')][_0x253c('0x44')]+'%'};return _0xfa99d3;}})});}_0xd57616=_[_0x253c('0x45')]({},_0xd57616,_0x20db9a[_0x253c('0x47')]);var _0x2d1c05={'where':_0xd57616[_0x253c('0x42')]};return db[_0x253c('0x33')][_0x253c('0x28')](_0x2d1c05)['then'](function(_0x2eb50c){_0x391ea9[_0x253c('0x28')]=_0x2eb50c;if(_0x20db9a[_0x253c('0x38')]['includeAll']){_0xd57616[_0x253c('0x48')]=[{'all':!![]}];}return db[_0x253c('0x33')][_0x253c('0x49')](_0xd57616);})[_0x253c('0x2d')](function(_0x41ab4e){_0x391ea9[_0x253c('0x4a')]=_0x41ab4e;return _0x391ea9;})[_0x253c('0x2d')](respondWithFilteredResult(_0x52906f,_0xd57616))[_0x253c('0x4b')](handleError(_0x52906f,null));};exports['show']=function(_0x1dc9ec,_0x1799d2){var _0x5bdfc4={'raw':![],'where':{'id':_0x1dc9ec['params']['id']}},_0x1efc65={};_0x1efc65['model']=_['keys'](db[_0x253c('0x33')][_0x253c('0x34')]);_0x1efc65['query']=_['keys'](_0x1dc9ec[_0x253c('0x38')]);_0x1efc65[_0x253c('0x39')]=_[_0x253c('0x3a')](_0x1efc65['model'],_0x1efc65[_0x253c('0x38')]);_0x5bdfc4['attributes']=_[_0x253c('0x3a')](_0x1efc65['model'],qs[_0x253c('0x3c')](_0x1dc9ec['query'][_0x253c('0x3c')]));_0x5bdfc4['attributes']=_0x5bdfc4[_0x253c('0x3d')][_0x253c('0x3e')]?_0x5bdfc4[_0x253c('0x3d')]:_0x1efc65[_0x253c('0x3b')];if(_0x1dc9ec[_0x253c('0x38')]['includeAll']){_0x5bdfc4[_0x253c('0x48')]=[{'all':!![]}];}_0x5bdfc4=_[_0x253c('0x45')]({},_0x5bdfc4,_0x1dc9ec[_0x253c('0x47')]);return db['VoiceQueueReport']['find'](_0x5bdfc4)[_0x253c('0x2d')](handleEntityNotFound(_0x1799d2,null))[_0x253c('0x2d')](respondWithResult(_0x1799d2,null))[_0x253c('0x4b')](handleError(_0x1799d2,null));};exports[_0x253c('0x4c')]=function(_0x5c27af,_0x274e15){return db['VoiceQueueReport'][_0x253c('0x4c')](_0x5c27af[_0x253c('0x4d')],{})['then'](respondWithResult(_0x274e15,0xc9))[_0x253c('0x4b')](handleError(_0x274e15,null));};exports[_0x253c('0x2c')]=function(_0x13e47e,_0x40e491){if(_0x13e47e[_0x253c('0x4d')]['id']){delete _0x13e47e[_0x253c('0x4d')]['id'];}return db[_0x253c('0x33')]['find']({'where':{'id':_0x13e47e[_0x253c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x40e491,null))[_0x253c('0x2d')](saveUpdates(_0x13e47e[_0x253c('0x4d')],null))[_0x253c('0x2d')](respondWithResult(_0x40e491,null))[_0x253c('0x4b')](handleError(_0x40e491,null));};exports['destroy']=function(_0x130331,_0x56447a){return db['VoiceQueueReport'][_0x253c('0x4f')]({'where':{'id':_0x130331['params']['id']}})[_0x253c('0x2d')](handleEntityNotFound(_0x56447a,null))[_0x253c('0x2d')](removeEntity(_0x56447a,null))[_0x253c('0x4b')](handleError(_0x56447a,null));};exports[_0x253c('0x50')]=function(_0x937b14,_0x35480e){return db[_0x253c('0x33')]['describe']()[_0x253c('0x2d')](respondWithResult(_0x35480e,null))[_0x253c('0x4b')](handleError(_0x35480e,null));};exports['getVoiceQueuesReport']=function(_0x51ab6c,_0x1952f8){var _0x1150b6={},_0x51d6d4={},_0x394da9={'count':0x0,'rows':[]};_0x51d6d4[_0x253c('0x3b')]=_[_0x253c('0x51')](db[_0x253c('0x33')][_0x253c('0x34')]);_0x51d6d4['query']=_[_0x253c('0x51')](_0x51ab6c[_0x253c('0x38')]);_0x51d6d4[_0x253c('0x39')]=_['intersection'](_0x51d6d4[_0x253c('0x3b')],_0x51d6d4[_0x253c('0x38')]);_0x1150b6[_0x253c('0x3d')]=_[_0x253c('0x3a')](_0x51d6d4[_0x253c('0x3b')],qs['fields'](_0x51ab6c[_0x253c('0x38')][_0x253c('0x3c')]));_0x1150b6[_0x253c('0x3d')]=_0x1150b6[_0x253c('0x3d')][_0x253c('0x3e')]?_0x1150b6[_0x253c('0x3d')]:_0x51d6d4[_0x253c('0x3b')];if(!_0x51ab6c[_0x253c('0x38')][_0x253c('0x3f')](_0x253c('0x52'))){_0x1150b6[_0x253c('0x27')]=qs[_0x253c('0x27')](_0x51ab6c[_0x253c('0x38')][_0x253c('0x27')]);_0x1150b6[_0x253c('0x25')]=qs[_0x253c('0x25')](_0x51ab6c['query'][_0x253c('0x25')]);}_0x1150b6[_0x253c('0x40')]=qs[_0x253c('0x41')](_0x51ab6c[_0x253c('0x38')][_0x253c('0x41')]);_0x1150b6['where']=qs[_0x253c('0x39')](_['pick'](_0x51ab6c[_0x253c('0x38')],_0x51d6d4[_0x253c('0x39')]));if(_0x51ab6c[_0x253c('0x38')]['filter']){_0x1150b6[_0x253c('0x42')]=_[_0x253c('0x45')](_0x1150b6[_0x253c('0x42')],{'$or':_[_0x253c('0x32')](_0x1150b6[_0x253c('0x3d')],function(_0x25bac9){var _0x478372={};_0x478372[_0x25bac9]={'$like':'%'+_0x51ab6c[_0x253c('0x38')]['filter']+'%'};return _0x478372;})});}_0x1150b6=_[_0x253c('0x45')]({},_0x1150b6,_0x51ab6c[_0x253c('0x47')]);var _0x3db2e1={'where':_0x1150b6['where']};return db['VoiceQueueReport'][_0x253c('0x28')](_0x3db2e1)[_0x253c('0x2d')](function(_0x34ef18){_0x394da9['count']=_0x34ef18;if(_0x51ab6c[_0x253c('0x38')][_0x253c('0x53')]){_0x1150b6['include']=[{'all':!![]}];}return db[_0x253c('0x33')][_0x253c('0x49')](_0x1150b6);})[_0x253c('0x2d')](function(_0x1b9dad){_0x394da9['rows']=_0x1b9dad;return _0x394da9;})['then'](respondWithFilteredResult(_0x1952f8,_0x1150b6,'getVoiceQueuesReport'))['catch'](handleError(_0x1952f8,null,_0x253c('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 792201a..5a255f8 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 _0x5f74=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x5f74,0xcc));var _0x45f7=function(_0x54a1c4,_0x3f0c8c){_0x54a1c4=_0x54a1c4-0x0;var _0x97d0fe=_0x5f74[_0x54a1c4];return _0x97d0fe;};'use strict';var EventEmitter=require(_0x45f7('0x0'));var VoiceQueueReport=require(_0x45f7('0x1'))['db'][_0x45f7('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x45f7('0x3')](0x0);var events={'afterCreate':_0x45f7('0x4'),'afterUpdate':_0x45f7('0x5'),'afterDestroy':_0x45f7('0x6')};function emitEvent(_0x5a2508){return function(_0x590fb3,_0xf9568c,_0x489059){VoiceQueueReportEvents[_0x45f7('0x7')](_0x5a2508+':'+_0x590fb3['id'],_0x590fb3);VoiceQueueReportEvents[_0x45f7('0x7')](_0x5a2508,_0x590fb3);_0x489059(null);};}for(var e in events){if(events[_0x45f7('0x8')](e)){var event=events[e];VoiceQueueReport[_0x45f7('0x9')](e,emitEvent(event));}}module[_0x45f7('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xdaa7=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xdaa7,0xec));var _0x7daa=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0xdaa7[_0x4067ac];return _0x53d74d;};'use strict';var EventEmitter=require(_0x7daa('0x0'));var VoiceQueueReport=require(_0x7daa('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7daa('0x2')](0x0);var events={'afterCreate':_0x7daa('0x3'),'afterUpdate':'update','afterDestroy':_0x7daa('0x4')};function emitEvent(_0xf02fa5){return function(_0x2d1f1e,_0x3f0638,_0x354961){VoiceQueueReportEvents[_0x7daa('0x5')](_0xf02fa5+':'+_0x2d1f1e['id'],_0x2d1f1e);VoiceQueueReportEvents[_0x7daa('0x5')](_0xf02fa5,_0x2d1f1e);_0x354961(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7daa('0x6')](e,emitEvent(event));}}module[_0x7daa('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 57c90ac..1cacf85 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 _0x1191=['exports','VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x1191,0x82));var _0x1119=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1191[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1119('0x0'));var util=require(_0x1119('0x1'));var logger=require(_0x1119('0x2'))(_0x1119('0x3'));var moment=require('moment');var BPromise=require(_0x1119('0x4'));var rp=require(_0x1119('0x5'));var fs=require('fs');var path=require(_0x1119('0x6'));var rimraf=require(_0x1119('0x7'));var config=require(_0x1119('0x8'));var attributes=require(_0x1119('0x9'));module[_0x1119('0xa')]=function(_0x2be1c0,_0x111ac3){return _0x2be1c0['define'](_0x1119('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1119('0xc')]},{'fields':[_0x1119('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22b7=['rimraf','define','report_queue','calleridnum','lodash','../../config/logger','moment','bluebird','path'];(function(_0x9911a6,_0x3f751d){var _0x5b445d=function(_0x40a6b8){while(--_0x40a6b8){_0x9911a6['push'](_0x9911a6['shift']());}};_0x5b445d(++_0x3f751d);}(_0x22b7,0x1a2));var _0x722b=function(_0x58e253,_0x30a9c3){_0x58e253=_0x58e253-0x0;var _0x2ffe75=_0x22b7[_0x58e253];return _0x2ffe75;};'use strict';var _=require(_0x722b('0x0'));var util=require('util');var logger=require(_0x722b('0x1'))('api');var moment=require(_0x722b('0x2'));var BPromise=require(_0x722b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x722b('0x4'));var rimraf=require(_0x722b('0x5'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0xfdc23a,_0x3ce2f2){return _0xfdc23a[_0x722b('0x6')]('VoiceQueueReport',attributes,{'tableName':_0x722b('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x722b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 50d1841..396e52b 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 _0xfb3a=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','limit','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb3a,0x140));var _0xafb3=function(_0x3b0bc7,_0x40a956){_0x3b0bc7=_0x3b0bc7-0x0;var _0x3bb644=_0xfb3a[_0x3b0bc7];return _0x3bb644;};'use strict';var _=require('lodash');var util=require(_0xafb3('0x0'));var moment=require(_0xafb3('0x1'));var BPromise=require(_0xafb3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb3('0x3'));var db=require(_0xafb3('0x4'))['db'];var utils=require(_0xafb3('0x5'));var logger=require(_0xafb3('0x6'))(_0xafb3('0x7'));var config=require(_0xafb3('0x8'));var jayson=require(_0xafb3('0x9'));var client=jayson[_0xafb3('0xa')][_0xafb3('0xb')]({'port':0x232a});config[_0xafb3('0xc')]=_[_0xafb3('0xd')](config[_0xafb3('0xc')],{'host':_0xafb3('0xe'),'port':0x18eb});var socket=require(_0xafb3('0xf'))(new Redis(config[_0xafb3('0xc')]));require(_0xafb3('0x10'))[_0xafb3('0x11')](socket);function respondWithRpcPromise(_0x1e974,_0x16923e,_0x2b2900){return new BPromise(function(_0x5ca519,_0x9672dd){return client[_0xafb3('0x12')](_0x1e974,_0x2b2900)[_0xafb3('0x13')](function(_0x20f875){logger[_0xafb3('0x14')](_0xafb3('0x15'),_0x16923e,_0xafb3('0x16'));logger[_0xafb3('0x17')](_0xafb3('0x18'),_0x16923e,'request\x20sent',JSON[_0xafb3('0x19')](_0x20f875));if(_0x20f875[_0xafb3('0x1a')]){if(_0x20f875[_0xafb3('0x1a')][_0xafb3('0x1b')]===0x1f4){logger[_0xafb3('0x1a')](_0xafb3('0x15'),_0x16923e,_0x20f875['error'][_0xafb3('0x1c')]);return _0x9672dd(_0x20f875['error'][_0xafb3('0x1c')]);}logger[_0xafb3('0x1a')](_0xafb3('0x15'),_0x16923e,_0x20f875[_0xafb3('0x1a')][_0xafb3('0x1c')]);return _0x5ca519(_0x20f875[_0xafb3('0x1a')]['message']);}else{logger[_0xafb3('0x14')](_0xafb3('0x15'),_0x16923e,'request\x20sent');_0x5ca519(_0x20f875[_0xafb3('0x1d')][_0xafb3('0x1c')]);}})[_0xafb3('0x1e')](function(_0x2de68b){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x16923e,_0x2de68b);_0x9672dd(_0x2de68b);});});}exports[_0xafb3('0x1f')]=function(_0x14abe8){var _0x38dfbd=this;return new Promise(function(_0x44e0aa,_0x14f59b){return db['VoiceQueueReport'][_0xafb3('0x20')]({'raw':_0x14abe8['options']?_0x14abe8[_0xafb3('0x21')][_0xafb3('0x22')]===undefined?!![]:![]:!![],'where':_0x14abe8[_0xafb3('0x21')]?_0x14abe8[_0xafb3('0x21')][_0xafb3('0x23')]||null:null,'attributes':_0x14abe8[_0xafb3('0x21')]?_0x14abe8['options'][_0xafb3('0x24')]||null:null,'limit':_0x14abe8['options']?_0x14abe8['options']['limit']||null:null,'include':_0x14abe8['options']?_0x14abe8[_0xafb3('0x21')][_0xafb3('0x25')]?_[_0xafb3('0x26')](_0x14abe8[_0xafb3('0x21')][_0xafb3('0x25')],function(_0x2ef131){return{'model':db[_0x2ef131['model']],'as':_0x2ef131['as'],'attributes':_0x2ef131[_0xafb3('0x24')],'include':_0x2ef131[_0xafb3('0x25')]?_['map'](_0x2ef131[_0xafb3('0x25')],function(_0x31f190){return{'model':db[_0x31f190[_0xafb3('0x27')]],'as':_0x31f190['as'],'attributes':_0x31f190[_0xafb3('0x24')],'include':_0x31f190[_0xafb3('0x25')]?_[_0xafb3('0x26')](_0x31f190[_0xafb3('0x25')],function(_0x32764e){return{'model':db[_0x32764e['model']],'as':_0x32764e['as'],'attributes':_0x32764e['attributes']};}):[]};}):[]};}):[]:[]})[_0xafb3('0x13')](function(_0x51d0af){logger[_0xafb3('0x14')](_0xafb3('0x1f'),_0x14abe8);logger[_0xafb3('0x17')]('GetVoiceQueueReport',_0x14abe8,JSON['stringify'](_0x51d0af));_0x44e0aa(_0x51d0af);})[_0xafb3('0x1e')](function(_0x208114){logger[_0xafb3('0x1a')](_0xafb3('0x1f'),_0x208114[_0xafb3('0x1c')],_0x14abe8);_0x14f59b(_0x38dfbd[_0xafb3('0x1a')](0x1f4,_0x208114[_0xafb3('0x1c')]));});});};exports[_0xafb3('0x28')]=function(_0x23e375){var _0x3be001=this;return new Promise(function(_0x25d256,_0x3d82ce){return db[_0xafb3('0x29')][_0xafb3('0x2a')](_0x23e375['body'],{'raw':_0x23e375[_0xafb3('0x21')]?_0x23e375[_0xafb3('0x21')][_0xafb3('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x34cba9){logger[_0xafb3('0x14')]('CreateVoiceQueueReport',_0x23e375);logger[_0xafb3('0x17')](_0xafb3('0x28'),_0x23e375,JSON[_0xafb3('0x19')](_0x34cba9));_0x25d256(_0x34cba9);})[_0xafb3('0x1e')](function(_0x2a181f){logger[_0xafb3('0x1a')](_0xafb3('0x28'),_0x2a181f['message'],_0x23e375);_0x3d82ce(_0x3be001[_0xafb3('0x1a')](0x1f4,_0x2a181f[_0xafb3('0x1c')]));});});};exports[_0xafb3('0x2b')]=function(_0x36e306){var _0x56b5c3=this;return new Promise(function(_0xd0e8d3,_0x32023a){return db['VoiceQueueReport'][_0xafb3('0x2c')](_0x36e306['body'],{'raw':_0x36e306[_0xafb3('0x21')]?_0x36e306[_0xafb3('0x21')][_0xafb3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36e306[_0xafb3('0x21')]?_0x36e306['options'][_0xafb3('0x23')]||null:null,'attributes':_0x36e306[_0xafb3('0x21')]?_0x36e306[_0xafb3('0x21')][_0xafb3('0x24')]||null:null,'limit':_0x36e306['options']?_0x36e306[_0xafb3('0x21')][_0xafb3('0x2d')]||null:null})['then'](function(_0x934f8d){logger['info'](_0xafb3('0x2b'),_0x36e306);logger['debug'](_0xafb3('0x2b'),_0x36e306,JSON['stringify'](_0x934f8d));_0xd0e8d3(_0x934f8d);})['catch'](function(_0x1e24f4){logger[_0xafb3('0x1a')](_0xafb3('0x2b'),_0x1e24f4[_0xafb3('0x1c')],_0x36e306);_0x32023a(_0x56b5c3[_0xafb3('0x1a')](0x1f4,_0x1e24f4[_0xafb3('0x1c')]));});});}; \ No newline at end of file +var _0x84fe=['findAll','options','raw','where','attributes','include','model','map','then','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport'];(function(_0x1b9892,_0x1efbf8){var _0x18606d=function(_0x42bac2){while(--_0x42bac2){_0x1b9892['push'](_0x1b9892['shift']());}};_0x18606d(++_0x1efbf8);}(_0x84fe,0x1d1));var _0xe84f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x84fe[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe84f('0x0'));var util=require(_0xe84f('0x1'));var moment=require(_0xe84f('0x2'));var BPromise=require(_0xe84f('0x3'));var rs=require(_0xe84f('0x4'));var fs=require('fs');var Redis=require(_0xe84f('0x5'));var db=require(_0xe84f('0x6'))['db'];var utils=require(_0xe84f('0x7'));var logger=require(_0xe84f('0x8'))(_0xe84f('0x9'));var config=require(_0xe84f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe84f('0xb')][_0xe84f('0xc')]({'port':0x232a});config[_0xe84f('0xd')]=_['defaults'](config[_0xe84f('0xd')],{'host':_0xe84f('0xe'),'port':0x18eb});var socket=require(_0xe84f('0xf'))(new Redis(config[_0xe84f('0xd')]));require(_0xe84f('0x10'))[_0xe84f('0x11')](socket);function respondWithRpcPromise(_0x18b1c9,_0x11dd8d,_0xf9beeb){return new BPromise(function(_0x47de0d,_0x408335){return client['request'](_0x18b1c9,_0xf9beeb)['then'](function(_0x5c3eb0){logger[_0xe84f('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x11dd8d,'request\x20sent');logger[_0xe84f('0x13')](_0xe84f('0x14'),_0x11dd8d,_0xe84f('0x15'),JSON[_0xe84f('0x16')](_0x5c3eb0));if(_0x5c3eb0[_0xe84f('0x17')]){if(_0x5c3eb0[_0xe84f('0x17')][_0xe84f('0x18')]===0x1f4){logger[_0xe84f('0x17')](_0xe84f('0x19'),_0x11dd8d,_0x5c3eb0['error']['message']);return _0x408335(_0x5c3eb0[_0xe84f('0x17')][_0xe84f('0x1a')]);}logger[_0xe84f('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x11dd8d,_0x5c3eb0[_0xe84f('0x17')]['message']);return _0x47de0d(_0x5c3eb0[_0xe84f('0x17')][_0xe84f('0x1a')]);}else{logger['info'](_0xe84f('0x19'),_0x11dd8d,_0xe84f('0x15'));_0x47de0d(_0x5c3eb0[_0xe84f('0x1b')][_0xe84f('0x1a')]);}})[_0xe84f('0x1c')](function(_0x206fc1){logger[_0xe84f('0x17')](_0xe84f('0x19'),_0x11dd8d,_0x206fc1);_0x408335(_0x206fc1);});});}exports[_0xe84f('0x1d')]=function(_0x3663e3){var _0x588700=this;return new Promise(function(_0x283fcf,_0x4a77a8){return db['VoiceQueueReport'][_0xe84f('0x1e')]({'raw':_0x3663e3[_0xe84f('0x1f')]?_0x3663e3[_0xe84f('0x1f')][_0xe84f('0x20')]===undefined?!![]:![]:!![],'where':_0x3663e3[_0xe84f('0x1f')]?_0x3663e3[_0xe84f('0x1f')][_0xe84f('0x21')]||null:null,'attributes':_0x3663e3[_0xe84f('0x1f')]?_0x3663e3[_0xe84f('0x1f')][_0xe84f('0x22')]||null:null,'limit':_0x3663e3[_0xe84f('0x1f')]?_0x3663e3[_0xe84f('0x1f')]['limit']||null:null,'include':_0x3663e3[_0xe84f('0x1f')]?_0x3663e3[_0xe84f('0x1f')][_0xe84f('0x23')]?_['map'](_0x3663e3[_0xe84f('0x1f')][_0xe84f('0x23')],function(_0x8ef69e){return{'model':db[_0x8ef69e[_0xe84f('0x24')]],'as':_0x8ef69e['as'],'attributes':_0x8ef69e[_0xe84f('0x22')],'include':_0x8ef69e[_0xe84f('0x23')]?_[_0xe84f('0x25')](_0x8ef69e[_0xe84f('0x23')],function(_0x337cf6){return{'model':db[_0x337cf6[_0xe84f('0x24')]],'as':_0x337cf6['as'],'attributes':_0x337cf6['attributes'],'include':_0x337cf6[_0xe84f('0x23')]?_[_0xe84f('0x25')](_0x337cf6[_0xe84f('0x23')],function(_0x403d90){return{'model':db[_0x403d90[_0xe84f('0x24')]],'as':_0x403d90['as'],'attributes':_0x403d90[_0xe84f('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe84f('0x26')](function(_0x31ff3e){logger[_0xe84f('0x12')](_0xe84f('0x1d'),_0x3663e3);logger['debug'](_0xe84f('0x1d'),_0x3663e3,JSON[_0xe84f('0x16')](_0x31ff3e));_0x283fcf(_0x31ff3e);})[_0xe84f('0x1c')](function(_0x25c18a){logger[_0xe84f('0x17')](_0xe84f('0x1d'),_0x25c18a[_0xe84f('0x1a')],_0x3663e3);_0x4a77a8(_0x588700[_0xe84f('0x17')](0x1f4,_0x25c18a['message']));});});};exports[_0xe84f('0x27')]=function(_0x4cfc4d){var _0x3d6d38=this;return new Promise(function(_0x8c410a,_0x1e484e){return db[_0xe84f('0x28')][_0xe84f('0x29')](_0x4cfc4d[_0xe84f('0x2a')],{'raw':_0x4cfc4d[_0xe84f('0x1f')]?_0x4cfc4d[_0xe84f('0x1f')][_0xe84f('0x20')]===undefined?!![]:![]:!![]})[_0xe84f('0x26')](function(_0x202cf1){logger[_0xe84f('0x12')]('CreateVoiceQueueReport',_0x4cfc4d);logger['debug'](_0xe84f('0x27'),_0x4cfc4d,JSON[_0xe84f('0x16')](_0x202cf1));_0x8c410a(_0x202cf1);})[_0xe84f('0x1c')](function(_0x336d71){logger[_0xe84f('0x17')]('CreateVoiceQueueReport',_0x336d71[_0xe84f('0x1a')],_0x4cfc4d);_0x1e484e(_0x3d6d38[_0xe84f('0x17')](0x1f4,_0x336d71['message']));});});};exports[_0xe84f('0x2b')]=function(_0x17426b){var _0x47e2c3=this;return new Promise(function(_0x401c04,_0x1474eb){return db['VoiceQueueReport']['update'](_0x17426b['body'],{'raw':_0x17426b[_0xe84f('0x1f')]?_0x17426b[_0xe84f('0x1f')][_0xe84f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17426b[_0xe84f('0x1f')]?_0x17426b['options'][_0xe84f('0x21')]||null:null,'attributes':_0x17426b[_0xe84f('0x1f')]?_0x17426b[_0xe84f('0x1f')][_0xe84f('0x22')]||null:null,'limit':_0x17426b[_0xe84f('0x1f')]?_0x17426b[_0xe84f('0x1f')][_0xe84f('0x2c')]||null:null})[_0xe84f('0x26')](function(_0x31510f){logger[_0xe84f('0x12')](_0xe84f('0x2b'),_0x17426b);logger['debug'](_0xe84f('0x2b'),_0x17426b,JSON[_0xe84f('0x16')](_0x31510f));_0x401c04(_0x31510f);})['catch'](function(_0x3fbdee){logger[_0xe84f('0x17')]('UpdateVoiceQueueReport',_0x3fbdee['message'],_0x17426b);_0x1474eb(_0x47e2c3[_0xe84f('0x17')](0x1f4,_0x3fbdee[_0xe84f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 34e0696..b2ddd14 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 _0x6a9a=['voiceQueueReport:','./voiceQueueReport.events','save','update','register','length'];(function(_0x41b465,_0x547671){var _0x320b95=function(_0x32f26f){while(--_0x32f26f){_0x41b465['push'](_0x41b465['shift']());}};_0x320b95(++_0x547671);}(_0x6a9a,0x1bd));var _0xa6a9=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x6a9a[_0x191154];return _0x3dcd73;};'use strict';var VoiceQueueReportEvents=require(_0xa6a9('0x0'));var events=[_0xa6a9('0x1'),'remove',_0xa6a9('0x2')];function createListener(_0x310bd8,_0x484e57){return function(_0x38adee){_0x484e57['emit'](_0x310bd8,_0x38adee);};}function removeListener(_0x21fdbd,_0x4367fb){return function(){VoiceQueueReportEvents['removeListener'](_0x21fdbd,_0x4367fb);};}exports[_0xa6a9('0x3')]=function(_0x3d9359){for(var _0x136943=0x0,_0x32ac64=events[_0xa6a9('0x4')];_0x136943<_0x32ac64;_0x136943++){var _0x3ee7b8=events[_0x136943];var _0x36823e=createListener(_0xa6a9('0x5')+_0x3ee7b8,_0x3d9359);VoiceQueueReportEvents['on'](_0x3ee7b8,_0x36823e);}}; \ No newline at end of file +var _0xdcf0=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','removeListener','register'];(function(_0x229301,_0x55d931){var _0x4a9ac5=function(_0x37a3f4){while(--_0x37a3f4){_0x229301['push'](_0x229301['shift']());}};_0x4a9ac5(++_0x55d931);}(_0xdcf0,0xb8));var _0x0dcf=function(_0x18b54f,_0x340e63){_0x18b54f=_0x18b54f-0x0;var _0x1bed7c=_0xdcf0[_0x18b54f];return _0x1bed7c;};'use strict';var VoiceQueueReportEvents=require(_0x0dcf('0x0'));var events=[_0x0dcf('0x1'),'remove',_0x0dcf('0x2')];function createListener(_0x4390bb,_0x53ce12){return function(_0x41aea7){_0x53ce12['emit'](_0x4390bb,_0x41aea7);};}function removeListener(_0x4b1323,_0x388fc3){return function(){VoiceQueueReportEvents[_0x0dcf('0x3')](_0x4b1323,_0x388fc3);};}exports[_0x0dcf('0x4')]=function(_0x2586c8){for(var _0x1367df=0x0,_0x598cf5=events[_0x0dcf('0x5')];_0x1367df<_0x598cf5;_0x1367df++){var _0x4ea8e2=events[_0x1367df];var _0x37871c=createListener(_0x0dcf('0x6')+_0x4ea8e2,_0x2586c8);VoiceQueueReportEvents['on'](_0x4ea8e2,_0x37871c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 36a2175..60353ec 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 _0xc1e8=['index','/:id','show','post','isAuthenticated','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xc1e8,0x87));var _0x8c1e=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0xc1e8[_0x26a4ea];return _0x1b669e;};'use strict';var multer=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var path=require(_0x8c1e('0x2'));var timeout=require(_0x8c1e('0x3'));var express=require(_0x8c1e('0x4'));var router=express[_0x8c1e('0x5')]();var fs_extra=require(_0x8c1e('0x6'));var auth=require(_0x8c1e('0x7'));var interaction=require(_0x8c1e('0x8'));var config=require(_0x8c1e('0x9'));var controller=require(_0x8c1e('0xa'));router[_0x8c1e('0xb')]('/',auth['isAuthenticated'](),controller[_0x8c1e('0xc')]);router[_0x8c1e('0xb')](_0x8c1e('0xd'),auth['isAuthenticated'](),controller[_0x8c1e('0xe')]);router[_0x8c1e('0xf')]('/',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x11')]);router[_0x8c1e('0x12')]('/:id',auth[_0x8c1e('0x10')](),controller[_0x8c1e('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8c1e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x552e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x552e,0x138));var _0xe552=function(_0x5d3ae4,_0xa6cfe3){_0x5d3ae4=_0x5d3ae4-0x0;var _0x580ddb=_0x552e[_0x5d3ae4];return _0x580ddb;};'use strict';var multer=require(_0xe552('0x0'));var util=require(_0xe552('0x1'));var path=require(_0xe552('0x2'));var timeout=require(_0xe552('0x3'));var express=require(_0xe552('0x4'));var router=express[_0xe552('0x5')]();var fs_extra=require(_0xe552('0x6'));var auth=require(_0xe552('0x7'));var interaction=require(_0xe552('0x8'));var config=require(_0xe552('0x9'));var controller=require('./voiceQueuesLog.controller');router[_0xe552('0xa')]('/',auth[_0xe552('0xb')](),controller[_0xe552('0xc')]);router[_0xe552('0xa')](_0xe552('0xd'),auth['isAuthenticated'](),controller[_0xe552('0xe')]);router['post']('/',auth[_0xe552('0xb')](),controller[_0xe552('0xf')]);router[_0xe552('0x10')](_0xe552('0xd'),auth[_0xe552('0xb')](),controller[_0xe552('0x11')]);router[_0xe552('0x12')](_0xe552('0xd'),auth[_0xe552('0xb')](),controller[_0xe552('0x13')]);module[_0xe552('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 8359874..c956199 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 _0x873a=['sequelize','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2c9596,_0x10d04a){var _0x41adb6=function(_0x43cbae){while(--_0x43cbae){_0x2c9596['push'](_0x2c9596['shift']());}};_0x41adb6(++_0x10d04a);}(_0x873a,0x1c2));var _0xa873=function(_0x37cc06,_0x582e3f){_0x37cc06=_0x37cc06-0x0;var _0x154b5e=_0x873a[_0x37cc06];return _0x154b5e;};'use strict';var Sequelize=require(_0xa873('0x0'));var moment=require(_0xa873('0x1'));module[_0xa873('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa873('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa873('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa873('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa873('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa873('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa873('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xa873('0x4')](_0xa873('0x5'))}}; \ No newline at end of file +var _0xfd30=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','format'];(function(_0x13a770,_0xc83d72){var _0x1552a5=function(_0x5d6033){while(--_0x5d6033){_0x13a770['push'](_0x13a770['shift']());}};_0x1552a5(++_0xc83d72);}(_0xfd30,0x97));var _0x0fd3=function(_0x323edf,_0x43fe50){_0x323edf=_0x323edf-0x0;var _0x2b3449=_0xfd30[_0x323edf];return _0x2b3449;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0fd3('0x0'));module[_0x0fd3('0x1')]={'time':{'type':Sequelize[_0x0fd3('0x2')]},'callid':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0fd3('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x0fd3('0x3')](_0x0fd3('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4941ca7..d8beff5 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 _0xdbe1=['VoiceQueuesLog','includeAll','findAll','rows','params','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x36c829,_0xbb5695){var _0x54e52d=function(_0x138966){while(--_0x138966){_0x36c829['push'](_0x36c829['shift']());}};_0x54e52d(++_0xbb5695);}(_0xdbe1,0x1ba));var _0x1dbe=function(_0x52b7ea,_0x33b70e){_0x52b7ea=_0x52b7ea-0x0;var _0x64f030=_0xdbe1[_0x52b7ea];return _0x64f030;};'use strict';var emlformat=require(_0x1dbe('0x0'));var rimraf=require(_0x1dbe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1dbe('0x2'));var rp=require('request-promise');var moment=require(_0x1dbe('0x3'));var BPromise=require(_0x1dbe('0x4'));var Mustache=require(_0x1dbe('0x5'));var util=require(_0x1dbe('0x6'));var path=require(_0x1dbe('0x7'));var sox=require('sox');var csv=require(_0x1dbe('0x8'));var ejs=require(_0x1dbe('0x9'));var fs=require('fs');var fs_extra=require(_0x1dbe('0xa'));var _=require(_0x1dbe('0xb'));var squel=require(_0x1dbe('0xc'));var crypto=require(_0x1dbe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1dbe('0xe'));var toCsv=require(_0x1dbe('0x8'));var querystring=require(_0x1dbe('0xf'));var Papa=require(_0x1dbe('0x10'));var Redis=require('ioredis');var authService=require(_0x1dbe('0x11'));var qs=require(_0x1dbe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1dbe('0x13'))(_0x1dbe('0x14'));var utils=require(_0x1dbe('0x15'));var config=require(_0x1dbe('0x16'));var licenseUtil=require(_0x1dbe('0x17'));var db=require(_0x1dbe('0x18'))['db'];function respondWithStatusCode(_0x28c3cc,_0x3869a2){_0x3869a2=_0x3869a2||0xcc;return function(_0x4f4a25){if(_0x4f4a25){return _0x28c3cc[_0x1dbe('0x19')](_0x3869a2);}return _0x28c3cc[_0x1dbe('0x1a')](_0x3869a2)[_0x1dbe('0x1b')]();};}function respondWithResult(_0x22636d,_0xccabd8){_0xccabd8=_0xccabd8||0xc8;return function(_0x1c8184){if(_0x1c8184){return _0x22636d[_0x1dbe('0x1a')](_0xccabd8)[_0x1dbe('0x1c')](_0x1c8184);}};}function respondWithFilteredResult(_0x414329,_0xf28bb2){return function(_0x44e41b){if(_0x44e41b){var _0x440b9c=typeof _0xf28bb2['offset']===_0x1dbe('0x1d')&&typeof _0xf28bb2[_0x1dbe('0x1e')]===_0x1dbe('0x1d');var _0x43005a=_0x44e41b[_0x1dbe('0x1f')];var _0x530e3e=_0x440b9c?0x0:_0xf28bb2[_0x1dbe('0x20')];var _0x39c02c=_0x440b9c?_0x44e41b['count']:_0xf28bb2[_0x1dbe('0x20')]+_0xf28bb2[_0x1dbe('0x1e')];var _0x2d1d19;if(_0x39c02c>=_0x43005a){_0x39c02c=_0x43005a;_0x2d1d19=0xc8;}else{_0x2d1d19=0xce;}_0x414329['status'](_0x2d1d19);return _0x414329['set'](_0x1dbe('0x21'),_0x530e3e+'-'+_0x39c02c+'/'+_0x43005a)[_0x1dbe('0x1c')](_0x44e41b);}return null;};}function patchUpdates(_0x5a6c46){return function(_0x4b74b9){try{jsonpatch[_0x1dbe('0x22')](_0x4b74b9,_0x5a6c46,!![]);}catch(_0x574654){return BPromise[_0x1dbe('0x23')](_0x574654);}return _0x4b74b9['save']();};}function saveUpdates(_0xf71bac,_0x3f749d){return function(_0x46a8bc){if(_0x46a8bc){return _0x46a8bc[_0x1dbe('0x24')](_0xf71bac)['then'](function(_0x9488e9){return _0x9488e9;});}return null;};}function removeEntity(_0x1917c7,_0x1527d9){return function(_0x16568c){if(_0x16568c){return _0x16568c[_0x1dbe('0x25')]()[_0x1dbe('0x26')](function(){_0x1917c7[_0x1dbe('0x1a')](0xcc)[_0x1dbe('0x1b')]();});}};}function handleEntityNotFound(_0x56276c,_0x2fb856){return function(_0x1f5dc1){if(!_0x1f5dc1){_0x56276c[_0x1dbe('0x19')](0x194);}return _0x1f5dc1;};}function handleError(_0x477c22,_0x15ff84){_0x15ff84=_0x15ff84||0x1f4;return function(_0x49ef77){logger['error'](_0x49ef77[_0x1dbe('0x27')]);if(_0x49ef77['name']){delete _0x49ef77[_0x1dbe('0x28')];}_0x477c22['status'](_0x15ff84)[_0x1dbe('0x29')](_0x49ef77);};}exports[_0x1dbe('0x2a')]=function(_0x5bd7cb,_0x6734b0){var _0x3bde48={},_0x1a0157={},_0x1e154f={'count':0x0,'rows':[]};var _0x446d8e=_[_0x1dbe('0x2b')](db['VoiceQueuesLog']['rawAttributes'],function(_0x132815){return{'name':_0x132815['fieldName'],'type':_0x132815['type'][_0x1dbe('0x2c')]};});_0x1a0157[_0x1dbe('0x2d')]=_[_0x1dbe('0x2b')](_0x446d8e,_0x1dbe('0x28'));_0x1a0157[_0x1dbe('0x2e')]=_[_0x1dbe('0x2f')](_0x5bd7cb[_0x1dbe('0x2e')]);_0x1a0157[_0x1dbe('0x30')]=_['intersection'](_0x1a0157[_0x1dbe('0x2d')],_0x1a0157['query']);_0x3bde48[_0x1dbe('0x31')]=_[_0x1dbe('0x32')](_0x1a0157[_0x1dbe('0x2d')],qs['fields'](_0x5bd7cb[_0x1dbe('0x2e')][_0x1dbe('0x33')]));_0x3bde48[_0x1dbe('0x31')]=_0x3bde48[_0x1dbe('0x31')]['length']?_0x3bde48[_0x1dbe('0x31')]:_0x1a0157[_0x1dbe('0x2d')];if(!_0x5bd7cb[_0x1dbe('0x2e')][_0x1dbe('0x34')](_0x1dbe('0x35'))){_0x3bde48[_0x1dbe('0x1e')]=qs['limit'](_0x5bd7cb[_0x1dbe('0x2e')][_0x1dbe('0x1e')]);_0x3bde48[_0x1dbe('0x20')]=qs['offset'](_0x5bd7cb['query'][_0x1dbe('0x20')]);}_0x3bde48['order']=qs[_0x1dbe('0x36')](_0x5bd7cb['query'][_0x1dbe('0x36')]);_0x3bde48[_0x1dbe('0x37')]=qs[_0x1dbe('0x30')](_[_0x1dbe('0x38')](_0x5bd7cb[_0x1dbe('0x2e')],_0x1a0157[_0x1dbe('0x30')]),_0x446d8e);if(_0x5bd7cb['query'][_0x1dbe('0x39')]){_0x3bde48['where']=_[_0x1dbe('0x3a')](_0x3bde48[_0x1dbe('0x37')],{'$or':_[_0x1dbe('0x2b')](_0x446d8e,function(_0x2a306d){if(_0x2a306d[_0x1dbe('0x3b')]!==_0x1dbe('0x3c')){var _0x210d89={};_0x210d89[_0x2a306d[_0x1dbe('0x28')]]={'$like':'%'+_0x5bd7cb[_0x1dbe('0x2e')][_0x1dbe('0x39')]+'%'};return _0x210d89;}})});}_0x3bde48=_['merge']({},_0x3bde48,_0x5bd7cb[_0x1dbe('0x3d')]);var _0x4c2fd1={'where':_0x3bde48['where']};return db[_0x1dbe('0x3e')][_0x1dbe('0x1f')](_0x4c2fd1)['then'](function(_0x335284){_0x1e154f['count']=_0x335284;if(_0x5bd7cb[_0x1dbe('0x2e')][_0x1dbe('0x3f')]){_0x3bde48['include']=[{'all':!![]}];}return db[_0x1dbe('0x3e')][_0x1dbe('0x40')](_0x3bde48);})[_0x1dbe('0x26')](function(_0x1c5528){_0x1e154f[_0x1dbe('0x41')]=_0x1c5528;return _0x1e154f;})[_0x1dbe('0x26')](respondWithFilteredResult(_0x6734b0,_0x3bde48))['catch'](handleError(_0x6734b0,null));};exports['show']=function(_0x3cd0a6,_0x2b5592){var _0x42bbce={'raw':!![],'where':{'id':_0x3cd0a6[_0x1dbe('0x42')]['id']}},_0x207764={};_0x207764['model']=_['keys'](db[_0x1dbe('0x3e')]['rawAttributes']);_0x207764[_0x1dbe('0x2e')]=_[_0x1dbe('0x2f')](_0x3cd0a6[_0x1dbe('0x2e')]);_0x207764['filters']=_[_0x1dbe('0x32')](_0x207764[_0x1dbe('0x2d')],_0x207764[_0x1dbe('0x2e')]);_0x42bbce['attributes']=_['intersection'](_0x207764[_0x1dbe('0x2d')],qs['fields'](_0x3cd0a6[_0x1dbe('0x2e')]['fields']));_0x42bbce[_0x1dbe('0x31')]=_0x42bbce[_0x1dbe('0x31')][_0x1dbe('0x43')]?_0x42bbce[_0x1dbe('0x31')]:_0x207764[_0x1dbe('0x2d')];if(_0x3cd0a6[_0x1dbe('0x2e')]['includeAll']){_0x42bbce['include']=[{'all':!![]}];}_0x42bbce=_['merge']({},_0x42bbce,_0x3cd0a6[_0x1dbe('0x3d')]);return db[_0x1dbe('0x3e')][_0x1dbe('0x44')](_0x42bbce)['then'](handleEntityNotFound(_0x2b5592,null))[_0x1dbe('0x26')](respondWithResult(_0x2b5592,null))[_0x1dbe('0x45')](handleError(_0x2b5592,null));};exports['create']=function(_0x16b6c4,_0x2828c9){return db[_0x1dbe('0x3e')][_0x1dbe('0x46')](_0x16b6c4[_0x1dbe('0x47')],{})['then'](respondWithResult(_0x2828c9,0xc9))[_0x1dbe('0x45')](handleError(_0x2828c9,null));};exports[_0x1dbe('0x24')]=function(_0x329e96,_0x3343c9){if(_0x329e96[_0x1dbe('0x47')]['id']){delete _0x329e96['body']['id'];}return db['VoiceQueuesLog'][_0x1dbe('0x44')]({'where':{'id':_0x329e96[_0x1dbe('0x42')]['id']}})['then'](handleEntityNotFound(_0x3343c9,null))[_0x1dbe('0x26')](saveUpdates(_0x329e96['body'],null))[_0x1dbe('0x26')](respondWithResult(_0x3343c9,null))[_0x1dbe('0x45')](handleError(_0x3343c9,null));};exports['destroy']=function(_0x452076,_0x44caf1){return db[_0x1dbe('0x3e')][_0x1dbe('0x44')]({'where':{'id':_0x452076[_0x1dbe('0x42')]['id']}})[_0x1dbe('0x26')](handleEntityNotFound(_0x44caf1,null))[_0x1dbe('0x26')](removeEntity(_0x44caf1,null))[_0x1dbe('0x45')](handleError(_0x44caf1,null));}; \ No newline at end of file +var _0x5068=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','count','set','apply','save','update','then','destroy','error','name','index','map','VoiceQueuesLog','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x15019c,_0x48c265){var _0x170cc7=function(_0x5f1f6f){while(--_0x5f1f6f){_0x15019c['push'](_0x15019c['shift']());}};_0x170cc7(++_0x48c265);}(_0x5068,0x154));var _0x8506=function(_0x1ea660,_0x1885e9){_0x1ea660=_0x1ea660-0x0;var _0x55350f=_0x5068[_0x1ea660];return _0x55350f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8506('0x0'));var zipdir=require(_0x8506('0x1'));var jsonpatch=require(_0x8506('0x2'));var rp=require(_0x8506('0x3'));var moment=require(_0x8506('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8506('0x5'));var util=require(_0x8506('0x6'));var path=require(_0x8506('0x7'));var sox=require(_0x8506('0x8'));var csv=require(_0x8506('0x9'));var ejs=require(_0x8506('0xa'));var fs=require('fs');var fs_extra=require(_0x8506('0xb'));var _=require(_0x8506('0xc'));var squel=require(_0x8506('0xd'));var crypto=require(_0x8506('0xe'));var jsforce=require(_0x8506('0xf'));var deskjs=require(_0x8506('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8506('0x11'));var Papa=require(_0x8506('0x12'));var Redis=require(_0x8506('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8506('0x14'));var as=require(_0x8506('0x15'));var hardwareService=require(_0x8506('0x16'));var logger=require(_0x8506('0x17'))(_0x8506('0x18'));var utils=require(_0x8506('0x19'));var config=require(_0x8506('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40b6d,_0x4cdd82){_0x4cdd82=_0x4cdd82||0xcc;return function(_0x487e9e){if(_0x487e9e){return _0x40b6d[_0x8506('0x1b')](_0x4cdd82);}return _0x40b6d[_0x8506('0x1c')](_0x4cdd82)[_0x8506('0x1d')]();};}function respondWithResult(_0x13011e,_0x19f9d3){_0x19f9d3=_0x19f9d3||0xc8;return function(_0x4694a1){if(_0x4694a1){return _0x13011e[_0x8506('0x1c')](_0x19f9d3)[_0x8506('0x1e')](_0x4694a1);}};}function respondWithFilteredResult(_0x594cc4,_0x5201db){return function(_0x3332a3){if(_0x3332a3){var _0x1d17d0=typeof _0x5201db[_0x8506('0x1f')]==='undefined'&&typeof _0x5201db['limit']==='undefined';var _0x2e5219=_0x3332a3[_0x8506('0x20')];var _0x1f35f5=_0x1d17d0?0x0:_0x5201db['offset'];var _0x71069d=_0x1d17d0?_0x3332a3[_0x8506('0x20')]:_0x5201db[_0x8506('0x1f')]+_0x5201db['limit'];var _0x5a396b;if(_0x71069d>=_0x2e5219){_0x71069d=_0x2e5219;_0x5a396b=0xc8;}else{_0x5a396b=0xce;}_0x594cc4['status'](_0x5a396b);return _0x594cc4[_0x8506('0x21')]('Content-Range',_0x1f35f5+'-'+_0x71069d+'/'+_0x2e5219)[_0x8506('0x1e')](_0x3332a3);}return null;};}function patchUpdates(_0x252078){return function(_0x4d1108){try{jsonpatch[_0x8506('0x22')](_0x4d1108,_0x252078,!![]);}catch(_0x4d62a3){return BPromise['reject'](_0x4d62a3);}return _0x4d1108[_0x8506('0x23')]();};}function saveUpdates(_0x1bc3d1,_0x3ebeb5){return function(_0x34f67f){if(_0x34f67f){return _0x34f67f[_0x8506('0x24')](_0x1bc3d1)[_0x8506('0x25')](function(_0x4d7ffe){return _0x4d7ffe;});}return null;};}function removeEntity(_0x52fd9e,_0x5c091a){return function(_0x214e6d){if(_0x214e6d){return _0x214e6d[_0x8506('0x26')]()['then'](function(){_0x52fd9e[_0x8506('0x1c')](0xcc)[_0x8506('0x1d')]();});}};}function handleEntityNotFound(_0x17de79,_0x51c67f){return function(_0x1c4c81){if(!_0x1c4c81){_0x17de79['sendStatus'](0x194);}return _0x1c4c81;};}function handleError(_0x3d154a,_0xab5816){_0xab5816=_0xab5816||0x1f4;return function(_0x54b930){logger[_0x8506('0x27')](_0x54b930['stack']);if(_0x54b930['name']){delete _0x54b930[_0x8506('0x28')];}_0x3d154a[_0x8506('0x1c')](_0xab5816)['send'](_0x54b930);};}exports[_0x8506('0x29')]=function(_0x16f055,_0x316982){var _0x499625={},_0x185be3={},_0x74af66={'count':0x0,'rows':[]};var _0x14ff61=_[_0x8506('0x2a')](db[_0x8506('0x2b')]['rawAttributes'],function(_0x1b2561){return{'name':_0x1b2561['fieldName'],'type':_0x1b2561[_0x8506('0x2c')]['key']};});_0x185be3[_0x8506('0x2d')]=_[_0x8506('0x2a')](_0x14ff61,_0x8506('0x28'));_0x185be3[_0x8506('0x2e')]=_[_0x8506('0x2f')](_0x16f055[_0x8506('0x2e')]);_0x185be3['filters']=_[_0x8506('0x30')](_0x185be3[_0x8506('0x2d')],_0x185be3[_0x8506('0x2e')]);_0x499625['attributes']=_['intersection'](_0x185be3[_0x8506('0x2d')],qs[_0x8506('0x31')](_0x16f055[_0x8506('0x2e')][_0x8506('0x31')]));_0x499625[_0x8506('0x32')]=_0x499625[_0x8506('0x32')][_0x8506('0x33')]?_0x499625[_0x8506('0x32')]:_0x185be3['model'];if(!_0x16f055[_0x8506('0x2e')][_0x8506('0x34')]('nolimit')){_0x499625['limit']=qs[_0x8506('0x35')](_0x16f055[_0x8506('0x2e')][_0x8506('0x35')]);_0x499625[_0x8506('0x1f')]=qs['offset'](_0x16f055[_0x8506('0x2e')][_0x8506('0x1f')]);}_0x499625[_0x8506('0x36')]=qs['sort'](_0x16f055['query'][_0x8506('0x37')]);_0x499625[_0x8506('0x38')]=qs[_0x8506('0x39')](_[_0x8506('0x3a')](_0x16f055[_0x8506('0x2e')],_0x185be3[_0x8506('0x39')]),_0x14ff61);if(_0x16f055[_0x8506('0x2e')]['filter']){_0x499625['where']=_['merge'](_0x499625[_0x8506('0x38')],{'$or':_[_0x8506('0x2a')](_0x14ff61,function(_0x5336b4){if(_0x5336b4['type']!==_0x8506('0x3b')){var _0x168d0a={};_0x168d0a[_0x5336b4[_0x8506('0x28')]]={'$like':'%'+_0x16f055['query']['filter']+'%'};return _0x168d0a;}})});}_0x499625=_[_0x8506('0x3c')]({},_0x499625,_0x16f055['options']);var _0x1215d2={'where':_0x499625[_0x8506('0x38')]};return db['VoiceQueuesLog'][_0x8506('0x20')](_0x1215d2)[_0x8506('0x25')](function(_0x4bfe30){_0x74af66[_0x8506('0x20')]=_0x4bfe30;if(_0x16f055[_0x8506('0x2e')][_0x8506('0x3d')]){_0x499625[_0x8506('0x3e')]=[{'all':!![]}];}return db[_0x8506('0x2b')][_0x8506('0x3f')](_0x499625);})[_0x8506('0x25')](function(_0x19ee56){_0x74af66[_0x8506('0x40')]=_0x19ee56;return _0x74af66;})[_0x8506('0x25')](respondWithFilteredResult(_0x316982,_0x499625))[_0x8506('0x41')](handleError(_0x316982,null));};exports[_0x8506('0x42')]=function(_0xc38184,_0x4bb3c1){var _0x33c6d0={'raw':!![],'where':{'id':_0xc38184['params']['id']}},_0x2b3c28={};_0x2b3c28['model']=_[_0x8506('0x2f')](db['VoiceQueuesLog'][_0x8506('0x43')]);_0x2b3c28[_0x8506('0x2e')]=_['keys'](_0xc38184[_0x8506('0x2e')]);_0x2b3c28[_0x8506('0x39')]=_['intersection'](_0x2b3c28[_0x8506('0x2d')],_0x2b3c28[_0x8506('0x2e')]);_0x33c6d0[_0x8506('0x32')]=_[_0x8506('0x30')](_0x2b3c28[_0x8506('0x2d')],qs[_0x8506('0x31')](_0xc38184['query'][_0x8506('0x31')]));_0x33c6d0[_0x8506('0x32')]=_0x33c6d0['attributes']['length']?_0x33c6d0[_0x8506('0x32')]:_0x2b3c28[_0x8506('0x2d')];if(_0xc38184[_0x8506('0x2e')]['includeAll']){_0x33c6d0[_0x8506('0x3e')]=[{'all':!![]}];}_0x33c6d0=_[_0x8506('0x3c')]({},_0x33c6d0,_0xc38184[_0x8506('0x44')]);return db[_0x8506('0x2b')][_0x8506('0x45')](_0x33c6d0)[_0x8506('0x25')](handleEntityNotFound(_0x4bb3c1,null))[_0x8506('0x25')](respondWithResult(_0x4bb3c1,null))['catch'](handleError(_0x4bb3c1,null));};exports[_0x8506('0x46')]=function(_0x151fbb,_0x2b38bf){return db['VoiceQueuesLog']['create'](_0x151fbb[_0x8506('0x47')],{})[_0x8506('0x25')](respondWithResult(_0x2b38bf,0xc9))['catch'](handleError(_0x2b38bf,null));};exports[_0x8506('0x24')]=function(_0x35e24a,_0x5d9bc6){if(_0x35e24a['body']['id']){delete _0x35e24a[_0x8506('0x47')]['id'];}return db[_0x8506('0x2b')][_0x8506('0x45')]({'where':{'id':_0x35e24a[_0x8506('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d9bc6,null))['then'](saveUpdates(_0x35e24a[_0x8506('0x47')],null))[_0x8506('0x25')](respondWithResult(_0x5d9bc6,null))['catch'](handleError(_0x5d9bc6,null));};exports[_0x8506('0x26')]=function(_0x5eb98c,_0x49fcd4){return db[_0x8506('0x2b')][_0x8506('0x45')]({'where':{'id':_0x5eb98c[_0x8506('0x48')]['id']}})[_0x8506('0x25')](handleEntityNotFound(_0x49fcd4,null))['then'](removeEntity(_0x49fcd4,null))[_0x8506('0x41')](handleError(_0x49fcd4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b4fe910..9041fcf 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 _0x0776=['./voiceQueuesLog.attributes','exports','voice_queues_log','event_dtm','dtm','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x39fba9,_0x245311){var _0x3078c5=function(_0x4540ff){while(--_0x4540ff){_0x39fba9['push'](_0x39fba9['shift']());}};_0x3078c5(++_0x245311);}(_0x0776,0xad));var _0x6077=function(_0x566395,_0x453a08){_0x566395=_0x566395-0x0;var _0x205a9d=_0x0776[_0x566395];return _0x205a9d;};'use strict';var _=require(_0x6077('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6077('0x1'));var moment=require(_0x6077('0x2'));var BPromise=require('bluebird');var rp=require(_0x6077('0x3'));var fs=require('fs');var path=require(_0x6077('0x4'));var rimraf=require(_0x6077('0x5'));var config=require(_0x6077('0x6'));var attributes=require(_0x6077('0x7'));module[_0x6077('0x8')]=function(_0x5c16bf,_0x50a0b7){return _0x5c16bf['define']('VoiceQueuesLog',attributes,{'tableName':_0x6077('0x9'),'paranoid':![],'indexes':[{'name':_0x6077('0xa'),'fields':['event',_0x6077('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x98f3=['moment','bluebird','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api'];(function(_0x25d6ce,_0x30d64a){var _0x1aef15=function(_0x13aa4f){while(--_0x13aa4f){_0x25d6ce['push'](_0x25d6ce['shift']());}};_0x1aef15(++_0x30d64a);}(_0x98f3,0x1a1));var _0x398f=function(_0x226e5b,_0x4935ed){_0x226e5b=_0x226e5b-0x0;var _0x3c44d3=_0x98f3[_0x226e5b];return _0x3c44d3;};'use strict';var _=require(_0x398f('0x0'));var util=require('util');var logger=require(_0x398f('0x1'))(_0x398f('0x2'));var moment=require(_0x398f('0x3'));var BPromise=require(_0x398f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x398f('0x5'));var rimraf=require('rimraf');var config=require(_0x398f('0x6'));var attributes=require(_0x398f('0x7'));module[_0x398f('0x8')]=function(_0x157d06,_0x55137d){return _0x157d06[_0x398f('0x9')](_0x398f('0xa'),attributes,{'tableName':_0x398f('0xb'),'paranoid':![],'indexes':[{'name':_0x398f('0xc'),'fields':[_0x398f('0xd'),_0x398f('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 65bc743..e023b64 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 _0xa03f=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d623d,_0xc2bee1){var _0x30a526=function(_0x4dfa1a){while(--_0x4dfa1a){_0x5d623d['push'](_0x5d623d['shift']());}};_0x30a526(++_0xc2bee1);}(_0xa03f,0x1ce));var _0xfa03=function(_0x699999,_0x572fb9){_0x699999=_0x699999-0x0;var _0x11c3d5=_0xa03f[_0x699999];return _0x11c3d5;};'use strict';var _=require(_0xfa03('0x0'));var util=require(_0xfa03('0x1'));var moment=require(_0xfa03('0x2'));var BPromise=require(_0xfa03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa03('0x4'));var db=require(_0xfa03('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa03('0x6'))(_0xfa03('0x7'));var config=require(_0xfa03('0x8'));var jayson=require(_0xfa03('0x9'));var client=jayson[_0xfa03('0xa')][_0xfa03('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b1b93,_0x5bebce,_0x92dff7){return new BPromise(function(_0xa6505f,_0x39b67b){return client[_0xfa03('0xc')](_0x1b1b93,_0x92dff7)[_0xfa03('0xd')](function(_0x1db169){logger[_0xfa03('0xe')](_0xfa03('0xf'),_0x5bebce,_0xfa03('0x10'));logger[_0xfa03('0x11')](_0xfa03('0x12'),_0x5bebce,_0xfa03('0x10'),JSON[_0xfa03('0x13')](_0x1db169));if(_0x1db169['error']){if(_0x1db169[_0xfa03('0x14')][_0xfa03('0x15')]===0x1f4){logger[_0xfa03('0x14')](_0xfa03('0xf'),_0x5bebce,_0x1db169[_0xfa03('0x14')][_0xfa03('0x16')]);return _0x39b67b(_0x1db169[_0xfa03('0x14')][_0xfa03('0x16')]);}logger[_0xfa03('0x14')](_0xfa03('0xf'),_0x5bebce,_0x1db169[_0xfa03('0x14')]['message']);return _0xa6505f(_0x1db169[_0xfa03('0x14')]['message']);}else{logger[_0xfa03('0xe')](_0xfa03('0xf'),_0x5bebce,_0xfa03('0x10'));_0xa6505f(_0x1db169['result'][_0xfa03('0x16')]);}})[_0xfa03('0x17')](function(_0x34eb35){logger[_0xfa03('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5bebce,_0x34eb35);_0x39b67b(_0x34eb35);});});} \ No newline at end of file +var _0x4205=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x123797,_0x5aa4b0){var _0x54379d=function(_0x1b685b){while(--_0x1b685b){_0x123797['push'](_0x123797['shift']());}};_0x54379d(++_0x5aa4b0);}(_0x4205,0x1b6));var _0x5420=function(_0x272d5a,_0x4937f1){_0x272d5a=_0x272d5a-0x0;var _0x544f1c=_0x4205[_0x272d5a];return _0x544f1c;};'use strict';var _=require(_0x5420('0x0'));var util=require('util');var moment=require(_0x5420('0x1'));var BPromise=require(_0x5420('0x2'));var rs=require(_0x5420('0x3'));var fs=require('fs');var Redis=require(_0x5420('0x4'));var db=require(_0x5420('0x5'))['db'];var utils=require(_0x5420('0x6'));var logger=require(_0x5420('0x7'))('rpc');var config=require(_0x5420('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5420('0x9')][_0x5420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x376771,_0x56bbda,_0x198c6a){return new BPromise(function(_0x3bd58e,_0x5ac1ec){return client['request'](_0x376771,_0x198c6a)[_0x5420('0xb')](function(_0x54bb4b){logger[_0x5420('0xc')](_0x5420('0xd'),_0x56bbda,_0x5420('0xe'));logger[_0x5420('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x56bbda,'request\x20sent',JSON[_0x5420('0x10')](_0x54bb4b));if(_0x54bb4b[_0x5420('0x11')]){if(_0x54bb4b[_0x5420('0x11')]['code']===0x1f4){logger['error'](_0x5420('0xd'),_0x56bbda,_0x54bb4b[_0x5420('0x11')][_0x5420('0x12')]);return _0x5ac1ec(_0x54bb4b[_0x5420('0x11')]['message']);}logger[_0x5420('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x56bbda,_0x54bb4b[_0x5420('0x11')][_0x5420('0x12')]);return _0x3bd58e(_0x54bb4b[_0x5420('0x11')]['message']);}else{logger[_0x5420('0xc')](_0x5420('0xd'),_0x56bbda,_0x5420('0xe'));_0x3bd58e(_0x54bb4b[_0x5420('0x13')][_0x5420('0x12')]);}})[_0x5420('0x14')](function(_0x1a4f53){logger['error'](_0x5420('0xd'),_0x56bbda,_0x1a4f53);_0x5ac1ec(_0x1a4f53);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 757e84a..0be016b 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 _0x8adc=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','/:id/downloads','downloads','downloadTranscribe','post','create','runTranscribe','put','delete','/:id','destroy','multer','util'];(function(_0xb0f21b,_0x3bf0b3){var _0x73734d=function(_0x13fd64){while(--_0x13fd64){_0xb0f21b['push'](_0xb0f21b['shift']());}};_0x73734d(++_0x3bf0b3);}(_0x8adc,0x124));var _0xc8ad=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x8adc[_0x3a04ab];return _0x4bff6d;};'use strict';var multer=require(_0xc8ad('0x0'));var util=require(_0xc8ad('0x1'));var path=require('path');var timeout=require(_0xc8ad('0x2'));var express=require('express');var router=express[_0xc8ad('0x3')]();var fs_extra=require(_0xc8ad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc8ad('0x5'));var config=require(_0xc8ad('0x6'));var controller=require(_0xc8ad('0x7'));router[_0xc8ad('0x8')]('/',auth[_0xc8ad('0x9')](),controller['index']);router[_0xc8ad('0x8')]('/describe',auth[_0xc8ad('0x9')](),controller[_0xc8ad('0xa')]);router[_0xc8ad('0x8')]('/:id',auth[_0xc8ad('0x9')](),controller['show']);router[_0xc8ad('0x8')]('/:id/download',auth[_0xc8ad('0x9')](),controller['download']);router[_0xc8ad('0x8')](_0xc8ad('0xb'),controller[_0xc8ad('0xc')]);router['get']('/:id/transcribe',auth[_0xc8ad('0x9')](),controller[_0xc8ad('0xd')]);router[_0xc8ad('0xe')]('/',auth[_0xc8ad('0x9')](),controller[_0xc8ad('0xf')]);router[_0xc8ad('0xe')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xc8ad('0x10')]);router[_0xc8ad('0x11')]('/:id',auth[_0xc8ad('0x9')](),controller['update']);router[_0xc8ad('0x12')](_0xc8ad('0x13'),auth[_0xc8ad('0x9')](),controller[_0xc8ad('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6b13=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','describe','/:id','isAuthenticated','show','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','multer','connect-timeout','express','Router'];(function(_0x5f0fd9,_0x4d171d){var _0x35cf87=function(_0x3ed6b6){while(--_0x3ed6b6){_0x5f0fd9['push'](_0x5f0fd9['shift']());}};_0x35cf87(++_0x4d171d);}(_0x6b13,0x6f));var _0x36b1=function(_0x42764d,_0x332a27){_0x42764d=_0x42764d-0x0;var _0x2a643c=_0x6b13[_0x42764d];return _0x2a643c;};'use strict';var multer=require(_0x36b1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x36b1('0x1'));var express=require(_0x36b1('0x2'));var router=express[_0x36b1('0x3')]();var fs_extra=require(_0x36b1('0x4'));var auth=require(_0x36b1('0x5'));var interaction=require(_0x36b1('0x6'));var config=require('../../config/environment');var controller=require(_0x36b1('0x7'));router[_0x36b1('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x36b1('0x9')]);router[_0x36b1('0x8')](_0x36b1('0xa'),auth[_0x36b1('0xb')](),controller[_0x36b1('0xc')]);router[_0x36b1('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['get'](_0x36b1('0xd'),controller['downloads']);router[_0x36b1('0x8')](_0x36b1('0xe'),auth[_0x36b1('0xb')](),controller[_0x36b1('0xf')]);router[_0x36b1('0x10')]('/',auth[_0x36b1('0xb')](),controller[_0x36b1('0x11')]);router[_0x36b1('0x10')]('/:id/transcribe',auth[_0x36b1('0xb')](),controller[_0x36b1('0x12')]);router[_0x36b1('0x13')](_0x36b1('0xa'),auth['isAuthenticated'](),controller[_0x36b1('0x14')]);router[_0x36b1('0x15')](_0x36b1('0xa'),auth[_0x36b1('0xb')](),controller[_0x36b1('0x16')]);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 04e6779..a79f2ce 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(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 2c0ab9e..4c19467 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 _0x11bb=['then','destroy','stack','name','map','VoiceRecording','rawAttributes','type','key','differenceBy','format','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','existsSync','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','decryptFile','Sequelize','ValidationError','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','Location','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','secrets','Voice\x20Recording\x20not\x20found','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','transcribeAccountId','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','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update'];(function(_0x37d76d,_0x57d3ed){var _0x424fe8=function(_0x4c4631){while(--_0x4c4631){_0x37d76d['push'](_0x37d76d['shift']());}};_0x424fe8(++_0x57d3ed);}(_0x11bb,0x1a6));var _0xb11b=function(_0x4c06d7,_0x3c270b){_0x4c06d7=_0x4c06d7-0x0;var _0x2af20f=_0x11bb[_0x4c06d7];return _0x2af20f;};'use strict';var emlformat=require(_0xb11b('0x0'));var rimraf=require(_0xb11b('0x1'));var zipdir=require(_0xb11b('0x2'));var jsonpatch=require(_0xb11b('0x3'));var rp=require(_0xb11b('0x4'));var moment=require(_0xb11b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb11b('0x6'));var util=require(_0xb11b('0x7'));var path=require(_0xb11b('0x8'));var sox=require(_0xb11b('0x9'));var csv=require(_0xb11b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb11b('0xb'));var _=require(_0xb11b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb11b('0xd'));var deskjs=require(_0xb11b('0xe'));var toCsv=require(_0xb11b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xb11b('0xf'));var uuidv4=require(_0xb11b('0x10'));var Redis=require(_0xb11b('0x11'));var authService=require(_0xb11b('0x12'));var qs=require(_0xb11b('0x13'));var as=require(_0xb11b('0x14'));var hardwareService=require(_0xb11b('0x15'));var logger=require('../../config/logger')(_0xb11b('0x16'));var utils=require(_0xb11b('0x17'));var config=require(_0xb11b('0x18'));var licenseUtil=require(_0xb11b('0x19'));var db=require(_0xb11b('0x1a'))['db'];function respondWithStatusCode(_0x578ff9,_0x57068d){_0x57068d=_0x57068d||0xcc;return function(_0x46080b){if(_0x46080b){return _0x578ff9[_0xb11b('0x1b')](_0x57068d);}return _0x578ff9['status'](_0x57068d)[_0xb11b('0x1c')]();};}function respondWithResult(_0x47f792,_0x22cae9){_0x22cae9=_0x22cae9||0xc8;return function(_0x103d97){if(_0x103d97){return _0x47f792[_0xb11b('0x1d')](_0x22cae9)[_0xb11b('0x1e')](_0x103d97);}};}function respondWithFilteredResult(_0x46124e,_0x552fca){return function(_0x4c72ac){if(_0x4c72ac){var _0x1d39bc=typeof _0x552fca['offset']===_0xb11b('0x1f')&&typeof _0x552fca[_0xb11b('0x20')]===_0xb11b('0x1f');var _0x41cc18=_0x4c72ac[_0xb11b('0x21')];var _0x354b3d=_0x1d39bc?0x0:_0x552fca[_0xb11b('0x22')];var _0x5b99a1=_0x1d39bc?_0x4c72ac[_0xb11b('0x21')]:_0x552fca[_0xb11b('0x22')]+_0x552fca[_0xb11b('0x20')];var _0x379754;if(_0x5b99a1>=_0x41cc18){_0x5b99a1=_0x41cc18;_0x379754=0xc8;}else{_0x379754=0xce;}_0x46124e['status'](_0x379754);return _0x46124e[_0xb11b('0x23')](_0xb11b('0x24'),_0x354b3d+'-'+_0x5b99a1+'/'+_0x41cc18)['json'](_0x4c72ac);}return null;};}function patchUpdates(_0x1c94f5){return function(_0x7d7113){try{jsonpatch[_0xb11b('0x25')](_0x7d7113,_0x1c94f5,!![]);}catch(_0x13a13b){return BPromise['reject'](_0x13a13b);}return _0x7d7113[_0xb11b('0x26')]();};}function saveUpdates(_0x521742,_0x505971){return function(_0x5e0380){if(_0x5e0380){return _0x5e0380[_0xb11b('0x27')](_0x521742)[_0xb11b('0x28')](function(_0x5ee6ca){return _0x5ee6ca;});}return null;};}function removeEntity(_0x1a360b,_0x33803c){return function(_0x3cfe6a){if(_0x3cfe6a){return _0x3cfe6a[_0xb11b('0x29')]()['then'](function(){_0x1a360b[_0xb11b('0x1d')](0xcc)[_0xb11b('0x1c')]();});}};}function handleEntityNotFound(_0x2eb31b,_0xfc9371){return function(_0xb0784a){if(!_0xb0784a){_0x2eb31b['sendStatus'](0x194);}return _0xb0784a;};}function handleError(_0x378ef0,_0x146ed1){_0x146ed1=_0x146ed1||0x1f4;return function(_0x24471d){logger['error'](_0x24471d[_0xb11b('0x2a')]);if(_0x24471d[_0xb11b('0x2b')]){delete _0x24471d[_0xb11b('0x2b')];}_0x378ef0[_0xb11b('0x1d')](_0x146ed1)['send'](_0x24471d);};}exports['index']=function(_0x4d2e53,_0x2c873a){var _0x2ddd99={},_0x89efc5={},_0x13f129={'count':0x0,'rows':[]};var _0x226e5a=_[_0xb11b('0x2c')](db[_0xb11b('0x2d')][_0xb11b('0x2e')],function(_0x320562){return{'name':_0x320562['fieldName'],'type':_0x320562[_0xb11b('0x2f')][_0xb11b('0x30')]};});_0x89efc5['model']=_[_0xb11b('0x31')](_[_0xb11b('0x2c')](_0x226e5a,'name'),[_0xb11b('0x32')]);_0x89efc5['query']=_[_0xb11b('0x33')](_0x4d2e53[_0xb11b('0x34')]);_0x89efc5[_0xb11b('0x35')]=_[_0xb11b('0x36')](_0x89efc5[_0xb11b('0x37')],_0x89efc5[_0xb11b('0x34')]);_0x2ddd99[_0xb11b('0x38')]=_[_0xb11b('0x36')](_0x89efc5[_0xb11b('0x37')],qs[_0xb11b('0x39')](_0x4d2e53[_0xb11b('0x34')][_0xb11b('0x39')]));_0x2ddd99['attributes']=_0x2ddd99[_0xb11b('0x38')][_0xb11b('0x3a')]?_0x2ddd99['attributes']:_0x89efc5[_0xb11b('0x37')];if(!_0x4d2e53['query'][_0xb11b('0x3b')]('nolimit')){_0x2ddd99[_0xb11b('0x20')]=qs['limit'](_0x4d2e53['query'][_0xb11b('0x20')]);_0x2ddd99[_0xb11b('0x22')]=qs[_0xb11b('0x22')](_0x4d2e53[_0xb11b('0x34')][_0xb11b('0x22')]);}_0x2ddd99[_0xb11b('0x3c')]=qs['sort'](_0x4d2e53['query'][_0xb11b('0x3d')]);_0x2ddd99[_0xb11b('0x3e')]=qs[_0xb11b('0x35')](_[_0xb11b('0x3f')](_0x4d2e53[_0xb11b('0x34')],_0x89efc5[_0xb11b('0x35')]),_0x226e5a);if(_0x4d2e53[_0xb11b('0x34')][_0xb11b('0x40')]){_0x2ddd99[_0xb11b('0x3e')]=_[_0xb11b('0x41')](_0x2ddd99[_0xb11b('0x3e')],{'$or':_[_0xb11b('0x2c')](_0x226e5a,function(_0x21238e){if(_0x21238e[_0xb11b('0x2f')]!==_0xb11b('0x42')){var _0x273f4b={};_0x273f4b[_0x21238e[_0xb11b('0x2b')]]={'$like':'%'+_0x4d2e53[_0xb11b('0x34')][_0xb11b('0x40')]+'%'};return _0x273f4b;}})});}_0x2ddd99=_[_0xb11b('0x41')]({},_0x2ddd99,_0x4d2e53[_0xb11b('0x43')]);var _0x2c477f={'where':_0x2ddd99['where']};return db[_0xb11b('0x2d')][_0xb11b('0x21')](_0x2c477f)['then'](function(_0x494151){_0x13f129[_0xb11b('0x21')]=_0x494151;if(_0x4d2e53[_0xb11b('0x34')][_0xb11b('0x44')]){_0x2ddd99[_0xb11b('0x45')]=[{'all':!![]}];}return db['VoiceRecording'][_0xb11b('0x46')](_0x2ddd99);})['then'](function(_0x14bf8a){_0x13f129['rows']=_0x14bf8a;return _0x13f129;})['then'](respondWithFilteredResult(_0x2c873a,_0x2ddd99))[_0xb11b('0x47')](handleError(_0x2c873a,null));};exports[_0xb11b('0x48')]=function(_0x4ea954,_0x5154cd){var _0x1c6485={'raw':![],'where':{'id':_0x4ea954[_0xb11b('0x49')]['id']}},_0x2dbfd7={};_0x2dbfd7[_0xb11b('0x37')]=_[_0xb11b('0x33')](db[_0xb11b('0x2d')][_0xb11b('0x2e')]);_0x2dbfd7[_0xb11b('0x34')]=_[_0xb11b('0x33')](_0x4ea954[_0xb11b('0x34')]);_0x2dbfd7[_0xb11b('0x35')]=_[_0xb11b('0x36')](_0x2dbfd7['model'],_0x2dbfd7[_0xb11b('0x34')]);_0x1c6485[_0xb11b('0x38')]=_[_0xb11b('0x36')](_0x2dbfd7['model'],qs['fields'](_0x4ea954[_0xb11b('0x34')][_0xb11b('0x39')]));_0x1c6485[_0xb11b('0x38')]=_0x1c6485[_0xb11b('0x38')][_0xb11b('0x3a')]?_0x1c6485['attributes']:_0x2dbfd7[_0xb11b('0x37')];if(_0x4ea954[_0xb11b('0x34')][_0xb11b('0x44')]){_0x1c6485['include']=[{'all':!![]}];}_0x1c6485=_[_0xb11b('0x41')]({},_0x1c6485,_0x4ea954[_0xb11b('0x43')]);return db[_0xb11b('0x2d')]['find'](_0x1c6485)['then'](handleEntityNotFound(_0x5154cd,null))['then'](respondWithResult(_0x5154cd,null))[_0xb11b('0x47')](handleError(_0x5154cd,null));};exports[_0xb11b('0x4a')]=function(_0x44447a,_0x589631){return db[_0xb11b('0x2d')][_0xb11b('0x4a')](_0x44447a['body'],{})[_0xb11b('0x28')](respondWithResult(_0x589631,0xc9))['catch'](handleError(_0x589631,null));};exports[_0xb11b('0x27')]=function(_0x2e563d,_0x18197a){if(_0x2e563d[_0xb11b('0x4b')]['id']){delete _0x2e563d[_0xb11b('0x4b')]['id'];}return db['VoiceRecording'][_0xb11b('0x4c')]({'where':{'id':_0x2e563d[_0xb11b('0x49')]['id']}})[_0xb11b('0x28')](handleEntityNotFound(_0x18197a,null))['then'](saveUpdates(_0x2e563d['body'],null))['then'](respondWithResult(_0x18197a,null))[_0xb11b('0x47')](handleError(_0x18197a,null));};exports[_0xb11b('0x4d')]=function(_0x3ca958,_0x21f389){return db[_0xb11b('0x2d')][_0xb11b('0x4d')]()[_0xb11b('0x28')](respondWithResult(_0x21f389,null))[_0xb11b('0x47')](handleError(_0x21f389,null));};exports[_0xb11b('0x4e')]=function(_0x4120b6,_0x3d28e3,_0x5f593a){var _0x474c65=require(_0xb11b('0x4f'));var _0x4e7d08=![];var _0xa7ff0e={};if(_0x4120b6[_0xb11b('0x34')][_0xb11b('0x2f')]&&_0x4120b6[_0xb11b('0x34')]['type']==='uniqueid'){_0xa7ff0e[_0xb11b('0x50')]=_0x4120b6['params']['id'];}else{_0xa7ff0e['id']=_0x4120b6[_0xb11b('0x49')]['id'];}return db[_0xb11b('0x2d')][_0xb11b('0x4c')]({'where':_0xa7ff0e,'attributes':['id',_0xb11b('0x51')],'raw':!![]})[_0xb11b('0x28')](handleEntityNotFound(_0x3d28e3,null))[_0xb11b('0x28')](function(_0x240635){if(_0x240635){var _0x24f115=_0x240635['value'];var _0x55a7f6=util[_0xb11b('0x32')]('%s.cypher',_0x24f115);if(fs[_0xb11b('0x52')](_0x55a7f6)){_0x4e7d08=!![];return _0x474c65['decryptFile'](_0x55a7f6,_0x24f115,config['secrets'][_0xb11b('0x53')])['then'](function(){return _0x240635;});}return _0x240635;}})[_0xb11b('0x28')](function(_0x4ef7a9){if(_0x4ef7a9){var _0x9cede5=_0x4ef7a9['value'];if(!fs[_0xb11b('0x52')](_0x9cede5)){throw new db['Sequelize']['ValidationError'](_0xb11b('0x54'));}if(_0x4ef7a9['filename']){return _0x3d28e3[_0xb11b('0x4e')](_0x9cede5,_0x4ef7a9[_0xb11b('0x55')]+path[_0xb11b('0x56')](_0x9cede5),function(){if(_0x4e7d08){fs[_0xb11b('0x57')](_0x9cede5);}});}else{return _0x3d28e3[_0xb11b('0x4e')](_0x9cede5,function(_0x10d0ff){if(_0x4e7d08){fs['unlink'](_0x9cede5);}});}}})['catch'](function(_0x5d7514){if(_0x5d7514['message']==='VoiceRecording\x20not\x20found'){_0x3d28e3[_0xb11b('0x1d')](0x194)['send'](_0xb11b('0x58'));}else{return handleError(_0x3d28e3,null);}});};exports['downloads']=function(_0x4219b2,_0x5e5a80,_0x26a8c5){var _0x20fa0a=require('../../components/encryptor');var _0x5d727e=![];var _0x59a77c={'$and':[db[_0xb11b('0x59')][_0xb11b('0x3e')](db[_0xb11b('0x59')]['fn'](_0xb11b('0x5a'),db[_0xb11b('0x59')][_0xb11b('0x5b')](_0xb11b('0x50'))),_0x4219b2[_0xb11b('0x34')][_0xb11b('0x5c')])]};if(_0x4219b2[_0xb11b('0x34')][_0xb11b('0x2f')]&&_0x4219b2['query'][_0xb11b('0x2f')]===_0xb11b('0x50')){_0x59a77c[_0xb11b('0x5d')]['push']({'uniqueid':_0x4219b2['params']['id']});}else{_0x59a77c['$and'][_0xb11b('0x5e')]({'id':_0x4219b2['params']['id']});}return db[_0xb11b('0x2d')][_0xb11b('0x4c')]({'where':_0x59a77c,'attributes':['id','value'],'raw':!![]})[_0xb11b('0x28')](handleEntityNotFound(_0x5e5a80,null))[_0xb11b('0x28')](function(_0x2c51ee){if(_0x2c51ee){var _0x5335e9=util['format'](_0xb11b('0x5f'),_0x2c51ee[_0xb11b('0x51')]);if(fs[_0xb11b('0x52')](_0x5335e9)){_0x5d727e=!![];return _0x20fa0a[_0xb11b('0x60')](_0x5335e9,_0x2c51ee[_0xb11b('0x51')],config['secrets'][_0xb11b('0x53')])[_0xb11b('0x28')](function(){return _0x2c51ee;});}return _0x2c51ee;}})[_0xb11b('0x28')](function(_0x49eac2){if(_0x49eac2){if(!fs[_0xb11b('0x52')](_0x49eac2[_0xb11b('0x51')])){throw new db[(_0xb11b('0x61'))][(_0xb11b('0x62'))](_0xb11b('0x54'));}if(_0x49eac2['filename']){return _0x5e5a80['download'](_0x49eac2[_0xb11b('0x51')],_0x49eac2[_0xb11b('0x55')]+path['extname'](_0x49eac2[_0xb11b('0x51')]),function(){if(_0x5d727e){fs[_0xb11b('0x57')](_0x49eac2['value']);}});}else{return _0x5e5a80[_0xb11b('0x4e')](_0x49eac2[_0xb11b('0x51')],function(_0x40e15a){if(_0x5d727e){fs[_0xb11b('0x57')](_0x49eac2[_0xb11b('0x51')]);}});}}})[_0xb11b('0x47')](handleError(_0x5e5a80,null));};exports[_0xb11b('0x29')]=function(_0x440991,_0x1d0e18){return db[_0xb11b('0x2d')][_0xb11b('0x4c')]({'where':{'id':_0x440991[_0xb11b('0x49')]['id']}})['then'](function(_0x31a7e7){if(_[_0xb11b('0x63')](_0x31a7e7)){throw new ReferenceError(_0xb11b('0x64'));}return _0x31a7e7;})[_0xb11b('0x28')](function(_0x5d5884){var _0xf330ee=_0x5d5884[_0xb11b('0x51')];logger['info'](_0xb11b('0x65'),_0xf330ee);if(!_[_0xb11b('0x63')](_0x5d5884['value'])&&fs[_0xb11b('0x52')](_0xf330ee)){logger[_0xb11b('0x66')](_0xb11b('0x67')+_0xf330ee+_0xb11b('0x68'));fs[_0xb11b('0x69')](_0xf330ee);}_0xf330ee=_0xf330ee+_0xb11b('0x6a');if(!_['isNil'](_0x5d5884[_0xb11b('0x51')])&&fs['existsSync'](_0xf330ee)){logger[_0xb11b('0x66')](_0xb11b('0x67')+_0xf330ee+_0xb11b('0x68'));fs[_0xb11b('0x69')](_0xf330ee);}return _0x5d5884;})[_0xb11b('0x28')](function(_0x19bd96){if(!_0x19bd96)throw new InternalError();return _0x19bd96[_0xb11b('0x29')]();})[_0xb11b('0x28')](function(){_0x1d0e18['status'](0xcc)[_0xb11b('0x1c')]();})[_0xb11b('0x47')](handleError(_0x1d0e18,null));};function getBucketslist(_0x2a81c7,_0x5e52c5,_0xf1c77e){return new Promise(function(_0x523d1d,_0x593e81){var _0x298126=new AWS['S3']({'accessKeyId':_0x5e52c5,'secretAccessKey':_0x2a81c7,'region':_0xf1c77e});_0x298126[_0xb11b('0x6b')]({},function(_0x3efdee,_0x39f3f5){if(_0x3efdee){return _0x593e81(_0x3efdee);}else{return _0x523d1d(_0x39f3f5);}});});}function createBucket(_0x1f9716,_0x4a6beb,_0x4f8a8a,_0x26687b){return new Promise(function(_0x13c8d2,_0x29720a){var _0x2346d3=new AWS['S3']({'accessKeyId':_0x4a6beb,'secretAccessKey':_0x1f9716,'region':_0x4f8a8a});_0x2346d3[_0xb11b('0x6c')]({'Bucket':_0x26687b},function(_0x399eaa,_0x2edc94){if(_0x399eaa){return _0x29720a(_0x399eaa);}else{return _0x13c8d2(_0x2edc94);}});});}function uploadFile(_0x13808f,_0x2d9999,_0x5d9c34,_0x89b342,_0x53bb58,_0x34c75c){return new Promise(function(_0x3eed54,_0x32526e){var _0x5c15a9=new AWS['S3']({'accessKeyId':_0x2d9999,'secretAccessKey':_0x13808f,'region':_0x5d9c34});_0x5c15a9[_0xb11b('0x6d')]({'Bucket':_0x89b342,'Key':_0x53bb58,'Body':_0x34c75c},function(_0x327bdb,_0x49d1c5){if(_0x327bdb){return _0x32526e(_0x327bdb);}else{return _0x3eed54(_0x49d1c5);}});});}function startTranscribe(_0x4130d2,_0x461c96,_0x51d73f,_0x5d1176,_0x334f45,_0x32a42c){return new Promise(function(_0x1cc4aa,_0xd6f469){var _0x3e406d=new AWS[(_0xb11b('0x6e'))]({'accessKeyId':_0x461c96,'secretAccessKey':_0x4130d2,'region':_0x51d73f});_0x3e406d[_0xb11b('0x6f')]({'TranscriptionJobName':_0x5d1176,'LanguageCode':_0x334f45,'Media':{'MediaFileUri':_0x32a42c}},function(_0x433368,_0x490abd){if(_0x433368){return _0xd6f469(_0x433368);}else{return _0x1cc4aa(_0x490abd);}});});}function transcribe(_0x27121f,_0x479fe5,_0x533dbb,_0x3fbeb1,_0x56ef06,_0x50ef15,_0x1357bb){return new Promise(function(_0x4b467c,_0x281308){var _0x404850={};logger[_0xb11b('0x66')](util[_0xb11b('0x32')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x27121f,_0x56ef06));return uploadFile(_0x479fe5,_0x533dbb,_0x3fbeb1,_0x56ef06,path[_0xb11b('0x70')](_0x50ef15),fs[_0xb11b('0x71')](_0x50ef15))[_0xb11b('0x28')](function(_0x5820d8){logger[_0xb11b('0x66')](util[_0xb11b('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x27121f,_0x56ef06,_0x5820d8[_0xb11b('0x72')]));_0x404850['bucket']=_0x5820d8[_0xb11b('0x73')];_0x404850[_0xb11b('0x74')]=_0x5820d8['Location'];logger[_0xb11b('0x66')](util[_0xb11b('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x27121f));return startTranscribe(_0x479fe5,_0x533dbb,_0x3fbeb1,uuidv4(),_0x1357bb,_0x5820d8[_0xb11b('0x72')]);})[_0xb11b('0x28')](function(_0x471397){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x27121f,_0x471397[_0xb11b('0x75')][_0xb11b('0x76')]));_0x404850['transcribeName']=_0x471397[_0xb11b('0x75')][_0xb11b('0x76')];_0x404850[_0xb11b('0x77')]=_0x471397[_0xb11b('0x75')][_0xb11b('0x78')];return _0x4b467c(_0x404850);})[_0xb11b('0x47')](function(_0x1f68ef){return _0x281308(_0x1f68ef);});});}exports[_0xb11b('0x79')]=function(_0x26c9f6,_0x42fd84,_0x311c73){var _0x133b08;var _0x1c68b4;var _0x365de2;var _0x492bbd=require(_0xb11b('0x4f'));return db['VoiceRecording']['findOne']({'where':{'id':_0x26c9f6[_0xb11b('0x49')]['id']}})[_0xb11b('0x28')](function(_0x1836bf){if(_0x1836bf){var _0x490a57=util[_0xb11b('0x32')](_0xb11b('0x5f'),_0x1836bf[_0xb11b('0x51')]);if(fs['existsSync'](_0x490a57)){cypher=!![];return _0x492bbd[_0xb11b('0x60')](_0x490a57,_0x1836bf[_0xb11b('0x51')],config[_0xb11b('0x7a')][_0xb11b('0x53')])[_0xb11b('0x28')](function(){return _0x1836bf;});}return _0x1836bf;}})['then'](function(_0x5add87){if(!_0x5add87){throw new db['Sequelize'][(_0xb11b('0x62'))](_0xb11b('0x7b'));}_0x1c68b4=_0x5add87;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xb11b('0x28')](handleEntityNotFound(_0x42fd84,null))[_0xb11b('0x28')](function(_0x3acdc7){if(_0x3acdc7){_0x133b08=_0x3acdc7;if(!_0x133b08['transcribe']||!_0x133b08['transcribeAccountId']||!_0x133b08[_0xb11b('0x7c')]||!_0x133b08['language']||!_0x133b08['bucket']){throw new db[(_0xb11b('0x61'))][(_0xb11b('0x62'))](_0xb11b('0x7d'));}if(_0x26c9f6[_0xb11b('0x4b')][_0xb11b('0x7e')]&&(!_0x133b08[_0xb11b('0x7f')]||!_0x133b08[_0xb11b('0x80')]||!_0x133b08['sentimentRegion']||!_0x133b08[_0xb11b('0x81')]||!_0x133b08[_0xb11b('0x82')])){throw new db[(_0xb11b('0x61'))][(_0xb11b('0x62'))](_0xb11b('0x83'));}return db[_0xb11b('0x84')][_0xb11b('0x85')]({'where':{'id':_0x133b08[_0xb11b('0x86')]}});}})[_0xb11b('0x28')](function(_0x4b0048){if(!_0x4b0048){throw new db[(_0xb11b('0x61'))][(_0xb11b('0x62'))](_0xb11b('0x87'));}if(!_0x4b0048[_0xb11b('0x88')]||!_0x4b0048[_0xb11b('0x89')]){throw new db['Sequelize'][(_0xb11b('0x62'))](_0xb11b('0x8a'));}_0x365de2=_0x4b0048;return getBucketslist(_0x365de2['data1'],_0x365de2[_0xb11b('0x89')],_0x133b08[_0xb11b('0x7c')]);})[_0xb11b('0x28')](function(_0x2fa806){if(_0x2fa806&&_0x2fa806[_0xb11b('0x8b')]){var _0x24bb2a=_[_0xb11b('0x4c')](_0x2fa806[_0xb11b('0x8b')],function(_0x4943bb){return _0x4943bb[_0xb11b('0x8c')]===_0x133b08[_0xb11b('0x82')];});if(!_0x24bb2a){logger[_0xb11b('0x66')](util[_0xb11b('0x32')](_0xb11b('0x8d'),_0x26c9f6[_0xb11b('0x49')]['id'],_0x133b08[_0xb11b('0x82')]));return createBucket(_0x365de2[_0xb11b('0x88')],_0x365de2['data2'],_0x133b08['transcribeRegion'],_0x133b08[_0xb11b('0x82')]);}logger[_0xb11b('0x66')](util[_0xb11b('0x32')](_0xb11b('0x8e'),_0x26c9f6[_0xb11b('0x49')]['id'],_0x133b08[_0xb11b('0x82')]));return;}})[_0xb11b('0x28')](function(_0x2b29a2){if(_0x1c68b4[_0xb11b('0x77')]==='NEW'){return transcribe(_0x26c9f6['params']['id'],_0x365de2[_0xb11b('0x88')],_0x365de2[_0xb11b('0x89')],_0x133b08[_0xb11b('0x7c')],_0x133b08[_0xb11b('0x82')],_0x1c68b4['value'],_0x133b08['language']);}else{logger[_0xb11b('0x66')](util[_0xb11b('0x32')](_0xb11b('0x8f'),_0x26c9f6['params']['id']));return{'transcribeStatus':_0xb11b('0x90')};}})[_0xb11b('0x28')](function(_0x44687b){if(_0x44687b){_0x44687b[_0xb11b('0x91')]=_0x26c9f6[_0xb11b('0x4b')]['runSentiment'];return _0x1c68b4[_0xb11b('0x92')](_0x44687b);}})['then'](respondWithResult(_0x42fd84,null))[_0xb11b('0x47')](handleError(_0x42fd84,null));};function writeFile(_0x30af02,_0x31c25c){return new Promise(function(_0x4f7ed4,_0x1a75c1){fs[_0xb11b('0x93')](_0x31c25c,_0x30af02,function(_0x20c605,_0x392fcf){if(_0x20c605){return _0x1a75c1(_0x20c605);}else{return _0x4f7ed4(_0x392fcf);}});});}exports[_0xb11b('0x94')]=function(_0x58ee16,_0x5cf054,_0x489afe){return db['VoiceRecording'][_0xb11b('0x85')]({'where':{'id':_0x58ee16['params']['id']}})[_0xb11b('0x28')](handleEntityNotFound(_0x5cf054))['then'](function(_0x5e7dfa){if(_0x5e7dfa&&_0x5e7dfa[_0xb11b('0x95')]){var _0xb45606=_0x5e7dfa[_0xb11b('0x95')];var _0x1eae3b=config[_0xb11b('0x96')]+_0xb11b('0x97')+_0x5e7dfa['id']+_0xb11b('0x98');if(fs[_0xb11b('0x52')](_0x1eae3b)){return _0x1eae3b;}return writeFile(_0xb45606,_0x1eae3b)[_0xb11b('0x28')](function(){return _0x1eae3b;});}else{throw new db['Sequelize'][(_0xb11b('0x62'))](_0xb11b('0x99'));}})[_0xb11b('0x28')](function(_0xe2446){return _0x5cf054['download'](_0xe2446);})[_0xb11b('0x47')](handleError(_0x5cf054));}; \ No newline at end of file +var _0xe004=['sequelize','MD5','col','token','push','$and','recording','Sequelize','ValidationError','Entity\x20not\x20found','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','format','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','where','filter','merge','options','VoiceRecording','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xe004,0x14f));var _0x4e00=function(_0x27e313,_0x2938da){_0x27e313=_0x27e313-0x0;var _0x457835=_0xe004[_0x27e313];return _0x457835;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e00('0x0'));var zipdir=require(_0x4e00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e00('0x2'));var moment=require('moment');var BPromise=require(_0x4e00('0x3'));var Mustache=require('mustache');var util=require(_0x4e00('0x4'));var path=require(_0x4e00('0x5'));var sox=require('sox');var csv=require(_0x4e00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e00('0x7'));var _=require('lodash');var squel=require(_0x4e00('0x8'));var crypto=require(_0x4e00('0x9'));var jsforce=require(_0x4e00('0xa'));var deskjs=require(_0x4e00('0xb'));var toCsv=require(_0x4e00('0x6'));var querystring=require(_0x4e00('0xc'));var Papa=require(_0x4e00('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x4e00('0xe'));var Redis=require(_0x4e00('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4e00('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e00('0x11'));var logger=require(_0x4e00('0x12'))(_0x4e00('0x13'));var utils=require(_0x4e00('0x14'));var config=require(_0x4e00('0x15'));var licenseUtil=require(_0x4e00('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a4342,_0x4158fa){_0x4158fa=_0x4158fa||0xcc;return function(_0x4edd14){if(_0x4edd14){return _0x2a4342[_0x4e00('0x17')](_0x4158fa);}return _0x2a4342[_0x4e00('0x18')](_0x4158fa)['end']();};}function respondWithResult(_0x230fa5,_0x24514a){_0x24514a=_0x24514a||0xc8;return function(_0x498716){if(_0x498716){return _0x230fa5['status'](_0x24514a)[_0x4e00('0x19')](_0x498716);}};}function respondWithFilteredResult(_0x99b4dc,_0x3c75f2){return function(_0x3ddaae){if(_0x3ddaae){var _0x2e6e21=typeof _0x3c75f2[_0x4e00('0x1a')]==='undefined'&&typeof _0x3c75f2[_0x4e00('0x1b')]===_0x4e00('0x1c');var _0x5f1300=_0x3ddaae['count'];var _0x42b0c9=_0x2e6e21?0x0:_0x3c75f2[_0x4e00('0x1a')];var _0x33b09e=_0x2e6e21?_0x3ddaae[_0x4e00('0x1d')]:_0x3c75f2[_0x4e00('0x1a')]+_0x3c75f2[_0x4e00('0x1b')];var _0x2146f9;if(_0x33b09e>=_0x5f1300){_0x33b09e=_0x5f1300;_0x2146f9=0xc8;}else{_0x2146f9=0xce;}_0x99b4dc[_0x4e00('0x18')](_0x2146f9);return _0x99b4dc[_0x4e00('0x1e')](_0x4e00('0x1f'),_0x42b0c9+'-'+_0x33b09e+'/'+_0x5f1300)[_0x4e00('0x19')](_0x3ddaae);}return null;};}function patchUpdates(_0x50637a){return function(_0x10b60d){try{jsonpatch['apply'](_0x10b60d,_0x50637a,!![]);}catch(_0x33c1cf){return BPromise['reject'](_0x33c1cf);}return _0x10b60d['save']();};}function saveUpdates(_0x1e9514,_0x37133f){return function(_0x392269){if(_0x392269){return _0x392269['update'](_0x1e9514)[_0x4e00('0x20')](function(_0x17c142){return _0x17c142;});}return null;};}function removeEntity(_0x2ca42d,_0x5930af){return function(_0x589bc8){if(_0x589bc8){return _0x589bc8[_0x4e00('0x21')]()[_0x4e00('0x20')](function(){_0x2ca42d[_0x4e00('0x18')](0xcc)[_0x4e00('0x22')]();});}};}function handleEntityNotFound(_0x46474c,_0x1173b3){return function(_0x3f1b22){if(!_0x3f1b22){_0x46474c['sendStatus'](0x194);}return _0x3f1b22;};}function handleError(_0x7c41ac,_0x147cc9){_0x147cc9=_0x147cc9||0x1f4;return function(_0x53f04d){logger[_0x4e00('0x23')](_0x53f04d['stack']);if(_0x53f04d[_0x4e00('0x24')]){delete _0x53f04d[_0x4e00('0x24')];}_0x7c41ac[_0x4e00('0x18')](_0x147cc9)[_0x4e00('0x25')](_0x53f04d);};}exports['index']=function(_0x2b7275,_0x510b7f){var _0xa40a17={},_0x5a0ced={},_0x8d5117={'count':0x0,'rows':[]};var _0x5bc714=_[_0x4e00('0x26')](db['VoiceRecording'][_0x4e00('0x27')],function(_0x544984){return{'name':_0x544984[_0x4e00('0x28')],'type':_0x544984[_0x4e00('0x29')][_0x4e00('0x2a')]};});_0x5a0ced[_0x4e00('0x2b')]=_['differenceBy'](_['map'](_0x5bc714,'name'),[_0x4e00('0x2c')]);_0x5a0ced[_0x4e00('0x2d')]=_[_0x4e00('0x2e')](_0x2b7275['query']);_0x5a0ced[_0x4e00('0x2f')]=_['intersection'](_0x5a0ced['model'],_0x5a0ced['query']);_0xa40a17[_0x4e00('0x30')]=_[_0x4e00('0x31')](_0x5a0ced[_0x4e00('0x2b')],qs[_0x4e00('0x32')](_0x2b7275[_0x4e00('0x2d')][_0x4e00('0x32')]));_0xa40a17[_0x4e00('0x30')]=_0xa40a17[_0x4e00('0x30')]['length']?_0xa40a17['attributes']:_0x5a0ced[_0x4e00('0x2b')];if(!_0x2b7275[_0x4e00('0x2d')][_0x4e00('0x33')](_0x4e00('0x34'))){_0xa40a17[_0x4e00('0x1b')]=qs['limit'](_0x2b7275[_0x4e00('0x2d')][_0x4e00('0x1b')]);_0xa40a17['offset']=qs[_0x4e00('0x1a')](_0x2b7275['query'][_0x4e00('0x1a')]);}_0xa40a17['order']=qs['sort'](_0x2b7275[_0x4e00('0x2d')]['sort']);_0xa40a17[_0x4e00('0x35')]=qs[_0x4e00('0x2f')](_['pick'](_0x2b7275[_0x4e00('0x2d')],_0x5a0ced[_0x4e00('0x2f')]),_0x5bc714);if(_0x2b7275[_0x4e00('0x2d')][_0x4e00('0x36')]){_0xa40a17['where']=_[_0x4e00('0x37')](_0xa40a17[_0x4e00('0x35')],{'$or':_[_0x4e00('0x26')](_0x5bc714,function(_0x5c1899){if(_0x5c1899[_0x4e00('0x29')]!=='VIRTUAL'){var _0x433a76={};_0x433a76[_0x5c1899[_0x4e00('0x24')]]={'$like':'%'+_0x2b7275[_0x4e00('0x2d')][_0x4e00('0x36')]+'%'};return _0x433a76;}})});}_0xa40a17=_['merge']({},_0xa40a17,_0x2b7275[_0x4e00('0x38')]);var _0x5ef75e={'where':_0xa40a17[_0x4e00('0x35')]};return db[_0x4e00('0x39')][_0x4e00('0x1d')](_0x5ef75e)['then'](function(_0x53b4bf){_0x8d5117[_0x4e00('0x1d')]=_0x53b4bf;if(_0x2b7275['query'][_0x4e00('0x3a')]){_0xa40a17[_0x4e00('0x3b')]=[{'all':!![]}];}return db[_0x4e00('0x39')][_0x4e00('0x3c')](_0xa40a17);})[_0x4e00('0x20')](function(_0x928122){_0x8d5117['rows']=_0x928122;return _0x8d5117;})[_0x4e00('0x20')](respondWithFilteredResult(_0x510b7f,_0xa40a17))[_0x4e00('0x3d')](handleError(_0x510b7f,null));};exports[_0x4e00('0x3e')]=function(_0x1e826e,_0x208072){var _0x339b75={'raw':![],'where':{'id':_0x1e826e[_0x4e00('0x3f')]['id']}},_0x27a74f={};_0x27a74f[_0x4e00('0x2b')]=_[_0x4e00('0x2e')](db[_0x4e00('0x39')][_0x4e00('0x27')]);_0x27a74f['query']=_[_0x4e00('0x2e')](_0x1e826e[_0x4e00('0x2d')]);_0x27a74f[_0x4e00('0x2f')]=_[_0x4e00('0x31')](_0x27a74f[_0x4e00('0x2b')],_0x27a74f[_0x4e00('0x2d')]);_0x339b75[_0x4e00('0x30')]=_[_0x4e00('0x31')](_0x27a74f[_0x4e00('0x2b')],qs[_0x4e00('0x32')](_0x1e826e[_0x4e00('0x2d')][_0x4e00('0x32')]));_0x339b75['attributes']=_0x339b75[_0x4e00('0x30')][_0x4e00('0x40')]?_0x339b75['attributes']:_0x27a74f[_0x4e00('0x2b')];if(_0x1e826e[_0x4e00('0x2d')]['includeAll']){_0x339b75['include']=[{'all':!![]}];}_0x339b75=_[_0x4e00('0x37')]({},_0x339b75,_0x1e826e[_0x4e00('0x38')]);return db['VoiceRecording'][_0x4e00('0x41')](_0x339b75)[_0x4e00('0x20')](handleEntityNotFound(_0x208072,null))[_0x4e00('0x20')](respondWithResult(_0x208072,null))[_0x4e00('0x3d')](handleError(_0x208072,null));};exports[_0x4e00('0x42')]=function(_0x254852,_0x543fbb){return db['VoiceRecording'][_0x4e00('0x42')](_0x254852[_0x4e00('0x43')],{})[_0x4e00('0x20')](respondWithResult(_0x543fbb,0xc9))[_0x4e00('0x3d')](handleError(_0x543fbb,null));};exports['update']=function(_0x324833,_0x7f231c){if(_0x324833[_0x4e00('0x43')]['id']){delete _0x324833[_0x4e00('0x43')]['id'];}return db['VoiceRecording'][_0x4e00('0x41')]({'where':{'id':_0x324833[_0x4e00('0x3f')]['id']}})['then'](handleEntityNotFound(_0x7f231c,null))[_0x4e00('0x20')](saveUpdates(_0x324833['body'],null))[_0x4e00('0x20')](respondWithResult(_0x7f231c,null))[_0x4e00('0x3d')](handleError(_0x7f231c,null));};exports[_0x4e00('0x44')]=function(_0x3289ea,_0x187f14){return db[_0x4e00('0x39')][_0x4e00('0x44')]()[_0x4e00('0x20')](respondWithResult(_0x187f14,null))['catch'](handleError(_0x187f14,null));};exports[_0x4e00('0x45')]=function(_0x872c0f,_0x373b30,_0x59fa56){var _0x28197e=require('../../components/encryptor');var _0x41e61e=![];var _0x3e20f7={};if(_0x872c0f[_0x4e00('0x2d')][_0x4e00('0x29')]&&_0x872c0f['query'][_0x4e00('0x29')]==='uniqueid'){_0x3e20f7[_0x4e00('0x46')]=_0x872c0f[_0x4e00('0x3f')]['id'];}else{_0x3e20f7['id']=_0x872c0f[_0x4e00('0x3f')]['id'];}return db['VoiceRecording'][_0x4e00('0x41')]({'where':_0x3e20f7,'attributes':['id',_0x4e00('0x47')],'raw':!![]})[_0x4e00('0x20')](handleEntityNotFound(_0x373b30,null))['then'](function(_0x1c29c5){if(_0x1c29c5){var _0x526e7e=_0x1c29c5[_0x4e00('0x47')];var _0x41ddcb=util[_0x4e00('0x2c')](_0x4e00('0x48'),_0x526e7e);if(fs[_0x4e00('0x49')](_0x41ddcb)){_0x41e61e=!![];return _0x28197e[_0x4e00('0x4a')](_0x41ddcb,_0x526e7e,config[_0x4e00('0x4b')]['recording'])[_0x4e00('0x20')](function(){return _0x1c29c5;});}return _0x1c29c5;}})[_0x4e00('0x20')](function(_0x42efde){if(_0x42efde){var _0x57d470=_0x42efde['value'];if(!fs[_0x4e00('0x49')](_0x57d470)){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x42efde[_0x4e00('0x4c')]){return _0x373b30[_0x4e00('0x45')](_0x57d470,_0x42efde[_0x4e00('0x4c')]+path[_0x4e00('0x4d')](_0x57d470),function(){if(_0x41e61e){fs[_0x4e00('0x4e')](_0x57d470);}});}else{return _0x373b30[_0x4e00('0x45')](_0x57d470,function(_0x693d08){if(_0x41e61e){fs[_0x4e00('0x4e')](_0x57d470);}});}}})[_0x4e00('0x3d')](function(_0x3f97bc){if(_0x3f97bc[_0x4e00('0x4f')]===_0x4e00('0x50')){_0x373b30[_0x4e00('0x18')](0x194)['send'](_0x4e00('0x51'));}else{return handleError(_0x373b30,null);}});};exports['downloads']=function(_0x283a28,_0x125af3,_0x1c5b7b){var _0x1b9643=require('../../components/encryptor');var _0xc4a52a=![];var _0x246564={'$and':[db[_0x4e00('0x52')]['where'](db['sequelize']['fn'](_0x4e00('0x53'),db['sequelize'][_0x4e00('0x54')](_0x4e00('0x46'))),_0x283a28['query'][_0x4e00('0x55')])]};if(_0x283a28['query']['type']&&_0x283a28[_0x4e00('0x2d')]['type']===_0x4e00('0x46')){_0x246564['$and'][_0x4e00('0x56')]({'uniqueid':_0x283a28[_0x4e00('0x3f')]['id']});}else{_0x246564[_0x4e00('0x57')][_0x4e00('0x56')]({'id':_0x283a28['params']['id']});}return db[_0x4e00('0x39')][_0x4e00('0x41')]({'where':_0x246564,'attributes':['id',_0x4e00('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x125af3,null))[_0x4e00('0x20')](function(_0x275fcb){if(_0x275fcb){var _0x1236b6=util[_0x4e00('0x2c')](_0x4e00('0x48'),_0x275fcb['value']);if(fs['existsSync'](_0x1236b6)){_0xc4a52a=!![];return _0x1b9643[_0x4e00('0x4a')](_0x1236b6,_0x275fcb[_0x4e00('0x47')],config[_0x4e00('0x4b')][_0x4e00('0x58')])[_0x4e00('0x20')](function(){return _0x275fcb;});}return _0x275fcb;}})[_0x4e00('0x20')](function(_0x498165){if(_0x498165){if(!fs['existsSync'](_0x498165[_0x4e00('0x47')])){throw new db[(_0x4e00('0x59'))][(_0x4e00('0x5a'))](_0x4e00('0x50'));}if(_0x498165[_0x4e00('0x4c')]){return _0x125af3[_0x4e00('0x45')](_0x498165[_0x4e00('0x47')],_0x498165[_0x4e00('0x4c')]+path['extname'](_0x498165[_0x4e00('0x47')]),function(){if(_0xc4a52a){fs['unlink'](_0x498165[_0x4e00('0x47')]);}});}else{return _0x125af3[_0x4e00('0x45')](_0x498165[_0x4e00('0x47')],function(_0x3d2ca2){if(_0xc4a52a){fs[_0x4e00('0x4e')](_0x498165[_0x4e00('0x47')]);}});}}})['catch'](handleError(_0x125af3,null));};exports[_0x4e00('0x21')]=function(_0xb98a23,_0x190fc2){return db[_0x4e00('0x39')][_0x4e00('0x41')]({'where':{'id':_0xb98a23[_0x4e00('0x3f')]['id']}})['then'](function(_0x47a454){if(_['isNil'](_0x47a454)){throw new ReferenceError(_0x4e00('0x5b'));}return _0x47a454;})[_0x4e00('0x20')](function(_0x333152){var _0xf49fc5=_0x333152[_0x4e00('0x47')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0xf49fc5);if(!_[_0x4e00('0x5c')](_0x333152[_0x4e00('0x47')])&&fs['existsSync'](_0xf49fc5)){logger[_0x4e00('0x5d')]('File:\x20\x22'+_0xf49fc5+_0x4e00('0x5e'));fs[_0x4e00('0x5f')](_0xf49fc5);}_0xf49fc5=_0xf49fc5+'.cypher';if(!_[_0x4e00('0x5c')](_0x333152[_0x4e00('0x47')])&&fs[_0x4e00('0x49')](_0xf49fc5)){logger[_0x4e00('0x5d')]('File:\x20\x22'+_0xf49fc5+_0x4e00('0x5e'));fs['unlinkSync'](_0xf49fc5);}return _0x333152;})[_0x4e00('0x20')](function(_0x23d21f){if(!_0x23d21f)throw new InternalError();return _0x23d21f[_0x4e00('0x21')]();})[_0x4e00('0x20')](function(){_0x190fc2[_0x4e00('0x18')](0xcc)[_0x4e00('0x22')]();})['catch'](handleError(_0x190fc2,null));};function getBucketslist(_0x26b3d3,_0x509ab8,_0x4b808f){return new Promise(function(_0x326bad,_0x3f48eb){var _0x1965b7=new AWS['S3']({'accessKeyId':_0x509ab8,'secretAccessKey':_0x26b3d3,'region':_0x4b808f});_0x1965b7['listBuckets']({},function(_0x1f1fec,_0x269ef7){if(_0x1f1fec){return _0x3f48eb(_0x1f1fec);}else{return _0x326bad(_0x269ef7);}});});}function createBucket(_0x10e838,_0x45ca18,_0x2f8db0,_0x3b1f33){return new Promise(function(_0x5a513f,_0x10268e){var _0x447137=new AWS['S3']({'accessKeyId':_0x45ca18,'secretAccessKey':_0x10e838,'region':_0x2f8db0});_0x447137['createBucket']({'Bucket':_0x3b1f33},function(_0x56eaf1,_0x3b6cbd){if(_0x56eaf1){return _0x10268e(_0x56eaf1);}else{return _0x5a513f(_0x3b6cbd);}});});}function uploadFile(_0x58dac8,_0x21d4b2,_0x63e9bf,_0xed489f,_0x235715,_0x3e8265){return new Promise(function(_0x27ae6f,_0x5594b1){var _0x3bbb40=new AWS['S3']({'accessKeyId':_0x21d4b2,'secretAccessKey':_0x58dac8,'region':_0x63e9bf});_0x3bbb40['upload']({'Bucket':_0xed489f,'Key':_0x235715,'Body':_0x3e8265},function(_0x407765,_0xffa390){if(_0x407765){return _0x5594b1(_0x407765);}else{return _0x27ae6f(_0xffa390);}});});}function startTranscribe(_0x479635,_0x5eac3b,_0x3fcaa1,_0x5a7e0f,_0x1b40a7,_0x38d865){return new Promise(function(_0x577b82,_0x4d6286){var _0x4d173f=new AWS[(_0x4e00('0x60'))]({'accessKeyId':_0x5eac3b,'secretAccessKey':_0x479635,'region':_0x3fcaa1});_0x4d173f['startTranscriptionJob']({'TranscriptionJobName':_0x5a7e0f,'LanguageCode':_0x1b40a7,'Media':{'MediaFileUri':_0x38d865}},function(_0x4c7d34,_0x1686f9){if(_0x4c7d34){return _0x4d6286(_0x4c7d34);}else{return _0x577b82(_0x1686f9);}});});}function transcribe(_0x3c4af3,_0x101061,_0x2881a7,_0x47c7cd,_0x528bac,_0xfd7479,_0xbdca66){return new Promise(function(_0x1d30b5,_0x4220bd){var _0x581016={};logger[_0x4e00('0x5d')](util[_0x4e00('0x2c')](_0x4e00('0x61'),_0x3c4af3,_0x528bac));return uploadFile(_0x101061,_0x2881a7,_0x47c7cd,_0x528bac,path['basename'](_0xfd7479),fs['readFileSync'](_0xfd7479))[_0x4e00('0x20')](function(_0x1cf75c){logger[_0x4e00('0x5d')](util[_0x4e00('0x2c')](_0x4e00('0x62'),_0x3c4af3,_0x528bac,_0x1cf75c[_0x4e00('0x63')]));_0x581016[_0x4e00('0x64')]=_0x1cf75c[_0x4e00('0x65')];_0x581016[_0x4e00('0x66')]=_0x1cf75c[_0x4e00('0x63')];logger[_0x4e00('0x5d')](util['format'](_0x4e00('0x67'),_0x3c4af3));return startTranscribe(_0x101061,_0x2881a7,_0x47c7cd,uuidv4(),_0xbdca66,_0x1cf75c[_0x4e00('0x63')]);})[_0x4e00('0x20')](function(_0x5941b3){logger[_0x4e00('0x5d')](util[_0x4e00('0x2c')](_0x4e00('0x68'),_0x3c4af3,_0x5941b3[_0x4e00('0x69')]['TranscriptionJobName']));_0x581016[_0x4e00('0x6a')]=_0x5941b3[_0x4e00('0x69')][_0x4e00('0x6b')];_0x581016[_0x4e00('0x6c')]=_0x5941b3[_0x4e00('0x69')][_0x4e00('0x6d')];return _0x1d30b5(_0x581016);})[_0x4e00('0x3d')](function(_0x458ee){return _0x4220bd(_0x458ee);});});}exports[_0x4e00('0x6e')]=function(_0x23a61d,_0x4bb7d2,_0x18c24d){var _0x58c44e;var _0x4800b6;var _0x325d90;var _0x2c2dab=require(_0x4e00('0x6f'));return db['VoiceRecording'][_0x4e00('0x70')]({'where':{'id':_0x23a61d['params']['id']}})[_0x4e00('0x20')](function(_0x37d6bd){if(_0x37d6bd){var _0x12dec2=util[_0x4e00('0x2c')](_0x4e00('0x48'),_0x37d6bd[_0x4e00('0x47')]);if(fs['existsSync'](_0x12dec2)){cypher=!![];return _0x2c2dab[_0x4e00('0x4a')](_0x12dec2,_0x37d6bd['value'],config['secrets']['recording'])[_0x4e00('0x20')](function(){return _0x37d6bd;});}return _0x37d6bd;}})['then'](function(_0xde8808){if(!_0xde8808){throw new db[(_0x4e00('0x59'))][(_0x4e00('0x5a'))]('Voice\x20Recording\x20not\x20found');}_0x4800b6=_0xde8808;return db[_0x4e00('0x71')][_0x4e00('0x70')]({'where':{'id':0x1}});})[_0x4e00('0x20')](handleEntityNotFound(_0x4bb7d2,null))[_0x4e00('0x20')](function(_0x54f1fe){if(_0x54f1fe){_0x58c44e=_0x54f1fe;if(!_0x58c44e[_0x4e00('0x72')]||!_0x58c44e[_0x4e00('0x73')]||!_0x58c44e['transcribeRegion']||!_0x58c44e[_0x4e00('0x74')]||!_0x58c44e['bucket']){throw new db['Sequelize']['ValidationError'](_0x4e00('0x75'));}if(_0x23a61d['body'][_0x4e00('0x76')]&&(!_0x58c44e[_0x4e00('0x77')]||!_0x58c44e['sentimentAccountId']||!_0x58c44e[_0x4e00('0x78')]||!_0x58c44e[_0x4e00('0x74')]||!_0x58c44e[_0x4e00('0x64')])){throw new db[(_0x4e00('0x59'))][(_0x4e00('0x5a'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x4e00('0x79')][_0x4e00('0x70')]({'where':{'id':_0x58c44e[_0x4e00('0x73')]}});}})[_0x4e00('0x20')](function(_0x2f2cf2){if(!_0x2f2cf2){throw new db[(_0x4e00('0x59'))][(_0x4e00('0x5a'))](_0x4e00('0x7a'));}if(!_0x2f2cf2['data1']||!_0x2f2cf2[_0x4e00('0x7b')]){throw new db[(_0x4e00('0x59'))][(_0x4e00('0x5a'))]('Cloud\x20Provider\x20not\x20configured');}_0x325d90=_0x2f2cf2;return getBucketslist(_0x325d90['data1'],_0x325d90[_0x4e00('0x7b')],_0x58c44e['transcribeRegion']);})[_0x4e00('0x20')](function(_0x42b5e0){if(_0x42b5e0&&_0x42b5e0[_0x4e00('0x7c')]){var _0x27bca7=_['find'](_0x42b5e0[_0x4e00('0x7c')],function(_0x1e469){return _0x1e469['Name']===_0x58c44e[_0x4e00('0x64')];});if(!_0x27bca7){logger['info'](util[_0x4e00('0x2c')](_0x4e00('0x7d'),_0x23a61d[_0x4e00('0x3f')]['id'],_0x58c44e[_0x4e00('0x64')]));return createBucket(_0x325d90[_0x4e00('0x7e')],_0x325d90[_0x4e00('0x7b')],_0x58c44e['transcribeRegion'],_0x58c44e[_0x4e00('0x64')]);}logger[_0x4e00('0x5d')](util[_0x4e00('0x2c')](_0x4e00('0x7f'),_0x23a61d[_0x4e00('0x3f')]['id'],_0x58c44e[_0x4e00('0x64')]));return;}})[_0x4e00('0x20')](function(_0x56574f){if(_0x4800b6[_0x4e00('0x6c')]===_0x4e00('0x80')){return transcribe(_0x23a61d['params']['id'],_0x325d90[_0x4e00('0x7e')],_0x325d90[_0x4e00('0x7b')],_0x58c44e[_0x4e00('0x81')],_0x58c44e['bucket'],_0x4800b6[_0x4e00('0x47')],_0x58c44e[_0x4e00('0x74')]);}else{logger[_0x4e00('0x5d')](util[_0x4e00('0x2c')](_0x4e00('0x82'),_0x23a61d[_0x4e00('0x3f')]['id']));return{'transcribeStatus':_0x4e00('0x83')};}})[_0x4e00('0x20')](function(_0x5f2ab5){if(_0x5f2ab5){_0x5f2ab5[_0x4e00('0x84')]=_0x23a61d[_0x4e00('0x43')][_0x4e00('0x76')];return _0x4800b6['updateAttributes'](_0x5f2ab5);}})['then'](respondWithResult(_0x4bb7d2,null))[_0x4e00('0x3d')](handleError(_0x4bb7d2,null));};function writeFile(_0x447883,_0xf1b589){return new Promise(function(_0x3cf7a6,_0x340f74){fs[_0x4e00('0x85')](_0xf1b589,_0x447883,function(_0x289845,_0x5def6d){if(_0x289845){return _0x340f74(_0x289845);}else{return _0x3cf7a6(_0x5def6d);}});});}exports['downloadTranscribe']=function(_0x30f86e,_0x4876d1,_0x208dbd){return db['VoiceRecording'][_0x4e00('0x70')]({'where':{'id':_0x30f86e['params']['id']}})[_0x4e00('0x20')](handleEntityNotFound(_0x4876d1))[_0x4e00('0x20')](function(_0x1c0bd8){if(_0x1c0bd8&&_0x1c0bd8[_0x4e00('0x86')]){var _0x756ae4=_0x1c0bd8['fileText'];var _0xb132f0=config[_0x4e00('0x87')]+_0x4e00('0x88')+_0x1c0bd8['id']+_0x4e00('0x89');if(fs[_0x4e00('0x49')](_0xb132f0)){return _0xb132f0;}return writeFile(_0x756ae4,_0xb132f0)['then'](function(){return _0xb132f0;});}else{throw new db[(_0x4e00('0x59'))][(_0x4e00('0x5a'))](_0x4e00('0x8a'));}})[_0x4e00('0x20')](function(_0x2e9df8){return _0x4876d1[_0x4e00('0x45')](_0x2e9df8);})[_0x4e00('0x3d')](handleError(_0x4876d1));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 48abeb5..745ba0f 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 _0x1a20=['../../config/logger','api','moment','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash'];(function(_0x354544,_0x3758d0){var _0x2ac3df=function(_0x19cdb4){while(--_0x19cdb4){_0x354544['push'](_0x354544['shift']());}};_0x2ac3df(++_0x3758d0);}(_0x1a20,0xa7));var _0x01a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1a20[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x01a2('0x0'));var util=require('util');var logger=require(_0x01a2('0x1'))(_0x01a2('0x2'));var moment=require(_0x01a2('0x3'));var BPromise=require('bluebird');var rp=require(_0x01a2('0x4'));var fs=require('fs');var path=require(_0x01a2('0x5'));var rimraf=require(_0x01a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x01a2('0x7'));module[_0x01a2('0x8')]=function(_0x419ebd,_0x3a8a8f){return _0x419ebd[_0x01a2('0x9')](_0x01a2('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x01a2('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c13=['uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings'];(function(_0x250447,_0x56dd71){var _0x48ff55=function(_0x383904){while(--_0x383904){_0x250447['push'](_0x250447['shift']());}};_0x48ff55(++_0x56dd71);}(_0x7c13,0xfd));var _0x37c1=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x7c13[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0x37c1('0x0'));var util=require(_0x37c1('0x1'));var logger=require('../../config/logger')(_0x37c1('0x2'));var moment=require(_0x37c1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37c1('0x4'));var rimraf=require(_0x37c1('0x5'));var config=require(_0x37c1('0x6'));var attributes=require(_0x37c1('0x7'));module[_0x37c1('0x8')]=function(_0x504587,_0x4da4de){return _0x504587['define'](_0x37c1('0x9'),attributes,{'tableName':_0x37c1('0xa'),'paranoid':![],'indexes':[{'name':_0x37c1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6277d82..0bab66a 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 _0xdf55=['create','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','info','result','catch','UpdateVoiceRecording','update','options','raw','attributes','limit','debug','stringify','CreateVoiceRecording','findOne','callRecordingEncryption'];(function(_0x3aeb37,_0x1de66b){var _0x268980=function(_0x56e02f){while(--_0x56e02f){_0x3aeb37['push'](_0x3aeb37['shift']());}};_0x268980(++_0x1de66b);}(_0xdf55,0x83));var _0x5df5=function(_0x1ba697,_0x186781){_0x1ba697=_0x1ba697-0x0;var _0x433b23=_0xdf55[_0x1ba697];return _0x433b23;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['VoiceRecording'][_0x5df5('0x17')](_0xb7e1c2['body'],{'raw':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')]['where']||null:null,'attributes':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null})['then'](function(_0x2e99a1){logger[_0x5df5('0x13')](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x1c')]('UpdateVoiceRecording',_0xb7e1c2,JSON[_0x5df5('0x1d')](_0x2e99a1));_0x215d59(_0x2e99a1);})[_0x5df5('0x15')](function(_0x395f3e){logger['error']('UpdateVoiceRecording',_0x395f3e['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0x395f3e[_0x5df5('0x12')]));});});};exports[_0x5df5('0x1e')]=function(_0xa7f4b3){var _0x1baf52=this;return new Promise(function(_0x1fd83c,_0x210d20){var _0x28723e=require('../../components/encryptor');var _0x18bb61;return db['Setting'][_0x5df5('0x1f')]({'attributes':['id',_0x5df5('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3854d0){_0x18bb61=_0x3854d0;return db['VoiceRecording'][_0x5df5('0x21')](_0xa7f4b3['body']);})[_0x5df5('0xc')](function(_0x4afe36){if(_0x18bb61[_0x5df5('0x20')]&&fs['existsSync'](_0x4afe36[_0x5df5('0x22')])){var _0x47bebb=util[_0x5df5('0x23')]('%s.cypher',_0x4afe36[_0x5df5('0x22')]);return _0x28723e[_0x5df5('0x24')](_0x4afe36[_0x5df5('0x22')],_0x47bebb,config[_0x5df5('0x25')][_0x5df5('0x26')])[_0x5df5('0xc')](function(){fs[_0x5df5('0x27')](_0x4afe36['value']);logger['info'](_0x5df5('0x28'));return _0x4afe36;});}return _0x4afe36;})[_0x5df5('0xc')](function(_0x3bbd2b){logger[_0x5df5('0x13')](_0x5df5('0x1e'),_0xa7f4b3);logger[_0x5df5('0x1c')]('CreateVoiceRecording',_0xa7f4b3,JSON[_0x5df5('0x1d')](_0x3bbd2b));_0x1fd83c(_0x3bbd2b);})[_0x5df5('0x15')](function(_0x2f1001){logger[_0x5df5('0xf')]('CreateVoiceRecording',_0x2f1001[_0x5df5('0x12')],_0xa7f4b3);_0x210d20(_0x1baf52['error'](0x1f4,_0x2f1001[_0x5df5('0x12')]));});});}; \ No newline at end of file +var _0x781d=['UpdateVoiceRecording','stringify','CreateVoiceRecording','findOne','callRecordingEncryption','format','%s.cypher','value','secrets','recording','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','VoiceRecording','update','body','options','raw','where','attributes'];(function(_0x407f08,_0x2a6185){var _0x1afd2c=function(_0x123a12){while(--_0x123a12){_0x407f08['push'](_0x407f08['shift']());}};_0x1afd2c(++_0x2a6185);}(_0x781d,0x14a));var _0xd781=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x781d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['UpdateVoiceRecording']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')](_0x1407fc[_0xd781('0x19')],{'raw':_0x1407fc[_0xd781('0x1a')]?_0x1407fc['options'][_0xd781('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1407fc[_0xd781('0x1a')]?_0x1407fc[_0xd781('0x1a')][_0xd781('0x1c')]||null:null,'attributes':_0x1407fc[_0xd781('0x1a')]?_0x1407fc[_0xd781('0x1a')][_0xd781('0x1d')]||null:null,'limit':_0x1407fc['options']?_0x1407fc[_0xd781('0x1a')]['limit']||null:null})['then'](function(_0x187a5a){logger['info'](_0xd781('0x1e'),_0x1407fc);logger[_0xd781('0xf')](_0xd781('0x1e'),_0x1407fc,JSON[_0xd781('0x1f')](_0x187a5a));_0x395d9c(_0x187a5a);})[_0xd781('0x16')](function(_0x28f4fe){logger[_0xd781('0x11')](_0xd781('0x1e'),_0x28f4fe[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922['error'](0x1f4,_0x28f4fe['message']));});});};exports[_0xd781('0x20')]=function(_0x849587){var _0xdad0b1=this;return new Promise(function(_0x57b41e,_0xa1349e){var _0x5a431b=require('../../components/encryptor');var _0x1e29c8;return db['Setting'][_0xd781('0x21')]({'attributes':['id',_0xd781('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5b6b9d){_0x1e29c8=_0x5b6b9d;return db[_0xd781('0x17')]['create'](_0x849587[_0xd781('0x19')]);})['then'](function(_0x21e802){if(_0x1e29c8[_0xd781('0x22')]&&fs['existsSync'](_0x21e802['value'])){var _0x432d14=util[_0xd781('0x23')](_0xd781('0x24'),_0x21e802['value']);return _0x5a431b['encryptFile'](_0x21e802[_0xd781('0x25')],_0x432d14,config[_0xd781('0x26')][_0xd781('0x27')])['then'](function(){fs['unlink'](_0x21e802[_0xd781('0x25')]);logger[_0xd781('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x21e802;});}return _0x21e802;})[_0xd781('0xc')](function(_0x43c322){logger['info'](_0xd781('0x20'),_0x849587);logger[_0xd781('0xf')](_0xd781('0x20'),_0x849587,JSON[_0xd781('0x1f')](_0x43c322));_0x57b41e(_0x43c322);})['catch'](function(_0x23dffb){logger[_0xd781('0x11')](_0xd781('0x20'),_0x23dffb[_0xd781('0x13')],_0x849587);_0xa1349e(_0xdad0b1['error'](0x1f4,_0x23dffb[_0xd781('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index f1e5a0c..b238b38 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 _0x1965=['/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1965,0x9f));var _0x5196=function(_0x1702cd,_0x28cc33){_0x1702cd=_0x1702cd-0x0;var _0x47eb87=_0x1965[_0x1702cd];return _0x47eb87;};'use strict';var multer=require(_0x5196('0x0'));var util=require(_0x5196('0x1'));var path=require('path');var timeout=require(_0x5196('0x2'));var express=require(_0x5196('0x3'));var router=express[_0x5196('0x4')]();var fs_extra=require(_0x5196('0x5'));var auth=require(_0x5196('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5196('0x7'));var controller=require(_0x5196('0x8'));router[_0x5196('0x9')]('/',auth[_0x5196('0xa')](),controller[_0x5196('0xb')]);router[_0x5196('0x9')]('/describe',auth[_0x5196('0xa')](),controller['describe']);router[_0x5196('0x9')](_0x5196('0xc'),auth['isAuthenticated'](),controller[_0x5196('0xd')]);router['post']('/',auth[_0x5196('0xa')](),controller[_0x5196('0xe')]);router[_0x5196('0xf')](_0x5196('0xc'),auth['isAuthenticated'](),controller[_0x5196('0x10')]);router[_0x5196('0x11')](_0x5196('0xc'),auth[_0x5196('0xa')](),controller['destroy']);module[_0x5196('0x12')]=router; \ No newline at end of file +var _0x19cd=['isAuthenticated','describe','/:id','show','post','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get'];(function(_0x117d25,_0xd6769f){var _0x50f8e8=function(_0x273b9a){while(--_0x273b9a){_0x117d25['push'](_0x117d25['shift']());}};_0x50f8e8(++_0xd6769f);}(_0x19cd,0x183));var _0xd19c=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x19cd[_0x119280];return _0x481797;};'use strict';var multer=require('multer');var util=require(_0xd19c('0x0'));var path=require(_0xd19c('0x1'));var timeout=require(_0xd19c('0x2'));var express=require(_0xd19c('0x3'));var router=express['Router']();var fs_extra=require(_0xd19c('0x4'));var auth=require(_0xd19c('0x5'));var interaction=require(_0xd19c('0x6'));var config=require('../../config/environment');var controller=require(_0xd19c('0x7'));router[_0xd19c('0x8')]('/',auth[_0xd19c('0x9')](),controller['index']);router[_0xd19c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd19c('0xa')]);router[_0xd19c('0x8')](_0xd19c('0xb'),auth[_0xd19c('0x9')](),controller[_0xd19c('0xc')]);router[_0xd19c('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd19c('0xe')](_0xd19c('0xb'),auth['isAuthenticated'](),controller[_0xd19c('0xf')]);router[_0xd19c('0x10')](_0xd19c('0xb'),auth[_0xd19c('0x9')](),controller['destroy']);module[_0xd19c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 69e01d4..77222a4 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 _0x155f=['ENUM','blind','attended','STRING','Yes','moment','exports'];(function(_0x5711f6,_0x5d90ba){var _0x158dd9=function(_0x46c672){while(--_0x46c672){_0x5711f6['push'](_0x5711f6['shift']());}};_0x158dd9(++_0x5d90ba);}(_0x155f,0x1cc));var _0xf155=function(_0x1a5c1d,_0x9d59a4){_0x1a5c1d=_0x1a5c1d-0x0;var _0x16cbdd=_0x155f[_0x1a5c1d];return _0x16cbdd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf155('0x0'));module[_0xf155('0x1')]={'type':{'type':Sequelize[_0xf155('0x2')](_0xf155('0x3'),_0xf155('0x4'))},'result':{'type':Sequelize[_0xf155('0x5')]},'transfererchannel':{'type':Sequelize[_0xf155('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xf155('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf155('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf155('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf155('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xf155('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xf155('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf155('0x5')]},'transfereechannel':{'type':Sequelize[_0xf155('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf155('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf155('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf155('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf155('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xf155('0x5')]},'transfereecontext':{'type':Sequelize[_0xf155('0x5')]},'transfereeexten':{'type':Sequelize[_0xf155('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf155('0x5')]},'isexternal':{'type':Sequelize[_0xf155('0x2')](_0xf155('0x6'),'No')},'context':{'type':Sequelize[_0xf155('0x5')]},'extension':{'type':Sequelize[_0xf155('0x5')]}}; \ No newline at end of file +var _0x9d7e=['STRING','moment','exports','ENUM','blind','attended'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x9d7e,0x18d));var _0xe9d7=function(_0x4cca04,_0x89c714){_0x4cca04=_0x4cca04-0x0;var _0x245552=_0x9d7e[_0x4cca04];return _0x245552;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe9d7('0x0'));module[_0xe9d7('0x1')]={'type':{'type':Sequelize[_0xe9d7('0x2')](_0xe9d7('0x3'),_0xe9d7('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xe9d7('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xe9d7('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe9d7('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe9d7('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xe9d7('0x5')]},'transfererexten':{'type':Sequelize[_0xe9d7('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xe9d7('0x5')]},'transfereechannel':{'type':Sequelize[_0xe9d7('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xe9d7('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe9d7('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe9d7('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xe9d7('0x5')]},'transfereecontext':{'type':Sequelize[_0xe9d7('0x5')]},'transfereeexten':{'type':Sequelize[_0xe9d7('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xe9d7('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xe9d7('0x5')]},'extension':{'type':Sequelize[_0xe9d7('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 6f23089..e59edb5 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 _0x2139=['sendStatus','error','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy'];(function(_0x2731df,_0x51e6b6){var _0x39e16a=function(_0x44855e){while(--_0x44855e){_0x2731df['push'](_0x2731df['shift']());}};_0x39e16a(++_0x51e6b6);}(_0x2139,0xbf));var _0x9213=function(_0x47ad9a,_0x300d49){_0x47ad9a=_0x47ad9a-0x0;var _0x24b4b1=_0x2139[_0x47ad9a];return _0x24b4b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9213('0x0'));var zipdir=require(_0x9213('0x1'));var jsonpatch=require(_0x9213('0x2'));var rp=require(_0x9213('0x3'));var moment=require(_0x9213('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9213('0x5'));var util=require(_0x9213('0x6'));var path=require(_0x9213('0x7'));var sox=require(_0x9213('0x8'));var csv=require(_0x9213('0x9'));var ejs=require(_0x9213('0xa'));var fs=require('fs');var fs_extra=require(_0x9213('0xb'));var _=require(_0x9213('0xc'));var squel=require(_0x9213('0xd'));var crypto=require(_0x9213('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9213('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9213('0x10'));var Papa=require(_0x9213('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9213('0x12'));var as=require(_0x9213('0x13'));var hardwareService=require(_0x9213('0x14'));var logger=require(_0x9213('0x15'))(_0x9213('0x16'));var utils=require(_0x9213('0x17'));var config=require(_0x9213('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9213('0x19'))['db'];function respondWithStatusCode(_0x497625,_0x4f8bc9){_0x4f8bc9=_0x4f8bc9||0xcc;return function(_0x59d054){if(_0x59d054){return _0x497625['sendStatus'](_0x4f8bc9);}return _0x497625[_0x9213('0x1a')](_0x4f8bc9)[_0x9213('0x1b')]();};}function respondWithResult(_0x353fd2,_0x327c12){_0x327c12=_0x327c12||0xc8;return function(_0x505656){if(_0x505656){return _0x353fd2[_0x9213('0x1a')](_0x327c12)['json'](_0x505656);}};}function respondWithFilteredResult(_0x51f5a9,_0x390c34){return function(_0x25bd3d){if(_0x25bd3d){var _0x45e26d=typeof _0x390c34[_0x9213('0x1c')]===_0x9213('0x1d')&&typeof _0x390c34[_0x9213('0x1e')]===_0x9213('0x1d');var _0x2accd5=_0x25bd3d[_0x9213('0x1f')];var _0x3a0ce9=_0x45e26d?0x0:_0x390c34[_0x9213('0x1c')];var _0x133889=_0x45e26d?_0x25bd3d[_0x9213('0x1f')]:_0x390c34[_0x9213('0x1c')]+_0x390c34[_0x9213('0x1e')];var _0x1584a3;if(_0x133889>=_0x2accd5){_0x133889=_0x2accd5;_0x1584a3=0xc8;}else{_0x1584a3=0xce;}_0x51f5a9[_0x9213('0x1a')](_0x1584a3);return _0x51f5a9[_0x9213('0x20')](_0x9213('0x21'),_0x3a0ce9+'-'+_0x133889+'/'+_0x2accd5)[_0x9213('0x22')](_0x25bd3d);}return null;};}function patchUpdates(_0xf2d326){return function(_0x12e1e0){try{jsonpatch['apply'](_0x12e1e0,_0xf2d326,!![]);}catch(_0x3a0614){return BPromise[_0x9213('0x23')](_0x3a0614);}return _0x12e1e0[_0x9213('0x24')]();};}function saveUpdates(_0x4d46c0,_0x355c3b){return function(_0x205b6e){if(_0x205b6e){return _0x205b6e[_0x9213('0x25')](_0x4d46c0)[_0x9213('0x26')](function(_0x5266c3){return _0x5266c3;});}return null;};}function removeEntity(_0x23f10f,_0xbd7170){return function(_0xa7a1d8){if(_0xa7a1d8){return _0xa7a1d8[_0x9213('0x27')]()[_0x9213('0x26')](function(){_0x23f10f[_0x9213('0x1a')](0xcc)[_0x9213('0x1b')]();});}};}function handleEntityNotFound(_0x705102,_0x19237c){return function(_0x5303c5){if(!_0x5303c5){_0x705102[_0x9213('0x28')](0x194);}return _0x5303c5;};}function handleError(_0x2d1c66,_0x46ac31){_0x46ac31=_0x46ac31||0x1f4;return function(_0xb688f2){logger[_0x9213('0x29')](_0xb688f2[_0x9213('0x2a')]);if(_0xb688f2[_0x9213('0x2b')]){delete _0xb688f2[_0x9213('0x2b')];}_0x2d1c66['status'](_0x46ac31)[_0x9213('0x2c')](_0xb688f2);};}exports['index']=function(_0x50fc6f,_0x363c82){var _0x20dd72={},_0x3b772f={},_0x18ddf3={'count':0x0,'rows':[]};var _0x10ecd3=_['map'](db[_0x9213('0x2d')][_0x9213('0x2e')],function(_0x3005df){return{'name':_0x3005df[_0x9213('0x2f')],'type':_0x3005df[_0x9213('0x30')][_0x9213('0x31')]};});_0x3b772f[_0x9213('0x32')]=_[_0x9213('0x33')](_0x10ecd3,_0x9213('0x2b'));_0x3b772f[_0x9213('0x34')]=_[_0x9213('0x35')](_0x50fc6f[_0x9213('0x34')]);_0x3b772f[_0x9213('0x36')]=_[_0x9213('0x37')](_0x3b772f[_0x9213('0x32')],_0x3b772f[_0x9213('0x34')]);_0x20dd72[_0x9213('0x38')]=_['intersection'](_0x3b772f[_0x9213('0x32')],qs[_0x9213('0x39')](_0x50fc6f[_0x9213('0x34')][_0x9213('0x39')]));_0x20dd72['attributes']=_0x20dd72['attributes'][_0x9213('0x3a')]?_0x20dd72[_0x9213('0x38')]:_0x3b772f[_0x9213('0x32')];if(!_0x50fc6f[_0x9213('0x34')][_0x9213('0x3b')]('nolimit')){_0x20dd72[_0x9213('0x1e')]=qs[_0x9213('0x1e')](_0x50fc6f[_0x9213('0x34')][_0x9213('0x1e')]);_0x20dd72['offset']=qs['offset'](_0x50fc6f[_0x9213('0x34')][_0x9213('0x1c')]);}_0x20dd72[_0x9213('0x3c')]=qs['sort'](_0x50fc6f[_0x9213('0x34')][_0x9213('0x3d')]);_0x20dd72[_0x9213('0x3e')]=qs['filters'](_[_0x9213('0x3f')](_0x50fc6f[_0x9213('0x34')],_0x3b772f[_0x9213('0x36')]),_0x10ecd3);if(_0x50fc6f[_0x9213('0x34')]['filter']){_0x20dd72[_0x9213('0x3e')]=_[_0x9213('0x40')](_0x20dd72[_0x9213('0x3e')],{'$or':_['map'](_0x10ecd3,function(_0x501cb8){if(_0x501cb8[_0x9213('0x30')]!=='VIRTUAL'){var _0x2ed9b8={};_0x2ed9b8[_0x501cb8[_0x9213('0x2b')]]={'$like':'%'+_0x50fc6f[_0x9213('0x34')][_0x9213('0x41')]+'%'};return _0x2ed9b8;}})});}_0x20dd72=_[_0x9213('0x40')]({},_0x20dd72,_0x50fc6f['options']);var _0x48ee36={'where':_0x20dd72['where']};return db[_0x9213('0x2d')][_0x9213('0x1f')](_0x48ee36)[_0x9213('0x26')](function(_0x252bb2){_0x18ddf3[_0x9213('0x1f')]=_0x252bb2;if(_0x50fc6f[_0x9213('0x34')][_0x9213('0x42')]){_0x20dd72[_0x9213('0x43')]=[{'all':!![]}];}return db[_0x9213('0x2d')][_0x9213('0x44')](_0x20dd72);})[_0x9213('0x26')](function(_0x4b8875){_0x18ddf3[_0x9213('0x45')]=_0x4b8875;return _0x18ddf3;})['then'](respondWithFilteredResult(_0x363c82,_0x20dd72))[_0x9213('0x46')](handleError(_0x363c82,null));};exports[_0x9213('0x47')]=function(_0x369972,_0x25cf21){var _0x4f3cbc={'raw':!![],'where':{'id':_0x369972[_0x9213('0x48')]['id']}},_0x51f9b9={};_0x51f9b9['model']=_[_0x9213('0x35')](db['VoiceTransferReport']['rawAttributes']);_0x51f9b9[_0x9213('0x34')]=_[_0x9213('0x35')](_0x369972['query']);_0x51f9b9['filters']=_[_0x9213('0x37')](_0x51f9b9['model'],_0x51f9b9[_0x9213('0x34')]);_0x4f3cbc[_0x9213('0x38')]=_[_0x9213('0x37')](_0x51f9b9[_0x9213('0x32')],qs[_0x9213('0x39')](_0x369972[_0x9213('0x34')][_0x9213('0x39')]));_0x4f3cbc['attributes']=_0x4f3cbc[_0x9213('0x38')]['length']?_0x4f3cbc['attributes']:_0x51f9b9[_0x9213('0x32')];if(_0x369972[_0x9213('0x34')][_0x9213('0x42')]){_0x4f3cbc['include']=[{'all':!![]}];}_0x4f3cbc=_[_0x9213('0x40')]({},_0x4f3cbc,_0x369972['options']);return db['VoiceTransferReport']['find'](_0x4f3cbc)[_0x9213('0x26')](handleEntityNotFound(_0x25cf21,null))[_0x9213('0x26')](respondWithResult(_0x25cf21,null))['catch'](handleError(_0x25cf21,null));};exports[_0x9213('0x49')]=function(_0x274d97,_0x411f3e){return db['VoiceTransferReport'][_0x9213('0x49')](_0x274d97['body'],{})[_0x9213('0x26')](respondWithResult(_0x411f3e,0xc9))['catch'](handleError(_0x411f3e,null));};exports[_0x9213('0x25')]=function(_0x25180d,_0x81f18b){if(_0x25180d[_0x9213('0x4a')]['id']){delete _0x25180d[_0x9213('0x4a')]['id'];}return db[_0x9213('0x2d')][_0x9213('0x4b')]({'where':{'id':_0x25180d[_0x9213('0x48')]['id']}})[_0x9213('0x26')](handleEntityNotFound(_0x81f18b,null))[_0x9213('0x26')](saveUpdates(_0x25180d[_0x9213('0x4a')],null))[_0x9213('0x26')](respondWithResult(_0x81f18b,null))[_0x9213('0x46')](handleError(_0x81f18b,null));};exports[_0x9213('0x27')]=function(_0x59a8ff,_0x39c740){return db[_0x9213('0x2d')][_0x9213('0x4b')]({'where':{'id':_0x59a8ff[_0x9213('0x48')]['id']}})[_0x9213('0x26')](handleEntityNotFound(_0x39c740,null))[_0x9213('0x26')](removeEntity(_0x39c740,null))[_0x9213('0x46')](handleError(_0x39c740,null));};exports[_0x9213('0x4c')]=function(_0x1a80ef,_0x29e98c){return db[_0x9213('0x2d')][_0x9213('0x4c')]()['then'](respondWithResult(_0x29e98c,null))[_0x9213('0x46')](handleError(_0x29e98c,null));}; \ No newline at end of file +var _0x692d=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','destroy','then','error','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','body','params','describe','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto'];(function(_0x120dac,_0x15b49b){var _0x468024=function(_0x7428a7){while(--_0x7428a7){_0x120dac['push'](_0x120dac['shift']());}};_0x468024(++_0x15b49b);}(_0x692d,0x11e));var _0xd692=function(_0x255da0,_0x5d4cc9){_0x255da0=_0x255da0-0x0;var _0x5eb9c8=_0x692d[_0x255da0];return _0x5eb9c8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd692('0x0'));var rp=require(_0xd692('0x1'));var moment=require('moment');var BPromise=require(_0xd692('0x2'));var Mustache=require(_0xd692('0x3'));var util=require(_0xd692('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd692('0x5'));var ejs=require(_0xd692('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd692('0x7'));var squel=require(_0xd692('0x8'));var crypto=require(_0xd692('0x9'));var jsforce=require(_0xd692('0xa'));var deskjs=require(_0xd692('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd692('0xc'));var Papa=require(_0xd692('0xd'));var Redis=require('ioredis');var authService=require(_0xd692('0xe'));var qs=require(_0xd692('0xf'));var as=require(_0xd692('0x10'));var hardwareService=require(_0xd692('0x11'));var logger=require(_0xd692('0x12'))('api');var utils=require(_0xd692('0x13'));var config=require(_0xd692('0x14'));var licenseUtil=require(_0xd692('0x15'));var db=require(_0xd692('0x16'))['db'];function respondWithStatusCode(_0x49b12c,_0x1d9a6f){_0x1d9a6f=_0x1d9a6f||0xcc;return function(_0x54ab9d){if(_0x54ab9d){return _0x49b12c[_0xd692('0x17')](_0x1d9a6f);}return _0x49b12c[_0xd692('0x18')](_0x1d9a6f)['end']();};}function respondWithResult(_0xb74594,_0x42b193){_0x42b193=_0x42b193||0xc8;return function(_0x128faa){if(_0x128faa){return _0xb74594[_0xd692('0x18')](_0x42b193)[_0xd692('0x19')](_0x128faa);}};}function respondWithFilteredResult(_0x164636,_0x2db5f3){return function(_0x2bf3a0){if(_0x2bf3a0){var _0x59ec9f=typeof _0x2db5f3[_0xd692('0x1a')]===_0xd692('0x1b')&&typeof _0x2db5f3['limit']===_0xd692('0x1b');var _0x41ba66=_0x2bf3a0[_0xd692('0x1c')];var _0x7d7f54=_0x59ec9f?0x0:_0x2db5f3[_0xd692('0x1a')];var _0x536996=_0x59ec9f?_0x2bf3a0[_0xd692('0x1c')]:_0x2db5f3[_0xd692('0x1a')]+_0x2db5f3[_0xd692('0x1d')];var _0x1fde5d;if(_0x536996>=_0x41ba66){_0x536996=_0x41ba66;_0x1fde5d=0xc8;}else{_0x1fde5d=0xce;}_0x164636[_0xd692('0x18')](_0x1fde5d);return _0x164636[_0xd692('0x1e')]('Content-Range',_0x7d7f54+'-'+_0x536996+'/'+_0x41ba66)[_0xd692('0x19')](_0x2bf3a0);}return null;};}function patchUpdates(_0x222de0){return function(_0x49cbde){try{jsonpatch[_0xd692('0x1f')](_0x49cbde,_0x222de0,!![]);}catch(_0x32a461){return BPromise[_0xd692('0x20')](_0x32a461);}return _0x49cbde['save']();};}function saveUpdates(_0xde07d3,_0x87ab73){return function(_0x39565d){if(_0x39565d){return _0x39565d[_0xd692('0x21')](_0xde07d3)['then'](function(_0x414a39){return _0x414a39;});}return null;};}function removeEntity(_0x5bebe0,_0x112449){return function(_0x5a1971){if(_0x5a1971){return _0x5a1971[_0xd692('0x22')]()[_0xd692('0x23')](function(){_0x5bebe0[_0xd692('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x191d9d,_0x4eb990){return function(_0x3e712c){if(!_0x3e712c){_0x191d9d[_0xd692('0x17')](0x194);}return _0x3e712c;};}function handleError(_0x2da750,_0x1a1e0d){_0x1a1e0d=_0x1a1e0d||0x1f4;return function(_0x5df2c8){logger[_0xd692('0x24')](_0x5df2c8[_0xd692('0x25')]);if(_0x5df2c8[_0xd692('0x26')]){delete _0x5df2c8[_0xd692('0x26')];}_0x2da750[_0xd692('0x18')](_0x1a1e0d)[_0xd692('0x27')](_0x5df2c8);};}exports['index']=function(_0x5ef0e5,_0x45594f){var _0x5c6572={},_0x4f1f6f={},_0x16e2a4={'count':0x0,'rows':[]};var _0x185b1b=_['map'](db[_0xd692('0x28')][_0xd692('0x29')],function(_0x515445){return{'name':_0x515445[_0xd692('0x2a')],'type':_0x515445[_0xd692('0x2b')][_0xd692('0x2c')]};});_0x4f1f6f[_0xd692('0x2d')]=_[_0xd692('0x2e')](_0x185b1b,'name');_0x4f1f6f['query']=_[_0xd692('0x2f')](_0x5ef0e5[_0xd692('0x30')]);_0x4f1f6f[_0xd692('0x31')]=_['intersection'](_0x4f1f6f['model'],_0x4f1f6f['query']);_0x5c6572['attributes']=_['intersection'](_0x4f1f6f['model'],qs[_0xd692('0x32')](_0x5ef0e5['query'][_0xd692('0x32')]));_0x5c6572[_0xd692('0x33')]=_0x5c6572[_0xd692('0x33')][_0xd692('0x34')]?_0x5c6572['attributes']:_0x4f1f6f['model'];if(!_0x5ef0e5[_0xd692('0x30')][_0xd692('0x35')](_0xd692('0x36'))){_0x5c6572[_0xd692('0x1d')]=qs[_0xd692('0x1d')](_0x5ef0e5[_0xd692('0x30')][_0xd692('0x1d')]);_0x5c6572[_0xd692('0x1a')]=qs[_0xd692('0x1a')](_0x5ef0e5['query']['offset']);}_0x5c6572[_0xd692('0x37')]=qs['sort'](_0x5ef0e5[_0xd692('0x30')][_0xd692('0x38')]);_0x5c6572[_0xd692('0x39')]=qs[_0xd692('0x31')](_[_0xd692('0x3a')](_0x5ef0e5[_0xd692('0x30')],_0x4f1f6f[_0xd692('0x31')]),_0x185b1b);if(_0x5ef0e5[_0xd692('0x30')][_0xd692('0x3b')]){_0x5c6572[_0xd692('0x39')]=_[_0xd692('0x3c')](_0x5c6572[_0xd692('0x39')],{'$or':_['map'](_0x185b1b,function(_0x592b2f){if(_0x592b2f['type']!==_0xd692('0x3d')){var _0x2aa529={};_0x2aa529[_0x592b2f[_0xd692('0x26')]]={'$like':'%'+_0x5ef0e5['query'][_0xd692('0x3b')]+'%'};return _0x2aa529;}})});}_0x5c6572=_[_0xd692('0x3c')]({},_0x5c6572,_0x5ef0e5[_0xd692('0x3e')]);var _0x1265c2={'where':_0x5c6572[_0xd692('0x39')]};return db[_0xd692('0x28')]['count'](_0x1265c2)[_0xd692('0x23')](function(_0x3c8051){_0x16e2a4[_0xd692('0x1c')]=_0x3c8051;if(_0x5ef0e5[_0xd692('0x30')][_0xd692('0x3f')]){_0x5c6572[_0xd692('0x40')]=[{'all':!![]}];}return db[_0xd692('0x28')][_0xd692('0x41')](_0x5c6572);})[_0xd692('0x23')](function(_0x5d6908){_0x16e2a4[_0xd692('0x42')]=_0x5d6908;return _0x16e2a4;})[_0xd692('0x23')](respondWithFilteredResult(_0x45594f,_0x5c6572))[_0xd692('0x43')](handleError(_0x45594f,null));};exports[_0xd692('0x44')]=function(_0x136525,_0x1a188e){var _0x24aafd={'raw':!![],'where':{'id':_0x136525['params']['id']}},_0x2fbdbb={};_0x2fbdbb[_0xd692('0x2d')]=_[_0xd692('0x2f')](db[_0xd692('0x28')][_0xd692('0x29')]);_0x2fbdbb[_0xd692('0x30')]=_[_0xd692('0x2f')](_0x136525[_0xd692('0x30')]);_0x2fbdbb[_0xd692('0x31')]=_[_0xd692('0x45')](_0x2fbdbb[_0xd692('0x2d')],_0x2fbdbb[_0xd692('0x30')]);_0x24aafd[_0xd692('0x33')]=_[_0xd692('0x45')](_0x2fbdbb['model'],qs[_0xd692('0x32')](_0x136525['query'][_0xd692('0x32')]));_0x24aafd[_0xd692('0x33')]=_0x24aafd[_0xd692('0x33')][_0xd692('0x34')]?_0x24aafd[_0xd692('0x33')]:_0x2fbdbb[_0xd692('0x2d')];if(_0x136525[_0xd692('0x30')][_0xd692('0x3f')]){_0x24aafd[_0xd692('0x40')]=[{'all':!![]}];}_0x24aafd=_[_0xd692('0x3c')]({},_0x24aafd,_0x136525[_0xd692('0x3e')]);return db[_0xd692('0x28')][_0xd692('0x46')](_0x24aafd)[_0xd692('0x23')](handleEntityNotFound(_0x1a188e,null))[_0xd692('0x23')](respondWithResult(_0x1a188e,null))[_0xd692('0x43')](handleError(_0x1a188e,null));};exports['create']=function(_0x13480b,_0x579921){return db[_0xd692('0x28')]['create'](_0x13480b[_0xd692('0x47')],{})[_0xd692('0x23')](respondWithResult(_0x579921,0xc9))[_0xd692('0x43')](handleError(_0x579921,null));};exports[_0xd692('0x21')]=function(_0x289eaf,_0x46d5c1){if(_0x289eaf['body']['id']){delete _0x289eaf['body']['id'];}return db[_0xd692('0x28')][_0xd692('0x46')]({'where':{'id':_0x289eaf['params']['id']}})[_0xd692('0x23')](handleEntityNotFound(_0x46d5c1,null))[_0xd692('0x23')](saveUpdates(_0x289eaf[_0xd692('0x47')],null))['then'](respondWithResult(_0x46d5c1,null))[_0xd692('0x43')](handleError(_0x46d5c1,null));};exports[_0xd692('0x22')]=function(_0x4d9354,_0x40849d){return db['VoiceTransferReport'][_0xd692('0x46')]({'where':{'id':_0x4d9354[_0xd692('0x48')]['id']}})[_0xd692('0x23')](handleEntityNotFound(_0x40849d,null))[_0xd692('0x23')](removeEntity(_0x40849d,null))[_0xd692('0x43')](handleError(_0x40849d,null));};exports[_0xd692('0x49')]=function(_0xb11460,_0x2aac9d){return db[_0xd692('0x28')][_0xd692('0x49')]()[_0xd692('0x23')](respondWithResult(_0x2aac9d,null))['catch'](handleError(_0x2aac9d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 927b226..552775b 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 _0xae0c=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xae0c,0x18b));var _0xcae0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xae0c[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xcae0('0x0'));var logger=require(_0xcae0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcae0('0x2'));var rp=require(_0xcae0('0x3'));var fs=require('fs');var path=require(_0xcae0('0x4'));var rimraf=require(_0xcae0('0x5'));var config=require(_0xcae0('0x6'));var attributes=require(_0xcae0('0x7'));module[_0xcae0('0x8')]=function(_0x13d756,_0x3bbaff){return _0x13d756[_0xcae0('0x9')](_0xcae0('0xa'),attributes,{'tableName':_0xcae0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff7e=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ce9c5,_0x15ed3d){var _0x17164f=function(_0x512c3b){while(--_0x512c3b){_0x5ce9c5['push'](_0x5ce9c5['shift']());}};_0x17164f(++_0x15ed3d);}(_0xff7e,0x91));var _0xeff7=function(_0x11fd40,_0x2b13ab){_0x11fd40=_0x11fd40-0x0;var _0x11f2e4=_0xff7e[_0x11fd40];return _0x11f2e4;};'use strict';var _=require(_0xeff7('0x0'));var util=require(_0xeff7('0x1'));var logger=require(_0xeff7('0x2'))(_0xeff7('0x3'));var moment=require(_0xeff7('0x4'));var BPromise=require(_0xeff7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeff7('0x6'));var rimraf=require(_0xeff7('0x7'));var config=require(_0xeff7('0x8'));var attributes=require(_0xeff7('0x9'));module[_0xeff7('0xa')]=function(_0x4c2d16,_0x314a69){return _0x4c2d16[_0xeff7('0xb')](_0xeff7('0xc'),attributes,{'tableName':_0xeff7('0xd'),'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 4b9354e..8d46d3d 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 _0x15d8=['http','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56350f,_0x230d89){var _0x130e5c=function(_0x88bfec){while(--_0x88bfec){_0x56350f['push'](_0x56350f['shift']());}};_0x130e5c(++_0x230d89);}(_0x15d8,0x189));var _0x815d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x815d('0x0'));var util=require(_0x815d('0x1'));var moment=require(_0x815d('0x2'));var BPromise=require(_0x815d('0x3'));var rs=require(_0x815d('0x4'));var fs=require('fs');var Redis=require(_0x815d('0x5'));var db=require(_0x815d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x815d('0x7'))(_0x815d('0x8'));var config=require(_0x815d('0x9'));var jayson=require(_0x815d('0xa'));var client=jayson[_0x815d('0xb')][_0x815d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3be48f,_0xd6a0b3,_0x2ee9b8){return new BPromise(function(_0x524e35,_0x70a23f){return client[_0x815d('0xd')](_0x3be48f,_0x2ee9b8)[_0x815d('0xe')](function(_0x4ffe01){logger[_0x815d('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xd6a0b3,_0x815d('0x10'));logger['debug'](_0x815d('0x11'),_0xd6a0b3,_0x815d('0x10'),JSON['stringify'](_0x4ffe01));if(_0x4ffe01[_0x815d('0x12')]){if(_0x4ffe01['error']['code']===0x1f4){logger[_0x815d('0x12')](_0x815d('0x13'),_0xd6a0b3,_0x4ffe01[_0x815d('0x12')][_0x815d('0x14')]);return _0x70a23f(_0x4ffe01[_0x815d('0x12')]['message']);}logger[_0x815d('0x12')](_0x815d('0x13'),_0xd6a0b3,_0x4ffe01[_0x815d('0x12')][_0x815d('0x14')]);return _0x524e35(_0x4ffe01[_0x815d('0x12')][_0x815d('0x14')]);}else{logger[_0x815d('0xf')](_0x815d('0x13'),_0xd6a0b3,'request\x20sent');_0x524e35(_0x4ffe01[_0x815d('0x15')][_0x815d('0x14')]);}})[_0x815d('0x16')](function(_0x207bd0){logger[_0x815d('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0xd6a0b3,_0x207bd0);_0x70a23f(_0x207bd0);});});}exports[_0x815d('0x17')]=function(_0x12bc29){var _0x5e6bd6=this;return new Promise(function(_0x169c4e,_0x3fbd23){return db['VoiceTransferReport']['create'](_0x12bc29[_0x815d('0x18')],{'raw':_0x12bc29[_0x815d('0x19')]?_0x12bc29['options']['raw']===undefined?!![]:![]:!![]})[_0x815d('0xe')](function(_0x349d40){logger[_0x815d('0xf')](_0x815d('0x17'),_0x12bc29);logger[_0x815d('0x1a')]('CreateVoiceTransferReport',_0x12bc29,JSON['stringify'](_0x349d40));_0x169c4e(_0x349d40);})['catch'](function(_0x22bc44){logger['error'](_0x815d('0x17'),_0x22bc44[_0x815d('0x14')],_0x12bc29);_0x3fbd23(_0x5e6bd6[_0x815d('0x12')](0x1f4,_0x22bc44[_0x815d('0x14')]));});});}; \ No newline at end of file +var _0xd21c=['CreateVoiceTransferReport','create','body','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result'];(function(_0x382c52,_0x2129ac){var _0x253476=function(_0x4d539a){while(--_0x4d539a){_0x382c52['push'](_0x382c52['shift']());}};_0x253476(++_0x2129ac);}(_0xd21c,0x115));var _0xcd21=function(_0x51b72e,_0x408f4f){_0x51b72e=_0x51b72e-0x0;var _0xa108e1=_0xd21c[_0x51b72e];return _0xa108e1;};'use strict';var _=require(_0xcd21('0x0'));var util=require(_0xcd21('0x1'));var moment=require(_0xcd21('0x2'));var BPromise=require(_0xcd21('0x3'));var rs=require(_0xcd21('0x4'));var fs=require('fs');var Redis=require(_0xcd21('0x5'));var db=require(_0xcd21('0x6'))['db'];var utils=require(_0xcd21('0x7'));var logger=require(_0xcd21('0x8'))(_0xcd21('0x9'));var config=require(_0xcd21('0xa'));var jayson=require(_0xcd21('0xb'));var client=jayson['client'][_0xcd21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x311024,_0x12069a,_0x4d5fd4){return new BPromise(function(_0x2ad598,_0x20a2c8){return client[_0xcd21('0xd')](_0x311024,_0x4d5fd4)['then'](function(_0x421e99){logger[_0xcd21('0xe')](_0xcd21('0xf'),_0x12069a,'request\x20sent');logger[_0xcd21('0x10')](_0xcd21('0x11'),_0x12069a,'request\x20sent',JSON[_0xcd21('0x12')](_0x421e99));if(_0x421e99[_0xcd21('0x13')]){if(_0x421e99[_0xcd21('0x13')]['code']===0x1f4){logger[_0xcd21('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x12069a,_0x421e99[_0xcd21('0x13')]['message']);return _0x20a2c8(_0x421e99['error']['message']);}logger[_0xcd21('0x13')](_0xcd21('0xf'),_0x12069a,_0x421e99['error']['message']);return _0x2ad598(_0x421e99[_0xcd21('0x13')][_0xcd21('0x14')]);}else{logger[_0xcd21('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x12069a,_0xcd21('0x15'));_0x2ad598(_0x421e99[_0xcd21('0x16')][_0xcd21('0x14')]);}})['catch'](function(_0x379aea){logger[_0xcd21('0x13')](_0xcd21('0xf'),_0x12069a,_0x379aea);_0x20a2c8(_0x379aea);});});}exports[_0xcd21('0x17')]=function(_0x3b0b59){var _0x3f5f89=this;return new Promise(function(_0x5880ab,_0x290722){return db['VoiceTransferReport'][_0xcd21('0x18')](_0x3b0b59[_0xcd21('0x19')],{'raw':_0x3b0b59[_0xcd21('0x1a')]?_0x3b0b59[_0xcd21('0x1a')][_0xcd21('0x1b')]===undefined?!![]:![]:!![]})[_0xcd21('0x1c')](function(_0x7b14b5){logger[_0xcd21('0xe')]('CreateVoiceTransferReport',_0x3b0b59);logger[_0xcd21('0x10')]('CreateVoiceTransferReport',_0x3b0b59,JSON['stringify'](_0x7b14b5));_0x5880ab(_0x7b14b5);})[_0xcd21('0x1d')](function(_0xfab39c){logger['error']('CreateVoiceTransferReport',_0xfab39c[_0xcd21('0x14')],_0x3b0b59);_0x290722(_0x3f5f89[_0xcd21('0x13')](0x1f4,_0xfab39c['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 659fc0c..7e0b2fa 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 _0xdee3=['/unhold','unhold','/calls','/transfer','express','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','hangup','/answer','answer','/hold','hold'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xdee3,0xf2));var _0x3dee=function(_0x23cd5a,_0x45de7d){_0x23cd5a=_0x23cd5a-0x0;var _0x4e4719=_0xdee3[_0x23cd5a];return _0x4e4719;};'use strict';var express=require(_0x3dee('0x0'));var router=express[_0x3dee('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3dee('0x2'));router[_0x3dee('0x3')](_0x3dee('0x4'),auth[_0x3dee('0x5')](),auth[_0x3dee('0x6')](),controller[_0x3dee('0x7')]);router[_0x3dee('0x3')]('/hangup',auth[_0x3dee('0x5')](),auth['canUpdate'](),controller[_0x3dee('0x8')]);router[_0x3dee('0x3')](_0x3dee('0x9'),auth[_0x3dee('0x5')](),auth[_0x3dee('0x6')](),controller[_0x3dee('0xa')]);router[_0x3dee('0x3')](_0x3dee('0xb'),auth[_0x3dee('0x5')](),auth['canUpdate'](),controller[_0x3dee('0xc')]);router['post'](_0x3dee('0xd'),auth[_0x3dee('0x5')](),auth[_0x3dee('0x6')](),controller[_0x3dee('0xe')]);router[_0x3dee('0x3')](_0x3dee('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller['calls']);router[_0x3dee('0x3')](_0x3dee('0x10'),auth[_0x3dee('0x5')](),auth[_0x3dee('0x6')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x877f=['/unhold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','hangup','/hold','hold'];(function(_0x13bb76,_0x39491f){var _0x2cbfb4=function(_0x54247e){while(--_0x54247e){_0x13bb76['push'](_0x13bb76['shift']());}};_0x2cbfb4(++_0x39491f);}(_0x877f,0x136));var _0xf877=function(_0x34b0b9,_0x492746){_0x34b0b9=_0x34b0b9-0x0;var _0x24fb0e=_0x877f[_0x34b0b9];return _0x24fb0e;};'use strict';var express=require('express');var router=express[_0xf877('0x0')]();var auth=require(_0xf877('0x1'));var controller=require(_0xf877('0x2'));router[_0xf877('0x3')]('/originate',auth[_0xf877('0x4')](),auth[_0xf877('0x5')](),controller[_0xf877('0x6')]);router[_0xf877('0x3')]('/hangup',auth[_0xf877('0x4')](),auth[_0xf877('0x5')](),controller[_0xf877('0x7')]);router[_0xf877('0x3')]('/answer',auth[_0xf877('0x4')](),auth['canUpdate'](),controller['answer']);router[_0xf877('0x3')](_0xf877('0x8'),auth[_0xf877('0x4')](),auth[_0xf877('0x5')](),controller[_0xf877('0x9')]);router[_0xf877('0x3')](_0xf877('0xa'),auth[_0xf877('0x4')](),auth['canUpdate'](),controller[_0xf877('0xb')]);router[_0xf877('0x3')]('/calls',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xf877('0xc')]);router[_0xf877('0x3')](_0xf877('0xd'),auth[_0xf877('0x4')](),auth[_0xf877('0x5')](),controller[_0xf877('0xe')]);module[_0xf877('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 365e8bc..b55e834 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 _0x4b1f=['originate','info','originate\x20fired:','body','validate','userId','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','json','hangup\x20executed!','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','path','lodash','../../config/environment','util','bluebird','client','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','callNumber\x20is\x20required','number','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','result','catch','User','agent','all','UserId','sessionId','length','sessionId\x20'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b1f,0x195));var _0xf4b1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4b1f[_0x57b54c];return _0x59cc19;};'use strict';var path=require(_0xf4b1('0x0'));var fs=require('fs');var _=require(_0xf4b1('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xf4b1('0x2'));var util=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xf4b1('0x5')][_0xf4b1('0x6')]({'port':0x232a});var logger=require(_0xf4b1('0x7'))('webbarapi');var Redis=require('ioredis');config[_0xf4b1('0x8')]=_[_0xf4b1('0x9')](config[_0xf4b1('0x8')],{'host':_0xf4b1('0xa'),'port':0x18eb});var io=require(_0xf4b1('0xb'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf4b1('0xc')]},'callNumber':{'type':'string','required':[!![],_0xf4b1('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],_0xf4b1('0xc')]},'sessionId':{'type':_0xf4b1('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],_0xf4b1('0xc')]},'sessionId':{'type':_0xf4b1('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],_0xf4b1('0xc')]},'sessionId':{'type':_0xf4b1('0xf'),'required':[!![],_0xf4b1('0x10')]},'transferNumber':{'type':_0xf4b1('0xf'),'required':[!![],_0xf4b1('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf4b1('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf4b1('0xc')]}});function emit(_0x4968f4,_0x5e7206,_0x554517){logger['info'](_0x4968f4,_0x5e7206,JSON[_0xf4b1('0x12')](_0x554517));io['to'](_0x4968f4)[_0xf4b1('0x13')](_0x5e7206,_0x554517);}function handleError(_0x534fd8){return function(_0x3b378e){console[_0xf4b1('0x14')](_0xf4b1('0x15'),_0x3b378e,_0x3b378e instanceof RangeError);logger[_0xf4b1('0x16')](_0x3b378e[_0xf4b1('0x17')]);if(_0x3b378e instanceof RangeError){if(_0x3b378e[_0xf4b1('0x18')]){delete _0x3b378e['name'];}_0x534fd8[_0xf4b1('0x19')](0x194)[_0xf4b1('0x1a')](_0x3b378e);}else{if(_0x3b378e['name']){delete _0x3b378e[_0xf4b1('0x18')];}_0x534fd8[_0xf4b1('0x19')](0x1f4)['send'](_0x3b378e);}};}function checkError(){return function(_0x13892d){if(!_0x13892d){throw new RangeError(_0xf4b1('0x1b'));}return _0x13892d;};}function respondWithRpcPromise(_0xbfab1e,_0x466739){return new BPromise(function(_0x5c50e8,_0x20013c){var _0x29b8c1=amiClient;return _0x29b8c1[_0xf4b1('0x1c')](_0xbfab1e,_0x466739)[_0xf4b1('0x1d')](function(_0x58376d){if(_0x58376d[_0xf4b1('0x16')]){if(_0x58376d[_0xf4b1('0x16')]['code']===0x1f4){return _0x20013c(_0x58376d[_0xf4b1('0x16')]['message']);}return _0x5c50e8(_0x58376d[_0xf4b1('0x16')]['message']);}else{_0x5c50e8(_0x58376d[_0xf4b1('0x1e')]);}})[_0xf4b1('0x1f')](function(_0x2e803d){_0x20013c(_0x2e803d);});});}function getAgent(_0x5a0285){return db[_0xf4b1('0x20')]['findOne']({'where':{'id':_0x5a0285,'role':_0xf4b1('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x29493b,_0x447ae7){return new BPromise(function(_0x5d28af,_0x22353e){var _0x23693b=respondWithRpcPromise('VoiceChannels');var _0x125bf4=getAgent(_0x29493b);Promise[_0xf4b1('0x22')]([_0x23693b,_0x125bf4])[_0xf4b1('0x1d')](function(_0x11ffb3){var _0x3046dc=_0x11ffb3[0x0];var _0x36243e=_0x11ffb3[0x1];var _0x2f830c=_['filter'](_0x3046dc['rows'],function(_0x31c13c){return _0x31c13c[_0xf4b1('0x23')]==_0x36243e['id']&&_0x31c13c[_0xf4b1('0x24')]==_0x447ae7;});if(_0x2f830c[_0xf4b1('0x25')]==0x1){_0x5d28af(_0x36243e);}else{_0x22353e(new RangeError(_0xf4b1('0x26')+_0x447ae7+'\x20not\x20found!'));}});});}exports[_0xf4b1('0x27')]=function(_0xa08452,_0xa6bdd7){logger[_0xf4b1('0x28')](_0xf4b1('0x29'),_0xa08452[_0xf4b1('0x2a')]);var _0x186dd3=originateValidation[_0xf4b1('0x2b')](_0xa08452['body']);if(_0x186dd3[_0xf4b1('0x25')]>0x0){return _0xa6bdd7['status'](0x190)['json'](_0x186dd3);}var _0x48f672=_0xa08452[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x75f753=_0xa08452[_0xf4b1('0x2a')][_0xf4b1('0x2d')];var _0x2ddbc8=_0xa08452[_0xf4b1('0x2a')][_0xf4b1('0x2e')];var _0x55a5a6=_0xa08452[_0xf4b1('0x2a')]['callbackUrl'];return getAgent(_0x48f672)[_0xf4b1('0x1d')](function(_0x303290){logger['info'](_0xf4b1('0x2f'),_0x303290[_0xf4b1('0x18')]);emit(util[_0xf4b1('0x30')](_0xf4b1('0x31'),_0x303290[_0xf4b1('0x18')]),'webbar:originate',{'callNumber':_0x75f753,'callerId':_0x2ddbc8,'callbackUrl':_0x55a5a6});return _0xa6bdd7[_0xf4b1('0x19')](0xc8)['json']({'error':![],'message':_0xf4b1('0x32')});})['catch'](handleError(_0xa6bdd7));};exports[_0xf4b1('0x33')]=function(_0x366621,_0xfe587f){logger['info'](_0xf4b1('0x34'),_0x366621[_0xf4b1('0x2a')]);var _0x207020=hangupValidation[_0xf4b1('0x2b')](_0x366621[_0xf4b1('0x2a')]);if(_0x207020[_0xf4b1('0x25')]>0x0){return _0xfe587f[_0xf4b1('0x19')](0x190)['json'](_0x207020);}var _0x393da0=_0x366621[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x3553c3=_0x366621[_0xf4b1('0x2a')][_0xf4b1('0x24')];return getAgent(_0x393da0)['then'](function(_0x33879b){logger[_0xf4b1('0x28')]('entityFound:',_0x33879b['name']);emit(util[_0xf4b1('0x30')](_0xf4b1('0x31'),_0x33879b[_0xf4b1('0x18')]),_0xf4b1('0x35'),{'sessionId':_0x3553c3});return _0xfe587f[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x37')});})[_0xf4b1('0x1f')](handleError(_0xfe587f));};exports['answer']=function(_0x3a4383,_0x5e9da4){logger['info']('answer\x20fired:',_0x3a4383[_0xf4b1('0x2a')]);var _0x3feed5=answerValidation[_0xf4b1('0x2b')](_0x3a4383['body']);if(_0x3feed5[_0xf4b1('0x25')]>0x0){return _0x5e9da4[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x3feed5);}var _0x5597d5=_0x3a4383[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x1f856c=_0x3a4383['body'][_0xf4b1('0x24')];return getAgent(_0x5597d5)['then'](function(_0x2e4f2a){logger[_0xf4b1('0x28')](_0xf4b1('0x2f'),_0x2e4f2a['name']);emit(util[_0xf4b1('0x30')](_0xf4b1('0x31'),_0x2e4f2a['name']),_0xf4b1('0x38'),{'sessionId':_0x1f856c});return _0x5e9da4[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x39')});})['catch'](handleError(_0x5e9da4));};exports['hold']=function(_0x14cdc6,_0x1638a6){logger['info'](_0xf4b1('0x3a'),_0x14cdc6['body']);var _0x202381=holdValidation['validate'](_0x14cdc6[_0xf4b1('0x2a')]);if(_0x202381[_0xf4b1('0x25')]>0x0){return _0x1638a6['status'](0x190)[_0xf4b1('0x36')](_0x202381);}var _0x104819=_0x14cdc6[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x2f4c27=_0x14cdc6[_0xf4b1('0x2a')][_0xf4b1('0x24')];return getAgent(_0x104819)[_0xf4b1('0x1d')](function(_0x4e6e04){logger['info'](_0xf4b1('0x2f'),_0x4e6e04[_0xf4b1('0x18')]);emit(util['format'](_0xf4b1('0x31'),_0x4e6e04[_0xf4b1('0x18')]),_0xf4b1('0x3b'),{'sessionId':_0x2f4c27});return _0x1638a6[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x3c')});})[_0xf4b1('0x1f')](handleError(_0x1638a6));};exports[_0xf4b1('0x3d')]=function(_0x29c3c1,_0x2bca13){logger[_0xf4b1('0x28')](_0xf4b1('0x3e'),_0x29c3c1[_0xf4b1('0x2a')]);var _0x1bf70f=unholdValidation[_0xf4b1('0x2b')](_0x29c3c1[_0xf4b1('0x2a')]);if(_0x1bf70f[_0xf4b1('0x25')]>0x0){return _0x2bca13[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x1bf70f);}var _0x3a1362=_0x29c3c1[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x38efcd=_0x29c3c1[_0xf4b1('0x2a')][_0xf4b1('0x24')];return getAgent(_0x3a1362)[_0xf4b1('0x1d')](function(_0x755ecb){logger[_0xf4b1('0x28')]('entityFound:',_0x755ecb[_0xf4b1('0x18')]);emit(util['format']('user:%s',_0x755ecb[_0xf4b1('0x18')]),_0xf4b1('0x3f'),{'sessionId':_0x38efcd});return _0x2bca13['status'](0xc8)[_0xf4b1('0x36')]({'error':![],'message':_0xf4b1('0x40')});})[_0xf4b1('0x1f')](handleError(_0x2bca13));};exports['calls']=function(_0x59b8e8,_0x1fc659){logger[_0xf4b1('0x28')](_0xf4b1('0x41'),_0x1fc659[_0xf4b1('0x2a')]);var _0x402e6c=callsValidation[_0xf4b1('0x2b')](_0x59b8e8[_0xf4b1('0x2a')]);if(_0x402e6c[_0xf4b1('0x25')]>0x0){return _0x1fc659[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x402e6c);}var _0x1fec6d=_0x59b8e8[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x24d0a6=respondWithRpcPromise('VoiceChannels');var _0x193bab=getAgent(_0x1fec6d);return Promise[_0xf4b1('0x22')]([_0x24d0a6,_0x193bab])[_0xf4b1('0x1d')](function(_0x427126){var _0xb53593=_0x427126[0x0];var _0x43d373=_0x427126[0x1];var _0xe7b6a3=_[_0xf4b1('0x42')](_0xb53593[_0xf4b1('0x43')],function(_0x47abe5){return _0x47abe5[_0xf4b1('0x23')]==_0x43d373['id'];});return _0x1fc659[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'count':_0xe7b6a3['length'],'rows':_0xe7b6a3});})['catch'](handleError(_0x1fc659));};exports[_0xf4b1('0x44')]=function(_0x1cc591,_0x4db29b){logger[_0xf4b1('0x28')](_0xf4b1('0x45'),_0x1cc591[_0xf4b1('0x2a')]);var _0x22d27f=conferenceValidation[_0xf4b1('0x2b')](_0x1cc591[_0xf4b1('0x2a')]);if(_0x22d27f[_0xf4b1('0x25')]>0x0){return _0x4db29b[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x22d27f);}var _0x36cf63=_0x1cc591[_0xf4b1('0x2a')]['userId'];return getAgent(_0x36cf63)[_0xf4b1('0x1d')](function(_0x350d07){logger['info'](_0xf4b1('0x2f'),_0x350d07[_0xf4b1('0x18')]);emit(util[_0xf4b1('0x30')]('user:%s',_0x350d07[_0xf4b1('0x18')]),_0xf4b1('0x46'));return _0x4db29b['status'](0xc8)['json']({'error':![],'message':_0xf4b1('0x47')});})['catch'](handleError(_0x4db29b));};exports['transfer']=function(_0x2de44d,_0x844121){logger['info']('transfer\x20fired:',_0x2de44d[_0xf4b1('0x2a')]);var _0x17eb9e=transferValidation['validate'](_0x2de44d[_0xf4b1('0x2a')]);if(_0x17eb9e[_0xf4b1('0x25')]>0x0){return _0x844121[_0xf4b1('0x19')](0x190)[_0xf4b1('0x36')](_0x17eb9e);}var _0xe82df1=_0x2de44d[_0xf4b1('0x2a')][_0xf4b1('0x2c')];var _0x55341b=_0x2de44d[_0xf4b1('0x2a')][_0xf4b1('0x24')];var _0xca5281=_0x2de44d[_0xf4b1('0x2a')][_0xf4b1('0x48')];return getAgent(_0xe82df1)[_0xf4b1('0x1d')](function(_0xe9ac5){logger['info']('entityFound:',_0xe9ac5[_0xf4b1('0x18')]);emit(util[_0xf4b1('0x30')]('user:%s',_0xe9ac5[_0xf4b1('0x18')]),_0xf4b1('0x49'),{'sessionId':_0x55341b,'transferNumber':_0xca5281});return _0x844121[_0xf4b1('0x19')](0xc8)[_0xf4b1('0x36')]({'error':![],'message':'transfer\x20executed!'});})[_0xf4b1('0x1f')](handleError(_0x844121));}; \ No newline at end of file +var _0xb43b=['ioredis','redis','validate','number','userId\x20is\x20required','string','info','stringify','emit','log','error','name','status','send','NotFound','request','then','code','message','result','User','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','json','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','user:%s','answer\x20executed!','hold','hold\x20fired:','webbar:hold','calls','calls\x20fired:','all','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi'];(function(_0x293b97,_0x22add9){var _0x198280=function(_0x5cb2a3){while(--_0x5cb2a3){_0x293b97['push'](_0x293b97['shift']());}};_0x198280(++_0x22add9);}(_0xb43b,0xbf));var _0xbb43=function(_0x46656c,_0x4925fe){_0x46656c=_0x46656c-0x0;var _0x10f5c4=_0xb43b[_0x46656c];return _0x10f5c4;};'use strict';var path=require(_0xbb43('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xbb43('0x1'))['db'];var config=require(_0xbb43('0x2'));var util=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var jayson=require(_0xbb43('0x5'));var amiClient=jayson[_0xbb43('0x6')][_0xbb43('0x7')]({'port':0x232a});var logger=require(_0xbb43('0x8'))(_0xbb43('0x9'));var Redis=require(_0xbb43('0xa'));config[_0xbb43('0xb')]=_['defaults'](config[_0xbb43('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb43('0xb')]));var Schema=require(_0xbb43('0xc'));var originateValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'callNumber':{'type':_0xbb43('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xbb43('0xf')},'callbackUrl':{'type':_0xbb43('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xbb43('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xbb43('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':_0xbb43('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xbb43('0xd'),'required':[!![],_0xbb43('0xe')]}});function emit(_0x15182b,_0x10c91b,_0x3be44b){logger[_0xbb43('0x10')](_0x15182b,_0x10c91b,JSON[_0xbb43('0x11')](_0x3be44b));io['to'](_0x15182b)[_0xbb43('0x12')](_0x10c91b,_0x3be44b);}function handleError(_0x20b839){return function(_0x4c223b){console[_0xbb43('0x13')]('handleError:',_0x4c223b,_0x4c223b instanceof RangeError);logger[_0xbb43('0x14')](_0x4c223b['stack']);if(_0x4c223b instanceof RangeError){if(_0x4c223b[_0xbb43('0x15')]){delete _0x4c223b[_0xbb43('0x15')];}_0x20b839[_0xbb43('0x16')](0x194)[_0xbb43('0x17')](_0x4c223b);}else{if(_0x4c223b['name']){delete _0x4c223b[_0xbb43('0x15')];}_0x20b839[_0xbb43('0x16')](0x1f4)[_0xbb43('0x17')](_0x4c223b);}};}function checkError(){return function(_0x6f34d6){if(!_0x6f34d6){throw new RangeError(_0xbb43('0x18'));}return _0x6f34d6;};}function respondWithRpcPromise(_0x57fc97,_0xee1084){return new BPromise(function(_0x1e83cd,_0x3409d0){var _0x3cb6d1=amiClient;return _0x3cb6d1[_0xbb43('0x19')](_0x57fc97,_0xee1084)[_0xbb43('0x1a')](function(_0x36992f){if(_0x36992f[_0xbb43('0x14')]){if(_0x36992f['error'][_0xbb43('0x1b')]===0x1f4){return _0x3409d0(_0x36992f[_0xbb43('0x14')]['message']);}return _0x1e83cd(_0x36992f[_0xbb43('0x14')][_0xbb43('0x1c')]);}else{_0x1e83cd(_0x36992f[_0xbb43('0x1d')]);}})['catch'](function(_0x4ea4c5){_0x3409d0(_0x4ea4c5);});});}function getAgent(_0x20f223){return db[_0xbb43('0x1e')]['findOne']({'where':{'id':_0x20f223,'role':'agent'}})[_0xbb43('0x1a')](checkError());}function getAgentCheckSession(_0xb9fe3b,_0x268fb5){return new BPromise(function(_0x4bb859,_0x27bb65){var _0x426cec=respondWithRpcPromise(_0xbb43('0x1f'));var _0x1a6e2b=getAgent(_0xb9fe3b);Promise['all']([_0x426cec,_0x1a6e2b])[_0xbb43('0x1a')](function(_0x170e7a){var _0x821beb=_0x170e7a[0x0];var _0x293d66=_0x170e7a[0x1];var _0x34b679=_[_0xbb43('0x20')](_0x821beb[_0xbb43('0x21')],function(_0x48986d){return _0x48986d[_0xbb43('0x22')]==_0x293d66['id']&&_0x48986d[_0xbb43('0x23')]==_0x268fb5;});if(_0x34b679[_0xbb43('0x24')]==0x1){_0x4bb859(_0x293d66);}else{_0x27bb65(new RangeError('sessionId\x20'+_0x268fb5+_0xbb43('0x25')));}});});}exports[_0xbb43('0x26')]=function(_0x9384d8,_0x168374){logger[_0xbb43('0x10')](_0xbb43('0x27'),_0x9384d8[_0xbb43('0x28')]);var _0xa86300=originateValidation[_0xbb43('0xc')](_0x9384d8['body']);if(_0xa86300['length']>0x0){return _0x168374['status'](0x190)['json'](_0xa86300);}var _0x352249=_0x9384d8[_0xbb43('0x28')][_0xbb43('0x29')];var _0xe5d75b=_0x9384d8[_0xbb43('0x28')][_0xbb43('0x2a')];var _0x3c8758=_0x9384d8[_0xbb43('0x28')]['callerId'];var _0x1cf664=_0x9384d8[_0xbb43('0x28')][_0xbb43('0x2b')];return getAgent(_0x352249)[_0xbb43('0x1a')](function(_0x4c65d0){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x4c65d0[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')]('user:%s',_0x4c65d0[_0xbb43('0x15')]),'webbar:originate',{'callNumber':_0xe5d75b,'callerId':_0x3c8758,'callbackUrl':_0x1cf664});return _0x168374[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x2f')});})[_0xbb43('0x30')](handleError(_0x168374));};exports[_0xbb43('0x31')]=function(_0x1c1f8b,_0x316ab1){logger[_0xbb43('0x10')](_0xbb43('0x32'),_0x1c1f8b[_0xbb43('0x28')]);var _0xfeaa38=hangupValidation[_0xbb43('0xc')](_0x1c1f8b['body']);if(_0xfeaa38[_0xbb43('0x24')]>0x0){return _0x316ab1[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0xfeaa38);}var _0x2db230=_0x1c1f8b[_0xbb43('0x28')][_0xbb43('0x29')];var _0x21e03d=_0x1c1f8b[_0xbb43('0x28')][_0xbb43('0x23')];return getAgent(_0x2db230)[_0xbb43('0x1a')](function(_0x1fe204){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x1fe204[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')]('user:%s',_0x1fe204[_0xbb43('0x15')]),_0xbb43('0x33'),{'sessionId':_0x21e03d});return _0x316ab1[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x34')});})[_0xbb43('0x30')](handleError(_0x316ab1));};exports['answer']=function(_0x13e9f7,_0x448c6f){logger['info']('answer\x20fired:',_0x13e9f7[_0xbb43('0x28')]);var _0x1eb63f=answerValidation[_0xbb43('0xc')](_0x13e9f7[_0xbb43('0x28')]);if(_0x1eb63f[_0xbb43('0x24')]>0x0){return _0x448c6f['status'](0x190)['json'](_0x1eb63f);}var _0x2ea37b=_0x13e9f7[_0xbb43('0x28')][_0xbb43('0x29')];var _0x2d1256=_0x13e9f7[_0xbb43('0x28')][_0xbb43('0x23')];return getAgent(_0x2ea37b)[_0xbb43('0x1a')](function(_0x1d8993){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x1d8993['name']);emit(util['format'](_0xbb43('0x35'),_0x1d8993[_0xbb43('0x15')]),'webbar:answer',{'sessionId':_0x2d1256});return _0x448c6f[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x36')});})[_0xbb43('0x30')](handleError(_0x448c6f));};exports[_0xbb43('0x37')]=function(_0x1fcb16,_0x3976f1){logger['info'](_0xbb43('0x38'),_0x1fcb16[_0xbb43('0x28')]);var _0x5970cc=holdValidation[_0xbb43('0xc')](_0x1fcb16[_0xbb43('0x28')]);if(_0x5970cc['length']>0x0){return _0x3976f1[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0x5970cc);}var _0xd1f32b=_0x1fcb16[_0xbb43('0x28')][_0xbb43('0x29')];var _0x43a840=_0x1fcb16[_0xbb43('0x28')][_0xbb43('0x23')];return getAgent(_0xd1f32b)[_0xbb43('0x1a')](function(_0x2f044f){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x2f044f['name']);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x2f044f[_0xbb43('0x15')]),_0xbb43('0x39'),{'sessionId':_0x43a840});return _0x3976f1['status'](0xc8)[_0xbb43('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0xbb43('0x30')](handleError(_0x3976f1));};exports['unhold']=function(_0x21f78b,_0x322a77){logger[_0xbb43('0x10')]('unhold\x20fired:',_0x21f78b[_0xbb43('0x28')]);var _0x218da6=unholdValidation[_0xbb43('0xc')](_0x21f78b['body']);if(_0x218da6[_0xbb43('0x24')]>0x0){return _0x322a77[_0xbb43('0x16')](0x190)['json'](_0x218da6);}var _0x42029c=_0x21f78b['body'][_0xbb43('0x29')];var _0x476116=_0x21f78b['body'][_0xbb43('0x23')];return getAgent(_0x42029c)[_0xbb43('0x1a')](function(_0x349390){logger['info'](_0xbb43('0x2c'),_0x349390['name']);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x349390[_0xbb43('0x15')]),'webbar:unhold',{'sessionId':_0x476116});return _0x322a77[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x322a77));};exports[_0xbb43('0x3a')]=function(_0x9e3707,_0x5b7b39){logger['info'](_0xbb43('0x3b'),_0x5b7b39['body']);var _0x30908e=callsValidation[_0xbb43('0xc')](_0x9e3707[_0xbb43('0x28')]);if(_0x30908e['length']>0x0){return _0x5b7b39['status'](0x190)['json'](_0x30908e);}var _0x55cb63=_0x9e3707['body'][_0xbb43('0x29')];var _0x31d265=respondWithRpcPromise(_0xbb43('0x1f'));var _0x4024bb=getAgent(_0x55cb63);return Promise[_0xbb43('0x3c')]([_0x31d265,_0x4024bb])['then'](function(_0x19e8b7){var _0x529455=_0x19e8b7[0x0];var _0x6e7c04=_0x19e8b7[0x1];var _0x4b5e4b=_[_0xbb43('0x20')](_0x529455[_0xbb43('0x21')],function(_0x132b98){return _0x132b98[_0xbb43('0x22')]==_0x6e7c04['id'];});return _0x5b7b39['status'](0xc8)[_0xbb43('0x2e')]({'count':_0x4b5e4b['length'],'rows':_0x4b5e4b});})[_0xbb43('0x30')](handleError(_0x5b7b39));};exports[_0xbb43('0x3d')]=function(_0x512619,_0x1b69ab){logger[_0xbb43('0x10')]('conference\x20fired:',_0x512619[_0xbb43('0x28')]);var _0x13e1e3=conferenceValidation[_0xbb43('0xc')](_0x512619[_0xbb43('0x28')]);if(_0x13e1e3[_0xbb43('0x24')]>0x0){return _0x1b69ab[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0x13e1e3);}var _0x161556=_0x512619['body'][_0xbb43('0x29')];return getAgent(_0x161556)['then'](function(_0x36a69b){logger[_0xbb43('0x10')]('entityFound:',_0x36a69b[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x36a69b[_0xbb43('0x15')]),_0xbb43('0x3e'));return _0x1b69ab[_0xbb43('0x16')](0xc8)[_0xbb43('0x2e')]({'error':![],'message':_0xbb43('0x3f')});})['catch'](handleError(_0x1b69ab));};exports[_0xbb43('0x40')]=function(_0x21260c,_0x12f96c){logger[_0xbb43('0x10')]('transfer\x20fired:',_0x21260c[_0xbb43('0x28')]);var _0x5d73a5=transferValidation[_0xbb43('0xc')](_0x21260c['body']);if(_0x5d73a5[_0xbb43('0x24')]>0x0){return _0x12f96c[_0xbb43('0x16')](0x190)[_0xbb43('0x2e')](_0x5d73a5);}var _0x265d2d=_0x21260c[_0xbb43('0x28')][_0xbb43('0x29')];var _0x349699=_0x21260c[_0xbb43('0x28')][_0xbb43('0x23')];var _0x32483f=_0x21260c['body'][_0xbb43('0x41')];return getAgent(_0x265d2d)['then'](function(_0x1b9280){logger[_0xbb43('0x10')](_0xbb43('0x2c'),_0x1b9280[_0xbb43('0x15')]);emit(util[_0xbb43('0x2d')](_0xbb43('0x35'),_0x1b9280[_0xbb43('0x15')]),_0xbb43('0x42'),{'sessionId':_0x349699,'transferNumber':_0x32483f});return _0x12f96c['status'](0xc8)[_0xbb43('0x2e')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x12f96c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 22086e6..7560f7c 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 _0x4991=['isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','create','addDisposition','post','addAnswer','/:id/users','addAgents','notify','send','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe'];(function(_0xefd357,_0x2ba14f){var _0x34a4b5=function(_0xcbf685){while(--_0xcbf685){_0xefd357['push'](_0xefd357['shift']());}};_0x34a4b5(++_0x2ba14f);}(_0x4991,0xf7));var _0x1499=function(_0x185606,_0xa1dc60){_0x185606=_0x185606-0x0;var _0x4f17d8=_0x4991[_0x185606];return _0x4f17d8;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['show']);router[_0x1499('0x9')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x9')]('/:id/canned_answers',auth[_0x1499('0xc')](),controller[_0x1499('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x1499('0x12')]);router[_0x1499('0x9')](_0x1499('0x13'),auth[_0x1499('0xc')](),controller[_0x1499('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1499('0x15')]);router['post'](_0x1499('0xf'),auth[_0x1499('0xc')](),controller[_0x1499('0x16')]);router[_0x1499('0x17')]('/:id/canned_answers',auth[_0x1499('0xc')](),controller[_0x1499('0x18')]);router['post'](_0x1499('0x19'),auth[_0x1499('0xc')](),controller[_0x1499('0x1a')]);router[_0x1499('0x17')](_0x1499('0x13'),auth[_0x1499('0xc')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x1499('0x1b')]);router[_0x1499('0x17')]('/:id/send',auth[_0x1499('0xc')](),controller[_0x1499('0x1c')]);router[_0x1499('0x1d')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x1e')]);router[_0x1499('0x1f')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x20')]);router[_0x1499('0x1f')](_0x1499('0xf'),auth[_0x1499('0xc')](),controller[_0x1499('0x21')]);router[_0x1499('0x1f')](_0x1499('0x22'),auth[_0x1499('0xc')](),controller['removeAnswers']);router[_0x1499('0x1f')](_0x1499('0x19'),auth[_0x1499('0xc')](),controller[_0x1499('0x23')]);module[_0x1499('0x24')]=router; \ No newline at end of file +var _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index be6d93a..c9b106e 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 _0x8e27=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e27,0xe2));var _0x78e2=function(_0x312962,_0x282d40){_0x312962=_0x312962-0x0;var _0x3e85d0=_0x8e27[_0x312962];return _0x3e85d0;};'use strict';var Sequelize=require(_0x78e2('0x0'));var rs=require(_0x78e2('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x78e2('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x78e2('0x2')],'defaultValue':function(){return rs[_0x78e2('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x78e2('0x4')]('twilio')},'accountSid':{'type':Sequelize[_0x78e2('0x2')]},'authToken':{'type':Sequelize[_0x78e2('0x2')]},'notificationTemplate':{'type':Sequelize[_0x78e2('0x5')],'defaultValue':function(){return _0x78e2('0x6');}},'notificationSound':{'type':Sequelize[_0x78e2('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x78e2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x78e2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x78e2('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x78e2('0x9'),'set':function(_0x4fcb34){if(!_0x4fcb34){this[_0x78e2('0xa')](_0x78e2('0xb'),null);}this[_0x78e2('0xa')](_0x78e2('0xc'),_0x4fcb34);}},'description':{'type':Sequelize[_0x78e2('0x2')]}}; \ No newline at end of file +var _0xa719=['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','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa719,0xbc));var _0x9a71=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa719[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x9a71('0x0'));var rs=require(_0x9a71('0x1'));module[_0x9a71('0x2')]={'name':{'type':Sequelize[_0x9a71('0x3')],'unique':_0x9a71('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x9a71('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9a71('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9a71('0x3')],'defaultValue':function(){return rs[_0x9a71('0x5')]();}},'phone':{'type':Sequelize[_0x9a71('0x3')]},'type':{'type':Sequelize[_0x9a71('0x6')]('twilio')},'accountSid':{'type':Sequelize[_0x9a71('0x3')]},'authToken':{'type':Sequelize[_0x9a71('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9a71('0x7')],'defaultValue':function(){return _0x9a71('0x8');}},'notificationSound':{'type':Sequelize[_0x9a71('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9a71('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9a71('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9a71('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9a71('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9a71('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9a71('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9a71('0xc'),'set':function(_0x2da970){if(!_0x2da970){this[_0x9a71('0xd')]('mandatoryDispositionPauseId',null);}this[_0x9a71('0xd')](_0x9a71('0xe'),_0x2da970);}},'description':{'type':Sequelize[_0x9a71('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 63be1b1..7fccee3 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 _0xebea=['includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','interaction','created','autoclose','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','send','body\x20is\x20mandatory\x20and\x20not\x20empty','List','WhatsappInteraction','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappAccount.socket','jayson/promise','client','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','count','then','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','getDispositions','order','options','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','pick','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x2ff127,_0x3d6e2b){var _0x53af48=function(_0x4a0c47){while(--_0x4a0c47){_0x2ff127['push'](_0x2ff127['shift']());}};_0x53af48(++_0x3d6e2b);}(_0xebea,0x1a0));var _0xaebe=function(_0x105ac4,_0x37cab0){_0x105ac4=_0x105ac4-0x0;var _0x4a954d=_0xebea[_0x105ac4];return _0x4a954d;};'use strict';var emlformat=require(_0xaebe('0x0'));var rimraf=require(_0xaebe('0x1'));var zipdir=require(_0xaebe('0x2'));var jsonpatch=require(_0xaebe('0x3'));var rp=require(_0xaebe('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaebe('0x5'));var util=require(_0xaebe('0x6'));var path=require('path');var sox=require(_0xaebe('0x7'));var csv=require('to-csv');var ejs=require(_0xaebe('0x8'));var fs=require('fs');var fs_extra=require(_0xaebe('0x9'));var _=require('lodash');var squel=require(_0xaebe('0xa'));var crypto=require(_0xaebe('0xb'));var jsforce=require(_0xaebe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaebe('0xd'));var querystring=require(_0xaebe('0xe'));var Papa=require(_0xaebe('0xf'));var Redis=require(_0xaebe('0x10'));var authService=require(_0xaebe('0x11'));var qs=require(_0xaebe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaebe('0x13'));var logger=require(_0xaebe('0x14'))(_0xaebe('0x15'));var utils=require(_0xaebe('0x16'));var config=require(_0xaebe('0x17'));var licenseUtil=require(_0xaebe('0x18'));var db=require('../../mysqldb')['db'];config[_0xaebe('0x19')]=_[_0xaebe('0x1a')](config[_0xaebe('0x19')],{'host':_0xaebe('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaebe('0x1c'))['register'](socket);var jayson=require(_0xaebe('0x1d'));var client=jayson[_0xaebe('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5c0e6e,_0x43d1c9,_0x103558,_0x5d7b5d){return new BPromise(function(_0x3e2db5,_0x5e1e48){var _0x53d8c5=_0x5d7b5d||client;return _0x53d8c5[_0xaebe('0x1f')](_0x5c0e6e,_0x103558)['then'](function(_0x961a98){logger[_0xaebe('0x20')](_0xaebe('0x21'),_0x43d1c9,_0xaebe('0x22'));logger[_0xaebe('0x23')](_0xaebe('0x24'),_0x43d1c9,_0xaebe('0x22'),JSON['stringify'](_0x961a98));if(_0x961a98[_0xaebe('0x25')]){if(_0x961a98[_0xaebe('0x25')]['code']===0x1f4){logger['error'](_0xaebe('0x21'),_0x43d1c9,_0x961a98[_0xaebe('0x25')][_0xaebe('0x26')]);return _0x5e1e48(_0x961a98[_0xaebe('0x25')][_0xaebe('0x26')]);}logger[_0xaebe('0x25')](_0xaebe('0x21'),_0x43d1c9,_0x961a98['error'][_0xaebe('0x26')]);return _0x3e2db5(_0x961a98[_0xaebe('0x25')]['message']);}else{logger[_0xaebe('0x20')](_0xaebe('0x21'),_0x43d1c9,_0xaebe('0x22'));_0x3e2db5(_0x961a98[_0xaebe('0x27')][_0xaebe('0x26')]);}})['catch'](function(_0x9b2d04){logger['error'](_0xaebe('0x21'),_0x43d1c9,_0x9b2d04);_0x5e1e48(_0x9b2d04);});});}function respondWithStatusCode(_0x25f411,_0x18cd9a){_0x18cd9a=_0x18cd9a||0xcc;return function(_0x59dd0c){if(_0x59dd0c){return _0x25f411[_0xaebe('0x28')](_0x18cd9a);}return _0x25f411['status'](_0x18cd9a)[_0xaebe('0x29')]();};}function respondWithResult(_0x9de42c,_0x414e9d){_0x414e9d=_0x414e9d||0xc8;return function(_0x72aa5){if(_0x72aa5){return _0x9de42c[_0xaebe('0x2a')](_0x414e9d)[_0xaebe('0x2b')](_0x72aa5);}};}function respondWithFilteredResult(_0x18fa15,_0xb59596){return function(_0x53da46){if(_0x53da46){var _0x459b58=typeof _0xb59596['offset']===_0xaebe('0x2c')&&typeof _0xb59596[_0xaebe('0x2d')]===_0xaebe('0x2c');var _0x3be904=_0x53da46['count'];var _0x2efa5d=_0x459b58?0x0:_0xb59596[_0xaebe('0x2e')];var _0x3b881f=_0x459b58?_0x53da46['count']:_0xb59596[_0xaebe('0x2e')]+_0xb59596[_0xaebe('0x2d')];var _0x4bbc79;if(_0x3b881f>=_0x3be904){_0x3b881f=_0x3be904;_0x4bbc79=0xc8;}else{_0x4bbc79=0xce;}_0x18fa15[_0xaebe('0x2a')](_0x4bbc79);return _0x18fa15[_0xaebe('0x2f')](_0xaebe('0x30'),_0x2efa5d+'-'+_0x3b881f+'/'+_0x3be904)[_0xaebe('0x2b')](_0x53da46);}return null;};}function patchUpdates(_0x4f1c3a){return function(_0x31ce82){try{jsonpatch[_0xaebe('0x31')](_0x31ce82,_0x4f1c3a,!![]);}catch(_0x5d99e4){return BPromise[_0xaebe('0x32')](_0x5d99e4);}return _0x31ce82[_0xaebe('0x33')]();};}function saveUpdates(_0xd8df23,_0x408fbe){return function(_0x8afcd9){if(_0x8afcd9){return _0x8afcd9['update'](_0xd8df23)['then'](function(_0x940305){return _0x940305;});}return null;};}function removeEntity(_0x1681ea,_0x473856){return function(_0x7a8f94){if(_0x7a8f94){return _0x7a8f94[_0xaebe('0x34')]()['then'](function(){var _0x8a1da8=_0x7a8f94[_0xaebe('0x35')]({'plain':!![]});var _0x40c163=_0xaebe('0x36');return db['UserProfileResource'][_0xaebe('0x34')]({'where':{'type':_0x40c163,'resourceId':_0x8a1da8['id']}})['then'](function(){return _0x7a8f94;});})['then'](function(){_0x1681ea[_0xaebe('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f846a,_0x5da22b){return function(_0xf379b9){if(!_0xf379b9){_0x1f846a[_0xaebe('0x28')](0x194);}return _0xf379b9;};}function handleError(_0x4cdc63,_0x5ebacf){_0x5ebacf=_0x5ebacf||0x1f4;return function(_0x53fef2){logger[_0xaebe('0x25')](_0x53fef2['stack']);if(_0x53fef2[_0xaebe('0x37')]){delete _0x53fef2[_0xaebe('0x37')];}_0x4cdc63[_0xaebe('0x2a')](_0x5ebacf)['send'](_0x53fef2);};}exports[_0xaebe('0x38')]=function(_0x4c2724,_0x325273){var _0x40a1cf={'include':[{'model':db[_0xaebe('0x39')],'as':_0xaebe('0x3a')}]},_0x19eb95={},_0x38945f={'count':0x0,'rows':[]};var _0x57c644=_[_0xaebe('0x3b')](db[_0xaebe('0x3c')][_0xaebe('0x3d')],function(_0x4dfd33){return{'name':_0x4dfd33['fieldName'],'type':_0x4dfd33[_0xaebe('0x3e')][_0xaebe('0x3f')]};});_0x19eb95[_0xaebe('0x40')]=_[_0xaebe('0x3b')](_0x57c644,_0xaebe('0x37'));_0x19eb95[_0xaebe('0x41')]=_[_0xaebe('0x42')](_0x4c2724[_0xaebe('0x41')]);_0x19eb95[_0xaebe('0x43')]=_[_0xaebe('0x44')](_0x19eb95[_0xaebe('0x40')],_0x19eb95[_0xaebe('0x41')]);_0x40a1cf[_0xaebe('0x45')]=_['intersection'](_0x19eb95['model'],qs[_0xaebe('0x46')](_0x4c2724[_0xaebe('0x41')][_0xaebe('0x46')]));_0x40a1cf['attributes']=_0x40a1cf[_0xaebe('0x45')][_0xaebe('0x47')]?_0x40a1cf[_0xaebe('0x45')]:_0x19eb95[_0xaebe('0x40')];if(!_0x4c2724[_0xaebe('0x41')][_0xaebe('0x48')](_0xaebe('0x49'))){_0x40a1cf[_0xaebe('0x2d')]=qs[_0xaebe('0x2d')](_0x4c2724[_0xaebe('0x41')][_0xaebe('0x2d')]);_0x40a1cf[_0xaebe('0x2e')]=qs['offset'](_0x4c2724[_0xaebe('0x41')][_0xaebe('0x2e')]);}_0x40a1cf['order']=qs[_0xaebe('0x4a')](_0x4c2724[_0xaebe('0x41')]['sort']);_0x40a1cf[_0xaebe('0x4b')]=qs[_0xaebe('0x43')](_['pick'](_0x4c2724[_0xaebe('0x41')],_0x19eb95[_0xaebe('0x43')]),_0x57c644);if(_0x4c2724[_0xaebe('0x41')][_0xaebe('0x4c')]){_0x40a1cf[_0xaebe('0x4b')]=_[_0xaebe('0x4d')](_0x40a1cf[_0xaebe('0x4b')],{'$or':_[_0xaebe('0x3b')](_0x57c644,function(_0x224614){if(_0x224614[_0xaebe('0x3e')]!=='VIRTUAL'){var _0x339e06={};_0x339e06[_0x224614[_0xaebe('0x37')]]={'$like':'%'+_0x4c2724[_0xaebe('0x41')]['filter']+'%'};return _0x339e06;}})});}_0x40a1cf=_[_0xaebe('0x4d')]({},_0x40a1cf,_0x4c2724['options']);var _0x32c017={'where':_0x40a1cf[_0xaebe('0x4b')]};return db['WhatsappAccount'][_0xaebe('0x4e')](_0x32c017)[_0xaebe('0x4f')](function(_0x553a22){_0x38945f[_0xaebe('0x4e')]=_0x553a22;if(_0x4c2724[_0xaebe('0x41')][_0xaebe('0x50')]){_0x40a1cf[_0xaebe('0x51')]=[{'all':!![]}];}return db[_0xaebe('0x3c')][_0xaebe('0x52')](_0x40a1cf);})['then'](function(_0x36cec1){_0x38945f[_0xaebe('0x53')]=_0x36cec1;return _0x38945f;})['then'](respondWithFilteredResult(_0x325273,_0x40a1cf))[_0xaebe('0x54')](handleError(_0x325273,null));};exports[_0xaebe('0x55')]=function(_0x2c4291,_0x9a542c){var _0x1a491a={'raw':![],'where':{'id':_0x2c4291[_0xaebe('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xaebe('0x3a')}]},_0x26a2cf={};_0x26a2cf[_0xaebe('0x40')]=_['keys'](db[_0xaebe('0x3c')]['rawAttributes']);_0x26a2cf[_0xaebe('0x41')]=_['keys'](_0x2c4291[_0xaebe('0x41')]);_0x26a2cf[_0xaebe('0x43')]=_[_0xaebe('0x44')](_0x26a2cf['model'],_0x26a2cf[_0xaebe('0x41')]);_0x1a491a['attributes']=_[_0xaebe('0x44')](_0x26a2cf[_0xaebe('0x40')],qs[_0xaebe('0x46')](_0x2c4291[_0xaebe('0x41')][_0xaebe('0x46')]));_0x1a491a[_0xaebe('0x45')]=_0x1a491a[_0xaebe('0x45')][_0xaebe('0x47')]?_0x1a491a[_0xaebe('0x45')]:_0x26a2cf[_0xaebe('0x40')];if(_0x2c4291[_0xaebe('0x41')][_0xaebe('0x50')]){_0x1a491a[_0xaebe('0x51')]=[{'all':!![]}];}_0x1a491a=_[_0xaebe('0x4d')]({},_0x1a491a,_0x2c4291['options']);return db[_0xaebe('0x3c')]['find'](_0x1a491a)['then'](handleEntityNotFound(_0x9a542c,null))[_0xaebe('0x4f')](respondWithResult(_0x9a542c,null))[_0xaebe('0x54')](handleError(_0x9a542c,null));};exports[_0xaebe('0x57')]=function(_0x2a88ea,_0x30701f){return db[_0xaebe('0x3c')][_0xaebe('0x57')](_0x2a88ea[_0xaebe('0x58')],{})[_0xaebe('0x4f')](function(_0x4cf320){var _0x251d12=_0x2a88ea[_0xaebe('0x59')][_0xaebe('0x35')]({'plain':!![]});if(!_0x251d12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x251d12[_0xaebe('0x5a')]==='user'){var _0x44f1f9=_0x4cf320[_0xaebe('0x35')]({'plain':!![]});var _0x110108='WhatsappAccounts';return db[_0xaebe('0x5b')][_0xaebe('0x5c')]({'where':{'name':_0x110108,'userProfileId':_0x251d12[_0xaebe('0x5d')]},'raw':!![]})[_0xaebe('0x4f')](function(_0x569598){if(_0x569598&&_0x569598[_0xaebe('0x5e')]===0x0){return db[_0xaebe('0x5f')][_0xaebe('0x57')]({'name':_0x44f1f9[_0xaebe('0x37')],'resourceId':_0x44f1f9['id'],'type':_0x569598['name'],'sectionId':_0x569598['id']},{})[_0xaebe('0x4f')](function(){return _0x4cf320;});}else{return _0x4cf320;}})['catch'](function(_0x2fc026){logger[_0xaebe('0x25')](_0xaebe('0x60'),_0x2fc026);throw _0x2fc026;});}return _0x4cf320;})[_0xaebe('0x4f')](respondWithResult(_0x30701f,0xc9))['catch'](handleError(_0x30701f,null));};exports[_0xaebe('0x61')]=function(_0x1148d0,_0xaa6e25){if(_0x1148d0[_0xaebe('0x58')]['id']){delete _0x1148d0['body']['id'];}return db[_0xaebe('0x3c')][_0xaebe('0x5c')]({'where':{'id':_0x1148d0['params']['id']},'include':[{'model':db[_0xaebe('0x39')],'as':_0xaebe('0x3a')}]})[_0xaebe('0x4f')](handleEntityNotFound(_0xaa6e25,null))['then'](saveUpdates(_0x1148d0['body'],null))[_0xaebe('0x4f')](respondWithResult(_0xaa6e25,null))['catch'](handleError(_0xaa6e25,null));};exports[_0xaebe('0x34')]=function(_0x4d871e,_0x55d166){return db[_0xaebe('0x3c')][_0xaebe('0x5c')]({'where':{'id':_0x4d871e['params']['id']}})['then'](handleEntityNotFound(_0x55d166,null))['then'](removeEntity(_0x55d166,null))[_0xaebe('0x54')](handleError(_0x55d166,null));};exports[_0xaebe('0x62')]=function(_0x348328,_0x214d51){return db[_0xaebe('0x3c')][_0xaebe('0x62')]()[_0xaebe('0x4f')](respondWithResult(_0x214d51,null))[_0xaebe('0x54')](handleError(_0x214d51,null));};exports[_0xaebe('0x63')]=function(_0x3a108c,_0x26bbb2,_0x14ceb2){if(_0x3a108c[_0xaebe('0x58')]['id']){delete _0x3a108c[_0xaebe('0x58')]['id'];}return db['WhatsappAccount'][_0xaebe('0x5c')]({'where':{'id':_0x3a108c[_0xaebe('0x56')]['id']}})[_0xaebe('0x4f')](handleEntityNotFound(_0x26bbb2,null))[_0xaebe('0x4f')](function(_0x4d34eb){if(_0x4d34eb){_0x3a108c[_0xaebe('0x58')][_0xaebe('0x64')]=_0x4d34eb['id'];return db['Disposition'][_0xaebe('0x57')](_0x3a108c[_0xaebe('0x58')]);}})[_0xaebe('0x4f')](respondWithResult(_0x26bbb2,null))[_0xaebe('0x54')](handleError(_0x26bbb2,null));};exports[_0xaebe('0x65')]=function(_0x29b5a2,_0x385206,_0x599d7b){var _0x1a51c9={'raw':![],'where':{}};var _0x402c15={};var _0x2a4dc6={'count':0x0,'rows':[]};return db[_0xaebe('0x3c')]['findOne']({'where':{'id':_0x29b5a2[_0xaebe('0x56')]['id']}})['then'](handleEntityNotFound(_0x385206,null))[_0xaebe('0x4f')](function(_0x1445da){if(_0x1445da){_0x402c15[_0xaebe('0x40')]=_[_0xaebe('0x42')](db['Disposition'][_0xaebe('0x3d')]);_0x402c15[_0xaebe('0x41')]=_[_0xaebe('0x42')](_0x29b5a2[_0xaebe('0x41')]);_0x402c15[_0xaebe('0x43')]=_[_0xaebe('0x44')](_0x402c15['model'],_0x402c15[_0xaebe('0x41')]);_0x1a51c9[_0xaebe('0x45')]=_[_0xaebe('0x44')](_0x402c15['model'],qs[_0xaebe('0x46')](_0x29b5a2[_0xaebe('0x41')][_0xaebe('0x46')]));_0x1a51c9[_0xaebe('0x45')]=_0x1a51c9[_0xaebe('0x45')][_0xaebe('0x47')]?_0x1a51c9[_0xaebe('0x45')]:_0x402c15[_0xaebe('0x40')];if(!_0x29b5a2[_0xaebe('0x41')][_0xaebe('0x48')]('nolimit')){_0x1a51c9[_0xaebe('0x2d')]=qs[_0xaebe('0x2d')](_0x29b5a2[_0xaebe('0x41')][_0xaebe('0x2d')]);_0x1a51c9[_0xaebe('0x2e')]=qs['offset'](_0x29b5a2[_0xaebe('0x41')][_0xaebe('0x2e')]);}_0x1a51c9[_0xaebe('0x66')]=qs[_0xaebe('0x4a')](_0x29b5a2[_0xaebe('0x41')][_0xaebe('0x4a')]);_0x1a51c9['where']=qs['filters'](_['pick'](_0x29b5a2[_0xaebe('0x41')],_0x402c15[_0xaebe('0x43')]));_0x1a51c9[_0xaebe('0x4b')][_0xaebe('0x64')]=_0x1445da['id'];if(_0x29b5a2[_0xaebe('0x41')]['filter']){_0x1a51c9[_0xaebe('0x4b')]=_[_0xaebe('0x4d')](_0x1a51c9[_0xaebe('0x4b')],{'$or':_[_0xaebe('0x3b')](_0x1a51c9[_0xaebe('0x45')],function(_0x1a6fbe){var _0x5603bf={};_0x5603bf[_0x1a6fbe]={'$like':'%'+_0x29b5a2[_0xaebe('0x41')][_0xaebe('0x4c')]+'%'};return _0x5603bf;})});}_0x1a51c9=_[_0xaebe('0x4d')]({},_0x1a51c9,_0x29b5a2[_0xaebe('0x67')]);return db['Disposition']['count']({'where':_0x1a51c9['where']})['then'](function(_0x131d69){_0x2a4dc6[_0xaebe('0x4e')]=_0x131d69;if(_0x29b5a2[_0xaebe('0x41')]['includeAll']){_0x1a51c9['include']=[{'all':!![]}];}return db[_0xaebe('0x68')][_0xaebe('0x52')](_0x1a51c9);})[_0xaebe('0x4f')](function(_0x347475){_0x2a4dc6[_0xaebe('0x53')]=_0x347475;return _0x2a4dc6;});}})[_0xaebe('0x4f')](respondWithFilteredResult(_0x385206,_0x1a51c9))[_0xaebe('0x54')](handleError(_0x385206,null));};exports[_0xaebe('0x69')]=function(_0x9e0f4f,_0x54c79c,_0x5cfc35){return db['WhatsappAccount']['find']({'where':{'id':_0x9e0f4f[_0xaebe('0x56')]['id']}})['then'](handleEntityNotFound(_0x54c79c,null))[_0xaebe('0x4f')](function(_0x6ef7b6){if(_0x6ef7b6){return _0x6ef7b6[_0xaebe('0x69')](_0x9e0f4f[_0xaebe('0x41')][_0xaebe('0x6a')]);}})[_0xaebe('0x4f')](respondWithStatusCode(_0x54c79c,null))['catch'](handleError(_0x54c79c,null));};exports[_0xaebe('0x6b')]=function(_0x23e19a,_0x1fa164,_0x4cb6b8){if(_0x23e19a[_0xaebe('0x58')]['id']){delete _0x23e19a[_0xaebe('0x58')]['id'];}return db[_0xaebe('0x3c')]['find']({'where':{'id':_0x23e19a['params']['id']}})['then'](handleEntityNotFound(_0x1fa164,null))[_0xaebe('0x4f')](function(_0x3d2ff4){if(_0x3d2ff4){_0x23e19a[_0xaebe('0x58')]['WhatsappAccountId']=_0x3d2ff4['id'];return db[_0xaebe('0x6c')][_0xaebe('0x57')](_0x23e19a[_0xaebe('0x58')]);}})[_0xaebe('0x4f')](respondWithResult(_0x1fa164,null))['catch'](handleError(_0x1fa164,null));};exports[_0xaebe('0x6d')]=function(_0x3e8a8c,_0x4131f6,_0x264746){var _0x283a3f={'raw':![],'where':{}};var _0x51f2b8={};var _0x2e18b2={'count':0x0,'rows':[]};return db[_0xaebe('0x3c')][_0xaebe('0x6e')]({'where':{'id':_0x3e8a8c[_0xaebe('0x56')]['id']}})[_0xaebe('0x4f')](handleEntityNotFound(_0x4131f6,null))[_0xaebe('0x4f')](function(_0x31588b){if(_0x31588b){_0x51f2b8[_0xaebe('0x40')]=_[_0xaebe('0x42')](db['CannedAnswer'][_0xaebe('0x3d')]);_0x51f2b8['query']=_[_0xaebe('0x42')](_0x3e8a8c[_0xaebe('0x41')]);_0x51f2b8['filters']=_[_0xaebe('0x44')](_0x51f2b8[_0xaebe('0x40')],_0x51f2b8[_0xaebe('0x41')]);_0x283a3f['attributes']=_[_0xaebe('0x44')](_0x51f2b8[_0xaebe('0x40')],qs[_0xaebe('0x46')](_0x3e8a8c['query'][_0xaebe('0x46')]));_0x283a3f[_0xaebe('0x45')]=_0x283a3f[_0xaebe('0x45')][_0xaebe('0x47')]?_0x283a3f['attributes']:_0x51f2b8[_0xaebe('0x40')];if(!_0x3e8a8c['query'][_0xaebe('0x48')]('nolimit')){_0x283a3f[_0xaebe('0x2d')]=qs[_0xaebe('0x2d')](_0x3e8a8c[_0xaebe('0x41')][_0xaebe('0x2d')]);_0x283a3f[_0xaebe('0x2e')]=qs[_0xaebe('0x2e')](_0x3e8a8c[_0xaebe('0x41')][_0xaebe('0x2e')]);}_0x283a3f[_0xaebe('0x66')]=qs[_0xaebe('0x4a')](_0x3e8a8c[_0xaebe('0x41')][_0xaebe('0x4a')]);_0x283a3f['where']=qs[_0xaebe('0x43')](_[_0xaebe('0x6f')](_0x3e8a8c[_0xaebe('0x41')],_0x51f2b8[_0xaebe('0x43')]));_0x283a3f[_0xaebe('0x4b')][_0xaebe('0x64')]=_0x31588b['id'];if(_0x3e8a8c[_0xaebe('0x41')][_0xaebe('0x4c')]){_0x283a3f[_0xaebe('0x4b')]=_[_0xaebe('0x4d')](_0x283a3f[_0xaebe('0x4b')],{'$or':_[_0xaebe('0x3b')](_0x283a3f[_0xaebe('0x45')],function(_0x391f14){var _0x3f8cfe={};_0x3f8cfe[_0x391f14]={'$like':'%'+_0x3e8a8c[_0xaebe('0x41')][_0xaebe('0x4c')]+'%'};return _0x3f8cfe;})});}_0x283a3f=_[_0xaebe('0x4d')]({},_0x283a3f,_0x3e8a8c[_0xaebe('0x67')]);return db[_0xaebe('0x6c')][_0xaebe('0x4e')]({'where':_0x283a3f[_0xaebe('0x4b')]})[_0xaebe('0x4f')](function(_0x1f0d25){_0x2e18b2[_0xaebe('0x4e')]=_0x1f0d25;if(_0x3e8a8c[_0xaebe('0x41')]['includeAll']){_0x283a3f[_0xaebe('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0xaebe('0x52')](_0x283a3f);})['then'](function(_0x1cc294){_0x2e18b2[_0xaebe('0x53')]=_0x1cc294;return _0x2e18b2;});}})[_0xaebe('0x4f')](respondWithFilteredResult(_0x4131f6,_0x283a3f))[_0xaebe('0x54')](handleError(_0x4131f6,null));};exports[_0xaebe('0x70')]=function(_0x21ca23,_0x2f1134,_0x57c83c){return db['WhatsappAccount'][_0xaebe('0x5c')]({'where':{'id':_0x21ca23[_0xaebe('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f1134,null))['then'](function(_0x3252f5){if(_0x3252f5){return _0x3252f5[_0xaebe('0x70')](_0x21ca23['query']['ids']);}})[_0xaebe('0x4f')](respondWithStatusCode(_0x2f1134,null))['catch'](handleError(_0x2f1134,null));};exports[_0xaebe('0x71')]=function(_0x2858bf,_0x4ca017,_0xdaec47){return db['WhatsappAccount'][_0xaebe('0x5c')]({'where':{'id':_0x2858bf['params']['id']}})[_0xaebe('0x4f')](handleEntityNotFound(_0x4ca017,null))[_0xaebe('0x4f')](function(_0x14fe60){if(_0x14fe60){return _0x14fe60[_0xaebe('0x71')](_0x2858bf[_0xaebe('0x58')]['ids'],_[_0xaebe('0x72')](_0x2858bf[_0xaebe('0x58')],[_0xaebe('0x6a'),'id'])||{})[_0xaebe('0x73')](function(_0xad40a1){for(var _0x4f03ed=0x0;_0x4f03ed<_0x2858bf['body'][_0xaebe('0x6a')][_0xaebe('0x47')];_0x4f03ed+=0x1){socket[_0xaebe('0x74')](_0xaebe('0x75'),{'UserId':Number(_0x2858bf[_0xaebe('0x58')][_0xaebe('0x6a')][_0x4f03ed]),'WhatsappAccountId':Number(_0x2858bf[_0xaebe('0x56')]['id'])});}return _0xad40a1;});}})[_0xaebe('0x4f')](respondWithResult(_0x4ca017,null))['catch'](handleError(_0x4ca017,null));};exports[_0xaebe('0x76')]=function(_0x5a2668,_0x25af33,_0x19ba67){return db[_0xaebe('0x3c')][_0xaebe('0x5c')]({'where':{'id':_0x5a2668[_0xaebe('0x56')]['id']}})[_0xaebe('0x4f')](handleEntityNotFound(_0x25af33,null))[_0xaebe('0x4f')](function(_0x39c62c){if(_0x39c62c){return _0x39c62c[_0xaebe('0x76')](_0x5a2668[_0xaebe('0x41')]['ids'])[_0xaebe('0x4f')](function(){if(_[_0xaebe('0x77')](_0x5a2668[_0xaebe('0x41')][_0xaebe('0x6a')])){for(var _0x3c371f=0x0;_0x3c371f<_0x5a2668['query'][_0xaebe('0x6a')][_0xaebe('0x47')];_0x3c371f+=0x1){socket[_0xaebe('0x74')](_0xaebe('0x78'),{'UserId':Number(_0x5a2668[_0xaebe('0x41')][_0xaebe('0x6a')][_0x3c371f]),'WhatsappAccountId':Number(_0x5a2668[_0xaebe('0x56')]['id'])});}}else{socket[_0xaebe('0x74')](_0xaebe('0x78'),{'UserId':Number(_0x5a2668[_0xaebe('0x41')][_0xaebe('0x6a')]),'WhatsappAccountId':Number(_0x5a2668[_0xaebe('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x25af33,null))[_0xaebe('0x54')](handleError(_0x25af33,null));};exports[_0xaebe('0x79')]=function(_0x34384c,_0x19bdab,_0xa430df){var _0x3177c4={};var _0x156fac={};var _0x217a53;var _0x277283;return db[_0xaebe('0x3c')][_0xaebe('0x6e')]({'where':{'id':_0x34384c[_0xaebe('0x56')]['id']}})[_0xaebe('0x4f')](handleEntityNotFound(_0x19bdab,null))['then'](function(_0x2e6304){if(_0x2e6304){_0x217a53=_0x2e6304;_0x156fac[_0xaebe('0x40')]=_[_0xaebe('0x42')](db[_0xaebe('0x7a')][_0xaebe('0x3d')]);_0x156fac[_0xaebe('0x41')]=_[_0xaebe('0x42')](_0x34384c[_0xaebe('0x41')]);_0x156fac[_0xaebe('0x43')]=_[_0xaebe('0x44')](_0x156fac[_0xaebe('0x40')],_0x156fac['query']);_0x3177c4['attributes']=_[_0xaebe('0x44')](_0x156fac[_0xaebe('0x40')],qs[_0xaebe('0x46')](_0x34384c[_0xaebe('0x41')]['fields']));_0x3177c4[_0xaebe('0x45')]=_0x3177c4[_0xaebe('0x45')][_0xaebe('0x47')]?_0x3177c4[_0xaebe('0x45')]:_0x156fac['model'];_0x3177c4[_0xaebe('0x66')]=qs['sort'](_0x34384c[_0xaebe('0x41')][_0xaebe('0x4a')]);_0x3177c4[_0xaebe('0x4b')]=qs['filters'](_['pick'](_0x34384c[_0xaebe('0x41')],_0x156fac[_0xaebe('0x43')]));if(_0x34384c['query'][_0xaebe('0x4c')]){_0x3177c4['where']=_[_0xaebe('0x4d')](_0x3177c4['where'],{'$or':_[_0xaebe('0x3b')](_0x3177c4[_0xaebe('0x45')],function(_0x399c4c){var _0x3c4c42={};_0x3c4c42[_0x399c4c]={'$like':'%'+_0x34384c[_0xaebe('0x41')]['filter']+'%'};return _0x3c4c42;})});}_0x3177c4=_[_0xaebe('0x4d')]({},_0x3177c4,_0x34384c['options']);return _0x217a53[_0xaebe('0x79')](_0x3177c4);}})[_0xaebe('0x4f')](function(_0x2b220a){if(_0x2b220a){_0x277283=_0x2b220a['length'];if(!_0x34384c['query'][_0xaebe('0x48')](_0xaebe('0x49'))){_0x3177c4[_0xaebe('0x2d')]=qs[_0xaebe('0x2d')](_0x34384c[_0xaebe('0x41')][_0xaebe('0x2d')]);_0x3177c4[_0xaebe('0x2e')]=qs[_0xaebe('0x2e')](_0x34384c['query'][_0xaebe('0x2e')]);}return _0x217a53['getAgents'](_0x3177c4);}})['then'](function(_0x2d6b9a){if(_0x2d6b9a){return _0x2d6b9a?{'count':_0x277283,'rows':_0x2d6b9a}:null;}})['then'](respondWithResult(_0x19bdab,null))[_0xaebe('0x54')](handleError(_0x19bdab,null));};exports['addApplications']=function(_0x4c8c6c,_0x28a65b,_0x461971){return db[_0xaebe('0x3c')][_0xaebe('0x6e')]({'where':{'id':_0x4c8c6c[_0xaebe('0x56')]['id']}})['then'](handleEntityNotFound(_0x28a65b,null))[_0xaebe('0x4f')](function(_0x3558c4){if(_0x3558c4){return db[_0xaebe('0x7b')][_0xaebe('0x7c')](function(_0x2f0641){return db[_0xaebe('0x7d')][_0xaebe('0x34')]({'where':{'WhatsappAccountId':_0x4c8c6c[_0xaebe('0x56')]['id']},'transaction':_0x2f0641})['then'](function(_0x216e50){var _0x2afce8=_[_0xaebe('0x3b')](_0x4c8c6c['body'],function(_0x3d0712){_0x3d0712[_0xaebe('0x64')]=_0x4c8c6c['params']['id'];return _0x3d0712;});return db[_0xaebe('0x7d')][_0xaebe('0x7e')](_0x2afce8,{'transaction':_0x2f0641});});})[_0xaebe('0x4f')](function(){return db[_0xaebe('0x7d')][_0xaebe('0x7f')]({'where':{'WhatsappAccountId':_0x4c8c6c[_0xaebe('0x56')]['id']},'order':_0xaebe('0x80')});});}})['then'](respondWithResult(_0x28a65b,null))['catch'](handleError(_0x28a65b,null));};exports[_0xaebe('0x81')]=function(_0x5557eb,_0x4ae84e,_0x2c3dd4){var _0x1ae5e3={};var _0x30e382={};var _0x661c31;var _0x59913f;return db['WhatsappAccount'][_0xaebe('0x6e')]({'where':{'id':_0x5557eb[_0xaebe('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ae84e,null))[_0xaebe('0x4f')](function(_0x4b4926){if(_0x4b4926){_0x661c31=_0x4b4926;_0x30e382[_0xaebe('0x40')]=_['keys'](db[_0xaebe('0x7d')][_0xaebe('0x3d')]);_0x30e382['query']=_[_0xaebe('0x42')](_0x5557eb[_0xaebe('0x41')]);_0x30e382[_0xaebe('0x43')]=_[_0xaebe('0x44')](_0x30e382[_0xaebe('0x40')],_0x30e382[_0xaebe('0x41')]);_0x1ae5e3[_0xaebe('0x45')]=_[_0xaebe('0x44')](_0x30e382['model'],qs[_0xaebe('0x46')](_0x5557eb['query'][_0xaebe('0x46')]));_0x1ae5e3['attributes']=_0x1ae5e3[_0xaebe('0x45')]['length']?_0x1ae5e3['attributes']:_0x30e382[_0xaebe('0x40')];_0x1ae5e3[_0xaebe('0x66')]=qs[_0xaebe('0x4a')](_0x5557eb['query'][_0xaebe('0x4a')]);_0x1ae5e3[_0xaebe('0x4b')]=qs[_0xaebe('0x43')](_['pick'](_0x5557eb[_0xaebe('0x41')],_0x30e382[_0xaebe('0x43')]));if(_0x5557eb[_0xaebe('0x41')][_0xaebe('0x4c')]){_0x1ae5e3[_0xaebe('0x4b')]=_[_0xaebe('0x4d')](_0x1ae5e3[_0xaebe('0x4b')],{'$or':_['map'](_0x1ae5e3[_0xaebe('0x45')],function(_0x68033a){var _0x16b940={};_0x16b940[_0x68033a]={'$like':'%'+_0x5557eb[_0xaebe('0x41')][_0xaebe('0x4c')]+'%'};return _0x16b940;})});}_0x1ae5e3=_[_0xaebe('0x4d')]({},_0x1ae5e3,_0x5557eb[_0xaebe('0x67')]);return _0x661c31[_0xaebe('0x81')](_0x1ae5e3);}})[_0xaebe('0x4f')](function(_0x950a8){if(_0x950a8){_0x59913f=_0x950a8['length'];if(!_0x5557eb[_0xaebe('0x41')][_0xaebe('0x48')](_0xaebe('0x49'))){_0x1ae5e3[_0xaebe('0x2d')]=qs[_0xaebe('0x2d')](_0x5557eb['query']['limit']);_0x1ae5e3[_0xaebe('0x2e')]=qs[_0xaebe('0x2e')](_0x5557eb[_0xaebe('0x41')][_0xaebe('0x2e')]);}return _0x661c31[_0xaebe('0x81')](_0x1ae5e3);}})[_0xaebe('0x4f')](function(_0x4a0f38){if(_0x4a0f38){return _0x4a0f38?{'count':_0x59913f,'rows':_0x4a0f38}:null;}})[_0xaebe('0x4f')](respondWithResult(_0x4ae84e,null))['catch'](handleError(_0x4ae84e,null));};exports[_0xaebe('0x82')]=function(_0x7ae7a3,_0x323e58,_0x2248f5){var _0x277969={'channel':_0xaebe('0x83')};var _0x1c814c=[];var _0x256829=[];var _0x2ab03c={};return db['WhatsappAccount'][_0xaebe('0x5c')]({'where':{'id':_0x7ae7a3[_0xaebe('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xaebe('0x84')}]})['then'](handleEntityNotFound(_0x323e58,null))['then'](function(_0x32b154){_0x277969[_0xaebe('0x85')]=_0x32b154;_0x277969[_0xaebe('0x86')]=_['orderBy'](_0x32b154['Applications'],[_0xaebe('0x80')],[_0xaebe('0x87')]);if(_0x277969[_0xaebe('0x85')][_0xaebe('0x84')]){delete _0x277969[_0xaebe('0x85')][_0xaebe('0x84')];}return db[_0xaebe('0x88')][_0xaebe('0x62')]();})[_0xaebe('0x4f')](function(_0x40287a){if(!_0x40287a){throw new db[(_0xaebe('0x89'))][(_0xaebe('0x8a'))](_0xaebe('0x8b'));}_0x1c814c=_[_0xaebe('0x8c')](_[_0xaebe('0x42')](_0x40287a),[_0xaebe('0x8d'),_0xaebe('0x8e')]);_0x256829=_[_0xaebe('0x8c')](_[_0xaebe('0x42')](_0x40287a),[_0xaebe('0x8d'),'updatedAt',_0xaebe('0x8f'),_0xaebe('0x90')]);_0x277969['body']={'mapKey':_0xaebe('0x91')};if(_0x277969[_0xaebe('0x85')]['type']&&_0x277969['account'][_0xaebe('0x3e')]==='twilio'){_0x277969[_0xaebe('0x58')][_0xaebe('0x92')]=_0x7ae7a3[_0xaebe('0x58')][_0xaebe('0x93')][_0xaebe('0x94')](_0xaebe('0x95'),'');_0x277969[_0xaebe('0x58')][_0xaebe('0x58')]=_0x7ae7a3[_0xaebe('0x58')][_0xaebe('0x96')];_0x277969[_0xaebe('0x58')][_0xaebe('0x97')]=_0x7ae7a3[_0xaebe('0x58')][_0xaebe('0x98')];}if(_0x277969[_0xaebe('0x58')]['id']){delete _0x277969['body']['id'];}if(_[_0xaebe('0x99')](_0x277969['body'][_0xaebe('0x92')])){throw new db[(_0xaebe('0x89'))]['ValidationError'](_0xaebe('0x9a'));}if(_[_0xaebe('0x99')](_0x277969['body'][_0xaebe('0x58')])||_0x277969[_0xaebe('0x58')]['body']===''){throw new db[(_0xaebe('0x89'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x277969[_0xaebe('0x58')][_0xaebe('0x9b')])){throw new db[(_0xaebe('0x89'))][(_0xaebe('0x8a'))](_0xaebe('0x9c')+_0x256829);}if(!_[_0xaebe('0x9d')](_0x256829,_0x277969[_0xaebe('0x58')][_0xaebe('0x9b')])){throw new db[(_0xaebe('0x89'))][(_0xaebe('0x8a'))](_0xaebe('0x9e')+_0x256829);}_0x2ab03c[_0x277969['body'][_0xaebe('0x9b')]]=_0x277969['body'][_0xaebe('0x92')];return db['CmList']['find']({'where':{'id':_0x277969[_0xaebe('0x85')]['ListId']},'include':[{'model':db[_0xaebe('0x88')],'as':_0xaebe('0x9f'),'where':_0x2ab03c,'limit':0x1,'order':[[_0xaebe('0x8e'),_0xaebe('0xa0')]]}]});})['then'](handleEntityNotFound(_0x323e58,null))[_0xaebe('0x4f')](function(_0x45235a){if(_0x45235a){_0x277969[_0xaebe('0xa1')]=_['omit'](_0x45235a,[_0xaebe('0x9f')]);if(_0x45235a['Contacts'][_0xaebe('0x47')]){return _0x45235a[_0xaebe('0x9f')][0x0];}var _0x17c215=_[_0xaebe('0x1a')](_0x277969['body'],{'firstName':_0x277969[_0xaebe('0x58')][_0xaebe('0x92')],'ListId':_0x45235a['id']});_0x17c215[_0x277969[_0xaebe('0x58')][_0xaebe('0x9b')]]=_0x277969[_0xaebe('0x58')][_0xaebe('0x92')];return db[_0xaebe('0x88')][_0xaebe('0x57')](_0x17c215,{'fields':_0x1c814c,'raw':!![]});}})[_0xaebe('0x4f')](handleEntityNotFound(_0x323e58,null))[_0xaebe('0x4f')](function(_0x229473){if(_0x229473){_0x277969[_0xaebe('0xa2')]=_0x229473;var _0x27b87d={'ContactId':_0x229473['id'],'phone':_0x277969[_0xaebe('0x58')][_0xaebe('0x92')],'WhatsappAccountId':_0x7ae7a3['params']['id']};var _0x55381f={'ContactId':_0x229473['id'],'WhatsappAccountId':_0x7ae7a3['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0xaebe('0x5c')]({'where':_0x55381f})[_0xaebe('0x4f')](function(_0x1c3cb0){if(_0x1c3cb0){return[_0x1c3cb0,![]];}return db['WhatsappInteraction'][_0xaebe('0x57')](_0x27b87d)[_0xaebe('0x4f')](function(_0x87361){return[_0x87361,!![]];});});}})['spread'](function(_0x19e410,_0x19d0c6){_0x277969[_0xaebe('0xa3')]=_0x19e410[_0xaebe('0x35')]({'plain':!![]});_0x277969[_0xaebe('0xa3')][_0xaebe('0xa4')]=![];if(_0x19d0c6){if(_0x277969['account'][_0xaebe('0xa5')]){_0x277969['applications']['push']({'id':0x0,'priority':_0x277969[_0xaebe('0x86')][_0xaebe('0x47')]+0x1,'app':_0xaebe('0xa6'),'appdata':_0xaebe('0xa7'),'interval':'*,*,*,*'});}_0x277969[_0xaebe('0xa3')][_0xaebe('0xa4')]=!![];}return db[_0xaebe('0xa8')][_0xaebe('0x57')]({'phone':_0x277969[_0xaebe('0x58')][_0xaebe('0x92')],'messageId':_0x277969[_0xaebe('0x58')][_0xaebe('0x97')],'body':_0x277969['body'][_0xaebe('0x58')],'WhatsappAccountId':_0x7ae7a3[_0xaebe('0x56')]['id'],'WhatsappInteractionId':_0x19e410['id'],'direction':'in','ContactId':_0x19e410[_0xaebe('0xa9')],'AttachmentId':_0x277969[_0xaebe('0x58')][_0xaebe('0xaa')]});})[_0xaebe('0x4f')](function(_0x141399){_0x277969[_0xaebe('0x26')]=_0x141399;if(_0x277969['interaction'][_0xaebe('0xab')]){return db[_0xaebe('0x7a')][_0xaebe('0x5c')]({'attributes':['id',_0xaebe('0x37')],'where':{'id':_0x277969[_0xaebe('0xa3')][_0xaebe('0xab')]}})['then'](function(_0xe92b7e){if(_0xe92b7e){_0x277969['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xaebe('0xac'),'appdata':_0xe92b7e[_0xaebe('0x37')]+','+(_0x277969['account'][_0xaebe('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xaebe('0xae'),_0xaebe('0xaf'),_0x277969);});}return respondWithRpcPromise(_0xaebe('0xae'),_0xaebe('0xaf'),_0x277969);})[_0xaebe('0x4f')](function(_0x5ad0ed){if(_0x5ad0ed){var _0x4de6ee=0xc8;var _0x657ca=_0xaebe('0xb0');logger[_0xaebe('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x657ca,_0x4de6ee,_0xaebe('0xb1'));logger[_0xaebe('0x23')](_0xaebe('0xb2'),_0x657ca,_0x4de6ee,_0xaebe('0xb1'),JSON[_0xaebe('0xb3')](_0x5ad0ed));if(_0x277969['account'][_0xaebe('0x3e')]===_0xaebe('0xb4')){return _0x323e58[_0xaebe('0x2a')](_0x4de6ee)[_0xaebe('0x2f')](_0xaebe('0xb5'),_0xaebe('0xb6'))[_0xaebe('0xb7')]('\x0a');}else{return _0x323e58['status'](_0x4de6ee)[_0xaebe('0x2b')](_0x5ad0ed);}}})[_0xaebe('0x54')](handleError(_0x323e58,null));};exports[_0xaebe('0xb7')]=function(_0x3f970e,_0x43e563,_0x459bab){var _0x2e59f1,_0x506d48,_0x11bcd4;if(_[_0xaebe('0x99')](_0x3f970e[_0xaebe('0x58')][_0xaebe('0x58')])||_0x3f970e[_0xaebe('0x58')]['body']===''){throw new db[(_0xaebe('0x89'))][(_0xaebe('0x8a'))](_0xaebe('0xb8'));}if(_['isNil'](_0x3f970e[_0xaebe('0x58')]['to'])){throw new db[(_0xaebe('0x89'))][(_0xaebe('0x8a'))]('to\x20is\x20mandatory');}_0x2e59f1=_0x3f970e[_0xaebe('0x58')]['to'];return db['WhatsappAccount'][_0xaebe('0x5c')]({'where':{'id':_0x3f970e[_0xaebe('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xaebe('0xb9'),'include':[{'model':db[_0xaebe('0x88')],'as':_0xaebe('0x9f'),'where':{'mobile':_0x2e59f1},'limit':0x1,'order':[['updatedAt',_0xaebe('0xa0')]]}]}]})[_0xaebe('0x4f')](handleEntityNotFound(_0x43e563,null))[_0xaebe('0x4f')](function(_0x100f08){if(_0x100f08&&_0x100f08['List']){_0x506d48=_0x100f08[_0xaebe('0x35')]({'plain':!![]});if(_0x506d48[_0xaebe('0xb9')]&&_0x506d48[_0xaebe('0xb9')][_0xaebe('0x9f')][_0xaebe('0x47')]){return _0x506d48[_0xaebe('0xb9')]['Contacts'][0x0];}return db[_0xaebe('0x88')][_0xaebe('0x57')](_[_0xaebe('0x1a')](_0x3f970e[_0xaebe('0x58')],{'firstName':_0x2e59f1,'mobile':_0x2e59f1,'phone':_0x2e59f1,'ListId':_0x506d48[_0xaebe('0x90')]}));}})[_0xaebe('0x4f')](handleEntityNotFound(_0x43e563,null))[_0xaebe('0x4f')](function(_0x1ce651){if(_0x1ce651){_0x11bcd4=_0x1ce651;return db[_0xaebe('0xba')]['find']({'where':{'ContactId':_0x11bcd4['id'],'closed':![],'WhatsappAccountId':_0x506d48['id']}})['then'](function(_0x53b25d){if(_0x53b25d){return[_0x53b25d,![]];}return db['WhatsappInteraction'][_0xaebe('0x57')]({'UserId':_0x3f970e[_0xaebe('0x59')]['id'],'ContactId':_0x11bcd4['id'],'WhatsappAccountId':_0x506d48['id'],'phone':_0x2e59f1,'firstMsgDirection':_0xaebe('0xbb'),'Messages':[_[_0xaebe('0x4d')](_0x3f970e[_0xaebe('0x58')],{'read':![],'body':_0x3f970e['body'][_0xaebe('0x58')],'phone':_0x2e59f1,'WhatsappAccountId':_0x506d48['id'],'UserId':_0x3f970e[_0xaebe('0x59')]['id'],'ContactId':_0x11bcd4['id']})]},{'include':[{'model':db[_0xaebe('0xa8')],'as':_0xaebe('0xbc')}]})['then'](function(_0x4fd666){return[_0x4fd666,!![]];});});}})[_0xaebe('0x73')](function(_0x19dca9,_0x2473a1){if(_0x2473a1){return _0x19dca9;}return db[_0xaebe('0xa8')][_0xaebe('0x57')](_[_0xaebe('0x4d')](_0x3f970e['body'],{'read':![],'body':_0x3f970e[_0xaebe('0x58')][_0xaebe('0x58')],'phone':_0x2e59f1,'WhatsappAccountId':_0x506d48['id'],'WhatsappInteractionId':_0x19dca9['id'],'UserId':_0x3f970e[_0xaebe('0x59')]['id'],'ContactId':_0x11bcd4['id']}))[_0xaebe('0x4f')](function(_0x8ba426){_0x19dca9['dataValues'][_0xaebe('0xbc')]=[];_0x19dca9[_0xaebe('0xbd')][_0xaebe('0xbc')][_0xaebe('0xbe')](_0x8ba426[_0xaebe('0xbd')]);return _0x19dca9;});})[_0xaebe('0x4f')](respondWithResult(_0x43e563,null))['catch'](handleError(_0x43e563,null));}; \ No newline at end of file +var _0x719a=['dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','message','error','info','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addAgents','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','bulkCreate','WhatsappApplication','findAndCountAll','getApplications','notify','Applications','account','applications','orderBy','CmContact','Sequelize','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','mobile','from','whatsapp:','Body','messageId','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','autoclose','push','close','*,*,*,*','created','WhatsappMessage','ContactId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','ListId','user','Messages'];(function(_0x60360a,_0x41eee6){var _0x3c9d76=function(_0x1997ee){while(--_0x1997ee){_0x60360a['push'](_0x60360a['shift']());}};_0x3c9d76(++_0x41eee6);}(_0x719a,0x16d));var _0xa719=function(_0x431ec1,_0x5dfb6a){_0x431ec1=_0x431ec1-0x0;var _0x1d6c97=_0x719a[_0x431ec1];return _0x1d6c97;};'use strict';var emlformat=require(_0xa719('0x0'));var rimraf=require(_0xa719('0x1'));var zipdir=require(_0xa719('0x2'));var jsonpatch=require(_0xa719('0x3'));var rp=require(_0xa719('0x4'));var moment=require(_0xa719('0x5'));var BPromise=require(_0xa719('0x6'));var Mustache=require(_0xa719('0x7'));var util=require('util');var path=require(_0xa719('0x8'));var sox=require(_0xa719('0x9'));var csv=require(_0xa719('0xa'));var ejs=require(_0xa719('0xb'));var fs=require('fs');var fs_extra=require(_0xa719('0xc'));var _=require('lodash');var squel=require(_0xa719('0xd'));var crypto=require(_0xa719('0xe'));var jsforce=require(_0xa719('0xf'));var deskjs=require(_0xa719('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa719('0x11'));var Redis=require(_0xa719('0x12'));var authService=require(_0xa719('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa719('0x14'));var hardwareService=require(_0xa719('0x15'));var logger=require(_0xa719('0x16'))(_0xa719('0x17'));var utils=require(_0xa719('0x18'));var config=require(_0xa719('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa719('0x1a'))['db'];config[_0xa719('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa719('0x1c'))(new Redis(config[_0xa719('0x1b')]));require('./whatsappAccount.socket')[_0xa719('0x1d')](socket);var jayson=require(_0xa719('0x1e'));var client=jayson[_0xa719('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1a333a,_0x155892,_0x4c42a8,_0x34421a){return new BPromise(function(_0x22bfec,_0x373744){var _0x507ba6=_0x34421a||client;return _0x507ba6[_0xa719('0x20')](_0x1a333a,_0x4c42a8)[_0xa719('0x21')](function(_0x485c87){logger['info'](_0xa719('0x22'),_0x155892,_0xa719('0x23'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x155892,'request\x20sent',JSON['stringify'](_0x485c87));if(_0x485c87['error']){if(_0x485c87['error']['code']===0x1f4){logger['error'](_0xa719('0x22'),_0x155892,_0x485c87['error'][_0xa719('0x24')]);return _0x373744(_0x485c87[_0xa719('0x25')][_0xa719('0x24')]);}logger[_0xa719('0x25')](_0xa719('0x22'),_0x155892,_0x485c87[_0xa719('0x25')][_0xa719('0x24')]);return _0x22bfec(_0x485c87[_0xa719('0x25')][_0xa719('0x24')]);}else{logger[_0xa719('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x155892,'request\x20sent');_0x22bfec(_0x485c87[_0xa719('0x27')]['message']);}})[_0xa719('0x28')](function(_0x2c27a3){logger[_0xa719('0x25')](_0xa719('0x22'),_0x155892,_0x2c27a3);_0x373744(_0x2c27a3);});});}function respondWithStatusCode(_0x5ef863,_0x290207){_0x290207=_0x290207||0xcc;return function(_0xc21853){if(_0xc21853){return _0x5ef863['sendStatus'](_0x290207);}return _0x5ef863[_0xa719('0x29')](_0x290207)[_0xa719('0x2a')]();};}function respondWithResult(_0x2f4d3f,_0x57f66b){_0x57f66b=_0x57f66b||0xc8;return function(_0x1aa8fa){if(_0x1aa8fa){return _0x2f4d3f['status'](_0x57f66b)['json'](_0x1aa8fa);}};}function respondWithFilteredResult(_0x36b829,_0x40956b){return function(_0xf7c9cf){if(_0xf7c9cf){var _0x5da5ff=typeof _0x40956b[_0xa719('0x2b')]===_0xa719('0x2c')&&typeof _0x40956b[_0xa719('0x2d')]===_0xa719('0x2c');var _0x4d27d5=_0xf7c9cf[_0xa719('0x2e')];var _0x140dcd=_0x5da5ff?0x0:_0x40956b['offset'];var _0x469b6c=_0x5da5ff?_0xf7c9cf[_0xa719('0x2e')]:_0x40956b[_0xa719('0x2b')]+_0x40956b[_0xa719('0x2d')];var _0x1e828b;if(_0x469b6c>=_0x4d27d5){_0x469b6c=_0x4d27d5;_0x1e828b=0xc8;}else{_0x1e828b=0xce;}_0x36b829[_0xa719('0x29')](_0x1e828b);return _0x36b829['set'](_0xa719('0x2f'),_0x140dcd+'-'+_0x469b6c+'/'+_0x4d27d5)[_0xa719('0x30')](_0xf7c9cf);}return null;};}function patchUpdates(_0xcfe0c7){return function(_0x446fd2){try{jsonpatch[_0xa719('0x31')](_0x446fd2,_0xcfe0c7,!![]);}catch(_0x29afd7){return BPromise[_0xa719('0x32')](_0x29afd7);}return _0x446fd2['save']();};}function saveUpdates(_0x466d14,_0x54d5b3){return function(_0x4f857f){if(_0x4f857f){return _0x4f857f[_0xa719('0x33')](_0x466d14)[_0xa719('0x21')](function(_0x202c28){return _0x202c28;});}return null;};}function removeEntity(_0x2268f8,_0xee7213){return function(_0x58ac4c){if(_0x58ac4c){return _0x58ac4c[_0xa719('0x34')]()['then'](function(){var _0x5f3ed7=_0x58ac4c[_0xa719('0x35')]({'plain':!![]});var _0x2af458=_0xa719('0x36');return db[_0xa719('0x37')][_0xa719('0x34')]({'where':{'type':_0x2af458,'resourceId':_0x5f3ed7['id']}})['then'](function(){return _0x58ac4c;});})[_0xa719('0x21')](function(){_0x2268f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5809d4,_0x52757f){return function(_0x235a6b){if(!_0x235a6b){_0x5809d4[_0xa719('0x38')](0x194);}return _0x235a6b;};}function handleError(_0x4118b3,_0x2a71f4){_0x2a71f4=_0x2a71f4||0x1f4;return function(_0x42fc7b){logger[_0xa719('0x25')](_0x42fc7b[_0xa719('0x39')]);if(_0x42fc7b[_0xa719('0x3a')]){delete _0x42fc7b[_0xa719('0x3a')];}_0x4118b3['status'](_0x2a71f4)[_0xa719('0x3b')](_0x42fc7b);};}exports[_0xa719('0x3c')]=function(_0x118a50,_0x298114){var _0x5a4c54={'include':[{'model':db[_0xa719('0x3d')],'as':_0xa719('0x3e')}]},_0x39b829={},_0xb45bbf={'count':0x0,'rows':[]};var _0x563f88=_[_0xa719('0x3f')](db[_0xa719('0x40')][_0xa719('0x41')],function(_0x89a4c1){return{'name':_0x89a4c1['fieldName'],'type':_0x89a4c1[_0xa719('0x42')][_0xa719('0x43')]};});_0x39b829[_0xa719('0x44')]=_[_0xa719('0x3f')](_0x563f88,_0xa719('0x3a'));_0x39b829[_0xa719('0x45')]=_[_0xa719('0x46')](_0x118a50['query']);_0x39b829['filters']=_[_0xa719('0x47')](_0x39b829[_0xa719('0x44')],_0x39b829[_0xa719('0x45')]);_0x5a4c54[_0xa719('0x48')]=_[_0xa719('0x47')](_0x39b829[_0xa719('0x44')],qs[_0xa719('0x49')](_0x118a50[_0xa719('0x45')][_0xa719('0x49')]));_0x5a4c54[_0xa719('0x48')]=_0x5a4c54['attributes'][_0xa719('0x4a')]?_0x5a4c54['attributes']:_0x39b829[_0xa719('0x44')];if(!_0x118a50[_0xa719('0x45')]['hasOwnProperty'](_0xa719('0x4b'))){_0x5a4c54['limit']=qs[_0xa719('0x2d')](_0x118a50[_0xa719('0x45')][_0xa719('0x2d')]);_0x5a4c54[_0xa719('0x2b')]=qs[_0xa719('0x2b')](_0x118a50[_0xa719('0x45')][_0xa719('0x2b')]);}_0x5a4c54[_0xa719('0x4c')]=qs[_0xa719('0x4d')](_0x118a50[_0xa719('0x45')]['sort']);_0x5a4c54['where']=qs[_0xa719('0x4e')](_[_0xa719('0x4f')](_0x118a50['query'],_0x39b829[_0xa719('0x4e')]),_0x563f88);if(_0x118a50[_0xa719('0x45')][_0xa719('0x50')]){_0x5a4c54[_0xa719('0x51')]=_[_0xa719('0x52')](_0x5a4c54[_0xa719('0x51')],{'$or':_[_0xa719('0x3f')](_0x563f88,function(_0xc0c133){if(_0xc0c133[_0xa719('0x42')]!==_0xa719('0x53')){var _0x5d41c1={};_0x5d41c1[_0xc0c133[_0xa719('0x3a')]]={'$like':'%'+_0x118a50['query'][_0xa719('0x50')]+'%'};return _0x5d41c1;}})});}_0x5a4c54=_[_0xa719('0x52')]({},_0x5a4c54,_0x118a50['options']);var _0x21ac92={'where':_0x5a4c54[_0xa719('0x51')]};return db[_0xa719('0x40')][_0xa719('0x2e')](_0x21ac92)[_0xa719('0x21')](function(_0xd0d288){_0xb45bbf[_0xa719('0x2e')]=_0xd0d288;if(_0x118a50[_0xa719('0x45')][_0xa719('0x54')]){_0x5a4c54[_0xa719('0x55')]=[{'all':!![]}];}return db[_0xa719('0x40')][_0xa719('0x56')](_0x5a4c54);})[_0xa719('0x21')](function(_0x4a3e63){_0xb45bbf[_0xa719('0x57')]=_0x4a3e63;return _0xb45bbf;})['then'](respondWithFilteredResult(_0x298114,_0x5a4c54))[_0xa719('0x28')](handleError(_0x298114,null));};exports[_0xa719('0x58')]=function(_0x5a5dd0,_0x5a2168){var _0x32878e={'raw':![],'where':{'id':_0x5a5dd0[_0xa719('0x59')]['id']},'include':[{'model':db[_0xa719('0x3d')],'as':_0xa719('0x3e')}]},_0x3d650b={};_0x3d650b[_0xa719('0x44')]=_['keys'](db[_0xa719('0x40')][_0xa719('0x41')]);_0x3d650b[_0xa719('0x45')]=_[_0xa719('0x46')](_0x5a5dd0['query']);_0x3d650b[_0xa719('0x4e')]=_[_0xa719('0x47')](_0x3d650b['model'],_0x3d650b['query']);_0x32878e[_0xa719('0x48')]=_['intersection'](_0x3d650b['model'],qs[_0xa719('0x49')](_0x5a5dd0['query'][_0xa719('0x49')]));_0x32878e['attributes']=_0x32878e['attributes'][_0xa719('0x4a')]?_0x32878e[_0xa719('0x48')]:_0x3d650b[_0xa719('0x44')];if(_0x5a5dd0[_0xa719('0x45')][_0xa719('0x54')]){_0x32878e[_0xa719('0x55')]=[{'all':!![]}];}_0x32878e=_['merge']({},_0x32878e,_0x5a5dd0[_0xa719('0x5a')]);return db[_0xa719('0x40')][_0xa719('0x5b')](_0x32878e)[_0xa719('0x21')](handleEntityNotFound(_0x5a2168,null))[_0xa719('0x21')](respondWithResult(_0x5a2168,null))['catch'](handleError(_0x5a2168,null));};exports[_0xa719('0x5c')]=function(_0x2ae212,_0x4b6d53){return db[_0xa719('0x40')][_0xa719('0x5c')](_0x2ae212[_0xa719('0x5d')],{})[_0xa719('0x21')](function(_0x1d585c){var _0x2f1cc6=_0x2ae212['user'][_0xa719('0x35')]({'plain':!![]});if(!_0x2f1cc6)throw new Error(_0xa719('0x5e'));if(_0x2f1cc6[_0xa719('0x5f')]==='user'){var _0x4cda78=_0x1d585c[_0xa719('0x35')]({'plain':!![]});var _0x41217a=_0xa719('0x36');return db[_0xa719('0x60')][_0xa719('0x5b')]({'where':{'name':_0x41217a,'userProfileId':_0x2f1cc6[_0xa719('0x61')]},'raw':!![]})['then'](function(_0x3c6108){if(_0x3c6108&&_0x3c6108[_0xa719('0x62')]===0x0){return db['UserProfileResource'][_0xa719('0x5c')]({'name':_0x4cda78['name'],'resourceId':_0x4cda78['id'],'type':_0x3c6108['name'],'sectionId':_0x3c6108['id']},{})[_0xa719('0x21')](function(){return _0x1d585c;});}else{return _0x1d585c;}})[_0xa719('0x28')](function(_0x4b8b13){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b8b13);throw _0x4b8b13;});}return _0x1d585c;})['then'](respondWithResult(_0x4b6d53,0xc9))['catch'](handleError(_0x4b6d53,null));};exports[_0xa719('0x33')]=function(_0x1e62e9,_0x416b7f){if(_0x1e62e9[_0xa719('0x5d')]['id']){delete _0x1e62e9['body']['id'];}return db[_0xa719('0x40')][_0xa719('0x5b')]({'where':{'id':_0x1e62e9[_0xa719('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xa719('0x3e')}]})[_0xa719('0x21')](handleEntityNotFound(_0x416b7f,null))['then'](saveUpdates(_0x1e62e9[_0xa719('0x5d')],null))[_0xa719('0x21')](respondWithResult(_0x416b7f,null))[_0xa719('0x28')](handleError(_0x416b7f,null));};exports[_0xa719('0x34')]=function(_0xc05917,_0x1247ba){return db[_0xa719('0x40')][_0xa719('0x5b')]({'where':{'id':_0xc05917['params']['id']}})[_0xa719('0x21')](handleEntityNotFound(_0x1247ba,null))[_0xa719('0x21')](removeEntity(_0x1247ba,null))['catch'](handleError(_0x1247ba,null));};exports[_0xa719('0x63')]=function(_0x4d2440,_0x205db5){return db['WhatsappAccount'][_0xa719('0x63')]()[_0xa719('0x21')](respondWithResult(_0x205db5,null))[_0xa719('0x28')](handleError(_0x205db5,null));};exports[_0xa719('0x64')]=function(_0x52f3ae,_0x1d32ff,_0x15958e){if(_0x52f3ae['body']['id']){delete _0x52f3ae['body']['id'];}return db[_0xa719('0x40')][_0xa719('0x5b')]({'where':{'id':_0x52f3ae[_0xa719('0x59')]['id']}})['then'](handleEntityNotFound(_0x1d32ff,null))['then'](function(_0x4dfb70){if(_0x4dfb70){_0x52f3ae[_0xa719('0x5d')][_0xa719('0x65')]=_0x4dfb70['id'];return db['Disposition'][_0xa719('0x5c')](_0x52f3ae[_0xa719('0x5d')]);}})['then'](respondWithResult(_0x1d32ff,null))[_0xa719('0x28')](handleError(_0x1d32ff,null));};exports[_0xa719('0x66')]=function(_0x1b7e8c,_0x2698ac,_0x539105){var _0x3b428c={'raw':![],'where':{}};var _0x3cc4f7={};var _0x473b3b={'count':0x0,'rows':[]};return db[_0xa719('0x40')][_0xa719('0x67')]({'where':{'id':_0x1b7e8c['params']['id']}})[_0xa719('0x21')](handleEntityNotFound(_0x2698ac,null))[_0xa719('0x21')](function(_0x2b4495){if(_0x2b4495){_0x3cc4f7[_0xa719('0x44')]=_['keys'](db[_0xa719('0x68')][_0xa719('0x41')]);_0x3cc4f7[_0xa719('0x45')]=_[_0xa719('0x46')](_0x1b7e8c[_0xa719('0x45')]);_0x3cc4f7['filters']=_[_0xa719('0x47')](_0x3cc4f7[_0xa719('0x44')],_0x3cc4f7[_0xa719('0x45')]);_0x3b428c[_0xa719('0x48')]=_['intersection'](_0x3cc4f7[_0xa719('0x44')],qs[_0xa719('0x49')](_0x1b7e8c['query'][_0xa719('0x49')]));_0x3b428c[_0xa719('0x48')]=_0x3b428c[_0xa719('0x48')]['length']?_0x3b428c[_0xa719('0x48')]:_0x3cc4f7['model'];if(!_0x1b7e8c[_0xa719('0x45')][_0xa719('0x69')]('nolimit')){_0x3b428c[_0xa719('0x2d')]=qs[_0xa719('0x2d')](_0x1b7e8c[_0xa719('0x45')][_0xa719('0x2d')]);_0x3b428c[_0xa719('0x2b')]=qs[_0xa719('0x2b')](_0x1b7e8c[_0xa719('0x45')][_0xa719('0x2b')]);}_0x3b428c['order']=qs[_0xa719('0x4d')](_0x1b7e8c['query']['sort']);_0x3b428c[_0xa719('0x51')]=qs[_0xa719('0x4e')](_[_0xa719('0x4f')](_0x1b7e8c[_0xa719('0x45')],_0x3cc4f7[_0xa719('0x4e')]));_0x3b428c[_0xa719('0x51')][_0xa719('0x65')]=_0x2b4495['id'];if(_0x1b7e8c[_0xa719('0x45')]['filter']){_0x3b428c[_0xa719('0x51')]=_[_0xa719('0x52')](_0x3b428c[_0xa719('0x51')],{'$or':_['map'](_0x3b428c[_0xa719('0x48')],function(_0x3cbfec){var _0x1cdc1b={};_0x1cdc1b[_0x3cbfec]={'$like':'%'+_0x1b7e8c[_0xa719('0x45')][_0xa719('0x50')]+'%'};return _0x1cdc1b;})});}_0x3b428c=_[_0xa719('0x52')]({},_0x3b428c,_0x1b7e8c['options']);return db[_0xa719('0x68')][_0xa719('0x2e')]({'where':_0x3b428c[_0xa719('0x51')]})[_0xa719('0x21')](function(_0x562942){_0x473b3b[_0xa719('0x2e')]=_0x562942;if(_0x1b7e8c[_0xa719('0x45')][_0xa719('0x54')]){_0x3b428c[_0xa719('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xa719('0x56')](_0x3b428c);})[_0xa719('0x21')](function(_0x7e51c1){_0x473b3b[_0xa719('0x57')]=_0x7e51c1;return _0x473b3b;});}})[_0xa719('0x21')](respondWithFilteredResult(_0x2698ac,_0x3b428c))[_0xa719('0x28')](handleError(_0x2698ac,null));};exports['removeDispositions']=function(_0x305945,_0x4c8986,_0x2373be){return db['WhatsappAccount'][_0xa719('0x5b')]({'where':{'id':_0x305945[_0xa719('0x59')]['id']}})[_0xa719('0x21')](handleEntityNotFound(_0x4c8986,null))['then'](function(_0x3c990b){if(_0x3c990b){return _0x3c990b[_0xa719('0x6a')](_0x305945[_0xa719('0x45')][_0xa719('0x6b')]);}})['then'](respondWithStatusCode(_0x4c8986,null))[_0xa719('0x28')](handleError(_0x4c8986,null));};exports[_0xa719('0x6c')]=function(_0x575985,_0xf32739,_0x25cd8e){if(_0x575985[_0xa719('0x5d')]['id']){delete _0x575985[_0xa719('0x5d')]['id'];}return db[_0xa719('0x40')]['find']({'where':{'id':_0x575985['params']['id']}})[_0xa719('0x21')](handleEntityNotFound(_0xf32739,null))['then'](function(_0x186f96){if(_0x186f96){_0x575985[_0xa719('0x5d')][_0xa719('0x65')]=_0x186f96['id'];return db[_0xa719('0x6d')][_0xa719('0x5c')](_0x575985[_0xa719('0x5d')]);}})['then'](respondWithResult(_0xf32739,null))['catch'](handleError(_0xf32739,null));};exports[_0xa719('0x6e')]=function(_0x27cdb4,_0xfad717,_0x51d831){var _0x104070={'raw':![],'where':{}};var _0x5dae1e={};var _0x50cdc7={'count':0x0,'rows':[]};return db[_0xa719('0x40')][_0xa719('0x67')]({'where':{'id':_0x27cdb4[_0xa719('0x59')]['id']}})[_0xa719('0x21')](handleEntityNotFound(_0xfad717,null))[_0xa719('0x21')](function(_0x4a2755){if(_0x4a2755){_0x5dae1e[_0xa719('0x44')]=_[_0xa719('0x46')](db['CannedAnswer'][_0xa719('0x41')]);_0x5dae1e[_0xa719('0x45')]=_[_0xa719('0x46')](_0x27cdb4[_0xa719('0x45')]);_0x5dae1e[_0xa719('0x4e')]=_['intersection'](_0x5dae1e['model'],_0x5dae1e[_0xa719('0x45')]);_0x104070[_0xa719('0x48')]=_[_0xa719('0x47')](_0x5dae1e[_0xa719('0x44')],qs[_0xa719('0x49')](_0x27cdb4[_0xa719('0x45')][_0xa719('0x49')]));_0x104070['attributes']=_0x104070[_0xa719('0x48')][_0xa719('0x4a')]?_0x104070[_0xa719('0x48')]:_0x5dae1e[_0xa719('0x44')];if(!_0x27cdb4['query'][_0xa719('0x69')](_0xa719('0x4b'))){_0x104070['limit']=qs[_0xa719('0x2d')](_0x27cdb4['query'][_0xa719('0x2d')]);_0x104070[_0xa719('0x2b')]=qs['offset'](_0x27cdb4[_0xa719('0x45')][_0xa719('0x2b')]);}_0x104070[_0xa719('0x4c')]=qs[_0xa719('0x4d')](_0x27cdb4[_0xa719('0x45')][_0xa719('0x4d')]);_0x104070[_0xa719('0x51')]=qs[_0xa719('0x4e')](_['pick'](_0x27cdb4[_0xa719('0x45')],_0x5dae1e[_0xa719('0x4e')]));_0x104070[_0xa719('0x51')][_0xa719('0x65')]=_0x4a2755['id'];if(_0x27cdb4[_0xa719('0x45')][_0xa719('0x50')]){_0x104070['where']=_['merge'](_0x104070[_0xa719('0x51')],{'$or':_['map'](_0x104070[_0xa719('0x48')],function(_0xd27b4c){var _0x3e3831={};_0x3e3831[_0xd27b4c]={'$like':'%'+_0x27cdb4[_0xa719('0x45')][_0xa719('0x50')]+'%'};return _0x3e3831;})});}_0x104070=_[_0xa719('0x52')]({},_0x104070,_0x27cdb4[_0xa719('0x5a')]);return db['CannedAnswer']['count']({'where':_0x104070[_0xa719('0x51')]})['then'](function(_0x40eaea){_0x50cdc7[_0xa719('0x2e')]=_0x40eaea;if(_0x27cdb4[_0xa719('0x45')]['includeAll']){_0x104070[_0xa719('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa719('0x56')](_0x104070);})['then'](function(_0x48f8ea){_0x50cdc7[_0xa719('0x57')]=_0x48f8ea;return _0x50cdc7;});}})[_0xa719('0x21')](respondWithFilteredResult(_0xfad717,_0x104070))[_0xa719('0x28')](handleError(_0xfad717,null));};exports['removeAnswers']=function(_0x653da7,_0x3d2148,_0x3d8e87){return db['WhatsappAccount']['find']({'where':{'id':_0x653da7[_0xa719('0x59')]['id']}})['then'](handleEntityNotFound(_0x3d2148,null))[_0xa719('0x21')](function(_0x572f18){if(_0x572f18){return _0x572f18['removeAnswers'](_0x653da7[_0xa719('0x45')][_0xa719('0x6b')]);}})['then'](respondWithStatusCode(_0x3d2148,null))[_0xa719('0x28')](handleError(_0x3d2148,null));};exports[_0xa719('0x6f')]=function(_0x2f821d,_0x2f7866,_0x1432db){return db[_0xa719('0x40')][_0xa719('0x5b')]({'where':{'id':_0x2f821d[_0xa719('0x59')]['id']}})['then'](handleEntityNotFound(_0x2f7866,null))['then'](function(_0x48aa42){if(_0x48aa42){return _0x48aa42[_0xa719('0x6f')](_0x2f821d[_0xa719('0x5d')]['ids'],_['omit'](_0x2f821d[_0xa719('0x5d')],[_0xa719('0x6b'),'id'])||{})[_0xa719('0x70')](function(_0x40013e){for(var _0x334ad9=0x0;_0x334ad9<_0x2f821d['body']['ids'][_0xa719('0x4a')];_0x334ad9+=0x1){socket[_0xa719('0x71')](_0xa719('0x72'),{'UserId':Number(_0x2f821d[_0xa719('0x5d')][_0xa719('0x6b')][_0x334ad9]),'WhatsappAccountId':Number(_0x2f821d[_0xa719('0x59')]['id'])});}return _0x40013e;});}})[_0xa719('0x21')](respondWithResult(_0x2f7866,null))[_0xa719('0x28')](handleError(_0x2f7866,null));};exports['removeAgents']=function(_0x3d9c9d,_0x1d60a2,_0x17a862){return db[_0xa719('0x40')][_0xa719('0x5b')]({'where':{'id':_0x3d9c9d[_0xa719('0x59')]['id']}})[_0xa719('0x21')](handleEntityNotFound(_0x1d60a2,null))['then'](function(_0x102b37){if(_0x102b37){return _0x102b37['removeAgents'](_0x3d9c9d[_0xa719('0x45')][_0xa719('0x6b')])['then'](function(){if(_[_0xa719('0x73')](_0x3d9c9d[_0xa719('0x45')][_0xa719('0x6b')])){for(var _0x493515=0x0;_0x493515<_0x3d9c9d[_0xa719('0x45')]['ids'][_0xa719('0x4a')];_0x493515+=0x1){socket[_0xa719('0x71')](_0xa719('0x74'),{'UserId':Number(_0x3d9c9d['query'][_0xa719('0x6b')][_0x493515]),'WhatsappAccountId':Number(_0x3d9c9d[_0xa719('0x59')]['id'])});}}else{socket[_0xa719('0x71')](_0xa719('0x74'),{'UserId':Number(_0x3d9c9d[_0xa719('0x45')][_0xa719('0x6b')]),'WhatsappAccountId':Number(_0x3d9c9d[_0xa719('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d60a2,null))[_0xa719('0x28')](handleError(_0x1d60a2,null));};exports[_0xa719('0x75')]=function(_0x591e30,_0xca2497,_0x1023e9){var _0x2ac7e3={};var _0x125963={};var _0x6accc0;var _0x1ee5d7;return db['WhatsappAccount'][_0xa719('0x67')]({'where':{'id':_0x591e30[_0xa719('0x59')]['id']}})[_0xa719('0x21')](handleEntityNotFound(_0xca2497,null))[_0xa719('0x21')](function(_0x168dbd){if(_0x168dbd){_0x6accc0=_0x168dbd;_0x125963[_0xa719('0x44')]=_[_0xa719('0x46')](db['User'][_0xa719('0x41')]);_0x125963[_0xa719('0x45')]=_[_0xa719('0x46')](_0x591e30[_0xa719('0x45')]);_0x125963[_0xa719('0x4e')]=_[_0xa719('0x47')](_0x125963[_0xa719('0x44')],_0x125963[_0xa719('0x45')]);_0x2ac7e3[_0xa719('0x48')]=_[_0xa719('0x47')](_0x125963['model'],qs[_0xa719('0x49')](_0x591e30[_0xa719('0x45')][_0xa719('0x49')]));_0x2ac7e3[_0xa719('0x48')]=_0x2ac7e3[_0xa719('0x48')][_0xa719('0x4a')]?_0x2ac7e3['attributes']:_0x125963[_0xa719('0x44')];_0x2ac7e3['order']=qs['sort'](_0x591e30[_0xa719('0x45')][_0xa719('0x4d')]);_0x2ac7e3[_0xa719('0x51')]=qs[_0xa719('0x4e')](_['pick'](_0x591e30[_0xa719('0x45')],_0x125963['filters']));if(_0x591e30['query']['filter']){_0x2ac7e3[_0xa719('0x51')]=_[_0xa719('0x52')](_0x2ac7e3[_0xa719('0x51')],{'$or':_[_0xa719('0x3f')](_0x2ac7e3[_0xa719('0x48')],function(_0x29633e){var _0x269cf5={};_0x269cf5[_0x29633e]={'$like':'%'+_0x591e30[_0xa719('0x45')][_0xa719('0x50')]+'%'};return _0x269cf5;})});}_0x2ac7e3=_[_0xa719('0x52')]({},_0x2ac7e3,_0x591e30[_0xa719('0x5a')]);return _0x6accc0['getAgents'](_0x2ac7e3);}})[_0xa719('0x21')](function(_0x3f8a19){if(_0x3f8a19){_0x1ee5d7=_0x3f8a19[_0xa719('0x4a')];if(!_0x591e30[_0xa719('0x45')][_0xa719('0x69')](_0xa719('0x4b'))){_0x2ac7e3[_0xa719('0x2d')]=qs[_0xa719('0x2d')](_0x591e30['query'][_0xa719('0x2d')]);_0x2ac7e3[_0xa719('0x2b')]=qs[_0xa719('0x2b')](_0x591e30[_0xa719('0x45')][_0xa719('0x2b')]);}return _0x6accc0[_0xa719('0x75')](_0x2ac7e3);}})[_0xa719('0x21')](function(_0x553725){if(_0x553725){return _0x553725?{'count':_0x1ee5d7,'rows':_0x553725}:null;}})[_0xa719('0x21')](respondWithResult(_0xca2497,null))[_0xa719('0x28')](handleError(_0xca2497,null));};exports[_0xa719('0x76')]=function(_0x731a80,_0x198f3a,_0xa30290){return db[_0xa719('0x40')]['findOne']({'where':{'id':_0x731a80[_0xa719('0x59')]['id']}})[_0xa719('0x21')](handleEntityNotFound(_0x198f3a,null))[_0xa719('0x21')](function(_0x128638){if(_0x128638){return db[_0xa719('0x77')][_0xa719('0x78')](function(_0xb279da){return db['WhatsappApplication'][_0xa719('0x34')]({'where':{'WhatsappAccountId':_0x731a80[_0xa719('0x59')]['id']},'transaction':_0xb279da})[_0xa719('0x21')](function(_0x6351b2){var _0x1ce9e7=_['map'](_0x731a80[_0xa719('0x5d')],function(_0xcb67d4){_0xcb67d4[_0xa719('0x65')]=_0x731a80[_0xa719('0x59')]['id'];return _0xcb67d4;});return db['WhatsappApplication'][_0xa719('0x79')](_0x1ce9e7,{'transaction':_0xb279da});});})[_0xa719('0x21')](function(){return db[_0xa719('0x7a')][_0xa719('0x7b')]({'where':{'WhatsappAccountId':_0x731a80[_0xa719('0x59')]['id']},'order':'priority'});});}})[_0xa719('0x21')](respondWithResult(_0x198f3a,null))[_0xa719('0x28')](handleError(_0x198f3a,null));};exports[_0xa719('0x7c')]=function(_0x4a8498,_0x4e5686,_0x188091){var _0x28a920={};var _0x38c3fa={};var _0x1067b0;var _0x53b137;return db['WhatsappAccount'][_0xa719('0x67')]({'where':{'id':_0x4a8498[_0xa719('0x59')]['id']}})[_0xa719('0x21')](handleEntityNotFound(_0x4e5686,null))[_0xa719('0x21')](function(_0x28fbf6){if(_0x28fbf6){_0x1067b0=_0x28fbf6;_0x38c3fa['model']=_['keys'](db[_0xa719('0x7a')]['rawAttributes']);_0x38c3fa[_0xa719('0x45')]=_[_0xa719('0x46')](_0x4a8498['query']);_0x38c3fa['filters']=_[_0xa719('0x47')](_0x38c3fa['model'],_0x38c3fa[_0xa719('0x45')]);_0x28a920['attributes']=_[_0xa719('0x47')](_0x38c3fa['model'],qs[_0xa719('0x49')](_0x4a8498[_0xa719('0x45')][_0xa719('0x49')]));_0x28a920[_0xa719('0x48')]=_0x28a920[_0xa719('0x48')]['length']?_0x28a920[_0xa719('0x48')]:_0x38c3fa['model'];_0x28a920['order']=qs[_0xa719('0x4d')](_0x4a8498[_0xa719('0x45')]['sort']);_0x28a920[_0xa719('0x51')]=qs[_0xa719('0x4e')](_[_0xa719('0x4f')](_0x4a8498[_0xa719('0x45')],_0x38c3fa[_0xa719('0x4e')]));if(_0x4a8498['query'][_0xa719('0x50')]){_0x28a920[_0xa719('0x51')]=_[_0xa719('0x52')](_0x28a920[_0xa719('0x51')],{'$or':_[_0xa719('0x3f')](_0x28a920[_0xa719('0x48')],function(_0x3351f0){var _0x56a270={};_0x56a270[_0x3351f0]={'$like':'%'+_0x4a8498[_0xa719('0x45')][_0xa719('0x50')]+'%'};return _0x56a270;})});}_0x28a920=_[_0xa719('0x52')]({},_0x28a920,_0x4a8498[_0xa719('0x5a')]);return _0x1067b0['getApplications'](_0x28a920);}})[_0xa719('0x21')](function(_0x790013){if(_0x790013){_0x53b137=_0x790013[_0xa719('0x4a')];if(!_0x4a8498[_0xa719('0x45')][_0xa719('0x69')](_0xa719('0x4b'))){_0x28a920[_0xa719('0x2d')]=qs['limit'](_0x4a8498['query'][_0xa719('0x2d')]);_0x28a920[_0xa719('0x2b')]=qs[_0xa719('0x2b')](_0x4a8498['query']['offset']);}return _0x1067b0['getApplications'](_0x28a920);}})[_0xa719('0x21')](function(_0xd4de67){if(_0xd4de67){return _0xd4de67?{'count':_0x53b137,'rows':_0xd4de67}:null;}})['then'](respondWithResult(_0x4e5686,null))[_0xa719('0x28')](handleError(_0x4e5686,null));};exports[_0xa719('0x7d')]=function(_0x42a9c9,_0x59f00b,_0x3c8b2c){var _0x453901={'channel':'whatsapp'};var _0x1ffc76=[];var _0x543998=[];var _0x54e3a8={};return db['WhatsappAccount'][_0xa719('0x5b')]({'where':{'id':_0x42a9c9[_0xa719('0x59')]['id']},'include':[{'model':db[_0xa719('0x7a')],'as':_0xa719('0x7e')}]})['then'](handleEntityNotFound(_0x59f00b,null))['then'](function(_0x25897c){_0x453901[_0xa719('0x7f')]=_0x25897c;_0x453901[_0xa719('0x80')]=_[_0xa719('0x81')](_0x25897c[_0xa719('0x7e')],['priority'],['asc']);if(_0x453901[_0xa719('0x7f')][_0xa719('0x7e')]){delete _0x453901[_0xa719('0x7f')]['Applications'];}return db[_0xa719('0x82')][_0xa719('0x63')]();})[_0xa719('0x21')](function(_0x4ad577){if(!_0x4ad577){throw new db[(_0xa719('0x83'))]['ValidationError'](_0xa719('0x84'));}_0x1ffc76=_['difference'](_['keys'](_0x4ad577),['createdAt',_0xa719('0x85')]);_0x543998=_[_0xa719('0x86')](_['keys'](_0x4ad577),[_0xa719('0x87'),_0xa719('0x85'),_0xa719('0x88'),'ListId']);_0x453901[_0xa719('0x5d')]={'mapKey':_0xa719('0x89')};if(_0x453901[_0xa719('0x7f')][_0xa719('0x42')]&&_0x453901[_0xa719('0x7f')]['type']==='twilio'){_0x453901['body'][_0xa719('0x8a')]=_0x42a9c9[_0xa719('0x5d')]['From']['replace'](_0xa719('0x8b'),'');_0x453901['body'][_0xa719('0x5d')]=_0x42a9c9[_0xa719('0x5d')][_0xa719('0x8c')];_0x453901[_0xa719('0x5d')][_0xa719('0x8d')]=_0x42a9c9[_0xa719('0x5d')][_0xa719('0x8e')];}if(_0x453901[_0xa719('0x5d')]['id']){delete _0x453901[_0xa719('0x5d')]['id'];}if(_[_0xa719('0x8f')](_0x453901['body']['from'])){throw new db[(_0xa719('0x83'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xa719('0x8f')](_0x453901[_0xa719('0x5d')][_0xa719('0x5d')])||_0x453901[_0xa719('0x5d')][_0xa719('0x5d')]===''){throw new db[(_0xa719('0x83'))]['ValidationError'](_0xa719('0x90'));}if(_[_0xa719('0x8f')](_0x453901[_0xa719('0x5d')][_0xa719('0x91')])){throw new db[(_0xa719('0x83'))][(_0xa719('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x543998);}if(!_[_0xa719('0x93')](_0x543998,_0x453901[_0xa719('0x5d')]['mapKey'])){throw new db[(_0xa719('0x83'))][(_0xa719('0x92'))](_0xa719('0x94')+_0x543998);}_0x54e3a8[_0x453901[_0xa719('0x5d')][_0xa719('0x91')]]=_0x453901[_0xa719('0x5d')][_0xa719('0x8a')];return db[_0xa719('0x95')][_0xa719('0x5b')]({'where':{'id':_0x453901[_0xa719('0x7f')]['ListId']},'include':[{'model':db[_0xa719('0x82')],'as':_0xa719('0x96'),'where':_0x54e3a8,'limit':0x1,'order':[[_0xa719('0x85'),_0xa719('0x97')]]}]});})[_0xa719('0x21')](handleEntityNotFound(_0x59f00b,null))['then'](function(_0x11eda4){if(_0x11eda4){_0x453901[_0xa719('0x98')]=_['omit'](_0x11eda4,[_0xa719('0x96')]);if(_0x11eda4[_0xa719('0x96')][_0xa719('0x4a')]){return _0x11eda4[_0xa719('0x96')][0x0];}var _0x15b6e3=_[_0xa719('0x99')](_0x453901[_0xa719('0x5d')],{'firstName':_0x453901[_0xa719('0x5d')][_0xa719('0x8a')],'ListId':_0x11eda4['id']});_0x15b6e3[_0x453901[_0xa719('0x5d')][_0xa719('0x91')]]=_0x453901[_0xa719('0x5d')][_0xa719('0x8a')];return db[_0xa719('0x82')][_0xa719('0x5c')](_0x15b6e3,{'fields':_0x1ffc76,'raw':!![]});}})[_0xa719('0x21')](handleEntityNotFound(_0x59f00b,null))[_0xa719('0x21')](function(_0x133465){if(_0x133465){_0x453901[_0xa719('0x9a')]=_0x133465;var _0x1de4f2={'ContactId':_0x133465['id'],'phone':_0x453901[_0xa719('0x5d')][_0xa719('0x8a')],'WhatsappAccountId':_0x42a9c9['params']['id']};var _0x1af0ac={'ContactId':_0x133465['id'],'WhatsappAccountId':_0x42a9c9[_0xa719('0x59')]['id'],'closed':![]};return db[_0xa719('0x9b')]['find']({'where':_0x1af0ac})['then'](function(_0x3c9b0f){if(_0x3c9b0f){return[_0x3c9b0f,![]];}return db[_0xa719('0x9b')][_0xa719('0x5c')](_0x1de4f2)[_0xa719('0x21')](function(_0x3e5fac){return[_0x3e5fac,!![]];});});}})[_0xa719('0x70')](function(_0x33534d,_0x517225){_0x453901[_0xa719('0x9c')]=_0x33534d['get']({'plain':!![]});_0x453901[_0xa719('0x9c')]['created']=![];if(_0x517225){if(_0x453901[_0xa719('0x7f')][_0xa719('0x9d')]){_0x453901[_0xa719('0x80')][_0xa719('0x9e')]({'id':0x0,'priority':_0x453901[_0xa719('0x80')]['length']+0x1,'app':_0xa719('0x9f'),'appdata':'unmanaged','interval':_0xa719('0xa0')});}_0x453901[_0xa719('0x9c')][_0xa719('0xa1')]=!![];}return db[_0xa719('0xa2')][_0xa719('0x5c')]({'phone':_0x453901[_0xa719('0x5d')][_0xa719('0x8a')],'messageId':_0x453901[_0xa719('0x5d')][_0xa719('0x8d')],'body':_0x453901[_0xa719('0x5d')][_0xa719('0x5d')],'WhatsappAccountId':_0x42a9c9[_0xa719('0x59')]['id'],'WhatsappInteractionId':_0x33534d['id'],'direction':'in','ContactId':_0x33534d[_0xa719('0xa3')],'AttachmentId':_0x453901[_0xa719('0x5d')]['AttachmentId']});})['then'](function(_0x251ce8){_0x453901[_0xa719('0x24')]=_0x251ce8;if(_0x453901[_0xa719('0x9c')][_0xa719('0xa4')]){return db[_0xa719('0xa5')][_0xa719('0x5b')]({'attributes':['id','name'],'where':{'id':_0x453901[_0xa719('0x9c')][_0xa719('0xa4')]}})[_0xa719('0x21')](function(_0x3134f6){if(_0x3134f6){_0x453901[_0xa719('0x80')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa719('0xa6'),'appdata':_0x3134f6[_0xa719('0x3a')]+','+(_0x453901['account'][_0xa719('0xa7')]||0xa),'interval':_0xa719('0xa0')});}return respondWithRpcPromise(_0xa719('0xa8'),_0xa719('0xa9'),_0x453901);});}return respondWithRpcPromise(_0xa719('0xa8'),_0xa719('0xa9'),_0x453901);})[_0xa719('0x21')](function(_0xaea7ea){if(_0xaea7ea){var _0x2e3720=0xc8;var _0x2b5f80='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2b5f80,_0x2e3720,_0xa719('0xaa'));logger['debug'](_0xa719('0xab'),_0x2b5f80,_0x2e3720,_0xa719('0xaa'),JSON[_0xa719('0xac')](_0xaea7ea));if(_0x453901[_0xa719('0x7f')][_0xa719('0x42')]===_0xa719('0xad')){return _0x59f00b[_0xa719('0x29')](_0x2e3720)['set'](_0xa719('0xae'),_0xa719('0xaf'))[_0xa719('0x3b')]('\x0a');}else{return _0x59f00b[_0xa719('0x29')](_0x2e3720)[_0xa719('0x30')](_0xaea7ea);}}})['catch'](handleError(_0x59f00b,null));};exports[_0xa719('0x3b')]=function(_0x14c7d0,_0x91f687,_0x152e7c){var _0x3777f0,_0x153894,_0x5e7ac3;if(_[_0xa719('0x8f')](_0x14c7d0[_0xa719('0x5d')][_0xa719('0x5d')])||_0x14c7d0[_0xa719('0x5d')][_0xa719('0x5d')]===''){throw new db['Sequelize'][(_0xa719('0x92'))](_0xa719('0x90'));}if(_[_0xa719('0x8f')](_0x14c7d0[_0xa719('0x5d')]['to'])){throw new db[(_0xa719('0x83'))][(_0xa719('0x92'))](_0xa719('0xb0'));}_0x3777f0=_0x14c7d0[_0xa719('0x5d')]['to'];return db[_0xa719('0x40')][_0xa719('0x5b')]({'where':{'id':_0x14c7d0[_0xa719('0x59')]['id']},'include':[{'model':db[_0xa719('0x95')],'as':_0xa719('0xb1'),'include':[{'model':db['CmContact'],'as':_0xa719('0x96'),'where':{'mobile':_0x3777f0},'limit':0x1,'order':[[_0xa719('0x85'),_0xa719('0x97')]]}]}]})[_0xa719('0x21')](handleEntityNotFound(_0x91f687,null))[_0xa719('0x21')](function(_0x333cfb){if(_0x333cfb&&_0x333cfb[_0xa719('0xb1')]){_0x153894=_0x333cfb[_0xa719('0x35')]({'plain':!![]});if(_0x153894[_0xa719('0xb1')]&&_0x153894[_0xa719('0xb1')][_0xa719('0x96')][_0xa719('0x4a')]){return _0x153894['List']['Contacts'][0x0];}return db['CmContact'][_0xa719('0x5c')](_[_0xa719('0x99')](_0x14c7d0[_0xa719('0x5d')],{'firstName':_0x3777f0,'mobile':_0x3777f0,'phone':_0x3777f0,'ListId':_0x153894[_0xa719('0xb2')]}));}})[_0xa719('0x21')](handleEntityNotFound(_0x91f687,null))[_0xa719('0x21')](function(_0xc41b3b){if(_0xc41b3b){_0x5e7ac3=_0xc41b3b;return db[_0xa719('0x9b')][_0xa719('0x5b')]({'where':{'ContactId':_0x5e7ac3['id'],'closed':![],'WhatsappAccountId':_0x153894['id']}})[_0xa719('0x21')](function(_0x103b6b){if(_0x103b6b){return[_0x103b6b,![]];}return db[_0xa719('0x9b')][_0xa719('0x5c')]({'UserId':_0x14c7d0['user']['id'],'ContactId':_0x5e7ac3['id'],'WhatsappAccountId':_0x153894['id'],'phone':_0x3777f0,'firstMsgDirection':'out','Messages':[_[_0xa719('0x52')](_0x14c7d0[_0xa719('0x5d')],{'read':![],'body':_0x14c7d0[_0xa719('0x5d')][_0xa719('0x5d')],'phone':_0x3777f0,'WhatsappAccountId':_0x153894['id'],'UserId':_0x14c7d0[_0xa719('0xb3')]['id'],'ContactId':_0x5e7ac3['id']})]},{'include':[{'model':db[_0xa719('0xa2')],'as':_0xa719('0xb4')}]})[_0xa719('0x21')](function(_0x2e521c){return[_0x2e521c,!![]];});});}})[_0xa719('0x70')](function(_0x490e63,_0x3e65d9){if(_0x3e65d9){return _0x490e63;}return db['WhatsappMessage'][_0xa719('0x5c')](_[_0xa719('0x52')](_0x14c7d0[_0xa719('0x5d')],{'read':![],'body':_0x14c7d0[_0xa719('0x5d')][_0xa719('0x5d')],'phone':_0x3777f0,'WhatsappAccountId':_0x153894['id'],'WhatsappInteractionId':_0x490e63['id'],'UserId':_0x14c7d0[_0xa719('0xb3')]['id'],'ContactId':_0x5e7ac3['id']}))[_0xa719('0x21')](function(_0x486c58){_0x490e63[_0xa719('0xb5')]['Messages']=[];_0x490e63[_0xa719('0xb5')][_0xa719('0xb4')][_0xa719('0x9e')](_0x486c58[_0xa719('0xb5')]);return _0x490e63;});})[_0xa719('0x21')](respondWithResult(_0x91f687,null))['catch'](handleError(_0x91f687,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 752a5f6..c573473 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 _0x0afb=['WhatsappAccount','save','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x428c50,_0x22fed3){var _0x5df527=function(_0x4ad123){while(--_0x4ad123){_0x428c50['push'](_0x428c50['shift']());}};_0x5df527(++_0x22fed3);}(_0x0afb,0x132));var _0xb0af=function(_0x287157,_0x4eb641){_0x287157=_0x287157-0x0;var _0x561a5b=_0x0afb[_0x287157];return _0x561a5b;};'use strict';var EventEmitter=require(_0xb0af('0x0'));var WhatsappAccount=require(_0xb0af('0x1'))['db'][_0xb0af('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb0af('0x3'),'afterUpdate':'update','afterDestroy':_0xb0af('0x4')};function emitEvent(_0x2dc571){return function(_0x5e881a,_0x102c9c,_0x51423e){WhatsappAccountEvents['emit'](_0x2dc571+':'+_0x5e881a['id'],_0x5e881a);WhatsappAccountEvents['emit'](_0x2dc571,_0x5e881a);_0x51423e(null);};}for(var e in events){if(events[_0xb0af('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xb0af('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x72a1=['hook','WhatsappAccount','setMaxListeners','save','hasOwnProperty'];(function(_0x25ef78,_0x11ea85){var _0x5575a9=function(_0x499235){while(--_0x499235){_0x25ef78['push'](_0x25ef78['shift']());}};_0x5575a9(++_0x11ea85);}(_0x72a1,0x1a0));var _0x172a=function(_0x498b6a,_0x1432c1){_0x498b6a=_0x498b6a-0x0;var _0x1446c4=_0x72a1[_0x498b6a];return _0x1446c4;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x172a('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x172a('0x1')](0x0);var events={'afterCreate':_0x172a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d30e3){return function(_0x2d60f0,_0x30997f,_0x5b2a2b){WhatsappAccountEvents['emit'](_0x3d30e3+':'+_0x2d60f0['id'],_0x2d60f0);WhatsappAccountEvents['emit'](_0x3d30e3,_0x2d60f0);_0x5b2a2b(null);};}for(var e in events){if(events[_0x172a('0x3')](e)){var event=events[e];WhatsappAccount[_0x172a('0x4')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index eb532f1..75941bf 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 _0x4bb4=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4c0097,_0x21eff6){var _0x3e2024=function(_0x3387be){while(--_0x3387be){_0x4c0097['push'](_0x4c0097['shift']());}};_0x3e2024(++_0x21eff6);}(_0x4bb4,0x70));var _0x44bb=function(_0x3ea817,_0xadab1c){_0x3ea817=_0x3ea817-0x0;var _0x533d4b=_0x4bb4[_0x3ea817];return _0x533d4b;};'use strict';var _=require(_0x44bb('0x0'));var util=require(_0x44bb('0x1'));var logger=require(_0x44bb('0x2'))(_0x44bb('0x3'));var moment=require(_0x44bb('0x4'));var BPromise=require(_0x44bb('0x5'));var rp=require(_0x44bb('0x6'));var fs=require('fs');var path=require(_0x44bb('0x7'));var rimraf=require(_0x44bb('0x8'));var config=require('../../config/environment');var attributes=require(_0x44bb('0x9'));module[_0x44bb('0xa')]=function(_0x3a71c7,_0x517b00){return _0x3a71c7['define'](_0x44bb('0xb'),attributes,{'tableName':_0x44bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x679b=['api','moment','path','rimraf','../../config/environment','define','whatsapp_accounts','lodash','util'];(function(_0x223c79,_0x3db2ea){var _0x18573e=function(_0x6a8bcf){while(--_0x6a8bcf){_0x223c79['push'](_0x223c79['shift']());}};_0x18573e(++_0x3db2ea);}(_0x679b,0x166));var _0xb679=function(_0x261e67,_0x57ef75){_0x261e67=_0x261e67-0x0;var _0x2b77eb=_0x679b[_0x261e67];return _0x2b77eb;};'use strict';var _=require(_0xb679('0x0'));var util=require(_0xb679('0x1'));var logger=require('../../config/logger')(_0xb679('0x2'));var moment=require(_0xb679('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb679('0x4'));var rimraf=require(_0xb679('0x5'));var config=require(_0xb679('0x6'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x2cb34f,_0xba29e){return _0x2cb34f[_0xb679('0x7')]('WhatsappAccount',attributes,{'tableName':_0xb679('0x8'),'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 241ed29..9e5c947 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 _0x5879=['map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','WhatsappAccount','find','options','raw','where','attributes','include'];(function(_0x14023b,_0x2348a8){var _0x2c16dd=function(_0x366731){while(--_0x366731){_0x14023b['push'](_0x14023b['shift']());}};_0x2c16dd(++_0x2348a8);}(_0x5879,0xdb));var _0x9587=function(_0x328e2f,_0x5a4f80){_0x328e2f=_0x328e2f-0x0;var _0x118ef1=_0x5879[_0x328e2f];return _0x118ef1;};'use strict';var _=require(_0x9587('0x0'));var util=require(_0x9587('0x1'));var moment=require(_0x9587('0x2'));var BPromise=require(_0x9587('0x3'));var rs=require(_0x9587('0x4'));var fs=require('fs');var Redis=require(_0x9587('0x5'));var db=require(_0x9587('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9587('0x7'))('rpc');var config=require(_0x9587('0x8'));var jayson=require(_0x9587('0x9'));var client=jayson[_0x9587('0xa')][_0x9587('0xb')]({'port':0x232a});config[_0x9587('0xc')]=_['defaults'](config[_0x9587('0xc')],{'host':_0x9587('0xd'),'port':0x18eb});var socket=require(_0x9587('0xe'))(new Redis(config[_0x9587('0xc')]));require(_0x9587('0xf'))[_0x9587('0x10')](socket);function respondWithRpcPromise(_0x29f32f,_0x52ba5f,_0x11a580){return new BPromise(function(_0x105eb1,_0x330c9e){return client['request'](_0x29f32f,_0x11a580)[_0x9587('0x11')](function(_0x417151){logger[_0x9587('0x12')](_0x9587('0x13'),_0x52ba5f,'request\x20sent');logger[_0x9587('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x52ba5f,_0x9587('0x15'),JSON[_0x9587('0x16')](_0x417151));if(_0x417151['error']){if(_0x417151[_0x9587('0x17')][_0x9587('0x18')]===0x1f4){logger['error'](_0x9587('0x13'),_0x52ba5f,_0x417151[_0x9587('0x17')][_0x9587('0x19')]);return _0x330c9e(_0x417151[_0x9587('0x17')][_0x9587('0x19')]);}logger[_0x9587('0x17')](_0x9587('0x13'),_0x52ba5f,_0x417151[_0x9587('0x17')][_0x9587('0x19')]);return _0x105eb1(_0x417151[_0x9587('0x17')][_0x9587('0x19')]);}else{logger[_0x9587('0x12')](_0x9587('0x13'),_0x52ba5f,'request\x20sent');_0x105eb1(_0x417151['result'][_0x9587('0x19')]);}})['catch'](function(_0x484383){logger[_0x9587('0x17')](_0x9587('0x13'),_0x52ba5f,_0x484383);_0x330c9e(_0x484383);});});}exports['ShowWhatsappAccount']=function(_0x13e256){var _0x3911c8=this;return new Promise(function(_0xea7961,_0x92170f){return db[_0x9587('0x1a')][_0x9587('0x1b')]({'raw':_0x13e256[_0x9587('0x1c')]?_0x13e256[_0x9587('0x1c')][_0x9587('0x1d')]===undefined?!![]:![]:!![],'where':_0x13e256[_0x9587('0x1c')]?_0x13e256['options'][_0x9587('0x1e')]||null:null,'attributes':_0x13e256[_0x9587('0x1c')]?_0x13e256[_0x9587('0x1c')][_0x9587('0x1f')]||null:null,'include':_0x13e256['options']?_0x13e256['options']['include']?_['map'](_0x13e256[_0x9587('0x1c')][_0x9587('0x20')],function(_0x4f02a6){return{'model':db[_0x4f02a6['model']],'as':_0x4f02a6['as'],'attributes':_0x4f02a6[_0x9587('0x1f')],'include':_0x4f02a6[_0x9587('0x20')]?_[_0x9587('0x21')](_0x4f02a6[_0x9587('0x20')],function(_0x3e1daf){return{'model':db[_0x3e1daf[_0x9587('0x22')]],'as':_0x3e1daf['as'],'attributes':_0x3e1daf[_0x9587('0x1f')],'include':_0x3e1daf['include']?_[_0x9587('0x21')](_0x3e1daf['include'],function(_0x26407f){return{'model':db[_0x26407f[_0x9587('0x22')]],'as':_0x26407f['as'],'attributes':_0x26407f[_0x9587('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2d96){logger[_0x9587('0x12')](_0x9587('0x23'),_0x13e256);logger[_0x9587('0x14')](_0x9587('0x23'),_0x13e256,JSON['stringify'](_0x2d2d96));_0xea7961(_0x2d2d96);})['catch'](function(_0x97c355){logger[_0x9587('0x17')]('ShowWhatsappAccount',_0x97c355[_0x9587('0x19')],_0x13e256);_0x92170f(_0x3911c8[_0x9587('0x17')](0x1f4,_0x97c355['message']));});});}; \ No newline at end of file +var _0x8770=['http','redis','defaults','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x59a23a,_0x273e61){var _0x39f0af=function(_0x300e78){while(--_0x300e78){_0x59a23a['push'](_0x59a23a['shift']());}};_0x39f0af(++_0x273e61);}(_0x8770,0x1b1));var _0x0877=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8770[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0877('0x0'));var util=require(_0x0877('0x1'));var moment=require('moment');var BPromise=require(_0x0877('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0877('0x3'))['db'];var utils=require(_0x0877('0x4'));var logger=require(_0x0877('0x5'))(_0x0877('0x6'));var config=require(_0x0877('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0877('0x8')][_0x0877('0x9')]({'port':0x232a});config[_0x0877('0xa')]=_[_0x0877('0xb')](config[_0x0877('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0877('0xa')]));require(_0x0877('0xc'))[_0x0877('0xd')](socket);function respondWithRpcPromise(_0x486c93,_0x5df24c,_0x241d29){return new BPromise(function(_0x3525de,_0x25ea56){return client[_0x0877('0xe')](_0x486c93,_0x241d29)[_0x0877('0xf')](function(_0xe26889){logger[_0x0877('0x10')](_0x0877('0x11'),_0x5df24c,_0x0877('0x12'));logger[_0x0877('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5df24c,'request\x20sent',JSON[_0x0877('0x14')](_0xe26889));if(_0xe26889[_0x0877('0x15')]){if(_0xe26889['error']['code']===0x1f4){logger[_0x0877('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x5df24c,_0xe26889[_0x0877('0x15')][_0x0877('0x16')]);return _0x25ea56(_0xe26889['error'][_0x0877('0x16')]);}logger[_0x0877('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x5df24c,_0xe26889[_0x0877('0x15')][_0x0877('0x16')]);return _0x3525de(_0xe26889[_0x0877('0x15')][_0x0877('0x16')]);}else{logger['info'](_0x0877('0x11'),_0x5df24c,_0x0877('0x12'));_0x3525de(_0xe26889['result']['message']);}})['catch'](function(_0x42489e){logger['error'](_0x0877('0x11'),_0x5df24c,_0x42489e);_0x25ea56(_0x42489e);});});}exports[_0x0877('0x17')]=function(_0x757c56){var _0x4ef863=this;return new Promise(function(_0x498c0d,_0x42f550){return db[_0x0877('0x18')][_0x0877('0x19')]({'raw':_0x757c56['options']?_0x757c56[_0x0877('0x1a')][_0x0877('0x1b')]===undefined?!![]:![]:!![],'where':_0x757c56[_0x0877('0x1a')]?_0x757c56[_0x0877('0x1a')][_0x0877('0x1c')]||null:null,'attributes':_0x757c56['options']?_0x757c56[_0x0877('0x1a')][_0x0877('0x1d')]||null:null,'include':_0x757c56['options']?_0x757c56[_0x0877('0x1a')][_0x0877('0x1e')]?_['map'](_0x757c56['options'][_0x0877('0x1e')],function(_0x592a2d){return{'model':db[_0x592a2d['model']],'as':_0x592a2d['as'],'attributes':_0x592a2d[_0x0877('0x1d')],'include':_0x592a2d[_0x0877('0x1e')]?_[_0x0877('0x1f')](_0x592a2d[_0x0877('0x1e')],function(_0x5b7460){return{'model':db[_0x5b7460[_0x0877('0x20')]],'as':_0x5b7460['as'],'attributes':_0x5b7460[_0x0877('0x1d')],'include':_0x5b7460[_0x0877('0x1e')]?_['map'](_0x5b7460[_0x0877('0x1e')],function(_0x593c2d){return{'model':db[_0x593c2d[_0x0877('0x20')]],'as':_0x593c2d['as'],'attributes':_0x593c2d[_0x0877('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0877('0xf')](function(_0x2f5b5f){logger[_0x0877('0x10')](_0x0877('0x17'),_0x757c56);logger[_0x0877('0x13')](_0x0877('0x17'),_0x757c56,JSON[_0x0877('0x14')](_0x2f5b5f));_0x498c0d(_0x2f5b5f);})[_0x0877('0x21')](function(_0x37054b){logger[_0x0877('0x15')]('ShowWhatsappAccount',_0x37054b['message'],_0x757c56);_0x42f550(_0x4ef863['error'](0x1f4,_0x37054b[_0x0877('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3ba870c..6e4e3fc 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 _0xfdb6=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x3ddd01,_0x5ab585){var _0x273144=function(_0x233634){while(--_0x233634){_0x3ddd01['push'](_0x3ddd01['shift']());}};_0x273144(++_0x5ab585);}(_0xfdb6,0xbf));var _0x6fdb=function(_0x4c9fef,_0x511512){_0x4c9fef=_0x4c9fef-0x0;var _0x14717d=_0xfdb6[_0x4c9fef];return _0x14717d;};'use strict';var WhatsappAccountEvents=require(_0x6fdb('0x0'));var events=[_0x6fdb('0x1'),_0x6fdb('0x2'),_0x6fdb('0x3')];function createListener(_0x9f3f1a,_0x40f97d){return function(_0xf861f0){_0x40f97d[_0x6fdb('0x4')](_0x9f3f1a,_0xf861f0);};}function removeListener(_0x4d85d9,_0x2bf175){return function(){WhatsappAccountEvents[_0x6fdb('0x5')](_0x4d85d9,_0x2bf175);};}exports[_0x6fdb('0x6')]=function(_0xb8bbb){for(var _0x3c5142=0x0,_0x2fecaa=events[_0x6fdb('0x7')];_0x3c5142<_0x2fecaa;_0x3c5142++){var _0x3389a8=events[_0x3c5142];var _0x137c2d=createListener(_0x6fdb('0x8')+_0x3389a8,_0xb8bbb);WhatsappAccountEvents['on'](_0x3389a8,_0x137c2d);}}; \ No newline at end of file +var _0x4ede=['save','remove','removeListener','length','whatsappAccount:'];(function(_0x3f3bb3,_0x55deed){var _0x46cb4c=function(_0x11605c){while(--_0x11605c){_0x3f3bb3['push'](_0x3f3bb3['shift']());}};_0x46cb4c(++_0x55deed);}(_0x4ede,0x1c2));var _0xe4ed=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4ede[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xe4ed('0x0'),_0xe4ed('0x1'),'update'];function createListener(_0x128e68,_0x3c5b77){return function(_0xa46a49){_0x3c5b77['emit'](_0x128e68,_0xa46a49);};}function removeListener(_0x493194,_0x46eaa0){return function(){WhatsappAccountEvents[_0xe4ed('0x2')](_0x493194,_0x46eaa0);};}exports['register']=function(_0x4f2772){for(var _0x5c3180=0x0,_0x5a3586=events[_0xe4ed('0x3')];_0x5c3180<_0x5a3586;_0x5c3180++){var _0x4c7168=events[_0x5c3180];var _0x50f958=createListener(_0xe4ed('0x4')+_0x4c7168,_0x4f2772);WhatsappAccountEvents['on'](_0x4c7168,_0x50f958);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7a40cff..280050b 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 _0x28ed=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x38e233,_0x574714){var _0x5e7ea5=function(_0x4be59e){while(--_0x4be59e){_0x38e233['push'](_0x38e233['shift']());}};_0x5e7ea5(++_0x574714);}(_0x28ed,0x14a));var _0xd28e=function(_0x5bcea8,_0x1ca840){_0x5bcea8=_0x5bcea8-0x0;var _0x1bfa53=_0x28ed[_0x5bcea8];return _0x1bfa53;};'use strict';var multer=require(_0xd28e('0x0'));var util=require(_0xd28e('0x1'));var path=require(_0xd28e('0x2'));var timeout=require(_0xd28e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd28e('0x4'));var interaction=require(_0xd28e('0x5'));var config=require(_0xd28e('0x6'));var controller=require(_0xd28e('0x7'));router[_0xd28e('0x8')]('/',auth[_0xd28e('0x9')](),controller['index']);router[_0xd28e('0x8')](_0xd28e('0xa'),auth['isAuthenticated'](),controller[_0xd28e('0xb')]);router['post']('/',auth[_0xd28e('0x9')](),controller[_0xd28e('0xc')]);router[_0xd28e('0xd')](_0xd28e('0xa'),auth[_0xd28e('0x9')](),controller[_0xd28e('0xe')]);router[_0xd28e('0xf')](_0xd28e('0xa'),auth[_0xd28e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9fcc=['/:id','show','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get'];(function(_0x5ebe56,_0x4f1bc2){var _0x52e074=function(_0x3ee227){while(--_0x3ee227){_0x5ebe56['push'](_0x5ebe56['shift']());}};_0x52e074(++_0x4f1bc2);}(_0x9fcc,0xf5));var _0xc9fc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9fcc[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xc9fc('0x0'));var util=require(_0xc9fc('0x1'));var path=require(_0xc9fc('0x2'));var timeout=require(_0xc9fc('0x3'));var express=require('express');var router=express[_0xc9fc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc9fc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc9fc('0x6'));var controller=require(_0xc9fc('0x7'));router['get']('/',auth[_0xc9fc('0x8')](),controller[_0xc9fc('0x9')]);router[_0xc9fc('0xa')](_0xc9fc('0xb'),auth[_0xc9fc('0x8')](),controller[_0xc9fc('0xc')]);router['post']('/',auth[_0xc9fc('0x8')](),controller['create']);router[_0xc9fc('0xd')](_0xc9fc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc9fc('0xe')](_0xc9fc('0xb'),auth['isAuthenticated'](),controller[_0xc9fc('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fc51461..4785f72 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 _0xba5f=['*,*,*,*','exports','noop','TEXT'];(function(_0x37aaf9,_0x55128f){var _0x276786=function(_0x321f93){while(--_0x321f93){_0x37aaf9['push'](_0x37aaf9['shift']());}};_0x276786(++_0x55128f);}(_0xba5f,0x135));var _0xfba5=function(_0x2c8d58,_0x41205c){_0x2c8d58=_0x2c8d58-0x0;var _0xfd9e6a=_0xba5f[_0x2c8d58];return _0xfd9e6a;};'use strict';var Sequelize=require('sequelize');module[_0xfba5('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfba5('0x1')},'appdata':{'type':Sequelize[_0xfba5('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfba5('0x3')}}; \ No newline at end of file +var _0xeaa7=['INTEGER','STRING','noop','TEXT','exports'];(function(_0xd0741b,_0x118226){var _0x58146e=function(_0x5b206b){while(--_0x5b206b){_0xd0741b['push'](_0xd0741b['shift']());}};_0x58146e(++_0x118226);}(_0xeaa7,0x13a));var _0x7eaa=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xeaa7[_0x359bbe];return _0x1b3353;};'use strict';var Sequelize=require('sequelize');module[_0x7eaa('0x0')]={'priority':{'type':Sequelize[_0x7eaa('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7eaa('0x2')],'allowNull':![],'defaultValue':_0x7eaa('0x3')},'appdata':{'type':Sequelize[_0x7eaa('0x4')]()},'description':{'type':Sequelize[_0x7eaa('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 76f33ca..ee30b71 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 _0xe14a=['create','body','destroy','params','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','intersection','length','find','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe14a,0x94));var _0xae14=function(_0x4239ea,_0x13625a){_0x4239ea=_0x4239ea-0x0;var _0x258f20=_0xe14a[_0x4239ea];return _0x258f20;};'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(_0xae14('0x0'));var BPromise=require(_0xae14('0x1'));var Mustache=require('mustache');var util=require(_0xae14('0x2'));var path=require(_0xae14('0x3'));var sox=require(_0xae14('0x4'));var csv=require(_0xae14('0x5'));var ejs=require(_0xae14('0x6'));var fs=require('fs');var fs_extra=require(_0xae14('0x7'));var _=require(_0xae14('0x8'));var squel=require(_0xae14('0x9'));var crypto=require(_0xae14('0xa'));var jsforce=require(_0xae14('0xb'));var deskjs=require(_0xae14('0xc'));var toCsv=require(_0xae14('0x5'));var querystring=require(_0xae14('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae14('0xe'));var qs=require(_0xae14('0xf'));var as=require(_0xae14('0x10'));var hardwareService=require(_0xae14('0x11'));var logger=require(_0xae14('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xae14('0x13'));var licenseUtil=require(_0xae14('0x14'));var db=require(_0xae14('0x15'))['db'];function respondWithStatusCode(_0x1d795c,_0x45f3e3){_0x45f3e3=_0x45f3e3||0xcc;return function(_0x1fb669){if(_0x1fb669){return _0x1d795c[_0xae14('0x16')](_0x45f3e3);}return _0x1d795c[_0xae14('0x17')](_0x45f3e3)[_0xae14('0x18')]();};}function respondWithResult(_0x473c84,_0x4a2446){_0x4a2446=_0x4a2446||0xc8;return function(_0x2bf01a){if(_0x2bf01a){return _0x473c84[_0xae14('0x17')](_0x4a2446)['json'](_0x2bf01a);}};}function respondWithFilteredResult(_0x2acc7a,_0x2245f0){return function(_0xef6e56){if(_0xef6e56){var _0x578f8c=typeof _0x2245f0[_0xae14('0x19')]==='undefined'&&typeof _0x2245f0['limit']===_0xae14('0x1a');var _0x61133f=_0xef6e56[_0xae14('0x1b')];var _0x4913e7=_0x578f8c?0x0:_0x2245f0['offset'];var _0x1ecd0f=_0x578f8c?_0xef6e56[_0xae14('0x1b')]:_0x2245f0[_0xae14('0x19')]+_0x2245f0[_0xae14('0x1c')];var _0x133604;if(_0x1ecd0f>=_0x61133f){_0x1ecd0f=_0x61133f;_0x133604=0xc8;}else{_0x133604=0xce;}_0x2acc7a[_0xae14('0x17')](_0x133604);return _0x2acc7a[_0xae14('0x1d')](_0xae14('0x1e'),_0x4913e7+'-'+_0x1ecd0f+'/'+_0x61133f)['json'](_0xef6e56);}return null;};}function patchUpdates(_0x459134){return function(_0x453eae){try{jsonpatch[_0xae14('0x1f')](_0x453eae,_0x459134,!![]);}catch(_0x410037){return BPromise[_0xae14('0x20')](_0x410037);}return _0x453eae[_0xae14('0x21')]();};}function saveUpdates(_0x45fec8,_0x58a002){return function(_0x3266cb){if(_0x3266cb){return _0x3266cb[_0xae14('0x22')](_0x45fec8)[_0xae14('0x23')](function(_0x3bb7cc){return _0x3bb7cc;});}return null;};}function removeEntity(_0x32dd4d,_0x33885f){return function(_0x55106c){if(_0x55106c){return _0x55106c['destroy']()['then'](function(){_0x32dd4d[_0xae14('0x17')](0xcc)[_0xae14('0x18')]();});}};}function handleEntityNotFound(_0x32893e,_0x25812a){return function(_0x36042f){if(!_0x36042f){_0x32893e[_0xae14('0x16')](0x194);}return _0x36042f;};}function handleError(_0x2a4499,_0xbad452){_0xbad452=_0xbad452||0x1f4;return function(_0x30c9f1){logger[_0xae14('0x24')](_0x30c9f1[_0xae14('0x25')]);if(_0x30c9f1[_0xae14('0x26')]){delete _0x30c9f1['name'];}_0x2a4499[_0xae14('0x17')](_0xbad452)[_0xae14('0x27')](_0x30c9f1);};}exports[_0xae14('0x28')]=function(_0x35aabc,_0x43c0e8){var _0x1b0f19={},_0x1da1db={},_0x5e9c9f={'count':0x0,'rows':[]};var _0x344640=_[_0xae14('0x29')](db[_0xae14('0x2a')]['rawAttributes'],function(_0x535e79){return{'name':_0x535e79[_0xae14('0x2b')],'type':_0x535e79[_0xae14('0x2c')][_0xae14('0x2d')]};});_0x1da1db[_0xae14('0x2e')]=_['map'](_0x344640,_0xae14('0x26'));_0x1da1db[_0xae14('0x2f')]=_[_0xae14('0x30')](_0x35aabc['query']);_0x1da1db['filters']=_['intersection'](_0x1da1db[_0xae14('0x2e')],_0x1da1db[_0xae14('0x2f')]);_0x1b0f19[_0xae14('0x31')]=_['intersection'](_0x1da1db[_0xae14('0x2e')],qs[_0xae14('0x32')](_0x35aabc[_0xae14('0x2f')]['fields']));_0x1b0f19[_0xae14('0x31')]=_0x1b0f19[_0xae14('0x31')]['length']?_0x1b0f19[_0xae14('0x31')]:_0x1da1db[_0xae14('0x2e')];if(!_0x35aabc[_0xae14('0x2f')][_0xae14('0x33')]('nolimit')){_0x1b0f19[_0xae14('0x1c')]=qs[_0xae14('0x1c')](_0x35aabc['query'][_0xae14('0x1c')]);_0x1b0f19[_0xae14('0x19')]=qs['offset'](_0x35aabc['query'][_0xae14('0x19')]);}_0x1b0f19['order']=qs[_0xae14('0x34')](_0x35aabc[_0xae14('0x2f')][_0xae14('0x34')]);_0x1b0f19['where']=qs[_0xae14('0x35')](_[_0xae14('0x36')](_0x35aabc[_0xae14('0x2f')],_0x1da1db[_0xae14('0x35')]),_0x344640);if(_0x35aabc[_0xae14('0x2f')][_0xae14('0x37')]){_0x1b0f19[_0xae14('0x38')]=_['merge'](_0x1b0f19[_0xae14('0x38')],{'$or':_[_0xae14('0x29')](_0x344640,function(_0x3728f6){if(_0x3728f6[_0xae14('0x2c')]!==_0xae14('0x39')){var _0x138afc={};_0x138afc[_0x3728f6[_0xae14('0x26')]]={'$like':'%'+_0x35aabc[_0xae14('0x2f')][_0xae14('0x37')]+'%'};return _0x138afc;}})});}_0x1b0f19=_[_0xae14('0x3a')]({},_0x1b0f19,_0x35aabc[_0xae14('0x3b')]);var _0x484f24={'where':_0x1b0f19['where']};return db[_0xae14('0x2a')]['count'](_0x484f24)[_0xae14('0x23')](function(_0x2240ae){_0x5e9c9f[_0xae14('0x1b')]=_0x2240ae;if(_0x35aabc[_0xae14('0x2f')][_0xae14('0x3c')]){_0x1b0f19[_0xae14('0x3d')]=[{'all':!![]}];}return db[_0xae14('0x2a')][_0xae14('0x3e')](_0x1b0f19);})['then'](function(_0x102f0f){_0x5e9c9f['rows']=_0x102f0f;return _0x5e9c9f;})[_0xae14('0x23')](respondWithFilteredResult(_0x43c0e8,_0x1b0f19))['catch'](handleError(_0x43c0e8,null));};exports[_0xae14('0x3f')]=function(_0x264318,_0x3cfc2c){var _0x54f6b6={'raw':!![],'where':{'id':_0x264318['params']['id']}},_0x20fa13={};_0x20fa13[_0xae14('0x2e')]=_[_0xae14('0x30')](db[_0xae14('0x2a')]['rawAttributes']);_0x20fa13[_0xae14('0x2f')]=_[_0xae14('0x30')](_0x264318['query']);_0x20fa13['filters']=_['intersection'](_0x20fa13[_0xae14('0x2e')],_0x20fa13[_0xae14('0x2f')]);_0x54f6b6['attributes']=_[_0xae14('0x40')](_0x20fa13[_0xae14('0x2e')],qs[_0xae14('0x32')](_0x264318[_0xae14('0x2f')][_0xae14('0x32')]));_0x54f6b6[_0xae14('0x31')]=_0x54f6b6['attributes'][_0xae14('0x41')]?_0x54f6b6[_0xae14('0x31')]:_0x20fa13['model'];if(_0x264318[_0xae14('0x2f')][_0xae14('0x3c')]){_0x54f6b6[_0xae14('0x3d')]=[{'all':!![]}];}_0x54f6b6=_['merge']({},_0x54f6b6,_0x264318['options']);return db[_0xae14('0x2a')][_0xae14('0x42')](_0x54f6b6)[_0xae14('0x23')](handleEntityNotFound(_0x3cfc2c,null))[_0xae14('0x23')](respondWithResult(_0x3cfc2c,null))[_0xae14('0x43')](handleError(_0x3cfc2c,null));};exports[_0xae14('0x44')]=function(_0x578be2,_0x27b13f){return db[_0xae14('0x2a')]['create'](_0x578be2['body'],{})[_0xae14('0x23')](respondWithResult(_0x27b13f,0xc9))['catch'](handleError(_0x27b13f,null));};exports[_0xae14('0x22')]=function(_0x213a83,_0xdf57a2){if(_0x213a83['body']['id']){delete _0x213a83[_0xae14('0x45')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x213a83['params']['id']}})[_0xae14('0x23')](handleEntityNotFound(_0xdf57a2,null))[_0xae14('0x23')](saveUpdates(_0x213a83['body'],null))['then'](respondWithResult(_0xdf57a2,null))[_0xae14('0x43')](handleError(_0xdf57a2,null));};exports[_0xae14('0x46')]=function(_0x3239de,_0x259781){return db['WhatsappApplication']['find']({'where':{'id':_0x3239de[_0xae14('0x47')]['id']}})[_0xae14('0x23')](handleEntityNotFound(_0x259781,null))[_0xae14('0x23')](removeEntity(_0x259781,null))[_0xae14('0x43')](handleError(_0x259781,null));}; \ No newline at end of file +var _0x6b19=['name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x5a5863,_0x50f0f2){var _0x36328e=function(_0x352019){while(--_0x352019){_0x5a5863['push'](_0x5a5863['shift']());}};_0x36328e(++_0x50f0f2);}(_0x6b19,0xf4));var _0x96b1=function(_0x2a8fce,_0x46889e){_0x2a8fce=_0x2a8fce-0x0;var _0x55a288=_0x6b19[_0x2a8fce];return _0x55a288;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96b1('0x1'));var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require(_0x96b1('0x3'));var BPromise=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var util=require(_0x96b1('0x6'));var path=require('path');var sox=require(_0x96b1('0x7'));var csv=require(_0x96b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require(_0x96b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x96b1('0xb'));var deskjs=require(_0x96b1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x96b1('0xd'));var Papa=require(_0x96b1('0xe'));var Redis=require(_0x96b1('0xf'));var authService=require(_0x96b1('0x10'));var qs=require(_0x96b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96b1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96b1('0x13'));var db=require(_0x96b1('0x14'))['db'];function respondWithStatusCode(_0x16ee32,_0x1d942a){_0x1d942a=_0x1d942a||0xcc;return function(_0x2d7569){if(_0x2d7569){return _0x16ee32['sendStatus'](_0x1d942a);}return _0x16ee32[_0x96b1('0x15')](_0x1d942a)[_0x96b1('0x16')]();};}function respondWithResult(_0xe809b6,_0x2dbaac){_0x2dbaac=_0x2dbaac||0xc8;return function(_0x28b596){if(_0x28b596){return _0xe809b6[_0x96b1('0x15')](_0x2dbaac)[_0x96b1('0x17')](_0x28b596);}};}function respondWithFilteredResult(_0x1e5fdf,_0x3ba832){return function(_0x5772d3){if(_0x5772d3){var _0x2e9615=typeof _0x3ba832[_0x96b1('0x18')]===_0x96b1('0x19')&&typeof _0x3ba832[_0x96b1('0x1a')]===_0x96b1('0x19');var _0x23852a=_0x5772d3[_0x96b1('0x1b')];var _0x41227b=_0x2e9615?0x0:_0x3ba832[_0x96b1('0x18')];var _0x44cc44=_0x2e9615?_0x5772d3[_0x96b1('0x1b')]:_0x3ba832['offset']+_0x3ba832['limit'];var _0x151178;if(_0x44cc44>=_0x23852a){_0x44cc44=_0x23852a;_0x151178=0xc8;}else{_0x151178=0xce;}_0x1e5fdf['status'](_0x151178);return _0x1e5fdf['set'](_0x96b1('0x1c'),_0x41227b+'-'+_0x44cc44+'/'+_0x23852a)[_0x96b1('0x17')](_0x5772d3);}return null;};}function patchUpdates(_0x2bb819){return function(_0x4f0d78){try{jsonpatch[_0x96b1('0x1d')](_0x4f0d78,_0x2bb819,!![]);}catch(_0x3954e3){return BPromise[_0x96b1('0x1e')](_0x3954e3);}return _0x4f0d78[_0x96b1('0x1f')]();};}function saveUpdates(_0x1e1436,_0x276919){return function(_0x416022){if(_0x416022){return _0x416022[_0x96b1('0x20')](_0x1e1436)[_0x96b1('0x21')](function(_0x3a17d3){return _0x3a17d3;});}return null;};}function removeEntity(_0x2acd58,_0x1b0f88){return function(_0x295f05){if(_0x295f05){return _0x295f05[_0x96b1('0x22')]()[_0x96b1('0x21')](function(){_0x2acd58[_0x96b1('0x15')](0xcc)[_0x96b1('0x16')]();});}};}function handleEntityNotFound(_0x5b19b6,_0x3f5049){return function(_0x226603){if(!_0x226603){_0x5b19b6[_0x96b1('0x23')](0x194);}return _0x226603;};}function handleError(_0x321863,_0x3b7492){_0x3b7492=_0x3b7492||0x1f4;return function(_0x2ad760){logger['error'](_0x2ad760['stack']);if(_0x2ad760[_0x96b1('0x24')]){delete _0x2ad760['name'];}_0x321863[_0x96b1('0x15')](_0x3b7492)[_0x96b1('0x25')](_0x2ad760);};}exports[_0x96b1('0x26')]=function(_0x106864,_0x4e4426){var _0x59fc7c={},_0x45c20e={},_0x9fc960={'count':0x0,'rows':[]};var _0x5a9332=_[_0x96b1('0x27')](db[_0x96b1('0x28')][_0x96b1('0x29')],function(_0x2262ad){return{'name':_0x2262ad[_0x96b1('0x2a')],'type':_0x2262ad[_0x96b1('0x2b')]['key']};});_0x45c20e[_0x96b1('0x2c')]=_[_0x96b1('0x27')](_0x5a9332,_0x96b1('0x24'));_0x45c20e[_0x96b1('0x2d')]=_[_0x96b1('0x2e')](_0x106864[_0x96b1('0x2d')]);_0x45c20e[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x45c20e['model'],_0x45c20e[_0x96b1('0x2d')]);_0x59fc7c[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x45c20e[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x59fc7c[_0x96b1('0x31')]=_0x59fc7c['attributes'][_0x96b1('0x33')]?_0x59fc7c[_0x96b1('0x31')]:_0x45c20e[_0x96b1('0x2c')];if(!_0x106864['query']['hasOwnProperty'](_0x96b1('0x34'))){_0x59fc7c[_0x96b1('0x1a')]=qs['limit'](_0x106864['query']['limit']);_0x59fc7c[_0x96b1('0x18')]=qs[_0x96b1('0x18')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x18')]);}_0x59fc7c[_0x96b1('0x35')]=qs[_0x96b1('0x36')](_0x106864[_0x96b1('0x2d')]['sort']);_0x59fc7c[_0x96b1('0x37')]=qs['filters'](_['pick'](_0x106864[_0x96b1('0x2d')],_0x45c20e[_0x96b1('0x2f')]),_0x5a9332);if(_0x106864['query'][_0x96b1('0x38')]){_0x59fc7c[_0x96b1('0x37')]=_[_0x96b1('0x39')](_0x59fc7c[_0x96b1('0x37')],{'$or':_[_0x96b1('0x27')](_0x5a9332,function(_0x49a5d7){if(_0x49a5d7[_0x96b1('0x2b')]!==_0x96b1('0x3a')){var _0x35ea21={};_0x35ea21[_0x49a5d7['name']]={'$like':'%'+_0x106864[_0x96b1('0x2d')]['filter']+'%'};return _0x35ea21;}})});}_0x59fc7c=_[_0x96b1('0x39')]({},_0x59fc7c,_0x106864['options']);var _0x53e072={'where':_0x59fc7c[_0x96b1('0x37')]};return db[_0x96b1('0x28')][_0x96b1('0x1b')](_0x53e072)[_0x96b1('0x21')](function(_0x4833c0){_0x9fc960[_0x96b1('0x1b')]=_0x4833c0;if(_0x106864[_0x96b1('0x2d')][_0x96b1('0x3b')]){_0x59fc7c[_0x96b1('0x3c')]=[{'all':!![]}];}return db[_0x96b1('0x28')][_0x96b1('0x3d')](_0x59fc7c);})[_0x96b1('0x21')](function(_0x52c232){_0x9fc960[_0x96b1('0x3e')]=_0x52c232;return _0x9fc960;})[_0x96b1('0x21')](respondWithFilteredResult(_0x4e4426,_0x59fc7c))[_0x96b1('0x3f')](handleError(_0x4e4426,null));};exports[_0x96b1('0x40')]=function(_0x50949f,_0x101253){var _0x40adda={'raw':!![],'where':{'id':_0x50949f[_0x96b1('0x41')]['id']}},_0x40a022={};_0x40a022[_0x96b1('0x2c')]=_[_0x96b1('0x2e')](db[_0x96b1('0x28')]['rawAttributes']);_0x40a022[_0x96b1('0x2d')]=_['keys'](_0x50949f[_0x96b1('0x2d')]);_0x40a022[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],_0x40a022[_0x96b1('0x2d')]);_0x40adda[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x50949f[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x40adda[_0x96b1('0x31')]=_0x40adda['attributes']['length']?_0x40adda[_0x96b1('0x31')]:_0x40a022['model'];if(_0x50949f['query'][_0x96b1('0x3b')]){_0x40adda['include']=[{'all':!![]}];}_0x40adda=_[_0x96b1('0x39')]({},_0x40adda,_0x50949f[_0x96b1('0x42')]);return db[_0x96b1('0x28')]['find'](_0x40adda)[_0x96b1('0x21')](handleEntityNotFound(_0x101253,null))[_0x96b1('0x21')](respondWithResult(_0x101253,null))[_0x96b1('0x3f')](handleError(_0x101253,null));};exports[_0x96b1('0x43')]=function(_0x584582,_0x27be9f){return db['WhatsappApplication'][_0x96b1('0x43')](_0x584582[_0x96b1('0x44')],{})[_0x96b1('0x21')](respondWithResult(_0x27be9f,0xc9))[_0x96b1('0x3f')](handleError(_0x27be9f,null));};exports[_0x96b1('0x20')]=function(_0x3070da,_0x248844){if(_0x3070da[_0x96b1('0x44')]['id']){delete _0x3070da['body']['id'];}return db[_0x96b1('0x28')][_0x96b1('0x45')]({'where':{'id':_0x3070da['params']['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x248844,null))[_0x96b1('0x21')](saveUpdates(_0x3070da[_0x96b1('0x44')],null))[_0x96b1('0x21')](respondWithResult(_0x248844,null))[_0x96b1('0x3f')](handleError(_0x248844,null));};exports[_0x96b1('0x22')]=function(_0x404848,_0x2159ba){return db[_0x96b1('0x28')]['find']({'where':{'id':_0x404848[_0x96b1('0x41')]['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x2159ba,null))[_0x96b1('0x21')](removeEntity(_0x2159ba,null))[_0x96b1('0x3f')](handleError(_0x2159ba,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 6dd02b0..7cf6773 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 _0x08d9=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications'];(function(_0x4b1761,_0x34c976){var _0x2caa46=function(_0x4db9bd){while(--_0x4db9bd){_0x4b1761['push'](_0x4b1761['shift']());}};_0x2caa46(++_0x34c976);}(_0x08d9,0xc2));var _0x908d=function(_0x56db77,_0x36c201){_0x56db77=_0x56db77-0x0;var _0x1536b5=_0x08d9[_0x56db77];return _0x1536b5;};'use strict';var _=require(_0x908d('0x0'));var util=require('util');var logger=require(_0x908d('0x1'))('api');var moment=require(_0x908d('0x2'));var BPromise=require(_0x908d('0x3'));var rp=require(_0x908d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x908d('0x5'));var attributes=require(_0x908d('0x6'));module[_0x908d('0x7')]=function(_0xe780e0,_0xb63409){return _0xe780e0['define'](_0x908d('0x8'),attributes,{'tableName':_0x908d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x908d('0xa'),'collate':_0x908d('0xb')});}; \ No newline at end of file +var _0xf725=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf725,0x7e));var _0x5f72=function(_0x1ff7db,_0x313e22){_0x1ff7db=_0x1ff7db-0x0;var _0x5e4b1a=_0xf725[_0x1ff7db];return _0x5e4b1a;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var logger=require(_0x5f72('0x2'))(_0x5f72('0x3'));var moment=require(_0x5f72('0x4'));var BPromise=require(_0x5f72('0x5'));var rp=require(_0x5f72('0x6'));var fs=require('fs');var path=require(_0x5f72('0x7'));var rimraf=require(_0x5f72('0x8'));var config=require(_0x5f72('0x9'));var attributes=require('./whatsappApplication.attributes');module[_0x5f72('0xa')]=function(_0x14a92d,_0x3f2ca7){return _0x14a92d[_0x5f72('0xb')](_0x5f72('0xc'),attributes,{'tableName':_0x5f72('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f72('0xe'),'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 b577fd1..f5bd55e 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 _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x231c0a,_0x205d8a){var _0x9b36e5=function(_0x59907c){while(--_0x59907c){_0x231c0a['push'](_0x231c0a['shift']());}};_0x9b36e5(++_0x205d8a);}(_0x032e,0x124));var _0xe032=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x032e[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x00bb[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 94f8728..30e80e8 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 _0xdfa0=['show','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x1e2353,_0x24bd66){var _0x50d5ac=function(_0x876998){while(--_0x876998){_0x1e2353['push'](_0x1e2353['shift']());}};_0x50d5ac(++_0x24bd66);}(_0xdfa0,0x69));var _0x0dfa=function(_0x42ef5e,_0x52b4c9){_0x42ef5e=_0x42ef5e-0x0;var _0x5d54dd=_0xdfa0[_0x42ef5e];return _0x5d54dd;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var fs_extra=require(_0x0dfa('0x4'));var auth=require(_0x0dfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dfa('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x0dfa('0x7')]('/',auth[_0x0dfa('0x8')](),controller['index']);router[_0x0dfa('0x7')](_0x0dfa('0x9'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0x7')]('/:id',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xb')]);router[_0x0dfa('0x7')]('/:id/messages',auth[_0x0dfa('0x8')](),controller['getMessages']);router[_0x0dfa('0x7')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller['download']);router[_0x0dfa('0xd')]('/',auth[_0x0dfa('0x8')](),controller['create']);router[_0x0dfa('0xd')](_0x0dfa('0xe'),auth['isAuthenticated'](),controller[_0x0dfa('0xf')]);router[_0x0dfa('0xd')](_0x0dfa('0x10'),auth[_0x0dfa('0x8')](),interaction[_0x0dfa('0x11')](_0x0dfa('0x12'),'whatsappinteraction:addtags'),controller[_0x0dfa('0x13')]);router[_0x0dfa('0x14')](_0x0dfa('0x15'),auth[_0x0dfa('0x8')](),interaction[_0x0dfa('0x11')](_0x0dfa('0x12'),_0x0dfa('0x16')),controller[_0x0dfa('0x17')]);router[_0x0dfa('0x18')](_0x0dfa('0x15'),auth[_0x0dfa('0x8')](),interaction[_0x0dfa('0x11')](_0x0dfa('0x12'),_0x0dfa('0x19')),controller[_0x0dfa('0x1a')]);router['delete'](_0x0dfa('0x10'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x1b')]);module[_0x0dfa('0x1c')]=router; \ No newline at end of file +var _0x8c46=['whatsappinteraction:addtags','addTags','update','delete','whatsapp','whatsappinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x875527,_0x2234fb){var _0x23c22c=function(_0x46e337){while(--_0x46e337){_0x875527['push'](_0x875527['shift']());}};_0x23c22c(++_0x2234fb);}(_0x8c46,0x171));var _0x68c4=function(_0x120f00,_0x3e9268){_0x120f00=_0x120f00-0x0;var _0x5c3ce3=_0x8c46[_0x120f00];return _0x5c3ce3;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x68c4('0x2'));var auth=require(_0x68c4('0x3'));var interaction=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var controller=require(_0x68c4('0x6'));router[_0x68c4('0x7')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x9')]);router[_0x68c4('0x7')](_0x68c4('0xa'),auth['isAuthenticated'](),controller[_0x68c4('0xb')]);router[_0x68c4('0x7')](_0x68c4('0xc'),auth['isAuthenticated'](),controller[_0x68c4('0xd')]);router[_0x68c4('0x7')](_0x68c4('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x68c4('0x7')](_0x68c4('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x68c4('0x10')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x11')]);router['post'](_0x68c4('0xe'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x12')]);router['post'](_0x68c4('0x13'),auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')]('whatsapp',_0x68c4('0x15')),controller[_0x68c4('0x16')]);router['put'](_0x68c4('0xc'),auth['isAuthenticated'](),interaction[_0x68c4('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x68c4('0x17')]);router[_0x68c4('0x18')]('/:id',auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')](_0x68c4('0x19'),_0x68c4('0x1a')),controller[_0x68c4('0x1b')]);router[_0x68c4('0x18')](_0x68c4('0x13'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x1c')]);module[_0x68c4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d5f917d..11b7a67 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 _0x744c=['sequelize','moment','exports','BOOLEAN','STRING','ENUM','out','DATE'];(function(_0xb43d8,_0x4aaa9e){var _0x5c0228=function(_0x489c64){while(--_0x489c64){_0xb43d8['push'](_0xb43d8['shift']());}};_0x5c0228(++_0x4aaa9e);}(_0x744c,0xa0));var _0xc744=function(_0x544463,_0x214963){_0x544463=_0x544463-0x0;var _0x1add2a=_0x744c[_0x544463];return _0x1add2a;};'use strict';var Sequelize=require(_0xc744('0x0'));var moment=require(_0xc744('0x1'));module[_0xc744('0x2')]={'closed':{'type':Sequelize[_0xc744('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc744('0x4')]},'secondDisposition':{'type':Sequelize[_0xc744('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc744('0x4')]},'note':{'type':Sequelize[_0xc744('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc744('0x5')]('in',_0xc744('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc744('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xc744('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0a52=['DATE','STRING','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x347910,_0x330f90){var _0x417e09=function(_0x1c065d){while(--_0x1c065d){_0x347910['push'](_0x347910['shift']());}};_0x417e09(++_0x330f90);}(_0x0a52,0xe4));var _0x20a5=function(_0x145537,_0x3bdcae){_0x145537=_0x145537-0x0;var _0x39f7ec=_0x0a52[_0x145537];return _0x39f7ec;};'use strict';var Sequelize=require(_0x20a5('0x0'));var moment=require(_0x20a5('0x1'));module['exports']={'closed':{'type':Sequelize[_0x20a5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x20a5('0x3')]},'disposition':{'type':Sequelize[_0x20a5('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x20a5('0x4')]},'note':{'type':Sequelize[_0x20a5('0x4')]},'phone':{'type':Sequelize[_0x20a5('0x4')]},'read1stAt':{'type':Sequelize[_0x20a5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x20a5('0x5')]('in',_0x20a5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x20a5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x20a5('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 91c84d2..008647c 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 _0xd5d3=['YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','server','files','attachments','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','secret','Account','Whatsapp','Owner','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','System','out','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','end','stack','name','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\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','type','start','Tag','forEach','union','User','UserId','body','text','some','compact','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','WhatsappInteraction','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','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','show','params','includeAll','include','options','create','update','describe','addMessage','WhatsappMessage','omit','ids','getMessages','format'];(function(_0x4e55f7,_0x1365c4){var _0x5933de=function(_0x508aba){while(--_0x508aba){_0x4e55f7['push'](_0x4e55f7['shift']());}};_0x5933de(++_0x1365c4);}(_0xd5d3,0x113));var _0x3d5d=function(_0x5e801a,_0x32fb93){_0x5e801a=_0x5e801a-0x0;var _0x4d5d11=_0xd5d3[_0x5e801a];return _0x4d5d11;};'use strict';var emlformat=require(_0x3d5d('0x0'));var rimraf=require(_0x3d5d('0x1'));var zipdir=require(_0x3d5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d5d('0x3'));var moment=require(_0x3d5d('0x4'));var BPromise=require(_0x3d5d('0x5'));var Mustache=require(_0x3d5d('0x6'));var util=require(_0x3d5d('0x7'));var path=require(_0x3d5d('0x8'));var sox=require('sox');var csv=require(_0x3d5d('0x9'));var ejs=require(_0x3d5d('0xa'));var fs=require('fs');var fs_extra=require(_0x3d5d('0xb'));var _=require(_0x3d5d('0xc'));var squel=require(_0x3d5d('0xd'));var crypto=require(_0x3d5d('0xe'));var jsforce=require(_0x3d5d('0xf'));var deskjs=require(_0x3d5d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3d5d('0x11'));var Redis=require(_0x3d5d('0x12'));var authService=require(_0x3d5d('0x13'));var qs=require(_0x3d5d('0x14'));var as=require(_0x3d5d('0x15'));var pdf=require(_0x3d5d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d5d('0x17'))(_0x3d5d('0x18'));var utils=require(_0x3d5d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3d5d('0x1a'));var db=require(_0x3d5d('0x1b'))['db'];config[_0x3d5d('0x1c')]=_[_0x3d5d('0x1d')](config[_0x3d5d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d5d('0x1e'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x3d5d('0x1f')](socket);function respondWithStatusCode(_0x3550d3,_0x7d95e6){_0x7d95e6=_0x7d95e6||0xcc;return function(_0x3f6fe9){if(_0x3f6fe9){return _0x3550d3[_0x3d5d('0x20')](_0x7d95e6);}return _0x3550d3[_0x3d5d('0x21')](_0x7d95e6)['end']();};}function respondWithResult(_0xae4d12,_0xb06068){_0xb06068=_0xb06068||0xc8;return function(_0xee1bb8){if(_0xee1bb8){return _0xae4d12[_0x3d5d('0x21')](_0xb06068)[_0x3d5d('0x22')](_0xee1bb8);}};}function respondWithFilteredResult(_0x43cfeb,_0x1800c2){return function(_0x83cdeb){if(_0x83cdeb){var _0x402446=typeof _0x1800c2[_0x3d5d('0x23')]==='undefined'&&typeof _0x1800c2['limit']===_0x3d5d('0x24');var _0x16d697=_0x83cdeb[_0x3d5d('0x25')];var _0xc26cde=_0x402446?0x0:_0x1800c2[_0x3d5d('0x23')];var _0x4c0863=_0x402446?_0x83cdeb[_0x3d5d('0x25')]:_0x1800c2['offset']+_0x1800c2[_0x3d5d('0x26')];var _0x2328f8;if(_0x4c0863>=_0x16d697){_0x4c0863=_0x16d697;_0x2328f8=0xc8;}else{_0x2328f8=0xce;}_0x43cfeb['status'](_0x2328f8);return _0x43cfeb[_0x3d5d('0x27')](_0x3d5d('0x28'),_0xc26cde+'-'+_0x4c0863+'/'+_0x16d697)[_0x3d5d('0x22')](_0x83cdeb);}return null;};}function patchUpdates(_0x34ca56){return function(_0x1fa7a0){try{jsonpatch[_0x3d5d('0x29')](_0x1fa7a0,_0x34ca56,!![]);}catch(_0x16bb95){return BPromise['reject'](_0x16bb95);}return _0x1fa7a0[_0x3d5d('0x2a')]();};}function saveUpdates(_0xf9b708,_0x1aa626){return function(_0x29f764){if(_0x29f764){return _0x29f764['update'](_0xf9b708)[_0x3d5d('0x2b')](function(_0x2cbb93){return _0x2cbb93;});}return null;};}function removeEntity(_0x51a42a,_0x4becb1){return function(_0x5ba713){if(_0x5ba713){return _0x5ba713[_0x3d5d('0x2c')]()[_0x3d5d('0x2b')](function(){_0x51a42a['status'](0xcc)[_0x3d5d('0x2d')]();});}};}function handleEntityNotFound(_0x5cb2d1,_0x1214c8){return function(_0xf1bcf3){if(!_0xf1bcf3){_0x5cb2d1[_0x3d5d('0x20')](0x194);}return _0xf1bcf3;};}function handleError(_0x52c56b,_0x5f1855){_0x5f1855=_0x5f1855||0x1f4;return function(_0xf7b847){logger['error'](_0xf7b847[_0x3d5d('0x2e')]);if(_0xf7b847[_0x3d5d('0x2f')]){delete _0xf7b847[_0x3d5d('0x2f')];}_0x52c56b[_0x3d5d('0x21')](_0x5f1855)['send'](_0xf7b847);};}function getInteractionUsers(_0x53cb4a,_0x33e509){return new BPromise(function(_0x1f9a7b,_0x45ee07){try{if(_0x33e509[_0x53cb4a['id']]){_0x53cb4a['Users']=_[_0x3d5d('0x30')](_0x33e509[_0x53cb4a['id']],function(_0x1e213e){return{'id':_0x1e213e['id'],'fullname':_0x1e213e[_0x3d5d('0x31')]};});}}catch(_0x121ccb){_0x45ee07(_0x121ccb);}_0x1f9a7b(_0x53cb4a);});}function getInteractionTags(_0x61b7c7,_0x176012){return new BPromise(function(_0x3ca21b,_0x577517){try{if(_0x61b7c7[_0x3d5d('0x32')]){_0x61b7c7[_0x3d5d('0x33')]=[];_0x61b7c7['TagIds'][_0x3d5d('0x34')](',')['forEach'](function(_0x2870bb){_0x61b7c7[_0x3d5d('0x33')][_0x3d5d('0x35')](_0x176012[_0x2870bb]);});}delete _0x61b7c7[_0x3d5d('0x32')];}catch(_0x2537e1){_0x577517(_0x2537e1);}_0x3ca21b(_0x61b7c7);});}function updateWhatsappInteraction(_0x267427,_0xccb04,_0x128b61){return new BPromise(function(_0x425d4e,_0x4554b6){return getInteractionUsers(_0x267427,_0x128b61)[_0x3d5d('0x2b')](function(_0x3c81ea){return getInteractionTags(_0x3c81ea,_0xccb04);})['then'](function(_0x36d0d8){_0x425d4e(_0x36d0d8);})[_0x3d5d('0x36')](function(_0x3d3cb6){_0x4554b6(_0x3d3cb6);});});}exports[_0x3d5d('0x37')]=function(_0x5db1e1,_0xc63532){var _0x4abf9b={},_0x39ab69={},_0x3335f7={'count':0x0,'rows':[]};var _0x1b6246=_[_0x3d5d('0x30')](db['WhatsappInteraction'][_0x3d5d('0x38')],function(_0x3ed62b){return{'name':_0x3ed62b[_0x3d5d('0x39')],'type':_0x3ed62b['type'][_0x3d5d('0x3a')]};});_0x39ab69[_0x3d5d('0x3b')]=_[_0x3d5d('0x30')](_0x1b6246,_0x3d5d('0x2f'));_0x39ab69[_0x3d5d('0x3c')]=_[_0x3d5d('0x3d')](_0x5db1e1[_0x3d5d('0x3c')]);_0x39ab69[_0x3d5d('0x3e')]=_[_0x3d5d('0x3f')](_0x39ab69[_0x3d5d('0x3b')],_0x39ab69[_0x3d5d('0x3c')]);_0x4abf9b[_0x3d5d('0x40')]=_[_0x3d5d('0x3f')](_0x39ab69[_0x3d5d('0x3b')],qs[_0x3d5d('0x41')](_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x41')]));_0x4abf9b[_0x3d5d('0x40')]=_0x4abf9b['attributes'][_0x3d5d('0x42')]?_0x4abf9b[_0x3d5d('0x40')]:_0x39ab69[_0x3d5d('0x3b')];if(!_0x5db1e1['query'][_0x3d5d('0x43')]('nolimit')){_0x4abf9b[_0x3d5d('0x26')]=qs[_0x3d5d('0x26')](_0x5db1e1[_0x3d5d('0x3c')]['limit']);_0x4abf9b[_0x3d5d('0x23')]=qs['offset'](_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x23')]);}_0x4abf9b[_0x3d5d('0x44')]=qs[_0x3d5d('0x45')](_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x45')]);_0x4abf9b[_0x3d5d('0x46')]=qs[_0x3d5d('0x3e')](_[_0x3d5d('0x47')](_0x5db1e1[_0x3d5d('0x3c')],_0x39ab69['filters']),_0x1b6246);var _0x594f01=[];var _0x42c985=squel[_0x3d5d('0x48')]()[_0x3d5d('0x49')]('id')[_0x3d5d('0x49')](_0x3d5d('0x2f'))[_0x3d5d('0x49')](_0x3d5d('0x4a'))[_0x3d5d('0x4b')](_0x3d5d('0x4c'));var _0x597f93=squel[_0x3d5d('0x48')]()[_0x3d5d('0x49')](_0x3d5d('0x4d'))[_0x3d5d('0x49')]('u.fullname')['field'](_0x3d5d('0x4e'))['from']('user_has_whatsapp_interactions','ui')[_0x3d5d('0x4f')]('users','u',_0x3d5d('0x50'));var _0x5c7373=squel[_0x3d5d('0x48')]()['from'](_0x3d5d('0x51'),'i')[_0x3d5d('0x4f')](_0x3d5d('0x52'),'c',_0x3d5d('0x53'))['left_join'](_0x3d5d('0x54'),'o',_0x3d5d('0x55'))['left_join'](_0x3d5d('0x56'),'a',_0x3d5d('0x57'))[_0x3d5d('0x4f')](_0x3d5d('0x58'),'me',_0x3d5d('0x59'))['left_join']('whatsapp_interaction_has_tags','it',_0x3d5d('0x5a'))[_0x3d5d('0x4f')](_0x3d5d('0x4c'),'t',_0x3d5d('0x5b'));var _0x1e8563=squel[_0x3d5d('0x5c')]();var _0x51760f=[];var _0x4cceb4=squel[_0x3d5d('0x5c')]();var _0x2154db;if(_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x5d')]){_0x2154db=as[_0x3d5d('0x5e')](_0x5db1e1[_0x3d5d('0x3c')]['search']);var _0x357ad3=_0x2154db[_0x3d5d('0x5f')];for(var _0x23daec=0x0;_0x23daec<_0x2154db['conditions'][_0x3d5d('0x42')];_0x23daec++){var _0x26b623=_0x2154db[_0x3d5d('0x60')][_0x23daec];var _0xaaa0fc='i';var _0x35dadb=_[_0x3d5d('0x61')](_0x1b6246,[_0x3d5d('0x2f'),_0x26b623['field']]);if(!_0x35dadb){switch(_0x26b623[_0x3d5d('0x49')]){case _0x3d5d('0x62'):if(_0x26b623[_0x3d5d('0x63')]==0x1){_0x5c7373[_0x3d5d('0x64')]('`'+_0x26b623[_0x3d5d('0x49')]+_0x3d5d('0x65'));}else{_0x5c7373[_0x3d5d('0x64')]('`'+_0x26b623[_0x3d5d('0x49')]+'`\x20>\x200');}break;case _0x3d5d('0x66'):if(_0x26b623[_0x3d5d('0x67')]===_0x3d5d('0x68')){if(_0x26b623[_0x3d5d('0x63')][_0x3d5d('0x34')]('\x20')[_0x3d5d('0x42')]>0x1){_0x1e8563[_0x357ad3](_0x3d5d('0x69'),qs[_0x3d5d('0x6a')](_0x26b623[_0x3d5d('0x63')]),null);}else{var _0x3f500b='%'+_0x26b623[_0x3d5d('0x63')]+'%';_0x1e8563[_0x357ad3](_0x3d5d('0x6b'),_0x3f500b,_0x3f500b,_0x3f500b);}}else{_0x35dadb=_[_0x3d5d('0x61')](_0x1b6246,['name',_0x3d5d('0x6c')]);_0x26b623[_0x3d5d('0x49')]=_0x3d5d('0x6c');_0x1ec592=as[_0x3d5d('0x6d')](_0xaaa0fc,_0x35dadb[_0x3d5d('0x6e')],_0x26b623);_0x1e8563[_0x357ad3](_0x1ec592['text'],_0x1ec592[_0x3d5d('0x63')][_0x3d5d('0x6f')],_0x1ec592['value']['end']);}break;case _0x3d5d('0x70'):var _0x3f1ab0=_0x26b623[_0x3d5d('0x63')][_0x3d5d('0x34')](',')['map'](function(_0x233b97){return Number(_0x233b97);});_0x3f1ab0[_0x3d5d('0x71')](function(_0x2ecc9a){_0x4cceb4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2ecc9a+',%');});_0x51760f=_[_0x3d5d('0x72')](_0x51760f,_0x3f1ab0);break;case _0x3d5d('0x73'):if(_0x26b623[_0x3d5d('0x67')]===_0x3d5d('0x68')){_0x1e8563[_0x357ad3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x26b623[_0x3d5d('0x63')]+'%',null);}else{_0x35dadb=_[_0x3d5d('0x61')](_0x1b6246,[_0x3d5d('0x2f'),_0x3d5d('0x74')]);_0x26b623[_0x3d5d('0x49')]=_0x3d5d('0x74');_0x1ec592=as[_0x3d5d('0x6d')](_0xaaa0fc,_0x35dadb[_0x3d5d('0x6e')],_0x26b623);_0x1e8563[_0x357ad3](_0x1ec592['text'],_0x1ec592[_0x3d5d('0x63')][_0x3d5d('0x6f')],_0x1ec592[_0x3d5d('0x63')]['end']);}break;case _0x3d5d('0x75'):_0x1ec592=as[_0x3d5d('0x6d')]('me',null,_0x26b623);_0x1e8563[_0x357ad3](_0x1ec592['text'],_0x1ec592[_0x3d5d('0x63')]['start'],_0x1ec592[_0x3d5d('0x63')][_0x3d5d('0x2d')]);break;}}else{var _0x1ec592=as[_0x3d5d('0x6d')](_0xaaa0fc,_0x35dadb['type'],_0x26b623);_0x1e8563[_0x357ad3](_0x1ec592[_0x3d5d('0x76')],_0x1ec592['value'][_0x3d5d('0x6f')],_0x1ec592['value'][_0x3d5d('0x2d')]);}}}else{var _0x4ce2d8=_(_0x5db1e1[_0x3d5d('0x3c')])[_0x3d5d('0x3d')]()[_0x3d5d('0x30')](function(_0x835712){return _[_0x3d5d('0x77')](_0x1b6246,[_0x3d5d('0x2f'),_0x835712])?_0x835712:undefined;})[_0x3d5d('0x78')]()[_0x3d5d('0x63')]();if(!_['isEmpty'](_0x4ce2d8)){_0x4ce2d8['forEach'](function(_0x3657f2){if(_0x3657f2==='WhatsappAccountId'){_0x5c7373[_0x3d5d('0x46')](_0x3d5d('0x79'),[][_0x3d5d('0x7a')](_0x5db1e1['query'][_0x3657f2]));}else if(_0x3657f2===_0x3d5d('0x7b')){var _0x3fe4db=JSON['parse'](_0x5db1e1[_0x3d5d('0x3c')][_0x3657f2])[_0x3d5d('0x7c')];var _0x41141b=JSON[_0x3d5d('0x7d')](_0x5db1e1[_0x3d5d('0x3c')][_0x3657f2])[_0x3d5d('0x7e')];_0x5c7373[_0x3d5d('0x46')](_0x3d5d('0x7f'),_0x3fe4db,_0x41141b);}else{if(_0x5db1e1[_0x3d5d('0x3c')][_0x3657f2]==='null'){_0x5c7373[_0x3d5d('0x46')]('i.'+_0x3657f2+_0x3d5d('0x80'));}else{_0x5c7373[_0x3d5d('0x46')]('i.'+_0x3657f2+_0x3d5d('0x81'),_0x5db1e1[_0x3d5d('0x3c')][_0x3657f2]);}}});}if(_0x5db1e1['query']['read']){if(_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x82')]==0x1){_0x5c7373[_0x3d5d('0x64')](_0x3d5d('0x83'));}else{_0x5c7373[_0x3d5d('0x64')](_0x3d5d('0x84'));}}if(_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x85')]){_0x51760f=_['isArray'](_0x5db1e1[_0x3d5d('0x3c')]['tag'])?_0x5db1e1['query']['tag']:new Array(_0x5db1e1['query'][_0x3d5d('0x85')]);_0x51760f[_0x3d5d('0x71')](function(_0x1f8f1b){_0x4cceb4['or'](_0x3d5d('0x86'),'%,'+_0x1f8f1b+',%');});}if(_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x87')]){var _0x1afb28=_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x87')][_0x3d5d('0x88')]('\x5c','\x5c\x5c')[_0x3d5d('0x88')](/'/g,'\x27\x27');if(qs[_0x3d5d('0x89')](_0x1afb28)){_0x1e8563['or'](_0x3d5d('0x8a'),_0x1afb28+'%')['or'](_0x3d5d('0x8b'),_0x1afb28+'%');}else{_0x1e8563['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3d5d('0x6a')](_0x1afb28))['or'](_0x3d5d('0x8c'),_0x1afb28+'%');}}}_0x5c7373['where'](_0x1e8563);_0x5c7373[_0x3d5d('0x8d')](_0x3d5d('0x8e'));var _0x2c88f1={'type':db[_0x3d5d('0x8f')][_0x3d5d('0x90')][_0x3d5d('0x91')],'raw':!![]};var _0x4b068e=_0x5c7373['clone']();_0x4b068e[_0x3d5d('0x49')](_0x3d5d('0x8e'));_0x4b068e[_0x3d5d('0x49')](_0x3d5d('0x92'),_0x3d5d('0x62'));if(_0x4abf9b[_0x3d5d('0x44')]){_0x4abf9b[_0x3d5d('0x44')]['forEach'](function(_0x3dea5a){var _0x1f7552=_0x3dea5a[0x0]===_0x3d5d('0x93')?_0x3dea5a[0x0]:'i.'+_0x3dea5a[0x0];_0x5c7373[_0x3d5d('0x44')](_0x1f7552,_0x3dea5a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3d5d('0x94')](_0x51760f)){_0x5c7373[_0x3d5d('0x64')](_0x4cceb4);_0x4b068e['where']('t.id\x20IN\x20?',_0x51760f);}BPromise['resolve']()[_0x3d5d('0x2b')](function(){if(!_0x2154db){if(_0x5db1e1[_0x3d5d('0x3c')][_0x3d5d('0x95')])return;_0x4b068e[_0x3d5d('0x46')](_0x3d5d('0x96'));_0x5c7373[_0x3d5d('0x46')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5db1e1[_0x3d5d('0x97')][_0x3d5d('0x98')]!==_0x3d5d('0x99'))return;return _0x5db1e1['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x3d5d('0x2b')](function(_0x34e1a2){if(_[_0x3d5d('0x94')](_0x34e1a2)){_0x4b068e[_0x3d5d('0x46')](_0x3d5d('0x9a'));_0x5c7373[_0x3d5d('0x46')](_0x3d5d('0x9a'));}else{_0x4b068e['where'](_0x3d5d('0x79'),_[_0x3d5d('0x30')](_0x34e1a2,'id'));_0x5c7373[_0x3d5d('0x46')](_0x3d5d('0x79'),_['map'](_0x34e1a2,'id'));}});})['then'](function(){if(_0x5db1e1[_0x3d5d('0x97')]['role']===_0x3d5d('0x99')&&!_0x2154db&&!_0x5db1e1['query'][_0x3d5d('0x95')])return[];return db[_0x3d5d('0x9b')][_0x3d5d('0x3c')](_0x4b068e[_0x3d5d('0x9c')](),_0x2c88f1);})['then'](function(_0x1cabf4){_0x3335f7[_0x3d5d('0x25')]=_0x1cabf4[_0x3d5d('0x42')];if(_0x3335f7[_0x3d5d('0x25')]===0x0)return[];return db['sequelize'][_0x3d5d('0x3c')](_0x42c985[_0x3d5d('0x9c')](),_0x2c88f1)['then'](function(_0x5b70b1){_0x594f01=_[_0x3d5d('0x9d')](_0x5b70b1,'id');_0x2c88f1=_[_0x3d5d('0x9e')](_0x2c88f1,{'model':db[_0x3d5d('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5db1e1[_0x3d5d('0x3c')]['fields']){_0x4abf9b[_0x3d5d('0x40')][_0x3d5d('0x71')](function(_0x371703){_0x5c7373[_0x3d5d('0x49')]('i.'+_0x371703);});}else{_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0x92'),'unreadMessages');_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0xa0'),_0x3d5d('0xa1'));_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0xa2'),_0x3d5d('0xa3'));_0x5c7373['field'](_0x3d5d('0xa4'),_0x3d5d('0x93'));_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0xa5'));_0x5c7373['field'](_0x3d5d('0xa6'),'Contact.firstName');_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0xa7'),_0x3d5d('0xa8'));_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0xa9'),'Contact.email');_0x5c7373['field']('c.phone',_0x3d5d('0xaa'));_0x5c7373['field'](_0x3d5d('0xab'),_0x3d5d('0xac'));_0x5c7373['field'](_0x3d5d('0xad'),_0x3d5d('0xae'));_0x5c7373['field'](_0x3d5d('0xaf'),_0x3d5d('0xb0'));_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0xb1'),_0x3d5d('0xb2'));_0x5c7373[_0x3d5d('0x49')](_0x3d5d('0xb3'),'TagIds');}if(_0x4abf9b[_0x3d5d('0x26')])_0x5c7373[_0x3d5d('0x26')](_0x4abf9b['limit']);if(_0x4abf9b[_0x3d5d('0x23')])_0x5c7373[_0x3d5d('0x23')](_0x4abf9b[_0x3d5d('0x23')]);return db[_0x3d5d('0x9b')]['query'](_0x5c7373[_0x3d5d('0x9c')](),_0x2c88f1);})[_0x3d5d('0x2b')](function(_0x411210){if(_0x411210['length']>0x0)_0x597f93[_0x3d5d('0x46')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x411210,'id'));return db['sequelize'][_0x3d5d('0x3c')](_0x597f93[_0x3d5d('0x9c')](),_0x2c88f1)[_0x3d5d('0x2b')](function(_0xde24fd){var _0x49e7bb=_[_0x3d5d('0xb4')](_0xde24fd,_0x3d5d('0xb5'));var _0xf25cf9=[];_0x411210[_0x3d5d('0x71')](function(_0x261b87){_0xf25cf9[_0x3d5d('0x35')](updateWhatsappInteraction(_0x261b87,_0x594f01,_0x49e7bb));});return BPromise[_0x3d5d('0xb6')](_0xf25cf9);});});})[_0x3d5d('0x2b')](function(_0x26a3b0){_0x3335f7['rows']=_0x26a3b0;return _0x3335f7;})[_0x3d5d('0x2b')](respondWithFilteredResult(_0xc63532,_0x4abf9b))[_0x3d5d('0x36')](handleError(_0xc63532,null));};exports[_0x3d5d('0xb7')]=function(_0x52a28d,_0x11c814){var _0x4a7c21={'raw':![],'where':{'id':_0x52a28d[_0x3d5d('0xb8')]['id']}},_0x47ea0a={};_0x47ea0a['model']=_['keys'](db[_0x3d5d('0x9f')][_0x3d5d('0x38')]);_0x47ea0a[_0x3d5d('0x3c')]=_['keys'](_0x52a28d[_0x3d5d('0x3c')]);_0x47ea0a[_0x3d5d('0x3e')]=_[_0x3d5d('0x3f')](_0x47ea0a[_0x3d5d('0x3b')],_0x47ea0a[_0x3d5d('0x3c')]);_0x4a7c21[_0x3d5d('0x40')]=_[_0x3d5d('0x3f')](_0x47ea0a[_0x3d5d('0x3b')],qs[_0x3d5d('0x41')](_0x52a28d[_0x3d5d('0x3c')][_0x3d5d('0x41')]));_0x4a7c21[_0x3d5d('0x40')]=_0x4a7c21[_0x3d5d('0x40')][_0x3d5d('0x42')]?_0x4a7c21[_0x3d5d('0x40')]:_0x47ea0a[_0x3d5d('0x3b')];if(_0x52a28d[_0x3d5d('0x3c')][_0x3d5d('0xb9')]){_0x4a7c21[_0x3d5d('0xba')]=[{'all':!![]}];}_0x4a7c21=_[_0x3d5d('0x9e')]({},_0x4a7c21,_0x52a28d[_0x3d5d('0xbb')]);return db['WhatsappInteraction'][_0x3d5d('0x61')](_0x4a7c21)[_0x3d5d('0x2b')](handleEntityNotFound(_0x11c814,null))[_0x3d5d('0x2b')](respondWithResult(_0x11c814,null))[_0x3d5d('0x36')](handleError(_0x11c814,null));};exports[_0x3d5d('0xbc')]=function(_0x2bdf09,_0x5ab32d){return db[_0x3d5d('0x9f')]['create'](_0x2bdf09[_0x3d5d('0x75')],{})[_0x3d5d('0x2b')](respondWithResult(_0x5ab32d,0xc9))['catch'](handleError(_0x5ab32d,null));};exports[_0x3d5d('0xbd')]=function(_0x3b7cff,_0x5b5dcf){if(_0x3b7cff[_0x3d5d('0x75')]['id']){delete _0x3b7cff[_0x3d5d('0x75')]['id'];}return db[_0x3d5d('0x9f')][_0x3d5d('0x61')]({'where':{'id':_0x3b7cff['params']['id']}})[_0x3d5d('0x2b')](handleEntityNotFound(_0x5b5dcf,null))[_0x3d5d('0x2b')](saveUpdates(_0x3b7cff[_0x3d5d('0x75')],null))[_0x3d5d('0x2b')](respondWithResult(_0x5b5dcf,null))[_0x3d5d('0x36')](handleError(_0x5b5dcf,null));};exports[_0x3d5d('0x2c')]=function(_0x382b6c,_0x31876f){return db[_0x3d5d('0x9f')][_0x3d5d('0x61')]({'where':{'id':_0x382b6c[_0x3d5d('0xb8')]['id']}})['then'](handleEntityNotFound(_0x31876f,null))[_0x3d5d('0x2b')](removeEntity(_0x31876f,null))[_0x3d5d('0x36')](handleError(_0x31876f,null));};exports[_0x3d5d('0xbe')]=function(_0x59fd62,_0x296043){return db[_0x3d5d('0x9f')][_0x3d5d('0xbe')]()['then'](respondWithResult(_0x296043,null))[_0x3d5d('0x36')](handleError(_0x296043,null));};exports[_0x3d5d('0xbf')]=function(_0x42de12,_0x3e337f,_0x3c1ea8){return db[_0x3d5d('0xc0')][_0x3d5d('0x61')]({'where':{'id':_0x42de12[_0x3d5d('0xb8')]['id']}})[_0x3d5d('0x2b')](handleEntityNotFound(_0x3e337f,null))[_0x3d5d('0x2b')](function(_0x2d8e82){if(_0x2d8e82){return _0x2d8e82[_0x3d5d('0xbf')](_0x42de12[_0x3d5d('0x75')]['ids'],_[_0x3d5d('0xc1')](_0x42de12['body'],[_0x3d5d('0xc2'),'id'])||{});}})[_0x3d5d('0x2b')](respondWithResult(_0x3e337f,null))[_0x3d5d('0x36')](handleError(_0x3e337f,null));};exports[_0x3d5d('0xc3')]=function(_0x5e7555,_0x2912f1,_0x8f25c4){var _0x5069cb={'raw':![],'where':{}};var _0x5911e7={};var _0x2ebf2f={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x5e7555[_0x3d5d('0xb8')]['id']}})[_0x3d5d('0x2b')](handleEntityNotFound(_0x2912f1,null))['then'](function(_0x346f1b){if(_0x346f1b){_0x5911e7[_0x3d5d('0x3b')]=_[_0x3d5d('0x3d')](db[_0x3d5d('0xc0')][_0x3d5d('0x38')]);_0x5911e7[_0x3d5d('0x3c')]=_['keys'](_0x5e7555[_0x3d5d('0x3c')]);_0x5911e7[_0x3d5d('0x3e')]=_['intersection'](_0x5911e7[_0x3d5d('0x3b')],_0x5911e7['query']);_0x5069cb[_0x3d5d('0x40')]=_['intersection'](_0x5911e7[_0x3d5d('0x3b')],qs[_0x3d5d('0x41')](_0x5e7555[_0x3d5d('0x3c')]['fields']));_0x5069cb[_0x3d5d('0x40')]=_0x5069cb[_0x3d5d('0x40')][_0x3d5d('0x42')]?_0x5069cb['attributes']:_0x5911e7[_0x3d5d('0x3b')];if(!_0x5e7555[_0x3d5d('0x3c')][_0x3d5d('0x43')]('nolimit')){_0x5069cb[_0x3d5d('0x26')]=qs['limit'](_0x5e7555['query'][_0x3d5d('0x26')]);_0x5069cb[_0x3d5d('0x23')]=qs[_0x3d5d('0x23')](_0x5e7555['query'][_0x3d5d('0x23')]);}_0x5069cb[_0x3d5d('0x44')]=qs[_0x3d5d('0x45')](_0x5e7555[_0x3d5d('0x3c')][_0x3d5d('0x45')]);_0x5069cb[_0x3d5d('0x46')]=qs[_0x3d5d('0x3e')](_['pick'](_0x5e7555['query'],_0x5911e7[_0x3d5d('0x3e')]));_0x5069cb['where'][_0x3d5d('0xb5')]=_0x346f1b['id'];if(_0x5e7555[_0x3d5d('0x3c')][_0x3d5d('0x87')]){_0x5069cb['where']=_['merge'](_0x5069cb[_0x3d5d('0x46')],{'$or':_[_0x3d5d('0x30')](_0x5069cb[_0x3d5d('0x40')],function(_0x58c7f2){var _0x4d5c0b={};_0x4d5c0b[_0x58c7f2]={'$like':'%'+_0x5e7555[_0x3d5d('0x3c')][_0x3d5d('0x87')]+'%'};return _0x4d5c0b;})});}if(_0x5e7555[_0x3d5d('0x3c')][_0x3d5d('0x7c')]){var _0x12ecf5=_0x5e7555[_0x3d5d('0x3c')][_0x3d5d('0x7c')]['split'](',');var _0x3f175a={};_0x3f175a[_0x12ecf5[0x0]]={'$gte':moment(_0x12ecf5[0x1])[_0x3d5d('0xc4')](_0x3d5d('0xc5'))};_0x5069cb[_0x3d5d('0x46')]=_[_0x3d5d('0x9e')](_0x5069cb[_0x3d5d('0x46')],_0x3f175a);}_0x5069cb=_['merge']({},_0x5069cb,_0x5e7555[_0x3d5d('0xbb')]);return db['WhatsappMessage'][_0x3d5d('0x25')]({'where':_0x5069cb['where']})['then'](function(_0x45caa){_0x2ebf2f['count']=_0x45caa;if(_0x5e7555['query'][_0x3d5d('0xb9')]){_0x5069cb[_0x3d5d('0xba')]=[{'all':!![]}];}return db[_0x3d5d('0xc0')][_0x3d5d('0xc6')](_0x5069cb);})[_0x3d5d('0x2b')](function(_0x5bb606){_0x2ebf2f[_0x3d5d('0xc7')]=_0x5bb606;return _0x2ebf2f;});}})[_0x3d5d('0x2b')](respondWithFilteredResult(_0x2912f1,_0x5069cb))[_0x3d5d('0x36')](handleError(_0x2912f1,null));};exports['addTags']=function(_0x42e7fc,_0x2833b3,_0x25238b){return db[_0x3d5d('0x9f')][_0x3d5d('0x61')]({'where':{'id':_0x42e7fc['params']['id']}})['then'](handleEntityNotFound(_0x2833b3,null))[_0x3d5d('0x2b')](function(_0x4db24c){if(_0x4db24c){return _0x4db24c[_0x3d5d('0xc8')](_0x42e7fc['body'][_0x3d5d('0xc2')],_[_0x3d5d('0xc1')](_0x42e7fc[_0x3d5d('0x75')],[_0x3d5d('0xc2'),'id'])||{})[_0x3d5d('0xc9')](function(){return db[_0x3d5d('0x70')][_0x3d5d('0xc6')]({'attributes':['id',_0x3d5d('0x2f'),_0x3d5d('0x4a')],'where':{'id':_0x42e7fc[_0x3d5d('0x75')][_0x3d5d('0xc2')]}});})['then'](function(_0x1dfec8){socket[_0x3d5d('0xca')](_0x3d5d('0xcb'),{'id':Number(_0x42e7fc[_0x3d5d('0xb8')]['id']),'tags':_0x1dfec8||[]});return{'id':Number(_0x42e7fc['params']['id']),'tags':_0x1dfec8||[]};});}})[_0x3d5d('0x2b')](respondWithResult(_0x2833b3,null))['catch'](handleError(_0x2833b3,null));};exports[_0x3d5d('0xcc')]=function(_0x463341,_0x925a80,_0x43b729){return db[_0x3d5d('0x9f')]['find']({'where':{'id':_0x463341[_0x3d5d('0xb8')]['id']}})[_0x3d5d('0x2b')](handleEntityNotFound(_0x925a80,null))['then'](function(_0x203c65){if(_0x203c65){return _0x203c65[_0x3d5d('0xcc')](_0x463341[_0x3d5d('0x3c')]['ids']);}})[_0x3d5d('0x2b')](respondWithStatusCode(_0x925a80,null))[_0x3d5d('0x36')](handleError(_0x925a80,null));};exports[_0x3d5d('0xcd')]=function(_0x1d5e12,_0xbff7bb){var _0x3f17a8=moment()[_0x3d5d('0xce')]()[_0x3d5d('0x9c')]();var _0x115a66=path[_0x3d5d('0xcf')](config['root'],_0x3d5d('0xd0'),_0x3d5d('0xd1'),'tmp');var _0x141ebc=path[_0x3d5d('0xcf')](config['root'],_0x3d5d('0xd0'),'files',_0x3d5d('0xd2'));var _0x38bbd0=path[_0x3d5d('0xcf')](_0x115a66,_0x3f17a8);var _0x2b77ec=util['format'](_0x3d5d('0xd3'),_0x1d5e12[_0x3d5d('0xb8')]['id'],_0x3f17a8);var _0x46978b=path['join'](_0x115a66,_0x2b77ec);var _0x3c37fe=[];_0x3c37fe[_0x3d5d('0x35')]({'model':db[_0x3d5d('0x73')],'as':_0x3d5d('0x73'),'attributes':['id',_0x3d5d('0x31')],'raw':!![]});_0x3c37fe[_0x3d5d('0x35')]({'model':db[_0x3d5d('0xd4')],'as':_0x3d5d('0x66'),'attributes':['id','firstName',_0x3d5d('0xd5')],'raw':!![]});if(_0x1d5e12[_0x3d5d('0x3c')][_0x3d5d('0xd2')]){_0x3c37fe[_0x3d5d('0x35')]({'model':db[_0x3d5d('0xd6')],'as':_0x3d5d('0xd6'),'raw':!![]});}var _0x4dfd5e=[{'model':db[_0x3d5d('0xc0')],'as':_0x3d5d('0xd7'),'attributes':['id',_0x3d5d('0x75'),_0x3d5d('0x7b'),_0x3d5d('0xd8'),_0x3d5d('0xd9'),_0x3d5d('0x82')],'include':_0x3c37fe}];_0x4dfd5e[_0x3d5d('0x35')]({'model':db['WhatsappAccount'],'as':_0x3d5d('0xda'),'attributes':['id',_0x3d5d('0x2f')]});_0x4dfd5e[_0x3d5d('0x35')]({'model':db['User'],'as':'Owner','attributes':['id',_0x3d5d('0x31')]});return db[_0x3d5d('0x9f')][_0x3d5d('0x61')]({'where':{'id':_0x1d5e12['params']['id']},'include':_0x4dfd5e})['then'](handleEntityNotFound(_0xbff7bb,null))[_0x3d5d('0x2b')](function(_0x251868){if(_0x251868){var _0x4ff0df=_0x251868['get']({'plain':!![]});fs['mkdirSync'](_0x38bbd0);var _0x52fc01={'channel':_0x3d5d('0xdb'),'account':_0x4ff0df['Account'][_0x3d5d('0x2f')],'agent':_0x4ff0df[_0x3d5d('0xdc')]?_0x4ff0df[_0x3d5d('0xdc')][_0x3d5d('0x31')]:_0x3d5d('0xdd'),'createdAt':moment(_0x4ff0df[_0x3d5d('0x7b')])[_0x3d5d('0xc4')](_0x3d5d('0xc5'))['toString'](),'closedAt':_0x4ff0df['closed']?moment(_0x4ff0df[_0x3d5d('0xde')])[_0x3d5d('0xc4')](_0x3d5d('0xc5'))[_0x3d5d('0x9c')]():'','disposition':_0x4ff0df[_0x3d5d('0xdf')],'messages':_(_0x4ff0df[_0x3d5d('0xd7')])[_0x3d5d('0x87')]({'secret':![]})[_0x3d5d('0x30')](function(_0x73d989){if(_0x73d989[_0x3d5d('0xd6')]){var _0x31293e=path[_0x3d5d('0xcf')](_0x141ebc,_0x73d989[_0x3d5d('0xd6')][_0x3d5d('0xe0')]);if(fs[_0x3d5d('0xe1')](_0x31293e)){fs[_0x3d5d('0xe2')](_0x31293e)[_0x3d5d('0xe3')](fs['createWriteStream'](path[_0x3d5d('0xcf')](_0x38bbd0,_0x73d989[_0x3d5d('0xd6')]['basename'])));}}return{'date':moment(_0x73d989[_0x3d5d('0x7b')])[_0x3d5d('0xc4')](_0x3d5d('0xc5'))['toString'](),'sender':_0x73d989['direction']==='out'?_0x73d989[_0x3d5d('0x73')]?_0x73d989['User'][_0x3d5d('0x31')]:_0x3d5d('0xe4'):_0x73d989[_0x3d5d('0x66')]['firstName']+(_0x73d989[_0x3d5d('0x66')][_0x3d5d('0xd5')]?'\x20'+_0x73d989['Contact'][_0x3d5d('0xd5')]:''),'body':_0x73d989[_0x3d5d('0xd6')]?_0x73d989[_0x3d5d('0xd6')]['basename']:_0x73d989['body'],'direction':_0x73d989['direction']===_0x3d5d('0xe5')?'A':'C','secret':_0x73d989['secret'],'read':_0x73d989[_0x3d5d('0x82')],'attachment':_0x73d989[_0x3d5d('0xd6')]};})[_0x3d5d('0x63')]()};return ejs['renderFile'](path[_0x3d5d('0xcf')](config['root'],'server',_0x3d5d('0xe6'),'downloadInteraction.ejs'),{'interaction':_0x52fc01})[_0x3d5d('0x2b')](function(_0x4e125a){var _0x33123e=path[_0x3d5d('0xcf')](_0x38bbd0,'transcript-'+_0x4ff0df['id']+'-'+_0x3f17a8+_0x3d5d('0xe7'));var _0x3b24c5={'path':_0x33123e,'channel':'Whatsapp','interactionId':_0x4ff0df['id']};return pdf[_0x3d5d('0xe8')](_0x4e125a,_0x3b24c5);})['then'](function(){return new BPromise(function(_0x5dadc3,_0xc62ada){zipdir(_0x38bbd0,{'saveTo':_0x46978b},function(_0x58c07d,_0x10fd35){if(_0x58c07d)return _0xc62ada(_0x58c07d);return _0x5dadc3(_0x10fd35);});})[_0x3d5d('0x2b')](function(){return new BPromise(function(_0x346e04,_0x58fb55){rimraf(_0x38bbd0,function(_0x30322f){if(_0x30322f)_0x58fb55(_0x30322f);return _0x346e04();});});})[_0x3d5d('0x2b')](function(){return _0xbff7bb['download'](_0x46978b,_0x2b77ec,function(_0x2859dd){if(_0x2859dd){console[_0x3d5d('0xe9')](_0x3d5d('0xea'),_0x2859dd);}else{fs[_0x3d5d('0xeb')](_0x46978b);}});});});}else{return _0xbff7bb[_0x3d5d('0x20')](0xc8);}})[_0x3d5d('0x36')](handleError(_0xbff7bb,null));}; \ No newline at end of file +var _0xbc9d=['undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','Users','map','TagIds','split','forEach','push','index','WhatsappInteraction','rawAttributes','fieldName','key','model','keys','filters','query','attributes','fields','length','nolimit','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','WhatsappAccountId','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','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','i.*','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','GROUP_CONCAT(DISTINCT\x20t.id)','rows','catch','show','params','intersection','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Owner','mkdirSync','Whatsapp','Account','N.A.','closedAt','disposition','basename','existsSync','pipe','createWriteStream','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbc9d,0xcc));var _0xdbc9=function(_0x2ef22d,_0x13ebc8){_0x2ef22d=_0x2ef22d-0x0;var _0x5dc1f7=_0xbc9d[_0x2ef22d];return _0x5dc1f7;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require('request-promise');var moment=require(_0xdbc9('0x4'));var BPromise=require(_0xdbc9('0x5'));var Mustache=require(_0xdbc9('0x6'));var util=require(_0xdbc9('0x7'));var path=require(_0xdbc9('0x8'));var sox=require('sox');var csv=require(_0xdbc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require(_0xdbc9('0xc'));var crypto=require('crypto');var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require(_0xdbc9('0x9'));var querystring=require('querystring');var Papa=require(_0xdbc9('0xf'));var Redis=require(_0xdbc9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdbc9('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xdbc9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbc9('0x13'))(_0xdbc9('0x14'));var utils=require('../../config/utils');var config=require(_0xdbc9('0x15'));var licenseUtil=require(_0xdbc9('0x16'));var db=require('../../mysqldb')['db'];config[_0xdbc9('0x17')]=_[_0xdbc9('0x18')](config['redis'],{'host':_0xdbc9('0x19'),'port':0x18eb});var socket=require(_0xdbc9('0x1a'))(new Redis(config[_0xdbc9('0x17')]));require('./whatsappInteraction.socket')[_0xdbc9('0x1b')](socket);function respondWithStatusCode(_0x330ec9,_0x4fc432){_0x4fc432=_0x4fc432||0xcc;return function(_0x469631){if(_0x469631){return _0x330ec9[_0xdbc9('0x1c')](_0x4fc432);}return _0x330ec9['status'](_0x4fc432)[_0xdbc9('0x1d')]();};}function respondWithResult(_0x538128,_0x3eef2f){_0x3eef2f=_0x3eef2f||0xc8;return function(_0x3b51b1){if(_0x3b51b1){return _0x538128[_0xdbc9('0x1e')](_0x3eef2f)[_0xdbc9('0x1f')](_0x3b51b1);}};}function respondWithFilteredResult(_0x2423e2,_0x4f8316){return function(_0x165831){if(_0x165831){var _0x1dc29c=typeof _0x4f8316[_0xdbc9('0x20')]===_0xdbc9('0x21')&&typeof _0x4f8316['limit']===_0xdbc9('0x21');var _0xefebd6=_0x165831[_0xdbc9('0x22')];var _0x35150e=_0x1dc29c?0x0:_0x4f8316[_0xdbc9('0x20')];var _0x3526c7=_0x1dc29c?_0x165831[_0xdbc9('0x22')]:_0x4f8316[_0xdbc9('0x20')]+_0x4f8316[_0xdbc9('0x23')];var _0xcd3935;if(_0x3526c7>=_0xefebd6){_0x3526c7=_0xefebd6;_0xcd3935=0xc8;}else{_0xcd3935=0xce;}_0x2423e2[_0xdbc9('0x1e')](_0xcd3935);return _0x2423e2[_0xdbc9('0x24')](_0xdbc9('0x25'),_0x35150e+'-'+_0x3526c7+'/'+_0xefebd6)['json'](_0x165831);}return null;};}function patchUpdates(_0x45267f){return function(_0x269afb){try{jsonpatch[_0xdbc9('0x26')](_0x269afb,_0x45267f,!![]);}catch(_0x520ad4){return BPromise['reject'](_0x520ad4);}return _0x269afb[_0xdbc9('0x27')]();};}function saveUpdates(_0x170d6f,_0x54f1bd){return function(_0x4e00a1){if(_0x4e00a1){return _0x4e00a1[_0xdbc9('0x28')](_0x170d6f)[_0xdbc9('0x29')](function(_0xafd89){return _0xafd89;});}return null;};}function removeEntity(_0x13fcf1,_0x28d719){return function(_0x465a5e){if(_0x465a5e){return _0x465a5e[_0xdbc9('0x2a')]()[_0xdbc9('0x29')](function(){_0x13fcf1['status'](0xcc)[_0xdbc9('0x1d')]();});}};}function handleEntityNotFound(_0x2553ac,_0x4ba13c){return function(_0x14ea19){if(!_0x14ea19){_0x2553ac[_0xdbc9('0x1c')](0x194);}return _0x14ea19;};}function handleError(_0x3f5a05,_0x4fc4a4){_0x4fc4a4=_0x4fc4a4||0x1f4;return function(_0x410292){logger[_0xdbc9('0x2b')](_0x410292[_0xdbc9('0x2c')]);if(_0x410292[_0xdbc9('0x2d')]){delete _0x410292[_0xdbc9('0x2d')];}_0x3f5a05[_0xdbc9('0x1e')](_0x4fc4a4)['send'](_0x410292);};}function getInteractionUsers(_0x2a62bf,_0x136b1e){return new BPromise(function(_0x7b3eb5,_0x33a3b0){try{if(_0x136b1e[_0x2a62bf['id']]){_0x2a62bf[_0xdbc9('0x2e')]=_[_0xdbc9('0x2f')](_0x136b1e[_0x2a62bf['id']],function(_0x2f18e7){return{'id':_0x2f18e7['id'],'fullname':_0x2f18e7['fullname']};});}}catch(_0x42a9bb){_0x33a3b0(_0x42a9bb);}_0x7b3eb5(_0x2a62bf);});}function getInteractionTags(_0x1f80a8,_0x58b748){return new BPromise(function(_0x1494e6,_0x41944e){try{if(_0x1f80a8[_0xdbc9('0x30')]){_0x1f80a8['Tags']=[];_0x1f80a8['TagIds'][_0xdbc9('0x31')](',')[_0xdbc9('0x32')](function(_0x47aefb){_0x1f80a8['Tags'][_0xdbc9('0x33')](_0x58b748[_0x47aefb]);});}delete _0x1f80a8[_0xdbc9('0x30')];}catch(_0x2dd470){_0x41944e(_0x2dd470);}_0x1494e6(_0x1f80a8);});}function updateWhatsappInteraction(_0x55bc02,_0x13ce6a,_0x131c55){return new BPromise(function(_0x236a37,_0xe39e74){return getInteractionUsers(_0x55bc02,_0x131c55)['then'](function(_0x1f5384){return getInteractionTags(_0x1f5384,_0x13ce6a);})[_0xdbc9('0x29')](function(_0x556ea3){_0x236a37(_0x556ea3);})['catch'](function(_0x3cf57b){_0xe39e74(_0x3cf57b);});});}exports[_0xdbc9('0x34')]=function(_0x5a2358,_0x3c2907){var _0x2faaa7={},_0x3d8cc9={},_0x4ef55c={'count':0x0,'rows':[]};var _0x1c5be3=_['map'](db[_0xdbc9('0x35')][_0xdbc9('0x36')],function(_0x368148){return{'name':_0x368148[_0xdbc9('0x37')],'type':_0x368148['type'][_0xdbc9('0x38')]};});_0x3d8cc9[_0xdbc9('0x39')]=_[_0xdbc9('0x2f')](_0x1c5be3,'name');_0x3d8cc9['query']=_[_0xdbc9('0x3a')](_0x5a2358['query']);_0x3d8cc9[_0xdbc9('0x3b')]=_['intersection'](_0x3d8cc9[_0xdbc9('0x39')],_0x3d8cc9[_0xdbc9('0x3c')]);_0x2faaa7[_0xdbc9('0x3d')]=_['intersection'](_0x3d8cc9['model'],qs[_0xdbc9('0x3e')](_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x3e')]));_0x2faaa7[_0xdbc9('0x3d')]=_0x2faaa7[_0xdbc9('0x3d')][_0xdbc9('0x3f')]?_0x2faaa7['attributes']:_0x3d8cc9[_0xdbc9('0x39')];if(!_0x5a2358[_0xdbc9('0x3c')]['hasOwnProperty'](_0xdbc9('0x40'))){_0x2faaa7[_0xdbc9('0x23')]=qs[_0xdbc9('0x23')](_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x23')]);_0x2faaa7['offset']=qs['offset'](_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x20')]);}_0x2faaa7['order']=qs[_0xdbc9('0x41')](_0x5a2358[_0xdbc9('0x3c')]['sort']);_0x2faaa7[_0xdbc9('0x42')]=qs[_0xdbc9('0x3b')](_[_0xdbc9('0x43')](_0x5a2358[_0xdbc9('0x3c')],_0x3d8cc9[_0xdbc9('0x3b')]),_0x1c5be3);var _0xb04180=[];var _0x30a1cf=squel['select']()[_0xdbc9('0x44')]('id')[_0xdbc9('0x44')]('name')[_0xdbc9('0x44')](_0xdbc9('0x45'))[_0xdbc9('0x46')](_0xdbc9('0x47'));var _0x17dce6=squel[_0xdbc9('0x48')]()['field'](_0xdbc9('0x49'))[_0xdbc9('0x44')](_0xdbc9('0x4a'))[_0xdbc9('0x44')](_0xdbc9('0x4b'))['from'](_0xdbc9('0x4c'),'ui')[_0xdbc9('0x4d')](_0xdbc9('0x4e'),'u',_0xdbc9('0x4f'));var _0x498d1d=squel['select']()[_0xdbc9('0x46')](_0xdbc9('0x50'),'i')[_0xdbc9('0x4d')](_0xdbc9('0x51'),'c',_0xdbc9('0x52'))[_0xdbc9('0x4d')](_0xdbc9('0x4e'),'o',_0xdbc9('0x53'))[_0xdbc9('0x4d')](_0xdbc9('0x54'),'a',_0xdbc9('0x55'))['left_join'](_0xdbc9('0x56'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xdbc9('0x4d')](_0xdbc9('0x57'),'it',_0xdbc9('0x58'))[_0xdbc9('0x4d')](_0xdbc9('0x47'),'t','t.id\x20=\x20it.TagId');var _0x5977a5=squel[_0xdbc9('0x59')]();var _0x2fd760=[];var _0x382dce=squel[_0xdbc9('0x59')]();var _0x5d3a17;if(_0x5a2358['query']['search']){_0x5d3a17=as[_0xdbc9('0x5a')](_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x5b')]);var _0x308ea2=_0x5d3a17[_0xdbc9('0x5c')];for(var _0x271688=0x0;_0x271688<_0x5d3a17['conditions'][_0xdbc9('0x3f')];_0x271688++){var _0x14dc0a=_0x5d3a17[_0xdbc9('0x5d')][_0x271688];var _0x3b315a='i';var _0x59c69a=_[_0xdbc9('0x5e')](_0x1c5be3,[_0xdbc9('0x2d'),_0x14dc0a[_0xdbc9('0x44')]]);if(!_0x59c69a){switch(_0x14dc0a[_0xdbc9('0x44')]){case _0xdbc9('0x5f'):if(_0x14dc0a[_0xdbc9('0x60')]==0x1){_0x498d1d['having']('`'+_0x14dc0a[_0xdbc9('0x44')]+_0xdbc9('0x61'));}else{_0x498d1d['having']('`'+_0x14dc0a[_0xdbc9('0x44')]+_0xdbc9('0x62'));}break;case'Contact':if(_0x14dc0a[_0xdbc9('0x63')]==='$substring'){if(_0x14dc0a[_0xdbc9('0x60')][_0xdbc9('0x31')]('\x20')[_0xdbc9('0x3f')]>0x1){_0x5977a5[_0x308ea2]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdbc9('0x64')](_0x14dc0a[_0xdbc9('0x60')]),null);}else{var _0x307d88='%'+_0x14dc0a[_0xdbc9('0x60')]+'%';_0x5977a5[_0x308ea2](_0xdbc9('0x65'),_0x307d88,_0x307d88,_0x307d88);}}else{_0x59c69a=_['find'](_0x1c5be3,[_0xdbc9('0x2d'),_0xdbc9('0x66')]);_0x14dc0a[_0xdbc9('0x44')]=_0xdbc9('0x66');_0x3098ba=as[_0xdbc9('0x67')](_0x3b315a,_0x59c69a[_0xdbc9('0x68')],_0x14dc0a);_0x5977a5[_0x308ea2](_0x3098ba[_0xdbc9('0x69')],_0x3098ba['value']['start'],_0x3098ba['value'][_0xdbc9('0x1d')]);}break;case _0xdbc9('0x6a'):var _0x59a52e=_0x14dc0a['value'][_0xdbc9('0x31')](',')[_0xdbc9('0x2f')](function(_0x298c1b){return Number(_0x298c1b);});_0x59a52e[_0xdbc9('0x32')](function(_0x23d2c6){_0x382dce['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x23d2c6+',%');});_0x2fd760=_[_0xdbc9('0x6b')](_0x2fd760,_0x59a52e);break;case _0xdbc9('0x6c'):if(_0x14dc0a[_0xdbc9('0x63')]===_0xdbc9('0x6d')){_0x5977a5[_0x308ea2](_0xdbc9('0x6e'),'%'+_0x14dc0a[_0xdbc9('0x60')]+'%',null);}else{_0x59c69a=_[_0xdbc9('0x5e')](_0x1c5be3,[_0xdbc9('0x2d'),_0xdbc9('0x6f')]);_0x14dc0a[_0xdbc9('0x44')]=_0xdbc9('0x6f');_0x3098ba=as[_0xdbc9('0x67')](_0x3b315a,_0x59c69a['type'],_0x14dc0a);_0x5977a5[_0x308ea2](_0x3098ba[_0xdbc9('0x69')],_0x3098ba[_0xdbc9('0x60')][_0xdbc9('0x70')],_0x3098ba[_0xdbc9('0x60')]['end']);}break;case _0xdbc9('0x71'):_0x3098ba=as['buildExpression']('me',null,_0x14dc0a);_0x5977a5[_0x308ea2](_0x3098ba[_0xdbc9('0x69')],_0x3098ba[_0xdbc9('0x60')][_0xdbc9('0x70')],_0x3098ba['value'][_0xdbc9('0x1d')]);break;}}else{var _0x3098ba=as[_0xdbc9('0x67')](_0x3b315a,_0x59c69a['type'],_0x14dc0a);_0x5977a5[_0x308ea2](_0x3098ba[_0xdbc9('0x69')],_0x3098ba[_0xdbc9('0x60')]['start'],_0x3098ba['value'][_0xdbc9('0x1d')]);}}}else{var _0x5a9fbe=_(_0x5a2358[_0xdbc9('0x3c')])[_0xdbc9('0x3a')]()[_0xdbc9('0x2f')](function(_0x42f4b3){return _[_0xdbc9('0x72')](_0x1c5be3,[_0xdbc9('0x2d'),_0x42f4b3])?_0x42f4b3:undefined;})[_0xdbc9('0x73')]()[_0xdbc9('0x60')]();if(!_[_0xdbc9('0x74')](_0x5a9fbe)){_0x5a9fbe[_0xdbc9('0x32')](function(_0x27593e){if(_0x27593e==='WhatsappAccountId'){_0x498d1d[_0xdbc9('0x42')](_0xdbc9('0x75'),[][_0xdbc9('0x76')](_0x5a2358[_0xdbc9('0x3c')][_0x27593e]));}else if(_0x27593e==='createdAt'){var _0x4276df=JSON['parse'](_0x5a2358[_0xdbc9('0x3c')][_0x27593e])[_0xdbc9('0x77')];var _0x28978f=JSON[_0xdbc9('0x78')](_0x5a2358['query'][_0x27593e])[_0xdbc9('0x79')];_0x498d1d[_0xdbc9('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4276df,_0x28978f);}else{if(_0x5a2358[_0xdbc9('0x3c')][_0x27593e]==='null'){_0x498d1d[_0xdbc9('0x42')]('i.'+_0x27593e+_0xdbc9('0x7a'));}else{_0x498d1d['where']('i.'+_0x27593e+_0xdbc9('0x7b'),_0x5a2358[_0xdbc9('0x3c')][_0x27593e]);}}});}if(_0x5a2358['query']['read']){if(_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x7c')]==0x1){_0x498d1d[_0xdbc9('0x7d')]('`unreadMessages`\x20=\x200');}else{_0x498d1d['having'](_0xdbc9('0x7e'));}}if(_0x5a2358['query'][_0xdbc9('0x7f')]){_0x2fd760=_[_0xdbc9('0x80')](_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x7f')])?_0x5a2358['query'][_0xdbc9('0x7f')]:new Array(_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x7f')]);_0x2fd760[_0xdbc9('0x32')](function(_0x5cbe5a){_0x382dce['or'](_0xdbc9('0x81'),'%,'+_0x5cbe5a+',%');});}if(_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x82')]){var _0x174681=_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x82')][_0xdbc9('0x83')]('\x5c','\x5c\x5c')[_0xdbc9('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x174681)){_0x5977a5['or']('i.id\x20LIKE\x20?',_0x174681+'%')['or'](_0xdbc9('0x84'),_0x174681+'%');}else{_0x5977a5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x174681))['or'](_0xdbc9('0x85'),_0x174681+'%');}}}_0x498d1d[_0xdbc9('0x42')](_0x5977a5);_0x498d1d[_0xdbc9('0x86')](_0xdbc9('0x87'));var _0x1580b5={'type':db[_0xdbc9('0x88')]['QueryTypes']['SELECT'],'raw':!![]};var _0x490a0e=_0x498d1d[_0xdbc9('0x89')]();_0x490a0e[_0xdbc9('0x44')](_0xdbc9('0x87'));_0x490a0e['field'](_0xdbc9('0x8a'),_0xdbc9('0x5f'));if(_0x2faaa7[_0xdbc9('0x8b')]){_0x2faaa7[_0xdbc9('0x8b')][_0xdbc9('0x32')](function(_0x521d5f){var _0x5308e7=_0x521d5f[0x0]==='contactName'?_0x521d5f[0x0]:'i.'+_0x521d5f[0x0];_0x498d1d['order'](_0x5308e7,_0x521d5f[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdbc9('0x74')](_0x2fd760)){_0x498d1d['having'](_0x382dce);_0x490a0e[_0xdbc9('0x42')](_0xdbc9('0x8c'),_0x2fd760);}BPromise[_0xdbc9('0x8d')]()['then'](function(){if(!_0x5d3a17){if(_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x8e')])return;_0x490a0e['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x498d1d['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5a2358[_0xdbc9('0x8f')][_0xdbc9('0x90')]!==_0xdbc9('0x91'))return;return _0x5a2358[_0xdbc9('0x8f')][_0xdbc9('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x314a37){if(_[_0xdbc9('0x74')](_0x314a37)){_0x490a0e[_0xdbc9('0x42')](_0xdbc9('0x93'));_0x498d1d[_0xdbc9('0x42')](_0xdbc9('0x93'));}else{_0x490a0e[_0xdbc9('0x42')](_0xdbc9('0x75'),_[_0xdbc9('0x2f')](_0x314a37,'id'));_0x498d1d[_0xdbc9('0x42')](_0xdbc9('0x75'),_[_0xdbc9('0x2f')](_0x314a37,'id'));}});})[_0xdbc9('0x29')](function(){if(_0x5a2358[_0xdbc9('0x8f')][_0xdbc9('0x90')]===_0xdbc9('0x91')&&!_0x5d3a17&&!_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x8e')])return[];return db[_0xdbc9('0x94')][_0xdbc9('0x3c')](_0x490a0e['toString'](),_0x1580b5);})[_0xdbc9('0x29')](function(_0x582152){_0x4ef55c[_0xdbc9('0x22')]=_0x582152[_0xdbc9('0x3f')];if(_0x4ef55c[_0xdbc9('0x22')]===0x0)return[];return db['sequelize'][_0xdbc9('0x3c')](_0x30a1cf[_0xdbc9('0x95')](),_0x1580b5)['then'](function(_0x14cd51){_0xb04180=_[_0xdbc9('0x96')](_0x14cd51,'id');_0x1580b5=_[_0xdbc9('0x97')](_0x1580b5,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a2358[_0xdbc9('0x3c')][_0xdbc9('0x3e')]){_0x2faaa7[_0xdbc9('0x3d')]['forEach'](function(_0xd83ddc){_0x498d1d[_0xdbc9('0x44')]('i.'+_0xd83ddc);});}else{_0x498d1d[_0xdbc9('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdbc9('0x5f'));_0x498d1d[_0xdbc9('0x44')]('a.key',_0xdbc9('0x98'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0x99'),_0xdbc9('0x9a'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0x9b'),'contactName');_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0x9c'));_0x498d1d[_0xdbc9('0x44')]('c.firstName',_0xdbc9('0x9d'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0x9e'),_0xdbc9('0x9f'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0xa0'),_0xdbc9('0xa1'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0xa2'),_0xdbc9('0xa3'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0xa4'),_0xdbc9('0xa5'));_0x498d1d['field']('c.fax',_0xdbc9('0xa6'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0xa7'),_0xdbc9('0xa8'));_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0xa9'),'Owner.internal');_0x498d1d[_0xdbc9('0x44')](_0xdbc9('0xaa'),_0xdbc9('0x30'));}if(_0x2faaa7[_0xdbc9('0x23')])_0x498d1d[_0xdbc9('0x23')](_0x2faaa7['limit']);if(_0x2faaa7[_0xdbc9('0x20')])_0x498d1d[_0xdbc9('0x20')](_0x2faaa7[_0xdbc9('0x20')]);return db['sequelize'][_0xdbc9('0x3c')](_0x498d1d[_0xdbc9('0x95')](),_0x1580b5);})[_0xdbc9('0x29')](function(_0x1252cc){if(_0x1252cc[_0xdbc9('0x3f')]>0x0)_0x17dce6[_0xdbc9('0x42')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x1252cc,'id'));return db[_0xdbc9('0x94')][_0xdbc9('0x3c')](_0x17dce6['toString'](),_0x1580b5)[_0xdbc9('0x29')](function(_0x4336b0){var _0x108578=_['groupBy'](_0x4336b0,'WhatsappInteractionId');var _0x1f914b=[];_0x1252cc['forEach'](function(_0x92ae03){_0x1f914b[_0xdbc9('0x33')](updateWhatsappInteraction(_0x92ae03,_0xb04180,_0x108578));});return BPromise['all'](_0x1f914b);});});})[_0xdbc9('0x29')](function(_0x1ed4b3){_0x4ef55c[_0xdbc9('0xab')]=_0x1ed4b3;return _0x4ef55c;})[_0xdbc9('0x29')](respondWithFilteredResult(_0x3c2907,_0x2faaa7))[_0xdbc9('0xac')](handleError(_0x3c2907,null));};exports[_0xdbc9('0xad')]=function(_0x8172dd,_0x5ec4ae){var _0x36adb0={'raw':![],'where':{'id':_0x8172dd[_0xdbc9('0xae')]['id']}},_0x269c5f={};_0x269c5f[_0xdbc9('0x39')]=_['keys'](db['WhatsappInteraction'][_0xdbc9('0x36')]);_0x269c5f[_0xdbc9('0x3c')]=_[_0xdbc9('0x3a')](_0x8172dd[_0xdbc9('0x3c')]);_0x269c5f[_0xdbc9('0x3b')]=_[_0xdbc9('0xaf')](_0x269c5f[_0xdbc9('0x39')],_0x269c5f[_0xdbc9('0x3c')]);_0x36adb0['attributes']=_[_0xdbc9('0xaf')](_0x269c5f['model'],qs[_0xdbc9('0x3e')](_0x8172dd[_0xdbc9('0x3c')]['fields']));_0x36adb0[_0xdbc9('0x3d')]=_0x36adb0[_0xdbc9('0x3d')]['length']?_0x36adb0[_0xdbc9('0x3d')]:_0x269c5f[_0xdbc9('0x39')];if(_0x8172dd[_0xdbc9('0x3c')]['includeAll']){_0x36adb0[_0xdbc9('0xb0')]=[{'all':!![]}];}_0x36adb0=_[_0xdbc9('0x97')]({},_0x36adb0,_0x8172dd[_0xdbc9('0xb1')]);return db[_0xdbc9('0x35')][_0xdbc9('0x5e')](_0x36adb0)[_0xdbc9('0x29')](handleEntityNotFound(_0x5ec4ae,null))[_0xdbc9('0x29')](respondWithResult(_0x5ec4ae,null))['catch'](handleError(_0x5ec4ae,null));};exports[_0xdbc9('0xb2')]=function(_0x627e7d,_0x548b75){return db[_0xdbc9('0x35')][_0xdbc9('0xb2')](_0x627e7d[_0xdbc9('0x71')],{})[_0xdbc9('0x29')](respondWithResult(_0x548b75,0xc9))[_0xdbc9('0xac')](handleError(_0x548b75,null));};exports['update']=function(_0x185deb,_0x2daac3){if(_0x185deb['body']['id']){delete _0x185deb['body']['id'];}return db[_0xdbc9('0x35')][_0xdbc9('0x5e')]({'where':{'id':_0x185deb[_0xdbc9('0xae')]['id']}})['then'](handleEntityNotFound(_0x2daac3,null))[_0xdbc9('0x29')](saveUpdates(_0x185deb['body'],null))['then'](respondWithResult(_0x2daac3,null))['catch'](handleError(_0x2daac3,null));};exports['destroy']=function(_0x4be76f,_0x20c52c){return db[_0xdbc9('0x35')][_0xdbc9('0x5e')]({'where':{'id':_0x4be76f[_0xdbc9('0xae')]['id']}})['then'](handleEntityNotFound(_0x20c52c,null))['then'](removeEntity(_0x20c52c,null))[_0xdbc9('0xac')](handleError(_0x20c52c,null));};exports[_0xdbc9('0xb3')]=function(_0x1bc725,_0x3910d1){return db[_0xdbc9('0x35')][_0xdbc9('0xb3')]()[_0xdbc9('0x29')](respondWithResult(_0x3910d1,null))[_0xdbc9('0xac')](handleError(_0x3910d1,null));};exports[_0xdbc9('0xb4')]=function(_0x3ba685,_0x4a83d5,_0x4f4e57){return db[_0xdbc9('0xb5')]['find']({'where':{'id':_0x3ba685[_0xdbc9('0xae')]['id']}})['then'](handleEntityNotFound(_0x4a83d5,null))[_0xdbc9('0x29')](function(_0x180beb){if(_0x180beb){return _0x180beb[_0xdbc9('0xb4')](_0x3ba685[_0xdbc9('0x71')][_0xdbc9('0xb6')],_[_0xdbc9('0xb7')](_0x3ba685[_0xdbc9('0x71')],[_0xdbc9('0xb6'),'id'])||{});}})[_0xdbc9('0x29')](respondWithResult(_0x4a83d5,null))[_0xdbc9('0xac')](handleError(_0x4a83d5,null));};exports[_0xdbc9('0xb8')]=function(_0x5e1ce8,_0x341343,_0x5cc177){var _0x417115={'raw':![],'where':{}};var _0x5cf811={};var _0x5a303a={'count':0x0,'rows':[]};return db[_0xdbc9('0x35')][_0xdbc9('0xb9')]({'where':{'id':_0x5e1ce8[_0xdbc9('0xae')]['id']}})['then'](handleEntityNotFound(_0x341343,null))[_0xdbc9('0x29')](function(_0x1698c1){if(_0x1698c1){_0x5cf811['model']=_[_0xdbc9('0x3a')](db['WhatsappMessage'][_0xdbc9('0x36')]);_0x5cf811[_0xdbc9('0x3c')]=_[_0xdbc9('0x3a')](_0x5e1ce8[_0xdbc9('0x3c')]);_0x5cf811[_0xdbc9('0x3b')]=_[_0xdbc9('0xaf')](_0x5cf811[_0xdbc9('0x39')],_0x5cf811[_0xdbc9('0x3c')]);_0x417115[_0xdbc9('0x3d')]=_[_0xdbc9('0xaf')](_0x5cf811[_0xdbc9('0x39')],qs[_0xdbc9('0x3e')](_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0x3e')]));_0x417115['attributes']=_0x417115[_0xdbc9('0x3d')][_0xdbc9('0x3f')]?_0x417115[_0xdbc9('0x3d')]:_0x5cf811[_0xdbc9('0x39')];if(!_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0xba')](_0xdbc9('0x40'))){_0x417115[_0xdbc9('0x23')]=qs[_0xdbc9('0x23')](_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0x23')]);_0x417115[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0x20')]);}_0x417115[_0xdbc9('0x8b')]=qs[_0xdbc9('0x41')](_0x5e1ce8[_0xdbc9('0x3c')]['sort']);_0x417115['where']=qs[_0xdbc9('0x3b')](_[_0xdbc9('0x43')](_0x5e1ce8['query'],_0x5cf811[_0xdbc9('0x3b')]));_0x417115['where']['WhatsappInteractionId']=_0x1698c1['id'];if(_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0x82')]){_0x417115[_0xdbc9('0x42')]=_[_0xdbc9('0x97')](_0x417115[_0xdbc9('0x42')],{'$or':_[_0xdbc9('0x2f')](_0x417115[_0xdbc9('0x3d')],function(_0x4c752e){var _0xcd7bf1={};_0xcd7bf1[_0x4c752e]={'$like':'%'+_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0x82')]+'%'};return _0xcd7bf1;})});}if(_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0x77')]){var _0x4c2434=_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0x77')][_0xdbc9('0x31')](',');var _0x10a74c={};_0x10a74c[_0x4c2434[0x0]]={'$gte':moment(_0x4c2434[0x1])[_0xdbc9('0xbb')](_0xdbc9('0xbc'))};_0x417115[_0xdbc9('0x42')]=_['merge'](_0x417115[_0xdbc9('0x42')],_0x10a74c);}_0x417115=_[_0xdbc9('0x97')]({},_0x417115,_0x5e1ce8[_0xdbc9('0xb1')]);return db[_0xdbc9('0xb5')][_0xdbc9('0x22')]({'where':_0x417115['where']})['then'](function(_0x47048f){_0x5a303a[_0xdbc9('0x22')]=_0x47048f;if(_0x5e1ce8[_0xdbc9('0x3c')][_0xdbc9('0xbd')]){_0x417115[_0xdbc9('0xb0')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xdbc9('0xbe')](_0x417115);})[_0xdbc9('0x29')](function(_0x4814e3){_0x5a303a[_0xdbc9('0xab')]=_0x4814e3;return _0x5a303a;});}})[_0xdbc9('0x29')](respondWithFilteredResult(_0x341343,_0x417115))[_0xdbc9('0xac')](handleError(_0x341343,null));};exports['addTags']=function(_0x5d253f,_0x3501a7,_0x1635f2){return db[_0xdbc9('0x35')]['find']({'where':{'id':_0x5d253f['params']['id']}})[_0xdbc9('0x29')](handleEntityNotFound(_0x3501a7,null))['then'](function(_0x473b86){if(_0x473b86){return _0x473b86[_0xdbc9('0xbf')](_0x5d253f['body'][_0xdbc9('0xb6')],_[_0xdbc9('0xb7')](_0x5d253f[_0xdbc9('0x71')],[_0xdbc9('0xb6'),'id'])||{})[_0xdbc9('0xc0')](function(){return db[_0xdbc9('0x6a')][_0xdbc9('0xbe')]({'attributes':['id',_0xdbc9('0x2d'),'color'],'where':{'id':_0x5d253f[_0xdbc9('0x71')][_0xdbc9('0xb6')]}});})[_0xdbc9('0x29')](function(_0x555723){socket[_0xdbc9('0xc1')](_0xdbc9('0xc2'),{'id':Number(_0x5d253f[_0xdbc9('0xae')]['id']),'tags':_0x555723||[]});return{'id':Number(_0x5d253f[_0xdbc9('0xae')]['id']),'tags':_0x555723||[]};});}})[_0xdbc9('0x29')](respondWithResult(_0x3501a7,null))[_0xdbc9('0xac')](handleError(_0x3501a7,null));};exports[_0xdbc9('0xc3')]=function(_0x211dd3,_0x39a594,_0x4f8797){return db[_0xdbc9('0x35')][_0xdbc9('0x5e')]({'where':{'id':_0x211dd3['params']['id']}})[_0xdbc9('0x29')](handleEntityNotFound(_0x39a594,null))['then'](function(_0xb1467){if(_0xb1467){return _0xb1467[_0xdbc9('0xc3')](_0x211dd3[_0xdbc9('0x3c')]['ids']);}})[_0xdbc9('0x29')](respondWithStatusCode(_0x39a594,null))['catch'](handleError(_0x39a594,null));};exports[_0xdbc9('0xc4')]=function(_0x148585,_0x3b2c6){var _0x411347=moment()[_0xdbc9('0xc5')]()[_0xdbc9('0x95')]();var _0x36e2c7=path['join'](config[_0xdbc9('0xc6')],_0xdbc9('0xc7'),_0xdbc9('0xc8'),'tmp');var _0x4c68bf=path[_0xdbc9('0xc9')](config[_0xdbc9('0xc6')],_0xdbc9('0xc7'),_0xdbc9('0xc8'),_0xdbc9('0xca'));var _0x17dd84=path['join'](_0x36e2c7,_0x411347);var _0x3f6b06=util['format'](_0xdbc9('0xcb'),_0x148585[_0xdbc9('0xae')]['id'],_0x411347);var _0xd1bd3c=path['join'](_0x36e2c7,_0x3f6b06);var _0x4f18f7=[];_0x4f18f7[_0xdbc9('0x33')]({'model':db[_0xdbc9('0x6c')],'as':_0xdbc9('0x6c'),'attributes':['id',_0xdbc9('0xcc')],'raw':!![]});_0x4f18f7[_0xdbc9('0x33')]({'model':db[_0xdbc9('0xcd')],'as':_0xdbc9('0xce'),'attributes':['id','firstName',_0xdbc9('0xcf')],'raw':!![]});if(_0x148585['query'][_0xdbc9('0xca')]){_0x4f18f7[_0xdbc9('0x33')]({'model':db[_0xdbc9('0xd0')],'as':_0xdbc9('0xd0'),'raw':!![]});}var _0x28ef40=[{'model':db['WhatsappMessage'],'as':_0xdbc9('0xd1'),'attributes':['id',_0xdbc9('0x71'),_0xdbc9('0xd2'),_0xdbc9('0xd3'),_0xdbc9('0xd4'),_0xdbc9('0x7c')],'include':_0x4f18f7}];_0x28ef40[_0xdbc9('0x33')]({'model':db[_0xdbc9('0xd5')],'as':'Account','attributes':['id',_0xdbc9('0x2d')]});_0x28ef40[_0xdbc9('0x33')]({'model':db[_0xdbc9('0x6c')],'as':_0xdbc9('0xd6'),'attributes':['id',_0xdbc9('0xcc')]});return db[_0xdbc9('0x35')][_0xdbc9('0x5e')]({'where':{'id':_0x148585[_0xdbc9('0xae')]['id']},'include':_0x28ef40})['then'](handleEntityNotFound(_0x3b2c6,null))[_0xdbc9('0x29')](function(_0x581e14){if(_0x581e14){var _0x24b007=_0x581e14['get']({'plain':!![]});fs[_0xdbc9('0xd7')](_0x17dd84);var _0x4b8a94={'channel':_0xdbc9('0xd8'),'account':_0x24b007[_0xdbc9('0xd9')][_0xdbc9('0x2d')],'agent':_0x24b007['Owner']?_0x24b007['Owner'][_0xdbc9('0xcc')]:_0xdbc9('0xda'),'createdAt':moment(_0x24b007[_0xdbc9('0xd2')])[_0xdbc9('0xbb')](_0xdbc9('0xbc'))['toString'](),'closedAt':_0x24b007['closed']?moment(_0x24b007[_0xdbc9('0xdb')])[_0xdbc9('0xbb')](_0xdbc9('0xbc'))[_0xdbc9('0x95')]():'','disposition':_0x24b007[_0xdbc9('0xdc')],'messages':_(_0x24b007['Messages'])[_0xdbc9('0x82')]({'secret':![]})[_0xdbc9('0x2f')](function(_0x1b4e5b){if(_0x1b4e5b[_0xdbc9('0xd0')]){var _0x3f6ac9=path[_0xdbc9('0xc9')](_0x4c68bf,_0x1b4e5b['Attachment'][_0xdbc9('0xdd')]);if(fs[_0xdbc9('0xde')](_0x3f6ac9)){fs['createReadStream'](_0x3f6ac9)[_0xdbc9('0xdf')](fs[_0xdbc9('0xe0')](path[_0xdbc9('0xc9')](_0x17dd84,_0x1b4e5b['Attachment'][_0xdbc9('0xdd')])));}}return{'date':moment(_0x1b4e5b['createdAt'])['format'](_0xdbc9('0xbc'))[_0xdbc9('0x95')](),'sender':_0x1b4e5b['direction']===_0xdbc9('0xe1')?_0x1b4e5b[_0xdbc9('0x6c')]?_0x1b4e5b['User'][_0xdbc9('0xcc')]:_0xdbc9('0xe2'):_0x1b4e5b[_0xdbc9('0xce')][_0xdbc9('0xe3')]+(_0x1b4e5b[_0xdbc9('0xce')][_0xdbc9('0xcf')]?'\x20'+_0x1b4e5b[_0xdbc9('0xce')][_0xdbc9('0xcf')]:''),'body':_0x1b4e5b['Attachment']?_0x1b4e5b[_0xdbc9('0xd0')][_0xdbc9('0xdd')]:_0x1b4e5b['body'],'direction':_0x1b4e5b['direction']===_0xdbc9('0xe1')?'A':'C','secret':_0x1b4e5b[_0xdbc9('0xd4')],'read':_0x1b4e5b[_0xdbc9('0x7c')],'attachment':_0x1b4e5b[_0xdbc9('0xd0')]};})[_0xdbc9('0x60')]()};return ejs[_0xdbc9('0xe4')](path['join'](config[_0xdbc9('0xc6')],_0xdbc9('0xc7'),_0xdbc9('0xe5'),_0xdbc9('0xe6')),{'interaction':_0x4b8a94})[_0xdbc9('0x29')](function(_0x7556f0){var _0x1ad796=path['join'](_0x17dd84,_0xdbc9('0xe7')+_0x24b007['id']+'-'+_0x411347+_0xdbc9('0xe8'));var _0x434bd3={'path':_0x1ad796,'channel':_0xdbc9('0xd8'),'interactionId':_0x24b007['id']};return pdf[_0xdbc9('0xe9')](_0x7556f0,_0x434bd3);})['then'](function(){return new BPromise(function(_0x2992f2,_0x353c55){zipdir(_0x17dd84,{'saveTo':_0xd1bd3c},function(_0x5d8fbe,_0x11f311){if(_0x5d8fbe)return _0x353c55(_0x5d8fbe);return _0x2992f2(_0x11f311);});})[_0xdbc9('0x29')](function(){return new BPromise(function(_0x498745,_0x38eefa){rimraf(_0x17dd84,function(_0x52821e){if(_0x52821e)_0x38eefa(_0x52821e);return _0x498745();});});})[_0xdbc9('0x29')](function(){return _0x3b2c6[_0xdbc9('0xc4')](_0xd1bd3c,_0x3f6b06,function(_0x56dbaf){if(_0x56dbaf){console[_0xdbc9('0xea')](_0xdbc9('0xeb'),_0x56dbaf);}else{fs[_0xdbc9('0xec')](_0xd1bd3c);}});});});}else{return _0x3b2c6[_0xdbc9('0x1c')](0xc8);}})[_0xdbc9('0xac')](handleError(_0x3b2c6,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b9f2fd2..355c531 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 _0xa249=['emit','catch','hook','events','../../mysqldb','WhatsappMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x2bff8d,_0x50c67f){var _0x28ac21=function(_0x2ab452){while(--_0x2ab452){_0x2bff8d['push'](_0x2bff8d['shift']());}};_0x28ac21(++_0x50c67f);}(_0xa249,0x183));var _0x9a24=function(_0x1a07f1,_0x563e18){_0x1a07f1=_0x1a07f1-0x0;var _0x51bc64=_0xa249[_0x1a07f1];return _0x51bc64;};'use strict';var EventEmitter=require(_0x9a24('0x0'));var WhatsappInteraction=require(_0x9a24('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x9a24('0x1'))['db'][_0x9a24('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a24('0x3'),'afterUpdate':'update','afterDestroy':_0x9a24('0x4')};function emitEvent(_0x48c56d){return function(_0x558c9a,_0x5c2f56,_0x1b0728){_0x558c9a[_0x9a24('0x5')]({'attributes':['id'],'raw':!![]})[_0x9a24('0x6')](function(_0x3e35b5){_0x558c9a[_0x9a24('0x7')](_0x9a24('0x8'),_0x3e35b5[_0x9a24('0x9')](function(_0x625ec3){return{'id':_0x625ec3['id']};}));return WhatsappMessage[_0x9a24('0xa')]({'where':{'WhatsappInteractionId':_0x558c9a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a24('0x6')](function(_0x543676){_0x558c9a['setDataValue'](_0x9a24('0xb'),_0x543676[_0x9a24('0xc')]);WhatsappInteractionEvents[_0x9a24('0xd')](_0x48c56d+':'+_0x558c9a['id'],_0x558c9a);WhatsappInteractionEvents['emit'](_0x48c56d,_0x558c9a);_0x1b0728(null);})[_0x9a24('0xe')](_0x1b0728(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x9a24('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xd624=['update','remove','setDataValue','Users','map','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5e1242,_0x4349d8){var _0x1bfe2d=function(_0x69470f){while(--_0x69470f){_0x5e1242['push'](_0x5e1242['shift']());}};_0x1bfe2d(++_0x4349d8);}(_0xd624,0x124));var _0x4d62=function(_0x32c0c4,_0x4b1f85){_0x32c0c4=_0x32c0c4-0x0;var _0x3d8ab2=_0xd624[_0x32c0c4];return _0x3d8ab2;};'use strict';var EventEmitter=require(_0x4d62('0x0'));var WhatsappInteraction=require(_0x4d62('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4d62('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d62('0x2'),'afterDestroy':_0x4d62('0x3')};function emitEvent(_0x231932){return function(_0x1a7587,_0x311462,_0x2582df){_0x1a7587['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x133d24){_0x1a7587[_0x4d62('0x4')](_0x4d62('0x5'),_0x133d24[_0x4d62('0x6')](function(_0xa80583){return{'id':_0xa80583['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1a7587['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d62('0x7')](function(_0x62e82e){_0x1a7587[_0x4d62('0x4')](_0x4d62('0x8'),_0x62e82e['length']);WhatsappInteractionEvents[_0x4d62('0x9')](_0x231932+':'+_0x1a7587['id'],_0x1a7587);WhatsappInteractionEvents[_0x4d62('0x9')](_0x231932,_0x1a7587);_0x2582df(null);})[_0x4d62('0xa')](_0x2582df(null));};}for(var e in events){if(events[_0x4d62('0xb')](e)){var event=events[e];WhatsappInteraction[_0x4d62('0xc')](e,emitEvent(event));}}module[_0x4d62('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 308e81f..03bcbeb 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 _0xcf3d=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x54315c,_0x1317c1){_0x54315c=_0x54315c-0x0;var _0x2bb000=_0xcf3d[_0x54315c];return _0x2bb000;};'use strict';var _=require(_0xdcf3('0x0'));var util=require(_0xdcf3('0x1'));var logger=require(_0xdcf3('0x2'))(_0xdcf3('0x3'));var moment=require('moment');var BPromise=require(_0xdcf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcf3('0x5'));var rimraf=require(_0xdcf3('0x6'));var config=require(_0xdcf3('0x7'));var attributes=require(_0xdcf3('0x8'));module[_0xdcf3('0x9')]=function(_0xfcfc09,_0x53e97c){return _0xfcfc09[_0xdcf3('0xa')]('WhatsappInteraction',attributes,{'tableName':_0xdcf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45c5bd,_0x55fe3a,_0x560771){if(_0x45c5bd['changed'](_0xdcf3('0xc'))){_0x45c5bd[_0xdcf3('0xd')]=moment()[_0xdcf3('0xe')](_0xdcf3('0xf'));}_0x560771(null,_0x45c5bd);}}});}; \ No newline at end of file +var _0x79c7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','changed','closedAt'];(function(_0x55991b,_0x4c78c0){var _0x4b884d=function(_0xfff7a7){while(--_0xfff7a7){_0x55991b['push'](_0x55991b['shift']());}};_0x4b884d(++_0x4c78c0);}(_0x79c7,0x1ad));var _0x779c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x79c7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x779c('0x0'))(_0x779c('0x1'));var moment=require(_0x779c('0x2'));var BPromise=require(_0x779c('0x3'));var rp=require(_0x779c('0x4'));var fs=require('fs');var path=require(_0x779c('0x5'));var rimraf=require(_0x779c('0x6'));var config=require(_0x779c('0x7'));var attributes=require(_0x779c('0x8'));module[_0x779c('0x9')]=function(_0xe19444,_0xce57b3){return _0xe19444[_0x779c('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x113d5d,_0x2ac785,_0x379283){if(_0x113d5d[_0x779c('0xb')]('closed')){_0x113d5d[_0x779c('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x379283(null,_0x113d5d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d3f004e..70f8d7b 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 _0xa009=['catch','WhatsappInteraction','update','body','options','where','attributes','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','then','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xe318fe,_0x514d16){var _0x45a207=function(_0x325299){while(--_0x325299){_0xe318fe['push'](_0xe318fe['shift']());}};_0x45a207(++_0x514d16);}(_0xa009,0x64));var _0x9a00=function(_0x260f23,_0x2d90ee){_0x260f23=_0x260f23-0x0;var _0x222dc1=_0xa009[_0x260f23];return _0x222dc1;};'use strict';var _=require(_0x9a00('0x0'));var util=require(_0x9a00('0x1'));var moment=require(_0x9a00('0x2'));var BPromise=require(_0x9a00('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a00('0x4'))['db'];var utils=require(_0x9a00('0x5'));var logger=require('../../config/logger')(_0x9a00('0x6'));var config=require(_0x9a00('0x7'));var jayson=require(_0x9a00('0x8'));var client=jayson[_0x9a00('0x9')][_0x9a00('0xa')]({'port':0x232a});config['redis']=_[_0x9a00('0xb')](config[_0x9a00('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a00('0xd'))(new Redis(config[_0x9a00('0xc')]));require(_0x9a00('0xe'))[_0x9a00('0xf')](socket);function respondWithRpcPromise(_0x5432c3,_0x510702,_0x3f27d1){return new BPromise(function(_0x574687,_0x3f2694){return client['request'](_0x5432c3,_0x3f27d1)['then'](function(_0x596243){logger[_0x9a00('0x10')](_0x9a00('0x11'),_0x510702,_0x9a00('0x12'));logger[_0x9a00('0x13')](_0x9a00('0x14'),_0x510702,_0x9a00('0x12'),JSON[_0x9a00('0x15')](_0x596243));if(_0x596243[_0x9a00('0x16')]){if(_0x596243['error'][_0x9a00('0x17')]===0x1f4){logger[_0x9a00('0x16')](_0x9a00('0x11'),_0x510702,_0x596243[_0x9a00('0x16')][_0x9a00('0x18')]);return _0x3f2694(_0x596243[_0x9a00('0x16')][_0x9a00('0x18')]);}logger['error'](_0x9a00('0x11'),_0x510702,_0x596243[_0x9a00('0x16')]['message']);return _0x574687(_0x596243['error'][_0x9a00('0x18')]);}else{logger[_0x9a00('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x510702,_0x9a00('0x12'));_0x574687(_0x596243[_0x9a00('0x19')][_0x9a00('0x18')]);}})[_0x9a00('0x1a')](function(_0x24efd3){logger['error'](_0x9a00('0x11'),_0x510702,_0x24efd3);_0x3f2694(_0x24efd3);});});}exports['UpdateWhatsappInteraction']=function(_0x46d4be){var _0x55e86d=this;return new Promise(function(_0x82bd41,_0x4c03d2){return db[_0x9a00('0x1b')][_0x9a00('0x1c')](_0x46d4be[_0x9a00('0x1d')],{'raw':_0x46d4be[_0x9a00('0x1e')]?_0x46d4be[_0x9a00('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d4be['options']?_0x46d4be[_0x9a00('0x1e')][_0x9a00('0x1f')]||null:null,'attributes':_0x46d4be['options']?_0x46d4be[_0x9a00('0x1e')][_0x9a00('0x20')]||null:null,'limit':_0x46d4be[_0x9a00('0x1e')]?_0x46d4be[_0x9a00('0x1e')]['limit']||null:null})['then'](function(_0x456ef9){logger['info'](_0x9a00('0x21'),_0x46d4be);logger[_0x9a00('0x13')](_0x9a00('0x21'),_0x46d4be,JSON[_0x9a00('0x15')](_0x456ef9));_0x82bd41(_0x456ef9);})['catch'](function(_0x3f7fbf){logger[_0x9a00('0x16')](_0x9a00('0x21'),_0x3f7fbf[_0x9a00('0x18')],_0x46d4be);_0x4c03d2(_0x55e86d[_0x9a00('0x16')](0x1f4,_0x3f7fbf[_0x9a00('0x18')]));});});};exports[_0x9a00('0x22')]=function(_0x50de42){return new Promise(function(_0x382602,_0x2ef4eb){return db[_0x9a00('0x1b')][_0x9a00('0x23')]({'where':_0x50de42[_0x9a00('0x1e')]?_0x50de42['options'][_0x9a00('0x1f')]||null:null})[_0x9a00('0x24')](function(_0x3f7f77){if(_0x3f7f77){return _0x3f7f77[_0x9a00('0x25')](_0x50de42[_0x9a00('0x1d')]['ids'],_[_0x9a00('0x26')](_0x50de42['body'],[_0x9a00('0x27'),'id'])||{});}})[_0x9a00('0x28')](function(_0x218891){logger[_0x9a00('0x10')](_0x9a00('0x29'),_0x50de42);logger[_0x9a00('0x13')]('AddTags',_0x50de42,JSON[_0x9a00('0x15')](_0x218891));_0x382602(_0x218891);})[_0x9a00('0x1a')](function(_0x552352){logger['error'](_0x9a00('0x29'),_0x552352[_0x9a00('0x18')],_0x50de42);_0x2ef4eb(_this[_0x9a00('0x16')](0x1f4,_0x552352[_0x9a00('0x18')]));});});}; \ No newline at end of file +var _0x0dcc=['attributes','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where'];(function(_0x38911a,_0x25b580){var _0x121391=function(_0x44bd81){while(--_0x44bd81){_0x38911a['push'](_0x38911a['shift']());}};_0x121391(++_0x25b580);}(_0x0dcc,0xb8));var _0xc0dc=function(_0x21558c,_0x28f368){_0x21558c=_0x21558c-0x0;var _0x6b6201=_0x0dcc[_0x21558c];return _0x6b6201;};'use strict';var _=require(_0xc0dc('0x0'));var util=require(_0xc0dc('0x1'));var moment=require(_0xc0dc('0x2'));var BPromise=require(_0xc0dc('0x3'));var rs=require(_0xc0dc('0x4'));var fs=require('fs');var Redis=require(_0xc0dc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0dc('0x6'));var logger=require(_0xc0dc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc0dc('0x8'));var client=jayson[_0xc0dc('0x9')][_0xc0dc('0xa')]({'port':0x232a});config[_0xc0dc('0xb')]=_[_0xc0dc('0xc')](config[_0xc0dc('0xb')],{'host':_0xc0dc('0xd'),'port':0x18eb});var socket=require(_0xc0dc('0xe'))(new Redis(config[_0xc0dc('0xb')]));require(_0xc0dc('0xf'))[_0xc0dc('0x10')](socket);function respondWithRpcPromise(_0x502947,_0x2503b1,_0x4f5b6d){return new BPromise(function(_0x1206f8,_0x2c4015){return client[_0xc0dc('0x11')](_0x502947,_0x4f5b6d)[_0xc0dc('0x12')](function(_0x3dab12){logger[_0xc0dc('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x2503b1,_0xc0dc('0x14'));logger[_0xc0dc('0x15')](_0xc0dc('0x16'),_0x2503b1,'request\x20sent',JSON[_0xc0dc('0x17')](_0x3dab12));if(_0x3dab12[_0xc0dc('0x18')]){if(_0x3dab12[_0xc0dc('0x18')][_0xc0dc('0x19')]===0x1f4){logger['error'](_0xc0dc('0x1a'),_0x2503b1,_0x3dab12[_0xc0dc('0x18')][_0xc0dc('0x1b')]);return _0x2c4015(_0x3dab12['error'][_0xc0dc('0x1b')]);}logger[_0xc0dc('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x2503b1,_0x3dab12[_0xc0dc('0x18')][_0xc0dc('0x1b')]);return _0x1206f8(_0x3dab12[_0xc0dc('0x18')][_0xc0dc('0x1b')]);}else{logger['info'](_0xc0dc('0x1a'),_0x2503b1,'request\x20sent');_0x1206f8(_0x3dab12[_0xc0dc('0x1c')][_0xc0dc('0x1b')]);}})[_0xc0dc('0x1d')](function(_0x2518b0){logger[_0xc0dc('0x18')](_0xc0dc('0x1a'),_0x2503b1,_0x2518b0);_0x2c4015(_0x2518b0);});});}exports[_0xc0dc('0x1e')]=function(_0x22b6b0){var _0x559d59=this;return new Promise(function(_0x453989,_0xc4e4ef){return db['WhatsappInteraction'][_0xc0dc('0x1f')](_0x22b6b0[_0xc0dc('0x20')],{'raw':_0x22b6b0[_0xc0dc('0x21')]?_0x22b6b0['options'][_0xc0dc('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22b6b0['options']?_0x22b6b0[_0xc0dc('0x21')][_0xc0dc('0x23')]||null:null,'attributes':_0x22b6b0[_0xc0dc('0x21')]?_0x22b6b0['options'][_0xc0dc('0x24')]||null:null,'limit':_0x22b6b0[_0xc0dc('0x21')]?_0x22b6b0['options']['limit']||null:null})[_0xc0dc('0x12')](function(_0x587cfd){logger[_0xc0dc('0x13')]('UpdateWhatsappInteraction',_0x22b6b0);logger[_0xc0dc('0x15')](_0xc0dc('0x1e'),_0x22b6b0,JSON[_0xc0dc('0x17')](_0x587cfd));_0x453989(_0x587cfd);})[_0xc0dc('0x1d')](function(_0x46eba7){logger[_0xc0dc('0x18')](_0xc0dc('0x1e'),_0x46eba7[_0xc0dc('0x1b')],_0x22b6b0);_0xc4e4ef(_0x559d59[_0xc0dc('0x18')](0x1f4,_0x46eba7[_0xc0dc('0x1b')]));});});};exports[_0xc0dc('0x25')]=function(_0x58e397){return new Promise(function(_0x3020ea,_0x47a558){return db['WhatsappInteraction'][_0xc0dc('0x26')]({'where':_0x58e397[_0xc0dc('0x21')]?_0x58e397['options']['where']||null:null})[_0xc0dc('0x12')](function(_0x57e19e){if(_0x57e19e){return _0x57e19e[_0xc0dc('0x27')](_0x58e397[_0xc0dc('0x20')]['ids'],_[_0xc0dc('0x28')](_0x58e397['body'],[_0xc0dc('0x29'),'id'])||{});}})[_0xc0dc('0x2a')](function(_0x35a342){logger[_0xc0dc('0x13')](_0xc0dc('0x2b'),_0x58e397);logger[_0xc0dc('0x15')]('AddTags',_0x58e397,JSON[_0xc0dc('0x17')](_0x35a342));_0x3020ea(_0x35a342);})[_0xc0dc('0x1d')](function(_0xf09a88){logger[_0xc0dc('0x18')](_0xc0dc('0x2b'),_0xf09a88[_0xc0dc('0x1b')],_0x58e397);_0x47a558(_this['error'](0x1f4,_0xf09a88[_0xc0dc('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5221f5e..1f329b8 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 _0x3f6c=['whatsappInteraction:','./whatsappInteraction.events','save','register'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x3f6c,0xe1));var _0xc3f6=function(_0x122540,_0x344b1b){_0x122540=_0x122540-0x0;var _0x1e8cde=_0x3f6c[_0x122540];return _0x1e8cde;};'use strict';var WhatsappInteractionEvents=require(_0xc3f6('0x0'));var events=[_0xc3f6('0x1'),'remove','update'];function createListener(_0x334d19,_0x35089a){return function(_0x177be9){_0x35089a['emit'](_0x334d19,_0x177be9);};}function removeListener(_0x51795c,_0x246bad){return function(){WhatsappInteractionEvents['removeListener'](_0x51795c,_0x246bad);};}exports[_0xc3f6('0x2')]=function(_0x398a1d){for(var _0x5199d9=0x0,_0x5149b1=events['length'];_0x5199d9<_0x5149b1;_0x5199d9++){var _0x3bb546=events[_0x5199d9];var _0x1a7d65=createListener(_0xc3f6('0x3')+_0x3bb546,_0x398a1d);WhatsappInteractionEvents['on'](_0x3bb546,_0x1a7d65);}}; \ No newline at end of file +var _0xc4c8=['whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x25c4fa,_0x5689b2){var _0x20f2ec=function(_0x58f844){while(--_0x58f844){_0x25c4fa['push'](_0x25c4fa['shift']());}};_0x20f2ec(++_0x5689b2);}(_0xc4c8,0x1b1));var _0x8c4c=function(_0x227e39,_0x482d65){_0x227e39=_0x227e39-0x0;var _0x546c40=_0xc4c8[_0x227e39];return _0x546c40;};'use strict';var WhatsappInteractionEvents=require(_0x8c4c('0x0'));var events=[_0x8c4c('0x1'),_0x8c4c('0x2'),'update'];function createListener(_0x38fabe,_0x42ca5f){return function(_0xa87319){_0x42ca5f[_0x8c4c('0x3')](_0x38fabe,_0xa87319);};}function removeListener(_0x48a0eb,_0xad3f53){return function(){WhatsappInteractionEvents[_0x8c4c('0x4')](_0x48a0eb,_0xad3f53);};}exports[_0x8c4c('0x5')]=function(_0x3b900b){for(var _0x4a6255=0x0,_0x529386=events[_0x8c4c('0x6')];_0x4a6255<_0x529386;_0x4a6255++){var _0x5368dd=events[_0x4a6255];var _0xd8c777=createListener(_0x8c4c('0x7')+_0x5368dd,_0x3b900b);WhatsappInteractionEvents['on'](_0x5368dd,_0xd8c777);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2efa31c..13d5656 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 _0x9e3b=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','whatsapp','create','status','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e3b,0x73));var _0xb9e3=function(_0x4e5b09,_0x55a771){_0x4e5b09=_0x4e5b09-0x0;var _0x3b25c3=_0x9e3b[_0x4e5b09];return _0x3b25c3;};'use strict';var multer=require(_0xb9e3('0x0'));var util=require(_0xb9e3('0x1'));var path=require(_0xb9e3('0x2'));var timeout=require(_0xb9e3('0x3'));var express=require(_0xb9e3('0x4'));var router=express['Router']();var fs_extra=require(_0xb9e3('0x5'));var auth=require(_0xb9e3('0x6'));var interaction=require(_0xb9e3('0x7'));var config=require('../../config/environment');var controller=require(_0xb9e3('0x8'));router[_0xb9e3('0x9')]('/',auth[_0xb9e3('0xa')](),controller[_0xb9e3('0xb')]);router[_0xb9e3('0x9')](_0xb9e3('0xc'),auth[_0xb9e3('0xa')](),controller['describe']);router[_0xb9e3('0x9')](_0xb9e3('0xd'),auth[_0xb9e3('0xa')](),controller[_0xb9e3('0xe')]);router[_0xb9e3('0xf')]('/',auth[_0xb9e3('0xa')](),interaction['tracked'](_0xb9e3('0x10'),'whatsappmessage:create'),controller[_0xb9e3('0x11')]);router['post']('/:id/status',controller[_0xb9e3('0x12')]);router[_0xb9e3('0x13')](_0xb9e3('0xd'),auth[_0xb9e3('0xa')](),controller[_0xb9e3('0x14')]);router[_0xb9e3('0x13')](_0xb9e3('0x15'),auth[_0xb9e3('0xa')](),controller[_0xb9e3('0x16')]);router['put'](_0xb9e3('0x17'),auth[_0xb9e3('0xa')](),controller[_0xb9e3('0x18')]);router[_0xb9e3('0x19')](_0xb9e3('0xd'),auth[_0xb9e3('0xa')](),controller[_0xb9e3('0x1a')]);module[_0xb9e3('0x1b')]=router; \ No newline at end of file +var _0x6288=['isAuthenticated','index','/describe','describe','get','show','post','tracked','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','/:id','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x2a0034,_0x51c1a1){var _0x55c1b0=function(_0x349508){while(--_0x349508){_0x2a0034['push'](_0x2a0034['shift']());}};_0x55c1b0(++_0x51c1a1);}(_0x6288,0x147));var _0x8628=function(_0x350796,_0x1bf21f){_0x350796=_0x350796-0x0;var _0x126f19=_0x6288[_0x350796];return _0x126f19;};'use strict';var multer=require(_0x8628('0x0'));var util=require('util');var path=require(_0x8628('0x1'));var timeout=require('connect-timeout');var express=require(_0x8628('0x2'));var router=express[_0x8628('0x3')]();var fs_extra=require(_0x8628('0x4'));var auth=require(_0x8628('0x5'));var interaction=require(_0x8628('0x6'));var config=require(_0x8628('0x7'));var controller=require(_0x8628('0x8'));router['get']('/',auth[_0x8628('0x9')](),controller[_0x8628('0xa')]);router['get'](_0x8628('0xb'),auth['isAuthenticated'](),controller[_0x8628('0xc')]);router[_0x8628('0xd')]('/:id',auth[_0x8628('0x9')](),controller[_0x8628('0xe')]);router[_0x8628('0xf')]('/',auth['isAuthenticated'](),interaction[_0x8628('0x10')]('whatsapp',_0x8628('0x11')),controller['create']);router[_0x8628('0xf')](_0x8628('0x12'),controller[_0x8628('0x13')]);router[_0x8628('0x14')]('/:id',auth[_0x8628('0x9')](),controller[_0x8628('0x15')]);router[_0x8628('0x14')](_0x8628('0x16'),auth[_0x8628('0x9')](),controller[_0x8628('0x17')]);router[_0x8628('0x14')](_0x8628('0x18'),auth[_0x8628('0x9')](),controller[_0x8628('0x19')]);router['delete'](_0x8628('0x1a'),auth[_0x8628('0x9')](),controller['destroy']);module[_0x8628('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index d4422c9..46758a5 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 _0xc75a=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT'];(function(_0x56fa4c,_0x438249){var _0x3b6ba8=function(_0x5e4ac6){while(--_0x5e4ac6){_0x56fa4c['push'](_0x56fa4c['shift']());}};_0x3b6ba8(++_0x438249);}(_0xc75a,0xeb));var _0xac75=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0xc75a[_0x329664];return _0x4e346e;};'use strict';var Sequelize=require(_0xac75('0x0'));module[_0xac75('0x1')]={'body':{'type':Sequelize[_0xac75('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xac75('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xac75('0x4')](0xbe)},'phone':{'type':Sequelize[_0xac75('0x4')]},'readAt':{'type':Sequelize[_0xac75('0x5')]},'secret':{'type':Sequelize[_0xac75('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xac75('0x4')]},'providerResponse':{'type':Sequelize[_0xac75('0x2')]}}; \ No newline at end of file +var _0x6355=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x53deaa,_0x10643e){var _0x24bbe4=function(_0xb36e17){while(--_0xb36e17){_0x53deaa['push'](_0x53deaa['shift']());}};_0x24bbe4(++_0x10643e);}(_0x6355,0x16c));var _0x5635=function(_0x1edde8,_0x574e41){_0x1edde8=_0x1edde8-0x0;var _0x2cb06a=_0x6355[_0x1edde8];return _0x2cb06a;};'use strict';var Sequelize=require(_0x5635('0x0'));module[_0x5635('0x1')]={'body':{'type':Sequelize[_0x5635('0x2')](_0x5635('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5635('0x4')]('in','out'),'defaultValue':_0x5635('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5635('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5635('0x6')]},'readAt':{'type':Sequelize[_0x5635('0x7')]},'secret':{'type':Sequelize[_0x5635('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5635('0x6')]},'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 2dd026d..33b2f27 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 _0xe54d=['whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SIP/%s','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','fast-json-patch','moment','bluebird','util','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','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','WhatsappMessage','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','includeAll','include','show','filters','intersection','merge','options','find','create','body','params','describe','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe54d,0xbe));var _0xde54=function(_0x326fb5,_0x1255c3){_0x326fb5=_0x326fb5-0x0;var _0x3c821b=_0xe54d[_0x326fb5];return _0x3c821b;};'use strict';var emlformat=require(_0xde54('0x0'));var rimraf=require(_0xde54('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde54('0x2'));var rp=require('request-promise');var moment=require(_0xde54('0x3'));var BPromise=require(_0xde54('0x4'));var Mustache=require('mustache');var util=require(_0xde54('0x5'));var path=require(_0xde54('0x6'));var sox=require(_0xde54('0x7'));var csv=require(_0xde54('0x8'));var ejs=require(_0xde54('0x9'));var fs=require('fs');var fs_extra=require(_0xde54('0xa'));var _=require(_0xde54('0xb'));var squel=require(_0xde54('0xc'));var crypto=require(_0xde54('0xd'));var jsforce=require(_0xde54('0xe'));var deskjs=require(_0xde54('0xf'));var toCsv=require(_0xde54('0x8'));var querystring=require('querystring');var Papa=require(_0xde54('0x10'));var Redis=require(_0xde54('0x11'));var authService=require(_0xde54('0x12'));var qs=require(_0xde54('0x13'));var as=require(_0xde54('0x14'));var hardwareService=require(_0xde54('0x15'));var logger=require('../../config/logger')(_0xde54('0x16'));var utils=require(_0xde54('0x17'));var config=require(_0xde54('0x18'));var licenseUtil=require(_0xde54('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xde54('0x1a')](config[_0xde54('0x1b')],{'host':_0xde54('0x1c'),'port':0x18eb});var socket=require(_0xde54('0x1d'))(new Redis(config['redis']));require(_0xde54('0x1e'))[_0xde54('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xde54('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0xde54('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x211141,_0x46aac8,_0x123593,_0x25f0bd){return new BPromise(function(_0x13b48b,_0x494739){var _0x14dd1c=_0x25f0bd||client;return _0x14dd1c[_0xde54('0x22')](_0x211141,_0x123593)[_0xde54('0x23')](function(_0x885f79){logger[_0xde54('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x46aac8,_0xde54('0x25'));logger[_0xde54('0x26')](_0xde54('0x27'),_0x46aac8,_0xde54('0x25'),JSON[_0xde54('0x28')](_0x885f79));if(_0x885f79[_0xde54('0x29')]){if(_0x885f79['error']['code']===0x1f4){logger[_0xde54('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x46aac8,_0x885f79[_0xde54('0x29')][_0xde54('0x2a')]);return _0x494739(_0x885f79[_0xde54('0x29')][_0xde54('0x2a')]);}logger['error'](_0xde54('0x2b'),_0x46aac8,_0x885f79[_0xde54('0x29')][_0xde54('0x2a')]);return _0x13b48b(_0x885f79[_0xde54('0x29')]['message']);}else{logger[_0xde54('0x24')](_0xde54('0x2b'),_0x46aac8,_0xde54('0x25'));_0x13b48b(_0x885f79[_0xde54('0x2c')][_0xde54('0x2a')]);}})[_0xde54('0x2d')](function(_0x38e648){logger[_0xde54('0x29')](_0xde54('0x2b'),_0x46aac8,_0x38e648);_0x494739(_0x38e648);});});}function respondWithStatusCode(_0x3e6e2a,_0x2558f7){_0x2558f7=_0x2558f7||0xcc;return function(_0x46be5e){if(_0x46be5e){return _0x3e6e2a[_0xde54('0x2e')](_0x2558f7);}return _0x3e6e2a[_0xde54('0x2f')](_0x2558f7)['end']();};}function respondWithResult(_0x507bad,_0x183c5e){_0x183c5e=_0x183c5e||0xc8;return function(_0xaf207c){if(_0xaf207c){return _0x507bad[_0xde54('0x2f')](_0x183c5e)[_0xde54('0x30')](_0xaf207c);}};}function respondWithFilteredResult(_0x33d681,_0x48ca1f){return function(_0x46fdbd){if(_0x46fdbd){var _0x4545f8=typeof _0x48ca1f['offset']==='undefined'&&typeof _0x48ca1f['limit']===_0xde54('0x31');var _0x70be46=_0x46fdbd[_0xde54('0x32')];var _0x123983=_0x4545f8?0x0:_0x48ca1f[_0xde54('0x33')];var _0x54dc62=_0x4545f8?_0x46fdbd[_0xde54('0x32')]:_0x48ca1f['offset']+_0x48ca1f[_0xde54('0x34')];var _0x227763;if(_0x54dc62>=_0x70be46){_0x54dc62=_0x70be46;_0x227763=0xc8;}else{_0x227763=0xce;}_0x33d681[_0xde54('0x2f')](_0x227763);return _0x33d681[_0xde54('0x35')](_0xde54('0x36'),_0x123983+'-'+_0x54dc62+'/'+_0x70be46)[_0xde54('0x30')](_0x46fdbd);}return null;};}function patchUpdates(_0x3fbfac){return function(_0x2e0018){try{jsonpatch[_0xde54('0x37')](_0x2e0018,_0x3fbfac,!![]);}catch(_0x41e681){return BPromise[_0xde54('0x38')](_0x41e681);}return _0x2e0018[_0xde54('0x39')]();};}function saveUpdates(_0x25c63c,_0x9e3069){return function(_0x30a1aa){if(_0x30a1aa){return _0x30a1aa[_0xde54('0x3a')](_0x25c63c)[_0xde54('0x23')](function(_0x1c3632){return _0x1c3632;});}return null;};}function removeEntity(_0xceee03,_0x22dc2f){return function(_0x23963c){if(_0x23963c){return _0x23963c[_0xde54('0x3b')]()['then'](function(){_0xceee03[_0xde54('0x2f')](0xcc)[_0xde54('0x3c')]();});}};}function handleEntityNotFound(_0x473cc1,_0xcecfe9){return function(_0x4b6bd5){if(!_0x4b6bd5){_0x473cc1[_0xde54('0x2e')](0x194);}return _0x4b6bd5;};}function handleError(_0x4fbd62,_0xb18bd8){_0xb18bd8=_0xb18bd8||0x1f4;return function(_0x39119b){logger['error'](_0x39119b[_0xde54('0x3d')]);if(_0x39119b[_0xde54('0x3e')]){delete _0x39119b[_0xde54('0x3e')];}_0x4fbd62[_0xde54('0x2f')](_0xb18bd8)[_0xde54('0x3f')](_0x39119b);};}exports[_0xde54('0x40')]=function(_0x1e3368,_0xcbadd2){var _0x3440cd={},_0x28ca44={},_0x7bea90={'count':0x0,'rows':[]};var _0x1a21ea=_[_0xde54('0x41')](db[_0xde54('0x42')]['rawAttributes'],function(_0x212117){return{'name':_0x212117[_0xde54('0x43')],'type':_0x212117['type'][_0xde54('0x44')]};});_0x28ca44[_0xde54('0x45')]=_[_0xde54('0x41')](_0x1a21ea,_0xde54('0x3e'));_0x28ca44[_0xde54('0x46')]=_[_0xde54('0x47')](_0x1e3368[_0xde54('0x46')]);_0x28ca44['filters']=_['intersection'](_0x28ca44[_0xde54('0x45')],_0x28ca44[_0xde54('0x46')]);_0x3440cd[_0xde54('0x48')]=_['intersection'](_0x28ca44[_0xde54('0x45')],qs[_0xde54('0x49')](_0x1e3368[_0xde54('0x46')][_0xde54('0x49')]));_0x3440cd[_0xde54('0x48')]=_0x3440cd[_0xde54('0x48')][_0xde54('0x4a')]?_0x3440cd[_0xde54('0x48')]:_0x28ca44[_0xde54('0x45')];if(!_0x1e3368[_0xde54('0x46')][_0xde54('0x4b')](_0xde54('0x4c'))){_0x3440cd[_0xde54('0x34')]=qs[_0xde54('0x34')](_0x1e3368[_0xde54('0x46')][_0xde54('0x34')]);_0x3440cd[_0xde54('0x33')]=qs[_0xde54('0x33')](_0x1e3368[_0xde54('0x46')][_0xde54('0x33')]);}_0x3440cd[_0xde54('0x4d')]=qs[_0xde54('0x4e')](_0x1e3368[_0xde54('0x46')][_0xde54('0x4e')]);_0x3440cd['where']=qs['filters'](_['pick'](_0x1e3368[_0xde54('0x46')],_0x28ca44['filters']),_0x1a21ea);if(_0x1e3368[_0xde54('0x46')][_0xde54('0x4f')]){_0x3440cd[_0xde54('0x50')]=_['merge'](_0x3440cd[_0xde54('0x50')],{'$or':_[_0xde54('0x41')](_0x1a21ea,function(_0x29d60a){if(_0x29d60a[_0xde54('0x51')]!==_0xde54('0x52')){var _0x10b250={};_0x10b250[_0x29d60a[_0xde54('0x3e')]]={'$like':'%'+_0x1e3368[_0xde54('0x46')][_0xde54('0x4f')]+'%'};return _0x10b250;}})});}_0x3440cd=_['merge']({},_0x3440cd,_0x1e3368['options']);var _0x6f220e={'where':_0x3440cd[_0xde54('0x50')]};return db[_0xde54('0x42')][_0xde54('0x32')](_0x6f220e)['then'](function(_0x3824bf){_0x7bea90[_0xde54('0x32')]=_0x3824bf;if(_0x1e3368[_0xde54('0x46')][_0xde54('0x53')]){_0x3440cd[_0xde54('0x54')]=[{'all':!![]}];}return db[_0xde54('0x42')]['findAll'](_0x3440cd);})[_0xde54('0x23')](function(_0x5ccd88){_0x7bea90['rows']=_0x5ccd88;return _0x7bea90;})['then'](respondWithFilteredResult(_0xcbadd2,_0x3440cd))[_0xde54('0x2d')](handleError(_0xcbadd2,null));};exports[_0xde54('0x55')]=function(_0x1cd03c,_0x515e92){var _0x3cdaea={'raw':!![],'where':{'id':_0x1cd03c['params']['id']}},_0x4512c={};_0x4512c[_0xde54('0x45')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x4512c[_0xde54('0x46')]=_[_0xde54('0x47')](_0x1cd03c['query']);_0x4512c[_0xde54('0x56')]=_['intersection'](_0x4512c[_0xde54('0x45')],_0x4512c[_0xde54('0x46')]);_0x3cdaea[_0xde54('0x48')]=_[_0xde54('0x57')](_0x4512c['model'],qs[_0xde54('0x49')](_0x1cd03c[_0xde54('0x46')][_0xde54('0x49')]));_0x3cdaea[_0xde54('0x48')]=_0x3cdaea['attributes'][_0xde54('0x4a')]?_0x3cdaea[_0xde54('0x48')]:_0x4512c['model'];if(_0x1cd03c[_0xde54('0x46')][_0xde54('0x53')]){_0x3cdaea['include']=[{'all':!![]}];}_0x3cdaea=_[_0xde54('0x58')]({},_0x3cdaea,_0x1cd03c[_0xde54('0x59')]);return db[_0xde54('0x42')][_0xde54('0x5a')](_0x3cdaea)[_0xde54('0x23')](handleEntityNotFound(_0x515e92,null))[_0xde54('0x23')](respondWithResult(_0x515e92,null))[_0xde54('0x2d')](handleError(_0x515e92,null));};exports[_0xde54('0x5b')]=function(_0x2e238f,_0x142bbb){return db[_0xde54('0x42')][_0xde54('0x5b')](_0x2e238f[_0xde54('0x5c')],{})[_0xde54('0x23')](respondWithResult(_0x142bbb,0xc9))[_0xde54('0x2d')](handleError(_0x142bbb,null));};exports[_0xde54('0x3a')]=function(_0x28e4c1,_0x5078fa){if(_0x28e4c1[_0xde54('0x5c')]['id']){delete _0x28e4c1[_0xde54('0x5c')]['id'];}return db['WhatsappMessage'][_0xde54('0x5a')]({'where':{'id':_0x28e4c1[_0xde54('0x5d')]['id']}})[_0xde54('0x23')](handleEntityNotFound(_0x5078fa,null))['then'](saveUpdates(_0x28e4c1[_0xde54('0x5c')],null))[_0xde54('0x23')](respondWithResult(_0x5078fa,null))[_0xde54('0x2d')](handleError(_0x5078fa,null));};exports[_0xde54('0x3b')]=function(_0x2575d8,_0x116259){return db[_0xde54('0x42')][_0xde54('0x5a')]({'where':{'id':_0x2575d8[_0xde54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x116259,null))[_0xde54('0x23')](removeEntity(_0x116259,null))[_0xde54('0x2d')](handleError(_0x116259,null));};exports[_0xde54('0x5e')]=function(_0x3d216d,_0x29fde0){return db[_0xde54('0x42')][_0xde54('0x5e')]()['then'](respondWithResult(_0x29fde0,null))[_0xde54('0x2d')](handleError(_0x29fde0,null));};var interaction_log=require(_0xde54('0x5f'))(_0xde54('0x60'));exports[_0xde54('0x61')]=function(_0x529e7f,_0x3b3ff6,_0xcc4b00){var _0x26cee0={'agent':{},'channel':'whatsapp'};if(_0x529e7f[_0xde54('0x5c')]['id']){delete _0x529e7f[_0xde54('0x5c')]['id'];}_0x529e7f[_0xde54('0x5c')]['read']=!![];_0x529e7f['body'][_0xde54('0x62')]=moment()[_0xde54('0x63')](_0xde54('0x64'));_0x529e7f['body'][_0xde54('0x65')]=_0x529e7f['body']['UserId']||_0x529e7f[_0xde54('0x66')]['id'];_0x26cee0[_0xde54('0x67')]['id']=_0x529e7f[_0xde54('0x5c')][_0xde54('0x65')];return db[_0xde54('0x42')][_0xde54('0x5a')]({'where':{'id':_0x529e7f[_0xde54('0x5d')]['id'],'UserId':null}})[_0xde54('0x23')](handleEntityNotFound(_0x3b3ff6,null))['then'](saveUpdates(_0x529e7f[_0xde54('0x5c')],null))['then'](function(_0x17e7c0){if(_0x17e7c0){_0x26cee0[_0xde54('0x2a')]=_0x17e7c0[_0xde54('0x68')]({'plain':!![]});return db[_0xde54('0x69')][_0xde54('0x5a')]({'where':{'id':_0x17e7c0['WhatsappInteractionId']}});}return null;})[_0xde54('0x23')](handleEntityNotFound(_0x3b3ff6,null))[_0xde54('0x23')](function(_0x42d3ec){if(_0x42d3ec){return _0x42d3ec[_0xde54('0x3a')]({'UserId':_0x529e7f[_0xde54('0x5c')]['UserId'],'read1stAt':_[_0xde54('0x6a')](_0x42d3ec[_0xde54('0x6b')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xde54('0x23')](function(_0x7b0c95){if(_0x7b0c95){_0x26cee0[_0xde54('0x6c')]=_0x7b0c95['get']({'plain':!![]});interaction_log[_0xde54('0x24')](_0xde54('0x6d'),_0x529e7f['user']['id'],_0x529e7f['user'][_0xde54('0x3e')],_0x529e7f[_0xde54('0x66')]['role'],_0x26cee0[_0xde54('0x6c')]['id'],_0x529e7f[_0xde54('0x5c')]?JSON[_0xde54('0x28')](_0x529e7f[_0xde54('0x5c')]):'null');return respondWithRpcPromise(_0xde54('0x6e'),_0xde54('0x6f'),_0x26cee0);}return null;})[_0xde54('0x23')](function(_0x44f215){var _0x39b1ac='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x44f215[_0xde54('0x2a')][_0xde54('0x70')];return db['sequelize'][_0xde54('0x46')](_0x39b1ac,{'type':db[_0xde54('0x71')][_0xde54('0x72')][_0xde54('0x73')],'raw':!![]})[_0xde54('0x23')](function(_0x238203){return _0x238203;});})[_0xde54('0x23')](function(_0x4286ef){if(_0x4286ef){_0x26cee0[_0xde54('0x2a')][_0xde54('0x74')]=_0x4286ef[0x0];if(!_0x529e7f[_0xde54('0x5c')][_0xde54('0x65')])return;return db[_0xde54('0x75')][_0xde54('0x5a')]({'where':{'id':_0x529e7f[_0xde54('0x5c')][_0xde54('0x65')],'role':_0xde54('0x67')},'attributes':['id',_0xde54('0x3e'),_0xde54('0x76'),_0xde54('0x77'),_0xde54('0x78')],'raw':!![]});}return null;})[_0xde54('0x23')](function(_0x105cf7){if(!_0x105cf7)return null;_0x26cee0[_0xde54('0x2a')][_0xde54('0x67')]=_0x105cf7;return _0x26cee0;})[_0xde54('0x23')](function(_0x18d1cb){if(_0x18d1cb){if(_0x529e7f[_0xde54('0x5c')][_0xde54('0x79')]){_0x26cee0[_0xde54('0x2a')][_0xde54('0x7a')]=util[_0xde54('0x63')]('SIP/%s',_0x529e7f[_0xde54('0x66')][_0xde54('0x3e')]);_0x26cee0[_0xde54('0x2a')][_0xde54('0x7b')]=_0x26cee0[_0xde54('0x7b')];_0x26cee0[_0xde54('0x2a')]['motionChannel']=_0x26cee0[_0xde54('0x7b')];_0x26cee0[_0xde54('0x2a')][_0xde54('0x7c')]=_0xde54('0x61');return respondWithRpcPromise('EventManager',_0xde54('0x7d'),{'event':_0xde54('0x7e'),'message':_0x26cee0[_0xde54('0x2a')]},client9002)[_0xde54('0x23')](function(){return _0x26cee0;});}return _0x26cee0;}return null;})[_0xde54('0x23')](respondWithResult(_0x3b3ff6,null))[_0xde54('0x2d')](handleError(_0x3b3ff6,null));};var interaction_log=require(_0xde54('0x5f'))(_0xde54('0x60'));exports[_0xde54('0x38')]=function(_0x1ba725,_0xcc1e28,_0x4734a2){var _0x2fa5ff={'agent':{},'channel':'whatsapp'};if(_0x1ba725[_0xde54('0x5c')]['id']){delete _0x1ba725['body']['id'];}_0x1ba725[_0xde54('0x5c')][_0xde54('0x65')]=_0x1ba725[_0xde54('0x5c')][_0xde54('0x65')]||_0x1ba725['user']['id'];_0x2fa5ff[_0xde54('0x67')]['id']=_0x1ba725[_0xde54('0x5c')]['UserId'];return db[_0xde54('0x42')][_0xde54('0x5a')]({'where':{'id':_0x1ba725['params']['id'],'UserId':null}})[_0xde54('0x23')](handleEntityNotFound(_0xcc1e28,null))['then'](function(_0x22063d){if(_0x22063d){_0x2fa5ff[_0xde54('0x2a')]=_0x22063d[_0xde54('0x68')]({'plain':!![]});return db[_0xde54('0x69')][_0xde54('0x5a')]({'where':{'id':_0x22063d['WhatsappInteractionId']}});}return null;})[_0xde54('0x23')](handleEntityNotFound(_0xcc1e28,null))[_0xde54('0x23')](function(_0x59a1ab){if(_0x59a1ab){_0x2fa5ff[_0xde54('0x6c')]=_0x59a1ab[_0xde54('0x68')]({'plain':!![]});interaction_log[_0xde54('0x24')](_0xde54('0x7f'),_0x1ba725[_0xde54('0x66')]['id'],_0x1ba725[_0xde54('0x66')][_0xde54('0x3e')],_0x1ba725['user'][_0xde54('0x80')],_0x2fa5ff[_0xde54('0x6c')]['id'],_0x1ba725[_0xde54('0x5c')]?JSON[_0xde54('0x28')](_0x1ba725[_0xde54('0x5c')]):_0xde54('0x81'));return respondWithRpcPromise(_0xde54('0x82'),'rejectMessage',_0x2fa5ff);}return null;})[_0xde54('0x23')](function(_0x4f98b3){var _0x5f050a=_0xde54('0x83')+_0x4f98b3['message'][_0xde54('0x70')];return db[_0xde54('0x84')][_0xde54('0x46')](_0x5f050a,{'type':db['Sequelize'][_0xde54('0x72')][_0xde54('0x73')],'raw':!![]})[_0xde54('0x23')](function(_0x567221){return _0x567221;});})[_0xde54('0x23')](function(_0x3ea9ca){if(_0x3ea9ca){_0x2fa5ff[_0xde54('0x2a')]['contact']=_0x3ea9ca[0x0];if(!_0x1ba725['body'][_0xde54('0x65')])return;return db['User'][_0xde54('0x5a')]({'where':{'id':_0x1ba725[_0xde54('0x5c')][_0xde54('0x65')],'role':_0xde54('0x67')},'attributes':['id',_0xde54('0x3e'),_0xde54('0x76'),'email',_0xde54('0x78')],'raw':!![]});}return null;})[_0xde54('0x23')](function(_0x8c4b4c){if(!_0x8c4b4c)return null;_0x2fa5ff[_0xde54('0x2a')][_0xde54('0x67')]=_0x8c4b4c;return _0x2fa5ff;})[_0xde54('0x23')](function(_0x1f63cf){if(_0x1f63cf){_0x1f63cf[_0xde54('0x2a')][_0xde54('0x7a')]=util[_0xde54('0x63')](_0xde54('0x85'),_0x1ba725[_0xde54('0x66')]['name']);_0x1f63cf[_0xde54('0x2a')][_0xde54('0x7b')]=_0x2fa5ff['channel'];_0x1f63cf[_0xde54('0x2a')][_0xde54('0x86')]=_0x2fa5ff[_0xde54('0x7b')];_0x1f63cf[_0xde54('0x2a')][_0xde54('0x7c')]=_0xde54('0x38');respondWithRpcPromise(_0xde54('0x7d'),'EventManager',{'event':_0xde54('0x87'),'message':_0x1f63cf[_0xde54('0x2a')]},client9002);return _0x2fa5ff;}return null;})[_0xde54('0x23')](respondWithResult(_0xcc1e28,null))[_0xde54('0x2d')](handleError(_0xcc1e28,null));};exports[_0xde54('0x2f')]=function(_0x222c7d,_0x4a375f,_0x24bc01){if(_0x222c7d[_0xde54('0x5c')]['id']){delete _0x222c7d[_0xde54('0x5c')]['id'];}var _0x210a52;return db[_0xde54('0x42')][_0xde54('0x5a')]({'where':{'id':_0x222c7d['params']['id']}})[_0xde54('0x23')](handleEntityNotFound(_0x4a375f,null))[_0xde54('0x23')](function(_0x14a8f6){if(_0x14a8f6){_0x210a52=_0x14a8f6;return db[_0xde54('0x88')][_0xde54('0x5a')]({'where':{'id':_0x14a8f6[_0xde54('0x89')]}});}})['then'](handleEntityNotFound(_0x4a375f,null))[_0xde54('0x23')](function(_0x4fa73b){if(_0x4fa73b){logger[_0xde54('0x26')](_0xde54('0x8a'),_0xde54('0x2f'),'received\x20delivery\x20report\x20from',_0x4fa73b[_0xde54('0x51')],util[_0xde54('0x8b')](_0x222c7d['body'],{'showHidden':![],'depth':null}));switch(_0x4fa73b[_0xde54('0x51')]){case _0xde54('0x8c'):if(_0x222c7d[_0xde54('0x5c')]['MessageSid']&&_0x222c7d['body'][_0xde54('0x8d')]===_0x210a52['messageId']&&_0x222c7d[_0xde54('0x5c')]['MessageStatus']&&_0x222c7d[_0xde54('0x5c')][_0xde54('0x8e')]==='read'){return _0x210a52[_0xde54('0x3a')]({'read':!![]});}else{logger[_0xde54('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xde54('0x8c'),util[_0xde54('0x8b')](_0x222c7d[_0xde54('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x210a52;}})[_0xde54('0x23')](respondWithResult(_0x4a375f,null))[_0xde54('0x2d')](handleError(_0x4a375f,null));}; \ No newline at end of file +var _0x760b=['WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','destroy','describe','whatsapp-interactions','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteraction','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','interface','channel','motionChannel','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage'];(function(_0x500d7d,_0x4af75b){var _0x44d4a2=function(_0x4ad2ce){while(--_0x4ad2ce){_0x500d7d['push'](_0x500d7d['shift']());}};_0x44d4a2(++_0x4af75b);}(_0x760b,0x95));var _0xb760=function(_0x94b7ca,_0xdfa839){_0x94b7ca=_0x94b7ca-0x0;var _0x1df43c=_0x760b[_0x94b7ca];return _0x1df43c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb760('0x0'));var zipdir=require(_0xb760('0x1'));var jsonpatch=require(_0xb760('0x2'));var rp=require(_0xb760('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb760('0x4'));var util=require(_0xb760('0x5'));var path=require(_0xb760('0x6'));var sox=require(_0xb760('0x7'));var csv=require(_0xb760('0x8'));var ejs=require(_0xb760('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb760('0xa'));var squel=require(_0xb760('0xb'));var crypto=require(_0xb760('0xc'));var jsforce=require(_0xb760('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb760('0x8'));var querystring=require(_0xb760('0xe'));var Papa=require(_0xb760('0xf'));var Redis=require(_0xb760('0x10'));var authService=require(_0xb760('0x11'));var qs=require(_0xb760('0x12'));var as=require(_0xb760('0x13'));var hardwareService=require(_0xb760('0x14'));var logger=require(_0xb760('0x15'))(_0xb760('0x16'));var utils=require(_0xb760('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb760('0x18'));var db=require('../../mysqldb')['db'];config[_0xb760('0x19')]=_['defaults'](config['redis'],{'host':_0xb760('0x1a'),'port':0x18eb});var socket=require(_0xb760('0x1b'))(new Redis(config['redis']));require(_0xb760('0x1c'))[_0xb760('0x1d')](socket);var jayson=require(_0xb760('0x1e'));var client=jayson[_0xb760('0x1f')][_0xb760('0x20')]({'port':0x232c});var client9002=jayson[_0xb760('0x1f')][_0xb760('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x928e1c,_0x3b52e6,_0x2dcca6,_0x5224b0){return new BPromise(function(_0xd0275c,_0x521be0){var _0x1f608d=_0x5224b0||client;return _0x1f608d[_0xb760('0x21')](_0x928e1c,_0x2dcca6)[_0xb760('0x22')](function(_0x3059ac){logger[_0xb760('0x23')](_0xb760('0x24'),_0x3b52e6,_0xb760('0x25'));logger[_0xb760('0x26')](_0xb760('0x27'),_0x3b52e6,_0xb760('0x25'),JSON[_0xb760('0x28')](_0x3059ac));if(_0x3059ac['error']){if(_0x3059ac['error'][_0xb760('0x29')]===0x1f4){logger[_0xb760('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x3b52e6,_0x3059ac['error'][_0xb760('0x2b')]);return _0x521be0(_0x3059ac[_0xb760('0x2a')][_0xb760('0x2b')]);}logger[_0xb760('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x3b52e6,_0x3059ac[_0xb760('0x2a')]['message']);return _0xd0275c(_0x3059ac[_0xb760('0x2a')][_0xb760('0x2b')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3b52e6,_0xb760('0x25'));_0xd0275c(_0x3059ac[_0xb760('0x2c')][_0xb760('0x2b')]);}})[_0xb760('0x2d')](function(_0x2c8925){logger[_0xb760('0x2a')](_0xb760('0x24'),_0x3b52e6,_0x2c8925);_0x521be0(_0x2c8925);});});}function respondWithStatusCode(_0x3d3bdb,_0x5bf39c){_0x5bf39c=_0x5bf39c||0xcc;return function(_0x5b20db){if(_0x5b20db){return _0x3d3bdb[_0xb760('0x2e')](_0x5bf39c);}return _0x3d3bdb[_0xb760('0x2f')](_0x5bf39c)['end']();};}function respondWithResult(_0x4da376,_0x185285){_0x185285=_0x185285||0xc8;return function(_0x5dfa7b){if(_0x5dfa7b){return _0x4da376['status'](_0x185285)[_0xb760('0x30')](_0x5dfa7b);}};}function respondWithFilteredResult(_0x43bc4b,_0x454b20){return function(_0x534302){if(_0x534302){var _0x4a71a4=typeof _0x454b20[_0xb760('0x31')]===_0xb760('0x32')&&typeof _0x454b20[_0xb760('0x33')]===_0xb760('0x32');var _0x12800c=_0x534302[_0xb760('0x34')];var _0x2a75ff=_0x4a71a4?0x0:_0x454b20[_0xb760('0x31')];var _0x5e01ec=_0x4a71a4?_0x534302[_0xb760('0x34')]:_0x454b20[_0xb760('0x31')]+_0x454b20[_0xb760('0x33')];var _0x541934;if(_0x5e01ec>=_0x12800c){_0x5e01ec=_0x12800c;_0x541934=0xc8;}else{_0x541934=0xce;}_0x43bc4b['status'](_0x541934);return _0x43bc4b[_0xb760('0x35')](_0xb760('0x36'),_0x2a75ff+'-'+_0x5e01ec+'/'+_0x12800c)[_0xb760('0x30')](_0x534302);}return null;};}function patchUpdates(_0x32e240){return function(_0x3287e9){try{jsonpatch[_0xb760('0x37')](_0x3287e9,_0x32e240,!![]);}catch(_0x5c9e9c){return BPromise[_0xb760('0x38')](_0x5c9e9c);}return _0x3287e9[_0xb760('0x39')]();};}function saveUpdates(_0x233182,_0x448d65){return function(_0x7fa927){if(_0x7fa927){return _0x7fa927[_0xb760('0x3a')](_0x233182)[_0xb760('0x22')](function(_0x36c753){return _0x36c753;});}return null;};}function removeEntity(_0x5b1c02,_0x49dd17){return function(_0x300843){if(_0x300843){return _0x300843['destroy']()['then'](function(){_0x5b1c02[_0xb760('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c9493,_0x252de4){return function(_0x470ab5){if(!_0x470ab5){_0x2c9493[_0xb760('0x2e')](0x194);}return _0x470ab5;};}function handleError(_0x2bce11,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x2be0dc){logger[_0xb760('0x2a')](_0x2be0dc['stack']);if(_0x2be0dc['name']){delete _0x2be0dc[_0xb760('0x3b')];}_0x2bce11[_0xb760('0x2f')](_0x4e8a7f)[_0xb760('0x3c')](_0x2be0dc);};}exports[_0xb760('0x3d')]=function(_0x902f97,_0x2d20a7){var _0x5514ac={},_0x4a21f5={},_0x225475={'count':0x0,'rows':[]};var _0x43cb35=_[_0xb760('0x3e')](db[_0xb760('0x3f')][_0xb760('0x40')],function(_0x19d0d4){return{'name':_0x19d0d4[_0xb760('0x41')],'type':_0x19d0d4[_0xb760('0x42')][_0xb760('0x43')]};});_0x4a21f5['model']=_[_0xb760('0x3e')](_0x43cb35,_0xb760('0x3b'));_0x4a21f5[_0xb760('0x44')]=_[_0xb760('0x45')](_0x902f97[_0xb760('0x44')]);_0x4a21f5[_0xb760('0x46')]=_[_0xb760('0x47')](_0x4a21f5[_0xb760('0x48')],_0x4a21f5['query']);_0x5514ac[_0xb760('0x49')]=_[_0xb760('0x47')](_0x4a21f5[_0xb760('0x48')],qs[_0xb760('0x4a')](_0x902f97['query']['fields']));_0x5514ac['attributes']=_0x5514ac[_0xb760('0x49')][_0xb760('0x4b')]?_0x5514ac[_0xb760('0x49')]:_0x4a21f5['model'];if(!_0x902f97[_0xb760('0x44')]['hasOwnProperty'](_0xb760('0x4c'))){_0x5514ac[_0xb760('0x33')]=qs['limit'](_0x902f97[_0xb760('0x44')]['limit']);_0x5514ac['offset']=qs[_0xb760('0x31')](_0x902f97['query'][_0xb760('0x31')]);}_0x5514ac['order']=qs[_0xb760('0x4d')](_0x902f97['query'][_0xb760('0x4d')]);_0x5514ac[_0xb760('0x4e')]=qs[_0xb760('0x46')](_[_0xb760('0x4f')](_0x902f97[_0xb760('0x44')],_0x4a21f5[_0xb760('0x46')]),_0x43cb35);if(_0x902f97['query'][_0xb760('0x50')]){_0x5514ac['where']=_[_0xb760('0x51')](_0x5514ac[_0xb760('0x4e')],{'$or':_[_0xb760('0x3e')](_0x43cb35,function(_0x1d42d9){if(_0x1d42d9[_0xb760('0x42')]!==_0xb760('0x52')){var _0x550f46={};_0x550f46[_0x1d42d9[_0xb760('0x3b')]]={'$like':'%'+_0x902f97['query'][_0xb760('0x50')]+'%'};return _0x550f46;}})});}_0x5514ac=_[_0xb760('0x51')]({},_0x5514ac,_0x902f97[_0xb760('0x53')]);var _0x213573={'where':_0x5514ac[_0xb760('0x4e')]};return db[_0xb760('0x3f')][_0xb760('0x34')](_0x213573)[_0xb760('0x22')](function(_0x471ebf){_0x225475[_0xb760('0x34')]=_0x471ebf;if(_0x902f97[_0xb760('0x44')][_0xb760('0x54')]){_0x5514ac['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xb760('0x55')](_0x5514ac);})['then'](function(_0x19c7b3){_0x225475[_0xb760('0x56')]=_0x19c7b3;return _0x225475;})[_0xb760('0x22')](respondWithFilteredResult(_0x2d20a7,_0x5514ac))[_0xb760('0x2d')](handleError(_0x2d20a7,null));};exports[_0xb760('0x57')]=function(_0x50ca10,_0x45b100){var _0x4e17b1={'raw':!![],'where':{'id':_0x50ca10[_0xb760('0x58')]['id']}},_0x364909={};_0x364909[_0xb760('0x48')]=_['keys'](db['WhatsappMessage'][_0xb760('0x40')]);_0x364909[_0xb760('0x44')]=_[_0xb760('0x45')](_0x50ca10[_0xb760('0x44')]);_0x364909[_0xb760('0x46')]=_[_0xb760('0x47')](_0x364909[_0xb760('0x48')],_0x364909[_0xb760('0x44')]);_0x4e17b1[_0xb760('0x49')]=_[_0xb760('0x47')](_0x364909[_0xb760('0x48')],qs[_0xb760('0x4a')](_0x50ca10[_0xb760('0x44')]['fields']));_0x4e17b1[_0xb760('0x49')]=_0x4e17b1[_0xb760('0x49')][_0xb760('0x4b')]?_0x4e17b1[_0xb760('0x49')]:_0x364909[_0xb760('0x48')];if(_0x50ca10['query'][_0xb760('0x54')]){_0x4e17b1['include']=[{'all':!![]}];}_0x4e17b1=_[_0xb760('0x51')]({},_0x4e17b1,_0x50ca10['options']);return db[_0xb760('0x3f')][_0xb760('0x59')](_0x4e17b1)[_0xb760('0x22')](handleEntityNotFound(_0x45b100,null))[_0xb760('0x22')](respondWithResult(_0x45b100,null))['catch'](handleError(_0x45b100,null));};exports['create']=function(_0x526541,_0x130fd3){return db[_0xb760('0x3f')][_0xb760('0x5a')](_0x526541[_0xb760('0x5b')],{})[_0xb760('0x22')](respondWithResult(_0x130fd3,0xc9))[_0xb760('0x2d')](handleError(_0x130fd3,null));};exports[_0xb760('0x3a')]=function(_0x57b378,_0x5cd699){if(_0x57b378['body']['id']){delete _0x57b378[_0xb760('0x5b')]['id'];}return db[_0xb760('0x3f')][_0xb760('0x59')]({'where':{'id':_0x57b378[_0xb760('0x58')]['id']}})['then'](handleEntityNotFound(_0x5cd699,null))[_0xb760('0x22')](saveUpdates(_0x57b378['body'],null))[_0xb760('0x22')](respondWithResult(_0x5cd699,null))[_0xb760('0x2d')](handleError(_0x5cd699,null));};exports[_0xb760('0x5c')]=function(_0x28be31,_0x18b99a){return db[_0xb760('0x3f')][_0xb760('0x59')]({'where':{'id':_0x28be31[_0xb760('0x58')]['id']}})[_0xb760('0x22')](handleEntityNotFound(_0x18b99a,null))[_0xb760('0x22')](removeEntity(_0x18b99a,null))[_0xb760('0x2d')](handleError(_0x18b99a,null));};exports[_0xb760('0x5d')]=function(_0x17ed8e,_0x4ac148){return db[_0xb760('0x3f')][_0xb760('0x5d')]()[_0xb760('0x22')](respondWithResult(_0x4ac148,null))['catch'](handleError(_0x4ac148,null));};var interaction_log=require('../../config/logger')(_0xb760('0x5e'));exports['accept']=function(_0x32bf37,_0x59cbe0,_0x5d98c5){var _0x5a7e0d={'agent':{},'channel':_0xb760('0x5f')};if(_0x32bf37['body']['id']){delete _0x32bf37[_0xb760('0x5b')]['id'];}_0x32bf37['body'][_0xb760('0x60')]=!![];_0x32bf37[_0xb760('0x5b')]['readAt']=moment()[_0xb760('0x61')](_0xb760('0x62'));_0x32bf37[_0xb760('0x5b')][_0xb760('0x63')]=_0x32bf37[_0xb760('0x5b')]['UserId']||_0x32bf37[_0xb760('0x64')]['id'];_0x5a7e0d['agent']['id']=_0x32bf37[_0xb760('0x5b')][_0xb760('0x63')];return db[_0xb760('0x3f')][_0xb760('0x59')]({'where':{'id':_0x32bf37[_0xb760('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x59cbe0,null))['then'](saveUpdates(_0x32bf37['body'],null))[_0xb760('0x22')](function(_0x3c9efb){if(_0x3c9efb){_0x5a7e0d[_0xb760('0x2b')]=_0x3c9efb['get']({'plain':!![]});return db[_0xb760('0x65')][_0xb760('0x59')]({'where':{'id':_0x3c9efb['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x59cbe0,null))[_0xb760('0x22')](function(_0x498ceb){if(_0x498ceb){return _0x498ceb[_0xb760('0x3a')]({'UserId':_0x32bf37['body']['UserId'],'read1stAt':_[_0xb760('0x66')](_0x498ceb[_0xb760('0x67')])?moment()[_0xb760('0x61')](_0xb760('0x62')):undefined});}return null;})['then'](function(_0x3cde7c){if(_0x3cde7c){_0x5a7e0d[_0xb760('0x68')]=_0x3cde7c[_0xb760('0x69')]({'plain':!![]});interaction_log[_0xb760('0x23')](_0xb760('0x6a'),_0x32bf37[_0xb760('0x64')]['id'],_0x32bf37[_0xb760('0x64')][_0xb760('0x3b')],_0x32bf37[_0xb760('0x64')][_0xb760('0x6b')],_0x5a7e0d[_0xb760('0x68')]['id'],_0x32bf37['body']?JSON[_0xb760('0x28')](_0x32bf37[_0xb760('0x5b')]):_0xb760('0x6c'));return respondWithRpcPromise(_0xb760('0x6d'),_0xb760('0x6e'),_0x5a7e0d);}return null;})[_0xb760('0x22')](function(_0x225a63){var _0x14a56c=_0xb760('0x6f')+_0x225a63[_0xb760('0x2b')][_0xb760('0x70')];return db[_0xb760('0x71')][_0xb760('0x44')](_0x14a56c,{'type':db[_0xb760('0x72')]['QueryTypes'][_0xb760('0x73')],'raw':!![]})[_0xb760('0x22')](function(_0x4a3fa2){return _0x4a3fa2;});})[_0xb760('0x22')](function(_0x1bf968){if(_0x1bf968){_0x5a7e0d[_0xb760('0x2b')][_0xb760('0x74')]=_0x1bf968[0x0];if(!_0x32bf37[_0xb760('0x5b')][_0xb760('0x63')])return;return db[_0xb760('0x75')][_0xb760('0x59')]({'where':{'id':_0x32bf37[_0xb760('0x5b')][_0xb760('0x63')],'role':_0xb760('0x76')},'attributes':['id',_0xb760('0x3b'),_0xb760('0x77'),_0xb760('0x78'),_0xb760('0x79')],'raw':!![]});}return null;})[_0xb760('0x22')](function(_0x39b079){if(!_0x39b079)return null;_0x5a7e0d[_0xb760('0x2b')][_0xb760('0x76')]=_0x39b079;return _0x5a7e0d;})[_0xb760('0x22')](function(_0xb5f520){if(_0xb5f520){if(_0x32bf37[_0xb760('0x5b')]['manual']){_0x5a7e0d[_0xb760('0x2b')][_0xb760('0x7a')]=util[_0xb760('0x61')]('SIP/%s',_0x32bf37[_0xb760('0x64')]['name']);_0x5a7e0d['message'][_0xb760('0x7b')]=_0x5a7e0d[_0xb760('0x7b')];_0x5a7e0d[_0xb760('0x2b')][_0xb760('0x7c')]=_0x5a7e0d[_0xb760('0x7b')];_0x5a7e0d[_0xb760('0x2b')]['event']=_0xb760('0x7d');return respondWithRpcPromise(_0xb760('0x7e'),'EventManager',{'event':_0xb760('0x7f'),'message':_0x5a7e0d[_0xb760('0x2b')]},client9002)[_0xb760('0x22')](function(){return _0x5a7e0d;});}return _0x5a7e0d;}return null;})[_0xb760('0x22')](respondWithResult(_0x59cbe0,null))[_0xb760('0x2d')](handleError(_0x59cbe0,null));};var interaction_log=require(_0xb760('0x15'))('whatsapp-interactions');exports[_0xb760('0x38')]=function(_0x55e472,_0x450abd,_0x3e2ba8){var _0x19bec4={'agent':{},'channel':_0xb760('0x5f')};if(_0x55e472[_0xb760('0x5b')]['id']){delete _0x55e472[_0xb760('0x5b')]['id'];}_0x55e472['body'][_0xb760('0x63')]=_0x55e472[_0xb760('0x5b')]['UserId']||_0x55e472[_0xb760('0x64')]['id'];_0x19bec4['agent']['id']=_0x55e472[_0xb760('0x5b')]['UserId'];return db['WhatsappMessage'][_0xb760('0x59')]({'where':{'id':_0x55e472[_0xb760('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x450abd,null))[_0xb760('0x22')](function(_0x2b710b){if(_0x2b710b){_0x19bec4[_0xb760('0x2b')]=_0x2b710b[_0xb760('0x69')]({'plain':!![]});return db[_0xb760('0x65')]['find']({'where':{'id':_0x2b710b['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x450abd,null))[_0xb760('0x22')](function(_0x8798a){if(_0x8798a){_0x19bec4[_0xb760('0x68')]=_0x8798a[_0xb760('0x69')]({'plain':!![]});interaction_log['info'](_0xb760('0x80'),_0x55e472[_0xb760('0x64')]['id'],_0x55e472[_0xb760('0x64')][_0xb760('0x3b')],_0x55e472[_0xb760('0x64')][_0xb760('0x6b')],_0x19bec4[_0xb760('0x68')]['id'],_0x55e472[_0xb760('0x5b')]?JSON[_0xb760('0x28')](_0x55e472[_0xb760('0x5b')]):_0xb760('0x6c'));return respondWithRpcPromise(_0xb760('0x81'),_0xb760('0x82'),_0x19bec4);}return null;})['then'](function(_0x56d536){var _0x368b8f=_0xb760('0x6f')+_0x56d536['message'][_0xb760('0x70')];return db[_0xb760('0x71')][_0xb760('0x44')](_0x368b8f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xb760('0x22')](function(_0x3a490a){return _0x3a490a;});})[_0xb760('0x22')](function(_0x3fe3e7){if(_0x3fe3e7){_0x19bec4[_0xb760('0x2b')][_0xb760('0x74')]=_0x3fe3e7[0x0];if(!_0x55e472[_0xb760('0x5b')][_0xb760('0x63')])return;return db['User'][_0xb760('0x59')]({'where':{'id':_0x55e472['body'][_0xb760('0x63')],'role':'agent'},'attributes':['id',_0xb760('0x3b'),_0xb760('0x77'),_0xb760('0x78'),_0xb760('0x79')],'raw':!![]});}return null;})['then'](function(_0x425a08){if(!_0x425a08)return null;_0x19bec4[_0xb760('0x2b')]['agent']=_0x425a08;return _0x19bec4;})[_0xb760('0x22')](function(_0x1cf65e){if(_0x1cf65e){_0x1cf65e[_0xb760('0x2b')][_0xb760('0x7a')]=util[_0xb760('0x61')](_0xb760('0x83'),_0x55e472[_0xb760('0x64')][_0xb760('0x3b')]);_0x1cf65e[_0xb760('0x2b')][_0xb760('0x7b')]=_0x19bec4['channel'];_0x1cf65e[_0xb760('0x2b')]['motionChannel']=_0x19bec4[_0xb760('0x7b')];_0x1cf65e[_0xb760('0x2b')]['event']='reject';respondWithRpcPromise(_0xb760('0x7e'),'EventManager',{'event':_0xb760('0x84'),'message':_0x1cf65e[_0xb760('0x2b')]},client9002);return _0x19bec4;}return null;})['then'](respondWithResult(_0x450abd,null))['catch'](handleError(_0x450abd,null));};exports[_0xb760('0x2f')]=function(_0x3a1f61,_0x78c0e5,_0x5382ed){if(_0x3a1f61[_0xb760('0x5b')]['id']){delete _0x3a1f61[_0xb760('0x5b')]['id'];}var _0x2a6dcb;return db[_0xb760('0x3f')]['find']({'where':{'id':_0x3a1f61[_0xb760('0x58')]['id']}})[_0xb760('0x22')](handleEntityNotFound(_0x78c0e5,null))[_0xb760('0x22')](function(_0x144ba3){if(_0x144ba3){_0x2a6dcb=_0x144ba3;return db[_0xb760('0x85')][_0xb760('0x59')]({'where':{'id':_0x144ba3['WhatsappAccountId']}});}})[_0xb760('0x22')](handleEntityNotFound(_0x78c0e5,null))[_0xb760('0x22')](function(_0x163103){if(_0x163103){logger['debug'](_0xb760('0x86'),'status',_0xb760('0x87'),_0x163103[_0xb760('0x42')],util['inspect'](_0x3a1f61[_0xb760('0x5b')],{'showHidden':![],'depth':null}));switch(_0x163103['type']){case'twilio':if(_0x3a1f61[_0xb760('0x5b')][_0xb760('0x88')]&&_0x3a1f61[_0xb760('0x5b')][_0xb760('0x88')]===_0x2a6dcb[_0xb760('0x89')]&&_0x3a1f61[_0xb760('0x5b')][_0xb760('0x8a')]&&_0x3a1f61['body']['MessageStatus']===_0xb760('0x60')){return _0x2a6dcb[_0xb760('0x3a')]({'read':!![]});}else{logger['error'](_0xb760('0x8b'),_0xb760('0x2f'),'twilio',util[_0xb760('0x8c')](_0x3a1f61[_0xb760('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x2a6dcb;}})[_0xb760('0x22')](respondWithResult(_0x78c0e5,null))[_0xb760('0x2d')](handleError(_0x78c0e5,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index dcd919e..e868d5d 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 _0x9d9b=['save','remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage'];(function(_0x452db4,_0x58e348){var _0x2a5672=function(_0x4883bb){while(--_0x4883bb){_0x452db4['push'](_0x452db4['shift']());}};_0x2a5672(++_0x58e348);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x4cd9c3,_0xe88fe8){_0x4cd9c3=_0x4cd9c3-0x0;var _0x36dd1a=_0x9d9b[_0x4cd9c3];return _0x36dd1a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xb9d9('0x0'))['db'][_0xb9d9('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb9d9('0x2'),'afterUpdate':'update','afterDestroy':_0xb9d9('0x3')};function emitEvent(_0x19d86d){return function(_0x2fd7d5,_0x55b2c3,_0x3bac8c){WhatsappMessageEvents['emit'](_0x19d86d+':'+_0x2fd7d5['id'],_0x2fd7d5);WhatsappMessageEvents[_0xb9d9('0x4')](_0x19d86d,_0x2fd7d5);_0x3bac8c(null);};}for(var e in events){if(events[_0xb9d9('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xb9d9('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0xbdb7=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x128ac7,_0x3f2d75){var _0x273221=function(_0x41638e){while(--_0x41638e){_0x128ac7['push'](_0x128ac7['shift']());}};_0x273221(++_0x3f2d75);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4671a5,_0x1db5f4){_0x4671a5=_0x4671a5-0x0;var _0x12f1ac=_0xbdb7[_0x4671a5];return _0x12f1ac;};'use strict';var EventEmitter=require(_0x7bdb('0x0'));var WhatsappMessage=require(_0x7bdb('0x1'))['db'][_0x7bdb('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7bdb('0x3')](0x0);var events={'afterCreate':_0x7bdb('0x4'),'afterUpdate':_0x7bdb('0x5'),'afterDestroy':_0x7bdb('0x6')};function emitEvent(_0x2c7e07){return function(_0x46c068,_0x47aec5,_0x28542c){WhatsappMessageEvents['emit'](_0x2c7e07+':'+_0x46c068['id'],_0x46c068);WhatsappMessageEvents['emit'](_0x2c7e07,_0x46c068);_0x28542c(null);};}for(var e in events){if(events[_0x7bdb('0x7')](e)){var event=events[e];WhatsappMessage[_0x7bdb('0x8')](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 36f5963..729f78a 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 _0xeff5=['afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','isNil','WhatsappInteraction','WhatsappInteractionId','then','createdAt','toLowerCase','error','out','secret','WhatsappAccountId','type','twilio','authToken','phone','accountSid','whatsapp:','remote','/api/whatsapp/messages/','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xeff5,0x101));var _0x5eff=function(_0x2d944f,_0xf06593){_0x2d944f=_0x2d944f-0x0;var _0x562dfa=_0xeff5[_0x2d944f];return _0x562dfa;};'use strict';var _=require(_0x5eff('0x0'));var util=require('util');var logger=require(_0x5eff('0x1'))('api');var moment=require(_0x5eff('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5eff('0x3'));var config=require(_0x5eff('0x4'));var attributes=require(_0x5eff('0x5'));module[_0x5eff('0x6')]=function(_0x15fc7e,_0x1722fe){return _0x15fc7e[_0x5eff('0x7')](_0x5eff('0x8'),attributes,{'tableName':_0x5eff('0x9'),'paranoid':![],'indexes':[{'name':_0x5eff('0xa'),'fields':[_0x5eff('0xa')]},{'name':_0x5eff('0xb'),'fields':[_0x5eff('0xc')],'type':_0x5eff('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c86c7,_0x380ca6,_0x37debd){var _0x37e919=_0x15fc7e[_0x5eff('0xe')];var _0x27f7fe=_0x2c86c7['get']({'plain':!![]});if(_0x27f7fe[_0x5eff('0xf')]['toLowerCase']()==='in'||_0x27f7fe[_0x5eff('0xf')]['toLowerCase']()==='out'&&!_0x27f7fe['secret']&&!_[_0x5eff('0x10')](_0x27f7fe['UserId'])){_0x37e919[_0x5eff('0x11')]['findOne']({'where':{'id':_0x27f7fe[_0x5eff('0x12')]}})[_0x5eff('0x13')](function(_0x3300c0){if(_0x3300c0){_0x3300c0['update']({'lastMsgAt':_0x27f7fe[_0x5eff('0x14')],'lastMsgDirection':_0x27f7fe[_0x5eff('0xf')][_0x5eff('0x15')]()});}})['catch'](function(_0x31f24b){console[_0x5eff('0x16')](_0x31f24b);});}if(_0x27f7fe[_0x5eff('0xf')]===_0x5eff('0x17')&&!_0x27f7fe[_0x5eff('0x18')]){var _0x52b9df;_0x37e919['WhatsappAccount']['find']({'where':{'id':_0x27f7fe[_0x5eff('0x19')]},'raw':!![]})[_0x5eff('0x13')](function(_0x100b2a){_0x52b9df=_0x100b2a;if(_0x52b9df&&_0x52b9df[_0x5eff('0x1a')]){switch(_0x52b9df[_0x5eff('0x1a')]){case _0x5eff('0x1b'):var _0x5afbad=require('twilio');if(_0x52b9df['accountSid']&&_0x52b9df[_0x5eff('0x1c')]&&_0x52b9df[_0x5eff('0x1d')]){var _0x3dfd8a=new _0x5afbad(_0x52b9df[_0x5eff('0x1e')],_0x52b9df['authToken']);_0x3dfd8a['messages']['create']({'body':_0x27f7fe[_0x5eff('0xc')],'to':_0x5eff('0x1f')+_0x27f7fe[_0x5eff('0x1d')],'from':_0x5eff('0x1f')+_0x52b9df[_0x5eff('0x1d')],'statusCallback':_0x52b9df[_0x5eff('0x20')]+_0x5eff('0x21')+_0x27f7fe['id']+'/status?token='+_0x52b9df['token']})[_0x5eff('0x13')](function(_0x44c090){if(_0x44c090[_0x5eff('0x22')]){return _0x2c86c7['update']({'messageId':_0x44c090[_0x5eff('0x22')]});}})[_0x5eff('0x23')](function(_0x9fcedc){logger[_0x5eff('0x16')](_0x5eff('0x24'),_0x5eff('0x25'),_0x5eff('0x1b'),util['inspect'](_0x9fcedc,{'showHidden':![],'depth':null}));});}else{logger[_0x5eff('0x16')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x5eff('0x26'));}break;}}})[_0x5eff('0x27')](function(){_0x37debd();});}else{_0x37debd();}}},'charset':_0x5eff('0x28'),'collate':_0x5eff('0x29')});}; \ No newline at end of file +var _0x13dd=['token','sid','update','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','messages','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token='];(function(_0x690ce6,_0x2c62bc){var _0x57b003=function(_0x53e0c5){while(--_0x53e0c5){_0x690ce6['push'](_0x690ce6['shift']());}};_0x57b003(++_0x2c62bc);}(_0x13dd,0x1a1));var _0xd13d=function(_0x3cccea,_0x172a13){_0x3cccea=_0x3cccea-0x0;var _0x5170a0=_0x13dd[_0x3cccea];return _0x5170a0;};'use strict';var _=require(_0xd13d('0x0'));var util=require(_0xd13d('0x1'));var logger=require(_0xd13d('0x2'))(_0xd13d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd13d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd13d('0x5'));var config=require(_0xd13d('0x6'));var attributes=require(_0xd13d('0x7'));module[_0xd13d('0x8')]=function(_0x4ba969,_0x2d0f3e){return _0x4ba969[_0xd13d('0x9')](_0xd13d('0xa'),attributes,{'tableName':_0xd13d('0xb'),'paranoid':![],'indexes':[{'name':_0xd13d('0xc'),'fields':[_0xd13d('0xc')]},{'name':_0xd13d('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x500ca9,_0x8dd188,_0x455b3b){var _0x32db6c=_0x4ba969['models'];var _0x57b6c1=_0x500ca9[_0xd13d('0xe')]({'plain':!![]});if(_0x57b6c1[_0xd13d('0xf')][_0xd13d('0x10')]()==='in'||_0x57b6c1[_0xd13d('0xf')][_0xd13d('0x10')]()===_0xd13d('0x11')&&!_0x57b6c1[_0xd13d('0x12')]&&!_[_0xd13d('0x13')](_0x57b6c1[_0xd13d('0x14')])){_0x32db6c[_0xd13d('0x15')][_0xd13d('0x16')]({'where':{'id':_0x57b6c1[_0xd13d('0x17')]}})['then'](function(_0x1842fe){if(_0x1842fe){_0x1842fe['update']({'lastMsgAt':_0x57b6c1[_0xd13d('0x18')],'lastMsgDirection':_0x57b6c1[_0xd13d('0xf')][_0xd13d('0x10')]()});}})[_0xd13d('0x19')](function(_0xb5a8d9){console[_0xd13d('0x1a')](_0xb5a8d9);});}if(_0x57b6c1[_0xd13d('0xf')]===_0xd13d('0x11')&&!_0x57b6c1['secret']){var _0x32c70d;_0x32db6c[_0xd13d('0x1b')][_0xd13d('0x1c')]({'where':{'id':_0x57b6c1[_0xd13d('0x1d')]},'raw':!![]})[_0xd13d('0x1e')](function(_0x348da0){_0x32c70d=_0x348da0;if(_0x32c70d&&_0x32c70d[_0xd13d('0x1f')]){switch(_0x32c70d['type']){case _0xd13d('0x20'):var _0x479e9e=require(_0xd13d('0x20'));if(_0x32c70d['accountSid']&&_0x32c70d[_0xd13d('0x21')]&&_0x32c70d[_0xd13d('0x22')]){var _0x54b33f=new _0x479e9e(_0x32c70d[_0xd13d('0x23')],_0x32c70d[_0xd13d('0x21')]);_0x54b33f[_0xd13d('0x24')]['create']({'body':_0x57b6c1[_0xd13d('0x25')],'to':_0xd13d('0x26')+_0x57b6c1[_0xd13d('0x22')],'from':_0xd13d('0x26')+_0x32c70d[_0xd13d('0x22')],'statusCallback':_0x32c70d[_0xd13d('0x27')]+_0xd13d('0x28')+_0x57b6c1['id']+_0xd13d('0x29')+_0x32c70d[_0xd13d('0x2a')]})['then'](function(_0x1effe3){if(_0x1effe3[_0xd13d('0x2b')]){return _0x500ca9[_0xd13d('0x2c')]({'messageId':_0x1effe3[_0xd13d('0x2b')]});}})[_0xd13d('0x19')](function(_0x4c7702){logger[_0xd13d('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd13d('0x20'),util[_0xd13d('0x2d')](_0x4c7702,{'showHidden':![],'depth':null}));});}else{logger[_0xd13d('0x1a')](_0xd13d('0x2e'),_0xd13d('0x2f'),_0xd13d('0x20'),_0xd13d('0x30'));}break;}}})[_0xd13d('0x31')](function(){_0x455b3b();});}else{_0x455b3b();}}},'charset':'utf8mb4','collate':_0xd13d('0x32')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index dd445ca..3ef8df4 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 _0x88e0=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','info','request\x20sent','catch','CreateWhatsappMessage','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x88e0,0x179));var _0x088e=function(_0x3bc52c,_0x3264e2){_0x3bc52c=_0x3bc52c-0x0;var _0xc31e87=_0x88e0[_0x3bc52c];return _0xc31e87;};'use strict';var _=require('lodash');var util=require(_0x088e('0x0'));var moment=require(_0x088e('0x1'));var BPromise=require('bluebird');var rs=require(_0x088e('0x2'));var fs=require('fs');var Redis=require(_0x088e('0x3'));var db=require(_0x088e('0x4'))['db'];var utils=require(_0x088e('0x5'));var logger=require(_0x088e('0x6'))(_0x088e('0x7'));var config=require(_0x088e('0x8'));var jayson=require(_0x088e('0x9'));var client=jayson[_0x088e('0xa')][_0x088e('0xb')]({'port':0x232a});config[_0x088e('0xc')]=_[_0x088e('0xd')](config[_0x088e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x088e('0xe'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x088e('0xf')](socket);function respondWithRpcPromise(_0x5d378f,_0x421859,_0x54c793){return new BPromise(function(_0x8e78fd,_0x54008b){return client['request'](_0x5d378f,_0x54c793)[_0x088e('0x10')](function(_0x2b8c11){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x421859,'request\x20sent');logger[_0x088e('0x11')](_0x088e('0x12'),_0x421859,'request\x20sent',JSON[_0x088e('0x13')](_0x2b8c11));if(_0x2b8c11['error']){if(_0x2b8c11[_0x088e('0x14')][_0x088e('0x15')]===0x1f4){logger[_0x088e('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x421859,_0x2b8c11[_0x088e('0x14')][_0x088e('0x16')]);return _0x54008b(_0x2b8c11[_0x088e('0x14')][_0x088e('0x16')]);}logger[_0x088e('0x14')](_0x088e('0x17'),_0x421859,_0x2b8c11[_0x088e('0x14')]['message']);return _0x8e78fd(_0x2b8c11[_0x088e('0x14')][_0x088e('0x16')]);}else{logger[_0x088e('0x18')](_0x088e('0x17'),_0x421859,_0x088e('0x19'));_0x8e78fd(_0x2b8c11['result'][_0x088e('0x16')]);}})[_0x088e('0x1a')](function(_0x541814){logger[_0x088e('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x421859,_0x541814);_0x54008b(_0x541814);});});}exports[_0x088e('0x1b')]=function(_0x39fc2f){var _0x3611a1=this;return new Promise(function(_0xd8ec42,_0x199e38){return db['WhatsappMessage'][_0x088e('0x1c')](_0x39fc2f[_0x088e('0x1d')],{'raw':_0x39fc2f[_0x088e('0x1e')]?_0x39fc2f[_0x088e('0x1e')][_0x088e('0x1f')]===undefined?!![]:![]:!![]})[_0x088e('0x10')](function(_0x266cb2){logger[_0x088e('0x18')](_0x088e('0x1b'),_0x39fc2f);logger[_0x088e('0x11')](_0x088e('0x1b'),_0x39fc2f,JSON[_0x088e('0x13')](_0x266cb2));_0xd8ec42(_0x266cb2);})[_0x088e('0x1a')](function(_0x3b1b96){logger[_0x088e('0x14')](_0x088e('0x1b'),_0x3b1b96[_0x088e('0x16')],_0x39fc2f);_0x199e38(_0x3611a1[_0x088e('0x14')](0x1f4,_0x3b1b96[_0x088e('0x16')]));});});}; \ No newline at end of file +var _0xd4e4=['redis','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3ec3d0,_0x2b4c24){var _0x4f4e0d=function(_0x459fb7){while(--_0x459fb7){_0x3ec3d0['push'](_0x3ec3d0['shift']());}};_0x4f4e0d(++_0x2b4c24);}(_0xd4e4,0x16a));var _0x4d4e=function(_0x25a97e,_0x4b28f5){_0x25a97e=_0x25a97e-0x0;var _0x43c067=_0xd4e4[_0x25a97e];return _0x43c067;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d4e('0x0'));var BPromise=require(_0x4d4e('0x1'));var rs=require(_0x4d4e('0x2'));var fs=require('fs');var Redis=require(_0x4d4e('0x3'));var db=require(_0x4d4e('0x4'))['db'];var utils=require(_0x4d4e('0x5'));var logger=require(_0x4d4e('0x6'))('rpc');var config=require(_0x4d4e('0x7'));var jayson=require(_0x4d4e('0x8'));var client=jayson[_0x4d4e('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4d4e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d4e('0xb'))(new Redis(config[_0x4d4e('0xa')]));require(_0x4d4e('0xc'))[_0x4d4e('0xd')](socket);function respondWithRpcPromise(_0x5ae6f2,_0x57961c,_0x79fb6){return new BPromise(function(_0x11cbbd,_0x22a17e){return client['request'](_0x5ae6f2,_0x79fb6)[_0x4d4e('0xe')](function(_0x408b49){logger[_0x4d4e('0xf')](_0x4d4e('0x10'),_0x57961c,_0x4d4e('0x11'));logger['debug'](_0x4d4e('0x12'),_0x57961c,_0x4d4e('0x11'),JSON[_0x4d4e('0x13')](_0x408b49));if(_0x408b49['error']){if(_0x408b49[_0x4d4e('0x14')][_0x4d4e('0x15')]===0x1f4){logger[_0x4d4e('0x14')](_0x4d4e('0x10'),_0x57961c,_0x408b49['error'][_0x4d4e('0x16')]);return _0x22a17e(_0x408b49[_0x4d4e('0x14')][_0x4d4e('0x16')]);}logger[_0x4d4e('0x14')](_0x4d4e('0x10'),_0x57961c,_0x408b49['error'][_0x4d4e('0x16')]);return _0x11cbbd(_0x408b49['error']['message']);}else{logger[_0x4d4e('0xf')](_0x4d4e('0x10'),_0x57961c,'request\x20sent');_0x11cbbd(_0x408b49[_0x4d4e('0x17')][_0x4d4e('0x16')]);}})[_0x4d4e('0x18')](function(_0x13b759){logger['error'](_0x4d4e('0x10'),_0x57961c,_0x13b759);_0x22a17e(_0x13b759);});});}exports[_0x4d4e('0x19')]=function(_0x5e3ac2){var _0x21b153=this;return new Promise(function(_0x4cab57,_0x230291){return db[_0x4d4e('0x1a')]['create'](_0x5e3ac2[_0x4d4e('0x1b')],{'raw':_0x5e3ac2[_0x4d4e('0x1c')]?_0x5e3ac2[_0x4d4e('0x1c')][_0x4d4e('0x1d')]===undefined?!![]:![]:!![]})[_0x4d4e('0xe')](function(_0x22f0e6){logger[_0x4d4e('0xf')]('CreateWhatsappMessage',_0x5e3ac2);logger[_0x4d4e('0x1e')]('CreateWhatsappMessage',_0x5e3ac2,JSON[_0x4d4e('0x13')](_0x22f0e6));_0x4cab57(_0x22f0e6);})['catch'](function(_0x56ffbe){logger[_0x4d4e('0x14')](_0x4d4e('0x19'),_0x56ffbe['message'],_0x5e3ac2);_0x230291(_0x21b153[_0x4d4e('0x14')](0x1f4,_0x56ffbe['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1a7b5b1..e72f04f 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 _0xfafa=['whatsappMessage:','./whatsappMessage.events','save','update','removeListener'];(function(_0x4a1ad1,_0x412724){var _0x1d97be=function(_0x4c7685){while(--_0x4c7685){_0x4a1ad1['push'](_0x4a1ad1['shift']());}};_0x1d97be(++_0x412724);}(_0xfafa,0x187));var _0xafaf=function(_0x599db6,_0x2fd973){_0x599db6=_0x599db6-0x0;var _0x752e07=_0xfafa[_0x599db6];return _0x752e07;};'use strict';var WhatsappMessageEvents=require(_0xafaf('0x0'));var events=[_0xafaf('0x1'),'remove',_0xafaf('0x2')];function createListener(_0x405ce3,_0x628b40){return function(_0x267ba7){_0x628b40['emit'](_0x405ce3,_0x267ba7);};}function removeListener(_0x4bdeb7,_0x3426fe){return function(){WhatsappMessageEvents[_0xafaf('0x3')](_0x4bdeb7,_0x3426fe);};}exports['register']=function(_0x22b03d){for(var _0x5276ce=0x0,_0x505ccb=events['length'];_0x5276ce<_0x505ccb;_0x5276ce++){var _0x5ac406=events[_0x5276ce];var _0x50c7b7=createListener(_0xafaf('0x4')+_0x5ac406,_0x22b03d);WhatsappMessageEvents['on'](_0x5ac406,_0x50c7b7);}}; \ No newline at end of file +var _0x1967=['register','./whatsappMessage.events','save','remove','update','emit'];(function(_0x1f5a1f,_0x474158){var _0x23c5f9=function(_0x2c5f91){while(--_0x2c5f91){_0x1f5a1f['push'](_0x1f5a1f['shift']());}};_0x23c5f9(++_0x474158);}(_0x1967,0x1b1));var _0x7196=function(_0xa5f508,_0x20e4d3){_0xa5f508=_0xa5f508-0x0;var _0x142aba=_0x1967[_0xa5f508];return _0x142aba;};'use strict';var WhatsappMessageEvents=require(_0x7196('0x0'));var events=[_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3')];function createListener(_0x2af1c2,_0x3ba92a){return function(_0xdd49c){_0x3ba92a[_0x7196('0x4')](_0x2af1c2,_0xdd49c);};}function removeListener(_0x33ffcb,_0x3a0686){return function(){WhatsappMessageEvents['removeListener'](_0x33ffcb,_0x3a0686);};}exports[_0x7196('0x5')]=function(_0x421c58){for(var _0x52fb9a=0x0,_0x40e122=events['length'];_0x52fb9a<_0x40e122;_0x52fb9a++){var _0x52f1b2=events[_0x52fb9a];var _0x180629=createListener('whatsappMessage:'+_0x52f1b2,_0x421c58);WhatsappMessageEvents['on'](_0x52f1b2,_0x180629);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c443bfa..f50125f 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 _0x6d13=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams'];(function(_0x557497,_0x4ca1f0){var _0x452046=function(_0x6d8f62){while(--_0x6d8f62){_0x557497['push'](_0x557497['shift']());}};_0x452046(++_0x4ca1f0);}(_0x6d13,0xd0));var _0x36d1=function(_0x357f0a,_0x37aa60){_0x357f0a=_0x357f0a-0x0;var _0x10d41b=_0x6d13[_0x357f0a];return _0x10d41b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x36d1('0x0'));var timeout=require(_0x36d1('0x1'));var express=require(_0x36d1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x36d1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x36d1('0x4'));var controller=require(_0x36d1('0x5'));router[_0x36d1('0x6')]('/',auth['isAuthenticated'](),controller[_0x36d1('0x7')]);router[_0x36d1('0x6')](_0x36d1('0x8'),auth['isAuthenticated'](),controller[_0x36d1('0x9')]);router[_0x36d1('0x6')](_0x36d1('0xa'),auth[_0x36d1('0xb')](),controller[_0x36d1('0xc')]);router[_0x36d1('0x6')](_0x36d1('0xd'),auth['isAuthenticated'](),controller[_0x36d1('0xe')]);router[_0x36d1('0x6')](_0x36d1('0xf'),auth[_0x36d1('0xb')](),controller['getTeams']);router['get'](_0x36d1('0x10'),auth[_0x36d1('0xb')](),controller[_0x36d1('0x11')]);router[_0x36d1('0x12')]('/',auth[_0x36d1('0xb')](),controller[_0x36d1('0x13')]);router[_0x36d1('0x12')](_0x36d1('0xf'),auth[_0x36d1('0xb')](),controller[_0x36d1('0x14')]);router['post'](_0x36d1('0x10'),auth[_0x36d1('0xb')](),controller[_0x36d1('0x15')]);router[_0x36d1('0x16')]('/:id',auth[_0x36d1('0xb')](),controller['update']);router[_0x36d1('0x17')]('/:id',auth[_0x36d1('0xb')](),controller[_0x36d1('0x18')]);router[_0x36d1('0x17')]('/:id/teams',auth[_0x36d1('0xb')](),controller[_0x36d1('0x19')]);router['delete'](_0x36d1('0x10'),auth[_0x36d1('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xcde2=['post','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','addTeams'];(function(_0x4699c4,_0x3461e3){var _0x5ac171=function(_0x599eaa){while(--_0x599eaa){_0x4699c4['push'](_0x4699c4['shift']());}};_0x5ac171(++_0x3461e3);}(_0xcde2,0x12a));var _0x2cde=function(_0xecd389,_0x54b3ec){_0xecd389=_0xecd389-0x0;var _0x331a3b=_0xcde2[_0xecd389];return _0x331a3b;};'use strict';var multer=require(_0x2cde('0x0'));var util=require(_0x2cde('0x1'));var path=require('path');var timeout=require(_0x2cde('0x2'));var express=require(_0x2cde('0x3'));var router=express[_0x2cde('0x4')]();var fs_extra=require(_0x2cde('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2cde('0x6'));var config=require(_0x2cde('0x7'));var controller=require(_0x2cde('0x8'));router[_0x2cde('0x9')]('/',auth['isAuthenticated'](),controller[_0x2cde('0xa')]);router['get'](_0x2cde('0xb'),auth[_0x2cde('0xc')](),controller[_0x2cde('0xd')]);router[_0x2cde('0x9')](_0x2cde('0xe'),auth[_0x2cde('0xc')](),controller['show']);router[_0x2cde('0x9')](_0x2cde('0xf'),auth[_0x2cde('0xc')](),controller[_0x2cde('0x10')]);router[_0x2cde('0x9')](_0x2cde('0x11'),auth[_0x2cde('0xc')](),controller['getTeams']);router['get'](_0x2cde('0x12'),auth[_0x2cde('0xc')](),controller[_0x2cde('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2cde('0x11'),auth[_0x2cde('0xc')](),controller[_0x2cde('0x14')]);router[_0x2cde('0x15')](_0x2cde('0x12'),auth[_0x2cde('0xc')](),controller[_0x2cde('0x16')]);router[_0x2cde('0x17')]('/:id',auth[_0x2cde('0xc')](),controller['update']);router['delete']('/:id',auth[_0x2cde('0xc')](),controller[_0x2cde('0x18')]);router[_0x2cde('0x19')](_0x2cde('0x11'),auth[_0x2cde('0xc')](),controller[_0x2cde('0x1a')]);router[_0x2cde('0x19')](_0x2cde('0x12'),auth['isAuthenticated'](),controller[_0x2cde('0x1b')]);module[_0x2cde('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index b754a32..bb7088c 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 _0x13c0=['roundrobin','sequelize','exports','STRING','name','beepall'];(function(_0x5e35fe,_0x2427ab){var _0xad7e84=function(_0x578ae3){while(--_0x578ae3){_0x5e35fe['push'](_0x5e35fe['shift']());}};_0xad7e84(++_0x2427ab);}(_0x13c0,0x79));var _0x013c=function(_0x73b80e,_0x4daa4a){_0x73b80e=_0x73b80e-0x0;var _0x4c31cd=_0x13c0[_0x73b80e];return _0x4c31cd;};'use strict';var Sequelize=require(_0x013c('0x0'));module[_0x013c('0x1')]={'name':{'type':Sequelize[_0x013c('0x2')],'unique':_0x013c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x013c('0x4'),_0x013c('0x5'))},'description':{'type':Sequelize[_0x013c('0x2')]}}; \ No newline at end of file +var _0x5645=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5165d8,_0xc5cb5){var _0xe2bec6=function(_0x1d6f17){while(--_0x1d6f17){_0x5165d8['push'](_0x5165d8['shift']());}};_0xe2bec6(++_0xc5cb5);}(_0x5645,0x19e));var _0x5564=function(_0x348bb5,_0x32c723){_0x348bb5=_0x348bb5-0x0;var _0x4fbc6c=_0x5645[_0x348bb5];return _0x4fbc6c;};'use strict';var Sequelize=require(_0x5564('0x0'));module[_0x5564('0x1')]={'name':{'type':Sequelize[_0x5564('0x2')],'unique':_0x5564('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5564('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5564('0x5'),_0x5564('0x6'),_0x5564('0x7'))},'description':{'type':Sequelize[_0x5564('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 1f31043..10dc9a4 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 _0x35c1=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','order','User','UserId','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','SELECT','TeamId','includes','all','union','compact','value','ids','isEmpty','addAgents','omit','spread','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','name','send','index','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x5d11b8,_0x5c2835){var _0x5c62ae=function(_0x4bb5de){while(--_0x4bb5de){_0x5d11b8['push'](_0x5d11b8['shift']());}};_0x5c62ae(++_0x5c2835);}(_0x35c1,0x175));var _0x135c=function(_0x546f9f,_0xcce640){_0x546f9f=_0x546f9f-0x0;var _0x3513dd=_0x35c1[_0x546f9f];return _0x3513dd;};'use strict';var emlformat=require(_0x135c('0x0'));var rimraf=require(_0x135c('0x1'));var zipdir=require(_0x135c('0x2'));var jsonpatch=require(_0x135c('0x3'));var rp=require('request-promise');var moment=require(_0x135c('0x4'));var BPromise=require(_0x135c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x135c('0x6'));var csv=require('to-csv');var ejs=require(_0x135c('0x7'));var fs=require('fs');var fs_extra=require(_0x135c('0x8'));var _=require(_0x135c('0x9'));var squel=require(_0x135c('0xa'));var crypto=require(_0x135c('0xb'));var jsforce=require(_0x135c('0xc'));var deskjs=require(_0x135c('0xd'));var toCsv=require(_0x135c('0xe'));var querystring=require(_0x135c('0xf'));var Papa=require(_0x135c('0x10'));var Redis=require(_0x135c('0x11'));var authService=require(_0x135c('0x12'));var qs=require(_0x135c('0x13'));var as=require(_0x135c('0x14'));var hardwareService=require(_0x135c('0x15'));var logger=require(_0x135c('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x135c('0x17'));var licenseUtil=require(_0x135c('0x18'));var db=require(_0x135c('0x19'))['db'];config[_0x135c('0x1a')]=_['defaults'](config['redis'],{'host':_0x135c('0x1b'),'port':0x18eb});var socket=require(_0x135c('0x1c'))(new Redis(config[_0x135c('0x1a')]));require(_0x135c('0x1d'))[_0x135c('0x1e')](socket);function respondWithStatusCode(_0x384f22,_0x1d838e){_0x1d838e=_0x1d838e||0xcc;return function(_0x3d7997){if(_0x3d7997){return _0x384f22[_0x135c('0x1f')](_0x1d838e);}return _0x384f22['status'](_0x1d838e)[_0x135c('0x20')]();};}function respondWithResult(_0x18d61d,_0x598bae){_0x598bae=_0x598bae||0xc8;return function(_0x1ebc0a){if(_0x1ebc0a){return _0x18d61d[_0x135c('0x21')](_0x598bae)[_0x135c('0x22')](_0x1ebc0a);}};}function respondWithFilteredResult(_0x5a57a6,_0x246f70){return function(_0x59c37b){if(_0x59c37b){var _0x8ff7f9=typeof _0x246f70[_0x135c('0x23')]===_0x135c('0x24')&&typeof _0x246f70['limit']===_0x135c('0x24');var _0x17849e=_0x59c37b['count'];var _0x14f97a=_0x8ff7f9?0x0:_0x246f70[_0x135c('0x23')];var _0x143e46=_0x8ff7f9?_0x59c37b[_0x135c('0x25')]:_0x246f70[_0x135c('0x23')]+_0x246f70[_0x135c('0x26')];var _0x158ba7;if(_0x143e46>=_0x17849e){_0x143e46=_0x17849e;_0x158ba7=0xc8;}else{_0x158ba7=0xce;}_0x5a57a6[_0x135c('0x21')](_0x158ba7);return _0x5a57a6['set']('Content-Range',_0x14f97a+'-'+_0x143e46+'/'+_0x17849e)[_0x135c('0x22')](_0x59c37b);}return null;};}function patchUpdates(_0x53e3d3){return function(_0x310fa0){try{jsonpatch['apply'](_0x310fa0,_0x53e3d3,!![]);}catch(_0x48f0e2){return BPromise[_0x135c('0x27')](_0x48f0e2);}return _0x310fa0[_0x135c('0x28')]();};}function saveUpdates(_0x3bb5ec,_0x2b68e1){return function(_0x236ca4){if(_0x236ca4){return _0x236ca4[_0x135c('0x29')](_0x3bb5ec)[_0x135c('0x2a')](function(_0x41770c){return _0x41770c;});}return null;};}function removeEntity(_0x50b90c,_0x5d92b7){return function(_0x21b927){if(_0x21b927){return _0x21b927[_0x135c('0x2b')]()[_0x135c('0x2a')](function(){var _0x5e752e=_0x21b927[_0x135c('0x2c')]({'plain':!![]});var _0x20a9cd=_0x135c('0x2d');return db[_0x135c('0x2e')][_0x135c('0x2b')]({'where':{'type':_0x20a9cd,'resourceId':_0x5e752e['id']}})['then'](function(){return _0x21b927;});})[_0x135c('0x2a')](function(){_0x50b90c['status'](0xcc)[_0x135c('0x20')]();});}};}function handleEntityNotFound(_0x4be801,_0x577ed2){return function(_0x25fdfa){if(!_0x25fdfa){_0x4be801[_0x135c('0x1f')](0x194);}return _0x25fdfa;};}function handleError(_0x28fbcf,_0x5522b0){_0x5522b0=_0x5522b0||0x1f4;return function(_0x2b585c){logger['error'](_0x2b585c['stack']);if(_0x2b585c[_0x135c('0x2f')]){delete _0x2b585c[_0x135c('0x2f')];}_0x28fbcf['status'](_0x5522b0)[_0x135c('0x30')](_0x2b585c);};}exports[_0x135c('0x31')]=function(_0x3198c1,_0x5b6c2c){var _0x551d82={},_0xf1474f={},_0x28054c={'count':0x0,'rows':[]};var _0x8b30b9=_['map'](db['WhatsappQueue'][_0x135c('0x32')],function(_0x44d34b){return{'name':_0x44d34b['fieldName'],'type':_0x44d34b[_0x135c('0x33')][_0x135c('0x34')]};});_0xf1474f['model']=_[_0x135c('0x35')](_0x8b30b9,_0x135c('0x2f'));_0xf1474f[_0x135c('0x36')]=_['keys'](_0x3198c1['query']);_0xf1474f[_0x135c('0x37')]=_[_0x135c('0x38')](_0xf1474f[_0x135c('0x39')],_0xf1474f[_0x135c('0x36')]);_0x551d82[_0x135c('0x3a')]=_[_0x135c('0x38')](_0xf1474f['model'],qs[_0x135c('0x3b')](_0x3198c1['query'][_0x135c('0x3b')]));_0x551d82[_0x135c('0x3a')]=_0x551d82[_0x135c('0x3a')][_0x135c('0x3c')]?_0x551d82[_0x135c('0x3a')]:_0xf1474f[_0x135c('0x39')];if(!_0x3198c1[_0x135c('0x36')][_0x135c('0x3d')](_0x135c('0x3e'))){_0x551d82[_0x135c('0x26')]=qs[_0x135c('0x26')](_0x3198c1[_0x135c('0x36')][_0x135c('0x26')]);_0x551d82[_0x135c('0x23')]=qs[_0x135c('0x23')](_0x3198c1[_0x135c('0x36')][_0x135c('0x23')]);}_0x551d82['order']=qs[_0x135c('0x3f')](_0x3198c1[_0x135c('0x36')][_0x135c('0x3f')]);_0x551d82[_0x135c('0x40')]=qs[_0x135c('0x37')](_[_0x135c('0x41')](_0x3198c1[_0x135c('0x36')],_0xf1474f[_0x135c('0x37')]),_0x8b30b9);if(_0x3198c1[_0x135c('0x36')][_0x135c('0x42')]){_0x551d82[_0x135c('0x40')]=_[_0x135c('0x43')](_0x551d82[_0x135c('0x40')],{'$or':_[_0x135c('0x35')](_0x8b30b9,function(_0x28550f){if(_0x28550f[_0x135c('0x33')]!==_0x135c('0x44')){var _0x2958d7={};_0x2958d7[_0x28550f[_0x135c('0x2f')]]={'$like':'%'+_0x3198c1[_0x135c('0x36')]['filter']+'%'};return _0x2958d7;}})});}_0x551d82=_['merge']({},_0x551d82,_0x3198c1[_0x135c('0x45')]);var _0x44dec1={'where':_0x551d82[_0x135c('0x40')]};return db[_0x135c('0x46')][_0x135c('0x25')](_0x44dec1)['then'](function(_0x5e5ff8){_0x28054c['count']=_0x5e5ff8;if(_0x3198c1[_0x135c('0x36')][_0x135c('0x47')]){_0x551d82[_0x135c('0x48')]=[{'all':!![]}];}return db[_0x135c('0x46')][_0x135c('0x49')](_0x551d82);})['then'](function(_0x5ebf6d){_0x28054c[_0x135c('0x4a')]=_0x5ebf6d;return _0x28054c;})[_0x135c('0x2a')](respondWithFilteredResult(_0x5b6c2c,_0x551d82))[_0x135c('0x4b')](handleError(_0x5b6c2c,null));};exports[_0x135c('0x4c')]=function(_0x4282ab,_0x52f478){var _0x270219={'raw':!![],'where':{'id':_0x4282ab[_0x135c('0x4d')]['id']}},_0x3e0d13={};_0x3e0d13['model']=_[_0x135c('0x4e')](db[_0x135c('0x46')][_0x135c('0x32')]);_0x3e0d13[_0x135c('0x36')]=_[_0x135c('0x4e')](_0x4282ab[_0x135c('0x36')]);_0x3e0d13[_0x135c('0x37')]=_[_0x135c('0x38')](_0x3e0d13[_0x135c('0x39')],_0x3e0d13[_0x135c('0x36')]);_0x270219[_0x135c('0x3a')]=_[_0x135c('0x38')](_0x3e0d13[_0x135c('0x39')],qs[_0x135c('0x3b')](_0x4282ab[_0x135c('0x36')]['fields']));_0x270219[_0x135c('0x3a')]=_0x270219['attributes'][_0x135c('0x3c')]?_0x270219[_0x135c('0x3a')]:_0x3e0d13['model'];if(_0x4282ab[_0x135c('0x36')][_0x135c('0x47')]){_0x270219[_0x135c('0x48')]=[{'all':!![]}];}_0x270219=_['merge']({},_0x270219,_0x4282ab[_0x135c('0x45')]);return db[_0x135c('0x46')][_0x135c('0x4f')](_0x270219)[_0x135c('0x2a')](handleEntityNotFound(_0x52f478,null))[_0x135c('0x2a')](respondWithResult(_0x52f478,null))[_0x135c('0x4b')](handleError(_0x52f478,null));};exports[_0x135c('0x50')]=function(_0x2437e6,_0x4df6ee){return db[_0x135c('0x46')]['create'](_0x2437e6[_0x135c('0x51')],{})[_0x135c('0x2a')](function(_0xb323a0){var _0x5252a8=_0x2437e6['user'][_0x135c('0x2c')]({'plain':!![]});if(!_0x5252a8)throw new Error(_0x135c('0x52'));if(_0x5252a8[_0x135c('0x53')]===_0x135c('0x54')){var _0x348336=_0xb323a0[_0x135c('0x2c')]({'plain':!![]});var _0x37d978=_0x135c('0x2d');return db[_0x135c('0x55')][_0x135c('0x4f')]({'where':{'name':_0x37d978,'userProfileId':_0x5252a8[_0x135c('0x56')]},'raw':!![]})[_0x135c('0x2a')](function(_0x3a4937){if(_0x3a4937&&_0x3a4937[_0x135c('0x57')]===0x0){return db['UserProfileResource'][_0x135c('0x50')]({'name':_0x348336['name'],'resourceId':_0x348336['id'],'type':_0x3a4937[_0x135c('0x2f')],'sectionId':_0x3a4937['id']},{})[_0x135c('0x2a')](function(){return _0xb323a0;});}else{return _0xb323a0;}})[_0x135c('0x4b')](function(_0x15fbf2){logger[_0x135c('0x58')](_0x135c('0x59'),_0x15fbf2);throw _0x15fbf2;});}return _0xb323a0;})[_0x135c('0x2a')](respondWithResult(_0x4df6ee,0xc9))[_0x135c('0x4b')](handleError(_0x4df6ee,null));};exports['update']=function(_0x317c93,_0x1365b8){if(_0x317c93[_0x135c('0x51')]['id']){delete _0x317c93[_0x135c('0x51')]['id'];}return db['WhatsappQueue'][_0x135c('0x4f')]({'where':{'id':_0x317c93[_0x135c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1365b8,null))[_0x135c('0x2a')](saveUpdates(_0x317c93[_0x135c('0x51')],null))[_0x135c('0x2a')](respondWithResult(_0x1365b8,null))[_0x135c('0x4b')](handleError(_0x1365b8,null));};exports[_0x135c('0x2b')]=function(_0x25dad9,_0x42b0cd){return db['WhatsappQueue'][_0x135c('0x4f')]({'where':{'id':_0x25dad9[_0x135c('0x4d')]['id']}})[_0x135c('0x2a')](handleEntityNotFound(_0x42b0cd,null))[_0x135c('0x2a')](removeEntity(_0x42b0cd,null))['catch'](handleError(_0x42b0cd,null));};exports[_0x135c('0x5a')]=function(_0x173b88,_0x42946a){return db[_0x135c('0x46')][_0x135c('0x5a')]()[_0x135c('0x2a')](respondWithResult(_0x42946a,null))[_0x135c('0x4b')](handleError(_0x42946a,null));};exports[_0x135c('0x5b')]=function(_0x546b80,_0x258a1e,_0x5526c1){var _0x3f2f56={'raw':!![],'where':{}},_0x1f441c={},_0x3ec9fb;return db[_0x135c('0x46')][_0x135c('0x5c')]({'where':{'id':_0x546b80[_0x135c('0x4d')]['id']}})[_0x135c('0x2a')](handleEntityNotFound(_0x258a1e,null))[_0x135c('0x2a')](function(_0x4c9c0d){if(_0x4c9c0d){_0x3ec9fb=_0x4c9c0d['get']({'plain':!![]});_0x1f441c[_0x135c('0x39')]=_['keys'](db[_0x135c('0x5d')][_0x135c('0x32')]);_0x1f441c['query']=_[_0x135c('0x4e')](_0x546b80[_0x135c('0x36')]);_0x1f441c[_0x135c('0x37')]=_['intersection'](_0x1f441c['model'],_0x1f441c[_0x135c('0x36')]);_0x3f2f56[_0x135c('0x3a')]=_[_0x135c('0x38')](_0x1f441c['model'],qs[_0x135c('0x3b')](_0x546b80[_0x135c('0x36')][_0x135c('0x3b')]));_0x3f2f56[_0x135c('0x3a')]=_0x3f2f56['attributes'][_0x135c('0x3c')]?_0x3f2f56['attributes']:_0x1f441c['model'];if(!_0x546b80[_0x135c('0x36')]['hasOwnProperty'](_0x135c('0x3e'))){_0x3f2f56[_0x135c('0x26')]=qs[_0x135c('0x26')](_0x546b80[_0x135c('0x36')]['limit']);_0x3f2f56[_0x135c('0x23')]=qs[_0x135c('0x23')](_0x546b80[_0x135c('0x36')]['offset']);}_0x3f2f56[_0x135c('0x5e')]=qs[_0x135c('0x3f')](_0x546b80['query'][_0x135c('0x3f')]);_0x3f2f56[_0x135c('0x40')]=qs['filters'](_[_0x135c('0x41')](_0x546b80['query'],_0x1f441c['filters']));_0x3f2f56['where']['WhatsappQueueId']=_0x4c9c0d['id'];if(_0x546b80['query'][_0x135c('0x42')]){_0x3f2f56[_0x135c('0x40')]=_['merge'](_0x3f2f56[_0x135c('0x40')],{'$or':_[_0x135c('0x35')](_0x3f2f56[_0x135c('0x3a')],function(_0xe1dc32){var _0x6ed143={};_0x6ed143[_0xe1dc32]={'$like':'%'+_0x546b80[_0x135c('0x36')][_0x135c('0x42')]+'%'};return _0x6ed143;})});}_0x3f2f56=_[_0x135c('0x43')]({},_0x3f2f56,_0x546b80[_0x135c('0x45')]);return db[_0x135c('0x5d')][_0x135c('0x49')](_0x3f2f56);}})['then'](function(_0x12ae2c){if(_0x12ae2c){return db[_0x135c('0x5f')]['findAndCountAll']({'where':{'id':_[_0x135c('0x35')](_0x12ae2c,_0x135c('0x60')),'role':'agent'},'attributes':['id',_0x135c('0x2f'),_0x135c('0x61'),'updatedAt',_0x135c('0x62')]});}})[_0x135c('0x2a')](function(_0x4831b9){if(_0x4831b9){return{'count':_0x4831b9[_0x135c('0x25')],'rows':_[_0x135c('0x35')](_0x4831b9['rows'],function(_0x1bee38){return{'membername':_0x1bee38['name'],'UserId':_0x1bee38['id'],'queue_name':_0x3ec9fb[_0x135c('0x2f')],'WhatsappQueueId':_0x3ec9fb['id'],'interface':util[_0x135c('0x63')](_0x135c('0x64'),_0x135c('0x65'),_0x1bee38['name']),'penalty':0x0,'paused':_0x1bee38[_0x135c('0x61')],'createdAt':_0x1bee38[_0x135c('0x62')],'updatedAt':_0x1bee38[_0x135c('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x135c('0x2a')](respondWithFilteredResult(_0x258a1e,_0x3f2f56))['catch'](handleError(_0x258a1e,null));};exports[_0x135c('0x67')]=function(_0x50b973,_0x1cb75c,_0x40990c){var _0x2e01d1={};var _0x4f4c7a={};var _0x52631a;var _0x221d67;return db['WhatsappQueue'][_0x135c('0x5c')]({'where':{'id':_0x50b973['params']['id']}})[_0x135c('0x2a')](handleEntityNotFound(_0x1cb75c,null))['then'](function(_0x18ddd6){if(_0x18ddd6){_0x52631a=_0x18ddd6;_0x4f4c7a['model']=_[_0x135c('0x4e')](db[_0x135c('0x68')][_0x135c('0x32')]);_0x4f4c7a['query']=_['keys'](_0x50b973['query']);_0x4f4c7a['filters']=_[_0x135c('0x38')](_0x4f4c7a['model'],_0x4f4c7a['query']);_0x2e01d1[_0x135c('0x3a')]=_[_0x135c('0x38')](_0x4f4c7a[_0x135c('0x39')],qs[_0x135c('0x3b')](_0x50b973[_0x135c('0x36')][_0x135c('0x3b')]));_0x2e01d1['attributes']=_0x2e01d1[_0x135c('0x3a')][_0x135c('0x3c')]?_0x2e01d1['attributes']:_0x4f4c7a[_0x135c('0x39')];_0x2e01d1['order']=qs[_0x135c('0x3f')](_0x50b973[_0x135c('0x36')][_0x135c('0x3f')]);_0x2e01d1[_0x135c('0x40')]=qs[_0x135c('0x37')](_[_0x135c('0x41')](_0x50b973[_0x135c('0x36')],_0x4f4c7a[_0x135c('0x37')]));if(_0x50b973['query'][_0x135c('0x42')]){_0x2e01d1['where']=_[_0x135c('0x43')](_0x2e01d1['where'],{'$or':_[_0x135c('0x35')](_0x2e01d1[_0x135c('0x3a')],function(_0x462151){var _0x141d4d={};_0x141d4d[_0x462151]={'$like':'%'+_0x50b973[_0x135c('0x36')]['filter']+'%'};return _0x141d4d;})});}_0x2e01d1=_[_0x135c('0x43')]({},_0x2e01d1,_0x50b973[_0x135c('0x45')]);return _0x52631a['getTeams'](_0x2e01d1);}})[_0x135c('0x2a')](function(_0x4e0523){if(_0x4e0523){_0x221d67=_0x4e0523[_0x135c('0x3c')];if(!_0x50b973[_0x135c('0x36')][_0x135c('0x3d')]('nolimit')){_0x2e01d1[_0x135c('0x26')]=qs[_0x135c('0x26')](_0x50b973[_0x135c('0x36')]['limit']);_0x2e01d1['offset']=qs['offset'](_0x50b973[_0x135c('0x36')][_0x135c('0x23')]);}return _0x52631a[_0x135c('0x67')](_0x2e01d1);}})[_0x135c('0x2a')](function(_0x42e889){if(_0x42e889){return _0x42e889?{'count':_0x221d67,'rows':_0x42e889}:null;}})[_0x135c('0x2a')](respondWithResult(_0x1cb75c,null))[_0x135c('0x4b')](handleError(_0x1cb75c,null));};exports[_0x135c('0x69')]=function(_0xfff66c,_0x123f76,_0x2cd90e){var _0x163f15=_0xfff66c[_0x135c('0x51')]['ids'];return db[_0x135c('0x68')][_0x135c('0x49')]({'where':{'id':_0x163f15},'attributes':['id'],'include':[{'model':db[_0x135c('0x5f')],'as':_0x135c('0x6a'),'attributes':['id',_0x135c('0x2f'),_0x135c('0x6b'),_0x135c('0x6c'),_0x135c('0x6d')],'raw':!![]}]})[_0x135c('0x2a')](function(_0x435b50){if(_0x435b50){var _0xccd92b=_[_0x135c('0x6e')](_0x435b50,function(_0x4eb207){var _0x223168=_0x4eb207[_0x135c('0x2c')]({'plain':!![]});return _0x223168[_0x135c('0x6a')];});return db['WhatsappQueue'][_0x135c('0x4f')]({'where':{'id':_0xfff66c[_0x135c('0x4d')]['id']}})[_0x135c('0x2a')](function(_0x58634b){return db['sequelize'][_0x135c('0x6f')](function(_0x558542){return _0x58634b[_0x135c('0x69')](_0x163f15,{'transaction':_0x558542})[_0x135c('0x2a')](function(){return BPromise[_0x135c('0x70')](_0xccd92b,function(_0x3efa64){return db[_0x135c('0x5d')][_0x135c('0x71')]({'where':{'UserId':_0x3efa64['id'],'WhatsappQueueId':_0xfff66c[_0x135c('0x4d')]['id']},'transaction':_0x558542});});})['then'](function(){_0xccd92b[_0x135c('0x72')](function(_0x1e0243){socket[_0x135c('0x73')](_0x135c('0x74'),{'UserId':_0x1e0243['id'],'WhatsappQueueId':_0x58634b['id']});});});});});}})[_0x135c('0x2a')](respondWithStatusCode(_0x123f76,null))[_0x135c('0x4b')](handleError(_0x123f76,null));};exports[_0x135c('0x75')]=function(_0x4ae5b4,_0xab25b0,_0x287d6e){return db['Team'][_0x135c('0x49')]({'where':{'id':_0x4ae5b4[_0x135c('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x135c('0x5f')],'as':_0x135c('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x135c('0x2a')](handleEntityNotFound(_0xab25b0,null))[_0x135c('0x2a')](function(_0x1a5b22){var _0x5b95a5=_['map'](_0x1a5b22,'id');var _0x4506e0=[];var _0x4faab6=[];var _0x2b775c=squel[_0x135c('0x76')]();_0x2b775c[_0x135c('0x77')]('tq.TeamId')[_0x135c('0x78')](_0x135c('0x79'),'tq')[_0x135c('0x7a')](_0x135c('0x7b'),'ut',_0x135c('0x7c'))[_0x135c('0x40')](_0x135c('0x7d'),_0x4ae5b4[_0x135c('0x4d')]['id']);for(var _0x41139d=0x0;_0x41139d<_0x1a5b22[_0x135c('0x3c')];_0x41139d+=0x1){let _0x223bb4=_0x1a5b22[_0x41139d];for(var _0x21f845=0x0;_0x21f845<_0x223bb4[_0x135c('0x6a')]['length'];_0x21f845+=0x1){let _0x13261c=_0x223bb4[_0x135c('0x6a')][_0x21f845];var _0xbe6552=_0x2b775c[_0x135c('0x7e')]();_0xbe6552[_0x135c('0x40')](_0x135c('0x7f'),_0x13261c['id']);_0x4faab6['push'](db[_0x135c('0x80')][_0x135c('0x36')](_0xbe6552[_0x135c('0x81')](),{'type':db[_0x135c('0x80')]['QueryTypes'][_0x135c('0x82')]})[_0x135c('0x2a')](function(_0x5e277a){if(_0x5e277a[_0x135c('0x3c')]===0x1){return _0x13261c['id'];}else{var _0xe2d5e6=_['every'](_[_0x135c('0x35')](_0x5e277a,_0x135c('0x83')),function(_0x430a8a){return _[_0x135c('0x84')](_0x5b95a5,_0x430a8a);});if(_0xe2d5e6){return _0x13261c['id'];}}}));}}return BPromise[_0x135c('0x85')](_0x4faab6)[_0x135c('0x2a')](function(_0x5028ed){_0x4506e0=_(_0x4506e0)[_0x135c('0x86')](_0x5028ed)[_0x135c('0x87')]()[_0x135c('0x88')]();return db[_0x135c('0x46')][_0x135c('0x4f')]({'where':{'id':_0x4ae5b4['params']['id']}})['then'](function(_0x353e71){return db[_0x135c('0x80')][_0x135c('0x6f')](function(_0x14e19b){return _0x353e71['removeTeams'](_0x4ae5b4[_0x135c('0x36')][_0x135c('0x89')],{'transaction':_0x14e19b})[_0x135c('0x2a')](function(){if(!_[_0x135c('0x8a')](_0x4506e0)){return _0x353e71['removeAgents'](_0x4506e0,{'transaction':_0x14e19b});}})[_0x135c('0x2a')](function(){_0x4506e0['forEach'](function(_0x101975){socket[_0x135c('0x73')]('userWhatsappQueue:remove',{'UserId':_0x101975,'WhatsappQueueId':_0x353e71['id']});});});});});});})[_0x135c('0x2a')](respondWithStatusCode(_0xab25b0,null))[_0x135c('0x4b')](handleError(_0xab25b0,null));};exports[_0x135c('0x8b')]=function(_0xd7c3eb,_0x270da5,_0x297337){return db[_0x135c('0x46')]['find']({'where':{'id':_0xd7c3eb['params']['id']}})['then'](handleEntityNotFound(_0x270da5,null))[_0x135c('0x2a')](function(_0x466ba9){if(_0x466ba9){return _0x466ba9[_0x135c('0x8b')](_0xd7c3eb[_0x135c('0x51')][_0x135c('0x89')],_[_0x135c('0x8c')](_0xd7c3eb[_0x135c('0x51')],['ids','id'])||{})[_0x135c('0x8d')](function(_0x14474e){for(var _0x31580f=0x0;_0x31580f<_0xd7c3eb[_0x135c('0x51')][_0x135c('0x89')]['length'];_0x31580f+=0x1){socket['emit'](_0x135c('0x74'),{'UserId':Number(_0xd7c3eb[_0x135c('0x51')][_0x135c('0x89')][_0x31580f]),'WhatsappQueueId':Number(_0xd7c3eb['params']['id'])});}return _0x14474e;});}})[_0x135c('0x2a')](respondWithResult(_0x270da5,null))[_0x135c('0x4b')](handleError(_0x270da5,null));};exports['removeAgents']=function(_0x44174c,_0x31b291,_0x1f003a){return db[_0x135c('0x46')][_0x135c('0x4f')]({'where':{'id':_0x44174c[_0x135c('0x4d')]['id']}})[_0x135c('0x2a')](handleEntityNotFound(_0x31b291,null))[_0x135c('0x2a')](function(_0x3debac){if(_0x3debac){return _0x3debac[_0x135c('0x8e')](_0x44174c['query'][_0x135c('0x89')])[_0x135c('0x2a')](function(){if(_['isArray'](_0x44174c[_0x135c('0x36')][_0x135c('0x89')])){for(var _0x3f3182=0x0;_0x3f3182<_0x44174c[_0x135c('0x36')][_0x135c('0x89')][_0x135c('0x3c')];_0x3f3182+=0x1){socket['emit'](_0x135c('0x8f'),{'UserId':Number(_0x44174c[_0x135c('0x36')][_0x135c('0x89')][_0x3f3182]),'WhatsappQueueId':Number(_0x44174c['params']['id'])});}}else{socket[_0x135c('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x44174c[_0x135c('0x36')][_0x135c('0x89')]),'WhatsappQueueId':Number(_0x44174c[_0x135c('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x31b291,null))[_0x135c('0x4b')](handleError(_0x31b291,null));};exports[_0x135c('0x90')]=function(_0x32ea29,_0x34f642,_0x13e7a4){var _0xb5309d={};var _0xd8fd56={};var _0x560f80;var _0x38cdce;return db[_0x135c('0x46')]['findOne']({'where':{'id':_0x32ea29[_0x135c('0x4d')]['id']}})[_0x135c('0x2a')](handleEntityNotFound(_0x34f642,null))[_0x135c('0x2a')](function(_0x502ce7){if(_0x502ce7){_0x560f80=_0x502ce7;_0xd8fd56[_0x135c('0x39')]=_[_0x135c('0x4e')](db[_0x135c('0x5f')][_0x135c('0x32')]);_0xd8fd56['query']=_['keys'](_0x32ea29[_0x135c('0x36')]);_0xd8fd56[_0x135c('0x37')]=_[_0x135c('0x38')](_0xd8fd56[_0x135c('0x39')],_0xd8fd56[_0x135c('0x36')]);_0xb5309d['attributes']=_[_0x135c('0x38')](_0xd8fd56[_0x135c('0x39')],qs['fields'](_0x32ea29[_0x135c('0x36')][_0x135c('0x3b')]));_0xb5309d['attributes']=_0xb5309d[_0x135c('0x3a')][_0x135c('0x3c')]?_0xb5309d[_0x135c('0x3a')]:_0xd8fd56[_0x135c('0x39')];_0xb5309d['order']=qs[_0x135c('0x3f')](_0x32ea29[_0x135c('0x36')][_0x135c('0x3f')]);_0xb5309d[_0x135c('0x40')]=qs[_0x135c('0x37')](_[_0x135c('0x41')](_0x32ea29[_0x135c('0x36')],_0xd8fd56[_0x135c('0x37')]));if(_0x32ea29['query'][_0x135c('0x42')]){_0xb5309d['where']=_['merge'](_0xb5309d['where'],{'$or':_[_0x135c('0x35')](_0xb5309d[_0x135c('0x3a')],function(_0xb50ccf){var _0x14586b={};_0x14586b[_0xb50ccf]={'$like':'%'+_0x32ea29[_0x135c('0x36')][_0x135c('0x42')]+'%'};return _0x14586b;})});}_0xb5309d=_[_0x135c('0x43')]({},_0xb5309d,_0x32ea29[_0x135c('0x45')]);return _0x560f80['getAgents'](_0xb5309d);}})['then'](function(_0x19927e){if(_0x19927e){_0x38cdce=_0x19927e[_0x135c('0x3c')];if(!_0x32ea29[_0x135c('0x36')][_0x135c('0x3d')](_0x135c('0x3e'))){_0xb5309d[_0x135c('0x26')]=qs[_0x135c('0x26')](_0x32ea29[_0x135c('0x36')][_0x135c('0x26')]);_0xb5309d['offset']=qs[_0x135c('0x23')](_0x32ea29[_0x135c('0x36')][_0x135c('0x23')]);}return _0x560f80['getAgents'](_0xb5309d);}})[_0x135c('0x2a')](function(_0xfb331a){if(_0xfb331a){return _0xfb331a?{'count':_0x38cdce,'rows':_0xfb331a}:null;}})[_0x135c('0x2a')](respondWithResult(_0x34f642,null))[_0x135c('0x4b')](handleError(_0x34f642,null));}; \ No newline at end of file +var _0xf790=['merge','options','where','includeAll','findAll','rows','catch','params','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','find','destroy','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','UserId','agent','whatsappPause','createdAt','%s/%s','updatedAt','getTeams','hasOwnProperty','addTeams','ids','User','online','interface','flatMap','Agents','sequelize','each','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','forEach','addAgents','omit','spread','removeAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','WhatsappQueues','name','send','WhatsappQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','order','sort','pick','filter','type','VIRTUAL'];(function(_0x124bf2,_0x1e0919){var _0x197fc2=function(_0x4b41fd){while(--_0x4b41fd){_0x124bf2['push'](_0x124bf2['shift']());}};_0x197fc2(++_0x1e0919);}(_0xf790,0xd8));var _0x0f79=function(_0x47a52b,_0x30c6db){_0x47a52b=_0x47a52b-0x0;var _0xadbba5=_0xf790[_0x47a52b];return _0xadbba5;};'use strict';var emlformat=require(_0x0f79('0x0'));var rimraf=require(_0x0f79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f79('0x2'));var BPromise=require(_0x0f79('0x3'));var Mustache=require(_0x0f79('0x4'));var util=require(_0x0f79('0x5'));var path=require(_0x0f79('0x6'));var sox=require(_0x0f79('0x7'));var csv=require(_0x0f79('0x8'));var ejs=require(_0x0f79('0x9'));var fs=require('fs');var fs_extra=require(_0x0f79('0xa'));var _=require(_0x0f79('0xb'));var squel=require(_0x0f79('0xc'));var crypto=require(_0x0f79('0xd'));var jsforce=require(_0x0f79('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0f79('0xf'));var Redis=require(_0x0f79('0x10'));var authService=require(_0x0f79('0x11'));var qs=require(_0x0f79('0x12'));var as=require(_0x0f79('0x13'));var hardwareService=require(_0x0f79('0x14'));var logger=require(_0x0f79('0x15'))('api');var utils=require(_0x0f79('0x16'));var config=require(_0x0f79('0x17'));var licenseUtil=require(_0x0f79('0x18'));var db=require(_0x0f79('0x19'))['db'];config[_0x0f79('0x1a')]=_[_0x0f79('0x1b')](config[_0x0f79('0x1a')],{'host':_0x0f79('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f79('0x1d'))['register'](socket);function respondWithStatusCode(_0x42f2c3,_0x11ccb1){_0x11ccb1=_0x11ccb1||0xcc;return function(_0x3c8891){if(_0x3c8891){return _0x42f2c3[_0x0f79('0x1e')](_0x11ccb1);}return _0x42f2c3[_0x0f79('0x1f')](_0x11ccb1)[_0x0f79('0x20')]();};}function respondWithResult(_0x27fad1,_0x1bf20e){_0x1bf20e=_0x1bf20e||0xc8;return function(_0x3cf0e3){if(_0x3cf0e3){return _0x27fad1['status'](_0x1bf20e)[_0x0f79('0x21')](_0x3cf0e3);}};}function respondWithFilteredResult(_0x580c68,_0x590e23){return function(_0xafc79){if(_0xafc79){var _0x19653a=typeof _0x590e23[_0x0f79('0x22')]==='undefined'&&typeof _0x590e23[_0x0f79('0x23')]===_0x0f79('0x24');var _0x1fc482=_0xafc79[_0x0f79('0x25')];var _0x41965d=_0x19653a?0x0:_0x590e23[_0x0f79('0x22')];var _0x380355=_0x19653a?_0xafc79[_0x0f79('0x25')]:_0x590e23[_0x0f79('0x22')]+_0x590e23[_0x0f79('0x23')];var _0x3bf843;if(_0x380355>=_0x1fc482){_0x380355=_0x1fc482;_0x3bf843=0xc8;}else{_0x3bf843=0xce;}_0x580c68[_0x0f79('0x1f')](_0x3bf843);return _0x580c68[_0x0f79('0x26')](_0x0f79('0x27'),_0x41965d+'-'+_0x380355+'/'+_0x1fc482)[_0x0f79('0x21')](_0xafc79);}return null;};}function patchUpdates(_0x2df003){return function(_0x2035b1){try{jsonpatch['apply'](_0x2035b1,_0x2df003,!![]);}catch(_0x135fa4){return BPromise[_0x0f79('0x28')](_0x135fa4);}return _0x2035b1[_0x0f79('0x29')]();};}function saveUpdates(_0x474cd2,_0xd16408){return function(_0x4490c7){if(_0x4490c7){return _0x4490c7[_0x0f79('0x2a')](_0x474cd2)[_0x0f79('0x2b')](function(_0x7ad460){return _0x7ad460;});}return null;};}function removeEntity(_0x4f1295,_0x4a9b34){return function(_0x54c10d){if(_0x54c10d){return _0x54c10d['destroy']()[_0x0f79('0x2b')](function(){var _0x306f4e=_0x54c10d[_0x0f79('0x2c')]({'plain':!![]});var _0x527236=_0x0f79('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x527236,'resourceId':_0x306f4e['id']}})['then'](function(){return _0x54c10d;});})[_0x0f79('0x2b')](function(){_0x4f1295['status'](0xcc)[_0x0f79('0x20')]();});}};}function handleEntityNotFound(_0x3f1da4,_0x576ff9){return function(_0x50c2fe){if(!_0x50c2fe){_0x3f1da4[_0x0f79('0x1e')](0x194);}return _0x50c2fe;};}function handleError(_0xd5c72c,_0x18fd2a){_0x18fd2a=_0x18fd2a||0x1f4;return function(_0xd1bf20){logger['error'](_0xd1bf20['stack']);if(_0xd1bf20[_0x0f79('0x2e')]){delete _0xd1bf20[_0x0f79('0x2e')];}_0xd5c72c[_0x0f79('0x1f')](_0x18fd2a)[_0x0f79('0x2f')](_0xd1bf20);};}exports['index']=function(_0x4f3a05,_0x3f0068){var _0x2ec10b={},_0x18c140={},_0x393b7a={'count':0x0,'rows':[]};var _0x4dedf7=_['map'](db[_0x0f79('0x30')][_0x0f79('0x31')],function(_0x4c42a8){return{'name':_0x4c42a8[_0x0f79('0x32')],'type':_0x4c42a8['type'][_0x0f79('0x33')]};});_0x18c140[_0x0f79('0x34')]=_[_0x0f79('0x35')](_0x4dedf7,_0x0f79('0x2e'));_0x18c140[_0x0f79('0x36')]=_[_0x0f79('0x37')](_0x4f3a05['query']);_0x18c140[_0x0f79('0x38')]=_[_0x0f79('0x39')](_0x18c140[_0x0f79('0x34')],_0x18c140[_0x0f79('0x36')]);_0x2ec10b[_0x0f79('0x3a')]=_[_0x0f79('0x39')](_0x18c140[_0x0f79('0x34')],qs['fields'](_0x4f3a05[_0x0f79('0x36')]['fields']));_0x2ec10b[_0x0f79('0x3a')]=_0x2ec10b[_0x0f79('0x3a')][_0x0f79('0x3b')]?_0x2ec10b[_0x0f79('0x3a')]:_0x18c140[_0x0f79('0x34')];if(!_0x4f3a05[_0x0f79('0x36')]['hasOwnProperty']('nolimit')){_0x2ec10b[_0x0f79('0x23')]=qs[_0x0f79('0x23')](_0x4f3a05['query'][_0x0f79('0x23')]);_0x2ec10b[_0x0f79('0x22')]=qs[_0x0f79('0x22')](_0x4f3a05[_0x0f79('0x36')]['offset']);}_0x2ec10b[_0x0f79('0x3c')]=qs[_0x0f79('0x3d')](_0x4f3a05[_0x0f79('0x36')][_0x0f79('0x3d')]);_0x2ec10b['where']=qs[_0x0f79('0x38')](_[_0x0f79('0x3e')](_0x4f3a05[_0x0f79('0x36')],_0x18c140[_0x0f79('0x38')]),_0x4dedf7);if(_0x4f3a05[_0x0f79('0x36')][_0x0f79('0x3f')]){_0x2ec10b['where']=_['merge'](_0x2ec10b['where'],{'$or':_[_0x0f79('0x35')](_0x4dedf7,function(_0x4c46ec){if(_0x4c46ec[_0x0f79('0x40')]!==_0x0f79('0x41')){var _0x16ed8c={};_0x16ed8c[_0x4c46ec[_0x0f79('0x2e')]]={'$like':'%'+_0x4f3a05[_0x0f79('0x36')][_0x0f79('0x3f')]+'%'};return _0x16ed8c;}})});}_0x2ec10b=_[_0x0f79('0x42')]({},_0x2ec10b,_0x4f3a05[_0x0f79('0x43')]);var _0x38a4db={'where':_0x2ec10b[_0x0f79('0x44')]};return db['WhatsappQueue'][_0x0f79('0x25')](_0x38a4db)[_0x0f79('0x2b')](function(_0x153680){_0x393b7a['count']=_0x153680;if(_0x4f3a05[_0x0f79('0x36')][_0x0f79('0x45')]){_0x2ec10b['include']=[{'all':!![]}];}return db[_0x0f79('0x30')][_0x0f79('0x46')](_0x2ec10b);})[_0x0f79('0x2b')](function(_0x200b8a){_0x393b7a[_0x0f79('0x47')]=_0x200b8a;return _0x393b7a;})[_0x0f79('0x2b')](respondWithFilteredResult(_0x3f0068,_0x2ec10b))[_0x0f79('0x48')](handleError(_0x3f0068,null));};exports['show']=function(_0xc3ed1e,_0x4c3242){var _0x46b117={'raw':!![],'where':{'id':_0xc3ed1e[_0x0f79('0x49')]['id']}},_0x5df6d4={};_0x5df6d4[_0x0f79('0x34')]=_[_0x0f79('0x37')](db[_0x0f79('0x30')][_0x0f79('0x31')]);_0x5df6d4[_0x0f79('0x36')]=_[_0x0f79('0x37')](_0xc3ed1e[_0x0f79('0x36')]);_0x5df6d4[_0x0f79('0x38')]=_[_0x0f79('0x39')](_0x5df6d4[_0x0f79('0x34')],_0x5df6d4[_0x0f79('0x36')]);_0x46b117[_0x0f79('0x3a')]=_[_0x0f79('0x39')](_0x5df6d4[_0x0f79('0x34')],qs[_0x0f79('0x4a')](_0xc3ed1e[_0x0f79('0x36')][_0x0f79('0x4a')]));_0x46b117[_0x0f79('0x3a')]=_0x46b117['attributes'][_0x0f79('0x3b')]?_0x46b117['attributes']:_0x5df6d4['model'];if(_0xc3ed1e[_0x0f79('0x36')]['includeAll']){_0x46b117['include']=[{'all':!![]}];}_0x46b117=_['merge']({},_0x46b117,_0xc3ed1e[_0x0f79('0x43')]);return db[_0x0f79('0x30')]['find'](_0x46b117)[_0x0f79('0x2b')](handleEntityNotFound(_0x4c3242,null))[_0x0f79('0x2b')](respondWithResult(_0x4c3242,null))[_0x0f79('0x48')](handleError(_0x4c3242,null));};exports[_0x0f79('0x4b')]=function(_0x2aa954,_0x4c5ff3){return db[_0x0f79('0x30')][_0x0f79('0x4b')](_0x2aa954['body'],{})['then'](function(_0x20b5e6){var _0x46a7e9=_0x2aa954[_0x0f79('0x4c')][_0x0f79('0x2c')]({'plain':!![]});if(!_0x46a7e9)throw new Error(_0x0f79('0x4d'));if(_0x46a7e9['role']===_0x0f79('0x4c')){var _0x22b340=_0x20b5e6[_0x0f79('0x2c')]({'plain':!![]});var _0x2a63bb='WhatsappQueues';return db[_0x0f79('0x4e')]['find']({'where':{'name':_0x2a63bb,'userProfileId':_0x46a7e9[_0x0f79('0x4f')]},'raw':!![]})[_0x0f79('0x2b')](function(_0x1a39b6){if(_0x1a39b6&&_0x1a39b6[_0x0f79('0x50')]===0x0){return db[_0x0f79('0x51')]['create']({'name':_0x22b340[_0x0f79('0x2e')],'resourceId':_0x22b340['id'],'type':_0x1a39b6[_0x0f79('0x2e')],'sectionId':_0x1a39b6['id']},{})['then'](function(){return _0x20b5e6;});}else{return _0x20b5e6;}})[_0x0f79('0x48')](function(_0x45869a){logger[_0x0f79('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45869a);throw _0x45869a;});}return _0x20b5e6;})[_0x0f79('0x2b')](respondWithResult(_0x4c5ff3,0xc9))[_0x0f79('0x48')](handleError(_0x4c5ff3,null));};exports['update']=function(_0xedf9db,_0x1e0047){if(_0xedf9db[_0x0f79('0x53')]['id']){delete _0xedf9db['body']['id'];}return db[_0x0f79('0x30')][_0x0f79('0x54')]({'where':{'id':_0xedf9db[_0x0f79('0x49')]['id']}})[_0x0f79('0x2b')](handleEntityNotFound(_0x1e0047,null))['then'](saveUpdates(_0xedf9db[_0x0f79('0x53')],null))[_0x0f79('0x2b')](respondWithResult(_0x1e0047,null))[_0x0f79('0x48')](handleError(_0x1e0047,null));};exports[_0x0f79('0x55')]=function(_0x82d1dc,_0x4efae3){return db[_0x0f79('0x30')][_0x0f79('0x54')]({'where':{'id':_0x82d1dc['params']['id']}})[_0x0f79('0x2b')](handleEntityNotFound(_0x4efae3,null))[_0x0f79('0x2b')](removeEntity(_0x4efae3,null))[_0x0f79('0x48')](handleError(_0x4efae3,null));};exports[_0x0f79('0x56')]=function(_0x18fa3e,_0x4034a2){return db[_0x0f79('0x30')][_0x0f79('0x56')]()['then'](respondWithResult(_0x4034a2,null))[_0x0f79('0x48')](handleError(_0x4034a2,null));};exports[_0x0f79('0x57')]=function(_0x20649d,_0x5ae278,_0x27519f){var _0x5bcae6={'raw':!![],'where':{}},_0x2d8575={},_0x3315f9;return db[_0x0f79('0x30')][_0x0f79('0x58')]({'where':{'id':_0x20649d[_0x0f79('0x49')]['id']}})[_0x0f79('0x2b')](handleEntityNotFound(_0x5ae278,null))[_0x0f79('0x2b')](function(_0x118ae0){if(_0x118ae0){_0x3315f9=_0x118ae0[_0x0f79('0x2c')]({'plain':!![]});_0x2d8575['model']=_[_0x0f79('0x37')](db[_0x0f79('0x59')]['rawAttributes']);_0x2d8575[_0x0f79('0x36')]=_['keys'](_0x20649d[_0x0f79('0x36')]);_0x2d8575[_0x0f79('0x38')]=_['intersection'](_0x2d8575[_0x0f79('0x34')],_0x2d8575[_0x0f79('0x36')]);_0x5bcae6['attributes']=_[_0x0f79('0x39')](_0x2d8575[_0x0f79('0x34')],qs[_0x0f79('0x4a')](_0x20649d['query']['fields']));_0x5bcae6[_0x0f79('0x3a')]=_0x5bcae6[_0x0f79('0x3a')]['length']?_0x5bcae6[_0x0f79('0x3a')]:_0x2d8575[_0x0f79('0x34')];if(!_0x20649d[_0x0f79('0x36')]['hasOwnProperty'](_0x0f79('0x5a'))){_0x5bcae6[_0x0f79('0x23')]=qs[_0x0f79('0x23')](_0x20649d[_0x0f79('0x36')][_0x0f79('0x23')]);_0x5bcae6[_0x0f79('0x22')]=qs[_0x0f79('0x22')](_0x20649d['query'][_0x0f79('0x22')]);}_0x5bcae6['order']=qs[_0x0f79('0x3d')](_0x20649d['query'][_0x0f79('0x3d')]);_0x5bcae6[_0x0f79('0x44')]=qs[_0x0f79('0x38')](_[_0x0f79('0x3e')](_0x20649d[_0x0f79('0x36')],_0x2d8575[_0x0f79('0x38')]));_0x5bcae6[_0x0f79('0x44')][_0x0f79('0x5b')]=_0x118ae0['id'];if(_0x20649d[_0x0f79('0x36')][_0x0f79('0x3f')]){_0x5bcae6[_0x0f79('0x44')]=_[_0x0f79('0x42')](_0x5bcae6[_0x0f79('0x44')],{'$or':_[_0x0f79('0x35')](_0x5bcae6[_0x0f79('0x3a')],function(_0x46bc48){var _0x1ee909={};_0x1ee909[_0x46bc48]={'$like':'%'+_0x20649d['query'][_0x0f79('0x3f')]+'%'};return _0x1ee909;})});}_0x5bcae6=_[_0x0f79('0x42')]({},_0x5bcae6,_0x20649d['options']);return db[_0x0f79('0x59')][_0x0f79('0x46')](_0x5bcae6);}})['then'](function(_0x35e32b){if(_0x35e32b){return db['User']['findAndCountAll']({'where':{'id':_[_0x0f79('0x35')](_0x35e32b,_0x0f79('0x5c')),'role':_0x0f79('0x5d')},'attributes':['id','name',_0x0f79('0x5e'),'updatedAt',_0x0f79('0x5f')]});}})['then'](function(_0x64f653){if(_0x64f653){return{'count':_0x64f653[_0x0f79('0x25')],'rows':_['map'](_0x64f653[_0x0f79('0x47')],function(_0x28db8a){return{'membername':_0x28db8a[_0x0f79('0x2e')],'UserId':_0x28db8a['id'],'queue_name':_0x3315f9[_0x0f79('0x2e')],'WhatsappQueueId':_0x3315f9['id'],'interface':util['format'](_0x0f79('0x60'),'SIP',_0x28db8a[_0x0f79('0x2e')]),'penalty':0x0,'paused':_0x28db8a['whatsappPause'],'createdAt':_0x28db8a[_0x0f79('0x5f')],'updatedAt':_0x28db8a[_0x0f79('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5ae278,_0x5bcae6))['catch'](handleError(_0x5ae278,null));};exports[_0x0f79('0x62')]=function(_0x268b99,_0x151729,_0x2e6dcf){var _0x14c99d={};var _0x1d194e={};var _0x424a05;var _0x199cad;return db[_0x0f79('0x30')]['findOne']({'where':{'id':_0x268b99[_0x0f79('0x49')]['id']}})['then'](handleEntityNotFound(_0x151729,null))[_0x0f79('0x2b')](function(_0x2723bc){if(_0x2723bc){_0x424a05=_0x2723bc;_0x1d194e[_0x0f79('0x34')]=_[_0x0f79('0x37')](db['Team']['rawAttributes']);_0x1d194e['query']=_['keys'](_0x268b99['query']);_0x1d194e[_0x0f79('0x38')]=_['intersection'](_0x1d194e[_0x0f79('0x34')],_0x1d194e['query']);_0x14c99d[_0x0f79('0x3a')]=_['intersection'](_0x1d194e[_0x0f79('0x34')],qs[_0x0f79('0x4a')](_0x268b99['query'][_0x0f79('0x4a')]));_0x14c99d[_0x0f79('0x3a')]=_0x14c99d['attributes'][_0x0f79('0x3b')]?_0x14c99d['attributes']:_0x1d194e[_0x0f79('0x34')];_0x14c99d[_0x0f79('0x3c')]=qs[_0x0f79('0x3d')](_0x268b99[_0x0f79('0x36')][_0x0f79('0x3d')]);_0x14c99d[_0x0f79('0x44')]=qs[_0x0f79('0x38')](_[_0x0f79('0x3e')](_0x268b99[_0x0f79('0x36')],_0x1d194e[_0x0f79('0x38')]));if(_0x268b99[_0x0f79('0x36')][_0x0f79('0x3f')]){_0x14c99d[_0x0f79('0x44')]=_[_0x0f79('0x42')](_0x14c99d[_0x0f79('0x44')],{'$or':_['map'](_0x14c99d[_0x0f79('0x3a')],function(_0xf36c5c){var _0x4d64a1={};_0x4d64a1[_0xf36c5c]={'$like':'%'+_0x268b99[_0x0f79('0x36')]['filter']+'%'};return _0x4d64a1;})});}_0x14c99d=_[_0x0f79('0x42')]({},_0x14c99d,_0x268b99[_0x0f79('0x43')]);return _0x424a05[_0x0f79('0x62')](_0x14c99d);}})[_0x0f79('0x2b')](function(_0x55c270){if(_0x55c270){_0x199cad=_0x55c270[_0x0f79('0x3b')];if(!_0x268b99[_0x0f79('0x36')][_0x0f79('0x63')](_0x0f79('0x5a'))){_0x14c99d[_0x0f79('0x23')]=qs[_0x0f79('0x23')](_0x268b99[_0x0f79('0x36')][_0x0f79('0x23')]);_0x14c99d['offset']=qs[_0x0f79('0x22')](_0x268b99[_0x0f79('0x36')][_0x0f79('0x22')]);}return _0x424a05[_0x0f79('0x62')](_0x14c99d);}})[_0x0f79('0x2b')](function(_0x468b67){if(_0x468b67){return _0x468b67?{'count':_0x199cad,'rows':_0x468b67}:null;}})['then'](respondWithResult(_0x151729,null))[_0x0f79('0x48')](handleError(_0x151729,null));};exports[_0x0f79('0x64')]=function(_0x1eeffe,_0x36c432,_0x1ec03c){var _0x144f0c=_0x1eeffe[_0x0f79('0x53')][_0x0f79('0x65')];return db['Team'][_0x0f79('0x46')]({'where':{'id':_0x144f0c},'attributes':['id'],'include':[{'model':db[_0x0f79('0x66')],'as':'Agents','attributes':['id',_0x0f79('0x2e'),_0x0f79('0x67'),'voicePause',_0x0f79('0x68')],'raw':!![]}]})['then'](function(_0x1a4686){if(_0x1a4686){var _0x35b62b=_[_0x0f79('0x69')](_0x1a4686,function(_0x4118e0){var _0x16ed09=_0x4118e0['get']({'plain':!![]});return _0x16ed09[_0x0f79('0x6a')];});return db['WhatsappQueue'][_0x0f79('0x54')]({'where':{'id':_0x1eeffe[_0x0f79('0x49')]['id']}})[_0x0f79('0x2b')](function(_0x43c998){return db[_0x0f79('0x6b')]['transaction'](function(_0x17f70c){return _0x43c998[_0x0f79('0x64')](_0x144f0c,{'transaction':_0x17f70c})[_0x0f79('0x2b')](function(){return BPromise[_0x0f79('0x6c')](_0x35b62b,function(_0x128c36){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x128c36['id'],'WhatsappQueueId':_0x1eeffe['params']['id']},'transaction':_0x17f70c});});})[_0x0f79('0x2b')](function(){_0x35b62b['forEach'](function(_0x307b24){socket[_0x0f79('0x6d')](_0x0f79('0x6e'),{'UserId':_0x307b24['id'],'WhatsappQueueId':_0x43c998['id']});});});});});}})['then'](respondWithStatusCode(_0x36c432,null))['catch'](handleError(_0x36c432,null));};exports[_0x0f79('0x6f')]=function(_0x34b796,_0x185ff3,_0x284230){return db['Team']['findAll']({'where':{'id':_0x34b796[_0x0f79('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0f79('0x66')],'as':_0x0f79('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x0f79('0x2b')](handleEntityNotFound(_0x185ff3,null))[_0x0f79('0x2b')](function(_0x4f1aa5){var _0x2d04e3=_[_0x0f79('0x35')](_0x4f1aa5,'id');var _0x1f9caa=[];var _0x19a86f=[];var _0x502732=squel[_0x0f79('0x70')]();_0x502732[_0x0f79('0x71')](_0x0f79('0x72'))[_0x0f79('0x73')](_0x0f79('0x74'),'tq')[_0x0f79('0x75')](_0x0f79('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0f79('0x44')](_0x0f79('0x77'),_0x34b796[_0x0f79('0x49')]['id']);for(var _0x30b04b=0x0;_0x30b04b<_0x4f1aa5['length'];_0x30b04b+=0x1){let _0x2ed312=_0x4f1aa5[_0x30b04b];for(var _0x4e8f71=0x0;_0x4e8f71<_0x2ed312[_0x0f79('0x6a')][_0x0f79('0x3b')];_0x4e8f71+=0x1){let _0x1ade76=_0x2ed312[_0x0f79('0x6a')][_0x4e8f71];var _0x3d0aec=_0x502732[_0x0f79('0x78')]();_0x3d0aec[_0x0f79('0x44')](_0x0f79('0x79'),_0x1ade76['id']);_0x19a86f[_0x0f79('0x7a')](db[_0x0f79('0x6b')][_0x0f79('0x36')](_0x3d0aec[_0x0f79('0x7b')](),{'type':db['sequelize']['QueryTypes'][_0x0f79('0x7c')]})[_0x0f79('0x2b')](function(_0x2a4ec5){if(_0x2a4ec5[_0x0f79('0x3b')]===0x1){return _0x1ade76['id'];}else{var _0x7094ef=_[_0x0f79('0x7d')](_[_0x0f79('0x35')](_0x2a4ec5,'TeamId'),function(_0xf7df4c){return _[_0x0f79('0x7e')](_0x2d04e3,_0xf7df4c);});if(_0x7094ef){return _0x1ade76['id'];}}}));}}return BPromise[_0x0f79('0x7f')](_0x19a86f)['then'](function(_0x3ee5f5){_0x1f9caa=_(_0x1f9caa)[_0x0f79('0x80')](_0x3ee5f5)[_0x0f79('0x81')]()[_0x0f79('0x82')]();return db['WhatsappQueue'][_0x0f79('0x54')]({'where':{'id':_0x34b796[_0x0f79('0x49')]['id']}})[_0x0f79('0x2b')](function(_0x22c6ec){return db[_0x0f79('0x6b')][_0x0f79('0x83')](function(_0x1c038e){return _0x22c6ec['removeTeams'](_0x34b796[_0x0f79('0x36')][_0x0f79('0x65')],{'transaction':_0x1c038e})[_0x0f79('0x2b')](function(){if(!_[_0x0f79('0x84')](_0x1f9caa)){return _0x22c6ec['removeAgents'](_0x1f9caa,{'transaction':_0x1c038e});}})[_0x0f79('0x2b')](function(){_0x1f9caa[_0x0f79('0x85')](function(_0x30f920){socket[_0x0f79('0x6d')]('userWhatsappQueue:remove',{'UserId':_0x30f920,'WhatsappQueueId':_0x22c6ec['id']});});});});});});})['then'](respondWithStatusCode(_0x185ff3,null))[_0x0f79('0x48')](handleError(_0x185ff3,null));};exports['addAgents']=function(_0x46df53,_0x1517bc,_0x328535){return db[_0x0f79('0x30')]['find']({'where':{'id':_0x46df53[_0x0f79('0x49')]['id']}})[_0x0f79('0x2b')](handleEntityNotFound(_0x1517bc,null))[_0x0f79('0x2b')](function(_0x48c360){if(_0x48c360){return _0x48c360[_0x0f79('0x86')](_0x46df53['body'][_0x0f79('0x65')],_[_0x0f79('0x87')](_0x46df53[_0x0f79('0x53')],['ids','id'])||{})[_0x0f79('0x88')](function(_0x43f645){for(var _0xffe0b7=0x0;_0xffe0b7<_0x46df53['body'][_0x0f79('0x65')]['length'];_0xffe0b7+=0x1){socket[_0x0f79('0x6d')](_0x0f79('0x6e'),{'UserId':Number(_0x46df53[_0x0f79('0x53')]['ids'][_0xffe0b7]),'WhatsappQueueId':Number(_0x46df53[_0x0f79('0x49')]['id'])});}return _0x43f645;});}})[_0x0f79('0x2b')](respondWithResult(_0x1517bc,null))[_0x0f79('0x48')](handleError(_0x1517bc,null));};exports[_0x0f79('0x89')]=function(_0xe41598,_0x14b985,_0x1ce658){return db['WhatsappQueue'][_0x0f79('0x54')]({'where':{'id':_0xe41598[_0x0f79('0x49')]['id']}})['then'](handleEntityNotFound(_0x14b985,null))['then'](function(_0x4264c3){if(_0x4264c3){return _0x4264c3['removeAgents'](_0xe41598[_0x0f79('0x36')][_0x0f79('0x65')])[_0x0f79('0x2b')](function(){if(_[_0x0f79('0x8a')](_0xe41598['query'][_0x0f79('0x65')])){for(var _0x21d0c0=0x0;_0x21d0c0<_0xe41598[_0x0f79('0x36')]['ids'][_0x0f79('0x3b')];_0x21d0c0+=0x1){socket[_0x0f79('0x6d')](_0x0f79('0x8b'),{'UserId':Number(_0xe41598[_0x0f79('0x36')][_0x0f79('0x65')][_0x21d0c0]),'WhatsappQueueId':Number(_0xe41598['params']['id'])});}}else{socket[_0x0f79('0x6d')]('userWhatsappQueue:remove',{'UserId':Number(_0xe41598[_0x0f79('0x36')][_0x0f79('0x65')]),'WhatsappQueueId':Number(_0xe41598[_0x0f79('0x49')]['id'])});}});}})[_0x0f79('0x2b')](respondWithStatusCode(_0x14b985,null))['catch'](handleError(_0x14b985,null));};exports[_0x0f79('0x8c')]=function(_0x1d6de5,_0x24aed6,_0x3ef979){var _0x211e84={};var _0x259b0b={};var _0x371683;var _0x13efc9;return db[_0x0f79('0x30')][_0x0f79('0x58')]({'where':{'id':_0x1d6de5['params']['id']}})['then'](handleEntityNotFound(_0x24aed6,null))[_0x0f79('0x2b')](function(_0x130418){if(_0x130418){_0x371683=_0x130418;_0x259b0b['model']=_[_0x0f79('0x37')](db[_0x0f79('0x66')][_0x0f79('0x31')]);_0x259b0b[_0x0f79('0x36')]=_[_0x0f79('0x37')](_0x1d6de5['query']);_0x259b0b[_0x0f79('0x38')]=_[_0x0f79('0x39')](_0x259b0b[_0x0f79('0x34')],_0x259b0b['query']);_0x211e84['attributes']=_[_0x0f79('0x39')](_0x259b0b[_0x0f79('0x34')],qs[_0x0f79('0x4a')](_0x1d6de5[_0x0f79('0x36')][_0x0f79('0x4a')]));_0x211e84[_0x0f79('0x3a')]=_0x211e84[_0x0f79('0x3a')][_0x0f79('0x3b')]?_0x211e84[_0x0f79('0x3a')]:_0x259b0b[_0x0f79('0x34')];_0x211e84[_0x0f79('0x3c')]=qs['sort'](_0x1d6de5[_0x0f79('0x36')]['sort']);_0x211e84[_0x0f79('0x44')]=qs[_0x0f79('0x38')](_[_0x0f79('0x3e')](_0x1d6de5[_0x0f79('0x36')],_0x259b0b[_0x0f79('0x38')]));if(_0x1d6de5[_0x0f79('0x36')][_0x0f79('0x3f')]){_0x211e84[_0x0f79('0x44')]=_['merge'](_0x211e84['where'],{'$or':_[_0x0f79('0x35')](_0x211e84[_0x0f79('0x3a')],function(_0x451250){var _0x25b429={};_0x25b429[_0x451250]={'$like':'%'+_0x1d6de5['query']['filter']+'%'};return _0x25b429;})});}_0x211e84=_[_0x0f79('0x42')]({},_0x211e84,_0x1d6de5['options']);return _0x371683[_0x0f79('0x8c')](_0x211e84);}})['then'](function(_0x4bd897){if(_0x4bd897){_0x13efc9=_0x4bd897[_0x0f79('0x3b')];if(!_0x1d6de5['query'][_0x0f79('0x63')]('nolimit')){_0x211e84[_0x0f79('0x23')]=qs['limit'](_0x1d6de5[_0x0f79('0x36')]['limit']);_0x211e84[_0x0f79('0x22')]=qs[_0x0f79('0x22')](_0x1d6de5[_0x0f79('0x36')]['offset']);}return _0x371683['getAgents'](_0x211e84);}})[_0x0f79('0x2b')](function(_0x3e6def){if(_0x3e6def){return _0x3e6def?{'count':_0x13efc9,'rows':_0x3e6def}:null;}})[_0x0f79('0x2b')](respondWithResult(_0x24aed6,null))['catch'](handleError(_0x24aed6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e6ee59f..c101e67 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 _0xc5fd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x1f26a9,_0x2b0262){var _0xb9e493=function(_0x35f6db){while(--_0x35f6db){_0x1f26a9['push'](_0x1f26a9['shift']());}};_0xb9e493(++_0x2b0262);}(_0xc5fd,0x138));var _0xdc5f=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xc5fd[_0x1a7550];return _0x426e22;};'use strict';var EventEmitter=require(_0xdc5f('0x0'));var WhatsappQueue=require(_0xdc5f('0x1'))['db'][_0xdc5f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xdc5f('0x3')](0x0);var events={'afterCreate':_0xdc5f('0x4'),'afterUpdate':_0xdc5f('0x5'),'afterDestroy':_0xdc5f('0x6')};function emitEvent(_0x3e42b8){return function(_0x5b920f,_0x58d7d5,_0x5c23f2){WhatsappQueueEvents[_0xdc5f('0x7')](_0x3e42b8+':'+_0x5b920f['id'],_0x5b920f);WhatsappQueueEvents['emit'](_0x3e42b8,_0x5b920f);_0x5c23f2(null);};}for(var e in events){if(events[_0xdc5f('0x8')](e)){var event=events[e];WhatsappQueue[_0xdc5f('0x9')](e,emitEvent(event));}}module[_0xdc5f('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0xcce8=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x71fad9,_0x27dae7){var _0x158d4e=function(_0x49b55c){while(--_0x49b55c){_0x71fad9['push'](_0x71fad9['shift']());}};_0x158d4e(++_0x27dae7);}(_0xcce8,0x159));var _0x8cce=function(_0x40bb79,_0x4d9a4e){_0x40bb79=_0x40bb79-0x0;var _0x67ae45=_0xcce8[_0x40bb79];return _0x67ae45;};'use strict';var EventEmitter=require(_0x8cce('0x0'));var WhatsappQueue=require(_0x8cce('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8cce('0x2')](0x0);var events={'afterCreate':_0x8cce('0x3'),'afterUpdate':_0x8cce('0x4'),'afterDestroy':'remove'};function emitEvent(_0x483045){return function(_0xf774b0,_0x269129,_0x101991){WhatsappQueueEvents[_0x8cce('0x5')](_0x483045+':'+_0xf774b0['id'],_0xf774b0);WhatsappQueueEvents[_0x8cce('0x5')](_0x483045,_0xf774b0);_0x101991(null);};}for(var e in events){if(events[_0x8cce('0x6')](e)){var event=events[e];WhatsappQueue[_0x8cce('0x7')](e,emitEvent(event));}}module[_0x8cce('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a853987..a8322a6 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 _0xecdc=['define','WhatsappQueue','whatsapp_queues','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xecdc,0xc1));var _0xcecd=function(_0x3ff608,_0x596ee9){_0x3ff608=_0x3ff608-0x0;var _0x12b565=_0xecdc[_0x3ff608];return _0x12b565;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xcecd('0x0'));var moment=require(_0xcecd('0x1'));var BPromise=require(_0xcecd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcecd('0x3'));var rimraf=require(_0xcecd('0x4'));var config=require(_0xcecd('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0xcecd('0x6')]=function(_0x5b8e54,_0x433327){return _0x5b8e54[_0xcecd('0x7')](_0xcecd('0x8'),attributes,{'tableName':_0xcecd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa94b=['moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','util','api'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0xa94b,0x174));var _0xba94=function(_0x104317,_0x14ac01){_0x104317=_0x104317-0x0;var _0x2e47b9=_0xa94b[_0x104317];return _0x2e47b9;};'use strict';var _=require('lodash');var util=require(_0xba94('0x0'));var logger=require('../../config/logger')(_0xba94('0x1'));var moment=require(_0xba94('0x2'));var BPromise=require(_0xba94('0x3'));var rp=require(_0xba94('0x4'));var fs=require('fs');var path=require(_0xba94('0x5'));var rimraf=require('rimraf');var config=require(_0xba94('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xba94('0x7')]=function(_0x501145,_0x17bac2){return _0x501145[_0xba94('0x8')](_0xba94('0x9'),attributes,{'tableName':_0xba94('0xa'),'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 4a7c6ba..be5c136 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 _0x4880=['register','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','WhatsappQueue','options','raw','where','attributes','include','model','map','then','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./whatsappQueue.socket'];(function(_0x235cea,_0x4c3504){var _0x15ee93=function(_0x5cb350){while(--_0x5cb350){_0x235cea['push'](_0x235cea['shift']());}};_0x15ee93(++_0x4c3504);}(_0x4880,0x147));var _0x0488=function(_0x1b9faa,_0x5373d5){_0x1b9faa=_0x1b9faa-0x0;var _0xaae9e3=_0x4880[_0x1b9faa];return _0xaae9e3;};'use strict';var _=require(_0x0488('0x0'));var util=require(_0x0488('0x1'));var moment=require('moment');var BPromise=require(_0x0488('0x2'));var rs=require(_0x0488('0x3'));var fs=require('fs');var Redis=require(_0x0488('0x4'));var db=require(_0x0488('0x5'))['db'];var utils=require(_0x0488('0x6'));var logger=require(_0x0488('0x7'))(_0x0488('0x8'));var config=require(_0x0488('0x9'));var jayson=require(_0x0488('0xa'));var client=jayson['client'][_0x0488('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0488('0xc')],{'host':_0x0488('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0488('0xc')]));require(_0x0488('0xe'))[_0x0488('0xf')](socket);function respondWithRpcPromise(_0x278767,_0x587e59,_0x497dc4){return new BPromise(function(_0x2182dd,_0x2fc07f){return client['request'](_0x278767,_0x497dc4)['then'](function(_0x567e69){logger[_0x0488('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x587e59,'request\x20sent');logger[_0x0488('0x11')](_0x0488('0x12'),_0x587e59,'request\x20sent',JSON[_0x0488('0x13')](_0x567e69));if(_0x567e69[_0x0488('0x14')]){if(_0x567e69[_0x0488('0x14')]['code']===0x1f4){logger[_0x0488('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x587e59,_0x567e69['error']['message']);return _0x2fc07f(_0x567e69['error']['message']);}logger[_0x0488('0x14')](_0x0488('0x15'),_0x587e59,_0x567e69['error'][_0x0488('0x16')]);return _0x2182dd(_0x567e69['error'][_0x0488('0x16')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x587e59,_0x0488('0x17'));_0x2182dd(_0x567e69[_0x0488('0x18')][_0x0488('0x16')]);}})[_0x0488('0x19')](function(_0x234bb7){logger[_0x0488('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x587e59,_0x234bb7);_0x2fc07f(_0x234bb7);});});}exports['GetWhatsappQueue']=function(_0x1863fb){var _0x41478c=this;return new Promise(function(_0x36c930,_0x5aeb5){return db[_0x0488('0x1a')]['findAll']({'raw':_0x1863fb[_0x0488('0x1b')]?_0x1863fb['options'][_0x0488('0x1c')]===undefined?!![]:![]:!![],'where':_0x1863fb['options']?_0x1863fb[_0x0488('0x1b')][_0x0488('0x1d')]||null:null,'attributes':_0x1863fb[_0x0488('0x1b')]?_0x1863fb[_0x0488('0x1b')][_0x0488('0x1e')]||null:null,'limit':_0x1863fb['options']?_0x1863fb['options']['limit']||null:null,'include':_0x1863fb['options']?_0x1863fb[_0x0488('0x1b')]['include']?_['map'](_0x1863fb[_0x0488('0x1b')][_0x0488('0x1f')],function(_0x3a4069){return{'model':db[_0x3a4069[_0x0488('0x20')]],'as':_0x3a4069['as'],'attributes':_0x3a4069[_0x0488('0x1e')],'include':_0x3a4069[_0x0488('0x1f')]?_[_0x0488('0x21')](_0x3a4069[_0x0488('0x1f')],function(_0x1c5921){return{'model':db[_0x1c5921[_0x0488('0x20')]],'as':_0x1c5921['as'],'attributes':_0x1c5921['attributes'],'include':_0x1c5921[_0x0488('0x1f')]?_[_0x0488('0x21')](_0x1c5921[_0x0488('0x1f')],function(_0x2be0d5){return{'model':db[_0x2be0d5[_0x0488('0x20')]],'as':_0x2be0d5['as'],'attributes':_0x2be0d5[_0x0488('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0488('0x22')](function(_0x1049d0){logger[_0x0488('0x10')](_0x0488('0x23'),_0x1863fb);logger[_0x0488('0x11')](_0x0488('0x23'),_0x1863fb,JSON['stringify'](_0x1049d0));_0x36c930(_0x1049d0);})[_0x0488('0x19')](function(_0x45eafe){logger[_0x0488('0x14')]('GetWhatsappQueue',_0x45eafe[_0x0488('0x16')],_0x1863fb);_0x5aeb5(_0x41478c['error'](0x1f4,_0x45eafe[_0x0488('0x16')]));});});};exports[_0x0488('0x24')]=function(_0x3ad7ba){var _0x10dad5=this;return new Promise(function(_0x5b7276,_0x3ee0df){return db[_0x0488('0x1a')][_0x0488('0x25')]({'raw':_0x3ad7ba[_0x0488('0x1b')]?_0x3ad7ba[_0x0488('0x1b')][_0x0488('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ad7ba[_0x0488('0x1b')]?_0x3ad7ba[_0x0488('0x1b')][_0x0488('0x1d')]||null:null,'attributes':_0x3ad7ba[_0x0488('0x1b')]?_0x3ad7ba[_0x0488('0x1b')][_0x0488('0x1e')]||null:null,'include':_0x3ad7ba['options']?_0x3ad7ba[_0x0488('0x1b')][_0x0488('0x1f')]?_[_0x0488('0x21')](_0x3ad7ba['options']['include'],function(_0xbbda0d){return{'model':db[_0xbbda0d[_0x0488('0x20')]],'as':_0xbbda0d['as'],'attributes':_0xbbda0d[_0x0488('0x1e')],'include':_0xbbda0d[_0x0488('0x1f')]?_[_0x0488('0x21')](_0xbbda0d[_0x0488('0x1f')],function(_0x469fa8){return{'model':db[_0x469fa8[_0x0488('0x20')]],'as':_0x469fa8['as'],'attributes':_0x469fa8['attributes'],'include':_0x469fa8[_0x0488('0x1f')]?_['map'](_0x469fa8['include'],function(_0x1e914f){return{'model':db[_0x1e914f[_0x0488('0x20')]],'as':_0x1e914f['as'],'attributes':_0x1e914f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0488('0x22')](function(_0x4b1f07){logger[_0x0488('0x10')](_0x0488('0x24'),_0x3ad7ba);logger[_0x0488('0x11')](_0x0488('0x24'),_0x3ad7ba,JSON[_0x0488('0x13')](_0x4b1f07));_0x5b7276(_0x4b1f07);})[_0x0488('0x19')](function(_0x1823bc){logger[_0x0488('0x14')](_0x0488('0x24'),_0x1823bc[_0x0488('0x16')],_0x3ad7ba);_0x3ee0df(_0x10dad5[_0x0488('0x14')](0x1f4,_0x1823bc[_0x0488('0x16')]));});});}; \ No newline at end of file +var _0xcb00=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','map','include','model','attributes','ShowWhatsappQueue','debug','catch','lodash','moment'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0xcb00,0x166));var _0x0cb0=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xcb00[_0x111e94];return _0x3de107;};'use strict';var _=require(_0x0cb0('0x0'));var util=require('util');var moment=require(_0x0cb0('0x1'));var BPromise=require('bluebird');var rs=require(_0x0cb0('0x2'));var fs=require('fs');var Redis=require(_0x0cb0('0x3'));var db=require(_0x0cb0('0x4'))['db'];var utils=require(_0x0cb0('0x5'));var logger=require(_0x0cb0('0x6'))(_0x0cb0('0x7'));var config=require(_0x0cb0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0cb0('0x9')][_0x0cb0('0xa')]({'port':0x232a});config[_0x0cb0('0xb')]=_[_0x0cb0('0xc')](config[_0x0cb0('0xb')],{'host':_0x0cb0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cb0('0xb')]));require(_0x0cb0('0xe'))['register'](socket);function respondWithRpcPromise(_0x2562ec,_0xfa06e2,_0x507d81){return new BPromise(function(_0x2c1a35,_0x6fd1dd){return client[_0x0cb0('0xf')](_0x2562ec,_0x507d81)[_0x0cb0('0x10')](function(_0x45c433){logger[_0x0cb0('0x11')](_0x0cb0('0x12'),_0xfa06e2,_0x0cb0('0x13'));logger['debug'](_0x0cb0('0x14'),_0xfa06e2,_0x0cb0('0x13'),JSON[_0x0cb0('0x15')](_0x45c433));if(_0x45c433[_0x0cb0('0x16')]){if(_0x45c433['error'][_0x0cb0('0x17')]===0x1f4){logger[_0x0cb0('0x16')](_0x0cb0('0x12'),_0xfa06e2,_0x45c433[_0x0cb0('0x16')][_0x0cb0('0x18')]);return _0x6fd1dd(_0x45c433[_0x0cb0('0x16')][_0x0cb0('0x18')]);}logger['error'](_0x0cb0('0x12'),_0xfa06e2,_0x45c433[_0x0cb0('0x16')][_0x0cb0('0x18')]);return _0x2c1a35(_0x45c433[_0x0cb0('0x16')][_0x0cb0('0x18')]);}else{logger[_0x0cb0('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0xfa06e2,_0x0cb0('0x13'));_0x2c1a35(_0x45c433[_0x0cb0('0x19')][_0x0cb0('0x18')]);}})['catch'](function(_0x5d4fea){logger[_0x0cb0('0x16')](_0x0cb0('0x12'),_0xfa06e2,_0x5d4fea);_0x6fd1dd(_0x5d4fea);});});}exports[_0x0cb0('0x1a')]=function(_0x244732){var _0x45634e=this;return new Promise(function(_0x277736,_0x17697e){return db[_0x0cb0('0x1b')][_0x0cb0('0x1c')]({'raw':_0x244732[_0x0cb0('0x1d')]?_0x244732[_0x0cb0('0x1d')][_0x0cb0('0x1e')]===undefined?!![]:![]:!![],'where':_0x244732[_0x0cb0('0x1d')]?_0x244732[_0x0cb0('0x1d')][_0x0cb0('0x1f')]||null:null,'attributes':_0x244732[_0x0cb0('0x1d')]?_0x244732[_0x0cb0('0x1d')]['attributes']||null:null,'limit':_0x244732[_0x0cb0('0x1d')]?_0x244732[_0x0cb0('0x1d')][_0x0cb0('0x20')]||null:null,'include':_0x244732['options']?_0x244732['options']['include']?_[_0x0cb0('0x21')](_0x244732[_0x0cb0('0x1d')][_0x0cb0('0x22')],function(_0xd9a662){return{'model':db[_0xd9a662[_0x0cb0('0x23')]],'as':_0xd9a662['as'],'attributes':_0xd9a662[_0x0cb0('0x24')],'include':_0xd9a662['include']?_[_0x0cb0('0x21')](_0xd9a662['include'],function(_0x4761b9){return{'model':db[_0x4761b9[_0x0cb0('0x23')]],'as':_0x4761b9['as'],'attributes':_0x4761b9[_0x0cb0('0x24')],'include':_0x4761b9[_0x0cb0('0x22')]?_['map'](_0x4761b9[_0x0cb0('0x22')],function(_0x5ab222){return{'model':db[_0x5ab222['model']],'as':_0x5ab222['as'],'attributes':_0x5ab222['attributes']};}):[]};}):[]};}):[]:[]})[_0x0cb0('0x10')](function(_0x2f1cbd){logger[_0x0cb0('0x11')](_0x0cb0('0x1a'),_0x244732);logger['debug']('GetWhatsappQueue',_0x244732,JSON[_0x0cb0('0x15')](_0x2f1cbd));_0x277736(_0x2f1cbd);})['catch'](function(_0x3b72cf){logger[_0x0cb0('0x16')]('GetWhatsappQueue',_0x3b72cf[_0x0cb0('0x18')],_0x244732);_0x17697e(_0x45634e[_0x0cb0('0x16')](0x1f4,_0x3b72cf[_0x0cb0('0x18')]));});});};exports[_0x0cb0('0x25')]=function(_0x428856){var _0x3bf10c=this;return new Promise(function(_0x4863f,_0x2f88dc){return db[_0x0cb0('0x1b')]['find']({'raw':_0x428856[_0x0cb0('0x1d')]?_0x428856[_0x0cb0('0x1d')][_0x0cb0('0x1e')]===undefined?!![]:![]:!![],'where':_0x428856['options']?_0x428856[_0x0cb0('0x1d')][_0x0cb0('0x1f')]||null:null,'attributes':_0x428856[_0x0cb0('0x1d')]?_0x428856[_0x0cb0('0x1d')][_0x0cb0('0x24')]||null:null,'include':_0x428856[_0x0cb0('0x1d')]?_0x428856['options'][_0x0cb0('0x22')]?_['map'](_0x428856[_0x0cb0('0x1d')][_0x0cb0('0x22')],function(_0x263342){return{'model':db[_0x263342[_0x0cb0('0x23')]],'as':_0x263342['as'],'attributes':_0x263342['attributes'],'include':_0x263342[_0x0cb0('0x22')]?_[_0x0cb0('0x21')](_0x263342[_0x0cb0('0x22')],function(_0x3e39eb){return{'model':db[_0x3e39eb[_0x0cb0('0x23')]],'as':_0x3e39eb['as'],'attributes':_0x3e39eb['attributes'],'include':_0x3e39eb[_0x0cb0('0x22')]?_[_0x0cb0('0x21')](_0x3e39eb['include'],function(_0x2a5530){return{'model':db[_0x2a5530['model']],'as':_0x2a5530['as'],'attributes':_0x2a5530[_0x0cb0('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0cb0('0x10')](function(_0x3f86b0){logger[_0x0cb0('0x11')](_0x0cb0('0x25'),_0x428856);logger[_0x0cb0('0x26')](_0x0cb0('0x25'),_0x428856,JSON['stringify'](_0x3f86b0));_0x4863f(_0x3f86b0);})[_0x0cb0('0x27')](function(_0x8f7e88){logger[_0x0cb0('0x16')](_0x0cb0('0x25'),_0x8f7e88[_0x0cb0('0x18')],_0x428856);_0x2f88dc(_0x3bf10c[_0x0cb0('0x16')](0x1f4,_0x8f7e88[_0x0cb0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5ec69a3..32a5943 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 _0x4bd7=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x51c542,_0xd1c6a6){var _0x1d7fbb=function(_0x13781e){while(--_0x13781e){_0x51c542['push'](_0x51c542['shift']());}};_0x1d7fbb(++_0xd1c6a6);}(_0x4bd7,0x1d2));var _0x74bd=function(_0x7a9ece,_0x3b4720){_0x7a9ece=_0x7a9ece-0x0;var _0x103af1=_0x4bd7[_0x7a9ece];return _0x103af1;};'use strict';var WhatsappQueueEvents=require(_0x74bd('0x0'));var events=[_0x74bd('0x1'),_0x74bd('0x2'),'update'];function createListener(_0x410ff7,_0x1c10f8){return function(_0x532fb5){_0x1c10f8['emit'](_0x410ff7,_0x532fb5);};}function removeListener(_0x4058d9,_0x5a7d7c){return function(){WhatsappQueueEvents[_0x74bd('0x3')](_0x4058d9,_0x5a7d7c);};}exports[_0x74bd('0x4')]=function(_0xadec77){for(var _0x358c16=0x0,_0x3007cb=events[_0x74bd('0x5')];_0x358c16<_0x3007cb;_0x358c16++){var _0x29dd26=events[_0x358c16];var _0x415150=createListener(_0x74bd('0x6')+_0x29dd26,_0xadec77);WhatsappQueueEvents['on'](_0x29dd26,_0x415150);}}; \ No newline at end of file +var _0x8c0e=['remove','update','emit','register','length','whatsappQueue:','save'];(function(_0x10a6c5,_0x3b8168){var _0x79e4b8=function(_0x4699c8){while(--_0x4699c8){_0x10a6c5['push'](_0x10a6c5['shift']());}};_0x79e4b8(++_0x3b8168);}(_0x8c0e,0x14f));var _0xe8c0=function(_0x1b8686,_0x3ee0b4){_0x1b8686=_0x1b8686-0x0;var _0x5572e3=_0x8c0e[_0x1b8686];return _0x5572e3;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xe8c0('0x0'),_0xe8c0('0x1'),_0xe8c0('0x2')];function createListener(_0x249bf2,_0x1adf18){return function(_0x13d8d0){_0x1adf18[_0xe8c0('0x3')](_0x249bf2,_0x13d8d0);};}function removeListener(_0x3cbd3e,_0x17bbed){return function(){WhatsappQueueEvents['removeListener'](_0x3cbd3e,_0x17bbed);};}exports[_0xe8c0('0x4')]=function(_0x387a96){for(var _0x54808a=0x0,_0x422e75=events[_0xe8c0('0x5')];_0x54808a<_0x422e75;_0x54808a++){var _0x4328ab=events[_0x54808a];var _0x4b8a1d=createListener(_0xe8c0('0x6')+_0x4328ab,_0x387a96);WhatsappQueueEvents['on'](_0x4328ab,_0x4b8a1d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b4e6671..d70efb5 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 _0xc327=['get','isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller'];(function(_0xaa24fe,_0x1a76d7){var _0x202a1b=function(_0x1c2f14){while(--_0x1c2f14){_0xaa24fe['push'](_0xaa24fe['shift']());}};_0x202a1b(++_0x1a76d7);}(_0xc327,0x1e5));var _0x7c32=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc327[_0x484e36];return _0xafc85d;};'use strict';var multer=require('multer');var util=require(_0x7c32('0x0'));var path=require(_0x7c32('0x1'));var timeout=require(_0x7c32('0x2'));var express=require(_0x7c32('0x3'));var router=express[_0x7c32('0x4')]();var fs_extra=require(_0x7c32('0x5'));var auth=require(_0x7c32('0x6'));var interaction=require(_0x7c32('0x7'));var config=require('../../config/environment');var controller=require(_0x7c32('0x8'));router[_0x7c32('0x9')]('/',auth[_0x7c32('0xa')](),controller[_0x7c32('0xb')]);router['get']('/describe',auth[_0x7c32('0xa')](),controller[_0x7c32('0xc')]);router[_0x7c32('0x9')](_0x7c32('0xd'),auth[_0x7c32('0xa')](),controller[_0x7c32('0xe')]);router[_0x7c32('0xf')]('/',auth[_0x7c32('0xa')](),controller['create']);router[_0x7c32('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7c32('0xd'),auth[_0x7c32('0xa')](),controller[_0x7c32('0x11')]);module[_0x7c32('0x12')]=router; \ No newline at end of file +var _0x7ac9=['../../config/environment','./whatsappQueueReport.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x375233,_0x165da0){var _0xb1fac5=function(_0x535787){while(--_0x535787){_0x375233['push'](_0x375233['shift']());}};_0xb1fac5(++_0x165da0);}(_0x7ac9,0xeb));var _0x97ac=function(_0x240238,_0x2509e7){_0x240238=_0x240238-0x0;var _0x2cd1c2=_0x7ac9[_0x240238];return _0x2cd1c2;};'use strict';var multer=require(_0x97ac('0x0'));var util=require(_0x97ac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x97ac('0x2'));var router=express[_0x97ac('0x3')]();var fs_extra=require(_0x97ac('0x4'));var auth=require(_0x97ac('0x5'));var interaction=require(_0x97ac('0x6'));var config=require(_0x97ac('0x7'));var controller=require(_0x97ac('0x8'));router[_0x97ac('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x97ac('0x9')](_0x97ac('0xa'),auth['isAuthenticated'](),controller[_0x97ac('0xb')]);router[_0x97ac('0x9')](_0x97ac('0xc'),auth[_0x97ac('0xd')](),controller[_0x97ac('0xe')]);router[_0x97ac('0xf')]('/',auth['isAuthenticated'](),controller[_0x97ac('0x10')]);router[_0x97ac('0x11')](_0x97ac('0xc'),auth[_0x97ac('0xd')](),controller[_0x97ac('0x12')]);router[_0x97ac('0x13')]('/:id',auth[_0x97ac('0xd')](),controller[_0x97ac('0x14')]);module[_0x97ac('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index efdf5db..9ca3d91 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(_0x4c7b2a,_0x12527e){var _0xd4e35a=function(_0x1ac535){while(--_0x1ac535){_0x4c7b2a['push'](_0x4c7b2a['shift']());}};_0xd4e35a(++_0x12527e);}(_0x7a54,0x106));var _0x47a5=function(_0x3ba278,_0x21dfbb){_0x3ba278=_0x3ba278-0x0;var _0x4032e8=_0x7a54[_0x3ba278];return _0x4032e8;};'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(_0x592c94,_0x2fe33c){var _0x2c1c86=function(_0x331cee){while(--_0x331cee){_0x592c94['push'](_0x592c94['shift']());}};_0x2c1c86(++_0x2fe33c);}(_0x7a54,0x106));var _0x47a5=function(_0x3d6bab,_0x2c677f){_0x3d6bab=_0x3d6bab-0x0;var _0xc0b940=_0x7a54[_0x3d6bab];return _0xc0b940;};'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 5b6a4a1..6ba5186 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 _0x5eb8=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','catch','show','params','keys','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','WhatsappQueueReport'];(function(_0x50a635,_0x158de3){var _0x15fcdf=function(_0x16342e){while(--_0x16342e){_0x50a635['push'](_0x50a635['shift']());}};_0x15fcdf(++_0x158de3);}(_0x5eb8,0xb0));var _0x85eb=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x5eb8[_0x137d1d];return _0x485108;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){_0x5b48d9[_0x85eb('0x1a')](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x5dfc96,_0x39d3fe){return function(_0x3453cd){if(!_0x3453cd){_0x5dfc96[_0x85eb('0x27')](0x194);}return _0x3453cd;};}function handleError(_0x30e766,_0x3e2326){_0x3e2326=_0x3e2326||0x1f4;return function(_0x57a03c){logger[_0x85eb('0x28')](_0x57a03c[_0x85eb('0x29')]);if(_0x57a03c[_0x85eb('0x2a')]){delete _0x57a03c[_0x85eb('0x2a')];}_0x30e766[_0x85eb('0x1a')](_0x3e2326)[_0x85eb('0x2b')](_0x57a03c);};}exports['index']=function(_0x562792,_0x37515c){var _0x585f2a={},_0xa9b14f={},_0x5255eb={'count':0x0,'rows':[]};var _0x4229e9=_[_0x85eb('0x2c')](db[_0x85eb('0x2d')][_0x85eb('0x2e')],function(_0xa67e1c){return{'name':_0xa67e1c[_0x85eb('0x2f')],'type':_0xa67e1c[_0x85eb('0x30')]['key']};});_0xa9b14f[_0x85eb('0x31')]=_[_0x85eb('0x2c')](_0x4229e9,'name');_0xa9b14f[_0x85eb('0x32')]=_['keys'](_0x562792['query']);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],_0xa9b14f[_0x85eb('0x32')]);_0x585f2a[_0x85eb('0x35')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x562792[_0x85eb('0x32')][_0x85eb('0x36')]));_0x585f2a['attributes']=_0x585f2a[_0x85eb('0x35')][_0x85eb('0x37')]?_0x585f2a['attributes']:_0xa9b14f['model'];if(!_0x562792[_0x85eb('0x32')][_0x85eb('0x38')](_0x85eb('0x39'))){_0x585f2a[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1e')]);_0x585f2a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1c')]);}_0x585f2a[_0x85eb('0x3a')]=qs[_0x85eb('0x3b')](_0x562792[_0x85eb('0x32')]['sort']);_0x585f2a[_0x85eb('0x3c')]=qs[_0x85eb('0x33')](_['pick'](_0x562792['query'],_0xa9b14f[_0x85eb('0x33')]),_0x4229e9);if(_0x562792[_0x85eb('0x32')]['filter']){_0x585f2a[_0x85eb('0x3c')]=_['merge'](_0x585f2a[_0x85eb('0x3c')],{'$or':_['map'](_0x4229e9,function(_0xaa27ca){if(_0xaa27ca['type']!==_0x85eb('0x3d')){var _0x5c618a={};_0x5c618a[_0xaa27ca[_0x85eb('0x2a')]]={'$like':'%'+_0x562792[_0x85eb('0x32')]['filter']+'%'};return _0x5c618a;}})});}_0x585f2a=_[_0x85eb('0x3e')]({},_0x585f2a,_0x562792['options']);var _0x2a6baa={'where':_0x585f2a[_0x85eb('0x3c')]};return db['WhatsappQueueReport'][_0x85eb('0x1f')](_0x2a6baa)['then'](function(_0x5495cf){_0x5255eb[_0x85eb('0x1f')]=_0x5495cf;if(_0x562792['query'][_0x85eb('0x3f')]){_0x585f2a[_0x85eb('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x585f2a);})[_0x85eb('0x26')](function(_0x422ec3){_0x5255eb['rows']=_0x422ec3;return _0x5255eb;})['then'](respondWithFilteredResult(_0x37515c,_0x585f2a))[_0x85eb('0x41')](handleError(_0x37515c,null));};exports[_0x85eb('0x42')]=function(_0x2211f9,_0x202681){var _0x3be961={'raw':!![],'where':{'id':_0x2211f9[_0x85eb('0x43')]['id']}},_0x5b7411={};_0x5b7411[_0x85eb('0x31')]=_[_0x85eb('0x44')](db[_0x85eb('0x2d')][_0x85eb('0x2e')]);_0x5b7411[_0x85eb('0x32')]=_[_0x85eb('0x44')](_0x2211f9[_0x85eb('0x32')]);_0x5b7411[_0x85eb('0x33')]=_['intersection'](_0x5b7411[_0x85eb('0x31')],_0x5b7411[_0x85eb('0x32')]);_0x3be961['attributes']=_[_0x85eb('0x34')](_0x5b7411[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x2211f9[_0x85eb('0x32')][_0x85eb('0x36')]));_0x3be961[_0x85eb('0x35')]=_0x3be961['attributes'][_0x85eb('0x37')]?_0x3be961[_0x85eb('0x35')]:_0x5b7411[_0x85eb('0x31')];if(_0x2211f9[_0x85eb('0x32')][_0x85eb('0x3f')]){_0x3be961[_0x85eb('0x40')]=[{'all':!![]}];}_0x3be961=_[_0x85eb('0x3e')]({},_0x3be961,_0x2211f9[_0x85eb('0x45')]);return db['WhatsappQueueReport'][_0x85eb('0x46')](_0x3be961)[_0x85eb('0x26')](handleEntityNotFound(_0x202681,null))[_0x85eb('0x26')](respondWithResult(_0x202681,null))[_0x85eb('0x41')](handleError(_0x202681,null));};exports[_0x85eb('0x47')]=function(_0x1a19c2,_0x3c387a){return db[_0x85eb('0x2d')][_0x85eb('0x47')](_0x1a19c2[_0x85eb('0x48')],{})[_0x85eb('0x26')](respondWithResult(_0x3c387a,0xc9))[_0x85eb('0x41')](handleError(_0x3c387a,null));};exports['update']=function(_0x11da79,_0x2c951b){if(_0x11da79[_0x85eb('0x48')]['id']){delete _0x11da79['body']['id'];}return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x11da79[_0x85eb('0x43')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2c951b,null))[_0x85eb('0x26')](saveUpdates(_0x11da79['body'],null))[_0x85eb('0x26')](respondWithResult(_0x2c951b,null))[_0x85eb('0x41')](handleError(_0x2c951b,null));};exports[_0x85eb('0x25')]=function(_0x50e264,_0xc5cb43){return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x50e264['params']['id']}})['then'](handleEntityNotFound(_0xc5cb43,null))[_0x85eb('0x26')](removeEntity(_0xc5cb43,null))['catch'](handleError(_0xc5cb43,null));};exports['describe']=function(_0x3f0b0c,_0x593723){return db[_0x85eb('0x2d')][_0x85eb('0x49')]()['then'](respondWithResult(_0x593723,null))['catch'](handleError(_0x593723,null));}; \ No newline at end of file +var _0xb688=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','show','includeAll','include','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x31dd81,_0x41fc33){var _0x34867e=function(_0x390caf){while(--_0x390caf){_0x31dd81['push'](_0x31dd81['shift']());}};_0x34867e(++_0x41fc33);}(_0xb688,0xcf));var _0x8b68=function(_0x2d8ad6,_0x3a4c24){_0x2d8ad6=_0x2d8ad6-0x0;var _0x20c118=_0xb688[_0x2d8ad6];return _0x20c118;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){_0x32ddc5['status'](0xcc)[_0x8b68('0x27')]();});}};}function handleEntityNotFound(_0x3cf8d2,_0x240b0b){return function(_0x5590ec){if(!_0x5590ec){_0x3cf8d2['sendStatus'](0x194);}return _0x5590ec;};}function handleError(_0x4fe8f6,_0x92d186){_0x92d186=_0x92d186||0x1f4;return function(_0x448e43){logger[_0x8b68('0x28')](_0x448e43['stack']);if(_0x448e43[_0x8b68('0x29')]){delete _0x448e43['name'];}_0x4fe8f6['status'](_0x92d186)[_0x8b68('0x2a')](_0x448e43);};}exports['index']=function(_0x26cad7,_0x3ac356){var _0x48e2c8={},_0x494ce4={},_0x357635={'count':0x0,'rows':[]};var _0x1cd230=_[_0x8b68('0x2b')](db[_0x8b68('0x2c')][_0x8b68('0x2d')],function(_0x2ad2df){return{'name':_0x2ad2df[_0x8b68('0x2e')],'type':_0x2ad2df['type'][_0x8b68('0x2f')]};});_0x494ce4['model']=_[_0x8b68('0x2b')](_0x1cd230,_0x8b68('0x29'));_0x494ce4['query']=_[_0x8b68('0x30')](_0x26cad7[_0x8b68('0x31')]);_0x494ce4[_0x8b68('0x32')]=_['intersection'](_0x494ce4['model'],_0x494ce4[_0x8b68('0x31')]);_0x48e2c8[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x494ce4[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x36')]));_0x48e2c8[_0x8b68('0x33')]=_0x48e2c8[_0x8b68('0x33')][_0x8b68('0x37')]?_0x48e2c8[_0x8b68('0x33')]:_0x494ce4[_0x8b68('0x35')];if(!_0x26cad7[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x48e2c8[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x1f')]);_0x48e2c8[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x26cad7[_0x8b68('0x31')]['offset']);}_0x48e2c8['order']=qs[_0x8b68('0x3a')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3a')]);_0x48e2c8[_0x8b68('0x3b')]=qs[_0x8b68('0x32')](_[_0x8b68('0x3c')](_0x26cad7[_0x8b68('0x31')],_0x494ce4[_0x8b68('0x32')]),_0x1cd230);if(_0x26cad7['query'][_0x8b68('0x3d')]){_0x48e2c8[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x48e2c8[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x2b')](_0x1cd230,function(_0x3e0032){if(_0x3e0032[_0x8b68('0x3f')]!==_0x8b68('0x40')){var _0x517571={};_0x517571[_0x3e0032[_0x8b68('0x29')]]={'$like':'%'+_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3d')]+'%'};return _0x517571;}})});}_0x48e2c8=_[_0x8b68('0x3e')]({},_0x48e2c8,_0x26cad7[_0x8b68('0x41')]);var _0x3b3394={'where':_0x48e2c8[_0x8b68('0x3b')]};return db['WhatsappQueueReport'][_0x8b68('0x21')](_0x3b3394)[_0x8b68('0x25')](function(_0x48f159){_0x357635[_0x8b68('0x21')]=_0x48f159;if(_0x26cad7[_0x8b68('0x31')]['includeAll']){_0x48e2c8['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x48e2c8);})[_0x8b68('0x25')](function(_0x23d24a){_0x357635['rows']=_0x23d24a;return _0x357635;})[_0x8b68('0x25')](respondWithFilteredResult(_0x3ac356,_0x48e2c8))['catch'](handleError(_0x3ac356,null));};exports[_0x8b68('0x42')]=function(_0x3841d2,_0x5a3193){var _0x2f90d9={'raw':!![],'where':{'id':_0x3841d2['params']['id']}},_0x5ae345={};_0x5ae345['model']=_[_0x8b68('0x30')](db[_0x8b68('0x2c')][_0x8b68('0x2d')]);_0x5ae345[_0x8b68('0x31')]=_['keys'](_0x3841d2[_0x8b68('0x31')]);_0x5ae345['filters']=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],_0x5ae345['query']);_0x2f90d9[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x3841d2['query'][_0x8b68('0x36')]));_0x2f90d9[_0x8b68('0x33')]=_0x2f90d9[_0x8b68('0x33')][_0x8b68('0x37')]?_0x2f90d9[_0x8b68('0x33')]:_0x5ae345[_0x8b68('0x35')];if(_0x3841d2[_0x8b68('0x31')][_0x8b68('0x43')]){_0x2f90d9[_0x8b68('0x44')]=[{'all':!![]}];}_0x2f90d9=_[_0x8b68('0x3e')]({},_0x2f90d9,_0x3841d2[_0x8b68('0x41')]);return db[_0x8b68('0x2c')][_0x8b68('0x45')](_0x2f90d9)[_0x8b68('0x25')](handleEntityNotFound(_0x5a3193,null))[_0x8b68('0x25')](respondWithResult(_0x5a3193,null))[_0x8b68('0x46')](handleError(_0x5a3193,null));};exports['create']=function(_0x3b7b06,_0x20681a){return db['WhatsappQueueReport'][_0x8b68('0x47')](_0x3b7b06['body'],{})['then'](respondWithResult(_0x20681a,0xc9))['catch'](handleError(_0x20681a,null));};exports[_0x8b68('0x24')]=function(_0x35874b,_0x34047c){if(_0x35874b[_0x8b68('0x48')]['id']){delete _0x35874b['body']['id'];}return db['WhatsappQueueReport'][_0x8b68('0x45')]({'where':{'id':_0x35874b[_0x8b68('0x49')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))['then'](saveUpdates(_0x35874b[_0x8b68('0x48')],null))[_0x8b68('0x25')](respondWithResult(_0x34047c,null))['catch'](handleError(_0x34047c,null));};exports[_0x8b68('0x26')]=function(_0xacac82,_0x595942){return db[_0x8b68('0x2c')][_0x8b68('0x45')]({'where':{'id':_0xacac82['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x595942,null))[_0x8b68('0x25')](removeEntity(_0x595942,null))['catch'](handleError(_0x595942,null));};exports['describe']=function(_0x5e3e99,_0x28f82d){return db[_0x8b68('0x2c')][_0x8b68('0x4a')]()[_0x8b68('0x25')](respondWithResult(_0x28f82d,null))['catch'](handleError(_0x28f82d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 284a6a4..1611479 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 _0x16b7=['path','rimraf','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x16b7,0x19f));var _0x716b=function(_0x19a49f,_0x124354){_0x19a49f=_0x19a49f-0x0;var _0x1e1fb2=_0x16b7[_0x19a49f];return _0x1e1fb2;};'use strict';var _=require(_0x716b('0x0'));var util=require(_0x716b('0x1'));var logger=require(_0x716b('0x2'))('api');var moment=require(_0x716b('0x3'));var BPromise=require(_0x716b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x716b('0x5'));var rimraf=require(_0x716b('0x6'));var config=require('../../config/environment');var attributes=require(_0x716b('0x7'));module[_0x716b('0x8')]=function(_0x54531b,_0x5d7b66){return _0x54531b[_0x716b('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x716b('0xa'),'paranoid':![],'indexes':[{'name':_0x716b('0xb'),'fields':[_0x716b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c0e=['moment','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x4e3d9f,_0x29c41b){var _0x26d48d=function(_0x3ba428){while(--_0x3ba428){_0x4e3d9f['push'](_0x4e3d9f['shift']());}};_0x26d48d(++_0x29c41b);}(_0x3c0e,0x1a1));var _0xe3c0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3c0e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xe3c0('0x0'));var util=require(_0xe3c0('0x1'));var logger=require(_0xe3c0('0x2'))('api');var moment=require(_0xe3c0('0x3'));var BPromise=require(_0xe3c0('0x4'));var rp=require(_0xe3c0('0x5'));var fs=require('fs');var path=require(_0xe3c0('0x6'));var rimraf=require(_0xe3c0('0x7'));var config=require('../../config/environment');var attributes=require(_0xe3c0('0x8'));module[_0xe3c0('0x9')]=function(_0x4d38b2,_0x127d3e){return _0x4d38b2['define']('WhatsappQueueReport',attributes,{'tableName':_0xe3c0('0xa'),'paranoid':![],'indexes':[{'name':_0xe3c0('0xb'),'fields':[_0xe3c0('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 bc4a88a..29faff1 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 _0xf840=['UpdateWhatsappQueueReport','update','body','where','attributes','limit','lodash','bluebird','randomstring','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0xf840,0x7a));var _0x0f84=function(_0x3e451f,_0x10500d){_0x3e451f=_0x3e451f-0x0;var _0x57978f=_0xf840[_0x3e451f];return _0x57978f;};'use strict';var _=require(_0x0f84('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0f84('0x1'));var rs=require(_0x0f84('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f84('0x3'))('rpc');var config=require(_0x0f84('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0f84('0x5')][_0x0f84('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x47974e,_0x4964da,_0x3fb3c2){return new BPromise(function(_0x55a1a7,_0x5011cd){return client[_0x0f84('0x7')](_0x47974e,_0x3fb3c2)[_0x0f84('0x8')](function(_0x536ab9){logger[_0x0f84('0x9')](_0x0f84('0xa'),_0x4964da,_0x0f84('0xb'));logger[_0x0f84('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4964da,'request\x20sent',JSON[_0x0f84('0xd')](_0x536ab9));if(_0x536ab9['error']){if(_0x536ab9[_0x0f84('0xe')][_0x0f84('0xf')]===0x1f4){logger[_0x0f84('0xe')](_0x0f84('0xa'),_0x4964da,_0x536ab9[_0x0f84('0xe')][_0x0f84('0x10')]);return _0x5011cd(_0x536ab9[_0x0f84('0xe')][_0x0f84('0x10')]);}logger['error'](_0x0f84('0xa'),_0x4964da,_0x536ab9[_0x0f84('0xe')]['message']);return _0x55a1a7(_0x536ab9[_0x0f84('0xe')][_0x0f84('0x10')]);}else{logger[_0x0f84('0x9')](_0x0f84('0xa'),_0x4964da,'request\x20sent');_0x55a1a7(_0x536ab9[_0x0f84('0x11')][_0x0f84('0x10')]);}})[_0x0f84('0x12')](function(_0x413947){logger[_0x0f84('0xe')](_0x0f84('0xa'),_0x4964da,_0x413947);_0x5011cd(_0x413947);});});}exports[_0x0f84('0x13')]=function(_0x525492){var _0x198a78=this;return new Promise(function(_0xb7fae,_0x70d1cf){return db[_0x0f84('0x14')]['create'](_0x525492['body'],{'raw':_0x525492['options']?_0x525492[_0x0f84('0x15')][_0x0f84('0x16')]===undefined?!![]:![]:!![]})[_0x0f84('0x8')](function(_0xacc19f){logger[_0x0f84('0x9')](_0x0f84('0x13'),_0x525492);logger[_0x0f84('0xc')](_0x0f84('0x13'),_0x525492,JSON['stringify'](_0xacc19f));_0xb7fae(_0xacc19f);})[_0x0f84('0x12')](function(_0x586c4a){logger[_0x0f84('0xe')](_0x0f84('0x13'),_0x586c4a[_0x0f84('0x10')],_0x525492);_0x70d1cf(_0x198a78[_0x0f84('0xe')](0x1f4,_0x586c4a['message']));});});};exports[_0x0f84('0x17')]=function(_0x37415e){var _0x38624c=this;return new Promise(function(_0x1b9c1d,_0x19bd83){return db[_0x0f84('0x14')][_0x0f84('0x18')](_0x37415e[_0x0f84('0x19')],{'raw':_0x37415e[_0x0f84('0x15')]?_0x37415e[_0x0f84('0x15')][_0x0f84('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37415e[_0x0f84('0x15')]?_0x37415e[_0x0f84('0x15')][_0x0f84('0x1a')]||null:null,'attributes':_0x37415e[_0x0f84('0x15')]?_0x37415e['options'][_0x0f84('0x1b')]||null:null,'limit':_0x37415e[_0x0f84('0x15')]?_0x37415e['options'][_0x0f84('0x1c')]||null:null})[_0x0f84('0x8')](function(_0x22532b){logger[_0x0f84('0x9')]('UpdateWhatsappQueueReport',_0x37415e);logger[_0x0f84('0xc')]('UpdateWhatsappQueueReport',_0x37415e,JSON[_0x0f84('0xd')](_0x22532b));_0x1b9c1d(_0x22532b);})['catch'](function(_0x30783e){logger['error']('UpdateWhatsappQueueReport',_0x30783e[_0x0f84('0x10')],_0x37415e);_0x19bd83(_0x38624c[_0x0f84('0xe')](0x1f4,_0x30783e['message']));});});}; \ No newline at end of file +var _0xf034=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','where','attributes','limit'];(function(_0x13b5c8,_0x56791a){var _0x51ae13=function(_0x1df114){while(--_0x1df114){_0x13b5c8['push'](_0x13b5c8['shift']());}};_0x51ae13(++_0x56791a);}(_0xf034,0x1c7));var _0x4f03=function(_0x4e10bf,_0x559938){_0x4e10bf=_0x4e10bf-0x0;var _0x3c0c88=_0xf034[_0x4e10bf];return _0x3c0c88;};'use strict';var _=require(_0x4f03('0x0'));var util=require(_0x4f03('0x1'));var moment=require(_0x4f03('0x2'));var BPromise=require(_0x4f03('0x3'));var rs=require(_0x4f03('0x4'));var fs=require('fs');var Redis=require(_0x4f03('0x5'));var db=require(_0x4f03('0x6'))['db'];var utils=require(_0x4f03('0x7'));var logger=require(_0x4f03('0x8'))('rpc');var config=require(_0x4f03('0x9'));var jayson=require(_0x4f03('0xa'));var client=jayson[_0x4f03('0xb')][_0x4f03('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x426a39,_0xf7d37,_0xc1ea09){return new BPromise(function(_0x14891f,_0x43cf17){return client[_0x4f03('0xd')](_0x426a39,_0xc1ea09)[_0x4f03('0xe')](function(_0xfe4f74){logger['info'](_0x4f03('0xf'),_0xf7d37,_0x4f03('0x10'));logger[_0x4f03('0x11')](_0x4f03('0x12'),_0xf7d37,_0x4f03('0x10'),JSON[_0x4f03('0x13')](_0xfe4f74));if(_0xfe4f74[_0x4f03('0x14')]){if(_0xfe4f74[_0x4f03('0x14')][_0x4f03('0x15')]===0x1f4){logger[_0x4f03('0x14')](_0x4f03('0xf'),_0xf7d37,_0xfe4f74[_0x4f03('0x14')][_0x4f03('0x16')]);return _0x43cf17(_0xfe4f74[_0x4f03('0x14')][_0x4f03('0x16')]);}logger['error'](_0x4f03('0xf'),_0xf7d37,_0xfe4f74[_0x4f03('0x14')][_0x4f03('0x16')]);return _0x14891f(_0xfe4f74[_0x4f03('0x14')][_0x4f03('0x16')]);}else{logger[_0x4f03('0x17')](_0x4f03('0xf'),_0xf7d37,_0x4f03('0x10'));_0x14891f(_0xfe4f74['result'][_0x4f03('0x16')]);}})[_0x4f03('0x18')](function(_0x4e2f3d){logger[_0x4f03('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0xf7d37,_0x4e2f3d);_0x43cf17(_0x4e2f3d);});});}exports['CreateWhatsappQueueReport']=function(_0xa16fe9){var _0x21d82d=this;return new Promise(function(_0x58ef8a,_0x444ba){return db[_0x4f03('0x19')][_0x4f03('0x1a')](_0xa16fe9[_0x4f03('0x1b')],{'raw':_0xa16fe9['options']?_0xa16fe9[_0x4f03('0x1c')][_0x4f03('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3dacfe){logger[_0x4f03('0x17')](_0x4f03('0x1e'),_0xa16fe9);logger['debug'](_0x4f03('0x1e'),_0xa16fe9,JSON[_0x4f03('0x13')](_0x3dacfe));_0x58ef8a(_0x3dacfe);})[_0x4f03('0x18')](function(_0x3200d2){logger[_0x4f03('0x14')](_0x4f03('0x1e'),_0x3200d2[_0x4f03('0x16')],_0xa16fe9);_0x444ba(_0x21d82d[_0x4f03('0x14')](0x1f4,_0x3200d2['message']));});});};exports[_0x4f03('0x1f')]=function(_0x5ee7e5){var _0x3b7554=this;return new Promise(function(_0x34708c,_0x23a9c1){return db[_0x4f03('0x19')]['update'](_0x5ee7e5[_0x4f03('0x1b')],{'raw':_0x5ee7e5[_0x4f03('0x1c')]?_0x5ee7e5[_0x4f03('0x1c')][_0x4f03('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ee7e5[_0x4f03('0x1c')]?_0x5ee7e5[_0x4f03('0x1c')][_0x4f03('0x20')]||null:null,'attributes':_0x5ee7e5[_0x4f03('0x1c')]?_0x5ee7e5[_0x4f03('0x1c')][_0x4f03('0x21')]||null:null,'limit':_0x5ee7e5['options']?_0x5ee7e5['options'][_0x4f03('0x22')]||null:null})[_0x4f03('0xe')](function(_0x166ac3){logger[_0x4f03('0x17')](_0x4f03('0x1f'),_0x5ee7e5);logger[_0x4f03('0x11')](_0x4f03('0x1f'),_0x5ee7e5,JSON[_0x4f03('0x13')](_0x166ac3));_0x34708c(_0x166ac3);})[_0x4f03('0x18')](function(_0x1c6679){logger[_0x4f03('0x14')](_0x4f03('0x1f'),_0x1c6679[_0x4f03('0x16')],_0x5ee7e5);_0x23a9c1(_0x3b7554['error'](0x1f4,_0x1c6679[_0x4f03('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3cb689d..d756388 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 _0x1108=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer'];(function(_0x951e8f,_0x46616e){var _0x39b037=function(_0x2de5b6){while(--_0x2de5b6){_0x951e8f['push'](_0x951e8f['shift']());}};_0x39b037(++_0x46616e);}(_0x1108,0x155));var _0x8110=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0x1108[_0x573c9e];return _0x5d0714;};'use strict';var multer=require(_0x8110('0x0'));var util=require('util');var path=require(_0x8110('0x1'));var timeout=require('connect-timeout');var express=require(_0x8110('0x2'));var router=express[_0x8110('0x3')]();var fs_extra=require(_0x8110('0x4'));var auth=require(_0x8110('0x5'));var interaction=require(_0x8110('0x6'));var config=require('../../config/environment');var controller=require(_0x8110('0x7'));router[_0x8110('0x8')]('/',auth[_0x8110('0x9')](),controller[_0x8110('0xa')]);router[_0x8110('0x8')](_0x8110('0xb'),auth[_0x8110('0x9')](),controller[_0x8110('0xc')]);router[_0x8110('0x8')](_0x8110('0xd'),auth['isAuthenticated'](),controller[_0x8110('0xe')]);router[_0x8110('0xf')]('/',auth[_0x8110('0x9')](),controller[_0x8110('0x10')]);router['put'](_0x8110('0xd'),auth[_0x8110('0x9')](),controller[_0x8110('0x11')]);router[_0x8110('0x12')](_0x8110('0xd'),auth[_0x8110('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x678d=['isAuthenticated','index','describe','/:id','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x678d,0xab));var _0xd678=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0x678d[_0x2226c1];return _0x178716;};'use strict';var multer=require('multer');var util=require(_0xd678('0x0'));var path=require(_0xd678('0x1'));var timeout=require(_0xd678('0x2'));var express=require('express');var router=express[_0xd678('0x3')]();var fs_extra=require(_0xd678('0x4'));var auth=require(_0xd678('0x5'));var interaction=require(_0xd678('0x6'));var config=require('../../config/environment');var controller=require(_0xd678('0x7'));router[_0xd678('0x8')]('/',auth[_0xd678('0x9')](),controller[_0xd678('0xa')]);router[_0xd678('0x8')]('/describe',auth[_0xd678('0x9')](),controller[_0xd678('0xb')]);router['get'](_0xd678('0xc'),auth[_0xd678('0x9')](),controller['show']);router[_0xd678('0xd')]('/',auth[_0xd678('0x9')](),controller['create']);router['put']('/:id',auth[_0xd678('0x9')](),controller[_0xd678('0xe')]);router[_0xd678('0xf')]('/:id',auth[_0xd678('0x9')](),controller[_0xd678('0x10')]);module[_0xd678('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 05365c1..dbb2159 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 _0x69d4=['exports','ENUM','account','agent','DATE','sequelize'];(function(_0x105b20,_0x388d13){var _0x357455=function(_0x5b28d7){while(--_0x5b28d7){_0x105b20['push'](_0x105b20['shift']());}};_0x357455(++_0x388d13);}(_0x69d4,0x83));var _0x469d=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x69d4[_0x40b3f2];return _0x4ce90c;};'use strict';var Sequelize=require(_0x469d('0x0'));module[_0x469d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x469d('0x2')](_0x469d('0x3'),_0x469d('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x469d('0x5')]}}; \ No newline at end of file +var _0xe5fc=['account','sequelize','STRING','ENUM'];(function(_0x248afa,_0xc057df){var _0x26d2d2=function(_0x337547){while(--_0x337547){_0x248afa['push'](_0x248afa['shift']());}};_0x26d2d2(++_0xc057df);}(_0xe5fc,0x109));var _0xce5f=function(_0x45a9e0,_0x3ca21c){_0x45a9e0=_0x45a9e0-0x0;var _0x4cff92=_0xe5fc[_0x45a9e0];return _0x4cff92;};'use strict';var Sequelize=require(_0xce5f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xce5f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xce5f('0x2')](_0xce5f('0x3'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d503acc..450d834 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 _0x23b3=['apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows','show','params','length','merge','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range'];(function(_0x41a29e,_0x6f3085){var _0x205b20=function(_0x24cddd){while(--_0x24cddd){_0x41a29e['push'](_0x41a29e['shift']());}};_0x205b20(++_0x6f3085);}(_0x23b3,0x101));var _0x323b=function(_0x42a778,_0x3cde9f){_0x42a778=_0x42a778-0x0;var _0x216581=_0x23b3[_0x42a778];return _0x216581;};'use strict';var emlformat=require(_0x323b('0x0'));var rimraf=require(_0x323b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x323b('0x2'));var rp=require(_0x323b('0x3'));var moment=require(_0x323b('0x4'));var BPromise=require(_0x323b('0x5'));var Mustache=require(_0x323b('0x6'));var util=require(_0x323b('0x7'));var path=require(_0x323b('0x8'));var sox=require(_0x323b('0x9'));var csv=require(_0x323b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x323b('0xb'));var _=require('lodash');var squel=require(_0x323b('0xc'));var crypto=require(_0x323b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x323b('0xe'));var toCsv=require(_0x323b('0xa'));var querystring=require(_0x323b('0xf'));var Papa=require('papaparse');var Redis=require(_0x323b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x323b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x323b('0x12'))('api');var utils=require(_0x323b('0x13'));var config=require(_0x323b('0x14'));var licenseUtil=require(_0x323b('0x15'));var db=require(_0x323b('0x16'))['db'];function respondWithStatusCode(_0x511ff4,_0x38d6a4){_0x38d6a4=_0x38d6a4||0xcc;return function(_0x4ef19d){if(_0x4ef19d){return _0x511ff4['sendStatus'](_0x38d6a4);}return _0x511ff4['status'](_0x38d6a4)[_0x323b('0x17')]();};}function respondWithResult(_0x2dc65c,_0x7a9866){_0x7a9866=_0x7a9866||0xc8;return function(_0x4f6e5d){if(_0x4f6e5d){return _0x2dc65c[_0x323b('0x18')](_0x7a9866)[_0x323b('0x19')](_0x4f6e5d);}};}function respondWithFilteredResult(_0x85507a,_0x3efe80){return function(_0xbb1eab){if(_0xbb1eab){var _0x13142c=typeof _0x3efe80['offset']===_0x323b('0x1a')&&typeof _0x3efe80[_0x323b('0x1b')]===_0x323b('0x1a');var _0x484a81=_0xbb1eab[_0x323b('0x1c')];var _0x4de4d2=_0x13142c?0x0:_0x3efe80[_0x323b('0x1d')];var _0x3af07d=_0x13142c?_0xbb1eab[_0x323b('0x1c')]:_0x3efe80[_0x323b('0x1d')]+_0x3efe80[_0x323b('0x1b')];var _0x259fbc;if(_0x3af07d>=_0x484a81){_0x3af07d=_0x484a81;_0x259fbc=0xc8;}else{_0x259fbc=0xce;}_0x85507a['status'](_0x259fbc);return _0x85507a['set'](_0x323b('0x1e'),_0x4de4d2+'-'+_0x3af07d+'/'+_0x484a81)[_0x323b('0x19')](_0xbb1eab);}return null;};}function patchUpdates(_0x201a06){return function(_0xc15897){try{jsonpatch[_0x323b('0x1f')](_0xc15897,_0x201a06,!![]);}catch(_0x10c2b5){return BPromise[_0x323b('0x20')](_0x10c2b5);}return _0xc15897['save']();};}function saveUpdates(_0x21a003,_0x2ed59f){return function(_0x3c3fc2){if(_0x3c3fc2){return _0x3c3fc2['update'](_0x21a003)[_0x323b('0x21')](function(_0x539116){return _0x539116;});}return null;};}function removeEntity(_0x543643,_0x52de08){return function(_0x3c51fa){if(_0x3c51fa){return _0x3c51fa[_0x323b('0x22')]()[_0x323b('0x21')](function(){_0x543643[_0x323b('0x18')](0xcc)[_0x323b('0x17')]();});}};}function handleEntityNotFound(_0x52f947,_0x53aaf4){return function(_0x47d8b0){if(!_0x47d8b0){_0x52f947[_0x323b('0x23')](0x194);}return _0x47d8b0;};}function handleError(_0x43a803,_0x1f078e){_0x1f078e=_0x1f078e||0x1f4;return function(_0xd41531){logger[_0x323b('0x24')](_0xd41531[_0x323b('0x25')]);if(_0xd41531[_0x323b('0x26')]){delete _0xd41531[_0x323b('0x26')];}_0x43a803[_0x323b('0x18')](_0x1f078e)[_0x323b('0x27')](_0xd41531);};}exports[_0x323b('0x28')]=function(_0x499a3c,_0x828bd1){var _0x54d5bd={},_0x3f2a9b={},_0x57464e={'count':0x0,'rows':[]};var _0x309b5b=_[_0x323b('0x29')](db[_0x323b('0x2a')]['rawAttributes'],function(_0x4f55b3){return{'name':_0x4f55b3['fieldName'],'type':_0x4f55b3[_0x323b('0x2b')][_0x323b('0x2c')]};});_0x3f2a9b[_0x323b('0x2d')]=_[_0x323b('0x29')](_0x309b5b,_0x323b('0x26'));_0x3f2a9b['query']=_[_0x323b('0x2e')](_0x499a3c[_0x323b('0x2f')]);_0x3f2a9b['filters']=_[_0x323b('0x30')](_0x3f2a9b[_0x323b('0x2d')],_0x3f2a9b[_0x323b('0x2f')]);_0x54d5bd[_0x323b('0x31')]=_[_0x323b('0x30')](_0x3f2a9b[_0x323b('0x2d')],qs[_0x323b('0x32')](_0x499a3c[_0x323b('0x2f')]['fields']));_0x54d5bd[_0x323b('0x31')]=_0x54d5bd[_0x323b('0x31')]['length']?_0x54d5bd[_0x323b('0x31')]:_0x3f2a9b[_0x323b('0x2d')];if(!_0x499a3c[_0x323b('0x2f')][_0x323b('0x33')](_0x323b('0x34'))){_0x54d5bd['limit']=qs[_0x323b('0x1b')](_0x499a3c[_0x323b('0x2f')][_0x323b('0x1b')]);_0x54d5bd[_0x323b('0x1d')]=qs[_0x323b('0x1d')](_0x499a3c[_0x323b('0x2f')][_0x323b('0x1d')]);}_0x54d5bd['order']=qs[_0x323b('0x35')](_0x499a3c['query'][_0x323b('0x35')]);_0x54d5bd[_0x323b('0x36')]=qs['filters'](_['pick'](_0x499a3c[_0x323b('0x2f')],_0x3f2a9b[_0x323b('0x37')]),_0x309b5b);if(_0x499a3c[_0x323b('0x2f')][_0x323b('0x38')]){_0x54d5bd[_0x323b('0x36')]=_['merge'](_0x54d5bd[_0x323b('0x36')],{'$or':_[_0x323b('0x29')](_0x309b5b,function(_0x34f865){if(_0x34f865['type']!==_0x323b('0x39')){var _0x384229={};_0x384229[_0x34f865[_0x323b('0x26')]]={'$like':'%'+_0x499a3c[_0x323b('0x2f')][_0x323b('0x38')]+'%'};return _0x384229;}})});}_0x54d5bd=_['merge']({},_0x54d5bd,_0x499a3c[_0x323b('0x3a')]);var _0x21d3fc={'where':_0x54d5bd[_0x323b('0x36')]};return db['WhatsappTransferReport'][_0x323b('0x1c')](_0x21d3fc)[_0x323b('0x21')](function(_0x25b1e3){_0x57464e[_0x323b('0x1c')]=_0x25b1e3;if(_0x499a3c[_0x323b('0x2f')][_0x323b('0x3b')]){_0x54d5bd[_0x323b('0x3c')]=[{'all':!![]}];}return db[_0x323b('0x2a')]['findAll'](_0x54d5bd);})[_0x323b('0x21')](function(_0x26ff6a){_0x57464e[_0x323b('0x3d')]=_0x26ff6a;return _0x57464e;})[_0x323b('0x21')](respondWithFilteredResult(_0x828bd1,_0x54d5bd))['catch'](handleError(_0x828bd1,null));};exports[_0x323b('0x3e')]=function(_0x1f71f1,_0x12a6e1){var _0x2cb8cc={'raw':!![],'where':{'id':_0x1f71f1[_0x323b('0x3f')]['id']}},_0x4456c8={};_0x4456c8[_0x323b('0x2d')]=_[_0x323b('0x2e')](db[_0x323b('0x2a')]['rawAttributes']);_0x4456c8[_0x323b('0x2f')]=_['keys'](_0x1f71f1[_0x323b('0x2f')]);_0x4456c8[_0x323b('0x37')]=_[_0x323b('0x30')](_0x4456c8[_0x323b('0x2d')],_0x4456c8[_0x323b('0x2f')]);_0x2cb8cc[_0x323b('0x31')]=_[_0x323b('0x30')](_0x4456c8[_0x323b('0x2d')],qs[_0x323b('0x32')](_0x1f71f1[_0x323b('0x2f')]['fields']));_0x2cb8cc[_0x323b('0x31')]=_0x2cb8cc[_0x323b('0x31')][_0x323b('0x40')]?_0x2cb8cc['attributes']:_0x4456c8['model'];if(_0x1f71f1[_0x323b('0x2f')][_0x323b('0x3b')]){_0x2cb8cc[_0x323b('0x3c')]=[{'all':!![]}];}_0x2cb8cc=_[_0x323b('0x41')]({},_0x2cb8cc,_0x1f71f1[_0x323b('0x3a')]);return db[_0x323b('0x2a')][_0x323b('0x42')](_0x2cb8cc)[_0x323b('0x21')](handleEntityNotFound(_0x12a6e1,null))[_0x323b('0x21')](respondWithResult(_0x12a6e1,null))[_0x323b('0x43')](handleError(_0x12a6e1,null));};exports[_0x323b('0x44')]=function(_0x46d1f9,_0x226032){return db[_0x323b('0x2a')][_0x323b('0x44')](_0x46d1f9[_0x323b('0x45')],{})['then'](respondWithResult(_0x226032,0xc9))['catch'](handleError(_0x226032,null));};exports[_0x323b('0x46')]=function(_0x577713,_0x42b6ff){if(_0x577713[_0x323b('0x45')]['id']){delete _0x577713[_0x323b('0x45')]['id'];}return db[_0x323b('0x2a')][_0x323b('0x42')]({'where':{'id':_0x577713['params']['id']}})[_0x323b('0x21')](handleEntityNotFound(_0x42b6ff,null))[_0x323b('0x21')](saveUpdates(_0x577713[_0x323b('0x45')],null))[_0x323b('0x21')](respondWithResult(_0x42b6ff,null))['catch'](handleError(_0x42b6ff,null));};exports[_0x323b('0x22')]=function(_0x1b70b4,_0x1bc1db){return db[_0x323b('0x2a')][_0x323b('0x42')]({'where':{'id':_0x1b70b4[_0x323b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1bc1db,null))['then'](removeEntity(_0x1bc1db,null))[_0x323b('0x43')](handleError(_0x1bc1db,null));};exports[_0x323b('0x47')]=function(_0x318089,_0x910ae2){return db[_0x323b('0x2a')]['describe']()[_0x323b('0x21')](respondWithResult(_0x910ae2,null))[_0x323b('0x43')](handleError(_0x910ae2,null));}; \ No newline at end of file +var _0xb464=['model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','WhatsappTransferReport','rawAttributes','type','key'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xb464,0xad));var _0x4b46=function(_0x47cc41,_0x11e552){_0x47cc41=_0x47cc41-0x0;var _0x580c72=_0xb464[_0x47cc41];return _0x580c72;};'use strict';var emlformat=require(_0x4b46('0x0'));var rimraf=require(_0x4b46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b46('0x2'));var rp=require(_0x4b46('0x3'));var moment=require('moment');var BPromise=require(_0x4b46('0x4'));var Mustache=require(_0x4b46('0x5'));var util=require(_0x4b46('0x6'));var path=require('path');var sox=require(_0x4b46('0x7'));var csv=require(_0x4b46('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b46('0x9'));var _=require(_0x4b46('0xa'));var squel=require(_0x4b46('0xb'));var crypto=require(_0x4b46('0xc'));var jsforce=require(_0x4b46('0xd'));var deskjs=require(_0x4b46('0xe'));var toCsv=require(_0x4b46('0x8'));var querystring=require(_0x4b46('0xf'));var Papa=require(_0x4b46('0x10'));var Redis=require(_0x4b46('0x11'));var authService=require(_0x4b46('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b46('0x13'));var logger=require('../../config/logger')(_0x4b46('0x14'));var utils=require(_0x4b46('0x15'));var config=require(_0x4b46('0x16'));var licenseUtil=require(_0x4b46('0x17'));var db=require(_0x4b46('0x18'))['db'];function respondWithStatusCode(_0xde1a48,_0x309f0b){_0x309f0b=_0x309f0b||0xcc;return function(_0x3a8ec3){if(_0x3a8ec3){return _0xde1a48['sendStatus'](_0x309f0b);}return _0xde1a48[_0x4b46('0x19')](_0x309f0b)[_0x4b46('0x1a')]();};}function respondWithResult(_0x5acb02,_0x59e642){_0x59e642=_0x59e642||0xc8;return function(_0x23de44){if(_0x23de44){return _0x5acb02[_0x4b46('0x19')](_0x59e642)[_0x4b46('0x1b')](_0x23de44);}};}function respondWithFilteredResult(_0x387ad3,_0x62977e){return function(_0x3d2ce6){if(_0x3d2ce6){var _0x481471=typeof _0x62977e[_0x4b46('0x1c')]===_0x4b46('0x1d')&&typeof _0x62977e[_0x4b46('0x1e')]==='undefined';var _0x2d5b7b=_0x3d2ce6[_0x4b46('0x1f')];var _0x17dfe6=_0x481471?0x0:_0x62977e['offset'];var _0x31aa56=_0x481471?_0x3d2ce6[_0x4b46('0x1f')]:_0x62977e[_0x4b46('0x1c')]+_0x62977e['limit'];var _0xc6011d;if(_0x31aa56>=_0x2d5b7b){_0x31aa56=_0x2d5b7b;_0xc6011d=0xc8;}else{_0xc6011d=0xce;}_0x387ad3[_0x4b46('0x19')](_0xc6011d);return _0x387ad3['set'](_0x4b46('0x20'),_0x17dfe6+'-'+_0x31aa56+'/'+_0x2d5b7b)['json'](_0x3d2ce6);}return null;};}function patchUpdates(_0x412ae6){return function(_0x13656f){try{jsonpatch[_0x4b46('0x21')](_0x13656f,_0x412ae6,!![]);}catch(_0xe31164){return BPromise['reject'](_0xe31164);}return _0x13656f[_0x4b46('0x22')]();};}function saveUpdates(_0x12bb36,_0x57ac49){return function(_0x30faa6){if(_0x30faa6){return _0x30faa6[_0x4b46('0x23')](_0x12bb36)[_0x4b46('0x24')](function(_0x4031f1){return _0x4031f1;});}return null;};}function removeEntity(_0x230beb,_0x3d7c2b){return function(_0xd10b0d){if(_0xd10b0d){return _0xd10b0d[_0x4b46('0x25')]()[_0x4b46('0x24')](function(){_0x230beb[_0x4b46('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a92c,_0x4c1a05){return function(_0x8faa44){if(!_0x8faa44){_0x29a92c['sendStatus'](0x194);}return _0x8faa44;};}function handleError(_0x2091a9,_0xc185df){_0xc185df=_0xc185df||0x1f4;return function(_0xd9a83c){logger['error'](_0xd9a83c[_0x4b46('0x26')]);if(_0xd9a83c[_0x4b46('0x27')]){delete _0xd9a83c[_0x4b46('0x27')];}_0x2091a9[_0x4b46('0x19')](_0xc185df)[_0x4b46('0x28')](_0xd9a83c);};}exports[_0x4b46('0x29')]=function(_0x178a97,_0x5c7473){var _0x2b22d7={},_0x5d925c={},_0x5df371={'count':0x0,'rows':[]};var _0x2c19ea=_['map'](db[_0x4b46('0x2a')][_0x4b46('0x2b')],function(_0x349d27){return{'name':_0x349d27['fieldName'],'type':_0x349d27[_0x4b46('0x2c')][_0x4b46('0x2d')]};});_0x5d925c[_0x4b46('0x2e')]=_[_0x4b46('0x2f')](_0x2c19ea,'name');_0x5d925c[_0x4b46('0x30')]=_['keys'](_0x178a97['query']);_0x5d925c[_0x4b46('0x31')]=_[_0x4b46('0x32')](_0x5d925c[_0x4b46('0x2e')],_0x5d925c['query']);_0x2b22d7[_0x4b46('0x33')]=_[_0x4b46('0x32')](_0x5d925c[_0x4b46('0x2e')],qs[_0x4b46('0x34')](_0x178a97[_0x4b46('0x30')]['fields']));_0x2b22d7[_0x4b46('0x33')]=_0x2b22d7['attributes'][_0x4b46('0x35')]?_0x2b22d7[_0x4b46('0x33')]:_0x5d925c['model'];if(!_0x178a97[_0x4b46('0x30')][_0x4b46('0x36')]('nolimit')){_0x2b22d7[_0x4b46('0x1e')]=qs['limit'](_0x178a97['query']['limit']);_0x2b22d7[_0x4b46('0x1c')]=qs['offset'](_0x178a97[_0x4b46('0x30')][_0x4b46('0x1c')]);}_0x2b22d7[_0x4b46('0x37')]=qs[_0x4b46('0x38')](_0x178a97[_0x4b46('0x30')][_0x4b46('0x38')]);_0x2b22d7[_0x4b46('0x39')]=qs[_0x4b46('0x31')](_['pick'](_0x178a97['query'],_0x5d925c[_0x4b46('0x31')]),_0x2c19ea);if(_0x178a97[_0x4b46('0x30')][_0x4b46('0x3a')]){_0x2b22d7[_0x4b46('0x39')]=_[_0x4b46('0x3b')](_0x2b22d7[_0x4b46('0x39')],{'$or':_['map'](_0x2c19ea,function(_0x5279ee){if(_0x5279ee[_0x4b46('0x2c')]!==_0x4b46('0x3c')){var _0x446b6d={};_0x446b6d[_0x5279ee['name']]={'$like':'%'+_0x178a97[_0x4b46('0x30')][_0x4b46('0x3a')]+'%'};return _0x446b6d;}})});}_0x2b22d7=_[_0x4b46('0x3b')]({},_0x2b22d7,_0x178a97[_0x4b46('0x3d')]);var _0x467190={'where':_0x2b22d7[_0x4b46('0x39')]};return db['WhatsappTransferReport']['count'](_0x467190)['then'](function(_0x285b76){_0x5df371[_0x4b46('0x1f')]=_0x285b76;if(_0x178a97[_0x4b46('0x30')][_0x4b46('0x3e')]){_0x2b22d7[_0x4b46('0x3f')]=[{'all':!![]}];}return db[_0x4b46('0x2a')][_0x4b46('0x40')](_0x2b22d7);})[_0x4b46('0x24')](function(_0x4a316a){_0x5df371[_0x4b46('0x41')]=_0x4a316a;return _0x5df371;})[_0x4b46('0x24')](respondWithFilteredResult(_0x5c7473,_0x2b22d7))['catch'](handleError(_0x5c7473,null));};exports['show']=function(_0x578e18,_0x4372ad){var _0x43c533={'raw':!![],'where':{'id':_0x578e18['params']['id']}},_0x35adad={};_0x35adad[_0x4b46('0x2e')]=_[_0x4b46('0x42')](db[_0x4b46('0x2a')][_0x4b46('0x2b')]);_0x35adad[_0x4b46('0x30')]=_['keys'](_0x578e18[_0x4b46('0x30')]);_0x35adad[_0x4b46('0x31')]=_[_0x4b46('0x32')](_0x35adad[_0x4b46('0x2e')],_0x35adad[_0x4b46('0x30')]);_0x43c533['attributes']=_[_0x4b46('0x32')](_0x35adad['model'],qs['fields'](_0x578e18[_0x4b46('0x30')][_0x4b46('0x34')]));_0x43c533[_0x4b46('0x33')]=_0x43c533[_0x4b46('0x33')]['length']?_0x43c533['attributes']:_0x35adad[_0x4b46('0x2e')];if(_0x578e18['query'][_0x4b46('0x3e')]){_0x43c533[_0x4b46('0x3f')]=[{'all':!![]}];}_0x43c533=_[_0x4b46('0x3b')]({},_0x43c533,_0x578e18[_0x4b46('0x3d')]);return db[_0x4b46('0x2a')][_0x4b46('0x43')](_0x43c533)[_0x4b46('0x24')](handleEntityNotFound(_0x4372ad,null))[_0x4b46('0x24')](respondWithResult(_0x4372ad,null))[_0x4b46('0x44')](handleError(_0x4372ad,null));};exports[_0x4b46('0x45')]=function(_0x1d9ee7,_0x2d3dc7){return db[_0x4b46('0x2a')]['create'](_0x1d9ee7[_0x4b46('0x46')],{})['then'](respondWithResult(_0x2d3dc7,0xc9))['catch'](handleError(_0x2d3dc7,null));};exports[_0x4b46('0x23')]=function(_0x4856c8,_0x3fa191){if(_0x4856c8[_0x4b46('0x46')]['id']){delete _0x4856c8[_0x4b46('0x46')]['id'];}return db['WhatsappTransferReport'][_0x4b46('0x43')]({'where':{'id':_0x4856c8['params']['id']}})['then'](handleEntityNotFound(_0x3fa191,null))[_0x4b46('0x24')](saveUpdates(_0x4856c8[_0x4b46('0x46')],null))[_0x4b46('0x24')](respondWithResult(_0x3fa191,null))[_0x4b46('0x44')](handleError(_0x3fa191,null));};exports['destroy']=function(_0x17ca96,_0x1c8d17){return db['WhatsappTransferReport'][_0x4b46('0x43')]({'where':{'id':_0x17ca96[_0x4b46('0x47')]['id']}})[_0x4b46('0x24')](handleEntityNotFound(_0x1c8d17,null))['then'](removeEntity(_0x1c8d17,null))[_0x4b46('0x44')](handleError(_0x1c8d17,null));};exports[_0x4b46('0x48')]=function(_0x24ee7e,_0x13a917){return db['WhatsappTransferReport'][_0x4b46('0x48')]()['then'](respondWithResult(_0x13a917,null))['catch'](handleError(_0x13a917,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3190f2a..bc63a73 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 _0xa33c=['moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api'];(function(_0x4babe0,_0x4b7683){var _0x324f70=function(_0x381384){while(--_0x381384){_0x4babe0['push'](_0x4babe0['shift']());}};_0x324f70(++_0x4b7683);}(_0xa33c,0xc9));var _0xca33=function(_0x3476dd,_0x2ccef6){_0x3476dd=_0x3476dd-0x0;var _0x58fe3c=_0xa33c[_0x3476dd];return _0x58fe3c;};'use strict';var _=require(_0xca33('0x0'));var util=require(_0xca33('0x1'));var logger=require('../../config/logger')(_0xca33('0x2'));var moment=require(_0xca33('0x3'));var BPromise=require(_0xca33('0x4'));var rp=require(_0xca33('0x5'));var fs=require('fs');var path=require(_0xca33('0x6'));var rimraf=require('rimraf');var config=require(_0xca33('0x7'));var attributes=require(_0xca33('0x8'));module['exports']=function(_0x1a3363,_0x247cc0){return _0x1a3363['define'](_0xca33('0x9'),attributes,{'tableName':_0xca33('0xa'),'paranoid':![],'indexes':[{'name':_0xca33('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd40=['path','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4323d4,_0x1c38df){var _0x1c3864=function(_0x29beb0){while(--_0x29beb0){_0x4323d4['push'](_0x4323d4['shift']());}};_0x1c3864(++_0x1c38df);}(_0xcd40,0x68));var _0x0cd4=function(_0x401542,_0x11c5d6){_0x401542=_0x401542-0x0;var _0x5a2499=_0xcd40[_0x401542];return _0x5a2499;};'use strict';var _=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var logger=require(_0x0cd4('0x2'))(_0x0cd4('0x3'));var moment=require('moment');var BPromise=require(_0x0cd4('0x4'));var rp=require(_0x0cd4('0x5'));var fs=require('fs');var path=require(_0x0cd4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x0cd4('0x7')]=function(_0x5e24d9,_0x251a33){return _0x5e24d9['define'](_0x0cd4('0x8'),attributes,{'tableName':_0x0cd4('0x9'),'paranoid':![],'indexes':[{'name':_0x0cd4('0xa'),'fields':[_0x0cd4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1122397..d213072 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 _0x0ca0=['jayson/promise','client','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5de827,_0xed9578){var _0xc63b4e=function(_0x41b5cd){while(--_0x41b5cd){_0x5de827['push'](_0x5de827['shift']());}};_0xc63b4e(++_0xed9578);}(_0x0ca0,0x115));var _0x00ca=function(_0x2e8b2f,_0xe72108){_0x2e8b2f=_0x2e8b2f-0x0;var _0x4fe6e5=_0x0ca0[_0x2e8b2f];return _0x4fe6e5;};'use strict';var _=require(_0x00ca('0x0'));var util=require(_0x00ca('0x1'));var moment=require(_0x00ca('0x2'));var BPromise=require(_0x00ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00ca('0x4'));var db=require(_0x00ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00ca('0x6'))(_0x00ca('0x7'));var config=require(_0x00ca('0x8'));var jayson=require(_0x00ca('0x9'));var client=jayson[_0x00ca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff6de,_0x15bc26,_0x1be0e0){return new BPromise(function(_0x8d120f,_0x247513){return client['request'](_0x4ff6de,_0x1be0e0)[_0x00ca('0xb')](function(_0x1f0fbf){logger[_0x00ca('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x15bc26,_0x00ca('0xd'));logger['debug'](_0x00ca('0xe'),_0x15bc26,_0x00ca('0xd'),JSON[_0x00ca('0xf')](_0x1f0fbf));if(_0x1f0fbf[_0x00ca('0x10')]){if(_0x1f0fbf['error'][_0x00ca('0x11')]===0x1f4){logger[_0x00ca('0x10')](_0x00ca('0x12'),_0x15bc26,_0x1f0fbf[_0x00ca('0x10')][_0x00ca('0x13')]);return _0x247513(_0x1f0fbf[_0x00ca('0x10')][_0x00ca('0x13')]);}logger[_0x00ca('0x10')](_0x00ca('0x12'),_0x15bc26,_0x1f0fbf[_0x00ca('0x10')]['message']);return _0x8d120f(_0x1f0fbf['error']['message']);}else{logger[_0x00ca('0xc')](_0x00ca('0x12'),_0x15bc26,_0x00ca('0xd'));_0x8d120f(_0x1f0fbf[_0x00ca('0x14')][_0x00ca('0x13')]);}})[_0x00ca('0x15')](function(_0x21aa21){logger[_0x00ca('0x10')](_0x00ca('0x12'),_0x15bc26,_0x21aa21);_0x247513(_0x21aa21);});});} \ No newline at end of file +var _0xd8f0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d8d40,_0x2ce931){var _0x190116=function(_0x18564b){while(--_0x18564b){_0x2d8d40['push'](_0x2d8d40['shift']());}};_0x190116(++_0x2ce931);}(_0xd8f0,0xaa));var _0x0d8f=function(_0xe5cac7,_0x6c2f84){_0xe5cac7=_0xe5cac7-0x0;var _0x50df20=_0xd8f0[_0xe5cac7];return _0x50df20;};'use strict';var _=require('lodash');var util=require(_0x0d8f('0x0'));var moment=require(_0x0d8f('0x1'));var BPromise=require(_0x0d8f('0x2'));var rs=require(_0x0d8f('0x3'));var fs=require('fs');var Redis=require(_0x0d8f('0x4'));var db=require(_0x0d8f('0x5'))['db'];var utils=require(_0x0d8f('0x6'));var logger=require(_0x0d8f('0x7'))(_0x0d8f('0x8'));var config=require(_0x0d8f('0x9'));var jayson=require(_0x0d8f('0xa'));var client=jayson[_0x0d8f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28f638,_0x4dd0cb,_0x49bbeb){return new BPromise(function(_0x301a91,_0x4c28f4){return client[_0x0d8f('0xc')](_0x28f638,_0x49bbeb)[_0x0d8f('0xd')](function(_0x2af252){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x4dd0cb,'request\x20sent');logger['debug'](_0x0d8f('0xe'),_0x4dd0cb,'request\x20sent',JSON[_0x0d8f('0xf')](_0x2af252));if(_0x2af252[_0x0d8f('0x10')]){if(_0x2af252[_0x0d8f('0x10')]['code']===0x1f4){logger[_0x0d8f('0x10')](_0x0d8f('0x11'),_0x4dd0cb,_0x2af252['error'][_0x0d8f('0x12')]);return _0x4c28f4(_0x2af252['error'][_0x0d8f('0x12')]);}logger[_0x0d8f('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4dd0cb,_0x2af252['error'][_0x0d8f('0x12')]);return _0x301a91(_0x2af252[_0x0d8f('0x10')][_0x0d8f('0x12')]);}else{logger['info'](_0x0d8f('0x11'),_0x4dd0cb,_0x0d8f('0x13'));_0x301a91(_0x2af252[_0x0d8f('0x14')][_0x0d8f('0x12')]);}})[_0x0d8f('0x15')](function(_0x48b6d7){logger[_0x0d8f('0x10')](_0x0d8f('0x11'),_0x4dd0cb,_0x48b6d7);_0x4c28f4(_0x48b6d7);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3e739e9..b5f9064 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbce2=['sequelize','sync','then','info','start','Online\x20apps:','map','online','name','join','Offline\x20apps:','filter','status','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0xbce2,0x1b5));var _0x2bce=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xbce2[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x2bce('0x0'));var mysqldb=require(_0x2bce('0x1'));var rpc=require(_0x2bce('0x2'));var config=require(_0x2bce('0x3'));var logger=require(_0x2bce('0x4'))(_0x2bce('0x5'));var pm2=require(_0x2bce('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x2bce('0x7'));var chat=require(_0x2bce('0x8'));var whatsapp=require(_0x2bce('0x9'));var transcribe=require(_0x2bce('0xa'));function main(){return mysqldb['db'][_0x2bce('0xb')][_0x2bce('0xc')]()[_0x2bce('0xd')](function(){return rpc['listen']();})[_0x2bce('0xd')](function(_0x13ff5c){logger[_0x2bce('0xe')](_0x13ff5c);return chat['start']();})[_0x2bce('0xd')](function(){return whatsapp[_0x2bce('0xf')]();})[_0x2bce('0xd')](function(){return schedule[_0x2bce('0xf')]();})['then'](function(){return transcribe[_0x2bce('0xf')]();})[_0x2bce('0xd')](function(_0x291860){logger[_0x2bce('0xe')](_0x291860);return pm2[_0x2bce('0xf')](pm2Config);})['then'](function(_0x1055f8){logger[_0x2bce('0xe')](_0x2bce('0x10'),_[_0x2bce('0x11')](_['filter'](_0x1055f8,{'status':_0x2bce('0x12')}),_0x2bce('0x13'))[_0x2bce('0x14')]());logger['info'](_0x2bce('0x15'),_['map'](_[_0x2bce('0x16')](_0x1055f8,function(_0x717c5a){return _0x717c5a[_0x2bce('0x17')]!==_0x2bce('0x12');}),_0x2bce('0x13'))[_0x2bce('0x14')]()||'None');config[_0x2bce('0x18')]&&require(_0x2bce('0x19'))[_0x2bce('0x1a')]();require(_0x2bce('0x1b'))[_0x2bce('0x1a')]();})[_0x2bce('0x1c')](function(_0x4c2b4b){logger[_0x2bce('0x1d')](_0x2bce('0x1e'),_0x4c2b4b);process[_0x2bce('0x1f')](0x1);});}main(); \ No newline at end of file +var _0x8e25=['join','Offline\x20apps:','status','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','listen','then','start','info','Online\x20apps:','map','filter','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e25,0x1d9));var _0x58e2=function(_0x2d6d25,_0x5c8736){_0x2d6d25=_0x2d6d25-0x0;var _0x176a23=_0x8e25[_0x2d6d25];return _0x176a23;};'use strict';var _=require(_0x58e2('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x58e2('0x1'));var config=require(_0x58e2('0x2'));var logger=require(_0x58e2('0x3'))(_0x58e2('0x4'));var pm2=require(_0x58e2('0x5'));var pm2Config=require(_0x58e2('0x6'));var schedule=require('./config/schedule');var chat=require(_0x58e2('0x7'));var whatsapp=require(_0x58e2('0x8'));var transcribe=require(_0x58e2('0x9'));function main(){return mysqldb['db'][_0x58e2('0xa')][_0x58e2('0xb')]()['then'](function(){return rpc[_0x58e2('0xc')]();})[_0x58e2('0xd')](function(_0x4c72b6){logger['info'](_0x4c72b6);return chat[_0x58e2('0xe')]();})[_0x58e2('0xd')](function(){return whatsapp[_0x58e2('0xe')]();})[_0x58e2('0xd')](function(){return schedule[_0x58e2('0xe')]();})[_0x58e2('0xd')](function(){return transcribe[_0x58e2('0xe')]();})[_0x58e2('0xd')](function(_0x177ed8){logger[_0x58e2('0xf')](_0x177ed8);return pm2[_0x58e2('0xe')](pm2Config);})[_0x58e2('0xd')](function(_0x2c3267){logger[_0x58e2('0xf')](_0x58e2('0x10'),_[_0x58e2('0x11')](_[_0x58e2('0x12')](_0x2c3267,{'status':'online'}),_0x58e2('0x13'))[_0x58e2('0x14')]());logger[_0x58e2('0xf')](_0x58e2('0x15'),_['map'](_[_0x58e2('0x12')](_0x2c3267,function(_0xe49da5){return _0xe49da5[_0x58e2('0x16')]!=='online';}),'name')['join']()||'None');config['seedDB']&&require(_0x58e2('0x17'))[_0x58e2('0x18')]();require(_0x58e2('0x19'))[_0x58e2('0x18')]();})[_0x58e2('0x1a')](function(_0x269cbd){logger[_0x58e2('0x1b')](_0x58e2('0x1c'),_0x269cbd);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 872dc2d..7781736 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 _0x1f1e=['headers','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','join','promisify','secret','payload','options','secrets','randomBytes','hex','floor','toString','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','session','role','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','then','disposition','json','unmanaged','Unmanaged.','Forbidden.','catch','startsWith'];(function(_0x1e8fe3,_0x590dfe){var _0x1c10a8=function(_0xa09738){while(--_0xa09738){_0x1e8fe3['push'](_0x1e8fe3['shift']());}};_0x1c10a8(++_0x590dfe);}(_0x1f1e,0x1ce));var _0xe1f1=function(_0x5363e4,_0x61f3f2){_0x5363e4=_0x5363e4-0x0;var _0x4a99b9=_0x1f1e[_0x5363e4];return _0x4a99b9;};'use strict';var db=require(_0xe1f1('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xe1f1('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xe1f1('0x2'));var _=require(_0xe1f1('0x3'));var jwt=require(_0xe1f1('0x4'));var expressJwt=require(_0xe1f1('0x5'));var compose=require(_0xe1f1('0x6'));var basicAuth=require(_0xe1f1('0x7'));var crypto=require(_0xe1f1('0x8'));var BPromise=require(_0xe1f1('0x9'));var util=require(_0xe1f1('0xa'));var moment=require(_0xe1f1('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0xe1f1('0xc')]});var userAttributes=['id',_0xe1f1('0xd'),'fullname',_0xe1f1('0xe'),_0xe1f1('0xf'),'email',_0xe1f1('0x10'),_0xe1f1('0x11'),_0xe1f1('0x12'),_0xe1f1('0x13'),_0xe1f1('0x14'),_0xe1f1('0x15'),_0xe1f1('0x16'),_0xe1f1('0x17'),_0xe1f1('0x18'),_0xe1f1('0x19'),_0xe1f1('0x1a'),'lastLoginAt',_0xe1f1('0x1b'),_0xe1f1('0x1c'),_0xe1f1('0x1d'),_0xe1f1('0x1e'),_0xe1f1('0x1f'),_0xe1f1('0x20'),_0xe1f1('0x21'),'phoneBarDnd',_0xe1f1('0x22'),_0xe1f1('0x23'),_0xe1f1('0x24'),'phoneBarExpires',_0xe1f1('0x25'),_0xe1f1('0x26'),_0xe1f1('0x27'),_0xe1f1('0x28'),_0xe1f1('0x29'),_0xe1f1('0x2a'),'privacyEnabled',_0xe1f1('0x2b'),_0xe1f1('0x2c'),_0xe1f1('0x2d'),'downloadOmnichannelInteractions',_0xe1f1('0x2e')];exports[_0xe1f1('0x2f')]=function(){return this[_0xe1f1('0x30')](!![])[_0xe1f1('0x31')](function(_0x535580,_0x1ff09b,_0x3b5e19){if(_0x535580[_0xe1f1('0x32')]){_0x3b5e19();}else{return db['ChatInteraction'][_0xe1f1('0x33')]({'where':{'id':_0x535580[_0xe1f1('0x34')]['id']},'attributes':['id',_0xe1f1('0x35'),'disposition'],'raw':!![]})[_0xe1f1('0x36')](function(_0x37e09f){if(_0x37e09f&&_0x37e09f[_0xe1f1('0x35')]){return _0x1ff09b['status'](_0x37e09f[_0xe1f1('0x37')]==='unmanaged'?0x195:0x193)[_0xe1f1('0x38')]({'message':_0x37e09f['disposition']===_0xe1f1('0x39')?_0xe1f1('0x3a'):_0xe1f1('0x3b')});}else{_0x3b5e19();}})[_0xe1f1('0x3c')](function(_0x5137ef){_0x3b5e19(_0x5137ef);});}});};exports[_0xe1f1('0x30')]=function isAuthenticated(_0x19ebb7){return compose()['use'](function(_0x41af14,_0x43ce8b,_0x4f3c38){var _0x39b88b;if(_0x41af14['headers']['authorization']){if(_[_0xe1f1('0x3d')](_0x41af14[_0xe1f1('0x3e')]['authorization'],_0xe1f1('0x3f'))){var _0x272ffa=basicAuth(_0x41af14);db[_0xe1f1('0x40')][_0xe1f1('0x41')]({'where':{'name':_0x272ffa[_0xe1f1('0xe')]}})[_0xe1f1('0x36')](function(_0x1109db){if(!_0x1109db||!_0x1109db[_0xe1f1('0x42')](_0x272ffa[_0xe1f1('0x43')])){return _0x43ce8b[_0xe1f1('0x44')](0x191)['json']({'message':_0xe1f1('0x45')});}_0x41af14[_0xe1f1('0x32')]={'id':_0x1109db['id']};_0x4f3c38();})[_0xe1f1('0x3c')](function(_0x16a968){_0x4f3c38(_0x16a968);});}else if(_['startsWith'](_0x41af14[_0xe1f1('0x3e')]['authorization'],_0xe1f1('0x46'))){validateJwt(_0x41af14,_0x43ce8b,_0x4f3c38);}else{if(_0x19ebb7){_0x4f3c38();}else{return _0x43ce8b[_0xe1f1('0x44')](0x193)[_0xe1f1('0x38')]({'message':_0xe1f1('0x47')});}}}else if(_0x41af14[_0xe1f1('0x48')]['apikey']){try{var _0x2d55ac={'audience':hardwareConf[_0xe1f1('0x49')](),'issuer':hardwareConf[_0xe1f1('0x49')]()};verifyJwt(_0x41af14[_0xe1f1('0x48')][_0xe1f1('0x4a')],_0x2d55ac)['then'](function(_0x2e276f){return db[_0xe1f1('0x40')][_0xe1f1('0x41')]({'where':{'id':_0x2e276f['sub']}})[_0xe1f1('0x36')](function(_0x23bdf8){_0x39b88b=_0x23bdf8;return db[_0xe1f1('0x4b')][_0xe1f1('0x33')]({'where':{'id':0x1},'attributes':[_0xe1f1('0x4c'),_0xe1f1('0x4d')],'raw':!![]});})[_0xe1f1('0x36')](function(_0x35d558){if(!_0x39b88b||!_[_0xe1f1('0x4e')](_0x39b88b[_0xe1f1('0x4f')],_0x2e276f[_0xe1f1('0x50')])){return _0x43ce8b[_0xe1f1('0x44')](0x191)[_0xe1f1('0x38')]({'message':_0xe1f1('0x51')});}if(_0x39b88b[_0xe1f1('0x52')]){return _0x43ce8b[_0xe1f1('0x44')](0x191)['json']({'message':_0xe1f1('0x53')});}if(_0x39b88b[_0xe1f1('0x54')]){if(_0x35d558[_0xe1f1('0x4d')]>0x0){if(moment(_0x39b88b[_0xe1f1('0x55')])[_0xe1f1('0x56')](_0x35d558['blockDuration'],_0xe1f1('0x57'))>moment()){return _0x43ce8b[_0xe1f1('0x44')](0x191)[_0xe1f1('0x38')]({'message':_0xe1f1('0x53')});}}else{return _0x43ce8b['status'](0x191)[_0xe1f1('0x38')]({'message':_0xe1f1('0x53')});}}_0x41af14[_0xe1f1('0x32')]={'id':_0x39b88b['id']};_0x4f3c38();});})[_0xe1f1('0x3c')](function(){return _0x43ce8b[_0xe1f1('0x44')](0x191)[_0xe1f1('0x38')]({'message':_0xe1f1('0x53')});});}catch(_0x268b26){_0x4f3c38(_0x268b26);}}else if(_0x19ebb7){_0x4f3c38();}else{return _0x43ce8b[_0xe1f1('0x44')](0x193)[_0xe1f1('0x38')]({'message':_0xe1f1('0x47')});}})[_0xe1f1('0x31')](function(_0x2a477c,_0x5b6e93,_0x42bdaf){if(_0x2a477c[_0xe1f1('0x32')]){db['User'][_0xe1f1('0x41')]({'where':{'id':_0x2a477c[_0xe1f1('0x32')]['id']},'attributes':userAttributes})[_0xe1f1('0x36')](function(_0x506c55){if(!_0x506c55){return _0x5b6e93[_0xe1f1('0x44')](0x194)[_0xe1f1('0x38')]({'message':'User\x20not\x20found.'});}_0x2a477c[_0xe1f1('0x32')]=_0x506c55;_0x42bdaf();})[_0xe1f1('0x3c')](function(_0xe6369d){_0x42bdaf(_0xe6369d);});}else if(_0x19ebb7){_0x42bdaf();}else{return _0x5b6e93['status'](0x194)[_0xe1f1('0x38')]({'message':_0xe1f1('0x58')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xe1f1('0x31')](function(_0x10403a,_0x3b140d,_0x53d46a){return licenseUtil[_0xe1f1('0x59')]()[_0xe1f1('0x36')](function(_0x4047eb){if(_0x4047eb['update']){_0x53d46a();}else{return _0x3b140d[_0xe1f1('0x44')](0x193)[_0xe1f1('0x38')]({'message':_0xe1f1('0x5a')});}})[_0xe1f1('0x3c')](function(_0x2c0794){_0x53d46a(_0x2c0794);});});};exports[_0xe1f1('0x5b')]=function(_0xd39b79,_0x5650da,_0x3cad78){_0xd39b79['isMiddleware']=!![];return _0x3cad78();};exports[_0xe1f1('0x5c')]=function signToken(_0xa89aa2){return signJwt(_0xa89aa2);};exports[_0xe1f1('0x5d')]=function(_0x3dcdb4,_0x14afb4){if(!_0x3dcdb4[_0xe1f1('0x32')]){return _0x14afb4[_0xe1f1('0x44')](0x194)[_0xe1f1('0x38')]({'message':_0xe1f1('0x5e')});}var _0x8ab956={'payload':{'id':_0x3dcdb4['user']['id'],'role':_0x3dcdb4['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x8ab956)[_0xe1f1('0x36')](function(_0x2b9eaf){_0x14afb4[_0xe1f1('0x5f')](_0xe1f1('0x60'),_0x2b9eaf);_0x14afb4[_0xe1f1('0x61')](_0xe1f1('0x62'));})[_0xe1f1('0x3c')](function(_0x5c7c70){return _0x14afb4['status'](0x1f4)[_0xe1f1('0x63')](_0x5c7c70);});};exports['retrieveApiKey']=function(_0x18c3a2){if(_[_0xe1f1('0x64')](_0x18c3a2[_0xe1f1('0x4f')])||_['isNil'](_0x18c3a2[_0xe1f1('0x65')])){return null;}else{return createJwt(_0x18c3a2);}};exports[_0xe1f1('0x66')]=function(_0x41b542){_0x41b542[_0xe1f1('0x4f')]=generateNonce();_0x41b542[_0xe1f1('0x65')]=generateIssuedAt();return createJwt(_0x41b542);};exports['regenerateApiKey']=function(_0x37394d,_0x236558){var _0x23a271=_0x37394d[_0xe1f1('0x48')][_0xe1f1('0x4a')];if(_0x23a271){var _0x3f0d60={'nonce':_0x236558[_0xe1f1('0x4f')],'iat':_0x236558[_0xe1f1('0x65')],'audience':hardwareConf[_0xe1f1('0x49')](),'issuer':hardwareConf[_0xe1f1('0x49')]()};return verifyJwt(_0x23a271,_0x3f0d60)[_0xe1f1('0x36')](function(){return generateApiKey(_0x236558);});}else{throw{'message':_0xe1f1('0x67')};}};exports[_0xe1f1('0x68')]=function(_0x5d5f0b){var _0x5e7eee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5e7eee['test'](_0x5d5f0b))throw new db['Sequelize'][(_0xe1f1('0x69'))](_0xe1f1('0x6a'));return;};exports[_0xe1f1('0x6b')]=function(_0x37879b,_0x2aa7c2,_0x56478a){var _0x2828e1=encryptor['decryptString'](_0x2aa7c2)[_0xe1f1('0x6c')](',');for(var _0x4d405c=0x0;_0x4d405c<_0x56478a;_0x4d405c++){if(!_0x2828e1[_0x4d405c])break;if(_0x37879b[_0xe1f1('0x6d')]()===_0x2828e1[_0x4d405c][_0xe1f1('0x6d')]()){var _0x1bef28=util[_0xe1f1('0x6e')](_0xe1f1('0x6f'),_0x56478a);if(_0x56478a===0x1){_0x1bef28=_0xe1f1('0x70');}throw new db[(_0xe1f1('0x71'))]['ValidationError'](_0x1bef28);}}return;};exports[_0xe1f1('0x72')]=function(_0x568f94,_0x1d735c){var _0x2927a0=_0x1d735c?encryptor[_0xe1f1('0x73')](_0x1d735c)[_0xe1f1('0x6c')](','):[];if(_0x2927a0[_0xe1f1('0x74')]===0x5){_0x2927a0[_0xe1f1('0x75')](-0x1,0x1);}_0x2927a0[_0xe1f1('0x76')](_0x568f94);return encryptor[_0xe1f1('0x77')](_0x2927a0[_0xe1f1('0x78')](','));};function signJwt(_0x484ee4){var _0x102159=BPromise[_0xe1f1('0x79')](jwt['sign'],{'context':jwt});var _0x18dd96=_0x484ee4[_0xe1f1('0x7a')]||config['secrets']['session'];return new BPromise(function(_0x51e582,_0x33ba16){_0x102159(_0x484ee4[_0xe1f1('0x7b')],_0x18dd96,_0x484ee4[_0xe1f1('0x7c')])[_0xe1f1('0x36')](function(_0x2fa2cd){_0x51e582(_0x2fa2cd);})[_0xe1f1('0x3c')](function(_0x692062){_0x33ba16(_0x692062);});});}function verifyJwt(_0x51d304,_0x1e7a0f,_0x426542){var _0x5cb243=BPromise[_0xe1f1('0x79')](jwt['verify'],{'context':jwt});var _0x2499e0=_0x426542||config[_0xe1f1('0x7d')]['session'];return new BPromise(function(_0x2742b3,_0x53007b){_0x5cb243(_0x51d304,_0x2499e0,_0x1e7a0f)[_0xe1f1('0x36')](function(_0x3296db){_0x2742b3(_0x3296db);})[_0xe1f1('0x3c')](function(_0x49ae21){_0x53007b(_0x49ae21);});});}function generateNonce(){return crypto[_0xe1f1('0x7e')](0x10)['toString'](_0xe1f1('0x7f'));}function generateIssuedAt(){return Math[_0xe1f1('0x80')](Date['now']()/0x3e8)[_0xe1f1('0x81')]();}function createJwt(_0x5c1a18){var _0x138949={'payload':{'iat':_0x5c1a18[_0xe1f1('0x65')],'nonce':_0x5c1a18[_0xe1f1('0x4f')]},'options':{'algorithm':_0xe1f1('0x82'),'subject':_0x5c1a18['id']['toString'](),'issuer':hardwareConf[_0xe1f1('0x49')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x138949)[_0xe1f1('0x36')](function(_0xbc0bcc){return{'iat':_0x5c1a18[_0xe1f1('0x65')],'nonce':_0x5c1a18['apiKeyNonce'],'token':_0xbc0bcc};});} \ No newline at end of file +var _0x2c8c=['disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','motion.token','redirect','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','join','promisify','sign','secret','secrets','options','verify','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','then','closed','unmanaged','json','disposition','Unmanaged.','Forbidden.','catch','headers','startsWith','Basic','User','authenticate','pass','status','authorization','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','find','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x2c8c,0xab));var _0xc2c8=function(_0x3ca080,_0x3c9d68){_0x3ca080=_0x3ca080-0x0;var _0x5f47ac=_0x2c8c[_0x3ca080];return _0x5f47ac;};'use strict';var db=require(_0xc2c8('0x0'))['db'];var config=require(_0xc2c8('0x1'));var hardwareConf=require(_0xc2c8('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xc2c8('0x3'));var _=require(_0xc2c8('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xc2c8('0x5'));var compose=require(_0xc2c8('0x6'));var basicAuth=require(_0xc2c8('0x7'));var crypto=require(_0xc2c8('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xc2c8('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xc2c8('0xa')]});var userAttributes=['id','role',_0xc2c8('0xb'),_0xc2c8('0xc'),'internal',_0xc2c8('0xd'),_0xc2c8('0xe'),_0xc2c8('0xf'),_0xc2c8('0x10'),_0xc2c8('0x11'),_0xc2c8('0x12'),_0xc2c8('0x13'),_0xc2c8('0x14'),_0xc2c8('0x15'),_0xc2c8('0x16'),_0xc2c8('0x17'),'showWebBar','lastLoginAt',_0xc2c8('0x18'),_0xc2c8('0x19'),_0xc2c8('0x1a'),_0xc2c8('0x1b'),_0xc2c8('0x1c'),_0xc2c8('0x1d'),'phoneBarAutoAnswerDelay',_0xc2c8('0x1e'),_0xc2c8('0x1f'),_0xc2c8('0x20'),_0xc2c8('0x21'),_0xc2c8('0x22'),_0xc2c8('0x23'),_0xc2c8('0x24'),_0xc2c8('0x25'),_0xc2c8('0x26'),_0xc2c8('0x27'),_0xc2c8('0x28'),_0xc2c8('0x29'),'settingsEnabled',_0xc2c8('0x2a'),_0xc2c8('0x2b'),'downloadOmnichannelInteractions',_0xc2c8('0x2c')];exports[_0xc2c8('0x2d')]=function(){return this[_0xc2c8('0x2e')](!![])[_0xc2c8('0x2f')](function(_0x4fc1a0,_0x3fd28d,_0x8c0973){if(_0x4fc1a0[_0xc2c8('0x30')]){_0x8c0973();}else{return db['ChatInteraction'][_0xc2c8('0x31')]({'where':{'id':_0x4fc1a0[_0xc2c8('0x32')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xc2c8('0x33')](function(_0x3c092d){if(_0x3c092d&&_0x3c092d[_0xc2c8('0x34')]){return _0x3fd28d['status'](_0x3c092d['disposition']===_0xc2c8('0x35')?0x195:0x193)[_0xc2c8('0x36')]({'message':_0x3c092d[_0xc2c8('0x37')]===_0xc2c8('0x35')?_0xc2c8('0x38'):_0xc2c8('0x39')});}else{_0x8c0973();}})[_0xc2c8('0x3a')](function(_0x5cd0b2){_0x8c0973(_0x5cd0b2);});}});};exports[_0xc2c8('0x2e')]=function isAuthenticated(_0x17bf58){return compose()['use'](function(_0x2d3973,_0x47e482,_0x75a5b8){var _0x4b8520;if(_0x2d3973[_0xc2c8('0x3b')]['authorization']){if(_[_0xc2c8('0x3c')](_0x2d3973[_0xc2c8('0x3b')]['authorization'],_0xc2c8('0x3d'))){var _0x14dda7=basicAuth(_0x2d3973);db[_0xc2c8('0x3e')]['find']({'where':{'name':_0x14dda7[_0xc2c8('0xc')]}})[_0xc2c8('0x33')](function(_0x58afcb){if(!_0x58afcb||!_0x58afcb[_0xc2c8('0x3f')](_0x14dda7[_0xc2c8('0x40')])){return _0x47e482[_0xc2c8('0x41')](0x191)[_0xc2c8('0x36')]({'message':'Wrong\x20credentials.'});}_0x2d3973[_0xc2c8('0x30')]={'id':_0x58afcb['id']};_0x75a5b8();})[_0xc2c8('0x3a')](function(_0x26c61c){_0x75a5b8(_0x26c61c);});}else if(_[_0xc2c8('0x3c')](_0x2d3973['headers'][_0xc2c8('0x42')],_0xc2c8('0x43'))){validateJwt(_0x2d3973,_0x47e482,_0x75a5b8);}else{if(_0x17bf58){_0x75a5b8();}else{return _0x47e482[_0xc2c8('0x41')](0x193)[_0xc2c8('0x36')]({'message':_0xc2c8('0x44')});}}}else if(_0x2d3973[_0xc2c8('0x45')]['apikey']){try{var _0x10dfff={'audience':hardwareConf[_0xc2c8('0x46')](),'issuer':hardwareConf[_0xc2c8('0x46')]()};verifyJwt(_0x2d3973[_0xc2c8('0x45')][_0xc2c8('0x47')],_0x10dfff)[_0xc2c8('0x33')](function(_0x154cad){return db[_0xc2c8('0x3e')][_0xc2c8('0x48')]({'where':{'id':_0x154cad['sub']}})[_0xc2c8('0x33')](function(_0x28553a){_0x4b8520=_0x28553a;return db['Setting'][_0xc2c8('0x31')]({'where':{'id':0x1},'attributes':[_0xc2c8('0x49'),_0xc2c8('0x4a')],'raw':!![]});})['then'](function(_0x52dc86){if(!_0x4b8520||!_[_0xc2c8('0x4b')](_0x4b8520[_0xc2c8('0x4c')],_0x154cad[_0xc2c8('0x4d')])){return _0x47e482[_0xc2c8('0x41')](0x191)[_0xc2c8('0x36')]({'message':_0xc2c8('0x4e')});}if(_0x4b8520[_0xc2c8('0x4f')]){return _0x47e482[_0xc2c8('0x41')](0x191)['json']({'message':_0xc2c8('0x50')});}if(_0x4b8520[_0xc2c8('0x51')]){if(_0x52dc86['blockDuration']>0x0){if(moment(_0x4b8520[_0xc2c8('0x52')])[_0xc2c8('0x53')](_0x52dc86[_0xc2c8('0x4a')],_0xc2c8('0x54'))>moment()){return _0x47e482[_0xc2c8('0x41')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x47e482['status'](0x191)[_0xc2c8('0x36')]({'message':_0xc2c8('0x50')});}}_0x2d3973[_0xc2c8('0x30')]={'id':_0x4b8520['id']};_0x75a5b8();});})[_0xc2c8('0x3a')](function(){return _0x47e482[_0xc2c8('0x41')](0x191)['json']({'message':_0xc2c8('0x50')});});}catch(_0x2e57b8){_0x75a5b8(_0x2e57b8);}}else if(_0x17bf58){_0x75a5b8();}else{return _0x47e482['status'](0x193)[_0xc2c8('0x36')]({'message':'Unknown\x20authorization\x20format'});}})[_0xc2c8('0x2f')](function(_0x51925e,_0x25d5aa,_0x213385){if(_0x51925e['user']){db[_0xc2c8('0x3e')][_0xc2c8('0x48')]({'where':{'id':_0x51925e[_0xc2c8('0x30')]['id']},'attributes':userAttributes})[_0xc2c8('0x33')](function(_0x134ead){if(!_0x134ead){return _0x25d5aa[_0xc2c8('0x41')](0x194)[_0xc2c8('0x36')]({'message':_0xc2c8('0x55')});}_0x51925e['user']=_0x134ead;_0x213385();})[_0xc2c8('0x3a')](function(_0x284cb1){_0x213385(_0x284cb1);});}else if(_0x17bf58){_0x213385();}else{return _0x25d5aa[_0xc2c8('0x41')](0x194)['json']({'message':_0xc2c8('0x56')});}});};exports[_0xc2c8('0x57')]=function canUpdate(){return compose()[_0xc2c8('0x2f')](function(_0x182d06,_0x1576ce,_0x11e7c8){return licenseUtil[_0xc2c8('0x58')]()['then'](function(_0x1c621d){if(_0x1c621d[_0xc2c8('0x59')]){_0x11e7c8();}else{return _0x1576ce[_0xc2c8('0x41')](0x193)[_0xc2c8('0x36')]({'message':_0xc2c8('0x5a')});}})['catch'](function(_0x1548dd){_0x11e7c8(_0x1548dd);});});};exports[_0xc2c8('0x5b')]=function(_0x16c2d5,_0x51fb3e,_0x23305a){_0x16c2d5[_0xc2c8('0x5b')]=!![];return _0x23305a();};exports['signToken']=function signToken(_0x129999){return signJwt(_0x129999);};exports[_0xc2c8('0x5c')]=function(_0x2e2827,_0xe3e706){if(!_0x2e2827[_0xc2c8('0x30')]){return _0xe3e706[_0xc2c8('0x41')](0x194)['json']({'message':_0xc2c8('0x5d')});}var _0x13f8e3={'payload':{'id':_0x2e2827[_0xc2c8('0x30')]['id'],'role':_0x2e2827['user'][_0xc2c8('0x5e')]},'options':{'expiresIn':0x15180}};return signJwt(_0x13f8e3)[_0xc2c8('0x33')](function(_0x58eeb5){_0xe3e706['cookie'](_0xc2c8('0x5f'),_0x58eeb5);_0xe3e706[_0xc2c8('0x60')]('/dashboards/general');})[_0xc2c8('0x3a')](function(_0x492598){return _0xe3e706[_0xc2c8('0x41')](0x1f4)[_0xc2c8('0x61')](_0x492598);});};exports['retrieveApiKey']=function(_0x3d62b0){if(_[_0xc2c8('0x62')](_0x3d62b0[_0xc2c8('0x4c')])||_[_0xc2c8('0x62')](_0x3d62b0['apiKeyIat'])){return null;}else{return createJwt(_0x3d62b0);}};exports[_0xc2c8('0x63')]=function(_0x29fee8){_0x29fee8[_0xc2c8('0x4c')]=generateNonce();_0x29fee8[_0xc2c8('0x64')]=generateIssuedAt();return createJwt(_0x29fee8);};exports[_0xc2c8('0x65')]=function(_0x33cb9c,_0x29b803){var _0x2d91d8=_0x33cb9c[_0xc2c8('0x45')][_0xc2c8('0x47')];if(_0x2d91d8){var _0x2abae4={'nonce':_0x29b803['apiKeyNonce'],'iat':_0x29b803[_0xc2c8('0x64')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xc2c8('0x46')]()};return verifyJwt(_0x2d91d8,_0x2abae4)[_0xc2c8('0x33')](function(){return generateApiKey(_0x29b803);});}else{throw{'message':_0xc2c8('0x66')};}};exports[_0xc2c8('0x67')]=function(_0x4ef1b4){var _0x36d1d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x36d1d2[_0xc2c8('0x68')](_0x4ef1b4))throw new db[(_0xc2c8('0x69'))]['ValidationError'](_0xc2c8('0x6a'));return;};exports[_0xc2c8('0x6b')]=function(_0x160f9d,_0x2cf8b9,_0x5a3cad){var _0x3074b5=encryptor[_0xc2c8('0x6c')](_0x2cf8b9)[_0xc2c8('0x6d')](',');for(var _0xe03d98=0x0;_0xe03d98<_0x5a3cad;_0xe03d98++){if(!_0x3074b5[_0xe03d98])break;if(_0x160f9d[_0xc2c8('0x6e')]()===_0x3074b5[_0xe03d98][_0xc2c8('0x6e')]()){var _0xa47eba=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5a3cad);if(_0x5a3cad===0x1){_0xa47eba=_0xc2c8('0x6f');}throw new db[(_0xc2c8('0x69'))]['ValidationError'](_0xa47eba);}}return;};exports[_0xc2c8('0x70')]=function(_0x48f434,_0x28727f){var _0x113737=_0x28727f?encryptor['decryptString'](_0x28727f)[_0xc2c8('0x6d')](','):[];if(_0x113737['length']===0x5){_0x113737['splice'](-0x1,0x1);}_0x113737['unshift'](_0x48f434);return encryptor['encryptString'](_0x113737[_0xc2c8('0x71')](','));};function signJwt(_0x3fd963){var _0xe7b84d=BPromise[_0xc2c8('0x72')](jwt[_0xc2c8('0x73')],{'context':jwt});var _0x29263a=_0x3fd963[_0xc2c8('0x74')]||config[_0xc2c8('0x75')][_0xc2c8('0xa')];return new BPromise(function(_0x4673f0,_0x978d1d){_0xe7b84d(_0x3fd963['payload'],_0x29263a,_0x3fd963[_0xc2c8('0x76')])[_0xc2c8('0x33')](function(_0x1efd3e){_0x4673f0(_0x1efd3e);})[_0xc2c8('0x3a')](function(_0x3b264b){_0x978d1d(_0x3b264b);});});}function verifyJwt(_0x1ac04e,_0x257bbf,_0x14df55){var _0x5dbc7c=BPromise['promisify'](jwt[_0xc2c8('0x77')],{'context':jwt});var _0x50e61e=_0x14df55||config['secrets']['session'];return new BPromise(function(_0x208562,_0x40b7e2){_0x5dbc7c(_0x1ac04e,_0x50e61e,_0x257bbf)[_0xc2c8('0x33')](function(_0x12fdce){_0x208562(_0x12fdce);})[_0xc2c8('0x3a')](function(_0x176b18){_0x40b7e2(_0x176b18);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xc2c8('0x78'));}function generateIssuedAt(){return Math[_0xc2c8('0x79')](Date[_0xc2c8('0x7a')]()/0x3e8)[_0xc2c8('0x7b')]();}function createJwt(_0x4dcf7a){var _0x45dda9={'payload':{'iat':_0x4dcf7a[_0xc2c8('0x64')],'nonce':_0x4dcf7a[_0xc2c8('0x4c')]},'options':{'algorithm':_0xc2c8('0x7c'),'subject':_0x4dcf7a['id'][_0xc2c8('0x7b')](),'issuer':hardwareConf[_0xc2c8('0x46')](),'audience':hardwareConf[_0xc2c8('0x46')]()}};return signJwt(_0x45dda9)[_0xc2c8('0x33')](function(_0x3c4f52){return{'iat':_0x4dcf7a[_0xc2c8('0x64')],'nonce':_0x4dcf7a[_0xc2c8('0x4c')],'token':_0x3c4f52};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index c7363c1..fac6c47 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 _0x7976=['update','binary','end','final','write','close','decryptFile','encryptString','createCipher','base64','decryptString','secret','createDecipher','utf8','crypto','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','hasOwnProperty','createWriteStream','data'];(function(_0x5cc28f,_0x48f9e2){var _0x1fa608=function(_0x4291ef){while(--_0x4291ef){_0x5cc28f['push'](_0x5cc28f['shift']());}};_0x1fa608(++_0x48f9e2);}(_0x7976,0x16d));var _0x6797=function(_0x51f053,_0x29138b){_0x51f053=_0x51f053-0x0;var _0x5a046b=_0x7976[_0x51f053];return _0x5a046b;};'use strict';var crypto=require(_0x6797('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x6797('0x1'))(_0x6797('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6797('0x3')][_0x6797('0x4')],'algorithm':_0x6797('0x5')};const fileOptions={'algorithm':_0x6797('0x6')};if(config[_0x6797('0x7')]&&config[_0x6797('0x7')][_0x6797('0x8')]){var isSupported=isAlgorithmSupported(config[_0x6797('0x7')][_0x6797('0x8')]);if(isSupported){fileOptions[_0x6797('0x8')]=config[_0x6797('0x7')][_0x6797('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x6797('0x7')][_0x6797('0x8')],_0x6797('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x291922){return AES_SUPPORTED_RX['test'](_0x291922);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x112cb3){return getSupportedCiphers()['indexOf'](_0x112cb3)>-0x1;}function combineOptions(_0x2291ba){var _0x499045={};for(var _0x56727a in fileOptions){if(fileOptions[_0x6797('0xa')](_0x56727a)){_0x499045[_0x56727a]=fileOptions[_0x56727a];}}if(_0x2291ba){for(var _0x5db5db in _0x2291ba){if(_0x2291ba['hasOwnProperty'](_0x5db5db)){_0x499045[_0x5db5db]=_0x2291ba[_0x5db5db];}}}return _0x499045;}exports['encryptFile']=function(_0x57395f,_0x3180b9,_0x395df3,_0x531bda){return new BPromise(function(_0x444acb,_0xca138e){_0x531bda=combineOptions(_0x531bda);var _0x26dec9=new Buffer(_0x395df3);var _0x34245a=fs['createReadStream'](_0x57395f);var _0x3e9cda=fs[_0x6797('0xb')](_0x3180b9);var _0x52bdf7=crypto['createCipher'](_0x531bda[_0x6797('0x8')],_0x26dec9);_0x34245a['on'](_0x6797('0xc'),function(_0x3e4220){var _0x2eb551=new Buffer(_0x52bdf7[_0x6797('0xd')](_0x3e4220),_0x6797('0xe'));_0x3e9cda['write'](_0x2eb551);});_0x34245a['on'](_0x6797('0xf'),function(){try{var _0xb96386=new Buffer(_0x52bdf7[_0x6797('0x10')]('binary'),_0x6797('0xe'));_0x3e9cda[_0x6797('0x11')](_0xb96386);_0x3e9cda[_0x6797('0xf')]();_0x3e9cda['on'](_0x6797('0x12'),function(){return _0x444acb(_0x3180b9);});}catch(_0x539b0b){fs['unlink'](_0x3180b9);return _0xca138e(_0x539b0b);}});});};exports[_0x6797('0x13')]=function(_0x32b7db,_0x28f338,_0xd1b532,_0x3ba331){return new BPromise(function(_0x6e2f08,_0x4150a4){_0x3ba331=combineOptions(_0x3ba331);var _0x27b8cf=new Buffer(_0xd1b532);var _0x58dc93=fs['createReadStream'](_0x32b7db);var _0x5d7cff=fs[_0x6797('0xb')](_0x28f338);var _0x43d688=crypto['createDecipher'](_0x3ba331['algorithm'],_0x27b8cf);_0x58dc93['on']('data',function(_0x201073){var _0x2a6cb2=new Buffer(_0x43d688['update'](_0x201073),_0x6797('0xe'));_0x5d7cff[_0x6797('0x11')](_0x2a6cb2);});_0x58dc93['on'](_0x6797('0xf'),function(){try{var _0x5820c3=new Buffer(_0x43d688[_0x6797('0x10')](_0x6797('0xe')),'binary');_0x5d7cff[_0x6797('0x11')](_0x5820c3);_0x5d7cff[_0x6797('0xf')]();_0x5d7cff['on'](_0x6797('0x12'),function(){return _0x6e2f08(_0x28f338);});}catch(_0x139313){fs['unlink'](_0x28f338);return _0x4150a4(_0x139313);}});});};exports[_0x6797('0x14')]=function(_0x55b8f8,_0x311497,_0x2a3df1){var _0x267cd6=_0x2a3df1||stringOptions['algorithm'];var _0x439bbf=_0x311497||stringOptions['secret'];var _0x557140=crypto[_0x6797('0x15')](_0x267cd6,_0x439bbf);var _0x214546=_0x557140[_0x6797('0xd')](_0x55b8f8,'utf8',_0x6797('0x16'));_0x214546+=_0x557140[_0x6797('0x10')](_0x6797('0x16'));return _0x214546;};exports[_0x6797('0x17')]=function(_0x2ccf57,_0x2ba1b9,_0x555bf2){var _0x4629cb=_0x555bf2||stringOptions['algorithm'];var _0x38e4ee=_0x2ba1b9||stringOptions[_0x6797('0x18')];var _0x113dee=crypto[_0x6797('0x19')](_0x4629cb,_0x38e4ee);var _0x292ee7=_0x113dee[_0x6797('0xd')](_0x2ccf57,_0x6797('0x16'),_0x6797('0x1a'));_0x292ee7+=_0x113dee[_0x6797('0x10')](_0x6797('0x1a'));return _0x292ee7;}; \ No newline at end of file +var _0xee41=['createDecipher','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','final','binary','close','unlink','decryptFile','write','end','encryptString','secret','utf8','base64'];(function(_0x4067a7,_0x19a7b0){var _0x318c52=function(_0x3c6e30){while(--_0x3c6e30){_0x4067a7['push'](_0x4067a7['shift']());}};_0x318c52(++_0x19a7b0);}(_0xee41,0xc7));var _0x1ee4=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0xee41[_0x179b74];return _0x268f76;};'use strict';var crypto=require(_0x1ee4('0x0'));var fs=require('fs');var BPromise=require(_0x1ee4('0x1'));var _=require('lodash');var config=require(_0x1ee4('0x2'));var logger=require(_0x1ee4('0x3'))(_0x1ee4('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1ee4('0x5')][_0x1ee4('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x1ee4('0x7')};if(config[_0x1ee4('0x8')]&&config[_0x1ee4('0x8')][_0x1ee4('0x9')]){var isSupported=isAlgorithmSupported(config[_0x1ee4('0x8')][_0x1ee4('0x9')]);if(isSupported){fileOptions[_0x1ee4('0x9')]=config[_0x1ee4('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1ee4('0xa')](',\x20');logger['error'](config[_0x1ee4('0x8')][_0x1ee4('0x9')],_0x1ee4('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x4435a4){return AES_SUPPORTED_RX[_0x1ee4('0xc')](_0x4435a4);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x1ee4('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x331e9e){return getSupportedCiphers()[_0x1ee4('0xe')](_0x331e9e)>-0x1;}function combineOptions(_0x37b58d){var _0x354dcc={};for(var _0x49dbcf in fileOptions){if(fileOptions['hasOwnProperty'](_0x49dbcf)){_0x354dcc[_0x49dbcf]=fileOptions[_0x49dbcf];}}if(_0x37b58d){for(var _0x28251c in _0x37b58d){if(_0x37b58d[_0x1ee4('0xf')](_0x28251c)){_0x354dcc[_0x28251c]=_0x37b58d[_0x28251c];}}}return _0x354dcc;}exports['encryptFile']=function(_0x5d2cb9,_0x5681d8,_0x21b78,_0x2db7bd){return new BPromise(function(_0x1e585b,_0x16434f){_0x2db7bd=combineOptions(_0x2db7bd);var _0x58042e=new Buffer(_0x21b78);var _0x4575d1=fs[_0x1ee4('0x10')](_0x5d2cb9);var _0x19a7db=fs[_0x1ee4('0x11')](_0x5681d8);var _0x537ec3=crypto[_0x1ee4('0x12')](_0x2db7bd[_0x1ee4('0x9')],_0x58042e);_0x4575d1['on'](_0x1ee4('0x13'),function(_0x25d1aa){var _0x357f05=new Buffer(_0x537ec3[_0x1ee4('0x14')](_0x25d1aa),'binary');_0x19a7db['write'](_0x357f05);});_0x4575d1['on']('end',function(){try{var _0xfc7be9=new Buffer(_0x537ec3[_0x1ee4('0x15')](_0x1ee4('0x16')),_0x1ee4('0x16'));_0x19a7db['write'](_0xfc7be9);_0x19a7db['end']();_0x19a7db['on'](_0x1ee4('0x17'),function(){return _0x1e585b(_0x5681d8);});}catch(_0x377b53){fs[_0x1ee4('0x18')](_0x5681d8);return _0x16434f(_0x377b53);}});});};exports[_0x1ee4('0x19')]=function(_0x23bb45,_0x25c620,_0x334524,_0x21ac91){return new BPromise(function(_0x34ca43,_0x3316ef){_0x21ac91=combineOptions(_0x21ac91);var _0x23b213=new Buffer(_0x334524);var _0x53b24d=fs[_0x1ee4('0x10')](_0x23bb45);var _0x5129e4=fs[_0x1ee4('0x11')](_0x25c620);var _0x2fd3b4=crypto['createDecipher'](_0x21ac91[_0x1ee4('0x9')],_0x23b213);_0x53b24d['on'](_0x1ee4('0x13'),function(_0x5bb806){var _0x3e6a04=new Buffer(_0x2fd3b4['update'](_0x5bb806),'binary');_0x5129e4[_0x1ee4('0x1a')](_0x3e6a04);});_0x53b24d['on'](_0x1ee4('0x1b'),function(){try{var _0x1bdd1a=new Buffer(_0x2fd3b4[_0x1ee4('0x15')](_0x1ee4('0x16')),'binary');_0x5129e4[_0x1ee4('0x1a')](_0x1bdd1a);_0x5129e4['end']();_0x5129e4['on'](_0x1ee4('0x17'),function(){return _0x34ca43(_0x25c620);});}catch(_0x303b1f){fs[_0x1ee4('0x18')](_0x25c620);return _0x3316ef(_0x303b1f);}});});};exports[_0x1ee4('0x1c')]=function(_0x492408,_0x5c4473,_0x231ee3){var _0x47e019=_0x231ee3||stringOptions[_0x1ee4('0x9')];var _0x562381=_0x5c4473||stringOptions[_0x1ee4('0x1d')];var _0x4f31df=crypto[_0x1ee4('0x12')](_0x47e019,_0x562381);var _0x362f31=_0x4f31df[_0x1ee4('0x14')](_0x492408,_0x1ee4('0x1e'),_0x1ee4('0x1f'));_0x362f31+=_0x4f31df['final']('base64');return _0x362f31;};exports['decryptString']=function(_0x5d3d75,_0x3e9945,_0x5e8252){var _0x29b15d=_0x5e8252||stringOptions[_0x1ee4('0x9')];var _0x4de856=_0x3e9945||stringOptions['secret'];var _0x37a483=crypto[_0x1ee4('0x20')](_0x29b15d,_0x4de856);var _0x4be44a=_0x37a483[_0x1ee4('0x14')](_0x5d3d75,_0x1ee4('0x1f'),_0x1ee4('0x1e'));_0x4be44a+=_0x37a483[_0x1ee4('0x15')](_0x1ee4('0x1e'));return _0x4be44a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 977dfb4..c681a84 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 _0x4332=['lodash','to-csv','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0x4332,0xc2));var _0x2433=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4332[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0x2433('0x0'));var path=require(_0x2433('0x1'));var _=require(_0x2433('0x2'));var csv=require(_0x2433('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x2433('0x4'));var rimraf=require('rimraf');var db=require(_0x2433('0x5'))['db'];var dbH=require(_0x2433('0x5'))[_0x2433('0x6')];var logger=require('../../config/logger')(_0x2433('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x2433('0x8')][0x2]);var QUERY=process[_0x2433('0x8')][0x3];var PATH=process[_0x2433('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5e1da7,_0x13f650){var _0x38ae99={'status':_0x5e1da7};var _0x35f959={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x13f650){_0x38ae99[_0x2433('0x9')]=_0x13f650;}return db[_0x2433('0xa')][_0x2433('0xb')](_0x38ae99,_0x35f959);}function main(){var _0x294648=0x1388;var _0x51bf5d;logger[_0x2433('0xc')](util[_0x2433('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x2433('0xe')][_0x2433('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2433('0x10'),_0x2433('0x11')]})[_0x2433('0x12')](function(_0x4d3f96){if(_0x4d3f96){_0x51bf5d=_0x4d3f96;_0x294648=_0x51bf5d[_0x2433('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x2433('0x13')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2433('0x14')][_0x2433('0x15')][_0x2433('0x16')]});})[_0x2433('0x12')](function(_0x2d4782){if(!_0x2d4782[0x0][_0x2433('0x17')]){return analyticExtractedReport(_0x2433('0x18'));}var _0x357467=[];var _0x3e7932=0x0;if(_0x51bf5d[_0x2433('0x10')]){if(_0x2d4782&&_0x2d4782['length']){var _0x5c2ccc=_[_0x2433('0x19')](_0x2d4782[0x0][_0x2433('0x17')]/_0x294648);var _0x2233f9=Number[_0x2433('0x1a')](_0x2d4782[0x0][_0x2433('0x17')]/_0x294648)?_0x2d4782[0x0][_0x2433('0x17')]%_0x294648:0x0;_0x5c2ccc[_0x2433('0x1b')](function(_0x586e14){if(_0x586e14>0x0){_0x3e7932+=_0x294648;}_0x357467[_0x2433('0x1c')](dbH[_0x2433('0x14')][_0x2433('0x13')](util[_0x2433('0xd')](_0x2433('0x1d'),QUERY,_0x294648,_0x3e7932),{'type':dbH[_0x2433('0x14')][_0x2433('0x15')]['SELECT']}));});if(_0x2233f9>0x0){_0x3e7932+=_0x294648;_0x357467[_0x2433('0x1c')](dbH['sequelize'][_0x2433('0x13')](util[_0x2433('0xd')](_0x2433('0x1d'),QUERY,_0x2233f9,_0x3e7932),{'type':dbH['sequelize'][_0x2433('0x15')][_0x2433('0x16')]}));}}}else{_0x357467[_0x2433('0x1c')](dbH[_0x2433('0x14')]['query'](QUERY,{'type':dbH[_0x2433('0x14')]['QueryTypes']['SELECT']}));}var _0x2e821f=path[_0x2433('0x1e')](PATH);var _0x146ac8=path[_0x2433('0x1f')](PATH,'.csv');var _0x5d7c38=_0x51bf5d[_0x2433('0x10')]&&_0x357467[_0x2433('0x20')]>0x1;var _0x488549=[];if(!fs[_0x2433('0x21')](path['join'](_0x2e821f,_0x146ac8))&&_0x5d7c38){fs[_0x2433('0x22')](path[_0x2433('0x23')](_0x2e821f,_0x146ac8));}return BPromise[_0x2433('0x24')](_0x357467,function(_0x2bea6c){_0x488549['push'](_0x2bea6c);})[_0x2433('0x12')](function(){for(var _0xaccf48=0x0;_0xaccf48<_0x488549['length'];_0xaccf48+=0x1){var _0x4c0924;var _0x23c45c=_0x488549[_0xaccf48];if(_0x5d7c38){_0x4c0924=path[_0x2433('0x23')](_0x2e821f,_0x146ac8,util[_0x2433('0xd')](_0x2433('0x25'),_0x146ac8,_0xaccf48,'csv'));}else{_0x4c0924=path[_0x2433('0x23')](_0x2e821f,util[_0x2433('0xd')](_0x2433('0x26'),_0x146ac8,'csv'));}fs[_0x2433('0x27')](_0x4c0924,csv(_0x23c45c));}})[_0x2433('0x12')](function(){if(_0x5d7c38){return new Promise(function(_0x1a3eee){zipdir(path[_0x2433('0x23')](_0x2e821f,_0x146ac8),{'saveTo':path[_0x2433('0x23')](_0x2e821f,util[_0x2433('0xd')](_0x2433('0x26'),_0x146ac8,_0x2433('0x28')))},function(_0x3f01ae,_0x2762dc){rimraf(path[_0x2433('0x23')](_0x2e821f,_0x146ac8),function(){});_0x1a3eee(_0x2433('0x29'));});});}})[_0x2433('0x12')](function(){logger[_0x2433('0xc')](util['format'](_0x2433('0x2a'),EXTRACTED_REPORT_ID,_0x2433('0x2b')));return analyticExtractedReport(_0x2433('0x2c'),_0x5d7c38?util['format']('%s.%s',_0x146ac8,_0x5d7c38?_0x2433('0x28'):'csv'):null);});})['catch'](function(_0x2b0597){logger['info'](util[_0x2433('0xd')](_0x2433('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x2b0597,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2433('0x2e'));})[_0x2433('0x2f')](function(){process[_0x2433('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0fff=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','lodash','to-csv','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','find','split','splitSizeCsv'];(function(_0x9948d9,_0x180ba0){var _0x4062bc=function(_0x5da8e7){while(--_0x5da8e7){_0x9948d9['push'](_0x9948d9['shift']());}};_0x4062bc(++_0x180ba0);}(_0x0fff,0x7a));var _0xf0ff=function(_0x251c55,_0x315c4f){_0x251c55=_0x251c55-0x0;var _0x2f8000=_0x0fff[_0x251c55];return _0x2f8000;};'use strict';var util=require(_0xf0ff('0x0'));var path=require('path');var _=require(_0xf0ff('0x1'));var csv=require(_0xf0ff('0x2'));var fs=require('fs');var BPromise=require(_0xf0ff('0x3'));var zipdir=require(_0xf0ff('0x4'));var rimraf=require('rimraf');var db=require(_0xf0ff('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xf0ff('0x6'))(_0xf0ff('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf0ff('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf0ff('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x50bac1,_0x7d4f49){var _0x38690d={'status':_0x50bac1};var _0xe1b931={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x7d4f49){_0x38690d[_0xf0ff('0x9')]=_0x7d4f49;}return db[_0xf0ff('0xa')][_0xf0ff('0xb')](_0x38690d,_0xe1b931);}function main(){var _0x26e95b=0x1388;var _0x388930;logger[_0xf0ff('0xc')](util[_0xf0ff('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf0ff('0xe')));return db[_0xf0ff('0xf')][_0xf0ff('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf0ff('0x11'),_0xf0ff('0x12')]})[_0xf0ff('0x13')](function(_0x3a6535){if(_0x3a6535){_0x388930=_0x3a6535;_0x26e95b=_0x388930[_0xf0ff('0x12')]||0x1388;}})['then'](function(){return dbH[_0xf0ff('0x14')][_0xf0ff('0x15')](util[_0xf0ff('0xd')](_0xf0ff('0x16'),QUERY),{'type':dbH[_0xf0ff('0x14')][_0xf0ff('0x17')][_0xf0ff('0x18')]});})[_0xf0ff('0x13')](function(_0xe32858){if(!_0xe32858[0x0][_0xf0ff('0x19')]){return analyticExtractedReport(_0xf0ff('0x1a'));}var _0x2b17a3=[];var _0x1ffb5f=0x0;if(_0x388930['split']){if(_0xe32858&&_0xe32858['length']){var _0x2039ed=_['range'](_0xe32858[0x0][_0xf0ff('0x19')]/_0x26e95b);var _0x410995=Number[_0xf0ff('0x1b')](_0xe32858[0x0]['num']/_0x26e95b)?_0xe32858[0x0][_0xf0ff('0x19')]%_0x26e95b:0x0;_0x2039ed[_0xf0ff('0x1c')](function(_0x56bac9){if(_0x56bac9>0x0){_0x1ffb5f+=_0x26e95b;}_0x2b17a3[_0xf0ff('0x1d')](dbH['sequelize'][_0xf0ff('0x15')](util[_0xf0ff('0xd')](_0xf0ff('0x1e'),QUERY,_0x26e95b,_0x1ffb5f),{'type':dbH[_0xf0ff('0x14')][_0xf0ff('0x17')][_0xf0ff('0x18')]}));});if(_0x410995>0x0){_0x1ffb5f+=_0x26e95b;_0x2b17a3[_0xf0ff('0x1d')](dbH[_0xf0ff('0x14')][_0xf0ff('0x15')](util[_0xf0ff('0xd')](_0xf0ff('0x1e'),QUERY,_0x410995,_0x1ffb5f),{'type':dbH['sequelize'][_0xf0ff('0x17')][_0xf0ff('0x18')]}));}}}else{_0x2b17a3[_0xf0ff('0x1d')](dbH[_0xf0ff('0x14')][_0xf0ff('0x15')](QUERY,{'type':dbH[_0xf0ff('0x14')]['QueryTypes'][_0xf0ff('0x18')]}));}var _0x11ef5c=path[_0xf0ff('0x1f')](PATH);var _0x4e9485=path[_0xf0ff('0x20')](PATH,'.csv');var _0x209139=_0x388930[_0xf0ff('0x11')]&&_0x2b17a3[_0xf0ff('0x21')]>0x1;var _0x295ec5=[];if(!fs['existsSync'](path[_0xf0ff('0x22')](_0x11ef5c,_0x4e9485))&&_0x209139){fs[_0xf0ff('0x23')](path[_0xf0ff('0x22')](_0x11ef5c,_0x4e9485));}return BPromise[_0xf0ff('0x24')](_0x2b17a3,function(_0x275b31){_0x295ec5[_0xf0ff('0x1d')](_0x275b31);})['then'](function(){for(var _0x2c059b=0x0;_0x2c059b<_0x295ec5[_0xf0ff('0x21')];_0x2c059b+=0x1){var _0x17082f;var _0x41f79e=_0x295ec5[_0x2c059b];if(_0x209139){_0x17082f=path[_0xf0ff('0x22')](_0x11ef5c,_0x4e9485,util[_0xf0ff('0xd')](_0xf0ff('0x25'),_0x4e9485,_0x2c059b,_0xf0ff('0x26')));}else{_0x17082f=path['join'](_0x11ef5c,util[_0xf0ff('0xd')]('%s.%s',_0x4e9485,_0xf0ff('0x26')));}fs['writeFileSync'](_0x17082f,csv(_0x41f79e));}})[_0xf0ff('0x13')](function(){if(_0x209139){return new Promise(function(_0x119ad5){zipdir(path['join'](_0x11ef5c,_0x4e9485),{'saveTo':path[_0xf0ff('0x22')](_0x11ef5c,util['format'](_0xf0ff('0x27'),_0x4e9485,'zip'))},function(_0x2261b2,_0x465cf5){rimraf(path['join'](_0x11ef5c,_0x4e9485),function(){});_0x119ad5(_0xf0ff('0x28'));});});}})[_0xf0ff('0x13')](function(){logger[_0xf0ff('0xc')](util[_0xf0ff('0xd')](_0xf0ff('0x29'),EXTRACTED_REPORT_ID,_0xf0ff('0xe')));return analyticExtractedReport(_0xf0ff('0x2a'),_0x209139?util[_0xf0ff('0xd')](_0xf0ff('0x27'),_0x4e9485,_0x209139?_0xf0ff('0x2b'):_0xf0ff('0x26')):null);});})['catch'](function(_0x5ceda9){logger[_0xf0ff('0xc')](util[_0xf0ff('0xd')](_0xf0ff('0x2c'),EXTRACTED_REPORT_ID,_0xf0ff('0xe')),util[_0xf0ff('0x2d')](_0x5ceda9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xf0ff('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f454f16..5576ad5 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 _0xeb42=['body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','push','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','find','split','then','splitSizePdf','range','isInteger','sequelize','query','SELECT','QueryTypes','dirname','.pdf','existsSync','join','flatten','createPdfKitDocument','%s.%s','pdf','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','pick','toString','value','fill','length'];(function(_0x227136,_0x86487b){var _0x55abc2=function(_0x540faa){while(--_0x540faa){_0x227136['push'](_0x227136['shift']());}};_0x55abc2(++_0x86487b);}(_0xeb42,0x146));var _0x2eb4=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xeb42[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x2eb4('0x0'));var fs=require('fs');var util=require(_0x2eb4('0x1'));var path=require(_0x2eb4('0x2'));var moment=require(_0x2eb4('0x3'));var htmlToPdfmake=require(_0x2eb4('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x2eb4('0x5'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x2eb4('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x2eb4('0x7'));var db=require(_0x2eb4('0x8'))['db'];var dbH=require(_0x2eb4('0x8'))[_0x2eb4('0x9')];var logger=require(_0x2eb4('0xa'))(_0x2eb4('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2eb4('0xc')][0x3];var PATH=process[_0x2eb4('0xc')][0x4];var NAME=process[_0x2eb4('0xc')][0x5];var FORMAT=_0x2eb4('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x111ca2,_0x1895ce){var _0x2760a6={'status':_0x111ca2};var _0x5a2eaf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1895ce){_0x2760a6['savename']=_0x1895ce;}return db[_0x2eb4('0xe')][_0x2eb4('0xf')](_0x2760a6,_0x5a2eaf);}function getHeaders(_0x5171dc){return _[_0x2eb4('0x10')](_0x5171dc,function(_0x59aa17){return{'text':_0x59aa17,'style':'tableHeader'};});}function getRows(_0x23a2b0,_0xed0748){return _[_0x2eb4('0x10')](_0xed0748,function(_0x2825c2){return _(_0x2825c2)[_0x2eb4('0x11')](_0x23a2b0)[_0x2eb4('0x10')](function(_0xcf6080){return _0xcf6080?_[_0x2eb4('0x12')](_0xcf6080):'';})[_0x2eb4('0x13')]();});}function createTable(_0x37bbf1,_0x505528){var _0x5b4332={'widths':_[_0x2eb4('0x14')](Array(_0x37bbf1[_0x2eb4('0x15')]),0x91),'heights':function(_0x46485f){return _0x46485f===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xdc4283=getHeaders(_0x37bbf1);_0x5b4332[_0x2eb4('0x16')]['push'](_0xdc4283);var _0xe55d96=getRows(_0x37bbf1,_0x505528);_0x5b4332['body']=_0x5b4332['body'][_0x2eb4('0x17')](_0xe55d96);return _0x5b4332;}function createTables(_0x2079ee){var _0xec7aac=[];var _0x47da81=_[_0x2eb4('0x18')](Object[_0x2eb4('0x19')](_0x2079ee[0x0]),0x5);_0x47da81[_0x2eb4('0x1a')](function(_0x524299){_0xec7aac['push'](createTable(_0x524299,_0x2079ee));});return _0xec7aac;}function getPDFDocDefinition(_0x1f8ffa){var _0x14d28e=util['format'](_0x2eb4('0x1b'),NAME,EXTRACTED_REPORT[_0x2eb4('0x1c')],moment(EXTRACTED_REPORT[_0x2eb4('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x2eb4('0x1e')])[_0x2eb4('0x1f')](FORMAT));var _0x568467=[];for(var _0x4b00ac=0x0;_0x4b00ac<_0x1f8ffa[_0x2eb4('0x15')];_0x4b00ac++){var _0x3e0e0f=[];if(_0x4b00ac===0x0){_0x3e0e0f[_0x2eb4('0x20')]({'text':_0x14d28e,'style':_0x2eb4('0x21')});}var _0x4ae01f={'table':_0x1f8ffa[_0x4b00ac]};if(_0x4b00ac>0x0){_0x4ae01f[_0x2eb4('0x22')]=_0x2eb4('0x23');_0x4ae01f[_0x2eb4('0x24')]=[0x0,0x46,0x0,0x0];}_0x3e0e0f[_0x2eb4('0x20')](_0x4ae01f);_0x568467[_0x2eb4('0x20')](_0x3e0e0f);}return{'pageSize':'A4','pageOrientation':_0x2eb4('0x25'),'content':_0x568467,'footer':function(_0x68371b,_0x4c097b){return{'text':_0x68371b[_0x2eb4('0x12')]()+_0x2eb4('0x26')+_0x4c097b,'style':_0x2eb4('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2eb4('0x28')},'footer':{'alignment':_0x2eb4('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x40c734){var _0x324cbc=0x1388;var _0x5d3962;if(!_0x40c734[0x0][_0x2eb4('0x2a')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x2eb4('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2eb4('0x2c'),'splitSizePdf']})[_0x2eb4('0x2d')](function(_0x4c4067){if(_0x4c4067){_0x5d3962=_0x4c4067;_0x324cbc=_0x5d3962[_0x2eb4('0x2e')]||0x3e8;}})[_0x2eb4('0x2d')](function(){var _0x47ee39=[];var _0x324543=0x0;if(_0x5d3962[_0x2eb4('0x2c')]){if(_0x40c734&&_0x40c734[_0x2eb4('0x15')]){var _0x1302a7=_[_0x2eb4('0x2f')](_0x40c734[0x0]['num']/_0x324cbc);var _0x1f7101=Number[_0x2eb4('0x30')](_0x40c734[0x0][_0x2eb4('0x2a')]/_0x324cbc)?_0x40c734[0x0]['num']%_0x324cbc:0x0;_0x1302a7[_0x2eb4('0x1a')](function(_0x592a06){if(_0x592a06>0x0){_0x324543+=_0x324cbc;}_0x47ee39[_0x2eb4('0x20')](dbH[_0x2eb4('0x31')][_0x2eb4('0x32')](util[_0x2eb4('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x324cbc,_0x324543),{'type':dbH[_0x2eb4('0x31')]['QueryTypes'][_0x2eb4('0x33')]}));});if(_0x1f7101>0x0){_0x324543+=_0x324cbc;_0x47ee39[_0x2eb4('0x20')](dbH[_0x2eb4('0x31')][_0x2eb4('0x32')](util[_0x2eb4('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1f7101,_0x324543),{'type':dbH[_0x2eb4('0x31')]['QueryTypes'][_0x2eb4('0x33')]}));}}}else{_0x47ee39[_0x2eb4('0x20')](dbH[_0x2eb4('0x31')]['query'](QUERY,{'type':dbH[_0x2eb4('0x31')][_0x2eb4('0x34')][_0x2eb4('0x33')]}));}var _0x53dde2=path[_0x2eb4('0x35')](PATH);var _0xf57bb2=path['basename'](PATH,_0x2eb4('0x36'));var _0x3facff=_0x5d3962[_0x2eb4('0x2c')]&&_0x47ee39[_0x2eb4('0x15')]>0x1;var _0x37120a=[];if(!fs[_0x2eb4('0x37')](path[_0x2eb4('0x38')](_0x53dde2,_0xf57bb2))&&_0x3facff){fs['mkdirSync'](path[_0x2eb4('0x38')](_0x53dde2,_0xf57bb2));}return BPromise['each'](_0x47ee39,function(_0x2056eb){_0x37120a[_0x2eb4('0x20')](_0x2056eb);})['then'](function(){var _0x4dae9b=[];for(var _0x53d279=0x0;_0x53d279<_0x37120a[_0x2eb4('0x15')];_0x53d279+=0x1){var _0x5a432f=_0x37120a[_0x53d279];var _0x38ee1a=createTables(_[_0x2eb4('0x39')](_0x5a432f));var _0x44aa4a;var _0x27a5d6=getPDFDocDefinition(_0x38ee1a);var _0x1535b2=getPDFPrinter();var _0x536fb9=_0x1535b2[_0x2eb4('0x3a')](_0x27a5d6);if(_0x3facff){_0x44aa4a=path[_0x2eb4('0x38')](_0x53dde2,_0xf57bb2,util[_0x2eb4('0x1f')]('%s%d.%s',_0xf57bb2,_0x53d279,'pdf'));}else{_0x44aa4a=path[_0x2eb4('0x38')](_0x53dde2,util[_0x2eb4('0x1f')](_0x2eb4('0x3b'),_0xf57bb2,_0x2eb4('0x3c')));}_0x4dae9b['push'](writePDFDocument(_0x536fb9,_0x44aa4a));}return Promise['all'](_0x4dae9b);})[_0x2eb4('0x2d')](function(){if(_0x3facff){return new Promise(function(_0x1f3b57){zipdir(path[_0x2eb4('0x38')](_0x53dde2,_0xf57bb2),{'saveTo':path[_0x2eb4('0x38')](_0x53dde2,util[_0x2eb4('0x1f')](_0x2eb4('0x3b'),_0xf57bb2,'zip'))},function(){rimraf(path['join'](_0x53dde2,_0xf57bb2),function(){});_0x1f3b57('zip\x20finished');});});}})[_0x2eb4('0x2d')](function(){if(!_0x3facff)return;rimraf(path[_0x2eb4('0x38')](_0x53dde2,_0xf57bb2),function(){});})[_0x2eb4('0x2d')](function(){logger[_0x2eb4('0x3d')](util['format'](_0x2eb4('0x3e'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x3facff?util['format']('%s.%s',_0xf57bb2,_0x3facff?_0x2eb4('0x3f'):_0x2eb4('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x2eb4('0x40'),EXTRACTED_REPORT_ID,_0x2eb4('0x41')));return db[_0x2eb4('0xe')][_0x2eb4('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2eb4('0x2d')](function(_0x3af64a){EXTRACTED_REPORT=_0x3af64a;return dbH['sequelize'][_0x2eb4('0x32')](util[_0x2eb4('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2eb4('0x31')]['QueryTypes'][_0x2eb4('0x33')]});})[_0x2eb4('0x2d')](extractReport)[_0x2eb4('0x43')](function(_0x2d3e40){logger[_0x2eb4('0x3d')](util[_0x2eb4('0x1f')](_0x2eb4('0x44'),EXTRACTED_REPORT_ID,_0x2eb4('0x41')),util[_0x2eb4('0x45')](_0x2d3e40,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x2eb4('0x46')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2fefba=new PdfPrinter({'Arial':{'normal':__dirname+_0x2eb4('0x47'),'bold':__dirname+_0x2eb4('0x48'),'italics':__dirname+_0x2eb4('0x49'),'bolditalics':__dirname+_0x2eb4('0x4a')}});return _0x2fefba;}function getPDFDocDefinitionFromHTML(_0x117f68,_0x45f33a){var _0x5ad626=util[_0x2eb4('0x1f')](_0x2eb4('0x4b'),_0x45f33a['channel'],_0x45f33a[_0x2eb4('0x4c')]);var _0x42307b=moment()['format']('YYYY-MM-DD')[_0x2eb4('0x12')]();var _0x272c80=htmlToPdfmake(_0x117f68,{'window':window,'tableAutoSize':!![]});return{'content':[_0x272c80],'defaultStyle':{'font':_0x2eb4('0x4d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x2eb4('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2eb4('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2eb4('0x4e')}},'header':function(){return[{'text':_0x2eb4('0x4f'),'style':_0x2eb4('0x21')}];},'footer':function(_0x3b85ae,_0x3e23a9){return[{'text':util['format'](_0x2eb4('0x50'),_0x5ad626,_0x3b85ae,_0x3e23a9,_0x42307b),'style':_0x2eb4('0x27')}];}};}function writePDFDocument(_0x4f3696,_0x4c0c36){return new Promise(function(_0x29bd0b,_0x522e0c){var _0x284825=_0x4f3696[_0x2eb4('0x51')](fs[_0x2eb4('0x52')](_0x4c0c36));_0x284825['on'](_0x2eb4('0x53'),function(){_0x29bd0b(_0x2eb4('0x53'));});_0x284825['on'](_0x2eb4('0x54'),function(_0x538a6d){_0x522e0c(_0x538a6d);});_0x4f3696[_0x2eb4('0x55')]();});}exports[_0x2eb4('0x56')]=function(_0x1cd167,_0x28b245){var _0x55678c=getPDFPrinter();var _0x5c11f8=getPDFDocDefinitionFromHTML(_0x1cd167,_0x28b245);var _0x4e443b=_0x55678c[_0x2eb4('0x3a')](_0x5c11f8);return writePDFDocument(_0x4e443b,_0x28b245[_0x2eb4('0x2')])[_0x2eb4('0x43')](function(_0x4ae76e){throw _0x4ae76e;});}; \ No newline at end of file +var _0x1db8=['num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','PDF','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','chunk','keys','forEach','format','startDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','Empty','Setting','find','split','splitSizePdf','then','range','isInteger'];(function(_0xdf3090,_0x3f1151){var _0x19bc0d=function(_0xa88093){while(--_0xa88093){_0xdf3090['push'](_0xdf3090['shift']());}};_0x19bc0d(++_0x3f1151);}(_0x1db8,0xdf));var _0x81db=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x1db8[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x81db('0x0'));var fs=require('fs');var util=require(_0x81db('0x1'));var path=require(_0x81db('0x2'));var moment=require(_0x81db('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x81db('0x4'));var zipdir=require(_0x81db('0x5'));var rimraf=require(_0x81db('0x6'));var JSDOM=require(_0x81db('0x7'))[_0x81db('0x8')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x81db('0x9')];var logger=require(_0x81db('0xa'))(_0x81db('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x81db('0xc')][0x2]);var QUERY=process[_0x81db('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x81db('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c1a7c,_0x156e41){var _0x22b08b={'status':_0x5c1a7c};var _0xc35cbd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x156e41){_0x22b08b[_0x81db('0xd')]=_0x156e41;}return db[_0x81db('0xe')][_0x81db('0xf')](_0x22b08b,_0xc35cbd);}function getHeaders(_0x35e214){return _[_0x81db('0x10')](_0x35e214,function(_0x404052){return{'text':_0x404052,'style':_0x81db('0x11')};});}function getRows(_0x8aaefe,_0x1cfc20){return _[_0x81db('0x10')](_0x1cfc20,function(_0x4f5140){return _(_0x4f5140)[_0x81db('0x12')](_0x8aaefe)[_0x81db('0x10')](function(_0x366d07){return _0x366d07?_[_0x81db('0x13')](_0x366d07):'';})[_0x81db('0x14')]();});}function createTable(_0x306523,_0x21d010){var _0x57b8f0={'widths':_[_0x81db('0x15')](Array(_0x306523[_0x81db('0x16')]),0x91),'heights':function(_0x29b95a){return _0x29b95a===0x0?_0x81db('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x36c820=getHeaders(_0x306523);_0x57b8f0[_0x81db('0x18')][_0x81db('0x19')](_0x36c820);var _0x524bc0=getRows(_0x306523,_0x21d010);_0x57b8f0[_0x81db('0x18')]=_0x57b8f0[_0x81db('0x18')]['concat'](_0x524bc0);return _0x57b8f0;}function createTables(_0x2dbe6a){var _0x181b09=[];var _0x57bccf=_[_0x81db('0x1a')](Object[_0x81db('0x1b')](_0x2dbe6a[0x0]),0x5);_0x57bccf[_0x81db('0x1c')](function(_0x3044d){_0x181b09[_0x81db('0x19')](createTable(_0x3044d,_0x2dbe6a));});return _0x181b09;}function getPDFDocDefinition(_0x157227){var _0x4ffeb2=util[_0x81db('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x81db('0x1e')])[_0x81db('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x584ba5=[];for(var _0x5032b2=0x0;_0x5032b2<_0x157227[_0x81db('0x16')];_0x5032b2++){var _0x484072=[];if(_0x5032b2===0x0){_0x484072[_0x81db('0x19')]({'text':_0x4ffeb2,'style':_0x81db('0x1f')});}var _0x5269dd={'table':_0x157227[_0x5032b2]};if(_0x5032b2>0x0){_0x5269dd[_0x81db('0x20')]=_0x81db('0x21');_0x5269dd[_0x81db('0x22')]=[0x0,0x46,0x0,0x0];}_0x484072['push'](_0x5269dd);_0x584ba5[_0x81db('0x19')](_0x484072);}return{'pageSize':'A4','pageOrientation':_0x81db('0x23'),'content':_0x584ba5,'footer':function(_0x52c2d2,_0x1d8ed5){return{'text':_0x52c2d2[_0x81db('0x13')]()+_0x81db('0x24')+_0x1d8ed5,'style':_0x81db('0x25')};},'defaultStyle':{'font':_0x81db('0x26')},'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(_0x4163e1){var _0x452247=0x1388;var _0x51d7f5;if(!_0x4163e1[0x0]['num']){return analyticExtractedReport(_0x81db('0x27'));}return db[_0x81db('0x28')][_0x81db('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x81db('0x2a'),_0x81db('0x2b')]})[_0x81db('0x2c')](function(_0x366dab){if(_0x366dab){_0x51d7f5=_0x366dab;_0x452247=_0x51d7f5['splitSizePdf']||0x3e8;}})[_0x81db('0x2c')](function(){var _0x1ce580=[];var _0x5949ce=0x0;if(_0x51d7f5[_0x81db('0x2a')]){if(_0x4163e1&&_0x4163e1['length']){var _0x273947=_[_0x81db('0x2d')](_0x4163e1[0x0]['num']/_0x452247);var _0x21e31b=Number[_0x81db('0x2e')](_0x4163e1[0x0][_0x81db('0x2f')]/_0x452247)?_0x4163e1[0x0][_0x81db('0x2f')]%_0x452247:0x0;_0x273947[_0x81db('0x1c')](function(_0x15801d){if(_0x15801d>0x0){_0x5949ce+=_0x452247;}_0x1ce580[_0x81db('0x19')](dbH[_0x81db('0x30')][_0x81db('0x31')](util[_0x81db('0x1d')](_0x81db('0x32'),QUERY,_0x452247,_0x5949ce),{'type':dbH[_0x81db('0x30')][_0x81db('0x33')][_0x81db('0x34')]}));});if(_0x21e31b>0x0){_0x5949ce+=_0x452247;_0x1ce580[_0x81db('0x19')](dbH[_0x81db('0x30')][_0x81db('0x31')](util[_0x81db('0x1d')](_0x81db('0x32'),QUERY,_0x21e31b,_0x5949ce),{'type':dbH[_0x81db('0x30')][_0x81db('0x33')][_0x81db('0x34')]}));}}}else{_0x1ce580[_0x81db('0x19')](dbH['sequelize'][_0x81db('0x31')](QUERY,{'type':dbH[_0x81db('0x30')][_0x81db('0x33')][_0x81db('0x34')]}));}var _0x367de8=path[_0x81db('0x35')](PATH);var _0x1c3857=path[_0x81db('0x36')](PATH,_0x81db('0x37'));var _0x290ac9=_0x51d7f5[_0x81db('0x2a')]&&_0x1ce580['length']>0x1;var _0x5c4aa1=[];if(!fs[_0x81db('0x38')](path['join'](_0x367de8,_0x1c3857))&&_0x290ac9){fs[_0x81db('0x39')](path[_0x81db('0x3a')](_0x367de8,_0x1c3857));}return BPromise[_0x81db('0x3b')](_0x1ce580,function(_0x305afe){_0x5c4aa1['push'](_0x305afe);})[_0x81db('0x2c')](function(){var _0x3c9378=[];for(var _0x4e7cf9=0x0;_0x4e7cf9<_0x5c4aa1[_0x81db('0x16')];_0x4e7cf9+=0x1){var _0x5f3d40=_0x5c4aa1[_0x4e7cf9];var _0x5ecde6=createTables(_['flatten'](_0x5f3d40));var _0x137f74;var _0x18d595=getPDFDocDefinition(_0x5ecde6);var _0x341046=getPDFPrinter();var _0x8ef24=_0x341046[_0x81db('0x3c')](_0x18d595);if(_0x290ac9){_0x137f74=path[_0x81db('0x3a')](_0x367de8,_0x1c3857,util[_0x81db('0x1d')](_0x81db('0x3d'),_0x1c3857,_0x4e7cf9,_0x81db('0x3e')));}else{_0x137f74=path[_0x81db('0x3a')](_0x367de8,util[_0x81db('0x1d')](_0x81db('0x3f'),_0x1c3857,'pdf'));}_0x3c9378['push'](writePDFDocument(_0x8ef24,_0x137f74));}return Promise[_0x81db('0x40')](_0x3c9378);})[_0x81db('0x2c')](function(){if(_0x290ac9){return new Promise(function(_0x135247){zipdir(path[_0x81db('0x3a')](_0x367de8,_0x1c3857),{'saveTo':path['join'](_0x367de8,util[_0x81db('0x1d')](_0x81db('0x3f'),_0x1c3857,_0x81db('0x41')))},function(){rimraf(path[_0x81db('0x3a')](_0x367de8,_0x1c3857),function(){});_0x135247('zip\x20finished');});});}})[_0x81db('0x2c')](function(){if(!_0x290ac9)return;rimraf(path[_0x81db('0x3a')](_0x367de8,_0x1c3857),function(){});})['then'](function(){logger[_0x81db('0x42')](util[_0x81db('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x81db('0x43'),_0x290ac9?util['format'](_0x81db('0x3f'),_0x1c3857,_0x290ac9?'zip':_0x81db('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x81db('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x81db('0xe')][_0x81db('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x81db('0x2c')](function(_0x1758df){EXTRACTED_REPORT=_0x1758df;return dbH['sequelize']['query'](util[_0x81db('0x1d')](_0x81db('0x45'),QUERY),{'type':dbH[_0x81db('0x30')][_0x81db('0x33')]['SELECT']});})[_0x81db('0x2c')](extractReport)['catch'](function(_0x42f5ec){logger[_0x81db('0x42')](util[_0x81db('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x81db('0x46')),util[_0x81db('0x47')](_0x42f5ec,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x81db('0x48'));})[_0x81db('0x49')](function(){process[_0x81db('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x37e666=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x81db('0x4b'),'italics':__dirname+_0x81db('0x4c'),'bolditalics':__dirname+_0x81db('0x4d')}});return _0x37e666;}function getPDFDocDefinitionFromHTML(_0x3f2a82,_0xd92170){var _0x10871c=util[_0x81db('0x1d')](_0x81db('0x4e'),_0xd92170[_0x81db('0x4f')],_0xd92170[_0x81db('0x50')]);var _0x124743=moment()[_0x81db('0x1d')](_0x81db('0x51'))[_0x81db('0x13')]();var _0x431b17=htmlToPdfmake(_0x3f2a82,{'window':window,'tableAutoSize':!![]});return{'content':[_0x431b17],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x81db('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x81db('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x2f1f07,_0xbb809a){return[{'text':util[_0x81db('0x1d')](_0x81db('0x53'),_0x10871c,_0x2f1f07,_0xbb809a,_0x124743),'style':_0x81db('0x25')}];}};}function writePDFDocument(_0x4622bd,_0x4ae1f2){return new Promise(function(_0x11fb8d,_0x4a66c0){var _0x269f18=_0x4622bd[_0x81db('0x54')](fs[_0x81db('0x55')](_0x4ae1f2));_0x269f18['on'](_0x81db('0x56'),function(){_0x11fb8d('finish');});_0x269f18['on'](_0x81db('0x57'),function(_0x52e3cf){_0x4a66c0(_0x52e3cf);});_0x4622bd['end']();});}exports[_0x81db('0x58')]=function(_0x23c1a5,_0x1833a2){var _0x5e0ec0=getPDFPrinter();var _0x277244=getPDFDocDefinitionFromHTML(_0x23c1a5,_0x1833a2);var _0x5f18cd=_0x5e0ec0[_0x81db('0x3c')](_0x277244);return writePDFDocument(_0x5f18cd,_0x1833a2[_0x81db('0x2')])[_0x81db('0x59')](function(_0x21c097){throw _0x21c097;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2664940..bea7d83 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 _0xecbc=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','existsSync','mkdirSync','join','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','inspect','Failed','finally','exit','util','path','lodash','json2xls','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx'];(function(_0x3e761a,_0x23b3d9){var _0x27f4a8=function(_0x13a5e0){while(--_0x13a5e0){_0x3e761a['push'](_0x3e761a['shift']());}};_0x27f4a8(++_0x23b3d9);}(_0xecbc,0x86));var _0xcecb=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xecbc[_0x2112d4];return _0x434972;};'use strict';var util=require(_0xcecb('0x0'));var path=require(_0xcecb('0x1'));var _=require(_0xcecb('0x2'));var fs=require('fs');var json2xls=require(_0xcecb('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xcecb('0x4'));var db=require(_0xcecb('0x5'))['db'];var dbH=require(_0xcecb('0x5'))['dbH'];var logger=require(_0xcecb('0x6'))(_0xcecb('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xcecb('0x8')][0x2]);var QUERY=process[_0xcecb('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f5c49,_0x57ae82){var _0x155f0d={'status':_0x3f5c49};var _0x32d5d8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x57ae82){_0x155f0d[_0xcecb('0x9')]=_0x57ae82;}return db[_0xcecb('0xa')][_0xcecb('0xb')](_0x155f0d,_0x32d5d8);}function main(){var _0x39c130=0x1388;var _0x383919;logger[_0xcecb('0xc')](util[_0xcecb('0xd')](_0xcecb('0xe'),EXTRACTED_REPORT_ID,_0xcecb('0xf')));return db[_0xcecb('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcecb('0x11'),_0xcecb('0x12')]})[_0xcecb('0x13')](function(_0x1e7ec1){if(_0x1e7ec1){_0x383919=_0x1e7ec1;_0x39c130=_0x383919[_0xcecb('0x12')]||0x1388;}})[_0xcecb('0x13')](function(){return dbH[_0xcecb('0x14')][_0xcecb('0x15')](util[_0xcecb('0xd')](_0xcecb('0x16'),QUERY),{'type':dbH[_0xcecb('0x14')][_0xcecb('0x17')][_0xcecb('0x18')]});})[_0xcecb('0x13')](function(_0x31c740){if(!_0x31c740[0x0][_0xcecb('0x19')]){return analyticExtractedReport('Empty');}var _0x5aa0c2=[];var _0x28d692=0x0;if(_0x383919['split']){if(_0x31c740&&_0x31c740['length']){var _0x1da88e=_[_0xcecb('0x1a')](_0x31c740[0x0][_0xcecb('0x19')]/_0x39c130);var _0x1536f9=Number[_0xcecb('0x1b')](_0x31c740[0x0]['num']/_0x39c130)?_0x31c740[0x0][_0xcecb('0x19')]%_0x39c130:0x0;_0x1da88e[_0xcecb('0x1c')](function(_0x760fcc){if(_0x760fcc>0x0){_0x28d692+=_0x39c130;}_0x5aa0c2[_0xcecb('0x1d')](dbH[_0xcecb('0x14')][_0xcecb('0x15')](util[_0xcecb('0xd')](_0xcecb('0x1e'),QUERY,_0x39c130,_0x28d692),{'type':dbH[_0xcecb('0x14')][_0xcecb('0x17')][_0xcecb('0x18')]}));});if(_0x1536f9>0x0){_0x28d692+=_0x39c130;_0x5aa0c2['push'](dbH['sequelize'][_0xcecb('0x15')](util[_0xcecb('0xd')](_0xcecb('0x1e'),QUERY,_0x1536f9,_0x28d692),{'type':dbH['sequelize']['QueryTypes'][_0xcecb('0x18')]}));}}}else{_0x5aa0c2[_0xcecb('0x1d')](dbH[_0xcecb('0x14')][_0xcecb('0x15')](QUERY,{'type':dbH['sequelize'][_0xcecb('0x17')][_0xcecb('0x18')]}));}var _0xea53bd=path['dirname'](PATH);var _0x2fe2f4=path[_0xcecb('0x1f')](PATH,_0xcecb('0x20'));var _0xdae4b9=_0x383919[_0xcecb('0x11')]&&_0x5aa0c2[_0xcecb('0x21')]>0x1;var _0x3ea6c4=[];if(!fs[_0xcecb('0x22')](path['join'](_0xea53bd,_0x2fe2f4))&&_0xdae4b9){fs[_0xcecb('0x23')](path[_0xcecb('0x24')](_0xea53bd,_0x2fe2f4));}return BPromise['each'](_0x5aa0c2,function(_0x58935d){_0x3ea6c4['push'](_0x58935d);})['then'](function(){for(var _0x48ef87=0x0;_0x48ef87<_0x3ea6c4['length'];_0x48ef87+=0x1){var _0x3496d8;var _0xaeeea7=_0x3ea6c4[_0x48ef87];if(_0xdae4b9){_0x3496d8=path[_0xcecb('0x24')](_0xea53bd,_0x2fe2f4,util[_0xcecb('0xd')](_0xcecb('0x25'),_0x2fe2f4,_0x48ef87,'xlsx'));}else{_0x3496d8=path[_0xcecb('0x24')](_0xea53bd,util[_0xcecb('0xd')](_0xcecb('0x26'),_0x2fe2f4,_0xcecb('0x27')));}fs[_0xcecb('0x28')](_0x3496d8,json2xls(_0xaeeea7),_0xcecb('0x29'));}})[_0xcecb('0x13')](function(){if(_0xdae4b9){return new Promise(function(_0x12ded3){zipdir(path[_0xcecb('0x24')](_0xea53bd,_0x2fe2f4),{'saveTo':path[_0xcecb('0x24')](_0xea53bd,util[_0xcecb('0xd')](_0xcecb('0x26'),_0x2fe2f4,'zip'))},function(_0x162128,_0x5584eb){rimraf(path[_0xcecb('0x24')](_0xea53bd,_0x2fe2f4),function(){});_0x12ded3(_0xcecb('0x2a'));});});}})[_0xcecb('0x13')](function(){logger[_0xcecb('0xc')](util['format'](_0xcecb('0x2b'),EXTRACTED_REPORT_ID,_0xcecb('0xf')));return analyticExtractedReport(_0xcecb('0x2c'),_0xdae4b9?util[_0xcecb('0xd')](_0xcecb('0x26'),_0x2fe2f4,_0xdae4b9?_0xcecb('0x2d'):'xlsx'):null);});})[_0xcecb('0x2e')](function(_0x78cc4c){logger[_0xcecb('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcecb('0xf')),util[_0xcecb('0x2f')](_0x78cc4c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcecb('0x30'));})[_0xcecb('0x31')](function(){process[_0xcecb('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2405=['%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','then','query','QueryTypes','SELECT','num','Empty','split','length','isInteger','forEach','push'];(function(_0x28770f,_0x5cff78){var _0x51bfe2=function(_0x332e8c){while(--_0x332e8c){_0x28770f['push'](_0x28770f['shift']());}};_0x51bfe2(++_0x5cff78);}(_0x2405,0x173));var _0x5240=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0x2405[_0x156a0d];return _0x98a9ba;};'use strict';var util=require(_0x5240('0x0'));var path=require(_0x5240('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x5240('0x2'));var BPromise=require(_0x5240('0x3'));var zipdir=require(_0x5240('0x4'));var rimraf=require(_0x5240('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5240('0x6'))['dbH'];var logger=require(_0x5240('0x7'))(_0x5240('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5240('0x9')][0x2]);var QUERY=process[_0x5240('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3b3f92,_0x56fd74){var _0x351fbc={'status':_0x3b3f92};var _0x1e70f3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x56fd74){_0x351fbc[_0x5240('0xa')]=_0x56fd74;}return db[_0x5240('0xb')][_0x5240('0xc')](_0x351fbc,_0x1e70f3);}function main(){var _0x3ae6cc=0x1388;var _0x3d6c4e;logger['info'](util[_0x5240('0xd')](_0x5240('0xe'),EXTRACTED_REPORT_ID,_0x5240('0xf')));return db[_0x5240('0x10')][_0x5240('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0x5240('0x12')](function(_0x561580){if(_0x561580){_0x3d6c4e=_0x561580;_0x3ae6cc=_0x3d6c4e['splitSizeXlsx']||0x1388;}})[_0x5240('0x12')](function(){return dbH['sequelize'][_0x5240('0x13')](util[_0x5240('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x5240('0x14')][_0x5240('0x15')]});})[_0x5240('0x12')](function(_0x264bfd){if(!_0x264bfd[0x0][_0x5240('0x16')]){return analyticExtractedReport(_0x5240('0x17'));}var _0x37a122=[];var _0x9681fd=0x0;if(_0x3d6c4e[_0x5240('0x18')]){if(_0x264bfd&&_0x264bfd[_0x5240('0x19')]){var _0x266f6=_['range'](_0x264bfd[0x0][_0x5240('0x16')]/_0x3ae6cc);var _0x57ae81=Number[_0x5240('0x1a')](_0x264bfd[0x0][_0x5240('0x16')]/_0x3ae6cc)?_0x264bfd[0x0][_0x5240('0x16')]%_0x3ae6cc:0x0;_0x266f6[_0x5240('0x1b')](function(_0x4e7727){if(_0x4e7727>0x0){_0x9681fd+=_0x3ae6cc;}_0x37a122[_0x5240('0x1c')](dbH['sequelize'][_0x5240('0x13')](util[_0x5240('0xd')](_0x5240('0x1d'),QUERY,_0x3ae6cc,_0x9681fd),{'type':dbH['sequelize'][_0x5240('0x14')][_0x5240('0x15')]}));});if(_0x57ae81>0x0){_0x9681fd+=_0x3ae6cc;_0x37a122['push'](dbH['sequelize'][_0x5240('0x13')](util[_0x5240('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x57ae81,_0x9681fd),{'type':dbH[_0x5240('0x1e')][_0x5240('0x14')]['SELECT']}));}}}else{_0x37a122[_0x5240('0x1c')](dbH['sequelize'][_0x5240('0x13')](QUERY,{'type':dbH[_0x5240('0x1e')][_0x5240('0x14')][_0x5240('0x15')]}));}var _0x3791cc=path[_0x5240('0x1f')](PATH);var _0x51993e=path[_0x5240('0x20')](PATH,_0x5240('0x21'));var _0x45290c=_0x3d6c4e[_0x5240('0x18')]&&_0x37a122[_0x5240('0x19')]>0x1;var _0x33d0b1=[];if(!fs[_0x5240('0x22')](path[_0x5240('0x23')](_0x3791cc,_0x51993e))&&_0x45290c){fs['mkdirSync'](path[_0x5240('0x23')](_0x3791cc,_0x51993e));}return BPromise['each'](_0x37a122,function(_0x58f8cf){_0x33d0b1[_0x5240('0x1c')](_0x58f8cf);})['then'](function(){for(var _0x9d09d0=0x0;_0x9d09d0<_0x33d0b1[_0x5240('0x19')];_0x9d09d0+=0x1){var _0x1df083;var _0x3b658f=_0x33d0b1[_0x9d09d0];if(_0x45290c){_0x1df083=path[_0x5240('0x23')](_0x3791cc,_0x51993e,util[_0x5240('0xd')](_0x5240('0x24'),_0x51993e,_0x9d09d0,_0x5240('0x25')));}else{_0x1df083=path[_0x5240('0x23')](_0x3791cc,util[_0x5240('0xd')](_0x5240('0x26'),_0x51993e,_0x5240('0x25')));}fs['writeFileSync'](_0x1df083,json2xls(_0x3b658f),_0x5240('0x27'));}})[_0x5240('0x12')](function(){if(_0x45290c){return new Promise(function(_0x2b7e18){zipdir(path['join'](_0x3791cc,_0x51993e),{'saveTo':path[_0x5240('0x23')](_0x3791cc,util['format'](_0x5240('0x26'),_0x51993e,_0x5240('0x28')))},function(_0x5ae6b1,_0x156ab2){rimraf(path[_0x5240('0x23')](_0x3791cc,_0x51993e),function(){});_0x2b7e18(_0x5240('0x29'));});});}})[_0x5240('0x12')](function(){logger[_0x5240('0x2a')](util[_0x5240('0xd')](_0x5240('0x2b'),EXTRACTED_REPORT_ID,_0x5240('0xf')));return analyticExtractedReport(_0x5240('0x2c'),_0x45290c?util['format'](_0x5240('0x26'),_0x51993e,_0x45290c?_0x5240('0x28'):_0x5240('0x25')):null);});})[_0x5240('0x2d')](function(_0x43c4cf){logger[_0x5240('0x2a')](util['format'](_0x5240('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x5240('0x2f')](_0x43c4cf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5240('0x30'));})[_0x5240('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fb0e7d1..6529484 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 _0xa73a=['destroy','bulkCreate','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extension','extensions','push','Set','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','transaction'];(function(_0x232f0a,_0xab5fad){var _0x2902fa=function(_0x14e3ca){while(--_0x14e3ca){_0x232f0a['push'](_0x232f0a['shift']());}};_0x2902fa(++_0xab5fad);}(_0xa73a,0xd1));var _0xaa73=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xa73a[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0xaa73('0x0'));var util=require(_0xaa73('0x1'));function rewrite(_0x15f357,_0x1ba7c7){var _0xaaed00=this;return _0x15f357['models'][_0xaa73('0x2')][_0xaa73('0x3')]({'raw':!![]})[_0xaa73('0x4')](function(_0x3d0a40){_0xaaed00[_0xaa73('0x5')]=_0x3d0a40;return _0x15f357[_0xaa73('0x6')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x1ba7c7[_0xaa73('0x7')]},'raw':!![]});})['then'](function(_0x4ed063){return _0x15f357[_0xaa73('0x6')][_0xaa73('0x8')][_0xaa73('0x3')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x4ed063,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xaa73('0x4')](function(_0x33f7b2){var _0x594e36=_[_0xaa73('0x9')](_0x33f7b2,{'priority':'1'});var _0x538dac=_[_0xaa73('0x9')](_0x33f7b2,{'isApp':0x1});var _0x25638d=_[_0xaa73('0xa')](_0x538dac,_0xaa73('0xb'));var _0x14e0fa=[_0xaa73('0xc'),_0xaa73('0xd')];var _0x4efad3=[];var _0x4788c7=[];for(var _0x1e4d00 in _0x25638d){if(_0x25638d[_0xaa73('0xe')](_0x1e4d00)){_0xaaed00[_0xaa73('0xf')]=0x2;_0xaaed00['extensions']=[];_0xaaed00[_0xaa73('0x10')]=_['find'](_0x594e36,{'exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')]});_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0]['type'],'app':_0xaa73('0x13'),'appdata':util['format'](_0xaa73('0x14'),_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')]),'context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});if(_0x25638d[_0x1e4d00][0x0]['type']===_0xaa73('0x18')){_0xaaed00[_0xaa73('0x11')]['push']({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':_0xaa73('0x13'),'appdata':_0xaa73('0x19')+_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')],'context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});}else if(_0x25638d[_0x1e4d00][0x0]['type']===_0xaa73('0x1a')){if(_0xaaed00[_0xaa73('0x10')]){_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':'Set','appdata':_0xaa73('0x1b')+(_0xaaed00[_0xaa73('0x10')]['cutdigits']?_0xaa73('0x1c')+_0xaaed00[_0xaa73('0x10')][_0xaa73('0x1d')]+'}':_0xaa73('0x1e')),'context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0]['exten'],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0]['VoiceExtensionId']});}_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':_0xaa73('0x13'),'appdata':_0xaa73('0x19')+_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')],'context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0]['exten'],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});var _0x2368d4=_0xaaed00['priority']++;_0xaaed00['extensions']['push']({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':_0xaa73('0x1f'),'appdata':_0xaa73('0x20')+(_0x2368d4+0x2)+_0xaa73('0x21')+(_0x2368d4+0x1)+')','context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0]['exten'],'priority':_0x2368d4,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0]['VoiceExtensionId']});if(_0xaaed00[_0xaa73('0x10')]){_0xaaed00[_0xaa73('0x11')]['push']({'type':_0x25638d[_0x1e4d00][0x0]['type'],'app':_0xaa73('0x13'),'appdata':_0xaaed00[_0xaa73('0x10')][_0xaa73('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0xaaed00[_0xaa73('0x10')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')],'priority':_0xaaed00['priority']++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});}_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x25638d[_0x1e4d00][0x0]['VoiceExtensionId'],'context':_0x25638d[_0x1e4d00][0x0]['context'],'exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});if(_0xaaed00['extension']&&_0xaaed00[_0xaa73('0x10')]['hasOwnProperty']('recordingFormat')&&_0xaaed00[_0xaa73('0x10')][_0xaa73('0x22')]!==_0xaa73('0x23')){_0xaaed00['extensions'][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0]['type'],'app':_0xaa73('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0]['exten'],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0]['VoiceExtensionId']});_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':_0xaa73('0x13'),'appdata':_0xaa73('0x24')+_0xaaed00[_0xaa73('0x10')][_0xaa73('0x22')]||'wav','context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0]['exten'],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});}}_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':_0xaa73('0x13'),'appdata':_0xaa73('0x25'),'context':_0x25638d[_0x1e4d00][0x0]['context'],'exten':_0x25638d[_0x1e4d00][0x0]['exten'],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});_0xaaed00['extensions'][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':'Set','appdata':_0xaa73('0x26'),'context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0]['type'],'app':_0xaa73('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x16')],'exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')],'priority':_0xaaed00[_0xaa73('0xf')]++,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});for(var _0x269b33=0x0,_0x16ce0a=0x0;_0x269b33<_0x25638d[_0x1e4d00][_0xaa73('0x27')];_0x269b33+=0x1,_0x16ce0a=0x0){var _0x1f3433=_0x25638d[_0x1e4d00][_0x269b33];if(_0x1f3433[_0xaa73('0x15')]){_0x1f3433[_0xaa73('0x15')]=_0x1f3433[_0xaa73('0x15')][_0xaa73('0x28')]();}var _0x4ff4d5=[];var _0x45179d=[];delete _0x1f3433['id'];delete _0x1f3433['createdAt'];delete _0x1f3433[_0xaa73('0x29')];var _0x260630=_0x1f3433[_0xaa73('0x2a')]!==_0xaa73('0x2b')?[_0x1f3433[_0xaa73('0x2a')]]:_0x1f3433['IntervalId']?_[_0xaa73('0x2c')](_[_0xaa73('0x9')](_0xaaed00[_0xaa73('0x5')],{'IntervalId':_0x1f3433['IntervalId']}),_0xaa73('0x2a')):[];if(_0x1f3433['hasOwnProperty'](_0xaa73('0x2d'))){if(_0x1f3433[_0xaa73('0x2d')]&&_0x1f3433[_0xaa73('0x2d')]!=='--'){_0x4ff4d5[_0xaa73('0x12')]({'type':_0x1f3433[_0xaa73('0x15')],'app':_0xaa73('0x13'),'appdata':_0xaa73('0x2e')+_0x1f3433[_0xaa73('0x2d')],'context':_0x1f3433[_0xaa73('0x16')],'exten':_0x1f3433[_0xaa73('0xb')],'priority':_0x260630[_0xaa73('0x27')]+_0xaaed00['priority']+_0x16ce0a++,'VoiceExtensionId':_0x1f3433[_0xaa73('0x17')]});}}if(_0x1f3433[_0xaa73('0x15')]===_0xaa73('0x1a')&&_0x1f3433['hasOwnProperty'](_0xaa73('0x2f'))){if(_0x1f3433[_0xaa73('0x2f')]){_0x4ff4d5['push']({'type':_0x1f3433[_0xaa73('0x15')],'app':_0xaa73('0x1f'),'appdata':_0xaa73('0x30')+_0x1f3433['callerID']+')','context':_0x1f3433[_0xaa73('0x16')],'exten':_0x1f3433['exten'],'priority':_0x260630[_0xaa73('0x27')]+_0xaaed00[_0xaa73('0xf')]+_0x16ce0a++,'VoiceExtensionId':_0x1f3433[_0xaa73('0x17')]});}else{_0x4ff4d5[_0xaa73('0x12')]({'type':_0x1f3433[_0xaa73('0x15')],'app':_0xaa73('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x1f3433[_0xaa73('0x16')],'exten':_0x1f3433[_0xaa73('0xb')],'priority':_0x260630[_0xaa73('0x27')]+_0xaaed00['priority']+_0x16ce0a++,'VoiceExtensionId':_0x1f3433['VoiceExtensionId']});}}if(_0x1f3433[_0xaa73('0xe')](_0xaa73('0x31'))){if(_0x14e0fa[_0xaa73('0x32')](_0x1f3433[_0xaa73('0x33')][_0xaa73('0x28')]())>=0x0&&_0x1f3433[_0xaa73('0x34')]!==_0xaa73('0x35')){if(_0x1f3433[_0xaa73('0x31')]){_0x4ff4d5[_0xaa73('0x12')]({'type':_0x1f3433[_0xaa73('0x15')],'app':'ExecIf','appdata':_0xaa73('0x36'),'context':_0x1f3433[_0xaa73('0x16')],'exten':_0x1f3433[_0xaa73('0xb')],'priority':_0x260630[_0xaa73('0x27')]+_0xaaed00[_0xaa73('0xf')]+_0x16ce0a++,'VoiceExtensionId':_0x1f3433['VoiceExtensionId']});_0x4ff4d5[_0xaa73('0x12')]({'type':_0x1f3433[_0xaa73('0x15')],'app':'Set','appdata':_0xaa73('0x37'),'context':_0x1f3433[_0xaa73('0x16')],'exten':_0x1f3433['exten'],'priority':_0x260630[_0xaa73('0x27')]+_0xaaed00[_0xaa73('0xf')]+_0x16ce0a++,'VoiceExtensionId':_0x1f3433['VoiceExtensionId']});}else{_0x4ff4d5[_0xaa73('0x12')]({'type':_0x1f3433[_0xaa73('0x15')],'app':_0xaa73('0x1f'),'appdata':_0xaa73('0x38'),'context':_0x1f3433[_0xaa73('0x16')],'exten':_0x1f3433[_0xaa73('0xb')],'priority':_0x260630[_0xaa73('0x27')]+_0xaaed00[_0xaa73('0xf')]+_0x16ce0a++,'VoiceExtensionId':_0x1f3433[_0xaa73('0x17')]});_0x4ff4d5[_0xaa73('0x12')]({'type':_0x1f3433['type'],'app':_0xaa73('0x13'),'appdata':_0xaa73('0x39'),'context':_0x1f3433['context'],'exten':_0x1f3433[_0xaa73('0xb')],'priority':_0x260630[_0xaa73('0x27')]+_0xaaed00[_0xaa73('0xf')]+_0x16ce0a++,'VoiceExtensionId':_0x1f3433[_0xaa73('0x17')]});}}}for(var _0x3aa4e7=0x0;_0x3aa4e7<_0x260630['length'];_0x3aa4e7+=0x1){var _0x30747c=_0xaaed00[_0xaa73('0xf')]+_0x260630[_0xaa73('0x27')];var _0x49c049=_0x3aa4e7===_0x260630[_0xaa73('0x27')]-0x1?_0xaaed00[_0xaa73('0xf')]+_0x4ff4d5[_0xaa73('0x27')]+_0x45179d[_0xaa73('0x27')]+0x2:_0xaaed00[_0xaa73('0xf')]+_0x3aa4e7+0x1;_0x4ff4d5[_0xaa73('0x3a')](_0x3aa4e7,0x0,{'type':_0x1f3433[_0xaa73('0x15')],'app':_0xaa73('0x3b'),'appdata':_0x260630[_0x3aa4e7]+'?'+_0x1f3433[_0xaa73('0x16')]+',${EXTEN},'+_0x30747c+':'+_0x1f3433['context']+',${EXTEN},'+_0x49c049,'exten':_0x1f3433[_0xaa73('0xb')],'context':_0x1f3433[_0xaa73('0x16')],'priority':_0xaaed00[_0xaa73('0xf')]+_0x3aa4e7,'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x17')]});}_0x1f3433[_0xaa73('0xf')]=_0x4ff4d5['length']?_[_0xaa73('0x3c')](_0x4ff4d5)[_0xaa73('0xf')]+0x1:_0xaaed00[_0xaa73('0xf')];_0xaaed00[_0xaa73('0xf')]=(_0x45179d[_0xaa73('0x27')]?_[_0xaa73('0x3c')](_0x45179d)[_0xaa73('0xf')]:_0x1f3433['priority'])+0x1;_0xaaed00['extensions']=_[_0xaa73('0x3d')](_0xaaed00['extensions'],_0x4ff4d5,[_0x1f3433],_0x45179d);}_0xaaed00[_0xaa73('0x11')][_0xaa73('0x12')]({'type':_0x25638d[_0x1e4d00][0x0][_0xaa73('0x15')],'app':'Hangup','exten':_0x25638d[_0x1e4d00][0x0][_0xaa73('0xb')],'context':_0x25638d[_0x1e4d00][0x0]['context'],'priority':_0xaaed00[_0xaa73('0xf')],'VoiceExtensionId':_0x25638d[_0x1e4d00][0x0]['VoiceExtensionId']});_0x4efad3[_0xaa73('0x12')](_0x25638d[_0x1e4d00][0x0]['VoiceExtensionId']);_0x4788c7=_[_0xaa73('0x3d')](_0x4788c7,_0xaaed00[_0xaa73('0x11')]);}}return _0x15f357[_0xaa73('0x3e')](function(_0x262ee1){return _0x15f357[_0xaa73('0x6')][_0xaa73('0x8')][_0xaa73('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x4efad3}},'transaction':_0x262ee1})[_0xaa73('0x4')](function(_0x1f9cc5){return _0x15f357['models']['VoiceExtension'][_0xaa73('0x40')](_['sortBy'](_0x4788c7,_0xaa73('0xf')),{'transaction':_0x262ee1});});});})[_0xaa73('0x41')](function(_0x232755){console[_0xaa73('0x42')](_0x232755);});}exports[_0xaa73('0x43')]=rewrite; \ No newline at end of file +var _0x9439=['outbound','Set','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','toLowerCase','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','length','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','type','CDR(type)=%s','context','VoiceExtensionId','push','CDR(routeid)='];(function(_0x58229d,_0x5751a7){var _0x34e5e3=function(_0x33e425){while(--_0x33e425){_0x58229d['push'](_0x58229d['shift']());}};_0x34e5e3(++_0x5751a7);}(_0x9439,0x6e));var _0x9943=function(_0x2cd024,_0x2bbb3c){_0x2cd024=_0x2cd024-0x0;var _0x22cd82=_0x9439[_0x2cd024];return _0x22cd82;};'use strict';var _=require(_0x9943('0x0'));var util=require(_0x9943('0x1'));function rewrite(_0x15ab1d,_0x2027fe){var _0x5f049d=this;return _0x15ab1d[_0x9943('0x2')][_0x9943('0x3')][_0x9943('0x4')]({'raw':!![]})[_0x9943('0x5')](function(_0x41624d){_0x5f049d[_0x9943('0x6')]=_0x41624d;return _0x15ab1d[_0x9943('0x2')][_0x9943('0x7')][_0x9943('0x4')]({'where':{'IntervalId':_0x2027fe['IntervalId']},'raw':!![]});})[_0x9943('0x5')](function(_0x52409b){return _0x15ab1d[_0x9943('0x2')]['VoiceExtension'][_0x9943('0x4')]({'where':{'exten':{'$in':_[_0x9943('0x8')](_[_0x9943('0x9')](_0x52409b,_0x9943('0xa')))}},'order':[{'raw':_0x9943('0xb')}],'raw':!![]});})['then'](function(_0x10e036){var _0x1376f9=_[_0x9943('0xc')](_0x10e036,{'priority':'1'});var _0x21786c=_[_0x9943('0xc')](_0x10e036,{'isApp':0x1});var _0x1b6cff=_[_0x9943('0xd')](_0x21786c,_0x9943('0xa'));var _0x43dde4=[_0x9943('0xe'),_0x9943('0xf')];var _0xe287de=[];var _0x54f9ba=[];for(var _0xc96640 in _0x1b6cff){if(_0x1b6cff[_0x9943('0x10')](_0xc96640)){_0x5f049d[_0x9943('0x11')]=0x2;_0x5f049d[_0x9943('0x12')]=[];_0x5f049d[_0x9943('0x13')]=_['find'](_0x1376f9,{'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')]});_0x5f049d[_0x9943('0x12')]['push']({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':'Set','appdata':util['format'](_0x9943('0x15'),_0x1b6cff[_0xc96640][0x0]['type']),'context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0]['exten'],'priority':_0x5f049d[_0x9943('0x11')]++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});if(_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')]==='inbound'){_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':'Set','appdata':_0x9943('0x19')+_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')],'context':_0x1b6cff[_0xc96640][0x0]['context'],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d[_0x9943('0x11')]++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0]['VoiceExtensionId']});}else if(_0x1b6cff[_0xc96640][0x0]['type']===_0x9943('0x1a')){if(_0x5f049d[_0x9943('0x13')]){_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':_0x9943('0x1b'),'appdata':'CDR(destination)='+(_0x5f049d[_0x9943('0x13')]['cutdigits']?'${EXTEN:'+_0x5f049d['extension'][_0x9943('0x1c')]+'}':_0x9943('0x1d')),'context':_0x1b6cff[_0xc96640][0x0]['context'],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d[_0x9943('0x11')]++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});}_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':_0x9943('0x1b'),'appdata':_0x9943('0x19')+_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')],'context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0]['exten'],'priority':_0x5f049d['priority']++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});var _0xbd477b=_0x5f049d[_0x9943('0x11')]++;_0x5f049d[_0x9943('0x12')]['push']({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':_0x9943('0x1e'),'appdata':_0x9943('0x1f')+(_0xbd477b+0x2)+_0x9943('0x20')+(_0xbd477b+0x1)+')','context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0xbd477b,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});if(_0x5f049d[_0x9943('0x13')]){_0x5f049d['extensions']['push']({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':_0x9943('0x1b'),'appdata':_0x5f049d[_0x9943('0x13')][_0x9943('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x5f049d['extension'][_0x9943('0x1c')]+'}':_0x9943('0x21'),'context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d[_0x9943('0x11')]++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0]['VoiceExtensionId']});}_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':'Set','appdata':_0x9943('0x22')+_0x1b6cff[_0xc96640][0x0]['VoiceExtensionId'],'context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0]['exten'],'priority':_0x5f049d[_0x9943('0x11')]++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0]['VoiceExtensionId']});if(_0x5f049d['extension']&&_0x5f049d['extension']['hasOwnProperty'](_0x9943('0x23'))&&_0x5f049d[_0x9943('0x13')][_0x9943('0x23')]!==_0x9943('0x24')){_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0]['type'],'app':'Set','appdata':_0x9943('0x25'),'context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d['priority']++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});_0x5f049d['extensions'][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':'Set','appdata':_0x9943('0x26')+_0x5f049d[_0x9943('0x13')][_0x9943('0x23')]||_0x9943('0x27'),'context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d[_0x9943('0x11')]++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});}}_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d['priority']++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':_0x9943('0x1b'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1b6cff[_0xc96640][0x0]['context'],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d[_0x9943('0x11')]++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});_0x5f049d[_0x9943('0x12')][_0x9943('0x18')]({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':_0x9943('0x1b'),'appdata':_0x9943('0x28'),'context':_0x1b6cff[_0xc96640][0x0][_0x9943('0x16')],'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'priority':_0x5f049d['priority']++,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});for(var _0x7861ca=0x0,_0x4c0c07=0x0;_0x7861ca<_0x1b6cff[_0xc96640]['length'];_0x7861ca+=0x1,_0x4c0c07=0x0){var _0x248637=_0x1b6cff[_0xc96640][_0x7861ca];if(_0x248637[_0x9943('0x14')]){_0x248637['type']=_0x248637[_0x9943('0x14')][_0x9943('0x29')]();}var _0x24ac13=[];var _0x21cb8f=[];delete _0x248637['id'];delete _0x248637['createdAt'];delete _0x248637['updatedAt'];var _0x25ed72=_0x248637[_0x9943('0x2a')]!==_0x9943('0x2b')?[_0x248637[_0x9943('0x2a')]]:_0x248637[_0x9943('0x2c')]?_['map'](_[_0x9943('0xc')](_0x5f049d[_0x9943('0x6')],{'IntervalId':_0x248637[_0x9943('0x2c')]}),_0x9943('0x2a')):[];if(_0x248637['hasOwnProperty'](_0x9943('0x2d'))){if(_0x248637[_0x9943('0x2d')]&&_0x248637[_0x9943('0x2d')]!=='--'){_0x24ac13[_0x9943('0x18')]({'type':_0x248637[_0x9943('0x14')],'app':_0x9943('0x1b'),'appdata':_0x9943('0x2e')+_0x248637[_0x9943('0x2d')],'context':_0x248637[_0x9943('0x16')],'exten':_0x248637[_0x9943('0xa')],'priority':_0x25ed72['length']+_0x5f049d[_0x9943('0x11')]+_0x4c0c07++,'VoiceExtensionId':_0x248637['VoiceExtensionId']});}}if(_0x248637[_0x9943('0x14')]===_0x9943('0x1a')&&_0x248637[_0x9943('0x10')](_0x9943('0x2f'))){if(_0x248637[_0x9943('0x2f')]){_0x24ac13[_0x9943('0x18')]({'type':_0x248637[_0x9943('0x14')],'app':_0x9943('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x248637[_0x9943('0x2f')]+')','context':_0x248637[_0x9943('0x16')],'exten':_0x248637['exten'],'priority':_0x25ed72['length']+_0x5f049d[_0x9943('0x11')]+_0x4c0c07++,'VoiceExtensionId':_0x248637['VoiceExtensionId']});}else{_0x24ac13[_0x9943('0x18')]({'type':_0x248637[_0x9943('0x14')],'app':_0x9943('0x1e'),'appdata':_0x9943('0x30'),'context':_0x248637['context'],'exten':_0x248637[_0x9943('0xa')],'priority':_0x25ed72['length']+_0x5f049d['priority']+_0x4c0c07++,'VoiceExtensionId':_0x248637[_0x9943('0x17')]});}}if(_0x248637[_0x9943('0x10')](_0x9943('0x31'))){if(_0x43dde4[_0x9943('0x32')](_0x248637['app'][_0x9943('0x29')]())>=0x0&&_0x248637['appType']!==_0x9943('0x33')){if(_0x248637[_0x9943('0x31')]){_0x24ac13[_0x9943('0x18')]({'type':_0x248637[_0x9943('0x14')],'app':_0x9943('0x1e'),'appdata':_0x9943('0x34'),'context':_0x248637[_0x9943('0x16')],'exten':_0x248637[_0x9943('0xa')],'priority':_0x25ed72['length']+_0x5f049d['priority']+_0x4c0c07++,'VoiceExtensionId':_0x248637[_0x9943('0x17')]});_0x24ac13[_0x9943('0x18')]({'type':_0x248637[_0x9943('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x248637[_0x9943('0x16')],'exten':_0x248637['exten'],'priority':_0x25ed72['length']+_0x5f049d[_0x9943('0x11')]+_0x4c0c07++,'VoiceExtensionId':_0x248637[_0x9943('0x17')]});}else{_0x24ac13['push']({'type':_0x248637['type'],'app':'ExecIf','appdata':_0x9943('0x35'),'context':_0x248637[_0x9943('0x16')],'exten':_0x248637[_0x9943('0xa')],'priority':_0x25ed72[_0x9943('0x36')]+_0x5f049d[_0x9943('0x11')]+_0x4c0c07++,'VoiceExtensionId':_0x248637[_0x9943('0x17')]});_0x24ac13[_0x9943('0x18')]({'type':_0x248637[_0x9943('0x14')],'app':_0x9943('0x1b'),'appdata':_0x9943('0x37'),'context':_0x248637[_0x9943('0x16')],'exten':_0x248637[_0x9943('0xa')],'priority':_0x25ed72[_0x9943('0x36')]+_0x5f049d[_0x9943('0x11')]+_0x4c0c07++,'VoiceExtensionId':_0x248637[_0x9943('0x17')]});}}}for(var _0x445721=0x0;_0x445721<_0x25ed72['length'];_0x445721+=0x1){var _0x31d08c=_0x5f049d[_0x9943('0x11')]+_0x25ed72[_0x9943('0x36')];var _0x35b2b8=_0x445721===_0x25ed72['length']-0x1?_0x5f049d['priority']+_0x24ac13[_0x9943('0x36')]+_0x21cb8f[_0x9943('0x36')]+0x2:_0x5f049d['priority']+_0x445721+0x1;_0x24ac13['splice'](_0x445721,0x0,{'type':_0x248637[_0x9943('0x14')],'app':_0x9943('0x38'),'appdata':_0x25ed72[_0x445721]+'?'+_0x248637[_0x9943('0x16')]+_0x9943('0x39')+_0x31d08c+':'+_0x248637[_0x9943('0x16')]+_0x9943('0x39')+_0x35b2b8,'exten':_0x248637[_0x9943('0xa')],'context':_0x248637[_0x9943('0x16')],'priority':_0x5f049d[_0x9943('0x11')]+_0x445721,'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0][_0x9943('0x17')]});}_0x248637[_0x9943('0x11')]=_0x24ac13[_0x9943('0x36')]?_['last'](_0x24ac13)[_0x9943('0x11')]+0x1:_0x5f049d['priority'];_0x5f049d[_0x9943('0x11')]=(_0x21cb8f[_0x9943('0x36')]?_[_0x9943('0x3a')](_0x21cb8f)['priority']:_0x248637['priority'])+0x1;_0x5f049d[_0x9943('0x12')]=_[_0x9943('0x3b')](_0x5f049d[_0x9943('0x12')],_0x24ac13,[_0x248637],_0x21cb8f);}_0x5f049d[_0x9943('0x12')]['push']({'type':_0x1b6cff[_0xc96640][0x0][_0x9943('0x14')],'app':_0x9943('0x3c'),'exten':_0x1b6cff[_0xc96640][0x0][_0x9943('0xa')],'context':_0x1b6cff[_0xc96640][0x0]['context'],'priority':_0x5f049d[_0x9943('0x11')],'VoiceExtensionId':_0x1b6cff[_0xc96640][0x0]['VoiceExtensionId']});_0xe287de[_0x9943('0x18')](_0x1b6cff[_0xc96640][0x0]['VoiceExtensionId']);_0x54f9ba=_[_0x9943('0x3b')](_0x54f9ba,_0x5f049d['extensions']);}}return _0x15ab1d[_0x9943('0x3d')](function(_0xeb86f9){return _0x15ab1d[_0x9943('0x2')]['VoiceExtension'][_0x9943('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0xe287de}},'transaction':_0xeb86f9})['then'](function(_0x32a2cc){return _0x15ab1d['models'][_0x9943('0x7')][_0x9943('0x3f')](_[_0x9943('0x40')](_0x54f9ba,_0x9943('0x11')),{'transaction':_0xeb86f9});});});})[_0x9943('0x41')](function(_0x2ae6af){console[_0x9943('0x42')](_0x2ae6af);});}exports[_0x9943('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 4b07d46..52d820c 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 _0x6a0f=['index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','error','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','message','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','field','NOW()','ContactId','cm_contacts','where','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','from','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a0f,0x12b));var _0xf6a0=function(_0x2c200e,_0x11d96e){_0x2c200e=_0x2c200e-0x0;var _0x4c69fc=_0x6a0f[_0x2c200e];return _0x4c69fc;};'use strict';var BPromise=require(_0xf6a0('0x0'));var util=require('util');var _=require(_0xf6a0('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xf6a0('0x2'));var Redis=require(_0xf6a0('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xf6a0('0x4'));var logger=require(_0xf6a0('0x5'))('api');config[_0xf6a0('0x6')]=_[_0xf6a0('0x7')](config[_0xf6a0('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6a0('0x8'))(new Redis(config[_0xf6a0('0x6')]));require(_0xf6a0('0x9'))[_0xf6a0('0xa')](socket);try{if(!process[_0xf6a0('0xb')][0x2]||process[_0xf6a0('0xb')][0x2]===_0xf6a0('0xc')||process[_0xf6a0('0xb')][0x2]==='null'){throw new Error(_0xf6a0('0xd'));}var FILEPATH=process[_0xf6a0('0xb')][0x2];if(!process['argv'][0x3]||process[_0xf6a0('0xb')][0x3]==='undefined'||process[_0xf6a0('0xb')][0x3]===_0xf6a0('0xe')||!process[_0xf6a0('0xb')][0x4]||process[_0xf6a0('0xb')][0x4]===_0xf6a0('0xc')||process[_0xf6a0('0xb')][0x4]===_0xf6a0('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xf6a0('0xb')][0x3][_0xf6a0('0xf')](','),process[_0xf6a0('0xb')][0x4][_0xf6a0('0xf')](','));if(!process[_0xf6a0('0xb')][0x5]||process['argv'][0x5]===_0xf6a0('0xc')||process[_0xf6a0('0xb')][0x5]===_0xf6a0('0xe')){throw new Error(_0xf6a0('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xf6a0('0xb')][0x6]&&process[_0xf6a0('0xb')][0x6]!=='undefined'&&process['argv'][0x6]!==_0xf6a0('0xe')?process[_0xf6a0('0xb')][0x6]:null;var DUPLICATES=process[_0xf6a0('0xb')][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0xf6a0('0xe')?process[_0xf6a0('0xb')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xf6a0('0xc')||process['argv'][0x8]==='null'){throw new Error(_0xf6a0('0x11'));}var SOCKET_TIMESTAMP=process[_0xf6a0('0xb')][0x8];}catch(_0x4a5cbe){logger['error'](_0x4a5cbe);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(_0x2b19b4,_0x307ca6,_0x23250f,_0x56bb2c){var _0x4adf1b={'message':_0x307ca6};_0x4adf1b[_0x2b19b4]=!![];if(_0x23250f){_0x4adf1b[_0xf6a0('0x12')]=_0x23250f;}if(_0x56bb2c){_0x4adf1b[_0xf6a0('0x13')]=_0x56bb2c;}return _0x4adf1b;}function isEmail(_0x995e9e){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))*$/[_0xf6a0('0x14')](_0x995e9e);}function checkRow(_0x1694f2,_0x26f59c,_0x46b730){return new BPromise(function(_0x453990,_0x2ed293){if(_[_0xf6a0('0x15')](_0x1694f2)){return _0x2ed293(handleCheckRowError('error',_0xf6a0('0x16'),null,_0x46b730));}if(_0x1694f2[_0xf6a0('0x17')]&&_0x1694f2['errors'][_0xf6a0('0x18')]){var _0x38d8aa=_[_0xf6a0('0x19')](_0x1694f2[_0xf6a0('0x17')],'message')[_0xf6a0('0x1a')](';');return _0x2ed293(handleCheckRowError(_0xf6a0('0x1b'),_0x38d8aa,null,_0x46b730));}var _0x222c31={};for(var _0x50afac in FIELDS){if(FIELDS[_0xf6a0('0x1c')](_0x50afac)&&FIELDS[_0x50afac]){_0x222c31[_0x50afac]=_0x1694f2['data'][0x0][FIELDS[_0x50afac]]||_0x1694f2['data'][0x0]['\ufeff'+FIELDS[_0x50afac]];}}if(!_0x222c31[_0xf6a0('0x1d')]){return _0x2ed293(handleCheckRowError(_0xf6a0('0x1b'),_0xf6a0('0x1e'),null,_0x46b730));}if(!_0x222c31[_0xf6a0('0x1f')]){return _0x2ed293(handleCheckRowError(_0xf6a0('0x1b'),_0xf6a0('0x20'),null,_0x46b730));}if(_0x222c31[_0xf6a0('0x21')]){var _0x11b666=moment(_0x222c31['birthDate'],'YYYY-MM-DD');if(!_0x11b666['isValid']()){return _0x2ed293(handleCheckRowError(_0xf6a0('0x1b'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x46b730));}}if(_0x222c31[_0xf6a0('0x22')]){if(!isEmail(_0x222c31['email'])){return _0x2ed293(handleCheckRowError(_0xf6a0('0x1b'),_0xf6a0('0x23'),null,_0x46b730));}}_0x222c31[_0xf6a0('0x24')]=LISTID;_0x222c31[_0xf6a0('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x26f59c){var _0x24c702={};for(var _0x11b644=0x0,_0x2e1359=DUPLICATES['length'];_0x11b644<_0x2e1359;_0x11b644+=0x1){_0x24c702[DUPLICATES[_0x11b644]]=_0x222c31[DUPLICATES[_0x11b644]];}var _0x38fd68=_['find'](_0x26f59c,_0x24c702);if(_0x38fd68){return _0x2ed293(handleCheckRowError('duplicate',_0xf6a0('0x26'),_0x38fd68,_0x46b730));}}return db[_0xf6a0('0x27')][_0xf6a0('0x28')](_0x222c31,{'raw':!![],'hooks':![],'fields':_[_0xf6a0('0x29')](_0x222c31)})[_0xf6a0('0x2a')](function(_0x270278){if(DUPLICATES&&DUPLICATES[_0xf6a0('0x18')]&&_0x26f59c){_0x26f59c[_0xf6a0('0x2b')](_[_0xf6a0('0x2c')](_0x222c31,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x270278['id'];return _0x453990();})[_0xf6a0('0x2d')](function(_0x19edc5){return _0x2ed293(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x19edc5[_0xf6a0('0x2e')]||JSON['stringify'](_0x19edc5)),null,_0x46b730));});});}function checkHopper(){function _0x2c6e8d(){return function(_0x12ec1b){logger[_0xf6a0('0x1b')](_0xf6a0('0x2f'),'checkHopper',util[_0xf6a0('0x30')](_0x12ec1b,{'showHidden':![],'depth':null}));};}var _0x695d54=function(_0x1f6d2e,_0x2c615a){var _0x276eb9=squel[_0xf6a0('0x31')]()[_0xf6a0('0x32')](_0xf6a0('0x33'))[_0xf6a0('0x34')]([_0xf6a0('0x1f'),_0xf6a0('0x35'),'ContactId','ListId',_0x2c615a,_0xf6a0('0x36'),_0xf6a0('0x37')],squel['select']()[_0xf6a0('0x38')](_0xf6a0('0x1f'),'phone')['field'](_0xf6a0('0x39'),_0xf6a0('0x35'))['field']('id',_0xf6a0('0x3a'))[_0xf6a0('0x38')](LISTID['toString'](),_0xf6a0('0x24'))[_0xf6a0('0x38')](_0x1f6d2e['id']['toString'](),_0x2c615a)[_0xf6a0('0x38')]('NOW()',_0xf6a0('0x36'))['field'](_0xf6a0('0x39'),_0xf6a0('0x37'))['from'](_0xf6a0('0x3b'))[_0xf6a0('0x3c')](_0xf6a0('0x3d'))[_0xf6a0('0x3c')]('ListId\x20=\x20?',LISTID[_0xf6a0('0x3e')]())['where'](_0xf6a0('0x3f'))[_0xf6a0('0x3c')](_0xf6a0('0x40'),squel[_0xf6a0('0x41')]()[_0xf6a0('0x38')](_0xf6a0('0x1f'))['from'](_0xf6a0('0x33'))[_0xf6a0('0x3c')](_0x2c615a+_0xf6a0('0x42'),_0x1f6d2e['id'][_0xf6a0('0x3e')]())))[_0xf6a0('0x3e')]();return _0x276eb9;};var _0x47f35b=function(_0x504478,_0x218193){var _0x57c544=squel['insert']()[_0xf6a0('0x32')](_0xf6a0('0x33'))[_0xf6a0('0x34')]([_0xf6a0('0x1f'),_0xf6a0('0x35'),'ContactId',_0xf6a0('0x24'),_0x218193,'createdAt',_0xf6a0('0x37')],squel[_0xf6a0('0x41')]()[_0xf6a0('0x38')](_0xf6a0('0x1f'),'phone')[_0xf6a0('0x38')](_0xf6a0('0x39'),_0xf6a0('0x35'))['field']('id',_0xf6a0('0x3a'))[_0xf6a0('0x38')](LISTID['toString'](),_0xf6a0('0x24'))[_0xf6a0('0x38')](_0x504478['id'][_0xf6a0('0x3e')](),_0x218193)['field'](_0xf6a0('0x39'),_0xf6a0('0x36'))['field']('NOW()',_0xf6a0('0x37'))[_0xf6a0('0x43')](_0xf6a0('0x3b'))[_0xf6a0('0x3c')](_0xf6a0('0x3d'))[_0xf6a0('0x3c')](_0xf6a0('0x44'),LISTID[_0xf6a0('0x3e')]())[_0xf6a0('0x3c')](_0xf6a0('0x45'),squel[_0xf6a0('0x46')](hopperContacts))[_0xf6a0('0x3c')](_0xf6a0('0x3f'))[_0xf6a0('0x3c')](_0xf6a0('0x40'),squel[_0xf6a0('0x41')]()[_0xf6a0('0x38')](_0xf6a0('0x47'))[_0xf6a0('0x43')](_0xf6a0('0x48'))['where'](_0x218193+_0xf6a0('0x42'),_0x504478['id'][_0xf6a0('0x3e')]()))[_0xf6a0('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf6a0('0x41')]()[_0xf6a0('0x38')](_0xf6a0('0x1f'))[_0xf6a0('0x43')](_0xf6a0('0x33'))[_0xf6a0('0x3c')](_0x218193+_0xf6a0('0x42'),_0x504478['id'][_0xf6a0('0x3e')]())))[_0xf6a0('0x3e')]();return _0x57c544;};function _0x20bac4(_0x1e9e37,_0x36cea9){var _0x44c1df=squel[_0xf6a0('0x31')]()[_0xf6a0('0x32')](_0xf6a0('0x33'))[_0xf6a0('0x34')]([_0xf6a0('0x1f'),'scheduledAt',_0xf6a0('0x3a'),_0xf6a0('0x24'),_0x36cea9,_0xf6a0('0x36'),_0xf6a0('0x37')],squel[_0xf6a0('0x41')]()[_0xf6a0('0x38')](_0xf6a0('0x1f'),_0xf6a0('0x1f'))[_0xf6a0('0x38')](_0xf6a0('0x39'),_0xf6a0('0x35'))[_0xf6a0('0x38')]('id',_0xf6a0('0x3a'))[_0xf6a0('0x38')](LISTID['toString'](),'ListId')[_0xf6a0('0x38')](_0x1e9e37['id']['toString'](),_0x36cea9)[_0xf6a0('0x38')](_0xf6a0('0x39'),'createdAt')[_0xf6a0('0x38')](_0xf6a0('0x39'),_0xf6a0('0x37'))[_0xf6a0('0x43')]('cm_contacts')['where'](_0xf6a0('0x3d'))[_0xf6a0('0x3c')]('ListId\x20=\x20?',LISTID[_0xf6a0('0x3e')]())[_0xf6a0('0x3c')](_0xf6a0('0x45'),squel['str'](hopperContacts))['where'](_0xf6a0('0x3f')))['toString']();return _0x44c1df;}function _0x373b9f(_0x380d88,_0xb840f1){var _0x61266b=squel[_0xf6a0('0x31')]()[_0xf6a0('0x32')](_0xf6a0('0x49'))[_0xf6a0('0x34')]([_0xf6a0('0x1f'),'ContactId',_0xf6a0('0x24'),_0xb840f1,'createdAt','updatedAt'],squel[_0xf6a0('0x41')]()['field'](_0xf6a0('0x1f'),_0xf6a0('0x1f'))['field']('id',_0xf6a0('0x3a'))[_0xf6a0('0x38')](LISTID[_0xf6a0('0x3e')](),'ListId')[_0xf6a0('0x38')](_0x380d88['id'][_0xf6a0('0x3e')](),_0xb840f1)[_0xf6a0('0x38')](_0xf6a0('0x39'),'createdAt')['field']('NOW()',_0xf6a0('0x37'))['from']('cm_contacts')[_0xf6a0('0x3c')](_0xf6a0('0x3d'))['where'](_0xf6a0('0x44'),LISTID['toString']())[_0xf6a0('0x3c')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0xf6a0('0x3f')))[_0xf6a0('0x3e')]();return _0x61266b;}return db['VoiceQueue'][_0xf6a0('0x4a')]({'where':{'type':_0xf6a0('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xf6a0('0x4c')],'as':_0xf6a0('0x4d'),'where':{'id':LISTID}}]})[_0xf6a0('0x2a')](function(_0xb225a6){var _0x49327c=[];if(_0xb225a6){var _0x30fd41;for(var _0x47a0e1=0x0,_0x25362e;_0x47a0e1<_0xb225a6['length'];_0x47a0e1+=0x1){_0x25362e=_0xb225a6[_0x47a0e1][_0xf6a0('0x4e')]({'plain':!![]});switch(_0x25362e[_0xf6a0('0x4f')]){case _0xf6a0('0x50'):_0x49327c[_0xf6a0('0x2b')](db[_0xf6a0('0x51')][_0xf6a0('0x52')](_0x47f35b(_0x25362e,'VoiceQueueId'))[_0xf6a0('0x2a')](function(){})[_0xf6a0('0x2d')](_0x2c6e8d()));break;case _0xf6a0('0x53'):_0x49327c[_0xf6a0('0x2b')](db[_0xf6a0('0x51')][_0xf6a0('0x52')](_0x695d54(_0x25362e,_0xf6a0('0x54')))[_0xf6a0('0x2a')](function(){})[_0xf6a0('0x2d')](_0x2c6e8d()));break;default:_0x49327c[_0xf6a0('0x2b')](db['sequelize'][_0xf6a0('0x52')](_0x20bac4(_0x25362e,_0xf6a0('0x54')))[_0xf6a0('0x2a')](function(){})['catch'](_0x2c6e8d()));}}}return _0x49327c;})['all']()[_0xf6a0('0x2a')](function(){return db['VoiceQueue'][_0xf6a0('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xf6a0('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xf6a0('0x2a')](function(_0x289746){var _0x12e85f=[];if(_0x289746){var _0x11c3e7;for(var _0x560cf=0x0,_0x465e35;_0x560cf<_0x289746[_0xf6a0('0x18')];_0x560cf+=0x1){_0x465e35=_0x289746[_0x560cf][_0xf6a0('0x4e')]({'plain':!![]});_0x12e85f[_0xf6a0('0x2b')](db[_0xf6a0('0x51')]['query'](_0x373b9f(_0x465e35,'VoiceQueueId'))[_0xf6a0('0x2a')](function(){})[_0xf6a0('0x2d')](_0x2c6e8d()));}}return _0x12e85f;})[_0xf6a0('0x55')]();})[_0xf6a0('0x2a')](function(){return db[_0xf6a0('0x56')][_0xf6a0('0x4a')]({'attributes':['id',_0xf6a0('0x4f')],'include':[{'model':db[_0xf6a0('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0xf6a0('0x2a')](function(_0x79d88d){var _0x1c335e=[];if(_0x79d88d){for(var _0x9f1c6d=0x0,_0x1d47fb;_0x9f1c6d<_0x79d88d[_0xf6a0('0x18')];_0x9f1c6d+=0x1){_0x1d47fb=_0x79d88d[_0x9f1c6d]['get']({'plain':!![]});switch(_0x1d47fb[_0xf6a0('0x4f')]){case _0xf6a0('0x50'):_0x1c335e[_0xf6a0('0x2b')](db[_0xf6a0('0x51')]['query'](_0x47f35b(_0x1d47fb,'CampaignId'))[_0xf6a0('0x2a')](function(){})[_0xf6a0('0x2d')](_0x2c6e8d()));break;case'onlyIfOpen':_0x1c335e['push'](db[_0xf6a0('0x51')][_0xf6a0('0x52')](_0x695d54(_0x1d47fb,_0xf6a0('0x57')))[_0xf6a0('0x2a')](function(){})['catch'](_0x2c6e8d()));break;default:_0x1c335e[_0xf6a0('0x2b')](db[_0xf6a0('0x51')][_0xf6a0('0x52')](_0x20bac4(_0x1d47fb,_0xf6a0('0x57')))['then'](function(){})[_0xf6a0('0x2d')](_0x2c6e8d()));}}}return _0x1c335e;})[_0xf6a0('0x55')]();})[_0xf6a0('0x2a')](function(){return db[_0xf6a0('0x56')][_0xf6a0('0x4a')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xf6a0('0x58'),'where':{'id':LISTID}}]})[_0xf6a0('0x2a')](function(_0x18f48e){var _0x55ecdc=[];if(_0x18f48e){for(var _0x416ec=0x0,_0x562ade;_0x416ec<_0x18f48e[_0xf6a0('0x18')];_0x416ec+=0x1){_0x562ade=_0x18f48e[_0x416ec]['get']({'plain':!![]});_0x55ecdc[_0xf6a0('0x2b')](db[_0xf6a0('0x51')][_0xf6a0('0x52')](_0x373b9f(_0x562ade,_0xf6a0('0x57')))['then'](function(){})[_0xf6a0('0x2d')](_0x2c6e8d()));}}return _0x55ecdc;})[_0xf6a0('0x55')]();})[_0xf6a0('0x2d')](function(_0xee6f2a){logger[_0xf6a0('0x1b')](_0xf6a0('0x59'),_0xf6a0('0x5a'),_0xee6f2a[_0xf6a0('0x2e')]);});}var processPromises=function(_0x2ef9c1){return BPromise[_0xf6a0('0x55')](promises)[_0xf6a0('0x2a')](function(_0x42c841){})[_0xf6a0('0x2d')](function(_0x58d6fa){logger[_0xf6a0('0x1b')](_0xf6a0('0x5b'),JSON[_0xf6a0('0x5c')](_0x58d6fa));})[_0xf6a0('0x5d')](function(){socket[_0xf6a0('0x5e')](_0xf6a0('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2ef9c1){return _0x2ef9c1[_0xf6a0('0x60')]();}});};var endCsv=function(){return BPromise[_0xf6a0('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xf6a0('0x2a')](function(){socket[_0xf6a0('0x5e')](_0xf6a0('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x435c8d){logger['error'](_0xf6a0('0x62'),JSON[_0xf6a0('0x5c')](_0x435c8d));}finally{process[_0xf6a0('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xf6a0('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xf6a0('0xf')](',');return db[_0xf6a0('0x27')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xf6a0('0x2a')](function(_0x249db0){var _0x28b2f7=fs[_0xf6a0('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xf6a0('0x66')](_0x28b2f7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x55c309,_0x3a4b76){total+=0x1;var _0x46ee42=total;promises[_0xf6a0('0x2b')](checkRow(_0x55c309,_0x249db0,_0x46ee42)[_0xf6a0('0x2a')](function(){success+=0x1;})[_0xf6a0('0x2d')](function(_0x39d344){if(_0x39d344['error']){errors+=0x1;delete _0x39d344['error'];}else if(_0x39d344[_0xf6a0('0x67')]){duplicates+=0x1;delete _0x39d344[_0xf6a0('0x67')];}rows[_0xf6a0('0x2b')](_0x39d344);}));if(total%0xc8===0x0){_0x3a4b76['pause']();return processPromises(_0x3a4b76);}},'complete':function(){return processPromises()['then'](function(){logger[_0xf6a0('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x364e69,_0x46f6c6){logger[_0xf6a0('0x64')](_0xf6a0('0x68'),JSON[_0xf6a0('0x5c')](_0x364e69));endCsv();}});})[_0xf6a0('0x2d')](function(_0x150043){logger['error'](_0xf6a0('0x69'),JSON[_0xf6a0('0x5c')](_0x150043));});}main(); \ No newline at end of file +var _0x3843=['../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','field','NOW()','toString','updatedAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_contacts','into','cm_hopper_black','outbound','CmList','Lists','dialCheckDuplicateType','query','VoiceQueueId','onlyIfOpen','sequelize','all','VoiceQueue','findAll','BlackLists','get','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','../../../mysqldb','api','redis','defaults','socket.io-emitter'];(function(_0x1efd54,_0x1a02ea){var _0x48287c=function(_0x1c27d8){while(--_0x1c27d8){_0x1efd54['push'](_0x1efd54['shift']());}};_0x48287c(++_0x1a02ea);}(_0x3843,0x13b));var _0x3384=function(_0x5eef77,_0x258604){_0x5eef77=_0x5eef77-0x0;var _0x407925=_0x3843[_0x5eef77];return _0x407925;};'use strict';var BPromise=require(_0x3384('0x0'));var util=require(_0x3384('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x3384('0x2'));var Papa=require(_0x3384('0x3'));var Redis=require('ioredis');var db=require(_0x3384('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3384('0x5'));config[_0x3384('0x6')]=_[_0x3384('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3384('0x8'))(new Redis(config[_0x3384('0x6')]));require(_0x3384('0x9'))[_0x3384('0xa')](socket);try{if(!process[_0x3384('0xb')][0x2]||process['argv'][0x2]===_0x3384('0xc')||process[_0x3384('0xb')][0x2]==='null'){throw new Error(_0x3384('0xd'));}var FILEPATH=process[_0x3384('0xb')][0x2];if(!process[_0x3384('0xb')][0x3]||process[_0x3384('0xb')][0x3]==='undefined'||process[_0x3384('0xb')][0x3]===_0x3384('0xe')||!process['argv'][0x4]||process[_0x3384('0xb')][0x4]==='undefined'||process['argv'][0x4]===_0x3384('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x3384('0xf')](process[_0x3384('0xb')][0x3]['split'](','),process[_0x3384('0xb')][0x4][_0x3384('0x10')](','));if(!process[_0x3384('0xb')][0x5]||process[_0x3384('0xb')][0x5]===_0x3384('0xc')||process[_0x3384('0xb')][0x5]===_0x3384('0xe')){throw new Error(_0x3384('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x3384('0xb')][0x6]&&process['argv'][0x6]!==_0x3384('0xc')&&process[_0x3384('0xb')][0x6]!==_0x3384('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0x3384('0xb')][0x7]&&process[_0x3384('0xb')][0x7]!=='undefined'&&process[_0x3384('0xb')][0x7]!==_0x3384('0xe')?process[_0x3384('0xb')][0x7]:null;if(!process[_0x3384('0xb')][0x8]||process[_0x3384('0xb')][0x8]==='undefined'||process[_0x3384('0xb')][0x8]===_0x3384('0xe')){throw new Error(_0x3384('0x12'));}var SOCKET_TIMESTAMP=process[_0x3384('0xb')][0x8];}catch(_0x74e1d9){logger[_0x3384('0x13')](_0x74e1d9);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(_0x3940bb,_0x57c512,_0x2968e8,_0x2822aa){var _0x3a02e8={'message':_0x57c512};_0x3a02e8[_0x3940bb]=!![];if(_0x2968e8){_0x3a02e8[_0x3384('0x14')]=_0x2968e8;}if(_0x2822aa){_0x3a02e8[_0x3384('0x15')]=_0x2822aa;}return _0x3a02e8;}function isEmail(_0x17b89f){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))*$/[_0x3384('0x16')](_0x17b89f);}function checkRow(_0x9e2595,_0xe5a251,_0x350bf8){return new BPromise(function(_0x494afe,_0x4ad55d){if(_[_0x3384('0x17')](_0x9e2595)){return _0x4ad55d(handleCheckRowError(_0x3384('0x13'),_0x3384('0x18'),null,_0x350bf8));}if(_0x9e2595[_0x3384('0x19')]&&_0x9e2595[_0x3384('0x19')][_0x3384('0x1a')]){var _0x5eb281=_['map'](_0x9e2595['errors'],_0x3384('0x1b'))['join'](';');return _0x4ad55d(handleCheckRowError(_0x3384('0x13'),_0x5eb281,null,_0x350bf8));}var _0x542bc9={};for(var _0x381cf7 in FIELDS){if(FIELDS[_0x3384('0x1c')](_0x381cf7)&&FIELDS[_0x381cf7]){_0x542bc9[_0x381cf7]=_0x9e2595[_0x3384('0x1d')][0x0][FIELDS[_0x381cf7]]||_0x9e2595[_0x3384('0x1d')][0x0]['\ufeff'+FIELDS[_0x381cf7]];}}if(!_0x542bc9['firstName']){return _0x4ad55d(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x350bf8));}if(!_0x542bc9[_0x3384('0x1e')]){return _0x4ad55d(handleCheckRowError(_0x3384('0x13'),_0x3384('0x1f'),null,_0x350bf8));}if(_0x542bc9[_0x3384('0x20')]){var _0x1939b5=moment(_0x542bc9[_0x3384('0x20')],_0x3384('0x21'));if(!_0x1939b5['isValid']()){return _0x4ad55d(handleCheckRowError(_0x3384('0x13'),_0x3384('0x22'),null,_0x350bf8));}}if(_0x542bc9['email']){if(!isEmail(_0x542bc9[_0x3384('0x23')])){return _0x4ad55d(handleCheckRowError('error',_0x3384('0x24'),null,_0x350bf8));}}_0x542bc9[_0x3384('0x25')]=LISTID;_0x542bc9[_0x3384('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xe5a251){var _0x1d5e0a={};for(var _0x503d40=0x0,_0x790fb0=DUPLICATES['length'];_0x503d40<_0x790fb0;_0x503d40+=0x1){_0x1d5e0a[DUPLICATES[_0x503d40]]=_0x542bc9[DUPLICATES[_0x503d40]];}var _0x16682e=_['find'](_0xe5a251,_0x1d5e0a);if(_0x16682e){return _0x4ad55d(handleCheckRowError(_0x3384('0x27'),_0x3384('0x28'),_0x16682e,_0x350bf8));}}return db[_0x3384('0x29')][_0x3384('0x2a')](_0x542bc9,{'raw':!![],'hooks':![],'fields':_[_0x3384('0x2b')](_0x542bc9)})[_0x3384('0x2c')](function(_0x4ee664){if(DUPLICATES&&DUPLICATES[_0x3384('0x1a')]&&_0xe5a251){_0xe5a251[_0x3384('0x2d')](_[_0x3384('0x2e')](_0x542bc9,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4ee664['id'];return _0x494afe();})[_0x3384('0x2f')](function(_0xfd72ba){return _0x4ad55d(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0xfd72ba['message']||JSON[_0x3384('0x30')](_0xfd72ba)),null,_0x350bf8));});});}function checkHopper(){function _0x207f31(){return function(_0x40f8c8){logger[_0x3384('0x13')](_0x3384('0x31'),'checkHopper',util[_0x3384('0x32')](_0x40f8c8,{'showHidden':![],'depth':null}));};}var _0x31c2cc=function(_0x277ba8,_0x1b4d88){var _0x9a99aa=squel[_0x3384('0x33')]()['into'](_0x3384('0x34'))[_0x3384('0x35')]([_0x3384('0x1e'),_0x3384('0x36'),_0x3384('0x37'),_0x3384('0x25'),_0x1b4d88,_0x3384('0x38'),'updatedAt'],squel['select']()['field'](_0x3384('0x1e'),'phone')[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x36'))[_0x3384('0x39')]('id',_0x3384('0x37'))[_0x3384('0x39')](LISTID[_0x3384('0x3b')](),_0x3384('0x25'))[_0x3384('0x39')](_0x277ba8['id']['toString'](),_0x1b4d88)[_0x3384('0x39')]('NOW()','createdAt')[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x3c'))[_0x3384('0x3d')]('cm_contacts')[_0x3384('0x3e')](_0x3384('0x3f'))[_0x3384('0x3e')](_0x3384('0x40'),LISTID[_0x3384('0x3b')]())[_0x3384('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x3384('0x3e')](_0x3384('0x41'),squel[_0x3384('0x42')]()[_0x3384('0x39')](_0x3384('0x1e'))[_0x3384('0x3d')](_0x3384('0x34'))[_0x3384('0x3e')](_0x1b4d88+'\x20=\x20?',_0x277ba8['id'][_0x3384('0x3b')]())))[_0x3384('0x3b')]();return _0x9a99aa;};var _0x132da5=function(_0x56e825,_0x3c713b){var _0x1b770d=squel['insert']()['into'](_0x3384('0x34'))['fromQuery']([_0x3384('0x1e'),_0x3384('0x36'),_0x3384('0x37'),_0x3384('0x25'),_0x3c713b,_0x3384('0x38'),'updatedAt'],squel[_0x3384('0x42')]()[_0x3384('0x39')](_0x3384('0x1e'),_0x3384('0x1e'))[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x36'))['field']('id',_0x3384('0x37'))[_0x3384('0x39')](LISTID[_0x3384('0x3b')](),_0x3384('0x25'))['field'](_0x56e825['id']['toString'](),_0x3c713b)[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x38'))[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x3c'))[_0x3384('0x3d')]('cm_contacts')[_0x3384('0x3e')](_0x3384('0x3f'))[_0x3384('0x3e')]('ListId\x20=\x20?',LISTID[_0x3384('0x3b')]())['where'](_0x3384('0x43'),squel[_0x3384('0x44')](hopperContacts))[_0x3384('0x3e')](_0x3384('0x45'))[_0x3384('0x3e')](_0x3384('0x41'),squel[_0x3384('0x42')]()[_0x3384('0x39')](_0x3384('0x46'))[_0x3384('0x3d')](_0x3384('0x47'))[_0x3384('0x3e')](_0x3c713b+_0x3384('0x48'),_0x56e825['id'][_0x3384('0x3b')]()))[_0x3384('0x3e')](_0x3384('0x41'),squel[_0x3384('0x42')]()[_0x3384('0x39')](_0x3384('0x1e'))['from']('cm_hopper')['where'](_0x3c713b+_0x3384('0x48'),_0x56e825['id'][_0x3384('0x3b')]())))[_0x3384('0x3b')]();return _0x1b770d;};function _0x1ecb24(_0x1f53f5,_0x2704e1){var _0xf607d8=squel['insert']()['into'](_0x3384('0x34'))['fromQuery'](['phone',_0x3384('0x36'),'ContactId',_0x3384('0x25'),_0x2704e1,_0x3384('0x38'),_0x3384('0x3c')],squel[_0x3384('0x42')]()[_0x3384('0x39')](_0x3384('0x1e'),_0x3384('0x1e'))['field'](_0x3384('0x3a'),_0x3384('0x36'))[_0x3384('0x39')]('id',_0x3384('0x37'))[_0x3384('0x39')](LISTID['toString'](),'ListId')['field'](_0x1f53f5['id'][_0x3384('0x3b')](),_0x2704e1)[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x38'))[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x3c'))[_0x3384('0x3d')](_0x3384('0x49'))['where'](_0x3384('0x3f'))[_0x3384('0x3e')](_0x3384('0x40'),LISTID[_0x3384('0x3b')]())[_0x3384('0x3e')](_0x3384('0x43'),squel['str'](hopperContacts))[_0x3384('0x3e')](_0x3384('0x45')))[_0x3384('0x3b')]();return _0xf607d8;}function _0x15e8f2(_0x41224e,_0x4ed65a){var _0x2843fc=squel[_0x3384('0x33')]()[_0x3384('0x4a')](_0x3384('0x4b'))[_0x3384('0x35')]([_0x3384('0x1e'),_0x3384('0x37'),_0x3384('0x25'),_0x4ed65a,_0x3384('0x38'),_0x3384('0x3c')],squel[_0x3384('0x42')]()['field'](_0x3384('0x1e'),_0x3384('0x1e'))[_0x3384('0x39')]('id','ContactId')[_0x3384('0x39')](LISTID['toString'](),'ListId')[_0x3384('0x39')](_0x41224e['id'][_0x3384('0x3b')](),_0x4ed65a)[_0x3384('0x39')]('NOW()',_0x3384('0x38'))[_0x3384('0x39')](_0x3384('0x3a'),_0x3384('0x3c'))[_0x3384('0x3d')](_0x3384('0x49'))[_0x3384('0x3e')]('deletedAt\x20IS\x20NULL')[_0x3384('0x3e')]('ListId\x20=\x20?',LISTID[_0x3384('0x3b')]())['where'](_0x3384('0x43'),squel['str'](hopperContacts))[_0x3384('0x3e')](_0x3384('0x45')))[_0x3384('0x3b')]();return _0x2843fc;}return db['VoiceQueue']['findAll']({'where':{'type':_0x3384('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3384('0x4d')],'as':_0x3384('0x4e'),'where':{'id':LISTID}}]})[_0x3384('0x2c')](function(_0x37ebce){var _0x4e5fa6=[];if(_0x37ebce){var _0xf38ba5;for(var _0x1cdcb7=0x0,_0x2b6ce4;_0x1cdcb7<_0x37ebce[_0x3384('0x1a')];_0x1cdcb7+=0x1){_0x2b6ce4=_0x37ebce[_0x1cdcb7]['get']({'plain':!![]});switch(_0x2b6ce4[_0x3384('0x4f')]){case'always':_0x4e5fa6[_0x3384('0x2d')](db['sequelize'][_0x3384('0x50')](_0x132da5(_0x2b6ce4,_0x3384('0x51')))[_0x3384('0x2c')](function(){})[_0x3384('0x2f')](_0x207f31()));break;case _0x3384('0x52'):_0x4e5fa6[_0x3384('0x2d')](db[_0x3384('0x53')][_0x3384('0x50')](_0x31c2cc(_0x2b6ce4,'VoiceQueueId'))[_0x3384('0x2c')](function(){})['catch'](_0x207f31()));break;default:_0x4e5fa6['push'](db[_0x3384('0x53')][_0x3384('0x50')](_0x1ecb24(_0x2b6ce4,_0x3384('0x51')))['then'](function(){})[_0x3384('0x2f')](_0x207f31()));}}}return _0x4e5fa6;})[_0x3384('0x54')]()[_0x3384('0x2c')](function(){return db[_0x3384('0x55')][_0x3384('0x56')]({'where':{'type':_0x3384('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3384('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x3cd9d6){var _0x23047e=[];if(_0x3cd9d6){var _0x17142d;for(var _0xa972a6=0x0,_0x3fe628;_0xa972a6<_0x3cd9d6[_0x3384('0x1a')];_0xa972a6+=0x1){_0x3fe628=_0x3cd9d6[_0xa972a6][_0x3384('0x58')]({'plain':!![]});_0x23047e[_0x3384('0x2d')](db[_0x3384('0x53')][_0x3384('0x50')](_0x15e8f2(_0x3fe628,_0x3384('0x51')))[_0x3384('0x2c')](function(){})[_0x3384('0x2f')](_0x207f31()));}}return _0x23047e;})[_0x3384('0x54')]();})[_0x3384('0x2c')](function(){return db[_0x3384('0x59')]['findAll']({'attributes':['id',_0x3384('0x4f')],'include':[{'model':db[_0x3384('0x4d')],'as':_0x3384('0x4e'),'where':{'id':LISTID}}]})[_0x3384('0x2c')](function(_0x3fa145){var _0x323904=[];if(_0x3fa145){for(var _0x3daeb8=0x0,_0x42f3d8;_0x3daeb8<_0x3fa145['length'];_0x3daeb8+=0x1){_0x42f3d8=_0x3fa145[_0x3daeb8]['get']({'plain':!![]});switch(_0x42f3d8['dialCheckDuplicateType']){case _0x3384('0x5a'):_0x323904['push'](db[_0x3384('0x53')][_0x3384('0x50')](_0x132da5(_0x42f3d8,_0x3384('0x5b')))[_0x3384('0x2c')](function(){})[_0x3384('0x2f')](_0x207f31()));break;case _0x3384('0x52'):_0x323904[_0x3384('0x2d')](db['sequelize'][_0x3384('0x50')](_0x31c2cc(_0x42f3d8,_0x3384('0x5b')))[_0x3384('0x2c')](function(){})[_0x3384('0x2f')](_0x207f31()));break;default:_0x323904[_0x3384('0x2d')](db[_0x3384('0x53')][_0x3384('0x50')](_0x1ecb24(_0x42f3d8,_0x3384('0x5b')))[_0x3384('0x2c')](function(){})['catch'](_0x207f31()));}}}return _0x323904;})[_0x3384('0x54')]();})[_0x3384('0x2c')](function(){return db[_0x3384('0x59')][_0x3384('0x56')]({'attributes':['id'],'include':[{'model':db[_0x3384('0x4d')],'as':_0x3384('0x57'),'where':{'id':LISTID}}]})[_0x3384('0x2c')](function(_0x543802){var _0x1a2b21=[];if(_0x543802){for(var _0x54271=0x0,_0x4614e9;_0x54271<_0x543802[_0x3384('0x1a')];_0x54271+=0x1){_0x4614e9=_0x543802[_0x54271][_0x3384('0x58')]({'plain':!![]});_0x1a2b21[_0x3384('0x2d')](db[_0x3384('0x53')]['query'](_0x15e8f2(_0x4614e9,_0x3384('0x5b')))['then'](function(){})[_0x3384('0x2f')](_0x207f31()));}}return _0x1a2b21;})[_0x3384('0x54')]();})[_0x3384('0x2f')](function(_0x4f0ade){logger['error'](_0x3384('0x5c'),'generalCheckHopper',_0x4f0ade[_0x3384('0x1b')]);});}var processPromises=function(_0x349d69){return BPromise[_0x3384('0x54')](promises)[_0x3384('0x2c')](function(_0xbdab47){})['catch'](function(_0x499ee8){logger[_0x3384('0x13')](_0x3384('0x5d'),JSON[_0x3384('0x30')](_0x499ee8));})['finally'](function(){socket['emit'](_0x3384('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x349d69){return _0x349d69[_0x3384('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3384('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x3384('0x2c')](function(){socket[_0x3384('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3384('0x61')](FILEPATH);}catch(_0x49c600){logger['error'](_0x3384('0x62'),JSON[_0x3384('0x30')](_0x49c600));}finally{process[_0x3384('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0x3384('0x64')](_0x3384('0x65'));endCsv();});function main(){return BPromise[_0x3384('0x66')]()[_0x3384('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3384('0x10')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3384('0x2c')](function(_0x254362){var _0x1b8d15=fs[_0x3384('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3384('0x68')](_0x1b8d15,{'header':!![],'skipEmptyLines':!![],'step':function(_0x276661,_0x3d36fd){total+=0x1;var _0x4ff0f2=total;promises[_0x3384('0x2d')](checkRow(_0x276661,_0x254362,_0x4ff0f2)['then'](function(){success+=0x1;})[_0x3384('0x2f')](function(_0x436691){if(_0x436691[_0x3384('0x13')]){errors+=0x1;delete _0x436691[_0x3384('0x13')];}else if(_0x436691[_0x3384('0x27')]){duplicates+=0x1;delete _0x436691[_0x3384('0x27')];}rows[_0x3384('0x2d')](_0x436691);}));if(total%0xc8===0x0){_0x3d36fd[_0x3384('0x69')]();return processPromises(_0x3d36fd);}},'complete':function(){return processPromises()[_0x3384('0x2c')](function(){logger[_0x3384('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x4b7b3d,_0x4525d1){logger[_0x3384('0x64')](_0x3384('0x6a'),JSON[_0x3384('0x30')](_0x4b7b3d));endCsv();}});})[_0x3384('0x2f')](function(_0xb15a46){logger[_0x3384('0x13')](_0x3384('0x6b'),JSON['stringify'](_0xb15a46));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d144e88..a29de9c 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 _0xf707=['redis','defaults','localhost','socket.io-emitter','format','test','select','field','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22always\x22','toString','fields','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','from','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','message','sequelize','query','push','catch','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','length','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','import'];(function(_0x3fde79,_0x11e979){var _0x4f4edb=function(_0x48db64){while(--_0x48db64){_0x3fde79['push'](_0x3fde79['shift']());}};_0x4f4edb(++_0x11e979);}(_0xf707,0xf1));var _0x7f70=function(_0x3596ab,_0x3b30bf){_0x3596ab=_0x3596ab-0x0;var _0x37682c=_0xf707[_0x3596ab];return _0x37682c;};'use strict';var fs=require('fs');var path=require(_0x7f70('0x0'));var _=require(_0x7f70('0x1'));var Papa=require(_0x7f70('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x7f70('0x3'));var squel=require(_0x7f70('0x4'));var Redis=require(_0x7f70('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x7f70('0x6'));config[_0x7f70('0x7')]=_[_0x7f70('0x8')](config[_0x7f70('0x7')],{'host':_0x7f70('0x9'),'port':0x18eb});var socket=require(_0x7f70('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7f70('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x401ea8){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))*$/[_0x7f70('0xc')](_0x401ea8);}function selectNotIn(_0x39c85d,_0x5ee807,_0x468ac3,_0x31acea,_0x1c4dfc){return squel[_0x7f70('0xd')]()[_0x7f70('0xe')]('phone')['from'](_0x31acea)[_0x7f70('0xf')](_0x5ee807,null,_0x5ee807+_0x7f70('0x10')+_0x31acea+'.'+_0x468ac3)[_0x7f70('0x11')](_0x31acea+'.'+_0x468ac3+'\x20=\x20'+_0x39c85d+'.'+_0x468ac3)[_0x7f70('0x11')](_0x5ee807+_0x7f70('0x12')+_0x1c4dfc['join']()+')');}function insertCmHopper(_0x415044,_0x834338,_0xef9ef7,_0x35f162,_0xb0b610){var _0x1b6bbb=['cm_contacts.phone','cm_contacts.scheduledat',_0x7f70('0x13'),_0x7f70('0x14'),_0x834338+'.'+_0x35f162,_0x7f70('0x15'),_0x7f70('0x16'),_0x7f70('0x17'),'cm_contacts.UserId','\x22'+_0xb0b610+'\x22'];return squel[_0x7f70('0x18')]()[_0x7f70('0x19')](_0x7f70('0x1a'))[_0x7f70('0x1b')]([_0x7f70('0x1c'),_0x7f70('0x1d'),_0x7f70('0x1e'),_0x7f70('0x1f'),_0x35f162,_0x7f70('0x20'),_0x7f70('0x21'),_0x7f70('0x22'),_0x7f70('0x23'),_0x7f70('0x24')],squel[_0x7f70('0xd')]()['fields'](_0x1b6bbb)['from'](_0x834338)[_0x7f70('0xf')](_0x7f70('0x25'),null,_0x7f70('0x26')+_0x834338+'.CmListId')[_0x7f70('0xf')](_0xef9ef7,null,_0xef9ef7+'.id\x20=\x20'+_0x834338+'.'+_0x35f162)[_0x7f70('0x11')](_0x834338+'.CmListId\x20=\x20?',_0x415044)[_0x7f70('0x11')](_0x7f70('0x27'),NOW)[_0x7f70('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x834338,_0xef9ef7,_0x35f162,_0x7f70('0x1a'),[_0x7f70('0x28'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x834338,_0xef9ef7,_0x35f162,_0x7f70('0x1a'),[_0x7f70('0x28')])))[_0x7f70('0x29')]();}function insertCmHopperBlack(_0x266777,_0x13aefc,_0x2e45d5,_0x3f9005){var _0x79c03d=['cm_contacts.phone',_0x7f70('0x13'),_0x7f70('0x14'),_0x13aefc+'.'+_0x3f9005,_0x7f70('0x15'),'cm_contacts.updatedAt'];return squel['insert']()['into']('cm_hopper_black')[_0x7f70('0x1b')]([_0x7f70('0x1c'),_0x7f70('0x1e'),_0x7f70('0x1f'),_0x3f9005,_0x7f70('0x20'),'updatedAt'],squel[_0x7f70('0xd')]()[_0x7f70('0x2a')](_0x79c03d)['from'](_0x13aefc)['join']('cm_contacts',null,_0x7f70('0x26')+_0x13aefc+'.CmListId')[_0x7f70('0xf')](_0x2e45d5,null,_0x2e45d5+'.id\x20=\x20'+_0x13aefc+'.'+_0x3f9005)['where'](_0x13aefc+_0x7f70('0x2b'),_0x266777)[_0x7f70('0x11')](_0x7f70('0x27'),NOW)[_0x7f70('0x11')](_0x7f70('0x2c'),squel['select']()['field'](_0x7f70('0x1c'))[_0x7f70('0x2d')]('cm_hopper_black')['where'](_0x7f70('0x2e'),_0x266777)['where'](_0x3f9005+_0x7f70('0x2f'),_0x13aefc+'.'+_0x3f9005)))[_0x7f70('0x29')]();}function insertCmContact(_0x3aa7d2,_0x142033,_0x5163db,_0xf614b7){var _0x482bd6=_[_0x7f70('0x30')](_[_0x7f70('0x31')](_0xf614b7),[_0x7f70('0x1f'),_0x7f70('0x32'),_0x7f70('0x20'),_0x7f70('0x21')]);return squel[_0x7f70('0x18')]()[_0x7f70('0x19')](_0x7f70('0x25'))[_0x7f70('0x1b')](_0x482bd6,squel[_0x7f70('0xd')]()[_0x7f70('0x2a')](_0x482bd6)[_0x7f70('0x2d')](_0x142033)['where']('('+_0x5163db[_0x7f70('0xf')](',')+_0x7f70('0x33'),squel[_0x7f70('0xd')]()[_0x7f70('0x2a')](_0x5163db)[_0x7f70('0x2d')](_0x7f70('0x25'))['where']('ListId\x20=\x20?',_0x3aa7d2)[_0x7f70('0x11')](_0x7f70('0x34')))[_0x7f70('0x11')](_0x7f70('0x35'),squel[_0x7f70('0xd')]()[_0x7f70('0xe')](_0x7f70('0x36'),_0x7f70('0x37'))[_0x7f70('0x2d')](_0x142033)[_0x7f70('0x38')](_0x5163db[_0x7f70('0xf')](','))))[_0x7f70('0x29')]();}function handleStop(){logger[_0x7f70('0x39')](_0x7f70('0x3a'));stopped=!![];}function handleUncaughtException(_0x2ce438){logger[_0x7f70('0x3b')](_0x2ce438['message']);process[_0x7f70('0x3c')](0x1);}function handleError(_0x4dd4cf,_0x4a68a6){stats[_0x7f70('0x3d')]['push']({'name':_0x4a68a6['code'],'message':_0x4a68a6[_0x7f70('0x3e')],'row':_0x4dd4cf});}function handleQuery(_0x4b7252){logger[_0x7f70('0x39')](_0x4b7252);return db[_0x7f70('0x3f')][_0x7f70('0x40')](_0x4b7252)['spread'](function(_0x4c06a4){results[_0x7f70('0x41')](_0x4c06a4);})[_0x7f70('0x42')](function(_0x124e7e){logger[_0x7f70('0x3b')](_0x124e7e[_0x7f70('0x3e')]);});}function main(_0x4a4a73,_0x47ad8f,_0x329c03,_0x19ce64){logger[_0x7f70('0x39')](_0x7f70('0x43'),_0x4a4a73,JSON[_0x7f70('0x44')](_0x47ad8f));process[_0x7f70('0x45')]('start');var _0x3e9bb2=_0x47ad8f[_0x7f70('0x46')];var _0x42e053=_0x47ad8f[_0x7f70('0x47')];var _0x245786=path['join'](config[_0x7f70('0x48')],_0x7f70('0x49'),_0x42e053+_0x7f70('0x4a'));var _0x3f9131=_[_0x7f70('0x31')](_0x3e9bb2)[_0x7f70('0xf')]();logger[_0x7f70('0x39')]('header',_0x3f9131);fs['writeFileSync'](_0x245786,_0x3f9131+'\x0a');Papa['parse'](fs['createReadStream'](_0x4a4a73),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5aa4f1,_0x5a2d68){try{for(var _0xa253d9=0x0,_0x57a5dc=[];_0xa253d9<_0x5aa4f1['data']['length'];_0xa253d9++){stats[_0x7f70('0x4b')]+=0x1;if(_0x5aa4f1['errors'][_0xa253d9]){handleError(_0x5aa4f1[_0x7f70('0x4c')][_0xa253d9],_0x5aa4f1[_0x7f70('0x3d')][_0xa253d9]);}else{var _0x289429=[];for(var _0x7f5c7 in _0x3e9bb2){if(_0x3e9bb2[_0x7f70('0x4d')](_0x7f5c7)){if(_0x5aa4f1[_0x7f70('0x4c')][_0xa253d9][_0x3e9bb2[_0x7f5c7]]){var _0x5866dd=_[_0x7f70('0x4e')](_0x5aa4f1[_0x7f70('0x4c')][_0xa253d9][_0x3e9bb2[_0x7f5c7]][_0x7f70('0x4f')](/"/g,'\x27'));switch(_0x7f5c7){case _0x7f70('0x1d'):var _0x1e21c3=moment(_0x5866dd,_0x7f70('0x50'),!![]);if(_0x1e21c3[_0x7f70('0x51')]()){_0x57a5dc['push']('\x22'+_0x5866dd+'\x22');}else{_0x289429[_0x7f70('0x41')](_0x7f70('0x52'));}break;case _0x7f70('0x22'):var _0x55b586=parseInt(_0x5866dd);_0x5866dd=_[_0x7f70('0x53')](_0x55b586)||_0x55b586<0x0||_0x55b586>0x4?_0x19ce64?0x3:0x2:_0x55b586;_0x57a5dc[_0x7f70('0x41')]('\x22'+_0x5866dd+'\x22');break;case'UserId':var _0x182d46=parseInt(_0x5866dd);if(_[_0x7f70('0x54')](_0x182d46)&&_[_0x7f70('0x55')](_0x329c03,_0x182d46)){_0x57a5dc[_0x7f70('0x41')]('\x22'+_0x182d46+'\x22');}else{_0x289429[_0x7f70('0x41')](_0x7f70('0x56'));}break;case'email':if(isEmail(_0x5866dd)){_0x57a5dc[_0x7f70('0x41')]('\x22'+_0x5866dd+'\x22');}else{_0x289429['push'](_0x7f70('0x57'));}break;case _0x7f70('0x58'):var _0x3aa45d=moment(_0x5866dd,'YYYY-MM-DD',!![]);if(_0x3aa45d['isValid']()){_0x57a5dc[_0x7f70('0x41')]('\x22'+_0x5866dd+'\x22');}else{_0x289429[_0x7f70('0x41')](_0x7f70('0x59'));}break;default:_0x57a5dc['push']('\x22'+_0x5866dd+'\x22');}}else{switch(_0x7f5c7){case'firstName':case _0x7f70('0x1c'):_0x289429[_0x7f70('0x41')](_0x7f5c7+_0x7f70('0x5a'));break;default:_0x57a5dc[_0x7f70('0x41')]('\x22\x22');}}}}if(_0x289429[_0x7f70('0x5b')]){handleError(_0x5aa4f1[_0x7f70('0x4c')][_0xa253d9],{'code':_0x7f70('0x5c'),'message':_0x289429[_0x7f70('0xf')]()});}else{fs['appendFileSync'](_0x245786,_0x57a5dc[_0x7f70('0xf')]()+'\x0a');}_0x57a5dc=[];}if(!(stats[_0x7f70('0x4b')]%0xc8)){socket[_0x7f70('0x5d')](_0x7f70('0x5e')+_0x42e053,stats);stats[_0x7f70('0x3d')]=[];}}if(stopped){logger[_0x7f70('0x39')](_0x7f70('0x5f'));_0x5a2d68[_0x7f70('0x60')]();}}catch(_0x182929){handleError(_0x5aa4f1[_0x7f70('0x4c')][_0xa253d9],{'code':_0x7f70('0x61'),'message':_0x182929[_0x7f70('0x3e')]});logger[_0x7f70('0x3b')]('step',_0x182929[_0x7f70('0x3e')]);}},'complete':function(){try{var _0x154daa=[];var _0x4fbb89=_0x7f70('0x25');if(_0x47ad8f[_0x7f70('0x62')]&&_0x47ad8f[_0x7f70('0x62')][_0x7f70('0x5b')]){_0x4fbb89=_0x7f70('0x63')+_0x42e053;_0x154daa[_0x7f70('0x41')](_0x7f70('0x64')+_0x4fbb89+'\x20LIKE\x20cm_contacts;');}var _0x31f6c7=util['format']('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',_0x245786,_0x4fbb89,_0x3f9131,_0x47ad8f[_0x7f70('0x1f')],_0x47ad8f[_0x7f70('0x32')]||null,NOW,NOW);if(_[_0x7f70('0x65')](_0x3e9bb2[_0x7f70('0x1d')])){_0x31f6c7+=_0x7f70('0x66');}_0x154daa[_0x7f70('0x41')](_0x31f6c7);if(_0x47ad8f['duplicates']&&_0x47ad8f[_0x7f70('0x62')][_0x7f70('0x5b')]){_0x154daa['push'](insertCmContact(_0x47ad8f[_0x7f70('0x1f')],_0x4fbb89,_0x47ad8f['duplicates'],_0x3e9bb2));_0x154daa['push']('DROP\x20TABLE\x20'+_0x4fbb89+';');}_0x154daa['push'](insertCmHopper(_0x47ad8f[_0x7f70('0x1f')],'voice_queues_has_cm_lists',_0x7f70('0x67'),_0x7f70('0x68'),_0x19ce64));_0x154daa[_0x7f70('0x41')](insertCmHopperBlack(_0x47ad8f[_0x7f70('0x1f')],_0x7f70('0x69'),_0x7f70('0x67'),_0x7f70('0x68')));_0x154daa[_0x7f70('0x41')](insertCmHopper(_0x47ad8f['ListId'],'campaigns_has_cm_lists','campaigns',_0x7f70('0x6a'),_0x19ce64));_0x154daa['push'](insertCmHopperBlack(_0x47ad8f[_0x7f70('0x1f')],_0x7f70('0x6b'),_0x7f70('0x6c'),'CampaignId'));BPromise['each'](_0x154daa,handleQuery)['then'](function(_0x56455c){stats[_0x7f70('0x6d')]=!![];stats[_0x7f70('0x6e')]=_0x47ad8f[_0x7f70('0x62')]&&_0x47ad8f[_0x7f70('0x62')]['length']?results[0x2][_0x7f70('0x6e')]:results[0x0]['affectedRows'];socket[_0x7f70('0x5d')]('contact:import:'+_0x42e053,stats);fs[_0x7f70('0x6f')](_0x4a4a73);fs[_0x7f70('0x6f')](_0x245786);process[_0x7f70('0x3c')](0x0);})[_0x7f70('0x42')](function(_0x18e7bf){logger[_0x7f70('0x3b')](_0x18e7bf[_0x7f70('0x3e')]);process[_0x7f70('0x3c')](0x1);});}catch(_0x27754c){logger[_0x7f70('0x3b')](_0x7f70('0x70'),_0x27754c['message']);process['exit'](0x1);}},'error':function(_0x1765e1,_0x3c433d,_0x1bfa5d,_0x3cda74){throw new Error(_0x3cda74);}});}function validate(){if(process[_0x7f70('0x71')]&&process[_0x7f70('0x71')][_0x7f70('0x5b')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x40a045=path[_0x7f70('0xf')](config['root'],_0x7f70('0x49'),process['argv'][0x2]);if(!fs[_0x7f70('0x72')](_0x40a045)){throw new Error(_0x7f70('0x73'));}var _0x43ce0d={};try{_0x43ce0d=JSON[_0x7f70('0x74')](process['argv'][0x3]);if(!_0x43ce0d[_0x7f70('0x46')]){throw new Error(_0x7f70('0x75'));}if(!_0x43ce0d['binding'][_0x7f70('0x1c')]){throw new Error(_0x7f70('0x76'));}if(!_0x43ce0d[_0x7f70('0x46')]['firstName']){throw new Error(_0x7f70('0x77'));}var _0xa8ba66=0x0;if(_0x43ce0d[_0x7f70('0x46')][_0x7f70('0x23')]){_0xa8ba66=0x1;}if(!_0x43ce0d['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x469e2d){throw new Error('body\x20id\x20mandatory');}var _0x5eb79e=[];try{_0x5eb79e=_[_0x7f70('0x78')](JSON['parse'](process[_0x7f70('0x71')][0x4]),'id');}catch(_0x5253cf){logger[_0x7f70('0x39')](_0x7f70('0x79'));}main(_0x40a045,_0x43ce0d,_0x5eb79e,_0xa8ba66);}validate();process['on'](_0x7f70('0x7a'),handleStop);process['on'](_0x7f70('0x7b'),handleUncaughtException); \ No newline at end of file +var _0xa5d1=['existsSync','file\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','toString','cm_hopper_black','updatedAt','fields','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','concat','keys','CompanyId','createdAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','push','code','sequelize','query','spread','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','header','writeFileSync','parse','createReadStream','length','rows','hasOwnProperty','data','replace','isValid','isNaN','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns','then','finish','affectedRows','unlink','catch','argv','arguments\x20\x20\x20','root'];(function(_0x14fa80,_0x1bd796){var _0x5dd840=function(_0x355dd1){while(--_0x355dd1){_0x14fa80['push'](_0x14fa80['shift']());}};_0x5dd840(++_0x1bd796);}(_0xa5d1,0xff));var _0x1a5d=function(_0x566335,_0x3398d2){_0x566335=_0x566335-0x0;var _0x5e9504=_0xa5d1[_0x566335];return _0x5e9504;};'use strict';var fs=require('fs');var path=require(_0x1a5d('0x0'));var _=require(_0x1a5d('0x1'));var Papa=require(_0x1a5d('0x2'));var util=require('util');var BPromise=require(_0x1a5d('0x3'));var moment=require(_0x1a5d('0x4'));var squel=require(_0x1a5d('0x5'));var Redis=require(_0x1a5d('0x6'));var db=require(_0x1a5d('0x7'))['db'];var config=require(_0x1a5d('0x8'));var logger=require(_0x1a5d('0x9'))('import');config[_0x1a5d('0xa')]=_['defaults'](config[_0x1a5d('0xa')],{'host':_0x1a5d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a5d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x1a5d('0xc')](_0x1a5d('0xd'));function isEmail(_0x4ff53c){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))*$/[_0x1a5d('0xe')](_0x4ff53c);}function selectNotIn(_0x378afc,_0x21a230,_0x572975,_0x1b142d,_0x5bb270){return squel[_0x1a5d('0xf')]()[_0x1a5d('0x10')](_0x1a5d('0x11'))[_0x1a5d('0x12')](_0x1b142d)[_0x1a5d('0x13')](_0x21a230,null,_0x21a230+_0x1a5d('0x14')+_0x1b142d+'.'+_0x572975)[_0x1a5d('0x15')](_0x1b142d+'.'+_0x572975+'\x20=\x20'+_0x378afc+'.'+_0x572975)[_0x1a5d('0x15')](_0x21a230+_0x1a5d('0x16')+_0x5bb270['join']()+')');}function insertCmHopper(_0xe1e033,_0x23121f,_0x36ef1e,_0x55a56d,_0x540638){var _0x3d85e0=[_0x1a5d('0x17'),_0x1a5d('0x18'),_0x1a5d('0x19'),_0x1a5d('0x1a'),_0x23121f+'.'+_0x55a56d,_0x1a5d('0x1b'),_0x1a5d('0x1c'),_0x1a5d('0x1d'),_0x1a5d('0x1e'),'\x22'+_0x540638+'\x22'];return squel[_0x1a5d('0x1f')]()[_0x1a5d('0x20')](_0x1a5d('0x21'))[_0x1a5d('0x22')]([_0x1a5d('0x11'),_0x1a5d('0x23'),_0x1a5d('0x24'),_0x1a5d('0x25'),_0x55a56d,'createdAt','updatedAt','priority',_0x1a5d('0x26'),_0x1a5d('0x27')],squel[_0x1a5d('0xf')]()['fields'](_0x3d85e0)[_0x1a5d('0x12')](_0x23121f)[_0x1a5d('0x13')](_0x1a5d('0x28'),null,_0x1a5d('0x29')+_0x23121f+'.CmListId')['join'](_0x36ef1e,null,_0x36ef1e+_0x1a5d('0x14')+_0x23121f+'.'+_0x55a56d)[_0x1a5d('0x15')](_0x23121f+_0x1a5d('0x2a'),_0xe1e033)['where'](_0x1a5d('0x2b'),NOW)[_0x1a5d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x23121f,_0x36ef1e,_0x55a56d,_0x1a5d('0x21'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x1a5d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x23121f,_0x36ef1e,_0x55a56d,_0x1a5d('0x21'),[_0x1a5d('0x2c')])))[_0x1a5d('0x2d')]();}function insertCmHopperBlack(_0x11cf88,_0x4b6aea,_0x4811a1,_0x527ea5){var _0x49c33a=['cm_contacts.phone',_0x1a5d('0x19'),_0x1a5d('0x1a'),_0x4b6aea+'.'+_0x527ea5,_0x1a5d('0x1b'),'cm_contacts.updatedAt'];return squel[_0x1a5d('0x1f')]()[_0x1a5d('0x20')](_0x1a5d('0x2e'))[_0x1a5d('0x22')]([_0x1a5d('0x11'),_0x1a5d('0x24'),_0x1a5d('0x25'),_0x527ea5,'createdAt',_0x1a5d('0x2f')],squel[_0x1a5d('0xf')]()[_0x1a5d('0x30')](_0x49c33a)[_0x1a5d('0x12')](_0x4b6aea)[_0x1a5d('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4b6aea+'.CmListId')[_0x1a5d('0x13')](_0x4811a1,null,_0x4811a1+_0x1a5d('0x14')+_0x4b6aea+'.'+_0x527ea5)[_0x1a5d('0x15')](_0x4b6aea+_0x1a5d('0x2a'),_0x11cf88)['where'](_0x1a5d('0x2b'),NOW)[_0x1a5d('0x15')](_0x1a5d('0x31'),squel['select']()[_0x1a5d('0x10')](_0x1a5d('0x11'))[_0x1a5d('0x12')](_0x1a5d('0x2e'))['where'](_0x1a5d('0x32'),_0x11cf88)['where'](_0x527ea5+'\x20=\x20?',_0x4b6aea+'.'+_0x527ea5)))[_0x1a5d('0x2d')]();}function insertCmContact(_0x2b924c,_0x2c6ca0,_0x5716f8,_0xea74bc){var _0x37ea34=_[_0x1a5d('0x33')](_[_0x1a5d('0x34')](_0xea74bc),[_0x1a5d('0x25'),_0x1a5d('0x35'),_0x1a5d('0x36'),_0x1a5d('0x2f')]);return squel[_0x1a5d('0x1f')]()[_0x1a5d('0x20')](_0x1a5d('0x28'))['fromQuery'](_0x37ea34,squel[_0x1a5d('0xf')]()[_0x1a5d('0x30')](_0x37ea34)[_0x1a5d('0x12')](_0x2c6ca0)[_0x1a5d('0x15')]('('+_0x5716f8['join'](',')+_0x1a5d('0x37'),squel[_0x1a5d('0xf')]()['fields'](_0x5716f8)[_0x1a5d('0x12')](_0x1a5d('0x28'))[_0x1a5d('0x15')](_0x1a5d('0x32'),_0x2b924c)[_0x1a5d('0x15')](_0x1a5d('0x38')))[_0x1a5d('0x15')](_0x1a5d('0x39'),squel[_0x1a5d('0xf')]()[_0x1a5d('0x10')](_0x1a5d('0x3a'),_0x1a5d('0x3b'))[_0x1a5d('0x12')](_0x2c6ca0)[_0x1a5d('0x3c')](_0x5716f8[_0x1a5d('0x13')](','))))[_0x1a5d('0x2d')]();}function handleStop(){logger[_0x1a5d('0x3d')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x395922){logger[_0x1a5d('0x3e')](_0x395922[_0x1a5d('0x3f')]);process[_0x1a5d('0x40')](0x1);}function handleError(_0x4c9caa,_0x347fa9){stats[_0x1a5d('0x41')][_0x1a5d('0x42')]({'name':_0x347fa9[_0x1a5d('0x43')],'message':_0x347fa9['message'],'row':_0x4c9caa});}function handleQuery(_0x4305f0){logger['info'](_0x4305f0);return db[_0x1a5d('0x44')][_0x1a5d('0x45')](_0x4305f0)[_0x1a5d('0x46')](function(_0xebb67c){results['push'](_0xebb67c);})['catch'](function(_0x439029){logger['error'](_0x439029[_0x1a5d('0x3f')]);});}function main(_0x15e175,_0x20a06d,_0x225914,_0x109efc){logger[_0x1a5d('0x3d')](_0x1a5d('0x47'),_0x15e175,JSON[_0x1a5d('0x48')](_0x20a06d));process[_0x1a5d('0x49')](_0x1a5d('0x4a'));var _0x159908=_0x20a06d[_0x1a5d('0x4b')];var _0x7dfb4b=_0x20a06d[_0x1a5d('0x4c')];var _0x3d3897=path[_0x1a5d('0x13')](config['root'],_0x1a5d('0x4d'),_0x7dfb4b+'.csv');var _0x23ff91=_[_0x1a5d('0x34')](_0x159908)[_0x1a5d('0x13')]();logger['info'](_0x1a5d('0x4e'),_0x23ff91);fs[_0x1a5d('0x4f')](_0x3d3897,_0x23ff91+'\x0a');Papa[_0x1a5d('0x50')](fs[_0x1a5d('0x51')](_0x15e175),{'header':!![],'skipEmptyLines':!![],'step':function(_0x376ebf,_0x454fd5){try{for(var _0x167c49=0x0,_0x1f0004=[];_0x167c49<_0x376ebf['data'][_0x1a5d('0x52')];_0x167c49++){stats[_0x1a5d('0x53')]+=0x1;if(_0x376ebf[_0x1a5d('0x41')][_0x167c49]){handleError(_0x376ebf['data'][_0x167c49],_0x376ebf[_0x1a5d('0x41')][_0x167c49]);}else{var _0x20510f=[];for(var _0x137783 in _0x159908){if(_0x159908[_0x1a5d('0x54')](_0x137783)){if(_0x376ebf['data'][_0x167c49][_0x159908[_0x137783]]){var _0x27bbf7=_['trim'](_0x376ebf[_0x1a5d('0x55')][_0x167c49][_0x159908[_0x137783]][_0x1a5d('0x56')](/"/g,'\x27'));switch(_0x137783){case _0x1a5d('0x23'):var _0x4fe704=moment(_0x27bbf7,_0x1a5d('0xd'),!![]);if(_0x4fe704[_0x1a5d('0x57')]()){_0x1f0004[_0x1a5d('0x42')]('\x22'+_0x27bbf7+'\x22');}else{_0x20510f[_0x1a5d('0x42')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x706dd=parseInt(_0x27bbf7);_0x27bbf7=_[_0x1a5d('0x58')](_0x706dd)||_0x706dd<0x0||_0x706dd>0x4?_0x109efc?0x3:0x2:_0x706dd;_0x1f0004['push']('\x22'+_0x27bbf7+'\x22');break;case _0x1a5d('0x26'):var _0x47870e=parseInt(_0x27bbf7);if(_['isNumber'](_0x47870e)&&_[_0x1a5d('0x59')](_0x225914,_0x47870e)){_0x1f0004[_0x1a5d('0x42')]('\x22'+_0x47870e+'\x22');}else{_0x20510f[_0x1a5d('0x42')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x27bbf7)){_0x1f0004[_0x1a5d('0x42')]('\x22'+_0x27bbf7+'\x22');}else{_0x20510f[_0x1a5d('0x42')](_0x1a5d('0x5a'));}break;case _0x1a5d('0x5b'):var _0x4b1b9e=moment(_0x27bbf7,_0x1a5d('0x5c'),!![]);if(_0x4b1b9e['isValid']()){_0x1f0004['push']('\x22'+_0x27bbf7+'\x22');}else{_0x20510f[_0x1a5d('0x42')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1f0004['push']('\x22'+_0x27bbf7+'\x22');}}else{switch(_0x137783){case _0x1a5d('0x5d'):case'phone':_0x20510f['push'](_0x137783+'\x20not\x20specified');break;default:_0x1f0004[_0x1a5d('0x42')]('\x22\x22');}}}}if(_0x20510f[_0x1a5d('0x52')]){handleError(_0x376ebf[_0x1a5d('0x55')][_0x167c49],{'code':_0x1a5d('0x5e'),'message':_0x20510f[_0x1a5d('0x13')]()});}else{fs['appendFileSync'](_0x3d3897,_0x1f0004['join']()+'\x0a');}_0x1f0004=[];}if(!(stats[_0x1a5d('0x53')]%0xc8)){socket[_0x1a5d('0x5f')](_0x1a5d('0x60')+_0x7dfb4b,stats);stats[_0x1a5d('0x41')]=[];}}if(stopped){logger['info'](_0x1a5d('0x61'));_0x454fd5[_0x1a5d('0x62')]();}}catch(_0x144d30){handleError(_0x376ebf[_0x1a5d('0x55')][_0x167c49],{'code':'SystemError','message':_0x144d30[_0x1a5d('0x3f')]});logger[_0x1a5d('0x3e')](_0x1a5d('0x63'),_0x144d30[_0x1a5d('0x3f')]);}},'complete':function(){try{var _0x4ab0bb=[];var _0x1232f8=_0x1a5d('0x28');if(_0x20a06d[_0x1a5d('0x64')]&&_0x20a06d['duplicates'][_0x1a5d('0x52')]){_0x1232f8=_0x1a5d('0x65')+_0x7dfb4b;_0x4ab0bb['push']('CREATE\x20TABLE\x20'+_0x1232f8+_0x1a5d('0x66'));}var _0x20df82=util['format']('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',_0x3d3897,_0x1232f8,_0x23ff91,_0x20a06d[_0x1a5d('0x25')],_0x20a06d[_0x1a5d('0x35')]||null,NOW,NOW);if(_[_0x1a5d('0x67')](_0x159908[_0x1a5d('0x23')])){_0x20df82+=_0x1a5d('0x68');}_0x4ab0bb[_0x1a5d('0x42')](_0x20df82);if(_0x20a06d[_0x1a5d('0x64')]&&_0x20a06d[_0x1a5d('0x64')][_0x1a5d('0x52')]){_0x4ab0bb[_0x1a5d('0x42')](insertCmContact(_0x20a06d[_0x1a5d('0x25')],_0x1232f8,_0x20a06d[_0x1a5d('0x64')],_0x159908));_0x4ab0bb[_0x1a5d('0x42')](_0x1a5d('0x69')+_0x1232f8+';');}_0x4ab0bb['push'](insertCmHopper(_0x20a06d['ListId'],'voice_queues_has_cm_lists',_0x1a5d('0x6a'),_0x1a5d('0x6b'),_0x109efc));_0x4ab0bb[_0x1a5d('0x42')](insertCmHopperBlack(_0x20a06d['ListId'],_0x1a5d('0x6c'),_0x1a5d('0x6a'),'VoiceQueueId'));_0x4ab0bb[_0x1a5d('0x42')](insertCmHopper(_0x20a06d[_0x1a5d('0x25')],_0x1a5d('0x6d'),'campaigns',_0x1a5d('0x6e'),_0x109efc));_0x4ab0bb[_0x1a5d('0x42')](insertCmHopperBlack(_0x20a06d[_0x1a5d('0x25')],'campaigns_has_cm_blacklists',_0x1a5d('0x6f'),'CampaignId'));BPromise['each'](_0x4ab0bb,handleQuery)[_0x1a5d('0x70')](function(_0xe66afd){stats[_0x1a5d('0x71')]=!![];stats[_0x1a5d('0x72')]=_0x20a06d['duplicates']&&_0x20a06d[_0x1a5d('0x64')][_0x1a5d('0x52')]?results[0x2][_0x1a5d('0x72')]:results[0x0][_0x1a5d('0x72')];socket[_0x1a5d('0x5f')](_0x1a5d('0x60')+_0x7dfb4b,stats);fs[_0x1a5d('0x73')](_0x15e175);fs[_0x1a5d('0x73')](_0x3d3897);process['exit'](0x0);})[_0x1a5d('0x74')](function(_0x2902c6){logger[_0x1a5d('0x3e')](_0x2902c6['message']);process[_0x1a5d('0x40')](0x1);});}catch(_0x29f911){logger['error']('complete',_0x29f911[_0x1a5d('0x3f')]);process['exit'](0x1);}},'error':function(_0x348793,_0x450589,_0x1a7b06,_0x56d5fc){throw new Error(_0x56d5fc);}});}function validate(){if(process[_0x1a5d('0x75')]&&process[_0x1a5d('0x75')][_0x1a5d('0x52')]<0x4){throw new Error(_0x1a5d('0x76'));}var _0xc4042a=path[_0x1a5d('0x13')](config[_0x1a5d('0x77')],_0x1a5d('0x4d'),process[_0x1a5d('0x75')][0x2]);if(!fs[_0x1a5d('0x78')](_0xc4042a)){throw new Error(_0x1a5d('0x79'));}var _0x58686d={};try{_0x58686d=JSON[_0x1a5d('0x50')](process[_0x1a5d('0x75')][0x3]);if(!_0x58686d[_0x1a5d('0x4b')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x58686d['binding'][_0x1a5d('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x58686d[_0x1a5d('0x4b')][_0x1a5d('0x5d')]){throw new Error(_0x1a5d('0x7a'));}var _0x5451c7=0x0;if(_0x58686d[_0x1a5d('0x4b')]['UserId']){_0x5451c7=0x1;}if(!_0x58686d['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x55f45e){throw new Error('body\x20id\x20mandatory');}var _0x3f16a9=[];try{_0x3f16a9=_[_0x1a5d('0x7b')](JSON[_0x1a5d('0x50')](process['argv'][0x4]),'id');}catch(_0xe41e96){logger['info'](_0x1a5d('0x7c'));}main(_0xc4042a,_0x58686d,_0x3f16a9,_0x5451c7);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index ac7a66f..b60b9c5 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 _0x38f6=['talktime','Called\x20Number','Member\x20Name','membername','Date','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','voice','inbound','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','queue','UniqueId','uniqueid','agentcalledAt','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x38f6,0x90));var _0x638f=function(_0x4cfb26,_0x181e55){_0x4cfb26=_0x4cfb26-0x0;var _0x524ff6=_0x38f6[_0x4cfb26];return _0x524ff6;};'use strict';exports['getSubjects']=function(_0x2bdd9d,_0x3e430f){var _0x247b6f=[{'type':_0x638f('0x0'),'content':_0x638f('0x1'),'variableName':null}];switch(_0x2bdd9d['toLowerCase']()){case _0x638f('0x2'):switch(_0x3e430f['toLowerCase']()){case _0x638f('0x3'):_0x247b6f[_0x638f('0x4')]({'type':_0x638f('0x5'),'content':'','variableName':'queue'});_0x247b6f[_0x638f('0x4')]({'type':_0x638f('0x5'),'content':'','variableName':_0x638f('0x6')});break;case _0x638f('0x7'):_0x247b6f[_0x638f('0x4')]({'type':_0x638f('0x0'),'content':_0x638f('0x8'),'variableName':null});_0x247b6f[_0x638f('0x4')]({'type':'variable','content':'','variableName':_0x638f('0x9')});break;}}return _0x247b6f;};exports[_0x638f('0xa')]=function(_0x1c2825,_0x131f2d){var _0x98f7de=[];switch(_0x1c2825[_0x638f('0xb')]()){case _0x638f('0x2'):switch(_0x131f2d['toLowerCase']()){case _0x638f('0x3'):_0x98f7de=[{'type':'string','content':_0x638f('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x638f('0xd'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x6')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0xf'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x10')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x11'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x12')},{'type':_0x638f('0xe'),'content':'','key':'Queue','keyType':_0x638f('0x5'),'variableName':_0x638f('0x13')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x14'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x15')},{'type':_0x638f('0xe'),'content':'','key':'Date','keyType':_0x638f('0x5'),'variableName':_0x638f('0x16')},{'type':_0x638f('0x0'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x638f('0xe'),'content':'','key':'Agent\x20Name','keyType':_0x638f('0x5'),'variableName':_0x638f('0x17')},{'type':'keyValue','content':'','key':_0x638f('0x18'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x9')},{'type':_0x638f('0x0'),'content':_0x638f('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x638f('0x1a'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x16')},{'type':'keyValue','content':'','key':_0x638f('0x1b'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x1c')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x1d'),'keyType':_0x638f('0x5'),'variableName':_0x638f('0x1e')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x1f'),'keyType':_0x638f('0x5'),'variableName':'holdtime'},{'type':_0x638f('0xe'),'content':'','key':'Talk\x20Time','keyType':_0x638f('0x5'),'variableName':_0x638f('0x20')}];break;case _0x638f('0x7'):_0x98f7de=[{'type':_0x638f('0x0'),'content':_0x638f('0xc'),'variableName':null},{'type':'keyValue','content':'','key':_0x638f('0x21'),'keyType':'variable','keyContent':'','variableName':_0x638f('0x9')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x22'),'keyType':_0x638f('0x5'),'keyContent':'','variableName':_0x638f('0x23')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x14'),'keyType':'variable','keyContent':'','variableName':_0x638f('0x15')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x24'),'keyType':_0x638f('0x5'),'keyContent':'','variableName':_0x638f('0x25')},{'type':_0x638f('0x0'),'content':_0x638f('0x19')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x26'),'keyType':_0x638f('0x5'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x638f('0x27'),'keyType':_0x638f('0x5'),'keyContent':'','variableName':_0x638f('0x28')},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x29'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x638f('0xe'),'content':'','key':_0x638f('0x2a'),'keyType':_0x638f('0x5'),'keyContent':'','variableName':_0x638f('0x2b')}];break;}}return _0x98f7de;}; \ No newline at end of file +var _0xcbc1=['Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','queue','push','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','calleridname','destexten','Queue','UniqueId','uniqueid','Date','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime','Answer\x20Time'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xcbc1,0x1ea));var _0x1cbc=function(_0x448c09,_0x40cacc){_0x448c09=_0x448c09-0x0;var _0x3825cd=_0xcbc1[_0x448c09];return _0x3825cd;};'use strict';exports[_0x1cbc('0x0')]=function(_0x2ac26b,_0x5f3bb1){var _0x38323f=[{'type':'string','content':_0x1cbc('0x1'),'variableName':null}];switch(_0x2ac26b[_0x1cbc('0x2')]()){case _0x1cbc('0x3'):switch(_0x5f3bb1[_0x1cbc('0x2')]()){case _0x1cbc('0x4'):_0x38323f['push']({'type':_0x1cbc('0x5'),'content':'','variableName':_0x1cbc('0x6')});_0x38323f[_0x1cbc('0x7')]({'type':_0x1cbc('0x5'),'content':'','variableName':_0x1cbc('0x8')});break;case _0x1cbc('0x9'):_0x38323f['push']({'type':_0x1cbc('0xa'),'content':_0x1cbc('0xb'),'variableName':null});_0x38323f[_0x1cbc('0x7')]({'type':_0x1cbc('0x5'),'content':'','variableName':_0x1cbc('0xc')});break;}}return _0x38323f;};exports['getDescriptions']=function(_0x5c626e,_0x1a3f17){var _0x272ff3=[];switch(_0x5c626e[_0x1cbc('0x2')]()){case _0x1cbc('0x3'):switch(_0x1a3f17[_0x1cbc('0x2')]()){case _0x1cbc('0x4'):_0x272ff3=[{'type':'string','content':_0x1cbc('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x1cbc('0xe'),'keyType':_0x1cbc('0x5'),'variableName':_0x1cbc('0x8')},{'type':_0x1cbc('0xf'),'content':'','key':'Caller\x20Name','keyType':_0x1cbc('0x5'),'variableName':_0x1cbc('0x10')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x1cbc('0x5'),'variableName':_0x1cbc('0x11')},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x12'),'keyType':_0x1cbc('0x5'),'variableName':'queue'},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x13'),'keyType':_0x1cbc('0x5'),'variableName':_0x1cbc('0x14')},{'type':'keyValue','content':'','key':_0x1cbc('0x15'),'keyType':_0x1cbc('0x5'),'variableName':'agentcalledAt'},{'type':_0x1cbc('0xa'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x16'),'keyType':_0x1cbc('0x5'),'variableName':'destcalleridname'},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x17'),'keyType':'variable','variableName':_0x1cbc('0xc')},{'type':_0x1cbc('0xa'),'content':_0x1cbc('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x19'),'keyType':_0x1cbc('0x5'),'variableName':_0x1cbc('0x1a')},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x1b'),'keyType':_0x1cbc('0x5'),'variableName':'agentconnectAt'},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x1c'),'keyType':_0x1cbc('0x5'),'variableName':_0x1cbc('0x1d')},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x1e'),'keyType':'variable','variableName':_0x1cbc('0x1f')},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x20'),'keyType':_0x1cbc('0x5'),'variableName':_0x1cbc('0x21')}];break;case _0x1cbc('0x9'):_0x272ff3=[{'type':_0x1cbc('0xa'),'content':_0x1cbc('0xd'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x1cbc('0xc')},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x22'),'keyType':_0x1cbc('0x5'),'keyContent':'','variableName':_0x1cbc('0x23')},{'type':_0x1cbc('0xf'),'content':'','key':'UniqueId','keyType':_0x1cbc('0x5'),'keyContent':'','variableName':_0x1cbc('0x14')},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x15'),'keyType':_0x1cbc('0x5'),'keyContent':'','variableName':_0x1cbc('0x24')},{'type':_0x1cbc('0xa'),'content':_0x1cbc('0x18')},{'type':'keyValue','content':'','key':_0x1cbc('0x25'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x26'),'keyType':_0x1cbc('0x5'),'keyContent':'','variableName':_0x1cbc('0x27')},{'type':'keyValue','content':'','key':_0x1cbc('0x28'),'keyType':_0x1cbc('0x5'),'keyContent':'','variableName':_0x1cbc('0x29')},{'type':_0x1cbc('0xf'),'content':'','key':_0x1cbc('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x1cbc('0x2b')}];break;}}return _0x272ff3;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index ededf22..d2c8030 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 _0xeec3=['info','tracked','user','query','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','name','role','null','Interaction','findOne','update','then'];(function(_0x19860f,_0xe4f818){var _0x550c21=function(_0x378ac0){while(--_0x378ac0){_0x19860f['push'](_0x19860f['shift']());}};_0x550c21(++_0xe4f818);}(_0xeec3,0x1ae));var _0x3eec=function(_0x3da5a1,_0x1e4e50){_0x3da5a1=_0x3da5a1-0x0;var _0x3a62ae=_0xeec3[_0x3da5a1];return _0x3a62ae;};'use strict';var _=require(_0x3eec('0x0'));var db=require(_0x3eec('0x1'))['db'];var loggers={'openchannel':require(_0x3eec('0x2'))(_0x3eec('0x3')),'mail':require(_0x3eec('0x2'))(_0x3eec('0x4')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x3eec('0x2'))(_0x3eec('0x5')),'chat':require(_0x3eec('0x2'))(_0x3eec('0x6')),'whatsapp':require(_0x3eec('0x2'))(_0x3eec('0x7'))};function getInteractionId(_0x3a07f8,_0x33b628,_0x2c144c){if(_0x3a07f8&&_0x3a07f8[_[_0x3eec('0x8')](_0x2c144c)+_0x3eec('0x9')]){return _0x3a07f8[_[_0x3eec('0x8')](_0x2c144c)+_0x3eec('0x9')];}else if(_0x3a07f8&&_0x3a07f8['id']){return _0x3a07f8['id'];}else if(_0x33b628&&_0x33b628['id']){return _0x33b628['id'];}else{return'unknown';}}function log(_0x1a4903,_0x4cae40,_0x262e6b,_0x102099,_0x5f4848,_0xd711fb){loggers[_0x5f4848[_0x3eec('0xa')]()][_0x1a4903]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd711fb['toUpperCase'](),_0x4cae40?_0x4cae40['id']:null,_0x4cae40?_0x4cae40[_0x3eec('0xb')]:null,_0x4cae40?_0x4cae40[_0x3eec('0xc')]:null,getInteractionId(_0x262e6b,_0x102099,_0x5f4848),_0x262e6b?JSON['stringify'](_0x262e6b):_0x3eec('0xd'));}function updateUser(_0x30a2d2,_0x2f225b,_0x1d6ba3,_0x446218,_0x245c65){db[_[_0x3eec('0x8')](_0x446218)+_0x3eec('0xe')][_0x3eec('0xf')]({'where':{'id':getInteractionId(_0x2f225b,_0x1d6ba3,_0x446218)}})['then'](function(_0xe6580b){if(_0xe6580b){return _0xe6580b[_0x3eec('0x10')]({'UserId':_0x30a2d2?_0x30a2d2['id']:null});}})[_0x3eec('0x11')](function(_0x4eec83){if(_0x4eec83){log(_0x3eec('0x12'),_0x30a2d2,_0x2f225b,_0x1d6ba3,_0x446218,_0x245c65);}})['catch'](function(){log('error',_0x30a2d2,_0x2f225b,_0x1d6ba3,_0x446218,_0x245c65);});}exports[_0x3eec('0x13')]=function(_0x520e6a,_0x2f016f){return function(_0xc3b7d9,_0x26d1bf,_0x1096a6){var _0x121dc5=_0xc3b7d9[_0x3eec('0x14')];var _0x30990a={};var _0x551965=_0xc3b7d9[_0x3eec('0x15')];if(_0x30990a){_0x30990a=_['clone'](_0xc3b7d9[_0x3eec('0x16')]);_0x30990a=_[_0x3eec('0x17')](_0x30990a,[_0x3eec('0x16'),_0x3eec('0x18'),_0x3eec('0x19'),_0x3eec('0x1a'),_0x3eec('0x1b')]);}updateUser(_0x121dc5,_0x30990a,_0x551965,_0x520e6a,_0x2f016f);_0x1096a6(null);};}; \ No newline at end of file +var _0xa3d2=['body','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','findOne','then','info','catch','clone'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa3d2,0x1c7));var _0x2a3d=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0xa3d2[_0x3238ea];return _0x4aaac2;};'use strict';var _=require('lodash');var db=require(_0x2a3d('0x0'))['db'];var loggers={'openchannel':require(_0x2a3d('0x1'))(_0x2a3d('0x2')),'mail':require(_0x2a3d('0x1'))(_0x2a3d('0x3')),'fax':require(_0x2a3d('0x1'))(_0x2a3d('0x4')),'sms':require('../../config/logger')(_0x2a3d('0x5')),'chat':require(_0x2a3d('0x1'))(_0x2a3d('0x6')),'whatsapp':require(_0x2a3d('0x1'))('whatsapp-interactions')};function getInteractionId(_0x14d664,_0x55a60f,_0x5682ed){if(_0x14d664&&_0x14d664[_[_0x2a3d('0x7')](_0x5682ed)+_0x2a3d('0x8')]){return _0x14d664[_[_0x2a3d('0x7')](_0x5682ed)+_0x2a3d('0x8')];}else if(_0x14d664&&_0x14d664['id']){return _0x14d664['id'];}else if(_0x55a60f&&_0x55a60f['id']){return _0x55a60f['id'];}else{return'unknown';}}function log(_0x426d47,_0x2f80a6,_0x1db99c,_0xe8f2b9,_0x23eaa4,_0x173205){loggers[_0x23eaa4[_0x2a3d('0x9')]()][_0x426d47](_0x2a3d('0xa'),_0x173205[_0x2a3d('0xb')](),_0x2f80a6?_0x2f80a6['id']:null,_0x2f80a6?_0x2f80a6[_0x2a3d('0xc')]:null,_0x2f80a6?_0x2f80a6[_0x2a3d('0xd')]:null,getInteractionId(_0x1db99c,_0xe8f2b9,_0x23eaa4),_0x1db99c?JSON['stringify'](_0x1db99c):_0x2a3d('0xe'));}function updateUser(_0x4f08e1,_0x31acce,_0x3bc036,_0x35432a,_0x2e9a7c){db[_[_0x2a3d('0x7')](_0x35432a)+'Interaction'][_0x2a3d('0xf')]({'where':{'id':getInteractionId(_0x31acce,_0x3bc036,_0x35432a)}})[_0x2a3d('0x10')](function(_0x1052e4){if(_0x1052e4){return _0x1052e4['update']({'UserId':_0x4f08e1?_0x4f08e1['id']:null});}})[_0x2a3d('0x10')](function(_0x73b7f4){if(_0x73b7f4){log(_0x2a3d('0x11'),_0x4f08e1,_0x31acce,_0x3bc036,_0x35432a,_0x2e9a7c);}})[_0x2a3d('0x12')](function(){log('error',_0x4f08e1,_0x31acce,_0x3bc036,_0x35432a,_0x2e9a7c);});}exports['tracked']=function(_0x2b234d,_0x37e75f){return function(_0x1528f1,_0x11516b,_0x18a3f2){var _0x5b5b9d=_0x1528f1['user'];var _0x4a1da3={};var _0x343224=_0x1528f1['query'];if(_0x4a1da3){_0x4a1da3=_[_0x2a3d('0x13')](_0x1528f1['body']);_0x4a1da3=_['omit'](_0x4a1da3,[_0x2a3d('0x14'),_0x2a3d('0x15'),_0x2a3d('0x16'),_0x2a3d('0x17'),_0x2a3d('0x18')]);}updateUser(_0x5b5b9d,_0x4a1da3,_0x343224,_0x2b234d,_0x37e75f);_0x18a3f2(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 22ce1d2..d083ea5 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 _0x1cc4=['user','isUserLimit','crypto','util','composable-middleware','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','status','json','users','User','admin'];(function(_0x27871e,_0x54b1a5){var _0x3de94b=function(_0x9a8aa){while(--_0x9a8aa){_0x27871e['push'](_0x27871e['shift']());}};_0x3de94b(++_0x54b1a5);}(_0x1cc4,0x1bc));var _0x41cc=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x1cc4[_0x5192de];return _0x4e287e;};'use strict';var crypto=require(_0x41cc('0x0'));var util=require(_0x41cc('0x1'));var compose=require(_0x41cc('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2a8363,_0x8569c){if(_0x2a8363&&_0x8569c){if(_0x8569c[_0x41cc('0x3')]&&_0x8569c['license']){var _0x338314=_0x8569c[_0x41cc('0x3')];var _0x379e36=_0x8569c[_0x41cc('0x4')];var _0x37a99f=_0x338314[_0x41cc('0x5')]('-')[0x4];var _0x50e864=_0x338314[_0x41cc('0x5')]('-')[0x0];var _0x5d5bf5=crypto[_0x41cc('0x6')]('aes-256-ctr',util[_0x41cc('0x7')](_0x41cc('0x8'),_0x37a99f,_0x338314,_0x50e864));var _0x1f49cf=_0x5d5bf5[_0x41cc('0x9')](_0x379e36,_0x41cc('0xa'),_0x41cc('0xb'));_0x1f49cf+=_0x5d5bf5[_0x41cc('0xc')]('utf8');var _0x821867=JSON['parse'](_0x1f49cf);return _0x821867[_0x41cc('0xd')](_0x2a8363)?_0x821867[_0x2a8363]:null;}}return null;}function isLimit(_0x227777,_0x4aa072,_0x189611,_0x41fd2c){var _0x210438=_0x4aa072;return compose()[_0x41cc('0xe')](function(_0x43f403,_0x193513,_0xfb9ec0){return db[_0x41cc('0xf')][_0x41cc('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x41cc('0x11')](function(_0x1f9c21){var _0x478b25=getValueFromLicense(_0x227777,_0x1f9c21);return _0x478b25?_0x478b25:_0x210438;})['then'](function(_0x1ac6d4){_0x210438=_0x1ac6d4;return _0x189611[_0x41cc('0x12')](_0x41fd2c);})['then'](function(_0x28218a){if(_0x28218a>=_0x210438){return _0x193513[_0x41cc('0x13')](0x193)[_0x41cc('0x14')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x227777)});}_0xfb9ec0();})['catch'](function(_0x335490){_0xfb9ec0(_0x335490);});});}function isUserLimit(){return isLimit(_0x41cc('0x15'),0x1,db[_0x41cc('0x16')],{'where':{'$or':[{'role':_0x41cc('0x17')},{'role':_0x41cc('0x18')}]}});}exports[_0x41cc('0x19')]=isUserLimit; \ No newline at end of file +var _0xa4fc=['update','base64','utf8','final','hasOwnProperty','use','License','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format'];(function(_0x291d00,_0x28ad4f){var _0x118f9e=function(_0x2c5301){while(--_0x2c5301){_0x291d00['push'](_0x291d00['shift']());}};_0x118f9e(++_0x28ad4f);}(_0xa4fc,0xf4));var _0xca4f=function(_0x1ad5ab,_0x12cde3){_0x1ad5ab=_0x1ad5ab-0x0;var _0x5b0479=_0xa4fc[_0x1ad5ab];return _0x5b0479;};'use strict';var crypto=require(_0xca4f('0x0'));var util=require('util');var compose=require(_0xca4f('0x1'));var db=require(_0xca4f('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x97982b,_0x2fd1a6){if(_0x97982b&&_0x2fd1a6){if(_0x2fd1a6[_0xca4f('0x3')]&&_0x2fd1a6[_0xca4f('0x4')]){var _0x4134e2=_0x2fd1a6[_0xca4f('0x3')];var _0x5921e4=_0x2fd1a6['license'];var _0x365c49=_0x4134e2['split']('-')[0x4];var _0x58f194=_0x4134e2[_0xca4f('0x5')]('-')[0x0];var _0x1e9632=crypto[_0xca4f('0x6')](_0xca4f('0x7'),util[_0xca4f('0x8')]('%s:%s:%s',_0x365c49,_0x4134e2,_0x58f194));var _0x58ec09=_0x1e9632[_0xca4f('0x9')](_0x5921e4,_0xca4f('0xa'),_0xca4f('0xb'));_0x58ec09+=_0x1e9632[_0xca4f('0xc')](_0xca4f('0xb'));var _0x2b9725=JSON['parse'](_0x58ec09);return _0x2b9725[_0xca4f('0xd')](_0x97982b)?_0x2b9725[_0x97982b]:null;}}return null;}function isLimit(_0x1ab75f,_0x5d8dcf,_0x2acef9,_0x3999d1){var _0x53b7ae=_0x5d8dcf;return compose()[_0xca4f('0xe')](function(_0x5dc84f,_0x5df31d,_0x5d1b8f){return db[_0xca4f('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xca4f('0x10')](function(_0xc53c15){var _0xca987b=getValueFromLicense(_0x1ab75f,_0xc53c15);return _0xca987b?_0xca987b:_0x53b7ae;})[_0xca4f('0x10')](function(_0x2574fa){_0x53b7ae=_0x2574fa;return _0x2acef9[_0xca4f('0x11')](_0x3999d1);})[_0xca4f('0x10')](function(_0x44aafd){if(_0x44aafd>=_0x53b7ae){return _0x5df31d['status'](0x193)['json']({'message':util['format'](_0xca4f('0x12'),_0x1ab75f)});}_0x5d1b8f();})['catch'](function(_0x48f8f0){_0x5d1b8f(_0x48f8f0);});});}function isUserLimit(){return isLimit(_0xca4f('0x13'),0x1,db['User'],{'where':{'$or':[{'role':_0xca4f('0x14')},{'role':_0xca4f('0x15')}]}});}exports[_0xca4f('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 06f629f..ed66075 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 _0x833c=['>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','utcOffset','hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','replace','split','length','slice','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','$gt'];(function(_0x25a136,_0x57320e){var _0x5b7159=function(_0x32c8f9){while(--_0x32c8f9){_0x25a136['push'](_0x25a136['shift']());}};_0x5b7159(++_0x57320e);}(_0x833c,0xb2));var _0xc833=function(_0x366304,_0x44ac75){_0x366304=_0x366304-0x0;var _0x4c5a32=_0x833c[_0x366304];return _0x4c5a32;};'use strict';var _=require(_0xc833('0x0'));var moment=require(_0xc833('0x1'));exports['parseSearch']=function(_0x1a8785){var _0x8b51b6={'conditions':[]};_0x8b51b6['sqlOperator']=_[_0xc833('0x2')](_0x1a8785,_0xc833('0x3'))?'or':_0xc833('0x4');var _0x4f657c=_0x1a8785[_0xc833('0x5')]('[$and]','')[_0xc833('0x5')](_0xc833('0x3'),'')[_0xc833('0x6')]('||');for(var _0x13a702=0x0;_0x13a702<_0x4f657c[_0xc833('0x7')];_0x13a702++){var _0x46847a=_0x4f657c[_0x13a702]['split'](':=');var _0x5a4b21=_0x46847a[0x0];var _0x24d5e1=_0x46847a[_0xc833('0x8')](0x1);_0x24d5e1['forEach'](function(_0x4ff3b6){var _0x347e53=_0x4ff3b6['split']('[')[_0xc833('0x9')]();var _0x437a98=_0x4ff3b6[_0xc833('0xa')](/\[(.*?)\]/g);_0x437a98['forEach'](function(_0x235059){var _0x2ff0bf=_0x235059[_0xc833('0x6')]('[')[_0xc833('0xb')](function(_0x56bc33){return _0x56bc33[_0xc833('0xc')](']')>-0x1;})[_0xc833('0xd')](function(_0x1f7ee9){return _0x1f7ee9[_0xc833('0x6')](']')[0x0];})[0x0];_0x8b51b6[_0xc833('0xe')][_0xc833('0xf')]({'field':_0x5a4b21,'operator':_0x347e53,'value':_0x2ff0bf});});});}return _0x8b51b6;};exports[_0xc833('0x10')]=function(_0x12b4e5,_0x4ebe75,_0x170694){var _0x2ddcbc={};if(_0x4ebe75===_0xc833('0x11')){if(_0x170694[_0xc833('0x12')]==='$eq'){_0x170694[_0xc833('0x12')]=_0xc833('0x13');_0x170694[_0xc833('0x14')]+=','+_0x170694[_0xc833('0x14')];}else if(_[_0xc833('0x15')](['$gt',_0xc833('0x16')],_0x170694[_0xc833('0x12')])){_0x170694[_0xc833('0x14')]=moment(_0x170694[_0xc833('0x14')])[_0xc833('0x17')](0x1,_0xc833('0x18'))[_0xc833('0x19')](_0xc833('0x1a'));}}if(_0x170694[_0xc833('0x1b')]){_0x4ebe75=_0x170694[_0xc833('0x1b')];_0x2ddcbc[_0xc833('0x1c')]=_0xc833('0x1d')+_0x12b4e5+'.'+_0x170694[_0xc833('0x1e')]+_0xc833('0x1f')+_0x170694['castTo']+')\x20'+parseOperator(_0x170694[_0xc833('0x12')]);}else{_0x2ddcbc[_0xc833('0x1c')]=_0x12b4e5+'.'+_0x170694[_0xc833('0x1e')]+'\x20'+parseOperator(_0x170694['operator']);}if(_[_0xc833('0x15')]([_0xc833('0x20'),_0xc833('0x21')],_0x170694['operator']))_0x2ddcbc['text']='('+_0x2ddcbc[_0xc833('0x1c')]+_0xc833('0x22')+_0x12b4e5+'.'+_0x170694[_0xc833('0x1e')]+_0xc833('0x23');_0x2ddcbc[_0xc833('0x14')]=parseValue(_0x4ebe75,_0x170694['operator'],_0x170694[_0xc833('0x14')]);return _0x2ddcbc;};function parseOperator(_0x341c8c){var _0x3022fb;switch(_0x341c8c){case'$in':_0x3022fb=_0xc833('0x24');break;case _0xc833('0x21'):_0x3022fb=_0xc833('0x25');break;case'$eq':_0x3022fb=_0xc833('0x26');break;case _0xc833('0x20'):_0x3022fb=_0xc833('0x27');break;case _0xc833('0x28'):case _0xc833('0x29'):case _0xc833('0x2a'):_0x3022fb='LIKE\x20?';break;case _0xc833('0x2b'):_0x3022fb=_0xc833('0x2c');break;case _0xc833('0x2d'):_0x3022fb=_0xc833('0x2e');break;case _0xc833('0x16'):_0x3022fb=_0xc833('0x2f');break;case _0xc833('0x30'):_0x3022fb='>=\x20?';break;case _0xc833('0x13'):_0x3022fb=_0xc833('0x31');break;}return _0x3022fb;}function parseValue(_0x9f1b5d,_0x1fe10a,_0x457a9d){var _0x1cfc46={'start':undefined,'end':undefined};switch(_0x1fe10a){case _0xc833('0x32'):case _0xc833('0x21'):_0x1cfc46['start']=_0x457a9d[_0xc833('0x6')](',');break;case _0xc833('0x28'):_0x1cfc46[_0xc833('0x33')]='%'+_0x457a9d+'%';break;case _0xc833('0x29'):_0x1cfc46[_0xc833('0x33')]=_0x457a9d+'%';break;case _0xc833('0x2a'):_0x1cfc46['start']='%'+_0x457a9d;break;case _0xc833('0x13'):var _0x4051d8=_0x457a9d[_0xc833('0x6')](',');var _0x457a9d=_0x4051d8[_0xc833('0x9')]();var _0x1e55cf=_0x4051d8['pop']();if(_0x9f1b5d===_0xc833('0x11')){_0x457a9d=moment(_0x457a9d)[_0xc833('0x34')](0x0,!![])[_0xc833('0x19')]();_0x1e55cf=moment(_0x1e55cf)[_0xc833('0x34')](0x0,!![])[_0xc833('0x17')](0x17,_0xc833('0x35'))[_0xc833('0x17')](0x3b,_0xc833('0x36'))[_0xc833('0x17')](0x3b,_0xc833('0x37'))[_0xc833('0x19')]();}_0x1cfc46={'start':_0x457a9d,'end':_0x1e55cf};break;default:_0x1cfc46[_0xc833('0x33')]=_0x457a9d;break;}return _0x1cfc46;} \ No newline at end of file +var _0xbdce=['field','text','$ne','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','lodash','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','CAST('];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xbdce,0xaa));var _0xebdc=function(_0x1a5e0f,_0x40eab3){_0x1a5e0f=_0x1a5e0f-0x0;var _0x5a441c=_0xbdce[_0x1a5e0f];return _0x5a441c;};'use strict';var _=require(_0xebdc('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x3fd025){var _0xa1bd67={'conditions':[]};_0xa1bd67[_0xebdc('0x1')]=_[_0xebdc('0x2')](_0x3fd025,_0xebdc('0x3'))?'or':_0xebdc('0x4');var _0x5701bb=_0x3fd025[_0xebdc('0x5')]('[$and]','')[_0xebdc('0x5')](_0xebdc('0x3'),'')[_0xebdc('0x6')]('||');for(var _0x596b2d=0x0;_0x596b2d<_0x5701bb[_0xebdc('0x7')];_0x596b2d++){var _0x1b5e2e=_0x5701bb[_0x596b2d]['split'](':=');var _0x2f9f45=_0x1b5e2e[0x0];var _0x3f2abd=_0x1b5e2e[_0xebdc('0x8')](0x1);_0x3f2abd[_0xebdc('0x9')](function(_0xeeb034){var _0x362e23=_0xeeb034[_0xebdc('0x6')]('[')[_0xebdc('0xa')]();var _0x57bbea=_0xeeb034[_0xebdc('0xb')](/\[(.*?)\]/g);_0x57bbea[_0xebdc('0x9')](function(_0x56fee9){var _0x9eff68=_0x56fee9[_0xebdc('0x6')]('[')[_0xebdc('0xc')](function(_0x3c95b5){return _0x3c95b5[_0xebdc('0xd')](']')>-0x1;})[_0xebdc('0xe')](function(_0x3b5826){return _0x3b5826[_0xebdc('0x6')](']')[0x0];})[0x0];_0xa1bd67[_0xebdc('0xf')][_0xebdc('0x10')]({'field':_0x2f9f45,'operator':_0x362e23,'value':_0x9eff68});});});}return _0xa1bd67;};exports[_0xebdc('0x11')]=function(_0x2e955c,_0x163902,_0x22ac43){var _0x2a906f={};if(_0x163902===_0xebdc('0x12')){if(_0x22ac43[_0xebdc('0x13')]===_0xebdc('0x14')){_0x22ac43['operator']=_0xebdc('0x15');_0x22ac43['value']+=','+_0x22ac43[_0xebdc('0x16')];}else if(_[_0xebdc('0x17')]([_0xebdc('0x18'),_0xebdc('0x19')],_0x22ac43[_0xebdc('0x13')])){_0x22ac43[_0xebdc('0x16')]=moment(_0x22ac43['value'])[_0xebdc('0x1a')](0x1,_0xebdc('0x1b'))[_0xebdc('0x1c')]('YYYY-MM-DD');}}if(_0x22ac43['castTo']){_0x163902=_0x22ac43['castTo'];_0x2a906f['text']=_0xebdc('0x1d')+_0x2e955c+'.'+_0x22ac43[_0xebdc('0x1e')]+'\x20AS\x20'+_0x22ac43['castTo']+')\x20'+parseOperator(_0x22ac43[_0xebdc('0x13')]);}else{_0x2a906f[_0xebdc('0x1f')]=_0x2e955c+'.'+_0x22ac43['field']+'\x20'+parseOperator(_0x22ac43['operator']);}if(_[_0xebdc('0x17')]([_0xebdc('0x20'),'$notIn'],_0x22ac43['operator']))_0x2a906f[_0xebdc('0x1f')]='('+_0x2a906f[_0xebdc('0x1f')]+_0xebdc('0x21')+_0x2e955c+'.'+_0x22ac43[_0xebdc('0x1e')]+'\x20IS\x20NULL)';_0x2a906f[_0xebdc('0x16')]=parseValue(_0x163902,_0x22ac43['operator'],_0x22ac43[_0xebdc('0x16')]);return _0x2a906f;};function parseOperator(_0x525539){var _0x289388;switch(_0x525539){case _0xebdc('0x22'):_0x289388=_0xebdc('0x23');break;case _0xebdc('0x24'):_0x289388=_0xebdc('0x25');break;case _0xebdc('0x14'):_0x289388='=\x20?';break;case _0xebdc('0x20'):_0x289388='<>\x20?';break;case'$substring':case _0xebdc('0x26'):case _0xebdc('0x27'):_0x289388=_0xebdc('0x28');break;case'$lt':_0x289388=_0xebdc('0x29');break;case _0xebdc('0x18'):_0x289388=_0xebdc('0x2a');break;case _0xebdc('0x19'):_0x289388='<=\x20?';break;case'$gte':_0x289388='>=\x20?';break;case _0xebdc('0x15'):_0x289388=_0xebdc('0x2b');break;}return _0x289388;}function parseValue(_0x165ca5,_0x28e2b9,_0x267d5d){var _0x350d35={'start':undefined,'end':undefined};switch(_0x28e2b9){case'$in':case'$notIn':_0x350d35[_0xebdc('0x2c')]=_0x267d5d[_0xebdc('0x6')](',');break;case _0xebdc('0x2d'):_0x350d35[_0xebdc('0x2c')]='%'+_0x267d5d+'%';break;case'$startsWith':_0x350d35['start']=_0x267d5d+'%';break;case _0xebdc('0x27'):_0x350d35[_0xebdc('0x2c')]='%'+_0x267d5d;break;case _0xebdc('0x15'):var _0x2eae78=_0x267d5d[_0xebdc('0x6')](',');var _0x267d5d=_0x2eae78[_0xebdc('0xa')]();var _0x391269=_0x2eae78[_0xebdc('0x2e')]();if(_0x165ca5==='DATE'){_0x267d5d=moment(_0x267d5d)[_0xebdc('0x2f')](0x0,!![])[_0xebdc('0x1c')]();_0x391269=moment(_0x391269)[_0xebdc('0x2f')](0x0,!![])[_0xebdc('0x1a')](0x17,_0xebdc('0x30'))['add'](0x3b,_0xebdc('0x31'))[_0xebdc('0x1a')](0x3b,'seconds')[_0xebdc('0x1c')]();}_0x350d35={'start':_0x267d5d,'end':_0x391269};break;default:_0x350d35[_0xebdc('0x2c')]=_0x267d5d;break;}return _0x350d35;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1eca646..5431bcf 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 _0x0908=['nolimit','order','where','pick','filter','merge','VIRTUAL','lower','options','lodash','parse','keys','includes','fields','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','ASC','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','getFullTextValue','forEach','replace','push','join','getOptions','$id','query','model','name','intersection','attributes'];(function(_0x3dbc70,_0x244a09){var _0x2193bf=function(_0x5b982b){while(--_0x5b982b){_0x3dbc70['push'](_0x3dbc70['shift']());}};_0x2193bf(++_0x244a09);}(_0x0908,0x83));var _0x8090=function(_0x4eedef,_0x2e4ca3){_0x4eedef=_0x4eedef-0x0;var _0x57d383=_0x0908[_0x4eedef];return _0x57d383;};'use strict';var _=require(_0x8090('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x39ce11){var _0x1994f5=['ne'];try{var _0x120a2b=JSON[_0x8090('0x1')](_0x39ce11);var _0x188d8d=Object[_0x8090('0x2')](_0x120a2b)[0x0];return _0x1994f5[_0x8090('0x3')](_0x188d8d);}catch(_0x488389){return![];}}function getOperatorValue(_0x460284){var _0x460a50=JSON[_0x8090('0x1')](_0x460284);var _0x25d434=Object[_0x8090('0x2')](_0x460a50)[0x0];var _0x59a8a5=_0x460a50[_0x25d434];return{['$'+_0x25d434]:_0x59a8a5};}exports[_0x8090('0x4')]=function(_0x4c54df){var _0x1f47ed=null;if(_0x4c54df){_0x1f47ed=_0x4c54df[_0x8090('0x5')](',');}return _0x1f47ed;};exports[_0x8090('0x6')]=function(_0x51c821,_0x580159){var _0x3af7c6={};if(!_['isEmpty'](_0x51c821)){_[_0x8090('0x7')](_0x51c821,function(_0x5b6d68,_0x58f2c6){try{if(_0x580159){var _0x27d3d1=_[_0x8090('0x8')](_0x580159,{'name':_0x58f2c6})||{};if(hasSequelizeOperator(_0x5b6d68)){_0x3af7c6[_0x58f2c6]=getOperatorValue(_0x5b6d68);}else if(_0x27d3d1[_0x8090('0x9')]===_0x8090('0xa')&&_[_0x8090('0xb')](_0x5b6d68)){var _0x116d49=JSON[_0x8090('0x1')](_0x5b6d68);var _0x490c5d={'$gte':moment(moment(_0x116d49[_0x8090('0xc')])['format'](_0x8090('0xd')))[_0x8090('0xe')]()[_0x8090('0xf')](),'$lte':moment(moment(_0x116d49['$lte'])[_0x8090('0xf')](_0x8090('0xd')))['utc']()[_0x8090('0x10')](0x1,'s')[_0x8090('0xf')]()};_0x3af7c6[_0x58f2c6]=_0x490c5d;}else if(_0x27d3d1['name']===_0x8090('0x11')){_0x3af7c6[_0x58f2c6]=_0x5b6d68;}else{_0x3af7c6[_0x58f2c6]=_[_0x8090('0x12')](_0x5b6d68)?_0x5b6d68:JSON[_0x8090('0x1')](_0x5b6d68);}}else{_0x3af7c6[_0x58f2c6]=_['isArray'](_0x5b6d68)?_0x5b6d68:JSON['parse'](_0x5b6d68);}}catch(_0x468689){_0x3af7c6[_0x58f2c6]=_0x5b6d68[_0x8090('0x5')](',');}});}return _0x3af7c6;};exports[_0x8090('0x13')]=function(_0x537aef){_0x537aef=parseInt(_0x537aef,0xa);if(!_0x537aef||_0x537aef<0x0){_0x537aef=LIMIT_VALUE;}return _0x537aef;};exports[_0x8090('0x14')]=function(_0x40509b){_0x40509b=parseInt(_0x40509b,0xa);if(!_0x40509b||_0x40509b<0x0){_0x40509b=0x0;}return _0x40509b;};exports[_0x8090('0x15')]=function(_0x25c733){var _0x151853,_0x5ad263=null;if(_0x25c733){_0x151853=_0x25c733[_0x8090('0x5')](',');_0x5ad263=_[_0x8090('0x16')](_0x151853,function(_0x49fa9d){if(_0x49fa9d[_0x8090('0x17')]('-')===0x0){return[_0x49fa9d===_0x8090('0x18')?sequelize['cast'](sequelize[_0x8090('0x19')](_0x8090('0x18')),_0x8090('0x1a')):_0x49fa9d[_0x8090('0x1b')](0x1),_0x8090('0x1c')];}else{return[_0x49fa9d===_0x8090('0x18')?sequelize['cast'](sequelize[_0x8090('0x19')](_0x8090('0x18')),_0x8090('0x1a')):_0x49fa9d,_0x8090('0x1d')];}});}return _0x5ad263;};exports[_0x8090('0x1e')]=function(_0xbc7be0,_0x4de769){if(_[_0x8090('0x1f')](_0xbc7be0)){return _0xbc7be0;}if(_[_0x8090('0x12')](_0xbc7be0)){for(var _0x450fd2=0x0;_0x450fd2<_0xbc7be0[_0x8090('0x20')];_0x450fd2+=0x1){_0xbc7be0[_0x450fd2]=this[_0x8090('0x1e')](_0xbc7be0[_0x450fd2],_0x4de769);}return _0xbc7be0;}if(!_[_0x8090('0x21')](_0xbc7be0)){return _0xbc7be0;}if(_[_0x8090('0x22')](_0x4de769)){_0x4de769=[_0x4de769];}if(!_[_0x8090('0x12')](_0x4de769)){return _0xbc7be0;}for(var _0x3924a7=0x0;_0x3924a7<_0x4de769[_0x8090('0x20')];_0x3924a7+=0x1){_[_0x8090('0x23')](_0xbc7be0,_0x4de769[_0x3924a7]);}for(var _0x19f9c4 in _0xbc7be0){if(_0xbc7be0[_0x8090('0x24')](_0x19f9c4)){_0xbc7be0[_0x19f9c4]=this['omit'](_0xbc7be0[_0x19f9c4],_0x4de769);}}return _0xbc7be0;};exports[_0x8090('0x25')]=function(_0x1225fc){return _0x1225fc['match'](RegExp(_0x8090('0x26')))?!![]:![];};exports['isEmail']=function(_0x5d95e1){return _0x5d95e1[_0x8090('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x8090('0x28')]=function(_0x453d08){var _0x3e0a40=[];_0x453d08[_0x8090('0x5')](/[ ,]+/)[_0x8090('0x29')](function(_0xd2d2d5){_0xd2d2d5=_0xd2d2d5[_0x8090('0x2a')](/([^:]")"+/g,'$1');_0xd2d2d5='+'+_0xd2d2d5+'*';if(_0xd2d2d5[_0x8090('0x3')]('@'))_0xd2d2d5='\x22'+_0xd2d2d5+'\x22';_0x3e0a40[_0x8090('0x2b')](_0xd2d2d5);});return _0x3e0a40[_0x8090('0x2c')]('\x20');};exports[_0x8090('0x2d')]=function(_0x238e66,_0x305bf6,_0x10d1af){var _0x2f7b9d={},_0x195932={};if(_0x305bf6['query'][_0x8090('0x2e')]){_0x305bf6[_0x8090('0x2f')]['id']=_0x305bf6[_0x8090('0x2f')][_0x8090('0x2e')];delete _0x305bf6['query'][_0x8090('0x2e')];}_0x2f7b9d[_0x8090('0x30')]=_[_0x8090('0x16')](_0x238e66,_0x8090('0x31'));_0x2f7b9d[_0x8090('0x2f')]=_[_0x8090('0x2')](_0x305bf6['query']);_0x2f7b9d['filters']=_[_0x8090('0x32')](_0x2f7b9d[_0x8090('0x30')],_0x2f7b9d['query']);_0x195932[_0x8090('0x33')]=_[_0x8090('0x32')](_0x2f7b9d[_0x8090('0x30')],this[_0x8090('0x4')](_0x305bf6[_0x8090('0x2f')][_0x8090('0x4')]));_0x195932['attributes']=_0x195932[_0x8090('0x33')][_0x8090('0x20')]?_0x195932[_0x8090('0x33')]:_0x2f7b9d[_0x8090('0x30')];if(!_0x305bf6[_0x8090('0x2f')][_0x8090('0x24')](_0x8090('0x34'))){_0x195932[_0x8090('0x13')]=this['limit'](_0x305bf6[_0x8090('0x2f')]['limit']);_0x195932['offset']=this[_0x8090('0x14')](_0x305bf6[_0x8090('0x2f')][_0x8090('0x14')]);}_0x195932[_0x8090('0x35')]=this[_0x8090('0x15')](_0x305bf6[_0x8090('0x2f')][_0x8090('0x15')]);_0x195932[_0x8090('0x36')]=this[_0x8090('0x6')](_[_0x8090('0x37')](_0x305bf6[_0x8090('0x2f')],_0x2f7b9d[_0x8090('0x6')]),_0x238e66);if(_0x305bf6[_0x8090('0x2f')][_0x8090('0x38')]){_0x195932[_0x8090('0x36')]=_[_0x8090('0x39')](_0x195932[_0x8090('0x36')],{'$or':_['map'](_0x238e66,function(_0x27c20f){if(_0x27c20f[_0x8090('0x9')]!==_0x8090('0x3a')){if(_0x10d1af){return sequelize[_0x8090('0x36')](sequelize['fn'](_0x8090('0x3b'),sequelize[_0x8090('0x19')](_0x27c20f[_0x8090('0x31')])),{'$like':sequelize['fn']('lower','%'+_0x305bf6['query'][_0x8090('0x38')]+'%')});}else{var _0x571db4={};_0x571db4[_0x27c20f['name']]={'$like':'%'+_0x305bf6[_0x8090('0x2f')]['filter']+'%'};return _0x571db4;}}})});}_0x195932=_['merge']({},_0x195932,_0x305bf6[_0x8090('0x3c')]);return _0x195932;}; \ No newline at end of file +var _0x3b81=['find','type','DATE','$gte','format','$lte','YYYY-MM-DD','utc','name','split','offset','sort','indexOf','priority','cast','col','unsigned','DESC','omit','isArray','isString','unset','hasOwnProperty','^[+]?[0-9]*$','match','getFullTextValue','forEach','push','getOptions','query','$id','model','map','filters','intersection','attributes','length','nolimit','limit','where','pick','filter','merge','VIRTUAL','lodash','sequelize','moment','parse','keys','includes','fields','isEmpty'];(function(_0x29a9be,_0x1c0773){var _0x5865a0=function(_0xb2cdab){while(--_0xb2cdab){_0x29a9be['push'](_0x29a9be['shift']());}};_0x5865a0(++_0x1c0773);}(_0x3b81,0x130));var _0x13b8=function(_0x4467d3,_0x285272){_0x4467d3=_0x4467d3-0x0;var _0x59ad68=_0x3b81[_0x4467d3];return _0x59ad68;};'use strict';var _=require(_0x13b8('0x0'));var sequelize=require(_0x13b8('0x1'));var moment=require(_0x13b8('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x288493){var _0x4d4cab=['ne'];try{var _0x92697d=JSON[_0x13b8('0x3')](_0x288493);var _0x12d3f8=Object[_0x13b8('0x4')](_0x92697d)[0x0];return _0x4d4cab[_0x13b8('0x5')](_0x12d3f8);}catch(_0x21f4fd){return![];}}function getOperatorValue(_0x5131f2){var _0x2b072b=JSON['parse'](_0x5131f2);var _0x15209a=Object[_0x13b8('0x4')](_0x2b072b)[0x0];var _0x256e21=_0x2b072b[_0x15209a];return{['$'+_0x15209a]:_0x256e21};}exports[_0x13b8('0x6')]=function(_0x2658f2){var _0x459e16=null;if(_0x2658f2){_0x459e16=_0x2658f2['split'](',');}return _0x459e16;};exports['filters']=function(_0x2ac388,_0x253320){var _0x442b5f={};if(!_[_0x13b8('0x7')](_0x2ac388)){_['forOwn'](_0x2ac388,function(_0x4ba026,_0x7611f5){try{if(_0x253320){var _0x55d6cc=_[_0x13b8('0x8')](_0x253320,{'name':_0x7611f5})||{};if(hasSequelizeOperator(_0x4ba026)){_0x442b5f[_0x7611f5]=getOperatorValue(_0x4ba026);}else if(_0x55d6cc[_0x13b8('0x9')]===_0x13b8('0xa')&&_['isPlainObject'](_0x4ba026)){var _0x58a9df=JSON[_0x13b8('0x3')](_0x4ba026);var _0x4036d0={'$gte':moment(moment(_0x58a9df[_0x13b8('0xb')])['format']('YYYY-MM-DD'))['utc']()[_0x13b8('0xc')](),'$lte':moment(moment(_0x58a9df[_0x13b8('0xd')])['format'](_0x13b8('0xe')))[_0x13b8('0xf')]()['subtract'](0x1,'s')[_0x13b8('0xc')]()};_0x442b5f[_0x7611f5]=_0x4036d0;}else if(_0x55d6cc[_0x13b8('0x10')]==='uniqueid'){_0x442b5f[_0x7611f5]=_0x4ba026;}else{_0x442b5f[_0x7611f5]=_['isArray'](_0x4ba026)?_0x4ba026:JSON['parse'](_0x4ba026);}}else{_0x442b5f[_0x7611f5]=_['isArray'](_0x4ba026)?_0x4ba026:JSON['parse'](_0x4ba026);}}catch(_0x1ebd16){_0x442b5f[_0x7611f5]=_0x4ba026[_0x13b8('0x11')](',');}});}return _0x442b5f;};exports['limit']=function(_0x243b50){_0x243b50=parseInt(_0x243b50,0xa);if(!_0x243b50||_0x243b50<0x0){_0x243b50=LIMIT_VALUE;}return _0x243b50;};exports[_0x13b8('0x12')]=function(_0x2b38b7){_0x2b38b7=parseInt(_0x2b38b7,0xa);if(!_0x2b38b7||_0x2b38b7<0x0){_0x2b38b7=0x0;}return _0x2b38b7;};exports[_0x13b8('0x13')]=function(_0x8313e9){var _0x46960a,_0x33343c=null;if(_0x8313e9){_0x46960a=_0x8313e9[_0x13b8('0x11')](',');_0x33343c=_['map'](_0x46960a,function(_0x4b8248){if(_0x4b8248[_0x13b8('0x14')]('-')===0x0){return[_0x4b8248===_0x13b8('0x15')?sequelize[_0x13b8('0x16')](sequelize[_0x13b8('0x17')](_0x13b8('0x15')),_0x13b8('0x18')):_0x4b8248['substr'](0x1),_0x13b8('0x19')];}else{return[_0x4b8248===_0x13b8('0x15')?sequelize['cast'](sequelize[_0x13b8('0x17')]('priority'),_0x13b8('0x18')):_0x4b8248,'ASC'];}});}return _0x33343c;};exports[_0x13b8('0x1a')]=function(_0x1e18b7,_0x4b5124){if(_[_0x13b8('0x7')](_0x1e18b7)){return _0x1e18b7;}if(_[_0x13b8('0x1b')](_0x1e18b7)){for(var _0x473672=0x0;_0x473672<_0x1e18b7['length'];_0x473672+=0x1){_0x1e18b7[_0x473672]=this['omit'](_0x1e18b7[_0x473672],_0x4b5124);}return _0x1e18b7;}if(!_['isObject'](_0x1e18b7)){return _0x1e18b7;}if(_[_0x13b8('0x1c')](_0x4b5124)){_0x4b5124=[_0x4b5124];}if(!_[_0x13b8('0x1b')](_0x4b5124)){return _0x1e18b7;}for(var _0x1da176=0x0;_0x1da176<_0x4b5124['length'];_0x1da176+=0x1){_[_0x13b8('0x1d')](_0x1e18b7,_0x4b5124[_0x1da176]);}for(var _0x26e271 in _0x1e18b7){if(_0x1e18b7[_0x13b8('0x1e')](_0x26e271)){_0x1e18b7[_0x26e271]=this['omit'](_0x1e18b7[_0x26e271],_0x4b5124);}}return _0x1e18b7;};exports['isNumeric']=function(_0x25e7ef){return _0x25e7ef['match'](RegExp(_0x13b8('0x1f')))?!![]:![];};exports['isEmail']=function(_0xf998){return _0xf998[_0x13b8('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x13b8('0x21')]=function(_0x56631b){var _0x3a9188=[];_0x56631b['split'](/[ ,]+/)[_0x13b8('0x22')](function(_0x176cca){_0x176cca=_0x176cca['replace'](/([^:]")"+/g,'$1');_0x176cca='+'+_0x176cca+'*';if(_0x176cca[_0x13b8('0x5')]('@'))_0x176cca='\x22'+_0x176cca+'\x22';_0x3a9188[_0x13b8('0x23')](_0x176cca);});return _0x3a9188['join']('\x20');};exports[_0x13b8('0x24')]=function(_0x4d99f7,_0x1cf062,_0x127df6){var _0x3a88c5={},_0x1f6c2a={};if(_0x1cf062[_0x13b8('0x25')]['$id']){_0x1cf062[_0x13b8('0x25')]['id']=_0x1cf062[_0x13b8('0x25')]['$id'];delete _0x1cf062[_0x13b8('0x25')][_0x13b8('0x26')];}_0x3a88c5[_0x13b8('0x27')]=_[_0x13b8('0x28')](_0x4d99f7,_0x13b8('0x10'));_0x3a88c5[_0x13b8('0x25')]=_[_0x13b8('0x4')](_0x1cf062['query']);_0x3a88c5[_0x13b8('0x29')]=_[_0x13b8('0x2a')](_0x3a88c5[_0x13b8('0x27')],_0x3a88c5[_0x13b8('0x25')]);_0x1f6c2a['attributes']=_['intersection'](_0x3a88c5[_0x13b8('0x27')],this['fields'](_0x1cf062[_0x13b8('0x25')][_0x13b8('0x6')]));_0x1f6c2a[_0x13b8('0x2b')]=_0x1f6c2a[_0x13b8('0x2b')][_0x13b8('0x2c')]?_0x1f6c2a[_0x13b8('0x2b')]:_0x3a88c5['model'];if(!_0x1cf062[_0x13b8('0x25')][_0x13b8('0x1e')](_0x13b8('0x2d'))){_0x1f6c2a[_0x13b8('0x2e')]=this['limit'](_0x1cf062[_0x13b8('0x25')]['limit']);_0x1f6c2a[_0x13b8('0x12')]=this['offset'](_0x1cf062[_0x13b8('0x25')][_0x13b8('0x12')]);}_0x1f6c2a['order']=this[_0x13b8('0x13')](_0x1cf062[_0x13b8('0x25')][_0x13b8('0x13')]);_0x1f6c2a[_0x13b8('0x2f')]=this[_0x13b8('0x29')](_[_0x13b8('0x30')](_0x1cf062['query'],_0x3a88c5[_0x13b8('0x29')]),_0x4d99f7);if(_0x1cf062[_0x13b8('0x25')][_0x13b8('0x31')]){_0x1f6c2a[_0x13b8('0x2f')]=_[_0x13b8('0x32')](_0x1f6c2a[_0x13b8('0x2f')],{'$or':_[_0x13b8('0x28')](_0x4d99f7,function(_0x3b8e4c){if(_0x3b8e4c[_0x13b8('0x9')]!==_0x13b8('0x33')){if(_0x127df6){return sequelize[_0x13b8('0x2f')](sequelize['fn']('lower',sequelize[_0x13b8('0x17')](_0x3b8e4c[_0x13b8('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x1cf062[_0x13b8('0x25')][_0x13b8('0x31')]+'%')});}else{var _0x38b50e={};_0x38b50e[_0x3b8e4c[_0x13b8('0x10')]]={'$like':'%'+_0x1cf062[_0x13b8('0x25')][_0x13b8('0x31')]+'%'};return _0x38b50e;}}})});}_0x1f6c2a=_[_0x13b8('0x32')]({},_0x1f6c2a,_0x1cf062['options']);return _0x1f6c2a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index dcaf561..b7d0407 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa959=['./environment','../mysqldb','get','env','production','appPath','join','development','test','set','root','client','use','json\x20replacer','toISOString','split','static','views','/server/views','engine','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','serve-favicon','body-parser','method-override','cookie-parser','path','passport','cors','moment'];(function(_0x2961c9,_0x294a6e){var _0x10f280=function(_0x5c1d28){while(--_0x5c1d28){_0x2961c9['push'](_0x2961c9['shift']());}};_0x10f280(++_0x294a6e);}(_0xa959,0x179));var _0x9a95=function(_0x239507,_0x1110fa){_0x239507=_0x239507-0x0;var _0x391573=_0xa959[_0x239507];return _0x391573;};'use strict';var express=require('express');var favicon=require(_0x9a95('0x0'));var bodyParser=require(_0x9a95('0x1'));var methodOverride=require(_0x9a95('0x2'));var cookieParser=require(_0x9a95('0x3'));var errorHandler=require('errorhandler');var path=require(_0x9a95('0x4'));var passport=require(_0x9a95('0x5'));var cors=require(_0x9a95('0x6'));var moment=require(_0x9a95('0x7'));var config=require(_0x9a95('0x8'));var db=require(_0x9a95('0x9'))['db'];exports['default']=function(_0x4fbfe5){var _0x281991=_0x4fbfe5[_0x9a95('0xa')](_0x9a95('0xb'));if(_0x281991===_0x9a95('0xc')){_0x4fbfe5['set'](_0x9a95('0xd'),path[_0x9a95('0xe')](config['root'],'public'));}if(_0x281991===_0x9a95('0xf')||_0x281991===_0x9a95('0x10')){_0x4fbfe5[_0x9a95('0x11')](_0x9a95('0xd'),path['join'](config[_0x9a95('0x12')],_0x9a95('0x13')));_0x4fbfe5[_0x9a95('0x14')](errorHandler());}_0x4fbfe5['set'](_0x9a95('0x15'),function(_0xdd6c95,_0x1641b2){if(this[_0xdd6c95]instanceof Date){_0x1641b2=this[_0xdd6c95][_0x9a95('0x16')]()[_0x9a95('0x17')]('.')[0x0]+'Z';}return _0x1641b2;});_0x4fbfe5[_0x9a95('0x14')](express[_0x9a95('0x18')](_0x4fbfe5['get']('appPath')));_0x4fbfe5[_0x9a95('0x11')](_0x9a95('0x19'),config['root']+_0x9a95('0x1a'));_0x4fbfe5[_0x9a95('0x1b')]('html',require(_0x9a95('0x1c'))[_0x9a95('0x1d')]);_0x4fbfe5[_0x9a95('0x11')](_0x9a95('0x1e'),'html');_0x4fbfe5[_0x9a95('0x14')](bodyParser[_0x9a95('0x1f')]({'limit':_0x9a95('0x20'),'extended':!![]}));_0x4fbfe5[_0x9a95('0x14')](bodyParser[_0x9a95('0x21')]({'limit':'50mb'}));_0x4fbfe5[_0x9a95('0x14')](cors());_0x4fbfe5['use'](methodOverride());_0x4fbfe5[_0x9a95('0x14')](cookieParser());_0x4fbfe5[_0x9a95('0x14')](passport[_0x9a95('0x22')]());}; \ No newline at end of file +var _0xa0fb=['view\x20engine','html','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','errorhandler','path','passport','cors','./environment','../mysqldb','default','get','env','set','appPath','join','root','public','test','client','use','json\x20replacer','toISOString','split','views','/server/views','ejs','renderFile'];(function(_0x50018f,_0x1430fc){var _0x278cdf=function(_0x125dcf){while(--_0x125dcf){_0x50018f['push'](_0x50018f['shift']());}};_0x278cdf(++_0x1430fc);}(_0xa0fb,0x12f));var _0xba0f=function(_0x2be20e,_0x188afa){_0x2be20e=_0x2be20e-0x0;var _0x758ef8=_0xa0fb[_0x2be20e];return _0x758ef8;};'use strict';var express=require(_0xba0f('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require(_0xba0f('0x1'));var cookieParser=require(_0xba0f('0x2'));var errorHandler=require(_0xba0f('0x3'));var path=require(_0xba0f('0x4'));var passport=require(_0xba0f('0x5'));var cors=require(_0xba0f('0x6'));var moment=require('moment');var config=require(_0xba0f('0x7'));var db=require(_0xba0f('0x8'))['db'];exports[_0xba0f('0x9')]=function(_0x376242){var _0x55ceb8=_0x376242[_0xba0f('0xa')](_0xba0f('0xb'));if(_0x55ceb8==='production'){_0x376242[_0xba0f('0xc')](_0xba0f('0xd'),path[_0xba0f('0xe')](config[_0xba0f('0xf')],_0xba0f('0x10')));}if(_0x55ceb8==='development'||_0x55ceb8===_0xba0f('0x11')){_0x376242[_0xba0f('0xc')](_0xba0f('0xd'),path[_0xba0f('0xe')](config[_0xba0f('0xf')],_0xba0f('0x12')));_0x376242[_0xba0f('0x13')](errorHandler());}_0x376242[_0xba0f('0xc')](_0xba0f('0x14'),function(_0x4c4b74,_0x599d58){if(this[_0x4c4b74]instanceof Date){_0x599d58=this[_0x4c4b74][_0xba0f('0x15')]()[_0xba0f('0x16')]('.')[0x0]+'Z';}return _0x599d58;});_0x376242[_0xba0f('0x13')](express['static'](_0x376242[_0xba0f('0xa')](_0xba0f('0xd'))));_0x376242[_0xba0f('0xc')](_0xba0f('0x17'),config[_0xba0f('0xf')]+_0xba0f('0x18'));_0x376242['engine']('html',require(_0xba0f('0x19'))[_0xba0f('0x1a')]);_0x376242['set'](_0xba0f('0x1b'),_0xba0f('0x1c'));_0x376242[_0xba0f('0x13')](bodyParser[_0xba0f('0x1d')]({'limit':_0xba0f('0x1e'),'extended':!![]}));_0x376242[_0xba0f('0x13')](bodyParser[_0xba0f('0x1f')]({'limit':'50mb'}));_0x376242[_0xba0f('0x13')](cors());_0x376242['use'](methodOverride());_0x376242[_0xba0f('0x13')](cookieParser());_0x376242['use'](passport[_0xba0f('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 06940b1..ee98e2a 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 _0xf9e9=['ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','join','createHash','md5','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress'];(function(_0x56fcdc,_0x2e9937){var _0x485c7b=function(_0x233d0e){while(--_0x233d0e){_0x56fcdc['push'](_0x56fcdc['shift']());}};_0x485c7b(++_0x2e9937);}(_0xf9e9,0x157));var _0x9f9e=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xf9e9[_0x3b231a];return _0x18d67a;};'use strict';var _=require(_0x9f9e('0x0'));var os=require('os');var crypto=require(_0x9f9e('0x1'));var machine=require(_0x9f9e('0x2'));var exec=require(_0x9f9e('0x3'))[_0x9f9e('0x4')];var config=require('../environment');function getInterfaces(){var _0x520bfa=[];var _0x1a5fca=os[_0x9f9e('0x5')]();var _0x343044=_['orderBy'](_['keys'](_0x1a5fca));for(var _0x396a67=0x0;_0x396a67<_0x343044[_0x9f9e('0x6')];_0x396a67++){var _0x5b45f9=_0x1a5fca[_0x343044[_0x396a67]][_0x9f9e('0x7')](function(_0x369d91){return _0x369d91[_0x9f9e('0x8')]===_0x9f9e('0x9')&&_0x369d91[_0x9f9e('0xa')]===![];});_0x520bfa=_0x520bfa[_0x9f9e('0xb')](_0x5b45f9);}return _0x520bfa;}function getFirstInterface(){var _0x44a183=_[_0x9f9e('0xc')](getInterfaces());return{'macAddress':_0x44a183&&_0x44a183[_0x9f9e('0xd')]?_0x44a183[_0x9f9e('0xd')]:_0x9f9e('0xe'),'ipAddress':_0x44a183&&_0x44a183[_0x9f9e('0xf')]?_0x44a183[_0x9f9e('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4188c8=_['orderBy'](os[_0x9f9e('0x10')]()['map'](function(_0x5351d2){return _0x5351d2['model'];}))[_0x9f9e('0x11')](':');return crypto[_0x9f9e('0x12')](_0x9f9e('0x13'))['update'](_0x4188c8)[_0x9f9e('0x14')](_0x9f9e('0x15'));}exports[_0x9f9e('0x16')]=function(){var _0x3744da=os[_0x9f9e('0x17')]();var _0x311995=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x311995[_0x9f9e('0x18')](config['licenseToken'])){return config[_0x9f9e('0x19')];}else if(_0x3744da===_0x9f9e('0x1a')){return exec(_0x9f9e('0x1b'),{'encoding':_0x9f9e('0x1c')})['replace']('\x0d\x0a','');}else{var _0x34d15f=getFirstInterface();var _0x571d07=getCPUhash();var _0x9d6f7d=_0x571d07+'|'+os[_0x9f9e('0x1d')]()+'|'+_0x34d15f[_0x9f9e('0x1e')]+'|'+_0x34d15f[_0x9f9e('0x1f')];var _0x3005e0=crypto[_0x9f9e('0x12')](_0x9f9e('0x13'))[_0x9f9e('0x20')](_0x9d6f7d)[_0x9f9e('0x14')](_0x9f9e('0x15'));return _0x3005e0[_0x9f9e('0x21')](0x0,0x8)+'-'+_0x3005e0[_0x9f9e('0x21')](0x8,0xc)+'-'+_0x3005e0[_0x9f9e('0x21')](0xc,0x10)+'-'+_0x3005e0['substring'](0x10,0x14)+'-'+_0x3005e0[_0x9f9e('0x21')](0x14);}}; \ No newline at end of file +var _0xb498=['family','IPv4','internal','concat','mac','address','orderBy','cpus','model','join','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter'];(function(_0x5a6795,_0x4ec985){var _0x6e6171=function(_0x43f784){while(--_0x43f784){_0x5a6795['push'](_0x5a6795['shift']());}};_0x6e6171(++_0x4ec985);}(_0xb498,0x9b));var _0x8b49=function(_0x4d9222,_0x2fd607){_0x4d9222=_0x4d9222-0x0;var _0x56d581=_0xb498[_0x4d9222];return _0x56d581;};'use strict';var _=require(_0x8b49('0x0'));var os=require('os');var crypto=require(_0x8b49('0x1'));var machine=require(_0x8b49('0x2'));var exec=require(_0x8b49('0x3'))[_0x8b49('0x4')];var config=require(_0x8b49('0x5'));function getInterfaces(){var _0x2e57d4=[];var _0x2a6314=os[_0x8b49('0x6')]();var _0xdd13f3=_['orderBy'](_[_0x8b49('0x7')](_0x2a6314));for(var _0x2ff55a=0x0;_0x2ff55a<_0xdd13f3[_0x8b49('0x8')];_0x2ff55a++){var _0x200c1d=_0x2a6314[_0xdd13f3[_0x2ff55a]][_0x8b49('0x9')](function(_0x596caf){return _0x596caf[_0x8b49('0xa')]===_0x8b49('0xb')&&_0x596caf[_0x8b49('0xc')]===![];});_0x2e57d4=_0x2e57d4[_0x8b49('0xd')](_0x200c1d);}return _0x2e57d4;}function getFirstInterface(){var _0x5c7c8e=_['head'](getInterfaces());return{'macAddress':_0x5c7c8e&&_0x5c7c8e[_0x8b49('0xe')]?_0x5c7c8e[_0x8b49('0xe')]:'00:00:00:00:00:00','ipAddress':_0x5c7c8e&&_0x5c7c8e[_0x8b49('0xf')]?_0x5c7c8e['address']:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2edf99=_[_0x8b49('0x10')](os[_0x8b49('0x11')]()['map'](function(_0x290f4d){return _0x290f4d[_0x8b49('0x12')];}))[_0x8b49('0x13')](':');return crypto['createHash']('md5')[_0x8b49('0x14')](_0x2edf99)[_0x8b49('0x15')](_0x8b49('0x16'));}exports['getUuid']=function(){var _0x1e591a=os[_0x8b49('0x17')]();var _0x3e1ed2=/[0-9a-f-]{36}/;if(config[_0x8b49('0x18')]&&_0x3e1ed2[_0x8b49('0x19')](config[_0x8b49('0x18')])){return config['licenseToken'];}else if(_0x1e591a===_0x8b49('0x1a')){return exec(_0x8b49('0x1b'),{'encoding':'utf8'})[_0x8b49('0x1c')]('\x0d\x0a','');}else{var _0x1aba00=getFirstInterface();var _0x391cc2=getCPUhash();var _0x4ed333=_0x391cc2+'|'+os[_0x8b49('0x1d')]()+'|'+_0x1aba00[_0x8b49('0x1e')]+'|'+_0x1aba00[_0x8b49('0x1f')];var _0x25b8f7=crypto['createHash']('md5')['update'](_0x4ed333)['digest'](_0x8b49('0x16'));return _0x25b8f7['substring'](0x0,0x8)+'-'+_0x25b8f7['substring'](0x8,0xc)+'-'+_0x25b8f7[_0x8b49('0x20')](0xc,0x10)+'-'+_0x25b8f7['substring'](0x10,0x14)+'-'+_0x25b8f7['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index e2fd99a..e47341b 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 _0xe41b=['toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','util','moment','request-promise','bluebird','version','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x3907c5,_0x2d5d79){var _0x530d36=function(_0x26809d){while(--_0x26809d){_0x3907c5['push'](_0x3907c5['shift']());}};_0x530d36(++_0x2d5d79);}(_0xe41b,0x1b1));var _0xbe41=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xe41b[_0x373dee];return _0x46798f;};'use strict';var util=require(_0xbe41('0x0'));var moment=require(_0xbe41('0x1'));var rp=require(_0xbe41('0x2'));var BPromise=require(_0xbe41('0x3'));var pkginfo=require('pkginfo')(module,_0xbe41('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xbe41('0x5'));var hardware=require(_0xbe41('0x6'));var logger=require(_0xbe41('0x7'))('license');var HOST=_0xbe41('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4e8ef1){return new BPromise(function(_0x20eda9,_0x233102){var _0x558e26=util[_0xbe41('0x9')](_0xbe41('0xa'),HOST,_0x4e8ef1,module[_0xbe41('0xb')][_0xbe41('0x4')]);if(oldToken){_0x558e26=util['format'](_0xbe41('0xc'),HOST,_0x4e8ef1,module[_0xbe41('0xb')][_0xbe41('0x4')],oldToken);}var _0x204ce2={'uri':_0x558e26,'method':_0xbe41('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x204ce2)[_0xbe41('0xe')](function(_0x117198){_0x20eda9(_0x117198);})[_0xbe41('0xf')](function(_0x26cbf0){_0x233102(_0x26cbf0);});});}function manageLicense(_0x528d75,_0x4a5baf){var _0x1346f5=_0x4a5baf['get']({'plain':!![]});if(!isOldTokenSent&&_0x1346f5[_0xbe41('0x10')]!==_0x528d75&&!_0x1346f5[_0xbe41('0x11')]){oldToken=_0x1346f5[_0xbe41('0x10')];}httpRequest(_0x528d75)[_0xbe41('0xe')](function(_0x307489){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x307489[_0xbe41('0x12')]){isOldTokenSent=![];if(!_0x1346f5[_0xbe41('0x13')]&&_0x1346f5[_0xbe41('0x13')]!=_0x307489[_0xbe41('0x13')]||_0x1346f5['license']&&_0x1346f5[_0xbe41('0x11')]){logger[_0xbe41('0x14')](_0xbe41('0x15'));}if(_0x1346f5[_0xbe41('0x13')]&&!_0x1346f5[_0xbe41('0x11')]&&_0x1346f5[_0xbe41('0x13')]!=_0x307489[_0xbe41('0x13')]){logger['info'](_0xbe41('0x16'));}if(_0x1346f5[_0xbe41('0x13')]&&!_0x1346f5[_0xbe41('0x11')]&&_0x1346f5[_0xbe41('0x13')]==_0x307489[_0xbe41('0x13')]){return _0x4a5baf;}return _0x4a5baf[_0xbe41('0x17')]({'data1':_0x528d75,'data2':null,'license':_0x307489[_0xbe41('0x13')]});}else{if(_0x307489['license']||_0x1346f5[_0xbe41('0x13')]){if(!_0x1346f5['data2']){if(_0x1346f5[_0xbe41('0x10')]==_0x528d75){GRAY_PERIOD_REASON=_0xbe41('0x18');logger[_0xbe41('0x14')](_0xbe41('0x19'));}else{GRAY_PERIOD_REASON=_0xbe41('0x1a');logger[_0xbe41('0x14')](_0xbe41('0x1b'),_0x1346f5[_0xbe41('0x10')],_0x528d75);}logger[_0xbe41('0x14')](_0xbe41('0x1c'),GRAY_PERIOD_REASON[_0xbe41('0x1d')](),moment()[_0xbe41('0x9')](_0xbe41('0x1e')));return _0x4a5baf[_0xbe41('0x17')]({'data2':encryptor[_0xbe41('0x1f')](moment()[_0xbe41('0x9')](_0xbe41('0x1e')))});}else{if(moment()[_0xbe41('0x20')](encryptor[_0xbe41('0x21')](_0x1346f5[_0xbe41('0x11')]),_0xbe41('0x22'))>DAYS){logger[_0xbe41('0x14')](_0xbe41('0x23'),moment()[_0xbe41('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4a5baf[_0xbe41('0x17')]({'data1':_0x528d75,'data2':null,'license':null});}}}else{if(_0x1346f5[_0xbe41('0x10')]!=_0x528d75){logger[_0xbe41('0x14')](_0xbe41('0x1b'),_0x1346f5[_0xbe41('0x10')],_0x528d75);return _0x4a5baf[_0xbe41('0x17')]({'data1':_0x528d75,'data2':null,'license':null});}}}return _0x4a5baf;})['then'](function(_0xf1504){_0x4a5baf=_0xf1504;})[_0xbe41('0xf')](function(_0x3775f0){logger[_0xbe41('0x24')](_0x3775f0[_0xbe41('0x25')]);})[_0xbe41('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0xbe41('0x27')](),_0x4a5baf);},TIME);});}function defaultLicense(){var _0x11a066=hardware['getUuid']();if(_0x11a066){return db[_0xbe41('0x28')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x11a066}})[_0xbe41('0x29')](function(_0x2e1d1f,_0x3179f8){logger[_0xbe41('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x11a066);manageLicense(_0x11a066,_0x2e1d1f);})[_0xbe41('0xf')](function(_0x45f545){logger[_0xbe41('0x24')](_0x45f545[_0xbe41('0x25')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x25e6=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','active','license','data2'];(function(_0x49c406,_0x1e03e6){var _0x212d85=function(_0x36afaa){while(--_0x36afaa){_0x49c406['push'](_0x49c406['shift']());}};_0x212d85(++_0x1e03e6);}(_0x25e6,0x10c));var _0x625e=function(_0x1001c3,_0x825a9d){_0x1001c3=_0x1001c3-0x0;var _0x23778f=_0x25e6[_0x1001c3];return _0x23778f;};'use strict';var util=require(_0x625e('0x0'));var moment=require(_0x625e('0x1'));var rp=require(_0x625e('0x2'));var BPromise=require(_0x625e('0x3'));var pkginfo=require(_0x625e('0x4'))(module,_0x625e('0x5'));var db=require(_0x625e('0x6'))['db'];var encryptor=require(_0x625e('0x7'));var hardware=require('./hardware');var logger=require(_0x625e('0x8'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x20f2f9){return new BPromise(function(_0xd269c4,_0x413ad9){var _0x2c4985=util[_0x625e('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x20f2f9,module[_0x625e('0xa')][_0x625e('0x5')]);if(oldToken){_0x2c4985=util[_0x625e('0x9')](_0x625e('0xb'),HOST,_0x20f2f9,module['exports'][_0x625e('0x5')],oldToken);}var _0x5a2666={'uri':_0x2c4985,'method':_0x625e('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x5a2666)[_0x625e('0xd')](function(_0x3b0664){_0xd269c4(_0x3b0664);})[_0x625e('0xe')](function(_0x3b49ae){_0x413ad9(_0x3b49ae);});});}function manageLicense(_0x4166e9,_0x22cdf5){var _0x1f43ef=_0x22cdf5['get']({'plain':!![]});if(!isOldTokenSent&&_0x1f43ef[_0x625e('0xf')]!==_0x4166e9&&!_0x1f43ef['data2']){oldToken=_0x1f43ef[_0x625e('0xf')];}httpRequest(_0x4166e9)['then'](function(_0x6eb35a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6eb35a[_0x625e('0x10')]){isOldTokenSent=![];if(!_0x1f43ef[_0x625e('0x11')]&&_0x1f43ef[_0x625e('0x11')]!=_0x6eb35a[_0x625e('0x11')]||_0x1f43ef[_0x625e('0x11')]&&_0x1f43ef[_0x625e('0x12')]){logger['info'](_0x625e('0x13'));}if(_0x1f43ef[_0x625e('0x11')]&&!_0x1f43ef['data2']&&_0x1f43ef[_0x625e('0x11')]!=_0x6eb35a[_0x625e('0x11')]){logger[_0x625e('0x14')](_0x625e('0x15'));}if(_0x1f43ef[_0x625e('0x11')]&&!_0x1f43ef[_0x625e('0x12')]&&_0x1f43ef['license']==_0x6eb35a[_0x625e('0x11')]){return _0x22cdf5;}return _0x22cdf5[_0x625e('0x16')]({'data1':_0x4166e9,'data2':null,'license':_0x6eb35a[_0x625e('0x11')]});}else{if(_0x6eb35a[_0x625e('0x11')]||_0x1f43ef[_0x625e('0x11')]){if(!_0x1f43ef['data2']){if(_0x1f43ef[_0x625e('0xf')]==_0x4166e9){GRAY_PERIOD_REASON=_0x625e('0x17');logger[_0x625e('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x625e('0x18');logger[_0x625e('0x14')](_0x625e('0x19'),_0x1f43ef[_0x625e('0xf')],_0x4166e9);}logger['info'](_0x625e('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x625e('0x9')](_0x625e('0x1b')));return _0x22cdf5['update']({'data2':encryptor[_0x625e('0x1c')](moment()['format'](_0x625e('0x1b')))});}else{if(moment()[_0x625e('0x1d')](encryptor[_0x625e('0x1e')](_0x1f43ef[_0x625e('0x12')]),_0x625e('0x1f'))>DAYS){logger[_0x625e('0x14')](_0x625e('0x20'),moment()['format'](_0x625e('0x1b')));isOldTokenSent=![];return _0x22cdf5[_0x625e('0x16')]({'data1':_0x4166e9,'data2':null,'license':null});}}}else{if(_0x1f43ef['data1']!=_0x4166e9){logger[_0x625e('0x14')](_0x625e('0x19'),_0x1f43ef[_0x625e('0xf')],_0x4166e9);return _0x22cdf5[_0x625e('0x16')]({'data1':_0x4166e9,'data2':null,'license':null});}}}return _0x22cdf5;})['then'](function(_0x182680){_0x22cdf5=_0x182680;})[_0x625e('0xe')](function(_0x154213){logger[_0x625e('0x21')](_0x154213[_0x625e('0x22')]);})[_0x625e('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x625e('0x24')](),_0x22cdf5);},TIME);});}function defaultLicense(){var _0x2d4d45=hardware[_0x625e('0x24')]();if(_0x2d4d45){return db[_0x625e('0x25')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2d4d45}})[_0x625e('0x26')](function(_0x34bad4,_0xf39d45){logger['info'](_0x625e('0x27'),_0x2d4d45);manageLicense(_0x2d4d45,_0x34bad4);})[_0x625e('0xe')](function(_0xf3d14e){logger[_0x625e('0x21')](_0xf3d14e[_0x625e('0x22')]);});}}exports[_0x625e('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f760b15..0ac5f38 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 _0xa6c9=['../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','add','days','disabled','message','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','users','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','bluebird','../../components/encryptor'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6c9,0xad));var _0x9a6c=function(_0x2607b7,_0x5c4f4b){_0x2607b7=_0x2607b7-0x0;var _0x462002=_0xa6c9[_0x2607b7];return _0x462002;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9a6c('0x0'));var BPromise=require(_0x9a6c('0x1'));var hardware=require('./hardware');var encryptor=require(_0x9a6c('0x2'));var db=require(_0x9a6c('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a6c('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9a6c('0x5'),'machineUuid':hardware[_0x9a6c('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9a6c('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9a6c('0x7'),'machineUuid':hardware[_0x9a6c('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5e5780){return new BPromise(function(_0x3b40fa,_0x2c4ac5){return db[_0x9a6c('0x8')][_0x9a6c('0x9')](_[_0x9a6c('0xa')](_0x5e5780,{'raw':!![],'where':{'id':0x1}}))[_0x9a6c('0xb')](function(_0x5a6a97){return checkLicense(_0x5a6a97,null);})['then'](function(_0x37a5dd){_0x3b40fa(_0x37a5dd);return;})[_0x9a6c('0xc')](function(_0xeda975){_0x2c4ac5(_0xeda975);});});}function checkLicense(_0x223841,_0x41e540){if(!_0x223841){demoLicense[_0x9a6c('0xd')]=_0x223841[_0x9a6c('0xe')];return demoLicense;}try{var _0x26c2e9=_0x41e540||_0x223841[_0x9a6c('0xf')];if(_[_0x9a6c('0x10')](_0x26c2e9)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x42246f=_0x223841[_0x9a6c('0xe')];var _0x327b56=_0x223841[_0x9a6c('0x11')];var _0x4f521f=_0x42246f[_0x9a6c('0x12')]('-')[0x4];var _0x3fab4f=_0x42246f[_0x9a6c('0x12')]('-')[0x0];var _0x40a888=encryptor[_0x9a6c('0x13')](_0x26c2e9,util[_0x9a6c('0x14')](_0x9a6c('0x15'),_0x4f521f,_0x42246f,_0x3fab4f));var _0x1c44fc=JSON[_0x9a6c('0x16')](_0x40a888);_0x1c44fc[_0x9a6c('0x17')]=![];_0x1c44fc[_0x9a6c('0xd')]=_0x42246f;_0x1c44fc['machineUuid']=hardware['getUuid']();if(_0x327b56){var _0x31e689=encryptor[_0x9a6c('0x13')](_0x327b56);_0x1c44fc[_0x9a6c('0x18')]=_0x31e689;_0x1c44fc['deadline']=moment(_0x31e689)[_0x9a6c('0x19')](0x7,_0x9a6c('0x1a'))[_0x9a6c('0x14')]();_0x1c44fc['grayReason']=_0x1c44fc['uuid']!=_0x1c44fc['machineUuid']?'changed':_0x9a6c('0x1b');}return _0x1c44fc;}catch(_0x337356){breakingLicense[_0x9a6c('0xd')]=_0x223841[_0x9a6c('0xe')];breakingLicense[_0x9a6c('0x1c')]=_0x337356[_0x9a6c('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x48206f,_0x11048a){getLicense()['then'](function(_0x3f20cf){return db['User'][_0x9a6c('0x1d')]({'attributes':[_0x9a6c('0x1e'),[db['sequelize']['fn'](_0x9a6c('0x1f'),db[_0x9a6c('0x20')][_0x9a6c('0x21')](_0x9a6c('0x1e'))),_0x9a6c('0x22')]],'group':_0x9a6c('0x1e'),'where':{'role':{'$or':[_0x9a6c('0x23'),_0x9a6c('0x24'),_0x9a6c('0x25')]}},'raw':!![]})['then'](function(_0x3713e9){var _0x1f5161={'user':_0x3f20cf[_0x9a6c('0x26')]||0x0,'telephone':_0x3f20cf['telephones']||0x0};_0x3713e9['forEach'](function(_0x59d307){var _0x2c72fb=_0x59d307[_0x9a6c('0x1e')]==='admin'?_0x9a6c('0x24'):_0x59d307['role'];_0x1f5161[_0x2c72fb]-=_0x59d307[_0x9a6c('0x22')];if(_0x1f5161[_0x2c72fb]<0x0)_0x1f5161[_0x2c72fb]=0x0;});_0x48206f(_0x1f5161);return;});})[_0x9a6c('0xc')](function(_0x616295){_0x11048a(_0x616295);});});}function checkUserLimits(_0x3f3d40){return new BPromise(function(_0x31fb5f,_0x477ed2){getLimits()[_0x9a6c('0xb')](function(_0x56ae21){var _0x558084=_[_0x9a6c('0x27')](_[_0x9a6c('0x28')](_0x3f3d40,_0x9a6c('0x1e')),[_0x9a6c('0x23'),_0x9a6c('0x24'),_0x9a6c('0x25')]);var _0x561346=(_0x558084[_0x9a6c('0x23')]||0x0)+(_0x558084[_0x9a6c('0x24')]||0x0);var _0x46c3a2=_0x558084[_0x9a6c('0x25')]||0x0;if(_0x561346>_0x56ae21['user'])return _0x477ed2(_0x9a6c('0x29'));if(_0x46c3a2>_0x56ae21['telephone'])return _0x477ed2(_0x9a6c('0x2a'));return _0x31fb5f();})[_0x9a6c('0xc')](function(_0x5b453f){_0x477ed2(_0x5b453f);});});}module[_0x9a6c('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xa5a6=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','catch','uuid','license','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','deadline','days','format','grayReason','changed','message','then','findAll','role','sequelize','COUNT','col','count','admin','user','users','telephones','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa5a6,0xb6));var _0x6a5a=function(_0xe4936,_0x3cd5c0){_0xe4936=_0xe4936-0x0;var _0x254fee=_0xa5a6[_0xe4936];return _0x254fee;};'use strict';var util=require(_0x6a5a('0x0'));var _=require(_0x6a5a('0x1'));var moment=require(_0x6a5a('0x2'));var BPromise=require(_0x6a5a('0x3'));var hardware=require('./hardware');var encryptor=require(_0x6a5a('0x4'));var db=require(_0x6a5a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6a5a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6a5a('0x7'),'machineUuid':hardware[_0x6a5a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6a5a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6a5a('0x9'),'machineUuid':hardware[_0x6a5a('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1dc32e){return new BPromise(function(_0x2dfeba,_0x42cc61){return db[_0x6a5a('0xa')]['find'](_['defaults'](_0x1dc32e,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5dd8e6){return checkLicense(_0x5dd8e6,null);})['then'](function(_0x3b9953){_0x2dfeba(_0x3b9953);return;})[_0x6a5a('0xb')](function(_0x5af098){_0x42cc61(_0x5af098);});});}function checkLicense(_0x30f120,_0x2c5dcf){if(!_0x30f120){demoLicense[_0x6a5a('0xc')]=_0x30f120['data1'];return demoLicense;}try{var _0xbc8bd5=_0x2c5dcf||_0x30f120[_0x6a5a('0xd')];if(_['isEmpty'](_0xbc8bd5)){throw new Error(_0x6a5a('0xe'));}var _0x8addfd=_0x30f120[_0x6a5a('0xf')];var _0x430083=_0x30f120[_0x6a5a('0x10')];var _0x4884c3=_0x8addfd[_0x6a5a('0x11')]('-')[0x4];var _0x14b451=_0x8addfd[_0x6a5a('0x11')]('-')[0x0];var _0x5700fb=encryptor[_0x6a5a('0x12')](_0xbc8bd5,util['format'](_0x6a5a('0x13'),_0x4884c3,_0x8addfd,_0x14b451));var _0x289966=JSON[_0x6a5a('0x14')](_0x5700fb);_0x289966[_0x6a5a('0x15')]=![];_0x289966[_0x6a5a('0xc')]=_0x8addfd;_0x289966[_0x6a5a('0x16')]=hardware[_0x6a5a('0x8')]();if(_0x430083){var _0x417cd7=encryptor[_0x6a5a('0x12')](_0x430083);_0x289966[_0x6a5a('0x17')]=_0x417cd7;_0x289966[_0x6a5a('0x18')]=moment(_0x417cd7)['add'](0x7,_0x6a5a('0x19'))[_0x6a5a('0x1a')]();_0x289966[_0x6a5a('0x1b')]=_0x289966[_0x6a5a('0xc')]!=_0x289966[_0x6a5a('0x16')]?_0x6a5a('0x1c'):'disabled';}return _0x289966;}catch(_0x5e9569){breakingLicense['uuid']=_0x30f120[_0x6a5a('0xf')];breakingLicense[_0x6a5a('0x1d')]=_0x5e9569[_0x6a5a('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x419d8b,_0x43c77b){getLicense()[_0x6a5a('0x1e')](function(_0x3671d2){return db['User'][_0x6a5a('0x1f')]({'attributes':[_0x6a5a('0x20'),[db[_0x6a5a('0x21')]['fn'](_0x6a5a('0x22'),db['sequelize'][_0x6a5a('0x23')]('role')),_0x6a5a('0x24')]],'group':_0x6a5a('0x20'),'where':{'role':{'$or':[_0x6a5a('0x25'),_0x6a5a('0x26'),'telephone']}},'raw':!![]})[_0x6a5a('0x1e')](function(_0x2d1261){var _0x4e88b1={'user':_0x3671d2[_0x6a5a('0x27')]||0x0,'telephone':_0x3671d2[_0x6a5a('0x28')]||0x0};_0x2d1261['forEach'](function(_0x4379d9){var _0x547b1c=_0x4379d9['role']===_0x6a5a('0x25')?_0x6a5a('0x26'):_0x4379d9['role'];_0x4e88b1[_0x547b1c]-=_0x4379d9['count'];if(_0x4e88b1[_0x547b1c]<0x0)_0x4e88b1[_0x547b1c]=0x0;});_0x419d8b(_0x4e88b1);return;});})[_0x6a5a('0xb')](function(_0x4abea8){_0x43c77b(_0x4abea8);});});}function checkUserLimits(_0x2140bf){return new BPromise(function(_0x5d3ad3,_0x56e1e1){getLimits()[_0x6a5a('0x1e')](function(_0x4277cd){var _0x35e86e=_[_0x6a5a('0x29')](_[_0x6a5a('0x2a')](_0x2140bf,_0x6a5a('0x20')),['admin',_0x6a5a('0x26'),_0x6a5a('0x2b')]);var _0x347a6a=(_0x35e86e[_0x6a5a('0x25')]||0x0)+(_0x35e86e['user']||0x0);var _0x4a42fa=_0x35e86e[_0x6a5a('0x2b')]||0x0;if(_0x347a6a>_0x4277cd[_0x6a5a('0x26')])return _0x56e1e1(_0x6a5a('0x2c'));if(_0x4a42fa>_0x4277cd[_0x6a5a('0x2b')])return _0x56e1e1(_0x6a5a('0x2d'));return _0x5d3ad3();})[_0x6a5a('0xb')](function(_0x117ba2){_0x56e1e1(_0x117ba2);});});}module[_0x6a5a('0x2e')]={'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 91146a9..26d8564 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 _0x47c5=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x6f4e55,_0x529a49){var _0x4c4281=function(_0x4de71d){while(--_0x4de71d){_0x6f4e55['push'](_0x6f4e55['shift']());}};_0x4c4281(++_0x529a49);}(_0x47c5,0x165));var _0x547c=function(_0x2322a8,_0x3cb189){_0x2322a8=_0x2322a8-0x0;var _0x5c980e=_0x47c5[_0x2322a8];return _0x5c980e;};'use strict';module[_0x547c('0x0')]={'DOMAIN':_0x547c('0x1'),'SESSION_SECRET':_0x547c('0x2'),'GOOGLE_ID':_0x547c('0x3'),'GOOGLE_SECRET':_0x547c('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x3266=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x53d5cf,_0x487709){var _0x10d7d8=function(_0x1747fa){while(--_0x1747fa){_0x53d5cf['push'](_0x53d5cf['shift']());}};_0x10d7d8(++_0x487709);}(_0x3266,0x6a));var _0x6326=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x3266[_0x49d41c];return _0xb64c5f;};'use strict';module[_0x6326('0x0')]={'DOMAIN':_0x6326('0x1'),'SESSION_SECRET':_0x6326('0x2'),'GOOGLE_ID':_0x6326('0x3'),'GOOGLE_SECRET':_0x6326('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2bd90e8..fb46650 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b50=['log','xcally','format','%s-%s.log','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','transports','%s-%s','error','File','debugLevel','moment','winston','util','path','INFO','join'];(function(_0x3260bc,_0x116ea7){var _0x3bd7f9=function(_0x436d31){while(--_0x436d31){_0x3260bc['push'](_0x3260bc['shift']());}};_0x3bd7f9(++_0x116ea7);}(_0x4b50,0x7e));var _0x04b5=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0x4b50[_0x5976f8];return _0x179715;};'use strict';var moment=require(_0x04b5('0x0'));var winston=require(_0x04b5('0x1'));var util=require(_0x04b5('0x2'));var path=require(_0x04b5('0x3'));var debugLevel=_0x04b5('0x4');function filename(_0x19055f,_0x413255){return path[_0x04b5('0x5')]('/var',_0x04b5('0x6'),_0x04b5('0x7'),util[_0x04b5('0x8')](_0x04b5('0x9'),_0x19055f,_0x413255));}function formatter(_0x1cf85e,_0xaf97d){_0xaf97d['message']=_0xaf97d['message'][_0x04b5('0xa')](/@@{/g,'{{{')[_0x04b5('0xa')](/}@@/g,_0x04b5('0xb'))[_0x04b5('0xa')](/@{/g,'{{')[_0x04b5('0xa')](/}@/g,'}}');return util[_0x04b5('0x8')](_0x04b5('0xc'),moment()[_0x04b5('0x8')](_0x04b5('0xd')),_0xaf97d[_0x04b5('0xe')][_0x04b5('0xf')](),_0x1cf85e,_0xaf97d[_0x04b5('0x10')]);}module['exports']=function(_0x12c765){return new winston['Logger']({'transports':[new winston[(_0x04b5('0x11'))]['File']({'name':util[_0x04b5('0x8')](_0x04b5('0x12'),_0x12c765,_0x04b5('0x13')),'filename':filename(_0x12c765,_0x04b5('0x13')),'level':_0x04b5('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x424b71){return formatter(_0x12c765,_0x424b71);}}),new winston['transports'][(_0x04b5('0x14'))]({'name':util[_0x04b5('0x8')](_0x04b5('0x12'),_0x12c765,'info'),'filename':filename(_0x12c765,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x564a79){return formatter(_0x12c765,_0x564a79);}}),new winston[(_0x04b5('0x11'))]['Console']({'level':process['env'][_0x04b5('0x15')]||debugLevel,'json':![],'formatter':function(_0x1284ad){return formatter(_0x12c765,_0x1284ad);}})]});}; \ No newline at end of file +var _0x0da9=['error','%s-%s','info','env','debugLevel','winston','path','INFO','join','/var','log','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','exports','Logger','transports','File'];(function(_0x171090,_0xa8ba62){var _0x2935b0=function(_0x5c9cba){while(--_0x5c9cba){_0x171090['push'](_0x171090['shift']());}};_0x2935b0(++_0xa8ba62);}(_0x0da9,0x102));var _0x90da=function(_0x254bbe,_0x44612d){_0x254bbe=_0x254bbe-0x0;var _0x42aae4=_0x0da9[_0x254bbe];return _0x42aae4;};'use strict';var moment=require('moment');var winston=require(_0x90da('0x0'));var util=require('util');var path=require(_0x90da('0x1'));var debugLevel=_0x90da('0x2');function filename(_0x66da49,_0x358f68){return path[_0x90da('0x3')](_0x90da('0x4'),_0x90da('0x5'),'xcally',util[_0x90da('0x6')](_0x90da('0x7'),_0x66da49,_0x358f68));}function formatter(_0x38a2f5,_0x1161f8){_0x1161f8[_0x90da('0x8')]=_0x1161f8[_0x90da('0x8')]['replace'](/@@{/g,_0x90da('0x9'))[_0x90da('0xa')](/}@@/g,_0x90da('0xb'))[_0x90da('0xa')](/@{/g,'{{')[_0x90da('0xa')](/}@/g,'}}');return util[_0x90da('0x6')](_0x90da('0xc'),moment()[_0x90da('0x6')](_0x90da('0xd')),_0x1161f8['level']['toUpperCase'](),_0x38a2f5,_0x1161f8[_0x90da('0x8')]);}module[_0x90da('0xe')]=function(_0x13d6e1){return new winston[(_0x90da('0xf'))]({'transports':[new winston[(_0x90da('0x10'))][(_0x90da('0x11'))]({'name':util[_0x90da('0x6')]('%s-%s',_0x13d6e1,_0x90da('0x12')),'filename':filename(_0x13d6e1,_0x90da('0x12')),'level':_0x90da('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x31d7cb){return formatter(_0x13d6e1,_0x31d7cb);}}),new winston[(_0x90da('0x10'))][(_0x90da('0x11'))]({'name':util[_0x90da('0x6')](_0x90da('0x13'),_0x13d6e1,_0x90da('0x14')),'filename':filename(_0x13d6e1,_0x90da('0x14')),'level':_0x90da('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3f1bad){return formatter(_0x13d6e1,_0x3f1bad);}}),new winston['transports']['Console']({'level':process[_0x90da('0x15')][_0x90da('0x16')]||debugLevel,'json':![],'formatter':function(_0x3f4273){return formatter(_0x13d6e1,_0x3f4273);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f77e74d..9b5042e 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 _0xac63=['agi','../../services/agi/index.js','email','xdr','../../services/xdr/index.js','express','../../services/express/index.js','ami','join'];(function(_0x4cd951,_0xf2d0fc){var _0x5ce54c=function(_0x257f98){while(--_0x257f98){_0x4cd951['push'](_0x4cd951['shift']());}};_0x5ce54c(++_0xf2d0fc);}(_0xac63,0x71));var _0x3ac6=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0xac63[_0x4dab14];return _0xf41aa;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x3ac6('0x0'),'script':path['join'](__dirname,_0x3ac6('0x1'))},{'name':_0x3ac6('0x2'),'script':path[_0x3ac6('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x3ac6('0x4'),'script':path[_0x3ac6('0x3')](__dirname,_0x3ac6('0x5'))},{'name':_0x3ac6('0x6'),'script':path[_0x3ac6('0x3')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x3ac6('0x3')](__dirname,'../../services/routing/index.js')},{'name':_0x3ac6('0x7'),'script':path['join'](__dirname,_0x3ac6('0x8'))}]};module['exports']=config; \ No newline at end of file +var _0x5bf9=['express','join','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path'];(function(_0xf91431,_0x43afe7){var _0x1b86ee=function(_0x32909b){while(--_0x32909b){_0xf91431['push'](_0xf91431['shift']());}};_0x1b86ee(++_0x43afe7);}(_0x5bf9,0x197));var _0x95bf=function(_0x1a74df,_0x43bd1e){_0x1a74df=_0x1a74df-0x0;var _0x581fd3=_0x5bf9[_0x1a74df];return _0x581fd3;};'use strict';var path=require(_0x95bf('0x0'));var os=require('os');var config={'apps':[{'name':_0x95bf('0x1'),'script':path[_0x95bf('0x2')](__dirname,_0x95bf('0x3'))},{'name':'ami','script':path[_0x95bf('0x2')](__dirname,_0x95bf('0x4'))},{'name':'agi','script':path['join'](__dirname,_0x95bf('0x5'))},{'name':_0x95bf('0x6'),'script':path[_0x95bf('0x2')](__dirname,_0x95bf('0x7'))},{'name':_0x95bf('0x8'),'script':path[_0x95bf('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x95bf('0x9'),'script':path[_0x95bf('0x2')](__dirname,_0x95bf('0xa'))}]};module[_0x95bf('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index c781e5a..1c926be 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 _0x3e39=['list','describe','delete','dump','saved','pm2','./config','connect','start','then','disconnect','stop','restart'];(function(_0x118120,_0x1e3aec){var _0x16d553=function(_0x392e8b){while(--_0x392e8b){_0x118120['push'](_0x118120['shift']());}};_0x16d553(++_0x1e3aec);}(_0x3e39,0x130));var _0x93e3=function(_0xdb7dbd,_0x79bcf7){_0xdb7dbd=_0xdb7dbd-0x0;var _0x359f01=_0x3e39[_0xdb7dbd];return _0x359f01;};'use strict';var pm2=require(_0x93e3('0x0'));var BPromise=require('bluebird');var config=require(_0x93e3('0x1'));function connect(){return new BPromise(function(_0xf3a15a,_0x2efec7){return pm2[_0x93e3('0x2')](function(_0x383a59){if(_0x383a59){return _0x2efec7(_0x383a59);}return _0xf3a15a('connected');});});};exports[_0x93e3('0x3')]=function(_0x192aac){return connect()[_0x93e3('0x4')](function(){return new BPromise(function(_0x270a1f,_0x34301b){return pm2[_0x93e3('0x3')](_0x192aac,function(_0x47e263,_0x4f90dc){if(_0x47e263){return _0x34301b(_0x47e263);}pm2[_0x93e3('0x5')]();return _0x270a1f(_0x4f90dc);});});});};exports[_0x93e3('0x6')]=function(_0xbdfb09){return connect()[_0x93e3('0x4')](function(){return new BPromise(function(_0x2859b9,_0x5ce774){return pm2[_0x93e3('0x6')](_0xbdfb09,function(_0xaca04b,_0x518f82){if(_0xaca04b){return _0x5ce774(_0xaca04b);}pm2[_0x93e3('0x5')]();return _0x2859b9(_0x518f82);});});});};exports[_0x93e3('0x7')]=function(_0x493281){return connect()['then'](function(){return new BPromise(function(_0x10fc78,_0x2db755){return pm2[_0x93e3('0x7')](_0x493281,function(_0x1e9923,_0x599719){if(_0x1e9923){return _0x2db755(_0x1e9923);}pm2[_0x93e3('0x5')]();return _0x10fc78(_0x599719);});});});};exports[_0x93e3('0x8')]=function(){return connect()[_0x93e3('0x4')](function(){return new BPromise(function(_0x2a5eef,_0xedd496){return pm2['list'](function(_0x4feec4,_0x37f3b9){if(_0x4feec4){return _0xedd496(_0x4feec4);}pm2['disconnect']();return _0x2a5eef(_0x37f3b9);});});});};exports[_0x93e3('0x9')]=function(_0x3dc0cd){return connect()[_0x93e3('0x4')](function(){return new BPromise(function(_0x1117ca,_0x1d817d){return pm2[_0x93e3('0x9')](_0x3dc0cd,function(_0x53fc48,_0x4a04e5){if(_0x53fc48){return _0x1d817d(_0x53fc48);}pm2['disconnect']();return _0x1117ca(_0x4a04e5);});});});};exports['delete']=function(_0x4fa4f6){return connect()[_0x93e3('0x4')](function(){return new BPromise(function(_0x3b21a6,_0x19e533){return pm2[_0x93e3('0xa')](_0x4fa4f6,function(_0x8f27b6,_0x551caa){if(_0x8f27b6){return _0x19e533(_0x8f27b6);}pm2[_0x93e3('0x5')]();return _0x3b21a6(_0x551caa);});});});};exports[_0x93e3('0xb')]=function(){return connect()[_0x93e3('0x4')](function(){return new BPromise(function(_0x50b46a,_0x2d1b2f){return pm2[_0x93e3('0xb')](function(_0x5eb1ee){if(_0x5eb1ee){return _0x2d1b2f(_0x5eb1ee);}return _0x50b46a(_0x93e3('0xc'));});});});}; \ No newline at end of file +var _0x19ef=['./config','start','disconnect','stop','restart','list','then','describe','delete','dump','saved','pm2','bluebird'];(function(_0x26bc36,_0x95e54){var _0x173490=function(_0xc1dacb){while(--_0xc1dacb){_0x26bc36['push'](_0x26bc36['shift']());}};_0x173490(++_0x95e54);}(_0x19ef,0x19e));var _0xf19e=function(_0xd5e913,_0x1992e9){_0xd5e913=_0xd5e913-0x0;var _0x44a7d4=_0x19ef[_0xd5e913];return _0x44a7d4;};'use strict';var pm2=require(_0xf19e('0x0'));var BPromise=require(_0xf19e('0x1'));var config=require(_0xf19e('0x2'));function connect(){return new BPromise(function(_0x2371ca,_0x1ca685){return pm2['connect'](function(_0x21d136){if(_0x21d136){return _0x1ca685(_0x21d136);}return _0x2371ca('connected');});});};exports[_0xf19e('0x3')]=function(_0xf79b6b){return connect()['then'](function(){return new BPromise(function(_0x11e673,_0x2f6e21){return pm2[_0xf19e('0x3')](_0xf79b6b,function(_0xfa6673,_0x2b5f67){if(_0xfa6673){return _0x2f6e21(_0xfa6673);}pm2[_0xf19e('0x4')]();return _0x11e673(_0x2b5f67);});});});};exports['stop']=function(_0x9231a1){return connect()['then'](function(){return new BPromise(function(_0x3d7fd2,_0xb07f85){return pm2[_0xf19e('0x5')](_0x9231a1,function(_0x24ef79,_0x53faeb){if(_0x24ef79){return _0xb07f85(_0x24ef79);}pm2[_0xf19e('0x4')]();return _0x3d7fd2(_0x53faeb);});});});};exports[_0xf19e('0x6')]=function(_0x526ce8){return connect()['then'](function(){return new BPromise(function(_0x44e273,_0x555f73){return pm2[_0xf19e('0x6')](_0x526ce8,function(_0x3b8d35,_0x147bf0){if(_0x3b8d35){return _0x555f73(_0x3b8d35);}pm2['disconnect']();return _0x44e273(_0x147bf0);});});});};exports[_0xf19e('0x7')]=function(){return connect()[_0xf19e('0x8')](function(){return new BPromise(function(_0x36f7a1,_0x2eda11){return pm2[_0xf19e('0x7')](function(_0x15e39d,_0x295952){if(_0x15e39d){return _0x2eda11(_0x15e39d);}pm2[_0xf19e('0x4')]();return _0x36f7a1(_0x295952);});});});};exports[_0xf19e('0x9')]=function(_0x43fd2f){return connect()['then'](function(){return new BPromise(function(_0x2b3381,_0x174595){return pm2[_0xf19e('0x9')](_0x43fd2f,function(_0xd199fb,_0x503f53){if(_0xd199fb){return _0x174595(_0xd199fb);}pm2[_0xf19e('0x4')]();return _0x2b3381(_0x503f53);});});});};exports[_0xf19e('0xa')]=function(_0x4bc3c7){return connect()[_0xf19e('0x8')](function(){return new BPromise(function(_0x302a5d,_0x779faa){return pm2[_0xf19e('0xa')](_0x4bc3c7,function(_0x34c5d4,_0x4553a7){if(_0x34c5d4){return _0x779faa(_0x34c5d4);}pm2['disconnect']();return _0x302a5d(_0x4553a7);});});});};exports[_0xf19e('0xb')]=function(){return connect()[_0xf19e('0x8')](function(){return new BPromise(function(_0x21ca8b,_0x25044a){return pm2[_0xf19e('0xb')](function(_0x37ad7a){if(_0x37ad7a){return _0x25044a(_0x37ad7a);}return _0x21ca8b(_0xf19e('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 3ec0342..1b22b85 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 _0xb048=['length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../logger','schedule','redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes'];(function(_0x329d55,_0x365bf5){var _0x462003=function(_0x12b615){while(--_0x12b615){_0x329d55['push'](_0x329d55['shift']());}};_0x462003(++_0x365bf5);}(_0xb048,0x1c1));var _0x8b04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb048[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8b04('0x0'));var moment=require(_0x8b04('0x1'));var Redis=require(_0x8b04('0x2'));var util=require(_0x8b04('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x8b04('0x4'))(_0x8b04('0x5'));config[_0x8b04('0x6')]=_['defaults'](config[_0x8b04('0x6')],{'host':_0x8b04('0x7'),'port':0x18eb});var io=require(_0x8b04('0x8'))(new Redis(config[_0x8b04('0x6')]));function closeInteractions(){var _0x12fa70=0x0;var _0x33ad71=[];return db['Setting'][_0x8b04('0x9')]({'raw':!![],'attributes':['id',_0x8b04('0xa')],'where':{'id':0x1}})[_0x8b04('0xb')](function(_0x3634fc){_0x12fa70=_0x3634fc[_0x8b04('0xa')];if(_0x12fa70){return db[_0x8b04('0xc')][_0x8b04('0xd')]({'raw':!![],'attributes':['id',_0x8b04('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3634fc[_0x8b04('0xa')],_0x8b04('0xf'))}}});}else{return[];}})[_0x8b04('0xb')](function(_0x21199b){if(_0x21199b&&_0x21199b[_0x8b04('0x10')]){_0x33ad71=_[_0x8b04('0x11')](_0x21199b||[],'id');logger[_0x8b04('0x12')](_0x8b04('0x13'),_0x33ad71[_0x8b04('0x14')]());return db[_0x8b04('0xc')]['update']({'closeReason':_0x8b04('0x15'),'disposition':_0x8b04('0x16'),'closed':!![],'closedAt':moment()[_0x8b04('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x33ad71}});}})['then'](function(){if(_0x33ad71&&_0x33ad71[_0x8b04('0x10')]){logger[_0x8b04('0x12')](_0x8b04('0x18'),_0x33ad71[_0x8b04('0x14')]());for(var _0x48d911=0x0;_0x48d911<_0x33ad71[_0x8b04('0x10')];_0x48d911++){io[_0x8b04('0x19')](_0x8b04('0x1a'),{'id':_0x33ad71[_0x48d911],'closed':!![]});}}})[_0x8b04('0x1b')](function(_0x32c44e){logger[_0x8b04('0x1c')](_0x8b04('0x1d'),_0x32c44e?util[_0x8b04('0x1e')](_0x32c44e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x57fb=['Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','length','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','socket.io-emitter'];(function(_0x259969,_0x4b8eb5){var _0x3c9fcb=function(_0x117766){while(--_0x117766){_0x259969['push'](_0x259969['shift']());}};_0x3c9fcb(++_0x4b8eb5);}(_0x57fb,0x141));var _0xb57f=function(_0x4fffa7,_0x147ecc){_0x4fffa7=_0x4fffa7-0x0;var _0x2d2a94=_0x57fb[_0x4fffa7];return _0x2d2a94;};'use strict';var _=require(_0xb57f('0x0'));var moment=require(_0xb57f('0x1'));var Redis=require(_0xb57f('0x2'));var util=require(_0xb57f('0x3'));var config=require(_0xb57f('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xb57f('0x5'))(_0xb57f('0x6'));config[_0xb57f('0x7')]=_['defaults'](config[_0xb57f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb57f('0x8'))(new Redis(config[_0xb57f('0x7')]));function closeInteractions(){var _0x3e13c2=0x0;var _0x117873=[];return db[_0xb57f('0x9')][_0xb57f('0xa')]({'raw':!![],'attributes':['id',_0xb57f('0xb')],'where':{'id':0x1}})[_0xb57f('0xc')](function(_0x41fd3b){_0x3e13c2=_0x41fd3b[_0xb57f('0xb')];if(_0x3e13c2){return db[_0xb57f('0xd')]['findAll']({'raw':!![],'attributes':['id',_0xb57f('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x41fd3b[_0xb57f('0xb')],'minutes')}}});}else{return[];}})['then'](function(_0x340926){if(_0x340926&&_0x340926['length']){_0x117873=_[_0xb57f('0xf')](_0x340926||[],'id');logger[_0xb57f('0x10')](_0xb57f('0x11'),_0x117873[_0xb57f('0x12')]());return db[_0xb57f('0xd')][_0xb57f('0x13')]({'closeReason':_0xb57f('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb57f('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x117873}});}})[_0xb57f('0xc')](function(){if(_0x117873&&_0x117873[_0xb57f('0x16')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x117873[_0xb57f('0x12')]());for(var _0x181303=0x0;_0x181303<_0x117873[_0xb57f('0x16')];_0x181303++){io[_0xb57f('0x17')](_0xb57f('0x18'),{'id':_0x117873[_0x181303],'closed':!![]});}}})[_0xb57f('0x19')](function(_0x4dcbde){logger[_0xb57f('0x1a')](_0xb57f('0x1b'),_0x4dcbde?util[_0xb57f('0x1c')](_0x4dcbde,{'showHidden':![],'depth':null}):'');});}exports[_0xb57f('0x1d')]=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 259e2fb..d1bb997 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 _0x2c23=['port','secure','authentication','user','pass','\x22%s\x22\x20<%s>','name','format','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','Sent','attachments','message','text','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','catch','data','subtractNumber','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','index','my\x20id','cron','start','add\x20cron','deleteJob','stop\x20cron','active','startAt','endAt','update\x20cron','util','lodash','moment','cron-job-manager','jayson/promise','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x2c23,0x139));var _0x32c2=function(_0x1d4c33,_0x30274f){_0x1d4c33=_0x1d4c33-0x0;var _0x3abfa2=_0x2c23[_0x1d4c33];return _0x3abfa2;};'use strict';var fs=require('fs');var util=require(_0x32c2('0x0'));var path=require('path');var _=require(_0x32c2('0x1'));var moment=require(_0x32c2('0x2'));var CronJobManager=require(_0x32c2('0x3'));var jayson=require(_0x32c2('0x4'));var BPromise=require('bluebird');var logger=require('../logger')('schedule');var db=require(_0x32c2('0x5'))['db'];var analyticCustomReportController=require(_0x32c2('0x6'));var analyticDefaultReportController=require(_0x32c2('0x7'));var client=jayson[_0x32c2('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x133235,_0x333f05){return function(){logger['info'](_0x32c2('0x9'),_0x133235[_0x32c2('0xa')]);var _0x5c42d9=!![];var _0x4fece9={'tls':{'rejectUnauthorized':![]}};if(_0x133235[_0x32c2('0xb')][_0x32c2('0xc')][_0x32c2('0xd')]){_0x4fece9[_0x32c2('0xd')]=_0x133235[_0x32c2('0xb')][_0x32c2('0xc')][_0x32c2('0xd')];}else{_0x4fece9[_0x32c2('0xe')]=_0x133235[_0x32c2('0xb')]['Smtp'][_0x32c2('0xe')];_0x4fece9['port']=_0x133235['MailAccount'][_0x32c2('0xc')][_0x32c2('0xf')];_0x4fece9[_0x32c2('0x10')]=_0x133235[_0x32c2('0xb')][_0x32c2('0xc')][_0x32c2('0x10')];}if(_0x133235[_0x32c2('0xb')][_0x32c2('0xc')][_0x32c2('0x11')]){_0x4fece9['auth']={'user':_0x133235[_0x32c2('0xb')]['Smtp'][_0x32c2('0x12')],'pass':_0x133235[_0x32c2('0xb')]['Smtp'][_0x32c2('0x13')]};}var _0xfa1a34={'account':_0x4fece9,'message':{'from':util['format'](_0x32c2('0x14'),_0x133235[_0x32c2('0xb')][_0x32c2('0x15')],_0x133235['MailAccount']['email']||_0x133235[_0x32c2('0xb')][_0x32c2('0xc')][_0x32c2('0x12')]),'to':_0x133235['email'],'cc':_0x133235['cc'],'bcc':_0x133235['bcc'],'subject':util[_0x32c2('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x333f05[_0x32c2('0x15')],_0x133235['subtractNumber'],_0x133235[_0x32c2('0x17')])}};var _0x339908=path[_0x32c2('0x18')](__dirname,_0x32c2('0x19'));var _0x5a0081=_0x333f05[_0x32c2('0x1a')];var _0x67ee63=util[_0x32c2('0x16')](_0x32c2('0x1b'),path['basename'](_0x333f05['savename'],path[_0x32c2('0x1c')](_0x333f05[_0x32c2('0x1a')])),_0x32c2('0x1d'));var _0x35a83f=path['join'](_0x339908,_0x5a0081);var _0x446b50=path[_0x32c2('0x18')](_0x339908,_0x67ee63);if(fs[_0x32c2('0x1e')](_0x35a83f)){_0x333f05['status']=_0x32c2('0x1f');_0xfa1a34['message'][_0x32c2('0x20')]=[{'filename':_0x5a0081,'path':_0x35a83f}];_0xfa1a34[_0x32c2('0x21')][_0x32c2('0x22')]=util[_0x32c2('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x32c2('0x23')](_0x333f05,null,0x2));}else if(fs[_0x32c2('0x1e')](_0x446b50)){_0x333f05[_0x32c2('0x24')]=_0x32c2('0x1f');_0xfa1a34[_0x32c2('0x21')][_0x32c2('0x20')]=[{'filename':_0x67ee63,'path':_0x446b50}];}else{_0xfa1a34[_0x32c2('0x21')][_0x32c2('0x22')]=_0x32c2('0x25');if(!_0x133235['sendIfEmpty']){_0x5c42d9=![];logger[_0x32c2('0x26')](_0x32c2('0x27'));}}if(_0x5c42d9){return client[_0x32c2('0x28')](_0x32c2('0x29'),_0xfa1a34)['then'](function(_0x34b034){if(_0x34b034[_0x32c2('0x2a')]){return logger['error'](_0x32c2('0x2b'),JSON[_0x32c2('0x23')](_0x34b034));}return logger[_0x32c2('0x26')]('email\x20sent');})[_0x32c2('0x2c')](function(_0x490a0b){return logger['error'](_0x32c2('0x2b'),JSON[_0x32c2('0x23')](_0x490a0b));});}};}function handleError(){return function(_0x33570d){return logger[_0x32c2('0x2a')](JSON[_0x32c2('0x23')](_0x33570d));};}function handleResult(_0x4c4e72){return function(_0x4ff062){logger[_0x32c2('0x26')](_0x32c2('0x2d'),JSON[_0x32c2('0x23')](_0x4ff062));if(_0x4c4e72[_0x32c2('0xb')]&&_0x4c4e72[_0x32c2('0xb')][_0x32c2('0xc')]&&!_['isNil'](_0x4c4e72['email'])){setTimeout(handleSendEmail(_0x4c4e72,_0x4ff062),0x3c*0x3e8);}};}function handleJob(_0x54562d){return function(){try{if(_['isNil'](_0x54562d[_0x32c2('0x2e')])){return logger[_0x32c2('0x26')](_0x32c2('0x2f'));}if(_[_0x32c2('0x30')](_0x54562d[_0x32c2('0x17')])){return logger[_0x32c2('0x26')](_0x32c2('0x31'));}var _0x999308={'startDate':moment()[_0x32c2('0x32')](_0x54562d[_0x32c2('0x2e')],_0x54562d[_0x32c2('0x17')])[_0x32c2('0x16')](_0x32c2('0x33')),'endDate':moment()[_0x32c2('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x32c2('0x34'),'output':_0x54562d[_0x32c2('0x35')],'name':_0x54562d['name']};if(!_['isNil'](_0x54562d[_0x32c2('0x36')])){logger[_0x32c2('0x26')]('exec\x20defaul\x20report\x20id:%s',_0x54562d[_0x32c2('0x36')]);return analyticDefaultReportController[_0x32c2('0x37')]({'id':_0x54562d[_0x32c2('0x36')]},_0x999308)[_0x32c2('0x38')](handleResult(_0x54562d))[_0x32c2('0x2c')](handleError());}if(!_[_0x32c2('0x30')](_0x54562d['CustomReportId'])){logger['info'](_0x32c2('0x39'),_0x54562d[_0x32c2('0x3a')]);return analyticCustomReportController[_0x32c2('0x37')]({'id':_0x54562d['CustomReportId']},_0x999308)[_0x32c2('0x38')](handleResult(_0x54562d))[_0x32c2('0x2c')](handleError());}}catch(_0x2f567f){logger['error'](JSON[_0x32c2('0x23')](_0x2f567f));}return logger[_0x32c2('0x26')](_0x32c2('0x3b'));};}function getJobs(_0x216f06){var _0x3d30ef={};if(_0x216f06){_0x3d30ef['id']=_0x216f06;}return db[_0x32c2('0x3c')]['findAll']({'where':_0x3d30ef,'include':[{'model':db[_0x32c2('0xb')],'attributes':['id',_0x32c2('0x15'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x32c2('0xc')}]}]})[_0x32c2('0x38')](function(_0x32d348){var _0x59715b=_[_0x32c2('0x3d')](manager[_0x32c2('0x3e')]);var _0x3a6928=_['map'](_0x32d348,function(_0x135738){return _0x135738['id'][_0x32c2('0x3f')]();});var _0x1a3693=_[_0x32c2('0x40')](_0x32d348,function(_0x5354bc){return _0x5354bc['id'][_0x32c2('0x3f')]();});var _0x28a364=_0x216f06?_0x3a6928:_[_0x32c2('0x41')](_0x3a6928,_0x59715b);var _0x177e18=_[_0x32c2('0x42')](_0x3a6928,_0x59715b);var _0x4c68f7=_[_0x32c2('0x41')](_0x59715b,_0x3a6928);var _0x12636d;var _0x4ba1cd;for(_0x12636d=0x0;_0x12636d<_0x4c68f7[_0x32c2('0x43')]&&!_0x216f06;_0x12636d+=0x1){_0x4ba1cd=_0x4c68f7[_0x12636d]['toString']();if(manager[_0x32c2('0x44')](_0x4ba1cd)){manager[_0x32c2('0x45')](_0x4ba1cd);manager['deleteJob'](_0x4ba1cd);logger[_0x32c2('0x26')](_0x32c2('0x46'),_0x4ba1cd);}}logger[_0x32c2('0x26')]('toRun',JSON[_0x32c2('0x23')](_0x28a364));for(_0x12636d=0x0;_0x12636d<_0x28a364['length'];_0x12636d+=0x1){_0x4ba1cd=_0x28a364[_0x12636d][_0x32c2('0x3f')]();logger['info'](_0x32c2('0x47'),_0x4ba1cd);if(_0x216f06){logger['info'](_0x32c2('0x48'),_0x216f06);logger['info'](JSON['stringify'](_0x1a3693[_0x4ba1cd]));BPromise['resolve']()[_0x32c2('0x38')](handleJob(_0x1a3693[_0x4ba1cd]));logger[_0x32c2('0x26')]('run\x20job',_0x1a3693[_0x4ba1cd][_0x32c2('0x15')],_0x1a3693[_0x4ba1cd][_0x32c2('0x49')]);}else if(_0x1a3693[_0x4ba1cd]['cron']&&_0x1a3693[_0x4ba1cd]['active']&&moment()['isBetween'](_0x1a3693[_0x4ba1cd]['startAt'],_0x1a3693[_0x4ba1cd]['endAt'])){manager['add'](_0x4ba1cd,_0x1a3693[_0x4ba1cd][_0x32c2('0x49')],handleJob(_0x1a3693[_0x4ba1cd]));manager[_0x32c2('0x4a')](_0x4ba1cd);logger[_0x32c2('0x26')](_0x32c2('0x4b'),_0x1a3693[_0x4ba1cd]['name'],_0x1a3693[_0x4ba1cd][_0x32c2('0x49')]);}else if(manager['exists'](_0x4ba1cd)){manager[_0x32c2('0x45')](_0x4ba1cd);manager[_0x32c2('0x4c')](_0x4ba1cd);logger[_0x32c2('0x26')](_0x32c2('0x4d'),_0x1a3693[_0x4ba1cd][_0x32c2('0x15')],_0x1a3693[_0x4ba1cd][_0x32c2('0x49')]);}}for(_0x12636d=0x0,_0x4ba1cd;_0x12636d<_0x177e18[_0x32c2('0x43')]&&!_0x216f06;_0x12636d+=0x1){_0x4ba1cd=_0x177e18[_0x12636d]['toString']();if(manager['exists'](_0x4ba1cd)){if(_0x1a3693[_0x4ba1cd][_0x32c2('0x49')]&&_0x1a3693[_0x4ba1cd][_0x32c2('0x4e')]&&moment()['isBetween'](_0x1a3693[_0x4ba1cd][_0x32c2('0x4f')],_0x1a3693[_0x4ba1cd][_0x32c2('0x50')])){manager['update'](_0x4ba1cd,_0x1a3693[_0x4ba1cd][_0x32c2('0x49')],handleJob(_0x1a3693[_0x4ba1cd]));logger[_0x32c2('0x26')](_0x32c2('0x51'),_0x1a3693[_0x4ba1cd][_0x32c2('0x15')],_0x1a3693[_0x4ba1cd][_0x32c2('0x49')]);}else{manager['stop'](_0x4ba1cd);manager[_0x32c2('0x4c')](_0x4ba1cd);logger[_0x32c2('0x26')](_0x32c2('0x4d'),_0x1a3693[_0x4ba1cd][_0x32c2('0x15')],_0x1a3693[_0x4ba1cd][_0x32c2('0x49')]);}}}})[_0x32c2('0x2c')](function(_0x31d065){logger[_0x32c2('0x2a')](JSON[_0x32c2('0x23')](_0x31d065));});}exports['run']=function(_0x587a94){return getJobs(_0x587a94);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6dd1=['info','email','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','stringify','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','keys','jobs','map','keyBy','toString','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','run\x20job','cron','isBetween','add\x20cron','stop\x20cron','active','endAt','update','update\x20cron','run','start','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http'];(function(_0x54144d,_0x13b86e){var _0x3edcdd=function(_0x2c9432){while(--_0x2c9432){_0x54144d['push'](_0x54144d['shift']());}};_0x3edcdd(++_0x13b86e);}(_0x6dd1,0x152));var _0x16dd=function(_0x1a02a8,_0x373688){_0x1a02a8=_0x1a02a8-0x0;var _0x7982c=_0x6dd1[_0x1a02a8];return _0x7982c;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require('lodash');var moment=require(_0x16dd('0x0'));var CronJobManager=require(_0x16dd('0x1'));var jayson=require(_0x16dd('0x2'));var BPromise=require(_0x16dd('0x3'));var logger=require('../logger')(_0x16dd('0x4'));var db=require(_0x16dd('0x5'))['db'];var analyticCustomReportController=require(_0x16dd('0x6'));var analyticDefaultReportController=require(_0x16dd('0x7'));var client=jayson[_0x16dd('0x8')][_0x16dd('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x435217,_0x5be130){return function(){logger[_0x16dd('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x435217[_0x16dd('0xb')]);var _0x8c2be1=!![];var _0x35190b={'tls':{'rejectUnauthorized':![]}};if(_0x435217[_0x16dd('0xc')][_0x16dd('0xd')][_0x16dd('0xe')]){_0x35190b[_0x16dd('0xe')]=_0x435217[_0x16dd('0xc')][_0x16dd('0xd')][_0x16dd('0xe')];}else{_0x35190b['host']=_0x435217[_0x16dd('0xc')][_0x16dd('0xd')][_0x16dd('0xf')];_0x35190b[_0x16dd('0x10')]=_0x435217[_0x16dd('0xc')][_0x16dd('0xd')][_0x16dd('0x10')];_0x35190b[_0x16dd('0x11')]=_0x435217[_0x16dd('0xc')][_0x16dd('0xd')][_0x16dd('0x11')];}if(_0x435217['MailAccount'][_0x16dd('0xd')][_0x16dd('0x12')]){_0x35190b['auth']={'user':_0x435217[_0x16dd('0xc')]['Smtp'][_0x16dd('0x13')],'pass':_0x435217[_0x16dd('0xc')][_0x16dd('0xd')][_0x16dd('0x14')]};}var _0x584293={'account':_0x35190b,'message':{'from':util[_0x16dd('0x15')](_0x16dd('0x16'),_0x435217[_0x16dd('0xc')][_0x16dd('0x17')],_0x435217[_0x16dd('0xc')][_0x16dd('0xb')]||_0x435217[_0x16dd('0xc')][_0x16dd('0xd')][_0x16dd('0x13')]),'to':_0x435217[_0x16dd('0xb')],'cc':_0x435217['cc'],'bcc':_0x435217[_0x16dd('0x18')],'subject':util[_0x16dd('0x15')](_0x16dd('0x19'),_0x5be130[_0x16dd('0x17')],_0x435217[_0x16dd('0x1a')],_0x435217['subtractUnit'])}};var _0x1b26c4=path[_0x16dd('0x1b')](__dirname,_0x16dd('0x1c'));var _0x190321=_0x5be130[_0x16dd('0x1d')];var _0x19d61b=util[_0x16dd('0x15')](_0x16dd('0x1e'),path[_0x16dd('0x1f')](_0x5be130[_0x16dd('0x1d')],path[_0x16dd('0x20')](_0x5be130[_0x16dd('0x1d')])),'zip');var _0x497a3b=path[_0x16dd('0x1b')](_0x1b26c4,_0x190321);var _0x57e88c=path[_0x16dd('0x1b')](_0x1b26c4,_0x19d61b);if(fs[_0x16dd('0x21')](_0x497a3b)){_0x5be130[_0x16dd('0x22')]=_0x16dd('0x23');_0x584293[_0x16dd('0x24')][_0x16dd('0x25')]=[{'filename':_0x190321,'path':_0x497a3b}];_0x584293['message'][_0x16dd('0x26')]=util[_0x16dd('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x16dd('0x27')](_0x5be130,null,0x2));}else if(fs[_0x16dd('0x21')](_0x57e88c)){_0x5be130[_0x16dd('0x22')]=_0x16dd('0x23');_0x584293[_0x16dd('0x24')][_0x16dd('0x25')]=[{'filename':_0x19d61b,'path':_0x57e88c}];}else{_0x584293[_0x16dd('0x24')][_0x16dd('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x435217[_0x16dd('0x28')]){_0x8c2be1=![];logger[_0x16dd('0xa')](_0x16dd('0x29'));}}if(_0x8c2be1){return client[_0x16dd('0x2a')](_0x16dd('0x2b'),_0x584293)[_0x16dd('0x2c')](function(_0x2993f9){if(_0x2993f9[_0x16dd('0x2d')]){return logger[_0x16dd('0x2d')](_0x16dd('0x2e'),JSON[_0x16dd('0x27')](_0x2993f9));}return logger[_0x16dd('0xa')]('email\x20sent');})[_0x16dd('0x2f')](function(_0xe5f923){return logger[_0x16dd('0x2d')](_0x16dd('0x2e'),JSON[_0x16dd('0x27')](_0xe5f923));});}};}function handleError(){return function(_0xc4fd06){return logger['error'](JSON[_0x16dd('0x27')](_0xc4fd06));};}function handleResult(_0x22dc20){return function(_0x2d3372){logger[_0x16dd('0xa')](_0x16dd('0x30'),JSON['stringify'](_0x2d3372));if(_0x22dc20[_0x16dd('0xc')]&&_0x22dc20['MailAccount'][_0x16dd('0xd')]&&!_[_0x16dd('0x31')](_0x22dc20['email'])){setTimeout(handleSendEmail(_0x22dc20,_0x2d3372),0x3c*0x3e8);}};}function handleJob(_0x2260d5){return function(){try{if(_[_0x16dd('0x31')](_0x2260d5[_0x16dd('0x1a')])){return logger[_0x16dd('0xa')](_0x16dd('0x32'));}if(_[_0x16dd('0x31')](_0x2260d5[_0x16dd('0x33')])){return logger[_0x16dd('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x196075={'startDate':moment()[_0x16dd('0x34')](_0x2260d5[_0x16dd('0x1a')],_0x2260d5['subtractUnit'])[_0x16dd('0x15')](_0x16dd('0x35')),'endDate':moment()[_0x16dd('0x15')](_0x16dd('0x35')),'type':_0x16dd('0x36'),'output':_0x2260d5['output'],'name':_0x2260d5[_0x16dd('0x17')]};if(!_[_0x16dd('0x31')](_0x2260d5[_0x16dd('0x37')])){logger['info'](_0x16dd('0x38'),_0x2260d5[_0x16dd('0x37')]);return analyticDefaultReportController[_0x16dd('0x39')]({'id':_0x2260d5[_0x16dd('0x37')]},_0x196075)['then'](handleResult(_0x2260d5))['catch'](handleError());}if(!_['isNil'](_0x2260d5[_0x16dd('0x3a')])){logger['info'](_0x16dd('0x3b'),_0x2260d5['CustomReportId']);return analyticCustomReportController[_0x16dd('0x39')]({'id':_0x2260d5['CustomReportId']},_0x196075)[_0x16dd('0x2c')](handleResult(_0x2260d5))[_0x16dd('0x2f')](handleError());}}catch(_0x170e78){logger['error'](JSON['stringify'](_0x170e78));}return logger[_0x16dd('0xa')](_0x16dd('0x3c'));};}function getJobs(_0x5f4112){var _0x4e68af={};if(_0x5f4112){_0x4e68af['id']=_0x5f4112;}return db['Schedule'][_0x16dd('0x3d')]({'where':_0x4e68af,'include':[{'model':db['MailAccount'],'attributes':['id',_0x16dd('0x17'),'email'],'include':[{'model':db[_0x16dd('0x3e')],'as':_0x16dd('0xd')}]}]})[_0x16dd('0x2c')](function(_0x487950){var _0x469cfc=_[_0x16dd('0x3f')](manager[_0x16dd('0x40')]);var _0x348e6e=_[_0x16dd('0x41')](_0x487950,function(_0x5109cd){return _0x5109cd['id']['toString']();});var _0x1c7997=_[_0x16dd('0x42')](_0x487950,function(_0x1284bf){return _0x1284bf['id'][_0x16dd('0x43')]();});var _0x3fda3b=_0x5f4112?_0x348e6e:_[_0x16dd('0x44')](_0x348e6e,_0x469cfc);var _0x9a5365=_[_0x16dd('0x45')](_0x348e6e,_0x469cfc);var _0x3ef39a=_[_0x16dd('0x44')](_0x469cfc,_0x348e6e);var _0x424d26;var _0x58b9ed;for(_0x424d26=0x0;_0x424d26<_0x3ef39a['length']&&!_0x5f4112;_0x424d26+=0x1){_0x58b9ed=_0x3ef39a[_0x424d26][_0x16dd('0x43')]();if(manager[_0x16dd('0x46')](_0x58b9ed)){manager[_0x16dd('0x47')](_0x58b9ed);manager[_0x16dd('0x48')](_0x58b9ed);logger[_0x16dd('0xa')](_0x16dd('0x49'),_0x58b9ed);}}logger[_0x16dd('0xa')](_0x16dd('0x4a'),JSON[_0x16dd('0x27')](_0x3fda3b));for(_0x424d26=0x0;_0x424d26<_0x3fda3b[_0x16dd('0x4b')];_0x424d26+=0x1){_0x58b9ed=_0x3fda3b[_0x424d26][_0x16dd('0x43')]();logger[_0x16dd('0xa')]('index',_0x58b9ed);if(_0x5f4112){logger[_0x16dd('0xa')]('my\x20id',_0x5f4112);logger[_0x16dd('0xa')](JSON[_0x16dd('0x27')](_0x1c7997[_0x58b9ed]));BPromise['resolve']()['then'](handleJob(_0x1c7997[_0x58b9ed]));logger['info'](_0x16dd('0x4c'),_0x1c7997[_0x58b9ed][_0x16dd('0x17')],_0x1c7997[_0x58b9ed][_0x16dd('0x4d')]);}else if(_0x1c7997[_0x58b9ed][_0x16dd('0x4d')]&&_0x1c7997[_0x58b9ed]['active']&&moment()[_0x16dd('0x4e')](_0x1c7997[_0x58b9ed]['startAt'],_0x1c7997[_0x58b9ed]['endAt'])){manager['add'](_0x58b9ed,_0x1c7997[_0x58b9ed]['cron'],handleJob(_0x1c7997[_0x58b9ed]));manager['start'](_0x58b9ed);logger[_0x16dd('0xa')](_0x16dd('0x4f'),_0x1c7997[_0x58b9ed][_0x16dd('0x17')],_0x1c7997[_0x58b9ed][_0x16dd('0x4d')]);}else if(manager['exists'](_0x58b9ed)){manager[_0x16dd('0x47')](_0x58b9ed);manager[_0x16dd('0x48')](_0x58b9ed);logger[_0x16dd('0xa')](_0x16dd('0x50'),_0x1c7997[_0x58b9ed]['name'],_0x1c7997[_0x58b9ed][_0x16dd('0x4d')]);}}for(_0x424d26=0x0,_0x58b9ed;_0x424d26<_0x9a5365[_0x16dd('0x4b')]&&!_0x5f4112;_0x424d26+=0x1){_0x58b9ed=_0x9a5365[_0x424d26][_0x16dd('0x43')]();if(manager['exists'](_0x58b9ed)){if(_0x1c7997[_0x58b9ed]['cron']&&_0x1c7997[_0x58b9ed][_0x16dd('0x51')]&&moment()[_0x16dd('0x4e')](_0x1c7997[_0x58b9ed]['startAt'],_0x1c7997[_0x58b9ed][_0x16dd('0x52')])){manager[_0x16dd('0x53')](_0x58b9ed,_0x1c7997[_0x58b9ed]['cron'],handleJob(_0x1c7997[_0x58b9ed]));logger['info'](_0x16dd('0x54'),_0x1c7997[_0x58b9ed][_0x16dd('0x17')],_0x1c7997[_0x58b9ed][_0x16dd('0x4d')]);}else{manager[_0x16dd('0x47')](_0x58b9ed);manager[_0x16dd('0x48')](_0x58b9ed);logger[_0x16dd('0xa')](_0x16dd('0x50'),_0x1c7997[_0x58b9ed][_0x16dd('0x17')],_0x1c7997[_0x58b9ed][_0x16dd('0x4d')]);}}}})[_0x16dd('0x2f')](function(_0x213177){logger[_0x16dd('0x2d')](JSON['stringify'](_0x213177));});}exports[_0x16dd('0x55')]=function(_0x431b95){return getJobs(_0x431b95);};exports[_0x16dd('0x56')]=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 fb8371e..a83f469 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 _0xcb10=['transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','Transcript','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','COMPLETED','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','push','all','lodash','aws-sdk','util','bluebird','../../config/logger','TranscribeService','Comprehend','detectSentiment','info','format','transcribeName','data1'];(function(_0x2a3adb,_0x30a6b3){var _0x4ee58c=function(_0x2fa001){while(--_0x2fa001){_0x2a3adb['push'](_0x2a3adb['shift']());}};_0x4ee58c(++_0x30a6b3);}(_0xcb10,0x104));var _0x0cb1=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xcb10[_0x1d24eb];return _0x1dc576;};var _=require(_0x0cb1('0x0'));var AWS=require(_0x0cb1('0x1'));var rp=require('request-promise');var util=require(_0x0cb1('0x2'));var BPromise=require(_0x0cb1('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x0cb1('0x4'))('transcribe');function getTranscriptionJob(_0x24812c,_0x36b51c,_0xf8664d,_0x1cf87a){return new Promise(function(_0x430f60,_0x3ee6ec){var _0x390335=new AWS[(_0x0cb1('0x5'))]({'accessKeyId':_0x36b51c,'secretAccessKey':_0x24812c,'region':_0xf8664d});_0x390335['getTranscriptionJob']({'TranscriptionJobName':_0x1cf87a},function(_0x43620c,_0x1f815e){if(_0x43620c){return _0x3ee6ec(_0x43620c);}else{return _0x430f60(_0x1f815e);}});});}function sentiment(_0xe9ca1c,_0x46657b,_0x41e0d2,_0x82508f,_0x2f05a8){return new Promise(function(_0x488a4f,_0x4eae6f){var _0x555c10=new AWS[(_0x0cb1('0x6'))]({'accessKeyId':_0x46657b,'secretAccessKey':_0xe9ca1c,'region':_0x41e0d2});_0x555c10[_0x0cb1('0x7')]({'Text':_0x82508f,'LanguageCode':_0x2f05a8['substring'](0x0,0x2)},function(_0x5638ff,_0x597a57){if(_0x5638ff){return _0x4eae6f(_0x5638ff);}else{return _0x488a4f(_0x597a57);}});});}function checkTranscribeJob(_0x3201b5,_0x5ab983,_0x6b6477){var _0x1c5680;return new BPromise(function(_0x2ce41b,_0xdc3a39){logger[_0x0cb1('0x8')](util[_0x0cb1('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3201b5['id'],_0x3201b5[_0x0cb1('0xa')]));return getTranscriptionJob(_0x6b6477[_0x0cb1('0xb')],_0x6b6477['data2'],_0x5ab983[_0x0cb1('0xc')],_0x3201b5['transcribeName'])[_0x0cb1('0xd')](function(_0x145cd4){logger['info'](util[_0x0cb1('0x9')](_0x0cb1('0xe'),_0x3201b5['id'],_0x3201b5[_0x0cb1('0xa')],_0x145cd4[_0x0cb1('0xf')]['TranscriptionJobStatus']));if(!_0x3201b5[_0x0cb1('0x10')]){switch(_0x145cd4[_0x0cb1('0xf')][_0x0cb1('0x11')]){case'COMPLETED':var _0x5a88b7={'transcribeStatus':_0x145cd4[_0x0cb1('0xf')][_0x0cb1('0x11')],'fileUri':_0x145cd4['TranscriptionJob'][_0x0cb1('0x12')]['TranscriptFileUri']};logger[_0x0cb1('0x8')](util['format'](_0x0cb1('0x13'),_0x3201b5['id']));return rp({'uri':_0x145cd4[_0x0cb1('0xf')][_0x0cb1('0x12')]['TranscriptFileUri'],'json':!![]})[_0x0cb1('0xd')](function(_0x1f4702){logger[_0x0cb1('0x8')](util[_0x0cb1('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3201b5['id']));if(_0x1f4702&&_0x1f4702[_0x0cb1('0x14')]&&_0x1f4702['results'][_0x0cb1('0x15')]&&_0x1f4702[_0x0cb1('0x14')][_0x0cb1('0x15')][_0x0cb1('0x16')]){_0x5a88b7[_0x0cb1('0x10')]='';for(var _0x1e82db=0x0;_0x1e82db<_0x1f4702['results'][_0x0cb1('0x15')][_0x0cb1('0x16')];_0x1e82db++){_0x5a88b7[_0x0cb1('0x10')]+=_0x1f4702[_0x0cb1('0x14')][_0x0cb1('0x15')][_0x1e82db][_0x0cb1('0x17')]+'';}}return _0x3201b5['update'](_0x5a88b7);})[_0x0cb1('0xd')](function(){logger[_0x0cb1('0x8')](util[_0x0cb1('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3201b5['id']));if(!_0x3201b5[_0x0cb1('0x18')]){throw new db['Sequelize'][(_0x0cb1('0x19'))](_0x0cb1('0x1a'));}if(!_0x5ab983[_0x0cb1('0x1b')]||!_0x5ab983[_0x0cb1('0x1c')]||!_0x5ab983[_0x0cb1('0x1d')]||!_0x5ab983['language']||!_0x5ab983[_0x0cb1('0x1e')]){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x20'));}if(!_0x5a88b7['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5ab983[_0x0cb1('0x1c')]===_0x6b6477['id']){return _0x6b6477;}else{return db[_0x0cb1('0x21')][_0x0cb1('0x22')]({'where':{'id':_settings[_0x0cb1('0x1c')]}});}})[_0x0cb1('0xd')](function(_0x2243ad){if(!_0x2243ad){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x23'));}if(!_0x2243ad[_0x0cb1('0xb')]||!_0x2243ad['data2']){throw new db[(_0x0cb1('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1c5680=_0x2243ad;logger[_0x0cb1('0x8')](util[_0x0cb1('0x9')](_0x0cb1('0x24'),_0x3201b5['id']));return sentiment(_0x1c5680[_0x0cb1('0xb')],_0x1c5680[_0x0cb1('0x25')],_0x5ab983[_0x0cb1('0x1d')],_0x5a88b7['fileText'],_0x5ab983[_0x0cb1('0x26')]);})[_0x0cb1('0xd')](function(_0x2a19b3){logger['info'](util[_0x0cb1('0x9')](_0x0cb1('0x27'),_0x3201b5['id']));return _0x3201b5[_0x0cb1('0x28')]({'sentiment':_0x2a19b3[_0x0cb1('0x29')],'sPositive':_0x2a19b3[_0x0cb1('0x2a')]['Positive'],'sNegative':_0x2a19b3[_0x0cb1('0x2a')][_0x0cb1('0x2b')],'sMixed':_0x2a19b3['SentimentScore']['Mixed'],'sNeutral':_0x2a19b3[_0x0cb1('0x2a')][_0x0cb1('0x2c')]});})['then'](function(){logger['info'](util['format'](_0x0cb1('0x2d'),_0x3201b5['id']));_0x2ce41b();});case _0x0cb1('0x2e'):return _0x3201b5[_0x0cb1('0x28')]({'transcribeStatus':_0x0cb1('0x2e'),'failureReason':_0x145cd4[_0x0cb1('0xf')][_0x0cb1('0x2f')]})[_0x0cb1('0xd')](function(){logger[_0x0cb1('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3201b5['id']));_0x2ce41b();});default:logger['info'](util[_0x0cb1('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3201b5['id']));break;}}else{return BPromise[_0x0cb1('0x30')]()[_0x0cb1('0xd')](function(){if(!_0x3201b5[_0x0cb1('0x18')]){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x1a'));}if(!_0x5ab983['sentiment']||!_0x5ab983['sentimentAccountId']||!_0x5ab983[_0x0cb1('0x1d')]||!_0x5ab983[_0x0cb1('0x26')]||!_0x5ab983[_0x0cb1('0x1e')]){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3201b5['fileText']){throw new Error(_0x0cb1('0x31'));}if(_0x5ab983[_0x0cb1('0x1c')]===_0x6b6477['id']){return _0x6b6477;}else{return db['CloudProvider'][_0x0cb1('0x22')]({'where':{'id':_settings[_0x0cb1('0x1c')]}});}})[_0x0cb1('0xd')](function(_0x295648){if(!_0x295648){throw new db['Sequelize']['ValidationError'](_0x0cb1('0x23'));}if(!_0x295648[_0x0cb1('0xb')]||!_0x295648[_0x0cb1('0x25')]){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x32'));}_0x1c5680=_0x295648;logger[_0x0cb1('0x8')](util[_0x0cb1('0x9')](_0x0cb1('0x24'),_0x3201b5['id']));return sentiment(_0x1c5680[_0x0cb1('0xb')],_0x1c5680['data2'],_0x5ab983['sentimentRegion'],_0x3201b5['fileText'],_0x5ab983[_0x0cb1('0x26')]);})[_0x0cb1('0xd')](function(_0x4ba2d4){logger['info'](util['format'](_0x0cb1('0x27'),_0x3201b5['id']));return _0x3201b5[_0x0cb1('0x28')]({'sentiment':_0x4ba2d4[_0x0cb1('0x29')],'sPositive':_0x4ba2d4[_0x0cb1('0x2a')][_0x0cb1('0x33')],'sNegative':_0x4ba2d4[_0x0cb1('0x2a')][_0x0cb1('0x2b')],'sMixed':_0x4ba2d4[_0x0cb1('0x2a')]['Mixed'],'sNeutral':_0x4ba2d4[_0x0cb1('0x2a')][_0x0cb1('0x2c')],'transcribeStatus':_0x0cb1('0x34')});})[_0x0cb1('0xd')](function(){logger[_0x0cb1('0x8')](util[_0x0cb1('0x9')](_0x0cb1('0x2d'),_0x3201b5['id']));_0x2ce41b();});}})[_0x0cb1('0x35')](function(_0x12ba75){if(_0x12ba75){if(!_0x12ba75['name']||_0x12ba75[_0x0cb1('0x36')]!==_0x0cb1('0x37')){logger[_0x0cb1('0x38')](util[_0x0cb1('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3201b5['id']),util[_0x0cb1('0x39')](_0x12ba75,{'showHidden':![],'depth':null}));}}_0x2ce41b();});});}function checkTranscribe(){var _0x551746;var _0xd468b;var _0x541fc0;return db[_0x0cb1('0x3a')]['findAll']({'where':{'transcribeStatus':_0x0cb1('0x3b')}})['then'](function(_0x3f7866){if(!_0x3f7866||!_0x3f7866[_0x0cb1('0x16')]){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x3c'));}_0x551746=_0x3f7866;return db[_0x0cb1('0x3d')][_0x0cb1('0x22')]({'where':{'id':0x1}});})['then'](function(_0x4dc3bc){if(!_0x4dc3bc){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x3e'));}_0xd468b=_0x4dc3bc;if(!_0xd468b[_0x0cb1('0x3f')]||!_0xd468b[_0x0cb1('0x40')]||!_0xd468b[_0x0cb1('0xc')]||!_0xd468b[_0x0cb1('0x26')]||!_0xd468b['bucket']){throw new db['Sequelize'][(_0x0cb1('0x19'))](_0x0cb1('0x41'));}return db[_0x0cb1('0x21')][_0x0cb1('0x22')]({'where':{'id':_0xd468b['transcribeAccountId']}});})[_0x0cb1('0xd')](function(_0xabdac5){if(!_0xabdac5){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x23'));}if(!_0xabdac5[_0x0cb1('0xb')]||!_0xabdac5[_0x0cb1('0x25')]){throw new db[(_0x0cb1('0x1f'))][(_0x0cb1('0x19'))](_0x0cb1('0x32'));}_0x541fc0=_0xabdac5;var _0x399d4e=[];_0x551746['forEach'](function(_0x380df2){_0x399d4e[_0x0cb1('0x42')](checkTranscribeJob(_0x380df2,_0xd468b,_0x541fc0));});return BPromise[_0x0cb1('0x43')](_0x399d4e);})['catch'](function(_0x32ace6){if(_0x32ace6){if(!_0x32ace6[_0x0cb1('0x36')]||_0x32ace6[_0x0cb1('0x36')]!==_0x0cb1('0x37')){logger[_0x0cb1('0x38')](util[_0x0cb1('0x39')](_0x32ace6,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc584=['language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','data2','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Neutral','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','SequelizeValidationError','inspect','start','aws-sdk','request-promise','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc584,0xa8));var _0x4c58=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0xc584[_0xc36d01];return _0xecb231;};var _=require('lodash');var AWS=require(_0x4c58('0x0'));var rp=require(_0x4c58('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x4c58('0x2'))['db'];var logger=require('../../config/logger')(_0x4c58('0x3'));function getTranscriptionJob(_0x2b3ab7,_0x1bdc22,_0x4d84d7,_0x30c04a){return new Promise(function(_0x1a6d4c,_0x3e94f0){var _0x2fbd47=new AWS[(_0x4c58('0x4'))]({'accessKeyId':_0x1bdc22,'secretAccessKey':_0x2b3ab7,'region':_0x4d84d7});_0x2fbd47['getTranscriptionJob']({'TranscriptionJobName':_0x30c04a},function(_0x50e4f6,_0x4e3129){if(_0x50e4f6){return _0x3e94f0(_0x50e4f6);}else{return _0x1a6d4c(_0x4e3129);}});});}function sentiment(_0x3859a1,_0x46f663,_0x4550da,_0x39405a,_0xb89ef4){return new Promise(function(_0x23a115,_0x85e280){var _0xd08c65=new AWS[(_0x4c58('0x5'))]({'accessKeyId':_0x46f663,'secretAccessKey':_0x3859a1,'region':_0x4550da});_0xd08c65[_0x4c58('0x6')]({'Text':_0x39405a,'LanguageCode':_0xb89ef4[_0x4c58('0x7')](0x0,0x2)},function(_0x3240cd,_0x4dd48e){if(_0x3240cd){return _0x85e280(_0x3240cd);}else{return _0x23a115(_0x4dd48e);}});});}function checkTranscribeJob(_0x5ed1fc,_0x28f052,_0x4c17de){var _0x821dba;return new BPromise(function(_0x4103c9,_0x29cb8c){logger[_0x4c58('0x8')](util[_0x4c58('0x9')](_0x4c58('0xa'),_0x5ed1fc['id'],_0x5ed1fc['transcribeName']));return getTranscriptionJob(_0x4c17de[_0x4c58('0xb')],_0x4c17de['data2'],_0x28f052[_0x4c58('0xc')],_0x5ed1fc[_0x4c58('0xd')])[_0x4c58('0xe')](function(_0x14af92){logger[_0x4c58('0x8')](util[_0x4c58('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5ed1fc['id'],_0x5ed1fc[_0x4c58('0xd')],_0x14af92[_0x4c58('0xf')][_0x4c58('0x10')]));if(!_0x5ed1fc[_0x4c58('0x11')]){switch(_0x14af92[_0x4c58('0xf')]['TranscriptionJobStatus']){case _0x4c58('0x12'):var _0x45b1ab={'transcribeStatus':_0x14af92['TranscriptionJob'][_0x4c58('0x10')],'fileUri':_0x14af92[_0x4c58('0xf')][_0x4c58('0x13')][_0x4c58('0x14')]};logger[_0x4c58('0x8')](util[_0x4c58('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x5ed1fc['id']));return rp({'uri':_0x14af92[_0x4c58('0xf')][_0x4c58('0x13')][_0x4c58('0x14')],'json':!![]})[_0x4c58('0xe')](function(_0xdd2d81){logger['info'](util[_0x4c58('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x5ed1fc['id']));if(_0xdd2d81&&_0xdd2d81[_0x4c58('0x15')]&&_0xdd2d81[_0x4c58('0x15')]['transcripts']&&_0xdd2d81[_0x4c58('0x15')][_0x4c58('0x16')][_0x4c58('0x17')]){_0x45b1ab['fileText']='';for(var _0x159bf8=0x0;_0x159bf8<_0xdd2d81[_0x4c58('0x15')][_0x4c58('0x16')][_0x4c58('0x17')];_0x159bf8++){_0x45b1ab[_0x4c58('0x11')]+=_0xdd2d81['results'][_0x4c58('0x16')][_0x159bf8][_0x4c58('0x18')]+'';}}return _0x5ed1fc[_0x4c58('0x19')](_0x45b1ab);})[_0x4c58('0xe')](function(){logger[_0x4c58('0x8')](util[_0x4c58('0x9')](_0x4c58('0x1a'),_0x5ed1fc['id']));if(!_0x5ed1fc[_0x4c58('0x1b')]){throw new db['Sequelize'][(_0x4c58('0x1c'))](_0x4c58('0x1d'));}if(!_0x28f052[_0x4c58('0x1e')]||!_0x28f052[_0x4c58('0x1f')]||!_0x28f052[_0x4c58('0x20')]||!_0x28f052[_0x4c58('0x21')]||!_0x28f052[_0x4c58('0x22')]){throw new db[(_0x4c58('0x23'))][(_0x4c58('0x1c'))](_0x4c58('0x24'));}if(!_0x45b1ab[_0x4c58('0x11')]){throw new Error(_0x4c58('0x25'));}if(_0x28f052[_0x4c58('0x1f')]===_0x4c17de['id']){return _0x4c17de;}else{return db[_0x4c58('0x26')][_0x4c58('0x27')]({'where':{'id':_settings[_0x4c58('0x1f')]}});}})[_0x4c58('0xe')](function(_0x29c3e0){if(!_0x29c3e0){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x29c3e0[_0x4c58('0xb')]||!_0x29c3e0['data2']){throw new db[(_0x4c58('0x23'))]['ValidationError'](_0x4c58('0x28'));}_0x821dba=_0x29c3e0;logger[_0x4c58('0x8')](util[_0x4c58('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ed1fc['id']));return sentiment(_0x821dba[_0x4c58('0xb')],_0x821dba[_0x4c58('0x29')],_0x28f052[_0x4c58('0x20')],_0x45b1ab[_0x4c58('0x11')],_0x28f052[_0x4c58('0x21')]);})[_0x4c58('0xe')](function(_0x18ae24){logger[_0x4c58('0x8')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5ed1fc['id']));return _0x5ed1fc['update']({'sentiment':_0x18ae24[_0x4c58('0x2a')],'sPositive':_0x18ae24[_0x4c58('0x2b')][_0x4c58('0x2c')],'sNegative':_0x18ae24['SentimentScore'][_0x4c58('0x2d')],'sMixed':_0x18ae24[_0x4c58('0x2b')][_0x4c58('0x2e')],'sNeutral':_0x18ae24[_0x4c58('0x2b')]['Neutral']});})[_0x4c58('0xe')](function(){logger[_0x4c58('0x8')](util[_0x4c58('0x9')](_0x4c58('0x1a'),_0x5ed1fc['id']));_0x4103c9();});case _0x4c58('0x2f'):return _0x5ed1fc[_0x4c58('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x14af92[_0x4c58('0xf')]['FailureReason']})['then'](function(){logger[_0x4c58('0x8')](util['format'](_0x4c58('0x1a'),_0x5ed1fc['id']));_0x4103c9();});default:logger[_0x4c58('0x8')](util[_0x4c58('0x9')](_0x4c58('0x30'),_0x5ed1fc['id']));break;}}else{return BPromise[_0x4c58('0x31')]()['then'](function(){if(!_0x5ed1fc[_0x4c58('0x1b')]){throw new db[(_0x4c58('0x23'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x28f052[_0x4c58('0x1e')]||!_0x28f052[_0x4c58('0x1f')]||!_0x28f052[_0x4c58('0x20')]||!_0x28f052['language']||!_0x28f052['bucket']){throw new db['Sequelize'][(_0x4c58('0x1c'))](_0x4c58('0x24'));}if(!_0x5ed1fc[_0x4c58('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x28f052[_0x4c58('0x1f')]===_0x4c17de['id']){return _0x4c17de;}else{return db[_0x4c58('0x26')][_0x4c58('0x27')]({'where':{'id':_settings[_0x4c58('0x1f')]}});}})[_0x4c58('0xe')](function(_0xdf2702){if(!_0xdf2702){throw new db[(_0x4c58('0x23'))][(_0x4c58('0x1c'))](_0x4c58('0x32'));}if(!_0xdf2702[_0x4c58('0xb')]||!_0xdf2702[_0x4c58('0x29')]){throw new db[(_0x4c58('0x23'))][(_0x4c58('0x1c'))](_0x4c58('0x28'));}_0x821dba=_0xdf2702;logger[_0x4c58('0x8')](util[_0x4c58('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ed1fc['id']));return sentiment(_0x821dba['data1'],_0x821dba['data2'],_0x28f052[_0x4c58('0x20')],_0x5ed1fc['fileText'],_0x28f052['language']);})['then'](function(_0x285510){logger[_0x4c58('0x8')](util[_0x4c58('0x9')](_0x4c58('0x33'),_0x5ed1fc['id']));return _0x5ed1fc[_0x4c58('0x19')]({'sentiment':_0x285510['Sentiment'],'sPositive':_0x285510[_0x4c58('0x2b')]['Positive'],'sNegative':_0x285510['SentimentScore'][_0x4c58('0x2d')],'sMixed':_0x285510['SentimentScore'][_0x4c58('0x2e')],'sNeutral':_0x285510[_0x4c58('0x2b')][_0x4c58('0x34')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger['info'](util[_0x4c58('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ed1fc['id']));_0x4103c9();});}})['catch'](function(_0x387984){if(_0x387984){if(!_0x387984['name']||_0x387984[_0x4c58('0x35')]!=='SequelizeValidationError'){logger[_0x4c58('0x36')](util['format'](_0x4c58('0x37'),_0x5ed1fc['id']),util['inspect'](_0x387984,{'showHidden':![],'depth':null}));}}_0x4103c9();});});}function checkTranscribe(){var _0x40daae;var _0x43c7ac;var _0x47f744;return db[_0x4c58('0x38')][_0x4c58('0x39')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x4c58('0xe')](function(_0x437fcd){if(!_0x437fcd||!_0x437fcd[_0x4c58('0x17')]){throw new db[(_0x4c58('0x23'))][(_0x4c58('0x1c'))](_0x4c58('0x3a'));}_0x40daae=_0x437fcd;return db['Setting'][_0x4c58('0x27')]({'where':{'id':0x1}});})[_0x4c58('0xe')](function(_0x31483f){if(!_0x31483f){throw new db[(_0x4c58('0x23'))][(_0x4c58('0x1c'))]('Settings\x20not\x20available');}_0x43c7ac=_0x31483f;if(!_0x43c7ac[_0x4c58('0x3')]||!_0x43c7ac[_0x4c58('0x3b')]||!_0x43c7ac[_0x4c58('0xc')]||!_0x43c7ac['language']||!_0x43c7ac['bucket']){throw new db[(_0x4c58('0x23'))][(_0x4c58('0x1c'))](_0x4c58('0x3c'));}return db['CloudProvider'][_0x4c58('0x27')]({'where':{'id':_0x43c7ac[_0x4c58('0x3b')]}});})['then'](function(_0x5e89f6){if(!_0x5e89f6){throw new db['Sequelize'][(_0x4c58('0x1c'))](_0x4c58('0x32'));}if(!_0x5e89f6[_0x4c58('0xb')]||!_0x5e89f6[_0x4c58('0x29')]){throw new db[(_0x4c58('0x23'))][(_0x4c58('0x1c'))](_0x4c58('0x28'));}_0x47f744=_0x5e89f6;var _0x3c9319=[];_0x40daae['forEach'](function(_0x1ad6ba){_0x3c9319[_0x4c58('0x3d')](checkTranscribeJob(_0x1ad6ba,_0x43c7ac,_0x47f744));});return BPromise[_0x4c58('0x3e')](_0x3c9319);})[_0x4c58('0x3f')](function(_0x550854){if(_0x550854){if(!_0x550854['name']||_0x550854[_0x4c58('0x35')]!==_0x4c58('0x40')){logger['error'](util[_0x4c58('0x41')](_0x550854,{'showHidden':![],'depth':null}));}}});}exports[_0x4c58('0x42')]=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 63187cc..515fc7e 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 _0x05a0=['whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','map','join','system','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x225fe2,_0x37eb94){var _0x2f7034=function(_0xeab445){while(--_0xeab445){_0x225fe2['push'](_0x225fe2['shift']());}};_0x2f7034(++_0x37eb94);}(_0x05a0,0x172));var _0x005a=function(_0x401b13,_0x45a103){_0x401b13=_0x401b13-0x0;var _0xd5faf=_0x05a0[_0x401b13];return _0xd5faf;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x005a('0x0'));var util=require(_0x005a('0x1'));var config=require(_0x005a('0x2'));var db=require(_0x005a('0x3'))['db'];var logger=require(_0x005a('0x4'))(_0x005a('0x5'));config[_0x005a('0x6')]=_[_0x005a('0x7')](config[_0x005a('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x005a('0x8'))(new Redis(config[_0x005a('0x6')]));function closeInteractions(){var _0x171220=[];return db[_0x005a('0x9')][_0x005a('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x005a('0xb')](0x18,_0x005a('0xc'))}}})['then'](function(_0x5986ff){if(_0x5986ff&&_0x5986ff['length']){_0x171220=_[_0x005a('0xd')](_0x5986ff||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x171220[_0x005a('0xe')]());return db[_0x005a('0x9')]['update']({'closeReason':_0x005a('0xf'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x005a('0x10'))},{'where':{'id':_0x171220}});}})['then'](function(){if(_0x171220&&_0x171220['length']){logger[_0x005a('0x11')](_0x005a('0x12'),_0x171220[_0x005a('0xe')]());for(var _0x2db331=0x0;_0x2db331<_0x171220['length'];_0x2db331++){io[_0x005a('0x13')](_0x005a('0x14'),{'id':_0x171220[_0x2db331],'closed':!![]});}}})[_0x005a('0x15')](function(_0x5d9ca6){logger[_0x005a('0x16')](_0x005a('0x17'),_0x5d9ca6?util[_0x005a('0x18')](_0x5d9ca6,{'showHidden':![],'depth':null}):'');});}exports[_0x005a('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5d0a=['then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours'];(function(_0x49f785,_0x1291bf){var _0x170c4c=function(_0x5e648a){while(--_0x5e648a){_0x49f785['push'](_0x49f785['shift']());}};_0x170c4c(++_0x1291bf);}(_0x5d0a,0x173));var _0xa5d0=function(_0x455d51,_0x35631f){_0x455d51=_0x455d51-0x0;var _0x55c2d2=_0x5d0a[_0x455d51];return _0x55c2d2;};'use strict';var _=require(_0xa5d0('0x0'));var moment=require(_0xa5d0('0x1'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require(_0xa5d0('0x2'))['db'];var logger=require(_0xa5d0('0x3'))(_0xa5d0('0x4'));config[_0xa5d0('0x5')]=_[_0xa5d0('0x6')](config[_0xa5d0('0x5')],{'host':_0xa5d0('0x7'),'port':0x18eb});var io=require(_0xa5d0('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x26c19f=[];return db['WhatsappInteraction'][_0xa5d0('0x9')]({'raw':!![],'attributes':['id',_0xa5d0('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa5d0('0xb')](0x18,_0xa5d0('0xc'))}}})[_0xa5d0('0xd')](function(_0x34a1d0){if(_0x34a1d0&&_0x34a1d0[_0xa5d0('0xe')]){_0x26c19f=_[_0xa5d0('0xf')](_0x34a1d0||[],'id');logger[_0xa5d0('0x10')](_0xa5d0('0x11'),_0x26c19f[_0xa5d0('0x12')]());return db[_0xa5d0('0x13')][_0xa5d0('0x14')]({'closeReason':_0xa5d0('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xa5d0('0x16')](_0xa5d0('0x17'))},{'where':{'id':_0x26c19f}});}})[_0xa5d0('0xd')](function(){if(_0x26c19f&&_0x26c19f[_0xa5d0('0xe')]){logger[_0xa5d0('0x10')](_0xa5d0('0x18'),_0x26c19f[_0xa5d0('0x12')]());for(var _0x148aa0=0x0;_0x148aa0<_0x26c19f['length'];_0x148aa0++){io[_0xa5d0('0x19')](_0xa5d0('0x1a'),{'id':_0x26c19f[_0x148aa0],'closed':!![]});}}})[_0xa5d0('0x1b')](function(_0x4a27c9){logger[_0xa5d0('0x1c')](_0xa5d0('0x1d'),_0x4a27c9?util[_0xa5d0('0x1e')](_0x4a27c9,{'showHidden':![],'depth':null}):'');});}exports[_0xa5d0('0x1f')]=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 bc35322..07251fe 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f6a=['hopper2','push','Innocenzo','innocenzo.biondo','@xcally.com','Biondo','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2'];(function(_0x43ff4b,_0x193ad1){var _0x127fee=function(_0x3eb0d0){while(--_0x3eb0d0){_0x43ff4b['push'](_0x43ff4b['shift']());}};_0x127fee(++_0x193ad1);}(_0x2f6a,0x1cc));var _0xa2f6=function(_0x34406b,_0x2951d7){_0x34406b=_0x34406b-0x0;var _0x185ee3=_0x2f6a[_0x34406b];return _0x185ee3;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xa2f6('0x0')]({'id':i,'firstName':_0xa2f6('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xa2f6('0x2')+i+_0xa2f6('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xa2f6('0x0')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xa2f6('0x0')]({'id':i,'firstName':_0xa2f6('0x1')+i,'lastName':_0xa2f6('0x4')+i,'phone':0xf879fb460+i,'email':_0xa2f6('0x2')+i+_0xa2f6('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xa2f6('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xa2f6('0x5')](),'updatedAt':Date[_0xa2f6('0x5')]()});}db[_0xa2f6('0x6')][_0xa2f6('0x7')]({'where':{}})['then'](function(){return db[_0xa2f6('0x6')]['bulkCreate'](contacts);})[_0xa2f6('0x8')](function(){console[_0xa2f6('0x9')](_0xa2f6('0xa'),_0xa2f6('0xb'));return db[_0xa2f6('0xc')][_0xa2f6('0x7')]({'where':{}});})[_0xa2f6('0x8')](function(){return db[_0xa2f6('0xc')][_0xa2f6('0xd')](hopper);})[_0xa2f6('0x8')](function(){console[_0xa2f6('0x9')](_0xa2f6('0xa'),_0xa2f6('0xe'));return db[_0xa2f6('0x6')][_0xa2f6('0xd')](contacts2);})[_0xa2f6('0x8')](function(){console[_0xa2f6('0x9')](_0xa2f6('0xa'),_0xa2f6('0xf'));return db['CmHopper'][_0xa2f6('0xd')](hopper2);})['then'](function(){console[_0xa2f6('0x9')](_0xa2f6('0xa'),_0xa2f6('0x10'));})['catch'](function(_0x224612){console[_0xa2f6('0x9')](_0x224612);}); \ No newline at end of file +var _0x8d83=['finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','then','CmContact','bulkCreate','log','contacts1','CmHopper','destroy'];(function(_0x49754d,_0x171c18){var _0x29326a=function(_0x2f637f){while(--_0x2f637f){_0x49754d['push'](_0x49754d['shift']());}};_0x29326a(++_0x171c18);}(_0x8d83,0x89));var _0x38d8=function(_0x40a00,_0x58e3e9){_0x40a00=_0x40a00-0x0;var _0x317499=_0x8d83[_0x40a00];return _0x317499;};'use strict';var util=require(_0x38d8('0x0'));var db=require(_0x38d8('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x38d8('0x2')+i,'lastName':_0x38d8('0x3')+i,'phone':0xf879fb460+i,'email':_0x38d8('0x4')+i+_0x38d8('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x38d8('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x38d8('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x38d8('0x7')](),'updatedAt':Date[_0x38d8('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x38d8('0x6')]({'id':i,'firstName':_0x38d8('0x2')+i,'lastName':_0x38d8('0x3')+i,'phone':0xf879fb460+i,'email':_0x38d8('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x38d8('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x38d8('0x7')](),'updatedAt':Date['now']()});}db['CmContact']['destroy']({'where':{}})[_0x38d8('0x8')](function(){return db[_0x38d8('0x9')][_0x38d8('0xa')](contacts);})[_0x38d8('0x8')](function(){console[_0x38d8('0xb')]('finished\x20populating',_0x38d8('0xc'));return db[_0x38d8('0xd')][_0x38d8('0xe')]({'where':{}});})['then'](function(){return db[_0x38d8('0xd')][_0x38d8('0xa')](hopper);})['then'](function(){console['log'](_0x38d8('0xf'),'hopper1');return db[_0x38d8('0x9')][_0x38d8('0xa')](contacts2);})['then'](function(){console[_0x38d8('0xb')](_0x38d8('0xf'),_0x38d8('0x10'));return db[_0x38d8('0xd')][_0x38d8('0xa')](hopper2);})[_0x38d8('0x8')](function(){console['log'](_0x38d8('0xf'),_0x38d8('0x11'));})[_0x38d8('0x12')](function(_0x4bf372){console[_0x38d8('0xb')](_0x4bf372);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6520bde..67cea9e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc218=['push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','add\x20user','catch','util'];(function(_0x533483,_0x576164){var _0x28b726=function(_0x5a6f53){while(--_0x5a6f53){_0x533483['push'](_0x533483['shift']());}};_0x28b726(++_0x576164);}(_0xc218,0x9f));var _0x8c21=function(_0xe900c,_0x218dd1){_0xe900c=_0xe900c-0x0;var _0xd9ff51=_0xc218[_0xe900c];return _0xd9ff51;};'use strict';var util=require(_0x8c21('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8c21('0x1')]({'name':util[_0x8c21('0x2')]('%s%s','agent',i),'fullname':util[_0x8c21('0x2')](_0x8c21('0x3'),_0x8c21('0x4'),i),'email':util[_0x8c21('0x2')](_0x8c21('0x5'),_0x8c21('0x4'),i),'role':_0x8c21('0x4'),'password':_0x8c21('0x6'),'internal':0xfa0+i,'type':_0x8c21('0x7'),'transport':[_0x8c21('0x8'),'ws',_0x8c21('0x9')],'disallow':[_0x8c21('0xa')],'allow':[_0x8c21('0xb')],'defaultuser':util['format'](_0x8c21('0x3'),_0x8c21('0x4'),i),'encryption':_0x8c21('0xc'),'avpf':_0x8c21('0xc'),'force_avp':_0x8c21('0xc'),'icesupport':'yes','dtlsenable':_0x8c21('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x8c21('0xd'),'dtlssetup':_0x8c21('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x8c21('0x3'),_0x8c21('0x4'),i),0xfa0+i)});}db[_0x8c21('0xf')][_0x8c21('0x10')](users)[_0x8c21('0x11')](function(){console['log'](_0x8c21('0x12'));})[_0x8c21('0x13')](function(_0x58a19c){console['log'](_0x58a19c);}); \ No newline at end of file +var _0xc89a=['then','add\x20user','log','util','../mysqldb','push','format','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate'];(function(_0x50f681,_0x59c6b9){var _0x2c8df7=function(_0x6a8f72){while(--_0x6a8f72){_0x50f681['push'](_0x50f681['shift']());}};_0x2c8df7(++_0x59c6b9);}(_0xc89a,0x168));var _0xac89=function(_0x425d0d,_0x396c0d){_0x425d0d=_0x425d0d-0x0;var _0x36a8b8=_0xc89a[_0x425d0d];return _0x36a8b8;};'use strict';var util=require(_0xac89('0x0'));var db=require(_0xac89('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xac89('0x2')]({'name':util[_0xac89('0x3')]('%s%s',_0xac89('0x4'),i),'fullname':util[_0xac89('0x3')]('%s%s',_0xac89('0x4'),i),'email':util[_0xac89('0x3')](_0xac89('0x5'),_0xac89('0x4'),i),'role':_0xac89('0x4'),'password':_0xac89('0x6'),'internal':0xfa0+i,'type':_0xac89('0x7'),'transport':['udp','ws',_0xac89('0x8')],'disallow':[_0xac89('0x9')],'allow':[_0xac89('0xa')],'defaultuser':util['format'](_0xac89('0xb'),'agent',i),'encryption':_0xac89('0xc'),'avpf':'yes','force_avp':_0xac89('0xc'),'icesupport':_0xac89('0xc'),'dtlsenable':_0xac89('0xc'),'dtlsverify':'no','dtlscertfile':_0xac89('0xd'),'dtlsprivatekey':_0xac89('0xe'),'dtlssetup':_0xac89('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0xac89('0xb'),'agent',i),0xfa0+i)});}db[_0xac89('0x10')][_0xac89('0x11')](users)[_0xac89('0x12')](function(){console['log'](_0xac89('0x13'));})['catch'](function(_0x4b2de6){console[_0xac89('0x14')](_0x4b2de6);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 100c287..3c4d687 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac41=['join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','length','format','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','VoiceQueue','SmsQueues','WhatsappQueues','Telephones','voice:inbound','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log'];(function(_0x1fd6b0,_0x5a40a0){var _0x202a08=function(_0x3a0674){while(--_0x3a0674){_0x1fd6b0['push'](_0x1fd6b0['shift']());}};_0x202a08(++_0x5a40a0);}(_0xac41,0xdd));var _0x1ac4=function(_0x3b6790,_0x3a62eb){_0x3b6790=_0x3b6790-0x0;var _0x178368=_0xac41[_0x3b6790];return _0x178368;};'use strict';var _=require(_0x1ac4('0x0'));var util=require(_0x1ac4('0x1'));var BPromise=require(_0x1ac4('0x2'));var db=require(_0x1ac4('0x3'))['db'];var config=require(_0x1ac4('0x4'));var queryQueues={'attributes':['id',_0x1ac4('0x5')],'include':[{'as':_0x1ac4('0x6'),'model':db[_0x1ac4('0x7')],'attributes':['id','name',_0x1ac4('0x8')],'raw':!![],'where':{'role':_0x1ac4('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1ac4('0x5')],'where':{'role':_0x1ac4('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1ac4('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x1ac4('0x5')],'where':{'role':_0x1ac4('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1ac4('0x5'),_0x1ac4('0xb')],'where':{'type':_0x1ac4('0xc')}};function getAssociatedResources(_0x109c09,_0x151e4f,_0x454972){return db[_0x1ac4('0xd')][_0x1ac4('0xe')]({'where':{'name':_0x109c09,'userProfileId':_0x151e4f},'raw':!![]})[_0x1ac4('0xf')](function(_0x56dcfd){if(_0x56dcfd){if(_0x56dcfd[_0x1ac4('0x10')]){switch(_0x109c09){case'VoiceQueues':case _0x1ac4('0x11'):case _0x1ac4('0x12'):case'SmsQueues':case _0x1ac4('0x13'):case _0x1ac4('0x14'):case'WhatsappQueues':return db[_0x454972][_0x1ac4('0x15')](queryQueues);case'Telephones':return db[_0x454972]['findAll'](queryTelephones);case'Trunks':return db[_0x454972][_0x1ac4('0x15')](queryTrunks);case _0x1ac4('0x16'):return db[_0x454972][_0x1ac4('0x15')](queryCampaigns);}}else{return db[_0x1ac4('0x17')][_0x1ac4('0x15')]({'attributes':[_0x1ac4('0x18')],'where':{'sectionId':_0x56dcfd['id']},'raw':!![]})['then'](function(_0x531769){if(_0x531769){var _0x160b86={'where':{'id':_[_0x1ac4('0x19')](_0x531769,_0x1ac4('0x18'))},'raw':!![]};switch(_0x454972){case'User':_0x160b86[_0x1ac4('0x1a')][_0x1ac4('0x8')]=_0x1ac4('0xa');break;case _0x1ac4('0x1b'):_0x160b86[_0x1ac4('0x1a')][_0x1ac4('0xb')]=_0x1ac4('0xc');break;}return db[_0x454972]['findAll'](_0x160b86);}else{return[];}});}}else{return[];}})['then'](function(_0x9c8678){return _0x9c8678;});}function joinOrLeaveQueues(_0x1dc9b3,_0x36ac93,_0x1988d7,_0x3bd3f7){_0x1dc9b3[_0x36ac93](util['format']('%s:queue:%s',_0x1988d7,_0x3bd3f7[_0x1ac4('0x5')]));if(_0x3bd3f7[_0x1ac4('0x6')]){for(var _0x479110=0x0;_0x479110<_0x3bd3f7[_0x1ac4('0x6')][_0x1ac4('0x1c')];_0x479110+=0x1){_0x1dc9b3[_0x36ac93](util[_0x1ac4('0x1d')](_0x1ac4('0x1e'),_0x3bd3f7['Agents'][_0x479110][_0x1ac4('0x5')]));}}}function joinOrLeave(_0x42c56e,_0x51901a,_0x1b5490){var _0x5e58b4;if(_0x42c56e[_0x1ac4('0x1f')][_0x1ac4('0x20')]['id']){db[_0x1ac4('0x7')][_0x1ac4('0x21')]({'attributes':['id','name',_0x1ac4('0x8'),'userProfileId'],'where':{'id':_0x42c56e[_0x1ac4('0x1f')][_0x1ac4('0x20')]['id']},'include':[{'model':db[_0x1ac4('0x22')],'as':_0x1ac4('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x1ac4('0x24')],'as':_0x1ac4('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x1ac4('0x26')],'as':_0x1ac4('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x1ac4('0x28')],'as':_0x1ac4('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x1ac4('0x2a')],'as':_0x1ac4('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x1ac4('0x2c')],'as':_0x1ac4('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x1ac4('0xf')](function(_0x1fa40a){if(_0x1fa40a){_0x5e58b4=_0x1fa40a;_0x42c56e[_0x51901a](util[_0x1ac4('0x1d')]('user:%s',_0x1fa40a['name']));var _0x55ed7b=[];switch(_0x1fa40a[_0x1ac4('0x8')]){case _0x1ac4('0x2e'):_0x42c56e[_0x51901a]('voice:inbound');_0x42c56e[_0x51901a](_0x1ac4('0x2f'));if(queryQueues[_0x1ac4('0x30')](_0x1ac4('0x31'))){delete queryQueues['include'];}_0x55ed7b[_0x1ac4('0x32')](db['VoiceQueue']['findAll'](queryQueues));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x33')][_0x1ac4('0x15')](queryQueues));_0x55ed7b['push'](db[_0x1ac4('0x34')][_0x1ac4('0x15')](queryQueues));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x35')][_0x1ac4('0x15')](queryQueues));_0x55ed7b['push'](db[_0x1ac4('0x36')][_0x1ac4('0x15')](queryQueues));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x37')][_0x1ac4('0x15')](queryQueues));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x38')]['findAll'](queryQueues));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x7')]['findAll'](queryTelephones));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x39')]['findAll'](queryTrunks));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x1b')][_0x1ac4('0x15')](queryCampaigns));_0x55ed7b[_0x1ac4('0x32')](db[_0x1ac4('0x7')][_0x1ac4('0x15')](queryAgents));break;case _0x1ac4('0x3a'):_0x42c56e[_0x51901a]('voice:inbound');_0x42c56e[_0x51901a](_0x1ac4('0x2f'));_0x55ed7b[_0x1ac4('0x32')](getAssociatedResources(_0x1ac4('0x3b'),_0x1fa40a[_0x1ac4('0x3c')],_0x1ac4('0x3d')));_0x55ed7b[_0x1ac4('0x32')](getAssociatedResources(_0x1ac4('0x11'),_0x1fa40a['userProfileId'],'ChatQueue'));_0x55ed7b[_0x1ac4('0x32')](getAssociatedResources(_0x1ac4('0x12'),_0x1fa40a['userProfileId'],'FaxQueue'));_0x55ed7b['push'](getAssociatedResources(_0x1ac4('0x3e'),_0x1fa40a[_0x1ac4('0x3c')],_0x1ac4('0x35')));_0x55ed7b[_0x1ac4('0x32')](getAssociatedResources(_0x1ac4('0x13'),_0x1fa40a[_0x1ac4('0x3c')],_0x1ac4('0x36')));_0x55ed7b[_0x1ac4('0x32')](getAssociatedResources(_0x1ac4('0x14'),_0x1fa40a[_0x1ac4('0x3c')],_0x1ac4('0x37')));_0x55ed7b[_0x1ac4('0x32')](getAssociatedResources(_0x1ac4('0x3f'),_0x1fa40a['userProfileId'],_0x1ac4('0x38')));_0x55ed7b[_0x1ac4('0x32')](getAssociatedResources(_0x1ac4('0x40'),_0x1fa40a[_0x1ac4('0x3c')],_0x1ac4('0x7')));_0x55ed7b['push'](getAssociatedResources('Trunks',_0x1fa40a[_0x1ac4('0x3c')],_0x1ac4('0x39')));_0x55ed7b['push'](getAssociatedResources(_0x1ac4('0x16'),_0x1fa40a['userProfileId'],_0x1ac4('0x1b')));_0x55ed7b['push'](db[_0x1ac4('0x7')][_0x1ac4('0x15')](queryAgents));break;case _0x1ac4('0x9'):_0x42c56e[_0x51901a](_0x1ac4('0x41'));_0x42c56e[_0x51901a](_0x1ac4('0x2f'));_0x55ed7b[_0x1ac4('0x32')](_0x1fa40a[_0x1ac4('0x42')]({'attributes':['id',_0x1ac4('0x5')]}));_0x55ed7b[_0x1ac4('0x32')](_0x1fa40a['getChatQueues']({'attributes':['id',_0x1ac4('0x5')]}));_0x55ed7b['push'](_0x1fa40a[_0x1ac4('0x43')]({'attributes':['id','name']}));_0x55ed7b[_0x1ac4('0x32')](_0x1fa40a[_0x1ac4('0x44')]({'attributes':['id',_0x1ac4('0x5')]}));_0x55ed7b[_0x1ac4('0x32')](_0x1fa40a[_0x1ac4('0x45')]({'attributes':['id','name']}));_0x55ed7b['push'](_0x1fa40a[_0x1ac4('0x46')]({'attributes':['id','name']}));_0x55ed7b[_0x1ac4('0x32')](_0x1fa40a[_0x1ac4('0x47')]({'attributes':['id',_0x1ac4('0x5')]}));break;}return BPromise['all'](_0x55ed7b);}})[_0x1ac4('0xf')](function(_0x20d324){if(_0x20d324&&_0x20d324[_0x1ac4('0x1c')]){for(var _0x1e9b0e=0x0;_0x1e9b0e<_0x20d324[_0x1ac4('0x1c')];_0x1e9b0e+=0x1){for(var _0x272b83=0x0;_0x272b83<_0x20d324[_0x1e9b0e][_0x1ac4('0x1c')];_0x272b83+=0x1){switch(_0x1e9b0e){case 0x0:joinOrLeaveQueues(_0x42c56e,_0x51901a,'voice',_0x20d324[_0x1e9b0e][_0x272b83]);break;case 0x1:joinOrLeaveQueues(_0x42c56e,_0x51901a,_0x1ac4('0x48'),_0x20d324[_0x1e9b0e][_0x272b83]);break;case 0x2:joinOrLeaveQueues(_0x42c56e,_0x51901a,'fax',_0x20d324[_0x1e9b0e][_0x272b83]);break;case 0x3:joinOrLeaveQueues(_0x42c56e,_0x51901a,_0x1ac4('0x49'),_0x20d324[_0x1e9b0e][_0x272b83]);break;case 0x4:joinOrLeaveQueues(_0x42c56e,_0x51901a,_0x1ac4('0x4a'),_0x20d324[_0x1e9b0e][_0x272b83]);break;case 0x5:joinOrLeaveQueues(_0x42c56e,_0x51901a,_0x1ac4('0x4b'),_0x20d324[_0x1e9b0e][_0x272b83]);break;case 0x6:joinOrLeaveQueues(_0x42c56e,_0x51901a,_0x1ac4('0x4c'),_0x20d324[_0x1e9b0e][_0x272b83]);break;case 0x7:if(_0x5e58b4[_0x1ac4('0x8')]!==_0x1ac4('0x9'))_0x42c56e[_0x51901a](util[_0x1ac4('0x1d')](_0x1ac4('0x4d'),_0x20d324[_0x1e9b0e][_0x272b83][_0x1ac4('0x5')]));break;case 0x8:if(_0x5e58b4[_0x1ac4('0x8')]!=='agent')_0x42c56e[_0x51901a](util['format'](_0x1ac4('0x4e'),_0x20d324[_0x1e9b0e][_0x272b83][_0x1ac4('0x5')]));break;case 0x9:if(_0x5e58b4[_0x1ac4('0x8')]!==_0x1ac4('0x9'))_0x42c56e[_0x51901a](util['format'](_0x1ac4('0x4f'),_0x20d324[_0x1e9b0e][_0x272b83][_0x1ac4('0xb')],_0x20d324[_0x1e9b0e][_0x272b83][_0x1ac4('0x5')]));break;case 0xa:_0x42c56e[_0x51901a](util['format'](_0x1ac4('0x1e'),_0x20d324[_0x1e9b0e][_0x272b83]['name']));break;}}}}})[_0x1ac4('0xf')](function(){if(_0x51901a===_0x1ac4('0x50')){var _0x2d00a1=_['map'](_0x5e58b4[_0x1ac4('0x23')],'id');return _0x5e58b4['removeChatInteractions'](_0x2d00a1)['then'](function(){for(var _0x33e442=0x0;_0x33e442<_0x2d00a1['length'];_0x33e442+=0x1){_0x1b5490[_0x1ac4('0x51')](_0x1ac4('0x52'),{'ChatInteractionId':Number(_0x2d00a1[_0x33e442]),'UserId':Number(_0x5e58b4['id'])});}});}})[_0x1ac4('0xf')](function(){if(_0x51901a==='leave'){var _0x483fc8=_['map'](_0x5e58b4['MailInteractions'],'id');return _0x5e58b4[_0x1ac4('0x53')](_0x483fc8)['then'](function(){for(var _0x43d124=0x0;_0x43d124<_0x483fc8[_0x1ac4('0x1c')];_0x43d124+=0x1){_0x1b5490[_0x1ac4('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x483fc8[_0x43d124]),'UserId':Number(_0x5e58b4['id'])});}});}})[_0x1ac4('0xf')](function(){if(_0x51901a===_0x1ac4('0x50')){var _0xca77ad=_[_0x1ac4('0x19')](_0x5e58b4[_0x1ac4('0x27')],'id');return _0x5e58b4['removeFaxInteractions'](_0xca77ad)[_0x1ac4('0xf')](function(){for(var _0x1c8b04=0x0;_0x1c8b04<_0xca77ad['length'];_0x1c8b04+=0x1){_0x1b5490[_0x1ac4('0x51')](_0x1ac4('0x54'),{'FaxInteractionId':Number(_0xca77ad[_0x1c8b04]),'UserId':Number(_0x5e58b4['id'])});}});}})[_0x1ac4('0xf')](function(){if(_0x51901a===_0x1ac4('0x50')){var _0x132152=_[_0x1ac4('0x19')](_0x5e58b4['SmsInteractions'],'id');return _0x5e58b4['removeSmsInteractions'](_0x132152)[_0x1ac4('0xf')](function(){for(var _0x30379d=0x0;_0x30379d<_0x132152[_0x1ac4('0x1c')];_0x30379d+=0x1){_0x1b5490[_0x1ac4('0x51')](_0x1ac4('0x55'),{'SmsInteractionId':Number(_0x132152[_0x30379d]),'UserId':Number(_0x5e58b4['id'])});}});}})[_0x1ac4('0xf')](function(){if(_0x51901a===_0x1ac4('0x50')){var _0x411d53=_[_0x1ac4('0x19')](_0x5e58b4[_0x1ac4('0x2b')],'id');return _0x5e58b4[_0x1ac4('0x56')](_0x411d53)[_0x1ac4('0xf')](function(){for(var _0x3693e2=0x0;_0x3693e2<_0x411d53['length'];_0x3693e2+=0x1){_0x1b5490['emit'](_0x1ac4('0x57'),{'OpenchannelInteractionId':Number(_0x411d53[_0x3693e2]),'UserId':Number(_0x5e58b4['id'])});}});}})[_0x1ac4('0xf')](function(){if(_0x51901a===_0x1ac4('0x50')){var _0x210523=_[_0x1ac4('0x19')](_0x5e58b4[_0x1ac4('0x2d')],'id');return _0x5e58b4['removeWhatsappInteractions'](_0x210523)['then'](function(){for(var _0x3a0d78=0x0;_0x3a0d78<_0x210523[_0x1ac4('0x1c')];_0x3a0d78+=0x1){_0x1b5490[_0x1ac4('0x51')](_0x1ac4('0x58'),{'WhatsappInteractionId':Number(_0x210523[_0x3a0d78]),'UserId':Number(_0x5e58b4['id'])});}});}})[_0x1ac4('0x59')](function(_0x3ddb2d){_0x42c56e[_0x1ac4('0x5a')](_0x3ddb2d);});}}function onDisconnect(_0x4cf93a,_0x392cac){joinOrLeave(_0x4cf93a,'leave',_0x392cac);}function onConnect(_0x558b55){joinOrLeave(_0x558b55,_0x1ac4('0x5b'));}exports[_0x1ac4('0x5c')]=function(_0xa0bb08){_0xa0bb08['on'](_0x1ac4('0x5d'),function(_0x185bc5){_0x185bc5[_0x1ac4('0x5e')](0x0);_0x185bc5[_0x1ac4('0x5f')]=_0x185bc5[_0x1ac4('0x60')][_0x1ac4('0x5d')][_0x1ac4('0x61')]+':'+_0x185bc5[_0x1ac4('0x60')][_0x1ac4('0x5d')][_0x1ac4('0x62')];_0x185bc5['connectedAt']=new Date();_0x185bc5[_0x1ac4('0x5a')]=function(_0x2a88c1){console[_0x1ac4('0x5a')](_0x1ac4('0x63')+_0x185bc5[_0x1ac4('0x64')][_0x1ac4('0x5')]+'['+_0x185bc5['address']+']',_0x2a88c1);};_0x185bc5['on'](_0x1ac4('0x65'),function(){onDisconnect(_0x185bc5,_0xa0bb08);_0x185bc5[_0x1ac4('0x5a')](_0x1ac4('0x66'));});onConnect(_0x185bc5);_0x185bc5[_0x1ac4('0x5a')](_0x1ac4('0x67'));});}; \ No newline at end of file +var _0x1c3d=['autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','UserProfileResource','then','map','resourceId','User','where','Campaign','format','Agents','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:outbound','include','push','VoiceQueue','ChatQueue','MailQueue','WhatsappQueue','Trunk','user','voice:inbound','IvrCampaigns','getVoiceQueues','getFaxQueues','getOpenchannelQueues','all','length','voice','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','type','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','nsp','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','role','agent','telephone','ivr','UserProfileSection'];(function(_0x2b26d1,_0x312594){var _0x4ff126=function(_0x434abc){while(--_0x434abc){_0x2b26d1['push'](_0x2b26d1['shift']());}};_0x4ff126(++_0x312594);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x1951de,_0x173387){_0x1951de=_0x1951de-0x0;var _0x418584=_0x1c3d[_0x1951de];return _0x418584;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var BPromise=require(_0xd1c3('0x1'));var db=require(_0xd1c3('0x2'))['db'];var config=require(_0xd1c3('0x3'));var queryQueues={'attributes':['id',_0xd1c3('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xd1c3('0x4'),_0xd1c3('0x5')],'raw':!![],'where':{'role':_0xd1c3('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd1c3('0x4')],'where':{'role':_0xd1c3('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd1c3('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd1c3('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd1c3('0x4'),'type'],'where':{'type':_0xd1c3('0x8')}};function getAssociatedResources(_0x2f3c1c,_0x16ef4d,_0x18556c){return db[_0xd1c3('0x9')]['findOne']({'where':{'name':_0x2f3c1c,'userProfileId':_0x16ef4d},'raw':!![]})['then'](function(_0x4055e8){if(_0x4055e8){if(_0x4055e8[_0xd1c3('0xa')]){switch(_0x2f3c1c){case _0xd1c3('0xb'):case _0xd1c3('0xc'):case _0xd1c3('0xd'):case _0xd1c3('0xe'):case _0xd1c3('0xf'):case _0xd1c3('0x10'):case _0xd1c3('0x11'):return db[_0x18556c]['findAll'](queryQueues);case _0xd1c3('0x12'):return db[_0x18556c]['findAll'](queryTelephones);case'Trunks':return db[_0x18556c][_0xd1c3('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x18556c][_0xd1c3('0x13')](queryCampaigns);}}else{return db[_0xd1c3('0x14')][_0xd1c3('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x4055e8['id']},'raw':!![]})[_0xd1c3('0x15')](function(_0x4230f7){if(_0x4230f7){var _0x127067={'where':{'id':_[_0xd1c3('0x16')](_0x4230f7,_0xd1c3('0x17'))},'raw':!![]};switch(_0x18556c){case _0xd1c3('0x18'):_0x127067[_0xd1c3('0x19')][_0xd1c3('0x5')]=_0xd1c3('0x7');break;case _0xd1c3('0x1a'):_0x127067['where']['type']=_0xd1c3('0x8');break;}return db[_0x18556c][_0xd1c3('0x13')](_0x127067);}else{return[];}});}}else{return[];}})[_0xd1c3('0x15')](function(_0x54a450){return _0x54a450;});}function joinOrLeaveQueues(_0x5b2571,_0x4b0a45,_0x9c9d4d,_0xac3076){_0x5b2571[_0x4b0a45](util[_0xd1c3('0x1b')]('%s:queue:%s',_0x9c9d4d,_0xac3076['name']));if(_0xac3076[_0xd1c3('0x1c')]){for(var _0x1b5fae=0x0;_0x1b5fae<_0xac3076['Agents']['length'];_0x1b5fae+=0x1){_0x5b2571[_0x4b0a45](util[_0xd1c3('0x1b')](_0xd1c3('0x1d'),_0xac3076[_0xd1c3('0x1c')][_0x1b5fae][_0xd1c3('0x4')]));}}}function joinOrLeave(_0x3d396c,_0x46ed40,_0x137fd5){var _0xaa7580;if(_0x3d396c[_0xd1c3('0x1e')][_0xd1c3('0x1f')]['id']){db['User']['find']({'attributes':['id',_0xd1c3('0x4'),_0xd1c3('0x5'),_0xd1c3('0x20')],'where':{'id':_0x3d396c[_0xd1c3('0x1e')]['query']['id']},'include':[{'model':db[_0xd1c3('0x21')],'as':_0xd1c3('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xd1c3('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1c3('0x24')],'as':_0xd1c3('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1c3('0x26')],'as':_0xd1c3('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd1c3('0x28')],'as':_0xd1c3('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xd1c3('0x15')](function(_0x3eabca){if(_0x3eabca){_0xaa7580=_0x3eabca;_0x3d396c[_0x46ed40](util[_0xd1c3('0x1b')](_0xd1c3('0x1d'),_0x3eabca[_0xd1c3('0x4')]));var _0x584b1d=[];switch(_0x3eabca[_0xd1c3('0x5')]){case _0xd1c3('0x2a'):_0x3d396c[_0x46ed40]('voice:inbound');_0x3d396c[_0x46ed40](_0xd1c3('0x2b'));if(queryQueues['hasOwnProperty'](_0xd1c3('0x2c'))){delete queryQueues[_0xd1c3('0x2c')];}_0x584b1d[_0xd1c3('0x2d')](db[_0xd1c3('0x2e')][_0xd1c3('0x13')](queryQueues));_0x584b1d[_0xd1c3('0x2d')](db[_0xd1c3('0x2f')][_0xd1c3('0x13')](queryQueues));_0x584b1d[_0xd1c3('0x2d')](db['FaxQueue'][_0xd1c3('0x13')](queryQueues));_0x584b1d[_0xd1c3('0x2d')](db['SmsQueue'][_0xd1c3('0x13')](queryQueues));_0x584b1d['push'](db[_0xd1c3('0x30')][_0xd1c3('0x13')](queryQueues));_0x584b1d[_0xd1c3('0x2d')](db['OpenchannelQueue'][_0xd1c3('0x13')](queryQueues));_0x584b1d[_0xd1c3('0x2d')](db[_0xd1c3('0x31')][_0xd1c3('0x13')](queryQueues));_0x584b1d[_0xd1c3('0x2d')](db[_0xd1c3('0x18')][_0xd1c3('0x13')](queryTelephones));_0x584b1d[_0xd1c3('0x2d')](db[_0xd1c3('0x32')]['findAll'](queryTrunks));_0x584b1d['push'](db[_0xd1c3('0x1a')]['findAll'](queryCampaigns));_0x584b1d[_0xd1c3('0x2d')](db[_0xd1c3('0x18')][_0xd1c3('0x13')](queryAgents));break;case _0xd1c3('0x33'):_0x3d396c[_0x46ed40](_0xd1c3('0x34'));_0x3d396c[_0x46ed40](_0xd1c3('0x2b'));_0x584b1d['push'](getAssociatedResources(_0xd1c3('0xb'),_0x3eabca['userProfileId'],_0xd1c3('0x2e')));_0x584b1d['push'](getAssociatedResources(_0xd1c3('0xc'),_0x3eabca['userProfileId'],'ChatQueue'));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources(_0xd1c3('0xd'),_0x3eabca[_0xd1c3('0x20')],'FaxQueue'));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources(_0xd1c3('0xe'),_0x3eabca[_0xd1c3('0x20')],'SmsQueue'));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources(_0xd1c3('0xf'),_0x3eabca[_0xd1c3('0x20')],_0xd1c3('0x30')));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources(_0xd1c3('0x10'),_0x3eabca[_0xd1c3('0x20')],'OpenchannelQueue'));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources(_0xd1c3('0x11'),_0x3eabca['userProfileId'],'WhatsappQueue'));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources(_0xd1c3('0x12'),_0x3eabca[_0xd1c3('0x20')],_0xd1c3('0x18')));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources('Trunks',_0x3eabca[_0xd1c3('0x20')],_0xd1c3('0x32')));_0x584b1d[_0xd1c3('0x2d')](getAssociatedResources(_0xd1c3('0x35'),_0x3eabca[_0xd1c3('0x20')],_0xd1c3('0x1a')));_0x584b1d[_0xd1c3('0x2d')](db[_0xd1c3('0x18')][_0xd1c3('0x13')](queryAgents));break;case _0xd1c3('0x6'):_0x3d396c[_0x46ed40]('voice:inbound');_0x3d396c[_0x46ed40](_0xd1c3('0x2b'));_0x584b1d['push'](_0x3eabca[_0xd1c3('0x36')]({'attributes':['id',_0xd1c3('0x4')]}));_0x584b1d[_0xd1c3('0x2d')](_0x3eabca['getChatQueues']({'attributes':['id',_0xd1c3('0x4')]}));_0x584b1d[_0xd1c3('0x2d')](_0x3eabca[_0xd1c3('0x37')]({'attributes':['id',_0xd1c3('0x4')]}));_0x584b1d[_0xd1c3('0x2d')](_0x3eabca['getSmsQueues']({'attributes':['id','name']}));_0x584b1d[_0xd1c3('0x2d')](_0x3eabca['getMailQueues']({'attributes':['id',_0xd1c3('0x4')]}));_0x584b1d[_0xd1c3('0x2d')](_0x3eabca[_0xd1c3('0x38')]({'attributes':['id',_0xd1c3('0x4')]}));_0x584b1d['push'](_0x3eabca['getWhatsappQueues']({'attributes':['id',_0xd1c3('0x4')]}));break;}return BPromise[_0xd1c3('0x39')](_0x584b1d);}})[_0xd1c3('0x15')](function(_0x5df790){if(_0x5df790&&_0x5df790[_0xd1c3('0x3a')]){for(var _0x4af1cb=0x0;_0x4af1cb<_0x5df790[_0xd1c3('0x3a')];_0x4af1cb+=0x1){for(var _0x3cd320=0x0;_0x3cd320<_0x5df790[_0x4af1cb][_0xd1c3('0x3a')];_0x3cd320+=0x1){switch(_0x4af1cb){case 0x0:joinOrLeaveQueues(_0x3d396c,_0x46ed40,_0xd1c3('0x3b'),_0x5df790[_0x4af1cb][_0x3cd320]);break;case 0x1:joinOrLeaveQueues(_0x3d396c,_0x46ed40,'chat',_0x5df790[_0x4af1cb][_0x3cd320]);break;case 0x2:joinOrLeaveQueues(_0x3d396c,_0x46ed40,'fax',_0x5df790[_0x4af1cb][_0x3cd320]);break;case 0x3:joinOrLeaveQueues(_0x3d396c,_0x46ed40,_0xd1c3('0x3c'),_0x5df790[_0x4af1cb][_0x3cd320]);break;case 0x4:joinOrLeaveQueues(_0x3d396c,_0x46ed40,_0xd1c3('0x3d'),_0x5df790[_0x4af1cb][_0x3cd320]);break;case 0x5:joinOrLeaveQueues(_0x3d396c,_0x46ed40,_0xd1c3('0x3e'),_0x5df790[_0x4af1cb][_0x3cd320]);break;case 0x6:joinOrLeaveQueues(_0x3d396c,_0x46ed40,_0xd1c3('0x3f'),_0x5df790[_0x4af1cb][_0x3cd320]);break;case 0x7:if(_0xaa7580[_0xd1c3('0x5')]!==_0xd1c3('0x6'))_0x3d396c[_0x46ed40](util[_0xd1c3('0x1b')](_0xd1c3('0x40'),_0x5df790[_0x4af1cb][_0x3cd320]['name']));break;case 0x8:if(_0xaa7580[_0xd1c3('0x5')]!==_0xd1c3('0x6'))_0x3d396c[_0x46ed40](util[_0xd1c3('0x1b')](_0xd1c3('0x41'),_0x5df790[_0x4af1cb][_0x3cd320][_0xd1c3('0x4')]));break;case 0x9:if(_0xaa7580['role']!=='agent')_0x3d396c[_0x46ed40](util[_0xd1c3('0x1b')]('campaign:%s:%s',_0x5df790[_0x4af1cb][_0x3cd320][_0xd1c3('0x42')],_0x5df790[_0x4af1cb][_0x3cd320][_0xd1c3('0x4')]));break;case 0xa:_0x3d396c[_0x46ed40](util[_0xd1c3('0x1b')]('user:%s',_0x5df790[_0x4af1cb][_0x3cd320][_0xd1c3('0x4')]));break;}}}}})[_0xd1c3('0x15')](function(){if(_0x46ed40===_0xd1c3('0x43')){var _0x14fcd9=_[_0xd1c3('0x16')](_0xaa7580[_0xd1c3('0x22')],'id');return _0xaa7580[_0xd1c3('0x44')](_0x14fcd9)[_0xd1c3('0x15')](function(){for(var _0xfcfaa=0x0;_0xfcfaa<_0x14fcd9[_0xd1c3('0x3a')];_0xfcfaa+=0x1){_0x137fd5[_0xd1c3('0x45')](_0xd1c3('0x46'),{'ChatInteractionId':Number(_0x14fcd9[_0xfcfaa]),'UserId':Number(_0xaa7580['id'])});}});}})[_0xd1c3('0x15')](function(){if(_0x46ed40===_0xd1c3('0x43')){var _0x59b12e=_['map'](_0xaa7580[_0xd1c3('0x23')],'id');return _0xaa7580['removeMailInteractions'](_0x59b12e)[_0xd1c3('0x15')](function(){for(var _0x4579c0=0x0;_0x4579c0<_0x59b12e[_0xd1c3('0x3a')];_0x4579c0+=0x1){_0x137fd5[_0xd1c3('0x45')](_0xd1c3('0x47'),{'MailInteractionId':Number(_0x59b12e[_0x4579c0]),'UserId':Number(_0xaa7580['id'])});}});}})[_0xd1c3('0x15')](function(){if(_0x46ed40===_0xd1c3('0x43')){var _0x18aea7=_[_0xd1c3('0x16')](_0xaa7580[_0xd1c3('0x25')],'id');return _0xaa7580[_0xd1c3('0x48')](_0x18aea7)['then'](function(){for(var _0x246e02=0x0;_0x246e02<_0x18aea7[_0xd1c3('0x3a')];_0x246e02+=0x1){_0x137fd5[_0xd1c3('0x45')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x18aea7[_0x246e02]),'UserId':Number(_0xaa7580['id'])});}});}})[_0xd1c3('0x15')](function(){if(_0x46ed40===_0xd1c3('0x43')){var _0x3ba3fd=_[_0xd1c3('0x16')](_0xaa7580[_0xd1c3('0x27')],'id');return _0xaa7580['removeSmsInteractions'](_0x3ba3fd)[_0xd1c3('0x15')](function(){for(var _0xab964f=0x0;_0xab964f<_0x3ba3fd[_0xd1c3('0x3a')];_0xab964f+=0x1){_0x137fd5[_0xd1c3('0x45')](_0xd1c3('0x49'),{'SmsInteractionId':Number(_0x3ba3fd[_0xab964f]),'UserId':Number(_0xaa7580['id'])});}});}})['then'](function(){if(_0x46ed40==='leave'){var _0x2d3731=_['map'](_0xaa7580['OpenchannelInteractions'],'id');return _0xaa7580['removeOpenchannelInteractions'](_0x2d3731)[_0xd1c3('0x15')](function(){for(var _0x5a9310=0x0;_0x5a9310<_0x2d3731[_0xd1c3('0x3a')];_0x5a9310+=0x1){_0x137fd5[_0xd1c3('0x45')](_0xd1c3('0x4a'),{'OpenchannelInteractionId':Number(_0x2d3731[_0x5a9310]),'UserId':Number(_0xaa7580['id'])});}});}})['then'](function(){if(_0x46ed40==='leave'){var _0x53f0fb=_[_0xd1c3('0x16')](_0xaa7580[_0xd1c3('0x4b')],'id');return _0xaa7580[_0xd1c3('0x4c')](_0x53f0fb)[_0xd1c3('0x15')](function(){for(var _0x3f5d86=0x0;_0x3f5d86<_0x53f0fb[_0xd1c3('0x3a')];_0x3f5d86+=0x1){_0x137fd5[_0xd1c3('0x45')](_0xd1c3('0x4d'),{'WhatsappInteractionId':Number(_0x53f0fb[_0x3f5d86]),'UserId':Number(_0xaa7580['id'])});}});}})['catch'](function(_0x52f1b5){_0x3d396c[_0xd1c3('0x4e')](_0x52f1b5);});}}function onDisconnect(_0x3dd815,_0xffdd02){joinOrLeave(_0x3dd815,'leave',_0xffdd02);}function onConnect(_0xd7f022){joinOrLeave(_0xd7f022,_0xd1c3('0x4f'));}exports[_0xd1c3('0x50')]=function(_0x3f45be){_0x3f45be['on'](_0xd1c3('0x51'),function(_0x468a4e){_0x468a4e['setMaxListeners'](0x0);_0x468a4e[_0xd1c3('0x52')]=_0x468a4e[_0xd1c3('0x53')][_0xd1c3('0x51')][_0xd1c3('0x54')]+':'+_0x468a4e[_0xd1c3('0x53')][_0xd1c3('0x51')][_0xd1c3('0x55')];_0x468a4e[_0xd1c3('0x56')]=new Date();_0x468a4e[_0xd1c3('0x4e')]=function(_0x2669f6){console['log']('SocketIO\x20'+_0x468a4e[_0xd1c3('0x57')][_0xd1c3('0x4')]+'['+_0x468a4e[_0xd1c3('0x52')]+']',_0x2669f6);};_0x468a4e['on']('disconnect',function(){onDisconnect(_0x468a4e,_0x3f45be);_0x468a4e[_0xd1c3('0x4e')](_0xd1c3('0x58'));});onConnect(_0x468a4e);_0x468a4e[_0xd1c3('0x4e')](_0xd1c3('0x59'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 79105b4..0751359 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 _0x949d=['ChatInteraction','afterCreate','Chat','afterUpdate','ChatMessage','Sms','SmsInteraction','newinteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','newmessage','Fax','FaxInteraction','MailInteraction','Mail','substatus','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','motionChannel','direction','sequelize','query','QueryTypes','contact','UserId','User','find','name','fullname','email','internal','interface','format','SIP/%s','channel','agent','incomingmessage','catch','get','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','changed','closed','event','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http'];(function(_0xc04b8b,_0xf3565c){var _0x258164=function(_0x1e40b5){while(--_0x1e40b5){_0xc04b8b['push'](_0xc04b8b['shift']());}};_0x258164(++_0xf3565c);}(_0x949d,0x162));var _0xd949=function(_0x1b0143,_0xfc68d7){_0x1b0143=_0x1b0143-0x0;var _0x3f7637=_0x949d[_0x1b0143];return _0x3f7637;};'use strict';var util=require(_0xd949('0x0'));var db=require(_0xd949('0x1'))['db'];var jayson=require(_0xd949('0x2'));var logger=require(_0xd949('0x3'))('triggers');var _=require('lodash');var client=jayson[_0xd949('0x4')][_0xd949('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xd949('0x6'),'event':_0xd949('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd949('0x8'),'model':_0xd949('0x6'),'event':_0xd949('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd949('0x8'),'model':_0xd949('0xa'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd949('0xb'),'model':_0xd949('0xc'),'event':_0xd949('0x7'),'condition':_0xd949('0xd'),'callback':afterCreate},{'channel':_0xd949('0xb'),'model':'SmsInteraction','event':'afterUpdate','condition':_0xd949('0xe'),'callback':afterUpdate},{'channel':_0xd949('0xb'),'model':_0xd949('0xf'),'event':_0xd949('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd949('0x10'),'model':_0xd949('0x11'),'event':_0xd949('0x7'),'condition':_0xd949('0xd'),'callback':afterCreate},{'channel':_0xd949('0x10'),'model':_0xd949('0x11'),'event':_0xd949('0x9'),'condition':_0xd949('0xe'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xd949('0x12'),'event':_0xd949('0x7'),'condition':_0xd949('0x13'),'callback':afterCreateMessage},{'channel':_0xd949('0x14'),'model':'FaxInteraction','event':_0xd949('0x7'),'condition':_0xd949('0xd'),'callback':afterCreate},{'channel':_0xd949('0x14'),'model':_0xd949('0x15'),'event':_0xd949('0x9'),'condition':_0xd949('0xe'),'callback':afterUpdate},{'channel':_0xd949('0x14'),'model':'FaxMessage','event':_0xd949('0x7'),'condition':_0xd949('0x13'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xd949('0x16'),'event':_0xd949('0x7'),'condition':_0xd949('0xd'),'callback':afterCreate},{'channel':_0xd949('0x17'),'model':_0xd949('0x16'),'event':'afterUpdate','condition':_0xd949('0xe'),'callback':afterUpdate},{'channel':_0xd949('0x17'),'model':'MailInteraction','event':'substatus','condition':_0xd949('0x18'),'callback':afterUpdate},{'channel':_0xd949('0x17'),'model':_0xd949('0x19'),'event':_0xd949('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0xd949('0x1a'),'event':_0xd949('0x7'),'condition':_0xd949('0xd'),'callback':afterCreate},{'channel':_0xd949('0x1b'),'model':_0xd949('0x1a'),'event':_0xd949('0x9'),'condition':_0xd949('0xe'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xd949('0x1c'),'event':_0xd949('0x7'),'condition':_0xd949('0x13'),'callback':afterCreateMessage}];function request(_0x32701a){return client['request'](_0xd949('0x1d'),_0x32701a)[_0xd949('0x1e')](function(_0x1e9abd){logger[_0xd949('0x1f')](_0xd949('0x20'),'EventManager',_0x1e9abd);if(_0x1e9abd['error']){if(_0x1e9abd[_0xd949('0x21')][_0xd949('0x22')]===0x1f4){logger['error'](_0xd949('0x20'),_0xd949('0x1d'),_0x1e9abd['error']);}}})['catch'](function(_0x298ed2){logger[_0xd949('0x21')](_0xd949('0x20'),_0xd949('0x1d'),_0x298ed2);});}function afterCreateMessage(_0x5e7c01,_0x129a00){return function(_0x5f4d45,_0x3c729b){_0x5f4d45=_0x5f4d45['get']({'plain':!![]});_0x5f4d45['channel']=_0x5e7c01;_0x5f4d45[_0xd949('0x23')]=_0x5e7c01;_0x5f4d45['event']=_0x5f4d45[_0xd949('0x24')];var _0x3fde6a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f4d45['ContactId'];return db[_0xd949('0x25')][_0xd949('0x26')](_0x3fde6a,{'type':db['Sequelize'][_0xd949('0x27')]['SELECT'],'raw':!![]})[_0xd949('0x1e')](function(_0x2f4691){return _0x2f4691;})['then'](function(_0x576678){if(_0x576678){_0x5f4d45[_0xd949('0x28')]=_0x576678[0x0];}if(_0x5f4d45[_0xd949('0x29')]){return db[_0xd949('0x2a')][_0xd949('0x2b')]({'where':{'id':_0x5f4d45[_0xd949('0x29')]},'attributes':['id',_0xd949('0x2c'),_0xd949('0x2d'),_0xd949('0x2e'),_0xd949('0x2f')],'raw':!![]})[_0xd949('0x1e')](function(_0x118f61){_0x5f4d45[_0xd949('0x30')]=util[_0xd949('0x31')](_0xd949('0x32'),_0x118f61['name']);_0x5f4d45[_0xd949('0x33')]=_0x5e7c01;_0x5f4d45[_0xd949('0x34')]=_0x118f61;return request({'event':_0xd949('0x35'),'message':_0x5f4d45});})[_0xd949('0x36')](function(_0x295dbd){console['error'](_0x295dbd);});}else{return request({'event':'outgoingmessage','message':_0x5f4d45});}});};}function afterCreate(_0x4331e3,_0xf39140){return function(_0x9091b7,_0x1c6677){_0x9091b7=_0x9091b7[_0xd949('0x37')]({'plain':!![]});_0x9091b7[_0xd949('0x33')]=_0x4331e3;_0x9091b7['motionChannel']=_0x4331e3;_0x9091b7['event']=_0xd949('0x38');var _0x4cd509=_0xd949('0x39')+_0x9091b7[_0xd949('0x3a')];return db[_0xd949('0x25')][_0xd949('0x26')](_0x4cd509,{'type':db[_0xd949('0x3b')][_0xd949('0x27')][_0xd949('0x3c')],'raw':!![]})[_0xd949('0x1e')](function(_0x12a87f){return _0x12a87f;})[_0xd949('0x1e')](function(_0x3c5810){if(_0x3c5810){_0x9091b7[_0xd949('0x28')]=_0x3c5810[0x0];}return request({'event':_0xf39140,'message':_0x9091b7});});};}function afterUpdate(_0x2127fb,_0x417f86){return function(_0x445c8e,_0x6efcaa){if(_0x445c8e[_0xd949('0x3d')](_0xd949('0x3e'))&&_0x445c8e[_0xd949('0x3e')]){_0x445c8e=_0x445c8e[_0xd949('0x37')]({'plain':!![]});_0x445c8e[_0xd949('0x33')]=_0x2127fb;_0x445c8e['motionChannel']=_0x2127fb;_0x445c8e[_0xd949('0x3f')]=_0xd949('0x3e');var _0x462202=_0xd949('0x39')+_0x445c8e['ContactId'];return db[_0xd949('0x25')]['query'](_0x462202,{'type':db[_0xd949('0x3b')]['QueryTypes'][_0xd949('0x3c')],'raw':!![]})[_0xd949('0x1e')](function(_0x308c1d){return _0x308c1d;})[_0xd949('0x1e')](function(_0x1b40ad){if(_0x1b40ad){_0x445c8e[_0xd949('0x28')]=_0x1b40ad[0x0];}if(_0x445c8e[_0xd949('0x29')]){return db[_0xd949('0x2a')]['find']({'where':{'id':_0x445c8e[_0xd949('0x29')]},'attributes':['id',_0xd949('0x2c'),_0xd949('0x2d'),'email','internal'],'raw':!![]})['then'](function(_0x207488){_0x445c8e[_0xd949('0x30')]=util[_0xd949('0x31')](_0xd949('0x32'),_0x207488[_0xd949('0x2c')]);_0x445c8e[_0xd949('0x34')]=_0x207488;return request({'event':_0x417f86,'message':_0x445c8e});})[_0xd949('0x36')](function(_0x381627){console[_0xd949('0x21')](_0x381627);});}else{return request({'event':_0x417f86,'message':_0x445c8e});}});}else if(_0x445c8e[_0xd949('0x3d')](_0xd949('0x18'))){_0x445c8e=_0x445c8e[_0xd949('0x37')]({'plain':!![]});_0x445c8e[_0xd949('0x33')]=_0x2127fb;_0x445c8e[_0xd949('0x3f')]=_0xd949('0x18');var _0x462202=_0xd949('0x39')+_0x445c8e['ContactId'];return db[_0xd949('0x25')]['query'](_0x462202,{'type':db[_0xd949('0x3b')]['QueryTypes'][_0xd949('0x3c')],'raw':!![]})['then'](function(_0x12403d){return _0x12403d;})['then'](function(_0x26d1e4){if(_0x26d1e4){_0x445c8e[_0xd949('0x28')]=_0x26d1e4[0x0];}if(_0x445c8e[_0xd949('0x29')]){return db[_0xd949('0x2a')][_0xd949('0x2b')]({'where':{'id':_0x445c8e['UserId']},'attributes':['id',_0xd949('0x2c'),_0xd949('0x2d'),_0xd949('0x2e'),_0xd949('0x2f')],'raw':!![]})[_0xd949('0x1e')](function(_0x326c35){_0x445c8e[_0xd949('0x30')]=util[_0xd949('0x31')]('SIP/%s',_0x326c35[_0xd949('0x2c')]);_0x445c8e[_0xd949('0x34')]=_0x326c35;return request({'event':_0x417f86,'message':_0x445c8e});})[_0xd949('0x36')](function(_0x55db8c){console['error'](_0x55db8c);});}else{return request({'event':_0x417f86,'message':_0x445c8e});}});}};}exports[_0xd949('0x40')]=function(){for(var _0x59b639=0x0;_0x59b639=_0xded07c[_0xaced('0x15')]){throw Error(_0xaced('0x16'));}_0x590f30(_0x261b1e);})[_0xaced('0x17')](function(_0x6c5fd){_0x2989ce(_0x6c5fd);});});}; \ No newline at end of file +var _0xcbad=['then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','fax','sms','openchannel','toLowerCase','includes','isUndefined','blockedAt','getLicense','role','agent','count'];(function(_0x2e2fb1,_0x21189c){var _0x885dcd=function(_0x405016){while(--_0x405016){_0x2e2fb1['push'](_0x2e2fb1['shift']());}};_0x885dcd(++_0x21189c);}(_0xcbad,0x1f0));var _0xdcba=function(_0x1a1fac,_0x9471ee){_0x1a1fac=_0x1a1fac-0x0;var _0x1bd74c=_0xcbad[_0x1a1fac];return _0x1bd74c;};'use strict';var _=require(_0xdcba('0x0'));var BPromise=require(_0xdcba('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xdcba('0x2'));var channels=['voice','mail','chat',_0xdcba('0x3'),_0xdcba('0x4'),'whatsapp',_0xdcba('0x5')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x1f16f0){_0x1f16f0=_0x1f16f0[_0xdcba('0x6')]();return _[_0xdcba('0x7')](channels,_0x1f16f0);};exports['clearBlockUser']=function(_0x12dc88,_0xfce5d0,_0x4596a5,_0x3cac4d){var _0x4a52fd={'loginAttempts':_0xfce5d0,'blocked':_0x4596a5};if(!_[_0xdcba('0x8')](_0x3cac4d)){_0x4a52fd[_0xdcba('0x9')]=_0x3cac4d;}return _0x12dc88['updateAttributes'](_0x4a52fd);};exports[_0xdcba('0xa')]=function(_0x43a7d9){return new BPromise(function(_0x1f89d8,_0x3b351b){var _0x18d0c3=0x0;if(_0x43a7d9[_0xdcba('0xb')]!==_0xdcba('0xc')){_0x1f89d8(_0x43a7d9);}db['User'][_0xdcba('0xd')]({'where':{'role':_0xdcba('0xc'),'online':!![],'id':{'$ne':_0x43a7d9['id']}}})[_0xdcba('0xe')](function(_0x49ba7b){_0x18d0c3=_0x49ba7b;return util[_0xdcba('0xa')]();})[_0xdcba('0xe')](function(_0x23d3ed){if(_0x23d3ed&&_0x23d3ed[_0xdcba('0xf')]&&_0x18d0c3>=_0x23d3ed['agents']){throw Error(_0xdcba('0x10'));}_0x1f89d8(_0x43a7d9);})['catch'](function(_0x16a726){_0x3b351b(_0x16a726);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index febaf6c..89a65bd 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86f5=['exports','status','render','json'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x86f5,0x74));var _0x586f=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x86f5[_0x314a8c];return _0x1d4607;};'use strict';module[_0x586f('0x0')][0x194]=function pageNotFound(_0x50c818,_0x207b25){var _0x315e14='404';var _0xef9d40=0x194;var _0x53a81d={'status':_0xef9d40};_0x207b25['status'](_0x53a81d[_0x586f('0x1')]);_0x207b25[_0x586f('0x2')](_0x315e14,{},function(_0x35c11a,_0x1baef5){if(_0x35c11a){return _0x207b25['status'](_0x53a81d[_0x586f('0x1')])[_0x586f('0x3')](_0x53a81d);}_0x207b25['send'](_0x1baef5);});}; \ No newline at end of file +var _0x399d=['exports','status'];(function(_0x384622,_0x5e798b){var _0x19d3b7=function(_0xa99323){while(--_0xa99323){_0x384622['push'](_0x384622['shift']());}};_0x19d3b7(++_0x5e798b);}(_0x399d,0x196));var _0xd399=function(_0x2986c3,_0x30bb95){_0x2986c3=_0x2986c3-0x0;var _0x27cc6c=_0x399d[_0x2986c3];return _0x27cc6c;};'use strict';module[_0xd399('0x0')][0x194]=function pageNotFound(_0x553f7a,_0x26908a){var _0x57144c='404';var _0x9a941e=0x194;var _0x1885c5={'status':_0x9a941e};_0x26908a[_0xd399('0x1')](_0x1885c5[_0xd399('0x1')]);_0x26908a['render'](_0x57144c,{},function(_0x3848e2,_0x363116){if(_0x3848e2){return _0x26908a['status'](_0x1885c5['status'])['json'](_0x1885c5);}_0x26908a['send'](_0x363116);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index c6de86a..f1e64e5 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1207=['Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteraction','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','UserProfile','userProfileId','belongsToMany','Groups','CmContact','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','MailQueues','UserMailQueue','FaxQueues','SmsQueues','OpenchannelQueues','CmList','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','belongsTo','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Team','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Dispositions','MailMessage','Interactions','List','ListId','TemplateId','Agents','Teams','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Dashboard','DashboardItem','FaxAccountId','FaxApplication','Exntensions','mandatoryDispositionPause','FaxQueue','FaxInteractionId','Account','fax_interaction_has_tags','Interaction','AttachmentId','UserFaxQueue','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','Answers','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','SmsInteractions','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','MailApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','cm_contact_has_tags','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','Configurations','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','FreshsalesConfiguration','ChatQueueReport','FromId','SessionId','SmsQueueReport','ProjectId','user_has_square_projects','team_has_mail_queues','ChatQueues','WhatsappQueues','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAccount','ToAgent','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','lodash','jstz','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','motion2','mysql','name','username','password','options','database','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','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','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','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/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','VoiceRecording','VoiceQueuesRt'];(function(_0x13df51,_0x2a4a85){var _0x16433e=function(_0x3f42fc){while(--_0x3f42fc){_0x13df51['push'](_0x13df51['shift']());}};_0x16433e(++_0x2a4a85);}(_0x1207,0xe1));var _0x7120=function(_0x48c77b,_0x219560){_0x48c77b=_0x48c77b-0x0;var _0x49c3f3=_0x1207[_0x48c77b];return _0x49c3f3;};'use strict';var config=require(_0x7120('0x0'));var Sequelize=require('sequelize');var _=require(_0x7120('0x1'));var jstz=require(_0x7120('0x2'));var timezone=jstz['determine']();config[_0x7120('0x3')]=_[_0x7120('0x4')](config['sequelize'],{'database':'motion2','username':_0x7120('0x5'),'password':_0x7120('0x6'),'options':{'host':_0x7120('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7120('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7120('0x9'),'collate':_0x7120('0xa')}}});config[_0x7120('0xb')]=_[_0x7120('0x4')](config['sequelizeHistory'],{'database':_0x7120('0xc'),'username':_0x7120('0x5'),'password':_0x7120('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x7120('0xd'),'dialectOptions':{'charset':_0x7120('0x8')},'logging':![],'timezone':timezone[_0x7120('0xe')](),'define':{'charset':_0x7120('0x9'),'collate':_0x7120('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7120('0x3')]['database'],config[_0x7120('0x3')][_0x7120('0xf')],config[_0x7120('0x3')][_0x7120('0x10')],config['sequelize'][_0x7120('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7120('0xb')][_0x7120('0x12')],config[_0x7120('0xb')]['username'],config[_0x7120('0xb')]['password'],config[_0x7120('0xb')][_0x7120('0x11')])};db[_0x7120('0x13')]=db[_0x7120('0x3')]['import'](_0x7120('0x14'));db[_0x7120('0x15')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x17'));db[_0x7120('0x18')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x19'));db[_0x7120('0x1a')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x1b'));db[_0x7120('0x1c')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x1d'));db['VoiceQueue']=db[_0x7120('0x3')]['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x7120('0x3')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x7120('0x1e')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x1f'));db[_0x7120('0x20')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x21'));db[_0x7120('0x22')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x23'));db[_0x7120('0x24')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/voiceCallReport/voiceCallReport.model');db[_0x7120('0x25')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x26'));db[_0x7120('0x27')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x28'));db[_0x7120('0x29')]=db[_0x7120('0x3')]['import'](_0x7120('0x2a'));db['MemberReport']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x2b'));db['Trunk']=db['sequelize']['import'](_0x7120('0x2c'));db['VoiceTransferReport']=db[_0x7120('0x3')]['import'](_0x7120('0x2d'));db[_0x7120('0x2e')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x7120('0x2f')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x30'));db[_0x7120('0x31')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x7120('0x3')]['import'](_0x7120('0x32'));db['UserFaxQueue']=db[_0x7120('0x3')]['import'](_0x7120('0x33'));db[_0x7120('0x34')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x35'));db[_0x7120('0x36')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x37'));db[_0x7120('0x38')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/mailServerIn/mailServerIn.model');db[_0x7120('0x39')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x3a'));db[_0x7120('0x3b')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/mailAccount/mailAccount.model');db[_0x7120('0x3c')]=db[_0x7120('0x3')]['import']('../api/mailQueue/mailQueue.model');db[_0x7120('0x3d')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x3e'));db['MailInteraction']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x3f'));db['MailMessage']=db[_0x7120('0x3')]['import'](_0x7120('0x40'));db[_0x7120('0x41')]=db[_0x7120('0x3')]['import'](_0x7120('0x42'));db[_0x7120('0x43')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x44'));db['DashboardItem']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x45'));db[_0x7120('0x46')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x47'));db['FaxInteraction']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x48'));db[_0x7120('0x49')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x4a'));db['FaxQueue']=db[_0x7120('0x3')]['import'](_0x7120('0x4b'));db['FaxQueueReport']=db[_0x7120('0x3')][_0x7120('0x16')]('../api/faxQueueReport/faxQueueReport.model');db[_0x7120('0x4c')]=db[_0x7120('0x3')]['import']('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x4d'));db[_0x7120('0x4e')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x4f'));db[_0x7120('0x50')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/smsMessage/smsMessage.model');db[_0x7120('0x51')]=db['sequelize'][_0x7120('0x16')]('../api/smsQueue/smsQueue.model');db[_0x7120('0x52')]=db['sequelize'][_0x7120('0x16')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize'][_0x7120('0x16')](_0x7120('0x53'));db[_0x7120('0x54')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x7120('0x55')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x56'));db[_0x7120('0x57')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x58'));db[_0x7120('0x59')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x5a'));db[_0x7120('0x5b')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x5c'));db[_0x7120('0x5d')]=db['sequelize'][_0x7120('0x16')]('../api/chatApplication/chatApplication.model');db[_0x7120('0x5e')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x5f'));db[_0x7120('0x60')]=db[_0x7120('0x3')]['import'](_0x7120('0x61'));db[_0x7120('0x62')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x63'));db[_0x7120('0x64')]=db[_0x7120('0x3')]['import'](_0x7120('0x65'));db[_0x7120('0x66')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x67'));db[_0x7120('0x68')]=db[_0x7120('0x3')]['import'](_0x7120('0x69'));db[_0x7120('0x6a')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x6b'));db['CmContact']=db[_0x7120('0x3')][_0x7120('0x16')]('../api/cmContact/cmContact.model');db[_0x7120('0x6c')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x6d'));db[_0x7120('0x6e')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x6f'));db[_0x7120('0x70')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x7120('0x71')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x72'));db[_0x7120('0x73')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x74'));db[_0x7120('0x75')]=db[_0x7120('0x3')]['import'](_0x7120('0x76'));db[_0x7120('0x77')]=db[_0x7120('0x3')]['import'](_0x7120('0x78'));db[_0x7120('0x79')]=db[_0x7120('0x3')]['import']('../api/automation/automation.model');db[_0x7120('0x7a')]=db[_0x7120('0x3')]['import'](_0x7120('0x7b'));db[_0x7120('0x7c')]=db['sequelize'][_0x7120('0x16')]('../api/disposition/disposition.model');db['Condition']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x7d'));db['Interval']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x7e'));db[_0x7120('0x7f')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x80'));db['Cdr']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x81'));db[_0x7120('0x82')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x83'));db[_0x7120('0x84')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x85'));db[_0x7120('0x86')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x87'));db[_0x7120('0x88')]=db['sequelize'][_0x7120('0x16')]('../api/tag/tag.model');db[_0x7120('0x89')]=db['sequelize']['import'](_0x7120('0x8a'));db[_0x7120('0x8b')]=db['sequelize']['import'](_0x7120('0x8c'));db[_0x7120('0x8d')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x8e'));db[_0x7120('0x8f')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x90'));db[_0x7120('0x91')]=db[_0x7120('0x3')]['import'](_0x7120('0x92'));db['AnalyticCustomReport']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x93'));db[_0x7120('0x94')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x95'));db[_0x7120('0x96')]=db['sequelize'][_0x7120('0x16')](_0x7120('0x97'));db[_0x7120('0x98')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x99'));db[_0x7120('0x9a')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x9b'));db['AnalyticTreeReport']=db[_0x7120('0x3')]['import'](_0x7120('0x9c'));db[_0x7120('0x9d')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x7120('0x9e')]=db['sequelize']['import'](_0x7120('0x9f'));db['SalesforceField']=db[_0x7120('0x3')]['import'](_0x7120('0xa0'));db['SugarcrmAccount']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xa1'));db[_0x7120('0xa2')]=db['sequelize'][_0x7120('0x16')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x7120('0xa3')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xa4'));db[_0x7120('0xa5')]=db['sequelize'][_0x7120('0x16')]('../api/intDeskAccount/intDeskAccount.model');db[_0x7120('0xa6')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xa7'));db[_0x7120('0xa8')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xa9'));db[_0x7120('0xaa')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xab'));db[_0x7120('0xac')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xad'));db[_0x7120('0xae')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xaf'));db[_0x7120('0xb0')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xb1'));db[_0x7120('0xb2')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xb3'));db[_0x7120('0xb4')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xb5'));db[_0x7120('0xb6')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xb7'));db[_0x7120('0xb8')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xb9'));db['FreshdeskField']=db['sequelize'][_0x7120('0x16')](_0x7120('0xba'));db['VtigerAccount']=db['sequelize']['import'](_0x7120('0xbb'));db[_0x7120('0xbc')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xbd'));db[_0x7120('0xbe')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xbf'));db[_0x7120('0xc0')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xc1'));db[_0x7120('0xc2')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xc3'));db[_0x7120('0xc4')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/intServicenowField/intServicenowField.model');db[_0x7120('0xc5')]=db[_0x7120('0x3')]['import'](_0x7120('0xc6'));db[_0x7120('0xc7')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xc8'));db[_0x7120('0xc9')]=db[_0x7120('0x3')]['import'](_0x7120('0xca'));db[_0x7120('0xcb')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xcc'));db['FreshsalesConfiguration']=db[_0x7120('0x3')][_0x7120('0x16')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x7120('0xcd')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x7120('0x8f')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x90'));db[_0x7120('0xce')]=db[_0x7120('0x3')]['import']('../api/network/network.model');db['ChatQueueReport']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xcf'));db[_0x7120('0xd0')]=db[_0x7120('0x3')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x7120('0xd1')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x7120('0xd2')]=db['sequelize'][_0x7120('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x7120('0xd3')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xd4'));db['SmsQueueReport']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xd5'));db[_0x7120('0xd6')]=db[_0x7120('0x3')]['import'](_0x7120('0xd7'));db[_0x7120('0xd8')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xd9'));db[_0x7120('0xda')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xdb'));db[_0x7120('0xdc')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xdd'));db[_0x7120('0xde')]=db['sequelize'][_0x7120('0x16')]('../api/squareOdbc/squareOdbc.model');db[_0x7120('0xdf')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/squareProject/squareProject.model');db[_0x7120('0xe0')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xe1'));db[_0x7120('0xe2')]=db['sequelize'][_0x7120('0x16')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x7120('0x3')][_0x7120('0x16')]('../api/team/team.model');db['License']=db[_0x7120('0x3')][_0x7120('0x16')]('../api/license/license.model');db[_0x7120('0xe3')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xe4'));db[_0x7120('0xe5')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xe6'));db[_0x7120('0xe7')]=db[_0x7120('0x3')]['import']('../api/attachment/attachment.model');db[_0x7120('0xe8')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xe9'));db['MailTransferReport']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xea'));db[_0x7120('0xeb')]=db['sequelize']['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x7120('0xec')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/faxTransferReport/faxTransferReport.model');db[_0x7120('0xed')]=db[_0x7120('0x3')]['import'](_0x7120('0xee'));db[_0x7120('0xef')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xf0'));db['CmList']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xf1'));db[_0x7120('0xf2')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xf3'));db[_0x7120('0xf4')]=db[_0x7120('0x3')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x7120('0xf5')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xf6'));db[_0x7120('0xf7')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xf8'));db[_0x7120('0xf9')]=db[_0x7120('0x3')][_0x7120('0x16')]('../api/whatsappAccount/whatsappAccount.model');db[_0x7120('0xfa')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xfb'));db[_0x7120('0xfc')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0xfd'));db[_0x7120('0xfe')]=db['sequelize'][_0x7120('0x16')](_0x7120('0xff'));db[_0x7120('0x100')]=db[_0x7120('0x3')]['import'](_0x7120('0x101'));db[_0x7120('0x102')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x103'));db[_0x7120('0x104')]=db[_0x7120('0x3')]['import'](_0x7120('0x105'));db[_0x7120('0x106')]=db[_0x7120('0x3')]['import'](_0x7120('0x107'));db[_0x7120('0x108')]=db[_0x7120('0x3')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x7120('0x109')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x10a'));db[_0x7120('0x10b')]=db[_0x7120('0x3')][_0x7120('0x16')](_0x7120('0x10c'));db[_0x7120('0x13')][_0x7120('0x10d')](db[_0x7120('0x20')],{'as':'VoiceMail','onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x13')][_0x7120('0x110')](db[_0x7120('0x111')],{'as':'Recordings','foreignKey':_0x7120('0x10f')});db[_0x7120('0x13')]['hasMany'](db[_0x7120('0x2e')],{'as':_0x7120('0x112'),'foreignKey':'UserId'});db['User'][_0x7120('0x110')](db[_0x7120('0x1a')],{'as':_0x7120('0x113'),'onDelete':_0x7120('0x10e'),'hooks':!![]});db[_0x7120('0x13')][_0x7120('0x110')](db[_0x7120('0x70')],{'as':_0x7120('0x114'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x7120('0x71')],{'as':_0x7120('0x115'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x13')][_0x7120('0x110')](db[_0x7120('0x73')],{'as':_0x7120('0x73'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x13')][_0x7120('0x110')](db[_0x7120('0x54')],{'as':_0x7120('0x116'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x13')][_0x7120('0x110')](db['ChatInteraction'],{'as':_0x7120('0x117'),'foreignKey':'UserId'});db['User']['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x7120('0x10f')});db[_0x7120('0x13')][_0x7120('0x110')](db[_0x7120('0x118')],{'as':_0x7120('0x119'),'foreignKey':'UserId'});db['User'][_0x7120('0x110')](db[_0x7120('0x11a')],{'as':_0x7120('0x11b'),'foreignKey':_0x7120('0x10f')});db['User'][_0x7120('0x110')](db[_0x7120('0xfc')],{'as':_0x7120('0x11c'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x13')][_0x7120('0x110')](db[_0x7120('0xf7')],{'as':_0x7120('0x11d'),'foreignKey':'SenderId'});db[_0x7120('0x13')]['belongsTo'](db[_0x7120('0x11e')],{'as':_0x7120('0x11e'),'foreignKey':_0x7120('0x11f')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x66')],{'as':_0x7120('0x121'),'through':'chat_group_has_users'});db['User']['belongsToMany'](db[_0x7120('0x122')],{'as':_0x7120('0x123'),'through':_0x7120('0x124')});db['User']['belongsToMany'](db['CmList'],{'as':'Lists','through':_0x7120('0x125')});db[_0x7120('0x13')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0x7120('0x13')][_0x7120('0x120')](db['MailInteraction'],{'as':_0x7120('0x11b'),'through':_0x7120('0x126')});db[_0x7120('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':_0x7120('0x117'),'through':_0x7120('0x127')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x118')],{'as':'FaxInteractions','through':_0x7120('0x128')});db['User'][_0x7120('0x120')](db[_0x7120('0x4e')],{'as':'SmsInteractions','through':_0x7120('0x129')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x54')],{'as':'OpenchannelInteractions','through':_0x7120('0x12a')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0xfc')],{'as':_0x7120('0x11c'),'through':'user_has_whatsapp_interactions'});db[_0x7120('0x13')]['belongsToMany'](db[_0x7120('0x12b')],{'as':_0x7120('0x12c'),'through':_0x7120('0x2f'),'required':![]});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0xf2')],{'as':'VoicePrefixes','through':_0x7120('0x10b'),'required':![]});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x3c')],{'as':_0x7120('0x12d'),'through':_0x7120('0x12e'),'required':![]});db['User'][_0x7120('0x120')](db[_0x7120('0x64')],{'as':'ChatQueues','through':_0x7120('0x31'),'required':![],'hooks':!![]});db[_0x7120('0x13')][_0x7120('0x120')](db['FaxQueue'],{'as':_0x7120('0x12f'),'through':'UserFaxQueue','required':![]});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x51')],{'as':_0x7120('0x130'),'through':_0x7120('0x34'),'required':![]});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x57')],{'as':_0x7120('0x131'),'through':_0x7120('0x36'),'required':![]});db[_0x7120('0x13')]['belongsToMany'](db[_0x7120('0x104')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x7120('0x13')]['belongsToMany'](db[_0x7120('0x132')],{'through':_0x7120('0x125')});db[_0x7120('0x13')][_0x7120('0x120')](db['VoicePrefix'],{'as':_0x7120('0x133'),'through':_0x7120('0x134'),'required':![]});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x59')],{'as':_0x7120('0x135'),'through':_0x7120('0x136')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x46')],{'as':_0x7120('0x137'),'through':_0x7120('0x138')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x3b')],{'as':_0x7120('0x139'),'through':_0x7120('0x13a')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x52')],{'as':_0x7120('0x13b'),'through':_0x7120('0x13c')});db[_0x7120('0x13')][_0x7120('0x120')](db[_0x7120('0x4c')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0x7120('0xf9')],{'as':_0x7120('0x13d'),'through':_0x7120('0x13e')});db[_0x7120('0x13')]['belongsToMany'](db[_0x7120('0xdf')],{'as':_0x7120('0x13f'),'through':'user_has_square_projects'});db[_0x7120('0x15')][_0x7120('0x110')](db['VoiceExtension'],{'as':_0x7120('0x140'),'onDelete':'cascade','foreignKey':_0x7120('0x141')});db[_0x7120('0x18')][_0x7120('0x110')](db[_0x7120('0x1a')],{'onDelete':_0x7120('0x10e')});db[_0x7120('0x1a')][_0x7120('0x110')](db[_0x7120('0x1a')],{'as':_0x7120('0x142'),'onDelete':'cascade'});db[_0x7120('0x1c')][_0x7120('0x120')](db[_0x7120('0x86')],{'as':_0x7120('0x143'),'through':_0x7120('0x144')});db[_0x7120('0x12b')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x7120('0x145'),'foreignKey':_0x7120('0x146')});db['VoiceQueue'][_0x7120('0x110')](db[_0x7120('0x6c')],{'as':_0x7120('0x147'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x7120('0x110')](db[_0x7120('0x70')],{'as':_0x7120('0x114'),'foreignKey':_0x7120('0x146')});db[_0x7120('0x12b')][_0x7120('0x110')](db[_0x7120('0x71')],{'as':_0x7120('0x148'),'foreignKey':_0x7120('0x146')});db[_0x7120('0x12b')][_0x7120('0x110')](db['ReportAgentPreview'],{'as':_0x7120('0x73'),'foreignKey':_0x7120('0x146')});db[_0x7120('0x12b')][_0x7120('0x110')](db[_0x7120('0x6e')],{'as':_0x7120('0x149'),'foreignKey':_0x7120('0x146')});db[_0x7120('0x12b')][_0x7120('0x110')](db[_0x7120('0xd3')],{'as':'JscriptySessions','foreignKey':_0x7120('0x146')});db[_0x7120('0x12b')][_0x7120('0x14a')](db[_0x7120('0x14b')],{'as':'Trunk','foreignKey':_0x7120('0x14c')});db['VoiceQueue'][_0x7120('0x14a')](db[_0x7120('0x14b')],{'as':_0x7120('0x14d'),'foreignKey':_0x7120('0x14e')});db['VoiceQueue']['belongsTo'](db[_0x7120('0x14f')],{'as':_0x7120('0x14f'),'foreignKey':_0x7120('0x150')});db[_0x7120('0x12b')][_0x7120('0x14a')](db[_0x7120('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x7120('0x151')});db['VoiceQueue']['belongsToMany'](db[_0x7120('0x132')],{'as':_0x7120('0x152'),'through':_0x7120('0x153')});db['VoiceQueue'][_0x7120('0x120')](db['User'],{'as':'Agents','through':_0x7120('0x2f')});db['VoiceQueue']['belongsToMany'](db[_0x7120('0x154')],{'as':'Teams','through':_0x7120('0x108')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x7120('0x155'),'through':_0x7120('0x156')});db[_0x7120('0x111')][_0x7120('0x14a')](db[_0x7120('0x13')],{'as':'User','foreignKey':_0x7120('0x10f')});db[_0x7120('0x1e')][_0x7120('0x14a')](db[_0x7120('0x13')],{'as':_0x7120('0x13'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x20')][_0x7120('0x110')](db[_0x7120('0x22')],{'as':_0x7120('0x157'),'onDelete':'cascade','foreignKey':_0x7120('0x158'),'sourceKey':_0x7120('0x159')});db['VoiceMailMessage']['belongsTo'](db[_0x7120('0x20')],{'foreignKey':'mailboxuser','targetKey':_0x7120('0x159')});db[_0x7120('0x24')][_0x7120('0x110')](db[_0x7120('0x29')],{'as':_0x7120('0x15a'),'foreignKey':_0x7120('0x15b'),'constraints':![]});db[_0x7120('0x24')][_0x7120('0x110')](db[_0x7120('0x27')],{'as':_0x7120('0x15c'),'foreignKey':_0x7120('0x15b'),'constraints':![]});db['VoiceCallReport'][_0x7120('0x14a')](db[_0x7120('0x13')],{'as':_0x7120('0x13'),'foreignKey':_0x7120('0x10f')});db['VoiceCallReport'][_0x7120('0x14a')](db['CmContact'],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db['MailServerIn'][_0x7120('0x14a')](db[_0x7120('0x3b')],{'as':'MailAccount','foreignKey':_0x7120('0x15f')});db[_0x7120('0x39')][_0x7120('0x14a')](db[_0x7120('0x3b')],{'as':_0x7120('0x3b'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x7120('0x10d')](db['MailServerIn'],{'as':_0x7120('0x160'),'onDelete':'cascade'});db['MailAccount'][_0x7120('0x10d')](db[_0x7120('0x39')],{'as':'Smtp','onDelete':_0x7120('0x10e')});db['MailAccount'][_0x7120('0x110')](db[_0x7120('0x7c')],{'as':_0x7120('0x161'),'foreignKey':_0x7120('0x15f'),'onDelete':'cascade'});db['MailAccount'][_0x7120('0x110')](db[_0x7120('0x7a')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x7120('0x3b')][_0x7120('0x110')](db[_0x7120('0x162')],{'as':_0x7120('0x157'),'foreignKey':_0x7120('0x15f')});db[_0x7120('0x3b')][_0x7120('0x110')](db[_0x7120('0x11a')],{'as':_0x7120('0x163')});db[_0x7120('0x3b')][_0x7120('0x110')](db[_0x7120('0x41')],{'as':'Applications'});db[_0x7120('0x3b')]['belongsTo'](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165')});db['MailAccount']['belongsTo'](db['Template'],{'as':_0x7120('0x89'),'foreignKey':_0x7120('0x166')});db['MailAccount']['belongsTo'](db[_0x7120('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x7120('0x151')});db[_0x7120('0x3b')]['belongsToMany'](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x13a')});db[_0x7120('0x3c')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x12e')});db['MailQueue']['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0x7120('0x168')});db[_0x7120('0x11a')][_0x7120('0x110')](db[_0x7120('0x162')],{'as':_0x7120('0x157'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x169')});db[_0x7120('0x11a')][_0x7120('0x14a')](db[_0x7120('0x3b')],{'as':'Account','foreignKey':_0x7120('0x15f')});db[_0x7120('0x11a')]['belongsTo'](db['CmContact'],{'as':_0x7120('0x15d'),'foreignKey':'ContactId'});db[_0x7120('0x11a')]['belongsTo'](db[_0x7120('0x13')],{'as':_0x7120('0x16a'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x11a')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x16b'),'as':_0x7120('0x16c')});db[_0x7120('0x11a')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x7120('0x16d')});db[_0x7120('0x11a')][_0x7120('0x120')](db['User'],{'as':_0x7120('0x16e'),'through':_0x7120('0x126'),'foreignKey':_0x7120('0x169')});db['MailMessage'][_0x7120('0x110')](db[_0x7120('0xe7')],{'as':_0x7120('0x16f'),'onDelete':'cascade'});db[_0x7120('0x162')]['belongsTo'](db[_0x7120('0x13')],{'as':_0x7120('0x13')});db[_0x7120('0x162')][_0x7120('0x14a')](db[_0x7120('0x122')],{'onDelete':_0x7120('0x10e'),'as':_0x7120('0x15d')});db[_0x7120('0x162')][_0x7120('0x14a')](db[_0x7120('0x11a')],{'as':'Interaction','foreignKey':_0x7120('0x169')});db[_0x7120('0x162')]['belongsTo'](db[_0x7120('0x3b')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x7120('0x162')][_0x7120('0x14a')](db[_0x7120('0x59')],{'as':_0x7120('0x59'),'foreignKey':_0x7120('0x170')});db[_0x7120('0x162')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x7120('0x171')});db[_0x7120('0x41')]['belongsTo'](db[_0x7120('0x13')],{'onDelete':'restrict'});db[_0x7120('0x41')][_0x7120('0x14a')](db['MailQueue'],{'onDelete':'restrict'});db[_0x7120('0x41')]['belongsTo'](db[_0x7120('0x3b')],{'onDelete':_0x7120('0x172')});db[_0x7120('0x41')]['belongsTo'](db[_0x7120('0x14f')],{'onDelete':_0x7120('0x172'),'foreignKey':_0x7120('0x150')});db[_0x7120('0x41')]['belongsTo'](db[_0x7120('0x88')],{'onDelete':_0x7120('0x172'),'foreignKey':_0x7120('0x173')});db[_0x7120('0x43')][_0x7120('0x14a')](db[_0x7120('0x3b')],{});db[_0x7120('0x43')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165')});db[_0x7120('0x43')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db[_0x7120('0x43')][_0x7120('0x14a')](db[_0x7120('0x11a')],{});db[_0x7120('0x43')][_0x7120('0x14a')](db['MailMessage'],{});db[_0x7120('0x43')][_0x7120('0x14a')](db[_0x7120('0x13')],{});db[_0x7120('0x43')]['belongsTo'](db[_0x7120('0x3c')],{});db[_0x7120('0x174')]['hasMany'](db[_0x7120('0x175')],{'as':'Items','onDelete':_0x7120('0x10e')});db['FaxAccount'][_0x7120('0x110')](db['Disposition'],{'as':_0x7120('0x161'),'foreignKey':_0x7120('0x176'),'onDelete':_0x7120('0x10e')});db['FaxAccount']['hasMany'](db[_0x7120('0x7a')],{'as':'Answers','foreignKey':_0x7120('0x176')});db['FaxAccount'][_0x7120('0x110')](db[_0x7120('0x118')],{'as':_0x7120('0x163')});db['FaxAccount'][_0x7120('0x110')](db[_0x7120('0x177')],{'as':_0x7120('0x142')});db[_0x7120('0x46')][_0x7120('0x110')](db[_0x7120('0x1a')],{'as':_0x7120('0x178'),'onDelete':_0x7120('0x10e')});db[_0x7120('0x46')][_0x7120('0x110')](db['FaxMessage'],{'as':_0x7120('0x157')});db[_0x7120('0x46')]['belongsTo'](db[_0x7120('0x14b')],{'as':_0x7120('0x14b')});db[_0x7120('0x46')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165')});db['FaxAccount']['belongsTo'](db[_0x7120('0x7f')],{'as':_0x7120('0x179'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7120('0x46')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x138')});db[_0x7120('0x177')][_0x7120('0x14a')](db[_0x7120('0x13')],{'onDelete':_0x7120('0x172')});db['FaxApplication'][_0x7120('0x14a')](db[_0x7120('0x17a')],{'onDelete':'restrict'});db[_0x7120('0x177')][_0x7120('0x14a')](db[_0x7120('0x46')],{'onDelete':_0x7120('0x172')});db[_0x7120('0x177')]['belongsTo'](db[_0x7120('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db['FaxInteraction'][_0x7120('0x110')](db['FaxMessage'],{'as':'Messages','onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x17b')});db['FaxInteraction'][_0x7120('0x14a')](db[_0x7120('0x46')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x176')});db[_0x7120('0x118')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db['FaxInteraction'][_0x7120('0x14a')](db['User'],{'as':_0x7120('0x16a'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x118')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':'fax_interaction_has_tags','as':_0x7120('0x16c')});db[_0x7120('0x118')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x17d'),'as':_0x7120('0x16d')});db[_0x7120('0x118')][_0x7120('0x120')](db['User'],{'as':_0x7120('0x16e'),'through':'user_has_fax_interactions','foreignKey':_0x7120('0x17b')});db['FaxMessage'][_0x7120('0x14a')](db[_0x7120('0x13')],{'onDelete':'cascade','as':_0x7120('0x13')});db[_0x7120('0x49')][_0x7120('0x14a')](db[_0x7120('0x118')],{'as':_0x7120('0x17e'),'foreignKey':_0x7120('0x17b')});db[_0x7120('0x49')]['belongsTo'](db[_0x7120('0x122')],{'onDelete':_0x7120('0x10e'),'as':'Contact'});db[_0x7120('0x49')][_0x7120('0x14a')](db[_0x7120('0xe7')],{'as':_0x7120('0xe7'),'foreignKey':_0x7120('0x17f')});db[_0x7120('0x49')][_0x7120('0x14a')](db[_0x7120('0x46')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x176')});db[_0x7120('0x17a')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x180')});db[_0x7120('0x17a')][_0x7120('0x120')](db[_0x7120('0x154')],{'through':_0x7120('0x181'),'as':'Teams'});db['FaxQueueReport'][_0x7120('0x14a')](db[_0x7120('0x46')],{});db['FaxQueueReport'][_0x7120('0x14a')](db['CmList'],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165')});db['FaxQueueReport'][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x7120('0x14a')](db[_0x7120('0x118')],{});db[_0x7120('0x182')][_0x7120('0x14a')](db[_0x7120('0x49')],{});db['FaxQueueReport'][_0x7120('0x14a')](db[_0x7120('0x13')],{});db[_0x7120('0x182')][_0x7120('0x14a')](db['FaxQueue'],{});db[_0x7120('0x4c')][_0x7120('0x110')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7120('0x183'),'onDelete':_0x7120('0x10e')});db[_0x7120('0x4c')][_0x7120('0x110')](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x7120('0x4c')][_0x7120('0x110')](db[_0x7120('0x50')],{'as':_0x7120('0x157'),'foreignKey':_0x7120('0x183')});db[_0x7120('0x4c')][_0x7120('0x110')](db['SmsInteraction'],{'as':_0x7120('0x163')});db[_0x7120('0x4c')]['hasMany'](db[_0x7120('0x184')],{'as':_0x7120('0x142')});db[_0x7120('0x4c')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':'List','foreignKey':_0x7120('0x165')});db[_0x7120('0x4c')][_0x7120('0x14a')](db[_0x7120('0x7f')],{'as':_0x7120('0x179'),'foreignKey':_0x7120('0x151')});db['SmsAccount'][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x185')});db['SmsApplication'][_0x7120('0x14a')](db['User'],{'onDelete':_0x7120('0x172')});db['SmsApplication']['belongsTo'](db[_0x7120('0x51')],{'onDelete':'restrict'});db[_0x7120('0x184')]['belongsTo'](db[_0x7120('0x4c')],{'onDelete':_0x7120('0x172')});db[_0x7120('0x184')]['belongsTo'](db[_0x7120('0x14f')],{'onDelete':'restrict','foreignKey':_0x7120('0x150')});db[_0x7120('0x184')][_0x7120('0x14a')](db[_0x7120('0x88')],{'onDelete':_0x7120('0x172'),'foreignKey':_0x7120('0x173')});db[_0x7120('0x4e')][_0x7120('0x110')](db[_0x7120('0x50')],{'as':_0x7120('0x157'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x186')});db[_0x7120('0x4e')][_0x7120('0x14a')](db[_0x7120('0x4c')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x183')});db[_0x7120('0x4e')][_0x7120('0x14a')](db['CmContact'],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db[_0x7120('0x4e')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x7120('0x10f')});db[_0x7120('0x4e')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x187'),'as':_0x7120('0x16c')});db[_0x7120('0x4e')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x187'),'as':_0x7120('0x16d')});db[_0x7120('0x4e')]['belongsToMany'](db[_0x7120('0x13')],{'as':_0x7120('0x16e'),'through':_0x7120('0x129'),'foreignKey':'SmsInteractionId'});db[_0x7120('0x50')][_0x7120('0x14a')](db['User'],{'as':_0x7120('0x13')});db['SmsMessage'][_0x7120('0x14a')](db[_0x7120('0x122')],{'onDelete':_0x7120('0x10e'),'as':_0x7120('0x15d')});db[_0x7120('0x50')]['belongsTo'](db[_0x7120('0x4e')],{'onDelete':'cascade','as':_0x7120('0x17e'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x7120('0x14a')](db[_0x7120('0x4c')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x183')});db[_0x7120('0x51')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':'Agents','through':_0x7120('0x34'),'foreignKey':_0x7120('0x188')});db[_0x7120('0x51')][_0x7120('0x120')](db[_0x7120('0x154')],{'through':_0x7120('0x189'),'as':'Teams'});db[_0x7120('0x52')][_0x7120('0x110')](db['Disposition'],{'as':_0x7120('0x161'),'foreignKey':_0x7120('0x18a'),'onDelete':_0x7120('0x10e')});db[_0x7120('0x52')]['hasMany'](db[_0x7120('0x7a')],{'as':_0x7120('0x18b'),'foreignKey':_0x7120('0x18a')});db[_0x7120('0x52')][_0x7120('0x110')](db[_0x7120('0x54')],{'as':_0x7120('0x163'),'foreignKey':_0x7120('0x18a')});db[_0x7120('0x52')][_0x7120('0x110')](db[_0x7120('0x55')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x7120('0x110')](db[_0x7120('0x18c')],{'as':_0x7120('0x142'),'foreignKey':_0x7120('0x18a')});db[_0x7120('0x52')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165')});db[_0x7120('0x52')][_0x7120('0x14a')](db[_0x7120('0x7f')],{'as':_0x7120('0x179'),'foreignKey':_0x7120('0x151')});db[_0x7120('0x52')][_0x7120('0x120')](db['User'],{'as':_0x7120('0x167'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x7120('0x14a')](db[_0x7120('0x13')],{'onDelete':_0x7120('0x172')});db[_0x7120('0x18c')]['belongsTo'](db[_0x7120('0x57')],{'onDelete':'restrict','foreignKey':_0x7120('0x18d')});db[_0x7120('0x18c')][_0x7120('0x14a')](db[_0x7120('0x52')],{'onDelete':_0x7120('0x172'),'foreignKey':_0x7120('0x18a')});db['OpenchannelApplication'][_0x7120('0x14a')](db[_0x7120('0x14f')],{'onDelete':_0x7120('0x172'),'foreignKey':'IntervalId'});db[_0x7120('0x18c')]['belongsTo'](db[_0x7120('0x88')],{'onDelete':_0x7120('0x172'),'foreignKey':'TagId'});db[_0x7120('0x54')]['hasMany'](db[_0x7120('0x55')],{'as':_0x7120('0x157'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x18e')});db['OpenchannelInteraction'][_0x7120('0x14a')](db[_0x7120('0x52')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x18a')});db['OpenchannelInteraction'][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':'Contact','foreignKey':_0x7120('0x15e')});db['OpenchannelInteraction']['belongsTo'](db[_0x7120('0x13')],{'as':_0x7120('0x16a'),'foreignKey':'UserId'});db[_0x7120('0x54')]['belongsToMany'](db[_0x7120('0x88')],{'through':_0x7120('0x18f'),'as':_0x7120('0x16c')});db[_0x7120('0x54')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x18f'),'as':'ThroughTags'});db[_0x7120('0x54')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x16e'),'through':_0x7120('0x12a'),'foreignKey':_0x7120('0x18e')});db[_0x7120('0x55')][_0x7120('0x14a')](db[_0x7120('0x13')],{'onDelete':'cascade','as':_0x7120('0x13')});db[_0x7120('0x55')][_0x7120('0x14a')](db[_0x7120('0x122')],{'onDelete':_0x7120('0x10e'),'as':_0x7120('0x15d')});db[_0x7120('0x55')][_0x7120('0x14a')](db[_0x7120('0x54')],{'onDelete':_0x7120('0x10e'),'as':_0x7120('0x17e'),'foreignKey':_0x7120('0x18e')});db[_0x7120('0x55')][_0x7120('0x14a')](db[_0x7120('0xe7')],{'as':_0x7120('0xe7'),'foreignKey':'AttachmentId'});db[_0x7120('0x55')][_0x7120('0x14a')](db[_0x7120('0x52')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x18a')});db[_0x7120('0x57')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':'UserOpenchannelQueue','foreignKey':_0x7120('0x18d')});db[_0x7120('0x57')]['belongsToMany'](db[_0x7120('0x154')],{'through':_0x7120('0x190'),'as':_0x7120('0x168')});db[_0x7120('0x59')][_0x7120('0x110')](db['Disposition'],{'as':_0x7120('0x161'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db['ChatWebsite'][_0x7120('0x110')](db[_0x7120('0x7a')],{'as':_0x7120('0x18b'),'foreignKey':_0x7120('0x170')});db[_0x7120('0x59')][_0x7120('0x110')](db[_0x7120('0x68')],{'as':_0x7120('0x191')});db[_0x7120('0x59')]['hasMany'](db[_0x7120('0x5e')],{'as':_0x7120('0x163')});db[_0x7120('0x59')]['hasMany'](db[_0x7120('0x5d')],{'as':_0x7120('0x142')});db[_0x7120('0x59')][_0x7120('0x110')](db[_0x7120('0x60')],{'as':'Messages'});db[_0x7120('0x59')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':'List','foreignKey':_0x7120('0x165')});db['ChatWebsite'][_0x7120('0x14a')](db[_0x7120('0x14f')],{'as':'Interval','foreignKey':_0x7120('0x150')});db[_0x7120('0x59')][_0x7120('0x14a')](db['MailAccount'],{'as':_0x7120('0x3b'),'foreignKey':'MailAccountId'});db[_0x7120('0x59')][_0x7120('0x14a')](db[_0x7120('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x7120('0x59')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x136')});db[_0x7120('0x5b')][_0x7120('0x14a')](db[_0x7120('0x52')],{});db[_0x7120('0x5b')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':'List','foreignKey':_0x7120('0x165')});db[_0x7120('0x5b')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x7120('0x14a')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x7120('0x14a')](db[_0x7120('0x13')],{});db[_0x7120('0x5b')][_0x7120('0x14a')](db[_0x7120('0x57')],{});db[_0x7120('0x5d')][_0x7120('0x14a')](db[_0x7120('0x13')],{'as':_0x7120('0x192'),'foreignKey':_0x7120('0x10f'),'onDelete':_0x7120('0x172')});db[_0x7120('0x5d')][_0x7120('0x14a')](db[_0x7120('0x64')],{'as':_0x7120('0x193'),'foreignKey':'ChatQueueId','onDelete':_0x7120('0x172')});db[_0x7120('0x5d')][_0x7120('0x14a')](db[_0x7120('0x59')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0x7120('0x14a')](db[_0x7120('0x88')],{'onDelete':'restrict','foreignKey':_0x7120('0x173')});db[_0x7120('0x5e')][_0x7120('0x110')](db[_0x7120('0x60')],{'as':_0x7120('0x157'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x194')});db[_0x7120('0x5e')][_0x7120('0x14a')](db[_0x7120('0x59')],{'as':_0x7120('0x17c'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x7120('0x14a')](db['CmContact'],{'as':_0x7120('0x15d'),'foreignKey':'ContactId'});db[_0x7120('0x5e')][_0x7120('0x14a')](db[_0x7120('0x13')],{'as':'Owner','foreignKey':_0x7120('0x10f')});db[_0x7120('0x5e')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x195'),'as':_0x7120('0x16c')});db[_0x7120('0x5e')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x195'),'as':_0x7120('0x16d')});db[_0x7120('0x5e')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x16e'),'through':_0x7120('0x127'),'foreignKey':_0x7120('0x194')});db[_0x7120('0x60')]['belongsTo'](db[_0x7120('0x13')],{'onDelete':'cascade','as':_0x7120('0x13')});db[_0x7120('0x60')][_0x7120('0x14a')](db[_0x7120('0x122')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x7120('0x15e')});db[_0x7120('0x60')][_0x7120('0x14a')](db[_0x7120('0x5e')],{'onDelete':'cascade','as':_0x7120('0x17e'),'foreignKey':_0x7120('0x194')});db[_0x7120('0x60')][_0x7120('0x14a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x7120('0x17f')});db['ChatMessage'][_0x7120('0x14a')](db[_0x7120('0x59')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x170')});db[_0x7120('0x62')][_0x7120('0x110')](db[_0x7120('0xe7')],{'as':_0x7120('0x16f'),'foreignKey':_0x7120('0x171'),'onDelete':_0x7120('0x10e'),'hooks':!![]});db[_0x7120('0x62')][_0x7120('0x14a')](db['CmContact'],{'onDelete':_0x7120('0x10e'),'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db[_0x7120('0x62')][_0x7120('0x14a')](db[_0x7120('0x59')],{'as':_0x7120('0x17c'),'foreignKey':'ChatWebsiteId'});db[_0x7120('0x64')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x31'),'hooks':!![]});db[_0x7120('0x64')][_0x7120('0x120')](db[_0x7120('0x154')],{'through':_0x7120('0x196'),'as':_0x7120('0x168')});db[_0x7120('0x66')][_0x7120('0x110')](db[_0x7120('0xd0')],{'as':_0x7120('0x157'),'foreignKey':_0x7120('0x197'),'onDelete':_0x7120('0x10e')});db[_0x7120('0x66')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x145'),'through':_0x7120('0x198')});db[_0x7120('0x68')][_0x7120('0x14a')](db[_0x7120('0x59')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x7120('0x6a')][_0x7120('0x110')](db['CmContact'],{'as':_0x7120('0x123'),'foreignKey':_0x7120('0x199')});db['CmContact'][_0x7120('0x110')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x7120('0x15e')});db[_0x7120('0x122')]['hasMany'](db['CmHopperFinal'],{'as':_0x7120('0x114'),'foreignKey':'ContactId'});db[_0x7120('0x122')][_0x7120('0x110')](db[_0x7120('0x71')],{'as':_0x7120('0x148'),'foreignKey':_0x7120('0x15e')});db[_0x7120('0x122')]['hasMany'](db[_0x7120('0x73')],{'as':_0x7120('0x73'),'foreignKey':_0x7120('0x15e')});db[_0x7120('0x122')][_0x7120('0x110')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x7120('0x15e')});db['CmContact'][_0x7120('0x110')](db[_0x7120('0x54')],{'as':_0x7120('0x116'),'foreignKey':'ContactId','onDelete':_0x7120('0x172')});db['CmContact'][_0x7120('0x110')](db[_0x7120('0x5e')],{'as':_0x7120('0x117'),'foreignKey':_0x7120('0x15e'),'onDelete':_0x7120('0x172')});db[_0x7120('0x122')][_0x7120('0x110')](db[_0x7120('0x4e')],{'as':_0x7120('0x19a'),'foreignKey':_0x7120('0x15e'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x7120('0x118')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x7120('0x172')});db[_0x7120('0x122')][_0x7120('0x110')](db[_0x7120('0x11a')],{'as':_0x7120('0x11b'),'foreignKey':_0x7120('0x15e'),'onDelete':_0x7120('0x172')});db[_0x7120('0x122')][_0x7120('0x14a')](db[_0x7120('0x6a')],{'as':'Company','foreignKey':'CompanyId'});db[_0x7120('0x122')][_0x7120('0x14a')](db['CmList'],{'as':_0x7120('0x164'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x7120('0x122')][_0x7120('0x120')](db['User'],{'as':_0x7120('0x16e'),'through':_0x7120('0x124')});db['CmContact']['belongsToMany'](db[_0x7120('0x88')],{'as':_0x7120('0x16c'),'through':'cm_contact_has_tags'});db[_0x7120('0x122')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x7120('0x6c')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165'),'onDelete':'cascade'});db['CmHopper'][_0x7120('0x14a')](db[_0x7120('0x13')],{'as':_0x7120('0x192'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0x6c')][_0x7120('0x14a')](db[_0x7120('0x12b')],{'as':'Queue','foreignKey':_0x7120('0x146'),'onDelete':_0x7120('0x10e')});db[_0x7120('0x6c')][_0x7120('0x14a')](db['Campaign'],{'as':_0x7120('0xe3'),'foreignKey':_0x7120('0x19b'),'onDelete':'cascade'});db[_0x7120('0x6c')][_0x7120('0x14a')](db['User'],{'as':_0x7120('0x16a'),'foreignKey':_0x7120('0x19c')});db[_0x7120('0x6e')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e'),'onDelete':'cascade'});db[_0x7120('0x6e')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165'),'onDelete':_0x7120('0x10e')});db[_0x7120('0x6e')]['belongsTo'](db[_0x7120('0x12b')],{'as':_0x7120('0x193'),'foreignKey':_0x7120('0x146'),'onDelete':_0x7120('0x10e')});db['CmHopperBlack']['belongsTo'](db[_0x7120('0xe3')],{'as':'Campaign','foreignKey':_0x7120('0x19b'),'onDelete':'cascade'});db[_0x7120('0x79')][_0x7120('0x110')](db[_0x7120('0x19d')],{'as':{'plural':_0x7120('0x19e'),'singular':_0x7120('0x19f')},'foreignKey':_0x7120('0x1a0'),'onDelete':_0x7120('0x10e'),'hooks':!![]});db[_0x7120('0x79')][_0x7120('0x110')](db['Condition'],{'as':{'plural':_0x7120('0x1a1'),'singular':_0x7120('0x1a2')},'foreignKey':_0x7120('0x1a3'),'onDelete':_0x7120('0x10e'),'hooks':!![]});db[_0x7120('0x79')][_0x7120('0x110')](db[_0x7120('0x77')],{'as':'Actions','foreignKey':_0x7120('0x1a4'),'onDelete':_0x7120('0x10e'),'hooks':!![]});db[_0x7120('0x7c')]['hasMany'](db[_0x7120('0x7c')],{'as':_0x7120('0x161'),'foreignKey':'ParentId','onDelete':_0x7120('0x10e')});db[_0x7120('0x14f')][_0x7120('0x110')](db[_0x7120('0x14f')],{'as':_0x7120('0x1a5'),'foreignKey':_0x7120('0x150'),'onDelete':_0x7120('0x10e'),'hooks':!![],'required':![]});db['Interval'][_0x7120('0x110')](db[_0x7120('0x1a')],{'as':_0x7120('0x113'),'foreignKey':_0x7120('0x150'),'onDelete':_0x7120('0x172')});db[_0x7120('0x14f')][_0x7120('0x110')](db[_0x7120('0x41')],{'as':_0x7120('0x1a6'),'foreignKey':_0x7120('0x150')});db[_0x7120('0x14f')][_0x7120('0x110')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x7120('0x150')});db['Interval'][_0x7120('0x110')](db[_0x7120('0x177')],{'as':_0x7120('0x1a7'),'foreignKey':_0x7120('0x150')});db[_0x7120('0x14f')][_0x7120('0x110')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x7120('0x84')][_0x7120('0x14a')](db[_0x7120('0x3b')],{});db[_0x7120('0x84')][_0x7120('0x14a')](db[_0x7120('0x94')],{'foreignKey':_0x7120('0x1a8')});db[_0x7120('0x84')][_0x7120('0x14a')](db[_0x7120('0x1a9')],{'foreignKey':_0x7120('0x1aa')});db['Sound']['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x7120('0x1ab'),'through':'moh_has_sounds','onDelete':_0x7120('0x172')});db[_0x7120('0x88')]['belongsToMany'](db['CmContact'],{'through':_0x7120('0x1ac')});db[_0x7120('0x88')]['belongsToMany'](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x7120('0x88')][_0x7120('0x120')](db[_0x7120('0x11a')],{'through':'mail_interaction_has_tags'});db[_0x7120('0x88')]['belongsToMany'](db[_0x7120('0x4e')],{'through':'sms_interaction_has_tags'});db[_0x7120('0x88')][_0x7120('0x120')](db[_0x7120('0x118')],{'through':_0x7120('0x17d')});db['Tag'][_0x7120('0x120')](db[_0x7120('0x54')],{'through':_0x7120('0x18f')});db[_0x7120('0x88')][_0x7120('0x120')](db[_0x7120('0xfc')],{'through':'whatsapp_interaction_has_tags'});db[_0x7120('0x8b')][_0x7120('0x110')](db['Condition'],{'as':{'plural':_0x7120('0x1ad'),'singular':_0x7120('0x1ae')},'foreignKey':_0x7120('0x1af'),'onDelete':_0x7120('0x10e'),'hooks':!![]});db['Trigger'][_0x7120('0x110')](db[_0x7120('0x19d')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x7120('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0x7120('0x8b')]['hasMany'](db[_0x7120('0x77')],{'as':'Actions','foreignKey':_0x7120('0x1b1'),'onDelete':_0x7120('0x10e'),'hooks':!![]});db['AnalyticCustomReport'][_0x7120('0x110')](db[_0x7120('0x9a')],{'as':_0x7120('0x1b2'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x7120('0x9a')],{'as':_0x7120('0x1b2'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1a8')});db[_0x7120('0x98')][_0x7120('0x110')](db['AnalyticFieldReport'],{'as':_0x7120('0x1b2'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b3')});db[_0x7120('0x9a')][_0x7120('0x14a')](db[_0x7120('0x98')],{'foreignKey':'MetricId'});db[_0x7120('0x9d')][_0x7120('0x110')](db[_0x7120('0x9e')],{'as':'Configurations','onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0x9e')][_0x7120('0x110')](db[_0x7120('0x1b5')],{'as':_0x7120('0x1b6'),'onDelete':'cascade','foreignKey':_0x7120('0x1b7')});db[_0x7120('0x9e')]['hasMany'](db[_0x7120('0x1b5')],{'as':_0x7120('0x1b8'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b9')});db['SalesforceConfiguration']['hasMany'](db[_0x7120('0x1b5')],{'as':_0x7120('0x1b2'),'onDelete':'cascade','foreignKey':_0x7120('0x1ba')});db[_0x7120('0x9e')][_0x7120('0x14a')](db[_0x7120('0x9d')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0x1b5')][_0x7120('0x110')](db[_0x7120('0x1b5')],{'as':_0x7120('0x1bb'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0x1b5')][_0x7120('0x110')](db[_0x7120('0x1b5')],{'as':_0x7120('0x1bc'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0x1b5')][_0x7120('0x110')](db[_0x7120('0x1b5')],{'as':_0x7120('0x1bd'),'foreignKey':_0x7120('0x1ba')});db['SalesforceField'][_0x7120('0x14a')](db[_0x7120('0x8d')],{'as':_0x7120('0x8d'),'foreignKey':_0x7120('0x1be')});db[_0x7120('0x1bf')][_0x7120('0x110')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0xa2')][_0x7120('0x110')](db[_0x7120('0xa3')],{'as':'Subjects','onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b7')});db['SugarcrmConfiguration'][_0x7120('0x110')](db[_0x7120('0xa3')],{'as':_0x7120('0x1b8'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0xa2')][_0x7120('0x110')](db['SugarcrmField'],{'as':_0x7120('0x1b2'),'onDelete':'cascade','foreignKey':_0x7120('0x1ba')});db[_0x7120('0xa2')][_0x7120('0x14a')](db[_0x7120('0x1bf')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0xa3')][_0x7120('0x110')](db[_0x7120('0xa3')],{'as':_0x7120('0x1bb'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0xa3')]['hasMany'](db[_0x7120('0xa3')],{'as':_0x7120('0x1bc'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0xa3')][_0x7120('0x110')](db[_0x7120('0xa3')],{'as':'Field','foreignKey':_0x7120('0x1ba')});db[_0x7120('0xa3')][_0x7120('0x14a')](db[_0x7120('0x8d')],{'as':_0x7120('0x8d'),'foreignKey':'VariableId'});db[_0x7120('0xa5')]['hasMany'](db[_0x7120('0xa6')],{'as':_0x7120('0x1c0'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0xa6')][_0x7120('0x110')](db[_0x7120('0xa8')],{'as':_0x7120('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0x7120('0xa8')],{'as':'Descriptions','onDelete':_0x7120('0x10e'),'foreignKey':'DescriptionId'});db[_0x7120('0xa6')][_0x7120('0x110')](db['DeskField'],{'as':_0x7120('0x1b2'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1ba')});db['DeskConfiguration'][_0x7120('0x14a')](db['DeskAccount'],{'as':'Account','foreignKey':_0x7120('0x1b4')});db[_0x7120('0xa6')]['belongsToMany'](db[_0x7120('0x88')],{'through':_0x7120('0x1c1')});db[_0x7120('0xa8')][_0x7120('0x110')](db[_0x7120('0xa8')],{'as':'Subject','foreignKey':_0x7120('0x1b7')});db[_0x7120('0xa8')]['hasMany'](db[_0x7120('0xa8')],{'as':_0x7120('0x1bc'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0xa8')][_0x7120('0x110')](db[_0x7120('0xa8')],{'as':_0x7120('0x1bd'),'foreignKey':_0x7120('0x1ba')});db['DeskField'][_0x7120('0x14a')](db['Variable'],{'as':_0x7120('0x8d'),'foreignKey':_0x7120('0x1be')});db[_0x7120('0xaa')][_0x7120('0x110')](db[_0x7120('0xac')],{'as':_0x7120('0x1c0'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0xac')][_0x7120('0x110')](db['ZohoField'],{'as':_0x7120('0x1b6'),'onDelete':_0x7120('0x10e'),'foreignKey':'SubjectId'});db[_0x7120('0xac')]['hasMany'](db[_0x7120('0xae')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x7120('0x1b9')});db[_0x7120('0xac')][_0x7120('0x110')](db[_0x7120('0xae')],{'as':_0x7120('0x1b2'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1ba')});db[_0x7120('0xac')][_0x7120('0x14a')](db[_0x7120('0xaa')],{'as':_0x7120('0x17c'),'foreignKey':'AccountId'});db[_0x7120('0xae')][_0x7120('0x110')](db[_0x7120('0xae')],{'as':_0x7120('0x1bb'),'foreignKey':'SubjectId'});db['ZohoField'][_0x7120('0x110')](db[_0x7120('0xae')],{'as':_0x7120('0x1bc'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0xae')][_0x7120('0x110')](db[_0x7120('0xae')],{'as':_0x7120('0x1bd'),'foreignKey':'FieldId'});db[_0x7120('0xae')][_0x7120('0x14a')](db['Variable'],{'as':'Variable','foreignKey':_0x7120('0x1be')});db['ZendeskAccount'][_0x7120('0x110')](db[_0x7120('0xb2')],{'as':'Configurations','onDelete':_0x7120('0x10e'),'foreignKey':'AccountId'});db[_0x7120('0xb2')][_0x7120('0x110')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x7120('0x1b7')});db[_0x7120('0xb2')]['hasMany'](db[_0x7120('0xb4')],{'as':_0x7120('0x1b8'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0xb2')][_0x7120('0x110')](db[_0x7120('0xb4')],{'as':'Fields','foreignKey':_0x7120('0x1ba')});db[_0x7120('0xb2')][_0x7120('0x14a')](db['ZendeskAccount'],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x1b4')});db['ZendeskConfiguration'][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x1c2')});db[_0x7120('0xb4')][_0x7120('0x110')](db['ZendeskField'],{'as':_0x7120('0x1bb'),'foreignKey':_0x7120('0x1b7')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x7120('0x1bc'),'foreignKey':'DescriptionId'});db[_0x7120('0xb4')][_0x7120('0x110')](db[_0x7120('0xb4')],{'as':'Field','foreignKey':_0x7120('0x1ba')});db['ZendeskField'][_0x7120('0x14a')](db[_0x7120('0x8d')],{'as':_0x7120('0x8d'),'foreignKey':_0x7120('0x1be')});db['FreshdeskAccount'][_0x7120('0x110')](db[_0x7120('0xb8')],{'as':_0x7120('0x1c0'),'onDelete':_0x7120('0x10e'),'foreignKey':'AccountId'});db[_0x7120('0xb8')][_0x7120('0x110')](db[_0x7120('0x1c3')],{'as':_0x7120('0x1b6'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0xb8')]['hasMany'](db[_0x7120('0x1c3')],{'as':_0x7120('0x1b8'),'onDelete':_0x7120('0x10e'),'foreignKey':'DescriptionId'});db[_0x7120('0xb8')][_0x7120('0x110')](db[_0x7120('0x1c3')],{'as':_0x7120('0x1b2'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1ba')});db[_0x7120('0xb8')][_0x7120('0x14a')](db[_0x7120('0xb6')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0xb8')][_0x7120('0x120')](db[_0x7120('0x88')],{'through':_0x7120('0x1c4')});db[_0x7120('0x1c3')][_0x7120('0x110')](db[_0x7120('0x1c3')],{'as':'Subject','foreignKey':_0x7120('0x1b7')});db[_0x7120('0x1c3')][_0x7120('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x7120('0x1b9')});db[_0x7120('0x1c3')]['hasMany'](db['FreshdeskField'],{'as':_0x7120('0x1bd'),'foreignKey':_0x7120('0x1ba')});db[_0x7120('0x1c3')][_0x7120('0x14a')](db[_0x7120('0x8d')],{'as':_0x7120('0x8d'),'foreignKey':_0x7120('0x1be')});db[_0x7120('0x1c5')][_0x7120('0x110')](db[_0x7120('0xbc')],{'as':_0x7120('0x1c0'),'onDelete':'cascade','foreignKey':_0x7120('0x1b4')});db[_0x7120('0xbc')][_0x7120('0x110')](db[_0x7120('0xbe')],{'as':_0x7120('0x1b6'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x7120('0x110')](db[_0x7120('0xbe')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x7120('0x110')](db[_0x7120('0xbe')],{'as':'Fields','foreignKey':'FieldId'});db[_0x7120('0xbc')][_0x7120('0x14a')](db[_0x7120('0x1c5')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0xbe')][_0x7120('0x110')](db['VtigerField'],{'as':'Subject','foreignKey':_0x7120('0x1b7')});db[_0x7120('0xbe')]['hasMany'](db[_0x7120('0xbe')],{'as':_0x7120('0x1bc'),'foreignKey':'DescriptionId'});db[_0x7120('0xbe')][_0x7120('0x110')](db['VtigerField'],{'as':'Field','foreignKey':_0x7120('0x1ba')});db[_0x7120('0xbe')][_0x7120('0x14a')](db[_0x7120('0x8d')],{'as':_0x7120('0x8d'),'foreignKey':_0x7120('0x1be')});db['ServicenowAccount'][_0x7120('0x110')](db[_0x7120('0xc2')],{'as':_0x7120('0x1c0'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b4')});db['ServicenowConfiguration']['hasMany'](db[_0x7120('0xc4')],{'as':_0x7120('0x1b6'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0xc2')]['hasMany'](db[_0x7120('0xc4')],{'as':_0x7120('0x1b8'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0xc2')][_0x7120('0x110')](db[_0x7120('0xc4')],{'as':_0x7120('0x1b2'),'foreignKey':_0x7120('0x1ba')});db[_0x7120('0xc2')][_0x7120('0x14a')](db[_0x7120('0xc0')],{'as':'Account','foreignKey':_0x7120('0x1b4')});db['ServicenowField'][_0x7120('0x110')](db['ServicenowField'],{'as':_0x7120('0x1bb'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0xc4')][_0x7120('0x110')](db[_0x7120('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x7120('0xc4')][_0x7120('0x110')](db[_0x7120('0xc4')],{'as':'Field','foreignKey':_0x7120('0x1ba')});db[_0x7120('0xc4')]['belongsTo'](db[_0x7120('0x8d')],{'as':'Variable','foreignKey':_0x7120('0x1be')});db[_0x7120('0xc5')]['hasMany'](db[_0x7120('0xc7')],{'as':_0x7120('0x1c0'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b4')});db[_0x7120('0xc7')][_0x7120('0x110')](db[_0x7120('0xc9')],{'as':_0x7120('0x1b6'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0xc7')]['hasMany'](db[_0x7120('0xc9')],{'as':_0x7120('0x1b8'),'onDelete':_0x7120('0x10e'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x7120('0x110')](db['Dynamics365Field'],{'as':_0x7120('0x1b2'),'onDelete':_0x7120('0x10e'),'foreignKey':_0x7120('0x1ba')});db[_0x7120('0xc7')][_0x7120('0x14a')](db['Dynamics365Account'],{'as':_0x7120('0x17c'),'foreignKey':'AccountId'});db[_0x7120('0xc9')][_0x7120('0x110')](db[_0x7120('0xc9')],{'as':'Subject','foreignKey':_0x7120('0x1b7')});db['Dynamics365Field'][_0x7120('0x110')](db[_0x7120('0xc9')],{'as':_0x7120('0x1bc'),'foreignKey':'DescriptionId'});db[_0x7120('0xc9')][_0x7120('0x110')](db[_0x7120('0xc9')],{'as':_0x7120('0x1bd'),'foreignKey':_0x7120('0x1ba')});db['Dynamics365Field'][_0x7120('0x14a')](db[_0x7120('0x8d')],{'as':_0x7120('0x8d'),'foreignKey':_0x7120('0x1be')});db['FreshsalesAccount'][_0x7120('0x110')](db[_0x7120('0x1c6')],{'as':_0x7120('0x1c0'),'onDelete':'cascade','foreignKey':_0x7120('0x1b4')});db[_0x7120('0x1c6')][_0x7120('0x110')](db['FreshsalesField'],{'as':_0x7120('0x1b6'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0x1c6')][_0x7120('0x110')](db[_0x7120('0xcd')],{'as':_0x7120('0x1b8'),'foreignKey':'DescriptionId'});db[_0x7120('0x1c6')]['hasMany'](db[_0x7120('0xcd')],{'as':_0x7120('0x1b2'),'foreignKey':_0x7120('0x1ba')});db['FreshsalesConfiguration'][_0x7120('0x14a')](db[_0x7120('0xcb')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x1b4')});db['FreshsalesField']['hasMany'](db[_0x7120('0xcd')],{'as':_0x7120('0x1bb'),'foreignKey':_0x7120('0x1b7')});db[_0x7120('0xcd')][_0x7120('0x110')](db['FreshsalesField'],{'as':_0x7120('0x1bc'),'foreignKey':_0x7120('0x1b9')});db[_0x7120('0xcd')][_0x7120('0x110')](db['FreshsalesField'],{'as':_0x7120('0x1bd'),'foreignKey':_0x7120('0x1ba')});db[_0x7120('0xcd')][_0x7120('0x14a')](db[_0x7120('0x8d')],{'as':_0x7120('0x8d'),'foreignKey':_0x7120('0x1be')});db[_0x7120('0x1c7')][_0x7120('0x14a')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165')});db[_0x7120('0x1c7')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db[_0x7120('0x1c7')]['belongsTo'](db['ChatInteraction'],{});db[_0x7120('0x1c7')][_0x7120('0x14a')](db[_0x7120('0x60')],{});db[_0x7120('0x1c7')][_0x7120('0x14a')](db['User'],{});db[_0x7120('0x1c7')]['belongsTo'](db['ChatQueue'],{});db[_0x7120('0xd0')][_0x7120('0x14a')](db['User'],{'onDelete':'cascade','foreignKey':_0x7120('0x1c8')});db[_0x7120('0xd0')]['belongsTo'](db[_0x7120('0x13')],{'onDelete':_0x7120('0x10e'),'foreignKey':'ToId'});db[_0x7120('0xd3')]['hasMany'](db[_0x7120('0xd2')],{'foreignKey':_0x7120('0x1c9'),'onDelete':_0x7120('0x10e')});db['JscriptySessionReport'][_0x7120('0x110')](db[_0x7120('0xd1')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x7120('0x1ca')][_0x7120('0x14a')](db[_0x7120('0x4c')],{});db['SmsQueueReport'][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':_0x7120('0x165')});db[_0x7120('0x1ca')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db['SmsQueueReport'][_0x7120('0x14a')](db[_0x7120('0x4e')],{});db[_0x7120('0x1ca')][_0x7120('0x14a')](db['SmsMessage'],{});db[_0x7120('0x1ca')][_0x7120('0x14a')](db[_0x7120('0x13')],{});db[_0x7120('0x1ca')][_0x7120('0x14a')](db[_0x7120('0x51')],{});db[_0x7120('0xda')]['hasMany'](db[_0x7120('0xd3')],{'foreignKey':'ProjectId'});db[_0x7120('0xda')][_0x7120('0x110')](db[_0x7120('0xd2')],{'foreignKey':_0x7120('0x1cb')});db[_0x7120('0xda')][_0x7120('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0x7120('0x1cb')});db[_0x7120('0xdf')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':'Users','through':_0x7120('0x1cc')});db[_0x7120('0x154')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':'user_has_teams'});db['Team'][_0x7120('0x120')](db[_0x7120('0x12b')],{'through':_0x7120('0x108'),'as':_0x7120('0x12c')});db[_0x7120('0x154')][_0x7120('0x120')](db[_0x7120('0x3c')],{'through':_0x7120('0x1cd'),'as':_0x7120('0x12d')});db[_0x7120('0x154')][_0x7120('0x120')](db['ChatQueue'],{'through':_0x7120('0x196'),'as':_0x7120('0x1ce')});db[_0x7120('0x154')][_0x7120('0x120')](db[_0x7120('0x17a')],{'through':_0x7120('0x181'),'as':_0x7120('0x12f')});db['Team']['belongsToMany'](db[_0x7120('0x51')],{'through':'team_has_sms_queues','as':_0x7120('0x130')});db[_0x7120('0x154')][_0x7120('0x120')](db[_0x7120('0x57')],{'through':'team_has_openchannel_queues','as':_0x7120('0x131')});db['Team']['belongsToMany'](db[_0x7120('0x104')],{'through':'team_has_whatsapp_queues','as':_0x7120('0x1cf')});db[_0x7120('0x154')][_0x7120('0x120')](db[_0x7120('0xf2')],{'through':'TeamVoicePrefix','as':_0x7120('0x133')});db[_0x7120('0xe3')]['hasMany'](db[_0x7120('0x6c')],{'as':_0x7120('0x147'),'foreignKey':_0x7120('0x19b')});db['Campaign'][_0x7120('0x110')](db[_0x7120('0x70')],{'as':_0x7120('0x114'),'foreignKey':'CampaignId'});db['Campaign'][_0x7120('0x110')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x7120('0x19b')});db[_0x7120('0xe3')][_0x7120('0x110')](db[_0x7120('0x6e')],{'as':'HopperBlacks','foreignKey':_0x7120('0x19b')});db['Campaign'][_0x7120('0x14a')](db[_0x7120('0x14b')],{'as':_0x7120('0x14b'),'foreignKey':_0x7120('0x14c')});db[_0x7120('0xe3')][_0x7120('0x14a')](db['Trunk'],{'as':_0x7120('0x14d'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x7120('0x14a')](db['Interval'],{'as':_0x7120('0x14f'),'foreignKey':_0x7120('0x150')});db[_0x7120('0xe3')]['belongsTo'](db[_0x7120('0xdf')],{'as':_0x7120('0xdf'),'foreignKey':_0x7120('0x1d0')});db[_0x7120('0xe3')][_0x7120('0x120')](db['CmList'],{'as':_0x7120('0x152'),'through':'campaigns_has_cm_lists'});db[_0x7120('0xe3')][_0x7120('0x120')](db[_0x7120('0x132')],{'as':_0x7120('0x155'),'through':_0x7120('0x1d1')});db[_0x7120('0xe7')]['belongsTo'](db[_0x7120('0x62')],{'as':_0x7120('0x62'),'foreignKey':'ChatOfflineMessageId'});db[_0x7120('0x1d2')][_0x7120('0x14a')](db['MailMessage'],{});db['MailTransferReport']['belongsTo'](db[_0x7120('0x11a')],{});db['MailTransferReport'][_0x7120('0x14a')](db[_0x7120('0x3b')],{'foreignKey':_0x7120('0x1d3'),'as':'FromAccount'});db[_0x7120('0x1d2')][_0x7120('0x14a')](db['User'],{'foreignKey':_0x7120('0x1d4'),'as':_0x7120('0x1d5')});db['MailTransferReport'][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d6'),'as':'ToAgent'});db[_0x7120('0x1d2')][_0x7120('0x14a')](db['MailQueue'],{'foreignKey':_0x7120('0x1d7'),'as':_0x7120('0x1d8')});db[_0x7120('0x1d2')][_0x7120('0x14a')](db['MailAccount'],{'foreignKey':_0x7120('0x1d9'),'as':_0x7120('0x1da')});db[_0x7120('0xeb')][_0x7120('0x14a')](db['ChatMessage'],{});db[_0x7120('0xeb')]['belongsTo'](db[_0x7120('0x5e')],{});db[_0x7120('0xeb')][_0x7120('0x14a')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x7120('0x1db')});db[_0x7120('0xeb')][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7120('0xeb')][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d6'),'as':_0x7120('0x1dc')});db[_0x7120('0xeb')][_0x7120('0x14a')](db[_0x7120('0x64')],{'foreignKey':'ToChatQueueId','as':_0x7120('0x1d8')});db[_0x7120('0xeb')][_0x7120('0x14a')](db[_0x7120('0x59')],{'foreignKey':_0x7120('0x1dd'),'as':_0x7120('0x1da')});db[_0x7120('0xec')][_0x7120('0x14a')](db[_0x7120('0x49')],{});db['FaxTransferReport']['belongsTo'](db[_0x7120('0x118')],{});db[_0x7120('0xec')][_0x7120('0x14a')](db[_0x7120('0x46')],{'foreignKey':'FromFaxAccountId','as':_0x7120('0x1db')});db[_0x7120('0xec')][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7120('0xec')][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d6'),'as':_0x7120('0x1dc')});db[_0x7120('0xec')][_0x7120('0x14a')](db[_0x7120('0x17a')],{'foreignKey':_0x7120('0x1de'),'as':_0x7120('0x1d8')});db[_0x7120('0xec')][_0x7120('0x14a')](db[_0x7120('0x46')],{'foreignKey':_0x7120('0x1df'),'as':_0x7120('0x1da')});db[_0x7120('0xed')]['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x7120('0x54')],{});db[_0x7120('0xed')]['belongsTo'](db[_0x7120('0x52')],{'foreignKey':'FromOpenchannelAccountId','as':_0x7120('0x1db')});db[_0x7120('0xed')][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d4'),'as':'FromAgent'});db[_0x7120('0xed')]['belongsTo'](db['User'],{'foreignKey':_0x7120('0x1d6'),'as':_0x7120('0x1dc')});db['OpenchannelTransferReport']['belongsTo'](db[_0x7120('0x57')],{'foreignKey':_0x7120('0x1e0'),'as':_0x7120('0x1d8')});db['OpenchannelTransferReport'][_0x7120('0x14a')](db[_0x7120('0x52')],{'foreignKey':'ToOpenchannelAccountId','as':_0x7120('0x1da')});db[_0x7120('0xef')][_0x7120('0x14a')](db[_0x7120('0x50')],{});db[_0x7120('0xef')][_0x7120('0x14a')](db[_0x7120('0x4e')],{});db[_0x7120('0xef')][_0x7120('0x14a')](db[_0x7120('0x4c')],{'foreignKey':_0x7120('0x1e1'),'as':_0x7120('0x1db')});db[_0x7120('0xef')][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d4'),'as':_0x7120('0x1d5')});db[_0x7120('0xef')]['belongsTo'](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d6'),'as':'ToAgent'});db[_0x7120('0xef')][_0x7120('0x14a')](db[_0x7120('0x51')],{'foreignKey':_0x7120('0x1e2'),'as':_0x7120('0x1d8')});db[_0x7120('0xef')][_0x7120('0x14a')](db[_0x7120('0x4c')],{'foreignKey':_0x7120('0x1e3'),'as':_0x7120('0x1da')});db[_0x7120('0x132')]['hasMany'](db[_0x7120('0x7c')],{'as':'Dispositions','foreignKey':_0x7120('0x165'),'onDelete':_0x7120('0x10e')});db[_0x7120('0x132')]['hasMany'](db[_0x7120('0x75')],{'as':_0x7120('0x1e4'),'foreignKey':_0x7120('0x165')});db[_0x7120('0x132')][_0x7120('0x110')](db['CmContact'],{'as':'Contacts','onDelete':_0x7120('0x10e'),'foreignKey':'ListId'});db[_0x7120('0x132')][_0x7120('0x110')](db[_0x7120('0x70')],{'as':_0x7120('0x114'),'foreignKey':_0x7120('0x165')});db[_0x7120('0x132')][_0x7120('0x110')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x7120('0x165')});db[_0x7120('0x132')][_0x7120('0x110')](db[_0x7120('0x73')],{'as':_0x7120('0x73'),'foreignKey':_0x7120('0x165')});db[_0x7120('0x132')][_0x7120('0x120')](db['VoiceQueue'],{'as':_0x7120('0x1e5'),'through':_0x7120('0x153')});db['CmList'][_0x7120('0x120')](db['User'],{'as':_0x7120('0x167'),'through':_0x7120('0x125')});db['VoicePrefix'][_0x7120('0x110')](db['VoiceExtension'],{'as':_0x7120('0x113'),'onDelete':_0x7120('0x10e')});db[_0x7120('0xf2')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':'Agents','through':_0x7120('0x10b')});db['VoicePrefix']['belongsToMany'](db[_0x7120('0x154')],{'through':'TeamVoicePrefix','as':_0x7120('0x168')});db[_0x7120('0x11e')]['hasMany'](db[_0x7120('0x13')],{'as':_0x7120('0x16e'),'foreignKey':_0x7120('0x11f')});db[_0x7120('0x11e')]['hasMany'](db[_0x7120('0xf4')],{'as':_0x7120('0x1e6'),'foreignKey':_0x7120('0x11f'),'onDelete':_0x7120('0x10e')});db[_0x7120('0xf4')][_0x7120('0x110')](db['UserProfileResource'],{'as':_0x7120('0x1e7'),'foreignKey':_0x7120('0x1e8'),'onDelete':_0x7120('0x10e')});db[_0x7120('0xf9')]['hasMany'](db[_0x7120('0x7c')],{'as':_0x7120('0x161'),'foreignKey':_0x7120('0x1e9'),'onDelete':_0x7120('0x10e')});db[_0x7120('0xf9')][_0x7120('0x110')](db[_0x7120('0x7a')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x7120('0x110')](db[_0x7120('0xfe')],{'as':_0x7120('0x157'),'foreignKey':'WhatsappAccountId'});db[_0x7120('0xf9')][_0x7120('0x110')](db['WhatsappInteraction'],{'as':_0x7120('0x163')});db[_0x7120('0xf9')][_0x7120('0x110')](db[_0x7120('0xfa')],{'as':_0x7120('0x142')});db[_0x7120('0xf9')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x7120('0x14a')](db[_0x7120('0x7f')],{'as':_0x7120('0x179'),'foreignKey':_0x7120('0x151')});db[_0x7120('0xf9')][_0x7120('0x120')](db[_0x7120('0x13')],{'as':_0x7120('0x167'),'through':_0x7120('0x13e')});db['WhatsappApplication'][_0x7120('0x14a')](db[_0x7120('0x13')],{'onDelete':_0x7120('0x172')});db[_0x7120('0xfa')]['belongsTo'](db[_0x7120('0x104')],{'onDelete':'restrict'});db[_0x7120('0xfa')][_0x7120('0x14a')](db[_0x7120('0xf9')],{'onDelete':_0x7120('0x172')});db['WhatsappApplication'][_0x7120('0x14a')](db['Interval'],{'onDelete':_0x7120('0x172'),'foreignKey':_0x7120('0x150')});db[_0x7120('0xfa')][_0x7120('0x14a')](db['Tag'],{'onDelete':_0x7120('0x172'),'foreignKey':_0x7120('0x173')});db['WhatsappInteraction'][_0x7120('0x110')](db[_0x7120('0xfe')],{'as':_0x7120('0x157'),'onDelete':'cascade','foreignKey':_0x7120('0x1ea')});db['WhatsappInteraction'][_0x7120('0x14a')](db[_0x7120('0xf9')],{'as':'Account','foreignKey':_0x7120('0x1e9')});db[_0x7120('0xfc')][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':_0x7120('0x15d'),'foreignKey':_0x7120('0x15e')});db[_0x7120('0xfc')][_0x7120('0x14a')](db[_0x7120('0x13')],{'as':_0x7120('0x16a'),'foreignKey':_0x7120('0x10f')});db[_0x7120('0xfc')][_0x7120('0x120')](db['Tag'],{'through':_0x7120('0x1eb'),'as':_0x7120('0x16c')});db[_0x7120('0xfc')][_0x7120('0x120')](db['Tag'],{'through':_0x7120('0x1eb'),'as':_0x7120('0x16d')});db['WhatsappInteraction'][_0x7120('0x120')](db['User'],{'as':_0x7120('0x16e'),'through':_0x7120('0x1ec'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db[_0x7120('0x13')],{'as':'User'});db[_0x7120('0xfe')][_0x7120('0x14a')](db[_0x7120('0x122')],{'onDelete':_0x7120('0x10e'),'as':_0x7120('0x15d')});db[_0x7120('0xfe')]['belongsTo'](db[_0x7120('0xfc')],{'onDelete':_0x7120('0x10e'),'as':_0x7120('0x17e'),'foreignKey':_0x7120('0x1ea')});db[_0x7120('0xfe')][_0x7120('0x14a')](db[_0x7120('0xf9')],{'as':_0x7120('0x17c'),'foreignKey':_0x7120('0x1e9')});db['WhatsappQueueReport'][_0x7120('0x14a')](db[_0x7120('0xf9')],{});db[_0x7120('0x100')][_0x7120('0x14a')](db[_0x7120('0x132')],{'as':_0x7120('0x164'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0x7120('0x14a')](db[_0x7120('0x122')],{'as':'Contact','foreignKey':_0x7120('0x15e')});db[_0x7120('0x100')][_0x7120('0x14a')](db[_0x7120('0xfc')],{});db[_0x7120('0x100')]['belongsTo'](db[_0x7120('0x104')],{});db[_0x7120('0x100')][_0x7120('0x14a')](db[_0x7120('0xfe')],{});db[_0x7120('0x100')][_0x7120('0x14a')](db[_0x7120('0x13')],{});db[_0x7120('0x102')]['belongsTo'](db[_0x7120('0xfe')],{});db[_0x7120('0x102')][_0x7120('0x14a')](db[_0x7120('0xfc')],{});db[_0x7120('0x102')][_0x7120('0x14a')](db[_0x7120('0xf9')],{'foreignKey':_0x7120('0x1ed'),'as':_0x7120('0x1db')});db[_0x7120('0x102')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x7120('0x1ee'),'as':_0x7120('0x1da')});db[_0x7120('0x102')][_0x7120('0x14a')](db['WhatsappQueue'],{'foreignKey':_0x7120('0x1ef'),'as':_0x7120('0x1d8')});db[_0x7120('0x102')]['belongsTo'](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d4'),'as':'FromAgent'});db[_0x7120('0x102')][_0x7120('0x14a')](db[_0x7120('0x13')],{'foreignKey':_0x7120('0x1d6'),'as':'ToAgent'});db[_0x7120('0x104')][_0x7120('0x120')](db['User'],{'as':_0x7120('0x167'),'through':_0x7120('0x1f0'),'foreignKey':_0x7120('0x1f1')});db['WhatsappQueue'][_0x7120('0x120')](db['Team'],{'through':_0x7120('0x1f2'),'as':_0x7120('0x168')});module[_0x7120('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf061=['../api/integration/integration.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','HopperHistory','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','SenderId','userProfileId','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','VoiceQueueId','VoiceQueue','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','Imap','hasOne','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','ListId','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','Items','FaxAccountId','FaxApplication','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Tags','Interaction','Attachment','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Hoppers','Company','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','ParentId','Intervals','Extensions','MailApplications','ChatApplications','DefaultReportId','Schedule','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','Subjects','ZendeskField','int_zendesk_configuration_has_tags','Dynamics365Configuration','Dynamics365Account','FromId','ToId','SessionId','SmsQueueReport','ProjectId','TeamVoiceQueue','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromAccount','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','exports','sequelize','lodash','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','name','utf8','password','options','username','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../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','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Template','Trigger','Variable','Integration'];(function(_0x58fe03,_0x29f44d){var _0x2cb89b=function(_0x10440a){while(--_0x10440a){_0x58fe03['push'](_0x58fe03['shift']());}};_0x2cb89b(++_0x29f44d);}(_0xf061,0x165));var _0x1f06=function(_0x1641cf,_0xbf2711){_0x1641cf=_0x1641cf-0x0;var _0x2fcd47=_0xf061[_0x1641cf];return _0x2fcd47;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x1f06('0x0'));var _=require(_0x1f06('0x1'));var jstz=require('jstz');var timezone=jstz[_0x1f06('0x2')]();config[_0x1f06('0x0')]=_['defaultsDeep'](config[_0x1f06('0x0')],{'database':_0x1f06('0x3'),'username':_0x1f06('0x4'),'password':_0x1f06('0x5'),'options':{'host':_0x1f06('0x6'),'port':0xcea,'dialect':_0x1f06('0x7'),'dialectOptions':{'charset':_0x1f06('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x1f06('0x9')}}});config[_0x1f06('0xa')]=_['defaultsDeep'](config[_0x1f06('0xa')],{'database':_0x1f06('0x3'),'username':'xcall','password':_0x1f06('0x5'),'options':{'host':_0x1f06('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x1f06('0xb')](),'define':{'charset':_0x1f06('0xc'),'collate':_0x1f06('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1f06('0x0')]['database'],config['sequelize']['username'],config['sequelize'][_0x1f06('0xd')],config[_0x1f06('0x0')][_0x1f06('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x1f06('0xa')][_0x1f06('0xf')],config[_0x1f06('0xa')][_0x1f06('0xd')],config[_0x1f06('0xa')][_0x1f06('0xe')])};db[_0x1f06('0x10')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x12'));db['VoiceChanSpy']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x13'));db[_0x1f06('0x14')]=db[_0x1f06('0x0')]['import']('../api/voiceContext/voiceContext.model');db[_0x1f06('0x15')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x16'));db[_0x1f06('0x17')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x18'));db['VoiceQueue']=db[_0x1f06('0x0')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x1f06('0x19')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x1a'));db['ScreenRecording']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x1b'));db[_0x1f06('0x1c')]=db['sequelize']['import'](_0x1f06('0x1d'));db[_0x1f06('0x1e')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x1f'));db['VoiceCallReport']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x20'));db['VoiceDialReport']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x21'));db[_0x1f06('0x22')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x23'));db[_0x1f06('0x24')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x25'));db[_0x1f06('0x26')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x27'));db[_0x1f06('0x28')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x29'));db[_0x1f06('0x2a')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x2b'));db[_0x1f06('0x2c')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x2d'));db[_0x1f06('0x2e')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x2f'));db[_0x1f06('0x30')]=db['sequelize']['import'](_0x1f06('0x31'));db[_0x1f06('0x32')]=db['sequelize']['import'](_0x1f06('0x33'));db[_0x1f06('0x34')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/userFaxQueue/userFaxQueue.model');db[_0x1f06('0x35')]=db['sequelize']['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x1f06('0x36')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x37'));db['UserWhatsappQueue']=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x38'));db[_0x1f06('0x39')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x3a'));db[_0x1f06('0x3b')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x3c'));db[_0x1f06('0x3d')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/mailQueue/mailQueue.model');db[_0x1f06('0x3e')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x3f'));db[_0x1f06('0x40')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x41'));db[_0x1f06('0x42')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x43'));db['MailApplication']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x44'));db[_0x1f06('0x45')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x46'));db[_0x1f06('0x47')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/dashboard/dashboard.model');db[_0x1f06('0x48')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x49'));db[_0x1f06('0x4a')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x4b'));db[_0x1f06('0x4c')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x4d'));db['FaxMessage']=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x4e'));db[_0x1f06('0x4f')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x50'));db['FaxQueueReport']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x51'));db['SmsAccount']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x52'));db[_0x1f06('0x53')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x54'));db[_0x1f06('0x55')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x56'));db[_0x1f06('0x57')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x58'));db[_0x1f06('0x59')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x5a'));db[_0x1f06('0x5b')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x5c'));db['OpenchannelApplication']=db[_0x1f06('0x0')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x5d'));db[_0x1f06('0x5e')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x5f'));db['OpenchannelQueue']=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x60'));db[_0x1f06('0x61')]=db[_0x1f06('0x0')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x1f06('0x62')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x63'));db[_0x1f06('0x64')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x65'));db[_0x1f06('0x66')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x67'));db['ChatMessage']=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x68'));db[_0x1f06('0x69')]=db[_0x1f06('0x0')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x1f06('0x6a')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/chatQueue/chatQueue.model');db[_0x1f06('0x6b')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x6c'));db[_0x1f06('0x6d')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x6e'));db['CmCompany']=db['sequelize'][_0x1f06('0x11')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x6f'));db[_0x1f06('0x70')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x71'));db[_0x1f06('0x72')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x1f06('0x73')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x74'));db[_0x1f06('0x75')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x76'));db['ReportAgentPreview']=db[_0x1f06('0x0')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x77'));db['Action']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x78'));db[_0x1f06('0x79')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x7a'));db[_0x1f06('0x7b')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x7c'));db['Disposition']=db[_0x1f06('0x0')]['import'](_0x1f06('0x7d'));db[_0x1f06('0x7e')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x7f'));db[_0x1f06('0x80')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x81'));db[_0x1f06('0x82')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x83'));db[_0x1f06('0x84')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x85'));db[_0x1f06('0x86')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x87'));db['Schedule']=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/schedule/schedule.model');db[_0x1f06('0x88')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x89'));db['Tag']=db[_0x1f06('0x0')]['import']('../api/tag/tag.model');db[_0x1f06('0x8a')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/template/template.model');db[_0x1f06('0x8b')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/trigger/trigger.model');db[_0x1f06('0x8c')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/variable/variable.model');db[_0x1f06('0x8d')]=db['sequelize']['import'](_0x1f06('0x8e'));db['IntegrationReport']=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x8f'));db[_0x1f06('0x90')]=db['sequelize'][_0x1f06('0x11')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x1f06('0x91')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x1f06('0x92')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x93'));db[_0x1f06('0x94')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x1f06('0x95')]=db['sequelize']['import'](_0x1f06('0x96'));db[_0x1f06('0x97')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x1f06('0x98')]=db['sequelize']['import'](_0x1f06('0x99'));db[_0x1f06('0x9a')]=db[_0x1f06('0x0')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x1f06('0x9b')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x9c'));db[_0x1f06('0x9d')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x1f06('0x9e')]=db[_0x1f06('0x0')]['import'](_0x1f06('0x9f'));db[_0x1f06('0xa0')]=db['sequelize'][_0x1f06('0x11')]('../api/intDeskAccount/intDeskAccount.model');db[_0x1f06('0xa1')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xa2'));db[_0x1f06('0xa3')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/intDeskField/intDeskField.model');db[_0x1f06('0xa4')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0x1f06('0xa5')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xa6'));db[_0x1f06('0xa7')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/intZohoField/intZohoField.model');db[_0x1f06('0xa8')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xa9'));db[_0x1f06('0xaa')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xab'));db['ZendeskField']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xac'));db[_0x1f06('0xad')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xae'));db[_0x1f06('0xaf')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0xb0'));db[_0x1f06('0xb1')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xb2'));db[_0x1f06('0xb3')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xb4'));db[_0x1f06('0xb5')]=db['sequelize']['import'](_0x1f06('0xb6'));db[_0x1f06('0xb7')]=db['sequelize'][_0x1f06('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x1f06('0xb8')]=db[_0x1f06('0x0')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x1f06('0xb9')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xba'));db[_0x1f06('0xbb')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xbc'));db['Dynamics365Account']=db['sequelize'][_0x1f06('0x11')](_0x1f06('0xbd'));db['Dynamics365Configuration']=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x1f06('0xbe')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xbf'));db[_0x1f06('0xc0')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xc1'));db[_0x1f06('0xc2')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xc3'));db[_0x1f06('0xc4')]=db['sequelize']['import'](_0x1f06('0xc5'));db['Integration']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x8e'));db['Network']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xc6'));db[_0x1f06('0xc7')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xc8'));db[_0x1f06('0xc9')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xca'));db[_0x1f06('0xcb')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xcc'));db[_0x1f06('0xcd')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x1f06('0xce')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0x1f06('0xcf')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xd0'));db['SquareDetailsReport']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xd1'));db[_0x1f06('0xd2')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1f06('0xd3')]=db['sequelize']['import'](_0x1f06('0xd4'));db['SquareOdbc']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xd5'));db[_0x1f06('0xd6')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xd7'));db[_0x1f06('0xd8')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xd9'));db[_0x1f06('0xda')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xdb'));db[_0x1f06('0xdc')]=db['sequelize']['import'](_0x1f06('0xdd'));db[_0x1f06('0xde')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/license/license.model');db[_0x1f06('0xdf')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xe0'));db[_0x1f06('0xe1')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/migration/migration.model');db['Attachment']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xe2'));db[_0x1f06('0xe3')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xe4'));db[_0x1f06('0xe5')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0xe6'));db[_0x1f06('0xe7')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xe8'));db[_0x1f06('0xe9')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0xea'));db['OpenchannelTransferReport']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xeb'));db['SmsTransferReport']=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0x1f06('0xec')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0xed'));db[_0x1f06('0xee')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xef'));db[_0x1f06('0xf0')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0xf1'));db[_0x1f06('0xf2')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xf3'));db['UserProfileResource']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xf4'));db[_0x1f06('0xf5')]=db['sequelize']['import'](_0x1f06('0xf6'));db['WhatsappAccount']=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0xf7'));db[_0x1f06('0xf8')]=db[_0x1f06('0x0')]['import'](_0x1f06('0xf9'));db[_0x1f06('0xfa')]=db['sequelize'][_0x1f06('0x11')](_0x1f06('0xfb'));db[_0x1f06('0xfc')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/whatsappMessage/whatsappMessage.model');db[_0x1f06('0xfd')]=db['sequelize']['import'](_0x1f06('0xfe'));db[_0x1f06('0xff')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x100'));db[_0x1f06('0x101')]=db['sequelize']['import'](_0x1f06('0x102'));db[_0x1f06('0x103')]=db[_0x1f06('0x0')][_0x1f06('0x11')](_0x1f06('0x104'));db['TeamVoiceQueue']=db['sequelize'][_0x1f06('0x11')](_0x1f06('0x105'));db[_0x1f06('0x106')]=db[_0x1f06('0x0')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x1f06('0x107')]=db[_0x1f06('0x0')][_0x1f06('0x11')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x1f06('0x10')]['hasOne'](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10')]['hasMany'](db[_0x1f06('0x19')],{'as':_0x1f06('0x10a'),'foreignKey':'UserId'});db[_0x1f06('0x10')][_0x1f06('0x10b')](db['UserVoiceQueueRt'],{'as':_0x1f06('0x10c'),'foreignKey':'UserId'});db[_0x1f06('0x10')]['hasMany'](db[_0x1f06('0x15')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x1f06('0x10')][_0x1f06('0x10b')](db[_0x1f06('0x73')],{'as':'HopperFinals','foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10')]['hasMany'](db['CmHopperHistory'],{'as':_0x1f06('0x10d'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10')]['hasMany'](db[_0x1f06('0x10e')],{'as':_0x1f06('0x10e'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10')][_0x1f06('0x10b')](db[_0x1f06('0x10f')],{'as':_0x1f06('0x110'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10')][_0x1f06('0x10b')](db[_0x1f06('0x66')],{'as':_0x1f06('0x111'),'foreignKey':'UserId'});db[_0x1f06('0x10')][_0x1f06('0x10b')](db[_0x1f06('0x55')],{'as':_0x1f06('0x112'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10')][_0x1f06('0x10b')](db[_0x1f06('0x4c')],{'as':_0x1f06('0x113'),'foreignKey':'UserId'});db['User'][_0x1f06('0x10b')](db[_0x1f06('0x40')],{'as':_0x1f06('0x114'),'foreignKey':_0x1f06('0x109')});db['User'][_0x1f06('0x10b')](db[_0x1f06('0xfa')],{'as':'WhatsappInteractions','foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10')][_0x1f06('0x10b')](db[_0x1f06('0xf5')],{'as':_0x1f06('0x115'),'foreignKey':_0x1f06('0x116')});db[_0x1f06('0x10')]['belongsTo'](db['UserProfile'],{'as':_0x1f06('0xf0'),'foreignKey':_0x1f06('0x117')});db['User'][_0x1f06('0x118')](db['ChatGroup'],{'as':'Groups','through':_0x1f06('0x119')});db['User'][_0x1f06('0x118')](db[_0x1f06('0x11a')],{'as':_0x1f06('0x11b'),'through':_0x1f06('0x11c')});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0xec')],{'as':_0x1f06('0x11d'),'through':_0x1f06('0x11e')});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0xdc')],{'through':_0x1f06('0x11f')});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0x40')],{'as':_0x1f06('0x114'),'through':_0x1f06('0x120')});db['User'][_0x1f06('0x118')](db[_0x1f06('0x66')],{'as':_0x1f06('0x111'),'through':_0x1f06('0x121')});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0x4c')],{'as':'FaxInteractions','through':_0x1f06('0x122')});db['User'][_0x1f06('0x118')](db[_0x1f06('0x55')],{'as':'SmsInteractions','through':_0x1f06('0x123')});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0x10f')],{'as':_0x1f06('0x110'),'through':_0x1f06('0x124')});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0xfa')],{'as':_0x1f06('0x125'),'through':_0x1f06('0x126')});db[_0x1f06('0x10')]['belongsToMany'](db['VoiceQueue'],{'as':_0x1f06('0x127'),'through':_0x1f06('0x2e'),'required':![]});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0xee')],{'as':'VoicePrefixes','through':_0x1f06('0x107'),'required':![]});db[_0x1f06('0x10')][_0x1f06('0x118')](db['MailQueue'],{'as':_0x1f06('0x128'),'through':_0x1f06('0x32'),'required':![]});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0x6a')],{'as':_0x1f06('0x129'),'through':_0x1f06('0x30'),'required':![],'hooks':!![]});db['User'][_0x1f06('0x118')](db[_0x1f06('0x4f')],{'as':_0x1f06('0x12a'),'through':_0x1f06('0x34'),'required':![]});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0x59')],{'as':'SmsQueues','through':_0x1f06('0x35'),'required':![]});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0x12b')],{'as':_0x1f06('0x12c'),'through':'UserOpenchannelQueue','required':![]});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0x101')],{'as':_0x1f06('0x12d'),'through':_0x1f06('0x12e'),'required':![]});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0xec')],{'through':_0x1f06('0x11e')});db[_0x1f06('0x10')][_0x1f06('0x118')](db[_0x1f06('0xee')],{'as':'VoicePrefixes','through':_0x1f06('0x12f'),'required':![]});db['User'][_0x1f06('0x118')](db[_0x1f06('0x61')],{'as':_0x1f06('0x130'),'through':_0x1f06('0x131')});db[_0x1f06('0x10')][_0x1f06('0x118')](db['FaxAccount'],{'as':'FaxAccounts','through':_0x1f06('0x132')});db[_0x1f06('0x10')]['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0x1f06('0x5b')],{'as':_0x1f06('0x133'),'through':_0x1f06('0x134')});db['User'][_0x1f06('0x118')](db[_0x1f06('0x135')],{'as':_0x1f06('0x136'),'through':_0x1f06('0x137')});db[_0x1f06('0x10')][_0x1f06('0x118')](db['WhatsappAccount'],{'as':_0x1f06('0x138'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db[_0x1f06('0xd6')],{'as':_0x1f06('0x139'),'through':_0x1f06('0x13a')});db[_0x1f06('0x13b')][_0x1f06('0x10b')](db[_0x1f06('0x15')],{'as':_0x1f06('0x13c'),'onDelete':'cascade','foreignKey':_0x1f06('0x13d')});db[_0x1f06('0x14')][_0x1f06('0x10b')](db[_0x1f06('0x15')],{'onDelete':'cascade'});db[_0x1f06('0x15')][_0x1f06('0x10b')](db[_0x1f06('0x15')],{'as':_0x1f06('0x13e'),'onDelete':'cascade'});db[_0x1f06('0x17')][_0x1f06('0x118')](db[_0x1f06('0x88')],{'as':'Sounds','through':_0x1f06('0x13f')});db['VoiceQueue'][_0x1f06('0x10b')](db[_0x1f06('0x2c')],{'as':'Members','foreignKey':_0x1f06('0x140')});db[_0x1f06('0x141')]['hasMany'](db[_0x1f06('0x70')],{'as':'Hoppers','foreignKey':_0x1f06('0x140')});db[_0x1f06('0x141')]['hasMany'](db['CmHopperFinal'],{'as':_0x1f06('0x142'),'foreignKey':_0x1f06('0x140')});db[_0x1f06('0x141')]['hasMany'](db[_0x1f06('0x75')],{'as':_0x1f06('0x143'),'foreignKey':_0x1f06('0x140')});db['VoiceQueue']['hasMany'](db[_0x1f06('0x10e')],{'as':_0x1f06('0x10e'),'foreignKey':_0x1f06('0x140')});db['VoiceQueue'][_0x1f06('0x10b')](db[_0x1f06('0x72')],{'as':_0x1f06('0x144'),'foreignKey':_0x1f06('0x140')});db[_0x1f06('0x141')][_0x1f06('0x10b')](db[_0x1f06('0xce')],{'as':_0x1f06('0x145'),'foreignKey':_0x1f06('0x140')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x1f06('0x28'),'foreignKey':_0x1f06('0x146')});db['VoiceQueue'][_0x1f06('0x147')](db['Trunk'],{'as':_0x1f06('0x148'),'foreignKey':_0x1f06('0x149')});db[_0x1f06('0x141')][_0x1f06('0x147')](db[_0x1f06('0x80')],{'as':_0x1f06('0x80'),'foreignKey':_0x1f06('0x14a')});db[_0x1f06('0x141')]['belongsTo'](db[_0x1f06('0x82')],{'as':_0x1f06('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1f06('0x141')][_0x1f06('0x118')](db[_0x1f06('0xec')],{'as':'Lists','through':_0x1f06('0x14c')});db[_0x1f06('0x141')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x2e')});db[_0x1f06('0x141')]['belongsToMany'](db['Team'],{'as':_0x1f06('0x14e'),'through':'TeamVoiceQueue'});db[_0x1f06('0x141')][_0x1f06('0x118')](db[_0x1f06('0xec')],{'as':_0x1f06('0x14f'),'through':'voice_queues_has_cm_blacklists'});db[_0x1f06('0x19')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':_0x1f06('0x10'),'foreignKey':_0x1f06('0x109')});db['ScreenRecording'][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':'User','foreignKey':_0x1f06('0x109')});db[_0x1f06('0x1c')][_0x1f06('0x10b')](db['VoiceMailMessage'],{'as':_0x1f06('0x150'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x151'),'sourceKey':_0x1f06('0x152')});db['VoiceMailMessage']['belongsTo'](db[_0x1f06('0x1c')],{'foreignKey':'mailboxuser','targetKey':_0x1f06('0x152')});db[_0x1f06('0x153')][_0x1f06('0x10b')](db[_0x1f06('0x24')],{'as':_0x1f06('0x154'),'foreignKey':_0x1f06('0x155'),'constraints':![]});db[_0x1f06('0x153')][_0x1f06('0x10b')](db['VoiceAgentReport'],{'as':_0x1f06('0x156'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':'User','foreignKey':_0x1f06('0x109')});db[_0x1f06('0x153')]['belongsTo'](db[_0x1f06('0x11a')],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x159')][_0x1f06('0x147')](db[_0x1f06('0x3b')],{'as':_0x1f06('0x3b'),'foreignKey':_0x1f06('0x15a')});db[_0x1f06('0x39')]['belongsTo'](db[_0x1f06('0x3b')],{'as':_0x1f06('0x3b'),'foreignKey':_0x1f06('0x15a')});db[_0x1f06('0x3b')]['hasOne'](db['MailServerIn'],{'as':_0x1f06('0x15b'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x3b')][_0x1f06('0x15c')](db[_0x1f06('0x39')],{'as':_0x1f06('0x15d'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x3b')][_0x1f06('0x10b')](db[_0x1f06('0x15e')],{'as':_0x1f06('0x15f'),'foreignKey':_0x1f06('0x15a'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x3b')][_0x1f06('0x10b')](db[_0x1f06('0x7b')],{'as':_0x1f06('0x160'),'foreignKey':_0x1f06('0x15a')});db['MailAccount']['hasMany'](db[_0x1f06('0x42')],{'as':_0x1f06('0x150'),'foreignKey':'MailAccountId'});db[_0x1f06('0x3b')][_0x1f06('0x10b')](db[_0x1f06('0x40')],{'as':_0x1f06('0x161')});db[_0x1f06('0x3b')][_0x1f06('0x10b')](db[_0x1f06('0x162')],{'as':'Applications'});db[_0x1f06('0x3b')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':'List','foreignKey':_0x1f06('0x163')});db[_0x1f06('0x3b')][_0x1f06('0x147')](db[_0x1f06('0x8a')],{'as':_0x1f06('0x8a'),'foreignKey':_0x1f06('0x164')});db['MailAccount'][_0x1f06('0x147')](db[_0x1f06('0x82')],{'as':_0x1f06('0x14b'),'foreignKey':_0x1f06('0x165')});db[_0x1f06('0x3b')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x1f06('0x10')],{'as':'Agents','through':_0x1f06('0x32')});db[_0x1f06('0x3d')][_0x1f06('0x118')](db[_0x1f06('0xdc')],{'through':_0x1f06('0x166'),'as':_0x1f06('0x14e')});db[_0x1f06('0x40')][_0x1f06('0x10b')](db[_0x1f06('0x42')],{'as':_0x1f06('0x150'),'onDelete':'cascade','foreignKey':_0x1f06('0x167')});db['MailInteraction'][_0x1f06('0x147')](db[_0x1f06('0x3b')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x15a')});db[_0x1f06('0x40')]['belongsTo'](db[_0x1f06('0x11a')],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db['MailInteraction'][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':_0x1f06('0x169'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x40')]['belongsToMany'](db[_0x1f06('0x16a')],{'through':_0x1f06('0x16b'),'as':'Tags'});db[_0x1f06('0x40')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x16b'),'as':_0x1f06('0x16c')});db['MailInteraction'][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'through':_0x1f06('0x120'),'foreignKey':_0x1f06('0x167')});db['MailMessage'][_0x1f06('0x10b')](db['Attachment'],{'as':_0x1f06('0x16e'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x42')]['belongsTo'](db['User'],{'as':_0x1f06('0x10')});db['MailMessage'][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'onDelete':_0x1f06('0x108'),'as':'Contact'});db['MailMessage'][_0x1f06('0x147')](db[_0x1f06('0x40')],{'as':'Interaction','foreignKey':_0x1f06('0x167')});db[_0x1f06('0x42')]['belongsTo'](db[_0x1f06('0x3b')],{'as':_0x1f06('0x168'),'foreignKey':'MailAccountId'});db[_0x1f06('0x42')]['belongsTo'](db[_0x1f06('0x61')],{'as':_0x1f06('0x61'),'foreignKey':_0x1f06('0x16f')});db[_0x1f06('0x42')][_0x1f06('0x147')](db['ChatOfflineMessage'],{'as':_0x1f06('0x69'),'foreignKey':_0x1f06('0x170')});db[_0x1f06('0x162')]['belongsTo'](db[_0x1f06('0x10')],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0x162')][_0x1f06('0x147')](db[_0x1f06('0x3d')],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0x162')][_0x1f06('0x147')](db[_0x1f06('0x3b')],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0x162')][_0x1f06('0x147')](db['Interval'],{'onDelete':_0x1f06('0x171'),'foreignKey':_0x1f06('0x14a')});db['MailApplication'][_0x1f06('0x147')](db[_0x1f06('0x16a')],{'onDelete':_0x1f06('0x171'),'foreignKey':_0x1f06('0x172')});db['MailQueueReport'][_0x1f06('0x147')](db[_0x1f06('0x3b')],{});db[_0x1f06('0x45')]['belongsTo'](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db[_0x1f06('0x45')][_0x1f06('0x147')](db['CmContact'],{'as':_0x1f06('0x157'),'foreignKey':'ContactId'});db['MailQueueReport']['belongsTo'](db['MailInteraction'],{});db[_0x1f06('0x45')][_0x1f06('0x147')](db[_0x1f06('0x42')],{});db[_0x1f06('0x45')][_0x1f06('0x147')](db[_0x1f06('0x10')],{});db[_0x1f06('0x45')]['belongsTo'](db['MailQueue'],{});db[_0x1f06('0x47')]['hasMany'](db['DashboardItem'],{'as':_0x1f06('0x174'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x4a')][_0x1f06('0x10b')](db[_0x1f06('0x15e')],{'as':_0x1f06('0x15f'),'foreignKey':_0x1f06('0x175'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x4a')][_0x1f06('0x10b')](db[_0x1f06('0x7b')],{'as':_0x1f06('0x160'),'foreignKey':_0x1f06('0x175')});db[_0x1f06('0x4a')][_0x1f06('0x10b')](db[_0x1f06('0x4c')],{'as':_0x1f06('0x161')});db[_0x1f06('0x4a')]['hasMany'](db[_0x1f06('0x176')],{'as':'Applications'});db[_0x1f06('0x4a')][_0x1f06('0x10b')](db[_0x1f06('0x15')],{'as':_0x1f06('0x177'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x4a')][_0x1f06('0x10b')](db[_0x1f06('0x178')],{'as':_0x1f06('0x150')});db[_0x1f06('0x4a')][_0x1f06('0x147')](db['Trunk'],{'as':_0x1f06('0x28')});db[_0x1f06('0x4a')][_0x1f06('0x147')](db['CmList'],{'as':_0x1f06('0x173'),'foreignKey':'ListId'});db['FaxAccount'][_0x1f06('0x147')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount']['belongsToMany'](db['User'],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x132')});db['FaxApplication'][_0x1f06('0x147')](db[_0x1f06('0x10')],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0x176')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0x176')][_0x1f06('0x147')](db[_0x1f06('0x4a')],{'onDelete':'restrict'});db[_0x1f06('0x176')][_0x1f06('0x147')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x1f06('0x172')});db[_0x1f06('0x4c')][_0x1f06('0x10b')](db[_0x1f06('0x178')],{'as':'Messages','onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x179')});db[_0x1f06('0x4c')][_0x1f06('0x147')](db[_0x1f06('0x4a')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x175')});db[_0x1f06('0x4c')][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x4c')][_0x1f06('0x147')](db['User'],{'as':_0x1f06('0x169'),'foreignKey':_0x1f06('0x109')});db['FaxInteraction'][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x17a'),'as':_0x1f06('0x17b')});db['FaxInteraction'][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x17a'),'as':_0x1f06('0x16c')});db[_0x1f06('0x4c')]['belongsToMany'](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'through':'user_has_fax_interactions','foreignKey':_0x1f06('0x179')});db[_0x1f06('0x178')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'onDelete':'cascade','as':'User'});db[_0x1f06('0x178')][_0x1f06('0x147')](db['FaxInteraction'],{'as':_0x1f06('0x17c'),'foreignKey':_0x1f06('0x179')});db[_0x1f06('0x178')]['belongsTo'](db[_0x1f06('0x11a')],{'onDelete':_0x1f06('0x108'),'as':'Contact'});db[_0x1f06('0x178')][_0x1f06('0x147')](db[_0x1f06('0x17d')],{'as':'Attachment','foreignKey':_0x1f06('0x17e')});db['FaxMessage']['belongsTo'](db[_0x1f06('0x4a')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x175')});db[_0x1f06('0x4f')]['belongsToMany'](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x34')});db[_0x1f06('0x4f')][_0x1f06('0x118')](db[_0x1f06('0xdc')],{'through':_0x1f06('0x17f'),'as':'Teams'});db[_0x1f06('0x180')][_0x1f06('0x147')](db[_0x1f06('0x4a')],{});db[_0x1f06('0x180')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db[_0x1f06('0x180')][_0x1f06('0x147')](db['CmContact'],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x180')][_0x1f06('0x147')](db[_0x1f06('0x4c')],{});db[_0x1f06('0x180')][_0x1f06('0x147')](db[_0x1f06('0x178')],{});db[_0x1f06('0x180')][_0x1f06('0x147')](db[_0x1f06('0x10')],{});db[_0x1f06('0x180')][_0x1f06('0x147')](db[_0x1f06('0x4f')],{});db[_0x1f06('0x135')][_0x1f06('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':'cascade'});db['SmsAccount'][_0x1f06('0x10b')](db['CannedAnswer'],{'as':_0x1f06('0x160'),'foreignKey':_0x1f06('0x181')});db[_0x1f06('0x135')]['hasMany'](db[_0x1f06('0x57')],{'as':_0x1f06('0x150'),'foreignKey':_0x1f06('0x181')});db[_0x1f06('0x135')][_0x1f06('0x10b')](db[_0x1f06('0x55')],{'as':'Interactions'});db[_0x1f06('0x135')]['hasMany'](db['SmsApplication'],{'as':'Applications'});db[_0x1f06('0x135')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':'ListId'});db[_0x1f06('0x135')][_0x1f06('0x147')](db[_0x1f06('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x1f06('0x165')});db[_0x1f06('0x135')][_0x1f06('0x118')](db['User'],{'as':_0x1f06('0x14d'),'through':'user_has_sms_accounts'});db[_0x1f06('0x53')][_0x1f06('0x147')](db['User'],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0x53')][_0x1f06('0x147')](db[_0x1f06('0x59')],{'onDelete':'restrict'});db[_0x1f06('0x53')][_0x1f06('0x147')](db[_0x1f06('0x135')],{'onDelete':'restrict'});db[_0x1f06('0x53')]['belongsTo'](db[_0x1f06('0x80')],{'onDelete':_0x1f06('0x171'),'foreignKey':_0x1f06('0x14a')});db[_0x1f06('0x53')]['belongsTo'](db[_0x1f06('0x16a')],{'onDelete':'restrict','foreignKey':_0x1f06('0x172')});db[_0x1f06('0x55')][_0x1f06('0x10b')](db[_0x1f06('0x57')],{'as':_0x1f06('0x150'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x182')});db[_0x1f06('0x55')][_0x1f06('0x147')](db['SmsAccount'],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x181')});db[_0x1f06('0x55')][_0x1f06('0x147')](db['CmContact'],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x55')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':_0x1f06('0x169'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x55')]['belongsToMany'](db[_0x1f06('0x16a')],{'through':_0x1f06('0x183'),'as':_0x1f06('0x17b')});db['SmsInteraction'][_0x1f06('0x118')](db['Tag'],{'through':_0x1f06('0x183'),'as':_0x1f06('0x16c')});db['SmsInteraction'][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'through':_0x1f06('0x123'),'foreignKey':'SmsInteractionId'});db[_0x1f06('0x57')]['belongsTo'](db[_0x1f06('0x10')],{'as':_0x1f06('0x10')});db[_0x1f06('0x57')][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'onDelete':_0x1f06('0x108'),'as':_0x1f06('0x157')});db[_0x1f06('0x57')][_0x1f06('0x147')](db[_0x1f06('0x55')],{'onDelete':'cascade','as':_0x1f06('0x17c'),'foreignKey':_0x1f06('0x182')});db[_0x1f06('0x57')][_0x1f06('0x147')](db['SmsAccount'],{'as':_0x1f06('0x168'),'foreignKey':'SmsAccountId'});db[_0x1f06('0x59')][_0x1f06('0x118')](db['User'],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x35'),'foreignKey':_0x1f06('0x184')});db[_0x1f06('0x59')]['belongsToMany'](db['Team'],{'through':_0x1f06('0x185'),'as':_0x1f06('0x14e')});db[_0x1f06('0x5b')][_0x1f06('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0x1f06('0x5b')][_0x1f06('0x10b')](db['CannedAnswer'],{'as':_0x1f06('0x160'),'foreignKey':_0x1f06('0x186')});db[_0x1f06('0x5b')]['hasMany'](db[_0x1f06('0x10f')],{'as':'Interactions','foreignKey':_0x1f06('0x186')});db[_0x1f06('0x5b')][_0x1f06('0x10b')](db['OpenchannelMessage'],{'as':_0x1f06('0x150'),'foreignKey':_0x1f06('0x186')});db[_0x1f06('0x5b')][_0x1f06('0x10b')](db['OpenchannelApplication'],{'as':_0x1f06('0x13e'),'foreignKey':_0x1f06('0x186')});db[_0x1f06('0x5b')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db['OpenchannelAccount'][_0x1f06('0x147')](db[_0x1f06('0x82')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x1f06('0x5b')][_0x1f06('0x118')](db['User'],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x134')});db[_0x1f06('0x187')][_0x1f06('0x147')](db['User'],{'onDelete':'restrict'});db[_0x1f06('0x187')][_0x1f06('0x147')](db[_0x1f06('0x12b')],{'onDelete':_0x1f06('0x171'),'foreignKey':'OpenchannelQueueId'});db[_0x1f06('0x187')][_0x1f06('0x147')](db[_0x1f06('0x5b')],{'onDelete':_0x1f06('0x171'),'foreignKey':'OpenchannelAccountId'});db[_0x1f06('0x187')][_0x1f06('0x147')](db[_0x1f06('0x80')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x1f06('0x187')][_0x1f06('0x147')](db[_0x1f06('0x16a')],{'onDelete':_0x1f06('0x171'),'foreignKey':'TagId'});db[_0x1f06('0x10f')][_0x1f06('0x10b')](db[_0x1f06('0x5e')],{'as':_0x1f06('0x150'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x1f06('0x147')](db[_0x1f06('0x5b')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x186')});db['OpenchannelInteraction'][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'as':'Contact','foreignKey':_0x1f06('0x158')});db[_0x1f06('0x10f')]['belongsTo'](db[_0x1f06('0x10')],{'as':_0x1f06('0x169'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x10f')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x188'),'as':'Tags'});db['OpenchannelInteraction'][_0x1f06('0x118')](db['Tag'],{'through':_0x1f06('0x188'),'as':_0x1f06('0x16c')});db[_0x1f06('0x10f')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'through':_0x1f06('0x124'),'foreignKey':_0x1f06('0x189')});db['OpenchannelMessage']['belongsTo'](db['User'],{'onDelete':'cascade','as':'User'});db[_0x1f06('0x5e')]['belongsTo'](db[_0x1f06('0x11a')],{'onDelete':_0x1f06('0x108'),'as':'Contact'});db[_0x1f06('0x5e')][_0x1f06('0x147')](db[_0x1f06('0x10f')],{'onDelete':_0x1f06('0x108'),'as':_0x1f06('0x17c'),'foreignKey':'OpenchannelInteractionId'});db[_0x1f06('0x5e')][_0x1f06('0x147')](db['Attachment'],{'as':_0x1f06('0x17d'),'foreignKey':_0x1f06('0x17e')});db['OpenchannelMessage'][_0x1f06('0x147')](db[_0x1f06('0x5b')],{'as':'Account','foreignKey':_0x1f06('0x186')});db[_0x1f06('0x12b')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x36'),'foreignKey':'OpenchannelQueueId'});db[_0x1f06('0x12b')]['belongsToMany'](db[_0x1f06('0xdc')],{'through':_0x1f06('0x18a'),'as':_0x1f06('0x14e')});db[_0x1f06('0x61')][_0x1f06('0x10b')](db[_0x1f06('0x15e')],{'as':'Dispositions','foreignKey':_0x1f06('0x16f'),'onDelete':'cascade'});db[_0x1f06('0x61')][_0x1f06('0x10b')](db[_0x1f06('0x7b')],{'as':_0x1f06('0x160'),'foreignKey':_0x1f06('0x16f')});db[_0x1f06('0x61')][_0x1f06('0x10b')](db['ChatProactiveAction'],{'as':_0x1f06('0x18b')});db[_0x1f06('0x61')]['hasMany'](db['ChatInteraction'],{'as':_0x1f06('0x161')});db['ChatWebsite']['hasMany'](db[_0x1f06('0x64')],{'as':_0x1f06('0x13e')});db[_0x1f06('0x61')][_0x1f06('0x10b')](db[_0x1f06('0x18c')],{'as':_0x1f06('0x150')});db[_0x1f06('0x61')]['belongsTo'](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db[_0x1f06('0x61')][_0x1f06('0x147')](db[_0x1f06('0x80')],{'as':'Interval','foreignKey':_0x1f06('0x14a')});db[_0x1f06('0x61')][_0x1f06('0x147')](db[_0x1f06('0x3b')],{'as':_0x1f06('0x3b'),'foreignKey':'MailAccountId'});db[_0x1f06('0x61')][_0x1f06('0x147')](db[_0x1f06('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x1f06('0x165')});db['ChatWebsite'][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x131')});db[_0x1f06('0x62')][_0x1f06('0x147')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db[_0x1f06('0x62')]['belongsTo'](db[_0x1f06('0x11a')],{'as':'Contact','foreignKey':_0x1f06('0x158')});db['OpenchannelQueueReport'][_0x1f06('0x147')](db[_0x1f06('0x10f')],{});db[_0x1f06('0x62')][_0x1f06('0x147')](db[_0x1f06('0x5e')],{});db[_0x1f06('0x62')][_0x1f06('0x147')](db['User'],{});db[_0x1f06('0x62')][_0x1f06('0x147')](db[_0x1f06('0x12b')],{});db[_0x1f06('0x64')][_0x1f06('0x147')](db['User'],{'as':_0x1f06('0x18d'),'foreignKey':_0x1f06('0x109'),'onDelete':_0x1f06('0x171')});db[_0x1f06('0x64')][_0x1f06('0x147')](db['ChatQueue'],{'as':_0x1f06('0x18e'),'foreignKey':_0x1f06('0x18f'),'onDelete':_0x1f06('0x171')});db['ChatApplication'][_0x1f06('0x147')](db['ChatWebsite'],{'as':_0x1f06('0x190'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x1f06('0x64')]['belongsTo'](db[_0x1f06('0x16a')],{'onDelete':_0x1f06('0x171'),'foreignKey':_0x1f06('0x172')});db['ChatInteraction'][_0x1f06('0x10b')](db[_0x1f06('0x18c')],{'as':_0x1f06('0x150'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x191')});db[_0x1f06('0x66')][_0x1f06('0x147')](db[_0x1f06('0x61')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x16f')});db['ChatInteraction'][_0x1f06('0x147')](db['CmContact'],{'as':'Contact','foreignKey':_0x1f06('0x158')});db[_0x1f06('0x66')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':_0x1f06('0x169'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0x66')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x192'),'as':_0x1f06('0x17b')});db[_0x1f06('0x66')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':'chat_interaction_has_tags','as':_0x1f06('0x16c')});db['ChatInteraction'][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':'Users','through':_0x1f06('0x121'),'foreignKey':_0x1f06('0x191')});db[_0x1f06('0x18c')]['belongsTo'](db[_0x1f06('0x10')],{'onDelete':_0x1f06('0x108'),'as':'User'});db['ChatMessage'][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'onDelete':'cascade','as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x18c')][_0x1f06('0x147')](db[_0x1f06('0x66')],{'onDelete':_0x1f06('0x108'),'as':_0x1f06('0x17c'),'foreignKey':_0x1f06('0x191')});db[_0x1f06('0x18c')][_0x1f06('0x147')](db[_0x1f06('0x17d')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x1f06('0x18c')][_0x1f06('0x147')](db[_0x1f06('0x61')],{'as':'Account','foreignKey':_0x1f06('0x16f')});db[_0x1f06('0x69')][_0x1f06('0x10b')](db['Attachment'],{'as':_0x1f06('0x16e'),'foreignKey':_0x1f06('0x170'),'onDelete':_0x1f06('0x108'),'hooks':!![]});db[_0x1f06('0x69')][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'onDelete':_0x1f06('0x108'),'as':'Contact','foreignKey':_0x1f06('0x158')});db[_0x1f06('0x69')][_0x1f06('0x147')](db[_0x1f06('0x61')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x16f')});db[_0x1f06('0x6a')]['belongsToMany'](db[_0x1f06('0x10')],{'as':'Agents','through':_0x1f06('0x30'),'hooks':!![]});db[_0x1f06('0x6a')][_0x1f06('0x118')](db[_0x1f06('0xdc')],{'through':_0x1f06('0x193'),'as':_0x1f06('0x14e')});db['ChatGroup'][_0x1f06('0x10b')](db[_0x1f06('0xc9')],{'as':_0x1f06('0x150'),'foreignKey':_0x1f06('0x194'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x6b')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':'Members','through':_0x1f06('0x119')});db[_0x1f06('0x6d')]['belongsTo'](db[_0x1f06('0x61')],{'as':'Website','foreignKey':_0x1f06('0x16f')});db[_0x1f06('0x195')][_0x1f06('0x10b')](db[_0x1f06('0x11a')],{'as':'Contacts','foreignKey':_0x1f06('0x196')});db[_0x1f06('0x11a')]['hasMany'](db['CmHopper'],{'as':_0x1f06('0x197'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x11a')][_0x1f06('0x10b')](db[_0x1f06('0x73')],{'as':_0x1f06('0x142'),'foreignKey':'ContactId'});db[_0x1f06('0x11a')][_0x1f06('0x10b')](db['CmHopperHistory'],{'as':_0x1f06('0x143'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x11a')][_0x1f06('0x10b')](db['ReportAgentPreview'],{'as':_0x1f06('0x10e'),'foreignKey':'ContactId'});db[_0x1f06('0x11a')]['hasMany'](db['JscriptySessionReport'],{'as':_0x1f06('0x145'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x11a')][_0x1f06('0x10b')](db[_0x1f06('0x10f')],{'as':_0x1f06('0x110'),'foreignKey':_0x1f06('0x158'),'onDelete':_0x1f06('0x171')});db[_0x1f06('0x11a')]['hasMany'](db['ChatInteraction'],{'as':_0x1f06('0x111'),'foreignKey':_0x1f06('0x158'),'onDelete':_0x1f06('0x171')});db[_0x1f06('0x11a')][_0x1f06('0x10b')](db['SmsInteraction'],{'as':_0x1f06('0x112'),'foreignKey':_0x1f06('0x158'),'onDelete':_0x1f06('0x171')});db[_0x1f06('0x11a')][_0x1f06('0x10b')](db[_0x1f06('0x4c')],{'as':'FaxInteractions','foreignKey':_0x1f06('0x158'),'onDelete':_0x1f06('0x171')});db[_0x1f06('0x11a')]['hasMany'](db[_0x1f06('0x40')],{'as':_0x1f06('0x114'),'foreignKey':_0x1f06('0x158'),'onDelete':_0x1f06('0x171')});db['CmContact'][_0x1f06('0x147')](db[_0x1f06('0x195')],{'as':_0x1f06('0x198'),'foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163'),'onDelete':_0x1f06('0x108')});db['CmContact'][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'through':'cm_user_has_contacts'});db[_0x1f06('0x11a')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'as':_0x1f06('0x17b'),'through':_0x1f06('0x199')});db[_0x1f06('0x11a')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x199'),'as':_0x1f06('0x16c')});db[_0x1f06('0x70')]['belongsTo'](db[_0x1f06('0x11a')],{'as':'Contact','foreignKey':_0x1f06('0x158'),'onDelete':_0x1f06('0x108')});db['CmHopper'][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x70')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':'Agent','foreignKey':_0x1f06('0x109')});db['CmHopper'][_0x1f06('0x147')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x1f06('0x140'),'onDelete':_0x1f06('0x108')});db['CmHopper']['belongsTo'](db[_0x1f06('0xdf')],{'as':'Campaign','foreignKey':_0x1f06('0x19a'),'onDelete':_0x1f06('0x108')});db['CmHopper'][_0x1f06('0x147')](db[_0x1f06('0x10')],{'as':'Owner','foreignKey':_0x1f06('0x19b')});db[_0x1f06('0x72')][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x72')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x72')][_0x1f06('0x147')](db[_0x1f06('0x141')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x1f06('0x108')});db[_0x1f06('0x72')][_0x1f06('0x147')](db[_0x1f06('0xdf')],{'as':_0x1f06('0xdf'),'foreignKey':_0x1f06('0x19a'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x79')]['hasMany'](db[_0x1f06('0x7e')],{'as':{'plural':_0x1f06('0x19c'),'singular':'OneAll'},'foreignKey':_0x1f06('0x19d'),'onDelete':_0x1f06('0x108'),'hooks':!![]});db['Automation'][_0x1f06('0x10b')](db['Condition'],{'as':{'plural':_0x1f06('0x19e'),'singular':_0x1f06('0x19f')},'foreignKey':_0x1f06('0x1a0'),'onDelete':_0x1f06('0x108'),'hooks':!![]});db[_0x1f06('0x79')][_0x1f06('0x10b')](db[_0x1f06('0x1a1')],{'as':_0x1f06('0x1a2'),'foreignKey':'AutomationId','onDelete':_0x1f06('0x108'),'hooks':!![]});db[_0x1f06('0x15e')][_0x1f06('0x10b')](db[_0x1f06('0x15e')],{'as':_0x1f06('0x15f'),'foreignKey':_0x1f06('0x1a3'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x80')]['hasMany'](db[_0x1f06('0x80')],{'as':_0x1f06('0x1a4'),'foreignKey':'IntervalId','onDelete':_0x1f06('0x108'),'hooks':!![],'required':![]});db['Interval'][_0x1f06('0x10b')](db[_0x1f06('0x15')],{'as':_0x1f06('0x1a5'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x1f06('0x80')][_0x1f06('0x10b')](db[_0x1f06('0x162')],{'as':_0x1f06('0x1a6'),'foreignKey':_0x1f06('0x14a')});db[_0x1f06('0x80')][_0x1f06('0x10b')](db[_0x1f06('0x64')],{'as':_0x1f06('0x1a7'),'foreignKey':_0x1f06('0x14a')});db[_0x1f06('0x80')]['hasMany'](db[_0x1f06('0x176')],{'as':'FaxApplications','foreignKey':_0x1f06('0x14a')});db[_0x1f06('0x80')][_0x1f06('0x10b')](db[_0x1f06('0x53')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0x1f06('0x147')](db[_0x1f06('0x3b')],{});db['Schedule'][_0x1f06('0x147')](db[_0x1f06('0x90')],{'foreignKey':_0x1f06('0x1a8')});db[_0x1f06('0x1a9')][_0x1f06('0x147')](db[_0x1f06('0x1aa')],{'foreignKey':_0x1f06('0x1ab')});db[_0x1f06('0x88')][_0x1f06('0x118')](db['VoiceMusicOnHold'],{'as':_0x1f06('0x1ac'),'through':_0x1f06('0x13f'),'onDelete':'restrict'});db[_0x1f06('0x16a')][_0x1f06('0x118')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x1f06('0x16a')][_0x1f06('0x118')](db[_0x1f06('0x66')],{'through':'chat_interaction_has_tags'});db[_0x1f06('0x16a')][_0x1f06('0x118')](db['MailInteraction'],{'through':_0x1f06('0x16b')});db[_0x1f06('0x16a')]['belongsToMany'](db[_0x1f06('0x55')],{'through':'sms_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x1f06('0x4c')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x1f06('0x118')](db['OpenchannelInteraction'],{'through':_0x1f06('0x188')});db[_0x1f06('0x16a')][_0x1f06('0x118')](db[_0x1f06('0xfa')],{'through':_0x1f06('0x1ad')});db[_0x1f06('0x8b')][_0x1f06('0x10b')](db[_0x1f06('0x7e')],{'as':{'plural':_0x1f06('0x1ae'),'singular':_0x1f06('0x1af')},'foreignKey':_0x1f06('0x1b0'),'onDelete':_0x1f06('0x108'),'hooks':!![]});db[_0x1f06('0x8b')][_0x1f06('0x10b')](db[_0x1f06('0x7e')],{'as':{'plural':_0x1f06('0x1b1'),'singular':_0x1f06('0x1b2')},'foreignKey':_0x1f06('0x1b3'),'onDelete':_0x1f06('0x108'),'hooks':!![]});db[_0x1f06('0x8b')][_0x1f06('0x10b')](db[_0x1f06('0x1a1')],{'as':'Actions','foreignKey':_0x1f06('0x1b4'),'onDelete':_0x1f06('0x108'),'hooks':!![]});db[_0x1f06('0x1aa')][_0x1f06('0x10b')](db[_0x1f06('0x94')],{'as':_0x1f06('0x1b5'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1ab'),'hooks':!![]});db[_0x1f06('0x90')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x1f06('0x1b5'),'onDelete':_0x1f06('0x108'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x1f06('0x10b')](db[_0x1f06('0x94')],{'as':_0x1f06('0x1b5'),'onDelete':'cascade','foreignKey':_0x1f06('0x1b6')});db['AnalyticFieldReport'][_0x1f06('0x147')](db[_0x1f06('0x92')],{'foreignKey':_0x1f06('0x1b6')});db[_0x1f06('0x97')]['hasMany'](db[_0x1f06('0x98')],{'as':_0x1f06('0x1b7'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1b8')});db['SalesforceConfiguration']['hasMany'](db[_0x1f06('0x9a')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x1f06('0x98')]['hasMany'](db[_0x1f06('0x9a')],{'as':_0x1f06('0x1b9'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0x98')][_0x1f06('0x10b')](db['SalesforceField'],{'as':_0x1f06('0x1b5'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0x98')][_0x1f06('0x147')](db[_0x1f06('0x97')],{'as':'Account','foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0x9a')]['hasMany'](db[_0x1f06('0x9a')],{'as':_0x1f06('0x1bc'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0x9a')][_0x1f06('0x10b')](db['SalesforceField'],{'as':_0x1f06('0x1be'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0x9a')][_0x1f06('0x10b')](db[_0x1f06('0x9a')],{'as':_0x1f06('0x1bf'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0x9a')]['belongsTo'](db[_0x1f06('0x8c')],{'as':_0x1f06('0x8c'),'foreignKey':_0x1f06('0x1c0')});db[_0x1f06('0x9b')][_0x1f06('0x10b')](db[_0x1f06('0x9d')],{'as':_0x1f06('0x1b7'),'onDelete':_0x1f06('0x108'),'foreignKey':'AccountId'});db[_0x1f06('0x9d')]['hasMany'](db['SugarcrmField'],{'as':_0x1f06('0x1c1'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0x9d')][_0x1f06('0x10b')](db[_0x1f06('0x9e')],{'as':_0x1f06('0x1b9'),'onDelete':_0x1f06('0x108'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration']['hasMany'](db[_0x1f06('0x9e')],{'as':_0x1f06('0x1b5'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1bb')});db['SugarcrmConfiguration'][_0x1f06('0x147')](db['SugarcrmAccount'],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0x9e')][_0x1f06('0x10b')](db[_0x1f06('0x9e')],{'as':_0x1f06('0x1bc'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0x9e')][_0x1f06('0x10b')](db[_0x1f06('0x9e')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x1f06('0x10b')](db[_0x1f06('0x9e')],{'as':'Field','foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0x9e')][_0x1f06('0x147')](db['Variable'],{'as':_0x1f06('0x8c'),'foreignKey':'VariableId'});db[_0x1f06('0xa0')][_0x1f06('0x10b')](db['DeskConfiguration'],{'as':_0x1f06('0x1b7'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xa1')][_0x1f06('0x10b')](db[_0x1f06('0xa3')],{'as':'Subjects','onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1bd')});db['DeskConfiguration'][_0x1f06('0x10b')](db['DeskField'],{'as':'Descriptions','onDelete':_0x1f06('0x108'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x1f06('0x10b')](db[_0x1f06('0xa3')],{'as':_0x1f06('0x1b5'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1bb')});db['DeskConfiguration'][_0x1f06('0x147')](db[_0x1f06('0xa0')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1b8')});db['DeskConfiguration'][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':'int_desk_configuration_has_tags'});db[_0x1f06('0xa3')]['hasMany'](db[_0x1f06('0xa3')],{'as':_0x1f06('0x1bc'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0xa3')]['hasMany'](db[_0x1f06('0xa3')],{'as':_0x1f06('0x1be'),'foreignKey':_0x1f06('0x1ba')});db['DeskField'][_0x1f06('0x10b')](db[_0x1f06('0xa3')],{'as':'Field','foreignKey':'FieldId'});db[_0x1f06('0xa3')][_0x1f06('0x147')](db[_0x1f06('0x8c')],{'as':_0x1f06('0x8c'),'foreignKey':_0x1f06('0x1c0')});db[_0x1f06('0xa4')][_0x1f06('0x10b')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xa5')][_0x1f06('0x10b')](db[_0x1f06('0xa7')],{'as':'Subjects','onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1bd')});db['ZohoConfiguration'][_0x1f06('0x10b')](db['ZohoField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x1f06('0x1ba')});db['ZohoConfiguration'][_0x1f06('0x10b')](db[_0x1f06('0xa7')],{'as':_0x1f06('0x1b5'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x1f06('0xa5')][_0x1f06('0x147')](db[_0x1f06('0xa4')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xa7')][_0x1f06('0x10b')](db[_0x1f06('0xa7')],{'as':_0x1f06('0x1bc'),'foreignKey':_0x1f06('0x1bd')});db['ZohoField'][_0x1f06('0x10b')](db[_0x1f06('0xa7')],{'as':'Description','foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xa7')]['hasMany'](db[_0x1f06('0xa7')],{'as':_0x1f06('0x1bf'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0xa7')][_0x1f06('0x147')](db[_0x1f06('0x8c')],{'as':_0x1f06('0x8c'),'foreignKey':_0x1f06('0x1c0')});db[_0x1f06('0xa8')]['hasMany'](db[_0x1f06('0xaa')],{'as':_0x1f06('0x1b7'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xaa')][_0x1f06('0x10b')](db[_0x1f06('0x1c2')],{'as':_0x1f06('0x1c1'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0xaa')][_0x1f06('0x10b')](db[_0x1f06('0x1c2')],{'as':_0x1f06('0x1b9'),'foreignKey':_0x1f06('0x1ba')});db['ZendeskConfiguration'][_0x1f06('0x10b')](db['ZendeskField'],{'as':_0x1f06('0x1b5'),'foreignKey':'FieldId'});db[_0x1f06('0xaa')][_0x1f06('0x147')](db['ZendeskAccount'],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xaa')]['belongsToMany'](db[_0x1f06('0x16a')],{'through':_0x1f06('0x1c3')});db[_0x1f06('0x1c2')][_0x1f06('0x10b')](db[_0x1f06('0x1c2')],{'as':_0x1f06('0x1bc'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0x1c2')][_0x1f06('0x10b')](db[_0x1f06('0x1c2')],{'as':_0x1f06('0x1be'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0x1c2')][_0x1f06('0x10b')](db[_0x1f06('0x1c2')],{'as':_0x1f06('0x1bf'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0x1c2')]['belongsTo'](db[_0x1f06('0x8c')],{'as':_0x1f06('0x8c'),'foreignKey':_0x1f06('0x1c0')});db[_0x1f06('0xad')][_0x1f06('0x10b')](db['FreshdeskConfiguration'],{'as':_0x1f06('0x1b7'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1b8')});db['FreshdeskConfiguration'][_0x1f06('0x10b')](db[_0x1f06('0xb1')],{'as':_0x1f06('0x1c1'),'onDelete':'cascade','foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0xaf')][_0x1f06('0x10b')](db[_0x1f06('0xb1')],{'as':_0x1f06('0x1b9'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xaf')][_0x1f06('0x10b')](db[_0x1f06('0xb1')],{'as':_0x1f06('0x1b5'),'onDelete':_0x1f06('0x108'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x1f06('0x147')](db['FreshdeskAccount'],{'as':_0x1f06('0x168'),'foreignKey':'AccountId'});db[_0x1f06('0xaf')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField']['hasMany'](db[_0x1f06('0xb1')],{'as':_0x1f06('0x1bc'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x1f06('0x10b')](db['FreshdeskField'],{'as':_0x1f06('0x1be'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xb1')][_0x1f06('0x10b')](db['FreshdeskField'],{'as':_0x1f06('0x1bf'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0xb1')][_0x1f06('0x147')](db['Variable'],{'as':_0x1f06('0x8c'),'foreignKey':_0x1f06('0x1c0')});db[_0x1f06('0xb3')][_0x1f06('0x10b')](db[_0x1f06('0xb5')],{'as':'Configurations','onDelete':_0x1f06('0x108'),'foreignKey':'AccountId'});db[_0x1f06('0xb5')][_0x1f06('0x10b')](db[_0x1f06('0xb7')],{'as':_0x1f06('0x1c1'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0xb5')]['hasMany'](db[_0x1f06('0xb7')],{'as':_0x1f06('0x1b9'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xb5')][_0x1f06('0x10b')](db[_0x1f06('0xb7')],{'as':_0x1f06('0x1b5'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0xb5')][_0x1f06('0x147')](db[_0x1f06('0xb3')],{'as':'Account','foreignKey':_0x1f06('0x1b8')});db['VtigerField'][_0x1f06('0x10b')](db[_0x1f06('0xb7')],{'as':'Subject','foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0xb7')][_0x1f06('0x10b')](db[_0x1f06('0xb7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1f06('0xb7')]['hasMany'](db[_0x1f06('0xb7')],{'as':'Field','foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0xb7')][_0x1f06('0x147')](db[_0x1f06('0x8c')],{'as':_0x1f06('0x8c'),'foreignKey':'VariableId'});db[_0x1f06('0xb8')][_0x1f06('0x10b')](db[_0x1f06('0xb9')],{'as':_0x1f06('0x1b7'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xb9')]['hasMany'](db[_0x1f06('0xbb')],{'as':_0x1f06('0x1c1'),'foreignKey':'SubjectId'});db[_0x1f06('0xb9')][_0x1f06('0x10b')](db[_0x1f06('0xbb')],{'as':_0x1f06('0x1b9'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xb9')][_0x1f06('0x10b')](db[_0x1f06('0xbb')],{'as':_0x1f06('0x1b5'),'foreignKey':'FieldId'});db[_0x1f06('0xb9')][_0x1f06('0x147')](db[_0x1f06('0xb8')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xbb')][_0x1f06('0x10b')](db[_0x1f06('0xbb')],{'as':_0x1f06('0x1bc'),'foreignKey':'SubjectId'});db[_0x1f06('0xbb')][_0x1f06('0x10b')](db[_0x1f06('0xbb')],{'as':'Description','foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xbb')]['hasMany'](db[_0x1f06('0xbb')],{'as':_0x1f06('0x1bf'),'foreignKey':_0x1f06('0x1bb')});db['ServicenowField'][_0x1f06('0x147')](db['Variable'],{'as':_0x1f06('0x8c'),'foreignKey':_0x1f06('0x1c0')});db['Dynamics365Account'][_0x1f06('0x10b')](db[_0x1f06('0x1c4')],{'as':_0x1f06('0x1b7'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0x1c4')][_0x1f06('0x10b')](db[_0x1f06('0xbe')],{'as':_0x1f06('0x1c1'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0x1c4')]['hasMany'](db['Dynamics365Field'],{'as':_0x1f06('0x1b9'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1ba')});db['Dynamics365Configuration']['hasMany'](db[_0x1f06('0xbe')],{'as':_0x1f06('0x1b5'),'onDelete':_0x1f06('0x108'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x1f06('0x147')](db[_0x1f06('0x1c5')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1b8')});db[_0x1f06('0xbe')][_0x1f06('0x10b')](db[_0x1f06('0xbe')],{'as':_0x1f06('0x1bc'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0xbe')][_0x1f06('0x10b')](db['Dynamics365Field'],{'as':_0x1f06('0x1be'),'foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xbe')][_0x1f06('0x10b')](db[_0x1f06('0xbe')],{'as':_0x1f06('0x1bf'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0xbe')][_0x1f06('0x147')](db[_0x1f06('0x8c')],{'as':_0x1f06('0x8c'),'foreignKey':'VariableId'});db[_0x1f06('0xc0')][_0x1f06('0x10b')](db[_0x1f06('0xc2')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x1f06('0xc2')][_0x1f06('0x10b')](db[_0x1f06('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x1f06('0xc2')]['hasMany'](db[_0x1f06('0xc4')],{'as':'Descriptions','foreignKey':_0x1f06('0x1ba')});db[_0x1f06('0xc2')][_0x1f06('0x10b')](db[_0x1f06('0xc4')],{'as':_0x1f06('0x1b5'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0xc2')][_0x1f06('0x147')](db[_0x1f06('0xc0')],{'as':'Account','foreignKey':'AccountId'});db[_0x1f06('0xc4')][_0x1f06('0x10b')](db[_0x1f06('0xc4')],{'as':_0x1f06('0x1bc'),'foreignKey':_0x1f06('0x1bd')});db[_0x1f06('0xc4')][_0x1f06('0x10b')](db[_0x1f06('0xc4')],{'as':_0x1f06('0x1be'),'foreignKey':_0x1f06('0x1ba')});db['FreshsalesField'][_0x1f06('0x10b')](db[_0x1f06('0xc4')],{'as':_0x1f06('0x1bf'),'foreignKey':_0x1f06('0x1bb')});db[_0x1f06('0xc4')]['belongsTo'](db[_0x1f06('0x8c')],{'as':'Variable','foreignKey':_0x1f06('0x1c0')});db[_0x1f06('0xc7')]['belongsTo'](db[_0x1f06('0x61')],{});db[_0x1f06('0xc7')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db[_0x1f06('0xc7')][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'as':_0x1f06('0x157'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0x1f06('0x147')](db['ChatInteraction'],{});db[_0x1f06('0xc7')][_0x1f06('0x147')](db[_0x1f06('0x18c')],{});db[_0x1f06('0xc7')][_0x1f06('0x147')](db['User'],{});db[_0x1f06('0xc7')]['belongsTo'](db['ChatQueue'],{});db['ChatInternalMessage'][_0x1f06('0x147')](db['User'],{'onDelete':'cascade','foreignKey':_0x1f06('0x1c6')});db[_0x1f06('0xc9')]['belongsTo'](db[_0x1f06('0x10')],{'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1c7')});db[_0x1f06('0xce')][_0x1f06('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x1f06('0x108')});db['JscriptySessionReport'][_0x1f06('0x10b')](db[_0x1f06('0xcb')],{'foreignKey':_0x1f06('0x1c8'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x1c9')][_0x1f06('0x147')](db[_0x1f06('0x135')],{});db[_0x1f06('0x1c9')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':'List','foreignKey':'ListId'});db[_0x1f06('0x1c9')]['belongsTo'](db['CmContact'],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0x1c9')][_0x1f06('0x147')](db['SmsInteraction'],{});db[_0x1f06('0x1c9')][_0x1f06('0x147')](db['SmsMessage'],{});db['SmsQueueReport'][_0x1f06('0x147')](db['User'],{});db['SmsQueueReport']['belongsTo'](db[_0x1f06('0x59')],{});db[_0x1f06('0xd2')][_0x1f06('0x10b')](db[_0x1f06('0xce')],{'foreignKey':_0x1f06('0x1ca')});db['JscriptyProject'][_0x1f06('0x10b')](db[_0x1f06('0xcd')],{'foreignKey':'ProjectId'});db[_0x1f06('0xd2')][_0x1f06('0x10b')](db['JscriptyAnswerReport'],{'foreignKey':_0x1f06('0x1ca')});db['SquareProject'][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'through':_0x1f06('0x13a')});db[_0x1f06('0xdc')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x11f')});db[_0x1f06('0xdc')][_0x1f06('0x118')](db[_0x1f06('0x141')],{'through':_0x1f06('0x1cb'),'as':_0x1f06('0x127')});db[_0x1f06('0xdc')]['belongsToMany'](db[_0x1f06('0x3d')],{'through':'team_has_mail_queues','as':_0x1f06('0x128')});db[_0x1f06('0xdc')][_0x1f06('0x118')](db[_0x1f06('0x6a')],{'through':'team_has_chat_queues','as':_0x1f06('0x129')});db[_0x1f06('0xdc')][_0x1f06('0x118')](db[_0x1f06('0x4f')],{'through':_0x1f06('0x17f'),'as':_0x1f06('0x12a')});db['Team'][_0x1f06('0x118')](db[_0x1f06('0x59')],{'through':_0x1f06('0x185'),'as':'SmsQueues'});db[_0x1f06('0xdc')][_0x1f06('0x118')](db[_0x1f06('0x12b')],{'through':_0x1f06('0x18a'),'as':_0x1f06('0x12c')});db['Team'][_0x1f06('0x118')](db[_0x1f06('0x101')],{'through':_0x1f06('0x1cc'),'as':'WhatsappQueues'});db['Team'][_0x1f06('0x118')](db[_0x1f06('0xee')],{'through':_0x1f06('0x106'),'as':_0x1f06('0x1cd')});db[_0x1f06('0xdf')]['hasMany'](db['CmHopper'],{'as':_0x1f06('0x197'),'foreignKey':_0x1f06('0x19a')});db[_0x1f06('0xdf')][_0x1f06('0x10b')](db[_0x1f06('0x73')],{'as':'HopperFinals','foreignKey':_0x1f06('0x19a')});db[_0x1f06('0xdf')]['hasMany'](db[_0x1f06('0x75')],{'as':_0x1f06('0x143'),'foreignKey':_0x1f06('0x19a')});db[_0x1f06('0xdf')][_0x1f06('0x10b')](db[_0x1f06('0x72')],{'as':_0x1f06('0x144'),'foreignKey':'CampaignId'});db[_0x1f06('0xdf')][_0x1f06('0x147')](db[_0x1f06('0x28')],{'as':'Trunk','foreignKey':_0x1f06('0x146')});db[_0x1f06('0xdf')]['belongsTo'](db['Trunk'],{'as':_0x1f06('0x148'),'foreignKey':_0x1f06('0x149')});db[_0x1f06('0xdf')][_0x1f06('0x147')](db[_0x1f06('0x80')],{'as':_0x1f06('0x80'),'foreignKey':_0x1f06('0x14a')});db[_0x1f06('0xdf')][_0x1f06('0x147')](db[_0x1f06('0xd6')],{'as':_0x1f06('0xd6'),'foreignKey':_0x1f06('0x1ce')});db['Campaign'][_0x1f06('0x118')](db['CmList'],{'as':_0x1f06('0x11d'),'through':'campaigns_has_cm_lists'});db[_0x1f06('0xdf')][_0x1f06('0x118')](db['CmList'],{'as':_0x1f06('0x14f'),'through':_0x1f06('0x1cf')});db[_0x1f06('0x17d')][_0x1f06('0x147')](db[_0x1f06('0x69')],{'as':_0x1f06('0x69'),'foreignKey':_0x1f06('0x170')});db['MailTransferReport'][_0x1f06('0x147')](db[_0x1f06('0x42')],{});db[_0x1f06('0xe5')][_0x1f06('0x147')](db[_0x1f06('0x40')],{});db['MailTransferReport'][_0x1f06('0x147')](db[_0x1f06('0x3b')],{'foreignKey':_0x1f06('0x1d0'),'as':'FromAccount'});db[_0x1f06('0xe5')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d1'),'as':_0x1f06('0x1d2')});db['MailTransferReport'][_0x1f06('0x147')](db['User'],{'foreignKey':'ToUserId','as':_0x1f06('0x1d3')});db[_0x1f06('0xe5')][_0x1f06('0x147')](db[_0x1f06('0x3d')],{'foreignKey':_0x1f06('0x1d4'),'as':_0x1f06('0x1d5')});db['MailTransferReport'][_0x1f06('0x147')](db[_0x1f06('0x3b')],{'foreignKey':'ToMailAccountId','as':_0x1f06('0x1d6')});db[_0x1f06('0xe7')][_0x1f06('0x147')](db[_0x1f06('0x18c')],{});db[_0x1f06('0xe7')][_0x1f06('0x147')](db[_0x1f06('0x66')],{});db[_0x1f06('0xe7')][_0x1f06('0x147')](db[_0x1f06('0x61')],{'foreignKey':_0x1f06('0x1d7'),'as':_0x1f06('0x1d8')});db[_0x1f06('0xe7')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d1'),'as':_0x1f06('0x1d2')});db[_0x1f06('0xe7')]['belongsTo'](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d9'),'as':_0x1f06('0x1d3')});db[_0x1f06('0xe7')]['belongsTo'](db[_0x1f06('0x6a')],{'foreignKey':_0x1f06('0x1da'),'as':_0x1f06('0x1d5')});db[_0x1f06('0xe7')][_0x1f06('0x147')](db['ChatWebsite'],{'foreignKey':_0x1f06('0x1db'),'as':_0x1f06('0x1d6')});db[_0x1f06('0xe9')][_0x1f06('0x147')](db[_0x1f06('0x178')],{});db[_0x1f06('0xe9')][_0x1f06('0x147')](db[_0x1f06('0x4c')],{});db[_0x1f06('0xe9')][_0x1f06('0x147')](db[_0x1f06('0x4a')],{'foreignKey':_0x1f06('0x1dc'),'as':_0x1f06('0x1d8')});db['FaxTransferReport']['belongsTo'](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d1'),'as':_0x1f06('0x1d2')});db[_0x1f06('0xe9')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d9'),'as':_0x1f06('0x1d3')});db['FaxTransferReport'][_0x1f06('0x147')](db[_0x1f06('0x4f')],{'foreignKey':_0x1f06('0x1dd'),'as':'ToQueue'});db[_0x1f06('0xe9')][_0x1f06('0x147')](db[_0x1f06('0x4a')],{'foreignKey':_0x1f06('0x1de'),'as':_0x1f06('0x1d6')});db['OpenchannelTransferReport'][_0x1f06('0x147')](db[_0x1f06('0x5e')],{});db[_0x1f06('0x1df')][_0x1f06('0x147')](db['OpenchannelInteraction'],{});db[_0x1f06('0x1df')]['belongsTo'](db[_0x1f06('0x5b')],{'foreignKey':_0x1f06('0x1e0'),'as':_0x1f06('0x1d8')});db[_0x1f06('0x1df')]['belongsTo'](db[_0x1f06('0x10')],{'foreignKey':'FromUserId','as':_0x1f06('0x1d2')});db['OpenchannelTransferReport'][_0x1f06('0x147')](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d9'),'as':'ToAgent'});db[_0x1f06('0x1df')]['belongsTo'](db[_0x1f06('0x12b')],{'foreignKey':'ToOpenchannelQueueId','as':_0x1f06('0x1d5')});db[_0x1f06('0x1df')]['belongsTo'](db[_0x1f06('0x5b')],{'foreignKey':_0x1f06('0x1e1'),'as':_0x1f06('0x1d6')});db['SmsTransferReport'][_0x1f06('0x147')](db[_0x1f06('0x57')],{});db[_0x1f06('0x1e2')]['belongsTo'](db[_0x1f06('0x55')],{});db[_0x1f06('0x1e2')]['belongsTo'](db[_0x1f06('0x135')],{'foreignKey':_0x1f06('0x1e3'),'as':_0x1f06('0x1d8')});db[_0x1f06('0x1e2')]['belongsTo'](db[_0x1f06('0x10')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x1f06('0x1e2')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d9'),'as':_0x1f06('0x1d3')});db[_0x1f06('0x1e2')][_0x1f06('0x147')](db[_0x1f06('0x59')],{'foreignKey':_0x1f06('0x1e4'),'as':_0x1f06('0x1d5')});db[_0x1f06('0x1e2')][_0x1f06('0x147')](db[_0x1f06('0x135')],{'foreignKey':_0x1f06('0x1e5'),'as':_0x1f06('0x1d6')});db['CmList'][_0x1f06('0x10b')](db[_0x1f06('0x15e')],{'as':_0x1f06('0x15f'),'foreignKey':_0x1f06('0x163'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0xec')][_0x1f06('0x10b')](db[_0x1f06('0x1e6')],{'as':_0x1f06('0x1e7'),'foreignKey':_0x1f06('0x163')});db[_0x1f06('0xec')][_0x1f06('0x10b')](db['CmContact'],{'as':_0x1f06('0x11b'),'onDelete':_0x1f06('0x108'),'foreignKey':'ListId'});db[_0x1f06('0xec')][_0x1f06('0x10b')](db[_0x1f06('0x73')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x1f06('0xec')]['hasMany'](db[_0x1f06('0x75')],{'as':'HopperHistory','foreignKey':_0x1f06('0x163')});db[_0x1f06('0xec')]['hasMany'](db[_0x1f06('0x10e')],{'as':'ReportAgentPreview','foreignKey':_0x1f06('0x163')});db[_0x1f06('0xec')][_0x1f06('0x118')](db[_0x1f06('0x141')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x1f06('0xec')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x11e')});db[_0x1f06('0xee')]['hasMany'](db[_0x1f06('0x15')],{'as':_0x1f06('0x1a5'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0xee')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x107')});db[_0x1f06('0xee')][_0x1f06('0x118')](db[_0x1f06('0xdc')],{'through':_0x1f06('0x106'),'as':'Teams'});db[_0x1f06('0xf0')][_0x1f06('0x10b')](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'foreignKey':_0x1f06('0x117')});db[_0x1f06('0xf0')][_0x1f06('0x10b')](db[_0x1f06('0xf2')],{'as':_0x1f06('0x1e8'),'foreignKey':'userProfileId','onDelete':_0x1f06('0x108')});db[_0x1f06('0xf2')][_0x1f06('0x10b')](db[_0x1f06('0x1e9')],{'as':_0x1f06('0x1ea'),'foreignKey':_0x1f06('0x1eb'),'onDelete':_0x1f06('0x108')});db[_0x1f06('0x1ec')]['hasMany'](db[_0x1f06('0x15e')],{'as':_0x1f06('0x15f'),'foreignKey':_0x1f06('0x1ed'),'onDelete':_0x1f06('0x108')});db['WhatsappAccount']['hasMany'](db[_0x1f06('0x7b')],{'as':_0x1f06('0x160'),'foreignKey':_0x1f06('0x1ed')});db[_0x1f06('0x1ec')][_0x1f06('0x10b')](db['WhatsappMessage'],{'as':_0x1f06('0x150'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x1f06('0x10b')](db[_0x1f06('0xfa')],{'as':'Interactions'});db[_0x1f06('0x1ec')][_0x1f06('0x10b')](db['WhatsappApplication'],{'as':_0x1f06('0x13e')});db['WhatsappAccount']['belongsTo'](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db['WhatsappAccount']['belongsTo'](db[_0x1f06('0x82')],{'as':_0x1f06('0x14b'),'foreignKey':_0x1f06('0x165')});db[_0x1f06('0x1ec')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':'Agents','through':_0x1f06('0x1ee')});db[_0x1f06('0xf8')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0xf8')][_0x1f06('0x147')](db[_0x1f06('0x101')],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0xf8')][_0x1f06('0x147')](db[_0x1f06('0x1ec')],{'onDelete':_0x1f06('0x171')});db[_0x1f06('0xf8')][_0x1f06('0x147')](db[_0x1f06('0x80')],{'onDelete':'restrict','foreignKey':_0x1f06('0x14a')});db[_0x1f06('0xf8')][_0x1f06('0x147')](db[_0x1f06('0x16a')],{'onDelete':_0x1f06('0x171'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x1f06('0x10b')](db['WhatsappMessage'],{'as':_0x1f06('0x150'),'onDelete':_0x1f06('0x108'),'foreignKey':_0x1f06('0x1ef')});db[_0x1f06('0xfa')][_0x1f06('0x147')](db[_0x1f06('0x1ec')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1ed')});db[_0x1f06('0xfa')]['belongsTo'](db[_0x1f06('0x11a')],{'as':_0x1f06('0x157'),'foreignKey':_0x1f06('0x158')});db[_0x1f06('0xfa')][_0x1f06('0x147')](db['User'],{'as':_0x1f06('0x169'),'foreignKey':_0x1f06('0x109')});db[_0x1f06('0xfa')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x1ad'),'as':_0x1f06('0x17b')});db[_0x1f06('0xfa')][_0x1f06('0x118')](db[_0x1f06('0x16a')],{'through':_0x1f06('0x1ad'),'as':_0x1f06('0x16c')});db[_0x1f06('0xfa')][_0x1f06('0x118')](db[_0x1f06('0x10')],{'as':_0x1f06('0x16d'),'through':_0x1f06('0x126'),'foreignKey':_0x1f06('0x1ef')});db[_0x1f06('0xfc')]['belongsTo'](db[_0x1f06('0x10')],{'as':_0x1f06('0x10')});db[_0x1f06('0xfc')][_0x1f06('0x147')](db[_0x1f06('0x11a')],{'onDelete':'cascade','as':_0x1f06('0x157')});db['WhatsappMessage'][_0x1f06('0x147')](db[_0x1f06('0xfa')],{'onDelete':_0x1f06('0x108'),'as':_0x1f06('0x17c'),'foreignKey':_0x1f06('0x1ef')});db[_0x1f06('0xfc')]['belongsTo'](db[_0x1f06('0x1ec')],{'as':_0x1f06('0x168'),'foreignKey':_0x1f06('0x1ed')});db[_0x1f06('0xfd')][_0x1f06('0x147')](db['WhatsappAccount'],{});db[_0x1f06('0xfd')][_0x1f06('0x147')](db[_0x1f06('0xec')],{'as':_0x1f06('0x173'),'foreignKey':_0x1f06('0x163')});db['WhatsappQueueReport']['belongsTo'](db[_0x1f06('0x11a')],{'as':_0x1f06('0x157'),'foreignKey':'ContactId'});db[_0x1f06('0xfd')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x1f06('0xfd')]['belongsTo'](db[_0x1f06('0x101')],{});db['WhatsappQueueReport'][_0x1f06('0x147')](db[_0x1f06('0xfc')],{});db[_0x1f06('0xfd')][_0x1f06('0x147')](db['User'],{});db['WhatsappTransferReport'][_0x1f06('0x147')](db['WhatsappMessage'],{});db[_0x1f06('0xff')][_0x1f06('0x147')](db[_0x1f06('0xfa')],{});db[_0x1f06('0xff')][_0x1f06('0x147')](db[_0x1f06('0x1ec')],{'foreignKey':'FromWhatsappAccountId','as':_0x1f06('0x1d8')});db[_0x1f06('0xff')][_0x1f06('0x147')](db[_0x1f06('0x1ec')],{'foreignKey':_0x1f06('0x1f0'),'as':'ToAccount'});db[_0x1f06('0xff')]['belongsTo'](db[_0x1f06('0x101')],{'foreignKey':_0x1f06('0x1f1'),'as':'ToQueue'});db['WhatsappTransferReport'][_0x1f06('0x147')](db['User'],{'foreignKey':'FromUserId','as':_0x1f06('0x1d2')});db[_0x1f06('0xff')][_0x1f06('0x147')](db[_0x1f06('0x10')],{'foreignKey':_0x1f06('0x1d9'),'as':_0x1f06('0x1d3')});db[_0x1f06('0x101')][_0x1f06('0x118')](db['User'],{'as':_0x1f06('0x14d'),'through':_0x1f06('0x12e'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0x1f06('0x118')](db[_0x1f06('0xdc')],{'through':_0x1f06('0x1cc'),'as':_0x1f06('0x14e')});module[_0x1f06('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e7f4e76..0f4fc1b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9274=['/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','username','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','pass','dsn','secret','oldPassword','isPlainObject','isArray','isString','replace','@@{','includes','path','express','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','device','x-forwarded-for','connection','other','agent_id','agent_name','test','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/mailServerOut','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign'];(function(_0x58e31d,_0x354688){var _0x3f38f6=function(_0x34864c){while(--_0x34864c){_0x58e31d['push'](_0x58e31d['shift']());}};_0x3f38f6(++_0x354688);}(_0x9274,0x1a3));var _0x4927=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9274[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var path=require(_0x4927('0x0'));var express=require(_0x4927('0x1'));var ewinston=require('express-winston');var util=require(_0x4927('0x2'));var errors=require(_0x4927('0x3'));var config=require('./config/environment');var logger=require(_0x4927('0x4'))(_0x4927('0x5'));var authLogger=require(_0x4927('0x4'))(_0x4927('0x6'));exports[_0x4927('0x7')]=function(_0x1c3cf6){_0x1c3cf6[_0x4927('0x8')](ewinston[_0x4927('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x67003,_0x48c176){var _0x31e472=_0x4927('0xa');if(!_[_0x4927('0xb')](_0x67003[_0x4927('0xc')])){_0x31e472+='\x20body=%s';var _0x4ba8ce=_0x67003[_0x4927('0xc')];maskSensitiveData(_0x4ba8ce);}return util[_0x4927('0xd')](_0x31e472,_0x67003[_0x4927('0xe')],_0x67003[_0x4927('0xf')]['x-forwarded-for']?_0x67003['headers']['x-forwarded-for']:_0x67003['connection'][_0x4927('0x10')]||_0x67003['ip'],_0x67003[_0x4927('0x11')],_0x48c176[_0x4927('0x12')],_0x48c176[_0x4927('0x13')],_0x67003[_0x4927('0x14')]?_0x67003[_0x4927('0x14')]['id']:null,_0x67003['user']?_0x67003['user'][_0x4927('0x15')]:null,_0x67003[_0x4927('0x14')]?_0x67003[_0x4927('0x14')][_0x4927('0x16')]:null,_0x4ba8ce?util[_0x4927('0x17')](_0x4ba8ce,![],null):'');}}));_0x1c3cf6[_0x4927('0x8')](ewinston[_0x4927('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3eb8bd,_0x430d6b){var _0x1c69be='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x3eb8bd[_0x4927('0xc')]&&_0x3eb8bd[_0x4927('0xc')][_0x4927('0x18')]&&_0x3eb8bd['body']['agent_id']){_0x1c69be='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4927('0xd')](_0x1c69be,_0x3eb8bd[_0x4927('0xe')],_0x3eb8bd[_0x4927('0xf')][_0x4927('0x19')]?_0x3eb8bd['headers']['x-forwarded-for']:_0x3eb8bd[_0x4927('0x1a')][_0x4927('0x10')]||_0x3eb8bd['ip'],_0x3eb8bd[_0x4927('0x11')],_0x430d6b[_0x4927('0x12')],_0x430d6b[_0x4927('0x13')],_0x3eb8bd[_0x4927('0x14')]?_0x3eb8bd[_0x4927('0x14')]['id']:null,_0x3eb8bd['user']?_0x3eb8bd[_0x4927('0x14')][_0x4927('0x15')]:null,_0x3eb8bd[_0x4927('0x14')]?_0x3eb8bd[_0x4927('0x14')][_0x4927('0x16')]:null,_0x3eb8bd['body']&&_0x3eb8bd[_0x4927('0xc')]['device']?_0x3eb8bd[_0x4927('0xc')][_0x4927('0x18')]:_0x4927('0x1b'),_0x3eb8bd['body']&&_0x3eb8bd[_0x4927('0xc')][_0x4927('0x1c')]?_0x3eb8bd['body']['agent_id']:'',_0x3eb8bd[_0x4927('0xc')]&&_0x3eb8bd['body'][_0x4927('0x1d')]?_0x3eb8bd['body'][_0x4927('0x1d')]:'');},'ignoreRoute':function(_0x48b5b1){var _0x23357a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x23357a[_0x4927('0x1e')](_0x48b5b1['url']);}}));_0x1c3cf6['use'](_0x4927('0x1f'),require('./api/user'));_0x1c3cf6['use'](_0x4927('0x20'),require('./api/voiceChanSpy'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x21'),require(_0x4927('0x22')));_0x1c3cf6['use']('/api/voice/extensions',require(_0x4927('0x23')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x24'),require(_0x4927('0x25')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x26'),require('./api/voiceQueue'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x27'),require(_0x4927('0x28')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x29'),require(_0x4927('0x2a')));_0x1c3cf6[_0x4927('0x8')]('/api/voice/mails',require(_0x4927('0x2b')));_0x1c3cf6[_0x4927('0x8')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x2c'),require(_0x4927('0x2d')));_0x1c3cf6['use'](_0x4927('0x2e'),require('./api/voiceDialReport'));_0x1c3cf6[_0x4927('0x8')]('/api/voice/agents/reports',require(_0x4927('0x2f')));_0x1c3cf6['use'](_0x4927('0x30'),require(_0x4927('0x31')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x32'),require(_0x4927('0x33')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x34'),require(_0x4927('0x35')));_0x1c3cf6[_0x4927('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x1c3cf6['use']('/api/mail/out_servers',require(_0x4927('0x36')));_0x1c3cf6[_0x4927('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x1c3cf6[_0x4927('0x8')]('/api/mail/queues',require(_0x4927('0x37')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x38'),require(_0x4927('0x39')));_0x1c3cf6[_0x4927('0x8')]('/api/mail/interactions',require(_0x4927('0x3a')));_0x1c3cf6[_0x4927('0x8')]('/api/mail/messages',require(_0x4927('0x3b')));_0x1c3cf6['use']('/api/mail/applications',require(_0x4927('0x3c')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x3d'),require(_0x4927('0x3e')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x3f'),require(_0x4927('0x40')));_0x1c3cf6['use']('/api/dashboards/items',require(_0x4927('0x41')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x42'),require(_0x4927('0x43')));_0x1c3cf6['use'](_0x4927('0x44'),require('./api/faxApplication'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x45'),require(_0x4927('0x46')));_0x1c3cf6['use'](_0x4927('0x47'),require(_0x4927('0x48')));_0x1c3cf6[_0x4927('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x49'),require(_0x4927('0x4a')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x4b'),require(_0x4927('0x4c')));_0x1c3cf6[_0x4927('0x8')]('/api/sms/applications',require('./api/smsApplication'));_0x1c3cf6[_0x4927('0x8')]('/api/sms/interactions',require(_0x4927('0x4d')));_0x1c3cf6[_0x4927('0x8')]('/api/sms/messages',require(_0x4927('0x4e')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x4f'),require(_0x4927('0x50')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x51'),require(_0x4927('0x52')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x53'),require(_0x4927('0x54')));_0x1c3cf6[_0x4927('0x8')]('/api/openchannel/interactions',require(_0x4927('0x55')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x56'),require(_0x4927('0x57')));_0x1c3cf6['use'](_0x4927('0x58'),require(_0x4927('0x59')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x5a'),require('./api/chatWebsite'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x5b'),require(_0x4927('0x5c')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x5d'),require(_0x4927('0x5e')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x5f'),require(_0x4927('0x60')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x61'),require('./api/chatMessage'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x62'),require('./api/chatOfflineMessage'));_0x1c3cf6['use'](_0x4927('0x63'),require(_0x4927('0x64')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x65'),require(_0x4927('0x66')));_0x1c3cf6['use'](_0x4927('0x67'),require(_0x4927('0x68')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x69'),require(_0x4927('0x6a')));_0x1c3cf6['use'](_0x4927('0x6b'),require('./api/cmContact'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x6c'),require(_0x4927('0x6d')));_0x1c3cf6['use'](_0x4927('0x6e'),require(_0x4927('0x6f')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x70'),require(_0x4927('0x71')));_0x1c3cf6[_0x4927('0x8')]('/api/cm/hopper_history',require(_0x4927('0x72')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x73'),require(_0x4927('0x74')));_0x1c3cf6['use'](_0x4927('0x75'),require(_0x4927('0x76')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x77'),require(_0x4927('0x78')));_0x1c3cf6['use']('/api/canned_answers',require(_0x4927('0x79')));_0x1c3cf6['use'](_0x4927('0x7a'),require('./api/disposition'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x7b'),require(_0x4927('0x7c')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x7d'),require('./api/interval'));_0x1c3cf6['use'](_0x4927('0x7e'),require(_0x4927('0x7f')));_0x1c3cf6[_0x4927('0x8')]('/api/cdr',require(_0x4927('0x80')));_0x1c3cf6['use'](_0x4927('0x81'),require(_0x4927('0x82')));_0x1c3cf6['use'](_0x4927('0x83'),require(_0x4927('0x84')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x85'),require('./api/sound'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x86'),require(_0x4927('0x87')));_0x1c3cf6[_0x4927('0x8')]('/api/templates',require(_0x4927('0x88')));_0x1c3cf6['use'](_0x4927('0x89'),require(_0x4927('0x8a')));_0x1c3cf6['use']('/api/variables',require(_0x4927('0x8b')));_0x1c3cf6['use'](_0x4927('0x8c'),require(_0x4927('0x8d')));_0x1c3cf6['use'](_0x4927('0x8e'),require(_0x4927('0x8f')));_0x1c3cf6['use'](_0x4927('0x90'),require(_0x4927('0x91')));_0x1c3cf6['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x92'),require('./api/analyticExtractedReport'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x93'),require(_0x4927('0x94')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x95'),require(_0x4927('0x96')));_0x1c3cf6[_0x4927('0x8')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x97'),require('./api/intSalesforceAccount'));_0x1c3cf6[_0x4927('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x98'),require(_0x4927('0x99')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x9a'),require(_0x4927('0x9b')));_0x1c3cf6['use'](_0x4927('0x9c'),require(_0x4927('0x9d')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x9e'),require(_0x4927('0x9f')));_0x1c3cf6['use']('/api/integrations/desk/accounts',require(_0x4927('0xa0')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xa1'),require(_0x4927('0xa2')));_0x1c3cf6[_0x4927('0x8')]('/api/integrations/desk/fields',require(_0x4927('0xa3')));_0x1c3cf6['use'](_0x4927('0xa4'),require('./api/intZohoAccount'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xa5'),require(_0x4927('0xa6')));_0x1c3cf6[_0x4927('0x8')]('/api/integrations/zoho/fields',require(_0x4927('0xa7')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xa8'),require(_0x4927('0xa9')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xaa'),require('./api/intZendeskConfiguration'));_0x1c3cf6[_0x4927('0x8')]('/api/integrations/zendesk/fields',require(_0x4927('0xab')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xac'),require('./api/intFreshdeskAccount'));_0x1c3cf6[_0x4927('0x8')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x1c3cf6['use'](_0x4927('0xad'),require(_0x4927('0xae')));_0x1c3cf6[_0x4927('0x8')]('/api/integrations/vtiger/accounts',require(_0x4927('0xaf')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xb0'),require(_0x4927('0xb1')));_0x1c3cf6['use'](_0x4927('0xb2'),require(_0x4927('0xb3')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xb4'),require(_0x4927('0xb5')));_0x1c3cf6[_0x4927('0x8')]('/api/integrations/servicenow/configurations',require(_0x4927('0xb6')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xb7'),require(_0x4927('0xb8')));_0x1c3cf6['use'](_0x4927('0xb9'),require(_0x4927('0xba')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xbb'),require(_0x4927('0xbc')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xbd'),require('./api/intDynamics365Field'));_0x1c3cf6['use'](_0x4927('0xbe'),require(_0x4927('0xbf')));_0x1c3cf6['use'](_0x4927('0xc0'),require(_0x4927('0xc1')));_0x1c3cf6['use'](_0x4927('0xc2'),require(_0x4927('0xc3')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xc4'),require(_0x4927('0xc5')));_0x1c3cf6[_0x4927('0x8')]('/api/chat/reports/queue',require(_0x4927('0xc6')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xc7'),require(_0x4927('0xc8')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xc9'),require(_0x4927('0xca')));_0x1c3cf6[_0x4927('0x8')]('/api/jscripty/questions/reports',require(_0x4927('0xcb')));_0x1c3cf6['use'](_0x4927('0xcc'),require('./api/jscriptySessionReport'));_0x1c3cf6['use']('/api/sms/reports/queue',require(_0x4927('0xcd')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xce'),require(_0x4927('0xcf')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xd0'),require(_0x4927('0xd1')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xd2'),require('./api/jscriptyProject'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xd3'),require(_0x4927('0xd4')));_0x1c3cf6['use'](_0x4927('0xd5'),require(_0x4927('0xd6')));_0x1c3cf6['use']('/api/square/projects',require('./api/squareProject'));_0x1c3cf6[_0x4927('0x8')]('/api/square/recordings',require(_0x4927('0xd7')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xd8'),require('./api/squareMessage'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xd9'),require(_0x4927('0xda')));_0x1c3cf6['use'](_0x4927('0xdb'),require(_0x4927('0xdc')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xdd'),require(_0x4927('0xde')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xdf'),require(_0x4927('0xe0')));_0x1c3cf6['use'](_0x4927('0xe1'),require(_0x4927('0xe2')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xe3'),require(_0x4927('0xe4')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xe5'),require('./api/mailTransferReport'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xe6'),require(_0x4927('0xe7')));_0x1c3cf6[_0x4927('0x8')]('/api/fax/reports/transfer',require(_0x4927('0xe8')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xe9'),require(_0x4927('0xea')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xeb'),require('./api/smsTransferReport'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xec'),require('./api/cmList'));_0x1c3cf6[_0x4927('0x8')]('/api/voice/prefixes',require(_0x4927('0xed')));_0x1c3cf6[_0x4927('0x8')]('/api/userProfiles',require(_0x4927('0xee')));_0x1c3cf6['use'](_0x4927('0xef'),require(_0x4927('0xf0')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xf1'),require(_0x4927('0xf2')));_0x1c3cf6['use']('/api/userNotifications',require(_0x4927('0xf3')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xf4'),require('./api/whatsappAccount'));_0x1c3cf6[_0x4927('0x8')]('/api/whatsapp/applications',require(_0x4927('0xf5')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xf6'),require('./api/whatsappInteraction'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xf7'),require(_0x4927('0xf8')));_0x1c3cf6['use']('/api/whatsapp/reports/queue',require(_0x4927('0xf9')));_0x1c3cf6[_0x4927('0x8')]('/api/whatsapp/reports/transfer',require(_0x4927('0xfa')));_0x1c3cf6[_0x4927('0x8')]('/api/whatsapp/queues',require(_0x4927('0xfb')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0xfc'),require(_0x4927('0xfd')));_0x1c3cf6[_0x4927('0x8')]('/api/realtime',require(_0x4927('0xfe')));_0x1c3cf6['use'](_0x4927('0xff'),require('./api/authLocal'));_0x1c3cf6['use'](_0x4927('0x100'),require(_0x4927('0x101')));_0x1c3cf6['use'](_0x4927('0x102'),require(_0x4927('0x103')));_0x1c3cf6['use'](_0x4927('0x104'),require(_0x4927('0x105')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x106'),require(_0x4927('0x107')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x108'),require(_0x4927('0x109')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x10a'),require(_0x4927('0x10b')));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x10c'),require('./api/webbar'));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x10d'),express[_0x4927('0x10e')](path[_0x4927('0x10f')](config['root'],_0x4927('0x10d'))));_0x1c3cf6['use']('/www',express[_0x4927('0x10e')](path[_0x4927('0x10f')](config[_0x4927('0x110')],_0x4927('0x111'))));_0x1c3cf6[_0x4927('0x8')]('/demo',express[_0x4927('0x10e')](path['join'](config[_0x4927('0x110')],_0x4927('0x112'))));_0x1c3cf6[_0x4927('0x8')](_0x4927('0x113'),express['static'](path['join'](config[_0x4927('0x110')],_0x4927('0x114'),_0x4927('0x115'))));_0x1c3cf6[_0x4927('0x8')]('/plugins',express[_0x4927('0x10e')](path[_0x4927('0x10f')](config[_0x4927('0x110')],_0x4927('0x116'))));_0x1c3cf6['route'](_0x4927('0x117'))[_0x4927('0x118')](errors[0x194]);_0x1c3cf6['route']('/*')[_0x4927('0x118')](function(_0x44e005,_0x4663b5){_0x4663b5[_0x4927('0x119')](path['resolve'](_0x1c3cf6[_0x4927('0x118')]('appPath')+'/index.html'));});};var sensitiveFields=[_0x4927('0x11a'),_0x4927('0x11b'),'newPassword',_0x4927('0x11c'),_0x4927('0x11d'),_0x4927('0x11e'),_0x4927('0x11f'),_0x4927('0x120'),_0x4927('0x121'),_0x4927('0x122'),_0x4927('0x123'),_0x4927('0x124'),_0x4927('0x125'),_0x4927('0x126'),_0x4927('0x127'),_0x4927('0x128'),_0x4927('0x129'),_0x4927('0x12a'),_0x4927('0x12b'),_0x4927('0x12c'),_0x4927('0x12d'),'authToken',_0x4927('0x12e'),_0x4927('0x12f'),_0x4927('0x130'),'calleridname','calleridnum',_0x4927('0x131'),_0x4927('0x132'),_0x4927('0x133'),_0x4927('0x134'),_0x4927('0x135'),_0x4927('0x136'),'key',_0x4927('0x14'),_0x4927('0x137'),'accountSid','localstationid',_0x4927('0x138'),_0x4927('0x139'),'registry',_0x4927('0x13a')];function maskSensitiveData(_0x3775af){var _0x2640a3=/(?!^)[\s\S](?!$)/g;if(!_[_0x4927('0x13b')](_0x3775af))return;for(var _0x153478 in _0x3775af){if(_[_0x4927('0x13c')](_0x3775af[_0x153478])){for(var _0x2c6273=0x0;_0x2c6273<_0x3775af[_0x153478]['length'];_0x2c6273++){maskSensitiveData(_0x3775af[_0x153478][_0x2c6273]);}}else if(_['isPlainObject'](_0x3775af[_0x153478])){maskSensitiveData(_0x3775af[_0x153478]);}else if(_[_0x4927('0x13d')](_0x3775af[_0x153478])){_0x3775af[_0x153478]=_0x3775af[_0x153478][_0x4927('0x13e')](/{{{/g,_0x4927('0x13f'))[_0x4927('0x13e')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0x4927('0x13e')](/}}/g,'}@');if(_[_0x4927('0x140')](sensitiveFields,_0x153478)){_0x3775af[_0x153478]=_0x3775af[_0x153478][_0x4927('0x13e')](_0x2640a3,'*');}}}} \ No newline at end of file +var _0xa269=['/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','./api/setting','/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/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/jira','/api/rpc','./api/rpc','/api/pm2','./api/pm2','static','join','/apidoc','/www','root','/demo','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','/index.html','password','newPassword','apiKey','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','authToken','consumerKey','calleridname','calleridnum','exten','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','isPlainObject','isArray','length','isString','replace','}@@','includes','lodash','path','express','express-winston','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','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','other','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/queues/reports','./api/memberReport'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa269,0x106));var _0x9a26=function(_0x10e4ec,_0x58460b){_0x10e4ec=_0x10e4ec-0x0;var _0x2db50c=_0xa269[_0x10e4ec];return _0x2db50c;};'use strict';var _=require(_0x9a26('0x0'));var path=require(_0x9a26('0x1'));var express=require(_0x9a26('0x2'));var ewinston=require(_0x9a26('0x3'));var util=require(_0x9a26('0x4'));var errors=require(_0x9a26('0x5'));var config=require(_0x9a26('0x6'));var logger=require(_0x9a26('0x7'))(_0x9a26('0x8'));var authLogger=require(_0x9a26('0x7'))(_0x9a26('0x9'));exports[_0x9a26('0xa')]=function(_0x8863dd){_0x8863dd[_0x9a26('0xb')](ewinston[_0x9a26('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3ad5b0,_0x59f818){var _0x3d45c8=_0x9a26('0xd');if(!_[_0x9a26('0xe')](_0x3ad5b0[_0x9a26('0xf')])){_0x3d45c8+=_0x9a26('0x10');var _0x45050f=_0x3ad5b0[_0x9a26('0xf')];maskSensitiveData(_0x45050f);}return util[_0x9a26('0x11')](_0x3d45c8,_0x3ad5b0['method'],_0x3ad5b0[_0x9a26('0x12')][_0x9a26('0x13')]?_0x3ad5b0['headers']['x-forwarded-for']:_0x3ad5b0[_0x9a26('0x14')][_0x9a26('0x15')]||_0x3ad5b0['ip'],_0x3ad5b0[_0x9a26('0x16')],_0x59f818[_0x9a26('0x17')],_0x59f818[_0x9a26('0x18')],_0x3ad5b0[_0x9a26('0x19')]?_0x3ad5b0[_0x9a26('0x19')]['id']:null,_0x3ad5b0[_0x9a26('0x19')]?_0x3ad5b0['user'][_0x9a26('0x1a')]:null,_0x3ad5b0[_0x9a26('0x19')]?_0x3ad5b0[_0x9a26('0x19')][_0x9a26('0x1b')]:null,_0x45050f?util[_0x9a26('0x1c')](_0x45050f,![],null):'');}}));_0x8863dd[_0x9a26('0xb')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x530510,_0x37f358){var _0x54c896=_0x9a26('0x1d');if(_0x530510[_0x9a26('0xf')]&&_0x530510[_0x9a26('0xf')][_0x9a26('0x1e')]&&_0x530510[_0x9a26('0xf')]['agent_id']){_0x54c896=_0x9a26('0x1f');}return util[_0x9a26('0x11')](_0x54c896,_0x530510[_0x9a26('0x20')],_0x530510['headers'][_0x9a26('0x13')]?_0x530510['headers'][_0x9a26('0x13')]:_0x530510[_0x9a26('0x14')][_0x9a26('0x15')]||_0x530510['ip'],_0x530510['url'],_0x37f358['statusCode'],_0x37f358['responseTime'],_0x530510[_0x9a26('0x19')]?_0x530510[_0x9a26('0x19')]['id']:null,_0x530510['user']?_0x530510[_0x9a26('0x19')][_0x9a26('0x1a')]:null,_0x530510[_0x9a26('0x19')]?_0x530510[_0x9a26('0x19')][_0x9a26('0x1b')]:null,_0x530510[_0x9a26('0xf')]&&_0x530510[_0x9a26('0xf')][_0x9a26('0x1e')]?_0x530510[_0x9a26('0xf')][_0x9a26('0x1e')]:_0x9a26('0x21'),_0x530510[_0x9a26('0xf')]&&_0x530510[_0x9a26('0xf')][_0x9a26('0x22')]?_0x530510['body']['agent_id']:'',_0x530510[_0x9a26('0xf')]&&_0x530510[_0x9a26('0xf')]['agent_name']?_0x530510['body'][_0x9a26('0x23')]:'');},'ignoreRoute':function(_0x56ebf2){var _0x54af6d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x54af6d['test'](_0x56ebf2[_0x9a26('0x16')]);}}));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x24'),require(_0x9a26('0x25')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x26'),require(_0x9a26('0x27')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x28'),require(_0x9a26('0x29')));_0x8863dd[_0x9a26('0xb')]('/api/voice/extensions',require(_0x9a26('0x2a')));_0x8863dd['use'](_0x9a26('0x2b'),require(_0x9a26('0x2c')));_0x8863dd['use'](_0x9a26('0x2d'),require(_0x9a26('0x2e')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x2f'),require(_0x9a26('0x30')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x31'),require(_0x9a26('0x32')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x33'),require('./api/voiceMail'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x34'),require(_0x9a26('0x35')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x36'),require(_0x9a26('0x37')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x38'),require('./api/voiceDialReport'));_0x8863dd[_0x9a26('0xb')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x39'),require('./api/voiceQueueReport'));_0x8863dd[_0x9a26('0xb')]('/api/members/reports',require(_0x9a26('0x3a')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x3b'),require(_0x9a26('0x3c')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x3d'),require(_0x9a26('0x3e')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x3f'),require(_0x9a26('0x40')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x41'),require(_0x9a26('0x42')));_0x8863dd[_0x9a26('0xb')]('/api/mail/queues',require(_0x9a26('0x43')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x44'),require(_0x9a26('0x45')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x46'),require(_0x9a26('0x47')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x48'),require(_0x9a26('0x49')));_0x8863dd[_0x9a26('0xb')]('/api/mail/applications',require('./api/mailApplication'));_0x8863dd['use'](_0x9a26('0x4a'),require(_0x9a26('0x4b')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x4c'),require(_0x9a26('0x4d')));_0x8863dd['use'](_0x9a26('0x4e'),require(_0x9a26('0x4f')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x50'),require(_0x9a26('0x51')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x52'),require(_0x9a26('0x53')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x54'),require(_0x9a26('0x55')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x56'),require('./api/faxMessage'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x57'),require(_0x9a26('0x58')));_0x8863dd['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x8863dd[_0x9a26('0xb')]('/api/sms/accounts',require(_0x9a26('0x59')));_0x8863dd[_0x9a26('0xb')]('/api/sms/applications',require(_0x9a26('0x5a')));_0x8863dd['use'](_0x9a26('0x5b'),require(_0x9a26('0x5c')));_0x8863dd[_0x9a26('0xb')]('/api/sms/messages',require(_0x9a26('0x5d')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x5e'),require(_0x9a26('0x5f')));_0x8863dd[_0x9a26('0xb')]('/api/openchannel/accounts',require(_0x9a26('0x60')));_0x8863dd['use'](_0x9a26('0x61'),require(_0x9a26('0x62')));_0x8863dd['use'](_0x9a26('0x63'),require(_0x9a26('0x64')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x65'),require(_0x9a26('0x66')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x67'),require(_0x9a26('0x68')));_0x8863dd['use'](_0x9a26('0x69'),require(_0x9a26('0x6a')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x6b'),require(_0x9a26('0x6c')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x6d'),require(_0x9a26('0x6e')));_0x8863dd['use']('/api/chat/interactions',require(_0x9a26('0x6f')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x70'),require(_0x9a26('0x71')));_0x8863dd[_0x9a26('0xb')]('/api/chat/offline_messages',require(_0x9a26('0x72')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x73'),require(_0x9a26('0x74')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x75'),require('./api/chatGroup'));_0x8863dd['use'](_0x9a26('0x76'),require(_0x9a26('0x77')));_0x8863dd[_0x9a26('0xb')]('/api/cm/companies',require(_0x9a26('0x78')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x79'),require(_0x9a26('0x7a')));_0x8863dd['use'](_0x9a26('0x7b'),require(_0x9a26('0x7c')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x7d'),require('./api/cmHopperBlack'));_0x8863dd['use']('/api/cm/hopper_final',require(_0x9a26('0x7e')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x7f'),require(_0x9a26('0x80')));_0x8863dd[_0x9a26('0xb')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x81'),require('./api/action'));_0x8863dd[_0x9a26('0xb')]('/api/automations',require(_0x9a26('0x82')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x83'),require('./api/cannedAnswer'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x84'),require(_0x9a26('0x85')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x86'),require(_0x9a26('0x87')));_0x8863dd['use'](_0x9a26('0x88'),require(_0x9a26('0x89')));_0x8863dd['use']('/api/pauses',require(_0x9a26('0x8a')));_0x8863dd[_0x9a26('0xb')]('/api/cdr',require(_0x9a26('0x8b')));_0x8863dd[_0x9a26('0xb')]('/api/voiceQueuesLog',require(_0x9a26('0x8c')));_0x8863dd[_0x9a26('0xb')]('/api/schedules',require(_0x9a26('0x8d')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x8e'),require(_0x9a26('0x8f')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x90'),require(_0x9a26('0x91')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x92'),require(_0x9a26('0x93')));_0x8863dd[_0x9a26('0xb')]('/api/triggers',require(_0x9a26('0x94')));_0x8863dd[_0x9a26('0xb')]('/api/variables',require(_0x9a26('0x95')));_0x8863dd['use'](_0x9a26('0x96'),require('./api/integration'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x97'),require('./api/integrationReport'));_0x8863dd['use'](_0x9a26('0x98'),require('./api/analyticCustomReport'));_0x8863dd[_0x9a26('0xb')]('/api/analytics/default_reports',require(_0x9a26('0x99')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x9a'),require(_0x9a26('0x9b')));_0x8863dd['use'](_0x9a26('0x9c'),require(_0x9a26('0x9d')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x9e'),require(_0x9a26('0x9f')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xa0'),require(_0x9a26('0xa1')));_0x8863dd[_0x9a26('0xb')]('/api/integrations/salesforce/accounts',require(_0x9a26('0xa2')));_0x8863dd[_0x9a26('0xb')]('/api/integrations/salesforce/configurations',require(_0x9a26('0xa3')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xa4'),require(_0x9a26('0xa5')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xa6'),require(_0x9a26('0xa7')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xa8'),require(_0x9a26('0xa9')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xaa'),require(_0x9a26('0xab')));_0x8863dd[_0x9a26('0xb')]('/api/integrations/desk/accounts',require(_0x9a26('0xac')));_0x8863dd[_0x9a26('0xb')]('/api/integrations/desk/configurations',require(_0x9a26('0xad')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xae'),require(_0x9a26('0xaf')));_0x8863dd['use'](_0x9a26('0xb0'),require('./api/intZohoAccount'));_0x8863dd[_0x9a26('0xb')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x8863dd[_0x9a26('0xb')]('/api/integrations/zoho/fields',require(_0x9a26('0xb1')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xb2'),require('./api/intZendeskAccount'));_0x8863dd['use'](_0x9a26('0xb3'),require(_0x9a26('0xb4')));_0x8863dd[_0x9a26('0xb')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xb5'),require('./api/intFreshdeskAccount'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xb6'),require(_0x9a26('0xb7')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xb8'),require(_0x9a26('0xb9')));_0x8863dd[_0x9a26('0xb')]('/api/integrations/vtiger/accounts',require(_0x9a26('0xba')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xbb'),require('./api/intVtigerConfiguration'));_0x8863dd[_0x9a26('0xb')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xbc'),require('./api/intServicenowAccount'));_0x8863dd[_0x9a26('0xb')]('/api/integrations/servicenow/configurations',require(_0x9a26('0xbd')));_0x8863dd['use'](_0x9a26('0xbe'),require(_0x9a26('0xbf')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xc0'),require(_0x9a26('0xc1')));_0x8863dd['use'](_0x9a26('0xc2'),require(_0x9a26('0xc3')));_0x8863dd['use'](_0x9a26('0xc4'),require(_0x9a26('0xc5')));_0x8863dd['use'](_0x9a26('0xc6'),require(_0x9a26('0xc7')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xc8'),require(_0x9a26('0xc9')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xca'),require('./api/intFreshsalesField'));_0x8863dd['use'](_0x9a26('0xcb'),require(_0x9a26('0xcc')));_0x8863dd['use']('/api/chat/reports/queue',require(_0x9a26('0xcd')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xce'),require('./api/chatInternalMessage'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xcf'),require(_0x9a26('0xd0')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xd1'),require(_0x9a26('0xd2')));_0x8863dd[_0x9a26('0xb')]('/api/jscripty/sessions/reports',require(_0x9a26('0xd3')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xd4'),require(_0x9a26('0xd5')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xd6'),require('./api/squareReport'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xd7'),require(_0x9a26('0xd8')));_0x8863dd[_0x9a26('0xb')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x8863dd['use']('/api/settings',require(_0x9a26('0xd9')));_0x8863dd[_0x9a26('0xb')]('/api/square/odbc',require('./api/squareOdbc'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xda'),require(_0x9a26('0xdb')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xdc'),require(_0x9a26('0xdd')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xde'),require(_0x9a26('0xdf')));_0x8863dd['use'](_0x9a26('0xe0'),require(_0x9a26('0xe1')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xe2'),require(_0x9a26('0xe3')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xe4'),require('./api/campaign'));_0x8863dd['use']('/api/migrations',require('./api/migration'));_0x8863dd['use'](_0x9a26('0xe5'),require(_0x9a26('0xe6')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xe7'),require(_0x9a26('0xe8')));_0x8863dd[_0x9a26('0xb')]('/api/mail/reports/transfer',require(_0x9a26('0xe9')));_0x8863dd[_0x9a26('0xb')]('/api/chat/reports/transfer',require(_0x9a26('0xea')));_0x8863dd[_0x9a26('0xb')]('/api/fax/reports/transfer',require(_0x9a26('0xeb')));_0x8863dd['use'](_0x9a26('0xec'),require(_0x9a26('0xed')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xee'),require('./api/smsTransferReport'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xef'),require(_0x9a26('0xf0')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xf1'),require('./api/voicePrefix'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xf2'),require('./api/userProfile'));_0x8863dd['use'](_0x9a26('0xf3'),require(_0x9a26('0xf4')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xf5'),require(_0x9a26('0xf6')));_0x8863dd['use'](_0x9a26('0xf7'),require(_0x9a26('0xf8')));_0x8863dd[_0x9a26('0xb')]('/api/whatsapp/accounts',require(_0x9a26('0xf9')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xfa'),require('./api/whatsappApplication'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xfb'),require(_0x9a26('0xfc')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0xfd'),require(_0x9a26('0xfe')));_0x8863dd[_0x9a26('0xb')]('/api/whatsapp/reports/queue',require(_0x9a26('0xff')));_0x8863dd[_0x9a26('0xb')]('/api/whatsapp/reports/transfer',require(_0x9a26('0x100')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x101'),require(_0x9a26('0x102')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x103'),require(_0x9a26('0x104')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x105'),require('./api/realtime'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x106'),require(_0x9a26('0x107')));_0x8863dd['use'](_0x9a26('0x108'),require('./api/authGoogle'));_0x8863dd[_0x9a26('0xb')]('/api/jira',require(_0x9a26('0x109')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x10a'),require(_0x9a26('0x10b')));_0x8863dd['use']('/api/version',require('./api/version'));_0x8863dd[_0x9a26('0xb')]('/api/system',require('./api/system'));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x10c'),require(_0x9a26('0x10d')));_0x8863dd[_0x9a26('0xb')]('/api/webbar',require('./api/webbar'));_0x8863dd[_0x9a26('0xb')]('/apidoc',express[_0x9a26('0x10e')](path[_0x9a26('0x10f')](config['root'],_0x9a26('0x110'))));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x111'),express['static'](path[_0x9a26('0x10f')](config[_0x9a26('0x112')],_0x9a26('0x111'))));_0x8863dd[_0x9a26('0xb')]('/demo',express[_0x9a26('0x10e')](path[_0x9a26('0x10f')](config[_0x9a26('0x112')],_0x9a26('0x113'))));_0x8863dd[_0x9a26('0xb')]('/snippet',express[_0x9a26('0x10e')](path['join'](config[_0x9a26('0x112')],'snippet','3.0.0')));_0x8863dd[_0x9a26('0xb')](_0x9a26('0x114'),express[_0x9a26('0x10e')](path[_0x9a26('0x10f')](config[_0x9a26('0x112')],_0x9a26('0x115'))));_0x8863dd[_0x9a26('0x116')](_0x9a26('0x117'))[_0x9a26('0x118')](errors[0x194]);_0x8863dd[_0x9a26('0x116')]('/*')[_0x9a26('0x118')](function(_0x2f0fc2,_0x3feb3b){_0x3feb3b[_0x9a26('0x119')](path['resolve'](_0x8863dd[_0x9a26('0x118')]('appPath')+_0x9a26('0x11a')));});};var sensitiveFields=['username',_0x9a26('0x11b'),_0x9a26('0x11c'),_0x9a26('0x11d'),'firstName',_0x9a26('0x11e'),_0x9a26('0x11f'),_0x9a26('0x120'),_0x9a26('0x121'),_0x9a26('0x122'),_0x9a26('0x123'),_0x9a26('0x124'),_0x9a26('0x125'),_0x9a26('0x126'),_0x9a26('0x127'),_0x9a26('0x128'),_0x9a26('0x129'),'token',_0x9a26('0x12a'),_0x9a26('0x12b'),'accessTokenSecret',_0x9a26('0x12c'),_0x9a26('0x12d'),'consumerSecret','membername',_0x9a26('0x12e'),_0x9a26('0x12f'),_0x9a26('0x130'),'vidaooApiKey','clientEmail',_0x9a26('0x131'),_0x9a26('0x132'),_0x9a26('0x133'),_0x9a26('0x134'),_0x9a26('0x19'),_0x9a26('0x135'),_0x9a26('0x136'),_0x9a26('0x137'),_0x9a26('0x138'),'secret',_0x9a26('0x139'),'oldPassword'];function maskSensitiveData(_0x47e382){var _0x2bdb35=/(?!^)[\s\S](?!$)/g;if(!_[_0x9a26('0x13a')](_0x47e382))return;for(var _0x4fcf2f in _0x47e382){if(_[_0x9a26('0x13b')](_0x47e382[_0x4fcf2f])){for(var _0x20c431=0x0;_0x20c431<_0x47e382[_0x4fcf2f][_0x9a26('0x13c')];_0x20c431++){maskSensitiveData(_0x47e382[_0x4fcf2f][_0x20c431]);}}else if(_[_0x9a26('0x13a')](_0x47e382[_0x4fcf2f])){maskSensitiveData(_0x47e382[_0x4fcf2f]);}else if(_[_0x9a26('0x13d')](_0x47e382[_0x4fcf2f])){_0x47e382[_0x4fcf2f]=_0x47e382[_0x4fcf2f][_0x9a26('0x13e')](/{{{/g,'@@{')[_0x9a26('0x13e')](/}}}/g,_0x9a26('0x13f'))[_0x9a26('0x13e')](/{{/g,'@{')[_0x9a26('0x13e')](/}}/g,'}@');if(_[_0x9a26('0x140')](sensitiveFields,_0x4fcf2f)){_0x47e382[_0x4fcf2f]=_0x47e382[_0x4fcf2f]['replace'](_0x2bdb35,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8033e55..8698800 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a73=['../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc'];(function(_0x250a8b,_0x223f0c){var _0x5e588d=function(_0x663b8){while(--_0x663b8){_0x250a8b['push'](_0x250a8b['shift']());}};_0x5e588d(++_0x223f0c);}(_0x7a73,0x1c7));var _0x37a7=function(_0x13e220,_0x52e1fa){_0x13e220=_0x13e220-0x0;var _0x3d933a=_0x7a73[_0x13e220];return _0x3d933a;};'use strict';var jayson=require(_0x37a7('0x0'));var BPromise=require('bluebird');var _=require('lodash');var config=require('../config/environment');exports[_0x37a7('0x1')]=function(){return new BPromise(function(_0x270f68,_0x10ea88){var _0x20491f={};_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x2')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x3')));_0x20491f=_['merge'](_0x20491f,require('../api/voiceQueue/voiceQueue.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x5')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x6')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x20491f=_['merge'](_0x20491f,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x7')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x8')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x9')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0xa')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0xb')));_0x20491f=_['merge'](_0x20491f,require('../api/mailAccount/mailAccount.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0xc')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/mailInteraction/mailInteraction.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0xd')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0xe')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0xf')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x10')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x11')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x12')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x13')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x14')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x15')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x16')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x17')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x18')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x19')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x1a')));_0x20491f=_['merge'](_0x20491f,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x1b')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x1c')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x1d')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x1e')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/chatMessage/chatMessage.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x1f')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x20')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x21')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x22')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x23')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x24')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x25')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x26')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x27')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x28')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x29')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x2a')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x2b')));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x2c')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x2d')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x2e')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x2f')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x30')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x31')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x32')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x20491f=_['merge'](_0x20491f,require(_0x37a7('0x33')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/setting/setting.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x34')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x35')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x36')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x37')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x38')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x39')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require('../api/plugin/plugin.rpc'));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x3a')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x3b')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x3c')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x3d')));_0x20491f=_[_0x37a7('0x4')](_0x20491f,require(_0x37a7('0x3e')));var _0x40154e=jayson[_0x37a7('0x3f')](_0x20491f)[_0x37a7('0x40')]();var _0x2f4681=config['rpc'][_0x37a7('0x41')]||config[_0x37a7('0x41')]+0x1;var _0x2760d1=config[_0x37a7('0x42')]['ip']||_0x37a7('0x43');_0x40154e['on'](_0x37a7('0x44'),function(_0x2cb9fe){return _0x10ea88(_0x2cb9fe);});_0x40154e['listen'](_0x2f4681,_0x2760d1,function(){console[_0x37a7('0x45')](_0x37a7('0x46'),_0x2760d1,_0x2f4681);require('../config/triggers')[_0x37a7('0x47')]();return _0x270f68(_0x37a7('0x48')+_0x2760d1+':'+_0x2f4681);});});}; \ No newline at end of file +var _0xbe0b=['localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port'];(function(_0x199951,_0x30cd3e){var _0x39d5da=function(_0x221628){while(--_0x221628){_0x199951['push'](_0x199951['shift']());}};_0x39d5da(++_0x30cd3e);}(_0xbe0b,0x11e));var _0xbbe0=function(_0x4112f5,_0x304bfe){_0x4112f5=_0x4112f5-0x0;var _0x44b7e6=_0xbe0b[_0x4112f5];return _0x44b7e6;};'use strict';var jayson=require(_0xbbe0('0x0'));var BPromise=require(_0xbbe0('0x1'));var _=require(_0xbbe0('0x2'));var config=require('../config/environment');exports[_0xbbe0('0x3')]=function(){return new BPromise(function(_0x4c6f92,_0x39360c){var _0x58794e={};_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x5')));_0x58794e=_['merge'](_0x58794e,require('../api/voiceExtension/voiceExtension.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x6')));_0x58794e=_['merge'](_0x58794e,require('../api/voiceRecording/voiceRecording.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x7')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x8')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x9')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0xa')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0xb')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/trunk/trunk.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0xc')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0xd')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0xe')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0xf')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x10')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/mailInteraction/mailInteraction.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/mailMessage/mailMessage.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x11')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x12')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x13')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x14')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x15')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x16')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x17')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x18')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x19')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x1a')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x1b')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x1c')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x1d')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x1e')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x1f')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x20')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x21')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x22')));_0x58794e=_['merge'](_0x58794e,require('../api/cmContact/cmContact.rpc'));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x23')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x24')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x25')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x26')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x27')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/pause/pause.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x28')));_0x58794e=_['merge'](_0x58794e,require('../api/template/template.rpc'));_0x58794e=_['merge'](_0x58794e,require('../api/trigger/trigger.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x29')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x58794e=_['merge'](_0x58794e,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x2a')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x2b')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x2c')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x2d')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x2e')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x2f')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x30')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x31')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x32')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x33')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x34')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/squareOdbc/squareOdbc.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x35')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/squareRecording/squareRecording.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x36')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x37')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x38')));_0x58794e=_['merge'](_0x58794e,require('../api/plugin/plugin.rpc'));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x39')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x3a')));_0x58794e=_['merge'](_0x58794e,require(_0xbbe0('0x3b')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require(_0xbbe0('0x3c')));_0x58794e=_[_0xbbe0('0x4')](_0x58794e,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x45fd6f=jayson[_0xbbe0('0x3d')](_0x58794e)['http']();var _0x3877ff=config[_0xbbe0('0x3e')][_0xbbe0('0x3f')]||config[_0xbbe0('0x3f')]+0x1;var _0x404e29=config[_0xbbe0('0x3e')]['ip']||_0xbbe0('0x40');_0x45fd6f['on'](_0xbbe0('0x41'),function(_0x5d66b5){return _0x39360c(_0x5d66b5);});_0x45fd6f[_0xbbe0('0x3')](_0x3877ff,_0x404e29,function(){console[_0xbbe0('0x42')](_0xbbe0('0x43'),_0x404e29,_0x3877ff);require('../config/triggers')[_0xbbe0('0x44')]();return _0x4c6f92(_0xbbe0('0x45')+_0x404e29+':'+_0x3877ff);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6eee2ee..0f5f8b6 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 _0xcfbf=['GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','lodash','events','EventEmitter','./reply','./error','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','destroy','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable'];(function(_0x6cd6f,_0x268963){var _0x3f6240=function(_0x10db08){while(--_0x10db08){_0x6cd6f['push'](_0x6cd6f['shift']());}};_0x3f6240(++_0x268963);}(_0xcfbf,0x1f1));var _0xfcfb=function(_0x276647,_0x62e085){_0x276647=_0x276647-0x0;var _0x3ef883=_0xcfbf[_0x276647];return _0x3ef883;};'use strict';var util=require('util');var _=require(_0xfcfb('0x0'));var EventEmitter=require(_0xfcfb('0x1'))[_0xfcfb('0x2')];var AGIReply=require(_0xfcfb('0x3'));var AGIError=require(_0xfcfb('0x4'));function AGIChannel(_0x28b39e){var _0xb8fc79=this,_0x1ce038=new AGIReply(),_0x4c56ff=![],_0xf2ed04={};EventEmitter['call'](_0xb8fc79);_0x28b39e['setEncoding'](_0xfcfb('0x5'));_0x28b39e[_0xfcfb('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1ce038[_0xfcfb('0x7')]('utf8');_0x1ce038['on'](_0xfcfb('0x8'),function(_0x19a972){for(var _0x268336 in _0x19a972){_0xb8fc79[_0x268336]=_0x19a972[_0x268336];}_0xb8fc79[_0xfcfb('0x9')](_0xfcfb('0xa'));});_0x1ce038['on'](_0xfcfb('0xb'),function(_0x26324a){if(_0x26324a[_0xfcfb('0xc')]()==_0xfcfb('0xd')){_0xb8fc79[_0xfcfb('0x9')](_0xfcfb('0xd'));return;}if(_0x26324a[_0xfcfb('0xe')](0x0,0xb)==_0xfcfb('0xf')){_0x4c56ff=!![];}if(_0x4c56ff){_0xf2ed04['rx']+=_0x26324a+'\x0a';if(_0x26324a[_0xfcfb('0x10')](_0xfcfb('0x11'))!=-0x1){_0x4c56ff=![];}}else{_0xf2ed04['rx']=_0x26324a;}if(_0x4c56ff){return;}if(typeof _0xf2ed04['cb']==_0xfcfb('0x12')){var _0x2619dd=_0xf2ed04['rx'][_0xfcfb('0xe')](0x0,0x3),_0x104135=null,_0x51cc1a=null;_0x2619dd=parseInt(_0x2619dd);if(isNaN(_0x2619dd)){_0xf2ed04['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x2619dd!=0xc8){_0xf2ed04['cb'](null,{'code':_0x2619dd,'result':-0x1,'extra':'KO'});return;}_0x104135=_0xf2ed04['rx'][_0xfcfb('0xe')](0x4)[_0xfcfb('0x13')](_0xfcfb('0x14'),'');if(_0x104135[_0xfcfb('0x15')]('\x20')!=-0x1){_0x104135=_0x104135[_0xfcfb('0x16')](0x0,_0x104135[_0xfcfb('0x15')]('\x20'));}if(_['startsWith'](_0x104135,'-1')){_0x104135=parseInt(_0x104135);}_0x51cc1a=_0xf2ed04['rx'][_0xfcfb('0x17')]('\x20');if(_0x51cc1a[_0xfcfb('0x18')]==0x3){_0x51cc1a=_0x51cc1a[0x2][_0xfcfb('0xe')](0x1,_0x51cc1a[0x2][_0xfcfb('0x18')]-0x1);}else if(_0x51cc1a[_0xfcfb('0x18')]>0x3){var _0x5cdb10=/\((.+)\)/;var _0xdcef46=_0xf2ed04['rx'][_0xfcfb('0x19')](_0x5cdb10);if(_0xdcef46){_0x51cc1a=_0xdcef46[0x1];}else{_0x51cc1a=null;}}else{_0x51cc1a=null;}_0xf2ed04['cb'](null,{'code':_0x2619dd,'result':_0x104135,'extra':_0x51cc1a});}});_0x28b39e['on'](_0xfcfb('0x1a'),function(_0x12c50d){_0xb8fc79[_0xfcfb('0x9')](_0xfcfb('0x1a'),new AGIError(_0xfcfb('0x1b'),_0x12c50d['code']));});_0x28b39e['on']('close',function(){_0xb8fc79['emit'](_0xfcfb('0x1c'),new AGIError(_0xfcfb('0x1d')));});_0x28b39e['on'](_0xfcfb('0x1e'),function(){_0xb8fc79[_0xfcfb('0x9')](_0xfcfb('0x1e'),new AGIError(_0xfcfb('0x1f')));_0x28b39e['destroy']();});_0x28b39e['pipe'](_0x1ce038);this[_0xfcfb('0x20')]=function(_0xfe2da6,_0x2c0311){var _0xfe2da6=_0xfe2da6||'',_0x2c0311=typeof _0x2c0311=='function'?_0x2c0311:new Function();_0xf2ed04={'tx':_0xfe2da6,'rx':'','cb':_0x2c0311};_0x28b39e['write'](_0xfe2da6+'\x0a');},this[_0xfcfb('0x1c')]=function(){_0x28b39e[_0xfcfb('0x21')]();};}util[_0xfcfb('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xfcfb('0x23')]=function(_0x5ac008){return this[_0xfcfb('0x20')][_0xfcfb('0x24')](this,_0x5ac008);};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x26')]=function(){return this['sendRequest'](_0xfcfb('0x27'));};AGIChannel['prototype'][_0xfcfb('0x28')]=function(_0x5e98dc,_0x43f124,_0x5c280b){_0x5e98dc=_0x5e98dc===undefined?_0xfcfb('0x29'):_0x5e98dc;_0x43f124=_0x43f124===undefined?'5':_0x43f124;_0x5c280b=_0x5c280b===undefined?'1':_0x5c280b;return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x2b'),_0x5e98dc,_0x43f124*0x3e8,_0x5c280b));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x2c')]=function(_0x5ff1eb){_0x5ff1eb=_0x5ff1eb||_0xfcfb('0x2d');return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x2e'),_0x5ff1eb));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x2f')]=function(_0x47298,_0x53fc1e){if(_[_0xfcfb('0x30')](_0x53fc1e)){return this['sendRequest'](util[_0xfcfb('0x2a')](_0xfcfb('0x31'),_0x47298,_0x53fc1e[_0xfcfb('0x32')](',')));}return this['sendRequest'](util[_0xfcfb('0x2a')](_0xfcfb('0x31'),_0x47298,_0x53fc1e));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x33')]=function(_0x35c64a){return this[_0xfcfb('0x23')](util['format']('SET\x20CONTEXT\x20%s',_0x35c64a));};AGIChannel['prototype'][_0xfcfb('0x34')]=function(_0x1649b6){return this[_0xfcfb('0x23')](util['format']('SET\x20EXTENSION\x20%s',_0x1649b6));};AGIChannel['prototype'][_0xfcfb('0x35')]=function(_0x2fafe7){return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x36'),_0x2fafe7));};AGIChannel[_0xfcfb('0x25')]['hangup']=function(){return this['sendRequest'](_0xfcfb('0x37'));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x38')]=function(_0x560da4,_0xe4853b){var _0x42c46a=_[_0xfcfb('0x39')](_0xe4853b)||_[_0xfcfb('0x3a')](_0xe4853b)?_0xe4853b[_0xfcfb('0x3b')]():_0xe4853b;return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x3c'),_0x560da4,_0x42c46a?_0x42c46a[_0xfcfb('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xfcfb('0x3d')]=function(_0x5d2b19,_0xd4ecb7){return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5d2b19,_0xd4ecb7));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x3e')]=function(_0x3f1ace,_0x2f0846){return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x3f'),_0x3f1ace,_0x2f0846));};AGIChannel['prototype'][_0xfcfb('0x40')]=function(_0x483dca,_0x673570){return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x41'),_0x483dca,_0x673570));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x42')]=function(_0x5d26d5,_0x37880b,_0x53df11){_0x37880b=_0x37880b||this[_0xfcfb('0x43')];_0x53df11=_0x53df11||0x1;this[_0xfcfb('0x33')](_0x5d26d5);this[_0xfcfb('0x34')](_0x37880b);this[_0xfcfb('0x35')](_0x53df11);return this[_0xfcfb('0x2c')](util['format'](_0xfcfb('0x44'),_0x5d26d5,_0x37880b,_0x53df11));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x45')]=function(_0xd717e4){return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x46'),_0xd717e4));};AGIChannel['prototype'][_0xfcfb('0x47')]=function(_0x30f7b5,_0x51f903,_0x37ae22,_0x194591,_0x4a7430,_0xfbb691){_0x51f903=_0x51f903||_0xfcfb('0x48');_0x37ae22=_0x37ae22||'';_0x194591=_0x194591===undefined?-0x1:_0x194591==='-1'?-0x1:_0x194591*0x3e8;_0x4a7430=_0x4a7430===undefined?'':'s='+_0x4a7430;_0xfbb691=_0xfbb691?'BEEP':'';return this[_0xfcfb('0x23')](util[_0xfcfb('0x2a')](_0xfcfb('0x49'),_0x30f7b5,_0x51f903,_0x37ae22,_0x194591,_0xfbb691,_0x4a7430));};AGIChannel['prototype'][_0xfcfb('0x4a')]=function(_0x398d6a,_0x93f1ca){_0x93f1ca=_0x93f1ca||'';return this[_0xfcfb('0x23')](util['format'](_0xfcfb('0x4b'),_0x398d6a,_0x93f1ca));};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x4c')]=function(_0x583470){return this[_0xfcfb('0x2f')](_0xfcfb('0x4d'),_0x583470);};AGIChannel[_0xfcfb('0x25')][_0xfcfb('0x4e')]=function(_0x380ce2){return this[_0xfcfb('0x2f')](_0xfcfb('0x4f'),_0x380ce2);};AGIChannel['prototype'][_0xfcfb('0x1a')]=function(_0x5051a2,_0x3db057){this[_0xfcfb('0x2c')](util[_0xfcfb('0x2a')](_0xfcfb('0x50'),_0x5051a2['id'],_0x5051a2['label'],_0x3db057));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x77a9=['pipe','command','write','prototype','sync','answer','sendRequest','ANSWER','getData','beep','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','events','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy'];(function(_0x1bb0b8,_0x24add2){var _0x22fc67=function(_0x2e051d){while(--_0x2e051d){_0x1bb0b8['push'](_0x1bb0b8['shift']());}};_0x22fc67(++_0x24add2);}(_0x77a9,0x19e));var _0x977a=function(_0x1da29c,_0x12d503){_0x1da29c=_0x1da29c-0x0;var _0x5b30fe=_0x77a9[_0x1da29c];return _0x5b30fe;};'use strict';var util=require(_0x977a('0x0'));var _=require('lodash');var EventEmitter=require(_0x977a('0x1'))['EventEmitter'];var AGIReply=require(_0x977a('0x2'));var AGIError=require(_0x977a('0x3'));function AGIChannel(_0x3807f1){var _0x368664=this,_0x520cd7=new AGIReply(),_0x318fc8=![],_0xb755={};EventEmitter[_0x977a('0x4')](_0x368664);_0x3807f1[_0x977a('0x5')](_0x977a('0x6'));_0x3807f1['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x520cd7['setEncoding'](_0x977a('0x6'));_0x520cd7['on'](_0x977a('0x7'),function(_0x5ac9c7){for(var _0x3974cf in _0x5ac9c7){_0x368664[_0x3974cf]=_0x5ac9c7[_0x3974cf];}_0x368664[_0x977a('0x8')](_0x977a('0x9'));});_0x520cd7['on'](_0x977a('0xa'),function(_0x279857){if(_0x279857[_0x977a('0xb')]()==_0x977a('0xc')){_0x368664[_0x977a('0x8')](_0x977a('0xc'));return;}if(_0x279857[_0x977a('0xd')](0x0,0xb)=='520-Invalid'){_0x318fc8=!![];}if(_0x318fc8){_0xb755['rx']+=_0x279857+'\x0a';if(_0x279857[_0x977a('0xe')](_0x977a('0xf'))!=-0x1){_0x318fc8=![];}}else{_0xb755['rx']=_0x279857;}if(_0x318fc8){return;}if(typeof _0xb755['cb']==_0x977a('0x10')){var _0x3c9281=_0xb755['rx'][_0x977a('0xd')](0x0,0x3),_0x44982f=null,_0x1fc863=null;_0x3c9281=parseInt(_0x3c9281);if(isNaN(_0x3c9281)){_0xb755['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x977a('0x11')});return;}if(_0x3c9281!=0xc8){_0xb755['cb'](null,{'code':_0x3c9281,'result':-0x1,'extra':'KO'});return;}_0x44982f=_0xb755['rx'][_0x977a('0xd')](0x4)[_0x977a('0x12')]('result=','');if(_0x44982f[_0x977a('0x13')]('\x20')!=-0x1){_0x44982f=_0x44982f['substr'](0x0,_0x44982f[_0x977a('0x13')]('\x20'));}if(_[_0x977a('0x14')](_0x44982f,'-1')){_0x44982f=parseInt(_0x44982f);}_0x1fc863=_0xb755['rx']['split']('\x20');if(_0x1fc863[_0x977a('0x15')]==0x3){_0x1fc863=_0x1fc863[0x2][_0x977a('0xd')](0x1,_0x1fc863[0x2][_0x977a('0x15')]-0x1);}else if(_0x1fc863[_0x977a('0x15')]>0x3){var _0x5a352c=/\((.+)\)/;var _0x3ab4f9=_0xb755['rx'][_0x977a('0x16')](_0x5a352c);if(_0x3ab4f9){_0x1fc863=_0x3ab4f9[0x1];}else{_0x1fc863=null;}}else{_0x1fc863=null;}_0xb755['cb'](null,{'code':_0x3c9281,'result':_0x44982f,'extra':_0x1fc863});}});_0x3807f1['on'](_0x977a('0x17'),function(_0x5b57bd){_0x368664[_0x977a('0x8')](_0x977a('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x5b57bd[_0x977a('0x18')]));});_0x3807f1['on']('close',function(){_0x368664[_0x977a('0x8')](_0x977a('0x19'),new AGIError(_0x977a('0x1a')));});_0x3807f1['on'](_0x977a('0x1b'),function(){_0x368664[_0x977a('0x8')]('timeout',new AGIError(_0x977a('0x1c')));_0x3807f1[_0x977a('0x1d')]();});_0x3807f1[_0x977a('0x1e')](_0x520cd7);this[_0x977a('0x1f')]=function(_0x22898f,_0x50ba0a){var _0x22898f=_0x22898f||'',_0x50ba0a=typeof _0x50ba0a==_0x977a('0x10')?_0x50ba0a:new Function();_0xb755={'tx':_0x22898f,'rx':'','cb':_0x50ba0a};_0x3807f1[_0x977a('0x20')](_0x22898f+'\x0a');},this[_0x977a('0x19')]=function(){_0x3807f1[_0x977a('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x977a('0x21')]['sendRequest']=function(_0x35888f){return this[_0x977a('0x1f')][_0x977a('0x22')](this,_0x35888f);};AGIChannel['prototype'][_0x977a('0x23')]=function(){return this[_0x977a('0x24')](_0x977a('0x25'));};AGIChannel['prototype'][_0x977a('0x26')]=function(_0x49a87a,_0x1ebceb,_0x3184b2){_0x49a87a=_0x49a87a===undefined?_0x977a('0x27'):_0x49a87a;_0x1ebceb=_0x1ebceb===undefined?'5':_0x1ebceb;_0x3184b2=_0x3184b2===undefined?'1':_0x3184b2;return this['sendRequest'](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x49a87a,_0x1ebceb*0x3e8,_0x3184b2));};AGIChannel[_0x977a('0x21')]['noop']=function(_0x48fa58){_0x48fa58=_0x48fa58||_0x977a('0x28');return this['sendRequest'](util[_0x977a('0x29')]('VERBOSE\x20\x22%s\x22',_0x48fa58));};AGIChannel[_0x977a('0x21')][_0x977a('0x2a')]=function(_0x1c1d57,_0x32a816){if(_['isArray'](_0x32a816)){return this[_0x977a('0x24')](util[_0x977a('0x29')](_0x977a('0x2b'),_0x1c1d57,_0x32a816[_0x977a('0x2c')](',')));}return this[_0x977a('0x24')](util['format']('EXEC\x20%s\x20%s',_0x1c1d57,_0x32a816));};AGIChannel[_0x977a('0x21')][_0x977a('0x2d')]=function(_0x30c0be){return this['sendRequest'](util[_0x977a('0x29')](_0x977a('0x2e'),_0x30c0be));};AGIChannel[_0x977a('0x21')]['setExtension']=function(_0x2ee08d){return this[_0x977a('0x24')](util[_0x977a('0x29')](_0x977a('0x2f'),_0x2ee08d));};AGIChannel[_0x977a('0x21')]['setPriority']=function(_0x2242dc){return this[_0x977a('0x24')](util[_0x977a('0x29')](_0x977a('0x30'),_0x2242dc));};AGIChannel[_0x977a('0x21')][_0x977a('0xc')]=function(){return this[_0x977a('0x24')](_0x977a('0x31'));};AGIChannel['prototype'][_0x977a('0x32')]=function(_0x25af42,_0x2f40fb){var _0x24e3d0=_[_0x977a('0x33')](_0x2f40fb)||_[_0x977a('0x34')](_0x2f40fb)?_0x2f40fb[_0x977a('0x35')]():_0x2f40fb;return this['sendRequest'](util[_0x977a('0x29')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x25af42,_0x24e3d0?_0x24e3d0[_0x977a('0x35')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x977a('0x36')]=function(_0x8ece8d,_0x2073b7){return this['sendRequest'](util['format'](_0x977a('0x37'),_0x8ece8d,_0x2073b7));};AGIChannel[_0x977a('0x21')][_0x977a('0x38')]=function(_0x2ae0d2,_0x53c251){return this['sendRequest'](util[_0x977a('0x29')](_0x977a('0x39'),_0x2ae0d2,_0x53c251));};AGIChannel[_0x977a('0x21')]['sayPhonetic']=function(_0x2de16a,_0x4e9310){return this['sendRequest'](util[_0x977a('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2de16a,_0x4e9310));};AGIChannel[_0x977a('0x21')][_0x977a('0x3a')]=function(_0x4ddef4,_0xb53181,_0x27b3ca){_0xb53181=_0xb53181||this[_0x977a('0x3b')];_0x27b3ca=_0x27b3ca||0x1;this[_0x977a('0x2d')](_0x4ddef4);this['setExtension'](_0xb53181);this['setPriority'](_0x27b3ca);return this[_0x977a('0x3c')](util[_0x977a('0x29')](_0x977a('0x3d'),_0x4ddef4,_0xb53181,_0x27b3ca));};AGIChannel[_0x977a('0x21')][_0x977a('0x3e')]=function(_0xe986f5){return this[_0x977a('0x24')](util[_0x977a('0x29')](_0x977a('0x3f'),_0xe986f5));};AGIChannel['prototype'][_0x977a('0x40')]=function(_0x56fa52,_0x99c580,_0x11ee33,_0x288bb1,_0x1bd43f,_0x518946){_0x99c580=_0x99c580||_0x977a('0x41');_0x11ee33=_0x11ee33||'';_0x288bb1=_0x288bb1===undefined?-0x1:_0x288bb1==='-1'?-0x1:_0x288bb1*0x3e8;_0x1bd43f=_0x1bd43f===undefined?'':'s='+_0x1bd43f;_0x518946=_0x518946?_0x977a('0x42'):'';return this[_0x977a('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x56fa52,_0x99c580,_0x11ee33,_0x288bb1,_0x518946,_0x1bd43f));};AGIChannel['prototype']['streamFile']=function(_0x35ebeb,_0x407ae1){_0x407ae1=_0x407ae1||'';return this[_0x977a('0x24')](util[_0x977a('0x29')](_0x977a('0x43'),_0x35ebeb,_0x407ae1));};AGIChannel[_0x977a('0x21')][_0x977a('0x44')]=function(_0x1c2c1a){return this[_0x977a('0x2a')](_0x977a('0x45'),_0x1c2c1a);};AGIChannel[_0x977a('0x21')][_0x977a('0x46')]=function(_0x5ee5ee){return this[_0x977a('0x2a')](_0x977a('0x47'),_0x5ee5ee);};AGIChannel['prototype']['error']=function(_0x2a6cb7,_0x2449d3){this['noop'](util[_0x977a('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2a6cb7['id'],_0x2a6cb7[_0x977a('0x48')],_0x2449d3));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x977a('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f2ff483..bf516fa 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 _0x4e4f=['push','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0x4e4f,0xf4));var _0xf4e4=function(_0x238c57,_0x199312){_0x238c57=_0x238c57-0x0;var _0x330024=_0x4e4f[_0x238c57];return _0x330024;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xf4e4('0x0'),'E_AGI_ARGUMENT_PORT':_0xf4e4('0x1'),'E_AGI_SERVER_ERROR':_0xf4e4('0x2'),'E_AGI_SERVER_CLOSE':_0xf4e4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xf4e4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xf4e4('0x5'),'E_AGI_SOCKET_CLOSE':_0xf4e4('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xf4e4('0x7'),'E_AGI_COMMAND_EMPTY':_0xf4e4('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xf4e4('0x9')};function AGIError(_0x3fc023){var _0x3fc023=_0x3fc023||null,_0x2b5af2=_0x2b5af2||[],_0x112a2b=0x1,_0x395a94='';if(!error[_0x3fc023]){_0x3fc023=_0xf4e4('0xa');}_0x2b5af2[_0xf4e4('0xb')](error[_0x3fc023]);while(arguments[_0x112a2b]){_0x2b5af2[_0xf4e4('0xb')](arguments[_0x112a2b]);_0x112a2b++;}_0x395a94=util[_0xf4e4('0xc')][_0xf4e4('0xd')](util,_0x2b5af2);this[_0xf4e4('0xe')]=_0x395a94;this[_0xf4e4('0xf')]=_0x3fc023;}module[_0xf4e4('0x10')]=AGIError; \ No newline at end of file +var _0xc2fe=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','format','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xc2fe,0x159));var _0xec2f=function(_0x19c7a1,_0x6c5a78){_0x19c7a1=_0x19c7a1-0x0;var _0x5bfa06=_0xc2fe[_0x19c7a1];return _0x5bfa06;};'use strict';var util=require(_0xec2f('0x0'));var error={'E_AGI_UNDEFINED':_0xec2f('0x1'),'E_AGI_ARGUMENT_PORT':_0xec2f('0x2'),'E_AGI_SERVER_ERROR':_0xec2f('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xec2f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xec2f('0x5'),'E_AGI_SOCKET_ERROR':_0xec2f('0x6'),'E_AGI_SOCKET_CLOSE':_0xec2f('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xec2f('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xec2f('0x9')};function AGIError(_0x4eae0e){var _0x4eae0e=_0x4eae0e||null,_0x2eee25=_0x2eee25||[],_0x33edcb=0x1,_0x4df1da='';if(!error[_0x4eae0e]){_0x4eae0e='E_AGI_UNDEFINED';}_0x2eee25['push'](error[_0x4eae0e]);while(arguments[_0x33edcb]){_0x2eee25['push'](arguments[_0x33edcb]);_0x33edcb++;}_0x4df1da=util[_0xec2f('0xa')][_0xec2f('0xb')](util,_0x2eee25);this['message']=_0x4df1da;this[_0xec2f('0xc')]=_0x4eae0e;}module[_0xec2f('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5ed605b..393e255 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 _0xcb11=['vertices','edges','prototype','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits'];(function(_0x53ce33,_0x182e70){var _0x54e760=function(_0x2d6269){while(--_0x2d6269){_0x53ce33['push'](_0x53ce33['shift']());}};_0x54e760(++_0x182e70);}(_0xcb11,0x1a4));var _0x1cb1=function(_0x599f13,_0x1c0140){_0x599f13=_0x599f13-0x0;var _0x1ebd6a=_0xcb11[_0x599f13];return _0x1ebd6a;};'use strict';var _=require(_0x1cb1('0x0'));var logger=require(_0x1cb1('0x1'))(_0x1cb1('0x2'));var verticesWithRetry=[_0x1cb1('0x3'),_0x1cb1('0x4'),'getsecretdigits'];var Graph=function(){this[_0x1cb1('0x5')]={};this[_0x1cb1('0x6')]={};this['numberOfEdges']=0x0;};Graph['prototype']['addVertex']=function(_0x441a18){this[_0x1cb1('0x5')][_0x441a18['id']]=_0x441a18;this[_0x1cb1('0x6')][_0x441a18['id']]=[];};Graph[_0x1cb1('0x7')][_0x1cb1('0x8')]=function(_0x59b4cc,_0x427ce4,_0x3b5204){this['edges'][_0x59b4cc]['push']({'target':_0x427ce4,'condition':_0x3b5204});this['numberOfEdges']+=0x1;};Graph[_0x1cb1('0x7')][_0x1cb1('0x9')]=function(){return _[_0x1cb1('0x9')](this[_0x1cb1('0x5')]);};Graph['prototype'][_0x1cb1('0xa')]=function(){return this['numberOfEdges'];};Graph[_0x1cb1('0x7')][_0x1cb1('0xb')]=function(_0x438ff0){return this[_0x1cb1('0x5')][_0x438ff0];};Graph['prototype'][_0x1cb1('0xc')]=function(_0x4a1eaf,_0x553bff){if(!this['vertices'][_0x4a1eaf]){return logger[_0x1cb1('0xd')](_0x1cb1('0xe'));}var _0x272989=_0x553bff(this['vertices'][_0x4a1eaf]);if(!_0x272989){return logger['info']('stop\x20traverse');}if(this[_0x1cb1('0x6')][_0x4a1eaf][_0x1cb1('0xf')]===0x0){return logger[_0x1cb1('0xd')]('no\x20edge/s\x20available');}for(var _0x25e271=0x0,_0x5a85b5=[],_0x2c5333=![];_0x25e271\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','getSquareProject','then','catch','createSquareReport','inspect','debug','stringify','timeout','sync','production','start','root','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','close','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x55cb3d,_0x4bed8f){var _0x15d60a=function(_0x526149){while(--_0x526149){_0x55cb3d['push'](_0x55cb3d['shift']());}};_0x15d60a(++_0x4bed8f);}(_0x6c4d,0x196));var _0xd6c4=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x6c4d[_0x49ca18];return _0x145d54;};'use strict';var parser=require(_0xd6c4('0x0'));var _=require(_0xd6c4('0x1'));var syncho=require(_0xd6c4('0x2'));var util=require('util');var moment=require(_0xd6c4('0x3'));var config=require(_0xd6c4('0x4'));var logger=require(_0xd6c4('0x5'))(_0xd6c4('0x6'));var utilLicense=require(_0xd6c4('0x7'));var rpc=require('./rpc');var mailRpc=require(_0xd6c4('0x8'));var Graph=require(_0xd6c4('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xd6c4('0x6')]=_['defaults'](config[_0xd6c4('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x52f57a){process[_0xd6c4('0xa')](function(){syncho(function(){try{setChannelVariables(_0x52f57a);agiHandler(_0x52f57a);}catch(_0xad4a9c){logger[_0xd6c4('0xb')](_0xad4a9c['stack']);}});});}function listeningHandler(){console[_0xd6c4('0xc')](_0xd6c4('0xd'),config[_0xd6c4('0x6')][_0xd6c4('0xe')]);logger[_0xd6c4('0xf')](util[_0xd6c4('0x10')](_0xd6c4('0x11'),config[_0xd6c4('0x6')]['ip'],config['agi'][_0xd6c4('0xe')]));}function errorHandler(_0x40d927){if(_0x40d927&&_0x40d927[_0xd6c4('0x12')]&&_0x40d927[_0xd6c4('0x13')]){logger['error'](util[_0xd6c4('0x10')](_0xd6c4('0x14'),_0x40d927[_0xd6c4('0x12')],_0x40d927['message']));}else{logger[_0xd6c4('0xb')](util['format'](_0xd6c4('0x15'),_0x40d927[_0xd6c4('0x16')]));}}function closeHandler(){logger[_0xd6c4('0xf')](util[_0xd6c4('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd6c4('0x17')],this[_0xd6c4('0x18')],this[_0xd6c4('0x19')],this[_0xd6c4('0x1a')],this[_0xd6c4('0x1b')]));try{createSquareReport(this);}catch(_0x41d868){logger[_0xd6c4('0xb')](_0x41d868[_0xd6c4('0x16')]);}}function timeoutHandler(){logger[_0xd6c4('0xf')](util[_0xd6c4('0x10')](_0xd6c4('0x1c'),this[_0xd6c4('0x17')],this[_0xd6c4('0x18')],this[_0xd6c4('0x19')],this[_0xd6c4('0x1a')],this[_0xd6c4('0x1b')]));}function hangupHandler(){logger[_0xd6c4('0xf')](util[_0xd6c4('0x10')](_0xd6c4('0x1d'),this[_0xd6c4('0x17')],this[_0xd6c4('0x18')],this[_0xd6c4('0x19')],this[_0xd6c4('0x1a')],this[_0xd6c4('0x1b')]));this[_0xd6c4('0x1e')]=!![];}function getRoot(_0xe6967c){return parser[_0xd6c4('0x1f')](_0xe6967c,{'object':!![]})[_0xd6c4('0x20')]['root'];}function addVertex(_0x4005a0,_0x4c7561,_0x1f06a9){_0x4c7561[_0xd6c4('0x21')]=_0x1f06a9;if(_0x4c7561['hasOwnProperty'](_0xd6c4('0x22'))){_0x4c7561[_0xd6c4('0x23')]=parseInt(_0x4c7561[_0xd6c4('0x22')],0xa);}_0x4005a0[_0xd6c4('0x24')](_[_0xd6c4('0x25')](_0x4c7561,_0xd6c4('0x26')));}function initGraph(_0x53e1e5,_0x56474a){var _0x54c4c2=new Graph();for(var _0x2f2c89 in _0x53e1e5){if(_0x53e1e5['hasOwnProperty'](_0x2f2c89)){if(_[_0xd6c4('0x27')](_0x53e1e5[_0x2f2c89])){for(var _0xd966a4=0x0;_0xd966a4<_0x53e1e5[_0x2f2c89][_0xd6c4('0x28')];_0xd966a4+=0x1){addVertex(_0x54c4c2,_0x53e1e5[_0x2f2c89][_0xd966a4],_0x2f2c89);}}else{addVertex(_0x54c4c2,_0x53e1e5[_0x2f2c89],_0x2f2c89);}}}for(var _0x21cb2d=0x0;_0x21cb2d<_0x56474a['length'];_0x21cb2d+=0x1){if(_0x56474a[_0x21cb2d][_0xd6c4('0x29')]&&_0x56474a[_0x21cb2d]['target']){_0x54c4c2[_0xd6c4('0x2a')](_0x56474a[_0x21cb2d][_0xd6c4('0x29')],_0x56474a[_0x21cb2d][_0xd6c4('0x2b')],_0x56474a[_0x21cb2d][_0xd6c4('0x2c')]);}}return _0x54c4c2;}function getSquareProject(_0x488302,_0x26c725){rpc[_0xd6c4('0x2d')](_0x488302)[_0xd6c4('0x2e')](function(_0x7197be){_0x26c725(null,_0x7197be);})[_0xd6c4('0x2f')](function(_0x5c6ed4){_0x26c725(null,_0x5c6ed4);});}function createSquareReport(_0x3d7944,_0x48825c){rpc[_0xd6c4('0x30')](_0x3d7944)[_0xd6c4('0x2e')](function(_0x29f3d6){if(_0x48825c){_0x48825c(null,_0x29f3d6);}})[_0xd6c4('0x2f')](function(_0x16b99e){if(_0x48825c){_0x48825c(null,_0x16b99e);}});}function setChannelVariables(_0xd7ea0c){for(var _0x3b03a8 in _0xd7ea0c){if(_0xd7ea0c['hasOwnProperty'](_0x3b03a8)){if(_0x3b03a8['indexOf']('agi_')===0x0){_0xd7ea0c[_0x3b03a8['substring'](0x4)]=_0xd7ea0c[_0x3b03a8];delete _0xd7ea0c[_0x3b03a8];}}}}function getLogFromObject(_0x53bf32){return util[_0xd6c4('0x31')](_0x53bf32,{'showHidden':![],'depth':null});}function agiHandler(_0x193aa9){var _0x413ef0,_0x4f89d5,_0x4c44eb,_0x230e01,_0x2e7785;logger[_0xd6c4('0x32')]('variables',JSON[_0xd6c4('0x33')](_0x193aa9,null,0x2));logger[_0xd6c4('0xf')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x193aa9[_0xd6c4('0x17')],_0x193aa9[_0xd6c4('0x18')],_0x193aa9[_0xd6c4('0x19')],_0x193aa9[_0xd6c4('0x1a')],_0x193aa9[_0xd6c4('0x1b')]));_0x193aa9['on']('error',errorHandler);_0x193aa9['on']('close',closeHandler);_0x193aa9['on'](_0xd6c4('0x34'),timeoutHandler);_0x193aa9['evtHangup']=![];_0x193aa9['on']('hangup',hangupHandler);var _0x1962bc=getSquareProject[_0xd6c4('0x35')](null,_0x193aa9[_0xd6c4('0x17')]);if(_0x1962bc){if(_0x1962bc['production']){_0x413ef0=getRoot(_0x1962bc[_0xd6c4('0x36')]);if(_0x413ef0&&_0x413ef0[_0xd6c4('0x37')]){logger[_0xd6c4('0x32')](_0xd6c4('0x38'),JSON['stringify'](_0x413ef0,null,0x2));_0x193aa9['joinAt']=moment()[_0xd6c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f89d5=initGraph(_['omit'](_0x413ef0,_0xd6c4('0x26')),_0x413ef0[_0xd6c4('0x26')]);_0x4c44eb=new Vertices(_0x193aa9,rpc,mailRpc);logger['info'](util[_0xd6c4('0x10')](_0xd6c4('0x39'),_0x193aa9['arg_1'],_0x193aa9[_0xd6c4('0x18')],_0x193aa9[_0xd6c4('0x19')],_0x193aa9[_0xd6c4('0x1a')],_0x193aa9['uniqueid']));_0x4f89d5[_0xd6c4('0x3a')](_0x413ef0[_0xd6c4('0x37')]['id'],function(_0x2bd340){try{_0x2bd340=_0x4c44eb[_0xd6c4('0x3b')](_0x2bd340);logger[_0xd6c4('0x32')]('vertex',JSON[_0xd6c4('0x33')](_0x2bd340,null,0x2));if(_0x2bd340[_0xd6c4('0x21')]==='gotoc'){logger[_0xd6c4('0xf')](_0xd6c4('0x3c'));_0x193aa9[_0xd6c4('0x3d')]=_0x2bd340[_0xd6c4('0x3d')]||_0x193aa9['context'];_0x193aa9[_0xd6c4('0x3e')]=_0x2bd340[_0xd6c4('0x3e')];_0x193aa9[_0xd6c4('0x3f')]=_0x2bd340[_0xd6c4('0x3f')]?_0x2bd340[_0xd6c4('0x3f')]-0x1:0x1;return null;}else if(_0x2bd340&&_0x4c44eb[_0x2bd340[_0xd6c4('0x21')]]){_0x2e7785=_0x4c44eb[_0x2bd340[_0xd6c4('0x21')]](_0x2bd340);logger[_0xd6c4('0xf')](_0xd6c4('0x40'),JSON['stringify'](_0x2e7785,null,0x2));if(_0x2e7785&&_0x2e7785[_0xd6c4('0x41')]===AGI_CODE_SUCCESS&&_0x2e7785[_0xd6c4('0x42')]!==AGI_RESULT_ERROR&&!_0x193aa9[_0xd6c4('0x1e')]){logger[_0xd6c4('0x32')](_0xd6c4('0x40'),getLogFromObject(_0x2e7785));return _[_0xd6c4('0x43')](_0x2e7785['result'])?null:_0x2e7785[_0xd6c4('0x42')][_0xd6c4('0x44')]();}else{logger[_0xd6c4('0xb')]('response',getLogFromObject(_0x2e7785));return null;}}else{logger[_0xd6c4('0xb')](_0xd6c4('0x45'));return null;}}catch(_0x2ef238){logger[_0xd6c4('0xb')](_0x2ef238[_0xd6c4('0x16')]);return null;}});if(_0x413ef0[_0xd6c4('0x46')]){logger[_0xd6c4('0xf')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x193aa9[_0xd6c4('0x17')],_0x193aa9[_0xd6c4('0x18')],_0x193aa9[_0xd6c4('0x19')],_0x193aa9[_0xd6c4('0x1a')],_0x193aa9[_0xd6c4('0x1b')]));_0x4f89d5['traverseBFS'](_0x413ef0['finally']['id'],function(_0x3ae45f){try{_0x3ae45f=_0x4c44eb['clear'](_0x3ae45f);logger[_0xd6c4('0x32')]('vertex',JSON[_0xd6c4('0x33')](_0x3ae45f,null,0x2));if(_0x3ae45f&&_0x4c44eb[_0x3ae45f['agicommand']]){_0x2e7785=_0x4c44eb[_0x3ae45f[_0xd6c4('0x21')]](_0x3ae45f);if(_0x2e7785){logger[_0xd6c4('0x32')](_0xd6c4('0x40'),getLogFromObject(_0x2e7785));return _['isUndefined'](_0x2e7785[_0xd6c4('0x42')])?null:_0x2e7785['result'][_0xd6c4('0x44')]();}else{logger[_0xd6c4('0xb')](_0xd6c4('0x40'),getLogFromObject(_0x2e7785));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4945e4){logger['error'](_0x4945e4['stack']);return null;}});}logger[_0xd6c4('0xf')](util[_0xd6c4('0x10')](_0xd6c4('0x47'),_0x193aa9[_0xd6c4('0x17')],_0x193aa9['calleridname'],_0x193aa9[_0xd6c4('0x19')],_0x193aa9[_0xd6c4('0x1a')],_0x193aa9[_0xd6c4('0x1b')]));logger[_0xd6c4('0xf')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x193aa9[_0xd6c4('0x3d')],_0x193aa9[_0xd6c4('0x3e')],parseInt(_0x193aa9['priority'],0xa)+0x1));_0x193aa9[_0xd6c4('0x48')](_0x193aa9['context'],_0x193aa9[_0xd6c4('0x3e')],parseInt(_0x193aa9[_0xd6c4('0x3f')],0xa)+0x1);_0x193aa9['close']();}}else{logger[_0xd6c4('0xb')](util['format'](_0xd6c4('0x49'),_0x193aa9['arg_1']));_0x193aa9[_0xd6c4('0x48')](_0x193aa9['context'],_0x193aa9[_0xd6c4('0x3e')],parseInt(_0x193aa9[_0xd6c4('0x3f')],0xa)+0x1);_0x193aa9[_0xd6c4('0x4a')]();}}else{logger[_0xd6c4('0xb')](util[_0xd6c4('0x10')](_0xd6c4('0x4b'),_0x193aa9[_0xd6c4('0x17')]));_0x193aa9[_0xd6c4('0x48')](_0x193aa9[_0xd6c4('0x3d')],_0x193aa9['extension'],parseInt(_0x193aa9[_0xd6c4('0x3f')],0xa)+0x1);_0x193aa9[_0xd6c4('0x4a')]();}}function main(){var _0x4a28fc;return utilLicense['getLicense']()[_0xd6c4('0x2e')](function(_0x495421){if(_0x495421){if(_0x495421[_0xd6c4('0x4c')]){if(_0x495421['callysquare']&&_0x495421[_0xd6c4('0x4d')]>0x0){logger[_0xd6c4('0xf')](util['format'](_0xd6c4('0x4e'),_0x495421['callysquare']));_0x4a28fc=_0x495421[_0xd6c4('0x4d')];}else{logger[_0xd6c4('0xf')](_0xd6c4('0x4f'));}}else{logger['info'](_0xd6c4('0x50'));_0x4a28fc=-0x1;}}})[_0xd6c4('0x2f')](function(_0x5847d6){logger[_0xd6c4('0xb')]('[LICENSE]',_0x5847d6[_0xd6c4('0x16')]);})[_0xd6c4('0x46')](function(){var _0x3726ff=require(_0xd6c4('0x51'))(config['agi'][_0xd6c4('0xe')],config[_0xd6c4('0x6')]['ip'],_0x4a28fc);_0x3726ff['on'](_0xd6c4('0xb'),errorHandler);_0x3726ff['on'](_0xd6c4('0x52'),listeningHandler);_0x3726ff['on'](_0xd6c4('0x53'),connectionHandler);_0x3726ff['on'](_0xd6c4('0x4a'),closeHandler);});}main(); \ No newline at end of file +var _0x02bc=['then','catch','createSquareReport','indexOf','inspect','debug','variables','close','timeout','hangup','sync','production','start','stringify','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','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','defaults','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','value','getSquareProject'];(function(_0x484204,_0x523532){var _0x995651=function(_0x4daf87){while(--_0x4daf87){_0x484204['push'](_0x484204['shift']());}};_0x995651(++_0x523532);}(_0x02bc,0x12f));var _0xc02b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x02bc[_0x5b644e];return _0x49c6bf;};'use strict';var parser=require(_0xc02b('0x0'));var _=require(_0xc02b('0x1'));var syncho=require('syncho');var util=require(_0xc02b('0x2'));var moment=require(_0xc02b('0x3'));var config=require(_0xc02b('0x4'));var logger=require(_0xc02b('0x5'))('agi');var utilLicense=require(_0xc02b('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xc02b('0x7'));var Graph=require(_0xc02b('0x8'));var Vertices=require(_0xc02b('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xc02b('0xa')]=_[_0xc02b('0xb')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x9e9678){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x9e9678);agiHandler(_0x9e9678);}catch(_0x5646aa){logger[_0xc02b('0xc')](_0x5646aa[_0xc02b('0xd')]);}});});}function listeningHandler(){console['log'](_0xc02b('0xe'),config[_0xc02b('0xa')][_0xc02b('0xf')]);logger[_0xc02b('0x10')](util[_0xc02b('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xc02b('0xa')]['ip'],config[_0xc02b('0xa')][_0xc02b('0xf')]));}function errorHandler(_0x3af7fe){if(_0x3af7fe&&_0x3af7fe[_0xc02b('0x12')]&&_0x3af7fe[_0xc02b('0x13')]){logger[_0xc02b('0xc')](util[_0xc02b('0x11')](_0xc02b('0x14'),_0x3af7fe[_0xc02b('0x12')],_0x3af7fe[_0xc02b('0x13')]));}else{logger[_0xc02b('0xc')](util[_0xc02b('0x11')](_0xc02b('0x15'),_0x3af7fe[_0xc02b('0xd')]));}}function closeHandler(){logger['info'](util[_0xc02b('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc02b('0x16')],this['calleridname'],this[_0xc02b('0x17')],this['dnid'],this[_0xc02b('0x18')]));try{createSquareReport(this);}catch(_0x36b846){logger[_0xc02b('0xc')](_0x36b846['stack']);}}function timeoutHandler(){logger[_0xc02b('0x10')](util[_0xc02b('0x11')](_0xc02b('0x19'),this[_0xc02b('0x16')],this['calleridname'],this[_0xc02b('0x17')],this[_0xc02b('0x1a')],this[_0xc02b('0x18')]));}function hangupHandler(){logger[_0xc02b('0x10')](util['format'](_0xc02b('0x1b'),this[_0xc02b('0x16')],this[_0xc02b('0x1c')],this[_0xc02b('0x17')],this[_0xc02b('0x1a')],this[_0xc02b('0x18')]));this[_0xc02b('0x1d')]=!![];}function getRoot(_0x3184d3){return parser[_0xc02b('0x1e')](_0x3184d3,{'object':!![]})[_0xc02b('0x1f')][_0xc02b('0x20')];}function addVertex(_0x5cbf44,_0x4c052c,_0x1ec8a8){_0x4c052c[_0xc02b('0x21')]=_0x1ec8a8;if(_0x4c052c[_0xc02b('0x22')](_0xc02b('0x23'))){_0x4c052c[_0xc02b('0x24')]=parseInt(_0x4c052c[_0xc02b('0x23')],0xa);}_0x5cbf44[_0xc02b('0x25')](_[_0xc02b('0x26')](_0x4c052c,_0xc02b('0x27')));}function initGraph(_0x1fc7da,_0x142dd2){var _0x1db95c=new Graph();for(var _0xe2f26a in _0x1fc7da){if(_0x1fc7da['hasOwnProperty'](_0xe2f26a)){if(_['isArray'](_0x1fc7da[_0xe2f26a])){for(var _0xbf788e=0x0;_0xbf788e<_0x1fc7da[_0xe2f26a][_0xc02b('0x28')];_0xbf788e+=0x1){addVertex(_0x1db95c,_0x1fc7da[_0xe2f26a][_0xbf788e],_0xe2f26a);}}else{addVertex(_0x1db95c,_0x1fc7da[_0xe2f26a],_0xe2f26a);}}}for(var _0x21e7a3=0x0;_0x21e7a3<_0x142dd2[_0xc02b('0x28')];_0x21e7a3+=0x1){if(_0x142dd2[_0x21e7a3][_0xc02b('0x29')]&&_0x142dd2[_0x21e7a3][_0xc02b('0x2a')]){_0x1db95c['addEdge'](_0x142dd2[_0x21e7a3][_0xc02b('0x29')],_0x142dd2[_0x21e7a3][_0xc02b('0x2a')],_0x142dd2[_0x21e7a3][_0xc02b('0x2b')]);}}return _0x1db95c;}function getSquareProject(_0x49d52d,_0x2d560b){rpc[_0xc02b('0x2c')](_0x49d52d)[_0xc02b('0x2d')](function(_0x3aaa2e){_0x2d560b(null,_0x3aaa2e);})[_0xc02b('0x2e')](function(_0x388ac0){_0x2d560b(null,_0x388ac0);});}function createSquareReport(_0x3a0fc7,_0x292c17){rpc[_0xc02b('0x2f')](_0x3a0fc7)['then'](function(_0x21ea8e){if(_0x292c17){_0x292c17(null,_0x21ea8e);}})[_0xc02b('0x2e')](function(_0x919cc9){if(_0x292c17){_0x292c17(null,_0x919cc9);}});}function setChannelVariables(_0x310f2a){for(var _0x316312 in _0x310f2a){if(_0x310f2a[_0xc02b('0x22')](_0x316312)){if(_0x316312[_0xc02b('0x30')]('agi_')===0x0){_0x310f2a[_0x316312['substring'](0x4)]=_0x310f2a[_0x316312];delete _0x310f2a[_0x316312];}}}}function getLogFromObject(_0x15f8ef){return util[_0xc02b('0x31')](_0x15f8ef,{'showHidden':![],'depth':null});}function agiHandler(_0x52c472){var _0x9308c0,_0x152723,_0x7b3adf,_0x2ad1e9,_0x1c19fd;logger[_0xc02b('0x32')](_0xc02b('0x33'),JSON['stringify'](_0x52c472,null,0x2));logger[_0xc02b('0x10')](util[_0xc02b('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x52c472[_0xc02b('0x16')],_0x52c472[_0xc02b('0x1c')],_0x52c472[_0xc02b('0x17')],_0x52c472[_0xc02b('0x1a')],_0x52c472[_0xc02b('0x18')]));_0x52c472['on']('error',errorHandler);_0x52c472['on'](_0xc02b('0x34'),closeHandler);_0x52c472['on'](_0xc02b('0x35'),timeoutHandler);_0x52c472[_0xc02b('0x1d')]=![];_0x52c472['on'](_0xc02b('0x36'),hangupHandler);var _0xcb08d0=getSquareProject[_0xc02b('0x37')](null,_0x52c472[_0xc02b('0x16')]);if(_0xcb08d0){if(_0xcb08d0[_0xc02b('0x38')]){_0x9308c0=getRoot(_0xcb08d0[_0xc02b('0x38')]);if(_0x9308c0&&_0x9308c0[_0xc02b('0x39')]){logger[_0xc02b('0x32')]('root',JSON[_0xc02b('0x3a')](_0x9308c0,null,0x2));_0x52c472['joinAt']=moment()['format'](_0xc02b('0x3b'));_0x152723=initGraph(_[_0xc02b('0x26')](_0x9308c0,_0xc02b('0x27')),_0x9308c0[_0xc02b('0x27')]);_0x7b3adf=new Vertices(_0x52c472,rpc,mailRpc);logger[_0xc02b('0x10')](util[_0xc02b('0x11')](_0xc02b('0x3c'),_0x52c472[_0xc02b('0x16')],_0x52c472[_0xc02b('0x1c')],_0x52c472['callerid'],_0x52c472[_0xc02b('0x1a')],_0x52c472[_0xc02b('0x18')]));_0x152723[_0xc02b('0x3d')](_0x9308c0[_0xc02b('0x39')]['id'],function(_0x2869bc){try{_0x2869bc=_0x7b3adf[_0xc02b('0x3e')](_0x2869bc);logger[_0xc02b('0x32')](_0xc02b('0x3f'),JSON[_0xc02b('0x3a')](_0x2869bc,null,0x2));if(_0x2869bc[_0xc02b('0x21')]==='gotoc'){logger[_0xc02b('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x52c472[_0xc02b('0x40')]=_0x2869bc['context']||_0x52c472[_0xc02b('0x40')];_0x52c472[_0xc02b('0x41')]=_0x2869bc[_0xc02b('0x41')];_0x52c472['priority']=_0x2869bc[_0xc02b('0x42')]?_0x2869bc[_0xc02b('0x42')]-0x1:0x1;return null;}else if(_0x2869bc&&_0x7b3adf[_0x2869bc['agicommand']]){_0x1c19fd=_0x7b3adf[_0x2869bc['agicommand']](_0x2869bc);logger['info'](_0xc02b('0x43'),JSON[_0xc02b('0x3a')](_0x1c19fd,null,0x2));if(_0x1c19fd&&_0x1c19fd[_0xc02b('0x44')]===AGI_CODE_SUCCESS&&_0x1c19fd[_0xc02b('0x45')]!==AGI_RESULT_ERROR&&!_0x52c472[_0xc02b('0x1d')]){logger['debug'](_0xc02b('0x43'),getLogFromObject(_0x1c19fd));return _[_0xc02b('0x46')](_0x1c19fd['result'])?null:_0x1c19fd['result'][_0xc02b('0x47')]();}else{logger[_0xc02b('0xc')]('response',getLogFromObject(_0x1c19fd));return null;}}else{logger[_0xc02b('0xc')](_0xc02b('0x48'));return null;}}catch(_0x49e294){logger['error'](_0x49e294[_0xc02b('0xd')]);return null;}});if(_0x9308c0[_0xc02b('0x49')]){logger[_0xc02b('0x10')](util[_0xc02b('0x11')](_0xc02b('0x4a'),_0x52c472['arg_1'],_0x52c472[_0xc02b('0x1c')],_0x52c472[_0xc02b('0x17')],_0x52c472['dnid'],_0x52c472['uniqueid']));_0x152723[_0xc02b('0x3d')](_0x9308c0[_0xc02b('0x49')]['id'],function(_0x4eb991){try{_0x4eb991=_0x7b3adf[_0xc02b('0x3e')](_0x4eb991);logger[_0xc02b('0x32')](_0xc02b('0x3f'),JSON[_0xc02b('0x3a')](_0x4eb991,null,0x2));if(_0x4eb991&&_0x7b3adf[_0x4eb991['agicommand']]){_0x1c19fd=_0x7b3adf[_0x4eb991[_0xc02b('0x21')]](_0x4eb991);if(_0x1c19fd){logger[_0xc02b('0x32')]('response',getLogFromObject(_0x1c19fd));return _[_0xc02b('0x46')](_0x1c19fd['result'])?null:_0x1c19fd[_0xc02b('0x45')][_0xc02b('0x47')]();}else{logger['error'](_0xc02b('0x43'),getLogFromObject(_0x1c19fd));return null;}}else{logger[_0xc02b('0xc')](_0xc02b('0x48'));return null;}}catch(_0x400ea2){logger[_0xc02b('0xc')](_0x400ea2[_0xc02b('0xd')]);return null;}});}logger[_0xc02b('0x10')](util[_0xc02b('0x11')](_0xc02b('0x4b'),_0x52c472['arg_1'],_0x52c472[_0xc02b('0x1c')],_0x52c472[_0xc02b('0x17')],_0x52c472[_0xc02b('0x1a')],_0x52c472[_0xc02b('0x18')]));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x52c472[_0xc02b('0x40')],_0x52c472[_0xc02b('0x41')],parseInt(_0x52c472[_0xc02b('0x42')],0xa)+0x1));_0x52c472[_0xc02b('0x4c')](_0x52c472[_0xc02b('0x40')],_0x52c472[_0xc02b('0x41')],parseInt(_0x52c472[_0xc02b('0x42')],0xa)+0x1);_0x52c472[_0xc02b('0x34')]();}}else{logger[_0xc02b('0xc')](util[_0xc02b('0x11')]('Project\x20%s\x20not\x20published',_0x52c472[_0xc02b('0x16')]));_0x52c472[_0xc02b('0x4c')](_0x52c472[_0xc02b('0x40')],_0x52c472[_0xc02b('0x41')],parseInt(_0x52c472[_0xc02b('0x42')],0xa)+0x1);_0x52c472[_0xc02b('0x34')]();}}else{logger[_0xc02b('0xc')](util[_0xc02b('0x11')](_0xc02b('0x4d'),_0x52c472[_0xc02b('0x16')]));_0x52c472[_0xc02b('0x4c')](_0x52c472['context'],_0x52c472[_0xc02b('0x41')],parseInt(_0x52c472[_0xc02b('0x42')],0xa)+0x1);_0x52c472[_0xc02b('0x34')]();}}function main(){var _0x133f7c;return utilLicense[_0xc02b('0x4e')]()[_0xc02b('0x2d')](function(_0x33c4f1){if(_0x33c4f1){if(_0x33c4f1[_0xc02b('0x4f')]){if(_0x33c4f1[_0xc02b('0x50')]&&_0x33c4f1[_0xc02b('0x50')]>0x0){logger[_0xc02b('0x10')](util[_0xc02b('0x11')](_0xc02b('0x51'),_0x33c4f1['callysquare']));_0x133f7c=_0x33c4f1[_0xc02b('0x50')];}else{logger[_0xc02b('0x10')](_0xc02b('0x52'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x133f7c=-0x1;}}})[_0xc02b('0x2e')](function(_0x444e43){logger['error'](_0xc02b('0x53'),_0x444e43['stack']);})[_0xc02b('0x49')](function(){var _0x48bd7f=require(_0xc02b('0x54'))(config[_0xc02b('0xa')][_0xc02b('0xf')],config[_0xc02b('0xa')]['ip'],_0x133f7c);_0x48bd7f['on']('error',errorHandler);_0x48bd7f['on'](_0xc02b('0x55'),listeningHandler);_0x48bd7f['on'](_0xc02b('0x56'),connectionHandler);_0x48bd7f['on'](_0xc02b('0x34'),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 a2ae511..495c034 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 _0xca74=['sendMailMessage','SendMail','bluebird','jayson/promise','request','then','error','message','result','catch'];(function(_0x3f560e,_0x289aa8){var _0x5bf213=function(_0xcc2f71){while(--_0xcc2f71){_0x3f560e['push'](_0x3f560e['shift']());}};_0x5bf213(++_0x289aa8);}(_0xca74,0x16a));var _0x4ca7=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xca74[_0x5cc8];return _0x450661;};'use strict';var BPromise=require(_0x4ca7('0x0'));var jayson=require(_0x4ca7('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x43a1ad,_0x39f77f){return new BPromise(function(_0x156057,_0x361786){return client[_0x4ca7('0x2')](_0x43a1ad,_0x39f77f)[_0x4ca7('0x3')](function(_0x348038){if(_0x348038['error']){return _0x361786(_0x348038[_0x4ca7('0x4')][_0x4ca7('0x5')]);}else{return _0x156057(_0x348038[_0x4ca7('0x6')]);}})[_0x4ca7('0x7')](function(_0x1c0875){return _0x361786(_0x1c0875);});});}exports[_0x4ca7('0x8')]=function(_0x4e1683,_0x3c1bbc){return request(_0x4ca7('0x9'),{'account':_0x4e1683,'message':_0x3c1bbc});}; \ No newline at end of file +var _0xb3f8=['sendMailMessage','SendMail','bluebird','jayson/promise','request','then','error','result','catch'];(function(_0x5d14ad,_0x2d17b9){var _0x5cb422=function(_0xd4b2bb){while(--_0xd4b2bb){_0x5d14ad['push'](_0x5d14ad['shift']());}};_0x5cb422(++_0x2d17b9);}(_0xb3f8,0xbf));var _0x8b3f=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0xb3f8[_0x557f5f];return _0x196eba;};'use strict';var BPromise=require(_0x8b3f('0x0'));var jayson=require(_0x8b3f('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x43c4e7,_0x719863){return new BPromise(function(_0x1d34d6,_0x2772c3){return client[_0x8b3f('0x2')](_0x43c4e7,_0x719863)[_0x8b3f('0x3')](function(_0x219110){if(_0x219110[_0x8b3f('0x4')]){return _0x2772c3(_0x219110[_0x8b3f('0x4')]['message']);}else{return _0x1d34d6(_0x219110[_0x8b3f('0x5')]);}})[_0x8b3f('0x6')](function(_0x5dd42b){return _0x2772c3(_0x5dd42b);});});}exports[_0x8b3f('0x7')]=function(_0xc12a55,_0x32266f){return request(_0x8b3f('0x8'),{'account':_0xc12a55,'message':_0x32266f});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index f4f0bef..10d4348 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 _0x64bb=['substring','length','split','slice','trim','emit','headers','line','exports','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf'];(function(_0x4eff6e,_0x3d7887){var _0x5ec73a=function(_0x362bc7){while(--_0x362bc7){_0x4eff6e['push'](_0x4eff6e['shift']());}};_0x5ec73a(++_0x3d7887);}(_0x64bb,0x68));var _0xb64b=function(_0x265c7c,_0x3015c3){_0x265c7c=_0x265c7c-0x0;var _0x82de42=_0x64bb[_0x265c7c];return _0x82de42;};'use strict';var util=require('util');var Transform=require(_0xb64b('0x0'))[_0xb64b('0x1')];function AGIReply(_0x4d9cc5){Transform[_0xb64b('0x2')](this,_0x4d9cc5);this[_0xb64b('0x3')]='';this[_0xb64b('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xb64b('0x5')][_0xb64b('0x6')]=function(_0x453361,_0x3915c9,_0xbdfca9){var _0x1b2873='\x0a',_0x2acae4=['\x0a\x0a',_0xb64b('0x7')],_0xeedfc2=-0x1,_0x35bd4d=-0x1,_0x3fed6e='',_0x21b2f7=0x0,_0x4ee418='',_0x13f73b='';this[_0xb64b('0x3')]+=_0x453361[_0xb64b('0x8')]();_0x4ee418=this['_localBuffer'];if(!this['_inBody']){_0x21b2f7=0x0;while(_0x2acae4[_0x21b2f7]){while((_0x35bd4d=_0x4ee418[_0xb64b('0x9')](_0x2acae4[_0x21b2f7]))!=-0x1){_0x3fed6e=_0x2acae4[_0x21b2f7];_0x13f73b=_0x4ee418['substring'](0x0,_0x35bd4d);_0x4ee418=_0x4ee418[_0xb64b('0xa')](_0x35bd4d+_0x3fed6e[_0xb64b('0xb')]);var _0x24c4d7=_0x13f73b[_0xb64b('0xc')](_0x1b2873),_0x134a5a=0x0,_0x38f2c4={},_0x1deaa9='',_0x372c97='',_0x27b541=-0x1;while(_0x24c4d7[_0x134a5a]){_0x27b541=_0x24c4d7[_0x134a5a][_0xb64b('0x9')](':');if(_0x27b541!=-0x1){_0x1deaa9=_0x24c4d7[_0x134a5a][_0xb64b('0xd')](0x0,_0x27b541)[_0xb64b('0xe')]();_0x372c97=_0x24c4d7[_0x134a5a][_0xb64b('0xd')](_0x27b541+0x1)[_0xb64b('0xe')]();if(_0x1deaa9[_0xb64b('0xb')]>0x0){_0x38f2c4[_0x1deaa9]=_0x372c97;}}else{}_0x134a5a++;}this[_0xb64b('0xf')](_0xb64b('0x10'),_0x38f2c4);this[_0xb64b('0x4')]=!![];}_0x21b2f7++;}this['_localBuffer']=_0x4ee418;}else{while((_0xeedfc2=_0x4ee418['indexOf'](_0x1b2873))!=-0x1){_0x13f73b=_0x4ee418[_0xb64b('0xa')](0x0,_0xeedfc2);this[_0xb64b('0xf')](_0xb64b('0x11'),_0x13f73b);_0x4ee418=_0x4ee418[_0xb64b('0xa')](_0xeedfc2+_0x1b2873[_0xb64b('0xb')]);}this[_0xb64b('0x3')]=_0x4ee418;}_0xbdfca9();};module[_0xb64b('0x12')]=AGIReply; \ No newline at end of file +var _0x3c29=['trim','slice','headers','emit','line','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','substring','length','indexOf'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x3c29,0x16d));var _0x93c2=function(_0x1697b4,_0x309e18){_0x1697b4=_0x1697b4-0x0;var _0x77abf=_0x3c29[_0x1697b4];return _0x77abf;};'use strict';var util=require(_0x93c2('0x0'));var Transform=require(_0x93c2('0x1'))[_0x93c2('0x2')];function AGIReply(_0x494e7f){Transform[_0x93c2('0x3')](this,_0x494e7f);this[_0x93c2('0x4')]='';this[_0x93c2('0x5')]=![];}util[_0x93c2('0x6')](AGIReply,Transform);AGIReply[_0x93c2('0x7')][_0x93c2('0x8')]=function(_0x23df00,_0x4b26e2,_0x3d19e0){var _0x2d34ef='\x0a',_0x5b0dd9=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x2288b3=-0x1,_0x109207=-0x1,_0x1ccb5a='',_0x53f857=0x0,_0x5ebbeb='',_0x3aa0b8='';this['_localBuffer']+=_0x23df00[_0x93c2('0x9')]();_0x5ebbeb=this[_0x93c2('0x4')];if(!this[_0x93c2('0x5')]){_0x53f857=0x0;while(_0x5b0dd9[_0x53f857]){while((_0x109207=_0x5ebbeb['indexOf'](_0x5b0dd9[_0x53f857]))!=-0x1){_0x1ccb5a=_0x5b0dd9[_0x53f857];_0x3aa0b8=_0x5ebbeb[_0x93c2('0xa')](0x0,_0x109207);_0x5ebbeb=_0x5ebbeb[_0x93c2('0xa')](_0x109207+_0x1ccb5a[_0x93c2('0xb')]);var _0x23dc95=_0x3aa0b8['split'](_0x2d34ef),_0x221f42=0x0,_0x50467b={},_0x2a937c='',_0x19fd2e='',_0x311ab7=-0x1;while(_0x23dc95[_0x221f42]){_0x311ab7=_0x23dc95[_0x221f42][_0x93c2('0xc')](':');if(_0x311ab7!=-0x1){_0x2a937c=_0x23dc95[_0x221f42]['slice'](0x0,_0x311ab7)[_0x93c2('0xd')]();_0x19fd2e=_0x23dc95[_0x221f42][_0x93c2('0xe')](_0x311ab7+0x1)[_0x93c2('0xd')]();if(_0x2a937c[_0x93c2('0xb')]>0x0){_0x50467b[_0x2a937c]=_0x19fd2e;}}else{}_0x221f42++;}this['emit'](_0x93c2('0xf'),_0x50467b);this[_0x93c2('0x5')]=!![];}_0x53f857++;}this['_localBuffer']=_0x5ebbeb;}else{while((_0x2288b3=_0x5ebbeb[_0x93c2('0xc')](_0x2d34ef))!=-0x1){_0x3aa0b8=_0x5ebbeb['substring'](0x0,_0x2288b3);this[_0x93c2('0x10')](_0x93c2('0x11'),_0x3aa0b8);_0x5ebbeb=_0x5ebbeb['substring'](_0x2288b3+_0x2d34ef[_0x93c2('0xb')]);}this[_0x93c2('0x4')]=_0x5ebbeb;}_0x3d19e0();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7d35eb1..038e0bb 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 _0x7c79=['ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById'];(function(_0x3291b8,_0x33b4d1){var _0x373e1e=function(_0x5ea3ed){while(--_0x5ea3ed){_0x3291b8['push'](_0x3291b8['shift']());}};_0x373e1e(++_0x33b4d1);}(_0x7c79,0x9e));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x97c7('0x0'));var moment=require(_0x97c7('0x1'));var _=require(_0x97c7('0x2'));var util=require(_0x97c7('0x3'));var jayson=require(_0x97c7('0x4'));var client=jayson[_0x97c7('0x5')][_0x97c7('0x6')]({'port':0x2329});function request(_0x133c07,_0x3407b1){return new BPromise(function(_0x3ac3f0,_0xe30454){return client[_0x97c7('0x7')](_0x133c07,_0x3407b1)['then'](function(_0x213e8b){if(_0x213e8b['error']){return _0xe30454(_0x213e8b[_0x97c7('0x8')][_0x97c7('0x9')]);}else{return _0x3ac3f0(_0x213e8b[_0x97c7('0xa')]);}})[_0x97c7('0xb')](function(_0x5edb2a){return _0xe30454(_0x5edb2a);});});}exports[_0x97c7('0xc')]=function(_0x55beac){return request(_0x97c7('0xd'),{'options':{'raw':![],'where':{'name':_0x55beac},'attributes':[_0x97c7('0xe')]}});};exports[_0x97c7('0xf')]=function(_0x2edc3d){return request(_0x97c7('0x10'),{'options':{'raw':![],'where':{'id':_0x2edc3d},'include':[{'model':_0x97c7('0x11'),'as':_0x97c7('0x12')}],'attributes':['id',_0x97c7('0x13'),'email']}});};exports[_0x97c7('0x14')]=function(_0x5dbec9){return request('ShowSquareProject',{'options':{'where':{'id':_0x5dbec9},'attributes':[_0x97c7('0x13')]}});};exports[_0x97c7('0x15')]=function(_0x38ff6a){return request(_0x97c7('0x16'),{'options':{'where':{'id':_0x38ff6a},'attributes':['name']}});};exports[_0x97c7('0x17')]=function(_0x52ef0a){return request('ShowVariable',{'options':{'where':{'id':_0x52ef0a},'attributes':[_0x97c7('0x13')]}});};exports[_0x97c7('0x18')]=function(_0x26f7aa){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x26f7aa},'attributes':['dsn']}});};exports['getUserById']=function(_0x2a1425){return request(_0x97c7('0x19'),{'options':{'where':{'id':_0x2a1425},'attributes':[_0x97c7('0x13')]}});};exports[_0x97c7('0x1a')]=function(_0x30e5bb){return request(_0x97c7('0x1b'),{'options':{'where':{'id':_0x30e5bb},'attributes':['name']}});};exports[_0x97c7('0x1c')]=function(_0x2f6d3d){return request(_0x97c7('0x1d'),{'options':{'where':{'id':_0x2f6d3d},'attributes':[_0x97c7('0x1e')]}});};exports['getIntervalById']=function(_0x22f50c){return request(_0x97c7('0x1f'),{'options':{'raw':![],'where':{'id':_0x22f50c},'include':[{'model':_0x97c7('0x20'),'as':_0x97c7('0x21')}]}});};exports[_0x97c7('0x22')]=function(_0x9daaa5){return request(_0x97c7('0x23'),{'options':{'where':{'id':_0x9daaa5},'attributes':['id',_0x97c7('0x13')]}});};exports[_0x97c7('0x24')]=function(_0x4e2c6f){return request(_0x97c7('0x25'),{'body':_0x4e2c6f});};exports[_0x97c7('0x26')]=function(_0x530f4e){return request(_0x97c7('0x27'),{'body':_0x530f4e});};exports['createSquareReport']=function(_0x19afa0){return request(_0x97c7('0x28'),{'body':_['merge'](_0x19afa0,{'project_name':_0x19afa0[_0x97c7('0x29')],'prev_project_name':_0x19afa0[_0x97c7('0x2a')]||'','is_subproject':_0x19afa0[_0x97c7('0x2a')]?!![]:![],'leaveAt':moment()[_0x97c7('0x2b')](_0x97c7('0x2c'))})});};exports[_0x97c7('0x2d')]=function(_0xeeceda){return request('CreateSquareRecording',{'body':_0xeeceda});};exports['createSquareMessage']=function(_0x318bf1){return request('CreateSquareMessage',{'body':_0x318bf1});};exports[_0x97c7('0x2e')]=function(_0x43fa16){return request(_0x97c7('0x2f'),{'options':{'raw':![],'where':{'phone':_0x43fa16['phone'],'ListId':_0x43fa16[_0x97c7('0x30')]}}})[_0x97c7('0x31')](function(_0x5a038c){if(_0x5a038c){return _0x5a038c;}return request(_0x97c7('0x32'),{'body':_0x43fa16});});};exports[_0x97c7('0x33')]=function(_0x27c458){return request(_0x97c7('0x34'),{'options':{'where':{'id':_0x27c458},'attributes':[_0x97c7('0x13')]}});};exports[_0x97c7('0x35')]=function(_0x17b888,_0x3d4783){return request(_0x97c7('0x36'),{'body':{'interface':_0x3d4783},'options':{'where':_0x17b888}});};exports[_0x97c7('0x37')]=function(_0x322d3f,_0x16e569,_0x1468ed){return request(_0x97c7('0x38'),{'body':{'type':_0x16e569,'uniqueid':_0x1468ed},'options':{'where':_0x322d3f}});};exports[_0x97c7('0x39')]=function(_0x21675f){return request(_0x97c7('0x3a'),{'body':{},'options':{'where':_0x21675f}});};exports[_0x97c7('0x3b')]=function(_0x55040e){return request(_0x97c7('0x3c'),{'body':{},'options':{'where':_0x55040e}});}; \ No newline at end of file +var _0xb703=['CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','then','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','util','jayson/promise','client','http','error','catch','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x3d3590,_0x23bd12){var _0x1348ff=function(_0x26a61a){while(--_0x26a61a){_0x3d3590['push'](_0x3d3590['shift']());}};_0x1348ff(++_0x23bd12);}(_0xb703,0x14b));var _0x3b70=function(_0x2b68a9,_0x3a643d){_0x2b68a9=_0x2b68a9-0x0;var _0x1ca40a=_0xb703[_0x2b68a9];return _0x1ca40a;};'use strict';var BPromise=require('bluebird');var moment=require(_0x3b70('0x0'));var _=require('lodash');var util=require(_0x3b70('0x1'));var jayson=require(_0x3b70('0x2'));var client=jayson[_0x3b70('0x3')][_0x3b70('0x4')]({'port':0x2329});function request(_0x169831,_0x314a06){return new BPromise(function(_0x26c2cd,_0x5a3660){return client['request'](_0x169831,_0x314a06)['then'](function(_0x1d56e7){if(_0x1d56e7['error']){return _0x5a3660(_0x1d56e7[_0x3b70('0x5')]['message']);}else{return _0x26c2cd(_0x1d56e7['result']);}})[_0x3b70('0x6')](function(_0xa3abb8){return _0x5a3660(_0xa3abb8);});});}exports['getSquareProject']=function(_0x130cb9){return request(_0x3b70('0x7'),{'options':{'raw':![],'where':{'name':_0x130cb9},'attributes':['production']}});};exports[_0x3b70('0x8')]=function(_0x48b033){return request(_0x3b70('0x9'),{'options':{'raw':![],'where':{'id':_0x48b033},'include':[{'model':'MailServerOut','as':_0x3b70('0xa')}],'attributes':['id',_0x3b70('0xb'),_0x3b70('0xc')]}});};exports[_0x3b70('0xd')]=function(_0x3bd87e){return request('ShowSquareProject',{'options':{'where':{'id':_0x3bd87e},'attributes':['name']}});};exports[_0x3b70('0xe')]=function(_0x34355d){return request(_0x3b70('0xf'),{'options':{'where':{'id':_0x34355d},'attributes':[_0x3b70('0xb')]}});};exports['getVariableById']=function(_0x2e6fcb){return request(_0x3b70('0x10'),{'options':{'where':{'id':_0x2e6fcb},'attributes':[_0x3b70('0xb')]}});};exports[_0x3b70('0x11')]=function(_0x2646d1){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2646d1},'attributes':[_0x3b70('0x12')]}});};exports[_0x3b70('0x13')]=function(_0x5c32cb){return request(_0x3b70('0x14'),{'options':{'where':{'id':_0x5c32cb},'attributes':['name']}});};exports['getTrunkById']=function(_0x19c373){return request(_0x3b70('0x15'),{'options':{'where':{'id':_0x19c373},'attributes':[_0x3b70('0xb')]}});};exports[_0x3b70('0x16')]=function(_0x8d2b83){return request('ShowSound',{'options':{'where':{'id':_0x8d2b83},'attributes':[_0x3b70('0x17')]}});};exports[_0x3b70('0x18')]=function(_0x5d77cb){return request(_0x3b70('0x19'),{'options':{'raw':![],'where':{'id':_0x5d77cb},'include':[{'model':_0x3b70('0x1a'),'as':_0x3b70('0x1b')}]}});};exports[_0x3b70('0x1c')]=function(_0x34b42a){return request('ShowSmsAccount',{'options':{'where':{'id':_0x34b42a},'attributes':['id',_0x3b70('0xb')]}});};exports[_0x3b70('0x1d')]=function(_0xc1139e){return request('CreateSmsMessage',{'body':_0xc1139e});};exports[_0x3b70('0x1e')]=function(_0x55fa13){return request(_0x3b70('0x1f'),{'body':_0x55fa13});};exports[_0x3b70('0x20')]=function(_0x3972ed){return request(_0x3b70('0x21'),{'body':_['merge'](_0x3972ed,{'project_name':_0x3972ed[_0x3b70('0x22')],'prev_project_name':_0x3972ed[_0x3b70('0x23')]||'','is_subproject':_0x3972ed['arg_2']?!![]:![],'leaveAt':moment()[_0x3b70('0x24')](_0x3b70('0x25'))})});};exports[_0x3b70('0x26')]=function(_0x4c48be){return request(_0x3b70('0x27'),{'body':_0x4c48be});};exports['createSquareMessage']=function(_0x4eca03){return request(_0x3b70('0x28'),{'body':_0x4eca03});};exports[_0x3b70('0x29')]=function(_0x651ff2){return request(_0x3b70('0x2a'),{'options':{'raw':![],'where':{'phone':_0x651ff2['phone'],'ListId':_0x651ff2['ListId']}}})[_0x3b70('0x2b')](function(_0x457b80){if(_0x457b80){return _0x457b80;}return request(_0x3b70('0x2c'),{'body':_0x651ff2});});};exports[_0x3b70('0x2d')]=function(_0x400318){return request('ShowPause',{'options':{'where':{'id':_0x400318},'attributes':[_0x3b70('0xb')]}});};exports['agentLogin']=function(_0x5004d9,_0x5ca165){return request(_0x3b70('0x2e'),{'body':{'interface':_0x5ca165},'options':{'where':_0x5004d9}});};exports[_0x3b70('0x2f')]=function(_0x4d9078,_0x5da86a,_0x2b068c){return request(_0x3b70('0x30'),{'body':{'type':_0x5da86a,'uniqueid':_0x2b068c},'options':{'where':_0x4d9078}});};exports[_0x3b70('0x31')]=function(_0x2507ec){return request('UnpauseUser',{'body':{},'options':{'where':_0x2507ec}});};exports[_0x3b70('0x32')]=function(_0x1bd017){return request(_0x3b70('0x33'),{'body':{},'options':{'where':_0x1bd017}});}; \ 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 6762e98..bbca836 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 _0x24ce=['./lex','exports'];(function(_0xb19a9c,_0xde49b5){var _0xb4cc3a=function(_0x4769ae){while(--_0x4769ae){_0xb19a9c['push'](_0xb19a9c['shift']());}};_0xb4cc3a(++_0xde49b5);}(_0x24ce,0x1de));var _0xe24c=function(_0x536781,_0x1c417c){_0x536781=_0x536781-0x0;var _0x3c848c=_0x24ce[_0x536781];return _0x3c848c;};var polly=require('./polly');var lex=require(_0xe24c('0x0'));module[_0xe24c('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x56da=['exports','./polly'];(function(_0x5c25f7,_0x3a69dc){var _0x1d51d1=function(_0x284c00){while(--_0x284c00){_0x5c25f7['push'](_0x5c25f7['shift']());}};_0x1d51d1(++_0x3a69dc);}(_0x56da,0x119));var _0xa56d=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x56da[_0x53e3de];return _0x7b905b;};var polly=require(_0xa56d('0x0'));var lex=require('./lex');module[_0xa56d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index d9412a9..2af0ec3 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 _0x4ea3=['./lib/api','exports'];(function(_0x583cfa,_0x5dd458){var _0x47fd2b=function(_0x1cbaea){while(--_0x1cbaea){_0x583cfa['push'](_0x583cfa['shift']());}};_0x47fd2b(++_0x5dd458);}(_0x4ea3,0x70));var _0x34ea=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4ea3[_0x618414];return _0x21c19a;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ No newline at end of file +var _0xbdb7=['./lib/api','exports'];(function(_0x202eec,_0xfd0015){var _0x9f95ad=function(_0x39d14f){while(--_0x39d14f){_0x202eec['push'](_0x202eec['shift']());}};_0x9f95ad(++_0xfd0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0xbdb7[_0x27bd2c];return _0x3784ea;};'use strict';var lex=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]=function(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07){return lex(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07);}; \ 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 e50e9c4..f9c7e81 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(_0x12b77d,_0x27509f){var _0x5e924e=function(_0x3c7724){while(--_0x3c7724){_0x12b77d['push'](_0x12b77d['shift']());}};_0x5e924e(++_0x27509f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x5a815e,_0x24ccb6){var _0x40cf45=function(_0x304ce3){while(--_0x304ce3){_0x5a815e['push'](_0x5a815e['shift']());}};_0x40cf45(++_0x24ccb6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 88de8ea..2fe3fa9 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 _0xac85=['./lib/api'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xac85,0x143));var _0x5ac8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac85[_0x3dd15e];return _0x231fd0;};'use strict';var polly=require(_0x5ac8('0x0'));module['exports']=function(_0x4ed3a3,_0x4b55ed,_0x3b246e,_0x2f71a6,_0x45f185,_0x540ec3,_0x3bffac){return polly(_0x4ed3a3,_0x4b55ed,_0x3b246e,_0x2f71a6,_0x45f185,_0x540ec3,_0x3bffac);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x184122,_0x4766fb,_0x139c39,_0x3614b6,_0x22036f,_0x3c46fd,_0x44b1dd){return polly(_0x184122,_0x4766fb,_0x139c39,_0x3614b6,_0x22036f,_0x3c46fd,_0x44b1dd);}; \ 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 226a58c..92e112e 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 _0x6b1b=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b1b,0x103));var _0xb6b1=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x6b1b[_0x1c546c];return _0x2cc384;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xb6b1('0x0'));var rs=require(_0xb6b1('0x1'));var AWS=require(_0xb6b1('0x2'));function pollyResult(_0x532096,_0x155383,_0x2c2117){return new BPromise(function(_0x1c5683,_0x4f60cc){_0x532096[_0xb6b1('0x3')](_0x155383,function(_0x4bc876,_0x215646){if(_0x4bc876){_0x4f60cc(_0x4bc876);}else if(_0x215646){if(_0x215646[_0xb6b1('0x4')]instanceof Buffer){fs['writeFile'](_0x2c2117,_0x215646['AudioStream'],function(_0xb2145b){if(_0xb2145b){_0x4f60cc(_0xb2145b);}else{_0x1c5683();}});}else{_0x4f60cc(new Error(_0xb6b1('0x5')));}}else{_0x4f60cc(new Error(_0xb6b1('0x6')));}});});}module[_0xb6b1('0x7')]=function(_0x149a69,_0x58517d,_0x5e6cd4,_0x3f959a,_0x5b9346,_0xc938b1,_0x459c06){var _0x2cf744=new AWS[(_0xb6b1('0x8'))]({'accessKeyId':_0x149a69,'secretAccessKey':_0x58517d,'region':_0x5e6cd4});var _0x4d32c2={'Text':_0x5b9346,'TextType':_0xc938b1||_0xb6b1('0x9'),'OutputFormat':'mp3','VoiceId':_0x3f959a};return pollyResult(_0x2cf744,_0x4d32c2,_0x459c06);}; \ No newline at end of file +var _0xdd38=['text','mp3','path','bluebird','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x328356,_0x491a3e){var _0x52881f=function(_0x181691){while(--_0x181691){_0x328356['push'](_0x328356['shift']());}};_0x52881f(++_0x491a3e);}(_0xdd38,0x188));var _0x8dd3=function(_0x120900,_0x1b16c7){_0x120900=_0x120900-0x0;var _0x356528=_0xdd38[_0x120900];return _0x356528;};'use strict';var fs=require('fs');var path=require(_0x8dd3('0x0'));var BPromise=require(_0x8dd3('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x17cf0e,_0x2b3c05,_0x4c6613){return new BPromise(function(_0x1097b4,_0x2fadc7){_0x17cf0e[_0x8dd3('0x2')](_0x2b3c05,function(_0x46626d,_0x14b82e){if(_0x46626d){_0x2fadc7(_0x46626d);}else if(_0x14b82e){if(_0x14b82e[_0x8dd3('0x3')]instanceof Buffer){fs[_0x8dd3('0x4')](_0x4c6613,_0x14b82e[_0x8dd3('0x3')],function(_0x5731e5){if(_0x5731e5){_0x2fadc7(_0x5731e5);}else{_0x1097b4();}});}else{_0x2fadc7(new Error(_0x8dd3('0x5')));}}else{_0x2fadc7(new Error(_0x8dd3('0x6')));}});});}module['exports']=function(_0x4838d1,_0x6ea251,_0x17ab90,_0x1e9a3d,_0x3aad1a,_0x12c417,_0x542beb){var _0x163677=new AWS[(_0x8dd3('0x7'))]({'accessKeyId':_0x4838d1,'secretAccessKey':_0x6ea251,'region':_0x17ab90});var _0x4598ba={'Text':_0x3aad1a,'TextType':_0x12c417||_0x8dd3('0x8'),'OutputFormat':_0x8dd3('0x9'),'VoiceId':_0x1e9a3d};return pollyResult(_0x163677,_0x4598ba,_0x542beb);}; \ 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 2d0d201..a1c5b25 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ef6=['./lib/api','exports'];(function(_0x4e4dc4,_0x3d84f9){var _0x5957ec=function(_0x37d8f4){while(--_0x37d8f4){_0x4e4dc4['push'](_0x4e4dc4['shift']());}};_0x5957ec(++_0x3d84f9);}(_0x4ef6,0xc2));var _0x64ef=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x4ef6[_0x2307fa];return _0x496486;};'use strict';var asr=require(_0x64ef('0x0'));module[_0x64ef('0x1')]=function(_0x15adaf,_0x22a023,_0x557a36,_0x47a3bb){return asr(_0x15adaf,_0x22a023,_0x557a36);}; \ No newline at end of file +var _0x2b20=['./lib/api','exports'];(function(_0x411d44,_0x279702){var _0x19dd4d=function(_0x1175e2){while(--_0x1175e2){_0x411d44['push'](_0x411d44['shift']());}};_0x19dd4d(++_0x279702);}(_0x2b20,0x14c));var _0x02b2=function(_0x46b9a8,_0x1a8d70){_0x46b9a8=_0x46b9a8-0x0;var _0xe34fb3=_0x2b20[_0x46b9a8];return _0xe34fb3;};'use strict';var asr=require(_0x02b2('0x0'));module[_0x02b2('0x1')]=function(_0x59d92b,_0x3f40a0,_0x21613d,_0x2366b2){return asr(_0x59d92b,_0x3f40a0,_0x21613d);}; \ 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 b6d91ac..a2b9ba6 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 _0xe2cc=['8000','url','bluebird','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x12088e,_0x3d7400){var _0x490314=function(_0x267553){while(--_0x267553){_0x12088e['push'](_0x12088e['shift']());}};_0x490314(++_0x3d7400);}(_0xe2cc,0x69));var _0xce2c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe2cc[_0x4cf98e];return _0x1623ac;};'use strict';var url=require(_0xce2c('0x0'));var BPromise=require(_0xce2c('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x3e19dc,_0x1e5b84,_0x2279d5){return new BPromise(function(_0x15fe3c,_0x25e41a){var _0x1a7c4e;if(typeof _0x3e19dc!==_0xce2c('0x2')||_0x3e19dc[_0xce2c('0x3')]===0x0){return _0x25e41a('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x1e5b84!=='string'||_0x1e5b84[_0xce2c('0x3')]===0x0){return _0x25e41a(_0xce2c('0x4'));}if(typeof _0x2279d5!==_0xce2c('0x5')&&(typeof _0x2279d5!==_0xce2c('0x2')||_0x2279d5[_0xce2c('0x3')]===0x0)){return _0x25e41a(_0xce2c('0x6'));}try{_0x1a7c4e=fs['readFileSync'](_0x3e19dc)[_0xce2c('0x7')](_0xce2c('0x8'));}catch(_0xc1d46b){return _0x25e41a(_0xc1d46b);}return _0x15fe3c({'method':_0xce2c('0x9'),'uri':host+_0xce2c('0xa')+_0x1e5b84,'body':{'config':{'encoding':_0xce2c('0xb'),'sampleRateHertz':_0xce2c('0xc'),'languageCode':_0x2279d5},'audio':{'content':_0x1a7c4e}},'json':!![]});});}; \ No newline at end of file +var _0xe644=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x3849b9,_0x235c0f){var _0x500202=function(_0x2643f4){while(--_0x2643f4){_0x3849b9['push'](_0x3849b9['shift']());}};_0x500202(++_0x235c0f);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0x4e64('0x0'));var BPromise=require(_0x4e64('0x1'));var fs=require('fs');var host=_0x4e64('0x2');module[_0x4e64('0x3')]=function(_0x18e17a,_0x1c5c75,_0x5e2d61){return new BPromise(function(_0x29c930,_0x7b06ee){var _0x2f5ef0;if(typeof _0x18e17a!==_0x4e64('0x4')||_0x18e17a[_0x4e64('0x5')]===0x0){return _0x7b06ee(_0x4e64('0x6'));}if(typeof _0x1c5c75!=='string'||_0x1c5c75[_0x4e64('0x5')]===0x0){return _0x7b06ee(_0x4e64('0x7'));}if(typeof _0x5e2d61!=='undefined'&&(typeof _0x5e2d61!=='string'||_0x5e2d61[_0x4e64('0x5')]===0x0)){return _0x7b06ee('lang\x20should\x20be\x20a\x20string');}try{_0x2f5ef0=fs['readFileSync'](_0x18e17a)[_0x4e64('0x8')](_0x4e64('0x9'));}catch(_0x4323bb){return _0x7b06ee(_0x4323bb);}return _0x29c930({'method':_0x4e64('0xa'),'uri':host+_0x4e64('0xb')+_0x1c5c75,'body':{'config':{'encoding':_0x4e64('0xc'),'sampleRateHertz':'8000','languageCode':_0x5e2d61},'audio':{'content':_0x2f5ef0}},'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 3136188..92ffb03 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 _0x82f1=['./asr','exports'];(function(_0x2718c8,_0x33a6c3){var _0x40ee17=function(_0x158865){while(--_0x158865){_0x2718c8['push'](_0x2718c8['shift']());}};_0x40ee17(++_0x33a6c3);}(_0x82f1,0x16e));var _0x182f=function(_0xe52a85,_0x1f6b57){_0xe52a85=_0xe52a85-0x0;var _0x594b95=_0x82f1[_0xe52a85];return _0x594b95;};var asr=require(_0x182f('0x0'));module[_0x182f('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbd30=['./asr','exports'];(function(_0xacda6e,_0x55252f){var _0x452777=function(_0x386664){while(--_0x386664){_0xacda6e['push'](_0xacda6e['shift']());}};_0x452777(++_0x55252f);}(_0xbd30,0x7e));var _0x0bd3=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xbd30[_0x26462c];return _0x509a42;};var asr=require(_0x0bd3('0x0'));module[_0x0bd3('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 52fb018..243937b 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 _0x99cd=['md5','path','request-promise','sox','google-tts-api','url','parse','util','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','statusMessage','createWriteStream','info','close','unlink','pipe','end','request\x20to\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','then','generate','.mp3','from','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','asr','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','endConversation','metadata','isFallbackIntent','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','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','apiai-promise','bluebird','dialogflow','http','https'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x99cd,0x109));var _0xd99c=function(_0x4f1a12,_0x2beb91){_0x4f1a12=_0x4f1a12-0x0;var _0x483310=_0x99cd[_0x4f1a12];return _0x483310;};'use strict';var apiai=require(_0xd99c('0x0'));var BPromise=require(_0xd99c('0x1'));var dialogflow=require(_0xd99c('0x2'));var fs=require('fs');var http=require(_0xd99c('0x3'));var https=require(_0xd99c('0x4'));var md5=require(_0xd99c('0x5'));var path=require(_0xd99c('0x6'));var querystring=require('querystring');var rp=require(_0xd99c('0x7'));var rs=require('randomstring');var sox=require(_0xd99c('0x8'));var tts=require(_0xd99c('0x9'));var urlParse=require(_0xd99c('0xa'))[_0xd99c('0xb')];var util=require(_0xd99c('0xc'));var aws=require('./aws');var google=require('./google');var sestek=require('./sestek');var tilde=require(_0xd99c('0xd'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xd99c('0xe');function downloadFile(_0x55cebc,_0x3ce228){return new BPromise(function(_0x19553d,_0x5e69bd){var _0x9da976=urlParse(_0x55cebc);var _0x51dcb1=_0x9da976[_0xd99c('0xf')]===_0xd99c('0x10')?https:http;var _0x592d11={'host':_0x9da976[_0xd99c('0x11')],'path':_0x9da976[_0xd99c('0x6')],'headers':{'user-agent':_0xd99c('0x12')}};_0x51dcb1[_0xd99c('0x13')](_0x592d11,function(_0x41dbaa){if(_0x41dbaa[_0xd99c('0x14')]!==0xc8){logger[_0xd99c('0x15')]('request\x20to\x20'+_0x55cebc+'\x20failed,\x20status\x20code\x20=\x20'+_0x41dbaa['statusCode']+'\x20('+_0x41dbaa[_0xd99c('0x16')]+')');_0x5e69bd(new Error('request\x20to\x20'+_0x55cebc+'\x20failed,\x20status\x20code\x20=\x20'+_0x41dbaa[_0xd99c('0x14')]+'\x20('+_0x41dbaa[_0xd99c('0x16')]+')'));return;}var _0x10a899=fs[_0xd99c('0x17')](_0x3ce228);_0x10a899['on']('finish',function(){logger[_0xd99c('0x18')]('finish\x20download\x20file');_0x10a899[_0xd99c('0x19')](_0x19553d);});_0x10a899['on'](_0xd99c('0x15'),function(_0x1bc5a6){fs[_0xd99c('0x1a')](_0x3ce228);logger[_0xd99c('0x15')]('download\x20error',_0x1bc5a6);_0x5e69bd(_0x1bc5a6);});_0x41dbaa[_0xd99c('0x1b')](_0x10a899);})['on']('error',function(_0x525ff5){logger['error'](_0x525ff5);_0x5e69bd(_0x525ff5);})[_0xd99c('0x1c')]();});}function uploadFile(_0x58bae3){return new BPromise(function(_0x4fd739,_0x504b0e){var _0x27f2d2=urlParse(_0x58bae3);var _0x422128=_0x27f2d2[_0xd99c('0xf')]===_0xd99c('0x10')?https:http;var _0x2221ba={'host':_0x27f2d2[_0xd99c('0x11')],'path':_0x27f2d2['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x422128['get'](_0x2221ba,function(_0x52ef26){if(_0x52ef26['statusCode']!==0xc8){_0x504b0e(new Error(_0xd99c('0x1d')+_0x58bae3+'\x20failed,\x20status\x20code\x20=\x20'+_0x52ef26[_0xd99c('0x14')]+'\x20('+_0x52ef26[_0xd99c('0x16')]+')'));return;}var _0x5c2f38='';_0x52ef26['on'](_0xd99c('0x1e'),function(_0x20454a){_0x5c2f38+=_0x20454a;});_0x52ef26['on']('end',function(){_0x4fd739(_0x5c2f38);});})['on'](_0xd99c('0x15'),function(_0x401897){_0x504b0e(_0x401897);})[_0xd99c('0x1c')]();});}function convertFile(_0x522d10,_0x475396){return new BPromise(function(_0x4eaf45,_0x222873){var _0x444c6f=sox[_0xd99c('0x1f')](_0x522d10,_0x475396,{'sampleRate':0x1f40,'format':_0xd99c('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x444c6f['on'](_0xd99c('0x15'),function(_0x4d936d){logger[_0xd99c('0x15')](_0xd99c('0x21'),_0x4d936d);_0x222873(_0x4d936d);});_0x444c6f['on'](_0xd99c('0x1c'),function(){logger[_0xd99c('0x18')](_0xd99c('0x22'));_0x4eaf45();});_0x444c6f[_0xd99c('0x23')]();});}function base64Decode(_0x5538ad,_0x2d59fa){var _0x2f4856=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs['generate'](0x4)+_0xd99c('0x26'));fs['writeFileSync'](_0x2f4856,_0x5538ad,_0xd99c('0x27'));return convertFile(_0x2f4856,_0x2d59fa)['then'](function(){try{fs[_0xd99c('0x1a')](_0x2f4856);fs[_0xd99c('0x28')](_0x2d59fa,_0xd99c('0x29'));}catch(_0x3458c2){logger[_0xd99c('0x15')](_0x3458c2);}return _0x2d59fa[_0xd99c('0x2a')]('.')[0x0];});}function base64Encode(_0x9a3a44){var _0x496704=fs['readFileSync'](_0x9a3a44);return new Buffer(_0x496704)[_0xd99c('0x2b')](_0xd99c('0x27'));}exports['googleCloudTTS']=function(_0x2d46d9,_0x1e8827,_0x29dc7e,_0x1e982c,_0x5a9ead,_0x419c1e){var _0x2ab4e2,_0x1ace0f;var _0x297845=_0xd99c('0x2c');var _0x25b08b=_0xd99c('0x2d')+_0x2d46d9;var _0x1a1332={};if(_0x1e8827===_0xd99c('0x2e')){_0x1a1332['input']={'ssml':_0x29dc7e};}else{_0x1a1332[_0xd99c('0x2f')]={'text':_0x29dc7e};};_0x1a1332[_0xd99c('0x30')]={'languageCode':_0x1e982c,'ssmlGender':_0x5a9ead};_0x1a1332[_0xd99c('0x31')]={'audioEncoding':_0xd99c('0x32'),'sampleRateHertz':0x1f40};var _0x5a30a8={'url':_0x297845+'text:synthesize'+_0x25b08b,'method':_0xd99c('0x33'),'json':!![],'body':_0x1a1332};return rp(_0x5a30a8)[_0xd99c('0x34')](function(_0x4d7133){return new BPromise(function(_0x326733,_0x48aa6d){_0x2ab4e2=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+_0xd99c('0x36'));var _0x2b181a=Buffer[_0xd99c('0x37')](_0x4d7133['audioContent'],_0xd99c('0x27'));return fs[_0xd99c('0x38')](_0x2ab4e2,_0x2b181a,function(_0x1637cf){_0x48aa6d(_0x1637cf);},function(_0x1ad45e){fs[_0xd99c('0x28')](_0x2ab4e2,_0xd99c('0x29'));_0x326733(_0x1ad45e);});});})[_0xd99c('0x34')](function(_0x3a02a1){_0x1ace0f=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+_0xd99c('0x26'));return convertFile(_0x2ab4e2,_0x1ace0f);})[_0xd99c('0x34')](function(){try{fs['unlink'](_0x2ab4e2);fs['chmodSync'](_0x1ace0f,_0xd99c('0x29'));}catch(_0x408f5d){logger[_0xd99c('0x15')](_0x408f5d);}logger[_0xd99c('0x18')](_0xd99c('0x39'),_0x1ace0f[_0xd99c('0x2a')]('.')[0x0]);return _0x1ace0f['split']('.')[0x0];});};exports['googleTTS']=function(_0x53d711,_0x2a39c8){var _0x209510=_0xd99c('0x3a');var _0x4907b8,_0x5a568b;var _0x363a6e;var _0x393a72={'encoding':_0xd99c('0x3b'),'method':_0xd99c('0x33'),'timeout':0x2710,'url':_0x209510,'headers':{'Content-Type':_0xd99c('0x3c')},'body':_0xd99c('0x3d')+encodeURIComponent(JSON[_0xd99c('0x3e')]([[['jQ1olc',JSON['stringify']([_0x53d711,_0x2a39c8||'en',![],_0xd99c('0x3f')]),null,_0xd99c('0x40')]]]))};return rp(_0x393a72)[_0xd99c('0x34')](function(_0x234f51){try{_0x363a6e=eval(_0x234f51[_0xd99c('0x41')](0x5))[0x0][0x2];}catch(_0x498ab1){throw new Error('parse\x20response\x20failed:\x0a'+_0x234f51[_0xd99c('0x1e')]);}if(!_0x363a6e){if(_0x53d711[_0xd99c('0x42')]>0xc8){throw new Error(_0xd99c('0x43'));}else{throw new Error(_0xd99c('0x44')+_0x2a39c8+_0xd99c('0x45'));}}try{_0x363a6e=eval(_0x363a6e)[0x0];}catch(_0x5308a3){throw new Error(_0xd99c('0x46')+res[_0xd99c('0x1e')]);}const _0xbac5b9=_0x363a6e;_0x4907b8=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+_0xd99c('0x36'));fs[_0xd99c('0x47')](_0x4907b8,_0x363a6e,{'encoding':_0xd99c('0x27')});_0x5a568b=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+_0xd99c('0x26'));return convertFile(_0x4907b8,_0x5a568b);})[_0xd99c('0x34')](function(){try{fs[_0xd99c('0x1a')](_0x4907b8);fs['chmodSync'](_0x5a568b,_0xd99c('0x29'));}catch(_0xc00d5){logger[_0xd99c('0x15')](_0xc00d5);}logger[_0xd99c('0x18')]('goggleTTS\x20path',_0x5a568b[_0xd99c('0x2a')]('.')[0x0]);return _0x5a568b['split']('.')[0x0];});};exports['googleASR']=function(_0x3a71f3,_0xc42711,_0x39cdd7){return google[_0xd99c('0x48')](_0x3a71f3,_0xc42711,_0x39cdd7)['then'](function(_0x150032){logger['info'](_0x150032[_0xd99c('0x49')]);return rp(_0x150032);})[_0xd99c('0x34')](function(_0x32d256){var _0x9383a6='';var _0x43075c=0x0;try{fs[_0xd99c('0x1a')](_0x3a71f3);}catch(_0x130eb6){logger[_0xd99c('0x15')](_0x130eb6);}if(_0x32d256&&_0x32d256[_0xd99c('0x4a')]){_0x9383a6=_0x32d256[_0xd99c('0x4a')]['map'](function(_0x502c50){return _0x502c50&&_0x502c50['alternatives'][0x0]&&_0x502c50[_0xd99c('0x4b')][0x0][_0xd99c('0x4c')]?_0x502c50['alternatives'][0x0][_0xd99c('0x4c')]:'';})['join']('\x0a');_0x43075c=_0x32d256[_0xd99c('0x4a')][_0xd99c('0x4d')](function(_0x5447a2){return _0x5447a2&&_0x5447a2[_0xd99c('0x4b')][0x0]&&_0x5447a2[_0xd99c('0x4b')][0x0][_0xd99c('0x4e')]?_0x5447a2[_0xd99c('0x4b')][0x0][_0xd99c('0x4e')]:0x0;})[_0xd99c('0x4f')]('\x0a');}logger[_0xd99c('0x18')](_0xd99c('0x50'),_0x9383a6);logger[_0xd99c('0x18')]('googleASR\x20confidence',_0x43075c);return{'transcript':_0x9383a6,'confidence':_0x43075c};})[_0xd99c('0x51')](function(_0x348b49){logger[_0xd99c('0x15')](_0xd99c('0x52'),_0x348b49['statusCode'],_0x348b49[_0xd99c('0x53')],_0x348b49[_0xd99c('0x54')]);});};exports[_0xd99c('0x55')]=function(_0x530e4b,_0x10447a,_0x46e1df,_0x29dc39){var _0x2e9d68=apiai(_0x10447a,{'language':_0x29dc39||'en'});return _0x2e9d68[_0xd99c('0x56')](_0x46e1df,{'sessionId':md5(_0x530e4b)})[_0xd99c('0x34')](function(_0x4774d3){logger[_0xd99c('0x18')](JSON[_0xd99c('0x3e')](_0x4774d3));return{'source':_0x4774d3[_0xd99c('0x57')][_0xd99c('0x58')],'resolvedQuery':_0x4774d3[_0xd99c('0x57')][_0xd99c('0x59')],'action':_0x4774d3[_0xd99c('0x57')]['action'],'actionIncomplete':_0x4774d3[_0xd99c('0x57')][_0xd99c('0x5a')],'speech':_0x4774d3[_0xd99c('0x57')][_0xd99c('0x5b')][_0xd99c('0x5c')],'score':_0x4774d3['result'][_0xd99c('0x5d')],'statusCode':_0x4774d3[_0xd99c('0x5e')]['code'],'endConversation':_0x4774d3['result']['metadata'][_0xd99c('0x5f')]||![],'isFallbackIntent':_0x4774d3[_0xd99c('0x57')][_0xd99c('0x60')][_0xd99c('0x61')]};});};exports['googleDialogflowV2']=function(_0x1ed502,_0x5b42be,_0x51e513,_0x348cc4,_0x451751,_0x13b609){var _0x8c1347=_0x348cc4['replace'](/\\n/g,'\x0a');var _0x5f2658={'credentials':{'private_key':_0x8c1347,'client_email':_0x51e513}};var _0x219421=new dialogflow[(_0xd99c('0x62'))](_0x5f2658);var _0x1b09ad=_0x219421['sessionPath'](_0x5b42be,md5(_0x1ed502));var _0x25e4d7={'session':_0x1b09ad,'queryInput':{'text':{'text':_0x451751,'languageCode':_0x13b609}}};return _0x219421[_0xd99c('0x63')](_0x25e4d7)['then'](function(_0x4cb0c4){if(_0x4cb0c4&&_0x4cb0c4['length']){logger[_0xd99c('0x18')](_0xd99c('0x64'),JSON[_0xd99c('0x3e')](_0x4cb0c4));var _0x11d1ac=_0x4cb0c4[0x0];if(_0x11d1ac){var _0xe998e9={'action':_0x11d1ac[_0xd99c('0x65')]['action'],'allRequiredParamsPresent':_0x11d1ac['queryResult']['allRequiredParamsPresent'],'endConversation':_0x11d1ac[_0xd99c('0x65')]['diagnosticInfo']&&_0x11d1ac[_0xd99c('0x65')][_0xd99c('0x66')][_0xd99c('0x67')]?_0x11d1ac[_0xd99c('0x65')][_0xd99c('0x66')][_0xd99c('0x67')][_0xd99c('0x68')][_0xd99c('0x69')]:![],'fulfillmentText':_0x11d1ac[_0xd99c('0x65')]['fulfillmentText'],'intentName':_0x11d1ac[_0xd99c('0x65')]['intent']['name'],'intentDisplayName':_0x11d1ac[_0xd99c('0x65')][_0xd99c('0x6a')][_0xd99c('0x6b')],'isFallbackIntent':_0x11d1ac[_0xd99c('0x65')]['intent']['isFallback'],'languageCode':_0x11d1ac[_0xd99c('0x65')][_0xd99c('0x6c')],'queryText':_0x11d1ac[_0xd99c('0x65')][_0xd99c('0x6d')],'responseId':_0x11d1ac[_0xd99c('0x6e')],'score':_0x11d1ac[_0xd99c('0x65')][_0xd99c('0x6f')],'speech':_0x11d1ac[_0xd99c('0x65')][_0xd99c('0x70')],'providerResponse':JSON['stringify'](_0x4cb0c4)};return _0xe998e9;}}});};exports[_0xd99c('0x71')]=function(_0x4497eb,_0x29965d,_0x16c578,_0x4be7b0){return tilde[_0xd99c('0x48')](_0x4497eb,_0x29965d,_0x16c578,_0x4be7b0)['then'](function(_0x150e9c){try{fs[_0xd99c('0x1a')](_0x4497eb);}catch(_0xd95fd8){logger['error'](_0xd95fd8);}logger[_0xd99c('0x18')](_0xd99c('0x72'),_0x150e9c[_0xd99c('0x4c')]);logger[_0xd99c('0x18')](_0xd99c('0x73'),_0x150e9c[_0xd99c('0x4e')]);return _0x150e9c;});};exports[_0xd99c('0x74')]=function(_0x4fb27b,_0x48e661,_0x189e05,_0x3a5abf,_0x1b2984,_0x5d071b){var _0x1290bc=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs['generate'](0x4)+'.mp3');var _0x391624;return aws[_0xd99c('0x75')](_0x4fb27b,_0x48e661,_0x189e05,_0x3a5abf,_0x1b2984,_0x5d071b,_0x1290bc)['then'](function(){_0x391624=path['resolve'](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+_0xd99c('0x26'));return convertFile(_0x1290bc,_0x391624);})[_0xd99c('0x34')](function(){try{fs['unlink'](_0x1290bc);fs[_0xd99c('0x28')](_0x391624,_0xd99c('0x29'));}catch(_0x3a5c12){logger[_0xd99c('0x15')](_0x3a5c12);}return _0x391624['split']('.')[0x0];});};exports[_0xd99c('0x76')]=function(_0x52dc56,_0x76bde3,_0x223b74,_0x1e8dc4,_0x56ebf8,_0x311ca1){return aws[_0xd99c('0x77')](_0x52dc56,_0x76bde3,_0x223b74,_0x1e8dc4,_0x56ebf8,_0x311ca1)[_0xd99c('0x34')](function(_0x8a3b39){logger['info'](JSON[_0xd99c('0x3e')](_0x8a3b39));return _0x8a3b39;});};exports[_0xd99c('0x78')]=function(_0x5b95d5,_0x3da633,_0x114790,_0x1cdbd4){var _0x25cec0=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x5b95d5,encodeURIComponent(_0x3da633),_0x114790,_0x1cdbd4);var _0x4fe62f=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+_0xd99c('0x36'));var _0x558916;return downloadFile(_0x25cec0,_0x4fe62f)[_0xd99c('0x34')](function(){_0x558916=path[_0xd99c('0x24')](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+'.wav');return convertFile(_0x4fe62f,_0x558916);})['then'](function(){try{fs['unlink'](_0x4fe62f);fs['chmodSync'](_0x558916,_0xd99c('0x29'));}catch(_0x570b9e){logger[_0xd99c('0x15')](_0x570b9e);}return _0x558916[_0xd99c('0x2a')]('.')[0x0];});};exports[_0xd99c('0x79')]=function(_0x5581c8,_0x40a6e7,_0x4ac378,_0x262b6d){var _0x2be925=util[_0xd99c('0x7a')](_0xd99c('0x7b'),ISPEECH_API,_0x40a6e7,_0x4ac378,base64Encode(_0x5581c8),_0x262b6d?util['format'](_0xd99c('0x7c'),encodeURIComponent(_0x262b6d)):_0xd99c('0x7d'));return uploadFile(_0x2be925)[_0xd99c('0x34')](function(_0x276532){return querystring['parse'](_0x276532);});};exports[_0xd99c('0x7e')]=function(_0x4bbeec,_0x344dde){return sestek[_0xd99c('0x7f')](_0x4bbeec,_0x344dde)[_0xd99c('0x34')](function(_0x570089){logger[_0xd99c('0x18')](JSON['stringify'](_0x570089));var _0x46b270={'speech':_0x570089[_0xd99c('0x80')],'action':_0x570089[_0xd99c('0x81')]?_0x570089[_0xd99c('0x81')][_0xd99c('0x82')]:undefined,'actiondata':_0x570089[_0xd99c('0x81')]?_0x570089[_0xd99c('0x81')][_0xd99c('0x83')]:undefined};if(_0x570089['channelData']&&_0x570089[_0xd99c('0x81')][_0xd99c('0x84')]){return base64Decode(_0x570089[_0xd99c('0x81')][_0xd99c('0x84')][_0xd99c('0x85')],path['resolve'](__dirname,_0xd99c('0x25'),rs[_0xd99c('0x35')](0x4)+_0xd99c('0x26')))[_0xd99c('0x34')](function(_0x336611){_0x46b270[_0xd99c('0x86')]=_0x336611;return _0x46b270;});}return _0x46b270;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xfa67=['freeform=3','parse','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','host','data','end','error\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','generate','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','message','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s'];(function(_0x532a0d,_0x12479c){var _0x4fd2f5=function(_0x198db7){while(--_0x198db7){_0x532a0d['push'](_0x532a0d['shift']());}};_0x4fd2f5(++_0x12479c);}(_0xfa67,0x95));var _0x7fa6=function(_0x1a9406,_0xb26dbe){_0x1a9406=_0x1a9406-0x0;var _0x1b2e37=_0xfa67[_0x1a9406];return _0x1b2e37;};'use strict';var apiai=require(_0x7fa6('0x0'));var BPromise=require(_0x7fa6('0x1'));var dialogflow=require(_0x7fa6('0x2'));var fs=require('fs');var http=require(_0x7fa6('0x3'));var https=require(_0x7fa6('0x4'));var md5=require(_0x7fa6('0x5'));var path=require(_0x7fa6('0x6'));var querystring=require(_0x7fa6('0x7'));var rp=require(_0x7fa6('0x8'));var rs=require(_0x7fa6('0x9'));var sox=require(_0x7fa6('0xa'));var tts=require(_0x7fa6('0xb'));var urlParse=require('url')['parse'];var util=require('util');var aws=require(_0x7fa6('0xc'));var google=require(_0x7fa6('0xd'));var sestek=require(_0x7fa6('0xe'));var tilde=require(_0x7fa6('0xf'));var logger=require('../../../config/logger')(_0x7fa6('0x10'));var ISPEECH_API=_0x7fa6('0x11');function downloadFile(_0x57c8b8,_0x310dff){return new BPromise(function(_0x1ac140,_0x26f7d6){var _0x5e2eca=urlParse(_0x57c8b8);var _0x3baffa=_0x5e2eca['protocol']===_0x7fa6('0x12')?https:http;var _0x5b11db={'host':_0x5e2eca['host'],'path':_0x5e2eca[_0x7fa6('0x6')],'headers':{'user-agent':_0x7fa6('0x13')}};_0x3baffa[_0x7fa6('0x14')](_0x5b11db,function(_0x58fc6e){if(_0x58fc6e['statusCode']!==0xc8){logger[_0x7fa6('0x15')](_0x7fa6('0x16')+_0x57c8b8+_0x7fa6('0x17')+_0x58fc6e[_0x7fa6('0x18')]+'\x20('+_0x58fc6e[_0x7fa6('0x19')]+')');_0x26f7d6(new Error(_0x7fa6('0x16')+_0x57c8b8+_0x7fa6('0x17')+_0x58fc6e[_0x7fa6('0x18')]+'\x20('+_0x58fc6e[_0x7fa6('0x19')]+')'));return;}var _0x3a2f16=fs[_0x7fa6('0x1a')](_0x310dff);_0x3a2f16['on']('finish',function(){logger[_0x7fa6('0x1b')](_0x7fa6('0x1c'));_0x3a2f16[_0x7fa6('0x1d')](_0x1ac140);});_0x3a2f16['on'](_0x7fa6('0x15'),function(_0x3559ce){fs[_0x7fa6('0x1e')](_0x310dff);logger['error'](_0x7fa6('0x1f'),_0x3559ce);_0x26f7d6(_0x3559ce);});_0x58fc6e[_0x7fa6('0x20')](_0x3a2f16);})['on'](_0x7fa6('0x15'),function(_0x1bead0){logger[_0x7fa6('0x15')](_0x1bead0);_0x26f7d6(_0x1bead0);})['end']();});}function uploadFile(_0x4b297a){return new BPromise(function(_0x36d166,_0x3cca62){var _0x4ca7c6=urlParse(_0x4b297a);var _0x877d71=_0x4ca7c6['protocol']==='https:'?https:http;var _0x36ccc3={'host':_0x4ca7c6[_0x7fa6('0x21')],'path':_0x4ca7c6[_0x7fa6('0x6')],'headers':{'user-agent':_0x7fa6('0x13')}};_0x877d71[_0x7fa6('0x14')](_0x36ccc3,function(_0x129037){if(_0x129037[_0x7fa6('0x18')]!==0xc8){_0x3cca62(new Error(_0x7fa6('0x16')+_0x4b297a+_0x7fa6('0x17')+_0x129037[_0x7fa6('0x18')]+'\x20('+_0x129037['statusMessage']+')'));return;}var _0x13e980='';_0x129037['on'](_0x7fa6('0x22'),function(_0x40e2bd){_0x13e980+=_0x40e2bd;});_0x129037['on'](_0x7fa6('0x23'),function(){_0x36d166(_0x13e980);});})['on'](_0x7fa6('0x15'),function(_0x403fab){_0x3cca62(_0x403fab);})['end']();});}function convertFile(_0x4ae46c,_0x325c2b){return new BPromise(function(_0x8a26da,_0x3b0328){var _0x1e9234=sox['transcode'](_0x4ae46c,_0x325c2b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1e9234['on']('error',function(_0x5dc2f2){logger[_0x7fa6('0x15')](_0x7fa6('0x24'),_0x5dc2f2);_0x3b0328(_0x5dc2f2);});_0x1e9234['on'](_0x7fa6('0x23'),function(){logger['info']('finish\x20to\x20convert');_0x8a26da();});_0x1e9234[_0x7fa6('0x25')]();});}function base64Decode(_0x59eab1,_0x21e583){var _0x2c3b8a=path[_0x7fa6('0x26')](__dirname,_0x7fa6('0x27'),rs['generate'](0x4)+_0x7fa6('0x28'));fs[_0x7fa6('0x29')](_0x2c3b8a,_0x59eab1,_0x7fa6('0x2a'));return convertFile(_0x2c3b8a,_0x21e583)['then'](function(){try{fs[_0x7fa6('0x1e')](_0x2c3b8a);fs[_0x7fa6('0x2b')](_0x21e583,'777');}catch(_0x2058c0){logger[_0x7fa6('0x15')](_0x2058c0);}return _0x21e583[_0x7fa6('0x2c')]('.')[0x0];});}function base64Encode(_0x173aa5){var _0x402d57=fs[_0x7fa6('0x2d')](_0x173aa5);return new Buffer(_0x402d57)[_0x7fa6('0x2e')](_0x7fa6('0x2a'));}exports[_0x7fa6('0x2f')]=function(_0x5be415,_0x2a7608,_0x39d7e6,_0x1703c5,_0x2ca520,_0x1dfe9a){var _0x5503d7,_0x54c2ae;var _0x22bef1=_0x7fa6('0x30');var _0x28b407=_0x7fa6('0x31')+_0x5be415;var _0x3a00cb={};if(_0x2a7608===_0x7fa6('0x32')){_0x3a00cb[_0x7fa6('0x33')]={'ssml':_0x39d7e6};}else{_0x3a00cb[_0x7fa6('0x33')]={'text':_0x39d7e6};};_0x3a00cb[_0x7fa6('0x34')]={'languageCode':_0x1703c5,'ssmlGender':_0x2ca520};_0x3a00cb[_0x7fa6('0x35')]={'audioEncoding':_0x7fa6('0x36'),'sampleRateHertz':0x1f40};var _0x21ea5b={'url':_0x22bef1+_0x7fa6('0x37')+_0x28b407,'method':_0x7fa6('0x38'),'json':!![],'body':_0x3a00cb};return rp(_0x21ea5b)[_0x7fa6('0x39')](function(_0x44da5c){return new BPromise(function(_0x3dd32e,_0x3d405d){_0x5503d7=path[_0x7fa6('0x26')](__dirname,_0x7fa6('0x27'),rs['generate'](0x4)+_0x7fa6('0x3a'));var _0x210747=Buffer[_0x7fa6('0x3b')](_0x44da5c[_0x7fa6('0x3c')],_0x7fa6('0x2a'));return fs['writeFile'](_0x5503d7,_0x210747,function(_0x16a4bd){_0x3d405d(_0x16a4bd);},function(_0x673be9){fs['chmodSync'](_0x5503d7,'777');_0x3dd32e(_0x673be9);});});})[_0x7fa6('0x39')](function(_0x57e763){_0x54c2ae=path['resolve'](__dirname,_0x7fa6('0x27'),rs['generate'](0x4)+_0x7fa6('0x28'));return convertFile(_0x5503d7,_0x54c2ae);})[_0x7fa6('0x39')](function(){try{fs[_0x7fa6('0x1e')](_0x5503d7);fs[_0x7fa6('0x2b')](_0x54c2ae,_0x7fa6('0x3d'));}catch(_0x63cf91){logger[_0x7fa6('0x15')](_0x63cf91);}logger['info'](_0x7fa6('0x3e'),_0x54c2ae[_0x7fa6('0x2c')]('.')[0x0]);return _0x54c2ae['split']('.')[0x0];});};exports[_0x7fa6('0x3f')]=function(_0x638763,_0x26443a){var _0x47a5a0=_0x7fa6('0x40');var _0x3bcf7c,_0x30d49d;var _0x39fd21;var _0x724fe4={'encoding':'utf8','method':_0x7fa6('0x38'),'timeout':0x2710,'url':_0x47a5a0,'headers':{'Content-Type':_0x7fa6('0x41')},'body':_0x7fa6('0x42')+encodeURIComponent(JSON[_0x7fa6('0x43')]([[[_0x7fa6('0x44'),JSON[_0x7fa6('0x43')]([_0x638763,_0x26443a||'en',![],_0x7fa6('0x45')]),null,'generic']]]))};return rp(_0x724fe4)[_0x7fa6('0x39')](function(_0x340c79){try{_0x39fd21=eval(_0x340c79['slice'](0x5))[0x0][0x2];}catch(_0x10480d){throw new Error(_0x7fa6('0x46')+_0x340c79[_0x7fa6('0x22')]);}if(!_0x39fd21){if(_0x638763['length']>0xc8){throw new Error(_0x7fa6('0x47'));}else{throw new Error('lang\x20\x22'+_0x26443a+_0x7fa6('0x48'));}}try{_0x39fd21=eval(_0x39fd21)[0x0];}catch(_0x1764b6){throw new Error(_0x7fa6('0x46')+res[_0x7fa6('0x22')]);}const _0x4a55d9=_0x39fd21;_0x3bcf7c=path['resolve'](__dirname,'tmp',rs[_0x7fa6('0x49')](0x4)+_0x7fa6('0x3a'));fs['writeFileSync'](_0x3bcf7c,_0x39fd21,{'encoding':_0x7fa6('0x2a')});_0x30d49d=path[_0x7fa6('0x26')](__dirname,_0x7fa6('0x27'),rs[_0x7fa6('0x49')](0x4)+'.wav');return convertFile(_0x3bcf7c,_0x30d49d);})[_0x7fa6('0x39')](function(){try{fs[_0x7fa6('0x1e')](_0x3bcf7c);fs[_0x7fa6('0x2b')](_0x30d49d,'777');}catch(_0x37f510){logger[_0x7fa6('0x15')](_0x37f510);}logger[_0x7fa6('0x1b')](_0x7fa6('0x4a'),_0x30d49d[_0x7fa6('0x2c')]('.')[0x0]);return _0x30d49d['split']('.')[0x0];});};exports[_0x7fa6('0x4b')]=function(_0x1b29b0,_0x36aa6d,_0x5279d2){return google[_0x7fa6('0x4c')](_0x1b29b0,_0x36aa6d,_0x5279d2)['then'](function(_0x5c4cc0){logger['info'](_0x5c4cc0[_0x7fa6('0x4d')]);return rp(_0x5c4cc0);})[_0x7fa6('0x39')](function(_0x52619e){var _0x3d929a='';var _0x14406a=0x0;try{fs[_0x7fa6('0x1e')](_0x1b29b0);}catch(_0x87c028){logger[_0x7fa6('0x15')](_0x87c028);}if(_0x52619e&&_0x52619e['results']){_0x3d929a=_0x52619e[_0x7fa6('0x4e')][_0x7fa6('0x4f')](function(_0x18b864){return _0x18b864&&_0x18b864[_0x7fa6('0x50')][0x0]&&_0x18b864[_0x7fa6('0x50')][0x0][_0x7fa6('0x51')]?_0x18b864[_0x7fa6('0x50')][0x0][_0x7fa6('0x51')]:'';})[_0x7fa6('0x52')]('\x0a');_0x14406a=_0x52619e[_0x7fa6('0x4e')][_0x7fa6('0x4f')](function(_0x4ce07c){return _0x4ce07c&&_0x4ce07c[_0x7fa6('0x50')][0x0]&&_0x4ce07c[_0x7fa6('0x50')][0x0][_0x7fa6('0x53')]?_0x4ce07c[_0x7fa6('0x50')][0x0][_0x7fa6('0x53')]:0x0;})[_0x7fa6('0x52')]('\x0a');}logger[_0x7fa6('0x1b')](_0x7fa6('0x54'),_0x3d929a);logger[_0x7fa6('0x1b')](_0x7fa6('0x55'),_0x14406a);return{'transcript':_0x3d929a,'confidence':_0x14406a};})['catch'](function(_0x5d2940){logger[_0x7fa6('0x15')]('[%s]\x20%s:%s',_0x5d2940[_0x7fa6('0x18')],_0x5d2940[_0x7fa6('0x56')],_0x5d2940[_0x7fa6('0x57')]);});};exports['googleDialogflow']=function(_0x478f7e,_0x5bb04d,_0x3fe772,_0x3ec32d){var _0x25a183=apiai(_0x5bb04d,{'language':_0x3ec32d||'en'});return _0x25a183[_0x7fa6('0x58')](_0x3fe772,{'sessionId':md5(_0x478f7e)})[_0x7fa6('0x39')](function(_0x3e3acf){logger[_0x7fa6('0x1b')](JSON[_0x7fa6('0x43')](_0x3e3acf));return{'source':_0x3e3acf[_0x7fa6('0x59')][_0x7fa6('0x5a')],'resolvedQuery':_0x3e3acf[_0x7fa6('0x59')][_0x7fa6('0x5b')],'action':_0x3e3acf['result']['action'],'actionIncomplete':_0x3e3acf[_0x7fa6('0x59')][_0x7fa6('0x5c')],'speech':_0x3e3acf['result'][_0x7fa6('0x5d')][_0x7fa6('0x5e')],'score':_0x3e3acf[_0x7fa6('0x59')][_0x7fa6('0x5f')],'statusCode':_0x3e3acf['status'][_0x7fa6('0x60')],'endConversation':_0x3e3acf['result'][_0x7fa6('0x61')][_0x7fa6('0x62')]||![],'isFallbackIntent':_0x3e3acf[_0x7fa6('0x59')][_0x7fa6('0x61')][_0x7fa6('0x63')]};});};exports[_0x7fa6('0x64')]=function(_0x378b28,_0x12e7c8,_0x23bc25,_0x5a5604,_0x20234d,_0x590edd){var _0x36de77=_0x5a5604[_0x7fa6('0x65')](/\\n/g,'\x0a');var _0x28a371={'credentials':{'private_key':_0x36de77,'client_email':_0x23bc25}};var _0x14770c=new dialogflow[(_0x7fa6('0x66'))](_0x28a371);var _0x5560b1=_0x14770c['sessionPath'](_0x12e7c8,md5(_0x378b28));var _0x459c98={'session':_0x5560b1,'queryInput':{'text':{'text':_0x20234d,'languageCode':_0x590edd}}};return _0x14770c[_0x7fa6('0x67')](_0x459c98)[_0x7fa6('0x39')](function(_0x4f34f1){if(_0x4f34f1&&_0x4f34f1[_0x7fa6('0x68')]){logger[_0x7fa6('0x1b')](_0x7fa6('0x69'),JSON['stringify'](_0x4f34f1));var _0x3dac80=_0x4f34f1[0x0];if(_0x3dac80){var _0x4c1d0f={'action':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x6b')],'allRequiredParamsPresent':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x6c')],'endConversation':_0x3dac80[_0x7fa6('0x6a')]['diagnosticInfo']&&_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x6d')][_0x7fa6('0x6e')]?_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x6d')][_0x7fa6('0x6e')]['end_conversation'][_0x7fa6('0x6f')]:![],'fulfillmentText':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x70')],'intentName':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x71')]['name'],'intentDisplayName':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x71')][_0x7fa6('0x72')],'isFallbackIntent':_0x3dac80[_0x7fa6('0x6a')]['intent'][_0x7fa6('0x73')],'languageCode':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x74')],'queryText':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x75')],'responseId':_0x3dac80['responseId'],'score':_0x3dac80[_0x7fa6('0x6a')][_0x7fa6('0x76')],'speech':_0x3dac80['queryResult'][_0x7fa6('0x70')],'providerResponse':JSON[_0x7fa6('0x43')](_0x4f34f1)};return _0x4c1d0f;}}});};exports[_0x7fa6('0x77')]=function(_0x2027a8,_0x369ba1,_0x18c76c,_0x4de43a){return tilde[_0x7fa6('0x4c')](_0x2027a8,_0x369ba1,_0x18c76c,_0x4de43a)[_0x7fa6('0x39')](function(_0x1c12b2){try{fs[_0x7fa6('0x1e')](_0x2027a8);}catch(_0x558166){logger['error'](_0x558166);}logger[_0x7fa6('0x1b')](_0x7fa6('0x78'),_0x1c12b2[_0x7fa6('0x51')]);logger[_0x7fa6('0x1b')](_0x7fa6('0x79'),_0x1c12b2[_0x7fa6('0x53')]);return _0x1c12b2;});};exports[_0x7fa6('0x7a')]=function(_0xf5e7a3,_0x4430a4,_0x42cdde,_0x5aa52f,_0x1d9917,_0x4f08aa){var _0x110f52=path['resolve'](__dirname,_0x7fa6('0x27'),rs[_0x7fa6('0x49')](0x4)+_0x7fa6('0x3a'));var _0x1a9fb3;return aws['polly'](_0xf5e7a3,_0x4430a4,_0x42cdde,_0x5aa52f,_0x1d9917,_0x4f08aa,_0x110f52)[_0x7fa6('0x39')](function(){_0x1a9fb3=path[_0x7fa6('0x26')](__dirname,_0x7fa6('0x27'),rs['generate'](0x4)+_0x7fa6('0x28'));return convertFile(_0x110f52,_0x1a9fb3);})[_0x7fa6('0x39')](function(){try{fs['unlink'](_0x110f52);fs['chmodSync'](_0x1a9fb3,_0x7fa6('0x3d'));}catch(_0x2a6bf6){logger['error'](_0x2a6bf6);}return _0x1a9fb3[_0x7fa6('0x2c')]('.')[0x0];});};exports[_0x7fa6('0x7b')]=function(_0x522348,_0xef9ac3,_0x47a6ba,_0x2afed7,_0x16e6e5,_0x412fca){return aws[_0x7fa6('0x7c')](_0x522348,_0xef9ac3,_0x47a6ba,_0x2afed7,_0x16e6e5,_0x412fca)['then'](function(_0x3f0b94){logger[_0x7fa6('0x1b')](JSON[_0x7fa6('0x43')](_0x3f0b94));return _0x3f0b94;});};exports[_0x7fa6('0x7d')]=function(_0x5a1fc5,_0x496ef7,_0x49e39a,_0x162d28){var _0x4ea54d=util[_0x7fa6('0x7e')](_0x7fa6('0x7f'),ISPEECH_API,_0x5a1fc5,encodeURIComponent(_0x496ef7),_0x49e39a,_0x162d28);var _0x26a044=path[_0x7fa6('0x26')](__dirname,_0x7fa6('0x27'),rs[_0x7fa6('0x49')](0x4)+_0x7fa6('0x3a'));var _0x5d8787;return downloadFile(_0x4ea54d,_0x26a044)[_0x7fa6('0x39')](function(){_0x5d8787=path[_0x7fa6('0x26')](__dirname,_0x7fa6('0x27'),rs['generate'](0x4)+_0x7fa6('0x28'));return convertFile(_0x26a044,_0x5d8787);})['then'](function(){try{fs[_0x7fa6('0x1e')](_0x26a044);fs[_0x7fa6('0x2b')](_0x5d8787,_0x7fa6('0x3d'));}catch(_0x546a05){logger[_0x7fa6('0x15')](_0x546a05);}return _0x5d8787['split']('.')[0x0];});};exports[_0x7fa6('0x80')]=function(_0x17c6ed,_0xfa782a,_0x3add39,_0x378913){var _0x690e26=util[_0x7fa6('0x7e')](_0x7fa6('0x81'),ISPEECH_API,_0xfa782a,_0x3add39,base64Encode(_0x17c6ed),_0x378913?util[_0x7fa6('0x7e')](_0x7fa6('0x82'),encodeURIComponent(_0x378913)):_0x7fa6('0x83'));return uploadFile(_0x690e26)[_0x7fa6('0x39')](function(_0x2e9054){return querystring[_0x7fa6('0x84')](_0x2e9054);});};exports[_0x7fa6('0x85')]=function(_0x3e18d2,_0x12619c){return sestek[_0x7fa6('0x86')](_0x3e18d2,_0x12619c)['then'](function(_0x4745ad){logger['info'](JSON['stringify'](_0x4745ad));var _0x22072e={'speech':_0x4745ad[_0x7fa6('0x87')],'action':_0x4745ad[_0x7fa6('0x88')]?_0x4745ad[_0x7fa6('0x88')]['CustomAction']:undefined,'actiondata':_0x4745ad[_0x7fa6('0x88')]?_0x4745ad[_0x7fa6('0x88')]['CustomActionData']:undefined};if(_0x4745ad[_0x7fa6('0x88')]&&_0x4745ad[_0x7fa6('0x88')]['AudioFromTts']){return base64Decode(_0x4745ad[_0x7fa6('0x88')][_0x7fa6('0x89')][_0x7fa6('0x8a')],path['resolve'](__dirname,'tmp',rs[_0x7fa6('0x49')](0x4)+_0x7fa6('0x28')))[_0x7fa6('0x39')](function(_0x1f5b11){_0x22072e[_0x7fa6('0x8b')]=_0x1f5b11;return _0x22072e;});}return _0x22072e;});};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 fce5606..7495801 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 _0x3bdd=['exports','./nda'];(function(_0x1bf6ca,_0x2a054b){var _0x4c47ff=function(_0x41d24f){while(--_0x41d24f){_0x1bf6ca['push'](_0x1bf6ca['shift']());}};_0x4c47ff(++_0x2a054b);}(_0x3bdd,0x1a9));var _0xd3bd=function(_0x1653f4,_0x2f3a96){_0x1653f4=_0x1653f4-0x0;var _0x25ad60=_0x3bdd[_0x1653f4];return _0x25ad60;};var nda=require(_0xd3bd('0x0'));module[_0xd3bd('0x1')]={'nda':nda}; \ No newline at end of file +var _0xa59f=['exports'];(function(_0x4a1dae,_0x5d04b7){var _0x41effd=function(_0x279736){while(--_0x279736){_0x4a1dae['push'](_0x4a1dae['shift']());}};_0x41effd(++_0x5d04b7);}(_0xa59f,0x7b));var _0xfa59=function(_0xe37b5c,_0x3054c3){_0xe37b5c=_0xe37b5c-0x0;var _0x51a670=_0xa59f[_0xe37b5c];return _0x51a670;};var nda=require('./nda');module[_0xfa59('0x0')]={'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 6c3990e..dbde85d 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 _0x43fd=['ndaactivity_type','Nda','uniqueid','calleridname','dnid','extension','text','project','body','ProjectName','channelData','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x4e502e,_0x2a7c94){var _0x25c957=function(_0x2f6f74){while(--_0x2f6f74){_0x4e502e['push'](_0x4e502e['shift']());}};_0x25c957(++_0x2a7c94);}(_0x43fd,0x150));var _0xd43f=function(_0x542f1b,_0xd52195){_0x542f1b=_0x542f1b-0x0;var _0x420ad1=_0x43fd[_0x542f1b];return _0x420ad1;};'use strict';var rp=require(_0xd43f('0x0'));var url=require(_0xd43f('0x1'));var logger=require('../../../../../config/logger')(_0xd43f('0x2'));module['exports']=function(_0x3ba8e5,_0x9f4756){var _0x2a99a2={'method':_0xd43f('0x3'),'uri':url[_0xd43f('0x4')](_0x9f4756[_0xd43f('0x5')],_0xd43f('0x6')),'form':{'grant_type':_0xd43f('0x7'),'username':_0x9f4756[_0xd43f('0x8')],'password':_0x9f4756[_0xd43f('0x7')]},'json':!![]};return rp(_0x2a99a2)[_0xd43f('0x9')](function(_0x2516ee){var _0x39a819={'method':_0xd43f('0x3'),'uri':url['resolve'](_0x9f4756[_0xd43f('0xa')],_0xd43f('0xb')),'body':{'type':_0x9f4756[_0xd43f('0xc')]||'message','channelId':_0xd43f('0xd'),'conversation':{'id':_0x3ba8e5[_0xd43f('0xe')]},'from':{'id':_0x3ba8e5['callerid'],'name':_0x3ba8e5[_0xd43f('0xf')]},'recipient':{'id':_0x3ba8e5[_0xd43f('0x10')],'name':_0x3ba8e5[_0xd43f('0x11')]},'text':_0x9f4756[_0xd43f('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2516ee['access_token']},'json':!![]};if(_0x9f4756[_0xd43f('0x13')]){_0x39a819[_0xd43f('0x14')]['channelData'][_0xd43f('0x15')]=_0x9f4756['project'];}if(_0x9f4756['ndagenerate_audio']=='1'){_0x39a819[_0xd43f('0x14')][_0xd43f('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd43f('0x17')};}if(_0x9f4756[_0xd43f('0x18')]){_0x39a819['body'][_0xd43f('0x16')][_0xd43f('0x19')]=_0x9f4756[_0xd43f('0x18')];if(_0x9f4756[_0xd43f('0x1a')]){_0x39a819[_0xd43f('0x14')]['channelData']['CustomActionData']=_0x9f4756['custom_action_data'];}}logger[_0xd43f('0x1b')](JSON[_0xd43f('0x1c')](_0x39a819));return rp(_0x39a819);});}; \ No newline at end of file +var _0x58e5=['stringify','request-promise','url','../../../../../config/logger','agi','exports','ndauth_url','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','extension','Bearer\x20','access_token','project','body','ProjectName','channelData','audio/wav','custom_action','custom_action_data','info'];(function(_0x24092b,_0x3f4ff0){var _0x5054bd=function(_0x2fdb5a){while(--_0x2fdb5a){_0x24092b['push'](_0x24092b['shift']());}};_0x5054bd(++_0x3f4ff0);}(_0x58e5,0xd1));var _0x558e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x58e5[_0x19950b];return _0x3c6b41;};'use strict';var rp=require(_0x558e('0x0'));var url=require(_0x558e('0x1'));var logger=require(_0x558e('0x2'))(_0x558e('0x3'));module[_0x558e('0x4')]=function(_0x319e46,_0x49a1b7){var _0x2f18ee={'method':'POST','uri':url['resolve'](_0x49a1b7[_0x558e('0x5')],'/token'),'form':{'grant_type':_0x558e('0x6'),'username':_0x49a1b7['username'],'password':_0x49a1b7[_0x558e('0x6')]},'json':!![]};return rp(_0x2f18ee)[_0x558e('0x7')](function(_0x533a69){var _0x58c368={'method':'POST','uri':url['resolve'](_0x49a1b7['ndassistant_url'],_0x558e('0x8')),'body':{'type':_0x49a1b7[_0x558e('0x9')]||'message','channelId':_0x558e('0xa'),'conversation':{'id':_0x319e46[_0x558e('0xb')]},'from':{'id':_0x319e46[_0x558e('0xc')],'name':_0x319e46[_0x558e('0xd')]},'recipient':{'id':_0x319e46['dnid'],'name':_0x319e46[_0x558e('0xe')]},'text':_0x49a1b7['text'],'channelData':{}},'headers':{'Authorization':_0x558e('0xf')+_0x533a69[_0x558e('0x10')]},'json':!![]};if(_0x49a1b7[_0x558e('0x11')]){_0x58c368[_0x558e('0x12')]['channelData'][_0x558e('0x13')]=_0x49a1b7[_0x558e('0x11')];}if(_0x49a1b7['ndagenerate_audio']=='1'){_0x58c368[_0x558e('0x12')][_0x558e('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x558e('0x15')};}if(_0x49a1b7['custom_action']){_0x58c368[_0x558e('0x12')][_0x558e('0x14')]['CustomAction']=_0x49a1b7[_0x558e('0x16')];if(_0x49a1b7[_0x558e('0x17')]){_0x58c368[_0x558e('0x12')][_0x558e('0x14')]['CustomActionData']=_0x49a1b7[_0x558e('0x17')];}}logger[_0x558e('0x18')](JSON[_0x558e('0x19')](_0x58c368));return rp(_0x58c368);});}; \ 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 f65c443..96b7a79 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 _0x3308=['exports','./lib/api'];(function(_0x37397d,_0x27b877){var _0x4c56bc=function(_0x16904d){while(--_0x16904d){_0x37397d['push'](_0x37397d['shift']());}};_0x4c56bc(++_0x27b877);}(_0x3308,0xe3));var _0x8330=function(_0x1e1023,_0x490aed){_0x1e1023=_0x1e1023-0x0;var _0x1a3ad5=_0x3308[_0x1e1023];return _0x1a3ad5;};'use strict';var asr=require(_0x8330('0x0'));module[_0x8330('0x1')]=function(_0x5acfee,_0x47a21b,_0x2da7d5,_0x3e7b5e){return asr(_0x5acfee,_0x47a21b,_0x2da7d5,_0x3e7b5e);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0xb7442d,_0x4b95e6,_0x5b6065,_0x36988d){return asr(_0xb7442d,_0x4b95e6,_0x5b6065,_0x36988d);}; \ 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 da106bf..7a489a9 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 _0xb745=['message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb745,0xc9));var _0x5b74=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xb745[_0x46f1a6];return _0x38429a;};'use strict';var BPromise=require(_0x5b74('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5b74('0x1'));var crypto=require(_0x5b74('0x2'));var logger=require(_0x5b74('0x3'))(_0x5b74('0x4'));module[_0x5b74('0x5')]=function(_0x48c0c4,_0x4f6d7c,_0x4d7b70,_0x31f1d4){return new BPromise(function(_0x4ddb83,_0x217257){logger[_0x5b74('0x6')](_0x5b74('0x7'),_0x31f1d4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4206ae=new WebSocket(_0x31f1d4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x539d95='';var _0x30e668='0';var _0xe37a44='1';var _0x199a86='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5b3f03(_0xb779c8){var _0x1d76a1=crypto[_0x5b74('0x8')](_0x5b74('0x9'));_0x1d76a1[_0x5b74('0xa')](_0xb779c8);return _0x1d76a1[_0x5b74('0xb')](_0x5b74('0xc'));}function _0x5bd9af(){try{logger[_0x5b74('0x6')](_0x5b74('0xd'));var _0x449887=moment()[_0x5b74('0xe')]();var _0x306202=_0x5b3f03(_0x449887+_0x4f6d7c+_0x4d7b70);_0x4206ae[_0x5b74('0xf')](JSON[_0x5b74('0x10')]({'appID':_0x4f6d7c,'timestamp':_0x449887,'appKey':_0x306202}));var _0x4a9a2a=fs[_0x5b74('0x11')](_0x48c0c4);_0x4a9a2a['on'](_0x5b74('0x12'),function(_0x144848){_0x4206ae[_0x5b74('0xf')](_0x144848);});_0x4a9a2a['on'](_0x5b74('0x13'),function(){_0x4206ae['send']('EOS');});}catch(_0x271d07){logger[_0x5b74('0x14')](_0x5b74('0x15'),JSON['stringify'](_0x271d07));_0x4206ae[_0x5b74('0x16')]();}}function _0x2ceb6c(_0x31a47e){try{if(_0x31a47e){var _0x521f41=JSON[_0x5b74('0x17')](_0x31a47e);switch(_0x521f41[_0x5b74('0x18')]){case 0x0:if(_0x521f41['result']){if(_0x521f41[_0x5b74('0x19')]['final']){logger[_0x5b74('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x5b74('0x10')](_0x521f41[_0x5b74('0x19')][_0x5b74('0x1a')]));_0x539d95=_0x521f41[_0x5b74('0x19')][_0x5b74('0x1a')][0x0][_0x5b74('0x1b')];_0x30e668=_0x521f41[_0x5b74('0x19')][_0x5b74('0x1a')][0x0][_0x5b74('0x1c')];_0xe37a44='0';_0x199a86=_0x5b74('0x1d');_0x4206ae['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xe37a44='1';_0x199a86='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x5b74('0x6')](_0x5b74('0x1e'));_0xe37a44='2';_0x199a86=_0x5b74('0x1e');break;case 0x9:logger[_0x5b74('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0xe37a44='9';_0x199a86=_0x5b74('0x1f');break;case 0xa:logger['info'](_0x5b74('0x20'));_0xe37a44='10';_0x199a86='Authentication\x20failed.';break;case 0xb:logger[_0x5b74('0x6')](_0x5b74('0x21'));_0xe37a44='11';_0x199a86=_0x5b74('0x21');}}}catch(_0x2b1baf){logger[_0x5b74('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x5b74('0x10')](_0x2b1baf));_0x4206ae[_0x5b74('0x16')]();}}function _0x4e8975(){logger['info'](_0x5b74('0x22'));_0x4ddb83({'transcript':_0x539d95,'confidence':_0x30e668,'status':_0xe37a44,'status_message':_0x199a86});}function _0xa2f534(_0x16e0e8){logger[_0x5b74('0x14')](_0x5b74('0x23'));if(!_[_0x5b74('0x24')](_0x16e0e8)){logger['error'](_[_0x5b74('0x25')](_0x16e0e8)?JSON[_0x5b74('0x10')](_0x16e0e8):_0x16e0e8);}}_0x4206ae['on'](_0x5b74('0x26'),_0x5bd9af);_0x4206ae['on'](_0x5b74('0x27'),_0x2ceb6c);_0x4206ae['on'](_0x5b74('0x13'),_0x4e8975);_0x4206ae['on'](_0x5b74('0x14'),_0xa2f534);});}; \ No newline at end of file +var _0x0b50=['createReadStream','data','send','close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','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.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x0b50,0x131));var _0x00b5=function(_0x18b477,_0x555d04){_0x18b477=_0x18b477-0x0;var _0x240b92=_0x0b50[_0x18b477];return _0x240b92;};'use strict';var BPromise=require(_0x00b5('0x0'));var _=require(_0x00b5('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x00b5('0x2'));var crypto=require(_0x00b5('0x3'));var logger=require(_0x00b5('0x4'))(_0x00b5('0x5'));module[_0x00b5('0x6')]=function(_0x4e3d79,_0x447cdf,_0x4c07a5,_0x1821a6){return new BPromise(function(_0x4ddd49,_0x38da60){logger[_0x00b5('0x7')](_0x00b5('0x8'),_0x1821a6||_0x00b5('0x9'));var _0x5540a1=new WebSocket(_0x1821a6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4d1ea6='';var _0x368f05='0';var _0x4d6853='1';var _0x578134='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x1939be(_0x147595){var _0x19ace4=crypto['createHash']('sha1');_0x19ace4['update'](_0x147595);return _0x19ace4[_0x00b5('0xa')](_0x00b5('0xb'));}function _0x3bf902(){try{logger[_0x00b5('0x7')](_0x00b5('0xc'));var _0x3a027e=moment()[_0x00b5('0xd')]();var _0xd1faba=_0x1939be(_0x3a027e+_0x447cdf+_0x4c07a5);_0x5540a1['send'](JSON[_0x00b5('0xe')]({'appID':_0x447cdf,'timestamp':_0x3a027e,'appKey':_0xd1faba}));var _0x5ed496=fs[_0x00b5('0xf')](_0x4e3d79);_0x5ed496['on'](_0x00b5('0x10'),function(_0xd69010){_0x5540a1[_0x00b5('0x11')](_0xd69010);});_0x5ed496['on'](_0x00b5('0x12'),function(){_0x5540a1['send'](_0x00b5('0x13'));});}catch(_0x4fbff1){logger['error'](_0x00b5('0x14'),JSON[_0x00b5('0xe')](_0x4fbff1));_0x5540a1['terminate']();}}function _0x3d875e(_0x2a8835){try{if(_0x2a8835){var _0x4af864=JSON[_0x00b5('0x15')](_0x2a8835);switch(_0x4af864[_0x00b5('0x16')]){case 0x0:if(_0x4af864['result']){if(_0x4af864[_0x00b5('0x17')][_0x00b5('0x18')]){logger[_0x00b5('0x7')]('Tilde\x20ASR\x20hypoteses',JSON[_0x00b5('0xe')](_0x4af864[_0x00b5('0x17')][_0x00b5('0x19')]));_0x4d1ea6=_0x4af864[_0x00b5('0x17')][_0x00b5('0x19')][0x0]['transcript'];_0x368f05=_0x4af864['result'][_0x00b5('0x19')][0x0][_0x00b5('0x1a')];_0x4d6853='0';_0x578134=_0x00b5('0x1b');_0x5540a1[_0x00b5('0x1c')]();}}break;case 0x1:logger[_0x00b5('0x7')](_0x00b5('0x1d'));_0x4d6853='1';_0x578134=_0x00b5('0x1d');break;case 0x2:logger[_0x00b5('0x7')](_0x00b5('0x1e'));_0x4d6853='2';_0x578134='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x00b5('0x1f'));_0x4d6853='9';_0x578134=_0x00b5('0x1f');break;case 0xa:logger[_0x00b5('0x7')](_0x00b5('0x20'));_0x4d6853='10';_0x578134=_0x00b5('0x20');break;case 0xb:logger['info'](_0x00b5('0x21'));_0x4d6853='11';_0x578134='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x57d764){logger[_0x00b5('0x22')](_0x00b5('0x23'),JSON[_0x00b5('0xe')](_0x57d764));_0x5540a1[_0x00b5('0x1c')]();}}function _0x591e7c(){logger[_0x00b5('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x4ddd49({'transcript':_0x4d1ea6,'confidence':_0x368f05,'status':_0x4d6853,'status_message':_0x578134});}function _0x5d9c87(_0x1a5235){logger[_0x00b5('0x22')](_0x00b5('0x24'));if(!_['isNil'](_0x1a5235)){logger['error'](_[_0x00b5('0x25')](_0x1a5235)?JSON['stringify'](_0x1a5235):_0x1a5235);}}_0x5540a1['on'](_0x00b5('0x26'),_0x3bf902);_0x5540a1['on'](_0x00b5('0x27'),_0x3d875e);_0x5540a1['on'](_0x00b5('0x12'),_0x591e7c);_0x5540a1['on'](_0x00b5('0x22'),_0x5d9c87);});}; \ 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 cb34a6e..f9569c0 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 _0x23a3=['exports'];(function(_0x4e3628,_0x4ccad1){var _0x22f46e=function(_0x176d23){while(--_0x176d23){_0x4e3628['push'](_0x4e3628['shift']());}};_0x22f46e(++_0x4ccad1);}(_0x23a3,0x15c));var _0x323a=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x23a3[_0x27beea];return _0x122645;};var asr=require('./asr');module[_0x323a('0x0')]={'asr':asr}; \ No newline at end of file +var _0x0361=['exports','./asr'];(function(_0x35681f,_0x122103){var _0xca27dc=function(_0x4deb8e){while(--_0x4deb8e){_0x35681f['push'](_0x35681f['shift']());}};_0xca27dc(++_0x122103);}(_0x0361,0x95));var _0x1036=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0361[_0x3ab51d];return _0x29a04e;};var asr=require(_0x1036('0x0'));module[_0x1036('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 08357d9..036f4bb 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 _0xe8cb=['close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code'];(function(_0x2c6717,_0x240ba5){var _0x5395f6=function(_0x4184c5){while(--_0x4184c5){_0x2c6717['push'](_0x2c6717['shift']());}};_0x5395f6(++_0x240ba5);}(_0xe8cb,0xa1));var _0xbe8c=function(_0x4dcfa1,_0x1fe748){_0x4dcfa1=_0x4dcfa1-0x0;var _0x2daeb1=_0xe8cb[_0x4dcfa1];return _0x2daeb1;};'use strict';var util=require(_0xbe8c('0x0'));var net=require(_0xbe8c('0x1'));var EventEmitter=require(_0xbe8c('0x2'))[_0xbe8c('0x3')];var AGIError=require(_0xbe8c('0x4'));var AGIChannel=require(_0xbe8c('0x5'));var AGIServer=function(_0x26358e,_0xe52c7c,_0x3d98c8){var _0x382f66=this,_0x26358e=_0x26358e||0x11dd,_0xe52c7c=_0xe52c7c||'127.0.0.1',_0x80b269=null,_0x533569=0x0;EventEmitter[_0xbe8c('0x6')](_0x382f66);function _0x274077(){if(!_0x26358e){_0x382f66[_0xbe8c('0x7')](_0xbe8c('0x8'),new AGIError(_0xbe8c('0x9')));return![];}_0x80b269=net[_0xbe8c('0xa')]();_0x80b269[_0xbe8c('0xb')](_0x26358e,_0xe52c7c);_0x80b269['on'](_0xbe8c('0xc'),function(){_0x382f66[_0xbe8c('0x7')](_0xbe8c('0xc'));});_0x80b269['on'](_0xbe8c('0xd'),function(_0x1f3886){_0x80b269[_0xbe8c('0xe')](function(_0x48f2a1,_0x19b53d){if(_0x48f2a1){_0x382f66['emit'](_0xbe8c('0x8'),new AGIError(_0xbe8c('0xf'),_0x48f2a1));}else if(_0x3d98c8&&_0x3d98c8<0x0){_0x382f66[_0xbe8c('0x7')]('error',new AGIError(_0xbe8c('0x10')));_0x1f3886[_0xbe8c('0x11')]();}else if(_0x3d98c8&&_0x3d98c8>0x0&&_0x3d98c8<_0x19b53d){_0x533569+=0x1;_0x382f66[_0xbe8c('0x7')]('error',new AGIError(_0xbe8c('0x12'),_0x533569));_0x1f3886['destroy']();}else{var _0x3f2559=new AGIChannel(_0x1f3886);_0x3f2559['on'](_0xbe8c('0x13'),function(){_0x382f66[_0xbe8c('0x7')]('connection',_0x3f2559);});}});});_0x80b269['on'](_0xbe8c('0x8'),function(_0x4bce6d){_0x382f66[_0xbe8c('0x7')](_0xbe8c('0x8'),new AGIError(_0xbe8c('0xf'),_0x4bce6d[_0xbe8c('0x14')]));});_0x80b269['on'](_0xbe8c('0x15'),function(){_0x382f66[_0xbe8c('0x7')](_0xbe8c('0x15'),new AGIError(_0xbe8c('0x16')));});}process[_0xbe8c('0x17')](function(){_0x274077();});};util[_0xbe8c('0x18')](AGIServer,EventEmitter);module[_0xbe8c('0x19')]=function(_0x5c1990,_0x5447c3,_0x7ef6c7){return new AGIServer(_0x5c1990,_0x5447c3,_0x7ef6c7);}; \ No newline at end of file +var _0x8c33=['createServer','listen','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','nextTick','inherits','exports','util','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT'];(function(_0xaaeb1e,_0x1b3c21){var _0x1cfb3c=function(_0x1a4b79){while(--_0x1a4b79){_0xaaeb1e['push'](_0xaaeb1e['shift']());}};_0x1cfb3c(++_0x1b3c21);}(_0x8c33,0x7c));var _0x38c3=function(_0xe84074,_0xaf6bcf){_0xe84074=_0xe84074-0x0;var _0x4de41a=_0x8c33[_0xe84074];return _0x4de41a;};'use strict';var util=require(_0x38c3('0x0'));var net=require('net');var EventEmitter=require('events')[_0x38c3('0x1')];var AGIError=require(_0x38c3('0x2'));var AGIChannel=require(_0x38c3('0x3'));var AGIServer=function(_0x45a3b5,_0x4a817e,_0x208a7e){var _0x3a0e7f=this,_0x45a3b5=_0x45a3b5||0x11dd,_0x4a817e=_0x4a817e||_0x38c3('0x4'),_0x26f8bb=null,_0x444e28=0x0;EventEmitter[_0x38c3('0x5')](_0x3a0e7f);function _0x465dc2(){if(!_0x45a3b5){_0x3a0e7f['emit'](_0x38c3('0x6'),new AGIError(_0x38c3('0x7')));return![];}_0x26f8bb=net[_0x38c3('0x8')]();_0x26f8bb[_0x38c3('0x9')](_0x45a3b5,_0x4a817e);_0x26f8bb['on']('listening',function(){_0x3a0e7f[_0x38c3('0xa')]('listening');});_0x26f8bb['on'](_0x38c3('0xb'),function(_0x214990){_0x26f8bb[_0x38c3('0xc')](function(_0x1c62b7,_0x2c47d8){if(_0x1c62b7){_0x3a0e7f['emit'](_0x38c3('0x6'),new AGIError(_0x38c3('0xd'),_0x1c62b7));}else if(_0x208a7e&&_0x208a7e<0x0){_0x3a0e7f[_0x38c3('0xa')](_0x38c3('0x6'),new AGIError(_0x38c3('0xe')));_0x214990[_0x38c3('0xf')]();}else if(_0x208a7e&&_0x208a7e>0x0&&_0x208a7e<_0x2c47d8){_0x444e28+=0x1;_0x3a0e7f['emit']('error',new AGIError(_0x38c3('0x10'),_0x444e28));_0x214990[_0x38c3('0xf')]();}else{var _0x31f4ad=new AGIChannel(_0x214990);_0x31f4ad['on']('ready',function(){_0x3a0e7f[_0x38c3('0xa')](_0x38c3('0xb'),_0x31f4ad);});}});});_0x26f8bb['on'](_0x38c3('0x6'),function(_0x17db48){_0x3a0e7f[_0x38c3('0xa')](_0x38c3('0x6'),new AGIError(_0x38c3('0xd'),_0x17db48[_0x38c3('0x11')]));});_0x26f8bb['on']('close',function(){_0x3a0e7f[_0x38c3('0xa')](_0x38c3('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x38c3('0x13')](function(){_0x465dc2();});};util[_0x38c3('0x14')](AGIServer,EventEmitter);module[_0x38c3('0x15')]=function(_0x9976bb,_0x80bd5d,_0x48f9e6){return new AGIServer(_0x9976bb,_0x80bd5d,_0x48f9e6);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 1495e61..5cdf5f4 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 _0x4ca7=['no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','command','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','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','replaceAll','join','exports','path','util','lodash','odbc','randomstring','request-promise','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','arg_1','callerid','createSquareRecording','extension','priority','accountcode','file','createCmContact','isEmpty','random','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','format','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','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','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','label','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','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','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','grammar','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','createSquareMessage','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','unlink','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','variable_id','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','.wav','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x392a71,_0x2b6f0d){_0x392a71=_0x392a71-0x0;var _0x538eb0=_0x4ca7[_0x392a71];return _0x538eb0;};'use strict';var fs=require('fs');var path=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var _=require(_0x74ca('0x2'));var sh=require('shelljs');var odbc=require(_0x74ca('0x3'))();var rs=require(_0x74ca('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x74ca('0x5'));var logger=require('../../config/logger')(_0x74ca('0x6'));var config=require(_0x74ca('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x74ca('0x8');var recursiveMapAttributes=['rawHeaders',_0x74ca('0x9')];var verticesWithRetry=[_0x74ca('0xa'),_0x74ca('0xb'),_0x74ca('0xc')];var AGIVertices=function(_0xec5de5,_0x33507a,_0x116715){this['channel']=_0xec5de5;this[_0x74ca('0xd')]=_0x33507a;this['mailRpc']=_0x116715;};AGIVertices[_0x74ca('0xe')][_0x74ca('0xf')]=function(_0x5bf3eb,_0x27f6f7){this[_0x74ca('0xd')][_0x74ca('0x10')](_0x5bf3eb)[_0x74ca('0x11')](function(_0x13423a){_0x27f6f7(null,_0x13423a?_0x13423a[_0x74ca('0x12')]:![]);})[_0x74ca('0x13')](function(_0x3ace02){_0x27f6f7(_0x3ace02);});};AGIVertices['prototype'][_0x74ca('0x14')]=function(_0x1d649c,_0x85ab5f){this[_0x74ca('0xd')][_0x74ca('0x15')](_0x1d649c)[_0x74ca('0x11')](function(_0xf72dc){_0x85ab5f(null,_0xf72dc?_0xf72dc[_0x74ca('0x12')]:![]);})[_0x74ca('0x13')](function(_0x196b51){_0x85ab5f(_0x196b51);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x16')]=function(_0x1f11a7,_0x42b90e){this['rpc'][_0x74ca('0x17')](_0x1f11a7)[_0x74ca('0x11')](function(_0xdc8fc7){_0x42b90e(null,_0xdc8fc7?_0xdc8fc7[_0x74ca('0x12')]:![]);})[_0x74ca('0x13')](function(_0x5769e1){_0x42b90e(_0x5769e1);});};AGIVertices['prototype'][_0x74ca('0x18')]=function(_0x13ad11,_0x1e7b92){this[_0x74ca('0xd')][_0x74ca('0x19')](_0x13ad11)[_0x74ca('0x11')](function(_0x4eab63){_0x1e7b92(null,_0x4eab63?_0x4eab63[_0x74ca('0x1a')]:![]);})[_0x74ca('0x13')](function(_0x4a85a5){_0x1e7b92(_0x4a85a5);});};AGIVertices['prototype']['getUser']=function(_0x22be63,_0x2f7bb1){this[_0x74ca('0xd')][_0x74ca('0x1b')](_0x22be63)[_0x74ca('0x11')](function(_0x1cae32){_0x2f7bb1(null,_0x1cae32?_0x1cae32[_0x74ca('0x12')]:![]);})[_0x74ca('0x13')](function(_0x1ceb6c){_0x2f7bb1(_0x1ceb6c);});};AGIVertices[_0x74ca('0xe')]['getTrunk']=function(_0x4c020c,_0x1aeded){this[_0x74ca('0xd')][_0x74ca('0x1c')](_0x4c020c)[_0x74ca('0x11')](function(_0x3ef087){_0x1aeded(null,_0x3ef087?_0x3ef087['name']:![]);})[_0x74ca('0x13')](function(_0x13ef53){_0x1aeded(_0x13ef53);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x1d')]=function(_0x262978,_0x529ace){var _0x227930=this;this[_0x74ca('0xd')][_0x74ca('0x1e')](_0x262978)[_0x74ca('0x11')](function(_0x3491ef){_0x529ace(null,_0x3491ef?_0x227930[_0x74ca('0x1f')](_0x3491ef['save_name']):![]);})['catch'](function(_0x42e048){_0x529ace(_0x42e048);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x20')]=function(_0x27da17,_0x92cc29){this['rpc'][_0x74ca('0x21')](_0x27da17)[_0x74ca('0x11')](function(_0x52f02e){_0x92cc29(null,_0x52f02e?_0x52f02e:![]);})[_0x74ca('0x13')](function(_0x3d0800){_0x92cc29(_0x3d0800);});};AGIVertices['prototype'][_0x74ca('0x22')]=function(_0x761513,_0x130a4f,_0xf4972b){this[_0x74ca('0x23')][_0x74ca('0x22')](_0x761513,_0x130a4f)[_0x74ca('0x11')](function(){_0xf4972b(null);})['catch'](function(_0x4d3f62){_0xf4972b(_0x4d3f62);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x24')]=function(_0x3c140d,_0x1881a0){this[_0x74ca('0xd')][_0x74ca('0x25')](_0x3c140d)[_0x74ca('0x11')](function(_0x5466e3){if(_0x5466e3){if(_0x5466e3[_0x74ca('0x26')]){_0x1881a0(null,[_0x5466e3[_0x74ca('0x27')]]);}else{_0x1881a0(null,_[_0x74ca('0x28')](_0x5466e3[_0x74ca('0x29')],_0x74ca('0x27')));}}else{_0x1881a0(null,![]);}})[_0x74ca('0x13')](function(_0x3eacf8){_0x1881a0(_0x3eacf8);});};AGIVertices[_0x74ca('0xe')]['getSoundPath']=function(_0x3d4e45){return util['format'](_0x74ca('0x2a'),FILES_PATH,_0x3d4e45);};AGIVertices['prototype'][_0x74ca('0x2b')]=function(_0x1430c9,_0x54bb1d,_0x3413eb){odbc[_0x74ca('0x2c')](_0x1430c9,function(_0x4b0829){if(_0x4b0829){logger[_0x74ca('0x2d')](_0x74ca('0x2e'),_0x4b0829);_0x3413eb(_0x4b0829);}else{logger['info'](_0x74ca('0x2f'));odbc['query'](_0x54bb1d,function(_0x39fc9a,_0x2b910d){if(_0x39fc9a){logger[_0x74ca('0x30')](_0x74ca('0x31'),_0x54bb1d);_0x3413eb(_0x39fc9a);}else{logger[_0x74ca('0x30')](_0x74ca('0x32'),_0x54bb1d);odbc[_0x74ca('0x33')](function(_0x4c1635){if(_0x4c1635){logger[_0x74ca('0x2d')](_0x74ca('0x34'),_0x4c1635);}_0x3413eb(null,_0x2b910d);});}});}});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x35')]=function(_0x3e8870,_0x145994){this[_0x74ca('0xd')][_0x74ca('0x36')](_0x3e8870)[_0x74ca('0x11')](function(_0x43a3ed){_0x145994(null,_0x43a3ed?_0x43a3ed:![]);})[_0x74ca('0x13')](function(_0x5b07e8){_0x145994(_0x5b07e8);});};AGIVertices['prototype'][_0x74ca('0x37')]=function(_0x10875d,_0x5ca35b){this[_0x74ca('0xd')]['createSmsMessage'](_0x10875d)[_0x74ca('0x11')](function(_0x2e9a37){_0x5ca35b(null,_0x2e9a37);})[_0x74ca('0x13')](function(_0x2ee173){_0x5ca35b(_0x2ee173);});};AGIVertices['prototype'][_0x74ca('0x38')]=function(_0x15a093,_0x2f3685,_0x360b37){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x74ca('0x39')][_0x74ca('0x3a')],'node':_0x15a093['label'],'application':_0x15a093['agicommand'],'data':_0x2f3685||null,'project_name':this[_0x74ca('0x39')][_0x74ca('0x3b')],'callerid':this[_0x74ca('0x39')][_0x74ca('0x3c')]})['then'](function(_0x5198c6){if(_0x360b37){_0x360b37(null,_0x5198c6);}})['catch'](function(_0x117f98){if(_0x360b37){_0x360b37(_0x117f98);}});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x3d')]=function(_0x2957b7,_0x4d9874,_0x58ec1b,_0xa75116){this[_0x74ca('0xd')][_0x74ca('0x3d')]({'uniqueid':this[_0x74ca('0x39')][_0x74ca('0x3a')],'callerid':this[_0x74ca('0x39')][_0x74ca('0x3c')],'calleridname':this[_0x74ca('0x39')]['calleridname'],'context':this[_0x74ca('0x39')]['context'],'extension':this[_0x74ca('0x39')][_0x74ca('0x3e')],'priority':this[_0x74ca('0x39')][_0x74ca('0x3f')],'accountcode':this[_0x74ca('0x39')][_0x74ca('0x40')],'dnid':this[_0x74ca('0x39')]['dnid'],'projectName':this[_0x74ca('0x39')][_0x74ca('0x3b')],'saveName':_0x4d9874,'filename':_0x2957b7[_0x74ca('0x41')]||_0x4d9874,'savePath':_0x58ec1b})[_0x74ca('0x11')](function(_0x5dddd3){_0xa75116(null,_0x5dddd3);})[_0x74ca('0x13')](function(_0x337b97){_0xa75116(_0x337b97);});};AGIVertices[_0x74ca('0xe')]['createSquareMessage']=function(_0x50aa19,_0x269e65,_0x3a0d02,_0x42ed76,_0x516f8e){this[_0x74ca('0xd')]['createSquareMessage']({'uniqueid':this[_0x74ca('0x39')][_0x74ca('0x3a')],'body':_0x50aa19,'direction':_0x269e65,'providerName':_0x3a0d02,'providerResponse':_0x42ed76})[_0x74ca('0x11')](function(_0x74d6a0){if(_0x516f8e){_0x516f8e(null,_0x74d6a0);}})['catch'](function(_0x3c4ef6){if(_0x516f8e){_0x516f8e(_0x3c4ef6);}});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x42')]=function(_0x2ae0b8,_0x3d68f6){this['rpc'][_0x74ca('0x42')]({'firstName':_[_0x74ca('0x43')](_0x2ae0b8[_0x74ca('0x12')])||_['isNil'](_0x2ae0b8[_0x74ca('0x12')])?'callback_'+Math[_0x74ca('0x44')]():_0x2ae0b8[_0x74ca('0x12')],'lastName':_[_0x74ca('0x43')](_0x2ae0b8[_0x74ca('0x45')])||_[_0x74ca('0x46')](_0x2ae0b8[_0x74ca('0x45')])?null:_0x2ae0b8[_0x74ca('0x45')],'phone':_0x2ae0b8[_0x74ca('0x47')],'ListId':_0x2ae0b8[_0x74ca('0x48')],'scheduledat':_0x2ae0b8[_0x74ca('0x49')],'callbackUniqueid':this['channel'][_0x74ca('0x3a')],'tags':_0x74ca('0x4a'),'description':_0x74ca('0x4b')+_0x2ae0b8[_0x74ca('0x49')][_0x74ca('0x4c')](),'priority':_0x2ae0b8[_0x74ca('0x4d')]})[_0x74ca('0x11')](function(_0x3bfa45){_0x3d68f6(null,_0x3bfa45);})[_0x74ca('0x13')](function(_0x1c18c1){_0x3d68f6(_0x1c18c1);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x4e')]=function(_0x2bbebf,_0x152a0e){this[_0x74ca('0xd')][_0x74ca('0x4f')](_0x2bbebf)['then'](function(_0x2be321){_0x152a0e(null,_0x2be321?_0x2be321[_0x74ca('0x12')]:![]);})['catch'](function(_0x55139e){_0x152a0e(_0x55139e);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x50')]=function(_0x15b9fa,_0x2b7d42,_0x51c7c9){var _0x234120={'role':_0x74ca('0x51')};_0x234120[_0x15b9fa]=this[_0x74ca('0x39')][_0x74ca('0x3c')];this[_0x74ca('0xd')][_0x74ca('0x50')](_0x234120,_0x2b7d42,this['channel']['uniqueid'])[_0x74ca('0x11')](function(_0xa8f708){_0x51c7c9(null,_[_0x74ca('0x46')](_0xa8f708)?![]:!![]);})[_0x74ca('0x13')](function(_0x31dba8){logger[_0x74ca('0x2d')](_0x31dba8);_0x51c7c9(null,![]);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x52')]=function(_0x165ea6,_0x411d29){var _0x572e4e={'role':'agent'};_0x572e4e[_0x165ea6]=this[_0x74ca('0x39')][_0x74ca('0x3c')];this[_0x74ca('0xd')]['agentUnpause'](_0x572e4e)[_0x74ca('0x11')](function(_0x19f4cf){_0x411d29(null,_[_0x74ca('0x46')](_0x19f4cf)?![]:!![]);})['catch'](function(_0x1a8ad6){logger[_0x74ca('0x2d')](_0x1a8ad6);_0x411d29(null,![]);});};AGIVertices['prototype'][_0x74ca('0x53')]=function(_0xbfb8e1,_0x56d3e2){var _0x29ab6b={'role':_0x74ca('0x51')};_0x29ab6b[_0xbfb8e1]=this['channel'][_0x74ca('0x3c')];this[_0x74ca('0xd')][_0x74ca('0x53')](_0x29ab6b)[_0x74ca('0x11')](function(_0x3fa3f8){_0x56d3e2(null,_[_0x74ca('0x46')](_0x3fa3f8)?![]:!![]);})[_0x74ca('0x13')](function(_0xa6e574){logger[_0x74ca('0x2d')](_0xa6e574);_0x56d3e2(null,![]);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x54')]=function(_0x18b074,_0xa709fa){var _0x384c48={'role':_0x74ca('0x51')};_0x384c48[_0x18b074]=this[_0x74ca('0x39')][_0x74ca('0x3c')];var _0x29fc24=_0x18b074!='internal'?util[_0x74ca('0x55')](_0x74ca('0x56'),'LOCAL',this[_0x74ca('0x39')][_0x74ca('0x3c')]):undefined;this[_0x74ca('0xd')]['agentLogin'](_0x384c48,_0x29fc24)['then'](function(_0x507e77){_0xa709fa(null,_['isNil'](_0x507e77)?![]:!![]);})['catch'](function(_0x9a5dce){logger[_0x74ca('0x2d')](_0x9a5dce);_0xa709fa(null,![]);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x57')]=function(_0x2eaae7,_0xc8749c){sh[_0x74ca('0x58')](_[_0x74ca('0x59')](_0x2eaae7),function(_0x57677b,_0x5559de){var _0x18c8a8=_0x5559de[_0x74ca('0x5a')](/(\r\n|\n|\r)/gm,'');_0xc8749c(null,_0x18c8a8);});};AGIVertices[_0x74ca('0xe')]['googleCloudTTS']=function(_0x4b727a,_0x497dfb){scripts[_0x74ca('0x5b')](_0x4b727a[_0x74ca('0x5c')],_0x4b727a[_0x74ca('0x5d')]||'text',_0x4b727a[_0x74ca('0x5e')],_0x4b727a[_0x74ca('0x5f')]||'en-US',_0x4b727a[_0x74ca('0x60')]||_0x74ca('0x61'),_0x4b727a[_0x74ca('0x62')]||_0x74ca('0x63'))[_0x74ca('0x11')](function(_0x490886){_0x497dfb(null,_0x490886);})[_0x74ca('0x13')](function(_0x1a86ef){_0x497dfb(_0x1a86ef);});};AGIVertices['prototype'][_0x74ca('0x64')]=function(_0x31057a,_0x429efd){scripts[_0x74ca('0x64')](_0x31057a['text'],_0x31057a['google_tts_language']||'en',0x1)[_0x74ca('0x11')](function(_0x59789e){_0x429efd(null,_0x59789e);})[_0x74ca('0x13')](function(_0x369a7a){_0x429efd(_0x369a7a);});};AGIVertices['prototype'][_0x74ca('0x65')]=function(_0x3cacad,_0x15fafb){var _0x1ea9b9={'uri':_0x3cacad[_0x74ca('0x66')],'method':_0x3cacad['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3cacad[_0x74ca('0x67')])===_0x74ca('0x68')&&parseInt(_0x3cacad[_0x74ca('0x67')])>=0x1?parseInt(_0x3cacad[_0x74ca('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x74ca('0x69')]([_0x74ca('0x6a'),_0x74ca('0x6b')],_0x1ea9b9[_0x74ca('0x6c')][_0x74ca('0x6d')]())){try{_0x1ea9b9[_0x74ca('0x6e')]=_0x3cacad[_0x74ca('0x9')]?JSON[_0x74ca('0x6f')](_0x3cacad['rawBody']):{};}catch(_0x2259d0){logger[_0x74ca('0x2d')](_0x74ca('0x70'),_0x2259d0);}}try{_0x1ea9b9[_0x74ca('0x71')]=_0x3cacad[_0x74ca('0x72')]?JSON[_0x74ca('0x6f')](_0x3cacad[_0x74ca('0x72')]):{};}catch(_0x1c3462){logger[_0x74ca('0x2d')](_0x74ca('0x73'),_0x1c3462);}if(_0x3cacad[_0x74ca('0x74')]){try{var _0x2ca16f=require(_0x3cacad[_0x74ca('0x74')])[_0x74ca('0x75')](this,_0x1ea9b9);_0x1ea9b9[_0x74ca('0x76')]=Mustache['render'](_0x3cacad['url'],_0x2ca16f,{},['$$','$$']);if(_0x1ea9b9['headers']){_0x1ea9b9[_0x74ca('0x71')]=JSON['parse'](Mustache[_0x74ca('0x77')](JSON[_0x74ca('0x78')](_0x1ea9b9['headers']),_0x2ca16f,{},['$$','$$']));}if(_0x1ea9b9[_0x74ca('0x6e')]){_0x1ea9b9[_0x74ca('0x6e')]=JSON[_0x74ca('0x6f')](Mustache[_0x74ca('0x77')](JSON[_0x74ca('0x78')](_0x1ea9b9[_0x74ca('0x6e')]),_0x2ca16f,{},['$$','$$']));}}catch(_0x2e4e96){logger[_0x74ca('0x2d')](_0x74ca('0x79'),_0x2e4e96);}}rp(_0x1ea9b9)[_0x74ca('0x11')](function(_0x34f02b){var _0x171e98={'statusCode':_0x34f02b[_0x74ca('0x7a')]||0xc8,'statusMessage':_0x34f02b[_0x74ca('0x7b')]||'OK','headers':_0x34f02b[_0x74ca('0x71')]||{},'body':_0x34f02b[_0x74ca('0x6e')]||{}};_0x15fafb(null,_0x171e98);})['catch'](function(_0x40feca){var _0x9679ba={'statusCode':_0x40feca['statusCode']||0x1f4,'statusMessage':_0x40feca[_0x74ca('0x7c')]||_0x74ca('0x7d'),'headers':_0x40feca[_0x74ca('0x7e')]['headers']||{},'body':_0x40feca[_0x74ca('0x7e')][_0x74ca('0x6e')]||{}};_0x15fafb(null,_0x9679ba);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x7f')]=function(_0x51aa5e,_0x43bcee){scripts[_0x74ca('0x7f')](this[_0x74ca('0x39')]['uniqueid'],_0x51aa5e[_0x74ca('0x80')],_0x51aa5e[_0x74ca('0x5e')],_0x51aa5e['dialogflow_language']||'en')[_0x74ca('0x11')](function(_0xc16735){_0x43bcee(null,_0xc16735);})[_0x74ca('0x13')](function(_0x382672){_0x43bcee(_0x382672);});};AGIVertices[_0x74ca('0xe')]['googleDialogflowV2']=function(_0x59307c,_0x3466b6){scripts[_0x74ca('0x81')](this[_0x74ca('0x39')]['uniqueid'],_0x59307c[_0x74ca('0x82')],_0x59307c[_0x74ca('0x83')],_0x59307c[_0x74ca('0x84')],_0x59307c[_0x74ca('0x5e')],_0x59307c[_0x74ca('0x85')]||'en')[_0x74ca('0x11')](function(_0x2ca374){_0x3466b6(null,_0x2ca374);})[_0x74ca('0x13')](function(_0x635e59){_0x3466b6(_0x635e59);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x86')]=function(_0x5751ef,_0xf7ca2c){scripts['sestekNDA'](this['channel'],_0x5751ef)[_0x74ca('0x11')](function(_0x3dba73){_0xf7ca2c(null,_0x3dba73);})[_0x74ca('0x13')](function(_0x3361b7){_0xf7ca2c(_0x3361b7);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x87')]=function(_0x4e52c7,_0x3a163d){scripts[_0x74ca('0x87')](_0x4e52c7['key'],_0x4e52c7[_0x74ca('0x5e')],_0x4e52c7[_0x74ca('0x88')]||'en-US',_0x4e52c7[_0x74ca('0x89')])[_0x74ca('0x11')](function(_0x476f52){_0x3a163d(null,_0x476f52);})[_0x74ca('0x13')](function(_0x7c68a2){_0x3a163d(_0x7c68a2);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x8a')]=function(_0x2790b7,_0x250ed5,_0x1fc629){scripts['ispeechASR'](_0x250ed5,_0x2790b7[_0x74ca('0x80')],_0x2790b7[_0x74ca('0x8b')]||_0x74ca('0x8c'),this[_0x74ca('0x8d')](_0x2790b7[_0x74ca('0x8e')])?_0x2790b7['model']:undefined)['then'](function(_0x383928){_0x1fc629(null,_0x383928);})[_0x74ca('0x13')](function(_0x4de8e3){_0x1fc629(_0x4de8e3);});};AGIVertices['prototype'][_0x74ca('0x8f')]=function(_0x631731,_0x32773a){scripts['awsPolly'](_0x631731['aws_access_key_id'],_0x631731[_0x74ca('0x90')],_0x631731[_0x74ca('0x91')],_0x631731['aws_polly_voice']||'Amy',_0x631731[_0x74ca('0x5e')],_0x631731['aws_text_type']||_0x74ca('0x5e'))[_0x74ca('0x11')](function(_0x44992f){_0x32773a(null,_0x44992f);})[_0x74ca('0x13')](function(_0x3a142a){_0x32773a(_0x3a142a);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x92')]=function(_0x5d9a9a,_0x119b0e){scripts[_0x74ca('0x92')](this[_0x74ca('0x39')]['uniqueid'],_0x5d9a9a[_0x74ca('0x93')],_0x5d9a9a[_0x74ca('0x90')],_0x5d9a9a[_0x74ca('0x94')],_0x5d9a9a[_0x74ca('0x5e')],_0x5d9a9a[_0x74ca('0x95')])[_0x74ca('0x11')](function(_0x1a14af){_0x119b0e(null,_0x1a14af);})[_0x74ca('0x13')](function(_0xf635ac){_0x119b0e(_0xf635ac);});};AGIVertices['prototype'][_0x74ca('0x96')]=function(_0x2b2c80,_0x1f73cd,_0x4223e0){scripts['googleASR'](_0x1f73cd,_0x2b2c80[_0x74ca('0x80')],_0x2b2c80[_0x74ca('0x97')]||_0x74ca('0x8c'))[_0x74ca('0x11')](function(_0x545d23){_0x4223e0(null,_0x545d23);})[_0x74ca('0x13')](function(_0x4743fa){_0x4223e0(_0x4743fa);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x98')]=function(_0x2221f3,_0x648e3c,_0x16b525){scripts[_0x74ca('0x98')](_0x648e3c,_0x2221f3[_0x74ca('0x99')],_0x2221f3[_0x74ca('0x9a')],_0x2221f3['uri'])[_0x74ca('0x11')](function(_0x1047b4){_0x16b525(null,_0x1047b4);})['catch'](function(_0x1db6a4){_0x16b525(_0x1db6a4);});};AGIVertices[_0x74ca('0xe')][_0x74ca('0x9b')]=function(_0x44ad1a){var _0x26cfd0=_[_0x74ca('0x69')](verticesWithRetry,_0x44ad1a['agicommand'])?_0x44ad1a:_[_0x74ca('0x9c')](_0x44ad1a);for(var _0x54cdf3 in _0x26cfd0){if(_0x26cfd0[_0x74ca('0x9d')](_0x54cdf3)){if(_0x26cfd0[_0x54cdf3]&&_[_0x74ca('0x9e')](_0x26cfd0[_0x54cdf3])){if(_[_0x74ca('0x69')](recursiveMapAttributes,_0x54cdf3)){_0x26cfd0[_0x54cdf3]=this[_0x74ca('0x9f')](_0x26cfd0[_0x54cdf3]);}else{_0x26cfd0[_0x54cdf3]=this[_0x74ca('0xa0')](_0x26cfd0[_0x54cdf3]);}}}}return _0x26cfd0;};AGIVertices['prototype'][_0x74ca('0xa1')]=function(_0x42ca69){for(var _0x2d7e23 in _0x42ca69){if(_0x42ca69[_0x74ca('0x9d')](_0x2d7e23)){if(_['isPlainObject'](_0x42ca69[_0x2d7e23])){this['recursiveNodeIndex'](_0x42ca69[_0x2d7e23]);}else if(_[_0x74ca('0xa2')](_0x42ca69[_0x2d7e23])){for(var _0x2a3a62=0x0;_0x2a3a62<_0x42ca69[_0x2d7e23][_0x74ca('0xa3')];_0x2a3a62++){this[_0x74ca('0xa1')](_0x42ca69[_0x2d7e23][_0x2a3a62]);}}else if(_[_0x74ca('0x9e')](_0x42ca69[_0x2d7e23])){_0x42ca69[_0x2d7e23]=this[_0x74ca('0xa0')](_0x42ca69[_0x2d7e23]);}}}};AGIVertices[_0x74ca('0xe')][_0x74ca('0xa4')]=function(_0x5389f8,_0x24c633){for(var _0x1cc8bc in _0x5389f8){if(_0x5389f8[_0x74ca('0x9d')](_0x1cc8bc)){if(_[_0x74ca('0xa5')](_0x5389f8[_0x1cc8bc])){if(!_[_0x74ca('0x43')](_0x5389f8[_0x1cc8bc])){this[_0x74ca('0xa4')](_0x5389f8[_0x1cc8bc],util[_0x74ca('0x55')](_0x74ca('0xa6'),_0x24c633,_0x1cc8bc));}}else if(_[_0x74ca('0xa2')](_0x5389f8[_0x1cc8bc])){for(var _0x353eca=0x0;_0x353eca<_0x5389f8[_0x1cc8bc][_0x74ca('0xa3')];_0x353eca++){this[_0x74ca('0xa4')](_0x5389f8[_0x1cc8bc][_0x353eca],util['format'](_0x74ca('0xa6'),_0x24c633,_0x1cc8bc+'['+_0x353eca+']'));}}else{if(!_[_0x74ca('0x46')](_0x5389f8[_0x1cc8bc])){this['channel'][_0x74ca('0xa7')](util[_0x74ca('0x55')]('%s.%s',_0x24c633,_0x1cc8bc),_0x5389f8[_0x1cc8bc]);}}}}};AGIVertices[_0x74ca('0xe')][_0x74ca('0x9f')]=function(_0x2fb480){try{var _0x44987c=JSON['parse'](_0x2fb480);this['recursiveNodeIndex'](_0x44987c);return JSON[_0x74ca('0x78')](_0x44987c);}catch(_0x32e429){return this[_0x74ca('0xa0')](_0x2fb480);}};AGIVertices[_0x74ca('0xe')]['replaceAllVariables']=function(_0x7df75a){var _0x19f5b5=_0x7df75a[_0x74ca('0xa8')]('{');for(var _0x4689b6=0x1;_0x4689b6<_0x19f5b5[_0x74ca('0xa3')];_0x4689b6+=0x1){var _0x2a9548=_0x19f5b5[_0x4689b6]['split']('}');if(_0x2a9548['length']>0x1){_0x7df75a=_0x7df75a['replaceAll']('{'+_0x2a9548[0x0]+'}',this[_0x74ca('0x39')][_0x74ca('0xf')](_0x2a9548[0x0])[_0x74ca('0xa9')]||_0x2a9548[0x0]);}}if(_0x19f5b5[_0x74ca('0xa3')]===0x1){return _0x7df75a[_0x74ca('0x4c')]();}return this[_0x74ca('0xa0')](_0x7df75a);};AGIVertices[_0x74ca('0xe')][_0x74ca('0xaa')]=function(_0x323da7,_0x5528c3){var _0x52625=this[_0x74ca('0x39')][_0x74ca('0xf')](_0x323da7);if(_0x52625['result']===-0x1){return _0x52625;}logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0xab'),_0x5528c3,_0x52625[_0x74ca('0xa9')]));return this['channel'][_0x74ca('0xa7')](_0x5528c3,_0x52625[_0x74ca('0xa9')]);};AGIVertices[_0x74ca('0xe')]['isConfigured']=function(_0xb2e0d2){return _0xb2e0d2&&_0xb2e0d2!=='0'&&_0xb2e0d2!=='-1'&&_0xb2e0d2!=='';};AGIVertices[_0x74ca('0xe')][_0x74ca('0xac')]=function(_0x153e29){this[_0x74ca('0x38')]['sync'](this,_0x153e29,'-');_0x153e29[_0x74ca('0xad')]=_0x153e29['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x74ca('0xe')]['mrcpsynth']=function(_0x5d342a){logger['info'](util[_0x74ca('0x55')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x5d342a[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x5d342a[_0x74ca('0x5e')])){return this[_0x74ca('0x39')]['noop'](_0x74ca('0xaf'));}var _0x5b23c4='\x22'+_0x5d342a['text']+'\x22';if(this[_0x74ca('0x8d')](_0x5d342a[_0x74ca('0x7e')])){_0x5b23c4+=','+_0x5d342a[_0x74ca('0x7e')];}var _0x101244=this[_0x74ca('0x39')][_0x74ca('0x58')](_0x74ca('0xb0'),_0x5b23c4);if(_0x101244[_0x74ca('0xb1')]===-0x1){return _0x101244;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xb3'),_0x5b23c4));};AGIVertices[_0x74ca('0xe')]['mrcprecog']=function(_0x4d973c){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0xb4'),_0x4d973c['label']));if(!this[_0x74ca('0x8d')](_0x4d973c['grammar'])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xb5'));}var _0x17eb0c=_0x4d973c['grammar'];if(this[_0x74ca('0x8d')](_0x4d973c[_0x74ca('0x7e')])){_0x17eb0c+=','+_0x4d973c[_0x74ca('0x7e')];}var _0x1574a1=this[_0x74ca('0x39')][_0x74ca('0x58')](_0x74ca('0xb6'),_0x17eb0c);if(_0x1574a1[_0x74ca('0xb1')]===-0x1){return _0x1574a1;}var _0x786c44=this[_0x74ca('0xaa')](_0x74ca('0xb7'),'MRCP_RECOG_CONFIDENCE');if(_0x786c44[_0x74ca('0xb1')]===-0x1){return _0x786c44;}var _0x35181b=this[_0x74ca('0xaa')](_0x74ca('0xb8'),'MRCP_RECOG_TRANSCRIPT');if(_0x35181b[_0x74ca('0xb1')]===-0x1){return _0x35181b;}var _0x5ece14=this['getAndSetVariable'](_0x74ca('0xb9'),_0x74ca('0xba'));if(_0x5ece14['result']===-0x1){return _0x5ece14;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xbb'),_0x17eb0c));};AGIVertices['prototype'][_0x74ca('0x6')]=function(_0x4a2c7f){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0xbc'),_0x4a2c7f['label']));return this[_0x74ca('0x39')][_0x74ca('0x6')]([_0x4a2c7f['command'],_0x4a2c7f['args']]);};AGIVertices[_0x74ca('0xe')]['answer']=function(_0x4e14ec){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4e14ec[_0x74ca('0xae')]));if(this['isConfigured'](_0x4e14ec['timeout'])){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0xbd'),_0x4e14ec[_0x74ca('0x67')]));var _0x4a4107=this[_0x74ca('0x39')][_0x74ca('0xbe')](_0x4e14ec[_0x74ca('0x67')]);if(_0x4a4107[_0x74ca('0xb1')]===-0x1){return _0x4a4107;}}return this[_0x74ca('0x39')][_0x74ca('0xbf')]();};AGIVertices[_0x74ca('0xe')][_0x74ca('0x4a')]=function(_0x3cca34){logger[_0x74ca('0x30')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3cca34[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x3cca34[_0x74ca('0x48')])){return this[_0x74ca('0x39')]['error'](_0x3cca34,_0x74ca('0xc0'));}_0x3cca34[_0x74ca('0x49')]=moment();if(this[_0x74ca('0x8d')](_0x3cca34[_0x74ca('0xc1')])){_0x3cca34['scheduledAt']=moment()['add'](_0x3cca34[_0x74ca('0xc1')],_0x74ca('0xc2'));}if(!this[_0x74ca('0x8d')](_0x3cca34['callback_priority'])){_0x3cca34[_0x74ca('0x4d')]=0x2;}this[_0x74ca('0x42')][_0x74ca('0x75')](this,_0x3cca34);return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xc3'),_0x3cca34[_0x74ca('0x47')],_0x3cca34[_0x74ca('0x48')],_0x3cca34['scheduledAt']));};AGIVertices[_0x74ca('0xe')]['custom_app']=function(_0x5657a9){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0xc4'),_0x5657a9[_0x74ca('0xae')]));var _0x2ee5b2=this[_0x74ca('0x39')]['exec'](_0x5657a9['application'],_0x5657a9[_0x74ca('0x7e')]);if(_0x2ee5b2[_0x74ca('0xb1')]===-0x1){return _0x2ee5b2;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format'](_0x74ca('0xc5'),_0x5657a9['application'],_0x5657a9[_0x74ca('0x7e')]));};AGIVertices[_0x74ca('0xe')]['lumenvoxtts']=function(_0x1bf0ec){logger['info'](util[_0x74ca('0x55')](_0x74ca('0xc6'),_0x1bf0ec['label']));if(!this[_0x74ca('0x8d')](_0x1bf0ec[_0x74ca('0x5e')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xaf'));}var _0x2ff652='\x22'+_0x1bf0ec[_0x74ca('0x5e')]+'\x22';if(this[_0x74ca('0x8d')](_0x1bf0ec[_0x74ca('0x7e')])){_0x2ff652+=','+_0x1bf0ec[_0x74ca('0x7e')];}var _0x2c5887=this[_0x74ca('0x39')][_0x74ca('0x58')]('MRCPSynth',_0x2ff652);if(_0x2c5887['result']===-0x1){return _0x2c5887;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xb3'),_0x2ff652));};AGIVertices[_0x74ca('0xe')]['sestektts']=function(_0x2dd9f5){logger[_0x74ca('0x30')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2dd9f5[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x2dd9f5[_0x74ca('0x5e')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xaf'));}var _0x26c0b4='\x22'+_0x2dd9f5[_0x74ca('0x5e')]+'\x22';if(this[_0x74ca('0x8d')](_0x2dd9f5[_0x74ca('0x7e')])){_0x26c0b4+=','+_0x2dd9f5[_0x74ca('0x7e')];}var _0x3ba424=this['channel']['exec'](_0x74ca('0xb0'),_0x26c0b4);if(_0x3ba424['result']===-0x1){return _0x3ba424;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xb3'),_0x26c0b4));};AGIVertices[_0x74ca('0xe')]['lumenvoxasr']=function(_0x5381be){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5381be['label']));if(!this[_0x74ca('0x8d')](_0x5381be['grammar'])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xb5'));}var _0x310e3b=_0x5381be[_0x74ca('0xc7')];if(this['isConfigured'](_0x5381be['options'])){_0x310e3b+=','+_0x5381be['options'];}var _0x52c950=this[_0x74ca('0x39')][_0x74ca('0x58')](_0x74ca('0xb6'),_0x310e3b);if(_0x52c950[_0x74ca('0xb1')]===-0x1){return _0x52c950;}var _0xe62b3c=this['getAndSetVariable'](_0x74ca('0xb7'),'LUMENVOX_ASR_CONFIDENCE');if(_0xe62b3c[_0x74ca('0xb1')]===-0x1){return _0xe62b3c;}var _0xf461c1=this[_0x74ca('0xaa')]('RECOG_INPUT()',_0x74ca('0xc8'));if(_0xf461c1[_0x74ca('0xb1')]===-0x1){return _0xf461c1;}var _0x1ed49c=this[_0x74ca('0xaa')]('RECOG_INSTANCE()',_0x74ca('0xc9'));if(_0x1ed49c['result']===-0x1){return _0x1ed49c;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format'](_0x74ca('0xbb'),_0x310e3b));};AGIVertices[_0x74ca('0xe')][_0x74ca('0xca')]=function(_0x27e380){logger['info'](util[_0x74ca('0x55')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x27e380[_0x74ca('0xae')]));if(!this['isConfigured'](_0x27e380['grammar'])){return this[_0x74ca('0x39')]['noop'](_0x74ca('0xb5'));}var _0x5120e0=_0x27e380['grammar'];if(this[_0x74ca('0x8d')](_0x27e380[_0x74ca('0x7e')])){_0x5120e0+=','+_0x27e380[_0x74ca('0x7e')];}var _0x346b19=this[_0x74ca('0x39')]['exec'](_0x74ca('0xb6'),_0x5120e0);if(_0x346b19['result']===-0x1){return _0x346b19;}var _0x13f2f2=this[_0x74ca('0xaa')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x13f2f2[_0x74ca('0xb1')]===-0x1){return _0x13f2f2;}var _0x5bf4fc=this[_0x74ca('0xaa')](_0x74ca('0xb8'),'SESTEK_ASR_TRANSCRIPT');if(_0x5bf4fc[_0x74ca('0xb1')]===-0x1){return _0x5bf4fc;}var _0x47f34f=this[_0x74ca('0xaa')](_0x74ca('0xb9'),_0x74ca('0xcb'));if(_0x47f34f[_0x74ca('0xb1')]===-0x1){return _0x47f34f;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xbb'),_0x5120e0));};AGIVertices['prototype'][_0x74ca('0xcc')]=function(_0x13a9ef){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0xcd'),_0x13a9ef[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x13a9ef['odbc_id'])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x13a9ef,'no\x20database\x20selected');}var _0xdc4716=this[_0x74ca('0x18')][_0x74ca('0x75')](this,_0x13a9ef['odbc_id']);if(!_0xdc4716){return this[_0x74ca('0x39')]['error'](_0x13a9ef,_0x74ca('0xce'));}if(!this['isConfigured'](_0x13a9ef[_0x74ca('0xcf')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x13a9ef,_0x74ca('0xd0'));}var _0x278558=_0x13a9ef[_0x74ca('0xcf')][_0x74ca('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x74ca('0x39')]['noop'](util['format'](_0x74ca('0xd1'),_0x278558));var _0x37f5f4=this[_0x74ca('0x2b')]['sync'](this,_0xdc4716,_0x278558);this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x13a9ef,_0x278558);if(!this['isConfigured'](_0x13a9ef['variable_id'])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xd2'));}var _0x443d05=this[_0x74ca('0xf')]['sync'](this,_0x13a9ef['variable_id']);if(!_0x443d05){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x13a9ef,_0x74ca('0xd3'));}var _0xd86abb=this;_0x37f5f4[_0x74ca('0xd4')](function(_0x26f230,_0x3558ad){Object[_0x74ca('0xd5')](_0x26f230)['forEach'](function(_0x180c35){_0xd86abb['channel'][_0x74ca('0xa7')](util[_0x74ca('0x55')](_0x74ca('0xd6'),_0x443d05,_0x3558ad,_0x180c35),_0x26f230[_0x180c35]);});});this[_0x74ca('0x39')]['setVariable'](util['format'](_0x74ca('0xd7'),_0x443d05),_0x37f5f4[_0x74ca('0xa3')]);return this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format'](_0x74ca('0xd8'),_0x443d05));};AGIVertices[_0x74ca('0xe')][_0x74ca('0xd9')]=function(_0x5ba351){logger[_0x74ca('0xda')](util[_0x74ca('0x55')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x5ba351[_0x74ca('0xae')]));if(!this['isConfigured'](_0x5ba351[_0x74ca('0xdb')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x5ba351,_0x74ca('0xdc'));}var _0x2d0620=this[_0x74ca('0xdd')][_0x74ca('0x75')](this,_0x5ba351[_0x74ca('0xdb')]);if(!_0x2d0620){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x5ba351,_0x74ca('0xde'));}var _0x2034d9=this[_0x74ca('0x39')]['exec'](_0x74ca('0xdf'),[util[_0x74ca('0x55')]('SIP/%s',_0x2d0620),_0x5ba351['timeout'],_0x5ba351[_0x74ca('0xe0')],_0x5ba351[_0x74ca('0x66')]]);if(_0x2034d9['result']===-0x1){return _0x2034d9;}return this['channel']['noop'](util[_0x74ca('0x55')](_0x74ca('0xe1'),_0x74ca('0xdf')));};AGIVertices[_0x74ca('0xe')][_0x74ca('0xe2')]=function(_0x14e691){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x14e691[_0x74ca('0xae')]));if(!this['isConfigured'](_0x14e691[_0x74ca('0x80')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')]('no\x20key\x20configured');}if(!this[_0x74ca('0x8d')](_0x14e691[_0x74ca('0x5e')])){return this['channel'][_0x74ca('0xb2')]('no\x20text\x20configured');}this[_0x74ca('0x39')][_0x74ca('0xe3')]=!![];this[_0x74ca('0x38')](_0x14e691);this['createSquareMessage'](_0x14e691['text'],'in','','');this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xe4'),_0x14e691[_0x74ca('0x5e')]));var _0x47d13b=this[_0x74ca('0x7f')][_0x74ca('0x75')](this,_0x14e691);if(_0x47d13b){for(var _0x1096d6 in _0x47d13b){if(_0x47d13b[_0x74ca('0x9d')](_0x1096d6)){this['channel'][_0x74ca('0xa7')](util[_0x74ca('0x55')](_0x74ca('0xe5'),_0x1096d6[_0x74ca('0x6d')]()),_0x47d13b[_0x1096d6]);}}this[_0x74ca('0xe6')](_0x47d13b[_0x74ca('0xe7')],_0x74ca('0xe8'),_0x74ca('0xe2'),'');return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')]('Dialogflow\x20Result\x20%s',_0x47d13b[_0x74ca('0xe7')]));}return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x14e691,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x74ca('0xe')][_0x74ca('0xe9')]=function(_0x270c03){logger['info'](util['format'](_0x74ca('0xea'),_0x270c03[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x270c03[_0x74ca('0x82')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')]('no\x20project_id\x20configured');}if(!this[_0x74ca('0x8d')](_0x270c03['client_email'])){return this[_0x74ca('0x39')]['noop'](_0x74ca('0xeb'));}if(!this[_0x74ca('0x8d')](_0x270c03[_0x74ca('0x84')])){return this[_0x74ca('0x39')]['noop'](_0x74ca('0xec'));}if(!this['isConfigured'](_0x270c03[_0x74ca('0x85')])){return this['channel'][_0x74ca('0xb2')](_0x74ca('0xed'));}if(!this['isConfigured'](_0x270c03[_0x74ca('0x5e')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')]('no\x20text\x20configured');}this[_0x74ca('0x39')][_0x74ca('0xe3')]=!![];this['createSquareDetailsReport'](_0x270c03);this[_0x74ca('0xe6')](_0x270c03['text'],'in','','');this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xee'),_0x270c03[_0x74ca('0x5e')]));var _0x290247=this[_0x74ca('0x81')][_0x74ca('0x75')](this,_0x270c03);if(_0x290247){for(var _0x21f6bc in _0x290247){if(_0x290247[_0x74ca('0x9d')](_0x21f6bc)){if(_0x21f6bc!==_0x74ca('0xef')){this[_0x74ca('0x39')][_0x74ca('0xa7')](util['format'](_0x74ca('0xe5'),_0x21f6bc['toUpperCase']()),_0x290247[_0x21f6bc]);}}}this[_0x74ca('0xe6')](_0x290247[_0x74ca('0xe7')],'out',_0x74ca('0xe9'),_0x290247[_0x74ca('0xef')]);return this['channel'][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xf0'),_0x290247[_0x74ca('0xe7')]));}return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x270c03,_0x74ca('0xf1'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0xf2')]=function(_0x1076de){logger['info'](util[_0x74ca('0x55')](_0x74ca('0xf3'),_0x1076de[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x1076de[_0x74ca('0xf4')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xf5'));}if(!this[_0x74ca('0x8d')](_0x1076de[_0x74ca('0xf6')])){return this['channel']['noop'](_0x74ca('0xf7'));}if(!this[_0x74ca('0x8d')](_0x1076de['password'])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xf8'));}if(!this[_0x74ca('0x8d')](_0x1076de[_0x74ca('0xf9')])){return this[_0x74ca('0x39')]['noop']('no\x20text\x20configured');}this[_0x74ca('0x39')]['bot']=!![];this[_0x74ca('0x38')](_0x1076de);this[_0x74ca('0xe6')](_0x1076de['text'],'in','','');this['channel'][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xfa'),_0x1076de[_0x74ca('0x5e')]));var _0x23831c=this[_0x74ca('0x86')][_0x74ca('0x75')](this,_0x1076de);if(_0x23831c){for(var _0x50c9fb in _0x23831c){if(_0x23831c[_0x74ca('0x9d')](_0x50c9fb)){this['channel'][_0x74ca('0xa7')](util[_0x74ca('0x55')]('SESTEK_NDA_%s',_0x50c9fb[_0x74ca('0x6d')]()),_0x23831c[_0x50c9fb]);}}this[_0x74ca('0xe6')](_0x23831c[_0x74ca('0xe7')],'out',_0x74ca('0xf2'),'');if(_0x23831c[_0x74ca('0xfb')]){this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x23831c[_0x74ca('0xfb')]));var _0x50283c=this[_0x74ca('0x39')]['streamFile'](_0x23831c['audiofile']);try{fs[_0x74ca('0xfc')](_0x23831c['audiofile']+'.wav');}catch(_0x5dba5e){logger['error'](_0x5dba5e);}return _0x50283c;}else{return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')]('SestekNDA\x20Result\x20%s',_0x23831c[_0x74ca('0xe7')]));}}return this['channel'][_0x74ca('0x2d')](_0x1076de,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x74ca('0xfd')]=function(_0x53a74d){logger['info'](util[_0x74ca('0x55')](_0x74ca('0xfe'),_0x53a74d[_0x74ca('0xae')]));return this['channel'][_0x74ca('0xb2')](_0x74ca('0xfd'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0xff')]=function(_0xf78252){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xf78252[_0x74ca('0xae')]));var _0x40449b='';if(_0xf78252[_0x74ca('0x100')]){if(!this[_0x74ca('0x8d')](_0xf78252[_0x74ca('0x100')])){return this['channel'][_0x74ca('0x2d')](_0xf78252,_0x74ca('0x101'));}else{var _0x5cd79d=parseInt(_0xf78252['trunk_id'],0xa);if(isNaN(_0x5cd79d)){_0x40449b=_0xf78252[_0x74ca('0x100')];}else{_0x40449b=this[_0x74ca('0x102')][_0x74ca('0x75')](this,_0xf78252['trunk_id']);if(!_0x40449b){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0xf78252,'no\x20trunk\x20found');}}}}else if(_0xf78252[_0x74ca('0x103')]){_0x40449b=_0xf78252[_0x74ca('0x103')];}else{return this[_0x74ca('0x39')]['error'](_0xf78252,_0x74ca('0x101'));}var _0x561b17=this['channel']['exec'](_0x74ca('0xdf'),[util[_0x74ca('0x55')]('SIP/%s/%s',_0x40449b,_0xf78252[_0x74ca('0x47')]),_0xf78252[_0x74ca('0x67')],_0xf78252['opts'],_0xf78252[_0x74ca('0x66')]]);if(_0x561b17['result']===-0x1){return _0x561b17;}return this['channel'][_0x74ca('0xb2')](util[_0x74ca('0x55')]('Executed\x20command\x20%s',_0x74ca('0xdf')));};AGIVertices['prototype'][_0x74ca('0x104')]=function(_0x2ff192){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x105'),_0x2ff192['label']));return this['channel'][_0x74ca('0xb2')](_0x74ca('0x104'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0xb')]=function(_0x556591){logger['info'](util['format'](_0x74ca('0x106'),_0x556591[_0x74ca('0xae')]));if(_0x556591[_0x74ca('0xad')]===0x0){return this[_0x74ca('0xac')](_0x556591);}_0x556591[_0x74ca('0xad')]-=0x1;if(!this[_0x74ca('0x8d')](_0x556591['file_id'])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x556591,_0x74ca('0x107'));}var _0x3a56bd=this[_0x74ca('0x1d')][_0x74ca('0x75')](this,_0x556591[_0x74ca('0x108')]);if(!_0x3a56bd){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x556591,_0x74ca('0x109'));}if(!this[_0x74ca('0x8d')](_0x556591['variable_id'])){return this[_0x74ca('0x39')]['error'](_0x74ca('0xd2'));}var _0x681d9e=this[_0x74ca('0x39')][_0x74ca('0x10a')](_0x3a56bd,_0x556591[_0x74ca('0x10b')],_0x556591['maxdigit']);var _0x57c095=_0x681d9e[_0x74ca('0xb1')]?_0x681d9e[_0x74ca('0xb1')][_0x74ca('0x4c')]():'';logger[_0x74ca('0x30')](_0x74ca('0x10c'),JSON['stringify'](_0x681d9e));if(_0x681d9e[_0x74ca('0xb1')]===-0x1){this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x556591,_0x57c095);return _0x681d9e;}else if(_0x681d9e[_0x74ca('0xa9')]===_0x74ca('0x67')){_0x681d9e['result']=_0x57c095['length']>=parseInt(_0x556591[_0x74ca('0x10d')])?'x':'i';}else{_0x681d9e[_0x74ca('0xb1')]=_0x57c095[_0x74ca('0xa3')]>=parseInt(_0x556591[_0x74ca('0x10d')])&&_0x57c095[_0x74ca('0xa3')]<=parseInt(_0x556591[_0x74ca('0x10e')])?'x':'i';}var _0x19187d=this['getVariable'][_0x74ca('0x75')](this,_0x556591[_0x74ca('0x10f')]);if(!_0x19187d){return this[_0x74ca('0x39')]['error'](_0x556591,_0x74ca('0xd3'));}this[_0x74ca('0x39')][_0x74ca('0xa7')](_0x19187d,_0x57c095);if(this[_0x74ca('0x8d')](_0x556591[_0x74ca('0x110')])){var _0x586fab=parseInt(_0x556591['hiddendigitsnum'],0xa);var _0xcac6fc=rs[_0x74ca('0x111')]({'charset':'*','length':_0x586fab});var _0xb56e6a=_0x57c095['length'];if(_0xb56e6a>0x0){if(_0xb56e6a>_0x586fab){this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x556591,_0x556591[_0x74ca('0x112')]===_0x74ca('0x113')?_0xcac6fc+_0x57c095[_0x74ca('0x114')](_0x586fab):_0x57c095[_0x74ca('0x114')](0x0,_0xb56e6a-_0x586fab)+_0xcac6fc);}else{this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x556591,rs[_0x74ca('0x111')]({'charset':'*','length':_0xb56e6a}));}}else{this['createSquareDetailsReport']['sync'](this,_0x556591,'');}}else{this['createSquareDetailsReport'][_0x74ca('0x75')](this,_0x556591,_0x57c095);}return _0x681d9e;};AGIVertices[_0x74ca('0xe')][_0x74ca('0xc')]=function(_0x388789){logger['info'](util['format'](_0x74ca('0x115'),_0x388789[_0x74ca('0xae')]));return this[_0x74ca('0xb')](_0x388789);};AGIVertices[_0x74ca('0xe')][_0x74ca('0x116')]=function(_0x2413f2){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x117'),_0x2413f2[_0x74ca('0xae')]));this['createSquareDetailsReport'][_0x74ca('0x75')](this,_0x2413f2,_0x2413f2[_0x74ca('0x118')]);return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x119'),_0x2413f2[_0x74ca('0x118')]));};AGIVertices[_0x74ca('0xe')][_0x74ca('0x11a')]=function(_0x244d83){logger['info'](util[_0x74ca('0x55')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x244d83['label']));if(!this['isConfigured'](_0x244d83['aws_access_key_id'])||!this[_0x74ca('0x8d')](_0x244d83['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x74ca('0x8d')](_0x244d83['text'])){return this['channel'][_0x74ca('0xb2')](_0x74ca('0xaf'));}this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x11b'),_0x244d83[_0x74ca('0x5e')]));var _0x495cc6=this[_0x74ca('0x8f')][_0x74ca('0x75')](this,_0x244d83);if(_0x495cc6){this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')]('aws\x20Polly\x20%s\x20file\x20created',_0x495cc6));var _0xbb731=this[_0x74ca('0x39')][_0x74ca('0x11c')](_0x495cc6);try{fs[_0x74ca('0xfc')](_0x495cc6+'.wav');}catch(_0xf4391f){logger['error'](_0xf4391f);}return _0xbb731;}return this['channel']['error'](_0x244d83,_0x74ca('0x11d'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0x11e')]=function(_0x23ca99){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x11f'),_0x23ca99['label']));if(!this[_0x74ca('0x8d')](_0x23ca99['aws_access_key_id'])||!this[_0x74ca('0x8d')](_0x23ca99[_0x74ca('0x90')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0x120'));}if(!this[_0x74ca('0x8d')](_0x23ca99['aws_bot_name'])){return this[_0x74ca('0x39')]['noop'](_0x74ca('0x121'));}if(!this[_0x74ca('0x8d')](_0x23ca99[_0x74ca('0x5e')])){return this[_0x74ca('0x39')]['noop']('no\x20text\x20configured');}this[_0x74ca('0x39')]['bot']=!![];this['createSquareDetailsReport'](_0x23ca99);this[_0x74ca('0xe6')](_0x23ca99['text'],'in','','');this[_0x74ca('0x39')]['noop'](util['format'](_0x74ca('0x122'),_0x23ca99[_0x74ca('0x5e')]));var _0x3f0368=this[_0x74ca('0x92')][_0x74ca('0x75')](this,_0x23ca99);if(_0x3f0368){for(var _0x389df3 in _0x3f0368){if(_0x3f0368[_0x74ca('0x9d')](_0x389df3)&&_[_0x74ca('0x9e')](_0x3f0368[_0x389df3])){this[_0x74ca('0x39')]['setVariable'](util['format'](_0x74ca('0x123'),_0x389df3['toUpperCase']()),_0x3f0368[_0x389df3]);}}if(_[_0x74ca('0x46')](_0x3f0368[_0x74ca('0x7c')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x74ca('0xe6')](_0x3f0368['message'],_0x74ca('0xe8'),_0x74ca('0x124'),'');return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x125'),_0x3f0368[_0x74ca('0x7c')]));}}return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x23ca99,_0x74ca('0x126'));};AGIVertices['prototype'][_0x74ca('0x127')]=function(_0x227d68){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x128'),_0x227d68[_0x74ca('0xae')],_0x227d68[_0x74ca('0x67')]));if(!this[_0x74ca('0x8d')](_0x227d68[_0x74ca('0x80')])){return this['channel'][_0x74ca('0xb2')](_0x74ca('0x129'));}var _0x135dd1='wav';var _0x17f1a1=util[_0x74ca('0x55')](_0x74ca('0x12a'),FILES_PATH,rs[_0x74ca('0x111')](0x4));var _0x3e5662=util[_0x74ca('0x55')](_0x74ca('0xa6'),_0x17f1a1,_0x135dd1);var _0x419505=!![];if(_0x227d68[_0x74ca('0x12b')]===_0x74ca('0x12c')){_0x419505=![];}var _0x4d253b=this[_0x74ca('0x39')][_0x74ca('0x12d')](_0x17f1a1,_0x135dd1,_0x227d68[_0x74ca('0x12e')],_0x227d68[_0x74ca('0x67')],undefined,_0x419505);if(_0x4d253b[_0x74ca('0xb1')]!==-0x1){this[_0x74ca('0x39')]['noop'](util[_0x74ca('0x55')](_0x74ca('0x12f'),_0x3e5662));var _0x1148c6=this[_0x74ca('0x96')]['sync'](this,_0x227d68,_0x3e5662);if(_0x1148c6){for(var _0x3623e8 in _0x1148c6){if(_0x1148c6[_0x74ca('0x9d')](_0x3623e8)){this[_0x74ca('0x39')]['setVariable'](util[_0x74ca('0x55')](_0x74ca('0x130'),_0x3623e8[_0x74ca('0x6d')]()),_0x1148c6[_0x3623e8]);}}return this[_0x74ca('0x39')]['noop'](util['format'](_0x74ca('0x131'),JSON['stringify'](_0x1148c6)));}}return _0x4d253b;};AGIVertices[_0x74ca('0xe')]['tildeasr']=function(_0x39fb97){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x132'),_0x39fb97[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x39fb97['appid'])){return this[_0x74ca('0x39')][_0x74ca('0xb2')]('no\x20appid\x20configured');}if(!this[_0x74ca('0x8d')](_0x39fb97[_0x74ca('0x9a')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')]('no\x20appsecret\x20configured');}var _0x2fe2e5=_0x74ca('0x133');var _0x2888e3=util[_0x74ca('0x55')]('%s/recordings/%s',FILES_PATH,rs[_0x74ca('0x111')](0x4));var _0x118672=util[_0x74ca('0x55')](_0x74ca('0xa6'),_0x2888e3,_0x2fe2e5);var _0x3aa654=!![];if(_0x39fb97[_0x74ca('0x12b')]===_0x74ca('0x12c')){_0x3aa654=![];}var _0x40848a=this[_0x74ca('0x39')]['recordFile'](_0x2888e3,_0x2fe2e5,_0x39fb97[_0x74ca('0x12e')],_0x39fb97[_0x74ca('0x67')],undefined,_0x3aa654);if(_0x40848a[_0x74ca('0xb1')]!==-0x1){this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format']('tilde\x20%s\x20file\x20created',_0x118672));var _0x9151f1=this['tildeASR'][_0x74ca('0x75')](this,_0x39fb97,_0x118672);if(_0x9151f1){for(var _0x5d8a2c in _0x9151f1){if(_0x9151f1[_0x74ca('0x9d')](_0x5d8a2c)){this[_0x74ca('0x39')][_0x74ca('0xa7')](util[_0x74ca('0x55')]('TILDE_ASR_%s',_0x5d8a2c[_0x74ca('0x6d')]()),_0x9151f1[_0x5d8a2c]);}}return this['channel']['noop'](util[_0x74ca('0x55')](_0x74ca('0x134'),JSON[_0x74ca('0x78')](_0x9151f1)));}}return _0x40848a;};AGIVertices['prototype'][_0x74ca('0x135')]=function(_0x1d0a77){logger['info'](util[_0x74ca('0x55')](_0x74ca('0x136'),_0x1d0a77['label']));return this[_0x74ca('0x39')][_0x74ca('0x137')](_0x1d0a77[_0x74ca('0x138')],_0x1d0a77[_0x74ca('0x3e')],_0x1d0a77['priority']);};AGIVertices[_0x74ca('0xe')][_0x74ca('0x139')]=function(_0x58dc65){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x13a'),_0x58dc65['label']));if(!this[_0x74ca('0x8d')](_0x58dc65[_0x74ca('0x13b')])){return this[_0x74ca('0x39')]['error'](_0x58dc65,_0x74ca('0x13c'));}try{var _0x17e4cc=eval(_0x58dc65[_0x74ca('0x13b')])?_0x74ca('0x13d'):_0x74ca('0x13e');this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x13f'),_0x58dc65[_0x74ca('0x13b')],_0x17e4cc));return{'code':0xc8,'result':_0x17e4cc};}catch(_0x100c5f){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x74ca('0xe')][_0x74ca('0x140')]=function(_0x5837be){logger['info'](util[_0x74ca('0x55')](_0x74ca('0x141'),_0x5837be[_0x74ca('0xae')]));if(!this['isConfigured'](_0x5837be[_0x74ca('0x142')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x5837be,_0x74ca('0x143'));}var _0x536bff=this[_0x74ca('0x24')][_0x74ca('0x75')](this,_0x5837be['interval_id']);if(!_0x536bff){return this['channel']['error'](_0x5837be,'no\x20intervals\x20found');}for(var _0x36076d=0x0;_0x36076d<_0x536bff[_0x74ca('0xa3')];_0x36076d+=0x1){var _0x1a297a=this[_0x74ca('0x39')][_0x74ca('0xf')](util[_0x74ca('0x55')](_0x74ca('0x144'),_0x536bff[_0x36076d]));if(_0x1a297a[_0x74ca('0xb1')]===-0x1){return _0x1a297a;}logger['info'](util[_0x74ca('0x55')]('IFTIME\x20%s\x20%s',_0x536bff[_0x36076d],_0x1a297a['extra']));if(_0x1a297a['extra']===_0x74ca('0x13d')){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x145'),_0x536bff[_0x36076d],_0x74ca('0x13d')));this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format'](_0x74ca('0x145'),_0x536bff[_0x36076d],'true'));return{'code':0xc8,'result':_0x74ca('0x13d')};}else{logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x145'),_0x536bff[_0x36076d],_0x74ca('0x13e')));this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format'](_0x74ca('0x145'),_0x536bff[_0x36076d],'false'));}}return{'code':0xc8,'result':_0x74ca('0x13e')};};AGIVertices[_0x74ca('0xe')]['hangup']=function(_0x277118){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x277118[_0x74ca('0xae')]));return this[_0x74ca('0x39')][_0x74ca('0x146')]();};AGIVertices['prototype']['ispeechasr']=function(_0x56202f){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x147'),_0x56202f[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x56202f[_0x74ca('0x80')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')]('no\x20key\x20configured');}var _0x2bb1e0=_0x74ca('0x133');var _0x13c7aa=util[_0x74ca('0x55')](_0x74ca('0x12a'),FILES_PATH,rs[_0x74ca('0x111')](0x4));var _0xde88f9=util[_0x74ca('0x55')](_0x74ca('0xa6'),_0x13c7aa,_0x2bb1e0);var _0x9c577e=!![];if(_0x56202f[_0x74ca('0x12b')]===_0x74ca('0x12c')){_0x9c577e=![];}var _0x28e61d=this[_0x74ca('0x39')]['recordFile'](_0x13c7aa,_0x2bb1e0,_0x56202f[_0x74ca('0x12e')],_0x56202f[_0x74ca('0x67')],undefined,_0x9c577e);if(_0x28e61d[_0x74ca('0xb1')]!==-0x1){this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x148'),_0xde88f9));var _0x15b673=this[_0x74ca('0x8a')][_0x74ca('0x75')](this,_0x56202f,_0xde88f9);if(_0x15b673){for(var _0x16e388 in _0x15b673){if(_0x15b673[_0x74ca('0x9d')](_0x16e388)){this['channel'][_0x74ca('0xa7')](util['format'](_0x74ca('0x149'),_0x16e388[_0x74ca('0x6d')]()),_0x15b673[_0x16e388]);}}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x14a'),JSON[_0x74ca('0x78')](_0x15b673)));}}return _0x28e61d;};AGIVertices[_0x74ca('0xe')][_0x74ca('0x14b')]=function(_0x3a9034){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x14c'),_0x3a9034[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x3a9034[_0x74ca('0x80')])){return this['channel'][_0x74ca('0xb2')](_0x74ca('0x129'));}if(!this[_0x74ca('0x8d')](_0x3a9034[_0x74ca('0x5e')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xaf'));}this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format'](_0x74ca('0x14d'),_0x3a9034[_0x74ca('0x5e')]));var _0x16d1aa=this[_0x74ca('0x87')]['sync'](this,_0x3a9034);if(_0x16d1aa){this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')]('ispeech\x20%s\x20file\x20created',_0x16d1aa));var _0x4a9aad=this['channel'][_0x74ca('0x11c')](_0x16d1aa,_0x3a9034[_0x74ca('0x12e')]);try{fs['unlink'](_0x16d1aa+_0x74ca('0x14e'));}catch(_0x2cf5ef){logger[_0x74ca('0x2d')](_0x2cf5ef);}return _0x4a9aad;}return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x3a9034,_0x74ca('0x14f'));};AGIVertices[_0x74ca('0xe')]['login']=function(_0x58d054){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x150'),_0x58d054['label']));if(!this['isConfigured'](_0x58d054[_0x74ca('0x151')])){return this['channel']['error'](_0x58d054,_0x74ca('0x152'));}logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x153'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x58d054[_0x74ca('0x151')]));var _0x563d65=this[_0x74ca('0x54')][_0x74ca('0x75')](this,_0x58d054[_0x74ca('0x151')]);if(_0x563d65){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x154'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x58d054[_0x74ca('0x151')]));this['channel'][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x154'),this[_0x74ca('0x39')]['callerid'],_0x58d054[_0x74ca('0x151')]));return{'code':0xc8,'result':_0x74ca('0x155')};}else{logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x156'),this[_0x74ca('0x39')]['callerid'],_0x58d054['findBy']));this[_0x74ca('0x39')][_0x74ca('0xb2')](util['format'](_0x74ca('0x156'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x58d054[_0x74ca('0x151')]));return{'code':0xc8,'result':_0x74ca('0x157')};}};AGIVertices[_0x74ca('0xe')][_0x74ca('0x158')]=function(_0x304cd6){logger[_0x74ca('0x30')](util['format'](_0x74ca('0x159'),_0x304cd6[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x304cd6[_0x74ca('0x151')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x304cd6,_0x74ca('0x152'));}logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x153'),this['channel'][_0x74ca('0x3c')],_0x304cd6[_0x74ca('0x151')]));var _0x4388b5=this['agentLogout'][_0x74ca('0x75')](this,_0x304cd6[_0x74ca('0x151')]);if(_0x4388b5){logger['info'](util[_0x74ca('0x55')](_0x74ca('0x154'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x304cd6['findBy']));this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x154'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x304cd6['findBy']));return{'code':0xc8,'result':_0x74ca('0x155')};}else{logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x156'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x304cd6[_0x74ca('0x151')]));this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x156'),this['channel'][_0x74ca('0x3c')],_0x304cd6[_0x74ca('0x151')]));return{'code':0xc8,'result':_0x74ca('0x157')};}};AGIVertices['prototype'][_0x74ca('0x15a')]=function(_0x2ce394){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x15b'),_0x2ce394[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x2ce394['operation'])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x2ce394,_0x74ca('0x15c'));}this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x15d'),_0x2ce394[_0x74ca('0x15e')]));var _0x2df812=eval(_0x2ce394[_0x74ca('0x15e')]);if(!this[_0x74ca('0x8d')](_0x2ce394['variable_id'])){return this['channel'][_0x74ca('0xb2')](_0x74ca('0xd2'));}var _0x1ee005=this[_0x74ca('0xf')]['sync'](this,_0x2ce394[_0x74ca('0x10f')]);if(!_0x1ee005){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x2ce394,_0x74ca('0xd3'));}if(_['isArray'](_0x2df812)){var _0x23801b=this;_0x2df812[_0x74ca('0xd4')](function(_0x3065b7,_0x431bc8){_0x23801b[_0x74ca('0x39')][_0x74ca('0xa7')](util[_0x74ca('0x55')](_0x74ca('0x15f'),_0x1ee005,_0x431bc8),_0x3065b7);});return this[_0x74ca('0x39')]['noop'](util[_0x74ca('0x55')](_0x74ca('0x160'),_0x1ee005));}else{return this[_0x74ca('0x39')][_0x74ca('0xa7')](_0x1ee005,_0x2df812);}};AGIVertices[_0x74ca('0xe')][_0x74ca('0xa')]=function(_0x1c3f90){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1c3f90[_0x74ca('0xae')]));if(_0x1c3f90[_0x74ca('0xad')]===0x0){return this[_0x74ca('0xac')](_0x1c3f90);}_0x1c3f90[_0x74ca('0xad')]-=0x1;if(!this[_0x74ca('0x8d')](_0x1c3f90['file_id'])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x1c3f90,_0x74ca('0x107'));}var _0x315e9a=this[_0x74ca('0x1d')][_0x74ca('0x75')](this,_0x1c3f90['file_id']);if(!_0x315e9a){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x1c3f90,_0x74ca('0x109'));}var _0x25ab8a=this['channel']['getData'](_0x315e9a,_0x1c3f90[_0x74ca('0x10b')],_0x1c3f90[_0x74ca('0x161')]);var _0x34dc5=_0x25ab8a[_0x74ca('0xb1')];if(_0x25ab8a[_0x74ca('0xb1')]===-0x1){this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x1c3f90,'-1');return _0x25ab8a;}else if(_0x25ab8a[_0x74ca('0xa9')]==='timeout'){_0x25ab8a['result']=_0x25ab8a[_0x74ca('0xb1')][_0x74ca('0xa3')]>0x0?_0x25ab8a[_0x74ca('0xb1')]:'t';}else if(_['isEmpty'](_0x25ab8a['result'])){_0x25ab8a['result']='#';_0x34dc5='#';}if(!this[_0x74ca('0x8d')](_0x1c3f90['variable_id'])){this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xd2'));}else{var _0x437972=this[_0x74ca('0xf')][_0x74ca('0x75')](this,_0x1c3f90[_0x74ca('0x10f')]);if(!_0x437972){return this['channel'][_0x74ca('0x2d')](_0x1c3f90,_0x74ca('0xd3'));}this[_0x74ca('0x39')][_0x74ca('0xa7')](_0x437972,_0x34dc5);}this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x1c3f90,_0x34dc5);return _0x25ab8a;};AGIVertices[_0x74ca('0xe')]['noop']=function(_0xda36d6){logger['info'](util['format'](_0x74ca('0x162'),_0xda36d6['label']));return this[_0x74ca('0x39')]['noop'](_0xda36d6[_0x74ca('0x163')]||_0xda36d6[_0x74ca('0xae')]);};AGIVertices['prototype'][_0x74ca('0x164')]=function(_0x2b8af5){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2b8af5[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x2b8af5[_0x74ca('0x151')])){return this[_0x74ca('0x39')]['error'](_0x2b8af5,_0x74ca('0x152'));}logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x2b8af5[_0x74ca('0x151')]));var _0x2e7490=this[_0x74ca('0x4e')]['sync'](this,_0x2b8af5['pause_id']);var _0x3472e9=this[_0x74ca('0x50')][_0x74ca('0x75')](this,_0x2b8af5[_0x74ca('0x151')],_0x2e7490);if(_0x3472e9){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x154'),this[_0x74ca('0x39')]['callerid'],_0x2b8af5[_0x74ca('0x151')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x2b8af5['findBy']));return{'code':0xc8,'result':_0x74ca('0x155')};}else{logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x156'),this[_0x74ca('0x39')]['callerid'],_0x2b8af5[_0x74ca('0x151')]));this['channel'][_0x74ca('0xb2')](util[_0x74ca('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x2b8af5['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x74ca('0xe')]['playback']=function(_0x5372d6){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x165'),_0x5372d6[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x5372d6[_0x74ca('0x108')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x5372d6,_0x74ca('0x107'));}var _0x1fa168=this[_0x74ca('0x1d')][_0x74ca('0x75')](this,_0x5372d6[_0x74ca('0x108')]);if(!_0x1fa168){return this[_0x74ca('0x39')]['error'](_0x5372d6,_0x74ca('0x109'));}var _0x5d96e7=this[_0x74ca('0x39')][_0x74ca('0x58')](_0x74ca('0x166'),[_0x1fa168,_0x5372d6[_0x74ca('0xe0')]]);if(_0x5d96e7[_0x74ca('0xb1')]===-0x1){return _0x5d96e7;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xc5'),'PLAYBACK',_0x1fa168));};AGIVertices[_0x74ca('0xe')]['queue']=function(_0x45b351){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x167'),_0x45b351[_0x74ca('0xae')]));if(!this['isConfigured'](_0x45b351[_0x74ca('0x168')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x45b351,_0x74ca('0x169'));}var _0x3f6d4a='';var _0xa2699=parseInt(_0x45b351[_0x74ca('0x168')],0xa);if(isNaN(_0xa2699)){_0x3f6d4a=_0x45b351[_0x74ca('0x168')];}else{_0x3f6d4a=this[_0x74ca('0x14')]['sync'](this,_0x45b351[_0x74ca('0x168')]);if(!_0x3f6d4a){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x45b351,_0x74ca('0x16a'));}}var _0x8e54b7='';if(this['isConfigured'](_0x45b351['file_id'])){var _0x135dc5=this['getSound'][_0x74ca('0x75')](this,_0x45b351[_0x74ca('0x108')]);if(_0x135dc5){_0x8e54b7=_0x135dc5;}}this['createSquareDetailsReport'][_0x74ca('0x75')](this,_0x45b351,_0x3f6d4a);if(_0x45b351[_0x74ca('0xe0')][_0x74ca('0x16b')]('x')<0x0){_0x45b351[_0x74ca('0xe0')]+='x';}if(_0x45b351[_0x74ca('0xe0')][_0x74ca('0x16b')]('X')<0x0){_0x45b351['opts']+='X';}this[_0x74ca('0x39')][_0x74ca('0xa7')](_0x74ca('0x16c'),_0x3f6d4a?_0x3f6d4a['toLowerCase']():'');var _0xecfc6=this[_0x74ca('0x39')][_0x74ca('0x58')](_0x74ca('0x16d'),[_0x3f6d4a,_0x45b351[_0x74ca('0xe0')],_0x45b351['url'],_0x8e54b7,_0x45b351['timeout'],_0x45b351[_0x74ca('0x6')],_0x45b351[_0x74ca('0x16e')],_0x45b351['gosub'],'',_0x45b351['position']]);if(_0xecfc6[_0x74ca('0xb1')]===-0x1){return _0xecfc6;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xc5'),_0x74ca('0x16d'),_0x3f6d4a));};AGIVertices[_0x74ca('0xe')][_0x74ca('0x16f')]=function(_0x28d94c){logger[_0x74ca('0x30')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x28d94c['label']));var _0x2d905b=_0x28d94c['recordingFormat']||_0x74ca('0x133');var _0x125995=util[_0x74ca('0x55')](_0x74ca('0x170'),this[_0x74ca('0x39')][_0x74ca('0x3a')],rs[_0x74ca('0x111')](0x5));var _0x3d894b=util['format'](_0x74ca('0x171'),FILES_PATH,_0x125995,_0x2d905b);var _0x4d2edd=util[_0x74ca('0x55')](_0x74ca('0x12a'),FILES_PATH,_0x125995);this[_0x74ca('0x3d')]['sync'](this,_0x28d94c,_0x125995,_0x3d894b);this[_0x74ca('0x39')][_0x74ca('0xa7')](_0x74ca('0x172'),_0x125995);logger[_0x74ca('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x4d2edd,_0x2d905b,_0x28d94c[_0x74ca('0x173')],_0x28d94c[_0x74ca('0x67')]);return this[_0x74ca('0x39')][_0x74ca('0x12d')](_0x4d2edd,_0x2d905b,_0x28d94c['escape_digits'],_0x28d94c[_0x74ca('0x67')],undefined,!![]);};AGIVertices['prototype'][_0x74ca('0x174')]=function(_0x54b2c7){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x175'),_0x54b2c7[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x54b2c7[_0x74ca('0x66')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0x176'));}var _0x4ba15a=this[_0x74ca('0x65')][_0x74ca('0x75')](this,_0x54b2c7);logger['info'](util['format'](_0x74ca('0x177'),util[_0x74ca('0x178')](_0x4ba15a,{'showHidden':![],'depth':null})));if(!this[_0x74ca('0x8d')](_0x54b2c7[_0x74ca('0x10f')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0x179'));}var _0x203063=this[_0x74ca('0xf')]['sync'](this,_0x54b2c7[_0x74ca('0x10f')]);if(!_0x203063){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x54b2c7,_0x74ca('0xd3'));}this[_0x74ca('0x39')][_0x74ca('0xa7')](util[_0x74ca('0x55')]('%s_STATUS_CODE',_0x203063),_0x4ba15a['statusCode']?_0x4ba15a[_0x74ca('0x7a')]:_0x74ca('0x17a'));this['channel']['setVariable'](util['format'](_0x74ca('0x17b'),_0x203063),_0x4ba15a[_0x74ca('0x7b')]?_0x4ba15a[_0x74ca('0x7b')]:'OK');if(_0x4ba15a[_0x74ca('0x6e')]){try{this[_0x74ca('0xa4')](_0x4ba15a[_0x74ca('0x6e')],_0x203063);}catch(_0x2273af){logger[_0x74ca('0x2d')](util[_0x74ca('0x55')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x203063));}}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xd8'),_0x203063));};AGIVertices['prototype'][_0x74ca('0x17c')]=function(_0x47e168){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x17d'),_0x47e168[_0x74ca('0xae')]));return this[_0x74ca('0x39')][_0x74ca('0x17e')](_0x47e168[_0x74ca('0x17f')]['replace'](/\s+/g,''),_0x47e168[_0x74ca('0x173')]);};AGIVertices[_0x74ca('0xe')]['saynumber']=function(_0xa23797){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x180'),_0xa23797[_0x74ca('0xae')]));return this[_0x74ca('0x39')]['sayNumber'](_0xa23797[_0x74ca('0x68')][_0x74ca('0x5a')](/\s+/g,''),_0xa23797[_0x74ca('0x173')]);};AGIVertices[_0x74ca('0xe')][_0x74ca('0x181')]=function(_0x5b48ff){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x5b48ff[_0x74ca('0xae')]));return this[_0x74ca('0x39')][_0x74ca('0x182')](_0x5b48ff[_0x74ca('0x5e')],_0x5b48ff[_0x74ca('0x173')]);};AGIVertices['prototype']['sendMail']=function(_0x4b731b){logger['info'](util[_0x74ca('0x55')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4b731b[_0x74ca('0xae')]));if(!this['isConfigured'](_0x4b731b[_0x74ca('0x183')])){return this['channel'][_0x74ca('0xb2')](_0x74ca('0x184'));}var _0x564ebb=this[_0x74ca('0x20')][_0x74ca('0x75')](this,_0x4b731b['account_id']);if(!_0x564ebb||!_0x564ebb[_0x74ca('0x185')]){return this['channel'][_0x74ca('0x2d')](_0x4b731b,'no\x20mail\x20account\x20found');}var _0x4c1040={'from':util[_0x74ca('0x55')](_0x74ca('0x186'),_0x564ebb[_0x74ca('0x12')],_0x564ebb[_0x74ca('0x187')]||_0x564ebb[_0x74ca('0x185')][_0x74ca('0x188')]),'to':_0x4b731b['to']||'','cc':_0x4b731b['cc']||'','bcc':_0x4b731b[_0x74ca('0x189')]||'','subject':_0x4b731b[_0x74ca('0x18a')],'html':_0x4b731b[_0x74ca('0x5e')],'text':_0x4b731b['text']};var _0xe45bce={'tls':{'rejectUnauthorized':![]}};if(_0x564ebb[_0x74ca('0x185')][_0x74ca('0x18b')]){_0xe45bce[_0x74ca('0x18b')]=_0x564ebb[_0x74ca('0x185')][_0x74ca('0x18b')];}else{_0xe45bce[_0x74ca('0x18c')]=_0x564ebb['Smtp'][_0x74ca('0x18c')];_0xe45bce[_0x74ca('0x18d')]=_0x564ebb[_0x74ca('0x185')][_0x74ca('0x18d')];_0xe45bce[_0x74ca('0x18e')]=_0x564ebb[_0x74ca('0x185')][_0x74ca('0x18e')];}if(_0x564ebb[_0x74ca('0x185')]['authentication']){_0xe45bce[_0x74ca('0x18f')]={'user':_0x564ebb[_0x74ca('0x185')][_0x74ca('0x188')],'pass':_0x564ebb[_0x74ca('0x185')][_0x74ca('0x190')]};}if(this[_0x74ca('0x8d')](_0x4b731b[_0x74ca('0x191')])){}logger[_0x74ca('0xda')](_0x74ca('0x192'),JSON[_0x74ca('0x78')](_0x4c1040));this['createSquareDetailsReport']['sync'](this,_0x4b731b,_0x4b731b['account_id']);this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x193'),_0x564ebb[_0x74ca('0x12')]));this[_0x74ca('0x22')][_0x74ca('0x75')](this,_0xe45bce,_0x4c1040);return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0x194'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0x195')]=function(_0x4156a4){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x196'),_0x4156a4[_0x74ca('0xae')]));return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0x197'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0x198')]=function(_0x280922){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x280922[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x280922[_0x74ca('0x199')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0x19a'));}var _0xc71197=this[_0x74ca('0x35')][_0x74ca('0x75')](this,_0x280922[_0x74ca('0x199')]);if(!_0xc71197){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x280922,_0x74ca('0x19b'));}var _0x1a01d5={'body':_0x280922[_0x74ca('0x19c')],'phone':_0x280922['to']||'','SmsAccountId':_0xc71197['id']};logger[_0x74ca('0xda')](_0x74ca('0x19d'),JSON[_0x74ca('0x78')](_0x1a01d5));this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x280922,_0x280922[_0x74ca('0x199')]);this[_0x74ca('0x39')]['noop'](util[_0x74ca('0x55')](_0x74ca('0x19e'),_0xc71197[_0x74ca('0x12')]));this['createSmsMessage']['sync'](this,_0x1a01d5);return this[_0x74ca('0x39')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x74ca('0xe')]['set']=function(_0x329788){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x19f'),_0x329788[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x329788[_0x74ca('0x10f')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x329788,_0x74ca('0x1a0'));}var _0x205a86=this['getVariable']['sync'](this,_0x329788[_0x74ca('0x10f')]);if(!_0x205a86){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x329788,_0x74ca('0xd3'));}return this[_0x74ca('0x39')][_0x74ca('0xa7')](_0x205a86,_0x329788[_0x74ca('0x1a1')]);};AGIVertices[_0x74ca('0xe')]['start']=function(_0x3bcf0a){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3bcf0a[_0x74ca('0xae')]));this[_0x74ca('0x39')]['noop'](_0x74ca('0x1a2'));if(_0x3bcf0a[_0x74ca('0xbf')]===_0x74ca('0x1a3')){this[_0x74ca('0x39')]['noop'](_0x74ca('0x1a4'));return this[_0x74ca('0x39')]['answer']();}return this[_0x74ca('0x39')][_0x74ca('0xb2')]('Skipped\x20Answer');};AGIVertices[_0x74ca('0xe')][_0x74ca('0x1a5')]=function(_0x5936bb){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x5936bb[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x5936bb[_0x74ca('0x1a6')])){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x5936bb,'no\x20subproject\x20selected');}var _0x20b1f7=this[_0x74ca('0x16')][_0x74ca('0x75')](this,_0x5936bb[_0x74ca('0x1a6')]);if(!this[_0x74ca('0x8d')](_0x20b1f7)){return this[_0x74ca('0x39')][_0x74ca('0x2d')](_0x5936bb,util['format'](_0x74ca('0x1a7'),_0x5936bb[_0x74ca('0x1a6')]));}if(_0x20b1f7===this[_0x74ca('0x39')][_0x74ca('0x3b')]){return this['channel'][_0x74ca('0x2d')](_0x5936bb,_0x74ca('0x1a8'));}this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x5936bb,_0x20b1f7);var _0x1563d6=this[_0x74ca('0x39')][_0x74ca('0x58')](_0x74ca('0x1a9'),util['format'](_0x74ca('0x1aa'),config[_0x74ca('0x6')][_0x74ca('0x18c')]||_0x74ca('0x1ab'),_0x20b1f7,this['channel']['arg_1']));if(_0x1563d6[_0x74ca('0xb1')]===-0x1){return _0x1563d6;}return this['channel'][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0xc5'),_0x74ca('0x1a9'),_0x20b1f7));};AGIVertices[_0x74ca('0xe')]['system']=function(_0x42d312){logger[_0x74ca('0x30')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x42d312[_0x74ca('0xae')]));var _0x4cc179=this[_0x74ca('0x57')]['sync'](this,_0x42d312['command']);this[_0x74ca('0x38')][_0x74ca('0x75')](this,_0x42d312,_0x42d312['command']);if(this['isConfigured'](_0x42d312[_0x74ca('0x10f')])){var _0x3d9305=this[_0x74ca('0xf')][_0x74ca('0x75')](this,_0x42d312['variable_id']);if(_0x3d9305){this[_0x74ca('0x39')][_0x74ca('0xa7')](_0x3d9305,_0x4cc179);return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x1ac'),_0x42d312[_0x74ca('0x1ad')],_0x3d9305));}}return this[_0x74ca('0x39')]['noop'](util[_0x74ca('0x55')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x42d312['command']));};AGIVertices['prototype'][_0x74ca('0x1ae')]=function(_0x3343b1){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3343b1[_0x74ca('0xae')]));_0x3343b1['text']=_0x3343b1['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x74ca('0x8d')](_0x3343b1[_0x74ca('0x5c')])){return this[_0x74ca('0x39')]['noop'](_0x74ca('0x1af'));}if(!this['isConfigured'](_0x3343b1['text'])){return this['channel'][_0x74ca('0xb2')]('no\x20text\x20configured');}this['channel'][_0x74ca('0xb2')](util['format'](_0x74ca('0x1b0'),_0x3343b1[_0x74ca('0x5e')]));var _0x560022=this[_0x74ca('0x5b')]['sync'](this,_0x3343b1);if(_0x560022){this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x560022));var _0x579a65=this[_0x74ca('0x39')][_0x74ca('0x11c')](_0x560022);try{fs['unlink'](_0x560022+'.wav');}catch(_0x2ffd92){logger[_0x74ca('0x2d')](_0x2ffd92);}return _0x579a65;}return this[_0x74ca('0x39')]['error'](_0x3343b1,_0x74ca('0x1b1'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0x1b2')]=function(_0x1ba940){logger['info'](util[_0x74ca('0x55')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1ba940[_0x74ca('0xae')]));_0x1ba940['text']=_0x1ba940[_0x74ca('0x5e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1ba940[_0x74ca('0x5e')])){return this[_0x74ca('0x39')][_0x74ca('0xb2')](_0x74ca('0xaf'));}this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')]('Trying\x20Google\x20TTS\x20%s',_0x1ba940[_0x74ca('0x5e')]));var _0x44ac00=this[_0x74ca('0x64')]['sync'](this,_0x1ba940);if(_0x44ac00){this['channel'][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x1b3'),_0x44ac00));var _0x44c368=this[_0x74ca('0x39')][_0x74ca('0x11c')](_0x44ac00);try{fs[_0x74ca('0xfc')](_0x44ac00+_0x74ca('0x14e'));}catch(_0x1fd780){logger[_0x74ca('0x2d')](_0x1fd780);}return _0x44c368;}return this['channel'][_0x74ca('0x2d')](_0x1ba940,_0x74ca('0x1b4'));};AGIVertices[_0x74ca('0xe')][_0x74ca('0x1b5')]=function(_0x8758dc){logger['info'](util[_0x74ca('0x55')](_0x74ca('0x1b6'),_0x8758dc[_0x74ca('0xae')]));if(!this[_0x74ca('0x8d')](_0x8758dc['findBy'])){return this['channel'][_0x74ca('0x2d')](_0x8758dc,_0x74ca('0x152'));}logger['info'](util['format'](_0x74ca('0x153'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x8758dc[_0x74ca('0x151')]));var _0x4a2031=this['agentUnpause']['sync'](this,_0x8758dc['findBy']);if(_0x4a2031){logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x154'),this['channel'][_0x74ca('0x3c')],_0x8758dc['findBy']));this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')](_0x74ca('0x154'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x8758dc[_0x74ca('0x151')]));return{'code':0xc8,'result':_0x74ca('0x155')};}else{logger[_0x74ca('0x30')](util[_0x74ca('0x55')](_0x74ca('0x156'),this[_0x74ca('0x39')][_0x74ca('0x3c')],_0x8758dc['findBy']));this[_0x74ca('0x39')]['noop'](util[_0x74ca('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x8758dc['findBy']));return{'code':0xc8,'result':_0x74ca('0x157')};}};AGIVertices['prototype'][_0x74ca('0x1b7')]=function(_0x3db87a){logger['info'](util['format'](_0x74ca('0x1b8'),_0x3db87a[_0x74ca('0xae')]));var _0x5c15dd=this[_0x74ca('0x39')][_0x74ca('0x58')](_0x74ca('0x1b9'),[_0x3db87a[_0x74ca('0x1ba')],_0x3db87a['options']]);if(_0x5c15dd['result']===-0x1){return _0x5c15dd;}return this[_0x74ca('0x39')][_0x74ca('0xb2')](util[_0x74ca('0x55')]('Executed\x20command\x20%s\x20%s',_0x74ca('0x1b9'),_0x3db87a['mailbox']));};AGIVertices['prototype'][_0x74ca('0x1bb')]=function(_0x4375a5){logger[_0x74ca('0x30')](util[_0x74ca('0x55')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4375a5['label']));if(!this['isConfigured'](_0x4375a5[_0x74ca('0x10f')])){return this[_0x74ca('0x39')]['error'](_0x4375a5,'no\x20variable\x20selected');}var _0x5aa77c=this['getVariable'][_0x74ca('0x75')](this,_0x4375a5['variable_id']);if(!_0x5aa77c){return this[_0x74ca('0x39')]['error'](_0x4375a5,_0x74ca('0xd3'));}var _0x59a5af=this[_0x74ca('0x39')][_0x74ca('0xf')](_0x5aa77c);return{'code':0xc8,'result':_0x59a5af[_0x74ca('0xa9')]?_0x59a5af[_0x74ca('0xa9')]:'-'};};String[_0x74ca('0xe')][_0x74ca('0x1bc')]=function(_0x12c1ba,_0xedfd13){return this[_0x74ca('0xa8')](_0x12c1ba)[_0x74ca('0x1bd')](_0xedfd13);};module[_0x74ca('0x1be')]=AGIVertices; \ No newline at end of file +var _0xf8e9=['RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','sip_id','no\x20user\x20found','DIAL','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','createSquareMessage','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','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','awsPolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','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','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','agicommand','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','arg_1','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','isPlainObject','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','getAndSetVariable','result','info','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','label','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf8e9,0x120));var _0x9f8e=function(_0x28710d,_0x9f1ed8){_0x28710d=_0x28710d-0x0;var _0x3bc041=_0xf8e9[_0x28710d];return _0x3bc041;};'use strict';var fs=require('fs');var path=require(_0x9f8e('0x0'));var util=require(_0x9f8e('0x1'));var _=require(_0x9f8e('0x2'));var sh=require(_0x9f8e('0x3'));var odbc=require(_0x9f8e('0x4'))();var rs=require(_0x9f8e('0x5'));var moment=require(_0x9f8e('0x6'));var Mustache=require('mustache');var rp=require(_0x9f8e('0x7'));var logger=require(_0x9f8e('0x8'))(_0x9f8e('0x9'));var config=require(_0x9f8e('0xa'));var scripts=require(_0x9f8e('0xb'));var FILES_PATH=_0x9f8e('0xc');var recursiveMapAttributes=[_0x9f8e('0xd'),_0x9f8e('0xe')];var verticesWithRetry=[_0x9f8e('0xf'),'getdigits',_0x9f8e('0x10')];var AGIVertices=function(_0x3a5369,_0x1ebf6b,_0x4b5120){this['channel']=_0x3a5369;this[_0x9f8e('0x11')]=_0x1ebf6b;this[_0x9f8e('0x12')]=_0x4b5120;};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x14')]=function(_0x6ffd1e,_0x203281){this[_0x9f8e('0x11')][_0x9f8e('0x15')](_0x6ffd1e)['then'](function(_0x1dfbfc){_0x203281(null,_0x1dfbfc?_0x1dfbfc[_0x9f8e('0x16')]:![]);})[_0x9f8e('0x17')](function(_0x2021e9){_0x203281(_0x2021e9);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x18')]=function(_0x306cb9,_0x500433){this[_0x9f8e('0x11')][_0x9f8e('0x19')](_0x306cb9)[_0x9f8e('0x1a')](function(_0x3d5190){_0x500433(null,_0x3d5190?_0x3d5190[_0x9f8e('0x16')]:![]);})[_0x9f8e('0x17')](function(_0x248035){_0x500433(_0x248035);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1b')]=function(_0x85211e,_0x5455bd){this[_0x9f8e('0x11')][_0x9f8e('0x1c')](_0x85211e)[_0x9f8e('0x1a')](function(_0x551df1){_0x5455bd(null,_0x551df1?_0x551df1[_0x9f8e('0x16')]:![]);})[_0x9f8e('0x17')](function(_0x44e50d){_0x5455bd(_0x44e50d);});};AGIVertices[_0x9f8e('0x13')]['getSquareOdbc']=function(_0x2c854a,_0x24a94d){this[_0x9f8e('0x11')][_0x9f8e('0x1d')](_0x2c854a)[_0x9f8e('0x1a')](function(_0x4ce267){_0x24a94d(null,_0x4ce267?_0x4ce267[_0x9f8e('0x1e')]:![]);})['catch'](function(_0x123583){_0x24a94d(_0x123583);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1f')]=function(_0x2880f3,_0x25f40b){this['rpc'][_0x9f8e('0x20')](_0x2880f3)[_0x9f8e('0x1a')](function(_0x54a4eb){_0x25f40b(null,_0x54a4eb?_0x54a4eb[_0x9f8e('0x16')]:![]);})[_0x9f8e('0x17')](function(_0x4c01ce){_0x25f40b(_0x4c01ce);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x21')]=function(_0x1e5c35,_0x1ecc9d){this[_0x9f8e('0x11')][_0x9f8e('0x22')](_0x1e5c35)[_0x9f8e('0x1a')](function(_0x4c76cd){_0x1ecc9d(null,_0x4c76cd?_0x4c76cd[_0x9f8e('0x16')]:![]);})['catch'](function(_0x246047){_0x1ecc9d(_0x246047);});};AGIVertices[_0x9f8e('0x13')]['getSound']=function(_0x1fbdf1,_0x11b0d5){var _0x42106d=this;this[_0x9f8e('0x11')][_0x9f8e('0x23')](_0x1fbdf1)[_0x9f8e('0x1a')](function(_0x3e65a6){_0x11b0d5(null,_0x3e65a6?_0x42106d['getSoundPath'](_0x3e65a6[_0x9f8e('0x24')]):![]);})['catch'](function(_0x446c95){_0x11b0d5(_0x446c95);});};AGIVertices[_0x9f8e('0x13')]['getMailAccount']=function(_0x5635eb,_0x20d79e){this['rpc'][_0x9f8e('0x25')](_0x5635eb)[_0x9f8e('0x1a')](function(_0x824960){_0x20d79e(null,_0x824960?_0x824960:![]);})[_0x9f8e('0x17')](function(_0x2a9d3e){_0x20d79e(_0x2a9d3e);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x26')]=function(_0x55c8d8,_0x16e876,_0x27e29c){this[_0x9f8e('0x12')][_0x9f8e('0x26')](_0x55c8d8,_0x16e876)[_0x9f8e('0x1a')](function(){_0x27e29c(null);})[_0x9f8e('0x17')](function(_0x4532f3){_0x27e29c(_0x4532f3);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x27')]=function(_0x329dbe,_0xe3f4c5){this[_0x9f8e('0x11')]['getIntervalById'](_0x329dbe)[_0x9f8e('0x1a')](function(_0x3e9afd){if(_0x3e9afd){if(_0x3e9afd[_0x9f8e('0x28')]){_0xe3f4c5(null,[_0x3e9afd[_0x9f8e('0x29')]]);}else{_0xe3f4c5(null,_[_0x9f8e('0x2a')](_0x3e9afd[_0x9f8e('0x2b')],_0x9f8e('0x29')));}}else{_0xe3f4c5(null,![]);}})[_0x9f8e('0x17')](function(_0x2ba6e6){_0xe3f4c5(_0x2ba6e6);});};AGIVertices['prototype'][_0x9f8e('0x2c')]=function(_0x5b7758){return util[_0x9f8e('0x2d')](_0x9f8e('0x2e'),FILES_PATH,_0x5b7758);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x2f')]=function(_0xda4644,_0x11ed77,_0x36fc8f){odbc[_0x9f8e('0x30')](_0xda4644,function(_0x237e89){if(_0x237e89){logger[_0x9f8e('0x31')](_0x9f8e('0x32'),_0x237e89);_0x36fc8f(_0x237e89);}else{logger['info'](_0x9f8e('0x33'));odbc['query'](_0x11ed77,function(_0x51c0d0,_0x27a7ad){if(_0x51c0d0){logger['info'](_0x9f8e('0x34'),_0x11ed77);_0x36fc8f(_0x51c0d0);}else{logger['info'](_0x9f8e('0x35'),_0x11ed77);odbc[_0x9f8e('0x36')](function(_0x2641c0){if(_0x2641c0){logger[_0x9f8e('0x31')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x2641c0);}_0x36fc8f(null,_0x27a7ad);});}});}});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x37')]=function(_0xe65d73,_0x2976ee){this[_0x9f8e('0x11')]['getSmsAccountById'](_0xe65d73)[_0x9f8e('0x1a')](function(_0x3150b5){_0x2976ee(null,_0x3150b5?_0x3150b5:![]);})[_0x9f8e('0x17')](function(_0x25afd6){_0x2976ee(_0x25afd6);});};AGIVertices['prototype'][_0x9f8e('0x38')]=function(_0x5ce505,_0x42b270){this['rpc'][_0x9f8e('0x38')](_0x5ce505)[_0x9f8e('0x1a')](function(_0x94a916){_0x42b270(null,_0x94a916);})[_0x9f8e('0x17')](function(_0x433c7c){_0x42b270(_0x433c7c);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x39')]=function(_0x4c1302,_0x15a7e7,_0x529cbb){this[_0x9f8e('0x11')][_0x9f8e('0x39')]({'uniqueid':this[_0x9f8e('0x3a')][_0x9f8e('0x3b')],'node':_0x4c1302['label'],'application':_0x4c1302[_0x9f8e('0x3c')],'data':_0x15a7e7||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x9f8e('0x3d')]})[_0x9f8e('0x1a')](function(_0x2a5cd1){if(_0x529cbb){_0x529cbb(null,_0x2a5cd1);}})[_0x9f8e('0x17')](function(_0x16384b){if(_0x529cbb){_0x529cbb(_0x16384b);}});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x3e')]=function(_0x4b8e47,_0x1c3de1,_0xa1c1a6,_0x2c8f94){this[_0x9f8e('0x11')][_0x9f8e('0x3e')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],'calleridname':this[_0x9f8e('0x3a')]['calleridname'],'context':this[_0x9f8e('0x3a')][_0x9f8e('0x3f')],'extension':this['channel'][_0x9f8e('0x40')],'priority':this['channel'][_0x9f8e('0x41')],'accountcode':this['channel'][_0x9f8e('0x42')],'dnid':this[_0x9f8e('0x3a')][_0x9f8e('0x43')],'projectName':this[_0x9f8e('0x3a')][_0x9f8e('0x44')],'saveName':_0x1c3de1,'filename':_0x4b8e47['file']||_0x1c3de1,'savePath':_0xa1c1a6})[_0x9f8e('0x1a')](function(_0xff8f69){_0x2c8f94(null,_0xff8f69);})['catch'](function(_0x5259fc){_0x2c8f94(_0x5259fc);});};AGIVertices['prototype']['createSquareMessage']=function(_0x4f3521,_0x2327e6,_0xb0bcf4,_0x1084cf,_0x102165){this['rpc']['createSquareMessage']({'uniqueid':this['channel']['uniqueid'],'body':_0x4f3521,'direction':_0x2327e6,'providerName':_0xb0bcf4,'providerResponse':_0x1084cf})[_0x9f8e('0x1a')](function(_0x134670){if(_0x102165){_0x102165(null,_0x134670);}})[_0x9f8e('0x17')](function(_0x468f89){if(_0x102165){_0x102165(_0x468f89);}});};AGIVertices[_0x9f8e('0x13')]['createCmContact']=function(_0xb75646,_0xaa853b){this[_0x9f8e('0x11')][_0x9f8e('0x45')]({'firstName':_[_0x9f8e('0x46')](_0xb75646[_0x9f8e('0x16')])||_[_0x9f8e('0x47')](_0xb75646[_0x9f8e('0x16')])?_0x9f8e('0x48')+Math[_0x9f8e('0x49')]():_0xb75646[_0x9f8e('0x16')],'lastName':_[_0x9f8e('0x46')](_0xb75646[_0x9f8e('0x4a')])||_[_0x9f8e('0x47')](_0xb75646[_0x9f8e('0x4a')])?null:_0xb75646[_0x9f8e('0x4a')],'phone':_0xb75646[_0x9f8e('0x4b')],'ListId':_0xb75646[_0x9f8e('0x4c')],'scheduledat':_0xb75646[_0x9f8e('0x4d')],'callbackUniqueid':this[_0x9f8e('0x3a')][_0x9f8e('0x3b')],'tags':_0x9f8e('0x4e'),'description':_0x9f8e('0x4f')+_0xb75646[_0x9f8e('0x4d')][_0x9f8e('0x50')](),'priority':_0xb75646[_0x9f8e('0x51')]})['then'](function(_0x3d07c1){_0xaa853b(null,_0x3d07c1);})[_0x9f8e('0x17')](function(_0x1fe959){_0xaa853b(_0x1fe959);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x52')]=function(_0x3ee737,_0x1c4628){this[_0x9f8e('0x11')][_0x9f8e('0x53')](_0x3ee737)['then'](function(_0xb34d01){_0x1c4628(null,_0xb34d01?_0xb34d01[_0x9f8e('0x16')]:![]);})[_0x9f8e('0x17')](function(_0x3ea950){_0x1c4628(_0x3ea950);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x54')]=function(_0x539c1d,_0x3cb8c0,_0x4011f7){var _0x51deb8={'role':_0x9f8e('0x55')};_0x51deb8[_0x539c1d]=this['channel']['callerid'];this[_0x9f8e('0x11')][_0x9f8e('0x54')](_0x51deb8,_0x3cb8c0,this['channel']['uniqueid'])['then'](function(_0x385ec4){_0x4011f7(null,_['isNil'](_0x385ec4)?![]:!![]);})[_0x9f8e('0x17')](function(_0x553304){logger[_0x9f8e('0x31')](_0x553304);_0x4011f7(null,![]);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x56')]=function(_0x460eca,_0x325cd8){var _0x5aa271={'role':_0x9f8e('0x55')};_0x5aa271[_0x460eca]=this['channel'][_0x9f8e('0x3d')];this['rpc']['agentUnpause'](_0x5aa271)[_0x9f8e('0x1a')](function(_0x489687){_0x325cd8(null,_[_0x9f8e('0x47')](_0x489687)?![]:!![]);})[_0x9f8e('0x17')](function(_0xcebff7){logger[_0x9f8e('0x31')](_0xcebff7);_0x325cd8(null,![]);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x57')]=function(_0x1ff828,_0x10117f){var _0x208d00={'role':_0x9f8e('0x55')};_0x208d00[_0x1ff828]=this[_0x9f8e('0x3a')][_0x9f8e('0x3d')];this[_0x9f8e('0x11')][_0x9f8e('0x57')](_0x208d00)[_0x9f8e('0x1a')](function(_0x3cb9a2){_0x10117f(null,_[_0x9f8e('0x47')](_0x3cb9a2)?![]:!![]);})[_0x9f8e('0x17')](function(_0x303091){logger[_0x9f8e('0x31')](_0x303091);_0x10117f(null,![]);});};AGIVertices[_0x9f8e('0x13')]['agentLogin']=function(_0x4899db,_0x57a12d){var _0x3dfc85={'role':_0x9f8e('0x55')};_0x3dfc85[_0x4899db]=this[_0x9f8e('0x3a')][_0x9f8e('0x3d')];var _0x4c4b14=_0x4899db!=_0x9f8e('0x58')?util[_0x9f8e('0x2d')](_0x9f8e('0x59'),_0x9f8e('0x5a'),this[_0x9f8e('0x3a')]['callerid']):undefined;this[_0x9f8e('0x11')]['agentLogin'](_0x3dfc85,_0x4c4b14)[_0x9f8e('0x1a')](function(_0x3af866){_0x57a12d(null,_[_0x9f8e('0x47')](_0x3af866)?![]:!![]);})[_0x9f8e('0x17')](function(_0x2482fd){logger['error'](_0x2482fd);_0x57a12d(null,![]);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x5b')]=function(_0x4cf62a,_0x5d93c7){sh['exec'](_[_0x9f8e('0x5c')](_0x4cf62a),function(_0x54ecc9,_0xa6d685){var _0x322a2e=_0xa6d685[_0x9f8e('0x5d')](/(\r\n|\n|\r)/gm,'');_0x5d93c7(null,_0x322a2e);});};AGIVertices['prototype'][_0x9f8e('0x5e')]=function(_0x1d4e86,_0x3839d1){scripts['googleCloudTTS'](_0x1d4e86[_0x9f8e('0x5f')],_0x1d4e86[_0x9f8e('0x60')]||_0x9f8e('0x61'),_0x1d4e86[_0x9f8e('0x61')],_0x1d4e86[_0x9f8e('0x62')]||'en-US',_0x1d4e86[_0x9f8e('0x63')]||_0x9f8e('0x64'),_0x1d4e86[_0x9f8e('0x65')]||_0x9f8e('0x66'))[_0x9f8e('0x1a')](function(_0x4b04b6){_0x3839d1(null,_0x4b04b6);})[_0x9f8e('0x17')](function(_0x1409d7){_0x3839d1(_0x1409d7);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x67')]=function(_0xf89d69,_0x8570e1){scripts[_0x9f8e('0x67')](_0xf89d69[_0x9f8e('0x61')],_0xf89d69[_0x9f8e('0x68')]||'en',0x1)['then'](function(_0x5c3b6b){_0x8570e1(null,_0x5c3b6b);})[_0x9f8e('0x17')](function(_0x2d6b76){_0x8570e1(_0x2d6b76);});};AGIVertices['prototype'][_0x9f8e('0x69')]=function(_0x5b886a,_0x5cb2f2){var _0x43263a={'uri':_0x5b886a[_0x9f8e('0x6a')],'method':_0x5b886a['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5b886a[_0x9f8e('0x6b')])===_0x9f8e('0x6c')&&parseInt(_0x5b886a[_0x9f8e('0x6b')])>=0x1?parseInt(_0x5b886a[_0x9f8e('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x9f8e('0x6d')]([_0x9f8e('0x6e'),_0x9f8e('0x6f')],_0x43263a[_0x9f8e('0x70')]['toUpperCase']())){try{_0x43263a['body']=_0x5b886a['rawBody']?JSON[_0x9f8e('0x71')](_0x5b886a['rawBody']):{};}catch(_0x371bd2){logger['error'](_0x9f8e('0x72'),_0x371bd2);}}try{_0x43263a['headers']=_0x5b886a['rawHeaders']?JSON['parse'](_0x5b886a[_0x9f8e('0xd')]):{};}catch(_0xb4835d){logger[_0x9f8e('0x31')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0xb4835d);}if(_0x5b886a['computedVariables']){try{var _0x1e2bb5=require(_0x5b886a['computedVariables'])[_0x9f8e('0x73')](this,_0x43263a);_0x43263a[_0x9f8e('0x74')]=Mustache[_0x9f8e('0x75')](_0x5b886a['url'],_0x1e2bb5,{},['$$','$$']);if(_0x43263a['headers']){_0x43263a[_0x9f8e('0x76')]=JSON[_0x9f8e('0x71')](Mustache[_0x9f8e('0x75')](JSON[_0x9f8e('0x77')](_0x43263a[_0x9f8e('0x76')]),_0x1e2bb5,{},['$$','$$']));}if(_0x43263a[_0x9f8e('0x78')]){_0x43263a[_0x9f8e('0x78')]=JSON[_0x9f8e('0x71')](Mustache[_0x9f8e('0x75')](JSON['stringify'](_0x43263a[_0x9f8e('0x78')]),_0x1e2bb5,{},['$$','$$']));}}catch(_0x330ab9){logger[_0x9f8e('0x31')](_0x9f8e('0x79'),_0x330ab9);}}rp(_0x43263a)[_0x9f8e('0x1a')](function(_0x5502cc){var _0x1eb217={'statusCode':_0x5502cc[_0x9f8e('0x7a')]||0xc8,'statusMessage':_0x5502cc['statusMessage']||'OK','headers':_0x5502cc['headers']||{},'body':_0x5502cc['body']||{}};_0x5cb2f2(null,_0x1eb217);})['catch'](function(_0x53add6){var _0x28617c={'statusCode':_0x53add6['statusCode']||0x1f4,'statusMessage':_0x53add6[_0x9f8e('0x7b')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x53add6[_0x9f8e('0x7c')][_0x9f8e('0x76')]||{},'body':_0x53add6[_0x9f8e('0x7c')][_0x9f8e('0x78')]||{}};_0x5cb2f2(null,_0x28617c);});};AGIVertices['prototype']['googleDialogflow']=function(_0x213d0b,_0x3e608e){scripts[_0x9f8e('0x7d')](this[_0x9f8e('0x3a')][_0x9f8e('0x3b')],_0x213d0b[_0x9f8e('0x7e')],_0x213d0b[_0x9f8e('0x61')],_0x213d0b['dialogflow_language']||'en')[_0x9f8e('0x1a')](function(_0x3303b9){_0x3e608e(null,_0x3303b9);})[_0x9f8e('0x17')](function(_0x43d047){_0x3e608e(_0x43d047);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x7f')]=function(_0x370c66,_0x45490e){scripts[_0x9f8e('0x7f')](this[_0x9f8e('0x3a')]['uniqueid'],_0x370c66[_0x9f8e('0x80')],_0x370c66[_0x9f8e('0x81')],_0x370c66[_0x9f8e('0x82')],_0x370c66[_0x9f8e('0x61')],_0x370c66[_0x9f8e('0x83')]||'en')[_0x9f8e('0x1a')](function(_0x750a7c){_0x45490e(null,_0x750a7c);})[_0x9f8e('0x17')](function(_0x5ad549){_0x45490e(_0x5ad549);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x84')]=function(_0x489dd8,_0x1fe528){scripts['sestekNDA'](this[_0x9f8e('0x3a')],_0x489dd8)[_0x9f8e('0x1a')](function(_0x11040d){_0x1fe528(null,_0x11040d);})[_0x9f8e('0x17')](function(_0x856a1a){_0x1fe528(_0x856a1a);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x85')]=function(_0x5050b1,_0x485206){scripts['ispeechTTS'](_0x5050b1[_0x9f8e('0x7e')],_0x5050b1[_0x9f8e('0x61')],_0x5050b1[_0x9f8e('0x86')]||'en-US',_0x5050b1[_0x9f8e('0x87')])[_0x9f8e('0x1a')](function(_0x302fd1){_0x485206(null,_0x302fd1);})[_0x9f8e('0x17')](function(_0x59227b){_0x485206(_0x59227b);});};AGIVertices[_0x9f8e('0x13')]['ispeechASR']=function(_0x1599ac,_0x28f0ff,_0x3a0cd5){scripts[_0x9f8e('0x88')](_0x28f0ff,_0x1599ac[_0x9f8e('0x7e')],_0x1599ac[_0x9f8e('0x89')]||_0x9f8e('0x8a'),this[_0x9f8e('0x8b')](_0x1599ac[_0x9f8e('0x8c')])?_0x1599ac[_0x9f8e('0x8c')]:undefined)['then'](function(_0x5bf091){_0x3a0cd5(null,_0x5bf091);})[_0x9f8e('0x17')](function(_0x2c0b53){_0x3a0cd5(_0x2c0b53);});};AGIVertices['prototype']['awsPolly']=function(_0x44d8fe,_0x1e3e24){scripts['awsPolly'](_0x44d8fe[_0x9f8e('0x8d')],_0x44d8fe['aws_secret_access_key'],_0x44d8fe[_0x9f8e('0x8e')],_0x44d8fe[_0x9f8e('0x8f')]||_0x9f8e('0x90'),_0x44d8fe[_0x9f8e('0x61')],_0x44d8fe[_0x9f8e('0x91')]||_0x9f8e('0x61'))['then'](function(_0xdea99f){_0x1e3e24(null,_0xdea99f);})[_0x9f8e('0x17')](function(_0x36e91e){_0x1e3e24(_0x36e91e);});};AGIVertices['prototype'][_0x9f8e('0x92')]=function(_0x261fa8,_0x4b305a){scripts[_0x9f8e('0x92')](this[_0x9f8e('0x3a')][_0x9f8e('0x3b')],_0x261fa8[_0x9f8e('0x8d')],_0x261fa8[_0x9f8e('0x93')],_0x261fa8['aws_lex_region'],_0x261fa8[_0x9f8e('0x61')],_0x261fa8[_0x9f8e('0x94')])[_0x9f8e('0x1a')](function(_0x1237f1){_0x4b305a(null,_0x1237f1);})[_0x9f8e('0x17')](function(_0x1fbb9c){_0x4b305a(_0x1fbb9c);});};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x95')]=function(_0xc2f769,_0x240f37,_0x2ba11f){scripts[_0x9f8e('0x95')](_0x240f37,_0xc2f769[_0x9f8e('0x7e')],_0xc2f769[_0x9f8e('0x96')]||_0x9f8e('0x8a'))[_0x9f8e('0x1a')](function(_0x2e8d32){_0x2ba11f(null,_0x2e8d32);})[_0x9f8e('0x17')](function(_0x436bc0){_0x2ba11f(_0x436bc0);});};AGIVertices[_0x9f8e('0x13')]['tildeASR']=function(_0x27abc9,_0x14a7e1,_0x47c6cc){scripts[_0x9f8e('0x97')](_0x14a7e1,_0x27abc9['appid'],_0x27abc9[_0x9f8e('0x98')],_0x27abc9[_0x9f8e('0x74')])[_0x9f8e('0x1a')](function(_0x3391a0){_0x47c6cc(null,_0x3391a0);})['catch'](function(_0x3787e6){_0x47c6cc(_0x3787e6);});};AGIVertices[_0x9f8e('0x13')]['clear']=function(_0x178365){var _0x4f002a=_[_0x9f8e('0x6d')](verticesWithRetry,_0x178365[_0x9f8e('0x3c')])?_0x178365:_[_0x9f8e('0x99')](_0x178365);for(var _0x29771c in _0x4f002a){if(_0x4f002a[_0x9f8e('0x9a')](_0x29771c)){if(_0x4f002a[_0x29771c]&&_['isString'](_0x4f002a[_0x29771c])){if(_[_0x9f8e('0x6d')](recursiveMapAttributes,_0x29771c)){_0x4f002a[_0x29771c]=this[_0x9f8e('0x9b')](_0x4f002a[_0x29771c]);}else{_0x4f002a[_0x29771c]=this[_0x9f8e('0x9c')](_0x4f002a[_0x29771c]);}}}}return _0x4f002a;};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x9d')]=function(_0x561236){for(var _0x30ca97 in _0x561236){if(_0x561236['hasOwnProperty'](_0x30ca97)){if(_['isPlainObject'](_0x561236[_0x30ca97])){this['recursiveNodeIndex'](_0x561236[_0x30ca97]);}else if(_[_0x9f8e('0x9e')](_0x561236[_0x30ca97])){for(var _0x4106b3=0x0;_0x4106b3<_0x561236[_0x30ca97][_0x9f8e('0x9f')];_0x4106b3++){this[_0x9f8e('0x9d')](_0x561236[_0x30ca97][_0x4106b3]);}}else if(_[_0x9f8e('0xa0')](_0x561236[_0x30ca97])){_0x561236[_0x30ca97]=this[_0x9f8e('0x9c')](_0x561236[_0x30ca97]);}}}};AGIVertices[_0x9f8e('0x13')]['saveRestApiResult']=function(_0x1c339f,_0x1a8bb8){for(var _0x76b1b1 in _0x1c339f){if(_0x1c339f[_0x9f8e('0x9a')](_0x76b1b1)){if(_[_0x9f8e('0xa1')](_0x1c339f[_0x76b1b1])){if(!_[_0x9f8e('0x46')](_0x1c339f[_0x76b1b1])){this[_0x9f8e('0xa2')](_0x1c339f[_0x76b1b1],util[_0x9f8e('0x2d')]('%s.%s',_0x1a8bb8,_0x76b1b1));}}else if(_[_0x9f8e('0x9e')](_0x1c339f[_0x76b1b1])){for(var _0x1bb0a4=0x0;_0x1bb0a4<_0x1c339f[_0x76b1b1][_0x9f8e('0x9f')];_0x1bb0a4++){this[_0x9f8e('0xa2')](_0x1c339f[_0x76b1b1][_0x1bb0a4],util[_0x9f8e('0x2d')](_0x9f8e('0xa3'),_0x1a8bb8,_0x76b1b1+'['+_0x1bb0a4+']'));}}else{if(!_[_0x9f8e('0x47')](_0x1c339f[_0x76b1b1])){this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](util[_0x9f8e('0x2d')](_0x9f8e('0xa3'),_0x1a8bb8,_0x76b1b1),_0x1c339f[_0x76b1b1]);}}}}};AGIVertices[_0x9f8e('0x13')]['replaceObjectAllVariables']=function(_0x590685){try{var _0x350728=JSON[_0x9f8e('0x71')](_0x590685);this[_0x9f8e('0x9d')](_0x350728);return JSON['stringify'](_0x350728);}catch(_0x53cac1){return this['replaceAllVariables'](_0x590685);}};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x9c')]=function(_0x275067){var _0x42bdcf=_0x275067['split']('{');for(var _0x2537ac=0x1;_0x2537ac<_0x42bdcf[_0x9f8e('0x9f')];_0x2537ac+=0x1){var _0x22ea29=_0x42bdcf[_0x2537ac]['split']('}');if(_0x22ea29['length']>0x1){_0x275067=_0x275067[_0x9f8e('0xa5')]('{'+_0x22ea29[0x0]+'}',this[_0x9f8e('0x3a')][_0x9f8e('0x14')](_0x22ea29[0x0])[_0x9f8e('0xa6')]||_0x22ea29[0x0]);}}if(_0x42bdcf['length']===0x1){return _0x275067[_0x9f8e('0x50')]();}return this[_0x9f8e('0x9c')](_0x275067);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xa7')]=function(_0xc9286b,_0x136827){var _0x1a7680=this['channel'][_0x9f8e('0x14')](_0xc9286b);if(_0x1a7680[_0x9f8e('0xa8')]===-0x1){return _0x1a7680;}logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0xaa'),_0x136827,_0x1a7680['extra']));return this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](_0x136827,_0x1a7680['extra']);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x8b')]=function(_0x385801){return _0x385801&&_0x385801!=='0'&&_0x385801!=='-1'&&_0x385801!=='';};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xab')]=function(_0x4711e6){this[_0x9f8e('0x39')]['sync'](this,_0x4711e6,'-');_0x4711e6[_0x9f8e('0xac')]=_0x4711e6[_0x9f8e('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x927f4c){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0xad'),_0x927f4c['label']));if(!this[_0x9f8e('0x8b')](_0x927f4c[_0x9f8e('0x61')])){return this['channel'][_0x9f8e('0xae')](_0x9f8e('0xaf'));}var _0x82b094='\x22'+_0x927f4c[_0x9f8e('0x61')]+'\x22';if(this[_0x9f8e('0x8b')](_0x927f4c[_0x9f8e('0x7c')])){_0x82b094+=','+_0x927f4c[_0x9f8e('0x7c')];}var _0x1f6703=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')](_0x9f8e('0xb1'),_0x82b094);if(_0x1f6703[_0x9f8e('0xa8')]===-0x1){return _0x1f6703;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x82b094));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xb2')]=function(_0x16fdce){logger['info'](util[_0x9f8e('0x2d')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x16fdce[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x16fdce[_0x9f8e('0xb4')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')]('no\x20grammar\x20configured');}var _0x1b3564=_0x16fdce[_0x9f8e('0xb4')];if(this[_0x9f8e('0x8b')](_0x16fdce[_0x9f8e('0x7c')])){_0x1b3564+=','+_0x16fdce['options'];}var _0x37bd30=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')](_0x9f8e('0xb5'),_0x1b3564);if(_0x37bd30['result']===-0x1){return _0x37bd30;}var _0x43f65a=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9f8e('0xb6'));if(_0x43f65a[_0x9f8e('0xa8')]===-0x1){return _0x43f65a;}var _0x574431=this[_0x9f8e('0xa7')](_0x9f8e('0xb7'),_0x9f8e('0xb8'));if(_0x574431[_0x9f8e('0xa8')]===-0x1){return _0x574431;}var _0x133bd1=this[_0x9f8e('0xa7')]('RECOG_INSTANCE()',_0x9f8e('0xb9'));if(_0x133bd1[_0x9f8e('0xa8')]===-0x1){return _0x133bd1;}return this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0xba'),_0x1b3564));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x9')]=function(_0x39d66b){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x39d66b[_0x9f8e('0xb3')]));return this[_0x9f8e('0x3a')][_0x9f8e('0x9')]([_0x39d66b[_0x9f8e('0xbb')],_0x39d66b[_0x9f8e('0xbc')]]);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xbd')]=function(_0x50fdbf){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x50fdbf[_0x9f8e('0xb3')]));if(this['isConfigured'](_0x50fdbf[_0x9f8e('0x6b')])){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0xbe'),_0x50fdbf[_0x9f8e('0x6b')]));var _0x5d25da=this['channel'][_0x9f8e('0xbf')](_0x50fdbf[_0x9f8e('0x6b')]);if(_0x5d25da[_0x9f8e('0xa8')]===-0x1){return _0x5d25da;}}return this['channel'][_0x9f8e('0xbd')]();};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x4e')]=function(_0xa6dad2){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0xc0'),_0xa6dad2[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0xa6dad2[_0x9f8e('0x4c')])){return this[_0x9f8e('0x3a')]['error'](_0xa6dad2,'no\x20list\x20selected');}_0xa6dad2[_0x9f8e('0x4d')]=moment();if(this[_0x9f8e('0x8b')](_0xa6dad2[_0x9f8e('0xc1')])){_0xa6dad2[_0x9f8e('0x4d')]=moment()['add'](_0xa6dad2['delay'],_0x9f8e('0xc2'));}if(!this[_0x9f8e('0x8b')](_0xa6dad2['callback_priority'])){_0xa6dad2[_0x9f8e('0x51')]=0x2;}this[_0x9f8e('0x45')]['sync'](this,_0xa6dad2);return this['channel'][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xa6dad2[_0x9f8e('0x4b')],_0xa6dad2['list_id'],_0xa6dad2[_0x9f8e('0x4d')]));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xc3')]=function(_0xa8e6fc){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0xc4'),_0xa8e6fc[_0x9f8e('0xb3')]));var _0x3d28ea=this['channel'][_0x9f8e('0xb0')](_0xa8e6fc[_0x9f8e('0xc5')],_0xa8e6fc[_0x9f8e('0x7c')]);if(_0x3d28ea[_0x9f8e('0xa8')]===-0x1){return _0x3d28ea;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0xc6'),_0xa8e6fc['application'],_0xa8e6fc[_0x9f8e('0x7c')]));};AGIVertices[_0x9f8e('0x13')]['lumenvoxtts']=function(_0x169367){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0xc7'),_0x169367['label']));if(!this[_0x9f8e('0x8b')](_0x169367[_0x9f8e('0x61')])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0xaf'));}var _0x443592='\x22'+_0x169367[_0x9f8e('0x61')]+'\x22';if(this[_0x9f8e('0x8b')](_0x169367[_0x9f8e('0x7c')])){_0x443592+=','+_0x169367[_0x9f8e('0x7c')];}var _0x2e6934=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')](_0x9f8e('0xb1'),_0x443592);if(_0x2e6934['result']===-0x1){return _0x2e6934;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x443592));};AGIVertices[_0x9f8e('0x13')]['sestektts']=function(_0x53485a){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0xc8'),_0x53485a[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x53485a[_0x9f8e('0x61')])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0xaf'));}var _0x50b693='\x22'+_0x53485a[_0x9f8e('0x61')]+'\x22';if(this[_0x9f8e('0x8b')](_0x53485a[_0x9f8e('0x7c')])){_0x50b693+=','+_0x53485a[_0x9f8e('0x7c')];}var _0x596356=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')](_0x9f8e('0xb1'),_0x50b693);if(_0x596356[_0x9f8e('0xa8')]===-0x1){return _0x596356;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0xc9'),_0x50b693));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xca')]=function(_0x5b46ed){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0xcb'),_0x5b46ed[_0x9f8e('0xb3')]));if(!this['isConfigured'](_0x5b46ed['grammar'])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xcc'));}var _0x3286c4=_0x5b46ed[_0x9f8e('0xb4')];if(this[_0x9f8e('0x8b')](_0x5b46ed[_0x9f8e('0x7c')])){_0x3286c4+=','+_0x5b46ed['options'];}var _0x486a14=this['channel'][_0x9f8e('0xb0')]('MRCPRecog',_0x3286c4);if(_0x486a14[_0x9f8e('0xa8')]===-0x1){return _0x486a14;}var _0x1e3340=this[_0x9f8e('0xa7')](_0x9f8e('0xcd'),_0x9f8e('0xce'));if(_0x1e3340[_0x9f8e('0xa8')]===-0x1){return _0x1e3340;}var _0x2bec8c=this[_0x9f8e('0xa7')](_0x9f8e('0xb7'),_0x9f8e('0xcf'));if(_0x2bec8c[_0x9f8e('0xa8')]===-0x1){return _0x2bec8c;}var _0x1afe2a=this[_0x9f8e('0xa7')]('RECOG_INSTANCE()',_0x9f8e('0xd0'));if(_0x1afe2a['result']===-0x1){return _0x1afe2a;}return this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0xba'),_0x3286c4));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xd1')]=function(_0x1f5de6){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0xd2'),_0x1f5de6[_0x9f8e('0xb3')]));if(!this['isConfigured'](_0x1f5de6[_0x9f8e('0xb4')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xcc'));}var _0xbb86cd=_0x1f5de6[_0x9f8e('0xb4')];if(this[_0x9f8e('0x8b')](_0x1f5de6[_0x9f8e('0x7c')])){_0xbb86cd+=','+_0x1f5de6['options'];}var _0x31598d=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')](_0x9f8e('0xb5'),_0xbb86cd);if(_0x31598d[_0x9f8e('0xa8')]===-0x1){return _0x31598d;}var _0x562b17=this[_0x9f8e('0xa7')]('RECOG_CONFIDENCE()',_0x9f8e('0xd3'));if(_0x562b17['result']===-0x1){return _0x562b17;}var _0x4d0fca=this['getAndSetVariable']('RECOG_INPUT()',_0x9f8e('0xd4'));if(_0x4d0fca[_0x9f8e('0xa8')]===-0x1){return _0x4d0fca;}var _0x2cbfea=this[_0x9f8e('0xa7')](_0x9f8e('0xd5'),_0x9f8e('0xd6'));if(_0x2cbfea[_0x9f8e('0xa8')]===-0x1){return _0x2cbfea;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xbb86cd));};AGIVertices['prototype'][_0x9f8e('0xd7')]=function(_0x38be67){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0xd8'),_0x38be67['label']));if(!this[_0x9f8e('0x8b')](_0x38be67[_0x9f8e('0xd9')])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x38be67,_0x9f8e('0xda'));}var _0x4a2477=this[_0x9f8e('0xdb')]['sync'](this,_0x38be67['odbc_id']);if(!_0x4a2477){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x38be67,'no\x20odbc\x20database\x20found');}if(!this[_0x9f8e('0x8b')](_0x38be67[_0x9f8e('0xdc')])){return this['channel']['error'](_0x38be67,_0x9f8e('0xdd'));}var _0xa83dcf=_0x38be67[_0x9f8e('0xdc')][_0x9f8e('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('query:\x20%s',_0xa83dcf));var _0x519eee=this['getQueryOdbc']['sync'](this,_0x4a2477,_0xa83dcf);this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x38be67,_0xa83dcf);if(!this[_0x9f8e('0x8b')](_0x38be67[_0x9f8e('0xde')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xdf'));}var _0x305421=this[_0x9f8e('0x14')][_0x9f8e('0x73')](this,_0x38be67['variable_id']);if(!_0x305421){return this['channel']['error'](_0x38be67,_0x9f8e('0xe0'));}var _0xcb9710=this;_0x519eee['forEach'](function(_0x5da48e,_0x404ecf){Object[_0x9f8e('0xe1')](_0x5da48e)['forEach'](function(_0x1461a4){_0xcb9710[_0x9f8e('0x3a')][_0x9f8e('0xa4')](util[_0x9f8e('0x2d')](_0x9f8e('0xe2'),_0x305421,_0x404ecf,_0x1461a4),_0x5da48e[_0x1461a4]);});});this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](util['format'](_0x9f8e('0xe3'),_0x305421),_0x519eee['length']);return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format']('variable\x20%s\x20set',_0x305421));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xe4')]=function(_0x8a05ee){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x8a05ee[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x8a05ee[_0x9f8e('0xe5')])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x8a05ee,'no\x20user\x20selected');}var _0x58ebcb=this[_0x9f8e('0x1f')][_0x9f8e('0x73')](this,_0x8a05ee[_0x9f8e('0xe5')]);if(!_0x58ebcb){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x8a05ee,_0x9f8e('0xe6'));}var _0x43fdda=this[_0x9f8e('0x3a')]['exec'](_0x9f8e('0xe7'),[util[_0x9f8e('0x2d')]('SIP/%s',_0x58ebcb),_0x8a05ee[_0x9f8e('0x6b')],_0x8a05ee[_0x9f8e('0xe8')],_0x8a05ee[_0x9f8e('0x6a')]]);if(_0x43fdda[_0x9f8e('0xa8')]===-0x1){return _0x43fdda;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xe9')]=function(_0x54e040){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0xea'),_0x54e040[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x54e040[_0x9f8e('0x7e')])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0xeb'));}if(!this[_0x9f8e('0x8b')](_0x54e040[_0x9f8e('0x61')])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0xaf'));}this[_0x9f8e('0x3a')][_0x9f8e('0xec')]=!![];this[_0x9f8e('0x39')](_0x54e040);this['createSquareMessage'](_0x54e040[_0x9f8e('0x61')],'in','','');this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0xed'),_0x54e040[_0x9f8e('0x61')]));var _0x189818=this[_0x9f8e('0x7d')][_0x9f8e('0x73')](this,_0x54e040);if(_0x189818){for(var _0x99dc8c in _0x189818){if(_0x189818['hasOwnProperty'](_0x99dc8c)){this[_0x9f8e('0x3a')]['setVariable'](util[_0x9f8e('0x2d')](_0x9f8e('0xee'),_0x99dc8c[_0x9f8e('0xef')]()),_0x189818[_0x99dc8c]);}}this[_0x9f8e('0xf0')](_0x189818[_0x9f8e('0xf1')],_0x9f8e('0xf2'),'dialogflow','');return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0xf3'),_0x189818[_0x9f8e('0xf1')]));}return this['channel'][_0x9f8e('0x31')](_0x54e040,_0x9f8e('0xf4'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xf5')]=function(_0xe87955){logger[_0x9f8e('0xa9')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0xe87955[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0xe87955['dialogflowV2_project_id'])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0xe87955[_0x9f8e('0x81')])){return this['channel'][_0x9f8e('0xae')]('no\x20client_email\x20configured');}if(!this[_0x9f8e('0x8b')](_0xe87955[_0x9f8e('0x82')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0xe87955[_0x9f8e('0x83')])){return this['channel']['noop']('no\x20anguage\x20configured');}if(!this[_0x9f8e('0x8b')](_0xe87955['text'])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xaf'));}this[_0x9f8e('0x3a')][_0x9f8e('0xec')]=!![];this[_0x9f8e('0x39')](_0xe87955);this[_0x9f8e('0xf0')](_0xe87955['text'],'in','','');this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format'](_0x9f8e('0xf6'),_0xe87955['text']));var _0x4bfe5e=this[_0x9f8e('0x7f')]['sync'](this,_0xe87955);if(_0x4bfe5e){for(var _0x177f4e in _0x4bfe5e){if(_0x4bfe5e[_0x9f8e('0x9a')](_0x177f4e)){if(_0x177f4e!=='providerResponse'){this[_0x9f8e('0x3a')]['setVariable'](util[_0x9f8e('0x2d')](_0x9f8e('0xee'),_0x177f4e[_0x9f8e('0xef')]()),_0x4bfe5e[_0x177f4e]);}}}this[_0x9f8e('0xf0')](_0x4bfe5e[_0x9f8e('0xf1')],_0x9f8e('0xf2'),_0x9f8e('0xf5'),_0x4bfe5e[_0x9f8e('0xf7')]);return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format'](_0x9f8e('0xf8'),_0x4bfe5e[_0x9f8e('0xf1')]));}return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0xe87955,_0x9f8e('0xf9'));};AGIVertices['prototype'][_0x9f8e('0xfa')]=function(_0x524c47){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x524c47[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x524c47[_0x9f8e('0xfb')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xfc'));}if(!this[_0x9f8e('0x8b')](_0x524c47[_0x9f8e('0xfd')])){return this['channel'][_0x9f8e('0xae')]('no\x20username\x20configured');}if(!this[_0x9f8e('0x8b')](_0x524c47[_0x9f8e('0xfe')])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0x9f8e('0x8b')](_0x524c47[_0x9f8e('0xff')])){return this['channel'][_0x9f8e('0xae')]('no\x20text\x20configured');}this[_0x9f8e('0x3a')][_0x9f8e('0xec')]=!![];this['createSquareDetailsReport'](_0x524c47);this[_0x9f8e('0xf0')](_0x524c47[_0x9f8e('0x61')],'in','','');this['channel'][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x100'),_0x524c47[_0x9f8e('0x61')]));var _0x371c5d=this[_0x9f8e('0x84')]['sync'](this,_0x524c47);if(_0x371c5d){for(var _0x132f4c in _0x371c5d){if(_0x371c5d[_0x9f8e('0x9a')](_0x132f4c)){this[_0x9f8e('0x3a')]['setVariable'](util[_0x9f8e('0x2d')](_0x9f8e('0x101'),_0x132f4c[_0x9f8e('0xef')]()),_0x371c5d[_0x132f4c]);}}this[_0x9f8e('0xf0')](_0x371c5d[_0x9f8e('0xf1')],'out','sesteknda','');if(_0x371c5d[_0x9f8e('0x102')]){this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x103'),_0x371c5d['audiofile']));var _0x439f38=this[_0x9f8e('0x3a')]['streamFile'](_0x371c5d['audiofile']);try{fs[_0x9f8e('0x104')](_0x371c5d['audiofile']+_0x9f8e('0x105'));}catch(_0x315ea5){logger[_0x9f8e('0x31')](_0x315ea5);}return _0x439f38;}else{return this['channel'][_0x9f8e('0xae')](util['format']('SestekNDA\x20Result\x20%s',_0x371c5d[_0x9f8e('0xf1')]));}}return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x524c47,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x9f8e('0x13')]['end']=function(_0x153df7){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x106'),_0x153df7[_0x9f8e('0xb3')]));return this['channel'][_0x9f8e('0xae')](_0x9f8e('0x107'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x108')]=function(_0xe1a0bc){logger[_0x9f8e('0xa9')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xe1a0bc[_0x9f8e('0xb3')]));var _0x2789bf='';if(_0xe1a0bc[_0x9f8e('0x109')]){if(!this[_0x9f8e('0x8b')](_0xe1a0bc[_0x9f8e('0x109')])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0xe1a0bc,_0x9f8e('0x10a'));}else{var _0x37b577=parseInt(_0xe1a0bc[_0x9f8e('0x109')],0xa);if(isNaN(_0x37b577)){_0x2789bf=_0xe1a0bc[_0x9f8e('0x109')];}else{_0x2789bf=this[_0x9f8e('0x21')][_0x9f8e('0x73')](this,_0xe1a0bc['trunk_id']);if(!_0x2789bf){return this[_0x9f8e('0x3a')]['error'](_0xe1a0bc,'no\x20trunk\x20found');}}}}else if(_0xe1a0bc[_0x9f8e('0x10b')]){_0x2789bf=_0xe1a0bc[_0x9f8e('0x10b')];}else{return this[_0x9f8e('0x3a')]['error'](_0xe1a0bc,_0x9f8e('0x10a'));}var _0x1e6c6c=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')](_0x9f8e('0xe7'),[util['format'](_0x9f8e('0x10c'),_0x2789bf,_0xe1a0bc['phone']),_0xe1a0bc['timeout'],_0xe1a0bc[_0x9f8e('0xe8')],_0xe1a0bc[_0x9f8e('0x6a')]]);if(_0x1e6c6c['result']===-0x1){return _0x1e6c6c;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format'](_0x9f8e('0x10d'),_0x9f8e('0xe7')));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x10e')]=function(_0xc20cf4){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x10f'),_0xc20cf4[_0x9f8e('0xb3')]));return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x10e'));};AGIVertices['prototype'][_0x9f8e('0x110')]=function(_0x469930){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x469930[_0x9f8e('0xb3')]));if(_0x469930[_0x9f8e('0xac')]===0x0){return this[_0x9f8e('0xab')](_0x469930);}_0x469930['retry']-=0x1;if(!this[_0x9f8e('0x8b')](_0x469930['file_id'])){return this['channel'][_0x9f8e('0x31')](_0x469930,_0x9f8e('0x111'));}var _0x11ee93=this[_0x9f8e('0x112')][_0x9f8e('0x73')](this,_0x469930[_0x9f8e('0x113')]);if(!_0x11ee93){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x469930,_0x9f8e('0x114'));}if(!this['isConfigured'](_0x469930[_0x9f8e('0xde')])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x9f8e('0xdf'));}var _0x19bff9=this[_0x9f8e('0x3a')][_0x9f8e('0x115')](_0x11ee93,_0x469930[_0x9f8e('0x116')],_0x469930[_0x9f8e('0x117')]);var _0x36bd62=_0x19bff9[_0x9f8e('0xa8')]?_0x19bff9['result'][_0x9f8e('0x50')]():'';logger['info'](_0x9f8e('0x118'),JSON[_0x9f8e('0x77')](_0x19bff9));if(_0x19bff9['result']===-0x1){this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x469930,_0x36bd62);return _0x19bff9;}else if(_0x19bff9[_0x9f8e('0xa6')]==='timeout'){_0x19bff9[_0x9f8e('0xa8')]=_0x36bd62[_0x9f8e('0x9f')]>=parseInt(_0x469930[_0x9f8e('0x119')])?'x':'i';}else{_0x19bff9[_0x9f8e('0xa8')]=_0x36bd62[_0x9f8e('0x9f')]>=parseInt(_0x469930['mindigit'])&&_0x36bd62[_0x9f8e('0x9f')]<=parseInt(_0x469930[_0x9f8e('0x117')])?'x':'i';}var _0x44b272=this['getVariable'][_0x9f8e('0x73')](this,_0x469930['variable_id']);if(!_0x44b272){return this[_0x9f8e('0x3a')]['error'](_0x469930,_0x9f8e('0xe0'));}this[_0x9f8e('0x3a')]['setVariable'](_0x44b272,_0x36bd62);if(this['isConfigured'](_0x469930['hiddendigitsnum'])){var _0x3d69f0=parseInt(_0x469930[_0x9f8e('0x11a')],0xa);var _0x9a17f0=rs[_0x9f8e('0x11b')]({'charset':'*','length':_0x3d69f0});var _0x4a102d=_0x36bd62['length'];if(_0x4a102d>0x0){if(_0x4a102d>_0x3d69f0){this[_0x9f8e('0x39')]['sync'](this,_0x469930,_0x469930['hiddendigitspos']===_0x9f8e('0x11c')?_0x9a17f0+_0x36bd62['substr'](_0x3d69f0):_0x36bd62['substr'](0x0,_0x4a102d-_0x3d69f0)+_0x9a17f0);}else{this[_0x9f8e('0x39')]['sync'](this,_0x469930,rs['generate']({'charset':'*','length':_0x4a102d}));}}else{this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x469930,'');}}else{this['createSquareDetailsReport'][_0x9f8e('0x73')](this,_0x469930,_0x36bd62);}return _0x19bff9;};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x10')]=function(_0x23043e){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x23043e[_0x9f8e('0xb3')]));return this[_0x9f8e('0x110')](_0x23043e);};AGIVertices[_0x9f8e('0x13')]['goal']=function(_0x5c0f79){logger['info'](util['format'](_0x9f8e('0x11d'),_0x5c0f79[_0x9f8e('0xb3')]));this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x5c0f79,_0x5c0f79[_0x9f8e('0x11e')]);return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x11f'),_0x5c0f79['goalname']));};AGIVertices['prototype'][_0x9f8e('0x120')]=function(_0x333ca5){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x121'),_0x333ca5[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x333ca5[_0x9f8e('0x8d')])||!this[_0x9f8e('0x8b')](_0x333ca5[_0x9f8e('0x93')])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0x122'));}if(!this['isConfigured'](_0x333ca5['text'])){return this['channel'][_0x9f8e('0xae')](_0x9f8e('0xaf'));}this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x123'),_0x333ca5[_0x9f8e('0x61')]));var _0x42eb04=this[_0x9f8e('0x124')][_0x9f8e('0x73')](this,_0x333ca5);if(_0x42eb04){this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format'](_0x9f8e('0x125'),_0x42eb04));var _0xa1d0a2=this[_0x9f8e('0x3a')][_0x9f8e('0x126')](_0x42eb04);try{fs[_0x9f8e('0x104')](_0x42eb04+_0x9f8e('0x105'));}catch(_0x5e656d){logger[_0x9f8e('0x31')](_0x5e656d);}return _0xa1d0a2;}return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x333ca5,_0x9f8e('0x127'));};AGIVertices[_0x9f8e('0x13')]['awslex']=function(_0x1b8fb4){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x128'),_0x1b8fb4['label']));if(!this[_0x9f8e('0x8b')](_0x1b8fb4[_0x9f8e('0x8d')])||!this[_0x9f8e('0x8b')](_0x1b8fb4[_0x9f8e('0x93')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x122'));}if(!this[_0x9f8e('0x8b')](_0x1b8fb4[_0x9f8e('0x94')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x129'));}if(!this[_0x9f8e('0x8b')](_0x1b8fb4[_0x9f8e('0x61')])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0xaf'));}this[_0x9f8e('0x3a')]['bot']=!![];this['createSquareDetailsReport'](_0x1b8fb4);this[_0x9f8e('0xf0')](_0x1b8fb4[_0x9f8e('0x61')],'in','','');this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format'](_0x9f8e('0x12a'),_0x1b8fb4['text']));var _0x14a1d9=this['awsLex'][_0x9f8e('0x73')](this,_0x1b8fb4);if(_0x14a1d9){for(var _0x41c74d in _0x14a1d9){if(_0x14a1d9['hasOwnProperty'](_0x41c74d)&&_['isString'](_0x14a1d9[_0x41c74d])){this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](util['format'](_0x9f8e('0x12b'),_0x41c74d[_0x9f8e('0xef')]()),_0x14a1d9[_0x41c74d]);}}if(_['isNil'](_0x14a1d9[_0x9f8e('0x7b')])){return this['channel'][_0x9f8e('0xae')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x9f8e('0xf0')](_0x14a1d9[_0x9f8e('0x7b')],_0x9f8e('0xf2'),_0x9f8e('0x12c'),'');return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x12d'),_0x14a1d9[_0x9f8e('0x7b')]));}}return this[_0x9f8e('0x3a')]['error'](_0x1b8fb4,_0x9f8e('0x12e'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x12f')]=function(_0x444910){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x130'),_0x444910['label'],_0x444910[_0x9f8e('0x6b')]));if(!this[_0x9f8e('0x8b')](_0x444910[_0x9f8e('0x7e')])){return this['channel'][_0x9f8e('0xae')](_0x9f8e('0xeb'));}var _0x1e7fd2=_0x9f8e('0x131');var _0x47ac6f=util[_0x9f8e('0x2d')](_0x9f8e('0x132'),FILES_PATH,rs['generate'](0x4));var _0x4e0c5c=util[_0x9f8e('0x2d')](_0x9f8e('0xa3'),_0x47ac6f,_0x1e7fd2);var _0x3d0c6f=!![];if(_0x444910['beep']===_0x9f8e('0x133')){_0x3d0c6f=![];}var _0x43e09d=this[_0x9f8e('0x3a')]['recordFile'](_0x47ac6f,_0x1e7fd2,_0x444910['intKey'],_0x444910['timeout'],undefined,_0x3d0c6f);if(_0x43e09d[_0x9f8e('0xa8')]!==-0x1){this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0x134'),_0x4e0c5c));var _0x4ee19d=this['googleASR']['sync'](this,_0x444910,_0x4e0c5c);if(_0x4ee19d){for(var _0x28d43e in _0x4ee19d){if(_0x4ee19d[_0x9f8e('0x9a')](_0x28d43e)){this['channel']['setVariable'](util[_0x9f8e('0x2d')](_0x9f8e('0x135'),_0x28d43e[_0x9f8e('0xef')]()),_0x4ee19d[_0x28d43e]);}}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x136'),JSON['stringify'](_0x4ee19d)));}}return _0x43e09d;};AGIVertices[_0x9f8e('0x13')]['tildeasr']=function(_0x500a53){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x137'),_0x500a53[_0x9f8e('0xb3')]));if(!this['isConfigured'](_0x500a53['appid'])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0x138'));}if(!this[_0x9f8e('0x8b')](_0x500a53[_0x9f8e('0x98')])){return this['channel'][_0x9f8e('0xae')]('no\x20appsecret\x20configured');}var _0x34aa70=_0x9f8e('0x131');var _0x5cf98f=util[_0x9f8e('0x2d')](_0x9f8e('0x132'),FILES_PATH,rs[_0x9f8e('0x11b')](0x4));var _0x5376dd=util[_0x9f8e('0x2d')](_0x9f8e('0xa3'),_0x5cf98f,_0x34aa70);var _0x2718b8=!![];if(_0x500a53[_0x9f8e('0x139')]===_0x9f8e('0x133')){_0x2718b8=![];}var _0x162a3a=this[_0x9f8e('0x3a')][_0x9f8e('0x13a')](_0x5cf98f,_0x34aa70,_0x500a53[_0x9f8e('0x13b')],_0x500a53[_0x9f8e('0x6b')],undefined,_0x2718b8);if(_0x162a3a[_0x9f8e('0xa8')]!==-0x1){this['channel']['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0x13c'),_0x5376dd));var _0x3c0fef=this[_0x9f8e('0x97')][_0x9f8e('0x73')](this,_0x500a53,_0x5376dd);if(_0x3c0fef){for(var _0x50343a in _0x3c0fef){if(_0x3c0fef[_0x9f8e('0x9a')](_0x50343a)){this[_0x9f8e('0x3a')]['setVariable'](util[_0x9f8e('0x2d')](_0x9f8e('0x13d'),_0x50343a[_0x9f8e('0xef')]()),_0x3c0fef[_0x50343a]);}}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x13e'),JSON[_0x9f8e('0x77')](_0x3c0fef)));}}return _0x162a3a;};AGIVertices['prototype'][_0x9f8e('0x13f')]=function(_0x3a80f2){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x140'),_0x3a80f2[_0x9f8e('0xb3')]));return this[_0x9f8e('0x3a')]['continueAt'](_0x3a80f2[_0x9f8e('0x3f')],_0x3a80f2['extension'],_0x3a80f2[_0x9f8e('0x41')]);};AGIVertices['prototype'][_0x9f8e('0x141')]=function(_0x20250c){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0x142'),_0x20250c[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x20250c['condition'])){return this['channel'][_0x9f8e('0x31')](_0x20250c,_0x9f8e('0x143'));}try{var _0xb8d40e=eval(_0x20250c[_0x9f8e('0x144')])?_0x9f8e('0x145'):_0x9f8e('0x146');this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('EVAL\x20CONDITION\x20%s\x20%s',_0x20250c[_0x9f8e('0x144')],_0xb8d40e));return{'code':0xc8,'result':_0xb8d40e};}catch(_0x3192c1){return{'code':0xc8,'result':_0x9f8e('0x146')};}};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x147')]=function(_0x2fd6a8){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x148'),_0x2fd6a8[_0x9f8e('0xb3')]));if(!this['isConfigured'](_0x2fd6a8['interval_id'])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x2fd6a8,_0x9f8e('0x149'));}var _0x3b1303=this[_0x9f8e('0x27')][_0x9f8e('0x73')](this,_0x2fd6a8[_0x9f8e('0x14a')]);if(!_0x3b1303){return this['channel'][_0x9f8e('0x31')](_0x2fd6a8,_0x9f8e('0x14b'));}for(var _0x2db408=0x0;_0x2db408<_0x3b1303[_0x9f8e('0x9f')];_0x2db408+=0x1){var _0x3168f6=this[_0x9f8e('0x3a')][_0x9f8e('0x14')](util['format'](_0x9f8e('0x14c'),_0x3b1303[_0x2db408]));if(_0x3168f6[_0x9f8e('0xa8')]===-0x1){return _0x3168f6;}logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x14d'),_0x3b1303[_0x2db408],_0x3168f6[_0x9f8e('0xa6')]));if(_0x3168f6[_0x9f8e('0xa6')]===_0x9f8e('0x145')){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x14d'),_0x3b1303[_0x2db408],'true'));this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x14d'),_0x3b1303[_0x2db408],_0x9f8e('0x145')));return{'code':0xc8,'result':_0x9f8e('0x145')};}else{logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x14d'),_0x3b1303[_0x2db408],_0x9f8e('0x146')));this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0x14d'),_0x3b1303[_0x2db408],_0x9f8e('0x146')));}}return{'code':0xc8,'result':_0x9f8e('0x146')};};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x14e')]=function(_0x3eb1de){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0x14f'),_0x3eb1de['label']));return this['channel'][_0x9f8e('0x14e')]();};AGIVertices['prototype'][_0x9f8e('0x150')]=function(_0x2009c7){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2009c7[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x2009c7[_0x9f8e('0x7e')])){return this['channel'][_0x9f8e('0xae')](_0x9f8e('0xeb'));}var _0x24d424=_0x9f8e('0x131');var _0x12f86e=util[_0x9f8e('0x2d')](_0x9f8e('0x132'),FILES_PATH,rs[_0x9f8e('0x11b')](0x4));var _0x5f18a7=util['format'](_0x9f8e('0xa3'),_0x12f86e,_0x24d424);var _0x1c8942=!![];if(_0x2009c7[_0x9f8e('0x139')]===_0x9f8e('0x133')){_0x1c8942=![];}var _0x2aedeb=this[_0x9f8e('0x3a')]['recordFile'](_0x12f86e,_0x24d424,_0x2009c7[_0x9f8e('0x13b')],_0x2009c7[_0x9f8e('0x6b')],undefined,_0x1c8942);if(_0x2aedeb[_0x9f8e('0xa8')]!==-0x1){this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0x151'),_0x5f18a7));var _0x5d0a5c=this[_0x9f8e('0x88')][_0x9f8e('0x73')](this,_0x2009c7,_0x5f18a7);if(_0x5d0a5c){for(var _0x142bf9 in _0x5d0a5c){if(_0x5d0a5c[_0x9f8e('0x9a')](_0x142bf9)){this[_0x9f8e('0x3a')]['setVariable'](util['format'](_0x9f8e('0x152'),_0x142bf9[_0x9f8e('0xef')]()),_0x5d0a5c[_0x142bf9]);}}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x9f8e('0x77')](_0x5d0a5c)));}}return _0x2aedeb;};AGIVertices[_0x9f8e('0x13')]['ispeechtts']=function(_0x25dd10){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x153'),_0x25dd10[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x25dd10[_0x9f8e('0x7e')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xeb'));}if(!this[_0x9f8e('0x8b')](_0x25dd10[_0x9f8e('0x61')])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0xaf'));}this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x154'),_0x25dd10[_0x9f8e('0x61')]));var _0x127dd1=this[_0x9f8e('0x85')][_0x9f8e('0x73')](this,_0x25dd10);if(_0x127dd1){this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format'](_0x9f8e('0x151'),_0x127dd1));var _0x34a437=this[_0x9f8e('0x3a')][_0x9f8e('0x126')](_0x127dd1,_0x25dd10[_0x9f8e('0x13b')]);try{fs[_0x9f8e('0x104')](_0x127dd1+_0x9f8e('0x105'));}catch(_0x17a8a7){logger['error'](_0x17a8a7);}return _0x34a437;}return this['channel'][_0x9f8e('0x31')](_0x25dd10,_0x9f8e('0x155'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x156')]=function(_0x38c025){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x38c025[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x38c025[_0x9f8e('0x157')])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x38c025,'no\x20find\x20by\x20configured');}logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x158'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x38c025['findBy']));var _0x3a35da=this[_0x9f8e('0x159')][_0x9f8e('0x73')](this,_0x38c025[_0x9f8e('0x157')]);if(_0x3a35da){logger['info'](util['format'](_0x9f8e('0x15a'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x38c025[_0x9f8e('0x157')]));this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x15a'),this['channel'][_0x9f8e('0x3d')],_0x38c025[_0x9f8e('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x15b'),this[_0x9f8e('0x3a')]['callerid'],_0x38c025['findBy']));this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x15b'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x38c025[_0x9f8e('0x157')]));return{'code':0xc8,'result':_0x9f8e('0x15c')};}};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x15d')]=function(_0x18a1e8){logger['info'](util['format'](_0x9f8e('0x15e'),_0x18a1e8[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x18a1e8['findBy'])){return this['channel'][_0x9f8e('0x31')](_0x18a1e8,'no\x20find\x20by\x20configured');}logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x158'),this['channel'][_0x9f8e('0x3d')],_0x18a1e8['findBy']));var _0xee3111=this[_0x9f8e('0x57')][_0x9f8e('0x73')](this,_0x18a1e8[_0x9f8e('0x157')]);if(_0xee3111){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x15a'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x18a1e8[_0x9f8e('0x157')]));this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x18a1e8['findBy']));return{'code':0xc8,'result':_0x9f8e('0x15f')};}else{logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x15b'),this['channel'][_0x9f8e('0x3d')],_0x18a1e8[_0x9f8e('0x157')]));this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x15b'),this[_0x9f8e('0x3a')]['callerid'],_0x18a1e8[_0x9f8e('0x157')]));return{'code':0xc8,'result':_0x9f8e('0x15c')};}};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x160')]=function(_0x169dbe){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x169dbe[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x169dbe[_0x9f8e('0x161')])){return this[_0x9f8e('0x3a')]['error'](_0x169dbe,_0x9f8e('0x162'));}this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x163'),_0x169dbe[_0x9f8e('0x161')]));var _0x51b687=eval(_0x169dbe[_0x9f8e('0x161')]);if(!this[_0x9f8e('0x8b')](_0x169dbe[_0x9f8e('0xde')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xdf'));}var _0x23e0d6=this[_0x9f8e('0x14')][_0x9f8e('0x73')](this,_0x169dbe['variable_id']);if(!_0x23e0d6){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x169dbe,_0x9f8e('0xe0'));}if(_['isArray'](_0x51b687)){var _0x5350e2=this;_0x51b687[_0x9f8e('0x164')](function(_0x18e24b,_0x10e660){_0x5350e2[_0x9f8e('0x3a')][_0x9f8e('0xa4')](util['format'](_0x9f8e('0x165'),_0x23e0d6,_0x10e660),_0x18e24b);});return this['channel'][_0x9f8e('0xae')](util[_0x9f8e('0x2d')]('variable\x20%s[key]\x20set',_0x23e0d6));}else{return this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](_0x23e0d6,_0x51b687);}};AGIVertices['prototype']['menu']=function(_0x40abdd){logger['info'](util[_0x9f8e('0x2d')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x40abdd[_0x9f8e('0xb3')]));if(_0x40abdd['retry']===0x0){return this['maxRetry'](_0x40abdd);}_0x40abdd[_0x9f8e('0xac')]-=0x1;if(!this['isConfigured'](_0x40abdd[_0x9f8e('0x113')])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x40abdd,_0x9f8e('0x111'));}var _0x37387e=this[_0x9f8e('0x112')][_0x9f8e('0x73')](this,_0x40abdd['file_id']);if(!_0x37387e){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x40abdd,_0x9f8e('0x114'));}var _0x5aca99=this[_0x9f8e('0x3a')]['getData'](_0x37387e,_0x40abdd['response'],_0x40abdd[_0x9f8e('0x166')]);var _0x527844=_0x5aca99[_0x9f8e('0xa8')];if(_0x5aca99['result']===-0x1){this['createSquareDetailsReport'][_0x9f8e('0x73')](this,_0x40abdd,'-1');return _0x5aca99;}else if(_0x5aca99[_0x9f8e('0xa6')]===_0x9f8e('0x6b')){_0x5aca99[_0x9f8e('0xa8')]=_0x5aca99[_0x9f8e('0xa8')]['length']>0x0?_0x5aca99[_0x9f8e('0xa8')]:'t';}else if(_['isEmpty'](_0x5aca99[_0x9f8e('0xa8')])){_0x5aca99[_0x9f8e('0xa8')]='#';_0x527844='#';}if(!this[_0x9f8e('0x8b')](_0x40abdd[_0x9f8e('0xde')])){this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xdf'));}else{var _0x3b1b4e=this[_0x9f8e('0x14')][_0x9f8e('0x73')](this,_0x40abdd[_0x9f8e('0xde')]);if(!_0x3b1b4e){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x40abdd,_0x9f8e('0xe0'));}this[_0x9f8e('0x3a')]['setVariable'](_0x3b1b4e,_0x527844);}this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x40abdd,_0x527844);return _0x5aca99;};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0xae')]=function(_0x497ca7){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x167'),_0x497ca7[_0x9f8e('0xb3')]));return this[_0x9f8e('0x3a')]['noop'](_0x497ca7[_0x9f8e('0x168')]||_0x497ca7[_0x9f8e('0xb3')]);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x169')]=function(_0x16895e){logger['info'](util['format'](_0x9f8e('0x16a'),_0x16895e[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x16895e[_0x9f8e('0x157')])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x16895e,'no\x20find\x20by\x20configured');}logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x16895e[_0x9f8e('0x157')]));var _0x4e7951=this[_0x9f8e('0x52')][_0x9f8e('0x73')](this,_0x16895e[_0x9f8e('0x16b')]);var _0x917494=this[_0x9f8e('0x54')][_0x9f8e('0x73')](this,_0x16895e[_0x9f8e('0x157')],_0x4e7951);if(_0x917494){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x15a'),this['channel'][_0x9f8e('0x3d')],_0x16895e[_0x9f8e('0x157')]));this['channel'][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x15a'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x16895e[_0x9f8e('0x157')]));return{'code':0xc8,'result':_0x9f8e('0x15f')};}else{logger['info'](util[_0x9f8e('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x16895e[_0x9f8e('0x157')]));this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0x15a'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x16895e[_0x9f8e('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x16c')]=function(_0x556c92){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x16d'),_0x556c92[_0x9f8e('0xb3')]));if(!this['isConfigured'](_0x556c92['file_id'])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x556c92,'no\x20file\x20audio\x20selected');}var _0xd6961a=this[_0x9f8e('0x112')][_0x9f8e('0x73')](this,_0x556c92[_0x9f8e('0x113')]);if(!_0xd6961a){return this['channel'][_0x9f8e('0x31')](_0x556c92,_0x9f8e('0x114'));}var _0x5263ea=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')](_0x9f8e('0x16e'),[_0xd6961a,_0x556c92[_0x9f8e('0xe8')]]);if(_0x5263ea['result']===-0x1){return _0x5263ea;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0xc6'),'PLAYBACK',_0xd6961a));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x16f')]=function(_0x1dfaaf){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0x170'),_0x1dfaaf['label']));if(!this['isConfigured'](_0x1dfaaf['queue_id'])){return this['channel'][_0x9f8e('0x31')](_0x1dfaaf,_0x9f8e('0x171'));}var _0x3528f2='';var _0x2f4d47=parseInt(_0x1dfaaf[_0x9f8e('0x172')],0xa);if(isNaN(_0x2f4d47)){_0x3528f2=_0x1dfaaf['queue_id'];}else{_0x3528f2=this[_0x9f8e('0x18')][_0x9f8e('0x73')](this,_0x1dfaaf[_0x9f8e('0x172')]);if(!_0x3528f2){return this['channel'][_0x9f8e('0x31')](_0x1dfaaf,_0x9f8e('0x173'));}}var _0x5b4b7b='';if(this['isConfigured'](_0x1dfaaf[_0x9f8e('0x113')])){var _0x37017b=this['getSound']['sync'](this,_0x1dfaaf[_0x9f8e('0x113')]);if(_0x37017b){_0x5b4b7b=_0x37017b;}}this['createSquareDetailsReport']['sync'](this,_0x1dfaaf,_0x3528f2);if(_0x1dfaaf[_0x9f8e('0xe8')][_0x9f8e('0x174')]('x')<0x0){_0x1dfaaf[_0x9f8e('0xe8')]+='x';}if(_0x1dfaaf[_0x9f8e('0xe8')]['indexOf']('X')<0x0){_0x1dfaaf[_0x9f8e('0xe8')]+='X';}this['channel'][_0x9f8e('0xa4')](_0x9f8e('0x175'),_0x3528f2?_0x3528f2[_0x9f8e('0x176')]():'');var _0x142725=this['channel'][_0x9f8e('0xb0')](_0x9f8e('0x177'),[_0x3528f2,_0x1dfaaf[_0x9f8e('0xe8')],_0x1dfaaf[_0x9f8e('0x6a')],_0x5b4b7b,_0x1dfaaf[_0x9f8e('0x6b')],_0x1dfaaf['agi'],_0x1dfaaf['macro'],_0x1dfaaf[_0x9f8e('0x178')],'',_0x1dfaaf[_0x9f8e('0x179')]]);if(_0x142725[_0x9f8e('0xa8')]===-0x1){return _0x142725;}return this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')]('Executed\x20command\x20%s\x20%s',_0x9f8e('0x177'),_0x3528f2));};AGIVertices['prototype'][_0x9f8e('0x17a')]=function(_0x356864){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0x17b'),_0x356864[_0x9f8e('0xb3')]));var _0x46bf96=_0x356864[_0x9f8e('0x17c')]||_0x9f8e('0x131');var _0x171ea2=util[_0x9f8e('0x2d')](_0x9f8e('0x17d'),this[_0x9f8e('0x3a')][_0x9f8e('0x3b')],rs[_0x9f8e('0x11b')](0x5));var _0x454c30=util[_0x9f8e('0x2d')](_0x9f8e('0x17e'),FILES_PATH,_0x171ea2,_0x46bf96);var _0x3a8352=util[_0x9f8e('0x2d')](_0x9f8e('0x132'),FILES_PATH,_0x171ea2);this[_0x9f8e('0x3e')]['sync'](this,_0x356864,_0x171ea2,_0x454c30);this[_0x9f8e('0x3a')][_0x9f8e('0xa4')]('RECORDING_SAVENAME',_0x171ea2);logger[_0x9f8e('0xa9')](_0x9f8e('0x17f'),_0x3a8352,_0x46bf96,_0x356864['escape_digits'],_0x356864['timeout']);return this['channel'][_0x9f8e('0x13a')](_0x3a8352,_0x46bf96,_0x356864[_0x9f8e('0x180')],_0x356864[_0x9f8e('0x6b')],undefined,!![]);};AGIVertices['prototype'][_0x9f8e('0x181')]=function(_0x872a6b){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x182'),_0x872a6b[_0x9f8e('0xb3')]));if(!this['isConfigured'](_0x872a6b[_0x9f8e('0x6a')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')]('no\x20url\x20configured');}var _0x6b1104=this[_0x9f8e('0x69')]['sync'](this,_0x872a6b);logger['info'](util['format'](_0x9f8e('0x183'),util['inspect'](_0x6b1104,{'showHidden':![],'depth':null})));if(!this[_0x9f8e('0x8b')](_0x872a6b[_0x9f8e('0xde')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x184'));}var _0x54554f=this[_0x9f8e('0x14')]['sync'](this,_0x872a6b[_0x9f8e('0xde')]);if(!_0x54554f){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x872a6b,'no\x20variable\x20found');}this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](util[_0x9f8e('0x2d')](_0x9f8e('0x185'),_0x54554f),_0x6b1104[_0x9f8e('0x7a')]?_0x6b1104[_0x9f8e('0x7a')]:_0x9f8e('0x186'));this['channel'][_0x9f8e('0xa4')](util['format']('%s_STATUS_MESSAGE',_0x54554f),_0x6b1104['statusMessage']?_0x6b1104[_0x9f8e('0x187')]:'OK');if(_0x6b1104[_0x9f8e('0x78')]){try{this[_0x9f8e('0xa2')](_0x6b1104['body'],_0x54554f);}catch(_0x18f415){logger[_0x9f8e('0x31')](util[_0x9f8e('0x2d')](_0x9f8e('0x188'),_0x54554f));}}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util['format'](_0x9f8e('0x189'),_0x54554f));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x18a')]=function(_0x108e2e){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x18b'),_0x108e2e[_0x9f8e('0xb3')]));return this['channel'][_0x9f8e('0x18c')](_0x108e2e[_0x9f8e('0x18d')]['replace'](/\s+/g,''),_0x108e2e[_0x9f8e('0x180')]);};AGIVertices[_0x9f8e('0x13')]['saynumber']=function(_0xa5e767){logger[_0x9f8e('0xa9')](util['format'](_0x9f8e('0x18e'),_0xa5e767[_0x9f8e('0xb3')]));return this['channel']['sayNumber'](_0xa5e767[_0x9f8e('0x6c')]['replace'](/\s+/g,''),_0xa5e767[_0x9f8e('0x180')]);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x18f')]=function(_0x3b225c){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x190'),_0x3b225c[_0x9f8e('0xb3')]));return this['channel'][_0x9f8e('0x191')](_0x3b225c[_0x9f8e('0x61')],_0x3b225c['escape_digits']);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x192')]=function(_0x4d2377){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x193'),_0x4d2377[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x4d2377[_0x9f8e('0x194')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x195'));}var _0x5a2b44=this[_0x9f8e('0x196')][_0x9f8e('0x73')](this,_0x4d2377[_0x9f8e('0x194')]);if(!_0x5a2b44||!_0x5a2b44[_0x9f8e('0x197')]){return this['channel']['error'](_0x4d2377,_0x9f8e('0x198'));}var _0x4ae328={'from':util[_0x9f8e('0x2d')](_0x9f8e('0x199'),_0x5a2b44[_0x9f8e('0x16')],_0x5a2b44[_0x9f8e('0x19a')]||_0x5a2b44[_0x9f8e('0x197')]['user']),'to':_0x4d2377['to']||'','cc':_0x4d2377['cc']||'','bcc':_0x4d2377[_0x9f8e('0x19b')]||'','subject':_0x4d2377[_0x9f8e('0x19c')],'html':_0x4d2377[_0x9f8e('0x61')],'text':_0x4d2377['text']};var _0x3647b9={'tls':{'rejectUnauthorized':![]}};if(_0x5a2b44['Smtp']['service']){_0x3647b9[_0x9f8e('0x19d')]=_0x5a2b44[_0x9f8e('0x197')][_0x9f8e('0x19d')];}else{_0x3647b9['host']=_0x5a2b44[_0x9f8e('0x197')][_0x9f8e('0x19e')];_0x3647b9[_0x9f8e('0x19f')]=_0x5a2b44[_0x9f8e('0x197')][_0x9f8e('0x19f')];_0x3647b9[_0x9f8e('0x1a0')]=_0x5a2b44[_0x9f8e('0x197')]['secure'];}if(_0x5a2b44['Smtp'][_0x9f8e('0x1a1')]){_0x3647b9[_0x9f8e('0x1a2')]={'user':_0x5a2b44['Smtp'][_0x9f8e('0x1a3')],'pass':_0x5a2b44[_0x9f8e('0x197')][_0x9f8e('0x1a4')]};}if(this[_0x9f8e('0x8b')](_0x4d2377[_0x9f8e('0x1a5')])){}logger[_0x9f8e('0x1a6')]('sendMail\x20message',JSON['stringify'](_0x4ae328));this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x4d2377,_0x4d2377[_0x9f8e('0x194')]);this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x1a7'),_0x5a2b44[_0x9f8e('0x16')]));this[_0x9f8e('0x26')][_0x9f8e('0x73')](this,_0x3647b9,_0x4ae328);return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x1a8'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1a9')]=function(_0x91efd6){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x1aa'),_0x91efd6[_0x9f8e('0xb3')]));return this['channel'][_0x9f8e('0xae')](_0x9f8e('0x1ab'));};AGIVertices[_0x9f8e('0x13')]['sendSMS']=function(_0x32e47d){logger['info'](util[_0x9f8e('0x2d')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x32e47d[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x32e47d[_0x9f8e('0x1ac')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x1ad'));}var _0x3dfeff=this[_0x9f8e('0x37')][_0x9f8e('0x73')](this,_0x32e47d[_0x9f8e('0x1ac')]);if(!_0x3dfeff){return this[_0x9f8e('0x3a')]['error'](_0x32e47d,_0x9f8e('0x1ae'));}var _0x2daf93={'body':_0x32e47d[_0x9f8e('0x1af')],'phone':_0x32e47d['to']||'','SmsAccountId':_0x3dfeff['id']};logger['debug']('sendSMS\x20message',JSON['stringify'](_0x2daf93));this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x32e47d,_0x32e47d[_0x9f8e('0x1ac')]);this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0x1b0'),_0x3dfeff[_0x9f8e('0x16')]));this['createSmsMessage'][_0x9f8e('0x73')](this,_0x2daf93);return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0x1b1'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1b2')]=function(_0x1c3487){logger['info'](util['format'](_0x9f8e('0x1b3'),_0x1c3487[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x1c3487['variable_id'])){return this[_0x9f8e('0x3a')]['error'](_0x1c3487,_0x9f8e('0x1b4'));}var _0x27dbcf=this[_0x9f8e('0x14')][_0x9f8e('0x73')](this,_0x1c3487['variable_id']);if(!_0x27dbcf){return this['channel']['error'](_0x1c3487,'no\x20variable\x20found');}return this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](_0x27dbcf,_0x1c3487[_0x9f8e('0x1b5')]);};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1b6')]=function(_0x136cff){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x136cff[_0x9f8e('0xb3')]));this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0x1b7'));if(_0x136cff['answer']===_0x9f8e('0x1b8')){this[_0x9f8e('0x3a')][_0x9f8e('0xae')]('Answer');return this['channel'][_0x9f8e('0xbd')]();}return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0x1b9'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1ba')]=function(_0x12262e){logger['info'](util['format'](_0x9f8e('0x1bb'),_0x12262e[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x12262e['project_id'])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x12262e,_0x9f8e('0x1bc'));}var _0x403c95=this[_0x9f8e('0x1b')]['sync'](this,_0x12262e[_0x9f8e('0x1bd')]);if(!this[_0x9f8e('0x8b')](_0x403c95)){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x12262e,util[_0x9f8e('0x2d')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x12262e[_0x9f8e('0x1bd')]));}if(_0x403c95===this['channel'][_0x9f8e('0x44')]){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x12262e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x12262e,_0x403c95);var _0x5d8d68=this[_0x9f8e('0x3a')][_0x9f8e('0xb0')]('AGI',util[_0x9f8e('0x2d')](_0x9f8e('0x1be'),config[_0x9f8e('0x9')][_0x9f8e('0x19e')]||_0x9f8e('0x1bf'),_0x403c95,this[_0x9f8e('0x3a')][_0x9f8e('0x44')]));if(_0x5d8d68[_0x9f8e('0xa8')]===-0x1){return _0x5d8d68;}return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0xc6'),_0x9f8e('0x1c0'),_0x403c95));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1c1')]=function(_0x7f3591){logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x1c2'),_0x7f3591['label']));var _0x425084=this[_0x9f8e('0x5b')][_0x9f8e('0x73')](this,_0x7f3591[_0x9f8e('0xbb')]);this[_0x9f8e('0x39')][_0x9f8e('0x73')](this,_0x7f3591,_0x7f3591['command']);if(this['isConfigured'](_0x7f3591[_0x9f8e('0xde')])){var _0x411c14=this[_0x9f8e('0x14')][_0x9f8e('0x73')](this,_0x7f3591[_0x9f8e('0xde')]);if(_0x411c14){this[_0x9f8e('0x3a')][_0x9f8e('0xa4')](_0x411c14,_0x425084);return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x1c3'),_0x7f3591[_0x9f8e('0xbb')],_0x411c14));}}return this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x7f3591[_0x9f8e('0xbb')]));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1c4')]=function(_0x54b094){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x54b094[_0x9f8e('0xb3')]));_0x54b094['text']=_0x54b094[_0x9f8e('0x61')][_0x9f8e('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9f8e('0x8b')](_0x54b094['apiKey'])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0x1c5'));}if(!this[_0x9f8e('0x8b')](_0x54b094[_0x9f8e('0x61')])){return this[_0x9f8e('0x3a')][_0x9f8e('0xae')](_0x9f8e('0xaf'));}this['channel']['noop'](util[_0x9f8e('0x2d')](_0x9f8e('0x1c6'),_0x54b094['text']));var _0x4e551c=this[_0x9f8e('0x5e')]['sync'](this,_0x54b094);if(_0x4e551c){this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x1c7'),_0x4e551c));var _0x505fdd=this[_0x9f8e('0x3a')][_0x9f8e('0x126')](_0x4e551c);try{fs[_0x9f8e('0x104')](_0x4e551c+_0x9f8e('0x105'));}catch(_0x51690d){logger['error'](_0x51690d);}return _0x505fdd;}return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x54b094,_0x9f8e('0x1c8'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1c9')]=function(_0x55664f){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x55664f[_0x9f8e('0xb3')]));_0x55664f[_0x9f8e('0x61')]=_0x55664f[_0x9f8e('0x61')][_0x9f8e('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9f8e('0x8b')](_0x55664f['text'])){return this[_0x9f8e('0x3a')]['noop'](_0x9f8e('0xaf'));}this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x1ca'),_0x55664f[_0x9f8e('0x61')]));var _0x206563=this['googleTTS'][_0x9f8e('0x73')](this,_0x55664f);if(_0x206563){this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x1cb'),_0x206563));var _0x51570c=this[_0x9f8e('0x3a')]['streamFile'](_0x206563);try{fs['unlink'](_0x206563+'.wav');}catch(_0x8edffa){logger[_0x9f8e('0x31')](_0x8edffa);}return _0x51570c;}return this[_0x9f8e('0x3a')]['error'](_0x55664f,_0x9f8e('0x1cc'));};AGIVertices[_0x9f8e('0x13')][_0x9f8e('0x1cd')]=function(_0x5bed19){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x1ce'),_0x5bed19['label']));if(!this[_0x9f8e('0x8b')](_0x5bed19[_0x9f8e('0x157')])){return this['channel']['error'](_0x5bed19,_0x9f8e('0x1cf'));}logger['info'](util['format'](_0x9f8e('0x158'),this['channel'][_0x9f8e('0x3d')],_0x5bed19[_0x9f8e('0x157')]));var _0x44bd28=this[_0x9f8e('0x56')][_0x9f8e('0x73')](this,_0x5bed19[_0x9f8e('0x157')]);if(_0x44bd28){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x15a'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x5bed19['findBy']));this['channel'][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x15a'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x5bed19[_0x9f8e('0x157')]));return{'code':0xc8,'result':_0x9f8e('0x15f')};}else{logger['info'](util[_0x9f8e('0x2d')](_0x9f8e('0x15b'),this[_0x9f8e('0x3a')][_0x9f8e('0x3d')],_0x5bed19[_0x9f8e('0x157')]));this[_0x9f8e('0x3a')][_0x9f8e('0xae')](util[_0x9f8e('0x2d')](_0x9f8e('0x15b'),this['channel'][_0x9f8e('0x3d')],_0x5bed19['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9f8e('0x13')]['voicemail']=function(_0xe95dbf){logger[_0x9f8e('0xa9')](util[_0x9f8e('0x2d')](_0x9f8e('0x1d0'),_0xe95dbf[_0x9f8e('0xb3')]));var _0x1a23d2=this[_0x9f8e('0x3a')]['exec'](_0x9f8e('0x1d1'),[_0xe95dbf['mailbox'],_0xe95dbf['options']]);if(_0x1a23d2[_0x9f8e('0xa8')]===-0x1){return _0x1a23d2;}return this[_0x9f8e('0x3a')]['noop'](util[_0x9f8e('0x2d')]('Executed\x20command\x20%s\x20%s',_0x9f8e('0x1d1'),_0xe95dbf['mailbox']));};AGIVertices['prototype'][_0x9f8e('0x1d2')]=function(_0x27d276){logger['info'](util['format'](_0x9f8e('0x1d3'),_0x27d276[_0x9f8e('0xb3')]));if(!this[_0x9f8e('0x8b')](_0x27d276['variable_id'])){return this[_0x9f8e('0x3a')][_0x9f8e('0x31')](_0x27d276,_0x9f8e('0x1b4'));}var _0x187bc5=this['getVariable'][_0x9f8e('0x73')](this,_0x27d276[_0x9f8e('0xde')]);if(!_0x187bc5){return this[_0x9f8e('0x3a')]['error'](_0x27d276,_0x9f8e('0xe0'));}var _0x27b522=this['channel'][_0x9f8e('0x14')](_0x187bc5);return{'code':0xc8,'result':_0x27b522[_0x9f8e('0xa6')]?_0x27b522[_0x9f8e('0xa6')]:'-'};};String[_0x9f8e('0x13')]['replaceAll']=function(_0x5f1a41,_0x414d29){return this[_0x9f8e('0x1d4')](_0x5f1a41)[_0x9f8e('0x1d5')](_0x414d29);};module[_0x9f8e('0x1d6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7ae11f7..559f268 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 _0xdbde=['Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','destlinkedid','savePause','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','update','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','acwTimeout','saveUnpause','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','attended','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]'];(function(_0x42533a,_0x24868f){var _0x496eed=function(_0x5375c1){while(--_0x5375c1){_0x42533a['push'](_0x42533a['shift']());}};_0x496eed(++_0x24868f);}(_0xdbde,0x156));var _0xedbd=function(_0x2cbc0b,_0x13ff4d){_0x2cbc0b=_0x2cbc0b-0x0;var _0x3317b8=_0xdbde[_0x2cbc0b];return _0x3317b8;};'use strict';var util=require(_0xedbd('0x0'));var _=require(_0xedbd('0x1'));var moment=require(_0xedbd('0x2'));var ami=require(_0xedbd('0x3'));var logger=require(_0xedbd('0x4'))(_0xedbd('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xedbd('0x6'));function Acw(_0x312717){this[_0xedbd('0x7')]=_0x312717[_0xedbd('0x7')];this['agents']=_0x312717[_0xedbd('0x8')];this[_0xedbd('0x9')]=_0x312717[_0xedbd('0x9')];this[_0xedbd('0xa')]={};ami['on']('agentconnect',this[_0xedbd('0xb')][_0xedbd('0xc')](this));ami['on'](_0xedbd('0xd'),this['syncHangupRequest'][_0xedbd('0xc')](this));ami['on'](_0xedbd('0xe'),this[_0xedbd('0xf')][_0xedbd('0xc')](this));ami['on'](_0xedbd('0x10'),this[_0xedbd('0x11')][_0xedbd('0xc')](this));ami['on'](_0xedbd('0x12'),this[_0xedbd('0x13')]['bind'](this));ami['on'](_0xedbd('0x14'),this[_0xedbd('0x15')][_0xedbd('0xc')](this));ami['on'](_0xedbd('0x16'),this[_0xedbd('0x17')]['bind'](this));}function getDiff(_0x3503c7){var _0x3d7e89=moment()['milliseconds'](0x0);var _0x13a903=moment(_0x3503c7)[_0xedbd('0x18')](0x0);return _0x3d7e89['diff'](_0x13a903,_0xedbd('0x19'));}Acw[_0xedbd('0x1a')][_0xedbd('0x1b')]=function(_0x3754ae){try{var _0x2c95ec=this;var _0x7fcfcd=this[_0xedbd('0xa')][_0x3754ae][_0xedbd('0x1c')];var _0x2f075d=this['channels'][_0x3754ae]['queue'];var _0x388a0f=this['voiceQueues'][_0x2f075d];var _0x4d18e2=![];var _0x197737='ACW';if(_0x388a0f[_0xedbd('0x1d')]){if(_0x388a0f[_0xedbd('0x1e')][_0xedbd('0x1f')]){_0x4d18e2=!![];_0x197737=_0x388a0f[_0xedbd('0x1e')][_0xedbd('0x1f')];}}ami[_0xedbd('0x20')]({'action':_0xedbd('0x21'),'interface':_0x7fcfcd,'paused':!![],'reason':_0x197737})[_0xedbd('0x22')](function(_0x24a62a){if(_0x2c95ec[_0xedbd('0x8')][_0x7fcfcd]){return RpcUser['getAgent'](_0x2c95ec[_0xedbd('0x8')][_0x7fcfcd]['id'])['then'](function(_0x4c8b96){if(_0x4c8b96&&!_0x4c8b96['voicePause']){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x3754ae,_0x7fcfcd,_0x2f075d);var _0x2b7ada=_0x2c95ec[_0xedbd('0xa')][_0x3754ae]['attended']&&_0x2c95ec[_0xedbd('0xa')][_0x3754ae][_0xedbd('0x23')]?_0x2c95ec['channels'][_0x3754ae][_0xedbd('0x23')]:_0x3754ae;return RpcUser[_0xedbd('0x24')](_0x2c95ec[_0xedbd('0x8')][_0x7fcfcd],_0x197737,_0x2b7ada)[_0xedbd('0x22')](function(_0x4ed4ea){if(!_0x4d18e2){_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3754ae,_0x2c95ec[_0xedbd('0x7')][_0x2f075d]['acwTimeout'],_0x7fcfcd,_0x2f075d);_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd][_0xedbd('0x25')]=setTimeout(_0x2c95ec[_0xedbd('0x26')][_0xedbd('0xc')](_0x2c95ec,_0x7fcfcd),_0x2c95ec[_0xedbd('0x7')][_0x2f075d]['acwTimeout']*0x3e8);_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd][_0xedbd('0x27')]=moment()['format'](_0xedbd('0x28'));_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd][_0xedbd('0x29')]=_0x3754ae;_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd][_0xedbd('0x2a')]=_0x2f075d;_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd]['updateAcw']=function(){var _0xf2d39f=getDiff(_0x2c95ec['timers'][_0x7fcfcd]['lastPauseAt']);clearTimeout(_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd][_0xedbd('0x25')]);_0x2c95ec[_0xedbd('0x9')][_0x7fcfcd][_0xedbd('0x25')]=![];RpcVoiceAgentReport[_0xedbd('0x2b')]({'acwtime':_0xf2d39f},_0x2c95ec['timers'][_0x7fcfcd][_0xedbd('0x29')],_0x7fcfcd)[_0xedbd('0x22')](function(_0x2e6044){logger[_0xedbd('0x2c')](_0xedbd('0x2d'),_0x3754ae,_0xf2d39f,_0x2e6044);})['catch'](function(_0x589bab){logger[_0xedbd('0x2e')](_0xedbd('0x2f'),_0x3754ae,_0x589bab);});delete _0x2c95ec[_0xedbd('0x9')][_0x7fcfcd];};}});}else{logger['info'](_0xedbd('0x30'),_0x3754ae,_0x7fcfcd,_0x2f075d);}});}})[_0xedbd('0x31')](function(_0x144bf2){logger['error'](_0xedbd('0x32'),_0x3754ae,_0x2c95ec[_0xedbd('0x7')][_0x2f075d]['acwTimeout'],_0x7fcfcd,_0x2f075d);})[_0xedbd('0x33')](function(){delete _0x2c95ec[_0xedbd('0xa')][_0x3754ae];});}catch(_0x410515){logger[_0xedbd('0x2e')](_0xedbd('0x34'),_0x410515[_0xedbd('0x35')]);}};Acw[_0xedbd('0x1a')][_0xedbd('0x26')]=function(_0x2403b9){try{var _0x35ec7c=this;if(_0x35ec7c['timers'][_0x2403b9]){_0x35ec7c['timers'][_0x2403b9][_0xedbd('0x25')]=![];var _0x446b20=_0x35ec7c['timers'][_0x2403b9][_0xedbd('0x29')];var _0x1654cb=_0x35ec7c['timers'][_0x2403b9][_0xedbd('0x2a')];var _0x4b2658=_0x35ec7c[_0xedbd('0x7')][_0x1654cb][_0xedbd('0x36')];logger[_0xedbd('0x2c')]('[%s][TIMER][STOP][AGENT:%s]',_0x446b20,_0x2403b9);RpcUser[_0xedbd('0x37')](this[_0xedbd('0x8')][_0x2403b9]);RpcVoiceAgentReport[_0xedbd('0x2b')]({'acwtime':_0x4b2658,'agentacw':!![]},_0x446b20,_0x2403b9)['then'](function(_0x1bd73a){logger[_0xedbd('0x2c')](_0xedbd('0x2d'),_0x446b20,_0x4b2658,_0x1bd73a);})['catch'](function(_0x53bd35){logger[_0xedbd('0x2e')](_0xedbd('0x2f'),_0x446b20,_0x53bd35);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2403b9);if(_0x35ec7c['timers']){logger[_0xedbd('0x2c')]('[ACW][TIMERS]',JSON[_0xedbd('0x38')](_0x35ec7c[_0xedbd('0x9')]));}}}catch(_0x2c8d0f){logger[_0xedbd('0x2e')](_0xedbd('0x39'),_0x2c8d0f[_0xedbd('0x35')]);}};Acw[_0xedbd('0x1a')][_0xedbd('0xb')]=function(_0x14d22f){try{if(this[_0xedbd('0x7')][_0x14d22f[_0xedbd('0x2a')]]&&(this[_0xedbd('0x7')][_0x14d22f[_0xedbd('0x2a')]][_0xedbd('0x5')]||this[_0xedbd('0x7')][_0x14d22f[_0xedbd('0x2a')]][_0xedbd('0x1d')])){if(this['agents'][_0x14d22f['interface']]){this[_0xedbd('0xa')][_0x14d22f[_0xedbd('0x29')]]={'queue':_0x14d22f[_0xedbd('0x2a')],'interface':_0x14d22f['interface'],'destlinkedid':_0x14d22f[_0xedbd('0x23')]};}}}catch(_0x3c070a){logger[_0xedbd('0x2e')](_0xedbd('0x3a'),_0x3c070a['message']);}};Acw[_0xedbd('0x1a')][_0xedbd('0x17')]=function(_0x235134){try{if(this[_0xedbd('0x7')][_0x235134[_0xedbd('0x2a')]]&&(this['voiceQueues'][_0x235134[_0xedbd('0x2a')]][_0xedbd('0x5')]||this['voiceQueues'][_0x235134[_0xedbd('0x2a')]][_0xedbd('0x1d')])){if(this[_0xedbd('0x8')][_0x235134[_0xedbd('0x1c')]]){this[_0xedbd('0xa')][_0x235134['uniqueid']]={'queue':_0x235134['queue'],'interface':_0x235134[_0xedbd('0x1c')]};}}}catch(_0x2cefb5){logger[_0xedbd('0x2e')](_0xedbd('0x3b'),_0x2cefb5['message']);}};Acw[_0xedbd('0x1a')][_0xedbd('0x3c')]=function(_0x46eadd){try{if(this[_0xedbd('0xa')][_0x46eadd[_0xedbd('0x29')]]&&_[_0xedbd('0x3d')](this[_0xedbd('0xa')][_0x46eadd[_0xedbd('0x29')]]['attended'])){logger[_0xedbd('0x2c')](_0xedbd('0x3e'),_0x46eadd['uniqueid']);this[_0xedbd('0x1b')](_0x46eadd[_0xedbd('0x29')]);}else if(this['channels'][_0x46eadd['linkedid']]&&_[_0xedbd('0x3d')](this[_0xedbd('0xa')][_0x46eadd[_0xedbd('0x3f')]]['attended'])){logger[_0xedbd('0x2c')](_0xedbd('0x40'),_0x46eadd[_0xedbd('0x3f')]);this[_0xedbd('0x1b')](_0x46eadd[_0xedbd('0x3f')]);}}catch(_0x3b8c8c){logger['error'](_0xedbd('0x41'),_0x3b8c8c[_0xedbd('0x35')]);}};Acw[_0xedbd('0x1a')][_0xedbd('0xf')]=function(_0x4bea17){try{if(this[_0xedbd('0xa')][_0x4bea17[_0xedbd('0x29')]]&&this[_0xedbd('0xa')][_0x4bea17[_0xedbd('0x29')]]['attended']){logger[_0xedbd('0x2c')](_0xedbd('0x42'),_0x4bea17['uniqueid']);this['startAcw'](_0x4bea17[_0xedbd('0x29')]);}else if(this[_0xedbd('0xa')][_0x4bea17[_0xedbd('0x3f')]]&&this[_0xedbd('0xa')][_0x4bea17[_0xedbd('0x3f')]][_0xedbd('0x43')]){logger[_0xedbd('0x2c')](_0xedbd('0x44'),_0x4bea17[_0xedbd('0x3f')]);this[_0xedbd('0x1b')](_0x4bea17[_0xedbd('0x3f')]);}}catch(_0x30cc41){logger[_0xedbd('0x2e')]('[ACW][syncHangup]\x20%s',_0x30cc41[_0xedbd('0x35')]);}};Acw[_0xedbd('0x1a')]['syncAttendedTransfer']=function(_0x7fc0d9){try{if(!_[_0xedbd('0x45')](this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x46')]])){this[_0xedbd('0x1b')](_0x7fc0d9['transfereeuniqueid']);if(this['channels'][_0x7fc0d9[_0xedbd('0x47')]]){this['channels'][_0x7fc0d9[_0xedbd('0x47')]][_0xedbd('0x43')]=!![];this['channels'][_0x7fc0d9[_0xedbd('0x48')]]=this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x47')]];delete this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x47')]];}}else if(!_['isNil'](this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x48')]])){this[_0xedbd('0x1b')](_0x7fc0d9[_0xedbd('0x48')]);if(this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x49')]]){this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x49')]][_0xedbd('0x43')]=!![];this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x46')]]=this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x49')]];delete this[_0xedbd('0xa')][_0x7fc0d9[_0xedbd('0x49')]];}}}catch(_0x871ef5){logger[_0xedbd('0x2e')](_0xedbd('0x4a'),_0x871ef5['message']);}};Acw[_0xedbd('0x1a')][_0xedbd('0x15')]=function(_0x352fd7){try{if(this[_0xedbd('0xa')][_0x352fd7['transfereruniqueid']]){logger[_0xedbd('0x2c')](_0xedbd('0x4b'),JSON[_0xedbd('0x38')](_0x352fd7[_0xedbd('0x4c')]));this[_0xedbd('0x1b')](_0x352fd7[_0xedbd('0x4c')]);}else if(this[_0xedbd('0xa')][_0x352fd7['transfererlinkedid']]){logger[_0xedbd('0x2c')](_0xedbd('0x4d'),JSON[_0xedbd('0x38')](_0x352fd7[_0xedbd('0x4e')]));this[_0xedbd('0x1b')](_0x352fd7[_0xedbd('0x4e')]);}}catch(_0x1cde9e){logger['error'](_0xedbd('0x4f'),_0x1cde9e[_0xedbd('0x35')]);}};Acw[_0xedbd('0x1a')][_0xedbd('0x11')]=function(_0x14b9b5){try{if(this[_0xedbd('0x7')][_0x14b9b5[_0xedbd('0x2a')]]&&this[_0xedbd('0x7')][_0x14b9b5['queue']][_0xedbd('0x50')]===_0xedbd('0x51')){if(this[_0xedbd('0x8')][_0x14b9b5['interface']]){logger[_0xedbd('0x2c')](_0xedbd('0x52'),_0x14b9b5[_0xedbd('0x29')],_0x14b9b5[_0xedbd('0x1c')],_0x14b9b5[_0xedbd('0x2a')]);return RpcUser[_0xedbd('0x24')](this[_0xedbd('0x8')][_0x14b9b5[_0xedbd('0x1c')]],_0xedbd('0x53'),_0x14b9b5[_0xedbd('0x29')]);}}}catch(_0x2bd31a){logger['error'](_0xedbd('0x54'),_0x2bd31a['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x33fc=['[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','update','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer'];(function(_0x1755c4,_0x2b8a42){var _0x48445a=function(_0xbd2fd){while(--_0xbd2fd){_0x1755c4['push'](_0x1755c4['shift']());}};_0x48445a(++_0x2b8a42);}(_0x33fc,0x15a));var _0xc33f=function(_0x4014c8,_0x38efb6){_0x4014c8=_0x4014c8-0x0;var _0x194847=_0x33fc[_0x4014c8];return _0x194847;};'use strict';var util=require(_0xc33f('0x0'));var _=require('lodash');var moment=require('moment');var ami=require('../ami');var logger=require(_0xc33f('0x1'))(_0xc33f('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xc33f('0x3'));function Acw(_0x2950a8){this[_0xc33f('0x4')]=_0x2950a8[_0xc33f('0x4')];this[_0xc33f('0x5')]=_0x2950a8[_0xc33f('0x5')];this[_0xc33f('0x6')]=_0x2950a8[_0xc33f('0x6')];this[_0xc33f('0x7')]={};ami['on']('agentconnect',this[_0xc33f('0x8')][_0xc33f('0x9')](this));ami['on'](_0xc33f('0xa'),this[_0xc33f('0xb')][_0xc33f('0x9')](this));ami['on'](_0xc33f('0xc'),this[_0xc33f('0xd')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xc33f('0x9')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xc33f('0x9')](this));ami['on'](_0xc33f('0xe'),this[_0xc33f('0xf')]['bind'](this));ami['on'](_0xc33f('0x10'),this[_0xc33f('0x11')][_0xc33f('0x9')](this));}function getDiff(_0x161484){var _0x371001=moment()[_0xc33f('0x12')](0x0);var _0x900f28=moment(_0x161484)[_0xc33f('0x12')](0x0);return _0x371001[_0xc33f('0x13')](_0x900f28,_0xc33f('0x14'));}Acw[_0xc33f('0x15')][_0xc33f('0x16')]=function(_0x591301){try{var _0x2a5e6a=this;var _0x4baff4=this[_0xc33f('0x7')][_0x591301][_0xc33f('0x17')];var _0x3f7f6=this[_0xc33f('0x7')][_0x591301][_0xc33f('0x18')];var _0x287f42=this['voiceQueues'][_0x3f7f6];var _0x3c9037=![];var _0x39202e=_0xc33f('0x19');if(_0x287f42[_0xc33f('0x1a')]){if(_0x287f42['mandatoryDispositionPause'][_0xc33f('0x1b')]){_0x3c9037=!![];_0x39202e=_0x287f42[_0xc33f('0x1c')][_0xc33f('0x1b')];}}ami['Action']({'action':_0xc33f('0x1d'),'interface':_0x4baff4,'paused':!![],'reason':_0x39202e})['then'](function(_0x278b50){if(_0x2a5e6a['agents'][_0x4baff4]){return RpcUser[_0xc33f('0x1e')](_0x2a5e6a['agents'][_0x4baff4]['id'])[_0xc33f('0x1f')](function(_0xe60867){if(_0xe60867&&!_0xe60867[_0xc33f('0x20')]){logger[_0xc33f('0x21')](_0xc33f('0x22'),_0x591301,_0x4baff4,_0x3f7f6);var _0x9aeaa6=_0x2a5e6a[_0xc33f('0x7')][_0x591301][_0xc33f('0x23')]&&_0x2a5e6a[_0xc33f('0x7')][_0x591301][_0xc33f('0x24')]?_0x2a5e6a[_0xc33f('0x7')][_0x591301][_0xc33f('0x24')]:_0x591301;return RpcUser[_0xc33f('0x25')](_0x2a5e6a['agents'][_0x4baff4],_0x39202e,_0x9aeaa6)['then'](function(_0x4a2d83){if(!_0x3c9037){_0x2a5e6a[_0xc33f('0x6')][_0x4baff4]={};logger[_0xc33f('0x21')](_0xc33f('0x26'),_0x591301,_0x2a5e6a[_0xc33f('0x4')][_0x3f7f6][_0xc33f('0x27')],_0x4baff4,_0x3f7f6);_0x2a5e6a['timers'][_0x4baff4][_0xc33f('0x28')]=setTimeout(_0x2a5e6a[_0xc33f('0x29')][_0xc33f('0x9')](_0x2a5e6a,_0x4baff4),_0x2a5e6a[_0xc33f('0x4')][_0x3f7f6][_0xc33f('0x27')]*0x3e8);_0x2a5e6a[_0xc33f('0x6')][_0x4baff4][_0xc33f('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2a5e6a['timers'][_0x4baff4][_0xc33f('0x2b')]=_0x591301;_0x2a5e6a[_0xc33f('0x6')][_0x4baff4][_0xc33f('0x18')]=_0x3f7f6;_0x2a5e6a['timers'][_0x4baff4]['updateAcw']=function(){var _0x28b1a3=getDiff(_0x2a5e6a[_0xc33f('0x6')][_0x4baff4][_0xc33f('0x2a')]);clearTimeout(_0x2a5e6a[_0xc33f('0x6')][_0x4baff4][_0xc33f('0x28')]);_0x2a5e6a['timers'][_0x4baff4]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x28b1a3},_0x2a5e6a[_0xc33f('0x6')][_0x4baff4][_0xc33f('0x2b')],_0x4baff4)[_0xc33f('0x1f')](function(_0x3bbc6d){logger[_0xc33f('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x591301,_0x28b1a3,_0x3bbc6d);})['catch'](function(_0x1dfd37){logger[_0xc33f('0x2c')](_0xc33f('0x2d'),_0x591301,_0x1dfd37);});delete _0x2a5e6a[_0xc33f('0x6')][_0x4baff4];};}});}else{logger[_0xc33f('0x21')](_0xc33f('0x2e'),_0x591301,_0x4baff4,_0x3f7f6);}});}})['catch'](function(_0x452753){logger[_0xc33f('0x2c')](_0xc33f('0x26'),_0x591301,_0x2a5e6a['voiceQueues'][_0x3f7f6][_0xc33f('0x27')],_0x4baff4,_0x3f7f6);})[_0xc33f('0x2f')](function(){delete _0x2a5e6a[_0xc33f('0x7')][_0x591301];});}catch(_0x225e7b){logger[_0xc33f('0x2c')](_0xc33f('0x30'),_0x225e7b[_0xc33f('0x31')]);}};Acw[_0xc33f('0x15')][_0xc33f('0x29')]=function(_0x339da7){try{var _0x1a3e75=this;if(_0x1a3e75[_0xc33f('0x6')][_0x339da7]){_0x1a3e75[_0xc33f('0x6')][_0x339da7][_0xc33f('0x28')]=![];var _0x58098d=_0x1a3e75[_0xc33f('0x6')][_0x339da7]['uniqueid'];var _0x2cffdf=_0x1a3e75[_0xc33f('0x6')][_0x339da7][_0xc33f('0x18')];var _0x2e1924=_0x1a3e75[_0xc33f('0x4')][_0x2cffdf]['acwTimeout'];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x58098d,_0x339da7);RpcUser[_0xc33f('0x32')](this[_0xc33f('0x5')][_0x339da7]);RpcVoiceAgentReport[_0xc33f('0x33')]({'acwtime':_0x2e1924,'agentacw':!![]},_0x58098d,_0x339da7)[_0xc33f('0x1f')](function(_0x3c9e93){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x58098d,_0x2e1924,_0x3c9e93);})[_0xc33f('0x34')](function(_0x29de05){logger[_0xc33f('0x2c')]('[%s][UPDATE][ERRORS:%s]',_0x58098d,_0x29de05);});}else{logger[_0xc33f('0x2c')](_0xc33f('0x35'),_0x339da7);if(_0x1a3e75[_0xc33f('0x6')]){logger[_0xc33f('0x21')](_0xc33f('0x36'),JSON[_0xc33f('0x37')](_0x1a3e75[_0xc33f('0x6')]));}}}catch(_0x47365c){logger['error'](_0xc33f('0x38'),_0x47365c[_0xc33f('0x31')]);}};Acw[_0xc33f('0x15')][_0xc33f('0x8')]=function(_0x5d2885){try{if(this['voiceQueues'][_0x5d2885[_0xc33f('0x18')]]&&(this[_0xc33f('0x4')][_0x5d2885[_0xc33f('0x18')]][_0xc33f('0x2')]||this[_0xc33f('0x4')][_0x5d2885[_0xc33f('0x18')]][_0xc33f('0x1a')])){if(this[_0xc33f('0x5')][_0x5d2885[_0xc33f('0x17')]]){this[_0xc33f('0x7')][_0x5d2885[_0xc33f('0x2b')]]={'queue':_0x5d2885[_0xc33f('0x18')],'interface':_0x5d2885[_0xc33f('0x17')],'destlinkedid':_0x5d2885['destlinkedid']};}}}catch(_0x247e5c){logger[_0xc33f('0x2c')](_0xc33f('0x39'),_0x247e5c[_0xc33f('0x31')]);}};Acw[_0xc33f('0x15')][_0xc33f('0x11')]=function(_0x530a82){try{if(this['voiceQueues'][_0x530a82[_0xc33f('0x18')]]&&(this['voiceQueues'][_0x530a82['queue']][_0xc33f('0x2')]||this[_0xc33f('0x4')][_0x530a82[_0xc33f('0x18')]][_0xc33f('0x1a')])){if(this[_0xc33f('0x5')][_0x530a82['interface']]){this[_0xc33f('0x7')][_0x530a82[_0xc33f('0x2b')]]={'queue':_0x530a82[_0xc33f('0x18')],'interface':_0x530a82['interface']};}}}catch(_0x24cc7f){logger[_0xc33f('0x2c')]('[ACW][syncAgentConnectPreview]\x20%s',_0x24cc7f[_0xc33f('0x31')]);}};Acw[_0xc33f('0x15')][_0xc33f('0xb')]=function(_0x23fcb1){try{if(this[_0xc33f('0x7')][_0x23fcb1[_0xc33f('0x2b')]]&&_['isUndefined'](this[_0xc33f('0x7')][_0x23fcb1['uniqueid']][_0xc33f('0x23')])){logger[_0xc33f('0x21')](_0xc33f('0x3a'),_0x23fcb1[_0xc33f('0x2b')]);this[_0xc33f('0x16')](_0x23fcb1[_0xc33f('0x2b')]);}else if(this['channels'][_0x23fcb1['linkedid']]&&_['isUndefined'](this[_0xc33f('0x7')][_0x23fcb1[_0xc33f('0x3b')]][_0xc33f('0x23')])){logger['info'](_0xc33f('0x3c'),_0x23fcb1['linkedid']);this[_0xc33f('0x16')](_0x23fcb1[_0xc33f('0x3b')]);}}catch(_0x22649c){logger['error'](_0xc33f('0x3d'),_0x22649c[_0xc33f('0x31')]);}};Acw[_0xc33f('0x15')][_0xc33f('0xd')]=function(_0x55e19f){try{if(this[_0xc33f('0x7')][_0x55e19f[_0xc33f('0x2b')]]&&this[_0xc33f('0x7')][_0x55e19f[_0xc33f('0x2b')]][_0xc33f('0x23')]){logger[_0xc33f('0x21')](_0xc33f('0x3e'),_0x55e19f['uniqueid']);this[_0xc33f('0x16')](_0x55e19f[_0xc33f('0x2b')]);}else if(this['channels'][_0x55e19f[_0xc33f('0x3b')]]&&this['channels'][_0x55e19f[_0xc33f('0x3b')]][_0xc33f('0x23')]){logger[_0xc33f('0x21')](_0xc33f('0x3f'),_0x55e19f[_0xc33f('0x3b')]);this[_0xc33f('0x16')](_0x55e19f['linkedid']);}}catch(_0x2b963f){logger[_0xc33f('0x2c')](_0xc33f('0x40'),_0x2b963f['message']);}};Acw[_0xc33f('0x15')][_0xc33f('0x41')]=function(_0xfb2d0c){try{if(!_['isNil'](this[_0xc33f('0x7')][_0xfb2d0c[_0xc33f('0x42')]])){this[_0xc33f('0x16')](_0xfb2d0c['transfereeuniqueid']);if(this['channels'][_0xfb2d0c[_0xc33f('0x43')]]){this[_0xc33f('0x7')][_0xfb2d0c[_0xc33f('0x43')]][_0xc33f('0x23')]=!![];this['channels'][_0xfb2d0c[_0xc33f('0x44')]]=this['channels'][_0xfb2d0c[_0xc33f('0x43')]];delete this[_0xc33f('0x7')][_0xfb2d0c[_0xc33f('0x43')]];}}else if(!_['isNil'](this['channels'][_0xfb2d0c[_0xc33f('0x44')]])){this[_0xc33f('0x16')](_0xfb2d0c[_0xc33f('0x44')]);if(this[_0xc33f('0x7')][_0xfb2d0c['origtransfereruniqueid']]){this[_0xc33f('0x7')][_0xfb2d0c[_0xc33f('0x45')]][_0xc33f('0x23')]=!![];this['channels'][_0xfb2d0c[_0xc33f('0x42')]]=this[_0xc33f('0x7')][_0xfb2d0c[_0xc33f('0x45')]];delete this['channels'][_0xfb2d0c[_0xc33f('0x45')]];}}}catch(_0xf44507){logger[_0xc33f('0x2c')](_0xc33f('0x46'),_0xf44507[_0xc33f('0x31')]);}};Acw[_0xc33f('0x15')][_0xc33f('0xf')]=function(_0x33152d){try{if(this['channels'][_0x33152d[_0xc33f('0x47')]]){logger[_0xc33f('0x21')](_0xc33f('0x48'),JSON['stringify'](_0x33152d['transfereruniqueid']));this[_0xc33f('0x16')](_0x33152d[_0xc33f('0x47')]);}else if(this[_0xc33f('0x7')][_0x33152d[_0xc33f('0x49')]]){logger['info'](_0xc33f('0x4a'),JSON[_0xc33f('0x37')](_0x33152d[_0xc33f('0x49')]));this['startAcw'](_0x33152d['transfererlinkedid']);}}catch(_0x1b1df4){logger['error'](_0xc33f('0x4b'),_0x1b1df4['message']);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x2f2fd7){try{if(this[_0xc33f('0x4')][_0x2f2fd7[_0xc33f('0x18')]]&&this['voiceQueues'][_0x2f2fd7['queue']][_0xc33f('0x4c')]==='all'){if(this[_0xc33f('0x5')][_0x2f2fd7[_0xc33f('0x17')]]){logger[_0xc33f('0x21')](_0xc33f('0x4d'),_0x2f2fd7[_0xc33f('0x2b')],_0x2f2fd7[_0xc33f('0x17')],_0x2f2fd7['queue']);return RpcUser[_0xc33f('0x25')](this[_0xc33f('0x5')][_0x2f2fd7[_0xc33f('0x17')]],_0xc33f('0x4e'),_0x2f2fd7[_0xc33f('0x2b')]);}}}catch(_0xb1ebf7){logger[_0xc33f('0x2c')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0xb1ebf7[_0xc33f('0x31')]);}};module[_0xc33f('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9e0905f..b131761 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 _0x2761=['Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionCoreShowChannels','catch','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0xe9c593,_0x5d1ead){var _0x26ffaa=function(_0x34119e){while(--_0x34119e){_0xe9c593['push'](_0xe9c593['shift']());}};_0x26ffaa(++_0x5d1ead);}(_0x2761,0x12d));var _0x1276=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2761[_0x4b369d];return _0x571a98;};'use strict';var Manager=require(_0x1276('0x0'));var BPromise=require(_0x1276('0x1'));var moment=require(_0x1276('0x2'));var util=require(_0x1276('0x3'));var _=require(_0x1276('0x4'));var logger=require(_0x1276('0x5'))(_0x1276('0x6'));var config=require(_0x1276('0x7'));var ami=new Manager(config[_0x1276('0x8')]['port'],config['asterisk']['ip'],config['asterisk'][_0x1276('0x9')],config[_0x1276('0x8')][_0x1276('0xa')],!![]);ami[_0x1276('0xb')]();ami['Action']=BPromise[_0x1276('0xc')](ami[_0x1276('0xd')]);function error(_0x3475b3){logger['error'](util[_0x1276('0xe')](_0x1276('0xf'),config[_0x1276('0x8')][_0x1276('0x9')],config[_0x1276('0x8')]['ip'],config[_0x1276('0x8')][_0x1276('0x10')],util['inspect'](_0x3475b3,![],null)));}function close(){logger[_0x1276('0x11')](util['format'](_0x1276('0x12'),config[_0x1276('0x8')][_0x1276('0x9')],config[_0x1276('0x8')]['ip'],config[_0x1276('0x8')][_0x1276('0x10')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x1276('0x13')]({'action':_0x1276('0x14')});};};ami[_0x1276('0x15')]=function(){return function(){return ami[_0x1276('0x13')]({'action':_0x1276('0x16')});};};ami[_0x1276('0x17')]=function(){return function(){return ami[_0x1276('0x13')]({'action':_0x1276('0x18')});};};ami[_0x1276('0x19')]=function(){return function(){return ami[_0x1276('0x13')]({'action':_0x1276('0x1a')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x1276('0x13')]({'action':'coreshowchannels'});};};function connect(_0x9e6d64){logger['info'](util['format'](_0x1276('0x1b'),config['asterisk'][_0x1276('0x9')],config[_0x1276('0x8')]['ip'],config['asterisk'][_0x1276('0x10')]));ami[_0x1276('0x1c')](_0x1276('0x11'),error);ami[_0x1276('0x1c')](_0x1276('0x1d'),close);}ami['on'](_0x1276('0x1e'),connect);ami['on'](_0x1276('0x1f'),function(_0x40ae33){logger['info'](util[_0x1276('0xe')](_0x1276('0x20'),config['asterisk'][_0x1276('0x9')],config[_0x1276('0x8')]['ip'],config['asterisk']['port'],util[_0x1276('0x21')](_0x40ae33,![],null)));});ami['on'](_0x1276('0x22'),function(_0x1c85f6){logger[_0x1276('0x23')](util[_0x1276('0xe')](_0x1276('0x24'),config[_0x1276('0x8')][_0x1276('0x9')],config[_0x1276('0x8')]['ip'],config[_0x1276('0x8')][_0x1276('0x10')]));return BPromise['resolve']()[_0x1276('0x25')](ami['actionSipShowRegistry']())[_0x1276('0x25')](ami[_0x1276('0x15')]())['then'](ami['actionSipPeerStatus']())[_0x1276('0x25')](ami['actionQueueSummary']())[_0x1276('0x25')](ami[_0x1276('0x26')]())[_0x1276('0x27')](function(_0x2e953c){console['log'](_0x2e953c);});});ami[_0x1276('0x1c')]('error',error);ami['once'](_0x1276('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0x8828=['lodash','ami','../../config/environment','asterisk','port','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','resolve','then','catch','log','exports','asterisk-manager','bluebird','util'];(function(_0x45310c,_0x106a46){var _0x5e941f=function(_0x17f122){while(--_0x17f122){_0x45310c['push'](_0x45310c['shift']());}};_0x5e941f(++_0x106a46);}(_0x8828,0x179));var _0x8882=function(_0x1b0feb,_0x2ce16c){_0x1b0feb=_0x1b0feb-0x0;var _0x593030=_0x8828[_0x1b0feb];return _0x593030;};'use strict';var Manager=require(_0x8882('0x0'));var BPromise=require(_0x8882('0x1'));var moment=require('moment');var util=require(_0x8882('0x2'));var _=require(_0x8882('0x3'));var logger=require('../../config/logger')(_0x8882('0x4'));var config=require(_0x8882('0x5'));var ami=new Manager(config[_0x8882('0x6')][_0x8882('0x7')],config[_0x8882('0x6')]['ip'],config['asterisk']['username'],config['asterisk']['password'],!![]);ami[_0x8882('0x8')]();ami[_0x8882('0x9')]=BPromise[_0x8882('0xa')](ami[_0x8882('0xb')]);function error(_0x15ab13){logger[_0x8882('0xc')](util['format'](_0x8882('0xd'),config[_0x8882('0x6')]['username'],config[_0x8882('0x6')]['ip'],config[_0x8882('0x6')][_0x8882('0x7')],util['inspect'](_0x15ab13,![],null)));}function close(){logger[_0x8882('0xc')](util[_0x8882('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x8882('0x6')][_0x8882('0xf')],config[_0x8882('0x6')]['ip'],config['asterisk']['port']));}ami[_0x8882('0x10')]=function(){return function(){return ami['Action']({'action':_0x8882('0x11')});};};ami[_0x8882('0x12')]=function(){return function(){return ami[_0x8882('0x9')]({'action':_0x8882('0x13')});};};ami[_0x8882('0x14')]=function(){return function(){return ami[_0x8882('0x9')]({'action':_0x8882('0x15')});};};ami[_0x8882('0x16')]=function(){return function(){return ami[_0x8882('0x9')]({'action':_0x8882('0x17')});};};ami[_0x8882('0x18')]=function(){return function(){return ami[_0x8882('0x9')]({'action':_0x8882('0x19')});};};function connect(_0x31bda){logger[_0x8882('0x1a')](util[_0x8882('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x8882('0x6')][_0x8882('0xf')],config[_0x8882('0x6')]['ip'],config['asterisk'][_0x8882('0x7')]));ami[_0x8882('0x1b')](_0x8882('0xc'),error);ami[_0x8882('0x1b')](_0x8882('0x1c'),close);}ami['on'](_0x8882('0x1d'),connect);ami['on']('shutdown',function(_0x376e3d){logger[_0x8882('0x1a')](util['format'](_0x8882('0x1e'),config[_0x8882('0x6')][_0x8882('0xf')],config[_0x8882('0x6')]['ip'],config[_0x8882('0x6')]['port'],util[_0x8882('0x1f')](_0x376e3d,![],null)));});ami['on'](_0x8882('0x20'),function(_0x4044f6){logger['info'](util[_0x8882('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x8882('0x6')][_0x8882('0xf')],config[_0x8882('0x6')]['ip'],config['asterisk'][_0x8882('0x7')]));return BPromise[_0x8882('0x21')]()[_0x8882('0x22')](ami[_0x8882('0x10')]())[_0x8882('0x22')](ami[_0x8882('0x12')]())[_0x8882('0x22')](ami['actionSipPeerStatus']())[_0x8882('0x22')](ami['actionQueueSummary']())[_0x8882('0x22')](ami[_0x8882('0x18')]())[_0x8882('0x23')](function(_0x52350b){console[_0x8882('0x24')](_0x52350b);});});ami[_0x8882('0x1b')]('error',error);ami[_0x8882('0x1b')](_0x8882('0x1c'),close);module[_0x8882('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5ef2679..2c69fc1 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(_0x290232,_0x1e8ebd){var _0x3b2a32=function(_0x2de30e){while(--_0x2de30e){_0x290232['push'](_0x290232['shift']());}};_0x3b2a32(++_0x1e8ebd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1d3a36,_0x29af18){_0x1d3a36=_0x1d3a36-0x0;var _0x23813b=_0xf4eb[_0x1d3a36];return _0x23813b;};'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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1d7741,_0x4fc994){_0x1d7741=_0x1d7741-0x0;var _0x551318=_0xf4eb[_0x1d7741];return _0x551318;};'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 diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 680b48e..0c1ab5f 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 _0x71b4=['ContactId','ListId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','moment','string','isNil','voiceQueue','uniqueid','Contact','phone','firstName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71b4,0x166));var _0x471b=function(_0x49a70a,_0xee3a2d){_0x49a70a=_0x49a70a-0x0;var _0x41d02d=_0x71b4[_0x49a70a];return _0x41d02d;};'use strict';var util=require(_0x471b('0x0'));var _=require('lodash');var moment=require(_0x471b('0x1'));function checkNameSurname(_0x3c1a68,_0x22c747,_0x363359){var _0x3b5407='';if(!_['isNil'](_0x22c747)&&_0x471b('0x2')===typeof _0x22c747){_0x3b5407+=_0x22c747;}if(!_[_0x471b('0x3')](_0x363359)&&_0x471b('0x2')===typeof _0x363359){_0x3b5407+='\x20'+_0x363359;}if(_0x3b5407!==''){return _0x3b5407;}return _0x3c1a68;}function Action(_0x2fe4f9,_0x4da296,_0x55687a){this[_0x471b('0x4')]=_0x2fe4f9;this[_0x471b('0x5')]=_0x55687a||undefined;this['name']=checkNameSurname(_0x4da296[_0x471b('0x6')][_0x471b('0x7')],_0x4da296['Contact'][_0x471b('0x8')],_0x4da296['Contact']['lastName']);this['number']=_0x4da296[_0x471b('0x6')][_0x471b('0x7')];this[_0x471b('0x9')]=_0x2fe4f9[_0x471b('0xa')];this[_0x471b('0xb')]=_0x4da296['active']||![];this[_0x471b('0xc')]=_0x2fe4f9[_0x471b('0xc')];this['dialQueueTimeout']=_0x2fe4f9[_0x471b('0xd')]||0x3;this[_0x471b('0xe')]=_0x4da296['scheduledat'];this[_0x471b('0xf')]=_0x4da296[_0x471b('0xf')];this[_0x471b('0x10')]=_0x4da296[_0x471b('0x10')];this[_0x471b('0x11')]=_0x4da296['countnoanswerretry'];this[_0x471b('0x12')]=_0x4da296[_0x471b('0x12')];this['countdropretry']=_0x4da296['countdropretry'];this[_0x471b('0x13')]=_0x4da296['countabandonedretry'];this[_0x471b('0x14')]=_0x4da296['countmachineretry'];this[_0x471b('0x15')]=_0x4da296[_0x471b('0x15')];this[_0x471b('0x16')]=_0x4da296[_0x471b('0x16')];this[_0x471b('0x17')]=_0x4da296[_0x471b('0x17')];this['UserId']=_0x4da296['UserId'];this['VoiceQueueId']=_0x4da296['VoiceQueueId'];this['CampaignId']=_0x4da296['CampaignId'];this['idHopper']=_0x4da296['id'];this[_0x471b('0x18')]=_0x4da296['Contact'][_0x471b('0x8')]||'';this['starttime']=moment()[_0x471b('0x19')](_0x471b('0x1a'));this[_0x471b('0x1b')]=_0x4da296[_0x471b('0x1b')];this[_0x471b('0x1c')]=_0x4da296['callbackuniqueid'];this[_0x471b('0x1d')]=_0x4da296['callbackat'];this[_0x471b('0x1e')]=_0x4da296[_0x471b('0x1e')];this[_0x471b('0x1f')]='';this['originatecalleridname']='';}Action[_0x471b('0x20')][_0x471b('0x21')]=function(){return util[_0x471b('0x19')](_0x471b('0x22'),this[_0x471b('0xa')],this[_0x471b('0x4')]['dialCutDigit']>0x0?this['number']['substring'](this[_0x471b('0x4')][_0x471b('0x23')]):this['number']);};Action['prototype'][_0x471b('0x24')]=function(){return this[_0x471b('0x9')];};module[_0x471b('0x25')]=Action; \ No newline at end of file +var _0x74b1=['prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','exports','util','lodash','moment','isNil','string','Contact','phone','firstName','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x4805bb,_0x161776){var _0x4a2fac=function(_0x209100){while(--_0x209100){_0x4805bb['push'](_0x4805bb['shift']());}};_0x4a2fac(++_0x161776);}(_0x74b1,0x167));var _0x174b=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x74b1[_0x558e45];return _0x3e9075;};'use strict';var util=require(_0x174b('0x0'));var _=require(_0x174b('0x1'));var moment=require(_0x174b('0x2'));function checkNameSurname(_0x3f1eb2,_0x27d37c,_0xe844ba){var _0x4680dc='';if(!_[_0x174b('0x3')](_0x27d37c)&&_0x174b('0x4')===typeof _0x27d37c){_0x4680dc+=_0x27d37c;}if(!_[_0x174b('0x3')](_0xe844ba)&&_0x174b('0x4')===typeof _0xe844ba){_0x4680dc+='\x20'+_0xe844ba;}if(_0x4680dc!==''){return _0x4680dc;}return _0x3f1eb2;}function Action(_0x547ac8,_0x2cdfca,_0xabeeea){this['voiceQueue']=_0x547ac8;this['uniqueid']=_0xabeeea||undefined;this['name']=checkNameSurname(_0x2cdfca[_0x174b('0x5')][_0x174b('0x6')],_0x2cdfca['Contact'][_0x174b('0x7')],_0x2cdfca[_0x174b('0x5')][_0x174b('0x8')]);this['number']=_0x2cdfca['Contact'][_0x174b('0x6')];this[_0x174b('0x9')]=_0x547ac8[_0x174b('0xa')];this['active']=_0x2cdfca[_0x174b('0xb')]||![];this[_0x174b('0xc')]=_0x547ac8[_0x174b('0xc')];this[_0x174b('0xd')]=_0x547ac8['dialQueueTimeout']||0x3;this[_0x174b('0xe')]=_0x2cdfca[_0x174b('0xe')];this['countbusyretry']=_0x2cdfca[_0x174b('0xf')];this['countcongestionretry']=_0x2cdfca[_0x174b('0x10')];this[_0x174b('0x11')]=_0x2cdfca['countnoanswerretry'];this[_0x174b('0x12')]=_0x2cdfca['countnosuchnumberretry'];this[_0x174b('0x13')]=_0x2cdfca[_0x174b('0x13')];this[_0x174b('0x14')]=_0x2cdfca['countabandonedretry'];this['countmachineretry']=_0x2cdfca[_0x174b('0x15')];this[_0x174b('0x16')]=_0x2cdfca[_0x174b('0x16')];this['ContactId']=_0x2cdfca[_0x174b('0x17')];this['ListId']=_0x2cdfca[_0x174b('0x18')];this[_0x174b('0x19')]=_0x2cdfca[_0x174b('0x19')];this['VoiceQueueId']=_0x2cdfca[_0x174b('0x1a')];this[_0x174b('0x1b')]=_0x2cdfca[_0x174b('0x1b')];this[_0x174b('0x1c')]=_0x2cdfca['id'];this[_0x174b('0x1d')]=_0x2cdfca[_0x174b('0x5')][_0x174b('0x7')]||'';this['starttime']=moment()[_0x174b('0x1e')](_0x174b('0x1f'));this['callback']=_0x2cdfca[_0x174b('0x20')];this[_0x174b('0x21')]=_0x2cdfca[_0x174b('0x21')];this[_0x174b('0x22')]=_0x2cdfca[_0x174b('0x22')];this[_0x174b('0x23')]=_0x2cdfca['recallme'];this[_0x174b('0x24')]='';this['originatecalleridname']='';}Action[_0x174b('0x25')][_0x174b('0x26')]=function(){return util[_0x174b('0x1e')](_0x174b('0x27'),this[_0x174b('0xa')],this[_0x174b('0x28')]['dialCutDigit']>0x0?this['number']['substring'](this[_0x174b('0x28')][_0x174b('0x29')]):this[_0x174b('0x2a')]);};Action[_0x174b('0x25')]['getQueue']=function(){return this[_0x174b('0x9')];};module[_0x174b('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b96067e..9d46fb5 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 _0xda3e=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','diff','seconds','state','Answer','scheduledat','type','queue'];(function(_0x1b0b6e,_0x2c0dae){var _0x4bba13=function(_0x41a2c8){while(--_0x41a2c8){_0x1b0b6e['push'](_0x1b0b6e['shift']());}};_0x4bba13(++_0x2c0dae);}(_0xda3e,0x160));var _0xeda3=function(_0x5ae4f2,_0xa682d5){_0x5ae4f2=_0x5ae4f2-0x0;var _0x3aaa4c=_0xda3e[_0x5ae4f2];return _0x3aaa4c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xeda3('0x0'));function getSeconds(_0x5bb85b,_0x57609f){var _0xf017ca=moment(_0x5bb85b)['milliseconds'](0x0);var _0x9d0a07=moment(_0x57609f)['milliseconds'](0x0);return _0xf017ca[_0xeda3('0x1')](_0x9d0a07,_0xeda3('0x2'));}function AgentComplete(_0x5009fe,_0x3c4f18){this[_0xeda3('0x3')]=0x4;this['statedesc']=_0xeda3('0x4');this['scheduledat']=_0x5009fe[_0xeda3('0x5')];this[_0xeda3('0x6')]=_0x5009fe[_0xeda3('0x6')];this['campaigntype']=_0x5009fe[_0xeda3('0x6')]==='outbound'?_0xeda3('0x7'):_0x5009fe[_0xeda3('0x6')];this[_0xeda3('0x8')]=_0x5009fe['countbusyretry'];this[_0xeda3('0x9')]=_0x5009fe['countcongestionretry'];this[_0xeda3('0xa')]=_0x5009fe[_0xeda3('0xa')];this[_0xeda3('0xb')]=_0x5009fe[_0xeda3('0x8')]+_0x5009fe[_0xeda3('0x9')]+_0x5009fe[_0xeda3('0xa')]+_0x5009fe[_0xeda3('0xc')]+_0x5009fe[_0xeda3('0xd')]+_0x5009fe[_0xeda3('0xe')]+_0x5009fe[_0xeda3('0xf')]+_0x5009fe[_0xeda3('0x10')];this[_0xeda3('0xc')]=_0x5009fe[_0xeda3('0xc')];this[_0xeda3('0xd')]=_0x5009fe[_0xeda3('0xd')];this[_0xeda3('0xe')]=_0x5009fe['countabandonedretry'];this[_0xeda3('0xf')]=_0x5009fe[_0xeda3('0xf')];this['countagentrejectretry']=_0x5009fe['countagentrejectretry'];this[_0xeda3('0x11')]=_0x3c4f18[_0xeda3('0x11')];this[_0xeda3('0x12')]=_0x5009fe[_0xeda3('0x13')];this[_0xeda3('0x14')]=_0x5009fe[_0xeda3('0x15')];this[_0xeda3('0x16')]=_0x5009fe[_0xeda3('0x16')];this[_0xeda3('0x17')]=_0x5009fe[_0xeda3('0x17')];this[_0xeda3('0x18')]=_0x5009fe[_0xeda3('0x18')];this[_0xeda3('0x19')]=moment()[_0xeda3('0x1a')](_0xeda3('0x1b'));this[_0xeda3('0x1c')]=getSeconds(_0x5009fe[_0xeda3('0x17')],_0x5009fe[_0xeda3('0x16')]);this[_0xeda3('0x1d')]=getSeconds(_0x5009fe[_0xeda3('0x18')],_0x5009fe[_0xeda3('0x17')]);this[_0xeda3('0x1e')]=getSeconds(this[_0xeda3('0x19')],_0x5009fe[_0xeda3('0x18')]);this[_0xeda3('0x7')]=_0x3c4f18[_0xeda3('0x7')];this[_0xeda3('0x1f')]=_0x3c4f18[_0xeda3('0x1f')];this[_0xeda3('0x20')]=_0x3c4f18[_0xeda3('0x20')];this[_0xeda3('0x21')]=_0x5009fe[_0xeda3('0x21')];this[_0xeda3('0x22')]=_0x5009fe[_0xeda3('0x22')];this[_0xeda3('0x23')]=_0x5009fe[_0xeda3('0x23')];this[_0xeda3('0x24')]=_0x5009fe[_0xeda3('0x24')];this[_0xeda3('0x25')]=_0x5009fe[_0xeda3('0x25')];this[_0xeda3('0x26')]=_0x5009fe['ListId'];this['UserId']=_0x5009fe[_0xeda3('0x27')];this[_0xeda3('0x28')]=_0x5009fe[_0xeda3('0x28')];this[_0xeda3('0x29')]=_0x5009fe[_0xeda3('0x29')];this[_0xeda3('0x2a')]=_0x5009fe['originatecalleridnum']||'';this[_0xeda3('0x2b')]=_0x5009fe['originatecalleridname']||'';}module[_0xeda3('0x2c')]=AgentComplete; \ No newline at end of file +var _0x991a=['countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x4e43cf,_0x983d7c){var _0x39ec1a=function(_0x36f8ef){while(--_0x36f8ef){_0x4e43cf['push'](_0x4e43cf['shift']());}};_0x39ec1a(++_0x983d7c);}(_0x991a,0xd4));var _0xa991=function(_0x84fc78,_0x49a45d){_0x84fc78=_0x84fc78-0x0;var _0x1871ce=_0x991a[_0x84fc78];return _0x1871ce;};'use strict';var util=require('util');var _=require(_0xa991('0x0'));var moment=require(_0xa991('0x1'));function getSeconds(_0x4af501,_0x1f3cf0){var _0x58cc65=moment(_0x4af501)[_0xa991('0x2')](0x0);var _0x14402c=moment(_0x1f3cf0)[_0xa991('0x2')](0x0);return _0x58cc65[_0xa991('0x3')](_0x14402c,_0xa991('0x4'));}function AgentComplete(_0x2c4b3d,_0x42d008){this[_0xa991('0x5')]=0x4;this['statedesc']=_0xa991('0x6');this[_0xa991('0x7')]=_0x2c4b3d['scheduledat'];this['type']=_0x2c4b3d[_0xa991('0x8')];this[_0xa991('0x9')]=_0x2c4b3d[_0xa991('0x8')]===_0xa991('0xa')?_0xa991('0xb'):_0x2c4b3d[_0xa991('0x8')];this[_0xa991('0xc')]=_0x2c4b3d[_0xa991('0xc')];this[_0xa991('0xd')]=_0x2c4b3d[_0xa991('0xd')];this[_0xa991('0xe')]=_0x2c4b3d[_0xa991('0xe')];this[_0xa991('0xf')]=_0x2c4b3d['countbusyretry']+_0x2c4b3d['countcongestionretry']+_0x2c4b3d[_0xa991('0xe')]+_0x2c4b3d[_0xa991('0x10')]+_0x2c4b3d[_0xa991('0x11')]+_0x2c4b3d[_0xa991('0x12')]+_0x2c4b3d['countmachineretry']+_0x2c4b3d[_0xa991('0x13')];this[_0xa991('0x10')]=_0x2c4b3d[_0xa991('0x10')];this[_0xa991('0x11')]=_0x2c4b3d[_0xa991('0x11')];this[_0xa991('0x12')]=_0x2c4b3d['countabandonedretry'];this[_0xa991('0x14')]=_0x2c4b3d[_0xa991('0x14')];this['countagentrejectretry']=_0x2c4b3d[_0xa991('0x13')];this['uniqueid']=_0x42d008[_0xa991('0x15')];this[_0xa991('0x16')]=_0x2c4b3d[_0xa991('0x17')];this['calleridnum']=_0x2c4b3d[_0xa991('0x18')];this[_0xa991('0x19')]=_0x2c4b3d[_0xa991('0x19')];this[_0xa991('0x1a')]=_0x2c4b3d[_0xa991('0x1a')];this[_0xa991('0x1b')]=_0x2c4b3d[_0xa991('0x1b')];this[_0xa991('0x1c')]=moment()[_0xa991('0x1d')](_0xa991('0x1e'));this[_0xa991('0x1f')]=getSeconds(_0x2c4b3d[_0xa991('0x1a')],_0x2c4b3d[_0xa991('0x19')]);this[_0xa991('0x20')]=getSeconds(_0x2c4b3d[_0xa991('0x1b')],_0x2c4b3d[_0xa991('0x1a')]);this[_0xa991('0x21')]=getSeconds(this[_0xa991('0x1c')],_0x2c4b3d['answertime']);this[_0xa991('0xb')]=_0x42d008['queue'];this['membername']=_0x42d008[_0xa991('0x22')];this[_0xa991('0x23')]=_0x42d008[_0xa991('0x23')];this['callback']=_0x2c4b3d[_0xa991('0x24')];this[_0xa991('0x25')]=_0x2c4b3d['callbackuniqueid'];this['callbackat']=_0x2c4b3d[_0xa991('0x26')];this[_0xa991('0x27')]=_0x2c4b3d[_0xa991('0x27')];this[_0xa991('0x28')]=_0x2c4b3d[_0xa991('0x28')];this[_0xa991('0x29')]=_0x2c4b3d['ListId'];this['UserId']=_0x2c4b3d[_0xa991('0x2a')];this['VoiceQueueId']=_0x2c4b3d['VoiceQueueId'];this[_0xa991('0x2b')]=_0x2c4b3d[_0xa991('0x2b')];this['originatecalleridnum']=_0x2c4b3d[_0xa991('0x2c')]||'';this['originatecalleridname']=_0x2c4b3d[_0xa991('0x2d')]||'';}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 b3b8fda..5ce1d5e 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 _0x84ab=['countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x40ca0e,_0x4ecf2f){var _0x46619=function(_0x9ceebb){while(--_0x9ceebb){_0x40ca0e['push'](_0x40ca0e['shift']());}};_0x46619(++_0x4ecf2f);}(_0x84ab,0x12f));var _0xb84a=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x84ab[_0x1e3c16];return _0x47a0c9;};'use strict';var util=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));function getSeconds(_0x1ea089,_0x473c3){var _0x512f13=moment(_0x1ea089)[_0xb84a('0x3')](0x0);var _0x18a4a5=moment(_0x473c3)['milliseconds'](0x0);return _0x512f13[_0xb84a('0x4')](_0x18a4a5,_0xb84a('0x5'));}function Final(_0x28c83b){this['uniqueid']=_0x28c83b['uniqueid'];this['scheduledat']=_0x28c83b[_0xb84a('0x6')];this['type']=_0x28c83b[_0xb84a('0x7')];this[_0xb84a('0x8')]=_0x28c83b['type']===_0xb84a('0x9')?'queue':_0x28c83b[_0xb84a('0x7')];this[_0xb84a('0xa')]=_0x28c83b[_0xb84a('0xa')];this['countcongestionretry']=_0x28c83b['countcongestionretry'];this['countnoanswerretry']=_0x28c83b[_0xb84a('0xb')];this[_0xb84a('0xc')]=_0x28c83b[_0xb84a('0xa')]+_0x28c83b[_0xb84a('0xd')]+_0x28c83b[_0xb84a('0xb')]+_0x28c83b['countnosuchnumberretry']+_0x28c83b[_0xb84a('0xe')]+_0x28c83b[_0xb84a('0xf')]+_0x28c83b[_0xb84a('0x10')]+_0x28c83b[_0xb84a('0x11')];this[_0xb84a('0x12')]=_0x28c83b[_0xb84a('0x12')];this[_0xb84a('0xe')]=_0x28c83b[_0xb84a('0xe')];this[_0xb84a('0xf')]=_0x28c83b[_0xb84a('0xf')];this[_0xb84a('0x10')]=_0x28c83b[_0xb84a('0x10')];this['countagentrejectretry']=_0x28c83b[_0xb84a('0x11')];this[_0xb84a('0x13')]=_0x28c83b[_0xb84a('0x13')];this[_0xb84a('0x14')]=_0x28c83b[_0xb84a('0x14')];this[_0xb84a('0x15')]=_0x28c83b[_0xb84a('0x15')];this[_0xb84a('0x16')]=_0x28c83b[_0xb84a('0x16')];this[_0xb84a('0x17')]=_0x28c83b[_0xb84a('0x17')];this[_0xb84a('0x18')]=_0x28c83b[_0xb84a('0x17')];this[_0xb84a('0x19')]=_0x28c83b['ringtime']||0x0;this[_0xb84a('0x1a')]=_0x28c83b[_0xb84a('0x1a')]||0x0;this['talktime']=_0x28c83b[_0xb84a('0x1b')]||0x0;this[_0xb84a('0x1c')]=_0x28c83b[_0xb84a('0x1c')];this[_0xb84a('0x1d')]=_0x28c83b['callbackuniqueid'];this['callbackat']=_0x28c83b[_0xb84a('0x1e')];this[_0xb84a('0x1f')]=_0x28c83b[_0xb84a('0x1f')];this[_0xb84a('0x20')]=_0x28c83b[_0xb84a('0x20')];this[_0xb84a('0x21')]=_0x28c83b[_0xb84a('0x21')];this[_0xb84a('0x22')]=_0x28c83b[_0xb84a('0x22')];this[_0xb84a('0x23')]=_0x28c83b[_0xb84a('0x23')];this[_0xb84a('0x24')]=_0x28c83b[_0xb84a('0x24')];this[_0xb84a('0x25')]=_0x28c83b[_0xb84a('0x25')]||'';this[_0xb84a('0x26')]=_0x28c83b[_0xb84a('0x26')]||'';}module[_0xb84a('0x27')]=Final; \ No newline at end of file +var _0xb458=['util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x1c4e8d,_0x5beec7){var _0xfa7339=function(_0x15780c){while(--_0x15780c){_0x1c4e8d['push'](_0x1c4e8d['shift']());}};_0xfa7339(++_0x5beec7);}(_0xb458,0x103));var _0x8b45=function(_0x5e3e02,_0x197125){_0x5e3e02=_0x5e3e02-0x0;var _0x5c0f2f=_0xb458[_0x5e3e02];return _0x5c0f2f;};'use strict';var util=require(_0x8b45('0x0'));var _=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));function getSeconds(_0x494751,_0x58a508){var _0xdf89d4=moment(_0x494751)[_0x8b45('0x3')](0x0);var _0x141a44=moment(_0x58a508)[_0x8b45('0x3')](0x0);return _0xdf89d4['diff'](_0x141a44,_0x8b45('0x4'));}function Final(_0x59cce3){this['uniqueid']=_0x59cce3[_0x8b45('0x5')];this[_0x8b45('0x6')]=_0x59cce3[_0x8b45('0x6')];this[_0x8b45('0x7')]=_0x59cce3[_0x8b45('0x7')];this['campaigntype']=_0x59cce3[_0x8b45('0x7')]===_0x8b45('0x8')?_0x8b45('0x9'):_0x59cce3[_0x8b45('0x7')];this[_0x8b45('0xa')]=_0x59cce3['countbusyretry'];this[_0x8b45('0xb')]=_0x59cce3[_0x8b45('0xb')];this['countnoanswerretry']=_0x59cce3['countnoanswerretry'];this['countglobal']=_0x59cce3['countbusyretry']+_0x59cce3[_0x8b45('0xb')]+_0x59cce3[_0x8b45('0xc')]+_0x59cce3[_0x8b45('0xd')]+_0x59cce3['countdropretry']+_0x59cce3[_0x8b45('0xe')]+_0x59cce3[_0x8b45('0xf')]+_0x59cce3[_0x8b45('0x10')];this[_0x8b45('0xd')]=_0x59cce3[_0x8b45('0xd')];this[_0x8b45('0x11')]=_0x59cce3['countdropretry'];this['countabandonedretry']=_0x59cce3[_0x8b45('0xe')];this[_0x8b45('0xf')]=_0x59cce3[_0x8b45('0xf')];this[_0x8b45('0x10')]=_0x59cce3[_0x8b45('0x10')];this[_0x8b45('0x9')]=_0x59cce3[_0x8b45('0x9')];this[_0x8b45('0x12')]=_0x59cce3[_0x8b45('0x12')];this[_0x8b45('0x13')]=_0x59cce3[_0x8b45('0x13')];this[_0x8b45('0x14')]=_0x59cce3[_0x8b45('0x14')];this[_0x8b45('0x15')]=_0x59cce3[_0x8b45('0x15')];this[_0x8b45('0x16')]=_0x59cce3[_0x8b45('0x15')];this[_0x8b45('0x17')]=_0x59cce3['ringtime']||0x0;this[_0x8b45('0x18')]=_0x59cce3[_0x8b45('0x18')]||0x0;this[_0x8b45('0x19')]=_0x59cce3[_0x8b45('0x19')]||0x0;this[_0x8b45('0x1a')]=_0x59cce3[_0x8b45('0x1a')];this[_0x8b45('0x1b')]=_0x59cce3[_0x8b45('0x1b')];this['callbackat']=_0x59cce3['callbackat'];this[_0x8b45('0x1c')]=_0x59cce3['recallme'];this[_0x8b45('0x1d')]=_0x59cce3[_0x8b45('0x1d')];this[_0x8b45('0x1e')]=_0x59cce3[_0x8b45('0x1e')];this[_0x8b45('0x1f')]=_0x59cce3[_0x8b45('0x1f')];this[_0x8b45('0x20')]=_0x59cce3['VoiceQueueId'];this['CampaignId']=_0x59cce3[_0x8b45('0x21')];this[_0x8b45('0x22')]=_0x59cce3['originatecalleridnum']||'';this['originatecalleridname']=_0x59cce3[_0x8b45('0x23')]||'';}module[_0x8b45('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 7044ba2..e574f3a 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 _0xfc6f=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','responsetime','format','ringtime','starttime','holdtime','talktime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0xfc6f,0xb2));var _0xffc6=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xfc6f[_0x24061a];return _0x82054e;};'use strict';var util=require('util');var _=require(_0xffc6('0x0'));var moment=require(_0xffc6('0x1'));function getSeconds(_0x182a1b,_0x34db7a){var _0x4eff3c=moment(_0x182a1b)[_0xffc6('0x2')](0x0);var _0x1fbaa4=moment(_0x34db7a)[_0xffc6('0x2')](0x0);return _0x4eff3c[_0xffc6('0x3')](_0x1fbaa4,_0xffc6('0x4'));}function Hangup(_0x1403e2,_0x2bdacb){this['state']=0x4;this[_0xffc6('0x5')]=_0xffc6('0x6');this[_0xffc6('0x7')]=_0x1403e2['scheduledat'];this[_0xffc6('0x8')]=_0x1403e2[_0xffc6('0x8')];this[_0xffc6('0x9')]=_0x1403e2[_0xffc6('0x8')]===_0xffc6('0xa')?'queue':_0x1403e2[_0xffc6('0x8')];this['countbusyretry']=_0x1403e2[_0xffc6('0xb')];this[_0xffc6('0xc')]=_0x1403e2['countcongestionretry'];this[_0xffc6('0xd')]=_0x1403e2[_0xffc6('0xd')];this[_0xffc6('0xe')]=_0x1403e2[_0xffc6('0xb')]+_0x1403e2[_0xffc6('0xc')]+_0x1403e2[_0xffc6('0xd')]+_0x1403e2[_0xffc6('0xf')]+_0x1403e2[_0xffc6('0x10')]+_0x1403e2[_0xffc6('0x11')]+_0x1403e2[_0xffc6('0x12')]+_0x1403e2[_0xffc6('0x13')];this[_0xffc6('0xf')]=_0x1403e2['countnosuchnumberretry'];this[_0xffc6('0x10')]=_0x1403e2[_0xffc6('0x10')];this['countabandonedretry']=_0x1403e2['countabandonedretry'];this[_0xffc6('0x12')]=_0x1403e2['countmachineretry'];this[_0xffc6('0x13')]=_0x1403e2['countagentrejectretry'];this['uniqueid']=_0x2bdacb[_0xffc6('0x14')];this['calleridname']=_0x1403e2[_0xffc6('0x15')];this[_0xffc6('0x16')]=_0x1403e2[_0xffc6('0x17')];this['starttime']=_0x1403e2['starttime'];this[_0xffc6('0x18')]=_0x1403e2[_0xffc6('0x18')];this['endtime']=moment()[_0xffc6('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xffc6('0x1a')]=getSeconds(_0x1403e2[_0xffc6('0x18')],_0x1403e2[_0xffc6('0x1b')]);this[_0xffc6('0x1c')]=0x0;this[_0xffc6('0x1d')]=getSeconds(this['endtime'],_0x1403e2['responsetime']);this[_0xffc6('0x1e')]=_0x1403e2[_0xffc6('0x1e')];this[_0xffc6('0x1f')]=_0xffc6('0x20');this[_0xffc6('0x21')]=_0x2bdacb['cause-txt'];this[_0xffc6('0x22')]=_0x1403e2['callback'];this[_0xffc6('0x23')]=_0x1403e2['callbackuniqueid'];this[_0xffc6('0x24')]=_0x1403e2[_0xffc6('0x24')];this['recallme']=_0x1403e2['recallme'];this['ContactId']=_0x1403e2[_0xffc6('0x25')];this['ListId']=_0x1403e2[_0xffc6('0x26')];this[_0xffc6('0x27')]=_0x1403e2['UserId'];this['VoiceQueueId']=_0x1403e2[_0xffc6('0x28')];this[_0xffc6('0x29')]=_0x1403e2['CampaignId'];}module[_0xffc6('0x2a')]=Hangup; \ No newline at end of file +var _0x0353=['CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x522748,_0x5702b5){var _0x2d3424=function(_0x3cf20b){while(--_0x3cf20b){_0x522748['push'](_0x522748['shift']());}};_0x2d3424(++_0x5702b5);}(_0x0353,0x104));var _0x3035=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x0353[_0x548627];return _0x844a84;};'use strict';var util=require(_0x3035('0x0'));var _=require(_0x3035('0x1'));var moment=require(_0x3035('0x2'));function getSeconds(_0x32c707,_0x236174){var _0x3d3c25=moment(_0x32c707)[_0x3035('0x3')](0x0);var _0x5b68ac=moment(_0x236174)['milliseconds'](0x0);return _0x3d3c25['diff'](_0x5b68ac,_0x3035('0x4'));}function Hangup(_0x5b67ab,_0x3b1839){this[_0x3035('0x5')]=0x4;this[_0x3035('0x6')]=_0x3035('0x7');this[_0x3035('0x8')]=_0x5b67ab[_0x3035('0x8')];this[_0x3035('0x9')]=_0x5b67ab[_0x3035('0x9')];this['campaigntype']=_0x5b67ab[_0x3035('0x9')]===_0x3035('0xa')?_0x3035('0xb'):_0x5b67ab[_0x3035('0x9')];this[_0x3035('0xc')]=_0x5b67ab[_0x3035('0xc')];this[_0x3035('0xd')]=_0x5b67ab['countcongestionretry'];this['countnoanswerretry']=_0x5b67ab['countnoanswerretry'];this[_0x3035('0xe')]=_0x5b67ab[_0x3035('0xc')]+_0x5b67ab[_0x3035('0xd')]+_0x5b67ab[_0x3035('0xf')]+_0x5b67ab[_0x3035('0x10')]+_0x5b67ab[_0x3035('0x11')]+_0x5b67ab[_0x3035('0x12')]+_0x5b67ab[_0x3035('0x13')]+_0x5b67ab['countagentrejectretry'];this['countnosuchnumberretry']=_0x5b67ab['countnosuchnumberretry'];this[_0x3035('0x11')]=_0x5b67ab['countdropretry'];this['countabandonedretry']=_0x5b67ab[_0x3035('0x12')];this[_0x3035('0x13')]=_0x5b67ab['countmachineretry'];this[_0x3035('0x14')]=_0x5b67ab[_0x3035('0x14')];this[_0x3035('0x15')]=_0x3b1839[_0x3035('0x15')];this[_0x3035('0x16')]=_0x5b67ab[_0x3035('0x17')];this['calleridnum']=_0x5b67ab['number'];this[_0x3035('0x18')]=_0x5b67ab[_0x3035('0x18')];this[_0x3035('0x19')]=_0x5b67ab[_0x3035('0x19')];this[_0x3035('0x1a')]=moment()[_0x3035('0x1b')](_0x3035('0x1c'));this[_0x3035('0x1d')]=getSeconds(_0x5b67ab[_0x3035('0x19')],_0x5b67ab[_0x3035('0x18')]);this[_0x3035('0x1e')]=0x0;this[_0x3035('0x1f')]=getSeconds(this['endtime'],_0x5b67ab[_0x3035('0x19')]);this[_0x3035('0xb')]=_0x5b67ab[_0x3035('0xb')];this['membername']='IVR';this[_0x3035('0x20')]=_0x3b1839['cause-txt'];this[_0x3035('0x21')]=_0x5b67ab[_0x3035('0x21')];this[_0x3035('0x22')]=_0x5b67ab[_0x3035('0x22')];this['callbackat']=_0x5b67ab[_0x3035('0x23')];this[_0x3035('0x24')]=_0x5b67ab['recallme'];this[_0x3035('0x25')]=_0x5b67ab[_0x3035('0x25')];this['ListId']=_0x5b67ab[_0x3035('0x26')];this[_0x3035('0x27')]=_0x5b67ab[_0x3035('0x27')];this[_0x3035('0x28')]=_0x5b67ab[_0x3035('0x28')];this[_0x3035('0x29')]=_0x5b67ab[_0x3035('0x29')];}module[_0x3035('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 25e2a89..881d979 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 _0x7628=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat'];(function(_0x23e1e6,_0x5950d3){var _0x413414=function(_0x17c4ca){while(--_0x17c4ca){_0x23e1e6['push'](_0x23e1e6['shift']());}};_0x413414(++_0x5950d3);}(_0x7628,0xc2));var _0x8762=function(_0x420772,_0x55e046){_0x420772=_0x420772-0x0;var _0x4ef164=_0x7628[_0x420772];return _0x4ef164;};'use strict';var util=require(_0x8762('0x0'));var _=require('lodash');var moment=require(_0x8762('0x1'));function getSeconds(_0x1fc443,_0x53a29c){var _0x521b4e=moment(_0x1fc443)[_0x8762('0x2')](0x0);var _0x41d67a=moment(_0x53a29c)[_0x8762('0x2')](0x0);return _0x521b4e['diff'](_0x41d67a,_0x8762('0x3'));}function History(_0x8af555){this[_0x8762('0x4')]=_0x8af555[_0x8762('0x4')];this[_0x8762('0x5')]=_0x8af555[_0x8762('0x5')]||undefined;this[_0x8762('0x6')]=_0x8af555[_0x8762('0x6')];this[_0x8762('0x7')]=_0x8af555[_0x8762('0x6')]===_0x8762('0x8')?_0x8762('0x9'):_0x8af555[_0x8762('0x6')];this[_0x8762('0xa')]=_0x8af555['countbusyretry'];this[_0x8762('0xb')]=_0x8af555['countcongestionretry'];this[_0x8762('0xc')]=_0x8af555[_0x8762('0xc')];this[_0x8762('0xd')]=_0x8af555[_0x8762('0xa')]+_0x8af555[_0x8762('0xb')]+_0x8af555[_0x8762('0xc')]+_0x8af555[_0x8762('0xe')]+_0x8af555[_0x8762('0xf')]+_0x8af555[_0x8762('0x10')]+_0x8af555['countmachineretry']+_0x8af555[_0x8762('0x11')];this[_0x8762('0xe')]=_0x8af555[_0x8762('0xe')];this[_0x8762('0xf')]=_0x8af555[_0x8762('0xf')];this[_0x8762('0x10')]=_0x8af555[_0x8762('0x10')];this[_0x8762('0x12')]=_0x8af555[_0x8762('0x12')];this[_0x8762('0x11')]=_0x8af555['countagentrejectretry'];this[_0x8762('0x9')]=_0x8af555[_0x8762('0x9')];this[_0x8762('0x13')]=_0x8af555[_0x8762('0x14')];this[_0x8762('0x15')]=_0x8af555[_0x8762('0x16')];this[_0x8762('0x17')]=_0x8af555[_0x8762('0x17')];this[_0x8762('0x18')]=_0x8af555[_0x8762('0x18')];this[_0x8762('0x19')]=_0x8af555[_0x8762('0x18')];this[_0x8762('0x1a')]=getSeconds(_0x8af555[_0x8762('0x18')],_0x8af555[_0x8762('0x17')]);this[_0x8762('0x1b')]=0x0;this[_0x8762('0x1c')]=0x0;this[_0x8762('0x1d')]=_0x8af555[_0x8762('0x1d')];this[_0x8762('0x1e')]=_0x8af555[_0x8762('0x1e')];this[_0x8762('0x1f')]=_0x8af555[_0x8762('0x1f')];this['recallme']=_0x8af555['recallme'];this['ContactId']=_0x8af555[_0x8762('0x20')];this[_0x8762('0x21')]=_0x8af555[_0x8762('0x21')];this[_0x8762('0x22')]=_0x8af555[_0x8762('0x22')];this['VoiceQueueId']=_0x8af555[_0x8762('0x23')];this['CampaignId']=_0x8af555[_0x8762('0x24')];this[_0x8762('0x25')]=_0x8af555[_0x8762('0x25')]||'';this[_0x8762('0x26')]=_0x8af555['originatecalleridname']||'';}module[_0x8762('0x27')]=History; \ No newline at end of file +var _0xe194=['UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x4db22b,_0x30003f){var _0x534552=function(_0x40a463){while(--_0x40a463){_0x4db22b['push'](_0x4db22b['shift']());}};_0x534552(++_0x30003f);}(_0xe194,0xe9));var _0x4e19=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xe194[_0x57486e];return _0x5f110b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4e19('0x0'));function getSeconds(_0x5e8c0b,_0x29ca9e){var _0x349753=moment(_0x5e8c0b)[_0x4e19('0x1')](0x0);var _0x400c5d=moment(_0x29ca9e)['milliseconds'](0x0);return _0x349753[_0x4e19('0x2')](_0x400c5d,_0x4e19('0x3'));}function History(_0x49e091){this[_0x4e19('0x4')]=_0x49e091[_0x4e19('0x4')];this[_0x4e19('0x5')]=_0x49e091[_0x4e19('0x5')]||undefined;this[_0x4e19('0x6')]=_0x49e091['type'];this['campaigntype']=_0x49e091[_0x4e19('0x6')]===_0x4e19('0x7')?_0x4e19('0x8'):_0x49e091[_0x4e19('0x6')];this[_0x4e19('0x9')]=_0x49e091[_0x4e19('0x9')];this['countcongestionretry']=_0x49e091[_0x4e19('0xa')];this[_0x4e19('0xb')]=_0x49e091[_0x4e19('0xb')];this[_0x4e19('0xc')]=_0x49e091[_0x4e19('0x9')]+_0x49e091[_0x4e19('0xa')]+_0x49e091['countnoanswerretry']+_0x49e091['countnosuchnumberretry']+_0x49e091[_0x4e19('0xd')]+_0x49e091[_0x4e19('0xe')]+_0x49e091[_0x4e19('0xf')]+_0x49e091['countagentrejectretry'];this[_0x4e19('0x10')]=_0x49e091['countnosuchnumberretry'];this['countdropretry']=_0x49e091['countdropretry'];this[_0x4e19('0xe')]=_0x49e091[_0x4e19('0xe')];this[_0x4e19('0xf')]=_0x49e091[_0x4e19('0xf')];this['countagentrejectretry']=_0x49e091[_0x4e19('0x11')];this[_0x4e19('0x8')]=_0x49e091['queue'];this[_0x4e19('0x12')]=_0x49e091[_0x4e19('0x13')];this[_0x4e19('0x14')]=_0x49e091[_0x4e19('0x15')];this[_0x4e19('0x16')]=_0x49e091['starttime'];this[_0x4e19('0x17')]=_0x49e091[_0x4e19('0x17')];this[_0x4e19('0x18')]=_0x49e091[_0x4e19('0x17')];this[_0x4e19('0x19')]=getSeconds(_0x49e091[_0x4e19('0x17')],_0x49e091[_0x4e19('0x16')]);this[_0x4e19('0x1a')]=0x0;this['talktime']=0x0;this[_0x4e19('0x1b')]=_0x49e091[_0x4e19('0x1b')];this[_0x4e19('0x1c')]=_0x49e091[_0x4e19('0x1c')];this[_0x4e19('0x1d')]=_0x49e091[_0x4e19('0x1d')];this[_0x4e19('0x1e')]=_0x49e091[_0x4e19('0x1e')];this[_0x4e19('0x1f')]=_0x49e091[_0x4e19('0x1f')];this[_0x4e19('0x20')]=_0x49e091[_0x4e19('0x20')];this['UserId']=_0x49e091[_0x4e19('0x21')];this['VoiceQueueId']=_0x49e091['VoiceQueueId'];this[_0x4e19('0x22')]=_0x49e091[_0x4e19('0x22')];this[_0x4e19('0x23')]=_0x49e091['originatecalleridnum']||'';this[_0x4e19('0x24')]=_0x49e091['originatecalleridname']||'';}module[_0x4e19('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 980760d..4e225c7 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 _0x4d46=['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','merge','diff','seconds','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','talking','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','sequence','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countglobal','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','agiafterat','dialDropMaxRetry','add','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','stateinterface','push','paused','queueStatusComplete','[unlockQueueStatus][undefined]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','interval','indexOf','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','handlePower','power','dialPowerLevel','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','Contact','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originate][error]','syncOriginateResponse','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[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]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','length','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','p\x20=\x20','interval\x20=\x20','Amax\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','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','hangup','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','stringify','format','voice_queue:save','ivr','info','-----\x20Stats\x20Predictive\x20---','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','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------'];(function(_0x2203af,_0x5c0694){var _0x4a9a50=function(_0x265772){while(--_0x265772){_0x2203af['push'](_0x2203af['shift']());}};_0x4a9a50(++_0x5c0694);}(_0x4d46,0x197));var _0x64d4=function(_0x56e0b6,_0x3fdb97){_0x56e0b6=_0x56e0b6-0x0;var _0x42e9c5=_0x4d46[_0x56e0b6];return _0x42e9c5;};'use strict';var util=require(_0x64d4('0x0'));var _=require(_0x64d4('0x1'));var BPromise=require(_0x64d4('0x2'));var uuid=require(_0x64d4('0x3'));var moment=require(_0x64d4('0x4'));var rr=require('rr');var md5=require(_0x64d4('0x5'));var Redis=require('ioredis');var ut=require(_0x64d4('0x6'));var config=require(_0x64d4('0x7'));var logger=require(_0x64d4('0x8'))(_0x64d4('0x9'));var loggerBooked=require(_0x64d4('0x8'))(_0x64d4('0xa'));var loggerPredictive=require('../../../config/logger')(_0x64d4('0xb'));var loggerPredictiveCalls=require(_0x64d4('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x64d4('0x8'))(_0x64d4('0xc'));var ami=require('../ami');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x64d4('0xd'))(new Redis(config[_0x64d4('0xe')]));var cmHopper=require(_0x64d4('0xf'));var cmHopperHistory=require(_0x64d4('0x10'));var cmHopperBlack=require(_0x64d4('0x11'));var voiceQueueRt=require(_0x64d4('0x12'));var Action=require(_0x64d4('0x13'));var History=require(_0x64d4('0x14'));var Final=require(_0x64d4('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x64d4('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0x64d4('0x17')][_0x64d4('0x18')]||_0x64d4('0x19');var strategy={'rrmemory':_0x64d4('0x1a'),'roundrobin':_0x64d4('0x1b')};var Sequence=function(){};Sequence[_0x64d4('0x1c')]['enqueue']=function(_0x2ab011){this[_0x64d4('0x1d')]=this[_0x64d4('0x1d')]?this[_0x64d4('0x1d')][_0x64d4('0x1e')](_0x2ab011):_0x2ab011();};function Dialer(_0x156743,_0xa8a81e){this['sequence']=new Sequence();this[_0x64d4('0x1f')]=_0xa8a81e;this[_0x64d4('0x20')]=_0x156743['voiceQueues'];this[_0x64d4('0x21')]=_0x156743[_0x64d4('0x21')];this[_0x64d4('0x22')]=_0x156743[_0x64d4('0x22')];this[_0x64d4('0x23')]=_0x156743[_0x64d4('0x23')];this[_0x64d4('0x24')]=config[_0x64d4('0x24')]||0x2;this['channels']={};this[_0x64d4('0x25')]={};this[_0x64d4('0x26')]={};this[_0x64d4('0x27')]={};this[_0x64d4('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0x64d4('0x29')]={};this[_0x64d4('0x2a')]={};this[_0x64d4('0x2b')]={};ami['on']('agentconnect',this[_0x64d4('0x2c')][_0x64d4('0x2d')](this));ami['on'](_0x64d4('0x2e'),this[_0x64d4('0x2f')][_0x64d4('0x2d')](this));ami['on'](_0x64d4('0x30'),this['syncOriginateResponse'][_0x64d4('0x2d')](this));ami['on'](_0x64d4('0x31'),this[_0x64d4('0x32')][_0x64d4('0x2d')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x64d4('0x33'),this['syncHangup'][_0x64d4('0x2d')](this));ami['on']('newexten',this[_0x64d4('0x34')][_0x64d4('0x2d')](this));ami['on'](_0x64d4('0x35'),this[_0x64d4('0x36')][_0x64d4('0x2d')](this));ami['on']('queuemember',this['syncQueueMember'][_0x64d4('0x2d')](this));ami['on'](_0x64d4('0x37'),this[_0x64d4('0x38')][_0x64d4('0x2d')](this));this[_0x64d4('0x39')]();this[_0x64d4('0x3a')]();}function isNotNull(_0x2204f0){return _0x2204f0!==null&&!_['isUndefined'](_0x2204f0);}function checkIsLoggedIn(_0x4c4bf1,_0x184813){return function(){if(_0x184813<=0x0){_0x4c4bf1[_0x64d4('0x3b')]='AGENTS_NOT_LOGGED';throw _0x4c4bf1[_0x64d4('0x3c')]+_0x64d4('0x3d');}};}function isActive(_0x194380){return _0x194380;}function checkIsActive(_0xcffa8f,_0x592825){return function(){if(!isActive(_0x592825)){_0xcffa8f['message']=_0x64d4('0x3e');throw _0xcffa8f['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x425593){return function(){if(!isNotNull(_0x425593[_0x64d4('0x3f')])){_0x425593['message']=_0x64d4('0x40');throw _0x425593['name']+_0x64d4('0x41');}if(!isNotNull(_0x425593[_0x64d4('0x3f')]['Intervals'])){_0x425593['message']=_0x64d4('0x40');throw _0x425593[_0x64d4('0x3c')]+_0x64d4('0x41');}if(!isNotNull(_[_0x64d4('0x42')](_0x425593[_0x64d4('0x3f')]['Intervals']))){_0x425593[_0x64d4('0x3b')]=_0x64d4('0x40');throw _0x425593[_0x64d4('0x3c')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x5c0847,_0x2fc272,_0x150bd1){return{'action':_0x5c0847,'response':_0x2fc272,'message':_0x150bd1,'stack':_0x150bd1};}function myreject(_0xb25fff){return function(_0x2acc82){return _0xb25fff(msgResponse(_0x64d4('0x43'),_0x64d4('0x44'),JSON['stringify'](_0x2acc82)));};}function getSeconds(_0x4c0cf8,_0x6e6fac){var _0xd0041d=moment(_0x4c0cf8)['milliseconds'](0x0);var _0x550cec=moment(_0x6e6fac)[_0x64d4('0x45')](0x0);return _0xd0041d['diff'](_0x550cec,'seconds');}function emit(_0x57cef5,_0x59940b,_0x17125e){io['to'](_0x57cef5)[_0x64d4('0x46')](_0x59940b,_0x17125e);}function emitVoiceQueueSummary(_0xa9f459){if(_0xa9f459[_0x64d4('0x47')]===_0x64d4('0x48')){var _0x130dba={'id':_0xa9f459['id'],'name':_0xa9f459['name'],'strategy':_0xa9f459[_0x64d4('0x49')],'answered':_0xa9f459[_0x64d4('0x4a')],'available':_0xa9f459[_0x64d4('0x4b')],'loggedIn':_0xa9f459[_0x64d4('0x4c')],'pTalking':_0xa9f459[_0x64d4('0x4d')],'sumBillable':_0xa9f459[_0x64d4('0x4e')],'sumDuration':_0xa9f459[_0x64d4('0x4f')],'sumHoldTime':_0xa9f459[_0x64d4('0x50')]||0x0,'talking':_0xa9f459['talking'],'total':_0xa9f459[_0x64d4('0x51')],'type':_0xa9f459['type'],'unmanaged':_0xa9f459[_0x64d4('0x52')],'abandoned':_0xa9f459['abandoned'],'waiting':_0xa9f459[_0x64d4('0x53')],'loggedInDb':_0xa9f459['loggedInDb'],'dialActive':_0xa9f459['dialActive'],'dialMethod':_0xa9f459[_0x64d4('0x54')],'dialOriginateCallerIdName':_0xa9f459[_0x64d4('0x55')],'dialOriginateCallerIdNumber':_0xa9f459[_0x64d4('0x56')],'dialOriginateTimeout':_0xa9f459[_0x64d4('0x57')],'dialPrefix':_0xa9f459[_0x64d4('0x58')],'outboundAnswerAgiCallsDay':_0xa9f459[_0x64d4('0x59')],'outboundAnswerCallsDay':_0xa9f459[_0x64d4('0x5a')],'outboundBlacklistCallsDay':_0xa9f459[_0x64d4('0x5b')],'outboundBusyCallsDay':_0xa9f459[_0x64d4('0x5c')],'outboundCongestionCallsDay':_0xa9f459['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xa9f459[_0x64d4('0x5d')],'outboundDropCallsDayCallersExit':_0xa9f459[_0x64d4('0x5e')],'outboundDropCallsDayTimeout':_0xa9f459[_0x64d4('0x5f')],'outboundNoAnswerCallsDay':_0xa9f459[_0x64d4('0x60')],'outboundNoSuchCallsDay':_0xa9f459['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xa9f459[_0x64d4('0x61')],'outboundReCallsDay':_0xa9f459[_0x64d4('0x62')],'outboundRejectCallsDay':_0xa9f459['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xa9f459['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0xa9f459[_0x64d4('0x63')],'predictiveIntervalAvgHoldtime':_0xa9f459['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0xa9f459[_0x64d4('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0xa9f459['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xa9f459[_0x64d4('0x65')],'predictiveIntervalErlangCalls':_0xa9f459[_0x64d4('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0xa9f459[_0x64d4('0x67')],'predictiveIntervalHitRate':_0xa9f459['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xa9f459[_0x64d4('0x68')],'predictiveIntervalPauses':_0xa9f459[_0x64d4('0x69')],'predictiveIntervalAvailable':_0xa9f459[_0x64d4('0x6a')],'predictiveIntervalTotalCalls':_0xa9f459[_0x64d4('0x6b')],'message':_0xa9f459[_0x64d4('0x3b')],'originated':_0xa9f459[_0x64d4('0x6c')],'erlangCalls':_0xa9f459['erlangCalls'],'erlangCallToSecond':_0xa9f459[_0x64d4('0x6d')],'erlangAbandonmentRate':_0xa9f459[_0x64d4('0x6e')],'erlangBusyFactor':_0xa9f459[_0x64d4('0x6f')],'startPredictive':_0xa9f459[_0x64d4('0x70')],'startProgressive':_0xa9f459['startProgressive']};if(_0xa9f459[_0x64d4('0x71')]){_0x130dba[_0x64d4('0x71')]={'id':_0xa9f459[_0x64d4('0x71')]['id'],'name':_0xa9f459[_0x64d4('0x71')]['name'],'active':_0xa9f459['Trunk'][_0x64d4('0x72')],'callerid':_0xa9f459[_0x64d4('0x71')]['callerid']};}if(_0xa9f459[_0x64d4('0x3f')]){_0x130dba[_0x64d4('0x3f')]={'id':_0xa9f459[_0x64d4('0x3f')]['id'],'name':_0xa9f459[_0x64d4('0x3f')]['name']};}var _0x46bd77=md5(JSON[_0x64d4('0x73')](_0x130dba));if(_0xa9f459[_0x64d4('0x5')]!==_0x46bd77){_0xa9f459[_0x64d4('0x5')]=_0x46bd77;emit(util[_0x64d4('0x74')]('voice:queue:%s',_0x130dba[_0x64d4('0x3c')]),_0x64d4('0x75'),_0x130dba);}}}function emitCampaignSummary(_0x4aeffb){if(_0x4aeffb[_0x64d4('0x47')]===_0x64d4('0x76')){emit(util[_0x64d4('0x74')]('campaign:ivr:%s',_0x4aeffb[_0x64d4('0x3c')]),'campaign:save',_0x4aeffb);}}function checkGetDataPredictive(_0x85ef48){if(isNotNull(_0x85ef48)&&!_[_0x64d4('0x42')](_0x85ef48)){loggerPredictive[_0x64d4('0x77')](_0x64d4('0x78'));loggerPredictive[_0x64d4('0x77')](_0x64d4('0x79'),_0x85ef48[_0x64d4('0x6b')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x85ef48['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x7a'),_0x85ef48[_0x64d4('0x65')]);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x7b'),_0x85ef48[_0x64d4('0x7c')]);loggerPredictive['info'](_0x64d4('0x7d'),_0x85ef48[_0x64d4('0x7e')]);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x7f'),_0x85ef48[_0x64d4('0x64')]);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x80'));if(_0x85ef48[_0x64d4('0x6b')]>0x0){if(!_['isUndefined'](_0x85ef48[_0x64d4('0x64')])&&_0x85ef48[_0x64d4('0x64')]>0x0){return!![];}loggerPredictive[_0x64d4('0x77')](_0x64d4('0x81'));if(!_[_0x64d4('0x82')](_0x85ef48[_0x64d4('0x7e')])&&_0x85ef48[_0x64d4('0x7e')]>0x0){return!![];}loggerPredictive[_0x64d4('0x77')](_0x64d4('0x83'));}else{loggerPredictive[_0x64d4('0x77')](_0x64d4('0x84'));}}else{loggerPredictive[_0x64d4('0x77')](_0x64d4('0x85'));}return![];}function mergeDataErlangB(_0x3ba14e){return function(_0x462309){loggerPredictive[_0x64d4('0x77')](_0x64d4('0x86'));loggerPredictive[_0x64d4('0x77')](_0x64d4('0x87'),_0x462309[_0x64d4('0x88')]);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x89'),_0x462309['erlangCallToSecond']);loggerPredictive['info'](_0x64d4('0x8a'),_0x462309[_0x64d4('0x6e')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x462309[_0x64d4('0x6f')]);loggerPredictive[_0x64d4('0x77')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x462309[_0x64d4('0x6e')]);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x80'));_[_0x64d4('0x8b')](_0x3ba14e,_0x462309);};}function getDiff(_0x3f3793){var _0x4a2e62=moment()[_0x64d4('0x45')](0x0);var _0x507fea=moment(_0x3f3793)[_0x64d4('0x45')](0x0);return _0x4a2e62[_0x64d4('0x8c')](_0x507fea,_0x64d4('0x8d'));}function ifInterval(_0x139a4e,_0x140c31){if(_[_0x64d4('0x82')](_0x140c31)){return![];}return getDiff(_0x140c31)<_0x139a4e*0x3c;}function freeVariablesPredictive(_0x596015){if(isNotNull(_0x596015)){if(!_[_0x64d4('0x82')](_0x596015[_0x64d4('0x8e')])){_0x596015[_0x64d4('0x8e')]=undefined;loggerPredictive[_0x64d4('0x77')](_0x596015['name'],_0x64d4('0x8f'));}if(!_['isUndefined'](_0x596015[_0x64d4('0x70')])){_0x596015['startPredictive']=undefined;loggerPredictive[_0x64d4('0x77')](_0x596015[_0x64d4('0x3c')],_0x64d4('0x90'));}if(!_[_0x64d4('0x82')](_0x596015[_0x64d4('0x91')])){clearInterval(_0x596015[_0x64d4('0x91')]);_0x596015['handlePredictive']=undefined;loggerPredictive[_0x64d4('0x77')](_0x596015['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x978b3e,_0x2dc677){if(_0x2dc677===0x0){return 0x0;}var _0x3fd083=0x1;for(var _0x5edae0=0x1;_0x5edae0<=_0x2dc677;_0x5edae0+=0x1){_0x3fd083=0x1+_0x3fd083*_0x5edae0/_0x978b3e;}return 0x1/_0x3fd083;}function isVoiceQueueOutbound(_0x2b71bd){return _0x2b71bd===_0x64d4('0x48');}function isNotPreview(_0x6d8010){return _0x6d8010!=='preview';}function isCampaignIvr(_0x783df7){return _0x783df7===_0x64d4('0x76');}function getCallerId(_0x551504,_0x21cd3a,_0x2fc57b){if(!_['isUndefined'](_0x2fc57b)&&typeof _0x2fc57b===_0x64d4('0x92')&&!_[_0x64d4('0x42')](_0x2fc57b)){if(!_[_0x64d4('0x82')](_0x21cd3a)&&typeof _0x21cd3a===_0x64d4('0x92')&&!_['isEmpty'](_0x21cd3a)){return util[_0x64d4('0x74')](_0x64d4('0x93'),_0x21cd3a,_0x2fc57b);}return util[_0x64d4('0x74')]('\x22%s\x22\x20<%s>',_0x2fc57b,_0x2fc57b);}if(!_[_0x64d4('0x82')](_0x551504)&&typeof _0x551504===_0x64d4('0x92')&&!_['isEmpty'](_0x551504)){return _0x551504;}return _0x64d4('0x94');}function loggerCatchQueueSummary(_0x719eff,_0x1e7694){return function(_0x214f5d){freeVariablesPredictive(_0x1e7694);emitVoiceQueueSummary(_0x1e7694);emitCampaignSummary(_0x1e7694);loggerSyncQueueSummary[_0x64d4('0x95')](_0x719eff,util[_0x64d4('0x96')](_0x214f5d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x38c832,_0x34b022){return function(_0x127f17){loggerPredictive['error'](_0x34b022[_0x64d4('0x3c')],_0x38c832);loggerPredictive[_0x64d4('0x95')](_0x127f17[_0x64d4('0x97')]);freeVariablesPredictive(_0x34b022);};}function loggerCatch(_0x133a08){return function(_0x41dd50){logger[_0x64d4('0x95')](_0x133a08,util[_0x64d4('0x96')](_0x41dd50,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x222163){return _0x222163&&!_[_0x64d4('0x82')](_0x222163)&&_0x222163['length']>0x0;}function decremetOriginate(_0x221e8e){if(!_[_0x64d4('0x82')](_0x221e8e)&&_0x221e8e!==null){if(typeof _0x221e8e[_0x64d4('0x6c')]!=='undefined'){if(_0x221e8e[_0x64d4('0x6c')]>0x0){_0x221e8e[_0x64d4('0x6c')]-=0x1;}else{logger[_0x64d4('0x95')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x64d4('0x98'));}}function checkContactLowerLimitOriginate(_0x4b3ef9,_0x384626,_0x1c39a2){if(_0x384626>_0x1c39a2){for(var _0x25920a=0x0;_0x25920a<_0x384626-_0x1c39a2;_0x25920a+=0x1){decremetOriginate(_0x4b3ef9);}}}function loggerGetContactDialer(_0x2bae1e,_0x491105,_0x1d7a03){return function(_0x6a4ba3){checkContactLowerLimitOriginate(_0x491105,_0x1d7a03,0x0);logger[_0x64d4('0x95')](_0x2bae1e,util[_0x64d4('0x96')](_0x6a4ba3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x375e60){return function(_0x4701fc){if(isNotNull(_0x4701fc)&&isNotNull(_0x4701fc[0x0])){if(_0x4701fc[0x0][_0x64d4('0x99')]>0x0){_0x375e60[_0x64d4('0x3b')]='RESCHEDULED_CONTACTS';logger[_0x64d4('0x77')](_0x64d4('0x9a')+_0x375e60[_0x64d4('0x3c')],_0x4701fc[0x0][_0x64d4('0x99')],_0x64d4('0x9b'));}else{_0x375e60[_0x64d4('0x3b')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x64d4('0x77')]('[getContactDialer2][Empty]'+_0x375e60[_0x64d4('0x3c')]);}}};}function notSendMessagesQueue(_0x5a6ce5){if(_0x5a6ce5[_0x64d4('0x9c')]){freeVariablesPredictive(_0x5a6ce5);if(_0x5a6ce5['originated']===0x0&&_0x5a6ce5[_0x64d4('0x9d')]===0x0&&_0x5a6ce5[_0x64d4('0x53')]===0x0&&(_0x5a6ce5[_0x64d4('0x4d')]||0x0)===0x0){_0x5a6ce5['sendMessageOneNotActive']=![];_0x5a6ce5[_0x64d4('0x4b')]=0x0;_0x5a6ce5[_0x64d4('0x3b')]=_0x64d4('0x3e');loggerSyncQueueSummary[_0x64d4('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5a6ce5['name'],_0x64d4('0x9e'));}else{_0x5a6ce5['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x64d4('0x95')](_0x64d4('0x9f'),_0x5a6ce5[_0x64d4('0x3c')],'is\x20disactive');}emitVoiceQueueSummary(_0x5a6ce5);}}function notSendMessagesCampaign(_0xf9fe34){if(_0xf9fe34[_0x64d4('0x9c')]){if(_0xf9fe34[_0x64d4('0x6c')]===0x0){_0xf9fe34['sendMessageOneNotActive']=![];_0xf9fe34[_0x64d4('0x3b')]=_0x64d4('0x3e');loggerSyncQueueSummary[_0x64d4('0x95')](_0x64d4('0xa0'),_0xf9fe34[_0x64d4('0x3c')],_0x64d4('0x9e'));}else{_0xf9fe34[_0x64d4('0x3b')]=_0x64d4('0xa1');loggerSyncQueueSummary[_0x64d4('0x95')](_0x64d4('0xa0'),_0xf9fe34[_0x64d4('0x3c')],'is\x20disactive');}emitCampaignSummary(_0xf9fe34);}}function createObjHistory(_0x33699b,_0x448376,_0x379c99,_0x1a3d10,_0x1114a6){_0x33699b['message']=_0x379c99;var _0x48a180=new Action(_0x33699b,_0x448376);var _0x2b47c3=new History(_0x48a180);_0x2b47c3['state']=_0x1a3d10;_0x2b47c3[_0x64d4('0xa2')]=_0x1114a6;_0x2b47c3[_0x64d4('0xa3')]=_0x48a180[_0x64d4('0xa4')];return _0x2b47c3;}Dialer['prototype'][_0x64d4('0x3a')]=function(){var _0x3e65b4=this;setInterval(function(){_0x3e65b4[_0x64d4('0xa5')](_0x3e65b4[_0x64d4('0x27')],_0x64d4('0xa6'));_0x3e65b4['clearZombieChannels'](_0x3e65b4[_0x64d4('0x25')],'[actions]');},0x32c8);};Dialer[_0x64d4('0x1c')]['clearZombieChannels']=function(_0x19a9ac,_0x38800b){var _0x4df739=this;for(var _0x2a638b in _0x19a9ac){if(typeof _0x19a9ac[_0x2a638b]!=='undefined'){this[_0x64d4('0xa7')][_0x64d4('0xa8')](function(){if(!_[_0x64d4('0xa9')](_0x19a9ac[_0x2a638b])){return ami[_0x64d4('0xaa')]({'action':_0x64d4('0xab'),'channel':_0x19a9ac[_0x2a638b][_0x64d4('0xac')]})[_0x64d4('0xad')](function(_0x48bfb5){if(_0x48bfb5[_0x64d4('0x3b')]===_0x64d4('0xae')){setTimeout(function(){if(_0x19a9ac[_0x2a638b]&&_0x19a9ac[_0x2a638b]['type']!=='ivr'){_0x4df739[_0x64d4('0xaf')](_0x4df739[_0x64d4('0x20')][_0x19a9ac[_0x2a638b][_0x64d4('0xb0')]]);logger['error'](_0x64d4('0xb1'),_0x38800b,_0x2a638b,_0x19a9ac[_0x2a638b][_0x64d4('0xb0')]);delete _0x19a9ac[_0x2a638b];}if(_0x19a9ac[_0x2a638b]&&_0x19a9ac[_0x2a638b][_0x64d4('0x47')]===_0x64d4('0x76')){_0x4df739[_0x64d4('0xaf')](_0x4df739['campaigns'][_0x19a9ac[_0x2a638b][_0x64d4('0xb0')]]);logger[_0x64d4('0x95')]('[Dialer][checkChannel][ivr]',_0x38800b,_0x2a638b,_0x19a9ac[_0x2a638b][_0x64d4('0xb0')]);delete _0x19a9ac[_0x2a638b];}},0x2328);}});}});}}};Dialer[_0x64d4('0x1c')][_0x64d4('0xb2')]=function(_0x2bd3b7){return BPromise[_0x64d4('0xb3')]()[_0x64d4('0xb4')](cmHopper['countReScheduled'](_0x2bd3b7))[_0x64d4('0xad')](loggerCatch(_0x64d4('0xb5')));};Dialer['prototype'][_0x64d4('0xb6')]=function(_0x34fe06){return BPromise[_0x64d4('0xb3')]()[_0x64d4('0xb4')](cmHopperBlack[_0x64d4('0xb6')](_0x34fe06))[_0x64d4('0xad')](loggerCatch(_0x64d4('0xb7')));};Dialer['prototype'][_0x64d4('0xb8')]=function(_0x6bfbf2){return BPromise[_0x64d4('0xb3')]()['then'](cmHopperBlack[_0x64d4('0xb8')](_0x6bfbf2))[_0x64d4('0xad')](loggerCatch(_0x64d4('0xb9')));};Dialer[_0x64d4('0x1c')][_0x64d4('0xba')]=function(_0x45ab8b){return BPromise[_0x64d4('0xb3')]()[_0x64d4('0xb4')](cmHopperHistory[_0x64d4('0xbb')](_0x45ab8b))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype']['rescheduleContact']=function(_0x52f2d4){return BPromise[_0x64d4('0xb3')]()[_0x64d4('0xb4')](cmHopper[_0x64d4('0xbc')](_0x52f2d4))['catch'](loggerCatch(_0x64d4('0xbd')));};Dialer['prototype'][_0x64d4('0xbe')]=function(_0x4a7b4c,_0x500fa5,_0xb9ca9e){return BPromise[_0x64d4('0xb3')]()[_0x64d4('0xb4')](cmHopper['unlockContact'](_0x4a7b4c,_0x500fa5,_0xb9ca9e))[_0x64d4('0xad')](loggerCatch(_0x64d4('0xbf')));};Dialer[_0x64d4('0x1c')][_0x64d4('0xc0')]=function(_0x1af092,_0x14c0b8,_0x270c06,_0xfead63,_0x642dae){return BPromise[_0x64d4('0xb3')]()['then'](cmHopper[_0x64d4('0xc0')](_0x1af092,_0x14c0b8,_0x270c06,_0xfead63))[_0x64d4('0xad')](function(_0x84084e){_0x642dae[_0x64d4('0xc1')]-=_0x270c06;_0x642dae[_0x64d4('0xc1')]=_0x642dae[_0x64d4('0xc1')]>0x0?_0x642dae['temp']:0x0;loggerCatch(_0x64d4('0xc2'))(_0x84084e);});};Dialer['prototype'][_0x64d4('0xc3')]=function(_0x83478f,_0x91aca6,_0x4570bb,_0x18793f){return BPromise['resolve']()[_0x64d4('0xb4')](cmHopper[_0x64d4('0xc3')](_0x83478f,_0x91aca6,_0x4570bb))[_0x64d4('0xad')](function(_0x776b34){_0x18793f[_0x64d4('0xc1')]-=_0x91aca6;_0x18793f[_0x64d4('0xc1')]=_0x18793f[_0x64d4('0xc1')]>0x0?_0x18793f[_0x64d4('0xc1')]:0x0;loggerCatch(_0x64d4('0xc4'))(_0x776b34);});};Dialer[_0x64d4('0x1c')]['getVoiceQueueRtPauses']=function(_0x173c51){return BPromise[_0x64d4('0xb3')]()['then'](voiceQueueRt[_0x64d4('0xc5')](_0x173c51))[_0x64d4('0xad')](loggerCatch(_0x64d4('0xc6')));};Dialer[_0x64d4('0x1c')][_0x64d4('0xc7')]=function(_0x51e9d3){return BPromise[_0x64d4('0xb3')]()[_0x64d4('0xb4')](cmHopper[_0x64d4('0xc7')](_0x51e9d3))[_0x64d4('0xad')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0x64d4('0xc8')]=function(_0x19970e){return BPromise['resolve']()[_0x64d4('0xb4')](cmHopperHistory[_0x64d4('0xc8')](_0x19970e))[_0x64d4('0xad')](loggerCatch(_0x64d4('0xc9')));};Dialer[_0x64d4('0x1c')][_0x64d4('0xaf')]=function(_0x379189){if(!_['isUndefined'](_0x379189)&&_0x379189!==null){if(typeof _0x379189[_0x64d4('0x6c')]!==_0x64d4('0xca')){if(_0x379189[_0x64d4('0x6c')]>0x0){_0x379189['originated']-=0x1;}else{logger[_0x64d4('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x64d4('0x95')](_0x64d4('0xcb'));}};Dialer[_0x64d4('0x1c')][_0x64d4('0xcc')]=function(_0x250f97,_0x417d34){var _0x1a73e0=this;return function(_0x3b4904){_0x1a73e0[_0x64d4('0xaf')](_0x417d34);logger[_0x64d4('0x95')](_0x250f97,util['inspect'](_0x3b4904,{'showHidden':![],'depth':null}));};};Dialer[_0x64d4('0x1c')][_0x64d4('0xcd')]=function(_0x153270,_0x44153a,_0x45bdce){var _0x165b9f={'state':0x19,'statedesc':_0x64d4('0xce')};this[_0x64d4('0xaf')](_0x44153a);this[_0x64d4('0xcf')](_[_0x64d4('0x8b')](_0x165b9f,_[_0x64d4('0xd0')](_0x45bdce,['ContactId',_0x64d4('0xd1'),_0x64d4('0xd2'),_0x64d4('0xd3'),_0x64d4('0xd4')])),_0x64d4('0xd5'),_0x64d4('0xd6'));logger[_0x64d4('0x95')](_0x153270);};Dialer[_0x64d4('0x1c')][_0x64d4('0xd7')]=function(_0xff3771){return _0xff3771===_0x64d4('0xd8');};Dialer[_0x64d4('0x1c')][_0x64d4('0xd9')]=function(_0x19abaa){return!_[_0x64d4('0x82')](_0x19abaa)&&_0x19abaa&&!_[_0x64d4('0x82')](_0x19abaa['name'])&&!_[_0x64d4('0x82')](_0x19abaa[_0x64d4('0x72')])&&_0x19abaa[_0x64d4('0x72')]&&(this['trunks'][util['format'](_0x64d4('0xda'),_0x19abaa['name'])]['status']===_0x64d4('0xdb')||this[_0x64d4('0x23')][util[_0x64d4('0x74')](_0x64d4('0xda'),_0x19abaa[_0x64d4('0x3c')])][_0x64d4('0xab')]===_0x64d4('0xdc'));};Dialer[_0x64d4('0x1c')][_0x64d4('0xcf')]=function(_0x4d0ef3,_0x4ff675,_0x1b595b){this[_0x64d4('0xc8')](_0x4d0ef3)[_0x64d4('0xad')](loggerCatch(_0x4ff675));this[_0x64d4('0xc7')](_0x4d0ef3)['catch'](loggerCatch(_0x1b595b));};Dialer['prototype'][_0x64d4('0x36')]=function(_0x34ab28){var _0x153b4d=this[_0x64d4('0x27')][_0x34ab28[_0x64d4('0xdd')]];var _0x31bf36;if(!_[_0x64d4('0xa9')](_0x34ab28)&&!_[_0x64d4('0xa9')](_0x34ab28[_0x64d4('0xde')])&&!_[_0x64d4('0xa9')](_0x34ab28[_0x64d4('0xde')][_0x64d4('0xdf')])&&_0x34ab28[_0x64d4('0xe0')]===_0x64d4('0xe1')&&_0x153b4d){if(_0x153b4d[_0x64d4('0x47')]!==_0x64d4('0x76')&&this[_0x64d4('0x20')][_0x153b4d[_0x64d4('0xb0')]][_0x64d4('0xe2')]&&_0x34ab28[_0x64d4('0xe3')]===_0x64d4('0xe4')){delete this['uniqueId'][_0x34ab28[_0x64d4('0xdd')]];this[_0x64d4('0xaf')](this[_0x64d4('0x20')][_0x153b4d['queue']]);this[_0x64d4('0x20')][_0x153b4d[_0x64d4('0xb0')]][_0x64d4('0x5a')]+=0x1;this[_0x64d4('0x20')][_0x153b4d['queue']][_0x64d4('0x59')]+=0x1;_0x31bf36=new Hangup(_0x153b4d,_0x34ab28);_0x31bf36[_0x64d4('0xe5')]=0x12;_0x31bf36['statedesc']=_0x64d4('0xe6');_0x31bf36[_0x64d4('0xe7')]=_0x64d4('0xe8');ami[_0x64d4('0x46')](_0x64d4('0xe9'),ut[_0x64d4('0xea')](_0x31bf36,_0x64d4('0xeb')));this[_0x64d4('0xcf')](_0x31bf36,_0x64d4('0xec'),_0x64d4('0xed'));}if(_0x153b4d[_0x64d4('0x47')]!==_0x64d4('0x76')&&this[_0x64d4('0x20')][_0x153b4d[_0x64d4('0xb0')]][_0x64d4('0xe2')]&&_0x34ab28[_0x64d4('0xe3')]===_0x64d4('0xee')){var _0x65877f=this;return new BPromise(function(_0x3aa5a3,_0x45a229){delete _0x65877f['uniqueId'][_0x34ab28[_0x64d4('0xdd')]];_0x65877f[_0x64d4('0xaf')](_0x65877f[_0x64d4('0x20')][_0x153b4d[_0x64d4('0xb0')]]);_0x65877f[_0x64d4('0x20')][_0x153b4d['queue']][_0x64d4('0x5a')]+=0x1;_0x65877f[_0x64d4('0x20')][_0x153b4d[_0x64d4('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3598ce=_0x65877f['voiceQueues'][_0x153b4d[_0x64d4('0xb0')]];var _0x441e4e=new Hangup(_0x153b4d,_0x34ab28);_0x441e4e[_0x64d4('0xe5')]=0x13;_0x441e4e['statedesc']='Machine';_0x441e4e[_0x64d4('0xe7')]=_0x64d4('0xe8');_0x441e4e['countmachineretry']+=0x1;_0x441e4e['countglobal']+=0x1;_0x441e4e[_0x64d4('0xeb')]=!![];ami[_0x64d4('0x46')](_0x64d4('0xe9'),ut[_0x64d4('0xea')](_0x441e4e,'amd'));_0x65877f['createHistory'](_0x441e4e)[_0x64d4('0xad')](loggerCatch(_0x64d4('0xef')));if(_0x441e4e[_0x64d4('0xf0')]+_0x441e4e[_0x64d4('0xf1')]+_0x441e4e[_0x64d4('0xf2')]+_0x441e4e[_0x64d4('0xf3')]+_0x441e4e[_0x64d4('0xf4')]+_0x441e4e['countabandonedretry']+_0x441e4e[_0x64d4('0xf5')]+_0x441e4e[_0x64d4('0xf6')]>=_0x3598ce[_0x64d4('0xf7')]){_0x65877f[_0x64d4('0xf8')](_0x441e4e,_0x3aa5a3,_0x45a229,_0x64d4('0xf9'));}else{if(_0x441e4e[_0x64d4('0xf5')]>=_0x3598ce[_0x64d4('0xfa')]){_0x65877f[_0x64d4('0xfb')](_0x441e4e,_0x3aa5a3,_0x45a229,_0x64d4('0xfc'));}else{_0x65877f[_0x64d4('0xbc')]({'active':![],'countmachineretry':_0x441e4e[_0x64d4('0xf5')],'scheduledat':moment()['add'](_0x3598ce[_0x64d4('0xfd')],_0x64d4('0xfe'))[_0x64d4('0x74')](_0x64d4('0xff')),'ContactId':_0x441e4e[_0x64d4('0x100')],'ListId':_0x441e4e['ListId'],'VoiceQueueId':_0x441e4e[_0x64d4('0xd3')]||undefined,'CampaignId':_0x441e4e[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x101')));_0x3aa5a3({'reschedule':0x1});}}});}if(_0x153b4d['type']===_0x64d4('0x76')&&this['campaigns'][_0x153b4d['queue']][_0x64d4('0xe2')]&&_0x34ab28['value']===_0x64d4('0xe4')){delete this[_0x64d4('0x27')][_0x34ab28[_0x64d4('0xdd')]];this['updateOriginated'](this['campaigns'][_0x153b4d[_0x64d4('0xb0')]]);_0x31bf36=new Hangup(_0x153b4d,_0x34ab28);_0x31bf36[_0x64d4('0xe5')]=0x12;_0x31bf36[_0x64d4('0xa2')]=_0x64d4('0xe6');_0x31bf36['membername']='AMD';ami['emit']('custom:amd',ut[_0x64d4('0xea')](_0x31bf36,_0x64d4('0xeb')));this[_0x64d4('0xcf')](_0x31bf36,_0x64d4('0x102'),_0x64d4('0x103'));}if(_0x153b4d['type']==='ivr'&&this[_0x64d4('0x21')][_0x153b4d['queue']]['dialAMDActive']&&_0x34ab28[_0x64d4('0xe3')]===_0x64d4('0xee')){var _0x65877f=this;return new BPromise(function(_0x5d6f0e,_0x78d2d8){delete _0x65877f[_0x64d4('0x27')][_0x34ab28[_0x64d4('0xdd')]];_0x65877f[_0x64d4('0xaf')](_0x65877f['campaigns'][_0x153b4d[_0x64d4('0xb0')]]);_0x65877f[_0x64d4('0x21')][_0x153b4d[_0x64d4('0xb0')]][_0x64d4('0x5a')]+=0x1;_0x65877f['campaigns'][_0x153b4d['queue']][_0x64d4('0x59')]+=0x1;var _0x21f0a6=_0x65877f['campaigns'][_0x153b4d[_0x64d4('0xb0')]];var _0x830be4=new Hangup(_0x153b4d,_0x34ab28);_0x830be4[_0x64d4('0xe5')]=0x13;_0x830be4[_0x64d4('0xa2')]=_0x64d4('0x104');_0x830be4['membername']='AMD';_0x830be4['countmachineretry']+=0x1;_0x830be4[_0x64d4('0x105')]+=0x1;_0x830be4['amd']=!![];ami[_0x64d4('0x46')](_0x64d4('0xe9'),ut[_0x64d4('0xea')](_0x830be4,_0x64d4('0xeb')));_0x65877f['createHistory'](_0x830be4)[_0x64d4('0xad')](loggerCatch(_0x64d4('0xef')));if(_0x830be4[_0x64d4('0xf0')]+_0x830be4[_0x64d4('0xf1')]+_0x830be4[_0x64d4('0xf2')]+_0x830be4[_0x64d4('0xf3')]+_0x830be4[_0x64d4('0xf4')]+_0x830be4['countabandonedretry']+_0x830be4[_0x64d4('0xf5')]+_0x830be4[_0x64d4('0xf6')]>=_0x21f0a6['dialGlobalMaxRetry']){_0x65877f[_0x64d4('0xf8')](_0x830be4,_0x5d6f0e,_0x78d2d8,_0x64d4('0xf9'));}else{if(_0x830be4['countmachineretry']>=_0x21f0a6['dialMachineMaxRetry']){_0x65877f[_0x64d4('0xfb')](_0x830be4,_0x5d6f0e,_0x78d2d8,_0x64d4('0xfc'));}else{_0x65877f['rescheduleContact']({'active':![],'countmachineretry':_0x830be4[_0x64d4('0xf5')],'scheduledat':moment()['add'](_0x21f0a6[_0x64d4('0xfd')],'minutes')[_0x64d4('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x830be4[_0x64d4('0x100')],'ListId':_0x830be4[_0x64d4('0xd1')],'VoiceQueueId':_0x830be4[_0x64d4('0xd3')]||undefined,'CampaignId':_0x830be4[_0x64d4('0xd4')]||undefined})['catch'](loggerCatch(_0x64d4('0x101')));_0x5d6f0e({'reschedule':0x1});}}});}}};Dialer[_0x64d4('0x1c')][_0x64d4('0x106')]=function(_0xd28358){var _0x209e54=this[_0x64d4('0x27')][_0xd28358[_0x64d4('0xdd')]];var _0xee44dc=this;var _0x4c63e2;if(_0x209e54&&_0x209e54[_0x64d4('0x47')]===_0x64d4('0x76')){delete this[_0x64d4('0x27')][_0xd28358[_0x64d4('0xdd')]];this['updateOriginated'](this[_0x64d4('0x21')][_0x209e54[_0x64d4('0xb0')]]);this[_0x64d4('0x21')][_0x209e54[_0x64d4('0xb0')]][_0x64d4('0x107')]+=0x1;_0x4c63e2=new Hangup(_0x209e54,_0xd28358);this['createHistory'](_0x4c63e2)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x108')));this[_0x64d4('0xc7')](_0x4c63e2)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x109')));}if(_0x209e54&&_0x209e54[_0x64d4('0x47')]!==_0x64d4('0x76')&&isNotNull(this[_0x64d4('0x20')][_0x209e54[_0x64d4('0xb0')]][_0x64d4('0x10a')])){delete this[_0x64d4('0x27')][_0xd28358['uniqueid']];this[_0x64d4('0xaf')](this['voiceQueues'][_0x209e54[_0x64d4('0xb0')]]);this[_0x64d4('0x20')][_0x209e54[_0x64d4('0xb0')]][_0x64d4('0x5a')]+=0x1;this[_0x64d4('0x20')][_0x209e54['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4c63e2=new Hangup(_0x209e54,_0xd28358);_0x4c63e2[_0x64d4('0xe5')]=0x10;_0x4c63e2[_0x64d4('0xa2')]=_0x64d4('0x10b');_0x4c63e2[_0x64d4('0xe7')]=_0x64d4('0x10c');this['createHistory'](_0x4c63e2)[_0x64d4('0xad')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x64d4('0xc7')](_0x4c63e2)['catch'](loggerCatch(_0x64d4('0x109')));}if(_0x209e54&&_0x209e54[_0x64d4('0x47')]!=='ivr'&&!isNotNull(this[_0x64d4('0x20')][_0x209e54['queue']][_0x64d4('0x10a')])){delete this[_0x64d4('0x27')][_0xd28358[_0x64d4('0xdd')]];this['updateOriginated'](this[_0x64d4('0x20')][_0x209e54[_0x64d4('0xb0')]]);this[_0x64d4('0x20')][_0x209e54[_0x64d4('0xb0')]][_0x64d4('0x10d')]+=0x1;_0x4c63e2=new Hangup(_0x209e54,_0xd28358);_0x4c63e2[_0x64d4('0xe5')]=0xc;_0x4c63e2['statedesc']=_0xd28358[_0x64d4('0x10e')];_0x4c63e2[_0x64d4('0xe7')]='Unknow';this[_0x64d4('0xc8')](_0x4c63e2)['catch'](loggerCatch(_0x64d4('0x108')));this[_0x64d4('0xc7')](_0x4c63e2)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x64d4('0x1c')][_0x64d4('0x32')]=function(_0x303104){var _0x475a2d=this[_0x64d4('0x27')][_0x303104['uniqueid']];var _0x1f4c84=this;if(this['voiceQueues'][_0x303104['queue']]){if(_0x475a2d&&_0x475a2d[_0x64d4('0x47')]!==_0x64d4('0x76')){delete this['uniqueId'][_0x303104[_0x64d4('0xdd')]];this[_0x64d4('0x20')][_0x303104['queue']][_0x64d4('0x5a')]+=0x1;var _0x3f2a7b=new AgentComplete(_0x475a2d,_0x303104);if(_0x303104['reason']===_0x64d4('0x10f')){_0x3f2a7b['agiafterat']=this[_0x64d4('0x20')][_0x303104[_0x64d4('0xb0')]][_0x64d4('0x110')]&&this[_0x64d4('0x20')][_0x303104[_0x64d4('0xb0')]][_0x64d4('0x111')]?moment()[_0x64d4('0x74')](_0x64d4('0xff')):undefined;}this['createHistory'](_0x3f2a7b)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x112')));this[_0x64d4('0xc7')](_0x3f2a7b)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x113')));}}};Dialer[_0x64d4('0x1c')]['syncAgentConnect']=function(_0x3e7e9a){if(this[_0x64d4('0x20')][_0x3e7e9a[_0x64d4('0xb0')]]){if(this[_0x64d4('0x27')][_0x3e7e9a[_0x64d4('0xdd')]]&&this['uniqueId'][_0x3e7e9a['uniqueid']][_0x64d4('0x47')]!=='ivr'){this['updateOriginated'](this['voiceQueues'][_0x3e7e9a['queue']]);this[_0x64d4('0x27')][_0x3e7e9a['uniqueid']][_0x64d4('0x114')]=moment()[_0x64d4('0x74')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x64d4('0x115')]=function(_0xe61fe){this[_0x64d4('0xc8')](_0xe61fe)[_0x64d4('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x64d4('0xc7')](_0xe61fe)['catch'](loggerCatch(_0x64d4('0x116')));};Dialer[_0x64d4('0x1c')]['syncQueueCallerAbandon']=function(_0x36ca94){var _0x1d0c56=this[_0x64d4('0x27')][_0x36ca94[_0x64d4('0xdd')]];var _0x380238=this;if(this[_0x64d4('0x20')][_0x36ca94['queue']]){if(_0x1d0c56&&_0x1d0c56[_0x64d4('0x47')]!=='ivr'){delete this[_0x64d4('0x27')][_0x36ca94[_0x64d4('0xdd')]];this['updateOriginated'](this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]]);_0x1d0c56[_0x64d4('0x117')]=moment()[_0x64d4('0x74')](_0x64d4('0xff'));var _0x18bdf0=new QueueCallerAbandon(_0x1d0c56,_0x36ca94);if(getSeconds(_0x1d0c56[_0x64d4('0x117')],_0x1d0c56[_0x64d4('0x118')])>=_0x1d0c56[_0x64d4('0x119')]){this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]][_0x64d4('0x5f')]+=0x1;this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]][_0x64d4('0x67')]+=0x1;_0x18bdf0['state']=0xa;_0x18bdf0[_0x64d4('0xa2')]='Drop';_0x18bdf0[_0x64d4('0x11a')]='TIMEOUT';_0x18bdf0[_0x64d4('0x11b')]=this[_0x64d4('0x20')][_0x36ca94['queue']][_0x64d4('0x110')]?moment()[_0x64d4('0x74')](_0x64d4('0xff')):undefined;_0x18bdf0[_0x64d4('0xf4')]+=0x1;_0x18bdf0['countglobal']+=0x1;if(_0x18bdf0['countdropretry']>=this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]][_0x64d4('0x11c')]){this['queueCallerAbandonCreateState'](_0x18bdf0);}else{this[_0x64d4('0xbc')]({'active':![],'countdropretry':_0x18bdf0[_0x64d4('0xf4')],'scheduledat':moment()[_0x64d4('0x11d')](this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]][_0x64d4('0x11e')],_0x64d4('0xfe'))[_0x64d4('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d0c56[_0x64d4('0x100')],'ListId':_0x1d0c56[_0x64d4('0xd1')],'VoiceQueueId':_0x1d0c56[_0x64d4('0xd3')]||undefined,'CampaignId':_0x1d0c56[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x11f')));var _0x282a3e=new History(_0x18bdf0);_0x282a3e[_0x64d4('0xe5')]=0xa;_0x282a3e[_0x64d4('0xa2')]=_0x64d4('0x120');_0x282a3e['starttime']=moment()[_0x64d4('0x74')](_0x64d4('0xff'));_0x282a3e[_0x64d4('0xa3')]=_0x282a3e[_0x64d4('0xa4')];_0x282a3e[_0x64d4('0x121')]=_0x18bdf0[_0x64d4('0x121')];_0x282a3e[_0x64d4('0x122')]=_0x18bdf0[_0x64d4('0x122')];this['createHistory'](_0x282a3e)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x123')));}}else{this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]][_0x64d4('0x7c')]+=0x1;this['voiceQueues'][_0x36ca94[_0x64d4('0xb0')]][_0x64d4('0x5e')]+=0x1;_0x18bdf0['state']=0xb;_0x18bdf0[_0x64d4('0xa2')]=_0x64d4('0x124');_0x18bdf0[_0x64d4('0x11a')]=_0x64d4('0x125');_0x18bdf0[_0x64d4('0x126')]+=0x1;_0x18bdf0[_0x64d4('0x105')]+=0x1;if(_0x18bdf0[_0x64d4('0x126')]>=this['voiceQueues'][_0x36ca94['queue']]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x18bdf0);}else{this[_0x64d4('0xbc')]({'active':![],'countabandonedretry':_0x18bdf0['countabandonedretry'],'scheduledat':moment()[_0x64d4('0x11d')](this[_0x64d4('0x20')][_0x36ca94[_0x64d4('0xb0')]][_0x64d4('0x127')],_0x64d4('0xfe'))[_0x64d4('0x74')](_0x64d4('0xff')),'ContactId':_0x1d0c56[_0x64d4('0x100')],'ListId':_0x1d0c56[_0x64d4('0xd1')],'VoiceQueueId':_0x1d0c56[_0x64d4('0xd3')]||undefined,'CampaignId':_0x1d0c56[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x128')));var _0x282a3e=new History(_0x18bdf0);_0x282a3e[_0x64d4('0xe5')]=0xb;_0x282a3e['statedesc']=_0x64d4('0x124');_0x282a3e[_0x64d4('0xa4')]=moment()[_0x64d4('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x282a3e[_0x64d4('0xa3')]=_0x282a3e[_0x64d4('0xa4')];_0x282a3e[_0x64d4('0x121')]=_0x18bdf0[_0x64d4('0x121')];_0x282a3e[_0x64d4('0x122')]=_0x18bdf0[_0x64d4('0x122')];this[_0x64d4('0xc8')](_0x282a3e)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x129')));}}}}};Dialer[_0x64d4('0x1c')]['syncNewExten']=function(_0x332b17){if(this[_0x64d4('0x25')][_0x332b17['uniqueid']]){this[_0x64d4('0x25')][_0x332b17[_0x64d4('0xdd')]][_0x64d4('0xac')]=_0x332b17['channel'];}if(this[_0x64d4('0x27')][_0x332b17['uniqueid']]){this[_0x64d4('0x27')][_0x332b17[_0x64d4('0xdd')]][_0x64d4('0xac')]=_0x332b17[_0x64d4('0xac')];}};Dialer['prototype']['syncQueueMember']=function(_0x433b8b){if(strategy[this[_0x64d4('0x20')][this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]][_0x64d4('0xb0')]]['strategy']]==='roundrobin'){if(this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]]&&_[_0x64d4('0xa9')](this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]][_0x64d4('0x12b')])&&_0x433b8b[_0x64d4('0xab')]==='1'&&_0x433b8b['paused']==='0'){if(this[_0x64d4('0x22')][_0x433b8b[_0x64d4('0x12c')]]){if(!this['agents'][_0x433b8b[_0x64d4('0x12c')]][_0x64d4('0x12b')]){this[_0x64d4('0x22')][_0x433b8b[_0x64d4('0x12c')]][_0x64d4('0x12b')]=!![];this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]][_0x64d4('0x12b')]=!![];this[_0x64d4('0x25')][_0x433b8b['actionid']][_0x64d4('0x12c')]=_0x433b8b[_0x64d4('0x12c')];}}}}else if((strategy[this[_0x64d4('0x20')][this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]][_0x64d4('0xb0')]][_0x64d4('0x49')]]||_0x64d4('0x1a'))===_0x64d4('0x1a')){if(this[_0x64d4('0x25')][_0x433b8b['actionid']]){if(this[_0x64d4('0x22')][_0x433b8b['stateinterface']]){this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]][_0x64d4('0x12c')]=_0x433b8b['stateinterface'];if(_[_0x64d4('0xa9')](this['queueBooked'][this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]][_0x64d4('0xb0')]])){this[_0x64d4('0x2a')][this[_0x64d4('0x25')][_0x433b8b['actionid']][_0x64d4('0xb0')]]=[];}this[_0x64d4('0x2a')][this[_0x64d4('0x25')][_0x433b8b[_0x64d4('0x12a')]][_0x64d4('0xb0')]][_0x64d4('0x12d')](_['merge'](_[_0x64d4('0xd0')](this[_0x64d4('0x25')][_0x433b8b['actionid']],['idHopper','stateinterface']),{'status':_0x433b8b[_0x64d4('0xab')],'paused':_0x433b8b[_0x64d4('0x12e')]}));}}}};function unlockQueueStatus(_0x28c944,_0x1c153d){setTimeout(function(){if(_['isUndefined'](_0x28c944[_0x64d4('0x12f')])){loggerBooked[_0x64d4('0x95')](_0x64d4('0x130'),_0x1c153d);}_0x28c944[_0x64d4('0x12f')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x1c153d,JSON[_0x64d4('0x73')](_['pick'](_0x28c944,['name',_0x64d4('0x12f')])));},0x1f3);}Dialer[_0x64d4('0x1c')][_0x64d4('0x38')]=function(_0x345d7d){var _0x43f8e3=this;var _0x1223aa=_0x43f8e3[_0x64d4('0x20')][_0x43f8e3['actions'][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xb0')]];if(strategy[this[_0x64d4('0x20')][this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]]['queue']][_0x64d4('0x49')]]==='roundrobin'){if(this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]]&&this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0x12c')]){this[_0x64d4('0x1f')][_0x64d4('0x131')](this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0x132')],this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0x12c')])[_0x64d4('0xad')](function(_0x2f208c){logger[_0x64d4('0x95')](_0x64d4('0x133'),util[_0x64d4('0x96')](_0x2f208c,{'showHidden':![],'depth':null}));})['finally'](function(){_0x43f8e3[_0x64d4('0xaf')](_0x43f8e3['voiceQueues'][_0x43f8e3[_0x64d4('0x25')][_0x345d7d['actionid']][_0x64d4('0xb0')]]);_0x43f8e3['agents'][_0x43f8e3[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]]['stateinterface']][_0x64d4('0x12b')]=![];delete _0x43f8e3[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]];unlockQueueStatus(_0x1223aa);});}else{this['updateOriginated'](this[_0x64d4('0x20')][this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xb0')]]);this[_0x64d4('0xbc')]({'active':![],'ContactId':this[_0x64d4('0x25')][_0x345d7d['actionid']][_0x64d4('0x100')],'ListId':this['actions'][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xd1')],'VoiceQueueId':this[_0x64d4('0x25')][_0x345d7d['actionid']][_0x64d4('0xd3')]||undefined,'CampaignId':this[_0x64d4('0x25')][_0x345d7d['actionid']][_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]];unlockQueueStatus(_0x1223aa);}}else if((strategy[this[_0x64d4('0x20')][this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]]['queue']][_0x64d4('0x49')]]||_0x64d4('0x1a'))===_0x64d4('0x1a')){var _0x537160;if(this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]]&&!_['isEmpty'](this[_0x64d4('0x2a')][this['actions'][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xb0')]])){if(this[_0x64d4('0x2b')][_0x43f8e3[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xb0')]]){this[_0x64d4('0x2b')][_0x43f8e3[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xb0')]]=this['queueBookedRR'][this['actions'][_0x345d7d[_0x64d4('0x12a')]]['queue']]?this[_0x64d4('0x2b')][this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xb0')]]:this[_0x64d4('0x2a')][this[_0x64d4('0x25')][_0x345d7d['actionid']][_0x64d4('0xb0')]]?this[_0x64d4('0x2a')][this[_0x64d4('0x25')][_0x345d7d['actionid']][_0x64d4('0xb0')]][_0x64d4('0x134')]||0x0:0x0;}this[_0x64d4('0x2a')][this['actions'][_0x345d7d['actionid']][_0x64d4('0xb0')]][_0x64d4('0x134')]=this['queueBookedRR'][this[_0x64d4('0x25')][_0x345d7d[_0x64d4('0x12a')]][_0x64d4('0xb0')]];for(var _0x159324=0x0;_0x159324=0x0;})[_0x64d4('0xad')](myreject(_0xf9c5e7)));}}else{_0x4cadbd[_0x64d4('0x12d')](ami['Action']({'action':'command','command':util[_0x64d4('0x74')]('iftime\x20%s,%s',_0x1be129,!_['isUndefined'](config[_0x64d4('0x14b')][_0x491ae9])?_0x491ae9:'')})[_0x64d4('0xb4')](function(_0x1b8ce2){return _0x1b8ce2[_0x64d4('0x14f')][_0x64d4('0x14e')]('true')>=0x0;})[_0x64d4('0xad')](myreject(_0xf9c5e7)));}BPromise[_0x64d4('0x150')](_0x4cadbd)['then'](function(_0x174ece){var _0x1be285=_[_0x64d4('0x151')](_0x174ece);if(_0x1be285){return _0x55b448(_0x1be285);}else{_0x400bc3[_0x64d4('0x3b')]=_0x1c88bc?_0x64d4('0x152'):_0x64d4('0x153');return _0xf9c5e7(msgResponse(_0x64d4('0x154'),_0x64d4('0x147'),'Global:\x20'+_0x1c88bc+'\x20'+_0x4a6594+_0x64d4('0x155')+util[_0x64d4('0x96')](_0x1be129,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x491ae9));}})[_0x64d4('0xad')](function(_0x1445b9){return _0xf9c5e7(msgResponse(_0x64d4('0x144'),_0x64d4('0x147'),JSON[_0x64d4('0x73')](_0x1445b9)));});});};Dialer[_0x64d4('0x1c')][_0x64d4('0x156')]=function(_0x455a19){var _0x1bbb63=this;return function(){switch(_0x455a19[_0x64d4('0x54')]){case'progressive':freeVariablesPredictive(_0x455a19);_0x1bbb63[_0x64d4('0x157')](_0x455a19,0x1);break;case _0x64d4('0x158'):freeVariablesPredictive(_0x455a19);_0x1bbb63['handlePower'](_0x455a19,_0x455a19[_0x64d4('0x159')]);break;case'predictive':_0x1bbb63[_0x64d4('0xb')](_0x455a19);break;case'booked':freeVariablesPredictive(_0x455a19);_0x1bbb63[_0x64d4('0x157')](_0x455a19,0x1);break;default:freeVariablesPredictive(_0x455a19);logger['error']('Queue',_0x455a19[_0x64d4('0x3c')],'method\x20not\x20recognized');}};};Dialer[_0x64d4('0x1c')]['launchHandleIvr']=function(_0x5caa1c){var _0x50082e=this;return function(){_0x50082e[_0x64d4('0x15a')](_0x5caa1c);};};Dialer[_0x64d4('0x1c')][_0x64d4('0xc')]=function(_0x2725a5){var _0x1caf81=this;if(isNotPreview(_0x2725a5['dialMethod'])){if(isVoiceQueueOutbound(_0x2725a5[_0x64d4('0x47')])&&isActive(_0x2725a5[_0x64d4('0x15b')])){_0x2725a5[_0x64d4('0x9c')]=!![];BPromise[_0x64d4('0xb3')]()[_0x64d4('0xb4')](checkIsLoggedIn(_0x2725a5,_0x2725a5[_0x64d4('0x4c')]))[_0x64d4('0xb4')](checkIsActive(_0x2725a5,_0x2725a5[_0x64d4('0x15b')]))[_0x64d4('0xb4')](checkInterval(_0x2725a5))['then'](_0x1caf81[_0x64d4('0x13f')](_0x2725a5))[_0x64d4('0xb4')](_0x1caf81[_0x64d4('0x143')](_0x2725a5[_0x64d4('0x15c')],_0x2725a5['dialTimezone'],_0x2725a5[_0x64d4('0x3c')],_0x2725a5))['then'](_0x1caf81[_0x64d4('0x145')](_0x2725a5[_0x64d4('0x3f')],_0x2725a5[_0x64d4('0x15d')],_0x2725a5[_0x64d4('0x3c')],_0x2725a5))[_0x64d4('0xb4')](_0x1caf81[_0x64d4('0x156')](_0x2725a5))[_0x64d4('0xad')](loggerCatchQueueSummary(_0x64d4('0x15e'),_0x2725a5));}else{notSendMessagesQueue(_0x2725a5);}}else{freeVariablesPredictive(_0x2725a5);}};Dialer[_0x64d4('0x1c')][_0x64d4('0x15f')]=function(){var _0x4960ac=this;var _0x2ec894;for(var _0x53fb9a in this[_0x64d4('0x21')]){if(typeof this[_0x64d4('0x21')][_0x53fb9a]!==_0x64d4('0xca')){_0x2ec894=this[_0x64d4('0x21')][_0x53fb9a];if(isCampaignIvr(_0x2ec894['type'])&&isActive(_0x2ec894[_0x64d4('0x72')])){_0x2ec894[_0x64d4('0x9c')]=!![];BPromise[_0x64d4('0xb3')]()['then'](checkIsActive(_0x2ec894,_0x2ec894[_0x64d4('0x72')]))[_0x64d4('0xb4')](checkInterval(_0x2ec894))['then'](_0x4960ac['checkIsTrunkReachable'](_0x2ec894))[_0x64d4('0xb4')](_0x4960ac['checkIfTime'](_0x2ec894[_0x64d4('0x15c')],_0x2ec894[_0x64d4('0x15d')],_0x2ec894[_0x64d4('0x3c')],_0x2ec894))[_0x64d4('0xb4')](_0x4960ac['checkIfTimeIntervals'](_0x2ec894[_0x64d4('0x3f')],_0x2ec894[_0x64d4('0x15d')],_0x2ec894['name'],_0x2ec894))[_0x64d4('0xb4')](_0x4960ac['launchHandleIvr'](_0x2ec894))[_0x64d4('0xad')](loggerCatchQueueSummary(_0x64d4('0x160'),_0x2ec894));}else{notSendMessagesCampaign(_0x2ec894);}}}};function getCallerIdRandom(_0x5234e5,_0x2ae178){var _0x378183;var _0x3006e2;var _0x36b098;if(_0x2ae178<=0x0){_0x2ae178=0x1;}_0x378183=new RegExp(_0x64d4('0x161')+_0x2ae178+'}$');_0x3006e2=Math['pow'](0xa,_0x2ae178-0x1);_0x36b098=Math[_0x64d4('0x162')](0xa,_0x2ae178)-0x1;return util['format']('%s',_[_0x64d4('0x163')](_0x5234e5,_0x378183,_[_0x64d4('0x164')](_0x3006e2,_0x36b098)));}function extractCalleridName(_0x28233c){var _0x20bacb=_0x28233c[_0x64d4('0x165')](/"(.*?)"/);return _0x20bacb?_0x20bacb[0x1]:_0x28233c;}function extractCalleridNumber(_0x3f8370){var _0x123586=_0x3f8370['match'](/<(.*?)>/);return _0x123586?_0x123586[0x1]:_0x3f8370;}Dialer[_0x64d4('0x1c')][_0x64d4('0x166')]=function(_0x14a947,_0x134cbc){var _0x9bb46e=this;var _0x25f09f=uuid['v4']();this['actions'][_0x25f09f]=new Action(_0x14a947,_0x134cbc,_0x25f09f);return new BPromise(function(_0x5071f1,_0x278a59){if(_[_0x64d4('0x82')](_0x14a947)&&typeof _0x14a947!==_0x64d4('0x167')){return _0x278a59(msgResponse(_0x64d4('0x168'),_0x64d4('0x147'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x134cbc[_0x64d4('0x169')]['phone'])||_0x134cbc[_0x64d4('0x169')][_0x64d4('0x16a')]===null){return _0x278a59(msgResponse(_0x64d4('0x168'),_0x64d4('0x147'),'contact\x20is\x20undefine'));}var _0x52a275={'XMD-CALLERID':_0x9bb46e[_0x64d4('0x25')][_0x25f09f]['getCaller'](),'XMD-AGI':_0x14a947['dialQueueProject']?util[_0x64d4('0x74')](_0x64d4('0x16b'),ipAgi,_0x14a947[_0x64d4('0x10a')]):_0x64d4('0x16c'),'XMD-AGIAFTER':_0x14a947['dialQueueProject2']?util['format'](_0x64d4('0x16b'),ipAgi,_0x14a947[_0x64d4('0x110')]):'NONE','XMD-QUEUE':_0x14a947[_0x64d4('0x47')]===_0x64d4('0x48')?util[_0x64d4('0x74')](_0x64d4('0x16d'),_0x14a947['name'],_0x14a947[_0x64d4('0x16e')]||'',_0x14a947[_0x64d4('0x111')]?'c':'',_0x14a947['dialQueueTimeout']||0x3):_0x64d4('0x16c'),'XMD-CONTACTID':_0x134cbc[_0x64d4('0x100')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x9bb46e[_0x64d4('0x25')][_0x25f09f]['getCaller'](),'XMD-AMD':_0x14a947[_0x64d4('0xe2')]?_0x64d4('0x16f'):_0x64d4('0x16c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x14a947[_0x64d4('0xe2')]){_0x52a275[_0x64d4('0x170')]=_0x14a947[_0x64d4('0x171')]||0x9c4;_0x52a275[_0x64d4('0x172')]=_0x14a947[_0x64d4('0x173')]||0x5dc;_0x52a275[_0x64d4('0x174')]=_0x14a947[_0x64d4('0x175')]||0x320;_0x52a275['XMD-AMDTOTALANALYSISTIME']=_0x14a947['dialAMDTotalAnalysisTime']||0x1388;_0x52a275[_0x64d4('0x176')]=_0x14a947[_0x64d4('0x177')]||0x64;_0x52a275[_0x64d4('0x178')]=_0x14a947[_0x64d4('0x179')]||0x32;_0x52a275[_0x64d4('0x17a')]=_0x14a947[_0x64d4('0x17b')]||0x3;_0x52a275[_0x64d4('0x17c')]=_0x14a947[_0x64d4('0x17d')]||0x100;_0x52a275[_0x64d4('0x17e')]=_0x14a947[_0x64d4('0x17f')]||0x1388;}if(_0x14a947['type']===_0x64d4('0x48')){_0x52a275[_0x64d4('0x180')]=_0x134cbc[_0x64d4('0xd3')];}else{_0x52a275['XMD-CAMPAIGNID']=_0x134cbc[_0x64d4('0xd4')];}for(var _0x4d8bb1 in _0x134cbc['Contact']){if(typeof _0x134cbc[_0x64d4('0x169')][_0x4d8bb1]!==_0x64d4('0xca')){if(isNotNull(_0x134cbc['Contact'][_0x4d8bb1])&&_0x4d8bb1!=='id'&&_0x4d8bb1!==_0x64d4('0x181')&&_0x4d8bb1!==_0x64d4('0x182')&&_0x4d8bb1!==_0x64d4('0x183')){_0x52a275[util[_0x64d4('0x74')]('%s%s','XMD-',_[_0x64d4('0x184')](_0x4d8bb1))]=_0x134cbc[_0x64d4('0x169')][_0x4d8bb1];}}}var _0x27e4d7=_0x9bb46e['isTrunkReachable'](_0x14a947[_0x64d4('0x71')])?getCallerId(_0x14a947[_0x64d4('0x71')][_0x64d4('0x185')],_0x14a947[_0x64d4('0x55')],_0x14a947[_0x64d4('0x186')]>0x0?getCallerIdRandom(_0x14a947['dialOriginateCallerIdNumber'],_0x14a947[_0x64d4('0x186')]):_0x14a947[_0x64d4('0x56')]):getCallerId(_[_0x64d4('0xa9')](_0x14a947['TrunkBackup'])?_0x14a947[_0x64d4('0x71')][_0x64d4('0x185')]:_0x14a947[_0x64d4('0x140')][_0x64d4('0x185')],_0x14a947[_0x64d4('0x55')],_0x14a947['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x14a947[_0x64d4('0x56')],_0x14a947[_0x64d4('0x186')]):_0x14a947[_0x64d4('0x56')]);if(_0x27e4d7){_0x52a275[_0x64d4('0x187')]=_0x9bb46e[_0x64d4('0x25')][_0x25f09f]['originatecalleridname']=extractCalleridName(_0x27e4d7);_0x52a275[_0x64d4('0x188')]=_0x9bb46e[_0x64d4('0x25')][_0x25f09f][_0x64d4('0x189')]=extractCalleridNumber(_0x27e4d7);}return ami[_0x64d4('0xaa')]({'actionid':_0x25f09f,'action':_0x64d4('0x168'),'channel':_0x9bb46e[_0x64d4('0xd9')](_0x14a947['Trunk'])?util[_0x64d4('0x74')](_0x64d4('0x18a'),_0x14a947['Trunk'][_0x64d4('0x3c')],isNotNull(_0x14a947[_0x64d4('0x58')])?_0x14a947[_0x64d4('0x58')][_0x64d4('0x18b')]()||'':'',_0x14a947[_0x64d4('0x18c')]>0x0?_0x134cbc['Contact'][_0x64d4('0x16a')][_0x64d4('0x18d')](_0x14a947[_0x64d4('0x18c')]):_0x134cbc[_0x64d4('0x169')][_0x64d4('0x16a')]):util['format'](_0x64d4('0x18a'),_[_0x64d4('0xa9')](_0x14a947[_0x64d4('0x140')])?_0x14a947['Trunk'][_0x64d4('0x3c')]:_0x14a947[_0x64d4('0x140')][_0x64d4('0x3c')],isNotNull(_0x14a947[_0x64d4('0x58')])?_0x14a947[_0x64d4('0x58')][_0x64d4('0x18b')]()||'':'',_0x14a947['dialCutDigit']>0x0?_0x134cbc[_0x64d4('0x169')][_0x64d4('0x16a')][_0x64d4('0x18d')](_0x14a947[_0x64d4('0x18c')]):_0x134cbc[_0x64d4('0x169')]['phone']),'callerid':_0x27e4d7,'Exten':'xcally-motion-dialer','Context':_0x64d4('0x18e'),'Priority':'1','variable':_0x52a275,'timeout':(_0x14a947['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x25f09f})[_0x64d4('0xb4')](function(_0x535b7f){return _0x5071f1(_0x535b7f);})[_0x64d4('0xad')](function(_0x53d935){_0x14a947[_0x64d4('0x61')]+=0x1;var _0x5d8a39=new History(_0x9bb46e[_0x64d4('0x25')][_0x25f09f]);logger[_0x64d4('0x95')](util['format']('[originateError]:\x20%s',JSON[_0x64d4('0x73')](_0x53d935)));_0x5d8a39['state']=0xe;_0x5d8a39[_0x64d4('0xa2')]='OriginateError';_0x5d8a39[_0x64d4('0xa4')]=moment()[_0x64d4('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d8a39[_0x64d4('0xa3')]=_0x5d8a39[_0x64d4('0xa4')];_0x9bb46e[_0x64d4('0xc8')](_0x5d8a39)['catch'](loggerCatch(_0x64d4('0x18f')));_0x9bb46e[_0x64d4('0xc7')](_0x5d8a39)['catch'](loggerCatch(_0x64d4('0x18f')))[_0x64d4('0x1e')](function(){delete _0x9bb46e[_0x64d4('0x25')][_0x25f09f];return _0x278a59(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer[_0x64d4('0x1c')][_0x64d4('0x190')]=function(_0x5f3ffb){var _0x42ab48=this[_0x64d4('0x25')][_0x5f3ffb[_0x64d4('0x12a')]];if(_0x42ab48){delete this[_0x64d4('0x25')][_0x5f3ffb[_0x64d4('0x12a')]];_0x42ab48[_0x64d4('0x118')]=moment()[_0x64d4('0x74')](_0x64d4('0xff'));var _0x4bca19=_0x42ab48[_0x64d4('0x47')]===_0x64d4('0x76')?this[_0x64d4('0x21')][_0x42ab48['queue']]:this[_0x64d4('0x20')][_0x42ab48[_0x64d4('0x191')]()];if(!this[_0x64d4('0xd7')](_0x5f3ffb[_0x64d4('0x192')])){this[_0x64d4('0xaf')](_0x4bca19);return this[_0x64d4('0x193')](_0x42ab48,_0x4bca19,_0x5f3ffb)[_0x64d4('0xad')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x64d4('0x27')][_0x5f3ffb[_0x64d4('0xdd')]]=_0x42ab48;}};Dialer[_0x64d4('0x1c')][_0x64d4('0x194')]=function(_0x2e7996,_0x3a5d34,_0x1bf1fc){var _0x163f0c=new History(_0x3a5d34);if(_0x163f0c['countbusyretry']+_0x163f0c[_0x64d4('0xf1')]+_0x163f0c[_0x64d4('0xf2')]+_0x163f0c[_0x64d4('0xf3')]+_0x163f0c['countdropretry']+_0x163f0c['countabandonedretry']+_0x163f0c['countmachineretry']+_0x163f0c[_0x64d4('0xf6')]>=_0x1bf1fc[_0x64d4('0xf7')]-0x1){return!![];}switch(_0x2e7996){case 0x3:if(_0x163f0c[_0x64d4('0xf2')]>=_0x1bf1fc[_0x64d4('0x195')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x163f0c[_0x64d4('0xf2')]+=0x1,'scheduledat':moment()[_0x64d4('0x11d')](_0x1bf1fc[_0x64d4('0x196')],'minutes')['format'](_0x64d4('0xff')),'ContactId':_0x163f0c[_0x64d4('0x100')],'ListId':_0x163f0c[_0x64d4('0xd1')],'VoiceQueueId':_0x163f0c[_0x64d4('0xd3')]||undefined,'CampaignId':_0x163f0c['CampaignId']||undefined})['catch'](loggerCatch(_0x64d4('0x197')));break;case 0x5:if(_0x163f0c[_0x64d4('0xf0')]>=_0x1bf1fc[_0x64d4('0x198')]-0x1){return!![];}this[_0x64d4('0xbc')]({'active':![],'countbusyretry':_0x163f0c['countbusyretry']+=0x1,'scheduledat':moment()[_0x64d4('0x11d')](_0x1bf1fc[_0x64d4('0x199')],_0x64d4('0xfe'))[_0x64d4('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x163f0c['ContactId'],'ListId':_0x163f0c[_0x64d4('0xd1')],'VoiceQueueId':_0x163f0c[_0x64d4('0xd3')]||undefined,'CampaignId':_0x163f0c[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x19a')));break;case 0x8:if(_0x163f0c[_0x64d4('0xf1')]>=_0x1bf1fc[_0x64d4('0x19b')]-0x1){return!![];}this[_0x64d4('0xbc')]({'active':![],'countcongestionretry':_0x163f0c[_0x64d4('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x1bf1fc[_0x64d4('0x19c')],_0x64d4('0xfe'))[_0x64d4('0x74')](_0x64d4('0xff')),'ContactId':_0x163f0c[_0x64d4('0x100')],'ListId':_0x163f0c[_0x64d4('0xd1')],'VoiceQueueId':_0x163f0c['VoiceQueueId']||undefined,'CampaignId':_0x163f0c[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x19d')));break;case 0x0:if(_0x163f0c[_0x64d4('0xf3')]>=_0x1bf1fc['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x64d4('0xbc')]({'active':![],'countnosuchnumberretry':_0x163f0c[_0x64d4('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x1bf1fc[_0x64d4('0x19e')],_0x64d4('0xfe'))[_0x64d4('0x74')](_0x64d4('0xff')),'ContactId':_0x163f0c[_0x64d4('0x100')],'ListId':_0x163f0c[_0x64d4('0xd1')],'VoiceQueueId':_0x163f0c[_0x64d4('0xd3')]||undefined,'CampaignId':_0x163f0c[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x19f')));}break;case 0xa:if(_0x163f0c[_0x64d4('0xf4')]>=_0x1bf1fc[_0x64d4('0x11c')]-0x1){return!![];}this[_0x64d4('0xbc')]({'active':![],'countdropretry':_0x163f0c[_0x64d4('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x1bf1fc[_0x64d4('0x11e')],'minutes')[_0x64d4('0x74')](_0x64d4('0xff')),'ContactId':_0x163f0c[_0x64d4('0x100')],'ListId':_0x163f0c[_0x64d4('0xd1')],'VoiceQueueId':_0x163f0c[_0x64d4('0xd3')]||undefined,'CampaignId':_0x163f0c[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x11f')));break;case 0xb:if(_0x163f0c[_0x64d4('0x126')]>=_0x1bf1fc[_0x64d4('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x163f0c[_0x64d4('0x126')]+=0x1,'scheduledat':moment()[_0x64d4('0x11d')](_0x1bf1fc[_0x64d4('0x127')],_0x64d4('0xfe'))[_0x64d4('0x74')](_0x64d4('0xff')),'ContactId':_0x163f0c[_0x64d4('0x100')],'ListId':_0x163f0c['ListId'],'VoiceQueueId':_0x163f0c['VoiceQueueId']||undefined,'CampaignId':_0x163f0c[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x163f0c['countmachineretry']>=_0x1bf1fc[_0x64d4('0xfa')]-0x1){return!![];}this[_0x64d4('0xbc')]({'active':![],'countmachineretry':_0x163f0c[_0x64d4('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x1bf1fc[_0x64d4('0xfd')],_0x64d4('0xfe'))[_0x64d4('0x74')](_0x64d4('0xff')),'ContactId':_0x163f0c[_0x64d4('0x100')],'ListId':_0x163f0c['ListId'],'VoiceQueueId':_0x163f0c['VoiceQueueId']||undefined,'CampaignId':_0x163f0c[_0x64d4('0xd4')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x163f0c[_0x64d4('0xf6')]>=_0x1bf1fc['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x64d4('0xbc')]({'active':![],'countagentrejectretry':_0x163f0c['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x1bf1fc[_0x64d4('0x1a1')],'minutes')[_0x64d4('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x163f0c[_0x64d4('0x100')],'ListId':_0x163f0c['ListId'],'VoiceQueueId':_0x163f0c['VoiceQueueId']||undefined,'CampaignId':_0x163f0c[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1a2')));break;default:return!![];}};Dialer[_0x64d4('0x1c')][_0x64d4('0x193')]=function(_0x587091,_0x1c5c57,_0x2d6617){var _0x18b41a=this;var _0xa8c627=new History(_0x587091);return new BPromise(function(_0x2c00ee,_0x365b57){if(_[_0x64d4('0x82')](_0x1c5c57)&&typeof _0x1c5c57!==_0x64d4('0x167')){return _0x365b57(msgResponse(_0x64d4('0x1a3'),_0x64d4('0x147'),'entity\x20is\x20undefine'));}if(_[_0x64d4('0x82')](_0x2d6617)&&typeof _0x2d6617!==_0x64d4('0x167')){return _0x365b57(msgResponse(_0x64d4('0x1a3'),_0x64d4('0x147'),_0x64d4('0x1a4')));}switch(_0x2d6617['reason']){case'0':_0x1c5c57[_0x64d4('0x1a5')]+=0x1;_0xa8c627['state']=0x0;_0xa8c627[_0x64d4('0xa2')]=_0x64d4('0x1a6');_0xa8c627[_0x64d4('0xf3')]+=0x1;_0xa8c627[_0x64d4('0x105')]+=0x1;ami[_0x64d4('0x46')]('custom:agentnosuchnumber',ut[_0x64d4('0xea')](_0x587091,_0x64d4('0x1a7')));_0x18b41a['createHistory'](_0xa8c627)[_0x64d4('0xad')](loggerCatch(_0x64d4('0xef')));if(_0x18b41a[_0x64d4('0x194')](0x0,_0x587091,_0x1c5c57)){if(_0xa8c627[_0x64d4('0xf3')]>=_0x1c5c57[_0x64d4('0x1a8')]){_0x18b41a[_0x64d4('0xfb')](_0xa8c627,_0x2c00ee,_0x365b57,'reason\x200\x20no\x20such\x20number....');}else{_0x18b41a[_0x64d4('0xf8')](_0xa8c627,_0x2c00ee,_0x365b57,_0x64d4('0x1a9'));}}break;case'3':_0x1c5c57['outboundNoAnswerCallsDay']+=0x1;_0xa8c627['state']=0x3;_0xa8c627[_0x64d4('0xa2')]=_0x64d4('0x1aa');_0xa8c627[_0x64d4('0xf2')]+=0x1;_0xa8c627[_0x64d4('0x105')]+=0x1;ami['emit'](_0x64d4('0x1ab'),ut['buildObj'](_0x587091,_0x64d4('0x1ac')));_0x18b41a[_0x64d4('0xc8')](_0xa8c627)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x18b41a[_0x64d4('0x194')](0x3,_0x587091,_0x1c5c57)){if(_0xa8c627[_0x64d4('0xf2')]>=_0x1c5c57[_0x64d4('0x195')]){_0x18b41a[_0x64d4('0xfb')](_0xa8c627,_0x2c00ee,_0x365b57,'reason\x203\x20ringing\x20no\x20answer');}else{_0x18b41a[_0x64d4('0xf8')](_0xa8c627,_0x2c00ee,_0x365b57,_0x64d4('0x1ad'));}}break;case'5':_0x1c5c57[_0x64d4('0x5c')]+=0x1;_0xa8c627['state']=0x5;_0xa8c627[_0x64d4('0xa2')]=_0x64d4('0x1ae');_0xa8c627[_0x64d4('0xf0')]+=0x1;_0xa8c627[_0x64d4('0x105')]+=0x1;ami[_0x64d4('0x46')](_0x64d4('0x1af'),ut['buildObj'](_0x587091,'busy'));_0x18b41a['createHistory'](_0xa8c627)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1b0')));if(_0x18b41a[_0x64d4('0x194')](0x5,_0x587091,_0x1c5c57)){if(_0xa8c627[_0x64d4('0xf0')]>=_0x1c5c57[_0x64d4('0x198')]){_0x18b41a[_0x64d4('0xfb')](_0xa8c627,_0x2c00ee,_0x365b57,'reason\x205\x20busy');}else{_0x18b41a[_0x64d4('0xf8')](_0xa8c627,_0x2c00ee,_0x365b57,_0x64d4('0x1b1'));}}break;case'8':_0x1c5c57['outboundCongestionCallsDay']+=0x1;_0xa8c627['state']=0x8;_0xa8c627[_0x64d4('0xa2')]=_0x64d4('0x1b2');_0xa8c627[_0x64d4('0xf1')]+=0x1;_0xa8c627['countglobal']+=0x1;ami[_0x64d4('0x46')](_0x64d4('0x1b3'),ut[_0x64d4('0xea')](_0x587091,_0x64d4('0x1b4')));_0x18b41a['createHistory'](_0xa8c627)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1b5')));if(_0x18b41a['checkRetriveMax'](0x8,_0x587091,_0x1c5c57)){if(_0xa8c627[_0x64d4('0xf1')]>=_0x1c5c57[_0x64d4('0x19b')]){_0x18b41a[_0x64d4('0xfb')](_0xa8c627,_0x2c00ee,_0x365b57,_0x64d4('0x1b6'));}else{_0x18b41a[_0x64d4('0xf8')](_0xa8c627,_0x2c00ee,_0x365b57,'reason\x208\x20congestion');}}break;case'11':_0x1c5c57[_0x64d4('0x1b7')]+=0x1;_0xa8c627[_0x64d4('0xe5')]=0xb;_0xa8c627[_0x64d4('0xa2')]=_0x64d4('0x124');_0xa8c627[_0x64d4('0x126')]+=0x1;_0xa8c627[_0x64d4('0x105')]+=0x1;_0x18b41a[_0x64d4('0xc8')](_0xa8c627)[_0x64d4('0xad')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x18b41a[_0x64d4('0x194')](0xb,_0x587091,_0x1c5c57)){if(_0xa8c627[_0x64d4('0x126')]>=_0x1c5c57[_0x64d4('0x1a0')]){_0x18b41a[_0x64d4('0xfb')](_0xa8c627,_0x2c00ee,_0x365b57,'reason\x2011\x20abandoned');}else{_0x18b41a[_0x64d4('0xf8')](_0xa8c627,_0x2c00ee,_0x365b57,_0x64d4('0x1b8'));}}break;case'20':_0x1c5c57[_0x64d4('0x1b9')]+=0x1;_0xa8c627[_0x64d4('0xe5')]=0x14;_0xa8c627[_0x64d4('0xa2')]=_0x64d4('0x1ba');_0xa8c627[_0x64d4('0xf6')]+=0x1;_0xa8c627['countglobal']+=0x1;ami['emit'](_0x64d4('0x1bb'),ut[_0x64d4('0xea')](_0x587091,_0x64d4('0x1bc')));_0x18b41a['createHistory'](_0xa8c627)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1bd')));if(_0x18b41a[_0x64d4('0x194')](0x14,_0x587091,_0x1c5c57)){if(_0xa8c627['countagentrejectretry']>=_0x1c5c57[_0x64d4('0x1be')]){_0x18b41a[_0x64d4('0xfb')](_0xa8c627,_0x2c00ee,_0x365b57,'reason\x2020\x20agentreject');}else{_0x18b41a[_0x64d4('0xf8')](_0xa8c627,_0x2c00ee,_0x365b57,_0x64d4('0x1bf'));}}break;default:_0x1c5c57['outboundUnknownCallsDay']+=0x1;_0xa8c627[_0x64d4('0xe5')]=0xc;_0xa8c627[_0x64d4('0xa2')]=_0x2d6617[_0x64d4('0x1c0')];_0x18b41a['createHistory'](_0xa8c627)[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1c1')));if(_0x18b41a[_0x64d4('0x194')](_0x2d6617[_0x64d4('0x1c0')],_0x587091,_0x1c5c57)){if(_0xa8c627['countbusyretry']+_0xa8c627['countcongestionretry']+_0xa8c627[_0x64d4('0xf2')]+_0xa8c627[_0x64d4('0xf3')]+_0xa8c627[_0x64d4('0xf4')]+_0xa8c627['countabandonedretry']+_0xa8c627['countmachineretry']+_0xa8c627[_0x64d4('0xf6')]>=_0x1c5c57[_0x64d4('0xf7')]){_0x18b41a['stateGlobal'](_0xa8c627,_0x2c00ee,_0x365b57,_0x2d6617['reason']);}else{_0x18b41a[_0x64d4('0xfb')](_0xa8c627,_0x2c00ee,_0x365b57,_0x2d6617[_0x64d4('0x1c0')]);}}}});};Dialer[_0x64d4('0x1c')]['stateGlobal']=function(_0x4450c7,_0x3c929,_0x458c12,_0x42815e){var _0x37e937=new Final(_0x4450c7);_0x37e937[_0x64d4('0xe5')]=0xf;_0x37e937['statedesc']=_0x64d4('0x1c2');this['createStateFinal'](_0x37e937,_0x3c929,_0x458c12,_0x42815e);};Dialer[_0x64d4('0x1c')][_0x64d4('0xfb')]=function(_0x2b3c54,_0x586c55,_0x5a8ac8,_0x30b2de){this[_0x64d4('0xc7')](_0x2b3c54)[_0x64d4('0xb4')](function(){return _0x586c55(msgResponse(_0x64d4('0x1a3'),_0x64d4('0xd8'),_0x30b2de));})[_0x64d4('0xad')](function(){return _0x5a8ac8(msgResponse(_0x64d4('0x1c3'),_0x64d4('0x147'),_0x64d4('0x1c4')));});};Dialer[_0x64d4('0x1c')][_0x64d4('0xb')]=function(_0x49a7ca){var _0x453309=_0x49a7ca[_0x64d4('0x1c5')]/0x64;var _0x17ca76=_0x49a7ca[_0x64d4('0x5f')]/(_0x49a7ca[_0x64d4('0x5f')]+_0x49a7ca[_0x64d4('0x5a')]);var _0xfe0668=Math[_0x64d4('0x1c6')](_0x49a7ca['predictiveIntervalAvailable']*(_0x49a7ca[_0x64d4('0x1c7')]/0x64));var _0x4a6be6=Math['round'](_0x49a7ca[_0x64d4('0x6a')]*(_0x49a7ca[_0x64d4('0x1c8')]/0x64));var _0x26d3e4=_0x49a7ca[_0x64d4('0x4b')]+_0x49a7ca['talking'];var _0x2775c3=Math[_0x64d4('0x1c9')](_0x49a7ca[_0x64d4('0x88')]*_0x49a7ca['erlangAbandonmentRate']*_0x49a7ca['predictiveIntervalHitRate']*_0x49a7ca[_0x64d4('0x68')]);if(_['isUndefined'](_0x49a7ca[_0x64d4('0x8e')])){if(!_[_0x64d4('0x82')](_0x49a7ca[_0x64d4('0x70')])){_0x49a7ca[_0x64d4('0x70')]=undefined;loggerPredictive['error'](_0x64d4('0x1ca'),_0x64d4('0x1cb'));}if(!_[_0x64d4('0x82')](_0x49a7ca[_0x64d4('0x91')])){loggerPredictive[_0x64d4('0x95')]('[startMethodPredictive][StartProgressive]',_0x64d4('0x1cc'));clearInterval(_0x49a7ca['handlePredictive']);_0x49a7ca['handlePredictive']=undefined;}_0x49a7ca[_0x64d4('0x8e')]=moment()['format'](_0x64d4('0xff'));loggerPredictive[_0x64d4('0x77')](_0x49a7ca[_0x64d4('0x3c')],_0x64d4('0x1cd'),_0x49a7ca[_0x64d4('0x8e')]);this[_0x64d4('0x157')](_0x49a7ca,0x1);}else if(ifInterval(_0x49a7ca[_0x64d4('0x1ce')],_0x49a7ca[_0x64d4('0x8e')])){this[_0x64d4('0x157')](_0x49a7ca,0x1);loggerPredictiveCalls['info'](_0x64d4('0x1cf'),_0x49a7ca[_0x64d4('0x8e')],_0x49a7ca[_0x64d4('0x3c')]);_0x49a7ca[_0x64d4('0x88')]=0x0;_0x49a7ca[_0x64d4('0x67')]=0x0;}else if(_0x453309<_0x17ca76&&_0x49a7ca[_0x64d4('0x1d0')]===_0x64d4('0x1d1')){freeVariablesPredictive(_0x49a7ca);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x1d2'),'Dropped\x20calls\x20day',_0x17ca76,_0x64d4('0x8e'),_0x49a7ca['name']);}else if(_0x2775c3<_0x49a7ca[_0x64d4('0x67')]&&_0x49a7ca[_0x64d4('0x1d0')]===_0x64d4('0x1d1')){freeVariablesPredictive(_0x49a7ca);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x1d3'),_0x64d4('0x1d4'),_0x2775c3,_0x64d4('0x1d5'),_0x49a7ca['predictiveIntervalErlangCallsDroppedCalls'],_0x64d4('0x8e'),_0x49a7ca[_0x64d4('0x3c')]);}else if(!ifInterval(_0x49a7ca[_0x64d4('0x1ce')],_0x49a7ca[_0x64d4('0x8e')])&&_['isUndefined'](_0x49a7ca[_0x64d4('0x70')])&&!_[_0x64d4('0x82')](_0x49a7ca[_0x64d4('0x8e')])){_0x49a7ca[_0x64d4('0x70')]=moment()['format'](_0x64d4('0xff'));loggerPredictive['info'](_0x49a7ca[_0x64d4('0x3c')],_0x64d4('0x1d6'),_0x49a7ca[_0x64d4('0x70')]);this[_0x64d4('0xba')](_0x49a7ca[_0x64d4('0x1ce')])['then'](this[_0x64d4('0x1d7')](_0x49a7ca))[_0x64d4('0xb4')](mergeDataErlangB(_0x49a7ca))[_0x64d4('0xb4')](this['startMethodPredictive'](_0x49a7ca))[_0x64d4('0xad')](loggerCatchPredictive(_0x64d4('0x1d8'),_0x49a7ca));}else if(!ifInterval(_0x49a7ca[_0x64d4('0x1ce')],_0x49a7ca[_0x64d4('0x70')])){_0x49a7ca[_0x64d4('0x67')]=0x0;_0x49a7ca[_0x64d4('0x70')]=moment()[_0x64d4('0x74')](_0x64d4('0xff'));loggerPredictive['info'](_0x49a7ca[_0x64d4('0x3c')],'recalculate\x20predictive\x20at',_0x49a7ca[_0x64d4('0x70')]);clearInterval(_0x49a7ca[_0x64d4('0x91')]);_0x49a7ca[_0x64d4('0x91')]=undefined;this[_0x64d4('0xba')](_0x49a7ca[_0x64d4('0x1ce')])[_0x64d4('0xb4')](this[_0x64d4('0x1d7')](_0x49a7ca))[_0x64d4('0xb4')](mergeDataErlangB(_0x49a7ca))[_0x64d4('0xb4')](this[_0x64d4('0x1d9')](_0x49a7ca))[_0x64d4('0xad')](loggerCatchPredictive(_0x64d4('0x1da'),_0x49a7ca));}else if(_0x49a7ca[_0x64d4('0x6a')]&&_0x26d3e4<_0x49a7ca['predictiveIntervalAvailable']-_0x4a6be6){freeVariablesPredictive(_0x49a7ca);loggerPredictive['info'](_0x49a7ca[_0x64d4('0x3c')],_0x64d4('0x1db'),_0x26d3e4,_0x64d4('0x1dc'),_0x49a7ca[_0x64d4('0x6a')],'-',_0x4a6be6,'=',_0x49a7ca[_0x64d4('0x6a')]-_0x4a6be6,')');}else if(_0x49a7ca['predictiveIntervalAvailable']&&_0x26d3e4>_0x49a7ca[_0x64d4('0x6a')]+_0xfe0668){freeVariablesPredictive(_0x49a7ca);loggerPredictive[_0x64d4('0x77')](_0x49a7ca[_0x64d4('0x3c')],_0x64d4('0x1db'),_0x26d3e4,_0x64d4('0x1dd'),_0x49a7ca[_0x64d4('0x6a')],'+',_0xfe0668,'=',_0x49a7ca[_0x64d4('0x6a')]+_0xfe0668,')');}};Dialer[_0x64d4('0x1c')]['getDataPredictive']=function(_0x5a33a1){var _0x2e5d6d=this;return function(_0x10702b){return new BPromise(function(_0x1dd15f,_0x4a6930){_[_0x64d4('0x8b')](_0x5a33a1,_0x10702b[0x0]);if(checkGetDataPredictive(_0x10702b[0x0])){var _0x10b88c=_0x5a33a1['predictiveIntervalAvailable']=_0x5a33a1[_0x64d4('0x9d')]+_0x5a33a1[_0x64d4('0x4b')];var _0x29ada8=_0x5a33a1[_0x64d4('0x1ce')]*0x3c;var _0x64e536=_0x10702b[0x0][_0x64d4('0x64')]+_0x10702b[0x0]['predictiveIntervalAvgHoldtime'];var _0xe9cee8=(_0x10702b[0x0][_0x64d4('0x63')]+_0x10702b[0x0][_0x64d4('0x65')]+_0x10702b[0x0][_0x64d4('0x7c')])/_0x10702b[0x0][_0x64d4('0x6b')];_0x5a33a1[_0x64d4('0x1de')]=_0xe9cee8>0x0?_0xe9cee8:0x1;switch(_0x5a33a1[_0x64d4('0x1d0')]){case _0x64d4('0x1d1'):var _0x42d500=_0x5a33a1[_0x64d4('0x1c5')]/0x64;return _0x2e5d6d[_0x64d4('0x1df')](_0x10b88c,_0x29ada8,_0x64e536,_0xe9cee8,_0x42d500)[_0x64d4('0xb4')](function(_0x2ad7e0){return _0x1dd15f(_0x2ad7e0);});case _0x64d4('0x1e0'):var _0xe2d3ab=_0x5a33a1[_0x64d4('0x1c5')]/0x64;return _0x2e5d6d['busyFactor'](_0x10b88c,_0x29ada8,_0x64e536,_0xe9cee8,_0xe2d3ab)[_0x64d4('0xb4')](function(_0x53b752){return _0x1dd15f(_0x53b752);});default:return _0x4a6930(msgResponse(_0x64d4('0x1e1'),'Failure',_0x64d4('0x1e2')));}}else{return _0x4a6930(msgResponse(_0x64d4('0x1e1'),_0x64d4('0x147'),_0x64d4('0x1e3')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0xf9f592){var _0x1169aa=this;return function(_0x511e6f){return new BPromise(function(_0x1137d0,_0x372096){_[_0x64d4('0x8b')](_0xf9f592,_0x511e6f[0x0]);if(checkGetDataPredictive(_0x511e6f[0x0])){loggerPredictive[_0x64d4('0x77')](JSON[_0x64d4('0x73')](_0x511e6f[0x0]));if(_0xf9f592[_0x64d4('0x1d0')]===_0x64d4('0x1d1')){return _0x1169aa[_0x64d4('0xc5')](_0xf9f592['id'])['then'](function(_0x5cb7a1){var _0xcc7dd=_0xf9f592['loggedIn']-_0x5cb7a1[0x0][_0x64d4('0x1e4')];var _0x545063=_0xf9f592[_0x64d4('0x1ce')]*0x3c;var _0x1a1a47=_0x511e6f[0x0][_0x64d4('0x64')]+_0x511e6f[0x0]['predictiveIntervalAvgHoldtime'];var _0x55e3e8=(_0x511e6f[0x0][_0x64d4('0x63')]+_0x511e6f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x511e6f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x511e6f[0x0]['predictiveIntervalTotalCalls'];var _0x200be1=_0xf9f592[_0x64d4('0x1c5')]/0x64;_0xf9f592['predictiveIntervalPauses']=_0x5cb7a1[0x0][_0x64d4('0x1e4')]||0x0;_0xf9f592[_0x64d4('0x1de')]=_0x55e3e8>0x0?_0x55e3e8:0x1;return _0x1169aa['abandonmentRate'](_0xcc7dd,_0x545063,_0x1a1a47,_0x55e3e8,_0x200be1);})[_0x64d4('0xb4')](function(_0x597843){return _0x1137d0(_0x597843);})[_0x64d4('0xad')](function(_0x4c3510){return _0x372096(msgResponse(_0x64d4('0x1e5'),_0x64d4('0x147'),JSON[_0x64d4('0x73')](_0x4c3510)));});}if(_0xf9f592['dialPredictiveOptimization']===_0x64d4('0x1e0')){return _0x1169aa[_0x64d4('0xc5')](_0xf9f592['id'])['then'](function(_0x442e15){var _0x234e4e=_0xf9f592['loggedIn']-_0x442e15[0x0][_0x64d4('0x1e4')];var _0x36ac36=_0xf9f592[_0x64d4('0x1ce')]*0x3c;var _0x371c6f=_0x511e6f[0x0]['predictiveIntervalAvgTalktime']+_0x511e6f[0x0][_0x64d4('0x7e')];var _0x4d76bb=(_0x511e6f[0x0]['predictiveIntervalAnsweredCalls']+_0x511e6f[0x0][_0x64d4('0x65')]+_0x511e6f[0x0][_0x64d4('0x7c')])/_0x511e6f[0x0][_0x64d4('0x6b')];var _0x4d76e1=_0xf9f592[_0x64d4('0x1c5')]/0x64;_0xf9f592[_0x64d4('0x69')]=_0x442e15[0x0]['outboundQueuePauses']||0x0;_0xf9f592[_0x64d4('0x1de')]=_0x4d76bb>0x0?_0x4d76bb:0x1;return _0x1169aa[_0x64d4('0x1e6')](_0x234e4e,_0x36ac36,_0x371c6f,_0x4d76bb,_0x4d76e1);})[_0x64d4('0xb4')](function(_0x51c420){return _0x1137d0(_0x51c420);})[_0x64d4('0xad')](function(_0xeaf99f){return _0x372096(msgResponse(_0x64d4('0x1e5'),_0x64d4('0x147'),JSON['stringify'](_0xeaf99f)));});}}else{return _0x372096(msgResponse(_0x64d4('0x1e1'),_0x64d4('0x147'),_0x64d4('0x1e3')));}});};};Dialer[_0x64d4('0x1c')][_0x64d4('0x1d9')]=function(_0x50ce73){var _0x2090bc=this;return function(){var _0xb7ef55=0x0;var _0x42e18c=Math[_0x64d4('0x1c9')](_0x50ce73['erlangCallToSecond']*0x3e8);if(_0x42e18c>0x0){_0x42e18c=_0x42e18c<0x64?0x64:_0x42e18c;loggerPredictive[_0x64d4('0x77')](_0x50ce73[_0x64d4('0x3c')],_0x64d4('0x1e7'),_0x42e18c,_0x64d4('0x45'));_0x50ce73[_0x64d4('0x91')]=setInterval(function(){_0x2090bc['handlePredictive'](_0x50ce73);loggerPredictiveCalls[_0x64d4('0x77')](_0x64d4('0x1e8'),_0xb7ef55+=0x1);},_0x42e18c);}else{loggerPredictive[_0x64d4('0x77')](_0x50ce73[_0x64d4('0x3c')],_0x64d4('0x1e9'));}};};Dialer[_0x64d4('0x1c')]['checkContactBlack']=function(_0x77abd0,_0x29f73d){var _0x405dd4=this;return function(_0x3aa421){if(_['isEmpty'](_0x3aa421)){if(_['isNil'](_0x29f73d[_0x64d4('0xd2')])||!_0x29f73d[_0x64d4('0x1ea')]){if(_0x77abd0[_0x64d4('0x54')]==='booked'){_0x77abd0[_0x64d4('0x12f')]=_['isUndefined'](_0x77abd0['queueStatusComplete'])?!![]:_0x77abd0['queueStatusComplete'];var _0x17be15=uuid['v4']();_0x405dd4[_0x64d4('0x25')][_0x17be15]=new Action(_0x77abd0,_0x29f73d,_0x17be15);loggerBooked[_0x64d4('0x77')](_0x64d4('0x1eb'),_0x17be15,'queueStatusComplete:\x20',JSON['stringify'](_0x77abd0[_0x64d4('0x12f')]),_0x64d4('0x1ec'),_0x77abd0[_0x64d4('0x3c')]);if(_0x77abd0['queueStatusComplete']){_0x77abd0[_0x64d4('0x12f')]=![];_0x405dd4['queueBooked'][_0x405dd4[_0x64d4('0x25')][_0x17be15][_0x64d4('0xb0')]]=[];ami[_0x64d4('0xaa')]({'actionid':_0x17be15,'action':'queuestatus','queue':_0x77abd0[_0x64d4('0x3c')]})[_0x64d4('0xad')](function(){_0x405dd4[_0x64d4('0xaf')](_0x77abd0);_0x405dd4[_0x64d4('0xbc')]({'active':![],'ContactId':_0x405dd4[_0x64d4('0x25')][_0x17be15][_0x64d4('0x100')],'ListId':_0x405dd4[_0x64d4('0x25')][_0x17be15][_0x64d4('0xd1')],'VoiceQueueId':_0x405dd4[_0x64d4('0x25')][_0x17be15]['VoiceQueueId']||undefined,'CampaignId':_0x405dd4[_0x64d4('0x25')][_0x17be15][_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1ed')));delete _0x405dd4[_0x64d4('0x25')][_0x17be15];});}else{loggerBooked[_0x64d4('0x77')](_0x64d4('0x1ee'),JSON[_0x64d4('0x73')](_0x77abd0[_0x64d4('0x12f')]),_0x64d4('0x1ec'),_0x77abd0[_0x64d4('0x3c')]);_0x405dd4[_0x64d4('0xaf')](_0x77abd0);_0x405dd4['rescheduleContact']({'active':![],'ContactId':_0x405dd4[_0x64d4('0x25')][_0x17be15][_0x64d4('0x100')],'ListId':_0x405dd4['actions'][_0x17be15][_0x64d4('0xd1')],'VoiceQueueId':_0x405dd4[_0x64d4('0x25')][_0x17be15][_0x64d4('0xd3')]||undefined,'CampaignId':_0x405dd4[_0x64d4('0x25')][_0x17be15][_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1ed')));delete _0x405dd4[_0x64d4('0x25')][_0x17be15];}}else{return _0x405dd4[_0x64d4('0x166')](_0x77abd0,_0x29f73d);}}else{if(getDiff(_0x29f73d[_0x64d4('0x1ef')])<_0x77abd0[_0x64d4('0x1f0')]*0x3c){if(_0x29f73d[_0x64d4('0x1f1')]&&!_0x29f73d[_0x64d4('0x1f1')][_0x64d4('0x1f2')]){_0x405dd4[_0x64d4('0x1f')][_0x64d4('0x131')](_0x29f73d['id'])[_0x64d4('0x1e')](function(){_0x405dd4['updateOriginated'](_0x77abd0);});}else{_0x405dd4['unlockContact']({'active':![]},_0x29f73d['id'],0x1)[_0x64d4('0x1e')](function(){_0x405dd4['updateOriginated'](_0x77abd0);});}}else{_0x77abd0[_0x64d4('0x62')]+=0x1;_0x405dd4[_0x64d4('0xaf')](_0x77abd0);if(_0x77abd0[_0x64d4('0x1f3')]){_0x405dd4['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x29f73d[_0x64d4('0x100')],'ListId':_0x29f73d[_0x64d4('0xd1')],'VoiceQueueId':_0x29f73d[_0x64d4('0xd3')]||undefined,'CampaignId':_0x29f73d[_0x64d4('0xd4')]||undefined})[_0x64d4('0xad')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x405dd4[_0x64d4('0xc8')](createObjHistory(_0x77abd0,_0x29f73d,_0x64d4('0x1f4'),0x17,_0x64d4('0x1f5')))[_0x64d4('0xad')](loggerCatch(_0x64d4('0x1f6')));}else{_0x405dd4[_0x64d4('0xcf')](createObjHistory(_0x77abd0,_0x29f73d,'RECALLFAILEDTIMEOUT',0x16,_0x64d4('0x1f7')),_0x64d4('0x1f8'),_0x64d4('0x1f9'));}}}}else{_0x77abd0[_0x64d4('0x5b')]+=0x1;_0x405dd4['saveInDb'](createObjHistory(_0x77abd0,_0x29f73d,_0x64d4('0x1fa'),0xd,_0x64d4('0x1fb')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x64d4('0x1fc');}};};Dialer[_0x64d4('0x1c')][_0x64d4('0x15a')]=function(_0x2ddd54){var _0x3d1025=this;var _0x47cdfd=_0x2ddd54[_0x64d4('0x1fd')]-_0x2ddd54[_0x64d4('0x6c')]-_0x2ddd54[_0x64d4('0xc1')];emitCampaignSummary(_0x2ddd54);if(_0x47cdfd>0x0){if(_0x47cdfd>this[_0x64d4('0x24')]){_0x47cdfd=this[_0x64d4('0x24')];}_0x2ddd54[_0x64d4('0xc1')]+=_0x47cdfd;this[_0x64d4('0xc3')](_0x2ddd54['id'],_0x47cdfd,_0x2ddd54[_0x64d4('0x1fe')],_0x2ddd54)['then'](function(_0x4a0d3){_0x2ddd54[_0x64d4('0xc1')]-=_0x47cdfd;_0x2ddd54['temp']=_0x2ddd54[_0x64d4('0xc1')]>0x0?_0x2ddd54['temp']:0x0;if(!checkContactEmpty(_0x4a0d3)){_0x2ddd54[_0x64d4('0x3b')]=_0x64d4('0x1ff');logger['info']('[getContactCampaign2][Empty]'+_0x2ddd54[_0x64d4('0x3c')]);}else{_0x2ddd54[_0x64d4('0x6c')]+=_0x4a0d3[_0x64d4('0x200')];_0x2ddd54[_0x64d4('0x3b')]=_0x64d4('0x201');for(var _0x57849d=0x0;_0x57849d<_0x4a0d3[_0x64d4('0x200')];_0x57849d+=0x1){_0x2ddd54[_0x64d4('0x202')]+=0x1;if(_[_0x64d4('0xa9')](_0x4a0d3[_0x57849d])||_[_0x64d4('0xa9')](_0x4a0d3[_0x57849d][_0x64d4('0x169')])||_[_0x64d4('0xa9')](_0x4a0d3[_0x57849d][_0x64d4('0x169')][_0x64d4('0x16a')])){_0x3d1025[_0x64d4('0xcd')](_0x64d4('0x203'),_0x2ddd54,_0x4a0d3[_0x57849d]);}else{_0x3d1025[_0x64d4('0xb8')](_[_0x64d4('0xd0')](_0x4a0d3[_0x57849d],[_0x64d4('0xd4'),_0x64d4('0x204')]))[_0x64d4('0xb4')](_0x3d1025[_0x64d4('0x205')](_0x2ddd54,_0x4a0d3[_0x57849d]))[_0x64d4('0xad')](_0x3d1025[_0x64d4('0xcc')](_0x64d4('0x206'),_0x2ddd54));}}}})['catch'](loggerGetContactDialer(_0x64d4('0x207'),_0x2ddd54,_0x47cdfd));}};Dialer[_0x64d4('0x1c')][_0x64d4('0x157')]=function(_0x4668a0,_0x489f5b){var _0x1d8a6d=this;var _0x2a5592=[];var _0x4bc19c=_0x489f5b>=0x1?_0x489f5b:0x1;if(_0x4668a0[_0x64d4('0x54')]===_0x64d4('0xa')){_0x4bc19c=0x1;}var _0x352703=Math[_0x64d4('0x1c9')](_0x4668a0[_0x64d4('0x4b')]*_0x4bc19c)-_0x4668a0[_0x64d4('0x6c')]-_0x4668a0[_0x64d4('0xc1')];emitVoiceQueueSummary(_0x4668a0);if(_0x4668a0['dialLimitQueue']>0x0){var _0x58ab34=_0x4668a0[_0x64d4('0x208')]-_0x4668a0[_0x64d4('0x6c')]-_0x4668a0[_0x64d4('0x9d')]-_0x4668a0['temp']-_0x4668a0['pTalking'];if(_0x352703>_0x58ab34){_0x352703=_0x58ab34;}}if(_0x352703>0x0){if(_0x4668a0['dialMethod']===_0x64d4('0xa')){_0x352703=0x1;}if(_0x352703>this['maxNumberOriginate']){_0x352703=this[_0x64d4('0x24')];}_0x4668a0[_0x64d4('0xc1')]+=_0x352703;for(var _0x5c58b8 in this[_0x64d4('0x22')]){if(typeof this[_0x64d4('0x22')][_0x5c58b8]!==_0x64d4('0xca')){if(this[_0x64d4('0x22')][_0x5c58b8][_0x64d4('0xe5')]===_0x64d4('0x209')&&this['agents'][_0x5c58b8]['status']===_0x64d4('0xdb')){_0x2a5592[_0x64d4('0x12d')](this['agents'][_0x5c58b8]['id']);}}}this[_0x64d4('0xc0')](_0x4668a0['id'],_0x2a5592,_0x352703,_0x4668a0[_0x64d4('0x1fe')],_0x4668a0)[_0x64d4('0xb4')](function(_0x2d400c){_0x4668a0['temp']-=_0x352703;_0x4668a0['temp']=_0x4668a0[_0x64d4('0xc1')]>0x0?_0x4668a0[_0x64d4('0xc1')]:0x0;if(!checkContactEmpty(_0x2d400c)){_0x1d8a6d[_0x64d4('0xb2')](_0x4668a0)[_0x64d4('0xb4')](sendMessageReschedule(_0x4668a0))[_0x64d4('0xad')](loggerCatch('[countReScheduled]\x20'));}else{_0x4668a0[_0x64d4('0x6c')]+=_0x2d400c[_0x64d4('0x200')];_0x4668a0[_0x64d4('0x3b')]=_0x4668a0[_0x64d4('0x54')]===_0x64d4('0xa')?_0x64d4('0x16f'):_0x64d4('0x201');for(var _0xb8b531=0x0;_0xb8b531<_0x2d400c[_0x64d4('0x200')];_0xb8b531+=0x1){if(_[_0x64d4('0xa9')](_0x2d400c[_0xb8b531])||_[_0x64d4('0xa9')](_0x2d400c[_0xb8b531][_0x64d4('0x169')])||_['isNil'](_0x2d400c[_0xb8b531][_0x64d4('0x169')][_0x64d4('0x16a')])){_0x1d8a6d[_0x64d4('0xcd')](_0x64d4('0x203'),_0x4668a0,_0x2d400c[_0xb8b531]);}else{_0x1d8a6d[_0x64d4('0xb6')](_[_0x64d4('0xd0')](_0x2d400c[_0xb8b531],[_0x64d4('0xd3'),'Contact.phone']))[_0x64d4('0xb4')](_0x1d8a6d[_0x64d4('0x205')](_0x4668a0,_0x2d400c[_0xb8b531]))[_0x64d4('0xad')](_0x1d8a6d[_0x64d4('0xcc')](_0x64d4('0x203'),_0x4668a0));}}}})['catch'](loggerGetContactDialer(_0x64d4('0x20a'),_0x4668a0,_0x352703));}};Dialer['prototype']['handlePredictive']=function(_0xcb6be9){if(_0xcb6be9[_0x64d4('0x208')]>0x0){var _0x294f03=_0xcb6be9[_0x64d4('0x208')]-_0xcb6be9[_0x64d4('0x6c')]-_0xcb6be9[_0x64d4('0x9d')];if(_0x294f03>0x0){this['tryOriginatePredictive'](_0xcb6be9);}else{loggerPredictiveCalls[_0x64d4('0x77')]('[handlePredictive][limitChannel]');}}else{this[_0x64d4('0x20b')](_0xcb6be9);}};Dialer[_0x64d4('0x1c')]['tryOriginatePredictive']=function(_0x36a22c){var _0x54007d=this;var _0x456cad=[];_0x36a22c['originated']+=0x1;for(var _0x1a6ff9 in this['agents']){if(typeof this[_0x64d4('0x22')][_0x1a6ff9]!==_0x64d4('0xca')){if(this[_0x64d4('0x22')][_0x1a6ff9]['state']===_0x64d4('0x209')&&this[_0x64d4('0x22')][_0x1a6ff9][_0x64d4('0xab')]===_0x64d4('0xdb')){_0x456cad[_0x64d4('0x12d')](this[_0x64d4('0x22')][_0x1a6ff9]['id']);}}}this['getContactDialer'](_0x36a22c['id'],_0x456cad,0x1,_0x36a22c['dialOrderByScheduledAt'],_0x36a22c)[_0x64d4('0xb4')](function(_0x4a544a){if(!checkContactEmpty(_0x4a544a)){checkContactLowerLimitOriginate(_0x36a22c,0x1,0x0);_0x54007d['countReScheduled'](_0x36a22c)[_0x64d4('0xb4')](sendMessageReschedule(_0x36a22c))[_0x64d4('0xad')](loggerCatch('[countReScheduled]\x20'));}else{_0x36a22c[_0x64d4('0x3b')]=_0x64d4('0x201');if(_[_0x64d4('0xa9')](_0x4a544a[0x0])||_[_0x64d4('0xa9')](_0x4a544a[0x0][_0x64d4('0x169')])||_['isNil'](_0x4a544a[0x0][_0x64d4('0x169')][_0x64d4('0x16a')])){_0x54007d['emptyContact'](_0x64d4('0x203'),_0x36a22c,_0x4a544a[0x0]);}else{_0x54007d[_0x64d4('0xb6')](_[_0x64d4('0xd0')](_0x4a544a[0x0],['VoiceQueueId','Contact.phone']))[_0x64d4('0xb4')](_0x54007d[_0x64d4('0x205')](_0x36a22c,_0x4a544a[0x0]))['catch'](_0x54007d[_0x64d4('0xcc')](_0x64d4('0x20c'),_0x36a22c));}}})[_0x64d4('0xad')](loggerGetContactDialer(_0x64d4('0x20d'),_0x36a22c,0x1));emitVoiceQueueSummary(_0x36a22c);};Dialer[_0x64d4('0x1c')][_0x64d4('0x1df')]=function(_0x138f88,_0x1404bc,_0xea2dd1,_0x326453,_0x36ea71,_0x553fe0){loggerPredictive[_0x64d4('0x77')](_0x64d4('0x20e'));loggerPredictive[_0x64d4('0x77')](_0x64d4('0x20f'),_0x138f88);loggerPredictive[_0x64d4('0x77')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1404bc);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x210'),_0xea2dd1);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x211'),_0x326453);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x212'),_0x36ea71);loggerPredictive[_0x64d4('0x77')]('---------------------------');return new BPromise(function(_0x445ff9,_0x20b797){if(_0x138f88<=0x0||isNaN(_0x138f88)){return _0x20b797(msgResponse(_0x64d4('0x213'),_0x64d4('0x44'),_0x64d4('0x214')+_0x138f88));}if(_0xea2dd1<=0x0||isNaN(_0xea2dd1)){return _0x20b797(msgResponse(_0x64d4('0x213'),_0x64d4('0x44'),_0x64d4('0x215')+_0xea2dd1));}if(_0x326453<=0x0||isNaN(_0x326453)){return _0x20b797(msgResponse(_0x64d4('0x213'),_0x64d4('0x44'),_0x64d4('0x216')+_0x326453));}if(_0x1404bc<=0x0||isNaN(_0x1404bc)){return _0x20b797(msgResponse(_0x64d4('0x213'),'Error',_0x64d4('0x217')+_0x1404bc));}if(_0x36ea71<=0x0||isNaN(_0x36ea71)){return _0x20b797(msgResponse(_0x64d4('0x213'),_0x64d4('0x44'),_0x64d4('0x218')+_0x36ea71));}_0x553fe0=_0x553fe0||0x0;var _0x57f708=0x1/_0xea2dd1;var _0xb5559c=0x0;var _0x39f234=0x0;var _0x532c43=0x0;var _0x111e2f=0x0;for(var _0x30e8ce=0x0;_0x532c43<_0x36ea71;_0x30e8ce+=0x1){_0x39f234=_0x30e8ce/_0x1404bc;_0xb5559c=(_0x326453*_0x39f234+_0x553fe0)/_0x57f708;_0x532c43=erlangb(_0xb5559c,_0x138f88);_0x111e2f=_0xb5559c/_0x138f88*(0x1-erlangb(_0xb5559c,_0x138f88));}return _0x445ff9({'erlangCalls':_0x30e8ce,'erlangCallToSecond':_0x1404bc/_0x30e8ce,'erlangAbandonmentRate':_0x532c43,'erlangBusyFactor':_0x111e2f});});};Dialer[_0x64d4('0x1c')][_0x64d4('0x1e6')]=function(_0x174dc7,_0x343cdd,_0x4524a9,_0x58690a,_0x5ba222,_0x43dd6f){loggerPredictive[_0x64d4('0x77')](_0x64d4('0x219'));loggerPredictive['info'](_0x64d4('0x20f'),_0x174dc7);loggerPredictive[_0x64d4('0x77')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x343cdd);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x210'),_0x4524a9);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x211'),_0x58690a);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x21a'),_0x5ba222);loggerPredictive[_0x64d4('0x77')](_0x64d4('0x80'));return new BPromise(function(_0x522b48,_0x464308){if(_0x174dc7<=0x0||isNaN(_0x174dc7)){return _0x464308(msgResponse('[busyFactor]',_0x64d4('0x44'),_0x64d4('0x214')+_0x174dc7));}if(_0x4524a9<=0x0||isNaN(_0x4524a9)){return _0x464308(msgResponse(_0x64d4('0x21b'),_0x64d4('0x44'),_0x64d4('0x215')+_0x4524a9));}if(_0x58690a<=0x0||isNaN(_0x58690a)){return _0x464308(msgResponse(_0x64d4('0x21b'),'Error',_0x64d4('0x216')+_0x58690a));}if(_0x343cdd<=0x0||isNaN(_0x343cdd)){return _0x464308(msgResponse(_0x64d4('0x21b'),_0x64d4('0x44'),'interval\x20=\x20'+_0x343cdd));}if(_0x5ba222<=0x0||isNaN(_0x5ba222)){return _0x464308(msgResponse('[busyFactor]',_0x64d4('0x44'),_0x64d4('0x21c')+_0x5ba222));}_0x43dd6f=_0x43dd6f||0x0;var _0x45245d=0x1/_0x4524a9;var _0x275975=0x0;var _0xd520f2=0x0;var _0x2ffd5f=0x0;var _0x2517eb=0x0;for(var _0xc06916=0x0;_0x2517eb<_0x5ba222;_0xc06916+=0x1){_0xd520f2=_0xc06916/_0x343cdd;_0x275975=(_0x58690a*_0xd520f2+_0x43dd6f)/_0x45245d;_0x2ffd5f=erlangb(_0x275975,_0x174dc7);_0x2517eb=_0x275975/_0x174dc7*(0x1-erlangb(_0x275975,_0x174dc7));}return _0x522b48({'erlangCalls':_0xc06916,'erlangCallToSecond':_0x343cdd/_0xc06916,'erlangAbandonmentRate':_0x2ffd5f,'erlangBusyFactor':_0x2517eb});});};module[_0x64d4('0x21d')]=Dialer; \ No newline at end of file +var _0xe630=['saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','value','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','dialAMDActive','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','HANGUP','buildObj','[syncHangupInAMDIvr]','MACHINE','countbusyretry','stateGlobal','dialMachineMaxRetry','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','strategy','locked','paused','agents','stateinterface','rrmemory','queueBooked','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','content','indexOf','true','iftime\x20%s,%s','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','syncCampaigns','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialer','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','outbound','XMD-VOICEQUEUEID','tags','createdAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','ACTIVE','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','Ts\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','util','lodash','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','emit','type','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','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','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','diff','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe630,0x149));var _0x0e63=function(_0x56f43b,_0x12f74b){_0x56f43b=_0x56f43b-0x0;var _0x2a81de=_0xe630[_0x56f43b];return _0x2a81de;};'use strict';var util=require(_0x0e63('0x0'));var _=require(_0x0e63('0x1'));var BPromise=require('bluebird');var uuid=require(_0x0e63('0x2'));var moment=require(_0x0e63('0x3'));var rr=require('rr');var md5=require(_0x0e63('0x4'));var Redis=require('ioredis');var ut=require(_0x0e63('0x5'));var config=require(_0x0e63('0x6'));var logger=require(_0x0e63('0x7'))('dialer');var loggerBooked=require(_0x0e63('0x7'))(_0x0e63('0x8'));var loggerPredictive=require(_0x0e63('0x7'))(_0x0e63('0x9'));var loggerPredictiveCalls=require(_0x0e63('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x0e63('0x7'))(_0x0e63('0xa'));var ami=require(_0x0e63('0xb'));config[_0x0e63('0xc')]=_[_0x0e63('0xd')](config[_0x0e63('0xc')],{'host':_0x0e63('0xe'),'port':0x18eb});var io=require(_0x0e63('0xf'))(new Redis(config[_0x0e63('0xc')]));var cmHopper=require(_0x0e63('0x10'));var cmHopperHistory=require(_0x0e63('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x0e63('0x12'));var Action=require(_0x0e63('0x13'));var History=require(_0x0e63('0x14'));var Final=require(_0x0e63('0x15'));var AgentComplete=require(_0x0e63('0x16'));var QueueCallerAbandon=require(_0x0e63('0x17'));var Hangup=require(_0x0e63('0x18'));var ipAgi=process[_0x0e63('0x19')][_0x0e63('0x1a')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x0e63('0x1b')};var Sequence=function(){};Sequence[_0x0e63('0x1c')][_0x0e63('0x1d')]=function(_0x187cf5){this[_0x0e63('0x1e')]=this[_0x0e63('0x1e')]?this['tail']['finally'](_0x187cf5):_0x187cf5();};function Dialer(_0x5d8660,_0x503f34){this[_0x0e63('0x1f')]=new Sequence();this[_0x0e63('0x20')]=_0x503f34;this[_0x0e63('0x21')]=_0x5d8660['voiceQueues'];this['campaigns']=_0x5d8660[_0x0e63('0x22')];this['agents']=_0x5d8660['agents'];this[_0x0e63('0x23')]=_0x5d8660['trunks'];this[_0x0e63('0x24')]=config[_0x0e63('0x24')]||0x2;this['channels']={};this['actions']={};this[_0x0e63('0x25')]={};this[_0x0e63('0x26')]={};this[_0x0e63('0x27')]={};this[_0x0e63('0x28')]={};this[_0x0e63('0x29')]={};this[_0x0e63('0x2a')]={};this['queueBooked']={};this[_0x0e63('0x2b')]={};ami['on'](_0x0e63('0x2c'),this[_0x0e63('0x2d')][_0x0e63('0x2e')](this));ami['on'](_0x0e63('0x2f'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x0e63('0x30'),this[_0x0e63('0x31')][_0x0e63('0x2e')](this));ami['on'](_0x0e63('0x32'),this[_0x0e63('0x33')]['bind'](this));ami['on'](_0x0e63('0x34'),this[_0x0e63('0xa')][_0x0e63('0x2e')](this));ami['on'](_0x0e63('0x35'),this[_0x0e63('0x36')][_0x0e63('0x2e')](this));ami['on'](_0x0e63('0x37'),this[_0x0e63('0x38')][_0x0e63('0x2e')](this));ami['on'](_0x0e63('0x39'),this[_0x0e63('0x3a')]['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x0e63('0x2e')](this));ami['on'](_0x0e63('0x3b'),this[_0x0e63('0x3c')][_0x0e63('0x2e')](this));this[_0x0e63('0x3d')]();this[_0x0e63('0x3e')]();}function isNotNull(_0x3ce92c){return _0x3ce92c!==null&&!_[_0x0e63('0x3f')](_0x3ce92c);}function checkIsLoggedIn(_0x2ef997,_0x31fc3e){return function(){if(_0x31fc3e<=0x0){_0x2ef997[_0x0e63('0x40')]=_0x0e63('0x41');throw _0x2ef997[_0x0e63('0x42')]+_0x0e63('0x43');}};}function isActive(_0x2b958f){return _0x2b958f;}function checkIsActive(_0xddb682,_0x33953c){return function(){if(!isActive(_0x33953c)){_0xddb682['message']=_0x0e63('0x44');throw _0xddb682[_0x0e63('0x42')]+'\x20NOT\x20Active';}};}function checkInterval(_0x3f0a8a){return function(){if(!isNotNull(_0x3f0a8a[_0x0e63('0x45')])){_0x3f0a8a[_0x0e63('0x40')]=_0x0e63('0x46');throw _0x3f0a8a['name']+_0x0e63('0x47');}if(!isNotNull(_0x3f0a8a[_0x0e63('0x45')][_0x0e63('0x48')])){_0x3f0a8a[_0x0e63('0x40')]=_0x0e63('0x46');throw _0x3f0a8a[_0x0e63('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0e63('0x49')](_0x3f0a8a[_0x0e63('0x45')][_0x0e63('0x48')]))){_0x3f0a8a[_0x0e63('0x40')]=_0x0e63('0x46');throw _0x3f0a8a[_0x0e63('0x42')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x36c466,_0x2f8bac,_0x9dca0d){return{'action':_0x36c466,'response':_0x2f8bac,'message':_0x9dca0d,'stack':_0x9dca0d};}function myreject(_0x27ba11){return function(_0x2f2f72){return _0x27ba11(msgResponse(_0x0e63('0x4a'),'Error',JSON[_0x0e63('0x4b')](_0x2f2f72)));};}function getSeconds(_0x4a8bdb,_0x2741a4){var _0x1ae634=moment(_0x4a8bdb)[_0x0e63('0x4c')](0x0);var _0x2e8cc6=moment(_0x2741a4)[_0x0e63('0x4c')](0x0);return _0x1ae634['diff'](_0x2e8cc6,'seconds');}function emit(_0x5e9f0f,_0x162fe3,_0x150b45){io['to'](_0x5e9f0f)[_0x0e63('0x4d')](_0x162fe3,_0x150b45);}function emitVoiceQueueSummary(_0x294b4a){if(_0x294b4a[_0x0e63('0x4e')]==='outbound'){var _0x51cc1d={'id':_0x294b4a['id'],'name':_0x294b4a[_0x0e63('0x42')],'strategy':_0x294b4a['strategy'],'answered':_0x294b4a[_0x0e63('0x4f')],'available':_0x294b4a['available'],'loggedIn':_0x294b4a[_0x0e63('0x50')],'pTalking':_0x294b4a[_0x0e63('0x51')],'sumBillable':_0x294b4a['sumBillable'],'sumDuration':_0x294b4a[_0x0e63('0x52')],'sumHoldTime':_0x294b4a[_0x0e63('0x53')]||0x0,'talking':_0x294b4a[_0x0e63('0x54')],'total':_0x294b4a[_0x0e63('0x55')],'type':_0x294b4a[_0x0e63('0x4e')],'unmanaged':_0x294b4a[_0x0e63('0x56')],'abandoned':_0x294b4a[_0x0e63('0x57')],'waiting':_0x294b4a[_0x0e63('0x58')],'loggedInDb':_0x294b4a[_0x0e63('0x59')],'dialActive':_0x294b4a['dialActive'],'dialMethod':_0x294b4a['dialMethod'],'dialOriginateCallerIdName':_0x294b4a[_0x0e63('0x5a')],'dialOriginateCallerIdNumber':_0x294b4a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x294b4a[_0x0e63('0x5b')],'dialPrefix':_0x294b4a[_0x0e63('0x5c')],'outboundAnswerAgiCallsDay':_0x294b4a[_0x0e63('0x5d')],'outboundAnswerCallsDay':_0x294b4a[_0x0e63('0x5e')],'outboundBlacklistCallsDay':_0x294b4a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x294b4a[_0x0e63('0x5f')],'outboundCongestionCallsDay':_0x294b4a[_0x0e63('0x60')],'outboundDropCallsDayACS':_0x294b4a[_0x0e63('0x61')],'outboundDropCallsDayCallersExit':_0x294b4a[_0x0e63('0x62')],'outboundDropCallsDayTimeout':_0x294b4a[_0x0e63('0x63')],'outboundNoAnswerCallsDay':_0x294b4a[_0x0e63('0x64')],'outboundNoSuchCallsDay':_0x294b4a[_0x0e63('0x65')],'outboundOriginateFailureCallsDay':_0x294b4a[_0x0e63('0x66')],'outboundReCallsDay':_0x294b4a[_0x0e63('0x67')],'outboundRejectCallsDay':_0x294b4a[_0x0e63('0x68')],'outboundUnknownCallsDay':_0x294b4a['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x294b4a[_0x0e63('0x69')],'predictiveIntervalAvgHoldtime':_0x294b4a[_0x0e63('0x6a')],'predictiveIntervalAvgTalktime':_0x294b4a[_0x0e63('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x294b4a[_0x0e63('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x294b4a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x294b4a[_0x0e63('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x294b4a[_0x0e63('0x6e')],'predictiveIntervalHitRate':_0x294b4a[_0x0e63('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x294b4a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x294b4a[_0x0e63('0x70')],'predictiveIntervalAvailable':_0x294b4a[_0x0e63('0x71')],'predictiveIntervalTotalCalls':_0x294b4a[_0x0e63('0x72')],'message':_0x294b4a['message'],'originated':_0x294b4a[_0x0e63('0x73')],'erlangCalls':_0x294b4a[_0x0e63('0x74')],'erlangCallToSecond':_0x294b4a[_0x0e63('0x75')],'erlangAbandonmentRate':_0x294b4a[_0x0e63('0x76')],'erlangBusyFactor':_0x294b4a['erlangBusyFactor'],'startPredictive':_0x294b4a[_0x0e63('0x28')],'startProgressive':_0x294b4a['startProgressive']};if(_0x294b4a[_0x0e63('0x77')]){_0x51cc1d[_0x0e63('0x77')]={'id':_0x294b4a[_0x0e63('0x77')]['id'],'name':_0x294b4a[_0x0e63('0x77')][_0x0e63('0x42')],'active':_0x294b4a[_0x0e63('0x77')][_0x0e63('0x78')],'callerid':_0x294b4a[_0x0e63('0x77')]['callerid']};}if(_0x294b4a['Interval']){_0x51cc1d['Interval']={'id':_0x294b4a[_0x0e63('0x45')]['id'],'name':_0x294b4a[_0x0e63('0x45')][_0x0e63('0x42')]};}var _0x478e74=md5(JSON[_0x0e63('0x4b')](_0x51cc1d));if(_0x294b4a[_0x0e63('0x4')]!==_0x478e74){_0x294b4a[_0x0e63('0x4')]=_0x478e74;emit(util[_0x0e63('0x79')]('voice:queue:%s',_0x51cc1d['name']),_0x0e63('0x7a'),_0x51cc1d);}}}function emitCampaignSummary(_0x39b246){if(_0x39b246['type']===_0x0e63('0x7b')){emit(util[_0x0e63('0x79')](_0x0e63('0x7c'),_0x39b246['name']),_0x0e63('0x7d'),_0x39b246);}}function checkGetDataPredictive(_0x377a34){if(isNotNull(_0x377a34)&&!_[_0x0e63('0x49')](_0x377a34)){loggerPredictive['info'](_0x0e63('0x7e'));loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x80'),_0x377a34[_0x0e63('0x72')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x81'),_0x377a34[_0x0e63('0x69')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x82'),_0x377a34[_0x0e63('0x83')]);loggerPredictive['info'](_0x0e63('0x84'),_0x377a34[_0x0e63('0x6c')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x85'),_0x377a34[_0x0e63('0x6a')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x86'),_0x377a34[_0x0e63('0x6b')]);loggerPredictive['info'](_0x0e63('0x87'));if(_0x377a34[_0x0e63('0x72')]>0x0){if(!_[_0x0e63('0x3f')](_0x377a34[_0x0e63('0x6b')])&&_0x377a34[_0x0e63('0x6b')]>0x0){return!![];}loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x88'));if(!_[_0x0e63('0x3f')](_0x377a34[_0x0e63('0x6a')])&&_0x377a34[_0x0e63('0x6a')]>0x0){return!![];}loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x89'));}else{loggerPredictive[_0x0e63('0x7f')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x8a'));}return![];}function mergeDataErlangB(_0x4835d1){return function(_0x1168df){loggerPredictive[_0x0e63('0x7f')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x0e63('0x8b'),_0x1168df[_0x0e63('0x74')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x8c'),_0x1168df[_0x0e63('0x75')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x8d'),_0x1168df[_0x0e63('0x76')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x8e'),_0x1168df[_0x0e63('0x8f')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x8d'),_0x1168df[_0x0e63('0x76')]);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x87'));_[_0x0e63('0x90')](_0x4835d1,_0x1168df);};}function getDiff(_0x35ce96){var _0x2710f5=moment()[_0x0e63('0x4c')](0x0);var _0x1c3902=moment(_0x35ce96)[_0x0e63('0x4c')](0x0);return _0x2710f5[_0x0e63('0x91')](_0x1c3902,_0x0e63('0x92'));}function ifInterval(_0x651ec,_0x590052){if(_[_0x0e63('0x3f')](_0x590052)){return![];}return getDiff(_0x590052)<_0x651ec*0x3c;}function freeVariablesPredictive(_0x50af93){if(isNotNull(_0x50af93)){if(!_[_0x0e63('0x3f')](_0x50af93['startProgressive'])){_0x50af93['startProgressive']=undefined;loggerPredictive[_0x0e63('0x7f')](_0x50af93[_0x0e63('0x42')],_0x0e63('0x93'));}if(!_['isUndefined'](_0x50af93[_0x0e63('0x28')])){_0x50af93[_0x0e63('0x28')]=undefined;loggerPredictive[_0x0e63('0x7f')](_0x50af93['name'],_0x0e63('0x94'));}if(!_[_0x0e63('0x3f')](_0x50af93['handlePredictive'])){clearInterval(_0x50af93['handlePredictive']);_0x50af93[_0x0e63('0x95')]=undefined;loggerPredictive['info'](_0x50af93[_0x0e63('0x42')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0xaa6f08,_0xae1f1c){if(_0xae1f1c===0x0){return 0x0;}var _0x3f7211=0x1;for(var _0xfaaac0=0x1;_0xfaaac0<=_0xae1f1c;_0xfaaac0+=0x1){_0x3f7211=0x1+_0x3f7211*_0xfaaac0/_0xaa6f08;}return 0x1/_0x3f7211;}function isVoiceQueueOutbound(_0x3b10fa){return _0x3b10fa==='outbound';}function isNotPreview(_0x2383ed){return _0x2383ed!==_0x0e63('0x20');}function isCampaignIvr(_0x3befd4){return _0x3befd4==='ivr';}function getCallerId(_0x34b12a,_0xd31899,_0x33c5e6){if(!_[_0x0e63('0x3f')](_0x33c5e6)&&typeof _0x33c5e6==='string'&&!_[_0x0e63('0x49')](_0x33c5e6)){if(!_[_0x0e63('0x3f')](_0xd31899)&&typeof _0xd31899===_0x0e63('0x96')&&!_['isEmpty'](_0xd31899)){return util[_0x0e63('0x79')]('\x22%s\x22\x20<%s>',_0xd31899,_0x33c5e6);}return util['format'](_0x0e63('0x97'),_0x33c5e6,_0x33c5e6);}if(!_[_0x0e63('0x3f')](_0x34b12a)&&typeof _0x34b12a===_0x0e63('0x96')&&!_['isEmpty'](_0x34b12a)){return _0x34b12a;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x3204ca,_0x3313f7){return function(_0x3b89f6){freeVariablesPredictive(_0x3313f7);emitVoiceQueueSummary(_0x3313f7);emitCampaignSummary(_0x3313f7);loggerSyncQueueSummary[_0x0e63('0x98')](_0x3204ca,util[_0x0e63('0x99')](_0x3b89f6,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x9f28d8,_0x4a7457){return function(_0x54b7fc){loggerPredictive[_0x0e63('0x98')](_0x4a7457['name'],_0x9f28d8);loggerPredictive[_0x0e63('0x98')](_0x54b7fc['stack']);freeVariablesPredictive(_0x4a7457);};}function loggerCatch(_0x4c6a2e){return function(_0x5ae0c1){logger['error'](_0x4c6a2e,util[_0x0e63('0x99')](_0x5ae0c1,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2153a2){return _0x2153a2&&!_[_0x0e63('0x3f')](_0x2153a2)&&_0x2153a2[_0x0e63('0x9a')]>0x0;}function decremetOriginate(_0x170c5e){if(!_[_0x0e63('0x3f')](_0x170c5e)&&_0x170c5e!==null){if(typeof _0x170c5e[_0x0e63('0x73')]!==_0x0e63('0x9b')){if(_0x170c5e[_0x0e63('0x73')]>0x0){_0x170c5e['originated']-=0x1;}else{logger[_0x0e63('0x98')](_0x0e63('0x9c'));}}}else{logger[_0x0e63('0x98')](_0x0e63('0x9d'));}}function checkContactLowerLimitOriginate(_0x146755,_0x298ae7,_0x29ab2f){if(_0x298ae7>_0x29ab2f){for(var _0x57b4c1=0x0;_0x57b4c1<_0x298ae7-_0x29ab2f;_0x57b4c1+=0x1){decremetOriginate(_0x146755);}}}function loggerGetContactDialer(_0x17a3af,_0x4414fa,_0xb1072e){return function(_0x523371){checkContactLowerLimitOriginate(_0x4414fa,_0xb1072e,0x0);logger[_0x0e63('0x98')](_0x17a3af,util[_0x0e63('0x99')](_0x523371,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5f045e){return function(_0x18a77a){if(isNotNull(_0x18a77a)&&isNotNull(_0x18a77a[0x0])){if(_0x18a77a[0x0][_0x0e63('0x9e')]>0x0){_0x5f045e[_0x0e63('0x40')]=_0x0e63('0x9f');logger['info'](_0x0e63('0xa0')+_0x5f045e[_0x0e63('0x42')],_0x18a77a[0x0]['contactsRescheduled'],_0x0e63('0xa1'));}else{_0x5f045e[_0x0e63('0x40')]=_0x0e63('0xa2');logger['info'](_0x0e63('0xa3')+_0x5f045e[_0x0e63('0x42')]);}}};}function notSendMessagesQueue(_0x570116){if(_0x570116[_0x0e63('0xa4')]){freeVariablesPredictive(_0x570116);if(_0x570116['originated']===0x0&&_0x570116['talking']===0x0&&_0x570116['waiting']===0x0&&(_0x570116['pTalking']||0x0)===0x0){_0x570116['sendMessageOneNotActive']=![];_0x570116[_0x0e63('0xa5')]=0x0;_0x570116[_0x0e63('0x40')]=_0x0e63('0x44');loggerSyncQueueSummary[_0x0e63('0x98')](_0x0e63('0xa6'),_0x570116[_0x0e63('0x42')],'is\x20not\x20active');}else{_0x570116[_0x0e63('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x0e63('0x98')](_0x0e63('0xa6'),_0x570116[_0x0e63('0x42')],'is\x20disactive');}emitVoiceQueueSummary(_0x570116);}}function notSendMessagesCampaign(_0x880c92){if(_0x880c92['sendMessageOneNotActive']){if(_0x880c92[_0x0e63('0x73')]===0x0){_0x880c92[_0x0e63('0xa4')]=![];_0x880c92[_0x0e63('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0e63('0x98')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x880c92['name'],_0x0e63('0xa7'));}else{_0x880c92[_0x0e63('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x0e63('0xa8'),_0x880c92[_0x0e63('0x42')],_0x0e63('0xa9'));}emitCampaignSummary(_0x880c92);}}function createObjHistory(_0x5230be,_0x1fbb05,_0x1c14d1,_0x334eda,_0x50e867){_0x5230be[_0x0e63('0x40')]=_0x1c14d1;var _0x5b612c=new Action(_0x5230be,_0x1fbb05);var _0x1b70db=new History(_0x5b612c);_0x1b70db[_0x0e63('0xaa')]=_0x334eda;_0x1b70db[_0x0e63('0xab')]=_0x50e867;_0x1b70db[_0x0e63('0xac')]=_0x5b612c['starttime'];return _0x1b70db;}Dialer[_0x0e63('0x1c')][_0x0e63('0x3e')]=function(){var _0x22c85e=this;setInterval(function(){_0x22c85e[_0x0e63('0xad')](_0x22c85e[_0x0e63('0x26')],_0x0e63('0xae'));_0x22c85e['clearZombieChannels'](_0x22c85e[_0x0e63('0xaf')],_0x0e63('0xb0'));},0x32c8);};Dialer['prototype'][_0x0e63('0xad')]=function(_0x50c5a5,_0x14e0e5){var _0x2541c8=this;for(var _0x5d6a06 in _0x50c5a5){if(typeof _0x50c5a5[_0x5d6a06]!==_0x0e63('0x9b')){this[_0x0e63('0x1f')][_0x0e63('0x1d')](function(){if(!_[_0x0e63('0xb1')](_0x50c5a5[_0x5d6a06])){return ami[_0x0e63('0xb2')]({'action':_0x0e63('0xb3'),'channel':_0x50c5a5[_0x5d6a06][_0x0e63('0xb4')]})['catch'](function(_0xf25367){if(_0xf25367[_0x0e63('0x40')]===_0x0e63('0xb5')){setTimeout(function(){if(_0x50c5a5[_0x5d6a06]&&_0x50c5a5[_0x5d6a06][_0x0e63('0x4e')]!==_0x0e63('0x7b')){_0x2541c8[_0x0e63('0xb6')](_0x2541c8[_0x0e63('0x21')][_0x50c5a5[_0x5d6a06][_0x0e63('0xb7')]]);logger['error'](_0x0e63('0xb8'),_0x14e0e5,_0x5d6a06,_0x50c5a5[_0x5d6a06]['queue']);delete _0x50c5a5[_0x5d6a06];}if(_0x50c5a5[_0x5d6a06]&&_0x50c5a5[_0x5d6a06]['type']==='ivr'){_0x2541c8[_0x0e63('0xb6')](_0x2541c8[_0x0e63('0x22')][_0x50c5a5[_0x5d6a06]['queue']]);logger[_0x0e63('0x98')](_0x0e63('0xb9'),_0x14e0e5,_0x5d6a06,_0x50c5a5[_0x5d6a06][_0x0e63('0xb7')]);delete _0x50c5a5[_0x5d6a06];}},0x2328);}});}});}}};Dialer[_0x0e63('0x1c')]['countReScheduled']=function(_0x25c868){return BPromise[_0x0e63('0xba')]()['then'](cmHopper[_0x0e63('0xbb')](_0x25c868))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xbd')));};Dialer[_0x0e63('0x1c')][_0x0e63('0xbe')]=function(_0x5f47cc){return BPromise[_0x0e63('0xba')]()[_0x0e63('0xbf')](cmHopperBlack[_0x0e63('0xbe')](_0x5f47cc))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xc0')));};Dialer[_0x0e63('0x1c')][_0x0e63('0xc1')]=function(_0x4b9e32){return BPromise['resolve']()[_0x0e63('0xbf')](cmHopperBlack[_0x0e63('0xc1')](_0x4b9e32))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xc2')));};Dialer[_0x0e63('0x1c')][_0x0e63('0xc3')]=function(_0x1c58a7){return BPromise[_0x0e63('0xba')]()[_0x0e63('0xbf')](cmHopperHistory[_0x0e63('0xc4')](_0x1c58a7))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xc5')));};Dialer[_0x0e63('0x1c')][_0x0e63('0xc6')]=function(_0x5d3ef1){return BPromise['resolve']()[_0x0e63('0xbf')](cmHopper[_0x0e63('0xc6')](_0x5d3ef1))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xc7')));};Dialer['prototype'][_0x0e63('0xc8')]=function(_0x35ea21,_0x32c878,_0x231fe0){return BPromise[_0x0e63('0xba')]()[_0x0e63('0xbf')](cmHopper[_0x0e63('0xc8')](_0x35ea21,_0x32c878,_0x231fe0))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xc9')));};Dialer['prototype'][_0x0e63('0xca')]=function(_0x4e4965,_0x29a8f5,_0x3b9bb2,_0x2d26c3,_0xa86ddf){return BPromise['resolve']()[_0x0e63('0xbf')](cmHopper[_0x0e63('0xca')](_0x4e4965,_0x29a8f5,_0x3b9bb2,_0x2d26c3))[_0x0e63('0xbc')](function(_0x46da56){_0xa86ddf[_0x0e63('0xcb')]-=_0x3b9bb2;_0xa86ddf[_0x0e63('0xcb')]=_0xa86ddf[_0x0e63('0xcb')]>0x0?_0xa86ddf[_0x0e63('0xcb')]:0x0;loggerCatch(_0x0e63('0xcc'))(_0x46da56);});};Dialer[_0x0e63('0x1c')]['getContactDialerIvr']=function(_0x4de256,_0x4786cf,_0x36be15,_0x57e765){return BPromise[_0x0e63('0xba')]()[_0x0e63('0xbf')](cmHopper[_0x0e63('0xcd')](_0x4de256,_0x4786cf,_0x36be15))[_0x0e63('0xbc')](function(_0x5ab22c){_0x57e765[_0x0e63('0xcb')]-=_0x4786cf;_0x57e765['temp']=_0x57e765[_0x0e63('0xcb')]>0x0?_0x57e765[_0x0e63('0xcb')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x5ab22c);});};Dialer[_0x0e63('0x1c')][_0x0e63('0xce')]=function(_0x5f567e){return BPromise['resolve']()[_0x0e63('0xbf')](voiceQueueRt[_0x0e63('0xce')](_0x5f567e))[_0x0e63('0xbc')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x0e63('0x1c')][_0x0e63('0xcf')]=function(_0xd06343){return BPromise[_0x0e63('0xba')]()[_0x0e63('0xbf')](cmHopper['moveContactManagedDialer'](_0xd06343))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xd0')));};Dialer['prototype'][_0x0e63('0xd1')]=function(_0x29e98e){return BPromise[_0x0e63('0xba')]()['then'](cmHopperHistory['createHistory'](_0x29e98e))['catch'](loggerCatch(_0x0e63('0xd2')));};Dialer[_0x0e63('0x1c')][_0x0e63('0xb6')]=function(_0x35585f){if(!_['isUndefined'](_0x35585f)&&_0x35585f!==null){if(typeof _0x35585f[_0x0e63('0x73')]!==_0x0e63('0x9b')){if(_0x35585f[_0x0e63('0x73')]>0x0){_0x35585f[_0x0e63('0x73')]-=0x1;}else{logger[_0x0e63('0x98')](_0x0e63('0xd3'));}}}else{logger[_0x0e63('0x98')](_0x0e63('0xd4'));}};Dialer[_0x0e63('0x1c')]['loggerHandler']=function(_0x6b1b79,_0x25b7c7){var _0x5c63e8=this;return function(_0x393862){_0x5c63e8[_0x0e63('0xb6')](_0x25b7c7);logger[_0x0e63('0x98')](_0x6b1b79,util['inspect'](_0x393862,{'showHidden':![],'depth':null}));};};Dialer[_0x0e63('0x1c')][_0x0e63('0xd5')]=function(_0x5d3008,_0x3ae203,_0xa3ee7c){var _0x29d2d6={'state':0x19,'statedesc':_0x0e63('0xd6')};this[_0x0e63('0xb6')](_0x3ae203);this[_0x0e63('0xd7')](_['merge'](_0x29d2d6,_[_0x0e63('0xd8')](_0xa3ee7c,[_0x0e63('0xd9'),_0x0e63('0xda'),'UserId',_0x0e63('0xdb'),_0x0e63('0xdc')])),_0x0e63('0xdd'),_0x0e63('0xde'));logger[_0x0e63('0x98')](_0x5d3008);};Dialer[_0x0e63('0x1c')][_0x0e63('0xdf')]=function(_0x9d785f){return _0x9d785f==='Success';};Dialer[_0x0e63('0x1c')]['isTrunkReachable']=function(_0xf23f02){return!_[_0x0e63('0x3f')](_0xf23f02)&&_0xf23f02&&!_[_0x0e63('0x3f')](_0xf23f02[_0x0e63('0x42')])&&!_[_0x0e63('0x3f')](_0xf23f02['active'])&&_0xf23f02[_0x0e63('0x78')]&&(this[_0x0e63('0x23')][util['format'](_0x0e63('0xe0'),_0xf23f02[_0x0e63('0x42')])][_0x0e63('0xb3')]===_0x0e63('0xe1')||this[_0x0e63('0x23')][util[_0x0e63('0x79')](_0x0e63('0xe0'),_0xf23f02[_0x0e63('0x42')])][_0x0e63('0xb3')]===_0x0e63('0xe2'));};Dialer['prototype']['saveInDb']=function(_0x2453d8,_0x5b6b6d,_0x3ece3a){this[_0x0e63('0xd1')](_0x2453d8)[_0x0e63('0xbc')](loggerCatch(_0x5b6b6d));this['moveContactManagedDialer'](_0x2453d8)[_0x0e63('0xbc')](loggerCatch(_0x3ece3a));};Dialer[_0x0e63('0x1c')]['syncVarSet']=function(_0x35ad57){var _0xf7fadf=this[_0x0e63('0x26')][_0x35ad57[_0x0e63('0xe3')]];var _0x27ef68;if(!_[_0x0e63('0xb1')](_0x35ad57)&&!_[_0x0e63('0xb1')](_0x35ad57[_0x0e63('0xe4')])&&!_[_0x0e63('0xb1')](_0x35ad57['variable'][_0x0e63('0xe5')])&&_0x35ad57['exten']==='xcally-motion-dialer'&&_0xf7fadf){if(_0xf7fadf[_0x0e63('0x4e')]!==_0x0e63('0x7b')&&this['voiceQueues'][_0xf7fadf[_0x0e63('0xb7')]]['dialAMDActive']&&_0x35ad57[_0x0e63('0xe6')]==='HANGUP'){delete this[_0x0e63('0x26')][_0x35ad57[_0x0e63('0xe3')]];this[_0x0e63('0xb6')](this['voiceQueues'][_0xf7fadf['queue']]);this[_0x0e63('0x21')][_0xf7fadf[_0x0e63('0xb7')]][_0x0e63('0x5e')]+=0x1;this[_0x0e63('0x21')][_0xf7fadf['queue']][_0x0e63('0x5d')]+=0x1;_0x27ef68=new Hangup(_0xf7fadf,_0x35ad57);_0x27ef68[_0x0e63('0xaa')]=0x12;_0x27ef68['statedesc']=_0x0e63('0xe7');_0x27ef68[_0x0e63('0xe8')]=_0x0e63('0xe9');ami[_0x0e63('0x4d')](_0x0e63('0xea'),ut['buildObj'](_0x27ef68,_0x0e63('0xeb')));this[_0x0e63('0xd7')](_0x27ef68,_0x0e63('0xec'),'[syncHangupInAMD]');}if(_0xf7fadf[_0x0e63('0x4e')]!==_0x0e63('0x7b')&&this[_0x0e63('0x21')][_0xf7fadf[_0x0e63('0xb7')]][_0x0e63('0xed')]&&_0x35ad57[_0x0e63('0xe6')]==='MACHINE'){var _0x102aa0=this;return new BPromise(function(_0x513a62,_0x1c8d4c){delete _0x102aa0[_0x0e63('0x26')][_0x35ad57[_0x0e63('0xe3')]];_0x102aa0['updateOriginated'](_0x102aa0[_0x0e63('0x21')][_0xf7fadf['queue']]);_0x102aa0[_0x0e63('0x21')][_0xf7fadf[_0x0e63('0xb7')]][_0x0e63('0x5e')]+=0x1;_0x102aa0['voiceQueues'][_0xf7fadf[_0x0e63('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1fce02=_0x102aa0['voiceQueues'][_0xf7fadf['queue']];var _0x3abd54=new Hangup(_0xf7fadf,_0x35ad57);_0x3abd54[_0x0e63('0xaa')]=0x13;_0x3abd54[_0x0e63('0xab')]=_0x0e63('0xee');_0x3abd54['membername']='AMD';_0x3abd54[_0x0e63('0xef')]+=0x1;_0x3abd54[_0x0e63('0xf0')]+=0x1;_0x3abd54[_0x0e63('0xeb')]=!![];ami[_0x0e63('0x4d')]('custom:amd',ut['buildObj'](_0x3abd54,'amd'));_0x102aa0[_0x0e63('0xd1')](_0x3abd54)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xf1')));if(_0x3abd54['countbusyretry']+_0x3abd54[_0x0e63('0xf2')]+_0x3abd54[_0x0e63('0xf3')]+_0x3abd54[_0x0e63('0xf4')]+_0x3abd54['countdropretry']+_0x3abd54['countabandonedretry']+_0x3abd54[_0x0e63('0xef')]+_0x3abd54[_0x0e63('0xf5')]>=_0x1fce02[_0x0e63('0xf6')]){_0x102aa0['stateGlobal'](_0x3abd54,_0x513a62,_0x1c8d4c,_0x0e63('0xf7'));}else{if(_0x3abd54[_0x0e63('0xef')]>=_0x1fce02['dialMachineMaxRetry']){_0x102aa0[_0x0e63('0xf8')](_0x3abd54,_0x513a62,_0x1c8d4c,_0x0e63('0xf9'));}else{_0x102aa0[_0x0e63('0xc6')]({'active':![],'countmachineretry':_0x3abd54['countmachineretry'],'scheduledat':moment()[_0x0e63('0xfa')](_0x1fce02[_0x0e63('0xfb')],_0x0e63('0xfc'))[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3abd54[_0x0e63('0xd9')],'ListId':_0x3abd54[_0x0e63('0xda')],'VoiceQueueId':_0x3abd54[_0x0e63('0xdb')]||undefined,'CampaignId':_0x3abd54['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x513a62({'reschedule':0x1});}}});}if(_0xf7fadf[_0x0e63('0x4e')]===_0x0e63('0x7b')&&this[_0x0e63('0x22')][_0xf7fadf['queue']][_0x0e63('0xed')]&&_0x35ad57[_0x0e63('0xe6')]===_0x0e63('0xfd')){delete this[_0x0e63('0x26')][_0x35ad57[_0x0e63('0xe3')]];this[_0x0e63('0xb6')](this[_0x0e63('0x22')][_0xf7fadf[_0x0e63('0xb7')]]);_0x27ef68=new Hangup(_0xf7fadf,_0x35ad57);_0x27ef68[_0x0e63('0xaa')]=0x12;_0x27ef68[_0x0e63('0xab')]=_0x0e63('0xe7');_0x27ef68[_0x0e63('0xe8')]=_0x0e63('0xe9');ami[_0x0e63('0x4d')](_0x0e63('0xea'),ut[_0x0e63('0xfe')](_0x27ef68,_0x0e63('0xeb')));this['saveInDb'](_0x27ef68,'[syncHangupInAMDIvr][createHistory]',_0x0e63('0xff'));}if(_0xf7fadf[_0x0e63('0x4e')]===_0x0e63('0x7b')&&this[_0x0e63('0x22')][_0xf7fadf[_0x0e63('0xb7')]][_0x0e63('0xed')]&&_0x35ad57['value']===_0x0e63('0x100')){var _0x102aa0=this;return new BPromise(function(_0x3593f3,_0x5363f2){delete _0x102aa0[_0x0e63('0x26')][_0x35ad57[_0x0e63('0xe3')]];_0x102aa0[_0x0e63('0xb6')](_0x102aa0[_0x0e63('0x22')][_0xf7fadf['queue']]);_0x102aa0[_0x0e63('0x22')][_0xf7fadf[_0x0e63('0xb7')]][_0x0e63('0x5e')]+=0x1;_0x102aa0[_0x0e63('0x22')][_0xf7fadf[_0x0e63('0xb7')]][_0x0e63('0x5d')]+=0x1;var _0x3b561d=_0x102aa0['campaigns'][_0xf7fadf['queue']];var _0x5a22f9=new Hangup(_0xf7fadf,_0x35ad57);_0x5a22f9[_0x0e63('0xaa')]=0x13;_0x5a22f9[_0x0e63('0xab')]=_0x0e63('0xee');_0x5a22f9['membername']=_0x0e63('0xe9');_0x5a22f9[_0x0e63('0xef')]+=0x1;_0x5a22f9[_0x0e63('0xf0')]+=0x1;_0x5a22f9[_0x0e63('0xeb')]=!![];ami[_0x0e63('0x4d')]('custom:amd',ut['buildObj'](_0x5a22f9,_0x0e63('0xeb')));_0x102aa0[_0x0e63('0xd1')](_0x5a22f9)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xf1')));if(_0x5a22f9[_0x0e63('0x101')]+_0x5a22f9[_0x0e63('0xf2')]+_0x5a22f9['countnoanswerretry']+_0x5a22f9['countnosuchnumberretry']+_0x5a22f9['countdropretry']+_0x5a22f9['countabandonedretry']+_0x5a22f9[_0x0e63('0xef')]+_0x5a22f9[_0x0e63('0xf5')]>=_0x3b561d[_0x0e63('0xf6')]){_0x102aa0[_0x0e63('0x102')](_0x5a22f9,_0x3593f3,_0x5363f2,_0x0e63('0xf7'));}else{if(_0x5a22f9[_0x0e63('0xef')]>=_0x3b561d[_0x0e63('0x103')]){_0x102aa0[_0x0e63('0xf8')](_0x5a22f9,_0x3593f3,_0x5363f2,'reason\x2019\x20machine....');}else{_0x102aa0[_0x0e63('0xc6')]({'active':![],'countmachineretry':_0x5a22f9[_0x0e63('0xef')],'scheduledat':moment()[_0x0e63('0xfa')](_0x3b561d[_0x0e63('0xfb')],'minutes')[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x5a22f9[_0x0e63('0xd9')],'ListId':_0x5a22f9[_0x0e63('0xda')],'VoiceQueueId':_0x5a22f9[_0x0e63('0xdb')]||undefined,'CampaignId':_0x5a22f9[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x105')));_0x3593f3({'reschedule':0x1});}}});}}};Dialer[_0x0e63('0x1c')]['syncHangup']=function(_0x4d1d23){var _0x21f4ef=this[_0x0e63('0x26')][_0x4d1d23['uniqueid']];var _0x2527ca=this;var _0x1bcf2e;if(_0x21f4ef&&_0x21f4ef[_0x0e63('0x4e')]===_0x0e63('0x7b')){delete this['uniqueId'][_0x4d1d23[_0x0e63('0xe3')]];this['updateOriginated'](this[_0x0e63('0x22')][_0x21f4ef[_0x0e63('0xb7')]]);this['campaigns'][_0x21f4ef[_0x0e63('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0x1bcf2e=new Hangup(_0x21f4ef,_0x4d1d23);this['createHistory'](_0x1bcf2e)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x106')));this['moveContactManagedDialer'](_0x1bcf2e)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x107')));}if(_0x21f4ef&&_0x21f4ef[_0x0e63('0x4e')]!=='ivr'&&isNotNull(this[_0x0e63('0x21')][_0x21f4ef[_0x0e63('0xb7')]]['dialQueueProject'])){delete this[_0x0e63('0x26')][_0x4d1d23[_0x0e63('0xe3')]];this[_0x0e63('0xb6')](this[_0x0e63('0x21')][_0x21f4ef[_0x0e63('0xb7')]]);this['voiceQueues'][_0x21f4ef['queue']][_0x0e63('0x5e')]+=0x1;this[_0x0e63('0x21')][_0x21f4ef[_0x0e63('0xb7')]][_0x0e63('0x5d')]+=0x1;_0x1bcf2e=new Hangup(_0x21f4ef,_0x4d1d23);_0x1bcf2e[_0x0e63('0xaa')]=0x10;_0x1bcf2e[_0x0e63('0xab')]=_0x0e63('0x108');_0x1bcf2e['membername']=_0x0e63('0x109');this[_0x0e63('0xd1')](_0x1bcf2e)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0e63('0xcf')](_0x1bcf2e)['catch'](loggerCatch(_0x0e63('0x107')));}if(_0x21f4ef&&_0x21f4ef[_0x0e63('0x4e')]!=='ivr'&&!isNotNull(this[_0x0e63('0x21')][_0x21f4ef['queue']][_0x0e63('0x10a')])){delete this[_0x0e63('0x26')][_0x4d1d23['uniqueid']];this[_0x0e63('0xb6')](this['voiceQueues'][_0x21f4ef[_0x0e63('0xb7')]]);this[_0x0e63('0x21')][_0x21f4ef[_0x0e63('0xb7')]][_0x0e63('0x10b')]+=0x1;_0x1bcf2e=new Hangup(_0x21f4ef,_0x4d1d23);_0x1bcf2e[_0x0e63('0xaa')]=0xc;_0x1bcf2e[_0x0e63('0xab')]=_0x4d1d23[_0x0e63('0x10c')];_0x1bcf2e[_0x0e63('0xe8')]='Unknow';this[_0x0e63('0xd1')](_0x1bcf2e)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0e63('0xcf')](_0x1bcf2e)['catch'](loggerCatch(_0x0e63('0x107')));}};Dialer['prototype'][_0x0e63('0x33')]=function(_0x2dafc1){var _0xa72545=this[_0x0e63('0x26')][_0x2dafc1[_0x0e63('0xe3')]];var _0x5117b0=this;if(this[_0x0e63('0x21')][_0x2dafc1[_0x0e63('0xb7')]]){if(_0xa72545&&_0xa72545[_0x0e63('0x4e')]!==_0x0e63('0x7b')){delete this['uniqueId'][_0x2dafc1[_0x0e63('0xe3')]];this[_0x0e63('0x21')][_0x2dafc1[_0x0e63('0xb7')]][_0x0e63('0x5e')]+=0x1;var _0x44c9e6=new AgentComplete(_0xa72545,_0x2dafc1);if(_0x2dafc1[_0x0e63('0x10d')]===_0x0e63('0x10e')){_0x44c9e6[_0x0e63('0x10f')]=this[_0x0e63('0x21')][_0x2dafc1['queue']][_0x0e63('0x110')]&&this['voiceQueues'][_0x2dafc1[_0x0e63('0xb7')]][_0x0e63('0x111')]?moment()[_0x0e63('0x79')](_0x0e63('0x104')):undefined;}this['createHistory'](_0x44c9e6)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x112')));this['moveContactManagedDialer'](_0x44c9e6)[_0x0e63('0xbc')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x0e63('0x1c')][_0x0e63('0x2d')]=function(_0x41034b){if(this[_0x0e63('0x21')][_0x41034b[_0x0e63('0xb7')]]){if(this['uniqueId'][_0x41034b[_0x0e63('0xe3')]]&&this['uniqueId'][_0x41034b['uniqueid']][_0x0e63('0x4e')]!==_0x0e63('0x7b')){this['updateOriginated'](this[_0x0e63('0x21')][_0x41034b[_0x0e63('0xb7')]]);this[_0x0e63('0x26')][_0x41034b[_0x0e63('0xe3')]][_0x0e63('0x113')]=moment()[_0x0e63('0x79')](_0x0e63('0x104'));}}};Dialer[_0x0e63('0x1c')]['queueCallerAbandonCreateState']=function(_0x308514){this[_0x0e63('0xd1')](_0x308514)['catch'](loggerCatch(_0x0e63('0x112')));this[_0x0e63('0xcf')](_0x308514)[_0x0e63('0xbc')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x0e63('0x1c')]['syncQueueCallerAbandon']=function(_0xce2407){var _0x2d5b8f=this[_0x0e63('0x26')][_0xce2407[_0x0e63('0xe3')]];var _0x4137c2=this;if(this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]]){if(_0x2d5b8f&&_0x2d5b8f[_0x0e63('0x4e')]!==_0x0e63('0x7b')){delete this['uniqueId'][_0xce2407[_0x0e63('0xe3')]];this[_0x0e63('0xb6')](this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]]);_0x2d5b8f[_0x0e63('0x114')]=moment()[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x6f4a1e=new QueueCallerAbandon(_0x2d5b8f,_0xce2407);if(getSeconds(_0x2d5b8f[_0x0e63('0x114')],_0x2d5b8f[_0x0e63('0x115')])>=_0x2d5b8f[_0x0e63('0x116')]){this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]][_0x0e63('0x83')]+=0x1;this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]][_0x0e63('0x63')]+=0x1;this['voiceQueues'][_0xce2407['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x6f4a1e[_0x0e63('0xaa')]=0xa;_0x6f4a1e['statedesc']=_0x0e63('0x117');_0x6f4a1e[_0x0e63('0x118')]=_0x0e63('0x119');_0x6f4a1e[_0x0e63('0x10f')]=this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]][_0x0e63('0x110')]?moment()[_0x0e63('0x79')](_0x0e63('0x104')):undefined;_0x6f4a1e['countdropretry']+=0x1;_0x6f4a1e[_0x0e63('0xf0')]+=0x1;if(_0x6f4a1e[_0x0e63('0x11a')]>=this[_0x0e63('0x21')][_0xce2407['queue']][_0x0e63('0x11b')]){this['queueCallerAbandonCreateState'](_0x6f4a1e);}else{this[_0x0e63('0xc6')]({'active':![],'countdropretry':_0x6f4a1e[_0x0e63('0x11a')],'scheduledat':moment()['add'](this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]]['dialDropRetryFrequency'],'minutes')[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x2d5b8f[_0x0e63('0xd9')],'ListId':_0x2d5b8f[_0x0e63('0xda')],'VoiceQueueId':_0x2d5b8f['VoiceQueueId']||undefined,'CampaignId':_0x2d5b8f[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x11c')));var _0x56e702=new History(_0x6f4a1e);_0x56e702[_0x0e63('0xaa')]=0xa;_0x56e702[_0x0e63('0xab')]='Drop';_0x56e702['starttime']=moment()[_0x0e63('0x79')](_0x0e63('0x104'));_0x56e702[_0x0e63('0xac')]=_0x56e702[_0x0e63('0x11d')];_0x56e702[_0x0e63('0x11e')]=_0x6f4a1e[_0x0e63('0x11e')];_0x56e702[_0x0e63('0x11f')]=_0x6f4a1e['calleridnum'];this['createHistory'](_0x56e702)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x120')));}}else{this[_0x0e63('0x21')][_0xce2407['queue']][_0x0e63('0x6c')]+=0x1;this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0x6f4a1e[_0x0e63('0xaa')]=0xb;_0x6f4a1e[_0x0e63('0xab')]=_0x0e63('0x121');_0x6f4a1e[_0x0e63('0x118')]='CALLEREXIT';_0x6f4a1e[_0x0e63('0x122')]+=0x1;_0x6f4a1e[_0x0e63('0xf0')]+=0x1;if(_0x6f4a1e[_0x0e63('0x122')]>=this[_0x0e63('0x21')][_0xce2407[_0x0e63('0xb7')]]['dialAbandonedMaxRetry']){this[_0x0e63('0x123')](_0x6f4a1e);}else{this[_0x0e63('0xc6')]({'active':![],'countabandonedretry':_0x6f4a1e['countabandonedretry'],'scheduledat':moment()[_0x0e63('0xfa')](this[_0x0e63('0x21')][_0xce2407['queue']][_0x0e63('0x124')],_0x0e63('0xfc'))[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x2d5b8f[_0x0e63('0xd9')],'ListId':_0x2d5b8f[_0x0e63('0xda')],'VoiceQueueId':_0x2d5b8f[_0x0e63('0xdb')]||undefined,'CampaignId':_0x2d5b8f[_0x0e63('0xdc')]||undefined})['catch'](loggerCatch(_0x0e63('0x125')));var _0x56e702=new History(_0x6f4a1e);_0x56e702[_0x0e63('0xaa')]=0xb;_0x56e702[_0x0e63('0xab')]='Abandoned';_0x56e702[_0x0e63('0x11d')]=moment()[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x56e702['endtime']=_0x56e702['starttime'];_0x56e702[_0x0e63('0x11e')]=_0x6f4a1e[_0x0e63('0x11e')];_0x56e702[_0x0e63('0x11f')]=_0x6f4a1e['calleridnum'];this[_0x0e63('0xd1')](_0x56e702)[_0x0e63('0xbc')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x0e63('0x1c')][_0x0e63('0x38')]=function(_0x2dc159){if(this[_0x0e63('0xaf')][_0x2dc159[_0x0e63('0xe3')]]){this[_0x0e63('0xaf')][_0x2dc159['uniqueid']][_0x0e63('0xb4')]=_0x2dc159[_0x0e63('0xb4')];}if(this[_0x0e63('0x26')][_0x2dc159[_0x0e63('0xe3')]]){this[_0x0e63('0x26')][_0x2dc159[_0x0e63('0xe3')]][_0x0e63('0xb4')]=_0x2dc159[_0x0e63('0xb4')];}};Dialer[_0x0e63('0x1c')][_0x0e63('0x126')]=function(_0x30b593){if(strategy[this[_0x0e63('0x21')][this[_0x0e63('0xaf')][_0x30b593[_0x0e63('0x127')]][_0x0e63('0xb7')]][_0x0e63('0x128')]]===_0x0e63('0x1b')){if(this['actions'][_0x30b593['actionid']]&&_['isNil'](this[_0x0e63('0xaf')][_0x30b593[_0x0e63('0x127')]][_0x0e63('0x129')])&&_0x30b593[_0x0e63('0xb3')]==='1'&&_0x30b593[_0x0e63('0x12a')]==='0'){if(this[_0x0e63('0x12b')][_0x30b593['stateinterface']]){if(!this[_0x0e63('0x12b')][_0x30b593[_0x0e63('0x12c')]][_0x0e63('0x129')]){this[_0x0e63('0x12b')][_0x30b593[_0x0e63('0x12c')]][_0x0e63('0x129')]=!![];this[_0x0e63('0xaf')][_0x30b593[_0x0e63('0x127')]]['locked']=!![];this[_0x0e63('0xaf')][_0x30b593['actionid']][_0x0e63('0x12c')]=_0x30b593[_0x0e63('0x12c')];}}}}else if((strategy[this[_0x0e63('0x21')][this[_0x0e63('0xaf')][_0x30b593[_0x0e63('0x127')]][_0x0e63('0xb7')]][_0x0e63('0x128')]]||'rrmemory')===_0x0e63('0x12d')){if(this['actions'][_0x30b593[_0x0e63('0x127')]]){if(this['agents'][_0x30b593['stateinterface']]){this['actions'][_0x30b593[_0x0e63('0x127')]]['stateinterface']=_0x30b593[_0x0e63('0x12c')];if(_[_0x0e63('0xb1')](this[_0x0e63('0x12e')][this[_0x0e63('0xaf')][_0x30b593[_0x0e63('0x127')]][_0x0e63('0xb7')]])){this[_0x0e63('0x12e')][this['actions'][_0x30b593['actionid']][_0x0e63('0xb7')]]=[];}this['queueBooked'][this[_0x0e63('0xaf')][_0x30b593[_0x0e63('0x127')]][_0x0e63('0xb7')]][_0x0e63('0x12f')](_[_0x0e63('0x90')](_[_0x0e63('0xd8')](this['actions'][_0x30b593[_0x0e63('0x127')]],['idHopper',_0x0e63('0x12c')]),{'status':_0x30b593[_0x0e63('0xb3')],'paused':_0x30b593['paused']}));}}}};function unlockQueueStatus(_0x1f061d,_0x3d437c){setTimeout(function(){if(_[_0x0e63('0x3f')](_0x1f061d[_0x0e63('0x130')])){loggerBooked[_0x0e63('0x98')](_0x0e63('0x131'),_0x3d437c);}_0x1f061d[_0x0e63('0x130')]=!![];loggerBooked[_0x0e63('0x7f')](_0x0e63('0x132'),_0x3d437c,JSON['stringify'](_[_0x0e63('0xd8')](_0x1f061d,[_0x0e63('0x42'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x0e63('0x1c')][_0x0e63('0x3c')]=function(_0x36f83f){var _0x431f44=this;var _0x53a5da=_0x431f44[_0x0e63('0x21')][_0x431f44[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]];if(strategy[this[_0x0e63('0x21')][this[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]][_0x0e63('0x128')]]===_0x0e63('0x1b')){if(this['actions'][_0x36f83f[_0x0e63('0x127')]]&&this[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0x12c')]){this[_0x0e63('0x20')][_0x0e63('0x133')](this[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0x134')],this['actions'][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0x12c')])[_0x0e63('0xbc')](function(_0x234e18){logger['error'](_0x0e63('0x135'),util[_0x0e63('0x99')](_0x234e18,{'showHidden':![],'depth':null}));})[_0x0e63('0x136')](function(){_0x431f44[_0x0e63('0xb6')](_0x431f44[_0x0e63('0x21')][_0x431f44[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]]);_0x431f44[_0x0e63('0x12b')][_0x431f44[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0x12c')]][_0x0e63('0x129')]=![];delete _0x431f44[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]];unlockQueueStatus(_0x53a5da);});}else{this['updateOriginated'](this['voiceQueues'][this[_0x0e63('0xaf')][_0x36f83f['actionid']][_0x0e63('0xb7')]]);this[_0x0e63('0xc6')]({'active':![],'ContactId':this[_0x0e63('0xaf')][_0x36f83f['actionid']]['ContactId'],'ListId':this['actions'][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xda')],'VoiceQueueId':this[_0x0e63('0xaf')][_0x36f83f['actionid']][_0x0e63('0xdb')]||undefined,'CampaignId':this['actions'][_0x36f83f['actionid']][_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x137')));delete this[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]];unlockQueueStatus(_0x53a5da);}}else if((strategy[this[_0x0e63('0x21')][this['actions'][_0x36f83f['actionid']][_0x0e63('0xb7')]][_0x0e63('0x128')]]||_0x0e63('0x12d'))===_0x0e63('0x12d')){var _0x1631a2;if(this['actions'][_0x36f83f[_0x0e63('0x127')]]&&!_[_0x0e63('0x49')](this[_0x0e63('0x12e')][this[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]])){if(this['queueBookedRR'][_0x431f44[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]]){this[_0x0e63('0x2b')][_0x431f44['actions'][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]]=this['queueBookedRR'][this['actions'][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]]?this[_0x0e63('0x2b')][this[_0x0e63('0xaf')][_0x36f83f['actionid']][_0x0e63('0xb7')]]:this['queueBooked'][this['actions'][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]]?this[_0x0e63('0x12e')][this[_0x0e63('0xaf')][_0x36f83f['actionid']]['queue']][_0x0e63('0x138')]||0x0:0x0;}this[_0x0e63('0x12e')][this[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]][_0x0e63('0xb7')]][_0x0e63('0x138')]=this[_0x0e63('0x2b')][this[_0x0e63('0xaf')][_0x36f83f[_0x0e63('0x127')]]['queue']];for(var _0x3c492f=0x0;_0x3c492f=0x0;})[_0x0e63('0xbc')](myreject(_0x5dbacc)));}}else{_0x37c9c3['push'](ami['Action']({'action':'command','command':util[_0x0e63('0x79')](_0x0e63('0x152'),_0x550e8f,!_['isUndefined'](config[_0x0e63('0x14b')][_0xed36c1])?_0xed36c1:'')})[_0x0e63('0xbf')](function(_0xf94c2a){return _0xf94c2a['content'][_0x0e63('0x150')](_0x0e63('0x151'))>=0x0;})['catch'](myreject(_0x5dbacc)));}BPromise[_0x0e63('0x153')](_0x37c9c3)[_0x0e63('0xbf')](function(_0x5dd756){var _0x161168=_['some'](_0x5dd756);if(_0x161168){return _0x1bbc67(_0x161168);}else{_0x3c37af[_0x0e63('0x40')]=_0x5e7544?_0x0e63('0x154'):_0x0e63('0x155');return _0x5dbacc(msgResponse(_0x0e63('0x156'),_0x0e63('0x147'),_0x0e63('0x157')+_0x5e7544+'\x20'+_0x4eaa26+_0x0e63('0x158')+util[_0x0e63('0x99')](_0x550e8f,{'showHidden':![],'depth':null})+_0x0e63('0x159')+_0xed36c1));}})[_0x0e63('0xbc')](function(_0x1a3d1f){return _0x5dbacc(msgResponse(_0x0e63('0x146'),_0x0e63('0x147'),JSON[_0x0e63('0x4b')](_0x1a3d1f)));});});};Dialer[_0x0e63('0x1c')][_0x0e63('0x15a')]=function(_0x3c2303){var _0x368a4b=this;return function(){switch(_0x3c2303[_0x0e63('0x15b')]){case _0x0e63('0x15c'):freeVariablesPredictive(_0x3c2303);_0x368a4b[_0x0e63('0x15d')](_0x3c2303,0x1);break;case _0x0e63('0x15e'):freeVariablesPredictive(_0x3c2303);_0x368a4b[_0x0e63('0x15d')](_0x3c2303,_0x3c2303[_0x0e63('0x15f')]);break;case'predictive':_0x368a4b['predictive'](_0x3c2303);break;case _0x0e63('0x8'):freeVariablesPredictive(_0x3c2303);_0x368a4b[_0x0e63('0x15d')](_0x3c2303,0x1);break;default:freeVariablesPredictive(_0x3c2303);logger[_0x0e63('0x98')](_0x0e63('0x160'),_0x3c2303[_0x0e63('0x42')],'method\x20not\x20recognized');}};};Dialer[_0x0e63('0x1c')][_0x0e63('0x161')]=function(_0x43b706){var _0x74e2e1=this;return function(){_0x74e2e1[_0x0e63('0x162')](_0x43b706);};};Dialer[_0x0e63('0x1c')][_0x0e63('0xa')]=function(_0x42eca2){var _0x5591a4=this;if(isNotPreview(_0x42eca2['dialMethod'])){if(isVoiceQueueOutbound(_0x42eca2[_0x0e63('0x4e')])&&isActive(_0x42eca2[_0x0e63('0x163')])){_0x42eca2[_0x0e63('0xa4')]=!![];BPromise['resolve']()[_0x0e63('0xbf')](checkIsLoggedIn(_0x42eca2,_0x42eca2['loggedIn']))[_0x0e63('0xbf')](checkIsActive(_0x42eca2,_0x42eca2[_0x0e63('0x163')]))[_0x0e63('0xbf')](checkInterval(_0x42eca2))[_0x0e63('0xbf')](_0x5591a4['checkIsTrunkReachable'](_0x42eca2))['then'](_0x5591a4['checkIfTime'](_0x42eca2[_0x0e63('0x164')],_0x42eca2[_0x0e63('0x165')],_0x42eca2['name'],_0x42eca2))['then'](_0x5591a4[_0x0e63('0x166')](_0x42eca2[_0x0e63('0x45')],_0x42eca2[_0x0e63('0x165')],_0x42eca2[_0x0e63('0x42')],_0x42eca2))[_0x0e63('0xbf')](_0x5591a4['checkDialMethod'](_0x42eca2))[_0x0e63('0xbc')](loggerCatchQueueSummary(_0x0e63('0x167'),_0x42eca2));}else{notSendMessagesQueue(_0x42eca2);}}else{freeVariablesPredictive(_0x42eca2);}};Dialer[_0x0e63('0x1c')][_0x0e63('0x168')]=function(){var _0xac82fd=this;var _0x3a396e;for(var _0x19cc66 in this[_0x0e63('0x22')]){if(typeof this['campaigns'][_0x19cc66]!==_0x0e63('0x9b')){_0x3a396e=this['campaigns'][_0x19cc66];if(isCampaignIvr(_0x3a396e[_0x0e63('0x4e')])&&isActive(_0x3a396e[_0x0e63('0x78')])){_0x3a396e[_0x0e63('0xa4')]=!![];BPromise[_0x0e63('0xba')]()[_0x0e63('0xbf')](checkIsActive(_0x3a396e,_0x3a396e['active']))[_0x0e63('0xbf')](checkInterval(_0x3a396e))[_0x0e63('0xbf')](_0xac82fd[_0x0e63('0x169')](_0x3a396e))[_0x0e63('0xbf')](_0xac82fd['checkIfTime'](_0x3a396e[_0x0e63('0x164')],_0x3a396e['dialTimezone'],_0x3a396e['name'],_0x3a396e))[_0x0e63('0xbf')](_0xac82fd[_0x0e63('0x166')](_0x3a396e[_0x0e63('0x45')],_0x3a396e[_0x0e63('0x165')],_0x3a396e['name'],_0x3a396e))[_0x0e63('0xbf')](_0xac82fd[_0x0e63('0x161')](_0x3a396e))[_0x0e63('0xbc')](loggerCatchQueueSummary(_0x0e63('0x16a'),_0x3a396e));}else{notSendMessagesCampaign(_0x3a396e);}}}};function getCallerIdRandom(_0x5a653f,_0x29f280){var _0x1c4ebd;var _0x162d9a;var _0x4c69eb;if(_0x29f280<=0x0){_0x29f280=0x1;}_0x1c4ebd=new RegExp(_0x0e63('0x16b')+_0x29f280+'}$');_0x162d9a=Math[_0x0e63('0x16c')](0xa,_0x29f280-0x1);_0x4c69eb=Math['pow'](0xa,_0x29f280)-0x1;return util[_0x0e63('0x79')]('%s',_[_0x0e63('0x16d')](_0x5a653f,_0x1c4ebd,_['random'](_0x162d9a,_0x4c69eb)));}function extractCalleridName(_0x5dba33){var _0x4a8dee=_0x5dba33[_0x0e63('0x16e')](/"(.*?)"/);return _0x4a8dee?_0x4a8dee[0x1]:_0x5dba33;}function extractCalleridNumber(_0x376cc2){var _0x164777=_0x376cc2[_0x0e63('0x16e')](/<(.*?)>/);return _0x164777?_0x164777[0x1]:_0x376cc2;}Dialer['prototype'][_0x0e63('0x16f')]=function(_0x3de56e,_0x3f2518){var _0x17914b=this;var _0xc694db=uuid['v4']();this['actions'][_0xc694db]=new Action(_0x3de56e,_0x3f2518,_0xc694db);return new BPromise(function(_0x50b5e8,_0x54fc98){if(_[_0x0e63('0x3f')](_0x3de56e)&&typeof _0x3de56e!==_0x0e63('0x170')){return _0x54fc98(msgResponse(_0x0e63('0x171'),'Failure',_0x0e63('0x172')));}if(_[_0x0e63('0x3f')](_0x3f2518[_0x0e63('0x173')][_0x0e63('0x174')])||_0x3f2518[_0x0e63('0x173')][_0x0e63('0x174')]===null){return _0x54fc98(msgResponse(_0x0e63('0x171'),_0x0e63('0x147'),_0x0e63('0x175')));}var _0x33583b={'XMD-CALLERID':_0x17914b[_0x0e63('0xaf')][_0xc694db][_0x0e63('0x176')](),'XMD-AGI':_0x3de56e[_0x0e63('0x10a')]?util[_0x0e63('0x79')](_0x0e63('0x177'),ipAgi,_0x3de56e[_0x0e63('0x10a')]):'NONE','XMD-AGIAFTER':_0x3de56e[_0x0e63('0x110')]?util[_0x0e63('0x79')](_0x0e63('0x177'),ipAgi,_0x3de56e[_0x0e63('0x110')]):_0x0e63('0x178'),'XMD-QUEUE':_0x3de56e[_0x0e63('0x4e')]==='outbound'?util[_0x0e63('0x79')]('\x22%s,%s%s,,,%s\x22',_0x3de56e['name'],_0x3de56e[_0x0e63('0x179')]||'',_0x3de56e['dialAgiAfterHangupAgent']?'c':'',_0x3de56e[_0x0e63('0x116')]||0x3):_0x0e63('0x178'),'XMD-CONTACTID':_0x3f2518[_0x0e63('0xd9')],'XMD-CDRTYPE':_0x0e63('0x17a'),'CALLERID(all)':_0x17914b[_0x0e63('0xaf')][_0xc694db][_0x0e63('0x176')](),'XMD-AMD':_0x3de56e[_0x0e63('0xed')]?'ACTIVE':_0x0e63('0x178'),'XMD-DESTINATION':_0x0e63('0x17b')};if(_0x3de56e[_0x0e63('0xed')]){_0x33583b[_0x0e63('0x17c')]=_0x3de56e['dialAMDInitialSilence']||0x9c4;_0x33583b[_0x0e63('0x17d')]=_0x3de56e[_0x0e63('0x17e')]||0x5dc;_0x33583b['XMD-AMDAFTERGREETINGSILENCE']=_0x3de56e[_0x0e63('0x17f')]||0x320;_0x33583b['XMD-AMDTOTALANALYSISTIME']=_0x3de56e[_0x0e63('0x180')]||0x1388;_0x33583b['XMD-AMDMINWORDLENGTH']=_0x3de56e[_0x0e63('0x181')]||0x64;_0x33583b[_0x0e63('0x182')]=_0x3de56e[_0x0e63('0x183')]||0x32;_0x33583b[_0x0e63('0x184')]=_0x3de56e[_0x0e63('0x185')]||0x3;_0x33583b[_0x0e63('0x186')]=_0x3de56e[_0x0e63('0x187')]||0x100;_0x33583b[_0x0e63('0x188')]=_0x3de56e[_0x0e63('0x189')]||0x1388;}if(_0x3de56e[_0x0e63('0x4e')]===_0x0e63('0x18a')){_0x33583b[_0x0e63('0x18b')]=_0x3f2518[_0x0e63('0xdb')];}else{_0x33583b['XMD-CAMPAIGNID']=_0x3f2518['CampaignId'];}for(var _0x2490dd in _0x3f2518[_0x0e63('0x173')]){if(typeof _0x3f2518[_0x0e63('0x173')][_0x2490dd]!==_0x0e63('0x9b')){if(isNotNull(_0x3f2518[_0x0e63('0x173')][_0x2490dd])&&_0x2490dd!=='id'&&_0x2490dd!==_0x0e63('0x18c')&&_0x2490dd!==_0x0e63('0x18d')&&_0x2490dd!=='updatedAt'){_0x33583b[util[_0x0e63('0x79')](_0x0e63('0x18e'),_0x0e63('0x18f'),_[_0x0e63('0x190')](_0x2490dd))]=_0x3f2518[_0x0e63('0x173')][_0x2490dd];}}}var _0x25b134=_0x17914b['isTrunkReachable'](_0x3de56e[_0x0e63('0x77')])?getCallerId(_0x3de56e[_0x0e63('0x77')][_0x0e63('0x191')],_0x3de56e[_0x0e63('0x5a')],_0x3de56e[_0x0e63('0x192')]>0x0?getCallerIdRandom(_0x3de56e[_0x0e63('0x193')],_0x3de56e[_0x0e63('0x192')]):_0x3de56e[_0x0e63('0x193')]):getCallerId(_[_0x0e63('0xb1')](_0x3de56e[_0x0e63('0x194')])?_0x3de56e[_0x0e63('0x77')]['callerid']:_0x3de56e[_0x0e63('0x194')][_0x0e63('0x191')],_0x3de56e[_0x0e63('0x5a')],_0x3de56e['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3de56e[_0x0e63('0x193')],_0x3de56e[_0x0e63('0x192')]):_0x3de56e[_0x0e63('0x193')]);if(_0x25b134){_0x33583b['XMD-ORIGINATECALLERIDNAME']=_0x17914b[_0x0e63('0xaf')][_0xc694db][_0x0e63('0x195')]=extractCalleridName(_0x25b134);_0x33583b[_0x0e63('0x196')]=_0x17914b['actions'][_0xc694db][_0x0e63('0x197')]=extractCalleridNumber(_0x25b134);}return ami[_0x0e63('0xb2')]({'actionid':_0xc694db,'action':'originate','channel':_0x17914b[_0x0e63('0x143')](_0x3de56e[_0x0e63('0x77')])?util[_0x0e63('0x79')](_0x0e63('0x198'),_0x3de56e[_0x0e63('0x77')]['name'],isNotNull(_0x3de56e[_0x0e63('0x5c')])?_0x3de56e[_0x0e63('0x5c')][_0x0e63('0x199')]()||'':'',_0x3de56e[_0x0e63('0x19a')]>0x0?_0x3f2518['Contact'][_0x0e63('0x174')][_0x0e63('0x19b')](_0x3de56e[_0x0e63('0x19a')]):_0x3f2518[_0x0e63('0x173')][_0x0e63('0x174')]):util[_0x0e63('0x79')](_0x0e63('0x198'),_['isNil'](_0x3de56e['TrunkBackup'])?_0x3de56e[_0x0e63('0x77')][_0x0e63('0x42')]:_0x3de56e['TrunkBackup'][_0x0e63('0x42')],isNotNull(_0x3de56e[_0x0e63('0x5c')])?_0x3de56e[_0x0e63('0x5c')]['trim']()||'':'',_0x3de56e[_0x0e63('0x19a')]>0x0?_0x3f2518['Contact'][_0x0e63('0x174')][_0x0e63('0x19b')](_0x3de56e[_0x0e63('0x19a')]):_0x3f2518['Contact'][_0x0e63('0x174')]),'callerid':_0x25b134,'Exten':_0x0e63('0x17b'),'Context':'from-sip','Priority':'1','variable':_0x33583b,'timeout':(_0x3de56e['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xc694db})[_0x0e63('0xbf')](function(_0x280407){return _0x50b5e8(_0x280407);})['catch'](function(_0xa8abd5){_0x3de56e[_0x0e63('0x66')]+=0x1;var _0x21fa8a=new History(_0x17914b[_0x0e63('0xaf')][_0xc694db]);logger[_0x0e63('0x98')](util[_0x0e63('0x79')](_0x0e63('0x19c'),JSON[_0x0e63('0x4b')](_0xa8abd5)));_0x21fa8a[_0x0e63('0xaa')]=0xe;_0x21fa8a[_0x0e63('0xab')]=_0x0e63('0x19d');_0x21fa8a[_0x0e63('0x11d')]=moment()[_0x0e63('0x79')](_0x0e63('0x104'));_0x21fa8a['endtime']=_0x21fa8a['starttime'];_0x17914b[_0x0e63('0xd1')](_0x21fa8a)['catch'](loggerCatch(_0x0e63('0x19e')));_0x17914b[_0x0e63('0xcf')](_0x21fa8a)[_0x0e63('0xbc')](loggerCatch('[originate][error]'))[_0x0e63('0x136')](function(){delete _0x17914b[_0x0e63('0xaf')][_0xc694db];return _0x54fc98(msgResponse('originate','Error',_0x0e63('0x19f')));});});});};Dialer[_0x0e63('0x1c')][_0x0e63('0x31')]=function(_0x2f9465){var _0x57350e=this[_0x0e63('0xaf')][_0x2f9465[_0x0e63('0x127')]];if(_0x57350e){delete this[_0x0e63('0xaf')][_0x2f9465[_0x0e63('0x127')]];_0x57350e[_0x0e63('0x115')]=moment()[_0x0e63('0x79')](_0x0e63('0x104'));var _0x14715b=_0x57350e[_0x0e63('0x4e')]==='ivr'?this[_0x0e63('0x22')][_0x57350e['queue']]:this[_0x0e63('0x21')][_0x57350e[_0x0e63('0x1a0')]()];if(!this['isSuccess'](_0x2f9465[_0x0e63('0x1a1')])){this[_0x0e63('0xb6')](_0x14715b);return this[_0x0e63('0x1a2')](_0x57350e,_0x14715b,_0x2f9465)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1a3')));}this[_0x0e63('0x26')][_0x2f9465['uniqueid']]=_0x57350e;}};Dialer['prototype']['checkRetriveMax']=function(_0x1385b2,_0x353bba,_0x10bd41){var _0x84bcf0=new History(_0x353bba);if(_0x84bcf0[_0x0e63('0x101')]+_0x84bcf0[_0x0e63('0xf2')]+_0x84bcf0['countnoanswerretry']+_0x84bcf0['countnosuchnumberretry']+_0x84bcf0[_0x0e63('0x11a')]+_0x84bcf0[_0x0e63('0x122')]+_0x84bcf0[_0x0e63('0xef')]+_0x84bcf0[_0x0e63('0xf5')]>=_0x10bd41[_0x0e63('0xf6')]-0x1){return!![];}switch(_0x1385b2){case 0x3:if(_0x84bcf0[_0x0e63('0xf3')]>=_0x10bd41[_0x0e63('0x1a4')]-0x1){return!![];}this[_0x0e63('0xc6')]({'active':![],'countnoanswerretry':_0x84bcf0[_0x0e63('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x10bd41[_0x0e63('0x1a5')],_0x0e63('0xfc'))[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x84bcf0[_0x0e63('0xd9')],'ListId':_0x84bcf0[_0x0e63('0xda')],'VoiceQueueId':_0x84bcf0['VoiceQueueId']||undefined,'CampaignId':_0x84bcf0['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x84bcf0['countbusyretry']>=_0x10bd41[_0x0e63('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x84bcf0['countbusyretry']+=0x1,'scheduledat':moment()[_0x0e63('0xfa')](_0x10bd41['dialBusyRetryFrequency'],'minutes')[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x84bcf0['ContactId'],'ListId':_0x84bcf0[_0x0e63('0xda')],'VoiceQueueId':_0x84bcf0[_0x0e63('0xdb')]||undefined,'CampaignId':_0x84bcf0[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x84bcf0[_0x0e63('0xf2')]>=_0x10bd41[_0x0e63('0x1a7')]-0x1){return!![];}this[_0x0e63('0xc6')]({'active':![],'countcongestionretry':_0x84bcf0[_0x0e63('0xf2')]+=0x1,'scheduledat':moment()[_0x0e63('0xfa')](_0x10bd41['dialCongestionRetryFrequency'],_0x0e63('0xfc'))[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x84bcf0[_0x0e63('0xd9')],'ListId':_0x84bcf0['ListId'],'VoiceQueueId':_0x84bcf0['VoiceQueueId']||undefined,'CampaignId':_0x84bcf0[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1a8')));break;case 0x0:if(_0x84bcf0[_0x0e63('0xf4')]>=_0x10bd41[_0x0e63('0x1a9')]-0x1){return!![];}else{this[_0x0e63('0xc6')]({'active':![],'countnosuchnumberretry':_0x84bcf0[_0x0e63('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x10bd41[_0x0e63('0x1aa')],_0x0e63('0xfc'))[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x84bcf0['ContactId'],'ListId':_0x84bcf0[_0x0e63('0xda')],'VoiceQueueId':_0x84bcf0['VoiceQueueId']||undefined,'CampaignId':_0x84bcf0[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x84bcf0[_0x0e63('0x11a')]>=_0x10bd41[_0x0e63('0x11b')]-0x1){return!![];}this[_0x0e63('0xc6')]({'active':![],'countdropretry':_0x84bcf0[_0x0e63('0x11a')]+=0x1,'scheduledat':moment()[_0x0e63('0xfa')](_0x10bd41[_0x0e63('0x1ab')],'minutes')[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x84bcf0['ContactId'],'ListId':_0x84bcf0[_0x0e63('0xda')],'VoiceQueueId':_0x84bcf0[_0x0e63('0xdb')]||undefined,'CampaignId':_0x84bcf0[_0x0e63('0xdc')]||undefined})['catch'](loggerCatch(_0x0e63('0x11c')));break;case 0xb:if(_0x84bcf0[_0x0e63('0x122')]>=_0x10bd41[_0x0e63('0x1ac')]-0x1){return!![];}this[_0x0e63('0xc6')]({'active':![],'countabandonedretry':_0x84bcf0[_0x0e63('0x122')]+=0x1,'scheduledat':moment()[_0x0e63('0xfa')](_0x10bd41['dialAbandonedRetryFrequency'],_0x0e63('0xfc'))[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x84bcf0[_0x0e63('0xd9')],'ListId':_0x84bcf0[_0x0e63('0xda')],'VoiceQueueId':_0x84bcf0['VoiceQueueId']||undefined,'CampaignId':_0x84bcf0[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x84bcf0[_0x0e63('0xef')]>=_0x10bd41['dialMachineMaxRetry']-0x1){return!![];}this[_0x0e63('0xc6')]({'active':![],'countmachineretry':_0x84bcf0['countmachineretry']+=0x1,'scheduledat':moment()[_0x0e63('0xfa')](_0x10bd41[_0x0e63('0xfb')],'minutes')[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x84bcf0[_0x0e63('0xd9')],'ListId':_0x84bcf0[_0x0e63('0xda')],'VoiceQueueId':_0x84bcf0[_0x0e63('0xdb')]||undefined,'CampaignId':_0x84bcf0[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x105')));break;case 0x14:if(_0x84bcf0[_0x0e63('0xf5')]>=_0x10bd41[_0x0e63('0x1ad')]-0x1){return!![];}this[_0x0e63('0xc6')]({'active':![],'countagentrejectretry':_0x84bcf0['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x0e63('0xfa')](_0x10bd41[_0x0e63('0x1ae')],_0x0e63('0xfc'))[_0x0e63('0x79')](_0x0e63('0x104')),'ContactId':_0x84bcf0['ContactId'],'ListId':_0x84bcf0[_0x0e63('0xda')],'VoiceQueueId':_0x84bcf0[_0x0e63('0xdb')]||undefined,'CampaignId':_0x84bcf0[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x0e63('0x1c')][_0x0e63('0x1a2')]=function(_0x5e161d,_0x3d53a2,_0x14391c){var _0x16ddc1=this;var _0x7ab3cb=new History(_0x5e161d);return new BPromise(function(_0x47ecdc,_0x332e4d){if(_['isUndefined'](_0x3d53a2)&&typeof _0x3d53a2!==_0x0e63('0x170')){return _0x332e4d(msgResponse(_0x0e63('0x1af'),'Failure',_0x0e63('0x1b0')));}if(_[_0x0e63('0x3f')](_0x14391c)&&typeof _0x14391c!==_0x0e63('0x170')){return _0x332e4d(msgResponse(_0x0e63('0x1af'),_0x0e63('0x147'),_0x0e63('0x1b1')));}switch(_0x14391c[_0x0e63('0x10d')]){case'0':_0x3d53a2[_0x0e63('0x65')]+=0x1;_0x7ab3cb[_0x0e63('0xaa')]=0x0;_0x7ab3cb[_0x0e63('0xab')]=_0x0e63('0x1b2');_0x7ab3cb[_0x0e63('0xf4')]+=0x1;_0x7ab3cb['countglobal']+=0x1;ami['emit'](_0x0e63('0x1b3'),ut['buildObj'](_0x5e161d,_0x0e63('0x1b4')));_0x16ddc1[_0x0e63('0xd1')](_0x7ab3cb)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xf1')));if(_0x16ddc1['checkRetriveMax'](0x0,_0x5e161d,_0x3d53a2)){if(_0x7ab3cb[_0x0e63('0xf4')]>=_0x3d53a2[_0x0e63('0x1a9')]){_0x16ddc1['createStateFinal'](_0x7ab3cb,_0x47ecdc,_0x332e4d,'reason\x200\x20no\x20such\x20number....');}else{_0x16ddc1['stateGlobal'](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1b5'));}}break;case'3':_0x3d53a2[_0x0e63('0x64')]+=0x1;_0x7ab3cb[_0x0e63('0xaa')]=0x3;_0x7ab3cb[_0x0e63('0xab')]=_0x0e63('0x1b6');_0x7ab3cb[_0x0e63('0xf3')]+=0x1;_0x7ab3cb['countglobal']+=0x1;ami[_0x0e63('0x4d')](_0x0e63('0x1b7'),ut['buildObj'](_0x5e161d,_0x0e63('0x1b8')));_0x16ddc1[_0x0e63('0xd1')](_0x7ab3cb)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1b9')));if(_0x16ddc1[_0x0e63('0x1ba')](0x3,_0x5e161d,_0x3d53a2)){if(_0x7ab3cb['countnoanswerretry']>=_0x3d53a2['dialNoAnswerMaxRetry']){_0x16ddc1[_0x0e63('0xf8')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1bb'));}else{_0x16ddc1[_0x0e63('0x102')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1bb'));}}break;case'5':_0x3d53a2['outboundBusyCallsDay']+=0x1;_0x7ab3cb[_0x0e63('0xaa')]=0x5;_0x7ab3cb[_0x0e63('0xab')]=_0x0e63('0x1bc');_0x7ab3cb[_0x0e63('0x101')]+=0x1;_0x7ab3cb[_0x0e63('0xf0')]+=0x1;ami[_0x0e63('0x4d')](_0x0e63('0x1bd'),ut['buildObj'](_0x5e161d,'busy'));_0x16ddc1['createHistory'](_0x7ab3cb)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1be')));if(_0x16ddc1[_0x0e63('0x1ba')](0x5,_0x5e161d,_0x3d53a2)){if(_0x7ab3cb['countbusyretry']>=_0x3d53a2[_0x0e63('0x1a6')]){_0x16ddc1[_0x0e63('0xf8')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1bf'));}else{_0x16ddc1['stateGlobal'](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1bf'));}}break;case'8':_0x3d53a2[_0x0e63('0x60')]+=0x1;_0x7ab3cb['state']=0x8;_0x7ab3cb[_0x0e63('0xab')]='Congestion';_0x7ab3cb[_0x0e63('0xf2')]+=0x1;_0x7ab3cb[_0x0e63('0xf0')]+=0x1;ami[_0x0e63('0x4d')](_0x0e63('0x1c0'),ut[_0x0e63('0xfe')](_0x5e161d,'congestion'));_0x16ddc1[_0x0e63('0xd1')](_0x7ab3cb)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1c1')));if(_0x16ddc1[_0x0e63('0x1ba')](0x8,_0x5e161d,_0x3d53a2)){if(_0x7ab3cb[_0x0e63('0xf2')]>=_0x3d53a2[_0x0e63('0x1a7')]){_0x16ddc1[_0x0e63('0xf8')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1c2'));}else{_0x16ddc1[_0x0e63('0x102')](_0x7ab3cb,_0x47ecdc,_0x332e4d,'reason\x208\x20congestion');}}break;case'11':_0x3d53a2[_0x0e63('0x1c3')]+=0x1;_0x7ab3cb['state']=0xb;_0x7ab3cb[_0x0e63('0xab')]=_0x0e63('0x121');_0x7ab3cb[_0x0e63('0x122')]+=0x1;_0x7ab3cb[_0x0e63('0xf0')]+=0x1;_0x16ddc1['createHistory'](_0x7ab3cb)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1c4')));if(_0x16ddc1[_0x0e63('0x1ba')](0xb,_0x5e161d,_0x3d53a2)){if(_0x7ab3cb[_0x0e63('0x122')]>=_0x3d53a2[_0x0e63('0x1ac')]){_0x16ddc1[_0x0e63('0xf8')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1c5'));}else{_0x16ddc1[_0x0e63('0x102')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1c5'));}}break;case'20':_0x3d53a2['outboundRejectCallsDay']+=0x1;_0x7ab3cb['state']=0x14;_0x7ab3cb[_0x0e63('0xab')]=_0x0e63('0x1c6');_0x7ab3cb['countagentrejectretry']+=0x1;_0x7ab3cb[_0x0e63('0xf0')]+=0x1;ami['emit'](_0x0e63('0x1c7'),ut[_0x0e63('0xfe')](_0x5e161d,_0x0e63('0x1c8')));_0x16ddc1[_0x0e63('0xd1')](_0x7ab3cb)[_0x0e63('0xbc')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x16ddc1[_0x0e63('0x1ba')](0x14,_0x5e161d,_0x3d53a2)){if(_0x7ab3cb[_0x0e63('0xf5')]>=_0x3d53a2[_0x0e63('0x1ad')]){_0x16ddc1['createStateFinal'](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1c9'));}else{_0x16ddc1[_0x0e63('0x102')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x0e63('0x1c9'));}}break;default:_0x3d53a2[_0x0e63('0x10b')]+=0x1;_0x7ab3cb[_0x0e63('0xaa')]=0xc;_0x7ab3cb['statedesc']=_0x14391c[_0x0e63('0x10d')];_0x16ddc1[_0x0e63('0xd1')](_0x7ab3cb)[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1ca')));if(_0x16ddc1[_0x0e63('0x1ba')](_0x14391c[_0x0e63('0x10d')],_0x5e161d,_0x3d53a2)){if(_0x7ab3cb[_0x0e63('0x101')]+_0x7ab3cb[_0x0e63('0xf2')]+_0x7ab3cb[_0x0e63('0xf3')]+_0x7ab3cb['countnosuchnumberretry']+_0x7ab3cb['countdropretry']+_0x7ab3cb[_0x0e63('0x122')]+_0x7ab3cb[_0x0e63('0xef')]+_0x7ab3cb[_0x0e63('0xf5')]>=_0x3d53a2['dialGlobalMaxRetry']){_0x16ddc1[_0x0e63('0x102')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x14391c[_0x0e63('0x10d')]);}else{_0x16ddc1[_0x0e63('0xf8')](_0x7ab3cb,_0x47ecdc,_0x332e4d,_0x14391c[_0x0e63('0x10d')]);}}}});};Dialer['prototype']['stateGlobal']=function(_0x25ffba,_0x59c35b,_0x698513,_0x400cc9){var _0x53c059=new Final(_0x25ffba);_0x53c059['state']=0xf;_0x53c059['statedesc']='Global';this[_0x0e63('0xf8')](_0x53c059,_0x59c35b,_0x698513,_0x400cc9);};Dialer[_0x0e63('0x1c')][_0x0e63('0xf8')]=function(_0x1552cb,_0xfa2c61,_0x3a01c2,_0x5242f0){this[_0x0e63('0xcf')](_0x1552cb)[_0x0e63('0xbf')](function(){return _0xfa2c61(msgResponse(_0x0e63('0x1af'),_0x0e63('0x1cb'),_0x5242f0));})['catch'](function(){return _0x3a01c2(msgResponse(_0x0e63('0x1cc'),_0x0e63('0x147'),'contact\x20not\x20moved'));});};Dialer[_0x0e63('0x1c')][_0x0e63('0x9')]=function(_0x1e897d){var _0x35a12b=_0x1e897d[_0x0e63('0x1cd')]/0x64;var _0x188967=_0x1e897d['outboundDropCallsDayTimeout']/(_0x1e897d['outboundDropCallsDayTimeout']+_0x1e897d[_0x0e63('0x5e')]);var _0x13c37e=Math['round'](_0x1e897d[_0x0e63('0x71')]*(_0x1e897d['predictiveIntervalMaxThreshold']/0x64));var _0x14e518=Math[_0x0e63('0x1ce')](_0x1e897d[_0x0e63('0x71')]*(_0x1e897d['predictiveIntervalMinThreshold']/0x64));var _0x462565=_0x1e897d[_0x0e63('0xa5')]+_0x1e897d[_0x0e63('0x54')];var _0x6ab7ca=Math['floor'](_0x1e897d['erlangCalls']*_0x1e897d[_0x0e63('0x76')]*_0x1e897d[_0x0e63('0x6f')]*_0x1e897d[_0x0e63('0x1cf')]);if(_[_0x0e63('0x3f')](_0x1e897d['startProgressive'])){if(!_[_0x0e63('0x3f')](_0x1e897d[_0x0e63('0x28')])){_0x1e897d[_0x0e63('0x28')]=undefined;loggerPredictive[_0x0e63('0x98')](_0x0e63('0x1d0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x1e897d[_0x0e63('0x95')])){loggerPredictive[_0x0e63('0x98')]('[startMethodPredictive][StartProgressive]',_0x0e63('0x1d1'));clearInterval(_0x1e897d[_0x0e63('0x95')]);_0x1e897d[_0x0e63('0x95')]=undefined;}_0x1e897d['startProgressive']=moment()[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0e63('0x7f')](_0x1e897d[_0x0e63('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x1e897d['startProgressive']);this['handlePower'](_0x1e897d,0x1);}else if(ifInterval(_0x1e897d[_0x0e63('0x1d2')],_0x1e897d[_0x0e63('0x29')])){this[_0x0e63('0x15d')](_0x1e897d,0x1);loggerPredictiveCalls['info'](_0x0e63('0x1d3'),_0x1e897d[_0x0e63('0x29')],_0x1e897d[_0x0e63('0x42')]);_0x1e897d[_0x0e63('0x74')]=0x0;_0x1e897d['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x35a12b<_0x188967&&_0x1e897d[_0x0e63('0x1d4')]===_0x0e63('0x1d5')){freeVariablesPredictive(_0x1e897d);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x1d6'),_0x0e63('0x1d7'),_0x188967,_0x0e63('0x29'),_0x1e897d[_0x0e63('0x42')]);}else if(_0x6ab7ca<_0x1e897d[_0x0e63('0x6e')]&&_0x1e897d[_0x0e63('0x1d4')]===_0x0e63('0x1d5')){freeVariablesPredictive(_0x1e897d);loggerPredictive['info'](_0x0e63('0x1d8'),'Max\x20Drop\x20',_0x6ab7ca,_0x0e63('0x1d9'),_0x1e897d[_0x0e63('0x6e')],_0x0e63('0x29'),_0x1e897d[_0x0e63('0x42')]);}else if(!ifInterval(_0x1e897d[_0x0e63('0x1d2')],_0x1e897d['startProgressive'])&&_[_0x0e63('0x3f')](_0x1e897d['startPredictive'])&&!_[_0x0e63('0x3f')](_0x1e897d['startProgressive'])){_0x1e897d['startPredictive']=moment()[_0x0e63('0x79')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0e63('0x7f')](_0x1e897d[_0x0e63('0x42')],_0x0e63('0x1da'),_0x1e897d[_0x0e63('0x28')]);this[_0x0e63('0xc3')](_0x1e897d[_0x0e63('0x1d2')])[_0x0e63('0xbf')](this['getDataPredictive'](_0x1e897d))['then'](mergeDataErlangB(_0x1e897d))['then'](this[_0x0e63('0x1db')](_0x1e897d))[_0x0e63('0xbc')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1e897d));}else if(!ifInterval(_0x1e897d[_0x0e63('0x1d2')],_0x1e897d['startPredictive'])){_0x1e897d[_0x0e63('0x6e')]=0x0;_0x1e897d['startPredictive']=moment()['format'](_0x0e63('0x104'));loggerPredictive[_0x0e63('0x7f')](_0x1e897d[_0x0e63('0x42')],_0x0e63('0x1dc'),_0x1e897d[_0x0e63('0x28')]);clearInterval(_0x1e897d['handlePredictive']);_0x1e897d[_0x0e63('0x95')]=undefined;this[_0x0e63('0xc3')](_0x1e897d[_0x0e63('0x1d2')])[_0x0e63('0xbf')](this[_0x0e63('0x1dd')](_0x1e897d))['then'](mergeDataErlangB(_0x1e897d))['then'](this[_0x0e63('0x1db')](_0x1e897d))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1e897d));}else if(_0x1e897d[_0x0e63('0x71')]&&_0x462565<_0x1e897d['predictiveIntervalAvailable']-_0x14e518){freeVariablesPredictive(_0x1e897d);loggerPredictive[_0x0e63('0x7f')](_0x1e897d[_0x0e63('0x42')],_0x0e63('0x1de'),_0x462565,_0x0e63('0x1df'),_0x1e897d[_0x0e63('0x71')],'-',_0x14e518,'=',_0x1e897d[_0x0e63('0x71')]-_0x14e518,')');}else if(_0x1e897d[_0x0e63('0x71')]&&_0x462565>_0x1e897d['predictiveIntervalAvailable']+_0x13c37e){freeVariablesPredictive(_0x1e897d);loggerPredictive['info'](_0x1e897d[_0x0e63('0x42')],_0x0e63('0x1de'),_0x462565,')\x20are\x20more\x20than\x20threshold\x20(',_0x1e897d[_0x0e63('0x71')],'+',_0x13c37e,'=',_0x1e897d[_0x0e63('0x71')]+_0x13c37e,')');}};Dialer[_0x0e63('0x1c')][_0x0e63('0x1dd')]=function(_0x5c15f4){var _0x1ea93b=this;return function(_0xd3a555){return new BPromise(function(_0x43efff,_0x4301a8){_['merge'](_0x5c15f4,_0xd3a555[0x0]);if(checkGetDataPredictive(_0xd3a555[0x0])){var _0x16170e=_0x5c15f4['predictiveIntervalAvailable']=_0x5c15f4[_0x0e63('0x54')]+_0x5c15f4[_0x0e63('0xa5')];var _0x205099=_0x5c15f4[_0x0e63('0x1d2')]*0x3c;var _0x3a6f44=_0xd3a555[0x0]['predictiveIntervalAvgTalktime']+_0xd3a555[0x0][_0x0e63('0x6a')];var _0x4bc56a=(_0xd3a555[0x0]['predictiveIntervalAnsweredCalls']+_0xd3a555[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xd3a555[0x0][_0x0e63('0x6c')])/_0xd3a555[0x0]['predictiveIntervalTotalCalls'];_0x5c15f4[_0x0e63('0x6f')]=_0x4bc56a>0x0?_0x4bc56a:0x1;switch(_0x5c15f4[_0x0e63('0x1d4')]){case _0x0e63('0x1d5'):var _0x5e8321=_0x5c15f4[_0x0e63('0x1cd')]/0x64;return _0x1ea93b[_0x0e63('0x1e0')](_0x16170e,_0x205099,_0x3a6f44,_0x4bc56a,_0x5e8321)[_0x0e63('0xbf')](function(_0x3ff5cc){return _0x43efff(_0x3ff5cc);});case _0x0e63('0x1e1'):var _0x28b80e=_0x5c15f4['dialPredictiveOptimizationPercentage']/0x64;return _0x1ea93b[_0x0e63('0x1e2')](_0x16170e,_0x205099,_0x3a6f44,_0x4bc56a,_0x28b80e)['then'](function(_0x4e9474){return _0x43efff(_0x4e9474);});default:return _0x4301a8(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x4301a8(msgResponse(_0x0e63('0x1e3'),_0x0e63('0x147'),_0x0e63('0x1e4')));}});};};Dialer[_0x0e63('0x1c')][_0x0e63('0x1e5')]=function(_0x964dc8){var _0x3b94ba=this;return function(_0x3b1cee){return new BPromise(function(_0x4cf8ac,_0x3dbe47){_['merge'](_0x964dc8,_0x3b1cee[0x0]);if(checkGetDataPredictive(_0x3b1cee[0x0])){loggerPredictive[_0x0e63('0x7f')](JSON[_0x0e63('0x4b')](_0x3b1cee[0x0]));if(_0x964dc8[_0x0e63('0x1d4')]==='dropRate'){return _0x3b94ba[_0x0e63('0xce')](_0x964dc8['id'])[_0x0e63('0xbf')](function(_0x29668b){var _0x479d02=_0x964dc8[_0x0e63('0x50')]-_0x29668b[0x0][_0x0e63('0x1e6')];var _0x49431a=_0x964dc8[_0x0e63('0x1d2')]*0x3c;var _0x23f74f=_0x3b1cee[0x0][_0x0e63('0x6b')]+_0x3b1cee[0x0][_0x0e63('0x6a')];var _0x2c2d08=(_0x3b1cee[0x0][_0x0e63('0x69')]+_0x3b1cee[0x0][_0x0e63('0x83')]+_0x3b1cee[0x0][_0x0e63('0x6c')])/_0x3b1cee[0x0][_0x0e63('0x72')];var _0x5b997b=_0x964dc8['dialPredictiveOptimizationPercentage']/0x64;_0x964dc8[_0x0e63('0x70')]=_0x29668b[0x0][_0x0e63('0x1e6')]||0x0;_0x964dc8[_0x0e63('0x6f')]=_0x2c2d08>0x0?_0x2c2d08:0x1;return _0x3b94ba[_0x0e63('0x1e0')](_0x479d02,_0x49431a,_0x23f74f,_0x2c2d08,_0x5b997b);})[_0x0e63('0xbf')](function(_0x44074a){return _0x4cf8ac(_0x44074a);})['catch'](function(_0x521f77){return _0x3dbe47(msgResponse(_0x0e63('0x1e7'),_0x0e63('0x147'),JSON[_0x0e63('0x4b')](_0x521f77)));});}if(_0x964dc8[_0x0e63('0x1d4')]===_0x0e63('0x1e1')){return _0x3b94ba[_0x0e63('0xce')](_0x964dc8['id'])[_0x0e63('0xbf')](function(_0x1501e2){var _0x431b58=_0x964dc8[_0x0e63('0x50')]-_0x1501e2[0x0][_0x0e63('0x1e6')];var _0x409295=_0x964dc8[_0x0e63('0x1d2')]*0x3c;var _0x5ef750=_0x3b1cee[0x0][_0x0e63('0x6b')]+_0x3b1cee[0x0][_0x0e63('0x6a')];var _0xcc4f51=(_0x3b1cee[0x0]['predictiveIntervalAnsweredCalls']+_0x3b1cee[0x0][_0x0e63('0x83')]+_0x3b1cee[0x0][_0x0e63('0x6c')])/_0x3b1cee[0x0][_0x0e63('0x72')];var _0x88af7c=_0x964dc8[_0x0e63('0x1cd')]/0x64;_0x964dc8['predictiveIntervalPauses']=_0x1501e2[0x0][_0x0e63('0x1e6')]||0x0;_0x964dc8[_0x0e63('0x6f')]=_0xcc4f51>0x0?_0xcc4f51:0x1;return _0x3b94ba[_0x0e63('0x1e2')](_0x431b58,_0x409295,_0x5ef750,_0xcc4f51,_0x88af7c);})['then'](function(_0x311b09){return _0x4cf8ac(_0x311b09);})[_0x0e63('0xbc')](function(_0xf88fb6){return _0x3dbe47(msgResponse(_0x0e63('0x1e7'),_0x0e63('0x147'),JSON['stringify'](_0xf88fb6)));});}}else{return _0x3dbe47(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x0e63('0x1c')][_0x0e63('0x1db')]=function(_0x350d84){var _0x552a12=this;return function(){var _0x1bb049=0x0;var _0x3b4596=Math[_0x0e63('0x1e8')](_0x350d84['erlangCallToSecond']*0x3e8);if(_0x3b4596>0x0){_0x3b4596=_0x3b4596<0x64?0x64:_0x3b4596;loggerPredictive[_0x0e63('0x7f')](_0x350d84[_0x0e63('0x42')],_0x0e63('0x1e9'),_0x3b4596,_0x0e63('0x4c'));_0x350d84['handlePredictive']=setInterval(function(){_0x552a12['handlePredictive'](_0x350d84);loggerPredictiveCalls[_0x0e63('0x7f')](_0x0e63('0x1ea'),_0x1bb049+=0x1);},_0x3b4596);}else{loggerPredictive[_0x0e63('0x7f')](_0x350d84[_0x0e63('0x42')],_0x0e63('0x1eb'));}};};Dialer['prototype']['checkContactBlack']=function(_0x496e7,_0x571622){var _0x14ca8f=this;return function(_0x212375){if(_[_0x0e63('0x49')](_0x212375)){if(_['isNil'](_0x571622[_0x0e63('0x1ec')])||!_0x571622[_0x0e63('0x1ed')]){if(_0x496e7['dialMethod']===_0x0e63('0x8')){_0x496e7[_0x0e63('0x130')]=_['isUndefined'](_0x496e7[_0x0e63('0x130')])?!![]:_0x496e7[_0x0e63('0x130')];var _0xee7933=uuid['v4']();_0x14ca8f[_0x0e63('0xaf')][_0xee7933]=new Action(_0x496e7,_0x571622,_0xee7933);loggerBooked['info'](_0x0e63('0x1ee'),_0xee7933,_0x0e63('0x1ef'),JSON['stringify'](_0x496e7[_0x0e63('0x130')]),'Queue:\x20',_0x496e7[_0x0e63('0x42')]);if(_0x496e7[_0x0e63('0x130')]){_0x496e7['queueStatusComplete']=![];_0x14ca8f[_0x0e63('0x12e')][_0x14ca8f['actions'][_0xee7933][_0x0e63('0xb7')]]=[];ami[_0x0e63('0xb2')]({'actionid':_0xee7933,'action':'queuestatus','queue':_0x496e7[_0x0e63('0x42')]})[_0x0e63('0xbc')](function(){_0x14ca8f['updateOriginated'](_0x496e7);_0x14ca8f['rescheduleContact']({'active':![],'ContactId':_0x14ca8f[_0x0e63('0xaf')][_0xee7933][_0x0e63('0xd9')],'ListId':_0x14ca8f[_0x0e63('0xaf')][_0xee7933][_0x0e63('0xda')],'VoiceQueueId':_0x14ca8f[_0x0e63('0xaf')][_0xee7933][_0x0e63('0xdb')]||undefined,'CampaignId':_0x14ca8f['actions'][_0xee7933][_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1f0')));delete _0x14ca8f[_0x0e63('0xaf')][_0xee7933];});}else{loggerBooked[_0x0e63('0x7f')](_0x0e63('0x1f1'),JSON[_0x0e63('0x4b')](_0x496e7['queueStatusComplete']),_0x0e63('0x1f2'),_0x496e7['name']);_0x14ca8f[_0x0e63('0xb6')](_0x496e7);_0x14ca8f[_0x0e63('0xc6')]({'active':![],'ContactId':_0x14ca8f[_0x0e63('0xaf')][_0xee7933][_0x0e63('0xd9')],'ListId':_0x14ca8f['actions'][_0xee7933]['ListId'],'VoiceQueueId':_0x14ca8f[_0x0e63('0xaf')][_0xee7933][_0x0e63('0xdb')]||undefined,'CampaignId':_0x14ca8f['actions'][_0xee7933][_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x14ca8f['actions'][_0xee7933];}}else{return _0x14ca8f[_0x0e63('0x16f')](_0x496e7,_0x571622);}}else{if(getDiff(_0x571622['scheduledat'])<_0x496e7[_0x0e63('0x1f3')]*0x3c){if(_0x571622['Agent']&&!_0x571622[_0x0e63('0x1f4')][_0x0e63('0x1f5')]){_0x14ca8f[_0x0e63('0x20')][_0x0e63('0x133')](_0x571622['id'])[_0x0e63('0x136')](function(){_0x14ca8f[_0x0e63('0xb6')](_0x496e7);});}else{_0x14ca8f[_0x0e63('0xc8')]({'active':![]},_0x571622['id'],0x1)[_0x0e63('0x136')](function(){_0x14ca8f[_0x0e63('0xb6')](_0x496e7);});}}else{_0x496e7[_0x0e63('0x67')]+=0x1;_0x14ca8f[_0x0e63('0xb6')](_0x496e7);if(_0x496e7[_0x0e63('0x1f6')]){_0x14ca8f['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x571622['ContactId'],'ListId':_0x571622[_0x0e63('0xda')],'VoiceQueueId':_0x571622[_0x0e63('0xdb')]||undefined,'CampaignId':_0x571622[_0x0e63('0xdc')]||undefined})[_0x0e63('0xbc')](loggerCatch(_0x0e63('0x1f7')));_0x14ca8f[_0x0e63('0xd1')](createObjHistory(_0x496e7,_0x571622,_0x0e63('0x1f8'),0x17,'RecallInQueue'))[_0x0e63('0xbc')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x14ca8f[_0x0e63('0xd7')](createObjHistory(_0x496e7,_0x571622,'RECALLFAILEDTIMEOUT',0x16,_0x0e63('0x1f9')),_0x0e63('0x1fa'),_0x0e63('0x1fb'));}}}}else{_0x496e7[_0x0e63('0x1fc')]+=0x1;_0x14ca8f[_0x0e63('0xd7')](createObjHistory(_0x496e7,_0x571622,'BLACKLIST',0xd,_0x0e63('0x1fd')),_0x0e63('0x1fe'),_0x0e63('0x1ff'));throw'inBlackList';}};};Dialer[_0x0e63('0x1c')][_0x0e63('0x162')]=function(_0x56ef43){var _0x1fdb51=this;var _0x37647d=_0x56ef43[_0x0e63('0x200')]-_0x56ef43[_0x0e63('0x73')]-_0x56ef43[_0x0e63('0xcb')];emitCampaignSummary(_0x56ef43);if(_0x37647d>0x0){if(_0x37647d>this[_0x0e63('0x24')]){_0x37647d=this['maxNumberOriginate'];}_0x56ef43['temp']+=_0x37647d;this[_0x0e63('0xcd')](_0x56ef43['id'],_0x37647d,_0x56ef43[_0x0e63('0x201')],_0x56ef43)['then'](function(_0x4d9440){_0x56ef43['temp']-=_0x37647d;_0x56ef43[_0x0e63('0xcb')]=_0x56ef43[_0x0e63('0xcb')]>0x0?_0x56ef43['temp']:0x0;if(!checkContactEmpty(_0x4d9440)){_0x56ef43[_0x0e63('0x40')]=_0x0e63('0xa2');logger[_0x0e63('0x7f')](_0x0e63('0x202')+_0x56ef43[_0x0e63('0x42')]);}else{_0x56ef43['originated']+=_0x4d9440[_0x0e63('0x9a')];_0x56ef43[_0x0e63('0x40')]=_0x0e63('0x203');for(var _0x21a46a=0x0;_0x21a46a<_0x4d9440[_0x0e63('0x9a')];_0x21a46a+=0x1){_0x56ef43[_0x0e63('0x204')]+=0x1;if(_[_0x0e63('0xb1')](_0x4d9440[_0x21a46a])||_[_0x0e63('0xb1')](_0x4d9440[_0x21a46a][_0x0e63('0x173')])||_[_0x0e63('0xb1')](_0x4d9440[_0x21a46a][_0x0e63('0x173')][_0x0e63('0x174')])){_0x1fdb51[_0x0e63('0xd5')]('[actionOriginate]\x20',_0x56ef43,_0x4d9440[_0x21a46a]);}else{_0x1fdb51[_0x0e63('0xc1')](_[_0x0e63('0xd8')](_0x4d9440[_0x21a46a],[_0x0e63('0xdc'),_0x0e63('0x205')]))[_0x0e63('0xbf')](_0x1fdb51[_0x0e63('0x206')](_0x56ef43,_0x4d9440[_0x21a46a]))['catch'](_0x1fdb51[_0x0e63('0x207')](_0x0e63('0x208'),_0x56ef43));}}}})[_0x0e63('0xbc')](loggerGetContactDialer(_0x0e63('0x209'),_0x56ef43,_0x37647d));}};Dialer[_0x0e63('0x1c')][_0x0e63('0x15d')]=function(_0x410842,_0x2bbb18){var _0x5cf6fc=this;var _0x3de3d9=[];var _0x53c4fa=_0x2bbb18>=0x1?_0x2bbb18:0x1;if(_0x410842['dialMethod']===_0x0e63('0x8')){_0x53c4fa=0x1;}var _0x5622d7=Math[_0x0e63('0x1e8')](_0x410842[_0x0e63('0xa5')]*_0x53c4fa)-_0x410842[_0x0e63('0x73')]-_0x410842[_0x0e63('0xcb')];emitVoiceQueueSummary(_0x410842);if(_0x410842['dialLimitQueue']>0x0){var _0x52324f=_0x410842[_0x0e63('0x20a')]-_0x410842['originated']-_0x410842[_0x0e63('0x54')]-_0x410842['temp']-_0x410842['pTalking'];if(_0x5622d7>_0x52324f){_0x5622d7=_0x52324f;}}if(_0x5622d7>0x0){if(_0x410842[_0x0e63('0x15b')]===_0x0e63('0x8')){_0x5622d7=0x1;}if(_0x5622d7>this[_0x0e63('0x24')]){_0x5622d7=this[_0x0e63('0x24')];}_0x410842[_0x0e63('0xcb')]+=_0x5622d7;for(var _0x32d593 in this[_0x0e63('0x12b')]){if(typeof this[_0x0e63('0x12b')][_0x32d593]!==_0x0e63('0x9b')){if(this[_0x0e63('0x12b')][_0x32d593][_0x0e63('0xaa')]==='not_inuse'&&this[_0x0e63('0x12b')][_0x32d593][_0x0e63('0xb3')]===_0x0e63('0xe1')){_0x3de3d9[_0x0e63('0x12f')](this[_0x0e63('0x12b')][_0x32d593]['id']);}}}this['getContactDialer'](_0x410842['id'],_0x3de3d9,_0x5622d7,_0x410842[_0x0e63('0x201')],_0x410842)['then'](function(_0x35237f){_0x410842[_0x0e63('0xcb')]-=_0x5622d7;_0x410842[_0x0e63('0xcb')]=_0x410842[_0x0e63('0xcb')]>0x0?_0x410842[_0x0e63('0xcb')]:0x0;if(!checkContactEmpty(_0x35237f)){_0x5cf6fc[_0x0e63('0xbb')](_0x410842)[_0x0e63('0xbf')](sendMessageReschedule(_0x410842))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xbd')));}else{_0x410842[_0x0e63('0x73')]+=_0x35237f[_0x0e63('0x9a')];_0x410842[_0x0e63('0x40')]=_0x410842[_0x0e63('0x15b')]===_0x0e63('0x8')?_0x0e63('0x20b'):_0x0e63('0x203');for(var _0x9bce0c=0x0;_0x9bce0c<_0x35237f[_0x0e63('0x9a')];_0x9bce0c+=0x1){if(_['isNil'](_0x35237f[_0x9bce0c])||_[_0x0e63('0xb1')](_0x35237f[_0x9bce0c]['Contact'])||_['isNil'](_0x35237f[_0x9bce0c][_0x0e63('0x173')][_0x0e63('0x174')])){_0x5cf6fc['emptyContact'](_0x0e63('0x20c'),_0x410842,_0x35237f[_0x9bce0c]);}else{_0x5cf6fc[_0x0e63('0xbe')](_[_0x0e63('0xd8')](_0x35237f[_0x9bce0c],[_0x0e63('0xdb'),_0x0e63('0x205')]))[_0x0e63('0xbf')](_0x5cf6fc[_0x0e63('0x206')](_0x410842,_0x35237f[_0x9bce0c]))[_0x0e63('0xbc')](_0x5cf6fc[_0x0e63('0x207')](_0x0e63('0x20c'),_0x410842));}}}})['catch'](loggerGetContactDialer(_0x0e63('0x20d'),_0x410842,_0x5622d7));}};Dialer[_0x0e63('0x1c')][_0x0e63('0x95')]=function(_0x33436e){if(_0x33436e[_0x0e63('0x20a')]>0x0){var _0x340def=_0x33436e[_0x0e63('0x20a')]-_0x33436e[_0x0e63('0x73')]-_0x33436e[_0x0e63('0x54')];if(_0x340def>0x0){this[_0x0e63('0x20e')](_0x33436e);}else{loggerPredictiveCalls[_0x0e63('0x7f')](_0x0e63('0x20f'));}}else{this[_0x0e63('0x20e')](_0x33436e);}};Dialer[_0x0e63('0x1c')][_0x0e63('0x20e')]=function(_0x242888){var _0x81dd71=this;var _0x1a9e78=[];_0x242888['originated']+=0x1;for(var _0x2ffcab in this[_0x0e63('0x12b')]){if(typeof this['agents'][_0x2ffcab]!=='undefined'){if(this[_0x0e63('0x12b')][_0x2ffcab]['state']===_0x0e63('0x210')&&this['agents'][_0x2ffcab]['status']===_0x0e63('0xe1')){_0x1a9e78[_0x0e63('0x12f')](this[_0x0e63('0x12b')][_0x2ffcab]['id']);}}}this[_0x0e63('0xca')](_0x242888['id'],_0x1a9e78,0x1,_0x242888[_0x0e63('0x201')],_0x242888)[_0x0e63('0xbf')](function(_0x52028d){if(!checkContactEmpty(_0x52028d)){checkContactLowerLimitOriginate(_0x242888,0x1,0x0);_0x81dd71[_0x0e63('0xbb')](_0x242888)[_0x0e63('0xbf')](sendMessageReschedule(_0x242888))[_0x0e63('0xbc')](loggerCatch(_0x0e63('0xbd')));}else{_0x242888[_0x0e63('0x40')]=_0x0e63('0x203');if(_[_0x0e63('0xb1')](_0x52028d[0x0])||_[_0x0e63('0xb1')](_0x52028d[0x0][_0x0e63('0x173')])||_[_0x0e63('0xb1')](_0x52028d[0x0][_0x0e63('0x173')][_0x0e63('0x174')])){_0x81dd71[_0x0e63('0xd5')](_0x0e63('0x20c'),_0x242888,_0x52028d[0x0]);}else{_0x81dd71[_0x0e63('0xbe')](_[_0x0e63('0xd8')](_0x52028d[0x0],[_0x0e63('0xdb'),'Contact.phone']))[_0x0e63('0xbf')](_0x81dd71[_0x0e63('0x206')](_0x242888,_0x52028d[0x0]))[_0x0e63('0xbc')](_0x81dd71[_0x0e63('0x207')](_0x0e63('0x211'),_0x242888));}}})[_0x0e63('0xbc')](loggerGetContactDialer(_0x0e63('0x212'),_0x242888,0x1));emitVoiceQueueSummary(_0x242888);};Dialer[_0x0e63('0x1c')][_0x0e63('0x1e0')]=function(_0x18f5dc,_0x3948d6,_0x1c7d13,_0x58fbef,_0x4e7914,_0x5badbd){loggerPredictive['info'](_0x0e63('0x213'));loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x214'),_0x18f5dc);loggerPredictive[_0x0e63('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3948d6);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x215'),_0x1c7d13);loggerPredictive[_0x0e63('0x7f')]('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',_0x58fbef);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x216'),_0x4e7914);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x87'));return new BPromise(function(_0xc23af0,_0x1fd8fd){if(_0x18f5dc<=0x0||isNaN(_0x18f5dc)){return _0x1fd8fd(msgResponse(_0x0e63('0x217'),_0x0e63('0x218'),'m\x20=\x20'+_0x18f5dc));}if(_0x1c7d13<=0x0||isNaN(_0x1c7d13)){return _0x1fd8fd(msgResponse('[abandonmentRate]',_0x0e63('0x218'),_0x0e63('0x219')+_0x1c7d13));}if(_0x58fbef<=0x0||isNaN(_0x58fbef)){return _0x1fd8fd(msgResponse(_0x0e63('0x217'),_0x0e63('0x218'),'p\x20=\x20'+_0x58fbef));}if(_0x3948d6<=0x0||isNaN(_0x3948d6)){return _0x1fd8fd(msgResponse(_0x0e63('0x217'),'Error',_0x0e63('0x21a')+_0x3948d6));}if(_0x4e7914<=0x0||isNaN(_0x4e7914)){return _0x1fd8fd(msgResponse(_0x0e63('0x217'),_0x0e63('0x218'),'Amax\x20=\x20'+_0x4e7914));}_0x5badbd=_0x5badbd||0x0;var _0x1ca95e=0x1/_0x1c7d13;var _0x2a7f6b=0x0;var _0x4411f3=0x0;var _0x220f2f=0x0;var _0x286308=0x0;for(var _0x512c1d=0x0;_0x220f2f<_0x4e7914;_0x512c1d+=0x1){_0x4411f3=_0x512c1d/_0x3948d6;_0x2a7f6b=(_0x58fbef*_0x4411f3+_0x5badbd)/_0x1ca95e;_0x220f2f=erlangb(_0x2a7f6b,_0x18f5dc);_0x286308=_0x2a7f6b/_0x18f5dc*(0x1-erlangb(_0x2a7f6b,_0x18f5dc));}return _0xc23af0({'erlangCalls':_0x512c1d,'erlangCallToSecond':_0x3948d6/_0x512c1d,'erlangAbandonmentRate':_0x220f2f,'erlangBusyFactor':_0x286308});});};Dialer['prototype']['busyFactor']=function(_0x11cba4,_0x364477,_0x5749ce,_0x4123e8,_0x3d9852,_0x673406){loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x21b'));loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x214'),_0x11cba4);loggerPredictive[_0x0e63('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x364477);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x215'),_0x5749ce);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x21c'),_0x4123e8);loggerPredictive[_0x0e63('0x7f')](_0x0e63('0x21d'),_0x3d9852);loggerPredictive[_0x0e63('0x7f')]('---------------------------');return new BPromise(function(_0x2e8726,_0x14732b){if(_0x11cba4<=0x0||isNaN(_0x11cba4)){return _0x14732b(msgResponse(_0x0e63('0x21e'),_0x0e63('0x218'),'m\x20=\x20'+_0x11cba4));}if(_0x5749ce<=0x0||isNaN(_0x5749ce)){return _0x14732b(msgResponse(_0x0e63('0x21e'),_0x0e63('0x218'),'Ts\x20=\x20'+_0x5749ce));}if(_0x4123e8<=0x0||isNaN(_0x4123e8)){return _0x14732b(msgResponse(_0x0e63('0x21e'),_0x0e63('0x218'),_0x0e63('0x21f')+_0x4123e8));}if(_0x364477<=0x0||isNaN(_0x364477)){return _0x14732b(msgResponse('[busyFactor]',_0x0e63('0x218'),_0x0e63('0x21a')+_0x364477));}if(_0x3d9852<=0x0||isNaN(_0x3d9852)){return _0x14732b(msgResponse('[busyFactor]',_0x0e63('0x218'),'Umin\x20=\x20'+_0x3d9852));}_0x673406=_0x673406||0x0;var _0x1a0348=0x1/_0x5749ce;var _0x55cf9d=0x0;var _0x24119c=0x0;var _0x269685=0x0;var _0x4735f9=0x0;for(var _0x160f1c=0x0;_0x4735f9<_0x3d9852;_0x160f1c+=0x1){_0x24119c=_0x160f1c/_0x364477;_0x55cf9d=(_0x4123e8*_0x24119c+_0x673406)/_0x1a0348;_0x269685=erlangb(_0x55cf9d,_0x11cba4);_0x4735f9=_0x55cf9d/_0x11cba4*(0x1-erlangb(_0x55cf9d,_0x11cba4));}return _0x2e8726({'erlangCalls':_0x160f1c,'erlangCallToSecond':_0x364477/_0x160f1c,'erlangAbandonmentRate':_0x269685,'erlangBusyFactor':_0x4735f9});});};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 2b6af1b..86f8228 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 _0xf379=['lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xf379,0x7a));var _0x9f37=function(_0x516cd6,_0xf63d1b){_0x516cd6=_0x516cd6-0x0;var _0x31c4bc=_0xf379[_0x516cd6];return _0x31c4bc;};'use strict';var util=require(_0x9f37('0x0'));var _=require(_0x9f37('0x1'));var moment=require('moment');function getSeconds(_0x3abf82,_0x12c96c){var _0x532829=moment(_0x3abf82)[_0x9f37('0x2')](0x0);var _0x2ff2db=moment(_0x12c96c)[_0x9f37('0x2')](0x0);return _0x532829[_0x9f37('0x3')](_0x2ff2db,_0x9f37('0x4'));}function QueueCallerAbandon(_0x54fdb3,_0x599bd8){this['scheduledat']=_0x54fdb3[_0x9f37('0x5')];this['type']=_0x54fdb3[_0x9f37('0x6')];this[_0x9f37('0x7')]=_0x54fdb3['type']===_0x9f37('0x8')?_0x9f37('0x9'):_0x54fdb3[_0x9f37('0x6')];this[_0x9f37('0xa')]=_0x54fdb3['countbusyretry'];this[_0x9f37('0xb')]=_0x54fdb3[_0x9f37('0xb')];this[_0x9f37('0xc')]=_0x54fdb3[_0x9f37('0xc')];this[_0x9f37('0xd')]=_0x54fdb3['countbusyretry']+_0x54fdb3[_0x9f37('0xb')]+_0x54fdb3[_0x9f37('0xc')]+_0x54fdb3[_0x9f37('0xe')]+_0x54fdb3[_0x9f37('0xf')]+_0x54fdb3[_0x9f37('0x10')]+_0x54fdb3[_0x9f37('0x11')]+_0x54fdb3[_0x9f37('0x12')];this['countnosuchnumberretry']=_0x54fdb3[_0x9f37('0xe')];this[_0x9f37('0xf')]=_0x54fdb3['countdropretry'];this[_0x9f37('0x10')]=_0x54fdb3[_0x9f37('0x10')];this['countmachineretry']=_0x54fdb3[_0x9f37('0x11')];this[_0x9f37('0x12')]=_0x54fdb3['countagentrejectretry'];this[_0x9f37('0x13')]=_0x599bd8[_0x9f37('0x13')];this[_0x9f37('0x14')]=_0x54fdb3['name'];this['calleridnum']=_0x54fdb3[_0x9f37('0x15')];this[_0x9f37('0x16')]=_0x54fdb3[_0x9f37('0x16')];this[_0x9f37('0x17')]=_0x54fdb3[_0x9f37('0x17')];this[_0x9f37('0x18')]=_0x54fdb3[_0x9f37('0x18')];this[_0x9f37('0x19')]=this['droptime'];this[_0x9f37('0x1a')]=getSeconds(_0x54fdb3[_0x9f37('0x17')],_0x54fdb3[_0x9f37('0x16')]);this[_0x9f37('0x1b')]=getSeconds(this[_0x9f37('0x18')],_0x54fdb3[_0x9f37('0x17')]);this[_0x9f37('0x1c')]=0x0;this[_0x9f37('0x9')]=_0x599bd8[_0x9f37('0x9')];this['membername']=_0x599bd8[_0x9f37('0x1d')];this[_0x9f37('0x1e')]=_0x599bd8['reason'];this['callback']=_0x54fdb3[_0x9f37('0x1f')];this[_0x9f37('0x20')]=_0x54fdb3['callbackuniqueid'];this[_0x9f37('0x21')]=_0x54fdb3['callbackat'];this['recallme']=_0x54fdb3[_0x9f37('0x22')];this[_0x9f37('0x23')]=_0x54fdb3[_0x9f37('0x23')];this['ListId']=_0x54fdb3[_0x9f37('0x24')];this['UserId']=_0x54fdb3['UserId'];this[_0x9f37('0x25')]=_0x54fdb3['VoiceQueueId'];this['CampaignId']=_0x54fdb3[_0x9f37('0x26')];this[_0x9f37('0x27')]=_0x54fdb3[_0x9f37('0x27')]||'';this['originatecalleridname']=_0x54fdb3[_0x9f37('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x4507=['countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x30fdcb,_0x130cc8){var _0x14eec4=function(_0x441009){while(--_0x441009){_0x30fdcb['push'](_0x30fdcb['shift']());}};_0x14eec4(++_0x130cc8);}(_0x4507,0x107));var _0x7450=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4507[_0x4e676e];return _0x336a3c;};'use strict';var util=require('util');var _=require(_0x7450('0x0'));var moment=require(_0x7450('0x1'));function getSeconds(_0x5d2ad4,_0x207037){var _0x4bc505=moment(_0x5d2ad4)[_0x7450('0x2')](0x0);var _0x273819=moment(_0x207037)['milliseconds'](0x0);return _0x4bc505['diff'](_0x273819,'seconds');}function QueueCallerAbandon(_0x28c9e1,_0x53adb6){this[_0x7450('0x3')]=_0x28c9e1[_0x7450('0x3')];this[_0x7450('0x4')]=_0x28c9e1['type'];this['campaigntype']=_0x28c9e1[_0x7450('0x4')]===_0x7450('0x5')?_0x7450('0x6'):_0x28c9e1[_0x7450('0x4')];this[_0x7450('0x7')]=_0x28c9e1[_0x7450('0x7')];this[_0x7450('0x8')]=_0x28c9e1[_0x7450('0x8')];this[_0x7450('0x9')]=_0x28c9e1[_0x7450('0x9')];this[_0x7450('0xa')]=_0x28c9e1[_0x7450('0x7')]+_0x28c9e1[_0x7450('0x8')]+_0x28c9e1[_0x7450('0x9')]+_0x28c9e1[_0x7450('0xb')]+_0x28c9e1[_0x7450('0xc')]+_0x28c9e1['countabandonedretry']+_0x28c9e1[_0x7450('0xd')]+_0x28c9e1['countagentrejectretry'];this[_0x7450('0xb')]=_0x28c9e1[_0x7450('0xb')];this[_0x7450('0xc')]=_0x28c9e1[_0x7450('0xc')];this['countabandonedretry']=_0x28c9e1[_0x7450('0xe')];this['countmachineretry']=_0x28c9e1[_0x7450('0xd')];this[_0x7450('0xf')]=_0x28c9e1[_0x7450('0xf')];this['uniqueid']=_0x53adb6['uniqueid'];this[_0x7450('0x10')]=_0x28c9e1[_0x7450('0x11')];this[_0x7450('0x12')]=_0x28c9e1[_0x7450('0x13')];this[_0x7450('0x14')]=_0x28c9e1[_0x7450('0x14')];this[_0x7450('0x15')]=_0x28c9e1[_0x7450('0x15')];this[_0x7450('0x16')]=_0x28c9e1[_0x7450('0x16')];this[_0x7450('0x17')]=this[_0x7450('0x16')];this[_0x7450('0x18')]=getSeconds(_0x28c9e1['responsetime'],_0x28c9e1[_0x7450('0x14')]);this[_0x7450('0x19')]=getSeconds(this['droptime'],_0x28c9e1[_0x7450('0x15')]);this['talktime']=0x0;this[_0x7450('0x6')]=_0x53adb6[_0x7450('0x6')];this[_0x7450('0x1a')]=_0x53adb6[_0x7450('0x1b')];this['reason']=_0x53adb6[_0x7450('0x1c')];this[_0x7450('0x1d')]=_0x28c9e1['callback'];this[_0x7450('0x1e')]=_0x28c9e1[_0x7450('0x1e')];this[_0x7450('0x1f')]=_0x28c9e1[_0x7450('0x1f')];this[_0x7450('0x20')]=_0x28c9e1[_0x7450('0x20')];this[_0x7450('0x21')]=_0x28c9e1[_0x7450('0x21')];this['ListId']=_0x28c9e1[_0x7450('0x22')];this[_0x7450('0x23')]=_0x28c9e1[_0x7450('0x23')];this['VoiceQueueId']=_0x28c9e1[_0x7450('0x24')];this['CampaignId']=_0x28c9e1['CampaignId'];this['originatecalleridnum']=_0x28c9e1[_0x7450('0x25')]||'';this[_0x7450('0x26')]=_0x28c9e1[_0x7450('0x26')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1509bd9..8c4d8e7 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(_0x3020e0,_0x27a654){var _0x4c9f73=function(_0x2fda49){while(--_0x2fda49){_0x3020e0['push'](_0x3020e0['shift']());}};_0x4c9f73(++_0x27a654);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x45eee1,_0x22aa67){var _0x560f0d=function(_0x250022){while(--_0x250022){_0x45eee1['push'](_0x45eee1['shift']());}};_0x560f0d(++_0x22aa67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 fc7bdd9..0052bd7 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 _0x2da7=['context','from-voip-provider','exten','localstationid','uniqueid','name','info','\x20syncNewchannel\x20','channel','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','variable','operation','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','then','stringify','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','prototype','updateStatus','[Fax][Message][Updated]','finally','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','%s/%s.tif','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','SIP/%s','status','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','util','lodash','bluebird','moment','path','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse'];(function(_0x6989ce,_0x3cb141){var _0x3849fd=function(_0x401ee5){while(--_0x401ee5){_0x6989ce['push'](_0x6989ce['shift']());}};_0x3849fd(++_0x3cb141);}(_0x2da7,0x18d));var _0x72da=function(_0x4ffc63,_0x4ea729){_0x4ffc63=_0x4ffc63-0x0;var _0x1538d6=_0x2da7[_0x4ffc63];return _0x1538d6;};'use strict';var util=require(_0x72da('0x0'));var _=require(_0x72da('0x1'));var BPromise=require(_0x72da('0x2'));var uuid=require('uuid');var moment=require(_0x72da('0x3'));var path=require(_0x72da('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x72da('0x5'));var logger=require(_0x72da('0x6'))(_0x72da('0x7'));var ami=require(_0x72da('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x72da('0x9'));var ut=require(_0x72da('0xa'));var Action=require(_0x72da('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x72da('0xc'));function Fax(_0x21b0a1){this[_0x72da('0xd')]={};this['faxAccounts']=_0x21b0a1[_0x72da('0xe')];this[_0x72da('0xf')]=_0x21b0a1[_0x72da('0xf')];this[_0x72da('0x10')]={};ami['on'](_0x72da('0x11'),this[_0x72da('0x12')][_0x72da('0x13')](this));ami['on']('varset',this[_0x72da('0x14')][_0x72da('0x13')](this));ami['on'](_0x72da('0x15'),this['syncNewState'][_0x72da('0x13')](this));ami['on'](_0x72da('0x16'),this[_0x72da('0x17')]['bind'](this));ami['on'](_0x72da('0x18'),this[_0x72da('0x19')][_0x72da('0x13')](this));ami['on'](_0x72da('0x1a'),this[_0x72da('0x1b')][_0x72da('0x13')](this));ami['on'](_0x72da('0x1c'),this[_0x72da('0x1d')][_0x72da('0x13')](this));ami['on']('originateresponse',this[_0x72da('0x1e')][_0x72da('0x13')](this));}Fax['prototype']['syncNewchannel']=function(_0x64a11e){if(_0x64a11e[_0x72da('0x1f')]===_0x72da('0x20')){for(var _0x32a449 in this[_0x72da('0xe')]){if(this[_0x72da('0xe')]['hasOwnProperty'](_0x32a449)){if(_0x64a11e[_0x72da('0x21')]===this[_0x72da('0xe')][_0x32a449][_0x72da('0x22')]){this[_0x72da('0xd')][_0x64a11e[_0x72da('0x23')]]={};this[_0x72da('0xd')][_0x64a11e[_0x72da('0x23')]]['channel']=_0x64a11e['channel'];this[_0x72da('0xd')][_0x64a11e['uniqueid']]['id']=this[_0x72da('0xe')][_0x32a449]['id'];this[_0x72da('0xd')][_0x64a11e[_0x72da('0x23')]][_0x72da('0x24')]=this[_0x72da('0xe')][_0x32a449][_0x72da('0x24')];logger[_0x72da('0x25')](_0x64a11e[_0x72da('0x23')],_0x72da('0x26'));}}}}if(this[_0x72da('0x10')][_0x64a11e[_0x72da('0x23')]]){this[_0x72da('0xd')][_0x64a11e['uniqueid']]={};this['channels'][_0x64a11e[_0x72da('0x23')]][_0x72da('0x27')]=_0x64a11e[_0x72da('0x27')];logger[_0x72da('0x25')](_0x64a11e[_0x72da('0x23')],_0x72da('0x26'));}};Fax['prototype'][_0x72da('0x14')]=function(_0x50abb8){if(this[_0x72da('0xd')][_0x50abb8[_0x72da('0x23')]]){for(var _0x33705d in _0x50abb8['variable']){if(_0x50abb8['variable'][_0x72da('0x28')](_0x33705d)){this[_0x72da('0xd')][_0x50abb8[_0x72da('0x23')]][_0x33705d]=_0x50abb8[_0x72da('0x29')];}}}};Fax['prototype'][_0x72da('0x2a')]=function(_0x2e12ce){if(this[_0x72da('0xd')][_0x2e12ce['uniqueid']]){this[_0x72da('0xd')][_0x2e12ce[_0x72da('0x23')]][_0x72da('0x2b')]=_0x2e12ce[_0x72da('0x2b')];this[_0x72da('0xd')][_0x2e12ce['uniqueid']][_0x72da('0x2c')]=_0x2e12ce[_0x72da('0x2c')];}};Fax['prototype'][_0x72da('0x17')]=function(_0x5e3bf8){if(this[_0x72da('0xd')][_0x5e3bf8[_0x72da('0x23')]]){for(var _0x47e050 in _0x5e3bf8[_0x72da('0x2d')]){if(_0x5e3bf8[_0x72da('0x2d')]['hasOwnProperty'](_0x47e050)){this[_0x72da('0xd')][_0x5e3bf8[_0x72da('0x23')]][_0x47e050]=_0x5e3bf8[_0x72da('0x29')];}}}};Fax['prototype'][_0x72da('0x19')]=function(_0x5331cd){if(this['channels'][_0x5331cd[_0x72da('0x23')]]){this[_0x72da('0xd')][_0x5331cd[_0x72da('0x23')]]['operation']=_0x5331cd[_0x72da('0x2e')];this['channels'][_0x5331cd['uniqueid']]['status']=_0x5331cd['status'];this[_0x72da('0xd')][_0x5331cd[_0x72da('0x23')]][_0x72da('0x22')]=_0x5331cd[_0x72da('0x22')];this[_0x72da('0xd')][_0x5331cd[_0x72da('0x23')]][_0x72da('0x2f')]=_0x5331cd[_0x72da('0x2f')];logger[_0x72da('0x25')](_0x5331cd['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x72da('0x1b')]=function(_0x2c13ea){var _0x22055e=this;if(this[_0x72da('0xd')][_0x2c13ea['uniqueid']]){var _0x147423=this[_0x72da('0xd')][_0x2c13ea[_0x72da('0x23')]]['id'];this[_0x72da('0xd')][_0x2c13ea[_0x72da('0x23')]][_0x72da('0x30')]=_0x2c13ea['remotestationid'];this[_0x72da('0xd')][_0x2c13ea[_0x72da('0x23')]][_0x72da('0x31')]=_0x2c13ea['pagestransferred'];this[_0x72da('0xd')][_0x2c13ea[_0x72da('0x23')]][_0x72da('0x22')]=_0x2c13ea['localstationid'];this[_0x72da('0xd')][_0x2c13ea[_0x72da('0x23')]][_0x72da('0x32')]=_0x2c13ea[_0x72da('0x32')];this[_0x72da('0xd')][_0x2c13ea[_0x72da('0x23')]][_0x72da('0x33')]=_0x2c13ea[_0x72da('0x33')];this[_0x72da('0xd')][_0x2c13ea['uniqueid']][_0x72da('0x2f')]=_0x2c13ea[_0x72da('0x2f')];this[_0x72da('0xd')][_0x2c13ea[_0x72da('0x23')]][_0x72da('0x34')]=_0x2c13ea['calleridnum'];if(this['channels'][_0x2c13ea[_0x72da('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x2c13ea[_0x72da('0x2f')],_0x72da('0x35'),function(_0x53a39b){logger[_0x72da('0x25')](_0x2c13ea[_0x72da('0x23')],'\x20result\x20conversion\x20file\x20',_0x53a39b[_0x72da('0x36')]);attachment['create']({'name':path[_0x72da('0x37')](_0x2c13ea[_0x72da('0x2f')])['name'],'basename':path[_0x72da('0x37')](_0x2c13ea[_0x72da('0x2f')])[_0x72da('0x24')]+_0x72da('0x38'),'type':'application/pdf'})[_0x72da('0x39')](function(_0xa19bdb){faxAccount['notify'](_0x147423,{'from':_0x2c13ea[_0x72da('0x34')],'mapKey':_0x72da('0x7'),'body':path['parse'](_0x2c13ea[_0x72da('0x2f')])[_0x72da('0x24')]+_0x72da('0x38'),'AttachmentId':_0xa19bdb['id']})['catch'](function(_0x3308c8){logger['error'](_0x2c13ea[_0x72da('0x23')],'\x20notify\x20',JSON[_0x72da('0x3a')](_0x3308c8));});})[_0x72da('0x3b')](function(_0x1be479){logger['error'](_0x2c13ea['uniqueid'],'\x20receiveFax\x20',JSON['stringify'](_0x1be479));});});}logger['info'](_0x2c13ea[_0x72da('0x23')],_0x72da('0x3c'));}};Fax['prototype'][_0x72da('0x1e')]=function(_0x1b51cf){if(this[_0x72da('0x10')][_0x1b51cf[_0x72da('0x23')]]){_[_0x72da('0x3d')](this['channels'][_0x1b51cf['uniqueid']],_[_0x72da('0x3e')](_0x1b51cf,[_0x72da('0x3f'),'reason']));}};function updateStatus(_0x490b99){if(_0x490b99[_0x72da('0x40')]){faxMessage[_0x72da('0x41')](_0x490b99['AttachmentId'],{'failMessage':_0x72da('0x42')})[_0x72da('0x39')](function(_0x3d4897){ut['logger'](_0x72da('0x43'),_0x3d4897);})[_0x72da('0x3b')](function(_0x28668b){ut[_0x72da('0x44')](_0x72da('0x45'),_0x28668b);});}else{ut[_0x72da('0x44')](_0x72da('0x46'));}}Fax[_0x72da('0x47')][_0x72da('0x48')]=function(_0x4c994b,_0x538178,_0x1f8f95){var _0x2d2ba5=this;var _0x3fdde9={};if(_0x538178){_0x3fdde9={'read':_0x538178};}else{_0x3fdde9={'failMessage':_0x1f8f95};}if(this[_0x72da('0x10')][_0x4c994b]['AttachmentId']){faxMessage['update'](this[_0x72da('0x10')][_0x4c994b][_0x72da('0x40')],_0x3fdde9)[_0x72da('0x39')](function(_0x999669){ut[_0x72da('0x44')](_0x72da('0x49'),_0x999669);})['catch'](function(_0x543c05){ut[_0x72da('0x44')]('[Fax][Message][NoUpdate1]',_0x543c05);})[_0x72da('0x4a')](function(){delete _0x2d2ba5['channels'][_0x4c994b];delete _0x2d2ba5[_0x72da('0x10')][_0x4c994b];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x72da('0xd')][_0x4c994b];delete this[_0x72da('0x10')][_0x4c994b];}};Fax['prototype']['syncHangup']=function(_0xa597b0){var _0x3dcff7=this;if(this['channels'][_0xa597b0[_0x72da('0x23')]]){if(this['actions'][_0xa597b0[_0x72da('0x23')]]){this[_0x72da('0xd')][_0xa597b0[_0x72da('0x23')]]['id']=this[_0x72da('0x10')][_0xa597b0[_0x72da('0x23')]]['id'];this[_0x72da('0xd')][_0xa597b0[_0x72da('0x23')]][_0x72da('0x24')]=this['actions'][_0xa597b0[_0x72da('0x23')]][_0x72da('0x24')];}logger[_0x72da('0x25')](_0xa597b0['uniqueid'],this['actions'][_0xa597b0[_0x72da('0x23')]]?'\x20hangup\x20sendFile\x20':_0x72da('0x4b'),JSON[_0x72da('0x3a')](this[_0x72da('0xd')][_0xa597b0[_0x72da('0x23')]]));if(this[_0x72da('0x10')][_0xa597b0[_0x72da('0x23')]]){if(this[_0x72da('0xd')][_0xa597b0[_0x72da('0x23')]][_0x72da('0x4c')]>0x0&&this[_0x72da('0xd')][_0xa597b0['uniqueid']][_0x72da('0x18')]===_0x72da('0x4d')){this[_0x72da('0x48')](_0xa597b0['uniqueid'],!![]);}else{this[_0x72da('0x48')](_0xa597b0[_0x72da('0x23')],![],this['channels'][_0xa597b0[_0x72da('0x23')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0xa597b0[_0x72da('0x23')]][_0x72da('0x4e')]:_0x72da('0x4f'));}}}};Fax[_0x72da('0x47')][_0x72da('0x50')]=function(_0x116e3a){var _0x215eee=this;return new BPromise(function(_0x311e30,_0x2cda2f){_0x215eee['execOriginate'](_0x116e3a,_0x215eee[_0x72da('0xe')][_0x116e3a[_0x72da('0x51')]])[_0x72da('0x39')](function(_0x108a98){ut['logger'](_0x72da('0x52'),_0x108a98);_0x311e30(ut[_0x72da('0x36')](_0x72da('0x53')));})[_0x72da('0x3b')](function(_0x64cd25){ut[_0x72da('0x44')](_0x72da('0x54'),_0x64cd25);updateStatus(_0x116e3a);_0x2cda2f(ut[_0x72da('0x36')](_0x72da('0x55')));});});};Fax[_0x72da('0x47')][_0x72da('0x56')]=function(_0x2b0c7f){var _0x27af4f=this;return new BPromise(function(_0x45089d,_0x4be768){var _0x2fb12c=_0x27af4f[_0x72da('0x57')](_0x27af4f['faxAccounts'][_0x2b0c7f[_0x72da('0x51')]][_0x72da('0x58')],_0x2b0c7f);if(_0x2fb12c[_0x72da('0x59')]){_0x45089d(ut[_0x72da('0x36')]('Trunk\x20Reachable'));}else{_0x4be768(ut[_0x72da('0x36')](_0x2fb12c[_0x72da('0x36')]));}});};function originate(_0x37922a,_0x4304ed,_0x695c98){return new BPromise(function(_0x2be75c,_0x18f9c4){if(_0x695c98){var _0x5a8877=util[_0x72da('0x5a')]('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[_0x72da('0x37')](_0x37922a[_0x72da('0x4')])[_0x72da('0x24')],_0x37922a[_0x72da('0x4')]);gs['execute'](_0x5a8877)[_0x72da('0x39')](function(){_0x37922a[_0x72da('0x4')]=util['format'](_0x72da('0x5b'),path[_0x72da('0x37')](_0x37922a[_0x72da('0x4')])['dir'],path[_0x72da('0x37')](_0x37922a[_0x72da('0x4')])['name']);_0x4304ed[_0x72da('0x5c')]=_0x37922a['path'];ut[_0x72da('0x44')]('Convert\x20pdf\x20to\x20tif','');ami[_0x72da('0x5d')](ut[_0x72da('0x5e')](_0x37922a,_0x4304ed))['then'](function(_0x4cd77a){_0x2be75c(_0x4cd77a);})[_0x72da('0x3b')](function(_0x344bd9){_0x18f9c4(_0x344bd9);});})[_0x72da('0x3b')](function(_0x5c92b6){_0x18f9c4(_0x5c92b6);});}else{ami['Action'](ut[_0x72da('0x5e')](_0x37922a,_0x4304ed))['then'](function(_0x3565ca){_0x2be75c(_0x3565ca);})['catch'](function(_0x29b693){_0x18f9c4(_0x29b693);});}});}Fax[_0x72da('0x47')][_0x72da('0x5f')]=function(_0x43867f,_0x2ef135){var _0x189b82=this;return new BPromise(function(_0x3298b3,_0x3b79b2){var _0x14838e=uuid['v4']();var _0x50d83b=ut[_0x72da('0x60')](_0x43867f,_0x2ef135);_0x189b82[_0x72da('0x10')][_0x14838e]=new Action(_0x14838e,_0x2ef135,_0x43867f);var _0x3820a3=_0x189b82['actions'][_0x14838e];if(path[_0x72da('0x37')](_0x43867f[_0x72da('0x4')])[_0x72da('0x61')]===_0x72da('0x38')){originate(_0x3820a3,_0x50d83b,!![])[_0x72da('0x39')](function(_0x84b995){_0x3298b3(_0x84b995);})['catch'](function(_0x27ddde){_0x3b79b2(_0x27ddde);});}else{originate(_0x3820a3,_0x50d83b,![])[_0x72da('0x39')](function(_0x150843){_0x3298b3(_0x150843);})[_0x72da('0x3b')](function(_0x253604){_0x3b79b2(_0x253604);});}});};Fax[_0x72da('0x47')][_0x72da('0x62')]=function(_0x330be7){return!_[_0x72da('0x63')](_0x330be7)&&!_[_0x72da('0x63')](_0x330be7[_0x72da('0x24')])&&!_['isNil'](_0x330be7['active'])&&_0x330be7['active']&&!_[_0x72da('0x63')](this[_0x72da('0xf')][util[_0x72da('0x5a')](_0x72da('0x64'),_0x330be7[_0x72da('0x24')])])&&!_[_0x72da('0x63')](this[_0x72da('0xf')][util[_0x72da('0x5a')](_0x72da('0x64'),_0x330be7[_0x72da('0x24')])][_0x72da('0x65')])&&(this[_0x72da('0xf')][util[_0x72da('0x5a')](_0x72da('0x64'),_0x330be7[_0x72da('0x24')])][_0x72da('0x65')]===_0x72da('0x66')||this[_0x72da('0xf')][util[_0x72da('0x5a')](_0x72da('0x64'),_0x330be7[_0x72da('0x24')])]['status']==='unmonitored');};Fax[_0x72da('0x47')][_0x72da('0x57')]=function(_0x3bf9df,_0x22a54d){if(!this[_0x72da('0x62')](_0x3bf9df)){ut[_0x72da('0x44')](_0x72da('0x67'),_[_0x72da('0x63')](_0x3bf9df)?'':_0x3bf9df['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x72da('0x63')](_0x22a54d[_0x72da('0x7')])){ut['logger'](_0x72da('0x68'),JSON[_0x72da('0x3a')](_0x22a54d));return{'isValid':![],'message':_0x72da('0x69')};}if(_[_0x72da('0x63')](_0x22a54d[_0x72da('0x4')])){ut[_0x72da('0x44')](_0x72da('0x6a'),JSON[_0x72da('0x3a')](_0x22a54d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0xc2ed=['isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','syncNewchannel','varset','syncVarSet','newstate','syncNewState','newexten','bind','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','actions','merge','response','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','stringify','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','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','format','XMF-PATH','Action','variablesAction','execOriginate','addVariables'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xc2ed,0xfa));var _0xdc2e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xc2ed[_0xf50820];return _0x2a9b10;};'use strict';var util=require(_0xdc2e('0x0'));var _=require(_0xdc2e('0x1'));var BPromise=require(_0xdc2e('0x2'));var uuid=require(_0xdc2e('0x3'));var moment=require(_0xdc2e('0x4'));var path=require(_0xdc2e('0x5'));var tiff2pdf=require(_0xdc2e('0x6'));var gs=require('./util/gs');var logger=require(_0xdc2e('0x7'))(_0xdc2e('0x8'));var ami=require('../ami');var rpcDb=require(_0xdc2e('0x9'));var Channel=require(_0xdc2e('0xa'));var ut=require(_0xdc2e('0xb'));var Action=require(_0xdc2e('0xc'));var faxAccount=require(_0xdc2e('0xd'));var attachment=require(_0xdc2e('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x3874ca){this[_0xdc2e('0xf')]={};this[_0xdc2e('0x10')]=_0x3874ca[_0xdc2e('0x10')];this[_0xdc2e('0x11')]=_0x3874ca[_0xdc2e('0x11')];this['actions']={};ami['on']('newchannel',this[_0xdc2e('0x12')]['bind'](this));ami['on'](_0xdc2e('0x13'),this[_0xdc2e('0x14')]['bind'](this));ami['on'](_0xdc2e('0x15'),this[_0xdc2e('0x16')]['bind'](this));ami['on'](_0xdc2e('0x17'),this['syncNewExten'][_0xdc2e('0x18')](this));ami['on']('faxstatus',this[_0xdc2e('0x19')][_0xdc2e('0x18')](this));ami['on'](_0xdc2e('0x1a'),this[_0xdc2e('0x1b')][_0xdc2e('0x18')](this));ami['on'](_0xdc2e('0x1c'),this[_0xdc2e('0x1d')][_0xdc2e('0x18')](this));ami['on'](_0xdc2e('0x1e'),this[_0xdc2e('0x1f')][_0xdc2e('0x18')](this));}Fax[_0xdc2e('0x20')][_0xdc2e('0x12')]=function(_0x5c7c57){if(_0x5c7c57[_0xdc2e('0x21')]===_0xdc2e('0x22')){for(var _0x1773fe in this['faxAccounts']){if(this[_0xdc2e('0x10')][_0xdc2e('0x23')](_0x1773fe)){if(_0x5c7c57['exten']===this[_0xdc2e('0x10')][_0x1773fe][_0xdc2e('0x24')]){this[_0xdc2e('0xf')][_0x5c7c57[_0xdc2e('0x25')]]={};this[_0xdc2e('0xf')][_0x5c7c57['uniqueid']][_0xdc2e('0x26')]=_0x5c7c57[_0xdc2e('0x26')];this[_0xdc2e('0xf')][_0x5c7c57[_0xdc2e('0x25')]]['id']=this['faxAccounts'][_0x1773fe]['id'];this[_0xdc2e('0xf')][_0x5c7c57[_0xdc2e('0x25')]]['name']=this[_0xdc2e('0x10')][_0x1773fe][_0xdc2e('0x27')];logger[_0xdc2e('0x28')](_0x5c7c57[_0xdc2e('0x25')],_0xdc2e('0x29'));}}}}if(this['actions'][_0x5c7c57['uniqueid']]){this[_0xdc2e('0xf')][_0x5c7c57[_0xdc2e('0x25')]]={};this[_0xdc2e('0xf')][_0x5c7c57[_0xdc2e('0x25')]][_0xdc2e('0x26')]=_0x5c7c57[_0xdc2e('0x26')];logger['info'](_0x5c7c57[_0xdc2e('0x25')],_0xdc2e('0x29'));}};Fax[_0xdc2e('0x20')][_0xdc2e('0x14')]=function(_0x43498a){if(this[_0xdc2e('0xf')][_0x43498a['uniqueid']]){for(var _0x280c7c in _0x43498a[_0xdc2e('0x2a')]){if(_0x43498a['variable']['hasOwnProperty'](_0x280c7c)){this[_0xdc2e('0xf')][_0x43498a[_0xdc2e('0x25')]][_0x280c7c]=_0x43498a['value'];}}}};Fax[_0xdc2e('0x20')][_0xdc2e('0x16')]=function(_0x17a63f){if(this[_0xdc2e('0xf')][_0x17a63f[_0xdc2e('0x25')]]){this[_0xdc2e('0xf')][_0x17a63f[_0xdc2e('0x25')]][_0xdc2e('0x2b')]=_0x17a63f[_0xdc2e('0x2b')];this[_0xdc2e('0xf')][_0x17a63f[_0xdc2e('0x25')]][_0xdc2e('0x2c')]=_0x17a63f[_0xdc2e('0x2c')];}};Fax[_0xdc2e('0x20')]['syncNewExten']=function(_0x44305b){if(this[_0xdc2e('0xf')][_0x44305b[_0xdc2e('0x25')]]){for(var _0x17b24a in _0x44305b['variable']){if(_0x44305b[_0xdc2e('0x2a')][_0xdc2e('0x23')](_0x17b24a)){this[_0xdc2e('0xf')][_0x44305b[_0xdc2e('0x25')]][_0x17b24a]=_0x44305b['value'];}}}};Fax[_0xdc2e('0x20')]['syncFaxStatus']=function(_0x11ae28){if(this[_0xdc2e('0xf')][_0x11ae28[_0xdc2e('0x25')]]){this['channels'][_0x11ae28[_0xdc2e('0x25')]][_0xdc2e('0x2d')]=_0x11ae28['operation'];this[_0xdc2e('0xf')][_0x11ae28[_0xdc2e('0x25')]]['status']=_0x11ae28[_0xdc2e('0x2e')];this[_0xdc2e('0xf')][_0x11ae28[_0xdc2e('0x25')]][_0xdc2e('0x24')]=_0x11ae28[_0xdc2e('0x24')];this[_0xdc2e('0xf')][_0x11ae28[_0xdc2e('0x25')]]['filename']=_0x11ae28[_0xdc2e('0x2f')];logger[_0xdc2e('0x28')](_0x11ae28[_0xdc2e('0x25')],_0xdc2e('0x30'));}};Fax[_0xdc2e('0x20')][_0xdc2e('0x1b')]=function(_0x49db5e){var _0x3261fd=this;if(this[_0xdc2e('0xf')][_0x49db5e[_0xdc2e('0x25')]]){var _0x2a9f6e=this[_0xdc2e('0xf')][_0x49db5e[_0xdc2e('0x25')]]['id'];this[_0xdc2e('0xf')][_0x49db5e[_0xdc2e('0x25')]][_0xdc2e('0x31')]=_0x49db5e[_0xdc2e('0x31')];this[_0xdc2e('0xf')][_0x49db5e[_0xdc2e('0x25')]][_0xdc2e('0x32')]=_0x49db5e[_0xdc2e('0x32')];this[_0xdc2e('0xf')][_0x49db5e[_0xdc2e('0x25')]][_0xdc2e('0x24')]=_0x49db5e[_0xdc2e('0x24')];this[_0xdc2e('0xf')][_0x49db5e['uniqueid']][_0xdc2e('0x33')]=_0x49db5e['resolution'];this[_0xdc2e('0xf')][_0x49db5e['uniqueid']][_0xdc2e('0x34')]=_0x49db5e[_0xdc2e('0x34')];this['channels'][_0x49db5e[_0xdc2e('0x25')]][_0xdc2e('0x2f')]=_0x49db5e[_0xdc2e('0x2f')];this[_0xdc2e('0xf')][_0x49db5e['uniqueid']]['calleridnum']=_0x49db5e[_0xdc2e('0x35')];if(this['channels'][_0x49db5e[_0xdc2e('0x25')]][_0xdc2e('0x32')]>0x0){tiff2pdf(_0x49db5e[_0xdc2e('0x2f')],_0xdc2e('0x36'),function(_0x5a62a7){logger[_0xdc2e('0x28')](_0x49db5e['uniqueid'],_0xdc2e('0x37'),_0x5a62a7[_0xdc2e('0x38')]);attachment[_0xdc2e('0x39')]({'name':path['parse'](_0x49db5e[_0xdc2e('0x2f')])[_0xdc2e('0x27')],'basename':path[_0xdc2e('0x3a')](_0x49db5e[_0xdc2e('0x2f')])[_0xdc2e('0x27')]+_0xdc2e('0x3b'),'type':'application/pdf'})['then'](function(_0x388542){faxAccount[_0xdc2e('0x3c')](_0x2a9f6e,{'from':_0x49db5e[_0xdc2e('0x35')],'mapKey':_0xdc2e('0x8'),'body':path['parse'](_0x49db5e[_0xdc2e('0x2f')])[_0xdc2e('0x27')]+'.pdf','AttachmentId':_0x388542['id']})[_0xdc2e('0x3d')](function(_0x462d52){logger[_0xdc2e('0x3e')](_0x49db5e[_0xdc2e('0x25')],_0xdc2e('0x3f'),JSON['stringify'](_0x462d52));});})[_0xdc2e('0x3d')](function(_0x29be04){logger[_0xdc2e('0x3e')](_0x49db5e[_0xdc2e('0x25')],_0xdc2e('0x40'),JSON['stringify'](_0x29be04));});});}logger['info'](_0x49db5e[_0xdc2e('0x25')],_0xdc2e('0x40'));}};Fax[_0xdc2e('0x20')][_0xdc2e('0x1f')]=function(_0x2e811a){if(this[_0xdc2e('0x41')][_0x2e811a[_0xdc2e('0x25')]]){_[_0xdc2e('0x42')](this['channels'][_0x2e811a['uniqueid']],_['pick'](_0x2e811a,[_0xdc2e('0x43'),'reason']));}};function updateStatus(_0x2f3d38){if(_0x2f3d38[_0xdc2e('0x44')]){faxMessage[_0xdc2e('0x45')](_0x2f3d38[_0xdc2e('0x44')],{'failMessage':_0xdc2e('0x46')})[_0xdc2e('0x47')](function(_0x8f48d4){ut[_0xdc2e('0x48')]('[Fax][Message][Error][Updated]',_0x8f48d4);})['catch'](function(_0x4ff61f){ut[_0xdc2e('0x48')](_0xdc2e('0x49'),_0x4ff61f);});}else{ut[_0xdc2e('0x48')](_0xdc2e('0x4a'));}}Fax[_0xdc2e('0x20')]['updateStatus']=function(_0x35b17b,_0x44edd4,_0x495a96){var _0x22a701=this;var _0x2329f0={};if(_0x44edd4){_0x2329f0={'read':_0x44edd4};}else{_0x2329f0={'failMessage':_0x495a96};}if(this[_0xdc2e('0x41')][_0x35b17b][_0xdc2e('0x44')]){faxMessage['update'](this['actions'][_0x35b17b][_0xdc2e('0x44')],_0x2329f0)[_0xdc2e('0x47')](function(_0x3d747f){ut['logger'](_0xdc2e('0x4b'),_0x3d747f);})[_0xdc2e('0x3d')](function(_0x214ca7){ut['logger'](_0xdc2e('0x4c'),_0x214ca7);})[_0xdc2e('0x4d')](function(){delete _0x22a701['channels'][_0x35b17b];delete _0x22a701[_0xdc2e('0x41')][_0x35b17b];});}else{ut['logger'](_0xdc2e('0x4e'));delete this[_0xdc2e('0xf')][_0x35b17b];delete this[_0xdc2e('0x41')][_0x35b17b];}};Fax[_0xdc2e('0x20')][_0xdc2e('0x1d')]=function(_0x365edb){var _0x2fda7f=this;if(this[_0xdc2e('0xf')][_0x365edb[_0xdc2e('0x25')]]){if(this['actions'][_0x365edb[_0xdc2e('0x25')]]){this[_0xdc2e('0xf')][_0x365edb[_0xdc2e('0x25')]]['id']=this[_0xdc2e('0x41')][_0x365edb['uniqueid']]['id'];this[_0xdc2e('0xf')][_0x365edb[_0xdc2e('0x25')]][_0xdc2e('0x27')]=this[_0xdc2e('0x41')][_0x365edb[_0xdc2e('0x25')]][_0xdc2e('0x27')];}logger[_0xdc2e('0x28')](_0x365edb[_0xdc2e('0x25')],this[_0xdc2e('0x41')][_0x365edb['uniqueid']]?_0xdc2e('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0xdc2e('0x50')](this[_0xdc2e('0xf')][_0x365edb['uniqueid']]));if(this['actions'][_0x365edb[_0xdc2e('0x25')]]){if(this[_0xdc2e('0xf')][_0x365edb[_0xdc2e('0x25')]][_0xdc2e('0x51')]>0x0&&this[_0xdc2e('0xf')][_0x365edb[_0xdc2e('0x25')]]['faxstatus']===_0xdc2e('0x52')){this[_0xdc2e('0x53')](_0x365edb[_0xdc2e('0x25')],!![]);}else{this[_0xdc2e('0x53')](_0x365edb[_0xdc2e('0x25')],![],this[_0xdc2e('0xf')][_0x365edb[_0xdc2e('0x25')]][_0xdc2e('0x54')]?_0xdc2e('0x55')+this[_0xdc2e('0xf')][_0x365edb['uniqueid']][_0xdc2e('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xdc2e('0x20')][_0xdc2e('0x56')]=function(_0xc55e6c){var _0x142698=this;return new BPromise(function(_0x2ba680,_0x557869){_0x142698['execOriginate'](_0xc55e6c,_0x142698[_0xdc2e('0x10')][_0xc55e6c['FaxAccountId']])[_0xdc2e('0x47')](function(_0x58772e){ut[_0xdc2e('0x48')](_0xdc2e('0x57'),_0x58772e);_0x2ba680(ut['message']('Fax\x20received'));})['catch'](function(_0x156ae2){ut[_0xdc2e('0x48')](_0xdc2e('0x58'),_0x156ae2);updateStatus(_0xc55e6c);_0x557869(ut[_0xdc2e('0x38')](_0xdc2e('0x59')));});});};Fax[_0xdc2e('0x20')][_0xdc2e('0x5a')]=function(_0x2b3b58){var _0x845dfe=this;return new BPromise(function(_0x5e6895,_0xcbbb8f){var _0xb88047=_0x845dfe[_0xdc2e('0x5b')](_0x845dfe[_0xdc2e('0x10')][_0x2b3b58[_0xdc2e('0x5c')]][_0xdc2e('0x5d')],_0x2b3b58);if(_0xb88047[_0xdc2e('0x5e')]){_0x5e6895(ut['message'](_0xdc2e('0x5f')));}else{_0xcbbb8f(ut[_0xdc2e('0x38')](_0xb88047[_0xdc2e('0x38')]));}});};function originate(_0xb55595,_0x6f8b78,_0x1b3534){return new BPromise(function(_0x83461e,_0x1ee83a){if(_0x1b3534){var _0x1eac50=util['format'](_0xdc2e('0x60'),path[_0xdc2e('0x3a')](_0xb55595['path'])[_0xdc2e('0x27')],_0xb55595[_0xdc2e('0x5')]);gs[_0xdc2e('0x61')](_0x1eac50)[_0xdc2e('0x47')](function(){_0xb55595[_0xdc2e('0x5')]=util[_0xdc2e('0x62')]('%s/%s.tif',path['parse'](_0xb55595[_0xdc2e('0x5')])['dir'],path[_0xdc2e('0x3a')](_0xb55595[_0xdc2e('0x5')])[_0xdc2e('0x27')]);_0x6f8b78[_0xdc2e('0x63')]=_0xb55595[_0xdc2e('0x5')];ut[_0xdc2e('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0xdc2e('0x64')](ut[_0xdc2e('0x65')](_0xb55595,_0x6f8b78))[_0xdc2e('0x47')](function(_0x1cc300){_0x83461e(_0x1cc300);})[_0xdc2e('0x3d')](function(_0x2d4ef7){_0x1ee83a(_0x2d4ef7);});})['catch'](function(_0x3a0834){_0x1ee83a(_0x3a0834);});}else{ami[_0xdc2e('0x64')](ut[_0xdc2e('0x65')](_0xb55595,_0x6f8b78))['then'](function(_0x4724f0){_0x83461e(_0x4724f0);})['catch'](function(_0x35e84e){_0x1ee83a(_0x35e84e);});}});}Fax[_0xdc2e('0x20')][_0xdc2e('0x66')]=function(_0x3aeb01,_0x41e778){var _0x2f0d87=this;return new BPromise(function(_0x23a0b3,_0x5a1bc0){var _0x4f7bf2=uuid['v4']();var _0x4cee22=ut[_0xdc2e('0x67')](_0x3aeb01,_0x41e778);_0x2f0d87[_0xdc2e('0x41')][_0x4f7bf2]=new Action(_0x4f7bf2,_0x41e778,_0x3aeb01);var _0xdaf905=_0x2f0d87[_0xdc2e('0x41')][_0x4f7bf2];if(path[_0xdc2e('0x3a')](_0x3aeb01[_0xdc2e('0x5')])['ext']===_0xdc2e('0x3b')){originate(_0xdaf905,_0x4cee22,!![])[_0xdc2e('0x47')](function(_0x4c4b09){_0x23a0b3(_0x4c4b09);})[_0xdc2e('0x3d')](function(_0x346380){_0x5a1bc0(_0x346380);});}else{originate(_0xdaf905,_0x4cee22,![])[_0xdc2e('0x47')](function(_0x1e9898){_0x23a0b3(_0x1e9898);})[_0xdc2e('0x3d')](function(_0x4a287b){_0x5a1bc0(_0x4a287b);});}});};Fax[_0xdc2e('0x20')][_0xdc2e('0x68')]=function(_0x52c12f){return!_[_0xdc2e('0x69')](_0x52c12f)&&!_[_0xdc2e('0x69')](_0x52c12f[_0xdc2e('0x27')])&&!_['isNil'](_0x52c12f[_0xdc2e('0x6a')])&&_0x52c12f['active']&&!_[_0xdc2e('0x69')](this['trunks'][util[_0xdc2e('0x62')](_0xdc2e('0x6b'),_0x52c12f['name'])])&&!_[_0xdc2e('0x69')](this['trunks'][util[_0xdc2e('0x62')](_0xdc2e('0x6b'),_0x52c12f[_0xdc2e('0x27')])][_0xdc2e('0x2e')])&&(this[_0xdc2e('0x11')][util[_0xdc2e('0x62')](_0xdc2e('0x6b'),_0x52c12f[_0xdc2e('0x27')])][_0xdc2e('0x2e')]===_0xdc2e('0x6c')||this['trunks'][util[_0xdc2e('0x62')](_0xdc2e('0x6b'),_0x52c12f['name'])]['status']===_0xdc2e('0x6d'));};Fax[_0xdc2e('0x20')]['checkTrunk']=function(_0xd74d81,_0x5862d6){if(!this[_0xdc2e('0x68')](_0xd74d81)){ut[_0xdc2e('0x48')](_0xdc2e('0x6e'),_[_0xdc2e('0x69')](_0xd74d81)?'':_0xd74d81[_0xdc2e('0x27')]+_0xdc2e('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xdc2e('0x69')](_0x5862d6[_0xdc2e('0x8')])){ut[_0xdc2e('0x48')](_0xdc2e('0x70'),JSON['stringify'](_0x5862d6));return{'isValid':![],'message':_0xdc2e('0x71')};}if(_['isNil'](_0x5862d6['path'])){ut[_0xdc2e('0x48')](_0xdc2e('0x72'),JSON[_0xdc2e('0x50')](_0x5862d6));return{'isValid':![],'message':_0xdc2e('0x73')};}return{'isValid':!![],'message':_0xdc2e('0x74')};};module[_0xdc2e('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index be6edd0..c86ef59 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 _0x0e40=['error','inspect','resolve','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x0e40,0x9c));var _0x00e4=function(_0x6c5a72,_0x2d576d){_0x6c5a72=_0x6c5a72-0x0;var _0xc4f6c5=_0x0e40[_0x6c5a72];return _0xc4f6c5;};'use strict';var util=require('util');var BPromise=require(_0x00e4('0x0'));var logger=require(_0x00e4('0x1'))(_0x00e4('0x2'));var _=require(_0x00e4('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x568d17){return function(_0xf4afa2){logger[_0x00e4('0x4')](_0x568d17,util[_0x00e4('0x5')](_0xf4afa2,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x59eda3,_0xafb0a8){return BPromise[_0x00e4('0x6')]()[_0x00e4('0x7')](faxAccount['notify'](_0x59eda3,_0xafb0a8))[_0x00e4('0x8')](loggerCatch(_0x00e4('0x9')));}; \ No newline at end of file +var _0x1216=['inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','lodash','../rpc/faxAccount','error'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x1216,0x95));var _0x6121=function(_0x20efe6,_0x2d6285){_0x20efe6=_0x20efe6-0x0;var _0x2680c2=_0x1216[_0x20efe6];return _0x2680c2;};'use strict';var util=require(_0x6121('0x0'));var BPromise=require(_0x6121('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x6121('0x2'));var faxAccount=require(_0x6121('0x3'));function loggerCatch(_0x4e4124){return function(_0x5ce0b4){logger[_0x6121('0x4')](_0x4e4124,util[_0x6121('0x5')](_0x5ce0b4,{'showHidden':![],'depth':null}));};}exports[_0x6121('0x6')]=function(_0x17ad5d,_0x465e42){return BPromise[_0x6121('0x7')]()[_0x6121('0x8')](faxAccount[_0x6121('0x6')](_0x17ad5d,_0x465e42))[_0x6121('0x9')](loggerCatch(_0x6121('0xa')));}; \ 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 b20ed87..e13a5bc 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 _0xfae9=['Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','child_process','exec','execute','info'];(function(_0x5353a7,_0x35c20f){var _0x2c86ac=function(_0x105d9e){while(--_0x105d9e){_0x5353a7['push'](_0x5353a7['shift']());}};_0x2c86ac(++_0x35c20f);}(_0xfae9,0x14b));var _0x9fae=function(_0x519cc4,_0x59d532){_0x519cc4=_0x519cc4-0x0;var _0x34f572=_0xfae9[_0x519cc4];return _0x34f572;};'use strict';var util=require('util');var logger=require(_0x9fae('0x0'))('fax');var BPromise=require('bluebird');var exec=require(_0x9fae('0x1'))[_0x9fae('0x2')];exports[_0x9fae('0x3')]=function(_0x4786c3){return new BPromise(function(_0x43da8d,_0x36ff3a){exec(_0x4786c3,function(_0x1c7dac,_0x13854f,_0x1cc9fc){logger[_0x9fae('0x4')](_0x9fae('0x5'),_0x13854f);if(_0x1c7dac){logger[_0x9fae('0x4')](_0x9fae('0x5'),_0x9fae('0x6'),util[_0x9fae('0x7')](_0x1c7dac,{'showHidden':![],'depth':null}),_0x13854f,_0x1cc9fc);_0x36ff3a(_0x1c7dac);}_0x43da8d(_0x13854f);});});}; \ No newline at end of file +var _0x6ce9=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','fax'];(function(_0x521dec,_0x3c9973){var _0x1d855c=function(_0x5537d9){while(--_0x5537d9){_0x521dec['push'](_0x521dec['shift']());}};_0x1d855c(++_0x3c9973);}(_0x6ce9,0x11e));var _0x96ce=function(_0xd2479f,_0x1d6196){_0xd2479f=_0xd2479f-0x0;var _0x11461f=_0x6ce9[_0xd2479f];return _0x11461f;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x96ce('0x0'));var BPromise=require('bluebird');var exec=require('child_process')[_0x96ce('0x1')];exports[_0x96ce('0x2')]=function(_0x1babad){return new BPromise(function(_0x15bf03,_0x4fb954){exec(_0x1babad,function(_0x1ae325,_0x3005ae,_0x3e93ce){logger[_0x96ce('0x3')](_0x96ce('0x4'),_0x3005ae);if(_0x1ae325){logger[_0x96ce('0x3')]('Exec\x20gs',_0x96ce('0x5'),util[_0x96ce('0x6')](_0x1ae325,{'showHidden':![],'depth':null}),_0x3005ae,_0x3e93ce);_0x4fb954(_0x1ae325);}_0x15bf03(_0x3005ae);});});}; \ 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 ef2ede8..e24a8da 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 _0xe1df=['uniqueid','originate','channel','xcally-motion-fax','from-sip','headerinfo','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','path','variablesAction'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe1df,0x17d));var _0xfe1d=function(_0x839f4f,_0x43ff39){_0x839f4f=_0x839f4f-0x0;var _0x306b83=_0xe1df[_0x839f4f];return _0x306b83;};'use strict';var util=require(_0xfe1d('0x0'));var _=require(_0xfe1d('0x1'));var moment=require(_0xfe1d('0x2'));var logger=require(_0xfe1d('0x3'))(_0xfe1d('0x4'));exports['message']=function(_0x4845ae){return{'message':_0x4845ae};};exports[_0xfe1d('0x5')]=function(_0x3847d6,_0x45ff62){logger[_0xfe1d('0x6')](_0x3847d6,util[_0xfe1d('0x7')](_0x45ff62,{'showHidden':![],'depth':null}));};exports[_0xfe1d('0x8')]=function(_0x3ee379,_0xb28137){var _0x2b5d2f={'XMF-ECM':_0xb28137[_0xfe1d('0x9')],'XMF-HEADERINFO':_0xb28137['headerinfo'],'XMF-MINRATE':_0xb28137[_0xfe1d('0xa')],'XMF-MAXRATE':_0xb28137[_0xfe1d('0xb')],'XMF-MODEM':util[_0xfe1d('0xc')]('\x22%s\x22',_0xb28137[_0xfe1d('0xd')]),'XMF-GATEWAY':_0xb28137[_0xfe1d('0xe')],'XMF-FAXDETECT':_0xb28137[_0xfe1d('0xf')],'XMF-T38TIMEOUT':_0xb28137[_0xfe1d('0x10')],'XMF-LOCALSTATIONID':_0xb28137['localstationid'],'XMF-PATH':_0x3ee379[_0xfe1d('0x11')]};return _0x2b5d2f;};exports[_0xfe1d('0x12')]=function(_0x1ac111,_0xccc3df){return{'actionid':_0x1ac111[_0xfe1d('0x13')],'action':_0xfe1d('0x14'),'channel':_0x1ac111[_0xfe1d('0x15')],'Exten':_0xfe1d('0x16'),'Context':_0xfe1d('0x17'),'Priority':'1','callerid':util[_0xfe1d('0xc')]('\x22%s\x22\x20<%s>',_0x1ac111[_0xfe1d('0x18')]?_0x1ac111['headerinfo']:'',_0x1ac111['localstationid']),'variable':_0xccc3df,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1ac111['uniqueid']};}; \ No newline at end of file +var _0x6087=['gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','from-sip','localstationid','util','lodash','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem'];(function(_0xc57775,_0x9b0cc6){var _0x25e666=function(_0x1f23af){while(--_0x1f23af){_0xc57775['push'](_0xc57775['shift']());}};_0x25e666(++_0x9b0cc6);}(_0x6087,0x7b));var _0x7608=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6087[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x7608('0x0'));var _=require(_0x7608('0x1'));var moment=require('moment');var logger=require(_0x7608('0x2'))(_0x7608('0x3'));exports[_0x7608('0x4')]=function(_0x29d6cd){return{'message':_0x29d6cd};};exports[_0x7608('0x5')]=function(_0x5b6041,_0x2d9883){logger[_0x7608('0x6')](_0x5b6041,util[_0x7608('0x7')](_0x2d9883,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x293da4,_0x4a12ad){var _0x1e3247={'XMF-ECM':_0x4a12ad[_0x7608('0x8')],'XMF-HEADERINFO':_0x4a12ad[_0x7608('0x9')],'XMF-MINRATE':_0x4a12ad[_0x7608('0xa')],'XMF-MAXRATE':_0x4a12ad[_0x7608('0xb')],'XMF-MODEM':util[_0x7608('0xc')](_0x7608('0xd'),_0x4a12ad[_0x7608('0xe')]),'XMF-GATEWAY':_0x4a12ad[_0x7608('0xf')],'XMF-FAXDETECT':_0x4a12ad[_0x7608('0x10')],'XMF-T38TIMEOUT':_0x4a12ad[_0x7608('0x11')],'XMF-LOCALSTATIONID':_0x4a12ad['localstationid'],'XMF-PATH':_0x293da4[_0x7608('0x12')]};return _0x1e3247;};exports[_0x7608('0x13')]=function(_0x32407d,_0x231f18){return{'actionid':_0x32407d[_0x7608('0x14')],'action':'originate','channel':_0x32407d['channel'],'Exten':'xcally-motion-fax','Context':_0x7608('0x15'),'Priority':'1','callerid':util[_0x7608('0xc')]('\x22%s\x22\x20<%s>',_0x32407d['headerinfo']?_0x32407d[_0x7608('0x9')]:'',_0x32407d[_0x7608('0x16')]),'variable':_0x231f18,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x32407d[_0x7608('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0221552..7266028 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 _0x218c=['initTriggers','getTemplates','initTemplates','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','listen','sync','catch','bluebird','util','moment','./server','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers'];(function(_0x2fcfaf,_0x5a8cad){var _0x1300f6=function(_0x329f35){while(--_0x329f35){_0x2fcfaf['push'](_0x2fcfaf['shift']());}};_0x1300f6(++_0x5a8cad);}(_0x218c,0x139));var _0xc218=function(_0x4d64d0,_0x11d5bb){_0x4d64d0=_0x4d64d0-0x0;var _0x246aa2=_0x218c[_0x4d64d0];return _0x246aa2;};'use strict';var BPromise=require(_0xc218('0x0'));var util=require(_0xc218('0x1'));var moment=require(_0xc218('0x2'));var server=require(_0xc218('0x3'));var Realtime=require('./realtime');var Report=require(_0xc218('0x4'));var Acw=require(_0xc218('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xc218('0x6'));var Preview=require(_0xc218('0x7'));var Fax=require(_0xc218('0x8'));var user=require(_0xc218('0x9'));var voiceQueue=require(_0xc218('0xa'));var voiceQueueReport=require(_0xc218('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xc218('0xc'));var trigger=require(_0xc218('0xd'));var template=require(_0xc218('0xe'));var cmHopperHistory=require(_0xc218('0xf'));var campaign=require(_0xc218('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc218('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xc218('0x12'));var desk=require(_0xc218('0x13'));var zoho=require(_0xc218('0x14'));var vtiger=require(_0xc218('0x15'));var freshsales=require(_0xc218('0x16'));var servicenow=require(_0xc218('0x17'));var dynamics365=require(_0xc218('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'](_0xc218('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc218('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc218('0x1a')]()[_0xc218('0x1b')](user[_0xc218('0x1c')]())[_0xc218('0x1b')](realtime[_0xc218('0x1d')]())[_0xc218('0x1b')](user[_0xc218('0x1e')]())['then'](realtime[_0xc218('0x1f')]())[_0xc218('0x1b')](trunk[_0xc218('0x20')]())[_0xc218('0x1b')](realtime[_0xc218('0x21')]())[_0xc218('0x1b')](voiceQueue[_0xc218('0x22')]())[_0xc218('0x1b')](realtime[_0xc218('0x23')]())[_0xc218('0x1b')](trigger[_0xc218('0x24')]())[_0xc218('0x1b')](realtime[_0xc218('0x25')]())[_0xc218('0x1b')](template[_0xc218('0x26')]())['then'](realtime[_0xc218('0x27')]())[_0xc218('0x1b')](zendesk['getZendeskAccounts']())[_0xc218('0x1b')](realtime['initZendeskAccounts']())['then'](salesforce['getSalesforceAccounts']())[_0xc218('0x1b')](realtime[_0xc218('0x28')]())[_0xc218('0x1b')](sugarcrm[_0xc218('0x29')]())['then'](realtime['initSugarcrmAccounts']())[_0xc218('0x1b')](freshdesk[_0xc218('0x2a')]())['then'](realtime[_0xc218('0x2b')]())[_0xc218('0x1b')](desk[_0xc218('0x2c')]())[_0xc218('0x1b')](realtime[_0xc218('0x2d')]())[_0xc218('0x1b')](zoho[_0xc218('0x2e')]())[_0xc218('0x1b')](realtime[_0xc218('0x2f')]())[_0xc218('0x1b')](vtiger[_0xc218('0x30')]())['then'](realtime[_0xc218('0x31')]())[_0xc218('0x1b')](freshsales[_0xc218('0x32')]())[_0xc218('0x1b')](realtime[_0xc218('0x33')]())['then'](servicenow['getServicenowAccounts']())[_0xc218('0x1b')](realtime[_0xc218('0x34')]())[_0xc218('0x1b')](dynamics365[_0xc218('0x35')]())['then'](realtime[_0xc218('0x36')]())[_0xc218('0x1b')](campaign[_0xc218('0x37')]())[_0xc218('0x1b')](realtime[_0xc218('0x38')]())['then'](voiceExtension[_0xc218('0x39')]())[_0xc218('0x1b')](realtime[_0xc218('0x3a')]())[_0xc218('0x1b')](faxAccount[_0xc218('0x3b')]())['then'](realtime[_0xc218('0x3c')]())[_0xc218('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xc218('0x1a')]()[_0xc218('0x1b')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xc218('0x3d')]())[_0xc218('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xc218('0x1b')](realtime[_0xc218('0x3e')]())[_0xc218('0x1b')](cmHopperHistory[_0xc218('0x3f')]())['then'](realtime[_0xc218('0x40')]())[_0xc218('0x1b')](voiceCallReport[_0xc218('0x41')]())[_0xc218('0x1b')](realtime[_0xc218('0x42')]())[_0xc218('0x1b')](function(_0x2820db){})['catch'](function(_0x5e1def){console['log'](_0x5e1def);});}function main(){return server[_0xc218('0x43')](realtime,preview,fax)[_0xc218('0x1b')](function(_0x5f2de1){return initRealtime();})[_0xc218('0x1b')](function(){return initParams();})[_0xc218('0x1b')](function(){report[_0xc218('0x44')]();setInterval(initRealtime,0x1388);})[_0xc218('0x45')](function(_0x193a07){console['log'](_0x193a07);});}main(); \ No newline at end of file +var _0x67ed=['getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks'];(function(_0xd703d1,_0x214217){var _0xa392d6=function(_0x37bf62){while(--_0x37bf62){_0xd703d1['push'](_0xd703d1['shift']());}};_0xa392d6(++_0x214217);}(_0x67ed,0x1e4));var _0xd67e=function(_0x117f59,_0x53f6d8){_0x117f59=_0x117f59-0x0;var _0x3b446e=_0x67ed[_0x117f59];return _0x3b446e;};'use strict';var BPromise=require(_0xd67e('0x0'));var util=require('util');var moment=require(_0xd67e('0x1'));var server=require(_0xd67e('0x2'));var Realtime=require(_0xd67e('0x3'));var Report=require(_0xd67e('0x4'));var Acw=require(_0xd67e('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xd67e('0x6'));var Preview=require(_0xd67e('0x7'));var Fax=require(_0xd67e('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xd67e('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xd67e('0xa'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xd67e('0xb'));var zendesk=require(_0xd67e('0xc'));var salesforce=require(_0xd67e('0xd'));var sugarcrm=require(_0xd67e('0xe'));var freshdesk=require(_0xd67e('0xf'));var desk=require(_0xd67e('0x10'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xd67e('0x11'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xd67e('0x12'));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()[_0xd67e('0x13')](_0xd67e('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd67e('0x13')](_0xd67e('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xd67e('0x15')]()[_0xd67e('0x16')](user['getAgents']())['then'](realtime[_0xd67e('0x17')]())['then'](user[_0xd67e('0x18')]())[_0xd67e('0x16')](realtime[_0xd67e('0x19')]())[_0xd67e('0x16')](trunk[_0xd67e('0x1a')]())['then'](realtime[_0xd67e('0x1b')]())['then'](voiceQueue[_0xd67e('0x1c')]())[_0xd67e('0x16')](realtime[_0xd67e('0x1d')]())[_0xd67e('0x16')](trigger[_0xd67e('0x1e')]())[_0xd67e('0x16')](realtime[_0xd67e('0x1f')]())['then'](template[_0xd67e('0x20')]())[_0xd67e('0x16')](realtime[_0xd67e('0x21')]())[_0xd67e('0x16')](zendesk['getZendeskAccounts']())[_0xd67e('0x16')](realtime[_0xd67e('0x22')]())['then'](salesforce['getSalesforceAccounts']())['then'](realtime[_0xd67e('0x23')]())[_0xd67e('0x16')](sugarcrm[_0xd67e('0x24')]())[_0xd67e('0x16')](realtime[_0xd67e('0x25')]())[_0xd67e('0x16')](freshdesk[_0xd67e('0x26')]())[_0xd67e('0x16')](realtime[_0xd67e('0x27')]())[_0xd67e('0x16')](desk[_0xd67e('0x28')]())[_0xd67e('0x16')](realtime[_0xd67e('0x29')]())[_0xd67e('0x16')](zoho[_0xd67e('0x2a')]())[_0xd67e('0x16')](realtime[_0xd67e('0x2b')]())[_0xd67e('0x16')](vtiger['getVtigerAccounts']())[_0xd67e('0x16')](realtime['initVtigerAccounts']())[_0xd67e('0x16')](freshsales[_0xd67e('0x2c')]())[_0xd67e('0x16')](realtime['initFreshsalesAccounts']())[_0xd67e('0x16')](servicenow[_0xd67e('0x2d')]())['then'](realtime[_0xd67e('0x2e')]())[_0xd67e('0x16')](dynamics365[_0xd67e('0x2f')]())['then'](realtime[_0xd67e('0x30')]())['then'](campaign['getCampaigns']())['then'](realtime[_0xd67e('0x31')]())[_0xd67e('0x16')](voiceExtension[_0xd67e('0x32')]())['then'](realtime[_0xd67e('0x33')]())[_0xd67e('0x16')](faxAccount[_0xd67e('0x34')]())[_0xd67e('0x16')](realtime[_0xd67e('0x35')]())[_0xd67e('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0xd67e('0x15')]()[_0xd67e('0x16')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xd67e('0x36')]())['then'](cmHopperHistory[_0xd67e('0x37')]())['then'](realtime[_0xd67e('0x38')]())['then'](cmHopperHistory[_0xd67e('0x39')]())['then'](realtime[_0xd67e('0x3a')]())[_0xd67e('0x16')](voiceCallReport[_0xd67e('0x3b')]())[_0xd67e('0x16')](realtime['initVoiceCallReports']())[_0xd67e('0x16')](function(_0x263185){})[_0xd67e('0x3c')](function(_0x29b87b){console[_0xd67e('0x3d')](_0x29b87b);});}function main(){return server[_0xd67e('0x3e')](realtime,preview,fax)[_0xd67e('0x16')](function(_0x453023){return initRealtime();})[_0xd67e('0x16')](function(){return initParams();})[_0xd67e('0x16')](function(){report[_0xd67e('0x3f')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x4433bd){console[_0xd67e('0x3d')](_0x4433bd);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 533c941..d3caa3d 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x445024,_0x36dca6){var _0x5ab19a=function(_0x598957){while(--_0x598957){_0x445024['push'](_0x445024['shift']());}};_0x5ab19a(++_0x36dca6);}(_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 md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x455c3d,_0x104ef6){var _0x25a136=function(_0x2db6fa){while(--_0x2db6fa){_0x455c3d['push'](_0x455c3d['shift']());}};_0x25a136(++_0x104ef6);}(_0x34e8,0x12c));var _0x834e=function(_0x362548,_0x852872){_0x362548=_0x362548-0x0;var _0x2f6548=_0x34e8[_0x362548];return _0x2f6548;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 43ecf2a..f194b79 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 _0xbe4b=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x4a7cdf,_0xb8413){var _0x44d1ea=function(_0x26e2b5){while(--_0x26e2b5){_0x4a7cdf['push'](_0x4a7cdf['shift']());}};_0x44d1ea(++_0xb8413);}(_0xbe4b,0xf0));var _0xbbe4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xbe4b[_0x465a0c];return _0x1e202e;};'use strict';function Campaign(_0x56481e){this['id']=_0x56481e['id']||0x0;this['name']=_0x56481e['name']||'';this[_0xbbe4('0x0')]=_0x56481e[_0xbbe4('0x0')]||'campaign';this[_0xbbe4('0x1')]=0x0;this[_0xbbe4('0x2')]=0x0;this[_0xbbe4('0x3')]=0x0;this[_0xbbe4('0x4')]=0x0;this[_0xbbe4('0x5')]='';this[_0xbbe4('0x6')]=!![];this[_0xbbe4('0x7')]=_0x56481e[_0xbbe4('0x7')];this[_0xbbe4('0x8')]=_0x56481e['limitCalls'];this[_0xbbe4('0x9')]=_0x56481e['dialTimezone']||null;this[_0xbbe4('0xa')]=_0x56481e['dialGlobalInterval']?_0x56481e['dialGlobalInterval']:null;this[_0xbbe4('0xb')]=_0x56481e[_0xbbe4('0xb')];this[_0xbbe4('0xc')]=_0x56481e[_0xbbe4('0xc')];this[_0xbbe4('0xd')]=_0x56481e['dialOriginateTimeout']||0x1e;this[_0xbbe4('0xe')]=_0x56481e[_0xbbe4('0xe')];this[_0xbbe4('0xf')]=_0x56481e[_0xbbe4('0xf')];this[_0xbbe4('0x10')]=_0x56481e[_0xbbe4('0x10')];this[_0xbbe4('0x11')]=_0x56481e[_0xbbe4('0x11')];this[_0xbbe4('0x12')]=_0x56481e[_0xbbe4('0x12')];this[_0xbbe4('0x13')]=_0x56481e[_0xbbe4('0x13')];this[_0xbbe4('0x14')]=_0x56481e[_0xbbe4('0x14')];this[_0xbbe4('0x15')]=_0x56481e[_0xbbe4('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x56481e[_0xbbe4('0x16')]||0x96;this[_0xbbe4('0x17')]=_0x56481e[_0xbbe4('0x17')]||0x3;this[_0xbbe4('0x18')]=_0x56481e[_0xbbe4('0x18')]||0x96;this[_0xbbe4('0x19')]=_0x56481e[_0xbbe4('0x19')]||0x3;this[_0xbbe4('0x1a')]=_0x56481e[_0xbbe4('0x1a')]||0x96;this[_0xbbe4('0x1b')]=_0x56481e[_0xbbe4('0x1b')]||0x3;this[_0xbbe4('0x1c')]=_0x56481e[_0xbbe4('0x1c')]||0x96;this[_0xbbe4('0x1d')]=_0x56481e[_0xbbe4('0x1d')]||0x3;this[_0xbbe4('0x1e')]=_0x56481e[_0xbbe4('0x1e')]||0x96;this[_0xbbe4('0x1f')]=_0x56481e[_0xbbe4('0x1f')]||_0xbbe4('0x20');this[_0xbbe4('0x21')]=_0x56481e[_0xbbe4('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x56481e[_0xbbe4('0x22')]||undefined;this['dialCutDigit']=_0x56481e['dialCutDigit']||undefined;this[_0xbbe4('0x23')]=_0x56481e['TrunkBackup']?_0x56481e[_0xbbe4('0x23')]:undefined;this[_0xbbe4('0x24')]=_0x56481e['Trunk']?_0x56481e[_0xbbe4('0x24')]:undefined;this['Interval']=_0x56481e[_0xbbe4('0x25')]?_0x56481e[_0xbbe4('0x25')]:undefined;this[_0xbbe4('0x26')]=_0x56481e['SquareProject']?_0x56481e['SquareProject']:undefined;this[_0xbbe4('0x27')]=_0x56481e[_0xbbe4('0x26')]?_0x56481e[_0xbbe4('0x26')]['name']:undefined;this[_0xbbe4('0x28')]=_0x56481e[_0xbbe4('0x28')]||![];this[_0xbbe4('0x29')]=_0x56481e['dialAMDInitialSilence'];this[_0xbbe4('0x2a')]=_0x56481e[_0xbbe4('0x2a')];this['dialAMDAfterGreetingSilence']=_0x56481e[_0xbbe4('0x2b')];this[_0xbbe4('0x2c')]=_0x56481e[_0xbbe4('0x2c')];this[_0xbbe4('0x2d')]=_0x56481e[_0xbbe4('0x2d')];this[_0xbbe4('0x2e')]=_0x56481e[_0xbbe4('0x2e')];this[_0xbbe4('0x2f')]=_0x56481e['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x56481e[_0xbbe4('0x30')];this[_0xbbe4('0x31')]=_0x56481e[_0xbbe4('0x31')];}module[_0xbbe4('0x32')]=Campaign; \ No newline at end of file +var _0xab61=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrTotalCallsDays','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0xab61,0x100));var _0x1ab6=function(_0x480c60,_0x3b0a2b){_0x480c60=_0x480c60-0x0;var _0x1d3d1a=_0xab61[_0x480c60];return _0x1d3d1a;};'use strict';function Campaign(_0x5717c2){this['id']=_0x5717c2['id']||0x0;this['name']=_0x5717c2[_0x1ab6('0x0')]||'';this[_0x1ab6('0x1')]=_0x5717c2['type']||_0x1ab6('0x2');this['originated']=0x0;this[_0x1ab6('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x1ab6('0x4')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this['active']=_0x5717c2['active'];this[_0x1ab6('0x5')]=_0x5717c2['limitCalls'];this['dialTimezone']=_0x5717c2[_0x1ab6('0x6')]||null;this[_0x1ab6('0x7')]=_0x5717c2['dialGlobalInterval']?_0x5717c2['dialGlobalInterval']:null;this[_0x1ab6('0x8')]=_0x5717c2['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5717c2[_0x1ab6('0x9')];this[_0x1ab6('0xa')]=_0x5717c2[_0x1ab6('0xa')]||0x1e;this[_0x1ab6('0xb')]=_0x5717c2['dialCongestionMaxRetry'];this[_0x1ab6('0xc')]=_0x5717c2[_0x1ab6('0xc')];this['dialBusyMaxRetry']=_0x5717c2[_0x1ab6('0xd')];this[_0x1ab6('0xe')]=_0x5717c2[_0x1ab6('0xe')];this[_0x1ab6('0xf')]=_0x5717c2[_0x1ab6('0xf')];this['dialNoAnswerRetryFrequency']=_0x5717c2[_0x1ab6('0x10')];this[_0x1ab6('0x11')]=_0x5717c2[_0x1ab6('0x11')];this[_0x1ab6('0x12')]=_0x5717c2[_0x1ab6('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5717c2[_0x1ab6('0x13')]||0x96;this[_0x1ab6('0x14')]=_0x5717c2[_0x1ab6('0x14')]||0x3;this[_0x1ab6('0x15')]=_0x5717c2[_0x1ab6('0x15')]||0x96;this[_0x1ab6('0x16')]=_0x5717c2[_0x1ab6('0x16')]||0x3;this[_0x1ab6('0x17')]=_0x5717c2['dialAbandonedRetryFrequency']||0x96;this[_0x1ab6('0x18')]=_0x5717c2[_0x1ab6('0x18')]||0x3;this[_0x1ab6('0x19')]=_0x5717c2[_0x1ab6('0x19')]||0x96;this[_0x1ab6('0x1a')]=_0x5717c2[_0x1ab6('0x1a')]||0x3;this[_0x1ab6('0x1b')]=_0x5717c2[_0x1ab6('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x5717c2[_0x1ab6('0x1c')]||_0x1ab6('0x1d');this['dialPrefix']=_0x5717c2['dialPrefix']||undefined;this[_0x1ab6('0x1e')]=_0x5717c2[_0x1ab6('0x1e')]||undefined;this[_0x1ab6('0x1f')]=_0x5717c2[_0x1ab6('0x1f')]||undefined;this['TrunkBackup']=_0x5717c2[_0x1ab6('0x20')]?_0x5717c2[_0x1ab6('0x20')]:undefined;this[_0x1ab6('0x21')]=_0x5717c2[_0x1ab6('0x21')]?_0x5717c2['Trunk']:undefined;this[_0x1ab6('0x22')]=_0x5717c2[_0x1ab6('0x22')]?_0x5717c2['Interval']:undefined;this['SquareProject']=_0x5717c2[_0x1ab6('0x23')]?_0x5717c2[_0x1ab6('0x23')]:undefined;this[_0x1ab6('0x24')]=_0x5717c2[_0x1ab6('0x23')]?_0x5717c2[_0x1ab6('0x23')][_0x1ab6('0x0')]:undefined;this[_0x1ab6('0x25')]=_0x5717c2[_0x1ab6('0x25')]||![];this[_0x1ab6('0x26')]=_0x5717c2[_0x1ab6('0x26')];this[_0x1ab6('0x27')]=_0x5717c2[_0x1ab6('0x27')];this[_0x1ab6('0x28')]=_0x5717c2['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5717c2[_0x1ab6('0x29')];this[_0x1ab6('0x2a')]=_0x5717c2[_0x1ab6('0x2a')];this[_0x1ab6('0x2b')]=_0x5717c2[_0x1ab6('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x5717c2[_0x1ab6('0x2c')];this[_0x1ab6('0x2d')]=_0x5717c2[_0x1ab6('0x2d')];this[_0x1ab6('0x2e')]=_0x5717c2[_0x1ab6('0x2e')];}module[_0x1ab6('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 1ac232f..9f3e753 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 _0x0570=['billableseconds','holdtime','tag','disposition','monitor','queue','monitors','transferType','mohtime','exports','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','lastapplication','lastdata','duration'];(function(_0x1b2c60,_0x53b096){var _0x1b6b7e=function(_0x5e2b02){while(--_0x5e2b02){_0x1b2c60['push'](_0x1b2c60['shift']());}};_0x1b6b7e(++_0x53b096);}(_0x0570,0x172));var _0x0057=function(_0x4c9e0b,_0x574671){_0x4c9e0b=_0x4c9e0b-0x0;var _0x2431e5=_0x0570[_0x4c9e0b];return _0x2431e5;};'use strict';function Channel(){this['starttime']=null;this[_0x0057('0x0')]='';this[_0x0057('0x1')]='';this[_0x0057('0x2')]=0x0;this['calleridname']='';this[_0x0057('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x0057('0x4')]=0x0;this['context']='';this[_0x0057('0x5')]=0x0;this[_0x0057('0x6')]=0x0;this[_0x0057('0x7')]=0x0;this[_0x0057('0x8')]=![];this[_0x0057('0x9')]=null;this['endtime']=null;this[_0x0057('0xa')]=![];this['abandoned']=![];this[_0x0057('0xb')]='';this[_0x0057('0xc')]='';this[_0x0057('0xd')]=0x0;this[_0x0057('0xe')]=0x0;this[_0x0057('0xf')]=0x0;this['type']=null;this[_0x0057('0x10')]=null;this[_0x0057('0x11')]=null;this[_0x0057('0x12')]=![];this['monitorFilename']=null;this[_0x0057('0x13')]=null;this[_0x0057('0x14')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x0057('0x15')]=undefined;this[_0x0057('0x16')]=0x0;}module[_0x0057('0x17')]=Channel; \ No newline at end of file +var _0xf99c=['answered','answertime','endtime','unmanaged','abandoned','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid'];(function(_0x2cfa08,_0x23a555){var _0x528029=function(_0x119fbf){while(--_0x119fbf){_0x2cfa08['push'](_0x2cfa08['shift']());}};_0x528029(++_0x23a555);}(_0xf99c,0x129));var _0xcf99=function(_0x4c2ecf,_0x31622b){_0x4c2ecf=_0x4c2ecf-0x0;var _0x35e6aa=_0xf99c[_0x4c2ecf];return _0x35e6aa;};'use strict';function Channel(){this[_0xcf99('0x0')]=null;this[_0xcf99('0x1')]='';this[_0xcf99('0x2')]='';this[_0xcf99('0x3')]=0x0;this[_0xcf99('0x4')]='';this[_0xcf99('0x5')]=undefined;this[_0xcf99('0x6')]=undefined;this[_0xcf99('0x7')]=0x0;this[_0xcf99('0x8')]='';this[_0xcf99('0x9')]=0x0;this[_0xcf99('0xa')]=0x0;this['exten']=0x0;this[_0xcf99('0xb')]=![];this[_0xcf99('0xc')]=null;this[_0xcf99('0xd')]=null;this[_0xcf99('0xe')]=![];this[_0xcf99('0xf')]=![];this['lastapplication']='';this['lastdata']='';this[_0xcf99('0x10')]=0x0;this[_0xcf99('0x11')]=0x0;this['holdtime']=0x0;this[_0xcf99('0x12')]=null;this[_0xcf99('0x13')]=null;this[_0xcf99('0x14')]=null;this[_0xcf99('0x15')]=![];this[_0xcf99('0x16')]=null;this[_0xcf99('0x17')]=null;this['monitors']=[];this[_0xcf99('0x18')]=undefined;this[_0xcf99('0x19')]=undefined;this['transferType']=undefined;this[_0xcf99('0x1a')]=0x0;}module[_0xcf99('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 7efa06d..d001fd7 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 _0xdf4d=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xdf4d,0xe9));var _0xddf4=function(_0x35878b,_0x37ea4a){_0x35878b=_0x35878b-0x0;var _0x4a89ad=_0xdf4d[_0x35878b];return _0x4a89ad;};'use strict';function DeskAccount(_0x49f97b){this['id']=_0x49f97b['id']||0x0;this[_0xddf4('0x0')]=_0x49f97b[_0xddf4('0x0')]||'';this[_0xddf4('0x1')]=_0x49f97b[_0xddf4('0x1')]||'';this[_0xddf4('0x2')]=_0x49f97b[_0xddf4('0x2')]||'';this[_0xddf4('0x3')]=_0x49f97b[_0xddf4('0x3')]||'';this['password']=_0x49f97b[_0xddf4('0x4')]||'';this[_0xddf4('0x5')]=_0x49f97b[_0xddf4('0x5')]||'';this[_0xddf4('0x6')]=_0x49f97b[_0xddf4('0x6')]||'';this['token']=_0x49f97b[_0xddf4('0x7')]||'';this[_0xddf4('0x8')]=_0x49f97b[_0xddf4('0x8')]||'';this[_0xddf4('0x9')]=_0x49f97b[_0xddf4('0x9')]||'';this[_0xddf4('0xa')]=_0x49f97b[_0xddf4('0xa')]||'';this['Configurations']=_0x49f97b[_0xddf4('0xb')]||{};}module[_0xddf4('0xc')]=DeskAccount; \ No newline at end of file +var _0x5c17=['remoteUri','authType','password','consumerKey','consumerSecret','token','type','serverUrl','exports','name','username'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x5c17,0x18a));var _0x75c1=function(_0x2a5fbc,_0x15f36f){_0x2a5fbc=_0x2a5fbc-0x0;var _0x365ab2=_0x5c17[_0x2a5fbc];return _0x365ab2;};'use strict';function DeskAccount(_0x452064){this['id']=_0x452064['id']||0x0;this[_0x75c1('0x0')]=_0x452064[_0x75c1('0x0')]||'';this[_0x75c1('0x1')]=_0x452064[_0x75c1('0x1')]||'';this['remoteUri']=_0x452064[_0x75c1('0x2')]||'';this['authType']=_0x452064[_0x75c1('0x3')]||'';this[_0x75c1('0x4')]=_0x452064[_0x75c1('0x4')]||'';this[_0x75c1('0x5')]=_0x452064[_0x75c1('0x5')]||'';this['consumerSecret']=_0x452064[_0x75c1('0x6')]||'';this['token']=_0x452064[_0x75c1('0x7')]||'';this['tokenSecret']=_0x452064['tokenSecret']||'';this['type']=_0x452064[_0x75c1('0x8')]||'';this[_0x75c1('0x9')]=_0x452064[_0x75c1('0x9')]||'';this['Configurations']=_0x452064['Configurations']||{};}module[_0x75c1('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6e88e78..20e71f0 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 _0xd8b0=['Configurations','exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';function Dynamics365Account(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['username']=_0x5d04de['username']||'';this[_0x0d8b('0x1')]=_0x5d04de[_0x0d8b('0x1')]||'';this[_0x0d8b('0x2')]=_0x5d04de[_0x0d8b('0x2')]||'';this[_0x0d8b('0x3')]=_0x5d04de['tenantId']||'';this['clientId']=_0x5d04de[_0x0d8b('0x4')]||'';this[_0x0d8b('0x5')]=_0x5d04de[_0x0d8b('0x5')]||{};this['serverUrl']=_0x5d04de[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5d04de['Configurations']||{};}module[_0x0d8b('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xda3f=['clientId','serverUrl','Configurations','exports','name','password','remoteUri','tenantId'];(function(_0x1c9ec3,_0x29b309){var _0x199047=function(_0x12b1c1){while(--_0x12b1c1){_0x1c9ec3['push'](_0x1c9ec3['shift']());}};_0x199047(++_0x29b309);}(_0xda3f,0xec));var _0xfda3=function(_0x262aed,_0x238e41){_0x262aed=_0x262aed-0x0;var _0x19150f=_0xda3f[_0x262aed];return _0x19150f;};'use strict';function Dynamics365Account(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['username']=_0x33f0ce['username']||'';this['password']=_0x33f0ce[_0xfda3('0x1')]||'';this['remoteUri']=_0x33f0ce[_0xfda3('0x2')]||'';this[_0xfda3('0x3')]=_0x33f0ce['tenantId']||'';this[_0xfda3('0x4')]=_0x33f0ce[_0xfda3('0x4')]||'';this['clientSecret']=_0x33f0ce['clientSecret']||{};this[_0xfda3('0x5')]=_0x33f0ce[_0xfda3('0x5')]||'';this[_0xfda3('0x6')]=_0x33f0ce[_0xfda3('0x6')]||{};}module[_0xfda3('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 431bd18..c536310 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 _0xfbe4=['headerinfo','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xfbe4,0xdd));var _0x4fbe=function(_0x4aa962,_0x2b47e6){_0x4aa962=_0x4aa962-0x0;var _0xb2fdf5=_0xfbe4[_0x4aa962];return _0xb2fdf5;};'use strict';function FaxAccount(_0x23b217){this['id']=_0x23b217['id']||0x0;this[_0x4fbe('0x0')]=_0x23b217[_0x4fbe('0x0')]||'';this[_0x4fbe('0x1')]=_0x23b217[_0x4fbe('0x1')];this[_0x4fbe('0x2')]=_0x23b217[_0x4fbe('0x2')];this['headerinfo']=_0x23b217[_0x4fbe('0x3')];this[_0x4fbe('0x4')]=_0x23b217['localstationid'];this['minrate']=_0x23b217[_0x4fbe('0x5')]||0x960;this[_0x4fbe('0x6')]=_0x23b217['maxrate']||0x3840;this['modem']=_0x23b217['modem']||'v17,v27,v29';this[_0x4fbe('0x7')]=_0x23b217['gateway']||'no';this[_0x4fbe('0x8')]=_0x23b217['faxdetect']||'no';this[_0x4fbe('0x9')]=_0x23b217[_0x4fbe('0x9')]||0x1388;this[_0x4fbe('0xa')]=_0x23b217[_0x4fbe('0xa')]||_0x4fbe('0xb');this[_0x4fbe('0xc')]=_0x23b217['Trunk']?_0x23b217[_0x4fbe('0xc')]:undefined;this[_0x4fbe('0xd')]=_0x23b217['ListId'];this[_0x4fbe('0xe')]=_0x23b217[_0x4fbe('0xe')];}module[_0x4fbe('0xf')]=FaxAccount; \ No newline at end of file +var _0xbda0=['maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x3b293a,_0x46d9d2){var _0x1de463=function(_0x3cf24d){while(--_0x3cf24d){_0x3b293a['push'](_0x3b293a['shift']());}};_0x1de463(++_0x46d9d2);}(_0xbda0,0x170));var _0x0bda=function(_0x1bb55a,_0x1c6f6c){_0x1bb55a=_0x1bb55a-0x0;var _0x328749=_0xbda0[_0x1bb55a];return _0x328749;};'use strict';function FaxAccount(_0x32f417){this['id']=_0x32f417['id']||0x0;this[_0x0bda('0x0')]=_0x32f417[_0x0bda('0x0')]||'';this[_0x0bda('0x1')]=_0x32f417[_0x0bda('0x1')];this[_0x0bda('0x2')]=_0x32f417[_0x0bda('0x2')];this[_0x0bda('0x3')]=_0x32f417['headerinfo'];this[_0x0bda('0x4')]=_0x32f417[_0x0bda('0x4')];this[_0x0bda('0x5')]=_0x32f417[_0x0bda('0x5')]||0x960;this[_0x0bda('0x6')]=_0x32f417[_0x0bda('0x6')]||0x3840;this['modem']=_0x32f417[_0x0bda('0x7')]||'v17,v27,v29';this[_0x0bda('0x8')]=_0x32f417[_0x0bda('0x8')]||'no';this[_0x0bda('0x9')]=_0x32f417[_0x0bda('0x9')]||'no';this[_0x0bda('0xa')]=_0x32f417[_0x0bda('0xa')]||0x1388;this[_0x0bda('0xb')]=_0x32f417['tech']||_0x0bda('0xc');this[_0x0bda('0xd')]=_0x32f417['Trunk']?_0x32f417[_0x0bda('0xd')]:undefined;this[_0x0bda('0xe')]=_0x32f417[_0x0bda('0xe')];this[_0x0bda('0xf')]=_0x32f417[_0x0bda('0xf')];}module[_0x0bda('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 37d8d42..270c4ac 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 _0xb6dc=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0xb6dc,0xf6));var _0xcb6d=function(_0xcb1c88,_0x10abf2){_0xcb1c88=_0xcb1c88-0x0;var _0x5b8b9f=_0xb6dc[_0xcb1c88];return _0x5b8b9f;};'use strict';function FreshdeskAccount(_0x393d9d){this['id']=_0x393d9d['id']||0x0;this[_0xcb6d('0x0')]=_0x393d9d[_0xcb6d('0x0')]||'';this[_0xcb6d('0x1')]=_0x393d9d[_0xcb6d('0x1')]||'';this['apiKey']=_0x393d9d['token']||'';this[_0xcb6d('0x2')]=_0x393d9d[_0xcb6d('0x2')]||'';this[_0xcb6d('0x3')]=_0x393d9d[_0xcb6d('0x3')]||'';this['Configurations']=_0x393d9d[_0xcb6d('0x4')]||{};}module[_0xcb6d('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xe1b3=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2ee4c0,_0x2734b8){var _0x5c3bfd=function(_0x4cfa51){while(--_0x4cfa51){_0x2ee4c0['push'](_0x2ee4c0['shift']());}};_0x5c3bfd(++_0x2734b8);}(_0xe1b3,0x1e3));var _0x3e1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1b3[_0x20a584];return _0x4b41a8;};'use strict';function FreshdeskAccount(_0x1f673c){this['id']=_0x1f673c['id']||0x0;this[_0x3e1b('0x0')]=_0x1f673c[_0x3e1b('0x0')]||'';this[_0x3e1b('0x1')]=_0x1f673c[_0x3e1b('0x1')]||'';this[_0x3e1b('0x2')]=_0x1f673c[_0x3e1b('0x3')]||'';this[_0x3e1b('0x4')]=_0x1f673c[_0x3e1b('0x4')]||'';this[_0x3e1b('0x5')]=_0x1f673c['serverUrl']||'';this[_0x3e1b('0x6')]=_0x1f673c[_0x3e1b('0x6')]||{};}module[_0x3e1b('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5ebd54f..5c3ee7a 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 _0xda19=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda19,0xd5));var _0x9da1=function(_0xfc553f,_0xf60646){_0xfc553f=_0xfc553f-0x0;var _0x4f72ea=_0xda19[_0xfc553f];return _0x4f72ea;};'use strict';function FreshsalesAccount(_0x26be9c){this['id']=_0x26be9c['id']||0x0;this[_0x9da1('0x0')]=_0x26be9c[_0x9da1('0x0')]||'';this['username']=_0x26be9c[_0x9da1('0x1')]||'';this['apiKey']=_0x26be9c[_0x9da1('0x2')]||'';this['remoteUri']=_0x26be9c[_0x9da1('0x3')]||'';this[_0x9da1('0x4')]=_0x26be9c[_0x9da1('0x4')]||'';this[_0x9da1('0x5')]=_0x26be9c[_0x9da1('0x5')]||{};}module[_0x9da1('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x5447=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x3b2d2,_0x3b141d){var _0x35dc74=function(_0x45b0e8){while(--_0x45b0e8){_0x3b2d2['push'](_0x3b2d2['shift']());}};_0x35dc74(++_0x3b141d);}(_0x5447,0xf1));var _0x7544=function(_0x371ad6,_0x5d0388){_0x371ad6=_0x371ad6-0x0;var _0x254a81=_0x5447[_0x371ad6];return _0x254a81;};'use strict';function FreshsalesAccount(_0x3b0586){this['id']=_0x3b0586['id']||0x0;this['name']=_0x3b0586[_0x7544('0x0')]||'';this[_0x7544('0x1')]=_0x3b0586['username']||'';this[_0x7544('0x2')]=_0x3b0586['token']||'';this[_0x7544('0x3')]=_0x3b0586[_0x7544('0x3')]||'';this[_0x7544('0x4')]=_0x3b0586[_0x7544('0x4')]||'';this[_0x7544('0x5')]=_0x3b0586[_0x7544('0x5')]||{};}module[_0x7544('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 d33fad6..8a92688 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 _0x8c63=['mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','exten','holdtime','lastAssignedTo','motionChannel'];(function(_0x239d4f,_0x17f3b5){var _0x399ee9=function(_0x138d2d){while(--_0x138d2d){_0x239d4f['push'](_0x239d4f['shift']());}};_0x399ee9(++_0x17f3b5);}(_0x8c63,0x70));var _0x38c6=function(_0x3c3e60,_0x32ab43){_0x3c3e60=_0x3c3e60-0x0;var _0x39e619=_0x8c63[_0x3c3e60];return _0x39e619;};'use strict';function QueueReport(){this[_0x38c6('0x0')]=_0x38c6('0x1');this[_0x38c6('0x2')]='';this[_0x38c6('0x3')]='';this[_0x38c6('0x4')]='';this['queue']='';this[_0x38c6('0x5')]=null;this[_0x38c6('0x6')]=null;this[_0x38c6('0x7')]=0x1;this[_0x38c6('0x8')]=0x1;this[_0x38c6('0x9')]=![];this['queuecallerabandonAt']=null;this[_0x38c6('0xa')]=![];this[_0x38c6('0xb')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x38c6('0xc')]=0x1;this[_0x38c6('0xd')]='';this[_0x38c6('0xe')]='';this[_0x38c6('0xf')]='';this['accountcode']='';this['context']='';this[_0x38c6('0x10')]='';this['priority']='';this[_0x38c6('0x11')]=0x0;this['assigned']=![];this[_0x38c6('0x12')]='';this[_0x38c6('0x13')]='voice';this[_0x38c6('0x14')]=0x0;this['variables']={};}module[_0x38c6('0x15')]=QueueReport; \ No newline at end of file +var _0x3232=['queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit'];(function(_0x48026e,_0x2bb295){var _0x4b42aa=function(_0x42c647){while(--_0x42c647){_0x48026e['push'](_0x48026e['shift']());}};_0x4b42aa(++_0x2bb295);}(_0x3232,0x1ed));var _0x2323=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3232[_0x5447fd];return _0x15b28a;};'use strict';function QueueReport(){this[_0x2323('0x0')]=_0x2323('0x1');this[_0x2323('0x2')]='';this[_0x2323('0x3')]='';this['calleridname']='';this[_0x2323('0x4')]='';this[_0x2323('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x2323('0x6')]=0x1;this[_0x2323('0x7')]=0x1;this[_0x2323('0x8')]=![];this[_0x2323('0x9')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x2323('0xa')]=![];this[_0x2323('0xb')]=null;this[_0x2323('0xc')]=0x1;this['channel']='';this[_0x2323('0xd')]='';this['connectedlinename']='';this[_0x2323('0xe')]='';this[_0x2323('0xf')]='';this['exten']='';this[_0x2323('0x10')]='';this[_0x2323('0x11')]=0x0;this[_0x2323('0x12')]=![];this[_0x2323('0x13')]='';this[_0x2323('0x14')]=_0x2323('0x15');this[_0x2323('0x16')]=0x0;this[_0x2323('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 938e9e3..44c8eeb 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 _0x24d5=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x530103,_0x255d2e){var _0x104d42=function(_0x100de7){while(--_0x100de7){_0x530103['push'](_0x530103['shift']());}};_0x104d42(++_0x255d2e);}(_0x24d5,0xa9));var _0x524d=function(_0x3ecf81,_0x7548d1){_0x3ecf81=_0x3ecf81-0x0;var _0x1384e3=_0x24d5[_0x3ecf81];return _0x1384e3;};'use strict';function SalesforceAccount(_0x78bfce){this['id']=_0x78bfce['id']||0x0;this[_0x524d('0x0')]=_0x78bfce[_0x524d('0x0')]||'';this['username']=_0x78bfce[_0x524d('0x1')]||'';this[_0x524d('0x2')]=_0x78bfce[_0x524d('0x2')]||'';this[_0x524d('0x3')]=_0x78bfce[_0x524d('0x3')]||'';this[_0x524d('0x4')]=_0x78bfce[_0x524d('0x4')]||'';this[_0x524d('0x5')]=_0x78bfce['clientSecret']||'';this[_0x524d('0x6')]=_0x78bfce[_0x524d('0x6')]||'';this[_0x524d('0x7')]=_0x78bfce[_0x524d('0x7')]||_0x524d('0x8');this[_0x524d('0x9')]=_0x78bfce[_0x524d('0x9')]||'';this[_0x524d('0xa')]=_0x78bfce[_0x524d('0xa')]||{};}module[_0x524d('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x1103=['exports','name','username','remoteUri','password','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x3b6d10,_0x4063e6){var _0xcc9a23=function(_0x451417){while(--_0x451417){_0x3b6d10['push'](_0x3b6d10['shift']());}};_0xcc9a23(++_0x4063e6);}(_0x1103,0x97));var _0x3110=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1103[_0x2dafbe];return _0x58a45a;};'use strict';function SalesforceAccount(_0x4755d9){this['id']=_0x4755d9['id']||0x0;this[_0x3110('0x0')]=_0x4755d9[_0x3110('0x0')]||'';this[_0x3110('0x1')]=_0x4755d9[_0x3110('0x1')]||'';this[_0x3110('0x2')]=_0x4755d9['remoteUri']||'';this[_0x3110('0x3')]=_0x4755d9[_0x3110('0x3')]||'';this['clientId']=_0x4755d9['clientId']||'';this[_0x3110('0x4')]=_0x4755d9[_0x3110('0x4')]||'';this[_0x3110('0x5')]=_0x4755d9[_0x3110('0x5')]||'';this[_0x3110('0x6')]=_0x4755d9[_0x3110('0x6')]||'integrationTab';this['serverUrl']=_0x4755d9[_0x3110('0x7')]||'';this['Configurations']=_0x4755d9[_0x3110('0x8')]||{};}module[_0x3110('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 2ce3087..ea98ec0 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 _0x14fc=['remoteUri','Configurations','exports','name','username','password'];(function(_0x471a6b,_0x4f8dab){var _0x1691e8=function(_0x130ee4){while(--_0x130ee4){_0x471a6b['push'](_0x471a6b['shift']());}};_0x1691e8(++_0x4f8dab);}(_0x14fc,0x93));var _0xc14f=function(_0x555890,_0xd516c8){_0x555890=_0x555890-0x0;var _0x3e574b=_0x14fc[_0x555890];return _0x3e574b;};'use strict';function ServicenowAccount(_0x183c5f){this['id']=_0x183c5f['id']||0x0;this['name']=_0x183c5f[_0xc14f('0x0')]||'';this[_0xc14f('0x1')]=_0x183c5f[_0xc14f('0x1')]||'';this[_0xc14f('0x2')]=_0x183c5f[_0xc14f('0x2')]||'';this[_0xc14f('0x3')]=_0x183c5f[_0xc14f('0x3')]||'';this['serverUrl']=_0x183c5f['serverUrl']||'';this[_0xc14f('0x4')]=_0x183c5f[_0xc14f('0x4')]||{};}module[_0xc14f('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x750c=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x291276,_0x5a4690){var _0x303ab3=function(_0xb0fe70){while(--_0xb0fe70){_0x291276['push'](_0x291276['shift']());}};_0x303ab3(++_0x5a4690);}(_0x750c,0x113));var _0xc750=function(_0xbcb50c,_0x44a66a){_0xbcb50c=_0xbcb50c-0x0;var _0x1af8d0=_0x750c[_0xbcb50c];return _0x1af8d0;};'use strict';function ServicenowAccount(_0x50b24d){this['id']=_0x50b24d['id']||0x0;this[_0xc750('0x0')]=_0x50b24d[_0xc750('0x0')]||'';this[_0xc750('0x1')]=_0x50b24d[_0xc750('0x1')]||'';this['password']=_0x50b24d[_0xc750('0x2')]||'';this[_0xc750('0x3')]=_0x50b24d['remoteUri']||'';this[_0xc750('0x4')]=_0x50b24d[_0xc750('0x4')]||'';this[_0xc750('0x5')]=_0x50b24d[_0xc750('0x5')]||{};}module[_0xc750('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fe9766d..7097b5b 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 _0xb0e2=['Configurations','exports','username','password','remoteUri'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xb0e2,0xac));var _0x2b0e=function(_0x244173,_0x3c0ef8){_0x244173=_0x244173-0x0;var _0x4671b8=_0xb0e2[_0x244173];return _0x4671b8;};'use strict';function SugarcrmAccount(_0x38d881){this['id']=_0x38d881['id']||0x0;this['name']=_0x38d881['name']||'';this[_0x2b0e('0x0')]=_0x38d881[_0x2b0e('0x0')]||'';this[_0x2b0e('0x1')]=_0x38d881[_0x2b0e('0x1')]||'';this[_0x2b0e('0x2')]=_0x38d881['remoteUri']||'';this['serverUrl']=_0x38d881['serverUrl']||'';this[_0x2b0e('0x3')]=_0x38d881[_0x2b0e('0x3')]||{};}module[_0x2b0e('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x9344=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x9344,0x1a7));var _0x4934=function(_0x58c6a9,_0x3a0caf){_0x58c6a9=_0x58c6a9-0x0;var _0x394f21=_0x9344[_0x58c6a9];return _0x394f21;};'use strict';function SugarcrmAccount(_0x150903){this['id']=_0x150903['id']||0x0;this[_0x4934('0x0')]=_0x150903['name']||'';this[_0x4934('0x1')]=_0x150903[_0x4934('0x1')]||'';this[_0x4934('0x2')]=_0x150903[_0x4934('0x2')]||'';this[_0x4934('0x3')]=_0x150903['remoteUri']||'';this[_0x4934('0x4')]=_0x150903['serverUrl']||'';this[_0x4934('0x5')]=_0x150903[_0x4934('0x5')]||{};}module[_0x4934('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 7b2ab61..cb09081 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 _0xd315=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x4633ee,_0xc061fe){var _0x5c5ac0=function(_0x29ef60){while(--_0x29ef60){_0x4633ee['push'](_0x4633ee['shift']());}};_0x5c5ac0(++_0xc061fe);}(_0xd315,0x123));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x584e71){this['id']=_0x584e71['id']||0x0;this[_0x5d31('0x0')]=_0x584e71[_0x5d31('0x0')]||'';this[_0x5d31('0x1')]=_0x584e71[_0x5d31('0x1')]||'';this[_0x5d31('0x2')]=_0x5d31('0x3');this[_0x5d31('0x4')]=0x0;this[_0x5d31('0x5')]=_0x5d31('0x3');this[_0x5d31('0x6')]='';}module[_0x5d31('0x7')]=Telephone; \ No newline at end of file +var _0xf69c=['accountcode','state','unknown','stateTime','address','exports','name'];(function(_0x55f20b,_0x4ee231){var _0x1b6f7f=function(_0x466d83){while(--_0x466d83){_0x55f20b['push'](_0x55f20b['shift']());}};_0x1b6f7f(++_0x4ee231);}(_0xf69c,0x1e2));var _0xcf69=function(_0x40686f,_0x3f24bf){_0x40686f=_0x40686f-0x0;var _0x53b21c=_0xf69c[_0x40686f];return _0x53b21c;};'use strict';function Telephone(_0x9e1b3d){this['id']=_0x9e1b3d['id']||0x0;this[_0xcf69('0x0')]=_0x9e1b3d[_0xcf69('0x0')]||'';this[_0xcf69('0x1')]=_0x9e1b3d['accountcode']||'';this[_0xcf69('0x2')]=_0xcf69('0x3');this[_0xcf69('0x4')]=0x0;this['status']=_0xcf69('0x3');this[_0xcf69('0x5')]='';}module[_0xcf69('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 e573626..88f87cd 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x5e0565,_0x5c9998){var _0xa1d8d6=function(_0x1ee03b){while(--_0x1ee03b){_0x5e0565['push'](_0x5e0565['shift']());}};_0xa1d8d6(++_0x5c9998);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x50e615,_0x9efb7f){var _0x58ffad=function(_0x3060be){while(--_0x3060be){_0x50e615['push'](_0x50e615['shift']());}};_0x58ffad(++_0x9efb7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 f200a64..c825441 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 _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x57e14c,_0x393d02){var _0x2f5a57=function(_0x6cc40d){while(--_0x6cc40d){_0x57e14c['push'](_0x57e14c['shift']());}};_0x2f5a57(++_0x393d02);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c3b02,_0x26c1ff){_0x2c3b02=_0x2c3b02-0x0;var _0x3c1557=_0x5f2f[_0x2c3b02];return _0x3c1557;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0xa27d22,_0x2681ad){var _0x5f1a36=function(_0x4b8c16){while(--_0x4b8c16){_0xa27d22['push'](_0xa27d22['shift']());}};_0x5f1a36(++_0x2681ad);}(_0xb10b,0x12a));var _0xbb10=function(_0x23931f,_0x44a59c){_0x23931f=_0x23931f-0x0;var _0x2575ce=_0xb10b[_0x23931f];return _0x2575ce;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('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 9ad6b39..57e83f4 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 _0x4f05=['defaultuser','exports','active','unknown','stateTime','status','registry','indexOf','split','host','port','domain','refresh','stateRegistry','registrationtime','address'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4f05,0x1d2));var _0x54f0=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x4f05[_0x13b02f];return _0x12e9a6;};'use strict';function Trunk(_0x3cf0f5){this['id']=_0x3cf0f5['id']||0x0;this[_0x54f0('0x0')]=_0x3cf0f5[_0x54f0('0x0')]||![];this['name']=_0x3cf0f5['name']||'';this['state']=_0x54f0('0x1');this[_0x54f0('0x2')]=0x0;this[_0x54f0('0x3')]=_0x54f0('0x1');this[_0x54f0('0x4')]=_0x3cf0f5[_0x54f0('0x4')]&&_0x3cf0f5[_0x54f0('0x4')][_0x54f0('0x5')](':')?_0x3cf0f5['registry'][_0x54f0('0x6')](':')[0x0]:'';this[_0x54f0('0x7')]='';this[_0x54f0('0x8')]='';this[_0x54f0('0x9')]='';this['domainport']='';this[_0x54f0('0xa')]='';this[_0x54f0('0xb')]=_0x54f0('0x1');this[_0x54f0('0xc')]='';this[_0x54f0('0xd')]='';this[_0x54f0('0xe')]=_0x3cf0f5['defaultuser']||'';}module[_0x54f0('0xf')]=Trunk; \ No newline at end of file +var _0xb437=['address','defaultuser','exports','active','name','unknown','stateTime','status','registry','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xb437,0xe0));var _0x7b43=function(_0x24688b,_0x42a6ac){_0x24688b=_0x24688b-0x0;var _0x5dbf0e=_0xb437[_0x24688b];return _0x5dbf0e;};'use strict';function Trunk(_0x24434e){this['id']=_0x24434e['id']||0x0;this[_0x7b43('0x0')]=_0x24434e[_0x7b43('0x0')]||![];this[_0x7b43('0x1')]=_0x24434e[_0x7b43('0x1')]||'';this['state']=_0x7b43('0x2');this[_0x7b43('0x3')]=0x0;this[_0x7b43('0x4')]='unknown';this[_0x7b43('0x5')]=_0x24434e[_0x7b43('0x5')]&&_0x24434e[_0x7b43('0x5')]['indexOf'](':')?_0x24434e['registry'][_0x7b43('0x6')](':')[0x0]:'';this[_0x7b43('0x7')]='';this[_0x7b43('0x8')]='';this[_0x7b43('0x9')]='';this[_0x7b43('0xa')]='';this[_0x7b43('0xb')]='';this[_0x7b43('0xc')]=_0x7b43('0x2');this[_0x7b43('0xd')]='';this[_0x7b43('0xe')]='';this['defaultuser']=_0x24434e[_0x7b43('0xf')]||'';}module[_0x7b43('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index fa35b5a..24ea433 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 _0xb3a9=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb3a9,0x177));var _0x9b3a=function(_0x27ed82,_0x4b11ce){_0x27ed82=_0x27ed82-0x0;var _0x2c591d=_0xb3a9[_0x27ed82];return _0x2c591d;};'use strict';function voiceExtension(_0x4bff2e){this['id']=_0x4bff2e['id']||0x0;this[_0x9b3a('0x0')]=_0x4bff2e['exten']||'';this[_0x9b3a('0x1')]=_0x4bff2e[_0x9b3a('0x1')]||_0x9b3a('0x2');this[_0x9b3a('0x3')]=_0x4bff2e[_0x9b3a('0x3')]||![];}module[_0x9b3a('0x4')]=voiceExtension; \ No newline at end of file +var _0xde58=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x43b9b4,_0x46b86f){var _0x39698d=function(_0x3a0e28){while(--_0x3a0e28){_0x43b9b4['push'](_0x43b9b4['shift']());}};_0x39698d(++_0x46b86f);}(_0xde58,0x1ce));var _0x8de5=function(_0x8ce582,_0x10b0b7){_0x8ce582=_0x8ce582-0x0;var _0x14bb7b=_0xde58[_0x8ce582];return _0x14bb7b;};'use strict';function voiceExtension(_0x5b0f5b){this['id']=_0x5b0f5b['id']||0x0;this['exten']=_0x5b0f5b[_0x8de5('0x0')]||'';this['recordingFormat']=_0x5b0f5b[_0x8de5('0x1')]||_0x8de5('0x2');this[_0x8de5('0x3')]=_0x5b0f5b['mandatoryDisposition']||![];}module[_0x8de5('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index cc44323..79e9779 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 _0x958a=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x5d829d,_0x14680a){var _0x25a70f=function(_0x51e77c){while(--_0x51e77c){_0x5d829d['push'](_0x5d829d['shift']());}};_0x25a70f(++_0x14680a);}(_0x958a,0x128));var _0xa958=function(_0x3f5d2b,_0x5106e5){_0x3f5d2b=_0x3f5d2b-0x0;var _0xa6fd62=_0x958a[_0x3f5d2b];return _0xa6fd62;};'use strict';var statusDesc=[_0xa958('0x0'),_0xa958('0x1'),'inuse',_0xa958('0x2'),_0xa958('0x3'),_0xa958('0x4'),_0xa958('0x5'),_0xa958('0x6'),'onhold'];var monitorFormat={'wav':_0xa958('0x7'),'wav49':'wav49','gsm':_0xa958('0x8')};var strategy={'rrmemory':_0xa958('0x9'),'roundrobin':_0xa958('0xa')};function VoiceQueue(_0x3ddaa9){this['id']=_0x3ddaa9['id']||0x0;this[_0xa958('0xb')]=_0x3ddaa9[_0xa958('0xb')]||'';this[_0xa958('0xc')]=_0x3ddaa9['monitor_format']||'';this['type']=_0x3ddaa9[_0xa958('0xd')]||_0xa958('0xe');this[_0xa958('0xf')]=0x0;this[_0xa958('0x10')]=0x0;this[_0xa958('0x11')]=0x0;this[_0xa958('0x12')]=0x0;this[_0xa958('0x13')]=0x0;this[_0xa958('0x14')]=0x0;this[_0xa958('0x15')]=0x0;this[_0xa958('0x16')]=0x0;this[_0xa958('0x17')]=0x0;this[_0xa958('0x18')]=0x0;this[_0xa958('0x19')]=0x0;this['acw']=_0x3ddaa9['acw']||![];this['acwTimeout']=_0x3ddaa9[_0xa958('0x1a')]||0xa;this[_0xa958('0x1b')]=_0x3ddaa9[_0xa958('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this[_0xa958('0x1c')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x3ddaa9[_0xa958('0x1d')]||null;this[_0xa958('0x1e')]=_0x3ddaa9[_0xa958('0x1e')]?_0x3ddaa9[_0xa958('0x1e')]:null;this[_0xa958('0x1f')]=_0x3ddaa9[_0xa958('0x1f')];this[_0xa958('0x20')]=_0x3ddaa9[_0xa958('0x20')]||'progressive';this[_0xa958('0x21')]=_0x3ddaa9['dialLimitChannel']||0x0;this[_0xa958('0x22')]=_0x3ddaa9[_0xa958('0x22')]||0x0;this['dialPowerLevel']=_0x3ddaa9[_0xa958('0x23')]||0x1;this[_0xa958('0x24')]=_0x3ddaa9[_0xa958('0x24')]||_0xa958('0x25');this[_0xa958('0x26')]=_0x3ddaa9[_0xa958('0x26')]||0.03;this['dialPredictiveInterval']=_0x3ddaa9['dialPredictiveInterval']||0x258;this[_0xa958('0x27')]=_0x3ddaa9[_0xa958('0x27')]||_0xa958('0x28');this['dialOriginateCallerIdNumber']=_0x3ddaa9[_0xa958('0x29')]||_0xa958('0x28');this['dialOriginateTimeout']=_0x3ddaa9[_0xa958('0x2a')]||0x1e;this[_0xa958('0x2b')]=_0x3ddaa9['dialQueueOptions']||'tTxX';this[_0xa958('0x2c')]=_0x3ddaa9[_0xa958('0x2c')]||0x3;this['dialQueueProject']=_0x3ddaa9[_0xa958('0x2d')]||undefined;this[_0xa958('0x2e')]=_0x3ddaa9[_0xa958('0x2e')]||0x3;this[_0xa958('0x2f')]=_0x3ddaa9[_0xa958('0x2f')]||0x96;this[_0xa958('0x30')]=_0x3ddaa9['dialBusyMaxRetry']||0x3;this[_0xa958('0x31')]=_0x3ddaa9['dialBusyRetryFrequency']||0x96;this[_0xa958('0x32')]=_0x3ddaa9[_0xa958('0x32')]||0x3;this[_0xa958('0x33')]=_0x3ddaa9[_0xa958('0x33')]||0x96;this[_0xa958('0x34')]=_0x3ddaa9[_0xa958('0x34')]||0x3;this[_0xa958('0x35')]=_0x3ddaa9[_0xa958('0x35')]||0x96;this[_0xa958('0x36')]=_0x3ddaa9[_0xa958('0x36')]||0x3;this['dialDropRetryFrequency']=_0x3ddaa9['dialDropRetryFrequency']||0x96;this[_0xa958('0x37')]=_0x3ddaa9['dialAbandonedMaxRetry']||0x3;this[_0xa958('0x38')]=_0x3ddaa9[_0xa958('0x38')]||0x96;this['dialMachineMaxRetry']=_0x3ddaa9[_0xa958('0x39')]||0x3;this[_0xa958('0x3a')]=_0x3ddaa9[_0xa958('0x3a')]||0x96;this[_0xa958('0x3b')]=_0x3ddaa9[_0xa958('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3ddaa9['dialAgentRejectRetryFrequency']||0x96;this[_0xa958('0x3c')]=_0x3ddaa9['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x3ddaa9[_0xa958('0x3d')]?_0x3ddaa9[_0xa958('0x3d')]:undefined;this[_0xa958('0x3e')]=_0x3ddaa9[_0xa958('0x3e')]?_0x3ddaa9[_0xa958('0x3e')]:undefined;this[_0xa958('0x3f')]=_0x3ddaa9['dialPrefix']||undefined;this[_0xa958('0x40')]=_0x3ddaa9['Interval']?_0x3ddaa9['Interval']:undefined;this[_0xa958('0x41')]=_0x3ddaa9[_0xa958('0x41')]||_0xa958('0x42');this[_0xa958('0x43')]=_0x3ddaa9[_0xa958('0x43')]||undefined;this[_0xa958('0x44')]=_0x3ddaa9[_0xa958('0x44')]||undefined;this[_0xa958('0x45')]=strategy[_0x3ddaa9['strategy']]||'rrmemory';this[_0xa958('0x46')]=!![];this[_0xa958('0x47')]=_0x3ddaa9[_0xa958('0x47')]||![];this[_0xa958('0x48')]=_0x3ddaa9[_0xa958('0x48')];this['dialAMDGreeting']=_0x3ddaa9[_0xa958('0x49')];this[_0xa958('0x4a')]=_0x3ddaa9[_0xa958('0x4a')];this[_0xa958('0x4b')]=_0x3ddaa9['dialAMDTotalAnalysisTime'];this[_0xa958('0x4c')]=_0x3ddaa9[_0xa958('0x4c')];this[_0xa958('0x4d')]=_0x3ddaa9[_0xa958('0x4d')];this[_0xa958('0x4e')]=_0x3ddaa9['dialAMDMaximumNumberOfWords'];this[_0xa958('0x4f')]=_0x3ddaa9[_0xa958('0x4f')];this[_0xa958('0x50')]=_0x3ddaa9[_0xa958('0x50')];this[_0xa958('0x51')]=0x0;this[_0xa958('0x52')]=0x0;this[_0xa958('0x53')]=_0x3ddaa9[_0xa958('0x53')];this[_0xa958('0x54')]=0x0;this[_0xa958('0x55')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xa958('0x56')]=0x0;this[_0xa958('0x57')]=0x0;this[_0xa958('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xa958('0x59')]=0x0;this[_0xa958('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xa958('0x5b')]=0x0;this['outboundReCallsDay']=0x0;this[_0xa958('0x5c')]=0x0;this['startProgressive']=undefined;this[_0xa958('0x5d')]=undefined;this['handlePredictive']=undefined;this[_0xa958('0x5e')]=1.05;this[_0xa958('0x5f')]=0x0;this[_0xa958('0x60')]=0x0;this[_0xa958('0x61')]=0x0;this[_0xa958('0x62')]=0x0;this[_0xa958('0x63')]=0x0;this[_0xa958('0x64')]=0x0;this[_0xa958('0x65')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xa958('0x66')]=_0x3ddaa9[_0xa958('0x67')]||0x14;this[_0xa958('0x68')]=_0x3ddaa9['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xa958('0x69')]=0x1;this[_0xa958('0x6a')]=0x0;this[_0xa958('0x6b')]=0x0;this[_0xa958('0x6c')]=0x0;this[_0xa958('0x6d')]=0x0;this['dialRecallMeTimeout']=_0x3ddaa9[_0xa958('0x6e')]||0x1e;this[_0xa958('0x6f')]=_0x3ddaa9[_0xa958('0x6f')]||![];this[_0xa958('0x70')]=_0x3ddaa9[_0xa958('0x70')]||undefined;this[_0xa958('0x71')]=_0x3ddaa9[_0xa958('0x71')]||![];this[_0xa958('0x72')]=_0x3ddaa9[_0xa958('0x72')]||![];this[_0xa958('0xc')]=monitorFormat[_0x3ddaa9[_0xa958('0xc')]]?monitorFormat[_0x3ddaa9[_0xa958('0xc')]]:undefined;this[_0xa958('0x73')]=_0x3ddaa9[_0xa958('0x73')]||![];this[_0xa958('0x74')]=_0x3ddaa9[_0xa958('0x74')]?_0x3ddaa9[_0xa958('0x74')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xe1d7=['TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk'];(function(_0x473e08,_0x22a0c8){var _0x18b098=function(_0x4e4010){while(--_0x4e4010){_0x473e08['push'](_0x473e08['shift']());}};_0x18b098(++_0x22a0c8);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x179d86,_0x139c2c){_0x179d86=_0x179d86-0x0;var _0x437ec7=_0xe1d7[_0x179d86];return _0x437ec7;};'use strict';var statusDesc=['unknown',_0x7e1d('0x0'),'inuse','busy','invalid',_0x7e1d('0x1'),_0x7e1d('0x2'),_0x7e1d('0x3'),'onhold'];var monitorFormat={'wav':_0x7e1d('0x4'),'wav49':_0x7e1d('0x5'),'gsm':_0x7e1d('0x6')};var strategy={'rrmemory':_0x7e1d('0x7'),'roundrobin':_0x7e1d('0x8')};function VoiceQueue(_0x491c61){this['id']=_0x491c61['id']||0x0;this[_0x7e1d('0x9')]=_0x491c61[_0x7e1d('0x9')]||'';this['monitor_format']=_0x491c61[_0x7e1d('0xa')]||'';this[_0x7e1d('0xb')]=_0x491c61['type']||'inbound';this[_0x7e1d('0xc')]=0x0;this[_0x7e1d('0xd')]=0x0;this[_0x7e1d('0xe')]=0x0;this[_0x7e1d('0xf')]=0x0;this[_0x7e1d('0x10')]=0x0;this[_0x7e1d('0x11')]=0x0;this[_0x7e1d('0x12')]=0x0;this['unmanaged']=0x0;this[_0x7e1d('0x13')]=0x0;this[_0x7e1d('0x14')]=0x0;this[_0x7e1d('0x15')]=0x0;this[_0x7e1d('0x16')]=_0x491c61['acw']||![];this[_0x7e1d('0x17')]=_0x491c61[_0x7e1d('0x17')]||0xa;this[_0x7e1d('0x18')]=_0x491c61['autopause']||'no';this[_0x7e1d('0x19')]=!![];this[_0x7e1d('0x1a')]='';this['originated']=0x0;this['temp']=0x0;this[_0x7e1d('0x1b')]=_0x491c61[_0x7e1d('0x1b')]||null;this[_0x7e1d('0x1c')]=_0x491c61['dialGlobalInterval']?_0x491c61[_0x7e1d('0x1c')]:null;this[_0x7e1d('0x1d')]=_0x491c61['dialActive'];this[_0x7e1d('0x1e')]=_0x491c61[_0x7e1d('0x1e')]||_0x7e1d('0x1f');this[_0x7e1d('0x20')]=_0x491c61['dialLimitChannel']||0x0;this[_0x7e1d('0x21')]=_0x491c61[_0x7e1d('0x21')]||0x0;this[_0x7e1d('0x22')]=_0x491c61[_0x7e1d('0x22')]||0x1;this[_0x7e1d('0x23')]=_0x491c61[_0x7e1d('0x23')]||_0x7e1d('0x24');this['dialPredictiveOptimizationPercentage']=_0x491c61[_0x7e1d('0x25')]||0.03;this[_0x7e1d('0x26')]=_0x491c61[_0x7e1d('0x26')]||0x258;this[_0x7e1d('0x27')]=_0x491c61[_0x7e1d('0x27')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x491c61['dialOriginateCallerIdNumber']||_0x7e1d('0x28');this[_0x7e1d('0x29')]=_0x491c61[_0x7e1d('0x29')]||0x1e;this['dialQueueOptions']=_0x491c61[_0x7e1d('0x2a')]||'tTxX';this[_0x7e1d('0x2b')]=_0x491c61[_0x7e1d('0x2b')]||0x3;this[_0x7e1d('0x2c')]=_0x491c61[_0x7e1d('0x2c')]||undefined;this[_0x7e1d('0x2d')]=_0x491c61[_0x7e1d('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x491c61[_0x7e1d('0x2e')]||0x96;this[_0x7e1d('0x2f')]=_0x491c61[_0x7e1d('0x2f')]||0x3;this[_0x7e1d('0x30')]=_0x491c61[_0x7e1d('0x30')]||0x96;this[_0x7e1d('0x31')]=_0x491c61[_0x7e1d('0x31')]||0x3;this[_0x7e1d('0x32')]=_0x491c61['dialNoAnswerRetryFrequency']||0x96;this[_0x7e1d('0x33')]=_0x491c61[_0x7e1d('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x491c61[_0x7e1d('0x34')]||0x96;this[_0x7e1d('0x35')]=_0x491c61['dialDropMaxRetry']||0x3;this[_0x7e1d('0x36')]=_0x491c61[_0x7e1d('0x36')]||0x96;this[_0x7e1d('0x37')]=_0x491c61[_0x7e1d('0x37')]||0x3;this[_0x7e1d('0x38')]=_0x491c61[_0x7e1d('0x38')]||0x96;this[_0x7e1d('0x39')]=_0x491c61[_0x7e1d('0x39')]||0x3;this[_0x7e1d('0x3a')]=_0x491c61[_0x7e1d('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x491c61[_0x7e1d('0x3b')]||0x3;this[_0x7e1d('0x3c')]=_0x491c61[_0x7e1d('0x3c')]||0x96;this[_0x7e1d('0x3d')]=_0x491c61[_0x7e1d('0x3d')]||0x4;this[_0x7e1d('0x3e')]=_0x491c61[_0x7e1d('0x3e')]?_0x491c61[_0x7e1d('0x3e')]:undefined;this[_0x7e1d('0x3f')]=_0x491c61['TrunkBackup']?_0x491c61['TrunkBackup']:undefined;this[_0x7e1d('0x40')]=_0x491c61[_0x7e1d('0x40')]||undefined;this[_0x7e1d('0x41')]=_0x491c61[_0x7e1d('0x41')]?_0x491c61['Interval']:undefined;this[_0x7e1d('0x42')]=_0x491c61['dialOrderByScheduledAt']||_0x7e1d('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x491c61[_0x7e1d('0x44')]||undefined;this[_0x7e1d('0x45')]=_0x491c61[_0x7e1d('0x45')]||undefined;this['strategy']=strategy[_0x491c61[_0x7e1d('0x46')]]||_0x7e1d('0x7');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x491c61['dialAMDActive']||![];this[_0x7e1d('0x47')]=_0x491c61[_0x7e1d('0x47')];this[_0x7e1d('0x48')]=_0x491c61[_0x7e1d('0x48')];this[_0x7e1d('0x49')]=_0x491c61['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x491c61[_0x7e1d('0x4a')];this[_0x7e1d('0x4b')]=_0x491c61['dialAMDMinWordLength'];this[_0x7e1d('0x4c')]=_0x491c61[_0x7e1d('0x4c')];this[_0x7e1d('0x4d')]=_0x491c61[_0x7e1d('0x4d')];this[_0x7e1d('0x4e')]=_0x491c61['dialAMDSilenceThreshold'];this[_0x7e1d('0x4f')]=_0x491c61['dialAMDMaximumWordLength'];this[_0x7e1d('0x50')]=0x0;this[_0x7e1d('0x51')]=0x0;this['timeout']=_0x491c61[_0x7e1d('0x52')];this['outboundAnswerCallsDay']=0x0;this[_0x7e1d('0x53')]=0x0;this[_0x7e1d('0x54')]=0x0;this[_0x7e1d('0x55')]=0x0;this[_0x7e1d('0x56')]=0x0;this[_0x7e1d('0x57')]=0x0;this[_0x7e1d('0x58')]=0x0;this[_0x7e1d('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x7e1d('0x5a')]=0x0;this[_0x7e1d('0x5b')]=0x0;this[_0x7e1d('0x5c')]=0x0;this[_0x7e1d('0x5d')]=0x0;this[_0x7e1d('0x5e')]=0x0;this[_0x7e1d('0x5f')]=undefined;this[_0x7e1d('0x60')]=undefined;this[_0x7e1d('0x61')]=undefined;this[_0x7e1d('0x62')]=1.05;this[_0x7e1d('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x7e1d('0x64')]=0x0;this[_0x7e1d('0x65')]=0x0;this[_0x7e1d('0x66')]=0x0;this[_0x7e1d('0x67')]=0x0;this[_0x7e1d('0x68')]=0x0;this[_0x7e1d('0x69')]=0x0;this[_0x7e1d('0x6a')]=_0x491c61[_0x7e1d('0x6b')]||0x14;this['predictiveIntervalMinThreshold']=_0x491c61[_0x7e1d('0x6b')]||0xa;this[_0x7e1d('0x6c')]=0x0;this[_0x7e1d('0x6d')]=0x0;this[_0x7e1d('0x6e')]=0x1;this[_0x7e1d('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7e1d('0x70')]=0x0;this[_0x7e1d('0x71')]=0x0;this[_0x7e1d('0x72')]=_0x491c61['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x491c61[_0x7e1d('0x73')]||![];this['dialQueueProject2']=_0x491c61[_0x7e1d('0x74')]||undefined;this[_0x7e1d('0x75')]=_0x491c61['dialAgiAfterHangupClient']||![];this[_0x7e1d('0x76')]=_0x491c61[_0x7e1d('0x76')]||![];this[_0x7e1d('0xa')]=monitorFormat[_0x491c61['monitor_format']]?monitorFormat[_0x491c61[_0x7e1d('0xa')]]:undefined;this['mandatoryDisposition']=_0x491c61[_0x7e1d('0x77')]||![];this[_0x7e1d('0x78')]=_0x491c61[_0x7e1d('0x78')]?_0x491c61[_0x7e1d('0x78')]:undefined;}module[_0x7e1d('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 2cbe40d..9892e1b 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 _0x788e=['serverUrl','exports','name','username','accessKey','remoteUri'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x788e,0x12e));var _0xe788=function(_0x4003a5,_0x4ff235){_0x4003a5=_0x4003a5-0x0;var _0x1fe948=_0x788e[_0x4003a5];return _0x1fe948;};'use strict';function VtigerAccount(_0x5dbf8b){this['id']=_0x5dbf8b['id']||0x0;this[_0xe788('0x0')]=_0x5dbf8b[_0xe788('0x0')]||'';this[_0xe788('0x1')]=_0x5dbf8b[_0xe788('0x1')]||'';this[_0xe788('0x2')]=_0x5dbf8b['accessKey']||'';this[_0xe788('0x3')]=_0x5dbf8b[_0xe788('0x3')]||'';this['serverUrl']=_0x5dbf8b[_0xe788('0x4')]||'';this['Configurations']=_0x5dbf8b['Configurations']||{};}module[_0xe788('0x5')]=VtigerAccount; \ No newline at end of file +var _0x17ed=['username','accessKey','serverUrl','Configurations','name'];(function(_0x12e87f,_0x2fa71e){var _0x4e0f51=function(_0x54d5dd){while(--_0x54d5dd){_0x12e87f['push'](_0x12e87f['shift']());}};_0x4e0f51(++_0x2fa71e);}(_0x17ed,0xe0));var _0xd17e=function(_0x1c6d94,_0x5d731e){_0x1c6d94=_0x1c6d94-0x0;var _0x447596=_0x17ed[_0x1c6d94];return _0x447596;};'use strict';function VtigerAccount(_0x3f6810){this['id']=_0x3f6810['id']||0x0;this[_0xd17e('0x0')]=_0x3f6810[_0xd17e('0x0')]||'';this[_0xd17e('0x1')]=_0x3f6810['username']||'';this[_0xd17e('0x2')]=_0x3f6810[_0xd17e('0x2')]||'';this['remoteUri']=_0x3f6810['remoteUri']||'';this[_0xd17e('0x3')]=_0x3f6810[_0xd17e('0x3')]||'';this[_0xd17e('0x4')]=_0x3f6810[_0xd17e('0x4')]||{};}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 db5cb9e..78ad4e7 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 _0x3f73=['password','token','remoteUri','authType','type','integrationTab','Configurations','exports','name','username'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x3f73,0x1c0));var _0x33f7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3f73[_0x20a584];return _0x4b41a8;};'use strict';function ZendeskAccount(_0x18226f){this['id']=_0x18226f['id']||0x0;this['name']=_0x18226f[_0x33f7('0x0')]||'';this[_0x33f7('0x1')]=_0x18226f[_0x33f7('0x1')]||'';this[_0x33f7('0x2')]=_0x18226f[_0x33f7('0x2')]||'';this[_0x33f7('0x3')]=_0x18226f[_0x33f7('0x3')]||'';this[_0x33f7('0x4')]=_0x18226f[_0x33f7('0x4')]||'';this[_0x33f7('0x5')]=_0x18226f['authType']||'';this['type']=_0x18226f[_0x33f7('0x6')]||_0x33f7('0x7');this['serverUrl']=_0x18226f['serverUrl']||'';this[_0x33f7('0x8')]=_0x18226f[_0x33f7('0x8')]||{};}module[_0x33f7('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x77ad=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x1b5e1e,_0x5b657d){var _0x550594=function(_0x2da675){while(--_0x2da675){_0x1b5e1e['push'](_0x1b5e1e['shift']());}};_0x550594(++_0x5b657d);}(_0x77ad,0xc2));var _0xd77a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x77ad[_0x3947c9];return _0x2e7871;};'use strict';function ZendeskAccount(_0x4494ed){this['id']=_0x4494ed['id']||0x0;this[_0xd77a('0x0')]=_0x4494ed[_0xd77a('0x0')]||'';this[_0xd77a('0x1')]=_0x4494ed[_0xd77a('0x1')]||'';this[_0xd77a('0x2')]=_0x4494ed['password']||'';this['token']=_0x4494ed[_0xd77a('0x3')]||'';this[_0xd77a('0x4')]=_0x4494ed['remoteUri']||'';this[_0xd77a('0x5')]=_0x4494ed[_0xd77a('0x5')]||'';this['type']=_0x4494ed[_0xd77a('0x6')]||_0xd77a('0x7');this[_0xd77a('0x8')]=_0x4494ed[_0xd77a('0x8')]||'';this['Configurations']=_0x4494ed[_0xd77a('0x9')]||{};}module[_0xd77a('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 2d78370..acfddbd 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 _0x99b1=['refreshToken','Configurations','exports','name','description','host','zone','clientId','serverUrl','code'];(function(_0x9547e8,_0x363b43){var _0x40c793=function(_0x40d61b){while(--_0x40d61b){_0x9547e8['push'](_0x9547e8['shift']());}};_0x40c793(++_0x363b43);}(_0x99b1,0x1a7));var _0x199b=function(_0x5f0f5d,_0x4f3a10){_0x5f0f5d=_0x5f0f5d-0x0;var _0x3e3a54=_0x99b1[_0x5f0f5d];return _0x3e3a54;};'use strict';function ZohoAccount(_0x5a64d0){this['id']=_0x5a64d0['id']||0x0;this['name']=_0x5a64d0[_0x199b('0x0')]||'';this[_0x199b('0x1')]=_0x5a64d0[_0x199b('0x1')]||'';this[_0x199b('0x2')]=_0x5a64d0[_0x199b('0x2')]||'';this[_0x199b('0x3')]=_0x5a64d0[_0x199b('0x3')]||'';this[_0x199b('0x4')]=_0x5a64d0[_0x199b('0x4')]||'';this['clientSecret']=_0x5a64d0['clientSecret']||'';this[_0x199b('0x5')]=_0x5a64d0[_0x199b('0x5')]||'';this[_0x199b('0x6')]=_0x5a64d0[_0x199b('0x6')]||'';this[_0x199b('0x7')]=_0x5a64d0[_0x199b('0x7')]||'';this[_0x199b('0x8')]=_0x5a64d0['Configurations']||{};}module[_0x199b('0x9')]=ZohoAccount; \ No newline at end of file +var _0xbd57=['description','host','zone','clientId','clientSecret','serverUrl','refreshToken','Configurations','exports','name'];(function(_0x1fa989,_0x2502ac){var _0x16783c=function(_0x46f66e){while(--_0x46f66e){_0x1fa989['push'](_0x1fa989['shift']());}};_0x16783c(++_0x2502ac);}(_0xbd57,0x8b));var _0x7bd5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbd57[_0x432682];return _0x463d05;};'use strict';function ZohoAccount(_0x3ea2d5){this['id']=_0x3ea2d5['id']||0x0;this[_0x7bd5('0x0')]=_0x3ea2d5['name']||'';this['description']=_0x3ea2d5[_0x7bd5('0x1')]||'';this[_0x7bd5('0x2')]=_0x3ea2d5[_0x7bd5('0x2')]||'';this['zone']=_0x3ea2d5[_0x7bd5('0x3')]||'';this[_0x7bd5('0x4')]=_0x3ea2d5[_0x7bd5('0x4')]||'';this[_0x7bd5('0x5')]=_0x3ea2d5[_0x7bd5('0x5')]||'';this[_0x7bd5('0x6')]=_0x3ea2d5['serverUrl']||'';this['code']=_0x3ea2d5['code']||'';this[_0x7bd5('0x7')]=_0x3ea2d5[_0x7bd5('0x7')]||'';this[_0x7bd5('0x8')]=_0x3ea2d5['Configurations']||{};}module[_0x7bd5('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 54341e1..5046b49 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 _0x37cc=['active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','lodash','moment','string','isNil','uniqueid','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName'];(function(_0x32ac34,_0x485845){var _0x3ab69a=function(_0x33eeec){while(--_0x33eeec){_0x32ac34['push'](_0x32ac34['shift']());}};_0x3ab69a(++_0x485845);}(_0x37cc,0x6c));var _0xc37c=function(_0x174e6b,_0x124a26){_0x174e6b=_0x174e6b-0x0;var _0x10ab0e=_0x37cc[_0x174e6b];return _0x10ab0e;};'use strict';var util=require('util');var _=require(_0xc37c('0x0'));var moment=require(_0xc37c('0x1'));function checkNameSurname(_0x3a93b9,_0x53ae66,_0x2bb342){var _0x11c67f='';if(!_['isNil'](_0x53ae66)&&_0xc37c('0x2')===typeof _0x53ae66){_0x11c67f+=_0x53ae66;}if(!_[_0xc37c('0x3')](_0x2bb342)&&'string'===typeof _0x2bb342){_0x11c67f+='\x20'+_0x2bb342;}if(_0x11c67f!==''){return _0x11c67f;}return _0x3a93b9;}function Action(_0x2b868d,_0x1dc8f9,_0x48628a,_0x1381b6,_0x11e8e4){this[_0xc37c('0x4')]=_0x48628a||undefined;this['idContact']=_0x2b868d['id'];this['queue']=_0x1dc8f9['name'];this['type']=_0x1dc8f9[_0xc37c('0x5')];this[_0xc37c('0x6')]='queue';this[_0xc37c('0x7')]=![];this[_0xc37c('0x8')]=_[_0xc37c('0x3')](_0x2b868d[_0xc37c('0x9')])?undefined:_0x2b868d[_0xc37c('0x9')][_0xc37c('0xa')];this[_0xc37c('0xb')]=this[_0xc37c('0x8')]?util[_0xc37c('0xc')](_0xc37c('0xd'),this['membername']):_0x1381b6||undefined;this[_0xc37c('0xe')]=checkNameSurname(_0x2b868d[_0xc37c('0xf')][_0xc37c('0x10')],_0x2b868d[_0xc37c('0xf')]['firstName'],_0x2b868d[_0xc37c('0xf')][_0xc37c('0x11')]);this['active']=_0x2b868d[_0xc37c('0x12')]||![];this['calleridnum']=_0x2b868d[_0xc37c('0xf')]['phone'];this['scheduledat']=_0x2b868d[_0xc37c('0x13')];this[_0xc37c('0x14')]=_0x2b868d['countbusyretry']||0x0;this[_0xc37c('0x15')]=_0x2b868d[_0xc37c('0x15')]||0x0;this[_0xc37c('0x16')]=_0x2b868d['countnoanswerretry']||0x0;this[_0xc37c('0x17')]=(_0x2b868d['countbusyretry']||0x0)+(_0x2b868d[_0xc37c('0x15')]||0x0)+(_0x2b868d[_0xc37c('0x16')]||0x0)+(_0x2b868d[_0xc37c('0x18')]||0x0)+(_0x2b868d[_0xc37c('0x19')]||0x0)+(_0x2b868d['countabandonedretry']||0x0)+(_0x2b868d['countmachineretry']||0x0)+(_0x2b868d[_0xc37c('0x1a')]||0x0);this[_0xc37c('0x18')]=_0x2b868d[_0xc37c('0x18')]||0x0;this[_0xc37c('0x19')]=_0x2b868d[_0xc37c('0x19')]||0x0;this[_0xc37c('0x1b')]=_0x2b868d[_0xc37c('0x1b')]||0x0;this[_0xc37c('0x1c')]=_0x2b868d[_0xc37c('0x1c')]||0x0;this[_0xc37c('0x1a')]=_0x2b868d['countagentrejectretry']||0x0;this[_0xc37c('0x1d')]=_0x2b868d[_0xc37c('0x1d')];this[_0xc37c('0x1e')]=_0x2b868d[_0xc37c('0x1e')];this[_0xc37c('0x1f')]=_0x2b868d['callbackat'];this[_0xc37c('0x20')]=_0x2b868d[_0xc37c('0x20')];this[_0xc37c('0x21')]=_0x2b868d[_0xc37c('0x21')];this[_0xc37c('0x22')]=_0x2b868d[_0xc37c('0x22')];this[_0xc37c('0x23')]=_['isNil'](_0x2b868d[_0xc37c('0x9')])?_0x2b868d['UserId']:_0x2b868d[_0xc37c('0x9')]['id'];this[_0xc37c('0x24')]=_0x2b868d[_0xc37c('0x24')];this[_0xc37c('0x25')]='';this[_0xc37c('0x26')]='';}Action[_0xc37c('0x27')][_0xc37c('0x28')]=function(){return util[_0xc37c('0xc')](_0xc37c('0x29'),this[_0xc37c('0xe')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x26d3=['\x22%s\x22\x20<%s>','exports','util','lodash','moment','string','uniqueid','queue','name','type','isNil','Agent','membername','format','SIP/%s','calleridname','phone','Contact','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x26d3,0x9e));var _0x326d=function(_0x1b0dd3,_0x201019){_0x1b0dd3=_0x1b0dd3-0x0;var _0x2daa63=_0x26d3[_0x1b0dd3];return _0x2daa63;};'use strict';var util=require(_0x326d('0x0'));var _=require(_0x326d('0x1'));var moment=require(_0x326d('0x2'));function checkNameSurname(_0x4de2b9,_0x15c47c,_0x5572c3){var _0x1a22cb='';if(!_['isNil'](_0x15c47c)&&'string'===typeof _0x15c47c){_0x1a22cb+=_0x15c47c;}if(!_['isNil'](_0x5572c3)&&_0x326d('0x3')===typeof _0x5572c3){_0x1a22cb+='\x20'+_0x5572c3;}if(_0x1a22cb!==''){return _0x1a22cb;}return _0x4de2b9;}function Action(_0x3facfb,_0x41146d,_0x4a544e,_0x5a386b,_0x22ed97){this[_0x326d('0x4')]=_0x4a544e||undefined;this['idContact']=_0x3facfb['id'];this[_0x326d('0x5')]=_0x41146d[_0x326d('0x6')];this['type']=_0x41146d[_0x326d('0x7')];this['campaigntype']=_0x326d('0x5');this['dialAnswer']=![];this['membername']=_[_0x326d('0x8')](_0x3facfb[_0x326d('0x9')])?undefined:_0x3facfb[_0x326d('0x9')][_0x326d('0x6')];this['channelAgent']=this[_0x326d('0xa')]?util[_0x326d('0xb')](_0x326d('0xc'),this['membername']):_0x5a386b||undefined;this[_0x326d('0xd')]=checkNameSurname(_0x3facfb['Contact'][_0x326d('0xe')],_0x3facfb[_0x326d('0xf')][_0x326d('0x10')],_0x3facfb[_0x326d('0xf')]['lastName']);this[_0x326d('0x11')]=_0x3facfb['active']||![];this[_0x326d('0x12')]=_0x3facfb['Contact'][_0x326d('0xe')];this[_0x326d('0x13')]=_0x3facfb['scheduledat'];this[_0x326d('0x14')]=_0x3facfb[_0x326d('0x14')]||0x0;this[_0x326d('0x15')]=_0x3facfb[_0x326d('0x15')]||0x0;this[_0x326d('0x16')]=_0x3facfb[_0x326d('0x16')]||0x0;this['countglobal']=(_0x3facfb['countbusyretry']||0x0)+(_0x3facfb[_0x326d('0x15')]||0x0)+(_0x3facfb[_0x326d('0x16')]||0x0)+(_0x3facfb[_0x326d('0x17')]||0x0)+(_0x3facfb[_0x326d('0x18')]||0x0)+(_0x3facfb['countabandonedretry']||0x0)+(_0x3facfb['countmachineretry']||0x0)+(_0x3facfb[_0x326d('0x19')]||0x0);this[_0x326d('0x17')]=_0x3facfb[_0x326d('0x17')]||0x0;this[_0x326d('0x18')]=_0x3facfb[_0x326d('0x18')]||0x0;this[_0x326d('0x1a')]=_0x3facfb[_0x326d('0x1a')]||0x0;this[_0x326d('0x1b')]=_0x3facfb[_0x326d('0x1b')]||0x0;this[_0x326d('0x19')]=_0x3facfb[_0x326d('0x19')]||0x0;this[_0x326d('0x1c')]=_0x3facfb[_0x326d('0x1c')];this['callbackuniqueid']=_0x3facfb[_0x326d('0x1d')];this['callbackat']=_0x3facfb[_0x326d('0x1e')];this[_0x326d('0x1f')]=_0x3facfb[_0x326d('0x1f')];this['ContactId']=_0x3facfb['ContactId'];this['ListId']=_0x3facfb['ListId'];this['UserId']=_['isNil'](_0x3facfb[_0x326d('0x9')])?_0x3facfb[_0x326d('0x20')]:_0x3facfb['Agent']['id'];this[_0x326d('0x21')]=_0x3facfb[_0x326d('0x21')];this['originatecalleridnum']='';this[_0x326d('0x22')]='';}Action[_0x326d('0x23')][_0x326d('0x24')]=function(){return util[_0x326d('0xb')](_0x326d('0x25'),this[_0x326d('0xd')],this['number']);};module[_0x326d('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ffa88c7..789733f 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 _0x117e=['lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./util/util','defaults','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','booked','preview','dialActive','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','Action','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','recallMe','getContactRecallMe','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','logCustomer','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','buildAcw','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','VoiceQueueId','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','dialOriginateCallerIdNumber','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','channelAgent','destconnectedlinenum','calleridnum','user:%s','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x117e,0x151));var _0xe117=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x117e[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xe117('0x0'));var _=require(_0xe117('0x1'));var BPromise=require(_0xe117('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0xe117('0x3'));var Redis=require(_0xe117('0x4'));var config=require(_0xe117('0x5'));var logger=require(_0xe117('0x6'))('preview');var loggerAction=require('../../../config/logger')(_0xe117('0x7'));var ami=require('../ami');var rpcDb=require(_0xe117('0x8'));var Action=require('./action');var ut=require(_0xe117('0x9'));config['redis']=_[_0xe117('0xa')](config[_0xe117('0xb')],{'host':_0xe117('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe117('0xd')][_0xe117('0xe')]=function(_0x4d0d5b){this[_0xe117('0xf')]=this[_0xe117('0xf')]?this['tail'][_0xe117('0x10')](_0x4d0d5b):_0x4d0d5b();};function Preview(_0x22f5b7){this[_0xe117('0x11')]=new Sequence();this[_0xe117('0x12')]=_0x22f5b7['voiceQueues'];this[_0xe117('0x13')]=_0x22f5b7[_0xe117('0x13')];this[_0xe117('0x14')]={};this[_0xe117('0x15')]=_0x22f5b7[_0xe117('0x15')];this[_0xe117('0x16')]=0x0;ami['on']('originateresponse',this[_0xe117('0x17')][_0xe117('0x18')](this));ami['on'](_0xe117('0x19'),this[_0xe117('0x1a')]['bind'](this));ami['on'](_0xe117('0x1b'),this['syncHangupRequest'][_0xe117('0x18')](this));ami['on'](_0xe117('0x1c'),this[_0xe117('0x1d')][_0xe117('0x18')](this));ami['on'](_0xe117('0x1e'),this[_0xe117('0x1f')][_0xe117('0x18')](this));ami['on'](_0xe117('0x20'),this['syncVarSet']['bind'](this));ami['on'](_0xe117('0x21'),this[_0xe117('0x22')][_0xe117('0x18')](this));ami['on'](_0xe117('0x23'),this[_0xe117('0x24')][_0xe117('0x18')](this));this[_0xe117('0x25')](this[_0xe117('0x12')]);}function emit(_0x1c6b26,_0x1351a6,_0x42e5eb){io['to'](_0x1c6b26)[_0xe117('0x26')](_0x1351a6,_0x42e5eb);}function emitCampaignPreview(_0x93e29e){if(_0x93e29e[_0xe117('0x27')]===_0xe117('0x28')){var _0x33325d={'id':_0x93e29e['id'],'name':_0x93e29e['name'],'strategy':_0x93e29e[_0xe117('0x29')],'answered':_0x93e29e[_0xe117('0x2a')],'available':_0x93e29e[_0xe117('0x2b')],'loggedIn':_0x93e29e[_0xe117('0x2c')],'pTalking':_0x93e29e[_0xe117('0x2d')],'sumBillable':_0x93e29e[_0xe117('0x2e')],'sumDuration':_0x93e29e[_0xe117('0x2f')],'sumHoldTime':_0x93e29e[_0xe117('0x30')]||0x0,'talking':_0x93e29e[_0xe117('0x31')],'total':_0x93e29e[_0xe117('0x32')],'type':_0x93e29e[_0xe117('0x27')],'unmanaged':_0x93e29e['unmanaged'],'abandoned':_0x93e29e[_0xe117('0x33')],'waiting':_0x93e29e[_0xe117('0x34')],'loggedInDb':_0x93e29e[_0xe117('0x35')],'dialActive':_0x93e29e['dialActive'],'dialMethod':_0x93e29e['dialMethod'],'dialOriginateCallerIdName':_0x93e29e[_0xe117('0x36')],'dialOriginateCallerIdNumber':_0x93e29e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x93e29e[_0xe117('0x37')],'dialPrefix':_0x93e29e[_0xe117('0x38')],'outboundAnswerAgiCallsDay':_0x93e29e[_0xe117('0x39')],'outboundAnswerCallsDay':_0x93e29e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x93e29e[_0xe117('0x3a')],'outboundBusyCallsDay':_0x93e29e[_0xe117('0x3b')],'outboundCongestionCallsDay':_0x93e29e[_0xe117('0x3c')],'outboundDropCallsDayACS':_0x93e29e['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x93e29e[_0xe117('0x3d')],'outboundDropCallsDayTimeout':_0x93e29e[_0xe117('0x3e')],'outboundNoAnswerCallsDay':_0x93e29e[_0xe117('0x3f')],'outboundNoSuchCallsDay':_0x93e29e[_0xe117('0x40')],'outboundOriginateFailureCallsDay':_0x93e29e[_0xe117('0x41')],'outboundReCallsDay':_0x93e29e['outboundReCallsDay'],'outboundRejectCallsDay':_0x93e29e[_0xe117('0x42')],'outboundUnknownCallsDay':_0x93e29e['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x93e29e[_0xe117('0x43')],'predictiveIntervalAnsweredCalls':_0x93e29e[_0xe117('0x44')],'predictiveIntervalAvgHoldtime':_0x93e29e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x93e29e[_0xe117('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x93e29e['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x93e29e[_0xe117('0x46')],'predictiveIntervalErlangCalls':_0x93e29e[_0xe117('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x93e29e[_0xe117('0x48')],'predictiveIntervalHitRate':_0x93e29e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x93e29e[_0xe117('0x49')],'predictiveIntervalPauses':_0x93e29e[_0xe117('0x4a')],'predictiveIntervalAvailable':_0x93e29e[_0xe117('0x4b')],'predictiveIntervalTotalCalls':_0x93e29e[_0xe117('0x4c')],'message':_0x93e29e[_0xe117('0x4d')],'originated':_0x93e29e[_0xe117('0x4e')],'erlangCalls':_0x93e29e[_0xe117('0x4f')],'erlangCallToSecond':_0x93e29e['erlangCallToSecond'],'erlangAbandonmentRate':_0x93e29e[_0xe117('0x50')],'erlangBusyFactor':_0x93e29e[_0xe117('0x51')],'startPredictive':_0x93e29e[_0xe117('0x52')],'startProgressive':_0x93e29e[_0xe117('0x53')]};if(_0x93e29e[_0xe117('0x54')]){_0x33325d[_0xe117('0x54')]={'id':_0x93e29e[_0xe117('0x54')]['id'],'name':_0x93e29e['Trunk'][_0xe117('0x55')],'active':_0x93e29e[_0xe117('0x54')][_0xe117('0x56')],'callerid':_0x93e29e[_0xe117('0x54')][_0xe117('0x57')]};}if(_0x93e29e[_0xe117('0x58')]){_0x33325d[_0xe117('0x58')]={'id':_0x93e29e[_0xe117('0x58')]['id'],'name':_0x93e29e[_0xe117('0x58')][_0xe117('0x55')]};}var _0x25f175=md5(JSON[_0xe117('0x59')](_0x33325d));if(_0x93e29e[_0xe117('0x3')]!==_0x25f175){_0x93e29e[_0xe117('0x3')]=_0x25f175;emit(util[_0xe117('0x5a')](_0xe117('0x5b'),_0x33325d['name']),'voice_queue:save',_0x33325d);}}}function emitVoiceQueueChannelRemove(_0xd52294){logger[_0xe117('0x5c')](_0xe117('0x5d'),JSON[_0xe117('0x59')](_0xd52294));emit(util[_0xe117('0x5a')](_0xe117('0x5b'),_0xd52294[_0xe117('0x55')]),'voice_queue_channel:remove',_0xd52294);io['emit'](_0xe117('0x5e'),_0xd52294);}function notSendMessagesQueue(_0x492178){if(_0x492178[_0xe117('0x5f')]){if(_0x492178[_0xe117('0x4e')]===0x0&&_0x492178[_0xe117('0x2d')]===0x0){_0x492178[_0xe117('0x5f')]=![];_0x492178[_0xe117('0x2b')]=0x0;_0x492178[_0xe117('0x60')]=0x0;_0x492178[_0xe117('0x4d')]='NOT_ACTIVE';ut[_0xe117('0x61')](_0xe117('0x62'),_0x492178[_0xe117('0x55')]+_0xe117('0x63'));}else{_0x492178['message']='IS_DISACTIVED';ut[_0xe117('0x61')](_0xe117('0x62'),_0x492178[_0xe117('0x55')]+_0xe117('0x64'));}emitCampaignPreview(_0x492178);}}Preview['prototype'][_0xe117('0x25')]=function(){var _0x5d8321=this;setInterval(function(){_0x5d8321[_0xe117('0x65')]();},0x7cf);};Preview[_0xe117('0xd')][_0xe117('0x65')]=function(){var _0x30fe8f=this[_0xe117('0x12')];this[_0xe117('0x16')]+=0x1;for(var _0x31b0ca in _0x30fe8f){if(_0x30fe8f[_0xe117('0x66')](_0x31b0ca)&&(_0x30fe8f[_0x31b0ca][_0xe117('0x67')]==='preview'||_0x30fe8f[_0x31b0ca][_0xe117('0x67')]===_0xe117('0x68'))&&_0x30fe8f[_0x31b0ca][_0xe117('0x27')]===_0xe117('0x28')){if(this[_0xe117('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x30fe8f[_0xe117('0x66')](_0x31b0ca)&&_0x30fe8f[_0x31b0ca][_0xe117('0x67')]===_0xe117('0x69')&&_0x30fe8f[_0x31b0ca][_0xe117('0x27')]==='outbound'){if(_0x30fe8f[_0x31b0ca][_0xe117('0x6a')]){this['setMessage'](_0x30fe8f[_0x31b0ca]);this['recallMe'](_0x30fe8f[_0x31b0ca]);}else{notSendMessagesQueue(_0x30fe8f[_0x31b0ca]);}}}};Preview[_0xe117('0xd')][_0xe117('0x6b')]=function(_0x3cc2bb){var _0x584325=this;this[_0xe117('0x11')][_0xe117('0xe')](function(){if(!_[_0xe117('0x6c')](_0x584325[_0xe117('0x14')][_0x3cc2bb])){loggerAction[_0xe117('0x5c')](_0xe117('0x6d'),_0x3cc2bb,_0xe117('0x6e'),_0x584325[_0xe117('0x14')][_0x3cc2bb][_0xe117('0x6f')],_0xe117('0x70'),JSON[_0xe117('0x59')](_0x584325[_0xe117('0x12')][_0x584325[_0xe117('0x14')][_0x3cc2bb][_0xe117('0x6f')]][_0xe117('0x4e')]),_0xe117('0x71'),JSON['stringify'](_0x584325[_0xe117('0x12')][_0x584325[_0xe117('0x14')][_0x3cc2bb][_0xe117('0x6f')]][_0xe117('0x2d')]),JSON['stringify'](_0x584325[_0xe117('0x14')][_0x3cc2bb][_0xe117('0x72')]),JSON['stringify'](_[_0xe117('0x73')](_0x584325[_0xe117('0x14')][_0x3cc2bb],[_0xe117('0x74'),_0xe117('0x75'),'VoiceQueueId','ListId'])));return ami[_0xe117('0x76')]({'action':'status','channel':_0x584325['actions'][_0x3cc2bb]['channel']})[_0xe117('0x77')](function(_0x409f1a){if(_0x409f1a[_0xe117('0x4d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x584325[_0xe117('0x14')][_0x3cc2bb]){ut[_0xe117('0x78')](_0x584325['campaignsPreview'][_0x584325[_0xe117('0x14')][_0x3cc2bb][_0xe117('0x6f')]],_0xe117('0x79'));if(_0x584325[_0xe117('0x14')][_0x3cc2bb][_0xe117('0x72')]===!![]){ut[_0xe117('0x7a')](_0x584325[_0xe117('0x12')][_0x584325['actions'][_0x3cc2bb][_0xe117('0x6f')]],'[clearZombieChannel]');ut[_0xe117('0x7b')](_0xe117('0x7c')+_0x3cc2bb,_0x584325['actions'][_0x3cc2bb][_0xe117('0x6f')]);}ut['loggerError'](_0xe117('0x7d')+_0x3cc2bb,_0x584325['actions'][_0x3cc2bb][_0xe117('0x6f')]);delete _0x584325[_0xe117('0x14')][_0x3cc2bb];}},0x2328);}});}});};Preview[_0xe117('0xd')][_0xe117('0x7e')]=function(){var _0x4e6ff0=this;loggerAction[_0xe117('0x5c')](_0xe117('0x7f'),_[_0xe117('0x80')](this[_0xe117('0x14')]));for(var _0x2725b0 in this[_0xe117('0x14')]){if(_0x4e6ff0[_0xe117('0x14')][_0xe117('0x66')](_0x2725b0)){_0x4e6ff0['clearZombieChannel'](_0x2725b0);}}};Preview[_0xe117('0xd')][_0xe117('0x81')]=function(_0x3162eb){var _0x4c5993=this;rpcDb[_0xe117('0x82')](_0x3162eb['id'],ut['agentReadyId'](this[_0xe117('0x15')]))[_0xe117('0x83')](function(_0x3700ba){if(!_[_0xe117('0x6c')](_0x3700ba)){for(var _0x2f9a62=0x0;_0x2f9a62<_0x3700ba['length'];_0x2f9a62+=0x1){if(ut[_0xe117('0x84')](_0x3700ba[_0x2f9a62][_0xe117('0x85')])<_0x3162eb[_0xe117('0x86')]*0x3c){if(_0x3700ba[_0x2f9a62][_0xe117('0x87')]&&!_0x3700ba[_0x2f9a62][_0xe117('0x87')]['voicePause']){_0x4c5993[_0xe117('0x88')](_0x3700ba[_0x2f9a62]['id'])['then'](ut[_0xe117('0x89')](_0xe117('0x8a')))[_0xe117('0x77')](ut[_0xe117('0x89')](_0xe117('0x8a')));}else{rpcDb[_0xe117('0x8b')](_0x3700ba[_0x2f9a62]['id']);}}else{var _0x1676a2=new Action(_0x3700ba[_0x2f9a62],_0x3162eb);_0x1676a2['starttime']=moment()['format'](_0xe117('0x8c'));_0x3162eb['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x1676a2,0x17,_0xe117('0x8d'));if(_0x3162eb['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0xe117('0x8e')](_0x3700ba[_0x2f9a62]));rpcDb[_0xe117('0x8f')](_0x1676a2,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x1676a2,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x1676a2,_0xe117('0x90'));rpcDb[_0xe117('0x91')](_0x1676a2,_0xe117('0x90'));}}}}})['catch'](ut[_0xe117('0x89')](_0xe117('0x92')));};Preview['prototype'][_0xe117('0x93')]=function(_0x3ec206){_0x3ec206[_0xe117('0x5f')]=!![];if(ut[_0xe117('0x94')](_0x3ec206['loggedIn'])){_0x3ec206['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0xe117('0x95')](_0x3ec206[_0xe117('0x6a')])){_0x3ec206['message']=_0xe117('0x96');}else if(!this[_0xe117('0x97')](_0x3ec206['Trunk'])){if(!this[_0xe117('0x97')](_0x3ec206[_0xe117('0x98')])){_0x3ec206['message']=_0xe117('0x99');}else{_0x3ec206['message']=_0xe117('0x9a');}}else{_0x3ec206[_0xe117('0x4d')]='ACTIVE';}emitCampaignPreview(_0x3ec206);};Preview[_0xe117('0xd')][_0xe117('0x9b')]=function(_0x385c67,_0x668b75,_0x4ee491){var _0x4e3815=this;var _0x469097=this['actions'][_0x668b75];var _0x27e3e4=this['campaignsPreview'][_0x469097['queue']];var _0x20b633;if(_0x27e3e4){switch(_0x4ee491){case'1':_0x27e3e4[_0xe117('0x40')]+=0x1;_0x469097['countnosuchnumberretry']+=0x1;_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut[_0xe117('0x9e')](_0x469097,0x0,_0xe117('0x9f'));ami[_0xe117('0x26')](_0xe117('0xa0'),ut['buildObj'](_0x469097,_0xe117('0xa1')));rpcDb[_0xe117('0x8f')](_0x469097,_0xe117('0xa2'));if(ut[_0xe117('0x9d')](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb[_0xe117('0x91')](_0x20b633,_0xe117('0xa6'));}else{if(_0x469097[_0xe117('0xa7')]>=_0x27e3e4['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x469097,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xe117('0xa8')](ut['scheduledAt'](_0x469097,'countnosuchnumberretry',_0x27e3e4[_0xe117('0xa9')]),_0x469097[_0xe117('0xaa')],_0x469097[_0xe117('0xab')]);}}delete this[_0xe117('0x14')][_0x385c67[_0xe117('0xac')]];break;case _0xe117('0xad'):var _0xc4a512=moment()[_0xe117('0x5a')](_0xe117('0x8c'));_0x469097['responsetime']=_0xc4a512;_0x469097[_0xe117('0xae')]=_0xc4a512;_0x469097[_0xe117('0x72')]=!![];_0x27e3e4[_0xe117('0x2d')]+=0x1;logger[_0xe117('0x5c')]('[syncHangup][talking][increment]',_0x469097[_0xe117('0xaf')],_0xe117('0xb0'),_0x27e3e4[_0xe117('0x55')],_0xe117('0x71'),_0x27e3e4[_0xe117('0x2d')]);ami[_0xe117('0x26')](_0xe117('0xb1'),ut[_0xe117('0xb2')](_0x469097,'connect',this[_0xe117('0x12')][_0x469097['queue']]));if(_0x27e3e4['acw']){ami[_0xe117('0x26')]('custom:agentConnectPreview',ut[_0xe117('0xb3')](_0x469097));}break;case'16':ami[_0xe117('0x26')]('custom:agentcomplete',ut[_0xe117('0xb2')](_0x469097,_0xe117('0xb4'),this['campaignsPreview'][_0x469097[_0xe117('0x6f')]]));emitVoiceQueueChannelRemove(ut[_0xe117('0xb2')](_0x469097,_0xe117('0xb4')));_0x27e3e4[_0xe117('0xb5')]+=0x1;_0x27e3e4['total']+=0x1;_0x27e3e4[_0xe117('0x2a')]+=0x1;ut[_0xe117('0x7a')](_0x27e3e4,_0xe117('0xb6'));_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut[_0xe117('0x9e')](_0x469097,0x4,_0xe117('0xb7'));rpcDb[_0xe117('0x8f')](_0x469097,_0xe117('0xb8'));rpcDb[_0xe117('0x91')](_0x469097,_0xe117('0xb9'));rpcDb[_0xe117('0xba')](_0x469097);_0x27e3e4['sumDuration']+=_0x469097['talktime'];_0x27e3e4[_0xe117('0x2e')]+=_0x469097[_0xe117('0xbb')];logger['info']('[syncHangup][talking][decrement]',_0x469097['uniqueid'],_0xe117('0xb0'),_0x27e3e4[_0xe117('0x55')],_0xe117('0x71'),_0x27e3e4[_0xe117('0x2d')]);delete this[_0xe117('0x14')][_0x385c67[_0xe117('0xac')]];break;case _0xe117('0xbc'):_0x27e3e4['outboundBusyCallsDay']+=0x1;_0x469097['countbusyretry']+=0x1;_0x469097[_0xe117('0x9c')]=ut['totalGlobal'](_0x469097);ut[_0xe117('0x9e')](_0x469097,0x5,'Busy');ami[_0xe117('0x26')](_0xe117('0xbd'),ut[_0xe117('0xb2')](_0x469097,_0xe117('0xbe')));rpcDb[_0xe117('0x8f')](_0x469097,_0xe117('0xbf'));if(ut[_0xe117('0x9d')](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb['createCustomerFinal'](_0x20b633,_0xe117('0xc0'));}else{if(_0x469097[_0xe117('0xc1')]>=_0x27e3e4[_0xe117('0xc2')]){rpcDb[_0xe117('0x91')](_0x469097,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xe117('0xc3')](_0x469097,_0xe117('0xc1'),_0x27e3e4[_0xe117('0xc4')]),_0x469097[_0xe117('0xaa')],_0x469097['activeContact']);}}break;case'NOANSWER':_0x27e3e4['outboundNoAnswerCallsDay']+=0x1;_0x469097[_0xe117('0xc5')]+=0x1;_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut['logCustomer'](_0x469097,0x3,'NoAnswer');ami[_0xe117('0x26')](_0xe117('0xc6'),ut[_0xe117('0xb2')](_0x469097,_0xe117('0xc7')));rpcDb['createCustomerHistory'](_0x469097,_0xe117('0xc8'));if(ut[_0xe117('0x9d')](_0x469097)>=_0x27e3e4['dialGlobalMaxRetry']){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb[_0xe117('0x91')](_0x20b633,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x469097['countnoanswerretry']>=_0x27e3e4[_0xe117('0xc9')]){rpcDb['createCustomerFinal'](_0x469097,_0xe117('0xc8'));}else{rpcDb[_0xe117('0xa8')](ut[_0xe117('0xc3')](_0x469097,_0xe117('0xc5'),_0x27e3e4[_0xe117('0xca')]),_0x469097[_0xe117('0xaa')],_0x469097[_0xe117('0xab')]);}}break;case'CONGESTION':_0x27e3e4['outboundCongestionCallsDay']+=0x1;_0x469097['countcongestionretry']+=0x1;_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut['logCustomer'](_0x469097,0x8,'Congestion');ami[_0xe117('0x26')](_0xe117('0xcb'),ut['buildObj'](_0x469097,'congestion'));rpcDb[_0xe117('0x8f')](_0x469097,_0xe117('0xcc'));if(ut[_0xe117('0x9d')](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb['createCustomerFinal'](_0x20b633,_0xe117('0xcd'));}else{if(_0x469097[_0xe117('0xce')]>=_0x27e3e4[_0xe117('0xcf')]){rpcDb[_0xe117('0x91')](_0x469097,_0xe117('0xcc'));}else{rpcDb[_0xe117('0xa8')](ut[_0xe117('0xc3')](_0x469097,'countcongestionretry',_0x27e3e4[_0xe117('0xc4')]),_0x469097[_0xe117('0xaa')],_0x469097[_0xe117('0xab')]);}}break;case'CANCEL':_0x27e3e4[_0xe117('0x42')]+=0x1;_0x469097[_0xe117('0xd0')]+=0x1;_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut[_0xe117('0x9e')](_0x469097,0x14,_0xe117('0xd1'));ami[_0xe117('0x26')](_0xe117('0xd2'),ut[_0xe117('0xb2')](_0x469097,_0xe117('0xd3')));rpcDb[_0xe117('0x8f')](_0x469097,_0xe117('0xd4'));if(ut['totalGlobal'](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0x14,_0xe117('0xd1'));rpcDb[_0xe117('0x91')](_0x20b633,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x469097[_0xe117('0xd0')]>=_0x27e3e4['dialAgentRejectMaxRetry']){rpcDb[_0xe117('0x91')](_0x469097,_0xe117('0xd5'));}else{rpcDb[_0xe117('0xa8')](ut[_0xe117('0xc3')](_0x469097,'countagentrejectretry',_0x27e3e4[_0xe117('0xd6')]),_0x469097[_0xe117('0xaa')],_0x469097['activeContact']);}}break;case _0xe117('0xd7'):_0x27e3e4[_0xe117('0x43')]+=0x1;_0x469097[_0xe117('0xd8')]+=0x1;_0x469097[_0xe117('0x9c')]=ut['totalGlobal'](_0x469097);ut[_0xe117('0x9e')](_0x469097,0xb,_0xe117('0xd9'));rpcDb['createCustomerHistory'](_0x469097,_0xe117('0xda'));if(ut['totalGlobal'](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb[_0xe117('0x91')](_0x20b633,_0xe117('0xda'));}else{if(_0x469097['countabandonedetry']>=_0x27e3e4[_0xe117('0xdb')]){rpcDb['createCustomerFinal'](_0x469097,_0xe117('0xda'));}else{rpcDb['rescheduleContact'](ut[_0xe117('0xc3')](_0x469097,_0xe117('0xd8'),_0x27e3e4[_0xe117('0xdc')]),_0x469097[_0xe117('0xaa')],_0x469097[_0xe117('0xab')]);}}break;case'18':_0x27e3e4[_0xe117('0xdd')]+=0x1;_0x469097['countmachineretry']+=0x1;_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut[_0xe117('0x9e')](_0x469097,0x12,_0x385c67[_0xe117('0xde')]||_0x385c67[_0xe117('0xdf')]);ami[_0xe117('0x26')](_0xe117('0xe0'),ut[_0xe117('0xb2')](_0x469097,_0xe117('0xe1')));rpcDb['createCustomerHistory'](_0x469097,_0xe117('0xe2'));if(ut[_0xe117('0x9d')](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb[_0xe117('0x91')](_0x20b633,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xe117('0x91')](_0x469097,_0xe117('0xe2'));}delete this['actions'][_0x385c67[_0xe117('0xac')]];break;case'19':_0x27e3e4[_0xe117('0xdd')]+=0x1;_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut[_0xe117('0x9e')](_0x469097,0x13,_0x385c67[_0xe117('0xde')]||_0x385c67[_0xe117('0xdf')]);ami[_0xe117('0x26')](_0xe117('0xe0'),ut['buildObj'](_0x469097,'amd'));rpcDb[_0xe117('0x8f')](_0x469097,_0xe117('0xe3'));if(ut[_0xe117('0x9d')](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb[_0xe117('0x91')](_0x20b633,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe117('0x91')](_0x469097,_0xe117('0xe3'));}delete this[_0xe117('0x14')][_0x385c67[_0xe117('0xac')]];break;default:if(_0x469097['dialAnswer']){ut[_0xe117('0x7a')](_0x27e3e4,_0xe117('0xe4'));ut[_0xe117('0x7b')](_0xe117('0xe5')+_0x27e3e4['name'],_0x385c67);}_0x27e3e4['outboundUnknownCallsDay']+=0x1;_0x469097[_0xe117('0x9c')]=ut[_0xe117('0x9d')](_0x469097);ut[_0xe117('0x9e')](_0x469097,0xc,_0x385c67[_0xe117('0xde')]||_0x385c67[_0xe117('0xdf')]);rpcDb[_0xe117('0x8f')](_0x469097,_0xe117('0xe6'));if(ut[_0xe117('0x9d')](_0x469097)>=_0x27e3e4[_0xe117('0xa3')]){_0x20b633=ut[_0xe117('0xa4')](_0x469097,0xf,_0xe117('0xa5'));rpcDb['createCustomerFinal'](_0x20b633,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xe117('0x91')](_0x469097,_0xe117('0xe7'));}delete this[_0xe117('0x14')][_0x385c67[_0xe117('0xac')]];}if(!(_0x469097[_0xe117('0x72')]&&_0x4ee491==='16')){ut[_0xe117('0x78')](_0x27e3e4,_0xe117('0xe8'));logger[_0xe117('0x5c')]('[originated][decrement][callProgressDetectingCustomer]',_0x469097[_0xe117('0xaf')],_0xe117('0xb0'),_0x27e3e4[_0xe117('0x55')],'originated:\x20',_0x27e3e4[_0xe117('0x4e')]);}if(_0x4ee491!==_0xe117('0xad')){delete this[_0xe117('0x14')][_0x385c67[_0xe117('0xac')]];delete this[_0xe117('0x14')][_0x385c67[_0xe117('0xe9')]];}}};Preview[_0xe117('0xd')][_0xe117('0xea')]=function(_0x2cd08f,_0x1618ee,_0x4034d1){if(_['isUndefined'](_0x1618ee)&&_0xe117('0xeb')!==typeof _0x1618ee){return;}if(_[_0xe117('0xec')](_0x4034d1)&&_0xe117('0xeb')!==typeof _0x4034d1){return;}switch(_0x4034d1[_0xe117('0xed')]){case'0':ut['logAgent'](_0x2cd08f,0x0,'NoSuchNumber');rpcDb[_0xe117('0xee')](_0x2cd08f,_0xe117('0xef'));break;case'3':ut[_0xe117('0xf0')](_0x2cd08f,0x3,_0xe117('0xf1'));rpcDb[_0xe117('0xee')](_0x2cd08f,_0xe117('0xf2'));break;case'5':ut[_0xe117('0xf0')](_0x2cd08f,0x5,_0xe117('0xf3'));rpcDb['createAgentHistory'](_0x2cd08f,_0xe117('0xf4'));break;case'8':ut[_0xe117('0xf0')](_0x2cd08f,0x8,'Congestion');rpcDb['createAgentHistory'](_0x2cd08f,_0xe117('0xf5'));break;case'22':ut[_0xe117('0xf0')](_0x2cd08f,0x16,'AnswerAGI');rpcDb[_0xe117('0xee')](_0x2cd08f,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xe117('0xf0')](_0x2cd08f,0xc,_0x4034d1['reason']);rpcDb['createAgentHistory'](_0x2cd08f,_0xe117('0xf5'));}ut[_0xe117('0x78')](_0x1618ee,_0xe117('0xf6'));logger[_0xe117('0x5c')](_0xe117('0xf7'),_0x2cd08f['uniqueid'],_0xe117('0xb0'),_0x1618ee[_0xe117('0x55')],_0xe117('0x70'),_0x1618ee['originated']);delete this[_0xe117('0x14')][_0x2cd08f['uniqueid']];};Preview[_0xe117('0xd')][_0xe117('0xf8')]=function(_0x9cedbc,_0x1b63ae,_0x4ada1e,_0x52cd6c,_0x238c81){var _0x54ea8c=this;return new BPromise(function(_0x4a3e39,_0x344da2){if(_[_0xe117('0x6c')](_0x1b63ae)||_[_0xe117('0x6c')](_0x1b63ae[_0xe117('0xf9')])||_[_0xe117('0x6c')](_0x1b63ae[_0xe117('0xf9')][_0xe117('0xfa')])||_[_0xe117('0x6c')](_0x1b63ae['VoiceQueueId'])){_0x344da2(ut['message']('Contact\x20is\x20undefined',_0x52cd6c,_0x238c81));return;}var _0x1204e4=uuid['v4']();var _0x4ddc4c=_0x54ea8c['campaignsPreview'][_0x1b63ae['Queue']['name']];var _0x20103d=_0x4ada1e?_0x54ea8c[_0xe117('0x15')][_0x4ada1e]['id']:undefined;_0x54ea8c[_0xe117('0x14')][_0x1204e4]=new Action(_0x1b63ae,_0x4ddc4c,_0x1204e4,_0x4ada1e,_0x20103d);var _0x4180a2=_0x54ea8c['actions'][_0x1204e4];_0x4180a2[_0xe117('0xaa')]=_0x52cd6c;_0x4180a2['activeContact']=_0x238c81;_0x4180a2['lookAgent']=_0x4ada1e;if(_[_0xe117('0xfb')](_0x9cedbc)){_0x54ea8c[_0xe117('0xfc')](_0x4180a2,_0x4ddc4c,_0x1b63ae,_0x4ada1e)[_0xe117('0x83')](function(_0x114c93){logger[_0xe117('0x5c')](_0xe117('0xfd'),'Queue:\x20'+_0x4180a2[_0xe117('0x6f')]+_0xe117('0xfe')+_0x4180a2[_0xe117('0xff')],JSON[_0xe117('0x59')](_0x114c93));ami[_0xe117('0x26')](_0xe117('0x100'),ut[_0xe117('0xb2')](_0x4180a2,'called',_0x54ea8c['campaignsPreview'][_0x4180a2[_0xe117('0x6f')]]));_0x4a3e39(ut[_0xe117('0x4d')](_0xe117('0x101')));})['catch'](function(_0x3fcfdd){ut[_0xe117('0x61')](_0xe117('0x102'),_0x3fcfdd);_0x344da2(ut['message']('Call\x20failed',_0x52cd6c,_0x238c81));});}else{_0x4ddc4c[_0xe117('0x3a')]+=0x1;ut[_0xe117('0x103')](_0x4180a2);rpcDb[_0xe117('0x104')](_0x4180a2,'[Blacklist][error]');delete _0x54ea8c[_0xe117('0x14')][_0x1204e4];_0x344da2(ut['message'](_0xe117('0x105'),_0x52cd6c,_0x238c81));}});};Preview[_0xe117('0xd')][_0xe117('0x97')]=function(_0x14c28e){return!_[_0xe117('0x6c')](_0x14c28e)&&!_[_0xe117('0x6c')](_0x14c28e[_0xe117('0x55')])&&!_[_0xe117('0x6c')](_0x14c28e[_0xe117('0x56')])&&_0x14c28e[_0xe117('0x56')]&&!_[_0xe117('0x6c')](this[_0xe117('0x13')][util[_0xe117('0x5a')](_0xe117('0x106'),_0x14c28e['name'])])&&!_[_0xe117('0x6c')](this[_0xe117('0x13')][util[_0xe117('0x5a')](_0xe117('0x106'),_0x14c28e['name'])]['status'])&&(this[_0xe117('0x13')][util[_0xe117('0x5a')]('SIP/%s',_0x14c28e['name'])][_0xe117('0x107')]==='reachable'||this[_0xe117('0x13')][util[_0xe117('0x5a')](_0xe117('0x106'),_0x14c28e[_0xe117('0x55')])][_0xe117('0x107')]===_0xe117('0x108'));};Preview['prototype'][_0xe117('0x88')]=function(_0x4dfc1a,_0x5959be){var _0x1dea20=this;return new BPromise(function(_0x2983ea,_0x5dfe1a){_0x1dea20[_0xe117('0x109')](_0x4dfc1a,_0x5959be)[_0xe117('0x83')](function(_0x35a47){_0x2983ea(_[_0xe117('0x73')](_0x35a47,[_0xe117('0x4d')]));})['catch'](function(_0x3a2330){if(_0x3a2330[_0xe117('0x10a')]){rpcDb[_0xe117('0x10b')](_0x4dfc1a);}if(_0x3a2330[_0xe117('0x56')]){rpcDb['disableContact'](_0x4dfc1a);}_0x5dfe1a(_[_0xe117('0x73')](_0x3a2330,[_0xe117('0x4d')]));});});};Preview[_0xe117('0xd')][_0xe117('0x109')]=function(_0x58e132,_0x121e9d){var _0x53edbd=this;return new BPromise(function(_0xaf41d5,_0x41a54e){var _0x326a71,_0x3b6658;rpcDb[_0xe117('0x10c')](_0x58e132)[_0xe117('0x83')](function(_0x557bc6){if(!_[_0xe117('0x6c')](_0x557bc6[0x0])){_0x3b6658=_0x557bc6[0x0]['recallme']?![]:!![];_0x326a71=_0x557bc6[0x0][_0xe117('0x10d')]?!![]:![];_0x326a71=_0x121e9d?!![]:_0x326a71;}var _0x16e35b=_0x53edbd[_0xe117('0x10e')](_0x557bc6);if(_0x16e35b[_0xe117('0x10f')]){rpcDb[_0xe117('0x110')](_[_0xe117('0x73')](_0x557bc6[0x0],[_0xe117('0x111'),_0xe117('0x112')]))['then'](function(_0x2c99b1){_0x53edbd[_0xe117('0xf8')](_0x2c99b1,_0x557bc6[0x0],_0x121e9d,_0x3b6658,_0x326a71)['then'](function(_0x29baba){_0xaf41d5(_0x29baba);})[_0xe117('0x77')](function(_0xd3ad1b){_0x41a54e(_0xd3ad1b);});})[_0xe117('0x77')](function(_0xcc9b32){ut[_0xe117('0x61')](_0xe117('0x113'),_0xcc9b32);_0x41a54e(ut[_0xe117('0x4d')](_0xe117('0x114'),_0x3b6658,_0x326a71));});}else{_0x41a54e(ut[_0xe117('0x4d')](_0x16e35b['message'],_0x3b6658,_0x326a71));}})[_0xe117('0x77')](function(_0x15b207){ut[_0xe117('0x61')](_0xe117('0x115'),_0x15b207);_0x41a54e(ut[_0xe117('0x4d')](_0xe117('0x114'),![],!![]));});});};Preview[_0xe117('0xd')][_0xe117('0x10e')]=function(_0x33aaed){if(_[_0xe117('0x6c')](_0x33aaed)||_[_0xe117('0xfb')](_0x33aaed)||!_[_0xe117('0x6c')](_0x33aaed[0x0][_0xe117('0x87')])&&_[_0xe117('0x6c')](_0x33aaed[0x0]['Agent'][_0xe117('0x55')])){ut[_0xe117('0x61')](_0xe117('0x116'),_0x33aaed);return{'isValid':![],'message':_0xe117('0x117')};}var _0x7b3b0e=this[_0xe117('0x12')][_0x33aaed[0x0][_0xe117('0x6e')][_0xe117('0x55')]];_0x7b3b0e['message']=_0xe117('0x9a');if(_[_0xe117('0x6c')](_0x7b3b0e)){ut[_0xe117('0x61')]('[Preview][validateContact][Empty\x20Campaign]',_0x7b3b0e);return{'isValid':![],'message':_0xe117('0x118')};}if(!this[_0xe117('0x97')](_0x7b3b0e[_0xe117('0x54')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0xe117('0x119')+_0x7b3b0e[_0xe117('0x55')]+_0xe117('0x11a'));if(!this[_0xe117('0x97')](_0x7b3b0e[_0xe117('0x98')])){ut[_0xe117('0x61')](_0xe117('0x11b'),_0x7b3b0e['name']+_0xe117('0x11c'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x7b3b0e[_0xe117('0x6a')])){ut['logger'](_0xe117('0x11d'),_0x7b3b0e[_0xe117('0x55')]+_0xe117('0x11e'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x7b3b0e['name']+_0xe117('0x11e')};}return{'isValid':!![],'message':_0xe117('0x11f')};};Preview['prototype']['execCall']=function(_0x341b87,_0x117614,_0x5a352e,_0x3d78a8){var _0x30d59c=this;return new BPromise(function(_0x3c4a23,_0x527869){var _0x13298b=_0x341b87['uniqueid'];var _0x3a4f06=_0x30d59c[_0xe117('0x97')](_0x117614['Trunk'])?util[_0xe117('0x5a')](_0xe117('0x120'),_0x117614[_0xe117('0x54')][_0xe117('0x55')],_[_0xe117('0x6c')](_0x117614[_0xe117('0x38')])?'':_0x117614[_0xe117('0x38')][_0xe117('0x121')]()||'',_0x117614['dialCutDigit']>0x0?_0x5a352e[_0xe117('0xf9')][_0xe117('0xfa')][_0xe117('0x122')](_0x117614[_0xe117('0x123')]):_0x5a352e[_0xe117('0xf9')]['phone']):util['format'](_0xe117('0x120'),_[_0xe117('0x6c')](_0x117614[_0xe117('0x98')])?_0x117614['Trunk']['name']:_0x117614[_0xe117('0x98')]['name'],_[_0xe117('0x6c')](_0x117614[_0xe117('0x38')])?'':_0x117614[_0xe117('0x38')]['trim']()||'',_0x117614[_0xe117('0x123')]>0x0?_0x5a352e[_0xe117('0xf9')][_0xe117('0xfa')][_0xe117('0x122')](_0x117614['dialCutDigit']):_0x5a352e[_0xe117('0xf9')][_0xe117('0xfa')]);var _0x5527dc=_0x30d59c[_0xe117('0x97')](_0x117614[_0xe117('0x54')])?ut['getCallerId'](_0x117614['Trunk'][_0xe117('0x57')],_0x117614[_0xe117('0x36')],_0x117614['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x117614[_0xe117('0x124')],_0x117614['dialRandomLastDigitCallerIdNumber']):_0x117614[_0xe117('0x124')]):ut[_0xe117('0x125')](_['isNil'](_0x117614[_0xe117('0x98')])?_0x117614[_0xe117('0x54')]['callerid']:_0x117614[_0xe117('0x98')][_0xe117('0x57')],_0x117614[_0xe117('0x36')],_0x117614[_0xe117('0x126')]>0x0?ut[_0xe117('0x127')](_0x117614['dialOriginateCallerIdNumber'],_0x117614[_0xe117('0x126')]):_0x117614[_0xe117('0x124')]);if(_0x5527dc){_0x341b87[_0xe117('0x128')]=ut[_0xe117('0x129')](_0x5527dc);_0x341b87[_0xe117('0x12a')]=ut[_0xe117('0x12b')](_0x5527dc);}var _0x5c7cde=ut[_0xe117('0x12c')](_0x117614,_0x5a352e,_0x3a4f06,_0x5527dc,_0x13298b,_0x341b87);_[_0xe117('0x12d')](_0x341b87,ut[_0xe117('0x12e')](_0x5c7cde));_0x341b87['starttime']=moment()[_0xe117('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xe117('0x76')](ut['variablesAction'](_0x341b87,_0x117614,_0x5c7cde,_0x341b87[_0xe117('0xab')],_0x3d78a8))[_0xe117('0x83')](function(_0x1e116e){var _0x429297=_0x341b87[_0xe117('0x12f')];if(!_[_0xe117('0x6c')](_0x429297)){if(!_['isNil'](_0x30d59c[_0xe117('0x15')][_0x429297])){_0x30d59c[_0xe117('0x15')][_0x429297][_0xe117('0x130')]=_0x341b87[_0xe117('0x131')];emit(util[_0xe117('0x5a')](_0xe117('0x132'),_0x30d59c[_0xe117('0x15')][_0x429297][_0xe117('0x55')]),'user:agentconnect',{'destaccountcode':_0x30d59c[_0xe117('0x15')][_0x429297][_0xe117('0x133')],'destconnectedlinenum':_0x341b87[_0xe117('0x131')]});}}_0x117614[_0xe117('0x4e')]+=0x1;logger[_0xe117('0x5c')](_0xe117('0x134'),_0x13298b,_0xe117('0xb0'),_0x117614[_0xe117('0x55')],_0xe117('0x70'),_0x117614[_0xe117('0x4e')]);_0x3c4a23(_0x1e116e);})[_0xe117('0x77')](function(_0x2e4360){ut['logAgent'](_0x341b87,0xe,_0xe117('0x135'));rpcDb[_0xe117('0xee')](_0x341b87,_0xe117('0x136'));_0x527869(_0x2e4360);});});};Preview[_0xe117('0xd')][_0xe117('0x1f')]=function(_0x1cbd1c){if(this['actions'][_0x1cbd1c[_0xe117('0xac')]]){this[_0xe117('0x14')][_0x1cbd1c[_0xe117('0xac')]][_0xe117('0x137')]=_0x1cbd1c[_0xe117('0x137')];}};Preview['prototype'][_0xe117('0x17')]=function(_0x3fa5ff){var _0x3ec7c8=this;var _0x56f48=this['actions'][_0x3fa5ff[_0xe117('0x138')]];if(_0x56f48){if(_0x56f48[_0xe117('0x139')]&&this[_0xe117('0x15')][_0x56f48[_0xe117('0x139')]]){ut[_0xe117('0x13a')](_0x56f48,this['agents'][_0x56f48[_0xe117('0x139')]][_0xe117('0x55')],this[_0xe117('0x15')][_0x56f48[_0xe117('0x139')]]['id']);}var _0x375cb2=_[_0xe117('0x13b')](_0x56f48);_0x375cb2['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4447e4=_0x3ec7c8['campaignsPreview'][_0x56f48['queue']];if(ut[_0xe117('0x13c')](_0x3fa5ff[_0xe117('0x13d')])){if(_0x56f48['unlockAgent']){rpcDb['unlockContact'](_0x56f48[_0xe117('0xff')]);}if(_0x56f48[_0xe117('0xab')]){rpcDb[_0xe117('0x8b')](_0x56f48[_0xe117('0xff')]);}ami[_0xe117('0x26')](_0xe117('0x13e'),ut[_0xe117('0xb2')](_0x56f48,'rejected',this[_0xe117('0x12')][_0x56f48[_0xe117('0x6f')]]));this['callProgressDetectingAgent'](_0x375cb2,_0x4447e4,_0x3fa5ff);}else{_0x56f48['starttime']=moment()[_0xe117('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xe117('0xf0')](_0x375cb2,0x4,_0xe117('0xb7'));rpcDb['createAgentHistory'](_0x375cb2,_0xe117('0x13f'));}}};Preview[_0xe117('0xd')]['syncHangup']=function(_0x251d52){var _0x2aaf04=this;var _0x36125d=this[_0xe117('0x14')][_0x251d52[_0xe117('0xac')]];var _0x268d76;if(_0x36125d){_0x268d76=this[_0xe117('0x12')][_0x36125d['queue']];logger[_0xe117('0x5c')](_0xe117('0x140'),_0x251d52[_0xe117('0xac')],_0xe117('0xb0'),_0x268d76[_0xe117('0x55')],_0xe117('0x71'),_0x268d76[_0xe117('0x2d')]);}if(this[_0xe117('0x14')][_0x251d52[_0xe117('0xac')]]&&_0x251d52[_0xe117('0xac')]!==_0x251d52[_0xe117('0xaf')]){if(_0x251d52['cause']==='16'&&this[_0xe117('0x14')][_0x251d52['linkedid']][_0xe117('0x72')]){this[_0xe117('0x9b')](_0x251d52,_0x251d52[_0xe117('0xac')],_0x251d52[_0xe117('0x141')]);}else if(this[_0xe117('0x14')][_0x251d52[_0xe117('0xac')]][_0xe117('0x72')]){logger['info']('[syncHangup][talking][cause]',_0x251d52[_0xe117('0xac')],_0x251d52['cause'],'\x20Queue',_0x268d76[_0xe117('0x55')],_0xe117('0x71'),_0x268d76[_0xe117('0x2d')]);this[_0xe117('0x9b')](_0x251d52,_0x251d52['linkedid'],_0x251d52[_0xe117('0x141')]);}}else if(_0x36125d&&_[_0xe117('0x6c')](_0x36125d[_0xe117('0x142')])&&_0x268d76[_0xe117('0x143')]&&_0x251d52['linkedid']===_0x251d52[_0xe117('0xaf')]&&_[_0xe117('0x6c')](_0x251d52[_0xe117('0xed')])&&_0x251d52[_0xe117('0x141')]==='16'&&_0x251d52[_0xe117('0x144')]==='6'&&_[_0xe117('0xec')](_0x36125d[_0xe117('0x145')])){if(_0x36125d[_0xe117('0xaa')]){rpcDb['unlockContact'](_0x36125d[_0xe117('0xff')]);}if(_0x36125d[_0xe117('0xab')]){rpcDb[_0xe117('0x8b')](_0x36125d[_0xe117('0xff')]);}_0x251d52[_0xe117('0xed')]='22';this[_0xe117('0xea')](_0x36125d,_0x268d76,_0x251d52);}else if(_0x36125d&&_0x36125d[_0xe117('0x145')]){if(_0x251d52[_0xe117('0x141')]==='16'&&this[_0xe117('0x14')][_0x251d52['linkedid']]['dialAnswer']){logger[_0xe117('0x5c')](_0xe117('0x146'),_0x251d52[_0xe117('0xac')],_0x251d52[_0xe117('0x141')],_0xe117('0xb0'),_0x268d76[_0xe117('0x55')],_0xe117('0x71'),_0x268d76[_0xe117('0x2d')]);this['callProgressDetectingCustomer'](_0x251d52,_0x251d52[_0xe117('0xac')],_0x251d52['cause']);}else if(this[_0xe117('0x14')][_0x251d52[_0xe117('0xac')]][_0xe117('0x72')]){logger[_0xe117('0x5c')]('[syncHangup][talking][cause]',_0x251d52[_0xe117('0xac')],_0x251d52['cause'],_0xe117('0xb0'),_0x268d76[_0xe117('0x55')],_0xe117('0x71'),_0x268d76[_0xe117('0x2d')]);this[_0xe117('0x9b')](_0x251d52,_0x251d52['linkedid'],_0x251d52[_0xe117('0x141')]);}}};Preview[_0xe117('0xd')]['syncDialEnd']=function(_0x981895){if(this[_0xe117('0x14')][_0x981895[_0xe117('0xe9')]]&&_0x981895[_0xe117('0xe9')]!==_0x981895['destuniqueid']){this[_0xe117('0x9b')](_0x981895,_0x981895['destlinkedid'],_0x981895[_0xe117('0xdf')]);}};Preview[_0xe117('0xd')][_0xe117('0x147')]=function(_0x10a791){if(this['actions'][_0x10a791[_0xe117('0xac')]]&&_0x10a791[_0xe117('0xac')]!==_0x10a791[_0xe117('0xaf')]&&!this['actions'][_0x10a791[_0xe117('0xac')]][_0xe117('0x72')]){if(_0x10a791[_0xe117('0x141')]==='1'){this['callProgressDetectingCustomer'](_0x10a791,_0x10a791[_0xe117('0xac')],_0x10a791[_0xe117('0x141')]);}}};Preview[_0xe117('0xd')][_0xe117('0x148')]=function(_0x411b92,_0x35c1c8,_0x2dd8f6){if(this[_0xe117('0x14')][_0x411b92]){if(_[_0xe117('0x6c')](this[_0xe117('0x14')][_0x411b92][_0xe117('0x149')])){this['actions'][_0x411b92][_0xe117('0x149')]={};}this[_0xe117('0x14')][_0x411b92][_0xe117('0x149')][_0x35c1c8]=_0x2dd8f6;}};Preview[_0xe117('0xd')]['syncVarSet']=function(_0x3d6895){try{if(!_['isNil'](_0x3d6895)){if(ut[_0xe117('0x14a')](_[_0xe117('0x14b')](_0x3d6895['variable'])[0x0])){this[_0xe117('0x148')](_0x3d6895[_0xe117('0xaf')],_[_0xe117('0x14b')](_0x3d6895[_0xe117('0x14c')])[0x0],_0x3d6895[_0xe117('0x14d')]);}}}catch(_0x1dcbf1){logger['error'](_0xe117('0x14e'),util[_0xe117('0x14f')](_0x1dcbf1,{'showHidden':![],'depth':null}));}};Preview[_0xe117('0xd')]['syncAttendedTransfer']=function(_0x154bf4){if(_0x154bf4){if(this[_0xe117('0x14')][_0x154bf4['transfertargetlinkedid']]){this[_0xe117('0x14')][_0x154bf4[_0xe117('0x150')]][_0xe117('0x145')]=!![];}}};Preview[_0xe117('0xd')][_0xe117('0x24')]=function(_0x3c539d){if(_0x3c539d){if(this[_0xe117('0x14')][_0x3c539d['transfererlinkedid']]){this[_0xe117('0x14')][_0x3c539d['transfererlinkedid']][_0xe117('0x145')]=!![];}}};module[_0xe117('0x151')]=Preview; \ No newline at end of file +var _0x58ba=['Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','pick','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','TrunkBackup','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','Action','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:agentconnect','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','dialQueueProject','channelstate','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','transfer','exports','util','lodash','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','callerid','Interval','md5','format','voice:queue:%s','info','stringify','emit','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','dialMethod','preview','booked','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','logger2','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','linkedid','BUSY','countbusyretry'];(function(_0x11bab2,_0x2eb82a){var _0x1729fd=function(_0x3e1280){while(--_0x3e1280){_0x11bab2['push'](_0x11bab2['shift']());}};_0x1729fd(++_0x2eb82a);}(_0x58ba,0x97));var _0xa58b=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0x58ba[_0x3dc68d];return _0xdf7f94;};'use strict';var util=require(_0xa58b('0x0'));var _=require(_0xa58b('0x1'));var BPromise=require(_0xa58b('0x2'));var uuid=require('uuid');var moment=require(_0xa58b('0x3'));var md5=require('md5');var Redis=require(_0xa58b('0x4'));var config=require(_0xa58b('0x5'));var logger=require(_0xa58b('0x6'))('preview');var loggerAction=require('../../../config/logger')(_0xa58b('0x7'));var ami=require(_0xa58b('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0xa58b('0x9'));var ut=require(_0xa58b('0xa'));config[_0xa58b('0xb')]=_[_0xa58b('0xc')](config['redis'],{'host':_0xa58b('0xd'),'port':0x18eb});var io=require(_0xa58b('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa58b('0xf')][_0xa58b('0x10')]=function(_0x252baf){this['tail']=this[_0xa58b('0x11')]?this[_0xa58b('0x11')][_0xa58b('0x12')](_0x252baf):_0x252baf();};function Preview(_0x11f4a7){this[_0xa58b('0x13')]=new Sequence();this[_0xa58b('0x14')]=_0x11f4a7['voiceQueues'];this[_0xa58b('0x15')]=_0x11f4a7[_0xa58b('0x15')];this[_0xa58b('0x16')]={};this[_0xa58b('0x17')]=_0x11f4a7['agents'];this[_0xa58b('0x18')]=0x0;ami['on'](_0xa58b('0x19'),this[_0xa58b('0x1a')]['bind'](this));ami['on']('hangup',this[_0xa58b('0x1b')][_0xa58b('0x1c')](this));ami['on'](_0xa58b('0x1d'),this[_0xa58b('0x1e')][_0xa58b('0x1c')](this));ami['on'](_0xa58b('0x1f'),this[_0xa58b('0x20')][_0xa58b('0x1c')](this));ami['on'](_0xa58b('0x21'),this['syncNewExten'][_0xa58b('0x1c')](this));ami['on'](_0xa58b('0x22'),this[_0xa58b('0x23')]['bind'](this));ami['on'](_0xa58b('0x24'),this[_0xa58b('0x25')]['bind'](this));ami['on'](_0xa58b('0x26'),this[_0xa58b('0x27')][_0xa58b('0x1c')](this));this[_0xa58b('0x28')](this[_0xa58b('0x14')]);}function emit(_0x27b601,_0x395529,_0x5b6346){io['to'](_0x27b601)['emit'](_0x395529,_0x5b6346);}function emitCampaignPreview(_0x1d3bc6){if(_0x1d3bc6[_0xa58b('0x29')]==='outbound'){var _0x1d3b98={'id':_0x1d3bc6['id'],'name':_0x1d3bc6['name'],'strategy':_0x1d3bc6[_0xa58b('0x2a')],'answered':_0x1d3bc6[_0xa58b('0x2b')],'available':_0x1d3bc6[_0xa58b('0x2c')],'loggedIn':_0x1d3bc6[_0xa58b('0x2d')],'pTalking':_0x1d3bc6[_0xa58b('0x2e')],'sumBillable':_0x1d3bc6[_0xa58b('0x2f')],'sumDuration':_0x1d3bc6[_0xa58b('0x30')],'sumHoldTime':_0x1d3bc6[_0xa58b('0x31')]||0x0,'talking':_0x1d3bc6[_0xa58b('0x32')],'total':_0x1d3bc6[_0xa58b('0x33')],'type':_0x1d3bc6[_0xa58b('0x29')],'unmanaged':_0x1d3bc6[_0xa58b('0x34')],'abandoned':_0x1d3bc6[_0xa58b('0x35')],'waiting':_0x1d3bc6['waiting'],'loggedInDb':_0x1d3bc6['loggedInDb'],'dialActive':_0x1d3bc6['dialActive'],'dialMethod':_0x1d3bc6['dialMethod'],'dialOriginateCallerIdName':_0x1d3bc6[_0xa58b('0x36')],'dialOriginateCallerIdNumber':_0x1d3bc6[_0xa58b('0x37')],'dialOriginateTimeout':_0x1d3bc6[_0xa58b('0x38')],'dialPrefix':_0x1d3bc6[_0xa58b('0x39')],'outboundAnswerAgiCallsDay':_0x1d3bc6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1d3bc6[_0xa58b('0x3a')],'outboundBlacklistCallsDay':_0x1d3bc6[_0xa58b('0x3b')],'outboundBusyCallsDay':_0x1d3bc6[_0xa58b('0x3c')],'outboundCongestionCallsDay':_0x1d3bc6[_0xa58b('0x3d')],'outboundDropCallsDayACS':_0x1d3bc6[_0xa58b('0x3e')],'outboundDropCallsDayCallersExit':_0x1d3bc6[_0xa58b('0x3f')],'outboundDropCallsDayTimeout':_0x1d3bc6['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1d3bc6[_0xa58b('0x40')],'outboundNoSuchCallsDay':_0x1d3bc6[_0xa58b('0x41')],'outboundOriginateFailureCallsDay':_0x1d3bc6[_0xa58b('0x42')],'outboundReCallsDay':_0x1d3bc6[_0xa58b('0x43')],'outboundRejectCallsDay':_0x1d3bc6[_0xa58b('0x44')],'outboundUnknownCallsDay':_0x1d3bc6[_0xa58b('0x45')],'outboundAbandonedCallsDay':_0x1d3bc6['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1d3bc6[_0xa58b('0x46')],'predictiveIntervalAvgHoldtime':_0x1d3bc6['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1d3bc6[_0xa58b('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x1d3bc6['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1d3bc6[_0xa58b('0x48')],'predictiveIntervalErlangCalls':_0x1d3bc6[_0xa58b('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x1d3bc6['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1d3bc6[_0xa58b('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x1d3bc6['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1d3bc6['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1d3bc6[_0xa58b('0x4b')],'predictiveIntervalTotalCalls':_0x1d3bc6['predictiveIntervalTotalCalls'],'message':_0x1d3bc6[_0xa58b('0x4c')],'originated':_0x1d3bc6[_0xa58b('0x4d')],'erlangCalls':_0x1d3bc6[_0xa58b('0x4e')],'erlangCallToSecond':_0x1d3bc6[_0xa58b('0x4f')],'erlangAbandonmentRate':_0x1d3bc6[_0xa58b('0x50')],'erlangBusyFactor':_0x1d3bc6[_0xa58b('0x51')],'startPredictive':_0x1d3bc6['startPredictive'],'startProgressive':_0x1d3bc6[_0xa58b('0x52')]};if(_0x1d3bc6[_0xa58b('0x53')]){_0x1d3b98['Trunk']={'id':_0x1d3bc6[_0xa58b('0x53')]['id'],'name':_0x1d3bc6[_0xa58b('0x53')][_0xa58b('0x54')],'active':_0x1d3bc6['Trunk']['active'],'callerid':_0x1d3bc6[_0xa58b('0x53')][_0xa58b('0x55')]};}if(_0x1d3bc6[_0xa58b('0x56')]){_0x1d3b98['Interval']={'id':_0x1d3bc6[_0xa58b('0x56')]['id'],'name':_0x1d3bc6['Interval'][_0xa58b('0x54')]};}var _0x1eee6d=md5(JSON['stringify'](_0x1d3b98));if(_0x1d3bc6[_0xa58b('0x57')]!==_0x1eee6d){_0x1d3bc6[_0xa58b('0x57')]=_0x1eee6d;emit(util[_0xa58b('0x58')](_0xa58b('0x59'),_0x1d3b98[_0xa58b('0x54')]),'voice_queue:save',_0x1d3b98);}}}function emitVoiceQueueChannelRemove(_0x3fd6da){logger[_0xa58b('0x5a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xa58b('0x5b')](_0x3fd6da));emit(util['format'](_0xa58b('0x59'),_0x3fd6da[_0xa58b('0x54')]),'voice_queue_channel:remove',_0x3fd6da);io[_0xa58b('0x5c')]('voice_queue_presence:remove',_0x3fd6da);}function notSendMessagesQueue(_0x141fd5){if(_0x141fd5['sendMessageOneNotActive']){if(_0x141fd5[_0xa58b('0x4d')]===0x0&&_0x141fd5['pTalking']===0x0){_0x141fd5[_0xa58b('0x5d')]=![];_0x141fd5[_0xa58b('0x2c')]=0x0;_0x141fd5['paused']=0x0;_0x141fd5['message']=_0xa58b('0x5e');ut[_0xa58b('0x5f')](_0xa58b('0x60'),_0x141fd5[_0xa58b('0x54')]+'\x20is\x20not\x20active');}else{_0x141fd5['message']='IS_DISACTIVED';ut[_0xa58b('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x141fd5[_0xa58b('0x54')]+'\x20is\x20disactive');}emitCampaignPreview(_0x141fd5);}}Preview[_0xa58b('0xf')]['loopCampaigns']=function(){var _0x524e06=this;setInterval(function(){_0x524e06[_0xa58b('0x61')]();},0x7cf);};Preview[_0xa58b('0xf')][_0xa58b('0x61')]=function(){var _0x458f16=this[_0xa58b('0x14')];this[_0xa58b('0x18')]+=0x1;for(var _0x4e3603 in _0x458f16){if(_0x458f16['hasOwnProperty'](_0x4e3603)&&(_0x458f16[_0x4e3603][_0xa58b('0x62')]===_0xa58b('0x63')||_0x458f16[_0x4e3603][_0xa58b('0x62')]===_0xa58b('0x64'))&&_0x458f16[_0x4e3603][_0xa58b('0x29')]===_0xa58b('0x65')){if(this[_0xa58b('0x18')]>0x7){this[_0xa58b('0x18')]=0x0;this[_0xa58b('0x66')]();}}if(_0x458f16[_0xa58b('0x67')](_0x4e3603)&&_0x458f16[_0x4e3603][_0xa58b('0x62')]==='preview'&&_0x458f16[_0x4e3603][_0xa58b('0x29')]==='outbound'){if(_0x458f16[_0x4e3603][_0xa58b('0x68')]){this[_0xa58b('0x69')](_0x458f16[_0x4e3603]);this[_0xa58b('0x6a')](_0x458f16[_0x4e3603]);}else{notSendMessagesQueue(_0x458f16[_0x4e3603]);}}}};Preview[_0xa58b('0xf')][_0xa58b('0x6b')]=function(_0x3a7800){var _0x2e3b69=this;this[_0xa58b('0x13')][_0xa58b('0x10')](function(){if(!_[_0xa58b('0x6c')](_0x2e3b69[_0xa58b('0x16')][_0x3a7800])){loggerAction[_0xa58b('0x5a')](_0xa58b('0x6d'),_0x3a7800,'Queue',_0x2e3b69['actions'][_0x3a7800][_0xa58b('0x6e')],_0xa58b('0x6f'),JSON[_0xa58b('0x5b')](_0x2e3b69['campaignsPreview'][_0x2e3b69[_0xa58b('0x16')][_0x3a7800][_0xa58b('0x6e')]]['originated']),_0xa58b('0x70'),JSON['stringify'](_0x2e3b69[_0xa58b('0x14')][_0x2e3b69['actions'][_0x3a7800]['queue']][_0xa58b('0x2e')]),JSON[_0xa58b('0x5b')](_0x2e3b69[_0xa58b('0x16')][_0x3a7800][_0xa58b('0x71')]),JSON[_0xa58b('0x5b')](_['pick'](_0x2e3b69[_0xa58b('0x16')][_0x3a7800],[_0xa58b('0x72'),_0xa58b('0x73'),_0xa58b('0x74'),_0xa58b('0x75')])));return ami['Action']({'action':_0xa58b('0x76'),'channel':_0x2e3b69[_0xa58b('0x16')][_0x3a7800]['channel']})[_0xa58b('0x77')](function(_0x12c1e7){if(_0x12c1e7[_0xa58b('0x4c')]===_0xa58b('0x78')){setTimeout(function(){if(_0x2e3b69['actions'][_0x3a7800]){ut['updateOriginated'](_0x2e3b69[_0xa58b('0x14')][_0x2e3b69[_0xa58b('0x16')][_0x3a7800]['queue']],_0xa58b('0x79'));if(_0x2e3b69[_0xa58b('0x16')][_0x3a7800][_0xa58b('0x71')]===!![]){ut[_0xa58b('0x7a')](_0x2e3b69[_0xa58b('0x14')][_0x2e3b69[_0xa58b('0x16')][_0x3a7800][_0xa58b('0x6e')]],_0xa58b('0x79'));ut[_0xa58b('0x7b')](_0xa58b('0x7c')+_0x3a7800,_0x2e3b69[_0xa58b('0x16')][_0x3a7800][_0xa58b('0x6e')]);}ut[_0xa58b('0x7b')](_0xa58b('0x7d')+_0x3a7800,_0x2e3b69[_0xa58b('0x16')][_0x3a7800][_0xa58b('0x6e')]);delete _0x2e3b69[_0xa58b('0x16')][_0x3a7800];}},0x2328);}});}});};Preview['prototype'][_0xa58b('0x66')]=function(){var _0x58a725=this;loggerAction[_0xa58b('0x5a')](_0xa58b('0x7e'),_['size'](this[_0xa58b('0x16')]));for(var _0x450e3d in this['actions']){if(_0x58a725[_0xa58b('0x16')][_0xa58b('0x67')](_0x450e3d)){_0x58a725[_0xa58b('0x6b')](_0x450e3d);}}};Preview[_0xa58b('0xf')][_0xa58b('0x6a')]=function(_0x28b2e5){var _0x1d1cf2=this;rpcDb['getContactRecallMe'](_0x28b2e5['id'],ut[_0xa58b('0x7f')](this['agents']))[_0xa58b('0x80')](function(_0x1f6feb){if(!_['isNil'](_0x1f6feb)){for(var _0xc69e33=0x0;_0xc69e33<_0x1f6feb[_0xa58b('0x81')];_0xc69e33+=0x1){if(ut[_0xa58b('0x82')](_0x1f6feb[_0xc69e33]['scheduledat'])<_0x28b2e5[_0xa58b('0x83')]*0x3c){if(_0x1f6feb[_0xc69e33][_0xa58b('0x84')]&&!_0x1f6feb[_0xc69e33][_0xa58b('0x84')][_0xa58b('0x85')]){_0x1d1cf2[_0xa58b('0x86')](_0x1f6feb[_0xc69e33]['id'])[_0xa58b('0x80')](ut['logger2'](_0xa58b('0x87')))[_0xa58b('0x77')](ut['logger2'](_0xa58b('0x87')));}else{rpcDb[_0xa58b('0x88')](_0x1f6feb[_0xc69e33]['id']);}}else{var _0x27175e=new Action(_0x1f6feb[_0xc69e33],_0x28b2e5);_0x27175e[_0xa58b('0x89')]=moment()[_0xa58b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x28b2e5[_0xa58b('0x43')]+=0x1;ut[_0xa58b('0x8a')](_0x27175e,0x17,_0xa58b('0x8b'));if(_0x28b2e5[_0xa58b('0x8c')]){rpcDb['rescheduleContactInQueue'](ut[_0xa58b('0x8d')](_0x1f6feb[_0xc69e33]));rpcDb[_0xa58b('0x8e')](_0x27175e,_0xa58b('0x8f'));}else{ut[_0xa58b('0x8a')](_0x27175e,0x16,'RecallFailedTimeout');rpcDb[_0xa58b('0x8e')](_0x27175e,'[HistoryRecallClose]');rpcDb[_0xa58b('0x90')](_0x27175e,_0xa58b('0x91'));}}}}})['catch'](ut[_0xa58b('0x92')](_0xa58b('0x93')));};Preview[_0xa58b('0xf')][_0xa58b('0x69')]=function(_0x1dab49){_0x1dab49[_0xa58b('0x5d')]=!![];if(ut[_0xa58b('0x94')](_0x1dab49[_0xa58b('0x2d')])){_0x1dab49['message']=_0xa58b('0x95');}else if(!ut['isActive'](_0x1dab49[_0xa58b('0x68')])){_0x1dab49['message']='NOT_ACTIVE';}else if(!this[_0xa58b('0x96')](_0x1dab49[_0xa58b('0x53')])){if(!this[_0xa58b('0x96')](_0x1dab49['TrunkBackup'])){_0x1dab49[_0xa58b('0x4c')]=_0xa58b('0x97');}else{_0x1dab49[_0xa58b('0x4c')]=_0xa58b('0x98');}}else{_0x1dab49[_0xa58b('0x4c')]=_0xa58b('0x98');}emitCampaignPreview(_0x1dab49);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x40790d,_0x41ffb2,_0x8492b4){var _0x2fd3b2=this;var _0x62b1a9=this[_0xa58b('0x16')][_0x41ffb2];var _0x2963d9=this['campaignsPreview'][_0x62b1a9[_0xa58b('0x6e')]];var _0x4b3071;if(_0x2963d9){switch(_0x8492b4){case'1':_0x2963d9['outboundNoSuchCallsDay']+=0x1;_0x62b1a9[_0xa58b('0x99')]+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut[_0xa58b('0x9b')](_0x62b1a9);ut['logCustomer'](_0x62b1a9,0x0,'NoSuchNumber');ami['emit'](_0xa58b('0x9c'),ut[_0xa58b('0x9d')](_0x62b1a9,_0xa58b('0x9e')));rpcDb[_0xa58b('0x8e')](_0x62b1a9,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut[_0xa58b('0xa0')](_0x62b1a9,0xf,_0xa58b('0xa1'));rpcDb[_0xa58b('0x90')](_0x4b3071,_0xa58b('0xa2'));}else{if(_0x62b1a9[_0xa58b('0x99')]>=_0x2963d9[_0xa58b('0xa3')]){rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xa2'));}else{rpcDb['rescheduleContact'](ut[_0xa58b('0xa4')](_0x62b1a9,_0xa58b('0x99'),_0x2963d9[_0xa58b('0xa5')]),_0x62b1a9['unlockAgent'],_0x62b1a9[_0xa58b('0xa6')]);}}delete this[_0xa58b('0x16')][_0x40790d['linkedid']];break;case _0xa58b('0xa7'):var _0x394dee=moment()[_0xa58b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x62b1a9[_0xa58b('0xa8')]=_0x394dee;_0x62b1a9['answertime']=_0x394dee;_0x62b1a9[_0xa58b('0x71')]=!![];_0x2963d9['pTalking']+=0x1;logger[_0xa58b('0x5a')](_0xa58b('0xa9'),_0x62b1a9[_0xa58b('0xaa')],_0xa58b('0xab'),_0x2963d9[_0xa58b('0x54')],'pTalking:\x20',_0x2963d9['pTalking']);ami[_0xa58b('0x5c')]('custom:agentconnect',ut[_0xa58b('0x9d')](_0x62b1a9,_0xa58b('0xac'),this[_0xa58b('0x14')][_0x62b1a9['queue']]));if(_0x2963d9[_0xa58b('0xad')]){ami[_0xa58b('0x5c')](_0xa58b('0xae'),ut['buildAcw'](_0x62b1a9));}break;case'16':ami[_0xa58b('0x5c')](_0xa58b('0xaf'),ut[_0xa58b('0x9d')](_0x62b1a9,'complete',this['campaignsPreview'][_0x62b1a9[_0xa58b('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0xa58b('0x9d')](_0x62b1a9,_0xa58b('0xb0')));_0x2963d9[_0xa58b('0x3a')]+=0x1;_0x2963d9['total']+=0x1;_0x2963d9['answered']+=0x1;ut[_0xa58b('0x7a')](_0x2963d9,_0xa58b('0xb1'));_0x62b1a9[_0xa58b('0x9a')]=ut['totalGlobal'](_0x62b1a9);ut['logCustomer'](_0x62b1a9,0x4,_0xa58b('0xb2'));rpcDb['createCustomerHistory'](_0x62b1a9,_0xa58b('0xb3'));rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xb4'));rpcDb[_0xa58b('0xb5')](_0x62b1a9);_0x2963d9['sumDuration']+=_0x62b1a9[_0xa58b('0xb6')];_0x2963d9['sumBillable']+=_0x62b1a9[_0xa58b('0xb6')];logger[_0xa58b('0x5a')]('[syncHangup][talking][decrement]',_0x62b1a9[_0xa58b('0xaa')],_0xa58b('0xab'),_0x2963d9[_0xa58b('0x54')],_0xa58b('0x70'),_0x2963d9[_0xa58b('0x2e')]);delete this['actions'][_0x40790d[_0xa58b('0xb7')]];break;case _0xa58b('0xb8'):_0x2963d9['outboundBusyCallsDay']+=0x1;_0x62b1a9[_0xa58b('0xb9')]+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut[_0xa58b('0x9b')](_0x62b1a9);ut[_0xa58b('0x8a')](_0x62b1a9,0x5,_0xa58b('0xba'));ami['emit'](_0xa58b('0xbb'),ut[_0xa58b('0x9d')](_0x62b1a9,_0xa58b('0xbc')));rpcDb['createCustomerHistory'](_0x62b1a9,_0xa58b('0xbd'));if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut[_0xa58b('0xa0')](_0x62b1a9,0xf,_0xa58b('0xa1'));rpcDb[_0xa58b('0x90')](_0x4b3071,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x62b1a9['countbusyretry']>=_0x2963d9[_0xa58b('0xbe')]){rpcDb[_0xa58b('0x90')](_0x62b1a9,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xa58b('0xbf')](ut[_0xa58b('0xa4')](_0x62b1a9,_0xa58b('0xb9'),_0x2963d9[_0xa58b('0xc0')]),_0x62b1a9[_0xa58b('0xc1')],_0x62b1a9[_0xa58b('0xa6')]);}}break;case _0xa58b('0xc2'):_0x2963d9['outboundNoAnswerCallsDay']+=0x1;_0x62b1a9[_0xa58b('0xc3')]+=0x1;_0x62b1a9['countglobal']=ut[_0xa58b('0x9b')](_0x62b1a9);ut['logCustomer'](_0x62b1a9,0x3,_0xa58b('0xc4'));ami[_0xa58b('0x5c')](_0xa58b('0xc5'),ut[_0xa58b('0x9d')](_0x62b1a9,_0xa58b('0xc6')));rpcDb[_0xa58b('0x8e')](_0x62b1a9,_0xa58b('0xc7'));if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut[_0xa58b('0xa0')](_0x62b1a9,0xf,_0xa58b('0xa1'));rpcDb[_0xa58b('0x90')](_0x4b3071,_0xa58b('0xc8'));}else{if(_0x62b1a9[_0xa58b('0xc3')]>=_0x2963d9['dialNoAnswerMaxRetry']){rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xc7'));}else{rpcDb[_0xa58b('0xbf')](ut[_0xa58b('0xa4')](_0x62b1a9,_0xa58b('0xc3'),_0x2963d9['dialNoAnswerRetryFrequency']),_0x62b1a9['unlockAgent'],_0x62b1a9[_0xa58b('0xa6')]);}}break;case _0xa58b('0xc9'):_0x2963d9['outboundCongestionCallsDay']+=0x1;_0x62b1a9[_0xa58b('0xca')]+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut['totalGlobal'](_0x62b1a9);ut['logCustomer'](_0x62b1a9,0x8,_0xa58b('0xcb'));ami['emit'](_0xa58b('0xcc'),ut[_0xa58b('0x9d')](_0x62b1a9,_0xa58b('0xcd')));rpcDb[_0xa58b('0x8e')](_0x62b1a9,_0xa58b('0xce'));if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut[_0xa58b('0xa0')](_0x62b1a9,0xf,'Global');rpcDb[_0xa58b('0x90')](_0x4b3071,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x62b1a9['countcongestionretry']>=_0x2963d9[_0xa58b('0xcf')]){rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xce'));}else{rpcDb[_0xa58b('0xbf')](ut[_0xa58b('0xa4')](_0x62b1a9,_0xa58b('0xca'),_0x2963d9[_0xa58b('0xc0')]),_0x62b1a9[_0xa58b('0xc1')],_0x62b1a9[_0xa58b('0xa6')]);}}break;case _0xa58b('0xd0'):_0x2963d9[_0xa58b('0x44')]+=0x1;_0x62b1a9[_0xa58b('0xd1')]+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut[_0xa58b('0x9b')](_0x62b1a9);ut['logCustomer'](_0x62b1a9,0x14,'AgentReject');ami[_0xa58b('0x5c')](_0xa58b('0xd2'),ut['buildObj'](_0x62b1a9,_0xa58b('0xd3')));rpcDb[_0xa58b('0x8e')](_0x62b1a9,'[syncHangupRequest][logAgentReject]');if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut['cloneAction'](_0x62b1a9,0x14,'AgentReject');rpcDb[_0xa58b('0x90')](_0x4b3071,_0xa58b('0xd4'));}else{if(_0x62b1a9['countagentrejectretry']>=_0x2963d9[_0xa58b('0xd5')]){rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xd4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x62b1a9,_0xa58b('0xd1'),_0x2963d9[_0xa58b('0xd6')]),_0x62b1a9[_0xa58b('0xc1')],_0x62b1a9[_0xa58b('0xa6')]);}}break;case'ABANDONED':_0x2963d9[_0xa58b('0xd7')]+=0x1;_0x62b1a9['countabandonedretry']+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut[_0xa58b('0x9b')](_0x62b1a9);ut[_0xa58b('0x8a')](_0x62b1a9,0xb,_0xa58b('0xd8'));rpcDb[_0xa58b('0x8e')](_0x62b1a9,_0xa58b('0xd9'));if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut['cloneAction'](_0x62b1a9,0xf,_0xa58b('0xa1'));rpcDb[_0xa58b('0x90')](_0x4b3071,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x62b1a9[_0xa58b('0xda')]>=_0x2963d9['dialAbandonedMaxRety']){rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xd9'));}else{rpcDb[_0xa58b('0xbf')](ut[_0xa58b('0xa4')](_0x62b1a9,_0xa58b('0xdb'),_0x2963d9[_0xa58b('0xdc')]),_0x62b1a9[_0xa58b('0xc1')],_0x62b1a9[_0xa58b('0xa6')]);}}break;case'18':_0x2963d9[_0xa58b('0x45')]+=0x1;_0x62b1a9[_0xa58b('0xdd')]+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut['totalGlobal'](_0x62b1a9);ut[_0xa58b('0x8a')](_0x62b1a9,0x12,_0x40790d[_0xa58b('0xde')]||_0x40790d['dialstatus']);ami[_0xa58b('0x5c')]('custom:amd',ut[_0xa58b('0x9d')](_0x62b1a9,'amd'));rpcDb[_0xa58b('0x8e')](_0x62b1a9,_0xa58b('0xdf'));if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9['dialGlobalMaxRetry']){_0x4b3071=ut[_0xa58b('0xa0')](_0x62b1a9,0xf,_0xa58b('0xa1'));rpcDb[_0xa58b('0x90')](_0x4b3071,_0xa58b('0xdf'));}else{rpcDb['createCustomerFinal'](_0x62b1a9,_0xa58b('0xdf'));}delete this['actions'][_0x40790d['linkedid']];break;case'19':_0x2963d9['outboundUnknownCallsDay']+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut['totalGlobal'](_0x62b1a9);ut[_0xa58b('0x8a')](_0x62b1a9,0x13,_0x40790d[_0xa58b('0xde')]||_0x40790d[_0xa58b('0xe0')]);ami[_0xa58b('0x5c')](_0xa58b('0xe1'),ut[_0xa58b('0x9d')](_0x62b1a9,_0xa58b('0xe2')));rpcDb[_0xa58b('0x8e')](_0x62b1a9,_0xa58b('0xe3'));if(ut['totalGlobal'](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut[_0xa58b('0xa0')](_0x62b1a9,0xf,_0xa58b('0xa1'));rpcDb[_0xa58b('0x90')](_0x4b3071,_0xa58b('0xe3'));}else{rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xe3'));}delete this[_0xa58b('0x16')][_0x40790d[_0xa58b('0xb7')]];break;default:if(_0x62b1a9[_0xa58b('0x71')]){ut['decrementTalkink'](_0x2963d9,_0xa58b('0xe4'));ut[_0xa58b('0x7b')](_0xa58b('0xe5')+_0x2963d9[_0xa58b('0x54')],_0x40790d);}_0x2963d9[_0xa58b('0x45')]+=0x1;_0x62b1a9[_0xa58b('0x9a')]=ut['totalGlobal'](_0x62b1a9);ut[_0xa58b('0x8a')](_0x62b1a9,0xc,_0x40790d[_0xa58b('0xde')]||_0x40790d['dialstatus']);rpcDb[_0xa58b('0x8e')](_0x62b1a9,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xa58b('0x9b')](_0x62b1a9)>=_0x2963d9[_0xa58b('0x9f')]){_0x4b3071=ut[_0xa58b('0xa0')](_0x62b1a9,0xf,'Global');rpcDb[_0xa58b('0x90')](_0x4b3071,_0xa58b('0xe6'));}else{rpcDb[_0xa58b('0x90')](_0x62b1a9,_0xa58b('0xe6'));}delete this[_0xa58b('0x16')][_0x40790d[_0xa58b('0xb7')]];}if(!(_0x62b1a9[_0xa58b('0x71')]&&_0x8492b4==='16')){ut[_0xa58b('0xe7')](_0x2963d9,_0xa58b('0xe8'));logger['info'](_0xa58b('0xe9'),_0x62b1a9[_0xa58b('0xaa')],'\x20Queue',_0x2963d9['name'],_0xa58b('0x6f'),_0x2963d9['originated']);}if(_0x8492b4!=='ANSWER'){delete this['actions'][_0x40790d[_0xa58b('0xb7')]];delete this[_0xa58b('0x16')][_0x40790d[_0xa58b('0xea')]];}}};Preview[_0xa58b('0xf')][_0xa58b('0xeb')]=function(_0x456b3f,_0x1a93d1,_0x372218){if(_['isUndefined'](_0x1a93d1)&&'object'!==typeof _0x1a93d1){return;}if(_[_0xa58b('0xec')](_0x372218)&&'object'!==typeof _0x372218){return;}switch(_0x372218[_0xa58b('0xed')]){case'0':ut[_0xa58b('0xee')](_0x456b3f,0x0,_0xa58b('0xef'));rpcDb[_0xa58b('0xf0')](_0x456b3f,_0xa58b('0xf1'));break;case'3':ut[_0xa58b('0xee')](_0x456b3f,0x3,_0xa58b('0xc4'));rpcDb['createAgentHistory'](_0x456b3f,_0xa58b('0xf2'));break;case'5':ut[_0xa58b('0xee')](_0x456b3f,0x5,'Busy');rpcDb[_0xa58b('0xf0')](_0x456b3f,_0xa58b('0xf3'));break;case'8':ut['logAgent'](_0x456b3f,0x8,_0xa58b('0xcb'));rpcDb[_0xa58b('0xf0')](_0x456b3f,_0xa58b('0xf4'));break;case'22':ut[_0xa58b('0xee')](_0x456b3f,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x456b3f,_0xa58b('0xf5'));break;default:ut[_0xa58b('0xee')](_0x456b3f,0xc,_0x372218['reason']);rpcDb[_0xa58b('0xf0')](_0x456b3f,_0xa58b('0xf4'));}ut[_0xa58b('0xe7')](_0x1a93d1,_0xa58b('0xf6'));logger['info'](_0xa58b('0xf7'),_0x456b3f[_0xa58b('0xaa')],'\x20Queue',_0x1a93d1['name'],_0xa58b('0x6f'),_0x1a93d1[_0xa58b('0x4d')]);delete this[_0xa58b('0x16')][_0x456b3f[_0xa58b('0xaa')]];};Preview[_0xa58b('0xf')]['checkInBlack']=function(_0xf79f8b,_0x545ec6,_0x2d1651,_0x978011,_0x2421bd){var _0x59607d=this;return new BPromise(function(_0x3f3c7e,_0x1f6267){if(_['isNil'](_0x545ec6)||_['isNil'](_0x545ec6['Contact'])||_[_0xa58b('0x6c')](_0x545ec6[_0xa58b('0xf8')][_0xa58b('0xf9')])||_['isNil'](_0x545ec6[_0xa58b('0x74')])){_0x1f6267(ut['message'](_0xa58b('0xfa'),_0x978011,_0x2421bd));return;}var _0x207010=uuid['v4']();var _0x28e860=_0x59607d[_0xa58b('0x14')][_0x545ec6[_0xa58b('0xfb')][_0xa58b('0x54')]];var _0x39f8f6=_0x2d1651?_0x59607d['agents'][_0x2d1651]['id']:undefined;_0x59607d[_0xa58b('0x16')][_0x207010]=new Action(_0x545ec6,_0x28e860,_0x207010,_0x2d1651,_0x39f8f6);var _0xb8b668=_0x59607d[_0xa58b('0x16')][_0x207010];_0xb8b668[_0xa58b('0xc1')]=_0x978011;_0xb8b668[_0xa58b('0xa6')]=_0x2421bd;_0xb8b668[_0xa58b('0xfc')]=_0x2d1651;if(_['isEmpty'](_0xf79f8b)){_0x59607d['execCall'](_0xb8b668,_0x28e860,_0x545ec6,_0x2d1651)[_0xa58b('0x80')](function(_0x29fbed){logger[_0xa58b('0x5a')](_0xa58b('0xfd'),_0xa58b('0xfe')+_0xb8b668['queue']+_0xa58b('0xff')+_0xb8b668[_0xa58b('0x100')],JSON[_0xa58b('0x5b')](_0x29fbed));ami['emit'](_0xa58b('0x101'),ut[_0xa58b('0x9d')](_0xb8b668,_0xa58b('0x102'),_0x59607d[_0xa58b('0x14')][_0xb8b668['queue']]));_0x3f3c7e(ut['message'](_0xa58b('0x103')));})[_0xa58b('0x77')](function(_0x374043){ut[_0xa58b('0x5f')](_0xa58b('0x104'),_0x374043);_0x1f6267(ut['message'](_0xa58b('0x105'),_0x978011,_0x2421bd));});}else{_0x28e860[_0xa58b('0x3b')]+=0x1;ut[_0xa58b('0x106')](_0xb8b668);rpcDb[_0xa58b('0x107')](_0xb8b668,_0xa58b('0x108'));delete _0x59607d[_0xa58b('0x16')][_0x207010];_0x1f6267(ut[_0xa58b('0x4c')](_0xa58b('0x109'),_0x978011,_0x2421bd));}});};Preview[_0xa58b('0xf')]['isTrunkReachable']=function(_0x5ab592){return!_[_0xa58b('0x6c')](_0x5ab592)&&!_['isNil'](_0x5ab592['name'])&&!_[_0xa58b('0x6c')](_0x5ab592[_0xa58b('0x10a')])&&_0x5ab592['active']&&!_[_0xa58b('0x6c')](this[_0xa58b('0x15')][util['format']('SIP/%s',_0x5ab592[_0xa58b('0x54')])])&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x5ab592['name'])][_0xa58b('0x76')])&&(this[_0xa58b('0x15')][util['format'](_0xa58b('0x10b'),_0x5ab592[_0xa58b('0x54')])][_0xa58b('0x76')]===_0xa58b('0x10c')||this[_0xa58b('0x15')][util['format']('SIP/%s',_0x5ab592['name'])]['status']==='unmonitored');};Preview[_0xa58b('0xf')][_0xa58b('0x86')]=function(_0x282bdf,_0x2af378){var _0x158d07=this;return new BPromise(function(_0x597f79,_0x5e5c35){_0x158d07[_0xa58b('0x10d')](_0x282bdf,_0x2af378)['then'](function(_0x5c05b9){_0x597f79(_[_0xa58b('0x10e')](_0x5c05b9,[_0xa58b('0x4c')]));})['catch'](function(_0x5f5594){if(_0x5f5594[_0xa58b('0x10f')]){rpcDb[_0xa58b('0x110')](_0x282bdf);}if(_0x5f5594[_0xa58b('0x10a')]){rpcDb[_0xa58b('0x88')](_0x282bdf);}_0x5e5c35(_['pick'](_0x5f5594,[_0xa58b('0x4c')]));});});};Preview['prototype'][_0xa58b('0x10d')]=function(_0x5cebd2,_0x4e1c6f){var _0x26ec6e=this;return new BPromise(function(_0x4b1ee7,_0x2018e7){var _0x49248c,_0x238a27;rpcDb['getContactPreview'](_0x5cebd2)[_0xa58b('0x80')](function(_0x52b28d){if(!_[_0xa58b('0x6c')](_0x52b28d[0x0])){_0x238a27=_0x52b28d[0x0][_0xa58b('0x111')]?![]:!![];_0x49248c=_0x52b28d[0x0][_0xa58b('0x111')]?!![]:![];_0x49248c=_0x4e1c6f?!![]:_0x49248c;}var _0x268085=_0x26ec6e[_0xa58b('0x112')](_0x52b28d);if(_0x268085[_0xa58b('0x113')]){rpcDb[_0xa58b('0x114')](_[_0xa58b('0x10e')](_0x52b28d[0x0],[_0xa58b('0x74'),_0xa58b('0x115')]))[_0xa58b('0x80')](function(_0x25a68d){_0x26ec6e[_0xa58b('0x116')](_0x25a68d,_0x52b28d[0x0],_0x4e1c6f,_0x238a27,_0x49248c)[_0xa58b('0x80')](function(_0x256f79){_0x4b1ee7(_0x256f79);})[_0xa58b('0x77')](function(_0x3a6305){_0x2018e7(_0x3a6305);});})[_0xa58b('0x77')](function(_0xee3765){ut[_0xa58b('0x5f')](_0xa58b('0x117'),_0xee3765);_0x2018e7(ut[_0xa58b('0x4c')](_0xa58b('0x118'),_0x238a27,_0x49248c));});}else{_0x2018e7(ut[_0xa58b('0x4c')](_0x268085['message'],_0x238a27,_0x49248c));}})[_0xa58b('0x77')](function(_0x3edbaa){ut['logger'](_0xa58b('0x119'),_0x3edbaa);_0x2018e7(ut[_0xa58b('0x4c')](_0xa58b('0x118'),![],!![]));});});};Preview[_0xa58b('0xf')]['validateContact']=function(_0x55228f){if(_[_0xa58b('0x6c')](_0x55228f)||_[_0xa58b('0x11a')](_0x55228f)||!_['isNil'](_0x55228f[0x0][_0xa58b('0x84')])&&_[_0xa58b('0x6c')](_0x55228f[0x0]['Agent'][_0xa58b('0x54')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x55228f);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x44d09c=this[_0xa58b('0x14')][_0x55228f[0x0][_0xa58b('0xfb')][_0xa58b('0x54')]];_0x44d09c[_0xa58b('0x4c')]=_0xa58b('0x98');if(_[_0xa58b('0x6c')](_0x44d09c)){ut[_0xa58b('0x5f')]('[Preview][validateContact][Empty\x20Campaign]',_0x44d09c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa58b('0x96')](_0x44d09c[_0xa58b('0x53')])){ut['logger'](_0xa58b('0x11b'),_0xa58b('0x11c')+_0x44d09c[_0xa58b('0x54')]+_0xa58b('0x11d'));if(!this[_0xa58b('0x96')](_0x44d09c['TrunkBackup'])){ut[_0xa58b('0x5f')](_0xa58b('0x11b'),_0x44d09c[_0xa58b('0x54')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x44d09c[_0xa58b('0x68')])){ut[_0xa58b('0x5f')]('[Preview][validateContact][Campaign\x20Active]',_0x44d09c[_0xa58b('0x54')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xa58b('0x11c')+_0x44d09c[_0xa58b('0x54')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xa58b('0x11e')};};Preview[_0xa58b('0xf')][_0xa58b('0x11f')]=function(_0x4574ba,_0x3f93b3,_0x3c78bf,_0x344ea2){var _0x1bd156=this;return new BPromise(function(_0x44f8a0,_0x1d60ec){var _0x34156a=_0x4574ba[_0xa58b('0xaa')];var _0x456ffb=_0x1bd156[_0xa58b('0x96')](_0x3f93b3[_0xa58b('0x53')])?util[_0xa58b('0x58')](_0xa58b('0x120'),_0x3f93b3[_0xa58b('0x53')][_0xa58b('0x54')],_[_0xa58b('0x6c')](_0x3f93b3[_0xa58b('0x39')])?'':_0x3f93b3['dialPrefix']['trim']()||'',_0x3f93b3[_0xa58b('0x121')]>0x0?_0x3c78bf[_0xa58b('0xf8')][_0xa58b('0xf9')][_0xa58b('0x122')](_0x3f93b3[_0xa58b('0x121')]):_0x3c78bf[_0xa58b('0xf8')]['phone']):util['format']('SIP/%s/%s%s',_[_0xa58b('0x6c')](_0x3f93b3[_0xa58b('0x123')])?_0x3f93b3['Trunk']['name']:_0x3f93b3['TrunkBackup'][_0xa58b('0x54')],_[_0xa58b('0x6c')](_0x3f93b3[_0xa58b('0x39')])?'':_0x3f93b3[_0xa58b('0x39')][_0xa58b('0x124')]()||'',_0x3f93b3[_0xa58b('0x121')]>0x0?_0x3c78bf[_0xa58b('0xf8')]['phone'][_0xa58b('0x122')](_0x3f93b3[_0xa58b('0x121')]):_0x3c78bf[_0xa58b('0xf8')][_0xa58b('0xf9')]);var _0x154d7e=_0x1bd156[_0xa58b('0x96')](_0x3f93b3['Trunk'])?ut[_0xa58b('0x125')](_0x3f93b3[_0xa58b('0x53')]['callerid'],_0x3f93b3[_0xa58b('0x36')],_0x3f93b3[_0xa58b('0x126')]>0x0?ut[_0xa58b('0x127')](_0x3f93b3[_0xa58b('0x37')],_0x3f93b3['dialRandomLastDigitCallerIdNumber']):_0x3f93b3[_0xa58b('0x37')]):ut[_0xa58b('0x125')](_[_0xa58b('0x6c')](_0x3f93b3[_0xa58b('0x123')])?_0x3f93b3[_0xa58b('0x53')][_0xa58b('0x55')]:_0x3f93b3[_0xa58b('0x123')][_0xa58b('0x55')],_0x3f93b3['dialOriginateCallerIdName'],_0x3f93b3[_0xa58b('0x126')]>0x0?ut[_0xa58b('0x127')](_0x3f93b3[_0xa58b('0x37')],_0x3f93b3[_0xa58b('0x126')]):_0x3f93b3['dialOriginateCallerIdNumber']);if(_0x154d7e){_0x4574ba[_0xa58b('0x128')]=ut['extractCalleridName'](_0x154d7e);_0x4574ba[_0xa58b('0x129')]=ut[_0xa58b('0x12a')](_0x154d7e);}var _0xc9375c=ut['addVariables'](_0x3f93b3,_0x3c78bf,_0x456ffb,_0x154d7e,_0x34156a,_0x4574ba);_['merge'](_0x4574ba,ut[_0xa58b('0x12b')](_0xc9375c));_0x4574ba[_0xa58b('0x89')]=moment()[_0xa58b('0x58')](_0xa58b('0x12c'));ami[_0xa58b('0x12d')](ut[_0xa58b('0x12e')](_0x4574ba,_0x3f93b3,_0xc9375c,_0x4574ba[_0xa58b('0xa6')],_0x344ea2))[_0xa58b('0x80')](function(_0xa2073e){var _0x4d1c61=_0x4574ba[_0xa58b('0x12f')];if(!_['isNil'](_0x4d1c61)){if(!_[_0xa58b('0x6c')](_0x1bd156[_0xa58b('0x17')][_0x4d1c61])){_0x1bd156['agents'][_0x4d1c61][_0xa58b('0x130')]=_0x4574ba[_0xa58b('0x131')];emit(util['format']('user:%s',_0x1bd156['agents'][_0x4d1c61][_0xa58b('0x54')]),_0xa58b('0x132'),{'destaccountcode':_0x1bd156['agents'][_0x4d1c61]['accountcode'],'destconnectedlinenum':_0x4574ba[_0xa58b('0x131')]});}}_0x3f93b3['originated']+=0x1;logger[_0xa58b('0x5a')](_0xa58b('0x133'),_0x34156a,_0xa58b('0xab'),_0x3f93b3[_0xa58b('0x54')],'originated:\x20',_0x3f93b3['originated']);_0x44f8a0(_0xa2073e);})[_0xa58b('0x77')](function(_0x945f0e){ut['logAgent'](_0x4574ba,0xe,'OriginateError');rpcDb[_0xa58b('0xf0')](_0x4574ba,_0xa58b('0x134'));_0x1d60ec(_0x945f0e);});});};Preview[_0xa58b('0xf')][_0xa58b('0x135')]=function(_0x17442a){if(this[_0xa58b('0x16')][_0x17442a[_0xa58b('0xb7')]]){this['actions'][_0x17442a[_0xa58b('0xb7')]][_0xa58b('0x136')]=_0x17442a[_0xa58b('0x136')];}};Preview['prototype'][_0xa58b('0x1a')]=function(_0x487417){var _0x3aa0aa=this;var _0x53997a=this[_0xa58b('0x16')][_0x487417[_0xa58b('0x137')]];if(_0x53997a){if(_0x53997a['lookAgent']&&this[_0xa58b('0x17')][_0x53997a['lookAgent']]){ut[_0xa58b('0x138')](_0x53997a,this[_0xa58b('0x17')][_0x53997a['lookAgent']][_0xa58b('0x54')],this['agents'][_0x53997a[_0xa58b('0xfc')]]['id']);}var _0x44f610=_[_0xa58b('0x139')](_0x53997a);_0x44f610['responsetime']=moment()[_0xa58b('0x58')](_0xa58b('0x12c'));var _0x553e9c=_0x3aa0aa['campaignsPreview'][_0x53997a[_0xa58b('0x6e')]];if(ut[_0xa58b('0x13a')](_0x487417[_0xa58b('0x13b')])){if(_0x53997a['unlockAgent']){rpcDb['unlockContact'](_0x53997a[_0xa58b('0x100')]);}if(_0x53997a['activeContact']){rpcDb[_0xa58b('0x88')](_0x53997a['idContact']);}ami[_0xa58b('0x5c')](_0xa58b('0x13c'),ut[_0xa58b('0x9d')](_0x53997a,_0xa58b('0x13d'),this['campaignsPreview'][_0x53997a['queue']]));this[_0xa58b('0xeb')](_0x44f610,_0x553e9c,_0x487417);}else{_0x53997a[_0xa58b('0x89')]=moment()[_0xa58b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xa58b('0xee')](_0x44f610,0x4,'Answer');rpcDb[_0xa58b('0xf0')](_0x44f610,_0xa58b('0x13e'));}}};Preview[_0xa58b('0xf')][_0xa58b('0x1b')]=function(_0x4a51ff){var _0x2865e6=this;var _0x3d0253=this[_0xa58b('0x16')][_0x4a51ff[_0xa58b('0xb7')]];var _0x575e44;if(_0x3d0253){_0x575e44=this['campaignsPreview'][_0x3d0253['queue']];logger[_0xa58b('0x5a')](_0xa58b('0x13f'),_0x4a51ff[_0xa58b('0xb7')],_0xa58b('0xab'),_0x575e44['name'],_0xa58b('0x70'),_0x575e44[_0xa58b('0x2e')]);}if(this[_0xa58b('0x16')][_0x4a51ff[_0xa58b('0xb7')]]&&_0x4a51ff[_0xa58b('0xb7')]!==_0x4a51ff[_0xa58b('0xaa')]){if(_0x4a51ff[_0xa58b('0x140')]==='16'&&this[_0xa58b('0x16')][_0x4a51ff[_0xa58b('0xb7')]][_0xa58b('0x71')]){this[_0xa58b('0x141')](_0x4a51ff,_0x4a51ff['linkedid'],_0x4a51ff[_0xa58b('0x140')]);}else if(this['actions'][_0x4a51ff[_0xa58b('0xb7')]][_0xa58b('0x71')]){logger[_0xa58b('0x5a')]('[syncHangup][talking][cause]',_0x4a51ff[_0xa58b('0xb7')],_0x4a51ff[_0xa58b('0x140')],_0xa58b('0xab'),_0x575e44[_0xa58b('0x54')],_0xa58b('0x70'),_0x575e44[_0xa58b('0x2e')]);this[_0xa58b('0x141')](_0x4a51ff,_0x4a51ff[_0xa58b('0xb7')],_0x4a51ff['cause']);}}else if(_0x3d0253&&_[_0xa58b('0x6c')](_0x3d0253['statedesc'])&&_0x575e44[_0xa58b('0x142')]&&_0x4a51ff[_0xa58b('0xb7')]===_0x4a51ff['uniqueid']&&_[_0xa58b('0x6c')](_0x4a51ff[_0xa58b('0xed')])&&_0x4a51ff[_0xa58b('0x140')]==='16'&&_0x4a51ff[_0xa58b('0x143')]==='6'&&_[_0xa58b('0xec')](_0x3d0253['transfer'])){if(_0x3d0253[_0xa58b('0xc1')]){rpcDb[_0xa58b('0x110')](_0x3d0253[_0xa58b('0x100')]);}if(_0x3d0253[_0xa58b('0xa6')]){rpcDb['disableContact'](_0x3d0253[_0xa58b('0x100')]);}_0x4a51ff[_0xa58b('0xed')]='22';this[_0xa58b('0xeb')](_0x3d0253,_0x575e44,_0x4a51ff);}else if(_0x3d0253&&_0x3d0253['transfer']){if(_0x4a51ff[_0xa58b('0x140')]==='16'&&this[_0xa58b('0x16')][_0x4a51ff[_0xa58b('0xb7')]][_0xa58b('0x71')]){logger[_0xa58b('0x5a')]('[syncHangup][talking][transfer]',_0x4a51ff['linkedid'],_0x4a51ff[_0xa58b('0x140')],_0xa58b('0xab'),_0x575e44[_0xa58b('0x54')],'pTalking:\x20',_0x575e44[_0xa58b('0x2e')]);this[_0xa58b('0x141')](_0x4a51ff,_0x4a51ff[_0xa58b('0xb7')],_0x4a51ff['cause']);}else if(this['actions'][_0x4a51ff['linkedid']][_0xa58b('0x71')]){logger['info'](_0xa58b('0x144'),_0x4a51ff[_0xa58b('0xb7')],_0x4a51ff['cause'],'\x20Queue',_0x575e44[_0xa58b('0x54')],_0xa58b('0x70'),_0x575e44[_0xa58b('0x2e')]);this[_0xa58b('0x141')](_0x4a51ff,_0x4a51ff[_0xa58b('0xb7')],_0x4a51ff['cause']);}}};Preview[_0xa58b('0xf')][_0xa58b('0x20')]=function(_0x1c6baf){if(this[_0xa58b('0x16')][_0x1c6baf['destlinkedid']]&&_0x1c6baf['destlinkedid']!==_0x1c6baf[_0xa58b('0x145')]){this[_0xa58b('0x141')](_0x1c6baf,_0x1c6baf['destlinkedid'],_0x1c6baf[_0xa58b('0xe0')]);}};Preview[_0xa58b('0xf')][_0xa58b('0x1e')]=function(_0x5c5c9b){if(this[_0xa58b('0x16')][_0x5c5c9b[_0xa58b('0xb7')]]&&_0x5c5c9b['linkedid']!==_0x5c5c9b['uniqueid']&&!this[_0xa58b('0x16')][_0x5c5c9b[_0xa58b('0xb7')]][_0xa58b('0x71')]){if(_0x5c5c9b[_0xa58b('0x140')]==='1'){this[_0xa58b('0x141')](_0x5c5c9b,_0x5c5c9b[_0xa58b('0xb7')],_0x5c5c9b[_0xa58b('0x140')]);}}};Preview[_0xa58b('0xf')][_0xa58b('0x146')]=function(_0x29a41a,_0x324261,_0x48a0c6){if(this[_0xa58b('0x16')][_0x29a41a]){if(_['isNil'](this[_0xa58b('0x16')][_0x29a41a][_0xa58b('0x147')])){this[_0xa58b('0x16')][_0x29a41a]['variables']={};}this[_0xa58b('0x16')][_0x29a41a][_0xa58b('0x147')][_0x324261]=_0x48a0c6;}};Preview[_0xa58b('0xf')][_0xa58b('0x23')]=function(_0x4d998a){try{if(!_[_0xa58b('0x6c')](_0x4d998a)){if(ut[_0xa58b('0x148')](_[_0xa58b('0x149')](_0x4d998a['variable'])[0x0])){this[_0xa58b('0x146')](_0x4d998a[_0xa58b('0xaa')],_['keys'](_0x4d998a[_0xa58b('0x14a')])[0x0],_0x4d998a['value']);}}}catch(_0x970221){logger['error'](_0xa58b('0x14b'),util[_0xa58b('0x14c')](_0x970221,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xa58b('0x25')]=function(_0x37d6ab){if(_0x37d6ab){if(this[_0xa58b('0x16')][_0x37d6ab['transfertargetlinkedid']]){this[_0xa58b('0x16')][_0x37d6ab[_0xa58b('0x14d')]]['transfer']=!![];}}};Preview[_0xa58b('0xf')][_0xa58b('0x27')]=function(_0x42b39e){if(_0x42b39e){if(this[_0xa58b('0x16')][_0x42b39e[_0xa58b('0x14e')]]){this[_0xa58b('0x16')][_0x42b39e[_0xa58b('0x14e')]][_0xa58b('0x14f')]=!![];}}};module[_0xa58b('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 65b66ff..7110b07 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 _0xa833=['crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','then','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0xa833,0x1c0));var _0x3a83=function(_0x37cf78,_0x4f13db){_0x37cf78=_0x37cf78-0x0;var _0x2acddc=_0xa833[_0x37cf78];return _0x2acddc;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x3a83('0x0'))(_0x3a83('0x1'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x3a83('0x2'));var cmHopperHistory=require(_0x3a83('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x3a83('0x4'));var voiceQueueReport=require(_0x3a83('0x5'));function loggerCatch(_0x4cc487){return function(_0x2aa113){logger[_0x3a83('0x6')](_0x4cc487,util['inspect'](_0x2aa113,{'showHidden':![],'depth':null}));};}function create(_0x523d9d){return BPromise['resolve']()['then'](cmHopperHistory[_0x3a83('0x7')](_0x523d9d))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x9')));}function createAgent(_0x441ce5){return BPromise[_0x3a83('0xa')]()['then'](agentReportPreview[_0x3a83('0x7')](_0x441ce5))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x9')));}function moveContact(_0x519c19){return BPromise[_0x3a83('0xa')]()['then'](cmHopper[_0x3a83('0xb')](_0x519c19,!![]))[_0x3a83('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x3a83('0xc')]=function(_0x5a9381){return BPromise[_0x3a83('0xa')]()[_0x3a83('0xd')](cmHopperBlack[_0x3a83('0xc')](_0x5a9381))[_0x3a83('0x8')](loggerCatch(_0x3a83('0xe')));};exports[_0x3a83('0xf')]=function(_0x5b1328){return BPromise[_0x3a83('0xa')]()[_0x3a83('0xd')](cmHopper[_0x3a83('0xf')](_0x5b1328))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x10')));};exports[_0x3a83('0x7')]=function(_0x353fcc,_0xa7ba90){create(_0x353fcc)[_0x3a83('0x8')](loggerCatch(_0xa7ba90));moveContact(_0x353fcc)[_0x3a83('0x8')](loggerCatch(_0xa7ba90));};exports[_0x3a83('0x11')]=function(_0x55c3ea,_0x5ba1b0){createAgent(_0x55c3ea)[_0x3a83('0x8')](loggerCatch(_0x5ba1b0));};exports[_0x3a83('0x12')]=function(_0x5b29f7,_0x2fcfae){create(_0x5b29f7)['catch'](loggerCatch(_0x2fcfae));};exports[_0x3a83('0x13')]=function(_0x28f40b,_0x2f9fa9){moveContact(_0x28f40b)['catch'](loggerCatch(_0x2f9fa9));};exports[_0x3a83('0x14')]=function(_0x11ff57,_0x2dceb,_0x4c6cbc){if(_0x2dceb){_0x11ff57[_0x3a83('0x15')]=null;}if(_0x4c6cbc){_0x11ff57['active']=![];}return BPromise[_0x3a83('0xa')]()['then'](cmHopper[_0x3a83('0x14')](_0x11ff57))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x16')));};exports[_0x3a83('0x17')]=function(_0xe60d3e){return BPromise['resolve']()['then'](cmHopper[_0x3a83('0x17')](_0xe60d3e))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x18')));};exports[_0x3a83('0x19')]=function(_0x3f0f2c){return BPromise[_0x3a83('0xa')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x3f0f2c,0x1))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x1a')));};exports[_0x3a83('0x1b')]=function(_0x2f213c){return BPromise['resolve']()[_0x3a83('0xd')](cmHopper['unlockContact']({'active':![]},_0x2f213c,0x1))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x1c')));};exports[_0x3a83('0x1d')]=function(_0x3f868e){var _0xa23cc8={};_0xa23cc8[_0x3a83('0x1e')]=_0x3f868e['type'];_0xa23cc8['uniqueid']=_0x3f868e['uniqueid'];_0xa23cc8[_0x3a83('0x1f')]=_0x3f868e[_0x3a83('0x1f')];_0xa23cc8[_0x3a83('0x20')]=_0x3f868e[_0x3a83('0x20')];_0xa23cc8[_0x3a83('0x21')]=_0x3f868e[_0x3a83('0x21')];_0xa23cc8[_0x3a83('0x22')]=_0x3f868e[_0x3a83('0x23')];_0xa23cc8[_0x3a83('0x24')]=_0x3f868e['answertime'];_0xa23cc8[_0x3a83('0x25')]=0x1;_0xa23cc8[_0x3a83('0x26')]=_0x3f868e['endtime'];_0xa23cc8[_0x3a83('0x27')]=_0x3f868e['membername'];_0xa23cc8[_0x3a83('0x28')]=_0x3a83('0x29');_0xa23cc8[_0x3a83('0x2a')]=_0x3a83('0x2b');_0xa23cc8[_0x3a83('0x2c')]=0x0;_0xa23cc8[_0x3a83('0x2d')]=0x1;_0xa23cc8['lastAssignedTo']=_0x3f868e['membername'];_0xa23cc8[_0x3a83('0x2e')]=_0x3a83('0x2f');return BPromise['resolve']()[_0x3a83('0xd')](voiceQueueReport[_0x3a83('0x30')](_0xa23cc8))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x31')));};exports['getContactRecallMe']=function(_0x1e356f,_0x1814ee){return BPromise[_0x3a83('0xa')]()[_0x3a83('0xd')](cmHopper[_0x3a83('0x32')](_0x1e356f,_0x1814ee))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x33')));};exports['rescheduleContactInQueue']=function(_0x2b3b40){return BPromise['resolve']()[_0x3a83('0xd')](cmHopper[_0x3a83('0x14')](_0x2b3b40,!![],!![]))[_0x3a83('0x8')](loggerCatch(_0x3a83('0x34')));}; \ No newline at end of file +var _0x2548=['[countReScheduled]\x20','unlockContact','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','[rescheduleContact]\x20'];(function(_0x35b2a1,_0x4cdca8){var _0x6023da=function(_0x10cd9f){while(--_0x10cd9f){_0x35b2a1['push'](_0x35b2a1['shift']());}};_0x6023da(++_0x4cdca8);}(_0x2548,0x141));var _0x8254=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2548[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x8254('0x0'));var BPromise=require(_0x8254('0x1'));var logger=require(_0x8254('0x2'))('preview');var _=require(_0x8254('0x3'));var cmHopper=require(_0x8254('0x4'));var cmHopperFinal=require(_0x8254('0x5'));var cmHopperHistory=require(_0x8254('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8254('0x7'));function loggerCatch(_0x1dd050){return function(_0x3b55ab){logger['error'](_0x1dd050,util[_0x8254('0x8')](_0x3b55ab,{'showHidden':![],'depth':null}));};}function create(_0x4d71d9){return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](cmHopperHistory[_0x8254('0xb')](_0x4d71d9))[_0x8254('0xc')](loggerCatch(_0x8254('0xd')));}function createAgent(_0x212984){return BPromise['resolve']()['then'](agentReportPreview[_0x8254('0xb')](_0x212984))['catch'](loggerCatch(_0x8254('0xd')));}function moveContact(_0x107eff){return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](cmHopper['moveContactManagedDialer'](_0x107eff,!![]))[_0x8254('0xc')](loggerCatch(_0x8254('0xe')));}exports[_0x8254('0xf')]=function(_0x974437){return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](cmHopperBlack[_0x8254('0xf')](_0x974437))['catch'](loggerCatch(_0x8254('0x10')));};exports[_0x8254('0x11')]=function(_0x43d782){return BPromise['resolve']()[_0x8254('0xa')](cmHopper['getContactPreview'](_0x43d782))[_0x8254('0xc')](loggerCatch(_0x8254('0x12')));};exports[_0x8254('0xb')]=function(_0x470f33,_0x19a522){create(_0x470f33)[_0x8254('0xc')](loggerCatch(_0x19a522));moveContact(_0x470f33)[_0x8254('0xc')](loggerCatch(_0x19a522));};exports[_0x8254('0x13')]=function(_0x5571b4,_0xdfa86b){createAgent(_0x5571b4)[_0x8254('0xc')](loggerCatch(_0xdfa86b));};exports[_0x8254('0x14')]=function(_0x2ceeab,_0x2a6d50){create(_0x2ceeab)[_0x8254('0xc')](loggerCatch(_0x2a6d50));};exports['createCustomerFinal']=function(_0x141eeb,_0x5b9f1c){moveContact(_0x141eeb)[_0x8254('0xc')](loggerCatch(_0x5b9f1c));};exports['rescheduleContact']=function(_0x15ec4c,_0xca803e,_0x3c5c42){if(_0xca803e){_0x15ec4c['UserId']=null;}if(_0x3c5c42){_0x15ec4c['active']=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x15ec4c))['catch'](loggerCatch(_0x8254('0x15')));};exports['countReScheduled']=function(_0x19e7e9){return BPromise['resolve']()[_0x8254('0xa')](cmHopper['countReScheduled'](_0x19e7e9))[_0x8254('0xc')](loggerCatch(_0x8254('0x16')));};exports[_0x8254('0x17')]=function(_0x15e60c){return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](cmHopper['unlockContact']({'UserId':null},_0x15e60c,0x1))[_0x8254('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0x8254('0x18')]=function(_0x5efeff){return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](cmHopper[_0x8254('0x17')]({'active':![]},_0x5efeff,0x1))[_0x8254('0xc')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x1cdeac){var _0x48dc59={};_0x48dc59[_0x8254('0x19')]=_0x1cdeac[_0x8254('0x19')];_0x48dc59[_0x8254('0x1a')]=_0x1cdeac['uniqueid'];_0x48dc59[_0x8254('0x1b')]=_0x1cdeac[_0x8254('0x1b')];_0x48dc59[_0x8254('0x1c')]=_0x1cdeac[_0x8254('0x1c')];_0x48dc59['queue']=_0x1cdeac[_0x8254('0x1d')];_0x48dc59['queuecallerjoinAt']=_0x1cdeac['answertime'];_0x48dc59[_0x8254('0x1e')]=_0x1cdeac[_0x8254('0x1f')];_0x48dc59[_0x8254('0x20')]=0x1;_0x48dc59[_0x8254('0x21')]=_0x1cdeac[_0x8254('0x22')];_0x48dc59['connectedlinename']=_0x1cdeac[_0x8254('0x23')];_0x48dc59[_0x8254('0x24')]='from-sip';_0x48dc59[_0x8254('0x25')]=_0x8254('0x26');_0x48dc59['holdtime']=0x0;_0x48dc59[_0x8254('0x27')]=0x1;_0x48dc59[_0x8254('0x28')]=_0x1cdeac[_0x8254('0x23')];_0x48dc59[_0x8254('0x29')]=_0x8254('0x2a');return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](voiceQueueReport[_0x8254('0x2b')](_0x48dc59))[_0x8254('0xc')](loggerCatch(_0x8254('0x2c')));};exports[_0x8254('0x2d')]=function(_0x3b4e57,_0x9e2f8){return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](cmHopper['getContactRecallMe'](_0x3b4e57,_0x9e2f8))[_0x8254('0xc')](loggerCatch(_0x8254('0x2e')));};exports[_0x8254('0x2f')]=function(_0x1a3937){return BPromise[_0x8254('0x9')]()[_0x8254('0xa')](cmHopper['rescheduleContact'](_0x1a3937,!![],!![]))[_0x8254('0xc')](loggerCatch(_0x8254('0x30')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 4075cee..c275dcb 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 _0x3531=['decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','voice','buildAcw','agentReadyId','not_inuse','status','push','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countcongestionretry','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','match','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','ContactId','dialer','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','cloneAction','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId'];(function(_0x4ef300,_0x17619d){var _0x5db6ee=function(_0x5c8678){while(--_0x5c8678){_0x4ef300['push'](_0x4ef300['shift']());}};_0x5db6ee(++_0x17619d);}(_0x3531,0xbc));var _0x1353=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3531[_0x160c73];return _0xd9302;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require(_0x1353('0x0'))(_0x1353('0x1'));var ipAgi=process[_0x1353('0x2')][_0x1353('0x3')]||_0x1353('0x4');function getSeconds(_0x21c39d,_0x30f529){var _0x236840=moment(_0x21c39d)[_0x1353('0x5')](0x0);var _0x31973a=moment(_0x30f529)[_0x1353('0x5')](0x0);return _0x236840[_0x1353('0x6')](_0x31973a,_0x1353('0x7'));}exports[_0x1353('0x8')]=function(_0x583d20){return function(_0x14d6a2){logger[_0x1353('0x9')](_0x583d20,util[_0x1353('0xa')](_0x14d6a2,{'showHidden':![],'depth':null}));};};exports[_0x1353('0xb')]=function(_0x5a17df,_0x15c80e){logger[_0x1353('0xc')](_0x5a17df,util['inspect'](_0x15c80e,{'showHidden':![],'depth':null}));};exports[_0x1353('0xd')]=function(_0x3e00b0,_0x44bfdf){logger['error'](_0x3e00b0,util[_0x1353('0xa')](_0x44bfdf,{'showHidden':![],'depth':null}));};exports[_0x1353('0xe')]=function(_0x919c78){return function(_0x15cecd){logger[_0x1353('0xc')](_0x919c78,util[_0x1353('0xa')](_0x15cecd,{'showHidden':![],'depth':null}));};};exports[_0x1353('0xf')]=function(_0x175477,_0xff8f55,_0x42518f){return{'message':_0x175477,'unlock':_0xff8f55,'active':_0x42518f};};exports[_0x1353('0x10')]=function(_0x418dc1,_0x51393b,_0x5b98cd){if(!_[_0x1353('0x11')](_0x5b98cd)&&'string'===typeof _0x5b98cd&&!_[_0x1353('0x12')](_0x5b98cd)){if(!_[_0x1353('0x11')](_0x51393b)&&_0x1353('0x13')===typeof _0x51393b&&!_[_0x1353('0x12')](_0x51393b)){return util['format'](_0x1353('0x14'),_0x51393b,_0x5b98cd);}return util[_0x1353('0x15')](_0x1353('0x14'),_0x5b98cd,_0x5b98cd);}if(!_[_0x1353('0x11')](_0x418dc1)&&_0x1353('0x13')===typeof _0x418dc1&&!_[_0x1353('0x12')](_0x418dc1)){return _0x418dc1;}return _0x1353('0x16');};exports[_0x1353('0x17')]=function(_0x9f2217){if(_['isNil'](_0x9f2217)){return![];}return _0x9f2217;};exports[_0x1353('0x18')]=function(_0x78439c,_0x440e46,_0x5dd9de,_0x33d357,_0x449f9a,_0x21c576){var _0x2f9e1d={'XMD-QUEUE':_0x440e46[_0x1353('0x19')]?_0x440e46[_0x1353('0x19')]['name']:'','XMD-CALLERID':_0x33d357,'XMD-CALLERID-PREVIEW':_0x21c576?util[_0x1353('0x15')]('\x22%s\x22\x20<%s>',_0x21c576[_0x1353('0x1a')],_0x21c576['calleridnum']):_0x33d357,'XMD-DIALID':_0x449f9a,'XMD-CONTACTID':_0x440e46[_0x1353('0x1b')],'XMD-CDRTYPE':_0x1353('0x1c'),'CALLERID(all)':_0x33d357,'XMD-VOICEQUEUEID':_0x440e46['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5dd9de,'XMD-DIALTIMEOUT':_0x78439c['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x1353('0x15')](_0x1353('0x1d'),_0x78439c[_0x1353('0x1e')]?'g':'',_[_0x1353('0x12')](_0x78439c['monitor_format'])?'':_0x1353('0x1f')),'XMD-DIALURL':_0x78439c[_0x1353('0x20')]||'','XMD-AGI':_0x78439c[_0x1353('0x21')]?util[_0x1353('0x15')](_0x1353('0x22'),ipAgi,_0x78439c[_0x1353('0x21')]):_0x1353('0x23'),'XMD-AGIAFTER':_0x78439c[_0x1353('0x1e')]?util[_0x1353('0x15')](_0x1353('0x22'),ipAgi,_0x78439c[_0x1353('0x1e')]):_0x1353('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x21c576?_0x21c576[_0x1353('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x21c576?_0x21c576[_0x1353('0x25')]:'','XMD-DESTINATION':_0x1353('0x26')};if(!_[_0x1353('0x12')](_0x78439c['monitor_format'])){_0x2f9e1d[util[_0x1353('0x15')]('%s',_0x1353('0x27'))]=_0x78439c[_0x1353('0x28')];_0x2f9e1d[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x449f9a;}if(_0x440e46&&_0x440e46[_0x1353('0x29')]){for(var _0x5d4729 in _0x440e46[_0x1353('0x29')]){if(_0x440e46[_0x1353('0x29')][_0x1353('0x2a')](_0x5d4729)){if(!_['isNil'](_0x440e46['Contact'][_0x5d4729])&&_0x5d4729!=='id'&&_0x5d4729!==_0x1353('0x2b')&&_0x5d4729!==_0x1353('0x2c')&&_0x5d4729!==_0x1353('0x2d')){_0x2f9e1d[util[_0x1353('0x15')]('%s%s',_0x1353('0x2e'),_[_0x1353('0x2f')](_0x5d4729))]=_0x440e46[_0x1353('0x29')][_0x5d4729];}}}}return _0x2f9e1d;};exports[_0x1353('0x30')]=function(_0x477d2c){var _0x1e9da4={};for(var _0x2fdb41 in _0x477d2c){if(_0x477d2c[_0x1353('0x2a')](_0x2fdb41)){_0x1e9da4[util[_0x1353('0x15')]('%s',_['toLower'](_0x2fdb41))]=_0x477d2c[_0x2fdb41];}}return{'variables':_0x1e9da4};};exports['updateOriginated']=function(_0x364bb9,_0x3ddce9){if(!_[_0x1353('0x31')](_0x364bb9)){if(_0x364bb9['hasOwnProperty'](_0x1353('0x32'))){if(_0x364bb9['originated']>0x0){_0x364bb9[_0x1353('0x32')]-=0x1;}else{logger[_0x1353('0x9')](_0x1353('0x33'),_0x3ddce9);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3ddce9);}};exports['logBlacklist']=function(_0x4cad61){var _0x38022c=moment()['format'](_0x1353('0x34'));_0x4cad61[_0x1353('0x35')]=0xd;_0x4cad61[_0x1353('0x36')]=_0x1353('0x37');_0x4cad61[_0x1353('0x38')]=_0x38022c;_0x4cad61['responsetime']=_0x38022c;_0x4cad61[_0x1353('0x39')]=_0x38022c;};exports[_0x1353('0x3a')]=function(_0x2afe35,_0x3618ad,_0xbf3579){var _0x4f80b9=moment()[_0x1353('0x15')](_0x1353('0x34'));_0x2afe35[_0x1353('0x35')]=_0x3618ad;_0x2afe35['statedesc']=_0xbf3579;_0x2afe35[_0x1353('0x3b')]=_0x4f80b9;_0x2afe35['ringtime']=getSeconds(_0x2afe35[_0x1353('0x3b')],_0x2afe35[_0x1353('0x38')]);};exports[_0x1353('0x3c')]=function(_0x3646c7,_0x3c731d,_0x57a906){_0x3646c7[_0x1353('0x3d')]=_0x3c731d;_0x3646c7[_0x1353('0x3e')]=_0x57a906;};exports[_0x1353('0x3f')]=function(_0x52677c,_0x362f8e,_0x5a32cc){var _0x52d1b1=moment()[_0x1353('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x52677c['state']=_0x362f8e;_0x52677c['statedesc']=_0x5a32cc;_0x52677c[_0x1353('0x3b')]=_0x52677c[_0x1353('0x3b')]?_0x52677c[_0x1353('0x3b')]:_0x52d1b1;_0x52677c[_0x1353('0x39')]=_0x52677c[_0x1353('0x39')]?_0x52677c['endtime']:_0x52d1b1;_0x52677c[_0x1353('0x40')]=getSeconds(_0x52677c[_0x1353('0x3b')]||0x0,_0x52677c[_0x1353('0x38')]||0x0);_0x52677c[_0x1353('0x41')]=_0x52677c['answertime']?getSeconds(_0x52677c[_0x1353('0x39')],_0x52677c[_0x1353('0x42')]):0x0;};exports[_0x1353('0x43')]=function(_0x5e93f5){return _0x5e93f5==='Failure';};exports[_0x1353('0x44')]=function(_0x282d56,_0x2203d4,_0x12cbed,_0x3f14b0,_0x25e8cd){var _0x223370=_0x3f14b0?_0x1353('0x45'):_0x282d56[_0x1353('0x1a')];_0x223370=_0x25e8cd?_0x1353('0x46'):_0x223370;return{'actionid':_0x282d56[_0x1353('0x47')],'action':_0x1353('0x48'),'channel':_0x282d56[_0x1353('0x49')],'callerid':util['format'](_0x1353('0x14'),_0x223370,_0x282d56[_0x1353('0x4a')]),'Exten':'xcally-motion-preview','Context':_0x1353('0x4b'),'Priority':'1','variable':_0x12cbed,'timeout':(_0x2203d4[_0x1353('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x282d56['uniqueid']};};exports[_0x1353('0x4d')]=function(_0x401983){return _0x401983[_0x1353('0x4e')]+_0x401983['countcongestionretry']+_0x401983[_0x1353('0x4f')]+_0x401983['countagentrejectretry']+_0x401983['countnosuchnumberretry'];};exports[_0x1353('0x50')]=function(_0x2b9eea){var _0x3d845c=_['clone'](_0x2b9eea);_0x3d845c[_0x1353('0x35')]=0xf;_0x3d845c[_0x1353('0x36')]=_0x1353('0x51');return _0x3d845c;};exports[_0x1353('0x52')]=function(_0x3c8cbb,_0x19b351,_0x41d0c9){var _0x25e2cc={};_0x25e2cc[_0x19b351]=_0x3c8cbb[_0x19b351];_0x25e2cc[_0x1353('0x53')]=![];_0x25e2cc[_0x1353('0x54')]=moment()['add'](_0x41d0c9,_0x1353('0x55'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25e2cc[_0x1353('0x1b')]=_0x3c8cbb[_0x1353('0x1b')];_0x25e2cc['ListId']=_0x3c8cbb[_0x1353('0x56')];_0x25e2cc[_0x1353('0x57')]=_0x3c8cbb[_0x1353('0x57')]||undefined;return _0x25e2cc;};exports[_0x1353('0x58')]=function(_0x14690d,_0x3a7127){if(!_[_0x1353('0x31')](_0x14690d)){if(_0x14690d[_0x1353('0x59')]>0x0){_0x14690d[_0x1353('0x59')]-=0x1;}else{logger[_0x1353('0x9')](_0x3a7127,_0x1353('0x5a'));}}else{logger[_0x1353('0x9')](_0x3a7127,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x1353('0x5b')]=function(_0x5333c0){if(_0x5333c0<=0x0){return!![];}return![];};exports[_0x1353('0x5c')]=function(_0x593f25,_0x3d44d3,_0x433abc){_0x593f25[_0x1353('0x5d')]=_0x3d44d3;_0x593f25['name']=_0x593f25[_0x1353('0x5e')];_0x593f25['interface']=_0x593f25[_0x1353('0x49')];_0x593f25[_0x1353('0x5f')]=_0x1353('0x60');if(_0x433abc){_0x593f25['mandatoryDisposition']=_0x433abc['mandatoryDisposition'];}return _0x593f25;};exports[_0x1353('0x61')]=function(_0x14a82d){var _0x41a151={};_0x41a151[_0x1353('0x5e')]=_0x14a82d[_0x1353('0x5e')];_0x41a151['interface']=_0x14a82d[_0x1353('0x49')];_0x41a151[_0x1353('0x47')]=_0x14a82d[_0x1353('0x47')];return _0x41a151;};exports[_0x1353('0x62')]=function(_0x47f264){var _0xb203f=[];for(var _0x1d1f7d in _0x47f264){if(_0x47f264[_0x1353('0x2a')](_0x1d1f7d)){if(!_[_0x1353('0x31')](_0x47f264[_0x1d1f7d])&&_0x47f264[_0x1d1f7d][_0x1353('0x35')]===_0x1353('0x63')&&_0x47f264[_0x1d1f7d][_0x1353('0x64')]==='reachable'){_0xb203f[_0x1353('0x65')](_0x47f264[_0x1d1f7d]['id']);}}}return _0xb203f;};exports['getDiff']=function(_0x177eca){var _0x593321=moment()[_0x1353('0x5')](0x0);var _0x537cb2=moment(_0x177eca)['milliseconds'](0x0);return _0x593321[_0x1353('0x6')](_0x537cb2,_0x1353('0x7'));};exports[_0x1353('0x66')]=function(_0x5c2854){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c2854[_0x1353('0x1b')],'ListId':_0x5c2854[_0x1353('0x56')],'VoiceQueueId':_0x5c2854['VoiceQueueId']||undefined,'CampaignId':_0x5c2854['CampaignId']||undefined};};exports[_0x1353('0x67')]=function(_0x40a252){if(_0x40a252===_0x1353('0x47')||_0x40a252===_0x1353('0x68')||_0x40a252===_0x1353('0x5e')||_0x40a252===_0x1353('0x69')||_0x40a252===_0x1353('0x6a')||_0x40a252===_0x1353('0x6b')||_0x40a252===_0x1353('0x3d')||_0x40a252===_0x1353('0x49')||_0x40a252==='calleridname'||_0x40a252===_0x1353('0x53')||_0x40a252===_0x1353('0x4a')||_0x40a252===_0x1353('0x54')||_0x40a252===_0x1353('0x4e')||_0x40a252===_0x1353('0x6c')||_0x40a252===_0x1353('0x4f')||_0x40a252==='countglobal'||_0x40a252==='callback'||_0x40a252===_0x1353('0x6d')||_0x40a252===_0x1353('0x6e')||_0x40a252===_0x1353('0x6f')||_0x40a252===_0x1353('0x1b')||_0x40a252===_0x1353('0x56')||_0x40a252==='UserId'||_0x40a252===_0x1353('0x57')||_0x40a252===_0x1353('0x70')||_0x40a252==='xmd-voicequeueid'||_0x40a252===_0x1353('0x71')||_0x40a252===_0x1353('0x72')||_0x40a252===_0x1353('0x73')||_0x40a252===_0x1353('0x74')||_0x40a252===_0x1353('0x75')||_0x40a252===_0x1353('0x76')||_0x40a252===_0x1353('0x77')||_0x40a252==='xmd-dialchannel'||_0x40a252===_0x1353('0x78')||_0x40a252===_0x1353('0x79')||_0x40a252==='xmd-callerid'||_0x40a252==='xmd-agiafter'||_0x40a252===_0x1353('0x7a')||_0x40a252===_0x1353('0x7b')||_0x40a252===_0x1353('0x7c')||_0x40a252==='rtpaudioqosjitter'||_0x40a252===_0x1353('0x7d')||_0x40a252===_0x1353('0x7e')||_0x40a252===_0x1353('0x7f')||_0x40a252===_0x1353('0x80')||_0x40a252===_0x1353('0x81')||_0x40a252===_0x1353('0x7b')||_0x40a252===_0x1353('0x7c')||_0x40a252===_0x1353('0x82')||_0x40a252===_0x1353('0x7d')||_0x40a252===_0x1353('0x7e')||_0x40a252===_0x1353('0x7f')||_0x40a252===_0x1353('0x80')||_0x40a252==='rtpaudioqosrttbridged'||_0x40a252==='bridgepeer'||_0x40a252===_0x1353('0x83')||_0x40a252===_0x1353('0x35')||_0x40a252===_0x1353('0x36')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x382fb0,_0x390eee){var _0x3a0c1a,_0x1d5599,_0x350b51;if(_0x390eee<=0x0){_0x390eee=0x1;}_0x3a0c1a=new RegExp(_0x1353('0x84')+_0x390eee+'}$');_0x1d5599=Math[_0x1353('0x85')](0xa,_0x390eee-0x1);_0x350b51=Math[_0x1353('0x85')](0xa,_0x390eee)-0x1;return util['format']('%s',_[_0x1353('0x86')](_0x382fb0,_0x3a0c1a,_['random'](_0x1d5599,_0x350b51)));};exports[_0x1353('0x87')]=function(_0x2987b9){var _0x410b2e=_0x2987b9['match'](/"(.*?)"/);return _0x410b2e?_0x410b2e[0x1]:_0x2987b9;};exports[_0x1353('0x88')]=function(_0x89a6e){var _0x1cb9ac=_0x89a6e[_0x1353('0x89')](/<(.*?)>/);return _0x1cb9ac?_0x1cb9ac[0x1]:_0x89a6e;}; \ No newline at end of file +var _0xe4a8=['dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','XMD-','toUpper','toLowerVariables','toLower','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','logCustomer','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','mandatoryDisposition','interface','not_inuse','status','reachable','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','membername','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','logger2','getCallerId','string','isUndefined','\x22%s\x22\x20<%s>','isEmpty','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','format'];(function(_0x20f0e8,_0x185419){var _0x162b37=function(_0x10a6ce){while(--_0x10a6ce){_0x20f0e8['push'](_0x20f0e8['shift']());}};_0x162b37(++_0x185419);}(_0xe4a8,0xef));var _0x8e4a=function(_0xa76664,_0x5e32db){_0xa76664=_0xa76664-0x0;var _0x3f7743=_0xe4a8[_0xa76664];return _0x3f7743;};'use strict';var util=require('util');var _=require(_0x8e4a('0x0'));var moment=require(_0x8e4a('0x1'));var logger=require(_0x8e4a('0x2'))(_0x8e4a('0x3'));var ipAgi=process[_0x8e4a('0x4')][_0x8e4a('0x5')]||_0x8e4a('0x6');function getSeconds(_0x523de0,_0x287968){var _0x24ceff=moment(_0x523de0)[_0x8e4a('0x7')](0x0);var _0x196876=moment(_0x287968)[_0x8e4a('0x7')](0x0);return _0x24ceff[_0x8e4a('0x8')](_0x196876,_0x8e4a('0x9'));}exports[_0x8e4a('0xa')]=function(_0x131970){return function(_0xa0aebf){logger[_0x8e4a('0xb')](_0x131970,util['inspect'](_0xa0aebf,{'showHidden':![],'depth':null}));};};exports[_0x8e4a('0xc')]=function(_0x20c4ee,_0x34bf43){logger[_0x8e4a('0xd')](_0x20c4ee,util[_0x8e4a('0xe')](_0x34bf43,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xdb8aa0,_0x4dca68){logger[_0x8e4a('0xb')](_0xdb8aa0,util[_0x8e4a('0xe')](_0x4dca68,{'showHidden':![],'depth':null}));};exports[_0x8e4a('0xf')]=function(_0x29885d){return function(_0x5614aa){logger[_0x8e4a('0xd')](_0x29885d,util[_0x8e4a('0xe')](_0x5614aa,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1a3dd4,_0x3304fc,_0x29a776){return{'message':_0x1a3dd4,'unlock':_0x3304fc,'active':_0x29a776};};exports[_0x8e4a('0x10')]=function(_0x5ee8ea,_0x3d1c80,_0x52ee4a){if(!_['isUndefined'](_0x52ee4a)&&_0x8e4a('0x11')===typeof _0x52ee4a&&!_['isEmpty'](_0x52ee4a)){if(!_[_0x8e4a('0x12')](_0x3d1c80)&&'string'===typeof _0x3d1c80&&!_['isEmpty'](_0x3d1c80)){return util['format'](_0x8e4a('0x13'),_0x3d1c80,_0x52ee4a);}return util['format'](_0x8e4a('0x13'),_0x52ee4a,_0x52ee4a);}if(!_['isUndefined'](_0x5ee8ea)&&_0x8e4a('0x11')===typeof _0x5ee8ea&&!_[_0x8e4a('0x14')](_0x5ee8ea)){return _0x5ee8ea;}return'\x22\x22\x20<>';};exports[_0x8e4a('0x15')]=function(_0x21378c){if(_[_0x8e4a('0x16')](_0x21378c)){return![];}return _0x21378c;};exports[_0x8e4a('0x17')]=function(_0x5adf05,_0x3fbdff,_0x12d3e7,_0x24117f,_0x589660,_0x5bdefd){var _0x4e2863={'XMD-QUEUE':_0x3fbdff[_0x8e4a('0x18')]?_0x3fbdff[_0x8e4a('0x18')][_0x8e4a('0x19')]:'','XMD-CALLERID':_0x24117f,'XMD-CALLERID-PREVIEW':_0x5bdefd?util['format']('\x22%s\x22\x20<%s>',_0x5bdefd[_0x8e4a('0x1a')],_0x5bdefd[_0x8e4a('0x1b')]):_0x24117f,'XMD-DIALID':_0x589660,'XMD-CONTACTID':_0x3fbdff[_0x8e4a('0x1c')],'XMD-CDRTYPE':_0x8e4a('0x1d'),'CALLERID(all)':_0x24117f,'XMD-VOICEQUEUEID':_0x3fbdff[_0x8e4a('0x1e')],'XMD-DIALCHANNEL':_0x12d3e7,'XMD-DIALTIMEOUT':_0x5adf05['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x5adf05['dialQueueProject2']?'g':'',_[_0x8e4a('0x14')](_0x5adf05[_0x8e4a('0x1f')])?'':_0x8e4a('0x20')),'XMD-DIALURL':_0x5adf05[_0x8e4a('0x21')]||'','XMD-AGI':_0x5adf05['dialQueueProject']?util[_0x8e4a('0x22')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5adf05[_0x8e4a('0x23')]):_0x8e4a('0x24'),'XMD-AGIAFTER':_0x5adf05[_0x8e4a('0x25')]?util['format'](_0x8e4a('0x26'),ipAgi,_0x5adf05[_0x8e4a('0x25')]):_0x8e4a('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x5bdefd?_0x5bdefd['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5bdefd?_0x5bdefd['originatecalleridname']:'','XMD-DESTINATION':_0x8e4a('0x27')};if(!_[_0x8e4a('0x14')](_0x5adf05['monitor_format'])){_0x4e2863[util[_0x8e4a('0x22')]('%s',_0x8e4a('0x28'))]=_0x5adf05[_0x8e4a('0x1f')];_0x4e2863[util[_0x8e4a('0x22')]('%s',_0x8e4a('0x29'))]=_0x589660;}if(_0x3fbdff&&_0x3fbdff['Contact']){for(var _0x202dfa in _0x3fbdff[_0x8e4a('0x2a')]){if(_0x3fbdff['Contact'][_0x8e4a('0x2b')](_0x202dfa)){if(!_[_0x8e4a('0x16')](_0x3fbdff['Contact'][_0x202dfa])&&_0x202dfa!=='id'&&_0x202dfa!==_0x8e4a('0x2c')&&_0x202dfa!=='createdAt'&&_0x202dfa!==_0x8e4a('0x2d')){_0x4e2863[util[_0x8e4a('0x22')]('%s%s',_0x8e4a('0x2e'),_[_0x8e4a('0x2f')](_0x202dfa))]=_0x3fbdff[_0x8e4a('0x2a')][_0x202dfa];}}}}return _0x4e2863;};exports[_0x8e4a('0x30')]=function(_0x1996b2){var _0x232d8a={};for(var _0x347fde in _0x1996b2){if(_0x1996b2['hasOwnProperty'](_0x347fde)){_0x232d8a[util[_0x8e4a('0x22')]('%s',_[_0x8e4a('0x31')](_0x347fde))]=_0x1996b2[_0x347fde];}}return{'variables':_0x232d8a};};exports['updateOriginated']=function(_0x47d955,_0x123662){if(!_['isNil'](_0x47d955)){if(_0x47d955['hasOwnProperty']('originated')){if(_0x47d955['originated']>0x0){_0x47d955['originated']-=0x1;}else{logger[_0x8e4a('0xb')](_0x8e4a('0x32'),_0x123662);}}}else{logger[_0x8e4a('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x123662);}};exports[_0x8e4a('0x33')]=function(_0x3bdbfd){var _0x36fd7b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3bdbfd[_0x8e4a('0x34')]=0xd;_0x3bdbfd[_0x8e4a('0x35')]=_0x8e4a('0x36');_0x3bdbfd[_0x8e4a('0x37')]=_0x36fd7b;_0x3bdbfd[_0x8e4a('0x38')]=_0x36fd7b;_0x3bdbfd[_0x8e4a('0x39')]=_0x36fd7b;};exports[_0x8e4a('0x3a')]=function(_0x310207,_0x12212b,_0x2e0223){var _0x5a6f84=moment()[_0x8e4a('0x22')](_0x8e4a('0x3b'));_0x310207[_0x8e4a('0x34')]=_0x12212b;_0x310207[_0x8e4a('0x35')]=_0x2e0223;_0x310207[_0x8e4a('0x38')]=_0x5a6f84;_0x310207[_0x8e4a('0x3c')]=getSeconds(_0x310207[_0x8e4a('0x38')],_0x310207['starttime']);};exports[_0x8e4a('0x3d')]=function(_0x3bf562,_0x576b23,_0x30754a){_0x3bf562['membername']=_0x576b23;_0x3bf562['UserId']=_0x30754a;};exports[_0x8e4a('0x3e')]=function(_0x2438ce,_0xf1c5b8,_0x428ee6){var _0x118de3=moment()[_0x8e4a('0x22')]('YYYY-MM-DD\x20HH:mm:ss');_0x2438ce[_0x8e4a('0x34')]=_0xf1c5b8;_0x2438ce[_0x8e4a('0x35')]=_0x428ee6;_0x2438ce[_0x8e4a('0x38')]=_0x2438ce[_0x8e4a('0x38')]?_0x2438ce[_0x8e4a('0x38')]:_0x118de3;_0x2438ce[_0x8e4a('0x39')]=_0x2438ce['endtime']?_0x2438ce['endtime']:_0x118de3;_0x2438ce['ringtime']=getSeconds(_0x2438ce[_0x8e4a('0x38')]||0x0,_0x2438ce[_0x8e4a('0x37')]||0x0);_0x2438ce['talktime']=_0x2438ce[_0x8e4a('0x3f')]?getSeconds(_0x2438ce[_0x8e4a('0x39')],_0x2438ce[_0x8e4a('0x3f')]):0x0;};exports[_0x8e4a('0x40')]=function(_0x4903d1){return _0x4903d1===_0x8e4a('0x41');};exports['variablesAction']=function(_0x1ef44e,_0x6094d6,_0x3239ad,_0x8736e8,_0x483c99){var _0x286f63=_0x8736e8?_0x8e4a('0x42'):_0x1ef44e[_0x8e4a('0x1a')];_0x286f63=_0x483c99?_0x8e4a('0x43'):_0x286f63;return{'actionid':_0x1ef44e[_0x8e4a('0x44')],'action':_0x8e4a('0x45'),'channel':_0x1ef44e[_0x8e4a('0x46')],'callerid':util['format'](_0x8e4a('0x13'),_0x286f63,_0x1ef44e['calleridnum']),'Exten':_0x8e4a('0x27'),'Context':'from-sip','Priority':'1','variable':_0x3239ad,'timeout':(_0x6094d6[_0x8e4a('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1ef44e[_0x8e4a('0x44')]};};exports[_0x8e4a('0x48')]=function(_0x180a77){return _0x180a77['countbusyretry']+_0x180a77[_0x8e4a('0x49')]+_0x180a77[_0x8e4a('0x4a')]+_0x180a77[_0x8e4a('0x4b')]+_0x180a77[_0x8e4a('0x4c')];};exports[_0x8e4a('0x4d')]=function(_0x4b9642){var _0x8a941d=_[_0x8e4a('0x4e')](_0x4b9642);_0x8a941d[_0x8e4a('0x34')]=0xf;_0x8a941d[_0x8e4a('0x35')]='Global';return _0x8a941d;};exports[_0x8e4a('0x4f')]=function(_0x335c9e,_0x233fb9,_0x30c653){var _0x2f9eb0={};_0x2f9eb0[_0x233fb9]=_0x335c9e[_0x233fb9];_0x2f9eb0[_0x8e4a('0x50')]=![];_0x2f9eb0[_0x8e4a('0x51')]=moment()[_0x8e4a('0x52')](_0x30c653,_0x8e4a('0x53'))[_0x8e4a('0x22')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f9eb0[_0x8e4a('0x1c')]=_0x335c9e[_0x8e4a('0x1c')];_0x2f9eb0[_0x8e4a('0x54')]=_0x335c9e['ListId'];_0x2f9eb0[_0x8e4a('0x1e')]=_0x335c9e[_0x8e4a('0x1e')]||undefined;return _0x2f9eb0;};exports[_0x8e4a('0x55')]=function(_0xa35d9a,_0x390d5d){if(!_[_0x8e4a('0x16')](_0xa35d9a)){if(_0xa35d9a[_0x8e4a('0x56')]>0x0){_0xa35d9a['pTalking']-=0x1;}else{logger[_0x8e4a('0xb')](_0x390d5d,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x390d5d,_0x8e4a('0x57'));}};exports[_0x8e4a('0x58')]=function(_0x4dbc21){if(_0x4dbc21<=0x0){return!![];}return![];};exports[_0x8e4a('0x59')]=function(_0x4897bd,_0x30259d,_0xb4f390){_0x4897bd[_0x8e4a('0x5a')]=_0x30259d;_0x4897bd['name']=_0x4897bd[_0x8e4a('0x5b')];_0x4897bd['interface']=_0x4897bd[_0x8e4a('0x46')];_0x4897bd[_0x8e4a('0x5c')]='voice';if(_0xb4f390){_0x4897bd[_0x8e4a('0x5d')]=_0xb4f390['mandatoryDisposition'];}return _0x4897bd;};exports['buildAcw']=function(_0x4fdd9c){var _0x1dc1fd={};_0x1dc1fd[_0x8e4a('0x5b')]=_0x4fdd9c[_0x8e4a('0x5b')];_0x1dc1fd[_0x8e4a('0x5e')]=_0x4fdd9c[_0x8e4a('0x46')];_0x1dc1fd[_0x8e4a('0x44')]=_0x4fdd9c[_0x8e4a('0x44')];return _0x1dc1fd;};exports['agentReadyId']=function(_0x4d9b84){var _0x4f2e3a=[];for(var _0x4982ba in _0x4d9b84){if(_0x4d9b84[_0x8e4a('0x2b')](_0x4982ba)){if(!_[_0x8e4a('0x16')](_0x4d9b84[_0x4982ba])&&_0x4d9b84[_0x4982ba][_0x8e4a('0x34')]===_0x8e4a('0x5f')&&_0x4d9b84[_0x4982ba][_0x8e4a('0x60')]===_0x8e4a('0x61')){_0x4f2e3a['push'](_0x4d9b84[_0x4982ba]['id']);}}}return _0x4f2e3a;};exports[_0x8e4a('0x62')]=function(_0x160c14){var _0xe3c960=moment()[_0x8e4a('0x7')](0x0);var _0x185e84=moment(_0x160c14)['milliseconds'](0x0);return _0xe3c960[_0x8e4a('0x8')](_0x185e84,_0x8e4a('0x9'));};exports[_0x8e4a('0x63')]=function(_0x53f127){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x53f127[_0x8e4a('0x1c')],'ListId':_0x53f127['ListId'],'VoiceQueueId':_0x53f127[_0x8e4a('0x1e')]||undefined,'CampaignId':_0x53f127[_0x8e4a('0x64')]||undefined};};exports[_0x8e4a('0x65')]=function(_0x11579d){if(_0x11579d===_0x8e4a('0x44')||_0x11579d===_0x8e4a('0x66')||_0x11579d===_0x8e4a('0x5b')||_0x11579d==='type'||_0x11579d===_0x8e4a('0x67')||_0x11579d==='dialAnswer'||_0x11579d===_0x8e4a('0x68')||_0x11579d===_0x8e4a('0x46')||_0x11579d==='calleridname'||_0x11579d===_0x8e4a('0x50')||_0x11579d==='calleridnum'||_0x11579d===_0x8e4a('0x51')||_0x11579d===_0x8e4a('0x69')||_0x11579d==='countcongestionretry'||_0x11579d===_0x8e4a('0x4a')||_0x11579d===_0x8e4a('0x6a')||_0x11579d===_0x8e4a('0x6b')||_0x11579d===_0x8e4a('0x6c')||_0x11579d===_0x8e4a('0x6d')||_0x11579d===_0x8e4a('0x6e')||_0x11579d===_0x8e4a('0x1c')||_0x11579d===_0x8e4a('0x54')||_0x11579d==='UserId'||_0x11579d===_0x8e4a('0x1e')||_0x11579d===_0x8e4a('0x6f')||_0x11579d===_0x8e4a('0x70')||_0x11579d===_0x8e4a('0x71')||_0x11579d==='xmd-phone'||_0x11579d==='xmd-listid'||_0x11579d===_0x8e4a('0x72')||_0x11579d===_0x8e4a('0x73')||_0x11579d===_0x8e4a('0x74')||_0x11579d==='xmd-dialid'||_0x11579d==='xmd-dialchannel'||_0x11579d===_0x8e4a('0x75')||_0x11579d===_0x8e4a('0x76')||_0x11579d===_0x8e4a('0x77')||_0x11579d===_0x8e4a('0x78')||_0x11579d==='xmd-agi'||_0x11579d==='rtpaudioqos'||_0x11579d==='rtpaudioqosbridged'||_0x11579d===_0x8e4a('0x79')||_0x11579d==='rtpaudioqosjitterbridged'||_0x11579d===_0x8e4a('0x7a')||_0x11579d==='rtpaudioqoslossbridged'||_0x11579d===_0x8e4a('0x7b')||_0x11579d==='rtpaudioqosrttbridged'||_0x11579d===_0x8e4a('0x7c')||_0x11579d===_0x8e4a('0x7d')||_0x11579d==='rtpaudioqosjitter'||_0x11579d===_0x8e4a('0x7e')||_0x11579d===_0x8e4a('0x7a')||_0x11579d===_0x8e4a('0x7f')||_0x11579d===_0x8e4a('0x7b')||_0x11579d===_0x8e4a('0x80')||_0x11579d===_0x8e4a('0x81')||_0x11579d===_0x8e4a('0x82')||_0x11579d===_0x8e4a('0x34')||_0x11579d===_0x8e4a('0x35')){return![];}return!![];};exports[_0x8e4a('0x83')]=function(_0x7c047,_0x24c1f4){var _0x1b859a,_0x413b9a,_0x40b357;if(_0x24c1f4<=0x0){_0x24c1f4=0x1;}_0x1b859a=new RegExp(_0x8e4a('0x84')+_0x24c1f4+'}$');_0x413b9a=Math['pow'](0xa,_0x24c1f4-0x1);_0x40b357=Math[_0x8e4a('0x85')](0xa,_0x24c1f4)-0x1;return util[_0x8e4a('0x22')]('%s',_[_0x8e4a('0x86')](_0x7c047,_0x1b859a,_[_0x8e4a('0x87')](_0x413b9a,_0x40b357)));};exports['extractCalleridName']=function(_0x45e9b7){var _0x44014b=_0x45e9b7[_0x8e4a('0x88')](/"(.*?)"/);return _0x44014b?_0x44014b[0x1]:_0x45e9b7;};exports['extractCalleridNumber']=function(_0x4eb5f3){var _0x8ac634=_0x4eb5f3[_0x8e4a('0x88')](/<(.*?)>/);return _0x8ac634?_0x8ac634[0x1]:_0x4eb5f3;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index fd0aee2..147ac83 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 _0x7aab=['string','number','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x59943d,_0x2e751b){var _0x46ace9=function(_0xfbd5f2){while(--_0xfbd5f2){_0x59943d['push'](_0x59943d['shift']());}};_0x46ace9(++_0x2e751b);}(_0x7aab,0x97));var _0xb7aa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7aab[_0x1facfa];return _0x9ec701;};'use strict';exports[_0xb7aa('0x0')]={'queue':{'type':_0xb7aa('0x1'),'required':!![]},'interface':{'type':_0xb7aa('0x1'),'required':!![]},'membername':{'type':_0xb7aa('0x1'),'required':!![]},'penalty':{'type':_0xb7aa('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xb7aa('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xb7aa('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xb7aa('0x1'),'required':![]}};exports[_0xb7aa('0x3')]={'module':{'type':_0xb7aa('0x1'),'required':![]}};exports[_0xb7aa('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xb7aa('0x5')]={'uniqueid':{'type':_0xb7aa('0x1'),'required':!![]},'filename':{'type':_0xb7aa('0x1')},'format':{'type':_0xb7aa('0x1')},'mixmonitorid':{'type':_0xb7aa('0x1')}};exports[_0xb7aa('0x6')]={'uniqueid':{'type':_0xb7aa('0x1'),'required':!![]}};exports[_0xb7aa('0x7')]={'uniqueid':{'type':_0xb7aa('0x1'),'required':!![]},'exten':{'type':_0xb7aa('0x1'),'required':!![]},'context':{'type':_0xb7aa('0x1')}}; \ No newline at end of file +var _0x7c06=['boolean','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0xa91d82,_0xcb9516){var _0x36494d=function(_0x1348db){while(--_0x1348db){_0xa91d82['push'](_0xa91d82['shift']());}};_0x36494d(++_0xcb9516);}(_0x7c06,0xde));var _0x67c0=function(_0x5a8ef0,_0x310bd4){_0x5a8ef0=_0x5a8ef0-0x0;var _0x4fc6dd=_0x7c06[_0x5a8ef0];return _0x4fc6dd;};'use strict';exports[_0x67c0('0x0')]={'queue':{'type':_0x67c0('0x1'),'required':!![]},'interface':{'type':_0x67c0('0x1'),'required':!![]},'membername':{'type':_0x67c0('0x1'),'required':!![]},'penalty':{'type':_0x67c0('0x2'),'required':![]},'paused':{'type':_0x67c0('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x67c0('0x1'),'required':!![]}};exports[_0x67c0('0x4')]={'interface':{'type':_0x67c0('0x1'),'required':!![]},'paused':{'type':_0x67c0('0x3')},'reason':{'type':_0x67c0('0x1'),'required':![]}};exports[_0x67c0('0x5')]={'module':{'type':_0x67c0('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':'string','required':!![]}};exports[_0x67c0('0x6')]={'uniqueid':{'type':_0x67c0('0x1'),'required':!![]},'filename':{'type':_0x67c0('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x67c0('0x1')}};exports[_0x67c0('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x67c0('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x67c0('0x1'),'required':!![]},'context':{'type':_0x67c0('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 622cec3..8bc0cb5 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 _0xe51a=['dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','name','interface','format','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isNil','SIP/%s','isUndefined','mergeFromDatabase','telephones','initTrunks','trunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','abandoned','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','bluebird','lodash','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','voiceQueues','triggers','campaigns','templates','voiceExtensions','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts'];(function(_0x3a9bf0,_0x574cf9){var _0x2a5439=function(_0x2be103){while(--_0x2be103){_0x3a9bf0['push'](_0x3a9bf0['shift']());}};_0x2a5439(++_0x574cf9);}(_0xe51a,0xb7));var _0xae51=function(_0x400888,_0x2997e1){_0x400888=_0x400888-0x0;var _0x583f9b=_0xe51a[_0x400888];return _0x583f9b;};'use strict';var BPromise=require(_0xae51('0x0'));var util=require('util');var _=require(_0xae51('0x1'));var moment=require(_0xae51('0x2'));var Agent=require(_0xae51('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xae51('0x4'));var Trigger=require(_0xae51('0x5'));var Template=require(_0xae51('0x6'));var Campaign=require(_0xae51('0x7'));var VoiceExtension=require(_0xae51('0x8'));var ZendeskAccount=require(_0xae51('0x9'));var SalesforceAccount=require(_0xae51('0xa'));var FreshdeskAccount=require(_0xae51('0xb'));var SugarcrmAccount=require(_0xae51('0xc'));var ZohoAccount=require(_0xae51('0xd'));var DeskAccount=require(_0xae51('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xae51('0xf'));var Dynamics365Account=require(_0xae51('0x10'));var FreshsalesAccount=require(_0xae51('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xae51('0x12')]={};this['telephones']={};this['trunks']={};this[_0xae51('0x13')]={};this[_0xae51('0x14')]={};this[_0xae51('0x15')]={};this[_0xae51('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xae51('0x17')]={};this['channels']={};this['queueChannels']={};this[_0xae51('0x18')]={};this[_0xae51('0x19')]={};this[_0xae51('0x1a')]={};this[_0xae51('0x1b')]={};this['salesforceAccounts']={};this[_0xae51('0x1c')]={};this[_0xae51('0x1d')]={};this[_0xae51('0x1e')]={};this[_0xae51('0x1f')]={};this['vtigerAccounts']={};this[_0xae51('0x20')]={};this[_0xae51('0x21')]={};this[_0xae51('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x14e6c1,_0x11fca9,_0x1aaa22){var _0x51a1ca=_[_0xae51('0x23')](_0x14e6c1,function(_0x1aa434,_0x12026d){return _0x1aa434[_0x1aaa22];});for(var _0x2f3eb3 in _0x11fca9){if(_0x11fca9[_0xae51('0x24')](_0x2f3eb3)){if(!_0x51a1ca[_0x2f3eb3]){delete _0x11fca9[_0x2f3eb3];}}}}function freeIsNotKeySip(_0x324492,_0x15fb97){var _0x5258a6=_[_0xae51('0x23')](_0x324492,function(_0xdc4e96,_0x15db63){return util['format']('SIP/%s',_0xdc4e96[_0xae51('0x25')]);});for(var _0x267f12 in _0x15fb97){if(_0x15fb97['hasOwnProperty'](_0x267f12)){if(!_0x5258a6[_0x267f12]){delete _0x15fb97[_0x267f12];}}}}function freeIsNotKeyAgent(_0x43f8fc,_0x5a27a0){var _0x4e8fe5=_[_0xae51('0x23')](_0x43f8fc,function(_0x20a764,_0x52958d){var _0x8f6695=_['isNil'](_0x20a764[_0xae51('0x26')])?util[_0xae51('0x27')]('SIP/%s',_0x20a764['name']):_0x20a764[_0xae51('0x26')];return _0x8f6695;});for(var _0x50829d in _0x5a27a0){if(_0x5a27a0[_0xae51('0x24')](_0x50829d)){if(!_0x4e8fe5[_0x50829d]){delete _0x5a27a0[_0x50829d];}}}}function clearVoiceCallReports(_0x500351){_0x500351[_0xae51('0x28')]=0x0;_0x500351[_0xae51('0x29')]=0x0;_0x500351['sumHoldTime']=0x0;_0x500351[_0xae51('0x2a')]=0x0;_0x500351[_0xae51('0x2b')]=0x0;}function clearCampaigns(_0x57f9f2){if(!_[_0xae51('0x2c')](_0x57f9f2)){for(var _0x29d632 in _0x57f9f2){if(_0x57f9f2[_0xae51('0x24')](_0x29d632)){_0x57f9f2[_0x29d632][_0xae51('0x2d')]=0x0;_0x57f9f2[_0x29d632][_0xae51('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x37f7f9){if(!_['isEmpty'](_0x37f7f9)){for(var _0x3f3932 in _0x37f7f9){if(_0x37f7f9[_0xae51('0x24')](_0x3f3932)){_0x37f7f9[_0x3f3932]['total']=0x0;_0x37f7f9[_0x3f3932]['answered']=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x2f')]=0x0;_0x37f7f9[_0x3f3932]['abandoned']=0x0;_0x37f7f9[_0x3f3932]['sumHoldTime']=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x2a')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x2b')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x30')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x31')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x32')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x33')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x34')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x35')]=0x0;_0x37f7f9[_0x3f3932]['outboundDropCallsDayTimeout']=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x36')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x37')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x38')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x39')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x3a')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x30')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x3b')]=0x0;_0x37f7f9[_0x3f3932][_0xae51('0x3c')]=!![];}}}}Realtime[_0xae51('0x3d')]['mergeFromDatabase']=function(_0x22fd13,_0x575bc3){for(var _0x5a479f in _0x575bc3){if(_0x22fd13[_0xae51('0x24')](_0x5a479f)){_0x22fd13[_0x5a479f]=_0x575bc3[_0x5a479f];}}};Realtime[_0xae51('0x3d')][_0xae51('0x3e')]=function(){var _0x5a7058=this;return function(_0x8d6b3){if(_0x8d6b3){freeIsNotKeyAgent(_0x8d6b3,_0x5a7058[_0xae51('0x12')]);for(var _0x1cbfc1=0x0,_0x6d0fa7={},_0x3657da={};_0x1cbfc1<_0x8d6b3[_0xae51('0x3f')];_0x1cbfc1+=0x1){_0x6d0fa7=_0x8d6b3[_0x1cbfc1];var _0x3bc545=_[_0xae51('0x40')](_0x6d0fa7['interface'])?util[_0xae51('0x27')](_0xae51('0x41'),_0x6d0fa7[_0xae51('0x25')]):_0x6d0fa7[_0xae51('0x26')];if(_[_0xae51('0x42')](_0x5a7058['agents'][_0x3bc545])){_0x5a7058['agents'][_0x3bc545]=new Agent(_0x6d0fa7);}else{_0x5a7058[_0xae51('0x43')](_0x5a7058[_0xae51('0x12')][_0x3bc545],_0x6d0fa7);}}}return _0x5a7058[_0xae51('0x12')];};};Realtime['prototype']['initTelephones']=function(){var _0x16b594=this;return function(_0x2c8777){if(_0x2c8777){freeIsNotKeySip(_0x2c8777,_0x16b594[_0xae51('0x44')]);for(var _0x88aa1d=0x0,_0x1838e8={},_0x1806c4={};_0x88aa1d<_0x2c8777[_0xae51('0x3f')];_0x88aa1d+=0x1){_0x1838e8=_0x2c8777[_0x88aa1d];if(_[_0xae51('0x42')](_0x16b594[_0xae51('0x44')][util[_0xae51('0x27')](_0xae51('0x41'),_0x1838e8['name'])])){_0x16b594[_0xae51('0x44')][util[_0xae51('0x27')](_0xae51('0x41'),_0x1838e8[_0xae51('0x25')])]=new Telephone(_0x1838e8);}else{_0x16b594['mergeFromDatabase'](_0x16b594[_0xae51('0x44')][util[_0xae51('0x27')](_0xae51('0x41'),_0x1838e8[_0xae51('0x25')])],_0x1838e8);}}}return _0x16b594[_0xae51('0x44')];};};Realtime[_0xae51('0x3d')][_0xae51('0x45')]=function(){var _0x5adc99=this;return function(_0x19eacb){if(_0x19eacb){freeIsNotKeySip(_0x19eacb,_0x5adc99[_0xae51('0x46')]);for(var _0x4e724e=0x0,_0x33988b={},_0x5cd433={};_0x4e724e<_0x19eacb[_0xae51('0x3f')];_0x4e724e+=0x1){_0x33988b=_0x19eacb[_0x4e724e];if(_[_0xae51('0x42')](_0x5adc99[_0xae51('0x46')][util['format'](_0xae51('0x41'),_0x33988b[_0xae51('0x25')])])){_0x5adc99[_0xae51('0x46')][util[_0xae51('0x27')](_0xae51('0x41'),_0x33988b[_0xae51('0x25')])]=new Trunk(_0x33988b);}else{_0x5adc99[_0xae51('0x43')](_0x5adc99[_0xae51('0x46')][util['format'](_0xae51('0x41'),_0x33988b[_0xae51('0x25')])],_0x33988b);}}}return _0x5adc99[_0xae51('0x46')];};};Realtime[_0xae51('0x3d')][_0xae51('0x47')]=function(){var _0x17ec29=this;return function(_0x5d89db){if(_0x5d89db){freeIsNotKey(_0x5d89db,_0x17ec29[_0xae51('0x13')],_0xae51('0x25'));for(var _0x561985=0x0,_0x4af278={},_0x1459e3={};_0x561985<_0x5d89db[_0xae51('0x3f')];_0x561985+=0x1){_0x4af278=_0x5d89db[_0x561985];if(_[_0xae51('0x42')](_0x17ec29[_0xae51('0x13')][_0x4af278[_0xae51('0x25')]])){_0x17ec29[_0xae51('0x13')][_0x4af278[_0xae51('0x25')]]=new VoiceQueue(_0x4af278);}else{_0x17ec29[_0xae51('0x43')](_0x17ec29['voiceQueues'][_0x4af278[_0xae51('0x25')]],_0x4af278);}}}return _0x17ec29[_0xae51('0x13')];};};Realtime[_0xae51('0x3d')]['initTriggers']=function(){var _0x24a6cf=this;return function(_0x1b5449){if(_0x1b5449){freeIsNotKey(_0x1b5449,_0x24a6cf[_0xae51('0x14')],'id');for(var _0x4b9ce9=0x0,_0x275a62={},_0xe37020={};_0x4b9ce9<_0x1b5449[_0xae51('0x3f')];_0x4b9ce9+=0x1){_0x275a62=_0x1b5449[_0x4b9ce9];if(_[_0xae51('0x42')](_0x24a6cf[_0xae51('0x14')][_0x275a62['id']])){_0x24a6cf['triggers'][_0x275a62['id']]=new Trigger(_0x275a62);}else{_0x24a6cf[_0xae51('0x43')](_0x24a6cf[_0xae51('0x14')][_0x275a62['id']],_0x275a62);}}}return _0x24a6cf[_0xae51('0x14')];};};Realtime[_0xae51('0x3d')][_0xae51('0x48')]=function(){var _0x2a7467=this;return function(_0x533e6b){if(_0x533e6b){freeIsNotKey(_0x533e6b,_0x2a7467[_0xae51('0x16')],'id');for(var _0x5df262=0x0,_0x295a68={},_0x3f9436={};_0x5df262<_0x533e6b[_0xae51('0x3f')];_0x5df262+=0x1){_0x295a68=_0x533e6b[_0x5df262];if(_['isUndefined'](_0x2a7467[_0xae51('0x16')][_0x295a68['id']])){_0x2a7467[_0xae51('0x16')][_0x295a68['id']]=new Template(_0x295a68);}else{_0x2a7467[_0xae51('0x43')](_0x2a7467[_0xae51('0x16')][_0x295a68['id']],_0x295a68);}}}return _0x2a7467[_0xae51('0x16')];};};Realtime['prototype'][_0xae51('0x49')]=function(){var _0x25750c=this;return function(_0x57bb1a){if(_0x57bb1a){freeIsNotKey(_0x57bb1a,_0x25750c['zendeskAccounts'],'id');for(var _0x4ecdeb=0x0,_0x167bda={},_0x554345={};_0x4ecdeb<_0x57bb1a[_0xae51('0x3f')];_0x4ecdeb+=0x1){_0x167bda=_0x57bb1a[_0x4ecdeb];if(_[_0xae51('0x42')](_0x25750c['zendeskAccounts'][_0x167bda['id']])){_0x25750c[_0xae51('0x1b')][_0x167bda['id']]=new ZendeskAccount(_0x167bda);}else{_0x25750c[_0xae51('0x43')](_0x25750c[_0xae51('0x1b')][_0x167bda['id']],_0x167bda);}}}return _0x25750c[_0xae51('0x1b')];};};Realtime[_0xae51('0x3d')][_0xae51('0x4a')]=function(){var _0x4c01f3=this;return function(_0x35663b){if(_0x35663b){freeIsNotKey(_0x35663b,_0x4c01f3[_0xae51('0x4b')],'id');for(var _0x2b07a0=0x0,_0x39b59e={},_0x1fd18a={};_0x2b07a0<_0x35663b[_0xae51('0x3f')];_0x2b07a0+=0x1){_0x39b59e=_0x35663b[_0x2b07a0];if(_[_0xae51('0x42')](_0x4c01f3[_0xae51('0x4b')][_0x39b59e['id']])){_0x4c01f3[_0xae51('0x4b')][_0x39b59e['id']]=new SalesforceAccount(_0x39b59e);}else{_0x4c01f3[_0xae51('0x43')](_0x4c01f3[_0xae51('0x4b')][_0x39b59e['id']],_0x39b59e);}}}return _0x4c01f3['salesforceAccounts'];};};Realtime[_0xae51('0x3d')][_0xae51('0x4c')]=function(){var _0x4b3f92=this;return function(_0xccf73f){if(_0xccf73f){freeIsNotKey(_0xccf73f,_0x4b3f92[_0xae51('0x1d')],'id');for(var _0xe705=0x0,_0x4a8aea={},_0x523975={};_0xe705<_0xccf73f['length'];_0xe705+=0x1){_0x4a8aea=_0xccf73f[_0xe705];if(_['isUndefined'](_0x4b3f92[_0xae51('0x1d')][_0x4a8aea['id']])){_0x4b3f92[_0xae51('0x1d')][_0x4a8aea['id']]=new FreshdeskAccount(_0x4a8aea);}else{_0x4b3f92[_0xae51('0x43')](_0x4b3f92[_0xae51('0x1d')][_0x4a8aea['id']],_0x4a8aea);}}}return _0x4b3f92[_0xae51('0x1d')];};};Realtime[_0xae51('0x3d')]['initZohoAccounts']=function(){var _0x277a09=this;return function(_0x165507){if(_0x165507){freeIsNotKey(_0x165507,_0x277a09[_0xae51('0x1e')],'id');for(var _0x46070e=0x0,_0x28c6b0={},_0xc4934d={};_0x46070e<_0x165507['length'];_0x46070e+=0x1){_0x28c6b0=_0x165507[_0x46070e];if(_[_0xae51('0x42')](_0x277a09[_0xae51('0x1e')][_0x28c6b0['id']])){_0x277a09[_0xae51('0x1e')][_0x28c6b0['id']]=new ZohoAccount(_0x28c6b0);}else{_0x277a09[_0xae51('0x43')](_0x277a09['zohoAccounts'][_0x28c6b0['id']],_0x28c6b0);}}}return _0x277a09['zohoAccounts'];};};Realtime[_0xae51('0x3d')][_0xae51('0x4d')]=function(){var _0x108b3c=this;return function(_0x1864b2){if(_0x1864b2){freeIsNotKey(_0x1864b2,_0x108b3c[_0xae51('0x1f')],'id');for(var _0x2eb2df=0x0,_0x573106={},_0x5cd235={};_0x2eb2df<_0x1864b2['length'];_0x2eb2df+=0x1){_0x573106=_0x1864b2[_0x2eb2df];if(_['isUndefined'](_0x108b3c[_0xae51('0x1f')][_0x573106['id']])){_0x108b3c['deskAccounts'][_0x573106['id']]=new DeskAccount(_0x573106);}else{_0x108b3c[_0xae51('0x43')](_0x108b3c[_0xae51('0x1f')][_0x573106['id']],_0x573106);}}}return _0x108b3c[_0xae51('0x1f')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x32846a=this;return function(_0x36cca5){if(_0x36cca5){freeIsNotKey(_0x36cca5,_0x32846a[_0xae51('0x1c')],'id');for(var _0x42532c=0x0,_0x476a3f={},_0x423cc2={};_0x42532c<_0x36cca5[_0xae51('0x3f')];_0x42532c+=0x1){_0x476a3f=_0x36cca5[_0x42532c];if(_[_0xae51('0x42')](_0x32846a[_0xae51('0x1c')][_0x476a3f['id']])){_0x32846a['sugarcrmAccounts'][_0x476a3f['id']]=new SugarcrmAccount(_0x476a3f);}else{_0x32846a[_0xae51('0x43')](_0x32846a[_0xae51('0x1c')][_0x476a3f['id']],_0x476a3f);}}}return _0x32846a[_0xae51('0x1c')];};};Realtime[_0xae51('0x3d')][_0xae51('0x4e')]=function(){var _0x15593d=this;return function(_0x2c9144){if(_0x2c9144){freeIsNotKey(_0x2c9144,_0x15593d['vtigerAccounts'],'id');for(var _0x3ef8a4=0x0,_0x2afa49={},_0xbf15c0={};_0x3ef8a4<_0x2c9144['length'];_0x3ef8a4+=0x1){_0x2afa49=_0x2c9144[_0x3ef8a4];if(_[_0xae51('0x42')](_0x15593d['vtigerAccounts'][_0x2afa49['id']])){_0x15593d['vtigerAccounts'][_0x2afa49['id']]=new VtigerAccount(_0x2afa49);}else{_0x15593d[_0xae51('0x43')](_0x15593d['vtigerAccounts'][_0x2afa49['id']],_0x2afa49);}}}return _0x15593d[_0xae51('0x4f')];};};Realtime[_0xae51('0x3d')][_0xae51('0x50')]=function(){var _0x303d6d=this;return function(_0x3ad09c){if(_0x3ad09c){freeIsNotKey(_0x3ad09c,_0x303d6d[_0xae51('0x20')],'id');for(var _0x386eed=0x0,_0x391d9c={},_0x448ca5={};_0x386eed<_0x3ad09c[_0xae51('0x3f')];_0x386eed+=0x1){_0x391d9c=_0x3ad09c[_0x386eed];if(_['isUndefined'](_0x303d6d['servicenowAccounts'][_0x391d9c['id']])){_0x303d6d[_0xae51('0x20')][_0x391d9c['id']]=new ServicenowAccount(_0x391d9c);}else{_0x303d6d[_0xae51('0x43')](_0x303d6d[_0xae51('0x20')][_0x391d9c['id']],_0x391d9c);}}}return _0x303d6d[_0xae51('0x20')];};};Realtime[_0xae51('0x3d')][_0xae51('0x51')]=function(){var _0x4b700a=this;return function(_0x2c4d4a){if(_0x2c4d4a){freeIsNotKey(_0x2c4d4a,_0x4b700a[_0xae51('0x21')],'id');for(var _0x4dd7db=0x0,_0xe72fdb={},_0x59bf17={};_0x4dd7db<_0x2c4d4a[_0xae51('0x3f')];_0x4dd7db+=0x1){_0xe72fdb=_0x2c4d4a[_0x4dd7db];if(_['isUndefined'](_0x4b700a['dynamics365Accounts'][_0xe72fdb['id']])){_0x4b700a[_0xae51('0x21')][_0xe72fdb['id']]=new Dynamics365Account(_0xe72fdb);}else{_0x4b700a[_0xae51('0x43')](_0x4b700a['dynamics365Accounts'][_0xe72fdb['id']],_0xe72fdb);}}}return _0x4b700a[_0xae51('0x21')];};};Realtime[_0xae51('0x3d')]['initFreshsalesAccounts']=function(){var _0x3e1009=this;return function(_0x350157){if(_0x350157){freeIsNotKey(_0x350157,_0x3e1009[_0xae51('0x22')],'id');for(var _0x136b1f=0x0,_0x141072={},_0x2be6b0={};_0x136b1f<_0x350157[_0xae51('0x3f')];_0x136b1f+=0x1){_0x141072=_0x350157[_0x136b1f];if(_[_0xae51('0x42')](_0x3e1009[_0xae51('0x22')][_0x141072['id']])){_0x3e1009[_0xae51('0x22')][_0x141072['id']]=new FreshsalesAccount(_0x141072);}else{_0x3e1009[_0xae51('0x43')](_0x3e1009['freshsalesAccounts'][_0x141072['id']],_0x141072);}}}return _0x3e1009[_0xae51('0x22')];};};Realtime[_0xae51('0x3d')][_0xae51('0x52')]=function(){var _0x2a1de7=this;return function(_0x448dff){for(var _0x26b089=0x0;_0x26b089<_0x448dff['length'];_0x26b089+=0x1){_[_0xae51('0x53')](_0x2a1de7['voiceQueues'][_0x448dff[_0x26b089]['name']],_0x448dff[_0x26b089]);}return _0x2a1de7[_0xae51('0x13')];};};Realtime[_0xae51('0x3d')][_0xae51('0x54')]=function(){var _0x1b14aa=this;return function(_0xedb0f7){clearVoiceQueues(_0x1b14aa[_0xae51('0x13')]);if(_0xedb0f7){_0xedb0f7=_[_0xae51('0x55')](_0xedb0f7,_0xae51('0x56'));for(var _0x5513c6 in _0xedb0f7){if(_0xedb0f7[_0xae51('0x24')](_0x5513c6)){var _0x46fc2c={};for(var _0x4e6332=0x0;_0x4e6332<_0xedb0f7[_0x5513c6][_0xae51('0x3f')];_0x4e6332+=0x1){var _0xe95cfe=_0xedb0f7[_0x5513c6][_0x4e6332]['queue'];if(_0x1b14aa[_0xae51('0x13')][_0xe95cfe]){if(_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x57')]){_0x1b14aa[_0xae51('0x13')][_0xe95cfe][_0xae51('0x2f')]+=0x1;}if(_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x58')]){_0x1b14aa[_0xae51('0x13')][_0xe95cfe][_0xae51('0x59')]+=0x1;}_0x1b14aa['voiceQueues'][_0xe95cfe][_0xae51('0x5a')]+=moment(_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x5b')])[_0xae51('0x5c')](moment(_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x5d')]),_0xae51('0x5e'))||0x0;if(_0x4e6332===_0xedb0f7[_0x5513c6][_0xae51('0x3f')]-0x1){_0x1b14aa[_0xae51('0x13')][_0xe95cfe][_0xae51('0x2a')]+=moment(_0xedb0f7[_0x5513c6][_0x4e6332]['queuecallercompleteAt']||_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x5f')]||_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x60')])[_0xae51('0x5c')](moment(_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x5d')]),'seconds')||0x0;_0x1b14aa[_0xae51('0x13')][_0xe95cfe][_0xae51('0x28')]+=0x1;if(_0xedb0f7[_0x5513c6][_0x4e6332][_0xae51('0x61')]){_0x1b14aa[_0xae51('0x13')][_0xe95cfe]['answered']+=0x1;_0x1b14aa[_0xae51('0x13')][_0xe95cfe][_0xae51('0x2b')]+=moment(_0xedb0f7[_0x5513c6][_0x4e6332]['queuecallercompleteAt'])[_0xae51('0x5c')](moment(_0xedb0f7[_0x5513c6][_0x4e6332]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x1b14aa['voiceQueues'][_0xe95cfe][_0xae51('0x2a')]+=_0x1b14aa[_0xae51('0x13')][_0xe95cfe][_0xae51('0x5a')]||0x0;}}}}}}return _0x1b14aa[_0xae51('0x13')];};};Realtime[_0xae51('0x3d')][_0xae51('0x62')]=function(){var _0x54969f=this;return function(_0x30420c){clearVoiceCallReports(_0x54969f['outbound']);if(_0x30420c){for(var _0x2500a6=0x0;_0x2500a6<_0x30420c[_0xae51('0x3f')];_0x2500a6+=0x1){_0x54969f[_0xae51('0x63')][_0xae51('0x28')]+=0x1;_0x54969f['outbound']['sumDuration']+=_0x30420c[_0x2500a6][_0xae51('0x64')];if(_0x30420c[_0x2500a6]['disposition']===_0xae51('0x65')){_0x54969f[_0xae51('0x63')][_0xae51('0x29')]+=0x1;_0x54969f['outbound'][_0xae51('0x5a')]+=_0x30420c[_0x2500a6][_0xae51('0x64')]-_0x30420c[_0x2500a6][_0xae51('0x66')]||0x0;_0x54969f[_0xae51('0x63')][_0xae51('0x2b')]+=_0x30420c[_0x2500a6]['billableseconds'];}}}return _0x54969f['outbound'];};};Realtime[_0xae51('0x3d')][_0xae51('0x67')]=function(){var _0x55b9b0=this;return function(_0x4bf4c2){if(_0x4bf4c2){freeIsNotKey(_0x4bf4c2,_0x55b9b0[_0xae51('0x15')],_0xae51('0x25'));for(var _0x35c737=0x0,_0x1a61d0={};_0x35c737<_0x4bf4c2[_0xae51('0x3f')];_0x35c737+=0x1){_0x1a61d0=_0x4bf4c2[_0x35c737];if(_['isUndefined'](_0x55b9b0['campaigns'][_0x1a61d0['name']])){_0x55b9b0['campaigns'][_0x1a61d0[_0xae51('0x25')]]=new Campaign(_0x1a61d0);}else{_0x55b9b0[_0xae51('0x43')](_0x55b9b0[_0xae51('0x15')][_0x1a61d0[_0xae51('0x25')]],_0x1a61d0);_0x55b9b0[_0xae51('0x15')][_0x1a61d0['name']]['dialQueueProject']=_0x1a61d0[_0xae51('0x68')]?_0x1a61d0[_0xae51('0x68')][_0xae51('0x25')]:undefined;}}}return _0x55b9b0['campaigns'];};};Realtime['prototype'][_0xae51('0x69')]=function(){var _0x42b627=this;return function(_0x4c5939){if(_0x4c5939){freeIsNotKey(_0x4c5939,_0x42b627[_0xae51('0x17')],'id');for(var _0x129b91=0x0,_0x41925f={};_0x129b91<_0x4c5939['length'];_0x129b91+=0x1){_0x41925f=_0x4c5939[_0x129b91];if(_[_0xae51('0x42')](_0x42b627[_0xae51('0x17')][_0x41925f['id']])){_0x42b627[_0xae51('0x17')][_0x41925f['id']]=new VoiceExtension(_0x41925f);}else{_0x42b627['mergeFromDatabase'](_0x42b627[_0xae51('0x17')][_0x41925f['id']],_0x41925f);}}}return _0x42b627['voiceExtensions'];};};Realtime[_0xae51('0x3d')][_0xae51('0x6a')]=function(){var _0x526464=this;return function(_0x118413){clearCampaigns(_0x526464[_0xae51('0x15')]);for(var _0x1e0d94=0x0;_0x1e0d94<_0x118413[_0xae51('0x3f')];_0x1e0d94+=0x1){_[_0xae51('0x53')](_0x526464[_0xae51('0x15')][_0x118413[_0x1e0d94][_0xae51('0x25')]],_0x118413[_0x1e0d94]);}return _0x526464[_0xae51('0x15')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x4321d3=this;return function(_0x371c7c){if(_0x371c7c){freeIsNotKey(_0x371c7c,_0x4321d3[_0xae51('0x6b')],'id');for(var _0x5e2086=0x0,_0x343423={},_0x3d869b={};_0x5e2086<_0x371c7c[_0xae51('0x3f')];_0x5e2086+=0x1){_0x343423=_0x371c7c[_0x5e2086];if(_[_0xae51('0x42')](_0x4321d3['faxAccounts'][_0x343423['id']])){_0x4321d3[_0xae51('0x6b')][_0x343423['id']]=new FaxAccount(_0x343423);}else{_0x4321d3[_0xae51('0x43')](_0x4321d3[_0xae51('0x6b')][_0x343423['id']],_0x343423);}}}return _0x4321d3[_0xae51('0x6b')];};};module['exports']=Realtime; \ No newline at end of file +var _0x26bd=['initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','exports','bluebird','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumDuration','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','format','isUndefined','length','initTrunks'];(function(_0x1463dd,_0xc26418){var _0x24b881=function(_0x10cb0a){while(--_0x10cb0a){_0x1463dd['push'](_0x1463dd['shift']());}};_0x24b881(++_0xc26418);}(_0x26bd,0x96));var _0xd26b=function(_0x4a0f28,_0x4cc307){_0x4a0f28=_0x4a0f28-0x0;var _0x37478b=_0x26bd[_0x4a0f28];return _0x37478b;};'use strict';var BPromise=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xd26b('0x2'));var Telephone=require(_0xd26b('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xd26b('0x4'));var Trigger=require(_0xd26b('0x5'));var Template=require(_0xd26b('0x6'));var Campaign=require(_0xd26b('0x7'));var VoiceExtension=require(_0xd26b('0x8'));var ZendeskAccount=require(_0xd26b('0x9'));var SalesforceAccount=require(_0xd26b('0xa'));var FreshdeskAccount=require(_0xd26b('0xb'));var SugarcrmAccount=require(_0xd26b('0xc'));var ZohoAccount=require(_0xd26b('0xd'));var DeskAccount=require(_0xd26b('0xe'));var VtigerAccount=require(_0xd26b('0xf'));var ServicenowAccount=require(_0xd26b('0x10'));var Dynamics365Account=require(_0xd26b('0x11'));var FreshsalesAccount=require(_0xd26b('0x12'));var FaxAccount=require(_0xd26b('0x13'));var Realtime=function(){this[_0xd26b('0x14')]={};this[_0xd26b('0x15')]={};this[_0xd26b('0x16')]={};this['voiceQueues']={};this[_0xd26b('0x17')]={};this['campaigns']={};this[_0xd26b('0x18')]={};this[_0xd26b('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd26b('0x1a')]={};this['channels']={};this[_0xd26b('0x1b')]={};this[_0xd26b('0x1c')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this[_0xd26b('0x1d')]={};this[_0xd26b('0x1e')]={};this['freshdeskAccounts']={};this[_0xd26b('0x1f')]={};this[_0xd26b('0x20')]={};this[_0xd26b('0x21')]={};this[_0xd26b('0x22')]={};this[_0xd26b('0x23')]={};this[_0xd26b('0x24')]={};this[_0xd26b('0x25')]={};};function freeIsNotKey(_0x53cff1,_0x1b0257,_0x1b669f){var _0x4fa19e=_[_0xd26b('0x26')](_0x53cff1,function(_0x47bab5,_0x1c93ad){return _0x47bab5[_0x1b669f];});for(var _0x33ebed in _0x1b0257){if(_0x1b0257['hasOwnProperty'](_0x33ebed)){if(!_0x4fa19e[_0x33ebed]){delete _0x1b0257[_0x33ebed];}}}}function freeIsNotKeySip(_0x3f54ce,_0x3b50de){var _0x308fae=_['mapKeys'](_0x3f54ce,function(_0x155bab,_0x2881ea){return util['format']('SIP/%s',_0x155bab[_0xd26b('0x27')]);});for(var _0xa8065b in _0x3b50de){if(_0x3b50de[_0xd26b('0x28')](_0xa8065b)){if(!_0x308fae[_0xa8065b]){delete _0x3b50de[_0xa8065b];}}}}function freeIsNotKeyAgent(_0xec7a5e,_0xb46c6f){var _0xb45591=_[_0xd26b('0x26')](_0xec7a5e,function(_0x39c63c,_0x32b241){var _0x30c9ef=_[_0xd26b('0x29')](_0x39c63c[_0xd26b('0x2a')])?util['format'](_0xd26b('0x2b'),_0x39c63c[_0xd26b('0x27')]):_0x39c63c[_0xd26b('0x2a')];return _0x30c9ef;});for(var _0xc86997 in _0xb46c6f){if(_0xb46c6f[_0xd26b('0x28')](_0xc86997)){if(!_0xb45591[_0xc86997]){delete _0xb46c6f[_0xc86997];}}}}function clearVoiceCallReports(_0x4af4df){_0x4af4df[_0xd26b('0x2c')]=0x0;_0x4af4df[_0xd26b('0x2d')]=0x0;_0x4af4df[_0xd26b('0x2e')]=0x0;_0x4af4df['sumDuration']=0x0;_0x4af4df[_0xd26b('0x2f')]=0x0;}function clearCampaigns(_0x4fea2d){if(!_[_0xd26b('0x30')](_0x4fea2d)){for(var _0x4f7e28 in _0x4fea2d){if(_0x4fea2d[_0xd26b('0x28')](_0x4f7e28)){_0x4fea2d[_0x4f7e28][_0xd26b('0x31')]=0x0;_0x4fea2d[_0x4f7e28][_0xd26b('0x32')]=0x0;}}}}function clearVoiceQueues(_0x32a8e4){if(!_[_0xd26b('0x30')](_0x32a8e4)){for(var _0x4fcaad in _0x32a8e4){if(_0x32a8e4[_0xd26b('0x28')](_0x4fcaad)){_0x32a8e4[_0x4fcaad][_0xd26b('0x2c')]=0x0;_0x32a8e4[_0x4fcaad]['answered']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x33')]=0x0;_0x32a8e4[_0x4fcaad]['abandoned']=0x0;_0x32a8e4[_0x4fcaad]['sumHoldTime']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x34')]=0x0;_0x32a8e4[_0x4fcaad]['sumBillable']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x35')]=0x0;_0x32a8e4[_0x4fcaad]['outboundNoAnswerCallsDay']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x36')]=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x37')]=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x38')]=0x0;_0x32a8e4[_0x4fcaad]['outboundUnknownCallsDay']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x39')]=0x0;_0x32a8e4[_0x4fcaad]['outboundDropCallsDayCallersExit']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x3a')]=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x3b')]=0x0;_0x32a8e4[_0x4fcaad]['outboundRejectCallsDay']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x3c')]=0x0;_0x32a8e4[_0x4fcaad]['outboundAnswerAgiCallsDay']=0x0;_0x32a8e4[_0x4fcaad][_0xd26b('0x3d')]=0x0;_0x32a8e4[_0x4fcaad]['queueStatusComplete']=!![];}}}}Realtime[_0xd26b('0x3e')][_0xd26b('0x3f')]=function(_0x3b757b,_0x4a7f6e){for(var _0x408b8d in _0x4a7f6e){if(_0x3b757b[_0xd26b('0x28')](_0x408b8d)){_0x3b757b[_0x408b8d]=_0x4a7f6e[_0x408b8d];}}};Realtime[_0xd26b('0x3e')]['initAgents']=function(){var _0x226ec9=this;return function(_0x2aec34){if(_0x2aec34){freeIsNotKeyAgent(_0x2aec34,_0x226ec9[_0xd26b('0x14')]);for(var _0x30e164=0x0,_0x4aebd3={},_0x2e24ff={};_0x30e164<_0x2aec34['length'];_0x30e164+=0x1){_0x4aebd3=_0x2aec34[_0x30e164];var _0x15c876=_[_0xd26b('0x29')](_0x4aebd3[_0xd26b('0x2a')])?util[_0xd26b('0x40')](_0xd26b('0x2b'),_0x4aebd3[_0xd26b('0x27')]):_0x4aebd3[_0xd26b('0x2a')];if(_[_0xd26b('0x41')](_0x226ec9[_0xd26b('0x14')][_0x15c876])){_0x226ec9[_0xd26b('0x14')][_0x15c876]=new Agent(_0x4aebd3);}else{_0x226ec9[_0xd26b('0x3f')](_0x226ec9[_0xd26b('0x14')][_0x15c876],_0x4aebd3);}}}return _0x226ec9[_0xd26b('0x14')];};};Realtime[_0xd26b('0x3e')]['initTelephones']=function(){var _0x1c0c46=this;return function(_0x261167){if(_0x261167){freeIsNotKeySip(_0x261167,_0x1c0c46['telephones']);for(var _0xb75770=0x0,_0x4a78bd={},_0x559861={};_0xb75770<_0x261167[_0xd26b('0x42')];_0xb75770+=0x1){_0x4a78bd=_0x261167[_0xb75770];if(_[_0xd26b('0x41')](_0x1c0c46[_0xd26b('0x15')][util['format']('SIP/%s',_0x4a78bd[_0xd26b('0x27')])])){_0x1c0c46[_0xd26b('0x15')][util[_0xd26b('0x40')](_0xd26b('0x2b'),_0x4a78bd[_0xd26b('0x27')])]=new Telephone(_0x4a78bd);}else{_0x1c0c46[_0xd26b('0x3f')](_0x1c0c46['telephones'][util[_0xd26b('0x40')](_0xd26b('0x2b'),_0x4a78bd['name'])],_0x4a78bd);}}}return _0x1c0c46['telephones'];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x43')]=function(){var _0x24b438=this;return function(_0x335e4d){if(_0x335e4d){freeIsNotKeySip(_0x335e4d,_0x24b438['trunks']);for(var _0x520f0c=0x0,_0x219342={},_0x8187c2={};_0x520f0c<_0x335e4d['length'];_0x520f0c+=0x1){_0x219342=_0x335e4d[_0x520f0c];if(_[_0xd26b('0x41')](_0x24b438[_0xd26b('0x16')][util[_0xd26b('0x40')]('SIP/%s',_0x219342[_0xd26b('0x27')])])){_0x24b438[_0xd26b('0x16')][util[_0xd26b('0x40')](_0xd26b('0x2b'),_0x219342['name'])]=new Trunk(_0x219342);}else{_0x24b438[_0xd26b('0x3f')](_0x24b438[_0xd26b('0x16')][util[_0xd26b('0x40')]('SIP/%s',_0x219342[_0xd26b('0x27')])],_0x219342);}}}return _0x24b438[_0xd26b('0x16')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x44')]=function(){var _0x243f81=this;return function(_0x13bdc7){if(_0x13bdc7){freeIsNotKey(_0x13bdc7,_0x243f81[_0xd26b('0x45')],'name');for(var _0x4bd802=0x0,_0x5cfebe={},_0x132d7d={};_0x4bd802<_0x13bdc7[_0xd26b('0x42')];_0x4bd802+=0x1){_0x5cfebe=_0x13bdc7[_0x4bd802];if(_[_0xd26b('0x41')](_0x243f81['voiceQueues'][_0x5cfebe[_0xd26b('0x27')]])){_0x243f81[_0xd26b('0x45')][_0x5cfebe[_0xd26b('0x27')]]=new VoiceQueue(_0x5cfebe);}else{_0x243f81[_0xd26b('0x3f')](_0x243f81[_0xd26b('0x45')][_0x5cfebe[_0xd26b('0x27')]],_0x5cfebe);}}}return _0x243f81[_0xd26b('0x45')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x46')]=function(){var _0x2e81e5=this;return function(_0x5bec26){if(_0x5bec26){freeIsNotKey(_0x5bec26,_0x2e81e5[_0xd26b('0x17')],'id');for(var _0x46e34c=0x0,_0x427cd2={},_0x167113={};_0x46e34c<_0x5bec26[_0xd26b('0x42')];_0x46e34c+=0x1){_0x427cd2=_0x5bec26[_0x46e34c];if(_[_0xd26b('0x41')](_0x2e81e5['triggers'][_0x427cd2['id']])){_0x2e81e5[_0xd26b('0x17')][_0x427cd2['id']]=new Trigger(_0x427cd2);}else{_0x2e81e5[_0xd26b('0x3f')](_0x2e81e5[_0xd26b('0x17')][_0x427cd2['id']],_0x427cd2);}}}return _0x2e81e5[_0xd26b('0x17')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x47')]=function(){var _0x72e6cc=this;return function(_0x47cc44){if(_0x47cc44){freeIsNotKey(_0x47cc44,_0x72e6cc[_0xd26b('0x18')],'id');for(var _0x3828b2=0x0,_0x1048f9={},_0x58a916={};_0x3828b2<_0x47cc44[_0xd26b('0x42')];_0x3828b2+=0x1){_0x1048f9=_0x47cc44[_0x3828b2];if(_[_0xd26b('0x41')](_0x72e6cc[_0xd26b('0x18')][_0x1048f9['id']])){_0x72e6cc[_0xd26b('0x18')][_0x1048f9['id']]=new Template(_0x1048f9);}else{_0x72e6cc[_0xd26b('0x3f')](_0x72e6cc[_0xd26b('0x18')][_0x1048f9['id']],_0x1048f9);}}}return _0x72e6cc[_0xd26b('0x18')];};};Realtime['prototype'][_0xd26b('0x48')]=function(){var _0x1fdd64=this;return function(_0x16e721){if(_0x16e721){freeIsNotKey(_0x16e721,_0x1fdd64[_0xd26b('0x49')],'id');for(var _0xcc4e48=0x0,_0x155a79={},_0x2cea74={};_0xcc4e48<_0x16e721[_0xd26b('0x42')];_0xcc4e48+=0x1){_0x155a79=_0x16e721[_0xcc4e48];if(_[_0xd26b('0x41')](_0x1fdd64[_0xd26b('0x49')][_0x155a79['id']])){_0x1fdd64[_0xd26b('0x49')][_0x155a79['id']]=new ZendeskAccount(_0x155a79);}else{_0x1fdd64['mergeFromDatabase'](_0x1fdd64['zendeskAccounts'][_0x155a79['id']],_0x155a79);}}}return _0x1fdd64[_0xd26b('0x49')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x4a')]=function(){var _0x572cf4=this;return function(_0x4e6dc8){if(_0x4e6dc8){freeIsNotKey(_0x4e6dc8,_0x572cf4['salesforceAccounts'],'id');for(var _0x48d0e4=0x0,_0xd4b704={},_0x2a4821={};_0x48d0e4<_0x4e6dc8[_0xd26b('0x42')];_0x48d0e4+=0x1){_0xd4b704=_0x4e6dc8[_0x48d0e4];if(_[_0xd26b('0x41')](_0x572cf4[_0xd26b('0x1d')][_0xd4b704['id']])){_0x572cf4[_0xd26b('0x1d')][_0xd4b704['id']]=new SalesforceAccount(_0xd4b704);}else{_0x572cf4[_0xd26b('0x3f')](_0x572cf4[_0xd26b('0x1d')][_0xd4b704['id']],_0xd4b704);}}}return _0x572cf4[_0xd26b('0x1d')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x4b')]=function(){var _0x312d1f=this;return function(_0x5b364a){if(_0x5b364a){freeIsNotKey(_0x5b364a,_0x312d1f['freshdeskAccounts'],'id');for(var _0x3fe3ff=0x0,_0x286d20={},_0x420307={};_0x3fe3ff<_0x5b364a[_0xd26b('0x42')];_0x3fe3ff+=0x1){_0x286d20=_0x5b364a[_0x3fe3ff];if(_['isUndefined'](_0x312d1f[_0xd26b('0x4c')][_0x286d20['id']])){_0x312d1f['freshdeskAccounts'][_0x286d20['id']]=new FreshdeskAccount(_0x286d20);}else{_0x312d1f[_0xd26b('0x3f')](_0x312d1f[_0xd26b('0x4c')][_0x286d20['id']],_0x286d20);}}}return _0x312d1f[_0xd26b('0x4c')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x4d')]=function(){var _0x317362=this;return function(_0x43a30c){if(_0x43a30c){freeIsNotKey(_0x43a30c,_0x317362[_0xd26b('0x1f')],'id');for(var _0x323e51=0x0,_0x30945e={},_0x59049f={};_0x323e51<_0x43a30c['length'];_0x323e51+=0x1){_0x30945e=_0x43a30c[_0x323e51];if(_[_0xd26b('0x41')](_0x317362[_0xd26b('0x1f')][_0x30945e['id']])){_0x317362[_0xd26b('0x1f')][_0x30945e['id']]=new ZohoAccount(_0x30945e);}else{_0x317362[_0xd26b('0x3f')](_0x317362['zohoAccounts'][_0x30945e['id']],_0x30945e);}}}return _0x317362['zohoAccounts'];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x4e')]=function(){var _0x4aaa4e=this;return function(_0x2af4e6){if(_0x2af4e6){freeIsNotKey(_0x2af4e6,_0x4aaa4e[_0xd26b('0x20')],'id');for(var _0x15b24a=0x0,_0x259a90={},_0x3b020d={};_0x15b24a<_0x2af4e6[_0xd26b('0x42')];_0x15b24a+=0x1){_0x259a90=_0x2af4e6[_0x15b24a];if(_['isUndefined'](_0x4aaa4e['deskAccounts'][_0x259a90['id']])){_0x4aaa4e[_0xd26b('0x20')][_0x259a90['id']]=new DeskAccount(_0x259a90);}else{_0x4aaa4e[_0xd26b('0x3f')](_0x4aaa4e[_0xd26b('0x20')][_0x259a90['id']],_0x259a90);}}}return _0x4aaa4e[_0xd26b('0x20')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x4f')]=function(){var _0x596674=this;return function(_0x462cdd){if(_0x462cdd){freeIsNotKey(_0x462cdd,_0x596674['sugarcrmAccounts'],'id');for(var _0x3a33d5=0x0,_0x4e3529={},_0x34cf27={};_0x3a33d5<_0x462cdd['length'];_0x3a33d5+=0x1){_0x4e3529=_0x462cdd[_0x3a33d5];if(_['isUndefined'](_0x596674['sugarcrmAccounts'][_0x4e3529['id']])){_0x596674[_0xd26b('0x1e')][_0x4e3529['id']]=new SugarcrmAccount(_0x4e3529);}else{_0x596674['mergeFromDatabase'](_0x596674[_0xd26b('0x1e')][_0x4e3529['id']],_0x4e3529);}}}return _0x596674['sugarcrmAccounts'];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x50')]=function(){var _0x53ec8b=this;return function(_0x94162d){if(_0x94162d){freeIsNotKey(_0x94162d,_0x53ec8b['vtigerAccounts'],'id');for(var _0x49be68=0x0,_0x2d995f={},_0x323986={};_0x49be68<_0x94162d['length'];_0x49be68+=0x1){_0x2d995f=_0x94162d[_0x49be68];if(_[_0xd26b('0x41')](_0x53ec8b[_0xd26b('0x21')][_0x2d995f['id']])){_0x53ec8b[_0xd26b('0x21')][_0x2d995f['id']]=new VtigerAccount(_0x2d995f);}else{_0x53ec8b[_0xd26b('0x3f')](_0x53ec8b['vtigerAccounts'][_0x2d995f['id']],_0x2d995f);}}}return _0x53ec8b[_0xd26b('0x21')];};};Realtime['prototype'][_0xd26b('0x51')]=function(){var _0x158f80=this;return function(_0xa23352){if(_0xa23352){freeIsNotKey(_0xa23352,_0x158f80[_0xd26b('0x22')],'id');for(var _0x528261=0x0,_0x59a57b={},_0x32d2c3={};_0x528261<_0xa23352[_0xd26b('0x42')];_0x528261+=0x1){_0x59a57b=_0xa23352[_0x528261];if(_['isUndefined'](_0x158f80[_0xd26b('0x22')][_0x59a57b['id']])){_0x158f80[_0xd26b('0x22')][_0x59a57b['id']]=new ServicenowAccount(_0x59a57b);}else{_0x158f80['mergeFromDatabase'](_0x158f80[_0xd26b('0x22')][_0x59a57b['id']],_0x59a57b);}}}return _0x158f80[_0xd26b('0x22')];};};Realtime['prototype'][_0xd26b('0x52')]=function(){var _0x1d804a=this;return function(_0x16a1e8){if(_0x16a1e8){freeIsNotKey(_0x16a1e8,_0x1d804a['dynamics365Accounts'],'id');for(var _0x35c3ae=0x0,_0x4ef68f={},_0x58bb13={};_0x35c3ae<_0x16a1e8[_0xd26b('0x42')];_0x35c3ae+=0x1){_0x4ef68f=_0x16a1e8[_0x35c3ae];if(_[_0xd26b('0x41')](_0x1d804a[_0xd26b('0x23')][_0x4ef68f['id']])){_0x1d804a[_0xd26b('0x23')][_0x4ef68f['id']]=new Dynamics365Account(_0x4ef68f);}else{_0x1d804a['mergeFromDatabase'](_0x1d804a['dynamics365Accounts'][_0x4ef68f['id']],_0x4ef68f);}}}return _0x1d804a[_0xd26b('0x23')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x53')]=function(){var _0x14a7d3=this;return function(_0x4b242b){if(_0x4b242b){freeIsNotKey(_0x4b242b,_0x14a7d3[_0xd26b('0x24')],'id');for(var _0x38691a=0x0,_0x2a03cd={},_0x1e4c6a={};_0x38691a<_0x4b242b[_0xd26b('0x42')];_0x38691a+=0x1){_0x2a03cd=_0x4b242b[_0x38691a];if(_[_0xd26b('0x41')](_0x14a7d3['freshsalesAccounts'][_0x2a03cd['id']])){_0x14a7d3['freshsalesAccounts'][_0x2a03cd['id']]=new FreshsalesAccount(_0x2a03cd);}else{_0x14a7d3[_0xd26b('0x3f')](_0x14a7d3[_0xd26b('0x24')][_0x2a03cd['id']],_0x2a03cd);}}}return _0x14a7d3['freshsalesAccounts'];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x54')]=function(){var _0x10fbe5=this;return function(_0x13c7ac){for(var _0x441c80=0x0;_0x441c80<_0x13c7ac['length'];_0x441c80+=0x1){_[_0xd26b('0x55')](_0x10fbe5[_0xd26b('0x45')][_0x13c7ac[_0x441c80]['name']],_0x13c7ac[_0x441c80]);}return _0x10fbe5[_0xd26b('0x45')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x56')]=function(){var _0x581a36=this;return function(_0xdf29ba){clearVoiceQueues(_0x581a36[_0xd26b('0x45')]);if(_0xdf29ba){_0xdf29ba=_['groupBy'](_0xdf29ba,'uniqueid');for(var _0x3381d3 in _0xdf29ba){if(_0xdf29ba[_0xd26b('0x28')](_0x3381d3)){var _0xbdd67d={};for(var _0x57108d=0x0;_0x57108d<_0xdf29ba[_0x3381d3][_0xd26b('0x42')];_0x57108d+=0x1){var _0x1ec3f7=_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x57')];if(_0x581a36[_0xd26b('0x45')][_0x1ec3f7]){if(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x58')]){_0x581a36['voiceQueues'][_0x1ec3f7]['unmanaged']+=0x1;}if(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x59')]){_0x581a36['voiceQueues'][_0x1ec3f7]['abandoned']+=0x1;}_0x581a36[_0xd26b('0x45')][_0x1ec3f7][_0xd26b('0x2e')]+=moment(_0xdf29ba[_0x3381d3][_0x57108d]['queuecallerleaveAt'])[_0xd26b('0x5a')](moment(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x5b')]),_0xd26b('0x5c'))||0x0;if(_0x57108d===_0xdf29ba[_0x3381d3][_0xd26b('0x42')]-0x1){_0x581a36[_0xd26b('0x45')][_0x1ec3f7][_0xd26b('0x34')]+=moment(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x5d')]||_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x5e')]||_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x5f')])[_0xd26b('0x5a')](moment(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x5b')]),_0xd26b('0x5c'))||0x0;_0x581a36[_0xd26b('0x45')][_0x1ec3f7][_0xd26b('0x2c')]+=0x1;if(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x60')]){_0x581a36['voiceQueues'][_0x1ec3f7][_0xd26b('0x2d')]+=0x1;_0x581a36['voiceQueues'][_0x1ec3f7][_0xd26b('0x2f')]+=moment(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x5d')])[_0xd26b('0x5a')](moment(_0xdf29ba[_0x3381d3][_0x57108d][_0xd26b('0x61')]),_0xd26b('0x5c'))||0x0;}}else{_0x581a36[_0xd26b('0x45')][_0x1ec3f7][_0xd26b('0x34')]+=_0x581a36['voiceQueues'][_0x1ec3f7][_0xd26b('0x2e')]||0x0;}}}}}}return _0x581a36[_0xd26b('0x45')];};};Realtime['prototype'][_0xd26b('0x62')]=function(){var _0x56674c=this;return function(_0x2c604a){clearVoiceCallReports(_0x56674c[_0xd26b('0x19')]);if(_0x2c604a){for(var _0x40702a=0x0;_0x40702a<_0x2c604a['length'];_0x40702a+=0x1){_0x56674c[_0xd26b('0x19')][_0xd26b('0x2c')]+=0x1;_0x56674c['outbound']['sumDuration']+=_0x2c604a[_0x40702a][_0xd26b('0x63')];if(_0x2c604a[_0x40702a][_0xd26b('0x64')]===_0xd26b('0x65')){_0x56674c[_0xd26b('0x19')][_0xd26b('0x2d')]+=0x1;_0x56674c[_0xd26b('0x19')][_0xd26b('0x2e')]+=_0x2c604a[_0x40702a][_0xd26b('0x63')]-_0x2c604a[_0x40702a][_0xd26b('0x66')]||0x0;_0x56674c[_0xd26b('0x19')][_0xd26b('0x2f')]+=_0x2c604a[_0x40702a][_0xd26b('0x66')];}}}return _0x56674c[_0xd26b('0x19')];};};Realtime['prototype'][_0xd26b('0x67')]=function(){var _0x36208d=this;return function(_0x2f7da7){if(_0x2f7da7){freeIsNotKey(_0x2f7da7,_0x36208d['campaigns'],_0xd26b('0x27'));for(var _0x125822=0x0,_0xf11b48={};_0x125822<_0x2f7da7[_0xd26b('0x42')];_0x125822+=0x1){_0xf11b48=_0x2f7da7[_0x125822];if(_['isUndefined'](_0x36208d[_0xd26b('0x68')][_0xf11b48['name']])){_0x36208d[_0xd26b('0x68')][_0xf11b48[_0xd26b('0x27')]]=new Campaign(_0xf11b48);}else{_0x36208d[_0xd26b('0x3f')](_0x36208d[_0xd26b('0x68')][_0xf11b48[_0xd26b('0x27')]],_0xf11b48);_0x36208d[_0xd26b('0x68')][_0xf11b48[_0xd26b('0x27')]][_0xd26b('0x69')]=_0xf11b48['SquareProject']?_0xf11b48[_0xd26b('0x6a')][_0xd26b('0x27')]:undefined;}}}return _0x36208d[_0xd26b('0x68')];};};Realtime[_0xd26b('0x3e')][_0xd26b('0x6b')]=function(){var _0x468d55=this;return function(_0x1decc4){if(_0x1decc4){freeIsNotKey(_0x1decc4,_0x468d55[_0xd26b('0x1a')],'id');for(var _0x47e5c5=0x0,_0xe2ca63={};_0x47e5c5<_0x1decc4[_0xd26b('0x42')];_0x47e5c5+=0x1){_0xe2ca63=_0x1decc4[_0x47e5c5];if(_[_0xd26b('0x41')](_0x468d55[_0xd26b('0x1a')][_0xe2ca63['id']])){_0x468d55[_0xd26b('0x1a')][_0xe2ca63['id']]=new VoiceExtension(_0xe2ca63);}else{_0x468d55[_0xd26b('0x3f')](_0x468d55[_0xd26b('0x1a')][_0xe2ca63['id']],_0xe2ca63);}}}return _0x468d55[_0xd26b('0x1a')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0xea7d33=this;return function(_0x4150cd){clearCampaigns(_0xea7d33[_0xd26b('0x68')]);for(var _0x34a418=0x0;_0x34a418<_0x4150cd[_0xd26b('0x42')];_0x34a418+=0x1){_['merge'](_0xea7d33[_0xd26b('0x68')][_0x4150cd[_0x34a418][_0xd26b('0x27')]],_0x4150cd[_0x34a418]);}return _0xea7d33[_0xd26b('0x68')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x2788ae=this;return function(_0x546af8){if(_0x546af8){freeIsNotKey(_0x546af8,_0x2788ae[_0xd26b('0x25')],'id');for(var _0xb65320=0x0,_0x1d8538={},_0x41db82={};_0xb65320<_0x546af8['length'];_0xb65320+=0x1){_0x1d8538=_0x546af8[_0xb65320];if(_['isUndefined'](_0x2788ae[_0xd26b('0x25')][_0x1d8538['id']])){_0x2788ae[_0xd26b('0x25')][_0x1d8538['id']]=new FaxAccount(_0x1d8538);}else{_0x2788ae[_0xd26b('0x3f')](_0x2788ae[_0xd26b('0x25')][_0x1d8538['id']],_0x1d8538);}}}return _0x2788ae[_0xd26b('0x25')];};};module[_0xd26b('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b2e99ee..3d547e7 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 _0xbc0d=['calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','isNil','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','bind','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','accountcode','name','SIP/%s','length','connectedlinenum','assigned','interface','queuecallercomplete','queuecallercompleteAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview'];(function(_0x5cca9f,_0x154684){var _0x55edda=function(_0x115aa2){while(--_0x115aa2){_0x5cca9f['push'](_0x5cca9f['shift']());}};_0x55edda(++_0x154684);}(_0xbc0d,0x129));var _0xdbc0=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xbc0d[_0xe30e17];return _0x2342c9;};'use strict';var _=require('lodash');var moment=require(_0xdbc0('0x0'));var util=require(_0xdbc0('0x1'));var config=require(_0xdbc0('0x2'));var ami=require(_0xdbc0('0x3'));var RpcVoiceAgentReport=require(_0xdbc0('0x4'));var RpcVoiceCallReport=require(_0xdbc0('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xdbc0('0x6'));var RpcVoiceQueueReport=require(_0xdbc0('0x7'));var RpcVoiceRecording=require(_0xdbc0('0x8'));var RpcVoiceTransferReport=require(_0xdbc0('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xdbc0('0xa'));var VoiceAgentReport=require(_0xdbc0('0xb'));var VoiceDialReport=require(_0xdbc0('0xc'));var UserReport=require(_0xdbc0('0xd'));function Report(_0x2144b6){this[_0xdbc0('0xe')]=_0x2144b6;this[_0xdbc0('0xf')]=_0x2144b6['agents'];this[_0xdbc0('0x10')]=_0x2144b6[_0xdbc0('0x10')];}Report['prototype'][_0xdbc0('0x11')]=function(_0x1cde69){var _0x3ad7f3=new VoiceQueueReport(this[_0xdbc0('0xe')]);var _0x4e124f=new VoiceAgentReport(this[_0xdbc0('0xe')]);var _0x1855ba=new VoiceDialReport(this[_0xdbc0('0xe')]);var _0x10bf19=new VoiceCallReport(this[_0xdbc0('0xe')]);var _0x11c690=new UserReport(this[_0xdbc0('0xe')]);if(config[_0xdbc0('0x12')]&&config[_0xdbc0('0x12')][_0xdbc0('0x13')]){ami['on'](_0xdbc0('0x14'),this[_0xdbc0('0x15')]['bind'](this));ami['on'](_0xdbc0('0x16'),this['voiceCallReport'][_0xdbc0('0x17')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0xdbc0('0x17')](this));ami['on'](_0xdbc0('0x18'),this['voiceDialReport']['bind'](this));ami['on'](_0xdbc0('0x19'),this['blindTransfer'][_0xdbc0('0x17')](this));ami['on'](_0xdbc0('0x1a'),this[_0xdbc0('0x1b')]['bind'](this));}};Report[_0xdbc0('0x1c')][_0xdbc0('0x1d')]=function(_0x5aea1d){var _0x773a67;_0x773a67=_[_0xdbc0('0x1e')](this[_0xdbc0('0xf')],function(_0x369e9e){return _0x369e9e[_0xdbc0('0x1f')]==_0x5aea1d||_0x369e9e[_0xdbc0('0x20')]==_0x5aea1d;});if(_['isNil'](_0x773a67)){var _0x3e8465=_[_0xdbc0('0x1e')](this['telephones'],function(_0x5c4342){return _0x5c4342[_0xdbc0('0x1f')]==_0x5aea1d||_0x5c4342['name']==_0x5aea1d;});if(_0x3e8465){_0x773a67=_[_0xdbc0('0x1e')](this[_0xdbc0('0xf')],function(_0xb416a6){return _0xb416a6['interface']==util['format'](_0xdbc0('0x21'),_0x3e8465[_0xdbc0('0x20')]);});}}return _0x773a67;};Report[_0xdbc0('0x1c')]['voiceQueueReport']=function(_0x1c245d){for(var _0x1af678=0x0;_0x1af678<_0x1c245d[_0xdbc0('0x22')];_0x1af678+=0x1){var _0x280ed7=this[_0xdbc0('0x1d')](_0x1c245d[_0x1af678][_0xdbc0('0x23')]);if(_0x280ed7){_0x1c245d[_0x1af678][_0xdbc0('0x1f')]=_0x280ed7[_0xdbc0('0x1f')];_0x1c245d[_0x1af678][_0xdbc0('0x24')]=!![];_0x1c245d[_0x1af678]['lastAssignedTo']=_0x280ed7[_0xdbc0('0x20')];_0x1c245d[_0x1af678][_0xdbc0('0x25')]=_['isNil'](_0x280ed7[_0xdbc0('0x25')])?util['format'](_0xdbc0('0x21'),_0x280ed7[_0xdbc0('0x20')]):_0x280ed7['interface'];if(_0x1c245d[_0x1af678][_0xdbc0('0x26')]){_0x1c245d[_0x1af678][_0xdbc0('0x27')]=moment()[_0xdbc0('0x28')](_0xdbc0('0x29'));}if(_0x1c245d[_0x1af678][_0xdbc0('0x2a')]){_0x1c245d[_0x1af678][_0xdbc0('0x2b')]=moment()[_0xdbc0('0x28')](_0xdbc0('0x29'));}RpcMemberReport['voiceQueueReport'](_0x1c245d[_0x1af678]);}RpcVoiceQueueReport[_0xdbc0('0x2c')](_0x1c245d[_0x1af678]);}};function extractCalleridNumber(_0x3ca53e){var _0x5c0dca=_0x3ca53e[_0xdbc0('0x2d')](/<(.*?)>/);return _0x5c0dca?_0x5c0dca[0x1]:_0x3ca53e;}Report[_0xdbc0('0x1c')]['voiceCallReport']=function(_0x2a9f18){_0x2a9f18['destination']=_0x2a9f18[_0xdbc0('0x2e')]||_0x2a9f18[_0xdbc0('0x2f')];if(_0x2a9f18['type']=='dialer'){_0x2a9f18['lastapplication']=_0xdbc0('0x30');_0x2a9f18[_0xdbc0('0x31')]=_0x2a9f18['queue'];if(_0x2a9f18[_0xdbc0('0x32')]==_0xdbc0('0x33')){_0x2a9f18['accountcode']='';_0x2a9f18['destination']=extractCalleridNumber(_0x2a9f18[_0xdbc0('0x34')]);}else if(_0x2a9f18[_0xdbc0('0x32')]==_0xdbc0('0x35')){if(_0x2a9f18[_0xdbc0('0x2e')]==_0xdbc0('0x36')){_0x2a9f18[_0xdbc0('0x2e')]=extractCalleridNumber(_0x2a9f18[_0xdbc0('0x37')]);_0x2a9f18[_0xdbc0('0x38')]=_0x2a9f18[_0xdbc0('0x39')];_0x2a9f18[_0xdbc0('0x3a')]=[_0x2a9f18[_0xdbc0('0x3b')],_0x2a9f18['channel']=_0x2a9f18[_0xdbc0('0x3a')]][0x0];_0x2a9f18[_0xdbc0('0x34')]=_0x2a9f18[_0xdbc0('0x37')];}else{_0x2a9f18[_0xdbc0('0x2e')]=_0x2a9f18[_0xdbc0('0x38')];_0x2a9f18[_0xdbc0('0x38')]=_0x2a9f18['originatecalleridnum'];if(_0x2a9f18[_0xdbc0('0x3c')]==_0xdbc0('0x3d')){_0x2a9f18['accountcode']=_0x2a9f18[_0xdbc0('0x23')];}else{_0x2a9f18['accountcode']='';}}}}else{_0x2a9f18[_0xdbc0('0x34')]=util[_0xdbc0('0x28')](_0xdbc0('0x3e'),_0x2a9f18['calleridname'],_0x2a9f18[_0xdbc0('0x38')]);}if(RpcVoiceTransferReport[_0xdbc0('0x3f')][_0x2a9f18[_0xdbc0('0x40')]]){var _0x6230dd=RpcVoiceTransferReport['transfers'][_0x2a9f18[_0xdbc0('0x40')]];_0x6230dd[_0xdbc0('0x41')]=_0x2a9f18[_0xdbc0('0x42')];RpcVoiceTransferReport[_0xdbc0('0x43')](_0x6230dd);delete RpcVoiceTransferReport[_0xdbc0('0x3f')][_0x2a9f18[_0xdbc0('0x40')]];}RpcVoiceCallReport[_0xdbc0('0x2c')](_0x2a9f18);if(_0x2a9f18[_0xdbc0('0x44')]){for(var _0x57d7f1=0x0;_0x57d7f1<_0x2a9f18[_0xdbc0('0x45')][_0xdbc0('0x22')];_0x57d7f1+=0x1){_0x2a9f18[_0xdbc0('0x46')]=_0x2a9f18[_0xdbc0('0x45')][_0x57d7f1][_0xdbc0('0x47')];_0x2a9f18['createdAt']=_0x2a9f18[_0xdbc0('0x45')][_0x57d7f1][_0xdbc0('0x48')];if(_0x2a9f18['exten']==_0xdbc0('0x36')){_0x2a9f18[_0xdbc0('0x38')]=_0x2a9f18['connectedlinenum'];_0x2a9f18['calleridname']=_0x2a9f18['connectedlinename'];_0x2a9f18[_0xdbc0('0x23')]=_0x2a9f18[_0xdbc0('0x1f')];_0x2a9f18[_0xdbc0('0x49')]=_0x2a9f18[_0xdbc0('0x4a')];_0x2a9f18[_0xdbc0('0x2f')]=_0x2a9f18['originatecalleridnum'];}else if(_0x2a9f18[_0xdbc0('0x2f')]==_0xdbc0('0x4b')){_0x2a9f18[_0xdbc0('0x38')]=_0x2a9f18[_0xdbc0('0x2e')];_0x2a9f18['exten']=_0x2a9f18['originatecalleridnum'];}RpcVoiceRecording[_0xdbc0('0x2c')](_0x2a9f18);}}};Report[_0xdbc0('0x1c')][_0xdbc0('0x4c')]=function(_0x443a1e){if(_[_0xdbc0('0x4d')](_0x443a1e)){_0x443a1e['forEach'](function(_0x1da93f){RpcVoiceAgentReport['create'](_0x1da93f);});}else{RpcVoiceAgentReport['create'](_0x443a1e);}};Report['prototype'][_0xdbc0('0x4e')]=function(_0x2a6860){RpcVoiceDialReport[_0xdbc0('0x2c')](_0x2a6860);var _0x28c4f5;var _0x696dd8;var _0x46f5ee=_0x2a6860['channel'];if(_[_0xdbc0('0x4f')](_0x46f5ee,_0xdbc0('0x50'))){_0x696dd8=_0x46f5ee[_0xdbc0('0x51')](_0x46f5ee[_0xdbc0('0x52')]('/')+0x1,_0x46f5ee[_0xdbc0('0x52')]('@'));_0x28c4f5=_[_0xdbc0('0x1e')](this['agents'],function(_0x5a499d){return _0x5a499d[_0xdbc0('0x53')]==_0x696dd8||_0x5a499d[_0xdbc0('0x54')]==_0x696dd8||_0x5a499d['accountcode']==_0x696dd8;});}else{_0x696dd8=_0x46f5ee[_0xdbc0('0x51')](_0x46f5ee[_0xdbc0('0x52')]('/')+0x1,_0x46f5ee['lastIndexOf']('-'));_0x28c4f5=this[_0xdbc0('0x1d')](_0x696dd8);}if(_0x28c4f5){_0x2a6860['interface']=_[_0xdbc0('0x55')](_0x28c4f5[_0xdbc0('0x25')])?util[_0xdbc0('0x28')]('SIP/%s',_0x28c4f5[_0xdbc0('0x20')]):_0x28c4f5[_0xdbc0('0x25')];_0x2a6860['membername']=_0x28c4f5[_0xdbc0('0x20')];_0x2a6860[_0xdbc0('0x1f')]=_0x28c4f5['accountcode'];RpcMemberReport['voiceDialReport'](_0x2a6860);}};Report[_0xdbc0('0x1c')][_0xdbc0('0x43')]=function(_0x1f3eb6){RpcVoiceTransferReport[_0xdbc0('0x3f')][_0x1f3eb6[_0xdbc0('0x56')]]=_0x1f3eb6;};Report[_0xdbc0('0x1c')]['attendedTransfer']=function(_0x4129d2){RpcVoiceTransferReport[_0xdbc0('0x1b')](_0x4129d2);};module[_0xdbc0('0x57')]=Report; \ No newline at end of file +var _0x4a1e=['voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','destination','exten','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport'];(function(_0x5395d6,_0x2a8b13){var _0x369bd8=function(_0x188163){while(--_0x188163){_0x5395d6['push'](_0x5395d6['shift']());}};_0x369bd8(++_0x2a8b13);}(_0x4a1e,0x1c9));var _0xe4a1=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0x4a1e[_0x481af3];return _0x3354ea;};'use strict';var _=require('lodash');var moment=require(_0xe4a1('0x0'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0xe4a1('0x1'));var RpcVoiceAgentReport=require(_0xe4a1('0x2'));var RpcVoiceCallReport=require(_0xe4a1('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xe4a1('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xe4a1('0x5'));var VoiceQueueReport=require(_0xe4a1('0x6'));var VoiceCallReport=require(_0xe4a1('0x7'));var VoiceAgentReport=require(_0xe4a1('0x8'));var VoiceDialReport=require(_0xe4a1('0x9'));var UserReport=require(_0xe4a1('0xa'));function Report(_0x421ff9){this['realtime']=_0x421ff9;this[_0xe4a1('0xb')]=_0x421ff9[_0xe4a1('0xb')];this['telephones']=_0x421ff9[_0xe4a1('0xc')];}Report[_0xe4a1('0xd')][_0xe4a1('0xe')]=function(_0x30e15a){var _0x2011eb=new VoiceQueueReport(this[_0xe4a1('0xf')]);var _0x1b3826=new VoiceAgentReport(this['realtime']);var _0x4627ea=new VoiceDialReport(this[_0xe4a1('0xf')]);var _0x49c677=new VoiceCallReport(this[_0xe4a1('0xf')]);var _0x1dcffa=new UserReport(this[_0xe4a1('0xf')]);if(config[_0xe4a1('0x10')]&&config[_0xe4a1('0x10')][_0xe4a1('0x11')]){ami['on'](_0xe4a1('0x12'),this['voiceQueueReport'][_0xe4a1('0x13')](this));ami['on'](_0xe4a1('0x14'),this[_0xe4a1('0x15')]['bind'](this));ami['on'](_0xe4a1('0x16'),this[_0xe4a1('0x17')][_0xe4a1('0x13')](this));ami['on'](_0xe4a1('0x18'),this[_0xe4a1('0x19')][_0xe4a1('0x13')](this));ami['on'](_0xe4a1('0x1a'),this[_0xe4a1('0x1b')]['bind'](this));ami['on'](_0xe4a1('0x1c'),this[_0xe4a1('0x1d')][_0xe4a1('0x13')](this));}};Report[_0xe4a1('0xd')][_0xe4a1('0x1e')]=function(_0x578262){var _0x48e252;_0x48e252=_[_0xe4a1('0x1f')](this[_0xe4a1('0xb')],function(_0xaa9ed9){return _0xaa9ed9[_0xe4a1('0x20')]==_0x578262||_0xaa9ed9[_0xe4a1('0x21')]==_0x578262;});if(_[_0xe4a1('0x22')](_0x48e252)){var _0x21ff07=_['find'](this[_0xe4a1('0xc')],function(_0x1ddd85){return _0x1ddd85[_0xe4a1('0x20')]==_0x578262||_0x1ddd85[_0xe4a1('0x21')]==_0x578262;});if(_0x21ff07){_0x48e252=_[_0xe4a1('0x1f')](this[_0xe4a1('0xb')],function(_0x4c7c2f){return _0x4c7c2f[_0xe4a1('0x23')]==util['format'](_0xe4a1('0x24'),_0x21ff07[_0xe4a1('0x21')]);});}}return _0x48e252;};Report[_0xe4a1('0xd')][_0xe4a1('0x25')]=function(_0xa3bb95){for(var _0x11e0b4=0x0;_0x11e0b4<_0xa3bb95[_0xe4a1('0x26')];_0x11e0b4+=0x1){var _0x1e60ef=this['findAgent'](_0xa3bb95[_0x11e0b4][_0xe4a1('0x27')]);if(_0x1e60ef){_0xa3bb95[_0x11e0b4][_0xe4a1('0x20')]=_0x1e60ef[_0xe4a1('0x20')];_0xa3bb95[_0x11e0b4][_0xe4a1('0x28')]=!![];_0xa3bb95[_0x11e0b4]['lastAssignedTo']=_0x1e60ef[_0xe4a1('0x21')];_0xa3bb95[_0x11e0b4]['interface']=_[_0xe4a1('0x22')](_0x1e60ef[_0xe4a1('0x23')])?util[_0xe4a1('0x29')](_0xe4a1('0x24'),_0x1e60ef[_0xe4a1('0x21')]):_0x1e60ef[_0xe4a1('0x23')];if(_0xa3bb95[_0x11e0b4]['queuecallercomplete']){_0xa3bb95[_0x11e0b4][_0xe4a1('0x2a')]=moment()[_0xe4a1('0x29')](_0xe4a1('0x2b'));}if(_0xa3bb95[_0x11e0b4][_0xe4a1('0x2c')]){_0xa3bb95[_0x11e0b4][_0xe4a1('0x2d')]=moment()[_0xe4a1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xe4a1('0x25')](_0xa3bb95[_0x11e0b4]);}RpcVoiceQueueReport['create'](_0xa3bb95[_0x11e0b4]);}};function extractCalleridNumber(_0x15049f){var _0x5dd3cc=_0x15049f['match'](/<(.*?)>/);return _0x5dd3cc?_0x5dd3cc[0x1]:_0x15049f;}Report[_0xe4a1('0xd')][_0xe4a1('0x15')]=function(_0x1dc6d8){_0x1dc6d8[_0xe4a1('0x2e')]=_0x1dc6d8[_0xe4a1('0x2e')]||_0x1dc6d8[_0xe4a1('0x2f')];if(_0x1dc6d8['type']=='dialer'){_0x1dc6d8[_0xe4a1('0x30')]=_0xe4a1('0x31');_0x1dc6d8[_0xe4a1('0x32')]=_0x1dc6d8[_0xe4a1('0x31')];if(_0x1dc6d8[_0xe4a1('0x33')]=='from-voip-provider'){_0x1dc6d8[_0xe4a1('0x20')]='';_0x1dc6d8[_0xe4a1('0x2e')]=extractCalleridNumber(_0x1dc6d8[_0xe4a1('0x34')]);}else if(_0x1dc6d8[_0xe4a1('0x33')]==_0xe4a1('0x35')){if(_0x1dc6d8[_0xe4a1('0x2e')]==_0xe4a1('0x36')){_0x1dc6d8['destination']=extractCalleridNumber(_0x1dc6d8[_0xe4a1('0x37')]);_0x1dc6d8[_0xe4a1('0x38')]=_0x1dc6d8[_0xe4a1('0x39')];_0x1dc6d8[_0xe4a1('0x3a')]=[_0x1dc6d8[_0xe4a1('0x3b')],_0x1dc6d8[_0xe4a1('0x3b')]=_0x1dc6d8[_0xe4a1('0x3a')]][0x0];_0x1dc6d8[_0xe4a1('0x34')]=_0x1dc6d8[_0xe4a1('0x37')];}else{_0x1dc6d8[_0xe4a1('0x2e')]=_0x1dc6d8[_0xe4a1('0x38')];_0x1dc6d8['calleridnum']=_0x1dc6d8[_0xe4a1('0x39')];if(_0x1dc6d8['disposition']=='ANSWERED'){_0x1dc6d8['accountcode']=_0x1dc6d8['connectedlinenum'];}else{_0x1dc6d8[_0xe4a1('0x20')]='';}}}}else{_0x1dc6d8[_0xe4a1('0x34')]=util[_0xe4a1('0x29')](_0xe4a1('0x3c'),_0x1dc6d8[_0xe4a1('0x3d')],_0x1dc6d8[_0xe4a1('0x38')]);}if(RpcVoiceTransferReport[_0xe4a1('0x3e')][_0x1dc6d8[_0xe4a1('0x3f')]]){var _0x2504f4=RpcVoiceTransferReport[_0xe4a1('0x3e')][_0x1dc6d8[_0xe4a1('0x3f')]];_0x2504f4['transfereelinkedid']=_0x1dc6d8['uniqueid'];RpcVoiceTransferReport[_0xe4a1('0x1b')](_0x2504f4);delete RpcVoiceTransferReport[_0xe4a1('0x3e')][_0x1dc6d8[_0xe4a1('0x3f')]];}RpcVoiceCallReport[_0xe4a1('0x40')](_0x1dc6d8);if(_0x1dc6d8[_0xe4a1('0x41')]){for(var _0x49117a=0x0;_0x49117a<_0x1dc6d8[_0xe4a1('0x42')][_0xe4a1('0x26')];_0x49117a+=0x1){_0x1dc6d8[_0xe4a1('0x43')]=_0x1dc6d8['monitors'][_0x49117a][_0xe4a1('0x44')];_0x1dc6d8[_0xe4a1('0x45')]=_0x1dc6d8[_0xe4a1('0x42')][_0x49117a]['createdAt'];if(_0x1dc6d8[_0xe4a1('0x2f')]==_0xe4a1('0x36')){_0x1dc6d8[_0xe4a1('0x38')]=_0x1dc6d8[_0xe4a1('0x27')];_0x1dc6d8['calleridname']=_0x1dc6d8[_0xe4a1('0x46')];_0x1dc6d8[_0xe4a1('0x27')]=_0x1dc6d8[_0xe4a1('0x20')];_0x1dc6d8[_0xe4a1('0x46')]=_0x1dc6d8['membername'];_0x1dc6d8[_0xe4a1('0x2f')]=_0x1dc6d8[_0xe4a1('0x39')];}else if(_0x1dc6d8[_0xe4a1('0x2f')]=='xcally-motion-dialer'){_0x1dc6d8[_0xe4a1('0x38')]=_0x1dc6d8['destination'];_0x1dc6d8[_0xe4a1('0x2f')]=_0x1dc6d8[_0xe4a1('0x39')];}RpcVoiceRecording[_0xe4a1('0x40')](_0x1dc6d8);}}};Report[_0xe4a1('0xd')][_0xe4a1('0x17')]=function(_0x438416){if(_[_0xe4a1('0x47')](_0x438416)){_0x438416[_0xe4a1('0x48')](function(_0x37e5fb){RpcVoiceAgentReport[_0xe4a1('0x40')](_0x37e5fb);});}else{RpcVoiceAgentReport[_0xe4a1('0x40')](_0x438416);}};Report['prototype'][_0xe4a1('0x19')]=function(_0xf58b9f){RpcVoiceDialReport[_0xe4a1('0x40')](_0xf58b9f);var _0x3095b4;var _0x48932b;var _0x28ba0e=_0xf58b9f[_0xe4a1('0x3b')];if(_[_0xe4a1('0x49')](_0x28ba0e,'Local')){_0x48932b=_0x28ba0e[_0xe4a1('0x4a')](_0x28ba0e[_0xe4a1('0x4b')]('/')+0x1,_0x28ba0e[_0xe4a1('0x4b')]('@'));_0x3095b4=_[_0xe4a1('0x1f')](this[_0xe4a1('0xb')],function(_0x5592c0){return _0x5592c0[_0xe4a1('0x4c')]==_0x48932b||_0x5592c0['phone']==_0x48932b||_0x5592c0[_0xe4a1('0x20')]==_0x48932b;});}else{_0x48932b=_0x28ba0e[_0xe4a1('0x4a')](_0x28ba0e[_0xe4a1('0x4b')]('/')+0x1,_0x28ba0e[_0xe4a1('0x4d')]('-'));_0x3095b4=this[_0xe4a1('0x1e')](_0x48932b);}if(_0x3095b4){_0xf58b9f['interface']=_[_0xe4a1('0x22')](_0x3095b4[_0xe4a1('0x23')])?util[_0xe4a1('0x29')](_0xe4a1('0x24'),_0x3095b4[_0xe4a1('0x21')]):_0x3095b4['interface'];_0xf58b9f['membername']=_0x3095b4[_0xe4a1('0x21')];_0xf58b9f[_0xe4a1('0x20')]=_0x3095b4[_0xe4a1('0x20')];RpcMemberReport['voiceDialReport'](_0xf58b9f);}};Report['prototype'][_0xe4a1('0x1b')]=function(_0x2ce407){RpcVoiceTransferReport[_0xe4a1('0x3e')][_0x2ce407[_0xe4a1('0x4e')]]=_0x2ce407;};Report[_0xe4a1('0xd')][_0xe4a1('0x1d')]=function(_0x8723ba){RpcVoiceTransferReport[_0xe4a1('0x1d')](_0x8723ba);};module[_0xe4a1('0x4f')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 76a33e9..09872e0 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 _0x726e=['lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','error','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','actionid','debug','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports'];(function(_0xd580e2,_0x109182){var _0x4d955f=function(_0x568fff){while(--_0x568fff){_0xd580e2['push'](_0xd580e2['shift']());}};_0x4d955f(++_0x109182);}(_0x726e,0x186));var _0xe726=function(_0x58b010,_0x248b7b){_0x58b010=_0x58b010-0x0;var _0x2ecd77=_0x726e[_0x58b010];return _0x2ecd77;};'use strict';var _=require(_0xe726('0x0'));var moment=require('moment');var util=require(_0xe726('0x1'));var Redis=require(_0xe726('0x2'));var BPromise=require(_0xe726('0x3'));var config=require(_0xe726('0x4'));var logger=require(_0xe726('0x5'))('ami');var ami=require('../ami');config[_0xe726('0x6')]=_[_0xe726('0x7')](config['redis'],{'host':_0xe726('0x8'),'port':0x18eb});var io=require(_0xe726('0x9'))(new Redis(config[_0xe726('0x6')]));function UserReport(_0x2c6640){this[_0xe726('0xa')]=_0x2c6640['trunks'];this[_0xe726('0xb')]=_0x2c6640[_0xe726('0xb')];this[_0xe726('0xc')]=_0x2c6640[_0xe726('0xc')];ami['on'](_0xe726('0xd'),this[_0xe726('0xe')]['bind'](this));ami['on']('registry',this['syncRegistry'][_0xe726('0xf')](this));ami['on'](_0xe726('0x10'),this[_0xe726('0x11')][_0xe726('0xf')](this));ami['on'](_0xe726('0x12'),this[_0xe726('0x13')][_0xe726('0xf')](this));return this[_0xe726('0x14')]();}function showSipRegistrations(){Promise['resolve']()[_0xe726('0x15')](ami[_0xe726('0x16')]())[_0xe726('0x17')](function(_0x1bfcce){logger['error'](_0xe726('0x18'),util[_0xe726('0x19')](_0x1bfcce,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe726('0x1a')]()[_0xe726('0x15')](ami[_0xe726('0x1b')]())[_0xe726('0x17')](function(_0x39af50){logger['error'](_0xe726('0x1c'),util[_0xe726('0x19')](_0x39af50,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe726('0x1a')]()[_0xe726('0x15')](ami[_0xe726('0x1d')]())['catch'](function(_0x255d47){logger[_0xe726('0x1e')](_0xe726('0x1f'),util[_0xe726('0x19')](_0x255d47,{'showHidden':![],'depth':null}));});}UserReport[_0xe726('0x20')][_0xe726('0x14')]=function(){setInterval(function(){BPromise['resolve']()[_0xe726('0x15')](showSipRegistrations())[_0xe726('0x15')](listDeviceStates())[_0xe726('0x15')](showPeersStatus());},0x32c8);};UserReport[_0xe726('0x20')][_0xe726('0x21')]=function(_0x8fbcdf){return _0x8fbcdf!==null&&!_[_0xe726('0x22')](_0x8fbcdf);};UserReport[_0xe726('0x20')][_0xe726('0x23')]=function(_0x314531,_0x55cf32,_0x304b16){io['to'](_0x314531)[_0xe726('0x23')](_0x55cf32,_0x304b16);};UserReport[_0xe726('0x20')]['syncRegistry']=function(_0x3f2e4a){try{if(this['isNotNull'](_0x3f2e4a)){logger[_0xe726('0x24')](_0xe726('0x25'),_0x3f2e4a[_0xe726('0x26')],_0x3f2e4a[_0xe726('0x27')]);logger['debug'](_0xe726('0x28'),util[_0xe726('0x19')](_0x3f2e4a,{'showHidden':![],'depth':null}));var _0x2ac054=_[_0xe726('0x29')](this[_0xe726('0xa')],{'defaultuser':_0x3f2e4a['username']});if(_0x2ac054){_0x3f2e4a[_0xe726('0x2a')]=_0x3f2e4a[_0xe726('0x27')];_[_0xe726('0x2b')](_0x2ac054,_[_0xe726('0x2c')](_0x3f2e4a,['event',_0xe726('0x2d'),'username',_0xe726('0x27')]));logger[_0xe726('0x2e')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xe726('0x19')](_0x2ac054,{'showHidden':![],'depth':null}));this[_0xe726('0x23')](util[_0xe726('0x2f')](_0xe726('0x30'),_0x2ac054[_0xe726('0x31')]),_0xe726('0x32'),_0x2ac054);}}}catch(_0x79477){logger[_0xe726('0x1e')](_0xe726('0x28'),util[_0xe726('0x19')](_0x79477,{'showHidden':![],'depth':null}));}};UserReport[_0xe726('0x20')][_0xe726('0x11')]=function(_0x462657){try{if(this[_0xe726('0x21')](_0x462657)){logger[_0xe726('0x24')](_0xe726('0x33'),_0x462657[_0xe726('0x34')],_0x462657[_0xe726('0x27')]);logger[_0xe726('0x2e')]('[userReport][devicestatechange]',util[_0xe726('0x19')](_0x462657,{'showHidden':![],'depth':null}));if(this[_0xe726('0xb')][_0x462657['device']]){if(!this[_0xe726('0xb')][_0x462657[_0xe726('0x34')]][_0xe726('0x35')]||_0x462657[_0xe726('0x27')][_0xe726('0x36')]()==_0xe726('0x37')){this['agents'][_0x462657[_0xe726('0x34')]][_0xe726('0x35')]=![];if(this[_0xe726('0xb')][_0x462657[_0xe726('0x34')]][_0xe726('0x27')]!==_0x462657[_0xe726('0x27')][_0xe726('0x36')]()){this[_0xe726('0xb')][_0x462657[_0xe726('0x34')]][_0xe726('0x38')]=_['toNumber'](moment()[_0xe726('0x2f')]('x'));}this[_0xe726('0xb')][_0x462657[_0xe726('0x34')]][_0xe726('0x27')]=_0x462657[_0xe726('0x27')][_0xe726('0x36')]();this[_0xe726('0xb')][_0x462657['device']]['updateStatusRealtime'](_0x462657);}}else if(this[_0xe726('0xc')][_0x462657[_0xe726('0x34')]]){if(this[_0xe726('0xc')][_0x462657['device']][_0xe726('0x27')]!==_0x462657[_0xe726('0x27')][_0xe726('0x36')]()){this[_0xe726('0xc')][_0x462657[_0xe726('0x34')]][_0xe726('0x38')]=_[_0xe726('0x39')](moment()[_0xe726('0x2f')]('x'));}this['telephones'][_0x462657['device']][_0xe726('0x27')]=_0x462657['state']['toLowerCase']();logger[_0xe726('0x2e')](_0xe726('0x3a'),util['inspect'](this[_0xe726('0xc')][_0x462657[_0xe726('0x34')]],{'showHidden':![],'depth':null}));this[_0xe726('0x23')](util[_0xe726('0x2f')]('telephone:%s',this[_0xe726('0xc')][_0x462657[_0xe726('0x34')]][_0xe726('0x31')]),_0xe726('0x3b'),this[_0xe726('0xc')][_0x462657[_0xe726('0x34')]]);}else if(this['trunks'][_0x462657['device']]){if(this['trunks'][_0x462657['device']]['state']!==_0x462657[_0xe726('0x27')]['toLowerCase']()){this[_0xe726('0xa')][_0x462657['device']]['stateTime']=_['toNumber'](moment()[_0xe726('0x2f')]('x'));}this[_0xe726('0xa')][_0x462657[_0xe726('0x34')]][_0xe726('0x27')]=_0x462657[_0xe726('0x27')]['toLowerCase']();logger[_0xe726('0x2e')](_0xe726('0x3c'),util[_0xe726('0x19')](this[_0xe726('0xa')][_0x462657['device']],{'showHidden':![],'depth':null}));this[_0xe726('0x23')](util['format'](_0xe726('0x30'),this[_0xe726('0xa')][_0x462657['device']][_0xe726('0x31')]),_0xe726('0x32'),this[_0xe726('0xa')][_0x462657[_0xe726('0x34')]]);}else if(_[_0xe726('0x3d')](_0x462657[_0xe726('0x34')],_0xe726('0x3e'))){var _0x5ece83=_0x462657[_0xe726('0x34')];var _0x170087=_0x5ece83[_0xe726('0x3f')](_0x5ece83['indexOf']('/')+0x1,_0x5ece83[_0xe726('0x40')]('@'));var _0x5ada22=_[_0xe726('0x29')](this[_0xe726('0xb')],function(_0xf57734){return _0xf57734[_0xe726('0x41')]==_0x170087||_0xf57734['phone']==_0x170087||_0xf57734[_0xe726('0x42')]==_0x170087;});if(_0x5ada22){if(_0x5ada22['state']!==_0x462657[_0xe726('0x27')][_0xe726('0x36')]()){_0x5ada22['stateTime']=_['toNumber'](moment()[_0xe726('0x2f')]('x'));}_0x5ada22['state']=_0x462657['state'][_0xe726('0x36')]();_0x5ada22['local']=!![];_0x5ada22[_0xe726('0x43')](_0x462657);}}}}catch(_0x4e8c1b){logger[_0xe726('0x1e')]('[userReport][devicestatechange]',util[_0xe726('0x19')](_0x4e8c1b,{'showHidden':![],'depth':null}));}};UserReport[_0xe726('0x20')]['syncPeerStatus']=function(_0x5289f2){try{if(this[_0xe726('0x21')](_0x5289f2)&&this[_0xe726('0x21')](_0x5289f2[_0xe726('0x12')])){logger[_0xe726('0x24')](_0xe726('0x44'),_0x5289f2[_0xe726('0x45')],_0x5289f2[_0xe726('0x46')],_0x5289f2[_0xe726('0x12')]);logger[_0xe726('0x2e')](_0xe726('0x47'),util[_0xe726('0x19')](_0x5289f2,{'showHidden':![],'depth':null}));if(this[_0xe726('0xb')][_0x5289f2[_0xe726('0x45')]]){if(!this['agents'][_0x5289f2[_0xe726('0x45')]][_0xe726('0x35')]||_0x5289f2[_0xe726('0x12')][_0xe726('0x36')]()==_0xe726('0x48')){this[_0xe726('0xb')][_0x5289f2[_0xe726('0x45')]]['local']=![];this[_0xe726('0xb')][_0x5289f2[_0xe726('0x45')]][_0xe726('0x49')]=_0x5289f2['peerstatus']['toLowerCase']();this['agents'][_0x5289f2[_0xe726('0x45')]][_0xe726('0x46')]=_0x5289f2[_0xe726('0x46')];this[_0xe726('0xb')][_0x5289f2[_0xe726('0x45')]][_0xe726('0x43')](_0x5289f2);}}else if(this[_0xe726('0xc')][_0x5289f2[_0xe726('0x45')]]){this['telephones'][_0x5289f2['peer']][_0xe726('0x49')]=_0x5289f2[_0xe726('0x12')][_0xe726('0x36')]();this[_0xe726('0xc')][_0x5289f2[_0xe726('0x45')]][_0xe726('0x46')]=_0x5289f2[_0xe726('0x46')];logger['debug'](_0xe726('0x4a'),util[_0xe726('0x19')](this[_0xe726('0xc')][_0x5289f2[_0xe726('0x45')]],{'showHidden':![],'depth':null}));this[_0xe726('0x23')](util['format'](_0xe726('0x4b'),this[_0xe726('0xc')][_0x5289f2[_0xe726('0x45')]]['name']),_0xe726('0x3b'),this[_0xe726('0xc')][_0x5289f2[_0xe726('0x45')]]);}else if(this[_0xe726('0xa')][_0x5289f2['peer']]){this['trunks'][_0x5289f2['peer']][_0xe726('0x49')]=_0x5289f2['peerstatus'][_0xe726('0x36')]();this[_0xe726('0xa')][_0x5289f2[_0xe726('0x45')]][_0xe726('0x46')]=_0x5289f2[_0xe726('0x46')];logger[_0xe726('0x2e')](_0xe726('0x4c'),util['inspect'](this[_0xe726('0xa')][_0x5289f2['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xe726('0x2f')](_0xe726('0x30'),this[_0xe726('0xa')][_0x5289f2[_0xe726('0x45')]][_0xe726('0x31')]),_0xe726('0x32'),this[_0xe726('0xa')][_0x5289f2[_0xe726('0x45')]]);}}}catch(_0x4fa176){logger[_0xe726('0x1e')](_0xe726('0x47'),util[_0xe726('0x19')](_0x4fa176,{'showHidden':![],'depth':null}));}};module[_0xe726('0x4d')]=UserReport; \ No newline at end of file +var _0xcc71=['toNumber','toLowerCase','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','find','mobile','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','moment','util','bluebird','../../../config/environment','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','stateRegistry','state','merge','event','actionid','format','name','trunk:save','[userReport][devicestatechange]','device','local','inuse','stateTime'];(function(_0x9a0b6b,_0x319570){var _0x42297f=function(_0x23edb5){while(--_0x23edb5){_0x9a0b6b['push'](_0x9a0b6b['shift']());}};_0x42297f(++_0x319570);}(_0xcc71,0xf5));var _0x1cc7=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xcc71[_0x494d1f];return _0x457b6e;};'use strict';var _=require('lodash');var moment=require(_0x1cc7('0x0'));var util=require(_0x1cc7('0x1'));var Redis=require('ioredis');var BPromise=require(_0x1cc7('0x2'));var config=require(_0x1cc7('0x3'));var logger=require('../../../config/logger')(_0x1cc7('0x4'));var ami=require(_0x1cc7('0x5'));config[_0x1cc7('0x6')]=_['defaults'](config[_0x1cc7('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1cc7('0x7'))(new Redis(config[_0x1cc7('0x6')]));function UserReport(_0xdfd430){this[_0x1cc7('0x8')]=_0xdfd430[_0x1cc7('0x8')];this[_0x1cc7('0x9')]=_0xdfd430[_0x1cc7('0x9')];this[_0x1cc7('0xa')]=_0xdfd430[_0x1cc7('0xa')];ami['on'](_0x1cc7('0xb'),this[_0x1cc7('0xc')][_0x1cc7('0xd')](this));ami['on'](_0x1cc7('0xe'),this[_0x1cc7('0xc')][_0x1cc7('0xd')](this));ami['on'](_0x1cc7('0xf'),this[_0x1cc7('0x10')][_0x1cc7('0xd')](this));ami['on'](_0x1cc7('0x11'),this[_0x1cc7('0x12')][_0x1cc7('0xd')](this));return this[_0x1cc7('0x13')]();}function showSipRegistrations(){Promise[_0x1cc7('0x14')]()[_0x1cc7('0x15')](ami['actionSipShowRegistry']())[_0x1cc7('0x16')](function(_0x54a747){logger['error'](_0x1cc7('0x17'),util[_0x1cc7('0x18')](_0x54a747,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1cc7('0x14')]()[_0x1cc7('0x15')](ami[_0x1cc7('0x19')]())['catch'](function(_0x1d0e51){logger[_0x1cc7('0x1a')](_0x1cc7('0x1b'),util[_0x1cc7('0x18')](_0x1d0e51,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami['actionSipPeerStatus']())[_0x1cc7('0x16')](function(_0x19efe8){logger[_0x1cc7('0x1a')](_0x1cc7('0x1c'),util[_0x1cc7('0x18')](_0x19efe8,{'showHidden':![],'depth':null}));});}UserReport[_0x1cc7('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x1cc7('0x14')]()[_0x1cc7('0x15')](showSipRegistrations())[_0x1cc7('0x15')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x1cc7('0x1e')]=function(_0x350944){return _0x350944!==null&&!_[_0x1cc7('0x1f')](_0x350944);};UserReport[_0x1cc7('0x1d')][_0x1cc7('0x20')]=function(_0x475e20,_0x31152d,_0x3b5fc4){io['to'](_0x475e20)[_0x1cc7('0x20')](_0x31152d,_0x3b5fc4);};UserReport[_0x1cc7('0x1d')][_0x1cc7('0xc')]=function(_0x49b8ac){try{if(this['isNotNull'](_0x49b8ac)){logger[_0x1cc7('0x21')](_0x1cc7('0x22'),_0x49b8ac[_0x1cc7('0x23')],_0x49b8ac['state']);logger[_0x1cc7('0x24')](_0x1cc7('0x25'),util[_0x1cc7('0x18')](_0x49b8ac,{'showHidden':![],'depth':null}));var _0x49d23e=_['find'](this[_0x1cc7('0x8')],{'defaultuser':_0x49b8ac[_0x1cc7('0x23')]});if(_0x49d23e){_0x49b8ac[_0x1cc7('0x26')]=_0x49b8ac[_0x1cc7('0x27')];_[_0x1cc7('0x28')](_0x49d23e,_['omit'](_0x49b8ac,[_0x1cc7('0x29'),_0x1cc7('0x2a'),_0x1cc7('0x23'),_0x1cc7('0x27')]));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x49d23e,{'showHidden':![],'depth':null}));this[_0x1cc7('0x20')](util[_0x1cc7('0x2b')]('trunk:%s',_0x49d23e[_0x1cc7('0x2c')]),_0x1cc7('0x2d'),_0x49d23e);}}}catch(_0x114739){logger[_0x1cc7('0x1a')](_0x1cc7('0x25'),util['inspect'](_0x114739,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1cc7('0x10')]=function(_0x6af658){try{if(this[_0x1cc7('0x1e')](_0x6af658)){logger[_0x1cc7('0x21')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x6af658['device'],_0x6af658[_0x1cc7('0x27')]);logger[_0x1cc7('0x24')](_0x1cc7('0x2e'),util[_0x1cc7('0x18')](_0x6af658,{'showHidden':![],'depth':null}));if(this['agents'][_0x6af658[_0x1cc7('0x2f')]]){if(!this[_0x1cc7('0x9')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x30')]||_0x6af658[_0x1cc7('0x27')]['toLowerCase']()==_0x1cc7('0x31')){this['agents'][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x30')]=![];if(this[_0x1cc7('0x9')][_0x6af658['device']][_0x1cc7('0x27')]!==_0x6af658['state']['toLowerCase']()){this[_0x1cc7('0x9')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x32')]=_[_0x1cc7('0x33')](moment()[_0x1cc7('0x2b')]('x'));}this[_0x1cc7('0x9')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x27')]=_0x6af658[_0x1cc7('0x27')][_0x1cc7('0x34')]();this['agents'][_0x6af658['device']][_0x1cc7('0x35')](_0x6af658);}}else if(this[_0x1cc7('0xa')][_0x6af658['device']]){if(this[_0x1cc7('0xa')][_0x6af658['device']][_0x1cc7('0x27')]!==_0x6af658[_0x1cc7('0x27')][_0x1cc7('0x34')]()){this['telephones'][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x32')]=_[_0x1cc7('0x33')](moment()['format']('x'));}this[_0x1cc7('0xa')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x27')]=_0x6af658['state'][_0x1cc7('0x34')]();logger[_0x1cc7('0x24')](_0x1cc7('0x36'),util[_0x1cc7('0x18')](this[_0x1cc7('0xa')][_0x6af658[_0x1cc7('0x2f')]],{'showHidden':![],'depth':null}));this[_0x1cc7('0x20')](util['format'](_0x1cc7('0x37'),this[_0x1cc7('0xa')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x2c')]),_0x1cc7('0x38'),this[_0x1cc7('0xa')][_0x6af658[_0x1cc7('0x2f')]]);}else if(this['trunks'][_0x6af658['device']]){if(this[_0x1cc7('0x8')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x27')]!==_0x6af658[_0x1cc7('0x27')][_0x1cc7('0x34')]()){this[_0x1cc7('0x8')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x32')]=_['toNumber'](moment()[_0x1cc7('0x2b')]('x'));}this[_0x1cc7('0x8')][_0x6af658[_0x1cc7('0x2f')]][_0x1cc7('0x27')]=_0x6af658[_0x1cc7('0x27')][_0x1cc7('0x34')]();logger[_0x1cc7('0x24')](_0x1cc7('0x39'),util[_0x1cc7('0x18')](this[_0x1cc7('0x8')][_0x6af658[_0x1cc7('0x2f')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1cc7('0x2b')](_0x1cc7('0x3a'),this[_0x1cc7('0x8')][_0x6af658['device']][_0x1cc7('0x2c')]),_0x1cc7('0x2d'),this[_0x1cc7('0x8')][_0x6af658[_0x1cc7('0x2f')]]);}else if(_[_0x1cc7('0x3b')](_0x6af658[_0x1cc7('0x2f')],_0x1cc7('0x3c'))){var _0x4a9b00=_0x6af658[_0x1cc7('0x2f')];var _0x336180=_0x4a9b00[_0x1cc7('0x3d')](_0x4a9b00[_0x1cc7('0x3e')]('/')+0x1,_0x4a9b00[_0x1cc7('0x3e')]('@'));var _0x32f6c4=_[_0x1cc7('0x3f')](this[_0x1cc7('0x9')],function(_0x28525a){return _0x28525a[_0x1cc7('0x40')]==_0x336180||_0x28525a[_0x1cc7('0x41')]==_0x336180||_0x28525a['accountcode']==_0x336180;});if(_0x32f6c4){if(_0x32f6c4['state']!==_0x6af658[_0x1cc7('0x27')]['toLowerCase']()){_0x32f6c4[_0x1cc7('0x32')]=_['toNumber'](moment()['format']('x'));}_0x32f6c4[_0x1cc7('0x27')]=_0x6af658[_0x1cc7('0x27')][_0x1cc7('0x34')]();_0x32f6c4[_0x1cc7('0x30')]=!![];_0x32f6c4[_0x1cc7('0x35')](_0x6af658);}}}}catch(_0x333c73){logger[_0x1cc7('0x1a')](_0x1cc7('0x2e'),util[_0x1cc7('0x18')](_0x333c73,{'showHidden':![],'depth':null}));}};UserReport[_0x1cc7('0x1d')]['syncPeerStatus']=function(_0x3d21a5){try{if(this['isNotNull'](_0x3d21a5)&&this[_0x1cc7('0x1e')](_0x3d21a5[_0x1cc7('0x11')])){logger[_0x1cc7('0x21')](_0x1cc7('0x42'),_0x3d21a5[_0x1cc7('0x43')],_0x3d21a5[_0x1cc7('0x44')],_0x3d21a5[_0x1cc7('0x11')]);logger['debug']('[userReport][peerstatus]',util[_0x1cc7('0x18')](_0x3d21a5,{'showHidden':![],'depth':null}));if(this[_0x1cc7('0x9')][_0x3d21a5[_0x1cc7('0x43')]]){if(!this[_0x1cc7('0x9')][_0x3d21a5['peer']][_0x1cc7('0x30')]||_0x3d21a5[_0x1cc7('0x11')]['toLowerCase']()=='registered'){this[_0x1cc7('0x9')][_0x3d21a5[_0x1cc7('0x43')]][_0x1cc7('0x30')]=![];this['agents'][_0x3d21a5[_0x1cc7('0x43')]][_0x1cc7('0x45')]=_0x3d21a5[_0x1cc7('0x11')][_0x1cc7('0x34')]();this[_0x1cc7('0x9')][_0x3d21a5[_0x1cc7('0x43')]]['address']=_0x3d21a5[_0x1cc7('0x44')];this[_0x1cc7('0x9')][_0x3d21a5['peer']][_0x1cc7('0x35')](_0x3d21a5);}}else if(this[_0x1cc7('0xa')][_0x3d21a5[_0x1cc7('0x43')]]){this[_0x1cc7('0xa')][_0x3d21a5['peer']]['status']=_0x3d21a5['peerstatus'][_0x1cc7('0x34')]();this['telephones'][_0x3d21a5[_0x1cc7('0x43')]][_0x1cc7('0x44')]=_0x3d21a5[_0x1cc7('0x44')];logger['debug'](_0x1cc7('0x46'),util[_0x1cc7('0x18')](this['telephones'][_0x3d21a5[_0x1cc7('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1cc7('0x2b')](_0x1cc7('0x37'),this['telephones'][_0x3d21a5[_0x1cc7('0x43')]][_0x1cc7('0x2c')]),_0x1cc7('0x38'),this[_0x1cc7('0xa')][_0x3d21a5[_0x1cc7('0x43')]]);}else if(this[_0x1cc7('0x8')][_0x3d21a5[_0x1cc7('0x43')]]){this[_0x1cc7('0x8')][_0x3d21a5[_0x1cc7('0x43')]][_0x1cc7('0x45')]=_0x3d21a5['peerstatus'][_0x1cc7('0x34')]();this['trunks'][_0x3d21a5[_0x1cc7('0x43')]][_0x1cc7('0x44')]=_0x3d21a5[_0x1cc7('0x44')];logger['debug'](_0x1cc7('0x47'),util[_0x1cc7('0x18')](this[_0x1cc7('0x8')][_0x3d21a5[_0x1cc7('0x43')]],{'showHidden':![],'depth':null}));this[_0x1cc7('0x20')](util[_0x1cc7('0x2b')](_0x1cc7('0x3a'),this[_0x1cc7('0x8')][_0x3d21a5[_0x1cc7('0x43')]]['name']),'trunk:save',this['trunks'][_0x3d21a5[_0x1cc7('0x43')]]);}}}catch(_0x2e5573){logger[_0x1cc7('0x1a')](_0x1cc7('0x48'),util[_0x1cc7('0x18')](_0x2e5573,{'showHidden':![],'depth':null}));}};module[_0x1cc7('0x49')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d25f3ae..b31411a 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 _0x3d7b=['mandatoryDisposition','inbound','variables','voice','merge','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','prototype','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','reason','talktime','acwtime','acwTimeout','omit','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x3d7b,0x1a2));var _0xb3d7=function(_0x2823fd,_0x5dfcc1){_0x2823fd=_0x2823fd-0x0;var _0x2f100e=_0x3d7b[_0x2823fd];return _0x2f100e;};'use strict';var _=require(_0xb3d7('0x0'));var moment=require(_0xb3d7('0x1'));var util=require(_0xb3d7('0x2'));var Redis=require(_0xb3d7('0x3'));var config=require(_0xb3d7('0x4'));var logger=require(_0xb3d7('0x5'))(_0xb3d7('0x6'));var ami=require('../ami');config['redis']=_[_0xb3d7('0x7')](config[_0xb3d7('0x8')],{'host':_0xb3d7('0x9'),'port':0x18eb});var io=require(_0xb3d7('0xa'))(new Redis(config[_0xb3d7('0x8')]));function VoiceAgentReport(_0x54faf8){this[_0xb3d7('0xb')]={};this[_0xb3d7('0xc')]=_0x54faf8['channels'];this[_0xb3d7('0xd')]=_0x54faf8['voiceQueues'];this['agents']=_0x54faf8[_0xb3d7('0xe')];this['variables']={};ami['on'](_0xb3d7('0xf'),this[_0xb3d7('0x10')][_0xb3d7('0x11')](this));ami['on'](_0xb3d7('0x12'),this['syncAgentConnect']['bind'](this));ami['on'](_0xb3d7('0x13'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb3d7('0x14'),this[_0xb3d7('0x15')][_0xb3d7('0x11')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xb3d7('0x11')](this));ami['on']('varset',this[_0xb3d7('0x16')][_0xb3d7('0x11')](this));ami['on'](_0xb3d7('0x17'),this[_0xb3d7('0x18')][_0xb3d7('0x11')](this));ami['on'](_0xb3d7('0x19'),this[_0xb3d7('0x1a')]['bind'](this));ami['on'](_0xb3d7('0x1b'),this[_0xb3d7('0x1c')][_0xb3d7('0x11')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xb3d7('0x11')](this));ami['on'](_0xb3d7('0x1d'),this['syncBlindTransfer'][_0xb3d7('0x11')](this));}VoiceAgentReport['prototype'][_0xb3d7('0x1e')]=function(_0x45d5ef,_0x149dc6,_0x48fa2d){io['to'](_0x45d5ef)[_0xb3d7('0x1e')](_0x149dc6,_0x48fa2d);};VoiceAgentReport['prototype'][_0xb3d7('0x1f')]=function(_0x121cb3){return _0x121cb3!==null&&!_[_0xb3d7('0x20')](_0x121cb3);};VoiceAgentReport['prototype'][_0xb3d7('0x10')]=function(_0x6b91d1){try{if(this['isNotNull'](_0x6b91d1)){logger[_0xb3d7('0x21')](_0xb3d7('0x22'),_0x6b91d1[_0xb3d7('0x23')],_0x6b91d1['membername'],_0x6b91d1[_0xb3d7('0x24')]);logger[_0xb3d7('0x25')](_0xb3d7('0x26'),_0x6b91d1['uniqueid'],util[_0xb3d7('0x27')](_0x6b91d1,{'showHidden':![],'depth':null}));if(_[_0xb3d7('0x20')](this[_0xb3d7('0xb')][_0x6b91d1[_0xb3d7('0x23')]])){this[_0xb3d7('0xb')][_0x6b91d1['uniqueid']]={};}if(_[_0xb3d7('0x20')](this[_0xb3d7('0xb')][_0x6b91d1[_0xb3d7('0x23')]][_0x6b91d1[_0xb3d7('0x24')]])){this[_0xb3d7('0xb')][_0x6b91d1[_0xb3d7('0x23')]][_0x6b91d1[_0xb3d7('0x24')]]={'agentcalledAt':moment()[_0xb3d7('0x28')](_0xb3d7('0x29')),'lastevent':_0xb3d7('0x2a'),'mandatoryDisposition':this[_0xb3d7('0xd')][_0x6b91d1['queue']]?this[_0xb3d7('0xd')][_0x6b91d1[_0xb3d7('0x2b')]][_0xb3d7('0x2c')]||![]:![],'type':this[_0xb3d7('0xd')][_0x6b91d1[_0xb3d7('0x2b')]]?this[_0xb3d7('0xd')][_0x6b91d1[_0xb3d7('0x2b')]]['type']||_0xb3d7('0x2d'):_0xb3d7('0x2d'),'variables':this[_0xb3d7('0x2e')][_0x6b91d1[_0xb3d7('0x23')]],'motionChannel':_0xb3d7('0x2f')};}_[_0xb3d7('0x30')](this['channels'][_0x6b91d1['uniqueid']][_0x6b91d1[_0xb3d7('0x24')]],_['omit'](_0x6b91d1,[_0xb3d7('0x31'),'privilege']));logger[_0xb3d7('0x25')](_0xb3d7('0x32'),_0x6b91d1[_0xb3d7('0x23')],util[_0xb3d7('0x27')](this['channels'][_0x6b91d1['uniqueid']][_0x6b91d1[_0xb3d7('0x24')]],{'showHidden':![],'depth':null}));ami[_0xb3d7('0x1e')](_0xb3d7('0x33'),this['channels'][_0x6b91d1['uniqueid']][_0x6b91d1['destuniqueid']]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x6b91d1['uniqueid'],util[_0xb3d7('0x27')](this[_0xb3d7('0xb')][_0x6b91d1[_0xb3d7('0x23')]][_0x6b91d1['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xb3d7('0x1e')](util['format'](_0xb3d7('0x34'),_0x6b91d1[_0xb3d7('0x35')]),_0xb3d7('0x36'),this['channels'][_0x6b91d1[_0xb3d7('0x23')]][_0x6b91d1[_0xb3d7('0x24')]]);}}catch(_0x1b8c65){logger[_0xb3d7('0x37')](_0xb3d7('0x38'),_0x6b91d1['uniqueid'],util[_0xb3d7('0x27')](_0x1b8c65,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')][_0xb3d7('0x3a')]=function(_0x42d129){try{if(this[_0xb3d7('0x1f')](_0x42d129)){if(this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]]){logger[_0xb3d7('0x25')](_0xb3d7('0x3b'),_0x42d129[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x42d129,{'showHidden':![],'depth':null}));for(var _0x4afd94 in this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]]){if(this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0xb3d7('0x3c')](_0x4afd94)){if(_0x42d129[_0xb3d7('0x24')]===_0x4afd94){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x42d129[_0xb3d7('0x23')],_0x42d129[_0xb3d7('0x35')],_0x42d129[_0xb3d7('0x24')]);this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x3d')]=moment()[_0xb3d7('0x28')](_0xb3d7('0x29'));this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x4afd94]['connectedlinename']=_0x42d129[_0xb3d7('0x3e')];this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x3f')]=_0x42d129[_0xb3d7('0x3f')];this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94]['destchannelstate']=_0x42d129[_0xb3d7('0x40')];this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x41')]=_0x42d129[_0xb3d7('0x41')];this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94]['holdtime']=_0x42d129[_0xb3d7('0x42')];this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x43')]=_0xb3d7('0x44');if(this[_0xb3d7('0xc')][this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x23')]]){var _0x2852d6=this[_0xb3d7('0xc')][this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x23')]][_0xb3d7('0x45')];this[_0xb3d7('0xb')][_0x42d129['uniqueid']][_0x4afd94][_0xb3d7('0x45')]=_0x2852d6;_0x42d129['routealias']=_0x2852d6;}_['merge'](this[_0xb3d7('0xe')][_0x42d129['interface']],_[_0xb3d7('0x46')](_0x42d129,[_0xb3d7('0x2b'),_0xb3d7('0x47'),'routealias']));logger['debug'](_0xb3d7('0x48'),_0x42d129[_0xb3d7('0x23')],util['inspect'](this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x42d129['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xb3d7('0x1e')](_0xb3d7('0x49'),this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x42d129[_0xb3d7('0x24')]]);logger[_0xb3d7('0x25')](_0xb3d7('0x4a'),_0x42d129[_0xb3d7('0x23')],util[_0xb3d7('0x27')](this[_0xb3d7('0xb')][_0x42d129['uniqueid']][_0x42d129[_0xb3d7('0x24')]],{'showHidden':![],'depth':null}));this[_0xb3d7('0x1e')](util[_0xb3d7('0x28')](_0xb3d7('0x34'),_0x42d129[_0xb3d7('0x35')]),_0xb3d7('0x4b'),this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x42d129[_0xb3d7('0x24')]]);}else if(!this[_0xb3d7('0xb')][_0x42d129['uniqueid']][_0x4afd94][_0xb3d7('0x13')]&&!this[_0xb3d7('0xb')][_0x42d129['uniqueid']][_0x4afd94][_0xb3d7('0x4c')]){logger[_0xb3d7('0x21')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x42d129[_0xb3d7('0x23')],this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x35')],_0x4afd94);this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x13')]=!![];this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94][_0xb3d7('0x4d')]=moment()[_0xb3d7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x42d129['uniqueid']][_0x4afd94]['answeredelsewheredestinationuniqueid']=_0x42d129['destuniqueid'];this[_0xb3d7('0xb')][_0x42d129[_0xb3d7('0x23')]][_0x4afd94]['answeredelsewheremembername']=_0x42d129[_0xb3d7('0x35')];this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x4afd94]['lastevent']=_0xb3d7('0x4e');this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x4afd94]['reason']='answered_elsewhere';logger[_0xb3d7('0x25')](_0xb3d7('0x4f'),_0x42d129[_0xb3d7('0x23')],util[_0xb3d7('0x27')](this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x4afd94],{'showHidden':![],'depth':null}));ami['emit'](_0xb3d7('0x50'),this['channels'][_0x42d129[_0xb3d7('0x23')]][_0x4afd94]);}}}}}}catch(_0x508789){logger[_0xb3d7('0x37')](_0xb3d7('0x51'),_0x42d129[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x508789,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')]['syncAgentRingNoAnswer']=function(_0x4dc526){try{if(this[_0xb3d7('0x1f')](_0x4dc526)){logger[_0xb3d7('0x25')](_0xb3d7('0x52'),_0x4dc526[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x4dc526,{'showHidden':![],'depth':null}));if(this['channels'][_0x4dc526['uniqueid']]&&this[_0xb3d7('0xb')][_0x4dc526[_0xb3d7('0x23')]][_0x4dc526[_0xb3d7('0x24')]]){logger['info'](_0xb3d7('0x53'),_0x4dc526[_0xb3d7('0x23')],_0x4dc526[_0xb3d7('0x35')],_0x4dc526[_0xb3d7('0x24')]);this[_0xb3d7('0xb')][_0x4dc526['uniqueid']][_0x4dc526['destuniqueid']]['agentringnoanswer']=!![];this[_0xb3d7('0xb')][_0x4dc526['uniqueid']][_0x4dc526[_0xb3d7('0x24')]][_0xb3d7('0x4d')]=moment()[_0xb3d7('0x28')](_0xb3d7('0x29'));this[_0xb3d7('0xb')][_0x4dc526['uniqueid']][_0x4dc526[_0xb3d7('0x24')]][_0xb3d7('0x43')]=_0xb3d7('0x54');this[_0xb3d7('0xb')][_0x4dc526['uniqueid']][_0x4dc526[_0xb3d7('0x24')]]['reason']=_0xb3d7('0x54');logger[_0xb3d7('0x25')](_0xb3d7('0x55'),_0x4dc526[_0xb3d7('0x23')],util['inspect'](this[_0xb3d7('0xb')][_0x4dc526[_0xb3d7('0x23')]][_0x4dc526['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xb3d7('0x56'),this[_0xb3d7('0xb')][_0x4dc526[_0xb3d7('0x23')]][_0x4dc526[_0xb3d7('0x24')]]);}}}catch(_0x14e414){logger['error'](_0xb3d7('0x57'),_0x4dc526[_0xb3d7('0x23')],util['inspect'](_0x14e414,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')][_0xb3d7('0x15')]=function(_0x3de568){try{if(this['isNotNull'](_0x3de568)){logger[_0xb3d7('0x25')](_0xb3d7('0x58'),_0x3de568['uniqueid'],util[_0xb3d7('0x27')](_0x3de568,{'showHidden':![],'depth':null}));if(this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]]){for(var _0x54336d in this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]]){if(this['channels'][_0x3de568[_0xb3d7('0x23')]][_0xb3d7('0x3c')](_0x54336d)&&!this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]][_0x54336d]['agentringnoanswer']&&!this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]][_0x54336d]['agentcomplete']){logger[_0xb3d7('0x21')](_0xb3d7('0x59'),_0x3de568[_0xb3d7('0x23')],this['channels'][_0x3de568['uniqueid']][_0x54336d][_0xb3d7('0x35')],_0x54336d);this[_0xb3d7('0xb')][_0x3de568['uniqueid']][_0x54336d]['agentringnoanswer']=!![];this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]][_0x54336d][_0xb3d7('0x4d')]=moment()[_0xb3d7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]][_0x54336d][_0xb3d7('0x43')]=_0xb3d7('0x5a');this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]][_0x54336d]['reason']='abandoned';logger[_0xb3d7('0x25')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x3de568[_0xb3d7('0x23')],util['inspect'](this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]][_0x54336d],{'showHidden':![],'depth':null}));ami[_0xb3d7('0x1e')](_0xb3d7('0x5b'),this[_0xb3d7('0xb')][_0x3de568[_0xb3d7('0x23')]][_0x54336d]);}}}}}catch(_0x3c27bc){logger[_0xb3d7('0x37')](_0xb3d7('0x5c'),_0x3de568[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x3c27bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb3d7('0x5d')]=function(_0x5f5651){try{if(this[_0xb3d7('0x1f')](_0x5f5651)){logger[_0xb3d7('0x25')](_0xb3d7('0x5e'),_0x5f5651['uniqueid'],util[_0xb3d7('0x27')](_0x5f5651,{'showHidden':![],'depth':null}));if(this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]]){for(var _0x202f12 in this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]]){if(this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0xb3d7('0x3c')](_0x202f12)){if(this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12]['agentconnectAt']&&!this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12][_0xb3d7('0x4c')]){logger['info'](_0xb3d7('0x5f'),_0x5f5651[_0xb3d7('0x23')],this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12][_0xb3d7('0x35')],_0x202f12);this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12]['agentcomplete']=!![];this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12][_0xb3d7('0x60')]=moment()[_0xb3d7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5f5651[_0xb3d7('0x23')]][_0x202f12][_0xb3d7('0x43')]='complete';this[_0xb3d7('0xb')][_0x5f5651['uniqueid']][_0x202f12]['reason']=_0x5f5651['reason']==_0xb3d7('0x61')?_0xb3d7('0x62'):_0x5f5651[_0xb3d7('0x63')];this['channels'][_0x5f5651['uniqueid']][_0x202f12][_0xb3d7('0x64')]=_0x5f5651[_0xb3d7('0x64')];if(this[_0xb3d7('0xd')][_0x5f5651[_0xb3d7('0x2b')]]&&this[_0xb3d7('0xd')][_0x5f5651[_0xb3d7('0x2b')]]['acw']){this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12][_0xb3d7('0x65')]=this[_0xb3d7('0xd')][_0x5f5651[_0xb3d7('0x2b')]][_0xb3d7('0x66')];this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12]['agentacw']=!![];}this[_0xb3d7('0xe')][_0x5f5651['interface']]=_[_0xb3d7('0x67')](this[_0xb3d7('0xe')][_0x5f5651[_0xb3d7('0x68')]],[_0xb3d7('0x2b'),_0xb3d7('0x47')]);logger[_0xb3d7('0x25')](_0xb3d7('0x69'),_0x5f5651[_0xb3d7('0x23')],util[_0xb3d7('0x27')](this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12],{'showHidden':![],'depth':null}));ami[_0xb3d7('0x1e')](_0xb3d7('0x6a'),this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12]);logger[_0xb3d7('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x5f5651[_0xb3d7('0x23')],util[_0xb3d7('0x27')](this[_0xb3d7('0xb')][_0x5f5651[_0xb3d7('0x23')]][_0x202f12],{'showHidden':![],'depth':null}));this[_0xb3d7('0x1e')](util[_0xb3d7('0x28')](_0xb3d7('0x34'),_0x5f5651['membername']),_0xb3d7('0x6b'),this['channels'][_0x5f5651[_0xb3d7('0x23')]][_0x202f12]);}}}}}}catch(_0x32e384){logger[_0xb3d7('0x37')]('[%s][voiceAgentReport][agentcomplete]',_0x5f5651[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x32e384,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')]['syncVarSet']=function(_0x3d8345){try{if(this[_0xb3d7('0x1f')](_0x3d8345)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x3d8345[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x3d8345,{'showHidden':![],'depth':null}));this[_0xb3d7('0x6c')](_0x3d8345[_0xb3d7('0x23')],_[_0xb3d7('0x6d')](_0x3d8345[_0xb3d7('0x6e')])[0x0],_0x3d8345[_0xb3d7('0x6f')]);if(this[_0xb3d7('0xb')][_0x3d8345[_0xb3d7('0x23')]]){for(var _0xe97d5e in this['channels'][_0x3d8345[_0xb3d7('0x23')]]){if(this[_0xb3d7('0xb')][_0x3d8345[_0xb3d7('0x23')]]['hasOwnProperty'](_0xe97d5e)){logger[_0xb3d7('0x21')](_0xb3d7('0x70'),_0x3d8345[_0xb3d7('0x23')],_0xe97d5e,_[_0xb3d7('0x6d')](_0x3d8345['variable'])[0x0],_0x3d8345['value']);if(_[_0xb3d7('0x20')](this[_0xb3d7('0xb')][_0x3d8345['uniqueid']][_0xe97d5e][_0xb3d7('0x2e')])){this[_0xb3d7('0xb')][_0x3d8345['uniqueid']][_0xe97d5e]['variables']={};}this[_0xb3d7('0xb')][_0x3d8345[_0xb3d7('0x23')]][_0xe97d5e][_0xb3d7('0x2e')]=this['variables'][_0x3d8345[_0xb3d7('0x23')]];}}}}}catch(_0x396c73){logger[_0xb3d7('0x37')](_0xb3d7('0x71'),_0x3d8345[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x396c73,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')][_0xb3d7('0x6c')]=function(_0x57cb77,_0x5d7f59,_0x34465c){var _0x5cf3fb=['rtpaudioqos','rtpaudioqosbridged',_0xb3d7('0x72'),_0xb3d7('0x73'),'rtpaudioqosloss',_0xb3d7('0x74'),_0xb3d7('0x75'),'rtpaudioqosrttbridged',_0xb3d7('0x76'),_0xb3d7('0x77'),_0xb3d7('0x78'),'bridgepvtcallid','membercalls',_0xb3d7('0x79'),_0xb3d7('0x7a'),_0xb3d7('0x7b'),'membername',_0xb3d7('0x7c'),_0xb3d7('0x7d')];if(!_[_0xb3d7('0x7e')](_0x5d7f59)&&!_['includes'](_0x5cf3fb,_0x5d7f59)){if(_[_0xb3d7('0x20')](this[_0xb3d7('0x2e')][_0x57cb77])){this[_0xb3d7('0x2e')][_0x57cb77]={};}this[_0xb3d7('0x2e')][_0x57cb77][_0x5d7f59]=_0x34465c;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x17d845){try{if(this[_0xb3d7('0x1f')](_0x17d845)){logger[_0xb3d7('0x25')](_0xb3d7('0x7f'),_0x17d845[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x17d845,{'showHidden':![],'depth':null}));if(this[_0xb3d7('0xb')][_0x17d845[_0xb3d7('0x23')]]){for(var _0x317735 in this[_0xb3d7('0xb')][_0x17d845['uniqueid']]){if(this[_0xb3d7('0xb')][_0x17d845['uniqueid']]['hasOwnProperty'](_0x317735)){if(this[_0xb3d7('0xb')][_0x17d845[_0xb3d7('0x23')]][_0x317735][_0xb3d7('0x63')]==_0xb3d7('0x61')&&this['channels'][_0x17d845[_0xb3d7('0x23')]][_0x317735][_0xb3d7('0x4c')]){logger['info'](_0xb3d7('0x80'),_0x17d845['uniqueid'],_0x317735);this[_0xb3d7('0xb')][_0x17d845[_0xb3d7('0x23')]][_0x317735][_0xb3d7('0x60')]=moment()[_0xb3d7('0x28')](_0xb3d7('0x29'));}}}logger['debug'](_0xb3d7('0x81'),_0x17d845['uniqueid'],util['inspect'](_['values'](this[_0xb3d7('0xb')][_0x17d845[_0xb3d7('0x23')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xb3d7('0x82'),_[_0xb3d7('0x83')](this[_0xb3d7('0xb')][_0x17d845['uniqueid']]));delete this['channels'][_0x17d845['uniqueid']];}if(this[_0xb3d7('0x2e')][_0x17d845[_0xb3d7('0x23')]]){delete this[_0xb3d7('0x2e')][_0x17d845[_0xb3d7('0x23')]];}}}catch(_0x160aee){logger[_0xb3d7('0x37')](_0xb3d7('0x84'),_0x17d845[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x160aee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')]['syncAttendedTransfer']=function(_0x17012a){try{if(this[_0xb3d7('0x1f')](_0x17012a)){logger['debug'](_0xb3d7('0x85'),_0x17012a[_0xb3d7('0x23')],util['inspect'](_0x17012a,{'showHidden':![],'depth':null}));if(this[_0xb3d7('0xb')][_0x17012a[_0xb3d7('0x86')]]){for(var _0x1d74a3 in this['channels'][_0x17012a[_0xb3d7('0x86')]]){if(this[_0xb3d7('0xb')][_0x17012a[_0xb3d7('0x86')]][_0xb3d7('0x3c')](_0x1d74a3)){if(_0x17012a[_0xb3d7('0x87')]===_0x1d74a3){logger['info']('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x17012a[_0xb3d7('0x23')],this[_0xb3d7('0xb')][_0x17012a[_0xb3d7('0x86')]][_0x1d74a3][_0xb3d7('0x35')],_0x1d74a3);var _0x146e0d=moment();this['channels'][_0x17012a['transfereeuniqueid']][_0x1d74a3][_0xb3d7('0x4c')]=!![];this[_0xb3d7('0xb')][_0x17012a[_0xb3d7('0x86')]][_0x1d74a3][_0xb3d7('0x60')]=moment()[_0xb3d7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x17012a[_0xb3d7('0x86')]][_0x1d74a3][_0xb3d7('0x43')]=_0xb3d7('0x88');this[_0xb3d7('0xb')][_0x17012a[_0xb3d7('0x86')]][_0x1d74a3][_0xb3d7('0x63')]=_0xb3d7('0x61');this[_0xb3d7('0xb')][_0x17012a['transfereeuniqueid']][_0x1d74a3]['talktime']=_0x146e0d['diff'](this[_0xb3d7('0xb')][_0x17012a[_0xb3d7('0x86')]][_0x1d74a3][_0xb3d7('0x3d')],_0xb3d7('0x89'));}}}}if(this['channels'][_0x17012a[_0xb3d7('0x8a')]]){var _0x4a74b1=this['channels'][_0x17012a['secondtransfereruniqueid']];this[_0xb3d7('0xb')][_0x17012a[_0xb3d7('0x8a')]]=this[_0xb3d7('0xb')][_0x17012a['transfereeuniqueid']];this[_0xb3d7('0xb')][_0x17012a['transfereeuniqueid']]=_0x4a74b1;}}}catch(_0x4cb2cf){logger[_0xb3d7('0x37')](_0xb3d7('0x8b'),_0x17012a[_0xb3d7('0x23')],util['inspect'](_0x4cb2cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')][_0xb3d7('0x8c')]=function(_0x10a21c){try{if(this[_0xb3d7('0x1f')](_0x10a21c)){logger[_0xb3d7('0x25')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x10a21c['uniqueid'],util[_0xb3d7('0x27')](_0x10a21c,{'showHidden':![],'depth':null}));if(this[_0xb3d7('0xb')][_0x10a21c['transfereeuniqueid']]){for(var _0x5d7043 in this['channels'][_0x10a21c[_0xb3d7('0x86')]]){if(this[_0xb3d7('0xb')][_0x10a21c[_0xb3d7('0x86')]][_0xb3d7('0x3c')](_0x5d7043)){if(_0x10a21c[_0xb3d7('0x8d')]===_0x5d7043){logger[_0xb3d7('0x21')](_0xb3d7('0x8e'),_0x10a21c[_0xb3d7('0x23')],this[_0xb3d7('0xb')][_0x10a21c['transfereeuniqueid']][_0x5d7043][_0xb3d7('0x35')],_0x5d7043);var _0x1ab19c=moment();this[_0xb3d7('0xb')][_0x10a21c[_0xb3d7('0x86')]][_0x5d7043]['agentcomplete']=!![];this['channels'][_0x10a21c[_0xb3d7('0x86')]][_0x5d7043][_0xb3d7('0x60')]=_0x1ab19c;this[_0xb3d7('0xb')][_0x10a21c[_0xb3d7('0x86')]][_0x5d7043][_0xb3d7('0x43')]=_0xb3d7('0x88');this['channels'][_0x10a21c['transfereeuniqueid']][_0x5d7043][_0xb3d7('0x63')]=_0xb3d7('0x61');this[_0xb3d7('0xb')][_0x10a21c[_0xb3d7('0x86')]][_0x5d7043][_0xb3d7('0x64')]=_0x1ab19c[_0xb3d7('0x8f')](this[_0xb3d7('0xb')][_0x10a21c[_0xb3d7('0x86')]][_0x5d7043][_0xb3d7('0x3d')],_0xb3d7('0x89'));}}}}}}catch(_0x3e524f){logger[_0xb3d7('0x37')](_0xb3d7('0x90'),_0x10a21c[_0xb3d7('0x23')],util['inspect'](_0x3e524f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')][_0xb3d7('0x1a')]=function(_0xbfb89a){var _0x3d8185='';try{if(this['isNotNull'](_0xbfb89a)){logger[_0xb3d7('0x25')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0xbfb89a[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0xbfb89a,{'showHidden':![],'depth':null}));if(_0xbfb89a[_0xb3d7('0x91')]){_0x3d8185=_0xbfb89a[_0xb3d7('0x91')][_0xb3d7('0x92')](0x0,_0xbfb89a[_0xb3d7('0x91')][_0xb3d7('0x93')]('-'));if(this[_0xb3d7('0xe')][_0x3d8185]){logger['info'](_0xb3d7('0x94'),_0xbfb89a['uniqueid'],_0x3d8185);this[_0xb3d7('0xe')][_0x3d8185][_0xb3d7('0x95')]=!![];}}}}catch(_0x11b523){logger[_0xb3d7('0x37')](_0xb3d7('0x96'),_0xbfb89a[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x11b523,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb3d7('0x39')][_0xb3d7('0x1c')]=function(_0x11445a){var _0x48397e='';try{if(this[_0xb3d7('0x1f')](_0x11445a)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x11445a[_0xb3d7('0x23')],util[_0xb3d7('0x27')](_0x11445a,{'showHidden':![],'depth':null}));if(_0x11445a[_0xb3d7('0x91')]){_0x48397e=_0x11445a[_0xb3d7('0x91')][_0xb3d7('0x92')](0x0,_0x11445a[_0xb3d7('0x91')]['lastIndexOf']('-'));if(this[_0xb3d7('0xe')][_0x48397e]){logger[_0xb3d7('0x21')](_0xb3d7('0x97'),_0x11445a[_0xb3d7('0x23')],_0x48397e);this[_0xb3d7('0xe')][_0x48397e]['onhold']=![];}}}}catch(_0x3e5f32){logger['error'](_0xb3d7('0x98'),_0x11445a[_0xb3d7('0x23')],util['inspect'](_0x3e5f32,{'showHidden':![],'depth':null}));}};module[_0xb3d7('0x99')]=VoiceAgentReport; \ No newline at end of file +var _0x6033=['[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%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]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','ioredis','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','called','queue','mandatoryDisposition','voice','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x6033,0x177));var _0x3603=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6033[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var moment=require(_0x3603('0x0'));var util=require('util');var Redis=require(_0x3603('0x1'));var config=require(_0x3603('0x2'));var logger=require('../../../config/logger')(_0x3603('0x3'));var ami=require('../ami');config[_0x3603('0x4')]=_[_0x3603('0x5')](config[_0x3603('0x4')],{'host':_0x3603('0x6'),'port':0x18eb});var io=require(_0x3603('0x7'))(new Redis(config[_0x3603('0x4')]));function VoiceAgentReport(_0x499eac){this[_0x3603('0x8')]={};this[_0x3603('0x9')]=_0x499eac[_0x3603('0x8')];this[_0x3603('0xa')]=_0x499eac[_0x3603('0xa')];this[_0x3603('0xb')]=_0x499eac[_0x3603('0xb')];this[_0x3603('0xc')]={};ami['on']('agentcalled',this[_0x3603('0xd')][_0x3603('0xe')](this));ami['on']('agentconnect',this[_0x3603('0xf')][_0x3603('0xe')](this));ami['on'](_0x3603('0x10'),this[_0x3603('0x11')][_0x3603('0xe')](this));ami['on']('queuecallerabandon',this[_0x3603('0x12')][_0x3603('0xe')](this));ami['on'](_0x3603('0x13'),this[_0x3603('0x14')][_0x3603('0xe')](this));ami['on'](_0x3603('0x15'),this['syncVarSet'][_0x3603('0xe')](this));ami['on'](_0x3603('0x16'),this[_0x3603('0x17')][_0x3603('0xe')](this));ami['on'](_0x3603('0x18'),this['syncMusicOnHoldStart'][_0x3603('0xe')](this));ami['on'](_0x3603('0x19'),this[_0x3603('0x1a')][_0x3603('0xe')](this));ami['on'](_0x3603('0x1b'),this['syncAttendedTransfer'][_0x3603('0xe')](this));ami['on'](_0x3603('0x1c'),this['syncBlindTransfer'][_0x3603('0xe')](this));}VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x1e')]=function(_0x2b53fb,_0x20db94,_0x528548){io['to'](_0x2b53fb)[_0x3603('0x1e')](_0x20db94,_0x528548);};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x1f')]=function(_0x1771c2){return _0x1771c2!==null&&!_[_0x3603('0x20')](_0x1771c2);};VoiceAgentReport[_0x3603('0x1d')]['syncAgentCalled']=function(_0x79c45a){try{if(this[_0x3603('0x1f')](_0x79c45a)){logger[_0x3603('0x21')](_0x3603('0x22'),_0x79c45a[_0x3603('0x23')],_0x79c45a['membername'],_0x79c45a[_0x3603('0x24')]);logger[_0x3603('0x25')](_0x3603('0x26'),_0x79c45a[_0x3603('0x23')],util[_0x3603('0x27')](_0x79c45a,{'showHidden':![],'depth':null}));if(_[_0x3603('0x20')](this[_0x3603('0x8')][_0x79c45a[_0x3603('0x23')]])){this['channels'][_0x79c45a['uniqueid']]={};}if(_[_0x3603('0x20')](this['channels'][_0x79c45a['uniqueid']][_0x79c45a['destuniqueid']])){this['channels'][_0x79c45a[_0x3603('0x23')]][_0x79c45a[_0x3603('0x24')]]={'agentcalledAt':moment()[_0x3603('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x3603('0x29'),'mandatoryDisposition':this[_0x3603('0xa')][_0x79c45a[_0x3603('0x2a')]]?this[_0x3603('0xa')][_0x79c45a[_0x3603('0x2a')]][_0x3603('0x2b')]||![]:![],'type':this[_0x3603('0xa')][_0x79c45a[_0x3603('0x2a')]]?this[_0x3603('0xa')][_0x79c45a['queue']]['type']||'inbound':'inbound','variables':this['variables'][_0x79c45a[_0x3603('0x23')]],'motionChannel':_0x3603('0x2c')};}_[_0x3603('0x2d')](this[_0x3603('0x8')][_0x79c45a['uniqueid']][_0x79c45a[_0x3603('0x24')]],_[_0x3603('0x2e')](_0x79c45a,['event',_0x3603('0x2f')]));logger[_0x3603('0x25')](_0x3603('0x30'),_0x79c45a[_0x3603('0x23')],util[_0x3603('0x27')](this[_0x3603('0x8')][_0x79c45a['uniqueid']][_0x79c45a[_0x3603('0x24')]],{'showHidden':![],'depth':null}));ami[_0x3603('0x1e')](_0x3603('0x31'),this[_0x3603('0x8')][_0x79c45a[_0x3603('0x23')]][_0x79c45a[_0x3603('0x24')]]);logger[_0x3603('0x25')](_0x3603('0x32'),_0x79c45a[_0x3603('0x23')],util['inspect'](this[_0x3603('0x8')][_0x79c45a[_0x3603('0x23')]][_0x79c45a['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x3603('0x28')]('user:%s',_0x79c45a[_0x3603('0x33')]),_0x3603('0x34'),this[_0x3603('0x8')][_0x79c45a[_0x3603('0x23')]][_0x79c45a['destuniqueid']]);}}catch(_0x42941a){logger[_0x3603('0x35')](_0x3603('0x36'),_0x79c45a['uniqueid'],util[_0x3603('0x27')](_0x42941a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x48222f){try{if(this['isNotNull'](_0x48222f)){if(this[_0x3603('0x8')][_0x48222f['uniqueid']]){logger[_0x3603('0x25')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x48222f[_0x3603('0x23')],util[_0x3603('0x27')](_0x48222f,{'showHidden':![],'depth':null}));for(var _0x2841c5 in this[_0x3603('0x8')][_0x48222f['uniqueid']]){if(this['channels'][_0x48222f[_0x3603('0x23')]][_0x3603('0x37')](_0x2841c5)){if(_0x48222f[_0x3603('0x24')]===_0x2841c5){logger[_0x3603('0x21')](_0x3603('0x38'),_0x48222f[_0x3603('0x23')],_0x48222f[_0x3603('0x33')],_0x48222f[_0x3603('0x24')]);this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x39')]=moment()['format'](_0x3603('0x3a'));this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5]['connectedlinename']=_0x48222f[_0x3603('0x3b')];this['channels'][_0x48222f['uniqueid']][_0x2841c5][_0x3603('0x3c')]=_0x48222f[_0x3603('0x3c')];this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x3d')]=_0x48222f[_0x3603('0x3d')];this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x3e')]=_0x48222f[_0x3603('0x3e')];this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x3f')]=_0x48222f[_0x3603('0x3f')];this[_0x3603('0x8')][_0x48222f['uniqueid']][_0x2841c5][_0x3603('0x40')]=_0x3603('0x41');if(this[_0x3603('0x9')][this['channels'][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x23')]]){var _0x48b59b=this['voiceChannels'][this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x23')]][_0x3603('0x42')];this[_0x3603('0x8')][_0x48222f['uniqueid']][_0x2841c5][_0x3603('0x42')]=_0x48b59b;_0x48222f['routealias']=_0x48b59b;}_[_0x3603('0x2d')](this['agents'][_0x48222f[_0x3603('0x43')]],_['pick'](_0x48222f,[_0x3603('0x2a'),_0x3603('0x44'),_0x3603('0x42')]));logger[_0x3603('0x25')](_0x3603('0x45'),_0x48222f['uniqueid'],util[_0x3603('0x27')](this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x48222f[_0x3603('0x24')]],{'showHidden':![],'depth':null}));ami[_0x3603('0x1e')](_0x3603('0x46'),this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x48222f[_0x3603('0x24')]]);logger[_0x3603('0x25')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x48222f[_0x3603('0x23')],util['inspect'](this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x48222f[_0x3603('0x24')]],{'showHidden':![],'depth':null}));this[_0x3603('0x1e')](util['format'](_0x3603('0x47'),_0x48222f['membername']),_0x3603('0x48'),this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x48222f[_0x3603('0x24')]]);}else if(!this[_0x3603('0x8')][_0x48222f['uniqueid']][_0x2841c5][_0x3603('0x10')]&&!this[_0x3603('0x8')][_0x48222f['uniqueid']][_0x2841c5]['agentcomplete']){logger[_0x3603('0x21')](_0x3603('0x49'),_0x48222f[_0x3603('0x23')],this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x33')],_0x2841c5);this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x10')]=!![];this[_0x3603('0x8')][_0x48222f['uniqueid']][_0x2841c5][_0x3603('0x4a')]=moment()['format'](_0x3603('0x3a'));this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x4b')]=_0x48222f[_0x3603('0x24')];this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x4c')]=_0x48222f[_0x3603('0x33')];this['channels'][_0x48222f['uniqueid']][_0x2841c5][_0x3603('0x40')]=_0x3603('0x4d');this['channels'][_0x48222f[_0x3603('0x23')]][_0x2841c5][_0x3603('0x4e')]='answered_elsewhere';logger['debug'](_0x3603('0x4f'),_0x48222f[_0x3603('0x23')],util['inspect'](this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5],{'showHidden':![],'depth':null}));ami[_0x3603('0x1e')]('custom:agentansweredelsewhere',this[_0x3603('0x8')][_0x48222f[_0x3603('0x23')]][_0x2841c5]);}}}}}}catch(_0x3de5c0){logger[_0x3603('0x35')](_0x3603('0x50'),_0x48222f[_0x3603('0x23')],util[_0x3603('0x27')](_0x3de5c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x4ac7b8){try{if(this[_0x3603('0x1f')](_0x4ac7b8)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x4ac7b8[_0x3603('0x23')],util['inspect'](_0x4ac7b8,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ac7b8['uniqueid']]&&this[_0x3603('0x8')][_0x4ac7b8[_0x3603('0x23')]][_0x4ac7b8[_0x3603('0x24')]]){logger[_0x3603('0x21')](_0x3603('0x51'),_0x4ac7b8[_0x3603('0x23')],_0x4ac7b8['membername'],_0x4ac7b8[_0x3603('0x24')]);this['channels'][_0x4ac7b8[_0x3603('0x23')]][_0x4ac7b8['destuniqueid']]['agentringnoanswer']=!![];this['channels'][_0x4ac7b8['uniqueid']][_0x4ac7b8[_0x3603('0x24')]]['agentringnoanswerAt']=moment()[_0x3603('0x28')](_0x3603('0x3a'));this[_0x3603('0x8')][_0x4ac7b8['uniqueid']][_0x4ac7b8['destuniqueid']][_0x3603('0x40')]=_0x3603('0x52');this[_0x3603('0x8')][_0x4ac7b8[_0x3603('0x23')]][_0x4ac7b8[_0x3603('0x24')]]['reason']='rejected';logger['debug'](_0x3603('0x53'),_0x4ac7b8[_0x3603('0x23')],util[_0x3603('0x27')](this[_0x3603('0x8')][_0x4ac7b8[_0x3603('0x23')]][_0x4ac7b8[_0x3603('0x24')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3603('0x54'),this[_0x3603('0x8')][_0x4ac7b8[_0x3603('0x23')]][_0x4ac7b8[_0x3603('0x24')]]);}}}catch(_0x52a68e){logger['error'](_0x3603('0x55'),_0x4ac7b8[_0x3603('0x23')],util['inspect'](_0x52a68e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x3f1763){try{if(this[_0x3603('0x1f')](_0x3f1763)){logger[_0x3603('0x25')](_0x3603('0x56'),_0x3f1763[_0x3603('0x23')],util[_0x3603('0x27')](_0x3f1763,{'showHidden':![],'depth':null}));if(this[_0x3603('0x8')][_0x3f1763[_0x3603('0x23')]]){for(var _0x14c8f5 in this[_0x3603('0x8')][_0x3f1763[_0x3603('0x23')]]){if(this[_0x3603('0x8')][_0x3f1763[_0x3603('0x23')]][_0x3603('0x37')](_0x14c8f5)&&!this[_0x3603('0x8')][_0x3f1763['uniqueid']][_0x14c8f5][_0x3603('0x10')]&&!this['channels'][_0x3f1763['uniqueid']][_0x14c8f5][_0x3603('0x13')]){logger[_0x3603('0x21')](_0x3603('0x57'),_0x3f1763[_0x3603('0x23')],this['channels'][_0x3f1763[_0x3603('0x23')]][_0x14c8f5][_0x3603('0x33')],_0x14c8f5);this[_0x3603('0x8')][_0x3f1763[_0x3603('0x23')]][_0x14c8f5][_0x3603('0x10')]=!![];this[_0x3603('0x8')][_0x3f1763['uniqueid']][_0x14c8f5][_0x3603('0x4a')]=moment()['format'](_0x3603('0x3a'));this['channels'][_0x3f1763[_0x3603('0x23')]][_0x14c8f5][_0x3603('0x40')]=_0x3603('0x58');this[_0x3603('0x8')][_0x3f1763['uniqueid']][_0x14c8f5][_0x3603('0x4e')]=_0x3603('0x58');logger['debug'](_0x3603('0x59'),_0x3f1763['uniqueid'],util[_0x3603('0x27')](this[_0x3603('0x8')][_0x3f1763[_0x3603('0x23')]][_0x14c8f5],{'showHidden':![],'depth':null}));ami[_0x3603('0x1e')]('custom:agentqueuecallerabandon',this[_0x3603('0x8')][_0x3f1763['uniqueid']][_0x14c8f5]);}}}}}catch(_0x61e701){logger['error'](_0x3603('0x5a'),_0x3f1763[_0x3603('0x23')],util[_0x3603('0x27')](_0x61e701,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x14')]=function(_0x306410){try{if(this[_0x3603('0x1f')](_0x306410)){logger[_0x3603('0x25')](_0x3603('0x5b'),_0x306410[_0x3603('0x23')],util[_0x3603('0x27')](_0x306410,{'showHidden':![],'depth':null}));if(this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]]){for(var _0xce8f8a in this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]]){if(this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]]['hasOwnProperty'](_0xce8f8a)){if(this[_0x3603('0x8')][_0x306410['uniqueid']][_0xce8f8a][_0x3603('0x39')]&&!this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]][_0xce8f8a][_0x3603('0x13')]){logger[_0x3603('0x21')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x306410[_0x3603('0x23')],this['channels'][_0x306410[_0x3603('0x23')]][_0xce8f8a]['membername'],_0xce8f8a);this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]][_0xce8f8a][_0x3603('0x13')]=!![];this['channels'][_0x306410[_0x3603('0x23')]][_0xce8f8a][_0x3603('0x5c')]=moment()[_0x3603('0x28')](_0x3603('0x3a'));this[_0x3603('0x8')][_0x306410['uniqueid']][_0xce8f8a][_0x3603('0x40')]=_0x3603('0x5d');this[_0x3603('0x8')][_0x306410['uniqueid']][_0xce8f8a][_0x3603('0x4e')]=_0x306410[_0x3603('0x4e')]=='transfer'?_0x3603('0x5e'):_0x306410[_0x3603('0x4e')];this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]][_0xce8f8a][_0x3603('0x5f')]=_0x306410[_0x3603('0x5f')];if(this[_0x3603('0xa')][_0x306410[_0x3603('0x2a')]]&&this[_0x3603('0xa')][_0x306410[_0x3603('0x2a')]][_0x3603('0x60')]){this['channels'][_0x306410[_0x3603('0x23')]][_0xce8f8a][_0x3603('0x61')]=this[_0x3603('0xa')][_0x306410[_0x3603('0x2a')]][_0x3603('0x62')];this['channels'][_0x306410['uniqueid']][_0xce8f8a]['agentacw']=!![];}this[_0x3603('0xb')][_0x306410[_0x3603('0x43')]]=_[_0x3603('0x2e')](this[_0x3603('0xb')][_0x306410['interface']],[_0x3603('0x2a'),_0x3603('0x44')]);logger['debug'](_0x3603('0x63'),_0x306410[_0x3603('0x23')],util[_0x3603('0x27')](this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]][_0xce8f8a],{'showHidden':![],'depth':null}));ami[_0x3603('0x1e')]('custom:agentcomplete',this[_0x3603('0x8')][_0x306410['uniqueid']][_0xce8f8a]);logger[_0x3603('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x306410['uniqueid'],util['inspect'](this[_0x3603('0x8')][_0x306410['uniqueid']][_0xce8f8a],{'showHidden':![],'depth':null}));this[_0x3603('0x1e')](util['format'](_0x3603('0x47'),_0x306410[_0x3603('0x33')]),'user:agentcomplete',this[_0x3603('0x8')][_0x306410[_0x3603('0x23')]][_0xce8f8a]);}}}}}}catch(_0x233c06){logger[_0x3603('0x35')](_0x3603('0x64'),_0x306410[_0x3603('0x23')],util['inspect'](_0x233c06,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x65')]=function(_0x2364cd){try{if(this[_0x3603('0x1f')](_0x2364cd)){logger['debug'](_0x3603('0x66'),_0x2364cd[_0x3603('0x23')],util[_0x3603('0x27')](_0x2364cd,{'showHidden':![],'depth':null}));this[_0x3603('0x67')](_0x2364cd[_0x3603('0x23')],_[_0x3603('0x68')](_0x2364cd[_0x3603('0x69')])[0x0],_0x2364cd[_0x3603('0x6a')]);if(this[_0x3603('0x8')][_0x2364cd[_0x3603('0x23')]]){for(var _0x4c4fcd in this[_0x3603('0x8')][_0x2364cd[_0x3603('0x23')]]){if(this[_0x3603('0x8')][_0x2364cd[_0x3603('0x23')]]['hasOwnProperty'](_0x4c4fcd)){logger[_0x3603('0x21')](_0x3603('0x6b'),_0x2364cd[_0x3603('0x23')],_0x4c4fcd,_[_0x3603('0x68')](_0x2364cd[_0x3603('0x69')])[0x0],_0x2364cd[_0x3603('0x6a')]);if(_['isUndefined'](this[_0x3603('0x8')][_0x2364cd[_0x3603('0x23')]][_0x4c4fcd]['variables'])){this[_0x3603('0x8')][_0x2364cd['uniqueid']][_0x4c4fcd][_0x3603('0xc')]={};}this[_0x3603('0x8')][_0x2364cd[_0x3603('0x23')]][_0x4c4fcd][_0x3603('0xc')]=this[_0x3603('0xc')][_0x2364cd[_0x3603('0x23')]];}}}}}catch(_0x4be129){logger[_0x3603('0x35')]('[%s][voiceAgentReport][varset]',_0x2364cd[_0x3603('0x23')],util[_0x3603('0x27')](_0x4be129,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x67')]=function(_0x24337c,_0x421ac9,_0x26fbf7){var _0xe9aac6=[_0x3603('0x6c'),_0x3603('0x6d'),_0x3603('0x6e'),_0x3603('0x6f'),_0x3603('0x70'),_0x3603('0x71'),_0x3603('0x72'),_0x3603('0x73'),_0x3603('0x74'),_0x3603('0x75'),_0x3603('0x76'),'bridgepvtcallid',_0x3603('0x77'),_0x3603('0x78'),_0x3603('0x79'),_0x3603('0x7a'),_0x3603('0x33'),_0x3603('0x7b'),_0x3603('0x7c')];if(!_[_0x3603('0x7d')](_0x421ac9)&&!_[_0x3603('0x7e')](_0xe9aac6,_0x421ac9)){if(_[_0x3603('0x20')](this['variables'][_0x24337c])){this[_0x3603('0xc')][_0x24337c]={};}this['variables'][_0x24337c][_0x421ac9]=_0x26fbf7;}};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x17')]=function(_0x1690c2){try{if(this[_0x3603('0x1f')](_0x1690c2)){logger[_0x3603('0x25')]('[%s][voiceAgentReport][hangup]\x20event:',_0x1690c2['uniqueid'],util[_0x3603('0x27')](_0x1690c2,{'showHidden':![],'depth':null}));if(this[_0x3603('0x8')][_0x1690c2['uniqueid']]){for(var _0x46f674 in this[_0x3603('0x8')][_0x1690c2[_0x3603('0x23')]]){if(this[_0x3603('0x8')][_0x1690c2[_0x3603('0x23')]][_0x3603('0x37')](_0x46f674)){if(this[_0x3603('0x8')][_0x1690c2[_0x3603('0x23')]][_0x46f674][_0x3603('0x4e')]==_0x3603('0x7f')&&this['channels'][_0x1690c2['uniqueid']][_0x46f674]['agentcomplete']){logger[_0x3603('0x21')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x1690c2[_0x3603('0x23')],_0x46f674);this['channels'][_0x1690c2['uniqueid']][_0x46f674][_0x3603('0x5c')]=moment()['format'](_0x3603('0x3a'));}}}logger[_0x3603('0x25')](_0x3603('0x80'),_0x1690c2[_0x3603('0x23')],util[_0x3603('0x27')](_[_0x3603('0x81')](this['channels'][_0x1690c2[_0x3603('0x23')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x3603('0x82'),_[_0x3603('0x81')](this[_0x3603('0x8')][_0x1690c2[_0x3603('0x23')]]));delete this['channels'][_0x1690c2[_0x3603('0x23')]];}if(this[_0x3603('0xc')][_0x1690c2[_0x3603('0x23')]]){delete this[_0x3603('0xc')][_0x1690c2[_0x3603('0x23')]];}}}catch(_0xb36826){logger['error'](_0x3603('0x83'),_0x1690c2['uniqueid'],util[_0x3603('0x27')](_0xb36826,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x84')]=function(_0x32b68d){try{if(this[_0x3603('0x1f')](_0x32b68d)){logger[_0x3603('0x25')](_0x3603('0x85'),_0x32b68d['uniqueid'],util[_0x3603('0x27')](_0x32b68d,{'showHidden':![],'depth':null}));if(this['channels'][_0x32b68d[_0x3603('0x86')]]){for(var _0x40c540 in this[_0x3603('0x8')][_0x32b68d[_0x3603('0x86')]]){if(this[_0x3603('0x8')][_0x32b68d[_0x3603('0x86')]][_0x3603('0x37')](_0x40c540)){if(_0x32b68d['origtransfereruniqueid']===_0x40c540){logger[_0x3603('0x21')](_0x3603('0x87'),_0x32b68d[_0x3603('0x23')],this[_0x3603('0x8')][_0x32b68d['transfereeuniqueid']][_0x40c540][_0x3603('0x33')],_0x40c540);var _0x4d611d=moment();this[_0x3603('0x8')][_0x32b68d[_0x3603('0x86')]][_0x40c540][_0x3603('0x13')]=!![];this[_0x3603('0x8')][_0x32b68d[_0x3603('0x86')]][_0x40c540][_0x3603('0x5c')]=moment()['format'](_0x3603('0x3a'));this[_0x3603('0x8')][_0x32b68d[_0x3603('0x86')]][_0x40c540][_0x3603('0x40')]=_0x3603('0x5d');this['channels'][_0x32b68d[_0x3603('0x86')]][_0x40c540]['reason']=_0x3603('0x7f');this[_0x3603('0x8')][_0x32b68d[_0x3603('0x86')]][_0x40c540]['talktime']=_0x4d611d[_0x3603('0x88')](this[_0x3603('0x8')][_0x32b68d['transfereeuniqueid']][_0x40c540][_0x3603('0x39')],_0x3603('0x89'));}}}}if(this[_0x3603('0x8')][_0x32b68d[_0x3603('0x8a')]]){var _0x2a8e1d=this[_0x3603('0x8')][_0x32b68d[_0x3603('0x8a')]];this[_0x3603('0x8')][_0x32b68d[_0x3603('0x8a')]]=this['channels'][_0x32b68d[_0x3603('0x86')]];this['channels'][_0x32b68d['transfereeuniqueid']]=_0x2a8e1d;}}}catch(_0xcf4441){logger[_0x3603('0x35')](_0x3603('0x8b'),_0x32b68d[_0x3603('0x23')],util['inspect'](_0xcf4441,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3603('0x1d')]['syncBlindTransfer']=function(_0xaf3702){try{if(this['isNotNull'](_0xaf3702)){logger[_0x3603('0x25')](_0x3603('0x8c'),_0xaf3702[_0x3603('0x23')],util[_0x3603('0x27')](_0xaf3702,{'showHidden':![],'depth':null}));if(this['channels'][_0xaf3702[_0x3603('0x86')]]){for(var _0x18f021 in this['channels'][_0xaf3702[_0x3603('0x86')]]){if(this[_0x3603('0x8')][_0xaf3702['transfereeuniqueid']][_0x3603('0x37')](_0x18f021)){if(_0xaf3702[_0x3603('0x8d')]===_0x18f021){logger[_0x3603('0x21')](_0x3603('0x8e'),_0xaf3702[_0x3603('0x23')],this['channels'][_0xaf3702[_0x3603('0x86')]][_0x18f021][_0x3603('0x33')],_0x18f021);var _0x457d87=moment();this[_0x3603('0x8')][_0xaf3702[_0x3603('0x86')]][_0x18f021][_0x3603('0x13')]=!![];this[_0x3603('0x8')][_0xaf3702[_0x3603('0x86')]][_0x18f021]['agentcompleteAt']=_0x457d87;this[_0x3603('0x8')][_0xaf3702['transfereeuniqueid']][_0x18f021][_0x3603('0x40')]=_0x3603('0x5d');this[_0x3603('0x8')][_0xaf3702[_0x3603('0x86')]][_0x18f021][_0x3603('0x4e')]='transfer';this[_0x3603('0x8')][_0xaf3702['transfereeuniqueid']][_0x18f021][_0x3603('0x5f')]=_0x457d87[_0x3603('0x88')](this['channels'][_0xaf3702[_0x3603('0x86')]][_0x18f021][_0x3603('0x39')],_0x3603('0x89'));}}}}}}catch(_0x2afdfe){logger[_0x3603('0x35')](_0x3603('0x8f'),_0xaf3702[_0x3603('0x23')],util[_0x3603('0x27')](_0x2afdfe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x90')]=function(_0x74cab8){var _0x1c5fbe='';try{if(this[_0x3603('0x1f')](_0x74cab8)){logger[_0x3603('0x25')](_0x3603('0x91'),_0x74cab8[_0x3603('0x23')],util[_0x3603('0x27')](_0x74cab8,{'showHidden':![],'depth':null}));if(_0x74cab8['channel']){_0x1c5fbe=_0x74cab8['channel'][_0x3603('0x92')](0x0,_0x74cab8[_0x3603('0x93')][_0x3603('0x94')]('-'));if(this[_0x3603('0xb')][_0x1c5fbe]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x74cab8[_0x3603('0x23')],_0x1c5fbe);this[_0x3603('0xb')][_0x1c5fbe][_0x3603('0x95')]=!![];}}}}catch(_0x5dc4bc){logger[_0x3603('0x35')]('[%s][voiceAgentReport][musiconholdstart]',_0x74cab8[_0x3603('0x23')],util['inspect'](_0x5dc4bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3603('0x1d')][_0x3603('0x1a')]=function(_0x560070){var _0x350d62='';try{if(this[_0x3603('0x1f')](_0x560070)){logger[_0x3603('0x25')](_0x3603('0x96'),_0x560070[_0x3603('0x23')],util[_0x3603('0x27')](_0x560070,{'showHidden':![],'depth':null}));if(_0x560070[_0x3603('0x93')]){_0x350d62=_0x560070[_0x3603('0x93')][_0x3603('0x92')](0x0,_0x560070['channel'][_0x3603('0x94')]('-'));if(this['agents'][_0x350d62]){logger[_0x3603('0x21')](_0x3603('0x97'),_0x560070['uniqueid'],_0x350d62);this[_0x3603('0xb')][_0x350d62]['onhold']=![];}}}}catch(_0x5b594a){logger[_0x3603('0x35')](_0x3603('0x98'),_0x560070[_0x3603('0x23')],util['inspect'](_0x5b594a,{'showHidden':![],'depth':null}));}};module[_0x3603('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 8216d28..3bb63c3 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 _0x5fc8=['milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','startsWith','starttime','duration','subtract','seconds','pick','includes','lastapplication','lastdata','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','replace','.wav49','.WAV','monitorFilename','monitors','isNil','push','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','isEmpty','getSettings','stopRecordingOnTransfer','resolve','then','StopMixMonitor','catch','Action','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','transferType','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime'];(function(_0x180d27,_0x5dca4c){var _0x3ad9be=function(_0x9dbd29){while(--_0x9dbd29){_0x180d27['push'](_0x180d27['shift']());}};_0x3ad9be(++_0x5dca4c);}(_0x5fc8,0xd4));var _0x85fc=function(_0x30892c,_0xfe29a8){_0x30892c=_0x30892c-0x0;var _0x3f0e6a=_0x5fc8[_0x30892c];return _0x3f0e6a;};'use strict';var BPromise=require(_0x85fc('0x0'));var _=require('lodash');var moment=require(_0x85fc('0x1'));var util=require(_0x85fc('0x2'));var path=require('path');var Redis=require(_0x85fc('0x3'));var config=require(_0x85fc('0x4'));var logger=require(_0x85fc('0x5'))('ami');var ami=require(_0x85fc('0x6'));var Channel=require(_0x85fc('0x7'));var RpcSetting=require(_0x85fc('0x8'));var statusDesc=[_0x85fc('0x9'),_0x85fc('0xa'),_0x85fc('0xb'),_0x85fc('0xc'),_0x85fc('0xd'),_0x85fc('0xe'),_0x85fc('0xf'),_0x85fc('0x10'),_0x85fc('0x11')];var applications=[_0x85fc('0x12'),_0x85fc('0x13'),_0x85fc('0x14'),_0x85fc('0x15'),_0x85fc('0x16'),_0x85fc('0x17')];var dispositions=[_0x85fc('0x18'),'FAILED','FAILED',_0x85fc('0x18'),_0x85fc('0x18'),_0x85fc('0x18'),_0x85fc('0x19'),_0x85fc('0x1a'),_0x85fc('0x1b'),_0x85fc('0x1b'),_0x85fc('0x1b')];var actions={};config[_0x85fc('0x1c')]=_[_0x85fc('0x1d')](config['redis'],{'host':_0x85fc('0x1e'),'port':0x18eb});var io=require(_0x85fc('0x1f'))(new Redis(config[_0x85fc('0x1c')]));function VoiceCallReport(_0x529b31){this[_0x85fc('0x20')]=_0x529b31[_0x85fc('0x20')];this['agents']=_0x529b31[_0x85fc('0x21')];this[_0x85fc('0x22')]={};ami['on'](_0x85fc('0x23'),this[_0x85fc('0x24')][_0x85fc('0x25')](this));ami['on'](_0x85fc('0x26'),this[_0x85fc('0x24')]['bind'](this));ami['on'](_0x85fc('0x27'),this[_0x85fc('0x28')][_0x85fc('0x25')](this));ami['on'](_0x85fc('0x29'),this['syncNewState'][_0x85fc('0x25')](this));ami['on']('varset',this[_0x85fc('0x2a')]['bind'](this));ami['on'](_0x85fc('0x2b'),this[_0x85fc('0x2c')][_0x85fc('0x25')](this));ami['on'](_0x85fc('0x2d'),this['syncNewCallerId'][_0x85fc('0x25')](this));ami['on'](_0x85fc('0x2e'),this[_0x85fc('0x2f')][_0x85fc('0x25')](this));ami['on'](_0x85fc('0x30'),this[_0x85fc('0x31')][_0x85fc('0x25')](this));ami['on'](_0x85fc('0x32'),this['syncMusicOnHoldStart'][_0x85fc('0x25')](this));ami['on'](_0x85fc('0x33'),this[_0x85fc('0x34')][_0x85fc('0x25')](this));try{logger[_0x85fc('0x35')](_0x85fc('0x36'));ami[_0x85fc('0x37')]();}catch(_0x40517b){logger[_0x85fc('0x38')](_0x85fc('0x39'),util[_0x85fc('0x3a')](_0x40517b,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x85fc('0x3b')]=function(_0x316de0){return _0x316de0!==null&&!_[_0x85fc('0x3c')](_0x316de0);};VoiceCallReport[_0x85fc('0x3d')]['emit']=function(_0x5addb5,_0x2b4e6f,_0x2a487b){io['to'](_0x5addb5)[_0x85fc('0x3e')](_0x2b4e6f,_0x2a487b);};VoiceCallReport[_0x85fc('0x3d')]['syncNewCallerId']=function(_0x4c56ef){try{if(this[_0x85fc('0x3b')](_0x4c56ef)){logger[_0x85fc('0x35')](_0x85fc('0x3f'),_0x4c56ef[_0x85fc('0x40')],_0x4c56ef[_0x85fc('0x41')],_0x4c56ef[_0x85fc('0x42')]);logger[_0x85fc('0x43')](_0x85fc('0x44'),_0x4c56ef[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x4c56ef,{'showHidden':![],'depth':null}));if(_0x4c56ef[_0x85fc('0x40')]===_0x4c56ef[_0x85fc('0x45')]){if(!_[_0x85fc('0x3c')](this[_0x85fc('0x20')][_0x4c56ef[_0x85fc('0x40')]])){_[_0x85fc('0x46')](this[_0x85fc('0x20')][_0x4c56ef[_0x85fc('0x40')]],_['pick'](_0x4c56ef,_[_0x85fc('0x47')](this[_0x85fc('0x20')][_0x4c56ef[_0x85fc('0x40')]])));}}if(_0x4c56ef[_0x85fc('0x48')]===_0x85fc('0x49')){if(this[_0x85fc('0x21')][_0x4c56ef[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]){if(_0x4c56ef[_0x85fc('0x4c')]==_0x85fc('0x4d')){this[_0x85fc('0x21')][_0x4c56ef[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x4e')]=_0x4c56ef[_0x85fc('0x4f')];this['emit'](util[_0x85fc('0x50')](_0x85fc('0x51'),this[_0x85fc('0x21')][_0x4c56ef[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x52')]),_0x85fc('0x53'),{'destaccountcode':this[_0x85fc('0x21')][_0x4c56ef[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x54')],'destconnectedlinenum':_0x4c56ef['connectedlinenum']});}}}}}catch(_0x35699f){logger[_0x85fc('0x38')](_0x85fc('0x55'),_0x4c56ef['uniqueid'],util[_0x85fc('0x3a')](_0x35699f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x85fc('0x28')]=function(_0x30bb16){try{if(this['isNotNull'](_0x30bb16)){logger[_0x85fc('0x43')](_0x85fc('0x56'),_0x30bb16[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x30bb16,{'showHidden':![],'depth':null}));if(_0x30bb16[_0x85fc('0x40')]===_0x30bb16[_0x85fc('0x45')]&&_0x30bb16['channel']!='OutgoingSpoolFailed'){if(_[_0x85fc('0x3c')](this[_0x85fc('0x20')][_0x30bb16[_0x85fc('0x40')]])){logger[_0x85fc('0x35')](_0x85fc('0x57'),_0x30bb16[_0x85fc('0x40')],_0x30bb16[_0x85fc('0x48')],_0x30bb16[_0x85fc('0x4c')]);this[_0x85fc('0x20')][_0x30bb16['uniqueid']]=new Channel();this[_0x85fc('0x20')][_0x30bb16[_0x85fc('0x40')]]['starttime']=moment()[_0x85fc('0x50')](_0x85fc('0x58'));this[_0x85fc('0x20')][_0x30bb16['uniqueid']][_0x85fc('0x59')]=dispositions[_[_0x85fc('0x5a')](_0x30bb16[_0x85fc('0x5b')])];_[_0x85fc('0x46')](this['channels'][_0x30bb16['uniqueid']],_['pick'](_0x30bb16,_[_0x85fc('0x47')](this['channels'][_0x30bb16[_0x85fc('0x40')]])));if(_0x30bb16['context']===_0x85fc('0x49')){if(this[_0x85fc('0x21')][_0x30bb16[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]){if(_['isUndefined'](this[_0x85fc('0x21')][_0x30bb16[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x4e')])){this[_0x85fc('0x21')][_0x30bb16[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x4e')]=_0x30bb16[_0x85fc('0x4c')];logger['debug'](_0x85fc('0x5c'),_0x30bb16[_0x85fc('0x40')],util[_0x85fc('0x3a')]({'destaccountcode':this[_0x85fc('0x21')][_0x30bb16[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x54')],'destconnectedlinenum':_0x30bb16['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0x85fc('0x50')](_0x85fc('0x51'),this[_0x85fc('0x21')][_0x30bb16['channel'][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x52')]),'user:agentconnect',{'destaccountcode':this[_0x85fc('0x21')][_0x30bb16[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x30bb16[_0x85fc('0x4c')]});}}}}}}}catch(_0xe132fd){logger['error']('[%s][voiceCallReport][newchannel]',_0x30bb16['uniqueid'],util[_0x85fc('0x3a')](_0xe132fd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x85fc('0x24')]=function(_0x293a8d){try{if(this[_0x85fc('0x3b')](_0x293a8d)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x293a8d[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x293a8d,{'showHidden':![],'depth':null}));if(_0x293a8d[_0x85fc('0x40')]===_0x293a8d[_0x85fc('0x45')]&&_0x293a8d[_0x85fc('0x4c')]!='h'&&_0x293a8d[_0x85fc('0x4a')]!=_0x85fc('0x5d')){_0x293a8d[_0x85fc('0x5e')]=_0x293a8d[_0x85fc('0x5e')][_0x85fc('0x5f')]();_0x293a8d[_0x85fc('0x60')]=_0x293a8d['appdata']&&_0x293a8d[_0x85fc('0x61')][_0x85fc('0x62')]('CDR(routeAlias)')?_0x293a8d[_0x85fc('0x61')]:(_0x293a8d[_0x85fc('0x61')]||_0x293a8d[_0x85fc('0x60')])[_0x85fc('0x5f')]();logger[_0x85fc('0x35')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x293a8d[_0x85fc('0x40')],_0x293a8d[_0x85fc('0x5e')],_0x293a8d[_0x85fc('0x60')]);if(_[_0x85fc('0x3c')](this['channels'][_0x293a8d[_0x85fc('0x40')]])){this[_0x85fc('0x20')][_0x293a8d[_0x85fc('0x40')]]=new Channel();this['channels'][_0x293a8d[_0x85fc('0x40')]][_0x85fc('0x63')]=_0x293a8d[_0x85fc('0x64')]?moment()[_0x85fc('0x65')](moment[_0x85fc('0x64')](_0x293a8d[_0x85fc('0x64')])[_0x85fc('0x66')](),'seconds')[_0x85fc('0x50')](_0x85fc('0x58')):moment()['format'](_0x85fc('0x58'));this[_0x85fc('0x20')][_0x293a8d[_0x85fc('0x40')]][_0x85fc('0x59')]='NO\x20ANSWER';}_[_0x85fc('0x46')](this['channels'][_0x293a8d[_0x85fc('0x40')]],_[_0x85fc('0x67')](_0x293a8d,_[_0x85fc('0x47')](this[_0x85fc('0x20')][_0x293a8d[_0x85fc('0x40')]])));if(_[_0x85fc('0x68')](applications,_0x293a8d[_0x85fc('0x5e')])){this[_0x85fc('0x20')][_0x293a8d[_0x85fc('0x40')]][_0x85fc('0x69')]=_0x293a8d[_0x85fc('0x5e')];this[_0x85fc('0x20')][_0x293a8d[_0x85fc('0x40')]][_0x85fc('0x6a')]=_0x293a8d[_0x85fc('0x60')];if(_0x293a8d[_0x85fc('0x5e')]==='set'&&_[_0x85fc('0x62')](_0x293a8d[_0x85fc('0x60')]['toLowerCase'](),'cdr(')){var _0x3f92a3=_0x293a8d[_0x85fc('0x60')][_0x85fc('0x4b')]('=');var _0x361fad=_0x3f92a3[0x0][_0x85fc('0x5f')]()[_0x85fc('0x6b')](/cdr\((.*)\)/);if(_0x361fad){this[_0x85fc('0x20')][_0x293a8d[_0x85fc('0x40')]][_0x361fad[0x1]]=_0x3f92a3[0x1];}}else if(_0x293a8d['application']===_0x85fc('0x13')){this['channels'][_0x293a8d['uniqueid']]['queue']=_0x293a8d[_0x85fc('0x60')][_0x85fc('0x4b')](',')[0x0];}}}}}catch(_0x4f3bc7){logger[_0x85fc('0x38')](_0x85fc('0x6c'),_0x293a8d[_0x85fc('0x40')],util['inspect'](_0x4f3bc7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85fc('0x3d')][_0x85fc('0x6d')]=function(_0x2d6b29){try{if(this[_0x85fc('0x3b')](_0x2d6b29)){logger[_0x85fc('0x35')](_0x85fc('0x6e'),_0x2d6b29[_0x85fc('0x40')],_0x2d6b29[_0x85fc('0x45')],_0x2d6b29[_0x85fc('0x41')],_0x2d6b29['calleridnum']);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x2d6b29['uniqueid'],util[_0x85fc('0x3a')](_0x2d6b29,{'showHidden':![],'depth':null}));if(_0x2d6b29[_0x85fc('0x40')]!==_0x2d6b29[_0x85fc('0x45')]){if(this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]]){if(_0x2d6b29['channelstate']==='6'){if(!this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x6f')]){var _0x517598=moment();this['channels'][_0x2d6b29['linkedid']][_0x85fc('0x6f')]=!![];this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x70')]=_0x517598['format'](_0x85fc('0x58'));if(this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x63')]){this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x71')]=_0x517598[_0x85fc('0x72')](this['channels'][_0x2d6b29['linkedid']]['starttime'],_0x85fc('0x66'));}}this[_0x85fc('0x20')][_0x2d6b29['linkedid']][_0x85fc('0x45')]=_0x2d6b29[_0x85fc('0x40')];if(_0x2d6b29[_0x85fc('0x42')]!==_0x85fc('0x4d')){this['channels'][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x4f')]=_0x2d6b29[_0x85fc('0x42')];}this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]]['connectedlinename']=_0x2d6b29[_0x85fc('0x41')];this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x73')]=_0x2d6b29[_0x85fc('0x4a')];this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]]['disposition']=dispositions[_[_0x85fc('0x5a')](_0x2d6b29[_0x85fc('0x5b')])];if(this[_0x85fc('0x21')][_0x2d6b29[_0x85fc('0x4a')]['split']('-')[0x0]]){this['channels'][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x74')]=this[_0x85fc('0x21')][_0x2d6b29[_0x85fc('0x4a')]['split']('-')[0x0]]['id'];this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x45')]][_0x85fc('0x75')]=this['agents'][_0x2d6b29['channel'][_0x85fc('0x4b')]('-')[0x0]]['name'];}}}}else{if(this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x40')]]){if(_0x2d6b29[_0x85fc('0x5b')]==='6'){if(this[_0x85fc('0x21')][_0x2d6b29[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]){this['channels'][_0x2d6b29[_0x85fc('0x40')]]['UserId']=this['agents'][_0x2d6b29[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]['id'];this['channels'][_0x2d6b29[_0x85fc('0x40')]][_0x85fc('0x75')]=this['agents'][_0x2d6b29[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x52')];}}}}if(_0x2d6b29['channelstate']==='6'&&_0x2d6b29[_0x85fc('0x48')]===_0x85fc('0x49')){if(this['agents'][_0x2d6b29[_0x85fc('0x4a')]['split']('-')[0x0]]){this[_0x85fc('0x21')][_0x2d6b29[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x4e')]=_0x2d6b29['exten'];var _0x127dd7;if(this[_0x85fc('0x20')][_0x2d6b29[_0x85fc('0x40')]])_0x127dd7=this[_0x85fc('0x20')][_0x2d6b29['uniqueid']][_0x85fc('0x76')];else if(this['channels'][_0x2d6b29[_0x85fc('0x45')]])_0x127dd7=this['channels'][_0x2d6b29['linkedid']][_0x85fc('0x76')];logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x2d6b29[_0x85fc('0x40')],util[_0x85fc('0x3a')]({'destaccountcode':this[_0x85fc('0x21')][_0x2d6b29['channel'][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x54')],'destconnectedlinenum':_0x2d6b29['exten'],'routealias':_0x127dd7},{'showHidden':![],'depth':null}));this[_0x85fc('0x3e')](util['format'](_0x85fc('0x51'),this[_0x85fc('0x21')][_0x2d6b29[_0x85fc('0x4a')]['split']('-')[0x0]][_0x85fc('0x52')]),_0x85fc('0x53'),{'destaccountcode':this[_0x85fc('0x21')][_0x2d6b29[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x54')],'destconnectedlinenum':_0x2d6b29[_0x85fc('0x4c')],'routealias':_0x127dd7});}}}}catch(_0xf24d9e){logger[_0x85fc('0x38')](_0x85fc('0x77'),_0x2d6b29[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0xf24d9e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85fc('0x3d')]['syncMixMonitorFilename']=function(_0xcd9702,_0x38abfc){try{if(this['channels'][_0xcd9702]){logger['info'](_0x85fc('0x78'),_0xcd9702,_0x38abfc);this[_0x85fc('0x20')][_0xcd9702][_0x85fc('0x79')]=!![];if(_['endsWith'](_0x38abfc,'.wav49')){_0x38abfc=_0x38abfc[_0x85fc('0x7a')](_0x85fc('0x7b'),_0x85fc('0x7c'));}this[_0x85fc('0x20')][_0xcd9702][_0x85fc('0x7d')]=_0x38abfc;var _0x1f8561=_['find'](this[_0x85fc('0x20')][_0xcd9702][_0x85fc('0x7e')],{'filename':_0x38abfc});if(_[_0x85fc('0x7f')](_0x1f8561)){this['channels'][_0xcd9702][_0x85fc('0x7e')][_0x85fc('0x80')]({'filename':_0x38abfc,'createdAt':moment()['format'](_0x85fc('0x58')),'mixmonitorid':'','status':'rec'});}}}catch(_0x4b75c8){logger[_0x85fc('0x38')]('[%s][voiceCallReport][mixMonitorFilename]',_0xcd9702,util[_0x85fc('0x3a')](_0x4b75c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85fc('0x3d')][_0x85fc('0x2a')]=function(_0x459b7d){try{if(this[_0x85fc('0x3b')](_0x459b7d)){logger[_0x85fc('0x43')]('[%s][voiceCallReport][varset]\x20event:',_0x459b7d['uniqueid'],util[_0x85fc('0x3a')](_0x459b7d,{'showHidden':![],'depth':null}));if(this['channels'][_0x459b7d[_0x85fc('0x40')]]&&_0x459b7d[_0x85fc('0x4a')]!=_0x85fc('0x5d')){if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')])){if(this[_0x85fc('0x3b')](_0x459b7d['variable'][_0x85fc('0x82')])){logger[_0x85fc('0x35')](_0x85fc('0x83'),_0x459b7d[_0x85fc('0x40')],_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x85')](_0x459b7d[_0x85fc('0x40')],_0x459b7d[_0x85fc('0x84')]);}else if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')][_0x85fc('0x86')])){logger[_0x85fc('0x35')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x459b7d[_0x85fc('0x40')],_0x459b7d['value']);this[_0x85fc('0x20')][_0x459b7d[_0x85fc('0x40')]]['calleridnum']=_0x459b7d[_0x85fc('0x84')];}else if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')][_0x85fc('0x87')])){logger[_0x85fc('0x35')](_0x85fc('0x88'),_0x459b7d['uniqueid'],_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x20')][_0x459b7d[_0x85fc('0x40')]][_0x85fc('0x89')]=_0x459b7d[_0x85fc('0x84')];}else if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')][_0x85fc('0x8a')])){logger[_0x85fc('0x35')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x459b7d['uniqueid'],_0x459b7d['value']);this[_0x85fc('0x20')][_0x459b7d[_0x85fc('0x40')]][_0x85fc('0x8b')]=_0x459b7d[_0x85fc('0x84')];}else if(this['isNotNull'](_0x459b7d['variable']['xmd-queue'])){logger['info'](_0x85fc('0x8c'),_0x459b7d['uniqueid'],_0x459b7d[_0x85fc('0x84')][_0x85fc('0x4b')](',')[0x0]);this['channels'][_0x459b7d[_0x85fc('0x40')]]['queue']=_0x459b7d['value'][_0x85fc('0x4b')](',')[0x0];}else if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')][_0x85fc('0x8d')])){logger['info'](_0x85fc('0x8e'),_0x459b7d[_0x85fc('0x40')],_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x20')][_0x459b7d[_0x85fc('0x40')]][_0x85fc('0x8f')]=_0x459b7d[_0x85fc('0x84')];}else if(this[_0x85fc('0x3b')](_0x459b7d['variable'][_0x85fc('0x90')])){logger[_0x85fc('0x35')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x459b7d[_0x85fc('0x40')],_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x20')][_0x459b7d['uniqueid']]['destination']=_0x459b7d[_0x85fc('0x84')];}else if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')][_0x85fc('0x91')])){logger['info'](_0x85fc('0x92'),_0x459b7d[_0x85fc('0x40')],_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x20')][_0x459b7d['uniqueid']]['calleridpreview']=_0x459b7d['value'];}else if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')][_0x85fc('0x93')])){logger[_0x85fc('0x35')](_0x85fc('0x94'),_0x459b7d[_0x85fc('0x40')],_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x20')][_0x459b7d[_0x85fc('0x40')]]['queue']=_0x459b7d['value'];}else if(this[_0x85fc('0x3b')](_0x459b7d[_0x85fc('0x81')][_0x85fc('0x95')])){logger[_0x85fc('0x35')](_0x85fc('0x96'),_0x459b7d[_0x85fc('0x40')],_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x20')][_0x459b7d[_0x85fc('0x40')]][_0x85fc('0x97')]=_0x459b7d[_0x85fc('0x84')];}}}else if(this[_0x85fc('0x3b')](_0x459b7d['variable'][_0x85fc('0x82')])){if(_0x459b7d['value']){var _0x23509d=path[_0x85fc('0x98')](_0x459b7d[_0x85fc('0x84')])[_0x85fc('0x52')];logger[_0x85fc('0x35')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x23509d,_0x459b7d[_0x85fc('0x84')]);this[_0x85fc('0x85')](_0x23509d,_0x459b7d[_0x85fc('0x84')]);}}else if(this[_0x85fc('0x20')][_0x459b7d[_0x85fc('0x45')]]){if(this[_0x85fc('0x3b')](_0x459b7d['variable'])){if(this['isNotNull'](_0x459b7d[_0x85fc('0x81')]['sipcallid'])){logger['info'](_0x85fc('0x96'),_0x459b7d[_0x85fc('0x45')],_0x459b7d['value']);this[_0x85fc('0x20')][_0x459b7d['linkedid']][_0x85fc('0x99')]=_0x459b7d[_0x85fc('0x84')];}}}}}catch(_0x41dae7){logger[_0x85fc('0x38')](_0x85fc('0x9a'),_0x459b7d[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x41dae7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85fc('0x3d')][_0x85fc('0x2c')]=function(_0x526794){try{if(this[_0x85fc('0x3b')](_0x526794)){logger[_0x85fc('0x43')](_0x85fc('0x9b'),_0x526794[_0x85fc('0x40')],util['inspect'](_0x526794,{'showHidden':![],'depth':null}));if(this[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]]){logger[_0x85fc('0x35')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x526794[_0x85fc('0x40')],_0x526794['cause-txt']);var _0x1123ee=moment();this['channels'][_0x526794[_0x85fc('0x40')]]['endtime']=_0x1123ee[_0x85fc('0x50')](_0x85fc('0x58'));this[_0x85fc('0x20')][_0x526794['uniqueid']][_0x85fc('0x64')]=_0x1123ee[_0x85fc('0x72')](this[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]][_0x85fc('0x63')],'seconds');if(this[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]]['answered']){this[_0x85fc('0x20')][_0x526794['uniqueid']]['billableseconds']=_0x1123ee['diff'](this[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]][_0x85fc('0x70')],_0x85fc('0x66'));this['channels'][_0x526794['uniqueid']]['holdtime']=this[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]][_0x85fc('0x64')]-this['channels'][_0x526794[_0x85fc('0x40')]][_0x85fc('0x9c')];}if(_0x526794[_0x85fc('0x48')]===_0x85fc('0x49')){if(this[_0x85fc('0x21')][_0x526794[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]){this[_0x85fc('0x21')][_0x526794['channel']['split']('-')[0x0]]=_[_0x85fc('0x9d')](this[_0x85fc('0x21')][_0x526794[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]],[_0x85fc('0x4e')]);logger['debug'](_0x85fc('0x9e'),_0x526794['uniqueid'],util['inspect']({'id':this[_0x85fc('0x21')][_0x526794[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]['id'],'destaccountcode':this[_0x85fc('0x21')][_0x526794[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]][_0x85fc('0x54')]},{'showHidden':![],'depth':null}));this[_0x85fc('0x3e')](util[_0x85fc('0x50')](_0x85fc('0x51'),this[_0x85fc('0x21')][_0x526794['channel']['split']('-')[0x0]][_0x85fc('0x52')]),_0x85fc('0x9f'),{'id':this[_0x85fc('0x21')][_0x526794['channel'][_0x85fc('0x4b')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x526794[_0x85fc('0x4a')][_0x85fc('0x4b')]('-')[0x0]]['accountcode']});}}var _0x5d250a=this;Promise['resolve']()['then'](function(){var _0x2bceb7=_0x5d250a['channels'][_0x526794[_0x85fc('0x40')]];if(typeof _0x2bceb7['transferType']==='undefined')return;if(_[_0x85fc('0xa0')](_0x2bceb7['monitors']))return;return RpcSetting[_0x85fc('0xa1')]()['then'](function(_0x11c2bd){if(!_0x11c2bd[_0x85fc('0xa2')])return;return Promise[_0x85fc('0xa3')]()[_0x85fc('0xa4')](function(){return ami['Action']({'action':_0x85fc('0xa5'),'channel':_0x2bceb7[_0x85fc('0x4a')]})[_0x85fc('0xa6')](function(){});})[_0x85fc('0xa4')](function(){return ami[_0x85fc('0xa7')]({'action':_0x85fc('0xa5'),'channel':_0x2bceb7[_0x85fc('0x73')]})[_0x85fc('0xa6')](function(){})[_0x85fc('0xa8')](function(){var _0x41f5ad=_0x5d250a[_0x85fc('0x21')][_0x2bceb7[_0x85fc('0x73')][_0x85fc('0x4b')]('-')[0x0]];if(!_0x41f5ad)return;io[_0x85fc('0x3e')]('webbar:stopmonitors',{'agentId':_0x41f5ad['id'],'uniqueid':_0x2bceb7[_0x85fc('0x40')]});});});});})[_0x85fc('0xa4')](function(){if(_0x526794[_0x85fc('0xa9')]===_0x85fc('0xaa')){_0x5d250a['blindTransfers'][_0x526794[_0x85fc('0x40')]]=_0x5d250a[_0x85fc('0x20')][_0x526794['uniqueid']];}else{if(_0x5d250a[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]]['type']===_0x85fc('0xab')&&_0x5d250a['blindTransfers'][_0x526794[_0x85fc('0x40')]]){_0x5d250a[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]][_0x85fc('0x40')]=[_0x5d250a[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]][_0x85fc('0x45')],_0x5d250a['channels'][_0x526794[_0x85fc('0x40')]][_0x85fc('0x45')]=_0x5d250a[_0x85fc('0x20')][_0x526794['uniqueid']][_0x85fc('0x40')]][0x0];delete _0x5d250a['blindTransfers'][_0x526794[_0x85fc('0x40')]];}}logger[_0x85fc('0x43')](_0x85fc('0xac'),_0x526794[_0x85fc('0x40')],util['inspect'](_0x5d250a[_0x85fc('0x20')][_0x526794[_0x85fc('0x40')]],{'showHidden':![],'depth':null}));ami[_0x85fc('0x3e')](_0x85fc('0xad'),_0x5d250a[_0x85fc('0x20')][_0x526794['uniqueid']]);delete _0x5d250a['channels'][_0x526794[_0x85fc('0x40')]];});}}}catch(_0x159ca6){logger[_0x85fc('0x38')]('[%s][voiceCallReport][hangup]',_0x526794[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x159ca6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x85fc('0x2f')]=function(_0x56eff3){try{if(this[_0x85fc('0x3b')](_0x56eff3)){logger['info'](_0x85fc('0xae'),_0x56eff3[_0x85fc('0x40')],_0x56eff3[_0x85fc('0xaf')],_0x56eff3[_0x85fc('0xb0')]);logger[_0x85fc('0x43')](_0x85fc('0xb1'),_0x56eff3[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x56eff3,{'showHidden':![],'depth':null}));if(this['channels'][_0x56eff3[_0x85fc('0xb2')]]){this['channels'][_0x56eff3[_0x85fc('0xb2')]][_0x85fc('0xb3')]=_0x56eff3['origtransferercalleridnum'];this[_0x85fc('0x20')][_0x56eff3['transfereeuniqueid']]['transferconnectedlinenum']=_0x56eff3[_0x85fc('0xb0')];if(this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb4')]]){var _0x2b928f=this['channels'][_0x56eff3[_0x85fc('0xb4')]];this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb4')]]=this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb2')]];this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb2')]]=_0x2b928f;}}else if(this[_0x85fc('0x20')][_0x56eff3['transfertargetuniqueid']]){this['channels'][_0x56eff3[_0x85fc('0xb5')]][_0x85fc('0xb3')]=_0x56eff3['origtransferercalleridnum'];this['channels'][_0x56eff3['transfertargetuniqueid']]['transferconnectedlinenum']=_0x56eff3[_0x85fc('0xb0')];if(this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb6')]]){var _0x2b928f=this['channels'][_0x56eff3[_0x85fc('0xb6')]];this[_0x85fc('0x20')][_0x56eff3['origtransfereruniqueid']]=this['channels'][_0x56eff3['transfertargetuniqueid']];this[_0x85fc('0x20')][_0x56eff3['transfertargetuniqueid']]=_0x2b928f;}}if((this['channels'][_0x56eff3['origtransfereruniqueid']]||this[_0x85fc('0x20')][_0x56eff3['origtransfererlinkedid']])&&this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb4')]]){var _0x418dfd=_[_0x85fc('0xb7')]([this['channels'][_0x56eff3[_0x85fc('0xb6')]],this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb8')]],this['channels'][_0x56eff3[_0x85fc('0xb4')]]],function(_0x5abee2){return _0x5abee2&&_0x5abee2[_0x85fc('0x8b')]==='outbound'&&_0x5abee2[_0x85fc('0xb9')];});if(_0x418dfd){if(this['channels'][_0x56eff3[_0x85fc('0xb6')]])this['channels'][_0x56eff3[_0x85fc('0xb6')]][_0x85fc('0xba')]='ATTENDED';if(this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb8')]])this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb8')]][_0x85fc('0xba')]=_0x85fc('0xbb');this[_0x85fc('0x20')][_0x56eff3[_0x85fc('0xb4')]][_0x85fc('0xba')]=_0x85fc('0xbb');}}}}catch(_0x432cb2){logger['error'](_0x85fc('0xbc'),_0x56eff3[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x432cb2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85fc('0x3d')]['syncBlindTransfer']=function(_0x5b78c2){try{if(this[_0x85fc('0x3b')](_0x5b78c2)){logger[_0x85fc('0x35')](_0x85fc('0xbd'),_0x5b78c2[_0x85fc('0x40')],_0x5b78c2[_0x85fc('0xbe')],_0x5b78c2[_0x85fc('0xbf')]);logger[_0x85fc('0x43')](_0x85fc('0xc0'),_0x5b78c2[_0x85fc('0x40')],util['inspect'](_0x5b78c2,{'showHidden':![],'depth':null}));if(this['channels'][_0x5b78c2[_0x85fc('0xb2')]]){this[_0x85fc('0x20')][_0x5b78c2[_0x85fc('0xb2')]][_0x85fc('0xb3')]=_0x5b78c2[_0x85fc('0xbe')];this['channels'][_0x5b78c2[_0x85fc('0xb2')]][_0x85fc('0xc1')]=_0x5b78c2['extension'];this[_0x85fc('0x20')][_0x5b78c2[_0x85fc('0xb2')]]['transferType']=_0x85fc('0xc2');this[_0x85fc('0x2c')]({'event':_0x85fc('0xaa'),'uniqueid':_0x5b78c2[_0x85fc('0xb2')],'context':_0x5b78c2[_0x85fc('0x48')],'channel':_0x5b78c2[_0x85fc('0xc3')]});}else{this['channels'][_0x5b78c2[_0x85fc('0xc4')]]['transferType']=_0x85fc('0xc2');}}}catch(_0x17501f){logger['error'](_0x85fc('0xc5'),_0x5b78c2[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x17501f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85fc('0x3d')][_0x85fc('0xc6')]=function(_0x1c32b5){try{if(this[_0x85fc('0x3b')](_0x1c32b5)){logger[_0x85fc('0x43')](_0x85fc('0xc7'),_0x1c32b5[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x1c32b5,{'showHidden':![],'depth':null}));if(this[_0x85fc('0x20')][_0x1c32b5[_0x85fc('0x40')]]){if(!_['isNil'](this[_0x85fc('0x20')][_0x1c32b5[_0x85fc('0x40')]][_0x85fc('0x70')])){this[_0x85fc('0x20')][_0x1c32b5[_0x85fc('0x40')]][_0x85fc('0xc8')]=moment()[_0x85fc('0x50')](_0x85fc('0x58'));logger['info'](_0x85fc('0xc9'),_0x1c32b5[_0x85fc('0x40')],this[_0x85fc('0x20')][_0x1c32b5[_0x85fc('0x40')]][_0x85fc('0xc8')]);}}}}catch(_0x460693){logger[_0x85fc('0x38')](_0x85fc('0xca'),_0x1c32b5[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x460693,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85fc('0x3d')][_0x85fc('0x34')]=function(_0x956d56){try{if(this[_0x85fc('0x3b')](_0x956d56)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x956d56['uniqueid'],util[_0x85fc('0x3a')](_0x956d56,{'showHidden':![],'depth':null}));if(this[_0x85fc('0x20')][_0x956d56[_0x85fc('0x40')]]){if(!_[_0x85fc('0x7f')](this[_0x85fc('0x20')][_0x956d56[_0x85fc('0x40')]][_0x85fc('0xc8')])){this[_0x85fc('0x20')][_0x956d56[_0x85fc('0x40')]][_0x85fc('0xcb')]+=moment()[_0x85fc('0xcc')](0x0)[_0x85fc('0x72')](this['channels'][_0x956d56[_0x85fc('0x40')]][_0x85fc('0xc8')],_0x85fc('0x66'));logger[_0x85fc('0x35')](_0x85fc('0xcd'),_0x956d56['uniqueid'],this[_0x85fc('0x20')][_0x956d56[_0x85fc('0x40')]]['mohtime']);delete this[_0x85fc('0x20')][_0x956d56['uniqueid']][_0x85fc('0xc8')];}}}}catch(_0x31d446){logger[_0x85fc('0x38')](_0x85fc('0xce'),_0x956d56[_0x85fc('0x40')],util[_0x85fc('0x3a')](_0x31d446,{'showHidden':![],'depth':null}));}};module[_0x85fc('0xcf')]=VoiceCallReport; \ No newline at end of file +var _0x0582=['membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','monitor','.wav49','replace','.WAV','find','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','destinationchannel','finally','webbar:stopmonitors','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','transferType','ATTENDED','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','context','channel','exten','xcally-motion-preview','split','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','from-sip','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','set','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','connectedlinename','calleridname','UserId'];(function(_0x467404,_0x9af88d){var _0x4b829c=function(_0x4d7ea6){while(--_0x4d7ea6){_0x467404['push'](_0x467404['shift']());}};_0x4b829c(++_0x9af88d);}(_0x0582,0x123));var _0x2058=function(_0x536cf5,_0x6c6c56){_0x536cf5=_0x536cf5-0x0;var _0x1d9a28=_0x0582[_0x536cf5];return _0x1d9a28;};'use strict';var BPromise=require(_0x2058('0x0'));var _=require(_0x2058('0x1'));var moment=require(_0x2058('0x2'));var util=require(_0x2058('0x3'));var path=require(_0x2058('0x4'));var Redis=require(_0x2058('0x5'));var config=require(_0x2058('0x6'));var logger=require(_0x2058('0x7'))(_0x2058('0x8'));var ami=require('../ami');var Channel=require('../model/channel');var RpcSetting=require(_0x2058('0x9'));var statusDesc=[_0x2058('0xa'),_0x2058('0xb'),_0x2058('0xc'),_0x2058('0xd'),_0x2058('0xe'),_0x2058('0xf'),_0x2058('0x10'),_0x2058('0x11'),'onhold'];var applications=['set',_0x2058('0x12'),_0x2058('0x13'),_0x2058('0x14'),_0x2058('0x15'),_0x2058('0x16')];var dispositions=[_0x2058('0x17'),_0x2058('0x18'),_0x2058('0x18'),'NO\x20ANSWER',_0x2058('0x17'),_0x2058('0x17'),_0x2058('0x19'),_0x2058('0x1a'),_0x2058('0x18'),_0x2058('0x18'),_0x2058('0x18')];var actions={};config['redis']=_['defaults'](config[_0x2058('0x1b')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2058('0x1b')]));function VoiceCallReport(_0x24f39b){this[_0x2058('0x1c')]=_0x24f39b[_0x2058('0x1c')];this[_0x2058('0x1d')]=_0x24f39b[_0x2058('0x1d')];this[_0x2058('0x1e')]={};ami['on'](_0x2058('0x1f'),this[_0x2058('0x20')][_0x2058('0x21')](this));ami['on'](_0x2058('0x22'),this[_0x2058('0x20')][_0x2058('0x21')](this));ami['on']('newchannel',this[_0x2058('0x23')][_0x2058('0x21')](this));ami['on'](_0x2058('0x24'),this[_0x2058('0x25')]['bind'](this));ami['on'](_0x2058('0x26'),this[_0x2058('0x27')][_0x2058('0x21')](this));ami['on'](_0x2058('0x28'),this[_0x2058('0x29')]['bind'](this));ami['on'](_0x2058('0x2a'),this[_0x2058('0x2b')]['bind'](this));ami['on']('attendedtransfer',this[_0x2058('0x2c')][_0x2058('0x21')](this));ami['on'](_0x2058('0x2d'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x2058('0x2e'),this[_0x2058('0x2f')][_0x2058('0x21')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));try{logger['info'](_0x2058('0x30'));ami[_0x2058('0x31')]();}catch(_0x546cea){logger['error'](_0x2058('0x32'),util[_0x2058('0x33')](_0x546cea,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2058('0x34')][_0x2058('0x35')]=function(_0x395744){return _0x395744!==null&&!_['isUndefined'](_0x395744);};VoiceCallReport[_0x2058('0x34')][_0x2058('0x36')]=function(_0x7930ff,_0x2722fa,_0x1a0c5b){io['to'](_0x7930ff)[_0x2058('0x36')](_0x2722fa,_0x1a0c5b);};VoiceCallReport[_0x2058('0x34')]['syncNewCallerId']=function(_0x4d9735){try{if(this[_0x2058('0x35')](_0x4d9735)){logger[_0x2058('0x37')](_0x2058('0x38'),_0x4d9735[_0x2058('0x39')],_0x4d9735['calleridname'],_0x4d9735[_0x2058('0x3a')]);logger['debug'](_0x2058('0x3b'),_0x4d9735[_0x2058('0x39')],util['inspect'](_0x4d9735,{'showHidden':![],'depth':null}));if(_0x4d9735['uniqueid']===_0x4d9735[_0x2058('0x3c')]){if(!_[_0x2058('0x3d')](this[_0x2058('0x1c')][_0x4d9735[_0x2058('0x39')]])){_[_0x2058('0x3e')](this['channels'][_0x4d9735[_0x2058('0x39')]],_[_0x2058('0x3f')](_0x4d9735,_['keys'](this[_0x2058('0x1c')][_0x4d9735[_0x2058('0x39')]])));}}if(_0x4d9735[_0x2058('0x40')]==='from-sip'){if(this[_0x2058('0x1d')][_0x4d9735[_0x2058('0x41')]['split']('-')[0x0]]){if(_0x4d9735[_0x2058('0x42')]==_0x2058('0x43')){this[_0x2058('0x1d')][_0x4d9735[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x45')]=_0x4d9735[_0x2058('0x46')];this[_0x2058('0x36')](util[_0x2058('0x47')](_0x2058('0x48'),this[_0x2058('0x1d')][_0x4d9735[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x49')]),_0x2058('0x4a'),{'destaccountcode':this[_0x2058('0x1d')][_0x4d9735[_0x2058('0x41')]['split']('-')[0x0]][_0x2058('0x4b')],'destconnectedlinenum':_0x4d9735['connectedlinenum']});}}}}}catch(_0x369fea){logger[_0x2058('0x4c')](_0x2058('0x4d'),_0x4d9735[_0x2058('0x39')],util[_0x2058('0x33')](_0x369fea,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x3984f9){try{if(this[_0x2058('0x35')](_0x3984f9)){logger[_0x2058('0x4e')]('[%s][voiceCallReport][newchannel]\x20event:',_0x3984f9[_0x2058('0x39')],util['inspect'](_0x3984f9,{'showHidden':![],'depth':null}));if(_0x3984f9[_0x2058('0x39')]===_0x3984f9[_0x2058('0x3c')]&&_0x3984f9[_0x2058('0x41')]!='OutgoingSpoolFailed'){if(_[_0x2058('0x3d')](this[_0x2058('0x1c')][_0x3984f9[_0x2058('0x39')]])){logger['info'](_0x2058('0x4f'),_0x3984f9[_0x2058('0x39')],_0x3984f9[_0x2058('0x40')],_0x3984f9[_0x2058('0x42')]);this[_0x2058('0x1c')][_0x3984f9[_0x2058('0x39')]]=new Channel();this[_0x2058('0x1c')][_0x3984f9['uniqueid']]['starttime']=moment()[_0x2058('0x47')](_0x2058('0x50'));this[_0x2058('0x1c')][_0x3984f9[_0x2058('0x39')]][_0x2058('0x51')]=dispositions[_[_0x2058('0x52')](_0x3984f9[_0x2058('0x53')])];_[_0x2058('0x3e')](this[_0x2058('0x1c')][_0x3984f9[_0x2058('0x39')]],_[_0x2058('0x3f')](_0x3984f9,_[_0x2058('0x54')](this['channels'][_0x3984f9[_0x2058('0x39')]])));if(_0x3984f9['context']===_0x2058('0x55')){if(this['agents'][_0x3984f9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]){if(_[_0x2058('0x3d')](this[_0x2058('0x1d')][_0x3984f9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x45')])){this[_0x2058('0x1d')][_0x3984f9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x45')]=_0x3984f9[_0x2058('0x42')];logger[_0x2058('0x4e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x3984f9['uniqueid'],util[_0x2058('0x33')]({'destaccountcode':this[_0x2058('0x1d')][_0x3984f9['channel'][_0x2058('0x44')]('-')[0x0]][_0x2058('0x4b')],'destconnectedlinenum':_0x3984f9['exten']},{'showHidden':![],'depth':null}));this[_0x2058('0x36')](util[_0x2058('0x47')](_0x2058('0x48'),this[_0x2058('0x1d')][_0x3984f9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x49')]),'user:agentconnect',{'destaccountcode':this[_0x2058('0x1d')][_0x3984f9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x4b')],'destconnectedlinenum':_0x3984f9['exten']});}}}}}}}catch(_0xad5e5c){logger[_0x2058('0x4c')](_0x2058('0x56'),_0x3984f9[_0x2058('0x39')],util[_0x2058('0x33')](_0xad5e5c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2058('0x20')]=function(_0x135f31){try{if(this[_0x2058('0x35')](_0x135f31)){logger['debug'](_0x2058('0x57'),_0x135f31['uniqueid'],util[_0x2058('0x33')](_0x135f31,{'showHidden':![],'depth':null}));if(_0x135f31[_0x2058('0x39')]===_0x135f31[_0x2058('0x3c')]&&_0x135f31[_0x2058('0x42')]!='h'&&_0x135f31['channel']!=_0x2058('0x58')){_0x135f31[_0x2058('0x59')]=_0x135f31[_0x2058('0x59')][_0x2058('0x5a')]();_0x135f31[_0x2058('0x5b')]=_0x135f31[_0x2058('0x5c')]&&_0x135f31['appdata']['startsWith'](_0x2058('0x5d'))?_0x135f31[_0x2058('0x5c')]:(_0x135f31[_0x2058('0x5c')]||_0x135f31['applicationdata'])[_0x2058('0x5a')]();logger[_0x2058('0x37')](_0x2058('0x5e'),_0x135f31[_0x2058('0x39')],_0x135f31['application'],_0x135f31['applicationdata']);if(_[_0x2058('0x3d')](this[_0x2058('0x1c')][_0x135f31[_0x2058('0x39')]])){this[_0x2058('0x1c')][_0x135f31[_0x2058('0x39')]]=new Channel();this[_0x2058('0x1c')][_0x135f31[_0x2058('0x39')]][_0x2058('0x5f')]=_0x135f31[_0x2058('0x60')]?moment()[_0x2058('0x61')](moment['duration'](_0x135f31['duration'])['seconds'](),_0x2058('0x62'))[_0x2058('0x47')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x2058('0x47')](_0x2058('0x50'));this['channels'][_0x135f31['uniqueid']][_0x2058('0x51')]=_0x2058('0x17');}_[_0x2058('0x3e')](this[_0x2058('0x1c')][_0x135f31[_0x2058('0x39')]],_[_0x2058('0x3f')](_0x135f31,_[_0x2058('0x54')](this[_0x2058('0x1c')][_0x135f31[_0x2058('0x39')]])));if(_[_0x2058('0x63')](applications,_0x135f31[_0x2058('0x59')])){this[_0x2058('0x1c')][_0x135f31['uniqueid']][_0x2058('0x64')]=_0x135f31[_0x2058('0x59')];this['channels'][_0x135f31['uniqueid']][_0x2058('0x65')]=_0x135f31[_0x2058('0x5b')];if(_0x135f31[_0x2058('0x59')]===_0x2058('0x66')&&_[_0x2058('0x67')](_0x135f31['applicationdata'][_0x2058('0x5a')](),_0x2058('0x68'))){var _0x498f6a=_0x135f31[_0x2058('0x5b')][_0x2058('0x44')]('=');var _0x444563=_0x498f6a[0x0][_0x2058('0x5a')]()[_0x2058('0x69')](/cdr\((.*)\)/);if(_0x444563){this[_0x2058('0x1c')][_0x135f31[_0x2058('0x39')]][_0x444563[0x1]]=_0x498f6a[0x1];}}else if(_0x135f31[_0x2058('0x59')]==='queue'){this[_0x2058('0x1c')][_0x135f31[_0x2058('0x39')]]['queue']=_0x135f31[_0x2058('0x5b')]['split'](',')[0x0];}}}}}catch(_0x361498){logger[_0x2058('0x4c')](_0x2058('0x6a'),_0x135f31[_0x2058('0x39')],util[_0x2058('0x33')](_0x361498,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2058('0x34')][_0x2058('0x25')]=function(_0x5c9981){try{if(this[_0x2058('0x35')](_0x5c9981)){logger[_0x2058('0x37')](_0x2058('0x6b'),_0x5c9981[_0x2058('0x39')],_0x5c9981[_0x2058('0x3c')],_0x5c9981['calleridname'],_0x5c9981[_0x2058('0x3a')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x5c9981[_0x2058('0x39')],util[_0x2058('0x33')](_0x5c9981,{'showHidden':![],'depth':null}));if(_0x5c9981[_0x2058('0x39')]!==_0x5c9981['linkedid']){if(this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]]){if(_0x5c9981['channelstate']==='6'){if(!this[_0x2058('0x1c')][_0x5c9981['linkedid']][_0x2058('0x6c')]){var _0x14b74e=moment();this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x6c')]=!![];this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x6d')]=_0x14b74e[_0x2058('0x47')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x5f')]){this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x6e')]=_0x14b74e[_0x2058('0x6f')](this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]]['starttime'],_0x2058('0x62'));}}this[_0x2058('0x1c')][_0x5c9981['linkedid']][_0x2058('0x3c')]=_0x5c9981[_0x2058('0x39')];if(_0x5c9981['calleridnum']!==_0x2058('0x43')){this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x46')]=_0x5c9981[_0x2058('0x3a')];}this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x70')]=_0x5c9981[_0x2058('0x71')];this['channels'][_0x5c9981[_0x2058('0x3c')]]['destinationchannel']=_0x5c9981[_0x2058('0x41')];this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x51')]=dispositions[_[_0x2058('0x52')](_0x5c9981[_0x2058('0x53')])];if(this['agents'][_0x5c9981['channel'][_0x2058('0x44')]('-')[0x0]]){this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]][_0x2058('0x72')]=this[_0x2058('0x1d')][_0x5c9981[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]['id'];this[_0x2058('0x1c')][_0x5c9981['linkedid']][_0x2058('0x73')]=this['agents'][_0x5c9981[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x49')];}}}}else{if(this[_0x2058('0x1c')][_0x5c9981['uniqueid']]){if(_0x5c9981[_0x2058('0x53')]==='6'){if(this[_0x2058('0x1d')][_0x5c9981[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]){this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x39')]][_0x2058('0x72')]=this[_0x2058('0x1d')][_0x5c9981[_0x2058('0x41')]['split']('-')[0x0]]['id'];this['channels'][_0x5c9981[_0x2058('0x39')]][_0x2058('0x73')]=this[_0x2058('0x1d')][_0x5c9981[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]['name'];}}}}if(_0x5c9981[_0x2058('0x53')]==='6'&&_0x5c9981[_0x2058('0x40')]==='from-sip'){if(this[_0x2058('0x1d')][_0x5c9981[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]){this[_0x2058('0x1d')][_0x5c9981['channel'][_0x2058('0x44')]('-')[0x0]][_0x2058('0x45')]=_0x5c9981[_0x2058('0x42')];var _0x550591;if(this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x39')]])_0x550591=this['channels'][_0x5c9981['uniqueid']][_0x2058('0x74')];else if(this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]])_0x550591=this[_0x2058('0x1c')][_0x5c9981[_0x2058('0x3c')]]['routealias'];logger[_0x2058('0x4e')](_0x2058('0x75'),_0x5c9981[_0x2058('0x39')],util[_0x2058('0x33')]({'destaccountcode':this[_0x2058('0x1d')][_0x5c9981[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5c9981[_0x2058('0x42')],'routealias':_0x550591},{'showHidden':![],'depth':null}));this[_0x2058('0x36')](util['format'](_0x2058('0x48'),this[_0x2058('0x1d')][_0x5c9981[_0x2058('0x41')]['split']('-')[0x0]][_0x2058('0x49')]),_0x2058('0x4a'),{'destaccountcode':this[_0x2058('0x1d')][_0x5c9981['channel'][_0x2058('0x44')]('-')[0x0]][_0x2058('0x4b')],'destconnectedlinenum':_0x5c9981[_0x2058('0x42')],'routealias':_0x550591});}}}}catch(_0xdc01c0){logger['error'](_0x2058('0x76'),_0x5c9981['uniqueid'],util[_0x2058('0x33')](_0xdc01c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2058('0x34')]['syncMixMonitorFilename']=function(_0x31fb39,_0x1b224c){try{if(this[_0x2058('0x1c')][_0x31fb39]){logger[_0x2058('0x37')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x31fb39,_0x1b224c);this[_0x2058('0x1c')][_0x31fb39][_0x2058('0x77')]=!![];if(_['endsWith'](_0x1b224c,_0x2058('0x78'))){_0x1b224c=_0x1b224c[_0x2058('0x79')]('.wav49',_0x2058('0x7a'));}this[_0x2058('0x1c')][_0x31fb39]['monitorFilename']=_0x1b224c;var _0x16ef5a=_[_0x2058('0x7b')](this[_0x2058('0x1c')][_0x31fb39][_0x2058('0x7c')],{'filename':_0x1b224c});if(_[_0x2058('0x7d')](_0x16ef5a)){this[_0x2058('0x1c')][_0x31fb39][_0x2058('0x7c')]['push']({'filename':_0x1b224c,'createdAt':moment()[_0x2058('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x2058('0x7e')});}}}catch(_0x2d97e1){logger[_0x2058('0x4c')](_0x2058('0x7f'),_0x31fb39,util[_0x2058('0x33')](_0x2d97e1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2058('0x27')]=function(_0x33a803){try{if(this[_0x2058('0x35')](_0x33a803)){logger[_0x2058('0x4e')]('[%s][voiceCallReport][varset]\x20event:',_0x33a803[_0x2058('0x39')],util['inspect'](_0x33a803,{'showHidden':![],'depth':null}));if(this[_0x2058('0x1c')][_0x33a803[_0x2058('0x39')]]&&_0x33a803['channel']!=_0x2058('0x58')){if(this[_0x2058('0x35')](_0x33a803[_0x2058('0x80')])){if(this[_0x2058('0x35')](_0x33a803[_0x2058('0x80')][_0x2058('0x81')])){logger[_0x2058('0x37')](_0x2058('0x82'),_0x33a803[_0x2058('0x39')],_0x33a803[_0x2058('0x83')]);this[_0x2058('0x84')](_0x33a803[_0x2058('0x39')],_0x33a803['value']);}else if(this[_0x2058('0x35')](_0x33a803[_0x2058('0x80')][_0x2058('0x85')])){logger[_0x2058('0x37')](_0x2058('0x86'),_0x33a803['uniqueid'],_0x33a803['value']);this['channels'][_0x33a803[_0x2058('0x39')]][_0x2058('0x3a')]=_0x33a803['value'];}else if(this[_0x2058('0x35')](_0x33a803['variable'][_0x2058('0x87')])){logger['info'](_0x2058('0x88'),_0x33a803['uniqueid'],_0x33a803[_0x2058('0x83')]);this[_0x2058('0x1c')][_0x33a803[_0x2058('0x39')]]['callerid']=_0x33a803['value'];}else if(this[_0x2058('0x35')](_0x33a803['variable']['xmd-cdrtype'])){logger[_0x2058('0x37')](_0x2058('0x89'),_0x33a803['uniqueid'],_0x33a803[_0x2058('0x83')]);this['channels'][_0x33a803[_0x2058('0x39')]]['type']=_0x33a803[_0x2058('0x83')];}else if(this[_0x2058('0x35')](_0x33a803[_0x2058('0x80')][_0x2058('0x8a')])){logger[_0x2058('0x37')](_0x2058('0x8b'),_0x33a803[_0x2058('0x39')],_0x33a803['value']['split'](',')[0x0]);this[_0x2058('0x1c')][_0x33a803[_0x2058('0x39')]][_0x2058('0x12')]=_0x33a803[_0x2058('0x83')][_0x2058('0x44')](',')[0x0];}else if(this['isNotNull'](_0x33a803[_0x2058('0x80')]['xmd-originatecalleridnum'])){logger[_0x2058('0x37')](_0x2058('0x8c'),_0x33a803[_0x2058('0x39')],_0x33a803['value']);this[_0x2058('0x1c')][_0x33a803['uniqueid']]['originatecalleridnum']=_0x33a803[_0x2058('0x83')];}else if(this[_0x2058('0x35')](_0x33a803[_0x2058('0x80')][_0x2058('0x8d')])){logger[_0x2058('0x37')](_0x2058('0x8e'),_0x33a803['uniqueid'],_0x33a803[_0x2058('0x83')]);this[_0x2058('0x1c')][_0x33a803[_0x2058('0x39')]][_0x2058('0x8f')]=_0x33a803[_0x2058('0x83')];}else if(this[_0x2058('0x35')](_0x33a803[_0x2058('0x80')][_0x2058('0x90')])){logger[_0x2058('0x37')](_0x2058('0x91'),_0x33a803[_0x2058('0x39')],_0x33a803[_0x2058('0x83')]);this[_0x2058('0x1c')][_0x33a803['uniqueid']][_0x2058('0x92')]=_0x33a803[_0x2058('0x83')];}else if(this[_0x2058('0x35')](_0x33a803['variable'][_0x2058('0x93')])){logger[_0x2058('0x37')](_0x2058('0x94'),_0x33a803[_0x2058('0x39')],_0x33a803[_0x2058('0x83')]);this[_0x2058('0x1c')][_0x33a803[_0x2058('0x39')]]['queue']=_0x33a803[_0x2058('0x83')];}else if(this['isNotNull'](_0x33a803[_0x2058('0x80')][_0x2058('0x95')])){logger['info'](_0x2058('0x96'),_0x33a803[_0x2058('0x39')],_0x33a803[_0x2058('0x83')]);this[_0x2058('0x1c')][_0x33a803[_0x2058('0x39')]]['sipcalluniqueid']=_0x33a803[_0x2058('0x83')];}}}else if(this[_0x2058('0x35')](_0x33a803['variable'][_0x2058('0x81')])){if(_0x33a803[_0x2058('0x83')]){var _0x424659=path[_0x2058('0x97')](_0x33a803['value'])['name'];logger[_0x2058('0x37')](_0x2058('0x82'),_0x424659,_0x33a803[_0x2058('0x83')]);this[_0x2058('0x84')](_0x424659,_0x33a803['value']);}}else if(this[_0x2058('0x1c')][_0x33a803[_0x2058('0x3c')]]){if(this[_0x2058('0x35')](_0x33a803['variable'])){if(this[_0x2058('0x35')](_0x33a803[_0x2058('0x80')][_0x2058('0x95')])){logger[_0x2058('0x37')](_0x2058('0x96'),_0x33a803[_0x2058('0x3c')],_0x33a803['value']);this[_0x2058('0x1c')][_0x33a803['linkedid']][_0x2058('0x98')]=_0x33a803[_0x2058('0x83')];}}}}}catch(_0x1139ee){logger[_0x2058('0x4c')]('[%s][voiceCallReport][varset]',_0x33a803[_0x2058('0x39')],util['inspect'](_0x1139ee,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2058('0x29')]=function(_0x427ae9){try{if(this[_0x2058('0x35')](_0x427ae9)){logger[_0x2058('0x4e')](_0x2058('0x99'),_0x427ae9[_0x2058('0x39')],util[_0x2058('0x33')](_0x427ae9,{'showHidden':![],'depth':null}));if(this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]]){logger[_0x2058('0x37')](_0x2058('0x9a'),_0x427ae9['uniqueid'],_0x427ae9['cause-txt']);var _0x5d412e=moment();this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x9b')]=_0x5d412e[_0x2058('0x47')](_0x2058('0x50'));this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x60')]=_0x5d412e['diff'](this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x5f')],'seconds');if(this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x6c')]){this[_0x2058('0x1c')][_0x427ae9['uniqueid']][_0x2058('0x9c')]=_0x5d412e[_0x2058('0x6f')](this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x6d')],'seconds');this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x6e')]=this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]]['duration']-this[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x9c')];}if(_0x427ae9[_0x2058('0x40')]===_0x2058('0x55')){if(this['agents'][_0x427ae9[_0x2058('0x41')]['split']('-')[0x0]]){this[_0x2058('0x1d')][_0x427ae9[_0x2058('0x41')]['split']('-')[0x0]]=_[_0x2058('0x9d')](this[_0x2058('0x1d')][_0x427ae9[_0x2058('0x41')]['split']('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x2058('0x9e'),_0x427ae9['uniqueid'],util['inspect']({'id':this[_0x2058('0x1d')][_0x427ae9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x2058('0x1d')][_0x427ae9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]][_0x2058('0x4b')]},{'showHidden':![],'depth':null}));this[_0x2058('0x36')](util[_0x2058('0x47')](_0x2058('0x48'),this[_0x2058('0x1d')][_0x427ae9[_0x2058('0x41')]['split']('-')[0x0]]['name']),_0x2058('0x9f'),{'id':this[_0x2058('0x1d')][_0x427ae9[_0x2058('0x41')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x2058('0x1d')][_0x427ae9[_0x2058('0x41')][_0x2058('0x44')]('-')[0x0]]['accountcode']});}}var _0x2924b6=this;Promise[_0x2058('0xa0')]()[_0x2058('0xa1')](function(){var _0x1452b1=_0x2924b6['channels'][_0x427ae9[_0x2058('0x39')]];if(typeof _0x1452b1['transferType']==='undefined')return;if(_['isEmpty'](_0x1452b1[_0x2058('0x7c')]))return;return RpcSetting[_0x2058('0xa2')]()[_0x2058('0xa1')](function(_0x3c4ef1){if(!_0x3c4ef1[_0x2058('0xa3')])return;return Promise['resolve']()['then'](function(){return ami[_0x2058('0xa4')]({'action':_0x2058('0xa5'),'channel':_0x1452b1[_0x2058('0x41')]})[_0x2058('0xa6')](function(){});})[_0x2058('0xa1')](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x1452b1[_0x2058('0xa7')]})['catch'](function(){})[_0x2058('0xa8')](function(){var _0x2ac0bf=_0x2924b6[_0x2058('0x1d')][_0x1452b1[_0x2058('0xa7')][_0x2058('0x44')]('-')[0x0]];if(!_0x2ac0bf)return;io['emit'](_0x2058('0xa9'),{'agentId':_0x2ac0bf['id'],'uniqueid':_0x1452b1[_0x2058('0x39')]});});});});})[_0x2058('0xa1')](function(){if(_0x427ae9['event']===_0x2058('0xaa')){_0x2924b6[_0x2058('0x1e')][_0x427ae9[_0x2058('0x39')]]=_0x2924b6['channels'][_0x427ae9['uniqueid']];}else{if(_0x2924b6[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0xab')]===_0x2058('0xac')&&_0x2924b6[_0x2058('0x1e')][_0x427ae9[_0x2058('0x39')]]){_0x2924b6['channels'][_0x427ae9[_0x2058('0x39')]][_0x2058('0x39')]=[_0x2924b6[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]]['linkedid'],_0x2924b6[_0x2058('0x1c')][_0x427ae9['uniqueid']][_0x2058('0x3c')]=_0x2924b6[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]][_0x2058('0x39')]][0x0];delete _0x2924b6[_0x2058('0x1e')][_0x427ae9['uniqueid']];}}logger[_0x2058('0x4e')](_0x2058('0xad'),_0x427ae9[_0x2058('0x39')],util[_0x2058('0x33')](_0x2924b6[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',_0x2924b6[_0x2058('0x1c')][_0x427ae9['uniqueid']]);delete _0x2924b6[_0x2058('0x1c')][_0x427ae9[_0x2058('0x39')]];});}}}catch(_0x31a1eb){logger['error'](_0x2058('0xae'),_0x427ae9['uniqueid'],util['inspect'](_0x31a1eb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2058('0x34')][_0x2058('0x2c')]=function(_0x4dff5e){try{if(this[_0x2058('0x35')](_0x4dff5e)){logger[_0x2058('0x37')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x4dff5e[_0x2058('0x39')],_0x4dff5e['origtransferercalleridnum'],_0x4dff5e[_0x2058('0xaf')]);logger[_0x2058('0x4e')](_0x2058('0xb0'),_0x4dff5e[_0x2058('0x39')],util['inspect'](_0x4dff5e,{'showHidden':![],'depth':null}));if(this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb1')]]){this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb1')]][_0x2058('0xb2')]=_0x4dff5e[_0x2058('0xb3')];this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb1')]]['transferconnectedlinenum']=_0x4dff5e['transfertargetcalleridnum'];if(this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb4')]]){var _0xd8ecd3=this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb4')]];this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb4')]]=this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb1')]];this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb1')]]=_0xd8ecd3;}}else if(this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb5')]]){this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb5')]][_0x2058('0xb2')]=_0x4dff5e['origtransferercalleridnum'];this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb5')]][_0x2058('0xb6')]=_0x4dff5e['transfertargetcalleridnum'];if(this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb7')]]){var _0xd8ecd3=this[_0x2058('0x1c')][_0x4dff5e['origtransfereruniqueid']];this[_0x2058('0x1c')][_0x4dff5e['origtransfereruniqueid']]=this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb5')]];this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb5')]]=_0xd8ecd3;}}if((this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb7')]]||this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb8')]])&&this['channels'][_0x4dff5e[_0x2058('0xb4')]]){var _0x4d1230=_[_0x2058('0xb9')]([this[_0x2058('0x1c')][_0x4dff5e['origtransfereruniqueid']],this[_0x2058('0x1c')][_0x4dff5e['origtransfererlinkedid']],this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb4')]]],function(_0x7f0158){return _0x7f0158&&_0x7f0158[_0x2058('0xab')]===_0x2058('0xac')&&_0x7f0158['routeid'];});if(_0x4d1230){if(this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb7')]])this[_0x2058('0x1c')][_0x4dff5e['origtransfereruniqueid']][_0x2058('0xba')]='ATTENDED';if(this[_0x2058('0x1c')][_0x4dff5e['origtransfererlinkedid']])this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb8')]][_0x2058('0xba')]=_0x2058('0xbb');this[_0x2058('0x1c')][_0x4dff5e[_0x2058('0xb4')]]['transferType']=_0x2058('0xbb');}}}}catch(_0x12e094){logger['error'](_0x2058('0xbc'),_0x4dff5e[_0x2058('0x39')],util[_0x2058('0x33')](_0x12e094,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2058('0x34')][_0x2058('0xbd')]=function(_0x40d6bc){try{if(this[_0x2058('0x35')](_0x40d6bc)){logger[_0x2058('0x37')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x40d6bc['uniqueid'],_0x40d6bc[_0x2058('0xbe')],_0x40d6bc[_0x2058('0xbf')]);logger[_0x2058('0x4e')](_0x2058('0xc0'),_0x40d6bc[_0x2058('0x39')],util['inspect'](_0x40d6bc,{'showHidden':![],'depth':null}));if(this[_0x2058('0x1c')][_0x40d6bc[_0x2058('0xb1')]]){this['channels'][_0x40d6bc[_0x2058('0xb1')]][_0x2058('0xb2')]=_0x40d6bc[_0x2058('0xbe')];this['channels'][_0x40d6bc[_0x2058('0xb1')]][_0x2058('0xb6')]=_0x40d6bc[_0x2058('0xbf')];this[_0x2058('0x1c')][_0x40d6bc[_0x2058('0xb1')]]['transferType']=_0x2058('0xc1');this[_0x2058('0x29')]({'event':'BlindTransfer','uniqueid':_0x40d6bc['transfereeuniqueid'],'context':_0x40d6bc['context'],'channel':_0x40d6bc['transfererchannel']});}else{this['channels'][_0x40d6bc[_0x2058('0xc2')]]['transferType']=_0x2058('0xc1');}}}catch(_0x44de6c){logger[_0x2058('0x4c')](_0x2058('0xc3'),_0x40d6bc[_0x2058('0x39')],util[_0x2058('0x33')](_0x44de6c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2058('0x34')][_0x2058('0x2f')]=function(_0xd6dee){try{if(this['isNotNull'](_0xd6dee)){logger[_0x2058('0x4e')](_0x2058('0xc4'),_0xd6dee[_0x2058('0x39')],util[_0x2058('0x33')](_0xd6dee,{'showHidden':![],'depth':null}));if(this[_0x2058('0x1c')][_0xd6dee[_0x2058('0x39')]]){if(!_[_0x2058('0x7d')](this[_0x2058('0x1c')][_0xd6dee[_0x2058('0x39')]][_0x2058('0x6d')])){this[_0x2058('0x1c')][_0xd6dee[_0x2058('0x39')]]['mohstarttime']=moment()[_0x2058('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger['info']('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0xd6dee[_0x2058('0x39')],this['channels'][_0xd6dee[_0x2058('0x39')]][_0x2058('0xc5')]);}}}}catch(_0x43e391){logger[_0x2058('0x4c')]('[%s][voiceCallReport][musiconholdstart]',_0xd6dee[_0x2058('0x39')],util['inspect'](_0x43e391,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2058('0x34')][_0x2058('0xc6')]=function(_0x5afc2d){try{if(this[_0x2058('0x35')](_0x5afc2d)){logger[_0x2058('0x4e')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x5afc2d[_0x2058('0x39')],util[_0x2058('0x33')](_0x5afc2d,{'showHidden':![],'depth':null}));if(this[_0x2058('0x1c')][_0x5afc2d[_0x2058('0x39')]]){if(!_[_0x2058('0x7d')](this[_0x2058('0x1c')][_0x5afc2d[_0x2058('0x39')]][_0x2058('0xc5')])){this[_0x2058('0x1c')][_0x5afc2d['uniqueid']][_0x2058('0xc7')]+=moment()[_0x2058('0xc8')](0x0)[_0x2058('0x6f')](this[_0x2058('0x1c')][_0x5afc2d[_0x2058('0x39')]][_0x2058('0xc5')],_0x2058('0x62'));logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x5afc2d[_0x2058('0x39')],this['channels'][_0x5afc2d[_0x2058('0x39')]][_0x2058('0xc7')]);delete this['channels'][_0x5afc2d['uniqueid']][_0x2058('0xc5')];}}}}catch(_0x1053c5){logger[_0x2058('0x4c')](_0x2058('0xc9'),_0x5afc2d[_0x2058('0x39')],util[_0x2058('0x33')](_0x1053c5,{'showHidden':![],'depth':null}));}};module[_0x2058('0xca')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 9675498..126bdf9 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 _0x3d69=['match','exports','lodash','util','../../../config/environment','ami','../ami','redis','defaults','localhost','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','syncDialEnd','bind','varset','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','addVariable','keys','value','variable','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','complete','total','answered','holdtime','seconds','sumHoldTime','billableseconds','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','toLowerCase','set','applicationdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split'];(function(_0x268a00,_0x97da0){var _0x205d7e=function(_0x3fa5c1){while(--_0x3fa5c1){_0x268a00['push'](_0x268a00['shift']());}};_0x205d7e(++_0x97da0);}(_0x3d69,0x77));var _0x93d6=function(_0x7f3392,_0x2463d3){_0x7f3392=_0x7f3392-0x0;var _0x460b1e=_0x3d69[_0x7f3392];return _0x460b1e;};'use strict';var _=require(_0x93d6('0x0'));var moment=require('moment');var util=require(_0x93d6('0x1'));var Redis=require('ioredis');var config=require(_0x93d6('0x2'));var logger=require('../../../config/logger')(_0x93d6('0x3'));var ami=require(_0x93d6('0x4'));config[_0x93d6('0x5')]=_[_0x93d6('0x6')](config[_0x93d6('0x5')],{'host':_0x93d6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x1f5260){this['channels']=_0x1f5260[_0x93d6('0x8')];this[_0x93d6('0x9')]=_0x1f5260[_0x93d6('0x9')];this[_0x93d6('0xa')]={};this[_0x93d6('0xb')]={};ami['on'](_0x93d6('0xc'),this[_0x93d6('0xd')]['bind'](this));ami['on']('dialend',this[_0x93d6('0xe')][_0x93d6('0xf')](this));ami['on'](_0x93d6('0x10'),this['syncVarSet'][_0x93d6('0xf')](this));ami['on'](_0x93d6('0x11'),this[_0x93d6('0x12')][_0x93d6('0xf')](this));ami['on'](_0x93d6('0x13'),this[_0x93d6('0x14')]['bind'](this));}VoiceDialReport[_0x93d6('0x15')][_0x93d6('0x16')]=function(_0x4428c9){return _0x4428c9!==null&&!_[_0x93d6('0x17')](_0x4428c9);};VoiceDialReport[_0x93d6('0x15')][_0x93d6('0x18')]=function(_0x52a9a4,_0x1319a4,_0x389b27){io['to'](_0x52a9a4)['emit'](_0x1319a4,_0x389b27);};VoiceDialReport['prototype'][_0x93d6('0xd')]=function(_0x25bbc6){try{if(this[_0x93d6('0x16')](_0x25bbc6)){logger[_0x93d6('0x19')](_0x93d6('0x1a'),_0x25bbc6[_0x93d6('0x1b')],util[_0x93d6('0x1c')](_0x25bbc6,{'showHidden':![],'depth':null}));if(this['channels'][_0x25bbc6['uniqueid']]){_[_0x93d6('0x1d')](this[_0x93d6('0x1e')][_0x25bbc6[_0x93d6('0x1b')]],{'starttime':moment()[_0x93d6('0x1f')](_0x93d6('0x20')),'lastevent':_0x93d6('0x21'),'interface':_0x25bbc6[_0x93d6('0x22')]['substring'](0x0,_0x25bbc6[_0x93d6('0x22')]['lastIndexOf']('-')),'membername':_0x25bbc6[_0x93d6('0x22')][_0x93d6('0x23')](_0x25bbc6[_0x93d6('0x22')][_0x93d6('0x24')]('/')+0x1,_0x25bbc6[_0x93d6('0x22')][_0x93d6('0x24')]('-'))},_[_0x93d6('0x25')](_0x25bbc6,[_0x93d6('0x26'),_0x93d6('0x27')]));logger[_0x93d6('0x28')](_0x93d6('0x29'),_0x25bbc6[_0x93d6('0x1b')],this[_0x93d6('0x1e')][_0x25bbc6[_0x93d6('0x1b')]][_0x93d6('0x2a')],this[_0x93d6('0x1e')][_0x25bbc6[_0x93d6('0x1b')]][_0x93d6('0x2b')]);logger[_0x93d6('0x19')](_0x93d6('0x2c'),_0x25bbc6[_0x93d6('0x1b')],util[_0x93d6('0x1c')](this[_0x93d6('0x1e')][_0x25bbc6['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x93d6('0xa')][_0x25bbc6[_0x93d6('0x1b')]])_['merge'](this[_0x93d6('0x1e')][_0x25bbc6[_0x93d6('0x1b')]],this[_0x93d6('0xa')][_0x25bbc6[_0x93d6('0x1b')]]);this[_0x93d6('0x18')](_0x93d6('0x2d'),_0x93d6('0x2e'),this['channels'][_0x25bbc6['uniqueid']]);logger['debug'](_0x93d6('0x2f'),_0x25bbc6[_0x93d6('0x1b')],util[_0x93d6('0x1c')](this[_0x93d6('0x1e')][_0x25bbc6[_0x93d6('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x93d6('0x18')](_0x93d6('0x30'),this[_0x93d6('0x1e')][_0x25bbc6[_0x93d6('0x1b')]]);}}}catch(_0x5d6119){logger[_0x93d6('0x31')]('[%s][voiceDialReport][dialbegin]',_0x25bbc6['uniqueid'],util['inspect'](_0x5d6119,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x93d6('0x15')][_0x93d6('0xe')]=function(_0xbe5c79){try{if(this[_0x93d6('0x16')](_0xbe5c79)){logger[_0x93d6('0x19')]('[%s][voiceDialReport][dialend]\x20event:',_0xbe5c79[_0x93d6('0x1b')],util[_0x93d6('0x1c')](_0xbe5c79,{'showHidden':![],'depth':null}));if(this['channels'][_0xbe5c79['uniqueid']]){this[_0x93d6('0x1e')][_0xbe5c79[_0x93d6('0x1b')]][_0x93d6('0x32')]=_0xbe5c79['dialstatus'];if(_0xbe5c79['dialstatus']===_0x93d6('0x33')){this[_0x93d6('0x1e')][_0xbe5c79[_0x93d6('0x1b')]][_0x93d6('0x34')]=_0xbe5c79[_0x93d6('0x34')];this[_0x93d6('0x1e')][_0xbe5c79[_0x93d6('0x1b')]]['connectedlinename']=_0xbe5c79[_0x93d6('0x35')];this[_0x93d6('0x1e')][_0xbe5c79['uniqueid']][_0x93d6('0x36')]=moment()[_0x93d6('0x1f')](_0x93d6('0x20'));this[_0x93d6('0x1e')][_0xbe5c79['uniqueid']][_0x93d6('0x37')]='connect';logger[_0x93d6('0x28')](_0x93d6('0x38'),_0xbe5c79['uniqueid'],_0xbe5c79[_0x93d6('0x22')][_0x93d6('0x23')](_0xbe5c79['channel'][_0x93d6('0x24')]('/')+0x1,_0xbe5c79[_0x93d6('0x22')][_0x93d6('0x24')]('-')));logger[_0x93d6('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0xbe5c79[_0x93d6('0x1b')],util[_0x93d6('0x1c')](this[_0x93d6('0x1e')][_0xbe5c79[_0x93d6('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x93d6('0x18')](_0x93d6('0x39'),this[_0x93d6('0x1e')][_0xbe5c79[_0x93d6('0x1b')]]);}logger['debug'](_0x93d6('0x3a'),_0xbe5c79['uniqueid'],util[_0x93d6('0x1c')](this[_0x93d6('0x1e')][_0xbe5c79[_0x93d6('0x1b')]],{'showHidden':![],'depth':null}));this[_0x93d6('0x18')](_0x93d6('0x2d'),_0x93d6('0x2e'),this[_0x93d6('0x1e')][_0xbe5c79[_0x93d6('0x1b')]]);}}}catch(_0x4ddfab){logger[_0x93d6('0x31')](_0x93d6('0x3b'),_0xbe5c79[_0x93d6('0x1b')],util[_0x93d6('0x1c')](_0x4ddfab,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x93d6('0x15')][_0x93d6('0x3c')]=function(_0x4a9e5f){try{if(this[_0x93d6('0x16')](_0x4a9e5f)){logger[_0x93d6('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x4a9e5f[_0x93d6('0x1b')],util['inspect'](_0x4a9e5f,{'showHidden':![],'depth':null}));this[_0x93d6('0x3d')](_0x4a9e5f['uniqueid'],_[_0x93d6('0x3e')](_0x4a9e5f['variable'])[0x0],_0x4a9e5f[_0x93d6('0x3f')]);if(this[_0x93d6('0x16')](_0x4a9e5f[_0x93d6('0x40')])&&this[_0x93d6('0x16')](_0x4a9e5f['variable'][_0x93d6('0x41')])){if(_[_0x93d6('0x17')](this[_0x93d6('0x1e')][_0x4a9e5f[_0x93d6('0x1b')]])){this['channels'][_0x4a9e5f['uniqueid']]={'routeId':_0x4a9e5f[_0x93d6('0x3f')],'variables':this[_0x93d6('0xb')][_0x4a9e5f['uniqueid']],'motionChannel':_0x93d6('0x42')};logger[_0x93d6('0x28')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x4a9e5f['uniqueid'],_0x4a9e5f[_0x93d6('0x40')][_0x93d6('0x41')],_[_0x93d6('0x3e')](_0x4a9e5f[_0x93d6('0x40')])[0x0],_0x4a9e5f['value']);logger[_0x93d6('0x19')](_0x93d6('0x43'),_0x4a9e5f[_0x93d6('0x1b')],util['inspect'](this[_0x93d6('0x1e')][_0x4a9e5f['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x93d6('0x2d'),_0x93d6('0x2e'),this['channels'][_0x4a9e5f[_0x93d6('0x1b')]]);}}}}catch(_0x3e366b){logger['error']('[%s][voiceDialReport][varset]',_0x4a9e5f['uniqueid'],util[_0x93d6('0x1c')](_0x3e366b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x42118e,_0x1ad195,_0x41a197){var _0x49f2bf=['rtpaudioqos',_0x93d6('0x44'),_0x93d6('0x45'),_0x93d6('0x46'),_0x93d6('0x47'),_0x93d6('0x48'),_0x93d6('0x49'),'rtpaudioqosrttbridged',_0x93d6('0x4a'),_0x93d6('0x4b'),_0x93d6('0x4c'),'bridgepvtcallid',_0x93d6('0x4d'),_0x93d6('0x4e'),_0x93d6('0x4f'),_0x93d6('0x50'),_0x93d6('0x2a'),_0x93d6('0x51'),'memberrealtime'];if(!_['isNil'](_0x1ad195)&&!_[_0x93d6('0x52')](_0x49f2bf,_0x1ad195)){if(_[_0x93d6('0x17')](this[_0x93d6('0xb')][_0x42118e])){this[_0x93d6('0xb')][_0x42118e]={};}this[_0x93d6('0xb')][_0x42118e][_0x1ad195]=_0x41a197;}};VoiceDialReport[_0x93d6('0x15')][_0x93d6('0x14')]=function(_0x25b8fb){try{if(this[_0x93d6('0x16')](_0x25b8fb)){logger['debug'](_0x93d6('0x53'),_0x25b8fb[_0x93d6('0x1b')],util[_0x93d6('0x1c')](_0x25b8fb,{'showHidden':![],'depth':null}));if(this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]){logger[_0x93d6('0x28')](_0x93d6('0x54'),_0x25b8fb[_0x93d6('0x1b')],_0x25b8fb[_0x93d6('0x55')]);this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x56')]=moment()[_0x93d6('0x1f')](_0x93d6('0x20'));this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x57')]=moment(this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x56')])[_0x93d6('0x58')](this['channels'][_0x25b8fb['uniqueid']][_0x93d6('0x59')],'seconds');this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]['lastevent']=_0x93d6('0x5a');this[_0x93d6('0x9')][_0x93d6('0x5b')]+=0x1;if(this[_0x93d6('0x1e')][_0x25b8fb['uniqueid']][_0x93d6('0x36')]){this['outbound'][_0x93d6('0x5c')]+=0x1;this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x5d')]=moment(this[_0x93d6('0x1e')][_0x25b8fb['uniqueid']][_0x93d6('0x36')])[_0x93d6('0x58')](this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x59')],_0x93d6('0x5e'));this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]['billableseconds']=moment(this['channels'][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x56')])['diff'](this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x36')],_0x93d6('0x5e'));this[_0x93d6('0x9')][_0x93d6('0x5f')]+=this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]['holdtime']||0x0;this[_0x93d6('0x9')]['sumBillable']+=this['channels'][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x60')];}this[_0x93d6('0x9')]['sumDuration']+=this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]][_0x93d6('0x57')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x25b8fb[_0x93d6('0x1b')],util[_0x93d6('0x1c')](this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x93d6('0x18')]('custom:voiceDialReport',this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]);logger[_0x93d6('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x25b8fb[_0x93d6('0x1b')],util[_0x93d6('0x1c')](this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x93d6('0x18')](_0x93d6('0x61'),this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]);logger[_0x93d6('0x19')](_0x93d6('0x62'),_0x25b8fb['uniqueid'],util[_0x93d6('0x1c')](this['channels'][_0x25b8fb['uniqueid']],{'showHidden':![],'depth':null}));this[_0x93d6('0x18')](_0x93d6('0x2d'),_0x93d6('0x63'),this[_0x93d6('0x9')]);logger['info'](_0x93d6('0x64'),JSON[_0x93d6('0x65')](this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]));logger[_0x93d6('0x19')](_0x93d6('0x66'),_0x25b8fb[_0x93d6('0x1b')],util[_0x93d6('0x1c')](this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]],{'showHidden':![],'depth':null}));this[_0x93d6('0x18')](_0x93d6('0x2d'),_0x93d6('0x67'),this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x1b')]]);delete this[_0x93d6('0x1e')][_0x25b8fb['uniqueid']];}else if(this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x68')]]){this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x68')]][_0x93d6('0x1b')]=this[_0x93d6('0x1e')][_0x25b8fb[_0x93d6('0x68')]][_0x93d6('0x69')];}if(this[_0x93d6('0xb')][_0x25b8fb[_0x93d6('0x1b')]]){delete this[_0x93d6('0xb')][_0x25b8fb[_0x93d6('0x1b')]];}}}catch(_0x1472bd){logger[_0x93d6('0x31')](_0x93d6('0x6a'),_0x25b8fb[_0x93d6('0x1b')],util[_0x93d6('0x1c')](_0x1472bd,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x93d6('0x12')]=function(_0x4a407c){try{if(this[_0x93d6('0x16')](_0x4a407c)){logger[_0x93d6('0x19')]('[%s][voiceDialReport][newexten]\x20event:',_0x4a407c[_0x93d6('0x1b')],util['inspect'](_0x4a407c,{'showHidden':![],'depth':null}));if(_0x4a407c['application'][_0x93d6('0x6b')]()===_0x93d6('0x6c')){_0x4a407c[_0x93d6('0x6d')]=(_0x4a407c['appdata']||_0x4a407c['applicationdata'])[_0x93d6('0x6b')]();if(_[_0x93d6('0x6e')](_0x4a407c[_0x93d6('0x6d')],_0x93d6('0x6f'))){if(_['isUndefined'](this['applications'][_0x4a407c[_0x93d6('0x1b')]]))this[_0x93d6('0xa')][_0x4a407c[_0x93d6('0x1b')]]={};logger[_0x93d6('0x28')](_0x93d6('0x70'),_0x4a407c[_0x93d6('0x1b')],_0x4a407c[_0x93d6('0x71')],_0x4a407c[_0x93d6('0x6d')]);var _0x2ab6a6=_0x4a407c[_0x93d6('0x6d')][_0x93d6('0x72')]('=');var _0xf77eae=_0x2ab6a6[0x0][_0x93d6('0x73')](/cdr\((.*)\)/);if(_0xf77eae)this[_0x93d6('0xa')][_0x4a407c[_0x93d6('0x1b')]][_0xf77eae[0x1]]=_0x2ab6a6[0x1];}}}}catch(_0x565cad){logger[_0x93d6('0x31')]('[%s][voiceDialReport][newexten]',_0x4a407c['uniqueid'],util[_0x93d6('0x1c')](_0x565cad,{'showHidden':![],'depth':null}));}};module[_0x93d6('0x74')]=VoiceDialReport; \ No newline at end of file +var _0xd8cd=['rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','starttime','seconds','total','answered','holdtime','diff','sumHoldTime','sumBillable','billableseconds','sumDuration','[%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:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','match','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','newexten','syncNewExten','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged'];(function(_0x47c500,_0x4bc088){var _0xbe7c9=function(_0x467cd9){while(--_0x467cd9){_0x47c500['push'](_0x47c500['shift']());}};_0xbe7c9(++_0x4bc088);}(_0xd8cd,0x19a));var _0xdd8c=function(_0xfc52ad,_0x19e7df){_0xfc52ad=_0xfc52ad-0x0;var _0x90d5f2=_0xd8cd[_0xfc52ad];return _0x90d5f2;};'use strict';var _=require(_0xdd8c('0x0'));var moment=require(_0xdd8c('0x1'));var util=require(_0xdd8c('0x2'));var Redis=require(_0xdd8c('0x3'));var config=require(_0xdd8c('0x4'));var logger=require(_0xdd8c('0x5'))(_0xdd8c('0x6'));var ami=require(_0xdd8c('0x7'));config[_0xdd8c('0x8')]=_[_0xdd8c('0x9')](config[_0xdd8c('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xdd8c('0xa'))(new Redis(config[_0xdd8c('0x8')]));function VoiceDialReport(_0x25c9de){this[_0xdd8c('0xb')]=_0x25c9de[_0xdd8c('0xc')];this[_0xdd8c('0xd')]=_0x25c9de[_0xdd8c('0xd')];this[_0xdd8c('0xe')]={};this[_0xdd8c('0xf')]={};ami['on'](_0xdd8c('0x10'),this[_0xdd8c('0x11')][_0xdd8c('0x12')](this));ami['on'](_0xdd8c('0x13'),this[_0xdd8c('0x14')][_0xdd8c('0x12')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xdd8c('0x15'),this[_0xdd8c('0x16')][_0xdd8c('0x12')](this));ami['on'](_0xdd8c('0x17'),this[_0xdd8c('0x18')][_0xdd8c('0x12')](this));}VoiceDialReport['prototype'][_0xdd8c('0x19')]=function(_0x5d914e){return _0x5d914e!==null&&!_[_0xdd8c('0x1a')](_0x5d914e);};VoiceDialReport[_0xdd8c('0x1b')]['emit']=function(_0x439b0d,_0x4b04fe,_0x72e121){io['to'](_0x439b0d)[_0xdd8c('0x1c')](_0x4b04fe,_0x72e121);};VoiceDialReport[_0xdd8c('0x1b')][_0xdd8c('0x11')]=function(_0x3a5382){try{if(this[_0xdd8c('0x19')](_0x3a5382)){logger[_0xdd8c('0x1d')](_0xdd8c('0x1e'),_0x3a5382['uniqueid'],util[_0xdd8c('0x1f')](_0x3a5382,{'showHidden':![],'depth':null}));if(this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]]){_['merge'](this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]],{'starttime':moment()[_0xdd8c('0x21')](_0xdd8c('0x22')),'lastevent':_0xdd8c('0x23'),'interface':_0x3a5382[_0xdd8c('0x24')]['substring'](0x0,_0x3a5382['channel'][_0xdd8c('0x25')]('-')),'membername':_0x3a5382[_0xdd8c('0x24')][_0xdd8c('0x26')](_0x3a5382[_0xdd8c('0x24')]['lastIndexOf']('/')+0x1,_0x3a5382[_0xdd8c('0x24')][_0xdd8c('0x25')]('-'))},_[_0xdd8c('0x27')](_0x3a5382,['event','privilege']));logger[_0xdd8c('0x28')](_0xdd8c('0x29'),_0x3a5382[_0xdd8c('0x20')],this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]][_0xdd8c('0x2a')],this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]]['interface']);logger[_0xdd8c('0x1d')](_0xdd8c('0x2b'),_0x3a5382[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));if(this[_0xdd8c('0xe')][_0x3a5382[_0xdd8c('0x20')]])_[_0xdd8c('0x2c')](this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]],this[_0xdd8c('0xe')][_0x3a5382['uniqueid']]);this['emit'](_0xdd8c('0x2d'),_0xdd8c('0x2e'),this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]]);logger[_0xdd8c('0x1d')](_0xdd8c('0x2f'),_0x3a5382[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](this['channels'][_0x3a5382[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));ami[_0xdd8c('0x1c')]('custom:dialbegin',this[_0xdd8c('0xb')][_0x3a5382[_0xdd8c('0x20')]]);}}}catch(_0x5c990f){logger[_0xdd8c('0x30')]('[%s][voiceDialReport][dialbegin]',_0x3a5382[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](_0x5c990f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xdd8c('0x14')]=function(_0x45f02f){try{if(this[_0xdd8c('0x19')](_0x45f02f)){logger[_0xdd8c('0x1d')](_0xdd8c('0x31'),_0x45f02f[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](_0x45f02f,{'showHidden':![],'depth':null}));if(this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]]){this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]][_0xdd8c('0x32')]=_0x45f02f[_0xdd8c('0x32')];if(_0x45f02f[_0xdd8c('0x32')]===_0xdd8c('0x33')){this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]][_0xdd8c('0x34')]=_0x45f02f[_0xdd8c('0x34')];this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]][_0xdd8c('0x35')]=_0x45f02f[_0xdd8c('0x35')];this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]][_0xdd8c('0x36')]=moment()['format'](_0xdd8c('0x22'));this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]][_0xdd8c('0x37')]=_0xdd8c('0x38');logger[_0xdd8c('0x28')](_0xdd8c('0x39'),_0x45f02f[_0xdd8c('0x20')],_0x45f02f[_0xdd8c('0x24')][_0xdd8c('0x26')](_0x45f02f['channel'][_0xdd8c('0x25')]('/')+0x1,_0x45f02f[_0xdd8c('0x24')][_0xdd8c('0x25')]('-')));logger[_0xdd8c('0x1d')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x45f02f['uniqueid'],util['inspect'](this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));ami['emit'](_0xdd8c('0x3a'),this['channels'][_0x45f02f['uniqueid']]);}logger['debug'](_0xdd8c('0x3b'),_0x45f02f[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](this[_0xdd8c('0xb')][_0x45f02f[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));this[_0xdd8c('0x1c')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x45f02f['uniqueid']]);}}}catch(_0x6c5f15){logger[_0xdd8c('0x30')]('[%s][voiceDialReport][dialend]',_0x45f02f[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](_0x6c5f15,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdd8c('0x1b')][_0xdd8c('0x3c')]=function(_0x5e408c){try{if(this['isNotNull'](_0x5e408c)){logger['debug'](_0xdd8c('0x3d'),_0x5e408c[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](_0x5e408c,{'showHidden':![],'depth':null}));this[_0xdd8c('0x3e')](_0x5e408c[_0xdd8c('0x20')],_[_0xdd8c('0x3f')](_0x5e408c[_0xdd8c('0x40')])[0x0],_0x5e408c['value']);if(this[_0xdd8c('0x19')](_0x5e408c['variable'])&&this[_0xdd8c('0x19')](_0x5e408c[_0xdd8c('0x40')][_0xdd8c('0x41')])){if(_[_0xdd8c('0x1a')](this[_0xdd8c('0xb')][_0x5e408c[_0xdd8c('0x20')]])){this[_0xdd8c('0xb')][_0x5e408c[_0xdd8c('0x20')]]={'routeId':_0x5e408c[_0xdd8c('0x42')],'variables':this[_0xdd8c('0xf')][_0x5e408c['uniqueid']],'motionChannel':_0xdd8c('0x43')};logger[_0xdd8c('0x28')](_0xdd8c('0x44'),_0x5e408c[_0xdd8c('0x20')],_0x5e408c[_0xdd8c('0x40')][_0xdd8c('0x41')],_[_0xdd8c('0x3f')](_0x5e408c['variable'])[0x0],_0x5e408c[_0xdd8c('0x42')]);logger[_0xdd8c('0x1d')](_0xdd8c('0x45'),_0x5e408c[_0xdd8c('0x20')],util['inspect'](this[_0xdd8c('0xb')][_0x5e408c[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));this[_0xdd8c('0x1c')](_0xdd8c('0x2d'),'voice_outbound_channel:save',this[_0xdd8c('0xb')][_0x5e408c[_0xdd8c('0x20')]]);}}}}catch(_0x8e7127){logger[_0xdd8c('0x30')]('[%s][voiceDialReport][varset]',_0x5e408c['uniqueid'],util[_0xdd8c('0x1f')](_0x8e7127,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdd8c('0x1b')][_0xdd8c('0x3e')]=function(_0x3a9838,_0x14fa42,_0x5eea66){var _0x5731d8=[_0xdd8c('0x46'),_0xdd8c('0x47'),_0xdd8c('0x48'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xdd8c('0x49'),_0xdd8c('0x4a'),'rtpaudioqosrttbridged',_0xdd8c('0x4b'),_0xdd8c('0x4c'),_0xdd8c('0x4d'),_0xdd8c('0x4e'),_0xdd8c('0x4f'),'memberdynamic',_0xdd8c('0x50'),_0xdd8c('0x51'),'membername',_0xdd8c('0x52'),_0xdd8c('0x53')];if(!_[_0xdd8c('0x54')](_0x14fa42)&&!_[_0xdd8c('0x55')](_0x5731d8,_0x14fa42)){if(_['isUndefined'](this[_0xdd8c('0xf')][_0x3a9838])){this['variables'][_0x3a9838]={};}this['variables'][_0x3a9838][_0x14fa42]=_0x5eea66;}};VoiceDialReport['prototype'][_0xdd8c('0x18')]=function(_0x4e5cc4){try{if(this[_0xdd8c('0x19')](_0x4e5cc4)){logger[_0xdd8c('0x1d')](_0xdd8c('0x56'),_0x4e5cc4[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](_0x4e5cc4,{'showHidden':![],'depth':null}));if(this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]]){logger[_0xdd8c('0x28')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4e5cc4[_0xdd8c('0x20')],_0x4e5cc4[_0xdd8c('0x57')]);this[_0xdd8c('0xb')][_0x4e5cc4['uniqueid']][_0xdd8c('0x58')]=moment()[_0xdd8c('0x21')](_0xdd8c('0x22'));this['channels'][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x59')]=moment(this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]]['endtime'])['diff'](this['channels'][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x5a')],_0xdd8c('0x5b'));this['channels'][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x37')]='complete';this['outbound'][_0xdd8c('0x5c')]+=0x1;if(this[_0xdd8c('0xb')][_0x4e5cc4['uniqueid']][_0xdd8c('0x36')]){this['outbound'][_0xdd8c('0x5d')]+=0x1;this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x5e')]=moment(this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x36')])[_0xdd8c('0x5f')](this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x5a')],_0xdd8c('0x5b'));this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]]['billableseconds']=moment(this['channels'][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x58')])['diff'](this['channels'][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x36')],_0xdd8c('0x5b'));this[_0xdd8c('0xd')][_0xdd8c('0x60')]+=this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x5e')]||0x0;this[_0xdd8c('0xd')][_0xdd8c('0x61')]+=this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]][_0xdd8c('0x62')];}this[_0xdd8c('0xd')][_0xdd8c('0x63')]+=this[_0xdd8c('0xb')][_0x4e5cc4['uniqueid']]['duration'];logger[_0xdd8c('0x1d')](_0xdd8c('0x64'),_0x4e5cc4['uniqueid'],util[_0xdd8c('0x1f')](this['channels'][_0x4e5cc4[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));ami[_0xdd8c('0x1c')](_0xdd8c('0x65'),this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]]);logger[_0xdd8c('0x1d')](_0xdd8c('0x66'),_0x4e5cc4[_0xdd8c('0x20')],util['inspect'](this['channels'][_0x4e5cc4[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));ami[_0xdd8c('0x1c')](_0xdd8c('0x67'),this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]]);logger['debug'](_0xdd8c('0x68'),_0x4e5cc4[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](this['channels'][_0x4e5cc4[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));this['emit'](_0xdd8c('0x2d'),_0xdd8c('0x69'),this['outbound']);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xdd8c('0x6a')](this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]]));logger[_0xdd8c('0x1d')](_0xdd8c('0x6b'),_0x4e5cc4[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]],{'showHidden':![],'depth':null}));this[_0xdd8c('0x1c')](_0xdd8c('0x2d'),_0xdd8c('0x6c'),this[_0xdd8c('0xb')][_0x4e5cc4['uniqueid']]);delete this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x20')]];}else if(this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x6d')]]){this[_0xdd8c('0xb')][_0x4e5cc4[_0xdd8c('0x6d')]]['uniqueid']=this['channels'][_0x4e5cc4['linkedid']][_0xdd8c('0x6e')];}if(this['variables'][_0x4e5cc4[_0xdd8c('0x20')]]){delete this['variables'][_0x4e5cc4[_0xdd8c('0x20')]];}}}catch(_0x5a6990){logger[_0xdd8c('0x30')](_0xdd8c('0x6f'),_0x4e5cc4['uniqueid'],util[_0xdd8c('0x1f')](_0x5a6990,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdd8c('0x1b')][_0xdd8c('0x16')]=function(_0x717f4e){try{if(this[_0xdd8c('0x19')](_0x717f4e)){logger[_0xdd8c('0x1d')]('[%s][voiceDialReport][newexten]\x20event:',_0x717f4e[_0xdd8c('0x20')],util['inspect'](_0x717f4e,{'showHidden':![],'depth':null}));if(_0x717f4e['application'][_0xdd8c('0x70')]()===_0xdd8c('0x71')){_0x717f4e[_0xdd8c('0x72')]=(_0x717f4e[_0xdd8c('0x73')]||_0x717f4e['applicationdata'])[_0xdd8c('0x70')]();if(_['startsWith'](_0x717f4e[_0xdd8c('0x72')],_0xdd8c('0x74'))){if(_[_0xdd8c('0x1a')](this[_0xdd8c('0xe')][_0x717f4e[_0xdd8c('0x20')]]))this[_0xdd8c('0xe')][_0x717f4e[_0xdd8c('0x20')]]={};logger[_0xdd8c('0x28')](_0xdd8c('0x75'),_0x717f4e[_0xdd8c('0x20')],_0x717f4e[_0xdd8c('0x76')],_0x717f4e[_0xdd8c('0x72')]);var _0x2faa7b=_0x717f4e[_0xdd8c('0x72')]['split']('=');var _0x293415=_0x2faa7b[0x0][_0xdd8c('0x77')](/cdr\((.*)\)/);if(_0x293415)this[_0xdd8c('0xe')][_0x717f4e[_0xdd8c('0x20')]][_0x293415[0x1]]=_0x2faa7b[0x1];}}}}catch(_0x4e514c){logger[_0xdd8c('0x30')]('[%s][voiceDialReport][newexten]',_0x717f4e[_0xdd8c('0x20')],util[_0xdd8c('0x1f')](_0x4e514c,{'showHidden':![],'depth':null}));}};module[_0xdd8c('0x78')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 7976786..21a73e0 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 _0x7b37=['queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentconnect','syncAgentConnect','syncVarSet','syncHangup','fullybooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','hasOwnProperty','pTalking','waiting','unlockRR','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','uniqueid','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][','voice_queue:save','isNotNull','isUndefined','queues','error','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','talking','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerexitreason','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','timeout','custom:timeout','varset','queueposition','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','includes','[%s][voiceQueueReport][hangup]','length','diff','milliseconds','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','custom:voiceQueueReport','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','CDR(routeAlias)','applicationdata','toLowerCase','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','md5','ioredis','../../../config/logger','../ami','../model/queueReport','redis','localhost','prototype','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind'];(function(_0x2b76de,_0x2c174c){var _0x4bbf3e=function(_0x422977){while(--_0x422977){_0x2b76de['push'](_0x2b76de['shift']());}};_0x4bbf3e(++_0x2c174c);}(_0x7b37,0xd9));var _0x77b3=function(_0x4f5916,_0x39c8f5){_0x4f5916=_0x4f5916-0x0;var _0x35137b=_0x7b37[_0x4f5916];return _0x35137b;};'use strict';var _=require(_0x77b3('0x0'));var moment=require(_0x77b3('0x1'));var util=require('util');var md5=require(_0x77b3('0x2'));var Redis=require(_0x77b3('0x3'));var config=require('../../../config/environment');var logger=require(_0x77b3('0x4'))('ami');var ami=require(_0x77b3('0x5'));var QueueReport=require(_0x77b3('0x6'));config[_0x77b3('0x7')]=_['defaults'](config[_0x77b3('0x7')],{'host':_0x77b3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x77b3('0x9')]['enqueue']=function(_0x35becb){this[_0x77b3('0xa')]=this['tail']?this[_0x77b3('0xa')][_0x77b3('0xb')](_0x35becb):_0x35becb();};function VoiceQueueReport(_0x24f2a1){this[_0x77b3('0xc')]=new Sequence();this[_0x77b3('0xd')]={};this[_0x77b3('0xe')]=_0x24f2a1[_0x77b3('0xe')];this[_0x77b3('0xf')]=_0x24f2a1[_0x77b3('0x10')];this[_0x77b3('0x11')]=_0x24f2a1['voiceQueues'];this[_0x77b3('0x12')]=!![];this[_0x77b3('0x13')]=_0x24f2a1[_0x77b3('0x13')];this[_0x77b3('0x14')]={};ami['on'](_0x77b3('0x15'),this[_0x77b3('0x16')][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x18'),this[_0x77b3('0x19')][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x1a'),this[_0x77b3('0x1b')]['bind'](this));ami['on'](_0x77b3('0x1c'),this[_0x77b3('0x1d')][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x1e'),this['syncQueueCallerLeave'][_0x77b3('0x17')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x1f'),this[_0x77b3('0x20')][_0x77b3('0x17')](this));ami['on']('varset',this[_0x77b3('0x21')]['bind'](this));ami['on']('hangup',this[_0x77b3('0x22')][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x23'),this['syncFullyBooted'][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x24'),this[_0x77b3('0x25')][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x26'),this[_0x77b3('0x27')][_0x77b3('0x17')](this));ami['on'](_0x77b3('0x28'),this[_0x77b3('0x29')][_0x77b3('0x17')](this));ami['on']('attendedtransfer',this[_0x77b3('0x2a')]['bind'](this));ami['on'](_0x77b3('0x2b'),this['syncBlindTransfer'][_0x77b3('0x17')](this));this[_0x77b3('0x2c')]();this[_0x77b3('0x2d')]();}function clearChannels(_0x3cd476){if(!_[_0x77b3('0x2e')](_0x3cd476)){for(var _0x5799c3 in _0x3cd476){if(_0x3cd476['hasOwnProperty'](_0x5799c3)){delete _0x3cd476[_0x5799c3];}}}}function clearCampaigns(_0x390b56){if(!_[_0x77b3('0x2e')](_0x390b56)){for(var _0x25dc3a in _0x390b56){if(_0x390b56['hasOwnProperty'](_0x25dc3a)){_0x390b56[_0x25dc3a][_0x77b3('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x287733){if(!_[_0x77b3('0x2e')](_0x287733)){for(var _0x2df602 in _0x287733){if(_0x287733[_0x77b3('0x30')](_0x2df602)){_0x287733[_0x2df602][_0x77b3('0x2f')]=0x0;_0x287733[_0x2df602]['talking']=0x0;_0x287733[_0x2df602][_0x77b3('0x31')]=0x0;_0x287733[_0x2df602][_0x77b3('0x32')]=0x0;_0x287733[_0x2df602]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x5e8d7a){if(!_[_0x77b3('0x2e')](_0x5e8d7a)){for(var _0x460813 in _0x5e8d7a){if(_0x5e8d7a[_0x77b3('0x30')](_0x460813)){_0x5e8d7a[_0x460813][_0x77b3('0x33')]=!![];}}}}VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x34')]=function(){var _0x3ff4ea=this;for(var _0xe88a76 in this[_0x77b3('0xf')]){if(this[_0x77b3('0xf')]['hasOwnProperty'](_0xe88a76)&&!this['channels'][_0xe88a76][_0x77b3('0x35')]){this[_0x77b3('0xc')]['enqueue'](function(){if(!_[_0x77b3('0x36')](_0x3ff4ea[_0x77b3('0xf')][_0xe88a76])){return ami[_0x77b3('0x37')]({'action':_0x77b3('0x38'),'channel':_0x3ff4ea['channels'][_0xe88a76][_0x77b3('0x39')]})[_0x77b3('0x3a')](function(_0x43d281){if(_0x43d281[_0x77b3('0x3b')]===_0x77b3('0x3c')){setTimeout(function(){if(_0x3ff4ea[_0x77b3('0xf')][_0xe88a76]){delete _0x3ff4ea[_0x77b3('0xf')][_0xe88a76];logger['error']('[%s][voiceQueueReport][checkChannel]',_0xe88a76,util[_0x77b3('0x3d')](_0x43d281,{'showHidden':![],'depth':null}));}if(_0x3ff4ea['queueReports'][_0xe88a76]){delete _0x3ff4ea['queueReports'][_0xe88a76];logger['error'](_0x77b3('0x3e'),_0xe88a76,util[_0x77b3('0x3d')](_0x43d281,{'showHidden':![],'depth':null}));}if(_0x3ff4ea[_0x77b3('0x14')][_0xe88a76]){delete _0x3ff4ea[_0x77b3('0x14')][_0xe88a76];logger['error'](_0x77b3('0x3f'),_0xe88a76,util[_0x77b3('0x3d')](_0x43d281,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x40')]=function(){logger['error'](_0x77b3('0x41'));clearChannels(this[_0x77b3('0xf')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0x77b3('0xe')]);clearVoiceQueues(this[_0x77b3('0x11')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x77b3('0x9')]['clearQueueReport']=function(_0x4d036d){var _0x350713=this;if(!_[_0x77b3('0x2e')](_0x4d036d)){for(var _0x4c7f73 in _0x4d036d){if(_0x4d036d[_0x77b3('0x30')](_0x4c7f73)){_0x350713[_0x77b3('0x42')](_0x4d036d[_0x4c7f73],_0x77b3('0x43'));delete _0x4d036d[_0x4c7f73];}}}};VoiceQueueReport[_0x77b3('0x9')]['emit']=function(_0x9c287,_0xc917a5,_0x48a661){io['to'](_0x9c287)[_0x77b3('0x44')](_0xc917a5,_0x48a661);};VoiceQueueReport['prototype'][_0x77b3('0x45')]=function(_0x2553c1,_0x131356){logger[_0x77b3('0x46')](_0x77b3('0x47')+_0x131356+_0x77b3('0x48'),_0x2553c1['uniqueid'],util[_0x77b3('0x3d')](_0x2553c1,{'showHidden':![],'depth':null}));this[_0x77b3('0x44')](util[_0x77b3('0x49')](_0x77b3('0x4a'),_0x2553c1[_0x77b3('0x4b')]),_0x77b3('0x4c'),_0x2553c1);io['emit'](_0x77b3('0x4d'),_0x2553c1);};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x42')]=function(_0x59980f,_0xed63ae){logger['debug'](_0x77b3('0x47')+_0xed63ae+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x59980f[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x59980f,{'showHidden':![],'depth':null}));this[_0x77b3('0x44')](util[_0x77b3('0x49')]('voice:queue:%s',_0x59980f[_0x77b3('0x4b')]),_0x77b3('0x4f'),_0x59980f);io[_0x77b3('0x44')](_0x77b3('0x50'),_0x59980f);};VoiceQueueReport['prototype'][_0x77b3('0x51')]=function(_0x5bba05,_0x4beb04){if(_0x5bba05[_0x77b3('0x52')]===_0x77b3('0x53')){var _0x8ad837={'id':_0x5bba05['id'],'name':_0x5bba05[_0x77b3('0x4b')],'strategy':_0x5bba05[_0x77b3('0x54')],'answered':_0x5bba05[_0x77b3('0x55')],'available':_0x5bba05[_0x77b3('0x56')],'loggedIn':_0x5bba05[_0x77b3('0x57')],'pTalking':_0x5bba05['pTalking'],'sumBillable':_0x5bba05[_0x77b3('0x58')],'sumDuration':_0x5bba05[_0x77b3('0x59')],'sumHoldTime':_0x5bba05[_0x77b3('0x5a')]||0x0,'talking':_0x5bba05['talking'],'total':_0x5bba05[_0x77b3('0x5b')],'type':_0x5bba05[_0x77b3('0x52')],'unmanaged':_0x5bba05[_0x77b3('0x5c')],'abandoned':_0x5bba05[_0x77b3('0x5d')],'waiting':_0x5bba05[_0x77b3('0x32')]};if(_0x5bba05[_0x77b3('0x5e')]){_0x8ad837[_0x77b3('0x5e')]={'id':_0x5bba05[_0x77b3('0x5e')]['id'],'name':_0x5bba05[_0x77b3('0x5e')][_0x77b3('0x4b')],'active':_0x5bba05[_0x77b3('0x5e')][_0x77b3('0x5f')],'callerid':_0x5bba05[_0x77b3('0x5e')][_0x77b3('0x60')]};}if(_0x5bba05[_0x77b3('0x61')]){_0x8ad837[_0x77b3('0x61')]={'id':_0x5bba05['Interval']['id'],'name':_0x5bba05[_0x77b3('0x61')][_0x77b3('0x4b')]};}var _0x446683=md5(JSON[_0x77b3('0x62')](_0x8ad837));if(_0x5bba05[_0x77b3('0x2')]!==_0x446683){_0x5bba05[_0x77b3('0x2')]=_0x446683;logger[_0x77b3('0x46')](_0x77b3('0x63')+_0x4beb04+']\x20sending\x20voice_queue:save\x20event:',util[_0x77b3('0x3d')](_0x8ad837,{'showHidden':![],'depth':null}));this[_0x77b3('0x44')](util[_0x77b3('0x49')](_0x77b3('0x4a'),_0x8ad837[_0x77b3('0x4b')]),_0x77b3('0x64'),_0x8ad837);}}};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x65')]=function(_0x26a0fe){return _0x26a0fe!==null&&!_[_0x77b3('0x66')](_0x26a0fe);};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x2d')]=function(){var _0x188dbf=this;setInterval(function(){_0x188dbf[_0x77b3('0x34')]();ami[_0x77b3('0x37')]({'action':_0x77b3('0x67')})['catch'](function(_0x5db561){logger[_0x77b3('0x68')](_0x77b3('0x69'),util[_0x77b3('0x3d')](_0x5db561,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x2c')]=function(){var _0x1a10f0=this;setInterval(function(){if(_0x1a10f0['flagQueueSummary']){return ami[_0x77b3('0x37')]({'action':_0x77b3('0x15')})[_0x77b3('0x6a')](function(_0x586e1b){_0x1a10f0[_0x77b3('0x12')]=![];})[_0x77b3('0x3a')](function(_0x2f75e5){logger[_0x77b3('0x68')](_0x77b3('0x6b'),util['inspect'](_0x2f75e5,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x16')]=function(_0x2afc57){try{if(this[_0x77b3('0x65')](_0x2afc57)&&this[_0x77b3('0x65')](_0x2afc57[_0x77b3('0x6c')])){logger[_0x77b3('0x46')](_0x77b3('0x6d'),util[_0x77b3('0x3d')](_0x2afc57,{'showHidden':![],'depth':null}));if(this[_0x77b3('0x11')][_0x2afc57[_0x77b3('0x6c')]]){logger[_0x77b3('0x6e')](_0x77b3('0x6f'),_0x2afc57[_0x77b3('0x6c')]);var _0x4c3648=_['countBy'](this[_0x77b3('0xf')],_0x77b3('0x6c'))[_0x2afc57[_0x77b3('0x6c')]]||0x0;var _0x2c3dea=_0x4c3648-_0x2afc57[_0x77b3('0x70')];if(this['voiceQueues'][_0x2afc57[_0x77b3('0x6c')]]['waiting']!==_[_0x77b3('0x71')](_0x2afc57['callers'])||this[_0x77b3('0x11')][_0x2afc57[_0x77b3('0x6c')]][_0x77b3('0x57')]!==_[_0x77b3('0x71')](_0x2afc57[_0x77b3('0x72')])||this[_0x77b3('0x11')][_0x2afc57[_0x77b3('0x6c')]][_0x77b3('0x56')]!==_[_0x77b3('0x71')](_0x2afc57['available'])||this['voiceQueues'][_0x2afc57[_0x77b3('0x6c')]][_0x77b3('0x73')]!==_0x2c3dea){this[_0x77b3('0x11')][_0x2afc57['queue']][_0x77b3('0x32')]=_[_0x77b3('0x71')](_0x2afc57[_0x77b3('0x70')]);this['voiceQueues'][_0x2afc57[_0x77b3('0x6c')]]['loggedIn']=_[_0x77b3('0x71')](_0x2afc57[_0x77b3('0x72')]);this['voiceQueues'][_0x2afc57[_0x77b3('0x6c')]]['available']=_[_0x77b3('0x71')](_0x2afc57[_0x77b3('0x56')]);this[_0x77b3('0x11')][_0x2afc57[_0x77b3('0x6c')]][_0x77b3('0x73')]=_0x2c3dea>0x0?_0x2c3dea:0x0;this[_0x77b3('0x11')][_0x2afc57['queue']][_0x77b3('0x73')]=this[_0x77b3('0x11')][_0x2afc57[_0x77b3('0x6c')]][_0x77b3('0x73')]>_['toNumber'](_0x2afc57['loggedin'])?_[_0x77b3('0x71')](_0x2afc57['loggedin']):this['voiceQueues'][_0x2afc57[_0x77b3('0x6c')]]['talking'];this[_0x77b3('0x51')](this['voiceQueues'][_0x2afc57[_0x77b3('0x6c')]],_0x77b3('0x15'));}logger[_0x77b3('0x46')](_0x77b3('0x74'),util['inspect'](this[_0x77b3('0x11')][_0x2afc57[_0x77b3('0x6c')]],{'showHidden':![],'depth':null}));ami[_0x77b3('0x44')](_0x77b3('0x75'),this[_0x77b3('0x11')][_0x2afc57[_0x77b3('0x6c')]]);}}}catch(_0x423e3b){logger['error']('[voiceQueueReport][queuesummary]',util[_0x77b3('0x3d')](_0x423e3b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x77b3('0x19')]=function(_0x47c7d5){logger[_0x77b3('0x46')](_0x77b3('0x76'),util[_0x77b3('0x3d')](_0x47c7d5,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x1b')]=function(_0xd281ca){try{if(this[_0x77b3('0x65')](_0xd281ca)){logger[_0x77b3('0x46')](_0x77b3('0x77'),_0xd281ca['uniqueid'],util[_0x77b3('0x3d')](_0xd281ca,{'showHidden':![],'depth':null}));if(_[_0x77b3('0x66')](this['queueReports'][_0xd281ca['uniqueid']]))this['queueReports'][_0xd281ca['uniqueid']]=[];if(_[_0x77b3('0x66')](this['channels'][_0xd281ca[_0x77b3('0x4e')]]))this['channels'][_0xd281ca['uniqueid']]={};var _0xa36ec9=new QueueReport();_0xa36ec9[_0x77b3('0x4b')]=_0xd281ca[_0x77b3('0x6c')];_0xa36ec9[_0x77b3('0x52')]=this['voiceQueues'][_0xa36ec9[_0x77b3('0x4b')]]&&this[_0x77b3('0x11')][_0xa36ec9[_0x77b3('0x4b')]][_0x77b3('0x52')]?this[_0x77b3('0x11')][_0xa36ec9[_0x77b3('0x4b')]][_0x77b3('0x52')]||_0x77b3('0x53'):_0x77b3('0x53');_0xa36ec9[_0x77b3('0x6c')]=_0xd281ca[_0x77b3('0x6c')];_0xa36ec9[_0x77b3('0x78')]=moment()[_0x77b3('0x49')](_0x77b3('0x79'));_0xa36ec9[_0x77b3('0x7a')]=_0xd281ca[_0x77b3('0x7a')];_0xa36ec9['count']=_0xd281ca['count'];_0xa36ec9[_0x77b3('0x4e')]=_0xd281ca['uniqueid'];_0xa36ec9['routealias']=this[_0x77b3('0xf')][_0xd281ca[_0x77b3('0x4e')]][_0x77b3('0x7b')];logger[_0x77b3('0x6e')](_0x77b3('0x7c'),_0xa36ec9[_0x77b3('0x4b')],_0xa36ec9[_0x77b3('0x52')]);_['merge'](_0xa36ec9,_[_0x77b3('0x7d')](_0xd281ca,_[_0x77b3('0x7e')](_0xa36ec9)));this[_0x77b3('0xd')][_0xd281ca[_0x77b3('0x4e')]]['push'](_0xa36ec9);this[_0x77b3('0xf')][_0xd281ca[_0x77b3('0x4e')]]=_0xa36ec9;this[_0x77b3('0x45')](_0xa36ec9,_0x77b3('0x1a'));}}catch(_0x5afa9d){logger[_0x77b3('0x68')](_0x77b3('0x77'),_0xd281ca[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x5afa9d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x1d')]=function(_0x530e49){try{if(this[_0x77b3('0x65')](_0x530e49)){logger[_0x77b3('0x46')](_0x77b3('0x7f'),_0x530e49[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x530e49,{'showHidden':![],'depth':null}));if(this[_0x77b3('0xd')][_0x530e49['uniqueid']]){var _0x297cd4=_[_0x77b3('0x80')](this[_0x77b3('0xd')][_0x530e49[_0x77b3('0x4e')]]);_0x297cd4[_0x77b3('0x81')]=![];_0x297cd4[_0x77b3('0x82')]=null;_0x297cd4[_0x77b3('0x83')]=_0x530e49[_0x77b3('0x83')];_0x297cd4[_0x77b3('0x84')]=_0x530e49[_0x77b3('0x84')];_0x297cd4[_0x77b3('0x1c')]=!![];_0x297cd4[_0x77b3('0x85')]=moment()[_0x77b3('0x49')](_0x77b3('0x79'));_0x297cd4['queuecallerexitreason']=_0x77b3('0x86');_0x297cd4[_0x77b3('0x87')]=null;logger[_0x77b3('0x6e')](_0x77b3('0x88'),_0x297cd4[_0x77b3('0x4b')],_0x297cd4['type']);this[_0x77b3('0xf')][_0x530e49[_0x77b3('0x4e')]]=_0x297cd4;this['emitVoiceQueueChannelRemove'](_0x297cd4,_0x77b3('0x1c'));}}}catch(_0xb72552){logger[_0x77b3('0x68')](_0x77b3('0x7f'),_0x530e49[_0x77b3('0x4e')],util['inspect'](_0xb72552,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x89')]=function(_0x3ce333){try{if(this[_0x77b3('0x65')](_0x3ce333)){logger['debug'](_0x77b3('0x8a'),_0x3ce333[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x3ce333,{'showHidden':![],'depth':null}));if(this[_0x77b3('0xd')][_0x3ce333[_0x77b3('0x4e')]]){var _0x5ddc9d=_['last'](this[_0x77b3('0xd')][_0x3ce333[_0x77b3('0x4e')]]);_0x5ddc9d[_0x77b3('0x8b')]=moment()['format'](_0x77b3('0x79'));_0x5ddc9d[_0x77b3('0x8c')]=_0x3ce333[_0x77b3('0x8c')];_0x5ddc9d[_0x77b3('0x8d')]=_0x3ce333['connectedlinename'];logger[_0x77b3('0x6e')](_0x77b3('0x8e'),_0x5ddc9d[_0x77b3('0x4b')],_0x5ddc9d[_0x77b3('0x52')],_0x3ce333['connectedlinenum'],_0x3ce333['connectedlinename']);this[_0x77b3('0xf')][_0x3ce333[_0x77b3('0x4e')]]=_0x5ddc9d;this[_0x77b3('0x45')](_0x5ddc9d,'queuecallerleave');}}}catch(_0x30e312){logger['error'](_0x77b3('0x8a'),_0x3ce333[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x30e312,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x20')]=function(_0x5392a2){try{if(this[_0x77b3('0x65')](_0x5392a2)){logger[_0x77b3('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x5392a2['uniqueid'],util['inspect'](_0x5392a2,{'showHidden':![],'depth':null}));if(this[_0x77b3('0xd')][_0x5392a2[_0x77b3('0x4e')]]){var _0x452d0e=_['last'](this['queueReports'][_0x5392a2[_0x77b3('0x4e')]]);_0x452d0e[_0x77b3('0x81')]=!![];_0x452d0e[_0x77b3('0x8f')]='COMPLETEDBYAGENT';logger[_0x77b3('0x6e')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x452d0e[_0x77b3('0x4b')],_0x452d0e[_0x77b3('0x52')]);}}}catch(_0x5d991e){logger[_0x77b3('0x68')]('[%s][voiceQueueReport][agentconnect]',_0x5392a2['uniqueid'],util[_0x77b3('0x3d')](_0x5d991e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x77b3('0x90')]=function(_0x5ce3c3){try{if(this[_0x77b3('0x65')](_0x5ce3c3)){logger[_0x77b3('0x46')](_0x77b3('0x91'),_0x5ce3c3[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x5ce3c3,{'showHidden':![],'depth':null}));if(this[_0x77b3('0xd')][_0x5ce3c3[_0x77b3('0x4e')]]){var _0x144f20=_[_0x77b3('0x80')](this[_0x77b3('0xd')][_0x5ce3c3['uniqueid']]);_0x144f20[_0x77b3('0x1c')]=![];_0x144f20[_0x77b3('0x85')]=null;_0x144f20[_0x77b3('0x92')]=!![];_0x144f20['lastAssignedTo']=_0x5ce3c3[_0x77b3('0x93')];_0x144f20[_0x77b3('0x83')]=_0x5ce3c3[_0x77b3('0x83')];_0x144f20[_0x77b3('0x81')]=!![];_0x144f20[_0x77b3('0x94')]=![];_0x144f20[_0x77b3('0x95')]=null;if(!_0x144f20[_0x77b3('0x96')]){if(_0x5ce3c3[_0x77b3('0x97')]=='transfer'){_0x144f20[_0x77b3('0x8f')]=_0x77b3('0x98');logger[_0x77b3('0x6e')](_0x77b3('0x99'),_0x144f20[_0x77b3('0x4b')],_0x144f20[_0x77b3('0x52')]);}else{if(_[_0x77b3('0x9a')](_0x5ce3c3[_0x77b3('0x39')]['toLowerCase'](),'local/')){if(this[_0x77b3('0xd')][_0x5ce3c3[_0x77b3('0x9b')]]){var _0x39f03d=_[_0x77b3('0x80')](this[_0x77b3('0xd')][_0x5ce3c3[_0x77b3('0x9b')]]);_0x39f03d[_0x77b3('0x81')]=![];_0x39f03d[_0x77b3('0x94')]=!![];_0x39f03d['queuecallerexitAt']=moment(_0x144f20[_0x77b3('0x78')])['add'](_0x5ce3c3[_0x77b3('0x83')],_0x77b3('0x9c'))[_0x77b3('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x39f03d[_0x77b3('0x8f')]=_0x77b3('0x9d');_0x39f03d[_0x77b3('0x96')]=!![];_0x39f03d[_0x77b3('0x9e')]=_0x77b3('0x9f');_0x39f03d['transferexten']=_0x5ce3c3['destexten'];_0x39f03d[_0x77b3('0xa0')]=_0x5ce3c3[_0x77b3('0x4e')];logger['info'](_0x77b3('0xa1'),_0x39f03d[_0x77b3('0x4b')],_0x39f03d[_0x77b3('0x52')]);var _0x539417=this[_0x77b3('0xd')][_0x5ce3c3[_0x77b3('0x9b')]];this['queueReports'][_0x5ce3c3['linkedid']]=this[_0x77b3('0xd')][_0x5ce3c3[_0x77b3('0x4e')]];this[_0x77b3('0xd')][_0x5ce3c3['uniqueid']]=_0x539417;}}else{_0x144f20[_0x77b3('0x8f')]=_0x77b3('0xa2')+_0x5ce3c3[_0x77b3('0x97')][_0x77b3('0xa3')]();logger[_0x77b3('0x6e')](_0x77b3('0xa4'),_0x144f20[_0x77b3('0x4b')],_0x144f20[_0x77b3('0x52')],_0x144f20[_0x77b3('0x8f')]);}}}this[_0x77b3('0xf')][_0x5ce3c3[_0x77b3('0x4e')]]=_0x144f20;this[_0x77b3('0x42')](_0x144f20,_0x77b3('0xa5'));}}}catch(_0xfa1a81){logger[_0x77b3('0x68')]('[%s][voiceQueueReport][agentcomplete]',_0x5ce3c3['uniqueid'],util[_0x77b3('0x3d')](_0xfa1a81,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0x21')]=function(_0x360729){try{if(this[_0x77b3('0x65')](_0x360729)){logger['debug'](_0x77b3('0xa6'),_0x360729[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x360729,{'showHidden':![],'depth':null}));this[_0x77b3('0xa7')](_0x360729[_0x77b3('0x4e')],_[_0x77b3('0x7e')](_0x360729[_0x77b3('0xa8')])[0x0],_0x360729[_0x77b3('0xa9')]);if(this[_0x77b3('0xd')][_0x360729[_0x77b3('0x4e')]]){var _0xd17c66=_[_0x77b3('0x80')](this[_0x77b3('0xd')][_0x360729[_0x77b3('0x4e')]]);if(_0xd17c66){if(this['isNotNull'](_0x360729['variable'])&&this[_0x77b3('0x65')](_0x360729[_0x77b3('0xa8')][_0x77b3('0xaa')])){switch(_0x360729[_0x77b3('0xa9')]){case _0x77b3('0xab'):_0xd17c66['queuecallerexit']=![];_0xd17c66[_0x77b3('0x95')]=null;break;case _0x77b3('0xac'):_0xd17c66['lastevent']=_0x77b3('0xad');_0xd17c66['queuecallerexit']=!![];_0xd17c66[_0x77b3('0x95')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd17c66[_0x77b3('0x8b')]=moment()[_0x77b3('0x49')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x77b3('0x46')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x360729[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0xd17c66,{'showHidden':![],'depth':null}));ami[_0x77b3('0x44')](_0x77b3('0xae'),_0xd17c66);break;default:_0xd17c66[_0x77b3('0x94')]=!![];_0xd17c66[_0x77b3('0x95')]=moment()[_0x77b3('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xd17c66[_0x77b3('0x8b')]=moment()[_0x77b3('0x49')]('YYYY-MM-DD\x20HH:mm:ss');}_0xd17c66[_0x77b3('0x1c')]=![];_0xd17c66['queuecallerabandonAt']=null;_0xd17c66[_0x77b3('0x8f')]=_0x360729[_0x77b3('0xa9')];this[_0x77b3('0xf')][_0x360729[_0x77b3('0x4e')]]=_0xd17c66;this[_0x77b3('0x42')](_0xd17c66,_0x77b3('0xaf'));}else if(this['isNotNull'](_0x360729['variable'])&&this['isNotNull'](_0x360729['variable'][_0x77b3('0xb0')])){if(!_0xd17c66[_0x77b3('0x1c')]){_0xd17c66[_0x77b3('0x94')]=!![];_0xd17c66[_0x77b3('0x95')]=moment()[_0x77b3('0x49')](_0x77b3('0x79'));_0xd17c66[_0x77b3('0x8f')]=_0x77b3('0xb1');_0xd17c66[_0x77b3('0x8b')]=moment()[_0x77b3('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x77b3('0xf')][_0x360729[_0x77b3('0x4e')]]=_0xd17c66;}}logger[_0x77b3('0x6e')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x360729['uniqueid'],_0xd17c66[_0x77b3('0x4b')],_0xd17c66[_0x77b3('0x52')],_[_0x77b3('0x7e')](_0x360729[_0x77b3('0xa8')])[0x0],_0x360729['value']);_0xd17c66[_0x77b3('0x14')]=this[_0x77b3('0x14')][_0x360729[_0x77b3('0x4e')]];}}}}catch(_0x3edeee){logger[_0x77b3('0x68')]('[%s][voiceQueueReport][varset]',_0x360729[_0x77b3('0x4e')],util['inspect'](_0x3edeee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77b3('0x9')][_0x77b3('0xa7')]=function(_0x1bd990,_0x1986af,_0x10253e){var _0x1a3064=[_0x77b3('0xb2'),_0x77b3('0xb3'),_0x77b3('0xb4'),'rtpaudioqosjitterbridged',_0x77b3('0xb5'),_0x77b3('0xb6'),'rtpaudioqosrtt',_0x77b3('0xb7'),_0x77b3('0xb8'),'sipuri',_0x77b3('0xb9'),_0x77b3('0xba'),_0x77b3('0xbb'),_0x77b3('0xbc'),'memberinterface',_0x77b3('0xbd'),_0x77b3('0x93'),_0x77b3('0xbe'),'memberrealtime'];if(!_['isNil'](_0x1986af)&&!_[_0x77b3('0xbf')](_0x1a3064,_0x1986af)){if(_[_0x77b3('0x66')](this[_0x77b3('0x14')][_0x1bd990])){this[_0x77b3('0x14')][_0x1bd990]={};}this[_0x77b3('0x14')][_0x1bd990][_0x1986af]=_0x10253e;}};VoiceQueueReport[_0x77b3('0x9')]['syncHangup']=function(_0x39ffea){try{if(this['isNotNull'](_0x39ffea)){logger[_0x77b3('0x46')](_0x77b3('0xc0'),_0x39ffea[_0x77b3('0x4e')],util[_0x77b3('0x3d')](_0x39ffea,{'showHidden':![],'depth':null}));if(this[_0x77b3('0xd')][_0x39ffea['uniqueid']]){for(var _0x4346b0=0x0,_0x107cbc={};_0x4346b00x0?_0x521b84:0x0;this[_0xaf2f('0x12')][_0x702fc6[_0xaf2f('0x5f')]]['talking']=this['voiceQueues'][_0x702fc6[_0xaf2f('0x5f')]][_0xaf2f('0x2f')]>_[_0xaf2f('0x63')](_0x702fc6[_0xaf2f('0x65')])?_[_0xaf2f('0x63')](_0x702fc6[_0xaf2f('0x65')]):this[_0xaf2f('0x12')][_0x702fc6[_0xaf2f('0x5f')]]['talking'];this[_0xaf2f('0x66')](this[_0xaf2f('0x12')][_0x702fc6['queue']],_0xaf2f('0x5c'));}logger[_0xaf2f('0x4c')](_0xaf2f('0x67'),util[_0xaf2f('0x3d')](this[_0xaf2f('0x12')][_0x702fc6[_0xaf2f('0x5f')]],{'showHidden':![],'depth':null}));ami['emit'](_0xaf2f('0x68'),this[_0xaf2f('0x12')][_0x702fc6[_0xaf2f('0x5f')]]);}}}catch(_0x11320e){logger['error'](_0xaf2f('0x69'),util[_0xaf2f('0x3d')](_0x11320e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf2f('0x17')]=function(_0x3820de){logger[_0xaf2f('0x4c')](_0xaf2f('0x6a'),util['inspect'](_0x3820de,{'showHidden':![],'depth':null}));this[_0xaf2f('0x13')]=!![];};VoiceQueueReport[_0xaf2f('0xa')][_0xaf2f('0x18')]=function(_0x4b6aad){try{if(this[_0xaf2f('0x5e')](_0x4b6aad)){logger[_0xaf2f('0x4c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4b6aad[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x4b6aad,{'showHidden':![],'depth':null}));if(_[_0xaf2f('0x59')](this[_0xaf2f('0xe')][_0x4b6aad[_0xaf2f('0x4d')]]))this[_0xaf2f('0xe')][_0x4b6aad[_0xaf2f('0x4d')]]=[];if(_[_0xaf2f('0x59')](this[_0xaf2f('0x10')][_0x4b6aad[_0xaf2f('0x4d')]]))this[_0xaf2f('0x10')][_0x4b6aad[_0xaf2f('0x4d')]]={};var _0x58b1bb=new QueueReport();_0x58b1bb[_0xaf2f('0x48')]=_0x4b6aad[_0xaf2f('0x5f')];_0x58b1bb[_0xaf2f('0x53')]=this[_0xaf2f('0x12')][_0x58b1bb[_0xaf2f('0x48')]]&&this[_0xaf2f('0x12')][_0x58b1bb[_0xaf2f('0x48')]][_0xaf2f('0x53')]?this[_0xaf2f('0x12')][_0x58b1bb[_0xaf2f('0x48')]][_0xaf2f('0x53')]||_0xaf2f('0x4f'):_0xaf2f('0x4f');_0x58b1bb[_0xaf2f('0x5f')]=_0x4b6aad['queue'];_0x58b1bb['queuecallerjoinAt']=moment()['format'](_0xaf2f('0x6b'));_0x58b1bb[_0xaf2f('0x6c')]=_0x4b6aad[_0xaf2f('0x6c')];_0x58b1bb[_0xaf2f('0x6d')]=_0x4b6aad[_0xaf2f('0x6d')];_0x58b1bb[_0xaf2f('0x4d')]=_0x4b6aad[_0xaf2f('0x4d')];_0x58b1bb[_0xaf2f('0x6e')]=this[_0xaf2f('0x10')][_0x4b6aad['uniqueid']][_0xaf2f('0x6e')];logger[_0xaf2f('0x6f')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x58b1bb[_0xaf2f('0x48')],_0x58b1bb[_0xaf2f('0x53')]);_[_0xaf2f('0x70')](_0x58b1bb,_[_0xaf2f('0x71')](_0x4b6aad,_[_0xaf2f('0x72')](_0x58b1bb)));this['queueReports'][_0x4b6aad[_0xaf2f('0x4d')]][_0xaf2f('0x73')](_0x58b1bb);this[_0xaf2f('0x10')][_0x4b6aad['uniqueid']]=_0x58b1bb;this[_0xaf2f('0x74')](_0x58b1bb,'queuecallerjoin');}}catch(_0x577bca){logger['error'](_0xaf2f('0x75'),_0x4b6aad[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x577bca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf2f('0xa')][_0xaf2f('0x1a')]=function(_0x4512f7){try{if(this[_0xaf2f('0x5e')](_0x4512f7)){logger[_0xaf2f('0x4c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4512f7[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x4512f7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4512f7[_0xaf2f('0x4d')]]){var _0x2b7a49=_[_0xaf2f('0x76')](this[_0xaf2f('0xe')][_0x4512f7[_0xaf2f('0x4d')]]);_0x2b7a49[_0xaf2f('0x77')]=![];_0x2b7a49[_0xaf2f('0x78')]=null;_0x2b7a49[_0xaf2f('0x79')]=_0x4512f7[_0xaf2f('0x79')];_0x2b7a49[_0xaf2f('0x7a')]=_0x4512f7['originalposition'];_0x2b7a49[_0xaf2f('0x19')]=!![];_0x2b7a49['queuecallerabandonAt']=moment()[_0xaf2f('0x46')](_0xaf2f('0x6b'));_0x2b7a49[_0xaf2f('0x7b')]='ABANDONED';_0x2b7a49[_0xaf2f('0x7c')]=null;logger[_0xaf2f('0x6f')](_0xaf2f('0x7d'),_0x2b7a49['name'],_0x2b7a49[_0xaf2f('0x53')]);this[_0xaf2f('0x10')][_0x4512f7[_0xaf2f('0x4d')]]=_0x2b7a49;this[_0xaf2f('0x4b')](_0x2b7a49,'queuecallerabandon');}}}catch(_0x593c97){logger[_0xaf2f('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4512f7[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x593c97,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf2f('0x1c')]=function(_0x13c4ba){try{if(this[_0xaf2f('0x5e')](_0x13c4ba)){logger[_0xaf2f('0x4c')](_0xaf2f('0x7e'),_0x13c4ba[_0xaf2f('0x4d')],util['inspect'](_0x13c4ba,{'showHidden':![],'depth':null}));if(this[_0xaf2f('0xe')][_0x13c4ba['uniqueid']]){var _0x17f384=_[_0xaf2f('0x76')](this['queueReports'][_0x13c4ba[_0xaf2f('0x4d')]]);_0x17f384[_0xaf2f('0x7f')]=moment()[_0xaf2f('0x46')](_0xaf2f('0x6b'));_0x17f384[_0xaf2f('0x80')]=_0x13c4ba[_0xaf2f('0x80')];_0x17f384['connectedlinename']=_0x13c4ba[_0xaf2f('0x81')];logger[_0xaf2f('0x6f')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x17f384[_0xaf2f('0x48')],_0x17f384[_0xaf2f('0x53')],_0x13c4ba[_0xaf2f('0x80')],_0x13c4ba[_0xaf2f('0x81')]);this[_0xaf2f('0x10')][_0x13c4ba[_0xaf2f('0x4d')]]=_0x17f384;this[_0xaf2f('0x74')](_0x17f384,_0xaf2f('0x1b'));}}}catch(_0xadd55){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x13c4ba['uniqueid'],util[_0xaf2f('0x3d')](_0xadd55,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf2f('0x82')]=function(_0x33a326){try{if(this[_0xaf2f('0x5e')](_0x33a326)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x33a326[_0xaf2f('0x4d')],util['inspect'](_0x33a326,{'showHidden':![],'depth':null}));if(this[_0xaf2f('0xe')][_0x33a326[_0xaf2f('0x4d')]]){var _0x553dd9=_['last'](this[_0xaf2f('0xe')][_0x33a326['uniqueid']]);_0x553dd9[_0xaf2f('0x77')]=!![];_0x553dd9[_0xaf2f('0x7b')]=_0xaf2f('0x83');logger[_0xaf2f('0x6f')](_0xaf2f('0x84'),_0x553dd9[_0xaf2f('0x48')],_0x553dd9[_0xaf2f('0x53')]);}}}catch(_0x13ed41){logger[_0xaf2f('0x3b')](_0xaf2f('0x85'),_0x33a326[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x13ed41,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf2f('0xa')][_0xaf2f('0x1e')]=function(_0x4377b8){try{if(this[_0xaf2f('0x5e')](_0x4377b8)){logger[_0xaf2f('0x4c')](_0xaf2f('0x86'),_0x4377b8[_0xaf2f('0x4d')],util['inspect'](_0x4377b8,{'showHidden':![],'depth':null}));if(this[_0xaf2f('0xe')][_0x4377b8[_0xaf2f('0x4d')]]){var _0x22146f=_[_0xaf2f('0x76')](this[_0xaf2f('0xe')][_0x4377b8[_0xaf2f('0x4d')]]);_0x22146f[_0xaf2f('0x19')]=![];_0x22146f[_0xaf2f('0x87')]=null;_0x22146f[_0xaf2f('0x88')]=!![];_0x22146f['lastAssignedTo']=_0x4377b8[_0xaf2f('0x89')];_0x22146f[_0xaf2f('0x79')]=_0x4377b8[_0xaf2f('0x79')];_0x22146f[_0xaf2f('0x77')]=!![];_0x22146f['queuecallerexit']=![];_0x22146f[_0xaf2f('0x8a')]=null;if(!_0x22146f[_0xaf2f('0x8b')]){if(_0x4377b8[_0xaf2f('0x8c')]=='transfer'){_0x22146f[_0xaf2f('0x7b')]='COMPLETED';logger[_0xaf2f('0x6f')](_0xaf2f('0x8d'),_0x22146f['name'],_0x22146f[_0xaf2f('0x53')]);}else{if(_[_0xaf2f('0x8e')](_0x4377b8[_0xaf2f('0x38')][_0xaf2f('0x8f')](),_0xaf2f('0x90'))){if(this[_0xaf2f('0xe')][_0x4377b8[_0xaf2f('0x91')]]){var _0x546c4e=_[_0xaf2f('0x76')](this[_0xaf2f('0xe')][_0x4377b8['linkedid']]);_0x546c4e[_0xaf2f('0x77')]=![];_0x546c4e['queuecallerexit']=!![];_0x546c4e['queuecallerexitAt']=moment(_0x22146f[_0xaf2f('0x92')])[_0xaf2f('0x93')](_0x4377b8[_0xaf2f('0x79')],'seconds')[_0xaf2f('0x46')](_0xaf2f('0x6b'));_0x546c4e[_0xaf2f('0x7b')]=_0xaf2f('0x94');_0x546c4e[_0xaf2f('0x8b')]=!![];_0x546c4e[_0xaf2f('0x95')]=_0xaf2f('0x96');_0x546c4e[_0xaf2f('0x97')]=_0x4377b8[_0xaf2f('0x98')];_0x546c4e[_0xaf2f('0x99')]=_0x4377b8['uniqueid'];logger[_0xaf2f('0x6f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x546c4e['name'],_0x546c4e['type']);var _0xdf9507=this['queueReports'][_0x4377b8[_0xaf2f('0x91')]];this['queueReports'][_0x4377b8['linkedid']]=this['queueReports'][_0x4377b8[_0xaf2f('0x4d')]];this[_0xaf2f('0xe')][_0x4377b8[_0xaf2f('0x4d')]]=_0xdf9507;}}else{_0x22146f[_0xaf2f('0x7b')]=_0xaf2f('0x9a')+_0x4377b8[_0xaf2f('0x8c')][_0xaf2f('0x9b')]();logger[_0xaf2f('0x6f')](_0xaf2f('0x9c'),_0x22146f[_0xaf2f('0x48')],_0x22146f[_0xaf2f('0x53')],_0x22146f['queuecallerexitreason']);}}}this[_0xaf2f('0x10')][_0x4377b8[_0xaf2f('0x4d')]]=_0x22146f;this[_0xaf2f('0x4b')](_0x22146f,'agentcomplete');}}}catch(_0x42fe3a){logger[_0xaf2f('0x3b')]('[%s][voiceQueueReport][agentcomplete]',_0x4377b8[_0xaf2f('0x4d')],util['inspect'](_0x42fe3a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf2f('0xa')][_0xaf2f('0x9d')]=function(_0x205c42){try{if(this[_0xaf2f('0x5e')](_0x205c42)){logger[_0xaf2f('0x4c')](_0xaf2f('0x9e'),_0x205c42['uniqueid'],util[_0xaf2f('0x3d')](_0x205c42,{'showHidden':![],'depth':null}));this['addVariable'](_0x205c42['uniqueid'],_[_0xaf2f('0x72')](_0x205c42[_0xaf2f('0x9f')])[0x0],_0x205c42[_0xaf2f('0xa0')]);if(this[_0xaf2f('0xe')][_0x205c42[_0xaf2f('0x4d')]]){var _0x44bba8=_['last'](this[_0xaf2f('0xe')][_0x205c42['uniqueid']]);if(_0x44bba8){if(this[_0xaf2f('0x5e')](_0x205c42[_0xaf2f('0x9f')])&&this[_0xaf2f('0x5e')](_0x205c42[_0xaf2f('0x9f')]['queuestatus'])){switch(_0x205c42[_0xaf2f('0xa0')]){case'CONTINUE':_0x44bba8[_0xaf2f('0xa1')]=![];_0x44bba8[_0xaf2f('0x8a')]=null;break;case _0xaf2f('0xa2'):_0x44bba8[_0xaf2f('0xa3')]=_0xaf2f('0xa4');_0x44bba8[_0xaf2f('0xa1')]=!![];_0x44bba8[_0xaf2f('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x44bba8[_0xaf2f('0x7f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xaf2f('0xa5'),_0x205c42[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x44bba8,{'showHidden':![],'depth':null}));ami[_0xaf2f('0x45')](_0xaf2f('0xa6'),_0x44bba8);break;default:_0x44bba8[_0xaf2f('0xa1')]=!![];_0x44bba8['queuecallerexitAt']=moment()[_0xaf2f('0x46')](_0xaf2f('0x6b'));_0x44bba8[_0xaf2f('0x7f')]=moment()['format'](_0xaf2f('0x6b'));}_0x44bba8[_0xaf2f('0x19')]=![];_0x44bba8[_0xaf2f('0x87')]=null;_0x44bba8['queuecallerexitreason']=_0x205c42['value'];this['channels'][_0x205c42[_0xaf2f('0x4d')]]=_0x44bba8;this[_0xaf2f('0x4b')](_0x44bba8,_0xaf2f('0x20'));}else if(this[_0xaf2f('0x5e')](_0x205c42[_0xaf2f('0x9f')])&&this['isNotNull'](_0x205c42[_0xaf2f('0x9f')][_0xaf2f('0xa7')])){if(!_0x44bba8['queuecallerabandon']){_0x44bba8[_0xaf2f('0xa1')]=!![];_0x44bba8[_0xaf2f('0x8a')]=moment()[_0xaf2f('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x44bba8[_0xaf2f('0x7b')]=_0xaf2f('0xa8');_0x44bba8[_0xaf2f('0x7f')]=moment()[_0xaf2f('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf2f('0x10')][_0x205c42[_0xaf2f('0x4d')]]=_0x44bba8;}}logger['info'](_0xaf2f('0xa9'),_0x205c42[_0xaf2f('0x4d')],_0x44bba8[_0xaf2f('0x48')],_0x44bba8[_0xaf2f('0x53')],_[_0xaf2f('0x72')](_0x205c42['variable'])[0x0],_0x205c42[_0xaf2f('0xa0')]);_0x44bba8['variables']=this[_0xaf2f('0x3e')][_0x205c42['uniqueid']];}}}}catch(_0x373711){logger[_0xaf2f('0x3b')](_0xaf2f('0x9e'),_0x205c42[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x373711,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf2f('0xaa')]=function(_0x1e4d57,_0x3e3d43,_0x29f1bb){var _0x42b3ad=[_0xaf2f('0xab'),_0xaf2f('0xac'),_0xaf2f('0xad'),_0xaf2f('0xae'),'rtpaudioqosloss',_0xaf2f('0xaf'),_0xaf2f('0xb0'),_0xaf2f('0xb1'),_0xaf2f('0xb2'),_0xaf2f('0xb3'),_0xaf2f('0xb4'),_0xaf2f('0xb5'),_0xaf2f('0xb6'),_0xaf2f('0xb7'),_0xaf2f('0xb8'),_0xaf2f('0xb9'),'membername',_0xaf2f('0xba'),'memberrealtime'];if(!_[_0xaf2f('0x35')](_0x3e3d43)&&!_['includes'](_0x42b3ad,_0x3e3d43)){if(_[_0xaf2f('0x59')](this[_0xaf2f('0x3e')][_0x1e4d57])){this[_0xaf2f('0x3e')][_0x1e4d57]={};}this[_0xaf2f('0x3e')][_0x1e4d57][_0x3e3d43]=_0x29f1bb;}};VoiceQueueReport[_0xaf2f('0xa')][_0xaf2f('0x22')]=function(_0x160539){try{if(this['isNotNull'](_0x160539)){logger[_0xaf2f('0x4c')](_0xaf2f('0xbb'),_0x160539[_0xaf2f('0x4d')],util[_0xaf2f('0x3d')](_0x160539,{'showHidden':![],'depth':null}));if(this[_0xaf2f('0xe')][_0x160539[_0xaf2f('0x4d')]]){for(var _0x257137=0x0,_0x4b5b90={};_0x257137=0x0?moment(_0xd9e51d[_0x779c('0x19')])[_0x779c('0xd')](_0xd9e51d[_0x779c('0x18')],_0x779c('0xe')):null,'data1':_0x779c('0x1a'),'data2':_0xd9e51d['accountcode'],'data3':_0xd9e51d[_0x779c('0x10')],'data4':_0xd9e51d[_0x779c('0x1b')]||null,'role':_0x779c('0x12'),'internal':_0xd9e51d[_0x779c('0x13')]?_[_0x779c('0x14')](_0xd9e51d['accountcode']):undefined,'uniqueid':_0xd9e51d['uniqueid']},'log':_0x779c('0x7')});}; \ No newline at end of file +var _0x3364=['membername','starttime','endtime','diff','outbound','exten','toNumber','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','SIP/%s','TALKING','seconds','inbound','queue','agent','accountcode','uniqueid','voiceDialReport'];(function(_0xddd5df,_0x161fbd){var _0xdd24d6=function(_0x3f047a){while(--_0x3f047a){_0xddd5df['push'](_0xddd5df['shift']());}};_0xdd24d6(++_0x161fbd);}(_0x3364,0x18d));var _0x4336=function(_0x34852c,_0x141358){_0x34852c=_0x34852c-0x0;var _0x5e7455=_0x3364[_0x34852c];return _0x5e7455;};'use strict';var moment=require('moment');var _=require(_0x4336('0x0'));var util=require(_0x4336('0x1'));var client=require(_0x4336('0x2'));exports[_0x4336('0x3')]=function(_0x54c81f){var _0x114c4d=_0x54c81f[_0x4336('0x4')]||_0x54c81f['queuecallerexitAt'];return client[_0x4336('0x5')](_0x4336('0x6'),{'body':{'channel':_0x4336('0x7'),'membername':_0x54c81f[_0x4336('0x8')],'interface':_['isNil'](_0x54c81f[_0x4336('0x9')])?util['format'](_0x4336('0xa'),_0x54c81f[_0x4336('0x8')]):_0x54c81f['interface'],'type':_0x4336('0xb'),'enterAt':_0x54c81f['queuecallerleaveAt'],'exitAt':_0x114c4d,'duration':moment(_0x114c4d)['diff'](_0x54c81f['queuecallerleaveAt'],_0x4336('0xc')),'data1':_0x4336('0xd'),'data2':_0x54c81f['calleridnum'],'data3':_0x54c81f['exten'],'data4':null,'data5':_0x54c81f[_0x4336('0xe')],'role':_0x4336('0xf'),'internal':_0x54c81f[_0x4336('0x10')]?_['toNumber'](_0x54c81f['accountcode']):undefined,'uniqueid':_0x54c81f[_0x4336('0x11')]},'log':_0x4336('0x6')});};exports[_0x4336('0x12')]=function(_0x575136){return client['Request'](_0x4336('0x6'),{'body':{'channel':_0x4336('0x7'),'membername':_0x575136[_0x4336('0x13')],'interface':_0x575136[_0x4336('0x9')],'type':'TALKING','enterAt':_0x575136[_0x4336('0x14')],'exitAt':_0x575136[_0x4336('0x15')],'duration':moment(_0x575136[_0x4336('0x15')])[_0x4336('0x16')](_0x575136['starttime'],'seconds')>=0x0?moment(_0x575136[_0x4336('0x15')])[_0x4336('0x16')](_0x575136[_0x4336('0x14')],_0x4336('0xc')):null,'data1':_0x4336('0x17'),'data2':_0x575136[_0x4336('0x10')],'data3':_0x575136[_0x4336('0x18')],'data4':_0x575136['dialstring']||null,'role':_0x4336('0xf'),'internal':_0x575136[_0x4336('0x10')]?_[_0x4336('0x19')](_0x575136['accountcode']):undefined,'uniqueid':_0x575136['uniqueid']},'log':_0x4336('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e99740b..a4a25e8 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 _0xd816=['../client','getSettings','ShowSetting'];(function(_0x2f7d5b,_0x4420bf){var _0x5d7e8b=function(_0x20b699){while(--_0x20b699){_0x2f7d5b['push'](_0x2f7d5b['shift']());}};_0x5d7e8b(++_0x4420bf);}(_0xd816,0xd5));var _0x6d81=function(_0x3282c4,_0x28a7f1){_0x3282c4=_0x3282c4-0x0;var _0x4915ec=_0xd816[_0x3282c4];return _0x4915ec;};'use strict';var client=require(_0x6d81('0x0'));exports[_0x6d81('0x1')]=function(){return client['Request'](_0x6d81('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':'GetSettings'});}; \ No newline at end of file +var _0x9809=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9809,0x1da));var _0x9980=function(_0x4559cf,_0x38be63){_0x4559cf=_0x4559cf-0x0;var _0x226f68=_0x9809[_0x4559cf];return _0x226f68;};'use strict';var client=require(_0x9980('0x0'));exports[_0x9980('0x1')]=function(){return client[_0x9980('0x2')](_0x9980('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9980('0x4')]},'log':_0x9980('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0a4cd91..8dfc5b1 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 _0xcfa5=['getTemplates','html','GetTemplate','../client'];(function(_0x164580,_0x3c81f9){var _0xed7154=function(_0x3b7929){while(--_0x3b7929){_0x164580['push'](_0x164580['shift']());}};_0xed7154(++_0x3c81f9);}(_0xcfa5,0xbb));var _0x5cfa=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xcfa5[_0x160c73];return _0xd9302;};'use strict';var client=require(_0x5cfa('0x0'));exports[_0x5cfa('0x1')]=function(_0x567acd){return function(_0x4b30fe){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x5cfa('0x2')]},'log':_0x5cfa('0x3')});};}; \ No newline at end of file +var _0x55f1=['../client','Request','GetTemplate','name','html'];(function(_0x3a23f1,_0x401962){var _0x484219=function(_0x2d862b){while(--_0x2d862b){_0x3a23f1['push'](_0x3a23f1['shift']());}};_0x484219(++_0x401962);}(_0x55f1,0x9b));var _0x155f=function(_0x5b2bf8,_0x3e68ab){_0x5b2bf8=_0x5b2bf8-0x0;var _0x1d96c4=_0x55f1[_0x5b2bf8];return _0x1d96c4;};'use strict';var client=require(_0x155f('0x0'));exports['getTemplates']=function(_0x9fa58a){return function(_0x476580){return client[_0x155f('0x1')](_0x155f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x155f('0x3'),_0x155f('0x4')]},'log':_0x155f('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 93b71a1..6f7a62e 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 _0x4fff=['field','AnyConditions','operator','value','Actions','action','data1','data3','data5','data6','data7','../client','Request','GetTrigger','name','channel','status'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x4fff,0xa4));var _0xf4ff=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4fff[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xf4ff('0x0'));exports['getTriggers']=function(_0xf9d08f){return function(_0x500ec5){return client[_0xf4ff('0x1')](_0xf4ff('0x2'),{'options':{'raw':![],'attributes':['id',_0xf4ff('0x3'),_0xf4ff('0x4'),_0xf4ff('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xf4ff('0x6'),'operator','value']},{'model':'Condition','as':_0xf4ff('0x7'),'attributes':['id',_0xf4ff('0x6'),_0xf4ff('0x8'),_0xf4ff('0x9')]},{'model':'Action','as':_0xf4ff('0xa'),'attributes':['id',_0xf4ff('0xb'),_0xf4ff('0xc'),'data2',_0xf4ff('0xd'),'data4',_0xf4ff('0xe'),_0xf4ff('0xf'),_0xf4ff('0x10')]}]},'log':_0xf4ff('0x2')});};}; \ No newline at end of file +var _0xdb32=['operator','value','AnyConditions','field','Action','action','data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xdb32,0x173));var _0x2db3=function(_0x31a0d9,_0x2e1de0){_0x31a0d9=_0x31a0d9-0x0;var _0x4a3484=_0xdb32[_0x31a0d9];return _0x4a3484;};'use strict';var client=require(_0x2db3('0x0'));exports[_0x2db3('0x1')]=function(_0x5a8810){return function(_0x26ae2c){return client[_0x2db3('0x2')](_0x2db3('0x3'),{'options':{'raw':![],'attributes':['id',_0x2db3('0x4'),'channel','status'],'include':[{'model':_0x2db3('0x5'),'as':_0x2db3('0x6'),'attributes':['id','field',_0x2db3('0x7'),_0x2db3('0x8')]},{'model':_0x2db3('0x5'),'as':_0x2db3('0x9'),'attributes':['id',_0x2db3('0xa'),_0x2db3('0x7'),_0x2db3('0x8')]},{'model':_0x2db3('0xb'),'as':'Actions','attributes':['id',_0x2db3('0xc'),'data1',_0x2db3('0xd'),'data3',_0x2db3('0xe'),_0x2db3('0xf'),_0x2db3('0x10'),_0x2db3('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c81eb9f..86d5b59 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 _0x8250=['../client','getTrunks','GetTrunk','name','defaultuser'];(function(_0x49f9e5,_0x49b7d4){var _0x3aad1b=function(_0x6df889){while(--_0x6df889){_0x49f9e5['push'](_0x49f9e5['shift']());}};_0x3aad1b(++_0x49b7d4);}(_0x8250,0xfa));var _0x0825=function(_0x42494f,_0x407d20){_0x42494f=_0x42494f-0x0;var _0x36ed56=_0x8250[_0x42494f];return _0x36ed56;};'use strict';var client=require(_0x0825('0x0'));exports[_0x0825('0x1')]=function(_0x4296a9){return function(_0x3c18ec){return client['Request'](_0x0825('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0825('0x3'),'registry',_0x0825('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x385b=['GetTrunk','name','defaultuser','getTrunks','Request'];(function(_0x5158c9,_0x266be8){var _0x509b6a=function(_0x2b8a72){while(--_0x2b8a72){_0x5158c9['push'](_0x5158c9['shift']());}};_0x509b6a(++_0x266be8);}(_0x385b,0x1a7));var _0xb385=function(_0x227242,_0x1f77a6){_0x227242=_0x227242-0x0;var _0x2711e8=_0x385b[_0x227242];return _0x2711e8;};'use strict';var client=require('../client');exports[_0xb385('0x0')]=function(_0x4ee4ed){return function(_0x2d214b){return client[_0xb385('0x1')](_0xb385('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb385('0x3'),'registry',_0xb385('0x4')]},'log':_0xb385('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 40a0b4e..21cf56a 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x47767c,_0x3f8280){var _0x4a0d87=function(_0x51f9c7){while(--_0x51f9c7){_0x47767c['push'](_0x47767c['shift']());}};_0x4a0d87(++_0x3f8280);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0xcb91[_0x1b745b];return _0x120a9d;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe706,0xa3));var _0x6e70=function(_0x128d68,_0x555a32){_0x128d68=_0x128d68-0x0;var _0x24ad4d=_0xe706[_0x128d68];return _0x24ad4d;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d1635e4..517820e 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 _0xdd5a=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client'];(function(_0x2b2a58,_0x3a0e71){var _0x2e8f68=function(_0x52fa75){while(--_0x52fa75){_0x2b2a58['push'](_0x2b2a58['shift']());}};_0x2e8f68(++_0x3a0e71);}(_0xdd5a,0x13f));var _0xadd5=function(_0x19e599,_0x4c69e0){_0x19e599=_0x19e599-0x0;var _0x409607=_0xdd5a[_0x19e599];return _0x409607;};'use strict';var client=require(_0xadd5('0x0'));exports['create']=function(_0x1db852){return client[_0xadd5('0x1')](_0xadd5('0x2'),{'body':_0x1db852,'log':_0xadd5('0x2')});};exports['update']=function(_0x20c38b,_0x2f7e3c,_0x49c7f7){return client[_0xadd5('0x1')](_0xadd5('0x3'),{'body':_0x20c38b,'options':{'where':{'uniqueid':_0x2f7e3c,'interface':_0x49c7f7,'agentcomplete':!![]}},'log':_0xadd5('0x3')});}; \ No newline at end of file +var _0x2f40=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x101a45,_0x57d4fc){var _0x426ebf=function(_0x4b63d5){while(--_0x4b63d5){_0x101a45['push'](_0x101a45['shift']());}};_0x426ebf(++_0x57d4fc);}(_0x2f40,0x194));var _0x02f4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2f40[_0x2d7f0e];return _0x110b07;};'use strict';var client=require(_0x02f4('0x0'));exports['create']=function(_0x4e77cb){return client['Request'](_0x02f4('0x1'),{'body':_0x4e77cb,'log':_0x02f4('0x1')});};exports[_0x02f4('0x2')]=function(_0x1e59c0,_0x724cc7,_0x18d054){return client[_0x02f4('0x3')](_0x02f4('0x4'),{'body':_0x1e59c0,'options':{'where':{'uniqueid':_0x724cc7,'interface':_0x18d054,'agentcomplete':!![]}},'log':_0x02f4('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 221dd16..911cfd8 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 _0x57ed=['Request','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x462edc,_0x32ae43){var _0x514744=function(_0x1eebb1){while(--_0x1eebb1){_0x462edc['push'](_0x462edc['shift']());}};_0x514744(++_0x32ae43);}(_0x57ed,0x10d));var _0xd57e=function(_0x2631f6,_0x552ce5){_0x2631f6=_0x2631f6-0x0;var _0x45917c=_0x57ed[_0x2631f6];return _0x45917c;};'use strict';var moment=require(_0xd57e('0x0'));var util=require(_0xd57e('0x1'));var _=require(_0xd57e('0x2'));var client=require(_0xd57e('0x3'));exports['create']=function(_0x17e553){return client[_0xd57e('0x4')]('CreateVoiceCallReport',{'body':_['merge'](_0x17e553,{'source':_0x17e553[_0xd57e('0x5')],'destinationcontext':_0x17e553[_0xd57e('0x6')],'callerid':_0x17e553[_0xd57e('0x7')],'amaflags':_0xd57e('0x8')}),'log':_0xd57e('0x9')});};exports[_0xd57e('0xa')]=function(){return function(){return client[_0xd57e('0x4')](_0xd57e('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xd57e('0xc')]('day')[_0xd57e('0xd')](_0xd57e('0xe')),moment()[_0xd57e('0xf')]('day')['format'](_0xd57e('0xe'))]}},'attributes':[_0xd57e('0x10'),_0xd57e('0x11'),_0xd57e('0x12'),_0xd57e('0x13')]},'log':_0xd57e('0x14')});};}; \ No newline at end of file +var _0xd680=['GetVoiceCallReport','outbound','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports'];(function(_0x3674cb,_0x4c7408){var _0x297ef3=function(_0x466e89){while(--_0x466e89){_0x3674cb['push'](_0x3674cb['shift']());}};_0x297ef3(++_0x4c7408);}(_0xd680,0x137));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x0d68('0x0'));var util=require('util');var _=require(_0x0d68('0x1'));var client=require('../client');exports[_0x0d68('0x2')]=function(_0x5868f4){return client[_0x0d68('0x3')](_0x0d68('0x4'),{'body':_['merge'](_0x5868f4,{'source':_0x5868f4[_0x0d68('0x5')],'destinationcontext':_0x5868f4[_0x0d68('0x6')],'callerid':_0x5868f4['callerid'],'amaflags':_0x0d68('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0x0d68('0x8')]=function(){return function(){return client['Request'](_0x0d68('0x9'),{'options':{'where':{'type':[_0x0d68('0xa')],'createdAt':{'$between':[moment()[_0x0d68('0xb')](_0x0d68('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x0d68('0xd')](_0x0d68('0xc'))[_0x0d68('0xe')](_0x0d68('0xf'))]}},'attributes':[_0x0d68('0x10'),_0x0d68('0x11'),_0x0d68('0x12'),'billableseconds']},'log':_0x0d68('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c0ca9e8..05156f5 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 _0x5e05=['Request','CreateVoiceDialReport','../client'];(function(_0x3c44e7,_0x116a1a){var _0x14b55f=function(_0xc3a694){while(--_0xc3a694){_0x3c44e7['push'](_0x3c44e7['shift']());}};_0x14b55f(++_0x116a1a);}(_0x5e05,0x15e));var _0x55e0=function(_0x3f5c6f,_0x1ba96b){_0x3f5c6f=_0x3f5c6f-0x0;var _0x359666=_0x5e05[_0x3f5c6f];return _0x359666;};'use strict';var client=require(_0x55e0('0x0'));exports['create']=function(_0x4caa84){return client[_0x55e0('0x1')](_0x55e0('0x2'),{'body':_0x4caa84,'log':_0x55e0('0x2')});}; \ No newline at end of file +var _0x5afa=['../client','Request','CreateVoiceDialReport'];(function(_0x1a12cb,_0x293cdd){var _0x242683=function(_0x4e1da3){while(--_0x4e1da3){_0x1a12cb['push'](_0x1a12cb['shift']());}};_0x242683(++_0x293cdd);}(_0x5afa,0x171));var _0xa5af=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x5afa[_0x298ed3];return _0x5aad28;};'use strict';var client=require(_0xa5af('0x0'));exports['create']=function(_0xca6c32){return client[_0xa5af('0x1')](_0xa5af('0x2'),{'body':_0xca6c32,'log':_0xa5af('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 98a4984..6ed7162 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 _0xa5fa=['getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x4d84db,_0x54ce75){var _0xd4ec83=function(_0x1ce5a6){while(--_0x1ce5a6){_0x4d84db['push'](_0x4d84db['shift']());}};_0xd4ec83(++_0x54ce75);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3add15,_0x1556a8){_0x3add15=_0x3add15-0x0;var _0x4171d0=_0xa5fa[_0x3add15];return _0x4171d0;};'use strict';var client=require('../client');exports[_0xaa5f('0x0')]=function(){return function(){return client[_0xaa5f('0x1')](_0xaa5f('0x2'),{'options':{'raw':!![],'attributes':['id',_0xaa5f('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xaa5f('0x0')});};}; \ No newline at end of file +var _0x705f=['getVoiceExtensions','Request','exten','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x705f,0x75));var _0xf705=function(_0x5794dd,_0x37af14){_0x5794dd=_0x5794dd-0x0;var _0x1a32a7=_0x705f[_0x5794dd];return _0x1a32a7;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xf705('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf705('0x1'),_0xf705('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xf705('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index feb81fc..04ea777 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 _0xd71c=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x152ca2,_0x5abd1b){var _0x58fbd2=function(_0x128b08){while(--_0x128b08){_0x152ca2['push'](_0x152ca2['shift']());}};_0x58fbd2(++_0x5abd1b);}(_0xd71c,0x178));var _0xcd71=function(_0x1a9f05,_0x38f917){_0x1a9f05=_0x1a9f05-0x0;var _0xb98272=_0xd71c[_0x1a9f05];return _0xb98272;};'use strict';var client=require(_0xcd71('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xcd71('0x1'),{'options':{'raw':![],'attributes':['id',_0xcd71('0x2'),_0xcd71('0x3'),_0xcd71('0x4'),'autopause',_0xcd71('0x5'),_0xcd71('0x6'),_0xcd71('0x7'),'dialMethod',_0xcd71('0x8'),_0xcd71('0x9'),'dialPowerLevel',_0xcd71('0xa'),_0xcd71('0xb'),'dialPredictiveInterval',_0xcd71('0xc'),_0xcd71('0xd'),_0xcd71('0xe'),_0xcd71('0xf'),'dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0xcd71('0x10'),_0xcd71('0x11'),_0xcd71('0x12'),_0xcd71('0x13'),_0xcd71('0x14'),_0xcd71('0x15'),_0xcd71('0x16'),_0xcd71('0x17'),_0xcd71('0x18'),_0xcd71('0x19'),_0xcd71('0x1a'),_0xcd71('0x1b'),_0xcd71('0x1c'),_0xcd71('0x1d'),'dialAMDTotalAnalysisTime',_0xcd71('0x1e'),_0xcd71('0x1f'),_0xcd71('0x20'),'dialAMDSilenceThreshold',_0xcd71('0x21'),'timeout',_0xcd71('0x22'),_0xcd71('0x23'),'dialOrderByScheduledAt',_0xcd71('0x24'),_0xcd71('0x25'),_0xcd71('0x26'),_0xcd71('0x5'),'strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry',_0xcd71('0x27'),_0xcd71('0x28'),_0xcd71('0x29'),_0xcd71('0x2a'),_0xcd71('0x2b'),_0xcd71('0x2c'),_0xcd71('0x2d'),_0xcd71('0x2e'),_0xcd71('0x2f'),_0xcd71('0x30'),_0xcd71('0x31'),_0xcd71('0x32')],'include':[{'model':_0xcd71('0x33'),'as':'Trunk','attributes':['id','name',_0xcd71('0x34'),_0xcd71('0x35')]},{'model':'Pause','as':_0xcd71('0x36'),'attributes':['id','name']},{'model':_0xcd71('0x33'),'as':_0xcd71('0x37'),'attributes':['id',_0xcd71('0x2'),'callerid','active']},{'model':_0xcd71('0x38'),'as':_0xcd71('0x38'),'attributes':['id',_0xcd71('0x2')],'include':[{'model':_0xcd71('0x38'),'as':_0xcd71('0x39'),'attributes':['id','name',_0xcd71('0x3a')]}]}]},'log':_0xcd71('0x3b')});};}; \ No newline at end of file +var _0xf4a6=['dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callerid','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf4a6,0x16b));var _0x6f4a=function(_0x3970a7,_0xaec0a4){_0x3970a7=_0x3970a7-0x0;var _0xbfda24=_0xf4a6[_0x3970a7];return _0xbfda24;};'use strict';var client=require(_0x6f4a('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x6f4a('0x1'),{'options':{'raw':![],'attributes':['id',_0x6f4a('0x2'),_0x6f4a('0x3'),_0x6f4a('0x4'),_0x6f4a('0x5'),'monitor_format',_0x6f4a('0x6'),_0x6f4a('0x7'),_0x6f4a('0x8'),_0x6f4a('0x9'),'dialLimitQueue',_0x6f4a('0xa'),_0x6f4a('0xb'),'dialPredictiveOptimizationPercentage',_0x6f4a('0xc'),_0x6f4a('0xd'),'dialOriginateCallerIdNumber',_0x6f4a('0xe'),'dialQueueOptions',_0x6f4a('0xf'),_0x6f4a('0x10'),_0x6f4a('0x11'),_0x6f4a('0x12'),_0x6f4a('0x13'),_0x6f4a('0x14'),_0x6f4a('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x6f4a('0x16'),_0x6f4a('0x17'),_0x6f4a('0x18'),_0x6f4a('0x19'),_0x6f4a('0x1a'),_0x6f4a('0x1b'),_0x6f4a('0x1c'),'dialAMDAfterGreetingSilence',_0x6f4a('0x1d'),_0x6f4a('0x1e'),_0x6f4a('0x1f'),_0x6f4a('0x20'),_0x6f4a('0x21'),_0x6f4a('0x22'),_0x6f4a('0x23'),'dialRecallMeTimeout',_0x6f4a('0x24'),'dialOrderByScheduledAt',_0x6f4a('0x25'),_0x6f4a('0x26'),'dialQueueProject2','monitor_format',_0x6f4a('0x27'),'dialRandomLastDigitCallerIdNumber',_0x6f4a('0x28'),_0x6f4a('0x29'),_0x6f4a('0x2a'),_0x6f4a('0x2b'),'dialDropRetryFrequency',_0x6f4a('0x2c'),_0x6f4a('0x2d'),_0x6f4a('0x2e'),_0x6f4a('0x2f'),_0x6f4a('0x30'),_0x6f4a('0x31'),_0x6f4a('0x32'),_0x6f4a('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x6f4a('0x2'),_0x6f4a('0x34'),'active']},{'model':_0x6f4a('0x35'),'as':_0x6f4a('0x36'),'attributes':['id','name']},{'model':_0x6f4a('0x37'),'as':_0x6f4a('0x38'),'attributes':['id',_0x6f4a('0x2'),_0x6f4a('0x34'),_0x6f4a('0x39')]},{'model':_0x6f4a('0x3a'),'as':_0x6f4a('0x3a'),'attributes':['id',_0x6f4a('0x2')],'include':[{'model':_0x6f4a('0x3a'),'as':_0x6f4a('0x3b'),'attributes':['id',_0x6f4a('0x2'),_0x6f4a('0x3c')]}]}]},'log':_0x6f4a('0x3d')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 42a38cb..0447599 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(_0x83e404,_0x559b43){var _0xbbb22f=function(_0x3e5cce){while(--_0x3e5cce){_0x83e404['push'](_0x83e404['shift']());}};_0xbbb22f(++_0x559b43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x131366,_0x1fc79d){var _0x263af1=function(_0x5d595e){while(--_0x5d595e){_0x131366['push'](_0x131366['shift']());}};_0x263af1(++_0x1fc79d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 5f49819..eb6f81a 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 _0x95a0=['Request','GetVoiceQueueRtPauses'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x95a0,0x1b6));var _0x095a=function(_0x4dd379,_0x277b0e){_0x4dd379=_0x4dd379-0x0;var _0x222687=_0x95a0[_0x4dd379];return _0x222687;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x3f9cd3){return function(){return client[_0x095a('0x0')](_0x095a('0x1'),{'options':{'where':{'VoiceQueueId':_0x3f9cd3,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xa678=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x3ea923,_0x15f087){var _0x547cf2=function(_0x29efd4){while(--_0x29efd4){_0x3ea923['push'](_0x3ea923['shift']());}};_0x547cf2(++_0x15f087);}(_0xa678,0x1cc));var _0x8a67=function(_0x4d315e,_0x5be61d){_0x4d315e=_0x4d315e-0x0;var _0x515c9e=_0xa678[_0x4d315e];return _0x515c9e;};'use strict';var client=require('../client');exports[_0x8a67('0x0')]=function(_0x58023f){return function(){return client[_0x8a67('0x1')](_0x8a67('0x2'),{'options':{'where':{'VoiceQueueId':_0x58023f,'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 5274527..c7c66b2 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2a9720,_0x21dfa4){var _0x9bbf9b=function(_0x436153){while(--_0x436153){_0x2a9720['push'](_0x2a9720['shift']());}};_0x9bbf9b(++_0x21dfa4);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3a4c07,_0x2a0e1a){var _0x28a937=function(_0x31565d){while(--_0x31565d){_0x3a4c07['push'](_0x3a4c07['shift']());}};_0x28a937(++_0x2a0e1a);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 55514fc..88604e5 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 _0x55b1=['attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten'];(function(_0x18adeb,_0x40c796){var _0x2e676a=function(_0x33918c){while(--_0x33918c){_0x18adeb['push'](_0x18adeb['shift']());}};_0x2e676a(++_0x40c796);}(_0x55b1,0x139));var _0x155b=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x55b1[_0x2d89ce];return _0x3fad10;};'use strict';var client=require(_0x155b('0x0'));exports[_0x155b('0x1')]={};exports[_0x155b('0x2')]=function(_0x433adf){return client['Request'](_0x155b('0x3'),{'body':{'result':_0x433adf[_0x155b('0x4')],'transfererchannel':_0x433adf[_0x155b('0x5')],'transferercalleridnum':_0x433adf[_0x155b('0x6')],'transferercalleridname':_0x433adf['transferercalleridname'],'transfererconnectedlinenum':_0x433adf[_0x155b('0x7')],'transfererconnectedlinename':_0x433adf[_0x155b('0x8')],'transfereraccountcode':_0x433adf[_0x155b('0x9')],'transferercontext':_0x433adf[_0x155b('0xa')],'transfererexten':_0x433adf[_0x155b('0xb')],'transfererlinkedid':_0x433adf['transfererlinkedid'],'transfereechannel':_0x433adf[_0x155b('0xc')],'transfereecalleridnum':_0x433adf[_0x155b('0xd')],'transfereecalleridname':_0x433adf[_0x155b('0xe')],'transfereeconnectedlinenum':_0x433adf[_0x155b('0xf')],'transfereeconnectedlinename':_0x433adf[_0x155b('0x10')],'transfereeaccountcode':_0x433adf[_0x155b('0x11')],'transfereecontext':_0x433adf[_0x155b('0x12')],'transfereeexten':_0x433adf['transfereeexten'],'transfereelinkedid':_0x433adf[_0x155b('0x13')],'isexternal':_0x433adf[_0x155b('0x14')],'context':_0x433adf[_0x155b('0x15')],'extension':_0x433adf['extension'],'type':_0x155b('0x16')},'log':_0x155b('0x3')});};exports[_0x155b('0x17')]=function(_0x7f843b){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x7f843b[_0x155b('0x4')],'transfererchannel':_0x7f843b['origtransfererchannel'],'transferercalleridnum':_0x7f843b[_0x155b('0x18')],'transferercalleridname':_0x7f843b['origtransferercalleridname'],'transfererconnectedlinenum':_0x7f843b[_0x155b('0x19')],'transfererconnectedlinename':_0x7f843b[_0x155b('0x1a')],'transfereraccountcode':_0x7f843b[_0x155b('0x1b')],'transferercontext':_0x7f843b[_0x155b('0x1c')],'transfererexten':_0x7f843b[_0x155b('0x1d')],'transfererlinkedid':_0x7f843b['origtransfererlinkedid'],'transfereechannel':_0x7f843b['transfertargetchannel'],'transfereecalleridnum':_0x7f843b[_0x155b('0x1e')],'transfereecalleridname':_0x7f843b['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x7f843b[_0x155b('0x1f')],'transfereeconnectedlinename':_0x7f843b[_0x155b('0x20')],'transfereeaccountcode':_0x7f843b[_0x155b('0x21')],'transfereecontext':_0x7f843b[_0x155b('0x22')],'transfereeexten':_0x7f843b[_0x155b('0x23')],'transfereelinkedid':_0x7f843b['transfertargetlinkedid'],'isexternal':_0x7f843b[_0x155b('0x14')],'context':_0x7f843b[_0x155b('0x24')],'extension':_0x7f843b[_0x155b('0x25')],'type':_0x155b('0x26')},'log':_0x155b('0x3')});}; \ No newline at end of file +var _0xc68d=['result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereeexten','transfereelinkedid','context','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xc68d,0xe0));var _0xdc68=function(_0x6afaeb,_0x1b9681){_0x6afaeb=_0x6afaeb-0x0;var _0x5696e3=_0xc68d[_0x6afaeb];return _0x5696e3;};'use strict';var client=require('../client');exports[_0xdc68('0x0')]={};exports[_0xdc68('0x1')]=function(_0x50cf1c){return client[_0xdc68('0x2')](_0xdc68('0x3'),{'body':{'result':_0x50cf1c[_0xdc68('0x4')],'transfererchannel':_0x50cf1c[_0xdc68('0x5')],'transferercalleridnum':_0x50cf1c[_0xdc68('0x6')],'transferercalleridname':_0x50cf1c[_0xdc68('0x7')],'transfererconnectedlinenum':_0x50cf1c[_0xdc68('0x8')],'transfererconnectedlinename':_0x50cf1c[_0xdc68('0x9')],'transfereraccountcode':_0x50cf1c[_0xdc68('0xa')],'transferercontext':_0x50cf1c[_0xdc68('0xb')],'transfererexten':_0x50cf1c[_0xdc68('0xc')],'transfererlinkedid':_0x50cf1c['transfererlinkedid'],'transfereechannel':_0x50cf1c[_0xdc68('0xd')],'transfereecalleridnum':_0x50cf1c[_0xdc68('0xe')],'transfereecalleridname':_0x50cf1c[_0xdc68('0xf')],'transfereeconnectedlinenum':_0x50cf1c['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x50cf1c['transfereeconnectedlinename'],'transfereeaccountcode':_0x50cf1c[_0xdc68('0x10')],'transfereecontext':_0x50cf1c['transfereecontext'],'transfereeexten':_0x50cf1c[_0xdc68('0x11')],'transfereelinkedid':_0x50cf1c[_0xdc68('0x12')],'isexternal':_0x50cf1c['isexternal'],'context':_0x50cf1c[_0xdc68('0x13')],'extension':_0x50cf1c['extension'],'type':'blind'},'log':_0xdc68('0x3')});};exports[_0xdc68('0x14')]=function(_0xd7c89f){return client['Request'](_0xdc68('0x3'),{'body':{'result':_0xd7c89f[_0xdc68('0x4')],'transfererchannel':_0xd7c89f[_0xdc68('0x15')],'transferercalleridnum':_0xd7c89f[_0xdc68('0x16')],'transferercalleridname':_0xd7c89f[_0xdc68('0x17')],'transfererconnectedlinenum':_0xd7c89f[_0xdc68('0x18')],'transfererconnectedlinename':_0xd7c89f['secondtransfererconnectedlinename'],'transfereraccountcode':_0xd7c89f['origtransfereraccountcode'],'transferercontext':_0xd7c89f[_0xdc68('0x19')],'transfererexten':_0xd7c89f['secondtransfererexten'],'transfererlinkedid':_0xd7c89f['origtransfererlinkedid'],'transfereechannel':_0xd7c89f[_0xdc68('0x1a')],'transfereecalleridnum':_0xd7c89f[_0xdc68('0x1b')],'transfereecalleridname':_0xd7c89f[_0xdc68('0x1c')],'transfereeconnectedlinenum':_0xd7c89f[_0xdc68('0x1d')],'transfereeconnectedlinename':_0xd7c89f[_0xdc68('0x1e')],'transfereeaccountcode':_0xd7c89f[_0xdc68('0x1f')],'transfereecontext':_0xd7c89f[_0xdc68('0x20')],'transfereeexten':_0xd7c89f[_0xdc68('0x21')],'transfereelinkedid':_0xd7c89f[_0xdc68('0x22')],'isexternal':_0xd7c89f[_0xdc68('0x23')],'context':_0xd7c89f[_0xdc68('0x24')],'extension':_0xd7c89f['origtransfererexten'],'type':_0xdc68('0x25')},'log':_0xdc68('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d231ebd..a3a3d52 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 _0x7524=['outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','undefined','values','voicechannel','validate','map','channels','filename','uniqueid','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','Hangup','context','telephones','trunks','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','moment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','catch','error','command','Action','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay'];(function(_0x1111c5,_0x553b45){var _0x56eed0=function(_0x238841){while(--_0x238841){_0x1111c5['push'](_0x1111c5['shift']());}};_0x56eed0(++_0x553b45);}(_0x7524,0xce));var _0x4752=function(_0x1b18f8,_0x427bdb){_0x1b18f8=_0x1b18f8-0x0;var _0x1a54e2=_0x7524[_0x1b18f8];return _0x1a54e2;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var jayson=require(_0x4752('0x1'));var schema=require('validate');var BPromise=require(_0x4752('0x2'));var moment=require(_0x4752('0x3'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x4752('0x4'));exports['listen']=function(_0x3884b9,_0x307267,_0x66a421){return new BPromise(function(_0x55b411,_0x104962){var _0x5b98c0={'QueuePause':function(_0x1e76cf){return new Promise(function(_0x1cbf34,_0x59477c){var _0x5db15c=util[_0x4752('0x5')](_0x4752('0x6'),_0x4752('0x7'),_0x1e76cf[_0x4752('0x8')]);if(_0x3884b9['timers']&&_0x3884b9[_0x4752('0x9')][_0x5db15c]&&_0x3884b9[_0x4752('0x9')][_0x5db15c][_0x4752('0xa')]){_0x3884b9[_0x4752('0x9')][_0x5db15c][_0x4752('0xb')]();}if(_0x3884b9['agents'][_0x5db15c]){_0x3884b9[_0x4752('0xc')][_0x5db15c][_0x4752('0xd')]({'statePause':_0x1e76cf[_0x4752('0xe')]?!![]:![]});}_0x1cbf34({'code':0xc8,'message':_0x4752('0xf')});});},'Reload':function(_0xe6023b){var _0x7c7890=this;return new Promise(function(_0xcee47,_0x505d48){if(ami[_0x4752('0x10')]()==![]){return _0x505d48(_0x7c7890['error'](0x1f4,[config[_0x4752('0x11')]['ip'],config[_0x4752('0x11')][_0x4752('0x12')],_0x4752('0x13')][_0x4752('0x14')]('\x20')));}_0xe6023b=_[_0x4752('0x15')](_0xe6023b,_[_0x4752('0x16')](properties['module']));_0xe6023b[_0x4752('0x17')]=_0x4752('0x18');return ami['Action'](_0xe6023b)[_0x4752('0x19')](function(_0x4b3088){_0xcee47({'code':0xc8,'message':_0x4b3088[_0x4752('0x1a')]});})[_0x4752('0x1b')](function(_0x516f3e){_0x505d48(_0x7c7890[_0x4752('0x1c')](0x1f5,_0x516f3e['message']));});});},'Command':function(_0x525176){var _0x285688=this;return new Promise(function(_0x4444e5,_0x3374d4){if(ami[_0x4752('0x10')]()==![]){return _0x3374d4(_0x285688[_0x4752('0x1c')](0x1f4,[config[_0x4752('0x11')]['ip'],config['asterisk'][_0x4752('0x12')],_0x4752('0x13')][_0x4752('0x14')]('\x20')));}_0x525176=_[_0x4752('0x15')](_0x525176,_0x4752('0x1d'));_0x525176[_0x4752('0x17')]='Command';return ami[_0x4752('0x1e')](_0x525176)[_0x4752('0x19')](function(_0x54a0bd){_0x4444e5({'code':0xc8,'message':_0x54a0bd[_0x4752('0x1f')]});})[_0x4752('0x1b')](function(_0x1e4e86){_0x3374d4(_0x285688[_0x4752('0x1c')](0x1f5,_0x1e4e86[_0x4752('0x1a')]));});});},'VoiceQueues':function(_0x26c332){return new Promise(function(_0x1135bf,_0x45c557){var _0xca8dd1=[];for(var _0x2c259a in _0x3884b9['voiceQueues']){if(_0x3884b9[_0x4752('0x20')]['hasOwnProperty'](_0x2c259a)){var _0x4b2635=_0x3884b9['voiceQueues'][_0x2c259a];var _0x1dcdcd={'id':_0x4b2635['id'],'name':_0x4b2635[_0x4752('0x8')],'strategy':_0x4b2635[_0x4752('0x21')],'answered':_0x4b2635[_0x4752('0x22')],'available':_0x4b2635[_0x4752('0x23')],'loggedIn':_0x4b2635[_0x4752('0x24')],'pTalking':_0x4b2635[_0x4752('0x25')],'sumBillable':_0x4b2635[_0x4752('0x26')],'sumDuration':_0x4b2635['sumDuration'],'sumHoldTime':_0x4b2635['sumHoldTime']||0x0,'talking':_0x4b2635[_0x4752('0x27')],'total':_0x4b2635[_0x4752('0x28')],'type':_0x4b2635[_0x4752('0x29')],'unmanaged':_0x4b2635[_0x4752('0x2a')],'abandoned':_0x4b2635[_0x4752('0x2b')],'waiting':_0x4b2635[_0x4752('0x2c')],'loggedInDb':_0x4b2635[_0x4752('0x2d')]};if(_0x4b2635[_0x4752('0x29')]===_0x4752('0x2e')){_0x1dcdcd[_0x4752('0x2f')]=_0x4b2635[_0x4752('0x2f')];_0x1dcdcd[_0x4752('0x30')]=_0x4b2635[_0x4752('0x30')];_0x1dcdcd[_0x4752('0x31')]=_0x4b2635[_0x4752('0x31')];_0x1dcdcd[_0x4752('0x32')]=_0x4b2635['dialOriginateCallerIdNumber'];_0x1dcdcd['dialOriginateTimeout']=_0x4b2635[_0x4752('0x33')];_0x1dcdcd[_0x4752('0x34')]=_0x4b2635[_0x4752('0x34')];_0x1dcdcd[_0x4752('0x35')]=_0x4b2635[_0x4752('0x35')];_0x1dcdcd[_0x4752('0x36')]=_0x4b2635[_0x4752('0x36')];_0x1dcdcd[_0x4752('0x37')]=_0x4b2635[_0x4752('0x37')];_0x1dcdcd[_0x4752('0x38')]=_0x4b2635['outboundBlacklistCallsDay'];_0x1dcdcd[_0x4752('0x39')]=_0x4b2635['outboundBusyCallsDay'];_0x1dcdcd[_0x4752('0x3a')]=_0x4b2635[_0x4752('0x3a')];_0x1dcdcd[_0x4752('0x3b')]=_0x4b2635[_0x4752('0x3b')];_0x1dcdcd[_0x4752('0x3c')]=_0x4b2635['outboundDropCallsDayCallersExit'];_0x1dcdcd[_0x4752('0x3d')]=_0x4b2635['outboundDropCallsDayTimeout'];_0x1dcdcd[_0x4752('0x3e')]=_0x4b2635[_0x4752('0x3e')];_0x1dcdcd[_0x4752('0x3f')]=_0x4b2635[_0x4752('0x3f')];_0x1dcdcd[_0x4752('0x40')]=_0x4b2635[_0x4752('0x40')];_0x1dcdcd[_0x4752('0x41')]=_0x4b2635[_0x4752('0x41')];_0x1dcdcd[_0x4752('0x42')]=_0x4b2635[_0x4752('0x42')];_0x1dcdcd['outboundUnknownCallsDay']=_0x4b2635[_0x4752('0x43')];_0x1dcdcd[_0x4752('0x44')]=_0x4b2635[_0x4752('0x44')];_0x1dcdcd[_0x4752('0x45')]=_0x4b2635[_0x4752('0x45')];_0x1dcdcd[_0x4752('0x46')]=_0x4b2635[_0x4752('0x46')];_0x1dcdcd[_0x4752('0x47')]=_0x4b2635['predictiveIntervalDroppedCallsCallersExit'];_0x1dcdcd[_0x4752('0x48')]=_0x4b2635['predictiveIntervalDroppedCallsTimeout'];_0x1dcdcd[_0x4752('0x49')]=_0x4b2635[_0x4752('0x49')];_0x1dcdcd[_0x4752('0x4a')]=_0x4b2635[_0x4752('0x4a')];_0x1dcdcd['predictiveIntervalHitRate']=_0x4b2635['predictiveIntervalHitRate'];_0x1dcdcd['predictiveIntervalMultiplicativeFactor']=_0x4b2635['predictiveIntervalMultiplicativeFactor'];_0x1dcdcd[_0x4752('0x4b')]=_0x4b2635[_0x4752('0x4b')];_0x1dcdcd['predictiveIntervalAvailable']=_0x4b2635[_0x4752('0x4c')];_0x1dcdcd[_0x4752('0x4d')]=_0x4b2635[_0x4752('0x4d')];_0x1dcdcd['message']=_0x4b2635[_0x4752('0x1a')];_0x1dcdcd[_0x4752('0x4e')]=_0x4b2635[_0x4752('0x4e')];_0x1dcdcd[_0x4752('0x4f')]=_0x4b2635[_0x4752('0x4f')];_0x1dcdcd['erlangCallToSecond']=_0x4b2635['erlangCallToSecond'];_0x1dcdcd[_0x4752('0x50')]=_0x4b2635[_0x4752('0x50')];_0x1dcdcd[_0x4752('0x51')]=_0x4b2635[_0x4752('0x51')];_0x1dcdcd[_0x4752('0x52')]=_0x4b2635[_0x4752('0x52')];_0x1dcdcd[_0x4752('0x53')]=_0x4b2635[_0x4752('0x53')];}if(_0x4b2635[_0x4752('0x54')]){_0x1dcdcd[_0x4752('0x54')]={'id':_0x4b2635[_0x4752('0x54')]['id'],'name':_0x4b2635[_0x4752('0x54')]['name'],'active':_0x4b2635[_0x4752('0x54')]['active'],'callerid':_0x4b2635[_0x4752('0x54')][_0x4752('0x55')]};}if(_0x4b2635['Interval']){_0x1dcdcd[_0x4752('0x56')]={'id':_0x4b2635[_0x4752('0x56')]['id'],'name':_0x4b2635[_0x4752('0x56')][_0x4752('0x8')]};}_0xca8dd1[_0x4752('0x57')](_0x1dcdcd);}}_0x1135bf({'count':_0xca8dd1[_0x4752('0x58')],'rows':_0xca8dd1});});},'UpdateVoiceQueue':function(_0x49afcc){return new Promise(function(_0x1a3092,_0x198f9d){var _0x3a78b2=_[_0x4752('0x59')](_0x3884b9[_0x4752('0x20')],{'id':parseInt(_0x49afcc['id'])});var _0xec3a1e=_['omit'](_0x49afcc,['id']);if(_0x3a78b2){for(var _0x1733ed in _0xec3a1e){if(typeof _0xec3a1e[_0x1733ed]!==_0x4752('0x5a')&&typeof _0x3a78b2[_0x1733ed]!==_0x4752('0x5a')){_0x3a78b2[_0x1733ed]=_0xec3a1e[_0x1733ed];}}_0x1a3092(_0x3a78b2);}else{_0x198f9d();}});},'VoiceChannels':function(_0x2b0dfb){return new Promise(function(_0x2aed07,_0x33fc2c){var _0x47d096=_[_0x4752('0x5b')](_0x3884b9['channels']);_0x2aed07({'count':_0x47d096['length'],'rows':_0x47d096});});},'VoiceChannelMixMonitor':function(_0x965429){var _0x234220=this;return new Promise(function(_0x424ca4,_0x4bcd96){if(ami[_0x4752('0x10')]()==![]){return _0x4bcd96(_0x234220[_0x4752('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x4752('0x11')][_0x4752('0x12')],_0x4752('0x13')]['join']('\x20')));}var _0x2ba24b=schema(properties[_0x4752('0x5c')])[_0x4752('0x5d')](_0x965429);if(_0x2ba24b[_0x4752('0x58')]>0x0){return _0x4bcd96(_0x234220[_0x4752('0x1c')](0x1f4,_[_0x4752('0x5e')](_0x2ba24b,'message')[_0x4752('0x14')](',\x20')));}var _0x5ac67f=_[_0x4752('0x59')](_0x3884b9[_0x4752('0x5f')],{'uniqueid':_0x965429['uniqueid']});if(_0x5ac67f&&_0x5ac67f['channel']){var _0x542e30=util['format']('%s.%s',_0x965429[_0x4752('0x60')]||_0x965429[_0x4752('0x61')],_0x965429[_0x4752('0x5')]||_0x4752('0x62'));return ami['Action']({'action':_0x4752('0x63'),'channel':_0x5ac67f[_0x4752('0x64')],'file':_0x542e30,'options':_0x4752('0x65')})[_0x4752('0x19')](function(_0x1f98a5){var _0x597d7c=_[_0x4752('0x59')](_0x5ac67f[_0x4752('0x66')],{'filename':_0x4752('0x67')+_0x542e30[_0x4752('0x68')]()});if(_[_0x4752('0x69')](_0x597d7c)){_0x5ac67f[_0x4752('0x66')]['push']({'filename':_0x4752('0x67')+_0x542e30[_0x4752('0x68')](),'createdAt':moment()['format'](_0x4752('0x6a')),'mixmonitorid':_0x1f98a5[_0x4752('0x6b')],'status':_0x4752('0x6c')});}else{_0x597d7c[_0x4752('0x6b')]=_0x1f98a5[_0x4752('0x6b')];_0x597d7c[_0x4752('0x6d')]=_0x4752('0x6c');}_0x424ca4({'code':0xc8,'message':[_0x965429[_0x4752('0x61')],_0x4752('0x6e'),_0x1f98a5[_0x4752('0x6b')]]['join']('\x20'),'mixmonitorid':_0x1f98a5['mixmonitorid']});})[_0x4752('0x1b')](function(_0x15bb22){_0x4bcd96(_0x234220[_0x4752('0x1c')](0x1f5,[_0x965429[_0x4752('0x61')],_0x15bb22[_0x4752('0x1a')][_0x4752('0x68')]()]['join']('\x20')));});}else{return _0x4bcd96(_0x234220[_0x4752('0x1c')](0x1f5,_0x4752('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x3315eb){var _0x24d20d=this;return new Promise(function(_0x182fca,_0x17b34b){if(ami[_0x4752('0x10')]()==![]){return _0x17b34b(_0x24d20d[_0x4752('0x1c')](0x1f4,[config[_0x4752('0x11')]['ip'],config[_0x4752('0x11')]['username'],_0x4752('0x13')][_0x4752('0x14')]('\x20')));}var _0x3fffb4=schema(properties[_0x4752('0x5c')])[_0x4752('0x5d')](_0x3315eb);if(_0x3fffb4[_0x4752('0x58')]>0x0){return _0x17b34b(_0x24d20d[_0x4752('0x1c')](0x1f4,_[_0x4752('0x5e')](_0x3fffb4,'message')[_0x4752('0x14')](',\x20')));}var _0x164e8c=_['find'](_0x3884b9[_0x4752('0x5f')],{'uniqueid':_0x3315eb[_0x4752('0x61')]});if(_0x164e8c){return BPromise['resolve']()[_0x4752('0x19')](function(){if(_0x164e8c[_0x4752('0x64')]){return ami[_0x4752('0x1e')]({'action':'StopMixMonitor','channel':_0x164e8c[_0x4752('0x64')],'mixmonitorid':_0x3315eb[_0x4752('0x6b')]})[_0x4752('0x1b')](function(_0x379859){});}})['then'](function(){if(_0x164e8c['destinationchannel']){return ami[_0x4752('0x1e')]({'action':_0x4752('0x70'),'channel':_0x164e8c[_0x4752('0x71')],'mixmonitorid':_0x3315eb[_0x4752('0x6b')]})[_0x4752('0x1b')](function(_0x335e89){});}})[_0x4752('0x19')](function(_0x1470f2){var _0x13fafa=_[_0x4752('0x59')](_0x164e8c[_0x4752('0x66')],{'mixmonitorid':_0x3315eb[_0x4752('0x6b')]});if(_0x13fafa){_0x13fafa[_0x4752('0x6d')]=_0x4752('0x72');}})['then'](function(){var _0x1ac662=util[_0x4752('0x5')](_0x4752('0x73'),_0x3315eb[_0x4752('0x60')]||_0x3315eb['uniqueid'],_0x3315eb[_0x4752('0x5')]||'wav');var _0x2645e9=_[_0x4752('0x59')](_0x164e8c['monitors'],{'filename':_0x4752('0x67')+_0x1ac662[_0x4752('0x68')]()});if(_0x2645e9){_0x2645e9[_0x4752('0x6d')]=_0x4752('0x72');}})[_0x4752('0x19')](function(){_0x182fca({'code':0xc8,'message':[_0x3315eb[_0x4752('0x61')],_0x4752('0x74')][_0x4752('0x14')]('\x20')});})[_0x4752('0x1b')](function(_0x126210){_0x17b34b(_0x24d20d['error'](0x1f5,[_0x3315eb[_0x4752('0x61')],_0x126210[_0x4752('0x1a')][_0x4752('0x68')]()][_0x4752('0x14')]('\x20')));});}else{return _0x17b34b(_0x24d20d['error'](0x1f5,_0x4752('0x6f')));}});},'VoiceQueuesChannels':function(_0x566506){return new Promise(function(_0x19f7cb,_0x360ebf){var _0x52605d=_[_0x4752('0x5b')](_0x3884b9[_0x4752('0x75')]);_0x19f7cb({'count':_0x52605d[_0x4752('0x58')],'rows':_0x52605d});});},'VoiceQueuesChannel':function(_0x545c23){var _0x51d261=this;return new Promise(function(_0x4bd05d,_0x1f1aa8){var _0x26ed2d=schema(properties['voicequeuechannel'])['validate'](_0x545c23);if(_0x26ed2d[_0x4752('0x58')]>0x0){return _0x1f1aa8(_0x51d261[_0x4752('0x1c')](0x1f4,_[_0x4752('0x5e')](_0x26ed2d,_0x4752('0x1a'))[_0x4752('0x14')](',\x20')));}var _0x251d0e=_[_0x4752('0x59')](_0x3884b9[_0x4752('0x75')],{'uniqueid':_0x545c23[_0x4752('0x61')]});if(_0x251d0e){_0x4bd05d(_0x251d0e);}else{return _0x1f1aa8(_0x51d261[_0x4752('0x1c')](0x1f5,_0x4752('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x114ec6){var _0x21a5be=this;return new Promise(function(_0x16c348,_0x3f40a3){if(ami['isConnected']()==![]){return _0x3f40a3(_0x21a5be[_0x4752('0x1c')](0x1f4,[config[_0x4752('0x11')]['ip'],config[_0x4752('0x11')][_0x4752('0x12')],_0x4752('0x13')][_0x4752('0x14')]('\x20')));}var _0x5787b2=schema(properties['voicequeuechannelhangup'])[_0x4752('0x5d')](_0x114ec6);if(_0x5787b2[_0x4752('0x58')]>0x0){return _0x3f40a3(_0x21a5be[_0x4752('0x1c')](0x1f4,_[_0x4752('0x5e')](_0x5787b2,_0x4752('0x1a'))['join'](',\x20')));}var _0x10a7ee=_[_0x4752('0x59')](_0x3884b9[_0x4752('0x75')],{'uniqueid':_0x114ec6[_0x4752('0x61')]});if(_0x10a7ee&&_0x10a7ee[_0x4752('0x64')]){return ami[_0x4752('0x1e')]({'action':_0x4752('0x76'),'channel':_0x10a7ee[_0x4752('0x64')]})[_0x4752('0x19')](function(_0x30a8c5){_0x16c348({'code':0xc8,'message':[_0x114ec6[_0x4752('0x61')],_0x30a8c5['message']['toLowerCase']()][_0x4752('0x14')]('\x20')});})[_0x4752('0x1b')](function(_0x2abb9f){_0x3f40a3(_0x21a5be[_0x4752('0x1c')](0x1f5,[_0x114ec6[_0x4752('0x61')],_0x2abb9f[_0x4752('0x1a')]['toLowerCase']()][_0x4752('0x14')]('\x20')));});}else{return _0x3f40a3(_0x21a5be[_0x4752('0x1c')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x45291f){var _0x20869f=this;return new Promise(function(_0x5180bd,_0x35f1d8){if(ami[_0x4752('0x10')]()==![]){return _0x35f1d8(_0x20869f['error'](0x1f4,[config['asterisk']['ip'],config[_0x4752('0x11')][_0x4752('0x12')],'ami\x20disconnected'][_0x4752('0x14')]('\x20')));}var _0xb5d141=schema(properties['voicequeuechannelredirect'])['validate'](_0x45291f);if(_0xb5d141[_0x4752('0x58')]>0x0){return _0x35f1d8(_0x20869f['error'](0x1f4,_[_0x4752('0x5e')](_0xb5d141,_0x4752('0x1a'))[_0x4752('0x14')](',\x20')));}var _0x223de7=_['find'](_0x3884b9[_0x4752('0x75')],{'uniqueid':_0x45291f[_0x4752('0x61')]});if(_0x223de7&&_0x223de7['channel']){return ami['Action']({'action':'Redirect','channel':_0x223de7[_0x4752('0x64')],'exten':_0x45291f['exten'],'context':_0x45291f[_0x4752('0x77')]||_0x223de7[_0x4752('0x77')],'priority':0x1})[_0x4752('0x19')](function(_0x90f5cd){_0x5180bd({'code':0xc8,'message':[_0x45291f[_0x4752('0x61')],_0x90f5cd[_0x4752('0x1a')][_0x4752('0x68')]()][_0x4752('0x14')]('\x20')});})[_0x4752('0x1b')](function(_0xb5e3e9){_0x35f1d8(_0x20869f[_0x4752('0x1c')](0x1f5,[_0x45291f['uniqueid'],_0xb5e3e9[_0x4752('0x1a')][_0x4752('0x68')]()][_0x4752('0x14')]('\x20')));});}else{return _0x35f1d8(_0x20869f['error'](0x1f5,_0x4752('0x6f')));}});},'Agents':function(_0x476569){return new Promise(function(_0x20da9c,_0x57c7e1){var _0x17a03d=_['values'](_0x3884b9[_0x4752('0xc')]);_0x20da9c({'count':_0x17a03d[_0x4752('0x58')],'rows':_0x17a03d});});},'Telephones':function(_0x159724){return new Promise(function(_0x2aa5fd,_0x52c216){var _0x59f379=_[_0x4752('0x5b')](_0x3884b9[_0x4752('0x78')]);_0x2aa5fd({'count':_0x59f379[_0x4752('0x58')],'rows':_0x59f379});});},'Trunks':function(_0x1a2e13){return new Promise(function(_0x5428f3,_0x12d59c){var _0x124042=_[_0x4752('0x5b')](_0x3884b9[_0x4752('0x79')]);_0x5428f3({'count':_0x124042[_0x4752('0x58')],'rows':_0x124042});});},'OutboundChannels':function(_0xabd6bb){return new Promise(function(_0x58e755,_0x38596b){var _0x2384c7=_[_0x4752('0x5b')](_0x3884b9['outboundChannels']);_0x58e755({'count':_0x2384c7[_0x4752('0x58')],'rows':_0x2384c7});});},'Outbound':function(_0x537702){return new Promise(function(_0x41552c,_0x375360){_0x41552c(_0x3884b9[_0x4752('0x2e')]);});},'Campaigns':function(_0x32e20d){return new Promise(function(_0x5c165d,_0x4493b1){var _0x549b86=_['values'](_0x3884b9[_0x4752('0x7a')]);_0x5c165d({'count':_0x549b86[_0x4752('0x58')],'rows':_0x549b86});});},'VoiceQueuesPreview':function(_0x1e0804){var _0x48b1da=this;return new Promise(function(_0x369e81,_0x116022){_0x307267['run'](_0x1e0804['id'])['then'](function(_0x3aff09){_0x369e81({'code':0xc8,'message':_0x3aff09[_0x4752('0x1a')]});})[_0x4752('0x1b')](function(_0x389017){_0x116022(_0x48b1da[_0x4752('0x1c')](0x1f4,_0x389017['message']));});});},'EventManager':function(_0x128686){var _0x52022a=this;return new Promise(function(_0x386d4b,_0xa2de54){if(!_0x128686[_0x4752('0x7b')]){return _0xa2de54(_0x52022a[_0x4752('0x1c')](0x1f4,_0x4752('0x7c')));}ami[_0x4752('0x7d')](_0x4752('0x7e')+_0x128686[_0x4752('0x7b')],_0x128686[_0x4752('0x1a')]);_0x386d4b({'code':0xc8,'message':_0x128686});});},'FaxAccounts':function(_0x229132){return new Promise(function(_0x25cf3d,_0x2b1733){var _0x55e3fb=_[_0x4752('0x5b')](_0x3884b9[_0x4752('0x7f')]);_0x25cf3d({'count':_0x55e3fb[_0x4752('0x58')],'rows':_0x55e3fb});});},'SendFax':function(_0x24ad81){var _0x539b9b=this;return new Promise(function(_0xdb7ab0,_0xcc2c87){_0x66a421[_0x4752('0x80')](_0x24ad81)[_0x4752('0x19')](function(_0x39391d){_0xdb7ab0({'code':0xc8,'message':_0x39391d['message']});})[_0x4752('0x1b')](function(_0x3578f4){_0xcc2c87(_0x539b9b[_0x4752('0x1c')](0x1f4,_0x3578f4['message']));});});},'CheckAfterSend':function(_0x28098c){var _0x553eb6=this;return new Promise(function(_0x4bde22,_0x2cfdd5){_0x66a421[_0x4752('0x81')](_0x28098c)['then'](function(_0x2be73d){_0x4bde22({'code':0xc8,'message':_0x2be73d['message']});})[_0x4752('0x1b')](function(_0x48b39f){_0x2cfdd5(_0x553eb6[_0x4752('0x1c')](0x1f4,_0x48b39f[_0x4752('0x1a')]));});});}};var _0x189485=jayson[_0x4752('0x82')](_0x5b98c0)['http']();_0x189485['on']('error',function(_0x4ab6b9){return _0x104962(_0x4ab6b9);});_0x189485[_0x4752('0x83')](0x232a,_0x4752('0x84'),function(){console[_0x4752('0x85')](_0x4752('0x86'),0x232a);return _0x55b411('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x6c45=['join','voicechannel','map','channels','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','find','toLowerCase','isNil','/var/spool/asterisk/monitor/','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','Redirect','exten','context','values','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','127.0.0.1','log','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Action','then','message','catch','command','Command','voiceQueues','name','strategy','available','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','undefined','length'];(function(_0x20b371,_0x1f9dff){var _0x556a6e=function(_0x4afec0){while(--_0x4afec0){_0x20b371['push'](_0x20b371['shift']());}};_0x556a6e(++_0x1f9dff);}(_0x6c45,0xb1));var _0x56c4=function(_0x18c6a8,_0x589b89){_0x18c6a8=_0x18c6a8-0x0;var _0x532586=_0x6c45[_0x18c6a8];return _0x532586;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var jayson=require('jayson/promise');var schema=require(_0x56c4('0x2'));var BPromise=require(_0x56c4('0x3'));var moment=require(_0x56c4('0x4'));var config=require(_0x56c4('0x5'));var properties=require(_0x56c4('0x6'));var ami=require(_0x56c4('0x7'));exports[_0x56c4('0x8')]=function(_0x24d839,_0x1316a6,_0x3cc49e){return new BPromise(function(_0x1fcb9e,_0x330e6){var _0x1d0b9b={'QueuePause':function(_0x373748){return new Promise(function(_0x7e0748,_0x38dbd7){var _0x13b767=util[_0x56c4('0x9')](_0x56c4('0xa'),_0x56c4('0xb'),_0x373748['name']);if(_0x24d839[_0x56c4('0xc')]&&_0x24d839[_0x56c4('0xc')][_0x13b767]&&_0x24d839[_0x56c4('0xc')][_0x13b767][_0x56c4('0xd')]){_0x24d839['timers'][_0x13b767][_0x56c4('0xe')]();}if(_0x24d839[_0x56c4('0xf')][_0x13b767]){_0x24d839[_0x56c4('0xf')][_0x13b767][_0x56c4('0x10')]({'statePause':_0x373748['pause']?!![]:![]});}_0x7e0748({'code':0xc8,'message':_0x56c4('0x11')});});},'Reload':function(_0x5ec318){var _0x512d7e=this;return new Promise(function(_0x2cb56e,_0xec63c0){if(ami[_0x56c4('0x12')]()==![]){return _0xec63c0(_0x512d7e[_0x56c4('0x13')](0x1f4,[config[_0x56c4('0x14')]['ip'],config['asterisk'][_0x56c4('0x15')],_0x56c4('0x16')]['join']('\x20')));}_0x5ec318=_[_0x56c4('0x17')](_0x5ec318,_[_0x56c4('0x18')](properties[_0x56c4('0x19')]));_0x5ec318[_0x56c4('0x1a')]='Reload';return ami[_0x56c4('0x1b')](_0x5ec318)[_0x56c4('0x1c')](function(_0x56324c){_0x2cb56e({'code':0xc8,'message':_0x56324c[_0x56c4('0x1d')]});})[_0x56c4('0x1e')](function(_0x110f71){_0xec63c0(_0x512d7e[_0x56c4('0x13')](0x1f5,_0x110f71['message']));});});},'Command':function(_0x100a6e){var _0xd696d7=this;return new Promise(function(_0x279a1e,_0x7a7612){if(ami[_0x56c4('0x12')]()==![]){return _0x7a7612(_0xd696d7[_0x56c4('0x13')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x56c4('0x15')],_0x56c4('0x16')]['join']('\x20')));}_0x100a6e=_[_0x56c4('0x17')](_0x100a6e,_0x56c4('0x1f'));_0x100a6e[_0x56c4('0x1a')]=_0x56c4('0x20');return ami[_0x56c4('0x1b')](_0x100a6e)[_0x56c4('0x1c')](function(_0xc130d6){_0x279a1e({'code':0xc8,'message':_0xc130d6['content']});})[_0x56c4('0x1e')](function(_0x3e1007){_0x7a7612(_0xd696d7[_0x56c4('0x13')](0x1f5,_0x3e1007['message']));});});},'VoiceQueues':function(_0xc8ed28){return new Promise(function(_0x4d1d9c,_0x213cc6){var _0xecf1e7=[];for(var _0x5945fb in _0x24d839[_0x56c4('0x21')]){if(_0x24d839[_0x56c4('0x21')]['hasOwnProperty'](_0x5945fb)){var _0x4c4a8c=_0x24d839['voiceQueues'][_0x5945fb];var _0x23fadb={'id':_0x4c4a8c['id'],'name':_0x4c4a8c[_0x56c4('0x22')],'strategy':_0x4c4a8c[_0x56c4('0x23')],'answered':_0x4c4a8c['answered'],'available':_0x4c4a8c[_0x56c4('0x24')],'loggedIn':_0x4c4a8c['loggedIn'],'pTalking':_0x4c4a8c['pTalking'],'sumBillable':_0x4c4a8c[_0x56c4('0x25')],'sumDuration':_0x4c4a8c[_0x56c4('0x26')],'sumHoldTime':_0x4c4a8c[_0x56c4('0x27')]||0x0,'talking':_0x4c4a8c[_0x56c4('0x28')],'total':_0x4c4a8c[_0x56c4('0x29')],'type':_0x4c4a8c[_0x56c4('0x2a')],'unmanaged':_0x4c4a8c[_0x56c4('0x2b')],'abandoned':_0x4c4a8c[_0x56c4('0x2c')],'waiting':_0x4c4a8c['waiting'],'loggedInDb':_0x4c4a8c[_0x56c4('0x2d')]};if(_0x4c4a8c[_0x56c4('0x2a')]===_0x56c4('0x2e')){_0x23fadb['dialActive']=_0x4c4a8c[_0x56c4('0x2f')];_0x23fadb[_0x56c4('0x30')]=_0x4c4a8c[_0x56c4('0x30')];_0x23fadb['dialOriginateCallerIdName']=_0x4c4a8c[_0x56c4('0x31')];_0x23fadb[_0x56c4('0x32')]=_0x4c4a8c['dialOriginateCallerIdNumber'];_0x23fadb[_0x56c4('0x33')]=_0x4c4a8c['dialOriginateTimeout'];_0x23fadb[_0x56c4('0x34')]=_0x4c4a8c[_0x56c4('0x34')];_0x23fadb[_0x56c4('0x35')]=_0x4c4a8c[_0x56c4('0x35')];_0x23fadb[_0x56c4('0x36')]=_0x4c4a8c['outboundAnswerAgiCallsDay'];_0x23fadb['outboundAnswerCallsDay']=_0x4c4a8c[_0x56c4('0x37')];_0x23fadb[_0x56c4('0x38')]=_0x4c4a8c[_0x56c4('0x38')];_0x23fadb[_0x56c4('0x39')]=_0x4c4a8c[_0x56c4('0x39')];_0x23fadb['outboundCongestionCallsDay']=_0x4c4a8c[_0x56c4('0x3a')];_0x23fadb[_0x56c4('0x3b')]=_0x4c4a8c[_0x56c4('0x3b')];_0x23fadb[_0x56c4('0x3c')]=_0x4c4a8c[_0x56c4('0x3c')];_0x23fadb[_0x56c4('0x3d')]=_0x4c4a8c[_0x56c4('0x3d')];_0x23fadb['outboundNoAnswerCallsDay']=_0x4c4a8c['outboundNoAnswerCallsDay'];_0x23fadb[_0x56c4('0x3e')]=_0x4c4a8c[_0x56c4('0x3e')];_0x23fadb[_0x56c4('0x3f')]=_0x4c4a8c[_0x56c4('0x3f')];_0x23fadb[_0x56c4('0x40')]=_0x4c4a8c['outboundReCallsDay'];_0x23fadb['outboundRejectCallsDay']=_0x4c4a8c[_0x56c4('0x41')];_0x23fadb['outboundUnknownCallsDay']=_0x4c4a8c[_0x56c4('0x42')];_0x23fadb[_0x56c4('0x43')]=_0x4c4a8c[_0x56c4('0x43')];_0x23fadb[_0x56c4('0x44')]=_0x4c4a8c['predictiveIntervalAvgHoldtime'];_0x23fadb[_0x56c4('0x45')]=_0x4c4a8c[_0x56c4('0x45')];_0x23fadb[_0x56c4('0x46')]=_0x4c4a8c[_0x56c4('0x46')];_0x23fadb[_0x56c4('0x47')]=_0x4c4a8c[_0x56c4('0x47')];_0x23fadb[_0x56c4('0x48')]=_0x4c4a8c['predictiveIntervalErlangCalls'];_0x23fadb['predictiveIntervalErlangCallsDroppedCalls']=_0x4c4a8c[_0x56c4('0x49')];_0x23fadb[_0x56c4('0x4a')]=_0x4c4a8c['predictiveIntervalHitRate'];_0x23fadb[_0x56c4('0x4b')]=_0x4c4a8c[_0x56c4('0x4b')];_0x23fadb['predictiveIntervalPauses']=_0x4c4a8c[_0x56c4('0x4c')];_0x23fadb[_0x56c4('0x4d')]=_0x4c4a8c['predictiveIntervalAvailable'];_0x23fadb['predictiveIntervalTotalCalls']=_0x4c4a8c[_0x56c4('0x4e')];_0x23fadb[_0x56c4('0x1d')]=_0x4c4a8c[_0x56c4('0x1d')];_0x23fadb[_0x56c4('0x4f')]=_0x4c4a8c['originated'];_0x23fadb['erlangCalls']=_0x4c4a8c['erlangCalls'];_0x23fadb[_0x56c4('0x50')]=_0x4c4a8c[_0x56c4('0x50')];_0x23fadb[_0x56c4('0x51')]=_0x4c4a8c['erlangAbandonmentRate'];_0x23fadb[_0x56c4('0x52')]=_0x4c4a8c[_0x56c4('0x52')];_0x23fadb['startPredictive']=_0x4c4a8c[_0x56c4('0x53')];_0x23fadb[_0x56c4('0x54')]=_0x4c4a8c[_0x56c4('0x54')];}if(_0x4c4a8c[_0x56c4('0x55')]){_0x23fadb[_0x56c4('0x55')]={'id':_0x4c4a8c[_0x56c4('0x55')]['id'],'name':_0x4c4a8c[_0x56c4('0x55')]['name'],'active':_0x4c4a8c['Trunk'][_0x56c4('0x56')],'callerid':_0x4c4a8c['Trunk']['callerid']};}if(_0x4c4a8c[_0x56c4('0x57')]){_0x23fadb['Interval']={'id':_0x4c4a8c[_0x56c4('0x57')]['id'],'name':_0x4c4a8c[_0x56c4('0x57')][_0x56c4('0x22')]};}_0xecf1e7[_0x56c4('0x58')](_0x23fadb);}}_0x4d1d9c({'count':_0xecf1e7['length'],'rows':_0xecf1e7});});},'UpdateVoiceQueue':function(_0x44d604){return new Promise(function(_0x42603f,_0x57bfe8){var _0x546b16=_['find'](_0x24d839['voiceQueues'],{'id':parseInt(_0x44d604['id'])});var _0x2651aa=_['omit'](_0x44d604,['id']);if(_0x546b16){for(var _0xd3b676 in _0x2651aa){if(typeof _0x2651aa[_0xd3b676]!=='undefined'&&typeof _0x546b16[_0xd3b676]!==_0x56c4('0x59')){_0x546b16[_0xd3b676]=_0x2651aa[_0xd3b676];}}_0x42603f(_0x546b16);}else{_0x57bfe8();}});},'VoiceChannels':function(_0x5f4c90){return new Promise(function(_0x4064b4,_0x593a2d){var _0xde1b7c=_['values'](_0x24d839['channels']);_0x4064b4({'count':_0xde1b7c[_0x56c4('0x5a')],'rows':_0xde1b7c});});},'VoiceChannelMixMonitor':function(_0x18f883){var _0x251ee2=this;return new Promise(function(_0x3886ec,_0x251c0c){if(ami[_0x56c4('0x12')]()==![]){return _0x251c0c(_0x251ee2['error'](0x1f4,[config[_0x56c4('0x14')]['ip'],config[_0x56c4('0x14')][_0x56c4('0x15')],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x1ca0fc=schema(properties[_0x56c4('0x5c')])[_0x56c4('0x2')](_0x18f883);if(_0x1ca0fc['length']>0x0){return _0x251c0c(_0x251ee2[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x1ca0fc,'message')[_0x56c4('0x5b')](',\x20')));}var _0x2b9010=_['find'](_0x24d839[_0x56c4('0x5e')],{'uniqueid':_0x18f883[_0x56c4('0x5f')]});if(_0x2b9010&&_0x2b9010[_0x56c4('0x60')]){var _0x227001=util[_0x56c4('0x9')]('%s.%s',_0x18f883[_0x56c4('0x61')]||_0x18f883['uniqueid'],_0x18f883[_0x56c4('0x9')]||_0x56c4('0x62'));return ami['Action']({'action':_0x56c4('0x63'),'channel':_0x2b9010[_0x56c4('0x60')],'file':_0x227001,'options':_0x56c4('0x64')})['then'](function(_0x3578f5){var _0x2c3cb0=_[_0x56c4('0x65')](_0x2b9010['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x227001[_0x56c4('0x66')]()});if(_[_0x56c4('0x67')](_0x2c3cb0)){_0x2b9010['monitors'][_0x56c4('0x58')]({'filename':_0x56c4('0x68')+_0x227001[_0x56c4('0x66')](),'createdAt':moment()[_0x56c4('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3578f5[_0x56c4('0x69')],'status':_0x56c4('0x6a')});}else{_0x2c3cb0[_0x56c4('0x69')]=_0x3578f5[_0x56c4('0x69')];_0x2c3cb0['status']=_0x56c4('0x6a');}_0x3886ec({'code':0xc8,'message':[_0x18f883['uniqueid'],_0x56c4('0x6b'),_0x3578f5[_0x56c4('0x69')]]['join']('\x20'),'mixmonitorid':_0x3578f5[_0x56c4('0x69')]});})[_0x56c4('0x1e')](function(_0x53a095){_0x251c0c(_0x251ee2['error'](0x1f5,[_0x18f883[_0x56c4('0x5f')],_0x53a095[_0x56c4('0x1d')]['toLowerCase']()][_0x56c4('0x5b')]('\x20')));});}else{return _0x251c0c(_0x251ee2[_0x56c4('0x13')](0x1f5,_0x56c4('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x31bcb3){var _0x3eecfe=this;return new Promise(function(_0x237e1f,_0x1d9868){if(ami[_0x56c4('0x12')]()==![]){return _0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f4,[config[_0x56c4('0x14')]['ip'],config['asterisk'][_0x56c4('0x15')],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x1942fe=schema(properties[_0x56c4('0x5c')])[_0x56c4('0x2')](_0x31bcb3);if(_0x1942fe[_0x56c4('0x5a')]>0x0){return _0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x1942fe,_0x56c4('0x1d'))['join'](',\x20')));}var _0x1c8190=_[_0x56c4('0x65')](_0x24d839[_0x56c4('0x5e')],{'uniqueid':_0x31bcb3['uniqueid']});if(_0x1c8190){return BPromise[_0x56c4('0x6d')]()['then'](function(){if(_0x1c8190[_0x56c4('0x60')]){return ami[_0x56c4('0x1b')]({'action':_0x56c4('0x6e'),'channel':_0x1c8190[_0x56c4('0x60')],'mixmonitorid':_0x31bcb3[_0x56c4('0x69')]})[_0x56c4('0x1e')](function(_0x2ac7f2){});}})[_0x56c4('0x1c')](function(){if(_0x1c8190[_0x56c4('0x6f')]){return ami['Action']({'action':_0x56c4('0x6e'),'channel':_0x1c8190['destinationchannel'],'mixmonitorid':_0x31bcb3['mixmonitorid']})[_0x56c4('0x1e')](function(_0x364243){});}})['then'](function(_0x1dd10a){var _0x4a2cae=_['find'](_0x1c8190[_0x56c4('0x70')],{'mixmonitorid':_0x31bcb3[_0x56c4('0x69')]});if(_0x4a2cae){_0x4a2cae['status']=_0x56c4('0x71');}})[_0x56c4('0x1c')](function(){var _0x298145=util[_0x56c4('0x9')](_0x56c4('0x72'),_0x31bcb3[_0x56c4('0x61')]||_0x31bcb3[_0x56c4('0x5f')],_0x31bcb3[_0x56c4('0x9')]||'wav');var _0x240ad9=_[_0x56c4('0x65')](_0x1c8190['monitors'],{'filename':_0x56c4('0x68')+_0x298145['toLowerCase']()});if(_0x240ad9){_0x240ad9['status']=_0x56c4('0x71');}})[_0x56c4('0x1c')](function(){_0x237e1f({'code':0xc8,'message':[_0x31bcb3[_0x56c4('0x5f')],_0x56c4('0x73')]['join']('\x20')});})[_0x56c4('0x1e')](function(_0x1aabd6){_0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f5,[_0x31bcb3[_0x56c4('0x5f')],_0x1aabd6[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')));});}else{return _0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2c45f6){return new Promise(function(_0x3e4f3a,_0x40301c){var _0x6e2c28=_['values'](_0x24d839[_0x56c4('0x74')]);_0x3e4f3a({'count':_0x6e2c28['length'],'rows':_0x6e2c28});});},'VoiceQueuesChannel':function(_0xb59d24){var _0x4b0d9c=this;return new Promise(function(_0x56c92a,_0x2791b6){var _0x5ecd9f=schema(properties['voicequeuechannel'])['validate'](_0xb59d24);if(_0x5ecd9f['length']>0x0){return _0x2791b6(_0x4b0d9c[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x5ecd9f,_0x56c4('0x1d'))['join'](',\x20')));}var _0x1a9345=_['find'](_0x24d839[_0x56c4('0x74')],{'uniqueid':_0xb59d24['uniqueid']});if(_0x1a9345){_0x56c92a(_0x1a9345);}else{return _0x2791b6(_0x4b0d9c[_0x56c4('0x13')](0x1f5,_0x56c4('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x20a3c9){var _0x51785f=this;return new Promise(function(_0x6c41c7,_0x39000f){if(ami['isConnected']()==![]){return _0x39000f(_0x51785f['error'](0x1f4,[config[_0x56c4('0x14')]['ip'],config[_0x56c4('0x14')]['username'],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x4feebd=schema(properties['voicequeuechannelhangup'])['validate'](_0x20a3c9);if(_0x4feebd[_0x56c4('0x5a')]>0x0){return _0x39000f(_0x51785f[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x4feebd,'message')[_0x56c4('0x5b')](',\x20')));}var _0x2fbe9d=_[_0x56c4('0x65')](_0x24d839['queueChannels'],{'uniqueid':_0x20a3c9['uniqueid']});if(_0x2fbe9d&&_0x2fbe9d[_0x56c4('0x60')]){return ami[_0x56c4('0x1b')]({'action':'Hangup','channel':_0x2fbe9d[_0x56c4('0x60')]})['then'](function(_0x5d1569){_0x6c41c7({'code':0xc8,'message':[_0x20a3c9['uniqueid'],_0x5d1569[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')});})[_0x56c4('0x1e')](function(_0xc82779){_0x39000f(_0x51785f[_0x56c4('0x13')](0x1f5,[_0x20a3c9[_0x56c4('0x5f')],_0xc82779[_0x56c4('0x1d')]['toLowerCase']()][_0x56c4('0x5b')]('\x20')));});}else{return _0x39000f(_0x51785f[_0x56c4('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x1e28b3){var _0x9bbbbc=this;return new Promise(function(_0xce0938,_0x2f24ad){if(ami['isConnected']()==![]){return _0x2f24ad(_0x9bbbbc[_0x56c4('0x13')](0x1f4,[config[_0x56c4('0x14')]['ip'],config['asterisk']['username'],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x127489=schema(properties['voicequeuechannelredirect'])[_0x56c4('0x2')](_0x1e28b3);if(_0x127489['length']>0x0){return _0x2f24ad(_0x9bbbbc['error'](0x1f4,_['map'](_0x127489,_0x56c4('0x1d'))['join'](',\x20')));}var _0x280e9f=_[_0x56c4('0x65')](_0x24d839[_0x56c4('0x74')],{'uniqueid':_0x1e28b3[_0x56c4('0x5f')]});if(_0x280e9f&&_0x280e9f['channel']){return ami['Action']({'action':_0x56c4('0x75'),'channel':_0x280e9f['channel'],'exten':_0x1e28b3[_0x56c4('0x76')],'context':_0x1e28b3[_0x56c4('0x77')]||_0x280e9f[_0x56c4('0x77')],'priority':0x1})['then'](function(_0x45a42e){_0xce0938({'code':0xc8,'message':[_0x1e28b3[_0x56c4('0x5f')],_0x45a42e[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')});})[_0x56c4('0x1e')](function(_0x537f7e){_0x2f24ad(_0x9bbbbc['error'](0x1f5,[_0x1e28b3[_0x56c4('0x5f')],_0x537f7e[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')));});}else{return _0x2f24ad(_0x9bbbbc[_0x56c4('0x13')](0x1f5,_0x56c4('0x6c')));}});},'Agents':function(_0x1300e3){return new Promise(function(_0x2f5b76,_0x51c8c5){var _0x4f2126=_[_0x56c4('0x78')](_0x24d839['agents']);_0x2f5b76({'count':_0x4f2126[_0x56c4('0x5a')],'rows':_0x4f2126});});},'Telephones':function(_0x45520e){return new Promise(function(_0x13c8ec,_0x2800f5){var _0x463ecd=_['values'](_0x24d839[_0x56c4('0x79')]);_0x13c8ec({'count':_0x463ecd[_0x56c4('0x5a')],'rows':_0x463ecd});});},'Trunks':function(_0x3a40f2){return new Promise(function(_0x4df8ac,_0x32b4eb){var _0x12f3dd=_[_0x56c4('0x78')](_0x24d839[_0x56c4('0x7a')]);_0x4df8ac({'count':_0x12f3dd[_0x56c4('0x5a')],'rows':_0x12f3dd});});},'OutboundChannels':function(_0x3293b3){return new Promise(function(_0x34c4e1,_0xca6015){var _0x507551=_['values'](_0x24d839['outboundChannels']);_0x34c4e1({'count':_0x507551['length'],'rows':_0x507551});});},'Outbound':function(_0x226b1c){return new Promise(function(_0x146aee,_0x2a29e0){_0x146aee(_0x24d839[_0x56c4('0x2e')]);});},'Campaigns':function(_0x2bba5c){return new Promise(function(_0xb2be11,_0x3a2a69){var _0x2e2d43=_[_0x56c4('0x78')](_0x24d839[_0x56c4('0x7b')]);_0xb2be11({'count':_0x2e2d43[_0x56c4('0x5a')],'rows':_0x2e2d43});});},'VoiceQueuesPreview':function(_0x4a8686){var _0x3202d6=this;return new Promise(function(_0xaa6920,_0x5a57f9){_0x1316a6[_0x56c4('0x7c')](_0x4a8686['id'])['then'](function(_0x43a81d){_0xaa6920({'code':0xc8,'message':_0x43a81d[_0x56c4('0x1d')]});})[_0x56c4('0x1e')](function(_0xb2158){_0x5a57f9(_0x3202d6[_0x56c4('0x13')](0x1f4,_0xb2158['message']));});});},'EventManager':function(_0xfee620){var _0xc4a2ab=this;return new Promise(function(_0x813103,_0x257593){if(!_0xfee620[_0x56c4('0x7d')]){return _0x257593(_0xc4a2ab[_0x56c4('0x13')](0x1f4,_0x56c4('0x7e')));}ami[_0x56c4('0x7f')](_0x56c4('0x80')+_0xfee620['event'],_0xfee620[_0x56c4('0x1d')]);_0x813103({'code':0xc8,'message':_0xfee620});});},'FaxAccounts':function(_0x343d49){return new Promise(function(_0x1b29ec,_0x271204){var _0x1cc090=_['values'](_0x24d839[_0x56c4('0x81')]);_0x1b29ec({'count':_0x1cc090[_0x56c4('0x5a')],'rows':_0x1cc090});});},'SendFax':function(_0x56a607){var _0x28d973=this;return new Promise(function(_0x551268,_0x5dae49){_0x3cc49e['send'](_0x56a607)['then'](function(_0xe5a367){_0x551268({'code':0xc8,'message':_0xe5a367[_0x56c4('0x1d')]});})['catch'](function(_0x3a3906){_0x5dae49(_0x28d973[_0x56c4('0x13')](0x1f4,_0x3a3906[_0x56c4('0x1d')]));});});},'CheckAfterSend':function(_0x592c1f){var _0x2d37a0=this;return new Promise(function(_0x116be3,_0xb11a95){_0x3cc49e['checkAfterSend'](_0x592c1f)[_0x56c4('0x1c')](function(_0xb64a11){_0x116be3({'code':0xc8,'message':_0xb64a11[_0x56c4('0x1d')]});})['catch'](function(_0x5dee4b){_0xb11a95(_0x2d37a0['error'](0x1f4,_0x5dee4b[_0x56c4('0x1d')]));});});}};var _0x182eb9=jayson[_0x56c4('0x82')](_0x1d0b9b)[_0x56c4('0x83')]();_0x182eb9['on'](_0x56c4('0x13'),function(_0xebea9){return _0x330e6(_0xebea9);});_0x182eb9[_0x56c4('0x8')](0x232a,_0x56c4('0x84'),function(){console[_0x56c4('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x1fcb9e('RPC\x20listening\x20on\x20port:'+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 0eaba82..b8bd0f1 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 _0xb607=['merge','ioredis','util','../../../../config/environment','../../rpc/cmContact','defaults','socket.io-emitter','redis','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','data3','split','$or','map','routeId','destcalleridnum','lastName','phone','mobile','fax','ListId','createdAt','scheduledAt','union','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','firstName','calleridname','','destcalleridname','Unknown','resolve','createContact','[CM][%s][%s]\x20Contact\x20created:%s','push','user:%s','name','format','action'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xb607,0x6d));var _0x7b60=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xb607[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x7b60('0x0'));var util=require(_0x7b60('0x1'));var config=require(_0x7b60('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x7b60('0x3'));config['redis']=_[_0x7b60('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7b60('0x5'))(new Redis(config[_0x7b60('0x6')]));function emit(_0x5a8335,_0x4195b7,_0x39d8b5,_0x439b6b,_0x53e8ce){logger['info'](_0x7b60('0x7'),_0x5a8335,_0x4195b7['id'],_0x39d8b5,_0x439b6b,JSON[_0x7b60('0x8')](_0x53e8ce));io['to'](_0x39d8b5)[_0x7b60('0x9')](_0x439b6b,_0x53e8ce);}exports[_0x7b60('0xa')]=function(_0x11fadf,_0x29d767,_0x288c5e,_0x1c25be){var _0x43a096,_0x355536;var _0x5a2a7d={};var _0x112da6=Number(_0x288c5e[_0x7b60('0xb')]);var _0x14dc55=_0x288c5e[_0x7b60('0xc')]?Boolean(Number(_0x288c5e[_0x7b60('0xc')])):![];var _0x321aca;if(_0x1c25be[_0x7b60('0xd')]){_0x5a2a7d['id']=_0x1c25be['xmd-contactid'];}if(!_0x5a2a7d['id']){_0x5a2a7d['ListId']=_0x112da6;_0x321aca=_0x288c5e[_0x7b60('0xe')]&&_0x288c5e['data3']!=='0'?_0x288c5e['data3'][_0x7b60('0xf')](','):['phone'];_0x5a2a7d[_0x7b60('0x10')]=_[_0x7b60('0x11')](_0x321aca,function(_0x597f6d){var _0x12d2f6={};_0x12d2f6[_0x597f6d]=_0x1c25be[_0x7b60('0x12')]?_0x1c25be[_0x7b60('0x13')]:_0x1c25be['calleridnum'];return _0x12d2f6;});}var _0x541712=['id','firstName',_0x7b60('0x14'),_0x7b60('0x15'),_0x7b60('0x16'),_0x7b60('0x17'),_0x7b60('0x18'),_0x7b60('0x19'),_0x7b60('0x1a'),'updatedAt'];var _0x43246e=_[_0x7b60('0x1b')](_0x541712,_0x321aca);BPromise['resolve']()[_0x7b60('0x1c')](cmContactRpc[_0x7b60('0x1d')]({'attributes':_0x43246e,'where':_0x5a2a7d}))[_0x7b60('0x1c')](function(_0x5bb694){_0x355536=_0x5bb694;if(!_['isEmpty'](_0x355536)){if(_0x355536[_0x7b60('0x1e')]===0x1){_0x43a096=_0x355536[0x0];logger[_0x7b60('0x1f')](_0x7b60('0x20'),_0x1c25be[_0x7b60('0x21')],_0x29d767['id'],_0x43a096['id']);}else{logger[_0x7b60('0x1f')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1c25be['uniqueid'],_0x29d767['id'],_['map'](_0x355536,'id')[_0x7b60('0x22')](','));}return;}else{logger[_0x7b60('0x1f')](_0x7b60('0x23'),_0x1c25be['uniqueid'],_0x29d767['id']);var _0x39100e={'ListId':_0x112da6};var _0x1226c1=_0x288c5e[_0x7b60('0x24')]&&_0x288c5e[_0x7b60('0x24')]!=='0'?_0x288c5e[_0x7b60('0x24')]:'phone';if(_0x14dc55){logger[_0x7b60('0x1f')](_0x7b60('0x25'),_0x1c25be[_0x7b60('0x21')],_0x29d767['id']);_0x39100e[_0x1226c1]=_[_0x7b60('0x26')](_0x1c25be[_0x7b60('0x12')])?_0x1c25be[_0x7b60('0x27')]:_0x1c25be[_0x7b60('0x13')];if(_[_0x7b60('0x26')](_0x1c25be[_0x7b60('0x12')])){_0x39100e[_0x7b60('0x28')]=_0x1c25be[_0x7b60('0x29')]&&_0x1c25be[_0x7b60('0x29')]!==_0x7b60('0x2a')?_0x1c25be['calleridname']:'Unknown';}else{_0x39100e[_0x7b60('0x28')]=_0x1c25be[_0x7b60('0x2b')]&&_0x1c25be['destcalleridname']!==''?_0x1c25be[_0x7b60('0x2b')]:_0x7b60('0x2c');}return BPromise[_0x7b60('0x2d')]()[_0x7b60('0x1c')](cmContactRpc[_0x7b60('0x2e')](_0x39100e))['then'](function(_0x4b671e){_0x43a096=_0x4b671e;_0x355536['push'](_0x4b671e);if(_0x43a096){logger[_0x7b60('0x1f')](_0x7b60('0x2f'),_0x1c25be[_0x7b60('0x21')],_0x29d767['id'],_0x43a096['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1c25be[_0x7b60('0x21')],_0x29d767['id']);_0x39100e[_0x1226c1]=_[_0x7b60('0x26')](_0x1c25be[_0x7b60('0x12')])?_0x1c25be[_0x7b60('0x27')]:_0x1c25be['destcalleridnum'];if(_[_0x7b60('0x26')](_0x1c25be[_0x7b60('0x12')])){_0x39100e[_0x7b60('0x28')]=_0x1c25be[_0x7b60('0x29')]&&_0x1c25be['calleridname']!==_0x7b60('0x2a')?_0x1c25be[_0x7b60('0x29')]:_0x7b60('0x2c');}else{_0x39100e[_0x7b60('0x28')]=_0x1c25be[_0x7b60('0x2b')]&&_0x1c25be['destcalleridname']!==''?_0x1c25be['destcalleridname']:'Unknown';}_0x43a096=_0x39100e;_0x355536[_0x7b60('0x30')](_0x39100e);return;}}})['then'](function(){if(_0x11fadf){emit(_0x1c25be[_0x7b60('0x21')],_0x29d767,util['format'](_0x7b60('0x31'),_0x11fadf[_0x7b60('0x32')]),util[_0x7b60('0x33')]('trigger:%s',_0x288c5e[_0x7b60('0x34')]['toLowerCase']()),{'evt':_[_0x7b60('0x35')](_0x1c25be,{'autoCreate':_0x14dc55}),'contact':_0x43a096===undefined?{}:_0x43a096,'contacts':_0x355536[_0x7b60('0x1e')]===0x0?undefined:_0x355536});}});}; \ No newline at end of file +var _0x6e2f=['isNil','routeId','calleridname','destcalleridname','','resolve','push','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','format','user:%s','name','trigger:%s','toLowerCase','lodash','bluebird','ioredis','util','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','then','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0x6e2f,0x140));var _0xf6e2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6e2f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf6e2('0x0'));var BPromise=require(_0xf6e2('0x1'));var Redis=require(_0xf6e2('0x2'));var util=require(_0xf6e2('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf6e2('0x4'));var cmContactRpc=require(_0xf6e2('0x5'));config[_0xf6e2('0x6')]=_[_0xf6e2('0x7')](config[_0xf6e2('0x6')],{'host':_0xf6e2('0x8'),'port':0x18eb});var io=require(_0xf6e2('0x9'))(new Redis(config['redis']));function emit(_0x580007,_0x450aab,_0x49ffdb,_0x8f6adc,_0x45f5d4){logger[_0xf6e2('0xa')](_0xf6e2('0xb'),_0x580007,_0x450aab['id'],_0x49ffdb,_0x8f6adc,JSON['stringify'](_0x45f5d4));io['to'](_0x49ffdb)[_0xf6e2('0xc')](_0x8f6adc,_0x45f5d4);}exports['exec']=function(_0x2778b4,_0x496c85,_0x3893a3,_0x23c61b){var _0x19de52,_0x3f1078;var _0x3e1de3={};var _0x4a8ff4=Number(_0x3893a3[_0xf6e2('0xd')]);var _0x50ad2d=_0x3893a3[_0xf6e2('0xe')]?Boolean(Number(_0x3893a3['data2'])):![];var _0x145d83;if(_0x23c61b[_0xf6e2('0xf')]){_0x3e1de3['id']=_0x23c61b[_0xf6e2('0xf')];}if(!_0x3e1de3['id']){_0x3e1de3[_0xf6e2('0x10')]=_0x4a8ff4;_0x145d83=_0x3893a3[_0xf6e2('0x11')]&&_0x3893a3[_0xf6e2('0x11')]!=='0'?_0x3893a3[_0xf6e2('0x11')][_0xf6e2('0x12')](','):[_0xf6e2('0x13')];_0x3e1de3[_0xf6e2('0x14')]=_['map'](_0x145d83,function(_0x314dc1){var _0x354eb6={};_0x354eb6[_0x314dc1]=_0x23c61b['routeId']?_0x23c61b[_0xf6e2('0x15')]:_0x23c61b[_0xf6e2('0x16')];return _0x354eb6;});}var _0x42cbd9=['id',_0xf6e2('0x17'),'lastName',_0xf6e2('0x13'),'mobile',_0xf6e2('0x18'),'ListId',_0xf6e2('0x19'),_0xf6e2('0x1a'),_0xf6e2('0x1b')];var _0x11ca63=_[_0xf6e2('0x1c')](_0x42cbd9,_0x145d83);BPromise['resolve']()[_0xf6e2('0x1d')](cmContactRpc['getContacts']({'attributes':_0x11ca63,'where':_0x3e1de3}))[_0xf6e2('0x1d')](function(_0x4315ff){_0x3f1078=_0x4315ff;if(!_['isEmpty'](_0x3f1078)){if(_0x3f1078[_0xf6e2('0x1e')]===0x1){_0x19de52=_0x3f1078[0x0];logger[_0xf6e2('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x23c61b[_0xf6e2('0x1f')],_0x496c85['id'],_0x19de52['id']);}else{logger[_0xf6e2('0xa')](_0xf6e2('0x20'),_0x23c61b['uniqueid'],_0x496c85['id'],_[_0xf6e2('0x21')](_0x3f1078,'id')[_0xf6e2('0x22')](','));}return;}else{logger[_0xf6e2('0xa')](_0xf6e2('0x23'),_0x23c61b[_0xf6e2('0x1f')],_0x496c85['id']);var _0x19844c={'ListId':_0x4a8ff4};var _0x211c31=_0x3893a3[_0xf6e2('0x24')]&&_0x3893a3[_0xf6e2('0x24')]!=='0'?_0x3893a3[_0xf6e2('0x24')]:'phone';if(_0x50ad2d){logger[_0xf6e2('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x23c61b[_0xf6e2('0x1f')],_0x496c85['id']);_0x19844c[_0x211c31]=_[_0xf6e2('0x25')](_0x23c61b[_0xf6e2('0x26')])?_0x23c61b[_0xf6e2('0x16')]:_0x23c61b[_0xf6e2('0x15')];if(_[_0xf6e2('0x25')](_0x23c61b[_0xf6e2('0x26')])){_0x19844c[_0xf6e2('0x17')]=_0x23c61b['calleridname']&&_0x23c61b['calleridname']!==''?_0x23c61b[_0xf6e2('0x27')]:'Unknown';}else{_0x19844c['firstName']=_0x23c61b[_0xf6e2('0x28')]&&_0x23c61b[_0xf6e2('0x28')]!==_0xf6e2('0x29')?_0x23c61b[_0xf6e2('0x28')]:'Unknown';}return BPromise[_0xf6e2('0x2a')]()[_0xf6e2('0x1d')](cmContactRpc['createContact'](_0x19844c))['then'](function(_0x59508a){_0x19de52=_0x59508a;_0x3f1078[_0xf6e2('0x2b')](_0x59508a);if(_0x19de52){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x23c61b[_0xf6e2('0x1f')],_0x496c85['id'],_0x19de52['id']);}return;});}else{logger['info'](_0xf6e2('0x2c'),_0x23c61b['uniqueid'],_0x496c85['id']);_0x19844c[_0x211c31]=_[_0xf6e2('0x25')](_0x23c61b[_0xf6e2('0x26')])?_0x23c61b[_0xf6e2('0x16')]:_0x23c61b[_0xf6e2('0x15')];if(_[_0xf6e2('0x25')](_0x23c61b['routeId'])){_0x19844c['firstName']=_0x23c61b[_0xf6e2('0x27')]&&_0x23c61b['calleridname']!==_0xf6e2('0x29')?_0x23c61b[_0xf6e2('0x27')]:'Unknown';}else{_0x19844c[_0xf6e2('0x17')]=_0x23c61b[_0xf6e2('0x28')]&&_0x23c61b['destcalleridname']!==_0xf6e2('0x29')?_0x23c61b[_0xf6e2('0x28')]:_0xf6e2('0x2d');}_0x19de52=_0x19844c;_0x3f1078['push'](_0x19844c);return;}}})['then'](function(){if(_0x2778b4){emit(_0x23c61b[_0xf6e2('0x1f')],_0x496c85,util[_0xf6e2('0x2e')](_0xf6e2('0x2f'),_0x2778b4[_0xf6e2('0x30')]),util['format'](_0xf6e2('0x31'),_0x3893a3['action'][_0xf6e2('0x32')]()),{'evt':_['merge'](_0x23c61b,{'autoCreate':_0x50ad2d}),'contact':_0x19de52===undefined?{}:_0x19de52,'contacts':_0x3f1078['length']===0x0?undefined:_0x3f1078});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b0d2694..08927df 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 _0x5ed9=['AllConditions','checkConditions','some','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','defaults','socket.io-emitter','redis','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','custom:agentringnoanswer','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','stringify','prototype','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','variables','Actions','length','toLowerCase','contactmanager','browser','popup','data2','render','html','uri','buildUri','isNil','location','uriLocation','windowWidth','data5','800','windowHeight','winApplication','winArguments','format','name','action','data1','merge','jscripty','trigger:%s','user:%s','exec','integration','routeId','script','parse','query','search','replace','channel','every'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0x5ed9,0x1e4));var _0x95ed=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5ed9[_0x122096];return _0x3d1966;};'use strict';var util=require('util');var _=require(_0x95ed('0x0'));var url=require(_0x95ed('0x1'));var Mustache=require(_0x95ed('0x2'));var Redis=require(_0x95ed('0x3'));var urlforward=require(_0x95ed('0x4'));var integration=require(_0x95ed('0x5'));var cmContact=require(_0x95ed('0x6'));var script=require(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var logger=require(_0x95ed('0x9'))(_0x95ed('0xa'));var ami=require('../ami');config['redis']=_[_0x95ed('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x95ed('0xc'))(new Redis(config[_0x95ed('0xd')]));var operators={'equals':function(_0x220a82,_0x156896){return _0x220a82==_0x156896;},'not_equals':function(_0x167a89,_0x2b4488){return _0x167a89!=_0x2b4488;}};var barAndWebActions=['popup',_0x95ed('0x1'),_0x95ed('0xe')];function Trigger(_0x5e01eb){this[_0x95ed('0xf')]=_0x5e01eb['triggers'];this['agents']=_0x5e01eb[_0x95ed('0x10')];this['voiceQueues']=_0x5e01eb[_0x95ed('0x11')];this[_0x95ed('0x12')]=_0x5e01eb[_0x95ed('0x12')];this[_0x95ed('0x13')]=_0x5e01eb[_0x95ed('0x13')];this[_0x95ed('0x14')]=_0x5e01eb[_0x95ed('0x14')];this[_0x95ed('0x15')]=_0x5e01eb[_0x95ed('0x15')];this[_0x95ed('0x16')]=_0x5e01eb['salesforceAccounts'];this[_0x95ed('0x17')]=_0x5e01eb[_0x95ed('0x17')];this[_0x95ed('0x18')]=_0x5e01eb[_0x95ed('0x18')];this['deskAccounts']=_0x5e01eb[_0x95ed('0x19')];this[_0x95ed('0x1a')]=_0x5e01eb[_0x95ed('0x1a')];this['servicenowAccounts']=_0x5e01eb['servicenowAccounts'];this[_0x95ed('0x1b')]=_0x5e01eb['dynamics365Accounts'];this[_0x95ed('0x1c')]=_0x5e01eb[_0x95ed('0x1c')];this[_0x95ed('0x1d')]={'zendesk':this[_0x95ed('0x14')],'salesforce':this[_0x95ed('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0x95ed('0x19')],'vtiger':this[_0x95ed('0x1a')],'dynamics365':this[_0x95ed('0x1b')],'freshsales':this[_0x95ed('0x1c')],'servicenow':this[_0x95ed('0x1e')]};ami['on'](_0x95ed('0x1f'),this[_0x95ed('0x20')]['bind'](this));ami['on']('custom:agentconnect',this[_0x95ed('0x20')]['bind'](this));ami['on'](_0x95ed('0x21'),this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x23'),this['syncCustomEvent'][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x24'),this['syncCustomEvent'][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x25'),this['syncCustomEvent'][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x26'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcongestion',this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on']('custom:agentreject',this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x27'),this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x28'),this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x29'),this['syncCustomEvent'][_0x95ed('0x22')](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on'](_0x95ed('0x2a'),this[_0x95ed('0x2b')]['bind'](this));ami['on'](_0x95ed('0x2c'),this['syncAgentDial'][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x2d'),this['syncCustomEvent'][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x2e'),this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x2f'),this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x30'),this['syncCustomEvent'][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x31'),this[_0x95ed('0x20')][_0x95ed('0x22')](this));ami['on'](_0x95ed('0x32'),this['syncCustomEvent']['bind'](this));}Trigger['prototype'][_0x95ed('0x33')]=function(_0x475e51,_0xd1b881,_0x884f06){logger['info'](_0x475e51,_0xd1b881,JSON[_0x95ed('0x34')](_0x884f06));io['to'](_0x475e51)[_0x95ed('0x33')](_0xd1b881,_0x884f06);};Trigger[_0x95ed('0x35')][_0x95ed('0x20')]=function(_0x5295b8){var _0x282f14=_[_0x95ed('0x36')](_0x5295b8);if(typeof _0x282f14[_0x95ed('0x37')]===_0x95ed('0x38')){_0x282f14[_0x95ed('0x37')]=_0x95ed('0x39');}this[_0x95ed('0x3a')](_0x282f14);};Trigger[_0x95ed('0x35')][_0x95ed('0x2b')]=function(_0x197c7b){if(this['agents'][_0x197c7b[_0x95ed('0x3b')]]){this[_0x95ed('0x20')](_0x197c7b);}};Trigger['prototype']['checkTriggers']=function(_0x3e5a34){var _0x24166a;for(var _0x377bdc in this['triggers']){if(this[_0x95ed('0xf')][_0x95ed('0x3c')](_0x377bdc)){if(this['triggers'][_0x377bdc]['status']){_0x24166a=this[_0x95ed('0x3d')](this['triggers'][_0x377bdc],_0x3e5a34);if(_0x24166a){_['merge'](_0x3e5a34,_0x3e5a34[_0x95ed('0x3e')]);for(var _0x1fe8bd=0x0,_0x2e4390,_0x72e3bb,_0x48d20f;_0x1fe8bd0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x2aa739,_0x4f9ff5){var _0x580208=function(_0x34ce92){while(--_0x34ce92){_0x2aa739['push'](_0x2aa739['shift']());}};_0x580208(++_0x4f9ff5);}(_0x3e74,0x175));var _0x43e7=function(_0x190233,_0x505054){_0x190233=_0x190233-0x0;var _0x3c4d37=_0x3e74[_0x190233];return _0x3c4d37;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 12c79a0..a36e972 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 _0xc5d7=['type','customField','idField','indexOf','content','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','Subjects','callDirection','queue','/systemusers(','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/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist'];(function(_0x4eb059,_0xb12edd){var _0xc03980=function(_0x1552b8){while(--_0x1552b8){_0x4eb059['push'](_0x4eb059['shift']());}};_0xc03980(++_0xb12edd);}(_0xc5d7,0x16b));var _0x7c5d=function(_0x5af95d,_0x35ac2e){_0x5af95d=_0x5af95d-0x0;var _0x171383=_0xc5d7[_0x5af95d];return _0x171383;};'use strict';var _=require(_0x7c5d('0x0'));var BPromise=require('bluebird');var rp=require(_0x7c5d('0x1'));var util=require(_0x7c5d('0x2'));var intUtil=require(_0x7c5d('0x3'));var md5=require(_0x7c5d('0x4'));var Redis=require(_0x7c5d('0x5'));var logger=require(_0x7c5d('0x6'))(_0x7c5d('0x7'));var config=require(_0x7c5d('0x8'));config[_0x7c5d('0x9')]=_['defaults'](config[_0x7c5d('0x9')],{'host':_0x7c5d('0xa'),'port':0x18eb});var io=require(_0x7c5d('0xb'))(new Redis(config[_0x7c5d('0x9')]));function getAuthToken(_0x22ff42,_0x769c7a,_0x2d691c){var _0x3296ec={'method':_0x7c5d('0xc'),'uri':_0x769c7a,'form':{'client_id':_0x22ff42[_0x7c5d('0xd')],'resource':_0x22ff42[_0x7c5d('0xe')],'username':_0x22ff42[_0x7c5d('0xf')],'password':_0x22ff42[_0x7c5d('0x10')],'grant_type':_0x7c5d('0x10'),'client_secret':_0x22ff42[_0x7c5d('0x11')]},'json':!![]};return rp(_0x3296ec)[_0x7c5d('0x12')](function(_0x23f793){return _0x23f793[_0x7c5d('0x13')];})[_0x7c5d('0x14')](function(_0x527c5d){logger[_0x7c5d('0x15')]('['+[_0x2d691c[_0x7c5d('0x16')]()]+_0x7c5d('0x17'));return _0x527c5d[_0x7c5d('0x18')];});}function getUser(_0x3ba6ba,_0x1d1d51,_0x542adb,_0x759325,_0x126be1,_0x3ea244){return new BPromise(function(_0x30947c,_0x34d3f4){return getAuthToken(_0x1d1d51,_0x759325,_0x3ea244)['then'](function(_0x28dfef){var _0x36e88a={'method':_0x7c5d('0x19'),'uri':_0x126be1+_0x7c5d('0x1a'),'headers':{'Authorization':_0x7c5d('0x1b')+_0x28dfef,'OData-Version':_0x7c5d('0x1c')},'json':!![]};return rp(_0x36e88a);})['then'](function(_0x2b8bf6){var _0x1e694b=_0x2b8bf6[_0x7c5d('0x1d')];var _0xe8c50=![];var _0x350ac9=null;if(!_[_0x7c5d('0x1e')](_0x542adb)){if(intUtil[_0x7c5d('0x1f')](_0x542adb['email'])){_0x3ba6ba[_0x7c5d('0x20')]=_0x542adb[_0x7c5d('0x21')];for(_0x350ac9=0x0;_0x350ac9<_0x1e694b['length'];_0x350ac9++){if(_0x1e694b[_0x350ac9][_0x7c5d('0x22')]===_0x542adb[_0x7c5d('0x21')]&&!_0x1e694b[_0x350ac9]['isdisabled']){_0xe8c50=!![];logger[_0x7c5d('0x23')]('['+[_0x3ea244[_0x7c5d('0x16')]()]+_0x7c5d('0x24')+_0x1e694b[_0x350ac9][_0x7c5d('0x25')]+'!');_0x3ba6ba[_0x7c5d('0x26')]=_0x1e694b[_0x350ac9][_0x7c5d('0x25')];}}}}if(!_0xe8c50){logger[_0x7c5d('0x23')]('['+[_0x3ea244[_0x7c5d('0x16')]()]+_0x7c5d('0x27'));_0x3ba6ba[_0x7c5d('0x20')]=_0x1d1d51[_0x7c5d('0xf')];for(_0x350ac9=0x0;_0x350ac9<_0x1e694b[_0x7c5d('0x28')];_0x350ac9++){if(_0x1e694b[_0x350ac9]['internalemailaddress']===_0x1d1d51[_0x7c5d('0xf')]){_0x3ba6ba[_0x7c5d('0x26')]=_0x1e694b[_0x350ac9]['systemuserid'];}}}_0x30947c(_0x3ba6ba);})[_0x7c5d('0x14')](function(_0x3f2639){_0x34d3f4(_0x3f2639[_0x7c5d('0x18')]);});});}function createEndUser(_0x2271ef,_0x192927,_0x4aab66,_0x444bfc,_0x289388,_0x38a45d){return new BPromise(function(_0x2da9d8,_0x5966fe){return getAuthToken(_0x192927,_0x4aab66,_0x38a45d)[_0x7c5d('0x12')](function(_0x160eda){var _0x11537a=_0x38a45d[_0x7c5d('0x29')]()===_0x7c5d('0x2a')?_0x289388['destcalleridnum']:_0x289388[_0x7c5d('0x2b')];var _0x5c3a9={'method':_0x7c5d('0xc'),'uri':_0x444bfc+_0x7c5d('0x2c'),'body':{'telephone1':_0x11537a,'fullname':_0x11537a,'firstname':_0x11537a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2271ef[_0x7c5d('0x26')]+')'},'headers':{'Authorization':_0x7c5d('0x1b')+_0x160eda,'OData-Version':_0x7c5d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5c3a9);})['then'](function(_0x14b031){var _0x7a6267=_0x14b031[_0x7c5d('0x2d')][_0x7c5d('0x2e')];var _0x1665f9=_0x7a6267[_0x7c5d('0x2f')](_0x7a6267['lastIndexOf']('(')+0x1,_0x7a6267[_0x7c5d('0x30')](')'));_0x2271ef[_0x7c5d('0x31')]=_0x1665f9;_0x2da9d8(_0x2271ef);})['catch'](function(_0x17a48e){_0x5966fe(_0x17a48e[_0x7c5d('0x18')]);});});}function getEndUser(_0x46bf9c,_0x2f084e,_0x1e0474,_0x120e67,_0x18c00c,_0x94f89b){return new BPromise(function(_0x1d440a,_0x3569f7){var _0xfacf55=_0x94f89b['toLowerCase']()===_0x7c5d('0x2a')?_0x18c00c[_0x7c5d('0x32')]:_0x18c00c['calleridnum'];return getAuthToken(_0x2f084e,_0x1e0474,_0x94f89b)[_0x7c5d('0x12')](function(_0x5e8ba9){var _0x1b0391={'method':'GET','uri':_0x120e67+_0x7c5d('0x33')+_0xfacf55[_0x7c5d('0x34')]('+',_0x7c5d('0x35'))+'\x27','headers':{'Authorization':_0x7c5d('0x1b')+_0x5e8ba9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b0391);})[_0x7c5d('0x12')](function(_0x1483ef){var _0x49eb85=null;if(_0x1483ef){var _0x496b34=_0x1483ef['value'];var _0x8854e6=![];for(_0x49eb85=0x0;_0x49eb85<_0x496b34[_0x7c5d('0x28')];_0x49eb85++){if(_0x496b34[_0x49eb85][_0x7c5d('0x36')]===_0xfacf55){_0x8854e6=!![];_0x46bf9c[_0x7c5d('0x31')]=_0x496b34[_0x49eb85][_0x7c5d('0x37')];}}if(_0x8854e6){_0x1d440a(_0x46bf9c);}else{return createEndUser(_0x46bf9c,_0x2f084e,_0x1e0474,_0x120e67,_0x18c00c,_0x94f89b)[_0x7c5d('0x12')](function(_0x1afe70){logger[_0x7c5d('0x23')]('['+[_0x94f89b[_0x7c5d('0x16')]()]+_0x7c5d('0x38'),_0x1afe70[_0x7c5d('0x31')]);_0x1d440a(_0x1afe70);});}}else{return createEndUser(_0x46bf9c,_0x2f084e,_0x1e0474,_0x120e67,_0x18c00c,_0x94f89b)[_0x7c5d('0x12')](function(_0x16e3c5){logger[_0x7c5d('0x23')]('['+[_0x94f89b[_0x7c5d('0x16')]()]+']\x20Enduser\x20Created!',_0x16e3c5[_0x7c5d('0x31')]);_0x1d440a(_0x16e3c5);});}});});}function getCustomFields(_0x20d7e3,_0x5795a4,_0x23e1d6){var _0x386c77={};if(_0x20d7e3[_0x7c5d('0x28')]>0x0){_[_0x7c5d('0x39')](_0x20d7e3,function(_0x3499b4){if(_[_0x7c5d('0x3a')]([_0x7c5d('0x3b'),_0x7c5d('0x3c')],_0x3499b4[_0x7c5d('0x3d')])&&_0x3499b4['nameField']&&!_0x3499b4[_0x7c5d('0x3e')]){var _0x124b38=_0x3499b4[_0x7c5d('0x3f')][_0x7c5d('0x29')]();var _0x43d9e3=_0x124b38['substring'](0x0,_0x124b38[_0x7c5d('0x40')]('_'));var _0x134cf1=_0x124b38[_0x7c5d('0x2f')](_0x124b38[_0x7c5d('0x40')]('_')+0x1);if(_0x43d9e3===_0x23e1d6){_0x386c77[_0x134cf1]=_0x3499b4[_0x7c5d('0x41')];}}});}return _0x386c77;}function getTicket(_0x23c70a,_0x3333fe,_0x22335d,_0x4cf701,_0x4d645b,_0x296dc4,_0x628bd2){return new BPromise(function(_0x4b0913,_0x2c83bb){var _0x41e06a;return getAuthToken(_0x3333fe,_0x22335d,_0x628bd2)[_0x7c5d('0x12')](function(_0x32bd47){if(_0x296dc4['ticketType']===_0x7c5d('0x42')){_0x41e06a={'method':'POST','uri':_0x4cf701+_0x7c5d('0x43'),'body':Object[_0x7c5d('0x44')]({},{'title':intUtil[_0x7c5d('0x45')](_0x296dc4['Subjects'],_0x4d645b,'\x20'),'description':intUtil[_0x7c5d('0x45')](_0x296dc4[_0x7c5d('0x46')],_0x4d645b,'\x0a'),'customerid_contact@odata.bind':_0x7c5d('0x47')+_0x23c70a[_0x7c5d('0x31')]+')','ownerid@odata.bind':'/systemusers('+_0x23c70a['userId']+')','caseorigincode':'1'},getCustomFields(_0x296dc4[_0x7c5d('0x48')],_0x4d645b,_0x296dc4[_0x7c5d('0x49')])),'headers':{'Authorization':_0x7c5d('0x1b')+_0x32bd47,'OData-Version':_0x7c5d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x296dc4[_0x7c5d('0x49')]===_0x7c5d('0x4a')){_0x41e06a={'method':'POST','uri':_0x4cf701+_0x7c5d('0x4b'),'body':Object[_0x7c5d('0x44')]({},{'subject':intUtil['getString'](_0x296dc4[_0x7c5d('0x4c')],_0x4d645b,'\x20'),'phonenumber':String(_0x4d645b[_0x7c5d('0x2b')]),'description':intUtil['getString'](_0x296dc4['Descriptions'],_0x4d645b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7c5d('0x47')+_0x23c70a['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x23c70a[_0x7c5d('0x26')]+')','directioncode':_0x23c70a[_0x7c5d('0x4d')]===_0x7c5d('0x4e')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x7c5d('0x4f')+_0x23c70a[_0x7c5d('0x26')]+')','participationtypemask':_0x23c70a[_0x7c5d('0x4d')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x7c5d('0x47')+_0x23c70a[_0x7c5d('0x31')]+')','participationtypemask':_0x23c70a['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x296dc4['Fields'],_0x4d645b,_0x296dc4[_0x7c5d('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0x32bd47,'OData-Version':_0x7c5d('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x41e06a);})['then'](function(_0x11d60b){var _0x4c2646=_0x11d60b['headers'][_0x7c5d('0x2e')];var _0x2f4c0e=_0x4c2646[_0x7c5d('0x2f')](_0x4c2646[_0x7c5d('0x30')]('(')+0x1,_0x4c2646[_0x7c5d('0x30')](')'));_0x23c70a[_0x7c5d('0x50')]=_0x2f4c0e;_0x4b0913(_0x23c70a);})[_0x7c5d('0x14')](function(_0x21ca47){_0x2c83bb(_0x21ca47[_0x7c5d('0x18')]);});});}function emit(_0x4f415e,_0x2efdc2,_0x38fe3f,_0x2ce764){var _0x30bba7={'uri':util[_0x7c5d('0x51')](_0x7c5d('0x52'),_0x4f415e,_0x38fe3f,_0x2ce764)};io['to'](util[_0x7c5d('0x51')](_0x7c5d('0x53'),_0x2efdc2))[_0x7c5d('0x54')](_0x7c5d('0x55'),_0x30bba7);}exports['cs']=function(_0x2273f6,_0x210808,_0x3ca26b,_0x1fc7ab,_0x4d4973,_0x5a5408,_0x191607,_0x945526){var _0x127b30={};_0x5a5408[_0x7c5d('0xe')]=intUtil[_0x7c5d('0x56')](_0x5a5408['remoteUri']);_0x5a5408[_0x7c5d('0x57')]=intUtil['stripTrailingSlash'](_0x5a5408[_0x7c5d('0x57')]);_0x127b30[_0x7c5d('0x4d')]=_0x945526==='queue'||_0x945526===_0x7c5d('0x58')?_0x7c5d('0x4e'):_0x7c5d('0x2a');var _0xbcb65=util['format'](_0x7c5d('0x59'),_0x5a5408['remoteUri']);var _0xee9e9b=util[_0x7c5d('0x51')](_0x7c5d('0x5a'),_0x5a5408[_0x7c5d('0x5b')]);var _0x36d516=util[_0x7c5d('0x51')](_0x7c5d('0x5c'),_0x5a5408[_0x7c5d('0x57')],_0x210808[_0x7c5d('0x5d')],md5(_0x210808[_0x7c5d('0x5d')]));if(_0x4d4973&&_0x4d4973['monitor_format']){logger[_0x7c5d('0x23')](_0x7c5d('0x5e'),_0x7c5d('0x5f'));_0x210808[_0x7c5d('0x60')]=_0x36d516;}else if(_0x191607&&_0x191607[_0x7c5d('0x61')]&&_0x191607[_0x7c5d('0x61')]!=='none'){logger[_0x7c5d('0x23')](_0x7c5d('0x62'),_0x7c5d('0x5f'));_0x210808['recordingURL']=_0x36d516;}else{_0x210808[_0x7c5d('0x60')]='';}return getUser(_0x127b30,_0x5a5408,_0x1fc7ab,_0xee9e9b,_0xbcb65,_0x945526)[_0x7c5d('0x12')](function(_0x95d8a4){logger[_0x7c5d('0x23')]('['+_0x945526[_0x7c5d('0x16')]()+_0x7c5d('0x63'),_0x95d8a4[_0x7c5d('0x26')]);logger[_0x7c5d('0x23')]('['+_0x945526[_0x7c5d('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x95d8a4[_0x7c5d('0x20')]);return getEndUser(_0x95d8a4,_0x5a5408,_0xee9e9b,_0xbcb65,_0x210808,_0x945526);})['then'](function(_0x15f3de){logger[_0x7c5d('0x23')]('['+_0x945526[_0x7c5d('0x16')]()+_0x7c5d('0x64'),_0x15f3de[_0x7c5d('0x31')]);logger[_0x7c5d('0x23')]('['+_0x945526[_0x7c5d('0x16')]()+_0x7c5d('0x65'),_0x210808['calleridnum']);return getTicket(_0x15f3de,_0x5a5408,_0xee9e9b,_0xbcb65,_0x210808,_0x3ca26b,_0x945526);})[_0x7c5d('0x12')](function(_0x484c18){logger['info'](util[_0x7c5d('0x51')]('['+_0x945526[_0x7c5d('0x16')]()+_0x7c5d('0x66'),_0x3ca26b[_0x7c5d('0x49')],_0x484c18[_0x7c5d('0x50')]));logger[_0x7c5d('0x23')](util[_0x7c5d('0x51')]('['+_0x945526[_0x7c5d('0x16')]()+']\x20Call\x20direction:\x20%s',_0x945526));if(_0x945526!==_0x7c5d('0x58')){logger[_0x7c5d('0x23')]('['+_0x945526['toUpperCase']()+']',_0x7c5d('0x67'));emit(_0x5a5408['remoteUri'],_0x1fc7ab['name'],_0x3ca26b['ticketType'],_0x484c18[_0x7c5d('0x50')]);}})['catch'](function(_0x3e5628){logger[_0x7c5d('0x15')]('['+_0x945526['toUpperCase']()+_0x7c5d('0x68'),util[_0x7c5d('0x69')](_0x3e5628,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb9a7=['telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','queue','callDirection','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','catch','toLowerCase','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','Bearer\x20'];(function(_0x259a38,_0x326eed){var _0x5ce448=function(_0x42977c){while(--_0x42977c){_0x259a38['push'](_0x259a38['shift']());}};_0x5ce448(++_0x326eed);}(_0xb9a7,0x172));var _0x7b9a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xb9a7[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x7b9a('0x0'));var BPromise=require('bluebird');var rp=require(_0x7b9a('0x1'));var util=require(_0x7b9a('0x2'));var intUtil=require(_0x7b9a('0x3'));var md5=require(_0x7b9a('0x4'));var Redis=require(_0x7b9a('0x5'));var logger=require(_0x7b9a('0x6'))(_0x7b9a('0x7'));var config=require(_0x7b9a('0x8'));config[_0x7b9a('0x9')]=_[_0x7b9a('0xa')](config[_0x7b9a('0x9')],{'host':_0x7b9a('0xb'),'port':0x18eb});var io=require(_0x7b9a('0xc'))(new Redis(config[_0x7b9a('0x9')]));function getAuthToken(_0x2bd0a6,_0x1f2c5e,_0x5a0e8b){var _0xaff1b7={'method':_0x7b9a('0xd'),'uri':_0x1f2c5e,'form':{'client_id':_0x2bd0a6[_0x7b9a('0xe')],'resource':_0x2bd0a6[_0x7b9a('0xf')],'username':_0x2bd0a6[_0x7b9a('0x10')],'password':_0x2bd0a6[_0x7b9a('0x11')],'grant_type':_0x7b9a('0x11'),'client_secret':_0x2bd0a6[_0x7b9a('0x12')]},'json':!![]};return rp(_0xaff1b7)[_0x7b9a('0x13')](function(_0x59e46f){return _0x59e46f[_0x7b9a('0x14')];})['catch'](function(_0x4cd6be){logger[_0x7b9a('0x15')]('['+[_0x5a0e8b[_0x7b9a('0x16')]()]+_0x7b9a('0x17'));return _0x4cd6be[_0x7b9a('0x18')];});}function getUser(_0x328d98,_0x447bf4,_0x172347,_0x186356,_0x4bf183,_0x4be1f9){return new BPromise(function(_0x53dec6,_0x3f596f){return getAuthToken(_0x447bf4,_0x186356,_0x4be1f9)[_0x7b9a('0x13')](function(_0x2ae8f7){var _0x346c94={'method':'GET','uri':_0x4bf183+_0x7b9a('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x2ae8f7,'OData-Version':_0x7b9a('0x1a')},'json':!![]};return rp(_0x346c94);})[_0x7b9a('0x13')](function(_0x1a09dd){var _0x51938e=_0x1a09dd[_0x7b9a('0x1b')];var _0x3c610d=![];var _0x52b8ea=null;if(!_['isNil'](_0x172347)){if(intUtil[_0x7b9a('0x1c')](_0x172347[_0x7b9a('0x1d')])){_0x328d98['userEmail']=_0x172347['email'];for(_0x52b8ea=0x0;_0x52b8ea<_0x51938e[_0x7b9a('0x1e')];_0x52b8ea++){if(_0x51938e[_0x52b8ea][_0x7b9a('0x1f')]===_0x172347[_0x7b9a('0x1d')]&&!_0x51938e[_0x52b8ea][_0x7b9a('0x20')]){_0x3c610d=!![];logger[_0x7b9a('0x21')]('['+[_0x4be1f9['toUpperCase']()]+_0x7b9a('0x22')+_0x51938e[_0x52b8ea]['systemuserid']+'!');_0x328d98[_0x7b9a('0x23')]=_0x51938e[_0x52b8ea][_0x7b9a('0x24')];}}}}if(!_0x3c610d){logger[_0x7b9a('0x21')]('['+[_0x4be1f9[_0x7b9a('0x16')]()]+_0x7b9a('0x25'));_0x328d98[_0x7b9a('0x26')]=_0x447bf4['username'];for(_0x52b8ea=0x0;_0x52b8ea<_0x51938e[_0x7b9a('0x1e')];_0x52b8ea++){if(_0x51938e[_0x52b8ea]['internalemailaddress']===_0x447bf4[_0x7b9a('0x10')]){_0x328d98[_0x7b9a('0x23')]=_0x51938e[_0x52b8ea][_0x7b9a('0x24')];}}}_0x53dec6(_0x328d98);})[_0x7b9a('0x27')](function(_0x434833){_0x3f596f(_0x434833[_0x7b9a('0x18')]);});});}function createEndUser(_0x15f7e0,_0x3c329f,_0x3f03a2,_0x457fee,_0x94f625,_0x365373){return new BPromise(function(_0x346eab,_0x2c92d5){return getAuthToken(_0x3c329f,_0x3f03a2,_0x365373)[_0x7b9a('0x13')](function(_0x6e37f){var _0x7d7235=_0x365373[_0x7b9a('0x28')]()===_0x7b9a('0x29')?_0x94f625['destcalleridnum']:_0x94f625[_0x7b9a('0x2a')];var _0x3a0f6e={'method':_0x7b9a('0xd'),'uri':_0x457fee+_0x7b9a('0x2b'),'body':{'telephone1':_0x7d7235,'fullname':_0x7d7235,'firstname':_0x7d7235,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7b9a('0x2c')+_0x15f7e0['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x6e37f,'OData-Version':_0x7b9a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3a0f6e);})[_0x7b9a('0x13')](function(_0x108140){var _0x4ac90b=_0x108140[_0x7b9a('0x2d')][_0x7b9a('0x2e')];var _0x29b3d6=_0x4ac90b[_0x7b9a('0x2f')](_0x4ac90b[_0x7b9a('0x30')]('(')+0x1,_0x4ac90b[_0x7b9a('0x30')](')'));_0x15f7e0[_0x7b9a('0x31')]=_0x29b3d6;_0x346eab(_0x15f7e0);})['catch'](function(_0x188424){_0x2c92d5(_0x188424[_0x7b9a('0x18')]);});});}function getEndUser(_0x1b7e54,_0x4cfcff,_0x20fd44,_0x5c48eb,_0x4b4c2a,_0x272472){return new BPromise(function(_0x3b9487,_0x24816b){var _0x3a5fbc=_0x272472[_0x7b9a('0x28')]()===_0x7b9a('0x29')?_0x4b4c2a[_0x7b9a('0x32')]:_0x4b4c2a['calleridnum'];return getAuthToken(_0x4cfcff,_0x20fd44,_0x272472)[_0x7b9a('0x13')](function(_0xce2cac){var _0x249846={'method':_0x7b9a('0x33'),'uri':_0x5c48eb+_0x7b9a('0x34')+_0x3a5fbc['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x7b9a('0x35')+_0xce2cac,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x249846);})[_0x7b9a('0x13')](function(_0x11cd70){var _0x20eb6c=null;if(_0x11cd70){var _0x5f6d69=_0x11cd70[_0x7b9a('0x1b')];var _0x257bab=![];for(_0x20eb6c=0x0;_0x20eb6c<_0x5f6d69[_0x7b9a('0x1e')];_0x20eb6c++){if(_0x5f6d69[_0x20eb6c][_0x7b9a('0x36')]===_0x3a5fbc){_0x257bab=!![];_0x1b7e54[_0x7b9a('0x31')]=_0x5f6d69[_0x20eb6c][_0x7b9a('0x37')];}}if(_0x257bab){_0x3b9487(_0x1b7e54);}else{return createEndUser(_0x1b7e54,_0x4cfcff,_0x20fd44,_0x5c48eb,_0x4b4c2a,_0x272472)[_0x7b9a('0x13')](function(_0x4ef84c){logger[_0x7b9a('0x21')]('['+[_0x272472[_0x7b9a('0x16')]()]+_0x7b9a('0x38'),_0x4ef84c['enduserId']);_0x3b9487(_0x4ef84c);});}}else{return createEndUser(_0x1b7e54,_0x4cfcff,_0x20fd44,_0x5c48eb,_0x4b4c2a,_0x272472)['then'](function(_0x143e7d){logger['info']('['+[_0x272472[_0x7b9a('0x16')]()]+_0x7b9a('0x39'),_0x143e7d['enduserId']);_0x3b9487(_0x143e7d);});}});});}function getCustomFields(_0x41be80,_0x1ba4c7,_0x3af7ea){var _0x32a099={};if(_0x41be80[_0x7b9a('0x1e')]>0x0){_[_0x7b9a('0x3a')](_0x41be80,function(_0x53cbf7){if(_[_0x7b9a('0x3b')]([_0x7b9a('0x3c'),_0x7b9a('0x3d')],_0x53cbf7[_0x7b9a('0x3e')])&&_0x53cbf7[_0x7b9a('0x3f')]&&!_0x53cbf7[_0x7b9a('0x40')]){var _0x1ed047=_0x53cbf7[_0x7b9a('0x41')][_0x7b9a('0x28')]();var _0x3428f8=_0x1ed047['substring'](0x0,_0x1ed047[_0x7b9a('0x42')]('_'));var _0x10cce8=_0x1ed047[_0x7b9a('0x2f')](_0x1ed047[_0x7b9a('0x42')]('_')+0x1);if(_0x3428f8===_0x3af7ea){_0x32a099[_0x10cce8]=_0x53cbf7[_0x7b9a('0x43')];}}});}return _0x32a099;}function getTicket(_0x29bd0f,_0x34046a,_0x4e8c0a,_0x2f5048,_0x445454,_0x4fe8df,_0x59e772){return new BPromise(function(_0x530fa1,_0x5f04fd){var _0x2b618d;return getAuthToken(_0x34046a,_0x4e8c0a,_0x59e772)[_0x7b9a('0x13')](function(_0x1f891c){if(_0x4fe8df[_0x7b9a('0x44')]===_0x7b9a('0x45')){_0x2b618d={'method':_0x7b9a('0xd'),'uri':_0x2f5048+_0x7b9a('0x46'),'body':Object[_0x7b9a('0x47')]({},{'title':intUtil[_0x7b9a('0x48')](_0x4fe8df[_0x7b9a('0x49')],_0x445454,'\x20'),'description':intUtil[_0x7b9a('0x48')](_0x4fe8df[_0x7b9a('0x4a')],_0x445454,'\x0a'),'customerid_contact@odata.bind':_0x7b9a('0x4b')+_0x29bd0f['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x29bd0f[_0x7b9a('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x4fe8df['Fields'],_0x445454,_0x4fe8df[_0x7b9a('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x1f891c,'OData-Version':_0x7b9a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4fe8df[_0x7b9a('0x44')]==='phonecall'){_0x2b618d={'method':_0x7b9a('0xd'),'uri':_0x2f5048+'phonecalls','body':Object[_0x7b9a('0x47')]({},{'subject':intUtil[_0x7b9a('0x48')](_0x4fe8df[_0x7b9a('0x49')],_0x445454,'\x20'),'phonenumber':String(_0x445454[_0x7b9a('0x2a')]),'description':intUtil[_0x7b9a('0x48')](_0x4fe8df[_0x7b9a('0x4a')],_0x445454,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7b9a('0x4b')+_0x29bd0f[_0x7b9a('0x31')]+')','ownerid@odata.bind':_0x7b9a('0x2c')+_0x29bd0f[_0x7b9a('0x23')]+')','directioncode':_0x29bd0f['callDirection']===_0x7b9a('0x4c')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x7b9a('0x2c')+_0x29bd0f[_0x7b9a('0x23')]+')','participationtypemask':_0x29bd0f[_0x7b9a('0x4d')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x29bd0f[_0x7b9a('0x31')]+')','participationtypemask':_0x29bd0f['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x4fe8df[_0x7b9a('0x4e')],_0x445454,_0x4fe8df[_0x7b9a('0x44')])),'headers':{'Authorization':_0x7b9a('0x35')+_0x1f891c,'OData-Version':_0x7b9a('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2b618d);})[_0x7b9a('0x13')](function(_0x2cc003){var _0x40ce3b=_0x2cc003[_0x7b9a('0x2d')][_0x7b9a('0x2e')];var _0x519a23=_0x40ce3b[_0x7b9a('0x2f')](_0x40ce3b[_0x7b9a('0x30')]('(')+0x1,_0x40ce3b[_0x7b9a('0x30')](')'));_0x29bd0f[_0x7b9a('0x4f')]=_0x519a23;_0x530fa1(_0x29bd0f);})['catch'](function(_0x3cb388){_0x5f04fd(_0x3cb388[_0x7b9a('0x18')]);});});}function emit(_0x1f62d1,_0x30b715,_0x37a974,_0x2f9ff8){var _0x86f429={'uri':util['format'](_0x7b9a('0x50'),_0x1f62d1,_0x37a974,_0x2f9ff8)};io['to'](util[_0x7b9a('0x51')](_0x7b9a('0x52'),_0x30b715))['emit'](_0x7b9a('0x53'),_0x86f429);}exports['cs']=function(_0x1a83aa,_0x52636d,_0x1c98c9,_0x51a078,_0x2d1db9,_0x36e1c3,_0x79d96d,_0xac612b){var _0x10628c={};_0x36e1c3[_0x7b9a('0xf')]=intUtil[_0x7b9a('0x54')](_0x36e1c3['remoteUri']);_0x36e1c3[_0x7b9a('0x55')]=intUtil['stripTrailingSlash'](_0x36e1c3[_0x7b9a('0x55')]);_0x10628c['callDirection']=_0xac612b===_0x7b9a('0x4c')||_0xac612b===_0x7b9a('0x56')?_0x7b9a('0x4c'):_0x7b9a('0x29');var _0x4b2e94=util[_0x7b9a('0x51')](_0x7b9a('0x57'),_0x36e1c3['remoteUri']);var _0x44ac3f=util[_0x7b9a('0x51')](_0x7b9a('0x58'),_0x36e1c3[_0x7b9a('0x59')]);var _0x4c635f=util['format'](_0x7b9a('0x5a'),_0x36e1c3[_0x7b9a('0x55')],_0x52636d[_0x7b9a('0x5b')],md5(_0x52636d[_0x7b9a('0x5b')]));if(_0x2d1db9&&_0x2d1db9[_0x7b9a('0x5c')]){logger['info'](_0x7b9a('0x5d'),'Recording\x20is\x20enabled!');_0x52636d[_0x7b9a('0x5e')]=_0x4c635f;}else if(_0x79d96d&&_0x79d96d['recordingFormat']&&_0x79d96d[_0x7b9a('0x5f')]!==_0x7b9a('0x60')){logger[_0x7b9a('0x21')](_0x7b9a('0x61'),'Recording\x20is\x20enabled!');_0x52636d[_0x7b9a('0x5e')]=_0x4c635f;}else{_0x52636d[_0x7b9a('0x5e')]='';}return getUser(_0x10628c,_0x36e1c3,_0x51a078,_0x44ac3f,_0x4b2e94,_0xac612b)['then'](function(_0x144655){logger[_0x7b9a('0x21')]('['+_0xac612b[_0x7b9a('0x16')]()+_0x7b9a('0x62'),_0x144655[_0x7b9a('0x23')]);logger[_0x7b9a('0x21')]('['+_0xac612b[_0x7b9a('0x16')]()+_0x7b9a('0x63'),_0x144655['userEmail']);return getEndUser(_0x144655,_0x36e1c3,_0x44ac3f,_0x4b2e94,_0x52636d,_0xac612b);})['then'](function(_0x1b1c56){logger[_0x7b9a('0x21')]('['+_0xac612b[_0x7b9a('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x1b1c56[_0x7b9a('0x31')]);logger[_0x7b9a('0x21')]('['+_0xac612b['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x52636d[_0x7b9a('0x2a')]);return getTicket(_0x1b1c56,_0x36e1c3,_0x44ac3f,_0x4b2e94,_0x52636d,_0x1c98c9,_0xac612b);})[_0x7b9a('0x13')](function(_0x18bc72){logger[_0x7b9a('0x21')](util['format']('['+_0xac612b[_0x7b9a('0x16')]()+_0x7b9a('0x64'),_0x1c98c9[_0x7b9a('0x44')],_0x18bc72[_0x7b9a('0x4f')]));logger[_0x7b9a('0x21')](util[_0x7b9a('0x51')]('['+_0xac612b['toUpperCase']()+_0x7b9a('0x65'),_0xac612b));if(_0xac612b!==_0x7b9a('0x56')){logger[_0x7b9a('0x21')]('['+_0xac612b[_0x7b9a('0x16')]()+']',_0x7b9a('0x66'));emit(_0x36e1c3[_0x7b9a('0xf')],_0x51a078[_0x7b9a('0x67')],_0x1c98c9[_0x7b9a('0x44')],_0x18bc72[_0x7b9a('0x4f')]);}})[_0x7b9a('0x27')](function(_0x119820){logger[_0x7b9a('0x15')]('['+_0xac612b['toUpperCase']()+_0x7b9a('0x68'),util[_0x7b9a('0x69')](_0x119820,{'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 b45b93a..891da83 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 _0x6ae0=['The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','destcalleridnum','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','Tags','name','Fields','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','push','idField','variable','variableName','Variable','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x6ae0,0x12b));var _0x06ae=function(_0x1d759d,_0x3f89fb){_0x1d759d=_0x1d759d-0x0;var _0x5a683d=_0x6ae0[_0x1d759d];return _0x5a683d;};'use strict';var _=require(_0x06ae('0x0'));var rp=require(_0x06ae('0x1'));var md5=require(_0x06ae('0x2'));var util=require(_0x06ae('0x3'));var Redis=require(_0x06ae('0x4'));var intUtil=require(_0x06ae('0x5'));var config=require(_0x06ae('0x6'));var logger=require(_0x06ae('0x7'))('freshdesk');config['redis']=_[_0x06ae('0x8')](config[_0x06ae('0x9')],{'host':_0x06ae('0xa'),'port':0x18eb});var io=require(_0x06ae('0xb'))(new Redis(config['redis']));var headers={'Content-Type':_0x06ae('0xc'),'Accept':_0x06ae('0xc')};function emit(_0x2590a6,_0x3820dc,_0x232362){io['to'](_0x2590a6)[_0x06ae('0xd')](_0x3820dc,_0x232362);}function getTicket(_0x5cc3da,_0x4fab54,_0x42bb82,_0x34d319,_0x53e9ff){logger[_0x06ae('0xe')]('Creating\x20new\x20ticket...');var _0xa69761=_[_0x06ae('0xf')]({'responder_id':_0x4fab54['id'],'requester_id':_0x42bb82['id'],'name':util[_0x06ae('0x10')](_0x06ae('0x11'),_0x53e9ff[_0x06ae('0x12')]),'phone':_0x53e9ff[_0x06ae('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x34d319[_0x06ae('0x14')],_0x53e9ff,'\x20'),'description':intUtil[_0x06ae('0x15')](_0x34d319[_0x06ae('0x16')],_0x53e9ff,'
'),'tags':getTags(_0x34d319[_0x06ae('0x17')],_0x06ae('0x18'))},getCustomFields(_0x34d319[_0x06ae('0x19')],_0x53e9ff));_0xa69761['custom_fields']=_['mapValues'](_[_0x06ae('0x1a')](_0xa69761[_0x06ae('0x1b')],'id'),'value');return request({'uri':util[_0x06ae('0x10')](_0x06ae('0x1c'),_0x5cc3da[_0x06ae('0x1d')]),'method':'POST','body':_0xa69761})['then'](function(_0x5aa53e){logger[_0x06ae('0xe')](_0x06ae('0x1e'));return _0x5aa53e;});}function getUser(_0x336225,_0x3043b4){if(intUtil[_0x06ae('0x1f')](_0x3043b4)){return request({'uri':util[_0x06ae('0x10')](_0x06ae('0x20'),_0x336225['remoteUri']),'qs':{'email':_0x3043b4}})[_0x06ae('0x21')](function(_0x2ccac3){if(_0x2ccac3[_0x06ae('0x22')]){logger[_0x06ae('0xe')]('Agent\x20found!');return _['find'](_0x2ccac3,function(_0x4eae60){return _0x4eae60[_0x06ae('0x23')][_0x06ae('0x24')]===_0x3043b4;});}else{logger[_0x06ae('0xe')](_0x06ae('0x25'));return request({'uri':util['format'](_0x06ae('0x26'),_0x336225['remoteUri'])})[_0x06ae('0x21')](function(_0x237737){logger[_0x06ae('0xe')](_0x06ae('0x27'));return _0x237737;});}});}else{logger[_0x06ae('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x06ae('0x10')]('%s/api/v2/agents/me',_0x336225[_0x06ae('0x1d')])})['then'](function(_0x3bbfc2){logger['info'](_0x06ae('0x27'));return _0x3bbfc2;});}}function getEndUser(_0x170be9,_0x305287,_0x54baab){logger[_0x06ae('0xe')](_0x06ae('0x28'),_0x54baab);return request({'uri':util[_0x06ae('0x10')](_0x06ae('0x29'),_0x170be9[_0x06ae('0x1d')]),'qs':{'phone':_0x54baab}})['then'](function(_0x7c2494){if(_0x7c2494[_0x06ae('0x22')]){logger['info'](_0x06ae('0x2a'));return _[_0x06ae('0x2b')](_0x7c2494,{'phone':_0x54baab});}else{logger[_0x06ae('0xe')](_0x06ae('0x2c'));return request({'uri':util[_0x06ae('0x10')](_0x06ae('0x29'),_0x170be9['remoteUri']),'method':_0x06ae('0x2d'),'body':{'name':_0x305287,'phone':_0x54baab}})[_0x06ae('0x21')](function(_0x57b1c8){logger[_0x06ae('0xe')](_0x06ae('0x2e'));return _0x57b1c8;});}});}function getAuth(_0x18fd7c){return util[_0x06ae('0x10')](_0x06ae('0x2f'),new Buffer(_0x18fd7c['apiKey']+':X')[_0x06ae('0x30')](_0x06ae('0x31')));}function request(_0x3d1acd){logger['debug'](_0x06ae('0x32'),JSON[_0x06ae('0x33')](_0x3d1acd));return rp(_['defaults'](_0x3d1acd,{'method':_0x06ae('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x42c669,_0xd87016){var _0x48afca=[];if(_0x42c669&&_0x42c669[_0x06ae('0x22')]>0x0){_0x48afca=_[_0x06ae('0x35')](_0x42c669,_0xd87016);}return _0x48afca;}function getCustomFields(_0x3b0e82,_0x4b41f6){var _0x2e769f=[];var _0x597a8e={'custom_fields':[]};if(_0x3b0e82['length']>0x0){_[_0x06ae('0x36')](_0x3b0e82,function(_0x33292c){if(_[_0x06ae('0x37')]([_0x06ae('0x38'),'picklist'],_0x33292c[_0x06ae('0x39')])&&_0x33292c[_0x06ae('0x3a')]&&!_0x33292c[_0x06ae('0x3b')]){_0x597a8e[_0x33292c[_0x06ae('0x3a')][_0x06ae('0x3c')]()]=_0x33292c[_0x06ae('0x3d')][_0x06ae('0x30')]();}else if(_[_0x06ae('0x37')]([_0x06ae('0x38'),'picklist'],_0x33292c[_0x06ae('0x39')])&&_0x33292c['idField']&&_0x33292c[_0x06ae('0x3b')]){_0x597a8e[_0x06ae('0x1b')][_0x06ae('0x3e')]({'id':_0x33292c[_0x06ae('0x3f')],'value':_0x33292c[_0x06ae('0x3d')]['toString']()});}else if(_0x33292c[_0x06ae('0x39')]===_0x06ae('0x40')&&_0x33292c[_0x06ae('0x41')]&&_0x33292c[_0x06ae('0x3f')]&&_0x33292c[_0x06ae('0x3b')]){_0x4b41f6[_0x33292c['variableName']]&&_0x597a8e['custom_fields'][_0x06ae('0x3e')]({'id':_0x33292c[_0x06ae('0x3f')],'value':_0x4b41f6[_0x33292c[_0x06ae('0x41')]][_0x06ae('0x30')]()});}else if(_0x33292c[_0x06ae('0x39')]==='customVariable'&&_0x33292c['Variable']&&_0x33292c['Variable'][_0x06ae('0x18')]&&_0x33292c[_0x06ae('0x3f')]&&_0x33292c[_0x06ae('0x3b')]){_0x4b41f6[_0x33292c[_0x06ae('0x42')][_0x06ae('0x18')][_0x06ae('0x3c')]()]&&_0x597a8e[_0x06ae('0x1b')][_0x06ae('0x3e')]({'id':_0x33292c[_0x06ae('0x3f')],'value':_0x4b41f6[_0x33292c[_0x06ae('0x42')]['name'][_0x06ae('0x3c')]()][_0x06ae('0x30')]()});}});}return _0x597a8e;}exports[_0x06ae('0x43')]=function(_0x2b44c7,_0x1d7dd4,_0x41dc26,_0x43f0bb,_0x5a6c41,_0x5b90f0){var _0x51f941,_0x1730ca;_0x5b90f0[_0x06ae('0x1d')]=intUtil['stripTrailingSlash'](_0x5b90f0[_0x06ae('0x1d')]);_0x5b90f0[_0x06ae('0x44')]=intUtil['stripTrailingSlash'](_0x5b90f0[_0x06ae('0x44')]);if(_0x5a6c41&&_0x5a6c41[_0x06ae('0x45')]){logger[_0x06ae('0xe')]('[QUEUE]',_0x06ae('0x46'));_0x1d7dd4[_0x06ae('0x47')]=util[_0x06ae('0x10')](_0x06ae('0x48'),_0x5b90f0[_0x06ae('0x44')],_0x1d7dd4[_0x06ae('0x49')],md5(_0x1d7dd4[_0x06ae('0x49')]));}else{_0x1d7dd4[_0x06ae('0x47')]='';}headers[_0x06ae('0x4a')]=getAuth(_0x5b90f0);return getUser(_0x5b90f0,_0x43f0bb[_0x06ae('0x24')])[_0x06ae('0x21')](function(_0x46f790){_0x51f941=_0x46f790;logger[_0x06ae('0xe')](_0x06ae('0x4b'),_0x51f941['id']);return getEndUser(_0x5b90f0,_0x1d7dd4['calleridname'],_0x1d7dd4[_0x06ae('0x13')]);})['then'](function(_0x4b3d94){_0x1730ca=_0x4b3d94;logger[_0x06ae('0xe')](_0x06ae('0x4c'),_0x1730ca['id']);return getTicket(_0x5b90f0,_0x51f941,_0x1730ca,_0x41dc26,_0x1d7dd4);})['then'](function(_0x1fa4a1){if(_0x1fa4a1&&_0x1fa4a1['id']){logger[_0x06ae('0xe')]('Ticket\x20created!');logger[_0x06ae('0xe')](_0x06ae('0x4d'),_0x1fa4a1['id']);logger[_0x06ae('0xe')]('[QUEUE]',_0x06ae('0x4e'));emit(util[_0x06ae('0x10')](_0x06ae('0x4f'),_0x43f0bb[_0x06ae('0x18')]),_0x06ae('0x50'),{'uri':util['format'](_0x06ae('0x51'),_0x5b90f0[_0x06ae('0x1d')],_0x1fa4a1['id'])});}})[_0x06ae('0x52')](function(_0x3159c6){logger[_0x06ae('0x53')](_0x06ae('0x54'),JSON['stringify'](_0x3159c6));});};exports[_0x06ae('0x55')]=function(_0x5b6da5,_0x16c5a6,_0x232ba2,_0x4f0102,_0x33b755,_0xe4724,_0x509b70){var _0x466beb,_0x7a9c6e;_0xe4724[_0x06ae('0x1d')]=intUtil[_0x06ae('0x56')](_0xe4724['remoteUri']);_0xe4724[_0x06ae('0x44')]=intUtil[_0x06ae('0x56')](_0xe4724[_0x06ae('0x44')]);if(_0x509b70&&_0x509b70[_0x06ae('0x57')]&&_0x509b70[_0x06ae('0x57')]!==_0x06ae('0x58')){logger[_0x06ae('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x16c5a6[_0x06ae('0x47')]=util[_0x06ae('0x10')](_0x06ae('0x48'),_0xe4724[_0x06ae('0x44')],_0x16c5a6[_0x06ae('0x49')],md5(_0x16c5a6[_0x06ae('0x49')]));}headers[_0x06ae('0x4a')]=getAuth(_0xe4724);return getUser(_0xe4724,_0x4f0102[_0x06ae('0x24')])[_0x06ae('0x21')](function(_0x5f2164){_0x466beb=_0x5f2164;logger[_0x06ae('0xe')](_0x06ae('0x4b'),_0x466beb['id']);return getEndUser(_0xe4724,_0x16c5a6['destcalleridname'],_0x16c5a6[_0x06ae('0x59')]);})['then'](function(_0x19ac8f){_0x7a9c6e=_0x19ac8f;logger[_0x06ae('0xe')](_0x06ae('0x4c'),_0x7a9c6e['id']);return getTicket(_0xe4724,_0x466beb,_0x7a9c6e,_0x232ba2,_0x16c5a6);})[_0x06ae('0x21')](function(_0x399ec9){if(_0x399ec9&&_0x399ec9['id']){logger[_0x06ae('0xe')](_0x06ae('0x1e'));logger[_0x06ae('0xe')](_0x06ae('0x4d'),_0x399ec9['id']);logger['info'](_0x06ae('0x5a'),_0x06ae('0x4e'));emit(util[_0x06ae('0x10')](_0x06ae('0x4f'),_0x4f0102[_0x06ae('0x18')]),_0x06ae('0x50'),{'uri':util[_0x06ae('0x10')](_0x06ae('0x51'),_0xe4724[_0x06ae('0x1d')],_0x399ec9['id'])});}})[_0x06ae('0x52')](function(_0x203ef6){logger[_0x06ae('0x53')](_0x06ae('0x5a'),JSON[_0x06ae('0x33')](_0x203ef6));});};exports[_0x06ae('0x5b')]=function(_0x5259f7,_0x12cc2a,_0x253706,_0x4c5ddc,_0x10a9b3,_0x3ce203){var _0x5e38,_0xd26ce3;_0x3ce203[_0x06ae('0x1d')]=intUtil[_0x06ae('0x56')](_0x3ce203[_0x06ae('0x1d')]);_0x3ce203[_0x06ae('0x44')]=intUtil[_0x06ae('0x56')](_0x3ce203[_0x06ae('0x44')]);if(_0x10a9b3&&_0x10a9b3[_0x06ae('0x45')]){logger[_0x06ae('0xe')]('['+_0x12cc2a[_0x06ae('0x5c')][_0x06ae('0x5d')]()+']',_0x06ae('0x46'));_0x12cc2a[_0x06ae('0x47')]=util[_0x06ae('0x10')](_0x06ae('0x48'),_0x3ce203[_0x06ae('0x44')],_0x12cc2a[_0x06ae('0x49')],md5(_0x12cc2a[_0x06ae('0x49')]));}else{_0x12cc2a['recordingURL']='';}headers[_0x06ae('0x4a')]=getAuth(_0x3ce203);return getUser(_0x3ce203,'')[_0x06ae('0x21')](function(_0x4fb737){_0x5e38=_0x4fb737;logger[_0x06ae('0xe')]('The\x20User\x20ID\x20is:',_0x5e38['id']);return getEndUser(_0x3ce203,_0x12cc2a[_0x06ae('0x12')],_0x12cc2a['calleridnum']);})[_0x06ae('0x21')](function(_0x535ef8){_0xd26ce3=_0x535ef8;logger[_0x06ae('0xe')](_0x06ae('0x4c'),_0xd26ce3['id']);return getTicket(_0x3ce203,_0x5e38,_0xd26ce3,_0x253706,_0x12cc2a);})[_0x06ae('0x21')](function(_0x256a26){if(_0x256a26){logger[_0x06ae('0xe')](_0x06ae('0x1e'));logger[_0x06ae('0xe')](_0x06ae('0x4d'),_0x256a26['id']);}})[_0x06ae('0x52')](function(_0x421b8d){logger[_0x06ae('0x53')]('['+_0x12cc2a[_0x06ae('0x5c')]['toUpperCase']()+']',JSON[_0x06ae('0x33')](_0x421b8d));});}; \ No newline at end of file +var _0xf9a4=['Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','toString','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','../../../../config/environment','../../../../config/logger','redis','defaults','application/json','emit','info','Creating\x20new\x20ticket...','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','then','%s/api/v2/agents','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x293cde,_0x2ea879){var _0x40e2cd=function(_0x19c582){while(--_0x19c582){_0x293cde['push'](_0x293cde['shift']());}};_0x40e2cd(++_0x2ea879);}(_0xf9a4,0xe8));var _0x4f9a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf9a4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4f9a('0x0'));var rp=require(_0x4f9a('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4f9a('0x2'));var logger=require(_0x4f9a('0x3'))('freshdesk');config[_0x4f9a('0x4')]=_[_0x4f9a('0x5')](config[_0x4f9a('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f9a('0x4')]));var headers={'Content-Type':_0x4f9a('0x6'),'Accept':'application/json'};function emit(_0x99bce8,_0xc4f1d9,_0x542d25){io['to'](_0x99bce8)[_0x4f9a('0x7')](_0xc4f1d9,_0x542d25);}function getTicket(_0xe1db67,_0x369603,_0x32e586,_0x5ed153,_0x34afc0){logger[_0x4f9a('0x8')](_0x4f9a('0x9'));var _0x577e15=_['merge']({'responder_id':_0x369603['id'],'requester_id':_0x32e586['id'],'name':util[_0x4f9a('0xa')]('Caller\x20-\x20%s',_0x34afc0[_0x4f9a('0xb')]),'phone':_0x34afc0[_0x4f9a('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4f9a('0xd')](_0x5ed153[_0x4f9a('0xe')],_0x34afc0,'\x20'),'description':intUtil[_0x4f9a('0xd')](_0x5ed153[_0x4f9a('0xf')],_0x34afc0,_0x4f9a('0x10')),'tags':getTags(_0x5ed153[_0x4f9a('0x11')],_0x4f9a('0x12'))},getCustomFields(_0x5ed153[_0x4f9a('0x13')],_0x34afc0));_0x577e15['custom_fields']=_['mapValues'](_[_0x4f9a('0x14')](_0x577e15[_0x4f9a('0x15')],'id'),_0x4f9a('0x16'));return request({'uri':util['format'](_0x4f9a('0x17'),_0xe1db67[_0x4f9a('0x18')]),'method':'POST','body':_0x577e15})[_0x4f9a('0x19')](function(_0x623501){logger['info']('Ticket\x20created!');return _0x623501;});}function getUser(_0x316f65,_0x2b2406){if(intUtil['validateEmail'](_0x2b2406)){return request({'uri':util[_0x4f9a('0xa')](_0x4f9a('0x1a'),_0x316f65[_0x4f9a('0x18')]),'qs':{'email':_0x2b2406}})[_0x4f9a('0x19')](function(_0x39fcd7){if(_0x39fcd7['length']){logger[_0x4f9a('0x8')](_0x4f9a('0x1b'));return _[_0x4f9a('0x1c')](_0x39fcd7,function(_0x1d4ee9){return _0x1d4ee9['contact'][_0x4f9a('0x1d')]===_0x2b2406;});}else{logger[_0x4f9a('0x8')](_0x4f9a('0x1e'));return request({'uri':util[_0x4f9a('0xa')](_0x4f9a('0x1f'),_0x316f65['remoteUri'])})[_0x4f9a('0x19')](function(_0x667ee1){logger['info'](_0x4f9a('0x20'));return _0x667ee1;});}});}else{logger[_0x4f9a('0x8')](_0x4f9a('0x21'));return request({'uri':util[_0x4f9a('0xa')]('%s/api/v2/agents/me',_0x316f65['remoteUri'])})[_0x4f9a('0x19')](function(_0x18e584){logger[_0x4f9a('0x8')](_0x4f9a('0x20'));return _0x18e584;});}}function getEndUser(_0x4f9d5f,_0x59f71c,_0x344791){logger[_0x4f9a('0x8')](_0x4f9a('0x22'),_0x344791);return request({'uri':util[_0x4f9a('0xa')](_0x4f9a('0x23'),_0x4f9d5f[_0x4f9a('0x18')]),'qs':{'phone':_0x344791}})[_0x4f9a('0x19')](function(_0x5c8e83){if(_0x5c8e83['length']){logger['info'](_0x4f9a('0x24'));return _[_0x4f9a('0x1c')](_0x5c8e83,{'phone':_0x344791});}else{logger[_0x4f9a('0x8')](_0x4f9a('0x25'));return request({'uri':util['format'](_0x4f9a('0x23'),_0x4f9d5f[_0x4f9a('0x18')]),'method':'POST','body':{'name':_0x59f71c,'phone':_0x344791}})[_0x4f9a('0x19')](function(_0x279628){logger[_0x4f9a('0x8')](_0x4f9a('0x26'));return _0x279628;});}});}function getAuth(_0x3712dc){return util[_0x4f9a('0xa')](_0x4f9a('0x27'),new Buffer(_0x3712dc[_0x4f9a('0x28')]+':X')['toString'](_0x4f9a('0x29')));}function request(_0x466c37){logger[_0x4f9a('0x2a')](_0x4f9a('0x2b'),JSON['stringify'](_0x466c37));return rp(_[_0x4f9a('0x5')](_0x466c37,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2e1af2,_0xd2aeb4){var _0x3e6ea3=[];if(_0x2e1af2&&_0x2e1af2[_0x4f9a('0x2c')]>0x0){_0x3e6ea3=_[_0x4f9a('0x2d')](_0x2e1af2,_0xd2aeb4);}return _0x3e6ea3;}function getCustomFields(_0x4325fa,_0x4c1624){var _0x38a466=[];var _0x353d36={'custom_fields':[]};if(_0x4325fa['length']>0x0){_[_0x4f9a('0x2e')](_0x4325fa,function(_0x5ed800){if(_[_0x4f9a('0x2f')]([_0x4f9a('0x30'),_0x4f9a('0x31')],_0x5ed800[_0x4f9a('0x32')])&&_0x5ed800[_0x4f9a('0x33')]&&!_0x5ed800[_0x4f9a('0x34')]){_0x353d36[_0x5ed800['nameField'][_0x4f9a('0x35')]()]=_0x5ed800[_0x4f9a('0x36')]['toString']();}else if(_[_0x4f9a('0x2f')]([_0x4f9a('0x30'),_0x4f9a('0x31')],_0x5ed800[_0x4f9a('0x32')])&&_0x5ed800[_0x4f9a('0x37')]&&_0x5ed800[_0x4f9a('0x34')]){_0x353d36[_0x4f9a('0x15')][_0x4f9a('0x38')]({'id':_0x5ed800[_0x4f9a('0x37')],'value':_0x5ed800[_0x4f9a('0x36')][_0x4f9a('0x39')]()});}else if(_0x5ed800[_0x4f9a('0x32')]===_0x4f9a('0x3a')&&_0x5ed800[_0x4f9a('0x3b')]&&_0x5ed800['idField']&&_0x5ed800[_0x4f9a('0x34')]){_0x4c1624[_0x5ed800[_0x4f9a('0x3b')]]&&_0x353d36['custom_fields'][_0x4f9a('0x38')]({'id':_0x5ed800[_0x4f9a('0x37')],'value':_0x4c1624[_0x5ed800[_0x4f9a('0x3b')]][_0x4f9a('0x39')]()});}else if(_0x5ed800[_0x4f9a('0x32')]==='customVariable'&&_0x5ed800[_0x4f9a('0x3c')]&&_0x5ed800[_0x4f9a('0x3c')]['name']&&_0x5ed800[_0x4f9a('0x37')]&&_0x5ed800['customField']){_0x4c1624[_0x5ed800[_0x4f9a('0x3c')][_0x4f9a('0x12')][_0x4f9a('0x35')]()]&&_0x353d36[_0x4f9a('0x15')][_0x4f9a('0x38')]({'id':_0x5ed800[_0x4f9a('0x37')],'value':_0x4c1624[_0x5ed800['Variable'][_0x4f9a('0x12')][_0x4f9a('0x35')]()]['toString']()});}});}return _0x353d36;}exports[_0x4f9a('0x3d')]=function(_0x2d26ae,_0x379ddf,_0x359cc4,_0x1a0950,_0x54de1c,_0x4ad0ac){var _0x52fe9c,_0x1936da;_0x4ad0ac[_0x4f9a('0x18')]=intUtil[_0x4f9a('0x3e')](_0x4ad0ac[_0x4f9a('0x18')]);_0x4ad0ac['serverUrl']=intUtil[_0x4f9a('0x3e')](_0x4ad0ac[_0x4f9a('0x3f')]);if(_0x54de1c&&_0x54de1c[_0x4f9a('0x40')]){logger[_0x4f9a('0x8')](_0x4f9a('0x41'),'Recording\x20is\x20enabled!');_0x379ddf[_0x4f9a('0x42')]=util[_0x4f9a('0xa')](_0x4f9a('0x43'),_0x4ad0ac[_0x4f9a('0x3f')],_0x379ddf[_0x4f9a('0x44')],md5(_0x379ddf['uniqueid']));}else{_0x379ddf[_0x4f9a('0x42')]='';}headers[_0x4f9a('0x45')]=getAuth(_0x4ad0ac);return getUser(_0x4ad0ac,_0x1a0950[_0x4f9a('0x1d')])[_0x4f9a('0x19')](function(_0x81aff1){_0x52fe9c=_0x81aff1;logger['info'](_0x4f9a('0x46'),_0x52fe9c['id']);return getEndUser(_0x4ad0ac,_0x379ddf[_0x4f9a('0xb')],_0x379ddf[_0x4f9a('0xc')]);})[_0x4f9a('0x19')](function(_0x50a665){_0x1936da=_0x50a665;logger['info'](_0x4f9a('0x47'),_0x1936da['id']);return getTicket(_0x4ad0ac,_0x52fe9c,_0x1936da,_0x359cc4,_0x379ddf);})['then'](function(_0xbdfdb5){if(_0xbdfdb5&&_0xbdfdb5['id']){logger[_0x4f9a('0x8')](_0x4f9a('0x48'));logger[_0x4f9a('0x8')](_0x4f9a('0x49'),_0xbdfdb5['id']);logger['info'](_0x4f9a('0x41'),_0x4f9a('0x4a'));emit(util[_0x4f9a('0xa')](_0x4f9a('0x4b'),_0x1a0950['name']),'trigger:browser:url',{'uri':util[_0x4f9a('0xa')](_0x4f9a('0x4c'),_0x4ad0ac[_0x4f9a('0x18')],_0xbdfdb5['id'])});}})[_0x4f9a('0x4d')](function(_0x3b3e7a){logger[_0x4f9a('0x4e')](_0x4f9a('0x41'),JSON[_0x4f9a('0x4f')](_0x3b3e7a));});};exports[_0x4f9a('0x50')]=function(_0x5057eb,_0x54382a,_0x3fba6e,_0x18acac,_0x57825d,_0x10ec6d,_0x5a3ce1){var _0x2a34d3,_0x1a0215;_0x10ec6d[_0x4f9a('0x18')]=intUtil[_0x4f9a('0x3e')](_0x10ec6d[_0x4f9a('0x18')]);_0x10ec6d[_0x4f9a('0x3f')]=intUtil[_0x4f9a('0x3e')](_0x10ec6d[_0x4f9a('0x3f')]);if(_0x5a3ce1&&_0x5a3ce1[_0x4f9a('0x51')]&&_0x5a3ce1[_0x4f9a('0x51')]!==_0x4f9a('0x52')){logger[_0x4f9a('0x8')](_0x4f9a('0x53'),_0x4f9a('0x54'));_0x54382a['recordingURL']=util[_0x4f9a('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10ec6d[_0x4f9a('0x3f')],_0x54382a[_0x4f9a('0x44')],md5(_0x54382a['uniqueid']));}headers[_0x4f9a('0x45')]=getAuth(_0x10ec6d);return getUser(_0x10ec6d,_0x18acac[_0x4f9a('0x1d')])[_0x4f9a('0x19')](function(_0x56b1ad){_0x2a34d3=_0x56b1ad;logger[_0x4f9a('0x8')](_0x4f9a('0x46'),_0x2a34d3['id']);return getEndUser(_0x10ec6d,_0x54382a['destcalleridname'],_0x54382a[_0x4f9a('0x55')]);})[_0x4f9a('0x19')](function(_0x2acc8f){_0x1a0215=_0x2acc8f;logger[_0x4f9a('0x8')](_0x4f9a('0x47'),_0x1a0215['id']);return getTicket(_0x10ec6d,_0x2a34d3,_0x1a0215,_0x3fba6e,_0x54382a);})[_0x4f9a('0x19')](function(_0x1e44e9){if(_0x1e44e9&&_0x1e44e9['id']){logger[_0x4f9a('0x8')]('Ticket\x20created!');logger[_0x4f9a('0x8')](_0x4f9a('0x49'),_0x1e44e9['id']);logger[_0x4f9a('0x8')](_0x4f9a('0x53'),_0x4f9a('0x4a'));emit(util[_0x4f9a('0xa')]('user:%s',_0x18acac['name']),_0x4f9a('0x56'),{'uri':util[_0x4f9a('0xa')](_0x4f9a('0x4c'),_0x10ec6d[_0x4f9a('0x18')],_0x1e44e9['id'])});}})[_0x4f9a('0x4d')](function(_0x36dbff){logger[_0x4f9a('0x4e')](_0x4f9a('0x53'),JSON[_0x4f9a('0x4f')](_0x36dbff));});};exports[_0x4f9a('0x57')]=function(_0x289bb9,_0x364680,_0xd66424,_0x1025d5,_0x9a13d8,_0x1ddd52){var _0x4b9398,_0x1dada9;_0x1ddd52[_0x4f9a('0x18')]=intUtil['stripTrailingSlash'](_0x1ddd52[_0x4f9a('0x18')]);_0x1ddd52[_0x4f9a('0x3f')]=intUtil['stripTrailingSlash'](_0x1ddd52['serverUrl']);if(_0x9a13d8&&_0x9a13d8[_0x4f9a('0x40')]){logger[_0x4f9a('0x8')]('['+_0x364680[_0x4f9a('0x58')][_0x4f9a('0x59')]()+']',_0x4f9a('0x54'));_0x364680[_0x4f9a('0x42')]=util[_0x4f9a('0xa')](_0x4f9a('0x43'),_0x1ddd52[_0x4f9a('0x3f')],_0x364680[_0x4f9a('0x44')],md5(_0x364680[_0x4f9a('0x44')]));}else{_0x364680[_0x4f9a('0x42')]='';}headers[_0x4f9a('0x45')]=getAuth(_0x1ddd52);return getUser(_0x1ddd52,'')[_0x4f9a('0x19')](function(_0x5bfab2){_0x4b9398=_0x5bfab2;logger[_0x4f9a('0x8')](_0x4f9a('0x46'),_0x4b9398['id']);return getEndUser(_0x1ddd52,_0x364680[_0x4f9a('0xb')],_0x364680[_0x4f9a('0xc')]);})[_0x4f9a('0x19')](function(_0x20aca1){_0x1dada9=_0x20aca1;logger[_0x4f9a('0x8')](_0x4f9a('0x47'),_0x1dada9['id']);return getTicket(_0x1ddd52,_0x4b9398,_0x1dada9,_0xd66424,_0x364680);})['then'](function(_0x2754bb){if(_0x2754bb){logger['info'](_0x4f9a('0x48'));logger[_0x4f9a('0x8')](_0x4f9a('0x49'),_0x2754bb['id']);}})['catch'](function(_0x300ac3){logger[_0x4f9a('0x4e')]('['+_0x364680[_0x4f9a('0x58')][_0x4f9a('0x59')]()+']',JSON[_0x4f9a('0x4f')](_0x300ac3));});}; \ 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 7aa10b5..786cb88 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 _0x816f=['find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20created:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','redis','socket.io-emitter','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','GET','/api/selector/owners','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','adminEmail','catch','message','&f=','&entities=contact'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0x816f,0xd7));var _0xf816=function(_0x2fcae1,_0x3308ec){_0x2fcae1=_0x2fcae1-0x0;var _0x39e317=_0x816f[_0x2fcae1];return _0x39e317;};'use strict';var _=require(_0xf816('0x0'));var rp=require(_0xf816('0x1'));var md5=require(_0xf816('0x2'));var util=require(_0xf816('0x3'));var moment=require(_0xf816('0x4'));var Promise=require(_0xf816('0x5'));var Redis=require(_0xf816('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xf816('0x7'))('freshsales');config[_0xf816('0x8')]=_['defaults'](config[_0xf816('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf816('0x9'))(new Redis(config[_0xf816('0x8')]));function getAdminId(_0x364701,_0x5e24d0,_0x527b21,_0x1ec7df){return new Promise(function(_0x2fc1c5,_0xa3a692){var _0x2722ff=![];var _0x542142={'method':'GET','uri':_0x1ec7df+'/api/selector/owners','json':!![]};_0x542142[_0xf816('0xa')]=_0x527b21;logger[_0xf816('0xb')](_0xf816('0xc'));return rp(_0x542142)[_0xf816('0xd')](function(_0x390a6d){if(_0x390a6d){var _0x4d5c38=_0x390a6d['users'];var _0x47abd7=null;for(_0x47abd7=0x0;_0x47abd7<_0x4d5c38[_0xf816('0xe')];_0x47abd7++){if(_0x4d5c38[_0x47abd7][_0xf816('0xf')]===_0x364701['adminEmail']){_0x364701['adminId']=_0x4d5c38[_0x47abd7]['id'];_0x2722ff=!![];}}if(_0x2722ff){logger[_0xf816('0xb')]('Admin\x20found:',_0x364701[_0xf816('0x10')]);_0x2fc1c5(_0x364701);}else{_0xa3a692({'statusCode':0x194,'message':_0xf816('0x11')});}}else{_0xa3a692({'statusCode':0x194,'message':_0xf816('0x11')});}})['catch'](function(_0x579a4f){logger[_0xf816('0x12')]('['+[_0x5e24d0[_0xf816('0x13')]()]+']',_0x579a4f['message']);_0xa3a692(_0x579a4f);});});}function getUser(_0x574c58,_0x5ef698,_0x4936f0){return function(_0x15d9b8){return new Promise(function(_0x1b8e96,_0x8689bd){var _0x4fa72e={'method':_0xf816('0x14'),'uri':_0x4936f0+_0xf816('0x15'),'json':!![]};_0x4fa72e[_0xf816('0xa')]=_0x5ef698;logger['info'](_0xf816('0x16'));return rp(_0x4fa72e)[_0xf816('0xd')](function(_0x658466){if(_0x658466){var _0x47f6cb=_0x658466[_0xf816('0x17')];var _0x35a682=![];var _0x6faa5f=null;if(_0x15d9b8[_0xf816('0x18')]!==null){logger[_0xf816('0xb')](_0xf816('0x19'),_0x15d9b8['agentEmail']);_0x15d9b8['userEmail']=_0x15d9b8[_0xf816('0x18')];for(_0x6faa5f=0x0;_0x6faa5f<_0x47f6cb[_0xf816('0xe')];_0x6faa5f++){if(_0x47f6cb[_0x6faa5f][_0xf816('0xf')]===_0x15d9b8[_0xf816('0x18')]){_0x35a682=!![];_0x15d9b8[_0xf816('0x1a')]=_0x47f6cb[_0x6faa5f]['id'];logger['info']('User\x20found:',_0x15d9b8[_0xf816('0x1a')]);}}}if(!_0x35a682){logger[_0xf816('0xb')](_0xf816('0x1b'));_0x15d9b8[_0xf816('0x1c')]=_0x15d9b8[_0xf816('0x1d')];_0x15d9b8['userId']=_0x15d9b8['adminId'];_0x35a682=!![];}if(_0x35a682){_0x1b8e96(_0x15d9b8);}else{_0x8689bd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x8689bd({'statusCode':0x194,'message':_0xf816('0x11')});}})[_0xf816('0x1e')](function(_0x3e9c59){logger[_0xf816('0x12')]('['+[_0x574c58[_0xf816('0x13')]()]+']',_0x3e9c59[_0xf816('0x1f')]);_0x8689bd(_0x3e9c59);});});};}function searchContact(_0xd39403,_0x324f18,_0xce6da0,_0x446a07){return new Promise(function(_0x59dba4,_0x2a6cfe){var _0x11b7c0={'method':_0xf816('0x14'),'headers':_0x324f18,'uri':_0xd39403+'/api/lookup?q='+_0x446a07+_0xf816('0x20')+_0xce6da0+_0xf816('0x21'),'json':!![]};rp(_0x11b7c0)[_0xf816('0xd')](function(_0x409350){var _0x12d420=_[_0xf816('0x22')](_0x409350[_0xf816('0x23')][_0xf816('0x23')],[_0xce6da0,_0x446a07]);_0x59dba4(_0x12d420);})[_0xf816('0x1e')](function(_0x34acd0){_0x2a6cfe(_0x34acd0);});});}function getEndUser(_0x5d9a11,_0x138301,_0x4d2095){return function(_0x2977a5){return new Promise(function(_0xfb6d4f,_0x5f457e){logger[_0xf816('0xb')](util[_0xf816('0x24')](_0xf816('0x25'),_0x2977a5[_0xf816('0x26')]));searchContact(_0x4d2095,_0x138301,_0xf816('0x27'),_0x2977a5[_0xf816('0x26')])['then'](function(_0xc91e39){if(_0xc91e39){_0x2977a5[_0xf816('0x28')]=_0xc91e39['id'];logger[_0xf816('0xb')]('Contact\x20found\x20mobile_number:',_0x2977a5['endUserId']);return _0xfb6d4f(_0x2977a5);}searchContact(_0x4d2095,_0x138301,_0xf816('0x29'),_0x2977a5['contactNumber'])[_0xf816('0xd')](function(_0x2df048){if(_0x2df048){_0x2977a5[_0xf816('0x28')]=_0x2df048['id'];logger[_0xf816('0xb')]('Contact\x20found\x20work_number:',_0x2977a5[_0xf816('0x28')]);return _0xfb6d4f(_0x2977a5);}createEndUser(_0x2977a5,_0x5d9a11,_0x138301,_0x4d2095)[_0xf816('0xd')](function(_0x43740d){logger[_0xf816('0xb')](_0xf816('0x2a'),_0x43740d[_0xf816('0x28')]);return _0xfb6d4f(_0x43740d);});});})['catch'](function(_0x54b8de){_0x5f457e(_0x54b8de);});});};}function createEndUser(_0x54826b,_0x1755ea,_0xadfe85,_0x4ccff1){return new Promise(function(_0x3e6b7e,_0x1d29f0){var _0x26882a=moment();var _0x415eeb={'method':_0xf816('0x2b'),'uri':_0x4ccff1+'/api/contacts','body':{'contact':{'last_name':_0x54826b[_0xf816('0x26')],'work_number':_0x54826b[_0xf816('0x26')],'mobile_number':_0x54826b[_0xf816('0x26')],'owner_id':_0x54826b['userId'],'created_at':_0x26882a['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x415eeb[_0xf816('0xa')]=_0xadfe85;logger['info'](_0xf816('0x2c'));return rp(_0x415eeb)['then'](function(_0xb44982){_0x54826b[_0xf816('0x28')]=_0xb44982[_0xf816('0x2d')]['id'];_0x3e6b7e(_0x54826b);})[_0xf816('0x1e')](function(_0xeca03){logger[_0xf816('0x12')]('['+[_0x1755ea[_0xf816('0x13')]()]+']',_0xeca03[_0xf816('0x1f')]);_0x1d29f0(_0xeca03[_0xf816('0x1f')]);});});}function getTicket(_0x4ec310,_0x46b4ff,_0x16ce3,_0x5a6d73,_0x27402d){return function(_0x5ca2be){logger[_0xf816('0xb')](_0xf816('0x2e'));return new Promise(function(_0x33d04e,_0x34a725){var _0x5ed4b1=moment();var _0x4a4364={'method':_0xf816('0x2b'),'uri':_0x16ce3+_0xf816('0x2f'),'body':{'title':intUtil[_0xf816('0x30')](_0x5a6d73[_0xf816('0x31')],_0x27402d,'\x20'),'description':intUtil[_0xf816('0x30')](_0x5a6d73[_0xf816('0x32')],_0x27402d,'\x0a'),'owner_id':_0x5ca2be[_0xf816('0x1a')],'creater_id':_0x5ca2be[_0xf816('0x10')],'targetable_id':_0x5ca2be[_0xf816('0x28')],'targetable_type':_0xf816('0x33'),'created_at':_0x5ed4b1[_0xf816('0x24')](_0xf816('0x34')),'due_date':_0x5ed4b1[_0xf816('0x35')](0x1e,'m')[_0xf816('0x24')](_0xf816('0x34'))},'json':!![]};_0x4a4364[_0xf816('0xa')]=_0x46b4ff;return rp(_0x4a4364)[_0xf816('0xd')](function(_0x11b1c2){_0x5ca2be['ticketId']=_0x11b1c2['task']['id'];logger[_0xf816('0xb')](_0xf816('0x36'),_0x5ca2be[_0xf816('0x37')]);_0x33d04e(_0x5ca2be);})[_0xf816('0x1e')](function(_0x54b732){logger[_0xf816('0x12')]('['+[_0x4ec310[_0xf816('0x13')]()]+']',_0x54b732[_0xf816('0x1f')]);_0x34a725(_0x54b732['message']);});});};}function emit(_0x1ec88e,_0x44fc78,_0x2dd59b){var _0x190e2b={'uri':_0x1ec88e+_0xf816('0x38')+_0x2dd59b};io['to'](util['format'](_0xf816('0x39'),_0x44fc78))[_0xf816('0x3a')](_0xf816('0x3b'),_0x190e2b);}exports['cs']=function(_0x1272a4,_0x5a7330,_0x5dc5d9,_0x27d9c2,_0x26f35a,_0x283a65,_0x5aef75,_0x31d950){var _0x15262d={};var _0x2ae0d5={'Authorization':_0xf816('0x3c')+_0x283a65[_0xf816('0x3d')]};_0x283a65[_0xf816('0x3e')]=intUtil['stripTrailingSlash'](_0x283a65[_0xf816('0x3e')]);_0x283a65[_0xf816('0x3f')]=intUtil[_0xf816('0x40')](_0x283a65[_0xf816('0x3f')]);var _0x49d7ca=_0x283a65[_0xf816('0x3e')];_0x15262d[_0xf816('0x1d')]=_0x283a65[_0xf816('0x41')];_0x15262d[_0xf816('0x26')]=_0x31d950[_0xf816('0x42')]()===_0xf816('0x43')?_0x5a7330[_0xf816('0x44')]:_0x5a7330[_0xf816('0x45')];_0x15262d['callDirection']=_0x31d950==='queue'||_0x31d950===_0xf816('0x46')?_0xf816('0x47'):'outbound';if(_0x27d9c2){_0x15262d[_0xf816('0x18')]=_0x27d9c2[_0xf816('0xf')];}var _0x4dbe36=util['format'](_0xf816('0x48'),_0x283a65[_0xf816('0x3f')],_0x5a7330['uniqueid'],md5(_0x5a7330['uniqueid']));if(_0x26f35a&&_0x26f35a[_0xf816('0x49')]){logger[_0xf816('0xb')]('[QUEUE]',_0xf816('0x4a'));_0x5a7330[_0xf816('0x4b')]=_0x4dbe36;}else if(_0x5aef75&&_0x5aef75[_0xf816('0x4c')]&&_0x5aef75[_0xf816('0x4c')]!==_0xf816('0x4d')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5a7330['recordingURL']=_0x4dbe36;}else{_0x5a7330['recordingURL']='';}return getAdminId(_0x15262d,_0x31d950,_0x2ae0d5,_0x49d7ca)[_0xf816('0xd')](getUser(_0x31d950,_0x2ae0d5,_0x49d7ca))[_0xf816('0xd')](getEndUser(_0x31d950,_0x2ae0d5,_0x49d7ca))['then'](getTicket(_0x31d950,_0x2ae0d5,_0x49d7ca,_0x5dc5d9,_0x5a7330))[_0xf816('0xd')](function(_0x5ec4c4){logger[_0xf816('0xb')](util[_0xf816('0x24')](_0xf816('0x4e'),_0x5ec4c4[_0xf816('0x37')]));if(_0x31d950!==_0xf816('0x46')){logger[_0xf816('0xb')]('['+[_0x31d950[_0xf816('0x13')]()]+']',_0xf816('0x4f'));emit(_0x49d7ca,_0x27d9c2[_0xf816('0x50')],_0x5ec4c4[_0xf816('0x28')]);}})[_0xf816('0x1e')](function(_0x4e19d6){logger[_0xf816('0x12')]('['+[_0x31d950['toUpperCase']()]+_0xf816('0x51'),util[_0xf816('0x52')](_0x4e19d6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe1e6=['../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','catch','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','md5','util','moment','bluebird','ioredis','../../../../config/environment'];(function(_0x284609,_0x386b54){var _0x55116b=function(_0x3cdc4e){while(--_0x3cdc4e){_0x284609['push'](_0x284609['shift']());}};_0x55116b(++_0x386b54);}(_0xe1e6,0x18f));var _0x6e1e=function(_0x5f0bff,_0x3a18f8){_0x5f0bff=_0x5f0bff-0x0;var _0x58cbd2=_0xe1e6[_0x5f0bff];return _0x58cbd2;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6e1e('0x0'));var util=require(_0x6e1e('0x1'));var moment=require(_0x6e1e('0x2'));var Promise=require(_0x6e1e('0x3'));var Redis=require(_0x6e1e('0x4'));var intUtil=require('./util');var config=require(_0x6e1e('0x5'));var logger=require(_0x6e1e('0x6'))(_0x6e1e('0x7'));config[_0x6e1e('0x8')]=_[_0x6e1e('0x9')](config[_0x6e1e('0x8')],{'host':_0x6e1e('0xa'),'port':0x18eb});var io=require(_0x6e1e('0xb'))(new Redis(config[_0x6e1e('0x8')]));function getAdminId(_0x2cab76,_0x3ba41e,_0x5b4177,_0x2b35cf){return new Promise(function(_0x5a4475,_0x538a3c){var _0x4502ba=![];var _0x3f63e8={'method':_0x6e1e('0xc'),'uri':_0x2b35cf+_0x6e1e('0xd'),'json':!![]};_0x3f63e8[_0x6e1e('0xe')]=_0x5b4177;logger[_0x6e1e('0xf')](_0x6e1e('0x10'));return rp(_0x3f63e8)['then'](function(_0x14eb43){if(_0x14eb43){var _0x53a017=_0x14eb43[_0x6e1e('0x11')];var _0x5cdd3d=null;for(_0x5cdd3d=0x0;_0x5cdd3d<_0x53a017[_0x6e1e('0x12')];_0x5cdd3d++){if(_0x53a017[_0x5cdd3d][_0x6e1e('0x13')]===_0x2cab76[_0x6e1e('0x14')]){_0x2cab76[_0x6e1e('0x15')]=_0x53a017[_0x5cdd3d]['id'];_0x4502ba=!![];}}if(_0x4502ba){logger[_0x6e1e('0xf')](_0x6e1e('0x16'),_0x2cab76[_0x6e1e('0x15')]);_0x5a4475(_0x2cab76);}else{_0x538a3c({'statusCode':0x194,'message':_0x6e1e('0x17')});}}else{_0x538a3c({'statusCode':0x194,'message':_0x6e1e('0x17')});}})['catch'](function(_0x2244f4){logger[_0x6e1e('0x18')]('['+[_0x3ba41e['toUpperCase']()]+']',_0x2244f4[_0x6e1e('0x19')]);_0x538a3c(_0x2244f4);});});}function getUser(_0x20f3a0,_0x3c5326,_0x88f150){return function(_0x57ea71){return new Promise(function(_0x3e7001,_0x481be8){var _0x11d920={'method':_0x6e1e('0xc'),'uri':_0x88f150+_0x6e1e('0xd'),'json':!![]};_0x11d920['headers']=_0x3c5326;logger[_0x6e1e('0xf')](_0x6e1e('0x1a'));return rp(_0x11d920)[_0x6e1e('0x1b')](function(_0x4ed2bd){if(_0x4ed2bd){var _0x1b9ae0=_0x4ed2bd[_0x6e1e('0x11')];var _0x4e69d7=![];var _0x42fa32=null;if(_0x57ea71[_0x6e1e('0x1c')]!==null){logger['info'](_0x6e1e('0x1d'),_0x57ea71['agentEmail']);_0x57ea71[_0x6e1e('0x1e')]=_0x57ea71[_0x6e1e('0x1c')];for(_0x42fa32=0x0;_0x42fa32<_0x1b9ae0[_0x6e1e('0x12')];_0x42fa32++){if(_0x1b9ae0[_0x42fa32][_0x6e1e('0x13')]===_0x57ea71[_0x6e1e('0x1c')]){_0x4e69d7=!![];_0x57ea71[_0x6e1e('0x1f')]=_0x1b9ae0[_0x42fa32]['id'];logger[_0x6e1e('0xf')](_0x6e1e('0x20'),_0x57ea71[_0x6e1e('0x1f')]);}}}if(!_0x4e69d7){logger[_0x6e1e('0xf')](_0x6e1e('0x21'));_0x57ea71[_0x6e1e('0x1e')]=_0x57ea71[_0x6e1e('0x14')];_0x57ea71[_0x6e1e('0x1f')]=_0x57ea71[_0x6e1e('0x15')];_0x4e69d7=!![];}if(_0x4e69d7){_0x3e7001(_0x57ea71);}else{_0x481be8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x481be8({'statusCode':0x194,'message':_0x6e1e('0x17')});}})[_0x6e1e('0x22')](function(_0x364c94){logger['error']('['+[_0x20f3a0[_0x6e1e('0x23')]()]+']',_0x364c94[_0x6e1e('0x19')]);_0x481be8(_0x364c94);});});};}function searchContact(_0x23cb37,_0x1d929b,_0x402bcb,_0x423bac){return new Promise(function(_0x246c9b,_0x2a6a25){var _0x135dd2={'method':_0x6e1e('0xc'),'headers':_0x1d929b,'uri':_0x23cb37+_0x6e1e('0x24')+_0x423bac+_0x6e1e('0x25')+_0x402bcb+_0x6e1e('0x26'),'json':!![]};rp(_0x135dd2)['then'](function(_0x3d81c7){var _0x27abdb=_['find'](_0x3d81c7[_0x6e1e('0x27')][_0x6e1e('0x27')],[_0x402bcb,_0x423bac]);_0x246c9b(_0x27abdb);})[_0x6e1e('0x22')](function(_0x5250c9){_0x2a6a25(_0x5250c9);});});}function getEndUser(_0x2a36a7,_0x52b88,_0x25ec65){return function(_0x5458c2){return new Promise(function(_0x6eae6e,_0x42a127){logger[_0x6e1e('0xf')](util[_0x6e1e('0x28')](_0x6e1e('0x29'),_0x5458c2[_0x6e1e('0x2a')]));searchContact(_0x25ec65,_0x52b88,'mobile_number',_0x5458c2[_0x6e1e('0x2a')])[_0x6e1e('0x1b')](function(_0x194aa5){if(_0x194aa5){_0x5458c2[_0x6e1e('0x2b')]=_0x194aa5['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x5458c2['endUserId']);return _0x6eae6e(_0x5458c2);}searchContact(_0x25ec65,_0x52b88,_0x6e1e('0x2c'),_0x5458c2[_0x6e1e('0x2a')])[_0x6e1e('0x1b')](function(_0x48c55e){if(_0x48c55e){_0x5458c2[_0x6e1e('0x2b')]=_0x48c55e['id'];logger[_0x6e1e('0xf')]('Contact\x20found\x20work_number:',_0x5458c2[_0x6e1e('0x2b')]);return _0x6eae6e(_0x5458c2);}createEndUser(_0x5458c2,_0x2a36a7,_0x52b88,_0x25ec65)[_0x6e1e('0x1b')](function(_0x2d8fa4){logger['info']('Contact\x20created:',_0x2d8fa4['endUserId']);return _0x6eae6e(_0x2d8fa4);});});})[_0x6e1e('0x22')](function(_0x4809f5){_0x42a127(_0x4809f5);});});};}function createEndUser(_0x483497,_0xc1ccfc,_0x4647fa,_0x14187f){return new Promise(function(_0x29c43b,_0x4c0837){var _0x58e97e=moment();var _0x239441={'method':_0x6e1e('0x2d'),'uri':_0x14187f+_0x6e1e('0x2e'),'body':{'contact':{'last_name':_0x483497[_0x6e1e('0x2a')],'work_number':_0x483497[_0x6e1e('0x2a')],'mobile_number':_0x483497['contactNumber'],'owner_id':_0x483497[_0x6e1e('0x1f')],'created_at':_0x58e97e['format'](_0x6e1e('0x2f'))}},'json':!![]};_0x239441[_0x6e1e('0xe')]=_0x4647fa;logger[_0x6e1e('0xf')](_0x6e1e('0x30'));return rp(_0x239441)[_0x6e1e('0x1b')](function(_0x1bae3c){_0x483497['endUserId']=_0x1bae3c['contact']['id'];_0x29c43b(_0x483497);})[_0x6e1e('0x22')](function(_0x33058d){logger[_0x6e1e('0x18')]('['+[_0xc1ccfc['toUpperCase']()]+']',_0x33058d['message']);_0x4c0837(_0x33058d['message']);});});}function getTicket(_0x1967d1,_0x3155e1,_0x2e3153,_0x501965,_0x778bf6){return function(_0x1931db){logger[_0x6e1e('0xf')](_0x6e1e('0x31'));return new Promise(function(_0x5cce6d,_0xef0a1c){var _0x37fed6=moment();var _0x4eed92={'method':_0x6e1e('0x2d'),'uri':_0x2e3153+_0x6e1e('0x32'),'body':{'title':intUtil['getString'](_0x501965[_0x6e1e('0x33')],_0x778bf6,'\x20'),'description':intUtil[_0x6e1e('0x34')](_0x501965[_0x6e1e('0x35')],_0x778bf6,'\x0a'),'owner_id':_0x1931db[_0x6e1e('0x1f')],'creater_id':_0x1931db[_0x6e1e('0x15')],'targetable_id':_0x1931db[_0x6e1e('0x2b')],'targetable_type':'Contact','created_at':_0x37fed6[_0x6e1e('0x28')](_0x6e1e('0x2f')),'due_date':_0x37fed6['add'](0x1e,'m')[_0x6e1e('0x28')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4eed92['headers']=_0x3155e1;return rp(_0x4eed92)[_0x6e1e('0x1b')](function(_0x1dc467){_0x1931db[_0x6e1e('0x36')]=_0x1dc467[_0x6e1e('0x37')]['id'];logger['info'](_0x6e1e('0x38'),_0x1931db['ticketId']);_0x5cce6d(_0x1931db);})[_0x6e1e('0x22')](function(_0x42c837){logger[_0x6e1e('0x18')]('['+[_0x1967d1['toUpperCase']()]+']',_0x42c837['message']);_0xef0a1c(_0x42c837[_0x6e1e('0x19')]);});});};}function emit(_0x53b1a5,_0x22ab89,_0x843f07){var _0x13b1a6={'uri':_0x53b1a5+_0x6e1e('0x39')+_0x843f07};io['to'](util[_0x6e1e('0x28')]('user:%s',_0x22ab89))[_0x6e1e('0x3a')](_0x6e1e('0x3b'),_0x13b1a6);}exports['cs']=function(_0x352e96,_0x220bd0,_0x32f698,_0x5f48dc,_0x3866e9,_0x37da22,_0x1578ca,_0x513043){var _0x574226={};var _0x1b8935={'Authorization':'Token\x20token='+_0x37da22[_0x6e1e('0x3c')]};_0x37da22[_0x6e1e('0x3d')]=intUtil[_0x6e1e('0x3e')](_0x37da22['remoteUri']);_0x37da22['serverUrl']=intUtil[_0x6e1e('0x3e')](_0x37da22[_0x6e1e('0x3f')]);var _0x5584ce=_0x37da22[_0x6e1e('0x3d')];_0x574226[_0x6e1e('0x14')]=_0x37da22[_0x6e1e('0x40')];_0x574226[_0x6e1e('0x2a')]=_0x513043[_0x6e1e('0x41')]()==='outbound'?_0x220bd0[_0x6e1e('0x42')]:_0x220bd0[_0x6e1e('0x43')];_0x574226[_0x6e1e('0x44')]=_0x513043==='queue'||_0x513043==='unmanaged'?'queue':_0x6e1e('0x45');if(_0x5f48dc){_0x574226[_0x6e1e('0x1c')]=_0x5f48dc[_0x6e1e('0x13')];}var _0x54889f=util[_0x6e1e('0x28')](_0x6e1e('0x46'),_0x37da22[_0x6e1e('0x3f')],_0x220bd0['uniqueid'],md5(_0x220bd0['uniqueid']));if(_0x3866e9&&_0x3866e9['monitor_format']){logger[_0x6e1e('0xf')](_0x6e1e('0x47'),_0x6e1e('0x48'));_0x220bd0['recordingURL']=_0x54889f;}else if(_0x1578ca&&_0x1578ca[_0x6e1e('0x49')]&&_0x1578ca[_0x6e1e('0x49')]!==_0x6e1e('0x4a')){logger[_0x6e1e('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x220bd0[_0x6e1e('0x4b')]=_0x54889f;}else{_0x220bd0[_0x6e1e('0x4b')]='';}return getAdminId(_0x574226,_0x513043,_0x1b8935,_0x5584ce)[_0x6e1e('0x1b')](getUser(_0x513043,_0x1b8935,_0x5584ce))['then'](getEndUser(_0x513043,_0x1b8935,_0x5584ce))[_0x6e1e('0x1b')](getTicket(_0x513043,_0x1b8935,_0x5584ce,_0x32f698,_0x220bd0))[_0x6e1e('0x1b')](function(_0x4ff38b){logger[_0x6e1e('0xf')](util[_0x6e1e('0x28')](_0x6e1e('0x4c'),_0x4ff38b[_0x6e1e('0x36')]));if(_0x513043!==_0x6e1e('0x4d')){logger['info']('['+[_0x513043[_0x6e1e('0x23')]()]+']',_0x6e1e('0x4e'));emit(_0x5584ce,_0x5f48dc[_0x6e1e('0x4f')],_0x4ff38b[_0x6e1e('0x2b')]);}})[_0x6e1e('0x22')](function(_0x5eac42){logger[_0x6e1e('0x18')]('['+[_0x513043[_0x6e1e('0x23')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x6e1e('0x50')](_0x5eac42,{'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 82c2de8..1df5a2e 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 _0x17ab=['Configurations','data3','queue','outbound','log','unmanaged','salesforce','freshdesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','zoho','desk','vtiger','freshsales','exec','includes','data1','toLowerCase','data2','find'];(function(_0xd059be,_0x4ea3b5){var _0xe47fab=function(_0x1bdf26){while(--_0x1bdf26){_0xd059be['push'](_0xd059be['shift']());}};_0xe47fab(++_0x4ea3b5);}(_0x17ab,0xed));var _0xb17a=function(_0x263a52,_0x2f6dc6){_0x263a52=_0x263a52-0x0;var _0x3fafc8=_0x17ab[_0x263a52];return _0x3fafc8;};'use strict';var _=require(_0xb17a('0x0'));var util=require('util');var zendesk=require(_0xb17a('0x1'));var salesforce=require(_0xb17a('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xb17a('0x3'));var zoho=require(_0xb17a('0x4'));var desk=require(_0xb17a('0x5'));var vtiger=require(_0xb17a('0x6'));var servicenow=require(_0xb17a('0x7'));var dynamics365=require(_0xb17a('0x8'));var freshsales=require(_0xb17a('0x9'));var integrations=[_0xb17a('0xa'),'salesforce',_0xb17a('0xb'),'freshdesk',_0xb17a('0xc'),_0xb17a('0xd'),_0xb17a('0xe'),'dynamics365',_0xb17a('0xf'),'servicenow'];exports[_0xb17a('0x10')]=function(_0x3d5e2a,_0x2abd8a,_0x3e8ca2,_0x58e670,_0x53addd,_0x54718a){if(_0x3e8ca2){if(_[_0xb17a('0x11')](integrations,_0x3d5e2a[_0xb17a('0x12')]['toLowerCase']())){try{var _0x21f6de=null;var _0x198ec6='';var _0xbecec2=_0x3e8ca2[_0x3d5e2a['data1'][_0xb17a('0x13')]()];if(_0xbecec2){var _0x4715f8=_0xbecec2[_0x3d5e2a[_0xb17a('0x14')]];if(_0x4715f8){var _0x49cbfa=_[_0xb17a('0x15')](_0x4715f8[_0xb17a('0x16')],{'id':parseInt(_0x3d5e2a[_0xb17a('0x17')],0xa)});if(_0x49cbfa){if(_0x58e670){if(_0x53addd&&_0x2abd8a[_0xb17a('0x18')]){_0x198ec6=_0xb17a('0x18');}else if(_0x2abd8a['routeId']){_0x198ec6=_0xb17a('0x19');}else{console[_0xb17a('0x1a')]('EVENT\x20UNKNOWN',_0x2abd8a);}}else{_0x198ec6=_0xb17a('0x1b');}switch(_0x3d5e2a['data1'][_0xb17a('0x13')]()){case _0xb17a('0xa'):zendesk[_0x198ec6](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a);break;case _0xb17a('0x1c'):salesforce[_0x198ec6](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a);break;case _0xb17a('0xb'):sugarcrm[_0x198ec6](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a);break;case _0xb17a('0x1d'):freshdesk[_0x198ec6](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a);break;case _0xb17a('0xc'):zoho[_0x198ec6](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a);break;case _0xb17a('0xd'):desk[_0x198ec6](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a);break;case _0xb17a('0xe'):vtiger[_0x198ec6](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a);break;case _0xb17a('0xf'):freshsales['cs'](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a,_0x198ec6);break;case'servicenow':servicenow['cs'](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a,_0x198ec6);break;case'dynamics365':dynamics365['cs'](_0x3d5e2a,_0x2abd8a,_0x49cbfa,_0x58e670,_0x53addd,_0x4715f8,_0x54718a,_0x198ec6);break;default:console[_0xb17a('0x1a')](_0xb17a('0x1e'));}}else{_0x21f6de=require(_0xb17a('0x1f'))(_0x3d5e2a['data1'][_0xb17a('0x13')]());_0x21f6de[_0xb17a('0x20')]('[EXEC]',util[_0xb17a('0x21')](_0xb17a('0x22'),_0x3d5e2a['data1'][_0xb17a('0x13')](),_0x3d5e2a[_0xb17a('0x17')]));}}else{_0x21f6de=require('../../../../config/logger')(_0x3d5e2a[_0xb17a('0x12')][_0xb17a('0x13')]());_0x21f6de[_0xb17a('0x20')](_0xb17a('0x23'),util['format'](_0xb17a('0x24'),_0x3d5e2a[_0xb17a('0x12')][_0xb17a('0x13')](),_0x3d5e2a[_0xb17a('0x14')]));}}else{}}catch(_0x41ad85){console[_0xb17a('0x20')](_0x41ad85);}}}}; \ No newline at end of file +var _0xe657=['dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce'];(function(_0x3aac69,_0x81d09f){var _0x38d35b=function(_0x58ef90){while(--_0x58ef90){_0x3aac69['push'](_0x3aac69['shift']());}};_0x38d35b(++_0x81d09f);}(_0xe657,0x7a));var _0x7e65=function(_0x1800af,_0x19ecb0){_0x1800af=_0x1800af-0x0;var _0x1fb471=_0xe657[_0x1800af];return _0x1fb471;};'use strict';var _=require('lodash');var util=require(_0x7e65('0x0'));var zendesk=require(_0x7e65('0x1'));var salesforce=require(_0x7e65('0x2'));var sugarcrm=require(_0x7e65('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x7e65('0x4'));var desk=require(_0x7e65('0x5'));var vtiger=require(_0x7e65('0x6'));var servicenow=require(_0x7e65('0x7'));var dynamics365=require(_0x7e65('0x8'));var freshsales=require(_0x7e65('0x9'));var integrations=['zendesk','salesforce',_0x7e65('0xa'),'freshdesk',_0x7e65('0xb'),_0x7e65('0xc'),_0x7e65('0xd'),'dynamics365',_0x7e65('0xe'),_0x7e65('0xf')];exports[_0x7e65('0x10')]=function(_0x310a03,_0x53f6ee,_0x2950c7,_0x5a07f1,_0x258d13,_0x1f43f5){if(_0x2950c7){if(_[_0x7e65('0x11')](integrations,_0x310a03[_0x7e65('0x12')]['toLowerCase']())){try{var _0x25c223=null;var _0x334e59='';var _0xc86e79=_0x2950c7[_0x310a03[_0x7e65('0x12')][_0x7e65('0x13')]()];if(_0xc86e79){var _0x30e316=_0xc86e79[_0x310a03[_0x7e65('0x14')]];if(_0x30e316){var _0x10056=_[_0x7e65('0x15')](_0x30e316['Configurations'],{'id':parseInt(_0x310a03[_0x7e65('0x16')],0xa)});if(_0x10056){if(_0x5a07f1){if(_0x258d13&&_0x53f6ee['queue']){_0x334e59=_0x7e65('0x17');}else if(_0x53f6ee['routeId']){_0x334e59=_0x7e65('0x18');}else{console[_0x7e65('0x19')](_0x7e65('0x1a'),_0x53f6ee);}}else{_0x334e59=_0x7e65('0x1b');}switch(_0x310a03[_0x7e65('0x12')][_0x7e65('0x13')]()){case _0x7e65('0x1c'):zendesk[_0x334e59](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5);break;case _0x7e65('0x1d'):salesforce[_0x334e59](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5);break;case _0x7e65('0xa'):sugarcrm[_0x334e59](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5);break;case'freshdesk':freshdesk[_0x334e59](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5);break;case _0x7e65('0xb'):zoho[_0x334e59](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5);break;case _0x7e65('0xc'):desk[_0x334e59](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5);break;case _0x7e65('0xd'):vtiger[_0x334e59](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5);break;case _0x7e65('0xe'):freshsales['cs'](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5,_0x334e59);break;case _0x7e65('0xf'):servicenow['cs'](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5,_0x334e59);break;case _0x7e65('0x1e'):dynamics365['cs'](_0x310a03,_0x53f6ee,_0x10056,_0x5a07f1,_0x258d13,_0x30e316,_0x1f43f5,_0x334e59);break;default:console[_0x7e65('0x19')](_0x7e65('0x1f'));}}else{_0x25c223=require(_0x7e65('0x20'))(_0x310a03[_0x7e65('0x12')][_0x7e65('0x13')]());_0x25c223[_0x7e65('0x21')](_0x7e65('0x22'),util[_0x7e65('0x23')](_0x7e65('0x24'),_0x310a03[_0x7e65('0x12')]['toLowerCase'](),_0x310a03[_0x7e65('0x16')]));}}else{_0x25c223=require(_0x7e65('0x20'))(_0x310a03['data1'][_0x7e65('0x13')]());_0x25c223[_0x7e65('0x21')](_0x7e65('0x22'),util[_0x7e65('0x23')](_0x7e65('0x25'),_0x310a03[_0x7e65('0x12')][_0x7e65('0x13')](),_0x310a03[_0x7e65('0x14')]));}}else{}}catch(_0x9cc4dd){console[_0x7e65('0x21')](_0x9cc4dd);}}}}; \ 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 93c459b..62dd46a 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 _0x2c40=['serverUrl','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','assign','Subjects','getString','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','identity','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Contact','Name','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','No\x20Company','Caller\x20-\x20%s','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue'];(function(_0x14613e,_0x78f9d){var _0x3cd3bb=function(_0xbce230){while(--_0xbce230){_0x14613e['push'](_0x14613e['shift']());}};_0x3cd3bb(++_0x78f9d);}(_0x2c40,0x126));var _0x02c4=function(_0x9d6c90,_0xf775ea){_0x9d6c90=_0x9d6c90-0x0;var _0x1a2040=_0x2c40[_0x9d6c90];return _0x1a2040;};'use strict';var _=require(_0x02c4('0x0'));var rp=require(_0x02c4('0x1'));var moment=require('moment');var BPromise=require(_0x02c4('0x2'));var md5=require(_0x02c4('0x3'));var jsforce=require(_0x02c4('0x4'));var util=require(_0x02c4('0x5'));var Redis=require(_0x02c4('0x6'));var intUtil=require(_0x02c4('0x7'));var config=require(_0x02c4('0x8'));var logger=require(_0x02c4('0x9'))(_0x02c4('0xa'));config[_0x02c4('0xb')]=_[_0x02c4('0xc')](config[_0x02c4('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x02c4('0xd'))(new Redis(config['redis']));function emit(_0x2382b9,_0x1dc195,_0x390a0){io['to'](_0x2382b9)['emit'](_0x1dc195,_0x390a0);}function getTicket(_0x42a3d9,_0x5b616a,_0x350e96,_0x4ab75d,_0x3cd64b,_0x52dc7b,_0x43dcdc,_0x3b69a8){var _0x1fa9a8=Object[_0x02c4('0xe')]({},{'OwnerId':_0x5b616a['id'],'Subject':intUtil['getString'](_0x4ab75d[_0x02c4('0xf')],_0x3cd64b,'\x20'),'Description':intUtil[_0x02c4('0x10')](_0x4ab75d['Descriptions'],_0x3cd64b,'\x0a')},getCustomFields(_0x52dc7b,_0x3cd64b));if(_0x350e96){if(_0x4ab75d[_0x02c4('0x11')]==='Task'){_0x1fa9a8[_0x02c4('0x12')]=moment[_0x02c4('0x13')]();_0x1fa9a8[_0x02c4('0x14')]=![];_0x1fa9a8[_0x02c4('0x15')]=![];if(_0x350e96[_0x02c4('0x16')]===_0x02c4('0x17')||_0x350e96[_0x02c4('0x16')]===_0x02c4('0x18')){_0x1fa9a8[_0x02c4('0x19')]=_0x350e96['id'];}else if(_0x350e96[_0x02c4('0x16')]===_0x02c4('0x1a')){_0x1fa9a8[_0x02c4('0x1b')]=_0x350e96['id'];}}else if(_0x4ab75d[_0x02c4('0x11')]===_0x02c4('0x1c')){if(_0x350e96[_0x02c4('0x16')]===_0x02c4('0x17')){_0x1fa9a8[_0x02c4('0x1d')]=_0x350e96['id'];}else if(_0x350e96['endUserType']==='account'){_0x1fa9a8['AccountId']=_0x350e96['id'];}else if(_0x350e96[_0x02c4('0x16')]===_0x02c4('0x18')&&_0x4ab75d[_0x02c4('0x1e')]){_0x1fa9a8[_0x4ab75d[_0x02c4('0x1e')]]=_0x350e96['id'];}else{logger[_0x02c4('0x1f')](_0x02c4('0x20'));}}}return _0x43dcdc[_0x02c4('0x21')](_0x4ab75d[_0x02c4('0x11')])[_0x02c4('0x22')](_0x1fa9a8);}function getUser(_0x58fff8,_0x47a885,_0xa94870){if(!_[_0x02c4('0x23')](_0x47a885)&&intUtil[_0x02c4('0x24')](_0x47a885)){var _0x133189={'Email':_0x47a885};var _0x38fcee={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xa94870['sobject'](_0x02c4('0x25'))[_0x02c4('0x26')](_0x133189,_0x38fcee)[_0x02c4('0x27')]()[_0x02c4('0x28')](function(_0x2a88fc){if(_0x2a88fc[_0x02c4('0x29')]){var _0x246b4d=_[_0x02c4('0x26')](_0x2a88fc,function(_0x2f7cb1){return _0x2f7cb1[_0x02c4('0x2a')]===_0x47a885;});if(_0x246b4d){logger[_0x02c4('0x1f')](_0x02c4('0x2b'),_0x47a885);return BPromise['resolve']({'id':_0x246b4d['Id'],'name':_0x246b4d['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x47a885);return _0xa94870[_0x02c4('0x2c')]()[_0x02c4('0x28')](function(_0xaee114){return BPromise[_0x02c4('0x2d')]({'id':_0xaee114[_0x02c4('0x2e')],'name':_0xaee114[_0x02c4('0x2f')]});});}});}else{logger[_0x02c4('0x1f')](_0x02c4('0x30'),_0x47a885);return _0xa94870[_0x02c4('0x2c')]()['then'](function(_0x17266f){return BPromise[_0x02c4('0x2d')]({'id':_0x17266f[_0x02c4('0x2e')],'name':_0x17266f[_0x02c4('0x2f')]});});}}function getEndUser(_0x4cc037,_0x53e6df,_0xef587d,_0x210301,_0x1761e3){var _0x1c95ac={'$or':{'Phone':_0x210301}};var _0x4ae064={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x02c4('0x2d')]()['then'](function(){logger['info'](_0x02c4('0x31'),_0x210301,_0x53e6df[_0x02c4('0x32')]);switch(_0x53e6df[_0x02c4('0x32')]){case _0x02c4('0x33'):var _0x46408a=_[_0x02c4('0x34')](_0x1c95ac);if(_0x53e6df[_0x02c4('0x35')]){var _0x11b4fc={};_0x11b4fc[_0x53e6df['additionalSearchContact']]=_0x210301;_['merge'](_0x46408a[_0x02c4('0x36')],_0x11b4fc);}return _0x1761e3[_0x02c4('0x21')]('Contact')[_0x02c4('0x26')](_0x46408a,_0x4ae064)[_0x02c4('0x27')]()[_0x02c4('0x28')](function(_0x571a27){if(_0x571a27&&_0x571a27['length']){return _0x571a27;}else{var _0x28eaf8=_[_0x02c4('0x34')](_0x1c95ac);if(_0x53e6df[_0x02c4('0x37')]){var _0x5b1bcf={};_0x5b1bcf[_0x53e6df[_0x02c4('0x37')]]=_0x210301;_[_0x02c4('0x38')](_0x28eaf8['$or'],_0x5b1bcf);}return _0x1761e3['sobject'](_0x02c4('0x39'))['find'](_0x28eaf8,_0x4ae064);}});case _0x02c4('0x3a'):var _0x2592b0=_[_0x02c4('0x34')](_0x1c95ac);if(_0x53e6df['additionalSearchAccount']){var _0x11b4fc={};_0x11b4fc[_0x53e6df[_0x02c4('0x3b')]]=_0x210301;_[_0x02c4('0x38')](_0x2592b0[_0x02c4('0x36')],_0x11b4fc);}return _0x1761e3[_0x02c4('0x21')]('Account')[_0x02c4('0x26')](_0x2592b0,_0x4ae064)[_0x02c4('0x27')]()[_0x02c4('0x28')](function(_0x52bc36){if(_0x52bc36&&_0x52bc36[_0x02c4('0x29')]){return _0x52bc36;}else{var _0x1a7bb1=_[_0x02c4('0x34')](_0x1c95ac);if(_0x53e6df[_0x02c4('0x35')]){var _0x3bc241={};_0x3bc241[_0x53e6df[_0x02c4('0x35')]]=_0x210301;_[_0x02c4('0x38')](_0x1a7bb1['$or'],_0x3bc241);}return _0x1761e3[_0x02c4('0x21')](_0x02c4('0x3c'))[_0x02c4('0x26')](_0x1a7bb1,_0x4ae064)[_0x02c4('0x28')](function(_0x20fa7f){if(_0x20fa7f&&_0x20fa7f[_0x02c4('0x29')]){return _0x20fa7f;}else{var _0x11ab35=_[_0x02c4('0x34')](_0x1c95ac);if(_0x53e6df[_0x02c4('0x37')]){var _0x1bcb17={};_0x1bcb17[_0x53e6df[_0x02c4('0x37')]]=_0x210301;_['merge'](_0x11ab35[_0x02c4('0x36')],_0x1bcb17);}return _0x1761e3[_0x02c4('0x21')](_0x02c4('0x39'))[_0x02c4('0x26')](_0x11ab35,_0x4ae064);}});}});case'contact':var _0x46408a=_['cloneDeep'](_0x1c95ac);if(_0x53e6df[_0x02c4('0x35')]){var _0x11b4fc={};_0x11b4fc[_0x53e6df[_0x02c4('0x35')]]=_0x210301;_[_0x02c4('0x38')](_0x46408a[_0x02c4('0x36')],_0x11b4fc);}return _0x1761e3[_0x02c4('0x21')](_0x02c4('0x3c'))[_0x02c4('0x26')](_0x46408a,_0x4ae064)[_0x02c4('0x27')]();case'lead':var _0x37989b=_['cloneDeep'](_0x1c95ac);if(_0x53e6df[_0x02c4('0x37')]){var _0x11b4fc={};_0x11b4fc[_0x53e6df[_0x02c4('0x37')]]=_0x210301;_[_0x02c4('0x38')](_0x37989b[_0x02c4('0x36')],_0x11b4fc);}return _0x1761e3[_0x02c4('0x21')]('Lead')[_0x02c4('0x26')](_0x37989b,_0x4ae064);case'account':var _0x2592b0=_[_0x02c4('0x34')](_0x1c95ac);if(_0x53e6df[_0x02c4('0x3b')]){var _0x11b4fc={};_0x11b4fc[_0x53e6df[_0x02c4('0x3b')]]=_0x210301;_[_0x02c4('0x38')](_0x2592b0[_0x02c4('0x36')],_0x11b4fc);}return _0x1761e3[_0x02c4('0x21')]('Account')['find'](_0x2592b0,_0x4ae064);default:return null;}})['then'](function(_0x207382){if(_0x207382&&_0x207382[_0x02c4('0x29')]){var _0x534cda=_['first'](_0x207382);if(_0x534cda){return BPromise[_0x02c4('0x2d')]({'id':_0x534cda['Id'],'name':_0x534cda[_0x02c4('0x3d')],'phone':_0x534cda['Phone'],'endUserType':_0x534cda['attributes']['type']['toLowerCase']()});}}})[_0x02c4('0x28')](function(_0x1ffbb8){if(_0x1ffbb8){logger[_0x02c4('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1ffbb8[_0x02c4('0x16')],_0x210301);return BPromise[_0x02c4('0x2d')](_0x1ffbb8);}else{logger['info'](_0x02c4('0x3e'),_0x210301);var _0x4d2d6d={'Phone':_0x210301};if(_0x53e6df[_0x02c4('0x3f')]){if(_0x53e6df[_0x02c4('0x3f')]===_0x02c4('0x17')){logger[_0x02c4('0x1f')](_0x02c4('0x40'),_0x210301,_0x53e6df['moduleCreate']);_0x4d2d6d[_0x02c4('0x41')]=_0xef587d!==_0x02c4('0x42')?_0xef587d:util[_0x02c4('0x43')]('Caller\x20-\x20%s',_0x210301);}else if(_0x53e6df['moduleCreate']==='lead'){logger[_0x02c4('0x1f')](_0x02c4('0x40'),_0x210301,_0x53e6df[_0x02c4('0x3f')]);_0x4d2d6d[_0x02c4('0x41')]=_0xef587d!==_0x02c4('0x42')?_0xef587d:util[_0x02c4('0x43')]('Caller\x20-\x20%s',_0x210301);_0x4d2d6d['Company']=_0x02c4('0x44');}else if(_0x53e6df[_0x02c4('0x3f')]===_0x02c4('0x1a')){logger[_0x02c4('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x210301,_0x53e6df[_0x02c4('0x3f')]);_0x4d2d6d[_0x02c4('0x3d')]=_0xef587d!==_0x02c4('0x42')?_0xef587d:util[_0x02c4('0x43')](_0x02c4('0x45'),_0x210301);}else{return null;}}return _0x1761e3[_0x02c4('0x21')](_['upperFirst'](_0x53e6df[_0x02c4('0x3f')]))[_0x02c4('0x22')](_0x4d2d6d)[_0x02c4('0x28')](function(_0x232db0){return BPromise[_0x02c4('0x2d')]({'id':_0x232db0['id'],'endUserType':_0x53e6df[_0x02c4('0x3f')]});});}});}function getCustomFields(_0x1b0fcd,_0x1b28f7){var _0x1d77ab={};if(_0x1b0fcd['length']>0x0){_[_0x02c4('0x46')](_0x1b0fcd,function(_0x563eb8){if(_[_0x02c4('0x47')]([_0x02c4('0x48'),_0x02c4('0x49')],_0x563eb8[_0x02c4('0x4a')])&&_0x563eb8[_0x02c4('0x4b')]){_0x1d77ab[_0x563eb8[_0x02c4('0x4b')]]=_0x563eb8[_0x02c4('0x4c')][_0x02c4('0x4d')]();}else if(_0x563eb8[_0x02c4('0x4a')]==='variable'&&_0x563eb8[_0x02c4('0x4e')]&&_0x563eb8['idField']){_0x1b28f7[_0x563eb8[_0x02c4('0x4e')]]&&(_0x1d77ab[_0x563eb8[_0x02c4('0x4b')]]=_0x1b28f7[_0x563eb8[_0x02c4('0x4e')]][_0x02c4('0x4d')]());}else if(_0x563eb8[_0x02c4('0x4a')]===_0x02c4('0x4f')&&_0x563eb8['Variable']&&_0x563eb8[_0x02c4('0x50')]['name']&&_0x563eb8[_0x02c4('0x4b')]){_0x1b28f7[_0x563eb8[_0x02c4('0x50')][_0x02c4('0x51')][_0x02c4('0x52')]()]&&(_0x1d77ab[_0x563eb8[_0x02c4('0x4b')]]=_0x1b28f7[_0x563eb8[_0x02c4('0x50')][_0x02c4('0x51')][_0x02c4('0x52')]()][_0x02c4('0x4d')]());}});}return _0x1d77ab;}function getConnection(_0xe2655f){var _0x150b14=_0xe2655f['password'][_0x02c4('0x53')](_0xe2655f[_0x02c4('0x54')]);var _0x50c8bc=new jsforce[(_0x02c4('0x55'))]({'oauth2':{'loginUrl':_0xe2655f[_0x02c4('0x56')]||_0x02c4('0x57'),'clientId':_0xe2655f[_0x02c4('0x58')],'clientSecret':_0xe2655f[_0x02c4('0x59')]}});return _0x50c8bc[_0x02c4('0x5a')](_0xe2655f['username'],_0x150b14)[_0x02c4('0x28')](function(){logger[_0x02c4('0x1f')](_0x02c4('0x5b'));return _0x50c8bc;});}exports[_0x02c4('0x5c')]=function(_0x540c16,_0x3db2fc,_0x43310b,_0x325c2f,_0x4731c4,_0x44f933){var _0x35b543,_0x4339ab,_0x9b6f3d,_0x27fc24;_0x44f933[_0x02c4('0x5d')]=intUtil['stripTrailingSlash'](_0x44f933[_0x02c4('0x5d')]);_0x44f933[_0x02c4('0x56')]=intUtil[_0x02c4('0x5e')](_0x44f933['remoteUri']);if(_0x4731c4&&_0x4731c4[_0x02c4('0x5f')]){logger[_0x02c4('0x1f')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3db2fc[_0x02c4('0x60')]=util[_0x02c4('0x43')](_0x02c4('0x61'),_0x44f933['serverUrl'],_0x3db2fc[_0x02c4('0x62')],md5(_0x3db2fc[_0x02c4('0x62')]));}else{_0x3db2fc[_0x02c4('0x60')]='';}return getConnection(_0x44f933)[_0x02c4('0x28')](function(_0x24af29){_0x27fc24=_0x24af29;return getUser(_0x44f933,_0x325c2f[_0x02c4('0x63')],_0x27fc24);})[_0x02c4('0x28')](function(_0x5ef076){_0x35b543=_0x5ef076;return getEndUser(_0x44f933,_0x43310b,_0x3db2fc[_0x02c4('0x64')],_0x3db2fc[_0x02c4('0x65')],_0x27fc24);})['then'](function(_0xb89479){_0x4339ab=_0xb89479;return getTicket(_0x44f933,_0x35b543,_0x4339ab,_0x43310b,_0x3db2fc,_0x43310b[_0x02c4('0x66')],_0x27fc24,'queue');})[_0x02c4('0x28')](function(_0x6b1931){_0x9b6f3d=_0x6b1931;logger['info'](_0x02c4('0x67'),_0x9b6f3d['id']);logger[_0x02c4('0x1f')](_0x02c4('0x68'),_0x9b6f3d['id'],_0x325c2f['name'],_0x44f933[_0x02c4('0x4a')]);switch(_0x44f933[_0x02c4('0x4a')]){case _0x02c4('0x69'):emit(util[_0x02c4('0x43')](_0x02c4('0x6a'),_0x325c2f[_0x02c4('0x51')]),_0x02c4('0x6b'),{'recordId':_0x9b6f3d['id']});break;case'newTab':emit(util['format']('user:%s',_0x325c2f['name']),_0x02c4('0x6c'),{'uri':util['format'](_0x02c4('0x6d'),_0x27fc24[_0x02c4('0x6e')],_0x9b6f3d['id'])});break;default:logger[_0x02c4('0x6f')](_0x02c4('0x70'));}})['catch'](function(_0x41324f){logger[_0x02c4('0x6f')](_0x02c4('0x71'),_0x41324f);});};exports[_0x02c4('0x72')]=function(_0x4edec4,_0x5d70b6,_0x557d56,_0x9ec56f,_0x4c2d55,_0x2309f4,_0x293b23){var _0x18279e,_0x7f9b49,_0xfb6623,_0x50ddbf;_0x2309f4['serverUrl']=intUtil[_0x02c4('0x5e')](_0x2309f4[_0x02c4('0x5d')]);_0x2309f4[_0x02c4('0x56')]=intUtil['stripTrailingSlash'](_0x2309f4['remoteUri']);if(_0x293b23&&_0x293b23[_0x02c4('0x73')]&&_0x293b23[_0x02c4('0x73')]!=='none'){logger[_0x02c4('0x1f')]('[OUTBOUND]',_0x02c4('0x74'));_0x5d70b6[_0x02c4('0x60')]=util[_0x02c4('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2309f4[_0x02c4('0x5d')],_0x5d70b6[_0x02c4('0x62')],md5(_0x5d70b6['uniqueid']));}return getConnection(_0x2309f4)[_0x02c4('0x28')](function(_0x3ed77b){_0x50ddbf=_0x3ed77b;return getUser(_0x2309f4,_0x9ec56f[_0x02c4('0x63')],_0x50ddbf);})[_0x02c4('0x28')](function(_0x39c7ac){_0x18279e=_0x39c7ac;return getEndUser(_0x2309f4,_0x557d56,_0x5d70b6[_0x02c4('0x75')],_0x5d70b6[_0x02c4('0x76')],_0x50ddbf);})[_0x02c4('0x28')](function(_0x240034){_0x7f9b49=_0x240034;return getTicket(_0x2309f4,_0x18279e,_0x7f9b49,_0x557d56,_0x5d70b6,_0x557d56[_0x02c4('0x66')],_0x50ddbf,_0x02c4('0x72'));})[_0x02c4('0x28')](function(_0x398891){_0xfb6623=_0x398891;logger[_0x02c4('0x1f')](_0x02c4('0x77'),_0xfb6623['id']);logger[_0x02c4('0x1f')](_0x02c4('0x78'),_0xfb6623['id'],_0x9ec56f['name'],_0x2309f4[_0x02c4('0x4a')]);switch(_0x2309f4['type']){case'integrationTab':emit(util[_0x02c4('0x43')]('user:%s',_0x9ec56f[_0x02c4('0x51')]),_0x02c4('0x6b'),{'recordId':_0xfb6623['id']});break;case _0x02c4('0x79'):emit(util[_0x02c4('0x43')](_0x02c4('0x6a'),_0x9ec56f['name']),_0x02c4('0x6c'),{'uri':util['format'](_0x02c4('0x6d'),_0x50ddbf['instanceUrl'],_0xfb6623['id'])});break;default:logger['error'](_0x02c4('0x7a'),_0x02c4('0x7b'));}})[_0x02c4('0x7c')](function(_0x199c7c){logger[_0x02c4('0x6f')](_0x02c4('0x7a'),_0x199c7c);});};exports['unmanaged']=function(_0x291e2f,_0x51de23,_0x3fc827,_0x5d21ce,_0x17f11b,_0x41b292){var _0x52ca8c,_0x1f2914,_0x7efec4,_0x1685a0;_0x41b292[_0x02c4('0x5d')]=intUtil['stripTrailingSlash'](_0x41b292[_0x02c4('0x5d')]);_0x41b292[_0x02c4('0x56')]=intUtil[_0x02c4('0x5e')](_0x41b292['remoteUri']);if(_0x17f11b&&_0x17f11b[_0x02c4('0x5f')]){logger[_0x02c4('0x1f')]('['+_0x51de23[_0x02c4('0x7d')][_0x02c4('0x7e')]()+']','Recording\x20is\x20enabled!');_0x51de23[_0x02c4('0x60')]=util[_0x02c4('0x43')](_0x02c4('0x61'),_0x41b292[_0x02c4('0x5d')],_0x51de23[_0x02c4('0x62')],md5(_0x51de23[_0x02c4('0x62')]));}else{_0x51de23['recordingURL']='';}return getConnection(_0x41b292)[_0x02c4('0x28')](function(_0x17b3e9){_0x1685a0=_0x17b3e9;if(!_[_0x02c4('0x23')](_0x5d21ce)){return getUser(_0x41b292,_0x5d21ce[_0x02c4('0x51')],_0x1685a0);}else{return getUser(_0x41b292,null,_0x1685a0);}})[_0x02c4('0x28')](function(_0x249a68){_0x52ca8c=_0x249a68;return getEndUser(_0x41b292,_0x3fc827,_0x51de23[_0x02c4('0x64')],_0x51de23[_0x02c4('0x65')],_0x1685a0);})[_0x02c4('0x28')](function(_0x43a7c2){_0x1f2914=_0x43a7c2;return getTicket(_0x41b292,_0x52ca8c,_0x1f2914,_0x3fc827,_0x51de23,_0x3fc827[_0x02c4('0x66')],_0x1685a0);})[_0x02c4('0x28')](function(_0x1c86cc){_0x7efec4=_0x1c86cc;logger[_0x02c4('0x1f')]('['+_0x51de23[_0x02c4('0x7d')][_0x02c4('0x7e')]()+_0x02c4('0x7f'),_0x7efec4['id']);logger[_0x02c4('0x1f')]('['+_0x51de23['lastevent'][_0x02c4('0x7e')]()+_0x02c4('0x80'),_0x41b292['type']);})[_0x02c4('0x7c')](function(_0x3a7ec1){logger['error']('['+_0x51de23[_0x02c4('0x7d')][_0x02c4('0x7e')]()+']',_0x3a7ec1);});}; \ No newline at end of file +var _0x0fa3=['email','calleridname','calleridnum','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','none','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','Fields',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','request-promise','jsforce','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','assign','Subjects','getString','ActivityDate','utc','IsRecurrence','contact','endUserType','WhoId','account','ticketType','Case','ContactId','AccountId','leadId','info','sobject','create','isNil','validateEmail','User','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','moduleSearch','contact_lead','additionalSearchContact','merge','$or','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','execute','Contact','lead','Account','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x4b6098,_0x4e8ca2){var _0x22520e=function(_0x1c0b4a){while(--_0x1c0b4a){_0x4b6098['push'](_0x4b6098['shift']());}};_0x22520e(++_0x4e8ca2);}(_0x0fa3,0x18a));var _0x30fa=function(_0x5f265e,_0x5f29c3){_0x5f265e=_0x5f265e-0x0;var _0x197592=_0x0fa3[_0x5f265e];return _0x197592;};'use strict';var _=require('lodash');var rp=require(_0x30fa('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x30fa('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x30fa('0x2'));var logger=require('../../../../config/logger')(_0x30fa('0x3'));config[_0x30fa('0x4')]=_[_0x30fa('0x5')](config[_0x30fa('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x30fa('0x6'))(new Redis(config[_0x30fa('0x4')]));function emit(_0x43b0bc,_0x1e077d,_0x2649d6){io['to'](_0x43b0bc)['emit'](_0x1e077d,_0x2649d6);}function getTicket(_0x48023a,_0x4024ce,_0x346fda,_0x1e69d8,_0x21793f,_0x162a8c,_0x567706,_0x1418c3){var _0x8e7d97=Object[_0x30fa('0x7')]({},{'OwnerId':_0x4024ce['id'],'Subject':intUtil['getString'](_0x1e69d8[_0x30fa('0x8')],_0x21793f,'\x20'),'Description':intUtil[_0x30fa('0x9')](_0x1e69d8['Descriptions'],_0x21793f,'\x0a')},getCustomFields(_0x162a8c,_0x21793f));if(_0x346fda){if(_0x1e69d8['ticketType']==='Task'){_0x8e7d97[_0x30fa('0xa')]=moment[_0x30fa('0xb')]();_0x8e7d97['IsReminderSet']=![];_0x8e7d97[_0x30fa('0xc')]=![];if(_0x346fda['endUserType']===_0x30fa('0xd')||_0x346fda[_0x30fa('0xe')]==='lead'){_0x8e7d97[_0x30fa('0xf')]=_0x346fda['id'];}else if(_0x346fda[_0x30fa('0xe')]===_0x30fa('0x10')){_0x8e7d97['WhatId']=_0x346fda['id'];}}else if(_0x1e69d8[_0x30fa('0x11')]===_0x30fa('0x12')){if(_0x346fda[_0x30fa('0xe')]===_0x30fa('0xd')){_0x8e7d97[_0x30fa('0x13')]=_0x346fda['id'];}else if(_0x346fda[_0x30fa('0xe')]===_0x30fa('0x10')){_0x8e7d97[_0x30fa('0x14')]=_0x346fda['id'];}else if(_0x346fda['endUserType']==='lead'&&_0x1e69d8[_0x30fa('0x15')]){_0x8e7d97[_0x1e69d8[_0x30fa('0x15')]]=_0x346fda['id'];}else{logger[_0x30fa('0x16')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x567706[_0x30fa('0x17')](_0x1e69d8['ticketType'])[_0x30fa('0x18')](_0x8e7d97);}function getUser(_0x50a4cf,_0x514a63,_0x461eac){if(!_[_0x30fa('0x19')](_0x514a63)&&intUtil[_0x30fa('0x1a')](_0x514a63)){var _0x542881={'Email':_0x514a63};var _0x637363={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x461eac['sobject'](_0x30fa('0x1b'))['find'](_0x542881,_0x637363)['execute']()[_0x30fa('0x1c')](function(_0x4d503a){if(_0x4d503a[_0x30fa('0x1d')]){var _0x124389=_[_0x30fa('0x1e')](_0x4d503a,function(_0x15d1b1){return _0x15d1b1[_0x30fa('0x1f')]===_0x514a63;});if(_0x124389){logger[_0x30fa('0x16')]('Agent\x20%s\x20found.',_0x514a63);return BPromise[_0x30fa('0x20')]({'id':_0x124389['Id'],'name':_0x124389[_0x30fa('0x21')]});}}else{logger[_0x30fa('0x16')](_0x30fa('0x22'),_0x514a63);return _0x461eac['identity']()['then'](function(_0x36accf){return BPromise['resolve']({'id':_0x36accf[_0x30fa('0x23')],'name':_0x36accf[_0x30fa('0x24')]});});}});}else{logger[_0x30fa('0x16')](_0x30fa('0x22'),_0x514a63);return _0x461eac[_0x30fa('0x25')]()[_0x30fa('0x1c')](function(_0x524425){return BPromise['resolve']({'id':_0x524425[_0x30fa('0x23')],'name':_0x524425['display_name']});});}}function getEndUser(_0x20751c,_0x5ed139,_0xe5b5db,_0x1263ea,_0x119290){var _0x5913dc={'$or':{'Phone':_0x1263ea}};var _0x201496={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x30fa('0x20')]()[_0x30fa('0x1c')](function(){logger[_0x30fa('0x16')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1263ea,_0x5ed139['moduleSearch']);switch(_0x5ed139[_0x30fa('0x26')]){case _0x30fa('0x27'):var _0x5ac1e3=_['cloneDeep'](_0x5913dc);if(_0x5ed139[_0x30fa('0x28')]){var _0x1f2914={};_0x1f2914[_0x5ed139[_0x30fa('0x28')]]=_0x1263ea;_[_0x30fa('0x29')](_0x5ac1e3[_0x30fa('0x2a')],_0x1f2914);}return _0x119290[_0x30fa('0x17')]('Contact')['find'](_0x5ac1e3,_0x201496)['execute']()[_0x30fa('0x1c')](function(_0x538a0a){if(_0x538a0a&&_0x538a0a['length']){return _0x538a0a;}else{var _0xdda928=_[_0x30fa('0x2b')](_0x5913dc);if(_0x5ed139[_0x30fa('0x2c')]){var _0x1b04ff={};_0x1b04ff[_0x5ed139[_0x30fa('0x2c')]]=_0x1263ea;_['merge'](_0xdda928[_0x30fa('0x2a')],_0x1b04ff);}return _0x119290[_0x30fa('0x17')](_0x30fa('0x2d'))[_0x30fa('0x1e')](_0xdda928,_0x201496);}});case'account_contact_lead':var _0x138f9e=_[_0x30fa('0x2b')](_0x5913dc);if(_0x5ed139[_0x30fa('0x2e')]){var _0x1f2914={};_0x1f2914[_0x5ed139[_0x30fa('0x2e')]]=_0x1263ea;_[_0x30fa('0x29')](_0x138f9e[_0x30fa('0x2a')],_0x1f2914);}return _0x119290['sobject']('Account')[_0x30fa('0x1e')](_0x138f9e,_0x201496)[_0x30fa('0x2f')]()['then'](function(_0x57a134){if(_0x57a134&&_0x57a134['length']){return _0x57a134;}else{var _0x3c7342=_[_0x30fa('0x2b')](_0x5913dc);if(_0x5ed139[_0x30fa('0x28')]){var _0x42accb={};_0x42accb[_0x5ed139[_0x30fa('0x28')]]=_0x1263ea;_[_0x30fa('0x29')](_0x3c7342[_0x30fa('0x2a')],_0x42accb);}return _0x119290[_0x30fa('0x17')](_0x30fa('0x30'))[_0x30fa('0x1e')](_0x3c7342,_0x201496)[_0x30fa('0x1c')](function(_0x3fa227){if(_0x3fa227&&_0x3fa227[_0x30fa('0x1d')]){return _0x3fa227;}else{var _0x34543b=_['cloneDeep'](_0x5913dc);if(_0x5ed139[_0x30fa('0x2c')]){var _0x351c5b={};_0x351c5b[_0x5ed139['additionalSearchLead']]=_0x1263ea;_['merge'](_0x34543b['$or'],_0x351c5b);}return _0x119290[_0x30fa('0x17')](_0x30fa('0x2d'))['find'](_0x34543b,_0x201496);}});}});case'contact':var _0x5ac1e3=_['cloneDeep'](_0x5913dc);if(_0x5ed139[_0x30fa('0x28')]){var _0x1f2914={};_0x1f2914[_0x5ed139['additionalSearchContact']]=_0x1263ea;_[_0x30fa('0x29')](_0x5ac1e3[_0x30fa('0x2a')],_0x1f2914);}return _0x119290[_0x30fa('0x17')](_0x30fa('0x30'))[_0x30fa('0x1e')](_0x5ac1e3,_0x201496)['execute']();case _0x30fa('0x31'):var _0x475878=_['cloneDeep'](_0x5913dc);if(_0x5ed139['additionalSearchLead']){var _0x1f2914={};_0x1f2914[_0x5ed139[_0x30fa('0x2c')]]=_0x1263ea;_['merge'](_0x475878['$or'],_0x1f2914);}return _0x119290[_0x30fa('0x17')](_0x30fa('0x2d'))[_0x30fa('0x1e')](_0x475878,_0x201496);case _0x30fa('0x10'):var _0x138f9e=_[_0x30fa('0x2b')](_0x5913dc);if(_0x5ed139['additionalSearchAccount']){var _0x1f2914={};_0x1f2914[_0x5ed139[_0x30fa('0x2e')]]=_0x1263ea;_[_0x30fa('0x29')](_0x138f9e[_0x30fa('0x2a')],_0x1f2914);}return _0x119290[_0x30fa('0x17')](_0x30fa('0x32'))[_0x30fa('0x1e')](_0x138f9e,_0x201496);default:return null;}})[_0x30fa('0x1c')](function(_0x35a194){if(_0x35a194&&_0x35a194[_0x30fa('0x1d')]){var _0x444f5e=_['first'](_0x35a194);if(_0x444f5e){return BPromise[_0x30fa('0x20')]({'id':_0x444f5e['Id'],'name':_0x444f5e[_0x30fa('0x21')],'phone':_0x444f5e[_0x30fa('0x33')],'endUserType':_0x444f5e[_0x30fa('0x34')]['type'][_0x30fa('0x35')]()});}}})[_0x30fa('0x1c')](function(_0x16e3b0){if(_0x16e3b0){logger['info'](_0x30fa('0x36'),_0x16e3b0['endUserType'],_0x1263ea);return BPromise[_0x30fa('0x20')](_0x16e3b0);}else{logger[_0x30fa('0x16')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x1263ea);var _0x24dcc2={'Phone':_0x1263ea};if(_0x5ed139[_0x30fa('0x37')]){if(_0x5ed139[_0x30fa('0x37')]===_0x30fa('0xd')){logger[_0x30fa('0x16')](_0x30fa('0x38'),_0x1263ea,_0x5ed139[_0x30fa('0x37')]);_0x24dcc2[_0x30fa('0x39')]=_0xe5b5db!==_0x30fa('0x3a')?_0xe5b5db:util[_0x30fa('0x3b')](_0x30fa('0x3c'),_0x1263ea);}else if(_0x5ed139['moduleCreate']===_0x30fa('0x31')){logger[_0x30fa('0x16')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1263ea,_0x5ed139[_0x30fa('0x37')]);_0x24dcc2[_0x30fa('0x39')]=_0xe5b5db!==_0x30fa('0x3a')?_0xe5b5db:util[_0x30fa('0x3b')](_0x30fa('0x3c'),_0x1263ea);_0x24dcc2[_0x30fa('0x3d')]=_0x30fa('0x3e');}else if(_0x5ed139[_0x30fa('0x37')]===_0x30fa('0x10')){logger[_0x30fa('0x16')](_0x30fa('0x38'),_0x1263ea,_0x5ed139[_0x30fa('0x37')]);_0x24dcc2[_0x30fa('0x21')]=_0xe5b5db!==''?_0xe5b5db:util[_0x30fa('0x3b')]('Caller\x20-\x20%s',_0x1263ea);}else{return null;}}return _0x119290[_0x30fa('0x17')](_[_0x30fa('0x3f')](_0x5ed139[_0x30fa('0x37')]))['create'](_0x24dcc2)[_0x30fa('0x1c')](function(_0x3e67f7){return BPromise[_0x30fa('0x20')]({'id':_0x3e67f7['id'],'endUserType':_0x5ed139[_0x30fa('0x37')]});});}});}function getCustomFields(_0x28e852,_0x146c47){var _0x2fd6a0={};if(_0x28e852[_0x30fa('0x1d')]>0x0){_[_0x30fa('0x40')](_0x28e852,function(_0x5b3cc5){if(_[_0x30fa('0x41')]([_0x30fa('0x42'),_0x30fa('0x43')],_0x5b3cc5[_0x30fa('0x44')])&&_0x5b3cc5[_0x30fa('0x45')]){_0x2fd6a0[_0x5b3cc5['idField']]=_0x5b3cc5['content'][_0x30fa('0x46')]();}else if(_0x5b3cc5['type']===_0x30fa('0x47')&&_0x5b3cc5[_0x30fa('0x48')]&&_0x5b3cc5[_0x30fa('0x45')]){_0x146c47[_0x5b3cc5['variableName']]&&(_0x2fd6a0[_0x5b3cc5[_0x30fa('0x45')]]=_0x146c47[_0x5b3cc5[_0x30fa('0x48')]][_0x30fa('0x46')]());}else if(_0x5b3cc5[_0x30fa('0x44')]===_0x30fa('0x49')&&_0x5b3cc5[_0x30fa('0x4a')]&&_0x5b3cc5[_0x30fa('0x4a')][_0x30fa('0x4b')]&&_0x5b3cc5[_0x30fa('0x45')]){_0x146c47[_0x5b3cc5[_0x30fa('0x4a')][_0x30fa('0x4b')][_0x30fa('0x35')]()]&&(_0x2fd6a0[_0x5b3cc5[_0x30fa('0x45')]]=_0x146c47[_0x5b3cc5[_0x30fa('0x4a')][_0x30fa('0x4b')][_0x30fa('0x35')]()]['toString']());}});}return _0x2fd6a0;}function getConnection(_0x59a287){var _0x990d84=_0x59a287[_0x30fa('0x4c')][_0x30fa('0x4d')](_0x59a287[_0x30fa('0x4e')]);var _0x2c6e13=new jsforce[(_0x30fa('0x4f'))]({'oauth2':{'loginUrl':_0x59a287[_0x30fa('0x50')]||_0x30fa('0x51'),'clientId':_0x59a287['clientId'],'clientSecret':_0x59a287[_0x30fa('0x52')]}});return _0x2c6e13[_0x30fa('0x53')](_0x59a287[_0x30fa('0x54')],_0x990d84)['then'](function(){logger[_0x30fa('0x16')](_0x30fa('0x55'));return _0x2c6e13;});}exports['queue']=function(_0xf31b9,_0x9985a6,_0x2ea563,_0x357bd2,_0x2b2231,_0x265810){var _0x4444b7,_0x3af84,_0x53c912,_0x2489c3;_0x265810[_0x30fa('0x56')]=intUtil[_0x30fa('0x57')](_0x265810[_0x30fa('0x56')]);_0x265810[_0x30fa('0x50')]=intUtil[_0x30fa('0x57')](_0x265810['remoteUri']);if(_0x2b2231&&_0x2b2231[_0x30fa('0x58')]){logger[_0x30fa('0x16')](_0x30fa('0x59'),_0x30fa('0x5a'));_0x9985a6[_0x30fa('0x5b')]=util['format'](_0x30fa('0x5c'),_0x265810['serverUrl'],_0x9985a6[_0x30fa('0x5d')],md5(_0x9985a6['uniqueid']));}else{_0x9985a6[_0x30fa('0x5b')]='';}return getConnection(_0x265810)[_0x30fa('0x1c')](function(_0x3fb41a){_0x2489c3=_0x3fb41a;return getUser(_0x265810,_0x357bd2[_0x30fa('0x5e')],_0x2489c3);})[_0x30fa('0x1c')](function(_0x30a92a){_0x4444b7=_0x30a92a;return getEndUser(_0x265810,_0x2ea563,_0x9985a6[_0x30fa('0x5f')],_0x9985a6[_0x30fa('0x60')],_0x2489c3);})[_0x30fa('0x1c')](function(_0xb29283){_0x3af84=_0xb29283;return getTicket(_0x265810,_0x4444b7,_0x3af84,_0x2ea563,_0x9985a6,_0x2ea563['Fields'],_0x2489c3,_0x30fa('0x61'));})[_0x30fa('0x1c')](function(_0x1919e0){_0x53c912=_0x1919e0;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x53c912['id']);logger[_0x30fa('0x16')](_0x30fa('0x62'),_0x53c912['id'],_0x357bd2[_0x30fa('0x4b')],_0x265810['type']);switch(_0x265810[_0x30fa('0x44')]){case _0x30fa('0x63'):emit(util[_0x30fa('0x3b')](_0x30fa('0x64'),_0x357bd2[_0x30fa('0x4b')]),_0x30fa('0x65'),{'recordId':_0x53c912['id']});break;case _0x30fa('0x66'):emit(util[_0x30fa('0x3b')](_0x30fa('0x64'),_0x357bd2['name']),'trigger:browser:url',{'uri':util['format'](_0x30fa('0x67'),_0x2489c3[_0x30fa('0x68')],_0x53c912['id'])});break;default:logger[_0x30fa('0x69')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x4e825b){logger['error'](_0x30fa('0x59'),_0x4e825b);});};exports['outbound']=function(_0x267183,_0x1ac540,_0x98273c,_0x519b0a,_0x41b92b,_0x50618e,_0x1c537a){var _0x3ce431,_0x59983a,_0x2c44d8,_0x282f07;_0x50618e[_0x30fa('0x56')]=intUtil[_0x30fa('0x57')](_0x50618e[_0x30fa('0x56')]);_0x50618e[_0x30fa('0x50')]=intUtil[_0x30fa('0x57')](_0x50618e[_0x30fa('0x50')]);if(_0x1c537a&&_0x1c537a['recordingFormat']&&_0x1c537a['recordingFormat']!==_0x30fa('0x6a')){logger[_0x30fa('0x16')]('[OUTBOUND]',_0x30fa('0x5a'));_0x1ac540[_0x30fa('0x5b')]=util[_0x30fa('0x3b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50618e[_0x30fa('0x56')],_0x1ac540['uniqueid'],md5(_0x1ac540[_0x30fa('0x5d')]));}return getConnection(_0x50618e)['then'](function(_0x4dbc93){_0x282f07=_0x4dbc93;return getUser(_0x50618e,_0x519b0a[_0x30fa('0x5e')],_0x282f07);})[_0x30fa('0x1c')](function(_0xf920e7){_0x3ce431=_0xf920e7;return getEndUser(_0x50618e,_0x98273c,_0x1ac540[_0x30fa('0x6b')],_0x1ac540[_0x30fa('0x6c')],_0x282f07);})[_0x30fa('0x1c')](function(_0x450cbd){_0x59983a=_0x450cbd;return getTicket(_0x50618e,_0x3ce431,_0x59983a,_0x98273c,_0x1ac540,_0x98273c['Fields'],_0x282f07,_0x30fa('0x6d'));})[_0x30fa('0x1c')](function(_0x130732){_0x2c44d8=_0x130732;logger[_0x30fa('0x16')](_0x30fa('0x6e'),_0x2c44d8['id']);logger[_0x30fa('0x16')](_0x30fa('0x6f'),_0x2c44d8['id'],_0x519b0a[_0x30fa('0x4b')],_0x50618e[_0x30fa('0x44')]);switch(_0x50618e[_0x30fa('0x44')]){case _0x30fa('0x63'):emit(util[_0x30fa('0x3b')](_0x30fa('0x64'),_0x519b0a[_0x30fa('0x4b')]),_0x30fa('0x65'),{'recordId':_0x2c44d8['id']});break;case'newTab':emit(util[_0x30fa('0x3b')](_0x30fa('0x64'),_0x519b0a[_0x30fa('0x4b')]),_0x30fa('0x70'),{'uri':util['format'](_0x30fa('0x67'),_0x282f07[_0x30fa('0x68')],_0x2c44d8['id'])});break;default:logger['error'](_0x30fa('0x71'),_0x30fa('0x72'));}})[_0x30fa('0x73')](function(_0x3c928b){logger[_0x30fa('0x69')](_0x30fa('0x71'),_0x3c928b);});};exports[_0x30fa('0x74')]=function(_0x1c4cd5,_0x11c54c,_0x3cdeb8,_0x5c9686,_0x3d03e2,_0x433b05){var _0x279ddc,_0x4064d3,_0x404b35,_0x54d741;_0x433b05['serverUrl']=intUtil[_0x30fa('0x57')](_0x433b05['serverUrl']);_0x433b05[_0x30fa('0x50')]=intUtil['stripTrailingSlash'](_0x433b05[_0x30fa('0x50')]);if(_0x3d03e2&&_0x3d03e2[_0x30fa('0x58')]){logger[_0x30fa('0x16')]('['+_0x11c54c[_0x30fa('0x75')]['toUpperCase']()+']',_0x30fa('0x5a'));_0x11c54c[_0x30fa('0x5b')]=util[_0x30fa('0x3b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x433b05[_0x30fa('0x56')],_0x11c54c[_0x30fa('0x5d')],md5(_0x11c54c[_0x30fa('0x5d')]));}else{_0x11c54c[_0x30fa('0x5b')]='';}return getConnection(_0x433b05)['then'](function(_0xa40979){_0x54d741=_0xa40979;if(!_[_0x30fa('0x19')](_0x5c9686)){return getUser(_0x433b05,_0x5c9686[_0x30fa('0x4b')],_0x54d741);}else{return getUser(_0x433b05,null,_0x54d741);}})[_0x30fa('0x1c')](function(_0x4782ce){_0x279ddc=_0x4782ce;return getEndUser(_0x433b05,_0x3cdeb8,_0x11c54c['calleridname'],_0x11c54c[_0x30fa('0x60')],_0x54d741);})[_0x30fa('0x1c')](function(_0x190c29){_0x4064d3=_0x190c29;return getTicket(_0x433b05,_0x279ddc,_0x4064d3,_0x3cdeb8,_0x11c54c,_0x3cdeb8[_0x30fa('0x76')],_0x54d741);})[_0x30fa('0x1c')](function(_0x105b23){_0x404b35=_0x105b23;logger[_0x30fa('0x16')]('['+_0x11c54c[_0x30fa('0x75')]['toUpperCase']()+_0x30fa('0x77'),_0x404b35['id']);logger[_0x30fa('0x16')]('['+_0x11c54c[_0x30fa('0x75')][_0x30fa('0x78')]()+_0x30fa('0x79'),_0x433b05[_0x30fa('0x44')]);})[_0x30fa('0x73')](function(_0x56f6c8){logger[_0x30fa('0x69')]('['+_0x11c54c[_0x30fa('0x75')]['toUpperCase']()+']',_0x56f6c8);});}; \ 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 07fe915..8b5ba11 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 _0x8a59=['getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','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','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign'];(function(_0x63b8af,_0x12dca8){var _0x417438=function(_0x31a6c5){while(--_0x31a6c5){_0x63b8af['push'](_0x63b8af['shift']());}};_0x417438(++_0x12dca8);}(_0x8a59,0x181));var _0x98a5=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x8a59[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x98a5('0x0'));var Promise=require(_0x98a5('0x1'));var rp=require(_0x98a5('0x2'));var util=require(_0x98a5('0x3'));var md5=require('md5');var Redis=require(_0x98a5('0x4'));var intUtil=require(_0x98a5('0x5'));var config=require('../../../../config/environment');var logger=require(_0x98a5('0x6'))(_0x98a5('0x7'));config[_0x98a5('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x98a5('0x9'))(new Redis(config[_0x98a5('0x8')]));function getAdminUser(_0xb618e4,_0x389e43,_0x2af41c,_0xde73a7,_0x4693d3,_0x4fa02f){return new Promise(function(_0x422a61,_0x2f1e8a){var _0x481add={'method':_0x98a5('0xa'),'uri':_0xde73a7+_0x98a5('0xb')+'&'+_0x4693d3+'&'+_0x4fa02f,'auth':_0x389e43,'json':!![]};return rp(_0x481add)[_0x98a5('0xc')](function(_0x972da9){if(_0x972da9[_0x98a5('0xd')][_0x98a5('0xe')]>0x0){_0x2af41c[_0x98a5('0xf')]=_0x972da9['result'][0x0][_0x98a5('0x10')];}logger[_0x98a5('0x11')]('['+[_0xb618e4[_0x98a5('0x12')]()]+_0x98a5('0x13'),_0x2af41c);_0x422a61(_0x2af41c);})[_0x98a5('0x14')](function(_0x16cb56){logger[_0x98a5('0x15')]('['+[_0xb618e4[_0x98a5('0x12')]()]+']',_0x16cb56[_0x98a5('0x16')]);_0x2f1e8a(_0x16cb56[_0x98a5('0x16')]);});});}function getUser(_0x2634e6,_0x37bb4b,_0x2f68f5,_0xeebf4f,_0x57c9d7){return function(_0x299038){logger[_0x98a5('0x11')]('['+[_0x2634e6['toUpperCase']()]+_0x98a5('0x17'),_0x299038);return new Promise(function(_0x8b5926,_0x19a1b5){if(intUtil['validateEmail'](_0x299038[_0x98a5('0x18')])){var _0x481aa3={'method':_0x98a5('0xa'),'uri':_0x2f68f5+_0x98a5('0x19')+_0x299038[_0x98a5('0x18')]+'&'+_0xeebf4f+'&'+_0x57c9d7,'auth':_0x37bb4b,'json':!![]};logger[_0x98a5('0x11')]('['+[_0x2634e6[_0x98a5('0x12')]()]+_0x98a5('0x1a'),_0x481aa3);return rp(_0x481aa3)[_0x98a5('0xc')](function(_0x33c421){logger['info']('['+[_0x2634e6[_0x98a5('0x12')]()]+_0x98a5('0x1b'),_0x33c421);if(_0x33c421[_0x98a5('0xd')][_0x98a5('0xe')]>0x0&&String(_0x33c421[_0x98a5('0xd')][0x0][_0x98a5('0x1c')])===_0x98a5('0x1d')){_0x299038['userId']=_0x33c421['result'][0x0][_0x98a5('0x10')];}else{_0x299038[_0x98a5('0x1e')]=_0x299038['adminId'];_0x299038[_0x98a5('0x18')]=_0x299038[_0x98a5('0x1f')];}logger['info']('['+[_0x2634e6[_0x98a5('0x12')]()]+_0x98a5('0x20'),_0x299038);_0x8b5926(_0x299038);})[_0x98a5('0x14')](function(_0x198192){logger['error']('['+[_0x2634e6[_0x98a5('0x12')]()]+']',_0x198192[_0x98a5('0x16')]);_0x19a1b5(_0x198192[_0x98a5('0x16')]);});}else{logger[_0x98a5('0x11')]('['+[_0x2634e6[_0x98a5('0x12')]()]+_0x98a5('0x21'));_0x299038[_0x98a5('0x1e')]=_0x299038[_0x98a5('0xf')];_0x299038[_0x98a5('0x18')]=_0x299038[_0x98a5('0x1f')];_0x8b5926(_0x299038);}});};}function createEndUser(_0x5916f5,_0xa59167,_0x3b66d7,_0x2039a8,_0x14ced7){logger[_0x98a5('0x11')]('['+[_0x5916f5[_0x98a5('0x12')]()]+_0x98a5('0x22'),_0x3b66d7);return new Promise(function(_0x1a88fc,_0x1b26b0){var _0x22691d={'method':_0x98a5('0x23'),'uri':_0x2039a8+_0x98a5('0x24')+_0x14ced7,'body':{'user_name':_0x3b66d7[_0x98a5('0x25')],'roles':_0x98a5('0x26'),'first_name':_0x3b66d7[_0x98a5('0x25')],'active':_0x98a5('0x1d'),'date_format':_0x98a5('0x27'),'phone':_0x3b66d7['endUserNumber']},'auth':_0xa59167,'json':!![]};return rp(_0x22691d)[_0x98a5('0xc')](function(_0x27261e){logger['info']('['+[_0x5916f5['toUpperCase']()]+_0x98a5('0x28'),_0x27261e[_0x98a5('0xd')]);_0x3b66d7[_0x98a5('0x29')]=_0x27261e[_0x98a5('0xd')]['sys_id'];_0x1a88fc(_0x3b66d7);})[_0x98a5('0x14')](function(_0x7ad605){logger[_0x98a5('0x15')]('['+[_0x5916f5[_0x98a5('0x12')]()]+']',_0x7ad605['message']);_0x1b26b0(_0x7ad605[_0x98a5('0x16')]);});});}function getEndUser(_0x395ebf,_0x592ac0,_0x570006,_0x6499b6,_0x4beedc){return function(_0x3b186e){logger[_0x98a5('0x11')]('['+[_0x395ebf[_0x98a5('0x12')]()]+_0x98a5('0x2a'),_0x3b186e);return new Promise(function(_0x4ebbb7,_0x13e525){var _0x26ee78={'method':_0x98a5('0xa'),'uri':_0x570006+_0x98a5('0x2b')+_0x3b186e[_0x98a5('0x25')]+'&'+_0x6499b6+'&'+_0x4beedc,'auth':_0x592ac0,'json':!![]};return rp(_0x26ee78)[_0x98a5('0xc')](function(_0x3381a8){if(_0x3381a8[_0x98a5('0xd')][_0x98a5('0xe')]>0x0){_0x3b186e[_0x98a5('0x29')]=_0x3381a8[_0x98a5('0xd')][0x0]['sys_id'];logger[_0x98a5('0x11')]('['+[_0x395ebf[_0x98a5('0x12')]()]+_0x98a5('0x2c'),_0x3b186e);_0x4ebbb7(_0x3b186e);}else{return createEndUser(_0x395ebf,_0x592ac0,_0x3b186e,_0x570006,_0x6499b6)['then'](function(_0x3317f4){logger[_0x98a5('0x11')]('['+[_0x395ebf[_0x98a5('0x12')]()]+'],\x20createEndUser\x20crm',_0x3317f4);_0x4ebbb7(_0x3317f4);});}})[_0x98a5('0x14')](function(_0x178d47){logger[_0x98a5('0x15')]('['+[_0x395ebf[_0x98a5('0x12')]()]+']',_0x178d47['message']);_0x13e525(_0x178d47[_0x98a5('0x16')]);});});};}function getCustomFields(_0x32a652,_0x203e95){var _0xc79a2e={};if(_0x32a652[_0x98a5('0xe')]>0x0){_[_0x98a5('0x2d')](_0x32a652,function(_0x4fe3fa){if(_[_0x98a5('0x2e')]([_0x98a5('0x2f'),'picklist'],_0x4fe3fa[_0x98a5('0x30')])&&_0x4fe3fa[_0x98a5('0x31')]&&!_0x4fe3fa[_0x98a5('0x32')]){_0xc79a2e[_0x4fe3fa[_0x98a5('0x31')][_0x98a5('0x33')]()]=_0x4fe3fa[_0x98a5('0x34')][_0x98a5('0x35')]();}else if(_[_0x98a5('0x2e')](['string',_0x98a5('0x36')],_0x4fe3fa[_0x98a5('0x30')])&&_0x4fe3fa[_0x98a5('0x37')]&&_0x4fe3fa[_0x98a5('0x32')]){_0xc79a2e[_0x4fe3fa[_0x98a5('0x37')]['toLowerCase']()]=_0x4fe3fa[_0x98a5('0x34')][_0x98a5('0x35')]();}else if(_0x4fe3fa[_0x98a5('0x30')]==='variable'&&_0x4fe3fa['variableName']&&_0x4fe3fa[_0x98a5('0x37')]&&_0x4fe3fa[_0x98a5('0x32')]){_0xc79a2e[_0x4fe3fa['idField'][_0x98a5('0x33')]()]=_0x203e95[_0x4fe3fa[_0x98a5('0x38')]]['toString']();}else if(_0x4fe3fa[_0x98a5('0x30')]===_0x98a5('0x39')&&_0x4fe3fa[_0x98a5('0x3a')]&&_0x4fe3fa[_0x98a5('0x3a')]['name']&&_0x4fe3fa[_0x98a5('0x37')]&&_0x4fe3fa[_0x98a5('0x32')]){_0xc79a2e[_0x4fe3fa[_0x98a5('0x37')][_0x98a5('0x33')]()]=_0x203e95[_0x4fe3fa[_0x98a5('0x3a')][_0x98a5('0x3b')][_0x98a5('0x33')]()][_0x98a5('0x35')]();}});}return _0xc79a2e;}function getTicket(_0x3d2461,_0x6fdb47,_0x3622c9,_0xe80201,_0x47152d,_0x454fe0){return function(_0x4c7333){logger[_0x98a5('0x11')]('['+[_0x3d2461[_0x98a5('0x12')]()]+_0x98a5('0x3c'),_0x4c7333);return new Promise(function(_0x57dd98,_0x1604e7){var _0x2df148=_0x3d2461[_0x98a5('0x33')]()==='outbound'?_0x4c7333['userId']:_0x4c7333[_0x98a5('0x29')];var _0x55fe27={'method':_0x98a5('0x23'),'uri':_0x3622c9+_0x98a5('0x3d')+'?'+_0x454fe0,'body':Object[_0x98a5('0x3e')]({},{'active':'true','caller_id':_0x2df148,'assigned_to':_0x4c7333[_0x98a5('0x1e')],'short_description':intUtil[_0x98a5('0x3f')](_0xe80201[_0x98a5('0x40')],_0x47152d,'\x20'),'description':intUtil[_0x98a5('0x3f')](_0xe80201[_0x98a5('0x41')],_0x47152d,'\x0a')},getCustomFields(_0xe80201[_0x98a5('0x42')],_0x47152d)),'auth':_0x6fdb47,'json':!![]};return rp(_0x55fe27)['then'](function(_0x3fc1ac){logger[_0x98a5('0x11')]('['+[_0x3d2461['toUpperCase']()]+_0x98a5('0x43'),_0x3fc1ac[_0x98a5('0xd')]);_0x4c7333[_0x98a5('0x44')]=_0x3fc1ac[_0x98a5('0xd')][_0x98a5('0x10')];_0x4c7333[_0x98a5('0x45')]=_0x3fc1ac[_0x98a5('0xd')][_0x98a5('0x46')];logger[_0x98a5('0x11')]('['+[_0x3d2461[_0x98a5('0x12')]()]+_0x98a5('0x47'),_0x4c7333);_0x57dd98(_0x4c7333);})['catch'](function(_0x2e3e6b){logger[_0x98a5('0x15')]('['+[_0x3d2461[_0x98a5('0x12')]()]+']',_0x2e3e6b[_0x98a5('0x16')]);_0x1604e7(_0x2e3e6b['message']);});});};}function createRemoteTag(_0x396bbc,_0x3c41dc,_0x339710,_0x23ddd6){return new Promise(function(_0x36cbad,_0x4072c4){var _0x36fcba={'method':_0x98a5('0x23'),'uri':_0x339710+_0x98a5('0x48')+'?'+_0x23ddd6,'body':{'short_description':_0x396bbc,'global':!![],'active':!![],'name':_0x396bbc},'auth':_0x3c41dc,'json':!![]};return rp(_0x36fcba)[_0x98a5('0xc')](function(_0x2de396){var _0x36ca48=_0x2de396[_0x98a5('0xd')]['sys_id'];_0x36cbad(_0x36ca48);});});}function getRemoteTag(_0x5e9c98,_0x4d29b4,_0x18bc0e,_0x61302b,_0x8c58a8){return new Promise(function(_0x4d1e56,_0x165070){var _0x40e2de={'method':'GET','uri':_0x18bc0e+'label'+_0x98a5('0x49')+_0x5e9c98+'&'+_0x61302b,'auth':_0x4d29b4,'json':!![]};return rp(_0x40e2de)['then'](function(_0x52fbdf){if(_0x52fbdf[_0x98a5('0xd')][_0x98a5('0xe')]>0x0){var _0x1b1f99=_0x52fbdf[_0x98a5('0xd')][0x0][_0x98a5('0x10')];_0x4d1e56(_0x1b1f99);}else{return createRemoteTag(_0x5e9c98,_0x4d29b4,_0x18bc0e,_0x61302b)['then'](function(_0x95f5bb){_0x4d1e56(_0x95f5bb);});}});});}function assignTagToIncident(_0xa96187,_0x1cb5f7,_0x5c3456,_0x143e2c,_0x25eaae){return new Promise(function(_0x3e1977,_0x490e38){var _0x440d12={'method':_0x98a5('0x23'),'uri':_0x5c3456+_0x98a5('0x4a')+'?'+_0x25eaae,'body':{'label':_0xa96187,'table':_0x98a5('0x3d'),'id_type':'Incident','table_key':_0x143e2c['ticketId'],'title':'Incident\x20-\x20'+_0x143e2c[_0x98a5('0x45')],'id_display':_0x143e2c[_0x98a5('0x45')]},'auth':_0x1cb5f7,'json':!![]};return rp(_0x440d12)[_0x98a5('0xc')](function(_0x4257aa){_0x3e1977();})[_0x98a5('0x14')](function(){_0x3e1977();});});}function manageTags(_0x407595,_0x398a72,_0x509854,_0xd71d68,_0x22a600,_0x5b5ea6,_0x3a45f3){return new Promise(function(_0x1e4a0c,_0x2f936d){var _0x620f8a=[];_0x398a72[_0x98a5('0x2d')](function(_0x217f38){_0x620f8a[_0x98a5('0x4b')](getRemoteTag(_0x217f38,_0x509854,_0xd71d68,_0x5b5ea6,_0x3a45f3));});return Promise[_0x98a5('0x4c')](_0x620f8a)[_0x98a5('0xc')](function(_0x304496){if(_0x304496[_0x98a5('0xe')]){logger[_0x98a5('0x11')]('['+[_0x407595[_0x98a5('0x12')]()]+_0x98a5('0x4d'),_0x304496);var _0x438f34=[];_0x304496[_0x98a5('0x2d')](function(_0x3b831){_0x438f34[_0x98a5('0x4b')](assignTagToIncident(_0x3b831,_0x509854,_0xd71d68,_0x22a600,_0x5b5ea6));});return Promise[_0x98a5('0x4c')](_0x438f34)[_0x98a5('0xc')](function(){_0x1e4a0c();})[_0x98a5('0x14')](function(){_0x1e4a0c();});}else{_0x1e4a0c();}});});}function getTags(_0x499f25,_0x121ad4,_0x5d4272,_0x461149,_0x219a85,_0xd9d4e1){return function(_0x2c404b){return new Promise(function(_0x2500d5,_0x391369){var _0x40fa13=[];var _0xab447f=_0x461149[_0x98a5('0x4e')];if(_0xab447f&&_0xab447f[_0x98a5('0xe')]>0x0){_0x40fa13=_[_0x98a5('0x4f')](_0xab447f,'name');}if(_0x40fa13['length']>0x0){return manageTags(_0x499f25,_0x40fa13,_0x121ad4,_0x5d4272,_0x2c404b,_0x219a85,_0xd9d4e1)[_0x98a5('0xc')](function(){_0x2500d5(_0x2c404b);});}else{_0x2500d5(_0x2c404b);}});};}function emit(_0x57d301,_0x3a1e56,_0x3e7462){var _0xa44307=_0x98a5('0x50')+_0x98a5('0x51')+_0x98a5('0x52')+'%255EORDERBYDESCnumber';var _0x292a6d={'uri':_0x57d301+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3e7462+_0xa44307};io['to'](util[_0x98a5('0x53')](_0x98a5('0x54'),_0x3a1e56))[_0x98a5('0x55')](_0x98a5('0x56'),_0x292a6d);}exports['cs']=function(_0x31a1dd,_0x59a84a,_0x3dae5e,_0x4b956b,_0x3d4ba9,_0x14f4fe,_0x145777,_0x5e4d1d){var _0xe84c29={};var _0x23dce2={'user':_0x14f4fe['username'],'pass':_0x14f4fe[_0x98a5('0x57')]};var _0x11db53=_0x98a5('0x58');var _0x3233bd='sysparm_display_value=true';_0x14f4fe[_0x98a5('0x59')]=intUtil['stripTrailingSlash'](_0x14f4fe[_0x98a5('0x59')]);_0x14f4fe[_0x98a5('0x5a')]=intUtil[_0x98a5('0x5b')](_0x14f4fe[_0x98a5('0x5a')]);var _0xb9ec9c=util[_0x98a5('0x53')](_0x98a5('0x5c'),_0x14f4fe['remoteUri']);_0xe84c29[_0x98a5('0x18')]=!_[_0x98a5('0x5d')](_0x4b956b)?_0x4b956b[_0x98a5('0x5e')]:null;_0xe84c29[_0x98a5('0x1f')]=_0x14f4fe[_0x98a5('0x5e')];_0xe84c29[_0x98a5('0x25')]=_0x5e4d1d['toLowerCase']()===_0x98a5('0x5f')?_0x59a84a[_0x98a5('0x60')]:_0x59a84a[_0x98a5('0x61')];_0xe84c29[_0x98a5('0x62')]=_0x5e4d1d===_0x98a5('0x63')||_0x5e4d1d===_0x98a5('0x64')?_0x98a5('0x63'):'outbound';var _0x4ad899=util['format'](_0x98a5('0x65'),_0x14f4fe[_0x98a5('0x5a')],_0x59a84a[_0x98a5('0x66')],md5(_0x59a84a['uniqueid']));if(_0x3d4ba9&&_0x3d4ba9[_0x98a5('0x67')]){logger[_0x98a5('0x11')]('[QUEUE]',_0x98a5('0x68'));_0x59a84a[_0x98a5('0x69')]=_0x4ad899;}else if(_0x145777&&_0x145777['recordingFormat']&&_0x145777[_0x98a5('0x6a')]!==_0x98a5('0x6b')){logger[_0x98a5('0x11')]('[OUTBOUND]',_0x98a5('0x68'));_0x59a84a[_0x98a5('0x69')]=_0x4ad899;}else{_0x59a84a[_0x98a5('0x69')]='';}return getAdminUser(_0x5e4d1d,_0x23dce2,_0xe84c29,_0xb9ec9c,_0x3233bd,_0x11db53)[_0x98a5('0xc')](getUser(_0x5e4d1d,_0x23dce2,_0xb9ec9c,_0x3233bd,_0x11db53))['then'](getEndUser(_0x5e4d1d,_0x23dce2,_0xb9ec9c,_0x3233bd,_0x11db53))[_0x98a5('0xc')](getTicket(_0x5e4d1d,_0x23dce2,_0xb9ec9c,_0x3dae5e,_0x59a84a,_0x3233bd))[_0x98a5('0xc')](function(_0x1e5cbf){logger['info'](util[_0x98a5('0x53')](_0x98a5('0x6c'),_0x1e5cbf[_0x98a5('0x44')]));logger['info'](util[_0x98a5('0x53')](_0x98a5('0x6d'),_0x5e4d1d));if(_0x5e4d1d!==_0x98a5('0x64')){logger[_0x98a5('0x11')]('['+[_0x5e4d1d[_0x98a5('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x14f4fe[_0x98a5('0x59')],_0x4b956b['name'],_0x1e5cbf[_0x98a5('0x44')]);}})[_0x98a5('0x14')](function(_0x25a2be){logger[_0x98a5('0x15')]('['+[_0x5e4d1d[_0x98a5('0x12')]()]+_0x98a5('0x6e'),util[_0x98a5('0x6f')](_0x25a2be,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x57eb=['stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','adminId','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','toLowerCase','toString','type','idField','customField','content','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1'];(function(_0x1e0fd0,_0x59f0a4){var _0x23c29e=function(_0x3a7dc9){while(--_0x3a7dc9){_0x1e0fd0['push'](_0x1e0fd0['shift']());}};_0x23c29e(++_0x59f0a4);}(_0x57eb,0xf2));var _0xb57e=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x57eb[_0x2714ec];return _0x2608e5;};'use strict';var _=require('lodash');var Promise=require(_0xb57e('0x0'));var rp=require(_0xb57e('0x1'));var util=require('util');var md5=require(_0xb57e('0x2'));var Redis=require(_0xb57e('0x3'));var intUtil=require(_0xb57e('0x4'));var config=require(_0xb57e('0x5'));var logger=require('../../../../config/logger')('servicenow');config[_0xb57e('0x6')]=_['defaults'](config[_0xb57e('0x6')],{'host':_0xb57e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x45df59,_0x5bbcaa,_0x22f749,_0x2253c6,_0x2acec0,_0x4cfa7a){return new Promise(function(_0x2342ac,_0x274f3b){var _0x2a6038={'method':_0xb57e('0x8'),'uri':_0x2253c6+_0xb57e('0x9')+'&'+_0x2acec0+'&'+_0x4cfa7a,'auth':_0x5bbcaa,'json':!![]};return rp(_0x2a6038)[_0xb57e('0xa')](function(_0x865f76){if(_0x865f76[_0xb57e('0xb')][_0xb57e('0xc')]>0x0){_0x22f749['adminId']=_0x865f76['result'][0x0][_0xb57e('0xd')];}logger[_0xb57e('0xe')]('['+[_0x45df59[_0xb57e('0xf')]()]+'],\x20getAdminUser\x20crm',_0x22f749);_0x2342ac(_0x22f749);})[_0xb57e('0x10')](function(_0x4e1946){logger[_0xb57e('0x11')]('['+[_0x45df59[_0xb57e('0xf')]()]+']',_0x4e1946[_0xb57e('0x12')]);_0x274f3b(_0x4e1946['message']);});});}function getUser(_0x496318,_0x1f7f69,_0x582c59,_0x3cbc35,_0x3557a6){return function(_0x563e10){logger[_0xb57e('0xe')]('['+[_0x496318[_0xb57e('0xf')]()]+_0xb57e('0x13'),_0x563e10);return new Promise(function(_0x5837ca,_0xcc6f06){if(intUtil[_0xb57e('0x14')](_0x563e10[_0xb57e('0x15')])){var _0x14eff7={'method':'GET','uri':_0x582c59+_0xb57e('0x16')+_0x563e10['userEmail']+'&'+_0x3cbc35+'&'+_0x3557a6,'auth':_0x1f7f69,'json':!![]};logger[_0xb57e('0xe')]('['+[_0x496318['toUpperCase']()]+_0xb57e('0x17'),_0x14eff7);return rp(_0x14eff7)['then'](function(_0x44ab79){logger['info']('['+[_0x496318['toUpperCase']()]+_0xb57e('0x18'),_0x44ab79);if(_0x44ab79[_0xb57e('0xb')][_0xb57e('0xc')]>0x0&&String(_0x44ab79[_0xb57e('0xb')][0x0][_0xb57e('0x19')])===_0xb57e('0x1a')){_0x563e10['userId']=_0x44ab79[_0xb57e('0xb')][0x0][_0xb57e('0xd')];}else{_0x563e10[_0xb57e('0x1b')]=_0x563e10['adminId'];_0x563e10[_0xb57e('0x15')]=_0x563e10[_0xb57e('0x1c')];}logger[_0xb57e('0xe')]('['+[_0x496318['toUpperCase']()]+_0xb57e('0x1d'),_0x563e10);_0x5837ca(_0x563e10);})[_0xb57e('0x10')](function(_0x13d4f3){logger[_0xb57e('0x11')]('['+[_0x496318[_0xb57e('0xf')]()]+']',_0x13d4f3['message']);_0xcc6f06(_0x13d4f3['message']);});}else{logger[_0xb57e('0xe')]('['+[_0x496318['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x563e10[_0xb57e('0x1b')]=_0x563e10[_0xb57e('0x1e')];_0x563e10[_0xb57e('0x15')]=_0x563e10[_0xb57e('0x1c')];_0x5837ca(_0x563e10);}});};}function createEndUser(_0x10cfbc,_0x1f98e9,_0x1fe3de,_0x42d9aa,_0x7ee02f){logger[_0xb57e('0xe')]('['+[_0x10cfbc[_0xb57e('0xf')]()]+_0xb57e('0x1f'),_0x1fe3de);return new Promise(function(_0xcd05bb,_0x23c0d2){var _0x54d030={'method':_0xb57e('0x20'),'uri':_0x42d9aa+'sys_user?'+_0x7ee02f,'body':{'user_name':_0x1fe3de[_0xb57e('0x21')],'roles':_0xb57e('0x22'),'first_name':_0x1fe3de[_0xb57e('0x21')],'active':_0xb57e('0x1a'),'date_format':_0xb57e('0x23'),'phone':_0x1fe3de['endUserNumber']},'auth':_0x1f98e9,'json':!![]};return rp(_0x54d030)['then'](function(_0x4f8995){logger[_0xb57e('0xe')]('['+[_0x10cfbc[_0xb57e('0xf')]()]+_0xb57e('0x24'),_0x4f8995[_0xb57e('0xb')]);_0x1fe3de[_0xb57e('0x25')]=_0x4f8995['result'][_0xb57e('0xd')];_0xcd05bb(_0x1fe3de);})[_0xb57e('0x10')](function(_0x2de261){logger[_0xb57e('0x11')]('['+[_0x10cfbc['toUpperCase']()]+']',_0x2de261['message']);_0x23c0d2(_0x2de261['message']);});});}function getEndUser(_0xe15b68,_0x4b43e3,_0x1997f4,_0x137f1d,_0x43c14f){return function(_0x520d25){logger['info']('['+[_0xe15b68[_0xb57e('0xf')]()]+_0xb57e('0x26'),_0x520d25);return new Promise(function(_0xd47f9a,_0x5dacd3){var _0x146da={'method':_0xb57e('0x8'),'uri':_0x1997f4+'sys_user?sysparm_query=phone%3D'+_0x520d25['endUserNumber']+'&'+_0x137f1d+'&'+_0x43c14f,'auth':_0x4b43e3,'json':!![]};return rp(_0x146da)[_0xb57e('0xa')](function(_0x3d0182){if(_0x3d0182[_0xb57e('0xb')][_0xb57e('0xc')]>0x0){_0x520d25[_0xb57e('0x25')]=_0x3d0182[_0xb57e('0xb')][0x0][_0xb57e('0xd')];logger[_0xb57e('0xe')]('['+[_0xe15b68['toUpperCase']()]+_0xb57e('0x27'),_0x520d25);_0xd47f9a(_0x520d25);}else{return createEndUser(_0xe15b68,_0x4b43e3,_0x520d25,_0x1997f4,_0x137f1d)[_0xb57e('0xa')](function(_0x48ba19){logger[_0xb57e('0xe')]('['+[_0xe15b68['toUpperCase']()]+_0xb57e('0x28'),_0x48ba19);_0xd47f9a(_0x48ba19);});}})[_0xb57e('0x10')](function(_0x4991bb){logger[_0xb57e('0x11')]('['+[_0xe15b68['toUpperCase']()]+']',_0x4991bb[_0xb57e('0x12')]);_0x5dacd3(_0x4991bb[_0xb57e('0x12')]);});});};}function getCustomFields(_0x5e6e37,_0x4e4187){var _0x5cb35b={};if(_0x5e6e37[_0xb57e('0xc')]>0x0){_[_0xb57e('0x29')](_0x5e6e37,function(_0x3f5e64){if(_[_0xb57e('0x2a')]([_0xb57e('0x2b'),_0xb57e('0x2c')],_0x3f5e64['type'])&&_0x3f5e64[_0xb57e('0x2d')]&&!_0x3f5e64['customField']){_0x5cb35b[_0x3f5e64[_0xb57e('0x2d')][_0xb57e('0x2e')]()]=_0x3f5e64['content'][_0xb57e('0x2f')]();}else if(_[_0xb57e('0x2a')]([_0xb57e('0x2b'),_0xb57e('0x2c')],_0x3f5e64[_0xb57e('0x30')])&&_0x3f5e64[_0xb57e('0x31')]&&_0x3f5e64[_0xb57e('0x32')]){_0x5cb35b[_0x3f5e64['idField'][_0xb57e('0x2e')]()]=_0x3f5e64[_0xb57e('0x33')][_0xb57e('0x2f')]();}else if(_0x3f5e64[_0xb57e('0x30')]==='variable'&&_0x3f5e64[_0xb57e('0x34')]&&_0x3f5e64[_0xb57e('0x31')]&&_0x3f5e64[_0xb57e('0x32')]){_0x5cb35b[_0x3f5e64['idField']['toLowerCase']()]=_0x4e4187[_0x3f5e64['variableName']]['toString']();}else if(_0x3f5e64[_0xb57e('0x30')]===_0xb57e('0x35')&&_0x3f5e64[_0xb57e('0x36')]&&_0x3f5e64['Variable'][_0xb57e('0x37')]&&_0x3f5e64[_0xb57e('0x31')]&&_0x3f5e64[_0xb57e('0x32')]){_0x5cb35b[_0x3f5e64[_0xb57e('0x31')][_0xb57e('0x2e')]()]=_0x4e4187[_0x3f5e64[_0xb57e('0x36')][_0xb57e('0x37')][_0xb57e('0x2e')]()][_0xb57e('0x2f')]();}});}return _0x5cb35b;}function getTicket(_0x4ac03d,_0x2ada76,_0x198bee,_0x2d9081,_0x2ae99f,_0x4e9468){return function(_0x42d14a){logger['info']('['+[_0x4ac03d[_0xb57e('0xf')]()]+']\x20getTicket\x20input\x20crm',_0x42d14a);return new Promise(function(_0x2833e7,_0x4e4773){var _0x219d4d=_0x4ac03d[_0xb57e('0x2e')]()===_0xb57e('0x38')?_0x42d14a[_0xb57e('0x1b')]:_0x42d14a[_0xb57e('0x25')];var _0x148b9d={'method':_0xb57e('0x20'),'uri':_0x198bee+_0xb57e('0x39')+'?'+_0x4e9468,'body':Object[_0xb57e('0x3a')]({},{'active':_0xb57e('0x1a'),'caller_id':_0x219d4d,'assigned_to':_0x42d14a[_0xb57e('0x1b')],'short_description':intUtil[_0xb57e('0x3b')](_0x2d9081[_0xb57e('0x3c')],_0x2ae99f,'\x20'),'description':intUtil[_0xb57e('0x3b')](_0x2d9081['Descriptions'],_0x2ae99f,'\x0a')},getCustomFields(_0x2d9081[_0xb57e('0x3d')],_0x2ae99f)),'auth':_0x2ada76,'json':!![]};return rp(_0x148b9d)[_0xb57e('0xa')](function(_0x332c8f){logger[_0xb57e('0xe')]('['+[_0x4ac03d[_0xb57e('0xf')]()]+_0xb57e('0x3e'),_0x332c8f[_0xb57e('0xb')]);_0x42d14a['ticketId']=_0x332c8f[_0xb57e('0xb')]['sys_id'];_0x42d14a[_0xb57e('0x3f')]=_0x332c8f[_0xb57e('0xb')][_0xb57e('0x40')];logger[_0xb57e('0xe')]('['+[_0x4ac03d[_0xb57e('0xf')]()]+_0xb57e('0x41'),_0x42d14a);_0x2833e7(_0x42d14a);})[_0xb57e('0x10')](function(_0x3ae820){logger[_0xb57e('0x11')]('['+[_0x4ac03d['toUpperCase']()]+']',_0x3ae820[_0xb57e('0x12')]);_0x4e4773(_0x3ae820[_0xb57e('0x12')]);});});};}function createRemoteTag(_0x213a99,_0x45c361,_0x13d4a4,_0x60cdf6){return new Promise(function(_0x285048,_0x1a8303){var _0x3b7b29={'method':_0xb57e('0x20'),'uri':_0x13d4a4+_0xb57e('0x42')+'?'+_0x60cdf6,'body':{'short_description':_0x213a99,'global':!![],'active':!![],'name':_0x213a99},'auth':_0x45c361,'json':!![]};return rp(_0x3b7b29)['then'](function(_0x10d62d){var _0x180de7=_0x10d62d[_0xb57e('0xb')][_0xb57e('0xd')];_0x285048(_0x180de7);});});}function getRemoteTag(_0x44e1d6,_0x1f9ab6,_0x3456b1,_0x58bc6f,_0x1544a3){return new Promise(function(_0x26e34d,_0x307037){var _0x4f254c={'method':_0xb57e('0x8'),'uri':_0x3456b1+_0xb57e('0x42')+'?sysparm_query=name%3D'+_0x44e1d6+'&'+_0x58bc6f,'auth':_0x1f9ab6,'json':!![]};return rp(_0x4f254c)[_0xb57e('0xa')](function(_0x4778b6){if(_0x4778b6[_0xb57e('0xb')][_0xb57e('0xc')]>0x0){var _0xe083fd=_0x4778b6[_0xb57e('0xb')][0x0][_0xb57e('0xd')];_0x26e34d(_0xe083fd);}else{return createRemoteTag(_0x44e1d6,_0x1f9ab6,_0x3456b1,_0x58bc6f)[_0xb57e('0xa')](function(_0x22f314){_0x26e34d(_0x22f314);});}});});}function assignTagToIncident(_0x581336,_0x386223,_0x2b8d22,_0x390f57,_0x4c59b7){return new Promise(function(_0x5bf583,_0x24a052){var _0x4bdd4b={'method':_0xb57e('0x20'),'uri':_0x2b8d22+_0xb57e('0x43')+'?'+_0x4c59b7,'body':{'label':_0x581336,'table':_0xb57e('0x39'),'id_type':_0xb57e('0x44'),'table_key':_0x390f57['ticketId'],'title':_0xb57e('0x45')+_0x390f57['ticketNumber'],'id_display':_0x390f57[_0xb57e('0x3f')]},'auth':_0x386223,'json':!![]};return rp(_0x4bdd4b)[_0xb57e('0xa')](function(_0x5f2d2d){_0x5bf583();})[_0xb57e('0x10')](function(){_0x5bf583();});});}function manageTags(_0x35a4e3,_0x558bc0,_0x152002,_0x205dcb,_0x563748,_0xf75f,_0xdafbd4){return new Promise(function(_0x30fb1a,_0xd1a3f){var _0x5c9ac2=[];_0x558bc0[_0xb57e('0x29')](function(_0x17737c){_0x5c9ac2['push'](getRemoteTag(_0x17737c,_0x152002,_0x205dcb,_0xf75f,_0xdafbd4));});return Promise[_0xb57e('0x46')](_0x5c9ac2)[_0xb57e('0xa')](function(_0x66dc7c){if(_0x66dc7c[_0xb57e('0xc')]){logger[_0xb57e('0xe')]('['+[_0x35a4e3[_0xb57e('0xf')]()]+_0xb57e('0x47'),_0x66dc7c);var _0x2268a4=[];_0x66dc7c[_0xb57e('0x29')](function(_0x4a9fb5){_0x2268a4[_0xb57e('0x48')](assignTagToIncident(_0x4a9fb5,_0x152002,_0x205dcb,_0x563748,_0xf75f));});return Promise[_0xb57e('0x46')](_0x2268a4)[_0xb57e('0xa')](function(){_0x30fb1a();})[_0xb57e('0x10')](function(){_0x30fb1a();});}else{_0x30fb1a();}});});}function getTags(_0x5b34ca,_0x220bdc,_0x571e0d,_0x137e00,_0x4f5eff,_0x3c5ce6){return function(_0x3c0120){return new Promise(function(_0x17220b,_0x5631a4){var _0x474501=[];var _0x142209=_0x137e00[_0xb57e('0x49')];if(_0x142209&&_0x142209['length']>0x0){_0x474501=_[_0xb57e('0x4a')](_0x142209,_0xb57e('0x37'));}if(_0x474501[_0xb57e('0xc')]>0x0){return manageTags(_0x5b34ca,_0x474501,_0x220bdc,_0x571e0d,_0x3c0120,_0x4f5eff,_0x3c5ce6)[_0xb57e('0xa')](function(){_0x17220b(_0x3c0120);});}else{_0x17220b(_0x3c0120);}});};}function emit(_0x195838,_0x1b70ce,_0x43f45e){var _0x2b330e=_0xb57e('0x4b')+_0xb57e('0x4c')+_0xb57e('0x4d')+_0xb57e('0x4e');var _0x15777f={'uri':_0x195838+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x43f45e+_0x2b330e};io['to'](util[_0xb57e('0x4f')](_0xb57e('0x50'),_0x1b70ce))['emit'](_0xb57e('0x51'),_0x15777f);}exports['cs']=function(_0x3ae07a,_0x529db0,_0x1b81b5,_0x23b2f8,_0x47ae0c,_0xe4782,_0x254dff,_0x3726bb){var _0x31debd={};var _0xf3788d={'user':_0xe4782[_0xb57e('0x52')],'pass':_0xe4782[_0xb57e('0x53')]};var _0x5d03a3=_0xb57e('0x54');var _0x420638='sysparm_display_value=true';_0xe4782['remoteUri']=intUtil[_0xb57e('0x55')](_0xe4782[_0xb57e('0x56')]);_0xe4782[_0xb57e('0x57')]=intUtil[_0xb57e('0x55')](_0xe4782[_0xb57e('0x57')]);var _0x591c53=util[_0xb57e('0x4f')](_0xb57e('0x58'),_0xe4782['remoteUri']);_0x31debd[_0xb57e('0x15')]=!_[_0xb57e('0x59')](_0x23b2f8)?_0x23b2f8['email']:null;_0x31debd[_0xb57e('0x1c')]=_0xe4782[_0xb57e('0x5a')];_0x31debd[_0xb57e('0x21')]=_0x3726bb[_0xb57e('0x2e')]()===_0xb57e('0x38')?_0x529db0['destcalleridnum']:_0x529db0[_0xb57e('0x5b')];_0x31debd[_0xb57e('0x5c')]=_0x3726bb==='queue'||_0x3726bb===_0xb57e('0x5d')?_0xb57e('0x5e'):_0xb57e('0x38');var _0x3b9e03=util[_0xb57e('0x4f')](_0xb57e('0x5f'),_0xe4782[_0xb57e('0x57')],_0x529db0['uniqueid'],md5(_0x529db0[_0xb57e('0x60')]));if(_0x47ae0c&&_0x47ae0c['monitor_format']){logger[_0xb57e('0xe')](_0xb57e('0x61'),_0xb57e('0x62'));_0x529db0['recordingURL']=_0x3b9e03;}else if(_0x254dff&&_0x254dff[_0xb57e('0x63')]&&_0x254dff['recordingFormat']!==_0xb57e('0x64')){logger[_0xb57e('0xe')](_0xb57e('0x65'),_0xb57e('0x62'));_0x529db0[_0xb57e('0x66')]=_0x3b9e03;}else{_0x529db0[_0xb57e('0x66')]='';}return getAdminUser(_0x3726bb,_0xf3788d,_0x31debd,_0x591c53,_0x420638,_0x5d03a3)[_0xb57e('0xa')](getUser(_0x3726bb,_0xf3788d,_0x591c53,_0x420638,_0x5d03a3))[_0xb57e('0xa')](getEndUser(_0x3726bb,_0xf3788d,_0x591c53,_0x420638,_0x5d03a3))['then'](getTicket(_0x3726bb,_0xf3788d,_0x591c53,_0x1b81b5,_0x529db0,_0x420638))[_0xb57e('0xa')](function(_0x8092f7){logger['info'](util[_0xb57e('0x4f')](_0xb57e('0x67'),_0x8092f7[_0xb57e('0x68')]));logger[_0xb57e('0xe')](util[_0xb57e('0x4f')](_0xb57e('0x69'),_0x3726bb));if(_0x3726bb!=='unmanaged'){logger['info']('['+[_0x3726bb[_0xb57e('0xf')]()]+']',_0xb57e('0x6a'));emit(_0xe4782['remoteUri'],_0x23b2f8['name'],_0x8092f7['ticketId']);}})['catch'](function(_0xcdafed){logger[_0xb57e('0x11')]('['+[_0x3726bb[_0xb57e('0xf')]()]+_0xb57e('0x6b'),util[_0xb57e('0x6c')](_0xcdafed,{'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 2e25db9..ef6420b 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 _0x2eaf=['Outbound','Ticket\x20created!','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','error','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','getString','Subjects','created_by','date_start','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','length','variableName','push','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','then','entry_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','name_value_list','user_id','Searching\x20enduser\x20with\x20phone','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','[HTTP]','map','forEach','string','nameField','toLowerCase','content','type','custom_fields','idField','toString','customField','customVariable','Variable','POST','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','outbound','uri','none','[OUTBOUND]','destcalleridname','destcalleridnum'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x2eaf,0x1e2));var _0xf2ea=function(_0x2ef529,_0x3fd12e){_0x2ef529=_0x2ef529-0x0;var _0x119dde=_0x2eaf[_0x2ef529];return _0x119dde;};'use strict';var _=require(_0xf2ea('0x0'));var rp=require(_0xf2ea('0x1'));var BPromise=require(_0xf2ea('0x2'));var md5=require(_0xf2ea('0x3'));var util=require(_0xf2ea('0x4'));var Redis=require(_0xf2ea('0x5'));var intUtil=require(_0xf2ea('0x6'));var config=require(_0xf2ea('0x7'));var logger=require(_0xf2ea('0x8'))(_0xf2ea('0x9'));config[_0xf2ea('0xa')]=_[_0xf2ea('0xb')](config['redis'],{'host':_0xf2ea('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf2ea('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x3c3c40,_0x6ff150,_0x87d69f){io['to'](_0x3c3c40)['emit'](_0x6ff150,_0x87d69f);}function getTicket(_0x50ec67,_0x25ccd9,_0x8b73dd,_0x4a4006,_0x473d45,_0x37d4c9,_0x47cabb,_0x2640fd){logger['info']('Creating\x20new\x20ticket...');var _0x599e28=new Date();var _0x12a05c=[{'name':'name','value':intUtil[_0xf2ea('0xd')](_0x4a4006[_0xf2ea('0xe')],_0x473d45,'\x20')},{'name':'assigned_user_id','value':_0x25ccd9['id']},{'name':_0xf2ea('0xf'),'value':_0x25ccd9['id']},{'name':'description','value':intUtil['getString'](_0x4a4006['Descriptions'],_0x473d45,'\x0a')},{'name':_0xf2ea('0x10'),'value':_0x599e28['toISOString']()['slice'](0x0,0x13)[_0xf2ea('0x11')]('T','\x20')},{'name':_0xf2ea('0x12'),'value':'0'},{'name':_0xf2ea('0x13'),'value':'15'},{'name':_0xf2ea('0x14'),'value':_0x8b73dd['id']},{'name':_0xf2ea('0x15'),'value':_0xf2ea('0x16')},{'name':_0xf2ea('0x17'),'value':_0x8b73dd[_0xf2ea('0x18')]},{'name':'direction','value':_0x2640fd}];if(_0x37d4c9[_0xf2ea('0x19')]){_['forEach'](_0x37d4c9,function(_0x23d0b7){if(_0x473d45[_0x23d0b7[_0xf2ea('0x1a')]]){_0x12a05c[_0xf2ea('0x1b')]({'name':_0x23d0b7['idField'],'value':_0x473d45[_0x23d0b7['variableName']]});}});}return request({'form':{'method':_0xf2ea('0x1c'),'input_type':_0xf2ea('0x1d'),'response_type':_0xf2ea('0x1d'),'rest_data':JSON[_0xf2ea('0x1e')]({'session':_0x47cabb['id'],'module_name':_0xf2ea('0x1f'),'name_value_list':_0x12a05c})}});}function getAuth(_0x4a2ff4){return util['format'](_0xf2ea('0x20'),new Buffer(_0x4a2ff4[_0xf2ea('0x21')]+':X')['toString'](_0xf2ea('0x22')));}function getServerInfo(_0x4f6a2e){return request({'form':{'method':_0xf2ea('0x23'),'input_type':_0xf2ea('0x1d'),'response_type':'JSON','rest_data':JSON[_0xf2ea('0x1e')]({'session':_0x4f6a2e['id']})}});}function getUser(_0x4e54d9,_0x4f896a,_0x540ce5){if(!_['isNil'](_0x4f896a)){logger[_0xf2ea('0x24')](_0xf2ea('0x25'),_0x4f896a);return request({'form':{'method':_0xf2ea('0x26'),'input_type':_0xf2ea('0x1d'),'response_type':_0xf2ea('0x1d'),'rest_data':JSON[_0xf2ea('0x1e')]({'session':_0x540ce5['id'],'module_name':_0xf2ea('0x27'),'query':util[_0xf2ea('0x28')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x4f896a),'order_by':'','offset':'0','select_fields':['id',_0xf2ea('0x18'),_0xf2ea('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf2ea('0x2a')](function(_0x541baa){if(_0x541baa[_0xf2ea('0x2b')][_0xf2ea('0x19')]){var _0x140fb9=_['find'](_0x541baa[_0xf2ea('0x2b')],function(_0x37485a){return _0x37485a['name_value_list'][_0xf2ea('0x29')][_0xf2ea('0x2c')]===_0x4f896a;});if(_0x140fb9){logger['info']('Agent\x20found!');return BPromise[_0xf2ea('0x2d')]({'id':_0x140fb9['name_value_list']['id'][_0xf2ea('0x2c')],'name':_0x140fb9['name_value_list'][_0xf2ea('0x18')][_0xf2ea('0x2c')]});}}logger[_0xf2ea('0x24')](_0xf2ea('0x2e'));return BPromise[_0xf2ea('0x2d')]({'id':_0x540ce5[_0xf2ea('0x2f')][_0xf2ea('0x30')][_0xf2ea('0x2c')],'name':_0x540ce5[_0xf2ea('0x2f')][_0xf2ea('0x29')][_0xf2ea('0x2c')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf2ea('0x2d')]({'id':_0x540ce5[_0xf2ea('0x2f')]['user_id']['value'],'name':_0x540ce5[_0xf2ea('0x2f')]['user_name'][_0xf2ea('0x2c')]});}}function getEndUser(_0x44e4c4,_0x3dbf0f,_0x4a9f2c,_0x1fa9f5){logger['info'](_0xf2ea('0x31'),_0x4a9f2c);return request({'form':{'method':_0xf2ea('0x26'),'input_type':_0xf2ea('0x1d'),'response_type':_0xf2ea('0x1d'),'rest_data':JSON['stringify']({'session':_0x1fa9f5['id'],'module_name':'Contacts','query':util[_0xf2ea('0x28')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x4a9f2c),'order_by':'','offset':'0','select_fields':['id',_0xf2ea('0x18'),_0xf2ea('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf2ea('0x2a')](function(_0x188d03){if(_0x188d03[_0xf2ea('0x2b')][_0xf2ea('0x19')]){var _0x4c9408=_[_0xf2ea('0x33')](_0x188d03[_0xf2ea('0x2b')],function(_0x5b5b0c){return _0x5b5b0c['name_value_list']['phone_home'][_0xf2ea('0x2c')]===_0x4a9f2c;});if(_0x4c9408){logger[_0xf2ea('0x24')](_0xf2ea('0x34'));return BPromise[_0xf2ea('0x2d')]({'id':_0x4c9408[_0xf2ea('0x2f')]['id'][_0xf2ea('0x2c')],'name':_0x4c9408['name_value_list'][_0xf2ea('0x18')][_0xf2ea('0x2c')],'phone':_0x4c9408['name_value_list'][_0xf2ea('0x32')][_0xf2ea('0x2c')]});}}else{logger[_0xf2ea('0x24')](_0xf2ea('0x35'));return request({'form':{'method':_0xf2ea('0x1c'),'input_type':_0xf2ea('0x1d'),'response_type':_0xf2ea('0x1d'),'rest_data':JSON[_0xf2ea('0x1e')]({'session':_0x1fa9f5['id'],'module_name':_0xf2ea('0x16'),'name_value_list':[{'name':_0xf2ea('0x36'),'value':_0x3dbf0f!==_0xf2ea('0x37')?_0x3dbf0f:util[_0xf2ea('0x28')]('Caller\x20-\x20%s',_0x4a9f2c)},{'name':_0xf2ea('0x32'),'value':_0x4a9f2c}]})}})['then'](function(_0x51a0f5){logger[_0xf2ea('0x24')](_0xf2ea('0x38'));return BPromise[_0xf2ea('0x2d')]({'id':_0x51a0f5['id'],'name':_0x51a0f5['entry_list'][_0xf2ea('0x36')][_0xf2ea('0x2c')],'phone':_0x51a0f5[_0xf2ea('0x2b')]['phone_home'][_0xf2ea('0x2c')]});});}});}function request(_0x35a184){logger['debug'](_0xf2ea('0x39'),JSON[_0xf2ea('0x1e')](_0x35a184));return rp(_['merge'](def,_0x35a184));}function getTags(_0x361803,_0x3b9272){var _0x2af58e=[];if(_0x361803&&_0x361803[_0xf2ea('0x19')]>0x0){_0x2af58e=_[_0xf2ea('0x3a')](_0x361803,_0x3b9272);}return _0x2af58e;}function getCustomFields(_0x129cda,_0x4922d6){var _0x4a7b29=[];var _0x4f54c3={'custom_fields':[]};if(_0x129cda[_0xf2ea('0x19')]>0x0){_[_0xf2ea('0x3b')](_0x129cda,function(_0x38b67e){if(_0x38b67e['type']===_0xf2ea('0x3c')&&_0x38b67e[_0xf2ea('0x3d')]&&!_0x38b67e['customField']){_0x4f54c3[_0x38b67e[_0xf2ea('0x3d')][_0xf2ea('0x3e')]()]=_0x38b67e[_0xf2ea('0x3f')]['toString']();}else if(_0x38b67e[_0xf2ea('0x40')]==='string'&&_0x38b67e['idField']&&_0x38b67e['customField']){_0x4f54c3[_0xf2ea('0x41')][_0xf2ea('0x1b')]({'id':_0x38b67e[_0xf2ea('0x42')],'value':_0x38b67e[_0xf2ea('0x3f')][_0xf2ea('0x43')]()});}else if(_0x38b67e[_0xf2ea('0x40')]==='variable'&&_0x38b67e[_0xf2ea('0x1a')]&&_0x38b67e[_0xf2ea('0x42')]&&_0x38b67e[_0xf2ea('0x44')]){_0x4922d6[_0x38b67e[_0xf2ea('0x1a')]]&&_0x4f54c3[_0xf2ea('0x41')][_0xf2ea('0x1b')]({'id':_0x38b67e[_0xf2ea('0x42')],'value':_0x4922d6[_0x38b67e[_0xf2ea('0x1a')]][_0xf2ea('0x43')]()});}else if(_0x38b67e[_0xf2ea('0x40')]===_0xf2ea('0x45')&&_0x38b67e[_0xf2ea('0x46')]&&_0x38b67e[_0xf2ea('0x46')][_0xf2ea('0x18')]&&_0x38b67e[_0xf2ea('0x42')]&&_0x38b67e[_0xf2ea('0x44')]){_0x4922d6[_0x38b67e[_0xf2ea('0x46')][_0xf2ea('0x18')][_0xf2ea('0x3e')]()]&&_0x4f54c3[_0xf2ea('0x41')][_0xf2ea('0x1b')]({'id':_0x38b67e['idField'],'value':_0x4922d6[_0x38b67e['Variable'][_0xf2ea('0x18')][_0xf2ea('0x3e')]()][_0xf2ea('0x43')]()});}});}return _0x4f54c3;}function getConnection(_0x491a2f){return request({'method':_0xf2ea('0x47'),'form':{'method':_0xf2ea('0x48'),'input_type':_0xf2ea('0x1d'),'response_type':_0xf2ea('0x1d'),'rest_data':JSON[_0xf2ea('0x1e')]({'user_auth':{'user_name':_0x491a2f['username'],'password':_0x491a2f['password'],'encryption':_0xf2ea('0x49')},'application':_0xf2ea('0x4a')})}})[_0xf2ea('0x2a')](function(_0x1a1336){var _0x47d974=_0x1a1336;if(_0x47d974['id']){def[_0xf2ea('0x4b')]=_0x47d974['id'];return BPromise['resolve'](_0x47d974);}else{throw new Error(util[_0xf2ea('0x28')]('Account\x20%d\x20is\x20not\x20valid',_0x491a2f['id']));}});}function setRelationship(_0x1835ac,_0x2e3c54,_0x312d85,_0x1d16be){return request({'form':{'method':_0xf2ea('0x4c'),'input_type':'JSON','response_type':_0xf2ea('0x1d'),'rest_data':JSON[_0xf2ea('0x1e')]({'session':_0x1835ac['id'],'module_name':_0xf2ea('0x1f'),'module_id':_0x312d85['id'],'link_field_name':_0x1d16be,'related_ids':[_0x2e3c54['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf2ea('0x4d')]=function(_0x5411a1,_0x5133fe,_0xf31675,_0x5a9581,_0xe2014b,_0x1188ad){var _0x5e77dd,_0x335bfa,_0x1ac808,_0x143987;_0x1188ad[_0xf2ea('0x4e')]=intUtil[_0xf2ea('0x4f')](_0x1188ad[_0xf2ea('0x4e')]);_0x1188ad['serverUrl']=intUtil[_0xf2ea('0x4f')](_0x1188ad[_0xf2ea('0x50')]);def['uri']=util['format'](_0xf2ea('0x51'),_0x1188ad['remoteUri']);if(_0xe2014b&&_0xe2014b[_0xf2ea('0x52')]){logger[_0xf2ea('0x24')](_0xf2ea('0x53'),_0xf2ea('0x54'));_0x5133fe[_0xf2ea('0x55')]=util[_0xf2ea('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1188ad[_0xf2ea('0x50')],_0x5133fe[_0xf2ea('0x56')],md5(_0x5133fe[_0xf2ea('0x56')]));}else{_0x5133fe[_0xf2ea('0x55')]='';}return getConnection(_0x1188ad)['then'](function(_0x4c7007){_0x143987=_0x4c7007;return getUser(_0x1188ad,_0x5a9581['name'],_0x143987);})['then'](function(_0x229ff4){_0x5e77dd=_0x229ff4;logger[_0xf2ea('0x24')](_0xf2ea('0x57'),_0x5e77dd['id']);return getEndUser(_0x1188ad,_0x5133fe[_0xf2ea('0x58')],_0x5133fe[_0xf2ea('0x59')],_0x143987);})['then'](function(_0x5efa70){_0x335bfa=_0x5efa70;logger['info'](_0xf2ea('0x5a'),_0x335bfa['id']);return getTicket(_0x1188ad,_0x5e77dd,_0x335bfa,_0xf31675,_0x5133fe,_0xf31675[_0xf2ea('0x5b')],_0x143987,_0xf2ea('0x5c'));})[_0xf2ea('0x2a')](function(_0x23113e){_0x1ac808=_0x23113e;logger[_0xf2ea('0x24')]('Ticket\x20created!');logger[_0xf2ea('0x24')](_0xf2ea('0x5d'),_0x1ac808['id']);return setRelationship(_0x143987,_0x5e77dd,_0x1ac808,_0xf2ea('0x5e'));})[_0xf2ea('0x2a')](function(){return setRelationship(_0x143987,_0x335bfa,_0x1ac808,_0xf2ea('0x5f'));})[_0xf2ea('0x2a')](function(){return getServerInfo(_0x143987);})[_0xf2ea('0x2a')](function(_0x3fa443){var _0x4d661f=parseInt(_0x3fa443[_0xf2ea('0x60')]['charAt'](0x0));var _0x36f326=util['format'](_0xf2ea('0x61'),_0x1188ad[_0xf2ea('0x4e')],_0x1ac808['id']);if(_0x4d661f>0x6){_0x36f326=util[_0xf2ea('0x28')](_0xf2ea('0x62'),_0x1188ad[_0xf2ea('0x4e')],_0x1ac808['id']);}logger[_0xf2ea('0x24')](_0xf2ea('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf2ea('0x28')](_0xf2ea('0x63'),_0x5a9581[_0xf2ea('0x18')]),_0xf2ea('0x64'),{'uri':_0x36f326});})[_0xf2ea('0x65')](function(_0x3be062){logger['error'](_0xf2ea('0x53'),JSON[_0xf2ea('0x1e')](_0x3be062));});};exports[_0xf2ea('0x66')]=function(_0x1e00c6,_0x5d9cc8,_0x145b0f,_0x5bf474,_0x5bba89,_0x2b9c8a,_0x3e5cc2){var _0x55d662,_0x43bf89,_0x1dca31,_0x52195e;_0x2b9c8a['remoteUri']=intUtil[_0xf2ea('0x4f')](_0x2b9c8a[_0xf2ea('0x4e')]);_0x2b9c8a[_0xf2ea('0x50')]=intUtil[_0xf2ea('0x4f')](_0x2b9c8a['serverUrl']);def[_0xf2ea('0x67')]=util[_0xf2ea('0x28')](_0xf2ea('0x51'),_0x2b9c8a[_0xf2ea('0x4e')]);if(_0x3e5cc2&&_0x3e5cc2['recordingFormat']&&_0x3e5cc2['recordingFormat']!==_0xf2ea('0x68')){logger[_0xf2ea('0x24')](_0xf2ea('0x69'),_0xf2ea('0x54'));_0x5d9cc8[_0xf2ea('0x55')]=util[_0xf2ea('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b9c8a[_0xf2ea('0x50')],_0x5d9cc8['uniqueid'],md5(_0x5d9cc8[_0xf2ea('0x56')]));}return getConnection(_0x2b9c8a)[_0xf2ea('0x2a')](function(_0x25d466){_0x52195e=_0x25d466;return getUser(_0x2b9c8a,_0x5bf474[_0xf2ea('0x18')],_0x52195e);})['then'](function(_0x10d65c){_0x55d662=_0x10d65c;logger['info'](_0xf2ea('0x57'),_0x55d662['id']);return getEndUser(_0x2b9c8a,_0x5d9cc8[_0xf2ea('0x6a')],_0x5d9cc8[_0xf2ea('0x6b')],_0x52195e);})[_0xf2ea('0x2a')](function(_0x13b706){_0x43bf89=_0x13b706;logger['info'](_0xf2ea('0x5a'),_0x43bf89['id']);return getTicket(_0x2b9c8a,_0x55d662,_0x43bf89,_0x145b0f,_0x5d9cc8,_0x145b0f['Fields'],_0x52195e,_0xf2ea('0x6c'));})[_0xf2ea('0x2a')](function(_0x3bed4f){_0x1dca31=_0x3bed4f;logger['info'](_0xf2ea('0x6d'));logger[_0xf2ea('0x24')]('The\x20Ticket\x20ID\x20is:',_0x1dca31['id']);return setRelationship(_0x52195e,_0x55d662,_0x1dca31,_0xf2ea('0x5e'));})[_0xf2ea('0x2a')](function(){return setRelationship(_0x52195e,_0x43bf89,_0x1dca31,_0xf2ea('0x5f'));})[_0xf2ea('0x2a')](function(){return getServerInfo(_0x52195e);})[_0xf2ea('0x2a')](function(_0x4fde58){var _0x3d2b07=parseInt(_0x4fde58[_0xf2ea('0x60')][_0xf2ea('0x6e')](0x0));var _0x12be79=util[_0xf2ea('0x28')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2b9c8a[_0xf2ea('0x4e')],_0x1dca31['id']);if(_0x3d2b07>0x6){_0x12be79=util[_0xf2ea('0x28')](_0xf2ea('0x62'),_0x2b9c8a[_0xf2ea('0x4e')],_0x1dca31['id']);}logger[_0xf2ea('0x24')](_0xf2ea('0x69'),_0xf2ea('0x6f'));emit(util[_0xf2ea('0x28')](_0xf2ea('0x63'),_0x5bf474[_0xf2ea('0x18')]),_0xf2ea('0x64'),{'uri':_0x12be79});})[_0xf2ea('0x65')](function(_0x485138){logger['error'](_0xf2ea('0x69'),JSON[_0xf2ea('0x1e')](_0x485138));});};exports[_0xf2ea('0x70')]=function(_0x197775,_0x152ef2,_0x2ab8d7,_0x29cad8,_0x167933,_0x149492){var _0x384914,_0x4f48aa,_0x1f2eb8,_0x479db1;_0x149492[_0xf2ea('0x4e')]=intUtil['stripTrailingSlash'](_0x149492['remoteUri']);_0x149492[_0xf2ea('0x50')]=intUtil['stripTrailingSlash'](_0x149492[_0xf2ea('0x50')]);def[_0xf2ea('0x67')]=util[_0xf2ea('0x28')](_0xf2ea('0x51'),_0x149492[_0xf2ea('0x4e')]);if(_0x167933&&_0x167933[_0xf2ea('0x52')]){logger['info']('['+_0x152ef2[_0xf2ea('0x71')]['toUpperCase']()+']',_0xf2ea('0x54'));_0x152ef2[_0xf2ea('0x55')]=util[_0xf2ea('0x28')](_0xf2ea('0x72'),_0x149492[_0xf2ea('0x50')],_0x152ef2[_0xf2ea('0x56')],md5(_0x152ef2[_0xf2ea('0x56')]));}else{_0x152ef2['recordingURL']='';}return getConnection(_0x149492)[_0xf2ea('0x2a')](function(_0x538792){_0x479db1=_0x538792;if(!_[_0xf2ea('0x73')](_0x29cad8)){return getUser(_0x149492,_0x29cad8[_0xf2ea('0x18')],_0x479db1);}else{return getUser(_0x149492,null,_0x479db1);}})[_0xf2ea('0x2a')](function(_0xe9b575){_0x384914=_0xe9b575;logger[_0xf2ea('0x24')](_0xf2ea('0x57'),_0x384914['id']);return getEndUser(_0x149492,_0x152ef2['calleridname'],_0x152ef2[_0xf2ea('0x59')],_0x479db1);})[_0xf2ea('0x2a')](function(_0x509e7d){_0x4f48aa=_0x509e7d;logger[_0xf2ea('0x24')](_0xf2ea('0x5a'),_0x4f48aa['id']);return getTicket(_0x149492,_0x384914,_0x4f48aa,_0x2ab8d7,_0x152ef2,_0x2ab8d7[_0xf2ea('0x5b')],_0x479db1,'Inbound');})['then'](function(_0x2e2342){_0x1f2eb8=_0x2e2342;logger[_0xf2ea('0x24')](_0xf2ea('0x6d'));logger[_0xf2ea('0x24')](_0xf2ea('0x5d'),_0x1f2eb8['id']);return setRelationship(_0x479db1,_0x384914,_0x1f2eb8,_0xf2ea('0x5e'));})[_0xf2ea('0x2a')](function(){return setRelationship(_0x479db1,_0x4f48aa,_0x1f2eb8,'contacts');})['then'](function(){return getServerInfo(_0x479db1);})[_0xf2ea('0x65')](function(_0x2a217c){logger[_0xf2ea('0x74')]('['+_0x152ef2[_0xf2ea('0x71')][_0xf2ea('0x75')]()+']',JSON['stringify'](_0x2a217c));});}; \ No newline at end of file +var _0x1987=['queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','contacts','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','date_start','slice','duration_minutes','parent_id','parent_name','direction','length','idField','variableName','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','isNil','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','format','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1987,0xa3));var _0x7198=function(_0x1f0b4f,_0xc1aca5){_0x1f0b4f=_0x1f0b4f-0x0;var _0x51daf0=_0x1987[_0x1f0b4f];return _0x51daf0;};'use strict';var _=require(_0x7198('0x0'));var rp=require(_0x7198('0x1'));var BPromise=require(_0x7198('0x2'));var md5=require('md5');var util=require(_0x7198('0x3'));var Redis=require(_0x7198('0x4'));var intUtil=require('./util');var config=require(_0x7198('0x5'));var logger=require('../../../../config/logger')(_0x7198('0x6'));config[_0x7198('0x7')]=_[_0x7198('0x8')](config[_0x7198('0x7')],{'host':_0x7198('0x9'),'port':0x18eb});var io=require(_0x7198('0xa'))(new Redis(config[_0x7198('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x38f360,_0x24d3cf,_0x4c3577){io['to'](_0x38f360)[_0x7198('0xb')](_0x24d3cf,_0x4c3577);}function getTicket(_0x567603,_0x2db318,_0x444c95,_0x55c82b,_0x21f769,_0xdef381,_0x389b95,_0x5e125b){logger[_0x7198('0xc')](_0x7198('0xd'));var _0x52d4ae=new Date();var _0x294376=[{'name':_0x7198('0xe'),'value':intUtil['getString'](_0x55c82b[_0x7198('0xf')],_0x21f769,'\x20')},{'name':_0x7198('0x10'),'value':_0x2db318['id']},{'name':_0x7198('0x11'),'value':_0x2db318['id']},{'name':_0x7198('0x12'),'value':intUtil[_0x7198('0x13')](_0x55c82b['Descriptions'],_0x21f769,'\x0a')},{'name':_0x7198('0x14'),'value':_0x52d4ae['toISOString']()[_0x7198('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x7198('0x16'),'value':'15'},{'name':_0x7198('0x17'),'value':_0x444c95['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x7198('0x18'),'value':_0x444c95['name']},{'name':_0x7198('0x19'),'value':_0x5e125b}];if(_0xdef381[_0x7198('0x1a')]){_['forEach'](_0xdef381,function(_0xfa9cea){if(_0x21f769[_0xfa9cea['variableName']]){_0x294376['push']({'name':_0xfa9cea[_0x7198('0x1b')],'value':_0x21f769[_0xfa9cea[_0x7198('0x1c')]]});}});}return request({'form':{'method':_0x7198('0x1d'),'input_type':'JSON','response_type':_0x7198('0x1e'),'rest_data':JSON['stringify']({'session':_0x389b95['id'],'module_name':_0x7198('0x1f'),'name_value_list':_0x294376})}});}function getAuth(_0x30da68){return util['format'](_0x7198('0x20'),new Buffer(_0x30da68[_0x7198('0x21')]+':X')[_0x7198('0x22')](_0x7198('0x23')));}function getServerInfo(_0x2b1955){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x7198('0x1e'),'rest_data':JSON['stringify']({'session':_0x2b1955['id']})}});}function getUser(_0x1090eb,_0xccfcdb,_0x4b8e3c){if(!_[_0x7198('0x24')](_0xccfcdb)){logger[_0x7198('0xc')]('Getting\x20agent\x20with\x20name',_0xccfcdb);return request({'form':{'method':_0x7198('0x25'),'input_type':_0x7198('0x1e'),'response_type':'JSON','rest_data':JSON[_0x7198('0x26')]({'session':_0x4b8e3c['id'],'module_name':_0x7198('0x27'),'query':util['format'](_0x7198('0x28'),_0xccfcdb),'order_by':'','offset':'0','select_fields':['id',_0x7198('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7198('0x29')](function(_0x45d400){if(_0x45d400[_0x7198('0x2a')][_0x7198('0x1a')]){var _0x491a43=_[_0x7198('0x2b')](_0x45d400[_0x7198('0x2a')],function(_0x25e76d){return _0x25e76d[_0x7198('0x2c')][_0x7198('0x2d')][_0x7198('0x2e')]===_0xccfcdb;});if(_0x491a43){logger[_0x7198('0xc')](_0x7198('0x2f'));return BPromise[_0x7198('0x30')]({'id':_0x491a43['name_value_list']['id'][_0x7198('0x2e')],'name':_0x491a43[_0x7198('0x2c')][_0x7198('0xe')][_0x7198('0x2e')]});}}logger[_0x7198('0xc')](_0x7198('0x31'));return BPromise['resolve']({'id':_0x4b8e3c[_0x7198('0x2c')][_0x7198('0x32')]['value'],'name':_0x4b8e3c[_0x7198('0x2c')][_0x7198('0x2d')][_0x7198('0x2e')]});});}else{logger[_0x7198('0xc')](_0x7198('0x33'));return BPromise[_0x7198('0x30')]({'id':_0x4b8e3c[_0x7198('0x2c')][_0x7198('0x32')][_0x7198('0x2e')],'name':_0x4b8e3c['name_value_list'][_0x7198('0x2d')][_0x7198('0x2e')]});}}function getEndUser(_0x3936ad,_0x290cf4,_0x2d29e6,_0x58a000){logger[_0x7198('0xc')](_0x7198('0x34'),_0x2d29e6);return request({'form':{'method':_0x7198('0x25'),'input_type':'JSON','response_type':_0x7198('0x1e'),'rest_data':JSON[_0x7198('0x26')]({'session':_0x58a000['id'],'module_name':_0x7198('0x35'),'query':util[_0x7198('0x36')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x2d29e6),'order_by':'','offset':'0','select_fields':['id',_0x7198('0xe'),_0x7198('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x42d8e6){if(_0x42d8e6[_0x7198('0x2a')][_0x7198('0x1a')]){var _0x2091f5=_['find'](_0x42d8e6[_0x7198('0x2a')],function(_0x10179e){return _0x10179e[_0x7198('0x2c')][_0x7198('0x37')][_0x7198('0x2e')]===_0x2d29e6;});if(_0x2091f5){logger['info'](_0x7198('0x38'));return BPromise[_0x7198('0x30')]({'id':_0x2091f5[_0x7198('0x2c')]['id'][_0x7198('0x2e')],'name':_0x2091f5[_0x7198('0x2c')][_0x7198('0xe')][_0x7198('0x2e')],'phone':_0x2091f5[_0x7198('0x2c')][_0x7198('0x37')][_0x7198('0x2e')]});}}else{logger['info'](_0x7198('0x39'));return request({'form':{'method':_0x7198('0x1d'),'input_type':_0x7198('0x1e'),'response_type':_0x7198('0x1e'),'rest_data':JSON[_0x7198('0x26')]({'session':_0x58a000['id'],'module_name':_0x7198('0x35'),'name_value_list':[{'name':_0x7198('0x3a'),'value':_0x290cf4!==_0x7198('0x3b')?_0x290cf4:util['format'](_0x7198('0x3c'),_0x2d29e6)},{'name':_0x7198('0x37'),'value':_0x2d29e6}]})}})['then'](function(_0x39ccbd){logger['info'](_0x7198('0x3d'));return BPromise['resolve']({'id':_0x39ccbd['id'],'name':_0x39ccbd[_0x7198('0x2a')][_0x7198('0x3a')][_0x7198('0x2e')],'phone':_0x39ccbd[_0x7198('0x2a')][_0x7198('0x37')][_0x7198('0x2e')]});});}});}function request(_0x32b6cd){logger[_0x7198('0x3e')]('[HTTP]',JSON[_0x7198('0x26')](_0x32b6cd));return rp(_[_0x7198('0x3f')](def,_0x32b6cd));}function getTags(_0x330326,_0x3f83ae){var _0x4b9b0e=[];if(_0x330326&&_0x330326[_0x7198('0x1a')]>0x0){_0x4b9b0e=_['map'](_0x330326,_0x3f83ae);}return _0x4b9b0e;}function getCustomFields(_0x8a1069,_0x324808){var _0xd3aea0=[];var _0xcdfb47={'custom_fields':[]};if(_0x8a1069['length']>0x0){_[_0x7198('0x40')](_0x8a1069,function(_0x23b149){if(_0x23b149[_0x7198('0x41')]===_0x7198('0x42')&&_0x23b149[_0x7198('0x43')]&&!_0x23b149[_0x7198('0x44')]){_0xcdfb47[_0x23b149[_0x7198('0x43')][_0x7198('0x45')]()]=_0x23b149[_0x7198('0x46')][_0x7198('0x22')]();}else if(_0x23b149[_0x7198('0x41')]==='string'&&_0x23b149[_0x7198('0x1b')]&&_0x23b149[_0x7198('0x44')]){_0xcdfb47[_0x7198('0x47')][_0x7198('0x48')]({'id':_0x23b149[_0x7198('0x1b')],'value':_0x23b149[_0x7198('0x46')][_0x7198('0x22')]()});}else if(_0x23b149[_0x7198('0x41')]===_0x7198('0x49')&&_0x23b149[_0x7198('0x1c')]&&_0x23b149[_0x7198('0x1b')]&&_0x23b149[_0x7198('0x44')]){_0x324808[_0x23b149['variableName']]&&_0xcdfb47[_0x7198('0x47')][_0x7198('0x48')]({'id':_0x23b149[_0x7198('0x1b')],'value':_0x324808[_0x23b149['variableName']]['toString']()});}else if(_0x23b149[_0x7198('0x41')]===_0x7198('0x4a')&&_0x23b149[_0x7198('0x4b')]&&_0x23b149[_0x7198('0x4b')][_0x7198('0xe')]&&_0x23b149[_0x7198('0x1b')]&&_0x23b149[_0x7198('0x44')]){_0x324808[_0x23b149[_0x7198('0x4b')]['name']['toLowerCase']()]&&_0xcdfb47[_0x7198('0x47')]['push']({'id':_0x23b149[_0x7198('0x1b')],'value':_0x324808[_0x23b149['Variable'][_0x7198('0xe')][_0x7198('0x45')]()][_0x7198('0x22')]()});}});}return _0xcdfb47;}function getConnection(_0x2825a8){return request({'method':'POST','form':{'method':'login','input_type':_0x7198('0x1e'),'response_type':_0x7198('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2825a8[_0x7198('0x4c')],'password':_0x2825a8[_0x7198('0x4d')],'encryption':_0x7198('0x4e')},'application':_0x7198('0x4f')})}})[_0x7198('0x29')](function(_0x3ab0b7){var _0x4c449d=_0x3ab0b7;if(_0x4c449d['id']){def[_0x7198('0x50')]=_0x4c449d['id'];return BPromise['resolve'](_0x4c449d);}else{throw new Error(util[_0x7198('0x36')](_0x7198('0x51'),_0x2825a8['id']));}});}function setRelationship(_0x21a468,_0x2132c6,_0x2b9c13,_0x58daae){return request({'form':{'method':_0x7198('0x52'),'input_type':_0x7198('0x1e'),'response_type':'JSON','rest_data':JSON[_0x7198('0x26')]({'session':_0x21a468['id'],'module_name':'Calls','module_id':_0x2b9c13['id'],'link_field_name':_0x58daae,'related_ids':[_0x2132c6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7198('0x53')]=function(_0x413339,_0x1dab38,_0x5ddf84,_0x4f3e03,_0x4ec7ce,_0x320592){var _0x5ccd93,_0x3a2392,_0x50f74e,_0x1fc376;_0x320592['remoteUri']=intUtil[_0x7198('0x54')](_0x320592[_0x7198('0x55')]);_0x320592[_0x7198('0x56')]=intUtil['stripTrailingSlash'](_0x320592['serverUrl']);def[_0x7198('0x57')]=util[_0x7198('0x36')](_0x7198('0x58'),_0x320592['remoteUri']);if(_0x4ec7ce&&_0x4ec7ce[_0x7198('0x59')]){logger['info'](_0x7198('0x5a'),_0x7198('0x5b'));_0x1dab38[_0x7198('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x320592[_0x7198('0x56')],_0x1dab38[_0x7198('0x5d')],md5(_0x1dab38[_0x7198('0x5d')]));}else{_0x1dab38[_0x7198('0x5c')]='';}return getConnection(_0x320592)[_0x7198('0x29')](function(_0x1c6cff){_0x1fc376=_0x1c6cff;return getUser(_0x320592,_0x4f3e03[_0x7198('0xe')],_0x1fc376);})[_0x7198('0x29')](function(_0x469693){_0x5ccd93=_0x469693;logger[_0x7198('0xc')](_0x7198('0x5e'),_0x5ccd93['id']);return getEndUser(_0x320592,_0x1dab38[_0x7198('0x5f')],_0x1dab38[_0x7198('0x60')],_0x1fc376);})['then'](function(_0x5c6b4b){_0x3a2392=_0x5c6b4b;logger['info'](_0x7198('0x61'),_0x3a2392['id']);return getTicket(_0x320592,_0x5ccd93,_0x3a2392,_0x5ddf84,_0x1dab38,_0x5ddf84[_0x7198('0x62')],_0x1fc376,_0x7198('0x63'));})[_0x7198('0x29')](function(_0x20f6fd){_0x50f74e=_0x20f6fd;logger[_0x7198('0xc')](_0x7198('0x64'));logger[_0x7198('0xc')]('The\x20Ticket\x20ID\x20is:',_0x50f74e['id']);return setRelationship(_0x1fc376,_0x5ccd93,_0x50f74e,_0x7198('0x65'));})['then'](function(){return setRelationship(_0x1fc376,_0x3a2392,_0x50f74e,'contacts');})[_0x7198('0x29')](function(){return getServerInfo(_0x1fc376);})['then'](function(_0x36c910){var _0x2eaf05=parseInt(_0x36c910[_0x7198('0x66')][_0x7198('0x67')](0x0));var _0x3f998c=util[_0x7198('0x36')](_0x7198('0x68'),_0x320592[_0x7198('0x55')],_0x50f74e['id']);if(_0x2eaf05>0x6){_0x3f998c=util[_0x7198('0x36')](_0x7198('0x69'),_0x320592[_0x7198('0x55')],_0x50f74e['id']);}logger['info'](_0x7198('0x5a'),_0x7198('0x6a'));emit(util[_0x7198('0x36')](_0x7198('0x6b'),_0x4f3e03[_0x7198('0xe')]),_0x7198('0x6c'),{'uri':_0x3f998c});})[_0x7198('0x6d')](function(_0x42b31f){logger['error'](_0x7198('0x5a'),JSON[_0x7198('0x26')](_0x42b31f));});};exports[_0x7198('0x6e')]=function(_0x3086ba,_0x4ab05b,_0x5be7f2,_0x1f5ecd,_0x312a46,_0xea6438,_0x53acd0){var _0x3ad333,_0x219039,_0x20f200,_0x38ece6;_0xea6438[_0x7198('0x55')]=intUtil[_0x7198('0x54')](_0xea6438[_0x7198('0x55')]);_0xea6438[_0x7198('0x56')]=intUtil['stripTrailingSlash'](_0xea6438[_0x7198('0x56')]);def['uri']=util[_0x7198('0x36')](_0x7198('0x58'),_0xea6438[_0x7198('0x55')]);if(_0x53acd0&&_0x53acd0['recordingFormat']&&_0x53acd0[_0x7198('0x6f')]!==_0x7198('0x70')){logger['info']('[OUTBOUND]',_0x7198('0x5b'));_0x4ab05b[_0x7198('0x5c')]=util['format'](_0x7198('0x71'),_0xea6438[_0x7198('0x56')],_0x4ab05b['uniqueid'],md5(_0x4ab05b[_0x7198('0x5d')]));}return getConnection(_0xea6438)[_0x7198('0x29')](function(_0x1ec5e9){_0x38ece6=_0x1ec5e9;return getUser(_0xea6438,_0x1f5ecd['name'],_0x38ece6);})[_0x7198('0x29')](function(_0x4d66fb){_0x3ad333=_0x4d66fb;logger[_0x7198('0xc')](_0x7198('0x5e'),_0x3ad333['id']);return getEndUser(_0xea6438,_0x4ab05b['destcalleridname'],_0x4ab05b[_0x7198('0x72')],_0x38ece6);})[_0x7198('0x29')](function(_0x3f4fb5){_0x219039=_0x3f4fb5;logger[_0x7198('0xc')]('The\x20Enduser\x20ID\x20is:',_0x219039['id']);return getTicket(_0xea6438,_0x3ad333,_0x219039,_0x5be7f2,_0x4ab05b,_0x5be7f2[_0x7198('0x62')],_0x38ece6,_0x7198('0x73'));})['then'](function(_0x234cc2){_0x20f200=_0x234cc2;logger[_0x7198('0xc')](_0x7198('0x64'));logger['info'](_0x7198('0x74'),_0x20f200['id']);return setRelationship(_0x38ece6,_0x3ad333,_0x20f200,_0x7198('0x65'));})[_0x7198('0x29')](function(){return setRelationship(_0x38ece6,_0x219039,_0x20f200,_0x7198('0x75'));})[_0x7198('0x29')](function(){return getServerInfo(_0x38ece6);})[_0x7198('0x29')](function(_0x269e7b){var _0x41857b=parseInt(_0x269e7b['version'][_0x7198('0x67')](0x0));var _0x430a46=util[_0x7198('0x36')](_0x7198('0x68'),_0xea6438[_0x7198('0x55')],_0x20f200['id']);if(_0x41857b>0x6){_0x430a46=util[_0x7198('0x36')](_0x7198('0x69'),_0xea6438[_0x7198('0x55')],_0x20f200['id']);}logger[_0x7198('0xc')](_0x7198('0x76'),_0x7198('0x6a'));emit(util[_0x7198('0x36')](_0x7198('0x6b'),_0x1f5ecd[_0x7198('0xe')]),_0x7198('0x6c'),{'uri':_0x430a46});})[_0x7198('0x6d')](function(_0xe7fa85){logger[_0x7198('0x77')](_0x7198('0x76'),JSON[_0x7198('0x26')](_0xe7fa85));});};exports[_0x7198('0x78')]=function(_0x53e722,_0x2c6d11,_0x5402a7,_0x386845,_0xe437eb,_0x20e331){var _0xcd0926,_0x29bd3b,_0x448cd,_0x4bf870;_0x20e331[_0x7198('0x55')]=intUtil[_0x7198('0x54')](_0x20e331['remoteUri']);_0x20e331[_0x7198('0x56')]=intUtil[_0x7198('0x54')](_0x20e331[_0x7198('0x56')]);def[_0x7198('0x57')]=util[_0x7198('0x36')](_0x7198('0x58'),_0x20e331[_0x7198('0x55')]);if(_0xe437eb&&_0xe437eb['monitor_format']){logger['info']('['+_0x2c6d11[_0x7198('0x79')][_0x7198('0x7a')]()+']',_0x7198('0x5b'));_0x2c6d11[_0x7198('0x5c')]=util[_0x7198('0x36')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20e331[_0x7198('0x56')],_0x2c6d11['uniqueid'],md5(_0x2c6d11[_0x7198('0x5d')]));}else{_0x2c6d11[_0x7198('0x5c')]='';}return getConnection(_0x20e331)[_0x7198('0x29')](function(_0x2dc6d5){_0x4bf870=_0x2dc6d5;if(!_['isNil'](_0x386845)){return getUser(_0x20e331,_0x386845[_0x7198('0xe')],_0x4bf870);}else{return getUser(_0x20e331,null,_0x4bf870);}})['then'](function(_0x24bd85){_0xcd0926=_0x24bd85;logger['info'](_0x7198('0x5e'),_0xcd0926['id']);return getEndUser(_0x20e331,_0x2c6d11[_0x7198('0x5f')],_0x2c6d11['calleridnum'],_0x4bf870);})[_0x7198('0x29')](function(_0xc7c95c){_0x29bd3b=_0xc7c95c;logger[_0x7198('0xc')](_0x7198('0x61'),_0x29bd3b['id']);return getTicket(_0x20e331,_0xcd0926,_0x29bd3b,_0x5402a7,_0x2c6d11,_0x5402a7[_0x7198('0x62')],_0x4bf870,'Inbound');})[_0x7198('0x29')](function(_0x28f61a){_0x448cd=_0x28f61a;logger['info'](_0x7198('0x64'));logger['info'](_0x7198('0x74'),_0x448cd['id']);return setRelationship(_0x4bf870,_0xcd0926,_0x448cd,'users');})[_0x7198('0x29')](function(){return setRelationship(_0x4bf870,_0x29bd3b,_0x448cd,_0x7198('0x75'));})[_0x7198('0x29')](function(){return getServerInfo(_0x4bf870);})[_0x7198('0x6d')](function(_0xcdd390){logger[_0x7198('0x77')]('['+_0x2c6d11[_0x7198('0x79')][_0x7198('0x7a')]()+']',JSON[_0x7198('0x26')](_0xcdd390));});}; \ 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 e711c2f..a9d42d4 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 _0x1e27=['variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','isNil','lodash','util','length','sortBy','type','string','push','content','variable'];(function(_0x1b1888,_0x1b4847){var _0x4c1f20=function(_0x3b5ac5){while(--_0x3b5ac5){_0x1b1888['push'](_0x1b1888['shift']());}};_0x4c1f20(++_0x1b4847);}(_0x1e27,0x1e5));var _0x71e2=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x1e27[_0x4cf0b7];return _0x545f10;};'use strict';var _=require(_0x71e2('0x0'));var util=require(_0x71e2('0x1'));exports['getString']=function(_0x450160,_0xdc4857,_0x4880dc){var _0x3622cc=[];if(_0x450160[_0x71e2('0x2')]>0x0){var _0x5cdbb9=_[_0x71e2('0x3')](_0x450160,['id']);for(var _0x5b8973=0x0;_0x5b8973<_0x5cdbb9[_0x71e2('0x2')];_0x5b8973++){var _0x427250=_0x5cdbb9[_0x5b8973];if(_0x427250[_0x71e2('0x4')]===_0x71e2('0x5')){_0x3622cc[_0x71e2('0x6')](_0x427250[_0x71e2('0x7')]);}else if(_0x427250[_0x71e2('0x4')]===_0x71e2('0x8')&&_0x427250[_0x71e2('0x9')]){_0xdc4857[_0x427250['variableName']]&&_0x3622cc[_0x71e2('0x6')](_0xdc4857[_0x427250[_0x71e2('0x9')]][_0x71e2('0xa')]());}else if(_0x427250[_0x71e2('0x4')]===_0x71e2('0xb')&&_0x427250[_0x71e2('0xc')]&&_0x427250['Variable'][_0x71e2('0xd')]){_0xdc4857[_0x427250[_0x71e2('0xc')][_0x71e2('0xd')][_0x71e2('0xe')]()]&&_0x3622cc[_0x71e2('0x6')](_0xdc4857[_0x427250['Variable'][_0x71e2('0xd')]['toLowerCase']()][_0x71e2('0xa')]());}else if(_0x427250[_0x71e2('0x4')]===_0x71e2('0xf')){if(_0x427250[_0x71e2('0x10')]==='string'&&_0x427250[_0x71e2('0x11')]){_0x3622cc[_0x71e2('0x6')](util[_0x71e2('0x12')](_0x71e2('0x13'),_0x427250['key'],_0x427250[_0x71e2('0x14')]));}else if(_0x427250['keyType']===_0x71e2('0x8')&&_0x427250[_0x71e2('0x9')]&&_0x427250['key']){_0xdc4857[_0x427250[_0x71e2('0x9')]]&&_0x3622cc['push'](util[_0x71e2('0x12')]('%s:\x20%s',_0x427250[_0x71e2('0x11')],_0xdc4857[_0x427250[_0x71e2('0x9')]]));}else if(_0x427250[_0x71e2('0x10')]===_0x71e2('0xb')&&_0x427250[_0x71e2('0xc')]&&_0x427250[_0x71e2('0xc')][_0x71e2('0xd')]&&_0x427250[_0x71e2('0x11')]){_0xdc4857[_0x427250[_0x71e2('0xc')]['name'][_0x71e2('0xe')]()]&&_0x3622cc[_0x71e2('0x6')](util[_0x71e2('0x12')]('%s:\x20%s',_0x427250[_0x71e2('0x11')],_0xdc4857[_0x427250[_0x71e2('0xc')][_0x71e2('0xd')]['toLowerCase']()]));}}}}return _0x3622cc[_0x71e2('0x15')](_0x4880dc);};exports[_0x71e2('0x16')]=function(_0x8bd89){var _0x4b80bf=_0x8bd89[_0x71e2('0x17')](-0x1);if(_0x4b80bf==='/'){_0x8bd89=_0x8bd89[_0x71e2('0x18')](0x0,_0x8bd89['lastIndexOf'](_0x4b80bf));}return _0x8bd89;};exports['validateEmail']=function(_0x26fc14){if(!_[_0x71e2('0x19')](_0x26fc14)&&_0x26fc14!==''){var _0x583db5=/^(([^<>()\[\]\\.,;:\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 _0x583db5['test'](String(_0x26fc14)[_0x71e2('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x2e6e=['lodash','length','sortBy','type','string','push','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','join','slice','lastIndexOf','validateEmail','test'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2e6e,0x114));var _0xe2e6=function(_0x503679,_0x1d99bf){_0x503679=_0x503679-0x0;var _0x2c6c2b=_0x2e6e[_0x503679];return _0x2c6c2b;};'use strict';var _=require(_0xe2e6('0x0'));var util=require('util');exports['getString']=function(_0x1a3a64,_0x4083b6,_0x5d3d4a){var _0x1e9331=[];if(_0x1a3a64[_0xe2e6('0x1')]>0x0){var _0x448e9e=_[_0xe2e6('0x2')](_0x1a3a64,['id']);for(var _0x2ed7ed=0x0;_0x2ed7ed<_0x448e9e[_0xe2e6('0x1')];_0x2ed7ed++){var _0x54c49a=_0x448e9e[_0x2ed7ed];if(_0x54c49a[_0xe2e6('0x3')]===_0xe2e6('0x4')){_0x1e9331[_0xe2e6('0x5')](_0x54c49a['content']);}else if(_0x54c49a['type']==='variable'&&_0x54c49a[_0xe2e6('0x6')]){_0x4083b6[_0x54c49a[_0xe2e6('0x6')]]&&_0x1e9331[_0xe2e6('0x5')](_0x4083b6[_0x54c49a[_0xe2e6('0x6')]]['toString']());}else if(_0x54c49a['type']==='customVariable'&&_0x54c49a[_0xe2e6('0x7')]&&_0x54c49a[_0xe2e6('0x7')][_0xe2e6('0x8')]){_0x4083b6[_0x54c49a[_0xe2e6('0x7')][_0xe2e6('0x8')][_0xe2e6('0x9')]()]&&_0x1e9331[_0xe2e6('0x5')](_0x4083b6[_0x54c49a[_0xe2e6('0x7')]['name']['toLowerCase']()][_0xe2e6('0xa')]());}else if(_0x54c49a['type']===_0xe2e6('0xb')){if(_0x54c49a[_0xe2e6('0xc')]===_0xe2e6('0x4')&&_0x54c49a[_0xe2e6('0xd')]){_0x1e9331[_0xe2e6('0x5')](util[_0xe2e6('0xe')](_0xe2e6('0xf'),_0x54c49a[_0xe2e6('0xd')],_0x54c49a[_0xe2e6('0x10')]));}else if(_0x54c49a[_0xe2e6('0xc')]==='variable'&&_0x54c49a[_0xe2e6('0x6')]&&_0x54c49a[_0xe2e6('0xd')]){_0x4083b6[_0x54c49a[_0xe2e6('0x6')]]&&_0x1e9331[_0xe2e6('0x5')](util[_0xe2e6('0xe')](_0xe2e6('0xf'),_0x54c49a[_0xe2e6('0xd')],_0x4083b6[_0x54c49a[_0xe2e6('0x6')]]));}else if(_0x54c49a[_0xe2e6('0xc')]===_0xe2e6('0x11')&&_0x54c49a[_0xe2e6('0x7')]&&_0x54c49a['Variable'][_0xe2e6('0x8')]&&_0x54c49a[_0xe2e6('0xd')]){_0x4083b6[_0x54c49a[_0xe2e6('0x7')]['name'][_0xe2e6('0x9')]()]&&_0x1e9331['push'](util['format'](_0xe2e6('0xf'),_0x54c49a['key'],_0x4083b6[_0x54c49a[_0xe2e6('0x7')][_0xe2e6('0x8')][_0xe2e6('0x9')]()]));}}}}return _0x1e9331[_0xe2e6('0x12')](_0x5d3d4a);};exports['stripTrailingSlash']=function(_0x59ef56){var _0x4876ff=_0x59ef56[_0xe2e6('0x13')](-0x1);if(_0x4876ff==='/'){_0x59ef56=_0x59ef56['substring'](0x0,_0x59ef56[_0xe2e6('0x14')](_0x4876ff));}return _0x59ef56;};exports[_0xe2e6('0x15')]=function(_0x2aba76){if(!_['isNil'](_0x2aba76)&&_0x2aba76!==''){var _0x736d53=/^(([^<>()\[\]\\.,;:\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 _0x736d53[_0xe2e6('0x16')](String(_0x2aba76)[_0xe2e6('0x9')]());}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 228e997..707a3b4 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(_0x2d5d8c,_0x44f6b2){var _0x4ae94f=function(_0x5de99f){while(--_0x5de99f){_0x2d5d8c['push'](_0x2d5d8c['shift']());}};_0x4ae94f(++_0x44f6b2);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index e7b8e5d..bf820bc 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 _0x814e=['customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','error','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','Subjects','Descriptions','getString','Fields','then','Ticket\x20created!','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','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','[HTTP]','stringify','GET','map','includes','string','picklist','customField','nameField','type','idField','custom_fields','push','content','variable','variableName'];(function(_0x523c78,_0x14129e){var _0x116745=function(_0x430e7b){while(--_0x430e7b){_0x523c78['push'](_0x523c78['shift']());}};_0x116745(++_0x14129e);}(_0x814e,0x17b));var _0xe814=function(_0x1ef66b,_0x227cc0){_0x1ef66b=_0x1ef66b-0x0;var _0x535b30=_0x814e[_0x1ef66b];return _0x535b30;};'use strict';var _=require(_0xe814('0x0'));var rp=require(_0xe814('0x1'));var md5=require('md5');var util=require(_0xe814('0x2'));var Redis=require(_0xe814('0x3'));var intUtil=require('./util');var config=require(_0xe814('0x4'));var logger=require('../../../../config/logger')(_0xe814('0x5'));config[_0xe814('0x6')]=_[_0xe814('0x7')](config[_0xe814('0x6')],{'host':_0xe814('0x8'),'port':0x18eb});var io=require(_0xe814('0x9'))(new Redis(config[_0xe814('0x6')]));function emit(_0x4d0f84,_0x4e3f58,_0x382d84){io['to'](_0x4d0f84)['emit'](_0x4e3f58,_0x382d84);}var headers={'Content-Type':'application/json','Accept':_0xe814('0xa')};function getTicket(_0x229333,_0x263434,_0x5c325d,_0x3d10d9,_0xa700){logger[_0xe814('0xb')](_0xe814('0xc'));return request({'uri':util[_0xe814('0xd')]('%s/tickets.json',_0x229333[_0xe814('0xe')]),'method':_0xe814('0xf'),'body':{'ticket':_[_0xe814('0x10')]({'requester_id':_0x5c325d['id'],'submitter_id':_0x263434?_0x263434['id']:undefined,'assignee_id':_0x263434?_0x263434['id']:undefined,'tags':getTags(_0x3d10d9[_0xe814('0x11')],_0xe814('0x12')),'subject':intUtil['getString'](_0x3d10d9[_0xe814('0x13')],_0xa700,'\x20'),'description':intUtil['getString'](_0x3d10d9[_0xe814('0x14')],_0xa700,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe814('0x15')](_0x3d10d9['Descriptions'],_0xa700,'\x0a')}},getCustomFields(_0x3d10d9[_0xe814('0x16')],_0xa700))}})[_0xe814('0x17')](function(_0x575aea){logger[_0xe814('0xb')](_0xe814('0x18'));return _0x575aea['ticket'];});}function getUser(_0x21defc,_0x1dcbe4){if(intUtil['validateEmail'](_0x1dcbe4)){logger['info'](_0xe814('0x19'),_0x1dcbe4);return request({'uri':util[_0xe814('0xd')](_0xe814('0x1a'),_0x21defc[_0xe814('0xe')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x1dcbe4)}})[_0xe814('0x17')](function(_0x22218b){if(_0x22218b[_0xe814('0x1b')]){logger[_0xe814('0xb')](_0xe814('0x1c'));return _[_0xe814('0x1d')](_0x22218b[_0xe814('0x1e')],{'email':_0x1dcbe4,'role':_0xe814('0x1f')});}else{logger['info'](_0xe814('0x20'));return request({'uri':util[_0xe814('0xd')](_0xe814('0x21'),_0x21defc['remoteUri'])})[_0xe814('0x17')](function(_0x34b203){logger['info'](_0xe814('0x22'));return _0x34b203[_0xe814('0x23')];});}});}else{logger[_0xe814('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe814('0xd')](_0xe814('0x21'),_0x21defc[_0xe814('0xe')])})[_0xe814('0x17')](function(_0x594247){logger['info'](_0xe814('0x22'));return _0x594247[_0xe814('0x23')];});}}function getEndUser(_0x3b69fe,_0x20afd5,_0x1b8575){logger[_0xe814('0xb')](_0xe814('0x24'),_0x1b8575);return request({'uri':util[_0xe814('0xd')](_0xe814('0x1a'),_0x3b69fe[_0xe814('0xe')]),'qs':{'query':util[_0xe814('0xd')](_0xe814('0x25'),_0x1b8575)}})[_0xe814('0x17')](function(_0xd7e7c3){var _0x28762e;if(_0xd7e7c3[_0xe814('0x1e')][_0xe814('0x26')]){_0xd7e7c3[_0xe814('0x1e')]=_[_0xe814('0x27')](_0xd7e7c3['results'],{'suspended':![],'role':_0xe814('0x28')});if(_0xd7e7c3['results']['length']){_0x28762e=_[_0xe814('0x29')](_0xd7e7c3[_0xe814('0x1e')]);}}if(_0x28762e){logger[_0xe814('0xb')](_0xe814('0x2a'));return _0x28762e;}else{logger[_0xe814('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xe814('0xd')](_0xe814('0x2b'),_0x3b69fe['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xe814('0xd')]('Caller\x20-\x20%s',_0x20afd5||_0x1b8575),'phone':_0x1b8575}}})[_0xe814('0x17')](function(_0x5eef71){logger[_0xe814('0xb')](_0xe814('0x2c'));return _0x5eef71['user'];});}});}function getAuth(_0x11f5bc){var _0x1361a6;if(_0x11f5bc[_0xe814('0x2d')]===_0xe814('0x2e')){_0x1361a6=util[_0xe814('0xd')](_0xe814('0x2f'),_0x11f5bc[_0xe814('0x30')],_0x11f5bc[_0xe814('0x2e')]);}else if(_0x11f5bc['authType']===_0xe814('0x31')){_0x1361a6=util[_0xe814('0xd')](_0xe814('0x32'),_0x11f5bc[_0xe814('0x30')],_0x11f5bc[_0xe814('0x31')]);}return util[_0xe814('0xd')]('Basic\x20%s',new Buffer(_0x1361a6)[_0xe814('0x33')](_0xe814('0x34')));}function request(_0x1f0f5d){logger['debug'](_0xe814('0x35'),JSON[_0xe814('0x36')](_0x1f0f5d));return rp(_['defaults'](_0x1f0f5d,{'method':_0xe814('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1c9f13,_0x37ef4c){var _0x3fd897=[];if(_0x1c9f13&&_0x1c9f13[_0xe814('0x26')]>0x0){_0x3fd897=_[_0xe814('0x38')](_0x1c9f13,_0x37ef4c);}return _0x3fd897;}function getCustomFields(_0x1378a2,_0xf9f27d){var _0x54e6ef=[];var _0x560f4d={'custom_fields':[]};if(_0x1378a2[_0xe814('0x26')]>0x0){_['forEach'](_0x1378a2,function(_0x87fcbd){if(_[_0xe814('0x39')]([_0xe814('0x3a'),_0xe814('0x3b')],_0x87fcbd['type'])&&_0x87fcbd['nameField']&&!_0x87fcbd[_0xe814('0x3c')]){_0x560f4d[_0x87fcbd[_0xe814('0x3d')]['toLowerCase']()]=_0x87fcbd['content']['toString']();}else if(_[_0xe814('0x39')]([_0xe814('0x3a'),_0xe814('0x3b')],_0x87fcbd[_0xe814('0x3e')])&&_0x87fcbd[_0xe814('0x3f')]&&_0x87fcbd['customField']){_0x560f4d[_0xe814('0x40')][_0xe814('0x41')]({'id':_0x87fcbd['idField'],'value':_0x87fcbd[_0xe814('0x42')][_0xe814('0x33')]()});}else if(_0x87fcbd[_0xe814('0x3e')]===_0xe814('0x43')&&_0x87fcbd[_0xe814('0x44')]&&_0x87fcbd[_0xe814('0x3f')]&&_0x87fcbd['customField']){_0xf9f27d[_0x87fcbd['variableName']]&&_0x560f4d['custom_fields'][_0xe814('0x41')]({'id':_0x87fcbd['idField'],'value':_0xf9f27d[_0x87fcbd[_0xe814('0x44')]][_0xe814('0x33')]()});}else if(_0x87fcbd[_0xe814('0x3e')]===_0xe814('0x45')&&_0x87fcbd[_0xe814('0x46')]&&_0x87fcbd[_0xe814('0x46')][_0xe814('0x12')]&&_0x87fcbd[_0xe814('0x3f')]&&_0x87fcbd[_0xe814('0x3c')]){_0xf9f27d[_0x87fcbd[_0xe814('0x46')]['name'][_0xe814('0x47')]()]&&_0x560f4d[_0xe814('0x40')][_0xe814('0x41')]({'id':_0x87fcbd[_0xe814('0x3f')],'value':_0xf9f27d[_0x87fcbd[_0xe814('0x46')]['name'][_0xe814('0x47')]()]['toString']()});}});}return _0x560f4d;}exports[_0xe814('0x48')]=function(_0x567e50,_0x141209,_0x2952c9,_0x5b4fae,_0x3a6820,_0xbd2fef){var _0x20b2f9,_0x59c664;_0xbd2fef[_0xe814('0xe')]=intUtil[_0xe814('0x49')](_0xbd2fef[_0xe814('0xe')]);_0xbd2fef[_0xe814('0x4a')]=intUtil[_0xe814('0x49')](_0xbd2fef[_0xe814('0x4a')]);if(_0x3a6820&&_0x3a6820[_0xe814('0x4b')]){logger[_0xe814('0xb')](_0xe814('0x4c'),_0xe814('0x4d'));_0x141209[_0xe814('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xbd2fef[_0xe814('0x4a')],_0x141209[_0xe814('0x4f')],md5(_0x141209[_0xe814('0x4f')]));}else{_0x141209['recordingURL']='';}headers[_0xe814('0x50')]=getAuth(_0xbd2fef);return getUser(_0xbd2fef,_0x5b4fae[_0xe814('0x51')])['then'](function(_0x4027f6){_0x20b2f9=_0x4027f6;logger[_0xe814('0xb')](_0xe814('0x52'),_0x20b2f9['id']);return getEndUser(_0xbd2fef,_0x141209[_0xe814('0x53')],_0x141209[_0xe814('0x54')]);})[_0xe814('0x17')](function(_0x301c21){_0x59c664=_0x301c21;logger['info']('The\x20Enduser\x20ID\x20is:',_0x59c664['id']);return getTicket(_0xbd2fef,_0x20b2f9,_0x59c664,_0x2952c9,_0x141209);})['then'](function(_0x768d6e){if(_0x768d6e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x768d6e['id']);switch(_0xbd2fef[_0xe814('0x3e')]){case _0xe814('0x55'):logger[_0xe814('0xb')](_0xe814('0x4c'),_0xe814('0x56'));return request({'uri':util[_0xe814('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xbd2fef[_0xe814('0xe')],_0x20b2f9['id'],_0x768d6e['id']),'method':_0xe814('0xf')});case _0xe814('0x57'):logger[_0xe814('0xb')](_0xe814('0x4c'),_0xe814('0x58'));emit(util[_0xe814('0xd')](_0xe814('0x59'),_0x5b4fae[_0xe814('0x12')]),_0xe814('0x5a'),{'uri':util[_0xe814('0xd')](_0xe814('0x5b'),_0xbd2fef[_0xe814('0xe')][_0xe814('0x5c')](_0xe814('0x5d'),''),_0x768d6e['id'])});break;default:logger['error'](_0xe814('0x4c'),_0xe814('0x5e'));}}})[_0xe814('0x5f')](function(_0x4f55fe){logger['error'](_0xe814('0x60'),util[_0xe814('0x61')](_0x4f55fe,{'showHidden':!![],'depth':null}));});};exports[_0xe814('0x62')]=function(_0x301175,_0x12e192,_0x297776,_0x52f359,_0x456973,_0xd31f26,_0x2cdfdf){var _0x40194b,_0x41dce8;_0xd31f26[_0xe814('0xe')]=intUtil['stripTrailingSlash'](_0xd31f26[_0xe814('0xe')]);_0xd31f26[_0xe814('0x4a')]=intUtil[_0xe814('0x49')](_0xd31f26[_0xe814('0x4a')]);if(_0x2cdfdf&&_0x2cdfdf['recordingFormat']&&_0x2cdfdf[_0xe814('0x63')]!==_0xe814('0x64')){logger[_0xe814('0xb')](_0xe814('0x65'),_0xe814('0x4d'));_0x12e192[_0xe814('0x4e')]=util[_0xe814('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd31f26[_0xe814('0x4a')],_0x12e192[_0xe814('0x4f')],md5(_0x12e192[_0xe814('0x4f')]));}headers[_0xe814('0x50')]=getAuth(_0xd31f26);return getUser(_0xd31f26,_0x52f359[_0xe814('0x51')])[_0xe814('0x17')](function(_0x5c649b){_0x40194b=_0x5c649b;logger['info'](_0xe814('0x52'),_0x40194b['id']);return getEndUser(_0xd31f26,_0x12e192[_0xe814('0x66')],_0x12e192['destcalleridnum']);})[_0xe814('0x17')](function(_0x2b28f2){_0x41dce8=_0x2b28f2;logger[_0xe814('0xb')](_0xe814('0x67'),_0x41dce8['id']);return getTicket(_0xd31f26,_0x40194b,_0x41dce8,_0x297776,_0x12e192);})[_0xe814('0x17')](function(_0x3a33ef){if(_0x3a33ef){logger[_0xe814('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3a33ef['id']);switch(_0xd31f26[_0xe814('0x3e')]){case _0xe814('0x55'):logger[_0xe814('0xb')](_0xe814('0x65'),_0xe814('0x56'));return request({'uri':util['format'](_0xe814('0x68'),_0xd31f26['remoteUri'],_0x40194b['id'],_0x3a33ef['id']),'method':_0xe814('0xf')});case _0xe814('0x57'):logger[_0xe814('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe814('0x59'),_0x52f359[_0xe814('0x12')]),_0xe814('0x5a'),{'uri':util['format'](_0xe814('0x5b'),_0xd31f26[_0xe814('0xe')]['replace']('/api/v2',''),_0x3a33ef['id'])});break;default:logger[_0xe814('0x69')](_0xe814('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xe814('0x5f')](function(_0x4ff145){logger[_0xe814('0x69')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xe814('0x61')](_0x4ff145,{'showHidden':!![],'depth':null}));});};exports[_0xe814('0x6a')]=function(_0x48050b,_0x283237,_0x36bce6,_0x4fd9d3,_0x429fb0,_0x22e36c){var _0x2a0603,_0x352101;_0x22e36c[_0xe814('0xe')]=intUtil[_0xe814('0x49')](_0x22e36c['remoteUri']);_0x22e36c[_0xe814('0x4a')]=intUtil[_0xe814('0x49')](_0x22e36c['serverUrl']);if(_0x429fb0&&_0x429fb0[_0xe814('0x4b')]){logger[_0xe814('0xb')]('['+_0x283237[_0xe814('0x6b')][_0xe814('0x6c')]()+']',_0xe814('0x4d'));_0x283237[_0xe814('0x4e')]=util['format'](_0xe814('0x6d'),_0x22e36c[_0xe814('0x4a')],_0x283237[_0xe814('0x4f')],md5(_0x283237[_0xe814('0x4f')]));}else{_0x283237[_0xe814('0x4e')]='';}headers[_0xe814('0x50')]=getAuth(_0x22e36c);return getUser(_0x22e36c)[_0xe814('0x17')](function(_0x43f73f){_0x2a0603=_0x43f73f;logger[_0xe814('0xb')]('The\x20User\x20ID\x20is:',_0x2a0603['id']);return getEndUser(_0x22e36c,_0x283237[_0xe814('0x53')],_0x283237[_0xe814('0x54')]);})[_0xe814('0x17')](function(_0x49c634){_0x352101=_0x49c634;logger['info'](_0xe814('0x67'),_0x352101['id']);return getTicket(_0x22e36c,_0x2a0603,_0x352101,_0x36bce6,_0x283237);})[_0xe814('0x17')](function(_0x4f0766){if(_0x4f0766){logger[_0xe814('0xb')](_0xe814('0x6e'),_0x4f0766['id']);}})[_0xe814('0x5f')](function(_0x196133){logger['error']('['+_0x283237['lastevent'][_0xe814('0x6c')]()+']'+_0xe814('0x6f'),util[_0xe814('0x61')](_0x196133,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe35a=['queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','%s/token:%s','token','Basic\x20%s','toString','debug','stringify','defaults','GET','forEach','includes','type','nameField','customField','content','string','idField','custom_fields','push','variable','variableName','Variable','toLowerCase'];(function(_0x2cb168,_0x5cf150){var _0x332c91=function(_0x5161e1){while(--_0x5161e1){_0x2cb168['push'](_0x2cb168['shift']());}};_0x332c91(++_0x5cf150);}(_0xe35a,0x103));var _0xae35=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xe35a[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require(_0xae35('0x0'));var rp=require(_0xae35('0x1'));var md5=require(_0xae35('0x2'));var util=require(_0xae35('0x3'));var Redis=require('ioredis');var intUtil=require(_0xae35('0x4'));var config=require(_0xae35('0x5'));var logger=require(_0xae35('0x6'))('zendesk');config['redis']=_['defaults'](config[_0xae35('0x7')],{'host':_0xae35('0x8'),'port':0x18eb});var io=require(_0xae35('0x9'))(new Redis(config['redis']));function emit(_0xb5d288,_0x3d7745,_0x4d7d4c){io['to'](_0xb5d288)[_0xae35('0xa')](_0x3d7745,_0x4d7d4c);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x370546,_0x2ce39f,_0x538162,_0x1a81c9,_0x1a5790){logger[_0xae35('0xb')](_0xae35('0xc'));return request({'uri':util['format'](_0xae35('0xd'),_0x370546[_0xae35('0xe')]),'method':_0xae35('0xf'),'body':{'ticket':_[_0xae35('0x10')]({'requester_id':_0x538162['id'],'submitter_id':_0x2ce39f?_0x2ce39f['id']:undefined,'assignee_id':_0x2ce39f?_0x2ce39f['id']:undefined,'tags':getTags(_0x1a81c9[_0xae35('0x11')],_0xae35('0x12')),'subject':intUtil[_0xae35('0x13')](_0x1a81c9[_0xae35('0x14')],_0x1a5790,'\x20'),'description':intUtil[_0xae35('0x13')](_0x1a81c9[_0xae35('0x15')],_0x1a5790,'\x0a'),'comment':{'public':![],'body':intUtil[_0xae35('0x13')](_0x1a81c9[_0xae35('0x15')],_0x1a5790,'\x0a')}},getCustomFields(_0x1a81c9[_0xae35('0x16')],_0x1a5790))}})[_0xae35('0x17')](function(_0x6e3adb){logger[_0xae35('0xb')](_0xae35('0x18'));return _0x6e3adb[_0xae35('0x19')];});}function getUser(_0x5d121c,_0x17acc1){if(intUtil[_0xae35('0x1a')](_0x17acc1)){logger[_0xae35('0xb')]('Getting\x20agent\x20with\x20email',_0x17acc1);return request({'uri':util[_0xae35('0x1b')](_0xae35('0x1c'),_0x5d121c['remoteUri']),'qs':{'query':util[_0xae35('0x1b')](_0xae35('0x1d'),_0x17acc1)}})[_0xae35('0x17')](function(_0x3e00eb){if(_0x3e00eb['count']){logger['info'](_0xae35('0x1e'));return _[_0xae35('0x1f')](_0x3e00eb[_0xae35('0x20')],{'email':_0x17acc1,'role':_0xae35('0x21')});}else{logger['info'](_0xae35('0x22'));return request({'uri':util['format']('%s/users/me.json',_0x5d121c[_0xae35('0xe')])})['then'](function(_0x24cf90){logger['info']('Admin\x20account\x20selected.');return _0x24cf90[_0xae35('0x23')];});}});}else{logger[_0xae35('0xb')](_0xae35('0x22'));return request({'uri':util['format'](_0xae35('0x24'),_0x5d121c[_0xae35('0xe')])})[_0xae35('0x17')](function(_0x57022c){logger[_0xae35('0xb')](_0xae35('0x25'));return _0x57022c[_0xae35('0x23')];});}}function getEndUser(_0x542aba,_0x12954f,_0x20ece5){logger[_0xae35('0xb')](_0xae35('0x26'),_0x20ece5);return request({'uri':util[_0xae35('0x1b')](_0xae35('0x1c'),_0x542aba[_0xae35('0xe')]),'qs':{'query':util[_0xae35('0x1b')](_0xae35('0x27'),_0x20ece5)}})[_0xae35('0x17')](function(_0x5cefea){var _0x3414bb;if(_0x5cefea['results'][_0xae35('0x28')]){_0x5cefea['results']=_['filter'](_0x5cefea[_0xae35('0x20')],{'suspended':![],'role':_0xae35('0x29')});if(_0x5cefea[_0xae35('0x20')][_0xae35('0x28')]){_0x3414bb=_[_0xae35('0x2a')](_0x5cefea[_0xae35('0x20')]);}}if(_0x3414bb){logger[_0xae35('0xb')]('Enduser\x20found!');return _0x3414bb;}else{logger[_0xae35('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xae35('0x2b'),_0x542aba[_0xae35('0xe')]),'method':'POST','body':{'user':{'role':_0xae35('0x29'),'name':util[_0xae35('0x1b')](_0xae35('0x2c'),_0x12954f||_0x20ece5),'phone':_0x20ece5}}})[_0xae35('0x17')](function(_0x39e4a8){logger[_0xae35('0xb')](_0xae35('0x2d'));return _0x39e4a8[_0xae35('0x23')];});}});}function getAuth(_0x594d38){var _0x1fed98;if(_0x594d38[_0xae35('0x2e')]===_0xae35('0x2f')){_0x1fed98=util[_0xae35('0x1b')](_0xae35('0x30'),_0x594d38['username'],_0x594d38[_0xae35('0x2f')]);}else if(_0x594d38[_0xae35('0x2e')]==='token'){_0x1fed98=util['format'](_0xae35('0x31'),_0x594d38['username'],_0x594d38[_0xae35('0x32')]);}return util[_0xae35('0x1b')](_0xae35('0x33'),new Buffer(_0x1fed98)[_0xae35('0x34')]('base64'));}function request(_0x54fc98){logger[_0xae35('0x35')]('[HTTP]',JSON[_0xae35('0x36')](_0x54fc98));return rp(_[_0xae35('0x37')](_0x54fc98,{'method':_0xae35('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x45c8d5,_0x452feb){var _0x597122=[];if(_0x45c8d5&&_0x45c8d5['length']>0x0){_0x597122=_['map'](_0x45c8d5,_0x452feb);}return _0x597122;}function getCustomFields(_0x16063c,_0xbfbc4a){var _0x377197=[];var _0x3d82fe={'custom_fields':[]};if(_0x16063c[_0xae35('0x28')]>0x0){_[_0xae35('0x39')](_0x16063c,function(_0x265e97){if(_[_0xae35('0x3a')](['string','picklist'],_0x265e97[_0xae35('0x3b')])&&_0x265e97[_0xae35('0x3c')]&&!_0x265e97[_0xae35('0x3d')]){_0x3d82fe[_0x265e97['nameField']['toLowerCase']()]=_0x265e97[_0xae35('0x3e')][_0xae35('0x34')]();}else if(_[_0xae35('0x3a')]([_0xae35('0x3f'),'picklist'],_0x265e97[_0xae35('0x3b')])&&_0x265e97[_0xae35('0x40')]&&_0x265e97[_0xae35('0x3d')]){_0x3d82fe[_0xae35('0x41')][_0xae35('0x42')]({'id':_0x265e97[_0xae35('0x40')],'value':_0x265e97[_0xae35('0x3e')][_0xae35('0x34')]()});}else if(_0x265e97[_0xae35('0x3b')]===_0xae35('0x43')&&_0x265e97[_0xae35('0x44')]&&_0x265e97[_0xae35('0x40')]&&_0x265e97[_0xae35('0x3d')]){_0xbfbc4a[_0x265e97[_0xae35('0x44')]]&&_0x3d82fe[_0xae35('0x41')][_0xae35('0x42')]({'id':_0x265e97[_0xae35('0x40')],'value':_0xbfbc4a[_0x265e97[_0xae35('0x44')]][_0xae35('0x34')]()});}else if(_0x265e97['type']==='customVariable'&&_0x265e97[_0xae35('0x45')]&&_0x265e97[_0xae35('0x45')][_0xae35('0x12')]&&_0x265e97[_0xae35('0x40')]&&_0x265e97['customField']){_0xbfbc4a[_0x265e97[_0xae35('0x45')][_0xae35('0x12')][_0xae35('0x46')]()]&&_0x3d82fe[_0xae35('0x41')]['push']({'id':_0x265e97[_0xae35('0x40')],'value':_0xbfbc4a[_0x265e97[_0xae35('0x45')]['name']['toLowerCase']()][_0xae35('0x34')]()});}});}return _0x3d82fe;}exports[_0xae35('0x47')]=function(_0x4c4c64,_0x196080,_0x93f6cd,_0x5a7072,_0xe5efc,_0xa27035){var _0x341c48,_0xcca360;_0xa27035['remoteUri']=intUtil[_0xae35('0x48')](_0xa27035[_0xae35('0xe')]);_0xa27035[_0xae35('0x49')]=intUtil[_0xae35('0x48')](_0xa27035['serverUrl']);if(_0xe5efc&&_0xe5efc['monitor_format']){logger['info']('[QUEUE]',_0xae35('0x4a'));_0x196080[_0xae35('0x4b')]=util[_0xae35('0x1b')](_0xae35('0x4c'),_0xa27035[_0xae35('0x49')],_0x196080[_0xae35('0x4d')],md5(_0x196080[_0xae35('0x4d')]));}else{_0x196080[_0xae35('0x4b')]='';}headers[_0xae35('0x4e')]=getAuth(_0xa27035);return getUser(_0xa27035,_0x5a7072['email'])[_0xae35('0x17')](function(_0x51f0c8){_0x341c48=_0x51f0c8;logger[_0xae35('0xb')](_0xae35('0x4f'),_0x341c48['id']);return getEndUser(_0xa27035,_0x196080['calleridname'],_0x196080[_0xae35('0x50')]);})['then'](function(_0x42542c){_0xcca360=_0x42542c;logger[_0xae35('0xb')](_0xae35('0x51'),_0xcca360['id']);return getTicket(_0xa27035,_0x341c48,_0xcca360,_0x93f6cd,_0x196080);})[_0xae35('0x17')](function(_0x54dae5){if(_0x54dae5){logger[_0xae35('0xb')](_0xae35('0x52'),_0x54dae5['id']);switch(_0xa27035[_0xae35('0x3b')]){case _0xae35('0x53'):logger[_0xae35('0xb')](_0xae35('0x54'),_0xae35('0x55'));return request({'uri':util[_0xae35('0x1b')](_0xae35('0x56'),_0xa27035[_0xae35('0xe')],_0x341c48['id'],_0x54dae5['id']),'method':'POST'});case _0xae35('0x57'):logger[_0xae35('0xb')](_0xae35('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xae35('0x1b')](_0xae35('0x58'),_0x5a7072[_0xae35('0x12')]),_0xae35('0x59'),{'uri':util['format'](_0xae35('0x5a'),_0xa27035[_0xae35('0xe')][_0xae35('0x5b')](_0xae35('0x5c'),''),_0x54dae5['id'])});break;default:logger[_0xae35('0x5d')](_0xae35('0x54'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xae35('0x5e')](function(_0x5a9fee){logger[_0xae35('0x5d')](_0xae35('0x5f'),util[_0xae35('0x60')](_0x5a9fee,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x53e922,_0x5080c6,_0x5a0495,_0x2f3eae,_0x39dbec,_0x3bb00b,_0x38c667){var _0x13185e,_0x48cff8;_0x3bb00b['remoteUri']=intUtil['stripTrailingSlash'](_0x3bb00b['remoteUri']);_0x3bb00b[_0xae35('0x49')]=intUtil[_0xae35('0x48')](_0x3bb00b[_0xae35('0x49')]);if(_0x38c667&&_0x38c667[_0xae35('0x61')]&&_0x38c667[_0xae35('0x61')]!==_0xae35('0x62')){logger[_0xae35('0xb')](_0xae35('0x63'),_0xae35('0x4a'));_0x5080c6[_0xae35('0x4b')]=util[_0xae35('0x1b')](_0xae35('0x4c'),_0x3bb00b[_0xae35('0x49')],_0x5080c6[_0xae35('0x4d')],md5(_0x5080c6[_0xae35('0x4d')]));}headers['Authorization']=getAuth(_0x3bb00b);return getUser(_0x3bb00b,_0x2f3eae[_0xae35('0x64')])['then'](function(_0x39cd7d){_0x13185e=_0x39cd7d;logger[_0xae35('0xb')](_0xae35('0x4f'),_0x13185e['id']);return getEndUser(_0x3bb00b,_0x5080c6[_0xae35('0x65')],_0x5080c6[_0xae35('0x66')]);})[_0xae35('0x17')](function(_0x3bfb87){_0x48cff8=_0x3bfb87;logger[_0xae35('0xb')]('The\x20Enduser\x20ID\x20is:',_0x48cff8['id']);return getTicket(_0x3bb00b,_0x13185e,_0x48cff8,_0x5a0495,_0x5080c6);})[_0xae35('0x17')](function(_0x48a82e){if(_0x48a82e){logger['info'](_0xae35('0x52'),_0x48a82e['id']);switch(_0x3bb00b[_0xae35('0x3b')]){case'integrationTab':logger[_0xae35('0xb')](_0xae35('0x63'),_0xae35('0x55'));return request({'uri':util[_0xae35('0x1b')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3bb00b[_0xae35('0xe')],_0x13185e['id'],_0x48a82e['id']),'method':_0xae35('0xf')});case _0xae35('0x57'):logger[_0xae35('0xb')](_0xae35('0x63'),_0xae35('0x67'));emit(util[_0xae35('0x1b')](_0xae35('0x58'),_0x2f3eae[_0xae35('0x12')]),_0xae35('0x59'),{'uri':util[_0xae35('0x1b')]('%s/agent/tickets/%s',_0x3bb00b['remoteUri'][_0xae35('0x5b')](_0xae35('0x5c'),''),_0x48a82e['id'])});break;default:logger[_0xae35('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xae35('0x5e')](function(_0x1c4d2a){logger[_0xae35('0x5d')](_0xae35('0x68'),util['inspect'](_0x1c4d2a,{'showHidden':!![],'depth':null}));});};exports[_0xae35('0x69')]=function(_0x9d29be,_0x5018da,_0x4e86ae,_0x1f6f2a,_0x4b9c01,_0x1c20b4){var _0x1e8f50,_0x1678fa;_0x1c20b4[_0xae35('0xe')]=intUtil[_0xae35('0x48')](_0x1c20b4[_0xae35('0xe')]);_0x1c20b4[_0xae35('0x49')]=intUtil['stripTrailingSlash'](_0x1c20b4[_0xae35('0x49')]);if(_0x4b9c01&&_0x4b9c01['monitor_format']){logger[_0xae35('0xb')]('['+_0x5018da[_0xae35('0x6a')][_0xae35('0x6b')]()+']',_0xae35('0x4a'));_0x5018da[_0xae35('0x4b')]=util[_0xae35('0x1b')](_0xae35('0x4c'),_0x1c20b4[_0xae35('0x49')],_0x5018da[_0xae35('0x4d')],md5(_0x5018da['uniqueid']));}else{_0x5018da[_0xae35('0x4b')]='';}headers[_0xae35('0x4e')]=getAuth(_0x1c20b4);return getUser(_0x1c20b4)[_0xae35('0x17')](function(_0x4b4967){_0x1e8f50=_0x4b4967;logger[_0xae35('0xb')](_0xae35('0x4f'),_0x1e8f50['id']);return getEndUser(_0x1c20b4,_0x5018da[_0xae35('0x6c')],_0x5018da['calleridnum']);})[_0xae35('0x17')](function(_0x1cc1a7){_0x1678fa=_0x1cc1a7;logger[_0xae35('0xb')](_0xae35('0x51'),_0x1678fa['id']);return getTicket(_0x1c20b4,_0x1e8f50,_0x1678fa,_0x4e86ae,_0x5018da);})[_0xae35('0x17')](function(_0x2c34bf){if(_0x2c34bf){logger[_0xae35('0xb')](_0xae35('0x52'),_0x2c34bf['id']);}})[_0xae35('0x5e')](function(_0x339040){logger[_0xae35('0x5d')]('['+_0x5018da[_0xae35('0x6a')][_0xae35('0x6b')]()+']'+_0xae35('0x6d'),util[_0xae35('0x60')](_0x339040,{'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 7ef7770..c800692 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 _0x18ee=['Call_Start_Time','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20Call\x20ID\x20is:','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','recordingURL','zoho.eu','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','lastevent','toUpperCase','calleridname','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','seconds','catch','error','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','then','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','mm:ss','called','Call_Result','Called','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout'];(function(_0x48db9b,_0x1a27ea){var _0x2d264c=function(_0x2d750b){while(--_0x2d750b){_0x48db9b['push'](_0x48db9b['shift']());}};_0x2d264c(++_0x1a27ea);}(_0x18ee,0xb7));var _0xe18e=function(_0x360b41,_0x6a5a52){_0x360b41=_0x360b41-0x0;var _0x212d95=_0x18ee[_0x360b41];return _0x212d95;};'use strict';var _=require('lodash');var rp=require(_0xe18e('0x0'));var md5=require(_0xe18e('0x1'));var util=require('util');var intUtil=require('./util');var moment=require(_0xe18e('0x2'));var Redis=require(_0xe18e('0x3'));var BPromise=require(_0xe18e('0x4'));var config=require(_0xe18e('0x5'));var logger=require(_0xe18e('0x6'))(_0xe18e('0x7'));config[_0xe18e('0x8')]=_[_0xe18e('0x9')](config['redis'],{'host':_0xe18e('0xa'),'port':0x18eb});var io=require(_0xe18e('0xb'))(new Redis(config[_0xe18e('0x8')]));function emit(_0xa2abb6,_0x24290f,_0xc5a543){io['to'](_0xa2abb6)[_0xe18e('0xc')](_0x24290f,_0xc5a543);}function request(_0x17bac4){logger[_0xe18e('0xd')]('[HTTP]',JSON[_0xe18e('0xe')](_0x17bac4));return rp(_0x17bac4);}function getCustomFields(_0x3cf904,_0x5c02d8){var _0x1fe9a2={};if(_0x3cf904[_0xe18e('0xf')]>0x0){_[_0xe18e('0x10')](_0x3cf904,function(_0x4ca7ad){if(_[_0xe18e('0x11')]([_0xe18e('0x12'),'picklist'],_0x4ca7ad['type'])&&_0x4ca7ad[_0xe18e('0x13')]){_0x1fe9a2[_0x4ca7ad[_0xe18e('0x13')]]=_0x4ca7ad[_0xe18e('0x14')][_0xe18e('0x15')]();}else if(_0x4ca7ad[_0xe18e('0x16')]==='variable'&&_0x4ca7ad[_0xe18e('0x17')]&&_0x4ca7ad[_0xe18e('0x13')]&&_0x5c02d8[_0x4ca7ad[_0xe18e('0x17')]]){_0x1fe9a2[_0x4ca7ad[_0xe18e('0x13')]]=_0x5c02d8[_0x4ca7ad[_0xe18e('0x17')]][_0xe18e('0x15')]();}else if(_0x4ca7ad[_0xe18e('0x16')]===_0xe18e('0x18')&&_0x4ca7ad[_0xe18e('0x19')]&&_0x4ca7ad[_0xe18e('0x19')][_0xe18e('0x1a')]&&_0x4ca7ad[_0xe18e('0x13')]&&_0x5c02d8[_0x4ca7ad[_0xe18e('0x19')][_0xe18e('0x1a')][_0xe18e('0x1b')]()]){_0x1fe9a2[_0x4ca7ad[_0xe18e('0x13')]]=_0x5c02d8[_0x4ca7ad[_0xe18e('0x19')][_0xe18e('0x1a')][_0xe18e('0x1b')]()][_0xe18e('0x15')]();}});}return _0x1fe9a2;}function getName(_0x31fadd){if(_0x31fadd['indexOf']('\x20')>0x0){var _0xeed7aa=_0x31fadd[_0xe18e('0x1c')](/ (.+)/);if(_0xeed7aa[0x1]){return _0xeed7aa;}}return[_0x31fadd,_0x31fadd];}var accountsTokens={};function getAccessToken(_0x5be277){return new Promise(function(_0x330312,_0x27fe88){if(!_['isNil'](accountsTokens[_0x5be277['id']])&&!_[_0xe18e('0x1d')](accountsTokens[_0x5be277['id']][_0xe18e('0x1e')])){if(moment()[_0xe18e('0x1f')](accountsTokens[_0x5be277['id']][_0xe18e('0x20')])){_0x330312(accountsTokens[_0x5be277['id']][_0xe18e('0x1e')]);}}var _0xc764b;switch(_0x5be277[_0xe18e('0x21')]){case'US':_0xc764b='https://accounts.zoho.com';break;case'AU':_0xc764b=_0xe18e('0x22');break;case'EU':_0xc764b='https://accounts.zoho.eu';break;case'IN':_0xc764b=_0xe18e('0x23');break;case'CN':_0xc764b='https://accounts.zoho.com.cn';break;default:_0xc764b='https://accounts.zoho.eu';break;}var _0x50def4={'method':_0xe18e('0x24'),'uri':_0xc764b+_0xe18e('0x25'),'qs':{'refresh_token':_0x5be277[_0xe18e('0x26')],'client_id':_0x5be277[_0xe18e('0x27')],'client_secret':_0x5be277[_0xe18e('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x50def4)['then'](function(_0x515c81){accountsTokens[_0x5be277['id']]={'access_token':_0x515c81[_0xe18e('0x1e')],'expires_in':moment()['add'](_0x515c81[_0xe18e('0x20')],_0xe18e('0x29'))};_0x330312(_0x515c81[_0xe18e('0x1e')]);})[_0xe18e('0x2a')](function(_0x21c442){logger[_0xe18e('0x2b')]('Failing\x20creating\x20the\x20access_token',_0x21c442[_0xe18e('0x2c')]);_0x27fe88(_0x21c442);});});}function getUser(_0x47fc88,_0xc59e7d,_0x881ccd,_0xc6ba63){logger[_0xe18e('0x2d')](_0xe18e('0x2e'));return request({'method':'GET','uri':util[_0xe18e('0x2f')](_0xe18e('0x30'),_0xc59e7d),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xe18e('0x31')+_0x47fc88},'json':!![]})['then'](function(_0x25a855){if(_0x25a855[_0xe18e('0x32')]){var _0x1d034c=-0x1;if(_[_0xe18e('0x33')](_0x25a855['users'])){if(!_[_0xe18e('0x1d')](_0xc6ba63)){_0x1d034c=_[_0xe18e('0x34')](_0x25a855[_0xe18e('0x32')],function(_0x3da5c9){return _0x3da5c9[_0xe18e('0x35')]===_0xc6ba63;});}if(_0x1d034c>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xe18e('0x2d')](_0xe18e('0x36'));_0x1d034c=_[_0xe18e('0x34')](_0x25a855[_0xe18e('0x32')],function(_0x572432){return _0x572432[_0xe18e('0x37')][_0xe18e('0x1a')]==='Administrator';});}return _0x25a855[_0xe18e('0x32')][_0x1d034c];}else{if(_0x25a855[_0xe18e('0x38')][_0xe18e('0x37')][_0xe18e('0x1a')]===_0xe18e('0x39')){logger['info'](_0xe18e('0x36'));user=_0x25a855[_0xe18e('0x38')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xe18e('0xe')](_0x25a855));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xe18e('0xe')](_0x25a855));}}}else{logger[_0xe18e('0x2b')](_0xe18e('0x3a'),JSON[_0xe18e('0xe')](_0x25a855));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x25a855));}})[_0xe18e('0x2a')](function(_0x281f2c){console[_0xe18e('0x2b')](_0x281f2c);});}function getZohoUser(_0x29c4e6,_0x567d97){return new BPromise(function(_0x1fcb54,_0x564b18){request(_0x29c4e6)[_0xe18e('0x3b')](function(_0x1ced0a){var _0x372f06=null;if(_0x1ced0a){_0x372f06=_0x1ced0a[_0xe18e('0x3c')][0x0];_0x372f06[_0xe18e('0x3d')]=_0x567d97;}_0x1fcb54(_0x372f06);})[_0xe18e('0x2a')](function(_0x3ffddd){_0x564b18(_0x3ffddd);});});}function createEndUser(_0x53cfca,_0x1e745b,_0x42743b,_0x481d79,_0x5ac5cc,_0x5be839){var _0x42743b=getName(_0x42743b);return request({'method':_0xe18e('0x24'),'uri':'https://www.zohoapis.'+_0x1e745b+_0xe18e('0x3e')+_[_0xe18e('0x3f')](_0x5be839[_0xe18e('0x40')])+'s','body':{'data':[{'Last_Name':_0x42743b[0x1],'First_Name':_0x42743b[0x0],'Phone':_0x481d79,'Owner':{'name':!_[_0xe18e('0x1d')](_0x5ac5cc[_0xe18e('0x41')][_0xe18e('0x1a')])?_0x5ac5cc['role'][_0xe18e('0x1a')]:!_[_0xe18e('0x1d')](_0x5ac5cc['first_name'])?_0x5ac5cc[_0xe18e('0x42')]+'\x20'+_0x5ac5cc[_0xe18e('0x43')]:_0x5ac5cc[_0xe18e('0x43')],'id':_0x5ac5cc['id']}}]},'headers':{'Authorization':_0xe18e('0x31')+_0x53cfca},'json':!![]})[_0xe18e('0x3b')](function(_0x2185c2){if(_0x2185c2&&_0x2185c2[_0xe18e('0x3c')][0x0][_0xe18e('0x44')]===_0xe18e('0x45')){var _0x248b8e=_0x2185c2[_0xe18e('0x3c')][0x0][_0xe18e('0x46')];_0x248b8e[_0xe18e('0x3d')]=_['startCase'](_0x5be839[_0xe18e('0x40')])+'s';return _0x248b8e;}logger['error'](_0xe18e('0x3a'),JSON[_0xe18e('0xe')](data));throw new Error(_0xe18e('0x47')+JSON[_0xe18e('0xe')](data));})['catch'](function(_0x505dd5){console['log']('CREATE\x20ERROR',_0x505dd5);});}function getEndUser(_0x569630,_0x3643c3,_0xeaecda,_0x5cc0fc,_0x2203ab,_0x4a98ff,_0x2a680b){var _0xd90496={'method':_0xe18e('0x48'),'uri':'','headers':{'Authorization':_0xe18e('0x31')+_0x569630},'json':!![]};switch(_0x2a680b[_0xe18e('0x49')]){case _0xe18e('0x4a'):_0xd90496[_0xe18e('0x4b')]=_0xe18e('0x4c')+_0x3643c3+_0xe18e('0x4d')+_0x2203ab+'))';return getZohoUser(_0xd90496,_0xe18e('0x4e'))['then'](function(_0x29287a){if(_0x29287a)return _0x29287a;_0xd90496[_0xe18e('0x4b')]=_0xe18e('0x4c')+_0x3643c3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2203ab+'))';return getZohoUser(_0xd90496,'Leads')['then'](function(_0x286ebb){if(_0x286ebb)return _0x286ebb;if(_0x2a680b[_0xe18e('0x40')]!=_0xe18e('0x4f')){return createEndUser(_0x569630,_0x3643c3,_0x5cc0fc,_0x2203ab,_0x4a98ff,_0x2a680b);}else{return{};}});});break;case _0xe18e('0x50'):_0xd90496[_0xe18e('0x4b')]=_0xe18e('0x4c')+_0x3643c3+_0xe18e('0x4d')+_0x2203ab+'))';return getZohoUser(_0xd90496,_0xe18e('0x4e'))[_0xe18e('0x3b')](function(_0x549437){if(_0x549437)return _0x549437;if(_0x2a680b[_0xe18e('0x40')]!=_0xe18e('0x4f')){return createEndUser(_0x569630,_0x3643c3,_0x5cc0fc,_0x2203ab,_0x4a98ff,_0x2a680b);}else{return{};}});break;case _0xe18e('0x51'):_0xd90496['uri']='https://www.zohoapis.'+_0x3643c3+_0xe18e('0x52')+_0x2203ab+'))';return getZohoUser(_0xd90496,_0xe18e('0x53'))[_0xe18e('0x3b')](function(_0x860fbc){if(_0x860fbc)return _0x860fbc;if(_0x2a680b['moduleCreate']!='nothing'){return createEndUser(_0x569630,_0x3643c3,_0x5cc0fc,_0x2203ab,_0x4a98ff,_0x2a680b);}else{return{};}});break;}}function getCall(_0x312cf7,_0x2bd146,_0x16bd20,_0x150a9e,_0x5eca9b,_0x5a7433,_0x59f1e1,_0x51fd41){logger[_0xe18e('0x2d')](_0xe18e('0x54'));var _0x26ad0d={};_0x26ad0d['Owner']={'name':!_[_0xe18e('0x1d')](_0x150a9e[_0xe18e('0x41')]['name'])&&!_[_0xe18e('0x1d')](_0x150a9e[_0xe18e('0x37')][_0xe18e('0x1a')])&&_0x150a9e[_0xe18e('0x37')][_0xe18e('0x1a')]==='administrator'?_0x150a9e['role']['name']:!_['isNil'](_0x150a9e[_0xe18e('0x42')])?_0x150a9e[_0xe18e('0x42')]+'\x20'+_0x150a9e[_0xe18e('0x43')]:_0x150a9e[_0xe18e('0x43')],'id':_0x150a9e['id']};_0x26ad0d[_0xe18e('0x55')]=intUtil[_0xe18e('0x56')](_0x5a7433['Subjects'],_0x59f1e1,'\x20');_0x26ad0d[_0xe18e('0x57')]=intUtil['getString'](_0x5a7433[_0xe18e('0x58')],_0x59f1e1,'\x0a');if(_0x5eca9b[_0xe18e('0x3d')]===_0xe18e('0x4e')){_0x26ad0d[_0xe18e('0x59')]={'name':!_[_0xe18e('0x1d')](_0x5eca9b[_0xe18e('0x5a')])?_0x5eca9b[_0xe18e('0x5a')]:!_[_0xe18e('0x1d')](_0x5eca9b['First_Name'])?_0x5eca9b[_0xe18e('0x5b')]+'\x20'+_0x5eca9b[_0xe18e('0x5c')]:_0x5eca9b[_0xe18e('0x5c')],'id':_0x5eca9b['id']};}if(_0x5eca9b[_0xe18e('0x3d')]===_0xe18e('0x53')){_0x26ad0d[_0xe18e('0x5d')]={'name':!_[_0xe18e('0x1d')](_0x5eca9b[_0xe18e('0x5a')])?_0x5eca9b[_0xe18e('0x5a')]:!_[_0xe18e('0x1d')](_0x5eca9b[_0xe18e('0x5b')])?_0x5eca9b[_0xe18e('0x5b')]+'\x20'+_0x5eca9b[_0xe18e('0x5c')]:_0x5eca9b[_0xe18e('0x5c')],'id':_0x5eca9b['id']};_0x26ad0d[_0xe18e('0x5e')]=_[_0xe18e('0x3f')](_0x5eca9b[_0xe18e('0x3d')]);}if(_0x59f1e1[_0xe18e('0x5f')]){_0x26ad0d[_0xe18e('0x60')]=moment[_0xe18e('0x61')](parseInt(_0x59f1e1['talktime'])*0x3e8)[_0xe18e('0x2f')]('mm:ss');}else if(_0x59f1e1[_0xe18e('0x62')]&&_0x59f1e1[_0xe18e('0x63')]){_0x26ad0d[_0xe18e('0x60')]=moment['utc'](moment(_0x59f1e1['endtime'],_0xe18e('0x64'))['diff'](moment(_0x59f1e1['starttime'],_0xe18e('0x64'))))[_0xe18e('0x2f')](_0xe18e('0x65'));}switch(_0x59f1e1['lastevent']){case _0xe18e('0x66'):_0x26ad0d[_0xe18e('0x67')]=_0xe18e('0x68');break;case'complete':case _0xe18e('0x69'):_0x26ad0d[_0xe18e('0x67')]=_0xe18e('0x6a');break;case _0xe18e('0x6b'):_0x26ad0d[_0xe18e('0x67')]=_0xe18e('0x6c');break;case _0xe18e('0x6d'):_0x26ad0d['Call_Result']=_0xe18e('0x6e');break;case _0xe18e('0x6f'):_0x26ad0d[_0xe18e('0x67')]=_0xe18e('0x70');default:}_0x26ad0d[_0xe18e('0x71')]=(_0x51fd41==='outbound'?moment(_0x59f1e1['starttime'])[_0xe18e('0x2f')](_0xe18e('0x64')):moment(_0x59f1e1[_0xe18e('0x72')])['format'](_0xe18e('0x64')))||moment()[_0xe18e('0x2f')](_0xe18e('0x64'));_0x26ad0d['Call_Type']=_0x51fd41||_0xe18e('0x73');_0x26ad0d=_[_0xe18e('0x74')](_0x26ad0d,getCustomFields(_0x5a7433[_0xe18e('0x75')],_0x59f1e1));return request({'method':_0xe18e('0x24'),'uri':_0xe18e('0x4c')+_0x2bd146+_0xe18e('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x312cf7},'body':{'data':[_0x26ad0d]},'json':!![]})[_0xe18e('0x3b')](function(_0x695d89){if(_0x695d89&&_0x695d89[_0xe18e('0x3c')][0x0][_0xe18e('0x44')]==='SUCCESS'){logger[_0xe18e('0x2d')](_0xe18e('0x77'));return{'id':_0x695d89[_0xe18e('0x3c')][0x0]['details']['id']};}})[_0xe18e('0x2a')](function(_0x1873e0){logger[_0xe18e('0x2d')](_0xe18e('0x78'),_0x1873e0[_0xe18e('0x2c')]);console[_0xe18e('0x79')](_0xe18e('0x78'),_0x1873e0);});}exports[_0xe18e('0x7a')]=function(_0x4ee7e1,_0x92d984,_0x44a2d2,_0x2fbeac,_0x2e3a9d,_0x435bd9){var _0x1a5451,_0x5270e2,_0x5be880;_0x435bd9[_0xe18e('0x7b')]=intUtil[_0xe18e('0x7c')](_0x435bd9['host']);_0x435bd9['serverUrl']=intUtil[_0xe18e('0x7c')](_0x435bd9[_0xe18e('0x7d')]);if(_0x2e3a9d&&_0x2e3a9d[_0xe18e('0x7e')]){logger[_0xe18e('0x2d')](_0xe18e('0x7f'),'Recording\x20is\x20enabled!');_0x92d984['recordingURL']=_0x435bd9[_0xe18e('0x7d')]+_0xe18e('0x80')+_0x92d984[_0xe18e('0x81')]+_0xe18e('0x82')+md5(_0x92d984[_0xe18e('0x81')]);}else{_0x92d984['recordingURL']='';}var _0x421583=_0x435bd9[_0xe18e('0x7b')]==='zoho.eu'?'eu':_0xe18e('0x83');return getAccessToken(_0x435bd9)[_0xe18e('0x3b')](function(_0x376641){_0x5be880=_0x376641;return getUser(_0x5be880,_0x421583,_0x435bd9,_0x2fbeac[_0xe18e('0x35')]);})[_0xe18e('0x3b')](function(_0x34e815){_0x1a5451=_0x34e815;logger[_0xe18e('0x2d')]('The\x20User\x20ID\x20is:',_0x1a5451['id']);return getEndUser(_0x5be880,_0x421583,_0x435bd9,_0x92d984['calleridname'],_0x92d984['calleridnum'],_0x1a5451,_0x44a2d2);})['then'](function(_0x2ab201){_0x5270e2=_0x2ab201;return getCall(_0x5be880,_0x421583,_0x435bd9,_0x1a5451,_0x5270e2,_0x44a2d2,_0x92d984,'Inbound');})['then'](function(_0x3be554){if(_0x3be554){logger[_0xe18e('0x2d')](_0xe18e('0x84'),_0x3be554['id']);logger['info']('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe18e('0x2f')](_0xe18e('0x85'),_0x2fbeac[_0xe18e('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x435bd9['host']+_0xe18e('0x86')+_0x3be554['id']});}})[_0xe18e('0x2a')](function(_0x2ad4f1){logger[_0xe18e('0x2b')](_0xe18e('0x7f'),JSON['stringify'](_0x2ad4f1));});};exports['outbound']=function(_0x22a501,_0x316224,_0x129017,_0x5678e8,_0x3185e4,_0x5738b7,_0x4eb7be){var _0x267005,_0xf4297e,_0xe85781;_0x5738b7[_0xe18e('0x7b')]=intUtil[_0xe18e('0x7c')](_0x5738b7[_0xe18e('0x7b')]);_0x5738b7[_0xe18e('0x7d')]=intUtil['stripTrailingSlash'](_0x5738b7['serverUrl']);if(_0x4eb7be&&_0x4eb7be[_0xe18e('0x87')]&&_0x4eb7be['recordingFormat']!==_0xe18e('0x88')){logger[_0xe18e('0x2d')](_0xe18e('0x89'),'Recording\x20is\x20enabled!');_0x316224[_0xe18e('0x8a')]=_0x5738b7[_0xe18e('0x7d')]+_0xe18e('0x80')+_0x316224[_0xe18e('0x81')]+_0xe18e('0x82')+md5(_0x316224['uniqueid']);}var _0x12f7bf=_0x5738b7[_0xe18e('0x7b')]===_0xe18e('0x8b')?'eu':_0xe18e('0x83');return getAccessToken(_0x5738b7)['then'](function(_0x1eaef7){_0xe85781=_0x1eaef7;return getUser(_0xe85781,_0x12f7bf,_0x5738b7,_0x5678e8[_0xe18e('0x35')]);})[_0xe18e('0x3b')](function(_0x1ad080){_0x267005=_0x1ad080;logger['info'](_0xe18e('0x8c'),_0x267005['id']);return getEndUser(_0xe85781,_0x12f7bf,_0x5738b7,_0x316224['destcalleridname'],_0x316224[_0xe18e('0x8d')],_0x267005,_0x129017);})['then'](function(_0x5477ee){_0xf4297e=_0x5477ee;return getCall(_0xe85781,_0x12f7bf,_0x5738b7,_0x267005,_0xf4297e,_0x129017,_0x316224,_0xe18e('0x8e'));})[_0xe18e('0x3b')](function(_0x5aca62){if(_0x5aca62){logger[_0xe18e('0x2d')](_0xe18e('0x84'),_0x5aca62['id']);logger[_0xe18e('0x2d')](_0xe18e('0x89'),_0xe18e('0x8f'));emit(util[_0xe18e('0x2f')](_0xe18e('0x85'),_0x5678e8['name']),_0xe18e('0x90'),{'uri':'https://crm.'+_0x5738b7[_0xe18e('0x7b')]+_0xe18e('0x86')+_0x5aca62['id']});}})[_0xe18e('0x2a')](function(_0x3c0761){logger[_0xe18e('0x2b')](_0xe18e('0x89'),JSON[_0xe18e('0xe')](_0x3c0761));});};exports['unmanaged']=function(_0x45af3b,_0x462cfc,_0x45a83d,_0x5a1c80,_0x157d2e,_0x1aea44){var _0x591a64,_0x44f034,_0x1b0703;_0x1aea44[_0xe18e('0x7b')]=intUtil[_0xe18e('0x7c')](_0x1aea44[_0xe18e('0x7b')]);_0x1aea44[_0xe18e('0x7d')]=intUtil['stripTrailingSlash'](_0x1aea44[_0xe18e('0x7d')]);if(_0x157d2e&&_0x157d2e[_0xe18e('0x7e')]){logger['info']('['+_0x462cfc[_0xe18e('0x91')][_0xe18e('0x92')]()+']','Recording\x20is\x20enabled!');_0x462cfc[_0xe18e('0x8a')]=_0x1aea44[_0xe18e('0x7d')]+_0xe18e('0x80')+_0x462cfc['uniqueid']+_0xe18e('0x82')+md5(_0x462cfc[_0xe18e('0x81')]);}else{_0x462cfc[_0xe18e('0x8a')]='';}var _0x117cd8=_0x1aea44[_0xe18e('0x7b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x1aea44)[_0xe18e('0x3b')](function(_0x2e2c92){_0x1b0703=_0x2e2c92;return getUser(_0x1b0703,_0x117cd8,_0x1aea44);})[_0xe18e('0x3b')](function(_0xcad2c3){_0x591a64=_0xcad2c3;logger[_0xe18e('0x2d')](_0xe18e('0x8c'),_0x591a64['id']);return getEndUser(_0x1b0703,_0x117cd8,_0x1aea44,_0x462cfc[_0xe18e('0x93')],_0x462cfc['calleridnum'],_0x591a64,_0x45a83d);})['then'](function(_0x366411){_0x44f034=_0x366411;return getCall(_0x1b0703,_0x117cd8,_0x1aea44,_0x591a64,_0x44f034,_0x45a83d,_0x462cfc,_0xe18e('0x73'));})['then'](function(_0x5b3d10){if(_0x5b3d10){logger[_0xe18e('0x2d')](_0xe18e('0x84'),_0x5b3d10['id']);}})['catch'](function(_0x4860c3){logger[_0xe18e('0x2b')]('['+_0x462cfc[_0xe18e('0x91')][_0xe18e('0x92')]()+']',JSON[_0xe18e('0xe')](_0x4860c3));});}; \ No newline at end of file +var _0xd370=['Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','[HTTP]','stringify','includes','string','picklist','type','content','toString','variable','variableName','idField','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','findIndex','profile','name','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','role','first_name','last_name','code','SUCCESS','details','enduserType','startCase','moduleCreate','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Contacts','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Description','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','connect','Answered','abandoned','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','/crm/v2/Calls','err','queue','host','monitor_format','[QUEUE]','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','serverUrl','recordingFormat','none','[OUTBOUND]'];(function(_0x43f671,_0x46844e){var _0x5dae29=function(_0x439b8d){while(--_0x439b8d){_0x43f671['push'](_0x43f671['shift']());}};_0x5dae29(++_0x46844e);}(_0xd370,0x1d3));var _0x0d37=function(_0x33b00c,_0x147745){_0x33b00c=_0x33b00c-0x0;var _0x5697dc=_0xd370[_0x33b00c];return _0x5697dc;};'use strict';var _=require(_0x0d37('0x0'));var rp=require(_0x0d37('0x1'));var md5=require(_0x0d37('0x2'));var util=require(_0x0d37('0x3'));var intUtil=require(_0x0d37('0x4'));var moment=require(_0x0d37('0x5'));var Redis=require(_0x0d37('0x6'));var BPromise=require(_0x0d37('0x7'));var config=require(_0x0d37('0x8'));var logger=require(_0x0d37('0x9'))(_0x0d37('0xa'));config['redis']=_[_0x0d37('0xb')](config[_0x0d37('0xc')],{'host':_0x0d37('0xd'),'port':0x18eb});var io=require(_0x0d37('0xe'))(new Redis(config['redis']));function emit(_0x4f16d4,_0x30fd18,_0x1acbe3){io['to'](_0x4f16d4)['emit'](_0x30fd18,_0x1acbe3);}function request(_0xd0cc5e){logger['debug'](_0x0d37('0xf'),JSON[_0x0d37('0x10')](_0xd0cc5e));return rp(_0xd0cc5e);}function getCustomFields(_0x2afe78,_0x5c1a46){var _0x1b048f={};if(_0x2afe78['length']>0x0){_['forEach'](_0x2afe78,function(_0x4e8e62){if(_[_0x0d37('0x11')]([_0x0d37('0x12'),_0x0d37('0x13')],_0x4e8e62[_0x0d37('0x14')])&&_0x4e8e62['idField']){_0x1b048f[_0x4e8e62['idField']]=_0x4e8e62[_0x0d37('0x15')][_0x0d37('0x16')]();}else if(_0x4e8e62[_0x0d37('0x14')]===_0x0d37('0x17')&&_0x4e8e62[_0x0d37('0x18')]&&_0x4e8e62['idField']&&_0x5c1a46[_0x4e8e62[_0x0d37('0x18')]]){_0x1b048f[_0x4e8e62[_0x0d37('0x19')]]=_0x5c1a46[_0x4e8e62[_0x0d37('0x18')]][_0x0d37('0x16')]();}else if(_0x4e8e62['type']==='customVariable'&&_0x4e8e62[_0x0d37('0x1a')]&&_0x4e8e62[_0x0d37('0x1a')]['name']&&_0x4e8e62[_0x0d37('0x19')]&&_0x5c1a46[_0x4e8e62[_0x0d37('0x1a')]['name'][_0x0d37('0x1b')]()]){_0x1b048f[_0x4e8e62[_0x0d37('0x19')]]=_0x5c1a46[_0x4e8e62[_0x0d37('0x1a')]['name'][_0x0d37('0x1b')]()][_0x0d37('0x16')]();}});}return _0x1b048f;}function getName(_0x31ece4){if(_0x31ece4[_0x0d37('0x1c')]('\x20')>0x0){var _0x5e89eb=_0x31ece4[_0x0d37('0x1d')](/ (.+)/);if(_0x5e89eb[0x1]){return _0x5e89eb;}}return[_0x31ece4,_0x31ece4];}var accountsTokens={};function getAccessToken(_0x939ea){return new Promise(function(_0x59a126,_0x59ed2f){if(!_[_0x0d37('0x1e')](accountsTokens[_0x939ea['id']])&&!_[_0x0d37('0x1e')](accountsTokens[_0x939ea['id']][_0x0d37('0x1f')])){if(moment()[_0x0d37('0x20')](accountsTokens[_0x939ea['id']][_0x0d37('0x21')])){_0x59a126(accountsTokens[_0x939ea['id']][_0x0d37('0x1f')]);}}var _0x4b773a;switch(_0x939ea[_0x0d37('0x22')]){case'US':_0x4b773a=_0x0d37('0x23');break;case'AU':_0x4b773a=_0x0d37('0x24');break;case'EU':_0x4b773a=_0x0d37('0x25');break;case'IN':_0x4b773a=_0x0d37('0x26');break;case'CN':_0x4b773a=_0x0d37('0x27');break;default:_0x4b773a='https://accounts.zoho.eu';break;}var _0x477f9c={'method':_0x0d37('0x28'),'uri':_0x4b773a+_0x0d37('0x29'),'qs':{'refresh_token':_0x939ea[_0x0d37('0x2a')],'client_id':_0x939ea[_0x0d37('0x2b')],'client_secret':_0x939ea[_0x0d37('0x2c')],'grant_type':_0x0d37('0x2d')},'json':!![]};return rp(_0x477f9c)[_0x0d37('0x2e')](function(_0x5be083){accountsTokens[_0x939ea['id']]={'access_token':_0x5be083[_0x0d37('0x1f')],'expires_in':moment()[_0x0d37('0x2f')](_0x5be083[_0x0d37('0x21')],_0x0d37('0x30'))};_0x59a126(_0x5be083[_0x0d37('0x1f')]);})[_0x0d37('0x31')](function(_0x35fef8){logger[_0x0d37('0x32')](_0x0d37('0x33'),_0x35fef8[_0x0d37('0x34')]);_0x59ed2f(_0x35fef8);});});}function getUser(_0x327897,_0x64ebd1,_0x1f7849,_0x17bfe1){logger[_0x0d37('0x35')]('Search\x20user');return request({'method':_0x0d37('0x36'),'uri':util[_0x0d37('0x37')](_0x0d37('0x38'),_0x64ebd1),'qs':{'type':_0x0d37('0x39')},'headers':{'Authorization':_0x0d37('0x3a')+_0x327897},'json':!![]})['then'](function(_0x1a0e3c){if(_0x1a0e3c[_0x0d37('0x3b')]){var _0x28772e=-0x1;if(_['isArrayLikeObject'](_0x1a0e3c[_0x0d37('0x3b')])){if(!_[_0x0d37('0x1e')](_0x17bfe1)){_0x28772e=_['findIndex'](_0x1a0e3c[_0x0d37('0x3b')],function(_0x1d88b4){return _0x1d88b4[_0x0d37('0x3c')]===_0x17bfe1;});}if(_0x28772e>=0x0){logger[_0x0d37('0x35')](_0x0d37('0x3d'));}else{logger[_0x0d37('0x35')]('Using\x20the\x20admin\x20account!');_0x28772e=_[_0x0d37('0x3e')](_0x1a0e3c[_0x0d37('0x3b')],function(_0xeafef5){return _0xeafef5[_0x0d37('0x3f')][_0x0d37('0x40')]===_0x0d37('0x41');});}return _0x1a0e3c[_0x0d37('0x3b')][_0x28772e];}else{if(_0x1a0e3c['user'][_0x0d37('0x3f')]['name']===_0x0d37('0x41')){logger['info'](_0x0d37('0x42'));user=_0x1a0e3c[_0x0d37('0x43')];return user;}else{logger[_0x0d37('0x32')](_0x0d37('0x44'),JSON['stringify'](_0x1a0e3c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1a0e3c));}}}else{logger[_0x0d37('0x32')]('The\x20failing\x20result\x20is',JSON[_0x0d37('0x10')](_0x1a0e3c));throw new Error(_0x0d37('0x45')+JSON[_0x0d37('0x10')](_0x1a0e3c));}})[_0x0d37('0x31')](function(_0x375d8f){console[_0x0d37('0x32')](_0x375d8f);});}function getZohoUser(_0x431891,_0x472050){return new BPromise(function(_0x4dd406,_0x4d57b7){request(_0x431891)['then'](function(_0x2dacb0){var _0x4b62a3=null;if(_0x2dacb0){_0x4b62a3=_0x2dacb0[_0x0d37('0x46')][0x0];_0x4b62a3['enduserType']=_0x472050;}_0x4dd406(_0x4b62a3);})['catch'](function(_0x173f15){_0x4d57b7(_0x173f15);});});}function createEndUser(_0x420420,_0x3a53bf,_0x1b4a7a,_0x7e48e5,_0x206473,_0xfa82a5){var _0x1b4a7a=getName(_0x1b4a7a);return request({'method':'POST','uri':_0x0d37('0x47')+_0x3a53bf+'/crm/v2/'+_['startCase'](_0xfa82a5['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1b4a7a[0x1],'First_Name':_0x1b4a7a[0x0],'Phone':_0x7e48e5,'Owner':{'name':!_[_0x0d37('0x1e')](_0x206473[_0x0d37('0x48')][_0x0d37('0x40')])?_0x206473[_0x0d37('0x48')][_0x0d37('0x40')]:!_['isNil'](_0x206473[_0x0d37('0x49')])?_0x206473[_0x0d37('0x49')]+'\x20'+_0x206473['last_name']:_0x206473[_0x0d37('0x4a')],'id':_0x206473['id']}}]},'headers':{'Authorization':_0x0d37('0x3a')+_0x420420},'json':!![]})['then'](function(_0x7e6be){if(_0x7e6be&&_0x7e6be[_0x0d37('0x46')][0x0][_0x0d37('0x4b')]===_0x0d37('0x4c')){var _0x21495b=_0x7e6be[_0x0d37('0x46')][0x0][_0x0d37('0x4d')];_0x21495b[_0x0d37('0x4e')]=_[_0x0d37('0x4f')](_0xfa82a5[_0x0d37('0x50')])+'s';return _0x21495b;}logger[_0x0d37('0x32')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x0d37('0x51')+JSON[_0x0d37('0x10')](data));})[_0x0d37('0x31')](function(_0x9ba620){console[_0x0d37('0x52')](_0x0d37('0x53'),_0x9ba620);});}function getEndUser(_0x52f96f,_0x2804cb,_0x52651c,_0x21b376,_0x4aa51a,_0x5de718,_0x34b7a2){var _0x28333f={'method':'GET','uri':'','headers':{'Authorization':_0x0d37('0x3a')+_0x52f96f},'json':!![]};switch(_0x34b7a2['moduleSearch']){case _0x0d37('0x54'):_0x28333f[_0x0d37('0x55')]=_0x0d37('0x47')+_0x2804cb+_0x0d37('0x56')+_0x4aa51a+'))';return getZohoUser(_0x28333f,'Contacts')[_0x0d37('0x2e')](function(_0x103185){if(_0x103185)return _0x103185;_0x28333f[_0x0d37('0x55')]=_0x0d37('0x47')+_0x2804cb+_0x0d37('0x57')+_0x4aa51a+'))';return getZohoUser(_0x28333f,_0x0d37('0x58'))[_0x0d37('0x2e')](function(_0x2ad92f){if(_0x2ad92f)return _0x2ad92f;if(_0x34b7a2[_0x0d37('0x50')]!='nothing'){return createEndUser(_0x52f96f,_0x2804cb,_0x21b376,_0x4aa51a,_0x5de718,_0x34b7a2);}else{return{};}});});break;case'contact':_0x28333f[_0x0d37('0x55')]='https://www.zohoapis.'+_0x2804cb+_0x0d37('0x56')+_0x4aa51a+'))';return getZohoUser(_0x28333f,_0x0d37('0x59'))[_0x0d37('0x2e')](function(_0x202dc0){if(_0x202dc0)return _0x202dc0;if(_0x34b7a2[_0x0d37('0x50')]!=_0x0d37('0x5a')){return createEndUser(_0x52f96f,_0x2804cb,_0x21b376,_0x4aa51a,_0x5de718,_0x34b7a2);}else{return{};}});break;case _0x0d37('0x5b'):_0x28333f['uri']=_0x0d37('0x47')+_0x2804cb+_0x0d37('0x57')+_0x4aa51a+'))';return getZohoUser(_0x28333f,_0x0d37('0x58'))[_0x0d37('0x2e')](function(_0x1c669a){if(_0x1c669a)return _0x1c669a;if(_0x34b7a2[_0x0d37('0x50')]!=_0x0d37('0x5a')){return createEndUser(_0x52f96f,_0x2804cb,_0x21b376,_0x4aa51a,_0x5de718,_0x34b7a2);}else{return{};}});break;}}function getCall(_0x2a2658,_0x553220,_0x352b42,_0x103441,_0x1a51df,_0x20457f,_0x59595f,_0x32ce44){logger[_0x0d37('0x35')](_0x0d37('0x5c'));var _0x420dab={};_0x420dab[_0x0d37('0x5d')]={'name':!_[_0x0d37('0x1e')](_0x103441[_0x0d37('0x48')][_0x0d37('0x40')])&&!_[_0x0d37('0x1e')](_0x103441['profile'][_0x0d37('0x40')])&&_0x103441[_0x0d37('0x3f')][_0x0d37('0x40')]===_0x0d37('0x5e')?_0x103441[_0x0d37('0x48')][_0x0d37('0x40')]:!_[_0x0d37('0x1e')](_0x103441['first_name'])?_0x103441[_0x0d37('0x49')]+'\x20'+_0x103441[_0x0d37('0x4a')]:_0x103441['last_name'],'id':_0x103441['id']};_0x420dab[_0x0d37('0x5f')]=intUtil['getString'](_0x20457f['Subjects'],_0x59595f,'\x20');_0x420dab[_0x0d37('0x60')]=intUtil['getString'](_0x20457f['Descriptions'],_0x59595f,'\x0a');if(_0x1a51df[_0x0d37('0x4e')]===_0x0d37('0x59')){_0x420dab['Who_Id']={'name':!_[_0x0d37('0x1e')](_0x1a51df[_0x0d37('0x61')])?_0x1a51df[_0x0d37('0x61')]:!_[_0x0d37('0x1e')](_0x1a51df[_0x0d37('0x62')])?_0x1a51df['First_Name']+'\x20'+_0x1a51df[_0x0d37('0x63')]:_0x1a51df[_0x0d37('0x63')],'id':_0x1a51df['id']};}if(_0x1a51df[_0x0d37('0x4e')]===_0x0d37('0x58')){_0x420dab[_0x0d37('0x64')]={'name':!_[_0x0d37('0x1e')](_0x1a51df['Full_Name'])?_0x1a51df['Full_Name']:!_[_0x0d37('0x1e')](_0x1a51df['First_Name'])?_0x1a51df[_0x0d37('0x62')]+'\x20'+_0x1a51df[_0x0d37('0x63')]:_0x1a51df[_0x0d37('0x63')],'id':_0x1a51df['id']};_0x420dab[_0x0d37('0x65')]=_[_0x0d37('0x4f')](_0x1a51df[_0x0d37('0x4e')]);}if(_0x59595f['talktime']){_0x420dab[_0x0d37('0x66')]=moment[_0x0d37('0x67')](parseInt(_0x59595f[_0x0d37('0x68')])*0x3e8)[_0x0d37('0x37')](_0x0d37('0x69'));}else if(_0x59595f[_0x0d37('0x6a')]&&_0x59595f['endtime']){_0x420dab[_0x0d37('0x66')]=moment[_0x0d37('0x67')](moment(_0x59595f['endtime'],_0x0d37('0x6b'))['diff'](moment(_0x59595f[_0x0d37('0x6c')],_0x0d37('0x6b'))))[_0x0d37('0x37')](_0x0d37('0x69'));}switch(_0x59595f[_0x0d37('0x6d')]){case _0x0d37('0x6e'):_0x420dab[_0x0d37('0x6f')]=_0x0d37('0x70');break;case'complete':case _0x0d37('0x71'):_0x420dab[_0x0d37('0x6f')]=_0x0d37('0x72');break;case'rejected':_0x420dab['Call_Result']='Rejected';break;case _0x0d37('0x73'):_0x420dab['Call_Result']=_0x0d37('0x74');break;case _0x0d37('0x75'):_0x420dab[_0x0d37('0x6f')]='Timeout';default:}_0x420dab[_0x0d37('0x76')]=(_0x32ce44===_0x0d37('0x77')?moment(_0x59595f[_0x0d37('0x6c')])[_0x0d37('0x37')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x59595f['agentcalledAt'])[_0x0d37('0x37')](_0x0d37('0x6b')))||moment()['format'](_0x0d37('0x6b'));_0x420dab[_0x0d37('0x78')]=_0x32ce44||_0x0d37('0x79');_0x420dab=_[_0x0d37('0x7a')](_0x420dab,getCustomFields(_0x20457f['Fields'],_0x59595f));return request({'method':_0x0d37('0x28'),'uri':'https://www.zohoapis.'+_0x553220+_0x0d37('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2a2658},'body':{'data':[_0x420dab]},'json':!![]})[_0x0d37('0x2e')](function(_0x5edd35){if(_0x5edd35&&_0x5edd35[_0x0d37('0x46')][0x0][_0x0d37('0x4b')]==='SUCCESS'){logger[_0x0d37('0x35')]('Call\x20created!');return{'id':_0x5edd35['data'][0x0][_0x0d37('0x4d')]['id']};}})[_0x0d37('0x31')](function(_0x22d744){logger[_0x0d37('0x35')]('err',_0x22d744['stack']);console[_0x0d37('0x52')](_0x0d37('0x7c'),_0x22d744);});}exports[_0x0d37('0x7d')]=function(_0x55a836,_0x209e0f,_0x281567,_0x2133ab,_0x4afcf5,_0x36d35a){var _0x2bdbe2,_0xeac957,_0x5bebd5;_0x36d35a[_0x0d37('0x7e')]=intUtil['stripTrailingSlash'](_0x36d35a[_0x0d37('0x7e')]);_0x36d35a['serverUrl']=intUtil['stripTrailingSlash'](_0x36d35a['serverUrl']);if(_0x4afcf5&&_0x4afcf5[_0x0d37('0x7f')]){logger[_0x0d37('0x35')](_0x0d37('0x80'),'Recording\x20is\x20enabled!');_0x209e0f[_0x0d37('0x81')]=_0x36d35a['serverUrl']+'/api/voice/recordings/'+_0x209e0f[_0x0d37('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x209e0f[_0x0d37('0x82')]);}else{_0x209e0f['recordingURL']='';}var _0xaf2eca=_0x36d35a['host']===_0x0d37('0x83')?'eu':_0x0d37('0x84');return getAccessToken(_0x36d35a)[_0x0d37('0x2e')](function(_0x4f3664){_0x5bebd5=_0x4f3664;return getUser(_0x5bebd5,_0xaf2eca,_0x36d35a,_0x2133ab[_0x0d37('0x3c')]);})['then'](function(_0x31c6f8){_0x2bdbe2=_0x31c6f8;logger['info'](_0x0d37('0x85'),_0x2bdbe2['id']);return getEndUser(_0x5bebd5,_0xaf2eca,_0x36d35a,_0x209e0f[_0x0d37('0x86')],_0x209e0f['calleridnum'],_0x2bdbe2,_0x281567);})[_0x0d37('0x2e')](function(_0x3c0319){_0xeac957=_0x3c0319;return getCall(_0x5bebd5,_0xaf2eca,_0x36d35a,_0x2bdbe2,_0xeac957,_0x281567,_0x209e0f,_0x0d37('0x79'));})[_0x0d37('0x2e')](function(_0x28e358){if(_0x28e358){logger[_0x0d37('0x35')](_0x0d37('0x87'),_0x28e358['id']);logger[_0x0d37('0x35')]('[QUEUE]',_0x0d37('0x88'));emit(util[_0x0d37('0x37')]('user:%s',_0x2133ab[_0x0d37('0x40')]),_0x0d37('0x89'),{'uri':_0x0d37('0x8a')+_0x36d35a[_0x0d37('0x7e')]+_0x0d37('0x8b')+_0x28e358['id']});}})[_0x0d37('0x31')](function(_0xd30546){logger[_0x0d37('0x32')]('[QUEUE]',JSON[_0x0d37('0x10')](_0xd30546));});};exports['outbound']=function(_0x843dcb,_0x3dba6b,_0x48e38f,_0x4a73c4,_0x18d8eb,_0x4e508,_0x30b9c5){var _0x1f9be4,_0xaa725,_0x1b0eda;_0x4e508[_0x0d37('0x7e')]=intUtil[_0x0d37('0x8c')](_0x4e508[_0x0d37('0x7e')]);_0x4e508[_0x0d37('0x8d')]=intUtil[_0x0d37('0x8c')](_0x4e508[_0x0d37('0x8d')]);if(_0x30b9c5&&_0x30b9c5[_0x0d37('0x8e')]&&_0x30b9c5[_0x0d37('0x8e')]!==_0x0d37('0x8f')){logger['info'](_0x0d37('0x90'),_0x0d37('0x91'));_0x3dba6b[_0x0d37('0x81')]=_0x4e508['serverUrl']+_0x0d37('0x92')+_0x3dba6b[_0x0d37('0x82')]+_0x0d37('0x93')+md5(_0x3dba6b['uniqueid']);}var _0x163e10=_0x4e508[_0x0d37('0x7e')]===_0x0d37('0x83')?'eu':'com';return getAccessToken(_0x4e508)[_0x0d37('0x2e')](function(_0x2c2503){_0x1b0eda=_0x2c2503;return getUser(_0x1b0eda,_0x163e10,_0x4e508,_0x4a73c4['email']);})[_0x0d37('0x2e')](function(_0xc0d71b){_0x1f9be4=_0xc0d71b;logger[_0x0d37('0x35')](_0x0d37('0x85'),_0x1f9be4['id']);return getEndUser(_0x1b0eda,_0x163e10,_0x4e508,_0x3dba6b['destcalleridname'],_0x3dba6b[_0x0d37('0x94')],_0x1f9be4,_0x48e38f);})[_0x0d37('0x2e')](function(_0xed0662){_0xaa725=_0xed0662;return getCall(_0x1b0eda,_0x163e10,_0x4e508,_0x1f9be4,_0xaa725,_0x48e38f,_0x3dba6b,_0x0d37('0x95'));})[_0x0d37('0x2e')](function(_0x4b6fff){if(_0x4b6fff){logger[_0x0d37('0x35')](_0x0d37('0x87'),_0x4b6fff['id']);logger[_0x0d37('0x35')](_0x0d37('0x90'),_0x0d37('0x88'));emit(util[_0x0d37('0x37')]('user:%s',_0x4a73c4['name']),_0x0d37('0x89'),{'uri':_0x0d37('0x8a')+_0x4e508[_0x0d37('0x7e')]+_0x0d37('0x8b')+_0x4b6fff['id']});}})[_0x0d37('0x31')](function(_0x2b3b95){logger[_0x0d37('0x32')](_0x0d37('0x90'),JSON[_0x0d37('0x10')](_0x2b3b95));});};exports[_0x0d37('0x96')]=function(_0xad33e7,_0x18b895,_0xfe16b3,_0x2b69ca,_0x4f68f7,_0x18b5c3){var _0x3dddee,_0x28054c,_0x18bfd8;_0x18b5c3[_0x0d37('0x7e')]=intUtil[_0x0d37('0x8c')](_0x18b5c3['host']);_0x18b5c3['serverUrl']=intUtil[_0x0d37('0x8c')](_0x18b5c3[_0x0d37('0x8d')]);if(_0x4f68f7&&_0x4f68f7[_0x0d37('0x7f')]){logger[_0x0d37('0x35')]('['+_0x18b895[_0x0d37('0x6d')][_0x0d37('0x97')]()+']',_0x0d37('0x91'));_0x18b895[_0x0d37('0x81')]=_0x18b5c3[_0x0d37('0x8d')]+'/api/voice/recordings/'+_0x18b895['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x18b895[_0x0d37('0x82')]);}else{_0x18b895[_0x0d37('0x81')]='';}var _0x3e8d7d=_0x18b5c3[_0x0d37('0x7e')]===_0x0d37('0x83')?'eu':'com';return getAccessToken(_0x18b5c3)[_0x0d37('0x2e')](function(_0x5d1270){_0x18bfd8=_0x5d1270;return getUser(_0x18bfd8,_0x3e8d7d,_0x18b5c3);})[_0x0d37('0x2e')](function(_0x20ec02){_0x3dddee=_0x20ec02;logger['info'](_0x0d37('0x85'),_0x3dddee['id']);return getEndUser(_0x18bfd8,_0x3e8d7d,_0x18b5c3,_0x18b895[_0x0d37('0x86')],_0x18b895[_0x0d37('0x98')],_0x3dddee,_0xfe16b3);})['then'](function(_0x17e1d6){_0x28054c=_0x17e1d6;return getCall(_0x18bfd8,_0x3e8d7d,_0x18b5c3,_0x3dddee,_0x28054c,_0xfe16b3,_0x18b895,_0x0d37('0x79'));})[_0x0d37('0x2e')](function(_0x3fd1df){if(_0x3fd1df){logger[_0x0d37('0x35')](_0x0d37('0x87'),_0x3fd1df['id']);}})['catch'](function(_0x5d55f0){logger['error']('['+_0x18b895[_0x0d37('0x6d')][_0x0d37('0x97')]()+']',JSON[_0x0d37('0x10')](_0x5d55f0));});}; \ 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 3c34da1..4712626 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 _0x400c=['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','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3'];(function(_0x2314ec,_0x1a69fa){var _0x23a918=function(_0x3f456f){while(--_0x3f456f){_0x2314ec['push'](_0x2314ec['shift']());}};_0x23a918(++_0x1a69fa);}(_0x400c,0x132));var _0xc400=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x400c[_0x36eaaa];return _0x461349;};'use strict';var util=require(_0xc400('0x0'));var sh=require(_0xc400('0x1'));var Mustache=require(_0xc400('0x2'));var logger=require(_0xc400('0x3'))(_0xc400('0x4'));exports[_0xc400('0x5')]=function(_0x4cbc59,_0x2d006a){var _0x3a9124=_0x4cbc59[_0xc400('0x6')]?_0x4cbc59[_0xc400('0x6')]:_0xc400('0x7');var _0x4a6794=_0x4cbc59[_0xc400('0x8')]?Mustache[_0xc400('0x9')](_0x4cbc59['data3'],_0x2d006a):_0x2d006a;sh['exec'](_0x4a6794,function(_0x18e2dc,_0x3fb5f1,_0x39a026){if(_0x18e2dc!==0x0){logger[_0xc400('0xa')](util[_0xc400('0xb')](_0xc400('0xc'),_0x3a9124,_0x4a6794,_0x18e2dc,_0x39a026));}else{logger[_0xc400('0xd')](util[_0xc400('0xb')](_0xc400('0xe'),_0x3a9124,_0x4a6794,_0x3fb5f1));}});}; \ No newline at end of file +var _0x8022=['shelljs','mustache','../../../../config/logger','trigger','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','util'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x8022,0xd1));var _0x2802=function(_0x1ba260,_0x552d9d){_0x1ba260=_0x1ba260-0x0;var _0x16e6ec=_0x8022[_0x1ba260];return _0x16e6ec;};'use strict';var util=require(_0x2802('0x0'));var sh=require(_0x2802('0x1'));var Mustache=require(_0x2802('0x2'));var logger=require(_0x2802('0x3'))(_0x2802('0x4'));exports[_0x2802('0x5')]=function(_0xeda5c5,_0x57714b){var _0x2d9f75=_0xeda5c5[_0x2802('0x6')]?_0xeda5c5[_0x2802('0x6')]:_0x2802('0x7');var _0x763796=_0xeda5c5[_0x2802('0x8')]?Mustache[_0x2802('0x9')](_0xeda5c5['data3'],_0x57714b):_0x57714b;sh[_0x2802('0x5')](_0x763796,function(_0x4b1b8d,_0x17b08d,_0x405aff){if(_0x4b1b8d!==0x0){logger[_0x2802('0xa')](util[_0x2802('0xb')](_0x2802('0xc'),_0x2d9f75,_0x763796,_0x4b1b8d,_0x405aff));}else{logger[_0x2802('0xd')](util[_0x2802('0xb')](_0x2802('0xe'),_0x2d9f75,_0x763796,_0x17b08d));}});}; \ 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 e51c3df..7788191 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 _0xd58c=['error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message','request-promise','lodash','trigger','exec','data1','toUpperCase','render','data2','data5','data6','parse','GET','DELETE','data7','body'];(function(_0x50c50b,_0x3a6fb3){var _0x423c29=function(_0x223cf6){while(--_0x223cf6){_0x50c50b['push'](_0x50c50b['shift']());}};_0x423c29(++_0x3a6fb3);}(_0xd58c,0x125));var _0xcd58=function(_0x73724c,_0x30b0ab){_0x73724c=_0x73724c-0x0;var _0x280b82=_0xd58c[_0x73724c];return _0x280b82;};'use strict';var rp=require(_0xcd58('0x0'));var util=require('util');var _=require(_0xcd58('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xcd58('0x2'));exports[_0xcd58('0x3')]=function(_0x421ef4,_0x56b2f5){var _0x5ea57b,_0x2caf02;var _0x1f9b30={'method':_0x421ef4[_0xcd58('0x4')][_0xcd58('0x5')](),'uri':Mustache[_0xcd58('0x6')](_0x421ef4[_0xcd58('0x7')],_0x56b2f5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x421ef4[_0xcd58('0x8')])==='number'&&parseInt(_0x421ef4['data5'])>=0x1&&parseInt(_0x421ef4[_0xcd58('0x8')])<=0xa?parseInt(_0x421ef4[_0xcd58('0x8')])*0x3e8:0x5*0x3e8};try{_0x1f9b30['headers']=_0x421ef4[_0xcd58('0x9')]?JSON[_0xcd58('0xa')](Mustache[_0xcd58('0x6')](_0x421ef4[_0xcd58('0x9')],_0x56b2f5)):{};}catch(_0x4e8fae){logger['error'](_0x4e8fae['stack']);}switch(_0x421ef4[_0xcd58('0x4')]['toUpperCase']()){case _0xcd58('0xb'):case _0xcd58('0xc'):_0x5ea57b=null;_0x1f9b30['qs']=_0x56b2f5;break;case'POST':case'PUT':if(_0x421ef4[_0xcd58('0xd')]){try{_0x5ea57b=JSON[_0xcd58('0xa')](Mustache[_0xcd58('0x6')](_0x421ef4[_0xcd58('0xd')],_0x56b2f5));_0x1f9b30[_0xcd58('0xe')]=_0x5ea57b;}catch(_0x24f04c){logger[_0xcd58('0xf')](_0x24f04c[_0xcd58('0x10')]);logger['error'](_0xcd58('0x11'));}}else{_0x5ea57b=_0x56b2f5;_0x1f9b30[_0xcd58('0xe')]=_0x5ea57b;}break;}logger['info'](util[_0xcd58('0x12')](_0xcd58('0x13'),_0x421ef4[_0xcd58('0x4')],_0x421ef4['data2'],JSON[_0xcd58('0x14')](_0x1f9b30)));rp(_0x1f9b30)[_0xcd58('0x15')](function(_0x2e0170){_0x5ea57b=!_['isNil'](_0x5ea57b)?_0xcd58('0x16')+_0x5ea57b:'';_0x2caf02=typeof _0x2e0170[_0xcd58('0xe')]===_0xcd58('0x17')?JSON[_0xcd58('0x14')](_0x2e0170[_0xcd58('0xe')]):_0x2e0170['body'];logger['info'](util[_0xcd58('0x12')](_0xcd58('0x18'),_0x421ef4[_0xcd58('0x4')],_0x421ef4[_0xcd58('0x7')],_0x2e0170['statusCode'],_0x2caf02));})['catch'](function(_0x1194a4){logger[_0xcd58('0xf')](util['format'](_0xcd58('0x19'),_0x421ef4[_0xcd58('0x4')],_0x421ef4[_0xcd58('0x7')],_0x1194a4[_0xcd58('0x1a')],_0x1194a4['name'],_0x1194a4[_0xcd58('0x1b')]));});}; \ No newline at end of file +var _0x8d08=['headers','data6','parse','toUpperCase','DELETE','POST','PUT','data7','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','body','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','trigger','exec','data1','render','data2','data5','number'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8d08,0xc1));var _0x88d0=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x8d08[_0x59b439];return _0x521ea3;};'use strict';var rp=require(_0x88d0('0x0'));var util=require(_0x88d0('0x1'));var _=require(_0x88d0('0x2'));var Mustache=require(_0x88d0('0x3'));var logger=require('../../../../config/logger')(_0x88d0('0x4'));exports[_0x88d0('0x5')]=function(_0x4db572,_0x72dc94){var _0x484d39,_0x54d4c5;var _0x1b98cf={'method':_0x4db572[_0x88d0('0x6')]['toUpperCase'](),'uri':Mustache[_0x88d0('0x7')](_0x4db572[_0x88d0('0x8')],_0x72dc94),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4db572[_0x88d0('0x9')])===_0x88d0('0xa')&&parseInt(_0x4db572[_0x88d0('0x9')])>=0x1&&parseInt(_0x4db572[_0x88d0('0x9')])<=0xa?parseInt(_0x4db572['data5'])*0x3e8:0x5*0x3e8};try{_0x1b98cf[_0x88d0('0xb')]=_0x4db572[_0x88d0('0xc')]?JSON[_0x88d0('0xd')](Mustache[_0x88d0('0x7')](_0x4db572[_0x88d0('0xc')],_0x72dc94)):{};}catch(_0x28edd0){logger['error'](_0x28edd0['stack']);}switch(_0x4db572['data1'][_0x88d0('0xe')]()){case'GET':case _0x88d0('0xf'):_0x484d39=null;_0x1b98cf['qs']=_0x72dc94;break;case _0x88d0('0x10'):case _0x88d0('0x11'):if(_0x4db572[_0x88d0('0x12')]){try{_0x484d39=JSON['parse'](Mustache[_0x88d0('0x7')](_0x4db572[_0x88d0('0x12')],_0x72dc94));_0x1b98cf['body']=_0x484d39;}catch(_0x339a47){logger[_0x88d0('0x13')](_0x339a47[_0x88d0('0x14')]);logger[_0x88d0('0x13')](_0x88d0('0x15'));}}else{_0x484d39=_0x72dc94;_0x1b98cf['body']=_0x484d39;}break;}logger['info'](util[_0x88d0('0x16')](_0x88d0('0x17'),_0x4db572[_0x88d0('0x6')],_0x4db572[_0x88d0('0x8')],JSON[_0x88d0('0x18')](_0x1b98cf)));rp(_0x1b98cf)[_0x88d0('0x19')](function(_0x4f2ac4){_0x484d39=!_[_0x88d0('0x1a')](_0x484d39)?_0x88d0('0x1b')+_0x484d39:'';_0x54d4c5=typeof _0x4f2ac4[_0x88d0('0x1c')]===_0x88d0('0x1d')?JSON[_0x88d0('0x18')](_0x4f2ac4['body']):_0x4f2ac4[_0x88d0('0x1c')];logger[_0x88d0('0x1e')](util[_0x88d0('0x16')](_0x88d0('0x1f'),_0x4db572[_0x88d0('0x6')],_0x4db572[_0x88d0('0x8')],_0x4f2ac4['statusCode'],_0x54d4c5));})['catch'](function(_0x5cc9c8){logger['error'](util['format'](_0x88d0('0x20'),_0x4db572[_0x88d0('0x6')],_0x4db572[_0x88d0('0x8')],_0x5cc9c8['statusCode'],_0x5cc9c8['name'],_0x5cc9c8[_0x88d0('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 67946ec..8e4779d 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 _0x7c8e=['../../config/logger','routing','http','request','debug','rpc','error','message','result','catch','exports','bluebird'];(function(_0x4a4ca7,_0x148c08){var _0x5ef64b=function(_0x162be8){while(--_0x162be8){_0x4a4ca7['push'](_0x4a4ca7['shift']());}};_0x5ef64b(++_0x148c08);}(_0x7c8e,0x137));var _0xe7c8=function(_0x49d40d,_0x30e0ea){_0x49d40d=_0x49d40d-0x0;var _0x5ec463=_0x7c8e[_0x49d40d];return _0x5ec463;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe7c8('0x0'));var logger=require(_0xe7c8('0x1'))(_0xe7c8('0x2'));var client=jayson['client'][_0xe7c8('0x3')]({'port':0x2329});client['Request']=function(_0x22ca79,_0x4a6c71){return new BPromise(function(_0x476d41,_0x314f2d){return client[_0xe7c8('0x4')](_0x22ca79,_0x4a6c71)['then'](function(_0x538da4){logger[_0xe7c8('0x5')](_0xe7c8('0x6'),_0xe7c8('0x2'),_0x22ca79,_0x4a6c71,_0x538da4);if(_0x538da4[_0xe7c8('0x7')]){logger['error'](_0xe7c8('0x6'),_0xe7c8('0x2'),_0x22ca79,_0x538da4['error'][_0xe7c8('0x8')],_0x4a6c71);return _0x314f2d(_0x538da4[_0xe7c8('0x7')][_0xe7c8('0x8')]);}else{return _0x476d41(_0x538da4[_0xe7c8('0x9')]);}})[_0xe7c8('0xa')](function(_0x46e824){logger[_0xe7c8('0x7')](_0xe7c8('0x6'),'routing',_0x22ca79,_0x46e824,_0x4a6c71);return _0x314f2d(_0x46e824);});});};module[_0xe7c8('0xb')]=client; \ No newline at end of file +var _0x5cb1=['then','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','request'];(function(_0x188be2,_0x353598){var _0x1d1fca=function(_0x1bcc9f){while(--_0x1bcc9f){_0x188be2['push'](_0x188be2['shift']());}};_0x1d1fca(++_0x353598);}(_0x5cb1,0x14b));var _0x15cb=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0x5cb1[_0x270dba];return _0x36b83b;};'use strict';var jayson=require(_0x15cb('0x0'));var BPromise=require(_0x15cb('0x1'));var logger=require(_0x15cb('0x2'))(_0x15cb('0x3'));var client=jayson[_0x15cb('0x4')][_0x15cb('0x5')]({'port':0x2329});client['Request']=function(_0xc7506c,_0x25d3a6){return new BPromise(function(_0x12c3db,_0x573937){return client[_0x15cb('0x6')](_0xc7506c,_0x25d3a6)[_0x15cb('0x7')](function(_0x2b6ca2){logger['debug'](_0x15cb('0x8'),_0x15cb('0x3'),_0xc7506c,_0x25d3a6,_0x2b6ca2);if(_0x2b6ca2[_0x15cb('0x9')]){logger[_0x15cb('0x9')](_0x15cb('0x8'),_0x15cb('0x3'),_0xc7506c,_0x2b6ca2['error'][_0x15cb('0xa')],_0x25d3a6);return _0x573937(_0x2b6ca2[_0x15cb('0x9')][_0x15cb('0xa')]);}else{return _0x12c3db(_0x2b6ca2[_0x15cb('0xb')]);}})['catch'](function(_0x3dbbab){logger[_0x15cb('0x9')]('rpc',_0x15cb('0x3'),_0xc7506c,_0x3dbbab,_0x25d3a6);return _0x573937(_0x3dbbab);});});};module[_0x15cb('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9da2638..5019004 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 _0x6c3d=['resolve','then','initMailAccounts','listen','loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','./rpc/setting'];(function(_0x237245,_0x1c3789){var _0x198069=function(_0x3e1e16){while(--_0x3e1e16){_0x237245['push'](_0x237245['shift']());}};_0x198069(++_0x1c3789);}(_0x6c3d,0x15b));var _0xd6c3=function(_0x2a6d9d,_0xe93ef9){_0x2a6d9d=_0x2a6d9d-0x0;var _0x439d1d=_0x6c3d[_0x2a6d9d];return _0x439d1d;};'use strict';var BPromise=require(_0xd6c3('0x0'));var server=require(_0xd6c3('0x1'));var Realtime=require(_0xd6c3('0x2'));var EmailChannel=require(_0xd6c3('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xd6c3('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xd6c3('0x5')]()[_0xd6c3('0x6')](mailAccount['getMailAccounts']())[_0xd6c3('0x6')](realtime[_0xd6c3('0x7')]())[_0xd6c3('0x6')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xd6c3('0x8')](realtime,email)['then'](function(){return initRealtime();})[_0xd6c3('0x6')](function(){return setting['getSettings']();})[_0xd6c3('0x6')](function(_0x2a8024){return setInterval(initRealtime,_0x2a8024[_0xd6c3('0x9')]*0x3e8);})[_0xd6c3('0xa')](function(_0x1bac24){console['log'](_0x1bac24);});}main(); \ No newline at end of file +var _0xc743=['./rpc/setting','resolve','then','initMailAccounts','refresh','mailAccounts','listen','catch','bluebird','./server','./realtime','./lib/email'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xc743,0xa4));var _0x3c74=function(_0x1b63dc,_0x4ffe7c){_0x1b63dc=_0x1b63dc-0x0;var _0x324aba=_0xc743[_0x1b63dc];return _0x324aba;};'use strict';var BPromise=require(_0x3c74('0x0'));var server=require(_0x3c74('0x1'));var Realtime=require(_0x3c74('0x2'));var EmailChannel=require(_0x3c74('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x3c74('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x3c74('0x5')]()[_0x3c74('0x6')](mailAccount['getMailAccounts']())[_0x3c74('0x6')](realtime[_0x3c74('0x7')]())[_0x3c74('0x6')](function(){email[_0x3c74('0x8')](realtime[_0x3c74('0x9')]);return realtime;});}function main(){return server[_0x3c74('0xa')](realtime,email)[_0x3c74('0x6')](function(){return initRealtime();})[_0x3c74('0x6')](function(){return setting['getSettings']();})[_0x3c74('0x6')](function(_0x5c29f2){return setInterval(initRealtime,_0x5c29f2['loginMailFrequency']*0x3e8);})[_0x3c74('0xb')](function(_0x17bfc5){console['log'](_0x17bfc5);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a659096..2401d6f 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 _0x8971=['box','handleImapBox','bind','handleImapEmail','end','error','isNil','status','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','send','verifySmtp','Smtp','verify','lodash','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','socket.io-emitter','redis','./imap','./smtp','info','mailAccounts','smtp','prototype','name','key','active','Imap','messageStatus','stringify','emit','hasOwnProperty','imapAccounts'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x8971,0xb4));var _0x1897=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x8971[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x1897('0x0'));var moment=require('moment');var BPromise=require(_0x1897('0x1'));var md5=require(_0x1897('0x2'));var Redis=require('ioredis');var config=require(_0x1897('0x3'));var logger=require(_0x1897('0x4'))(_0x1897('0x5'));config['redis']=_[_0x1897('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1897('0x7'))(new Redis(config[_0x1897('0x8')]));var EmailImap=require(_0x1897('0x9'));var EmailSmtp=require(_0x1897('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x27061f){logger[_0x1897('0xb')]('start\x20email\x20channel');this[_0x1897('0xc')]=_0x27061f[_0x1897('0xc')];this['imapAccounts']={};this[_0x1897('0xd')]=new EmailSmtp();}EmailChannel[_0x1897('0xe')]['emit']=function(_0x4a7c1f){var _0x1ad90d=this[_0x1897('0xc')][_0x4a7c1f];var _0x5d6460={'id':_0x1ad90d['id'],'name':_0x1ad90d[_0x1897('0xf')],'key':_0x1ad90d[_0x1897('0x10')],'active':_0x1ad90d[_0x1897('0x11')],'Imap':{'status':_0x1ad90d[_0x1897('0x12')]['status'],'messageStatus':_0x1ad90d[_0x1897('0x12')][_0x1897('0x13')],'total':_0x1ad90d['Imap']['total']}};if(_['isNil'](md5Accounts[_0x4a7c1f])){md5Accounts[_0x4a7c1f]={};}var _0x12005d=md5(JSON[_0x1897('0x14')](_0x5d6460));if(md5Accounts[_0x4a7c1f][_0x1897('0x2')]!==_0x12005d){md5Accounts[_0x4a7c1f]['md5']=_0x12005d;io[_0x1897('0x15')]('mailAccount:update',_0x5d6460);}};EmailChannel[_0x1897('0xe')]['refresh']=function(_0x1b8630){for(var _0x3b1c20 in _0x1b8630){if(_0x1b8630[_0x1897('0x16')](_0x3b1c20)){if(_0x1b8630[_0x3b1c20][_0x1897('0x12')]&&_0x1b8630[_0x3b1c20]['active']){var _0x2a6d34=_0x1b8630[_0x3b1c20][_0x1897('0x12')];if(!this['imapAccounts']['hasOwnProperty'](_0x2a6d34['id'])){this[_0x1897('0x17')][_0x2a6d34['id']]=new EmailImap(_0x2a6d34,_0x1b8630[_0x3b1c20][_0x1897('0x5')]);this[_0x1897('0x17')][_0x2a6d34['id']]['on'](_0x1897('0x18'),this[_0x1897('0x19')][_0x1897('0x1a')](this,_0x3b1c20));this['imapAccounts'][_0x2a6d34['id']]['on'](_0x1897('0x5'),this[_0x1897('0x1b')][_0x1897('0x1a')](this,_0x3b1c20));this[_0x1897('0x17')][_0x2a6d34['id']]['on'](_0x1897('0x1c'),this['handleImapEnd'][_0x1897('0x1a')](this,_0x3b1c20));this['imapAccounts'][_0x2a6d34['id']]['on'](_0x1897('0x1d'),this['handleImapError'][_0x1897('0x1a')](this,_0x3b1c20));}}else{if(_[_0x1897('0x1e')](this[_0x1897('0xc')][_0x3b1c20][_0x1897('0x12')])){this[_0x1897('0xc')][_0x3b1c20]['Imap']={};}this[_0x1897('0xc')][_0x3b1c20][_0x1897('0x12')][_0x1897('0x1f')]='disabled';this[_0x1897('0xc')][_0x3b1c20][_0x1897('0x12')][_0x1897('0x13')]='';this[_0x1897('0x15')](_0x3b1c20);}}}};EmailChannel[_0x1897('0xe')][_0x1897('0x19')]=function(_0x240dfb,_0x47c92b){if(this[_0x1897('0xc')][_0x240dfb]){this['mailAccounts'][_0x240dfb][_0x1897('0x12')][_0x1897('0x1f')]=_0x1897('0x20');this[_0x1897('0xc')][_0x240dfb][_0x1897('0x12')]['messageStatus']=_0x47c92b[_0x1897('0xf')];if(_0x47c92b[_0x1897('0x21')]){this['mailAccounts'][_0x240dfb][_0x1897('0x12')][_0x1897('0x22')]=_0x47c92b[_0x1897('0x21')][_0x1897('0x22')];}return this['emit'](_0x240dfb);}};EmailChannel[_0x1897('0xe')][_0x1897('0x1b')]=function(_0x2fba2d,_0x5a70ac){logger['info'](_0x1897('0x23'),_0x5a70ac[_0x1897('0x24')],_0x5a70ac[_0x1897('0x25')],_0x5a70ac[_0x1897('0x26')],_0x2fba2d);if(this[_0x1897('0xc')][_0x2fba2d]){return mailAccount[_0x1897('0x27')](_0x2fba2d,_0x5a70ac)[_0x1897('0x28')](function(_0xcd1b6f){if(_0xcd1b6f){logger[_0x1897('0xb')](_0x1897('0x29'));}})[_0x1897('0x2a')](function(_0xc955f4){logger[_0x1897('0x1d')](_0x1897('0x2b'),JSON[_0x1897('0x14')](_0xc955f4));});}};EmailChannel[_0x1897('0xe')][_0x1897('0x2c')]=function(_0x52bbf3){if(this[_0x1897('0xc')][_0x52bbf3]&&this['mailAccounts'][_0x52bbf3]['Imap']){if(this[_0x1897('0x17')][this[_0x1897('0xc')][_0x52bbf3][_0x1897('0x12')]['id']]){delete this[_0x1897('0x17')][this[_0x1897('0xc')][_0x52bbf3][_0x1897('0x12')]['id']];}this[_0x1897('0xc')][_0x52bbf3][_0x1897('0x12')][_0x1897('0x2d')]=moment();this[_0x1897('0x15')](_0x52bbf3);}};EmailChannel['prototype'][_0x1897('0x2e')]=function(_0x460543,_0x1d0759){if(this[_0x1897('0xc')][_0x460543]){this[_0x1897('0xc')][_0x460543]['Imap'][_0x1897('0x1f')]=_0x1897('0x1d');this[_0x1897('0xc')][_0x460543]['Imap']['messageStatus']=_0x1d0759;return this[_0x1897('0x15')](_0x460543);}};EmailChannel[_0x1897('0xe')]['sendMail']=function(_0x456be7,_0x43edef){return this[_0x1897('0xd')][_0x1897('0x2f')](_0x456be7,_0x43edef);};EmailChannel[_0x1897('0xe')][_0x1897('0x30')]=function(_0x4f75e8){var _0x55dc2d=this;if(this['mailAccounts'][_0x4f75e8['id']]){if(_['isNil'](this[_0x1897('0xc')][_0x4f75e8['id']][_0x1897('0x31')])){this[_0x1897('0xc')][_0x4f75e8['id']]['Smtp']={};}this['mailAccounts'][_0x4f75e8['id']][_0x1897('0x31')][_0x1897('0x2d')]=moment();return new BPromise(function(_0x3e4a0e,_0x1922b3){return _0x55dc2d['smtp']['verify'](_0x4f75e8)['then'](function(_0x581ab2){_0x55dc2d[_0x1897('0xc')][_0x4f75e8['id']][_0x1897('0x31')][_0x1897('0x1f')]='verified';_0x55dc2d[_0x1897('0xc')][_0x4f75e8['id']][_0x1897('0x31')][_0x1897('0x13')]='';_0x55dc2d[_0x1897('0x15')](_0x4f75e8['id']);_0x3e4a0e(_0x581ab2);})[_0x1897('0x2a')](function(_0x297bae){_0x55dc2d[_0x1897('0xc')][_0x4f75e8['id']][_0x1897('0x31')]['status']=_0x1897('0x1d');_0x55dc2d[_0x1897('0xc')][_0x4f75e8['id']][_0x1897('0x31')]['messageStatus']=_0x297bae;_0x55dc2d[_0x1897('0x15')](_0x4f75e8['id']);_0x1922b3(_0x297bae);});});}return this[_0x1897('0xd')][_0x1897('0x32')](_0x4f75e8);};module['exports']=EmailChannel; \ No newline at end of file +var _0x7ead=['sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','Imap','status','messageStatus','total','mailAccount:update','prototype','hasOwnProperty','active','box','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync'];(function(_0xe0a265,_0x1bff8d){var _0x443eb0=function(_0x1b2f6c){while(--_0x1b2f6c){_0xe0a265['push'](_0xe0a265['shift']());}};_0x443eb0(++_0x1bff8d);}(_0x7ead,0x19e));var _0xd7ea=function(_0x5294cc,_0x12bc09){_0x5294cc=_0x5294cc-0x0;var _0x152a02=_0x7ead[_0x5294cc];return _0x152a02;};'use strict';var _=require(_0xd7ea('0x0'));var moment=require(_0xd7ea('0x1'));var BPromise=require(_0xd7ea('0x2'));var md5=require(_0xd7ea('0x3'));var Redis=require(_0xd7ea('0x4'));var config=require('../../../config/environment');var logger=require(_0xd7ea('0x5'))(_0xd7ea('0x6'));config[_0xd7ea('0x7')]=_[_0xd7ea('0x8')](config[_0xd7ea('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd7ea('0x9'))(new Redis(config[_0xd7ea('0x7')]));var EmailImap=require(_0xd7ea('0xa'));var EmailSmtp=require(_0xd7ea('0xb'));var mailAccount=require(_0xd7ea('0xc'));var md5Accounts={};function EmailChannel(_0x76dd3){logger[_0xd7ea('0xd')](_0xd7ea('0xe'));this[_0xd7ea('0xf')]=_0x76dd3[_0xd7ea('0xf')];this[_0xd7ea('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xd7ea('0x11')]=function(_0x41d80f){var _0x1a8f4c=this[_0xd7ea('0xf')][_0x41d80f];var _0xab8185={'id':_0x1a8f4c['id'],'name':_0x1a8f4c[_0xd7ea('0x12')],'key':_0x1a8f4c[_0xd7ea('0x13')],'active':_0x1a8f4c['active'],'Imap':{'status':_0x1a8f4c[_0xd7ea('0x14')][_0xd7ea('0x15')],'messageStatus':_0x1a8f4c[_0xd7ea('0x14')][_0xd7ea('0x16')],'total':_0x1a8f4c[_0xd7ea('0x14')][_0xd7ea('0x17')]}};if(_['isNil'](md5Accounts[_0x41d80f])){md5Accounts[_0x41d80f]={};}var _0x3cdd6f=md5(JSON['stringify'](_0xab8185));if(md5Accounts[_0x41d80f][_0xd7ea('0x3')]!==_0x3cdd6f){md5Accounts[_0x41d80f][_0xd7ea('0x3')]=_0x3cdd6f;io[_0xd7ea('0x11')](_0xd7ea('0x18'),_0xab8185);}};EmailChannel[_0xd7ea('0x19')]['refresh']=function(_0x2d8349){for(var _0x95ef12 in _0x2d8349){if(_0x2d8349[_0xd7ea('0x1a')](_0x95ef12)){if(_0x2d8349[_0x95ef12][_0xd7ea('0x14')]&&_0x2d8349[_0x95ef12][_0xd7ea('0x1b')]){var _0x20299a=_0x2d8349[_0x95ef12][_0xd7ea('0x14')];if(!this[_0xd7ea('0x10')]['hasOwnProperty'](_0x20299a['id'])){this[_0xd7ea('0x10')][_0x20299a['id']]=new EmailImap(_0x20299a,_0x2d8349[_0x95ef12][_0xd7ea('0x6')]);this['imapAccounts'][_0x20299a['id']]['on'](_0xd7ea('0x1c'),this['handleImapBox'][_0xd7ea('0x1d')](this,_0x95ef12));this[_0xd7ea('0x10')][_0x20299a['id']]['on'](_0xd7ea('0x6'),this[_0xd7ea('0x1e')][_0xd7ea('0x1d')](this,_0x95ef12));this[_0xd7ea('0x10')][_0x20299a['id']]['on'](_0xd7ea('0x1f'),this[_0xd7ea('0x20')]['bind'](this,_0x95ef12));this['imapAccounts'][_0x20299a['id']]['on']('error',this[_0xd7ea('0x21')][_0xd7ea('0x1d')](this,_0x95ef12));}}else{if(_[_0xd7ea('0x22')](this[_0xd7ea('0xf')][_0x95ef12][_0xd7ea('0x14')])){this['mailAccounts'][_0x95ef12][_0xd7ea('0x14')]={};}this['mailAccounts'][_0x95ef12][_0xd7ea('0x14')][_0xd7ea('0x15')]=_0xd7ea('0x23');this[_0xd7ea('0xf')][_0x95ef12][_0xd7ea('0x14')][_0xd7ea('0x16')]='';this[_0xd7ea('0x11')](_0x95ef12);}}}};EmailChannel[_0xd7ea('0x19')][_0xd7ea('0x24')]=function(_0x5479bb,_0x386100){if(this[_0xd7ea('0xf')][_0x5479bb]){this['mailAccounts'][_0x5479bb][_0xd7ea('0x14')]['status']=_0xd7ea('0x25');this[_0xd7ea('0xf')][_0x5479bb][_0xd7ea('0x14')][_0xd7ea('0x16')]=_0x386100[_0xd7ea('0x12')];if(_0x386100[_0xd7ea('0x26')]){this['mailAccounts'][_0x5479bb][_0xd7ea('0x14')][_0xd7ea('0x17')]=_0x386100[_0xd7ea('0x26')][_0xd7ea('0x17')];}return this[_0xd7ea('0x11')](_0x5479bb);}};EmailChannel[_0xd7ea('0x19')]['handleImapEmail']=function(_0x36b631,_0x36195d){logger[_0xd7ea('0xd')](_0xd7ea('0x27'),_0x36195d[_0xd7ea('0x28')],_0x36195d[_0xd7ea('0x29')],_0x36195d[_0xd7ea('0x2a')],_0x36b631);if(this['mailAccounts'][_0x36b631]){return mailAccount[_0xd7ea('0x2b')](_0x36b631,_0x36195d)[_0xd7ea('0x2c')](function(_0x11a978){if(_0x11a978){logger[_0xd7ea('0xd')](_0xd7ea('0x2d'));}})[_0xd7ea('0x2e')](function(_0x2f2bfe){logger[_0xd7ea('0x2f')](_0xd7ea('0x30'),JSON['stringify'](_0x2f2bfe));});}};EmailChannel[_0xd7ea('0x19')][_0xd7ea('0x20')]=function(_0x5a8d04){if(this[_0xd7ea('0xf')][_0x5a8d04]&&this[_0xd7ea('0xf')][_0x5a8d04][_0xd7ea('0x14')]){if(this[_0xd7ea('0x10')][this[_0xd7ea('0xf')][_0x5a8d04][_0xd7ea('0x14')]['id']]){delete this[_0xd7ea('0x10')][this['mailAccounts'][_0x5a8d04][_0xd7ea('0x14')]['id']];}this[_0xd7ea('0xf')][_0x5a8d04][_0xd7ea('0x14')][_0xd7ea('0x31')]=moment();this[_0xd7ea('0x11')](_0x5a8d04);}};EmailChannel[_0xd7ea('0x19')]['handleImapError']=function(_0x47f30f,_0x39aea8){if(this[_0xd7ea('0xf')][_0x47f30f]){this[_0xd7ea('0xf')][_0x47f30f][_0xd7ea('0x14')]['status']=_0xd7ea('0x2f');this[_0xd7ea('0xf')][_0x47f30f][_0xd7ea('0x14')][_0xd7ea('0x16')]=_0x39aea8;return this[_0xd7ea('0x11')](_0x47f30f);}};EmailChannel['prototype'][_0xd7ea('0x32')]=function(_0x2ddf7d,_0x365f27){return this[_0xd7ea('0x33')][_0xd7ea('0x34')](_0x2ddf7d,_0x365f27);};EmailChannel['prototype'][_0xd7ea('0x35')]=function(_0x268c3d){var _0x3e737f=this;if(this[_0xd7ea('0xf')][_0x268c3d['id']]){if(_[_0xd7ea('0x22')](this[_0xd7ea('0xf')][_0x268c3d['id']][_0xd7ea('0x36')])){this[_0xd7ea('0xf')][_0x268c3d['id']][_0xd7ea('0x36')]={};}this[_0xd7ea('0xf')][_0x268c3d['id']][_0xd7ea('0x36')][_0xd7ea('0x31')]=moment();return new BPromise(function(_0x5b6efd,_0xb1c503){return _0x3e737f[_0xd7ea('0x33')][_0xd7ea('0x37')](_0x268c3d)[_0xd7ea('0x2c')](function(_0x225c74){_0x3e737f['mailAccounts'][_0x268c3d['id']][_0xd7ea('0x36')][_0xd7ea('0x15')]=_0xd7ea('0x38');_0x3e737f[_0xd7ea('0xf')][_0x268c3d['id']]['Smtp'][_0xd7ea('0x16')]='';_0x3e737f['emit'](_0x268c3d['id']);_0x5b6efd(_0x225c74);})['catch'](function(_0x3eac5d){_0x3e737f[_0xd7ea('0xf')][_0x268c3d['id']][_0xd7ea('0x36')][_0xd7ea('0x15')]=_0xd7ea('0x2f');_0x3e737f[_0xd7ea('0xf')][_0x268c3d['id']][_0xd7ea('0x36')][_0xd7ea('0x16')]=_0x3eac5d;_0x3e737f[_0xd7ea('0x11')](_0x268c3d['id']);_0xb1c503(_0x3eac5d);});});}return this['smtp']['verify'](_0x268c3d);};module[_0xd7ea('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1c104b0..ab1c416 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 _0x8440=['authentication','user','host','port','tls','required','password','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','once','handleFetchError','handleFetchEnd','error','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','upperFirst','exports','path','util','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','ready','handleReady','end','handleEnd','bind','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service'];(function(_0x17da33,_0x560e61){var _0x4f5899=function(_0x52c999){while(--_0x52c999){_0x17da33['push'](_0x17da33['shift']());}};_0x4f5899(++_0x560e61);}(_0x8440,0x122));var _0x0844=function(_0x25f2bc,_0x3fd38a){_0x25f2bc=_0x25f2bc-0x0;var _0x21bd7=_0x8440[_0x25f2bc];return _0x21bd7;};'use strict';var fs=require('fs');var path=require(_0x0844('0x0'));var util=require(_0x0844('0x1'));var Imap=require('imap');var _=require(_0x0844('0x2'));var rs=require('randomstring');var simpleParser=require(_0x0844('0x3'))[_0x0844('0x4')];var Iconv=require(_0x0844('0x5'))[_0x0844('0x6')];var EventEmitter=require(_0x0844('0x7'))[_0x0844('0x8')];var utils=require(_0x0844('0x9'));var logger=require(_0x0844('0xa'))(_0x0844('0xb'));function EmailImap(_0x5449ba,_0x1184fb){this[_0x0844('0xc')]=_0x0844('0xd');this[_0x0844('0xe')]=this[_0x0844('0xf')](_0x5449ba,_0x1184fb);this[_0x0844('0x10')]=new Imap(this[_0x0844('0xe')]);this[_0x0844('0x10')]['once'](_0x0844('0x11'),this[_0x0844('0x12')]['bind'](this));this[_0x0844('0x10')]['once'](_0x0844('0x13'),this[_0x0844('0x14')][_0x0844('0x15')](this));this[_0x0844('0x10')]['on']('error',this[_0x0844('0x16')]['bind'](this));this[_0x0844('0x10')][_0x0844('0x17')]();}util[_0x0844('0x18')](EmailImap,EventEmitter);EmailImap[_0x0844('0x19')][_0x0844('0xf')]=function(_0x424be8,_0x34fea2){var _0x3163ac={'connTimeout':_0x424be8['connTimeout']?_0x424be8[_0x0844('0x1a')]*0x3e8:0x2710,'authTimeout':_0x424be8[_0x0844('0x1b')]?_0x424be8[_0x0844('0x1b')]*0x3e8:0x1388};if(_[_0x0844('0x1c')](_0x424be8[_0x0844('0x1d')])){if(_0x424be8[_0x0844('0x1e')]){_0x3163ac[_0x0844('0x1f')]=_0x424be8[_0x0844('0x1f')];_0x3163ac['password']=_0x424be8['password'];}_0x3163ac[_0x0844('0x20')]=_0x424be8[_0x0844('0x20')];_0x3163ac[_0x0844('0x21')]=_0x424be8[_0x0844('0x21')]||0x3e1;if(_0x424be8[_0x0844('0x22')]){_0x3163ac[_0x0844('0x22')]=!![];}else{_0x3163ac['tls']=![];_0x3163ac['autotls']=_0x0844('0x23');}}else{_0x3163ac['user']=_0x424be8['user'];_0x3163ac[_0x0844('0x24')]=_0x424be8[_0x0844('0x24')];_0x3163ac['host']=utils[_0x0844('0x25')](_0x424be8['service']);_0x3163ac['port']=0x3e1;_0x3163ac[_0x0844('0x22')]=!![];}_0x3163ac[_0x0844('0xb')]=_0x34fea2||_0x424be8[_0x0844('0x1f')]||_0x0844('0x26');return _0x3163ac;};EmailImap[_0x0844('0x19')][_0x0844('0x12')]=function(){this['imap'][_0x0844('0x27')](this[_0x0844('0xc')],![],this[_0x0844('0x28')]['bind'](this));};EmailImap[_0x0844('0x19')][_0x0844('0x28')]=function(_0x3d0de9,_0x2b9c15){if(_0x3d0de9){this[_0x0844('0x16')](_0x3d0de9,!![]);}else{this[_0x0844('0x29')](_0x0844('0x2a'),_0x2b9c15);this[_0x0844('0x2b')]();}};EmailImap[_0x0844('0x19')][_0x0844('0x2c')]=function(_0x520992){if(_0x520992){this[_0x0844('0x16')](_0x520992,!![]);}else{this['imap'][_0x0844('0x13')]();}};EmailImap[_0x0844('0x19')][_0x0844('0x2b')]=function(){this['imap'][_0x0844('0x2d')](['UNSEEN'],this[_0x0844('0x2e')][_0x0844('0x15')](this));};EmailImap[_0x0844('0x19')][_0x0844('0x2e')]=function(_0x36b48a,_0x62a77b){if(_0x36b48a){this[_0x0844('0x16')](_0x36b48a,!![]);}else{if(_0x62a77b[_0x0844('0x2f')]){try{var _0x48bee3=this[_0x0844('0x10')][_0x0844('0x30')](_0x62a77b,{'bodies':'','markSeen':!![]});_0x48bee3['on']('message',this['handleFetchMessage'][_0x0844('0x15')](this));_0x48bee3[_0x0844('0x31')]('error',this[_0x0844('0x32')][_0x0844('0x15')](this));_0x48bee3[_0x0844('0x31')]('end',this[_0x0844('0x33')][_0x0844('0x15')](this));}catch(_0x15d2ef){logger[_0x0844('0x34')](_0x15d2ef);}}else{this[_0x0844('0x10')]['closeBox'](!![],this[_0x0844('0x2c')][_0x0844('0x15')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x20340f,_0x1b741a){_0x20340f['on'](_0x0844('0x35'),this[_0x0844('0x36')][_0x0844('0x15')](this));_0x20340f[_0x0844('0x31')]('attributes',this[_0x0844('0x37')][_0x0844('0x15')](this));_0x20340f['once']('end',this[_0x0844('0x38')][_0x0844('0x15')](this));};EmailImap[_0x0844('0x19')][_0x0844('0x36')]=function(_0xb5ee55,_0x457a77){simpleParser(_0xb5ee55,{'Iconv':Iconv},this[_0x0844('0x39')][_0x0844('0x15')](this));};EmailImap['prototype'][_0x0844('0x37')]=function(_0xea2ad5){};EmailImap[_0x0844('0x19')]['handleMessageEnd']=function(){};EmailImap[_0x0844('0x19')][_0x0844('0x39')]=function(_0x1ddf29,_0x180e71){if(_0x1ddf29){logger['error'](_0x1ddf29);}else{var _0xa8f968=this;utils[_0x0844('0x3a')](this[_0x0844('0xe')],_0x180e71,function(_0x3520e0){_0xa8f968[_0x0844('0x29')](_0x0844('0xb'),_0x3520e0);});}};EmailImap[_0x0844('0x19')]['handleFetchEnd']=function(){this[_0x0844('0x10')]['closeBox'](!![],this[_0x0844('0x2c')][_0x0844('0x15')](this));};EmailImap[_0x0844('0x19')]['handleFetchError']=function(_0x2f144d){this[_0x0844('0x16')](_0x2f144d);this[_0x0844('0x10')][_0x0844('0x3b')](!![],this[_0x0844('0x2c')][_0x0844('0x15')](this));};EmailImap[_0x0844('0x19')]['handleEnd']=function(){this['emit'](_0x0844('0x13'));};EmailImap[_0x0844('0x19')][_0x0844('0x16')]=function(_0x256864,_0x4024f){logger['error'](_0x0844('0x16'),this[_0x0844('0xe')][_0x0844('0xb')],JSON[_0x0844('0x3c')](_0x256864));var _0x3894bc='';if(_0x256864){if(_0x256864[_0x0844('0x3d')]){_0x3894bc=_0x256864[_0x0844('0x3d')];}else{for(var _0x558ec9 in _0x256864){if(_0x256864['hasOwnProperty'](_0x558ec9)){_0x3894bc+=_[_0x0844('0x3e')](_0x558ec9)+':\x20'+_0x256864[_0x558ec9]+'\x0a';}}}}if(_0x4024f){this[_0x0844('0x10')][_0x0844('0x13')]();}else{this[_0x0844('0x29')]('error',_0x3894bc);this[_0x0844('0x29')]('end');}};module[_0x0844('0x3f')]=EmailImap; \ No newline at end of file +var _0x39f1=['bind','end','handleEnd','error','handleError','connTimeout','authTimeout','service','authentication','user','password','host','tls','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','box','handleCloseBox','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','randomstring','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x39f1,0xd3));var _0x139f=function(_0x13dd37,_0x1a62d7){_0x13dd37=_0x13dd37-0x0;var _0x4018ef=_0x39f1[_0x13dd37];return _0x4018ef;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x139f('0x0'));var Imap=require(_0x139f('0x1'));var _=require('lodash');var rs=require(_0x139f('0x2'));var simpleParser=require('mailparser')[_0x139f('0x3')];var Iconv=require(_0x139f('0x4'))[_0x139f('0x5')];var EventEmitter=require(_0x139f('0x6'))['EventEmitter'];var utils=require(_0x139f('0x7'));var logger=require(_0x139f('0x8'))(_0x139f('0x9'));function EmailImap(_0x19aec7,_0x4671e1){this[_0x139f('0xa')]=_0x139f('0xb');this['account']=this[_0x139f('0xc')](_0x19aec7,_0x4671e1);this[_0x139f('0x1')]=new Imap(this[_0x139f('0xd')]);this['imap'][_0x139f('0xe')](_0x139f('0xf'),this[_0x139f('0x10')][_0x139f('0x11')](this));this[_0x139f('0x1')][_0x139f('0xe')](_0x139f('0x12'),this[_0x139f('0x13')][_0x139f('0x11')](this));this[_0x139f('0x1')]['on'](_0x139f('0x14'),this[_0x139f('0x15')][_0x139f('0x11')](this));this[_0x139f('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x139f('0xc')]=function(_0x4564c9,_0x2fc81c){var _0x59987b={'connTimeout':_0x4564c9['connTimeout']?_0x4564c9[_0x139f('0x16')]*0x3e8:0x2710,'authTimeout':_0x4564c9[_0x139f('0x17')]?_0x4564c9[_0x139f('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x4564c9[_0x139f('0x18')])){if(_0x4564c9[_0x139f('0x19')]){_0x59987b[_0x139f('0x1a')]=_0x4564c9[_0x139f('0x1a')];_0x59987b[_0x139f('0x1b')]=_0x4564c9[_0x139f('0x1b')];}_0x59987b[_0x139f('0x1c')]=_0x4564c9['host'];_0x59987b['port']=_0x4564c9['port']||0x3e1;if(_0x4564c9['tls']){_0x59987b[_0x139f('0x1d')]=!![];}else{_0x59987b[_0x139f('0x1d')]=![];_0x59987b['autotls']='required';}}else{_0x59987b[_0x139f('0x1a')]=_0x4564c9[_0x139f('0x1a')];_0x59987b[_0x139f('0x1b')]=_0x4564c9[_0x139f('0x1b')];_0x59987b[_0x139f('0x1c')]=utils[_0x139f('0x1e')](_0x4564c9[_0x139f('0x18')]);_0x59987b['port']=0x3e1;_0x59987b[_0x139f('0x1d')]=!![];}_0x59987b[_0x139f('0x9')]=_0x2fc81c||_0x4564c9['user']||_0x139f('0x1f');return _0x59987b;};EmailImap[_0x139f('0x20')][_0x139f('0x10')]=function(){this['imap'][_0x139f('0x21')](this['mailbox'],![],this[_0x139f('0x22')][_0x139f('0x11')](this));};EmailImap[_0x139f('0x20')]['handleOpenBox']=function(_0x5a894f,_0x4a0295){if(_0x5a894f){this['handleError'](_0x5a894f,!![]);}else{this['emit'](_0x139f('0x23'),_0x4a0295);this['readUnseen']();}};EmailImap[_0x139f('0x20')][_0x139f('0x24')]=function(_0x4b5742){if(_0x4b5742){this[_0x139f('0x15')](_0x4b5742,!![]);}else{this[_0x139f('0x1')][_0x139f('0x12')]();}};EmailImap[_0x139f('0x20')][_0x139f('0x25')]=function(){this['imap']['search']([_0x139f('0x26')],this['handleReadUnseen'][_0x139f('0x11')](this));};EmailImap['prototype'][_0x139f('0x27')]=function(_0x1cc5d6,_0x4292e7){if(_0x1cc5d6){this[_0x139f('0x15')](_0x1cc5d6,!![]);}else{if(_0x4292e7[_0x139f('0x28')]){try{var _0x81fd0d=this[_0x139f('0x1')][_0x139f('0x29')](_0x4292e7,{'bodies':'','markSeen':!![]});_0x81fd0d['on'](_0x139f('0x2a'),this[_0x139f('0x2b')]['bind'](this));_0x81fd0d[_0x139f('0xe')]('error',this['handleFetchError']['bind'](this));_0x81fd0d[_0x139f('0xe')](_0x139f('0x12'),this[_0x139f('0x2c')][_0x139f('0x11')](this));}catch(_0x2ddd23){logger[_0x139f('0x14')](_0x2ddd23);}}else{this['imap']['closeBox'](!![],this[_0x139f('0x24')]['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x416d6f,_0x3fbb9e){_0x416d6f['on']('body',this[_0x139f('0x2d')]['bind'](this));_0x416d6f[_0x139f('0xe')](_0x139f('0x2e'),this[_0x139f('0x2f')][_0x139f('0x11')](this));_0x416d6f[_0x139f('0xe')](_0x139f('0x12'),this[_0x139f('0x30')][_0x139f('0x11')](this));};EmailImap[_0x139f('0x20')][_0x139f('0x2d')]=function(_0x1c700d,_0x524cc3){simpleParser(_0x1c700d,{'Iconv':Iconv},this['handleSimpleParser'][_0x139f('0x11')](this));};EmailImap[_0x139f('0x20')][_0x139f('0x2f')]=function(_0x56bed5){};EmailImap[_0x139f('0x20')]['handleMessageEnd']=function(){};EmailImap[_0x139f('0x20')][_0x139f('0x31')]=function(_0xa768c6,_0x1494b3){if(_0xa768c6){logger['error'](_0xa768c6);}else{var _0x24e216=this;utils['parser'](this['account'],_0x1494b3,function(_0xc4bcaf){_0x24e216[_0x139f('0x32')](_0x139f('0x9'),_0xc4bcaf);});}};EmailImap[_0x139f('0x20')][_0x139f('0x2c')]=function(){this[_0x139f('0x1')][_0x139f('0x33')](!![],this[_0x139f('0x24')][_0x139f('0x11')](this));};EmailImap[_0x139f('0x20')]['handleFetchError']=function(_0x362608){this[_0x139f('0x15')](_0x362608);this[_0x139f('0x1')][_0x139f('0x33')](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype'][_0x139f('0x13')]=function(){this[_0x139f('0x32')](_0x139f('0x12'));};EmailImap[_0x139f('0x20')][_0x139f('0x15')]=function(_0x2daf35,_0x230cee){logger[_0x139f('0x14')](_0x139f('0x15'),this['account'][_0x139f('0x9')],JSON[_0x139f('0x34')](_0x2daf35));var _0x29210c='';if(_0x2daf35){if(_0x2daf35[_0x139f('0x35')]){_0x29210c=_0x2daf35['textCode'];}else{for(var _0x2fba0f in _0x2daf35){if(_0x2daf35[_0x139f('0x36')](_0x2fba0f)){_0x29210c+=_[_0x139f('0x37')](_0x2fba0f)+':\x20'+_0x2daf35[_0x2fba0f]+'\x0a';}}}}if(_0x230cee){this['imap'][_0x139f('0x12')]();}else{this['emit']('error',_0x29210c);this['emit'](_0x139f('0x12'));}};module[_0x139f('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index ceceecf..c35ae1a 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 _0xcefd=['nodemailer-plugin-inline-base64','prototype','use','sendMail','createTransport','verify','nodemailer','bluebird'];(function(_0x45138b,_0xec2bd6){var _0x398884=function(_0x408309){while(--_0x408309){_0x45138b['push'](_0x45138b['shift']());}};_0x398884(++_0xec2bd6);}(_0xcefd,0x146));var _0xdcef=function(_0x71d604,_0x3edc06){_0x71d604=_0x71d604-0x0;var _0x1ae5a5=_0xcefd[_0x71d604];return _0x1ae5a5;};'use strict';var nodemailer=require(_0xdcef('0x0'));var BPromise=require(_0xdcef('0x1'));var inlineBase64=require(_0xdcef('0x2'));function EmailSmtp(){}EmailSmtp[_0xdcef('0x3')]['send']=function(_0x1ec1ac,_0x1d8e1c){return new BPromise(function(_0x50a2ef,_0x1d4188){var _0x2cad24=nodemailer['createTransport'](_0x1ec1ac);_0x2cad24[_0xdcef('0x4')]('compile',inlineBase64());_0x2cad24[_0xdcef('0x5')](_0x1d8e1c,function(_0x576930,_0x41904d){if(_0x576930){_0x1d4188(_0x576930['toString']());}else{_0x50a2ef(_0x41904d);}});});};EmailSmtp[_0xdcef('0x3')]['verify']=function(_0x305707){return new BPromise(function(_0x52fb95,_0x2ffed0){var _0x2ffb1d=nodemailer[_0xdcef('0x6')](_0x305707);_0x2ffb1d[_0xdcef('0x7')](function(_0x3068cf,_0x33cc1d){if(_0x3068cf){_0x2ffed0(_0x3068cf['toString']());}else{if(_0x33cc1d){_0x52fb95(_0x33cc1d);}else{_0x2ffed0('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x14a0=['exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14a0,0x109));var _0x014a=function(_0x10faaf,_0x4c4fbb){_0x10faaf=_0x10faaf-0x0;var _0x3c08c3=_0x14a0[_0x10faaf];return _0x3c08c3;};'use strict';var nodemailer=require(_0x014a('0x0'));var BPromise=require(_0x014a('0x1'));var inlineBase64=require(_0x014a('0x2'));function EmailSmtp(){}EmailSmtp[_0x014a('0x3')][_0x014a('0x4')]=function(_0x1cbdb2,_0x1368a2){return new BPromise(function(_0x349a0d,_0x1cf6f3){var _0x56d55d=nodemailer[_0x014a('0x5')](_0x1cbdb2);_0x56d55d[_0x014a('0x6')]('compile',inlineBase64());_0x56d55d[_0x014a('0x7')](_0x1368a2,function(_0x7f2dc6,_0x290270){if(_0x7f2dc6){_0x1cf6f3(_0x7f2dc6[_0x014a('0x8')]());}else{_0x349a0d(_0x290270);}});});};EmailSmtp[_0x014a('0x3')]['verify']=function(_0x1d6924){return new BPromise(function(_0x3168f0,_0x1cb4e5){var _0x1dc8d2=nodemailer[_0x014a('0x5')](_0x1d6924);_0x1dc8d2[_0x014a('0x9')](function(_0x257ce3,_0x2be12d){if(_0x257ce3){_0x1cb4e5(_0x257ce3[_0x014a('0x8')]());}else{if(_0x2be12d){_0x3168f0(_0x2be12d);}else{_0x1cb4e5(_0x014a('0xa'));}}});});};module[_0x014a('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 4f764a2..7d71485 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 _0x5d0a=['outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','Anonymous','split','pop','isEmpty','html','test','includes','Empty\x20message

','Attachments','push','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com'];(function(_0x4f52ef,_0x1121cd){var _0x284c17=function(_0x2d0c4c){while(--_0x2d0c4c){_0x4f52ef['push'](_0x4f52ef['shift']());}};_0x284c17(++_0x1121cd);}(_0x5d0a,0x175));var _0xa5d0=function(_0x36d518,_0x2de2ec){_0x36d518=_0x36d518-0x0;var _0x44404c=_0x5d0a[_0x36d518];return _0x44404c;};'use strict';var _=require(_0xa5d0('0x0'));var moment=require('moment');var random=require(_0xa5d0('0x1'));var fs=require('fs');var path=require('path');var util=require(_0xa5d0('0x2'));var tnef=require(_0xa5d0('0x3'));var logger=require(_0xa5d0('0x4'))(_0xa5d0('0x5'));var config=require('../../../config/environment');function getAddress(_0x24b2b5){var _0x81c8f7=_[_0xa5d0('0x6')](_0x24b2b5[_0xa5d0('0x7')]);return _0x81c8f7&&_0x81c8f7[_0xa5d0('0x8')]?_0x81c8f7[_0xa5d0('0x8')]:_0xa5d0('0x9')+random[_0xa5d0('0xa')](0x6)+_0xa5d0('0xb');}function getFirstName(_0x27fe5a){var _0x3845b3=_['head'](_0x27fe5a[_0xa5d0('0x7')]);if(_0x3845b3&&_0x3845b3[_0xa5d0('0xc')]){if(_0x3845b3[_0xa5d0('0xc')]==_0x3845b3[_0xa5d0('0x8')]){return _0x3845b3[_0xa5d0('0xc')][_0xa5d0('0xd')](0x0,_0x3845b3[_0xa5d0('0xc')][_0xa5d0('0xe')]('@'));}var _0xc847c9=_0x3845b3[_0xa5d0('0xc')]['split'](/\s+/);return _0xc847c9[_0xa5d0('0xf')]>0x1?_0xc847c9['slice'](0x0,-0x1)['join']('\x20'):_0x3845b3[_0xa5d0('0xc')];}return _0xa5d0('0x10');}function getLastName(_0xe6550c){var _0x414388=_['head'](_0xe6550c['value']);if(_0x414388&&_0x414388[_0xa5d0('0xc')]){var _0x2a138b=_0x414388[_0xa5d0('0xc')][_0xa5d0('0x11')](/\s+/);return _0x2a138b[_0xa5d0('0xf')]>0x1?_0x2a138b[_0xa5d0('0x12')]():'';}return'';}function getMails(_0x1461d5,_0x5b267d){var _0x2da9ec='';for(var _0x5bfe18=0x0;_0x5bfe18<_0x5b267d[_0xa5d0('0x7')][_0xa5d0('0xf')];_0x5bfe18+=0x1){if(_0x5b267d['value'][_0x5bfe18]['address']!==_0x1461d5){if(!_[_0xa5d0('0x13')](_0x2da9ec)){_0x2da9ec+=',';}_0x2da9ec+=_0x5b267d[_0xa5d0('0x7')][_0x5bfe18]['name']||_0x5b267d[_0xa5d0('0x7')][_0x5bfe18][_0xa5d0('0x8')]||'';_0x2da9ec+='\x20<';_0x2da9ec+=_0x5b267d[_0xa5d0('0x7')][_0x5bfe18][_0xa5d0('0x8')]?_0x5b267d[_0xa5d0('0x7')][_0x5bfe18][_0xa5d0('0x8')]:'anonymous'+random['generate'](0x6)+_0xa5d0('0xb');_0x2da9ec+='>';}}return _0x2da9ec;}function parseEmail(_0x135c5f,_0x4cc587,_0x5e5ddf){if(_0x4cc587[_0xa5d0('0x14')]){var _0x42a745=/)<[^<]*)*<\/script>/gi;while(_0x42a745[_0xa5d0('0x15')](_0x4cc587[_0xa5d0('0x14')])){_0x4cc587[_0xa5d0('0x14')]=_0x4cc587[_0xa5d0('0x14')]['replace'](_0x42a745,'');}if(_0x4cc587[_0xa5d0('0x14')][_0xa5d0('0x16')](_0xa5d0('0x17'))){var _0x5b363f=[];_0x4cc587[_0xa5d0('0x18')][_0xa5d0('0x19')](_0x28d23a=>{_0x5b363f['push'](_0x28d23a['filename']);});var _0x758789=/]+>/g;var _0x4b8241=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x49ca76=_0x4cc587['html'][_0xa5d0('0x1a')](_0x4b8241,_0xa5d0('0x1b'));var _0x5ca6f7=_0x49ca76[_0xa5d0('0x1a')](_0x758789,'_IMG');for(let _0x2ee9d0=0x0;_0x2ee9d0<_0x5b363f['length'];_0x2ee9d0++){var _0x3ab3d5=_0x5ca6f7[_0xa5d0('0x1a')](_0xa5d0('0x1c'),'\x20[Attachment:\x20'+_0x5b363f[_0x2ee9d0]+'\x20]');_0x5ca6f7=_0x3ab3d5;}_0x4cc587['html']=_0x5ca6f7;}_0x5e5ddf[_0xa5d0('0x1d')]=_0x4cc587[_0xa5d0('0x14')];}else{_0x5e5ddf[_0xa5d0('0x1d')]=_0x4cc587[_0xa5d0('0x1e')];}if(_0x5e5ddf['body']){_0x5e5ddf[_0xa5d0('0x1d')]=_0x5e5ddf[_0xa5d0('0x1d')]['replace'](/0x0){var _0x5a8444=[_0xa5d0('0x2f'),_0xa5d0('0x30'),_0xa5d0('0x31')];for(var _0x107d97=0x0;_0x107d97<_0x4cc587[_0xa5d0('0x2e')][_0xa5d0('0xf')];_0x107d97++){var _0xfabf5f=_['indexOf'](_0x5a8444,_0x4cc587[_0xa5d0('0x2e')][_0x107d97][_0xa5d0('0x32')]);if(_0xfabf5f>=0x0){_0x5e5ddf[_0xa5d0('0x33')]=!![];}}}return _0x5e5ddf;}exports[_0xa5d0('0x34')]=function(_0x1090b6,_0x358b23,_0x330657){var _0x41fa0f={'from':getAddress(_0x358b23['from']),'firstName':getFirstName(_0x358b23[_0xa5d0('0x35')]),'lastName':getLastName(_0x358b23['from']),'mapKey':_0xa5d0('0x5'),'message':{'from':getMails(_0x1090b6['email'],_0x358b23[_0xa5d0('0x35')]),'to':_0x1090b6['email'],'cc':'','subject':_0x358b23[_0xa5d0('0x36')]||'','messageId':_0x358b23['messageId'],'inReplyTo':_0x358b23[_0xa5d0('0x37')],'sentAt':moment(_0x358b23[_0xa5d0('0x38')])['format'](_0xa5d0('0x39')),'attach':![],'attachments':[]}};if(!_0x358b23[_0xa5d0('0x14')]&&!_0x358b23[_0xa5d0('0x1e')]){var _0x33651b=_['filter'](_0x358b23['attachments'],{'contentType':_0xa5d0('0x3a')});if(_0x33651b[_0xa5d0('0xf')]){logger[_0xa5d0('0x3b')](util[_0xa5d0('0x3c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x358b23['messageId']));tnef[_0xa5d0('0x3d')](_[_0xa5d0('0x3e')](_0x33651b)[_0xa5d0('0x2c')],function(_0x37c1f6,_0x43b8b6){if(_0x43b8b6){_0x358b23['html']=_0x43b8b6['BodyHTML']||_0xa5d0('0x3f');if(_0x43b8b6[_0xa5d0('0x40')]){for(var _0x2d8551=0x0;_0x2d8551<_0x43b8b6[_0xa5d0('0x40')][_0xa5d0('0xf')];_0x2d8551++){var _0x102908=_0x43b8b6[_0xa5d0('0x40')][_0x2d8551];_0x41fa0f[_0xa5d0('0x20')][_0xa5d0('0x18')][_0xa5d0('0x41')]({'filename':_0x102908['Title'],'content':Buffer[_0xa5d0('0x35')](_0x102908['Data'])});}}}_0x330657(parseEmail(_0x1090b6,_0x358b23,_0x41fa0f));});}else{_0x358b23[_0xa5d0('0x14')]=_0xa5d0('0x3f');_0x330657(parseEmail(_0x1090b6,_0x358b23,_0x41fa0f));}}else{_0x330657(parseEmail(_0x1090b6,_0x358b23,_0x41fa0f));}};exports['getHost']=function(_0x2d4716){switch(_0x2d4716){case _0xa5d0('0x42'):return _0xa5d0('0x43');case _0xa5d0('0x44'):return _0xa5d0('0x45');case'hotmail':return _0xa5d0('0x46');case _0xa5d0('0x47'):return _0xa5d0('0x48');}return _0xa5d0('0x49');}; \ No newline at end of file +var _0x3f96=['name','substring','split','slice','join','Anonymous','length','pop','isEmpty','generate','html','test','replace','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head'];(function(_0x3e41ed,_0x38c3f1){var _0x42dd42=function(_0x905235){while(--_0x905235){_0x3e41ed['push'](_0x3e41ed['shift']());}};_0x42dd42(++_0x38c3f1);}(_0x3f96,0x1d3));var _0x63f9=function(_0x17aec1,_0x4d71e9){_0x17aec1=_0x17aec1-0x0;var _0x9345db=_0x3f96[_0x17aec1];return _0x9345db;};'use strict';var _=require(_0x63f9('0x0'));var moment=require(_0x63f9('0x1'));var random=require(_0x63f9('0x2'));var fs=require('fs');var path=require(_0x63f9('0x3'));var util=require(_0x63f9('0x4'));var tnef=require('node-tnef');var logger=require(_0x63f9('0x5'))(_0x63f9('0x6'));var config=require(_0x63f9('0x7'));function getAddress(_0x26ff58){var _0x2109ce=_['head'](_0x26ff58[_0x63f9('0x8')]);return _0x2109ce&&_0x2109ce[_0x63f9('0x9')]?_0x2109ce[_0x63f9('0x9')]:_0x63f9('0xa')+random['generate'](0x6)+_0x63f9('0xb');}function getFirstName(_0x258200){var _0x201069=_[_0x63f9('0xc')](_0x258200[_0x63f9('0x8')]);if(_0x201069&&_0x201069[_0x63f9('0xd')]){if(_0x201069[_0x63f9('0xd')]==_0x201069[_0x63f9('0x9')]){return _0x201069['name'][_0x63f9('0xe')](0x0,_0x201069[_0x63f9('0xd')]['indexOf']('@'));}var _0x409957=_0x201069[_0x63f9('0xd')][_0x63f9('0xf')](/\s+/);return _0x409957['length']>0x1?_0x409957[_0x63f9('0x10')](0x0,-0x1)[_0x63f9('0x11')]('\x20'):_0x201069[_0x63f9('0xd')];}return _0x63f9('0x12');}function getLastName(_0x10be8f){var _0x568e3d=_[_0x63f9('0xc')](_0x10be8f['value']);if(_0x568e3d&&_0x568e3d[_0x63f9('0xd')]){var _0x486d32=_0x568e3d[_0x63f9('0xd')]['split'](/\s+/);return _0x486d32[_0x63f9('0x13')]>0x1?_0x486d32[_0x63f9('0x14')]():'';}return'';}function getMails(_0x37fc43,_0x352334){var _0x100d39='';for(var _0x1da33e=0x0;_0x1da33e<_0x352334[_0x63f9('0x8')]['length'];_0x1da33e+=0x1){if(_0x352334[_0x63f9('0x8')][_0x1da33e][_0x63f9('0x9')]!==_0x37fc43){if(!_[_0x63f9('0x15')](_0x100d39)){_0x100d39+=',';}_0x100d39+=_0x352334[_0x63f9('0x8')][_0x1da33e][_0x63f9('0xd')]||_0x352334['value'][_0x1da33e][_0x63f9('0x9')]||'';_0x100d39+='\x20<';_0x100d39+=_0x352334[_0x63f9('0x8')][_0x1da33e][_0x63f9('0x9')]?_0x352334['value'][_0x1da33e][_0x63f9('0x9')]:_0x63f9('0xa')+random[_0x63f9('0x16')](0x6)+_0x63f9('0xb');_0x100d39+='>';}}return _0x100d39;}function parseEmail(_0x1681cc,_0x537a11,_0x59f437){if(_0x537a11[_0x63f9('0x17')]){var _0x3926a2=/)<[^<]*)*<\/script>/gi;while(_0x3926a2[_0x63f9('0x18')](_0x537a11[_0x63f9('0x17')])){_0x537a11[_0x63f9('0x17')]=_0x537a11[_0x63f9('0x17')][_0x63f9('0x19')](_0x3926a2,'');}if(_0x537a11['html']['includes'](_0x63f9('0x1a'))){var _0x3cdff5=[];_0x537a11[_0x63f9('0x1b')][_0x63f9('0x1c')](_0x462fe9=>{_0x3cdff5[_0x63f9('0x1d')](_0x462fe9[_0x63f9('0x1e')]);});var _0xbb9716=/]+>/g;var _0x5637c3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4abbf2=_0x537a11[_0x63f9('0x17')][_0x63f9('0x19')](_0x5637c3,_0x63f9('0x1f'));var _0x14d708=_0x4abbf2['replace'](_0xbb9716,_0x63f9('0x20'));for(let _0x4c6f08=0x0;_0x4c6f08<_0x3cdff5[_0x63f9('0x13')];_0x4c6f08++){var _0x3b8586=_0x14d708[_0x63f9('0x19')]('_IMG',_0x63f9('0x21')+_0x3cdff5[_0x4c6f08]+_0x63f9('0x22'));_0x14d708=_0x3b8586;}_0x537a11[_0x63f9('0x17')]=_0x14d708;}_0x59f437[_0x63f9('0x23')]=_0x537a11[_0x63f9('0x17')];}else{_0x59f437[_0x63f9('0x23')]=_0x537a11['textAsHtml'];}if(_0x59f437[_0x63f9('0x23')]){_0x59f437[_0x63f9('0x23')]=_0x59f437[_0x63f9('0x23')][_0x63f9('0x19')](/0x0){var _0x4a1fd1=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0xd37f1b=0x0;_0xd37f1b<_0x537a11[_0x63f9('0x33')][_0x63f9('0x13')];_0xd37f1b++){var _0x2cdb7e=_[_0x63f9('0x34')](_0x4a1fd1,_0x537a11[_0x63f9('0x33')][_0xd37f1b][_0x63f9('0x35')]);if(_0x2cdb7e>=0x0){_0x59f437[_0x63f9('0x36')]=!![];}}}return _0x59f437;}exports[_0x63f9('0x37')]=function(_0x5f53ab,_0x23ee18,_0x4a3da9){var _0x34b87e={'from':getAddress(_0x23ee18['from']),'firstName':getFirstName(_0x23ee18[_0x63f9('0x38')]),'lastName':getLastName(_0x23ee18[_0x63f9('0x38')]),'mapKey':_0x63f9('0x6'),'message':{'from':getMails(_0x5f53ab['email'],_0x23ee18[_0x63f9('0x38')]),'to':_0x5f53ab[_0x63f9('0x6')],'cc':'','subject':_0x23ee18[_0x63f9('0x39')]||'','messageId':_0x23ee18['messageId'],'inReplyTo':_0x23ee18['inReplyTo'],'sentAt':moment(_0x23ee18[_0x63f9('0x3a')])[_0x63f9('0x2d')](_0x63f9('0x3b')),'attach':![],'attachments':[]}};if(!_0x23ee18[_0x63f9('0x17')]&&!_0x23ee18[_0x63f9('0x3c')]){var _0x12314e=_['filter'](_0x23ee18[_0x63f9('0x1b')],{'contentType':_0x63f9('0x3d')});if(_0x12314e['length']){logger[_0x63f9('0x3e')](util[_0x63f9('0x2d')](_0x63f9('0x3f'),_0x23ee18['messageId']));tnef['parseBuffer'](_[_0x63f9('0x40')](_0x12314e)[_0x63f9('0x41')],function(_0x59a779,_0x2eb77a){if(_0x2eb77a){_0x23ee18[_0x63f9('0x17')]=_0x2eb77a[_0x63f9('0x42')]||_0x63f9('0x43');if(_0x2eb77a[_0x63f9('0x44')]){for(var _0x51d818=0x0;_0x51d818<_0x2eb77a[_0x63f9('0x44')][_0x63f9('0x13')];_0x51d818++){var _0x311a60=_0x2eb77a['Attachments'][_0x51d818];_0x34b87e['message']['attachments']['push']({'filename':_0x311a60[_0x63f9('0x45')],'content':Buffer[_0x63f9('0x38')](_0x311a60[_0x63f9('0x46')])});}}}_0x4a3da9(parseEmail(_0x5f53ab,_0x23ee18,_0x34b87e));});}else{_0x23ee18['html']='

Empty\x20message

';_0x4a3da9(parseEmail(_0x5f53ab,_0x23ee18,_0x34b87e));}}else{_0x4a3da9(parseEmail(_0x5f53ab,_0x23ee18,_0x34b87e));}};exports[_0x63f9('0x47')]=function(_0x15c27b){switch(_0x15c27b){case _0x63f9('0x48'):return _0x63f9('0x49');case _0x63f9('0x4a'):return _0x63f9('0x4b');case _0x63f9('0x4c'):return _0x63f9('0x4d');case'outlook365':return _0x63f9('0x4e');}return _0x63f9('0x4f');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f69bded..e619ef9 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 _0x7a48=['exports','name','key','SERV','active','Imap','Smtp'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7a48,0xb7));var _0x87a4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7a48[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');function MailAccount(_0x57c7c4){this['id']=_0x57c7c4['id']||0x0;this['name']=_0x57c7c4[_0x87a4('0x0')]||'Service';this[_0x87a4('0x1')]=_0x57c7c4['key']||_0x87a4('0x2');this['active']=_0x57c7c4[_0x87a4('0x3')]||![];this[_0x87a4('0x4')]=_0x57c7c4[_0x87a4('0x4')]||[];this[_0x87a4('0x5')]=_0x57c7c4['Smtp']||[];}module[_0x87a4('0x6')]=MailAccount; \ No newline at end of file +var _0xfe8a=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xfe8a,0xd8));var _0xafe8=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xfe8a[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0xafe8('0x0'));function MailAccount(_0x2d9c72){this['id']=_0x2d9c72['id']||0x0;this[_0xafe8('0x1')]=_0x2d9c72[_0xafe8('0x1')]||_0xafe8('0x2');this[_0xafe8('0x3')]=_0x2d9c72[_0xafe8('0x3')]||_0xafe8('0x4');this[_0xafe8('0x5')]=_0x2d9c72['active']||![];this[_0xafe8('0x6')]=_0x2d9c72[_0xafe8('0x6')]||[];this['Smtp']=_0x2d9c72[_0xafe8('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 85349e6..5f16ba6 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 _0xe980=['initMailAccounts','length','isUndefined','mailAccounts','merge','exports','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x1001b8,_0x5e47d7){var _0x13fb99=function(_0x4271ec){while(--_0x4271ec){_0x1001b8['push'](_0x1001b8['shift']());}};_0x13fb99(++_0x5e47d7);}(_0xe980,0x74));var _0x0e98=function(_0x4631bc,_0xd32da9){_0x4631bc=_0x4631bc-0x0;var _0x41d511=_0xe980[_0x4631bc];return _0x41d511;};'use strict';var _=require('lodash');var MailAccount=require(_0x0e98('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2c9283,_0x33ab7e,_0x381ab9){var _0x30a9ad=_[_0x0e98('0x1')](_0x2c9283,function(_0x26783e,_0x1f4762){return _0x26783e[_0x381ab9];});for(var _0x580959 in _0x33ab7e){if(_0x33ab7e[_0x0e98('0x2')](_0x580959)){if(!_0x30a9ad[_0x580959]){delete _0x33ab7e[_0x580959];}}}}Realtime[_0x0e98('0x3')][_0x0e98('0x4')]=function(_0x4ef9dc,_0x2e2a17){for(var _0x44edb3 in _0x2e2a17){if(_0x4ef9dc[_0x0e98('0x2')](_0x44edb3)){_0x4ef9dc[_0x44edb3]=_0x2e2a17[_0x44edb3];}}};Realtime[_0x0e98('0x3')][_0x0e98('0x5')]=function(){var _0x4b3ca5=this;return function(_0x27baa7){if(_0x27baa7){freeIsNotKey(_0x27baa7,_0x4b3ca5['mailAccounts'],'id');for(var _0x509fba=0x0,_0x55f251={},_0x2cc8b2={};_0x509fba<_0x27baa7[_0x0e98('0x6')];_0x509fba+=0x1){_0x55f251=_0x27baa7[_0x509fba];if(_[_0x0e98('0x7')](_0x4b3ca5[_0x0e98('0x8')][_0x55f251['id']])){_0x4b3ca5['mailAccounts'][_0x55f251['id']]=new MailAccount(_0x55f251);}else{_[_0x0e98('0x9')](_0x4b3ca5[_0x0e98('0x8')][_0x55f251['id']],_0x55f251);}}}return _0x4b3ca5[_0x0e98('0x8')];};};module[_0x0e98('0xa')]=Realtime; \ No newline at end of file +var _0xb8cb=['mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x5ca259,_0x145448){var _0x30d5d8=function(_0x3a0a32){while(--_0x3a0a32){_0x5ca259['push'](_0x5ca259['shift']());}};_0x30d5d8(++_0x145448);}(_0xb8cb,0x14d));var _0xbb8c=function(_0x3fe0ee,_0x2e4a5d){_0x3fe0ee=_0x3fe0ee-0x0;var _0x199249=_0xb8cb[_0x3fe0ee];return _0x199249;};'use strict';var _=require(_0xbb8c('0x0'));var MailAccount=require(_0xbb8c('0x1'));var Realtime=function(){this[_0xbb8c('0x2')]={};};function freeIsNotKey(_0x22c17c,_0x3cfe66,_0x3b75b4){var _0x143a5b=_[_0xbb8c('0x3')](_0x22c17c,function(_0x2bc107,_0x3cdceb){return _0x2bc107[_0x3b75b4];});for(var _0x5b5b82 in _0x3cfe66){if(_0x3cfe66[_0xbb8c('0x4')](_0x5b5b82)){if(!_0x143a5b[_0x5b5b82]){delete _0x3cfe66[_0x5b5b82];}}}}Realtime['prototype'][_0xbb8c('0x5')]=function(_0x358119,_0xd12fb){for(var _0x1301fd in _0xd12fb){if(_0x358119['hasOwnProperty'](_0x1301fd)){_0x358119[_0x1301fd]=_0xd12fb[_0x1301fd];}}};Realtime[_0xbb8c('0x6')][_0xbb8c('0x7')]=function(){var _0x4e988e=this;return function(_0xb69ad4){if(_0xb69ad4){freeIsNotKey(_0xb69ad4,_0x4e988e[_0xbb8c('0x2')],'id');for(var _0x38627b=0x0,_0x175825={},_0x48cd68={};_0x38627b<_0xb69ad4[_0xbb8c('0x8')];_0x38627b+=0x1){_0x175825=_0xb69ad4[_0x38627b];if(_[_0xbb8c('0x9')](_0x4e988e[_0xbb8c('0x2')][_0x175825['id']])){_0x4e988e['mailAccounts'][_0x175825['id']]=new MailAccount(_0x175825);}else{_[_0xbb8c('0xa')](_0x4e988e[_0xbb8c('0x2')][_0x175825['id']],_0x175825);}}}return _0x4e988e[_0xbb8c('0x2')];};};module[_0xbb8c('0xb')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1b2c357..90c19b6 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 _0xe3da=['getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp'];(function(_0x2d82d6,_0xf444e){var _0x163259=function(_0x14988f){while(--_0x14988f){_0x2d82d6['push'](_0x2d82d6['shift']());}};_0x163259(++_0xf444e);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xae3d('0x0'));exports[_0xae3d('0x1')]=function(){return function(){return client[_0xae3d('0x2')](_0xae3d('0x3'),{'options':{'attributes':['id',_0xae3d('0x4'),_0xae3d('0x5'),_0xae3d('0x6'),_0xae3d('0x7'),_0xae3d('0x8'),_0xae3d('0x9'),_0xae3d('0xa')],'raw':![],'include':[{'model':_0xae3d('0xb'),'as':_0xae3d('0xc')},{'model':_0xae3d('0xd'),'as':_0xae3d('0xe')}]},'log':_0xae3d('0xf')});};};exports['notify']=function(_0x2a5c45,_0x3d6650){return client['Request']('NotifyMailAccount',{'account':{'id':_0x2a5c45},'body':_0x3d6650,'log':_0xae3d('0x10')});}; \ No newline at end of file +var _0x9f89=['Request','NotifyMailAccount','getMailAccounts','GetMailAccount','name','service','email','active','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount'];(function(_0x43b617,_0x5a875a){var _0x430419=function(_0x4c26e2){while(--_0x4c26e2){_0x43b617['push'](_0x43b617['shift']());}};_0x430419(++_0x5a875a);}(_0x9f89,0x13d));var _0x99f8=function(_0xafa99c,_0x45daf6){_0xafa99c=_0xafa99c-0x0;var _0x206199=_0x9f89[_0xafa99c];return _0x206199;};'use strict';var client=require('../client');exports[_0x99f8('0x0')]=function(){return function(){return client['Request'](_0x99f8('0x1'),{'options':{'attributes':['id',_0x99f8('0x2'),_0x99f8('0x3'),_0x99f8('0x4'),_0x99f8('0x5'),'key',_0x99f8('0x6'),_0x99f8('0x7')],'raw':![],'include':[{'model':_0x99f8('0x8'),'as':_0x99f8('0x9')},{'model':_0x99f8('0xa'),'as':_0x99f8('0xb')}]},'log':_0x99f8('0xc')});};};exports['notify']=function(_0x22c84d,_0x21524b){return client[_0x99f8('0xd')](_0x99f8('0xe'),{'account':{'id':_0x22c84d},'body':_0x21524b,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index fd9eeeb..56e4fb9 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 _0x277a=['GetSettings','../client','ShowSetting','loginMailFrequency'];(function(_0x1d1099,_0x344928){var _0x5e6fed=function(_0x5edddf){while(--_0x5edddf){_0x1d1099['push'](_0x1d1099['shift']());}};_0x5e6fed(++_0x344928);}(_0x277a,0x195));var _0xa277=function(_0x4cff04,_0x538b48){_0x4cff04=_0x4cff04-0x0;var _0x4d799a=_0x277a[_0x4cff04];return _0x4d799a;};'use strict';var client=require(_0xa277('0x0'));exports['getSettings']=function(){return client['Request'](_0xa277('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa277('0x2')]},'log':_0xa277('0x3')});}; \ No newline at end of file +var _0xf0e0=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x24b897,_0x38df26){var _0x522698=function(_0x1757a3){while(--_0x1757a3){_0x24b897['push'](_0x24b897['shift']());}};_0x522698(++_0x38df26);}(_0xf0e0,0x13a));var _0x0f0e=function(_0x3dbc0c,_0x5ad8c6){_0x3dbc0c=_0x3dbc0c-0x0;var _0x4d4133=_0xf0e0[_0x3dbc0c];return _0x4d4133;};'use strict';var client=require(_0x0f0e('0x0'));exports[_0x0f0e('0x1')]=function(){return client[_0x0f0e('0x2')](_0x0f0e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0f0e('0x4')]},'log':_0x0f0e('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 82ae184..6256d51 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 b367271..b64fd9e 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 _0x809e=['ioredis','../../config/environment','createServer','timeout','listen','socket.io','polling','defaults','localhost','adapter','redis','../../config/triggers','default','../../config/socketio','../../routes','listening','log','lodash','http','express','sticky-session'];(function(_0x392b1a,_0xdb0a18){var _0xad6360=function(_0x59212b){while(--_0x59212b){_0x392b1a['push'](_0x392b1a['shift']());}};_0xad6360(++_0xdb0a18);}(_0x809e,0x18b));var _0xe809=function(_0x33804e,_0x231b0c){_0x33804e=_0x33804e-0x0;var _0x1bf721=_0x809e[_0x33804e];return _0x1bf721;};'use strict';var _=require(_0xe809('0x0'));var http=require(_0xe809('0x1'));var express=require(_0xe809('0x2'));var sticky=require(_0xe809('0x3'));var Redis=require(_0xe809('0x4'));var config=require(_0xe809('0x5'));var app=express();var server=http[_0xe809('0x6')](app);server[_0xe809('0x7')]=0xdbba0;if(sticky[_0xe809('0x8')](server,config['port'])){var socketio=require(_0xe809('0x9'))(server,{'transports':['websocket',_0xe809('0xa')]});config['redis']=_[_0xe809('0xb')](config['redis'],{'host':_0xe809('0xc'),'port':0x18eb});socketio[_0xe809('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0xe809('0xe')]),'subClient':new Redis(config[_0xe809('0xe')])}));require(_0xe809('0xf'))[_0xe809('0x10')]();require(_0xe809('0x11'))[_0xe809('0x10')](socketio);require('../../config/express')[_0xe809('0x10')](app);require(_0xe809('0x12'))['default'](app);}else{server['once'](_0xe809('0x13'),function(){console[_0xe809('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x4194=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','localhost','default','../../config/socketio','../../config/express','once','listening','log'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x4194,0xde));var _0x4419=function(_0x54b01e,_0x3bf2b6){_0x54b01e=_0x54b01e-0x0;var _0x5ae0c2=_0x4194[_0x54b01e];return _0x5ae0c2;};'use strict';var _=require(_0x4419('0x0'));var http=require(_0x4419('0x1'));var express=require('express');var sticky=require(_0x4419('0x2'));var Redis=require(_0x4419('0x3'));var config=require(_0x4419('0x4'));var app=express();var server=http[_0x4419('0x5')](app);server[_0x4419('0x6')]=0xdbba0;if(sticky[_0x4419('0x7')](server,config[_0x4419('0x8')])){var socketio=require(_0x4419('0x9'))(server,{'transports':['websocket',_0x4419('0xa')]});config[_0x4419('0xb')]=_[_0x4419('0xc')](config[_0x4419('0xb')],{'host':_0x4419('0xd'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x4419('0xb')])}));require('../../config/triggers')[_0x4419('0xe')]();require(_0x4419('0xf'))[_0x4419('0xe')](socketio);require(_0x4419('0x10'))[_0x4419('0xe')](app);require('../../routes')[_0x4419('0xe')](app);}else{server[_0x4419('0x11')](_0x4419('0x12'),function(){console[_0x4419('0x13')](_0x4419('0x14'),config[_0x4419('0x8')]);});}exports=module[_0x4419('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index bbac3b4..844a55d 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 _0xb1a0=['../../config/logger','routing','Request','request','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x80a31c,_0x5e341e){var _0x10557c=function(_0x280727){while(--_0x280727){_0x80a31c['push'](_0x80a31c['shift']());}};_0x10557c(++_0x5e341e);}(_0xb1a0,0x1df));var _0x0b1a=function(_0x1ec622,_0x37fbcf){_0x1ec622=_0x1ec622-0x0;var _0x3f8883=_0xb1a0[_0x1ec622];return _0x3f8883;};'use strict';var jayson=require(_0x0b1a('0x0'));var BPromise=require(_0x0b1a('0x1'));var logger=require(_0x0b1a('0x2'))(_0x0b1a('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x0b1a('0x4')]=function(_0xee3db9,_0x11c57e){return new BPromise(function(_0x1d3992,_0x312c6b){return client[_0x0b1a('0x5')](_0xee3db9,_0x11c57e)[_0x0b1a('0x6')](function(_0x28d86f){logger['debug'](_0x0b1a('0x7'),_0x0b1a('0x3'),_0xee3db9,_0x11c57e,_0x28d86f);if(_0x28d86f[_0x0b1a('0x8')]){logger[_0x0b1a('0x8')]('rpc',_0x0b1a('0x3'),_0xee3db9,_0x28d86f[_0x0b1a('0x8')][_0x0b1a('0x9')],_0x11c57e);return _0x312c6b(_0x28d86f[_0x0b1a('0x8')]['message']);}else{return _0x1d3992(_0x28d86f[_0x0b1a('0xa')]);}})[_0x0b1a('0xb')](function(_0x124ab6){logger['error'](_0x0b1a('0x7'),'routing',_0xee3db9,_0x124ab6,_0x11c57e);return _0x312c6b(_0x124ab6);});});};module[_0x0b1a('0xc')]=client; \ No newline at end of file +var _0xf9e2=['routing','client','http','Request','then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger'];(function(_0x50fd9d,_0x18d38b){var _0x5ac73f=function(_0x450524){while(--_0x450524){_0x50fd9d['push'](_0x50fd9d['shift']());}};_0x5ac73f(++_0x18d38b);}(_0xf9e2,0x1be));var _0x2f9e=function(_0x35f7cc,_0x519c54){_0x35f7cc=_0x35f7cc-0x0;var _0x3f70a8=_0xf9e2[_0x35f7cc];return _0x3f70a8;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2f9e('0x0'));var logger=require(_0x2f9e('0x1'))(_0x2f9e('0x2'));var client=jayson[_0x2f9e('0x3')][_0x2f9e('0x4')]({'port':0x2329});client[_0x2f9e('0x5')]=function(_0x344b4a,_0x24b4c9){return new BPromise(function(_0x99452c,_0x56b03c){return client['request'](_0x344b4a,_0x24b4c9)[_0x2f9e('0x6')](function(_0x56ce6d){logger[_0x2f9e('0x7')](_0x2f9e('0x8'),_0x2f9e('0x2'),_0x344b4a,_0x24b4c9,_0x56ce6d);if(_0x56ce6d[_0x2f9e('0x9')]){logger['error']('rpc','routing',_0x344b4a,_0x56ce6d[_0x2f9e('0x9')][_0x2f9e('0xa')],_0x24b4c9);return _0x56b03c(_0x56ce6d[_0x2f9e('0x9')][_0x2f9e('0xa')]);}else{return _0x99452c(_0x56ce6d[_0x2f9e('0xb')]);}})[_0x2f9e('0xc')](function(_0x2ba4c){logger[_0x2f9e('0x9')](_0x2f9e('0x8'),'routing',_0x344b4a,_0x2ba4c,_0x24b4c9);return _0x56b03c(_0x2ba4c);});});};module[_0x2f9e('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d6fa849..0d0a55e 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 _0xd03d=['getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x396f59,_0x466f03){var _0x19251e=function(_0x42d40b){while(--_0x42d40b){_0x396f59['push'](_0x396f59['shift']());}};_0x19251e(++_0x466f03);}(_0xd03d,0x190));var _0xdd03=function(_0x33a2ce,_0x56f751){_0x33a2ce=_0x33a2ce-0x0;var _0x3fccd7=_0xd03d[_0x33a2ce];return _0x3fccd7;};'use strict';var BPromise=require('bluebird');var server=require(_0xdd03('0x0'));var Realtime=require(_0xdd03('0x1'));var user=require(_0xdd03('0x2'));var interval=require(_0xdd03('0x3'));var openchannelQueue=require(_0xdd03('0x4'));var chatQueue=require(_0xdd03('0x5'));var smsQueue=require(_0xdd03('0x6'));var mailQueue=require(_0xdd03('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xdd03('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xdd03('0x9')]()[_0xdd03('0xa')](user['getAgents']())[_0xdd03('0xa')](realtime['initAgents']())[_0xdd03('0xa')](interval[_0xdd03('0xb')]())[_0xdd03('0xa')](realtime['initIntervals']())[_0xdd03('0xa')](openchannelQueue[_0xdd03('0xc')]())[_0xdd03('0xa')](realtime[_0xdd03('0xd')]())[_0xdd03('0xa')](chatQueue[_0xdd03('0xe')]())[_0xdd03('0xa')](realtime[_0xdd03('0xf')]())['then'](smsQueue[_0xdd03('0x10')]())[_0xdd03('0xa')](realtime[_0xdd03('0x11')]())[_0xdd03('0xa')](mailQueue[_0xdd03('0x12')]())[_0xdd03('0xa')](realtime[_0xdd03('0x13')]())[_0xdd03('0xa')](faxQueue[_0xdd03('0x14')]())['then'](realtime[_0xdd03('0x15')]())['then'](whatsappQueue[_0xdd03('0x16')]())[_0xdd03('0xa')](realtime[_0xdd03('0x17')]())[_0xdd03('0xa')](function(){return realtime;});}function main(){return server[_0xdd03('0x18')](realtime)[_0xdd03('0xa')](function(_0x217f2d){return initRealtime();})['then'](function(_0x157e0b){return setInterval(initRealtime,0x1388);})[_0xdd03('0x19')](function(_0x528511){console['log'](_0x528511);});}main(); \ No newline at end of file +var _0x0b7b=['initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','then','initAgents','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues'];(function(_0x1cc98e,_0x5b6f77){var _0x1aa22d=function(_0x1c4315){while(--_0x1c4315){_0x1cc98e['push'](_0x1cc98e['shift']());}};_0x1aa22d(++_0x5b6f77);}(_0x0b7b,0x130));var _0xb0b7=function(_0x3bf4f0,_0x316456){_0x3bf4f0=_0x3bf4f0-0x0;var _0x2c6a5c=_0x0b7b[_0x3bf4f0];return _0x2c6a5c;};'use strict';var BPromise=require(_0xb0b7('0x0'));var server=require(_0xb0b7('0x1'));var Realtime=require(_0xb0b7('0x2'));var user=require(_0xb0b7('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xb0b7('0x4'));var chatQueue=require(_0xb0b7('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xb0b7('0x6'));var faxQueue=require(_0xb0b7('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xb0b7('0x8')](user['getAgents']())[_0xb0b7('0x8')](realtime[_0xb0b7('0x9')]())['then'](interval['getIntervals']())[_0xb0b7('0x8')](realtime['initIntervals']())[_0xb0b7('0x8')](openchannelQueue[_0xb0b7('0xa')]())[_0xb0b7('0x8')](realtime['initOpenchannelQueues']())[_0xb0b7('0x8')](chatQueue[_0xb0b7('0xb')]())[_0xb0b7('0x8')](realtime[_0xb0b7('0xc')]())['then'](smsQueue[_0xb0b7('0xd')]())[_0xb0b7('0x8')](realtime[_0xb0b7('0xe')]())[_0xb0b7('0x8')](mailQueue[_0xb0b7('0xf')]())[_0xb0b7('0x8')](realtime[_0xb0b7('0x10')]())[_0xb0b7('0x8')](faxQueue[_0xb0b7('0x11')]())[_0xb0b7('0x8')](realtime[_0xb0b7('0x12')]())['then'](whatsappQueue[_0xb0b7('0x13')]())[_0xb0b7('0x8')](realtime['initWhatsappQueues']())[_0xb0b7('0x8')](function(){return realtime;});}function main(){return server[_0xb0b7('0x14')](realtime)[_0xb0b7('0x8')](function(_0x38d142){return initRealtime();})['then'](function(_0x222733){return setInterval(initRealtime,0x1388);})[_0xb0b7('0x15')](function(_0xa48192){console[_0xb0b7('0x16')](_0xa48192);});}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 d91263b..9d9192b 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4d3b39,_0x4ec5ad){var _0x3f92ca=function(_0x155efa){while(--_0x155efa){_0x4d3b39['push'](_0x4d3b39['shift']());}};_0x3f92ca(++_0x4ec5ad);}(_0x326f,0xd1));var _0xf326=function(_0x28cf09,_0x22a09c){_0x28cf09=_0x28cf09-0x0;var _0x3ae488=_0x326f[_0x28cf09];return _0x3ae488;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};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(_0x34f3d4,_0x5ae214){var _0x17f899=function(_0x14a5a2){while(--_0x14a5a2){_0x34f3d4['push'](_0x34f3d4['shift']());}};_0x17f899(++_0x5ae214);}(_0x814b,0x1a2));var _0xb814=function(_0x46bec2,_0x36cde0){_0x46bec2=_0x46bec2-0x0;var _0x39b857=_0x814b[_0x46bec2];return _0x39b857;};'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 3bfa1c2..7cc8cc7 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 _0xa2a0=['then','error','result','SendMail','bluebird','jayson/promise','client','request'];(function(_0x19da45,_0x31c75a){var _0xf28a6c=function(_0x4d0320){while(--_0x4d0320){_0x19da45['push'](_0x19da45['shift']());}};_0xf28a6c(++_0x31c75a);}(_0xa2a0,0x104));var _0x0a2a=function(_0x485022,_0xef3922){_0x485022=_0x485022-0x0;var _0x1a6ef5=_0xa2a0[_0x485022];return _0x1a6ef5;};'use strict';var BPromise=require(_0x0a2a('0x0'));var jayson=require(_0x0a2a('0x1'));var client=jayson[_0x0a2a('0x2')]['http']({'port':0x232b});function request(_0x3b64b3,_0x1a0781){return new BPromise(function(_0x225f3d,_0x4a14ec){return client[_0x0a2a('0x3')](_0x3b64b3,_0x1a0781)[_0x0a2a('0x4')](function(_0x2fe593){if(_0x2fe593[_0x0a2a('0x5')]){return _0x4a14ec(_0x2fe593['error']['message']);}else{return _0x225f3d(_0x2fe593[_0x0a2a('0x6')]);}})['catch'](function(_0x578dbe){return _0x4a14ec(_0x578dbe);});});}exports['sendMailMessage']=function(_0x532ba1,_0x54a611){return request(_0x0a2a('0x7'),{'account':_0x532ba1,'message':_0x54a611});}; \ No newline at end of file +var _0x24b2=['bluebird','jayson/promise','client','request','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x1d8c86,_0x35919a){var _0x47c8a5=function(_0x39346d){while(--_0x39346d){_0x1d8c86['push'](_0x1d8c86['shift']());}};_0x47c8a5(++_0x35919a);}(_0x24b2,0x1b8));var _0x224b=function(_0x45411b,_0x4921e7){_0x45411b=_0x45411b-0x0;var _0x1b9a67=_0x24b2[_0x45411b];return _0x1b9a67;};'use strict';var BPromise=require(_0x224b('0x0'));var jayson=require(_0x224b('0x1'));var client=jayson[_0x224b('0x2')]['http']({'port':0x232b});function request(_0x90c2c4,_0x23a3e9){return new BPromise(function(_0x53c056,_0x3529c8){return client[_0x224b('0x3')](_0x90c2c4,_0x23a3e9)[_0x224b('0x4')](function(_0x44a481){if(_0x44a481[_0x224b('0x5')]){return _0x3529c8(_0x44a481[_0x224b('0x5')][_0x224b('0x6')]);}else{return _0x53c056(_0x44a481[_0x224b('0x7')]);}})[_0x224b('0x8')](function(_0x24a629){return _0x3529c8(_0x24a629);});});}exports[_0x224b('0x9')]=function(_0x24ae01,_0x2a6198){return request(_0x224b('0xa'),{'account':_0x24ae01,'message':_0x2a6198});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index d0c39cb..5708f35 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 _0x28f2=['smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','fax','sms','whatsapp','Status','format','chatStatusTime','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x28f2,0x193));var _0x228f=function(_0x5a3116,_0x1759fe){_0x5a3116=_0x5a3116-0x0;var _0x84f35c=_0x28f2[_0x5a3116];return _0x84f35c;};'use strict';var _=require(_0x228f('0x0'));var moment=require(_0x228f('0x1'));var md5=require(_0x228f('0x2'));var Redis=require(_0x228f('0x3'));var config=require(_0x228f('0x4'));config['redis']=_[_0x228f('0x5')](config[_0x228f('0x6')],{'host':_0x228f('0x7'),'port':0x18eb});var io=require(_0x228f('0x8'))(new Redis(config[_0x228f('0x6')]));function Agent(_0x3439f5){this['id']=_0x3439f5['id']||0x0;this[_0x228f('0x9')]=_0x3439f5['name']||'';this[_0x228f('0xa')]=_0x3439f5['online']||!![];this[_0x228f('0xb')]=_0x3439f5[_0x228f('0xb')]||![];this[_0x228f('0xc')]=_0x3439f5['chatPause']||![];this[_0x228f('0xd')]=_0x3439f5['mailPause']||![];this[_0x228f('0xe')]=_0x3439f5[_0x228f('0xe')]||![];this['smsPause']=_0x3439f5[_0x228f('0xf')]||![];this[_0x228f('0x10')]=_0x3439f5[_0x228f('0x10')]||![];this[_0x228f('0x11')]=_0x228f('0x12');this['chatStatusTime']=0x0;this[_0x228f('0x13')]=_0x3439f5[_0x228f('0x13')]||0x0;this[_0x228f('0x14')]=0x0;this[_0x228f('0x15')]=_0x228f('0x12');this[_0x228f('0x16')]=0x0;this[_0x228f('0x17')]=_0x3439f5[_0x228f('0x17')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x228f('0x18')]=_0x228f('0x12');this[_0x228f('0x19')]=0x0;this[_0x228f('0x1a')]=_0x3439f5[_0x228f('0x1a')]||0x0;this[_0x228f('0x1b')]=0x0;this[_0x228f('0x1c')]='unknown';this[_0x228f('0x1d')]=0x0;this['smsCapacity']=_0x3439f5[_0x228f('0x1e')]||0x0;this[_0x228f('0x1f')]=0x0;this[_0x228f('0x20')]='unknown';this[_0x228f('0x21')]=0x0;this['whatsappCapacity']=_0x3439f5[_0x228f('0x22')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x228f('0x23')]='unknown';this['openchannelStatusTime']=0x0;this[_0x228f('0x24')]=_0x3439f5['openchannelCapacity']||0x0;this[_0x228f('0x25')]=0x0;this[_0x228f('0x26')]=![];this[_0x228f('0x27')]=undefined;this[_0x228f('0x2')]='';this[_0x228f('0x28')]();}Agent[_0x228f('0x29')][_0x228f('0x2a')]=function(_0x3f7b96){if(this[_0x3f7b96+_0x228f('0x2b')]>0x0){if(this[_0x3f7b96+'Capacity']>0x0&&this[_0x3f7b96+_0x228f('0x2b')]>=this[_0x3f7b96+_0x228f('0x2c')]){return _0x228f('0x2d');}else{return _0x228f('0x2e');}}else{return _0x228f('0x2f');}};Agent[_0x228f('0x29')][_0x228f('0x28')]=function(){var _0x20c111=[_0x228f('0x30'),'chat',_0x228f('0x31'),_0x228f('0x32'),_0x228f('0x33'),_0x228f('0x34')];for(var _0x3036d4=0x0;_0x3036d4<_0x20c111['length'];_0x3036d4+=0x1){var _0xe8aac=this['getChannelStatus'](_0x20c111[_0x3036d4]);if(this[_0x20c111[_0x3036d4]+_0x228f('0x35')]!==_0xe8aac){this[_0x20c111[_0x3036d4]+'StatusTime']=_['toNumber'](moment()[_0x228f('0x36')]('x'));}this[_0x20c111[_0x3036d4]+_0x228f('0x35')]=_0xe8aac;}var _0x2a7842={'id':this['id'],'name':this[_0x228f('0x9')],'online':this[_0x228f('0xa')],'voicePause':this[_0x228f('0xb')],'chatPause':this[_0x228f('0xc')],'mailPause':this[_0x228f('0xd')],'smsPause':this[_0x228f('0xf')],'faxPause':this[_0x228f('0xe')],'openchannelPause':this[_0x228f('0x10')],'chatStatus':this[_0x228f('0x11')],'chatStatusTime':this[_0x228f('0x37')],'chatCapacity':this[_0x228f('0x13')],'chatCurrentCapacity':this[_0x228f('0x14')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x228f('0x16')],'mailCapacity':this[_0x228f('0x17')],'mailCurrentCapacity':this[_0x228f('0x38')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x228f('0x19')],'faxCapacity':this[_0x228f('0x1a')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x228f('0x1c')],'smsStatusTime':this[_0x228f('0x1d')],'smsCapacity':this[_0x228f('0x1e')],'smsCurrentCapacity':this[_0x228f('0x1f')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x228f('0x21')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x228f('0x39')],'openchannelStatus':this[_0x228f('0x23')],'openchannelStatusTime':this[_0x228f('0x3a')],'openchannelCapacity':this[_0x228f('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x228f('0x26')],'busyQueue':this[_0x228f('0x27')]};var _0x58dc0c=md5(JSON['stringify'](_0x2a7842));if(this['md5']!==_0x58dc0c){this[_0x228f('0x2')]=_0x58dc0c;io[_0x228f('0x3b')](_0x228f('0x3c'),_0x2a7842);}};module[_0x228f('0x3d')]=Agent; \ No newline at end of file +var _0x5e0e=['mail','chat','openchannel','fax','sms','Status','StatusTime','toNumber','mailPause','mailStatus','faxCurrentCapacity','smsStatusTime','whatsappStatusTime','openchannelStatusTime','stringify','emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime'];(function(_0xe4cc01,_0x2dc0a4){var _0x1332f8=function(_0x18ce1f){while(--_0x18ce1f){_0xe4cc01['push'](_0xe4cc01['shift']());}};_0x1332f8(++_0x2dc0a4);}(_0x5e0e,0x1c3));var _0xe5e0=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0x5e0e[_0x17ebae];return _0x8cbe7d;};'use strict';var _=require(_0xe5e0('0x0'));var moment=require(_0xe5e0('0x1'));var md5=require(_0xe5e0('0x2'));var Redis=require(_0xe5e0('0x3'));var config=require(_0xe5e0('0x4'));config[_0xe5e0('0x5')]=_[_0xe5e0('0x6')](config[_0xe5e0('0x5')],{'host':_0xe5e0('0x7'),'port':0x18eb});var io=require(_0xe5e0('0x8'))(new Redis(config[_0xe5e0('0x5')]));function Agent(_0x45a9a8){this['id']=_0x45a9a8['id']||0x0;this[_0xe5e0('0x9')]=_0x45a9a8['name']||'';this[_0xe5e0('0xa')]=_0x45a9a8[_0xe5e0('0xa')]||!![];this[_0xe5e0('0xb')]=_0x45a9a8[_0xe5e0('0xb')]||![];this[_0xe5e0('0xc')]=_0x45a9a8[_0xe5e0('0xc')]||![];this['mailPause']=_0x45a9a8['mailPause']||![];this[_0xe5e0('0xd')]=_0x45a9a8[_0xe5e0('0xd')]||![];this[_0xe5e0('0xe')]=_0x45a9a8[_0xe5e0('0xe')]||![];this[_0xe5e0('0xf')]=_0x45a9a8[_0xe5e0('0xf')]||![];this[_0xe5e0('0x10')]=_0xe5e0('0x11');this[_0xe5e0('0x12')]=0x0;this[_0xe5e0('0x13')]=_0x45a9a8[_0xe5e0('0x13')]||0x0;this[_0xe5e0('0x14')]=0x0;this['mailStatus']='unknown';this[_0xe5e0('0x15')]=0x0;this['mailCapacity']=_0x45a9a8[_0xe5e0('0x16')]||0x0;this[_0xe5e0('0x17')]=0x0;this[_0xe5e0('0x18')]=_0xe5e0('0x11');this[_0xe5e0('0x19')]=0x0;this[_0xe5e0('0x1a')]=_0x45a9a8[_0xe5e0('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xe5e0('0x1b')]=_0xe5e0('0x11');this['smsStatusTime']=0x0;this[_0xe5e0('0x1c')]=_0x45a9a8[_0xe5e0('0x1c')]||0x0;this[_0xe5e0('0x1d')]=0x0;this[_0xe5e0('0x1e')]=_0xe5e0('0x11');this['whatsappStatusTime']=0x0;this[_0xe5e0('0x1f')]=_0x45a9a8[_0xe5e0('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xe5e0('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0xe5e0('0x21')]=_0x45a9a8[_0xe5e0('0x21')]||0x0;this[_0xe5e0('0x22')]=0x0;this[_0xe5e0('0x23')]=![];this[_0xe5e0('0x24')]=undefined;this[_0xe5e0('0x2')]='';this['updateRealtime']();}Agent[_0xe5e0('0x25')][_0xe5e0('0x26')]=function(_0x511ec4){if(this[_0x511ec4+_0xe5e0('0x27')]>0x0){if(this[_0x511ec4+_0xe5e0('0x28')]>0x0&&this[_0x511ec4+_0xe5e0('0x27')]>=this[_0x511ec4+_0xe5e0('0x28')]){return _0xe5e0('0x29');}else{return _0xe5e0('0x2a');}}else{return _0xe5e0('0x2b');}};Agent[_0xe5e0('0x25')][_0xe5e0('0x2c')]=function(){var _0x2555b7=[_0xe5e0('0x2d'),_0xe5e0('0x2e'),_0xe5e0('0x2f'),_0xe5e0('0x30'),_0xe5e0('0x31'),'whatsapp'];for(var _0x2f7eae=0x0;_0x2f7eae<_0x2555b7['length'];_0x2f7eae+=0x1){var _0x37d0d7=this['getChannelStatus'](_0x2555b7[_0x2f7eae]);if(this[_0x2555b7[_0x2f7eae]+_0xe5e0('0x32')]!==_0x37d0d7){this[_0x2555b7[_0x2f7eae]+_0xe5e0('0x33')]=_[_0xe5e0('0x34')](moment()['format']('x'));}this[_0x2555b7[_0x2f7eae]+_0xe5e0('0x32')]=_0x37d0d7;}var _0x5b86b8={'id':this['id'],'name':this[_0xe5e0('0x9')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xe5e0('0xc')],'mailPause':this[_0xe5e0('0x35')],'smsPause':this[_0xe5e0('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xe5e0('0xf')],'chatStatus':this[_0xe5e0('0x10')],'chatStatusTime':this[_0xe5e0('0x12')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe5e0('0x14')],'mailStatus':this[_0xe5e0('0x36')],'mailStatusTime':this[_0xe5e0('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xe5e0('0x18')],'faxStatusTime':this[_0xe5e0('0x19')],'faxCapacity':this[_0xe5e0('0x1a')],'faxCurrentCapacity':this[_0xe5e0('0x37')],'smsStatus':this[_0xe5e0('0x1b')],'smsStatusTime':this[_0xe5e0('0x38')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xe5e0('0x1e')],'whatsappStatusTime':this[_0xe5e0('0x39')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xe5e0('0x20')],'openchannelStatusTime':this[_0xe5e0('0x3a')],'openchannelCapacity':this[_0xe5e0('0x21')],'openchannelCurrentCapacity':this[_0xe5e0('0x22')],'busy':this[_0xe5e0('0x23')],'busyQueue':this[_0xe5e0('0x24')]};var _0x3c5c70=md5(JSON[_0xe5e0('0x3b')](_0x5b86b8));if(this[_0xe5e0('0x2')]!==_0x3c5c70){this[_0xe5e0('0x2')]=_0x3c5c70;io[_0xe5e0('0x3c')](_0xe5e0('0x3d'),_0x5b86b8);}};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 e81f1af..ae6ac74 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 _0x9801=['online','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length'];(function(_0xf54a87,_0x3c068b){var _0x1f1ac6=function(_0x17a314){while(--_0x17a314){_0xf54a87['push'](_0xf54a87['shift']());}};_0x1f1ac6(++_0x3c068b);}(_0x9801,0x1c7));var _0x1980=function(_0x5a6e8a,_0x52719a){_0x5a6e8a=_0x5a6e8a-0x0;var _0x3d989b=_0x9801[_0x5a6e8a];return _0x3d989b;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1980('0x0'));var Redis=require(_0x1980('0x1'));var config=require(_0x1980('0x2'));config[_0x1980('0x3')]=_[_0x1980('0x4')](config['redis'],{'host':_0x1980('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x109957){this['id']=_0x109957['id']||0x0;this[_0x1980('0x6')]=_0x109957[_0x1980('0x6')]||'';this[_0x1980('0x7')]=_0x109957[_0x1980('0x7')]||0xa;this['strategy']=_0x109957['strategy']||_0x1980('0x8');this[_0x1980('0x9')]=_0x109957[_0x1980('0x9')];this[_0x1980('0xa')]={};this[_0x1980('0xb')]=0x0;this[_0x1980('0xc')]='';this[_0x1980('0xd')]();this['updateRealtime']();}ChatQueue[_0x1980('0xe')][_0x1980('0xd')]=function(){var _0x1ab9cc=this[_0x1980('0xa')][_0x1980('0xf')];this['mapAgentsId']=_[_0x1980('0x10')](this['Agents'],'id');this[_0x1980('0xa')][_0x1980('0xf')]=_0x1ab9cc;};ChatQueue[_0x1980('0xe')][_0x1980('0x11')]=function(){this[_0x1980('0x12')]=0x0;this[_0x1980('0x13')]=0x0;for(var _0xc799ed=0x0;_0xc799ed=0x0?this['available']:0x0;var _0x16dffd={'id':this['id'],'available':this[_0x1980('0x16')],'loggedIn':this[_0x1980('0x12')],'name':this[_0x1980('0x6')],'paused':this[_0x1980('0x13')],'waiting':this[_0x1980('0xb')]};var _0x5e7134=md5(JSON[_0x1980('0x17')](_0x16dffd));if(this[_0x1980('0xc')]!==_0x5e7134){this['md5']=_0x5e7134;io['to'](util['format'](_0x1980('0x18'),_0x16dffd[_0x1980('0x6')]))[_0x1980('0x19')](_0x1980('0x1a'),_0x16dffd);}};module[_0x1980('0x1b')]=ChatQueue; \ No newline at end of file +var _0x9386=['updateRealtime','updateRouting','_rr','map','loggedIn','online','chatPause','paused','available','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x5157a8,_0x4baf68){var _0x1f7119=function(_0x221ebe){while(--_0x221ebe){_0x5157a8['push'](_0x5157a8['shift']());}};_0x1f7119(++_0x4baf68);}(_0x9386,0x99));var _0x6938=function(_0x17f3ff,_0x52aca7){_0x17f3ff=_0x17f3ff-0x0;var _0xcf4709=_0x9386[_0x17f3ff];return _0xcf4709;};'use strict';var _=require(_0x6938('0x0'));var md5=require(_0x6938('0x1'));var util=require('util');var Redis=require(_0x6938('0x2'));var config=require(_0x6938('0x3'));config[_0x6938('0x4')]=_[_0x6938('0x5')](config['redis'],{'host':_0x6938('0x6'),'port':0x18eb});var io=require(_0x6938('0x7'))(new Redis(config[_0x6938('0x4')]));function ChatQueue(_0x3f6498){this['id']=_0x3f6498['id']||0x0;this[_0x6938('0x8')]=_0x3f6498[_0x6938('0x8')]||'';this[_0x6938('0x9')]=_0x3f6498[_0x6938('0x9')]||0xa;this[_0x6938('0xa')]=_0x3f6498[_0x6938('0xa')]||_0x6938('0xb');this[_0x6938('0xc')]=_0x3f6498[_0x6938('0xc')];this[_0x6938('0xd')]={};this[_0x6938('0xe')]=0x0;this[_0x6938('0x1')]='';this['updateRouting']();this[_0x6938('0xf')]();}ChatQueue['prototype'][_0x6938('0x10')]=function(){var _0x51ec38=this['mapAgentsId'][_0x6938('0x11')];this[_0x6938('0xd')]=_[_0x6938('0x12')](this['Agents'],'id');this[_0x6938('0xd')]['_rr']=_0x51ec38;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x6938('0x13')]=0x0;this['paused']=0x0;for(var _0x38f64a=0x0;_0x38f64a=0x0?this[_0x6938('0x17')]:0x0;var _0x5615e6={'id':this['id'],'available':this[_0x6938('0x17')],'loggedIn':this[_0x6938('0x13')],'name':this[_0x6938('0x8')],'paused':this[_0x6938('0x16')],'waiting':this[_0x6938('0xe')]};var _0x31ac19=md5(JSON['stringify'](_0x5615e6));if(this['md5']!==_0x31ac19){this[_0x6938('0x1')]=_0x31ac19;io['to'](util[_0x6938('0x18')](_0x6938('0x19'),_0x5615e6['name']))['emit'](_0x6938('0x1a'),_0x5615e6);}};module[_0x6938('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1b03d79..8f85be7 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 _0xef4a=['ioredis','../../../config/environment','redis','defaults','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','md5','format','fax:queue:%s','emit','fax_queue:save','exports','util'];(function(_0x4bcd02,_0x401b12){var _0x4696eb=function(_0x35a989){while(--_0x35a989){_0x4bcd02['push'](_0x4bcd02['shift']());}};_0x4696eb(++_0x401b12);}(_0xef4a,0xc3));var _0xaef4=function(_0x345555,_0x55948f){_0x345555=_0x345555-0x0;var _0x2c03e8=_0xef4a[_0x345555];return _0x2c03e8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xaef4('0x0'));var Redis=require(_0xaef4('0x1'));var config=require(_0xaef4('0x2'));config[_0xaef4('0x3')]=_[_0xaef4('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaef4('0x3')]));function FaxQueue(_0x1e409a){this['id']=_0x1e409a['id']||0x0;this[_0xaef4('0x5')]=_0x1e409a[_0xaef4('0x5')]||'';this[_0xaef4('0x6')]=_0x1e409a['timeout']||0xa;this['strategy']=_0x1e409a['strategy']||'beepall';this[_0xaef4('0x7')]=_0x1e409a[_0xaef4('0x7')];this[_0xaef4('0x8')]={};this[_0xaef4('0x9')]=0x0;this['md5']='';this[_0xaef4('0xa')]();this[_0xaef4('0xb')]();}FaxQueue[_0xaef4('0xc')][_0xaef4('0xa')]=function(){var _0xa02e0=this['mapAgentsId'][_0xaef4('0xd')];this[_0xaef4('0x8')]=_[_0xaef4('0xe')](this[_0xaef4('0x7')],'id');this['mapAgentsId'][_0xaef4('0xd')]=_0xa02e0;};FaxQueue[_0xaef4('0xc')][_0xaef4('0xb')]=function(){this[_0xaef4('0xf')]=0x0;this[_0xaef4('0x10')]=0x0;for(var _0x41001f=0x0;_0x41001f=0x0?this[_0xaef4('0x14')]:0x0;var _0x5a4fc4={'id':this['id'],'available':this[_0xaef4('0x14')],'loggedIn':this[_0xaef4('0xf')],'name':this[_0xaef4('0x5')],'paused':this[_0xaef4('0x10')],'waiting':this[_0xaef4('0x9')]};var _0x30d388=md5(JSON[_0xaef4('0x15')](_0x5a4fc4));if(this['md5']!==_0x30d388){this[_0xaef4('0x16')]=_0x30d388;io['to'](util[_0xaef4('0x17')](_0xaef4('0x18'),_0x5a4fc4[_0xaef4('0x5')]))[_0xaef4('0x19')](_0xaef4('0x1a'),_0x5a4fc4);}};module[_0xaef4('0x1b')]=FaxQueue; \ No newline at end of file +var _0xab87=['online','loggedIn','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','Agents','_rr','paused','length'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xab87,0x1cb));var _0x7ab8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xab87[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7ab8('0x0'));var md5=require(_0x7ab8('0x1'));var util=require(_0x7ab8('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x7ab8('0x3')](config['redis'],{'host':_0x7ab8('0x4'),'port':0x18eb});var io=require(_0x7ab8('0x5'))(new Redis(config[_0x7ab8('0x6')]));function FaxQueue(_0x153656){this['id']=_0x153656['id']||0x0;this[_0x7ab8('0x7')]=_0x153656[_0x7ab8('0x7')]||'';this[_0x7ab8('0x8')]=_0x153656[_0x7ab8('0x8')]||0xa;this[_0x7ab8('0x9')]=_0x153656[_0x7ab8('0x9')]||_0x7ab8('0xa');this['Agents']=_0x153656['Agents'];this['mapAgentsId']={};this[_0x7ab8('0xb')]=0x0;this[_0x7ab8('0x1')]='';this[_0x7ab8('0xc')]();this[_0x7ab8('0xd')]();}FaxQueue[_0x7ab8('0xe')][_0x7ab8('0xc')]=function(){var _0x2b2e67=this['mapAgentsId']['_rr'];this[_0x7ab8('0xf')]=_[_0x7ab8('0x10')](this[_0x7ab8('0x11')],'id');this[_0x7ab8('0xf')][_0x7ab8('0x12')]=_0x2b2e67;};FaxQueue[_0x7ab8('0xe')][_0x7ab8('0xd')]=function(){this['loggedIn']=0x0;this[_0x7ab8('0x13')]=0x0;for(var _0x5e34b4=0x0;_0x5e34b4=0x0?this[_0x7ab8('0x18')]:0x0;var _0x15b886={'id':this['id'],'available':this[_0x7ab8('0x18')],'loggedIn':this[_0x7ab8('0x16')],'name':this[_0x7ab8('0x7')],'paused':this[_0x7ab8('0x13')],'waiting':this[_0x7ab8('0xb')]};var _0x5b92a3=md5(JSON[_0x7ab8('0x19')](_0x15b886));if(this['md5']!==_0x5b92a3){this[_0x7ab8('0x1')]=_0x5b92a3;io['to'](util['format'](_0x7ab8('0x1a'),_0x15b886['name']))[_0x7ab8('0x1b')](_0x7ab8('0x1c'),_0x15b886);}};module[_0x7ab8('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 5d904c4..bd6b3bd 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 _0x6215=['name','Intervals','exports'];(function(_0x1fd441,_0x2629bf){var _0x411a91=function(_0x5d14e3){while(--_0x5d14e3){_0x1fd441['push'](_0x1fd441['shift']());}};_0x411a91(++_0x2629bf);}(_0x6215,0xcf));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x5cddcb){this['id']=_0x5cddcb['id']||0x0;this[_0x5621('0x0')]=_0x5cddcb[_0x5621('0x0')]||'';this[_0x5621('0x1')]=_0x5cddcb[_0x5621('0x1')]||{};}module[_0x5621('0x2')]=Interval; \ No newline at end of file +var _0x2309=['Intervals','name'];(function(_0x13c95a,_0x1b2f7e){var _0x5a3c57=function(_0x2d3cdb){while(--_0x2d3cdb){_0x13c95a['push'](_0x13c95a['shift']());}};_0x5a3c57(++_0x1b2f7e);}(_0x2309,0x1cf));var _0x9230=function(_0x2946d3,_0x162791){_0x2946d3=_0x2946d3-0x0;var _0x19aa59=_0x2309[_0x2946d3];return _0x19aa59;};'use strict';function Interval(_0x1eed6d){this['id']=_0x1eed6d['id']||0x0;this['name']=_0x1eed6d[_0x9230('0x0')]||'';this[_0x9230('0x1')]=_0x1eed6d[_0x9230('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 7136964..134a5f0 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 _0xea9f=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','mailPause','available','paused','stringify','md5','mail:queue:%s','emit','mail_queue:save','exports','util','ioredis','redis','localhost','socket.io-emitter','name'];(function(_0x828994,_0xea87e4){var _0x13a315=function(_0x5d68a2){while(--_0x5d68a2){_0x828994['push'](_0x828994['shift']());}};_0x13a315(++_0xea87e4);}(_0xea9f,0xda));var _0xfea9=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xea9f[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xfea9('0x0'));var Redis=require(_0xfea9('0x1'));var config=require('../../../config/environment');config[_0xfea9('0x2')]=_['defaults'](config[_0xfea9('0x2')],{'host':_0xfea9('0x3'),'port':0x18eb});var io=require(_0xfea9('0x4'))(new Redis(config[_0xfea9('0x2')]));function MailQueue(_0x49c207){this['id']=_0x49c207['id']||0x0;this[_0xfea9('0x5')]=_0x49c207['name']||'';this[_0xfea9('0x6')]=_0x49c207[_0xfea9('0x6')]||0xa;this[_0xfea9('0x7')]=_0x49c207[_0xfea9('0x7')]||_0xfea9('0x8');this[_0xfea9('0x9')]=_0x49c207[_0xfea9('0x9')];this[_0xfea9('0xa')]={};this[_0xfea9('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0xfea9('0xc')]();}MailQueue[_0xfea9('0xd')][_0xfea9('0xe')]=function(){var _0x49b4f4=this['mapAgentsId'][_0xfea9('0xf')];this['mapAgentsId']=_[_0xfea9('0x10')](this[_0xfea9('0x9')],'id');this['mapAgentsId'][_0xfea9('0xf')]=_0x49b4f4;};MailQueue[_0xfea9('0xd')][_0xfea9('0xc')]=function(){this[_0xfea9('0x11')]=0x0;this['paused']=0x0;for(var _0x292053=0x0;_0x292053=0x0?this['available']:0x0;var _0xae5ce7={'id':this['id'],'available':this[_0xfea9('0x14')],'loggedIn':this[_0xfea9('0x11')],'name':this[_0xfea9('0x5')],'paused':this['paused'],'waiting':this[_0xfea9('0xb')]};var _0x321773=md5(JSON[_0xfea9('0x16')](_0xae5ce7));if(this[_0xfea9('0x17')]!==_0x321773){this[_0xfea9('0x17')]=_0x321773;io['to'](util['format'](_0xfea9('0x18'),_0xae5ce7['name']))[_0xfea9('0x19')](_0xfea9('0x1a'),_0xae5ce7);}};module[_0xfea9('0x1b')]=MailQueue; \ No newline at end of file +var _0x797a=['mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','paused','length','mailPause','available','loggedIn','waiting','stringify','format','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x5c324b,_0x6d15ba){var _0x270595=function(_0x4c668e){while(--_0x4c668e){_0x5c324b['push'](_0x5c324b['shift']());}};_0x270595(++_0x6d15ba);}(_0x797a,0x1c2));var _0xa797=function(_0x2fd72c,_0x5512ef){_0x2fd72c=_0x2fd72c-0x0;var _0x1603e6=_0x797a[_0x2fd72c];return _0x1603e6;};'use strict';var _=require(_0xa797('0x0'));var md5=require(_0xa797('0x1'));var util=require(_0xa797('0x2'));var Redis=require(_0xa797('0x3'));var config=require(_0xa797('0x4'));config[_0xa797('0x5')]=_[_0xa797('0x6')](config[_0xa797('0x5')],{'host':_0xa797('0x7'),'port':0x18eb});var io=require(_0xa797('0x8'))(new Redis(config[_0xa797('0x5')]));function MailQueue(_0x2da56c){this['id']=_0x2da56c['id']||0x0;this[_0xa797('0x9')]=_0x2da56c[_0xa797('0x9')]||'';this['timeout']=_0x2da56c[_0xa797('0xa')]||0xa;this[_0xa797('0xb')]=_0x2da56c[_0xa797('0xb')]||_0xa797('0xc');this['Agents']=_0x2da56c[_0xa797('0xd')];this[_0xa797('0xe')]={};this['waiting']=0x0;this['md5']='';this[_0xa797('0xf')]();this[_0xa797('0x10')]();}MailQueue[_0xa797('0x11')][_0xa797('0xf')]=function(){var _0x2612ca=this['mapAgentsId']['_rr'];this[_0xa797('0xe')]=_[_0xa797('0x12')](this[_0xa797('0xd')],'id');this[_0xa797('0xe')][_0xa797('0x13')]=_0x2612ca;};MailQueue[_0xa797('0x11')][_0xa797('0x10')]=function(){this['loggedIn']=0x0;this[_0xa797('0x14')]=0x0;for(var _0x41b803=0x0;_0x41b803=0x0?this[_0xa797('0x17')]:0x0;var _0x54a242={'id':this['id'],'available':this[_0xa797('0x17')],'loggedIn':this[_0xa797('0x18')],'name':this[_0xa797('0x9')],'paused':this[_0xa797('0x14')],'waiting':this[_0xa797('0x19')]};var _0x19f21f=md5(JSON[_0xa797('0x1a')](_0x54a242));if(this[_0xa797('0x1')]!==_0x19f21f){this[_0xa797('0x1')]=_0x19f21f;io['to'](util[_0xa797('0x1b')]('mail:queue:%s',_0x54a242[_0xa797('0x9')]))['emit']('mail_queue:save',_0x54a242);}};module[_0xa797('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 64f43f6..d093db9 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x1261,0x144));var _0x1126=function(_0x2caf3a,_0x1d65d6){_0x2caf3a=_0x2caf3a-0x0;var _0x34f044=_0x1261[_0x2caf3a];return _0x34f044;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('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 ec96656..7a68a82 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 _0xe107=['format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','timeout','strategy','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','available','waiting','stringify'];(function(_0x19a694,_0x15cbdd){var _0x1bf71a=function(_0x26bb48){while(--_0x26bb48){_0x19a694['push'](_0x19a694['shift']());}};_0x1bf71a(++_0x15cbdd);}(_0xe107,0xb3));var _0x7e10=function(_0x3d0944,_0x5b3856){_0x3d0944=_0x3d0944-0x0;var _0x58cc78=_0xe107[_0x3d0944];return _0x58cc78;};'use strict';var _=require(_0x7e10('0x0'));var md5=require('md5');var util=require(_0x7e10('0x1'));var Redis=require(_0x7e10('0x2'));var config=require(_0x7e10('0x3'));config['redis']=_[_0x7e10('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7e10('0x5'))(new Redis(config[_0x7e10('0x6')]));function SmsQueue(_0x841f6d){this['id']=_0x841f6d['id']||0x0;this['name']=_0x841f6d['name']||'';this[_0x7e10('0x7')]=_0x841f6d[_0x7e10('0x7')]||0xa;this[_0x7e10('0x8')]=_0x841f6d[_0x7e10('0x8')]||'beepall';this['Agents']=_0x841f6d[_0x7e10('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7e10('0xa')]='';this[_0x7e10('0xb')]();this[_0x7e10('0xc')]();}SmsQueue[_0x7e10('0xd')][_0x7e10('0xb')]=function(){var _0x52ba74=this[_0x7e10('0xe')]['_rr'];this[_0x7e10('0xe')]=_[_0x7e10('0xf')](this[_0x7e10('0x9')],'id');this['mapAgentsId'][_0x7e10('0x10')]=_0x52ba74;};SmsQueue[_0x7e10('0xd')][_0x7e10('0xc')]=function(){this[_0x7e10('0x11')]=0x0;this[_0x7e10('0x12')]=0x0;for(var _0x1b4d9d=0x0;_0x1b4d9d=0x0?this['available']:0x0;var _0x3208c6={'id':this['id'],'available':this[_0x7e10('0x15')],'loggedIn':this[_0x7e10('0x11')],'name':this['name'],'paused':this[_0x7e10('0x12')],'waiting':this[_0x7e10('0x16')]};var _0x157b22=md5(JSON[_0x7e10('0x17')](_0x3208c6));if(this[_0x7e10('0xa')]!==_0x157b22){this['md5']=_0x157b22;io['to'](util[_0x7e10('0x18')](_0x7e10('0x19'),_0x3208c6['name']))[_0x7e10('0x1a')](_0x7e10('0x1b'),_0x3208c6);}};module[_0x7e10('0x1c')]=SmsQueue; \ No newline at end of file +var _0xa25c=['online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa25c,0x13f));var _0xca25=function(_0xa43518,_0x2a4c6b){_0xa43518=_0xa43518-0x0;var _0x5e9b94=_0xa25c[_0xa43518];return _0x5e9b94;};'use strict';var _=require('lodash');var md5=require(_0xca25('0x0'));var util=require(_0xca25('0x1'));var Redis=require(_0xca25('0x2'));var config=require(_0xca25('0x3'));config[_0xca25('0x4')]=_[_0xca25('0x5')](config[_0xca25('0x4')],{'host':_0xca25('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca25('0x4')]));function SmsQueue(_0x4ff5bd){this['id']=_0x4ff5bd['id']||0x0;this['name']=_0x4ff5bd[_0xca25('0x7')]||'';this['timeout']=_0x4ff5bd[_0xca25('0x8')]||0xa;this[_0xca25('0x9')]=_0x4ff5bd[_0xca25('0x9')]||_0xca25('0xa');this[_0xca25('0xb')]=_0x4ff5bd['Agents'];this['mapAgentsId']={};this[_0xca25('0xc')]=0x0;this['md5']='';this[_0xca25('0xd')]();this[_0xca25('0xe')]();}SmsQueue[_0xca25('0xf')]['updateRouting']=function(){var _0x49eb79=this['mapAgentsId'][_0xca25('0x10')];this[_0xca25('0x11')]=_[_0xca25('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xca25('0x10')]=_0x49eb79;};SmsQueue['prototype'][_0xca25('0xe')]=function(){this[_0xca25('0x13')]=0x0;this[_0xca25('0x14')]=0x0;for(var _0x1a3207=0x0;_0x1a3207=0x0?this[_0xca25('0x18')]:0x0;var _0x18ec6f={'id':this['id'],'available':this[_0xca25('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xca25('0x7')],'paused':this[_0xca25('0x14')],'waiting':this[_0xca25('0xc')]};var _0x1cf09c=md5(JSON[_0xca25('0x19')](_0x18ec6f));if(this['md5']!==_0x1cf09c){this[_0xca25('0x0')]=_0x1cf09c;io['to'](util[_0xca25('0x1a')](_0xca25('0x1b'),_0x18ec6f[_0xca25('0x7')]))[_0xca25('0x1c')](_0xca25('0x1d'),_0x18ec6f);}};module[_0xca25('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4e54d7a..6bef3a2 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 _0x8d95=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','length','available','loggedIn','paused','stringify','format','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x215b0b,_0x4e86fc){var _0x3db893=function(_0x51e797){while(--_0x51e797){_0x215b0b['push'](_0x215b0b['shift']());}};_0x3db893(++_0x4e86fc);}(_0x8d95,0x11e));var _0x58d9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8d95[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x58d9('0x0'));var md5=require('md5');var util=require(_0x58d9('0x1'));var Redis=require(_0x58d9('0x2'));var config=require(_0x58d9('0x3'));config[_0x58d9('0x4')]=_[_0x58d9('0x5')](config[_0x58d9('0x4')],{'host':_0x58d9('0x6'),'port':0x18eb});var io=require(_0x58d9('0x7'))(new Redis(config[_0x58d9('0x4')]));function WhatsappQueue(_0x9233a){this['id']=_0x9233a['id']||0x0;this[_0x58d9('0x8')]=_0x9233a[_0x58d9('0x8')]||'';this[_0x58d9('0x9')]=_0x9233a[_0x58d9('0x9')]||0xa;this[_0x58d9('0xa')]=_0x9233a[_0x58d9('0xa')]||_0x58d9('0xb');this[_0x58d9('0xc')]=_0x9233a['Agents'];this['mapAgentsId']={};this[_0x58d9('0xd')]=0x0;this[_0x58d9('0xe')]='';this[_0x58d9('0xf')]();this[_0x58d9('0x10')]();}WhatsappQueue[_0x58d9('0x11')]['updateRouting']=function(){var _0x5eb402=this['mapAgentsId'][_0x58d9('0x12')];this[_0x58d9('0x13')]=_['map'](this['Agents'],'id');this[_0x58d9('0x13')][_0x58d9('0x12')]=_0x5eb402;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3cc6d9=0x0;_0x3cc6d9=0x0?this[_0x58d9('0x15')]:0x0;var _0xb6f09f={'id':this['id'],'available':this[_0x58d9('0x15')],'loggedIn':this[_0x58d9('0x16')],'name':this[_0x58d9('0x8')],'paused':this[_0x58d9('0x17')],'waiting':this[_0x58d9('0xd')]};var _0x180c31=md5(JSON[_0x58d9('0x18')](_0xb6f09f));if(this['md5']!==_0x180c31){this[_0x58d9('0xe')]=_0x180c31;io['to'](util[_0x58d9('0x19')]('whatsapp:queue:%s',_0xb6f09f[_0x58d9('0x8')]))[_0x58d9('0x1a')](_0x58d9('0x1b'),_0xb6f09f);}};module[_0x58d9('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xbaae=['paused','whatsappPause','available','whatsapp:queue:%s','exports','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xbaae,0x87));var _0xebaa=function(_0x26ce58,_0xcc305c){_0x26ce58=_0x26ce58-0x0;var _0x3d37dc=_0xbaae[_0x26ce58];return _0x3d37dc;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xebaa('0x0'));var Redis=require(_0xebaa('0x1'));var config=require(_0xebaa('0x2'));config['redis']=_[_0xebaa('0x3')](config['redis'],{'host':_0xebaa('0x4'),'port':0x18eb});var io=require(_0xebaa('0x5'))(new Redis(config[_0xebaa('0x6')]));function WhatsappQueue(_0x245ea9){this['id']=_0x245ea9['id']||0x0;this[_0xebaa('0x7')]=_0x245ea9[_0xebaa('0x7')]||'';this[_0xebaa('0x8')]=_0x245ea9[_0xebaa('0x8')]||0xa;this[_0xebaa('0x9')]=_0x245ea9[_0xebaa('0x9')]||_0xebaa('0xa');this['Agents']=_0x245ea9[_0xebaa('0xb')];this['mapAgentsId']={};this[_0xebaa('0xc')]=0x0;this[_0xebaa('0xd')]='';this[_0xebaa('0xe')]();this[_0xebaa('0xf')]();}WhatsappQueue[_0xebaa('0x10')][_0xebaa('0xe')]=function(){var _0x73d794=this[_0xebaa('0x11')]['_rr'];this[_0xebaa('0x11')]=_[_0xebaa('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xebaa('0x13')]=_0x73d794;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xebaa('0x14')]=0x0;this[_0xebaa('0x15')]=0x0;for(var _0x4fc814=0x0;_0x4fc814=0x0?this['available']:0x0;var _0xa55541={'id':this['id'],'available':this[_0xebaa('0x17')],'loggedIn':this[_0xebaa('0x14')],'name':this['name'],'paused':this[_0xebaa('0x15')],'waiting':this[_0xebaa('0xc')]};var _0x1300ef=md5(JSON['stringify'](_0xa55541));if(this['md5']!==_0x1300ef){this[_0xebaa('0xd')]=_0x1300ef;io['to'](util['format'](_0xebaa('0x18'),_0xa55541[_0xebaa('0x7')]))['emit']('whatsapp_queue:save',_0xa55541);}};module[_0xebaa('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2ae5819..6ab8163 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 38be680..8b023bc 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 _0x5a3b=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','UpdateChatInteraction','updateChatInteraction','addTags','Request'];(function(_0xee51c0,_0x5f2ff4){var _0x136063=function(_0x7c5597){while(--_0x7c5597){_0xee51c0['push'](_0xee51c0['shift']());}};_0x136063(++_0x5f2ff4);}(_0x5a3b,0x14b));var _0xb5a3=function(_0x2884eb,_0x41933b){_0x2884eb=_0x2884eb-0x0;var _0x11f3a3=_0x5a3b[_0x2884eb];return _0x11f3a3;};'use strict';var client=require(_0xb5a3('0x0'));exports['update']=function(_0x5e8420,_0x3c24de){return client['Request'](_0xb5a3('0x1'),{'body':_0x3c24de,'options':{'where':{'id':_0x5e8420}},'log':_0xb5a3('0x2')});};exports[_0xb5a3('0x3')]=function(_0x121ba8,_0x3813ea){return client[_0xb5a3('0x4')](_0xb5a3('0x5'),{'body':_0x3813ea,'options':{'where':{'id':_0x121ba8}},'log':_0xb5a3('0x6')});}; \ No newline at end of file +var _0x6f2c=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','AddTagsToChatInteraction'];(function(_0x1c0bac,_0x5b0255){var _0x207c88=function(_0x2481c3){while(--_0x2481c3){_0x1c0bac['push'](_0x1c0bac['shift']());}};_0x207c88(++_0x5b0255);}(_0x6f2c,0x16f));var _0xc6f2=function(_0x3a40d8,_0x253303){_0x3a40d8=_0x3a40d8-0x0;var _0x403cb8=_0x6f2c[_0x3a40d8];return _0x403cb8;};'use strict';var client=require(_0xc6f2('0x0'));exports[_0xc6f2('0x1')]=function(_0x2a5412,_0x55a571){return client[_0xc6f2('0x2')](_0xc6f2('0x3'),{'body':_0x55a571,'options':{'where':{'id':_0x2a5412}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x5c398f,_0x5d7847){return client['Request'](_0xc6f2('0x4'),{'body':_0x5d7847,'options':{'where':{'id':_0x5c398f}},'log':_0xc6f2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e740bda..2d6b0d6 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 _0xfcad=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x459df6,_0x71e21a){var _0x584307=function(_0x1a3bf4){while(--_0x1a3bf4){_0x459df6['push'](_0x459df6['shift']());}};_0x584307(++_0x71e21a);}(_0xfcad,0xce));var _0xdfca=function(_0x1127db,_0x1345de){_0x1127db=_0x1127db-0x0;var _0x56cffc=_0xfcad[_0x1127db];return _0x56cffc;};'use strict';var client=require(_0xdfca('0x0'));exports['create']=function(_0x133541){return client[_0xdfca('0x1')](_0xdfca('0x2'),{'body':_0x133541,'log':_0xdfca('0x3')});}; \ No newline at end of file +var _0x4bff=['Request','CreateChatMessage','../client'];(function(_0x28f8b7,_0x257a0e){var _0x513408=function(_0x12a117){while(--_0x12a117){_0x28f8b7['push'](_0x28f8b7['shift']());}};_0x513408(++_0x257a0e);}(_0x4bff,0x122));var _0xf4bf=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x4bff[_0x368fb9];return _0x4892fb;};'use strict';var client=require(_0xf4bf('0x0'));exports['create']=function(_0x12094e){return client[_0xf4bf('0x1')](_0xf4bf('0x2'),{'body':_0x12094e,'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 c7a595a..e8b75eb 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 _0x9649=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents','online'];(function(_0x3a83ad,_0x49ff0b){var _0x4a8204=function(_0x4dc5d3){while(--_0x4dc5d3){_0x3a83ad['push'](_0x3a83ad['shift']());}};_0x4a8204(++_0x49ff0b);}(_0x9649,0x19f));var _0x9964=function(_0x11e363,_0xf77ad4){_0x11e363=_0x11e363-0x0;var _0x4fb00f=_0x9649[_0x11e363];return _0x4fb00f;};'use strict';var client=require(_0x9964('0x0'));exports[_0x9964('0x1')]=function(){return function(){return client[_0x9964('0x2')](_0x9964('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9964('0x4'),_0x9964('0x5')],'include':[{'model':'User','as':_0x9964('0x6'),'attributes':['id','name',_0x9964('0x7'),_0x9964('0x8')]}]},'log':_0x9964('0x1')});};}; \ No newline at end of file +var _0xf29c=['Request','GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause','getChatQueues'];(function(_0x12a217,_0x27aa61){var _0x3447a8=function(_0x1d39d7){while(--_0x1d39d7){_0x12a217['push'](_0x12a217['shift']());}};_0x3447a8(++_0x27aa61);}(_0xf29c,0xc7));var _0xcf29=function(_0x8376b3,_0xd95da8){_0x8376b3=_0x8376b3-0x0;var _0x5879d2=_0xf29c[_0x8376b3];return _0x5879d2;};'use strict';var client=require('../client');exports[_0xcf29('0x0')]=function(){return function(){return client[_0xcf29('0x1')](_0xcf29('0x2'),{'options':{'raw':![],'attributes':['id',_0xcf29('0x3'),_0xcf29('0x4'),_0xcf29('0x5')],'include':[{'model':_0xcf29('0x6'),'as':_0xcf29('0x7'),'attributes':['id',_0xcf29('0x3'),_0xcf29('0x8'),_0xcf29('0x9')]}]},'log':_0xcf29('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d684df9..d2f4037 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 _0x1ae3=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x399f0e,_0x40c7e7){var _0x150853=function(_0xaa9856){while(--_0xaa9856){_0x399f0e['push'](_0x399f0e['shift']());}};_0x150853(++_0x40c7e7);}(_0x1ae3,0x139));var _0x31ae=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0x1ae3[_0x91d019];return _0x19de1f;};'use strict';var client=require(_0x31ae('0x0'));exports[_0x31ae('0x1')]=function(_0x50dfb3){return client[_0x31ae('0x2')](_0x31ae('0x3'),{'body':_0x50dfb3,'log':_0x31ae('0x3')});};exports[_0x31ae('0x4')]=function(_0x4f03c3,_0x16eaa4){return client[_0x31ae('0x2')](_0x31ae('0x5'),{'body':_0x16eaa4,'options':{'where':{'uniqueid':_0x4f03c3},'order':[['id',_0x31ae('0x6')]],'limit':0x1},'log':_0x31ae('0x5')});}; \ No newline at end of file +var _0x0e9f=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x0e9f,0x116));var _0xf0e9=function(_0x498c71,_0x36155d){_0x498c71=_0x498c71-0x0;var _0x5cf10e=_0x0e9f[_0x498c71];return _0x5cf10e;};'use strict';var client=require(_0xf0e9('0x0'));exports[_0xf0e9('0x1')]=function(_0x5c81a4){return client['Request'](_0xf0e9('0x2'),{'body':_0x5c81a4,'log':'CreateChatQueueReport'});};exports['update']=function(_0x2d2d99,_0x559cad){return client['Request'](_0xf0e9('0x3'),{'body':_0x559cad,'options':{'where':{'uniqueid':_0x2d2d99},'order':[['id',_0xf0e9('0x4')]],'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 0205850..e5314ea 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x36c0f9,_0x1738c){var _0x742668=function(_0x44a06f){while(--_0x44a06f){_0x36c0f9['push'](_0x36c0f9['shift']());}};_0x742668(++_0x1738c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0x7a54,0x106));var _0x47a5=function(_0x1ba6ab,_0x11da96){_0x1ba6ab=_0x1ba6ab-0x0;var _0x524d72=_0x7a54[_0x1ba6ab];return _0x524d72;};'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 46508bf..d55eb22 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 _0xa0f2=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xa0f2,0x1ca));var _0x2a0f=function(_0x2685b2,_0x513f32){_0x2685b2=_0x2685b2-0x0;var _0x54b54e=_0xa0f2[_0x2685b2];return _0x54b54e;};'use strict';var client=require(_0x2a0f('0x0'));exports['create']=function(_0x34bec9){return client[_0x2a0f('0x1')](_0x2a0f('0x2'),{'body':_0x34bec9,'log':_0x2a0f('0x3')});}; \ No newline at end of file +var _0xafa9=['Request','createFaxMessage'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xafa9,0x6e));var _0x9afa=function(_0xb093,_0x5403c4){_0xb093=_0xb093-0x0;var _0x516bac=_0xafa9[_0xb093];return _0x516bac;};'use strict';var client=require('../client');exports['create']=function(_0x5bd725){return client[_0x9afa('0x0')]('CreateFaxMessage',{'body':_0x5bd725,'log':_0x9afa('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index dc95248..e3cf562 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 _0x357c=['timeout','Agents','faxPause','../client','getFaxQueues','Request','name'];(function(_0x34e4d2,_0x533604){var _0x2acb93=function(_0x184a41){while(--_0x184a41){_0x34e4d2['push'](_0x34e4d2['shift']());}};_0x2acb93(++_0x533604);}(_0x357c,0x106));var _0xc357=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x357c[_0x470e67];return _0x28bbde;};'use strict';var client=require(_0xc357('0x0'));exports[_0xc357('0x1')]=function(){return function(){return client[_0xc357('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xc357('0x3'),_0xc357('0x4'),'strategy'],'include':[{'model':'User','as':_0xc357('0x5'),'attributes':['id',_0xc357('0x3'),'online',_0xc357('0x6')]}]},'log':_0xc357('0x1')});};}; \ No newline at end of file +var _0x7874=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x39b0c3,_0x43a281){var _0x59e420=function(_0x2bdf04){while(--_0x2bdf04){_0x39b0c3['push'](_0x39b0c3['shift']());}};_0x59e420(++_0x43a281);}(_0x7874,0x1e2));var _0x4787=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0x7874[_0x4ca288];return _0x2362c1;};'use strict';var client=require(_0x4787('0x0'));exports[_0x4787('0x1')]=function(){return function(){return client[_0x4787('0x2')](_0x4787('0x3'),{'options':{'raw':![],'attributes':['id',_0x4787('0x4'),_0x4787('0x5'),_0x4787('0x6')],'include':[{'model':_0x4787('0x7'),'as':'Agents','attributes':['id',_0x4787('0x4'),_0x4787('0x8'),_0x4787('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 912577c..76de785 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 _0xba35=['../client','create','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x4e6617,_0x271f92){var _0x4bffd8=function(_0x4e699b){while(--_0x4e699b){_0x4e6617['push'](_0x4e6617['shift']());}};_0x4bffd8(++_0x271f92);}(_0xba35,0x174));var _0x5ba3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xba35[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x5ba3('0x0'));exports[_0x5ba3('0x1')]=function(_0x4ef14f){return client['Request'](_0x5ba3('0x2'),{'body':_0x4ef14f,'log':_0x5ba3('0x2')});};exports[_0x5ba3('0x3')]=function(_0x27ab35,_0x53290e){return client['Request']('UpdateFaxQueueReport',{'body':_0x53290e,'options':{'where':{'uniqueid':_0x27ab35},'order':[['id',_0x5ba3('0x4')]],'limit':0x1},'log':_0x5ba3('0x5')});}; \ No newline at end of file +var _0x8ea2=['update','UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0x1ff446,_0xaca1fc){var _0x5a151d=function(_0x4d7f6f){while(--_0x4d7f6f){_0x1ff446['push'](_0x1ff446['shift']());}};_0x5a151d(++_0xaca1fc);}(_0x8ea2,0xd5));var _0x28ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x28ea('0x0')]=function(_0x383d64){return client[_0x28ea('0x1')]('CreateFaxQueueReport',{'body':_0x383d64,'log':_0x28ea('0x2')});};exports[_0x28ea('0x3')]=function(_0x4217a2,_0x4da541){return client[_0x28ea('0x1')](_0x28ea('0x4'),{'body':_0x4da541,'options':{'where':{'uniqueid':_0x4217a2},'order':[['id',_0x28ea('0x5')]],'limit':0x1},'log':_0x28ea('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a9b95e4..31aa13f 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 _0x8759=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x50cadc,_0x295360){var _0x5b6161=function(_0x130063){while(--_0x130063){_0x50cadc['push'](_0x50cadc['shift']());}};_0x5b6161(++_0x295360);}(_0x8759,0xb3));var _0x9875=function(_0x5e0f25,_0x560c12){_0x5e0f25=_0x5e0f25-0x0;var _0x31c92b=_0x8759[_0x5e0f25];return _0x31c92b;};'use strict';var client=require(_0x9875('0x0'));exports[_0x9875('0x1')]=function(){return function(){return client[_0x9875('0x2')](_0x9875('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9875('0x4')],'include':[{'model':_0x9875('0x5'),'as':_0x9875('0x6'),'attributes':['id',_0x9875('0x4'),_0x9875('0x7')]}]},'log':_0x9875('0x1')});};}; \ No newline at end of file +var _0x5aec=['GetInterval','Interval','Intervals','name','interval','../client','getIntervals','Request'];(function(_0x41cf31,_0x1d9345){var _0x9b2b1b=function(_0x504269){while(--_0x504269){_0x41cf31['push'](_0x41cf31['shift']());}};_0x9b2b1b(++_0x1d9345);}(_0x5aec,0x1ad));var _0xc5ae=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5aec[_0xd0b415];return _0x2bdf2c;};'use strict';var client=require(_0xc5ae('0x0'));exports[_0xc5ae('0x1')]=function(){return function(){return client[_0xc5ae('0x2')](_0xc5ae('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xc5ae('0x4'),'as':_0xc5ae('0x5'),'attributes':['id',_0xc5ae('0x6'),_0xc5ae('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 626e635..8db7833 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 _0x36ee=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction'];(function(_0x3648ba,_0x5c35b1){var _0x3bc56e=function(_0x1ac56a){while(--_0x1ac56a){_0x3648ba['push'](_0x3648ba['shift']());}};_0x3bc56e(++_0x5c35b1);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var client=require('../client');exports['update']=function(_0x34e33c,_0x521ff3){return client[_0xe36e('0x0')](_0xe36e('0x1'),{'body':_0x521ff3,'options':{'where':{'id':_0x34e33c}},'log':_0xe36e('0x2')});};exports[_0xe36e('0x3')]=function(_0x567a84,_0x1118af){return client[_0xe36e('0x0')](_0xe36e('0x4'),{'body':_0x1118af,'options':{'where':{'id':_0x567a84}},'log':_0xe36e('0x5')});}; \ No newline at end of file +var _0x1893=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x5c9a9e,_0x35cab6){var _0x500462=function(_0x147f23){while(--_0x147f23){_0x5c9a9e['push'](_0x5c9a9e['shift']());}};_0x500462(++_0x35cab6);}(_0x1893,0xa2));var _0x3189=function(_0x5a5ad8,_0x34911c){_0x5a5ad8=_0x5a5ad8-0x0;var _0x5512e5=_0x1893[_0x5a5ad8];return _0x5512e5;};'use strict';var client=require('../client');exports['update']=function(_0x1bfe8b,_0x3aec2b){return client[_0x3189('0x0')](_0x3189('0x1'),{'body':_0x3aec2b,'options':{'where':{'id':_0x1bfe8b}},'log':_0x3189('0x2')});};exports[_0x3189('0x3')]=function(_0x3953a2,_0x5371db){return client[_0x3189('0x0')](_0x3189('0x4'),{'body':_0x5371db,'options':{'where':{'id':_0x3953a2}},'log':_0x3189('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2652b7e..de58018 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 _0xac62=['CreateMailMessage','createMailMessage','create'];(function(_0x5c6e09,_0x71f3bc){var _0x7d0802=function(_0x94f05){while(--_0x94f05){_0x5c6e09['push'](_0x5c6e09['shift']());}};_0x7d0802(++_0x71f3bc);}(_0xac62,0x152));var _0x2ac6=function(_0x467d3b,_0x4225ba){_0x467d3b=_0x467d3b-0x0;var _0x1a35ec=_0xac62[_0x467d3b];return _0x1a35ec;};'use strict';var client=require('../client');exports[_0x2ac6('0x0')]=function(_0x4647f2){return client['Request'](_0x2ac6('0x1'),{'body':_0x4647f2,'log':_0x2ac6('0x2')});}; \ No newline at end of file +var _0xd837=['createMailMessage','create','CreateMailMessage'];(function(_0x201862,_0x1876f7){var _0x172551=function(_0x479a28){while(--_0x479a28){_0x201862['push'](_0x201862['shift']());}};_0x172551(++_0x1876f7);}(_0xd837,0x19c));var _0x7d83=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xd837[_0x18a79d];return _0x4f8848;};'use strict';var client=require('../client');exports[_0x7d83('0x0')]=function(_0xca1d){return client['Request'](_0x7d83('0x1'),{'body':_0xca1d,'log':_0x7d83('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 323b290..c7c7c77 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 _0x8e2a=['GetMailQueue','name','online','mailPause','Request'];(function(_0x1a8ea6,_0xadee16){var _0x130e71=function(_0x5099d3){while(--_0x5099d3){_0x1a8ea6['push'](_0x1a8ea6['shift']());}};_0x130e71(++_0xadee16);}(_0x8e2a,0xa4));var _0xa8e2=function(_0xffdf22,_0x109194){_0xffdf22=_0xffdf22-0x0;var _0x3c57c3=_0x8e2a[_0xffdf22];return _0x3c57c3;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xa8e2('0x0')](_0xa8e2('0x1'),{'options':{'raw':![],'attributes':['id',_0xa8e2('0x2'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xa8e2('0x2'),_0xa8e2('0x3'),_0xa8e2('0x4')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xe9ed=['../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xe9ed,0xdc));var _0xde9e=function(_0x1448bc,_0x39399c){_0x1448bc=_0x1448bc-0x0;var _0x433a66=_0xe9ed[_0x1448bc];return _0x433a66;};'use strict';var client=require(_0xde9e('0x0'));exports[_0xde9e('0x1')]=function(){return function(){return client[_0xde9e('0x2')](_0xde9e('0x3'),{'options':{'raw':![],'attributes':['id',_0xde9e('0x4'),_0xde9e('0x5'),_0xde9e('0x6')],'include':[{'model':_0xde9e('0x7'),'as':_0xde9e('0x8'),'attributes':['id',_0xde9e('0x4'),_0xde9e('0x9'),_0xde9e('0xa')]}]},'log':_0xde9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a223364..d8b1a92 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 _0x0618=['update','Request','DESC','UpdateMailQueueReport','CreateMailQueueReport'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x0618,0x130));var _0x8061=function(_0xc812a0,_0x37a9d3){_0xc812a0=_0xc812a0-0x0;var _0x14f339=_0x0618[_0xc812a0];return _0x14f339;};'use strict';var client=require('../client');exports['create']=function(_0x23f881){return client['Request'](_0x8061('0x0'),{'body':_0x23f881,'log':_0x8061('0x0')});};exports[_0x8061('0x1')]=function(_0x40a83f,_0x5e5f80){return client[_0x8061('0x2')]('UpdateMailQueueReport',{'body':_0x5e5f80,'options':{'where':{'uniqueid':_0x40a83f},'order':[['id',_0x8061('0x3')]],'limit':0x1},'log':_0x8061('0x4')});}; \ No newline at end of file +var _0x445b=['CreateMailQueueReport','UpdateMailQueueReport','Request'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x445b,0x185));var _0xb445=function(_0x29e165,_0x488240){_0x29e165=_0x29e165-0x0;var _0x5479d3=_0x445b[_0x29e165];return _0x5479d3;};'use strict';var client=require('../client');exports['create']=function(_0xc00454){return client[_0xb445('0x0')](_0xb445('0x1'),{'body':_0xc00454,'log':_0xb445('0x1')});};exports['update']=function(_0x4fe80,_0x421e94){return client['Request'](_0xb445('0x2'),{'body':_0x421e94,'options':{'where':{'uniqueid':_0x4fe80},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ae115c5..e202bd7 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 _0x880c=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x1eb444,_0x3f351f){var _0x352f34=function(_0x9cdf7f){while(--_0x9cdf7f){_0x1eb444['push'](_0x1eb444['shift']());}};_0x352f34(++_0x3f351f);}(_0x880c,0xd7));var _0xc880=function(_0x53ac4d,_0xd40116){_0x53ac4d=_0x53ac4d-0x0;var _0x24e12c=_0x880c[_0x53ac4d];return _0x24e12c;};'use strict';var client=require('../client');exports[_0xc880('0x0')]=function(_0x847ad5,_0x4707d1){return client[_0xc880('0x1')](_0xc880('0x2'),{'body':_0x4707d1,'options':{'where':{'id':_0x847ad5}},'log':_0xc880('0x3')});};exports['addTags']=function(_0x851ab1,_0x5b349e){return client['Request'](_0xc880('0x4'),{'body':_0x5b349e,'options':{'where':{'id':_0x851ab1}},'log':_0xc880('0x5')});}; \ No newline at end of file +var _0xd0e3=['addTagsToChatInteraction','../client','update','Request','AddTagsToOpenchannelInteraction'];(function(_0x2626d3,_0x592c35){var _0x52d450=function(_0x5cff0b){while(--_0x5cff0b){_0x2626d3['push'](_0x2626d3['shift']());}};_0x52d450(++_0x592c35);}(_0xd0e3,0xe2));var _0x3d0e=function(_0x58b19e,_0x12ebe7){_0x58b19e=_0x58b19e-0x0;var _0x34da28=_0xd0e3[_0x58b19e];return _0x34da28;};'use strict';var client=require(_0x3d0e('0x0'));exports[_0x3d0e('0x1')]=function(_0x2eaab1,_0x953b4a){return client[_0x3d0e('0x2')]('UpdateOpenchannelInteraction',{'body':_0x953b4a,'options':{'where':{'id':_0x2eaab1}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x4dbf27,_0x35ec38){return client[_0x3d0e('0x2')](_0x3d0e('0x3'),{'body':_0x35ec38,'options':{'where':{'id':_0x4dbf27}},'log':_0x3d0e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 825059e..29177b5 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 _0xa4a2=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x22db31,_0x568f64){var _0x483061=function(_0x12103f){while(--_0x12103f){_0x22db31['push'](_0x22db31['shift']());}};_0x483061(++_0x568f64);}(_0xa4a2,0x146));var _0x2a4a=function(_0x4b2603,_0x139563){_0x4b2603=_0x4b2603-0x0;var _0x549381=_0xa4a2[_0x4b2603];return _0x549381;};'use strict';var client=require(_0x2a4a('0x0'));exports[_0x2a4a('0x1')]=function(_0x5a0b02){return client[_0x2a4a('0x2')](_0x2a4a('0x3'),{'body':_0x5a0b02,'log':_0x2a4a('0x4')});}; \ No newline at end of file +var _0x1b8c=['../client','create','Request','CreateOpenchannelMessage'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1b8c,0x1e0));var _0xc1b8=function(_0x28d38b,_0x359528){_0x28d38b=_0x28d38b-0x0;var _0x4e9b08=_0x1b8c[_0x28d38b];return _0x4e9b08;};'use strict';var client=require(_0xc1b8('0x0'));exports[_0xc1b8('0x1')]=function(_0x16b2d1){return client[_0xc1b8('0x2')](_0xc1b8('0x3'),{'body':_0x16b2d1,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 932a15e..17f2d46 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 _0xeebe=['User','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','name','timeout','strategy'];(function(_0x3fa4c9,_0x2e41fc){var _0x28d721=function(_0x437c02){while(--_0x437c02){_0x3fa4c9['push'](_0x3fa4c9['shift']());}};_0x28d721(++_0x2e41fc);}(_0xeebe,0xff));var _0xeeeb=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xeebe[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0xeeeb('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xeeeb('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xeeeb('0x2'),_0xeeeb('0x3'),_0xeeeb('0x4')],'include':[{'model':_0xeeeb('0x5'),'as':_0xeeeb('0x6'),'attributes':['id',_0xeeeb('0x2'),_0xeeeb('0x7'),_0xeeeb('0x8')]}]},'log':_0xeeeb('0x9')});};}; \ No newline at end of file +var _0x0f82=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','timeout','User'];(function(_0x185ba0,_0x6286e5){var _0x5ede71=function(_0x3c6272){while(--_0x3c6272){_0x185ba0['push'](_0x185ba0['shift']());}};_0x5ede71(++_0x6286e5);}(_0x0f82,0xd3));var _0x20f8=function(_0x318054,_0x516efd){_0x318054=_0x318054-0x0;var _0x19a6ae=_0x0f82[_0x318054];return _0x19a6ae;};'use strict';var client=require(_0x20f8('0x0'));exports[_0x20f8('0x1')]=function(){return function(){return client[_0x20f8('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x20f8('0x3'),'strategy'],'include':[{'model':_0x20f8('0x4'),'as':_0x20f8('0x5'),'attributes':['id','name',_0x20f8('0x6'),_0x20f8('0x7')]}]},'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 c3fd017..3b9d1fc 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 _0x9bb4=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x96d97e,_0x56b6cd){var _0x4afdf8=function(_0xa791d9){while(--_0xa791d9){_0x96d97e['push'](_0x96d97e['shift']());}};_0x4afdf8(++_0x56b6cd);}(_0x9bb4,0xd5));var _0x49bb=function(_0x53d51b,_0x44d713){_0x53d51b=_0x53d51b-0x0;var _0x214764=_0x9bb4[_0x53d51b];return _0x214764;};'use strict';var client=require(_0x49bb('0x0'));exports[_0x49bb('0x1')]=function(_0x1de75a){return client[_0x49bb('0x2')](_0x49bb('0x3'),{'body':_0x1de75a,'log':_0x49bb('0x3')});};exports[_0x49bb('0x4')]=function(_0xa01a73,_0x45317c){return client['Request'](_0x49bb('0x5'),{'body':_0x45317c,'options':{'where':{'uniqueid':_0xa01a73},'order':[['id',_0x49bb('0x6')]],'limit':0x1},'log':_0x49bb('0x5')});}; \ No newline at end of file +var _0xe005=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x4ab80b,_0x1b514b){var _0x58a515=function(_0x360f43){while(--_0x360f43){_0x4ab80b['push'](_0x4ab80b['shift']());}};_0x58a515(++_0x1b514b);}(_0xe005,0x17a));var _0x5e00=function(_0x27612f,_0x4e75dc){_0x27612f=_0x27612f-0x0;var _0x5bf1bc=_0xe005[_0x27612f];return _0x5bf1bc;};'use strict';var client=require(_0x5e00('0x0'));exports[_0x5e00('0x1')]=function(_0x2bba31){return client[_0x5e00('0x2')]('CreateOpenchannelQueueReport',{'body':_0x2bba31,'log':_0x5e00('0x3')});};exports[_0x5e00('0x4')]=function(_0x50c887,_0x540a36){return client[_0x5e00('0x2')](_0x5e00('0x5'),{'body':_0x540a36,'options':{'where':{'uniqueid':_0x50c887},'order':[['id','DESC']],'limit':0x1},'log':_0x5e00('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bd9e253..7662950 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 _0x6f7f=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x578987,_0x56b294){var _0xb4e40a=function(_0x39f493){while(--_0x39f493){_0x578987['push'](_0x578987['shift']());}};_0xb4e40a(++_0x56b294);}(_0x6f7f,0x177));var _0xf6f7=function(_0x2049a9,_0x1344d7){_0x2049a9=_0x2049a9-0x0;var _0x3e4bfe=_0x6f7f[_0x2049a9];return _0x3e4bfe;};'use strict';var client=require('../client');exports[_0xf6f7('0x0')]=function(_0x2d025d,_0x2b4ee7){return client[_0xf6f7('0x1')](_0xf6f7('0x2'),{'body':_0x2b4ee7,'options':{'where':{'id':_0x2d025d}},'log':'updateSmsInteraction'});};exports[_0xf6f7('0x3')]=function(_0x52ca83,_0x3886b0){return client[_0xf6f7('0x1')](_0xf6f7('0x4'),{'body':_0x3886b0,'options':{'where':{'id':_0x52ca83}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xb7c8=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x56deb6,_0x243838){var _0x2e08a6=function(_0x9a94a5){while(--_0x9a94a5){_0x56deb6['push'](_0x56deb6['shift']());}};_0x2e08a6(++_0x243838);}(_0xb7c8,0x119));var _0x8b7c=function(_0x292543,_0x54e93e){_0x292543=_0x292543-0x0;var _0x14d6f7=_0xb7c8[_0x292543];return _0x14d6f7;};'use strict';var client=require('../client');exports[_0x8b7c('0x0')]=function(_0x150db2,_0x15b7a3){return client[_0x8b7c('0x1')](_0x8b7c('0x2'),{'body':_0x15b7a3,'options':{'where':{'id':_0x150db2}},'log':_0x8b7c('0x3')});};exports[_0x8b7c('0x4')]=function(_0x50113e,_0x38672b){return client[_0x8b7c('0x1')](_0x8b7c('0x5'),{'body':_0x38672b,'options':{'where':{'id':_0x50113e}},'log':_0x8b7c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7cacdda..4ac58e8 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 _0xda1b=['createSmsMessage','../client','create','Request'];(function(_0x2c1475,_0x381dde){var _0x12d056=function(_0x339423){while(--_0x339423){_0x2c1475['push'](_0x2c1475['shift']());}};_0x12d056(++_0x381dde);}(_0xda1b,0x1ed));var _0xbda1=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xda1b[_0x2dadb9];return _0x2f0097;};'use strict';var client=require(_0xbda1('0x0'));exports[_0xbda1('0x1')]=function(_0x501491){return client[_0xbda1('0x2')]('CreateSmsMessage',{'body':_0x501491,'log':_0xbda1('0x3')});}; \ No newline at end of file +var _0xad70=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x19cf9b,_0x17b5c8){var _0x20507c=function(_0x4c40c5){while(--_0x4c40c5){_0x19cf9b['push'](_0x19cf9b['shift']());}};_0x20507c(++_0x17b5c8);}(_0xad70,0x18d));var _0x0ad7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad70[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0ad7('0x0'));exports[_0x0ad7('0x1')]=function(_0x2f5a8e){return client[_0x0ad7('0x2')](_0x0ad7('0x3'),{'body':_0x2f5a8e,'log':_0x0ad7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5a625d9..675c011 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0xa212db,_0x26e04d){var _0x173d37=function(_0x1054eb){while(--_0x1054eb){_0xa212db['push'](_0xa212db['shift']());}};_0x173d37(++_0x26e04d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb7e7[_0x1da04e];return _0xdd8c41;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x5a33a5,_0x387d69){var _0x5de2d9=function(_0x1ebca3){while(--_0x1ebca3){_0x5a33a5['push'](_0x5a33a5['shift']());}};_0x5de2d9(++_0x387d69);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c1f1f93..e21d3db 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(_0x60cf8b,_0x3ff49a){var _0x2eb5d6=function(_0x46d306){while(--_0x46d306){_0x60cf8b['push'](_0x60cf8b['shift']());}};_0x2eb5d6(++_0x3ff49a);}(_0x34e8,0x12c));var _0x834e=function(_0x373157,_0x19cfa1){_0x373157=_0x373157-0x0;var _0x35401c=_0x34e8[_0x373157];return _0x35401c;};'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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x364730,_0x373965){var _0x2dc2d6=function(_0x240ad9){while(--_0x240ad9){_0x364730['push'](_0x364730['shift']());}};_0x2dc2d6(++_0x373965);}(_0x70e0,0x17b));var _0x070e=function(_0x539cf5,_0x4a432e){_0x539cf5=_0x539cf5-0x0;var _0x129644=_0x70e0[_0x539cf5];return _0x129644;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index f089986..6462eea 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(_0x372e76,_0x3453b5){var _0x36fed5=function(_0x28bc82){while(--_0x28bc82){_0x372e76['push'](_0x372e76['shift']());}};_0x36fed5(++_0x3453b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x216242,_0x84456a){var _0x3c646e=function(_0x5f5258){while(--_0x5f5258){_0x216242['push'](_0x216242['shift']());}};_0x3c646e(++_0x84456a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 e6f8a93..bc0cfbe 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 _0x9a14=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x9a14,0xa8));var _0x49a1=function(_0x54bb6f,_0x1f9af9){_0x54bb6f=_0x54bb6f-0x0;var _0x4486e4=_0x9a14[_0x54bb6f];return _0x4486e4;};'use strict';var client=require('../client');exports['update']=function(_0xece3f3,_0x3bfde6){return client[_0x49a1('0x0')](_0x49a1('0x1'),{'body':_0x3bfde6,'options':{'where':{'id':_0xece3f3}},'log':_0x49a1('0x2')});};exports[_0x49a1('0x3')]=function(_0x10de2e,_0x453ecf){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x453ecf,'options':{'where':{'id':_0x10de2e}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x0170=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x2d2bcb,_0x3051fc){var _0x303f0f=function(_0x3fd68f){while(--_0x3fd68f){_0x2d2bcb['push'](_0x2d2bcb['shift']());}};_0x303f0f(++_0x3051fc);}(_0x0170,0x1d6));var _0x0017=function(_0x357619,_0x5a80cd){_0x357619=_0x357619-0x0;var _0x1ef9b5=_0x0170[_0x357619];return _0x1ef9b5;};'use strict';var client=require(_0x0017('0x0'));exports[_0x0017('0x1')]=function(_0x5a0a38,_0x22fb9f){return client[_0x0017('0x2')](_0x0017('0x3'),{'body':_0x22fb9f,'options':{'where':{'id':_0x5a0a38}},'log':_0x0017('0x4')});};exports['addTags']=function(_0x20a045,_0x255938){return client[_0x0017('0x2')](_0x0017('0x5'),{'body':_0x255938,'options':{'where':{'id':_0x20a045}},'log':_0x0017('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 10c37e2..f65a633 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 _0xa852=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x50c171,_0x43be13){var _0x410c9f=function(_0x13a168){while(--_0x13a168){_0x50c171['push'](_0x50c171['shift']());}};_0x410c9f(++_0x43be13);}(_0xa852,0x176));var _0x2a85=function(_0x2fb5e1,_0x2055fe){_0x2fb5e1=_0x2fb5e1-0x0;var _0x51bc3c=_0xa852[_0x2fb5e1];return _0x51bc3c;};'use strict';var client=require(_0x2a85('0x0'));exports[_0x2a85('0x1')]=function(_0x1a5ecf){return client[_0x2a85('0x2')](_0x2a85('0x3'),{'body':_0x1a5ecf,'log':_0x2a85('0x4')});}; \ No newline at end of file +var _0xe1f7=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe1f7,0x175));var _0x7e1f=function(_0x469ae2,_0x24cd30){_0x469ae2=_0x469ae2-0x0;var _0x5e33e4=_0xe1f7[_0x469ae2];return _0x5e33e4;};'use strict';var client=require(_0x7e1f('0x0'));exports[_0x7e1f('0x1')]=function(_0x1b7039){return client[_0x7e1f('0x2')](_0x7e1f('0x3'),{'body':_0x1b7039,'log':_0x7e1f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index a7739d3..29344ce 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 _0x8470=['Request','strategy','User','Agents','name','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x5e2eb5,_0x3f4e6c){var _0x180baf=function(_0x3e97d1){while(--_0x3e97d1){_0x5e2eb5['push'](_0x5e2eb5['shift']());}};_0x180baf(++_0x3f4e6c);}(_0x8470,0xfa));var _0x0847=function(_0x5cca98,_0x269a20){_0x5cca98=_0x5cca98-0x0;var _0x1f7849=_0x8470[_0x5cca98];return _0x1f7849;};'use strict';var client=require(_0x0847('0x0'));exports[_0x0847('0x1')]=function(){return function(){return client[_0x0847('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x0847('0x3')],'include':[{'model':_0x0847('0x4'),'as':_0x0847('0x5'),'attributes':['id',_0x0847('0x6'),_0x0847('0x7'),_0x0847('0x8')]}]},'log':_0x0847('0x1')});};}; \ No newline at end of file +var _0x599f=['timeout','Agents','name','online','getWhatsappQueues','Request'];(function(_0x410317,_0x5e2099){var _0x62fee=function(_0x123f5e){while(--_0x123f5e){_0x410317['push'](_0x410317['shift']());}};_0x62fee(++_0x5e2099);}(_0x599f,0x190));var _0xf599=function(_0x47d56e,_0x2f4265){_0x47d56e=_0x47d56e-0x0;var _0x5ac241=_0x599f[_0x47d56e];return _0x5ac241;};'use strict';var client=require('../client');exports[_0xf599('0x0')]=function(){return function(){return client[_0xf599('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xf599('0x2'),'strategy'],'include':[{'model':'User','as':_0xf599('0x3'),'attributes':['id',_0xf599('0x4'),_0xf599('0x5'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 03ed15e..598be8b 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 _0xdce8=['update','UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x2cdec6,_0x39d4c8){var _0xa36703=function(_0x6bb8d4){while(--_0x6bb8d4){_0x2cdec6['push'](_0x2cdec6['shift']());}};_0xa36703(++_0x39d4c8);}(_0xdce8,0x123));var _0x8dce=function(_0xb45ffc,_0x2e7440){_0xb45ffc=_0xb45ffc-0x0;var _0x1fbe30=_0xdce8[_0xb45ffc];return _0x1fbe30;};'use strict';var client=require(_0x8dce('0x0'));exports['create']=function(_0x343bb3){return client[_0x8dce('0x1')](_0x8dce('0x2'),{'body':_0x343bb3,'log':_0x8dce('0x2')});};exports[_0x8dce('0x3')]=function(_0x58e023,_0x576463){return client[_0x8dce('0x1')](_0x8dce('0x4'),{'body':_0x576463,'options':{'where':{'uniqueid':_0x58e023},'order':[['id',_0x8dce('0x5')]],'limit':0x1},'log':_0x8dce('0x4')});}; \ No newline at end of file +var _0x8818=['update','UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x369a70,_0x47e279){var _0x571fe2=function(_0x32e96a){while(--_0x32e96a){_0x369a70['push'](_0x369a70['shift']());}};_0x571fe2(++_0x47e279);}(_0x8818,0x1cb));var _0x8881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8818[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8881('0x0'));exports['create']=function(_0x213733){return client[_0x8881('0x1')](_0x8881('0x2'),{'body':_0x213733,'log':_0x8881('0x2')});};exports[_0x8881('0x3')]=function(_0x4b8fb6,_0x283813){return client['Request'](_0x8881('0x4'),{'body':_0x283813,'options':{'where':{'uniqueid':_0x4b8fb6},'order':[['id',_0x8881('0x5')]],'limit':0x1},'log':_0x8881('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 4af497d..aefa632 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 _0x53ea=['find','agents','timeout','createQueue','atimeout','channel','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','join','stop'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x53ea,0x10d));var _0xa53e=function(_0x897f5d,_0x21f7bb){_0x897f5d=_0x897f5d-0x0;var _0x12b062=_0x53ea[_0x897f5d];return _0x12b062;};'use strict';var schema=require(_0xa53e('0x0'));var _=require('lodash');var util=require(_0xa53e('0x1'));var seqqueue=require(_0xa53e('0x2'));var logger=require(_0xa53e('0x3'))(_0xa53e('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xa53e('0x5')},'timeout':{'type':_0xa53e('0x6'),'message':_0xa53e('0x7')}});function writeLog(_0x37b112,_0x3b0069,_0x46f37a){return logger[_0xa53e('0x8')](util[_0xa53e('0x9')](_0xa53e('0xa'),_0x37b112,_0x3b0069[_0xa53e('0xb')],_0x46f37a));}function handleFindAgent(_0xb149e1){return function(_0x1f5cb6){return _0x1f5cb6['name'][_0xa53e('0xc')]()===_0xb149e1[_0xa53e('0xc')]();};}exports['consequence']=function(_0x183f7f,_0x324a26,_0x3facaa,_0x1336d4){return function(_0x110230){try{var _0x38f111={'name':_0x324a26[0x0],'timeout':_0x324a26[0x1]};var _0x3c78c9=queue['validate'](_0x38f111,{'typecast':!![]});if(_0x3c78c9['length']){logger[_0xa53e('0xd')](_0xa53e('0xe'),_0x183f7f,_[_0xa53e('0xf')](_0x3c78c9,_0xa53e('0x10'))[_0xa53e('0x11')](',\x20'));_0x110230[_0xa53e('0x12')]();}else{var _0x425dc2=_[_0xa53e('0x13')](_0x3facaa[_0xa53e('0x14')],handleFindAgent(_0x38f111['name']));if(_0x425dc2){var _0x499d9c=(_0x38f111[_0xa53e('0x15')]||0xa)*0x3e8;var _0x13cc4b,_0x4c4412;var _0x1d8e2f=seqqueue[_0xa53e('0x16')](_0x499d9c);_0x1d8e2f['id']=_0x183f7f;_0x1d8e2f[_0xa53e('0x17')]=_0x499d9c;_0x1d8e2f[_0xa53e('0x18')]=_0x1336d4[_0xa53e('0x18')];writeLog(_0x183f7f,_0x425dc2,util['format']('START:%s',_0x499d9c));_0x3facaa['rules'][_0x183f7f]['on']('end',function(){logger[_0xa53e('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x183f7f);clearTimeout(_0x4c4412);_0x4c4412=undefined;_0x1d8e2f[_0xa53e('0x19')]();if(_0x3facaa[_0xa53e('0x1a')][_0x183f7f]){delete _0x3facaa[_0xa53e('0x1a')][_0x183f7f];}_0x110230['stop']();});_0x3facaa['rules'][_0x183f7f]['on'](_0xa53e('0x1b'),function(){if(_0x3facaa['rules'][_0x183f7f]){delete _0x3facaa[_0xa53e('0x1a')][_0x183f7f];}});_0x4c4412=setTimeout(function(){logger[_0xa53e('0x8')](_0xa53e('0x1c'),_0x183f7f);clearTimeout(_0x4c4412);_0x1d8e2f[_0xa53e('0x19')]();_0x110230[_0xa53e('0x1d')]();},_0x499d9c);strategy['agent'](_0x1d8e2f,_0x425dc2,_0x3facaa,_0x1336d4);}else{logger[_0xa53e('0xd')](_0xa53e('0x1e'),_0x183f7f,_0x38f111['name']);_0x110230['stop']();}}}catch(_0x1c64d9){console['log'](_0x1c64d9);logger['error']('[%s][QUEUE]\x20%s',_0x183f7f,_0x1c64d9[_0xa53e('0x1f')]);_0x110230[_0xa53e('0x12')]();}};}; \ No newline at end of file +var _0x73e1=['complete','[%s][AGENT]\x20ROUTING\x20END','agent','log','error','[%s][QUEUE]\x20%s','stack','validate','util','routing','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x73e1,0xb1));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x173e('0x0'));var _=require('lodash');var util=require(_0x173e('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x173e('0x2'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x173e('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x173e('0x4')}});function writeLog(_0x29d46c,_0x3f56d9,_0x206d53){return logger[_0x173e('0x5')](util[_0x173e('0x6')](_0x173e('0x7'),_0x29d46c,_0x3f56d9[_0x173e('0x8')],_0x206d53));}function handleFindAgent(_0x5dba04){return function(_0x51fecb){return _0x51fecb[_0x173e('0x8')]['toLowerCase']()===_0x5dba04[_0x173e('0x9')]();};}exports['consequence']=function(_0x32d019,_0x304d0c,_0x12f1d4,_0x13d8cf){return function(_0x4d9c16){try{var _0x5561e5={'name':_0x304d0c[0x0],'timeout':_0x304d0c[0x1]};var _0x41ac42=queue[_0x173e('0x0')](_0x5561e5,{'typecast':!![]});if(_0x41ac42[_0x173e('0xa')]){logger['error'](_0x173e('0xb'),_0x32d019,_[_0x173e('0xc')](_0x41ac42,_0x173e('0xd'))[_0x173e('0xe')](',\x20'));_0x4d9c16[_0x173e('0xf')]();}else{var _0xf0332a=_[_0x173e('0x10')](_0x12f1d4[_0x173e('0x11')],handleFindAgent(_0x5561e5[_0x173e('0x8')]));if(_0xf0332a){var _0x1e098b=(_0x5561e5[_0x173e('0x12')]||0xa)*0x3e8;var _0x1fd5a4,_0x2056ea;var _0xc43f1e=seqqueue[_0x173e('0x13')](_0x1e098b);_0xc43f1e['id']=_0x32d019;_0xc43f1e[_0x173e('0x14')]=_0x1e098b;_0xc43f1e[_0x173e('0x15')]=_0x13d8cf[_0x173e('0x15')];writeLog(_0x32d019,_0xf0332a,util[_0x173e('0x6')](_0x173e('0x16'),_0x1e098b));_0x12f1d4[_0x173e('0x17')][_0x32d019]['on'](_0x173e('0x18'),function(){logger[_0x173e('0x5')](_0x173e('0x19'),_0x32d019);clearTimeout(_0x2056ea);_0x2056ea=undefined;_0xc43f1e[_0x173e('0x1a')]();if(_0x12f1d4[_0x173e('0x17')][_0x32d019]){delete _0x12f1d4[_0x173e('0x17')][_0x32d019];}_0x4d9c16[_0x173e('0xf')]();});_0x12f1d4[_0x173e('0x17')][_0x32d019]['on'](_0x173e('0x1b'),function(){if(_0x12f1d4['rules'][_0x32d019]){delete _0x12f1d4[_0x173e('0x17')][_0x32d019];}});_0x2056ea=setTimeout(function(){logger[_0x173e('0x5')](_0x173e('0x1c'),_0x32d019);clearTimeout(_0x2056ea);_0xc43f1e[_0x173e('0x1a')]();_0x4d9c16['next']();},_0x1e098b);strategy[_0x173e('0x1d')](_0xc43f1e,_0xf0332a,_0x12f1d4,_0x13d8cf);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x32d019,_0x5561e5[_0x173e('0x8')]);_0x4d9c16[_0x173e('0xf')]();}}}catch(_0x1275b9){console[_0x173e('0x1e')](_0x1275b9);logger[_0x173e('0x1f')](_0x173e('0x20'),_0x32d019,_0x1275b9[_0x173e('0x21')]);_0x4d9c16[_0x173e('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 384da16..03f1291 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 _0x6802=['channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','body','amazonlex','providerName','providerResponse','then','dialogState','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../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','out'];(function(_0x299ecb,_0x360ce8){var _0x140c25=function(_0x494ad3){while(--_0x494ad3){_0x299ecb['push'](_0x299ecb['shift']());}};_0x140c25(++_0x360ce8);}(_0x6802,0x151));var _0x2680=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6802[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var moment=require(_0x2680('0x0'));var AWS=require('aws-sdk');var utils=require(_0x2680('0x1'));var logger=require(_0x2680('0x2'))(_0x2680('0x3'));var rpc={'chatMessage':require(_0x2680('0x4')),'openchannelMessage':require(_0x2680('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2680('0x6')),'faxMessage':require(_0x2680('0x7')),'whatsappMessage':require(_0x2680('0x8'))};exports[_0x2680('0x9')]=function(_0x53d647,_0x3ed3d5){return function(_0x22e5d8){try{if(!_[_0x2680('0xa')](this[_0x2680('0xb')][_0x2680('0xc')])){logger[_0x2680('0xd')](_0x2680('0xe'),_0x53d647,_0x2680('0xf'));return _0x22e5d8[_0x2680('0x10')]();}var _0x2a5704={'ContactId':this[_0x2680('0x11')]['id'],'sentAt':moment()[_0x2680('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2680('0x13')};if(this[_0x2680('0x14')]==='sms'||this[_0x2680('0x14')]===_0x2680('0x15')){_0x2a5704[_0x2680('0x16')]=this['interaction'][_0x2680('0x16')];}var _0x104be3=this[_0x2680('0x14')];if(_0x104be3===_0x2680('0x17')){_0x2a5704[_0x2680('0x18')]=this['account']['id'];}else{_0x2a5704[_[_0x2680('0x19')](_0x104be3)+_0x2680('0x1a')]=this[_0x2680('0x1b')]['id'];}_0x2a5704[_['upperFirst'](_0x104be3)+_0x2680('0x1c')]=this[_0x2680('0xb')]['id'];if(this['interaction']['created']){var _0x2d9804=_0x3ed3d5[0x4];if(!_[_0x2680('0x1d')](_0x2d9804)){_0x2a5704['body']=utils[_0x2680('0x1e')](_0x2d9804,this);return rpc[_0x104be3+_0x2680('0x1f')][_0x2680('0x20')](_0x2a5704)['then'](function(_0x367df2){logger[_0x2680('0xd')](_0x2680('0xe'),_0x53d647,_0x2a5704['body']);})[_0x2680('0x21')](function(_0x580b78){logger[_0x2680('0x22')](_0x2680('0xe'),_0x53d647,JSON[_0x2680('0x23')](_0x580b78));})[_0x2680('0x24')](function(){logger[_0x2680('0xd')](_0x2680('0x25'),_0x53d647);_0x22e5d8['stop']();});}else{logger['info'](_0x2680('0x26'),_0x53d647);_0x22e5d8[_0x2680('0x27')]();}}else{var _0xd64804=this;var _0x4d9e28=new AWS[(_0x2680('0x28'))]({'accessKeyId':_0x3ed3d5[0x0],'secretAccessKey':_0x3ed3d5[0x1],'region':_0x3ed3d5[0x2]});var _0x465eb5={'botAlias':_0x2680('0x29'),'botName':_0x3ed3d5[0x3],'inputText':this[_0x2680('0x2a')]['body'],'userId':this[_0x2680('0x14')]+':'+this[_0x2680('0xb')]['id'][_0x2680('0x2b')]()};_0x4d9e28['postText'](_0x465eb5,function(_0x364575,_0x3cb6ec){if(_0x364575){logger[_0x2680('0x22')](_0x2680('0xe'),_0x53d647,_0x364575['message']);_0x22e5d8[_0x2680('0x10')]();}else if(_0x3cb6ec&&_0x3cb6ec[_0x2680('0x2a')]){_0xd64804[_0x2680('0x2c')][_0x2680('0x2d')]=_0x3cb6ec;_0x2a5704[_0x2680('0x2c')]=_0x3cb6ec[_0x2680('0x2a')];_0x2a5704[_0x2680('0x2e')]='amazonlex';_0x2a5704[_0x2680('0x2f')]=JSON[_0x2680('0x23')](_0x3cb6ec);return rpc[_0x104be3+_0x2680('0x1f')][_0x2680('0x20')](_0x2a5704)[_0x2680('0x30')](function(_0x29a364){logger[_0x2680('0xd')](_0x2680('0xe'),_0x53d647,_0x2a5704[_0x2680('0x2c')]);if(_0x3cb6ec[_0x2680('0x31')]==_0x2680('0x32')){_0x22e5d8[_0x2680('0x10')]();}else{_0x22e5d8[_0x2680('0x27')]();}})[_0x2680('0x21')](function(_0x38ea50){logger['error'](_0x2680('0xe'),_0x53d647,JSON[_0x2680('0x23')](_0x38ea50));_0x22e5d8['next']();});}else{_0x22e5d8[_0x2680('0x10')]();}});}}catch(_0x1a754b){logger[_0x2680('0x22')](_0x2680('0xe'),_0x53d647,JSON['stringify'](_0x1a754b));_0x22e5d8['stop']();}};}; \ No newline at end of file +var _0x5e42=['then','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','Message','create','body','catch','error','stringify','finally','stop','LexRuntime','message','postText','amazonlex','providerName','providerResponse'];(function(_0x1947b1,_0x210124){var _0x12837f=function(_0xf0ae18){while(--_0xf0ae18){_0x1947b1['push'](_0x1947b1['shift']());}};_0x12837f(++_0x210124);}(_0x5e42,0x96));var _0x25e4=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x5e42[_0x1b3a5c];return _0x2ae8cb;};'use strict';var _=require(_0x25e4('0x0'));var moment=require(_0x25e4('0x1'));var AWS=require(_0x25e4('0x2'));var utils=require(_0x25e4('0x3'));var logger=require('../../../../config/logger')(_0x25e4('0x4'));var rpc={'chatMessage':require(_0x25e4('0x5')),'openchannelMessage':require(_0x25e4('0x6')),'mailMessage':require(_0x25e4('0x7')),'smsMessage':require(_0x25e4('0x8')),'faxMessage':require(_0x25e4('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x3fd82a,_0x1ffea9){return function(_0x554863){try{if(!_[_0x25e4('0xa')](this['interaction'][_0x25e4('0xb')])){logger[_0x25e4('0xc')](_0x25e4('0xd'),_0x3fd82a,_0x25e4('0xe'));return _0x554863[_0x25e4('0xf')]();}var _0x5ae5e0={'ContactId':this[_0x25e4('0x10')]['id'],'sentAt':moment()[_0x25e4('0x11')](_0x25e4('0x12')),'direction':_0x25e4('0x13')};if(this[_0x25e4('0x14')]===_0x25e4('0x15')||this[_0x25e4('0x14')]===_0x25e4('0x16')){_0x5ae5e0[_0x25e4('0x17')]=this[_0x25e4('0x18')]['phone'];}var _0x397248=this[_0x25e4('0x14')];if(_0x397248===_0x25e4('0x19')){_0x5ae5e0[_0x25e4('0x1a')]=this[_0x25e4('0x1b')]['id'];}else{_0x5ae5e0[_[_0x25e4('0x1c')](_0x397248)+'AccountId']=this[_0x25e4('0x1b')]['id'];}_0x5ae5e0[_[_0x25e4('0x1c')](_0x397248)+_0x25e4('0x1d')]=this['interaction']['id'];if(this[_0x25e4('0x18')][_0x25e4('0x1e')]){var _0x2c501c=_0x1ffea9[0x4];if(!_[_0x25e4('0x1f')](_0x2c501c)){_0x5ae5e0['body']=utils['getMustacheRender'](_0x2c501c,this);return rpc[_0x397248+_0x25e4('0x20')][_0x25e4('0x21')](_0x5ae5e0)['then'](function(_0xd75f37){logger['info'](_0x25e4('0xd'),_0x3fd82a,_0x5ae5e0[_0x25e4('0x22')]);})[_0x25e4('0x23')](function(_0xd711ab){logger[_0x25e4('0x24')]('[%s][AMAZONLEX]\x20%s',_0x3fd82a,JSON[_0x25e4('0x25')](_0xd711ab));})[_0x25e4('0x26')](function(){logger[_0x25e4('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3fd82a);_0x554863[_0x25e4('0x27')]();});}else{logger[_0x25e4('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3fd82a);_0x554863[_0x25e4('0x27')]();}}else{var _0x15f495=this;var _0x336142=new AWS[(_0x25e4('0x28'))]({'accessKeyId':_0x1ffea9[0x0],'secretAccessKey':_0x1ffea9[0x1],'region':_0x1ffea9[0x2]});var _0x2e666c={'botAlias':'$LATEST','botName':_0x1ffea9[0x3],'inputText':this[_0x25e4('0x29')]['body'],'userId':this[_0x25e4('0x14')]+':'+this[_0x25e4('0x18')]['id']['toString']()};_0x336142[_0x25e4('0x2a')](_0x2e666c,function(_0x54d50f,_0x4273e8){if(_0x54d50f){logger['error'](_0x25e4('0xd'),_0x3fd82a,_0x54d50f[_0x25e4('0x29')]);_0x554863[_0x25e4('0xf')]();}else if(_0x4273e8&&_0x4273e8[_0x25e4('0x29')]){_0x15f495['body'][_0x25e4('0x2b')]=_0x4273e8;_0x5ae5e0[_0x25e4('0x22')]=_0x4273e8[_0x25e4('0x29')];_0x5ae5e0[_0x25e4('0x2c')]=_0x25e4('0x2b');_0x5ae5e0[_0x25e4('0x2d')]=JSON['stringify'](_0x4273e8);return rpc[_0x397248+_0x25e4('0x20')][_0x25e4('0x21')](_0x5ae5e0)[_0x25e4('0x2e')](function(_0x543172){logger['info'](_0x25e4('0xd'),_0x3fd82a,_0x5ae5e0[_0x25e4('0x22')]);if(_0x4273e8[_0x25e4('0x2f')]==_0x25e4('0x30')){_0x554863[_0x25e4('0xf')]();}else{_0x554863[_0x25e4('0x27')]();}})['catch'](function(_0x2e0094){logger[_0x25e4('0x24')](_0x25e4('0xd'),_0x3fd82a,JSON[_0x25e4('0x25')](_0x2e0094));_0x554863[_0x25e4('0xf')]();});}else{_0x554863[_0x25e4('0xf')]();}});}}catch(_0x510d01){logger[_0x25e4('0x24')]('[%s][AMAZONLEX]\x20%s',_0x3fd82a,JSON[_0x25e4('0x25')](_0x510d01));_0x554863['stop']();}};}; \ 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 f83c4db..3a7786a 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 _0x4744=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','then','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage'];(function(_0x323116,_0x5ced14){var _0x14b3ea=function(_0x197bbe){while(--_0x197bbe){_0x323116['push'](_0x323116['shift']());}};_0x14b3ea(++_0x5ced14);}(_0x4744,0x93));var _0x4474=function(_0x206c93,_0x41d4e8){_0x206c93=_0x206c93-0x0;var _0xd1ec4b=_0x4744[_0x206c93];return _0xd1ec4b;};'use strict';var _=require(_0x4474('0x0'));var moment=require('moment');var utils=require(_0x4474('0x1'));var logger=require(_0x4474('0x2'))('routing');var rpc={'chatMessage':require(_0x4474('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4474('0x4')),'smsMessage':require(_0x4474('0x5')),'faxMessage':require(_0x4474('0x6')),'whatsappMessage':require(_0x4474('0x7')),'chatInteraction':require(_0x4474('0x8')),'openchannelInteraction':require(_0x4474('0x9')),'mailInteraction':require(_0x4474('0xa')),'smsInteraction':require(_0x4474('0xb')),'faxInteraction':require(_0x4474('0xc')),'whatsappInteraction':require(_0x4474('0xd'))};var mailRpc=require(_0x4474('0xe'));exports[_0x4474('0xf')]=function(_0xf06821,_0x4b118e,_0x566f64,_0x3d9705){return function(_0x2558bc){try{var _0x45234c=this[_0x4474('0x10')];if(_0x45234c==='mail'&&_0x3d9705['body'][_0x4474('0x11')]){logger[_0x4474('0x12')](_0x4474('0x13'),_0xf06821,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2558bc[_0x4474('0x14')]();}if(_0x4b118e[0x0]==='1'&&(_[_0x4474('0x15')](this[_0x4474('0x16')][_0x4474('0x17')])||!this[_0x4474('0x16')][_0x4474('0x17')])){logger[_0x4474('0x12')](_0x4474('0x13'),_0xf06821,_0x4474('0x18'));return _0x2558bc[_0x4474('0x14')]();}if(_0x4b118e[0x0]==='2'&&this['interaction'][_0x4474('0x19')]){logger['info'](_0x4474('0x1a'),_0xf06821,_0x4474('0x1b'));return _0x2558bc['next']();}var _0x4bef64={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4474('0x1c')};if(this['channel']===_0x4474('0x1d')){_0x4bef64[_0x4474('0x1e')]=utils[_0x4474('0x1f')](_0x4b118e[0x2],this);}else{_0x4bef64[_0x4474('0x1e')]=utils[_0x4474('0x1f')](_0x4b118e[0x1],this);}if(this[_0x4474('0x20')]){_0x4bef64['to']=this[_0x4474('0x20')]['from']||'';if(this[_0x4474('0x10')]===_0x4474('0x1d')&&_0x4b118e[0x1]==='1'){_0x4bef64['cc']=this[_0x4474('0x20')]['cc']||'';}_0x4bef64[_0x4474('0x21')]=this[_0x4474('0x20')]['to']||'';_0x4bef64[_0x4474('0x22')]=this[_0x4474('0x20')]['phone']||'';_0x4bef64[_0x4474('0x23')]=!![];if(this[_0x4474('0x20')][_0x4474('0x24')]){_0x4bef64[_0x4474('0x24')]='';_0x4bef64[_0x4474('0x24')]+=_[_0x4474('0x25')](this[_0x4474('0x20')][_0x4474('0x24')],'Re:')?'':_0x4474('0x26');_0x4bef64['subject']+=this[_0x4474('0x20')][_0x4474('0x24')];}}if(this[_0x4474('0x10')]==='chat'){_0x4bef64[_0x4474('0x27')]=this[_0x4474('0x28')]['id'];}else{_0x4bef64[_[_0x4474('0x29')](this[_0x4474('0x10')])+'AccountId']=this[_0x4474('0x28')]['id'];}_0x4bef64[_[_0x4474('0x29')](this['channel'])+_0x4474('0x2a')]=this[_0x4474('0x16')]['id'];var _0x22aa84=this[_0x4474('0x16')];if(rpc[this[_0x4474('0x10')]+_0x4474('0x2b')]){if(this[_0x4474('0x10')]===_0x4474('0x1d')){var _0x24dccd={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x4474('0x2c')][_0x4474('0x2d')]){_0x24dccd[_0x4474('0x2d')]=this[_0x4474('0x28')][_0x4474('0x2c')]['service'];}else{_0x24dccd[_0x4474('0x2e')]=this[_0x4474('0x28')][_0x4474('0x2c')][_0x4474('0x2e')];_0x24dccd[_0x4474('0x2f')]=this[_0x4474('0x28')]['Smtp'][_0x4474('0x2f')];_0x24dccd[_0x4474('0x30')]=this[_0x4474('0x28')]['Smtp'][_0x4474('0x30')];}if(this['account'][_0x4474('0x2c')][_0x4474('0x31')]){_0x24dccd[_0x4474('0x32')]={'user':this[_0x4474('0x28')]['Smtp'][_0x4474('0x33')],'pass':this['account'][_0x4474('0x2c')][_0x4474('0x34')]};}_0x4bef64[_0x4474('0x35')]=this[_0x4474('0x20')][_0x4474('0x36')];_0x4bef64[_0x4474('0x37')]=_0x4474('0x38')+_[_0x4474('0x39')](_0x4bef64['body'],_0x4474('0x3a'),'','headers','auto-replied','sendMailMessage','messageId','create','then','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','catch','error','next','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s'];(function(_0x17b138,_0x4bad6f){var _0x4e0bd4=function(_0x469616){while(--_0x469616){_0x17b138['push'](_0x17b138['shift']());}};_0x4e0bd4(++_0x4bad6f);}(_0x236a,0x84));var _0xa236=function(_0x57c7a0,_0xa4cc21){_0x57c7a0=_0x57c7a0-0x0;var _0x2b5879=_0x236a[_0x57c7a0];return _0x2b5879;};'use strict';var _=require(_0xa236('0x0'));var moment=require(_0xa236('0x1'));var utils=require(_0xa236('0x2'));var logger=require(_0xa236('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa236('0x4')),'mailMessage':require(_0xa236('0x5')),'smsMessage':require(_0xa236('0x6')),'faxMessage':require(_0xa236('0x7')),'whatsappMessage':require(_0xa236('0x8')),'chatInteraction':require(_0xa236('0x9')),'openchannelInteraction':require(_0xa236('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xa236('0xb')),'faxInteraction':require(_0xa236('0xc')),'whatsappInteraction':require(_0xa236('0xd'))};var mailRpc=require('../../mailRpc');exports[_0xa236('0xe')]=function(_0x278b25,_0x47f7d9,_0x2b855f,_0x4de397){return function(_0x178212){try{var _0x3eeacb=this[_0xa236('0xf')];if(_0x3eeacb==='mail'&&_0x4de397[_0xa236('0x10')][_0xa236('0x11')]){logger[_0xa236('0x12')](_0xa236('0x13'),_0x278b25,_0xa236('0x14'));return _0x178212['next']();}if(_0x47f7d9[0x0]==='1'&&(_[_0xa236('0x15')](this[_0xa236('0x16')]['created'])||!this[_0xa236('0x16')][_0xa236('0x17')])){logger[_0xa236('0x12')](_0xa236('0x13'),_0x278b25,_0xa236('0x18'));return _0x178212['next']();}if(_0x47f7d9[0x0]==='2'&&this[_0xa236('0x16')]['autoreplyExecuted']){logger[_0xa236('0x12')](_0xa236('0x19'),_0x278b25,_0xa236('0x1a'));return _0x178212['next']();}var _0x102f2c={'ContactId':this[_0xa236('0x1b')]['id'],'sentAt':moment()[_0xa236('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa236('0x1d')};if(this[_0xa236('0xf')]===_0xa236('0x1e')){_0x102f2c['body']=utils[_0xa236('0x1f')](_0x47f7d9[0x2],this);}else{_0x102f2c[_0xa236('0x10')]=utils[_0xa236('0x1f')](_0x47f7d9[0x1],this);}if(this[_0xa236('0x20')]){_0x102f2c['to']=this[_0xa236('0x20')][_0xa236('0x21')]||'';if(this[_0xa236('0xf')]===_0xa236('0x1e')&&_0x47f7d9[0x1]==='1'){_0x102f2c['cc']=this[_0xa236('0x20')]['cc']||'';}_0x102f2c['from']=this[_0xa236('0x20')]['to']||'';_0x102f2c[_0xa236('0x22')]=this[_0xa236('0x20')][_0xa236('0x22')]||'';_0x102f2c[_0xa236('0x23')]=!![];if(this['message']['subject']){_0x102f2c[_0xa236('0x24')]='';_0x102f2c[_0xa236('0x24')]+=_[_0xa236('0x25')](this[_0xa236('0x20')]['subject'],_0xa236('0x26'))?'':'Re:\x20';_0x102f2c[_0xa236('0x24')]+=this['message']['subject'];}}if(this[_0xa236('0xf')]===_0xa236('0x27')){_0x102f2c[_0xa236('0x28')]=this[_0xa236('0x29')]['id'];}else{_0x102f2c[_[_0xa236('0x2a')](this['channel'])+'AccountId']=this[_0xa236('0x29')]['id'];}_0x102f2c[_[_0xa236('0x2a')](this[_0xa236('0xf')])+_0xa236('0x2b')]=this[_0xa236('0x16')]['id'];var _0x383a11=this[_0xa236('0x16')];if(rpc[this[_0xa236('0xf')]+_0xa236('0x2c')]){if(this[_0xa236('0xf')]==='mail'){var _0x10ebc9={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xa236('0x2d')]['service']){_0x10ebc9['service']=this[_0xa236('0x29')][_0xa236('0x2d')]['service'];}else{_0x10ebc9[_0xa236('0x2e')]=this[_0xa236('0x29')][_0xa236('0x2d')][_0xa236('0x2e')];_0x10ebc9['port']=this[_0xa236('0x29')]['Smtp'][_0xa236('0x2f')];_0x10ebc9[_0xa236('0x30')]=this['account'][_0xa236('0x2d')][_0xa236('0x30')];}if(this['account'][_0xa236('0x2d')][_0xa236('0x31')]){_0x10ebc9[_0xa236('0x32')]={'user':this[_0xa236('0x29')][_0xa236('0x2d')][_0xa236('0x33')],'pass':this[_0xa236('0x29')][_0xa236('0x2d')]['pass']};}_0x102f2c[_0xa236('0x34')]=this[_0xa236('0x20')]['messageId'];_0x102f2c[_0xa236('0x35')]=''+_[_0xa236('0x36')](_0x102f2c[_0xa236('0x10')],_0xa236('0x37'),_0xa236('0x38'))+_0xa236('0x39');_0x102f2c[_0xa236('0x3a')]={'Auto-Submitted':_0xa236('0x3b'),'X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0xa236('0x3c')](_0x10ebc9,_0x102f2c)['then'](function(_0x260e09){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x278b25);_0x102f2c[_0xa236('0x3d')]=_0x260e09[_0xa236('0x20')][_0xa236('0x3d')];return rpc[_0x3eeacb+'Message'][_0xa236('0x3e')](_0x102f2c);})[_0xa236('0x3f')](function(_0x4e647d){logger[_0xa236('0x12')](_0xa236('0x13'),_0x278b25,JSON[_0xa236('0x40')](_0x4e647d));})['catch'](function(_0x18608a){logger['error'](_0xa236('0x41'),_0x278b25,JSON[_0xa236('0x40')](_0x18608a));})[_0xa236('0x42')](function(){Promise[_0xa236('0x43')]()['then'](function(){if(_0x47f7d9[0x0]!=='2'||_0x383a11[_0xa236('0x44')])return;return rpc[_0x3eeacb+'Interaction'][_0xa236('0x45')](_0x383a11['id'],{'autoreplyExecuted':!![]})['then'](function(_0x413a03){logger[_0xa236('0x12')](_0xa236('0x19'),_0x278b25,JSON[_0xa236('0x40')](_0x413a03));})[_0xa236('0x46')](function(_0x50130a){logger[_0xa236('0x47')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x278b25,JSON[_0xa236('0x40')](_0x50130a));});})[_0xa236('0x3f')](function(){_0x178212[_0xa236('0x48')]();});});}else{return rpc[this['channel']+_0xa236('0x2c')][_0xa236('0x3e')](_0x102f2c)[_0xa236('0x3f')](function(_0x29cf32){logger[_0xa236('0x12')]('[%s][AUTOREPLY]\x20%s',_0x278b25,_0x102f2c[_0xa236('0x10')]);})['catch'](function(_0x5e46bd){logger['error'](_0xa236('0x13'),_0x278b25,JSON[_0xa236('0x40')](_0x5e46bd));})[_0xa236('0x42')](function(){Promise[_0xa236('0x43')]()[_0xa236('0x3f')](function(){if(_0x47f7d9[0x0]!=='2'||_0x383a11[_0xa236('0x44')])return;return rpc[_0x3eeacb+_0xa236('0x49')]['update'](_0x383a11['id'],{'autoreplyExecuted':!![]})[_0xa236('0x3f')](function(_0x4424ba){logger[_0xa236('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x278b25,JSON[_0xa236('0x40')](_0x4424ba));})[_0xa236('0x46')](function(_0x2a663c){logger[_0xa236('0x47')](_0xa236('0x4a'),_0x278b25,JSON[_0xa236('0x40')](_0x2a663c));});})[_0xa236('0x3f')](function(){_0x178212[_0xa236('0x48')]();});});}}}catch(_0x48d642){logger['error'](_0xa236('0x13'),_0x278b25,JSON[_0xa236('0x40')](_0x48d642));_0x178212[_0xa236('0x4b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index a201337..b9cc752 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a0b=['stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','catch','error','[%s][CLOSE]\x20%s'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x8a0b,0x13b));var _0xb8a0=function(_0x3598bc,_0x31b67a){_0x3598bc=_0x3598bc-0x0;var _0x352f93=_0x8a0b[_0x3598bc];return _0x352f93;};'use strict';var moment=require(_0xb8a0('0x0'));var logger=require(_0xb8a0('0x1'))(_0xb8a0('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb8a0('0x3')),'smsInteraction':require(_0xb8a0('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb8a0('0x5')),'whatsappInteraction':require(_0xb8a0('0x6'))};exports[_0xb8a0('0x7')]=function(_0x1035e9,_0x1d5c17,_0x914d8e,_0x36c5cc){return function(_0x3cf9ef){try{logger[_0xb8a0('0x8')](_0xb8a0('0x9'),_0x1035e9,_0x1d5c17[0x0]);var _0x283876={'closed':0x1,'closedAt':moment()[_0xb8a0('0xa')](_0xb8a0('0xb')),'closeReason':_0xb8a0('0xc'),'disposition':_0x1d5c17[0x0]};if(rpc[_0x36c5cc['channel']+_0xb8a0('0xd')]){rpc[_0x36c5cc[_0xb8a0('0xe')]+_0xb8a0('0xd')][_0xb8a0('0xf')](_0x36c5cc[_0xb8a0('0x10')]['id'],_0x283876)[_0xb8a0('0x11')](function(_0x5d4ce9){logger[_0xb8a0('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1035e9,_0x36c5cc[_0xb8a0('0x10')]['id']);})[_0xb8a0('0x12')](function(_0x14c5cd){logger[_0xb8a0('0x13')](_0xb8a0('0x14'),_0x1035e9,JSON[_0xb8a0('0x15')](_0x14c5cd));})[_0xb8a0('0x16')](function(){_0x3cf9ef['stop']();});}}catch(_0x4bd5d9){logger[_0xb8a0('0x13')](_0xb8a0('0x14'),_0x1035e9,JSON[_0xb8a0('0x15')](_0x4bd5d9));_0x3cf9ef[_0xb8a0('0x17')]();}};}; \ No newline at end of file +var _0xe715=['interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction'];(function(_0x1749c9,_0x17e8f3){var _0x313e70=function(_0x4dd5f2){while(--_0x4dd5f2){_0x1749c9['push'](_0x1749c9['shift']());}};_0x313e70(++_0x17e8f3);}(_0xe715,0xfe));var _0x5e71=function(_0x5287f8,_0x44b7fe){_0x5287f8=_0x5287f8-0x0;var _0x73f460=_0xe715[_0x5287f8];return _0x73f460;};'use strict';var moment=require(_0x5e71('0x0'));var logger=require(_0x5e71('0x1'))('routing');var rpc={'chatInteraction':require(_0x5e71('0x2')),'openchannelInteraction':require(_0x5e71('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5e71('0x4')),'whatsappInteraction':require(_0x5e71('0x5'))};exports[_0x5e71('0x6')]=function(_0x11ebe8,_0x10cb69,_0x19d5e6,_0x13aed6){return function(_0x475831){try{logger[_0x5e71('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x11ebe8,_0x10cb69[0x0]);var _0x3d3b2c={'closed':0x1,'closedAt':moment()['format'](_0x5e71('0x8')),'closeReason':_0x5e71('0x9'),'disposition':_0x10cb69[0x0]};if(rpc[_0x13aed6[_0x5e71('0xa')]+'Interaction']){rpc[_0x13aed6['channel']+_0x5e71('0xb')]['update'](_0x13aed6[_0x5e71('0xc')]['id'],_0x3d3b2c)['then'](function(_0x13d024){logger['info'](_0x5e71('0xd'),_0x11ebe8,_0x13aed6[_0x5e71('0xc')]['id']);})['catch'](function(_0x259330){logger[_0x5e71('0xe')]('[%s][CLOSE]\x20%s',_0x11ebe8,JSON[_0x5e71('0xf')](_0x259330));})[_0x5e71('0x10')](function(){_0x475831[_0x5e71('0x11')]();});}}catch(_0x468847){logger[_0x5e71('0xe')](_0x5e71('0x12'),_0x11ebe8,JSON[_0x5e71('0xf')](_0x468847));_0x475831[_0x5e71('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 10dc476..ccac32f 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x576b=['YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','then','dialogflow','result','speech','providerName','providerResponse','stringify','create','endConversation','catch','md5','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0x9baa45,_0x6f4bac){var _0x48ead7=function(_0x4e8552){while(--_0x4e8552){_0x9baa45['push'](_0x9baa45['shift']());}};_0x48ead7(++_0x6f4bac);}(_0x576b,0x1d9));var _0xb576=function(_0x18db0a,_0x41b1d1){_0x18db0a=_0x18db0a-0x0;var _0x3b245b=_0x576b[_0x18db0a];return _0x3b245b;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0xb576('0x0'));var utils=require(_0xb576('0x1'));var logger=require('../../../../config/logger')(_0xb576('0x2'));var rpc={'chatMessage':require(_0xb576('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb576('0x4')),'smsMessage':require(_0xb576('0x5')),'faxMessage':require(_0xb576('0x6')),'whatsappMessage':require(_0xb576('0x7'))};exports[_0xb576('0x8')]=function(_0x22cbae,_0x42affb){return function(_0x42f2c0){try{if(!_[_0xb576('0x9')](this[_0xb576('0xa')][_0xb576('0xb')])){logger[_0xb576('0xc')](_0xb576('0xd'),_0x22cbae,_0xb576('0xe'));return _0x42f2c0[_0xb576('0xf')]();}var _0x4b209b={'ContactId':this[_0xb576('0x10')]['id'],'sentAt':moment()['format'](_0xb576('0x11')),'direction':_0xb576('0x12')};if(this[_0xb576('0x13')]==='sms'||this['channel']===_0xb576('0x14')){_0x4b209b[_0xb576('0x15')]=this[_0xb576('0xa')][_0xb576('0x15')];}var _0x20d2ef=this[_0xb576('0x13')];if(_0x20d2ef===_0xb576('0x16')){_0x4b209b[_0xb576('0x17')]=this[_0xb576('0x18')]['id'];}else{_0x4b209b[_[_0xb576('0x19')](_0x20d2ef)+'AccountId']=this['account']['id'];}_0x4b209b[_['upperFirst'](_0x20d2ef)+_0xb576('0x1a')]=this[_0xb576('0xa')]['id'];if(this[_0xb576('0xa')][_0xb576('0x1b')]){var _0x463fb2=_0x42affb[0x2];if(!_[_0xb576('0x1c')](_0x463fb2)){_0x4b209b['body']=utils[_0xb576('0x1d')](_0x463fb2,this);return rpc[_0x20d2ef+_0xb576('0x1e')]['create'](_0x4b209b)['then'](function(_0x394d7e){logger[_0xb576('0xc')](_0xb576('0xd'),_0x22cbae,_0x4b209b['body']);})['catch'](function(_0x55b8c0){logger[_0xb576('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x22cbae,JSON['stringify'](_0x55b8c0));})[_0xb576('0x20')](function(){logger[_0xb576('0xc')](_0xb576('0x21'),_0x22cbae);_0x42f2c0[_0xb576('0x22')]();});}else{logger['info'](_0xb576('0x23'),_0x22cbae);_0x42f2c0[_0xb576('0x22')]();}}else{var _0xde0fb1=this;var _0x2295ed=apiai(_0x42affb[0x0],{'language':_0x42affb[0x1]||'en'});return _0x2295ed[_0xb576('0x24')](this[_0xb576('0x25')][_0xb576('0x26')],{'sessionId':md5(this[_0xb576('0xa')]['id'])})[_0xb576('0x27')](function(_0x189c32){_0xde0fb1[_0xb576('0x26')][_0xb576('0x28')]=_0x189c32;_0x4b209b[_0xb576('0x26')]=_0x189c32[_0xb576('0x29')]['fulfillment'][_0xb576('0x2a')];_0x4b209b[_0xb576('0x2b')]=_0xb576('0x28');_0x4b209b[_0xb576('0x2c')]=JSON[_0xb576('0x2d')](_0x189c32);return rpc[_0x20d2ef+_0xb576('0x1e')][_0xb576('0x2e')](_0x4b209b)['then'](function(_0x30d966){logger[_0xb576('0xc')](_0xb576('0xd'),_0x22cbae,_0x4b209b[_0xb576('0x26')]);if(_0x189c32[_0xb576('0x29')]['metadata'][_0xb576('0x2f')]){_0x42f2c0['next']();}else{_0x42f2c0[_0xb576('0x22')]();}})[_0xb576('0x30')](function(_0x239638){logger[_0xb576('0x1f')](_0xb576('0xd'),_0x22cbae,JSON['stringify'](_0x239638));_0x42f2c0[_0xb576('0xf')]();});})[_0xb576('0x30')](function(_0x2f4e6c){logger[_0xb576('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x22cbae,_0x2f4e6c[_0xb576('0x25')]);_0x42f2c0[_0xb576('0xf')]();});}}catch(_0x30afc6){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x22cbae,JSON['stringify'](_0x30afc6));_0x42f2c0[_0xb576('0x22')]();}};}; \ No newline at end of file +var _0x4ca4=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','result','fulfillment','providerName','dialogflow','providerResponse','stringify','endConversation','next','lodash','moment','apiai-promise','md5'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4ca4,0x100));var _0x44ca=function(_0x22c9fa,_0x2697e3){_0x22c9fa=_0x22c9fa-0x0;var _0x20ef12=_0x4ca4[_0x22c9fa];return _0x20ef12;};'use strict';var _=require(_0x44ca('0x0'));var moment=require(_0x44ca('0x1'));var apiai=require(_0x44ca('0x2'));var md5=require(_0x44ca('0x3'));var utils=require(_0x44ca('0x4'));var logger=require(_0x44ca('0x5'))(_0x44ca('0x6'));var rpc={'chatMessage':require(_0x44ca('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x44ca('0x8')),'smsMessage':require(_0x44ca('0x9')),'faxMessage':require(_0x44ca('0xa')),'whatsappMessage':require(_0x44ca('0xb'))};exports[_0x44ca('0xc')]=function(_0x32097f,_0x4ce88d){return function(_0x5d7a35){try{if(!_['isNil'](this[_0x44ca('0xd')][_0x44ca('0xe')])){logger['info'](_0x44ca('0xf'),_0x32097f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5d7a35['next']();}var _0x89a1c5={'ContactId':this[_0x44ca('0x10')]['id'],'sentAt':moment()[_0x44ca('0x11')](_0x44ca('0x12')),'direction':_0x44ca('0x13')};if(this['channel']==='sms'||this[_0x44ca('0x14')]===_0x44ca('0x15')){_0x89a1c5['phone']=this['interaction'][_0x44ca('0x16')];}var _0x21cc06=this[_0x44ca('0x14')];if(_0x21cc06===_0x44ca('0x17')){_0x89a1c5[_0x44ca('0x18')]=this[_0x44ca('0x19')]['id'];}else{_0x89a1c5[_[_0x44ca('0x1a')](_0x21cc06)+_0x44ca('0x1b')]=this['account']['id'];}_0x89a1c5[_[_0x44ca('0x1a')](_0x21cc06)+_0x44ca('0x1c')]=this['interaction']['id'];if(this[_0x44ca('0xd')][_0x44ca('0x1d')]){var _0x598619=_0x4ce88d[0x2];if(!_[_0x44ca('0x1e')](_0x598619)){_0x89a1c5[_0x44ca('0x1f')]=utils[_0x44ca('0x20')](_0x598619,this);return rpc[_0x21cc06+_0x44ca('0x21')][_0x44ca('0x22')](_0x89a1c5)[_0x44ca('0x23')](function(_0x1fe960){logger[_0x44ca('0x24')](_0x44ca('0xf'),_0x32097f,_0x89a1c5['body']);})[_0x44ca('0x25')](function(_0x159766){logger[_0x44ca('0x26')](_0x44ca('0xf'),_0x32097f,JSON['stringify'](_0x159766));})[_0x44ca('0x27')](function(){logger['info'](_0x44ca('0x28'),_0x32097f);_0x5d7a35[_0x44ca('0x29')]();});}else{logger['info'](_0x44ca('0x2a'),_0x32097f);_0x5d7a35[_0x44ca('0x29')]();}}else{var _0x1cf198=this;var _0x2ec184=apiai(_0x4ce88d[0x0],{'language':_0x4ce88d[0x1]||'en'});return _0x2ec184['textRequest'](this[_0x44ca('0x2b')]['body'],{'sessionId':md5(this[_0x44ca('0xd')]['id'])})[_0x44ca('0x23')](function(_0x4f93e0){_0x1cf198['body']['dialogflow']=_0x4f93e0;_0x89a1c5['body']=_0x4f93e0[_0x44ca('0x2c')][_0x44ca('0x2d')]['speech'];_0x89a1c5[_0x44ca('0x2e')]=_0x44ca('0x2f');_0x89a1c5[_0x44ca('0x30')]=JSON[_0x44ca('0x31')](_0x4f93e0);return rpc[_0x21cc06+_0x44ca('0x21')][_0x44ca('0x22')](_0x89a1c5)[_0x44ca('0x23')](function(_0x97c546){logger[_0x44ca('0x24')](_0x44ca('0xf'),_0x32097f,_0x89a1c5[_0x44ca('0x1f')]);if(_0x4f93e0[_0x44ca('0x2c')]['metadata'][_0x44ca('0x32')]){_0x5d7a35['next']();}else{_0x5d7a35[_0x44ca('0x29')]();}})['catch'](function(_0x94f15a){logger[_0x44ca('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x32097f,JSON[_0x44ca('0x31')](_0x94f15a));_0x5d7a35['next']();});})['catch'](function(_0x2c7283){logger['error'](_0x44ca('0xf'),_0x32097f,_0x2c7283[_0x44ca('0x2b')]);_0x5d7a35[_0x44ca('0x33')]();});}}catch(_0x531ec9){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x32097f,JSON[_0x44ca('0x31')](_0x531ec9));_0x5d7a35[_0x44ca('0x29')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index d80b576..dffcde8 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cbe=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','created','isEmpty','getMustacheRender','create','error','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','dialogflow','md5','moment','bluebird'];(function(_0x49f2a8,_0x475eae){var _0x4ff055=function(_0x1e0c0b){while(--_0x1e0c0b){_0x49f2a8['push'](_0x49f2a8['shift']());}};_0x4ff055(++_0x475eae);}(_0x2cbe,0x110));var _0xe2cb=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0x2cbe[_0x754ab4];return _0x34079a;};'use strict';var _=require('lodash');var dialogflow=require(_0xe2cb('0x0'));var md5=require(_0xe2cb('0x1'));var moment=require(_0xe2cb('0x2'));var Promise=require(_0xe2cb('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xe2cb('0x4')),'openchannelMessage':require(_0xe2cb('0x5')),'mailMessage':require(_0xe2cb('0x6')),'smsMessage':require(_0xe2cb('0x7')),'faxMessage':require(_0xe2cb('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x3307fb,_0x5d4259,_0x488165,_0x3399a3){return new Promise(function(_0x462427,_0x298797){var _0x4e8928=_[_0xe2cb('0x9')](_0x488165);_0x4e8928[_0xe2cb('0xa')]=_0x3399a3;return rpc[_0x5d4259+_0xe2cb('0xb')]['create'](_0x4e8928)[_0xe2cb('0xc')](function(){logger[_0xe2cb('0xd')](_0xe2cb('0xe'),_0x3307fb,_0x4e8928['body']);_0x462427();})[_0xe2cb('0xf')](function(_0x253715){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3307fb,JSON['stringify'](_0x253715));_0x298797(_0x253715);});});}exports[_0xe2cb('0x10')]=function(_0x298c39,_0x49af22){return function(_0x4cbe3c){try{if(!_[_0xe2cb('0x11')](this[_0xe2cb('0x12')]['UserId'])){logger[_0xe2cb('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x298c39,_0xe2cb('0x13'));return _0x4cbe3c[_0xe2cb('0x14')]();}var _0x2cd887={'ContactId':this[_0xe2cb('0x15')]['id'],'sentAt':moment()[_0xe2cb('0x16')](_0xe2cb('0x17')),'direction':_0xe2cb('0x18')};if(this[_0xe2cb('0x19')]===_0xe2cb('0x1a')||this[_0xe2cb('0x19')]===_0xe2cb('0x1b')){_0x2cd887[_0xe2cb('0x1c')]=this[_0xe2cb('0x12')]['phone'];}var _0x15aeed=this[_0xe2cb('0x19')];if(_0x15aeed===_0xe2cb('0x1d')){_0x2cd887['ChatWebsiteId']=this[_0xe2cb('0x1e')]['id'];}else{_0x2cd887[_[_0xe2cb('0x1f')](_0x15aeed)+'AccountId']=this[_0xe2cb('0x1e')]['id'];}_0x2cd887[_[_0xe2cb('0x1f')](_0x15aeed)+'InteractionId']=this[_0xe2cb('0x12')]['id'];if(this[_0xe2cb('0x12')][_0xe2cb('0x20')]){var _0x3fe5ca=_0x49af22[0x4];if(!_[_0xe2cb('0x21')](_0x3fe5ca)){_0x2cd887[_0xe2cb('0xa')]=utils[_0xe2cb('0x22')](_0x3fe5ca,this);return rpc[_0x15aeed+_0xe2cb('0xb')][_0xe2cb('0x23')](_0x2cd887)[_0xe2cb('0xc')](function(_0x31409e){logger[_0xe2cb('0xd')](_0xe2cb('0xe'),_0x298c39,_0x2cd887[_0xe2cb('0xa')]);})[_0xe2cb('0xf')](function(_0x5ca899){logger[_0xe2cb('0x24')](_0xe2cb('0xe'),_0x298c39,JSON[_0xe2cb('0x25')](_0x5ca899));})['finally'](function(){logger[_0xe2cb('0xd')](_0xe2cb('0x26'),_0x298c39);_0x4cbe3c[_0xe2cb('0x27')]();});}else{logger[_0xe2cb('0xd')](_0xe2cb('0x28'),_0x298c39);_0x4cbe3c[_0xe2cb('0x27')]();}}else{var _0x1f2edc=this;var _0x2e9c47=_0x49af22[0x2]['replace'](/\\n/g,'\x0a');var _0x18bd2e={'credentials':{'private_key':_0x2e9c47,'client_email':_0x49af22[0x1]}};var _0x3afaf2=new dialogflow[(_0xe2cb('0x29'))](_0x18bd2e);var _0x197f76=_0x3afaf2['sessionPath'](_0x49af22[0x0],md5(_0x1f2edc['interaction']['id']));var _0x37afb9={'session':_0x197f76,'queryInput':{'text':{'text':_0x1f2edc[_0xe2cb('0x2a')]['body'],'languageCode':_0x49af22[0x3]||'en'}}};return _0x3afaf2[_0xe2cb('0x2b')](_0x37afb9)[_0xe2cb('0xc')](function(_0x206137){if(_0x206137&&_0x206137[_0xe2cb('0x2c')]){_0x1f2edc[_0xe2cb('0xa')][_0xe2cb('0x2d')]=_0x206137;var _0x5dd0d6=_0x206137[0x0];var _0xac0588=_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x2f')]&&_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x2f')]['fields']?_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x2f')][_0xe2cb('0x30')][_0xe2cb('0x31')][_0xe2cb('0x32')]:![];_0x1f2edc[_0xe2cb('0xa')][_0xe2cb('0x33')]=_0x5dd0d6['queryResult'][_0xe2cb('0x34')];_0x1f2edc[_0xe2cb('0xa')][_0xe2cb('0x35')]=_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x36')];_0x1f2edc[_0xe2cb('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x5dd0d6[_0xe2cb('0x2e')]['diagnosticInfo']&&_0x5dd0d6[_0xe2cb('0x2e')]['diagnosticInfo'][_0xe2cb('0x30')]?_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x2f')]['fields']['end_conversation'][_0xe2cb('0x32')]:![];_0x1f2edc[_0xe2cb('0xa')][_0xe2cb('0x37')]=_0x5dd0d6['queryResult'][_0xe2cb('0x38')][_0xe2cb('0x39')];_0x1f2edc[_0xe2cb('0xa')][_0xe2cb('0x3a')]=_0x5dd0d6['queryResult']['intent']['displayName'];_0x1f2edc[_0xe2cb('0xa')][_0xe2cb('0x3b')]=_0x5dd0d6['queryResult']['intent']['isFallback'];_0x1f2edc[_0xe2cb('0xa')][_0xe2cb('0x3c')]=_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x3d')];_0x1f2edc['body'][_0xe2cb('0x3e')]=_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x3f')];_0x1f2edc['body']['DIALOGFLOWV2_SCORE']=_0x5dd0d6[_0xe2cb('0x2e')][_0xe2cb('0x40')];_0x2cd887[_0xe2cb('0x41')]='dialogflowV2';_0x2cd887[_0xe2cb('0x42')]=JSON['stringify'](_0x206137);var _0x4f67dd=[];for(var _0xc5e1df=0x0;_0xc5e1df<_0x206137[_0xe2cb('0x2c')];_0xc5e1df++){var _0x185628=_0x206137[_0xc5e1df];if(_0x185628&&_0x185628['queryResult']&&_0x185628[_0xe2cb('0x2e')][_0xe2cb('0x43')]){_0x4f67dd[_0xe2cb('0x44')](createMessage(_0x298c39,_0x15aeed,_0x2cd887,_0x185628[_0xe2cb('0x2e')][_0xe2cb('0x43')]));}}return Promise['all'](_0x4f67dd)['then'](function(){if(_0xac0588){_0x4cbe3c[_0xe2cb('0x14')]();}else{_0x4cbe3c[_0xe2cb('0x27')]();}})['catch'](function(_0x202501){logger[_0xe2cb('0x24')](_0xe2cb('0xe'),_0x298c39,JSON[_0xe2cb('0x25')](_0x202501));_0x4cbe3c['next']();});}})['catch'](function(_0x1412da){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x298c39,_0x1412da['message']);_0x4cbe3c[_0xe2cb('0x14')]();});}}catch(_0xe4d640){logger[_0xe2cb('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0x298c39,JSON[_0xe2cb('0x25')](_0xe4d640));_0x4cbe3c[_0xe2cb('0x27')]();}};}; \ No newline at end of file +var _0xb66c=['replace','SessionsClient','sessionPath','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','next','lodash','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x3501e9,_0x30a756){var _0x413e91=function(_0x180f38){while(--_0x180f38){_0x3501e9['push'](_0x3501e9['shift']());}};_0x413e91(++_0x30a756);}(_0xb66c,0x175));var _0xcb66=function(_0x43e7e3,_0x544747){_0x43e7e3=_0x43e7e3-0x0;var _0xc960ad=_0xb66c[_0x43e7e3];return _0xc960ad;};'use strict';var _=require(_0xcb66('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xcb66('0x1'));var moment=require('moment');var Promise=require(_0xcb66('0x2'));var logger=require(_0xcb66('0x3'))(_0xcb66('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0xcb66('0x5')),'openchannelMessage':require(_0xcb66('0x6')),'mailMessage':require(_0xcb66('0x7')),'smsMessage':require(_0xcb66('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x19adf5,_0x1b6852,_0xa3993,_0x439f3d){return new Promise(function(_0xf7bc39,_0x58582b){var _0x2c62ad=_[_0xcb66('0x9')](_0xa3993);_0x2c62ad[_0xcb66('0xa')]=_0x439f3d;return rpc[_0x1b6852+_0xcb66('0xb')][_0xcb66('0xc')](_0x2c62ad)['then'](function(){logger[_0xcb66('0xd')](_0xcb66('0xe'),_0x19adf5,_0x2c62ad[_0xcb66('0xa')]);_0xf7bc39();})[_0xcb66('0xf')](function(_0x4841e4){logger[_0xcb66('0x10')](_0xcb66('0xe'),_0x19adf5,JSON[_0xcb66('0x11')](_0x4841e4));_0x58582b(_0x4841e4);});});}exports[_0xcb66('0x12')]=function(_0x582523,_0x4079ae){return function(_0x40c810){try{if(!_[_0xcb66('0x13')](this[_0xcb66('0x14')]['UserId'])){logger[_0xcb66('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x582523,_0xcb66('0x15'));return _0x40c810['next']();}var _0x27442d={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xcb66('0x16')),'direction':_0xcb66('0x17')};if(this[_0xcb66('0x18')]===_0xcb66('0x19')||this['channel']===_0xcb66('0x1a')){_0x27442d[_0xcb66('0x1b')]=this[_0xcb66('0x14')]['phone'];}var _0x2e4126=this['channel'];if(_0x2e4126===_0xcb66('0x1c')){_0x27442d[_0xcb66('0x1d')]=this[_0xcb66('0x1e')]['id'];}else{_0x27442d[_[_0xcb66('0x1f')](_0x2e4126)+'AccountId']=this['account']['id'];}_0x27442d[_['upperFirst'](_0x2e4126)+_0xcb66('0x20')]=this['interaction']['id'];if(this['interaction'][_0xcb66('0x21')]){var _0x507d5a=_0x4079ae[0x4];if(!_[_0xcb66('0x22')](_0x507d5a)){_0x27442d[_0xcb66('0xa')]=utils[_0xcb66('0x23')](_0x507d5a,this);return rpc[_0x2e4126+_0xcb66('0xb')][_0xcb66('0xc')](_0x27442d)[_0xcb66('0x24')](function(_0x3391a0){logger['info'](_0xcb66('0xe'),_0x582523,_0x27442d['body']);})['catch'](function(_0xf89c0e){logger[_0xcb66('0x10')](_0xcb66('0xe'),_0x582523,JSON['stringify'](_0xf89c0e));})[_0xcb66('0x25')](function(){logger[_0xcb66('0xd')](_0xcb66('0x26'),_0x582523);_0x40c810[_0xcb66('0x27')]();});}else{logger['info'](_0xcb66('0x28'),_0x582523);_0x40c810[_0xcb66('0x27')]();}}else{var _0x134987=this;var _0x293711=_0x4079ae[0x2][_0xcb66('0x29')](/\\n/g,'\x0a');var _0x22527e={'credentials':{'private_key':_0x293711,'client_email':_0x4079ae[0x1]}};var _0x1e5c56=new dialogflow[(_0xcb66('0x2a'))](_0x22527e);var _0x28fc0b=_0x1e5c56[_0xcb66('0x2b')](_0x4079ae[0x0],md5(_0x134987['interaction']['id']));var _0x2152dc={'session':_0x28fc0b,'queryInput':{'text':{'text':_0x134987['message']['body'],'languageCode':_0x4079ae[0x3]||'en'}}};return _0x1e5c56['detectIntent'](_0x2152dc)[_0xcb66('0x24')](function(_0x4ca8b4){if(_0x4ca8b4&&_0x4ca8b4[_0xcb66('0x2c')]){_0x134987[_0xcb66('0xa')][_0xcb66('0x2d')]=_0x4ca8b4;var _0x5d3fb5=_0x4ca8b4[0x0];var _0x123787=_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x2f')]&&_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x2f')][_0xcb66('0x30')]?_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x2f')][_0xcb66('0x30')][_0xcb66('0x31')]['boolValue']:![];_0x134987[_0xcb66('0xa')][_0xcb66('0x32')]=_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x33')];_0x134987[_0xcb66('0xa')][_0xcb66('0x34')]=_0x5d3fb5[_0xcb66('0x2e')]['allRequiredParamsPresent'];_0x134987[_0xcb66('0xa')][_0xcb66('0x35')]=_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x2f')]&&_0x5d3fb5['queryResult'][_0xcb66('0x2f')][_0xcb66('0x30')]?_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x2f')][_0xcb66('0x30')][_0xcb66('0x31')][_0xcb66('0x36')]:![];_0x134987[_0xcb66('0xa')][_0xcb66('0x37')]=_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x38')][_0xcb66('0x39')];_0x134987['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5d3fb5['queryResult'][_0xcb66('0x38')][_0xcb66('0x3a')];_0x134987[_0xcb66('0xa')][_0xcb66('0x3b')]=_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x38')]['isFallback'];_0x134987[_0xcb66('0xa')]['DIALOGFLOWV2_LANGUAGECODE']=_0x5d3fb5['queryResult']['languageCode'];_0x134987[_0xcb66('0xa')][_0xcb66('0x3c')]=_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x3d')];_0x134987[_0xcb66('0xa')][_0xcb66('0x3e')]=_0x5d3fb5[_0xcb66('0x2e')][_0xcb66('0x3f')];_0x27442d[_0xcb66('0x40')]='dialogflowV2';_0x27442d[_0xcb66('0x41')]=JSON[_0xcb66('0x11')](_0x4ca8b4);var _0x4df1b8=[];for(var _0x5ea5c8=0x0;_0x5ea5c8<_0x4ca8b4[_0xcb66('0x2c')];_0x5ea5c8++){var _0x1f1712=_0x4ca8b4[_0x5ea5c8];if(_0x1f1712&&_0x1f1712['queryResult']&&_0x1f1712['queryResult'][_0xcb66('0x42')]){_0x4df1b8['push'](createMessage(_0x582523,_0x2e4126,_0x27442d,_0x1f1712['queryResult'][_0xcb66('0x42')]));}}return Promise[_0xcb66('0x43')](_0x4df1b8)[_0xcb66('0x24')](function(){if(_0x123787){_0x40c810[_0xcb66('0x44')]();}else{_0x40c810[_0xcb66('0x27')]();}})[_0xcb66('0xf')](function(_0x3323ee){logger[_0xcb66('0x10')](_0xcb66('0xe'),_0x582523,JSON['stringify'](_0x3323ee));_0x40c810['next']();});}})['catch'](function(_0x1f4600){logger['error'](_0xcb66('0xe'),_0x582523,_0x1f4600['message']);_0x40c810[_0xcb66('0x44')]();});}}catch(_0x3c8030){logger[_0xcb66('0x10')](_0xcb66('0xe'),_0x582523,JSON[_0xcb66('0x11')](_0x3c8030));_0x40c810[_0xcb66('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 39da80d..9ba20af 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9690=['replace','length','error','[%s][GOTOIF]\x20%s','map','message','condition','priorityTrue','priorityFalse','info','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x55a2f4,_0x685090){var _0x238877=function(_0x5f068f){while(--_0x5f068f){_0x55a2f4['push'](_0x55a2f4['shift']());}};_0x238877(++_0x685090);}(_0x9690,0xad));var _0x0969=function(_0x4e9149,_0x36579c){_0x4e9149=_0x4e9149-0x0;var _0x24208d=_0x9690[_0x4e9149];return _0x24208d;};'use strict';var schema=require(_0x0969('0x0'));var _=require(_0x0969('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x0969('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x0969('0x3'),'required':!![],'message':_0x0969('0x4')},'priorityTrue':{'type':'number','message':_0x0969('0x5')},'priorityFalse':{'type':_0x0969('0x6'),'message':_0x0969('0x7')}});exports[_0x0969('0x8')]=function(_0x3fdb29,_0x272a2e){return function(_0x5eef2a){try{var _0x4d7d6e={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x272a2e[0x0],this),{'wordwrap':![]})[_0x0969('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x272a2e[0x1],'priorityFalse':_0x272a2e[0x2]};var _0x16cb68=gotoif[_0x0969('0x0')](_0x4d7d6e,{'typecast':!![]});if(_0x16cb68[_0x0969('0xa')]){logger[_0x0969('0xb')](_0x0969('0xc'),_0x3fdb29,_[_0x0969('0xd')](_0x16cb68,_0x0969('0xe'))['join'](',\x20'));_0x5eef2a['stop']();}else{try{var _0x25a399=eval('('+_0x4d7d6e[_0x0969('0xf')]+')');var _0x584e66=_0x25a399?_0x4d7d6e[_0x0969('0x10')]:_0x4d7d6e[_0x0969('0x11')];logger[_0x0969('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3fdb29,_0x4d7d6e[_0x0969('0xf')],_0x25a399,_0x584e66||'next');if(_0x584e66){var _0x1e14bd=_['findIndex'](_0x5eef2a[_0x0969('0x13')](),{'p':_0x584e66});if(_0x1e14bd>=0x0){logger[_0x0969('0x12')](_0x0969('0x14'),_0x3fdb29,_0x584e66||_0x0969('0x15'),_0x1e14bd);_0x5eef2a[_0x0969('0x15')](_0x1e14bd);}else{logger[_0x0969('0x12')](_0x0969('0x16'),_0x3fdb29,_0x584e66||_0x0969('0x15'));_0x5eef2a[_0x0969('0x17')]();}}else{_0x5eef2a[_0x0969('0x15')]();}}catch(_0x40f18b){logger[_0x0969('0xb')](_0x0969('0x18'),_0x3fdb29,_0x40f18b['message']);_0x5eef2a[_0x0969('0x17')]();}}}catch(_0x484f3c){logger[_0x0969('0xb')](_0x0969('0xc'),_0x3fdb29,JSON[_0x0969('0x19')](_0x484f3c));_0x5eef2a[_0x0969('0x17')]();}};}; \ No newline at end of file +var _0x8e6d=['priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x592b99,_0x9dce93){var _0x282cd3=function(_0x9fcb0c){while(--_0x9fcb0c){_0x592b99['push'](_0x592b99['shift']());}};_0x282cd3(++_0x9dce93);}(_0x8e6d,0xc3));var _0xd8e6=function(_0x165119,_0x2a3023){_0x165119=_0x165119-0x0;var _0xdb9746=_0x8e6d[_0x165119];return _0xdb9746;};'use strict';var schema=require(_0xd8e6('0x0'));var _=require(_0xd8e6('0x1'));var htmlToText=require(_0xd8e6('0x2'));var utils=require('./utils');var logger=require(_0xd8e6('0x3'))(_0xd8e6('0x4'));var gotoif=schema({'condition':{'type':_0xd8e6('0x5'),'required':!![],'message':_0xd8e6('0x6')},'priorityTrue':{'type':_0xd8e6('0x7'),'message':_0xd8e6('0x8')},'priorityFalse':{'type':_0xd8e6('0x7'),'message':_0xd8e6('0x9')}});exports[_0xd8e6('0xa')]=function(_0x4cd3a2,_0x2d17e2){return function(_0x137479){try{var _0x556b99={'condition':htmlToText[_0xd8e6('0xb')](utils[_0xd8e6('0xc')](_0x2d17e2[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2d17e2[0x1],'priorityFalse':_0x2d17e2[0x2]};var _0xbd6bc0=gotoif[_0xd8e6('0x0')](_0x556b99,{'typecast':!![]});if(_0xbd6bc0['length']){logger[_0xd8e6('0xd')](_0xd8e6('0xe'),_0x4cd3a2,_[_0xd8e6('0xf')](_0xbd6bc0,'message')[_0xd8e6('0x10')](',\x20'));_0x137479[_0xd8e6('0x11')]();}else{try{var _0x33b58f=eval('('+_0x556b99[_0xd8e6('0x12')]+')');var _0x52d589=_0x33b58f?_0x556b99[_0xd8e6('0x13')]:_0x556b99[_0xd8e6('0x14')];logger['info'](_0xd8e6('0x15'),_0x4cd3a2,_0x556b99[_0xd8e6('0x12')],_0x33b58f,_0x52d589||_0xd8e6('0x16'));if(_0x52d589){var _0x2dfcab=_[_0xd8e6('0x17')](_0x137479[_0xd8e6('0x18')](),{'p':_0x52d589});if(_0x2dfcab>=0x0){logger[_0xd8e6('0x19')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4cd3a2,_0x52d589||_0xd8e6('0x16'),_0x2dfcab);_0x137479[_0xd8e6('0x16')](_0x2dfcab);}else{logger[_0xd8e6('0x19')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4cd3a2,_0x52d589||_0xd8e6('0x16'));_0x137479['stop']();}}else{_0x137479['next']();}}catch(_0x14af6e){logger['error'](_0xd8e6('0x1a'),_0x4cd3a2,_0x14af6e[_0xd8e6('0x1b')]);_0x137479[_0xd8e6('0x11')]();}}}catch(_0x29d4eb){logger[_0xd8e6('0xd')](_0xd8e6('0xe'),_0x4cd3a2,JSON[_0xd8e6('0x1c')](_0x29d4eb));_0x137479[_0xd8e6('0x11')]();}};}; \ 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 edd1f43..a175d25 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 _0x371e=['consequence','length','error','map','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','validate','../../../../config/logger','routing','number'];(function(_0x4fb2ef,_0xb5136b){var _0x4e6e0e=function(_0x189aeb){while(--_0x189aeb){_0x4fb2ef['push'](_0x4fb2ef['shift']());}};_0x4e6e0e(++_0xb5136b);}(_0x371e,0xea));var _0xe371=function(_0x3736f7,_0xe2b1b4){_0x3736f7=_0x3736f7-0x0;var _0x4d1960=_0x371e[_0x3736f7];return _0x4d1960;};'use strict';var schema=require(_0xe371('0x0'));var _=require('lodash');var logger=require(_0xe371('0x1'))(_0xe371('0x2'));var gotop=schema({'priority':{'type':_0xe371('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xe371('0x4')]=function(_0x274bce,_0x8e11a0){return function(_0x2e386b){try{var _0x418c2f={'priority':_0x8e11a0[0x0]};var _0x3cee21=gotop[_0xe371('0x0')](_0x418c2f,{'typecast':!![]});if(_0x3cee21[_0xe371('0x5')]){logger[_0xe371('0x6')]('[%s][GOTOP]\x20%s',_0x274bce,_[_0xe371('0x7')](_0x3cee21,'message')[_0xe371('0x8')](',\x20'));_0x2e386b[_0xe371('0x9')]();}else{logger[_0xe371('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x274bce,_0x418c2f[_0xe371('0xb')]);if(_0x418c2f[_0xe371('0xb')]){var _0x5dd26e=_[_0xe371('0xc')](_0x2e386b['rules'](),{'p':_0x418c2f['priority']});if(_0x5dd26e>=0x0){logger['info'](_0xe371('0xd'),_0x274bce,_0x418c2f[_0xe371('0xb')]||_0xe371('0xe'),_0x5dd26e);_0x2e386b['next'](_0x5dd26e);}else{logger[_0xe371('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x274bce,_0x418c2f[_0xe371('0xb')]||_0xe371('0xe'));_0x2e386b[_0xe371('0x9')]();}}else{_0x2e386b[_0xe371('0xe')]();}}}catch(_0x4bd94e){logger[_0xe371('0x6')](_0xe371('0xf'),_0x274bce,JSON[_0xe371('0x10')](_0x4bd94e));_0x2e386b[_0xe371('0x9')]();}};}; \ No newline at end of file +var _0x0ce5=['validate','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify'];(function(_0x549444,_0x41c180){var _0x2348d2=function(_0x12e035){while(--_0x12e035){_0x549444['push'](_0x549444['shift']());}};_0x2348d2(++_0x41c180);}(_0x0ce5,0x168));var _0x50ce=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x0ce5[_0x447ef1];return _0x3d72ec;};'use strict';var schema=require(_0x50ce('0x0'));var _=require('lodash');var logger=require(_0x50ce('0x1'))(_0x50ce('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x50ce('0x3')}});exports[_0x50ce('0x4')]=function(_0x37ab49,_0x3f46b8){return function(_0x34068b){try{var _0x490cd2={'priority':_0x3f46b8[0x0]};var _0x1872d4=gotop['validate'](_0x490cd2,{'typecast':!![]});if(_0x1872d4[_0x50ce('0x5')]){logger[_0x50ce('0x6')]('[%s][GOTOP]\x20%s',_0x37ab49,_['map'](_0x1872d4,_0x50ce('0x7'))[_0x50ce('0x8')](',\x20'));_0x34068b[_0x50ce('0x9')]();}else{logger[_0x50ce('0xa')](_0x50ce('0xb'),_0x37ab49,_0x490cd2[_0x50ce('0xc')]);if(_0x490cd2[_0x50ce('0xc')]){var _0x300f4b=_[_0x50ce('0xd')](_0x34068b[_0x50ce('0xe')](),{'p':_0x490cd2[_0x50ce('0xc')]});if(_0x300f4b>=0x0){logger['info'](_0x50ce('0xf'),_0x37ab49,_0x490cd2[_0x50ce('0xc')]||'next',_0x300f4b);_0x34068b[_0x50ce('0x10')](_0x300f4b);}else{logger[_0x50ce('0xa')](_0x50ce('0x11'),_0x37ab49,_0x490cd2[_0x50ce('0xc')]||'next');_0x34068b[_0x50ce('0x9')]();}}else{_0x34068b['next']();}}}catch(_0x3b60a6){logger[_0x50ce('0x6')](_0x50ce('0x12'),_0x37ab49,JSON[_0x50ce('0x13')](_0x3b60a6));_0x34068b['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 42ed150..ce23939 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 _0x3bc4=['[%s][MESSAGE]\x20%s','body','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info'];(function(_0x5e3cbd,_0x2fd5cd){var _0x1ed1ce=function(_0x4bae94){while(--_0x4bae94){_0x5e3cbd['push'](_0x5e3cbd['shift']());}};_0x1ed1ce(++_0x2fd5cd);}(_0x3bc4,0xc9));var _0x43bc=function(_0x3f4bef,_0x359a87){_0x3f4bef=_0x3f4bef-0x0;var _0x1989b7=_0x3bc4[_0x3f4bef];return _0x1989b7;};'use strict';var _=require('lodash');var utils=require(_0x43bc('0x0'));var logger=require(_0x43bc('0x1'))(_0x43bc('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x43bc('0x3')),'mailMessage':require(_0x43bc('0x4')),'smsMessage':require(_0x43bc('0x5')),'faxMessage':require(_0x43bc('0x6')),'whatsappMessage':require(_0x43bc('0x7'))};exports[_0x43bc('0x8')]=function(_0x5f1b2f,_0x561841){return function(_0x98ad87){try{var _0x3037ba={'body':utils[_0x43bc('0x9')](_0x561841[0x0],this),'ContactId':this[_0x43bc('0xa')]['id']};if(this[_0x43bc('0xb')]===_0x43bc('0xc')){_0x3037ba[_0x43bc('0xd')]=this[_0x43bc('0xe')]['id'];}else{_0x3037ba[_[_0x43bc('0xf')](this[_0x43bc('0xb')])+_0x43bc('0x10')]=this['account']['id'];}_0x3037ba[_['upperFirst'](this[_0x43bc('0xb')])+_0x43bc('0x11')]=this[_0x43bc('0x12')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x43bc('0xb')]+_0x43bc('0x13')][_0x43bc('0x14')](_0x3037ba)[_0x43bc('0x15')](function(_0x3777b4){logger[_0x43bc('0x16')](_0x43bc('0x17'),_0x5f1b2f,_0x3037ba[_0x43bc('0x18')]);_0x98ad87['next']();})['catch'](function(_0x18c88d){logger[_0x43bc('0x19')](_0x43bc('0x17'),_0x5f1b2f,JSON[_0x43bc('0x1a')](_0x18c88d));_0x98ad87[_0x43bc('0x1b')]();});}}catch(_0x328c39){logger['error'](_0x43bc('0x17'),_0x5f1b2f,JSON[_0x43bc('0x1a')](_0x328c39));_0x98ad87[_0x43bc('0x1b')]();}};}; \ No newline at end of file +var _0x793b=['error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x18c99e,_0x9095d7){var _0x88321d=function(_0x20821e){while(--_0x20821e){_0x18c99e['push'](_0x18c99e['shift']());}};_0x88321d(++_0x9095d7);}(_0x793b,0x189));var _0xb793=function(_0x2e95f1,_0x154015){_0x2e95f1=_0x2e95f1-0x0;var _0x16b808=_0x793b[_0x2e95f1];return _0x16b808;};'use strict';var _=require(_0xb793('0x0'));var utils=require(_0xb793('0x1'));var logger=require(_0xb793('0x2'))(_0xb793('0x3'));var rpc={'chatMessage':require(_0xb793('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb793('0x5')),'smsMessage':require(_0xb793('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xb793('0x7')]=function(_0x3cb1c8,_0x322b07){return function(_0x2b1f19){try{var _0x39f110={'body':utils[_0xb793('0x8')](_0x322b07[0x0],this),'ContactId':this[_0xb793('0x9')]['id']};if(this[_0xb793('0xa')]===_0xb793('0xb')){_0x39f110[_0xb793('0xc')]=this[_0xb793('0xd')]['id'];}else{_0x39f110[_[_0xb793('0xe')](this[_0xb793('0xa')])+_0xb793('0xf')]=this['account']['id'];}_0x39f110[_[_0xb793('0xe')](this[_0xb793('0xa')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xb793('0xa')]+_0xb793('0x10')]){return rpc[this['channel']+_0xb793('0x10')][_0xb793('0x11')](_0x39f110)['then'](function(_0x13d536){logger[_0xb793('0x12')](_0xb793('0x13'),_0x3cb1c8,_0x39f110[_0xb793('0x14')]);_0x2b1f19[_0xb793('0x15')]();})[_0xb793('0x16')](function(_0x19d2cb){logger['error'](_0xb793('0x13'),_0x3cb1c8,JSON['stringify'](_0x19d2cb));_0x2b1f19['stop']();});}}catch(_0x20ab1e){logger[_0xb793('0x17')](_0xb793('0x13'),_0x3cb1c8,JSON[_0xb793('0x18')](_0x20ab1e));_0x2b1f19[_0xb793('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index d74e17f..062ec39 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 _0x77cd=['error','stringify','stop','./utils','../../../../config/logger','routing','[%s][NOOP]\x20%s','next'];(function(_0x1d8aba,_0x341822){var _0x37041d=function(_0x3c03c7){while(--_0x3c03c7){_0x1d8aba['push'](_0x1d8aba['shift']());}};_0x37041d(++_0x341822);}(_0x77cd,0x173));var _0xd77c=function(_0x52a5a,_0xdf21c5){_0x52a5a=_0x52a5a-0x0;var _0x2dfc3c=_0x77cd[_0x52a5a];return _0x2dfc3c;};'use strict';var utils=require(_0xd77c('0x0'));var logger=require(_0xd77c('0x1'))(_0xd77c('0x2'));exports['consequence']=function(_0x5b4b96,_0x465410){return function(_0xc3e4cc){try{logger['info'](_0xd77c('0x3'),_0x5b4b96,utils['getMustacheRender'](_0x465410[0x0],this));_0xc3e4cc[_0xd77c('0x4')]();}catch(_0x29042a){logger[_0xd77c('0x5')](_0xd77c('0x3'),_0x5b4b96,JSON[_0xd77c('0x6')](_0x29042a));_0xc3e4cc[_0xd77c('0x7')]();}};}; \ No newline at end of file +var _0x48b7=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x48b7,0xd5));var _0x748b=function(_0x2cb996,_0x595dad){_0x2cb996=_0x2cb996-0x0;var _0x3d9fce=_0x48b7[_0x2cb996];return _0x3d9fce;};'use strict';var utils=require(_0x748b('0x0'));var logger=require(_0x748b('0x1'))(_0x748b('0x2'));exports[_0x748b('0x3')]=function(_0x2a2e05,_0x263fde){return function(_0x3d8199){try{logger[_0x748b('0x4')](_0x748b('0x5'),_0x2a2e05,utils[_0x748b('0x6')](_0x263fde[0x0],this));_0x3d8199['next']();}catch(_0x16decf){logger['error'](_0x748b('0x5'),_0x2a2e05,JSON[_0x748b('0x7')](_0x16decf));_0x3d8199[_0x748b('0x8')]();}};}; \ 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 a4dd955..24c1b64 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 _0x52c4=['message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','waiting','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','log','[%s][QUEUE]\x20%s','lodash','util','moment','ioredis','../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','queue_id','queue','joinAt','emit','account','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','interaction','channel','MessageId'];(function(_0x2da39f,_0x3d10ec){var _0x12dec3=function(_0xdff258){while(--_0xdff258){_0x2da39f['push'](_0x2da39f['shift']());}};_0x12dec3(++_0x3d10ec);}(_0x52c4,0x1a6));var _0x452c=function(_0x244ca7,_0x506ea5){_0x244ca7=_0x244ca7-0x0;var _0x282b81=_0x52c4[_0x244ca7];return _0x282b81;};'use strict';var schema=require('validate');var _=require(_0x452c('0x0'));var util=require(_0x452c('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x452c('0x2'));var Redis=require(_0x452c('0x3'));var config=require('../../../../config/environment');var logger=require(_0x452c('0x4'))(_0x452c('0x5'));var strategy=require('./strategy');config['redis']=_[_0x452c('0x6')](config[_0x452c('0x7')],{'host':_0x452c('0x8'),'port':0x18eb});var io=require(_0x452c('0x9'))(new Redis(config['redis']));var attributes=['id',_0x452c('0xa'),'account',_0x452c('0xb'),'from',_0x452c('0xc')];function emit(_0x29f70a,_0x11ef67,_0x6d769f){io['to'](_0x29f70a)[_0x452c('0xd')](_0x11ef67,_0x6d769f);}function emitChannelQueueInteraction(_0x3fbbd9,_0x303891,_0x1740bf,_0x1f7239,_0xf08df,_0x26b301,_0x94af33,_0x46a42b){var _0x3da0a3=_['clone'](_0x1740bf);_0x3da0a3[_0x452c('0xa')]=_0x46a42b;_0x3da0a3['queue']=_0x303891;_0x3da0a3[_0x452c('0xe')]=_0x1f7239;_0x3da0a3['id']=_0xf08df;if(_0x26b301){_0x94af33[util['format'](_0x452c('0xf'),_0x3fbbd9)][_0xf08df]=_[_0x452c('0x10')](_0x3da0a3,attributes);}else{delete _0x94af33[util[_0x452c('0x11')](_0x452c('0xf'),_0x3fbbd9)][_0xf08df];}emit(util[_0x452c('0x11')](_0x452c('0x12'),_0x3fbbd9,_0x303891),util['format']('%s_queue_waiting_interaction:%s',_0x3fbbd9,_0x26b301?_0x452c('0x13'):_0x452c('0x14')),_[_0x452c('0x10')](_0x3da0a3,attributes));}var rpc={'openchannelQueueReport':require(_0x452c('0x15')),'mailQueueReport':require(_0x452c('0x16')),'chatQueueReport':require(_0x452c('0x17')),'smsQueueReport':require(_0x452c('0x18')),'faxQueueReport':require(_0x452c('0x19')),'whatsappQueueReport':require(_0x452c('0x1a'))};var queue=schema({'name':{'type':_0x452c('0x1b'),'required':!![],'message':_0x452c('0x1c')},'timeout':{'type':_0x452c('0x1d'),'message':_0x452c('0x1e')}});function startRouting(_0x4c1a49,_0x2c187f,_0x2292d7,_0x2aa024){if(_0x4c1a49&&_0x2c187f&&_0x2292d7){_0x2c187f['waiting']+=0x1;var _0x5d0784={'uniqueid':_0x4c1a49,'from':_0x2292d7[_0x452c('0x1f')]?_0x2292d7[_0x452c('0x1f')]['from']:'','joinAt':moment()['format'](_0x452c('0x20')),'ContactId':_0x2292d7[_0x452c('0x21')]?_0x2292d7[_0x452c('0x21')]['id']:null,'ListId':_0x2292d7[_0x452c('0x22')]?_0x2292d7[_0x452c('0x22')]['id']:null};_0x5d0784[_[_0x452c('0x23')](_0x2292d7['channel'])+_0x452c('0x24')]=_0x2c187f['id']||null;_0x5d0784[_[_0x452c('0x23')](_0x2292d7['channel'])+'InteractionId']=_0x2292d7[_0x452c('0x25')]?_0x2292d7[_0x452c('0x25')]['id']:null;_0x5d0784[_[_0x452c('0x23')](_0x2292d7[_0x452c('0x26')])+_0x452c('0x27')]=_0x2292d7[_0x452c('0x28')]?_0x2292d7[_0x452c('0x28')]['id']:null;_0x5d0784[_[_0x452c('0x23')](_0x2292d7[_0x452c('0x26')])+(_0x2292d7[_0x452c('0x26')]!==_0x452c('0x29')?_0x452c('0x2a'):_0x452c('0x2b'))]=_0x2292d7[_0x452c('0xe')]?_0x2292d7['account']['id']:null;logger['info'](util[_0x452c('0x11')](_0x452c('0x2c'),_0x4c1a49,_0x2c187f[_0x452c('0x2d')]));emitChannelQueueInteraction(_0x2292d7[_0x452c('0x26')],_0x2c187f[_0x452c('0x2d')],_0x5d0784,_0x2292d7[_0x452c('0xe')][_0x452c('0x2d')],_0x2292d7[_0x452c('0x28')]['id'],!![],_0x2aa024,_0x2c187f['id']);if(rpc[_0x2292d7['channel']+'QueueReport']){return rpc[_0x2292d7[_0x452c('0x26')]+_0x452c('0x2e')][_0x452c('0x2f')](_0x5d0784)['catch'](function(_0x56ef66){logger[_0x452c('0x30')](_0x452c('0x31'));});}}}function stopRouting(_0x21ef14,_0x26c2f5,_0x5ee960,_0x36050d){if(_0x21ef14&&_0x26c2f5){_0x26c2f5[_0x452c('0x32')]-=0x1;var _0x4bbf3f={'leaveAt':moment()[_0x452c('0x11')](_0x452c('0x20')),'acceptAt':moment()[_0x452c('0x11')](_0x452c('0x20')),'reason':_0x452c('0x33')};logger[_0x452c('0x34')](util[_0x452c('0x11')](_0x452c('0x35'),_0x21ef14,_0x26c2f5[_0x452c('0x2d')]));emitChannelQueueInteraction(_0x5ee960[_0x452c('0x26')],_0x26c2f5[_0x452c('0x2d')],_0x5ee960[_0x452c('0x1f')],_0x5ee960[_0x452c('0xe')][_0x452c('0x2d')],_0x5ee960[_0x452c('0x28')]['id'],![],_0x36050d,_0x26c2f5['id']);if(rpc[_0x5ee960[_0x452c('0x26')]+_0x452c('0x2e')]){return rpc[_0x5ee960['channel']+'QueueReport'][_0x452c('0x36')](_0x21ef14,_0x4bbf3f)[_0x452c('0x37')](function(_0x3fc35d){logger[_0x452c('0x30')](_0x452c('0x38'));});}}}function endRouting(_0x5a2521,_0x299cd8,_0x3cae29,_0x2a69ab){if(_0x5a2521&&_0x299cd8){_0x299cd8[_0x452c('0x32')]-=0x1;var _0x4dba17={'leaveAt':moment()[_0x452c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x452c('0x20')),'reason':_0x452c('0x39')};logger[_0x452c('0x34')](util[_0x452c('0x11')](_0x452c('0x3a'),_0x5a2521,_0x299cd8[_0x452c('0x2d')]));emitChannelQueueInteraction(_0x3cae29['channel'],_0x299cd8[_0x452c('0x2d')],_0x3cae29[_0x452c('0x1f')],_0x3cae29[_0x452c('0xe')][_0x452c('0x2d')],_0x3cae29[_0x452c('0x28')]['id'],![],_0x2a69ab);if(rpc[_0x3cae29['channel']+'QueueReport']){return rpc[_0x3cae29['channel']+_0x452c('0x2e')]['update'](_0x5a2521,_0x4dba17)['catch'](function(_0x4aa561){logger[_0x452c('0x30')](_0x452c('0x38'));});}}}function handleFindQueue(_0xf2111f){return function(_0x2a81d9){return _0x2a81d9['name'][_0x452c('0x3b')]()===_0xf2111f['toLowerCase']();};}exports[_0x452c('0x3c')]=function(_0x45ddd2,_0x48f860,_0x46f1d5,_0x3c039d){return function(_0xe65d96){try{var _0xef17d5={'name':_0x48f860[0x0],'timeout':_0x48f860[0x1]};var _0x29602c=queue[_0x452c('0x3d')](_0xef17d5,{'typecast':!![]});if(_0x29602c[_0x452c('0x3e')]){logger['error']('[%s][QUEUE]\x20%s',_0x45ddd2,_[_0x452c('0x3f')](_0x29602c,_0x452c('0x28'))[_0x452c('0x40')](',\x20'));_0xe65d96[_0x452c('0x41')]();}else{var _0x5f1b39=_[_0x452c('0x42')](_0x46f1d5[_0x3c039d[_0x452c('0x26')]+'Queues'],handleFindQueue(_0xef17d5[_0x452c('0x2d')]));if(_0x5f1b39){startRouting(_0x45ddd2,_0x5f1b39,_0x3c039d,_0x46f1d5);var _0x207b83=(_0x5f1b39['timeout']||0xa)*0x3e8;var _0x4a5c19=(_0xef17d5[_0x452c('0x39')]||0x14)*0x3e8;var _0x1714ae,_0x2ea4ef;if(_0x207b83>_0x4a5c19){_0x4a5c19=_0x207b83;}var _0x2bc827=seqqueue[_0x452c('0x43')](_0x207b83);_0x2bc827['id']=_0x45ddd2;_0x2bc827[_0x452c('0x44')]=_0x207b83;_0x2bc827[_0x452c('0x45')]=_0x4a5c19;_0x2bc827[_0x452c('0x26')]=_0x3c039d[_0x452c('0x26')];_0x46f1d5[_0x452c('0x46')][_0x45ddd2]['on'](_0x452c('0x47'),function(){logger[_0x452c('0x34')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x45ddd2);stopRouting(_0x45ddd2,_0x5f1b39,_0x3c039d,_0x46f1d5);clearTimeout(_0x1714ae);_0x1714ae=undefined;_0x2bc827[_0x452c('0x48')](!![]);if(_0x46f1d5[_0x452c('0x46')][_0x45ddd2]){delete _0x46f1d5[_0x452c('0x46')][_0x45ddd2];}_0xe65d96[_0x452c('0x41')]();});_0x46f1d5[_0x452c('0x46')][_0x45ddd2]['on']('complete',function(){if(_0x46f1d5[_0x452c('0x46')][_0x45ddd2]){delete _0x46f1d5[_0x452c('0x46')][_0x45ddd2];}});_0x1714ae=setTimeout(function(){logger[_0x452c('0x34')](_0x452c('0x49'),_0x45ddd2);endRouting(_0x45ddd2,_0x5f1b39,_0x3c039d,_0x46f1d5);clearTimeout(_0x1714ae);_0x2bc827[_0x452c('0x48')](!![]);_0xe65d96['next']();},_0x4a5c19);switch(_0x5f1b39['strategy']){case _0x452c('0x4a'):strategy['rrmemory'](_0x2bc827,_0x5f1b39,_0x46f1d5,_0x3c039d);break;default:strategy['beepall'](_0x2bc827,_0x5f1b39,_0x46f1d5,_0x3c039d);}}else{logger[_0x452c('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x45ddd2,_0xef17d5[_0x452c('0x2d')]);_0xe65d96['stop']();}}}catch(_0x12fc23){console[_0x452c('0x4b')](_0x12fc23);logger['error'](_0x452c('0x4c'),_0x45ddd2,_0x12fc23['stack']);_0xe65d96[_0x452c('0x41')]();}};}; \ No newline at end of file +var _0x7445=['atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue'];(function(_0x4402a5,_0x8a27a5){var _0x681298=function(_0x247f6d){while(--_0x247f6d){_0x4402a5['push'](_0x4402a5['shift']());}};_0x681298(++_0x8a27a5);}(_0x7445,0x1e2));var _0x5744=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0x7445[_0x542d80];return _0x1f4492;};'use strict';var schema=require('validate');var _=require(_0x5744('0x0'));var util=require(_0x5744('0x1'));var seqqueue=require(_0x5744('0x2'));var moment=require('moment');var Redis=require(_0x5744('0x3'));var config=require(_0x5744('0x4'));var logger=require(_0x5744('0x5'))(_0x5744('0x6'));var strategy=require(_0x5744('0x7'));config['redis']=_[_0x5744('0x8')](config[_0x5744('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x5744('0xa'))(new Redis(config[_0x5744('0x9')]));var attributes=['id',_0x5744('0xb'),_0x5744('0xc'),_0x5744('0xd'),'from',_0x5744('0xe')];function emit(_0x475756,_0x29f246,_0x4c1d36){io['to'](_0x475756)[_0x5744('0xf')](_0x29f246,_0x4c1d36);}function emitChannelQueueInteraction(_0x261bcd,_0x563f39,_0x5958a7,_0x305500,_0x182633,_0x85e3cf,_0x1f592b,_0x53a1a7){var _0x52413e=_[_0x5744('0x10')](_0x5958a7);_0x52413e[_0x5744('0xb')]=_0x53a1a7;_0x52413e['queue']=_0x563f39;_0x52413e['account']=_0x305500;_0x52413e['id']=_0x182633;if(_0x85e3cf){_0x1f592b[util[_0x5744('0x11')]('%sQueuesWaitingInteractions',_0x261bcd)][_0x182633]=_[_0x5744('0x12')](_0x52413e,attributes);}else{delete _0x1f592b[util[_0x5744('0x11')](_0x5744('0x13'),_0x261bcd)][_0x182633];}emit(util[_0x5744('0x11')]('%s:queue:%s',_0x261bcd,_0x563f39),util[_0x5744('0x11')](_0x5744('0x14'),_0x261bcd,_0x85e3cf?_0x5744('0x15'):'remove'),_['pick'](_0x52413e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5744('0x16')),'chatQueueReport':require(_0x5744('0x17')),'smsQueueReport':require(_0x5744('0x18')),'faxQueueReport':require(_0x5744('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5744('0x1a'),'message':_0x5744('0x1b')}});function startRouting(_0x102569,_0x362a6f,_0x49954d,_0x4fa8b3){if(_0x102569&&_0x362a6f&&_0x49954d){_0x362a6f['waiting']+=0x1;var _0x5994bb={'uniqueid':_0x102569,'from':_0x49954d[_0x5744('0x1c')]?_0x49954d[_0x5744('0x1c')]['from']:'','joinAt':moment()[_0x5744('0x11')](_0x5744('0x1d')),'ContactId':_0x49954d[_0x5744('0x1e')]?_0x49954d[_0x5744('0x1e')]['id']:null,'ListId':_0x49954d[_0x5744('0x1f')]?_0x49954d[_0x5744('0x1f')]['id']:null};_0x5994bb[_[_0x5744('0x20')](_0x49954d[_0x5744('0x21')])+_0x5744('0x22')]=_0x362a6f['id']||null;_0x5994bb[_['upperFirst'](_0x49954d[_0x5744('0x21')])+_0x5744('0x23')]=_0x49954d[_0x5744('0x24')]?_0x49954d[_0x5744('0x24')]['id']:null;_0x5994bb[_[_0x5744('0x20')](_0x49954d[_0x5744('0x21')])+'MessageId']=_0x49954d[_0x5744('0x25')]?_0x49954d['message']['id']:null;_0x5994bb[_[_0x5744('0x20')](_0x49954d[_0x5744('0x21')])+(_0x49954d[_0x5744('0x21')]!==_0x5744('0x26')?_0x5744('0x27'):_0x5744('0x28'))]=_0x49954d[_0x5744('0xc')]?_0x49954d[_0x5744('0xc')]['id']:null;logger[_0x5744('0x29')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x102569,_0x362a6f[_0x5744('0x2a')]));emitChannelQueueInteraction(_0x49954d[_0x5744('0x21')],_0x362a6f[_0x5744('0x2a')],_0x5994bb,_0x49954d[_0x5744('0xc')][_0x5744('0x2a')],_0x49954d[_0x5744('0x25')]['id'],!![],_0x4fa8b3,_0x362a6f['id']);if(rpc[_0x49954d[_0x5744('0x21')]+_0x5744('0x2b')]){return rpc[_0x49954d[_0x5744('0x21')]+_0x5744('0x2b')][_0x5744('0x2c')](_0x5994bb)[_0x5744('0x2d')](function(_0xc21994){logger[_0x5744('0x2e')]('create\x20queue\x20report');});}}}function stopRouting(_0x49c0f6,_0x296411,_0x43cbe2,_0x58cd99){if(_0x49c0f6&&_0x296411){_0x296411[_0x5744('0x2f')]-=0x1;var _0x4af2fc={'leaveAt':moment()[_0x5744('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x5744('0x11')](_0x5744('0x1d')),'reason':_0x5744('0x30')};logger[_0x5744('0x29')](util[_0x5744('0x11')](_0x5744('0x31'),_0x49c0f6,_0x296411['name']));emitChannelQueueInteraction(_0x43cbe2[_0x5744('0x21')],_0x296411[_0x5744('0x2a')],_0x43cbe2['body'],_0x43cbe2[_0x5744('0xc')][_0x5744('0x2a')],_0x43cbe2[_0x5744('0x25')]['id'],![],_0x58cd99,_0x296411['id']);if(rpc[_0x43cbe2[_0x5744('0x21')]+_0x5744('0x2b')]){return rpc[_0x43cbe2[_0x5744('0x21')]+_0x5744('0x2b')]['update'](_0x49c0f6,_0x4af2fc)['catch'](function(_0x102766){logger['error'](_0x5744('0x32'));});}}}function endRouting(_0x15e481,_0x2f6e52,_0x57b8f2,_0x8f026){if(_0x15e481&&_0x2f6e52){_0x2f6e52[_0x5744('0x2f')]-=0x1;var _0x40d375={'leaveAt':moment()[_0x5744('0x11')](_0x5744('0x1d')),'exitAt':moment()[_0x5744('0x11')](_0x5744('0x1d')),'reason':_0x5744('0x33')};logger[_0x5744('0x29')](util[_0x5744('0x11')](_0x5744('0x34'),_0x15e481,_0x2f6e52[_0x5744('0x2a')]));emitChannelQueueInteraction(_0x57b8f2['channel'],_0x2f6e52['name'],_0x57b8f2[_0x5744('0x1c')],_0x57b8f2[_0x5744('0xc')][_0x5744('0x2a')],_0x57b8f2[_0x5744('0x25')]['id'],![],_0x8f026);if(rpc[_0x57b8f2[_0x5744('0x21')]+_0x5744('0x2b')]){return rpc[_0x57b8f2[_0x5744('0x21')]+_0x5744('0x2b')][_0x5744('0x35')](_0x15e481,_0x40d375)[_0x5744('0x2d')](function(_0x35a510){logger[_0x5744('0x2e')](_0x5744('0x32'));});}}}function handleFindQueue(_0x4fa5d){return function(_0x467ca3){return _0x467ca3[_0x5744('0x2a')][_0x5744('0x36')]()===_0x4fa5d[_0x5744('0x36')]();};}exports[_0x5744('0x37')]=function(_0x23b669,_0x504e41,_0x5a2898,_0x298c8a){return function(_0x174b8a){try{var _0x1ee19d={'name':_0x504e41[0x0],'timeout':_0x504e41[0x1]};var _0x2d0b28=queue[_0x5744('0x38')](_0x1ee19d,{'typecast':!![]});if(_0x2d0b28['length']){logger[_0x5744('0x2e')](_0x5744('0x39'),_0x23b669,_[_0x5744('0x3a')](_0x2d0b28,_0x5744('0x25'))[_0x5744('0x3b')](',\x20'));_0x174b8a[_0x5744('0x3c')]();}else{var _0x582ab5=_[_0x5744('0x3d')](_0x5a2898[_0x298c8a[_0x5744('0x21')]+_0x5744('0x3e')],handleFindQueue(_0x1ee19d[_0x5744('0x2a')]));if(_0x582ab5){startRouting(_0x23b669,_0x582ab5,_0x298c8a,_0x5a2898);var _0x114355=(_0x582ab5[_0x5744('0x33')]||0xa)*0x3e8;var _0x32e10e=(_0x1ee19d['timeout']||0x14)*0x3e8;var _0x2eb26e,_0x4e29e5;if(_0x114355>_0x32e10e){_0x32e10e=_0x114355;}var _0xf49566=seqqueue[_0x5744('0x3f')](_0x114355);_0xf49566['id']=_0x23b669;_0xf49566[_0x5744('0x40')]=_0x114355;_0xf49566[_0x5744('0x41')]=_0x32e10e;_0xf49566[_0x5744('0x21')]=_0x298c8a['channel'];_0x5a2898[_0x5744('0x42')][_0x23b669]['on'](_0x5744('0x43'),function(){logger['info'](_0x5744('0x44'),_0x23b669);stopRouting(_0x23b669,_0x582ab5,_0x298c8a,_0x5a2898);clearTimeout(_0x2eb26e);_0x2eb26e=undefined;_0xf49566['close'](!![]);if(_0x5a2898[_0x5744('0x42')][_0x23b669]){delete _0x5a2898['rules'][_0x23b669];}_0x174b8a[_0x5744('0x3c')]();});_0x5a2898[_0x5744('0x42')][_0x23b669]['on']('complete',function(){if(_0x5a2898[_0x5744('0x42')][_0x23b669]){delete _0x5a2898[_0x5744('0x42')][_0x23b669];}});_0x2eb26e=setTimeout(function(){logger[_0x5744('0x29')](_0x5744('0x45'),_0x23b669);endRouting(_0x23b669,_0x582ab5,_0x298c8a,_0x5a2898);clearTimeout(_0x2eb26e);_0xf49566[_0x5744('0x46')](!![]);_0x174b8a[_0x5744('0x47')]();},_0x32e10e);switch(_0x582ab5[_0x5744('0x48')]){case _0x5744('0x49'):strategy[_0x5744('0x49')](_0xf49566,_0x582ab5,_0x5a2898,_0x298c8a);break;default:strategy[_0x5744('0x4a')](_0xf49566,_0x582ab5,_0x5a2898,_0x298c8a);}}else{logger[_0x5744('0x2e')](_0x5744('0x4b'),_0x23b669,_0x1ee19d[_0x5744('0x2a')]);_0x174b8a[_0x5744('0x3c')]();}}}catch(_0x5c9b20){console[_0x5744('0x4c')](_0x5c9b20);logger[_0x5744('0x2e')]('[%s][QUEUE]\x20%s',_0x23b669,_0x5c9b20[_0x5744('0x4d')]);_0x174b8a[_0x5744('0x3c')]();}};}; \ 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 e4f67ae..158c0d0 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 _0xea83=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','notificationId','agent','push','handleRun','bind','handleTimeout','squeue','timeout','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','isAgentAvailable','realtime','busy','busyQueue','showNotification'];(function(_0x101489,_0x200af3){var _0x5718fd=function(_0x3f5dca){while(--_0x3f5dca){_0x101489['push'](_0x101489['shift']());}};_0x5718fd(++_0x200af3);}(_0xea83,0x15c));var _0x3ea8=function(_0x4fa892,_0x4e66a0){_0x4fa892=_0x4fa892-0x0;var _0x260ef6=_0xea83[_0x4fa892];return _0x260ef6;};'use strict';var _=require('lodash');var uuid=require(_0x3ea8('0x0'));var util=require(_0x3ea8('0x1'));var logger=require(_0x3ea8('0x2'))('routing');var Agent=function(_0x57f141,_0x4c6d62,_0x800f40,_0x12db99){this[_0x3ea8('0x3')]=uuid['v4']();this['squeue']=_0x57f141;this[_0x3ea8('0x4')]=_0x4c6d62;this['realtime']=_0x800f40;this['routing']=_0x12db99;this['squeue'][_0x3ea8('0x5')](this[_0x3ea8('0x6')][_0x3ea8('0x7')](this),this[_0x3ea8('0x8')][_0x3ea8('0x7')](this));this[_0x3ea8('0x9')]['on'](_0x3ea8('0xa'),this['handleTimeout'][_0x3ea8('0x7')](this));this[_0x3ea8('0x9')]['on']('drained',this[_0x3ea8('0xb')][_0x3ea8('0x7')](this));};Agent['prototype'][_0x3ea8('0x5')]=function(){this[_0x3ea8('0x9')][_0x3ea8('0x5')](this[_0x3ea8('0x6')][_0x3ea8('0x7')](this),this[_0x3ea8('0x8')][_0x3ea8('0x7')](this));};Agent[_0x3ea8('0xc')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x3ea8('0x6')]=function(_0x3578a0){logger[_0x3ea8('0xd')](_0x3ea8('0xe'),this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x4')]['id']);if(_[_0x3ea8('0xf')](this['realtime'][_0x3ea8('0x10')][this[_0x3ea8('0x4')]['id']])){logger[_0x3ea8('0xd')](_0x3ea8('0x11'),this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x4')]['id']);setTimeout(this['push'][_0x3ea8('0x7')](this),0x3e8);}else{if(this[_0x3ea8('0x12')]['forcedOwnership']||util[_0x3ea8('0x13')](this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x14')][_0x3ea8('0x10')][this[_0x3ea8('0x4')]['id']],this['squeue']['channel'],![])){this[_0x3ea8('0x14')][_0x3ea8('0x10')][this[_0x3ea8('0x4')]['id']][_0x3ea8('0x15')]=!![];this[_0x3ea8('0x14')][_0x3ea8('0x10')][this[_0x3ea8('0x4')]['id']][_0x3ea8('0x16')]=undefined;util[_0x3ea8('0x17')](this[_0x3ea8('0x3')],this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x14')]['agents'][this['agent']['id']],null,this[_0x3ea8('0x12')]);util['writeLog'](this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x14')][_0x3ea8('0x10')][this[_0x3ea8('0x4')]['id']],_0x3ea8('0x18')+(this[_0x3ea8('0x12')]['forcedOwnership']?':FORCED':''));}else{logger[_0x3ea8('0xd')](_0x3ea8('0x19'),this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x3ea8('0xc')][_0x3ea8('0x8')]=function(_0x55d714){if(_['isNil'](this[_0x3ea8('0x14')][_0x3ea8('0x10')][this['agent']['id']])){return logger[_0x3ea8('0xd')](_0x3ea8('0x11'),this['squeue']['id'],this[_0x3ea8('0x4')]['id']);}else{logger[_0x3ea8('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x4')]['id']);util[_0x3ea8('0x1a')](this[_0x3ea8('0x3')],this[_0x3ea8('0x9')]['id'],this['realtime'][_0x3ea8('0x10')][this['agent']['id']],null,this[_0x3ea8('0x12')]);this[_0x3ea8('0x14')][_0x3ea8('0x10')][this[_0x3ea8('0x4')]['id']][_0x3ea8('0x15')]=![];this[_0x3ea8('0x14')][_0x3ea8('0x10')][this[_0x3ea8('0x4')]['id']][_0x3ea8('0x16')]=undefined;util[_0x3ea8('0x1b')](this[_0x3ea8('0x9')]['id'],this[_0x3ea8('0x14')]['agents'][this[_0x3ea8('0x4')]['id']],_0x55d714?_0x3ea8('0x1c'):_0x3ea8('0x1d'));}if(!_0x55d714){setTimeout(this[_0x3ea8('0x5')][_0x3ea8('0x7')](this),0x3e8);}};function agent(_0xa3309,_0x374b26,_0x511fac,_0x358ec7){return new Agent(_0xa3309,_0x374b26,_0x511fac,_0x358ec7);}module[_0x3ea8('0x1e')]=agent; \ No newline at end of file +var _0x1dbd=['handleRun','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy','busyQueue','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','handleDrained','prototype'];(function(_0x14b1df,_0x5874ec){var _0x5249b8=function(_0x26bdc5){while(--_0x26bdc5){_0x14b1df['push'](_0x14b1df['shift']());}};_0x5249b8(++_0x5874ec);}(_0x1dbd,0x1e0));var _0xd1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1db('0x0'));var uuid=require('uuid');var util=require(_0xd1db('0x1'));var logger=require(_0xd1db('0x2'))(_0xd1db('0x3'));var Agent=function(_0x26cb58,_0x21a4d7,_0x2f989b,_0xdde2f0){this[_0xd1db('0x4')]=uuid['v4']();this[_0xd1db('0x5')]=_0x26cb58;this[_0xd1db('0x6')]=_0x21a4d7;this[_0xd1db('0x7')]=_0x2f989b;this['routing']=_0xdde2f0;this['squeue'][_0xd1db('0x8')](this['handleRun'][_0xd1db('0x9')](this),this[_0xd1db('0xa')]['bind'](this));this[_0xd1db('0x5')]['on']('timeout',this[_0xd1db('0xa')][_0xd1db('0x9')](this));this[_0xd1db('0x5')]['on']('drained',this[_0xd1db('0xb')][_0xd1db('0x9')](this));};Agent[_0xd1db('0xc')][_0xd1db('0x8')]=function(){this[_0xd1db('0x5')][_0xd1db('0x8')](this[_0xd1db('0xd')][_0xd1db('0x9')](this),this[_0xd1db('0xa')][_0xd1db('0x9')](this));};Agent[_0xd1db('0xc')][_0xd1db('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xd1db('0xc')][_0xd1db('0xd')]=function(_0x4d4073){logger[_0xd1db('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xd1db('0x6')]['id']);if(_[_0xd1db('0xf')](this[_0xd1db('0x7')][_0xd1db('0x10')][this[_0xd1db('0x6')]['id']])){logger[_0xd1db('0xe')](_0xd1db('0x11'),this[_0xd1db('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xd1db('0x8')][_0xd1db('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util['isAgentAvailable'](this[_0xd1db('0x5')]['id'],this['realtime'][_0xd1db('0x10')][this[_0xd1db('0x6')]['id']],this[_0xd1db('0x5')]['channel'],![])){this[_0xd1db('0x7')][_0xd1db('0x10')][this[_0xd1db('0x6')]['id']][_0xd1db('0x12')]=!![];this['realtime'][_0xd1db('0x10')][this[_0xd1db('0x6')]['id']][_0xd1db('0x13')]=undefined;util[_0xd1db('0x14')](this['notificationId'],this[_0xd1db('0x5')]['id'],this[_0xd1db('0x7')]['agents'][this[_0xd1db('0x6')]['id']],null,this[_0xd1db('0x3')]);util['writeLog'](this[_0xd1db('0x5')]['id'],this['realtime']['agents'][this[_0xd1db('0x6')]['id']],'RINGING'+(this[_0xd1db('0x3')]['forcedOwnership']?_0xd1db('0x15'):''));}else{logger[_0xd1db('0xe')](_0xd1db('0x16'),this[_0xd1db('0x5')]['id'],this[_0xd1db('0x6')]['id']);setTimeout(this[_0xd1db('0x8')]['bind'](this),0x3e8);}}};Agent[_0xd1db('0xc')]['handleTimeout']=function(_0x10b945){if(_[_0xd1db('0xf')](this[_0xd1db('0x7')]['agents'][this[_0xd1db('0x6')]['id']])){return logger[_0xd1db('0xe')](_0xd1db('0x11'),this[_0xd1db('0x5')]['id'],this['agent']['id']);}else{logger[_0xd1db('0xe')](_0xd1db('0x17'),this[_0xd1db('0x5')]['id'],this[_0xd1db('0x6')]['id']);util[_0xd1db('0x18')](this[_0xd1db('0x4')],this[_0xd1db('0x5')]['id'],this[_0xd1db('0x7')][_0xd1db('0x10')][this[_0xd1db('0x6')]['id']],null,this[_0xd1db('0x3')]);this['realtime'][_0xd1db('0x10')][this['agent']['id']][_0xd1db('0x12')]=![];this[_0xd1db('0x7')][_0xd1db('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0xd1db('0x19')](this['squeue']['id'],this[_0xd1db('0x7')][_0xd1db('0x10')][this[_0xd1db('0x6')]['id']],_0x10b945?_0xd1db('0x1a'):_0xd1db('0x1b'));}if(!_0x10b945){setTimeout(this[_0xd1db('0x8')]['bind'](this),0x3e8);}};function agent(_0x5a7fa3,_0xd8cde9,_0x54bb88,_0x100bea){return new Agent(_0x5a7fa3,_0xd8cde9,_0x54bb88,_0x100bea);}module[_0xd1db('0x1c')]=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 981fbdc..a72bab9 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 _0xa2c8=['handleDrained','prototype','push','isNil','Agents','length','agents','info','channel','writeLog','RINGING','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','STOP','TIMEOUT','busy','lodash','uuid','./util','../../../../../config/logger','routing','queue','realtime','squeue','handleRun','bind','handleTimeout','drained'];(function(_0xbc1d6a,_0x562312){var _0x4c61da=function(_0x405660){while(--_0x405660){_0xbc1d6a['push'](_0xbc1d6a['shift']());}};_0x4c61da(++_0x562312);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8a2c('0x0'));var uuid=require(_0x8a2c('0x1'));var util=require(_0x8a2c('0x2'));var logger=require(_0x8a2c('0x3'))(_0x8a2c('0x4'));var Beepall=function(_0x67da9d,_0x48d4f9,_0x1b1142,_0x590508){this['notificationId']=uuid['v4']();this['squeue']=_0x67da9d;this[_0x8a2c('0x5')]=_0x48d4f9;this[_0x8a2c('0x6')]=_0x1b1142;this[_0x8a2c('0x4')]=_0x590508;this[_0x8a2c('0x7')]['push'](this[_0x8a2c('0x8')][_0x8a2c('0x9')](this),this[_0x8a2c('0xa')]['bind'](this));this['squeue']['on']('timeout',this[_0x8a2c('0xa')][_0x8a2c('0x9')](this));this['squeue']['on'](_0x8a2c('0xb'),this[_0x8a2c('0xc')][_0x8a2c('0x9')](this));};Beepall[_0x8a2c('0xd')][_0x8a2c('0xe')]=function(){this[_0x8a2c('0x7')]['push'](this[_0x8a2c('0x8')][_0x8a2c('0x9')](this),this['handleTimeout'][_0x8a2c('0x9')](this));};Beepall[_0x8a2c('0xd')]['handleDrained']=function(_0x5a1fa7){this['handleTimeout'](!![]);};Beepall['prototype'][_0x8a2c('0x8')]=function(_0x16c114){var _0x30b3c2=!![];if(!_['isNil'](this['queue'])&&!_[_0x8a2c('0xf')](this[_0x8a2c('0x5')][_0x8a2c('0x10')])&&this[_0x8a2c('0x5')][_0x8a2c('0x10')][_0x8a2c('0x11')]>0x0){for(var _0x3d82a5=0x0,_0x3e18f1;_0x3d82a50x0){for(var _0x2f77e7=0x0,_0x7b4538;_0x2f77e70x0&&_0x2f3415[_0xa36371+'CurrentCapacity']>=_0x2f3415[_0xa36371+_0x6709('0x25')]){writeLog(_0x1c5153,_0x2f3415,_0xa36371[_0x6709('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6709('0x28')]=function(_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325){return sendNotification(!![],_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325);};exports[_0x6709('0x29')]=function(_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee){return sendNotification(![],_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xd101=['account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','info','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','split','\x20interaction'];(function(_0x12647a,_0x532050){var _0x4844cb=function(_0x53877c){while(--_0x53877c){_0x12647a['push'](_0x12647a['shift']());}};_0x4844cb(++_0x532050);}(_0xd101,0xc1));var _0x1d10=function(_0x12fe9c,_0x59f92a){_0x12fe9c=_0x12fe9c-0x0;var _0x49e619=_0xd101[_0x12fe9c];return _0x49e619;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var utils=require(_0x1d10('0x1'));var Mustache=require(_0x1d10('0x2'));var Redis=require(_0x1d10('0x3'));var config=require(_0x1d10('0x4'));var logger=require(_0x1d10('0x5'))(_0x1d10('0x6'));config[_0x1d10('0x7')]=_[_0x1d10('0x8')](config['redis'],{'host':_0x1d10('0x9'),'port':0x18eb});var io=require(_0x1d10('0xa'))(new Redis(config[_0x1d10('0x7')]));function emit(_0x27d569,_0xb9e08,_0x36335e){io['to'](_0x27d569)[_0x1d10('0xb')](_0xb9e08,_0x36335e);}function sendNotification(_0x43df2c,_0x3a15c8,_0x182c87,_0xf7926b,_0x14e4df,_0x1610b4){io['to'](util[_0x1d10('0xc')](_0x1d10('0xd'),_0xf7926b[_0x1d10('0xe')]))[_0x1d10('0xb')]('user:save',_0xf7926b);var _0x3a2050=_0x1610b4||{};var _0x93cb59=_0x182c87[_0x1d10('0xf')]('.');var _0x190d4c={'uniqueid':_0x3a15c8,'channel':_0x93cb59[0x0],'id':_0x93cb59[0x1],'title':_0x93cb59[0x0]+_0x1d10('0x10'),'interactionId':_0x93cb59[0x2],'queue':_0x14e4df?_0x14e4df['name']:null,'sound':_0x3a2050[_0x1d10('0x11')][_0x1d10('0x12')],'shake':_0x3a2050[_0x1d10('0x11')][_0x1d10('0x13')]};try{if(!_0x3a2050[_0x1d10('0x14')]){_0x3a2050[_0x1d10('0x14')]={};}if(_0x14e4df){_0x3a2050['body'][_0x1d10('0x15')]=_0x14e4df;}else if(_0x3a2050[_0x1d10('0x14')][_0x1d10('0x15')]){delete _0x3a2050[_0x1d10('0x14')]['queue'];}_0x190d4c[_0x1d10('0x16')]=utils[_0x1d10('0x17')](_0x3a2050[_0x1d10('0x11')][_0x1d10('0x18')],_0x3a2050);}catch(_0x1b2051){_0x190d4c[_0x1d10('0x16')]=_0x1d10('0x19');logger['error'](util[_0x1d10('0xc')](_0x1d10('0x1a'),_0x3a15c8,_0x1b2051[_0x1d10('0x1b')]));}io['to'](util[_0x1d10('0xc')](_0x1d10('0xd'),_0xf7926b['name']))['emit'](util[_0x1d10('0xc')]('notification:%s',_0x43df2c?'save':'remove'),_0x190d4c);}function writeLog(_0x237b92,_0x2496bc,_0x24717c){return logger[_0x1d10('0x1c')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x237b92,_0x2496bc[_0x1d10('0xe')],_0x24717c));}exports['isAgentAvailable']=function(_0x68b09,_0x474321,_0x160802,_0x37f22d){if(_0x474321[_0x1d10('0x1d')]){writeLog(_0x68b09,_0x474321,_0x1d10('0x1e'));return![];}if(!_0x474321[_0x1d10('0x1f')]){writeLog(_0x68b09,_0x474321,_0x1d10('0x20'));return![];}if(_0x474321[_0x160802+_0x1d10('0x21')]){writeLog(_0x68b09,_0x474321,_0x1d10('0x22'));return![];}if(_0x37f22d&&_0x474321[_0x1d10('0x23')](_0x160802+'Capacity')&&_0x474321[_0x1d10('0x23')](_0x160802+_0x1d10('0x24'))){if(_0x474321[_0x160802+_0x1d10('0x25')]>0x0&&_0x474321[_0x160802+_0x1d10('0x24')]>=_0x474321[_0x160802+_0x1d10('0x25')]){writeLog(_0x68b09,_0x474321,_0x160802[_0x1d10('0x26')]()+_0x1d10('0x27'));return![];}}return!![];};exports[_0x1d10('0x28')]=function(_0x4f7837,_0x355e10,_0x24eb47,_0x59b5eb,_0x13a3dc){return sendNotification(!![],_0x4f7837,_0x355e10,_0x24eb47,_0x59b5eb,_0x13a3dc);};exports['hideNotification']=function(_0x4db221,_0x41b5b8,_0x597aea,_0xa4e6aa,_0x21a02e){return sendNotification(![],_0x4db221,_0x41b5b8,_0x597aea,_0xa4e6aa,_0x21a02e);};exports[_0x1d10('0x29')]=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 c3566d9..9340ea0 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 _0x39a7=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils'];(function(_0x5100c1,_0x27bdae){var _0x5769f9=function(_0xcee3b4){while(--_0xcee3b4){_0x5100c1['push'](_0x5100c1['shift']());}};_0x5769f9(++_0x27bdae);}(_0x39a7,0x15b));var _0x739a=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x39a7[_0x50f392];return _0x5926f2;};'use strict';var schema=require(_0x739a('0x0'));var sh=require(_0x739a('0x1'));var _=require(_0x739a('0x2'));var utils=require(_0x739a('0x3'));var logger=require(_0x739a('0x4'))(_0x739a('0x5'));var system=schema({'command':{'type':_0x739a('0x6'),'required':!![],'message':_0x739a('0x7')}});exports['consequence']=function(_0xa9a796,_0x20ff9b){return function(_0x173abb){try{var _0x5bf8f1={'command':_0x20ff9b[0x0]};var _0x30f170=system['validate'](_0x5bf8f1,{'typecast':!![]});if(_0x30f170[_0x739a('0x8')]){logger[_0x739a('0x9')](_0x739a('0xa'),_0xa9a796,_[_0x739a('0xb')](_0x30f170,_0x739a('0xc'))['join'](',\x20'));logger['info'](_0x739a('0xd'),_0xa9a796);_0x173abb[_0x739a('0xe')]();}else{var _0x3236e1=this;var _0x3fbdeb=utils[_0x739a('0xf')](_0x20ff9b[0x0],this);logger[_0x739a('0x10')](_0x739a('0x11'),_0xa9a796,_0x3fbdeb);sh[_0x739a('0x12')](_['trim'](_0x3fbdeb),function(_0x4e1eba,_0x4e5105){logger['info'](_0x739a('0x13'),_0xa9a796,_0x4e1eba);if(_0x4e1eba==0x0){var _0x1c25a0=_0x4e5105[_0x739a('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x20ff9b[0x1])||_[_0x739a('0x15')](_0x20ff9b[0x1])){logger[_0x739a('0x10')](_0x739a('0x16'),_0xa9a796);_0x3236e1[_0x739a('0x17')][_0x20ff9b[0x1]]=_0x1c25a0;}else{logger[_0x739a('0x10')](_0x739a('0x18'),_0xa9a796,_0x20ff9b[0x1],_0x1c25a0);_0x3236e1[_0x739a('0x17')][_0x20ff9b[0x1]]=_0x1c25a0;}}_0x173abb[_0x739a('0xe')]();});}}catch(_0x42d65a){logger[_0x739a('0x9')](_0x739a('0xa'),_0xa9a796,_[_0x739a('0x19')](_0x42d65a)?JSON[_0x739a('0x1a')](_0x42d65a):_0x42d65a);logger['info'](_0x739a('0xd'),_0xa9a796);_0x173abb[_0x739a('0xe')]();}};}; \ No newline at end of file +var _0x0855=['[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','stringify','validate','shelljs','./utils','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0855,0x1de));var _0x5085=function(_0x3723eb,_0x4ef6ad){_0x3723eb=_0x3723eb-0x0;var _0x30b1e2=_0x0855[_0x3723eb];return _0x30b1e2;};'use strict';var schema=require(_0x5085('0x0'));var sh=require(_0x5085('0x1'));var _=require('lodash');var utils=require(_0x5085('0x2'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x5085('0x3'),'required':!![],'message':_0x5085('0x4')}});exports['consequence']=function(_0x2eaf19,_0x48d07a){return function(_0x37a70a){try{var _0x1e499a={'command':_0x48d07a[0x0]};var _0x1dc74b=system[_0x5085('0x0')](_0x1e499a,{'typecast':!![]});if(_0x1dc74b['length']){logger[_0x5085('0x5')](_0x5085('0x6'),_0x2eaf19,_[_0x5085('0x7')](_0x1dc74b,_0x5085('0x8'))[_0x5085('0x9')](',\x20'));logger[_0x5085('0xa')](_0x5085('0xb'),_0x2eaf19);_0x37a70a['next']();}else{var _0x454cb8=this;var _0xb323c4=utils[_0x5085('0xc')](_0x48d07a[0x0],this);logger[_0x5085('0xa')](_0x5085('0xd'),_0x2eaf19,_0xb323c4);sh[_0x5085('0xe')](_['trim'](_0xb323c4),function(_0x3c23bc,_0x2b94de){logger[_0x5085('0xa')](_0x5085('0xf'),_0x2eaf19,_0x3c23bc);if(_0x3c23bc==0x0){var _0x44633c=_0x2b94de['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x48d07a[0x1])||_[_0x5085('0x10')](_0x48d07a[0x1])){logger[_0x5085('0xa')](_0x5085('0x11'),_0x2eaf19);_0x454cb8[_0x5085('0x12')][_0x48d07a[0x1]]=_0x44633c;}else{logger[_0x5085('0xa')](_0x5085('0x13'),_0x2eaf19,_0x48d07a[0x1],_0x44633c);_0x454cb8['body'][_0x48d07a[0x1]]=_0x44633c;}}_0x37a70a[_0x5085('0x14')]();});}}catch(_0x49d284){logger[_0x5085('0x5')](_0x5085('0x6'),_0x2eaf19,_['isObject'](_0x49d284)?JSON[_0x5085('0x15')](_0x49d284):_0x49d284);logger[_0x5085('0xa')](_0x5085('0xb'),_0x2eaf19);_0x37a70a[_0x5085('0x14')]();}};}; \ 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 d6c0228..55ed154 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 _0x482e=['channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x482e,0x169));var _0xe482=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x482e[_0x122ef9];return _0x42fba0;};'use strict';var schema=require(_0xe482('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xe482('0x1')),'smsInteraction':require(_0xe482('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe482('0x3')),'whatsappInteraction':require(_0xe482('0x4'))};var logger=require(_0xe482('0x5'))(_0xe482('0x6'));var tag=schema({'tag':{'type':_0xe482('0x7'),'required':!![],'message':_0xe482('0x8')}});exports[_0xe482('0x9')]=function(_0x12d260,_0x441a85,_0x3f7178,_0x2be559){return function(_0x582538){try{var _0x486f2a={'tag':_0x441a85[0x0]};var _0x3a5984=tag[_0xe482('0x0')](_0x486f2a,{'typecast':!![]});if(_0x3a5984[_0xe482('0xa')]){logger[_0xe482('0xb')](_0xe482('0xc'),_0x12d260,_[_0xe482('0xd')](_0x3a5984,_0xe482('0xe'))['join'](',\x20'));logger[_0xe482('0xf')](_0xe482('0x10'),_0x12d260);_0x582538['next']();}else{var _0x154943={'ids':[_0x441a85[0x0]]};if(rpc[_0x2be559[_0xe482('0x11')]+_0xe482('0x12')]){rpc[_0x2be559['channel']+_0xe482('0x12')][_0xe482('0x13')](_0x2be559[_0xe482('0x14')]['id'],_0x154943)['then'](function(_0x47ea47){logger[_0xe482('0xf')](_0xe482('0x15'),_0x12d260,_0x441a85[0x1],_0x2be559['channel'],_0x2be559[_0xe482('0x14')]['id']);})[_0xe482('0x16')](function(_0x3506d4){logger[_0xe482('0xb')](_0xe482('0xc'),_0x12d260,JSON[_0xe482('0x17')](_0x3506d4));logger[_0xe482('0xf')](_0xe482('0x10'),_0x12d260);})[_0xe482('0x18')](function(){_0x582538[_0xe482('0x19')]();});}}}catch(_0x141da4){logger[_0xe482('0xb')](_0xe482('0xc'),_0x12d260,_[_0xe482('0x1a')](_0x141da4)?JSON[_0xe482('0x17')](_0x141da4):_0x141da4);logger[_0xe482('0xf')](_0xe482('0x10'),_0x12d260);_0x582538[_0xe482('0x19')]();}};}; \ No newline at end of file +var _0xeabf=['finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','[%s][TAG]\x20%s','stringify'];(function(_0xf0ab7c,_0x23bbc2){var _0x198144=function(_0x1c3a40){while(--_0x1c3a40){_0xf0ab7c['push'](_0xf0ab7c['shift']());}};_0x198144(++_0x23bbc2);}(_0xeabf,0x119));var _0xfeab=function(_0x227079,_0x2e2baa){_0x227079=_0x227079-0x0;var _0x1e956c=_0xeabf[_0x227079];return _0x1e956c;};'use strict';var schema=require(_0xfeab('0x0'));var _=require(_0xfeab('0x1'));var rpc={'chatInteraction':require(_0xfeab('0x2')),'openchannelInteraction':require(_0xfeab('0x3')),'smsInteraction':require(_0xfeab('0x4')),'mailInteraction':require(_0xfeab('0x5')),'faxInteraction':require(_0xfeab('0x6')),'whatsappInteraction':require(_0xfeab('0x7'))};var logger=require(_0xfeab('0x8'))(_0xfeab('0x9'));var tag=schema({'tag':{'type':_0xfeab('0xa'),'required':!![],'message':_0xfeab('0xb')}});exports[_0xfeab('0xc')]=function(_0x2ffb8c,_0xde5065,_0x79c18d,_0x44fb7d){return function(_0x13219b){try{var _0x354ce2={'tag':_0xde5065[0x0]};var _0x127774=tag[_0xfeab('0x0')](_0x354ce2,{'typecast':!![]});if(_0x127774[_0xfeab('0xd')]){logger['error']('[%s][TAG]\x20%s',_0x2ffb8c,_[_0xfeab('0xe')](_0x127774,_0xfeab('0xf'))[_0xfeab('0x10')](',\x20'));logger[_0xfeab('0x11')](_0xfeab('0x12'),_0x2ffb8c);_0x13219b[_0xfeab('0x13')]();}else{var _0x93f07e={'ids':[_0xde5065[0x0]]};if(rpc[_0x44fb7d[_0xfeab('0x14')]+'Interaction']){rpc[_0x44fb7d['channel']+_0xfeab('0x15')][_0xfeab('0x16')](_0x44fb7d[_0xfeab('0x17')]['id'],_0x93f07e)[_0xfeab('0x18')](function(_0x168804){logger[_0xfeab('0x11')](_0xfeab('0x19'),_0x2ffb8c,_0xde5065[0x1],_0x44fb7d[_0xfeab('0x14')],_0x44fb7d[_0xfeab('0x17')]['id']);})['catch'](function(_0x3e481f){logger[_0xfeab('0x1a')](_0xfeab('0x1b'),_0x2ffb8c,JSON[_0xfeab('0x1c')](_0x3e481f));logger[_0xfeab('0x11')](_0xfeab('0x12'),_0x2ffb8c);})[_0xfeab('0x1d')](function(){_0x13219b[_0xfeab('0x13')]();});}}}catch(_0x424a46){logger[_0xfeab('0x1a')](_0xfeab('0x1b'),_0x2ffb8c,_[_0xfeab('0x1e')](_0x424a46)?JSON[_0xfeab('0x1c')](_0x424a46):_0x424a46);logger[_0xfeab('0x11')](_0xfeab('0x12'),_0x2ffb8c);_0x13219b[_0xfeab('0x13')]();}};}; \ 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 dcfdd90..204d1e9 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x5d0243,_0x25ad62){var _0xb9ce5a=function(_0x453bcb){while(--_0x453bcb){_0x5d0243['push'](_0x5d0243['shift']());}};_0xb9ce5a(++_0x25ad62);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4f080f,_0x35800a){var _0x28e648=function(_0xaf9cb0){while(--_0xaf9cb0){_0x4f080f['push'](_0x4f080f['shift']());}};_0x28e648(++_0x35800a);}(_0xe706,0xa3));var _0x6e70=function(_0x2904a8,_0x73180){_0x2904a8=_0x2904a8-0x0;var _0x4aae50=_0xe706[_0x2904a8];return _0x4aae50;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8919988..7b5f7db 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 _0x6f4f=['paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','name','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','../../../config/environment','../../../config/logger','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','IntervalId','Intervals','map','interval','isNil','listen','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','rules','execute','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available'];(function(_0x5b6a59,_0x3b9ac0){var _0x3ef1e4=function(_0x18bb8d){while(--_0x18bb8d){_0x5b6a59['push'](_0x5b6a59['shift']());}};_0x3ef1e4(++_0x3b9ac0);}(_0x6f4f,0x187));var _0xf6f4=function(_0xe3eee3,_0x281e96){_0xe3eee3=_0xe3eee3-0x0;var _0x23bcaa=_0x6f4f[_0xe3eee3];return _0x23bcaa;};'use strict';var _=require(_0xf6f4('0x0'));var util=require(_0xf6f4('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xf6f4('0x2'));var uuid=require('uuid');var config=require(_0xf6f4('0x3'));var logger=require(_0xf6f4('0x4'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xf6f4('0x5')),'smsQueueReport':require(_0xf6f4('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xf6f4('0x7'))};var RuleEngine=require(_0xf6f4('0x8'));function getId(_0x53de6f,_0x7382a5,_0x4af406){return util['format']('%s.%s.%s',_0x53de6f,_0x7382a5||0x0,_0x4af406||0x0);}function getIntervals(_0x282e55,_0x21787f){var _0x243122=[];if(!_['isNil'](_0x21787f[_0xf6f4('0x9')])&&!_['isNil'](_0x282e55[_0x21787f[_0xf6f4('0x9')]])&&!_['isNil'](_0x282e55[_0x21787f[_0xf6f4('0x9')]][_0xf6f4('0xa')])){_0x243122=_[_0xf6f4('0xb')](_0x282e55[_0x21787f[_0xf6f4('0x9')]][_0xf6f4('0xa')],_0xf6f4('0xc'));}else if(!_[_0xf6f4('0xd')](_0x21787f[_0xf6f4('0xc')])){_0x243122=[_0x21787f[_0xf6f4('0xc')]];}return _0x243122;}exports[_0xf6f4('0xe')]=function(_0x5e4b05){_0x5e4b05['rules']={};return new BPromise(function(_0x11ed75,_0x8d9b76){var _0x39172d={'Start':function(_0x48e2fe){var _0x417035=this;return new Promise(function(_0xe983df,_0x1d0441){if(_0x48e2fe){try{var _0x4f5820=[];var _0x42c261=getId(_0x48e2fe[_0xf6f4('0xf')],_0x48e2fe[_0xf6f4('0x10')]?_0x48e2fe[_0xf6f4('0x10')]['id']:0x0,_0x48e2fe[_0xf6f4('0x11')]?_0x48e2fe[_0xf6f4('0x11')]['id']:0x0);if(_0x48e2fe[_0xf6f4('0x12')]&&_['isArray'](_0x48e2fe['applications'])&&_0x48e2fe[_0xf6f4('0x12')][_0xf6f4('0x13')]){for(var _0x274280=0x0;_0x274280<_0x48e2fe[_0xf6f4('0x12')]['length'];_0x274280+=0x1){var _0x49c236=_0x48e2fe[_0xf6f4('0x12')][_0x274280];if(fs[_0xf6f4('0x14')](path[_0xf6f4('0x15')](__dirname,'applications',_0x49c236[_0xf6f4('0x16')]+_0xf6f4('0x17')))){var _0x4c35e2=[];switch(_0x49c236['app'][_0xf6f4('0x18')]()){case _0xf6f4('0x19'):var _0x24623d=_0x49c236['appdata']['split'](',');if(_0x48e2fe['channel']===_0xf6f4('0x1a')){_0x4c35e2[_0xf6f4('0x1b')](_0x24623d[0x0]);_0x4c35e2[_0xf6f4('0x1b')](_0x24623d[0x1]);_0x4c35e2[_0xf6f4('0x1b')](_0x24623d['slice'](0x2,_0x24623d['length'])[_0xf6f4('0x15')](','));}else{_0x4c35e2['push'](_0x24623d[0x0]);_0x4c35e2['push'](_0x24623d[_0xf6f4('0x1c')](0x1,_0x24623d['length'])['join'](','));}break;case _0xf6f4('0x1d'):var _0x6b71d=_0x49c236[_0xf6f4('0x1e')][_0xf6f4('0x1f')](',');_0x4c35e2[_0xf6f4('0x1b')](_0x6b71d[0x0]);_0x4c35e2[_0xf6f4('0x1b')](_0x6b71d[0x1]);_0x4c35e2[_0xf6f4('0x1b')](_0x6b71d['slice'](0x2,_0x6b71d['length'])[_0xf6f4('0x15')](','));break;case _0xf6f4('0x20'):var _0x430b89=_0x49c236[_0xf6f4('0x1e')][_0xf6f4('0x1f')](',');_0x4c35e2[_0xf6f4('0x1b')](_0x430b89[0x0]);_0x4c35e2[_0xf6f4('0x1b')](_0x430b89[0x1]);_0x4c35e2[_0xf6f4('0x1b')](_0x430b89[0x2]);_0x4c35e2[_0xf6f4('0x1b')](_0x430b89[0x3]);_0x4c35e2['push'](_0x430b89['slice'](0x4,_0x430b89[_0xf6f4('0x13')])[_0xf6f4('0x15')](','));break;case _0xf6f4('0x21'):var _0x8947c2=_0x49c236[_0xf6f4('0x1e')]['split'](',');_0x4c35e2[_0xf6f4('0x1b')](_0x8947c2[0x0]);_0x4c35e2['push'](_0x8947c2[0x1]);_0x4c35e2[_0xf6f4('0x1b')](_0x8947c2[0x2]);_0x4c35e2[_0xf6f4('0x1b')](_0x8947c2[0x3]);_0x4c35e2[_0xf6f4('0x1b')](_0x8947c2[_0xf6f4('0x1c')](0x4,_0x8947c2[_0xf6f4('0x13')])[_0xf6f4('0x15')](','));break;case'message':_0x4c35e2[_0xf6f4('0x1b')](_0x49c236[_0xf6f4('0x1e')]);break;case _0xf6f4('0x22'):_0x4c35e2[_0xf6f4('0x1b')](_0x49c236[_0xf6f4('0x23')]);_0x4c35e2[_0xf6f4('0x1b')](_0x49c236[_0xf6f4('0x1e')]);break;default:_0x4c35e2=_[_0xf6f4('0xd')](_0x49c236[_0xf6f4('0x1e')])?[]:_0x49c236['appdata'][_0xf6f4('0x1f')](',');}var _0x2547f2={'id':util[_0xf6f4('0x24')](_0xf6f4('0x25'),_0x42c261,_0x49c236['id'],_0x49c236[_0xf6f4('0x16')]),'condition':require(_0xf6f4('0x26'))[_0xf6f4('0x27')](_0x42c261,getIntervals(_0x5e4b05['intervals'],_0x49c236),_0x5e4b05),'consequence':require(_0xf6f4('0x28')+_0x49c236[_0xf6f4('0x16')])['consequence'](_0x42c261,_0x4c35e2,_0x5e4b05,_0x48e2fe),'p':_0x49c236[_0xf6f4('0x29')]||0x0};logger[_0xf6f4('0x2a')](_0xf6f4('0x2b'),_0x2547f2['id'],_0xf6f4('0x2c'),getIntervals(_0x5e4b05[_0xf6f4('0x2d')],_0x49c236)[_0xf6f4('0x15')](_0xf6f4('0x2e')));_0x4f5820['push'](_0x2547f2);}else{logger[_0xf6f4('0x2f')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x49c236['app']+'.js'));}}_0x5e4b05[_0xf6f4('0x30')][_0x42c261]=new RuleEngine(_0x4f5820);_0x5e4b05[_0xf6f4('0x30')][_0x42c261][_0xf6f4('0x31')](_0x48e2fe,function(_0x26fbb1){logger[_0xf6f4('0x2a')](_0xf6f4('0x32'),JSON[_0xf6f4('0x33')](_0x26fbb1[_0xf6f4('0x34')]));if(_0x5e4b05['rules'][_0x42c261]){_0x5e4b05['rules'][_0x42c261]['emit'](_0xf6f4('0x35'));}});return _0xe983df({'code':0xc8,'message':_0x48e2fe});}else{logger[_0xf6f4('0x2a')](_0xf6f4('0x36'));return _0xe983df({'code':0xc8,'message':_0x48e2fe});}}catch(_0x135359){logger[_0xf6f4('0x2f')](_0x135359[_0xf6f4('0x37')]);return _0x1d0441(_0x417035[_0xf6f4('0x2f')](0x1f4,_0x135359));}}return _0x1d0441(_0xf6f4('0x38'));});},'AcceptMessage':function(_0x3d2bca){var _0x2fc3f8=this;return new Promise(function(_0x42377a,_0x5bc3e4){if(_0x3d2bca[_0xf6f4('0x39')]&&_0x3d2bca[_0xf6f4('0x39')]['id']){if(_0x5e4b05[_0xf6f4('0x3a')][_0x3d2bca[_0xf6f4('0x39')]['id']]){_0x5e4b05[_0xf6f4('0x3a')][_0x3d2bca['agent']['id']][_0xf6f4('0x3b')]=![];_0x5e4b05[_0xf6f4('0x3a')][_0x3d2bca[_0xf6f4('0x39')]['id']][_0xf6f4('0x3c')]=undefined;}}if(_0x3d2bca[_0xf6f4('0x10')]&&_0x3d2bca['message']['id']){try{var _0x1b1fea=getId(_0x3d2bca[_0xf6f4('0xf')],_0x3d2bca[_0xf6f4('0x10')]?_0x3d2bca[_0xf6f4('0x10')]['id']:0x0,_0x3d2bca[_0xf6f4('0x11')]?_0x3d2bca['interaction']['id']:0x0);if(_0x5e4b05[_0xf6f4('0x30')][_0x1b1fea]){_0x5e4b05[_0xf6f4('0x30')][_0x1b1fea]['emit'](_0xf6f4('0x3d'));if(rpc[_0x3d2bca[_0xf6f4('0xf')]+_0xf6f4('0x3e')]){rpc[_0x3d2bca[_0xf6f4('0xf')]+'QueueReport'][_0xf6f4('0x3f')](_0x1b1fea,{'UserId':_0x3d2bca[_0xf6f4('0x10')][_0xf6f4('0x40')]})['catch'](function(_0x580ec9){logger[_0xf6f4('0x2f')](_0xf6f4('0x41'));});}}return _0x42377a({'code':0xc8,'message':_0x3d2bca});}catch(_0x3309a3){logger[_0xf6f4('0x2f')](_0x3309a3['stack']);return _0x5bc3e4(_0x2fc3f8[_0xf6f4('0x2f')](0x1f4,_0x3309a3));}}logger['error']('message\x20is\x20empty');return _0x5bc3e4(_0x2fc3f8[_0xf6f4('0x2f')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3bd01d){var _0x5d9d53=this;return new Promise(function(_0x270605,_0xaa628a){if(_0x3bd01d[_0xf6f4('0x39')]&&_0x3bd01d['agent']['id']){try{if(_0x5e4b05['agents'][_0x3bd01d['agent']['id']]){_0x5e4b05[_0xf6f4('0x3a')][_0x3bd01d[_0xf6f4('0x39')]['id']][_0xf6f4('0x3b')]=![];_0x5e4b05[_0xf6f4('0x3a')][_0x3bd01d[_0xf6f4('0x39')]['id']]['busyQueue']=undefined;}return _0x270605({'code':0xc8,'message':_0x3bd01d});}catch(_0x2a1001){logger[_0xf6f4('0x2f')](_0x2a1001['stack']);return _0xaa628a(_0x5d9d53[_0xf6f4('0x2f')](0x1f4,_0x2a1001));}}logger[_0xf6f4('0x2f')](_0xf6f4('0x42'));return _0xaa628a(_0x5d9d53[_0xf6f4('0x2f')](0x1f4,_0xf6f4('0x42')));});},'AbandonInteraction':function(_0x290567){var _0x6712b5=this;return new Promise(function(_0x109f12,_0x1eb881){if(_0x290567[_0xf6f4('0xf')]&&_0x290567[_0xf6f4('0x11')]&&_0x290567['interaction']['id']){try{var _0x580bc1=getId(_0x290567[_0xf6f4('0xf')],_0x290567[_0xf6f4('0x10')]?_0x290567[_0xf6f4('0x10')]['id']:0x0,_0x290567[_0xf6f4('0x11')]?_0x290567[_0xf6f4('0x11')]['id']:0x0);if(_0x5e4b05[_0xf6f4('0x30')][_0x580bc1]){_0x5e4b05[_0xf6f4('0x30')][_0x580bc1]['emit'](_0xf6f4('0x3d'));}return _0x109f12({'code':0xc8,'message':_0x290567});}catch(_0x47d0bc){logger[_0xf6f4('0x2f')](_0x47d0bc['stack']);return _0x1eb881(_0x6712b5[_0xf6f4('0x2f')](0x1f4,_0x47d0bc));}}logger[_0xf6f4('0x2f')](_0xf6f4('0x42'));return _0x1eb881(_0x6712b5['error'](0x1f4,_0xf6f4('0x42')));});},'AgentCapacity':function(_0x588720){var _0x23098d=this;return new Promise(function(_0x1e2ee1,_0x1a0337){if(_0x5e4b05[_0xf6f4('0x3a')][_0xf6f4('0x43')](_0x588720['id'])){for(var _0x4b5f75 in _0x588720[_0xf6f4('0x44')]){if(_0x588720[_0xf6f4('0x44')][_0xf6f4('0x43')](_0x4b5f75)){if(_0x5e4b05[_0xf6f4('0x3a')][_0x588720['id']]['hasOwnProperty'](_0x4b5f75+'CurrentCapacity')){_0x5e4b05[_0xf6f4('0x3a')][_0x588720['id']][_0x4b5f75+'CurrentCapacity']=parseInt(_0x588720[_0xf6f4('0x44')][_0x4b5f75],0xa);}}}_0x5e4b05['agents'][_0x588720['id']][_0xf6f4('0x45')]();return _0x1e2ee1({'code':0xc8,'message':_0x5e4b05[_0xf6f4('0x3a')][_0x588720['id']]});}else{return _0x1a0337(_0x23098d[_0xf6f4('0x2f')](0x1f4,_0xf6f4('0x46')));}});},'Agents':function(_0x4f77ac){return new Promise(function(_0x4af78b,_0x3fc27e){var _0x33a510=_[_0xf6f4('0x47')](_0x5e4b05[_0xf6f4('0x3a')]);_0x4af78b({'count':_0x33a510['length'],'rows':_0x33a510});});},'ChatQueues':function(_0x4ad098){return new Promise(function(_0x5534d2,_0xbe04ea){var _0x36a61e=[];for(var _0x1d1033 in _0x5e4b05['chatQueues']){if(_0x5e4b05[_0xf6f4('0x48')][_0xf6f4('0x43')](_0x1d1033)){var _0x1b89cb=_0x5e4b05[_0xf6f4('0x48')][_0x1d1033];var _0x16c295={'id':_0x1b89cb['id'],'available':_0x1b89cb[_0xf6f4('0x49')],'loggedIn':_0x1b89cb['loggedIn'],'name':_0x1b89cb['name'],'paused':_0x1b89cb[_0xf6f4('0x4a')],'waiting':_0x1b89cb[_0xf6f4('0x4b')]};_0x36a61e[_0xf6f4('0x1b')](_0x16c295);}}_0x5534d2({'count':_0x36a61e[_0xf6f4('0x13')],'rows':_0x36a61e});});},'MailQueues':function(_0x573549){return new Promise(function(_0x2aa437,_0x3a10b3){var _0x37338d=[];for(var _0x43c592 in _0x5e4b05[_0xf6f4('0x4c')]){if(_0x5e4b05[_0xf6f4('0x4c')][_0xf6f4('0x43')](_0x43c592)){var _0x2b8bde=_0x5e4b05['mailQueues'][_0x43c592];var _0x1e30f4={'id':_0x2b8bde['id'],'available':_0x2b8bde['available'],'loggedIn':_0x2b8bde[_0xf6f4('0x4d')],'name':_0x2b8bde['name'],'paused':_0x2b8bde[_0xf6f4('0x4a')],'waiting':_0x2b8bde[_0xf6f4('0x4b')]};_0x37338d[_0xf6f4('0x1b')](_0x1e30f4);}}_0x2aa437({'count':_0x37338d[_0xf6f4('0x13')],'rows':_0x37338d});});},'OpenchannelQueues':function(_0x3274cc){return new Promise(function(_0x524789,_0x4a94a0){var _0x373449=[];for(var _0x4e73ff in _0x5e4b05[_0xf6f4('0x4e')]){if(_0x5e4b05[_0xf6f4('0x4e')][_0xf6f4('0x43')](_0x4e73ff)){var _0x46b3ce=_0x5e4b05[_0xf6f4('0x4e')][_0x4e73ff];var _0x3ee522={'id':_0x46b3ce['id'],'available':_0x46b3ce[_0xf6f4('0x49')],'loggedIn':_0x46b3ce[_0xf6f4('0x4d')],'name':_0x46b3ce['name'],'paused':_0x46b3ce[_0xf6f4('0x4a')],'waiting':_0x46b3ce[_0xf6f4('0x4b')]};_0x373449[_0xf6f4('0x1b')](_0x3ee522);}}_0x524789({'count':_0x373449[_0xf6f4('0x13')],'rows':_0x373449});});},'SmsQueues':function(_0x1c4df8){return new Promise(function(_0x1ba17a,_0x33cd51){var _0x569e95=[];for(var _0x2f7b3d in _0x5e4b05[_0xf6f4('0x4f')]){if(_0x5e4b05['smsQueues'][_0xf6f4('0x43')](_0x2f7b3d)){var _0x144773=_0x5e4b05['smsQueues'][_0x2f7b3d];var _0x3e1cb3={'id':_0x144773['id'],'available':_0x144773[_0xf6f4('0x49')],'loggedIn':_0x144773[_0xf6f4('0x4d')],'name':_0x144773['name'],'paused':_0x144773[_0xf6f4('0x4a')],'waiting':_0x144773['waiting']};_0x569e95['push'](_0x3e1cb3);}}_0x1ba17a({'count':_0x569e95['length'],'rows':_0x569e95});});},'FaxQueues':function(_0x534568){return new Promise(function(_0xef807a,_0xe46b10){var _0x23b290=[];for(var _0x330647 in _0x5e4b05[_0xf6f4('0x50')]){if(_0x5e4b05['faxQueues'][_0xf6f4('0x43')](_0x330647)){var _0x2bf341=_0x5e4b05[_0xf6f4('0x50')][_0x330647];var _0x511f87={'id':_0x2bf341['id'],'available':_0x2bf341['available'],'loggedIn':_0x2bf341[_0xf6f4('0x4d')],'name':_0x2bf341[_0xf6f4('0x51')],'paused':_0x2bf341['paused'],'waiting':_0x2bf341[_0xf6f4('0x4b')]};_0x23b290[_0xf6f4('0x1b')](_0x511f87);}}_0xef807a({'count':_0x23b290[_0xf6f4('0x13')],'rows':_0x23b290});});},'WhatsappQueues':function(_0x4614bb){return new Promise(function(_0xa75e00,_0x649f7f){var _0xb76bb6=[];for(var _0xb3b6b8 in _0x5e4b05[_0xf6f4('0x52')]){if(_0x5e4b05['whatsappQueues'][_0xf6f4('0x43')](_0xb3b6b8)){var _0x181097=_0x5e4b05['whatsappQueues'][_0xb3b6b8];var _0x47db62={'id':_0x181097['id'],'available':_0x181097[_0xf6f4('0x49')],'loggedIn':_0x181097[_0xf6f4('0x4d')],'name':_0x181097[_0xf6f4('0x51')],'paused':_0x181097[_0xf6f4('0x4a')],'waiting':_0x181097[_0xf6f4('0x4b')]};_0xb76bb6[_0xf6f4('0x1b')](_0x47db62);}}_0xa75e00({'count':_0xb76bb6[_0xf6f4('0x13')],'rows':_0xb76bb6});});},'ChatQueuesWaitingInteractions':function(_0x3e9d29){return new Promise(function(_0x1a2111,_0x126063){var _0x592ac2=_[_0xf6f4('0x47')](_0x5e4b05[_0xf6f4('0x53')]);_0x1a2111({'count':_0x592ac2['length'],'rows':_0x592ac2});});},'MailQueuesWaitingInteractions':function(_0x55fbc7){return new Promise(function(_0x24066c,_0x14578b){var _0x1f0524=_['values'](_0x5e4b05[_0xf6f4('0x54')]);_0x24066c({'count':_0x1f0524['length'],'rows':_0x1f0524});});},'OpenchannelQueuesWaitingInteractions':function(_0x2ebe2b){return new Promise(function(_0x270c18,_0x556913){var _0x42d3ae=_['values'](_0x5e4b05[_0xf6f4('0x55')]);_0x270c18({'count':_0x42d3ae['length'],'rows':_0x42d3ae});});},'SmsQueuesWaitingInteractions':function(_0x146f7e){return new Promise(function(_0x1e12b0,_0x3ca964){var _0x1aaafd=_[_0xf6f4('0x47')](_0x5e4b05[_0xf6f4('0x56')]);_0x1e12b0({'count':_0x1aaafd[_0xf6f4('0x13')],'rows':_0x1aaafd});});},'FaxQueuesWaitingInteractions':function(_0x3bda31){return new Promise(function(_0x2bf96f,_0x192adb){var _0x1d0efd=_['values'](_0x5e4b05[_0xf6f4('0x57')]);_0x2bf96f({'count':_0x1d0efd[_0xf6f4('0x13')],'rows':_0x1d0efd});});},'WhatsappQueuesWaitingInteractions':function(_0x5bf279){return new Promise(function(_0x389067,_0xf96483){var _0x221e6=_[_0xf6f4('0x47')](_0x5e4b05[_0xf6f4('0x58')]);_0x389067({'count':_0x221e6[_0xf6f4('0x13')],'rows':_0x221e6});});}};var _0x23083b=jayson[_0xf6f4('0x59')](_0x39172d)[_0xf6f4('0x5a')]();_0x23083b['on'](_0xf6f4('0x2f'),function(_0x124ebd){logger[_0xf6f4('0x2f')](JSON[_0xf6f4('0x33')](_0x124ebd));return _0x8d9b76(_0x124ebd);});_0x23083b[_0xf6f4('0xe')](0x232c,_0xf6f4('0x5b'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x11ed75(_0xf6f4('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x62e4=['paused','waiting','mailQueues','openchannelQueues','name','smsQueues','available','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','listen','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','channel','message','interaction','applications','isArray','length','join','app','toLowerCase','autoreply','split','mail','push','slice','appdata','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn'];(function(_0x3187b7,_0x57fdab){var _0x329e57=function(_0x24486a){while(--_0x24486a){_0x3187b7['push'](_0x3187b7['shift']());}};_0x329e57(++_0x57fdab);}(_0x62e4,0x12b));var _0x462e=function(_0x28b0ec,_0x2a8979){_0x28b0ec=_0x28b0ec-0x0;var _0x4ffc96=_0x62e4[_0x28b0ec];return _0x4ffc96;};'use strict';var _=require(_0x462e('0x0'));var util=require(_0x462e('0x1'));var path=require(_0x462e('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x462e('0x3'));var uuid=require(_0x462e('0x4'));var config=require(_0x462e('0x5'));var logger=require(_0x462e('0x6'))(_0x462e('0x7'));var rpc={'openchannelQueueReport':require(_0x462e('0x8')),'mailQueueReport':require(_0x462e('0x9')),'chatQueueReport':require(_0x462e('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x462e('0xb'))};var RuleEngine=require(_0x462e('0xc'));function getId(_0x10c575,_0x1661fc,_0x156937){return util['format'](_0x462e('0xd'),_0x10c575,_0x1661fc||0x0,_0x156937||0x0);}function getIntervals(_0x4a677c,_0x26820f){var _0x3ea257=[];if(!_[_0x462e('0xe')](_0x26820f[_0x462e('0xf')])&&!_[_0x462e('0xe')](_0x4a677c[_0x26820f[_0x462e('0xf')]])&&!_[_0x462e('0xe')](_0x4a677c[_0x26820f['IntervalId']]['Intervals'])){_0x3ea257=_[_0x462e('0x10')](_0x4a677c[_0x26820f[_0x462e('0xf')]][_0x462e('0x11')],'interval');}else if(!_['isNil'](_0x26820f[_0x462e('0x12')])){_0x3ea257=[_0x26820f['interval']];}return _0x3ea257;}exports['listen']=function(_0x2330dd){_0x2330dd['rules']={};return new BPromise(function(_0x32b054,_0x183ce7){var _0xda189e={'Start':function(_0x2c4e47){var _0x253cb4=this;return new Promise(function(_0x19da97,_0x5d9466){if(_0x2c4e47){try{var _0x5c344c=[];var _0x3d8f83=getId(_0x2c4e47[_0x462e('0x13')],_0x2c4e47[_0x462e('0x14')]?_0x2c4e47[_0x462e('0x14')]['id']:0x0,_0x2c4e47[_0x462e('0x15')]?_0x2c4e47['interaction']['id']:0x0);if(_0x2c4e47[_0x462e('0x16')]&&_[_0x462e('0x17')](_0x2c4e47[_0x462e('0x16')])&&_0x2c4e47['applications'][_0x462e('0x18')]){for(var _0x399836=0x0;_0x399836<_0x2c4e47['applications'][_0x462e('0x18')];_0x399836+=0x1){var _0xb6256e=_0x2c4e47['applications'][_0x399836];if(fs['existsSync'](path[_0x462e('0x19')](__dirname,_0x462e('0x16'),_0xb6256e[_0x462e('0x1a')]+'.js'))){var _0x57c3e0=[];switch(_0xb6256e[_0x462e('0x1a')][_0x462e('0x1b')]()){case _0x462e('0x1c'):var _0x54d1ac=_0xb6256e['appdata'][_0x462e('0x1d')](',');if(_0x2c4e47[_0x462e('0x13')]===_0x462e('0x1e')){_0x57c3e0[_0x462e('0x1f')](_0x54d1ac[0x0]);_0x57c3e0[_0x462e('0x1f')](_0x54d1ac[0x1]);_0x57c3e0['push'](_0x54d1ac[_0x462e('0x20')](0x2,_0x54d1ac['length'])[_0x462e('0x19')](','));}else{_0x57c3e0['push'](_0x54d1ac[0x0]);_0x57c3e0[_0x462e('0x1f')](_0x54d1ac['slice'](0x1,_0x54d1ac[_0x462e('0x18')])[_0x462e('0x19')](','));}break;case'dialogflow':var _0x20601e=_0xb6256e[_0x462e('0x21')][_0x462e('0x1d')](',');_0x57c3e0['push'](_0x20601e[0x0]);_0x57c3e0[_0x462e('0x1f')](_0x20601e[0x1]);_0x57c3e0[_0x462e('0x1f')](_0x20601e[_0x462e('0x20')](0x2,_0x20601e[_0x462e('0x18')])[_0x462e('0x19')](','));break;case _0x462e('0x22'):var _0x274323=_0xb6256e['appdata'][_0x462e('0x1d')](',');_0x57c3e0['push'](_0x274323[0x0]);_0x57c3e0[_0x462e('0x1f')](_0x274323[0x1]);_0x57c3e0[_0x462e('0x1f')](_0x274323[0x2]);_0x57c3e0[_0x462e('0x1f')](_0x274323[0x3]);_0x57c3e0['push'](_0x274323[_0x462e('0x20')](0x4,_0x274323[_0x462e('0x18')])['join'](','));break;case _0x462e('0x23'):var _0x9e405a=_0xb6256e[_0x462e('0x21')][_0x462e('0x1d')](',');_0x57c3e0['push'](_0x9e405a[0x0]);_0x57c3e0[_0x462e('0x1f')](_0x9e405a[0x1]);_0x57c3e0[_0x462e('0x1f')](_0x9e405a[0x2]);_0x57c3e0[_0x462e('0x1f')](_0x9e405a[0x3]);_0x57c3e0['push'](_0x9e405a['slice'](0x4,_0x9e405a[_0x462e('0x18')])[_0x462e('0x19')](','));break;case _0x462e('0x14'):_0x57c3e0[_0x462e('0x1f')](_0xb6256e[_0x462e('0x21')]);break;case _0x462e('0x24'):_0x57c3e0[_0x462e('0x1f')](_0xb6256e[_0x462e('0x25')]);_0x57c3e0[_0x462e('0x1f')](_0xb6256e[_0x462e('0x21')]);break;default:_0x57c3e0=_[_0x462e('0xe')](_0xb6256e[_0x462e('0x21')])?[]:_0xb6256e[_0x462e('0x21')][_0x462e('0x1d')](',');}var _0x4eb2d4={'id':util[_0x462e('0x26')](_0x462e('0x27'),_0x3d8f83,_0xb6256e['id'],_0xb6256e['app']),'condition':require(_0x462e('0x28'))['condition'](_0x3d8f83,getIntervals(_0x2330dd[_0x462e('0x29')],_0xb6256e),_0x2330dd),'consequence':require(_0x462e('0x2a')+_0xb6256e[_0x462e('0x1a')])[_0x462e('0x2b')](_0x3d8f83,_0x57c3e0,_0x2330dd,_0x2c4e47),'p':_0xb6256e[_0x462e('0x2c')]||0x0};logger[_0x462e('0x2d')](_0x462e('0x2e'),_0x4eb2d4['id'],_0x462e('0x2f'),getIntervals(_0x2330dd['intervals'],_0xb6256e)[_0x462e('0x19')](_0x462e('0x30')));_0x5c344c[_0x462e('0x1f')](_0x4eb2d4);}else{logger[_0x462e('0x31')](_0x462e('0x32'),path[_0x462e('0x19')](__dirname,'applications',_0xb6256e[_0x462e('0x1a')]+'.js'));}}_0x2330dd['rules'][_0x3d8f83]=new RuleEngine(_0x5c344c);_0x2330dd[_0x462e('0x33')][_0x3d8f83]['execute'](_0x2c4e47,function(_0x20e4f0){logger['info'](_0x462e('0x34'),JSON[_0x462e('0x35')](_0x20e4f0['matchPath']));if(_0x2330dd[_0x462e('0x33')][_0x3d8f83]){_0x2330dd[_0x462e('0x33')][_0x3d8f83][_0x462e('0x36')](_0x462e('0x37'));}});return _0x19da97({'code':0xc8,'message':_0x2c4e47});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x19da97({'code':0xc8,'message':_0x2c4e47});}}catch(_0x3e1665){logger[_0x462e('0x31')](_0x3e1665[_0x462e('0x38')]);return _0x5d9466(_0x253cb4[_0x462e('0x31')](0x1f4,_0x3e1665));}}return _0x5d9466(_0x462e('0x39'));});},'AcceptMessage':function(_0x1b6325){var _0x40fbbb=this;return new Promise(function(_0x17888d,_0x4151f5){if(_0x1b6325[_0x462e('0x3a')]&&_0x1b6325[_0x462e('0x3a')]['id']){if(_0x2330dd[_0x462e('0x3b')][_0x1b6325[_0x462e('0x3a')]['id']]){_0x2330dd[_0x462e('0x3b')][_0x1b6325[_0x462e('0x3a')]['id']][_0x462e('0x3c')]=![];_0x2330dd[_0x462e('0x3b')][_0x1b6325['agent']['id']][_0x462e('0x3d')]=undefined;}}if(_0x1b6325[_0x462e('0x14')]&&_0x1b6325[_0x462e('0x14')]['id']){try{var _0x4b371d=getId(_0x1b6325[_0x462e('0x13')],_0x1b6325['message']?_0x1b6325['message']['id']:0x0,_0x1b6325['interaction']?_0x1b6325[_0x462e('0x15')]['id']:0x0);if(_0x2330dd[_0x462e('0x33')][_0x4b371d]){_0x2330dd[_0x462e('0x33')][_0x4b371d][_0x462e('0x36')](_0x462e('0x3e'));if(rpc[_0x1b6325[_0x462e('0x13')]+_0x462e('0x3f')]){rpc[_0x1b6325[_0x462e('0x13')]+_0x462e('0x3f')][_0x462e('0x40')](_0x4b371d,{'UserId':_0x1b6325[_0x462e('0x14')][_0x462e('0x41')]})[_0x462e('0x42')](function(_0x3cc040){logger['error'](_0x462e('0x43'));});}}return _0x17888d({'code':0xc8,'message':_0x1b6325});}catch(_0x1346e6){logger[_0x462e('0x31')](_0x1346e6[_0x462e('0x38')]);return _0x4151f5(_0x40fbbb['error'](0x1f4,_0x1346e6));}}logger[_0x462e('0x31')](_0x462e('0x44'));return _0x4151f5(_0x40fbbb['error'](0x1f4,_0x462e('0x44')));});},'RejectMessage':function(_0x364e3c){var _0x44b7e9=this;return new Promise(function(_0x2e743f,_0x369722){if(_0x364e3c[_0x462e('0x3a')]&&_0x364e3c[_0x462e('0x3a')]['id']){try{if(_0x2330dd[_0x462e('0x3b')][_0x364e3c[_0x462e('0x3a')]['id']]){_0x2330dd['agents'][_0x364e3c[_0x462e('0x3a')]['id']]['busy']=![];_0x2330dd['agents'][_0x364e3c[_0x462e('0x3a')]['id']]['busyQueue']=undefined;}return _0x2e743f({'code':0xc8,'message':_0x364e3c});}catch(_0x5219b8){logger[_0x462e('0x31')](_0x5219b8[_0x462e('0x38')]);return _0x369722(_0x44b7e9['error'](0x1f4,_0x5219b8));}}logger[_0x462e('0x31')](_0x462e('0x44'));return _0x369722(_0x44b7e9['error'](0x1f4,_0x462e('0x44')));});},'AbandonInteraction':function(_0x566c55){var _0x588351=this;return new Promise(function(_0x11fd77,_0x1e4fad){if(_0x566c55[_0x462e('0x13')]&&_0x566c55[_0x462e('0x15')]&&_0x566c55[_0x462e('0x15')]['id']){try{var _0x3e4e65=getId(_0x566c55['channel'],_0x566c55[_0x462e('0x14')]?_0x566c55[_0x462e('0x14')]['id']:0x0,_0x566c55['interaction']?_0x566c55['interaction']['id']:0x0);if(_0x2330dd['rules'][_0x3e4e65]){_0x2330dd['rules'][_0x3e4e65][_0x462e('0x36')](_0x462e('0x3e'));}return _0x11fd77({'code':0xc8,'message':_0x566c55});}catch(_0x13fc9e){logger[_0x462e('0x31')](_0x13fc9e[_0x462e('0x38')]);return _0x1e4fad(_0x588351[_0x462e('0x31')](0x1f4,_0x13fc9e));}}logger['error'](_0x462e('0x44'));return _0x1e4fad(_0x588351[_0x462e('0x31')](0x1f4,_0x462e('0x44')));});},'AgentCapacity':function(_0x4ceced){var _0x3bb275=this;return new Promise(function(_0x340e2e,_0x5e39bf){if(_0x2330dd[_0x462e('0x3b')][_0x462e('0x45')](_0x4ceced['id'])){for(var _0xa30000 in _0x4ceced[_0x462e('0x46')]){if(_0x4ceced[_0x462e('0x46')][_0x462e('0x45')](_0xa30000)){if(_0x2330dd[_0x462e('0x3b')][_0x4ceced['id']][_0x462e('0x45')](_0xa30000+_0x462e('0x47'))){_0x2330dd[_0x462e('0x3b')][_0x4ceced['id']][_0xa30000+_0x462e('0x47')]=parseInt(_0x4ceced[_0x462e('0x46')][_0xa30000],0xa);}}}_0x2330dd[_0x462e('0x3b')][_0x4ceced['id']][_0x462e('0x48')]();return _0x340e2e({'code':0xc8,'message':_0x2330dd[_0x462e('0x3b')][_0x4ceced['id']]});}else{return _0x5e39bf(_0x3bb275[_0x462e('0x31')](0x1f4,_0x462e('0x49')));}});},'Agents':function(_0x2b6fe2){return new Promise(function(_0xdb7760,_0x1df23d){var _0xe935ee=_[_0x462e('0x4a')](_0x2330dd[_0x462e('0x3b')]);_0xdb7760({'count':_0xe935ee['length'],'rows':_0xe935ee});});},'ChatQueues':function(_0x45b55c){return new Promise(function(_0x44e995,_0x3c5519){var _0x1f1d09=[];for(var _0x1e5424 in _0x2330dd[_0x462e('0x4b')]){if(_0x2330dd['chatQueues'][_0x462e('0x45')](_0x1e5424)){var _0xb3efc0=_0x2330dd[_0x462e('0x4b')][_0x1e5424];var _0x212a7c={'id':_0xb3efc0['id'],'available':_0xb3efc0['available'],'loggedIn':_0xb3efc0[_0x462e('0x4c')],'name':_0xb3efc0['name'],'paused':_0xb3efc0[_0x462e('0x4d')],'waiting':_0xb3efc0[_0x462e('0x4e')]};_0x1f1d09['push'](_0x212a7c);}}_0x44e995({'count':_0x1f1d09[_0x462e('0x18')],'rows':_0x1f1d09});});},'MailQueues':function(_0x5bcdd6){return new Promise(function(_0x38f7bd,_0x50308c){var _0x5546dc=[];for(var _0x13d0e5 in _0x2330dd[_0x462e('0x4f')]){if(_0x2330dd[_0x462e('0x4f')]['hasOwnProperty'](_0x13d0e5)){var _0x47eccd=_0x2330dd[_0x462e('0x4f')][_0x13d0e5];var _0x19cc13={'id':_0x47eccd['id'],'available':_0x47eccd['available'],'loggedIn':_0x47eccd[_0x462e('0x4c')],'name':_0x47eccd['name'],'paused':_0x47eccd[_0x462e('0x4d')],'waiting':_0x47eccd['waiting']};_0x5546dc[_0x462e('0x1f')](_0x19cc13);}}_0x38f7bd({'count':_0x5546dc[_0x462e('0x18')],'rows':_0x5546dc});});},'OpenchannelQueues':function(_0x88068d){return new Promise(function(_0xdb77b3,_0x4c4a8d){var _0x2b4c42=[];for(var _0x5e8353 in _0x2330dd['openchannelQueues']){if(_0x2330dd[_0x462e('0x50')][_0x462e('0x45')](_0x5e8353)){var _0xfb129e=_0x2330dd[_0x462e('0x50')][_0x5e8353];var _0x700794={'id':_0xfb129e['id'],'available':_0xfb129e['available'],'loggedIn':_0xfb129e['loggedIn'],'name':_0xfb129e[_0x462e('0x51')],'paused':_0xfb129e[_0x462e('0x4d')],'waiting':_0xfb129e['waiting']};_0x2b4c42[_0x462e('0x1f')](_0x700794);}}_0xdb77b3({'count':_0x2b4c42[_0x462e('0x18')],'rows':_0x2b4c42});});},'SmsQueues':function(_0x10709d){return new Promise(function(_0x1c7bf5,_0x343562){var _0x5361c5=[];for(var _0x26ba30 in _0x2330dd[_0x462e('0x52')]){if(_0x2330dd['smsQueues'][_0x462e('0x45')](_0x26ba30)){var _0x209db3=_0x2330dd[_0x462e('0x52')][_0x26ba30];var _0x10d5b7={'id':_0x209db3['id'],'available':_0x209db3[_0x462e('0x53')],'loggedIn':_0x209db3[_0x462e('0x4c')],'name':_0x209db3[_0x462e('0x51')],'paused':_0x209db3[_0x462e('0x4d')],'waiting':_0x209db3[_0x462e('0x4e')]};_0x5361c5['push'](_0x10d5b7);}}_0x1c7bf5({'count':_0x5361c5[_0x462e('0x18')],'rows':_0x5361c5});});},'FaxQueues':function(_0x4cf7dd){return new Promise(function(_0x4203ed,_0x47cae9){var _0x5e7a4d=[];for(var _0x235545 in _0x2330dd[_0x462e('0x54')]){if(_0x2330dd[_0x462e('0x54')][_0x462e('0x45')](_0x235545)){var _0x2ebe78=_0x2330dd[_0x462e('0x54')][_0x235545];var _0x234942={'id':_0x2ebe78['id'],'available':_0x2ebe78[_0x462e('0x53')],'loggedIn':_0x2ebe78[_0x462e('0x4c')],'name':_0x2ebe78[_0x462e('0x51')],'paused':_0x2ebe78['paused'],'waiting':_0x2ebe78[_0x462e('0x4e')]};_0x5e7a4d[_0x462e('0x1f')](_0x234942);}}_0x4203ed({'count':_0x5e7a4d[_0x462e('0x18')],'rows':_0x5e7a4d});});},'WhatsappQueues':function(_0x584f0b){return new Promise(function(_0xaf6554,_0x95ff59){var _0x2ce84e=[];for(var _0x4588ad in _0x2330dd['whatsappQueues']){if(_0x2330dd['whatsappQueues'][_0x462e('0x45')](_0x4588ad)){var _0x278697=_0x2330dd[_0x462e('0x55')][_0x4588ad];var _0x140f17={'id':_0x278697['id'],'available':_0x278697[_0x462e('0x53')],'loggedIn':_0x278697[_0x462e('0x4c')],'name':_0x278697[_0x462e('0x51')],'paused':_0x278697[_0x462e('0x4d')],'waiting':_0x278697[_0x462e('0x4e')]};_0x2ce84e[_0x462e('0x1f')](_0x140f17);}}_0xaf6554({'count':_0x2ce84e[_0x462e('0x18')],'rows':_0x2ce84e});});},'ChatQueuesWaitingInteractions':function(_0x3b3aa0){return new Promise(function(_0x3670f2,_0x41fc46){var _0x18ba70=_['values'](_0x2330dd['chatQueuesWaitingInteractions']);_0x3670f2({'count':_0x18ba70['length'],'rows':_0x18ba70});});},'MailQueuesWaitingInteractions':function(_0x14dac6){return new Promise(function(_0xf60436,_0x268632){var _0x18f94b=_['values'](_0x2330dd[_0x462e('0x56')]);_0xf60436({'count':_0x18f94b['length'],'rows':_0x18f94b});});},'OpenchannelQueuesWaitingInteractions':function(_0xca2b6c){return new Promise(function(_0x2de158,_0x586c95){var _0x5c3115=_[_0x462e('0x4a')](_0x2330dd[_0x462e('0x57')]);_0x2de158({'count':_0x5c3115[_0x462e('0x18')],'rows':_0x5c3115});});},'SmsQueuesWaitingInteractions':function(_0x13c77c){return new Promise(function(_0xad9e9b,_0x1f4f7a){var _0x449284=_['values'](_0x2330dd[_0x462e('0x58')]);_0xad9e9b({'count':_0x449284[_0x462e('0x18')],'rows':_0x449284});});},'FaxQueuesWaitingInteractions':function(_0x2be7ff){return new Promise(function(_0xe4fcf3,_0x4532b7){var _0x367af8=_[_0x462e('0x4a')](_0x2330dd[_0x462e('0x59')]);_0xe4fcf3({'count':_0x367af8[_0x462e('0x18')],'rows':_0x367af8});});},'WhatsappQueuesWaitingInteractions':function(_0x168614){return new Promise(function(_0x120d8d,_0x17d1be){var _0x39967b=_[_0x462e('0x4a')](_0x2330dd['whatsappQueuesWaitingInteractions']);_0x120d8d({'count':_0x39967b[_0x462e('0x18')],'rows':_0x39967b});});}};var _0x2ea03d=jayson[_0x462e('0x5a')](_0xda189e)['http']();_0x2ea03d['on'](_0x462e('0x31'),function(_0x5304fe){logger['error'](JSON['stringify'](_0x5304fe));return _0x183ce7(_0x5304fe);});_0x2ea03d[_0x462e('0x5b')](0x232c,_0x462e('0x5c'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x32b054(_0x462e('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 1ee36bb..c155f53 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 _0x8d96=['result','catch','rules','info','length','push','Command','iftime\x20%s','message','indexOf','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','util','lodash','../../../config/logger','routing','client','http','then','error'];(function(_0x256bed,_0x352d23){var _0x13a57a=function(_0x4feea2){while(--_0x4feea2){_0x256bed['push'](_0x256bed['shift']());}};_0x13a57a(++_0x352d23);}(_0x8d96,0x70));var _0x68d9=function(_0x34a62c,_0x353cbe){_0x34a62c=_0x34a62c-0x0;var _0x5c3f14=_0x8d96[_0x34a62c];return _0x5c3f14;};'use strict';var util=require(_0x68d9('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x68d9('0x1'));var logger=require(_0x68d9('0x2'))(_0x68d9('0x3'));var client=jayson[_0x68d9('0x4')][_0x68d9('0x5')]({'port':0x232a});function request(_0x324673,_0xfb52cf){return new BPromise(function(_0x79f0b7,_0x5164fb){return client['request'](_0x324673,_0xfb52cf)[_0x68d9('0x6')](function(_0x3bb1c5){if(_0x3bb1c5[_0x68d9('0x7')]){return _0x5164fb(_0x3bb1c5[_0x68d9('0x7')]['message']);}else{return _0x79f0b7(_0x3bb1c5[_0x68d9('0x8')]);}})[_0x68d9('0x9')](function(_0x377d9a){return _0x5164fb(_0x377d9a);});});}exports['condition']=function(_0x4822d7,_0x1723a2,_0x315e23){return function(_0x3a8044){if(_0x315e23[_0x68d9('0xa')]&&!_0x315e23['rules'][_0x4822d7]){logger[_0x68d9('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4822d7);return _0x3a8044['stop']();}var _0x37119b=[];for(var _0x2aab2c=0x0;_0x2aab2c<_0x1723a2[_0x68d9('0xc')];_0x2aab2c+=0x1){_0x37119b[_0x68d9('0xd')](request(_0x68d9('0xe'),{'command':util['format'](_0x68d9('0xf'),_0x1723a2[_0x2aab2c])})['then'](function(_0x4e6025){return _0x4e6025&&_0x4e6025[_0x68d9('0x10')]&&_0x4e6025[_0x68d9('0x10')][_0x68d9('0x11')]('true')>=0x0?!![]:![];})['catch'](function(_0x29d417){logger[_0x68d9('0x7')]('[%s][INTERVAL]\x20%s',_0x4822d7,_0x1723a2[_0x2aab2c]);}));}BPromise['all'](_0x37119b)[_0x68d9('0x6')](function(_0x1727c7){var _0x53479e=_[_0x68d9('0x12')](_0x1727c7);logger['info'](_0x68d9('0x13'),_0x4822d7,_0x1723a2[_0x68d9('0x14')](_0x68d9('0x15')),_0x53479e);_0x3a8044[_0x68d9('0x16')](_0x53479e);})[_0x68d9('0x9')](function(_0x3e5d07){console[_0x68d9('0x17')](_0x3e5d07);logger[_0x68d9('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x4822d7,_0x1723a2[_0x68d9('0x14')](_0x68d9('0x15')),_0x3e5d07['stack']);_0x3a8044['stop']();});};}; \ No newline at end of file +var _0xbf6e=['when','log','join','\x20|\x20','stack','stop','util','../../../config/logger','routing','client','request','then','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xbf6e,0x76));var _0xebf6=function(_0x3103e4,_0x202431){_0x3103e4=_0x3103e4-0x0;var _0x360a19=_0xbf6e[_0x3103e4];return _0x360a19;};'use strict';var util=require(_0xebf6('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xebf6('0x1'))(_0xebf6('0x2'));var client=jayson[_0xebf6('0x3')]['http']({'port':0x232a});function request(_0x1c5b97,_0x458ae1){return new BPromise(function(_0xb3bf43,_0x4587f5){return client[_0xebf6('0x4')](_0x1c5b97,_0x458ae1)[_0xebf6('0x5')](function(_0x6e2daa){if(_0x6e2daa[_0xebf6('0x6')]){return _0x4587f5(_0x6e2daa[_0xebf6('0x6')]['message']);}else{return _0xb3bf43(_0x6e2daa[_0xebf6('0x7')]);}})[_0xebf6('0x8')](function(_0x3648b8){return _0x4587f5(_0x3648b8);});});}exports[_0xebf6('0x9')]=function(_0x4e284b,_0x402841,_0x41c2dc){return function(_0x384ae0){if(_0x41c2dc[_0xebf6('0xa')]&&!_0x41c2dc[_0xebf6('0xa')][_0x4e284b]){logger['info'](_0xebf6('0xb'),_0x4e284b);return _0x384ae0['stop']();}var _0x573647=[];for(var _0x557383=0x0;_0x557383<_0x402841['length'];_0x557383+=0x1){_0x573647[_0xebf6('0xc')](request(_0xebf6('0xd'),{'command':util['format'](_0xebf6('0xe'),_0x402841[_0x557383])})[_0xebf6('0x5')](function(_0x4e7a97){return _0x4e7a97&&_0x4e7a97[_0xebf6('0xf')]&&_0x4e7a97['message'][_0xebf6('0x10')](_0xebf6('0x11'))>=0x0?!![]:![];})['catch'](function(_0x42b6b5){logger[_0xebf6('0x6')](_0xebf6('0x12'),_0x4e284b,_0x402841[_0x557383]);}));}BPromise[_0xebf6('0x13')](_0x573647)[_0xebf6('0x5')](function(_0x261852){var _0x4587e8=_[_0xebf6('0x14')](_0x261852);logger['info'](_0xebf6('0x15'),_0x4e284b,_0x402841['join']('\x20|\x20'),_0x4587e8);_0x384ae0[_0xebf6('0x16')](_0x4587e8);})[_0xebf6('0x8')](function(_0x2daf9a){console[_0xebf6('0x17')](_0x2daf9a);logger[_0xebf6('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x4e284b,_0x402841[_0xebf6('0x18')](_0xebf6('0x19')),_0x2daf9a[_0xebf6('0x1a')]);_0x384ae0[_0xebf6('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 6556e4a..f89354a 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 _0xe605=['agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','lastevent','timeout','holdtime','ringtime','talktime','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','now','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','reason','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','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','interface','calleridnum','connectedlinenum','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','called','connectedlinename','error','[%s][agents][agentcalled]'];(function(_0x466ca9,_0x27c8d9){var _0x9c0a5e=function(_0x213d56){while(--_0x213d56){_0x466ca9['push'](_0x466ca9['shift']());}};_0x9c0a5e(++_0x27c8d9);}(_0xe605,0x92));var _0x5e60=function(_0x16d9ae,_0x400e03){_0x16d9ae=_0x16d9ae-0x0;var _0x29e2d1=_0xe605[_0x16d9ae];return _0x29e2d1;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x36add0,_0x455efd){utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x4'),_0x36add0[_0x5e60('0x5')],_0x36add0[_0x5e60('0x6')],_0x36add0[_0x5e60('0x7')],_0x36add0[_0x5e60('0x8')],_0x36add0[_0x5e60('0x9')],_0x36add0[_0x5e60('0xa')],_0x36add0[_0x5e60('0xb')],_0x36add0['lastevent']));if(_0x36add0[_0x5e60('0x7')]){utils['getVoiceQueueByName'](_0x36add0['queue'])['then'](function(_0x43f7eb){if(_0x43f7eb){_0x36add0[_0x5e60('0xc')]=_0x43f7eb[_0x5e60('0xc')];_0x36add0[_0x5e60('0xd')]=_0x36add0[_0x5e60('0xe')]?_0x43f7eb[_0x5e60('0xf')]:![];_0x36add0['acwtime']=_0x36add0[_0x5e60('0xd')]?_0x43f7eb['acwTimeout']:0x0;}utils[_0x5e60('0x10')](_0x5e60('0x11'),_0x36add0);});}else{utils[_0x5e60('0x10')]('CreateVoiceAgentReport',_0x36add0);}if(_0x455efd){delete transfers[_0x36add0[_0x5e60('0x5')]];}else{delete agents[_0x36add0[_0x5e60('0x12')]];}}exports[_0x5e60('0x13')]=function(_0xe039de){try{utils[_0x5e60('0x14')](util[_0x5e60('0x3')]('[%s][agents][agentcalled]',_0xe039de[_0x5e60('0x5')]),_0xe039de);agents[_0xe039de[_0x5e60('0x12')]]=_0xe039de;agents[_0xe039de[_0x5e60('0x12')]][_0x5e60('0x15')]=utils['now']();agents[_0xe039de[_0x5e60('0x12')]]['lastevent']=_0x5e60('0x16');agents[_0xe039de[_0x5e60('0x12')]]['connectedlinenum']=null;agents[_0xe039de[_0x5e60('0x12')]][_0x5e60('0x17')]=null;utils[_0x5e60('0x2')](util[_0x5e60('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xe039de[_0x5e60('0x5')],agents[_0xe039de[_0x5e60('0x12')]]['membername'],_0xe039de[_0x5e60('0x12')]));}catch(_0x3a9e6b){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x19'),_0xe039de[_0x5e60('0x5')]),_0x3a9e6b);}};exports[_0x5e60('0x1a')]=function(_0x524c93){try{if(!_[_0x5e60('0x1b')](agents[_0x524c93[_0x5e60('0x12')]])){utils[_0x5e60('0x14')](util['format'](_0x5e60('0x1c'),_0x524c93['uniqueid']),_0x524c93);utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x1d'),_0x524c93[_0x5e60('0x5')],agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x8')],_0x524c93[_0x5e60('0x12')]));agents[_0x524c93['destuniqueid']][_0x5e60('0x1a')]=!![];agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x1e')]=utils['now']();agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x1f')]=_0x5e60('0x20');agents[_0x524c93[_0x5e60('0x12')]]['reason']=_0x5e60('0x20');agents[_0x524c93['destuniqueid']][_0x5e60('0x21')]=_0x524c93[_0x5e60('0x22')]?parseInt(_0x524c93['ringtime'])/0x3e8:0x0;agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x23')]=0x0;unanswered['push'](_0x524c93[_0x5e60('0x12')]);}}catch(_0xac9c7a){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x524c93[_0x5e60('0x5')]),_0xac9c7a);}};exports[_0x5e60('0x24')]=function(_0x2e8e9e){try{_[_0x5e60('0x25')](agents,function(_0x3ccfee,_0x558197){if(_0x3ccfee[_0x5e60('0x5')]==_0x2e8e9e[_0x5e60('0x5')]&&!_['includes'](unanswered,_0x3ccfee[_0x5e60('0x12')])){utils['debug'](util['format'](_0x5e60('0x26'),_0x2e8e9e[_0x5e60('0x5')]),_0x2e8e9e);utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x27'),_0x2e8e9e[_0x5e60('0x5')],_0x3ccfee[_0x5e60('0x8')],_0x3ccfee[_0x5e60('0x12')]));_0x3ccfee[_0x5e60('0x1a')]=!![];_0x3ccfee[_0x5e60('0x1e')]=utils['now']();_0x3ccfee[_0x5e60('0x1f')]='abandoned';_0x3ccfee['reason']=_0x5e60('0x28');_0x3ccfee[_0x5e60('0x21')]=_0x2e8e9e['holdtime'];_0x3ccfee[_0x5e60('0x23')]=0x0;writeDB(_0x3ccfee);}});}catch(_0x576c70){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x26'),_0x2e8e9e[_0x5e60('0x5')]),_0x576c70);}};exports[_0x5e60('0x29')]=function(_0x23498b){try{if(agents[_0x23498b[_0x5e60('0x12')]]){utils[_0x5e60('0x14')](util['format'](_0x5e60('0x2a'),_0x23498b[_0x5e60('0x5')]),_0x23498b);utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x2b'),_0x23498b[_0x5e60('0x5')],agents[_0x23498b[_0x5e60('0x12')]]['membername'],_0x23498b[_0x5e60('0x12')]));agents[_0x23498b[_0x5e60('0x12')]]['agentconnectAt']=utils['now']();agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0xb')]=_0x23498b[_0x5e60('0xb')];agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0x17')]=_0x23498b['connectedlinename'];agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0x21')]=_0x23498b[_0x5e60('0x22')];agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0x1f')]=_0x5e60('0x2c');_[_0x5e60('0x25')](agents,function(_0x54022a,_0x401bf1){if(_0x54022a[_0x5e60('0x12')]!=_0x23498b['destuniqueid']&&_0x54022a['uniqueid']==_0x23498b['uniqueid']){_0x54022a[_0x5e60('0x23')]=0x0;_0x54022a[_0x5e60('0x21')]=_0x23498b[_0x5e60('0x22')];_0x54022a[_0x5e60('0x1a')]=!![];_0x54022a['agentringnoanswerAt']=utils[_0x5e60('0x2d')]();_0x54022a[_0x5e60('0x1f')]='answered_elsewhere';_0x54022a['reason']=_0x5e60('0x2e');_0x54022a[_0x5e60('0x2f')]=_0x23498b[_0x5e60('0x12')];_0x54022a[_0x5e60('0x30')]=_0x23498b[_0x5e60('0x8')];writeDB(_0x54022a);}});}}catch(_0x3899ae){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x2a'),_0x23498b['uniqueid']),_0x3899ae);}};exports[_0x5e60('0xe')]=function(_0x2bb154){try{if(!_['isNil'](agents[_0x2bb154[_0x5e60('0x12')]])){utils[_0x5e60('0x14')](util[_0x5e60('0x3')](_0x5e60('0x31'),_0x2bb154[_0x5e60('0x5')]),_0x2bb154);utils['info'](util[_0x5e60('0x3')](_0x5e60('0x32'),_0x2bb154[_0x5e60('0x5')],agents[_0x2bb154[_0x5e60('0x12')]]['membername'],_0x2bb154['destuniqueid']));agents[_0x2bb154['destuniqueid']][_0x5e60('0xe')]=!![];agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x33')]=utils[_0x5e60('0x2d')]();agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x23')]=utils['diffTime'](agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x33')],agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x34')]);agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x35')]=_0x2bb154[_0x5e60('0x35')];agents[_0x2bb154['destuniqueid']][_0x5e60('0x1f')]=_0x5e60('0x36');writeDB(agents[_0x2bb154[_0x5e60('0x12')]]);}}catch(_0x1b3add){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x31'),_0x2bb154[_0x5e60('0x5')]),_0x1b3add);}};exports[_0x5e60('0x37')]=function(_0x350d6d){try{if(!_[_0x5e60('0x1b')](agents[_0x350d6d[_0x5e60('0x38')]])){utils[_0x5e60('0x14')](util[_0x5e60('0x3')](_0x5e60('0x39'),_0x350d6d[_0x5e60('0x5')]),_0x350d6d);utils[_0x5e60('0x2')](util[_0x5e60('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x350d6d['uniqueid'],agents[_0x350d6d[_0x5e60('0x38')]]['membername'],agents[_0x350d6d[_0x5e60('0x38')]][_0x5e60('0x5')]));agents[_0x350d6d[_0x5e60('0x38')]][_0x5e60('0x3a')]=!![];agents[_0x350d6d[_0x5e60('0x38')]][_0x5e60('0x3b')]='blind';agents[_0x350d6d['transfereruniqueid']][_0x5e60('0x3c')]=_0x350d6d[_0x5e60('0x3d')];agents[_0x350d6d[_0x5e60('0x38')]]['transferuniqueid']=agents[_0x350d6d['transfereruniqueid']][_0x5e60('0x5')];}}catch(_0x46f3ba){utils[_0x5e60('0x18')](util['format'](_0x5e60('0x39'),_0x350d6d[_0x5e60('0x5')]),_0x46f3ba);}};exports[_0x5e60('0x3e')]=function(_0xf18339){try{utils[_0x5e60('0x14')](util[_0x5e60('0x3')]('[%s][agents][attendedtransfer]',_0xf18339[_0x5e60('0x3f')]),_0xf18339);if(_0xf18339[_0x5e60('0x3f')]==_0xf18339['origtransfererlinkedid']){if(!_[_0x5e60('0x1b')](agents[_0xf18339[_0x5e60('0x40')]])){utils[_0x5e60('0x2')](util['format'](_0x5e60('0x41'),_0xf18339[_0x5e60('0x3f')],agents[_0xf18339['secondtransfereruniqueid']][_0x5e60('0x8')]));agents[_0xf18339[_0x5e60('0x40')]][_0x5e60('0x3a')]=!![];agents[_0xf18339[_0x5e60('0x40')]]['transfertype']=_0x5e60('0x42');agents[_0xf18339[_0x5e60('0x40')]]['transferexten']=_0xf18339[_0x5e60('0x43')];agents[_0xf18339['secondtransfereruniqueid']][_0x5e60('0x44')]=_0xf18339['origtransfereruniqueid'];}if(_0xf18339[_0x5e60('0x45')]&&agents[_0xf18339[_0x5e60('0x45')]]){agents[_0xf18339['transfereeuniqueid']][_0x5e60('0x46')]=0x1;transfers[_0xf18339['transfereeuniqueid']]=_[_0x5e60('0x47')](agents[_0xf18339['transfereeuniqueid']]);transfers[_0xf18339[_0x5e60('0x45')]]['calleridnum']=agents[_0xf18339[_0x5e60('0x40')]][_0x5e60('0xa')];transfers[_0xf18339[_0x5e60('0x45')]][_0x5e60('0x48')]=agents[_0xf18339[_0x5e60('0x40')]][_0x5e60('0x48')];transfers[_0xf18339[_0x5e60('0x45')]]['agentcalledAt']=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x45')]][_0x5e60('0x34')]=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x45')]][_0x5e60('0x21')]=0x0;transfers[_0xf18339['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0xf18339['secondtransfereruniqueid']==_0xf18339[_0x5e60('0x49')]){if(!_[_0x5e60('0x1b')](agents[_0xf18339['origtransfereruniqueid']])){utils[_0x5e60('0x2')](util[_0x5e60('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0xf18339[_0x5e60('0x3f')],agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x8')]));agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x3a')]=!![];agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x3b')]=_0x5e60('0x42');agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x3c')]=_0xf18339[_0x5e60('0x4a')];agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x44')]=_0xf18339[_0x5e60('0x40')];}if(_0xf18339[_0x5e60('0x4b')]&&agents[_0xf18339[_0x5e60('0x4b')]]){agents[_0xf18339[_0x5e60('0x4b')]]['agententerreason']=0x1;transfers[_0xf18339[_0x5e60('0x4b')]]=_[_0x5e60('0x47')](agents[_0xf18339[_0x5e60('0x4b')]]);transfers[_0xf18339['transfertargetuniqueid']][_0x5e60('0xa')]=agents[_0xf18339[_0x5e60('0x3f')]]['calleridnum'];transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x48')]=agents[_0xf18339['origtransfereruniqueid']][_0x5e60('0x48')];transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x15')]=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x34')]=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x21')]=0x0;transfers[_0xf18339['transfertargetuniqueid']][_0x5e60('0x46')]=0x2;}}}catch(_0x2615f8){utils[_0x5e60('0x18')](util['format'](_0x5e60('0x4c'),_0xf18339[_0x5e60('0x3f')]),_0x2615f8);}};exports[_0x5e60('0x4d')]=function(_0x15d975){try{utils[_0x5e60('0x14')](util['format'](_0x5e60('0x4e'),_0x15d975[_0x5e60('0x5')]),_0x15d975);if(agents[_0x15d975[_0x5e60('0x5')]]&&agents[_0x15d975['uniqueid']]['reason']===_0x5e60('0x20')){if(_0x15d975[_0x5e60('0x4f')]==='21'){agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x35')]=_0x5e60('0x50');agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x1f')]='rejected';}utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x51'),_0x15d975['uniqueid'],agents[_0x15d975['uniqueid']][_0x5e60('0x8')],agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x35')],agents[_0x15d975['uniqueid']]['lastevent']));writeDB(agents[_0x15d975[_0x5e60('0x5')]]);var _0x45cc9c=unanswered[_0x5e60('0x52')](_0x15d975[_0x5e60('0x5')]);if(_0x45cc9c>-0x1){unanswered[_0x5e60('0x53')](_0x45cc9c,0x1);}}if(transfers[_0x15d975[_0x5e60('0x5')]]){transfers[_0x15d975['uniqueid']][_0x5e60('0xe')]=!![];transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')]=utils[_0x5e60('0x2d')]();transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x23')]=utils[_0x5e60('0x54')](transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')],transfers[_0x15d975['uniqueid']][_0x5e60('0x34')]);transfers[_0x15d975[_0x5e60('0x5')]]['reason']=_0x5e60('0x55');transfers[_0x15d975[_0x5e60('0x5')]]['lastevent']=_0x5e60('0x36');utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x51'),_0x15d975[_0x5e60('0x5')],transfers[_0x15d975[_0x5e60('0x5')]]['membername'],transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x35')],transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x1f')]));writeDB(transfers[_0x15d975[_0x5e60('0x5')]],!![]);}if(agents[_0x15d975[_0x5e60('0x5')]]&&agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x34')]){agents[_0x15d975[_0x5e60('0x5')]]['agentcomplete']=!![];agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')]=utils[_0x5e60('0x2d')]();agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x23')]=utils[_0x5e60('0x54')](agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')],agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x34')]);agents[_0x15d975['uniqueid']]['reason']=agents[_0x15d975['uniqueid']][_0x5e60('0x3a')]?_0x5e60('0x3a'):_0x5e60('0x55');agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x1f')]=_0x5e60('0x36');utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x51'),_0x15d975['uniqueid'],agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x8')],agents[_0x15d975[_0x5e60('0x5')]]['reason'],agents[_0x15d975[_0x5e60('0x5')]]['lastevent']));writeDB(agents[_0x15d975['uniqueid']]);}}catch(_0x5c1aa2){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x4e'),_0x15d975[_0x5e60('0x5')]),_0x5c1aa2);}}; \ No newline at end of file +var _0xa5fa=['[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertype','secondtransfererexten','transferuniqueid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','acw','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','[%s][agents][agentcalled]','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer'];(function(_0x4df998,_0x4f3540){var _0xf9deb8=function(_0x330111){while(--_0x330111){_0x4df998['push'](_0x4df998['shift']());}};_0xf9deb8(++_0x4f3540);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x54e350,_0x110bb2){_0x54e350=_0x54e350-0x0;var _0x252979=_0xa5fa[_0x54e350];return _0x252979;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var utils=require(_0xaa5f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24d383,_0x1b7e1d){utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x3'),_0x24d383['uniqueid'],_0x24d383[_0xaa5f('0x4')],_0x24d383[_0xaa5f('0x5')],_0x24d383[_0xaa5f('0x6')],_0x24d383[_0xaa5f('0x7')],_0x24d383[_0xaa5f('0x8')],_0x24d383[_0xaa5f('0x9')],_0x24d383[_0xaa5f('0xa')]));if(_0x24d383[_0xaa5f('0x5')]){utils[_0xaa5f('0xb')](_0x24d383[_0xaa5f('0x5')])[_0xaa5f('0xc')](function(_0x4e5257){if(_0x4e5257){_0x24d383[_0xaa5f('0xd')]=_0x4e5257[_0xaa5f('0xd')];_0x24d383['agentacw']=_0x24d383['agentcomplete']?_0x4e5257[_0xaa5f('0xe')]:![];_0x24d383['acwtime']=_0x24d383['agentacw']?_0x4e5257[_0xaa5f('0xf')]:0x0;}utils['request'](_0xaa5f('0x10'),_0x24d383);});}else{utils[_0xaa5f('0x11')](_0xaa5f('0x10'),_0x24d383);}if(_0x1b7e1d){delete transfers[_0x24d383[_0xaa5f('0x12')]];}else{delete agents[_0x24d383[_0xaa5f('0x13')]];}}exports['agentcalled']=function(_0xbd4e10){try{utils['debug'](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0xbd4e10);agents[_0xbd4e10[_0xaa5f('0x13')]]=_0xbd4e10;agents[_0xbd4e10[_0xaa5f('0x13')]]['agentcalledAt']=utils['now']();agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x15');agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x9')]=null;agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x16')]=null;utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x18'),_0xbd4e10[_0xaa5f('0x12')],agents[_0xbd4e10[_0xaa5f('0x13')]]['membername'],_0xbd4e10[_0xaa5f('0x13')]));}catch(_0x4c0a9d){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0x4c0a9d);}};exports[_0xaa5f('0x1a')]=function(_0x194691){try{if(!_[_0xaa5f('0x1b')](agents[_0x194691[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x1d'),_0x194691['uniqueid']),_0x194691);utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x1e'),_0x194691[_0xaa5f('0x12')],agents[_0x194691['destuniqueid']][_0xaa5f('0x6')],_0x194691[_0xaa5f('0x13')]));agents[_0x194691['destuniqueid']][_0xaa5f('0x1a')]=!![];agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x1f')]=utils[_0xaa5f('0x20')]();agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]]['reason']=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x194691['ringtime']?parseInt(_0x194691[_0xaa5f('0x23')])/0x3e8:0x0;agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x24')]=0x0;unanswered['push'](_0x194691[_0xaa5f('0x13')]);}}catch(_0x479f29){utils['error'](util[_0xaa5f('0x2')]('[%s][agents][agentringnoanswer]',_0x194691[_0xaa5f('0x12')]),_0x479f29);}};exports['queuecallerabandon']=function(_0x4c5dc0){try{_['forIn'](agents,function(_0x26a90d,_0x4ddebd){if(_0x26a90d[_0xaa5f('0x12')]==_0x4c5dc0[_0xaa5f('0x12')]&&!_['includes'](unanswered,_0x26a90d['destuniqueid'])){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x4c5dc0);utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x26'),_0x4c5dc0[_0xaa5f('0x12')],_0x26a90d['membername'],_0x26a90d[_0xaa5f('0x13')]));_0x26a90d[_0xaa5f('0x1a')]=!![];_0x26a90d['agentringnoanswerAt']=utils['now']();_0x26a90d['lastevent']='abandoned';_0x26a90d[_0xaa5f('0x27')]=_0xaa5f('0x28');_0x26a90d[_0xaa5f('0x22')]=_0x4c5dc0[_0xaa5f('0x22')];_0x26a90d[_0xaa5f('0x24')]=0x0;writeDB(_0x26a90d);}});}catch(_0x3bcaf6){utils[_0xaa5f('0x19')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x3bcaf6);}};exports[_0xaa5f('0x29')]=function(_0x1f3268){try{if(agents[_0x1f3268[_0xaa5f('0x13')]]){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x2a'),_0x1f3268[_0xaa5f('0x12')]),_0x1f3268);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x2b'),_0x1f3268['uniqueid'],agents[_0x1f3268['destuniqueid']][_0xaa5f('0x6')],_0x1f3268[_0xaa5f('0x13')]));agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x2c')]=utils['now']();agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x9')]=_0x1f3268[_0xaa5f('0x9')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x16')]=_0x1f3268[_0xaa5f('0x16')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0xa')]='connect';_[_0xaa5f('0x2d')](agents,function(_0x2562ce,_0xcd9c30){if(_0x2562ce[_0xaa5f('0x13')]!=_0x1f3268[_0xaa5f('0x13')]&&_0x2562ce[_0xaa5f('0x12')]==_0x1f3268[_0xaa5f('0x12')]){_0x2562ce[_0xaa5f('0x24')]=0x0;_0x2562ce[_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];_0x2562ce['agentringnoanswer']=!![];_0x2562ce[_0xaa5f('0x1f')]=utils['now']();_0x2562ce[_0xaa5f('0xa')]=_0xaa5f('0x2e');_0x2562ce[_0xaa5f('0x27')]='answered_elsewhere';_0x2562ce[_0xaa5f('0x2f')]=_0x1f3268[_0xaa5f('0x13')];_0x2562ce[_0xaa5f('0x30')]=_0x1f3268['membername'];writeDB(_0x2562ce);}});}}catch(_0x12a8e4){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x2a'),_0x1f3268['uniqueid']),_0x12a8e4);}};exports[_0xaa5f('0x31')]=function(_0x2b2b4c){try{if(!_[_0xaa5f('0x1b')](agents[_0x2b2b4c[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x2b2b4c);utils['info'](util[_0xaa5f('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2b2b4c[_0xaa5f('0x12')],agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x6')],_0x2b2b4c[_0xaa5f('0x13')]));agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x33')]=utils['now']();agents[_0x2b2b4c['destuniqueid']]['talktime']=utils[_0xaa5f('0x34')](agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x33')],agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x2c')]);agents[_0x2b2b4c[_0xaa5f('0x13')]]['reason']=_0x2b2b4c[_0xaa5f('0x27')];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x35');writeDB(agents[_0x2b2b4c[_0xaa5f('0x13')]]);}}catch(_0x1f9629){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x1f9629);}};exports[_0xaa5f('0x36')]=function(_0x2de737){try{if(!_[_0xaa5f('0x1b')](agents[_0x2de737[_0xaa5f('0x37')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')]('[%s][agents][blindtransfer]',_0x2de737[_0xaa5f('0x12')]),_0x2de737);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x38'),_0x2de737[_0xaa5f('0x12')],agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x6')],agents[_0x2de737['transfereruniqueid']][_0xaa5f('0x12')]));agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x39')]=!![];agents[_0x2de737[_0xaa5f('0x37')]]['transfertype']=_0xaa5f('0x3a');agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x3b')]=_0x2de737['extension'];agents[_0x2de737['transfereruniqueid']]['transferuniqueid']=agents[_0x2de737['transfereruniqueid']]['uniqueid'];}}catch(_0x509c61){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3c'),_0x2de737[_0xaa5f('0x12')]),_0x509c61);}};exports[_0xaa5f('0x3d')]=function(_0x17b872){try{utils['debug'](util['format'](_0xaa5f('0x3e'),_0x17b872[_0xaa5f('0x3f')]),_0x17b872);if(_0x17b872['origtransfereruniqueid']==_0x17b872[_0xaa5f('0x40')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872[_0xaa5f('0x41')]])){utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872['secondtransfereruniqueid']]['membername']));agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x39')]=!![];agents[_0x17b872['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x17b872[_0xaa5f('0x41')]]['transferexten']=_0x17b872[_0xaa5f('0x43')];agents[_0x17b872['secondtransfereruniqueid']]['transferuniqueid']=_0x17b872[_0xaa5f('0x3f')];}if(_0x17b872[_0xaa5f('0x44')]&&agents[_0x17b872[_0xaa5f('0x44')]]){agents[_0x17b872['transfereeuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x44')]]=_[_0xaa5f('0x46')](agents[_0x17b872['transfereeuniqueid']]);transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x8')]=agents[_0x17b872['secondtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x47')]=agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x48')]=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]]['agentconnectAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x45')]=0x2;}}else if(_0x17b872[_0xaa5f('0x41')]==_0x17b872[_0xaa5f('0x49')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872['origtransfereruniqueid']])){utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x6')]));agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x39')]=!![];agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x4a')]='ATTENDED';agents[_0x17b872[_0xaa5f('0x3f')]]['transferexten']=_0x17b872[_0xaa5f('0x4b')];agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x4c')]=_0x17b872[_0xaa5f('0x41')];}if(_0x17b872[_0xaa5f('0x4d')]&&agents[_0x17b872[_0xaa5f('0x4d')]]){agents[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x4d')]]=_['clone'](agents[_0x17b872['transfertargetuniqueid']]);transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x8')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x47')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x4d')]]['agentcalledAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x2c')]=utils['now']();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x2;}}}catch(_0x309605){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3e'),_0x17b872['origtransfereruniqueid']),_0x309605);}};exports[_0xaa5f('0x4e')]=function(_0x2ba378){try{utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x4f'),_0x2ba378['uniqueid']),_0x2ba378);if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378['uniqueid']][_0xaa5f('0x27')]===_0xaa5f('0x21')){if(_0x2ba378[_0xaa5f('0x50')]==='21'){agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=_0xaa5f('0x51');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x51');}utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378['uniqueid'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]]['lastevent']));writeDB(agents[_0x2ba378['uniqueid']]);var _0x104079=unanswered[_0xaa5f('0x52')](_0x2ba378['uniqueid']);if(_0x104079>-0x1){unanswered[_0xaa5f('0x53')](_0x104079,0x1);}}if(transfers[_0x2ba378['uniqueid']]){transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x31')]=!![];transfers[_0x2ba378['uniqueid']][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')],transfers[_0x2ba378['uniqueid']][_0xaa5f('0x2c')]);transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')]='agent';transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378[_0xaa5f('0x12')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(transfers[_0x2ba378[_0xaa5f('0x12')]],!![]);}if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378[_0xaa5f('0x12')]]['agentconnectAt']){agents[_0x2ba378['uniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](agents[_0x2ba378[_0xaa5f('0x12')]]['agentcompleteAt'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x2c')]);agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=agents[_0x2ba378['uniqueid']][_0xaa5f('0x39')]?_0xaa5f('0x39'):_0xaa5f('0x54');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x55'),_0x2ba378[_0xaa5f('0x12')],agents[_0x2ba378['uniqueid']][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(agents[_0x2ba378['uniqueid']]);}}catch(_0x4183c0){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')]('[%s][agents][hangup]',_0x2ba378['uniqueid']),_0x4183c0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 08602a0..ab5ba0a 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 _0x126c=['lastapplication','lastdata','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','xmd-contactid','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','gotoif'];(function(_0x3f4c36,_0x44142e){var _0x21cd79=function(_0x3ade80){while(--_0x3ade80){_0x3f4c36['push'](_0x3f4c36['shift']());}};_0x21cd79(++_0x44142e);}(_0x126c,0x14a));var _0xc126=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x126c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc126('0x0'));var util=require(_0xc126('0x1'));var utils=require(_0xc126('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xc126('0x3'),_0xc126('0x4'),_0xc126('0x4'),'NO\x20ANSWER',_0xc126('0x3'),_0xc126('0x3'),_0xc126('0x5'),_0xc126('0x6'),'FAILED',_0xc126('0x4'),_0xc126('0x4')];var channels={};function writeDB(_0x34d13e){var _0x5a55fc;if(transfers[_0xc126('0x7')][_0x34d13e['uniqueid']]){_0x5a55fc=_0x34d13e['uniqueid'];_0x34d13e[_0xc126('0x8')]=transfers['blinds'][_0x34d13e[_0xc126('0x8')]][_0xc126('0x9')];}utils[_0xc126('0xa')](util[_0xc126('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34d13e['uniqueid'],_0x34d13e[_0xc126('0xc')],_0x34d13e[_0xc126('0xd')],_0x34d13e[_0xc126('0xe')],_0x34d13e['interface'],_0x34d13e[_0xc126('0xf')],_0x34d13e[_0xc126('0x10')],_0x34d13e[_0xc126('0x11')]));if(_0x34d13e[_0xc126('0x12')]){utils[_0xc126('0x13')](_0x34d13e[_0xc126('0x12')])['then'](function(_0x12a92f){if(_0x12a92f){_0x34d13e[_0xc126('0x14')]=_0x12a92f['id'];}utils[_0xc126('0x15')](_0xc126('0x16'),_0x34d13e);});}else{utils['request']('CreateVoiceCallReport',_0x34d13e);}if(channels[_0x34d13e[_0xc126('0x8')]]){delete channels[_0x34d13e['uniqueid']];}else if(_0x5a55fc&&channels[_0x5a55fc]){delete transfers[_0xc126('0x7')][_0x5a55fc];delete channels[_0x5a55fc];}}exports[_0xc126('0x17')]=function(_0x318600){try{utils[_0xc126('0x18')](util[_0xc126('0xb')]('[%s][calls][newchannel]',_0x318600[_0xc126('0x8')]),_0x318600);if(_0x318600[_0xc126('0x8')]==_0x318600[_0xc126('0x19')]&&_0x318600['channel']!=_0xc126('0x1a')){utils['info'](util[_0xc126('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x318600[_0xc126('0x8')],_0x318600[_0xc126('0x1b')],_0x318600[_0xc126('0x1c')]));channels[_0x318600['uniqueid']]={'uniqueid':_0x318600[_0xc126('0x8')],'accountcode':_0x318600[_0xc126('0x12')],'source':_0x318600[_0xc126('0xf')],'destination':_0x318600['exten'],'destinationcontext':_0x318600[_0xc126('0x1b')],'channel':_0x318600[_0xc126('0xc')],'starttime':utils[_0xc126('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc126('0x3'),'amaflags':_0xc126('0x1e')};}}catch(_0x1c7026){utils[_0xc126('0x1f')](util['format']('[%s][calls][newchannel]',_0x318600[_0xc126('0x8')]),_0x1c7026);}};exports[_0xc126('0x20')]=function(_0x5616bf){try{utils[_0xc126('0x18')](util[_0xc126('0xb')](_0xc126('0x21'),_0x5616bf[_0xc126('0x8')]),_0x5616bf);if(!_[_0xc126('0x22')](channels[_0x5616bf[_0xc126('0x8')]])&&_0x5616bf[_0xc126('0x23')]==0x6){utils['info'](util['format'](_0xc126('0x24'),_0x5616bf[_0xc126('0x8')],_0x5616bf[_0xc126('0x1b')],_0x5616bf[_0xc126('0xc')]));if(_[_0xc126('0x22')](channels[_0x5616bf[_0xc126('0x8')]][_0xc126('0x25')])){channels[_0x5616bf[_0xc126('0x8')]][_0xc126('0x25')]=utils['now']();}}else if(!_[_0xc126('0x22')](channels[_0x5616bf[_0xc126('0x19')]])&&_0x5616bf[_0xc126('0x23')]==0x6&&_0x5616bf[_0xc126('0x1b')]!=_0xc126('0x26')){utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x27'),_0x5616bf['uniqueid'],_0x5616bf['linkedid'],_0x5616bf[_0xc126('0x1b')],_0x5616bf[_0xc126('0xc')]));channels[_0x5616bf[_0xc126('0x19')]][_0xc126('0x12')]=_0x5616bf['accountcode'];channels[_0x5616bf['linkedid']][_0xc126('0x28')]=_0x5616bf[_0xc126('0xc')];if(_[_0xc126('0x22')](channels[_0x5616bf[_0xc126('0x19')]][_0xc126('0x29')])){channels[_0x5616bf[_0xc126('0x19')]][_0xc126('0x29')]=utils['now']();}channels[_0x5616bf['linkedid']]['disposition']=dispositions[_[_0xc126('0x2a')](_0x5616bf[_0xc126('0x23')])]||_0xc126('0x5');}}catch(_0x11621a){utils[_0xc126('0x1f')](util[_0xc126('0xb')](_0xc126('0x21'),_0x5616bf['uniqueid']),_0x11621a);}};exports['hangup']=function(_0x37d5f8){try{if(!_[_0xc126('0x22')](channels[_0x37d5f8[_0xc126('0x8')]])){utils['debug'](util[_0xc126('0xb')](_0xc126('0x2b'),_0x37d5f8[_0xc126('0x8')]),_0x37d5f8);if(_[_0xc126('0x22')](channels[_0x37d5f8[_0xc126('0x8')]]['callerid'])){channels[_0x37d5f8[_0xc126('0x8')]][_0xc126('0x2c')]=_0x37d5f8[_0xc126('0x2d')]+'\x20<'+_0x37d5f8[_0xc126('0xf')]+'>';}utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x2e'),_0x37d5f8[_0xc126('0x8')],channels[_0x37d5f8['uniqueid']][_0xc126('0x2c')],_0x37d5f8[_0xc126('0x2f')]));channels[_0x37d5f8['uniqueid']]['endtime']=utils[_0xc126('0x1d')]();channels[_0x37d5f8['uniqueid']]['duration']=utils[_0xc126('0x30')](channels[_0x37d5f8[_0xc126('0x8')]][_0xc126('0x31')],channels[_0x37d5f8['uniqueid']][_0xc126('0x32')]);channels[_0x37d5f8['uniqueid']]['billableseconds']=channels[_0x37d5f8[_0xc126('0x8')]][_0xc126('0x29')]?utils['diffTime'](channels[_0x37d5f8['uniqueid']][_0xc126('0x31')],channels[_0x37d5f8[_0xc126('0x8')]]['answertime']):0x0;writeDB(channels[_0x37d5f8[_0xc126('0x8')]]);}}catch(_0x10e77b){utils[_0xc126('0x1f')](util[_0xc126('0xb')](_0xc126('0x2b'),_0x37d5f8[_0xc126('0x8')]),_0x10e77b);}};exports[_0xc126('0x33')]=function(_0x1e9bd3){try{if(!_[_0xc126('0x22')](channels[_0x1e9bd3[_0xc126('0x34')]])){utils[_0xc126('0x18')](util[_0xc126('0xb')](_0xc126('0x35'),_0x1e9bd3[_0xc126('0x36')]),_0x1e9bd3);if(channels[_0x1e9bd3[_0xc126('0x34')]][_0xc126('0xc')]==_0x1e9bd3[_0xc126('0x37')]){utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x38'),_0x1e9bd3[_0xc126('0x36')],_0x1e9bd3[_0xc126('0x34')],_0x1e9bd3[_0xc126('0x39')]));channels[_0x1e9bd3[_0xc126('0x34')]]['destinationchannel']=_0x1e9bd3[_0xc126('0x39')];channels[_0x1e9bd3[_0xc126('0x34')]][_0xc126('0x3a')]=_0xc126('0x3b');}else if(channels[_0x1e9bd3['localtwolinkedid']][_0xc126('0xc')]=_0x1e9bd3[_0xc126('0x3c')]){utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x38'),_0x1e9bd3[_0xc126('0x36')],_0x1e9bd3[_0xc126('0x34')],_0x1e9bd3['origtransfererchannel']));channels[_0x1e9bd3['localtwolinkedid']][_0xc126('0x28')]=_0x1e9bd3[_0xc126('0x3d')];channels[_0x1e9bd3[_0xc126('0x34')]]['userfield']=_0xc126('0x3b');}}}catch(_0x1bd234){utils[_0xc126('0x1f')](util[_0xc126('0xb')]('[%s][calls][attendedtransfer]',_0x1e9bd3['origtransfereruniqueid']),_0x1bd234);}};exports[_0xc126('0x3e')]=function(_0x2b6ff0){try{if(!_[_0xc126('0x22')](channels[_0x2b6ff0[_0xc126('0x8')]])){utils[_0xc126('0x18')](util[_0xc126('0xb')]('[%s][calls][musiconholdstart]',_0x2b6ff0[_0xc126('0x8')]),_0x2b6ff0);channels[_0x2b6ff0['uniqueid']][_0xc126('0x3f')]=utils[_0xc126('0x1d')]();utils[_0xc126('0xa')](util[_0xc126('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2b6ff0[_0xc126('0x8')],channels[_0x2b6ff0['uniqueid']][_0xc126('0x3f')]));}}catch(_0x1ba6b8){utils[_0xc126('0x1f')](util[_0xc126('0xb')](_0xc126('0x40'),_0x2b6ff0[_0xc126('0x8')]),_0x1ba6b8);}};exports[_0xc126('0x41')]=function(_0x17bfdd){try{if(!_[_0xc126('0x22')](channels[_0x17bfdd[_0xc126('0x8')]])){utils[_0xc126('0x18')](util[_0xc126('0xb')](_0xc126('0x42'),_0x17bfdd[_0xc126('0x8')]),_0x17bfdd);if(!_['isNil'](channels[_0x17bfdd[_0xc126('0x8')]][_0xc126('0x3f')])){channels[_0x17bfdd[_0xc126('0x8')]][_0xc126('0x43')]+=utils['diffTime'](utils[_0xc126('0x1d')](),channels[_0x17bfdd[_0xc126('0x8')]]['musiconholdstartAt']);utils[_0xc126('0xa')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x17bfdd['uniqueid'],channels[_0x17bfdd[_0xc126('0x8')]][_0xc126('0x43')]));delete channels[_0x17bfdd[_0xc126('0x8')]][_0xc126('0x3f')];}}}catch(_0x4db353){utils[_0xc126('0x1f')](util['format'](_0xc126('0x42'),_0x17bfdd[_0xc126('0x8')]),_0x4db353);}};exports[_0xc126('0x44')]=function(_0x2a6388){try{if(!_[_0xc126('0x22')](channels[_0x2a6388['uniqueid']])){utils[_0xc126('0x18')](util[_0xc126('0xb')](_0xc126('0x45'),_0x2a6388['uniqueid']),_0x2a6388);if(!_['isNil'](_0x2a6388[_0xc126('0x46')][_0xc126('0x47')])){utils[_0xc126('0xa')](util['format'](_0xc126('0x48'),_0x2a6388[_0xc126('0x8')],_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388[_0xc126('0x8')]][_0xc126('0x4a')]=_0x2a6388['value'];}if(!_[_0xc126('0x22')](_0x2a6388[_0xc126('0x46')]['xmd-phone'])){utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x4b'),_0x2a6388[_0xc126('0x8')],_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388[_0xc126('0x8')]][_0xc126('0x4c')]=_0x2a6388[_0xc126('0x49')];channels[_0x2a6388['uniqueid']]['callerid']='\x22'+_0x2a6388[_0xc126('0x49')]+_0xc126('0x4d')+_0x2a6388[_0xc126('0x49')]+'>';}if(!_[_0xc126('0x22')](_0x2a6388[_0xc126('0x46')][_0xc126('0x4e')])||!_[_0xc126('0x22')](_0x2a6388['variable'][_0xc126('0x4f')])){utils[_0xc126('0xa')](util['format'](_0xc126('0x50'),_0x2a6388['uniqueid'],!_[_0xc126('0x22')](_0x2a6388[_0xc126('0x46')][_0xc126('0x4e')])?_0xc126('0x4e'):_0xc126('0x4f'),_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388[_0xc126('0x8')]][_0xc126('0x2c')]=_0x2a6388['value'];}if(!_[_0xc126('0x22')](_0x2a6388[_0xc126('0x46')][_0xc126('0x51')])||!_[_0xc126('0x22')](_0x2a6388['variable'][_0xc126('0x52')])){utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x50'),_0x2a6388['uniqueid'],!_[_0xc126('0x22')](_0x2a6388[_0xc126('0x46')][_0xc126('0x51')])?_0xc126('0x51'):_0xc126('0x52'),_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388[_0xc126('0x8')]]['lastapplication']=_0xc126('0x53');channels[_0x2a6388[_0xc126('0x8')]]['lastdata']=_0x2a6388[_0xc126('0x49')];channels[_0x2a6388['uniqueid']][_0xc126('0xd')]=!![];}if(!_['isNil'](_0x2a6388[_0xc126('0x46')][_0xc126('0x54')])){utils[_0xc126('0xa')](util[_0xc126('0xb')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x2a6388[_0xc126('0x8')],_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388[_0xc126('0x8')]][_0xc126('0x55')]=_0x2a6388[_0xc126('0x49')];}if(!_[_0xc126('0x22')](_0x2a6388[_0xc126('0x46')][_0xc126('0x56')])){utils[_0xc126('0xa')](util[_0xc126('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2a6388[_0xc126('0x8')],_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388[_0xc126('0x8')]][_0xc126('0x57')]=_0x2a6388[_0xc126('0x49')];}if(!_[_0xc126('0x22')](_0x2a6388['variable']['outboundrouteid'])){utils[_0xc126('0xa')](util['format'](_0xc126('0x58'),_0x2a6388['uniqueid'],_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388['uniqueid']][_0xc126('0x59')]=_0x2a6388[_0xc126('0x49')];}if(!_['isNil'](_0x2a6388[_0xc126('0x46')]['sipcallid'])){utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x5a'),_0x2a6388[_0xc126('0x8')],_0x2a6388[_0xc126('0x49')]));channels[_0x2a6388[_0xc126('0x8')]][_0xc126('0x5b')]=_0x2a6388[_0xc126('0x49')];}}}catch(_0x57bbdd){utils[_0xc126('0x1f')](util[_0xc126('0xb')](_0xc126('0x45'),_0x2a6388[_0xc126('0x8')]),_0x57bbdd);}};exports[_0xc126('0x5c')]=function(_0x8972ee){try{if(!_[_0xc126('0x22')](channels[_0x8972ee['uniqueid']])){utils[_0xc126('0x18')](util[_0xc126('0xb')]('[%s][calls][newexten]',_0x8972ee['uniqueid']),_0x8972ee);utils[_0xc126('0xa')](util[_0xc126('0xb')](_0xc126('0x5d'),_0x8972ee[_0xc126('0x8')],_0x8972ee[_0xc126('0x5e')],_0x8972ee[_0xc126('0x5f')]));if(_0x8972ee[_0xc126('0x5e')][_0xc126('0x60')]()==_0xc126('0x61')&&_[_0xc126('0x62')](_0x8972ee[_0xc126('0x5f')]['toLowerCase'](),_0xc126('0x63'))){var _0x48f297=_0x8972ee[_0xc126('0x5f')][_0xc126('0x64')]('=');var _0x170ec4=_0x48f297[0x0][_0xc126('0x65')](_0x48f297[0x0]['lastIndexOf']('(')+0x1,_0x48f297[0x0][_0xc126('0x66')](')'));var _0x28ce96=_0x48f297[0x1];channels[_0x8972ee['uniqueid']][_0x170ec4]=_0x28ce96;}if(!_['includes']([_0xc126('0x67'),_0xc126('0x68'),'execif',_0xc126('0x61'),_0xc126('0x69')],_0x8972ee[_0xc126('0x5e')][_0xc126('0x60')]())){channels[_0x8972ee[_0xc126('0x8')]][_0xc126('0x6a')]=_0x8972ee[_0xc126('0x5e')];channels[_0x8972ee['uniqueid']][_0xc126('0x6b')]=_0x8972ee[_0xc126('0x5f')];}}}catch(_0x4f0b34){utils['error'](util[_0xc126('0xb')](_0xc126('0x6c'),_0x8972ee['uniqueid']),_0x4f0b34);}}; \ No newline at end of file +var _0x8be8=['xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','appdata','cdr','lastIndexOf','hangup','noop','execif','gotoif','toLowerCase','lastdata','[%s][calls][newexten]','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','format','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x8be8,0xfe));var _0x88be=function(_0x1e8cba,_0x29a703){_0x1e8cba=_0x1e8cba-0x0;var _0x214cfb=_0x8be8[_0x1e8cba];return _0x214cfb;};'use strict';var _=require('lodash');var util=require(_0x88be('0x0'));var utils=require(_0x88be('0x1'));var transfers=require(_0x88be('0x2'));var dispositions=[_0x88be('0x3'),_0x88be('0x4'),_0x88be('0x4'),_0x88be('0x3'),'NO\x20ANSWER',_0x88be('0x3'),_0x88be('0x5'),_0x88be('0x6'),'FAILED',_0x88be('0x4'),'FAILED'];var channels={};function writeDB(_0x1d147a){var _0xd45849;if(transfers[_0x88be('0x7')][_0x1d147a['uniqueid']]){_0xd45849=_0x1d147a[_0x88be('0x8')];_0x1d147a[_0x88be('0x8')]=transfers['blinds'][_0x1d147a[_0x88be('0x8')]][_0x88be('0x9')];}utils[_0x88be('0xa')](util['format'](_0x88be('0xb'),_0x1d147a[_0x88be('0x8')],_0x1d147a['channel'],_0x1d147a[_0x88be('0xc')],_0x1d147a[_0x88be('0xd')],_0x1d147a[_0x88be('0xe')],_0x1d147a[_0x88be('0xf')],_0x1d147a[_0x88be('0x10')],_0x1d147a['lastevent']));if(_0x1d147a[_0x88be('0x11')]){utils[_0x88be('0x12')](_0x1d147a[_0x88be('0x11')])[_0x88be('0x13')](function(_0x11cb35){if(_0x11cb35){_0x1d147a[_0x88be('0x14')]=_0x11cb35['id'];}utils['request'](_0x88be('0x15'),_0x1d147a);});}else{utils[_0x88be('0x16')](_0x88be('0x15'),_0x1d147a);}if(channels[_0x1d147a[_0x88be('0x8')]]){delete channels[_0x1d147a[_0x88be('0x8')]];}else if(_0xd45849&&channels[_0xd45849]){delete transfers[_0x88be('0x7')][_0xd45849];delete channels[_0xd45849];}}exports[_0x88be('0x17')]=function(_0x2b7539){try{utils[_0x88be('0x18')](util[_0x88be('0x19')]('[%s][calls][newchannel]',_0x2b7539[_0x88be('0x8')]),_0x2b7539);if(_0x2b7539['uniqueid']==_0x2b7539[_0x88be('0x1a')]&&_0x2b7539[_0x88be('0x1b')]!=_0x88be('0x1c')){utils[_0x88be('0xa')](util[_0x88be('0x19')](_0x88be('0x1d'),_0x2b7539[_0x88be('0x8')],_0x2b7539[_0x88be('0x1e')],_0x2b7539['exten']));channels[_0x2b7539['uniqueid']]={'uniqueid':_0x2b7539[_0x88be('0x8')],'accountcode':_0x2b7539[_0x88be('0x11')],'source':_0x2b7539[_0x88be('0xf')],'destination':_0x2b7539[_0x88be('0x1f')],'destinationcontext':_0x2b7539[_0x88be('0x1e')],'channel':_0x2b7539['channel'],'starttime':utils[_0x88be('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x88be('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x50e7fb){utils[_0x88be('0x21')](util[_0x88be('0x19')](_0x88be('0x22'),_0x2b7539['uniqueid']),_0x50e7fb);}};exports[_0x88be('0x23')]=function(_0x9d27b5){try{utils[_0x88be('0x18')](util[_0x88be('0x19')](_0x88be('0x24'),_0x9d27b5[_0x88be('0x8')]),_0x9d27b5);if(!_[_0x88be('0x25')](channels[_0x9d27b5[_0x88be('0x8')]])&&_0x9d27b5[_0x88be('0x26')]==0x6){utils[_0x88be('0xa')](util[_0x88be('0x19')](_0x88be('0x27'),_0x9d27b5[_0x88be('0x8')],_0x9d27b5[_0x88be('0x1e')],_0x9d27b5['channel']));if(_[_0x88be('0x25')](channels[_0x9d27b5[_0x88be('0x8')]][_0x88be('0x28')])){channels[_0x9d27b5[_0x88be('0x8')]]['systemanswertime']=utils[_0x88be('0x20')]();}}else if(!_[_0x88be('0x25')](channels[_0x9d27b5[_0x88be('0x1a')]])&&_0x9d27b5['channelstate']==0x6&&_0x9d27b5[_0x88be('0x1e')]!=_0x88be('0x29')){utils[_0x88be('0xa')](util['format'](_0x88be('0x2a'),_0x9d27b5[_0x88be('0x8')],_0x9d27b5[_0x88be('0x1a')],_0x9d27b5['context'],_0x9d27b5[_0x88be('0x1b')]));channels[_0x9d27b5[_0x88be('0x1a')]][_0x88be('0x11')]=_0x9d27b5[_0x88be('0x11')];channels[_0x9d27b5[_0x88be('0x1a')]]['destinationchannel']=_0x9d27b5['channel'];if(_[_0x88be('0x25')](channels[_0x9d27b5[_0x88be('0x1a')]][_0x88be('0x2b')])){channels[_0x9d27b5[_0x88be('0x1a')]][_0x88be('0x2b')]=utils[_0x88be('0x20')]();}channels[_0x9d27b5['linkedid']]['disposition']=dispositions[_[_0x88be('0x2c')](_0x9d27b5[_0x88be('0x26')])]||_0x88be('0x5');}}catch(_0x3021c1){utils[_0x88be('0x21')](util['format']('[%s][calls][newstate]',_0x9d27b5[_0x88be('0x8')]),_0x3021c1);}};exports['hangup']=function(_0x1b1c45){try{if(!_[_0x88be('0x25')](channels[_0x1b1c45[_0x88be('0x8')]])){utils[_0x88be('0x18')](util[_0x88be('0x19')]('[%s][calls][hangup]',_0x1b1c45[_0x88be('0x8')]),_0x1b1c45);if(_[_0x88be('0x25')](channels[_0x1b1c45[_0x88be('0x8')]][_0x88be('0x2d')])){channels[_0x1b1c45[_0x88be('0x8')]]['callerid']=_0x1b1c45[_0x88be('0x2e')]+'\x20<'+_0x1b1c45[_0x88be('0xf')]+'>';}utils['info'](util[_0x88be('0x19')](_0x88be('0x2f'),_0x1b1c45[_0x88be('0x8')],channels[_0x1b1c45['uniqueid']][_0x88be('0x2d')],_0x1b1c45[_0x88be('0x30')]));channels[_0x1b1c45[_0x88be('0x8')]][_0x88be('0x31')]=utils[_0x88be('0x20')]();channels[_0x1b1c45['uniqueid']][_0x88be('0x32')]=utils[_0x88be('0x33')](channels[_0x1b1c45[_0x88be('0x8')]]['endtime'],channels[_0x1b1c45[_0x88be('0x8')]][_0x88be('0x34')]);channels[_0x1b1c45[_0x88be('0x8')]]['billableseconds']=channels[_0x1b1c45[_0x88be('0x8')]][_0x88be('0x2b')]?utils['diffTime'](channels[_0x1b1c45[_0x88be('0x8')]][_0x88be('0x31')],channels[_0x1b1c45[_0x88be('0x8')]][_0x88be('0x2b')]):0x0;writeDB(channels[_0x1b1c45[_0x88be('0x8')]]);}}catch(_0x3116c3){utils['error'](util[_0x88be('0x19')](_0x88be('0x35'),_0x1b1c45[_0x88be('0x8')]),_0x3116c3);}};exports[_0x88be('0x36')]=function(_0x6ab41c){try{if(!_['isNil'](channels[_0x6ab41c['localtwolinkedid']])){utils[_0x88be('0x18')](util[_0x88be('0x19')]('[%s][calls][attendedtransfer]',_0x6ab41c[_0x88be('0x37')]),_0x6ab41c);if(channels[_0x6ab41c['localtwolinkedid']][_0x88be('0x1b')]==_0x6ab41c[_0x88be('0x38')]){utils[_0x88be('0xa')](util['format'](_0x88be('0x39'),_0x6ab41c[_0x88be('0x37')],_0x6ab41c[_0x88be('0x3a')],_0x6ab41c[_0x88be('0x3b')]));channels[_0x6ab41c[_0x88be('0x3a')]][_0x88be('0x3c')]=_0x6ab41c[_0x88be('0x3b')];channels[_0x6ab41c[_0x88be('0x3a')]][_0x88be('0x3d')]='_attended';}else if(channels[_0x6ab41c[_0x88be('0x3a')]][_0x88be('0x1b')]=_0x6ab41c[_0x88be('0x3e')]){utils[_0x88be('0xa')](util['format'](_0x88be('0x39'),_0x6ab41c[_0x88be('0x37')],_0x6ab41c[_0x88be('0x3a')],_0x6ab41c['origtransfererchannel']));channels[_0x6ab41c['localtwolinkedid']]['destinationchannel']=_0x6ab41c[_0x88be('0x3f')];channels[_0x6ab41c[_0x88be('0x3a')]][_0x88be('0x3d')]=_0x88be('0x40');}}}catch(_0x2116c6){utils[_0x88be('0x21')](util[_0x88be('0x19')](_0x88be('0x41'),_0x6ab41c[_0x88be('0x37')]),_0x2116c6);}};exports[_0x88be('0x42')]=function(_0x232dfd){try{if(!_[_0x88be('0x25')](channels[_0x232dfd['uniqueid']])){utils['debug'](util[_0x88be('0x19')](_0x88be('0x43'),_0x232dfd['uniqueid']),_0x232dfd);channels[_0x232dfd[_0x88be('0x8')]][_0x88be('0x44')]=utils[_0x88be('0x20')]();utils[_0x88be('0xa')](util[_0x88be('0x19')](_0x88be('0x45'),_0x232dfd[_0x88be('0x8')],channels[_0x232dfd['uniqueid']][_0x88be('0x44')]));}}catch(_0x4f3203){utils[_0x88be('0x21')](util[_0x88be('0x19')](_0x88be('0x43'),_0x232dfd['uniqueid']),_0x4f3203);}};exports[_0x88be('0x46')]=function(_0xef885a){try{if(!_[_0x88be('0x25')](channels[_0xef885a[_0x88be('0x8')]])){utils[_0x88be('0x18')](util['format'](_0x88be('0x47'),_0xef885a[_0x88be('0x8')]),_0xef885a);if(!_[_0x88be('0x25')](channels[_0xef885a['uniqueid']][_0x88be('0x44')])){channels[_0xef885a[_0x88be('0x8')]][_0x88be('0x48')]+=utils[_0x88be('0x33')](utils['now'](),channels[_0xef885a[_0x88be('0x8')]]['musiconholdstartAt']);utils[_0x88be('0xa')](util[_0x88be('0x19')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0xef885a['uniqueid'],channels[_0xef885a[_0x88be('0x8')]][_0x88be('0x48')]));delete channels[_0xef885a[_0x88be('0x8')]][_0x88be('0x44')];}}}catch(_0x8ac502){utils[_0x88be('0x21')](util[_0x88be('0x19')](_0x88be('0x47'),_0xef885a[_0x88be('0x8')]),_0x8ac502);}};exports[_0x88be('0x49')]=function(_0x510f80){try{if(!_[_0x88be('0x25')](channels[_0x510f80[_0x88be('0x8')]])){utils[_0x88be('0x18')](util[_0x88be('0x19')](_0x88be('0x4a'),_0x510f80['uniqueid']),_0x510f80);if(!_['isNil'](_0x510f80[_0x88be('0x4b')][_0x88be('0x4c')])){utils[_0x88be('0xa')](util[_0x88be('0x19')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x510f80[_0x88be('0x8')],_0x510f80[_0x88be('0x4d')]));channels[_0x510f80['uniqueid']][_0x88be('0x4e')]=_0x510f80[_0x88be('0x4d')];}if(!_[_0x88be('0x25')](_0x510f80[_0x88be('0x4b')][_0x88be('0x4f')])){utils[_0x88be('0xa')](util['format'](_0x88be('0x50'),_0x510f80[_0x88be('0x8')],_0x510f80[_0x88be('0x4d')]));channels[_0x510f80[_0x88be('0x8')]][_0x88be('0x51')]=_0x510f80[_0x88be('0x4d')];channels[_0x510f80[_0x88be('0x8')]][_0x88be('0x2d')]='\x22'+_0x510f80[_0x88be('0x4d')]+_0x88be('0x52')+_0x510f80[_0x88be('0x4d')]+'>';}if(!_[_0x88be('0x25')](_0x510f80['variable'][_0x88be('0x53')])||!_[_0x88be('0x25')](_0x510f80[_0x88be('0x4b')]['xmd-callerid'])){utils[_0x88be('0xa')](util[_0x88be('0x19')](_0x88be('0x54'),_0x510f80['uniqueid'],!_[_0x88be('0x25')](_0x510f80['variable'][_0x88be('0x53')])?_0x88be('0x53'):_0x88be('0x55'),_0x510f80['value']));channels[_0x510f80[_0x88be('0x8')]]['callerid']=_0x510f80['value'];}if(!_['isNil'](_0x510f80[_0x88be('0x4b')][_0x88be('0x56')])||!_[_0x88be('0x25')](_0x510f80[_0x88be('0x4b')][_0x88be('0x57')])){utils['info'](util[_0x88be('0x19')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x510f80[_0x88be('0x8')],!_['isNil'](_0x510f80[_0x88be('0x4b')][_0x88be('0x56')])?'xmd-queue':_0x88be('0x57'),_0x510f80[_0x88be('0x4d')]));channels[_0x510f80[_0x88be('0x8')]][_0x88be('0x58')]=_0x88be('0x59');channels[_0x510f80[_0x88be('0x8')]]['lastdata']=_0x510f80[_0x88be('0x4d')];channels[_0x510f80['uniqueid']][_0x88be('0xc')]=!![];}if(!_[_0x88be('0x25')](_0x510f80[_0x88be('0x4b')][_0x88be('0x5a')])){utils[_0x88be('0xa')](util[_0x88be('0x19')](_0x88be('0x5b'),_0x510f80[_0x88be('0x8')],_0x510f80[_0x88be('0x4d')]));channels[_0x510f80[_0x88be('0x8')]][_0x88be('0x5c')]=_0x510f80[_0x88be('0x4d')];}if(!_[_0x88be('0x25')](_0x510f80['variable'][_0x88be('0x5d')])){utils[_0x88be('0xa')](util['format'](_0x88be('0x5e'),_0x510f80['uniqueid'],_0x510f80[_0x88be('0x4d')]));channels[_0x510f80[_0x88be('0x8')]]['type']=_0x510f80[_0x88be('0x4d')];}if(!_[_0x88be('0x25')](_0x510f80[_0x88be('0x4b')][_0x88be('0x5f')])){utils[_0x88be('0xa')](util[_0x88be('0x19')](_0x88be('0x60'),_0x510f80['uniqueid'],_0x510f80[_0x88be('0x4d')]));channels[_0x510f80[_0x88be('0x8')]][_0x88be('0x61')]=_0x510f80['value'];}if(!_[_0x88be('0x25')](_0x510f80[_0x88be('0x4b')][_0x88be('0x62')])){utils[_0x88be('0xa')](util[_0x88be('0x19')](_0x88be('0x63'),_0x510f80[_0x88be('0x8')],_0x510f80['value']));channels[_0x510f80[_0x88be('0x8')]][_0x88be('0x62')]=_0x510f80[_0x88be('0x4d')];}}}catch(_0x4bccc0){utils[_0x88be('0x21')](util[_0x88be('0x19')](_0x88be('0x4a'),_0x510f80['uniqueid']),_0x4bccc0);}};exports['newexten']=function(_0x33a22a){try{if(!_[_0x88be('0x25')](channels[_0x33a22a['uniqueid']])){utils['debug'](util[_0x88be('0x19')]('[%s][calls][newexten]',_0x33a22a['uniqueid']),_0x33a22a);utils[_0x88be('0xa')](util['format'](_0x88be('0x64'),_0x33a22a[_0x88be('0x8')],_0x33a22a[_0x88be('0x65')],_0x33a22a['appdata']));if(_0x33a22a[_0x88be('0x65')]['toLowerCase']()==_0x88be('0x66')&&_['startsWith'](_0x33a22a[_0x88be('0x67')]['toLowerCase'](),_0x88be('0x68'))){var _0x1681f5=_0x33a22a[_0x88be('0x67')]['split']('=');var _0x3d9b08=_0x1681f5[0x0]['substring'](_0x1681f5[0x0][_0x88be('0x69')]('(')+0x1,_0x1681f5[0x0][_0x88be('0x69')](')'));var _0x51bcd0=_0x1681f5[0x1];channels[_0x33a22a[_0x88be('0x8')]][_0x3d9b08]=_0x51bcd0;}if(!_['includes']([_0x88be('0x6a'),_0x88be('0x6b'),_0x88be('0x6c'),_0x88be('0x66'),_0x88be('0x6d')],_0x33a22a[_0x88be('0x65')][_0x88be('0x6e')]())){channels[_0x33a22a[_0x88be('0x8')]][_0x88be('0x58')]=_0x33a22a['application'];channels[_0x33a22a['uniqueid']][_0x88be('0x6f')]=_0x33a22a[_0x88be('0x67')];}}}catch(_0x11ef64){utils[_0x88be('0x21')](util[_0x88be('0x19')](_0x88be('0x70'),_0x33a22a[_0x88be('0x8')]),_0x11ef64);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6996a0c..2e26e82 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 _0xf9d1=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20close','managerevent'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf9d1,0xa2));var _0x1f9d=function(_0x594262,_0x52225f){_0x594262=_0x594262-0x0;var _0xeef368=_0xf9d1[_0x594262];return _0xeef368;};'use strict';var utils=require(_0x1f9d('0x0'));exports['connect']=function(){utils[_0x1f9d('0x1')](_0x1f9d('0x2'));};exports[_0x1f9d('0x3')]=function(){utils[_0x1f9d('0x1')](_0x1f9d('0x4'));};exports[_0x1f9d('0x5')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x363ae5){utils[_0x1f9d('0x6')]('[core]\x20error',_0x363ae5);};exports['close']=function(){utils['info'](_0x1f9d('0x7'));};exports[_0x1f9d('0x8')]=function(_0x5e203a){}; \ No newline at end of file +var _0xeecc=['managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close'];(function(_0x3a0ebd,_0x47f368){var _0x51a660=function(_0x4023e6){while(--_0x4023e6){_0x3a0ebd['push'](_0x3a0ebd['shift']());}};_0x51a660(++_0x47f368);}(_0xeecc,0x121));var _0xceec=function(_0x1c50bf,_0x56dc68){_0x1c50bf=_0x1c50bf-0x0;var _0x5cc258=_0xeecc[_0x1c50bf];return _0x5cc258;};'use strict';var utils=require(_0xceec('0x0'));exports[_0xceec('0x1')]=function(){utils['info'](_0xceec('0x2'));};exports[_0xceec('0x3')]=function(){utils[_0xceec('0x4')](_0xceec('0x5'));};exports[_0xceec('0x6')]=function(){utils[_0xceec('0x4')](_0xceec('0x7'));};exports[_0xceec('0x8')]=function(_0x4e5dc1){utils[_0xceec('0x8')]('[core]\x20error',_0x4e5dc1);};exports[_0xceec('0x9')]=function(){utils[_0xceec('0x4')](_0xceec('0xa'));};exports[_0xceec('0xb')]=function(_0x429e8a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4c2c694..5d868c4 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 _0xa871=['starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','error','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','diffTime','holdtime','billableseconds','endtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','varset','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa871,0xf4));var _0x1a87=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xa871[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x1a87('0x0'));var util=require(_0x1a87('0x1'));var utils=require(_0x1a87('0x2'));var dials={};function writeDB(_0x11a173){utils[_0x1a87('0x3')](util['format'](_0x1a87('0x4'),_0x11a173[_0x1a87('0x5')],_0x11a173[_0x1a87('0x6')],_0x11a173[_0x1a87('0x7')],_0x11a173['calleridnum'],_0x11a173[_0x1a87('0x8')],_0x11a173['dialstatus']));utils[_0x1a87('0x9')](_0x1a87('0xa'),_0x11a173);delete dials[_0x11a173[_0x1a87('0x5')]];}exports[_0x1a87('0xb')]=function(_0x1c91ad){try{utils[_0x1a87('0xc')](util[_0x1a87('0xd')](_0x1a87('0xe'),_0x1c91ad[_0x1a87('0x5')]),_0x1c91ad);utils[_0x1a87('0x3')](util[_0x1a87('0xd')](_0x1a87('0xf'),_0x1c91ad[_0x1a87('0x5')],_0x1c91ad[_0x1a87('0x10')],_0x1c91ad[_0x1a87('0x11')]));if(_0x1c91ad[_0x1a87('0x10')][_0x1a87('0x12')]()=='set'&&_[_0x1a87('0x13')](_0x1c91ad[_0x1a87('0x11')][_0x1a87('0x12')](),_0x1a87('0x14'))){var _0x1cdd0b=_0x1c91ad[_0x1a87('0x11')][_0x1a87('0x15')]('=');dials[_0x1c91ad[_0x1a87('0x5')]]={'routeId':_0x1cdd0b[0x1]};}}catch(_0x1f09c3){utils['error'](util[_0x1a87('0xd')]('[%s][dials][newexten]',_0x1c91ad[_0x1a87('0x5')]),_0x1f09c3);}};exports[_0x1a87('0x16')]=function(_0x78b659){try{utils[_0x1a87('0xc')](util[_0x1a87('0xd')]('[%s][dials][varset]',_0x78b659['uniqueid']),_0x78b659);if(!_[_0x1a87('0x17')](_0x78b659['variable'][_0x1a87('0x18')])){utils[_0x1a87('0x3')](util[_0x1a87('0xd')](_0x1a87('0x19'),_0x78b659[_0x1a87('0x5')],_0x78b659[_0x1a87('0x1a')]));dials[_0x78b659[_0x1a87('0x5')]]={'routeId':_0x78b659['value']};}}catch(_0x45d7dc){utils['error'](util[_0x1a87('0xd')](_0x1a87('0x1b'),_0x78b659[_0x1a87('0x5')]),_0x45d7dc);}};exports[_0x1a87('0x1c')]=function(_0x522e68){try{if(!_['isNil'](dials[_0x522e68['uniqueid']])){utils[_0x1a87('0xc')](util[_0x1a87('0xd')](_0x1a87('0x1d'),_0x522e68['uniqueid']),_0x522e68);dials[_0x522e68[_0x1a87('0x5')]]=_[_0x1a87('0x1e')](dials[_0x522e68['uniqueid']],_0x522e68);dials[_0x522e68['uniqueid']][_0x1a87('0x1f')]=utils[_0x1a87('0x20')]();dials[_0x522e68[_0x1a87('0x5')]][_0x1a87('0x21')]=_0x1a87('0x22');utils[_0x1a87('0x3')](util[_0x1a87('0xd')](_0x1a87('0x23'),_0x522e68[_0x1a87('0x5')],dials[_0x522e68['uniqueid']][_0x1a87('0x1f')]));}}catch(_0x4b6204){utils['error'](util[_0x1a87('0xd')](_0x1a87('0x1d'),_0x522e68[_0x1a87('0x5')]),_0x4b6204);}};exports[_0x1a87('0x24')]=function(_0x283ca1){try{if(!_[_0x1a87('0x17')](dials[_0x283ca1[_0x1a87('0x5')]])){utils['debug'](util[_0x1a87('0xd')](_0x1a87('0x25'),_0x283ca1[_0x1a87('0x5')]),_0x283ca1);dials[_0x283ca1[_0x1a87('0x5')]][_0x1a87('0x26')]=_0x283ca1[_0x1a87('0x26')];if(_0x283ca1[_0x1a87('0x26')]=='ANSWER'){dials[_0x283ca1[_0x1a87('0x5')]]=_[_0x1a87('0x1e')](dials[_0x283ca1[_0x1a87('0x5')]],_0x283ca1);dials[_0x283ca1['uniqueid']][_0x1a87('0x27')]=utils[_0x1a87('0x20')]();dials[_0x283ca1['uniqueid']][_0x1a87('0x21')]=_0x1a87('0x28');utils[_0x1a87('0x3')](util[_0x1a87('0xd')](_0x1a87('0x29'),_0x283ca1[_0x1a87('0x5')],_0x283ca1[_0x1a87('0x26')],dials[_0x283ca1[_0x1a87('0x5')]][_0x1a87('0x27')]));}else{utils['info'](util[_0x1a87('0xd')](_0x1a87('0x2a'),_0x283ca1[_0x1a87('0x5')],_0x283ca1[_0x1a87('0x26')]));}}}catch(_0x30a6a1){utils[_0x1a87('0x2b')](util[_0x1a87('0xd')](_0x1a87('0x25'),_0x283ca1[_0x1a87('0x5')]),_0x30a6a1);}};exports[_0x1a87('0x2c')]=function(_0x2878bd){try{if(!_[_0x1a87('0x17')](dials[_0x2878bd[_0x1a87('0x5')]])){utils[_0x1a87('0xc')](util[_0x1a87('0xd')](_0x1a87('0x2d'),_0x2878bd[_0x1a87('0x5')]),_0x2878bd);utils['info'](util['format'](_0x1a87('0x2e'),_0x2878bd[_0x1a87('0x5')],_0x2878bd[_0x1a87('0x2f')],_0x2878bd[_0x1a87('0x30')],_0x2878bd[_0x1a87('0x31')]));dials[_0x2878bd[_0x1a87('0x5')]]=_['assign'](dials[_0x2878bd[_0x1a87('0x5')]],{'endtime':utils['now'](),'lastevent':_0x1a87('0x32')});dials[_0x2878bd['uniqueid']]['duration']=utils[_0x1a87('0x33')](dials[_0x2878bd[_0x1a87('0x5')]]['endtime'],dials[_0x2878bd['uniqueid']]['starttime']);dials[_0x2878bd[_0x1a87('0x5')]][_0x1a87('0x34')]=utils['diffTime'](dials[_0x2878bd[_0x1a87('0x5')]][_0x1a87('0x27')]||dials[_0x2878bd['uniqueid']]['endtime'],dials[_0x2878bd[_0x1a87('0x5')]][_0x1a87('0x1f')]);dials[_0x2878bd[_0x1a87('0x5')]][_0x1a87('0x35')]=dials[_0x2878bd[_0x1a87('0x5')]][_0x1a87('0x27')]?utils[_0x1a87('0x33')](dials[_0x2878bd[_0x1a87('0x5')]][_0x1a87('0x36')],dials[_0x2878bd[_0x1a87('0x5')]]['answertime']):0x0;writeDB(dials[_0x2878bd[_0x1a87('0x5')]]);}}catch(_0x16b712){utils[_0x1a87('0x2b')](util[_0x1a87('0xd')](_0x1a87('0x2d'),_0x2878bd[_0x1a87('0x5')]),_0x16b712);}}; \ No newline at end of file +var _0x8fde=['[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridnum','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','connectedlinenum','dialstatus','request','debug','format','[%s][dials][newexten]','uniqueid'];(function(_0x38e39a,_0x57dcca){var _0x152c21=function(_0x4f0def){while(--_0x4f0def){_0x38e39a['push'](_0x38e39a['shift']());}};_0x152c21(++_0x57dcca);}(_0x8fde,0x159));var _0xe8fd=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8fde[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xe8fd('0x0'));var util=require('util');var utils=require(_0xe8fd('0x1'));var dials={};function writeDB(_0x2d5091){utils[_0xe8fd('0x2')](util['format'](_0xe8fd('0x3'),_0x2d5091['uniqueid'],_0x2d5091['channel'],_0x2d5091[_0xe8fd('0x4')],_0x2d5091['calleridnum'],_0x2d5091[_0xe8fd('0x5')],_0x2d5091[_0xe8fd('0x6')]));utils[_0xe8fd('0x7')]('CreateVoiceDialReport',_0x2d5091);delete dials[_0x2d5091['uniqueid']];}exports['newexten']=function(_0x3c0c52){try{utils[_0xe8fd('0x8')](util[_0xe8fd('0x9')](_0xe8fd('0xa'),_0x3c0c52[_0xe8fd('0xb')]),_0x3c0c52);utils[_0xe8fd('0x2')](util[_0xe8fd('0x9')](_0xe8fd('0xc'),_0x3c0c52['uniqueid'],_0x3c0c52[_0xe8fd('0xd')],_0x3c0c52[_0xe8fd('0xe')]));if(_0x3c0c52[_0xe8fd('0xd')]['toLowerCase']()==_0xe8fd('0xf')&&_[_0xe8fd('0x10')](_0x3c0c52[_0xe8fd('0xe')][_0xe8fd('0x11')](),_0xe8fd('0x12'))){var _0x14e821=_0x3c0c52[_0xe8fd('0xe')]['split']('=');dials[_0x3c0c52[_0xe8fd('0xb')]]={'routeId':_0x14e821[0x1]};}}catch(_0x5888e0){utils[_0xe8fd('0x13')](util[_0xe8fd('0x9')](_0xe8fd('0xa'),_0x3c0c52[_0xe8fd('0xb')]),_0x5888e0);}};exports[_0xe8fd('0x14')]=function(_0x450c34){try{utils[_0xe8fd('0x8')](util[_0xe8fd('0x9')](_0xe8fd('0x15'),_0x450c34[_0xe8fd('0xb')]),_0x450c34);if(!_['isNil'](_0x450c34[_0xe8fd('0x16')][_0xe8fd('0x17')])){utils[_0xe8fd('0x2')](util[_0xe8fd('0x9')](_0xe8fd('0x18'),_0x450c34[_0xe8fd('0xb')],_0x450c34[_0xe8fd('0x19')]));dials[_0x450c34['uniqueid']]={'routeId':_0x450c34['value']};}}catch(_0xdaf400){utils['error'](util[_0xe8fd('0x9')](_0xe8fd('0x15'),_0x450c34[_0xe8fd('0xb')]),_0xdaf400);}};exports[_0xe8fd('0x1a')]=function(_0x182f94){try{if(!_[_0xe8fd('0x1b')](dials[_0x182f94['uniqueid']])){utils[_0xe8fd('0x8')](util['format'](_0xe8fd('0x1c'),_0x182f94[_0xe8fd('0xb')]),_0x182f94);dials[_0x182f94['uniqueid']]=_['assign'](dials[_0x182f94[_0xe8fd('0xb')]],_0x182f94);dials[_0x182f94['uniqueid']][_0xe8fd('0x1d')]=utils[_0xe8fd('0x1e')]();dials[_0x182f94[_0xe8fd('0xb')]][_0xe8fd('0x1f')]=_0xe8fd('0x20');utils[_0xe8fd('0x2')](util[_0xe8fd('0x9')](_0xe8fd('0x21'),_0x182f94[_0xe8fd('0xb')],dials[_0x182f94[_0xe8fd('0xb')]][_0xe8fd('0x1d')]));}}catch(_0x54ed86){utils['error'](util[_0xe8fd('0x9')](_0xe8fd('0x1c'),_0x182f94['uniqueid']),_0x54ed86);}};exports[_0xe8fd('0x22')]=function(_0x386a06){try{if(!_[_0xe8fd('0x1b')](dials[_0x386a06['uniqueid']])){utils[_0xe8fd('0x8')](util[_0xe8fd('0x9')]('[%s][dials][dialend]',_0x386a06[_0xe8fd('0xb')]),_0x386a06);dials[_0x386a06[_0xe8fd('0xb')]][_0xe8fd('0x6')]=_0x386a06['dialstatus'];if(_0x386a06[_0xe8fd('0x6')]==_0xe8fd('0x23')){dials[_0x386a06[_0xe8fd('0xb')]]=_[_0xe8fd('0x24')](dials[_0x386a06[_0xe8fd('0xb')]],_0x386a06);dials[_0x386a06[_0xe8fd('0xb')]][_0xe8fd('0x25')]=utils[_0xe8fd('0x1e')]();dials[_0x386a06[_0xe8fd('0xb')]][_0xe8fd('0x1f')]=_0xe8fd('0x26');utils['info'](util[_0xe8fd('0x9')](_0xe8fd('0x27'),_0x386a06[_0xe8fd('0xb')],_0x386a06[_0xe8fd('0x6')],dials[_0x386a06['uniqueid']][_0xe8fd('0x25')]));}else{utils['info'](util[_0xe8fd('0x9')](_0xe8fd('0x28'),_0x386a06[_0xe8fd('0xb')],_0x386a06[_0xe8fd('0x6')]));}}}catch(_0x5a96ae){utils['error'](util['format']('[%s][dials][dialend]',_0x386a06[_0xe8fd('0xb')]),_0x5a96ae);}};exports[_0xe8fd('0x29')]=function(_0x3e2ea9){try{if(!_[_0xe8fd('0x1b')](dials[_0x3e2ea9['uniqueid']])){utils[_0xe8fd('0x8')](util[_0xe8fd('0x9')](_0xe8fd('0x2a'),_0x3e2ea9['uniqueid']),_0x3e2ea9);utils[_0xe8fd('0x2')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3e2ea9[_0xe8fd('0xb')],_0x3e2ea9[_0xe8fd('0x2b')],_0x3e2ea9[_0xe8fd('0x2c')],_0x3e2ea9['cause-txt']));dials[_0x3e2ea9[_0xe8fd('0xb')]]=_[_0xe8fd('0x24')](dials[_0x3e2ea9[_0xe8fd('0xb')]],{'endtime':utils['now'](),'lastevent':_0xe8fd('0x2d')});dials[_0x3e2ea9[_0xe8fd('0xb')]][_0xe8fd('0x2e')]=utils[_0xe8fd('0x2f')](dials[_0x3e2ea9[_0xe8fd('0xb')]][_0xe8fd('0x30')],dials[_0x3e2ea9[_0xe8fd('0xb')]][_0xe8fd('0x1d')]);dials[_0x3e2ea9[_0xe8fd('0xb')]][_0xe8fd('0x31')]=utils[_0xe8fd('0x2f')](dials[_0x3e2ea9[_0xe8fd('0xb')]][_0xe8fd('0x25')]||dials[_0x3e2ea9[_0xe8fd('0xb')]][_0xe8fd('0x30')],dials[_0x3e2ea9['uniqueid']][_0xe8fd('0x1d')]);dials[_0x3e2ea9['uniqueid']][_0xe8fd('0x32')]=dials[_0x3e2ea9[_0xe8fd('0xb')]]['answertime']?utils[_0xe8fd('0x2f')](dials[_0x3e2ea9[_0xe8fd('0xb')]]['endtime'],dials[_0x3e2ea9['uniqueid']][_0xe8fd('0x25')]):0x0;writeDB(dials[_0x3e2ea9[_0xe8fd('0xb')]]);}}catch(_0x29cc6d){utils[_0xe8fd('0x13')](util[_0xe8fd('0x9')](_0xe8fd('0x2a'),_0x3e2ea9[_0xe8fd('0xb')]),_0x29cc6d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ab5c827..d88ff1e 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 _0xb02d=['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','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','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]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','port','asterisk','username','password','keepConnected'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb02d,0xca));var _0xdb02=function(_0x19287f,_0x131638){_0x19287f=_0x19287f-0x0;var _0xd2ad20=_0xb02d[_0x19287f];return _0xd2ad20;};var AsteriskManager=require(_0xdb02('0x0'));var config=require(_0xdb02('0x1'));var utils=require(_0xdb02('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0xdb02('0x3')],config['asterisk']['ip'],config[_0xdb02('0x4')][_0xdb02('0x5')],config[_0xdb02('0x4')][_0xdb02('0x6')],!![]);ami[_0xdb02('0x7')]();if(config[_0xdb02('0x8')]&&config[_0xdb02('0x8')][_0xdb02('0x9')]){utils[_0xdb02('0xa')](_0xdb02('0xb'));}else{var agents=require(_0xdb02('0xc'));var calls=require(_0xdb02('0xd'));var queues=require(_0xdb02('0xe'));var recordings=require(_0xdb02('0xf'));var members=require(_0xdb02('0x10'));var dials=require(_0xdb02('0x11'));var transfers=require(_0xdb02('0x12'));var core=require(_0xdb02('0x13'));ami['on'](_0xdb02('0x14'),core[_0xdb02('0x14')]);ami['on'](_0xdb02('0x15'),core[_0xdb02('0x15')]);ami['on'](_0xdb02('0x16'),core[_0xdb02('0x16')]);ami['on'](_0xdb02('0x17'),core[_0xdb02('0x17')]);ami['on'](_0xdb02('0x18'),core['close']);ami['on'](_0xdb02('0x19'),core[_0xdb02('0x19')]);ami['on'](_0xdb02('0x1a'),function(_0x5a2821){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x1d'),_0x5a2821[_0xdb02('0x1e')]),_0x5a2821);members[_0xdb02('0x1a')](_0x5a2821);}catch(_0x269108){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')]('[%s][index][devicestatechange]',_0x5a2821['device']),_0x269108);}});ami['on'](_0xdb02('0x1f'),function(_0x37a5ba){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')]('[%s][index][agentcalled]',_0x37a5ba[_0xdb02('0x20')]),_0x37a5ba);agents[_0xdb02('0x1f')](_0x37a5ba);}catch(_0x58f92f){utils['error'](util['format'](_0xdb02('0x21'),_0x37a5ba['uniqueid']),_0x58f92f);}});ami['on'](_0xdb02('0x22'),function(_0x534091){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x23'),_0x534091[_0xdb02('0x20')]),_0x534091);agents[_0xdb02('0x22')](_0x534091);}catch(_0x20feef){utils['error'](util['format'](_0xdb02('0x23'),_0x534091[_0xdb02('0x20')]),_0x20feef);}});ami['on'](_0xdb02('0x24'),function(_0x295fa6){try{utils['debug'](util[_0xdb02('0x1c')](_0xdb02('0x25'),_0x295fa6[_0xdb02('0x20')]),_0x295fa6);agents[_0xdb02('0x24')](_0x295fa6);queues[_0xdb02('0x24')](_0x295fa6);}catch(_0x25d643){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')](_0xdb02('0x25'),_0x295fa6[_0xdb02('0x20')]),_0x25d643);}});ami['on'](_0xdb02('0x26'),function(_0x479a9c){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x27'),_0x479a9c['uniqueid']),_0x479a9c);agents[_0xdb02('0x26')](_0x479a9c);queues['agentcomplete'](_0x479a9c);members[_0xdb02('0x26')](_0x479a9c);}catch(_0x1e65ee){utils['error'](util[_0xdb02('0x1c')](_0xdb02('0x27'),_0x479a9c[_0xdb02('0x20')]),_0x1e65ee);}});ami['on'](_0xdb02('0x28'),function(_0xb0e7e){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x29'),_0xb0e7e[_0xdb02('0x20')]),_0xb0e7e);agents[_0xdb02('0x28')](_0xb0e7e);queues['queuecallerabandon'](_0xb0e7e);}catch(_0x45e624){utils['error'](util[_0xdb02('0x1c')](_0xdb02('0x29'),_0xb0e7e['uniqueid']),_0x45e624);}});ami['on'](_0xdb02('0x2a'),function(_0x5eb511){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x2b'),_0x5eb511[_0xdb02('0x20')]),_0x5eb511);queues[_0xdb02('0x2a')](_0x5eb511);recordings[_0xdb02('0x2a')](_0x5eb511);}catch(_0xc4d880){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')](_0xdb02('0x2b'),_0x5eb511[_0xdb02('0x20')]),_0xc4d880);}});ami['on'](_0xdb02('0x2c'),function(_0x184199){try{utils['debug'](util[_0xdb02('0x1c')](_0xdb02('0x2d'),_0x184199[_0xdb02('0x20')]),_0x184199);queues['queuecallerleave'](_0x184199);}catch(_0x3ce49e){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')](_0xdb02('0x2d'),_0x184199[_0xdb02('0x20')]),_0x3ce49e);}});ami['on']('musiconholdstart',function(_0x4bd970){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x2e'),_0x4bd970[_0xdb02('0x20')]),_0x4bd970);queues[_0xdb02('0x2f')](_0x4bd970);calls[_0xdb02('0x2f')](_0x4bd970);}catch(_0x2039bb){utils[_0xdb02('0x17')](util['format'](_0xdb02('0x2e'),_0x4bd970[_0xdb02('0x20')]),_0x2039bb);}});ami['on'](_0xdb02('0x30'),function(_0x451b09){try{utils[_0xdb02('0x1b')](util['format'](_0xdb02('0x31'),_0x451b09[_0xdb02('0x20')]),_0x451b09);queues['musiconholdstop'](_0x451b09);calls[_0xdb02('0x30')](_0x451b09);}catch(_0x37dd96){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')]('[%s][index][musiconholdstop]',_0x451b09[_0xdb02('0x20')]),_0x37dd96);}});ami['on'](_0xdb02('0x32'),function(_0xabbea4){try{utils[_0xdb02('0x1b')](util['format']('[%s][index][newstate]',_0xabbea4[_0xdb02('0x20')]),_0xabbea4);calls[_0xdb02('0x32')](_0xabbea4);recordings[_0xdb02('0x32')](_0xabbea4);}catch(_0x158683){utils['error'](util[_0xdb02('0x1c')]('[%s][index][newstate]',_0xabbea4[_0xdb02('0x20')]),_0x158683);}});ami['on'](_0xdb02('0x33'),function(_0x38ebbb){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x34'),_0x38ebbb[_0xdb02('0x20')]),_0x38ebbb);calls[_0xdb02('0x33')](_0x38ebbb);recordings[_0xdb02('0x33')](_0x38ebbb);dials[_0xdb02('0x33')](_0x38ebbb);agents['hangup'](_0x38ebbb);queues[_0xdb02('0x33')](_0x38ebbb);}catch(_0x4bf7d8){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')]('[%s][index][hangup]',_0x38ebbb['uniqueid']),_0x4bf7d8);}});ami['on'](_0xdb02('0x35'),function(_0x2fe180){try{utils['debug'](util[_0xdb02('0x1c')](_0xdb02('0x36'),_0x2fe180['uniqueid']),_0x2fe180);members[_0xdb02('0x35')](_0x2fe180);}catch(_0x352675){utils['error'](util[_0xdb02('0x1c')](_0xdb02('0x36'),_0x2fe180[_0xdb02('0x20')]),_0x352675);}});ami['on'](_0xdb02('0x37'),function(_0x209777){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')](_0xdb02('0x38'),_0x209777['uniqueid']),_0x209777);queues[_0xdb02('0x37')](_0x209777);agents['blindtransfer'](_0x209777);transfers[_0xdb02('0x37')](_0x209777);}catch(_0x5ec2c9){utils[_0xdb02('0x17')](util['format'](_0xdb02('0x38'),_0x209777[_0xdb02('0x20')]),_0x5ec2c9);}});ami['on'](_0xdb02('0x39'),function(_0x4bdebf){try{utils[_0xdb02('0x1b')](util['format'](_0xdb02('0x3a'),_0x4bdebf[_0xdb02('0x3b')]),_0x4bdebf);queues[_0xdb02('0x39')](_0x4bdebf);transfers[_0xdb02('0x39')](_0x4bdebf);agents[_0xdb02('0x39')](_0x4bdebf);calls[_0xdb02('0x39')](_0x4bdebf);}catch(_0x497928){utils['error'](util[_0xdb02('0x1c')](_0xdb02('0x3a'),_0x4bdebf[_0xdb02('0x3b')]),_0x497928);}});ami['on'](_0xdb02('0x3c'),function(_0xe41f79){try{utils['debug'](util[_0xdb02('0x1c')]('[%s][index][varset]',_0xe41f79['uniqueid']),_0xe41f79);queues[_0xdb02('0x3c')](_0xe41f79);recordings[_0xdb02('0x3c')](_0xe41f79);calls['varset'](_0xe41f79);dials['varset'](_0xe41f79);}catch(_0xf50e95){utils['error'](util[_0xdb02('0x1c')](_0xdb02('0x3d'),_0xe41f79[_0xdb02('0x20')]),_0xf50e95);}});ami['on'](_0xdb02('0x3e'),function(_0x2cd87f){try{utils[_0xdb02('0x1b')](util['format'](_0xdb02('0x3f'),_0x2cd87f[_0xdb02('0x20')]),_0x2cd87f);calls[_0xdb02('0x3e')](_0x2cd87f);recordings[_0xdb02('0x3e')](_0x2cd87f);dials[_0xdb02('0x3e')](_0x2cd87f);}catch(_0x377a33){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')](_0xdb02('0x3f'),_0x2cd87f[_0xdb02('0x20')]),_0x377a33);}});ami['on'](_0xdb02('0x40'),function(_0x4780c4){try{utils['debug'](util['format'](_0xdb02('0x41'),_0x4780c4[_0xdb02('0x20')]),_0x4780c4);calls['newchannel'](_0x4780c4);recordings[_0xdb02('0x40')](_0x4780c4);}catch(_0x2b244c){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')](_0xdb02('0x41'),_0x4780c4[_0xdb02('0x20')]),_0x2b244c);}});ami['on'](_0xdb02('0x42'),function(_0x5c90d3){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x5c90d3[_0xdb02('0x20')]),_0x5c90d3);dials[_0xdb02('0x42')](_0x5c90d3);}catch(_0x4f35cf){utils['error'](util[_0xdb02('0x1c')](_0xdb02('0x43'),_0x5c90d3[_0xdb02('0x20')]),_0x4f35cf);}});ami['on'](_0xdb02('0x44'),function(_0x4d1665){try{utils[_0xdb02('0x1b')](util[_0xdb02('0x1c')]('[%s][index][dialend]',_0x4d1665[_0xdb02('0x20')]),_0x4d1665);dials[_0xdb02('0x44')](_0x4d1665);}catch(_0x59c8c0){utils[_0xdb02('0x17')](util[_0xdb02('0x1c')](_0xdb02('0x45'),_0x4d1665['uniqueid']),_0x59c8c0);}});} \ No newline at end of file +var _0x7376=['[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart'];(function(_0x12d2d7,_0x253ea8){var _0x1defcb=function(_0x4d42e4){while(--_0x4d42e4){_0x12d2d7['push'](_0x12d2d7['shift']());}};_0x1defcb(++_0x253ea8);}(_0x7376,0x1f4));var _0x6737=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x7376[_0x12fc8d];return _0x3f9d04;};var AsteriskManager=require(_0x6737('0x0'));var config=require(_0x6737('0x1'));var utils=require(_0x6737('0x2'));var util=require(_0x6737('0x3'));var ami=new AsteriskManager(config[_0x6737('0x4')][_0x6737('0x5')],config[_0x6737('0x4')]['ip'],config[_0x6737('0x4')]['username'],config[_0x6737('0x4')][_0x6737('0x6')],!![]);ami[_0x6737('0x7')]();if(config[_0x6737('0x8')]&&config[_0x6737('0x8')][_0x6737('0x9')]){utils[_0x6737('0xa')](_0x6737('0xb'));}else{var agents=require(_0x6737('0xc'));var calls=require(_0x6737('0xd'));var queues=require(_0x6737('0xe'));var recordings=require(_0x6737('0xf'));var members=require(_0x6737('0x10'));var dials=require(_0x6737('0x11'));var transfers=require('./transfers.controller');var core=require(_0x6737('0x12'));ami['on']('connect',core['connect']);ami['on'](_0x6737('0x13'),core['shutdown']);ami['on']('fullybooted',core[_0x6737('0x14')]);ami['on']('error',core[_0x6737('0x15')]);ami['on'](_0x6737('0x16'),core[_0x6737('0x16')]);ami['on'](_0x6737('0x17'),core[_0x6737('0x17')]);ami['on'](_0x6737('0x18'),function(_0x2103b7){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')]('[%s][index][devicestatechange]',_0x2103b7[_0x6737('0x1b')]),_0x2103b7);members[_0x6737('0x18')](_0x2103b7);}catch(_0x279a6d){utils['error'](util[_0x6737('0x1a')]('[%s][index][devicestatechange]',_0x2103b7[_0x6737('0x1b')]),_0x279a6d);}});ami['on'](_0x6737('0x1c'),function(_0x2f80c0){try{utils[_0x6737('0x19')](util['format'](_0x6737('0x1d'),_0x2f80c0['uniqueid']),_0x2f80c0);agents[_0x6737('0x1c')](_0x2f80c0);}catch(_0x1ab3ea){utils[_0x6737('0x15')](util['format']('[%s][index][agentcalled]',_0x2f80c0[_0x6737('0x1e')]),_0x1ab3ea);}});ami['on'](_0x6737('0x1f'),function(_0x37a2b1){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')]('[%s][index][agentringnoanswer]',_0x37a2b1[_0x6737('0x1e')]),_0x37a2b1);agents[_0x6737('0x1f')](_0x37a2b1);}catch(_0x30f985){utils[_0x6737('0x15')](util['format'](_0x6737('0x20'),_0x37a2b1[_0x6737('0x1e')]),_0x30f985);}});ami['on'](_0x6737('0x21'),function(_0x3f3c42){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')]('[%s][index][agentconnect]',_0x3f3c42[_0x6737('0x1e')]),_0x3f3c42);agents['agentconnect'](_0x3f3c42);queues[_0x6737('0x21')](_0x3f3c42);}catch(_0x3da2f0){utils[_0x6737('0x15')](util['format'](_0x6737('0x22'),_0x3f3c42['uniqueid']),_0x3da2f0);}});ami['on'](_0x6737('0x23'),function(_0x50a6b7){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')]('[%s][index][agentcomplete]',_0x50a6b7['uniqueid']),_0x50a6b7);agents[_0x6737('0x23')](_0x50a6b7);queues[_0x6737('0x23')](_0x50a6b7);members[_0x6737('0x23')](_0x50a6b7);}catch(_0x2d0c30){utils[_0x6737('0x15')](util[_0x6737('0x1a')](_0x6737('0x24'),_0x50a6b7[_0x6737('0x1e')]),_0x2d0c30);}});ami['on']('queuecallerabandon',function(_0x1bbf81){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')](_0x6737('0x25'),_0x1bbf81[_0x6737('0x1e')]),_0x1bbf81);agents['queuecallerabandon'](_0x1bbf81);queues[_0x6737('0x26')](_0x1bbf81);}catch(_0x1f50f1){utils[_0x6737('0x15')](util[_0x6737('0x1a')](_0x6737('0x25'),_0x1bbf81[_0x6737('0x1e')]),_0x1f50f1);}});ami['on'](_0x6737('0x27'),function(_0x2e4e1e){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')](_0x6737('0x28'),_0x2e4e1e['uniqueid']),_0x2e4e1e);queues[_0x6737('0x27')](_0x2e4e1e);recordings[_0x6737('0x27')](_0x2e4e1e);}catch(_0x105070){utils['error'](util[_0x6737('0x1a')]('[%s][index][queuecallerjoin]',_0x2e4e1e['uniqueid']),_0x105070);}});ami['on']('queuecallerleave',function(_0x4c6adb){try{utils['debug'](util['format'](_0x6737('0x29'),_0x4c6adb['uniqueid']),_0x4c6adb);queues[_0x6737('0x2a')](_0x4c6adb);}catch(_0x2a6def){utils[_0x6737('0x15')](util[_0x6737('0x1a')](_0x6737('0x29'),_0x4c6adb[_0x6737('0x1e')]),_0x2a6def);}});ami['on'](_0x6737('0x2b'),function(_0x2a5f93){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')](_0x6737('0x2c'),_0x2a5f93[_0x6737('0x1e')]),_0x2a5f93);queues[_0x6737('0x2b')](_0x2a5f93);calls[_0x6737('0x2b')](_0x2a5f93);}catch(_0x11fed5){utils[_0x6737('0x15')](util[_0x6737('0x1a')]('[%s][index][musiconholdstart]',_0x2a5f93[_0x6737('0x1e')]),_0x11fed5);}});ami['on']('musiconholdstop',function(_0x2f0fc1){try{utils['debug'](util['format'](_0x6737('0x2d'),_0x2f0fc1[_0x6737('0x1e')]),_0x2f0fc1);queues[_0x6737('0x2e')](_0x2f0fc1);calls[_0x6737('0x2e')](_0x2f0fc1);}catch(_0x3d8281){utils['error'](util[_0x6737('0x1a')](_0x6737('0x2d'),_0x2f0fc1['uniqueid']),_0x3d8281);}});ami['on'](_0x6737('0x2f'),function(_0xa868be){try{utils[_0x6737('0x19')](util['format'](_0x6737('0x30'),_0xa868be[_0x6737('0x1e')]),_0xa868be);calls[_0x6737('0x2f')](_0xa868be);recordings['newstate'](_0xa868be);}catch(_0xb1541a){utils['error'](util[_0x6737('0x1a')](_0x6737('0x30'),_0xa868be[_0x6737('0x1e')]),_0xb1541a);}});ami['on'](_0x6737('0x31'),function(_0x4c0bf0){try{utils['debug'](util[_0x6737('0x1a')](_0x6737('0x32'),_0x4c0bf0['uniqueid']),_0x4c0bf0);calls[_0x6737('0x31')](_0x4c0bf0);recordings[_0x6737('0x31')](_0x4c0bf0);dials[_0x6737('0x31')](_0x4c0bf0);agents[_0x6737('0x31')](_0x4c0bf0);queues[_0x6737('0x31')](_0x4c0bf0);}catch(_0x4073c3){utils[_0x6737('0x15')](util['format'](_0x6737('0x32'),_0x4c0bf0[_0x6737('0x1e')]),_0x4073c3);}});ami['on'](_0x6737('0x33'),function(_0x20d4f8){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')](_0x6737('0x34'),_0x20d4f8[_0x6737('0x1e')]),_0x20d4f8);members[_0x6737('0x33')](_0x20d4f8);}catch(_0x2ce5e9){utils[_0x6737('0x15')](util[_0x6737('0x1a')]('[%s][index][cdr]',_0x20d4f8['uniqueid']),_0x2ce5e9);}});ami['on']('blindtransfer',function(_0x46231e){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')](_0x6737('0x35'),_0x46231e['uniqueid']),_0x46231e);queues['blindtransfer'](_0x46231e);agents[_0x6737('0x36')](_0x46231e);transfers[_0x6737('0x36')](_0x46231e);}catch(_0x14104c){utils['error'](util['format'](_0x6737('0x35'),_0x46231e[_0x6737('0x1e')]),_0x14104c);}});ami['on']('attendedtransfer',function(_0x476704){try{utils['debug'](util[_0x6737('0x1a')](_0x6737('0x37'),_0x476704['origtransfereruniqueid']),_0x476704);queues[_0x6737('0x38')](_0x476704);transfers[_0x6737('0x38')](_0x476704);agents[_0x6737('0x38')](_0x476704);calls['attendedtransfer'](_0x476704);}catch(_0x4b79a6){utils[_0x6737('0x15')](util[_0x6737('0x1a')](_0x6737('0x37'),_0x476704[_0x6737('0x39')]),_0x4b79a6);}});ami['on'](_0x6737('0x3a'),function(_0x53ab32){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')](_0x6737('0x3b'),_0x53ab32[_0x6737('0x1e')]),_0x53ab32);queues['varset'](_0x53ab32);recordings[_0x6737('0x3a')](_0x53ab32);calls[_0x6737('0x3a')](_0x53ab32);dials[_0x6737('0x3a')](_0x53ab32);}catch(_0x5b2239){utils[_0x6737('0x15')](util[_0x6737('0x1a')](_0x6737('0x3b'),_0x53ab32[_0x6737('0x1e')]),_0x5b2239);}});ami['on']('newexten',function(_0x15a73e){try{utils['debug'](util[_0x6737('0x1a')](_0x6737('0x3c'),_0x15a73e[_0x6737('0x1e')]),_0x15a73e);calls['newexten'](_0x15a73e);recordings['newexten'](_0x15a73e);dials[_0x6737('0x3d')](_0x15a73e);}catch(_0x20fc13){utils[_0x6737('0x15')](util[_0x6737('0x1a')](_0x6737('0x3c'),_0x15a73e[_0x6737('0x1e')]),_0x20fc13);}});ami['on'](_0x6737('0x3e'),function(_0x346982){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')]('[%s][index][newchannel]',_0x346982['uniqueid']),_0x346982);calls[_0x6737('0x3e')](_0x346982);recordings[_0x6737('0x3e')](_0x346982);}catch(_0x37c49c){utils['error'](util[_0x6737('0x1a')](_0x6737('0x3f'),_0x346982[_0x6737('0x1e')]),_0x37c49c);}});ami['on'](_0x6737('0x40'),function(_0x5000c2){try{utils[_0x6737('0x19')](util[_0x6737('0x1a')](_0x6737('0x41'),_0x5000c2[_0x6737('0x1e')]),_0x5000c2);dials['dialbegin'](_0x5000c2);}catch(_0x16ed95){utils['error'](util['format'](_0x6737('0x42'),_0x5000c2[_0x6737('0x1e')]),_0x16ed95);}});ami['on'](_0x6737('0x43'),function(_0x3df743){try{utils['debug'](util[_0x6737('0x1a')]('[%s][index][dialend]',_0x3df743[_0x6737('0x1e')]),_0x3df743);dials['dialend'](_0x3df743);}catch(_0x2c0be3){utils['error'](util[_0x6737('0x1a')]('[%s][index][dialend]',_0x3df743['uniqueid']),_0x2c0be3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ebdac1d..c353235 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 _0xe4ec=['exitAt','enterAt','error','agentcomplete','debug','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','type','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','then','name','CreateMemberReport','getUserByName','split','internal','request','catch','[%s][members][writeDB]','some','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','duration','diffTime'];(function(_0x38c0ed,_0x32c459){var _0xc859db=function(_0x448760){while(--_0x448760){_0x38c0ed['push'](_0x38c0ed['shift']());}};_0xc859db(++_0x32c459);}(_0xe4ec,0x11c));var _0xce4e=function(_0x3493c8,_0x43a74a){_0x3493c8=_0x3493c8-0x0;var _0x3c72a8=_0xe4ec[_0x3493c8];return _0x3c72a8;};'use strict';var _=require('lodash');var util=require(_0xce4e('0x0'));var utils=require('./utils');var members={};var exclude=[_0xce4e('0x1'),_0xce4e('0x2')];function writeDB(_0x3af39a){utils['info'](util[_0xce4e('0x3')](_0xce4e('0x4'),_0x3af39a[_0xce4e('0x5')],_0x3af39a[_0xce4e('0x6')],_0x3af39a[_0xce4e('0x7')],_0x3af39a[_0xce4e('0x8')],_0x3af39a[_0xce4e('0x9')],_0x3af39a['type']));if(_0x3af39a[_0xce4e('0x6')]){utils['getUserByInterface'](_0x3af39a['interface'])[_0xce4e('0xa')](function(_0x371a0c){if(_0x371a0c){_0x3af39a[_0xce4e('0x9')]=_0x371a0c[_0xce4e('0xb')];_0x3af39a['internal']=_0x371a0c['internal'];utils['request'](_0xce4e('0xc'),_0x3af39a);}else{utils[_0xce4e('0xd')](_0x3af39a[_0xce4e('0x6')][_0xce4e('0xe')]('/')[0x1])[_0xce4e('0xa')](function(_0x22d4f4){if(_0x22d4f4){_0x3af39a[_0xce4e('0x9')]=_0x22d4f4[_0xce4e('0xb')];_0x3af39a['internal']=_0x22d4f4[_0xce4e('0xf')];utils[_0xce4e('0x10')](_0xce4e('0xc'),_0x3af39a);}});}})[_0xce4e('0x11')](function(_0x5f24f9){utils['error'](util[_0xce4e('0x3')](_0xce4e('0x12'),_0x3af39a[_0xce4e('0x5')]),_0x5f24f9);});}delete members[_0x3af39a['interface']];}function startsWith(_0x5c2890,_0x813e7e){return _[_0xce4e('0x13')](_0x5c2890,function(_0x1eeac2){return _['startsWith'](_0x813e7e,_0x1eeac2);});}exports[_0xce4e('0x14')]=function(_0x492e96){try{utils['debug'](util['format'](_0xce4e('0x15'),members[_0x492e96[_0xce4e('0x16')]]?members[_0x492e96[_0xce4e('0x16')]]['uniqueid']:_0x492e96[_0xce4e('0x16')]),_0x492e96);utils['info'](util['format'](_0xce4e('0x17'),members[_0x492e96[_0xce4e('0x16')]]?members[_0x492e96[_0xce4e('0x16')]]['uniqueid']:_0x492e96[_0xce4e('0x16')],_0x492e96[_0xce4e('0x18')],_0x492e96[_0xce4e('0x16')]));switch(_0x492e96[_0xce4e('0x18')]){case _0xce4e('0x19'):case _0xce4e('0x1a'):if(!startsWith(exclude,_0x492e96['device'])){members[_0x492e96['device']]={'channel':_0xce4e('0x1b'),'interface':_0x492e96[_0xce4e('0x16')],'type':_0xce4e('0x1c'),'enterAt':utils[_0xce4e('0x1d')](),'role':'agent'};}break;case _0xce4e('0x1e'):if(!_[_0xce4e('0x1f')](members[_0x492e96[_0xce4e('0x16')]])){members[_0x492e96[_0xce4e('0x16')]]['exitAt']=utils[_0xce4e('0x1d')]();members[_0x492e96[_0xce4e('0x16')]][_0xce4e('0x20')]=utils[_0xce4e('0x21')](members[_0x492e96[_0xce4e('0x16')]][_0xce4e('0x22')],members[_0x492e96[_0xce4e('0x16')]][_0xce4e('0x23')]);if(members[_0x492e96['device']][_0xce4e('0x5')]){writeDB(members[_0x492e96[_0xce4e('0x16')]]);}}break;default:break;}}catch(_0x3219bc){utils[_0xce4e('0x24')](util['format']('[%s][members][devicestatechange]',members[_0x492e96[_0xce4e('0x16')]]?members[_0x492e96[_0xce4e('0x16')]][_0xce4e('0x5')]:_0x492e96[_0xce4e('0x16')]),_0x3219bc);}};exports[_0xce4e('0x25')]=function(_0x1b53b1){try{if(!_[_0xce4e('0x1f')](members[_0x1b53b1[_0xce4e('0x6')]])){utils[_0xce4e('0x26')](util[_0xce4e('0x3')]('[%s][members][agentcomplete]',_0x1b53b1[_0xce4e('0x5')]),_0x1b53b1);utils[_0xce4e('0x27')](util[_0xce4e('0x3')](_0xce4e('0x28'),_0x1b53b1[_0xce4e('0x5')],_0x1b53b1[_0xce4e('0x6')],_0x1b53b1[_0xce4e('0x29')]));members[_0x1b53b1[_0xce4e('0x6')]]=_[_0xce4e('0x2a')](members[_0x1b53b1[_0xce4e('0x6')]],{'data4':_0x1b53b1[_0xce4e('0x29')],'uniqueid':_0x1b53b1['uniqueid']});}}catch(_0x3f46f9){utils['error'](util[_0xce4e('0x3')](_0xce4e('0x2b'),_0x1b53b1[_0xce4e('0x5')]),_0x3f46f9);}};exports[_0xce4e('0x2c')]=function(_0x4321e9){try{utils['debug'](util[_0xce4e('0x3')](_0xce4e('0x2d'),_0x4321e9[_0xce4e('0x5')]),_0x4321e9);if(_0x4321e9['channel']){var _0x1fbb38=_0x4321e9[_0xce4e('0x7')][_0xce4e('0xe')]('-')[0x0];if(!_[_0xce4e('0x1f')](members[_0x1fbb38])){members[_0x1fbb38]=_[_0xce4e('0x2a')](members[_0x1fbb38],{'data1':members[_0x1fbb38][_0xce4e('0x2e')]||_0x4321e9[_0xce4e('0x2f')],'data2':members[_0x1fbb38]['data2']||_0x4321e9[_0xce4e('0x30')],'data3':members[_0x1fbb38][_0xce4e('0x31')]||_0x4321e9['destination'],'uniqueid':members[_0x1fbb38][_0xce4e('0x5')]||_0x4321e9[_0xce4e('0x5')]});utils['info'](util[_0xce4e('0x3')](_0xce4e('0x32'),_0x4321e9[_0xce4e('0x5')],members[_0x1fbb38][_0xce4e('0x2e')],members[_0x1fbb38][_0xce4e('0x8')],members[_0x1fbb38][_0xce4e('0x31')]));if(members[_0x1fbb38][_0xce4e('0x22')]){writeDB(members[_0x1fbb38]);}}}if(_0x4321e9['destinationchannel']){var _0x3fd094=_0x4321e9[_0xce4e('0x33')][_0xce4e('0xe')]('-')[0x0];if(!_['isNil'](members[_0x3fd094])){members[_0x3fd094]=_[_0xce4e('0x2a')](members[_0x3fd094],{'data1':members[_0x3fd094]['data1']||_0x4321e9[_0xce4e('0x2f')],'data2':members[_0x3fd094][_0xce4e('0x8')]||_0x4321e9[_0xce4e('0x30')],'data3':members[_0x3fd094][_0xce4e('0x31')]||_0x4321e9[_0xce4e('0x34')],'uniqueid':members[_0x3fd094]['uniqueid']||_0x4321e9[_0xce4e('0x5')]});utils['info'](util[_0xce4e('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4321e9[_0xce4e('0x5')],members[_0x3fd094][_0xce4e('0x2e')],members[_0x3fd094][_0xce4e('0x8')],members[_0x3fd094][_0xce4e('0x31')]));if(members[_0x3fd094][_0xce4e('0x22')]){writeDB(members[_0x3fd094]);}}}}catch(_0x3f08ca){utils['error'](util[_0xce4e('0x3')](_0xce4e('0x2d'),_0x4321e9[_0xce4e('0x5')]),_0x3f08ca);}}; \ No newline at end of file +var _0x5e57=['info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','split','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','error','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5e57,0x170));var _0x75e5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5e57[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x75e5('0x0'));var util=require('util');var utils=require(_0x75e5('0x1'));var members={};var exclude=[_0x75e5('0x2'),'Queue:'];function writeDB(_0x3f87ea){utils[_0x75e5('0x3')](util['format'](_0x75e5('0x4'),_0x3f87ea[_0x75e5('0x5')],_0x3f87ea[_0x75e5('0x6')],_0x3f87ea[_0x75e5('0x7')],_0x3f87ea[_0x75e5('0x8')],_0x3f87ea[_0x75e5('0x9')],_0x3f87ea[_0x75e5('0xa')]));if(_0x3f87ea[_0x75e5('0x6')]){utils['getUserByInterface'](_0x3f87ea[_0x75e5('0x6')])[_0x75e5('0xb')](function(_0x9f50b7){if(_0x9f50b7){_0x3f87ea['membername']=_0x9f50b7[_0x75e5('0xc')];_0x3f87ea[_0x75e5('0xd')]=_0x9f50b7[_0x75e5('0xd')];utils[_0x75e5('0xe')](_0x75e5('0xf'),_0x3f87ea);}else{utils[_0x75e5('0x10')](_0x3f87ea[_0x75e5('0x6')][_0x75e5('0x11')]('/')[0x1])[_0x75e5('0xb')](function(_0x3c55e6){if(_0x3c55e6){_0x3f87ea[_0x75e5('0x9')]=_0x3c55e6[_0x75e5('0xc')];_0x3f87ea[_0x75e5('0xd')]=_0x3c55e6['internal'];utils[_0x75e5('0xe')](_0x75e5('0xf'),_0x3f87ea);}});}})['catch'](function(_0x208eab){utils['error'](util[_0x75e5('0x12')](_0x75e5('0x13'),_0x3f87ea[_0x75e5('0x5')]),_0x208eab);});}delete members[_0x3f87ea[_0x75e5('0x6')]];}function startsWith(_0x3e834f,_0x64e0f7){return _[_0x75e5('0x14')](_0x3e834f,function(_0x7b1183){return _[_0x75e5('0x15')](_0x64e0f7,_0x7b1183);});}exports[_0x75e5('0x16')]=function(_0x3da21a){try{utils['debug'](util[_0x75e5('0x12')](_0x75e5('0x17'),members[_0x3da21a[_0x75e5('0x18')]]?members[_0x3da21a['device']]['uniqueid']:_0x3da21a['device']),_0x3da21a);utils[_0x75e5('0x3')](util[_0x75e5('0x12')](_0x75e5('0x19'),members[_0x3da21a[_0x75e5('0x18')]]?members[_0x3da21a[_0x75e5('0x18')]][_0x75e5('0x5')]:_0x3da21a[_0x75e5('0x18')],_0x3da21a[_0x75e5('0x1a')],_0x3da21a[_0x75e5('0x18')]));switch(_0x3da21a['state']){case _0x75e5('0x1b'):case _0x75e5('0x1c'):if(!startsWith(exclude,_0x3da21a[_0x75e5('0x18')])){members[_0x3da21a[_0x75e5('0x18')]]={'channel':_0x75e5('0x1d'),'interface':_0x3da21a[_0x75e5('0x18')],'type':'TALKING','enterAt':utils[_0x75e5('0x1e')](),'role':_0x75e5('0x1f')};}break;case _0x75e5('0x20'):if(!_['isNil'](members[_0x3da21a[_0x75e5('0x18')]])){members[_0x3da21a['device']][_0x75e5('0x21')]=utils[_0x75e5('0x1e')]();members[_0x3da21a[_0x75e5('0x18')]][_0x75e5('0x22')]=utils[_0x75e5('0x23')](members[_0x3da21a['device']][_0x75e5('0x21')],members[_0x3da21a[_0x75e5('0x18')]][_0x75e5('0x24')]);if(members[_0x3da21a[_0x75e5('0x18')]][_0x75e5('0x5')]){writeDB(members[_0x3da21a[_0x75e5('0x18')]]);}}break;default:break;}}catch(_0x4d3e72){utils['error'](util[_0x75e5('0x12')](_0x75e5('0x17'),members[_0x3da21a[_0x75e5('0x18')]]?members[_0x3da21a[_0x75e5('0x18')]][_0x75e5('0x5')]:_0x3da21a[_0x75e5('0x18')]),_0x4d3e72);}};exports[_0x75e5('0x25')]=function(_0x66df36){try{if(!_[_0x75e5('0x26')](members[_0x66df36[_0x75e5('0x6')]])){utils[_0x75e5('0x27')](util[_0x75e5('0x12')](_0x75e5('0x28'),_0x66df36[_0x75e5('0x5')]),_0x66df36);utils['info'](util[_0x75e5('0x12')](_0x75e5('0x29'),_0x66df36[_0x75e5('0x5')],_0x66df36[_0x75e5('0x6')],_0x66df36['queue']));members[_0x66df36[_0x75e5('0x6')]]=_[_0x75e5('0x2a')](members[_0x66df36['interface']],{'data4':_0x66df36[_0x75e5('0x2b')],'uniqueid':_0x66df36['uniqueid']});}}catch(_0x1aa911){utils[_0x75e5('0x2c')](util[_0x75e5('0x12')](_0x75e5('0x28'),_0x66df36['uniqueid']),_0x1aa911);}};exports[_0x75e5('0x2d')]=function(_0x487486){try{utils[_0x75e5('0x27')](util[_0x75e5('0x12')]('[%s][members][cdr]',_0x487486[_0x75e5('0x5')]),_0x487486);if(_0x487486['channel']){var _0x545395=_0x487486[_0x75e5('0x7')][_0x75e5('0x11')]('-')[0x0];if(!_[_0x75e5('0x26')](members[_0x545395])){members[_0x545395]=_[_0x75e5('0x2a')](members[_0x545395],{'data1':members[_0x545395][_0x75e5('0x2e')]||_0x487486[_0x75e5('0xa')],'data2':members[_0x545395][_0x75e5('0x8')]||_0x487486[_0x75e5('0x2f')],'data3':members[_0x545395][_0x75e5('0x30')]||_0x487486[_0x75e5('0x31')],'uniqueid':members[_0x545395][_0x75e5('0x5')]||_0x487486[_0x75e5('0x5')]});utils[_0x75e5('0x3')](util[_0x75e5('0x12')](_0x75e5('0x32'),_0x487486['uniqueid'],members[_0x545395][_0x75e5('0x2e')],members[_0x545395][_0x75e5('0x8')],members[_0x545395][_0x75e5('0x30')]));if(members[_0x545395]['exitAt']){writeDB(members[_0x545395]);}}}if(_0x487486['destinationchannel']){var _0x2421ff=_0x487486[_0x75e5('0x33')]['split']('-')[0x0];if(!_[_0x75e5('0x26')](members[_0x2421ff])){members[_0x2421ff]=_[_0x75e5('0x2a')](members[_0x2421ff],{'data1':members[_0x2421ff][_0x75e5('0x2e')]||_0x487486['type'],'data2':members[_0x2421ff][_0x75e5('0x8')]||_0x487486['source'],'data3':members[_0x2421ff][_0x75e5('0x30')]||_0x487486['destination'],'uniqueid':members[_0x2421ff][_0x75e5('0x5')]||_0x487486['uniqueid']});utils['info'](util[_0x75e5('0x12')](_0x75e5('0x32'),_0x487486[_0x75e5('0x5')],members[_0x2421ff]['data1'],members[_0x2421ff][_0x75e5('0x8')],members[_0x2421ff][_0x75e5('0x30')]));if(members[_0x2421ff]['exitAt']){writeDB(members[_0x2421ff]);}}}}catch(_0x31d084){utils[_0x75e5('0x2c')](util['format'](_0x75e5('0x34'),_0x487486[_0x75e5('0x5')]),_0x31d084);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7e84a52..b4b2b72 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 _0x5f5f=['[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','varset','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x5f5f,0xa4));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf5f5('0x0'));var queues={};function writeDB(_0x1cd22a){utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1cd22a[_0xf5f5('0x3')],_0x1cd22a[_0xf5f5('0x4')],_0x1cd22a[_0xf5f5('0x5')],_0x1cd22a[_0xf5f5('0x6')],_0x1cd22a[_0xf5f5('0x7')],_0x1cd22a[_0xf5f5('0x8')],_0x1cd22a[_0xf5f5('0x9')]));if(_0x1cd22a[_0xf5f5('0x5')]){utils['getVoiceQueueByName'](_0x1cd22a[_0xf5f5('0x5')])[_0xf5f5('0xa')](function(_0x2341ee){if(_0x2341ee){_0x1cd22a[_0xf5f5('0xb')]=_0x2341ee[_0xf5f5('0xb')];}utils[_0xf5f5('0xc')](_0xf5f5('0xd'),_0x1cd22a);});}else{utils[_0xf5f5('0xc')](_0xf5f5('0xd'),_0x1cd22a);}if(_0x1cd22a['transfereduniqueid']){delete queues[_0x1cd22a['transfereduniqueid']];}else{delete queues[_0x1cd22a[_0xf5f5('0x3')]];}}exports[_0xf5f5('0xe')]=function(_0x2ec0e2){try{utils[_0xf5f5('0xf')](util[_0xf5f5('0x2')]('[%s][queues][queuecallerjoin]',_0x2ec0e2[_0xf5f5('0x3')]),_0x2ec0e2);utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')](_0xf5f5('0x10'),_0x2ec0e2[_0xf5f5('0x3')],_0x2ec0e2[_0xf5f5('0x5')],_0x2ec0e2[_0xf5f5('0x11')]));queues[_0x2ec0e2['uniqueid']]=_[_0xf5f5('0x12')](_0x2ec0e2,{'originalposition':_0x2ec0e2[_0xf5f5('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x231466){utils[_0xf5f5('0x13')](util[_0xf5f5('0x2')](_0xf5f5('0x14'),_0x2ec0e2['uniqueid']),_0x231466);}};exports['hangup']=function(_0x3c5775){try{if(!_[_0xf5f5('0x15')](queues[_0x3c5775[_0xf5f5('0x3')]])){utils[_0xf5f5('0xf')](util[_0xf5f5('0x2')](_0xf5f5('0x16'),_0x3c5775[_0xf5f5('0x3')]),_0x3c5775);if(queues[_0x3c5775[_0xf5f5('0x3')]]['queuecallerleaveAt']){if(!queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x17')]&&!queues[_0x3c5775['uniqueid']]['queuecallerexit']){queues[_0x3c5775['uniqueid']][_0xf5f5('0x18')]=!![];queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x19')]=utils[_0xf5f5('0x1a')]();queues[_0x3c5775['uniqueid']][_0xf5f5('0x9')]=_0xf5f5('0x1b');}utils['info'](util[_0xf5f5('0x2')](_0xf5f5('0x1c'),_0x3c5775[_0xf5f5('0x3')],queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x1d')],queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x9')]));writeDB(queues[_0x3c5775[_0xf5f5('0x3')]]);}else if(queues[_0x3c5775['uniqueid']]['transfereduniqueid']){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3c5775['uniqueid'],queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x1d')],queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x1e')]));queues[queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x1e')]]=queues[_0x3c5775[_0xf5f5('0x3')]];queues[queues[_0x3c5775[_0xf5f5('0x3')]][_0xf5f5('0x1e')]]['queuecallerenterreason']=0x2;delete queues[_0x3c5775[_0xf5f5('0x3')]];}}}catch(_0x242ab7){utils[_0xf5f5('0x13')](util[_0xf5f5('0x2')](_0xf5f5('0x16'),_0x3c5775[_0xf5f5('0x3')]),_0x242ab7);}};exports[_0xf5f5('0x1f')]=function(_0x2136cf){try{utils[_0xf5f5('0xf')](util[_0xf5f5('0x2')]('[%s][queues][varset]',_0x2136cf[_0xf5f5('0x3')]),_0x2136cf);if(!_[_0xf5f5('0x15')](_0x2136cf[_0xf5f5('0x20')]['queuestatus'])&&_0x2136cf[_0xf5f5('0x21')][_0xf5f5('0x22')]()!==_0xf5f5('0x23')){if(!_[_0xf5f5('0x15')](queues[_0x2136cf[_0xf5f5('0x3')]])){queues[_0x2136cf[_0xf5f5('0x3')]]['queuecallerabandon']=![];queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x24')]=null;queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x25')]=!![];queues[_0x2136cf['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x9')]=_0x2136cf[_0xf5f5('0x21')][_0xf5f5('0x22')]();utils['info'](util[_0xf5f5('0x2')](_0xf5f5('0x26'),_0x2136cf[_0xf5f5('0x3')],queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x1d')],_0x2136cf[_0xf5f5('0x21')],queues[_0x2136cf['uniqueid']][_0xf5f5('0x9')]));writeDB(queues[_0x2136cf[_0xf5f5('0x3')]]);}}else if(!_[_0xf5f5('0x15')](_0x2136cf[_0xf5f5('0x20')][_0xf5f5('0x27')])){if(!_['isNil'](queues[_0x2136cf[_0xf5f5('0x3')]])&&!queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x17')]){queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x17')]=![];queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x24')]=null;queues[_0x2136cf[_0xf5f5('0x3')]]['queuecallerexit']=!![];queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x28')]=utils[_0xf5f5('0x1a')]();queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x9')]=_0xf5f5('0x29');utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2136cf[_0xf5f5('0x3')],queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x1d')],_0x2136cf['value'],queues[_0x2136cf[_0xf5f5('0x3')]][_0xf5f5('0x9')]));}}}catch(_0x42efd7){utils[_0xf5f5('0x13')](util[_0xf5f5('0x2')]('[%s][queues][varset]',_0x2136cf[_0xf5f5('0x3')]),_0x42efd7);}};exports[_0xf5f5('0x17')]=function(_0x3bcc62){try{if(!_['isNil'](queues[_0x3bcc62['uniqueid']])){utils[_0xf5f5('0xf')](util[_0xf5f5('0x2')](_0xf5f5('0x2a'),_0x3bcc62[_0xf5f5('0x3')]),_0x3bcc62);queues[_0x3bcc62[_0xf5f5('0x3')]][_0xf5f5('0x25')]=![];queues[_0x3bcc62['uniqueid']][_0xf5f5('0x28')]=null;queues[_0x3bcc62['uniqueid']][_0xf5f5('0x17')]=!![];queues[_0x3bcc62[_0xf5f5('0x3')]][_0xf5f5('0x24')]=utils['now']();queues[_0x3bcc62[_0xf5f5('0x3')]][_0xf5f5('0x9')]=_0xf5f5('0x2b');utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')](_0xf5f5('0x2c'),_0x3bcc62[_0xf5f5('0x3')],queues[_0x3bcc62[_0xf5f5('0x3')]][_0xf5f5('0x1d')],queues[_0x3bcc62[_0xf5f5('0x3')]][_0xf5f5('0x9')]));}}catch(_0x3419b1){utils[_0xf5f5('0x13')](util['format'](_0xf5f5('0x2a'),_0x3bcc62[_0xf5f5('0x3')]),_0x3419b1);}};exports[_0xf5f5('0x2d')]=function(_0x1e8157){try{if(!_[_0xf5f5('0x15')](queues[_0x1e8157[_0xf5f5('0x3')]])){utils[_0xf5f5('0xf')](util[_0xf5f5('0x2')]('[%s][queues][queuecallerleave]',_0x1e8157['uniqueid']),_0x1e8157);utils['info'](util['format'](_0xf5f5('0x2e'),_0x1e8157['uniqueid'],queues[_0x1e8157[_0xf5f5('0x3')]][_0xf5f5('0x1d')],_0x1e8157['connectedlinenum'],_0x1e8157[_0xf5f5('0x2f')]));queues[_0x1e8157[_0xf5f5('0x3')]]['queuecallerleave']=!![];queues[_0x1e8157['uniqueid']][_0xf5f5('0x30')]=utils['now']();queues[_0x1e8157['uniqueid']][_0xf5f5('0x31')]=utils[_0xf5f5('0x32')](queues[_0x1e8157[_0xf5f5('0x3')]][_0xf5f5('0x30')],queues[_0x1e8157['uniqueid']][_0xf5f5('0x33')]);queues[_0x1e8157[_0xf5f5('0x3')]]['position']=_0x1e8157['position'];queues[_0x1e8157[_0xf5f5('0x3')]][_0xf5f5('0x34')]=_0x1e8157['count'];queues[_0x1e8157[_0xf5f5('0x3')]][_0xf5f5('0x35')]=_0x1e8157[_0xf5f5('0x35')];queues[_0x1e8157[_0xf5f5('0x3')]][_0xf5f5('0x2f')]=_0x1e8157[_0xf5f5('0x2f')];}}catch(_0x23d78b){utils[_0xf5f5('0x13')](util[_0xf5f5('0x2')](_0xf5f5('0x36'),_0x1e8157[_0xf5f5('0x3')]),_0x23d78b);}};exports[_0xf5f5('0x37')]=function(_0x29269a){try{if(!_[_0xf5f5('0x15')](queues[_0x29269a['uniqueid']])){utils[_0xf5f5('0xf')](util['format'](_0xf5f5('0x38'),_0x29269a[_0xf5f5('0x3')]),_0x29269a);utils[_0xf5f5('0x1')](util['format'](_0xf5f5('0x39'),_0x29269a[_0xf5f5('0x3')],queues[_0x29269a['uniqueid']]['name'],_0x29269a['membername'],_0x29269a[_0xf5f5('0x3a')]));queues[_0x29269a[_0xf5f5('0x3')]][_0xf5f5('0x17')]=![];queues[_0x29269a[_0xf5f5('0x3')]][_0xf5f5('0x17')]=![];queues[_0x29269a['uniqueid']][_0xf5f5('0x24')]=null;queues[_0x29269a[_0xf5f5('0x3')]][_0xf5f5('0x25')]=![];queues[_0x29269a[_0xf5f5('0x3')]][_0xf5f5('0x9')]=null;queues[_0x29269a[_0xf5f5('0x3')]][_0xf5f5('0x28')]=null;queues[_0x29269a[_0xf5f5('0x3')]][_0xf5f5('0x3b')]=!![];queues[_0x29269a[_0xf5f5('0x3')]][_0xf5f5('0x8')]=_0x29269a[_0xf5f5('0x3a')];queues[_0x29269a['uniqueid']][_0xf5f5('0x6')]=_0x29269a[_0xf5f5('0x3c')];}}catch(_0x3d8793){utils[_0xf5f5('0x13')](util[_0xf5f5('0x2')](_0xf5f5('0x38'),_0x29269a[_0xf5f5('0x3')]),_0x3d8793);}};exports[_0xf5f5('0x3d')]=function(_0x2ab72c){try{if(!_['isNil'](queues[_0x2ab72c[_0xf5f5('0x3')]])){if(queues[_0x2ab72c['uniqueid']][_0xf5f5('0x30')]){utils[_0xf5f5('0xf')](util[_0xf5f5('0x2')](_0xf5f5('0x3e'),_0x2ab72c[_0xf5f5('0x3')]),_0x2ab72c);queues[_0x2ab72c[_0xf5f5('0x3')]][_0xf5f5('0x17')]=![];queues[_0x2ab72c[_0xf5f5('0x3')]][_0xf5f5('0x17')]=![];queues[_0x2ab72c['uniqueid']][_0xf5f5('0x24')]=null;queues[_0x2ab72c[_0xf5f5('0x3')]][_0xf5f5('0x25')]=![];queues[_0x2ab72c['uniqueid']][_0xf5f5('0x28')]=null;queues[_0x2ab72c['uniqueid']][_0xf5f5('0x3b')]=!![];queues[_0x2ab72c[_0xf5f5('0x3')]]['lastAssignedTo']=_0x2ab72c[_0xf5f5('0x3c')];queues[_0x2ab72c['uniqueid']][_0xf5f5('0x18')]=!![];queues[_0x2ab72c[_0xf5f5('0x3')]][_0xf5f5('0x19')]=utils[_0xf5f5('0x1a')]();if(_0x2ab72c[_0xf5f5('0x3f')]==_0xf5f5('0x40')){if(!queues[_0x2ab72c[_0xf5f5('0x3')]][_0xf5f5('0x40')]){queues[_0x2ab72c['uniqueid']][_0xf5f5('0x9')]=_0xf5f5('0x41');}}else{queues[_0x2ab72c[_0xf5f5('0x3')]][_0xf5f5('0x9')]=_0xf5f5('0x42')+_0x2ab72c[_0xf5f5('0x3f')]['toUpperCase']();}utils['info'](util[_0xf5f5('0x2')](_0xf5f5('0x43'),_0x2ab72c[_0xf5f5('0x3')],queues[_0x2ab72c[_0xf5f5('0x3')]][_0xf5f5('0x1d')],_0x2ab72c[_0xf5f5('0x3c')],queues[_0x2ab72c['uniqueid']][_0xf5f5('0x9')]));writeDB(queues[_0x2ab72c['uniqueid']]);}}}catch(_0x2be51f){utils[_0xf5f5('0x13')](util[_0xf5f5('0x2')](_0xf5f5('0x3e'),_0x2ab72c[_0xf5f5('0x3')]),_0x2be51f);}};exports['blindtransfer']=function(_0x59948b){try{if(!_[_0xf5f5('0x15')](queues[_0x59948b[_0xf5f5('0x44')]])){utils[_0xf5f5('0xf')](util['format'](_0xf5f5('0x45'),_0x59948b[_0xf5f5('0x3')]),_0x59948b);queues[_0x59948b[_0xf5f5('0x44')]][_0xf5f5('0x40')]=!![];queues[_0x59948b[_0xf5f5('0x44')]][_0xf5f5('0x46')]=_0xf5f5('0x47');queues[_0x59948b['transfereeuniqueid']][_0xf5f5('0x48')]=_0x59948b[_0xf5f5('0x49')];queues[_0x59948b['transfereeuniqueid']][_0xf5f5('0x4a')]=_0x59948b[_0xf5f5('0x44')];queues[_0x59948b['transfereeuniqueid']][_0xf5f5('0x9')]=_0xf5f5('0x4b');utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')](_0xf5f5('0x4c'),_0x59948b['uniqueid'],queues[_0x59948b['transfereeuniqueid']][_0xf5f5('0x1d')],_0x59948b[_0xf5f5('0x44')],_0x59948b['extension']));}}catch(_0x6367e6){utils[_0xf5f5('0x13')](util['format'](_0xf5f5('0x45'),_0x59948b[_0xf5f5('0x3')]),_0x6367e6);}};exports[_0xf5f5('0x4d')]=function(_0x391a16){try{utils[_0xf5f5('0xf')](util[_0xf5f5('0x2')]('[%s][queues][attendedtransfer]',_0x391a16['origtransfereruniqueid']),_0x391a16);if(_0x391a16[_0xf5f5('0x4e')]==_0x391a16[_0xf5f5('0x4f')]){if(!_[_0xf5f5('0x15')](queues[_0x391a16[_0xf5f5('0x50')]])){utils[_0xf5f5('0x1')](util['format'](_0xf5f5('0x51'),_0x391a16[_0xf5f5('0x4e')],queues[_0x391a16[_0xf5f5('0x50')]][_0xf5f5('0x1d')],_0x391a16['origtransfererexten']));queues[_0x391a16[_0xf5f5('0x50')]]['transfer']=!![];queues[_0x391a16['secondtransfererlinkedid']][_0xf5f5('0x46')]=_0xf5f5('0x52');queues[_0x391a16[_0xf5f5('0x50')]][_0xf5f5('0x48')]=_0x391a16[_0xf5f5('0x53')];queues[_0x391a16[_0xf5f5('0x50')]][_0xf5f5('0x4a')]=_0x391a16[_0xf5f5('0x4e')];queues[_0x391a16['secondtransfererlinkedid']][_0xf5f5('0x9')]=_0xf5f5('0x54');}if(!_[_0xf5f5('0x15')](queues[_0x391a16['origtransfererlinkedid']])){if(_0x391a16[_0xf5f5('0x55')]&&queues[_0x391a16[_0xf5f5('0x55')]]){queues[_0x391a16[_0xf5f5('0x55')]]['queuecallerenterreason']=0x1;queues[_0x391a16[_0xf5f5('0x44')]]=_[_0xf5f5('0x56')](queues[_0x391a16[_0xf5f5('0x55')]]);queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x1e')]=_0x391a16[_0xf5f5('0x57')];queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x58')]=0x2;queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x7')]=queues[_0x391a16[_0xf5f5('0x50')]][_0xf5f5('0x7')];queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x59')]=queues[_0x391a16[_0xf5f5('0x50')]][_0xf5f5('0x59')];queues[_0x391a16['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xf5f5('0x1a')]();queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x30')]=utils[_0xf5f5('0x1a')]();queues[_0x391a16['transfereeuniqueid']][_0xf5f5('0x31')]=0x0;queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x5a')]=0x0;utils['info'](util[_0xf5f5('0x2')](_0xf5f5('0x5b'),_0x391a16[_0xf5f5('0x4e')],queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x1d')],queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x7')],queues[_0x391a16[_0xf5f5('0x44')]][_0xf5f5('0x59')]));}else{utils['info'](util[_0xf5f5('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x391a16[_0xf5f5('0x4e')],queues[_0x391a16[_0xf5f5('0x4f')]]['name'],_0x391a16['secondtransfererlinkedid']));queues[_0x391a16[_0xf5f5('0x4f')]][_0xf5f5('0x1e')]=_0x391a16[_0xf5f5('0x50')];}}}else if(_0x391a16[_0xf5f5('0x5c')]==_0x391a16[_0xf5f5('0x50')]){if(!_[_0xf5f5('0x15')](queues[_0x391a16[_0xf5f5('0x4f')]])){utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')](_0xf5f5('0x5d'),_0x391a16['origtransfereruniqueid'],queues[_0x391a16[_0xf5f5('0x4f')]][_0xf5f5('0x1d')],_0x391a16['secondtransfereruniqueid'],_0x391a16[_0xf5f5('0x5e')]));queues[_0x391a16[_0xf5f5('0x4f')]][_0xf5f5('0x40')]=!![];queues[_0x391a16[_0xf5f5('0x4f')]]['transfertype']=_0xf5f5('0x52');queues[_0x391a16[_0xf5f5('0x4f')]][_0xf5f5('0x48')]=_0x391a16[_0xf5f5('0x5e')];queues[_0x391a16[_0xf5f5('0x4f')]][_0xf5f5('0x4a')]=_0x391a16['secondtransfereruniqueid'];queues[_0x391a16[_0xf5f5('0x4f')]][_0xf5f5('0x9')]=_0xf5f5('0x54');}if(!_['isNil'](queues[_0x391a16[_0xf5f5('0x50')]])){if(_0x391a16[_0xf5f5('0x5f')]&&queues[_0x391a16['transfertargetlinkedid']]){queues[_0x391a16[_0xf5f5('0x5f')]][_0xf5f5('0x58')]=0x1;queues[_0x391a16[_0xf5f5('0x57')]]=_[_0xf5f5('0x56')](queues[_0x391a16[_0xf5f5('0x5f')]]);queues[_0x391a16['transfertargetuniqueid']][_0xf5f5('0x1e')]=_0x391a16['transfertargetuniqueid'];queues[_0x391a16['transfertargetuniqueid']][_0xf5f5('0x58')]=0x2;queues[_0x391a16['transfertargetuniqueid']][_0xf5f5('0x7')]=queues[_0x391a16[_0xf5f5('0x4f')]]['calleridnum'];queues[_0x391a16[_0xf5f5('0x57')]][_0xf5f5('0x59')]=queues[_0x391a16[_0xf5f5('0x4f')]][_0xf5f5('0x59')];queues[_0x391a16[_0xf5f5('0x57')]][_0xf5f5('0x33')]=utils[_0xf5f5('0x1a')]();queues[_0x391a16[_0xf5f5('0x57')]][_0xf5f5('0x30')]=utils[_0xf5f5('0x1a')]();queues[_0x391a16[_0xf5f5('0x57')]][_0xf5f5('0x31')]=0x0;queues[_0x391a16[_0xf5f5('0x57')]]['mohtime']=0x0;utils['info'](util[_0xf5f5('0x2')](_0xf5f5('0x60'),_0x391a16[_0xf5f5('0x4e')],queues[_0x391a16['transfertargetuniqueid']][_0xf5f5('0x1d')],queues[_0x391a16[_0xf5f5('0x57')]]['transfereduniqueid'],queues[_0x391a16[_0xf5f5('0x57')]]['calleridnum'],queues[_0x391a16[_0xf5f5('0x57')]][_0xf5f5('0x59')]));}else{utils['info'](util[_0xf5f5('0x2')](_0xf5f5('0x61'),_0x391a16['origtransfereruniqueid'],queues[_0x391a16[_0xf5f5('0x50')]]['name'],_0x391a16[_0xf5f5('0x4f')]));queues[_0x391a16[_0xf5f5('0x50')]]['transfereduniqueid']=_0x391a16['origtransfererlinkedid'];}}}}catch(_0x14fb6a){utils[_0xf5f5('0x13')](util['format'](_0xf5f5('0x62'),_0x391a16['origtransfereruniqueid']),_0x14fb6a);}};exports[_0xf5f5('0x63')]=function(_0x5bfc69){try{if(!_[_0xf5f5('0x15')](queues[_0x5bfc69[_0xf5f5('0x3')]])){utils[_0xf5f5('0xf')](util['format']('[%s][queues][musiconholdstart]',_0x5bfc69[_0xf5f5('0x3')]),_0x5bfc69);queues[_0x5bfc69[_0xf5f5('0x3')]][_0xf5f5('0x64')]=utils[_0xf5f5('0x1a')]();utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')](_0xf5f5('0x65'),_0x5bfc69[_0xf5f5('0x3')],queues[_0x5bfc69[_0xf5f5('0x3')]][_0xf5f5('0x1d')],queues[_0x5bfc69[_0xf5f5('0x3')]][_0xf5f5('0x64')]));}}catch(_0x25686a){utils[_0xf5f5('0x13')](util['format'](_0xf5f5('0x66'),_0x5bfc69['uniqueid']),_0x25686a);}};exports['musiconholdstop']=function(_0x5e4081){try{if(!_['isNil'](queues[_0x5e4081[_0xf5f5('0x3')]])){if(!_[_0xf5f5('0x15')](queues[_0x5e4081['uniqueid']]['musiconholdstartAt'])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x5e4081[_0xf5f5('0x3')]),_0x5e4081);queues[_0x5e4081[_0xf5f5('0x3')]][_0xf5f5('0x5a')]+=utils[_0xf5f5('0x32')](utils[_0xf5f5('0x1a')](),queues[_0x5e4081['uniqueid']][_0xf5f5('0x64')]);utils[_0xf5f5('0x1')](util[_0xf5f5('0x2')](_0xf5f5('0x67'),_0x5e4081[_0xf5f5('0x3')],queues[_0x5e4081[_0xf5f5('0x3')]][_0xf5f5('0x1d')],queues[_0x5e4081[_0xf5f5('0x3')]]['mohtime']));delete queues[_0x5e4081['uniqueid']]['musiconholdstartAt'];}}}catch(_0x4c204b){utils[_0xf5f5('0x13')](util[_0xf5f5('0x2')](_0xf5f5('0x68'),_0x5e4081[_0xf5f5('0x3')]),_0x4c204b);}}; \ No newline at end of file +var _0xc82b=['queueposition','[%s][queues][varset]','[%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','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','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]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x397fcc,_0x3be1a9){var _0x5bb3b1=function(_0x4232a9){while(--_0x4232a9){_0x397fcc['push'](_0x397fcc['shift']());}};_0x5bb3b1(++_0x3be1a9);}(_0xc82b,0xa4));var _0xbc82=function(_0x11c8ac,_0x5b98d4){_0x11c8ac=_0x11c8ac-0x0;var _0x3f1bba=_0xc82b[_0x11c8ac];return _0x3f1bba;};'use strict';var _=require(_0xbc82('0x0'));var util=require(_0xbc82('0x1'));var utils=require(_0xbc82('0x2'));var queues={};function writeDB(_0x6c7623){utils[_0xbc82('0x3')](util['format'](_0xbc82('0x4'),_0x6c7623[_0xbc82('0x5')],_0x6c7623[_0xbc82('0x6')],_0x6c7623[_0xbc82('0x7')],_0x6c7623[_0xbc82('0x8')],_0x6c7623[_0xbc82('0x9')],_0x6c7623[_0xbc82('0xa')],_0x6c7623[_0xbc82('0xb')]));if(_0x6c7623['queue']){utils[_0xbc82('0xc')](_0x6c7623[_0xbc82('0x7')])[_0xbc82('0xd')](function(_0x27f5a6){if(_0x27f5a6){_0x6c7623['type']=_0x27f5a6['type'];}utils[_0xbc82('0xe')](_0xbc82('0xf'),_0x6c7623);});}else{utils[_0xbc82('0xe')]('CreateVoiceQueueReport',_0x6c7623);}if(_0x6c7623[_0xbc82('0x10')]){delete queues[_0x6c7623[_0xbc82('0x10')]];}else{delete queues[_0x6c7623['uniqueid']];}}exports[_0xbc82('0x11')]=function(_0x15c933){try{utils['debug'](util[_0xbc82('0x12')](_0xbc82('0x13'),_0x15c933[_0xbc82('0x5')]),_0x15c933);utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x14'),_0x15c933[_0xbc82('0x5')],_0x15c933[_0xbc82('0x7')],_0x15c933[_0xbc82('0x15')]));queues[_0x15c933[_0xbc82('0x5')]]=_['assign'](_0x15c933,{'originalposition':_0x15c933[_0xbc82('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x1a105f){utils['error'](util[_0xbc82('0x12')](_0xbc82('0x13'),_0x15c933[_0xbc82('0x5')]),_0x1a105f);}};exports['hangup']=function(_0x312b62){try{if(!_[_0xbc82('0x16')](queues[_0x312b62[_0xbc82('0x5')]])){utils[_0xbc82('0x17')](util['format'](_0xbc82('0x18'),_0x312b62[_0xbc82('0x5')]),_0x312b62);if(queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0x19')]){if(!queues[_0x312b62['uniqueid']]['queuecallerabandon']&&!queues[_0x312b62['uniqueid']][_0xbc82('0x1a')]){queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0x1b')]=!![];queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0x1c')]=utils[_0xbc82('0x1d')]();queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0xb')]='COMPLETEDBYAGENT';}utils[_0xbc82('0x3')](util[_0xbc82('0x12')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x312b62['uniqueid'],queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0x1e')],queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0xb')]));writeDB(queues[_0x312b62[_0xbc82('0x5')]]);}else if(queues[_0x312b62[_0xbc82('0x5')]]['transfereduniqueid']){utils[_0xbc82('0x3')](util['format'](_0xbc82('0x1f'),_0x312b62[_0xbc82('0x5')],queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0x1e')],queues[_0x312b62['uniqueid']][_0xbc82('0x10')]));queues[queues[_0x312b62['uniqueid']]['transfereduniqueid']]=queues[_0x312b62['uniqueid']];queues[queues[_0x312b62[_0xbc82('0x5')]][_0xbc82('0x10')]][_0xbc82('0x20')]=0x2;delete queues[_0x312b62[_0xbc82('0x5')]];}}}catch(_0x4739d3){utils[_0xbc82('0x21')](util['format'](_0xbc82('0x18'),_0x312b62[_0xbc82('0x5')]),_0x4739d3);}};exports[_0xbc82('0x22')]=function(_0x5c82ad){try{utils[_0xbc82('0x17')](util[_0xbc82('0x12')]('[%s][queues][varset]',_0x5c82ad['uniqueid']),_0x5c82ad);if(!_[_0xbc82('0x16')](_0x5c82ad[_0xbc82('0x23')][_0xbc82('0x24')])&&_0x5c82ad['value'][_0xbc82('0x25')]()!==_0xbc82('0x26')){if(!_[_0xbc82('0x16')](queues[_0x5c82ad[_0xbc82('0x5')]])){queues[_0x5c82ad['uniqueid']][_0xbc82('0x27')]=![];queues[_0x5c82ad['uniqueid']][_0xbc82('0x28')]=null;queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0x1a')]=!![];queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0x29')]=utils['now']();queues[_0x5c82ad['uniqueid']][_0xbc82('0xb')]=_0x5c82ad[_0xbc82('0x2a')]['toUpperCase']();utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x2b'),_0x5c82ad[_0xbc82('0x5')],queues[_0x5c82ad['uniqueid']]['name'],_0x5c82ad[_0xbc82('0x2a')],queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0xb')]));writeDB(queues[_0x5c82ad[_0xbc82('0x5')]]);}}else if(!_[_0xbc82('0x16')](_0x5c82ad[_0xbc82('0x23')][_0xbc82('0x2c')])){if(!_[_0xbc82('0x16')](queues[_0x5c82ad[_0xbc82('0x5')]])&&!queues[_0x5c82ad[_0xbc82('0x5')]]['queuecallerabandon']){queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0x27')]=![];queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0x28')]=null;queues[_0x5c82ad['uniqueid']][_0xbc82('0x1a')]=!![];queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0x29')]=utils[_0xbc82('0x1d')]();queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0xb')]='EXITWITHKEY';utils['info'](util[_0xbc82('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x5c82ad['uniqueid'],queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0x1e')],_0x5c82ad['value'],queues[_0x5c82ad[_0xbc82('0x5')]][_0xbc82('0xb')]));}}}catch(_0x45f2b8){utils[_0xbc82('0x21')](util['format'](_0xbc82('0x2d'),_0x5c82ad[_0xbc82('0x5')]),_0x45f2b8);}};exports['queuecallerabandon']=function(_0x25c526){try{if(!_[_0xbc82('0x16')](queues[_0x25c526[_0xbc82('0x5')]])){utils['debug'](util[_0xbc82('0x12')](_0xbc82('0x2e'),_0x25c526[_0xbc82('0x5')]),_0x25c526);queues[_0x25c526[_0xbc82('0x5')]][_0xbc82('0x1a')]=![];queues[_0x25c526[_0xbc82('0x5')]][_0xbc82('0x29')]=null;queues[_0x25c526['uniqueid']][_0xbc82('0x27')]=!![];queues[_0x25c526[_0xbc82('0x5')]][_0xbc82('0x28')]=utils[_0xbc82('0x1d')]();queues[_0x25c526[_0xbc82('0x5')]][_0xbc82('0xb')]=_0xbc82('0x2f');utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x30'),_0x25c526[_0xbc82('0x5')],queues[_0x25c526['uniqueid']][_0xbc82('0x1e')],queues[_0x25c526[_0xbc82('0x5')]][_0xbc82('0xb')]));}}catch(_0x52ba24){utils['error'](util[_0xbc82('0x12')](_0xbc82('0x2e'),_0x25c526[_0xbc82('0x5')]),_0x52ba24);}};exports[_0xbc82('0x31')]=function(_0x371866){try{if(!_['isNil'](queues[_0x371866[_0xbc82('0x5')]])){utils['debug'](util[_0xbc82('0x12')](_0xbc82('0x32'),_0x371866['uniqueid']),_0x371866);utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x33'),_0x371866[_0xbc82('0x5')],queues[_0x371866[_0xbc82('0x5')]][_0xbc82('0x1e')],_0x371866[_0xbc82('0x34')],_0x371866['connectedlinename']));queues[_0x371866[_0xbc82('0x5')]]['queuecallerleave']=!![];queues[_0x371866[_0xbc82('0x5')]]['queuecallerleaveAt']=utils[_0xbc82('0x1d')]();queues[_0x371866[_0xbc82('0x5')]][_0xbc82('0x35')]=utils[_0xbc82('0x36')](queues[_0x371866[_0xbc82('0x5')]][_0xbc82('0x19')],queues[_0x371866[_0xbc82('0x5')]][_0xbc82('0x37')]);queues[_0x371866['uniqueid']][_0xbc82('0x15')]=_0x371866[_0xbc82('0x15')];queues[_0x371866[_0xbc82('0x5')]]['count']=_0x371866[_0xbc82('0x38')];queues[_0x371866[_0xbc82('0x5')]][_0xbc82('0x34')]=_0x371866[_0xbc82('0x34')];queues[_0x371866[_0xbc82('0x5')]]['connectedlinename']=_0x371866[_0xbc82('0x39')];}}catch(_0x331977){utils[_0xbc82('0x21')](util[_0xbc82('0x12')](_0xbc82('0x32'),_0x371866[_0xbc82('0x5')]),_0x331977);}};exports[_0xbc82('0x3a')]=function(_0x2a8651){try{if(!_[_0xbc82('0x16')](queues[_0x2a8651[_0xbc82('0x5')]])){utils[_0xbc82('0x17')](util['format'](_0xbc82('0x3b'),_0x2a8651[_0xbc82('0x5')]),_0x2a8651);utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x3c'),_0x2a8651[_0xbc82('0x5')],queues[_0x2a8651[_0xbc82('0x5')]]['name'],_0x2a8651[_0xbc82('0x3d')],_0x2a8651[_0xbc82('0x3e')]));queues[_0x2a8651[_0xbc82('0x5')]][_0xbc82('0x27')]=![];queues[_0x2a8651['uniqueid']][_0xbc82('0x27')]=![];queues[_0x2a8651[_0xbc82('0x5')]]['queuecallerabandonAt']=null;queues[_0x2a8651[_0xbc82('0x5')]][_0xbc82('0x1a')]=![];queues[_0x2a8651[_0xbc82('0x5')]]['queuecallerexitreason']=null;queues[_0x2a8651[_0xbc82('0x5')]]['queuecallerexitAt']=null;queues[_0x2a8651[_0xbc82('0x5')]][_0xbc82('0x3f')]=!![];queues[_0x2a8651[_0xbc82('0x5')]][_0xbc82('0xa')]=_0x2a8651[_0xbc82('0x3e')];queues[_0x2a8651[_0xbc82('0x5')]]['lastAssignedTo']=_0x2a8651[_0xbc82('0x3d')];}}catch(_0x236aea){utils['error'](util['format'](_0xbc82('0x3b'),_0x2a8651[_0xbc82('0x5')]),_0x236aea);}};exports[_0xbc82('0x40')]=function(_0x1d0d0d){try{if(!_['isNil'](queues[_0x1d0d0d[_0xbc82('0x5')]])){if(queues[_0x1d0d0d['uniqueid']]['queuecallerleaveAt']){utils[_0xbc82('0x17')](util[_0xbc82('0x12')]('[%s][queues][agentcomplete]',_0x1d0d0d['uniqueid']),_0x1d0d0d);queues[_0x1d0d0d['uniqueid']][_0xbc82('0x27')]=![];queues[_0x1d0d0d[_0xbc82('0x5')]][_0xbc82('0x27')]=![];queues[_0x1d0d0d[_0xbc82('0x5')]][_0xbc82('0x28')]=null;queues[_0x1d0d0d[_0xbc82('0x5')]][_0xbc82('0x1a')]=![];queues[_0x1d0d0d['uniqueid']][_0xbc82('0x29')]=null;queues[_0x1d0d0d['uniqueid']][_0xbc82('0x3f')]=!![];queues[_0x1d0d0d[_0xbc82('0x5')]]['lastAssignedTo']=_0x1d0d0d['membername'];queues[_0x1d0d0d[_0xbc82('0x5')]]['queuecallercomplete']=!![];queues[_0x1d0d0d[_0xbc82('0x5')]][_0xbc82('0x1c')]=utils[_0xbc82('0x1d')]();if(_0x1d0d0d['reason']==_0xbc82('0x41')){if(!queues[_0x1d0d0d[_0xbc82('0x5')]][_0xbc82('0x41')]){queues[_0x1d0d0d[_0xbc82('0x5')]][_0xbc82('0xb')]=_0xbc82('0x42');}}else{queues[_0x1d0d0d['uniqueid']][_0xbc82('0xb')]=_0xbc82('0x43')+_0x1d0d0d[_0xbc82('0x44')][_0xbc82('0x25')]();}utils[_0xbc82('0x3')](util['format'](_0xbc82('0x45'),_0x1d0d0d[_0xbc82('0x5')],queues[_0x1d0d0d[_0xbc82('0x5')]]['name'],_0x1d0d0d[_0xbc82('0x3d')],queues[_0x1d0d0d['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x1d0d0d['uniqueid']]);}}}catch(_0x37fb90){utils[_0xbc82('0x21')](util['format']('[%s][queues][agentcomplete]',_0x1d0d0d[_0xbc82('0x5')]),_0x37fb90);}};exports[_0xbc82('0x46')]=function(_0xbff256){try{if(!_[_0xbc82('0x16')](queues[_0xbff256[_0xbc82('0x47')]])){utils[_0xbc82('0x17')](util['format']('[%s][queues][blindtransfer]',_0xbff256['uniqueid']),_0xbff256);queues[_0xbff256[_0xbc82('0x47')]]['transfer']=!![];queues[_0xbff256[_0xbc82('0x47')]][_0xbc82('0x48')]='BLIND';queues[_0xbff256[_0xbc82('0x47')]][_0xbc82('0x49')]=_0xbff256[_0xbc82('0x4a')];queues[_0xbff256[_0xbc82('0x47')]][_0xbc82('0x4b')]=_0xbff256[_0xbc82('0x47')];queues[_0xbff256['transfereeuniqueid']][_0xbc82('0xb')]=_0xbc82('0x4c');utils[_0xbc82('0x3')](util[_0xbc82('0x12')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xbff256['uniqueid'],queues[_0xbff256[_0xbc82('0x47')]][_0xbc82('0x1e')],_0xbff256[_0xbc82('0x47')],_0xbff256[_0xbc82('0x4a')]));}}catch(_0x191698){utils[_0xbc82('0x21')](util['format']('[%s][queues][blindtransfer]',_0xbff256['uniqueid']),_0x191698);}};exports[_0xbc82('0x4d')]=function(_0x2fa1f6){try{utils['debug'](util[_0xbc82('0x12')](_0xbc82('0x4e'),_0x2fa1f6[_0xbc82('0x4f')]),_0x2fa1f6);if(_0x2fa1f6[_0xbc82('0x4f')]==_0x2fa1f6[_0xbc82('0x50')]){if(!_[_0xbc82('0x16')](queues[_0x2fa1f6[_0xbc82('0x51')]])){utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x52'),_0x2fa1f6[_0xbc82('0x4f')],queues[_0x2fa1f6[_0xbc82('0x51')]][_0xbc82('0x1e')],_0x2fa1f6['origtransfererexten']));queues[_0x2fa1f6['secondtransfererlinkedid']][_0xbc82('0x41')]=!![];queues[_0x2fa1f6[_0xbc82('0x51')]]['transfertype']=_0xbc82('0x53');queues[_0x2fa1f6['secondtransfererlinkedid']][_0xbc82('0x49')]=_0x2fa1f6[_0xbc82('0x54')];queues[_0x2fa1f6[_0xbc82('0x51')]]['transferuniqueid']=_0x2fa1f6[_0xbc82('0x4f')];queues[_0x2fa1f6[_0xbc82('0x51')]]['queuecallerexitreason']=_0xbc82('0x55');}if(!_[_0xbc82('0x16')](queues[_0x2fa1f6[_0xbc82('0x50')]])){if(_0x2fa1f6['transfereelinkedid']&&queues[_0x2fa1f6[_0xbc82('0x56')]]){queues[_0x2fa1f6[_0xbc82('0x56')]][_0xbc82('0x20')]=0x1;queues[_0x2fa1f6['transfereeuniqueid']]=_[_0xbc82('0x57')](queues[_0x2fa1f6['transfereelinkedid']]);queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x10')]=_0x2fa1f6[_0xbc82('0x58')];queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x20')]=0x2;queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x9')]=queues[_0x2fa1f6[_0xbc82('0x51')]][_0xbc82('0x9')];queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x59')]=queues[_0x2fa1f6[_0xbc82('0x51')]][_0xbc82('0x59')];queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x37')]=utils['now']();queues[_0x2fa1f6['transfereeuniqueid']][_0xbc82('0x19')]=utils[_0xbc82('0x1d')]();queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x35')]=0x0;queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x5a')]=0x0;utils['info'](util['format'](_0xbc82('0x5b'),_0x2fa1f6[_0xbc82('0x4f')],queues[_0x2fa1f6['transfereeuniqueid']][_0xbc82('0x1e')],queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x9')],queues[_0x2fa1f6[_0xbc82('0x47')]][_0xbc82('0x59')]));}else{utils[_0xbc82('0x3')](util['format'](_0xbc82('0x5c'),_0x2fa1f6[_0xbc82('0x4f')],queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0x1e')],_0x2fa1f6['secondtransfererlinkedid']));queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0x10')]=_0x2fa1f6['secondtransfererlinkedid'];}}}else if(_0x2fa1f6['secondtransfereruniqueid']==_0x2fa1f6[_0xbc82('0x51')]){if(!_[_0xbc82('0x16')](queues[_0x2fa1f6[_0xbc82('0x50')]])){utils[_0xbc82('0x3')](util['format'](_0xbc82('0x5d'),_0x2fa1f6[_0xbc82('0x4f')],queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0x1e')],_0x2fa1f6[_0xbc82('0x5e')],_0x2fa1f6['secondtransfererexten']));queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0x41')]=!![];queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0x48')]='ATTENDED';queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0x49')]=_0x2fa1f6['secondtransfererexten'];queues[_0x2fa1f6[_0xbc82('0x50')]]['transferuniqueid']=_0x2fa1f6[_0xbc82('0x5e')];queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0xb')]=_0xbc82('0x55');}if(!_[_0xbc82('0x16')](queues[_0x2fa1f6[_0xbc82('0x51')]])){if(_0x2fa1f6[_0xbc82('0x5f')]&&queues[_0x2fa1f6[_0xbc82('0x5f')]]){queues[_0x2fa1f6[_0xbc82('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x2fa1f6[_0xbc82('0x58')]]=_[_0xbc82('0x57')](queues[_0x2fa1f6[_0xbc82('0x5f')]]);queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x10')]=_0x2fa1f6[_0xbc82('0x58')];queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x20')]=0x2;queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x9')]=queues[_0x2fa1f6['origtransfererlinkedid']]['calleridnum'];queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x59')]=queues[_0x2fa1f6[_0xbc82('0x50')]][_0xbc82('0x59')];queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x37')]=utils[_0xbc82('0x1d')]();queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x19')]=utils['now']();queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x35')]=0x0;queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x5a')]=0x0;utils['info'](util['format'](_0xbc82('0x60'),_0x2fa1f6[_0xbc82('0x4f')],queues[_0x2fa1f6[_0xbc82('0x58')]]['name'],queues[_0x2fa1f6['transfertargetuniqueid']][_0xbc82('0x10')],queues[_0x2fa1f6[_0xbc82('0x58')]][_0xbc82('0x9')],queues[_0x2fa1f6[_0xbc82('0x58')]]['calleridname']));}else{utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x5c'),_0x2fa1f6[_0xbc82('0x4f')],queues[_0x2fa1f6[_0xbc82('0x51')]][_0xbc82('0x1e')],_0x2fa1f6[_0xbc82('0x50')]));queues[_0x2fa1f6['secondtransfererlinkedid']][_0xbc82('0x10')]=_0x2fa1f6['origtransfererlinkedid'];}}}}catch(_0x25d25f){utils['error'](util[_0xbc82('0x12')]('[%s][queues][attendedtransfer]',_0x2fa1f6[_0xbc82('0x4f')]),_0x25d25f);}};exports[_0xbc82('0x61')]=function(_0x45920){try{if(!_[_0xbc82('0x16')](queues[_0x45920[_0xbc82('0x5')]])){utils[_0xbc82('0x17')](util[_0xbc82('0x12')](_0xbc82('0x62'),_0x45920[_0xbc82('0x5')]),_0x45920);queues[_0x45920[_0xbc82('0x5')]][_0xbc82('0x63')]=utils[_0xbc82('0x1d')]();utils[_0xbc82('0x3')](util[_0xbc82('0x12')](_0xbc82('0x64'),_0x45920['uniqueid'],queues[_0x45920[_0xbc82('0x5')]]['name'],queues[_0x45920[_0xbc82('0x5')]][_0xbc82('0x63')]));}}catch(_0x5e175d){utils[_0xbc82('0x21')](util[_0xbc82('0x12')](_0xbc82('0x62'),_0x45920[_0xbc82('0x5')]),_0x5e175d);}};exports[_0xbc82('0x65')]=function(_0x1ae611){try{if(!_[_0xbc82('0x16')](queues[_0x1ae611[_0xbc82('0x5')]])){if(!_['isNil'](queues[_0x1ae611[_0xbc82('0x5')]][_0xbc82('0x63')])){utils[_0xbc82('0x17')](util['format'](_0xbc82('0x66'),_0x1ae611['uniqueid']),_0x1ae611);queues[_0x1ae611[_0xbc82('0x5')]][_0xbc82('0x5a')]+=utils[_0xbc82('0x36')](utils[_0xbc82('0x1d')](),queues[_0x1ae611[_0xbc82('0x5')]][_0xbc82('0x63')]);utils['info'](util[_0xbc82('0x12')](_0xbc82('0x67'),_0x1ae611['uniqueid'],queues[_0x1ae611[_0xbc82('0x5')]][_0xbc82('0x1e')],queues[_0x1ae611['uniqueid']][_0xbc82('0x5a')]));delete queues[_0x1ae611[_0xbc82('0x5')]][_0xbc82('0x63')];}}}catch(_0x526aef){utils[_0xbc82('0x21')](util[_0xbc82('0x12')](_0xbc82('0x66'),_0x1ae611[_0xbc82('0x5')]),_0x526aef);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0592e93..b298512 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 _0x1f03=['linkedid','context','exten','channel','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]'];(function(_0x4f02e8,_0x5ef794){var _0x4f72e5=function(_0xcfaaea){while(--_0xcfaaea){_0x4f02e8['push'](_0x4f02e8['shift']());}};_0x4f72e5(++_0x5ef794);}(_0x1f03,0xeb));var _0x31f0=function(_0x37de2e,_0x426ca9){_0x37de2e=_0x37de2e-0x0;var _0x1b1e94=_0x1f03[_0x37de2e];return _0x1b1e94;};'use strict';var _=require(_0x31f0('0x0'));var util=require(_0x31f0('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x41ec52){utils[_0x31f0('0x2')](util[_0x31f0('0x3')](_0x31f0('0x4'),_0x41ec52[_0x31f0('0x5')]));if(_0x41ec52[_0x31f0('0x6')]){utils[_0x31f0('0x7')](_0x41ec52[_0x31f0('0x6')])[_0x31f0('0x8')](function(_0x5305e8){if(_0x5305e8){_0x41ec52[_0x31f0('0x9')]=_0x5305e8[_0x31f0('0xa')];_0x41ec52[_0x31f0('0xb')]=_0x5305e8['id'];}utils['request'](_0x31f0('0xc'),_0x41ec52);});}else{utils[_0x31f0('0xd')](_0x31f0('0xc'),_0x41ec52);}}exports[_0x31f0('0xe')]=function(_0xa64377){try{utils[_0x31f0('0xf')](util[_0x31f0('0x3')](_0x31f0('0x10'),_0xa64377['uniqueid']),_0xa64377);if(_0xa64377[_0x31f0('0x5')]==_0xa64377[_0x31f0('0x11')]){utils[_0x31f0('0x2')](util[_0x31f0('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0xa64377['uniqueid'],_0xa64377[_0x31f0('0x12')],_0xa64377[_0x31f0('0x13')]));recordings[_0xa64377[_0x31f0('0x5')]]={'uniqueid':_0xa64377[_0x31f0('0x5')],'accountcode':_0xa64377[_0x31f0('0x6')],'exten':_0xa64377[_0x31f0('0x13')],'context':_0xa64377['context'],'channel':_0xa64377[_0x31f0('0x14')],'monitors':[]};}}catch(_0xeba6bb){utils['error'](util[_0x31f0('0x3')](_0x31f0('0x10'),_0xa64377[_0x31f0('0x5')]),_0xeba6bb);}};exports['newstate']=function(_0x1b5ae8){try{utils[_0x31f0('0xf')](util[_0x31f0('0x3')](_0x31f0('0x15'),_0x1b5ae8[_0x31f0('0x5')]),_0x1b5ae8);if(!_[_0x31f0('0x16')](recordings[_0x1b5ae8[_0x31f0('0x5')]])&&_0x1b5ae8[_0x31f0('0x17')]==0x6){utils[_0x31f0('0x2')](util[_0x31f0('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x1b5ae8['uniqueid'],_0x1b5ae8[_0x31f0('0x12')],_0x1b5ae8['channel']));}else if(!_[_0x31f0('0x16')](recordings[_0x1b5ae8[_0x31f0('0x11')]])&&_0x1b5ae8[_0x31f0('0x17')]==0x6&&_0x1b5ae8[_0x31f0('0x12')]!=_0x31f0('0x18')){utils[_0x31f0('0x2')](util[_0x31f0('0x3')](_0x31f0('0x19'),_0x1b5ae8[_0x31f0('0x5')],_0x1b5ae8[_0x31f0('0x11')],_0x1b5ae8['context'],_0x1b5ae8[_0x31f0('0x14')]));recordings[_0x1b5ae8[_0x31f0('0x11')]][_0x31f0('0x6')]=_0x1b5ae8[_0x31f0('0x6')];}}catch(_0x51f750){utils[_0x31f0('0x1a')](util[_0x31f0('0x3')]('[%s][recordings][newstate]',_0x1b5ae8[_0x31f0('0x5')]),_0x51f750);}};exports[_0x31f0('0x1b')]=function(_0x574847){try{if(!_[_0x31f0('0x16')](_0x574847[_0x31f0('0x1c')])&&!_[_0x31f0('0x16')](_0x574847['variable']['mixmonitor_filename'])){utils[_0x31f0('0xf')](util[_0x31f0('0x3')](_0x31f0('0x1d'),_0x574847[_0x31f0('0x5')]),_0x574847);utils[_0x31f0('0x2')](util[_0x31f0('0x3')](_0x31f0('0x1e'),_0x574847[_0x31f0('0x5')],_0x574847[_0x31f0('0x1c')],_0x574847[_0x31f0('0x1f')]));if(_[_0x31f0('0x20')](_0x574847[_0x31f0('0x1f')],_0x31f0('0x21'))){_0x574847['value']=_0x574847[_0x31f0('0x1f')][_0x31f0('0x22')]('.wav49',_0x31f0('0x23'));}if(recordings[_0x574847[_0x31f0('0x11')]]){var _0x3642a1=_['find'](recordings[_0x574847[_0x31f0('0x11')]][_0x31f0('0x24')],{'value':_0x574847[_0x31f0('0x1f')]});if(_['isNil'](_0x3642a1)){recordings[_0x574847[_0x31f0('0x11')]][_0x31f0('0x24')][_0x31f0('0x25')]({'value':_0x574847[_0x31f0('0x1f')]});}}}}catch(_0x13d4da){utils[_0x31f0('0x1a')](util[_0x31f0('0x3')](_0x31f0('0x1d'),_0x574847[_0x31f0('0x5')]),_0x13d4da);}};exports[_0x31f0('0x26')]=function(_0x1d2b6c){try{if(!_[_0x31f0('0x16')](recordings[_0x1d2b6c[_0x31f0('0x5')]])){utils['debug'](util['format']('[%s][recordings][hangup]',_0x1d2b6c[_0x31f0('0x5')]),_0x1d2b6c);utils[_0x31f0('0x2')](util[_0x31f0('0x3')](_0x31f0('0x27'),_0x1d2b6c[_0x31f0('0x5')],_0x1d2b6c[_0x31f0('0x28')],_0x1d2b6c[_0x31f0('0x29')],_0x1d2b6c[_0x31f0('0x2a')]));recordings[_0x1d2b6c['uniqueid']][_0x31f0('0x28')]=_0x1d2b6c[_0x31f0('0x28')];recordings[_0x1d2b6c[_0x31f0('0x5')]]['calleridname']=_0x1d2b6c[_0x31f0('0x29')];recordings[_0x1d2b6c[_0x31f0('0x5')]][_0x31f0('0x2b')]=_0x1d2b6c[_0x31f0('0x2b')];recordings[_0x1d2b6c['uniqueid']][_0x31f0('0x2c')]=_0x1d2b6c['connectedlinename'];if(recordings[_0x1d2b6c[_0x31f0('0x5')]][_0x31f0('0x2d')]==_0x31f0('0x2e')&&recordings[_0x1d2b6c[_0x31f0('0x5')]][_0x31f0('0x6')]){recordings[_0x1d2b6c[_0x31f0('0x5')]][_0x31f0('0x2b')]=recordings[_0x1d2b6c[_0x31f0('0x5')]]['accountcode'];recordings[_0x1d2b6c[_0x31f0('0x5')]]['connectedlinename']='';}recordings[_0x1d2b6c[_0x31f0('0x5')]]['monitors'][_0x31f0('0x2f')](function(_0x1b44d9){var _0x4f2730=_[_0x31f0('0x30')](recordings[_0x1d2b6c['uniqueid']]);_0x4f2730['value']=_0x1b44d9[_0x31f0('0x1f')];writeDB(_0x4f2730);});delete recordings[_0x1d2b6c[_0x31f0('0x5')]];}}catch(_0x116f0c){utils['error'](util[_0x31f0('0x3')](_0x31f0('0x31'),_0x1d2b6c[_0x31f0('0x5')]),_0x116f0c);}};exports['newexten']=function(_0x5f55e7){try{if(!_['isNil'](recordings[_0x5f55e7['uniqueid']])){utils[_0x31f0('0xf')](util['format']('[%s][recordings][newexten]',_0x5f55e7[_0x31f0('0x5')]),_0x5f55e7);utils[_0x31f0('0x2')](util['format'](_0x31f0('0x32'),_0x5f55e7[_0x31f0('0x5')],_0x5f55e7[_0x31f0('0x33')],_0x5f55e7[_0x31f0('0x34')]));if(_0x5f55e7[_0x31f0('0x33')][_0x31f0('0x35')]()==_0x31f0('0x36')&&_[_0x31f0('0x37')](_0x5f55e7[_0x31f0('0x34')]['toLowerCase'](),_0x31f0('0x38'))){var _0x225ce7=_0x5f55e7[_0x31f0('0x34')]['split']('=');var _0x50b465=_0x225ce7[0x0]['substring'](_0x225ce7[0x0]['lastIndexOf']('(')+0x1,_0x225ce7[0x0][_0x31f0('0x39')](')'));var _0x5e6cb2=_0x225ce7[0x1];recordings[_0x5f55e7[_0x31f0('0x5')]][_0x50b465]=_0x5e6cb2;}}}catch(_0x1fe1bb){utils[_0x31f0('0x1a')](util[_0x31f0('0x3')](_0x31f0('0x3a'),_0x5f55e7['uniqueid']),_0x1fe1bb);}};exports[_0x31f0('0x3b')]=function(_0x459085){try{if(!_[_0x31f0('0x16')](recordings[_0x459085[_0x31f0('0x5')]])){utils[_0x31f0('0xf')](util[_0x31f0('0x3')](_0x31f0('0x3c'),_0x459085[_0x31f0('0x5')]),_0x459085);utils[_0x31f0('0x2')](util[_0x31f0('0x3')](_0x31f0('0x3d'),_0x459085[_0x31f0('0x5')],_0x459085['queue']));recordings[_0x459085[_0x31f0('0x5')]][_0x31f0('0x3e')]=_0x459085['queue'];}}catch(_0x12ffa7){utils[_0x31f0('0x1a')](util[_0x31f0('0x3')]('[%s][recordings][queuecallerjoin]',_0x459085[_0x31f0('0x5')]),_0x12ffa7);}}; \ No newline at end of file +var _0x9026=['format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','debug','value','.wav49','replace','.WAV','monitors','push','[%s][recordings][varset]','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x9026,0x171));var _0x6902=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x9026[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require(_0x6902('0x0'));var utils=require(_0x6902('0x1'));var recordings={};function writeDB(_0x3df157){utils[_0x6902('0x2')](util[_0x6902('0x3')](_0x6902('0x4'),_0x3df157[_0x6902('0x5')]));if(_0x3df157[_0x6902('0x6')]){utils[_0x6902('0x7')](_0x3df157[_0x6902('0x6')])[_0x6902('0x8')](function(_0x5318c6){if(_0x5318c6){_0x3df157[_0x6902('0x9')]=_0x5318c6[_0x6902('0xa')];_0x3df157[_0x6902('0xb')]=_0x5318c6['id'];}utils['request'](_0x6902('0xc'),_0x3df157);});}else{utils[_0x6902('0xd')](_0x6902('0xc'),_0x3df157);}}exports[_0x6902('0xe')]=function(_0xc5f1b2){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0xc5f1b2[_0x6902('0x5')]),_0xc5f1b2);if(_0xc5f1b2[_0x6902('0x5')]==_0xc5f1b2[_0x6902('0xf')]){utils['info'](util[_0x6902('0x3')](_0x6902('0x10'),_0xc5f1b2['uniqueid'],_0xc5f1b2[_0x6902('0x11')],_0xc5f1b2[_0x6902('0x12')]));recordings[_0xc5f1b2['uniqueid']]={'uniqueid':_0xc5f1b2['uniqueid'],'accountcode':_0xc5f1b2[_0x6902('0x6')],'exten':_0xc5f1b2[_0x6902('0x12')],'context':_0xc5f1b2[_0x6902('0x11')],'channel':_0xc5f1b2[_0x6902('0x13')],'monitors':[]};}}catch(_0x39d381){utils[_0x6902('0x14')](util[_0x6902('0x3')]('[%s][recordings][newchannel]',_0xc5f1b2[_0x6902('0x5')]),_0x39d381);}};exports[_0x6902('0x15')]=function(_0xadb965){try{utils['debug'](util['format'](_0x6902('0x16'),_0xadb965[_0x6902('0x5')]),_0xadb965);if(!_[_0x6902('0x17')](recordings[_0xadb965[_0x6902('0x5')]])&&_0xadb965[_0x6902('0x18')]==0x6){utils[_0x6902('0x2')](util[_0x6902('0x3')](_0x6902('0x19'),_0xadb965[_0x6902('0x5')],_0xadb965[_0x6902('0x11')],_0xadb965[_0x6902('0x13')]));}else if(!_['isNil'](recordings[_0xadb965['linkedid']])&&_0xadb965['channelstate']==0x6&&_0xadb965[_0x6902('0x11')]!='transfer'){utils[_0x6902('0x2')](util[_0x6902('0x3')](_0x6902('0x1a'),_0xadb965['uniqueid'],_0xadb965[_0x6902('0xf')],_0xadb965[_0x6902('0x11')],_0xadb965[_0x6902('0x13')]));recordings[_0xadb965['linkedid']][_0x6902('0x6')]=_0xadb965[_0x6902('0x6')];}}catch(_0x410bc8){utils['error'](util[_0x6902('0x3')](_0x6902('0x16'),_0xadb965[_0x6902('0x5')]),_0x410bc8);}};exports[_0x6902('0x1b')]=function(_0x155461){try{if(!_[_0x6902('0x17')](_0x155461[_0x6902('0x1c')])&&!_[_0x6902('0x17')](_0x155461[_0x6902('0x1c')][_0x6902('0x1d')])){utils[_0x6902('0x1e')](util[_0x6902('0x3')]('[%s][recordings][varset]',_0x155461[_0x6902('0x5')]),_0x155461);utils[_0x6902('0x2')](util[_0x6902('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x155461['uniqueid'],_0x155461[_0x6902('0x1c')],_0x155461[_0x6902('0x1f')]));if(_['endsWith'](_0x155461[_0x6902('0x1f')],_0x6902('0x20'))){_0x155461[_0x6902('0x1f')]=_0x155461['value'][_0x6902('0x21')](_0x6902('0x20'),_0x6902('0x22'));}if(recordings[_0x155461[_0x6902('0xf')]]){var _0x1d2c81=_['find'](recordings[_0x155461[_0x6902('0xf')]][_0x6902('0x23')],{'value':_0x155461[_0x6902('0x1f')]});if(_[_0x6902('0x17')](_0x1d2c81)){recordings[_0x155461['linkedid']]['monitors'][_0x6902('0x24')]({'value':_0x155461[_0x6902('0x1f')]});}}}}catch(_0xf841f3){utils[_0x6902('0x14')](util[_0x6902('0x3')](_0x6902('0x25'),_0x155461[_0x6902('0x5')]),_0xf841f3);}};exports[_0x6902('0x26')]=function(_0x3a0659){try{if(!_[_0x6902('0x17')](recordings[_0x3a0659[_0x6902('0x5')]])){utils[_0x6902('0x1e')](util[_0x6902('0x3')]('[%s][recordings][hangup]',_0x3a0659[_0x6902('0x5')]),_0x3a0659);utils[_0x6902('0x2')](util[_0x6902('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3a0659[_0x6902('0x5')],_0x3a0659[_0x6902('0x27')],_0x3a0659['calleridname'],_0x3a0659['cause-txt']));recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x27')]=_0x3a0659[_0x6902('0x27')];recordings[_0x3a0659[_0x6902('0x5')]]['calleridname']=_0x3a0659[_0x6902('0x28')];recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x29')]=_0x3a0659[_0x6902('0x29')];recordings[_0x3a0659[_0x6902('0x5')]]['connectedlinename']=_0x3a0659[_0x6902('0x2a')];if(recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x2b')]==_0x6902('0x2c')&&recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x6')]){recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x29')]=recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x6')];recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x2a')]='';}recordings[_0x3a0659[_0x6902('0x5')]][_0x6902('0x23')][_0x6902('0x2d')](function(_0x4f7e4a){var _0x105634=_['clone'](recordings[_0x3a0659[_0x6902('0x5')]]);_0x105634['value']=_0x4f7e4a[_0x6902('0x1f')];writeDB(_0x105634);});delete recordings[_0x3a0659[_0x6902('0x5')]];}}catch(_0x4e76f8){utils['error'](util[_0x6902('0x3')](_0x6902('0x2e'),_0x3a0659[_0x6902('0x5')]),_0x4e76f8);}};exports[_0x6902('0x2f')]=function(_0x267da0){try{if(!_[_0x6902('0x17')](recordings[_0x267da0['uniqueid']])){utils[_0x6902('0x1e')](util['format']('[%s][recordings][newexten]',_0x267da0['uniqueid']),_0x267da0);utils[_0x6902('0x2')](util['format'](_0x6902('0x30'),_0x267da0[_0x6902('0x5')],_0x267da0[_0x6902('0x31')],_0x267da0[_0x6902('0x32')]));if(_0x267da0[_0x6902('0x31')][_0x6902('0x33')]()==_0x6902('0x34')&&_[_0x6902('0x35')](_0x267da0[_0x6902('0x32')]['toLowerCase'](),_0x6902('0x36'))){var _0x102e96=_0x267da0[_0x6902('0x32')]['split']('=');var _0x5489db=_0x102e96[0x0][_0x6902('0x37')](_0x102e96[0x0]['lastIndexOf']('(')+0x1,_0x102e96[0x0][_0x6902('0x38')](')'));var _0x2afe36=_0x102e96[0x1];recordings[_0x267da0[_0x6902('0x5')]][_0x5489db]=_0x2afe36;}}}catch(_0x1e4ca9){utils[_0x6902('0x14')](util[_0x6902('0x3')](_0x6902('0x39'),_0x267da0['uniqueid']),_0x1e4ca9);}};exports[_0x6902('0x3a')]=function(_0x5cfa9d){try{if(!_[_0x6902('0x17')](recordings[_0x5cfa9d[_0x6902('0x5')]])){utils[_0x6902('0x1e')](util[_0x6902('0x3')](_0x6902('0x3b'),_0x5cfa9d[_0x6902('0x5')]),_0x5cfa9d);utils[_0x6902('0x2')](util[_0x6902('0x3')](_0x6902('0x3c'),_0x5cfa9d[_0x6902('0x5')],_0x5cfa9d[_0x6902('0x3d')]));recordings[_0x5cfa9d['uniqueid']]['queue']=_0x5cfa9d[_0x6902('0x3d')];}}catch(_0x1f590f){utils[_0x6902('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x5cfa9d[_0x6902('0x5')]),_0x1f590f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b9f2b9f..4a503b7 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 _0xcc94=['transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum'];(function(_0xf64c11,_0x1d2315){var _0x38e9b6=function(_0x97ff5e){while(--_0x97ff5e){_0xf64c11['push'](_0xf64c11['shift']());}};_0x38e9b6(++_0x1d2315);}(_0xcc94,0x86));var _0x4cc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc94[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4cc9('0x0'));var util=require(_0x4cc9('0x1'));var utils=require(_0x4cc9('0x2'));function writeDB(_0x166998){utils[_0x4cc9('0x3')](util[_0x4cc9('0x4')](_0x4cc9('0x5'),_0x166998[_0x4cc9('0x6')]===_0x4cc9('0x7')?_0x166998[_0x4cc9('0x8')]:_0x166998[_0x4cc9('0x9')],_0x166998['type']));utils[_0x4cc9('0xa')](_0x4cc9('0xb'),_0x166998);}exports[_0x4cc9('0xc')]={};exports[_0x4cc9('0xd')]=function(_0x12fbd5){try{utils[_0x4cc9('0xe')](util[_0x4cc9('0x4')](_0x4cc9('0xf'),_0x12fbd5[_0x4cc9('0x9')]),_0x12fbd5);utils['info'](util[_0x4cc9('0x4')](_0x4cc9('0x10'),_0x12fbd5[_0x4cc9('0x9')],_0x12fbd5[_0x4cc9('0x11')],_0x12fbd5[_0x4cc9('0x12')],_0x12fbd5[_0x4cc9('0x13')],_0x12fbd5['transfereecalleridname']));_0x12fbd5[_0x4cc9('0x6')]='blind';exports['blinds'][_0x12fbd5['transfereruniqueid']]=_0x12fbd5;writeDB(_0x12fbd5);}catch(_0x25032e){utils[_0x4cc9('0x14')](util[_0x4cc9('0x4')](_0x4cc9('0xf'),_0x12fbd5['uniqueid']),_0x25032e);}};exports[_0x4cc9('0x15')]=function(_0x143685){try{utils[_0x4cc9('0xe')](util[_0x4cc9('0x4')](_0x4cc9('0x16'),_0x143685[_0x4cc9('0x8')]),_0x143685);utils[_0x4cc9('0x3')](util[_0x4cc9('0x4')](_0x4cc9('0x17'),_0x143685['origtransfereruniqueid'],_0x143685[_0x4cc9('0x18')],_0x143685['origtransferercalleridname'],_0x143685[_0x4cc9('0x19')],_0x143685[_0x4cc9('0x1a')]));_0x143685=_[_0x4cc9('0x1b')](_0x143685,{'transfererchannel':_0x143685[_0x4cc9('0x1c')],'transferercalleridnum':_0x143685[_0x4cc9('0x18')],'transferercalleridname':_0x143685[_0x4cc9('0x1d')],'transfererconnectedlinenum':_0x143685[_0x4cc9('0x1e')],'transfererconnectedlinename':_0x143685[_0x4cc9('0x1f')],'transfereraccountcode':_0x143685['origtransfereraccountcode'],'transferercontext':_0x143685[_0x4cc9('0x20')],'transfererexten':_0x143685[_0x4cc9('0x21')],'transfererlinkedid':_0x143685['origtransfererlinkedid'],'context':_0x143685['origtransferercontext'],'extension':_0x143685['origtransfererexten'],'type':_0x4cc9('0x7')});if(_[_0x4cc9('0x22')](_0x143685[_0x4cc9('0x23')])){_0x143685=_[_0x4cc9('0x1b')](_0x143685,{'transfereechannel':_0x143685[_0x4cc9('0x24')],'transfereecalleridnum':_0x143685[_0x4cc9('0x19')],'transfereecalleridname':_0x143685['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x143685['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x143685['transfertargetconnectedlinename'],'transfereeaccountcode':_0x143685['transfertargetaccountcode'],'transfereecontext':_0x143685[_0x4cc9('0x25')],'transfereeexten':_0x143685[_0x4cc9('0x26')],'transfereelinkedid':_0x143685[_0x4cc9('0x27')]});}writeDB(_0x143685);}catch(_0x160e6c){utils[_0x4cc9('0x14')](util['format']('[%s][transfers][attendedtransfer]',_0x143685[_0x4cc9('0x8')]),_0x160e6c);}}; \ No newline at end of file +var _0x123e=['util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash'];(function(_0x44826d,_0x298148){var _0x1e76c7=function(_0x57a795){while(--_0x57a795){_0x44826d['push'](_0x44826d['shift']());}};_0x1e76c7(++_0x298148);}(_0x123e,0x7a));var _0xe123=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x123e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe123('0x0'));var util=require(_0xe123('0x1'));var utils=require(_0xe123('0x2'));function writeDB(_0x1d3091){utils[_0xe123('0x3')](util[_0xe123('0x4')](_0xe123('0x5'),_0x1d3091[_0xe123('0x6')]===_0xe123('0x7')?_0x1d3091['origtransfereruniqueid']:_0x1d3091[_0xe123('0x8')],_0x1d3091['type']));utils[_0xe123('0x9')]('CreateVoiceTransferReport',_0x1d3091);}exports[_0xe123('0xa')]={};exports[_0xe123('0xb')]=function(_0x12b37e){try{utils[_0xe123('0xc')](util[_0xe123('0x4')](_0xe123('0xd'),_0x12b37e[_0xe123('0x8')]),_0x12b37e);utils[_0xe123('0x3')](util['format'](_0xe123('0xe'),_0x12b37e[_0xe123('0x8')],_0x12b37e[_0xe123('0xf')],_0x12b37e[_0xe123('0x10')],_0x12b37e['transfereecalleridnum'],_0x12b37e['transfereecalleridname']));_0x12b37e[_0xe123('0x6')]='blind';exports[_0xe123('0xa')][_0x12b37e[_0xe123('0x11')]]=_0x12b37e;writeDB(_0x12b37e);}catch(_0x47adaf){utils[_0xe123('0x12')](util[_0xe123('0x4')](_0xe123('0xd'),_0x12b37e[_0xe123('0x8')]),_0x47adaf);}};exports[_0xe123('0x13')]=function(_0x1fe3ea){try{utils[_0xe123('0xc')](util[_0xe123('0x4')](_0xe123('0x14'),_0x1fe3ea[_0xe123('0x15')]),_0x1fe3ea);utils[_0xe123('0x3')](util['format'](_0xe123('0x16'),_0x1fe3ea[_0xe123('0x15')],_0x1fe3ea[_0xe123('0x17')],_0x1fe3ea[_0xe123('0x18')],_0x1fe3ea[_0xe123('0x19')],_0x1fe3ea['transfertargetcalleridname']));_0x1fe3ea=_['assign'](_0x1fe3ea,{'transfererchannel':_0x1fe3ea[_0xe123('0x1a')],'transferercalleridnum':_0x1fe3ea[_0xe123('0x17')],'transferercalleridname':_0x1fe3ea[_0xe123('0x18')],'transfererconnectedlinenum':_0x1fe3ea[_0xe123('0x1b')],'transfererconnectedlinename':_0x1fe3ea[_0xe123('0x1c')],'transfereraccountcode':_0x1fe3ea[_0xe123('0x1d')],'transferercontext':_0x1fe3ea[_0xe123('0x1e')],'transfererexten':_0x1fe3ea[_0xe123('0x1f')],'transfererlinkedid':_0x1fe3ea[_0xe123('0x20')],'context':_0x1fe3ea['origtransferercontext'],'extension':_0x1fe3ea[_0xe123('0x21')],'type':'attended'});if(_['isNil'](_0x1fe3ea[_0xe123('0x22')])){_0x1fe3ea=_['assign'](_0x1fe3ea,{'transfereechannel':_0x1fe3ea['transfertargetchannel'],'transfereecalleridnum':_0x1fe3ea[_0xe123('0x19')],'transfereecalleridname':_0x1fe3ea[_0xe123('0x23')],'transfereeconnectedlinenum':_0x1fe3ea[_0xe123('0x24')],'transfereeconnectedlinename':_0x1fe3ea['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1fe3ea[_0xe123('0x25')],'transfereecontext':_0x1fe3ea[_0xe123('0x26')],'transfereeexten':_0x1fe3ea[_0xe123('0x27')],'transfereelinkedid':_0x1fe3ea[_0xe123('0x28')]});}writeDB(_0x1fe3ea);}catch(_0xfa158e){utils[_0xe123('0x12')](util['format'](_0xe123('0x14'),_0x1fe3ea[_0xe123('0x15')]),_0xfa158e);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d40acf3..8e6f421 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 _0x7166=['bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','format','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter','isBefore'];(function(_0x7c8ac9,_0x22001a){var _0x1ace96=function(_0x47866b){while(--_0x47866b){_0x7c8ac9['push'](_0x7c8ac9['shift']());}};_0x1ace96(++_0x22001a);}(_0x7166,0x90));var _0x6716=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x7166[_0x503790];return _0x388092;};'use strict';var BPromise=require(_0x6716('0x0'));var jayson=require(_0x6716('0x1'));var moment=require(_0x6716('0x2'));var util=require('util');var client=jayson[_0x6716('0x3')][_0x6716('0x4')]({'port':0x2329});var logger=require(_0x6716('0x5'))(_0x6716('0x6'));exports['info']=function(_0x3b711d,_0x26d51b){logger[_0x6716('0x7')](_0x3b711d,_0x26d51b?util[_0x6716('0x8')](_0x26d51b,{'showHidden':![],'depth':null}):'');};exports[_0x6716('0x9')]=function(_0x29260f,_0xd68301){logger[_0x6716('0x9')](_0x29260f,_0xd68301?util[_0x6716('0x8')](_0xd68301,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3855cc,_0x45d9fe){logger[_0x6716('0xa')](_0x3855cc,_0x45d9fe?util[_0x6716('0x8')](_0x45d9fe,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3dbc74,_0x42864c){return client[_0x6716('0xb')](_0x3dbc74,{'body':_0x42864c})[_0x6716('0xc')](function(_0x563186){logger['debug'](_0x6716('0xd'),_0x3dbc74,_0x563186?util['inspect'](_0x563186,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3b850e){logger[_0x6716('0xa')](_0x6716('0xd'),_0x3dbc74,_0x3b850e?util['inspect'](_0x3b850e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x11f17){return client[_0x6716('0xb')](_0x6716('0xe'),{'options':{'raw':!![],'attributes':['id',_0x6716('0xf'),_0x6716('0x10'),_0x6716('0x11')],'where':_0x11f17,'limit':0x1}})['then'](function(_0x55fae3){logger['debug'](_0x6716('0x12'),JSON[_0x6716('0x13')](_0x11f17),_0x55fae3?util[_0x6716('0x8')](_0x55fae3,{'showHidden':![],'depth':null}):'');return _0x55fae3[_0x6716('0x14')][_0x6716('0x15')]?_0x55fae3[_0x6716('0x14')][0x0]:null;});}exports[_0x6716('0x16')]=function(_0x1c8c80){return new BPromise(function(_0x5317e6,_0x4b1970){if(_0x1c8c80){return getUser({'internal':_0x1c8c80})['then'](function(_0x2782bb){logger[_0x6716('0x7')](_0x6716('0x17'),_0x1c8c80,_0x2782bb?_0x6716('0x18'):'notfound');return _0x5317e6(_0x2782bb);})[_0x6716('0x19')](function(_0x509843){logger[_0x6716('0xa')]('[utils][getUserByInternal]',_0x509843?util[_0x6716('0x8')](_0x509843,{'showHidden':![],'depth':null}):'');return _0x5317e6(null);});}return _0x5317e6(null);});};exports['getUserByInterface']=function(_0x4064a8){return new BPromise(function(_0xad6860,_0x2915c2){if(_0x4064a8){return getUser({'interface':_0x4064a8})[_0x6716('0xc')](function(_0x4c81c1){logger[_0x6716('0x7')](_0x6716('0x1a'),_0x4064a8,_0x4c81c1?_0x6716('0x18'):_0x6716('0x1b'));return _0xad6860(_0x4c81c1);})[_0x6716('0x19')](function(_0x659288){logger[_0x6716('0xa')](_0x6716('0x1c'),_0x659288?util[_0x6716('0x8')](_0x659288,{'showHidden':![],'depth':null}):'');return _0xad6860(null);});}return _0xad6860(null);});};exports['getUserByName']=function(_0x54d053){return new BPromise(function(_0x20bb8a,_0x3f5b3e){if(_0x54d053){return getUser({'name':_0x54d053})[_0x6716('0xc')](function(_0x479ab2){logger[_0x6716('0x7')](_0x6716('0x1d'),_0x54d053,_0x479ab2?_0x6716('0x18'):_0x6716('0x1b'));return _0x20bb8a(_0x479ab2);})[_0x6716('0x19')](function(_0x1e2e6f){logger[_0x6716('0xa')](_0x6716('0x1e'),_0x1e2e6f?util[_0x6716('0x8')](_0x1e2e6f,{'showHidden':![],'depth':null}):'');return _0x20bb8a(null);});}return _0x20bb8a(null);});};exports[_0x6716('0x1f')]=function(_0x2fce91){return new BPromise(function(_0x25435f,_0x1deec9){if(_0x2fce91){return client[_0x6716('0xb')](_0x6716('0x20'),{'options':{'raw':!![],'attributes':['id',_0x6716('0x10'),_0x6716('0x21'),_0x6716('0x22'),_0x6716('0x23')],'where':{'name':_0x2fce91},'limit':0x1}})[_0x6716('0xc')](function(_0x27a4ae){logger[_0x6716('0x9')](_0x6716('0x24'),_0x2fce91,_0x27a4ae?util[_0x6716('0x8')](_0x27a4ae,{'showHidden':![],'depth':null}):'');logger[_0x6716('0x7')](_0x6716('0x25'),_0x2fce91,_0x27a4ae?_0x6716('0x18'):_0x6716('0x1b'));return _0x25435f(_0x27a4ae[_0x6716('0x14')][_0x6716('0x15')]?_0x27a4ae[_0x6716('0x14')][0x0]:null);})[_0x6716('0x19')](function(_0x48dc05){logger[_0x6716('0xa')]('[utils][getVoiceQueueByName]',_0x48dc05?util['inspect'](_0x48dc05,{'showHidden':![],'depth':null}):'');return _0x25435f(null);});}return _0x25435f(null);});};exports['addTime']=function(_0x1e5882,_0xa07880){return moment(_0x1e5882)[_0x6716('0x26')](_0xa07880,'seconds')[_0x6716('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6716('0x28')]=function(_0x54b0b2,_0x1182e0){return moment(_0x54b0b2)[_0x6716('0x29')](_0x1182e0,_0x6716('0x2a'))[_0x6716('0x27')](_0x6716('0x2b'));};exports['diffTime']=function(_0x104c95,_0x1efc07){return moment(_0x104c95)[_0x6716('0x2c')](moment(_0x1efc07),_0x6716('0x2a'));};exports['sumTime']=function(_0x31696b,_0x5fcdbc){return parseInt(_0x31696b,0xa)+parseInt(_0x5fcdbc,0xa);};exports[_0x6716('0x2d')]=function(){return moment()['format'](_0x6716('0x2b'));};exports[_0x6716('0x2e')]=function(_0x502ddc,_0x50a5a3){if(_0x50a5a3){return moment(_0x502ddc)[_0x6716('0x2e')](_0x50a5a3);}return!![];};exports[_0x6716('0x2f')]=function(_0x4a2783,_0xaf5030){if(_0xaf5030){return moment(_0x4a2783)[_0x6716('0x2f')](_0xaf5030);}else if(_0x4a2783){return!![];}return![];}; \ No newline at end of file +var _0x814b=['http','xdr','info','inspect','error','request','then','debug','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client'];(function(_0x58b603,_0x450f6d){var _0xf76126=function(_0x5688da){while(--_0x5688da){_0x58b603['push'](_0x58b603['shift']());}};_0xf76126(++_0x450f6d);}(_0x814b,0x1a2));var _0xb814=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x814b[_0x20845e];return _0x28cf2b;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var client=jayson[_0xb814('0x4')][_0xb814('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xb814('0x6'));exports[_0xb814('0x7')]=function(_0x258866,_0x4237bc){logger[_0xb814('0x7')](_0x258866,_0x4237bc?util[_0xb814('0x8')](_0x4237bc,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3b0829,_0x2e6272){logger['debug'](_0x3b0829,_0x2e6272?util[_0xb814('0x8')](_0x2e6272,{'showHidden':![],'depth':null}):'');};exports[_0xb814('0x9')]=function(_0x186d5a,_0x41166c){logger[_0xb814('0x9')](_0x186d5a,_0x41166c?util[_0xb814('0x8')](_0x41166c,{'showHidden':![],'depth':null}):'');};exports[_0xb814('0xa')]=function(_0x19aad8,_0x207dbc){return client[_0xb814('0xa')](_0x19aad8,{'body':_0x207dbc})[_0xb814('0xb')](function(_0x4b5f14){logger[_0xb814('0xc')]('[utils][request]\x20name:%s',_0x19aad8,_0x4b5f14?util[_0xb814('0x8')](_0x4b5f14,{'showHidden':![],'depth':null}):'');})[_0xb814('0xd')](function(_0x35b10d){logger[_0xb814('0x9')](_0xb814('0xe'),_0x19aad8,_0x35b10d?util[_0xb814('0x8')](_0x35b10d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1438e7){return client[_0xb814('0xa')](_0xb814('0xf'),{'options':{'raw':!![],'attributes':['id',_0xb814('0x10'),_0xb814('0x11'),_0xb814('0x12')],'where':_0x1438e7,'limit':0x1}})[_0xb814('0xb')](function(_0x39bfcf){logger[_0xb814('0xc')](_0xb814('0x13'),JSON[_0xb814('0x14')](_0x1438e7),_0x39bfcf?util[_0xb814('0x8')](_0x39bfcf,{'showHidden':![],'depth':null}):'');return _0x39bfcf[_0xb814('0x15')][_0xb814('0x16')]?_0x39bfcf[_0xb814('0x15')][0x0]:null;});}exports['getUserByInternal']=function(_0x168a48){return new BPromise(function(_0x55ba16,_0x270598){if(_0x168a48){return getUser({'internal':_0x168a48})[_0xb814('0xb')](function(_0x4c3007){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x168a48,_0x4c3007?_0xb814('0x17'):'notfound');return _0x55ba16(_0x4c3007);})['catch'](function(_0xb684ea){logger[_0xb814('0x9')](_0xb814('0x18'),_0xb684ea?util['inspect'](_0xb684ea,{'showHidden':![],'depth':null}):'');return _0x55ba16(null);});}return _0x55ba16(null);});};exports[_0xb814('0x19')]=function(_0x531032){return new BPromise(function(_0x1e6393,_0x1808a3){if(_0x531032){return getUser({'interface':_0x531032})[_0xb814('0xb')](function(_0x470e81){logger[_0xb814('0x7')](_0xb814('0x1a'),_0x531032,_0x470e81?_0xb814('0x17'):'notfound');return _0x1e6393(_0x470e81);})[_0xb814('0xd')](function(_0x52b7a3){logger[_0xb814('0x9')](_0xb814('0x1b'),_0x52b7a3?util[_0xb814('0x8')](_0x52b7a3,{'showHidden':![],'depth':null}):'');return _0x1e6393(null);});}return _0x1e6393(null);});};exports[_0xb814('0x1c')]=function(_0x1c8a2e){return new BPromise(function(_0xb9e57d,_0x3d836c){if(_0x1c8a2e){return getUser({'name':_0x1c8a2e})['then'](function(_0x392222){logger[_0xb814('0x7')](_0xb814('0x1d'),_0x1c8a2e,_0x392222?_0xb814('0x17'):_0xb814('0x1e'));return _0xb9e57d(_0x392222);})[_0xb814('0xd')](function(_0x3f0150){logger[_0xb814('0x9')]('[utils][getUserByName]',_0x3f0150?util[_0xb814('0x8')](_0x3f0150,{'showHidden':![],'depth':null}):'');return _0xb9e57d(null);});}return _0xb9e57d(null);});};exports[_0xb814('0x1f')]=function(_0x52ed64){return new BPromise(function(_0x9008b2,_0x37d24d){if(_0x52ed64){return client[_0xb814('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xb814('0x11'),_0xb814('0x20'),'acw',_0xb814('0x21')],'where':{'name':_0x52ed64},'limit':0x1}})['then'](function(_0x6efe9a){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x52ed64,_0x6efe9a?util[_0xb814('0x8')](_0x6efe9a,{'showHidden':![],'depth':null}):'');logger['info'](_0xb814('0x22'),_0x52ed64,_0x6efe9a?_0xb814('0x17'):_0xb814('0x1e'));return _0x9008b2(_0x6efe9a['result']['length']?_0x6efe9a[_0xb814('0x15')][0x0]:null);})[_0xb814('0xd')](function(_0x523566){logger[_0xb814('0x9')](_0xb814('0x23'),_0x523566?util[_0xb814('0x8')](_0x523566,{'showHidden':![],'depth':null}):'');return _0x9008b2(null);});}return _0x9008b2(null);});};exports[_0xb814('0x24')]=function(_0x1b78de,_0x60024d){return moment(_0x1b78de)[_0xb814('0x25')](_0x60024d,'seconds')[_0xb814('0x26')](_0xb814('0x27'));};exports[_0xb814('0x28')]=function(_0x424e2b,_0x14100d){return moment(_0x424e2b)['subtract'](_0x14100d,_0xb814('0x29'))['format'](_0xb814('0x27'));};exports[_0xb814('0x2a')]=function(_0xe0f509,_0x492d5e){return moment(_0xe0f509)[_0xb814('0x2b')](moment(_0x492d5e),_0xb814('0x29'));};exports['sumTime']=function(_0x2fcd92,_0x2d0e27){return parseInt(_0x2fcd92,0xa)+parseInt(_0x2d0e27,0xa);};exports[_0xb814('0x2c')]=function(){return moment()[_0xb814('0x26')](_0xb814('0x27'));};exports[_0xb814('0x2d')]=function(_0x4d81eb,_0xa6ce87){if(_0xa6ce87){return moment(_0x4d81eb)['isAfter'](_0xa6ce87);}return!![];};exports[_0xb814('0x2e')]=function(_0x4b5583,_0x4492ef){if(_0x4492ef){return moment(_0x4b5583)['isBefore'](_0x4492ef);}else if(_0x4b5583){return!![];}return![];}; \ No newline at end of file